fix: resolve oxlint warnings — suppress false positives, remove unused imports (#22687)

This commit is contained in:
Kit Langton
2026-04-15 21:33:54 -04:00
committed by GitHub
parent bbdbc107ae
commit f7d4665e40
80 changed files with 82 additions and 106 deletions

View File

@@ -4,7 +4,13 @@
// Effect uses `function*` with Effect.gen/Effect.fnUntraced that don't always yield // Effect uses `function*` with Effect.gen/Effect.fnUntraced that don't always yield
"require-yield": "off", "require-yield": "off",
// SolidJS uses `let ref: T | undefined` for JSX ref bindings assigned at runtime // SolidJS uses `let ref: T | undefined` for JSX ref bindings assigned at runtime
"no-unassigned-vars": "off" "no-unassigned-vars": "off",
// SolidJS tracks reactive deps by reading properties inside createEffect
"no-unused-expressions": "off",
// Intentional control char matching (ANSI escapes, null byte sanitization)
"no-control-regex": "off",
// SST and plugin tools require triple-slash references
"triple-slash-reference": "off"
}, },
"ignorePatterns": ["**/node_modules", "**/dist", "**/.build", "**/.sst", "**/*.d.ts"] "ignorePatterns": ["**/node_modules", "**/dist", "**/.build", "**/.sst", "**/*.d.ts"]
} }

View File

@@ -281,7 +281,7 @@ async function assertOpencodeConnected() {
}) })
connected = true connected = true
break break
} catch (e) {} } catch {}
await sleep(300) await sleep(300)
} while (retry++ < 30) } while (retry++ < 30)
@@ -561,7 +561,7 @@ async function subscribeSessionEvents() {
if (evt.properties.info.id !== session.id) continue if (evt.properties.info.id !== session.id) continue
session = evt.properties.info session = evt.properties.info
} }
} catch (e) { } catch {
// Ignore parse errors // Ignore parse errors
} }
} }
@@ -576,7 +576,7 @@ async function subscribeSessionEvents() {
async function summarize(response: string) { async function summarize(response: string) {
try { try {
return await chat(`Summarize the following in less than 40 characters:\n\n${response}`) return await chat(`Summarize the following in less than 40 characters:\n\n${response}`)
} catch (e) { } catch {
if (isScheduleEvent()) { if (isScheduleEvent()) {
return "Scheduled task changes" return "Scheduled task changes"
} }

View File

@@ -1,5 +1,5 @@
import { SECRET } from "./secret" import { SECRET } from "./secret"
import { domain, shortDomain } from "./stage" import { shortDomain } from "./stage"
const storage = new sst.cloudflare.Bucket("EnterpriseStorage") const storage = new sst.cloudflare.Bucket("EnterpriseStorage")

View File

@@ -258,8 +258,8 @@ class StringSerializeHandler extends BaseSerializeHandler {
} }
protected _beforeSerialize(rows: number, start: number, _end: number): void { protected _beforeSerialize(rows: number, start: number, _end: number): void {
this._allRows = new Array<string>(rows) this._allRows = Array.from<string>({ length: rows })
this._allRowSeparators = new Array<string>(rows) this._allRowSeparators = Array.from<string>({ length: rows })
this._rowIndex = 0 this._rowIndex = 0
this._currentRow = "" this._currentRow = ""

View File

@@ -8,7 +8,7 @@ import { Spinner } from "@opencode-ai/ui/spinner"
import { showToast } from "@opencode-ai/ui/toast" import { showToast } from "@opencode-ai/ui/toast"
import { Tooltip, TooltipKeybind } from "@opencode-ai/ui/tooltip" import { Tooltip, TooltipKeybind } from "@opencode-ai/ui/tooltip"
import { getFilename } from "@opencode-ai/shared/util/path" import { getFilename } from "@opencode-ai/shared/util/path"
import { createEffect, createMemo, For, onCleanup, Show } from "solid-js" import { createEffect, createMemo, For, Show } from "solid-js"
import { createStore } from "solid-js/store" import { createStore } from "solid-js/store"
import { Portal } from "solid-js/web" import { Portal } from "solid-js/web"
import { useCommand } from "@/context/command" import { useCommand } from "@/context/command"

View File

@@ -1,4 +1,4 @@
import { createEffect, createMemo, onCleanup, Show, untrack } from "solid-js" import { createEffect, createMemo, Show, untrack } from "solid-js"
import { createStore } from "solid-js/store" import { createStore } from "solid-js/store"
import { useLocation, useNavigate, useParams } from "@solidjs/router" import { useLocation, useNavigate, useParams } from "@solidjs/router"
import { IconButton } from "@opencode-ai/ui/icon-button" import { IconButton } from "@opencode-ai/ui/icon-button"

View File

@@ -63,6 +63,7 @@ export function createRefreshQueue(input: QueueInput) {
} }
} finally { } finally {
running = false running = false
// oxlint-disable-next-line no-unsafe-finally -- intentional: early return skips schedule() when paused
if (input.paused()) return if (input.paused()) return
if (root || queued.size) schedule() if (root || queued.size) schedule()
} }

View File

@@ -704,7 +704,7 @@ export default function Layout(props: ParentProps) {
createEffect(() => { createEffect(() => {
const active = new Set(visibleSessionDirs()) const active = new Set(visibleSessionDirs())
for (const directory of [...prefetchedByDir.keys()]) { for (const directory of prefetchedByDir.keys()) {
if (active.has(directory)) continue if (active.has(directory)) continue
prefetchedByDir.delete(directory) prefetchedByDir.delete(directory)
} }

View File

@@ -1,4 +1,4 @@
import { createEffect, createSignal, onCleanup, type JSX } from "solid-js" import { createEffect, onCleanup, type JSX } from "solid-js"
import { makeEventListener } from "@solid-primitives/event-listener" import { makeEventListener } from "@solid-primitives/event-listener"
import type { SnapshotFileDiff, VcsFileDiff } from "@opencode-ai/sdk/v2" import type { SnapshotFileDiff, VcsFileDiff } from "@opencode-ai/sdk/v2"
import { SessionReview } from "@opencode-ai/ui/session-review" import { SessionReview } from "@opencode-ai/ui/session-review"

View File

@@ -1,5 +1,4 @@
import { action, useSubmission } from "@solidjs/router" import { action, useSubmission } from "@solidjs/router"
import dock from "../asset/lander/dock.png"
import { Resource } from "@opencode-ai/console-resource" import { Resource } from "@opencode-ai/console-resource"
import { Show } from "solid-js" import { Show } from "solid-js"
import { useI18n } from "~/context/i18n" import { useI18n } from "~/context/i18n"

View File

@@ -47,7 +47,7 @@ export function Header(props: { zen?: boolean; go?: boolean; hideGetStarted?: bo
notation: "compact", notation: "compact",
compactDisplay: "short", compactDisplay: "short",
maximumFractionDigits: 0, maximumFractionDigits: 0,
}).format(githubData()?.stars!) }).format(githubData()?.stars)
: config.github.starsFormatted.compact, : config.github.starsFormatted.compact,
) )

View File

@@ -0,0 +1 @@
export {}

View File

@@ -1,7 +1,7 @@
import { Title } from "@solidjs/meta" import { Title } from "@solidjs/meta"
import { createAsync, query, useParams } from "@solidjs/router" import { createAsync, query, useParams } from "@solidjs/router"
import { createSignal, For, Show } from "solid-js" import { createSignal, For, Show } from "solid-js"
import { Database, desc, eq } from "@opencode-ai/console-core/drizzle/index.js" import { Database, eq } from "@opencode-ai/console-core/drizzle/index.js"
import { BenchmarkTable } from "@opencode-ai/console-core/schema/benchmark.sql.js" import { BenchmarkTable } from "@opencode-ai/console-core/schema/benchmark.sql.js"
import { useI18n } from "~/context/i18n" import { useI18n } from "~/context/i18n"

View File

@@ -1,5 +1,5 @@
import "./index.css" import "./index.css"
import { createAsync, query, redirect } from "@solidjs/router" import { createAsync, query } from "@solidjs/router"
import { Title, Meta } from "@solidjs/meta" import { Title, Meta } from "@solidjs/meta"
import { For, createMemo, createSignal, onCleanup, onMount } from "solid-js" import { For, createMemo, createSignal, onCleanup, onMount } from "solid-js"
//import { HttpHeader } from "@solidjs/start" //import { HttpHeader } from "@solidjs/start"

View File

@@ -1,5 +1,5 @@
import { query, useParams, action, createAsync, redirect, useSubmission } from "@solidjs/router" import { query, useParams, action, createAsync, redirect, useSubmission } from "@solidjs/router"
import { For, Show, createEffect } from "solid-js" import { For, createEffect } from "solid-js"
import { createStore } from "solid-js/store" import { createStore } from "solid-js/store"
import { withActor } from "~/context/auth.withActor" import { withActor } from "~/context/auth.withActor"
import { Actor } from "@opencode-ai/console-core/actor.js" import { Actor } from "@opencode-ai/console-core/actor.js"

View File

@@ -1,5 +1,5 @@
import "./index.css" import "./index.css"
import { createAsync, query, redirect } from "@solidjs/router" import { createAsync, query } from "@solidjs/router"
import { Title, Meta } from "@solidjs/meta" import { Title, Meta } from "@solidjs/meta"
//import { HttpHeader } from "@solidjs/start" //import { HttpHeader } from "@solidjs/start"
import zenLogoLight from "../../asset/zen-ornate-light.svg" import zenLogoLight from "../../asset/zen-ornate-light.svg"

View File

@@ -345,7 +345,7 @@ export async function handler(
logger.metric({ logger.metric({
"error.cause2": JSON.stringify(error.cause), "error.cause2": JSON.stringify(error.cause),
}) })
} catch (e) {} } catch {}
} }
// Note: both top level "type" and "error.type" fields are used by the @ai-sdk/anthropic client to render the error message. // Note: both top level "type" and "error.type" fields are used by the @ai-sdk/anthropic client to render the error message.

View File

@@ -153,7 +153,7 @@ export const anthropicHelper: ProviderHelper = ({ reqModel, providerModel }) =>
let json let json
try { try {
json = JSON.parse(data.slice(6)) json = JSON.parse(data.slice(6))
} catch (e) { } catch {
return return
} }

View File

@@ -48,7 +48,7 @@ export const googleHelper: ProviderHelper = ({ providerModel }) => ({
let json let json
try { try {
json = JSON.parse(chunk.slice(6)) as { usageMetadata?: Usage } json = JSON.parse(chunk.slice(6)) as { usageMetadata?: Usage }
} catch (e) { } catch {
return return
} }

View File

@@ -49,7 +49,7 @@ export const oaCompatHelper: ProviderHelper = ({ adjustCacheUsage, safetyIdentif
let json let json
try { try {
json = JSON.parse(chunk.slice(6)) as { usage?: Usage } json = JSON.parse(chunk.slice(6)) as { usage?: Usage }
} catch (e) { } catch {
return return
} }
@@ -289,7 +289,7 @@ export function fromOaCompatibleResponse(resp: any): CommonResponse {
index: 0, index: 0,
message: { message: {
role: "assistant" as const, role: "assistant" as const,
...(content.length > 0 && content.some((c) => c.type === "text") ...(content.some((c) => c.type === "text")
? { ? {
content: content content: content
.filter((c) => c.type === "text") .filter((c) => c.type === "text")
@@ -297,7 +297,7 @@ export function fromOaCompatibleResponse(resp: any): CommonResponse {
.join(""), .join(""),
} }
: {}), : {}),
...(content.length > 0 && content.some((c) => c.type === "tool_use") ...(content.some((c) => c.type === "tool_use")
? { ? {
tool_calls: content tool_calls: content
.filter((c) => c.type === "tool_use") .filter((c) => c.type === "tool_use")

View File

@@ -36,7 +36,7 @@ export const openaiHelper: ProviderHelper = ({ workspaceID }) => ({
let json let json
try { try {
json = JSON.parse(data.slice(6)) as { response?: { usage?: Usage } } json = JSON.parse(data.slice(6)) as { response?: { usage?: Usage } }
} catch (e) { } catch {
return return
} }

View File

@@ -1,7 +1,5 @@
import { subscribe } from "diagnostics_channel" import { Database, eq } from "../src/drizzle/index.js"
import { Billing } from "../src/billing.js" import { BillingTable } from "../src/schema/billing.sql.js"
import { and, Database, eq } from "../src/drizzle/index.js"
import { BillingTable, PaymentTable, SubscriptionTable } from "../src/schema/billing.sql.js"
const workspaceID = process.argv[2] const workspaceID = process.argv[2]

View File

@@ -1,12 +1,10 @@
import { Billing } from "../src/billing.js" import { Billing } from "../src/billing.js"
import { and, Database, eq, isNull, sql } from "../src/drizzle/index.js" import { and, Database, eq, isNull } from "../src/drizzle/index.js"
import { UserTable } from "../src/schema/user.sql.js" import { UserTable } from "../src/schema/user.sql.js"
import { BillingTable, PaymentTable, SubscriptionTable } from "../src/schema/billing.sql.js" import { BillingTable, SubscriptionTable } from "../src/schema/billing.sql.js"
import { Identifier } from "../src/identifier.js" import { Identifier } from "../src/identifier.js"
import { centsToMicroCents } from "../src/util/price.js"
import { AuthTable } from "../src/schema/auth.sql.js" import { AuthTable } from "../src/schema/auth.sql.js"
import { BlackData } from "../src/black.js" import { BlackData } from "../src/black.js"
import { Actor } from "../src/actor.js"
const plan = "200" const plan = "200"
const couponID = "JAIr0Pe1" const couponID = "JAIr0Pe1"

View File

@@ -1,7 +1,5 @@
import { subscribe } from "diagnostics_channel" import { Database, eq } from "../src/drizzle/index.js"
import { Billing } from "../src/billing.js" import { BillingTable } from "../src/schema/billing.sql.js"
import { and, Database, eq } from "../src/drizzle/index.js"
import { BillingTable, PaymentTable, SubscriptionTable } from "../src/schema/billing.sql.js"
const workspaceID = process.argv[2] const workspaceID = process.argv[2]

View File

@@ -1,4 +1,4 @@
import { Database, eq, and, sql, inArray, isNull, count } from "../src/drizzle/index.js" import { Database, eq, and, sql, inArray, isNull } from "../src/drizzle/index.js"
import { BillingTable, BlackPlans } from "../src/schema/billing.sql.js" import { BillingTable, BlackPlans } from "../src/schema/billing.sql.js"
import { UserTable } from "../src/schema/user.sql.js" import { UserTable } from "../src/schema/user.sql.js"
import { AuthTable } from "../src/schema/auth.sql.js" import { AuthTable } from "../src/schema/auth.sql.js"

View File

@@ -0,0 +1 @@
export {}

View File

@@ -48,7 +48,7 @@ export namespace Log {
function use() { function use() {
try { try {
return ctx.use() return ctx.use()
} catch (e) { } catch {
return { tags: {} } return { tags: {} }
} }
} }

View File

@@ -1,4 +1,4 @@
import { describe, expect, test, afterAll } from "bun:test" import { describe, expect, test } from "bun:test"
import { Share } from "../../src/core/share" import { Share } from "../../src/core/share"
import { Storage } from "../../src/core/storage" import { Storage } from "../../src/core/storage"
import { Identifier } from "@opencode-ai/shared/util/identifier" import { Identifier } from "@opencode-ai/shared/util/identifier"

View File

@@ -107,7 +107,7 @@ if (!Script.preview) {
await $`cd ./dist/aur-${pkg} && git commit -m "Update to v${Script.version}"` await $`cd ./dist/aur-${pkg} && git commit -m "Update to v${Script.version}"`
await $`cd ./dist/aur-${pkg} && git push` await $`cd ./dist/aur-${pkg} && git push`
break break
} catch (e) { } catch {
continue continue
} }
} }

View File

@@ -5,7 +5,6 @@ import { bootstrap } from "../../bootstrap"
import { cmd } from "../cmd" import { cmd } from "../cmd"
import { Log } from "../../../util/log" import { Log } from "../../../util/log"
import { EOL } from "os" import { EOL } from "os"
import { setTimeout as sleep } from "node:timers/promises"
export const LSPCommand = cmd({ export const LSPCommand = cmd({
command: "lsp", command: "lsp",

View File

@@ -297,7 +297,7 @@ export const ExportCommand = cmd({
process.stdout.write(JSON.stringify(args.sanitize ? sanitize(exportData) : exportData, null, 2)) process.stdout.write(JSON.stringify(args.sanitize ? sanitize(exportData) : exportData, null, 2))
process.stdout.write(EOL) process.stdout.write(EOL)
} catch (error) { } catch {
UI.error(`Session not found: ${sessionID!}`) UI.error(`Session not found: ${sessionID!}`)
process.exit(1) process.exit(1)
} }

View File

@@ -362,7 +362,7 @@ export const GithubInstallCommand = cmd({
retries++ retries++
await sleep(1000) await sleep(1000)
} while (true) } while (true) // oxlint-disable-line no-constant-condition
s.stop("Installed GitHub app") s.stop("Installed GitHub app")
@@ -931,7 +931,7 @@ export const GithubRunCommand = cmd({
async function summarize(response: string) { async function summarize(response: string) {
try { try {
return await chat(`Summarize the following in less than 40 characters:\n\n${response}`) return await chat(`Summarize the following in less than 40 characters:\n\n${response}`)
} catch (e) { } catch {
const title = issueEvent const title = issueEvent
? issueEvent.issue.title ? issueEvent.issue.title
: (payload as PullRequestReviewCommentEvent).pull_request.title : (payload as PullRequestReviewCommentEvent).pull_request.title

View File

@@ -2,9 +2,6 @@ import { Server } from "../../server/server"
import { cmd } from "./cmd" import { cmd } from "./cmd"
import { withNetworkOptions, resolveNetworkOptions } from "../network" import { withNetworkOptions, resolveNetworkOptions } from "../network"
import { Flag } from "../../flag/flag" import { Flag } from "../../flag/flag"
import { Workspace } from "../../control-plane/workspace"
import { Project } from "../../project/project"
import { Installation } from "../../installation"
export const ServeCommand = cmd({ export const ServeCommand = cmd({
command: "serve", command: "serve",

View File

@@ -23,7 +23,7 @@ import { DialogProvider, useDialog } from "@tui/ui/dialog"
import { DialogProvider as DialogProviderList } from "@tui/component/dialog-provider" import { DialogProvider as DialogProviderList } from "@tui/component/dialog-provider"
import { ErrorComponent } from "@tui/component/error-component" import { ErrorComponent } from "@tui/component/error-component"
import { PluginRouteMissing } from "@tui/component/plugin-route-missing" import { PluginRouteMissing } from "@tui/component/plugin-route-missing"
import { ProjectProvider, useProject } from "@tui/context/project" import { ProjectProvider } from "@tui/context/project"
import { useEvent } from "@tui/context/event" import { useEvent } from "@tui/context/event"
import { SDKProvider, useSDK } from "@tui/context/sdk" import { SDKProvider, useSDK } from "@tui/context/sdk"
import { StartupLoading } from "@tui/component/startup-loading" import { StartupLoading } from "@tui/component/startup-loading"
@@ -115,6 +115,7 @@ export function tui(input: {
events?: EventSource events?: EventSource
}) { }) {
// promise to prevent immediate exit // promise to prevent immediate exit
// oxlint-disable-next-line no-async-promise-executor -- intentional: async executor used for sequential setup before resolve
return new Promise<void>(async (resolve) => { return new Promise<void>(async (resolve) => {
const unguard = win32InstallCtrlCGuard() const unguard = win32InstallCtrlCGuard()
win32DisableProcessedInput() win32DisableProcessedInput()

View File

@@ -1,7 +1,7 @@
import { DialogSelect, type DialogSelectRef } from "../ui/dialog-select" import { DialogSelect, type DialogSelectRef } from "../ui/dialog-select"
import { useTheme } from "../context/theme" import { useTheme } from "../context/theme"
import { useDialog } from "../ui/dialog" import { useDialog } from "../ui/dialog"
import { onCleanup, onMount } from "solid-js" import { onCleanup } from "solid-js"
export function DialogThemeList() { export function DialogThemeList() {
const theme = useTheme() const theme = useTheme()

View File

@@ -1,4 +1,4 @@
import { BoxRenderable, TextareaRenderable, MouseEvent, PasteEvent, decodePasteBytes, t, dim, fg } from "@opentui/core" import { BoxRenderable, TextareaRenderable, MouseEvent, PasteEvent, decodePasteBytes } from "@opentui/core"
import { createEffect, createMemo, onMount, createSignal, onCleanup, on, Show, Switch, Match } from "solid-js" import { createEffect, createMemo, onMount, createSignal, onCleanup, on, Show, Switch, Match } from "solid-js"
import "opentui-spinner/solid" import "opentui-spinner/solid"
import path from "path" import path from "path"

View File

@@ -1,5 +1,4 @@
import { BusEvent } from "@/bus/bus-event" import { BusEvent } from "@/bus/bus-event"
import { Bus } from "@/bus"
import { SessionID } from "@/session/schema" import { SessionID } from "@/session/schema"
import z from "zod" import z from "zod"

View File

@@ -863,7 +863,7 @@ export function Session() {
) )
await Clipboard.copy(transcript) await Clipboard.copy(transcript)
toast.show({ message: "Session transcript copied to clipboard!", variant: "success" }) toast.show({ message: "Session transcript copied to clipboard!", variant: "success" })
} catch (error) { } catch {
toast.show({ message: "Failed to copy session transcript", variant: "error" }) toast.show({ message: "Failed to copy session transcript", variant: "error" })
} }
dialog.clear() dialog.clear()
@@ -925,7 +925,7 @@ export function Session() {
toast.show({ message: `Session exported to ${filename}`, variant: "success" }) toast.show({ message: `Session exported to ${filename}`, variant: "success" })
} }
} catch (error) { } catch {
toast.show({ message: "Failed to export session", variant: "error" }) toast.show({ message: "Failed to export session", variant: "error" })
} }
dialog.clear() dialog.clear()
@@ -1010,7 +1010,7 @@ export function Session() {
), ),
} }
}) })
} catch (error) { } catch {
return [] return []
} }
}) })

View File

@@ -1,6 +1,6 @@
import { InputRenderable, RGBA, ScrollBoxRenderable, TextAttributes } from "@opentui/core" import { InputRenderable, RGBA, ScrollBoxRenderable, TextAttributes } from "@opentui/core"
import { useTheme, selectedForeground } from "@tui/context/theme" import { useTheme, selectedForeground } from "@tui/context/theme"
import { entries, filter, flatMap, groupBy, pipe, take } from "remeda" import { entries, filter, flatMap, groupBy, pipe } from "remeda"
import { batch, createEffect, createMemo, For, Show, type JSX, on } from "solid-js" import { batch, createEffect, createMemo, For, Show, type JSX, on } from "solid-js"
import { createStore } from "solid-js/store" import { createStore } from "solid-js/store"
import { useKeyboard, useTerminalDimensions } from "@opentui/solid" import { useKeyboard, useTerminalDimensions } from "@opentui/solid"

View File

@@ -19,7 +19,7 @@ export const WorkspaceContext = {
get workspaceID() { get workspaceID() {
try { try {
return context.use().workspaceID return context.use().workspaceID
} catch (err) { } catch {
return undefined return undefined
} }
}, },

View File

@@ -1,4 +1,3 @@
import { sep } from "node:path"
import { Glob } from "@opencode-ai/shared/util/glob" import { Glob } from "@opencode-ai/shared/util/glob"
export namespace FileIgnore { export namespace FileIgnore {

View File

@@ -1,4 +1,4 @@
import { Cause, Effect, Layer, Scope, Context } from "effect" import { Cause, Effect, Layer, Context } from "effect"
// @ts-ignore // @ts-ignore
import { createWrapper } from "@parcel/watcher/wrapper" import { createWrapper } from "@parcel/watcher/wrapper"
import type ParcelWatcher from "@parcel/watcher" import type ParcelWatcher from "@parcel/watcher"

View File

@@ -6,7 +6,6 @@ import path from "path"
import { mergeDeep } from "remeda" import { mergeDeep } from "remeda"
import z from "zod" import z from "zod"
import { Config } from "../config" import { Config } from "../config"
import { Instance } from "../project/instance"
import { Log } from "../util/log" import { Log } from "../util/log"
import * as Formatter from "./formatter" import * as Formatter from "./formatter"

View File

@@ -53,6 +53,6 @@ if (version !== CACHE_VERSION) {
}), }),
), ),
) )
} catch (e) {} } catch {}
await Filesystem.write(path.join(Global.Path.cache, "version"), CACHE_VERSION) await Filesystem.write(path.join(Global.Path.cache, "version"), CACHE_VERSION)
} }

View File

@@ -1,5 +1,4 @@
import { BusEvent } from "@/bus/bus-event" import { BusEvent } from "@/bus/bus-event"
import { Bus } from "@/bus"
import z from "zod" import z from "zod"
import { NamedError } from "@opencode-ai/shared/util/error" import { NamedError } from "@opencode-ai/shared/util/error"
import { Log } from "../util/log" import { Log } from "../util/log"

View File

@@ -826,7 +826,7 @@ export namespace LSPServer {
if (cargoTomlContent.includes("[workspace]")) { if (cargoTomlContent.includes("[workspace]")) {
return currentDir return currentDir
} }
} catch (err) { } catch {
// File doesn't exist or can't be read, continue searching up // File doesn't exist or can't be read, continue searching up
} }

View File

@@ -630,7 +630,7 @@ export namespace Patch {
type: "delete", type: "delete",
content, content,
}) })
} catch (error) { } catch {
return { return {
type: MaybeApplyPatchVerified.CorrectnessError, type: MaybeApplyPatchVerified.CorrectnessError,
error: new Error(`Failed to read file for deletion: ${deletePath}`), error: new Error(`Failed to read file for deletion: ${deletePath}`),

View File

@@ -3,7 +3,6 @@ import { BusEvent } from "@/bus/bus-event"
import { Config } from "@/config" import { Config } from "@/config"
import { InstanceState } from "@/effect/instance-state" import { InstanceState } from "@/effect/instance-state"
import { ProjectID } from "@/project/schema" import { ProjectID } from "@/project/schema"
import { Instance } from "@/project/instance"
import { MessageID, SessionID } from "@/session/schema" import { MessageID, SessionID } from "@/session/schema"
import { PermissionTable } from "@/session/session.sql" import { PermissionTable } from "@/session/session.sql"
import { Database, eq } from "@/storage/db" import { Database, eq } from "@/storage/db"

View File

@@ -1,10 +1,8 @@
import type { Hooks, PluginInput } from "@opencode-ai/plugin" import type { Hooks, PluginInput } from "@opencode-ai/plugin"
import { Log } from "../util/log" import { Log } from "../util/log"
import { Installation } from "../installation" import { Installation } from "../installation"
import { Auth, OAUTH_DUMMY_KEY } from "../auth" import { OAUTH_DUMMY_KEY } from "../auth"
import os from "os" import os from "os"
import { ProviderTransform } from "@/provider/transform"
import { ModelID, ProviderID } from "@/provider/schema"
import { setTimeout as sleep } from "node:timers/promises" import { setTimeout as sleep } from "node:timers/promises"
import { createServer } from "http" import { createServer } from "http"

View File

@@ -793,6 +793,7 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV3 {
fetch: this.config.fetch, fetch: this.config.fetch,
}) })
// oxlint-disable-next-line no-this-alias -- needed for closure scope inside generator
const self = this const self = this
let finishReason: { let finishReason: {

View File

@@ -7,7 +7,6 @@ import { mapValues } from "remeda"
import { errors } from "../error" import { errors } from "../error"
import { lazy } from "../../util/lazy" import { lazy } from "../../util/lazy"
import { AppRuntime } from "../../effect/app-runtime" import { AppRuntime } from "../../effect/app-runtime"
import { Effect } from "effect"
import { jsonRequest } from "./trace" import { jsonRequest } from "./trace"
export const ConfigRoutes = lazy(() => export const ConfigRoutes = lazy(() =>

View File

@@ -4,7 +4,6 @@ import { describeRoute, resolver } from "hono-openapi"
import { streamSSE } from "hono/streaming" import { streamSSE } from "hono/streaming"
import { Log } from "@/util/log" import { Log } from "@/util/log"
import { BusEvent } from "@/bus/bus-event" import { BusEvent } from "@/bus/bus-event"
import { SyncEvent } from "@/sync"
import { Bus } from "@/bus" import { Bus } from "@/bus"
import { AsyncQueue } from "../../util/queue" import { AsyncQueue } from "../../util/queue"

View File

@@ -1,4 +1,4 @@
import { Hono, type MiddlewareHandler } from "hono" import { Hono } from "hono"
import { describeRoute, validator, resolver } from "hono-openapi" import { describeRoute, validator, resolver } from "hono-openapi"
import type { UpgradeWebSocket } from "hono/ws" import type { UpgradeWebSocket } from "hono/ws"
import { Effect } from "effect" import { Effect } from "effect"

View File

@@ -2,7 +2,6 @@ import { BusEvent } from "@/bus/bus-event"
import { Bus } from "@/bus" import { Bus } from "@/bus"
import { Session } from "." import { Session } from "."
import { SessionID, MessageID, PartID } from "./schema" import { SessionID, MessageID, PartID } from "./schema"
import { Instance } from "../project/instance"
import { Provider } from "../provider/provider" import { Provider } from "../provider/provider"
import { MessageV2 } from "./message-v2" import { MessageV2 } from "./message-v2"
import z from "zod" import z from "zod"

View File

@@ -249,6 +249,7 @@ export namespace SessionProcessor {
case "reasoning-end": case "reasoning-end":
if (!(value.id in ctx.reasoningMap)) return if (!(value.id in ctx.reasoningMap)) return
// oxlint-disable-next-line no-self-assign -- reactivity trigger
ctx.reasoningMap[value.id].text = ctx.reasoningMap[value.id].text ctx.reasoningMap[value.id].text = ctx.reasoningMap[value.id].text
ctx.reasoningMap[value.id].time = { ...ctx.reasoningMap[value.id].time, end: Date.now() } ctx.reasoningMap[value.id].time = { ...ctx.reasoningMap[value.id].time, end: Date.now() }
if (value.providerMetadata) ctx.reasoningMap[value.id].metadata = value.providerMetadata if (value.providerMetadata) ctx.reasoningMap[value.id].metadata = value.providerMetadata
@@ -431,6 +432,7 @@ export namespace SessionProcessor {
case "text-end": case "text-end":
if (!ctx.currentText) return if (!ctx.currentText) return
// oxlint-disable-next-line no-self-assign -- reactivity trigger
ctx.currentText.text = ctx.currentText.text ctx.currentText.text = ctx.currentText.text
ctx.currentText.text = (yield* plugin.trigger( ctx.currentText.text = (yield* plugin.trigger(
"experimental.text.complete", "experimental.text.complete",

View File

@@ -1,11 +1,9 @@
import { NotFoundError, eq, and, sql } from "../storage/db" import { NotFoundError, eq, and } from "../storage/db"
import { SyncEvent } from "@/sync" import { SyncEvent } from "@/sync"
import { Session } from "./index" import { Session } from "./index"
import { MessageV2 } from "./message-v2" import { MessageV2 } from "./message-v2"
import { SessionTable, MessageTable, PartTable, SessionEntryTable } from "./session.sql" import { SessionTable, MessageTable, PartTable } from "./session.sql"
import { Log } from "../util/log" import { Log } from "../util/log"
import { DateTime } from "effect"
import { SessionEntry } from "@/v2/session-entry"
const log = Log.create({ service: "session.projector" }) const log = Log.create({ service: "session.projector" })

View File

@@ -10,7 +10,6 @@ import { MessageV2 } from "./message-v2"
import { SessionID, MessageID, PartID } from "./schema" import { SessionID, MessageID, PartID } from "./schema"
import { SessionRunState } from "./run-state" import { SessionRunState } from "./run-state"
import { SessionSummary } from "./summary" import { SessionSummary } from "./summary"
import { SessionStatus } from "./status"
export namespace SessionRevert { export namespace SessionRevert {
const log = Log.create({ service: "session.revert" }) const log = Log.create({ service: "session.revert" })

View File

@@ -77,11 +77,13 @@ export namespace JsonMigration {
async function read(files: string[], start: number, end: number) { async function read(files: string[], start: number, end: number) {
const count = end - start const count = end - start
// oxlint-disable-next-line unicorn/no-new-array -- pre-allocated for index-based batch fill
const tasks = new Array(count) const tasks = new Array(count)
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
tasks[i] = Filesystem.readJson(files[start + i]) tasks[i] = Filesystem.readJson(files[start + i])
} }
const results = await Promise.allSettled(tasks) const results = await Promise.allSettled(tasks)
// oxlint-disable-next-line unicorn/no-new-array -- pre-allocated for index-based batch fill
const items = new Array(count) const items = new Array(count)
for (let i = 0; i < results.length; i++) { for (let i = 0; i < results.length; i++) {
const result = results[i] const result = results[i]
@@ -243,6 +245,7 @@ export namespace JsonMigration {
for (let i = 0; i < allMessageFiles.length; i += batchSize) { for (let i = 0; i < allMessageFiles.length; i += batchSize) {
const end = Math.min(i + batchSize, allMessageFiles.length) const end = Math.min(i + batchSize, allMessageFiles.length)
const batch = await read(allMessageFiles, i, end) const batch = await read(allMessageFiles, i, end)
// oxlint-disable-next-line unicorn/no-new-array -- pre-allocated for index-based batch fill
const values = new Array(batch.length) const values = new Array(batch.length)
let count = 0 let count = 0
for (let j = 0; j < batch.length; j++) { for (let j = 0; j < batch.length; j++) {
@@ -273,6 +276,7 @@ export namespace JsonMigration {
for (let i = 0; i < partFiles.length; i += batchSize) { for (let i = 0; i < partFiles.length; i += batchSize) {
const end = Math.min(i + batchSize, partFiles.length) const end = Math.min(i + batchSize, partFiles.length)
const batch = await read(partFiles, i, end) const batch = await read(partFiles, i, end)
// oxlint-disable-next-line unicorn/no-new-array -- pre-allocated for index-based batch fill
const values = new Array(batch.length) const values = new Array(batch.length)
let count = 0 let count = 0
for (let j = 0; j < batch.length; j++) { for (let j = 0; j < batch.length; j++) {

View File

@@ -1,6 +1,5 @@
import z from "zod" import z from "zod"
import type { ZodObject } from "zod" import type { ZodObject } from "zod"
import { EventEmitter } from "events"
import { Database, eq } from "@/storage/db" import { Database, eq } from "@/storage/db"
import { GlobalBus } from "@/bus/global" import { GlobalBus } from "@/bus/global"
import { Bus as ProjectBus } from "@/bus" import { Bus as ProjectBus } from "@/bus"

View File

@@ -416,7 +416,7 @@ export const WhitespaceNormalizedReplacer: Replacer = function* (content, find)
if (match) { if (match) {
yield match[0] yield match[0]
} }
} catch (e) { } catch {
// Invalid regex pattern, skip // Invalid regex pattern, skip
} }
} }

View File

@@ -8,7 +8,6 @@ import { Agent } from "../agent/agent"
import type { SessionPrompt } from "../session/prompt" import type { SessionPrompt } from "../session/prompt"
import { Config } from "../config" import { Config } from "../config"
import { Effect } from "effect" import { Effect } from "effect"
import { Log } from "@/util/log"
export interface TaskPromptOps { export interface TaskPromptOps {
cancel(sessionID: SessionID): void cancel(sessionID: SessionID): void

View File

@@ -1,6 +1,6 @@
import z from "zod" import z from "zod"
import { Effect } from "effect" import { Effect } from "effect"
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http" import { HttpClient, HttpClientRequest } from "effect/unstable/http"
import { Tool } from "./tool" import { Tool } from "./tool"
import TurndownService from "turndown" import TurndownService from "turndown"
import DESCRIPTION from "./webfetch.txt" import DESCRIPTION from "./webfetch.txt"

View File

@@ -4,14 +4,9 @@ export function lazy<T>(fn: () => T) {
const result = (): T => { const result = (): T => {
if (loaded) return value as T if (loaded) return value as T
try { value = fn()
value = fn() loaded = true
loaded = true return value as T
return value as T
} catch (e) {
// Don't mark as loaded if initialization failed
throw e
}
} }
result.reset = () => { result.reset = () => {

View File

@@ -1,8 +1,6 @@
import { Context, Layer, Schema, Effect } from "effect" import { Context, Layer, Schema, Effect } from "effect"
import { SessionEntry } from "./session-entry" import { SessionEntry } from "./session-entry"
import { Struct } from "effect" import { Struct } from "effect"
import { Identifier } from "@/id/id"
import { withStatics } from "@/util/schema"
import { Session } from "@/session" import { Session } from "@/session"
import { SessionID } from "@/session/schema" import { SessionID } from "@/session/schema"

View File

@@ -5,7 +5,6 @@ import { pathToFileURL } from "url"
import { tmpdir } from "../../fixture/fixture" import { tmpdir } from "../../fixture/fixture"
import { createTuiPluginApi } from "../../fixture/tui-plugin" import { createTuiPluginApi } from "../../fixture/tui-plugin"
import { mockTuiRuntime } from "../../fixture/tui-runtime" import { mockTuiRuntime } from "../../fixture/tui-runtime"
import { TuiConfig } from "../../../src/config/tui"
const { TuiPluginRuntime } = await import("../../../src/cli/cmd/tui/plugin/runtime") const { TuiPluginRuntime } = await import("../../../src/cli/cmd/tui/plugin/runtime")

View File

@@ -1,8 +1,7 @@
import { NodeFileSystem, NodePath } from "@effect/platform-node"
import { describe, expect } from "bun:test" import { describe, expect } from "bun:test"
import fs from "node:fs/promises" import fs from "node:fs/promises"
import path from "node:path" import path from "node:path"
import { Effect, Exit, Layer, Stream } from "effect" import { Effect, Exit, Stream } from "effect"
import type * as PlatformError from "effect/PlatformError" import type * as PlatformError from "effect/PlatformError"
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process" import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"
import * as CrossSpawnSpawner from "../../src/effect/cross-spawn-spawner" import * as CrossSpawnSpawner from "../../src/effect/cross-spawn-spawner"

View File

@@ -1,5 +1,5 @@
import { afterEach, expect, test } from "bun:test" import { afterEach, expect, test } from "bun:test"
import { Cause, Deferred, Duration, Effect, Exit, Fiber, Layer, ManagedRuntime, Context } from "effect" import { Deferred, Duration, Effect, Exit, Fiber, Layer, ManagedRuntime, Context } from "effect"
import { InstanceState } from "../../src/effect/instance-state" import { InstanceState } from "../../src/effect/instance-state"
import { InstanceRef } from "../../src/effect/instance-ref" import { InstanceRef } from "../../src/effect/instance-ref"
import { Instance } from "../../src/project/instance" import { Instance } from "../../src/project/instance"

View File

@@ -6,7 +6,7 @@ import * as CrossSpawnSpawner from "../../src/effect/cross-spawn-spawner"
import { Permission } from "../../src/permission" import { Permission } from "../../src/permission"
import { PermissionID } from "../../src/permission/schema" import { PermissionID } from "../../src/permission/schema"
import { Instance } from "../../src/project/instance" import { Instance } from "../../src/project/instance"
import { provideInstance, provideTmpdirInstance, tmpdir, tmpdirScoped } from "../fixture/fixture" import { provideInstance, provideTmpdirInstance, tmpdirScoped } from "../fixture/fixture"
import { testEffect } from "../lib/effect" import { testEffect } from "../lib/effect"
import { MessageID, SessionID } from "../../src/session/schema" import { MessageID, SessionID } from "../../src/session/schema"

View File

@@ -1,3 +1,4 @@
export {}
// TODO: UNCOMMENT WHEN GITLAB SUPPORT IS COMPLETED // TODO: UNCOMMENT WHEN GITLAB SUPPORT IS COMPLETED
// //
// //

View File

@@ -3,7 +3,6 @@ import { Effect } from "effect"
import path from "path" import path from "path"
import { GlobalBus } from "../../src/bus/global" import { GlobalBus } from "../../src/bus/global"
import { Snapshot } from "../../src/snapshot" import { Snapshot } from "../../src/snapshot"
import { InstanceBootstrap } from "../../src/project/bootstrap"
import { Instance } from "../../src/project/instance" import { Instance } from "../../src/project/instance"
import { Server } from "../../src/server/server" import { Server } from "../../src/server/server"
import { Filesystem } from "../../src/util/filesystem" import { Filesystem } from "../../src/util/filesystem"

View File

@@ -2,7 +2,6 @@ import { afterEach, describe, expect, mock, test } from "bun:test"
import { APICallError } from "ai" import { APICallError } from "ai"
import { Cause, Effect, Exit, Layer, ManagedRuntime } from "effect" import { Cause, Effect, Exit, Layer, ManagedRuntime } from "effect"
import * as Stream from "effect/Stream" import * as Stream from "effect/Stream"
import path from "path"
import z from "zod" import z from "zod"
import { Bus } from "../../src/bus" import { Bus } from "../../src/bus"
import { Config } from "../../src/config" import { Config } from "../../src/config"

View File

@@ -3,7 +3,6 @@ import { FetchHttpClient } from "effect/unstable/http"
import { expect } from "bun:test" import { expect } from "bun:test"
import { Cause, Effect, Exit, Fiber, Layer } from "effect" import { Cause, Effect, Exit, Fiber, Layer } from "effect"
import path from "path" import path from "path"
import z from "zod"
import { Agent as AgentSvc } from "../../src/agent/agent" import { Agent as AgentSvc } from "../../src/agent/agent"
import { Bus } from "../../src/bus" import { Bus } from "../../src/bus"
import { Command } from "../../src/command" import { Command } from "../../src/command"

View File

@@ -49,7 +49,6 @@ import { Instruction } from "../../src/session/instruction"
import { SessionProcessor } from "../../src/session/processor" import { SessionProcessor } from "../../src/session/processor"
import { SessionRunState } from "../../src/session/run-state" import { SessionRunState } from "../../src/session/run-state"
import { SessionStatus } from "../../src/session/status" import { SessionStatus } from "../../src/session/status"
import { Shell } from "../../src/shell/shell"
import { Snapshot } from "../../src/snapshot" import { Snapshot } from "../../src/snapshot"
import { ToolRegistry } from "../../src/tool/registry" import { ToolRegistry } from "../../src/tool/registry"
import { Truncate } from "../../src/tool/truncate" import { Truncate } from "../../src/tool/truncate"

View File

@@ -13,7 +13,6 @@ import { Provider } from "../../src/provider/provider"
import { Session } from "../../src/session" import { Session } from "../../src/session"
import type { SessionID } from "../../src/session/schema" import type { SessionID } from "../../src/session/schema"
import { ShareNext } from "../../src/share/share-next" import { ShareNext } from "../../src/share/share-next"
import { Storage } from "../../src/storage/storage"
import { SessionShareTable } from "../../src/share/share.sql" import { SessionShareTable } from "../../src/share/share.sql"
import { Database, eq } from "../../src/storage/db" import { Database, eq } from "../../src/storage/db"
import { provideTmpdirInstance } from "../fixture/fixture" import { provideTmpdirInstance } from "../fixture/fixture"

View File

@@ -1,6 +1,5 @@
import { describe, expect } from "bun:test" import { describe, expect } from "bun:test"
import { Effect, Fiber, Layer } from "effect" import { Effect, Fiber, Layer } from "effect"
import { Tool } from "../../src/tool/tool"
import { QuestionTool } from "../../src/tool/question" import { QuestionTool } from "../../src/tool/question"
import { Question } from "../../src/question" import { Question } from "../../src/question"
import { SessionID, MessageID } from "../../src/session/schema" import { SessionID, MessageID } from "../../src/session/schema"

View File

@@ -95,7 +95,7 @@ app.message(async ({ message, say }) => {
const shareResult = await client.session.share({ path: { id: createResult.data.id } }) const shareResult = await client.session.share({ path: { id: createResult.data.id } })
if (!shareResult.error && shareResult.data) { if (!shareResult.error && shareResult.data) {
const sessionUrl = shareResult.data.share?.url! const sessionUrl = shareResult.data.share?.url
console.log("🔗 Session shared:", sessionUrl) console.log("🔗 Session shared:", sessionUrl)
await app.client.chat.postMessage({ channel, thread_ts: thread, text: sessionUrl }) await app.client.chat.postMessage({ channel, thread_ts: thread, text: sessionUrl })
} }

View File

@@ -37,7 +37,6 @@ import { type UiI18n, useI18n } from "../context/i18n"
import { BasicTool, GenericTool } from "./basic-tool" import { BasicTool, GenericTool } from "./basic-tool"
import { Accordion } from "./accordion" import { Accordion } from "./accordion"
import { StickyAccordionHeader } from "./sticky-accordion-header" import { StickyAccordionHeader } from "./sticky-accordion-header"
import { Card } from "./card"
import { Collapsible } from "./collapsible" import { Collapsible } from "./collapsible"
import { FileIcon } from "./file-icon" import { FileIcon } from "./file-icon"
import { Icon } from "./icon" import { Icon } from "./icon"

View File

@@ -1,5 +1,5 @@
// @ts-nocheck // @ts-nocheck
import { createSignal, createMemo, createEffect, on, For, Show, Index, batch } from "solid-js" import { createSignal, createMemo, createEffect, on, For, Show, batch } from "solid-js"
import { createStore, produce } from "solid-js/store" import { createStore, produce } from "solid-js/store"
import type { import type {
Message, Message,

View File

@@ -1,5 +1,5 @@
import { type SelectedLineRange } from "@pierre/diffs" import { type SelectedLineRange } from "@pierre/diffs"
import { diffLineIndex, diffRowIndex, findDiffSide } from "./diff-selection" import { diffLineIndex, diffRowIndex } from "./diff-selection"
export type CommentSide = "additions" | "deletions" export type CommentSide = "additions" | "deletions"

View File

@@ -78,7 +78,7 @@ export function activate(context: vscode.ExtensionContext) {
await fetch(`http://localhost:${port}/app`) await fetch(`http://localhost:${port}/app`)
connected = true connected = true
break break
} catch (e) {} } catch {}
tries-- tries--
} while (tries > 0) } while (tries > 0)