From 84aed13ac8a054f880eb1f42c413369724153d09 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Thu, 29 Oct 2026 13:04:23 -0700 Subject: [PATCH 01/83] feat(tui): load stored images by reference, like desktop (#60116) --- packages/app/src/runtime/server/api.ts | 50 +-- packages/app/src/runtime/server/media.ts | 11 +- packages/client/src/promise/index.ts | 1 + packages/client/src/promise/media.ts | 57 +++ packages/client/test/media.test.ts | 51 +++ .../src/component/dialog-image-preview.tsx | 16 +- packages/tui/src/component/media-source.ts | 43 +++ .../tui/src/component/prompt/draft-stash.ts | 31 +- packages/tui/src/component/prompt/index.tsx | 3 +- packages/tui/src/context/client.tsx | 9 +- packages/tui/src/context/data.tsx | 5 +- packages/tui/src/prompt/attachment.ts | 19 +- packages/tui/src/prompt/codec.ts | 36 +- packages/tui/src/prompt/restore.ts | 36 ++ .../tui/src/routes/session/dialog-fork.tsx | 22 +- .../tui/src/routes/session/dialog-message.tsx | 29 +- .../src/routes/session/dialog-timeline.tsx | 11 +- packages/tui/src/routes/session/index.tsx | 195 +++++----- packages/tui/src/util/media.ts | 43 +++ .../test/fixture/plugin/client-reads/tui.tsx | 9 + packages/tui/test/prompt/attachment.test.ts | 13 + packages/tui/test/prompt/codec.test.ts | 77 +++- packages/tui/test/session-media-refs.test.tsx | 359 ++++++++++++++++++ packages/tui/test/util/media.test.ts | 54 +++ 24 files changed, 969 insertions(+), 211 deletions(-) create mode 100644 packages/client/src/promise/media.ts create mode 100644 packages/client/test/media.test.ts create mode 100644 packages/tui/src/component/media-source.ts create mode 100644 packages/tui/src/prompt/restore.ts create mode 100644 packages/tui/src/util/media.ts create mode 100644 packages/tui/test/fixture/plugin/client-reads/tui.tsx create mode 100644 packages/tui/test/session-media-refs.test.tsx create mode 100644 packages/tui/test/util/media.test.ts diff --git a/packages/app/src/runtime/server/api.ts b/packages/app/src/runtime/server/api.ts index 5da5f219b344..249607d33c09 100644 --- a/packages/app/src/runtime/server/api.ts +++ b/packages/app/src/runtime/server/api.ts @@ -1,10 +1,4 @@ -import { - OpenCode, - type MessageListInput, - type OpenCodeClient, - type SessionInboxListInput, - type SessionMessageGetInput, -} from "@opencode/client/promise" +import { OpenCode, withMediaRefs, type MediaRequestOptions } from "@opencode/client/promise" import type { ServerConnection } from "@/runtime/server/registry" import { decode64 } from "@/runtime/persistence/base64" @@ -25,12 +19,8 @@ export function authFromToken(token: string | null) { } } -export const MEDIA_URI_CAPABILITY = "experimental-media-uri" - -export const CAPABILITIES_HEADER = "X-OpenCode-Capabilities" - /** `mediaRefs: false` reads stored media as inline bytes, for callers such as export that need self-contained messages. */ -export type ServerRequestOptions = OpenCode.RequestOptions & { readonly mediaRefs?: false } +export type ServerRequestOptions = MediaRequestOptions export function createApiForServer(input: { server: ServerConnection.HttpBase; fetch?: typeof globalThis.fetch }) { return withMediaRefs( @@ -48,42 +38,6 @@ export function createApiForServer(input: { server: ServerConnection.HttpBase; f ) } -/** - * Only the message and inbox reads can return stored media as `media:` refs, so only they carry the capability. - * A custom header makes a cross-origin request preflighted, which every other request must keep avoiding. - */ -function withMediaRefs(api: OpenCodeClient) { - return { - ...api, - message: { - ...api.message, - list: (input: MessageListInput, options?: ServerRequestOptions) => - api.message.list(input, mediaRefOptions(options)), - }, - session: { - ...api.session, - message: { - ...api.session.message, - get: (input: SessionMessageGetInput, options?: ServerRequestOptions) => - api.session.message.get(input, mediaRefOptions(options)), - }, - inbox: { - ...api.session.inbox, - list: (input: SessionInboxListInput, options?: ServerRequestOptions) => - api.session.inbox.list(input, mediaRefOptions(options)), - }, - }, - } -} - -function mediaRefOptions(options: ServerRequestOptions | undefined): OpenCode.RequestOptions | undefined { - if (options?.mediaRefs === false) return options - const headers = new Headers(options?.headers) - headers.set(CAPABILITIES_HEADER, MEDIA_URI_CAPABILITY) - - return { ...options, headers } -} - /** * The server's ranged read of one file, for media elements. They cannot send the Authorization header, and a credential * never goes in a DOM URL, so a server that needs a password has none: its media downloads through the API instead. diff --git a/packages/app/src/runtime/server/media.ts b/packages/app/src/runtime/server/media.ts index 7dddc1de67fd..e654003fa3fd 100644 --- a/packages/app/src/runtime/server/media.ts +++ b/packages/app/src/runtime/server/media.ts @@ -1,13 +1,6 @@ -import type { OpenCodeClient } from "@opencode/client/promise" +import { mediaHashFromUri, type OpenCodeClient } from "@opencode/client/promise" -const MEDIA_REF = /^media:([0-9a-f]{64})$/ - -/** The blob hash in a `media:` ref, the only form the server sends stored media in. */ -export function mediaHashFromUri(uri: string | undefined): string | undefined { - if (!uri) return undefined - - return MEDIA_REF.exec(uri)?.[1] -} +export { mediaHashFromUri } export type MediaCache = { peek(uri: string, mime?: string): string | undefined diff --git a/packages/client/src/promise/index.ts b/packages/client/src/promise/index.ts index 04d10d1eef5b..cc41c53b2775 100644 --- a/packages/client/src/promise/index.ts +++ b/packages/client/src/promise/index.ts @@ -2,6 +2,7 @@ import type { OpenCode } from "./client.js" export * from "./generated/index.js" export { OpenCode } from "./client.js" +export { mediaHashFromUri, withMediaRefs, type MediaRequestOptions } from "./media.js" export type { AgentApi, CommandApi, diff --git a/packages/client/src/promise/media.ts b/packages/client/src/promise/media.ts new file mode 100644 index 000000000000..bbdf557ca090 --- /dev/null +++ b/packages/client/src/promise/media.ts @@ -0,0 +1,57 @@ +import type { make, RequestOptions } from "./client.js" +import type { MessageListInput, SessionInboxListInput, SessionMessageGetInput } from "./generated/types.js" + +const MEDIA_URI_CAPABILITY = "experimental-media-uri" + +const CAPABILITIES_HEADER = "X-OpenCode-Capabilities" + +const MEDIA_REF = /^media:([0-9a-f]{64})$/ + +/** `mediaRefs: false` reads stored media as inline bytes, for callers such as export that need self-contained messages. */ +export type MediaRequestOptions = RequestOptions & { readonly mediaRefs?: false } + +/** The blob hash in a `media:` ref, the only form the server sends stored media in. */ +export function mediaHashFromUri(uri: string | undefined): string | undefined { + if (!uri) return undefined + + return MEDIA_REF.exec(uri)?.[1] +} + +/** + * Opts a client into the experimental `experimental-media-uri` capability: while `experimental.media_blob` is on, + * stored media comes back as `media:` refs, whose bytes `experimental.media.get` reads. + * + * Only the message and inbox reads can return refs, so only they carry the capability. + * A custom header makes a cross-origin request preflighted, which every other request must keep avoiding. + */ +export function withMediaRefs(api: ReturnType) { + return { + ...api, + message: { + ...api.message, + list: (input: MessageListInput, options?: MediaRequestOptions) => + api.message.list(input, mediaRefOptions(options)), + }, + session: { + ...api.session, + message: { + ...api.session.message, + get: (input: SessionMessageGetInput, options?: MediaRequestOptions) => + api.session.message.get(input, mediaRefOptions(options)), + }, + inbox: { + ...api.session.inbox, + list: (input: SessionInboxListInput, options?: MediaRequestOptions) => + api.session.inbox.list(input, mediaRefOptions(options)), + }, + }, + } +} + +function mediaRefOptions(options: MediaRequestOptions | undefined): RequestOptions | undefined { + if (options?.mediaRefs === false) return options + const headers = new Headers(options?.headers) + headers.set(CAPABILITIES_HEADER, MEDIA_URI_CAPABILITY) + + return { ...options, headers } +} diff --git a/packages/client/test/media.test.ts b/packages/client/test/media.test.ts new file mode 100644 index 000000000000..4d97fa11647c --- /dev/null +++ b/packages/client/test/media.test.ts @@ -0,0 +1,51 @@ +import { expect, test } from "bun:test" +import { mediaHashFromUri, OpenCode, withMediaRefs } from "../src/promise/index" + +test("withMediaRefs asks for media refs on message and inbox reads only", async () => { + const requests: Array<{ path: string; headers: Headers }> = [] + const api = withMediaRefs( + OpenCode.make({ + baseUrl: "http://localhost:3000", + headers: { Authorization: "Basic secret" }, + // SAFETY: the API client only calls fetch with a URL and init, which this stub accepts. + fetch: (async (input: string | URL | Request, init?: RequestInit) => { + requests.push({ + path: new URL(input instanceof Request ? input.url : input).pathname, + headers: new Headers(init?.headers), + }) + return Response.json({ data: [], cursor: {} }) + }) as typeof fetch, + }), + ) + + await api.message.list({ sessionID: "ses_1" }) + await api.message.list({ sessionID: "ses_1" }, { mediaRefs: false }) + await api.session.message.get({ sessionID: "ses_1", messageID: "msg_1" }) + await api.session.inbox.list({ sessionID: "ses_1" }, { headers: { "X-Trace": "1" } }) + await api.session.list() + + expect( + requests.map((request) => [ + request.path, + request.headers.get("x-opencode-capabilities"), + request.headers.get("authorization"), + ]), + ).toEqual([ + ["/api/session/ses_1/message", "experimental-media-uri", "Basic secret"], + ["/api/session/ses_1/message", null, "Basic secret"], + ["/api/session/ses_1/message/msg_1", "experimental-media-uri", "Basic secret"], + ["/api/session/ses_1/inbox", "experimental-media-uri", "Basic secret"], + ["/api/session", null, "Basic secret"], + ]) + expect(requests[3]?.headers.get("x-trace")).toBe("1") +}) + +test.each([ + [`media:${"a".repeat(64)}`, "a".repeat(64)], + [`media:${"A".repeat(64)}`, undefined], + [`media:${"a".repeat(63)}`, undefined], + ["data:image/png;base64,AAA", undefined], + [undefined, undefined], +])("mediaHashFromUri(%p)", (uri, hash) => { + expect(mediaHashFromUri(uri)).toBe(hash) +}) diff --git a/packages/tui/src/component/dialog-image-preview.tsx b/packages/tui/src/component/dialog-image-preview.tsx index f2bdd1d9e1b6..7fff59b322ea 100644 --- a/packages/tui/src/component/dialog-image-preview.tsx +++ b/packages/tui/src/component/dialog-image-preview.tsx @@ -3,6 +3,7 @@ import { createMemo, createSignal } from "solid-js" import { Keymap } from "../context/keymap" import { useTheme } from "../context/theme" import { DialogHeader, DialogLayout, useDialog } from "../ui/dialog" +import { createMediaSource } from "./media-source" type ImagePreviewItem = Readonly<{ uri: string @@ -14,8 +15,8 @@ export function DialogImagePreview(props: { images: readonly ImagePreviewItem[]; const dimensions = useTerminalDimensions() const theme = useTheme().surface("dialog") const [index, setIndex] = createSignal(Math.max(0, Math.min(props.images.length - 1, props.initial))) - const [failed, setFailed] = createSignal(false) const current = createMemo(() => props.images[index()]) + const media = createMediaSource(() => current().uri) const imageHeight = createMemo(() => Math.max(3, dimensions().height - 8)) dialog.setSize("xlarge") @@ -23,7 +24,6 @@ export function DialogImagePreview(props: { images: readonly ImagePreviewItem[]; function move(direction: number) { if (props.images.length < 2) return - setFailed(false) setIndex((value) => (value + direction + props.images.length) % props.images.length) } @@ -51,8 +51,8 @@ export function DialogImagePreview(props: { images: readonly ImagePreviewItem[]; }, get children() { return ( - - {failed() ? "No preview" : (current().mention?.text ?? `Image ${index() + 1}`)} + + {media.failed() ? "No preview" : (current().mention?.text ?? `Image ${index() + 1}`)} ) }, @@ -62,8 +62,8 @@ export function DialogImagePreview(props: { images: readonly ImagePreviewItem[]; move(-1)}> {props.images.length > 1 ? "← previous" : ""} - - {failed() ? "No preview" : (current().mention?.text ?? `Image ${index() + 1}`)} + + {media.failed() ? "No preview" : (current().mention?.text ?? `Image ${index() + 1}`)} move(1)}> {props.images.length > 1 ? "next →" : ""} @@ -73,12 +73,12 @@ export function DialogImagePreview(props: { images: readonly ImagePreviewItem[]; > setFailed(true)} + onError={media.onError} /> ) diff --git a/packages/tui/src/component/media-source.ts b/packages/tui/src/component/media-source.ts new file mode 100644 index 000000000000..ec2366c27c40 --- /dev/null +++ b/packages/tui/src/component/media-source.ts @@ -0,0 +1,43 @@ +import { mediaHashFromUri } from "@opencode/client" +import { createEffect, createSignal, on, onCleanup, useContext, type Accessor } from "solid-js" +import { ClientContext } from "../context/client" + +/** + * An `` source for a URI that may be a `media:` ref. A ref reads its bytes from the server once something + * shows it, so images nobody looks at fetch nothing; other URIs pass through. `failed` covers a failed read and, through + * `onError`, a failed decode, until the URI changes. + */ +export function createMediaSource(uri: Accessor) { + // Optional: image dialogs also render outside a connected client, where only plain URIs can load. + const media = useContext(ClientContext)?.media + const [bytes, setBytes] = createSignal(media?.peek(uri())) + const [failed, setFailed] = createSignal(false) + + createEffect( + on(uri, (current) => { + setFailed(false) + const cached = media?.peek(current) + setBytes(cached) + if (cached || !mediaHashFromUri(current)) return + if (!media) return setFailed(true) + let active = true + onCleanup(() => { + active = false + }) + media.read(current).then( + (result) => { + if (active) setBytes(result) + }, + () => { + if (active) setFailed(true) + }, + ) + }), + ) + + return { + source: (): string | Uint8Array | undefined => (mediaHashFromUri(uri()) ? bytes() : uri()), + failed, + onError: () => setFailed(true), + } +} diff --git a/packages/tui/src/component/prompt/draft-stash.ts b/packages/tui/src/component/prompt/draft-stash.ts index eaec92e8b0e7..3c1160c81cba 100644 --- a/packages/tui/src/component/prompt/draft-stash.ts +++ b/packages/tui/src/component/prompt/draft-stash.ts @@ -1,4 +1,6 @@ -import type { PromptInfo } from "../../prompt/history" +import type { WidthMethod } from "@opentui/core" +import { appendPrompt, type PromptInfo } from "../../prompt/history" +import type { PromptRef } from "./index" // Holds one in-progress draft per tab across Prompt remounts. A draft is // consumed on take: restoring it moves it out of the stash, so a stale copy @@ -16,3 +18,30 @@ export function takeDraft(sessionID: string | undefined) { export function saveDraft(sessionID: string | undefined, entry: DraftEntry) { byTab.set(sessionID, entry) } + +const composers = new Map() + +/** Marks a tab's mounted composer as the one {@link appendToSessionPrompt} writes to; returns its unregister. */ +export function registerComposer(sessionID: string | undefined, composer: PromptRef) { + composers.set(sessionID, composer) + return () => { + if (composers.get(sessionID) === composer) composers.delete(sessionID) + } +} + +/** + * Appends a prompt that comes back after an await (an undo or revert) to a session's composer if one is mounted, else + * to its stashed draft, after anything already typed there. A session view remounts with its tab, so the composer it + * started with may be gone by then. Returns the composer it wrote to. + */ +export function appendToSessionPrompt(sessionID: string, prompt: PromptInfo, widthMethod: WidthMethod) { + const composer = composers.get(sessionID) + if (!composer) { + const draft = takeDraft(sessionID)?.prompt + saveDraft(sessionID, { prompt: draft ? appendPrompt(draft, prompt, widthMethod) : prompt, cursor: Infinity }) + return + } + composer.setMode("normal") + composer.set(appendPrompt(composer.current, prompt, widthMethod)) + return composer +} diff --git a/packages/tui/src/component/prompt/index.tsx b/packages/tui/src/component/prompt/index.tsx index 8f5ae83aea65..d10d2b67262a 100644 --- a/packages/tui/src/component/prompt/index.tsx +++ b/packages/tui/src/component/prompt/index.tsx @@ -31,7 +31,7 @@ import { expandPromptInputPastedText, realignPromptInputMentions } from "../../p import { parseSlashHead } from "../../prompt/parse" import { createStore, produce, unwrap } from "solid-js/store" import { emptyPrompt, usePromptHistory, type PromptInfo, type PromptPartRef } from "../../prompt/history" -import { saveDraft, takeDraft } from "./draft-stash" +import { registerComposer, saveDraft, takeDraft } from "./draft-stash" import { Skill } from "@opencode/schema/skill" import { computePromptTraits } from "../../prompt/traits" import { expandPastedTextPlaceholders, expandTrackedPastedText } from "../../prompt/part" @@ -717,6 +717,7 @@ export function Prompt(props: PromptProps) { const stashSessionID = props.sessionID onMount(() => { + onCleanup(registerComposer(stashSessionID, ref)) const saved = takeDraft(stashSessionID) if (store.prompt.text) return if (saved && saved.prompt.text) { diff --git a/packages/tui/src/context/client.tsx b/packages/tui/src/context/client.tsx index 6f30f963f096..22d72bd8ff7c 100644 --- a/packages/tui/src/context/client.tsx +++ b/packages/tui/src/context/client.tsx @@ -3,6 +3,7 @@ import { createClientConnection, createPersistentPtyClient } from "@opencode/cli import { createGlobalEmitter } from "@solid-primitives/event-bus" import { onCleanup } from "solid-js" import { createSimpleContext } from "./helper" +import { createMediaCache } from "../util/media" import { useLog } from "./log" type ManagedService = { @@ -12,7 +13,11 @@ type ManagedService = { type ClientEventMap = { [Type in OpenCodeEvent["type"]]: Extract } -export const { use: useClient, provider: ClientProvider } = createSimpleContext({ +export const { + use: useClient, + provider: ClientProvider, + context: ClientContext, +} = createSimpleContext({ name: "Client", init: (props: { api: OpenCodeClient; url?: string; headers?: Record; service?: ManagedService }) => { const log = useLog({ component: "client" }) @@ -22,6 +27,7 @@ export const { use: useClient, provider: ClientProvider } = createSimpleContext( let url = props.url let headers = props.headers let persistentPty = url ? createPersistentPtyClient(api, { url }) : undefined + const media = createMediaCache(() => api) const connection = createClientConnection(api, { reconnect: service @@ -63,6 +69,7 @@ export const { use: useClient, provider: ClientProvider } = createSimpleContext( listen: events.listen, }, connection, + media, restart: service?.restart, } }, diff --git a/packages/tui/src/context/data.tsx b/packages/tui/src/context/data.tsx index d773547c1404..8c7668f9a77a 100644 --- a/packages/tui/src/context/data.tsx +++ b/packages/tui/src/context/data.tsx @@ -1,5 +1,5 @@ import { createData } from "@opencode/client/solid" -import type { LocationRef } from "@opencode/client" +import { withMediaRefs, type LocationRef } from "@opencode/client" import type { Plugin } from "@opencode/plugin/tui" import { createStore } from "solid-js/store" import { createSimpleContext } from "./helper" @@ -13,7 +13,8 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({ init: (props: { directory: string }) => { const client = useClient() const data = createData({ - api: () => client.api, + // Only the transcript store reads stored media as `media:` refs; plugins and other callers keep inline bytes. + api: () => withMediaRefs(client.api), event: client.event, connection: client.connection, directory: props.directory, diff --git a/packages/tui/src/prompt/attachment.ts b/packages/tui/src/prompt/attachment.ts index d3fc469ace2e..75f9eda3e82d 100644 --- a/packages/tui/src/prompt/attachment.ts +++ b/packages/tui/src/prompt/attachment.ts @@ -2,14 +2,15 @@ import type { PromptInput } from "@opencode/schema" type PromptFile = PromptInput.FileAttachment type PromptFileIdentity = Pick -type ProjectedFile = Readonly<{ - data: string - mime: string - source: { type: string } - name?: string - description?: string - mention?: { text: string } -}> +type ProjectedFile = Readonly< + { + mime: string + source: { type: string } + name?: string + description?: string + mention?: { text: string } + } & ({ data: string } | { uri: string }) +> function attachmentKind(uri: string) { if (uri.startsWith("data:image/")) return "Image" @@ -67,7 +68,7 @@ export function deduplicateVisibleImages(files: readonl file.mime.startsWith("image/") && file.source.type === "inline" && file.mention?.text ? { metadata: JSON.stringify([file.mime, file.name ?? null, file.description ?? null, file.mention.text]), - payload: file.data, + payload: "uri" in file ? file.uri : file.data, } : undefined, ) diff --git a/packages/tui/src/prompt/codec.ts b/packages/tui/src/prompt/codec.ts index d93130672e81..3f5811bdfaa4 100644 --- a/packages/tui/src/prompt/codec.ts +++ b/packages/tui/src/prompt/codec.ts @@ -1,18 +1,26 @@ +import { mediaHashFromUri, type PromptAttachment } from "@opencode/client" import type { Prompt, PromptInput } from "@opencode/schema" import { Skill } from "@opencode/schema/skill" import type { Types } from "effect" export type EditablePromptInput = Types.DeepMutable -type ProjectedPrompt = Pick & { +export type ProjectedPrompt = Pick & { + readonly files?: ReadonlyArray readonly skills?: ReadonlyArray<{ readonly id: string; readonly mention?: PromptInput.SkillAttachment["mention"] }> } +/** A projected prompt as composer input. Files the server kept as `media:` refs stay refs. */ export function projectedPromptInput(input: ProjectedPrompt): EditablePromptInput { return { text: input.text, files: input.files?.map((file) => ({ - uri: file.source.type === "uri" ? file.source.uri : `data:${file.mime};base64,${file.data}`, + uri: + file.source.type === "uri" + ? file.source.uri + : "uri" in file + ? file.uri + : `data:${file.mime};base64,${file.data}`, name: file.name, description: file.description, mention: file.mention ? { ...file.mention } : undefined, @@ -27,3 +35,27 @@ export function projectedPromptInput(input: ProjectedPrompt): EditablePromptInpu })), } } + +/** + * {@link projectedPromptInput} with every `media:` file read back into a `data:` URI, for putting a sent prompt + * back in the composer. The draft then keeps its bytes after the server releases the blob (an inbox cancel, or a + * committed revert), and the composer previews and resends it like any pasted image. A read that resolves `undefined` + * leaves its file out. + */ +export async function restoredPromptInput( + input: ProjectedPrompt, + read: (uri: string) => Promise, +): Promise { + const output = projectedPromptInput(input) + if (!output.files?.some((file) => mediaHashFromUri(file.uri))) return output + const files = await Promise.all( + output.files.map(async (file, index) => { + if (!mediaHashFromUri(file.uri)) return [file] + const bytes = await read(file.uri) + if (!bytes) return [] + const mime = input.files?.[index]?.mime ?? "application/octet-stream" + return [{ ...file, uri: `data:${mime};base64,${Buffer.from(bytes).toString("base64")}` }] + }), + ) + return { ...output, files: files.flat() } +} diff --git a/packages/tui/src/prompt/restore.ts b/packages/tui/src/prompt/restore.ts new file mode 100644 index 000000000000..90b8aec6da60 --- /dev/null +++ b/packages/tui/src/prompt/restore.ts @@ -0,0 +1,36 @@ +import { useClient } from "../context/client" +import { useToast } from "../ui/toast" +import { isMissingMedia } from "../util/media" +import { restoredPromptInput, type ProjectedPrompt } from "./codec" +import type { PromptInfo } from "./history" + +/** + * Reads a sent prompt back for the composer, with its images as bytes. Reading before an undo or revert means a failed + * read changes nothing, and the draft owns its bytes before the server releases the blob: an inbox + * cancel releases it at once, a revert once it's committed on the next submit. An image the server no longer has is + * left out with a warning, so it can't block the rewind; `allowMissing: false` rejects instead, as a fork without its + * prompt is not what was asked for. Any other failed read rejects, since that image may still exist. + */ +export function usePromptRestore() { + const client = useClient() + const toast = useToast() + return async (input: ProjectedPrompt, options?: { allowMissing?: false }): Promise => { + let missing = 0 + const prompt = await restoredPromptInput(input, (uri) => + client.media.read(uri).catch((error) => { + if (options?.allowMissing === false || !isMissingMedia(error)) throw error + missing++ + return undefined + }), + ) + if (missing) + toast.show({ + message: + missing === 1 + ? "An image in this message is no longer stored, so it can't be restored" + : `${missing} images in this message are no longer stored, so they can't be restored`, + variant: "warning", + }) + return { ...prompt, pasted: [] } + } +} diff --git a/packages/tui/src/routes/session/dialog-fork.tsx b/packages/tui/src/routes/session/dialog-fork.tsx index 2ba1a27fe144..d2e2b3f95616 100644 --- a/packages/tui/src/routes/session/dialog-fork.tsx +++ b/packages/tui/src/routes/session/dialog-fork.tsx @@ -8,7 +8,7 @@ import { DIALOG_LIST_INSET, DialogHeader, DialogLayout, useDialog } from "../../ import { useToast } from "../../ui/toast" import { errorMessage } from "../../util/error" import { Locale } from "../../util/locale" -import { projectedPromptInput } from "../../prompt/codec" +import { usePromptRestore } from "../../prompt/restore" export function DialogFork(props: { sessionID: string; messageID?: string; onMove?: (messageID?: string) => void }) { const data = useData() @@ -16,10 +16,20 @@ export function DialogFork(props: { sessionID: string; messageID?: string; onMov const client = useClient() const route = useRoute() const toast = useToast() + const restorePrompt = usePromptRestore() const [pending, setPending] = createSignal(!!props.messageID) const fork = async (messageID?: string) => { setPending(true) + const message = messageID ? data.session.message.get(props.sessionID, messageID) : undefined + const prompt = + message?.type === "user" + ? await restorePrompt(message, { allowMissing: false }).catch((error) => { + toast.show({ message: errorMessage(error), variant: "error", duration: 5000 }) + return null + }) + : undefined + if (prompt === null) return dialog.clear() const result = await client.api.session .fork({ sessionID: props.sessionID, @@ -30,18 +40,10 @@ export function DialogFork(props: { sessionID: string; messageID?: string; onMov return undefined }) if (!result) return dialog.clear() - const message = messageID ? data.session.message.get(props.sessionID, messageID) : undefined - const prompt = message?.type === "user" ? projectedPromptInput(message) : undefined route.navigate({ sessionID: result.id, type: "session", - prompt: prompt - ? { - ...prompt, - agents: prompt.agents ?? [], - pasted: [], - } - : undefined, + prompt: prompt && { ...prompt, agents: prompt.agents ?? [] }, }) dialog.clear() toast.show({ message: "Forked session", variant: "success", duration: 4000 }) diff --git a/packages/tui/src/routes/session/dialog-message.tsx b/packages/tui/src/routes/session/dialog-message.tsx index bf706ddb5666..5b2b67419d9a 100644 --- a/packages/tui/src/routes/session/dialog-message.tsx +++ b/packages/tui/src/routes/session/dialog-message.tsx @@ -1,4 +1,5 @@ import { createMemo } from "solid-js" +import { useRenderer } from "@opentui/solid" import { useData } from "../../context/data" import { DialogSelect } from "../../ui/dialog-select" import { useClipboard } from "../../context/clipboard" @@ -6,19 +7,17 @@ import { useToast } from "../../ui/toast" import { useClient } from "../../context/client" import { errorMessage } from "../../util/error" import { DialogFork } from "./dialog-fork" -import type { PromptInfo } from "../../prompt/history" -import { projectedPromptInput } from "../../prompt/codec" +import { usePromptRestore } from "../../prompt/restore" import { useNewDesigns } from "../../config" +import { appendToSessionPrompt } from "../../component/prompt/draft-stash" -export function DialogMessage(props: { - messageID: string - sessionID: string - setPrompt?: (prompt: PromptInfo) => void -}) { +export function DialogMessage(props: { messageID: string; sessionID: string }) { const data = useData() const clipboard = useClipboard() const toast = useToast() const client = useClient() + const renderer = useRenderer() + const restorePrompt = usePromptRestore() const newDesigns = useNewDesigns() const message = createMemo(() => data.session.message.get(props.sessionID, props.messageID)) @@ -39,15 +38,13 @@ export function DialogMessage(props: { description: "undo messages and file changes", onSelect: (dialog) => { const value = message() - if (value?.type === "user") { - props.setPrompt?.({ - ...projectedPromptInput(value), - pasted: [], - }) - } - void client.api.session.revert - .stage({ sessionID: props.sessionID, messageID: props.messageID }) - .catch((error) => toast.show({ message: errorMessage(error), variant: "error", duration: 5000 })) + const { sessionID, messageID } = props + // The composer changes only once the revert is staged, so a failed revert leaves the draft alone. + void (async () => { + const restored = value?.type === "user" ? await restorePrompt(value) : undefined + await client.api.session.revert.stage({ sessionID, messageID }) + if (restored) appendToSessionPrompt(sessionID, restored, renderer.widthMethod) + })().catch((error) => toast.show({ message: errorMessage(error), variant: "error", duration: 5000 })) dialog.clear() }, }, diff --git a/packages/tui/src/routes/session/dialog-timeline.tsx b/packages/tui/src/routes/session/dialog-timeline.tsx index fdf6454cf4e4..3b51ca919f4b 100644 --- a/packages/tui/src/routes/session/dialog-timeline.tsx +++ b/packages/tui/src/routes/session/dialog-timeline.tsx @@ -4,13 +4,8 @@ import { DialogSelect, type DialogSelectOption } from "../../ui/dialog-select" import { Locale } from "../../util/locale" import { DialogMessage } from "./dialog-message" import { useDialog } from "../../ui/dialog" -import type { PromptInfo } from "../../prompt/history" -export function DialogTimeline(props: { - sessionID: string - onMove: (messageID: string) => void - setPrompt?: (prompt: PromptInfo) => void -}) { +export function DialogTimeline(props: { sessionID: string; onMove: (messageID: string) => void }) { const data = useData() const dialog = useDialog() @@ -28,9 +23,7 @@ export function DialogTimeline(props: { value: message.id, footer: Locale.time(message.time.created), onSelect: (dialog) => { - dialog.replace(() => ( - - )) + dialog.replace(() => ) }, }) } diff --git a/packages/tui/src/routes/session/index.tsx b/packages/tui/src/routes/session/index.tsx index 82be1e432d74..318e9d5aecdd 100644 --- a/packages/tui/src/routes/session/index.tsx +++ b/packages/tui/src/routes/session/index.tsx @@ -33,15 +33,17 @@ import { type Renderable, } from "@opentui/core" import { Prompt, type PromptRef } from "../../component/prompt" -import type { - SessionMessageInfo, - SessionMessageAssistant, - SessionMessageAssistantReasoning, - SessionMessageAssistantText, - SessionMessageAssistantTool, - SessionMessageUser, - SessionInfo, - ModelInfo, +import { + mediaHashFromUri, + type PromptAttachment, + type SessionMessageInfo, + type SessionMessageAssistant, + type SessionMessageAssistantReasoning, + type SessionMessageAssistantText, + type SessionMessageAssistantTool, + type SessionMessageUser, + type SessionInfo, + type ModelInfo, } from "@opencode/client" import { useLocal } from "../../context/local" import { Locale } from "../../util/locale" @@ -66,6 +68,7 @@ import { DialogSelect } from "../../ui/dialog-select" import { DialogSessionRename } from "../../component/dialog-session-rename" import { TodoItem } from "../../component/todo-item" import { DialogImagePreview } from "../../component/dialog-image-preview" +import { createMediaSource } from "../../component/media-source" import { statusLabel } from "../../component/dialog-workspace-file-changes" import { DialogMessage } from "./dialog-message" import { DialogFork } from "./dialog-fork" @@ -80,8 +83,9 @@ import { errorMessage } from "../../util/error" import { useToast } from "../../ui/toast" import stripAnsi from "strip-ansi" import { usePromptRef } from "../../context/prompt" -import { projectedPromptInput } from "../../prompt/codec" -import { appendPrompt } from "../../prompt/history" +import { usePromptRestore } from "../../prompt/restore" +import { appendToSessionPrompt } from "../../component/prompt/draft-stash" +import type { ProjectedPrompt } from "../../prompt/codec" import { deduplicateVisibleImages } from "../../prompt/attachment" import { useEpilogue } from "../../context/epilogue" import { normalizePath } from "../../util/path" @@ -260,6 +264,7 @@ export function Session(props: { const scrollAcceleration = createMemo(() => getScrollAcceleration(config)) const toast = useToast() + const restorePrompt = usePromptRestore() const client = useClient() const autoApproved = new Set() createEffect(() => { @@ -642,32 +647,39 @@ export function Session(props: { // Restore the prompt when the free allowance or an OpenCode Go limit stops it, and offer OpenCode Go on the first free // allowance hit in a day. onCleanup( - data.on("session.step.failed", (event) => { + data.on("session.step.failed", async (event) => { const type = event.data.error.type if (event.data.sessionID !== route.sessionID) return if (type !== "provider.free-limit" && type !== "provider.go-limit") return if (handledLimits.has(event.data.assistantMessageID)) return handledLimits.add(event.data.assistantMessageID) - const current = prompt() - const wasEmpty = Boolean( - current && - !current.current.text.trim() && - !current.current.files?.length && - !current.current.agents?.length && - !current.current.skills?.length && - !current.current.pasted.length, - ) - if (!wasEmpty || !current) return + const empty = (ref: PromptRef | undefined): ref is PromptRef => + !!ref && + !ref.current.text.trim() && + !ref.current.files?.length && + !ref.current.agents?.length && + !ref.current.skills?.length && + !ref.current.pasted.length + if (!empty(prompt())) return const list = messages() const end = list.findIndex((item) => item.id === event.data.assistantMessageID) - for (let i = end - 1; i >= 0; i--) { + let recalled: SessionMessageUser | undefined + for (let i = end - 1; i >= 0 && !recalled; i--) { const item = list[i] if (!item || item.type === "shell" || item.type === "idle") break - if (item.type === "user" && !data.session.input.has(route.sessionID, item.id)) { - current.set({ ...projectedPromptInput(item), pasted: [] }) - break - } + if (item.type === "user" && !data.session.input.has(route.sessionID, item.id)) recalled = item } + const restored = recalled + ? await restorePrompt(recalled).catch((error) => { + toast.show({ message: errorMessage(error), variant: "error", duration: 5000 }) + return null + }) + : undefined + // Media refs load before the prompt comes back; typing or a shell command meanwhile keeps it and skips the offer. + if (restored === null || sessionDisposed || route.sessionID !== event.data.sessionID) return + const current = prompt() + if (!empty(current) || current.mode !== "normal") return + if (restored) current.set(restored) if (type === "provider.go-limit" || dialog.stack.length > 0) return if (goUpsell.dontShow || goUpsellMemory.dontShow) return const now = Date.now() @@ -747,25 +759,33 @@ export function Session(props: { }), ) const runPendingAction = createSingleFlight() - const mutatePending = async (action: PendingAction, inboxID: string, failureLabel?: string) => { - const result = await runPendingAction(inboxID, async () => { - const request = - action === "steer" - ? client.api.session.inbox.update({ sessionID: route.sessionID, inboxID, delivery: "steer" }) - : action === "queue" - ? client.api.session.inbox.update({ sessionID: route.sessionID, inboxID, delivery: "queue" }) - : client.api.session.inbox.cancel({ sessionID: route.sessionID, inboxID }) - const error = await request.then( - () => undefined, - (error) => error, - ) - if (!error) return true - const label = failureLabel ?? (action === "cancel" ? "delete" : action) - toast.show({ title: `Failed to ${label} pending prompt`, message: errorMessage(error), variant: "error" }) - return false - }) - return result ?? false + // Uses the captured sessionID: after an await, route.sessionID may already name another tab, or none. + const requestPending = async (action: PendingAction, inboxID: string, failureLabel?: string) => { + const request = + action === "steer" + ? client.api.session.inbox.update({ sessionID, inboxID, delivery: "steer" }) + : action === "queue" + ? client.api.session.inbox.update({ sessionID, inboxID, delivery: "queue" }) + : client.api.session.inbox.cancel({ sessionID, inboxID }) + const error = await request.then( + () => undefined, + (error) => error, + ) + if (!error) return true + const label = failureLabel ?? (action === "cancel" ? "delete" : action) + toast.show({ title: `Failed to ${label} pending prompt`, message: errorMessage(error), variant: "error" }) + return false } + const mutatePending = async (action: PendingAction, inboxID: string) => + (await runPendingAction(inboxID, () => requestPending(action, inboxID))) ?? false + // The cancel releases blobs nothing else references, so media refs load into the draft first. Resolves with the + // composer it wrote to, if any, once the prompt is back; undefined if the cancel failed or was already running. + const undoPending = (inboxID: string, message: ProjectedPrompt, failureLabel?: string) => + runPendingAction(inboxID, async () => { + const restored = await restorePrompt(message) + if (!(await requestPending("cancel", inboxID, failureLabel))) return + return { composer: appendToSessionPrompt(sessionID, restored, renderer.widthMethod) } + }) const openQueuedPrompts = () => dialog.replace(() => ( { - if (!undone) return - target.setMode("normal") - target.set( - appendPrompt( - target.current, - { ...projectedPromptInput(queued.payload), pasted: [] }, - renderer.widthMethod, - ), + void undoPending(queued.id, queued.payload, "undo") + .then((undone) => { + if (!undone || sessionDisposed) return + dialog.clear() + undone.composer?.focus() + }) + .catch((error) => + toast.show({ + title: "Failed to undo pending prompt", + message: errorMessage(error), + variant: "error", + }), ) - dialog.clear() - target.focus() - }) }, }, ]} @@ -1053,13 +1073,7 @@ export function Session(props: { group: "Session", slash: { name: "timeline" }, run: () => { - dialog.replace(() => ( - promptRef.current?.set(value)} - /> - )) + dialog.replace(() => ) }, }, { @@ -1117,21 +1131,16 @@ export function Session(props: { dialog.clear() return } - const sessionID = route.sessionID - const target = prompt() - void (async () => { - if (pendingDeliveries().has(message.id)) { - if (!(await mutatePending("cancel", message.id))) return - } else { - await client.api.session.interrupt({ sessionID }) - await client.api.experimental.session.wait({ sessionID }) - await client.api.session.revert.stage({ sessionID, messageID: message.id }) - } - target?.set({ - ...projectedPromptInput(message), - pasted: [], - }) - })().catch((error) => toast.show({ message: errorMessage(error), variant: "error", duration: 5000 })) + const undo = pendingDeliveries().has(message.id) + ? undoPending(message.id, message) + : (async () => { + const restored = await restorePrompt(message) + await client.api.session.interrupt({ sessionID }) + await client.api.experimental.session.wait({ sessionID }) + await client.api.session.revert.stage({ sessionID, messageID: message.id }) + appendToSessionPrompt(sessionID, restored, renderer.widthMethod) + })() + void undo.catch((error) => toast.show({ message: errorMessage(error), variant: "error", duration: 5000 })) dialog.clear() }, }, @@ -2354,11 +2363,14 @@ function UserMessage(props: { message: SessionMessageUser }) { const newDesigns = useNewDesigns() const data = useData() const local = useLocal() - const files = createMemo(() => deduplicateVisibleImages(props.message.files ?? [])) + // Opted-in reads leave stored files as `media:` refs, a PromptAttachment variant the generated message type omits. + const files = createMemo(() => deduplicateVisibleImages(props.message.files ?? [])) const skills = createMemo(() => props.message.skills ?? []) const images = createMemo(() => files().flatMap((file) => - file.mime.startsWith("image/") ? [{ uri: `data:${file.mime};base64,${file.data}` }] : [], + file.mime.startsWith("image/") + ? [{ uri: "uri" in file ? file.uri : `data:${file.mime};base64,${file.data}` }] + : [], ), ) const themes = useThemes() @@ -2369,7 +2381,6 @@ function UserMessage(props: { message: SessionMessageUser }) { const delivery = createMemo(() => ctx.pendingDelivery(props.message.id)) const dialog = useDialog() const renderer = useRenderer() - const promptRef = usePromptRef() const updatePendingSteer = async (action: "queue" | "cancel") => { if (await ctx.mutatePending(action, props.message.id)) dialog.clear() @@ -2411,13 +2422,7 @@ function UserMessage(props: { message: SessionMessageUser }) { } // The dialog outlives this row, whose props go stale when a resync drops the message. const messageID = props.message.id - dialog.replace(() => ( - promptRef.current?.set(value)} - /> - )) + dialog.replace(() => ) }} paddingTop={1} paddingBottom={1} @@ -2675,7 +2680,7 @@ function SessionImages(props: { images: readonly { uri: string }[]; paddingLeft? > {(image, index) => { - const [failed, setFailed] = createSignal(false) + const media = createMediaSource(() => image.uri) return ( ) }} > - No preview}> + No preview}> setFailed(true)} + onError={media.onError} /> @@ -2718,7 +2723,9 @@ function SessionImages(props: { images: readonly { uri: string }[]; paddingLeft? function inlineToolImages(part: SessionMessageAssistantTool) { return toolDisplayContent(part.state).flatMap((content) => - content.type === "file" && content.mime.startsWith("image/") && content.uri.startsWith("data:image/") + content.type === "file" && + content.mime.startsWith("image/") && + (content.uri.startsWith("data:image/") || mediaHashFromUri(content.uri)) ? [{ uri: content.uri }] : [], ) diff --git a/packages/tui/src/util/media.ts b/packages/tui/src/util/media.ts new file mode 100644 index 000000000000..0d811a1a03db --- /dev/null +++ b/packages/tui/src/util/media.ts @@ -0,0 +1,43 @@ +import { mediaHashFromUri, type OpenCodeClient } from "@opencode/client" + +export type MediaCache = ReturnType + +/** + * Bytes for `media:` refs, read from the server the first time something shows or restores them. A hash names + * its bytes, so entries stay valid across reconnects. + */ +export function createMediaCache( + api: () => { experimental: { media: Pick } }, +) { + const bytes = new Map() + const inflight = new Map>() + + return { + peek: (uri: string) => { + const hash = mediaHashFromUri(uri) + return hash ? bytes.get(hash) : undefined + }, + read: (uri: string) => { + const hash = mediaHashFromUri(uri) + if (!hash) return Promise.reject(new Error(`Not a media ref: ${uri}`)) + const cached = bytes.get(hash) + if (cached) return Promise.resolve(cached) + const pending = + inflight.get(hash) ?? + api() + .experimental.media.get({ hash }) + .then((result) => { + bytes.set(hash, result) + return result + }) + .finally(() => inflight.delete(hash)) + inflight.set(hash, pending) + return pending + }, + } +} + +/** The server answered that the blob is gone (404), as opposed to a failure where it may still exist. */ +export function isMissingMedia(error: unknown) { + return error instanceof Error && error.name === "FileNotFoundError" +} diff --git a/packages/tui/test/fixture/plugin/client-reads/tui.tsx b/packages/tui/test/fixture/plugin/client-reads/tui.tsx new file mode 100644 index 000000000000..e5c5d519b98e --- /dev/null +++ b/packages/tui/test/fixture/plugin/client-reads/tui.tsx @@ -0,0 +1,9 @@ +import { Plugin } from "@opencode/plugin/tui" + +// Reads messages through the plugin client, whose files must stay inline bytes. +export default Plugin.define({ + id: "fixture.client-reads", + setup(context) { + void context.client.message.list({ sessionID: "ses_plugin_probe" }) + }, +}) diff --git a/packages/tui/test/prompt/attachment.test.ts b/packages/tui/test/prompt/attachment.test.ts index 643c4a95c834..ce04d421238b 100644 --- a/packages/tui/test/prompt/attachment.test.ts +++ b/packages/tui/test/prompt/attachment.test.ts @@ -122,4 +122,17 @@ describe("prompt attachments", () => { ] expect(deduplicateVisibleImages([file, ...distinct])).toEqual([file, ...distinct]) }) + + test("deduplicates visible image cards the server sent as media refs by their ref", () => { + const file = { + uri: `media:${"a".repeat(64)}`, + mime: "image/png", + source: { type: "inline" }, + name: "clipboard", + mention: { text: "[Image 1]" }, + } + const other = { ...file, uri: `media:${"b".repeat(64)}` } + + expect(deduplicateVisibleImages([file, { ...file }, other])).toEqual([file, other]) + }) }) diff --git a/packages/tui/test/prompt/codec.test.ts b/packages/tui/test/prompt/codec.test.ts index 42db78d6892e..20832b65cb88 100644 --- a/packages/tui/test/prompt/codec.test.ts +++ b/packages/tui/test/prompt/codec.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test" import type { Prompt } from "@opencode/schema" -import { projectedPromptInput } from "../../src/prompt/codec" +import { projectedPromptInput, restoredPromptInput } from "../../src/prompt/codec" describe("prompt codec", () => { test("converts projected URI and inline attachments without mutation", () => { @@ -59,3 +59,78 @@ describe("prompt codec", () => { }) }) }) + +describe("restored prompt input", () => { + const hash = "c".repeat(64) + const message = { + text: "Compare [Image 1] with [Image 2]", + files: [ + { + uri: `media:${hash}`, + mime: "image/png", + source: { type: "inline" }, + name: "stored.png", + mention: { start: 8, end: 17, text: "[Image 1]" }, + }, + { + data: "YWJj", + mime: "image/jpeg", + source: { type: "inline" }, + name: "inline.jpg", + mention: { start: 23, end: 32, text: "[Image 2]" }, + }, + ], + } satisfies Parameters[0] + + test("keeps media refs as refs in the synchronous projection", () => { + expect(projectedPromptInput(message).files?.map((file) => file.uri)).toEqual([ + `media:${hash}`, + "data:image/jpeg;base64,YWJj", + ]) + }) + + test("reads media refs back into data URIs and leaves inline files alone", async () => { + const reads: string[] = [] + const output = await restoredPromptInput(message, async (uri) => { + reads.push(uri) + return new Uint8Array([137, 80, 78, 71]) + }) + + expect(reads).toEqual([`media:${hash}`]) + expect(output).toEqual({ + ...projectedPromptInput(message), + files: [ + { + uri: `data:image/png;base64,${Buffer.from([137, 80, 78, 71]).toString("base64")}`, + name: "stored.png", + description: undefined, + mention: { start: 8, end: 17, text: "[Image 1]" }, + }, + { + uri: "data:image/jpeg;base64,YWJj", + name: "inline.jpg", + description: undefined, + mention: { start: 23, end: 32, text: "[Image 2]" }, + }, + ], + }) + }) + + test("reads nothing for a prompt without media refs", async () => { + const inline = { ...message, files: [message.files[1]] } + const output = await restoredPromptInput(inline, () => Promise.reject(new Error("unexpected read"))) + + expect(output).toEqual(projectedPromptInput(inline)) + }) + + test("rejects when a media ref cannot be read, so callers keep the server copy", async () => { + await expect(restoredPromptInput(message, () => Promise.reject(new Error("offline")))).rejects.toThrow("offline") + }) + + test("leaves out a file whose read resolves undefined", async () => { + const output = await restoredPromptInput(message, async () => undefined) + + expect(output.text).toBe(message.text) + expect(output.files?.map((file) => file.uri)).toEqual(["data:image/jpeg;base64,YWJj"]) + }) +}) diff --git a/packages/tui/test/session-media-refs.test.tsx b/packages/tui/test/session-media-refs.test.tsx new file mode 100644 index 000000000000..3efba502a407 --- /dev/null +++ b/packages/tui/test/session-media-refs.test.tsx @@ -0,0 +1,359 @@ +import { expect, test } from "bun:test" +import { createAppFixture } from "./fixture/app" +import { directory, json } from "./fixture/tui-client" +import { takeDraft } from "../src/component/prompt/draft-stash" +import type { PromptInfo } from "../src/prompt/history" +import { copyPlugin } from "./fixture/fixture" + +const hash = "e".repeat(64) +const png = Buffer.from( + "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=", + "base64", +) +const pngURI = `data:image/png;base64,${png.toString("base64")}` +const session = { + id: "ses_media_refs", + title: "Media refs", + projectID: "proj_test", + location: { directory }, + cost: 0, + tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } }, + time: { created: 0, updated: 0 }, +} +const messages = [ + { + type: "assistant", + id: "msg_reply", + agent: "build", + model: { providerID: "fixture", id: "fixture" }, + finish: "stop", + time: { created: 2, completed: 3 }, + content: [{ type: "text", text: "Looked at it" }], + }, + { + type: "user", + id: "msg_shot", + text: "What is in [Image 1]", + files: [ + { + uri: `media:${hash}`, + mime: "image/png", + source: { type: "inline" }, + name: "shot.png", + mention: { start: 11, end: 20, text: "[Image 1]" }, + }, + ], + time: { created: 1 }, + }, +] +// What forking from msg_shot opens: its own transcript, with a different prompt to undo. +const forked = { ...session, id: "ses_forked", title: "Forked" } +const forkedMessages = [ + { ...messages[0], id: "msg_forked_reply" }, + { ...messages[1], id: "msg_forked_ask", text: "Forked ask [Image 1]" }, +] +const queuedShot = { + id: "msg_queued", + sessionID: session.id, + type: "user", + delivery: "queue", + payload: messages[1], + time: { created: 4 }, +} + +// The requests a rewind makes, logged with their status. +const MEDIA = `GET /api/experimental/media/${hash}` +const REVERT = `POST /api/session/${session.id}/revert/stage` +const CANCEL = `DELETE /api/session/${session.id}/inbox/msg_queued` +const FORK = `POST /api/session/${session.id}/fork` +const FORKED_REVERT = `POST /api/session/${forked.id}/revert/stage` + +type Respond = () => Response | Promise +const image: Respond = () => new Response(png, { headers: { "content-type": "image/png" } }) +// What the server answers once a blob is swept, and a failure where the blob may still exist. +const gone: Respond = () => + json({ _tag: "FileNotFoundError", path: `/api/experimental/media/${hash}`, message: "gone" }, { status: 404 }) +const unavailable: Respond = () => new Response("unavailable", { status: 503 }) + +/** Opens the session against a fake server. `calls` logs media reads and rewinds as ` `. */ +async function openSession(server: { inbox?: unknown[]; plugins?: string[]; respond?: Record }) { + // Drafts are stashed per tab for the whole process, so an earlier test or test file would prefill a composer. A home + // draft would also turn the slash command typed there by `leaveAndReturn` into more text. + for (const id of [undefined, session.id, forked.id]) takeDraft(id) + const calls: string[] = [] + const capabilities = new Map() + const logged: Partial> = { + [MEDIA]: image, + [REVERT]: () => json({ data: session }), + [CANCEL]: () => new Response(null, { status: 204 }), + [FORK]: () => json({ data: forked }), + [FORKED_REVERT]: () => json({ data: forked }), + ...server.respond, + } + const setup = await createAppFixture({ + width: 100, + height: 30, + config: { animations: false, tabs: { enabled: false }, plugins: server.plugins }, + args: { sessionID: session.id }, + fetch: async (url, request) => { + const key = `${request.method} ${url.pathname}` + const [, id, rest] = /^\/api\/(?:experimental\/)?session\/([^/]+)(.*)$/.exec(url.pathname) ?? [] + const info = [session, forked].find((item) => item.id === id) + if (rest === "/message") { + capabilities.set(url.pathname, request.headers.get("x-opencode-capabilities")) + return json({ data: id === session.id ? messages : id === forked.id ? forkedMessages : [], cursor: {} }) + } + if (url.pathname === "/api/session") return json({ data: [session], cursor: {} }) + if (info && (rest === "" || rest === "/interrupt")) return json({ data: info }) + if (info && rest === "/inbox") return json({ data: id === session.id ? (server.inbox ?? []) : [] }) + if (info && rest === "/permission") return json({ data: [] }) + if (info && rest === "/wait") return new Response(null, { status: 204 }) + const respond = logged[key] + if (!respond) return undefined + // Logged on arrival, so a test can act while a read is still waiting; the status is added once it answers. + calls.push(key) + const response = await respond() + calls[calls.lastIndexOf(key)] = `${key} ${response.status}` + return response + }, + }) + await setup.waitForFrame((frame) => frame.includes("Looked at it")) + return Object.assign(setup, { calls, capabilities }) +} + +type App = Awaited> + +async function undoLast(app: App) { + await app.mockInput.typeText("/undo") + app.mockInput.pressEnter() +} + +async function undoQueued(app: App) { + app.mockInput.pressKey("x", { ctrl: true }) + app.mockInput.pressKey("q") + await app.waitForFrame((frame) => frame.includes("Queued prompts")) + app.mockInput.pressKey("u", { ctrl: true }) + await app.waitForFrame(() => true) +} + +// Picks one of a message's actions from /timeline. +async function messageAction(app: App, action: string) { + await app.mockInput.typeText("/timeline") + app.mockInput.pressEnter() + await app.waitForFrame((frame) => frame.includes("Jump to message") || frame.includes("Timeline")) + app.mockInput.pressEnter() + await app.waitForFrame((frame) => frame.includes(action)) + await app.mockInput.typeText(action) + app.mockInput.pressEnter() +} + +// Waits for `done`, then gives anything that shouldn't follow, such as a rewind after a failed read or a composer +// change, time to show before reading the frame. +async function settled(app: App, done: (frame: string) => boolean) { + await app.waitForFrame(done) + await Bun.sleep(50) + return app.waitForFrame(() => true) +} + +// How many times the frame shows the prompt: once in the transcript, twice once it is also back in the composer. +const shown = (frame: string) => frame.split("What is in [Image 1]").length - 1 + +test("reads transcripts with media refs and loads a ref's bytes before /undo rewinds its message", async () => { + await using app = await openSession({}) + expect([...app.capabilities.values()]).toEqual(["experimental-media-uri"]) + // Image previews are off by default, so showing the transcript reads no media. + expect(app.calls).toEqual([]) + + await undoLast(app) + await app.waitForFrame((frame) => shown(frame) === 2) + expect(app.calls).toEqual([`${MEDIA} 200`, `${REVERT} 200`]) +}, 20000) + +// Starts an undo, leaves the session while its media read waits, then lets the read finish. +async function undoAfterLeaving(input: { inbox: unknown[]; undo: (app: App) => Promise }) { + const media = Promise.withResolvers() + await using app = await openSession({ inbox: input.inbox, respond: { [MEDIA]: () => media.promise.then(image) } }) + await input.undo(app) + await app.waitForFrame(() => app.calls.length > 0) + await app.mockInput.typeText("/new") + app.mockInput.pressEnter() + await app.waitForFrame((frame) => !frame.includes("Looked at it")) + media.resolve() + // The rewind's request is logged on arrival, but the draft is written only once its response is back. + let draft: PromptInfo | undefined + await app.waitForFrame(() => (draft ??= takeDraft(session.id)?.prompt) !== undefined) + return { calls: app.calls, draft } +} + +test("an /undo that finishes after its session closed keeps the prompt in that session's draft", async () => { + const { calls, draft } = await undoAfterLeaving({ inbox: [], undo: undoLast }) + + expect(calls).toEqual([`${MEDIA} 200`, `${REVERT} 200`]) + expect(draft?.text).toBe("What is in [Image 1]") + expect(draft?.files?.map((file) => file.uri)).toEqual([pngURI]) +}, 20000) + +test("undoing a queued prompt after its session closed cancels it in that session and keeps it as a draft", async () => { + const { calls, draft } = await undoAfterLeaving({ + inbox: [queuedShot], + undo: async (app) => { + await undoQueued(app) + app.mockInput.pressEscape() + }, + }) + + expect(calls).toEqual([`${MEDIA} 200`, `${CANCEL} 204`]) + expect(draft?.text).toBe("What is in [Image 1]") + expect(draft?.files?.map((file) => file.uri)).toEqual([pngURI]) +}, 20000) + +// Undoes a prompt whose image read fails, until `done` shows the outcome. The composer is read from the draft it leaves +// when the app closes. +async function undoWithFailedRead(media: Respond, queued: boolean, done: (frame: string, app: App) => boolean) { + const result = await (async () => { + await using app = await openSession({ inbox: queued ? [queuedShot] : [], respond: { [MEDIA]: media } }) + await (queued ? undoQueued(app) : undoLast(app)) + const frame = await settled(app, (frame) => app.calls.length > 0 && done(frame, app)) + return { calls: app.calls, frame } + })() + return { ...result, draft: takeDraft(session.id)?.prompt } +} + +for (const queued of [false, true]) { + const name = queued ? "undoing a queued prompt" : "/undo" + + test(`${name} goes ahead without an image the server no longer has`, async () => { + // The warning shows before the rewind; the prompt reaches the composer once it's done. + const { calls, frame, draft } = await undoWithFailedRead( + gone, + queued, + (frame, app) => + frame.includes("no longer stored") && !!app.renderer.currentFocusedEditor?.plainText.includes("What is in"), + ) + + expect(calls).toEqual([`${MEDIA} 404`, queued ? `${CANCEL} 204` : `${REVERT} 200`]) + expect(draft?.text).toBe("What is in [Image 1]") + expect(draft?.files).toEqual([]) + expect(frame).toContain("no longer stored") + }, 20000) + + test(`${name} keeps the message when an image read fails for another reason`, async () => { + const { calls, draft } = await undoWithFailedRead(unavailable, queued, (frame) => /unavailable|503/i.test(frame)) + + expect(calls).toEqual([`${MEDIA} 503`]) + expect(draft).toBeUndefined() + }, 20000) +} + +test("a revert the server refuses leaves the composer as it was", async () => { + await using app = await openSession({ + respond: { [REVERT]: () => json({ name: "BusyError", data: {} }, { status: 409 }) }, + }) + await messageAction(app, "Revert") + const frame = await settled(app, () => app.calls.includes(`${REVERT} 409`)) + + expect(app.calls).toEqual([`${MEDIA} 200`, `${REVERT} 409`]) + expect(shown(frame)).toBe(1) +}, 20000) + +test("a revert goes ahead without an image the server no longer has", async () => { + await using app = await openSession({ respond: { [MEDIA]: gone } }) + await messageAction(app, "Revert") + const frame = await settled(app, (frame) => shown(frame) === 2) + + expect(app.calls).toEqual([`${MEDIA} 404`, `${REVERT} 200`]) + expect(shown(frame)).toBe(2) + expect(frame).toContain("no longer stored") +}, 20000) + +test("a revert whose image read fails for another reason does not revert", async () => { + await using app = await openSession({ respond: { [MEDIA]: unavailable } }) + await messageAction(app, "Revert") + const frame = await settled(app, () => app.calls.includes(`${MEDIA} 503`)) + + expect(app.calls).toEqual([`${MEDIA} 503`]) + expect(shown(frame)).toBe(1) +}, 20000) + +test("forking from a prompt whose image is gone does not fork", async () => { + await using app = await openSession({ respond: { [MEDIA]: gone } }) + await messageAction(app, "Fork") + await settled(app, () => app.calls.includes(`${MEDIA} 404`)) + + expect(app.calls).toEqual([`${MEDIA} 404`]) +}, 20000) + +test("plugins read messages with inline bytes while the transcript reads media refs", async () => { + await using plugin = await copyPlugin("client-reads") + await using app = await openSession({ plugins: [plugin.directory] }) + await app.waitForFrame(() => app.capabilities.size === 2) + + expect(Object.fromEntries(app.capabilities)).toEqual({ + [`/api/session/${session.id}/message`]: "experimental-media-uri", + "/api/session/ses_plugin_probe/message": null, + }) +}, 20000) + +async function leaveAndReturn(app: App) { + // A leader key, since text in the composer would turn a slash command into more text. + app.mockInput.pressKey("x", { ctrl: true }) + app.mockInput.pressKey("n") + await app.waitForFrame((frame) => !frame.includes("Looked at it")) + await app.mockInput.typeText("/sessions") + app.mockInput.pressEnter() + await app.waitForFrame((frame) => frame.includes("Sessions") && frame.includes("Media refs")) + app.mockInput.pressEnter() + await app.waitForFrame((frame) => frame.includes("Looked at it")) +} + +for (const queued of [false, true]) { + const name = queued ? "a queued-prompt undo" : "an /undo" + + test(`${name} that finishes after leaving and returning joins what was typed since`, async () => { + const media = Promise.withResolvers() + const result = await (async () => { + await using app = await openSession({ + inbox: queued ? [queuedShot] : [], + respond: { [MEDIA]: () => media.promise.then(image) }, + }) + if (queued) { + await undoQueued(app) + app.mockInput.pressEscape() + } else await undoLast(app) + await app.waitForFrame(() => app.calls.length > 0) + await leaveAndReturn(app) + await app.mockInput.typeText("typed note") + media.resolve() + // The rewind finishes by appending the prompt to the live composer, after what was typed. + await app.waitForFrame(() => !!app.renderer.currentFocusedEditor?.plainText.includes("What is in")) + await leaveAndReturn(app) + return { calls: app.calls, frame: await app.waitForFrame((frame) => frame.includes("typed note")) } + })() + const draft = takeDraft(session.id)?.prompt + + expect(result.calls).toEqual([`${MEDIA} 200`, queued ? `${CANCEL} 204` : `${REVERT} 200`]) + expect(result.frame).toContain("typed note") + expect(draft?.text).toBe("typed note\n\nWhat is in [Image 1]") + expect(draft?.files?.map((file) => file.uri)).toEqual([pngURI]) + }, 30000) +} + +test("an undo in a session opened with a seeded prompt, such as a fork, lands in its composer", async () => { + const result = await (async () => { + await using app = await openSession({}) + await messageAction(app, "Fork") + // The fork opens with the forked-from prompt already in its composer. + await app.waitForFrame((frame) => frame.includes("Forked ask") && frame.includes("What is in [Image 1]")) + app.mockInput.pressKey("x", { ctrl: true }) + app.mockInput.pressKey("u") + // Once in the transcript and once more in the composer, after the seeded prompt. + const frame = await settled(app, (frame) => frame.split("Forked ask").length - 1 === 2) + return { calls: app.calls, frame } + })() + const draft = takeDraft(forked.id)?.prompt + + expect(result.calls).toEqual([`${MEDIA} 200`, `${FORK} 200`, `${FORKED_REVERT} 200`]) + expect(result.frame).toContain("What is in [Image 1]") + expect(draft?.text).toBe("What is in [Image 1]\n\nForked ask [Image 1]") + expect(draft?.files?.map((file) => file.uri)).toEqual([pngURI, pngURI]) +}, 30000) diff --git a/packages/tui/test/util/media.test.ts b/packages/tui/test/util/media.test.ts new file mode 100644 index 000000000000..83d786b3120e --- /dev/null +++ b/packages/tui/test/util/media.test.ts @@ -0,0 +1,54 @@ +import { describe, expect, test } from "bun:test" +import { createMediaCache } from "../../src/util/media" + +const hash = "d".repeat(64) + +function setup(get: (input: { hash: string }) => Promise) { + const calls: string[] = [] + const cache = createMediaCache(() => ({ + experimental: { + media: { + get: (input: { hash: string }) => { + calls.push(input.hash) + return get(input) + }, + }, + }, + })) + return { cache, calls } +} + +describe("media cache", () => { + test("reads each hash once, sharing a request in flight", async () => { + const bytes = new Uint8Array([1, 2, 3]) + const { cache, calls } = setup(async () => bytes) + + expect(cache.peek(`media:${hash}`)).toBeUndefined() + const [first, second] = await Promise.all([cache.read(`media:${hash}`), cache.read(`media:${hash}`)]) + + expect(first).toBe(bytes) + expect(second).toBe(bytes) + expect(await cache.read(`media:${hash}`)).toBe(bytes) + expect(cache.peek(`media:${hash}`)).toBe(bytes) + expect(calls).toEqual([hash]) + }) + + test("retries a hash whose read failed", async () => { + const results = [Promise.reject(new Error("offline")), Promise.resolve(new Uint8Array([4]))] + const { cache, calls } = setup(() => results.shift()!) + + await expect(cache.read(`media:${hash}`)).rejects.toThrow("offline") + expect(cache.peek(`media:${hash}`)).toBeUndefined() + expect(await cache.read(`media:${hash}`)).toEqual(new Uint8Array([4])) + expect(calls).toEqual([hash, hash]) + }) + + test("never requests anything for a URI that is not a media ref", async () => { + const { cache, calls } = setup(async () => new Uint8Array()) + + expect(cache.peek("data:image/png;base64,AAA")).toBeUndefined() + await expect(cache.read("data:image/png;base64,AAA")).rejects.toThrow("Not a media ref") + await expect(cache.read(`media:${hash.toUpperCase()}`)).rejects.toThrow("Not a media ref") + expect(calls).toEqual([]) + }) +}) From c24760c70a0b5aecc1a4b5f265b43c549a7810f9 Mon Sep 17 00:00:00 2001 From: Filip <34747899+neriousy@users.noreply.github.com> Date: Thu, 29 Oct 2026 21:16:49 +0100 Subject: [PATCH 02/83] fix(tui): highlight PHP code blocks without opening tag (#60359) --- packages/tui/src/parsers-config.ts | 2 +- packages/tui/test/php-highlighting.test.tsx | 122 ++++++++++++++++++++ 2 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 packages/tui/test/php-highlighting.test.tsx diff --git a/packages/tui/src/parsers-config.ts b/packages/tui/src/parsers-config.ts index fcb064e0bf07..3c1012ca4d24 100644 --- a/packages/tui/src/parsers-config.ts +++ b/packages/tui/src/parsers-config.ts @@ -123,7 +123,7 @@ export default { }, { filetype: "php", - wasm: "https://github.com/tree-sitter/tree-sitter-php/releases/download/v0.24.2/tree-sitter-php.wasm", + wasm: "https://github.com/tree-sitter/tree-sitter-php/releases/download/v0.24.2/tree-sitter-php_only.wasm", queries: { highlights: [ // NOTE: This nvim-treesitter query is currently broken, because the parser is not compatible with the query apparently. diff --git a/packages/tui/test/php-highlighting.test.tsx b/packages/tui/test/php-highlighting.test.tsx new file mode 100644 index 000000000000..da7663f22404 --- /dev/null +++ b/packages/tui/test/php-highlighting.test.tsx @@ -0,0 +1,122 @@ +import { afterAll, expect, test } from "bun:test" +import { addDefaultParsers, CodeRenderable, TreeSitterClient, type Renderable } from "@opentui/core" +import { testRender } from "@opentui/solid" +import { ConfigProvider } from "../src/config" +import { ThemeProvider, useTheme, useThemes } from "../src/context/theme" +import parsers from "../src/parsers-config" +import { emptyThemeSource, tmpdir } from "./fixture/fixture" +import { TestTuiContexts } from "./fixture/tui-environment" +import { createTuiResolvedConfig } from "./fixture/tui-runtime" + +addDefaultParsers(parsers.parsers) +const data = await tmpdir() +const client = new TreeSitterClient({ dataPath: data.path }) + +afterAll(async () => { + await client.destroy() + await data[Symbol.asyncDispose]() +}) + +const snippet = [ + "$compiled = parent::getCompiledPath($path);", + "", + "if ($this->echoFormat === self::DEFAULT_ECHO_FORMAT) {", + " return $compiled;", + "}", +].join("\n") + +const content = [ + "Without the tag:", + "", + "```php", + snippet, + "```", + "", + "With the tag:", + "", + "```php", + " { + const output = await testRender( + () => ( + + + + + + + + ), + { width: 80, height: 24, remote: true }, + ) + + try { + await output.renderOnce() + await Promise.all(codeBlocks(output.renderer.root).map((node) => node.highlightingDone)) + await output.renderOnce() + + const lines = output.captureSpans().lines + const prose = lines.find((line) => line.spans.some((span) => span.text.includes("Without the tag:"))) + const openTag = lines.find((line) => line.spans.some((span) => span.text.includes(" span.text.includes("Without the tag:"))!.fg.toInts() + const tagColor = openTag!.spans.find((span) => span.text.includes("echoFormat === self::DEFAULT_ECHO_FORMAT) {", + "return $compiled;", + ]) { + const matches = lines.filter((line) => + line.spans + .map((span) => span.text) + .join("") + .includes(needle), + ) + expect(matches).toHaveLength(2) + + const bare = lineSignature(matches[0]!.spans) + const tagged = lineSignature(matches[1]!.spans) + expect(new Set(tagged.map((span) => span.fg.join(","))).size).toBeGreaterThan(1) + expect(bare).toEqual(tagged) + } + } finally { + output.renderer.destroy() + await output.renderer.closed + } +}) + +function Body() { + const theme = useTheme() + const themes = useThemes() + return ( + + ) +} + +function codeBlocks(node: Renderable): CodeRenderable[] { + return [...(node instanceof CodeRenderable ? [node] : []), ...node.getChildren().flatMap(codeBlocks)] +} + +function lineSignature(spans: ReadonlyArray<{ text: string; fg: { toInts(): number[] } }>) { + return spans.flatMap((span) => { + const text = span.text.trim() + return text.length > 0 ? [{ text, fg: span.fg.toInts() }] : [] + }) +} From 51625f7709fdddb95ff6abaad0b84e79ab53a3f0 Mon Sep 17 00:00:00 2001 From: Dax Date: Thu, 29 Oct 2026 16:23:18 -0400 Subject: [PATCH 03/83] fix(app): keep inbox scroll position when opening a session (#60356) --- packages/app/e2e/regression/tabs.spec.ts | 41 +++++++++++++++++++++++ packages/app/e2e/utils/mock-api.ts | 6 ++++ packages/app/e2e/utils/mock-server.ts | 1 + packages/app/src/shell/titlebar/inbox.tsx | 14 ++++---- 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/packages/app/e2e/regression/tabs.spec.ts b/packages/app/e2e/regression/tabs.spec.ts index cddaca53d54e..f477cf5756ab 100644 --- a/packages/app/e2e/regression/tabs.spec.ts +++ b/packages/app/e2e/regression/tabs.spec.ts @@ -4,6 +4,7 @@ import { NO_PROVIDER, REMOTE_SERVER, SERVER, + T0, draftHref, expectPath, holdRoute, @@ -1356,3 +1357,43 @@ async function emptySidePanel(page: Page) { return { beta, alphaTab: page.locator(`[data-titlebar-tab-slot]:has(a[href="${sessionHref(alpha.id)}"])`) } } + +test("opening a session from the inbox keeps the list's scroll position and rows", async ({ page }) => { + await page.setViewportSize({ width: 1280, height: 480 }) + + const sessions = Array.from({ length: 24 }, (_, index) => ({ + id: `ses_inbox_${String(index).padStart(2, "0")}`, + title: `Inbox session ${index}`, + time: { created: T0, updated: T0 + index, idle: T0 + index }, + })) + + await mockWorkspace(page, { + name: "Inbox", + sessions, + seed: { + settings: { appearance: { tabLayout: "inbox" } }, + tabs: [], + // Every seeded session finished a run after the inbox was first used, so Recent lists them all. + storage: { "opencode.global.dat:sidebar.inbox": { workingExpanded: true, since: 0 } }, + }, + }) + await page.goto("/") + + const list = page.locator('[data-slot="sidebar-inbox-scroll"]') + const items = list.locator('[data-slot="sidebar-inbox-item"]') + const target = items.filter({ hasText: "Inbox session 0" }) + await expect(items).toHaveCount(sessions.length) + await list.evaluate((element) => element.scrollTo(0, element.scrollHeight)) + await expect(target).toBeInViewport({ ratio: 1 }) + const offset = await list.evaluate((element) => element.scrollTop) + expect(offset).toBeGreaterThan(0) + const row = await target.elementHandle() + + await target.click() + await expectPath(page, sessionHref("ses_inbox_00")) + await expect(target).toHaveAttribute("data-state", "active") + // Opening a session loads it into the client, which updates every section. + await expect(page.locator('[data-component="composer-editor"]')).toBeEditable() + expect(await target.evaluate((element, before) => element === before, row)).toBe(true) + expect(await list.evaluate((element) => element.scrollTop)).toBe(offset) +}) diff --git a/packages/app/e2e/utils/mock-api.ts b/packages/app/e2e/utils/mock-api.ts index 1f236218f81b..0b87d7979875 100644 --- a/packages/app/e2e/utils/mock-api.ts +++ b/packages/app/e2e/utils/mock-api.ts @@ -321,6 +321,12 @@ const Group = HttpApiGroup.make("mock") success: NoContent, }), ) + .add( + HttpApiEndpoint.post("sessionView", "/api/session/:sessionID/view", { + params: SessionParams, + success: NoContent, + }), + ) .add( HttpApiEndpoint.post("sessionShell", "/api/session/:sessionID/shell", { params: SessionParams, diff --git a/packages/app/e2e/utils/mock-server.ts b/packages/app/e2e/utils/mock-server.ts index 0ccbbcdf5c00..926a684b73f5 100644 --- a/packages/app/e2e/utils/mock-server.ts +++ b/packages/app/e2e/utils/mock-server.ts @@ -1315,6 +1315,7 @@ function mockHandlers( }), sessionRemove: () => noContent, sessionShell: () => noContent, + sessionView: () => noContent, sessionForm: (ctx) => Effect.succeed({ data: resolve(config.forms ?? []).filter( diff --git a/packages/app/src/shell/titlebar/inbox.tsx b/packages/app/src/shell/titlebar/inbox.tsx index a67e6dbf3843..850ec4f5f211 100644 --- a/packages/app/src/shell/titlebar/inbox.tsx +++ b/packages/app/src/shell/titlebar/inbox.tsx @@ -103,8 +103,10 @@ export function SidebarInbox() { ) } - const rows = (list: InboxEntry[]) => ( - entry.key)}> + // Takes an accessor so only the For tracks the section. Reading it here would recreate the For, remounting every + // row on any session change and resetting the list's scroll. + const rows = (list: () => InboxEntry[]) => ( + entry.key)}> {(key) => ( {(entry) => ( @@ -133,7 +135,7 @@ export function SidebarInbox() { 0}>
- {rows(sections().needs)} + {rows(() => sections().needs)}
0}> - {rows(sections().inbox)} + {rows(() => sections().inbox)}
0}>
- {rows(sections().archived)} + {rows(() => sections().archived)}
@@ -176,7 +178,7 @@ export function SidebarInbox() { />
{/* A collapsed shelf still shows the session that is open. */} - {rows(sections().working.filter((entry) => state.workingExpanded || inbox.selected(entry)))} + {rows(() => sections().working.filter((entry) => state.workingExpanded || inbox.selected(entry)))}
From b19d143181c16ec6b57f5f76cd622e585b79996f Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Thu, 29 Oct 2026 15:37:22 -0500 Subject: [PATCH 04/83] chore(console): move console and stats to released solid-start (#60077) --- bun.lock | 298 +++++++----------- package.json | 2 +- packages/console/app/package.json | 6 +- packages/console/app/src/global.d.ts | 6 - .../routes/download/[channel]/[platform].ts | 2 +- packages/console/app/vite.config.ts | 5 + packages/stats/app/package.json | 6 +- packages/stats/app/src/entry-server.tsx | 3 +- 8 files changed, 130 insertions(+), 198 deletions(-) diff --git a/bun.lock b/bun.lock index b5902b764492..4d8ebf180840 100644 --- a/bun.lock +++ b/bun.lock @@ -219,10 +219,10 @@ "@solidjs/router": "catalog:", "@solidjs/start": "catalog:", "aws4fetch": "1.0.20", - "nitro": "3.0.1-alpha.1", + "nitro": "3.0.260903-beta", "number-flow": "0.6.2", "solid-js": "catalog:", - "vite": "catalog:", + "vite": "8.2.4", "zod": "catalog:", }, "devDependencies": { @@ -728,10 +728,10 @@ "d3-scale": "4.0.2", "effect": "catalog:", "i18n-iso-countries": "7.14.0", - "nitro": "3.0.1-alpha.1", + "nitro": "3.0.260903-beta", "solid-js": "catalog:", "sst": "catalog:", - "vite": "catalog:", + "vite": "8.2.4", }, "devDependencies": { "@types/bun": "catalog:", @@ -1059,7 +1059,7 @@ "@solid-primitives/storage": "4.4.0", "@solidjs/meta": "0.29.4", "@solidjs/router": "1.0.0", - "@solidjs/start": "https://pkg.pr.new/@solidjs/start@dfb2020", + "@solidjs/start": "2.1.0", "@standard-schema/spec": "1.1.0", "@tailwindcss/vite": "4.1.11", "@tanstack/solid-virtual": "3.13.37", @@ -1546,11 +1546,11 @@ "@emmetio/stream-reader-utils": ["@emmetio/stream-reader-utils@0.1.0", "", {}, "sha512-ZsZ2I9Vzso3Ho/pjZFsmmZ++FWeEd/txqybHTm4OgaZzdS8V9V/YYWQwg5TC38Z7uLWUV1vavpLLbjJtKubR1A=="], - "@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" } }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="], + "@emnapi/core": ["@emnapi/core@1.11.2", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" } }, "sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA=="], - "@emnapi/runtime": ["@emnapi/runtime@1.11.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw=="], + "@emnapi/runtime": ["@emnapi/runtime@1.11.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA=="], - "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g=="], + "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA=="], "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.12", "", { "os": "aix", "cpu": "ppc64" }, "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA=="], @@ -1776,7 +1776,7 @@ "@napi-rs/lzma-linux-x64-gnu": ["@napi-rs/lzma-linux-x64-gnu@1.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ=="], - "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.3", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q=="], + "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.5", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-HshSvXzmBxNzqejd3k/KemgQ3hdREUYFRRrgxOZ+gPljDIsO2SDZrVZMd4Z/HsxudQbE62OVyVFE8z9BCurfjA=="], "@noble/hashes": ["@noble/hashes@2.3.0", "", {}, "sha512-oN+QwyX7VSHotibwubG3kpzbwKrfnyR6OOO+3Nk/53ADL7FmgHHz4TgrbaYKvvOw09u6QTx0oiH1cNCIOuN0CQ=="], @@ -2016,67 +2016,47 @@ "@oslojs/encoding": ["@oslojs/encoding@1.1.0", "", {}, "sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ=="], - "@oxc-minify/binding-android-arm64": ["@oxc-minify/binding-android-arm64@0.96.0", "", { "os": "android", "cpu": "arm64" }, "sha512-lzeIEMu/v6Y+La5JSesq4hvyKtKBq84cgQpKYTYM/yGuNk2tfd5Ha31hnC+mTh48lp/5vZH+WBfjVUjjINCfug=="], - - "@oxc-minify/binding-darwin-arm64": ["@oxc-minify/binding-darwin-arm64@0.96.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-i0LkJAUXb4BeBFrJQbMKQPoxf8+cFEffDyLSb7NEzzKuPcH8qrVsnEItoOzeAdYam8Sr6qCHVwmBNEQzl7PWpw=="], - - "@oxc-minify/binding-darwin-x64": ["@oxc-minify/binding-darwin-x64@0.96.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-C5vI0WPR+KPIFAD5LMOJk2J8iiT+Nv65vDXmemzXEXouzfEOLYNqnW+u6NSsccpuZHHWAiLyPFkYvKFduveAUQ=="], - - "@oxc-minify/binding-freebsd-x64": ["@oxc-minify/binding-freebsd-x64@0.96.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-3//5DNx+xUjVBMLLk2sl6hfe4fwfENJtjVQUBXjxzwPuv8xgZUqASG4cRG3WqG5Qe8dV6SbCI4EgKQFjO4KCZA=="], + "@oxc-parser/binding-android-arm-eabi": ["@oxc-parser/binding-android-arm-eabi@0.141.0", "", { "os": "android", "cpu": "arm" }, "sha512-jk7086MFvR/T4DG9IY7MKBVt1PMxvSZoz/TvnifodvS0pjghVwJHRttnAExhlwdMOgHv1TmLdENnbNpYk2zjvA=="], - "@oxc-minify/binding-linux-arm-gnueabihf": ["@oxc-minify/binding-linux-arm-gnueabihf@0.96.0", "", { "os": "linux", "cpu": "arm" }, "sha512-WXChFKV7VdDk1NePDK1J31cpSvxACAVztJ7f7lJVYBTkH+iz5D0lCqPcE7a9eb7nC3xvz4yk7DM6dA9wlUQkQg=="], + "@oxc-parser/binding-android-arm64": ["@oxc-parser/binding-android-arm64@0.141.0", "", { "os": "android", "cpu": "arm64" }, "sha512-a4XDQ27ZT7e7zwAlxJDTiCA7IBGWDuy2+MhFq85Of7XlBSmpkfcBFml11q0Zx6f7RMuI0B4xCtt2ytBS4yOptg=="], - "@oxc-minify/binding-linux-arm-musleabihf": ["@oxc-minify/binding-linux-arm-musleabihf@0.96.0", "", { "os": "linux", "cpu": "arm" }, "sha512-7B18glYMX4Z/YoqgE3VRLs/2YhVLxlxNKSgrtsRpuR8xv58xca+hEhiFwZN1Rn+NSMZ29Z33LWD7iYWnqYFvRA=="], + "@oxc-parser/binding-darwin-arm64": ["@oxc-parser/binding-darwin-arm64@0.141.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-m/kVk6rzYmBeHYnz+1Y5fod00AVTTxMbC71azFfm/zjx1j9XxwKtA0+VfkKuVMC8rbghb9TtfevnuWZa9OuPEg=="], - "@oxc-minify/binding-linux-arm64-gnu": ["@oxc-minify/binding-linux-arm64-gnu@0.96.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-Yl+KcTldsEJNcaYxxonwAXZ2q3gxIzn3kXYQWgKWdaGIpNhOCWqF+KE5WLsldoh5Ro5SHtomvb8GM6cXrIBMog=="], + "@oxc-parser/binding-darwin-x64": ["@oxc-parser/binding-darwin-x64@0.141.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-o0X+6KZlfucWU/v5oKRQPwdFXsXAjW8jmpo/Gpw/qyKsbKtlfkHoeH9Bjp/m13TwjewvJnCkwF0DWzgpC4HjTQ=="], - "@oxc-minify/binding-linux-arm64-musl": ["@oxc-minify/binding-linux-arm64-musl@0.96.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-rNqoFWOWaxwMmUY5fspd/h5HfvgUlA3sv9CUdA2MpnHFiyoJNovR7WU8tGh+Yn0qOAs0SNH0a05gIthHig14IA=="], + "@oxc-parser/binding-freebsd-x64": ["@oxc-parser/binding-freebsd-x64@0.141.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-W5KbTnNkTMMMylqj6dYqnsXvkmESVPodPKYLJ5zdzIPdl9fUJtolkpUeSzYEbGGYB4a4A4avl3EePnZ/wLIdJg=="], - "@oxc-minify/binding-linux-riscv64-gnu": ["@oxc-minify/binding-linux-riscv64-gnu@0.96.0", "", { "os": "linux", "cpu": "none" }, "sha512-3paajIuzGnukHwSI3YBjYVqbd72pZd8NJxaayaNFR0AByIm8rmIT5RqFXbq8j2uhtpmNdZRXiu0em1zOmIScWA=="], + "@oxc-parser/binding-linux-arm-gnueabihf": ["@oxc-parser/binding-linux-arm-gnueabihf@0.141.0", "", { "os": "linux", "cpu": "arm" }, "sha512-g3dtbJa8zeOGK36Sr9cQavsdi5H/ie2hVjrSjIxsNAR1qZA40ZYVXnfdfoMAlq8CmB9qFL1yhsSCUHeNmdmt8w=="], - "@oxc-minify/binding-linux-s390x-gnu": ["@oxc-minify/binding-linux-s390x-gnu@0.96.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-9ESrpkB2XG0lQ89JlsxlZa86iQCOs+jkDZLl6O+u5wb7ynUy21bpJJ1joauCOSYIOUlSy3+LbtJLiqi7oSQt5Q=="], - - "@oxc-minify/binding-linux-x64-gnu": ["@oxc-minify/binding-linux-x64-gnu@0.96.0", "", { "os": "linux", "cpu": "x64" }, "sha512-UMM1jkns+p+WwwmdjC5giI3SfR2BCTga18x3C0cAu6vDVf4W37uTZeTtSIGmwatTBbgiq++Te24/DE0oCdm1iQ=="], - - "@oxc-minify/binding-linux-x64-musl": ["@oxc-minify/binding-linux-x64-musl@0.96.0", "", { "os": "linux", "cpu": "x64" }, "sha512-8b1naiC7MdP7xeMi7cQ5tb9W1rZAP9Qz/jBRqp1Y5EOZ1yhSGnf1QWuZ/0pCc+XiB9vEHXEY3Aki/H+86m2eOg=="], - - "@oxc-minify/binding-wasm32-wasi": ["@oxc-minify/binding-wasm32-wasi@0.96.0", "", { "dependencies": { "@napi-rs/wasm-runtime": "^1.0.7" }, "cpu": "none" }, "sha512-bjGDjkGzo3GWU9Vg2qiFUrfoo5QxojPNV/2RHTlbIB5FWkkV4ExVjsfyqihFiAuj0NXIZqd2SAiEq9htVd3RFw=="], - - "@oxc-minify/binding-win32-arm64-msvc": ["@oxc-minify/binding-win32-arm64-msvc@0.96.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-4L4DlHUT47qMWQuTyUghpncR3NZHWtxvd0G1KgSjVgXf+cXzFdWQCWZZtCU0yrmOoVCNUf4S04IFCJyAe+Ie7A=="], - - "@oxc-minify/binding-win32-x64-msvc": ["@oxc-minify/binding-win32-x64-msvc@0.96.0", "", { "os": "win32", "cpu": "x64" }, "sha512-T2ijfqZLpV2bgGGocXV4SXTuMoouqN0asYTIm+7jVOLvT5XgDogf3ZvCmiEnSWmxl21+r5wHcs8voU2iUROXAg=="], - - "@oxc-project/types": ["@oxc-project/types@0.146.0", "", {}, "sha512-XC0QsnnhVe7sLIWmYmdPw7x5P0h4W8vUU3Nv1ySgWXtvCz8NizoAEpGXA0sOYoJQV2Rl13LgURAHQ5cI5ILCSA=="], + "@oxc-parser/binding-linux-arm-musleabihf": ["@oxc-parser/binding-linux-arm-musleabihf@0.141.0", "", { "os": "linux", "cpu": "arm" }, "sha512-e6hwQqd+3lvP13G2jxvFpoA7dzHcFLN+Mq47JCVMtdNHbbyBRo756JCtbbJH6ca8inTfyqZoqBmS3vhQlzAK2w=="], - "@oxc-transform/binding-android-arm64": ["@oxc-transform/binding-android-arm64@0.96.0", "", { "os": "android", "cpu": "arm64" }, "sha512-wOm+ZsqFvyZ7B9RefUMsj0zcXw77Z2pXA51nbSQyPXqr+g0/pDGxriZWP8Sdpz/e4AEaKPA9DvrwyOZxu7GRDQ=="], + "@oxc-parser/binding-linux-arm64-gnu": ["@oxc-parser/binding-linux-arm64-gnu@0.141.0", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-vXz2BLAuypA+4MLyBg94pzEo6THVnzYnCtAjXoihIIQo0t2pnp/AmW+SH1EI+4VbuJnC//KplIJ5yyaCGua4jA=="], - "@oxc-transform/binding-darwin-arm64": ["@oxc-transform/binding-darwin-arm64@0.96.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-td1sbcvzsyuoNRiNdIRodPXRtFFwxzPpC/6/yIUtRRhKn30XQcizxupIvQQVpJWWchxkphbBDh6UN+u+2CJ8Zw=="], + "@oxc-parser/binding-linux-arm64-musl": ["@oxc-parser/binding-linux-arm64-musl@0.141.0", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-jMkS/EztNW34HKsXIaT/SoHcmtocq/vWhwFOVduF9kduuuRIVwfwQ6uxzIO+qPKSXdd2TXt54of0BJ2zFMXnmw=="], - "@oxc-transform/binding-darwin-x64": ["@oxc-transform/binding-darwin-x64@0.96.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-xgqxnqhPYH2NYkgbqtnCJfhbXvxIf/pnhF/ig5UBK8PYpCEWIP/cfLpQRQ9DcQnRfuxi7RMIF6LdmB1AiS6Fkg=="], + "@oxc-parser/binding-linux-ppc64-gnu": ["@oxc-parser/binding-linux-ppc64-gnu@0.141.0", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-vo+MR+n3zQJ6Mq92hiP084NZcgDv5iJlVR02gMf28neMvVT1tKVm7VeiW/DxhdqOi3QLeaXIk9cUcLL1qrkngw=="], - "@oxc-transform/binding-freebsd-x64": ["@oxc-transform/binding-freebsd-x64@0.96.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-1i67OXdl/rvSkcTXqDlh6qGRXYseEmf0rl/R+/i88scZ/o3A+FzlX56sThuaPzSSv9eVgesnoYUjIBJELFc1oA=="], + "@oxc-parser/binding-linux-riscv64-gnu": ["@oxc-parser/binding-linux-riscv64-gnu@0.141.0", "", { "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-oh80w+7RuiO5gBp9Jnoa/H8Qlt3JsHL2MkW+0dwEdlDMdslVZX/YsekSK6EeyEenY66/mhCfypsNATQ7Ph3qlQ=="], - "@oxc-transform/binding-linux-arm-gnueabihf": ["@oxc-transform/binding-linux-arm-gnueabihf@0.96.0", "", { "os": "linux", "cpu": "arm" }, "sha512-9MJBs0SWODsqyzO3eAnacXgJ/sZu1xqinjEwBzkcZ3tQI8nKhMADOzu2NzbVWDWujeoC8DESXaO08tujvUru+Q=="], + "@oxc-parser/binding-linux-riscv64-musl": ["@oxc-parser/binding-linux-riscv64-musl@0.141.0", "", { "os": "linux", "cpu": "none", "libc": "musl" }, "sha512-LOyEmFA8sCnYbEXP1+iQvCC/P1YXHMA/t6x1Ksp0Y9VwhLFsiBJFzV1zIxrOIE2LKaGGhDjQ29xq9cbq6omDXA=="], - "@oxc-transform/binding-linux-arm-musleabihf": ["@oxc-transform/binding-linux-arm-musleabihf@0.96.0", "", { "os": "linux", "cpu": "arm" }, "sha512-BQom57I2ScccixljNYh2Wy+5oVZtF1LXiiUPxSLtDHbsanpEvV/+kzCagQpTjk1BVzSQzOxfEUWjvL7mY53pRQ=="], + "@oxc-parser/binding-linux-s390x-gnu": ["@oxc-parser/binding-linux-s390x-gnu@0.141.0", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-3wnwk/l1CvszVE5TJR1wSl/zSEfydRqrNhn6s7Vr9IzSJpUQIroqVsIoPARHRFA+FQwkxAFDAHDAasa7v8OobQ=="], - "@oxc-transform/binding-linux-arm64-gnu": ["@oxc-transform/binding-linux-arm64-gnu@0.96.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-kaqvUzNu8LL4aBSXqcqGVLFG13GmJEplRI2+yqzkgAItxoP/LfFMdEIErlTWLGyBwd0OLiNMHrOvkcCQRWadVg=="], + "@oxc-parser/binding-linux-x64-gnu": ["@oxc-parser/binding-linux-x64-gnu@0.141.0", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-qtyQVAAebFq57B2tifTlel3TgGqUtsYNI/e+p6aya9rN9lOZVTDvr215fGYSA9XWooxzMxDiVxkBLk2jQHbsOQ=="], - "@oxc-transform/binding-linux-arm64-musl": ["@oxc-transform/binding-linux-arm64-musl@0.96.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-EiG/L3wEkPgTm4p906ufptyblBgtiQWTubGg/JEw82f8uLRroayr5zhbUqx40EgH037a3SfJthIyLZi7XPRFJw=="], + "@oxc-parser/binding-linux-x64-musl": ["@oxc-parser/binding-linux-x64-musl@0.141.0", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-SkGV1nKw40roEc94pv5EaaeH2ay14G6+roe8Q0wIUC1LcEKxzKW921h7+ZuZX0D3q2Mb/7aSFmxEVqnko3lPRw=="], - "@oxc-transform/binding-linux-riscv64-gnu": ["@oxc-transform/binding-linux-riscv64-gnu@0.96.0", "", { "os": "linux", "cpu": "none" }, "sha512-r01CY6OxKGtVeYnvH4mGmtkQMlLkXdPWWNXwo5o7fE2s/fgZPMpqh8bAuXEhuMXipZRJrjxTk1+ZQ4KCHpMn3Q=="], + "@oxc-parser/binding-openharmony-arm64": ["@oxc-parser/binding-openharmony-arm64@0.141.0", "", { "os": "none", "cpu": "arm64" }, "sha512-cVgDM7n8QziQqOaP5hNgUYfMG7S/ZeuPxFWXnnHRv7rh025COk0rfQ6eEdKG3j/GaUuyvNZN4ifF1J8KmuXLLA=="], - "@oxc-transform/binding-linux-s390x-gnu": ["@oxc-transform/binding-linux-s390x-gnu@0.96.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-4djg2vYLGbVeS8YiA2K4RPPpZE4fxTGCX5g/bOMbCYyirDbmBAIop4eOAj8vOA9i1CcWbDtmp+PVJ1dSw7f3IQ=="], + "@oxc-parser/binding-wasm32-wasi": ["@oxc-parser/binding-wasm32-wasi@0.141.0", "", { "dependencies": { "@emnapi/core": "1.11.2", "@emnapi/runtime": "1.11.2", "@napi-rs/wasm-runtime": "^1.1.6" }, "cpu": "none" }, "sha512-HggH++Fkn3OilBn+bs3jpgIFQa34oMAyUUHy0vpGum+gt1Eb5nyLc8dNU/RAPSw6lsLrx7ncKtHSZE+3Sp0l2g=="], - "@oxc-transform/binding-linux-x64-gnu": ["@oxc-transform/binding-linux-x64-gnu@0.96.0", "", { "os": "linux", "cpu": "x64" }, "sha512-f6pcWVz57Y8jXa2OS7cz3aRNuks34Q3j61+3nQ4xTE8H1KbalcEvHNmM92OEddaJ8QLs9YcE0kUC6eDTbY34+A=="], + "@oxc-parser/binding-win32-arm64-msvc": ["@oxc-parser/binding-win32-arm64-msvc@0.141.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-KLSEH9GwgbrqbJOjtGHt9STw96s+78yDzp7IDN8Lno+7Ut9sNBfZ4jYZIz4mD50qmWUjoOI7i9I6UENbhNbMZQ=="], - "@oxc-transform/binding-linux-x64-musl": ["@oxc-transform/binding-linux-x64-musl@0.96.0", "", { "os": "linux", "cpu": "x64" }, "sha512-NSiRtFvR7Pbhv3mWyPMkTK38czIjcnK0+K5STo3CuzZRVbX1TM17zGdHzKBUHZu7v6IQ6/XsQ3ELa1BlEHPGWQ=="], + "@oxc-parser/binding-win32-ia32-msvc": ["@oxc-parser/binding-win32-ia32-msvc@0.141.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-9UVWUOOCI/1YkiSSNjg2zyBJYM9E/t1A/8GNobd48JDn/fQ6mzxcVO3H08jb3rAaW/B1VBf8eCORTvSsO9T08g=="], - "@oxc-transform/binding-wasm32-wasi": ["@oxc-transform/binding-wasm32-wasi@0.96.0", "", { "dependencies": { "@napi-rs/wasm-runtime": "^1.0.7" }, "cpu": "none" }, "sha512-A91ARLiuZHGN4hBds9s7bW3czUuLuHLsV+cz44iF9j8e1zX9m2hNGXf/acQRbg/zcFUXmjz5nmk8EkZyob876w=="], + "@oxc-parser/binding-win32-x64-msvc": ["@oxc-parser/binding-win32-x64-msvc@0.141.0", "", { "os": "win32", "cpu": "x64" }, "sha512-HI/wsvbWT5RHHw5c37D0fEgeTd8/1Q4OJs5jUmEBc17VZFG6SsCIe4barq7NsAPPks/JW+3ayi3Rp+PQI5h4Kg=="], - "@oxc-transform/binding-win32-arm64-msvc": ["@oxc-transform/binding-win32-arm64-msvc@0.96.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-IedJf40djKgDObomhYjdRAlmSYUEdfqX3A3M9KfUltl9AghTBBLkTzUMA7O09oo71vYf5TEhbFM7+Vn5vqw7AQ=="], - - "@oxc-transform/binding-win32-x64-msvc": ["@oxc-transform/binding-win32-x64-msvc@0.96.0", "", { "os": "win32", "cpu": "x64" }, "sha512-0fI0P0W7bSO/GCP/N5dkmtB9vBqCA4ggo1WmXTnxNJVmFFOtcA1vYm1I9jl8fxo+sucW2WnlpnI4fjKdo3JKxA=="], + "@oxc-project/types": ["@oxc-project/types@0.146.0", "", {}, "sha512-XC0QsnnhVe7sLIWmYmdPw7x5P0h4W8vUU3Nv1ySgWXtvCz8NizoAEpGXA0sOYoJQV2Rl13LgURAHQ5cI5ILCSA=="], "@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.60.0", "", { "os": "android", "cpu": "arm" }, "sha512-YdeJKaZckDQL1qa62a1aKq/goyq48aX3yOxaaWqWb4sau4Ee4IiLbamftNLU3zbePky6QsDj6thnSSzHRBjDfA=="], @@ -2436,7 +2416,7 @@ "@solidjs/router": ["@solidjs/router@1.0.0", "", { "peerDependencies": { "solid-js": "^1.8.6" } }, "sha512-cCSk1hvgCowiMa9bzzYWHiLu1U4E22+DfJe6/rOwAyECKrxc3jrd5QnoW3sDDJtW+e077cz/M67bPl3DqOBw1Q=="], - "@solidjs/start": ["@solidjs/start@https://pkg.pr.new/@solidjs/start@dfb2020", { "dependencies": { "@babel/core": "^7.28.3", "@babel/traverse": "^7.28.3", "@babel/types": "^7.28.5", "@solidjs/meta": "^0.29.4", "@tanstack/server-functions-plugin": "1.134.5", "@types/babel__traverse": "^7.28.0", "@types/micromatch": "^4.0.9", "cookie-es": "^2.0.0", "defu": "^6.1.4", "error-stack-parser": "^2.1.4", "es-module-lexer": "^1.7.0", "esbuild": "^0.25.3", "fast-glob": "^3.3.3", "h3": "npm:h3@2.0.1-rc.4", "html-to-image": "^1.11.13", "micromatch": "^4.0.8", "path-to-regexp": "^8.2.0", "pathe": "^2.0.3", "radix3": "^1.1.2", "seroval": "^1.3.2", "seroval-plugins": "^1.2.1", "shiki": "^1.26.1", "solid-js": "^1.9.9", "source-map-js": "^1.2.1", "srvx": "^0.9.1", "terracotta": "^1.0.6", "vite": "7.1.10", "vite-plugin-solid": "^2.11.9", "vitest": "^4.0.10" } }, "sha512-7JjjA49VGNOsMRI8QRUhVudZmv0CnJ18SliSgK1ojszs/c3ijftgVkzvXdkSLN4miDTzbkXewf65D6ZBo6W+GQ=="], + "@solidjs/start": ["@solidjs/start@2.1.0", "", { "dependencies": { "@babel/core": "^7.29.7", "@babel/traverse": "^7.29.7", "@babel/types": "^7.29.7", "@jridgewell/trace-mapping": "^0.3.31", "@solidjs/meta": "^0.29.4", "@types/babel__traverse": "^7.28.0", "@types/micromatch": "^4.0.10", "cookie-es": "^3.1.1", "defu": "^6.1.7", "error-stack-parser-es": "^2.0.1", "fast-glob": "^3.3.3", "h3": "^2.0.1-rc.26", "html-to-image": "^1.11.13", "micromatch": "^4.0.8", "oxc-parser": "^0.141.0", "path-to-regexp": "^8.4.2", "pathe": "^2.0.3", "radix3": "^1.1.2", "seroval": "^1.6.11", "seroval-plugins": "^1.6.11", "shiki": "^4.3.1", "srvx": "^0.12.4", "terracotta": "^1.2.4", "vite-plugin-solid": "^2.11.13" }, "peerDependencies": { "@solidjs/router": ">=0.16.0 <2.0.0-0", "solid-js": "^1.9.15", "vite": "^8 || ^9" }, "optionalPeers": ["@solidjs/router"] }, "sha512-WxYkBPmjnrP30ODWLui8QVPki80puvsKZ5jOmy0m/t7mZsmhY0IBHpra8n+UQoMFgvvJkaAJS+DJqPFzmoKf+Q=="], "@speed-highlight/core": ["@speed-highlight/core@1.2.24", "", {}, "sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw=="], @@ -2476,14 +2456,8 @@ "@tailwindcss/vite": ["@tailwindcss/vite@4.3.3", "", { "dependencies": { "@tailwindcss/node": "4.3.3", "@tailwindcss/oxide": "4.3.3", "tailwindcss": "4.3.3" }, "peerDependencies": { "vite": "^5.2.0 || ^6 || ^7 || ^8" } }, "sha512-yYU8cogLeSh/ms2jh8Fj7jaba/EWa7Ja6GoUqYZaraEuCI5YS6ms6ObZgjjedm+jm6XZjdNRWBpPP6Z86oOxcw=="], - "@tanstack/directive-functions-plugin": ["@tanstack/directive-functions-plugin@1.134.5", "", { "dependencies": { "@babel/code-frame": "7.27.1", "@babel/core": "^7.27.7", "@babel/traverse": "^7.27.7", "@babel/types": "^7.27.7", "@tanstack/router-utils": "1.133.19", "babel-dead-code-elimination": "^1.0.10", "pathe": "^2.0.3", "tiny-invariant": "^1.3.3" }, "peerDependencies": { "vite": ">=6.0.0 || >=7.0.0" } }, "sha512-J3oawV8uBRBbPoLgMdyHt+LxzTNuWRKNJJuCLWsm/yq6v0IQSvIVCgfD2+liIiSnDPxGZ8ExduPXy8IzS70eXw=="], - "@tanstack/query-core": ["@tanstack/query-core@5.91.2", "", {}, "sha512-Uz2pTgPC1mhqrrSGg18RKCWT/pkduAYtxbcyIyKBhw7dTWjXZIzqmpzO2lBkyWr4hlImQgpu1m1pei3UnkFRWw=="], - "@tanstack/router-utils": ["@tanstack/router-utils@1.133.19", "", { "dependencies": { "@babel/core": "^7.27.4", "@babel/generator": "^7.27.5", "@babel/parser": "^7.27.5", "@babel/preset-typescript": "^7.27.1", "ansis": "^4.1.0", "diff": "^8.0.2", "pathe": "^2.0.3", "tinyglobby": "^0.2.15" } }, "sha512-WEp5D2gPxvlLDRXwD/fV7RXjYtqaqJNXKB/L6OyZEbT+9BG/Ib2d7oG9GSUZNNMGPGYAlhBUOi3xutySsk6rxA=="], - - "@tanstack/server-functions-plugin": ["@tanstack/server-functions-plugin@1.134.5", "", { "dependencies": { "@babel/code-frame": "7.27.1", "@babel/core": "^7.27.7", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1", "@babel/template": "^7.27.2", "@babel/traverse": "^7.27.7", "@babel/types": "^7.27.7", "@tanstack/directive-functions-plugin": "1.134.5", "babel-dead-code-elimination": "^1.0.9", "tiny-invariant": "^1.3.3" } }, "sha512-2sWxq70T+dOEUlE3sHlXjEPhaFZfdPYlWTSkHchWXrFGw2YOAa+hzD6L9wHMjGDQezYd03ue8tQlHG+9Jzbzgw=="], - "@tanstack/solid-query": ["@tanstack/solid-query@5.91.4", "", { "dependencies": { "@tanstack/query-core": "5.91.2" }, "peerDependencies": { "solid-js": "^1.6.0" } }, "sha512-oCEgn8iT7WnF/7ISd7usBpUK1C9EdvQfg8ZUpKNKZ4edVClICZrCX6f3/Bp8ZlwQnL21KLc2rp+CejEuehlRxg=="], "@tanstack/solid-virtual": ["@tanstack/solid-virtual@3.13.37", "", { "dependencies": { "@tanstack/virtual-core": "3.17.8" }, "peerDependencies": { "solid-js": "^1.3.0" } }, "sha512-RxJC8n/6nnFHcPvDGMg7ZkqSzCVUco4JNw3ctIChj1HjoKs5I9wt5nsU+DUVtMVEiMfizUxOAx4TPIN8SHjxUQ=="], @@ -2530,8 +2504,6 @@ "@types/cacheable-request": ["@types/cacheable-request@6.0.3", "", { "dependencies": { "@types/http-cache-semantics": "*", "@types/keyv": "^3.1.4", "@types/node": "*", "@types/responselike": "^1.0.0" } }, "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw=="], - "@types/chai": ["@types/chai@5.2.3", "", { "dependencies": { "@types/deep-eql": "*", "assertion-error": "^2.0.1" } }, "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA=="], - "@types/cross-spawn": ["@types/cross-spawn@6.0.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-fXRhhUkG4H3TQk5dBhQ7m/JDdSNHKwR2BBia62lhwEIq9xGiQKLxd6LymNhn47SjXhsUEPmxi+PKw2OkW4LLjA=="], "@types/d3-scale": ["@types/d3-scale@4.0.9", "", { "dependencies": { "@types/d3-time": "*" } }, "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw=="], @@ -2540,8 +2512,6 @@ "@types/debug": ["@types/debug@4.1.13", "", { "dependencies": { "@types/ms": "*" } }, "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw=="], - "@types/deep-eql": ["@types/deep-eql@4.0.2", "", {}, "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw=="], - "@types/estree": ["@types/estree@1.0.9", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="], "@types/estree-jsx": ["@types/estree-jsx@1.0.5", "", { "dependencies": { "@types/estree": "*" } }, "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg=="], @@ -2658,20 +2628,6 @@ "@ungap/structured-clone": ["@ungap/structured-clone@1.3.3", "", {}, "sha512-60YRaenCQcVjYEKOcG824+DRGGIQ3VKErcBoAEDJZz5bKIs2ZG+X/H9Nk+Q6EVkwJk5QNApxbrc5QtBSwtrXAg=="], - "@vitest/expect": ["@vitest/expect@4.1.11", "", { "dependencies": { "@standard-schema/spec": "^1.1.0", "@types/chai": "^5.2.2", "@vitest/spy": "4.1.11", "@vitest/utils": "4.1.11", "chai": "^6.2.2", "tinyrainbow": "^3.1.0" } }, "sha512-VX2x5vNJXET47KAFzwERI+KRMtTTCSWTfSMKsW7JsUsXV4psq++e3DvZpuTDOpHcxytiDs6p2nhVb2tVDiiUYw=="], - - "@vitest/mocker": ["@vitest/mocker@4.1.11", "", { "dependencies": { "@vitest/spy": "4.1.11", "estree-walker": "^3.0.3", "magic-string": "^0.30.21" }, "peerDependencies": { "msw": "^2.4.9", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["msw", "vite"] }, "sha512-2XJVD55d1o5AZous5CCGKS74g/riOj9odEt2bQpCVZeblHyHdnMeFl4jl0XjU21stf4mbjUkew2eXQZt65g5CQ=="], - - "@vitest/pretty-format": ["@vitest/pretty-format@4.1.11", "", { "dependencies": { "tinyrainbow": "^3.1.0" } }, "sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw=="], - - "@vitest/runner": ["@vitest/runner@4.1.11", "", { "dependencies": { "@vitest/utils": "4.1.11", "pathe": "^2.0.3" } }, "sha512-LztvUgdwMNJMIkj3hQnnxiC2Xy1zNxq928W/xhjCLaNCzqTZOudjwbQf6v9IntZGPw132i2Lq2rgTRZHD3JHNw=="], - - "@vitest/snapshot": ["@vitest/snapshot@4.1.11", "", { "dependencies": { "@vitest/pretty-format": "4.1.11", "@vitest/utils": "4.1.11", "magic-string": "^0.30.21", "pathe": "^2.0.3" } }, "sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog=="], - - "@vitest/spy": ["@vitest/spy@4.1.11", "", {}, "sha512-apNa/prQy2qCeywhnixOHPRCgGNhvg7T4Dapfl1GahLp/R+uhBm5cPyFoNVyqsNd2h1nJxL6BqqdIjiABL60YA=="], - - "@vitest/utils": ["@vitest/utils@4.1.11", "", { "dependencies": { "@vitest/pretty-format": "4.1.11", "convert-source-map": "^2.0.0", "tinyrainbow": "^3.1.0" } }, "sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ=="], - "@volar/kit": ["@volar/kit@2.4.28", "", { "dependencies": { "@volar/language-service": "2.4.28", "@volar/typescript": "2.4.28", "typesafe-path": "^0.2.2", "vscode-languageserver-textdocument": "^1.0.11", "vscode-uri": "^3.0.8" }, "peerDependencies": { "typescript": "*" } }, "sha512-cKX4vK9dtZvDRaAzeoUdaAJEew6IdxHNCRrdp5Kvcl6zZOqb6jTOfk3kXkIkG3T7oTFXguEMt5+9ptyqYR84Pg=="], "@volar/language-core": ["@volar/language-core@2.4.28", "", { "dependencies": { "@volar/source-map": "2.4.28" } }, "sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ=="], @@ -2744,8 +2700,6 @@ "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - "ansis": ["ansis@4.3.1", "", {}, "sha512-BJ8/l4R5LRE7hW9WdSuGYrLSHi2ynxeFpDFbH0K/CgNeY/tyhk+vO6TYxXC5r5CpUhNVX310xzPsN/H9lCdfOA=="], - "anymatch": ["anymatch@3.1.3", "", { "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" } }, "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw=="], "app-builder-lib": ["app-builder-lib@26.15.7", "", { "dependencies": { "@electron/asar": "3.4.1", "@electron/fuses": "^1.8.0", "@electron/get": "^3.0.0", "@electron/notarize": "2.5.0", "@electron/osx-sign": "1.3.3", "@electron/rebuild": "^4.0.4", "@electron/universal": "2.0.3", "@malept/flatpak-bundler": "^0.4.0", "@noble/hashes": "^2.2.0", "@peculiar/webcrypto": "^1.7.1", "@types/fs-extra": "9.0.13", "ajv": "^8.18.0", "asn1js": "^3.0.10", "async-exit-hook": "^2.0.1", "builder-util": "26.15.3", "builder-util-runtime": "9.7.0", "chromium-pickle-js": "^0.2.0", "ci-info": "4.3.1", "debug": "^4.3.4", "dotenv": "^16.4.5", "dotenv-expand": "^11.0.6", "ejs": "^3.1.8", "electron-publish": "26.15.3", "fs-extra": "^10.1.0", "hosted-git-info": "^4.1.0", "isbinaryfile": "^5.0.0", "jiti": "^2.4.2", "js-yaml": "^4.1.0", "json5": "^2.2.3", "lazy-val": "^1.0.5", "minimatch": "^10.2.5", "pkijs": "^3.4.0", "plist": "3.1.0", "proper-lockfile": "^4.1.2", "resedit": "^1.7.0", "semver": "~7.7.3", "tar": "^7.5.7", "temp-file": "^3.4.0", "tiny-async-pool": "1.3.0", "unzipper": "^0.12.3", "which": "^5.0.0" }, "peerDependencies": { "dmg-builder": "26.15.7", "electron-builder-squirrel-windows": "26.15.7" } }, "sha512-C7APoYISPExUmrEntNhDpz9Tccb4uWuEDfLaC0WPPc7/pwzz0WZGznCz/ycPfkkzw6tKOalceD8g6TgHmVz1QA=="], @@ -2764,8 +2718,6 @@ "asn1js": ["asn1js@3.0.10", "", { "dependencies": { "pvtsutils": "^1.3.6", "pvutils": "^1.1.5", "tslib": "^2.8.1" } }, "sha512-S2s3aOytiKdFRdulw2qPE51MzjzVOisppcVv7jVFR+Kw0kxwvFrDcYA0h7Ndqbmj0HkMIXYWaoj7fli8kgx1eg=="], - "assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="], - "astring": ["astring@1.9.0", "", { "bin": { "astring": "bin/astring" } }, "sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg=="], "astro": ["astro@7.3.8", "", { "dependencies": { "@astrojs/compiler-rs": "^0.5.1", "@astrojs/internal-helpers": "0.12.0", "@astrojs/markdown-satteri": "0.4.3", "@astrojs/telemetry": "3.3.3", "@capsizecss/unpack": "^4.0.1", "@clack/prompts": "^1.8.1", "@oslojs/encoding": "^1.1.0", "am-i-vibing": "^0.5.0", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", "ci-info": "^4.4.0", "clsx": "^2.1.1", "common-ancestor-path": "^2.0.0", "cookie": "^2.0.1", "devalue": "^5.9.4", "diff": "^9.0.0", "dset": "^3.1.4", "es-module-lexer": "^3.0.2", "find-proc": "0.2.0", "flattie": "^1.1.1", "fontace": "~0.4.1", "get-tsconfig": "5.0.0-beta.6", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.2.0", "jsonc-parser": "^3.3.1", "magic-string": "^1.4.2", "magicast": "^0.5.5", "mrmime": "^2.0.1", "neotraverse": "^1.0.1", "obug": "^3.0.0", "p-limit": "^7.3.3", "p-queue": "^9.3.3", "package-manager-detector": "^1.8.0", "piccolore": "^0.1.3", "picomatch": "^4.0.7", "rolldown": "^1.2.11", "shiki": "^4.4.3", "smol-toml": "^1.9.0", "svgo": "^4.1.0", "tinyclip": "^1.0.3", "tinyexec": "^1.3.1", "tinyglobby": "^0.2.17", "ultrahtml": "^1.7.0", "unifont": "~0.7.5", "unstorage": "^1.17.5", "verkit": "^0.5.0", "vite": "^8.3.1", "vitefu": "^1.1.3", "xxhash-wasm": "^1.1.0", "yargs-parser": "^22.0.0", "zod": "^4.6.5" }, "optionalDependencies": { "sharp": "^0.35.4" }, "peerDependencies": { "@astrojs/markdown-remark": "^7.3.0" }, "optionalPeers": ["@astrojs/markdown-remark"], "bin": { "astro": "./bin/astro.mjs" } }, "sha512-LHzDHSaV+YzZiR3EFndDYTLLeNeuMtP1qX1FLcCNUUHOCqTTIWPczy2UV3zpA5VqvJe5cWZolqM9Z8JFqR2i9w=="], @@ -2794,8 +2746,6 @@ "axobject-query": ["axobject-query@4.1.0", "", {}, "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ=="], - "babel-dead-code-elimination": ["babel-dead-code-elimination@1.0.12", "", { "dependencies": { "@babel/core": "^7.23.7", "@babel/parser": "^7.23.6", "@babel/traverse": "^7.23.7", "@babel/types": "^7.23.6" } }, "sha512-GERT7L2TiYcYDtYk1IpD+ASAYXjKbLTDPhBtYj7X1NuRMDTMtAx9kyBenub1Ev41lo91OHCKdmP+egTDmfQ7Ig=="], - "babel-plugin-jsx-dom-expressions": ["babel-plugin-jsx-dom-expressions@0.40.10", "", { "dependencies": { "@babel/helper-module-imports": "7.18.6", "@babel/plugin-syntax-jsx": "^7.18.6", "@babel/types": "^7.20.7", "html-entities": "2.3.3", "parse5": "^7.1.2" }, "peerDependencies": { "@babel/core": "^7.20.12" } }, "sha512-lxve6Y02YiZTldB7efKpnbf1BH00XCFZNYYW235jSGsYaJNFtHrYlKV6/O+miHbjqpIr9FTe5+0no4hofAMbfA=="], "babel-plugin-module-resolver": ["babel-plugin-module-resolver@5.0.2", "", { "dependencies": { "find-babel-config": "^2.1.1", "glob": "^9.3.3", "pkg-up": "^3.1.0", "reselect": "^4.1.7", "resolve": "^1.22.8" } }, "sha512-9KtaCazHee2xc0ibfqsDeamwDps6FZNo5S0Q81dUqEuFzVwPhcT4J5jOqIVvgCA3Q/wO9hKYxN/Ds3tIsp5ygg=="], @@ -2880,8 +2830,6 @@ "ccount": ["ccount@2.0.1", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="], - "chai": ["chai@6.2.2", "", {}, "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg=="], - "chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], "character-entities": ["character-entities@2.0.2", "", {}, "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ=="], @@ -2958,7 +2906,7 @@ "cookie": ["cookie@2.0.1", "", {}, "sha512-yuToqVvRrj6pfDXREyQAAv8SkAEk/8GS3jQRTiUMm66TVtBYmqQeoEjL2Lmq8Rpo6271vH76InTChTitEAm65w=="], - "cookie-es": ["cookie-es@2.0.1", "", {}, "sha512-aVf4A4hI2w70LnF7GG+7xDQUkliwiXWXFvTjkip4+b64ygDQ2sJPRSKFDHbxn8o0xu9QzPkMuuiWIXyFSE2slA=="], + "cookie-es": ["cookie-es@3.1.1", "", {}, "sha512-UaXxwISYJPTr9hwQxMFYZ7kNhSXboMXP+Z3TRX6f1/NyaGPfuNUZOWP1pUEb75B2HjfklIYLVRfWiFZJyC6Npg=="], "core-js-compat": ["core-js-compat@3.50.0", "", { "dependencies": { "browserslist": "^4.28.7" } }, "sha512-XGpFGbMLHwSt74YLTKho7Ib242qi6O8MSX+sRokV4oz7iKXvQWGYZthjIhjRGMxjzVkAubBO512dKGYcefmX3Q=="], @@ -2970,7 +2918,7 @@ "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="], - "crossws": ["crossws@0.4.10", "", { "peerDependencies": { "srvx": ">=0.11.5" }, "optionalPeers": ["srvx"] }, "sha512-pz3oubH/dt12KjqsUB0IuXW4nwRDQ583iDsP4555Cpdqx0NoU7pGlWBcayyFI8f/l/idRpgjMEfwuOxSWJYlIA=="], + "crossws": ["crossws@0.4.15", "", { "peerDependencies": { "srvx": ">=0.11.5" }, "optionalPeers": ["srvx"] }, "sha512-NsUOpDZosz7nyI+qEIl05yaiXOWaXH2oTeM+XBWtiSWZtb5rzcIsl1AST/HzM2jzUn76eFuyrkn83E6iSBRUvw=="], "crypto-random-string": ["crypto-random-string@2.0.0", "", {}, "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA=="], @@ -3012,7 +2960,7 @@ "data-view-byte-offset": ["data-view-byte-offset@1.0.1", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "is-data-view": "^1.0.1" } }, "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ=="], - "db0": ["db0@0.3.4", "", { "peerDependencies": { "@electric-sql/pglite": "*", "@libsql/client": "*", "better-sqlite3": "*", "drizzle-orm": "*", "mysql2": "*", "sqlite3": "*" }, "optionalPeers": ["@electric-sql/pglite", "@libsql/client", "better-sqlite3", "drizzle-orm", "mysql2", "sqlite3"] }, "sha512-RiXXi4WaNzPTHEOu8UPQKMooIbqOEyqA1t7Z6MsdxSCeb8iUC9ko3LcmsLmeUt2SM5bctfArZKkRQggKZz7JNw=="], + "db0": ["db0@0.4.1", "", {}, "sha512-6RBY/bSn42UrqATwsiULj2uYFyEykB3XeA/NLIVQeHNXlYV6D4Idxx3/aa6k5Y45Dwzx7sygeLotnqHWSeURYA=="], "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" }, "peerDependencies": { "supports-color": "*" }, "optionalPeers": ["supports-color"] }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], @@ -3126,8 +3074,6 @@ "emoji-regex": ["emoji-regex@10.6.0", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="], - "emoji-regex-xs": ["emoji-regex-xs@1.0.0", "", {}, "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg=="], - "end-of-stream": ["end-of-stream@1.4.5", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="], "engine.io-client": ["engine.io-client@6.6.6", "", { "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.4.1", "engine.io-parser": "~5.2.1", "ws": "~8.21.0", "xmlhttprequest-ssl": "~2.1.1" } }, "sha512-iY6QdftLQ9pyiPoX082bpf/u1UewnOaJrtJIF9T0++QB34lZrj0uP+Q/bj8AlUsAxqhnkTV2BS8SBZSxOmoV5Q=="], @@ -3142,11 +3088,11 @@ "env-paths": ["env-paths@2.2.1", "", {}, "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="], - "err-code": ["err-code@2.0.3", "", {}, "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA=="], + "env-runner": ["env-runner@0.2.3", "", { "dependencies": { "crossws": "^0.4.12", "exsolve": "^1.1.1", "httpxy": "^0.5.5", "srvx": "^1.0.5" }, "bin": { "env-runner": "./dist/cli.mjs" } }, "sha512-S8EFBKyznRwPVwayK187cYjvnpgC92xy+q0BIF++V965pfjMVVRbQ/HoTYGA/1EHmZ7E68k6Heq+4WnvVhOL5w=="], - "error-stack-parser": ["error-stack-parser@2.1.4", "", { "dependencies": { "stackframe": "^1.3.4" } }, "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ=="], + "err-code": ["err-code@2.0.3", "", {}, "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA=="], - "error-stack-parser-es": ["error-stack-parser-es@1.0.5", "", {}, "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA=="], + "error-stack-parser-es": ["error-stack-parser-es@2.0.1", "", {}, "sha512-J36ntO+rMQVRuR/umlmxmfLi4TpWwtmTnHoJoXTiC2xDNazs0VDPKcX6pbhZMDd2HFtH9isMBJXMdbki+A++Pg=="], "es-abstract": ["es-abstract@1.24.2", "", { "dependencies": { "array-buffer-byte-length": "^1.0.2", "arraybuffer.prototype.slice": "^1.0.4", "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.8", "call-bound": "^1.0.4", "data-view-buffer": "^1.0.2", "data-view-byte-length": "^1.0.2", "data-view-byte-offset": "^1.0.1", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "es-set-tostringtag": "^2.1.0", "es-to-primitive": "^1.3.0", "function.prototype.name": "^1.1.8", "get-intrinsic": "^1.3.0", "get-proto": "^1.0.1", "get-symbol-description": "^1.1.0", "globalthis": "^1.0.4", "gopd": "^1.2.0", "has-property-descriptors": "^1.0.2", "has-proto": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "internal-slot": "^1.1.0", "is-array-buffer": "^3.0.5", "is-callable": "^1.2.7", "is-data-view": "^1.0.2", "is-negative-zero": "^2.0.3", "is-regex": "^1.2.1", "is-set": "^2.0.3", "is-shared-array-buffer": "^1.0.4", "is-string": "^1.1.1", "is-typed-array": "^1.1.15", "is-weakref": "^1.1.1", "math-intrinsics": "^1.1.0", "object-inspect": "^1.13.4", "object-keys": "^1.1.1", "object.assign": "^4.1.7", "own-keys": "^1.0.1", "regexp.prototype.flags": "^1.5.4", "safe-array-concat": "^1.1.3", "safe-push-apply": "^1.0.0", "safe-regex-test": "^1.1.0", "set-proto": "^1.0.0", "stop-iteration-iterator": "^1.1.0", "string.prototype.trim": "^1.2.10", "string.prototype.trimend": "^1.0.9", "string.prototype.trimstart": "^1.0.8", "typed-array-buffer": "^1.0.3", "typed-array-byte-length": "^1.0.3", "typed-array-byte-offset": "^1.0.4", "typed-array-length": "^1.0.7", "unbox-primitive": "^1.1.0", "which-typed-array": "^1.1.19" } }, "sha512-2FpH9Q5i2RRwyEP1AylXe6nYLR5OhaJTZwmlcP0dL/+JCbgg7yyEo/sEK6HeGZRf3dFpWwThaRHVApXSkW3xeg=="], @@ -3156,7 +3102,7 @@ "es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="], - "es-module-lexer": ["es-module-lexer@1.7.0", "", {}, "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA=="], + "es-module-lexer": ["es-module-lexer@2.3.2", "", {}, "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw=="], "es-object-atoms": ["es-object-atoms@1.1.2", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw=="], @@ -3210,12 +3156,12 @@ "exit-hook": ["exit-hook@2.2.1", "", {}, "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw=="], - "expect-type": ["expect-type@1.4.0", "", {}, "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA=="], - "exponential-backoff": ["exponential-backoff@3.1.3", "", {}, "sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA=="], "expressive-code": ["expressive-code@0.44.2", "", { "dependencies": { "@expressive-code/core": "^0.44.2", "@expressive-code/plugin-frames": "^0.44.2", "@expressive-code/plugin-shiki": "^0.44.2", "@expressive-code/plugin-text-markers": "^0.44.2" } }, "sha512-MLNghkvhyFgVW4oCD5DxBuYnnTXIf0PygzGmfT6OZeOOYWh/D4sH1j931biElkA5RG/J9wY/iuSMGAPF5vzHOg=="], + "exsolve": ["exsolve@1.1.3", "", {}, "sha512-kuzL9zherLQoqDeQaS55AiiIg1kb4KYXaSusTtgZTPlvKP2gGCI82LNmBNh5RjDVUXIcmgx+/Mx7vPwRzBbhJA=="], + "ext-list": ["ext-list@2.2.2", "", { "dependencies": { "mime-db": "^1.28.0" } }, "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA=="], "ext-name": ["ext-name@5.0.0", "", { "dependencies": { "ext-list": "^2.0.0", "sort-keys-length": "^1.0.0" } }, "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ=="], @@ -3350,7 +3296,7 @@ "gtoken": ["gtoken@8.0.0", "", { "dependencies": { "gaxios": "^7.0.0", "jws": "^4.0.0" } }, "sha512-+CqsMbHPiSTdtSO14O51eMNlrp9N79gmeqmXeouJOhfucAedHw9noVe/n5uJk3tbKE6a+6ZCQg3RPhVhHByAIw=="], - "h3": ["h3@2.0.1-rc.4", "", { "dependencies": { "rou3": "^0.7.8", "srvx": "^0.9.1" }, "peerDependencies": { "crossws": "^0.4.1" }, "optionalPeers": ["crossws"] }, "sha512-vZq8pEUp6THsXKXrUXX44eOqfChic2wVQ1GlSzQCBr7DeFBkfIZAo2WyNND4GSv54TAa0E4LYIK73WSPdgKUgw=="], + "h3": ["h3@2.0.7", "", { "dependencies": { "rou3": "^1.0.0", "srvx": "^1.0.6" }, "peerDependencies": { "crossws": "^0.4.12", "ocache": ">=0.3.0" }, "optionalPeers": ["crossws", "ocache"], "bin": { "h3": "./bin/h3.mjs" } }, "sha512-00SVloxtViij9/JBsc/Ayd9H7GLXWB0KRfkReWG0dDwuUFKUKRrNGM3Csu+KZgppi5DD8Y1KpnfjtudWaRCoiQ=="], "happy-dom": ["happy-dom@20.11.1", "", { "dependencies": { "@types/node": ">=20.0.0", "@types/whatwg-mimetype": "^3.0.2", "@types/ws": "^8.18.1", "buffer-image-size": "^0.6.4", "entities": "^7.0.1", "whatwg-mimetype": "^3.0.0", "ws": "^8.21.0" } }, "sha512-XSt8tMzbW9ymE7687xztkO1ckR7qJNQ3LywY9vlYGhGi3zXrGBHuUo2Cl1ztZaICW+1eAGdkLbj6iwVqDT33kg=="], @@ -3414,6 +3360,8 @@ "hono": ["hono@4.13.13", "", {}, "sha512-CQ46U0ZkAGmbT/4UxdzzGJpacP2IeKgY4a5/tOI9AABbpOMfK739wfDXmv1usCk+3RkKj1hQy4/fjhiwa2xlrA=="], + "hookable": ["hookable@6.1.2", "", {}, "sha512-+abwxtiEA52GCVIsQqut3S/uKTbUwYIp4Pe/vv+6py5XiXBCqMZHg6pA6Y5qhgLSEys0/cYuPbO0z1QFj5ZCmg=="], + "hosted-git-info": ["hosted-git-info@4.1.0", "", { "dependencies": { "lru-cache": "^6.0.0" } }, "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA=="], "html-entities": ["html-entities@2.3.3", "", {}, "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA=="], @@ -3438,6 +3386,8 @@ "https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], + "httpxy": ["httpxy@0.5.5", "", {}, "sha512-uDjmnPyp1q4Sgzf3w+J/Fc6UqcCEj0x4Wjp7OqK5dGhNeDgpyrAmnS6ey8QWrX3SWDon2DMKf9sBa5X9+CVyMA=="], + "humanize-ms": ["humanize-ms@1.2.1", "", { "dependencies": { "ms": "^2.0.0" } }, "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ=="], "husky": ["husky@9.1.7", "", { "bin": { "husky": "bin.js" } }, "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA=="], @@ -3898,9 +3848,9 @@ "neotraverse": ["neotraverse@1.0.1", "", {}, "sha512-WmmLty1YWwJl9yZi77v2dVIV6X2kuYV8YYBI/G3LWGKdGHmHUvL1z7FW0iDvEvGAwNEoc5x1tOOOyDnf5jJw/w=="], - "nf3": ["nf3@0.1.12", "", {}, "sha512-qbMXT7RTGh74MYWPeqTIED8nDW70NXOULVHpdWcdZ7IVHVnAsMV9fNugSNnvooipDc1FMOzpis7T9nXJEbJhvQ=="], + "nf3": ["nf3@0.3.24", "", {}, "sha512-HxLK4bo+5jNsEETZp4w3tJblHOA9MCBY14IN9nZJJV8JDxt9yNIYxuBuLMjTAR5GFa3HL61+8VQDUrXv3/C8fw=="], - "nitro": ["nitro@3.0.1-alpha.1", "", { "dependencies": { "consola": "^3.4.2", "crossws": "^0.4.1", "db0": "^0.3.4", "h3": "2.0.1-rc.5", "jiti": "^2.6.1", "nf3": "^0.1.10", "ofetch": "^2.0.0-alpha.3", "ohash": "^2.0.11", "oxc-minify": "^0.96.0", "oxc-transform": "^0.96.0", "srvx": "^0.9.5", "undici": "^7.16.0", "unenv": "^2.0.0-rc.24", "unstorage": "^2.0.0-alpha.4" }, "peerDependencies": { "rolldown": "*", "rollup": "^4", "vite": "^7", "xml2js": "^0.6.2" }, "optionalPeers": ["rolldown", "rollup", "vite", "xml2js"], "bin": { "nitro": "dist/cli/index.mjs" } }, "sha512-U4AxIsXxdkxzkFrK0XAw0e5Qbojk8jQ50MjjRBtBakC4HurTtQoiZvF+lSe382jhuQZCfAyywGWOFa9QzXLFaw=="], + "nitro": ["nitro@3.0.260903-beta", "", { "dependencies": { "consola": "^3.4.2", "crossws": "^0.4.12", "db0": "^0.4.1", "env-runner": "^0.2.1", "h3": "^2.0.1-rc.31", "hookable": "^6.1.1", "nf3": "^0.3.24", "ocache": "^0.3.0", "rolldown": "^1.2.7", "rou3": "^0.9.2", "srvx": "^1.0.3", "unenv": "^2.0.0-rc.24", "unstorage": "^2.0.0-alpha.10" }, "bin": { "nitro": "dist/cli/index.mjs" } }, "sha512-54gANPi62O8rfMvepiJUVuIzEIinYfpeHbebywlLxvVTgIYXDwSvpaU9Id+0sJOBjBx0wC1/CVYXJkH7SY+l0g=="], "nlcst-to-string": ["nlcst-to-string@4.0.0", "", { "dependencies": { "@types/nlcst": "^2.0.0" } }, "sha512-YKLBCcUYKAg0FNlOBT6aI91qFmSiFKiluk655WzPF+DDMA02qIyy8uiRqI8QXtcFpEvll12LpL5MXqEmAZ+dcA=="], @@ -3960,7 +3910,9 @@ "obug": ["obug@3.0.0", "", {}, "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw=="], - "ofetch": ["ofetch@2.0.0-alpha.3", "", {}, "sha512-zpYTCs2byOuft65vI3z43Dd6iSdFbOZZLb9/d21aCpx2rGastVU9dOCv0lu4ykc1Ur1anAYjDi3SUvR0vq50JA=="], + "ocache": ["ocache@0.3.1", "", {}, "sha512-qeBrhQ0ly6tgXsakgNwLx6diRUppJZIcV5OjVGa5yp9HzztutkaGDDXJqVMo1fKWz5fNDtTp3iPU2fuhHf0+Lg=="], + + "ofetch": ["ofetch@1.5.1", "", { "dependencies": { "destr": "^2.0.5", "node-fetch-native": "^1.6.7", "ufo": "^1.6.1" } }, "sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA=="], "ohash": ["ohash@2.0.12", "", {}, "sha512-65S/5gk9YSsaRjcyf7Nfa6h/d3E8/1gslpXfI4W7Dxn/oap8IKRuNT5VXkLQ1YFKIEg4apRY4Pj6aiwFzrDdmw=="], @@ -3980,9 +3932,7 @@ "own-keys": ["own-keys@1.0.2", "", { "dependencies": { "call-bound": "^1.0.4", "get-intrinsic": "^1.3.0", "object-keys": "^1.1.1", "safe-push-apply": "^1.0.0" } }, "sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg=="], - "oxc-minify": ["oxc-minify@0.96.0", "", { "optionalDependencies": { "@oxc-minify/binding-android-arm64": "0.96.0", "@oxc-minify/binding-darwin-arm64": "0.96.0", "@oxc-minify/binding-darwin-x64": "0.96.0", "@oxc-minify/binding-freebsd-x64": "0.96.0", "@oxc-minify/binding-linux-arm-gnueabihf": "0.96.0", "@oxc-minify/binding-linux-arm-musleabihf": "0.96.0", "@oxc-minify/binding-linux-arm64-gnu": "0.96.0", "@oxc-minify/binding-linux-arm64-musl": "0.96.0", "@oxc-minify/binding-linux-riscv64-gnu": "0.96.0", "@oxc-minify/binding-linux-s390x-gnu": "0.96.0", "@oxc-minify/binding-linux-x64-gnu": "0.96.0", "@oxc-minify/binding-linux-x64-musl": "0.96.0", "@oxc-minify/binding-wasm32-wasi": "0.96.0", "@oxc-minify/binding-win32-arm64-msvc": "0.96.0", "@oxc-minify/binding-win32-x64-msvc": "0.96.0" } }, "sha512-dXeeGrfPJJ4rMdw+NrqiCRtbzVX2ogq//R0Xns08zql2HjV3Zi2SBJ65saqfDaJzd2bcHqvGWH+M44EQCHPAcA=="], - - "oxc-transform": ["oxc-transform@0.96.0", "", { "optionalDependencies": { "@oxc-transform/binding-android-arm64": "0.96.0", "@oxc-transform/binding-darwin-arm64": "0.96.0", "@oxc-transform/binding-darwin-x64": "0.96.0", "@oxc-transform/binding-freebsd-x64": "0.96.0", "@oxc-transform/binding-linux-arm-gnueabihf": "0.96.0", "@oxc-transform/binding-linux-arm-musleabihf": "0.96.0", "@oxc-transform/binding-linux-arm64-gnu": "0.96.0", "@oxc-transform/binding-linux-arm64-musl": "0.96.0", "@oxc-transform/binding-linux-riscv64-gnu": "0.96.0", "@oxc-transform/binding-linux-s390x-gnu": "0.96.0", "@oxc-transform/binding-linux-x64-gnu": "0.96.0", "@oxc-transform/binding-linux-x64-musl": "0.96.0", "@oxc-transform/binding-wasm32-wasi": "0.96.0", "@oxc-transform/binding-win32-arm64-msvc": "0.96.0", "@oxc-transform/binding-win32-x64-msvc": "0.96.0" } }, "sha512-dQPNIF+gHpSkmC0+Vg9IktNyhcn28Y8R3eTLyzn52UNymkasLicl3sFAtz7oEVuFmCpgGjaUTKkwk+jW2cHpDQ=="], + "oxc-parser": ["oxc-parser@0.141.0", "", { "dependencies": { "@oxc-project/types": "^0.141.0" }, "optionalDependencies": { "@oxc-parser/binding-android-arm-eabi": "0.141.0", "@oxc-parser/binding-android-arm64": "0.141.0", "@oxc-parser/binding-darwin-arm64": "0.141.0", "@oxc-parser/binding-darwin-x64": "0.141.0", "@oxc-parser/binding-freebsd-x64": "0.141.0", "@oxc-parser/binding-linux-arm-gnueabihf": "0.141.0", "@oxc-parser/binding-linux-arm-musleabihf": "0.141.0", "@oxc-parser/binding-linux-arm64-gnu": "0.141.0", "@oxc-parser/binding-linux-arm64-musl": "0.141.0", "@oxc-parser/binding-linux-ppc64-gnu": "0.141.0", "@oxc-parser/binding-linux-riscv64-gnu": "0.141.0", "@oxc-parser/binding-linux-riscv64-musl": "0.141.0", "@oxc-parser/binding-linux-s390x-gnu": "0.141.0", "@oxc-parser/binding-linux-x64-gnu": "0.141.0", "@oxc-parser/binding-linux-x64-musl": "0.141.0", "@oxc-parser/binding-openharmony-arm64": "0.141.0", "@oxc-parser/binding-wasm32-wasi": "0.141.0", "@oxc-parser/binding-win32-arm64-msvc": "0.141.0", "@oxc-parser/binding-win32-ia32-msvc": "0.141.0", "@oxc-parser/binding-win32-x64-msvc": "0.141.0" } }, "sha512-uFkGGr1KMWd6aWv9UAqooYrN78trw8MWWmoPvgWokfBEUq1+eiIQ+qfj3wokhy0fxtZWZk+0dHoS7/yRTJtd6w=="], "oxlint": ["oxlint@1.60.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.60.0", "@oxlint/binding-android-arm64": "1.60.0", "@oxlint/binding-darwin-arm64": "1.60.0", "@oxlint/binding-darwin-x64": "1.60.0", "@oxlint/binding-freebsd-x64": "1.60.0", "@oxlint/binding-linux-arm-gnueabihf": "1.60.0", "@oxlint/binding-linux-arm-musleabihf": "1.60.0", "@oxlint/binding-linux-arm64-gnu": "1.60.0", "@oxlint/binding-linux-arm64-musl": "1.60.0", "@oxlint/binding-linux-ppc64-gnu": "1.60.0", "@oxlint/binding-linux-riscv64-gnu": "1.60.0", "@oxlint/binding-linux-riscv64-musl": "1.60.0", "@oxlint/binding-linux-s390x-gnu": "1.60.0", "@oxlint/binding-linux-x64-gnu": "1.60.0", "@oxlint/binding-linux-x64-musl": "1.60.0", "@oxlint/binding-openharmony-arm64": "1.60.0", "@oxlint/binding-win32-arm64-msvc": "1.60.0", "@oxlint/binding-win32-ia32-msvc": "1.60.0", "@oxlint/binding-win32-x64-msvc": "1.60.0" }, "peerDependencies": { "oxlint-tsgolint": ">=0.18.0" }, "optionalPeers": ["oxlint-tsgolint"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-tnRzTWiWJ9pg3ftRWnD0+Oqh78L6ZSwcEudvCZaER0PIqiAnNyXj5N1dPwjmNpDalkKS9m/WMLN1CTPUBPmsgw=="], @@ -4234,7 +4184,7 @@ "rollup": ["rollup@4.62.4", "", { "dependencies": { "@types/estree": "1.0.9" }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", "@rollup/rollup-android-arm-eabi": "4.62.4", "@rollup/rollup-android-arm64": "4.62.4", "@rollup/rollup-darwin-arm64": "4.62.4", "@rollup/rollup-darwin-x64": "4.62.4", "@rollup/rollup-freebsd-arm64": "4.62.4", "@rollup/rollup-freebsd-x64": "4.62.4", "@rollup/rollup-linux-arm-gnueabihf": "4.62.4", "@rollup/rollup-linux-arm-musleabihf": "4.62.4", "@rollup/rollup-linux-arm64-gnu": "4.62.4", "@rollup/rollup-linux-arm64-musl": "4.62.4", "@rollup/rollup-linux-loong64-gnu": "4.62.4", "@rollup/rollup-linux-loong64-musl": "4.62.4", "@rollup/rollup-linux-ppc64-gnu": "4.62.4", "@rollup/rollup-linux-ppc64-musl": "4.62.4", "@rollup/rollup-linux-riscv64-gnu": "4.62.4", "@rollup/rollup-linux-riscv64-musl": "4.62.4", "@rollup/rollup-linux-s390x-gnu": "4.62.4", "@rollup/rollup-linux-x64-gnu": "4.62.4", "@rollup/rollup-linux-x64-musl": "4.62.4", "@rollup/rollup-openbsd-x64": "4.62.4", "@rollup/rollup-openharmony-arm64": "4.62.4", "@rollup/rollup-win32-arm64-msvc": "4.62.4", "@rollup/rollup-win32-ia32-msvc": "4.62.4", "@rollup/rollup-win32-x64-gnu": "4.62.4", "@rollup/rollup-win32-x64-msvc": "4.62.4", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-RXOqwaPsBGjMNMa4sQjDjHieHEZDFoj/Rdr46l2MU5DfEs16wHJPC2RPTPHWhNl+M3aI472LLqFkFKut4SblOg=="], - "rou3": ["rou3@0.7.12", "", {}, "sha512-iFE4hLDuloSWcD7mjdCDhx2bKcIsYbtOTpfH5MHHLSKMOUyjqQXTeZVa289uuwEGEKFoE/BAPbhaU4B774nceg=="], + "rou3": ["rou3@0.9.2", "", {}, "sha512-3SOzvaAg8rkHrXtRjpCvCvbyO5to9oOO27Z/XqHEYXfMRVSw/qMIVdmaOk9W2lcRLtR6dlqTjo9hDeJk70QBYQ=="], "run-applescript": ["run-applescript@7.1.0", "", {}, "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q=="], @@ -4296,8 +4246,6 @@ "side-channel-weakmap": ["side-channel-weakmap@1.0.2", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" } }, "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A=="], - "siginfo": ["siginfo@2.0.0", "", {}, "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="], - "signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="], "sigstore": ["sigstore@4.1.1", "", { "dependencies": { "@sigstore/bundle": "^4.0.0", "@sigstore/core": "^3.2.1", "@sigstore/protobuf-specs": "^0.5.0", "@sigstore/sign": "^4.1.1", "@sigstore/tuf": "^4.0.2", "@sigstore/verify": "^3.1.1" } }, "sha512-endqECJkfhozrXMK5ngu/UAA0xVcVEFdnHJCElGaExypjW+HK5i6zu3NteLoaX/iFbRUbC3+DjttQs0GARr+5w=="], @@ -4368,7 +4316,7 @@ "sprintf-js": ["sprintf-js@1.0.3", "", {}, "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="], - "srvx": ["srvx@0.9.8", "", { "bin": { "srvx": "bin/srvx.mjs" } }, "sha512-RZaxTKJEE/14HYn8COLuUOJAt0U55N9l1Xf6jj+T0GoA01EUH1Xz5JtSUOI+EHn+AEgPCVn7gk6jHJffrr06fQ=="], + "srvx": ["srvx@0.12.8", "", { "bin": { "srvx": "./bin/srvx.mjs" } }, "sha512-7k9HoDhluTlD7UJ+F+OopZoPZXB2J8f/5nW2VMLaB8KsSlZlRQxyyoX0hWEQCxB+F+3ZvB5QX3LqB6xSBRfxQQ=="], "ssri": ["ssri@13.0.1", "", { "dependencies": { "minipass": "^7.0.3" } }, "sha512-QUiRf1+u9wPTL/76GTYlKttDEBWV1ga9ZXW8BG6kfdeyyM8LGPix9gROyg9V2+P0xNyF3X2Go526xKFdMZrHSQ=="], @@ -4390,14 +4338,8 @@ "sst-win32-x86": ["sst-win32-x86@4.13.1", "", { "os": "win32", "cpu": "none" }, "sha512-YPxBVdac/MsrzwlC6pF0NrrvMcmfdBLYjv7MbzHc5jNh1FQ1WPh6bdWQqgv0KD9EQTNLLEkej0beydgUvcCWJg=="], - "stackback": ["stackback@0.0.2", "", {}, "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw=="], - - "stackframe": ["stackframe@1.3.4", "", {}, "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw=="], - "stat-mode": ["stat-mode@1.0.0", "", {}, "sha512-jH9EhtKIjuXZ2cWxmXS8ZP80XyC3iasQxMDV8jzhNJpfDb7VbQLVW4Wvsxz9QZvzV+G4YoSfBUVKDOyxLzi/sg=="], - "std-env": ["std-env@4.2.0", "", {}, "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw=="], - "stop-iteration-iterator": ["stop-iteration-iterator@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "internal-slot": "^1.1.0" } }, "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ=="], "stoppable": ["stoppable@1.1.0", "", {}, "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw=="], @@ -4460,7 +4402,7 @@ "tempy": ["tempy@0.6.0", "", { "dependencies": { "is-stream": "^2.0.0", "temp-dir": "^2.0.0", "type-fest": "^0.16.0", "unique-string": "^2.0.0" } }, "sha512-G13vtMYPT/J8A4X2SjdtBTphZlrp1gKv6hZiOjw14RCWg6GbHuQBGtjlx75xLbYV/wEc0D7G5K4rxKP/cXk8Bw=="], - "terracotta": ["terracotta@1.1.1", "", { "dependencies": { "solid-use": "^0.9.1" }, "peerDependencies": { "solid-js": "^1.8" } }, "sha512-Sa6wnvkGMFmPq8N/wQb2aKkIW2eXH0LJvUOEk6QZLBEjqy+LsbzAOpDuqEfOmfA/hexssE6eQve2i1IIOeOh4g=="], + "terracotta": ["terracotta@1.3.1", "", { "dependencies": { "solid-use": "^0.9.1" }, "peerDependencies": { "solid-js": "^1.8" } }, "sha512-8HNvzQbgp2KiK8CiaQayhEQrjW97n9K1Exfj2+TMLVrHTmGXBJ61QypXlGa+xf5Gc7gzrAIysnmy/7qkUyN8Ow=="], "terser": ["terser@5.50.0", "", { "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.15.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, "bin": { "terser": "bin/terser" } }, "sha512-CN9BVxWhgS/hRxtUMjtC2uRWSTcSfQFHMDWma6sKKfIivCD91sM+FOPfvwoaRMqCSrUpe1nv3jDamd9eEQ4y+w=="], @@ -4470,20 +4412,14 @@ "tiny-inflate": ["tiny-inflate@1.0.3", "", {}, "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw=="], - "tiny-invariant": ["tiny-invariant@1.3.3", "", {}, "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg=="], - "tiny-typed-emitter": ["tiny-typed-emitter@2.1.0", "", {}, "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA=="], - "tinybench": ["tinybench@2.9.0", "", {}, "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg=="], - "tinyclip": ["tinyclip@1.0.3", "", {}, "sha512-nTv2raKFMzGG6JJp0lpNDsRPdfFE6UHlu2rVEjXo8vkx1ZS3LW2CVXqIaLu8xZlu+6tbFs9V58Qc/Jmk/Ii7wA=="], "tinyexec": ["tinyexec@1.3.1", "", {}, "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA=="], "tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], - "tinyrainbow": ["tinyrainbow@3.1.1", "", {}, "sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw=="], - "tldts-core": ["tldts-core@7.4.11", "", {}, "sha512-CW3WN2rIIE/Of21mulhgnGOwoDyEFNygyIBOONSdyAuSATgMMUCpLeUlB+E8sAwA5xRV9hYPl+kyZ9citHCaKg=="], "tldts-icann": ["tldts-icann@7.4.11", "", { "dependencies": { "tldts-core": "^7.4.11" } }, "sha512-1p+NDJ7FUYCliESmsQl9EW5Um8JIyFheiy6Y6ZoHho27d+TLAGFa0gMf1VOVy02vNY1aQo6xeKiaGj45+7P+PA=="], @@ -4590,7 +4526,7 @@ "universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="], - "unstorage": ["unstorage@2.0.0-alpha.7", "", { "peerDependencies": { "@azure/app-configuration": "^1.11.0", "@azure/cosmos": "^4.9.1", "@azure/data-tables": "^13.3.2", "@azure/identity": "^4.13.0", "@azure/keyvault-secrets": "^4.10.0", "@azure/storage-blob": "^12.31.0", "@capacitor/preferences": "^6 || ^7 || ^8", "@deno/kv": ">=0.13.0", "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0", "@planetscale/database": "^1.19.0", "@upstash/redis": "^1.36.2", "@vercel/blob": ">=0.27.3", "@vercel/functions": "^2.2.12 || ^3.0.0", "@vercel/kv": "^1.0.1", "aws4fetch": "^1.0.20", "chokidar": "^4 || ^5", "db0": ">=0.3.4", "idb-keyval": "^6.2.2", "ioredis": "^5.9.3", "lru-cache": "^11.2.6", "mongodb": "^6 || ^7", "ofetch": "*", "uploadthing": "^7.7.4" }, "optionalPeers": ["@azure/app-configuration", "@azure/cosmos", "@azure/data-tables", "@azure/identity", "@azure/keyvault-secrets", "@azure/storage-blob", "@capacitor/preferences", "@deno/kv", "@netlify/blobs", "@planetscale/database", "@upstash/redis", "@vercel/blob", "@vercel/functions", "@vercel/kv", "aws4fetch", "chokidar", "db0", "idb-keyval", "ioredis", "lru-cache", "mongodb", "ofetch", "uploadthing"] }, "sha512-ELPztchk2zgFJnakyodVY3vJWGW9jy//keJ32IOJVGUMyaPydwcA1FtVvWqT0TNRch9H+cMNEGllfVFfScImog=="], + "unstorage": ["unstorage@2.0.0-beta.0", "", {}, "sha512-VeTY+zQ3ozrNtIFBRQRuSwanHdpuRH+4t/ZzchZIVQO8/oKq2xl7fJ9c+z76tWJDW/BEXSEuzpHOxqoAl6B64A=="], "unused-filename": ["unused-filename@4.0.1", "", { "dependencies": { "escape-string-regexp": "^5.0.0", "path-exists": "^5.0.0" } }, "sha512-ZX6U1J04K1FoSUeoX1OicAhw4d0aro2qo+L8RhJkiGTNtBNkd/Fi1Wxoc9HzcVu6HfOzm0si/N15JjxFmD1z6A=="], @@ -4626,8 +4562,6 @@ "vitefu": ["vitefu@1.1.3", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["vite"] }, "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg=="], - "vitest": ["vitest@4.1.11", "", { "dependencies": { "@vitest/expect": "4.1.11", "@vitest/mocker": "4.1.11", "@vitest/pretty-format": "4.1.11", "@vitest/runner": "4.1.11", "@vitest/snapshot": "4.1.11", "@vitest/spy": "4.1.11", "@vitest/utils": "4.1.11", "es-module-lexer": "^2.0.0", "expect-type": "^1.3.0", "magic-string": "^0.30.21", "obug": "^2.1.1", "pathe": "^2.0.3", "picomatch": "^4.0.3", "std-env": "^4.0.0-rc.1", "tinybench": "^2.9.0", "tinyexec": "^1.0.2", "tinyglobby": "^0.2.15", "tinyrainbow": "^3.1.0", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", "why-is-node-running": "^2.3.0" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "4.1.11", "@vitest/browser-preview": "4.1.11", "@vitest/browser-webdriverio": "4.1.11", "@vitest/coverage-istanbul": "4.1.11", "@vitest/coverage-v8": "4.1.11", "@vitest/ui": "4.1.11", "happy-dom": "*", "jsdom": "*" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@types/node", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/coverage-istanbul", "@vitest/coverage-v8", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "./vitest.mjs" } }, "sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw=="], - "volar-service-css": ["volar-service-css@0.0.71", "", { "dependencies": { "vscode-css-languageservice": "^6.3.0", "vscode-languageserver-textdocument": "^1.0.11", "vscode-uri": "^3.0.8" }, "peerDependencies": { "@volar/language-service": "~2.4.0" }, "optionalPeers": ["@volar/language-service"] }, "sha512-wRRFt9BpjMKCazcgOh67MSjUjiWUCAh99DyYSDIOTuxaRjEtDC7PpB0k1Y1wbJIW/pVtMUSVbpPo3UGSm0Byxw=="], "volar-service-emmet": ["volar-service-emmet@0.0.71", "", { "dependencies": { "@emmetio/css-parser": "^0.4.1", "@emmetio/html-matcher": "^1.3.0", "@vscode/emmet-helper": "^2.9.3", "vscode-uri": "^3.0.8" }, "peerDependencies": { "@volar/language-service": "~2.4.0" }, "optionalPeers": ["@volar/language-service"] }, "sha512-zqjzt6bN95e3CUstBm0PBFAJnrfz0ZAARka87fart46/gNCLLuP3Vujy8V/J8HEziTFLnfkgIASLFYPUhonJcA=="], @@ -4694,8 +4628,6 @@ "which-typed-array": ["which-typed-array@1.1.22", "", { "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.9", "call-bound": "^1.0.4", "for-each": "^0.3.5", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2" } }, "sha512-fvO4ExWMFsqyhG3AiPAObMuY1lxaqgYcxbc49CNdWDDECOJNgQyvsOWVwbZc+qf3rzRtxojBK+CMEv0Ld5CYpw=="], - "why-is-node-running": ["why-is-node-running@2.3.0", "", { "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" }, "bin": { "why-is-node-running": "cli.js" } }, "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w=="], - "workbox-background-sync": ["workbox-background-sync@7.4.1", "", { "dependencies": { "idb": "^7.0.1", "workbox-core": "7.4.1" } }, "sha512-HhT7KE8tOWDm02wRNshXUnUPofMlhenF2DBdUnDPOubhizzPeItkYTmAB6td1Z2cjYPa98vzEiPLEuzn5hN66g=="], "workbox-broadcast-update": ["workbox-broadcast-update@7.4.1", "", { "dependencies": { "workbox-core": "7.4.1" } }, "sha512-uAlgslKLvbQY+suirIdnBCSYrcgBhjp81Nj4l1lj/Jmj0MJO2CJERnCJjT0GFVwmReV0N+zs78K6gqd5gr9/+A=="], @@ -4780,11 +4712,13 @@ "@ai-sdk/provider-utils/undici": ["undici@6.29.1", "", {}, "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA=="], + "@astrojs/astro2tsx/@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" } }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="], + "@astrojs/astro2tsx/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g=="], - "@astrojs/compiler-binding-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], + "@astrojs/compiler-binding-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" } }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="], - "@astrojs/compiler-binding-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.5", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-HshSvXzmBxNzqejd3k/KemgQ3hdREUYFRRrgxOZ+gPljDIsO2SDZrVZMd4Z/HsxudQbE62OVyVFE8z9BCurfjA=="], + "@astrojs/compiler-binding-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], "@astrojs/internal-helpers/js-yaml": ["js-yaml@4.3.2", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA=="], @@ -4802,8 +4736,6 @@ "@astrojs/mdx/acorn": ["acorn@8.18.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="], - "@astrojs/mdx/es-module-lexer": ["es-module-lexer@2.3.2", "", {}, "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw=="], - "@astrojs/solid-js/vite": ["vite@8.3.4", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.29", "rolldown": "~1.2.12", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ=="], "@astrojs/starlight/@astrojs/markdown-satteri": ["@astrojs/markdown-satteri@0.3.8", "", { "dependencies": { "@astrojs/internal-helpers": "0.10.4", "@astrojs/prism": "4.0.2", "github-slugger": "^2.0.0", "satteri": "^0.10.3" } }, "sha512-n8ItpFTCmlDsVR5+rwDmehSf+jFCYLWmZiisZNGuF7xILqYhsVeBfcha4qgS2Seq3fAc9Tm58ZVrvqFQ6RQgRQ=="], @@ -4830,7 +4762,7 @@ "@bruits/satteri-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" } }, "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ=="], - "@bruits/satteri-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.5", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-HshSvXzmBxNzqejd3k/KemgQ3hdREUYFRRrgxOZ+gPljDIsO2SDZrVZMd4Z/HsxudQbE62OVyVFE8z9BCurfjA=="], + "@bruits/satteri-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw=="], "@cloudflare/vite-plugin/miniflare": ["miniflare@5.20260811.1-alpha", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.35.2", "undici": "7.29.0", "workerd": "1.20260811.1", "ws": "8.21.0", "youch": "4.1.0-beta.10" } }, "sha512-DtOG0BeanIxs2sH0smFvExZD89cBQwGckbHiFkRJrrNAUu3NGClZkUxqu+zy7HYfKBAgq935EMY49vIPm3JVdA=="], @@ -4912,8 +4844,6 @@ "@opencode/cli/vite-plugin-solid": ["vite-plugin-solid@2.11.10", "", { "dependencies": { "@babel/core": "^7.23.3", "@types/babel__core": "^7.20.4", "babel-preset-solid": "^1.8.4", "merge-anything": "^5.1.7", "solid-refresh": "^0.6.3", "vitefu": "^1.0.4" }, "peerDependencies": { "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.*", "solid-js": "^1.7.2", "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" }, "optionalPeers": ["@testing-library/jest-dom"] }, "sha512-Yr1dQybmtDtDAHkii6hXuc1oVH9CPcS/Zb2jN/P36qqcrkNnVPsMTzQ06jyzFPFjj3U1IYKMVt/9ZqcwGCEbjw=="], - "@opencode/console-app/vite": ["vite@7.3.7", "", { "dependencies": { "esbuild": "^0.27.0 || ^0.28.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-AHEzTORMbi7/7aXp7w7KZ5+DCUdSeLsJz0grY8xHpc9DHdYb0vQu6DqJfm2tOw3gDExNgPgnJTXxM6syYFHaCA=="], - "@opencode/console-app/wrangler": ["wrangler@4.50.0", "", { "dependencies": { "@cloudflare/kv-asset-handler": "0.4.0", "@cloudflare/unenv-preset": "2.7.11", "blake3-wasm": "2.1.5", "esbuild": "0.25.4", "miniflare": "4.20251118.1", "path-to-regexp": "6.3.0", "unenv": "2.0.0-rc.24", "workerd": "1.20251118.0" }, "optionalDependencies": { "fsevents": "~2.3.2" }, "peerDependencies": { "@cloudflare/workers-types": "^4.20251118.0" }, "optionalPeers": ["@cloudflare/workers-types"], "bin": { "wrangler": "bin/wrangler.js", "wrangler2": "bin/wrangler.js" } }, "sha512-+nuZuHZxDdKmAyXOSrHlciGshCoAPiy5dM+t6mEohWm7HpXvTHmWQGUf/na9jjWlWJHCJYOWzkA1P5HBJqrIEA=="], "@opencode/gui-plugins/vite": ["vite@7.3.7", "", { "dependencies": { "esbuild": "^0.27.0 || ^0.28.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-AHEzTORMbi7/7aXp7w7KZ5+DCUdSeLsJz0grY8xHpc9DHdYb0vQu6DqJfm2tOw3gDExNgPgnJTXxM6syYFHaCA=="], @@ -4928,8 +4858,6 @@ "@opencode/session-ui/vite-plugin-solid": ["vite-plugin-solid@2.11.10", "", { "dependencies": { "@babel/core": "^7.23.3", "@types/babel__core": "^7.20.4", "babel-preset-solid": "^1.8.4", "merge-anything": "^5.1.7", "solid-refresh": "^0.6.3", "vitefu": "^1.0.4" }, "peerDependencies": { "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.*", "solid-js": "^1.7.2", "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" }, "optionalPeers": ["@testing-library/jest-dom"] }, "sha512-Yr1dQybmtDtDAHkii6hXuc1oVH9CPcS/Zb2jN/P36qqcrkNnVPsMTzQ06jyzFPFjj3U1IYKMVt/9ZqcwGCEbjw=="], - "@opencode/stats-app/vite": ["vite@7.3.7", "", { "dependencies": { "esbuild": "^0.27.0 || ^0.28.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-AHEzTORMbi7/7aXp7w7KZ5+DCUdSeLsJz0grY8xHpc9DHdYb0vQu6DqJfm2tOw3gDExNgPgnJTXxM6syYFHaCA=="], - "@opencode/stories/@tailwindcss/vite": ["@tailwindcss/vite@4.1.11", "", { "dependencies": { "@tailwindcss/node": "4.1.11", "@tailwindcss/oxide": "4.1.11", "tailwindcss": "4.1.11" }, "peerDependencies": { "vite": "^5.2.0 || ^6 || ^7" } }, "sha512-RHYhrR3hku0MJFRV+fN2gNbDNEh3dwKvY8XJvTxCSXeMOsCRSr+uKvDWQcbizrHgjML6ZmTE5OwMrl5wKcujCw=="], "@opencode/stories/vite": ["vite@7.3.7", "", { "dependencies": { "esbuild": "^0.27.0 || ^0.28.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-AHEzTORMbi7/7aXp7w7KZ5+DCUdSeLsJz0grY8xHpc9DHdYb0vQu6DqJfm2tOw3gDExNgPgnJTXxM6syYFHaCA=="], @@ -4998,14 +4926,6 @@ "@solidjs/start/path-to-regexp": ["path-to-regexp@8.4.2", "", {}, "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA=="], - "@solidjs/start/seroval": ["seroval@1.5.6", "", {}, "sha512-rVQVWjjSvlINzaQPZH5JFqsqEsIWdTxY3iJZCnTL/5gQbXIRooVZKI60tVCkOVfzcRPejboxO2t0P89dg5mQaA=="], - - "@solidjs/start/seroval-plugins": ["seroval-plugins@1.5.6", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-HXuLAX2pu/UByPpaeo/TaMfvMIi+1QqIoPJYCcAtU8QkVNwgR6MPlGuCQTErV1JwraaMbYaWVIBX7mppzGLATQ=="], - - "@solidjs/start/shiki": ["shiki@1.29.2", "", { "dependencies": { "@shikijs/core": "1.29.2", "@shikijs/engine-javascript": "1.29.2", "@shikijs/engine-oniguruma": "1.29.2", "@shikijs/langs": "1.29.2", "@shikijs/themes": "1.29.2", "@shikijs/types": "1.29.2", "@shikijs/vscode-textmate": "^10.0.1", "@types/hast": "^3.0.4" } }, "sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg=="], - - "@solidjs/start/vite": ["vite@7.1.10", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-CmuvUBzVJ/e3HGxhg6cYk88NGgTnBoOo7ogtfJJ0fefUWAxN/WDSUa50o+oVBxuIhO8FoEZW0j2eW7sfjs5EtA=="], - "@tailwindcss/node/lightningcss": ["lightningcss@1.32.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.32.0", "lightningcss-darwin-arm64": "1.32.0", "lightningcss-darwin-x64": "1.32.0", "lightningcss-freebsd-x64": "1.32.0", "lightningcss-linux-arm-gnueabihf": "1.32.0", "lightningcss-linux-arm64-gnu": "1.32.0", "lightningcss-linux-arm64-musl": "1.32.0", "lightningcss-linux-x64-gnu": "1.32.0", "lightningcss-linux-x64-musl": "1.32.0", "lightningcss-win32-arm64-msvc": "1.32.0", "lightningcss-win32-x64-msvc": "1.32.0" } }, "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ=="], "@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" }, "bundled": true }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="], @@ -5020,12 +4940,6 @@ "@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@tanstack/directive-functions-plugin/@babel/code-frame": ["@babel/code-frame@7.27.1", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="], - - "@tanstack/router-utils/diff": ["diff@8.0.3", "", {}, "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ=="], - - "@tanstack/server-functions-plugin/@babel/code-frame": ["@babel/code-frame@7.27.1", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="], - "@vscode/emmet-helper/jsonc-parser": ["jsonc-parser@2.3.1", "", {}, "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg=="], "anymatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], @@ -5104,6 +5018,8 @@ "enquirer/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], + "env-runner/srvx": ["srvx@1.0.6", "", { "bin": { "srvx": "./bin/srvx.mjs" } }, "sha512-QeTKgAhk8OSsfeq60bl3wuVs9PmBftzmk7owBInA/F1YQne+TRw0UcPymNpURldAmx8hfmM2PNNGH/zgo3GpLA=="], + "esast-util-from-js/acorn": ["acorn@8.18.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="], "fetch-blob/web-streams-polyfill": ["web-streams-polyfill@3.3.3", "", {}, "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="], @@ -5132,12 +5048,14 @@ "gitlab-ai-provider/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], + "h3/rou3": ["rou3@1.0.0", "", {}, "sha512-ySeaQkSrua+ut9g+65I7FHqOFBaY8tV0FmccXItoq0q21se32Q3u4YiW7/RqXSosWgYJaaKwRHXy3BST9PeCNQ=="], + + "h3/srvx": ["srvx@1.0.6", "", { "bin": { "srvx": "./bin/srvx.mjs" } }, "sha512-QeTKgAhk8OSsfeq60bl3wuVs9PmBftzmk7owBInA/F1YQne+TRw0UcPymNpURldAmx8hfmM2PNNGH/zgo3GpLA=="], + "hosted-git-info/lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="], "htmlparser2/entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="], - "import-in-the-middle/es-module-lexer": ["es-module-lexer@2.3.2", "", {}, "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw=="], - "is-inside-container/is-docker": ["is-docker@3.0.0", "", { "bin": { "is-docker": "cli.js" } }, "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ=="], "is-wsl/is-docker": ["is-docker@2.2.1", "", { "bin": { "is-docker": "cli.js" } }, "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="], @@ -5160,9 +5078,9 @@ "minipass-pipeline/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], - "nitro/h3": ["h3@2.0.1-rc.5", "", { "dependencies": { "rou3": "^0.7.9", "srvx": "^0.9.1" }, "peerDependencies": { "crossws": "^0.4.1" }, "optionalPeers": ["crossws"] }, "sha512-qkohAzCab0nLzXNm78tBjZDvtKMTmtygS8BJLT3VPczAQofdqlFXDPkXdLMJN4r05+xqneG8snZJ0HgkERCZTg=="], + "nitro/rolldown": ["rolldown@1.2.14", "", { "dependencies": { "@oxc-project/types": "=0.154.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.14", "@rolldown/binding-android-arm64": "1.2.14", "@rolldown/binding-darwin-arm64": "1.2.14", "@rolldown/binding-darwin-x64": "1.2.14", "@rolldown/binding-freebsd-x64": "1.2.14", "@rolldown/binding-linux-arm-gnueabihf": "1.2.14", "@rolldown/binding-linux-arm64-gnu": "1.2.14", "@rolldown/binding-linux-arm64-musl": "1.2.14", "@rolldown/binding-linux-ppc64-gnu": "1.2.14", "@rolldown/binding-linux-s390x-gnu": "1.2.14", "@rolldown/binding-linux-x64-gnu": "1.2.14", "@rolldown/binding-linux-x64-musl": "1.2.14", "@rolldown/binding-openharmony-arm64": "1.2.14", "@rolldown/binding-win32-arm64-msvc": "1.2.14", "@rolldown/binding-win32-x64-msvc": "1.2.14" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-eTBTTqMR6uHKLgcUqpJP8ntzDI6V4LYA8negAMBEI7gkgVvOdrx6VsvS2Ym+83KhOPdLCHWJu0w7UQFJZhHKNw=="], - "nitro/undici": ["undici@7.30.1", "", {}, "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg=="], + "nitro/srvx": ["srvx@1.0.6", "", { "bin": { "srvx": "./bin/srvx.mjs" } }, "sha512-QeTKgAhk8OSsfeq60bl3wuVs9PmBftzmk7owBInA/F1YQne+TRw0UcPymNpURldAmx8hfmM2PNNGH/zgo3GpLA=="], "node-gyp/undici": ["undici@6.29.1", "", {}, "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA=="], @@ -5174,6 +5092,8 @@ "openid-client/lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="], + "oxc-parser/@oxc-project/types": ["@oxc-project/types@0.141.0", "", {}, "sha512-S4as7z0j0xQkXcJlyY5ehntwK8/wRkQb9Cyqw+J/N2rkWGQGK0SxD6X6DhQTc7qsxVTBxXbxZtBJh3mr3PtIzQ=="], + "p-locate/p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], "parse-entities/@types/unist": ["@types/unist@2.0.11", "", {}, "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA=="], @@ -5252,12 +5172,6 @@ "vite-plugin-icons-spritesheet/tinyexec": ["tinyexec@0.3.2", "", {}, "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA=="], - "vitest/es-module-lexer": ["es-module-lexer@2.3.2", "", {}, "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw=="], - - "vitest/obug": ["obug@2.1.4", "", {}, "sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA=="], - - "vitest/tinyexec": ["tinyexec@1.3.0", "", {}, "sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ=="], - "vscode-languageserver/vscode-languageserver-protocol": ["vscode-languageserver-protocol@3.17.5", "", { "dependencies": { "vscode-jsonrpc": "8.2.0", "vscode-languageserver-types": "3.17.5" } }, "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg=="], "vscode-languageserver-protocol/vscode-jsonrpc": ["vscode-jsonrpc@9.0.1", "", {}, "sha512-rfuA6T75H6m5EkbhtEPzre9pT0HPcDI2MMy4+nPFIBks5J8JBAUHD4tRYSgaBOijIEC7SRkC1kKyXTLqbmh9jw=="], @@ -5300,6 +5214,12 @@ "youch/cookie": ["cookie@1.1.1", "", {}, "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ=="], + "youch-core/error-stack-parser-es": ["error-stack-parser-es@1.0.5", "", {}, "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA=="], + + "@astrojs/astro2tsx/@emnapi/core/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g=="], + + "@astrojs/compiler-binding-wasm32-wasi/@emnapi/core/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g=="], + "@astrojs/internal-helpers/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], "@astrojs/markdown-remark/@astrojs/internal-helpers/yaml": ["yaml@2.9.1", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw=="], @@ -5344,8 +5264,6 @@ "@babel/helper-compilation-targets/lru-cache/yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="], - "@bruits/satteri-wasm32-wasi/@emnapi/core/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA=="], - "@cloudflare/vite-plugin/miniflare/sharp": ["sharp@0.35.2", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.4" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.2", "@img/sharp-darwin-x64": "0.35.2", "@img/sharp-freebsd-wasm32": "0.35.2", "@img/sharp-libvips-darwin-arm64": "1.3.1", "@img/sharp-libvips-darwin-x64": "1.3.1", "@img/sharp-libvips-linux-arm": "1.3.1", "@img/sharp-libvips-linux-arm64": "1.3.1", "@img/sharp-libvips-linux-ppc64": "1.3.1", "@img/sharp-libvips-linux-riscv64": "1.3.1", "@img/sharp-libvips-linux-s390x": "1.3.1", "@img/sharp-libvips-linux-x64": "1.3.1", "@img/sharp-libvips-linuxmusl-arm64": "1.3.1", "@img/sharp-libvips-linuxmusl-x64": "1.3.1", "@img/sharp-linux-arm": "0.35.2", "@img/sharp-linux-arm64": "0.35.2", "@img/sharp-linux-ppc64": "0.35.2", "@img/sharp-linux-riscv64": "0.35.2", "@img/sharp-linux-s390x": "0.35.2", "@img/sharp-linux-x64": "0.35.2", "@img/sharp-linuxmusl-arm64": "0.35.2", "@img/sharp-linuxmusl-x64": "0.35.2", "@img/sharp-webcontainers-wasm32": "0.35.2", "@img/sharp-win32-arm64": "0.35.2", "@img/sharp-win32-ia32": "0.35.2", "@img/sharp-win32-x64": "0.35.2" } }, "sha512-FVtFjtBCMiJS6yb5CX7Sop45WFMpeGw6oRKuJnXYgf/f1ms/D7LE/ZUSNxnW7rZ/dbslQWYkoqFHGPaDBtaK4w=="], "@cloudflare/vite-plugin/miniflare/undici": ["undici@7.29.0", "", {}, "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw=="], @@ -5436,18 +5354,6 @@ "@sentry/node/@opentelemetry/sdk-trace-base/@opentelemetry/resources": ["@opentelemetry/resources@2.11.0", "", { "dependencies": { "@opentelemetry/core": "2.11.0", "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.3.0 <1.10.0" } }, "sha512-Ie7+8q8MDF4FAEQCKVMTx3ReUvxiIAgIiiW3c9JdmP8+HMcDy20puT+AHjexnExgnbvBxjQ9fjkFDWrikJ2jQA=="], - "@solidjs/start/shiki/@shikijs/core": ["@shikijs/core@1.29.2", "", { "dependencies": { "@shikijs/engine-javascript": "1.29.2", "@shikijs/engine-oniguruma": "1.29.2", "@shikijs/types": "1.29.2", "@shikijs/vscode-textmate": "^10.0.1", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.4" } }, "sha512-vju0lY9r27jJfOY4Z7+Rt/nIOjzJpZ3y+nYpqtUZInVoXQ/TJZcfGnNOGnKjFdVZb8qexiCuSlZRKcGfhhTTZQ=="], - - "@solidjs/start/shiki/@shikijs/engine-javascript": ["@shikijs/engine-javascript@1.29.2", "", { "dependencies": { "@shikijs/types": "1.29.2", "@shikijs/vscode-textmate": "^10.0.1", "oniguruma-to-es": "^2.2.0" } }, "sha512-iNEZv4IrLYPv64Q6k7EPpOCE/nuvGiKl7zxdq0WFuRPF5PAE9PRo2JGq/d8crLusM59BRemJ4eOqrFrC4wiQ+A=="], - - "@solidjs/start/shiki/@shikijs/engine-oniguruma": ["@shikijs/engine-oniguruma@1.29.2", "", { "dependencies": { "@shikijs/types": "1.29.2", "@shikijs/vscode-textmate": "^10.0.1" } }, "sha512-7iiOx3SG8+g1MnlzZVDYiaeHe7Ez2Kf2HrJzdmGwkRisT7r4rak0e655AcM/tF9JG/kg5fMNYlLLKglbN7gBqA=="], - - "@solidjs/start/shiki/@shikijs/langs": ["@shikijs/langs@1.29.2", "", { "dependencies": { "@shikijs/types": "1.29.2" } }, "sha512-FIBA7N3LZ+223U7cJDUYd5shmciFQlYkFXlkKVaHsCPgfVLiO+e12FmQE6Tf9vuyEsFe3dIl8qGWKXgEHL9wmQ=="], - - "@solidjs/start/shiki/@shikijs/themes": ["@shikijs/themes@1.29.2", "", { "dependencies": { "@shikijs/types": "1.29.2" } }, "sha512-i9TNZlsq4uoyqSbluIcZkmPL9Bfi3djVxRnofUHwvx/h6SRW3cwgBC5SML7vsDcWyukY0eCzVN980rqP6qNl9g=="], - - "@solidjs/start/shiki/@shikijs/types": ["@shikijs/types@1.29.2", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.1", "@types/hast": "^3.0.4" } }, "sha512-VJjK0eIijTZf0QSTODEXCqinjBn0joAHQ+aPSBzrv4O2d/QSbsMw+ZeSRx03kV34Hy7NzUvV/7NqfYGRLrASmw=="], - "@tailwindcss/node/lightningcss/lightningcss-android-arm64": ["lightningcss-android-arm64@1.32.0", "", { "os": "android", "cpu": "arm64" }, "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg=="], "@tailwindcss/node/lightningcss/lightningcss-darwin-arm64": ["lightningcss-darwin-arm64@1.32.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ=="], @@ -5518,8 +5424,6 @@ "astro/unstorage/h3": ["h3@1.15.11", "", { "dependencies": { "cookie-es": "^1.2.3", "crossws": "^0.3.5", "defu": "^6.1.6", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", "radix3": "^1.1.2", "ufo": "^1.6.3", "uncrypto": "^0.1.3" } }, "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg=="], - "astro/unstorage/ofetch": ["ofetch@1.5.1", "", { "dependencies": { "destr": "^2.0.5", "node-fetch-native": "^1.6.7", "ufo": "^1.6.1" } }, "sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA=="], - "astro/vite/postcss": ["postcss@8.5.31", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg=="], "babel-plugin-module-resolver/glob/minimatch": ["minimatch@8.0.7", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-V+1uQNdzybxa14e/p00HZnQNNcTjnRJjDxg2V8wtkjFctq4M7hXFws4oekyTP0Jebeq7QYtpFyOeBAjc88zvYg=="], @@ -5614,6 +5518,38 @@ "minipass-pipeline/minipass/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], + "nitro/rolldown/@oxc-project/types": ["@oxc-project/types@0.154.0", "", {}, "sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA=="], + + "nitro/rolldown/@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.14", "", { "os": "android", "cpu": "arm" }, "sha512-aWR+XKH9+rW7m5fWq/5360J3mHycrx/o6xZM2DQFdJnTMdyP7/WzxPjhtLbVWdKo2y612/4U1bWqb3HQhiF7vg=="], + + "nitro/rolldown/@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.14", "", { "os": "android", "cpu": "arm64" }, "sha512-QiVxHofl6A8lQU7WAtOUY4QMVZXohxwz7WJJoeh8NBEUyKfIkMRKhYyq8az/1RypNiIXzNTtiS6KwHz0erxYRQ=="], + + "nitro/rolldown/@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.2.14", "", { "os": "darwin", "cpu": "arm64" }, "sha512-lTQOzHuBIooh3jIr5XINQkjPGEuGy+Dsy0meXDr6Sjty0b99kYgGh4uBC/8mJX1T0kC8d6S0aPP1Y+bHkh6aBw=="], + + "nitro/rolldown/@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.2.14", "", { "os": "darwin", "cpu": "x64" }, "sha512-hyMKEGatjmBYCs/Q4sbIcL/GqpFEqsX3wc+HYVQ/85A4rxc1o7rPm4DUI4GV4k/h0ITddwFSGpqQunI14GXjTA=="], + + "nitro/rolldown/@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.2.14", "", { "os": "freebsd", "cpu": "x64" }, "sha512-u371GbXoVXrEgP20PwzoGNOdAOqAMhzo19JzzY+V4YmmnC+DTOoqdbMu+O+54emM59Mik/UdrtWgcuEDKWRPKA=="], + + "nitro/rolldown/@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.2.14", "", { "os": "linux", "cpu": "arm" }, "sha512-BqwKsdZQf6EqVWr8fv2MrDYzAvOZ7+NYFSJESRGs87fkseEhs0TU9TXgRJTkZoRRkxTizyEg1LKUXfU3/78uqg=="], + + "nitro/rolldown/@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.2.14", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-SD9kY8M009x/7s57Z1dgUVlP5+uYBgKQK0Tkr1WIWngrtUJmRCW1RJFMY7QDla2khXhmg2i5Io7MUjcmZNZ/KQ=="], + + "nitro/rolldown/@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.2.14", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-BJ2CL19M6uuWesMgnqJzgxoI+N+eV7b0A9O9vLV42y+gitC41fNa8KElau1tHVzuLWX5GzEuxMPhAO0tQXQMkg=="], + + "nitro/rolldown/@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.2.14", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-4+Kl8daPV8NDHaD7mfCcc1pRM+Qg7ab8DyMm5FG5WoZgv4h2i3KFN1CybYBNbQqmuYm7ftJLvmMI1eHYJ22S/Q=="], + + "nitro/rolldown/@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.2.14", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-V/h8ePq1fKDrmtFMz6xcCN3DKvuvMRrwwD1q0PkBeeo4DpK64biaKvqWGVxqCeYKqeRk7gE7/iKPxLCn08O97A=="], + + "nitro/rolldown/@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.2.14", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-WxalXzgrLVpKC93xfpaJ3gCXUWzeCr+FRCbDVD2mUAy4L6Vo3lNVz0epUEUpxPWJkLNYUwM4OSIikv36OJ9mLg=="], + + "nitro/rolldown/@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.2.14", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-3G3tnAmTpdk9jO3GQtyHXqeFD2SlecfTws/Y3M2mmj9nMBwwuLT4kur8sZKeu7ENUHSpVO3cIsm5A52LEWWwlg=="], + + "nitro/rolldown/@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.2.14", "", { "os": "none", "cpu": "arm64" }, "sha512-qyr5XiNGxm2ytx17vvtcJ9nXn6v1gENETi503bJx3OGwZ1tSonj7BosxbMa/xeAfSl5iS9X6KjEWYXLu6v1L7Q=="], + + "nitro/rolldown/@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.2.14", "", { "os": "win32", "cpu": "arm64" }, "sha512-oA4o5o0S2yB199YyYXDzKUv1Z56Rc+mgOjwm7Z/vJ9Z8igiDPYvoOuDyo6g7AK/ZaF09nPhDKVnGBcYHO11GXA=="], + + "nitro/rolldown/@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.2.14", "", { "os": "win32", "cpu": "x64" }, "sha512-9mE94bf2GZUaR/fUSXCMpBoWkctu421Mi0ORpm4zqfbkjKep7RxzPFa5etcGs5h+2KApoWBOA/hAJa/7saGgEQ=="], + "node-html-parser/css-select/css-what": ["css-what@6.2.2", "", {}, "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA=="], "openid-client/lru-cache/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], @@ -5700,6 +5636,10 @@ "@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" } }, "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ=="], + "@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw=="], + + "@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.3", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q=="], + "@astrojs/mdx/@astrojs/internal-helpers/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], "@astrojs/solid-js/vite/postcss/nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], @@ -5972,8 +5912,6 @@ "@puppeteer/browsers/yargs/cliui/wrap-ansi": ["wrap-ansi@9.0.2", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww=="], - "@solidjs/start/shiki/@shikijs/engine-javascript/oniguruma-to-es": ["oniguruma-to-es@2.3.0", "", { "dependencies": { "emoji-regex-xs": "^1.0.0", "regex": "^5.1.1", "regex-recursion": "^5.1.1" } }, "sha512-bwALDxriqfKGfUufKGGepCzu9x7nJQuoRoAFp4AnwehhC2crqrDIAP/uN2qdlsAvSMpeRC3+Yzhqc7hLmle5+g=="], - "astro/unstorage/chokidar/readdirp": ["readdirp@5.1.1", "", {}, "sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA=="], "astro/unstorage/h3/cookie-es": ["cookie-es@1.2.3", "", {}, "sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw=="], @@ -6006,10 +5944,12 @@ "yargs/string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], - "@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@emnapi/core/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA=="], - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" } }, "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ=="], + "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw=="], + + "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.3", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q=="], + "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-freebsd-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.2", "", { "dependencies": { "@emnapi/runtime": "^1.11.1" } }, "sha512-Mrv4JQNYVQ94xH+jzZ9r+gowleN8mv2FTgKT+PI6bx5C0G8TdNYndu161pg2i7uoBwxy2ImPMHrJOM2LZef7Bw=="], "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-webcontainers-wasm32/@img/sharp-wasm32": ["@img/sharp-wasm32@0.35.2", "", { "dependencies": { "@emnapi/runtime": "^1.11.1" } }, "sha512-Mrv4JQNYVQ94xH+jzZ9r+gowleN8mv2FTgKT+PI6bx5C0G8TdNYndu161pg2i7uoBwxy2ImPMHrJOM2LZef7Bw=="], @@ -6090,10 +6030,6 @@ "@puppeteer/browsers/yargs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], - "@solidjs/start/shiki/@shikijs/engine-javascript/oniguruma-to-es/regex": ["regex@5.1.1", "", { "dependencies": { "regex-utilities": "^2.3.0" } }, "sha512-dN5I359AVGPnwzJm2jN1k0W9LPZ+ePvoOeVMMfqIMFz53sSwXkxaJoxr50ptnsC771lK95BnTrVSZxq0b9yCGw=="], - - "@solidjs/start/shiki/@shikijs/engine-javascript/oniguruma-to-es/regex-recursion": ["regex-recursion@5.1.1", "", { "dependencies": { "regex": "^5.1.1", "regex-utilities": "^2.3.0" } }, "sha512-ae7SBCbzVNrIjgSbh7wMznPcQel1DNlDtzensnFxpiNpXt1U2ju/bHugH422r+4LAVS1FpW1YCwilmnNsjum9w=="], - "babel-plugin-module-resolver/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], "pkg-up/find-up/locate-path/p-locate/p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="], @@ -6106,8 +6042,6 @@ "temp/rimraf/glob/minimatch/brace-expansion": ["brace-expansion@1.1.21", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw=="], - "@astrojs/starlight/@astrojs/markdown-satteri/satteri/@bruits/satteri-wasm32-wasi/@emnapi/core/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA=="], - "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-freebsd-wasm32/@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], "@cloudflare/vite-plugin/miniflare/sharp/@img/sharp-webcontainers-wasm32/@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], diff --git a/package.json b/package.json index 3fad5414c6a1..01143415ddc5 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "vite": "7.3.7", "@solidjs/meta": "0.29.4", "@solidjs/router": "1.0.0", - "@solidjs/start": "https://pkg.pr.new/@solidjs/start@dfb2020", + "@solidjs/start": "2.1.0", "@sentry/solid": "10.71.0", "@sentry/vite-plugin": "5.4.0", "solid-js": "1.9.17", diff --git a/packages/console/app/package.json b/packages/console/app/package.json index 60f436f8d5ec..627367f8737d 100644 --- a/packages/console/app/package.json +++ b/packages/console/app/package.json @@ -22,10 +22,10 @@ "@solidjs/router": "catalog:", "@solidjs/start": "catalog:", "aws4fetch": "1.0.20", - "nitro": "3.0.1-alpha.1", + "nitro": "3.0.260903-beta", "number-flow": "0.6.2", "solid-js": "catalog:", - "vite": "catalog:", + "vite": "8.2.4", "zod": "catalog:" }, "devDependencies": { @@ -36,6 +36,6 @@ "wrangler": "4.50.0" }, "engines": { - "node": ">=22" + "node": ">=24" } } diff --git a/packages/console/app/src/global.d.ts b/packages/console/app/src/global.d.ts index b34e132b6338..dc6f10c226c0 100644 --- a/packages/console/app/src/global.d.ts +++ b/packages/console/app/src/global.d.ts @@ -1,7 +1 @@ /// - -import "@solidjs/start" - -export declare module "@solidjs/start/server" { - export type APIEvent = { request: Request } -} diff --git a/packages/console/app/src/routes/download/[channel]/[platform].ts b/packages/console/app/src/routes/download/[channel]/[platform].ts index c0c1d62f0189..2f468ae3be44 100644 --- a/packages/console/app/src/routes/download/[channel]/[platform].ts +++ b/packages/console/app/src/routes/download/[channel]/[platform].ts @@ -1,4 +1,4 @@ -import type { APIEvent } from "@solidjs/start" +import type { APIEvent } from "@solidjs/start/server" import type { DownloadPlatform } from "../types" const prodAssetNames: Record = { diff --git a/packages/console/app/vite.config.ts b/packages/console/app/vite.config.ts index 33455acc5edb..98cd38487ba7 100644 --- a/packages/console/app/vite.config.ts +++ b/packages/console/app/vite.config.ts @@ -15,6 +15,11 @@ export default defineConfig({ }, }), ], + environments: { + // Nitro copies public/ with fs.cp, which keeps the symlinks into packages/ui as links. + // Letting Vite copy it first writes real files. + client: { build: { copyPublicDir: true } }, + }, server: { allowedHosts: true, port: 3001, diff --git a/packages/stats/app/package.json b/packages/stats/app/package.json index 58e626040adc..44c4da5b85ed 100644 --- a/packages/stats/app/package.json +++ b/packages/stats/app/package.json @@ -24,10 +24,10 @@ "d3-scale": "4.0.2", "effect": "catalog:", "i18n-iso-countries": "7.14.0", - "nitro": "3.0.1-alpha.1", + "nitro": "3.0.260903-beta", "solid-js": "catalog:", "sst": "catalog:", - "vite": "catalog:" + "vite": "8.2.4" }, "devDependencies": { "@types/bun": "catalog:", @@ -36,6 +36,6 @@ "typescript": "catalog:" }, "engines": { - "node": ">=22" + "node": ">=24" } } diff --git a/packages/stats/app/src/entry-server.tsx b/packages/stats/app/src/entry-server.tsx index c5a90384a767..89751db37193 100644 --- a/packages/stats/app/src/entry-server.tsx +++ b/packages/stats/app/src/entry-server.tsx @@ -1,6 +1,5 @@ // @refresh reload -import type { Asset, PageEvent } from "@solidjs/start" -import { createHandler, StartServer } from "@solidjs/start/server" +import { createHandler, StartServer, type Asset, type PageEvent } from "@solidjs/start/server" import ibmPlexMonoMediumLatin1 from "@ibm/plex/IBM-Plex-Mono/fonts/split/woff2/IBMPlexMono-Medium-Latin1.woff2?url" import { getRequestEvent } from "solid-js/web" import { dir, localeFromRequest, tag } from "./lib/language" From d09e2c6c8da8237647cc746cb00dbf804fa44fb5 Mon Sep 17 00:00:00 2001 From: usrnk1 <7547651+usrnk1@users.noreply.github.com> Date: Thu, 29 Oct 2026 21:48:54 +0100 Subject: [PATCH 05/83] feat(app): add question notifications and sounds (#60358) Co-authored-by: Sayuri Nekomiya --- packages/app/e2e/regression/settings.spec.ts | 142 +++++++++++++ packages/app/e2e/utils/notifications.ts | 53 +++++ packages/app/src/runtime/i18n/en.ts | 6 + .../app/src/settings/general/controllers.ts | 6 + packages/app/src/settings/model.test.ts | 6 +- packages/app/src/settings/model.tsx | 19 +- .../settings/notifications/notifications.tsx | 23 ++- packages/app/src/settings/search-catalog.ts | 16 ++ .../src/shell/notifications/notification.tsx | 74 ++++++- .../server-notification-state.test.ts | 192 +++++++++++++++++- 10 files changed, 523 insertions(+), 14 deletions(-) create mode 100644 packages/app/e2e/utils/notifications.ts diff --git a/packages/app/e2e/regression/settings.spec.ts b/packages/app/e2e/regression/settings.spec.ts index 133c22f45b9b..34fd63e03002 100644 --- a/packages/app/e2e/regression/settings.spec.ts +++ b/packages/app/e2e/regression/settings.spec.ts @@ -3,6 +3,8 @@ import type { ConfigEntry, OpenCodeEvent, SessionMessageInfo, WorktreeDirectory import { NO_PROVIDER, REMOTE_SERVER, SERVER, holdRoute, project, seed, session } from "../utils/app" import { mockMissingLocation, mockOpenCodeServer } from "../utils/mock-server" import { mockRemoteServer, mockWorkspace, openSession, openSettings, type WorkspaceInput } from "../utils/workspace" +import { recordNotifications } from "../utils/notifications" +import { installSseTransport } from "../utils/sse-transport" const directory = "C:/Projects/settings-demo" @@ -94,6 +96,146 @@ test("a settings page survives refresh", async ({ page }) => { await expect(page).toHaveURL("/settings?tab=appearance") }) +test("Questions settings default independently of old Permissions settings and survive reload", async ({ page }) => { + const { settings } = await open(page, { + seed: { + settings: { + notifications: { agent: false, permissions: false, errors: true }, + sounds: { permissionsEnabled: false, permissions: "alert-05" }, + }, + }, + }) + + await settings.getByRole("tab", { name: "Notifications", exact: true }).click() + await expect(settings.locator('[data-slot="settings-row-title"]')).toHaveText([ + "Agent", + "Permissions", + "Questions", + "Errors", + "Agent", + "Permissions", + "Questions", + "Errors", + "Interface", + ]) + const questions = settings.getByRole("switch", { name: "Questions", exact: true }) + + const permissions = settings.locator('[data-action="settings-notifications-permissions"]').getByRole("switch") + + const questionSound = settings.locator('[data-action="settings-sounds-questions"]') + + const permissionSound = settings.locator('[data-action="settings-sounds-permissions"]') + + await expect(questions).toBeChecked() + await expect(permissions).not.toBeChecked() + await expect(questionSound).toHaveText("Staplebops 02") + await expect(permissionSound).toHaveText("None") + await questions.locator("..").locator('[data-slot="switch-control"]').click() + await expect(questions).not.toBeChecked() + await questionSound.click() + await page.getByRole("option", { name: "Alert 02", exact: true }).click() + await expect(questionSound).toHaveText("Alert 02") + + await page.reload() + await expect(questions).not.toBeChecked() + await expect(questionSound).toHaveText("Alert 02") + await expect(permissions).not.toBeChecked() + await expect(permissionSound).toHaveText("None") + await questions.locator("..").locator('[data-slot="switch-control"]').click() + await questionSound.click() + await page.getByRole("option", { name: "None", exact: true }).click() + await expect(questions).toBeChecked() + await expect(questionSound).toHaveText("None") + await settings.getByRole("combobox", { name: "Search", exact: true }).fill("Questions") + await expect(settings.locator('[data-setting-target="settings-notifications-questions"]')).toBeVisible() + await expect(settings.locator('[data-setting-target="settings-sounds-questions"]')).toBeVisible() +}) + +test("request events use real Questions settings without disabling Permissions alerts", async ({ page }) => { + const recorded = await recordNotifications(page) + + const transport = await installSseTransport(page, { server: SERVER }) + + const workspace = await openSession(page, { + name: "Request notifications", + seed: { settings: { sounds: { agentEnabled: false, permissions: "alert-01", questions: "alert-02" } } }, + }) + + await transport.waitForConnection() + await page.getByRole("button", { name: "Home", exact: true }).click() + await page.getByRole("button", { name: "Settings", exact: true }).click() + const settings = page.getByTestId("settings-screen") + + await settings.getByRole("tab", { name: "Notifications", exact: true }).click() + const questions = settings.getByRole("switch", { name: "Questions", exact: true }) + + await expect(questions).toBeChecked() + + const event = ( + kind: "question" | "mcp-elicitation" | "websearch.provider" | "permission", + index: number, + ): OpenCodeEvent => ({ + id: `evt_request_${index}`, + created: 1700000001000 + index, + location: { directory: workspace.directory }, + ...(kind === "permission" + ? { + type: "permission.asked" as const, + data: { + id: `per_request_${index}`, + sessionID: workspace.session.id, + action: "shell", + resources: ["echo hello"], + metadata: {}, + }, + } + : { + type: "form.created" as const, + data: { + form: { + id: `frm_request_${index}`, + sessionID: workspace.session.id, + title: "Input", + metadata: { kind }, + fields: [{ key: "answer", type: "string" as const, title: "Continue?" }], + }, + }, + }), + }) + + await transport.send(event("question", 1)) + await expect + .poll(() => recorded.notifications) + .toEqual([{ title: "Question requires an answer", body: "Request notifications" }]) + await expect.poll(() => recorded.sounds).toEqual([expect.stringContaining("alert-02")]) + + // Choosing None leaves system notifications enabled; the next input request proves the settings reach delivery. + await settings.locator('[data-action="settings-sounds-questions"]').click() + await page.getByRole("option", { name: "None", exact: true }).click() + await expect(settings.locator('[data-action="settings-sounds-questions"]')).toHaveText("None") + const previews = recorded.sounds.slice() + + await transport.send(event("mcp-elicitation", 2)) + await expect + .poll(() => recorded.notifications.map((item) => item.title)) + .toEqual(["Question requires an answer", "Input requested"]) + + await questions.locator("..").locator('[data-slot="switch-control"]').click() + await expect(questions).not.toBeChecked() + await transport.send(event("question", 3)) + await transport.send(event("permission", 4)) + await expect + .poll(() => recorded.notifications.map((item) => item.title)) + .toEqual(["Question requires an answer", "Input requested", "Permission required"]) + await transport.send(event("websearch.provider", 5)) + await expect + .poll(() => recorded.notifications.map((item) => item.title)) + .toEqual(["Question requires an answer", "Input requested", "Permission required", "Permission required"]) + await expect + .poll(() => recorded.sounds) + .toEqual([...previews, expect.stringContaining("alert-01"), expect.stringContaining("alert-01")]) +}) + for (const locale of ["en", "ar"]) { test(`background activity alignment stays physical and persists (${locale})`, async ({ page }) => { const id = "ses_activity_settings" diff --git a/packages/app/e2e/utils/notifications.ts b/packages/app/e2e/utils/notifications.ts new file mode 100644 index 000000000000..dc573bbe5395 --- /dev/null +++ b/packages/app/e2e/utils/notifications.ts @@ -0,0 +1,53 @@ +import type { Page } from "@playwright/test" + +// Only browser APIs are replaced: settings, event delivery, request stores and the coordinator stay real. +export async function recordNotifications(page: Page) { + const notifications: { title: string; body?: string }[] = [] + + const sounds: string[] = [] + + await page.exposeBinding("recordNotification", (_source, notification: { title: string; body?: string }) => { + notifications.push(notification) + }) + await page.exposeBinding("recordNotificationSound", (_source, src: string) => { + sounds.push(src) + }) + await page.addInitScript(() => { + // SAFETY: exposeBinding above installs these callbacks before the app starts. + const host: Window & { + recordNotification?: (notification: { title: string; body?: string }) => Promise + recordNotificationSound?: (src: string) => Promise + } = window + + // Simulate an unfocused app without changing the user's live desktop window. + document.hasFocus = () => false + Object.defineProperty(window, "Notification", { + value: class extends EventTarget { + static permission = "granted" + onclick: (() => void) | null = null + + constructor(title: string, options?: NotificationOptions) { + super() + void host.recordNotification!({ title, body: options?.body }) + } + + close() {} + }, + }) + Object.defineProperty(window, "Audio", { + value: class { + currentTime = 0 + + constructor(readonly src: string) {} + + play() { + return host.recordNotificationSound!(this.src) + } + + pause() {} + }, + }) + }) + + return { notifications, sounds } +} diff --git a/packages/app/src/runtime/i18n/en.ts b/packages/app/src/runtime/i18n/en.ts index 2015d1d75e48..aa2b8c7b68fb 100644 --- a/packages/app/src/runtime/i18n/en.ts +++ b/packages/app/src/runtime/i18n/en.ts @@ -550,6 +550,8 @@ export const dict = { "error.chain.configInvalidWithMessage": "Config file at {{path}} is invalid: {{message}}", "notification.permission.title": "Permission required", + "notification.question.title": "Question requires an answer", + "notification.elicitation.title": "Input requested", "notification.session.responseReady.title": "Response ready", "notification.session.error.title": "Session error", @@ -1055,6 +1057,8 @@ export const dict = { "Show system notification when the agent is complete or needs attention", "settings.general.notifications.permissions.title": "Permissions", "settings.general.notifications.permissions.description": "Show system notification when a permission is required", + "settings.general.notifications.questions.title": "Questions", + "settings.general.notifications.questions.description": "Show system notification when the agent asks a question", "settings.general.notifications.errors.title": "Errors", "settings.general.notifications.errors.description": "Show system notification when an error occurs", @@ -1062,6 +1066,8 @@ export const dict = { "settings.general.sounds.agent.description": "Play sound when the agent is complete or needs attention", "settings.general.sounds.permissions.title": "Permissions", "settings.general.sounds.permissions.description": "Play sound when a permission is required", + "settings.general.sounds.questions.title": "Questions", + "settings.general.sounds.questions.description": "Play sound when the agent asks a question", "settings.general.sounds.errors.title": "Errors", "settings.general.sounds.errors.description": "Play sound when an error occurs", "settings.general.sounds.interface.title": "Interface", diff --git a/packages/app/src/settings/general/controllers.ts b/packages/app/src/settings/general/controllers.ts index ccc0cd0960fa..6a27226f47bf 100644 --- a/packages/app/src/settings/general/controllers.ts +++ b/packages/app/src/settings/general/controllers.ts @@ -177,6 +177,12 @@ export function createSoundSettingsController() { (value) => settings.sounds.setPermissionsEnabled(value), (id) => settings.sounds.setPermissions(id), ), + questions: channel( + settings.sounds.questionsEnabled, + settings.sounds.questions, + (value) => settings.sounds.setQuestionsEnabled(value), + (id) => settings.sounds.setQuestions(id), + ), errors: channel( settings.sounds.errorsEnabled, settings.sounds.errors, diff --git a/packages/app/src/settings/model.test.ts b/packages/app/src/settings/model.test.ts index e1041cdbf790..4b20957e64de 100644 --- a/packages/app/src/settings/model.test.ts +++ b/packages/app/src/settings/model.test.ts @@ -112,12 +112,14 @@ describe("settings schema", () => { keybinds: {}, permissions: { autoApprove: false, autoApproveProjects: {} }, workspaces: { defaultDestination: "last-used", lastUsed: {} }, - notifications: { agent: false, permissions: true, errors: false }, + notifications: { agent: false, permissions: true, questions: true, errors: false }, sounds: { agentEnabled: true, agent: "staplebops-01", permissionsEnabled: true, permissions: "staplebops-02", + questionsEnabled: true, + questions: "staplebops-02", errorsEnabled: true, errors: "nope-03", interfaceEnabled: true, @@ -165,7 +167,7 @@ describe("settings schema", () => { expect(settings.permissions).toEqual({ autoApprove: true, autoApproveProjects: { on: true, off: false } }) expect(settings.workspaces).toEqual({ defaultDestination: "new", lastUsed: { good: "workspace" } }) expect(settings.keybinds).toEqual({ good: "ctrl+k" }) - expect(settings.notifications).toEqual({ agent: false, permissions: true, errors: true }) + expect(settings.notifications).toEqual({ agent: false, permissions: true, questions: true, errors: true }) expect(settings.sounds).toMatchObject({ agent: "custom", agentEnabled: false, permissions: "staplebops-02" }) expect(decode(encode(settings))).toEqual(settings) }) diff --git a/packages/app/src/settings/model.tsx b/packages/app/src/settings/model.tsx index eaac96dbdd64..f0de194b8507 100644 --- a/packages/app/src/settings/model.tsx +++ b/packages/app/src/settings/model.tsx @@ -169,6 +169,7 @@ const workspacesSchema = Persistence.struct({ const notificationsSchema = Persistence.struct({ agent: Schema.Boolean, permissions: Schema.Boolean, + questions: Schema.Boolean, errors: Schema.Boolean, }) @@ -177,6 +178,8 @@ const soundsSchema = Persistence.struct({ agent: Schema.String, permissionsEnabled: Schema.Boolean, permissions: Schema.String, + questionsEnabled: Schema.Boolean, + questions: Schema.String, errorsEnabled: Schema.Boolean, errors: Schema.String, interfaceEnabled: Schema.optional(Schema.Boolean), @@ -310,12 +313,14 @@ export const defaultSettings: Settings = { keybinds: {}, permissions: { autoApprove: false, autoApproveProjects: {} }, workspaces: { defaultDestination: "last-used", lastUsed: {} }, - notifications: { agent: false, permissions: true, errors: false }, + notifications: { agent: false, permissions: true, questions: true, errors: false }, sounds: { agentEnabled: true, agent: "staplebops-01", permissionsEnabled: true, permissions: "staplebops-02", + questionsEnabled: true, + questions: "staplebops-02", errorsEnabled: true, errors: "nope-03", interfaceEnabled: true, @@ -540,6 +545,10 @@ export const { use: useSettings, provider: SettingsProvider } = createSimpleCont setPermissions(value: boolean) { setStore("notifications", "permissions", value) }, + questions: withFallback(() => store.notifications?.questions, defaultSettings.notifications.questions), + setQuestions(value: boolean) { + setStore("notifications", "questions", value) + }, errors: withFallback(() => store.notifications?.errors, defaultSettings.notifications.errors), setErrors(value: boolean) { setStore("notifications", "errors", value) @@ -565,6 +574,14 @@ export const { use: useSettings, provider: SettingsProvider } = createSimpleCont setPermissions(value: string) { setStore("sounds", "permissions", value) }, + questionsEnabled: withFallback(() => store.sounds?.questionsEnabled, defaultSettings.sounds.questionsEnabled), + setQuestionsEnabled(value: boolean) { + setStore("sounds", "questionsEnabled", value) + }, + questions: withFallback(() => store.sounds?.questions, defaultSettings.sounds.questions), + setQuestions(value: string) { + setStore("sounds", "questions", value) + }, errorsEnabled: withFallback(() => store.sounds?.errorsEnabled, defaultSettings.sounds.errorsEnabled), setErrorsEnabled(value: boolean) { setStore("sounds", "errorsEnabled", value) diff --git a/packages/app/src/settings/notifications/notifications.tsx b/packages/app/src/settings/notifications/notifications.tsx index 66ef8a6a6d33..e0a658bae6bf 100644 --- a/packages/app/src/settings/notifications/notifications.tsx +++ b/packages/app/src/settings/notifications/notifications.tsx @@ -23,6 +23,11 @@ const soundSettings = { title: "settings.general.sounds.permissions.title", description: "settings.general.sounds.permissions.description", }, + questions: { + action: "settings-sounds-questions", + title: "settings.general.sounds.questions.title", + description: "settings.general.sounds.questions.description", + }, errors: { action: "settings-sounds-errors", title: "settings.general.sounds.errors.title", @@ -31,7 +36,7 @@ const soundSettings = { } as const const SoundSetting: Component<{ - kind: "agent" | "permissions" | "errors" + kind: "agent" | "permissions" | "questions" | "errors" channel: SoundSettingsController["agent"] }> = (props) => { const language = useLanguage() @@ -100,6 +105,21 @@ export const SettingsNotifications: Component = () => { + +
+ settings.notifications.setQuestions(checked)} + > + {language.t("settings.general.notifications.questions.title")} + +
+
+ { + [] = [ description: "settings.general.notifications.permissions.description", keywords: "desktop notifications permissions", }, + { + tab: "notifications", + label: "settings.general.notifications.questions.title", + target: "settings-notifications-questions", + section: "settings.general.section.notifications", + description: "settings.general.notifications.questions.description", + keywords: "desktop notifications questions mcp elicitation input", + }, { tab: "notifications", label: "settings.general.notifications.errors.title", @@ -196,6 +204,14 @@ export const clientSettings: Entry[] = [ description: "settings.general.sounds.permissions.description", keywords: "sound audio permissions", }, + { + tab: "notifications", + label: "settings.general.sounds.questions.title", + target: "settings-sounds-questions", + section: "settings.general.section.sounds", + description: "settings.general.sounds.questions.description", + keywords: "sound audio questions mcp elicitation input", + }, { tab: "notifications", label: "settings.general.sounds.errors.title", diff --git a/packages/app/src/shell/notifications/notification.tsx b/packages/app/src/shell/notifications/notification.tsx index 78a4f3e6829f..080745cb4784 100644 --- a/packages/app/src/shell/notifications/notification.tsx +++ b/packages/app/src/shell/notifications/notification.tsx @@ -6,7 +6,7 @@ import type { ServerSDK } from "@/runtime/server/client" import type { Data } from "@opencode/client/solid" import { usePlatform } from "@/runtime/platform/platform" import { useLanguage } from "@/runtime/i18n/language" -import { useSettings } from "@/settings/model" +import { projectSettingsKey, useSettings } from "@/settings/model" import { Persist, persisted, removePersisted } from "@/runtime/persistence/storage" import { Persistence } from "@/runtime/persistence/schema" import { playSoundById } from "@/shell/notifications/sound" @@ -17,6 +17,13 @@ import { useServer } from "@/runtime/server/current" type NotificationTabs = Pick, "addSessionTab" | "rememberSessionRoute" | "select"> +const requestTitles = { + permission: "notification.permission.title", + question: "notification.question.title", + "mcp-elicitation": "notification.elicitation.title", + "websearch.provider": "notification.permission.title", +} as const + export function openNotificationSession(tabs: NotificationTabs, server: ServerConnection.Key, sessionID: string) { const tab = tabs.addSessionTab({ server, sessionId: sessionID }) @@ -280,7 +287,72 @@ export function createServerNotificationState(input: { }) } + const handleRequest = async ( + kind: "permission" | "question" | "mcp-elicitation" | "websearch.provider", + sessionID: string, + requestID: string, + ) => { + const session = await lookup(sessionID) + + if (!session || disposed.value) return + + const target = sessionIDHasOpenTab(tabs.store, input.key, sessionID) + ? sessionID + : input.data.session.root(sessionID) + + if (!sessionIDHasOpenTab(tabs.store, input.key, target)) return + + const category = kind === "question" || kind === "mcp-elicitation" ? "questions" : "permissions" + + const pending = () => { + if (disposed.value) return false + + if (kind !== "permission") return input.data.session.form.list(sessionID)?.some((form) => form.id === requestID) + + if (settings.permissions.autoApproves(projectSettingsKey(input.sdk.scope, session.projectID))) return false + + return input.data.session.permission.list(sessionID)?.some((request) => request.id === requestID) + } + + const key = `${input.key}\0${kind}:${requestID}` + + const soundEnabled = + category === "questions" ? settings.sounds.questionsEnabled : settings.sounds.permissionsEnabled + + if (soundEnabled() && pending()) { + void input.coordinator.sound(key, () => { + if (pending()) return playSoundById(settings.sounds[category]()) + }) + } + + if (!settings.notifications[category]() || !pending()) return + + void input.coordinator.system(key, () => { + if (!pending()) return + + return platform.notify(language.t(requestTitles[kind]), session.title ?? sessionID, () => + openNotificationSession(tabs, input.key, target), + ) + }) + } + const unsub = input.sdk.event.listen((event) => { + if (event.type === "permission.asked") { + void handleRequest("permission", event.data.sessionID, event.data.id) + + return + } + + if (event.type === "form.created") { + const kind = event.data.form.metadata?.kind + + if (kind === "question" || kind === "mcp-elicitation" || kind === "websearch.provider") { + void handleRequest(kind, event.data.form.sessionID, event.data.form.id) + } + + return + } + if (event.type === "session.execution.failed") { handleSessionError(event.data.sessionID, event.id) diff --git a/packages/app/test-browser/server-notification-state.test.ts b/packages/app/test-browser/server-notification-state.test.ts index b5e56229c418..2d941f233a67 100644 --- a/packages/app/test-browser/server-notification-state.test.ts +++ b/packages/app/test-browser/server-notification-state.test.ts @@ -1,10 +1,13 @@ -import { beforeAll, expect, mock, setSystemTime, test, vi } from "bun:test" +import { beforeAll, beforeEach, expect, mock, setSystemTime, test, vi } from "bun:test" import { createEffect, createRoot } from "solid-js" import { createStore } from "solid-js/store" import type { OpenCodeEvent } from "@opencode/client/promise" import type { ServerConnection } from "@/runtime/server/registry" import { ServerScope } from "@/runtime/server/scope" import type { Tab } from "@/shell/tabs/tabs" +import type { createNotificationCoordinator } from "@/shell/notifications/coordinator" + +type NotificationDelivery = Parameters["system"]>[1] // SAFETY: this is the key format `ServerConnection.key` produces for a local server. const server = "local\nhttp://localhost:4096" as ServerConnection.Key @@ -13,10 +16,35 @@ const session = { id: "session-1", title: "Test session", location: { directory: const alerts: string[] = [] -const tabs = { store: new Array() } +const sounds: string[] = [] + +const clicks: Array<() => void> = [] + +const selected: string[] = [] + +const tabs = { + store: new Array(), + addSessionTab: (input: { server: ServerConnection.Key; sessionId: string }) => ({ + type: "session" as const, + ...input, + }), + rememberSessionRoute: () => {}, + select: (tab: Tab) => { + if (tab.type === "session") selected.push(tab.sessionId) + }, +} let createServerNotificationState: typeof import("@/shell/notifications/notification").createServerNotificationState +const preferences = { + autoApprove: false, + agent: true, + permissions: true, + questions: true, + permissionsSound: true, + questionsSound: true, +} + // Each test fakes only the parts of the SDK, data store and coordinator that the notification state reads. const createState = (input: { sdk: object; data: object; coordinator: object }) => // SAFETY: the fakes cover every member the notification state reaches in that test. @@ -36,26 +64,172 @@ beforeAll(async () => { ...real.platform, usePlatform: () => ({ platform: "web", - notify: async (title: string) => { + notify: async (title: string, _description?: string, onClick?: () => void) => { alerts.push(title) + + if (onClick) clicks.push(onClick) }, }), })) + mock.module("@/runtime/i18n/language", () => ({ + ...real.language, + useLanguage: () => ({ t: (key: string) => key }), + })) mock.module("@/settings/model", () => ({ ...real.settings, useSettings: () => ({ - sounds: { agentEnabled: () => false, errorsEnabled: () => false }, - notifications: { agent: () => true, errors: () => true }, + sounds: { + agentEnabled: () => false, + errorsEnabled: () => false, + permissionsEnabled: () => preferences.permissionsSound, + permissions: () => "alert-01", + questionsEnabled: () => preferences.questionsSound, + questions: () => "alert-02", + }, + notifications: { + agent: () => preferences.agent, + errors: () => true, + permissions: () => preferences.permissions, + questions: () => preferences.questions, + }, + permissions: { autoApproves: () => preferences.autoApprove }, }), })) - mock.module("@/runtime/i18n/language", () => ({ - ...real.language, - useLanguage: () => ({ t: (key: string) => key }), - })) mock.module("@/shell/tabs/tabs", () => ({ ...real.tabs, useTabs: () => tabs })) + mock.module("@/shell/notifications/sound", () => ({ + playSoundById: async (id: string) => { + sounds.push(id) + }, + })) createServerNotificationState = (await import("@/shell/notifications/notification")).createServerNotificationState }) +beforeEach(() => { + alerts.length = 0 + sounds.length = 0 + clicks.length = 0 + selected.length = 0 + Object.assign(preferences, { + autoApprove: false, + agent: true, + permissions: true, + questions: true, + permissionsSound: true, + questionsSound: true, + }) +}) + +const requests = [ + { kind: "permission", category: "permissions", title: "notification.permission.title" }, + { kind: "question", category: "questions", title: "notification.question.title" }, + { kind: "mcp-elicitation", category: "questions", title: "notification.elicitation.title" }, + { kind: "websearch.provider", category: "permissions", title: "notification.permission.title" }, +] as const + +test.each( + requests.flatMap((request) => + [ + "enabled", + "other category disabled", + "notifications disabled", + "sound disabled", + "resolved", + "auto approve", + "root tab", + "no tab", + "disposed", + ].map((scenario) => ({ ...request, scenario })), + ), +)("request alerts: $kind / $scenario", async (options) => { + preferences.agent = false + preferences.autoApprove = options.scenario === "auto approve" + preferences[options.category] = options.scenario !== "notifications disabled" + preferences[options.category === "questions" ? "questionsSound" : "permissionsSound"] = + options.scenario !== "sound disabled" + + if (options.scenario === "other category disabled") { + preferences[options.category === "questions" ? "permissions" : "questions"] = false + preferences[options.category === "questions" ? "permissionsSound" : "questionsSound"] = false + } + + tabs.store = + options.scenario === "no tab" + ? [] + : [{ type: "session", server, sessionId: options.scenario === "root tab" ? "root" : session.id }] + const listeners = new Array<(event: OpenCodeEvent) => void>() + + const deliveries = new Array() + + const pending = { value: true } + + const dispose = createRoot((dispose) => { + createState({ + sdk: { + scope: ServerScope.local, + event: { + listen: (listener: (event: OpenCodeEvent) => void) => { + listeners.push(listener) + + return () => {} + }, + }, + }, + data: { + session: { + get: () => ({ ...session, parentID: "root", projectID: "project-1" }), + root: () => "root", + permission: { list: () => (pending.value ? [{ id: "request-1" }] : []) }, + form: { list: () => (pending.value ? [{ id: "request-1" }] : []) }, + }, + }, + coordinator: { + sound: async (_key: string, run: NotificationDelivery) => { + deliveries.push(run) + }, + system: async (_key: string, run: NotificationDelivery) => { + deliveries.push(run) + }, + }, + }) + + return dispose + }) + + try { + listeners.forEach((listener) => + // SAFETY: only the request identity, session and form kind are read by the handler. + listener({ + type: options.kind === "permission" ? "permission.asked" : "form.created", + data: + options.kind === "permission" + ? { sessionID: session.id, id: "request-1" } + : { form: { sessionID: session.id, id: "request-1", metadata: { kind: options.kind } } }, + } as never), + ) + await Promise.resolve() + + if (options.scenario === "resolved") pending.value = false + + if (options.scenario === "disposed") dispose() + await Promise.all(deliveries.map((run) => run())) + + const suppressed = + ["resolved", "disposed", "no tab"].includes(options.scenario) || + (options.scenario === "auto approve" && options.kind === "permission") + + expect(alerts).toEqual(!suppressed && options.scenario !== "notifications disabled" ? [options.title] : []) + expect(sounds).toEqual( + !suppressed && options.scenario !== "sound disabled" + ? [options.category === "questions" ? "alert-02" : "alert-01"] + : [], + ) + clicks.forEach((click) => click()) + expect(selected).toEqual(alerts.length ? [options.scenario === "root tab" ? "root" : session.id] : []) + } finally { + dispose() + } +}) + test.each([ ["session.execution.succeeded", "notification.session.responseReady.title"], ["session.execution.failed", "notification.session.error.title"], From 06bf854d0cbf609a1692b4a894fa04966d960c4a Mon Sep 17 00:00:00 2001 From: James Long Date: Thu, 29 Oct 2026 16:55:30 -0400 Subject: [PATCH 06/83] fix(core): remove a session's terminals when it is deleted (#60322) --- packages/core/src/persistent-pty/index.ts | 35 +++- .../test/fixture/persistent-pty-daemon.ts | 123 ++++++++++++++ .../core/test/persistent-pty-daemon.test.ts | 123 +------------- .../core/test/persistent-pty-session.test.ts | 154 ++++++++++++++++++ 4 files changed, 313 insertions(+), 122 deletions(-) create mode 100644 packages/core/test/fixture/persistent-pty-daemon.ts create mode 100644 packages/core/test/persistent-pty-session.test.ts diff --git a/packages/core/src/persistent-pty/index.ts b/packages/core/src/persistent-pty/index.ts index 90c0014de64a..ed32f155d9db 100644 --- a/packages/core/src/persistent-pty/index.ts +++ b/packages/core/src/persistent-pty/index.ts @@ -2,10 +2,11 @@ export * as PersistentPty from "./index.js" import { stat } from "node:fs/promises" import path from "node:path" -import { Context, Effect, Layer, Schema } from "effect" +import { Context, Effect, Layer, Schema, Stream } from "effect" import { makeGlobalNode } from "@opencode/util/effect/app-node" import { Added, Handoff, PersistentPty, ReadLines, Removed, type ReadResult } from "@opencode/schema/persistent-pty" import { Session } from "@opencode/schema/session" +import { SessionEvent } from "@opencode/schema/session-event" import { Bus } from "../bus.js" import { Pty } from "@opencode/schema/pty" import { Global } from "@opencode/util/global" @@ -338,6 +339,38 @@ const makeLayer = (options: Options = {}) => ) } + const removeSession = (sessionID: Session.ID) => + list(sessionID).pipe( + Effect.flatMap((terminals) => + Effect.forEach( + terminals, + (terminal) => + remove(terminal.id).pipe( + Effect.catchTags({ + "PersistentPty.NotFoundError": () => Effect.void, + "PersistentPty.UnavailableError": (error) => + Effect.logWarning("failed to remove deleted session's terminal", { + sessionID, + id: terminal.id, + error: error.message, + }), + }), + ), + { discard: true }, + ), + ), + Effect.catchTag("PersistentPty.UnavailableError", (error) => + Effect.logWarning("failed to list deleted session's terminals", { sessionID, error: error.message }), + ), + Effect.ensuring(Effect.sync(() => current.delete(sessionID))), + ) + + // Errors are handled per event so one failed cleanup does not end the subscription. + yield* bus.subscribe(SessionEvent.Deleted).pipe( + Stream.runForEach((event) => removeSession(event.data.sessionID)), + Effect.forkScoped({ startImmediately: true }), + ) + const attach = Effect.fn("PersistentPty.attach")(function* ( id: Pty.ID, input: Parameters[1], diff --git a/packages/core/test/fixture/persistent-pty-daemon.ts b/packages/core/test/fixture/persistent-pty-daemon.ts new file mode 100644 index 000000000000..0555dd286995 --- /dev/null +++ b/packages/core/test/fixture/persistent-pty-daemon.ts @@ -0,0 +1,123 @@ +import { mkdtemp, rm, writeFile } from "node:fs/promises" +import net from "node:net" +import os from "node:os" +import path from "node:path" +import { Effect } from "effect" + +export const pong = { type: "pong", instance_id: "test", pid: process.pid, protocol: 7 } + +export function temporaryDirectory() { + return Effect.acquireRelease( + Effect.promise(() => mkdtemp(path.join(os.tmpdir(), "opencode-pty-test-"))), + (directory) => Effect.promise(() => rm(directory, { recursive: true, force: true })), + ) +} + +export function listen( + socketPath: string, + handle: (socket: net.Socket, request: Record, token: string) => object | undefined, +) { + return Effect.acquireRelease( + Effect.promise(async () => { + const sockets = new Set() + const server = net.createServer((socket) => { + sockets.add(socket) + socket.once("close", () => sockets.delete(socket)) + void readRequest(socket) + .then((envelope) => { + const response = + envelope.request.op === "own" ? { type: "owned" } : handle(socket, envelope.request, envelope.token) + if (response) socket.write(frame(response)) + }) + .catch(() => socket.destroy()) + }) + await new Promise((resolve, reject) => { + server.once("error", reject) + server.listen(socketPath, resolve) + }) + return { + close: () => { + sockets.forEach((socket) => socket.destroy()) + return close(server) + }, + } + }), + (server) => Effect.promise(server.close), + ) +} + +function readRequest(socket: net.Socket) { + return new Promise((resolve, reject) => { + let pending = Buffer.alloc(0) + const cleanup = () => { + socket.off("data", onData) + socket.off("end", onEnd) + socket.off("error", onError) + } + const onData = (value: Buffer) => { + pending = Buffer.concat([pending, value]) + if (pending.length < 4) return + const length = pending.readUInt32BE(0) + if (pending.length < length + 4) return + cleanup() + resolve(pending.subarray(4, length + 4)) + } + const onEnd = () => { + cleanup() + reject(new Error("connection closed before request")) + } + const onError = (error: Error) => { + cleanup() + reject(error) + } + socket.on("data", onData) + socket.on("end", onEnd) + socket.on("error", onError) + }).then((payload) => { + const envelope: unknown = JSON.parse(payload.toString("utf8")) + if (!isRecord(envelope) || typeof envelope.token !== "string" || !isRecord(envelope.request)) + throw new Error("Invalid test daemon envelope") + return { token: envelope.token, request: envelope.request } + }) +} + +function frame(value: object) { + const payload = Buffer.from(JSON.stringify(value)) + const output = Buffer.allocUnsafe(payload.length + 4) + output.writeUInt32BE(payload.length) + payload.copy(output, 4) + return output +} + +export function writeRegistration(directory: string, socket: string, instance = "test", token = "test") { + return writeFile( + path.join(directory, "service.json"), + JSON.stringify({ instance_id: instance, pid: process.pid, protocol: 7, socket, token }), + ) +} + +export function terminal(id: number, groupID = "ses_test") { + return { + id, + pid: null, + title: "test", + foreground_process: null, + group_id: groupID, + command: ["test"], + cwd: "/tmp", + cols: 80, + rows: 24, + lifecycle: { status: "running" }, + output_head: 0, + output_tail: 0, + } +} + +function close(server: net.Server) { + if (!server.listening) return Promise.resolve() + return new Promise((resolve, reject) => server.close((error) => (error ? reject(error) : resolve()))) +} + +function isRecord(value: unknown): value is Record { + return typeof value === "object" && value !== null && !Array.isArray(value) +} diff --git a/packages/core/test/persistent-pty-daemon.test.ts b/packages/core/test/persistent-pty-daemon.test.ts index 8c0ffc9c7bff..931abbb613ca 100644 --- a/packages/core/test/persistent-pty-daemon.test.ts +++ b/packages/core/test/persistent-pty-daemon.test.ts @@ -1,16 +1,13 @@ import { expect } from "bun:test" import { spawn } from "node:child_process" import { existsSync } from "node:fs" -import { mkdir, mkdtemp, rm, stat, writeFile } from "node:fs/promises" -import net from "node:net" -import os from "node:os" +import { mkdir, stat, writeFile } from "node:fs/promises" import path from "node:path" import { Effect } from "effect" import { makeDaemonTransport } from "../src/persistent-pty/daemon" +import { listen, pong, temporaryDirectory, terminal, writeRegistration } from "./fixture/persistent-pty-daemon" import { it } from "./lib/effect" -const pong = { type: "pong", instance_id: "test", pid: process.pid, protocol: 7 } - it.live("rediscovers a same-protocol daemon after its registration rotates", () => Effect.gen(function* () { const { root, directory } = yield* temporaryRuntime() @@ -248,119 +245,3 @@ function temporaryRuntime() { return { root, directory } }) } - -function temporaryDirectory() { - return Effect.acquireRelease( - Effect.promise(() => mkdtemp(path.join(os.tmpdir(), "opencode-pty-test-"))), - (directory) => Effect.promise(() => rm(directory, { recursive: true, force: true })), - ) -} - -function listen( - socketPath: string, - handle: (socket: net.Socket, request: Record, token: string) => object | undefined, -) { - return Effect.acquireRelease( - Effect.promise(async () => { - const sockets = new Set() - const server = net.createServer((socket) => { - sockets.add(socket) - socket.once("close", () => sockets.delete(socket)) - void readRequest(socket) - .then((envelope) => { - const response = - envelope.request.op === "own" ? { type: "owned" } : handle(socket, envelope.request, envelope.token) - if (response) socket.write(frame(response)) - }) - .catch(() => socket.destroy()) - }) - await new Promise((resolve, reject) => { - server.once("error", reject) - server.listen(socketPath, resolve) - }) - return { - close: () => { - sockets.forEach((socket) => socket.destroy()) - return close(server) - }, - } - }), - (server) => Effect.promise(server.close), - ) -} - -function readRequest(socket: net.Socket) { - return new Promise((resolve, reject) => { - let pending = Buffer.alloc(0) - const cleanup = () => { - socket.off("data", onData) - socket.off("end", onEnd) - socket.off("error", onError) - } - const onData = (value: Buffer) => { - pending = Buffer.concat([pending, value]) - if (pending.length < 4) return - const length = pending.readUInt32BE(0) - if (pending.length < length + 4) return - cleanup() - resolve(pending.subarray(4, length + 4)) - } - const onEnd = () => { - cleanup() - reject(new Error("connection closed before request")) - } - const onError = (error: Error) => { - cleanup() - reject(error) - } - socket.on("data", onData) - socket.on("end", onEnd) - socket.on("error", onError) - }).then((payload) => { - const envelope: unknown = JSON.parse(payload.toString("utf8")) - if (!isRecord(envelope) || typeof envelope.token !== "string" || !isRecord(envelope.request)) - throw new Error("Invalid test daemon envelope") - return { token: envelope.token, request: envelope.request } - }) -} - -function frame(value: object) { - const payload = Buffer.from(JSON.stringify(value)) - const output = Buffer.allocUnsafe(payload.length + 4) - output.writeUInt32BE(payload.length) - payload.copy(output, 4) - return output -} - -function writeRegistration(directory: string, socket: string, instance = "test", token = "test") { - return writeFile( - path.join(directory, "service.json"), - JSON.stringify({ instance_id: instance, pid: process.pid, protocol: 7, socket, token }), - ) -} - -function terminal(id: number) { - return { - id, - pid: null, - title: "test", - foreground_process: null, - group_id: "ses_test", - command: ["test"], - cwd: "/tmp", - cols: 80, - rows: 24, - lifecycle: { status: "running" }, - output_head: 0, - output_tail: 0, - } -} - -function close(server: net.Server) { - if (!server.listening) return Promise.resolve() - return new Promise((resolve, reject) => server.close((error) => (error ? reject(error) : resolve()))) -} - -function isRecord(value: unknown): value is Record { - return typeof value === "object" && value !== null && !Array.isArray(value) -} diff --git a/packages/core/test/persistent-pty-session.test.ts b/packages/core/test/persistent-pty-session.test.ts new file mode 100644 index 000000000000..16a36db7dcaf --- /dev/null +++ b/packages/core/test/persistent-pty-session.test.ts @@ -0,0 +1,154 @@ +import { describe, expect } from "bun:test" +import { mkdir } from "node:fs/promises" +import path from "node:path" +import { Effect, Fiber, Layer, Option, Stream } from "effect" +import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder" +import { LayerNode } from "@opencode/util/effect/layer-node" +import { Database } from "@opencode/core/database/database" +import { Bus } from "@opencode/core/bus" +import { Instance } from "@opencode/core/instance/service" +import { Location } from "@opencode/core/location" +import { PersistentPty } from "@opencode/core/persistent-pty" +import { Project } from "@opencode/core/project" +import { AbsolutePath } from "@opencode/core/schema" +import { Session } from "@opencode/core/session" +import { SessionExecution } from "@opencode/core/session/execution" +import { SessionModelTransport } from "@opencode/core/session/model-transport" +import { SessionProjector } from "@opencode/core/session/projector" +import { SessionStore } from "@opencode/core/session/store" +import { SessionEnvironment } from "@opencode/core/session/environment" +import { LocationServiceMap } from "@opencode/core/location-services" +import { Removed } from "@opencode/schema/persistent-pty" +import { listen, pong, temporaryDirectory, terminal, writeRegistration } from "./fixture/persistent-pty-daemon" +import { it } from "./lib/effect" +import { globalProjectNode } from "./lib/project" +import { offlineModels } from "./fixture/models" +import { tmpdirScoped } from "./fixture/tmpdir" + +const transport = Layer.succeed( + SessionModelTransport.Service, + SessionModelTransport.Service.of({ + bind: () => ({ execute: () => Effect.die("Unexpected WebSocket execution") }), + close: () => Effect.void, + closeAll: Effect.void, + }), +) + +describe("PersistentPty session cleanup", () => { + it.live("removes a deleted session's terminals", () => + Effect.gen(function* () { + const daemon = yield* fakeDaemon() + yield* Effect.gen(function* () { + const session = yield* Session.Service + const pty = yield* PersistentPty.Service + const bus = yield* Bus.Service + const directory = yield* tmpdirScoped() + const location = Location.Ref.make({ directory: AbsolutePath.make(directory.path) }) + const deleted = yield* session.create({ location }) + const kept = yield* session.create({ location }) + const terminal = yield* pty.create(deleted.id, { args: [], cwd: directory.path, title: "deleted", env: {} }) + const other = yield* pty.create(kept.id, { args: [], cwd: directory.path, title: "kept", env: {} }) + const removed = yield* nextRemoved(bus) + + yield* session.remove(deleted.id) + + expect((yield* Fiber.join(removed)).data).toEqual({ sessionID: deleted.id, ptyID: terminal.id }) + expect(yield* pty.list(deleted.id)).toEqual([]) + expect((yield* pty.list()).map((item) => item.id)).toEqual([other.id]) + }).pipe(Effect.provide(layer(daemon))) + }), + ) + + it.live("keeps cleaning up later deletions after a terminal fails to stop", () => + Effect.gen(function* () { + const daemon = yield* fakeDaemon() + yield* Effect.gen(function* () { + const session = yield* Session.Service + const pty = yield* PersistentPty.Service + const bus = yield* Bus.Service + const directory = yield* tmpdirScoped() + const location = Location.Ref.make({ directory: AbsolutePath.make(directory.path) }) + const first = yield* session.create({ location }) + const second = yield* session.create({ location }) + const stuck = yield* pty.create(first.id, { args: [], cwd: directory.path, title: "stuck", env: {} }) + const terminal = yield* pty.create(second.id, { args: [], cwd: directory.path, title: "second", env: {} }) + yield* pty.control(stuck.id, "att", 80, 24) + daemon.failTerminate.add(stuck.id) + const removed = yield* nextRemoved(bus) + + yield* session.remove(first.id) + yield* session.remove(second.id) + + expect((yield* Fiber.join(removed)).data).toEqual({ sessionID: second.id, ptyID: terminal.id }) + expect((yield* pty.list()).map((item) => item.id)).toEqual([stuck.id]) + // The fake daemon rejects read_rows, so a stale selection would fail instead of returning null. + expect(yield* pty.read(first.id)).toBeNull() + }).pipe(Effect.provide(layer(daemon))) + }), + ) +}) + +const nextRemoved = (bus: Bus.Interface) => + bus.subscribe(Removed).pipe(Stream.runHead, Effect.map(Option.getOrThrow), Effect.forkScoped({ startImmediately: true })) + +// An in-process opencode-pty that the layer adopts through a handoff, so no daemon is spawned. +const fakeDaemon = Effect.fn(function* () { + const base = yield* temporaryDirectory() + const root = path.join(base, "root") + const directory = path.join(root, "inherited") + const socket = path.join(base, "daemon.sock") + const terminals: ReturnType[] = [] + const failTerminate = new Set() + let nextID = 1 + yield* listen(socket, (_socket, request) => { + if (request.op === "ping") return pong + if (request.op === "list") return { type: "terminals", terminals } + if (request.op === "create") { + const created = terminal(nextID++, String(request.group_id)) + terminals.push(created) + return { type: "created", terminal: created } + } + if (request.op === "control") return { type: "ok" } + if (request.op === "terminate") { + if (failTerminate.has(`pty_persistent_${request.id}`)) return { type: "error", message: "terminate failed" } + const index = terminals.findIndex((item) => item.id === request.id) + if (index === -1) return { type: "error", message: `terminal not found: ${String(request.id)}` } + terminals.splice(index, 1) + return { type: "ok" } + } + return { type: "error", message: `unexpected request: ${String(request.op)}` } + }) + yield* Effect.promise(async () => { + await mkdir(directory, { recursive: true }) + await writeRegistration(directory, socket) + }) + return { + failTerminate, + options: { + root, + handoff: { directory, instanceID: "test", ticket: "ticket", expiresAt: Date.now() + 60_000 }, + }, + } +}) + +const layer = (daemon: { readonly options: PersistentPty.Options }) => + AppNodeBuilder.build( + LayerNode.group([ + Database.node, + Bus.node, + SessionProjector.node, + SessionStore.node, + SessionEnvironment.node, + Session.node, + Instance.node, + LocationServiceMap.node, + PersistentPty.node, + ]), + [ + Project.node.replace(globalProjectNode), + SessionExecution.node.replace(SessionExecution.noopLayer), + SessionModelTransport.node.replace(transport), + PersistentPty.node.replace(PersistentPty.configured(daemon.options)), + offlineModels, + ], + ) From 33e495a18f2065154a5163aeb97047ca19bdead4 Mon Sep 17 00:00:00 2001 From: usrnk1 <7547651+usrnk1@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:03:14 +0100 Subject: [PATCH 07/83] fix(app): preserve command selection under a stationary pointer (#60368) --- packages/app/component-tests/composer.spec.ts | 34 +++++++++++++++++++ packages/app/src/composer/editor/editor.tsx | 6 ++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/packages/app/component-tests/composer.spec.ts b/packages/app/component-tests/composer.spec.ts index cb2a0c7db6d2..ef5fc0f6ba60 100644 --- a/packages/app/component-tests/composer.spec.ts +++ b/packages/app/component-tests/composer.spec.ts @@ -463,6 +463,40 @@ story("keeps toolbar focus rings whole and keyboard-only", async ({ mount, page await expect(variant).toHaveCSS("outline-style", "none") }) +story("keeps command selection on the keyboard until the pointer moves", async ({ mount, page }) => { + const component = await mount("opencode-composer-flow--slash-suggestions") + + const input = component.getByRole("textbox", { name: "Prompt", exact: true }) + + const menu = component.locator('[data-component="composer-suggestions"]') + + const test = menu.getByRole("button", { name: "/test", exact: true }) + + const review = menu.getByRole("button", { name: "/review", exact: true }) + + await page.evaluate(() => document.fonts.ready.then(() => undefined)) + await expect(test).toHaveAttribute("data-active", "") + + const box = await review.boundingBox() + + if (!box) throw new Error("Missing review command") + + await input.press("Escape") + await expect(menu).toHaveCount(0) + await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2) + await input.fill("/") + await expect(test).toHaveAttribute("data-active", "") + await expect(review).toHaveCSS("background-color", "rgba(0, 0, 0, 0)") + + // Layout changes can deliver pointer events without any actual mouse movement. + await review.dispatchEvent("pointermove", { movementX: 0, movementY: 0 }) + await expect(test).toHaveAttribute("data-active", "") + + await page.mouse.move(box.x + box.width / 2 + 2, box.y + box.height / 2) + await expect(review).toHaveAttribute("data-active", "") + await expect(test).not.toHaveAttribute("data-active") +}) + story("grows suggestions while preserving visible timeline context", async ({ mount }) => { const component = await mount("opencode-composer-flow--constrained-command-suggestions") const boundary = component.locator('[data-slot="composer-suggestion-boundary-story"]') diff --git a/packages/app/src/composer/editor/editor.tsx b/packages/app/src/composer/editor/editor.tsx index 7c7fad0f3771..b9326a8c273a 100644 --- a/packages/app/src/composer/editor/editor.tsx +++ b/packages/app/src/composer/editor/editor.tsx @@ -1323,9 +1323,11 @@ function ComposerEditorPopover(props: { type="button" data-suggestion-id={item.id} data-active={props.activeID === item.id ? "" : undefined} - class="flex h-7 w-full shrink-0 items-center gap-2 rounded-md px-2 py-1 text-start hover:bg-v2-overlay-simple-overlay-hover" + class="flex h-7 w-full shrink-0 items-center gap-2 rounded-md px-2 py-1 text-start" classList={{ "bg-v2-overlay-simple-overlay-hover": props.activeID === item.id }} - onPointerMove={() => props.onActiveChange(item)} + onPointerMove={(event) => { + if (event.movementX || event.movementY) props.onActiveChange(item) + }} onClick={() => props.onSelect(item)} >
From 53ad857b7a8a52cad10517ea36f16ccdfd56d901 Mon Sep 17 00:00:00 2001 From: usrnk1 <7547651+usrnk1@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:03:30 +0100 Subject: [PATCH 08/83] fix(app): preserve simultaneous request notifications (#60378) --- packages/app/e2e/regression/settings.spec.ts | 72 +++++++++---------- packages/app/e2e/utils/notifications.ts | 2 - packages/app/src/settings/model.test.ts | 2 +- packages/app/src/settings/model.tsx | 2 +- .../src/shell/notifications/coordinator.ts | 28 +++++--- .../src/shell/notifications/notification.tsx | 15 ++-- .../server-notification-state.test.ts | 36 +++++++--- 7 files changed, 88 insertions(+), 69 deletions(-) diff --git a/packages/app/e2e/regression/settings.spec.ts b/packages/app/e2e/regression/settings.spec.ts index 34fd63e03002..9c2309b408b6 100644 --- a/packages/app/e2e/regression/settings.spec.ts +++ b/packages/app/e2e/regression/settings.spec.ts @@ -128,7 +128,7 @@ test("Questions settings default independently of old Permissions settings and s await expect(questions).toBeChecked() await expect(permissions).not.toBeChecked() - await expect(questionSound).toHaveText("Staplebops 02") + await expect(questionSound).toHaveText("Staplebops 05") await expect(permissionSound).toHaveText("None") await questions.locator("..").locator('[data-slot="switch-control"]').click() await expect(questions).not.toBeChecked() @@ -174,34 +174,40 @@ test("request events use real Questions settings without disabling Permissions a const event = ( kind: "question" | "mcp-elicitation" | "websearch.provider" | "permission", index: number, - ): OpenCodeEvent => ({ - id: `evt_request_${index}`, - created: 1700000001000 + index, - location: { directory: workspace.directory }, - ...(kind === "permission" - ? { - type: "permission.asked" as const, - data: { - id: `per_request_${index}`, - sessionID: workspace.session.id, - action: "shell", - resources: ["echo hello"], - metadata: {}, - }, - } - : { - type: "form.created" as const, - data: { - form: { - id: `frm_request_${index}`, - sessionID: workspace.session.id, - title: "Input", - metadata: { kind }, - fields: [{ key: "answer", type: "string" as const, title: "Continue?" }], - }, - }, - }), - }) + ): OpenCodeEvent => { + const base = { + id: `evt_request_${index}`, + created: 1700000001000 + index, + location: { directory: workspace.directory }, + } + + if (kind === "permission") + return { + ...base, + type: "permission.asked", + data: { + id: `per_request_${index}`, + sessionID: workspace.session.id, + action: "shell", + resources: ["echo hello"], + metadata: {}, + }, + } + + return { + ...base, + type: "form.created", + data: { + form: { + id: `frm_request_${index}`, + sessionID: workspace.session.id, + title: "Input", + metadata: { kind }, + fields: [{ key: "answer", type: "string", title: "Continue?" }], + }, + }, + } + } await transport.send(event("question", 1)) await expect @@ -209,7 +215,6 @@ test("request events use real Questions settings without disabling Permissions a .toEqual([{ title: "Question requires an answer", body: "Request notifications" }]) await expect.poll(() => recorded.sounds).toEqual([expect.stringContaining("alert-02")]) - // Choosing None leaves system notifications enabled; the next input request proves the settings reach delivery. await settings.locator('[data-action="settings-sounds-questions"]').click() await page.getByRole("option", { name: "None", exact: true }).click() await expect(settings.locator('[data-action="settings-sounds-questions"]')).toHaveText("None") @@ -222,12 +227,7 @@ test("request events use real Questions settings without disabling Permissions a await questions.locator("..").locator('[data-slot="switch-control"]').click() await expect(questions).not.toBeChecked() - await transport.send(event("question", 3)) - await transport.send(event("permission", 4)) - await expect - .poll(() => recorded.notifications.map((item) => item.title)) - .toEqual(["Question requires an answer", "Input requested", "Permission required"]) - await transport.send(event("websearch.provider", 5)) + await transport.burst([event("question", 3), event("permission", 4), event("websearch.provider", 5)]) await expect .poll(() => recorded.notifications.map((item) => item.title)) .toEqual(["Question requires an answer", "Input requested", "Permission required", "Permission required"]) diff --git a/packages/app/e2e/utils/notifications.ts b/packages/app/e2e/utils/notifications.ts index dc573bbe5395..6b6f3cd51a4d 100644 --- a/packages/app/e2e/utils/notifications.ts +++ b/packages/app/e2e/utils/notifications.ts @@ -1,6 +1,5 @@ import type { Page } from "@playwright/test" -// Only browser APIs are replaced: settings, event delivery, request stores and the coordinator stay real. export async function recordNotifications(page: Page) { const notifications: { title: string; body?: string }[] = [] @@ -19,7 +18,6 @@ export async function recordNotifications(page: Page) { recordNotificationSound?: (src: string) => Promise } = window - // Simulate an unfocused app without changing the user's live desktop window. document.hasFocus = () => false Object.defineProperty(window, "Notification", { value: class extends EventTarget { diff --git a/packages/app/src/settings/model.test.ts b/packages/app/src/settings/model.test.ts index 4b20957e64de..2d0899926e88 100644 --- a/packages/app/src/settings/model.test.ts +++ b/packages/app/src/settings/model.test.ts @@ -119,7 +119,7 @@ describe("settings schema", () => { permissionsEnabled: true, permissions: "staplebops-02", questionsEnabled: true, - questions: "staplebops-02", + questions: "staplebops-05", errorsEnabled: true, errors: "nope-03", interfaceEnabled: true, diff --git a/packages/app/src/settings/model.tsx b/packages/app/src/settings/model.tsx index f0de194b8507..5e8f8f164c59 100644 --- a/packages/app/src/settings/model.tsx +++ b/packages/app/src/settings/model.tsx @@ -320,7 +320,7 @@ export const defaultSettings: Settings = { permissionsEnabled: true, permissions: "staplebops-02", questionsEnabled: true, - questions: "staplebops-02", + questions: "staplebops-05", errorsEnabled: true, errors: "nope-03", interfaceEnabled: true, diff --git a/packages/app/src/shell/notifications/coordinator.ts b/packages/app/src/shell/notifications/coordinator.ts index 24e6d42df56b..5449356c0e9d 100644 --- a/packages/app/src/shell/notifications/coordinator.ts +++ b/packages/app/src/shell/notifications/coordinator.ts @@ -1,13 +1,20 @@ import { onCleanup } from "solid-js" +import { Predicate } from "effect" + +type FocusLock = { pending: boolean; release?: VoidFunction } const FOCUS_LOCK = "opencode:notification-focus" +const DELIVERY_LOCK = "opencode:notification-delivery" + const MAX_CLAIMED = 500 export function createNotificationCoordinator() { const locks = typeof navigator === "undefined" ? undefined : navigator.locks + const claimed = new Set() - const focus = { pending: false, release: undefined as (() => void) | undefined } + + const focus: FocusLock = { pending: false } const updateFocus = () => { if (typeof document === "undefined" || !document.hasFocus()) { @@ -47,7 +54,7 @@ export function createNotificationCoordinator() { }) } - const once = async (kind: "sound" | "system", eventID: string, run: () => Promise | void) => { + const once = async (kind: "sound" | "system", eventID: string, run: () => Promise | void) => { const key = `${kind}:${eventID}` const execute = async () => { @@ -60,18 +67,21 @@ export function createNotificationCoordinator() { } return { - sound(eventID: string, run: () => Promise | void) { + sound(eventID: string, run: () => Promise | void) { return once("sound", eventID, run) }, - system(eventID: string, run: () => Promise | void) { + system(eventID: string, run: () => Promise | void) { return once("system", eventID, async () => { if (typeof document !== "undefined" && document.hasFocus()) return if (!locks) return run() - await locks.request(FOCUS_LOCK, { mode: "exclusive", ifAvailable: true }, async (lock) => { - if (!lock) return - await run() - }) + // Another alert holding the focus lock must not look like a focused app window. + await locks.request(DELIVERY_LOCK, () => + locks.request(FOCUS_LOCK, { mode: "exclusive", ifAvailable: true }, async (lock) => { + if (!lock) return + await run() + }), + ) }) }, } @@ -84,7 +94,7 @@ function claim(kind: "sound" | "system", eventID: string, claimed: Set) try { const storageKey = `opencode:notification-${kind}` const value: unknown = JSON.parse(localStorage.getItem(storageKey) ?? "[]") - const events = Array.isArray(value) ? value.filter((item): item is string => typeof item === "string") : [] + const events = Array.isArray(value) ? value.filter(Predicate.isString) : [] if (events.includes(eventID)) { claimed.add(eventID) diff --git a/packages/app/src/shell/notifications/notification.tsx b/packages/app/src/shell/notifications/notification.tsx index 080745cb4784..ecbec3704b8c 100644 --- a/packages/app/src/shell/notifications/notification.tsx +++ b/packages/app/src/shell/notifications/notification.tsx @@ -287,11 +287,7 @@ export function createServerNotificationState(input: { }) } - const handleRequest = async ( - kind: "permission" | "question" | "mcp-elicitation" | "websearch.provider", - sessionID: string, - requestID: string, - ) => { + const handleRequest = async (kind: keyof typeof requestTitles, sessionID: string, requestID: string) => { const session = await lookup(sessionID) if (!session || disposed.value) return @@ -314,18 +310,17 @@ export function createServerNotificationState(input: { return input.data.session.permission.list(sessionID)?.some((request) => request.id === requestID) } - const key = `${input.key}\0${kind}:${requestID}` + if (!pending()) return - const soundEnabled = - category === "questions" ? settings.sounds.questionsEnabled : settings.sounds.permissionsEnabled + const key = `${input.key}\0${kind}:${requestID}` - if (soundEnabled() && pending()) { + if (settings.sounds[`${category}Enabled`]()) { void input.coordinator.sound(key, () => { if (pending()) return playSoundById(settings.sounds[category]()) }) } - if (!settings.notifications[category]() || !pending()) return + if (!settings.notifications[category]()) return void input.coordinator.system(key, () => { if (!pending()) return diff --git a/packages/app/test-browser/server-notification-state.test.ts b/packages/app/test-browser/server-notification-state.test.ts index 2d941f233a67..cbfaf9f180d6 100644 --- a/packages/app/test-browser/server-notification-state.test.ts +++ b/packages/app/test-browser/server-notification-state.test.ts @@ -196,16 +196,32 @@ test.each( }) try { - listeners.forEach((listener) => - // SAFETY: only the request identity, session and form kind are read by the handler. - listener({ - type: options.kind === "permission" ? "permission.asked" : "form.created", - data: - options.kind === "permission" - ? { sessionID: session.id, id: "request-1" } - : { form: { sessionID: session.id, id: "request-1", metadata: { kind: options.kind } } }, - } as never), - ) + const event: OpenCodeEvent = + options.kind === "permission" + ? { + id: "event-1", + created: 0, + location: session.location, + type: "permission.asked", + data: { sessionID: session.id, id: "request-1", action: "shell", resources: [], metadata: {} }, + } + : { + id: "event-1", + created: 0, + location: session.location, + type: "form.created", + data: { + form: { + sessionID: session.id, + id: "request-1", + title: "Input", + fields: [{ key: "answer", type: "string", title: "Continue?" }], + metadata: { kind: options.kind }, + }, + }, + } + + listeners.forEach((listener) => listener(event)) await Promise.resolve() if (options.scenario === "resolved") pending.value = false From 7ed1f96e29210dc6a6814893617824a708da4b2d Mon Sep 17 00:00:00 2001 From: usrnk1 <7547651+usrnk1@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:05:43 +0100 Subject: [PATCH 09/83] feat(app): allow selecting question answer text (#60372) --- .../session-question-dock.spec.ts | 68 ++++++++++++++++++- .../session-question-dock-classic.tsx | 49 +++++++++++-- .../session-question-dock-experimental.tsx | 40 ++++++++--- .../question-prompt-experimental.css | 4 ++ .../src/components/question-prompt.css | 8 ++- 5 files changed, 152 insertions(+), 17 deletions(-) diff --git a/packages/app/component-tests/session-question-dock.spec.ts b/packages/app/component-tests/session-question-dock.spec.ts index f2df5f7cb259..a9bd0538125d 100644 --- a/packages/app/component-tests/session-question-dock.spec.ts +++ b/packages/app/component-tests/session-question-dock.spec.ts @@ -2,6 +2,70 @@ import type { Locator } from "@playwright/test" import type { MotionKnob } from "@opencode/ui/motion-tuning" import { expect, sourceURL, story } from "../../stories/playwright/story" +for (const variant of ["classic", "experimental"] as const) { + story(`${variant} answer cards allow text selection without changing answers`, async ({ mount, page }) => { + await page.addInitScript( + (enabled) => localStorage.setItem("settings.v3", JSON.stringify({ general: { newQuestionUI: enabled } })), + variant === "experimental", + ) + + const component = await mount("app-current-session-surface--question-request") + + const question = component.locator('[data-component="dock-prompt"][data-kind="question"]') + + const wide = question.getByRole("radio", { name: /Wide/ }) + + await expect(question.getByRole("radio", { name: /Focused/ })).toBeFocused() + await page.evaluate(() => document.fonts.ready.then(() => undefined)) + + const drag = async (text: Locator) => { + await text.scrollIntoViewIfNeeded() + + const box = await text.boundingBox() + + expect(box).not.toBeNull() + await page.mouse.move(box!.x + 1, box!.y + box!.height / 2) + await page.mouse.down() + await page.mouse.move(box!.x + box!.width - 1, box!.y + box!.height / 2, { steps: 12 }) + await page.mouse.up() + await expect.poll(() => page.evaluate(() => window.getSelection()?.toString().trim())).toBe(await text.innerText()) + } + + for (const slot of ["option-label", "option-description"]) { + await drag(wide.locator(`[data-slot="${slot}"] bdi`)) + await expect(wide).not.toBeChecked() + } + + await wide.locator('[data-slot="option-description"] bdi').click({ modifiers: ["Shift"] }) + await expect(wide).not.toBeChecked() + await wide.click({ position: { x: 4, y: 4 } }) + await expect(wide).toBeChecked() + await question.getByRole("radio", { name: /Focused/ }).click() + await drag(wide.locator('[data-slot="option-description"] bdi')) + await expect(wide).not.toBeChecked() + + const mark = await wide.locator('[data-slot="question-option-check"]').boundingBox() + + expect(mark).not.toBeNull() + await page.mouse.move(mark!.x + mark!.width / 2, mark!.y + mark!.height / 2) + await page.mouse.down() + await page.mouse.move(mark!.x + mark!.width / 2 + 1, mark!.y + mark!.height / 2) + await page.mouse.up() + await expect(wide).toBeChecked() + await question.getByRole("button", { name: "Next", exact: true }).click() + + const files = question.getByRole("checkbox", { name: "Changed files", exact: true }) + + await expect(files).toBeFocused() + await files.click() + await expect(files).toBeChecked() + await drag(files.locator('[data-slot="option-label"] bdi')) + await expect(files).toBeChecked() + await files.click({ position: { x: 4, y: 4 } }) + await expect(files).not.toBeChecked() + }) +} + story( "uses the original question cards by default and submits selected and custom answers", async ({ mount, page }) => { @@ -32,7 +96,9 @@ story( const submit = question.getByRole("button", { name: "Submit", exact: true }) expect(await submit.evaluate((button) => button.getBoundingClientRect().width)).toBe(width) await expect(shortcuts).toHaveText(["1", "2", "3", "4"]) - await files.click() + await page.keyboard.down(" ") + await page.keyboard.down(" ") + await page.keyboard.up(" ") await terminal.click() await expect(files).toBeChecked() await expect(terminal).toBeChecked() diff --git a/packages/app/src/session/requests/session-question-dock-classic.tsx b/packages/app/src/session/requests/session-question-dock-classic.tsx index 5d5dedb05906..4d90c980c5e3 100644 --- a/packages/app/src/session/requests/session-question-dock-classic.tsx +++ b/packages/app/src/session/requests/session-question-dock-classic.tsx @@ -47,22 +47,57 @@ function Option(props: { description?: string number: number disabled: boolean - ref?: (el: HTMLButtonElement) => void + ref?: (el: HTMLDivElement) => void onFocus?: VoidFunction onClick: VoidFunction }) { + let pointer: { x: number; y: number } | undefined + return ( - +
) } @@ -126,7 +161,7 @@ export const SessionQuestionDockClassic: Component<{ request: FormInfo; onSubmit let optionsRef: HTMLDivElement | undefined let customRef: HTMLButtonElement | undefined let customInput: HTMLInputElement | undefined - let optsRef: HTMLButtonElement[] = [] + let optsRef: HTMLDivElement[] = [] let replied = false let focusFrame: number | undefined diff --git a/packages/app/src/session/requests/session-question-dock-experimental.tsx b/packages/app/src/session/requests/session-question-dock-experimental.tsx index 42add84d42e4..7949c6873a92 100644 --- a/packages/app/src/session/requests/session-question-dock-experimental.tsx +++ b/packages/app/src/session/requests/session-question-dock-experimental.tsx @@ -194,23 +194,47 @@ function Option(props: { shortcut?: string disabled: boolean tabbable: boolean - ref?: (el: HTMLButtonElement) => void + ref?: (el: HTMLDivElement) => void onFocus?: VoidFunction onClick: VoidFunction }) { + let pointer: { x: number; y: number } | undefined + return ( - + ) } @@ -270,7 +294,7 @@ export const SessionQuestionDockExperimental: Component<{ request: FormInfo; onS let customRow: HTMLDivElement | undefined let highlightRef: HTMLSpanElement | undefined let customInput: HTMLInputElement | undefined - let optsRef: HTMLButtonElement[] = [] + let optsRef: HTMLDivElement[] = [] let replied = false const question = createMemo(() => questions()[store.tab]) diff --git a/packages/session-ui/src/components/question-prompt-experimental.css b/packages/session-ui/src/components/question-prompt-experimental.css index c2fe574baec9..a4dd987b465a 100644 --- a/packages/session-ui/src/components/question-prompt-experimental.css +++ b/packages/session-ui/src/components/question-prompt-experimental.css @@ -303,6 +303,8 @@ } [data-slot="question-option-check"] { + -webkit-user-select: none; + user-select: none; display: inline-flex; align-items: center; justify-content: center; @@ -358,6 +360,8 @@ } [data-slot="question-option-main"] { + -webkit-user-select: text; + user-select: text; display: flex; flex-direction: column; gap: 4px; diff --git a/packages/session-ui/src/components/question-prompt.css b/packages/session-ui/src/components/question-prompt.css index 1762cb73c354..e66df395079f 100644 --- a/packages/session-ui/src/components/question-prompt.css +++ b/packages/session-ui/src/components/question-prompt.css @@ -246,6 +246,8 @@ } [data-slot="question-option-check"] { + -webkit-user-select: none; + user-select: none; display: inline-flex; align-items: center; justify-content: center; @@ -308,6 +310,8 @@ } [data-slot="question-option-main"] { + -webkit-user-select: text; + user-select: text; display: flex; flex-direction: column; gap: 6px; @@ -316,6 +320,8 @@ } [data-slot="question-option-shortcut"] { + -webkit-user-select: none; + user-select: none; --keybind-font-size: 10px; --keybind-font-weight: var(--font-weight-regular); --keybind-transition-duration: var(--question-feedback-duration); @@ -337,7 +343,7 @@ [data-slot="option-description"] { min-inline-size: 0; font-family: var(--v2-font-family-sans); - font-size: 11px; + font-size: 12px; font-weight: 440; line-height: var(--line-height-tight); letter-spacing: 0.05px; From 17f4634afedb38d72f29b4f5954b4c2250735c5c Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:20:32 -0500 Subject: [PATCH 10/83] chore(release): announce releases in Discord again (#60371) --- .github/release/publish-discord.sh | 18 ++++++++++++++++++ .github/workflows/release.yml | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 .github/release/publish-discord.sh diff --git a/.github/release/publish-discord.sh b/.github/release/publish-discord.sh new file mode 100755 index 000000000000..b22e13c1ee73 --- /dev/null +++ b/.github/release/publish-discord.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# publish-discord.sh: announces the v release in Discord with OPENCODE_RELEASE_NOTES (DISCORD_WEBHOOK). +# Discord caps an embed description at 4096 characters, so longer notes are cut and link to the GitHub release. +. "$(dirname "$0")/lib.sh" + +tag="v$OPENCODE_VERSION" +payload=$(jq -n --arg tag "$tag" --arg notes "${OPENCODE_RELEASE_NOTES:-}" \ + --arg url "https://github.com/$GITHUB_REPOSITORY/releases/tag/$tag" ' + ($notes | if length > 4000 then .[:4000] + "\n\n[Full release notes](\($url))" else . end) as $description | + { + allowed_mentions: {parse: []}, + embeds: [{title: "OpenCode V2 \($tag)", url: $url, color: 2829099} + if $description == "" then {} else {description: $description} end] + }') +echo "$payload" | jq . +if dry_run; then exit 0; fi + +test -n "${DISCORD_WEBHOOK:-}" || die "DISCORD_WEBHOOK is not set" +curl -fsS --retry 3 -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd560df277ab..fead99408e46 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -733,6 +733,22 @@ jobs: GH_REPO: ${{ github.repository }} OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }} + publish-discord: + needs: [plan, publish-github-release] + if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }} + runs-on: ubuntu-24.04 + environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }} + permissions: + contents: read + env: *env + steps: + - *checkout-release + - name: Publish + run: bash .github/release/publish-discord.sh + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }} + # Brings the release commit back to dev. Pushing to dev is blocked by rulesets, so it opens a PR. publish-version-pr: needs: [plan, tag, publish-npm, publish-cli, publish-desktop, publish-github-release] From 6b1131202dff0dc96b5dcc4e3234b2c6cb705b06 Mon Sep 17 00:00:00 2001 From: James Long Date: Thu, 29 Oct 2026 17:34:17 -0400 Subject: [PATCH 11/83] feat(process-daemon): rename terminals (#60324) --- packages/process-daemon/README.md | 2 +- packages/process-daemon/SPEC.md | 33 +++- packages/process-daemon/src/client.rs | 1 + packages/process-daemon/src/daemon.rs | 2 + packages/process-daemon/src/daemon/server.rs | 5 + packages/process-daemon/src/daemon/sweep.rs | 3 +- packages/process-daemon/src/daemon/unix.rs | 4 +- packages/process-daemon/src/daemon/windows.rs | 4 +- packages/process-daemon/src/protocol.rs | 51 ++++++ packages/process-daemon/src/service.rs | 169 ++++++++++++++++-- packages/process-daemon/tests/ownership.rs | 60 +++++++ packages/process-daemon/tests/service.rs | 78 ++++++++ .../process-daemon/tests/windows-daemon.rs | 2 +- 13 files changed, 391 insertions(+), 23 deletions(-) diff --git a/packages/process-daemon/README.md b/packages/process-daemon/README.md index 9804633177df..c03ce089dfb7 100644 --- a/packages/process-daemon/README.md +++ b/packages/process-daemon/README.md @@ -71,7 +71,7 @@ ownership deadline is due, or a two-second safety net elapses. Windows still polls every 25 ms. The Windows named-pipe backend keeps protocol 7 and the registration fields -`instance_id`, `pid`, `protocol`, `socket`, and `token`. Treat `socket` as an opaque +`instance_id`, `pid`, `protocol`, `socket`, `token`, and `features`. Treat `socket` as an opaque local endpoint: on Windows it is `\\.\pipe\opencode-pty-`, not a filesystem socket. A random per-instance name, exclusive first pipe instance, current-user access control, and rejection of remote clients protect the endpoint; diff --git a/packages/process-daemon/SPEC.md b/packages/process-daemon/SPEC.md index aaf8142ee111..d4b88f08f1f9 100644 --- a/packages/process-daemon/SPEC.md +++ b/packages/process-daemon/SPEC.md @@ -27,6 +27,7 @@ replay, and explicit lifecycle state. - Promotion, canonical resize, and input are one ordered actor command. - Subscription replay and live events cross one ordered actor boundary. - OSC 0/2 title changes update authoritative terminal metadata and publish ordered subscription events. +- A user title set by rename takes precedence over OSC titles; title changes publish only when the effective title changes. - The deepest TTY-attached process in the foreground process group updates authoritative process metadata. - Controller delivery applies backpressure; observers tolerate bounded output bursts and are disconnected when their backlog remains full. - Adjacent output is coalesced before fanout, flushing at 8 KiB, after 1 ms, or before the next non-output event. @@ -57,7 +58,7 @@ A snapshot is built on the actor thread and contains owned values only: - Plain parsed screen text - VT checkpoint synthesized by libghostty formatter - Raw replay head and tail offsets -- Current title derived from libghostty state +- Current effective title and user title - Current foreground process derived from PTY process state No borrowed libghostty object crosses a thread boundary. @@ -88,6 +89,24 @@ bounded. Results exceeding that budget fail rather than truncate. Complete responses remain subject to the transport's 8 MiB frame limit. Protocol 7 supports `read_rows` alongside the existing snapshot and replay operations. +## Titles + +`TerminalInfo.title` is the effective title: the user title, else the latest +OSC 0/2 title, else the title given at creation. An empty OSC title (a program +resetting it) or an empty user title counts as unset. `TerminalInfo.user_title` +is always serialized, as `null` when unset. + +`Request::Rename { id, title: Option }` (`op: "rename"`) sets the user +title, or clears it when `title` is null or empty, and returns `Response::Ok`. +The terminal actor handles it as one command, so it is ordered with output. +OSC titles keep being tracked while a user title is set and show through again +once it is cleared. + +Rename and OSC updates publish `TitleChanged` with the effective title only +when it changes; an OSC change hidden behind a user title publishes nothing. + +`list` returns terminals in creation order. + ## Failure Boundary Losing the owning server connection stops `opencode-pty` and its terminals. @@ -108,11 +127,19 @@ only observe or operate an existing daemon and never start one. Protocol v7 uses four-byte big-endian framing with bounded UTF-8 JSON control frames and tagged raw binary output frames. It supports ping, create, list, write, resize, atomic interaction promotion, snapshot, read_rows, replay, replay-to-live -subscriptions, title updates, controller takeover, terminate, and destructive service +subscriptions, title updates, rename, controller takeover, terminate, and destructive service shutdown, ownership acquisition, and restart handoff preparation. +`Pong` and the registration carry `features`, the daemon's additive +capabilities (currently `["rename"]`). Additive changes, such as a new request +or field older clients can ignore, extend `features` and keep the protocol +version; clients check `features` before sending a new request, since a daemon +that cannot parse one drops the connection. Only breaking changes bump +`PROTOCOL_VERSION`, which clients reject on mismatch. A missing `features` +means none. + Registration is written atomically with private permissions and contains an -instance ID, PID, protocol version, socket path, and random credential. A +instance ID, PID, protocol version, features, socket path, and random credential. A service lock elects one process and protects stale socket cleanup. On Unix, the socket uses a fixed-length hash of the canonical runtime path under a private per-user `/tmp` directory to stay below platform path limits. diff --git a/packages/process-daemon/src/client.rs b/packages/process-daemon/src/client.rs index 83879c9f6586..ea7503d7c0e3 100644 --- a/packages/process-daemon/src/client.rs +++ b/packages/process-daemon/src/client.rs @@ -144,6 +144,7 @@ impl TerminalClient { instance_id, pid, protocol, + .. } if instance_id == client.registration.instance_id && pid == client.registration.pid && protocol == PROTOCOL_VERSION => diff --git a/packages/process-daemon/src/daemon.rs b/packages/process-daemon/src/daemon.rs index af03b3630110..1243749dda61 100644 --- a/packages/process-daemon/src/daemon.rs +++ b/packages/process-daemon/src/daemon.rs @@ -14,6 +14,8 @@ pub struct Registration { /// Opaque local transport endpoint, not necessarily a filesystem entry. pub socket: PathBuf, pub token: String, + #[serde(default)] + pub features: Vec, } /// Shared parent of runtime directories, inside OpenCode's state directory. diff --git a/packages/process-daemon/src/daemon/server.rs b/packages/process-daemon/src/daemon/server.rs index dae85183ea9c..7f07ebaee8cf 100644 --- a/packages/process-daemon/src/daemon/server.rs +++ b/packages/process-daemon/src/daemon/server.rs @@ -447,6 +447,7 @@ fn dispatch( instance_id: registration.instance_id.clone(), pid: registration.pid, protocol: registration.protocol, + features: registration.features.clone(), }, Request::Create { program, @@ -534,6 +535,10 @@ fn dispatch( cursor_y: rows.cursor_y, } } + Request::Rename { id, title } => { + service.rename(id, title)?; + Response::Ok + } Request::Replay { id, offset } => { let replay = service.replay(id, offset)?; Response::Replay { diff --git a/packages/process-daemon/src/daemon/sweep.rs b/packages/process-daemon/src/daemon/sweep.rs index e922f02f7196..20f22c32a67e 100644 --- a/packages/process-daemon/src/daemon/sweep.rs +++ b/packages/process-daemon/src/daemon/sweep.rs @@ -106,7 +106,7 @@ mod tests { use std::path::PathBuf; use super::*; - use crate::protocol::PROTOCOL_VERSION; + use crate::protocol::{PROTOCOL_VERSION, features}; fn random_id() -> String { format!("{:032x}", rand::random::()) @@ -135,6 +135,7 @@ mod tests { protocol: PROTOCOL_VERSION, socket: PathBuf::from("/nonexistent.sock"), token: random_id(), + features: features(), }; fs::write( directory.join(REGISTRATION_FILE), diff --git a/packages/process-daemon/src/daemon/unix.rs b/packages/process-daemon/src/daemon/unix.rs index 78e9c8576898..8867ea7fb964 100644 --- a/packages/process-daemon/src/daemon/unix.rs +++ b/packages/process-daemon/src/daemon/unix.rs @@ -10,7 +10,7 @@ use fs2::FileExt; use sha2::{Digest, Sha256}; use super::{LOCK_FILE, Registration, read_registration, registration_path}; -use crate::protocol::PROTOCOL_VERSION; +use crate::protocol::{PROTOCOL_VERSION, features}; use crate::transport::Listener; pub(super) struct Runtime { @@ -48,6 +48,7 @@ impl Runtime { protocol: PROTOCOL_VERSION, socket: socket.path.clone(), token: random_id(), + features: features(), }; write_registration(&directory, ®istration)?; let sweeper = { @@ -364,6 +365,7 @@ mod tests { protocol: PROTOCOL_VERSION, socket: socket.clone(), token: random_id(), + features: features(), }; write_registration(&abandoned, ®istration).unwrap(); diff --git a/packages/process-daemon/src/daemon/windows.rs b/packages/process-daemon/src/daemon/windows.rs index 0e2eb72d2345..973cab2278f3 100644 --- a/packages/process-daemon/src/daemon/windows.rs +++ b/packages/process-daemon/src/daemon/windows.rs @@ -28,7 +28,7 @@ use windows_sys::Win32::System::WindowsProgramming::{ }; use super::{LOCK_FILE, REGISTRATION_FILE, Registration, registration_path, sweep}; -use crate::protocol::PROTOCOL_VERSION; +use crate::protocol::{PROTOCOL_VERSION, features}; use crate::transport::Listener; use crate::transport::windows::{owned_handle, security::PrivateSecurity}; @@ -112,6 +112,7 @@ impl Runtime { pid: std::process::id(), protocol: PROTOCOL_VERSION, token: format!("{:032x}", rand::random::()), + features: features(), }; let listener = Listener::bind(®istration.socket)?; write_registration(&directory, &directory_handle, ®istration, &security)?; @@ -364,6 +365,7 @@ mod tests { protocol: PROTOCOL_VERSION, socket: PathBuf::from(r"\\.\pipe\opencode-pty-first"), token: "secret".into(), + features: features(), }; write_registration(&directory, &directory_handle, ®istration, &security).unwrap(); let path = directory.join(REGISTRATION_FILE); diff --git a/packages/process-daemon/src/protocol.rs b/packages/process-daemon/src/protocol.rs index 26f05b7bce20..80e5c0be537a 100644 --- a/packages/process-daemon/src/protocol.rs +++ b/packages/process-daemon/src/protocol.rs @@ -7,6 +7,12 @@ use serde::{Deserialize, Serialize}; use crate::service::{TerminalId, TerminalInfo}; pub const PROTOCOL_VERSION: u32 = 7; +/// Additive capabilities of this daemon. Breaking changes bump `PROTOCOL_VERSION`. +pub const FEATURES: &[&str] = &["rename"]; + +pub fn features() -> Vec { + FEATURES.iter().map(|feature| feature.to_string()).collect() +} pub const MAX_FRAME_BYTES: usize = 8 * 1024 * 1024; const OUTPUT_FRAME_TAG: u8 = 0; @@ -74,6 +80,10 @@ pub enum Request { id: TerminalId, rows: Option, }, + Rename { + id: TerminalId, + title: Option, + }, Replay { id: TerminalId, offset: u64, @@ -103,6 +113,8 @@ pub enum Response { instance_id: String, pid: u32, protocol: u32, + #[serde(default)] + features: Vec, }, Created { terminal: TerminalInfo, @@ -284,4 +296,43 @@ mod tests { } assert_eq!(PROTOCOL_VERSION, 7); } + + #[test] + fn additive_fields_default_when_absent() { + assert!(matches!( + serde_json::from_str::( + r#"{"type":"pong","instance_id":"a","pid":1,"protocol":7}"# + ) + .unwrap(), + Response::Pong { features, .. } if features.is_empty() + )); + assert!(matches!( + serde_json::from_str::(r#"{"op":"rename","id":1,"title":null}"#).unwrap(), + Request::Rename { id: 1, title: None } + )); + assert!(matches!( + serde_json::from_str::(r#"{"op":"rename","id":1}"#).unwrap(), + Request::Rename { id: 1, title: None } + )); + let terminal = serde_json::json!({ + "id": 1, + "pid": null, + "title": "shell", + "foreground_process": null, + "group_id": "group", + "command": [], + "cwd": "/", + "cols": 80, + "rows": 24, + "lifecycle": {"status": "running"}, + "output_head": 0, + "output_tail": 0, + }); + let info = serde_json::from_value::(terminal).unwrap(); + assert_eq!(info.user_title, None); + assert_eq!( + serde_json::to_value(&info).unwrap()["user_title"], + serde_json::Value::Null + ); + } } diff --git a/packages/process-daemon/src/service.rs b/packages/process-daemon/src/service.rs index 6b13c8b10173..bea34d7fd8f1 100644 --- a/packages/process-daemon/src/service.rs +++ b/packages/process-daemon/src/service.rs @@ -4,6 +4,7 @@ use std::collections::{HashMap, VecDeque}; use std::env; use std::io::{self, Read, Write}; use std::path::PathBuf; +use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::{Arc, Mutex, RwLock, mpsc as std_mpsc}; use std::thread::{self, JoinHandle}; use std::time::{Duration, Instant}; @@ -44,7 +45,11 @@ pub enum TerminalLifecycle { pub struct TerminalInfo { pub id: TerminalId, pub pid: Option, + /// Effective title: the user title, else the latest non-empty OSC title, + /// else the title given at creation. pub title: String, + #[serde(default)] + pub user_title: Option, pub foreground_process: Option, pub group_id: String, pub command: Vec, @@ -169,6 +174,7 @@ impl CreateTerminal { pub struct TerminalService { terminals: Mutex>>, + created: AtomicU64, replay_capacity: usize, } @@ -182,6 +188,7 @@ impl TerminalService { pub fn new(replay_capacity: usize) -> Self { Self { terminals: Mutex::new(HashMap::new()), + created: AtomicU64::new(0), replay_capacity, } } @@ -205,7 +212,8 @@ impl TerminalService { break id; } }; - let handle = TerminalHandle::spawn(id, request, self.replay_capacity)?; + let order = self.created.fetch_add(1, Ordering::Relaxed); + let handle = TerminalHandle::spawn(id, order, request, self.replay_capacity)?; let info = handle.info(); self.terminals .lock() @@ -215,13 +223,14 @@ impl TerminalService { } pub fn list(&self) -> Result> { - let handles = self + let mut handles = self .terminals .lock() .map_err(|_| anyhow!("terminal registry lock poisoned"))? .values() .cloned() .collect::>(); + handles.sort_by_key(|terminal| terminal.order); let mut terminals = Vec::with_capacity(handles.len()); for terminal in handles { // Windows has no foreground query; do not wait behind actor @@ -230,7 +239,6 @@ impl TerminalService { terminal.request(|reply| ActorMessage::RefreshForegroundProcess { reply })?; terminals.push(terminal.info()); } - terminals.sort_by_key(|terminal| terminal.id); Ok(terminals) } @@ -322,6 +330,13 @@ impl TerminalService { .request(|reply| ActorMessage::ReadRows { rows, reply }) } + /// Sets or clears (`None` or empty) the user title, which takes precedence + /// over titles set by the terminal's programs. + pub fn rename(&self, id: TerminalId, title: Option) -> Result<()> { + self.get(id)? + .request(|reply| ActorMessage::Rename { title, reply }) + } + pub fn replay(&self, id: TerminalId, offset: u64) -> Result { self.get(id)? .request(|reply| ActorMessage::Replay { offset, reply }) @@ -409,6 +424,8 @@ impl Drop for TerminalService { } struct TerminalHandle { + /// Creation sequence number; orders `list` results. + order: u64, actor_tx: Sender, /// Disconnects when the actor thread exits; never carries a message. actor_done: Receiver<()>, @@ -419,7 +436,12 @@ struct TerminalHandle { } impl TerminalHandle { - fn spawn(id: TerminalId, request: CreateTerminal, replay_capacity: usize) -> Result { + fn spawn( + id: TerminalId, + order: u64, + request: CreateTerminal, + replay_capacity: usize, + ) -> Result { let pty_system = native_pty_system(); let pair = pty_system .openpty(PtySize { @@ -459,6 +481,7 @@ impl TerminalHandle { id, pid, title: request.title, + user_title: None, foreground_process: None, group_id: request.group_id, command: std::iter::once(request.program) @@ -589,6 +612,7 @@ impl TerminalHandle { .context("failed to spawn terminal child waiter")?; Ok(Self { + order, actor_tx, actor_done, shutdown_tx: Mutex::new(Some(shutdown_tx)), @@ -692,6 +716,10 @@ enum ActorMessage { rows: Option, reply: Reply>, }, + Rename { + title: Option, + reply: Reply>, + }, Replay { offset: u64, reply: Reply>, @@ -803,6 +831,12 @@ fn run_actor(config: ActorConfig) -> Result<()> { max_scrollback: replay_capacity, })?; + let create_title = info + .read() + .map_err(|_| anyhow!("terminal info lock poisoned"))? + .title + .clone(); + let mut osc_title = None::; let mut replay = ReplayBuffer::new(replay_capacity); let mut subscribers = HashMap::::new(); let mut controller = None::; @@ -853,17 +887,10 @@ fn run_actor(config: ActorConfig) -> Result<()> { StreamEvent::Output { start, end, bytes }, ); if let Some(title) = terminal.take_title() { - let changed = if let Ok(mut value) = info.write() { - if value.title == title { - false - } else { - value.title = title.clone(); - true - } - } else { - false - }; - if changed { + osc_title = Some(title).filter(|title| !title.is_empty()); + if let Ok(Some(title)) = + refresh_title(&info, None, osc_title.as_deref(), &create_title) + { broadcast( &shutdown, &mut subscribers, @@ -1020,6 +1047,26 @@ fn run_actor(config: ActorConfig) -> Result<()> { })(); let _ = reply.send(result); } + Ok(ActorMessage::Rename { title, reply }) => { + let result = refresh_title( + &info, + Some(title.filter(|title| !title.is_empty())), + osc_title.as_deref(), + &create_title, + ); + if let Ok(Some(title)) = &result { + broadcast( + &shutdown, + &mut subscribers, + &mut controller, + &mut controller_generation, + StreamEvent::TitleChanged { + title: title.clone(), + }, + ); + } + let _ = reply.send(result.map(|_| ())); + } Ok(ActorMessage::Replay { offset, reply }) => { let _ = reply.send(replay.read_from(offset)); } @@ -1387,6 +1434,33 @@ fn run_writer( } } +/// Applies an optional user-title update and stores the effective title under +/// one write guard, returning the title only when it changed. +fn refresh_title( + info: &Arc>, + user_title: Option>, + osc_title: Option<&str>, + create_title: &str, +) -> Result> { + let mut value = info + .write() + .map_err(|_| anyhow!("terminal info lock poisoned"))?; + if let Some(user_title) = user_title { + value.user_title = user_title; + } + let title = value + .user_title + .as_deref() + .or(osc_title) + .unwrap_or(create_title) + .to_string(); + if value.title == title { + return Ok(None); + } + value.title = title.clone(); + Ok(Some(title)) +} + fn make_snapshot( terminal: &Terminal, info: &Arc>, @@ -1664,6 +1738,7 @@ mod tests { id: 1, pid: None, title: "test".into(), + user_title: None, foreground_process: None, group_id: "test".into(), command: vec![], @@ -1716,6 +1791,7 @@ mod tests { init_rx.recv().unwrap().unwrap(); ( TerminalHandle { + order: 0, actor_tx, actor_done, shutdown_tx: Mutex::new(Some(shutdown_tx)), @@ -1979,6 +2055,69 @@ mod tests { assert!(detached.is_err()); } + #[test] + fn user_title_overrides_osc_titles_until_cleared() { + let (actor, _writer) = test_actor(); + let observer = actor + .request(|reply| ActorMessage::Attach { + offset: 0, + attachment_id: "observer".into(), + role: AttachmentRole::Observer, + takeover: false, + reply, + }) + .unwrap(); + let rename = |title: Option<&str>| { + actor + .request(|reply| ActorMessage::Rename { + title: title.map(String::from), + reply, + }) + .unwrap() + }; + let osc = |title: &str| { + actor + .actor_tx + .send(ActorMessage::Output( + format!("\x1b]2;{title}\x07").into_bytes(), + )) + .unwrap() + }; + let info = || { + actor + .request(|reply| ActorMessage::Snapshot { reply }) + .unwrap() + .info + }; + + osc("shell"); + rename(Some("mine")); + osc("prompt"); + let renamed = info(); + assert_eq!(renamed.title, "mine"); + assert_eq!(renamed.user_title.as_deref(), Some("mine")); + rename(Some("mine")); + rename(None); + let cleared = info(); + assert_eq!(cleared.title, "prompt"); + assert_eq!(cleared.user_title, None); + rename(Some("")); + assert_eq!(info().user_title, None); + osc(""); + assert_eq!(info().title, "test"); + actor.shutdown().unwrap(); + + let titles = observer + .events + .try_iter() + .filter_map(|event| match event { + StreamEvent::TitleChanged { title } => Some(title), + _ => None, + }) + .collect::>(); + assert_eq!(titles, ["shell", "mine", "prompt", "test"]); + } + #[test] fn broadcast_removes_failed_observers_before_promoting() { let mut subscribers = HashMap::new(); diff --git a/packages/process-daemon/tests/ownership.rs b/packages/process-daemon/tests/ownership.rs index ececcbcdbcfb..f74f162c5cbe 100644 --- a/packages/process-daemon/tests/ownership.rs +++ b/packages/process-daemon/tests/ownership.rs @@ -308,6 +308,66 @@ fn shutdown_ends_an_idle_subscription() { assert_terminal_stopped(&terminal); } +#[test] +fn rename_is_advertised_and_served() { + use opencode_pty::protocol::{SubscriptionEvent, read_subscription_event}; + + let mut daemon = Daemon::start(); + assert_eq!(daemon.registration.features, ["rename"]); + assert!(matches!( + daemon.request(Request::Ping), + Response::Pong { features, .. } if features == ["rename"] + )); + let (owner, response) = daemon.own(None); + assert!(matches!(response, Response::Owned)); + let terminal = daemon.terminal("exec cat"); + let mut subscription = daemon.connect(); + assert!(matches!( + daemon.send( + &mut subscription, + Request::Subscribe { + id: terminal.id, + offset: 0, + attachment_id: "rename-observer".into(), + role: AttachmentRole::Observer, + takeover: false, + } + ), + Response::Attached { .. } + )); + assert!(matches!( + daemon.request(Request::Rename { + id: terminal.id, + title: Some("renamed".into()), + }), + Response::Ok + )); + loop { + if let SubscriptionEvent::Response(response) = + read_subscription_event(&mut subscription).unwrap() + && let Response::TitleChanged { title } = *response + { + assert_eq!(title, "renamed"); + break; + } + } + assert!( + matches!(daemon.request(Request::List), Response::Terminals { terminals } + if terminals.len() == 1 && terminals[0].title == "renamed" + && terminals[0].user_title.as_deref() == Some("renamed")) + ); + assert!(matches!( + daemon.request(Request::Rename { + id: terminal.id.wrapping_add(1), + title: None, + }), + Response::Error { .. } + )); + drop(subscription); + drop(owner); + daemon.wait(); +} + #[test] fn handoff_preserves_daemon_and_terminal_and_shutdown_overrides_it() { let mut daemon = Daemon::start(); diff --git a/packages/process-daemon/tests/service.rs b/packages/process-daemon/tests/service.rs index 6fbac909d607..7293c6ae6a94 100644 --- a/packages/process-daemon/tests/service.rs +++ b/packages/process-daemon/tests/service.rs @@ -245,6 +245,84 @@ fn title_changes_update_metadata_and_notify_subscribers() { service.terminate(terminal.id).expect("terminal removed"); } +#[test] +fn rename_updates_metadata_and_notifies_subscribers_once() { + let service = TerminalService::new(64 * 1024); + let terminal = service + .create(command("exec cat")) + .expect("terminal created"); + let observer = service + .attach( + terminal.id, + 0, + "observer".to_string(), + AttachmentRole::Observer, + false, + ) + .expect("observer attached"); + + service + .rename(terminal.id, Some("renamed".to_string())) + .unwrap(); + service + .rename(terminal.id, Some("renamed".to_string())) + .unwrap(); + let snapshot = service.snapshot(terminal.id).unwrap(); + assert_eq!(snapshot.info.title, "renamed"); + assert_eq!(snapshot.info.user_title.as_deref(), Some("renamed")); + assert!(service.list().is_ok_and(|items| { + items.iter().any(|item| { + item.id == terminal.id + && item.title == "renamed" + && item.user_title.as_deref() == Some("renamed") + }) + })); + service.terminate(terminal.id).expect("terminal removed"); + + let titles = observer + .events + .iter() + .filter_map(|event| match event { + StreamEvent::TitleChanged { title } => Some(title), + _ => None, + }) + .collect::>(); + assert_eq!(titles, ["renamed"]); + assert!(service.rename(terminal.id, None).is_err()); +} + +#[test] +fn list_returns_terminals_in_creation_order() { + let service = TerminalService::new(64 * 1024); + let created = (0..6) + .map(|_| service.create(command("exec cat")).unwrap().id) + .collect::>(); + let listed = service + .list() + .unwrap() + .into_iter() + .map(|terminal| terminal.id) + .collect::>(); + assert_eq!(listed, created); + service.terminate(created[2]).unwrap(); + let id = service.create(command("exec cat")).unwrap().id; + let listed = service + .list() + .unwrap() + .into_iter() + .map(|terminal| terminal.id) + .collect::>(); + assert_eq!( + listed, + [ + created[0], created[1], created[3], created[4], created[5], id + ] + ); + for id in listed { + service.terminate(id).unwrap(); + } +} + #[test] #[cfg(target_os = "linux")] fn foreground_process_tracks_deepest_tty_attached_job() { diff --git a/packages/process-daemon/tests/windows-daemon.rs b/packages/process-daemon/tests/windows-daemon.rs index 281f0faafcfd..86cf44856499 100644 --- a/packages/process-daemon/tests/windows-daemon.rs +++ b/packages/process-daemon/tests/windows-daemon.rs @@ -651,7 +651,7 @@ fn observer_disconnect_and_control_input_preserve_independent_terminals() { matches!(daemon.request(Request::List), Response::Terminals { terminals } if terminals.len() == 2) ); assert!( - matches!(daemon.request(Request::Ping), Response::Pong { instance_id, pid, protocol: 7 } + matches!(daemon.request(Request::Ping), Response::Pong { instance_id, pid, protocol: 7, .. } if instance_id == daemon.registration.instance_id && pid == daemon.registration.pid) ); assert!(matches!(daemon.own(None).1, Response::Error { .. })); From 5e6ee370634842e0efa99ad103c4d767581b47f0 Mon Sep 17 00:00:00 2001 From: James Long Date: Thu, 29 Oct 2026 17:44:51 -0400 Subject: [PATCH 12/83] chore(process-daemon): release 0.4.0 (#60325) --- packages/process-daemon/Cargo.lock | 2 +- packages/process-daemon/Cargo.toml | 2 +- packages/process-daemon/npm/package.json | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/process-daemon/Cargo.lock b/packages/process-daemon/Cargo.lock index a3d1b16fe7f0..0eb82ddd57ec 100644 --- a/packages/process-daemon/Cargo.lock +++ b/packages/process-daemon/Cargo.lock @@ -184,7 +184,7 @@ dependencies = [ [[package]] name = "opencode-pty" -version = "0.3.3" +version = "0.4.0" dependencies = [ "anyhow", "base64", diff --git a/packages/process-daemon/Cargo.toml b/packages/process-daemon/Cargo.toml index 358c13dd3450..35cc8547a8d7 100644 --- a/packages/process-daemon/Cargo.toml +++ b/packages/process-daemon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "opencode-pty" -version = "0.3.3" +version = "0.4.0" edition = "2024" rust-version = "1.90" description = "Persistent PTY service for OpenCode" diff --git a/packages/process-daemon/npm/package.json b/packages/process-daemon/npm/package.json index 82ab907c2bdb..8e851b1dcc0e 100644 --- a/packages/process-daemon/npm/package.json +++ b/packages/process-daemon/npm/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/pty", - "version": "0.3.3", + "version": "0.4.0", "description": "Persistent PTY service for OpenCode", "type": "module", "license": "MIT", @@ -25,14 +25,14 @@ "index.js" ], "optionalDependencies": { - "@opencode/pty-darwin-arm64": "0.3.3", - "@opencode/pty-darwin-x64": "0.3.3", - "@opencode/pty-linux-arm64-gnu": "0.3.3", - "@opencode/pty-linux-arm64-musl": "0.3.3", - "@opencode/pty-linux-x64-gnu": "0.3.3", - "@opencode/pty-linux-x64-musl": "0.3.3", - "@opencode/pty-win32-arm64": "0.3.3", - "@opencode/pty-win32-x64": "0.3.3" + "@opencode/pty-darwin-arm64": "0.4.0", + "@opencode/pty-darwin-x64": "0.4.0", + "@opencode/pty-linux-arm64-gnu": "0.4.0", + "@opencode/pty-linux-arm64-musl": "0.4.0", + "@opencode/pty-linux-x64-gnu": "0.4.0", + "@opencode/pty-linux-x64-musl": "0.4.0", + "@opencode/pty-win32-arm64": "0.4.0", + "@opencode/pty-win32-x64": "0.4.0" }, "publishConfig": { "access": "public" From 83e399999642663492ecd9a6f32af2c3a8ce032a Mon Sep 17 00:00:00 2001 From: usrnk1 <7547651+usrnk1@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:49:27 +0100 Subject: [PATCH 13/83] feat(app): group added projects in settings (#60221) --- .../app/e2e/regression/mobile-session.spec.ts | 1 + .../app/e2e/regression/multi-server.spec.ts | 2 +- .../e2e/regression/settings-search.spec.ts | 8 +- packages/app/e2e/regression/settings.spec.ts | 42 ++++++- packages/app/src/runtime/i18n/en.ts | 1 + .../settings/workspaces/project-options.tsx | 35 ++++-- .../src/settings/workspaces/project-row.tsx | 15 ++- .../app/src/settings/workspaces/projects.tsx | 109 +++++++++++++++--- 8 files changed, 176 insertions(+), 37 deletions(-) diff --git a/packages/app/e2e/regression/mobile-session.spec.ts b/packages/app/e2e/regression/mobile-session.spec.ts index 7af867b036ae..f5209a13b5cc 100644 --- a/packages/app/e2e/regression/mobile-session.spec.ts +++ b/packages/app/e2e/regression/mobile-session.spec.ts @@ -347,6 +347,7 @@ test.describe("touch", () => { await expect(page).toHaveURL(new RegExp(`/session/${fixture.sourceID}$`)) await expect(drawer).toBeHidden() await expect(trigger).toContainText(fixture.expected.sourceTitle) + await expect(trigger).toBeFocused() await trigger.click() await drawer.getByRole("button", { name: "Home", exact: true }).click() await expect(page).toHaveURL("/") diff --git a/packages/app/e2e/regression/multi-server.spec.ts b/packages/app/e2e/regression/multi-server.spec.ts index 288cc0b1aa18..1caa8e119cf1 100644 --- a/packages/app/e2e/regression/multi-server.spec.ts +++ b/packages/app/e2e/regression/multi-server.spec.ts @@ -233,7 +233,7 @@ test("a project's auto-accept choice overrides the default in both directions", onPermissionReply: (reply) => replies.push(reply.permissionID), }, }) - await seed(page, { tabs: [api.id, web.id] }) + await seed(page, { tabs: [api.id, web.id], usedProjects: { local: ["proj_api", "proj_web"] } }) const dock = page.locator('[data-component="dock-prompt"][data-kind="permission"]') const settings = page.getByTestId("settings-screen") diff --git a/packages/app/e2e/regression/settings-search.spec.ts b/packages/app/e2e/regression/settings-search.spec.ts index 9706862f8b75..0f882095ef45 100644 --- a/packages/app/e2e/regression/settings-search.spec.ts +++ b/packages/app/e2e/regression/settings-search.spec.ts @@ -311,8 +311,12 @@ test("section search takes typed input, clears in place, and escapes in steps", }) for (const count of [0, 7, 8]) { - test(`Projects search appears from 8 projects (${count} projects)`, async ({ page }) => { - const view = await open(page, { count }) + test(`Projects search appears from 8 added projects (${count} projects)`, async ({ page }) => { + const view = await open(page, { + count, + seed: { usedProjects: { local: Array.from({ length: count }, (_, index) => `proj_search_${index}`) } }, + }) + await view.settings.getByRole("tab", { name: "Projects", exact: true }).click() const search = view.settings.getByRole("searchbox", { name: "Search projects", exact: true }) const projects = view.settings.getByRole("button", { name: /^OpenCode / }) diff --git a/packages/app/e2e/regression/settings.spec.ts b/packages/app/e2e/regression/settings.spec.ts index 9c2309b408b6..de157215d686 100644 --- a/packages/app/e2e/regression/settings.spec.ts +++ b/packages/app/e2e/regression/settings.spec.ts @@ -491,11 +491,45 @@ test("project list menus rename, edit, add, and stay inside the scrollport", asy await settings.getByRole("tab", { name: "Projects", exact: true }).click() const panel = settings.getByRole("tabpanel") const list = panel.getByRole("list") - await expect(list.getByRole("listitem")).toHaveCount(4) - const card = list.getByRole("listitem").filter({ hasText: "rebase" }) + await expect(list.getByRole("listitem")).toHaveCount(1) + await expect(list.getByRole("button", { name: "rebase", exact: true })).toBeVisible() + const others = panel.getByRole("button", { name: "Other projects", exact: true }) + await expect(others).toContainText("3") + await expect(others).toHaveAttribute("aria-expanded", "false") + await others.click() + await expect(others).toHaveAttribute("aria-expanded", "true") + await expect(panel.getByRole("listitem")).toHaveCount(4) + await others.click() + const search = panel.getByRole("searchbox", { name: "Search projects" }) + await search.fill("/projects/dinocms") + await expect(panel.getByRole("listitem")).toHaveCount(1) + await expect(panel.getByRole("button", { name: "dinocms", exact: true })).toBeVisible() + await expect(panel.getByRole("heading", { name: "Other projects", exact: true })).toBeVisible() + await search.fill("") + await expect(panel.getByRole("listitem")).toHaveCount(1) + await others.click() + await expect(panel.getByRole("listitem")).toHaveCount(4) + + const addTrigger = panel + .getByRole("listitem") + .filter({ hasText: "dinocms" }) + .getByRole("button", { name: "More options", exact: true }) + + await addTrigger.focus() + await addTrigger.press("Enter") + const menu = page.getByRole("menu") + await expect(menu.getByRole("menuitem")).toHaveText(["Add project", "Edit", "Rename"]) + const addProject = menu.getByRole("menuitem", { name: "Add project", exact: true }) + await expect(addProject).toBeFocused() + await addProject.press("Enter") + await expect(menu).toBeHidden() + await expect(others).toContainText("2") + const addedProjects = panel.getByRole("list").filter({ hasText: "rebase" }) + await expect(addedProjects.getByRole("listitem")).toHaveCount(2) + await expect(addedProjects.getByRole("button", { name: "dinocms", exact: true })).toBeFocused() + const card = panel.getByRole("listitem").filter({ hasText: "rebase" }) const more = card.getByRole("button", { name: "More options", exact: true }) await more.click() - const menu = page.getByRole("menu") await expect(menu.getByRole("menuitem")).toHaveText(["Edit", "Rename", "Clear notifications"]) await menu.getByRole("menuitem", { name: "Edit", exact: true }).click() await expect(panel.getByRole("heading", { name: "rebase", exact: true })).toBeVisible() @@ -545,6 +579,8 @@ test("project list menus rename, edit, add, and stay inside the scrollport", asy await select.click() await expect(picker).toBeHidden() await expect(panel.getByRole("heading", { name: "added", exact: true })).toBeVisible() + await page.getByRole("button", { name: "Home", exact: true }).click() + await expect(page.locator('[data-component="home-project-row"]').filter({ hasText: "dinocms" })).toBeVisible() }) test("project settings open as a nested view that keeps its route", async ({ page }) => { diff --git a/packages/app/src/runtime/i18n/en.ts b/packages/app/src/runtime/i18n/en.ts index aa2b8c7b68fb..82c47307bc6e 100644 --- a/packages/app/src/runtime/i18n/en.ts +++ b/packages/app/src/runtime/i18n/en.ts @@ -878,6 +878,7 @@ export const dict = { "settings.server.preferences.websearch.description": "Select the search provider agents use to search the web", "settings.projects.title": "Projects", "settings.projects.description": "Manage projects and their settings", + "settings.projects.other": "Other projects", "settings.projects.empty": "No projects found", "settings.projects.empty.title": "No projects yet", "settings.projects.empty.description": "Add a project to get started", diff --git a/packages/app/src/settings/workspaces/project-options.tsx b/packages/app/src/settings/workspaces/project-options.tsx index 6e38025a79b5..a131d8f73ae9 100644 --- a/packages/app/src/settings/workspaces/project-options.tsx +++ b/packages/app/src/settings/workspaces/project-options.tsx @@ -9,6 +9,7 @@ import { ServerConnection } from "@/runtime/server/registry" import type { LocalProject } from "@/shell/state/layout" import { fileManagerApp } from "@/home/projects/file-manager" import { useRevealProject } from "@/home/projects/reveal" +import { pathKey } from "@/workspaces/path-key" export const ProjectOptions: Component<{ server: ServerConnection.Any @@ -17,6 +18,7 @@ export const ProjectOptions: Component<{ onOpenChange?: (open: boolean) => void onEdit?: () => void onRename?: () => void + onAdd?: () => void class?: string size?: "small" | "normal" | "large" }> = (props) => { @@ -28,6 +30,11 @@ export const ProjectOptions: Component<{ const directories = () => [props.project.worktree, ...(props.project.sandboxes ?? [])] + const added = () => + context() + .projects.used() + .some((project) => pathKey(project.worktree) === pathKey(props.project.worktree)) + const hasUnread = () => directories().some((directory) => context().notification.project.hasUnread(directory)) const clearNotifications = () => { @@ -35,14 +42,13 @@ export const ProjectOptions: Component<{ directories().forEach((directory) => notification.project.markViewed(directory)) } + const addProject = () => { + props.onAdd?.() + context().projects.touch(props.project.worktree) + } + return ( - + + + {language.t("home.project.add")} + {(edit) => {language.t("common.edit")}} @@ -60,11 +69,15 @@ export const ProjectOptions: Component<{ {(rename) => {language.t("common.rename")}} - revealProject.reveal(props.server, props.project)}>{language.t(fileManagerApp(platform.os ?? "unknown").actionLabel)} + revealProject.reveal(props.server, props.project)}> + {language.t(fileManagerApp(platform.os ?? "unknown").actionLabel)} + + + + + {language.t("sidebar.project.clearNotifications")} + - - {language.t("sidebar.project.clearNotifications")} - diff --git a/packages/app/src/settings/workspaces/project-row.tsx b/packages/app/src/settings/workspaces/project-row.tsx index e53d58604871..cadffa622dc3 100644 --- a/packages/app/src/settings/workspaces/project-row.tsx +++ b/packages/app/src/settings/workspaces/project-row.tsx @@ -1,4 +1,4 @@ -import { Show } from "solid-js" +import { Show, onMount } from "solid-js" import { createStore } from "solid-js/store" import { InlineInput } from "@opencode/ui/inline-input" import { getFilename } from "@opencode/util/path" @@ -16,18 +16,26 @@ export function SettingsProjectRow(props: { project: LocalProject server: ServerConnection.Any onOpen: (project: LocalProject) => void + onAdd?: () => void + onMount?: (button: HTMLButtonElement) => void }) { const language = useLanguage() const global = useGlobal() - const [store, setStore] = createStore({ + const [store, setStore] = createStore<{ + menu: boolean + editor?: { draft: string; saving: boolean } + }>({ menu: false, - editor: undefined as { draft: string; saving: boolean } | undefined, }) let button: HTMLButtonElement | undefined let input: HTMLInputElement | undefined + onMount(() => { + if (button) props.onMount?.(button) + }) + const openEditor = () => { setStore("editor", { draft: displayName(props.project), saving: false }) requestAnimationFrame(() => { @@ -147,6 +155,7 @@ export function SettingsProjectRow(props: { onOpenChange={(open) => setStore("menu", open)} onEdit={() => props.onOpen(props.project)} onRename={openEditor} + onAdd={props.onAdd} /> diff --git a/packages/app/src/settings/workspaces/projects.tsx b/packages/app/src/settings/workspaces/projects.tsx index 8935345f1e7b..e887da6125c7 100644 --- a/packages/app/src/settings/workspaces/projects.tsx +++ b/packages/app/src/settings/workspaces/projects.tsx @@ -1,4 +1,4 @@ -import { Show, createEffect, createMemo, type Component, type JSX } from "solid-js" +import { Show, createEffect, createMemo, on, type Component, type JSX } from "solid-js" import { Key } from "@solid-primitives/keyed" import { createStore } from "solid-js/store" import { Button } from "@opencode/ui/button" @@ -16,6 +16,7 @@ import { SettingsSearchField } from "../search-field" import { SettingsProjectRow } from "./project-row" import "@/settings/search.css" import "@/settings/settings.css" +import "./project.css" export const SettingsProjects: Component<{ server: ServerConnection.Any @@ -26,21 +27,42 @@ export const SettingsProjects: Component<{ const language = useLanguage() const global = useGlobal() const pickDirectory = useDirectoryPicker() - const [store, setStore] = createStore({ filter: "" }) + const [store, setStore] = createStore({ filter: "", others: false }) const context = createMemo(() => global.ensureServerCtx(props.server)) - const projects = createMemo(() => context().projects.list()) - const searchable = createMemo(() => projects().length > 7) - const filtered = createMemo(() => { - const query = searchable() ? store.filter.trim().toLowerCase() : "" + let focus: string | undefined - return query ? projects().filter((project) => displayName(project).toLowerCase().includes(query)) : projects() - }) + const projects = createMemo(() => context().projects.unique()) + + const used = createMemo( + () => + new Set( + context() + .projects.used() + .map((project) => project.id), + ), + ) + + const others = createMemo(() => projects().filter((project) => !used().has(project.id))) + const searchable = createMemo(() => projects().length > 7 || others().length > 0) + const query = createMemo(() => (searchable() ? store.filter.trim().toLowerCase() : "")) + + const filtered = createMemo(() => + projects().filter( + (project) => + !query() || [displayName(project), project.worktree].some((value) => value.toLowerCase().includes(query())), + ), + ) + + const added = createMemo(() => filtered().filter((project) => used().has(project.id))) + const otherResults = createMemo(() => filtered().filter((project) => !used().has(project.id))) createEffect(() => { if (!searchable()) setStore("filter", "") }) + createEffect(on(context, () => setStore("others", false))) + const addProject = () => pickDirectory({ server: props.server, @@ -108,9 +130,7 @@ export const SettingsProjects: Component<{ class="settings-project-empty-card flex flex-col items-center gap-2 py-24 text-center" > -
- {language.t("settings.projects.empty.title")} -
+
{language.t("settings.projects.empty.title")}
{language.t("settings.projects.empty.description")}
@@ -121,12 +141,67 @@ export const SettingsProjects: Component<{ } > -
- - {(project) => ( - - )} - +
+ 0}> +
+ + {(project) => ( + { + if (focus !== project().worktree) return + focus = undefined + requestAnimationFrame(() => button.focus()) + }} + /> + )} + +
+
+ 0}> + {language.t("settings.projects.other")} + } + > + + + +
+ + {(project) => ( + (focus = project().worktree)} + /> + )} + +
+
+
From 067b741783c5b8a3a4e898d82ff65d9c0a473aae Mon Sep 17 00:00:00 2001 From: James Long Date: Thu, 29 Oct 2026 18:23:04 -0400 Subject: [PATCH 14/83] refactor(client): share the persistent pty protocol (#60323) --- packages/client/src/solid/pty.ts | 47 ++++++++ .../client/test/solid-pty-protocol.test.ts | 113 ++++++++++++++++++ packages/tui/src/component/terminal-pane.tsx | 55 ++------- 3 files changed, 172 insertions(+), 43 deletions(-) create mode 100644 packages/client/test/solid-pty-protocol.test.ts diff --git a/packages/client/src/solid/pty.ts b/packages/client/src/solid/pty.ts index 1dc7afd63099..b911b114608b 100644 --- a/packages/client/src/solid/pty.ts +++ b/packages/client/src/solid/pty.ts @@ -1,5 +1,52 @@ +import { PersistentPty } from "@opencode/schema/persistent-pty" +import { Schema } from "effect" import type { ExperimentalPersistentPtyConnectTokenInput, OpenCodeClient, PtyConnectTokenInput } from "../promise" +// Declares only the fields clients read, so servers can add or drop the rest without a client silently ignoring a +// message it depends on. +export const PersistentPtyMessage = Schema.Union([ + Schema.Struct({ + type: Schema.Literal("attached"), + inputProtocol: Schema.optional(Schema.Number), + info: Schema.Struct({ size: PersistentPty.Info.fields.size }), + role: Schema.optional(Schema.Literals(["controller", "observer"])), + }), + Schema.Struct({ type: Schema.Literal("replay_complete") }), + Schema.Struct({ + type: Schema.Literal("resized"), + cols: Schema.Number, + rows: Schema.Number, + checkpoint: Schema.String, + }), + Schema.Struct({ + type: Schema.Literal("controller_changed"), + attachmentID: Schema.optional(Schema.NullOr(Schema.String)), + }), + Schema.Struct({ + type: Schema.Literal("exited"), + exitCode: Schema.optional(Schema.NullOr(Schema.Number)), + }), + Schema.Struct({ type: Schema.Literal("title_changed"), title: Schema.String }), + Schema.Struct({ type: Schema.Literal("foreground_process_changed"), process: Schema.NullOr(Schema.String) }), +]) +export type PersistentPtyMessage = typeof PersistentPtyMessage.Type + +const decodeMessage = Schema.decodeUnknownOption(Schema.fromJsonString(PersistentPtyMessage)) + +export function decodePersistentPtyMessage(text: string) { + return decodeMessage(text) +} + +export function persistentPtyFrame(size: { cols: number; rows: number }, data?: Uint8Array) { + const frame = new Uint8Array(5 + (data?.byteLength ?? 0)) + const view = new DataView(frame.buffer) + frame[0] = data ? 1 : 0 + view.setUint16(1, size.cols) + view.setUint16(3, size.rows) + if (data) frame.set(data, 5) + return frame +} + export type PtyClientOptions = { readonly url: string readonly openSocket?: (url: URL) => WebSocket diff --git a/packages/client/test/solid-pty-protocol.test.ts b/packages/client/test/solid-pty-protocol.test.ts new file mode 100644 index 000000000000..fdcb45e75d0a --- /dev/null +++ b/packages/client/test/solid-pty-protocol.test.ts @@ -0,0 +1,113 @@ +import { describe, expect, test } from "bun:test" +import { Option } from "effect" +import { decodePersistentPtyMessage, persistentPtyFrame } from "../src/solid" + +const info = { + id: "pty_1", + title: "zsh", + command: "/bin/zsh", + args: [], + cwd: "/repo", + status: "running", + pid: 42, + sessionID: "ses_1", + foregroundProcess: null, + size: { cols: 80, rows: 24 }, + output: { head: 0, tail: 128 }, +} + +const decode = (value: object) => Option.getOrUndefined(decodePersistentPtyMessage(JSON.stringify(value))) + +describe("decodePersistentPtyMessage", () => { + test("decodes every message the server sends, keeping only the fields clients read", () => { + const replay = { requestedOffset: 128, availableOffset: 0, endOffset: 256, truncated: false } + + expect( + [ + { type: "attached", inputProtocol: 1, info, role: "controller", generation: 3, replay }, + { type: "replay_complete", endOffset: 256 }, + { type: "resized", cols: 100, rows: 30, generation: 4, checkpoint: "G2M=" }, + { type: "controller_changed", attachmentID: "attachment-1", generation: 5 }, + { type: "exited", exitCode: 0, finalOffset: 512 }, + { type: "title_changed", title: "vim" }, + { type: "foreground_process_changed", process: "vim" }, + { type: "foreground_process_changed", process: null }, + ].map(decode), + ).toEqual([ + { type: "attached", inputProtocol: 1, info: { size: info.size }, role: "controller" }, + { type: "replay_complete" }, + { type: "resized", cols: 100, rows: 30, checkpoint: "G2M=" }, + { type: "controller_changed", attachmentID: "attachment-1" }, + { type: "exited", exitCode: 0 }, + { type: "title_changed", title: "vim" }, + { type: "foreground_process_changed", process: "vim" }, + { type: "foreground_process_changed", process: null }, + ]) + }) + + test("reads only the size from attached terminal info, whatever else the server version sends", () => { + const attached = (terminal: object) => ({ type: "attached", inputProtocol: 1, info: terminal, role: "controller" }) + + expect(decode(attached(info))).toEqual(attached({ size: info.size })) + expect(decode(attached({ ...info, userTitle: "build", sessionID: "dummy" }))).toEqual(attached({ size: info.size })) + expect(decode(attached({ id: "pty_1" }))).toBeUndefined() + }) + + test("decodes minimal messages and the fields JSON.stringify drops", () => { + expect(decode({ type: "attached", info: { size: info.size } })).toEqual({ + type: "attached", + info: { size: info.size }, + }) + expect(decode({ type: "replay_complete" })).toEqual({ type: "replay_complete" }) + expect(decode({ type: "controller_changed", generation: 5 })).toEqual({ type: "controller_changed" }) + expect(decode({ type: "controller_changed", attachmentID: null })).toEqual({ + type: "controller_changed", + attachmentID: null, + }) + expect(decode({ type: "exited", finalOffset: 512 })).toEqual({ type: "exited" }) + expect(decode({ type: "exited", exitCode: null })).toEqual({ type: "exited", exitCode: null }) + }) + + test("ignores fields it does not know", () => { + expect(decode({ type: "title_changed", title: "vim", extra: true })).toEqual({ + type: "title_changed", + title: "vim", + }) + }) + + test("returns None for unknown message types", () => { + expect(Option.isNone(decodePersistentPtyMessage(JSON.stringify({ type: "future_message", value: 1 })))).toBe(true) + }) + + test("returns None for malformed input", () => { + const inputs = [ + "", + "not json", + "null", + "42", + JSON.stringify({ endOffset: 1 }), + JSON.stringify({ type: "resized", cols: "100", rows: 30, generation: 4, checkpoint: "" }), + JSON.stringify({ type: "resized", cols: 100, rows: 30, generation: 4 }), + JSON.stringify({ type: "attached", inputProtocol: 1, role: "controller", generation: 1 }), + JSON.stringify({ type: "foreground_process_changed" }), + ] + + expect(inputs.map((input) => Option.isNone(decodePersistentPtyMessage(input)))).toEqual(inputs.map(() => true)) + }) +}) + +describe("persistentPtyFrame", () => { + test("encodes a size-only interaction frame", () => { + expect(Array.from(persistentPtyFrame({ cols: 300, rows: 24 }))).toEqual([0, 1, 44, 0, 24]) + }) + + test("encodes an input frame with its data", () => { + expect(Array.from(persistentPtyFrame({ cols: 80, rows: 513 }, new Uint8Array([104, 105])))).toEqual([ + 1, 0, 80, 2, 1, 104, 105, + ]) + }) + + test("encodes empty input as an input frame", () => { + expect(Array.from(persistentPtyFrame({ cols: 80, rows: 24 }, new Uint8Array()))).toEqual([1, 0, 80, 0, 24]) + }) +}) diff --git a/packages/tui/src/component/terminal-pane.tsx b/packages/tui/src/component/terminal-pane.tsx index 596926901c52..2c0a1c39ba29 100644 --- a/packages/tui/src/component/terminal-pane.tsx +++ b/packages/tui/src/component/terminal-pane.tsx @@ -1,6 +1,8 @@ import { EmbeddedTerminalRenderable, type RGBA } from "@opentui/core" +import { decodePersistentPtyMessage, persistentPtyFrame } from "@opencode/client/solid" import { rgbToOklch, type ResolvedThemeTokens } from "@opencode/theme/tui" import { extend, useRenderer } from "@opentui/solid" +import { Option } from "effect" import { createEffect, createSignal, onCleanup, onMount, Show } from "solid-js" import { useClient } from "../context/client" import { Keymap } from "../context/keymap" @@ -77,7 +79,7 @@ export function TerminalPane(props: { return } if (!size) return - send(interactionFrame(size)) + send(persistentPtyFrame(size)) } createEffect(() => { @@ -89,7 +91,7 @@ export function TerminalPane(props: { pendingInput.push(data) return } - if (size) send(interactionFrame(size, data)) + if (size) send(persistentPtyFrame(size, data)) } onCleanup(terminals.attachWriter(props.ptyID, sendInput)) @@ -206,21 +208,14 @@ export function TerminalPane(props: { return } if (typeof event.data !== "string") return - const message: unknown = JSON.parse(event.data) - if (!message || typeof message !== "object" || !("type" in message)) return + const decoded = decodePersistentPtyMessage(event.data) + if (Option.isNone(decoded)) return + const message = decoded.value if (message.type === "exited") { exited = true return } - if ( - message.type === "resized" && - "cols" in message && - typeof message.cols === "number" && - "rows" in message && - typeof message.rows === "number" && - "checkpoint" in message && - typeof message.checkpoint === "string" - ) { + if (message.type === "resized") { enqueue({ type: "resize", size: { cols: message.cols, rows: message.rows }, @@ -232,36 +227,20 @@ export function TerminalPane(props: { enqueue({ type: "ready" }) return } - if ( - message.type === "controller_changed" && - "attachmentID" in message && - (typeof message.attachmentID === "string" || message.attachmentID === undefined) - ) { + if (message.type === "controller_changed") { const previous = controller controller = message.attachmentID === attachmentID if (controller && !previous && restored) interact() return } if (message.type !== "attached") return - if (!("inputProtocol" in message) || message.inputProtocol !== 1) { + if (message.inputProtocol !== 1) { setFailure("Persistent terminal server is out of date; restart OpenCode") next.close() return } - if ( - "info" in message && - message.info && - typeof message.info === "object" && - "size" in message.info && - message.info.size && - typeof message.info.size === "object" && - "cols" in message.info.size && - typeof message.info.size.cols === "number" && - "rows" in message.info.size && - typeof message.info.size.rows === "number" - ) - enqueue({ type: "resize", size: { cols: message.info.size.cols, rows: message.info.size.rows } }) - controller = "role" in message && message.role === "controller" + enqueue({ type: "resize", size: { cols: message.info.size.cols, rows: message.info.size.rows } }) + controller = message.role === "controller" attached = true }) next.addEventListener("error", () => { @@ -396,13 +375,3 @@ function hex(color: RGBA) { .map((value) => value.toString(16).padStart(2, "0")) .join("")}` } - -function interactionFrame(size: { cols: number; rows: number }, data?: Uint8Array) { - const frame = new Uint8Array(5 + (data?.byteLength ?? 0)) - const view = new DataView(frame.buffer) - frame[0] = data ? 1 : 0 - view.setUint16(1, size.cols) - view.setUint16(3, size.rows) - if (data) frame.set(data, 5) - return frame -} From dc0bfc5ea4691679d4bd936d202403a2fd69ec3f Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Thu, 29 Oct 2026 15:29:19 -0700 Subject: [PATCH 15/83] fix(core): check redirects, PowerShell method calls, and dynamic directory changes (#60376) --- packages/core/src/schedule/check.ts | 2 +- packages/core/src/shell/parse.ts | 296 +++++++++++++++--- packages/core/src/shell/scan.ts | 200 +++++++++--- packages/core/test/permission.test.ts | 80 ++++- .../test/shell-parse-compatibility.test.ts | 109 +++++-- packages/core/test/shell-parse-parity.test.ts | 31 +- packages/core/test/shell-parse-syntax.test.ts | 8 +- packages/core/test/shell-parse.test.ts | 61 +++- .../core/test/shell-scan/bash-safety.test.ts | 61 ++-- .../core/test/shell-scan/bash-syntax.test.ts | 17 +- .../test/shell-scan/compound-parity.test.ts | 9 +- packages/core/test/shell-scan/oracle.test.ts | 2 +- .../shell-scan/parity-regressions.test.ts | 29 +- .../test/shell-scan/powershell-syntax.test.ts | 20 ++ .../core/test/shell-scan/redirect.test.ts | 86 ++--- packages/core/test/shell-scan/scan.test.ts | 6 +- packages/core/test/tool-shell.test.ts | 19 +- packages/schema/src/config/experimental.ts | 2 +- 18 files changed, 788 insertions(+), 250 deletions(-) diff --git a/packages/core/src/schedule/check.ts b/packages/core/src/schedule/check.ts index aea13b2ee3ad..d628e29d4ae0 100644 --- a/packages/core/src/schedule/check.ts +++ b/packages/core/src/schedule/check.ts @@ -344,7 +344,7 @@ const scanShell = Effect.fnUntraced(function* (command: string) { .resolve({ path: location.directory, kind: "directory" }) .pipe(Effect.mapError((error) => error.message)) const shell = yield* shellSelect.resolve({ priority: "compat" }) - const parsed = yield* ShellParse.scanPortable(command, shell, target.absolute).pipe( + const parsed = yield* ShellParse.scan(command, shell, target.absolute).pipe( Effect.mapError((error) => error.message), ) const directories = yield* Effect.forEach(parsed.directories, (directory) => diff --git a/packages/core/src/shell/parse.ts b/packages/core/src/shell/parse.ts index 356fbb6705af..ef0f25c20756 100644 --- a/packages/core/src/shell/parse.ts +++ b/packages/core/src/shell/parse.ts @@ -1,16 +1,19 @@ export * as ShellParse from "./parse.js" -import { Effect } from "effect" +import { Effect, Result } from "effect" +import fs from "fs" import os from "os" import path from "path" import { ShellScan } from "./scan.js" import { ShellSelect } from "./select.js" import { Wildcard } from "../util/wildcard.js" -type Part = { type: string; text: string; unquotedTilde?: boolean } +type Part = { type: string; text: string; raw: string; unquotedTilde?: boolean } const CWD = new Set(["cd", "chdir", "popd", "pushd", "push-location", "set-location"]) const POWERSHELL_PATH_FLAG_RE = /^-(?:p(?:ath|at|a)?|lp|l(?:i(?:t(?:e(?:r(?:a(?:l(?:p(?:a(?:t(?:h)?)?)?)?)?)?)?)?)?)?|psp(?:a(?:t(?:h)?)?)?):?$/i +const POWERSHELL_LITERAL_FLAG_RE = /^-(?:lp|l(?:i(?:t(?:e(?:r(?:a(?:l(?:p(?:a(?:t(?:h)?)?)?)?)?)?)?)?)?)?|psp(?:a(?:t(?:h)?)?)?):?$/i +const POWERSHELL_STACK_FLAG_RE = /^-(?:stack(?:name|nam|na|n)?|st):?$/i export type Result = { commands: Array<{ resource: string; save: string }> @@ -172,6 +175,13 @@ export function scan(command: string, shell: string, cwd: string): Effect.Effect for (const item of scanned.commands) { // Declarations are skipped as standalone permission resources, while nested substitutions remain. if (item.declaration) continue + if (item.redirectPrefixEnd !== undefined) { + const head = item.resource.slice(0, item.redirectPrefixEnd) + const next = item.resource[item.redirectPrefixEnd] + const separator = next === "\t" || next === "\n" ? next : " " + output.commands.push({ resource: item.resource, save: `${head}${separator}*` }) + continue + } const words = item.redirectWordCount === undefined ? item.rawWords : item.rawWords.slice(0, item.redirectWordCount) // Bare statement-head foreach blocks act as PowerShell control flow rather than cmdlet invocations. if ( @@ -186,29 +196,33 @@ export function scan(command: string, shell: string, cwd: string): Effect.Effect ? words.flatMap((raw, index): Part[] => { const text = !raw.includes("`$") && /['"`]/.test(raw) ? (item.words[index] ?? raw) : raw.replaceAll("`$", "\0") - if (!/^-[A-Za-z_?][\w?-]*(?::|$)/.test(raw)) return [{ type: "word", text }] + if (!/^-[A-Za-z_?][\w?-]*(?::|$)/.test(raw)) return [{ type: "word", text, raw }] const colon = text.indexOf(":") - if (colon >= 0) + if (colon >= 0) { + const rawColon = raw.indexOf(":") return colon + 1 < text.length ? [ - { type: "command_parameter", text: text.slice(0, colon) }, - { type: "word", text: text.slice(colon + 1) }, + { type: "command_parameter", text: text.slice(0, colon), raw: raw.slice(0, rawColon) }, + { type: "word", text: text.slice(colon + 1), raw: rawColon >= 0 ? raw.slice(rawColon + 1) : raw }, ] - : [{ type: "command_parameter", text: text.slice(0, colon) }] - return [{ type: "command_parameter", text }] + : [{ type: "command_parameter", text: text.slice(0, colon), raw }] + } + return [{ type: "command_parameter", text, raw }] }) : item.rawWords.map((raw, index): Part => { const word = item.words[index] ?? raw return { type: "word", text: isStaticBashWord(raw) ? word.replaceAll("$", "\0") : "$", + raw, unquotedTilde: raw.startsWith("~"), } }) - const directoryCommand = unwrapDirectoryCommand(words, parts, powershell) + const directoryCommand = unwrapDirectoryCommand(powershell ? words : item.rawWords, parts, powershell) if (directoryCommand) { - output.directories.push(...directoryArgs(directoryCommand, powershell, cwd, shell)) - if (directoryCommand === parts) continue + const resolved = directoryArgs(directoryCommand, powershell, cwd, shell) + output.directories.push(...resolved.directories) + if (directoryCommand === parts && resolved.complete) continue } const selected = prefix(words.slice(0, PREFIX_LENGTH)) const conventional = `${selected.join(" ")} *` @@ -217,14 +231,16 @@ export function scan(command: string, shell: string, cwd: string): Effect.Effect const save = !powershell || end === undefined || Wildcard.match(item.resource, conventional) ? conventional - : (() => { - const boundary = - item.wordEnds?.find( - (value) => value >= end && (value >= item.resource.length || /\s/.test(item.resource[value])), - ) ?? end - const separator = /^\s+(?:`(?:\r\n|\r|\n)\s*)?/.exec(item.resource.slice(boundary))?.[0] - return `${item.resource.slice(0, boundary)}${separator ?? " "}*` - })() + : item.resource[end] === "(" + ? `${item.resource.slice(0, end)}(*` + : (() => { + const boundary = + item.wordEnds?.find( + (value) => value >= end && (value >= item.resource.length || /\s/.test(item.resource[value])), + ) ?? end + const separator = /^\s+(?:`(?:\r\n|\r|\n)\s*)?/.exec(item.resource.slice(boundary))?.[0] + return `${item.resource.slice(0, boundary)}${separator ?? " "}*` + })() output.commands.push({ resource: item.resource, save, @@ -234,8 +250,6 @@ export function scan(command: string, shell: string, cwd: string): Effect.Effect }) } -export const scanPortable = scan - function unwrapDirectoryCommand(rawWords: string[], parts: Part[], powershell: boolean) { const head = powershell ? rawWords[0]?.toLowerCase() : rawWords[0] if (CWD.has(head ?? "")) return parts @@ -256,24 +270,58 @@ function unwrapDirectoryCommand(rawWords: string[], parts: Part[], powershell: b function isStaticBashWord(raw: string) { let quote: "'" | '"' | "$'" | undefined + let segmentStarted = false + let segmentLeadingDot = false + let segmentGlob = false + let hasAnsiEscape = false + let hasUnquotedGlob = false + const braces: boolean[] = [] + const recordChar = (char: string, unquotedGlob = false) => { + if (unquotedGlob) hasUnquotedGlob = true + if (hasAnsiEscape && hasUnquotedGlob) return false + if (char === "/") { + segmentStarted = false + segmentLeadingDot = false + segmentGlob = false + return true + } + if (!segmentStarted) { + segmentStarted = true + segmentLeadingDot = char === "." + } + if (unquotedGlob) segmentGlob = true + return !(segmentLeadingDot && segmentGlob) + } + for (let index = 0; index < raw.length; index++) { const char = raw[index] const next = raw[index + 1] ?? "" if (quote === "'") { - if (char === "'") quote = undefined + if (char === "'") { + quote = undefined + continue + } + if (!recordChar(char)) return false continue } if (quote === "$'") { if (char === "\\") { + hasAnsiEscape = true + if (hasUnquotedGlob) return false index++ continue } - if (char === "'") quote = undefined + if (char === "'") { + quote = undefined + continue + } + if (!recordChar(char)) return false continue } if (quote === '"') { if (char === "\\" && '$`"\\\n'.includes(next)) { index++ + if (next !== "\n" && !recordChar(next)) return false continue } if (char === '"') { @@ -282,10 +330,12 @@ function isStaticBashWord(raw: string) { } if (char === "`" || (char === "$" && (/[A-Za-z_0-9@*#?$!({[-]/.test(next) || raw.startsWith("\\\n", index + 1)))) return false + if (!recordChar(char)) return false continue } if (char === "\\") { index++ + if (next !== "\n" && !recordChar(next)) return false continue } if (char === "'") { @@ -312,53 +362,165 @@ function isStaticBashWord(raw: string) { (char === "$" && (/[A-Za-z_0-9@*#?$!({[-]/.test(next) || raw.startsWith("\\\n", index + 1))) ) return false + if (char === "{") { + braces.push(false) + if (!recordChar(char)) return false + continue + } + if (braces.length > 0 && (char === "," || (char === "." && next === "."))) { + braces[braces.length - 1] = true + } + if (char === "}" && braces.length > 0) { + if (braces.pop()) return false + if (!recordChar(char)) return false + continue + } + if (!recordChar(char, char === "*" || char === "?" || char === "[")) return false } return quote === undefined } +function hasPowerShellDotWildcard(raw: string) { + let quote: "'" | '"' | undefined + let segmentStarted = false + let segmentLeadingDot = false + let segmentGlob = false + let hasQuoteEscape = false + let hasUnquotedGlob = false + const recordChar = (char: string, unquotedGlob = false) => { + if (unquotedGlob) hasUnquotedGlob = true + if (hasQuoteEscape && hasUnquotedGlob) return true + if (char === "/" || char === "\\") { + segmentStarted = false + segmentLeadingDot = false + segmentGlob = false + return false + } + if (!segmentStarted) { + segmentStarted = true + segmentLeadingDot = char === "." + } + if (unquotedGlob) segmentGlob = true + return segmentLeadingDot && segmentGlob + } + + for (let index = 0; index < raw.length; index++) { + const char = raw[index] + const next = raw[index + 1] ?? "" + if (quote === "'") { + if (char === "'" && next === "'") { + index++ + if (recordChar("'")) return true + continue + } + if (char === "'") { + quote = undefined + continue + } + if (recordChar(char)) return true + continue + } + if (quote === '"') { + if (char === "`") { + hasQuoteEscape = true + if (hasUnquotedGlob) return true + index++ + continue + } + if (char === '"' && next === '"') { + index++ + if (recordChar('"')) return true + continue + } + if (char === '"') { + quote = undefined + continue + } + if (recordChar(char)) return true + continue + } + if (char === "`") { + index++ + if (recordChar(next)) return true + continue + } + if (char === "'" || char === '"') { + quote = char + continue + } + if (recordChar(char, char === "*" || char === "?" || char === "[")) return true + } + return false +} + function directoryArgs(command: Part[], powershell: boolean, cwd: string, shell: string) { + const head = command[0]?.text.toLowerCase() ?? "" + if (head === "popd" || head === "pop-location") return { directories: [], complete: false } + if (!powershell) { let endOfOptions = false - return command - .slice(1) - .filter((part) => { - if (endOfOptions) return true - if (part.text === "--") { - endOfOptions = true - return false - } - return !part.text.startsWith("-") - }) - .map((part) => directoryArgument(part.text, powershell, cwd, shell, part.unquotedTilde)) - .filter((part) => part !== undefined) + const operands = command.slice(1).filter((part) => { + if (endOfOptions) return true + if (part.text === "--") { + endOfOptions = true + return false + } + if (part.text === "-") return true + return !part.text.startsWith("-") + }) + if (operands.length === 0) return { directories: [], complete: false } + const resolved = operands.map((part) => + part.text === "-" ? undefined : directoryArgument(part.text, false, cwd, shell, part.unquotedTilde), + ) + const directories = resolved.filter((item): item is string => item !== undefined) + return { directories, complete: directories.length === operands.length } } const directories: string[] = [] - let path = false + let pathFlag = false + let literalFlag = false let endOfParameters = false + let sawOperand = false + let complete = true for (const part of command.slice(1)) { if (!endOfParameters && part.text === "--") { endOfParameters = true continue } - if (path) { - const value = directoryArgument(part.text, powershell, cwd, shell) + if (pathFlag) { + sawOperand = true + const value = + !literalFlag && (hasPowerShellDotWildcard(part.raw) || part.text === "-" || part.text === "+") + ? undefined + : directoryArgument(part.text, true, cwd, shell) if (value) directories.push(value) - path = false + if (!value) complete = false + pathFlag = false + literalFlag = false continue } if (!endOfParameters && part.type === "command_parameter") { - path = POWERSHELL_PATH_FLAG_RE.test(part.text) + if (POWERSHELL_STACK_FLAG_RE.test(part.text)) { + complete = false + return { directories, complete } + } + pathFlag = POWERSHELL_PATH_FLAG_RE.test(part.text) + literalFlag = POWERSHELL_LITERAL_FLAG_RE.test(part.text) continue } - const value = directoryArgument(part.text, powershell, cwd, shell) + sawOperand = true + const value = + hasPowerShellDotWildcard(part.raw) || (!endOfParameters && (part.raw === "-" || part.raw === "+")) + ? undefined + : directoryArgument(part.text, true, cwd, shell) if (value) directories.push(value) + if (!value) complete = false } - return directories + return { directories, complete: sawOperand && complete } } function directoryArgument(value: string, powershell: boolean, cwd: string, shell: string, unquotedTilde = false) { - if (!powershell) return expandKnownDirectory(value, false, unquotedTilde) + if (!powershell) return expandKnownDirectory(value, false, cwd, unquotedTilde) const quote = value[0] const text = (quote === '"' || quote === "'") && value.at(-1) === quote ? value.slice(1, -1) : value @@ -375,10 +537,11 @@ function directoryArgument(value: string, powershell: boolean, cwd: string, shel return path.dirname(shell) }), true, + cwd, ) } -function expandKnownDirectory(value: string, powershell: boolean, unquotedTilde = false) { +function expandKnownDirectory(value: string, powershell: boolean, cwd: string, unquotedTilde = false) { // Unknown shell expressions cannot be resolved safely during permission analysis. if (value.includes("$") || value.includes("`") || (powershell && value.startsWith("("))) return const resolved = value.replaceAll("\0", "$") @@ -387,21 +550,52 @@ function expandKnownDirectory(value: string, powershell: boolean, unquotedTilde return path.join(os.homedir(), resolved.slice(2)) } if (unquotedTilde && process.platform !== "win32") { - const userMatch = /^~([A-Za-z0-9._-]+)(?=$|\/)/.exec(resolved) + if (resolved === "~+") return cwd + if (resolved.startsWith("~+/")) return path.join(cwd, resolved.slice(3)) + if (/^~(?:[-+](?:\d+)?|\d+)(?=$|\/)/.test(resolved)) return + const userMatch = /^~([A-Za-z_][A-Za-z0-9._-]*)(?=$|\/)/.exec(resolved) if (userMatch) { const user = userMatch[1] - const home = - user === "root" - ? process.platform === "darwin" - ? "/var/root" - : "/root" - : path.join(process.platform === "darwin" ? "/Users" : "/home", user) + const home = resolveUserHome(user) + if (!home) return return path.join(home, resolved.slice(user.length + 1)) } } return resolved } +let cachedPasswdHomes: ReadonlyMap | undefined + +function passwdHomes() { + if (cachedPasswdHomes) return cachedPasswdHomes + const content = Result.try(() => fs.readFileSync("/etc/passwd", "utf8")) + const entries = Result.isSuccess(content) + ? content.success.split("\n").flatMap((line): Array<[string, string]> => { + if (!line || line.startsWith("#")) return [] + const fields = line.split(":") + const name = fields[0] + const home = fields[5] + return name && home ? [[name, home]] : [] + }) + : [] + cachedPasswdHomes = new Map(entries) + return cachedPasswdHomes +} + +function resolveUserHome(user: string) { + const current = Result.try(() => os.userInfo()) + if (Result.isSuccess(current) && current.success.username === user && current.success.homedir) { + return current.success.homedir + } + const fromPasswd = passwdHomes().get(user) + if (fromPasswd) return fromPasswd + if (process.platform === "darwin") { + const candidate = path.join("/Users", user) + const exists = Result.try(() => fs.statSync(candidate).isDirectory()) + if (Result.isSuccess(exists) && exists.success) return candidate + } +} + function environment(key: string) { if (process.platform !== "win32") return process.env[key] const name = Object.keys(process.env).find((item) => item.toLowerCase() === key.toLowerCase()) diff --git a/packages/core/src/shell/scan.ts b/packages/core/src/shell/scan.ts index bad56f3e95ba..a8ad405f9941 100644 --- a/packages/core/src/shell/scan.ts +++ b/packages/core/src/shell/scan.ts @@ -19,8 +19,10 @@ type Command = { wordEnds?: number[] statementHead?: true declaration?: true - // Words after a trailing redirect are destinations in the legacy command span. + // Words before the first redirect when redirects appear between arguments. redirectWordCount?: number + // Exclusive prefix end relative to resource for commandless or group redirects. + redirectPrefixEnd?: number } // Opaque describes a parsing limitation, not a permission decision. @@ -185,9 +187,8 @@ type BashState = { wordStart: number wordEnd: number commandStart: number | undefined - commandEnd: number - resourceEnd: number | undefined redirectWordCount: number | undefined + redirectPrefixEnd: number | undefined // Posix shells such as Dash read `&>` as `&` and `>`, so later words would start another command there. ampersandRedirectWords: number | undefined commandWordIndex: number @@ -195,8 +196,10 @@ type BashState = { assignmentHeadUnsafe: boolean invalid: OpaqueReason | undefined redirectTarget: boolean + dupRedirect: boolean hereString: boolean hasRedirect: boolean + hasFileRedirect: boolean compoundEnd: boolean // A list operator (&&, ||, |, |&) still awaits its right-hand command. dangling: boolean @@ -286,10 +289,14 @@ function finishBashWord(state: BashState) { state.words.push(state.word) // Unquoted trailing continuations are ignored syntax, not part of the raw token. state.rawWords.push(state.input.slice(state.wordStart, state.wordEnd)) - state.commandEnd = state.wordEnd } - if (state.hereString && state.resourceEnd === undefined) state.commandEnd = state.wordEnd + if (state.redirectTarget) { + if (!state.dupRedirect || !/^(?:\d+-?|-)$/.test(state.input.slice(state.wordStart, state.wordEnd))) + state.hasFileRedirect = true + state.redirectPrefixEnd ??= state.wordEnd + } state.redirectTarget = false + state.dupRedirect = false state.hereString = false state.word = "" state.literal = "" @@ -369,14 +376,15 @@ function finishBashCommand(state: BashState, boundary = false, newline = false) const inHeader = bashInHeader(state) if (name >= 0 && !state.words[name]) state.invalid ??= "invalid-structure" if (name >= 0 && !inHeader) { - const resource = state.input - .slice(state.commandStart, state.resourceEnd ?? state.wordEnd) - .replace(/^[ \t\n]+|[ \t\n]+$/g, "") + const resource = state.input.slice(state.commandStart, state.wordEnd).replace(/^[ \t\n]+|[ \t\n]+$/g, "") const command: Command = { resource, words: state.words.slice(name), rawWords: state.rawWords.slice(name), - ...(name === 0 && BASH_DECLARATIONS.has(state.rawWords[0]) && resource.startsWith(state.rawWords[0]) + ...(name === 0 && + !state.hasRedirect && + BASH_DECLARATIONS.has(state.rawWords[0]) && + resource.startsWith(state.rawWords[0]) ? { declaration: true as const } : {}), ...(state.redirectWordCount !== undefined && state.redirectWordCount < state.words.length @@ -424,11 +432,42 @@ function finishBashCommand(state: BashState, boundary = false, newline = false) for (const heredoc of state.heredocs) { if (heredoc.owned) continue heredoc.owned = true - if (newline && state.resourceEnd === undefined) { + if (newline) { heredoc.command = command heredoc.start = state.commandStart } } + } else if ( + name < 0 && + !inHeader && + state.commandStart !== undefined && + (state.hasFileRedirect || (state.hasRedirect && !state.compoundEnd)) + ) { + const rawSpan = state.input.slice(state.commandStart, state.wordEnd) + const leading = /^[ \t\n]+/.exec(rawSpan)?.[0].length ?? 0 + const resource = rawSpan.slice(leading).replace(/[ \t\n]+$/g, "") + if (resource) { + const prefixEnd = + state.redirectPrefixEnd !== undefined + ? Math.max(1, Math.min(resource.length, state.redirectPrefixEnd - state.commandStart - leading)) + : resource.length + const prefixToken = resource.slice(0, prefixEnd) + const command: Command = { + resource, + words: [prefixToken], + rawWords: [prefixToken], + redirectPrefixEnd: prefixEnd, + } + state.commands.push(command) + for (const heredoc of state.heredocs) { + if (heredoc.owned) continue + heredoc.owned = true + if (newline) { + heredoc.command = command + heredoc.start = state.commandStart + } + } + } } for (const heredoc of state.heredocs) heredoc.owned = true if (boundary && !state.words.length && !state.hasRedirect && !state.compoundEnd && !inHeader) @@ -440,9 +479,11 @@ function finishBashCommand(state: BashState, boundary = false, newline = false) state.rawWords.length = 0 state.commandWordIndex = -1 state.commandStart = undefined + state.dupRedirect = false state.hasRedirect = false - state.resourceEnd = undefined + state.hasFileRedirect = false state.redirectWordCount = undefined + state.redirectPrefixEnd = undefined state.ampersandRedirectWords = undefined state.compoundEnd = false state.dangling = false @@ -475,17 +516,18 @@ function scanBash( wordStart: start, wordEnd: start, commandStart: undefined, - commandEnd: start, - resourceEnd: undefined, redirectWordCount: undefined, + redirectPrefixEnd: undefined, ampersandRedirectWords: undefined, commandWordIndex: -1, assignmentWord: false, assignmentHeadUnsafe: false, invalid: undefined, redirectTarget: false, + dupRedirect: false, hereString: false, hasRedirect: false, + hasFileRedirect: false, compoundEnd: false, dangling: false, outer, @@ -681,8 +723,6 @@ function scanBashOperatorOrSeparator( const fdPrefix = state.wordStarted && !state.assignmentHeadUnsafe && /^(?:\d+|\{[A-Za-z_][A-Za-z0-9_]*\})$/.test(state.word) if (fdPrefix) { - // A continuation separates the legacy number token from the redirect descriptor. - if (state.wordEnd < index) state.commandEnd = state.wordEnd state.word = "" state.literal = "" state.output = "" @@ -690,23 +730,24 @@ function scanBashOperatorOrSeparator( } if (!fdPrefix) finishBashWord(state) if (redirect.startsWith("&") && context.dialect === "posix") state.ampersandRedirectWords ??= state.words.length - // Trailing redirects wrap a whole list/pipeline in the legacy grammar, not its last command. - // Prefix redirects remain part of the command, and later words remain redirect destinations. if (state.redirectWordCount === undefined && state.commandWordIndex >= 0) { state.redirectWordCount = state.words.length } - if (state.dangling && redirect !== "<<<" && state.commandWordIndex >= 0) { - state.resourceEnd ??= state.commandEnd - } if (redirect === "<<" || redirect === "<<-") { const delimiter = bashHeredocDelimiter(input, index + redirect.length, redirect === "<<-") if (!delimiter) return { kind: "opaque", reason: "invalid-redirect" } + state.hasFileRedirect = true + state.redirectPrefixEnd ??= + " \t".includes(input[index + redirect.length] ?? "") ? index + redirect.length : delimiter.end + 1 state.heredocs.push(delimiter) state.wordEnd = delimiter.end + 1 state.redirectTarget = false + state.dupRedirect = false return delimiter.end } + if (" \t\n".includes(input[index + redirect.length] ?? "")) state.redirectPrefixEnd ??= index + redirect.length state.redirectTarget = true + state.dupRedirect = redirect === "<&" || redirect === ">&" state.hereString = redirect === "<<<" return index + redirect.length - 1 } @@ -1838,6 +1879,9 @@ function scanPowerShellList( let clause: PowerShellClause = initialClause let after: "do" | "if" | "try" | undefined let indexable: false | "variable" | "closed" | "member" = false + let memberChainStart: number | undefined + let hasMemberAccess = false + let hasFileRedirect = false let stopParsing = false let commandEnd = start let statementHead = true @@ -1846,6 +1890,11 @@ function scanPowerShellList( let dangling = false let invocation = false + const resetMember = () => { + indexable = false + memberChainStart = undefined + hasMemberAccess = false + } const finishWord = (end: number) => { if (!started) return // Generic tokens can spell stop-parsing with escapes or embedded quotes; literal strings cannot. @@ -1861,7 +1910,7 @@ function scanPowerShellList( ) stopParsing = true if (!redirectTarget) { - if (!words.length && !invocation && !expression) segment = wordStart + if (!words.length && !invocation) segment = wordStart words.push(word) rawWords.push(input.slice(wordStart, end)) wordEnds.push(end) @@ -1874,13 +1923,13 @@ function scanPowerShellList( } const finishCommand = (end: number, required = false) => { finishWord(end) - if (words.length && !expression && !clause) + if (words.length && ((!expression && !clause) || hasFileRedirect)) commands.push({ resource: input.slice(segment, commandEnd).trimEnd(), words: [...words], rawWords: [...rawWords], wordEnds: wordEnds.map((value) => value - segment), - ...(statementHead && !invocation ? { statementHead: true as const } : {}), + ...(statementHead && !invocation && !expression && !clause ? { statementHead: true as const } : {}), }) else if ( (!expression && !clause && invocation) || @@ -1894,11 +1943,12 @@ function scanPowerShellList( rawWords.length = 0 wordEnds.length = 0 redirectTarget = false + hasFileRedirect = false invocation = false expression = initialExpression clause = initialClause after = undefined - indexable = false + resetMember() stopParsing = false } @@ -1960,8 +2010,13 @@ function scanPowerShellList( if (char === "'" || char === '"') { if (!started && words.length === 0 && !invocation) expression = true quote = char - standalone = atBoundary || (expression && !redirectTarget) || (indexable === "member" && /[.:]$/.test(word)) - if (!standalone) indexable = false + const dynamicMember = indexable === "member" && /[.:]$/.test(started ? word : (words.at(-1) ?? "")) + standalone = atBoundary || (expression && !redirectTarget) || dynamicMember + if (dynamicMember) hasMemberAccess = true + else if (standalone) { + memberChainStart = index + hasMemberAccess = false + } else resetMember() started = true continue } @@ -1973,7 +2028,7 @@ function scanPowerShellList( // At a token boundary escaped whitespace is trivia, not a new argument. else if (!atBoundary || !rawSpace) { started = true - indexable = false + if (!(indexable === "member" && /[\p{L}\p{Nl}\d_]/u.test(escape.value))) resetMember() word += escape.value } index = escape.end @@ -1998,7 +2053,7 @@ function scanPowerShellList( if (started) finishWord(index) const end = input.indexOf("#>", index + 2) if (end < 0) return { kind: "opaque", reason: "invalid-structure" } - if (!memberOperator) indexable = false + if (!memberOperator) resetMember() index = end + 1 continue } @@ -2035,7 +2090,8 @@ function scanPowerShellList( if (redirectTarget || words.length === 0 || (clause && clause !== "member")) return { kind: "opaque", reason: "invalid-redirect" } redirectTarget = !redirect.includes("&") - indexable = false + if (redirectTarget) hasFileRedirect = true + resetMember() index += redirect.length - 1 commandEnd = index + 1 continue @@ -2104,7 +2160,8 @@ function scanPowerShellList( rawWords.length = 0 wordEnds.length = 0 expression = false - indexable = false + hasFileRedirect = false + resetMember() if (!assign || char !== "=") index++ continue } @@ -2121,6 +2178,8 @@ function scanPowerShellList( started = true index = literal.end finishWord(index + 1) + memberChainStart = wordStart + hasMemberAccess = false indexable = "closed" continue } @@ -2128,7 +2187,15 @@ function scanPowerShellList( const end = powerShellBracedVariable(input, index, skipped) if (end === undefined) return { kind: "opaque", reason: "invalid-structure" } if (!started && !words.length && !invocation && hash !== "switch") expression = true - indexable = atBoundary || (indexable === "member" && /[.:]$/.test(word)) ? "closed" : false + const dynamicMember = indexable === "member" && /[.:]$/.test(started ? word : (words.at(-1) ?? "")) + if (dynamicMember) { + indexable = "closed" + hasMemberAccess = true + } else if (atBoundary) { + memberChainStart = index + hasMemberAccess = false + indexable = "closed" + } else resetMember() word += input.slice(index, end + 1) started = true index = end @@ -2149,7 +2216,17 @@ function scanPowerShellList( ? index : undefined if (opener !== undefined) { + const tokenIndex = index const openChar = input[opener] + const prevMemberWord = started ? word : (words.at(-1) ?? "") + const dynamicMemberOpener = indexable === "member" && /[.:]$/.test(prevMemberWord) + const priorIndexable = Boolean(indexable) + const isMethodCall = + char === "(" && + opener === tokenIndex && + memberChainStart !== undefined && + ((indexable === "member" && started && !/[.:]$/.test(word)) || + (indexable === "closed" && !started && hasMemberAccess)) const standaloneBlock = atBoundary || inExpression || char === "(" || openChar === "{" const blockClose = openChar === "(" ? ")" : openChar === "[" ? "]" : "}" const blockHash = @@ -2179,12 +2256,28 @@ function scanPowerShellList( started = true word += input.slice(index, result.end + 1) index = result.end - if (openChar === "[") { + if (isMethodCall && memberChainStart !== undefined) { + finishWord(index + 1) + const callResource = input.slice(memberChainStart, result.end + 1) + const head = input.slice(memberChainStart, opener) + const args = input.slice(opener, result.end + 1) + nestedCommands.push({ + resource: callResource, + words: [head, args], + rawWords: [head, args], + wordEnds: [head.length, callResource.length], + }) indexable = "closed" + hasMemberAccess = false + } else if (openChar === "[") { + indexable = "closed" + if (!priorIndexable) memberChainStart = tokenIndex if (input[index + 1] !== "[") finishWord(index + 1) } else if (standaloneBlock) { finishWord(index + 1) indexable = "closed" + if (!dynamicMemberOpener) memberChainStart = tokenIndex + hasMemberAccess = dynamicMemberOpener } if ((clause === "paren" && char === "(") || (clause && clause !== "paren" && char === "{")) { const completed = clause === "do" || clause === "if" || clause === "try" ? clause : undefined @@ -2210,8 +2303,9 @@ function scanPowerShellList( continue } if (/\s/.test(char) && char !== "\n" && char !== "\r") { + const memberOperator = indexable === "member" && /[.:]$/.test(started ? word : (words.at(-1) ?? "")) finishWord(index) - indexable = false + if (!memberOperator) resetMember() continue } const next = input[index + 1] @@ -2235,12 +2329,12 @@ function scanPowerShellList( if ((clause && clause !== "member") || prev.endsWith(",") || memberOperator) { finishWord(index) index += separator.length - 1 - if (!memberOperator) indexable = false + if (!memberOperator) resetMember() continue } if (!started && !words.length && !invocation) { index += separator.length - 1 - indexable = false + resetMember() continue } } @@ -2252,39 +2346,53 @@ function scanPowerShellList( } if (!started && !words.length && !invocation && hash !== "switch" && testAt(POWERSHELL_EXPRESSION_RE, input, index)) expression = true - if ((atBoundary || (indexable === "member" && /[.:]$/.test(word))) && char === "$") - indexable = testAt(POWERSHELL_INDEXABLE_VAR_RE, input, index + 1) ? "variable" : false - else if (indexable === "closed") + const prevMember = started ? word : (words.at(-1) ?? "") + if ((atBoundary || (indexable === "member" && /[.:]$/.test(prevMember))) && char === "$") { + if (testAt(POWERSHELL_INDEXABLE_VAR_RE, input, index + 1)) { + if (indexable === "member" && /[.:]$/.test(prevMember)) hasMemberAccess = true + else { + memberChainStart = index + hasMemberAccess = false + } + indexable = "variable" + } else resetMember() + } else if (indexable === "closed") { indexable = - (char === "." && input[index + 1] !== "." && !/\s/.test(input[index + 1] ?? "")) || - (!started && char === ":" && input[index + 1] === ":" && !/\s/.test(input[index + 2] ?? "")) || + (char === "." && input[index + 1] !== "." && (!/\s/.test(input[index + 1] ?? "") || inExpression)) || + (!started && char === ":" && input[index + 1] === ":") || (!started && char === "?" && input[index + 1] === "." && input[index + 2] !== "." && - !/\s/.test(input[index + 2] ?? "")) + (!/\s/.test(input[index + 2] ?? "") || inExpression)) ? "member" : !started && char === "?" && input[index + 1] === "[" ? "closed" : false - else if (indexable === "variable") + if (indexable === "member") hasMemberAccess = true + else if (!indexable) resetMember() + } else if (indexable === "variable") { indexable = - (char === "." && input[index + 1] !== "." && !/\s/.test(input[index + 1] ?? "")) || - (char === ":" && input[index + 1] === ":" && !/\s/.test(input[index + 2] ?? "")) + (char === "." && input[index + 1] !== "." && (!/\s/.test(input[index + 1] ?? "") || inExpression)) || + (char === ":" && input[index + 1] === ":") ? "member" : (char === "." && input[index + 1] === ".") || !/[\p{L}\p{Nl}\d_:?]/u.test(char) ? false : "variable" - else if (indexable === "member") + if (indexable === "member") hasMemberAccess = true + else if (!indexable) resetMember() + } else if (indexable === "member") { indexable = char === "." && input[index + 1] === "." ? false - : (char === "." && !/\s/.test(input[index + 1] ?? "")) || + : (char === "." && (!/\s/.test(input[index + 1] ?? "") || inExpression)) || (char === ":" && (input[index + 1] === ":" || input[index - 1] === ":")) || (char === "?" && input[index + 1] === "." && input[index + 2] !== ".") || /[\p{L}\p{Nl}\d_]/u.test(char) ? "member" : false + if (!indexable) resetMember() + } after = undefined started = true dangling = false diff --git a/packages/core/test/permission.test.ts b/packages/core/test/permission.test.ts index 99340d1f90cc..442c1bea06ae 100644 --- a/packages/core/test/permission.test.ts +++ b/packages/core/test/permission.test.ts @@ -521,9 +521,9 @@ describe("shell scanner permission impact", () => { command: "printf ok && git status > output", approved: ["printf *", "git status *"], exact: ["printf ok", "git status"], - denied: "git status", + denied: "git status *", savedEffect: ["allow", "allow"], - exactEffect: ["allow", "allow"], + exactEffect: ["allow", "ask"], deniedEffect: ["deny", "deny"], }, { @@ -532,9 +532,9 @@ describe("shell scanner permission impact", () => { command: "printf ok | cat < input > output", approved: ["printf *", "cat *"], exact: ["printf ok", "cat"], - denied: "cat", + denied: "cat *", savedEffect: ["allow", "allow"], - exactEffect: ["allow", "allow"], + exactEffect: ["allow", "ask"], deniedEffect: ["deny", "deny"], }, { @@ -543,10 +543,10 @@ describe("shell scanner permission impact", () => { command: "FOO=bar > output; printf done", approved: ["printf *"], exact: ["printf done"], - denied: "FOO=bar > output; printf done", - savedEffect: ["ask", "allow"], - exactEffect: ["ask", "allow"], - deniedEffect: ["deny", "allow"], + denied: "FOO=bar > output", + savedEffect: ["ask", "ask"], + exactEffect: ["ask", "ask"], + deniedEffect: ["deny", "deny"], }, { name: "assignment redirect with an approved command substitution", @@ -555,9 +555,9 @@ describe("shell scanner permission impact", () => { approved: ["git describe *"], exact: ["git describe --tags"], denied: "VERSION=$(git describe --tags) > build/version.txt", - savedEffect: ["ask", "allow"], - exactEffect: ["ask", "allow"], - deniedEffect: ["deny", "allow"], + savedEffect: ["ask", "ask"], + exactEffect: ["ask", "ask"], + deniedEffect: ["deny", "deny"], }, { name: "substitution in a saved prefix", @@ -603,6 +603,39 @@ describe("shell scanner permission impact", () => { exactEffect: ["allow", "ask"], deniedEffect: ["deny", "allow"], }, + { + name: "trailing redirect after list operator", + shell: "bash", + command: "true && cat > secret", + approved: ["true *", "cat *"], + exact: ["true", "cat"], + denied: "* > secret*", + savedEffect: ["allow", "allow"], + exactEffect: ["allow", "ask"], + deniedEffect: ["allow", "deny"], + }, + { + name: "commandless redirect write", + shell: "zsh", + command: ">> ~/.zshrc <<< 'x'", + approved: [">> *"], + exact: [">> ~/.zshrc <<< 'x'"], + denied: ">> *", + savedEffect: ["allow", "allow"], + exactEffect: ["allow", "allow"], + deniedEffect: ["deny", "deny"], + }, + { + name: "PowerShell .NET method invocation", + shell: "pwsh", + command: '[IO.File]::Delete("C:\\victim")', + approved: ["[IO.File]::Delete(*"], + exact: ['[IO.File]::Delete("C:\\victim")'], + denied: "*Delete(*", + savedEffect: ["allow", "allow"], + exactEffect: ["allow", "allow"], + deniedEffect: ["deny", "deny"], + }, ] as const) { for (const scenario of [ { name: "no approval", saved: [], rules: [], expected: ["ask", "ask"] }, @@ -718,14 +751,31 @@ describe("shell scanner permission impact", () => { name: "assignment redirect prefix", shell: "bash", command: "FOO=bar > output; printf done", - grants: [["printf *"], ["printf *"]], - // Identical saved rules cover only the native resource, regardless of which parser saved them. + grants: [ + ["printf *"], + ["FOO=bar > *", "printf *"], + ], repeat: [ ["ask", "allow"], ["ask", "allow"], ], - next: "printf next", - nextEffect: ["allow", "allow"], + next: "FOO=bar rm -rf /", + nextEffect: ["ask", "ask"], + }, + { + name: "PowerShell method prefix", + shell: "pwsh", + command: '[IO.File]::Delete("C:\\first")', + grants: [ + ["[IO.File]::Delete(*"], + ["[IO.File]::Delete(*"], + ], + repeat: [ + ["allow", "allow"], + ["allow", "allow"], + ], + next: '[IO.File]::WriteAllText("C:\\first", "x")', + nextEffect: ["ask", "ask"], }, { name: "PowerShell tab prefix", diff --git a/packages/core/test/shell-parse-compatibility.test.ts b/packages/core/test/shell-parse-compatibility.test.ts index bbabc602aa35..e08bd0154546 100644 --- a/packages/core/test/shell-parse-compatibility.test.ts +++ b/packages/core/test/shell-parse-compatibility.test.ts @@ -45,14 +45,37 @@ const compatibilityCases: Array<[string, string, Record, ShellPa "bash", "cd $HOME; pwd", { HOME: "/session-home" }, - { commands: [{ resource: "pwd", save: "pwd *" }], directories: [] }, + { + commands: [ + { resource: "cd $HOME", save: "cd *" }, + { resource: "pwd", save: "pwd *" }, + ], + directories: [], + }, + ], + [ + "bash", + "cd; pwd", + { HOME: "/session-home" }, + { + commands: [ + { resource: "cd", save: "cd *" }, + { resource: "pwd", save: "pwd *" }, + ], + directories: [], + }, ], - ["bash", "cd; pwd", { HOME: "/session-home" }, { commands: [{ resource: "pwd", save: "pwd *" }], directories: [] }], [ "bash", 'target=/outside; cd "$target"; pwd', {}, - { commands: [{ resource: "pwd", save: "pwd *" }], directories: [] }, + { + commands: [ + { resource: 'cd "$target"', save: "cd *" }, + { resource: "pwd", save: "pwd *" }, + ], + directories: [], + }, ], [ "bash", @@ -81,7 +104,18 @@ const compatibilityCases: Array<[string, string, Record, ShellPa {}, { commands: [{ resource: "FOO=bar git status", save: "git status *" }], directories: [] }, ], - ["bash", "HOME=/outside; cd; pwd", {}, { commands: [{ resource: "pwd", save: "pwd *" }], directories: [] }], + [ + "bash", + "HOME=/outside; cd; pwd", + {}, + { + commands: [ + { resource: "cd", save: "cd *" }, + { resource: "pwd", save: "pwd *" }, + ], + directories: [], + }, + ], ["bash", "CDPATH=/outside cd child", {}, { commands: [], directories: ["child"] }], [ "bash", @@ -103,7 +137,7 @@ const compatibilityCases: Array<[string, string, Record, ShellPa { commands: [ { resource: "printf ok", save: "printf *" }, - { resource: "git status", save: "git status *" }, + { resource: "git status > output", save: "git status *" }, ], directories: [], }, @@ -115,7 +149,7 @@ const compatibilityCases: Array<[string, string, Record, ShellPa { commands: [ { resource: "printf ok", save: "printf *" }, - { resource: "cat", save: "cat *" }, + { resource: "cat < input > output", save: "cat *" }, ], directories: [], }, @@ -126,7 +160,20 @@ const compatibilityCases: Array<[string, string, Record, ShellPa {}, { commands: [{ resource: "pwd", save: "pwd *" }], directories: ["-/../../../etc"] }, ], - ["bash", "cd -; pushd; popd; pwd", {}, { commands: [{ resource: "pwd", save: "pwd *" }], directories: [] }], + [ + "bash", + "cd -; pushd; popd; pwd", + {}, + { + commands: [ + { resource: "cd -", save: "cd *" }, + { resource: "pushd", save: "pushd *" }, + { resource: "popd", save: "popd *" }, + { resource: "pwd", save: "pwd *" }, + ], + directories: [], + }, + ], [ "bash", "command cd /outside; builtin cd /elsewhere", @@ -171,7 +218,10 @@ const compatibilityCases: Array<[string, string, Record, ShellPa "pwsh", "Set-Location $HOME; Set-Location $PWD; Set-Location $target", { HOME: "/session-home" }, - { commands: [], directories: [process.platform === "win32" ? os.homedir() : "/session-home", "/workspace"] }, + { + commands: [{ resource: "Set-Location $target", save: "Set-Location *" }], + directories: [process.platform === "win32" ? os.homedir() : "/session-home", "/workspace"], + }, ], [ "pwsh", @@ -209,8 +259,7 @@ const compatibilityCases: Array<[string, string, Record, ShellPa const command = ${JSON.stringify(command)} const shell = ${JSON.stringify(shell)} const scanned = await Effect.runPromise(ShellParse.scan(command, shell, "/workspace")) - const native = await Effect.runPromise(ShellParse.scanPortable(command, shell, "/workspace")) - console.log(JSON.stringify([scanned, native])) + console.log(JSON.stringify(scanned)) `, ], cwd: `${import.meta.dir}/..`, @@ -224,14 +273,11 @@ const compatibilityCases: Array<[string, string, Record, ShellPa child.exited, ]) expect(code, error).toBe(0) - const [scanned, native] = JSON.parse(output) - expect(scanned).toEqual(expected) - expect(native).toEqual(scanned) + expect(JSON.parse(output)).toEqual(expected) return } const scanned = await Effect.runPromise(ShellParse.scan(command, shell, "/workspace")) expect(scanned).toEqual(expected) - expect(await Effect.runPromise(ShellParse.scanPortable(command, shell, "/workspace"))).toEqual(scanned) }, ) @@ -243,7 +289,7 @@ const compatibilityCases: Array<[string, string, Record, ShellPa test("extracts inline PowerShell directory flags with case-insensitive names and quoted values", async () => { const result = await Effect.runPromise( - ShellParse.scanPortable( + ShellParse.scan( "Set-Location -LITERALPATH:C:\\outside; Set-Location -pAtH:'../other dir'; Set-Location -p:/short; Set-Location -lp /literal; Set-Location -l:/prefix; Set-Location -lit:/litprefix; Set-Location -pat:/patprefix; Set-Location -PSPath:/pspath; Set-Location '-outside'; Set-Location -/../../outside; Set-Location -Path -- -/../../outside2; Set-Location -- -outside2; Set-Location -`outside3; Set-Location \"../`$a/../outside4\"; Set-Location /out`side; Set-Location 'C:\\quoted'", "pwsh", "/workspace", @@ -274,7 +320,7 @@ const compatibilityCases: Array<[string, string, Record, ShellPa test("retains statement-head ForEach-Object cmdlet calls when non-scriptblock parameters are present", async () => { const result = await Effect.runPromise( - ShellParse.scanPortable("ForEach-Object -InputObject $proc -MemberName Kill", "pwsh", "/workspace"), + ShellParse.scan("ForEach-Object -InputObject $proc -MemberName Kill", "pwsh", "/workspace"), ) expect(result).toEqual({ commands: [{ resource: "ForEach-Object -InputObject $proc -MemberName Kill", save: "ForEach-Object *" }], @@ -286,16 +332,22 @@ const compatibilityCases: Array<[string, string, Record, ShellPa describe("scanner behavior on former tree-sitter gaps", () => { for (const fixture of [ { - name: "omits synthetic command nodes for an assignment with redirection", + name: "retains redirect resource for an assignment with redirection", shell: "bash", command: "FOO=bar > output", - expected: { commands: [], directories: [] }, + expected: { commands: [{ resource: "FOO=bar > output", save: "FOO=bar > *" }], directories: [] }, }, { - name: "retains nested executable commands without empty assignment command nodes", + name: "retains both redirect resource and nested executable commands on assignment redirection", shell: "bash", command: "FOO=$(printf value) > output", - expected: { commands: [{ resource: "printf value", save: "printf *" }], directories: [] }, + expected: { + commands: [ + { resource: "FOO=$(printf value) > output", save: "FOO=$(printf value) > *" }, + { resource: "printf value", save: "printf *" }, + ], + directories: [], + }, }, { name: "keeps numeric arguments in saved prefixes", @@ -357,13 +409,24 @@ describe("scanner behavior on former tree-sitter gaps", () => { command: "Set-Location a,b", expected: { commands: [], directories: ["a,b"] }, }, + { + name: "retains unresolved PowerShell stack, history, and dot-wildcard directory commands", + shell: "pwsh", + command: "Set-Location -StackName old; Set-Location -; Set-Location +; Set-Location .[.] ; Set-Location -LiteralPath '.[.]'", + expected: { + commands: [ + { resource: "Set-Location -StackName old", save: "Set-Location *" }, + { resource: "Set-Location -", save: "Set-Location *" }, + { resource: "Set-Location +", save: "Set-Location *" }, + { resource: "Set-Location .[.]", save: "Set-Location *" }, + ], + directories: [".[.]"], + }, + }, ]) { test(fixture.name, async () => { const scanned = await Effect.runPromise(ShellParse.scan(fixture.command, fixture.shell, "/workspace")) expect(scanned).toEqual(fixture.expected) - expect(await Effect.runPromise(ShellParse.scanPortable(fixture.command, fixture.shell, "/workspace"))).toEqual( - fixture.expected, - ) }) } }) diff --git a/packages/core/test/shell-parse-parity.test.ts b/packages/core/test/shell-parse-parity.test.ts index 1a842d35f031..dc392e2aba77 100644 --- a/packages/core/test/shell-parse-parity.test.ts +++ b/packages/core/test/shell-parse-parity.test.ts @@ -13,7 +13,6 @@ describe("ShellParse native parity", () => { const scanned = shell === "pwsh" ? ShellScan.scanPowerShell(command) : ShellScan.scan(command) expect(scanned.kind, context).toBe("scanned") const parsed = await Effect.runPromise(ShellParse.scan(command, shell, "/workspace")) - expect(await Effect.runPromise(ShellParse.scanPortable(command, shell, "/workspace")), context).toEqual(parsed) for (const item of parsed.commands) { if (!/^[A-Za-z_][A-Za-z0-9_]*=/.test(item.resource)) { expect(Wildcard.match(item.resource, item.save), context).toBe(true) @@ -50,22 +49,28 @@ describe("ShellParse native parity", () => { ["pwsh", "git status; npm run test; docker compose up"], ["pwsh", 'git "status"; npm "run" test; docker "compose" up'], ["pwsh", "Write-Output done # comment\nGet-ChildItem"], - ])("native resources, saved prefixes, and directories match in %s: %s", async (shell, command) => { + ])("extracts resources, saved prefixes, and directories in %s: %s", async (shell, command) => { const scanned = shell === "pwsh" ? ShellScan.scanPowerShell(command) : ShellScan.scan(command) expect(scanned.kind).toBe("scanned") - const native = await Effect.runPromise(ShellParse.scanPortable(command, shell, "/workspace")) - expect(await Effect.runPromise(ShellParse.scan(command, shell, "/workspace"))).toEqual(native) + await Effect.runPromise(ShellParse.scan(command, shell, "/workspace")) }) - test.each(["> output", "FOO=bar", "2>> output"])( - "returns an explicit empty result for statements without executable command nodes: %s", - async (command) => { - expect(ShellScan.scan(command)).toEqual({ kind: "scanned", commands: [] }) - const native = await Effect.runPromise(ShellParse.scanPortable(command, "bash", "/workspace")) - expect(native).toEqual({ commands: [], directories: [] }) - expect(await Effect.runPromise(ShellParse.scan(command, "bash", "/workspace"))).toEqual(native) - }, - ) + test("returns an explicit empty result for pure variable assignments without redirects", async () => { + expect(ShellScan.scan("FOO=bar")).toEqual({ kind: "scanned", commands: [] }) + expect(await Effect.runPromise(ShellParse.scan("FOO=bar", "bash", "/workspace"))).toEqual({ + commands: [], + directories: [], + }) + }) + + test.each([ + ["> output", [{ resource: "> output", save: "> *" }]], + ["2>> output", [{ resource: "2>> output", save: "2>> *" }]], + ] as const)("retains commandless redirects with matching saved prefixes: %s", async (command, commands) => { + const parsed = await Effect.runPromise(ShellParse.scan(command, "bash", "/workspace")) + expect(parsed).toEqual({ commands: [...commands], directories: [] }) + for (const item of parsed.commands) expect(Wildcard.match(item.resource, item.save)).toBe(true) + }) }) describe("ShellParse malformed native syntax", () => { diff --git a/packages/core/test/shell-parse-syntax.test.ts b/packages/core/test/shell-parse-syntax.test.ts index b24ff973fd14..c9711741518b 100644 --- a/packages/core/test/shell-parse-syntax.test.ts +++ b/packages/core/test/shell-parse-syntax.test.ts @@ -65,7 +65,7 @@ describe("native shell syntax compatibility", () => { "F='$HOME/bin'; SIZE=4096; N=$(( (SIZE + 1023) / 1024 )); echo $N", ])(`${shell} extracts commands without rejecting ordinary syntax: %s`, async (command) => { const scanned = await Effect.runPromise(ShellParse.scan(command, shell, "/workspace")) - expect(await Effect.runPromise(ShellParse.scanPortable(command, shell, "/workspace"))).toEqual(scanned) + expect(scanned.commands.length).toBeGreaterThanOrEqual(0) }) } @@ -89,7 +89,7 @@ describe("native shell syntax compatibility", () => { ).toEqual({ commands: [ { resource: "true", save: "true *" }, - { resource: "cat", save: "cat *" }, + { resource: "cat <<'EOF'", save: "cat *" }, { resource: "git status", save: "git status *" }, ], directories: [], @@ -125,7 +125,7 @@ describe("native shell syntax compatibility", () => { ).toEqual({ commands: [ { resource: "true", save: "true *" }, - { resource: "git add -p file.rs <<< $'n\\ny\\n'", save: "git add *" }, + { resource: "git add -p file.rs <<< $'n\\ny\\n' >/dev/null", save: "git add *" }, ], directories: [], }) @@ -196,6 +196,6 @@ describe("native shell syntax compatibility", () => { "git st`atus", ])("PowerShell extracts commands without rejecting ordinary syntax: %s", async (command) => { const scanned = await Effect.runPromise(ShellParse.scan(command, "pwsh", "/workspace")) - expect(await Effect.runPromise(ShellParse.scanPortable(command, "pwsh", "/workspace"))).toEqual(scanned) + for (const item of scanned.commands) expect(Wildcard.match(item.resource, item.save), item.resource).toBe(true) }) }) diff --git a/packages/core/test/shell-parse.test.ts b/packages/core/test/shell-parse.test.ts index bd1f4bd79378..44e882e4ee31 100644 --- a/packages/core/test/shell-parse.test.ts +++ b/packages/core/test/shell-parse.test.ts @@ -48,7 +48,7 @@ describe("ShellParse", () => { for (const command of commands) { const scanned = await Effect.runPromise(ShellParse.scan(command, "/bin/bash", "/workspace")) - expect(await Effect.runPromise(ShellParse.scanPortable(command, "/bin/bash", "/workspace"))).toEqual(scanned) + expect(scanned.commands.length).toBeGreaterThan(0) } }) @@ -165,9 +165,68 @@ describe("ShellParse", () => { process.platform === "darwin" ? "/var/root/secret" : "/root/secret", "~root", ]) + + const tildeForms = await Effect.runPromise( + ShellParse.scan( + "cd ~+/../outside && cd ~- && cd ~+1 && cd ~0 && cd ~__opencode_nonexistent_user__", + "/bin/bash", + "/workspace", + ), + ) + expect(tildeForms.directories).toEqual(["/outside"]) + expect(tildeForms.commands).toEqual([ + { resource: "cd ~-", save: "cd *" }, + { resource: "cd ~+1", save: "cd *" }, + { resource: "cd ~0", save: "cd *" }, + { resource: "cd ~__opencode_nonexistent_user__", save: "cd *" }, + ]) + + const dynamicCd = await Effect.runPromise( + ShellParse.scan("cd {..,x} && cd .[.] && cd .? && cd $'\\x2e'[.] && cd '.[.]'", "/bin/bash", "/workspace"), + ) + expect(dynamicCd.directories).toEqual([".[.]"]) + expect(dynamicCd.commands).toEqual([ + { resource: "cd {..,x}", save: "cd *" }, + { resource: "cd .[.]", save: "cd *" }, + { resource: "cd .?", save: "cd *" }, + { resource: "cd $'\\x2e'[.]", save: "cd *" }, + ]) + + const nobodyHome = await Effect.runPromise( + ShellParse.scan("cd ~nobody", "/bin/bash", "/workspace"), + ) + expect(nobodyHome.directories).toHaveLength(1) + expect(nobodyHome.directories[0]).not.toBe( + path.join(process.platform === "darwin" ? "/Users" : "/home", "nobody"), + ) } }) + test("retains commandless redirects, redirected declarations, and PowerShell method calls as permission resources", async () => { + const redirects = await Effect.runPromise( + ShellParse.scan(">> ~/.zshrc <<< 'x'; export -p > ~/.bashrc", "/bin/zsh", "/workspace"), + ) + expect(redirects).toEqual({ + commands: [ + { resource: ">> ~/.zshrc <<< 'x'", save: ">> *" }, + { resource: "export -p > ~/.bashrc", save: "export *" }, + ], + directories: [], + }) + + const methods = await Effect.runPromise( + ShellParse.scan('[IO.File]::Delete("C:\\victim"); $proc.Kill(); "x" >> ~/.bashrc', "pwsh", "C:\\workspace"), + ) + expect(methods).toEqual({ + commands: [ + { resource: '[IO.File]::Delete("C:\\victim")', save: "[IO.File]::Delete(*" }, + { resource: "$proc.Kill()", save: "$proc.Kill(*" }, + { resource: '"x" >> ~/.bashrc', save: '"x" *' }, + ], + directories: [], + }) + }) + test("extracts PowerShell directory parameters", async () => { const result = await Effect.runPromise( ShellParse.scan("Set-Location -LiteralPath '..\\outside'; Get-ChildItem", "pwsh", "C:\\workspace"), diff --git a/packages/core/test/shell-scan/bash-safety.test.ts b/packages/core/test/shell-scan/bash-safety.test.ts index a6b6802d9f8d..d981c6270945 100644 --- a/packages/core/test/shell-scan/bash-safety.test.ts +++ b/packages/core/test/shell-scan/bash-safety.test.ts @@ -81,12 +81,19 @@ describe("Bash execution safety", () => { expect(ShellScan.scan(source).kind).toBe("opaque") }) - test.each(["X=value > /dev/null", "X=x 2> output", "X=x < input", "> /dev/null", "2>> output", ">output 2>&1"])( - "scans redirects without inventing an executable command: %s", - (source) => { - expect(ShellScan.scan(source)).toEqual({ kind: "scanned", commands: [] }) - }, - ) + test.each([ + ["X=value > /dev/null", "X=value > /dev/null", "X=value >"], + ["X=x 2> output", "X=x 2> output", "X=x 2>"], + ["X=x < input", "X=x < input", "X=x <"], + ["> /dev/null", "> /dev/null", ">"], + ["2>> output", "2>> output", "2>>"], + [">output 2>&1", ">output 2>&1", ">output"], + ] as const)("retains commandless redirects as explicit permission resources: %s", (source, resource, head) => { + expect(ShellScan.scan(source)).toMatchObject({ + kind: "scanned", + commands: [{ resource, words: [head], rawWords: [head] }], + }) + }) test.each([">", "X=x >", "X=x > # comment\nprintf ok", ">; printf ok", "(printf ok) >", "{ printf ok; } >"])( "still requires redirect targets: %s", @@ -96,26 +103,40 @@ describe("Bash execution safety", () => { ) test.each([ - "{ printf ok; } > output", - "{ printf ok; } 2> output", - "{ printf ok; } &> output", - "(printf ok) > output", - "{ printf ok; }; X=x > output", - ])("scans leading groups and their redirects without synthetic commands: %s", (source) => { - expect(ShellScan.scan(source)).toEqual({ + ["{ printf ok; } > output", "> output", ">"], + ["{ printf ok; } 2> output", "2> output", "2>"], + ["{ printf ok; } &> output", "&> output", "&>"], + ["(printf ok) > output", "> output", ">"], + ["{ printf ok; }; X=x > output", "X=x > output", "X=x >"], + ] as const)("retains file redirects on compound groups and trailing assignments: %s", (source, redirectResource, head) => { + expect(ShellScan.scan(source)).toMatchObject({ kind: "scanned", - commands: [{ resource: "printf ok", words: ["printf", "ok"], rawWords: ["printf", "ok"] }], + commands: [ + { resource: "printf ok", words: ["printf", "ok"], rawWords: ["printf", "ok"] }, + { resource: redirectResource, words: [head], rawWords: [head] }, + ], }) }) + test.each(["{ printf ok; } 2>&1", "(printf ok) 2>&1", "(printf ok) 2>&-"])( + "does not invent redirect commands for pure group descriptor duplications: %s", + (source) => { + expect(ShellScan.scan(source)).toEqual({ + kind: "scanned", + commands: [{ resource: "printf ok", words: ["printf", "ok"], rawWords: ["printf", "ok"] }], + }) + }, + ) + test.each(["X=x >$(printf output)", ">$(printf output)", "{ :; } >$(printf output)", "(:) >$(printf output)"])( - "retains explicit substitutions in otherwise commandless redirects: %s", + "retains both redirect resources and explicit substitutions in commandless redirects: %s", (source) => { const result = ShellScan.scan(source) expect(result.kind).toBe("scanned") if (result.kind === "opaque") return + const redirectHead = source.startsWith("X=x") ? "X=x >$(printf output)" : ">$(printf output)" expect(result.commands.map((command) => command.words[0])).toEqual( - source.includes(":") ? [":", "printf"] : ["printf"], + source.includes(":") ? [":", redirectHead, "printf"] : [redirectHead, "printf"], ) expect(result.commands.at(-1)).toEqual({ resource: "printf output", @@ -126,10 +147,11 @@ describe("Bash execution safety", () => { ) test("scans a list following a group redirect suffix", () => { - expect(ShellScan.scan("(printf ok) >output && pwd")).toEqual({ + expect(ShellScan.scan("(printf ok) >output && pwd")).toMatchObject({ kind: "scanned", commands: [ { resource: "printf ok", words: ["printf", "ok"], rawWords: ["printf", "ok"] }, + { resource: ">output", words: [">output"], rawWords: [">output"] }, { resource: "pwd", words: ["pwd"], rawWords: ["pwd"] }, ], }) @@ -260,7 +282,10 @@ describe("Bash real-shell redirect-only statements", () => { const result = ShellScan.scan(source) expect(result.kind).toBe("scanned") if (result.kind === "opaque") return - expect(result.commands.map((command) => command.words[0]).sort()).toEqual(observed) + expect( + result.commands.filter((command) => command.redirectPrefixEnd === undefined).map((command) => command.words[0]).sort(), + ).toEqual(observed) + expect(result.commands.some((command) => command.redirectPrefixEnd !== undefined)).toBe(true) }) } }) diff --git a/packages/core/test/shell-scan/bash-syntax.test.ts b/packages/core/test/shell-scan/bash-syntax.test.ts index d5bfb2ab0049..5ba1d9f462c7 100644 --- a/packages/core/test/shell-scan/bash-syntax.test.ts +++ b/packages/core/test/shell-scan/bash-syntax.test.ts @@ -156,7 +156,10 @@ describe("ordinary Bash and Zsh syntax", () => { }) test("scans a Zsh brace group closed after a redirect", () => { - expect(ShellScan.scan("{ a && >f }")).toMatchObject({ kind: "scanned", commands: [{ words: ["a"] }] }) + expect(ShellScan.scan("{ a && >f }")).toMatchObject({ + kind: "scanned", + commands: [{ words: ["a"] }, { resource: ">f", words: [">f"] }], + }) }) test("preserves raw lexical spelling of ANSI-C and locale quoted words", () => { @@ -188,8 +191,8 @@ describe("Bash shared heredoc delimiter grammar", () => { '(cat <<"E\\$OF"\nhello\nE$OF\n)', '(cat <<-"E\\OF"\n\thello\n\tE\\OF\n)', ])("preserves heredoc permission resources and saved prefixes: %s", async (source) => { - const legacy = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) - expect(await Effect.runPromise(ShellParse.scanPortable(source, "/bin/bash", "/workspace"))).toEqual(legacy) + const parsed = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) + expect(parsed.commands[0]?.save).toBe("cat *") }) test.each([ @@ -202,8 +205,8 @@ describe("Bash shared heredoc delimiter grammar", () => { expect(result.kind).toBe("scanned") if (result.kind !== "scanned") throw new Error(result.reason) expect(result.commands.map((command) => command.words[0])).toEqual([...names]) - const legacy = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) - expect(await Effect.runPromise(ShellParse.scanPortable(source, "/bin/bash", "/workspace"))).toEqual(legacy) + const parsed = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) + expect(parsed.commands).toHaveLength(names.length) }) test.each([ @@ -291,7 +294,7 @@ describe("Bash dialects", () => { test("reads a reserved word after a redirect as a Zsh keyword", () => { const source = "if true; then >/dev/null fi; next" - expect(heads(source, "zsh")).toEqual(["true", "next"]) + expect(heads(source, "zsh")).toEqual(["true", ">/dev/null", "next"]) expect(heads(source, "bash")).toBe("opaque") expect(heads(source, "posix")).toBe("opaque") }) @@ -313,7 +316,7 @@ describe("Bash dialects", () => { ["/bin/dash", ["x = 1", "y"]], ["/opt/bin/mksh", ["x = 1", "y"]], ] as const)("derives the dialect from the shell executable: %s", async (shell, resources) => { - const result = await Effect.runPromise(ShellParse.scanPortable("(( x = 1 )); y", shell, "/workspace")) + const result = await Effect.runPromise(ShellParse.scan("(( x = 1 )); y", shell, "/workspace")) expect(result.commands.map((command) => command.resource)).toEqual([...resources]) }) }) diff --git a/packages/core/test/shell-scan/compound-parity.test.ts b/packages/core/test/shell-scan/compound-parity.test.ts index 4ddeee5c1158..437ab147ce0d 100644 --- a/packages/core/test/shell-scan/compound-parity.test.ts +++ b/packages/core/test/shell-scan/compound-parity.test.ts @@ -26,11 +26,10 @@ describe("compound function acceptance", () => { const name = head.includes("probe-name") ? "probe-name" : "probe" const source = context(`${head} ${body}; ${name}`) test(`${shell}: ${source}`, async () => { - // Braces preserve the function's behavior, but avoid Tree-sitter's recovery artifacts. - const legacy = await Effect.runPromise( + const braced = await Effect.runPromise( ShellParse.scan(context(`${head} { ${body}; }; ${name}`), shell, "/workspace"), ) - expect(await Effect.runPromise(ShellParse.scanPortable(source, shell, "/workspace"))).toEqual(legacy) + expect(await Effect.runPromise(ShellParse.scan(source, shell, "/workspace"))).toEqual(braced) }) } } @@ -79,8 +78,8 @@ describe("Zsh parenthesized loop acceptance", () => { for (const context of contexts) { const source = context(fixture.source) test(source, async () => { - const legacy = await Effect.runPromise(ShellParse.scan(context(fixture.equivalent), "zsh", "/workspace")) - expect(await Effect.runPromise(ShellParse.scanPortable(source, "zsh", "/workspace"))).toEqual(legacy) + const equivalent = await Effect.runPromise(ShellParse.scan(context(fixture.equivalent), "zsh", "/workspace")) + expect(await Effect.runPromise(ShellParse.scan(source, "zsh", "/workspace"))).toEqual(equivalent) }) } diff --git a/packages/core/test/shell-scan/oracle.test.ts b/packages/core/test/shell-scan/oracle.test.ts index 406759795a46..1dac077b77df 100644 --- a/packages/core/test/shell-scan/oracle.test.ts +++ b/packages/core/test/shell-scan/oracle.test.ts @@ -752,7 +752,7 @@ describe.skipIf(process.platform === "win32")("real-shell directory oracle", () ) expect(changed.length, `Fixture never changed directory in any real shell: ${source}`).toBeGreaterThan(0) for (const executable of changed) { - const parsed = await Effect.runPromiseExit(ShellParse.scanPortable(source, executable, root)) + const parsed = await Effect.runPromiseExit(ShellParse.scan(source, executable, root)) if (Exit.isSuccess(parsed)) expect(parsed.value.directories, `${executable} in: ${source}`).toContain(target) } }, diff --git a/packages/core/test/shell-scan/parity-regressions.test.ts b/packages/core/test/shell-scan/parity-regressions.test.ts index e7f9f5e68db9..3150ad02320d 100644 --- a/packages/core/test/shell-scan/parity-regressions.test.ts +++ b/packages/core/test/shell-scan/parity-regressions.test.ts @@ -30,17 +30,16 @@ describe("legacy-accepted shell syntax regressions", () => { "preserves deeply indented function definitions: %s", async (source) => { const command = `( ${" ".repeat(32_000)}${source} )` - const legacy = await Effect.runPromise(ShellParse.scan(command, "zsh", "/workspace")) - expect(await Effect.runPromise(ShellParse.scanPortable(command, "zsh", "/workspace"))).toEqual(legacy) + const parsed = await Effect.runPromise(ShellParse.scan(command, "zsh", "/workspace")) + expect(parsed.commands.some((item) => item.resource === "scan_probe")).toBe(true) }, ) test.each(conditions.flatMap((source) => contexts.map((context) => context(source))))( "retains conditional process substitutions and permission resources: %s", async (source) => { - const legacy = await Effect.runPromise(ShellParse.scan(source, "bash", "/workspace")) - expect(legacy.commands.some((command) => command.resource === "scan_probe")).toBe(true) - expect(await Effect.runPromise(ShellParse.scanPortable(source, "bash", "/workspace"))).toEqual(legacy) + const parsed = await Effect.runPromise(ShellParse.scan(source, "bash", "/workspace")) + expect(parsed.commands.some((command) => command.resource === "scan_probe")).toBe(true) }, ) @@ -52,9 +51,8 @@ describe("legacy-accepted shell syntax regressions", () => { ), ), )(`${shell} preserves line continuations at function boundaries: %s`, async (source) => { - const legacy = await Effect.runPromise(ShellParse.scan(source, shell, "/workspace")) - expect(legacy.commands.some((command) => command.resource === "scan_probe")).toBe(true) - expect(await Effect.runPromise(ShellParse.scanPortable(source, shell, "/workspace"))).toEqual(legacy) + const parsed = await Effect.runPromise(ShellParse.scan(source, shell, "/workspace")) + expect(parsed.commands.some((command) => command.resource === "scan_probe")).toBe(true) }) test.each( @@ -64,17 +62,15 @@ describe("legacy-accepted shell syntax regressions", () => { ), ), )(`${shell} preserves comments between a function head and its body: %s`, async (source) => { - const legacy = await Effect.runPromise(ShellParse.scan(source, shell, "/workspace")) - expect(legacy.commands.some((command) => command.resource === "scan_probe")).toBe(true) - expect(await Effect.runPromise(ShellParse.scanPortable(source, shell, "/workspace"))).toEqual(legacy) + const parsed = await Effect.runPromise(ShellParse.scan(source, shell, "/workspace")) + expect(parsed.commands.some((command) => command.resource === "scan_probe")).toBe(true) }) test.each(functions)( `${shell} preserves function resources, saved prefixes, and directories: %s`, async (source) => { - const legacy = await Effect.runPromise(ShellParse.scan(source, shell, "/workspace")) - expect(legacy.commands.some((command) => command.resource === "scan_probe")).toBe(true) - expect(await Effect.runPromise(ShellParse.scanPortable(source, shell, "/workspace"))).toEqual(legacy) + const parsed = await Effect.runPromise(ShellParse.scan(source, shell, "/workspace")) + expect(parsed.commands.some((command) => command.resource === "scan_probe")).toBe(true) }, ) @@ -116,9 +112,8 @@ describe("legacy-accepted shell syntax regressions", () => { "while() { scan_probe; break; }", "until() { scan_probe; break; }", ])("preserves Zsh anonymous functions and parenthesized loop permissions: %s", async (source) => { - const legacy = await Effect.runPromise(ShellParse.scan(source, "zsh", "/workspace")) - expect(legacy.commands.some((command) => command.resource === "scan_probe")).toBe(true) - expect(await Effect.runPromise(ShellParse.scanPortable(source, "zsh", "/workspace"))).toEqual(legacy) + const parsed = await Effect.runPromise(ShellParse.scan(source, "zsh", "/workspace")) + expect(parsed.commands.some((command) => command.resource === "scan_probe")).toBe(true) }) test.each([ diff --git a/packages/core/test/shell-scan/powershell-syntax.test.ts b/packages/core/test/shell-scan/powershell-syntax.test.ts index 595242145211..4ed7ade734a9 100644 --- a/packages/core/test/shell-scan/powershell-syntax.test.ts +++ b/packages/core/test/shell-scan/powershell-syntax.test.ts @@ -60,6 +60,26 @@ describe("PowerShell practical syntax", () => { ['@"\n$(Write-Output \'\n"@\'; git status)\n"@', ["Write-Output '\n\"@'", "git status"]], ["class C { [int]$x = (git status); [void] M() { git diff } }", ["git status", "git diff"]], ["enum Color { Red; Green = 2 }; git status", ["git status"]], + ["[IO.File]::Delete('C:\\victim')", ["[IO.File]::Delete('C:\\victim')"]], + [ + '[scriptblock]::Create("Remove-Item victim").Invoke()', + ['[scriptblock]::Create("Remove-Item victim")', '[scriptblock]::Create("Remove-Item victim").Invoke()'], + ], + [ + '([scriptblock]::Create("Remove-Item victim")).Invoke()', + ['[scriptblock]::Create("Remove-Item victim")', '([scriptblock]::Create("Remove-Item victim")).Invoke()'], + ], + [ + '$ExecutionContext.InvokeCommand.InvokeScript("Remove-Item victim")', + ['$ExecutionContext.InvokeCommand.InvokeScript("Remove-Item victim")'], + ], + ["Write-Output $proc.Kill()", ["Write-Output $proc.Kill()", "$proc.Kill()"]], + ["$proc.'Kill'(); $proc.('Ki' + 'll')(); $proc?.Dispose()", ["$proc.'Kill'()", "$proc.('Ki' + 'll')()", "$proc?.Dispose()"]], + [ + "[IO.File]::De`lete('x'); [IO.File]:: Delete('y'); $proc.\nKill()", + ["[IO.File]::De`lete('x')", "[IO.File]:: Delete('y')", "$proc.\nKill()"], + ], + ['"payload" >> ~/.bashrc; (git status) > out.txt', ['"payload" >> ~/.bashrc', "(git status) > out.txt", "git status"]], ] as const)("extracts command resources from %s", (source, resources) => { const result = ShellScan.scanPowerShell(source) expect(result.kind).toBe("scanned") diff --git a/packages/core/test/shell-scan/redirect.test.ts b/packages/core/test/shell-scan/redirect.test.ts index 72fbcafdc74b..6626b30c81b2 100644 --- a/packages/core/test/shell-scan/redirect.test.ts +++ b/packages/core/test/shell-scan/redirect.test.ts @@ -4,29 +4,36 @@ import { ShellParse } from "../../src/shell/parse.js" import { ShellScan } from "../../src/shell/scan.js" import { Wildcard } from "../../src/util/wildcard.js" -async function parity(source: string) { - const legacy = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) - const native = await Effect.runPromise(ShellParse.scanPortable(source, "/bin/bash", "/workspace")) - expect(native, source).toEqual(legacy) +async function checkResources(source: string) { + const parsed = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) + for (const command of parsed.commands) { + if ( + !/^[A-Za-z_][A-Za-z0-9_]*=/.test(command.resource) && + !/^(?:\d*>>?|\d*>&|&>>?|\d*<|\d*<>|>\|)/.test(command.resource) && + !command.resource.includes("\\\n") + ) { + expect(Wildcard.match(command.resource, command.save), `${source}: ${JSON.stringify(command)}`).toBe(true) + } + } } describe("Bash redirect resource oracle", () => { test.each([ - ["printf hello | cat > marker", ["printf hello", "cat"]], - ["printf ok && git status > output", ["printf ok", "git status"]], + ["printf hello | cat > marker", ["printf hello", "cat > marker"]], + ["printf ok && git status > output", ["printf ok", "git status > output"]], ["cat > output", ["cat > output"]], ["cat > output | cat", ["cat > output", "cat"]], - ["pwd | > output cat > tail", ["pwd", "> output cat"]], - ["pwd && cat > output file", ["pwd", "cat"]], + ["pwd | > output cat > tail", ["pwd", "> output cat > tail"]], + ["pwd && cat > output file", ["pwd", "cat > output file"]], ["pwd; cat > output", ["pwd", "cat > output"]], ["pwd\ncat > output", ["pwd", "cat > output"]], - ] as const)("matches exact permission resources: %s", async (source, resources) => { - const legacy = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) - expect(legacy.commands.map((command) => command.resource)).toEqual([...resources]) - await parity(source) + ] as const)("keeps redirects visible across lists and pipelines: %s", async (source, resources) => { + const parsed = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) + expect(parsed.commands.map((command) => command.resource)).toEqual([...resources]) + await checkResources(source) }) - test("matches redirect positions across generated list and pipeline boundaries", async () => { + test("scans redirect positions across generated list and pipeline boundaries", async () => { const redirects = [">output", ">>output", "err", "2>&1", "<&0", ">|output", "&>output", "&>>output"] const separators = [" | ", " |& ", " && ", " || ", "; ", " & ", "\n"] for (const redirect of redirects) { @@ -43,10 +50,10 @@ describe("Bash redirect resource oracle", () => { expect(ShellScan.scan(command).kind).toBe("opaque") continue } - await parity(command) + await checkResources(command) for (const separator of separators) { - await parity(`printf ok${separator}${command}`) - await parity(`${command}${separator}pwd >last`) + await checkResources(`printf ok${separator}${command}`) + await checkResources(`${command}${separator}pwd >last`) } } } @@ -88,55 +95,54 @@ describe("Bash redirect resource oracle", () => { "time git status", "time -p git status", "coproc git status", - ])("preserves nested commands, prefixes, and context: %s", parity) + ])("preserves nested commands, prefixes, and context: %s", checkResources) - test("keeps lexical words and nested redirect-target commands after narrowing the resource", () => { - const result = ShellScan.scan('pwd | git >"$(printf output)" status') + test("keeps full redirect resource, lexical words, and nested redirect-target commands", async () => { + const source = 'pwd | git >"$(printf output)" status' + const result = ShellScan.scan(source) expect(result.kind).toBe("scanned") if (result.kind !== "scanned") throw new Error(`Unexpected opacity: ${result.reason}`) expect(result.commands[1]).toMatchObject({ - resource: "git", + resource: 'git >"$(printf output)" status', words: ["git", "status"], rawWords: ["git", "status"], redirectWordCount: 1, }) expect(result.commands[2]).toMatchObject({ resource: "printf output", rawWords: ["printf", "output"] }) + const parsed = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) + expect(parsed.commands[1]).toEqual({ resource: 'git >"$(printf output)" status', save: "git *" }) + expect(Wildcard.match(parsed.commands[1]!.resource, parsed.commands[1]!.save)).toBe(true) }) - test("excludes ignored trailing continuations from narrowed command prefixes", async () => { + test("retains trailing redirect span after a continuation on pipeline RHS", async () => { const source = "pwd | cat\\\n >out" - const legacy = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) const result = ShellScan.scan(source) expect(result.kind).toBe("scanned") if (result.kind !== "scanned") throw new Error(`Unexpected opacity: ${result.reason}`) - expect(result.commands.map((command) => command.resource)).toEqual( - legacy.commands.map((command) => command.resource), - ) expect(result.commands[1]?.rawWords).toEqual(["cat"]) - expect(legacy.commands[1]).toEqual({ resource: "cat", save: "cat *" }) - const native = await Effect.runPromise(ShellParse.scanPortable(source, "/bin/bash", "/workspace")) - expect(native).toEqual(legacy) - expect(native.commands.every((command) => Wildcard.match(command.resource, command.save))).toBe(true) + const parsed = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) + expect(parsed.commands).toEqual([ + { resource: "pwd", save: "pwd *" }, + { resource: "cat\\\n >out", save: "cat *" }, + ]) }) test.each(["cat\\\n", "cat \\\n", "cat\\\n\\\n", "cat\\\n;", "cat >out\\\n", "cat >out \\\n"])( "saved prefixes cover their standalone continuation command: %j", async (source) => { - await parity(source) const result = ShellScan.scan(source) expect(result.kind).toBe("scanned") if (result.kind !== "scanned") throw new Error(result.reason) expect(result.commands[0]?.rawWords).toEqual(["cat"]) - const native = await Effect.runPromise(ShellParse.scanPortable(source, "/bin/bash", "/workspace")) - expect(native.commands[0]).toEqual({ resource: source.includes(">out") ? "cat >out" : "cat", save: "cat *" }) - expect(native.commands.every((command) => Wildcard.match(command.resource, command.save))).toBe(true) + const parsed = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) + expect(parsed.commands[0]).toEqual({ resource: source.includes(">out") ? "cat >out" : "cat", save: "cat *" }) + expect(parsed.commands.every((command) => Wildcard.match(command.resource, command.save))).toBe(true) }, ) test.each(["printf 'literal\\\n'\\\n", 'printf "literal\\\n"\\\n', "printf a\\\nb\\\n", 'printf a\\\n""\\\n'])( "preserves meaningful raw syntax before an ignored trailing continuation: %j", async (source) => { - await parity(source) const result = ShellScan.scan(source) expect(result.kind).toBe("scanned") if (result.kind !== "scanned") throw new Error(result.reason) @@ -145,18 +151,18 @@ describe("Bash redirect resource oracle", () => { }, ) - test("assignment then redirect on a pipeline RHS retains the command", async () => { + test("assignment then redirect on a pipeline RHS retains the full command and trailing redirect", async () => { const source = "printf ok | FOO=bar >output git status 3>tail" - const native = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) - expect(native.commands).toEqual([ + const parsed = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) + expect(parsed.commands).toEqual([ { resource: "printf ok", save: "printf *" }, - { resource: "FOO=bar >output git status", save: "git status *" }, + { resource: "FOO=bar >output git status 3>tail", save: "git status *" }, ]) }) test("redirect before cd operand retains the target directory", async () => { const source = "pwd && cd >out /outside" - const native = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) - expect(native).toEqual({ commands: [{ resource: "pwd", save: "pwd *" }], directories: ["/outside"] }) + const parsed = await Effect.runPromise(ShellParse.scan(source, "/bin/bash", "/workspace")) + expect(parsed).toEqual({ commands: [{ resource: "pwd", save: "pwd *" }], directories: ["/outside"] }) }) }) diff --git a/packages/core/test/shell-scan/scan.test.ts b/packages/core/test/shell-scan/scan.test.ts index 66ae2d528cf1..25bf89054c56 100644 --- a/packages/core/test/shell-scan/scan.test.ts +++ b/packages/core/test/shell-scan/scan.test.ts @@ -166,12 +166,12 @@ describe("ShellScan", () => { }, ) - test("keeps first-command redirects but excludes list-level redirects from resources", () => { + test("keeps redirects in resources across list operators", () => { expect(ShellScan.scan("FOO=bar 2>>err printf ok > out && cat < input")).toMatchObject({ kind: "scanned", commands: [ { resource: "FOO=bar 2>>err printf ok > out", words: ["printf", "ok"] }, - { resource: "cat", words: ["cat"] }, + { resource: "cat < input", words: ["cat"] }, ], }) }) @@ -181,7 +181,7 @@ describe("ShellScan", () => { kind: "scanned", commands: [ { resource: "printf ok>out 2>&1", words: ["printf", "ok"] }, - { resource: "cat", words: ["cat"] }, + { resource: "cat { }), )) - test("pipeline redirect preserves exact approval and denial despite broad saved approval", () => + test("pipeline redirect keeps the redirect target visible to exact approval and denial", () => withScanner((registry, fixture) => Effect.gen(function* () { const saved = yield* PermissionSaved.Service @@ -366,6 +366,13 @@ describe("ShellTool scanner permissions", () => { yield* saved.add({ projectID: location.project.id, action: "shell", resources: ["printf hello", "cat"] }) const marker = path.join(fixture.active, "marker") const command = "printf hello | cat > marker" + const unapprovedRedirect = yield* runPermissionCommand(registry, command, marker, ["reject"]) + expect(unapprovedRedirect.requests).toMatchObject([ + { action: "shell", resources: ["printf hello", "cat > marker"], save: ["printf *", "cat *"] }, + ]) + expect(yield* Effect.promise(() => Bun.file(marker).exists())).toBe(false) + + yield* saved.add({ projectID: location.project.id, action: "shell", resources: ["cat > marker"] }) const exact = yield* runPermissionCommand(registry, command, marker, []) expect(exact.requests).toEqual([]) expect(exact.exit).toMatchObject({ _tag: "Success", value: { status: "completed", metadata: { exit: 0 } } }) @@ -381,7 +388,7 @@ describe("ShellTool scanner permissions", () => { const agents = yield* Agent.Service yield* agents.transform((editor) => editor.update(toolIdentity.agent, (agent) => { - agent.permissions = [{ action: "shell", resource: "cat", effect: "deny" }] + agent.permissions = [{ action: "shell", resource: "* > marker", effect: "deny" }] }), ) yield* Effect.promise(() => fs.rm(marker)) @@ -858,12 +865,16 @@ describe("ShellTool", () => { { sessionID, action: "shell", - resources: [isWindows ? "Start-Sleep -Milliseconds 100" : helloCommand], + resources: isWindows + ? ["[Console]::Out.Write('hello')", "Start-Sleep -Milliseconds 100"] + : [helloCommand], agent: toolIdentity.agent, source: { type: "tool", messageID: toolIdentity.messageID, id: "call-shell" }, }, ]) - expect(assertions[0]?.save).toEqual([isWindows ? "Start-Sleep *" : "printf *"]) + expect(assertions[0]?.save).toEqual( + isWindows ? ["[Console]::Out.Write(*", "Start-Sleep *"] : ["printf *"], + ) }), ) }, diff --git a/packages/schema/src/config/experimental.ts b/packages/schema/src/config/experimental.ts index c9fb5cccc5e1..83ad0a9d212d 100644 --- a/packages/schema/src/config/experimental.ts +++ b/packages/schema/src/config/experimental.ts @@ -7,7 +7,7 @@ import { ConfigPolicy } from "./policy.js" export class Info extends Schema.Class("ConfigExperimental.Info")({ portable_shell_scanner: Schema.Boolean.pipe(optional).annotate({ - description: "Enable the experimental portable shell permission scanner. Defaults to false.", + description: "Deprecated: the built-in shell permission scanner is now always enabled.", }), todo: Schema.Boolean.pipe(optional).annotate({ description: "Enable the experimental todowrite tool. Defaults to false.", From a070e11643325b32a6c209f8da9132b05dbbf29e Mon Sep 17 00:00:00 2001 From: James Long Date: Thu, 29 Oct 2026 18:49:46 -0400 Subject: [PATCH 16/83] test(app): mock persistent pty routes (#60327) --- packages/app/e2e/utils/mock-api.ts | 75 ++++ packages/app/e2e/utils/mock-server.ts | 108 ++++- packages/app/e2e/utils/persistent-pty.ts | 542 +++++++++++++++++++++++ 3 files changed, 718 insertions(+), 7 deletions(-) create mode 100644 packages/app/e2e/utils/persistent-pty.ts diff --git a/packages/app/e2e/utils/mock-api.ts b/packages/app/e2e/utils/mock-api.ts index 0b87d7979875..bdac71face9a 100644 --- a/packages/app/e2e/utils/mock-api.ts +++ b/packages/app/e2e/utils/mock-api.ts @@ -1,5 +1,6 @@ import { Predicate, Schema, SchemaGetter } from "effect" import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api" +import { PersistentPty } from "@opencode/schema/persistent-pty" import { Pty } from "@opencode/schema/pty" import { Worktree } from "@opencode/schema/worktree" @@ -69,6 +70,18 @@ export class MockPtyNotFound extends Schema.TaggedError()("PtyN message: Schema.String, }) {} +// The server's error when a service it needs, such as the opencode-pty daemon, cannot run. +export class MockServiceUnavailable extends Schema.TaggedError()("ServiceUnavailableError", { + message: Schema.String, + service: Schema.optional(Schema.String), +}) {} + +// The server's error for a feature the connected opencode-pty daemon lacks, such as `rename`. +export class MockPtyFeatureUnsupported extends Schema.TaggedError()( + "PtyFeatureUnsupportedError", + { feature: Schema.String, message: Schema.String }, +) {} + // The server's error for a request without its password. export class MockUnauthorized extends Schema.TaggedError()("UnauthorizedError", { message: Schema.String, @@ -83,6 +96,17 @@ const Unsupported = MockUnsupported.pipe(HttpApiSchema.status(501)) const PtyMissing = [MockNotFound.pipe(HttpApiSchema.status(404)), MockPtyNotFound.pipe(HttpApiSchema.status(404))] +const PersistentPtyUnavailable = MockServiceUnavailable.pipe(HttpApiSchema.status(503)) + +const PersistentPtyMissing = [MockPtyNotFound.pipe(HttpApiSchema.status(404)), PersistentPtyUnavailable] + +// `PersistentPty.UpdateInput` once terminal renaming lands; the schema still requires `size`. +const PersistentPtyUpdate = Schema.Struct({ + attachmentID: Schema.optional(Schema.String), + size: Schema.optional(Schema.Struct({ cols: Schema.Number, rows: Schema.Number })), + title: Schema.optional(Schema.NullOr(Schema.String)), +}) + const Group = HttpApiGroup.make("mock") .add(HttpApiEndpoint.get("info", "/api/info", { success: Json })) .add( @@ -291,6 +315,57 @@ const Group = HttpApiGroup.make("mock") error: PtyMissing, }), ) + .add( + HttpApiEndpoint.get("persistentPtyList", "/api/experimental/session/:sessionID/terminal", { + params: SessionParams, + success: Json, + error: PersistentPtyUnavailable, + }), + ) + .add( + HttpApiEndpoint.post("persistentPtyCreate", "/api/experimental/session/:sessionID/terminal", { + params: SessionParams, + payload: PersistentPty.CreateInput, + success: Json, + error: PersistentPtyUnavailable, + }), + ) + .add( + HttpApiEndpoint.get("persistentPtyGet", "/api/experimental/persistent-pty/:ptyID", { + params: PtyParams, + success: Json, + error: PersistentPtyMissing, + }), + ) + .add( + HttpApiEndpoint.put("persistentPtyUpdate", "/api/experimental/persistent-pty/:ptyID", { + params: PtyParams, + payload: PersistentPtyUpdate, + success: Json, + error: [...PersistentPtyMissing, MockPtyFeatureUnsupported.pipe(HttpApiSchema.status(501))], + }), + ) + .add( + HttpApiEndpoint.delete("persistentPtyRemove", "/api/experimental/persistent-pty/:ptyID", { + params: PtyParams, + success: NoContent, + error: PersistentPtyMissing, + }), + ) + .add( + HttpApiEndpoint.get("persistentPtySnapshot", "/api/experimental/persistent-pty/:ptyID/snapshot", { + params: PtyParams, + success: Json, + error: PersistentPtyMissing, + }), + ) + .add( + HttpApiEndpoint.post("persistentPtyConnectToken", "/api/experimental/persistent-pty/:ptyID/connect-token", { + params: PtyParams, + success: Json, + error: PersistentPtyMissing, + }), + ) .add( HttpApiEndpoint.get("sessionList", "/api/session", { query: Query, diff --git a/packages/app/e2e/utils/mock-server.ts b/packages/app/e2e/utils/mock-server.ts index 926a684b73f5..900708d5f3ad 100644 --- a/packages/app/e2e/utils/mock-server.ts +++ b/packages/app/e2e/utils/mock-server.ts @@ -12,11 +12,14 @@ import { MockBadRequest, MockInternal, MockNotFound, + MockPtyFeatureUnsupported, MockPtyNotFound, + MockServiceUnavailable, MockShellNotFound, MockUnauthorized, MockUnsupported, } from "./mock-api" +import { createPersistentPty, type MockPersistentPtyConfig, type MockServerEvent } from "./persistent-pty" import { installSseTransport } from "./sse-transport" type Resolvable = T | (() => T) @@ -147,6 +150,9 @@ export interface MockServerConfig { // Serves `/api/pty*` and mock PTY WebSockets. Created IDs are the first unused `${prefix}` (prefix must start with "pty"). // `directory` is the owning workspace (Location); `cwd` is the reported working directory (default: `directory`). pty?: { prefix?: string; initial?: { id: string; title: string; directory?: string; cwd?: string }[] } + // Serves the session-scoped persistent PTY routes and their connect WebSockets (`e2e/utils/persistent-pty.ts`). + // Without it, those routes answer 503 like a server whose opencode-pty daemon cannot run. + persistentPty?: MockPersistentPtyConfig // Answers 500 InvalidDirectory when a request names a directory this server does not own. strictDirectory?: boolean // Answers 401 UnauthorizedError unless a request carries this password; a function may change it mid-test. @@ -305,7 +311,7 @@ export async function mockOpenCodeServer(page: Page, config: MockServerConfig) { // Delivers events on this server's mock stream; buffered until the app connects. // An origin served by an SSE transport receives the events as one burst on its active connection. - const push = (payloads: readonly OpenCodeEvent[]) => + const push = (payloads: readonly MockServerEvent[]) => page.evaluate( ({ server, payloads }) => { // SAFETY: only the init script, `installSseTransport`, and benchmarks write these globals, in the declared shapes. @@ -322,7 +328,7 @@ export async function mockOpenCodeServer(page: Page, config: MockServerConfig) { ) // Server-side events the mock publishes itself; delivery failures other than a missing document fail the test. - const emit = (events: OpenCodeEvent[]) => + const emit = (events: MockServerEvent[]) => void push(events).catch((cause: unknown) => { if (page.isClosed() || retryableDelivery(cause)) return throw cause @@ -482,7 +488,15 @@ export async function mockOpenCodeServer(page: Page, config: MockServerConfig) { ) } - return { server, pty: transport.pty, push } + if (config.persistentPty) { + const host = new URL(server).host + await page.routeWebSocket( + (url) => url.host === host && /^\/api\/experimental\/persistent-pty\/[^/]+\/connect$/.test(url.pathname), + (ws) => transport.persistentPty.connect(ws), + ) + } + + return { server, pty: transport.pty, persistentPty: transport.persistentPty, push } } // Answers every Location-scoped request for `directory` as the server does once that folder is deleted. @@ -535,15 +549,19 @@ export async function mockServers(page: Page, servers: Record void = () => {}) { +export function createMockServerHandler( + config: MockServerConfig, + emit: (events: MockServerEvent[]) => void = () => {}, +) { const pty = createPty(config) + const persistentPty = createPersistentPty({ config: config.persistentPty, directory: config.directory }, emit) const web = HttpRouter.toWebHandler( HttpApiBuilder.layer(MockApi).pipe( @@ -553,6 +571,7 @@ export function createMockServerHandler(config: MockServerConfig, emit: (events: nextCursor: 0, sessionCreates: 0, pty, + persistentPty, emit, mcp: new Map(), attempts: new Map(), @@ -563,7 +582,7 @@ export function createMockServerHandler(config: MockServerConfig, emit: (events: { disableLogger: true }, ) - return { ...web, pty } + return { ...web, pty, persistentPty } } const corsHeaders = { @@ -736,7 +755,8 @@ function mockHandlers( nextCursor: number sessionCreates: number pty: ReturnType - emit: (events: OpenCodeEvent[]) => void + persistentPty: ReturnType + emit: (events: MockServerEvent[]) => void // MCP status overrides by `\n`, and OAuth attempt creation times by attempt ID. mcp: Map attempts: Map @@ -765,6 +785,25 @@ function mockHandlers( ), ) + const persistentPtyEnabled = Effect.suspend(() => + config.persistentPty && state.persistentPty.capability !== false + ? Effect.void + : Effect.fail(new MockServiceUnavailable({ message: "opencode-pty is not available", service: "opencode-pty" })), + ) + + const findPersistentPty = (id: string) => + persistentPtyEnabled.pipe( + Effect.andThen(() => + Effect.suspend(() => { + const found = state.persistentPty.find(id) + + return found + ? Effect.succeed(found) + : Effect.fail(new MockPtyNotFound({ ptyID: id, message: `PTY session not found: ${id}` })) + }), + ), + ) + const mcpServers = (directory: string) => (Predicate.isFunction(config.mcp) ? config.mcp(directory) : (config.mcp ?? [])).map((server) => { if (!Predicate.isObject(server)) return server @@ -880,6 +919,10 @@ function mockHandlers( hostname: config.hostname, urls: config.server ? [config.server] : [], paths: { tmp: "/tmp/opencode" }, + capabilities: + state.persistentPty.capability === undefined + ? undefined + : { persistentPty: state.persistentPty.capability }, }), config: () => Effect.succeed(configEntries), reference: () => Effect.succeed({ location: location(config), data: [] }), @@ -1241,6 +1284,57 @@ function mockHandlers( return { location: location(config, directory), data: { ticket, expires_in: 60 } } }), ), + persistentPtyList: (ctx) => + persistentPtyEnabled.pipe(Effect.map(() => ({ data: state.persistentPty.list(ctx.params.sessionID) }))), + persistentPtyCreate: (ctx) => + persistentPtyEnabled.pipe( + Effect.map(() => { + const session = config.sessions.find((item) => item.id === ctx.params.sessionID) + const directory = session ? currentSession(session, config.directory).location.directory : undefined + + return { + data: state.persistentPty.create(ctx.params.sessionID, { + ...ctx.payload, + cwd: ctx.payload.cwd ?? directory, + }), + } + }), + ), + persistentPtyGet: (ctx) => findPersistentPty(ctx.params.ptyID).pipe(Effect.map((data) => ({ data }))), + persistentPtyUpdate: (ctx) => + findPersistentPty(ctx.params.ptyID).pipe( + Effect.flatMap((found) => + ctx.payload.title !== undefined && !state.persistentPty.renameSupported + ? Effect.fail( + new MockPtyFeatureUnsupported({ + feature: "rename", + message: "Terminal renaming will be available after OpenCode's terminal service restarts", + }), + ) + : Effect.sync(() => ({ data: state.persistentPty.update(found.id, ctx.payload) })), + ), + ), + persistentPtyRemove: (ctx) => + findPersistentPty(ctx.params.ptyID).pipe( + Effect.map((found) => { + state.persistentPty.remove(found.id) + + return HttpApiSchema.NoContent.make() + }), + ), + persistentPtySnapshot: (ctx) => + findPersistentPty(ctx.params.ptyID).pipe( + Effect.map((found) => ({ data: state.persistentPty.snapshot(found.id) })), + ), + persistentPtyConnectToken: (ctx) => + findPersistentPty(ctx.params.ptyID).pipe( + Effect.map((found) => ({ + data: { + ticket: state.persistentPty.issue(found.id, Object.fromEntries(Object.entries(ctx.request.headers))), + expires_in: 60, + }, + })), + ), sessionList: (ctx) => { const sessions = config.sessions .filter( diff --git a/packages/app/e2e/utils/persistent-pty.ts b/packages/app/e2e/utils/persistent-pty.ts new file mode 100644 index 000000000000..4f1355d4c1e6 --- /dev/null +++ b/packages/app/e2e/utils/persistent-pty.ts @@ -0,0 +1,542 @@ +import type { WebSocketRoute } from "@playwright/test" +import type { OpenCodeEvent } from "@opencode/client/promise" +import type { PersistentPty } from "@opencode/schema/persistent-pty" +import { Predicate } from "effect" + +// Serves the session-scoped persistent PTY routes (`/api/experimental/.../terminal`, `/api/experimental/persistent-pty`) +// and their connect WebSockets, like a server backed by the opencode-pty daemon. +export type MockPersistentPtyConfig = { + // `server.info().capabilities.persistentPty`; omitted by default, like a server that predates the field. `false` + // also makes the routes answer 503 like a server without the daemon. + capability?: boolean + // Whether PUT renames (the daemon lists the `rename` feature). When false, a title update answers 501 + // PtyFeatureUnsupportedError. Default true. + renameSupported?: boolean + // Terminals that exist before the page loads; they publish no events. + initial?: MockPersistentPtySeed[] +} + +export type MockPersistentPtySeed = { + // Default: the next `pty_persistent_`. + id?: string + sessionID: string + // The create title (default "Terminal"). + title?: string + userTitle?: string | null + command?: string + args?: string[] + // Default: the server directory. + cwd?: string + size?: { cols: number; rows: number } + // Output the terminal already wrote; snapshots replay it as their checkpoint. + output?: string + foregroundProcess?: string | null +} + +// `PersistentPty.Info`, with the `userTitle` that terminal renaming adds. +export type MockPersistentPtyInfo = { + id: string + title: string + userTitle: string | null + command: string + args: string[] + cwd: string + status: "running" | "exited" + pid: number + exitCode?: number + sessionID: string + foregroundProcess: string | null + size: { cols: number; rows: number } + output: { head: number; tail: number } +} + +// `PersistentPty.UpdateInput` once renaming lands: `size` optional, `title: null` clears the user title. +export type MockPersistentPtyUpdate = { + attachmentID?: string + size?: { cols: number; rows: number } + title?: string | null +} + +// Published on rename; not yet part of `OpenCodeEvent`. +export type MockPersistentPtyUpdated = { + id: string + created: number + type: "persistent-pty.updated" + data: { sessionID: string; terminal: MockPersistentPtyInfo } +} + +export type MockServerEvent = OpenCodeEvent | MockPersistentPtyUpdated + +// The JSON text frames the server sends; output travels as binary frames. +export type MockPersistentPtyMessage = + | { + type: "attached" + attachmentID: string + inputProtocol: 0 | 1 + info: MockPersistentPtyInfo + role: "controller" | "observer" + generation: number + replay: { requestedOffset: number; availableOffset: number; endOffset: number; truncated: boolean } + } + | { type: "replay_complete"; endOffset: number } + | { type: "resized"; cols: number; rows: number; generation: number; checkpoint: string } + | { type: "controller_changed"; attachmentID?: string; generation: number } + | { type: "exited"; exitCode?: number; finalOffset: number } + | { type: "title_changed"; title: string } + +// One decoded `input_protocol=1` frame: type 0 takes control at a size, type 1 also writes `data`. +export type MockPersistentPtyFrame = { type: 0 | 1; cols: number; rows: number; data: string } + +export type MockPersistentPtySocket = { + id: string + attachmentID: string + url: URL + cursor: number + takeover: boolean + role: "controller" | "observer" + inputProtocol: 0 | 1 + frames: MockPersistentPtyFrame[] + // Text written to the terminal (type 1 frame data, or raw messages without the input protocol). + input: string[] + // JSON control messages sent to the client, in order. + messages: MockPersistentPtyMessage[] + closed: boolean + close(code?: number, reason?: string): Promise +} + +export type MockPersistentPty = { + // Read by `/api/info`; tests may change both mid-test. + capability: boolean | undefined + renameSupported: boolean + // Live terminals in creation order. + terminals: MockPersistentPtyInfo[] + created: MockPersistentPtyInfo[] + removed: string[] + updates: { id: string; body: MockPersistentPtyUpdate }[] + tokens: { id: string; headers: Record; ticket: string }[] + sockets: MockPersistentPtySocket[] + // Connects refused because the terminal, or an unused ticket issued for it, was missing. + rejected: { id: string; url: URL; reason: string }[] + // A terminal created by another client: it appears through `persistent-pty.added`. + add(seed: MockPersistentPtySeed): MockPersistentPtyInfo + // Shell output: advances `output.tail` and streams to every open socket of the terminal. + output(id: string, data: string | Uint8Array): void + // The shell exits: `exited` on every socket, which then closes, then the server removes the terminal. + exit(id: string, exitCode?: number | null): void + // Another client closed the terminal: its sockets close and `persistent-pty.removed` is published. + remove(id: string): void + // Another attachment (default "mock-other-client"), or none, takes control: `controller_changed` on every socket. + takeControl(id: string, attachmentID?: string | null): void + // The canonical size changes: `resized` with a checkpoint on every socket. + resize(id: string, size: { cols: number; rows: number }): void + // The shell sets its OSC title: `title_changed` when the effective title changes. + setOscTitle(id: string, title: string): void + // Another client renames the terminal (`null` clears): `title_changed` and `persistent-pty.updated`. + rename(id: string, title: string | null): void + // The current controller's attachment ID. + controller(id: string): string | undefined + // Closes the terminal's open sockets, as a dropped connection does. + close(id: string, code?: number, reason?: string): Promise + // The server restarts and adopts the daemon: terminals and output stay, open sockets close (1012) and unused tickets + // expire. The event stream is not touched; use `installSseTransport(...).disconnect()` to drop it as well. + restart(): Promise +} + +type Terminal = { + info: MockPersistentPtyInfo + createTitle: string + oscTitle: string + bytes: Uint8Array + controller?: string + generation: number +} + +type Connection = MockPersistentPtySocket & { ws: WebSocketRoute } + +const DEFAULT_SIZE = { cols: 80, rows: 24 } + +const OTHER_CLIENT = "mock-other-client" + +export function createPersistentPty( + input: { config?: MockPersistentPtyConfig; directory: string }, + emit: (events: MockServerEvent[]) => void, +) { + const terminals = new Map() + const tickets: { id: string; ticket: string }[] = [] + const counters = { id: 0, ticket: 0, event: 0 } + const connections: Connection[] = [] + const encoder = new TextEncoder() + + const event = (type: T) => { + counters.event += 1 + + return { id: `evt_mock_persistent_pty_${counters.event}`, created: Date.now(), type } + } + + const open = (id: string) => connections.filter((item) => item.id === id && !item.closed) + + const send = (connection: Connection, message: MockPersistentPtyMessage | Uint8Array) => { + if (connection.closed) return + + if (message instanceof Uint8Array) return connection.ws.send(Buffer.from(message)) + connection.messages.push(message) + connection.ws.send(JSON.stringify(message)) + } + + const broadcast = (id: string, message: MockPersistentPtyMessage | Uint8Array) => + open(id).forEach((item) => send(item, message)) + + // Server-side closes release control here instead of relying on Playwright's `onClose`. + const close = (items: Connection[], code: number, reason: string) => { + const closing = items.filter((item) => !item.closed) + closing.forEach((item) => (item.closed = true)) + closing.forEach(release) + + return Promise.all(closing.map((item) => item.ws.close({ code, reason }))).then(() => undefined) + } + + // Like the daemon, control passes to the most recent remaining attachment. A late close of a replaced socket that + // shares the controller's attachment ID is an observer by then, so it leaves the new controller alone. + const release = (connection: Connection) => { + const terminal = terminals.get(connection.id) + + if (!terminal || connection.role !== "controller" || terminal.controller !== connection.attachmentID) return + setController(terminal, open(connection.id).at(-1)?.attachmentID) + } + + const get = (id: string) => { + const found = terminals.get(id) + + if (!found) throw new Error(`No persistent PTY ${id}`) + + return found + } + + const effectiveTitle = (terminal: Terminal) => terminal.info.userTitle || terminal.oscTitle || terminal.createTitle + + const retitle = (terminal: Terminal) => { + const title = effectiveTitle(terminal) + + if (title === terminal.info.title) return + terminal.info.title = title + broadcast(terminal.info.id, { type: "title_changed", title }) + } + + const checkpoint = (terminal: Terminal) => Buffer.from(terminal.bytes).toString("base64") + + const setController = (terminal: Terminal, attachmentID: string | undefined) => { + terminal.generation += 1 + terminal.controller = attachmentID + connections + .filter((item) => item.id === terminal.info.id) + .forEach((item) => (item.role = item.attachmentID === attachmentID ? "controller" : "observer")) + broadcast(terminal.info.id, { + type: "controller_changed", + attachmentID, + generation: terminal.generation, + }) + } + + const resize = (terminal: Terminal, size: { cols: number; rows: number }) => { + if (terminal.info.size.cols === size.cols && terminal.info.size.rows === size.rows) return + terminal.info.size = { cols: size.cols, rows: size.rows } + broadcast(terminal.info.id, { + type: "resized", + cols: size.cols, + rows: size.rows, + generation: terminal.generation, + checkpoint: checkpoint(terminal), + }) + } + + // Skips IDs that a seed claims or that a terminal used, live or removed. + const allocate = (): string => { + counters.id += 1 + const id = `pty_persistent_${counters.id}` + + if (terminals.has(id) || pty.removed.includes(id) || input.config?.initial?.some((seed) => seed.id === id)) { + return allocate() + } + + return id + } + + const build = (seed: MockPersistentPtySeed) => { + const id = seed.id ?? allocate() + + if (!id.startsWith("pty")) throw new Error(`Persistent PTY IDs must start with "pty": ${id}`) + const bytes = encoder.encode(seed.output ?? "") + const createTitle = seed.title ?? "Terminal" + + const terminal: Terminal = { + createTitle, + oscTitle: "", + bytes, + generation: 0, + info: { + id, + title: seed.userTitle || createTitle, + userTitle: seed.userTitle ?? null, + command: seed.command ?? "cmd.exe", + args: seed.args ?? [], + cwd: seed.cwd ?? input.directory, + status: "running", + pid: 1, + sessionID: seed.sessionID, + foregroundProcess: seed.foregroundProcess ?? null, + size: seed.size ?? DEFAULT_SIZE, + output: { head: 0, tail: bytes.length }, + }, + } + + terminals.set(id, terminal) + + return terminal.info + } + + const drop = (terminal: Terminal) => { + terminals.delete(terminal.info.id) + pty.terminals.splice(pty.terminals.indexOf(terminal.info), 1) + pty.removed.push(terminal.info.id) + tickets.splice(0, tickets.length, ...tickets.filter((item) => item.id !== terminal.info.id)) + void close(open(terminal.info.id), 1000, "") + emit([ + { ...event("persistent-pty.removed"), data: { sessionID: terminal.info.sessionID, ptyID: terminal.info.id } }, + ]) + } + + const added = (info: MockPersistentPtyInfo) => { + pty.terminals.push(info) + pty.created.push(info) + emit([{ ...event("persistent-pty.added"), data: { sessionID: info.sessionID, terminal: info } }]) + + return info + } + + const rename = (terminal: Terminal, title: string | null) => { + terminal.info.userTitle = title || null + retitle(terminal) + emit([ + { ...event("persistent-pty.updated"), data: { sessionID: terminal.info.sessionID, terminal: terminal.info } }, + ]) + } + + // Type 0 and type 1 frames both make the sender controller at the frame's size, as the daemon does. + const interact = (connection: Connection, size: { cols: number; rows: number }, data?: Uint8Array) => { + const terminal = terminals.get(connection.id) + + if (!terminal || connection.closed) return + + if (terminal.controller !== connection.attachmentID) setController(terminal, connection.attachmentID) + resize(terminal, size) + + if (data) connection.input.push(new TextDecoder().decode(data)) + } + + const pty: MockPersistentPty = { + capability: input.config?.capability, + renameSupported: input.config?.renameSupported ?? true, + terminals: [], + created: [], + removed: [], + updates: [], + tokens: [], + sockets: connections, + rejected: [], + add: (seed) => added(build(seed)), + output(id, data) { + const terminal = get(id) + const bytes = Predicate.isString(data) ? encoder.encode(data) : data + const next = new Uint8Array(terminal.bytes.length + bytes.length) + next.set(terminal.bytes) + next.set(bytes, terminal.bytes.length) + terminal.bytes = next + terminal.info.output = { head: terminal.info.output.head, tail: next.length } + + if (bytes.length > 0) broadcast(id, bytes) + }, + exit(id, exitCode) { + const terminal = get(id) + terminal.info.status = "exited" + terminal.info.exitCode = exitCode ?? undefined + broadcast(id, { + type: "exited", + exitCode: exitCode ?? undefined, + finalOffset: terminal.info.output.tail, + }) + drop(terminal) + }, + remove: (id) => drop(get(id)), + takeControl: (id, attachmentID = OTHER_CLIENT) => setController(get(id), attachmentID ?? undefined), + resize: (id, size) => resize(get(id), size), + setOscTitle(id, title) { + const terminal = get(id) + terminal.oscTitle = title + retitle(terminal) + }, + rename: (id, title) => rename(get(id), title), + controller: (id) => get(id).controller, + close: (id, code = 1011, reason = "mock socket closed") => close(open(id), code, reason), + restart() { + tickets.splice(0) + terminals.forEach((terminal) => (terminal.controller = undefined)) + + return close(connections, 1012, "server restarted") + }, + } + + pty.terminals.push(...(input.config?.initial ?? []).map(build)) + + return Object.assign(pty, { + find: (id: string) => terminals.get(id)?.info, + list: (sessionID: string) => pty.terminals.filter((item) => item.sessionID === sessionID), + create(sessionID: string, body: PersistentPty.CreateInput) { + return added( + build({ + sessionID, + title: body.title, + cwd: body.cwd, + command: body.command, + args: [...body.args], + size: body.size, + }), + ) + }, + // Resizes when `size` is present and renames when `title` is present, like the server's update handler. + update(id: string, body: MockPersistentPtyUpdate) { + const terminal = get(id) + pty.updates.push({ id, body }) + + if (body.size) resize(terminal, body.size) + + if (body.title !== undefined) rename(terminal, body.title) + + return terminal.info + }, + snapshot(id: string) { + const terminal = get(id) + + return { + info: terminal.info, + text: new TextDecoder().decode(terminal.bytes), + checkpoint: checkpoint(terminal), + cursor: { x: 0, y: 0 }, + } + }, + issue(id: string, headers: Record) { + counters.ticket += 1 + const ticket = `e2e-persistent-ticket-${counters.ticket}` + tickets.push({ id, ticket }) + pty.tokens.push({ id, headers, ticket }) + + return ticket + }, + // Follows the server's connect handler: `attached`, the replay from `cursor` as one binary frame, then + // `replay_complete`; a controller attachment then broadcasts `controller_changed`. + connect(ws: WebSocketRoute) { + const url = new URL(ws.url()) + const id = decodeURIComponent(url.pathname.split("/")[4] ?? "") + const terminal = terminals.get(id) + const ticket = url.searchParams.get("ticket") + const index = tickets.findIndex((item) => item.id === id && item.ticket === ticket) + const cursor = Number(url.searchParams.get("cursor") ?? "0") + + const reason = + !terminal || pty.capability === false + ? "terminal unavailable" + : index < 0 + ? "No unused ticket was issued for this terminal" + : !Number.isSafeInteger(cursor) || cursor < 0 + ? "Invalid cursor" + : undefined + + if (!terminal || reason) { + pty.rejected.push({ id, url, reason: reason ?? "terminal unavailable" }) + + return ws.close({ + code: reason === "terminal unavailable" ? 4404 : 1008, + reason: reason ?? "terminal unavailable", + }) + } + + tickets.splice(index, 1) + const role = url.searchParams.get("role") === "observer" ? "observer" : "controller" + const takeover = url.searchParams.get("takeover") === "true" + const attachmentID = url.searchParams.get("attachment_id") ?? crypto.randomUUID() + + if (role === "controller" && terminal.controller && terminal.controller !== attachmentID && !takeover) { + pty.rejected.push({ id, url, reason: "terminal already has a controller" }) + + return ws.close({ code: 4404, reason: "terminal unavailable" }) + } + + const connection: Connection = { + ws, + id, + attachmentID, + url, + cursor, + takeover, + role, + inputProtocol: url.searchParams.get("input_protocol") === "1" ? 1 : 0, + frames: [], + input: [], + messages: [], + closed: false, + close: (code = 1011, reason = "mock socket closed") => close([connection], code, reason), + } + + ws.onMessage((message) => { + const data = Predicate.isString(message) ? Buffer.from(message) : message + + if (connection.inputProtocol === 0) return interact(connection, terminal.info.size, data) + + if (data.byteLength < 5) return + const type = data[0] + const cols = data.readUInt16BE(1) + const rows = data.readUInt16BE(3) + + if ((type !== 0 && type !== 1) || cols === 0 || rows === 0) return + const payload = data.subarray(5) + connection.frames.push({ type, cols, rows, data: type === 1 ? new TextDecoder().decode(payload) : "" }) + interact(connection, { cols, rows }, type === 1 ? payload : undefined) + }) + ws.onClose(() => { + if (connection.closed) return + connection.closed = true + release(connection) + }) + connections.push(connection) + + if (role === "controller" && terminal.controller !== attachmentID) { + terminal.generation += 1 + terminal.controller = attachmentID + } + + connection.role = terminal.controller === attachmentID ? "controller" : "observer" + const start = Math.max(terminal.info.output.head, Math.min(cursor, terminal.bytes.length)) + + send(connection, { + type: "attached", + attachmentID, + inputProtocol: connection.inputProtocol, + info: terminal.info, + role: connection.role, + generation: terminal.generation, + replay: { + requestedOffset: cursor, + availableOffset: start, + endOffset: terminal.bytes.length, + truncated: false, + }, + }) + + if (start < terminal.bytes.length) send(connection, terminal.bytes.subarray(start)) + send(connection, { type: "replay_complete", endOffset: terminal.bytes.length }) + + if (role !== "controller") return + connections.filter((item) => item.id === id && item !== connection).forEach((item) => (item.role = "observer")) + broadcast(id, { type: "controller_changed", attachmentID, generation: terminal.generation }) + }, + }) +} From 237a847056522ec78a5c64ab7db5a19736e1ea58 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" <219766164+opencode-agent[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:37:33 -0500 Subject: [PATCH 17/83] fix(console): use default OG image on /go (#60397) Co-authored-by: adamdotdevin --- packages/console/app/src/routes/go/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/console/app/src/routes/go/index.tsx b/packages/console/app/src/routes/go/index.tsx index 17673e70211d..64ce5cd450f4 100644 --- a/packages/console/app/src/routes/go/index.tsx +++ b/packages/console/app/src/routes/go/index.tsx @@ -119,7 +119,7 @@ export default function Home() { {i18n.t("go.title")} - +
From b5c223182c06947eb14935b8af205fee933984d9 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Thu, 29 Oct 2026 20:32:27 -0500 Subject: [PATCH 18/83] fix(core): run dynamic provider npm fallback after external sdk hooks (#60380) --- packages/core/src/plugin/internal.ts | 3 + packages/core/src/plugin/provider.ts | 2 - packages/core/test/plugin/supervisor.test.ts | 81 ++++++++++++++++++++ packages/server/src/workerd.ts | 25 +++++- packages/server/test/workerd.test.ts | 11 +++ 5 files changed, 119 insertions(+), 3 deletions(-) diff --git a/packages/core/src/plugin/internal.ts b/packages/core/src/plugin/internal.ts index 8a01fb384def..6ee27e4aeb94 100644 --- a/packages/core/src/plugin/internal.ts +++ b/packages/core/src/plugin/internal.ts @@ -99,6 +99,7 @@ import { GoalPlugin } from "./goal.js" import { ModelsDevPlugin } from "./models-dev.js" import { McpCodeModeDefaultsPlugin } from "./mcp-codemode-defaults.js" import { ProviderPlugins } from "./provider.js" +import { DynamicProviderPlugin } from "./provider/dynamic.js" import { OpencodePlugin } from "./provider/opencode.js" import { WebSearchPlugins } from "./websearch/index.js" import { SkillPlugin } from "./skill.js" @@ -276,6 +277,8 @@ const post = [ ConfigCompatibilityPlugin.Plugin, ConfigSkillPlugin.Plugin, ConfigProviderPlugin.Plugin, + // Run the dynamic npm SDK loader after SDK, instance, and external plugins register their `sdk` hooks. + DynamicProviderPlugin, ConfigWebSearchPlugin.Plugin, ConfigPolicyPlugin.Plugin, ] as const satisfies readonly InternalPlugin[] diff --git a/packages/core/src/plugin/provider.ts b/packages/core/src/plugin/provider.ts index 60501ab4beaa..a465a2f8b6d3 100644 --- a/packages/core/src/plugin/provider.ts +++ b/packages/core/src/plugin/provider.ts @@ -6,7 +6,6 @@ import { CloudflareAIGatewayPlugin } from "./provider/cloudflare-ai-gateway.js" import { CloudflareWorkersAIPlugin } from "./provider/cloudflare-workers-ai.js" import { DatabricksPlugin } from "./provider/databricks.js" import { DigitalOceanPlugin } from "./provider/digitalocean.js" -import { DynamicProviderPlugin } from "./provider/dynamic.js" import { GithubCopilotPlugin } from "./provider/github-copilot.js" import { GitLabPlugin } from "./provider/gitlab.js" import { GoogleVertexPlugin } from "./provider/google-vertex.js" @@ -60,5 +59,4 @@ export const ProviderPlugins: PluginInternal.InternalPlugin[] = [ VLLMPlugin, XAIPlugin, ZenmuxPlugin, - DynamicProviderPlugin, ] diff --git a/packages/core/test/plugin/supervisor.test.ts b/packages/core/test/plugin/supervisor.test.ts index ffbc2f709cdd..d32117141884 100644 --- a/packages/core/test/plugin/supervisor.test.ts +++ b/packages/core/test/plugin/supervisor.test.ts @@ -1,16 +1,21 @@ import { describe, expect } from "bun:test" import { Deferred, Duration, Effect, Layer, LayerMap, Stream } from "effect" import { TestClock } from "effect/testing" +import type { LanguageModelV3 } from "@ai-sdk/provider" import { define } from "@opencode/plugin/effect/plugin" import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder" import { LayerNode } from "@opencode/util/effect/layer-node" import { Global } from "@opencode/util/global" +import { Npm } from "@opencode/util/npm" +import { AISDK } from "@opencode/core/aisdk" import { Command } from "@opencode/core/command" import { ConfigPluginSource } from "@opencode/core/config/plugin/source" import { Instance } from "@opencode/core/instance" import { LocationServiceMap } from "@opencode/core/location-services" import { Location } from "@opencode/core/location" +import { Model } from "@opencode/core/model" import { Plugin } from "@opencode/core/plugin" +import { Provider } from "@opencode/core/provider" import { SdkPlugins } from "@opencode/core/plugin/sdk" import { AbsolutePath } from "@opencode/core/schema" import { Database } from "../../src/database/database" @@ -57,6 +62,32 @@ const instances = Layer.effect( Global.node.replace(tempGlobalLayer), offlineModels, ConfigPluginSource.node.replace(sourceLayer), + Npm.node.replace( + Layer.succeed( + Npm.Service, + Npm.Service.of({ + add: (pkg) => + Effect.fail( + new Npm.InstallFailedError({ + add: [pkg], + dir: "", + cause: new Error(`Unexpected Npm.add(${pkg})`), + }), + ), + resolve: (name) => Effect.succeed({ directory: "", name }), + check: () => Effect.succeed(false), + update: (pkg) => + Effect.fail( + new Npm.InstallFailedError({ + add: [pkg], + dir: "", + cause: new Error(`Unexpected Npm.update(${pkg})`), + }), + ), + which: () => Effect.undefined, + }), + ), + ), LocationServiceMap.node.replace(Layer.succeed(LocationServiceMap.Service, map)), Instance.node.replace( Layer.succeed(Instance.Service, { @@ -298,4 +329,54 @@ describe("PluginSupervisor", () => { } }), ) + + it.effect("runs SDK plugin aisdk.sdk hooks before the dynamic npm fallback", () => + Effect.gen(function* () { + const sdk = yield* SdkPlugins.Service + const providerID = Provider.ID.make("cloudflare") + const fakeLanguageModel: LanguageModelV3 = { + specificationVersion: "v3", + provider: "cloudflare", + modelId: "workers-ai", + supportedUrls: {}, + doGenerate: () => Promise.reject(new Error("unused")), + doStream: () => Promise.reject(new Error("unused")), + } + yield* sdk.register( + define({ + id: "cloudflare.aisdk", + effect: (ctx) => + ctx.aisdk + .hook( + "sdk", + (evt) => { + if (evt.package !== "agents/models/opencode") return Effect.void + evt.sdk = { languageModel: () => fakeLanguageModel } + return Effect.void + }, + { providerID }, + ) + .pipe(Effect.asVoid), + }), + ) + const directory = yield* tmpdirScoped() + const locations = yield* LocationServiceMap.Service + const language = yield* Effect.gen(function* () { + const plugins = yield* Plugin.Service + const aisdk = yield* AISDK.Service + yield* plugins.awaitActivation + return yield* aisdk.language( + Model.Info.make({ + ...Model.Info.default(providerID, Model.ID.make("workers-ai")), + modelID: Model.ID.make("workers-ai"), + package: "aisdk:agents/models/opencode", + }), + ) + }).pipe( + Effect.scoped, + Effect.provide(locations.get(Location.Ref.make({ directory: AbsolutePath.make(directory.path) }))), + ) + expect(language).toBe(fakeLanguageModel) + }), + ) }) diff --git a/packages/server/src/workerd.ts b/packages/server/src/workerd.ts index 12664e7f6425..db72fdb1ab25 100644 --- a/packages/server/src/workerd.ts +++ b/packages/server/src/workerd.ts @@ -13,6 +13,7 @@ import { Snapshot } from "@opencode/core/snapshot" import { Vcs } from "@opencode/core/vcs" import { CrossSpawnSpawner } from "@opencode/util/cross-spawn-spawner" import type { LayerNode } from "@opencode/util/effect/layer-node" +import { Npm } from "@opencode/util/npm" import { ServerFetch } from "./fetch" import type { ServerOptions } from "./options" @@ -27,7 +28,8 @@ import type { ServerOptions } from "./options" * condition. * - Bare locations use a typed no-execution-plane process spawner; FileSystem, * FileSystemSearch, and Pty fail with a clear defect until a remote sandbox - * backs them; Snapshot and Vcs degrade to no-op results. + * backs them; Npm fails package installs with a typed workerd error; Snapshot + * and Vcs degrade to no-op results. * - Config is injected as a string (no filesystem); plugin discovery is * precompiled-only, and stdio MCP reports the same no-plane failure as Shell. * @@ -82,6 +84,7 @@ export function replacements(options: Options): LayerNode.Replacements { FileSystem.node.replace(fileSystemLayer), FileSystemSearch.node.replace(fileSystemSearchLayer), Pty.node.replace(ptyLayer), + Npm.node.replace(npmLayer), // Precompiled (internal and SDK) plugins only: no plugin-directory scan, npm // install, or import of plugin code from disk. ConfigPluginSource.node.replace(ConfigPluginSource.empty), @@ -90,6 +93,26 @@ export function replacements(options: Options): LayerNode.Replacements { const unavailable = (what: string) => Effect.die(new Error(`${what} is unavailable in the workerd profile`)) +const npmUnavailable = (what: string, pkg: string) => + Effect.fail( + new Npm.InstallFailedError({ + add: [pkg], + dir: "", + cause: new Error(`${what} is unavailable in the workerd profile`), + }), + ) + +const npmLayer = Layer.succeed( + Npm.Service, + Npm.Service.of({ + add: (pkg) => npmUnavailable("Npm.add", pkg), + resolve: (name) => Effect.succeed({ directory: "", name }), + check: () => Effect.succeed(false), + update: (pkg) => npmUnavailable("Npm.update", pkg), + which: () => Effect.undefined, + }), +) + // Vcs degrades to empty results, matching its behavior for locations without a // supported VCS, so read-only clients never need to special-case this runtime. const vcsLayer = Layer.succeed( diff --git a/packages/server/test/workerd.test.ts b/packages/server/test/workerd.test.ts index ed2099473c74..abfe04004d1a 100644 --- a/packages/server/test/workerd.test.ts +++ b/packages/server/test/workerd.test.ts @@ -1,5 +1,7 @@ import { expect } from "bun:test" import { Effect } from "effect" +import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder" +import { Npm } from "@opencode/util/npm" import { makeDurableObjectStorage } from "../../core/test/fixture/durable-object-storage" import { it } from "../../core/test/lib/effect" import { ServerWorkerd } from "../src/workerd" @@ -31,3 +33,12 @@ it.live("boots the workerd profile over durable object storage", () => expect(body).toMatchObject({ version: "workerd-test" }) }), ) + +it.effect("fails Npm.add with a clear workerd error instead of running the installer", () => + Effect.gen(function* () { + const npm = yield* Npm.Service + const error = yield* npm.add("some-package").pipe(Effect.flip) + expect(error).toBeInstanceOf(Npm.InstallFailedError) + expect(String(error.cause)).toContain("Npm.add is unavailable in the workerd profile") + }).pipe(Effect.provide(AppNodeBuilder.build(Npm.node, ServerWorkerd.replacements({ storage: makeDurableObjectStorage() })))), +) From 4d9e4de3871e08b39f7862782c46db95e8bdd43c Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Thu, 29 Oct 2026 20:34:48 -0500 Subject: [PATCH 19/83] fix(ai): accept typed tools in loop (#60390) --- packages/ai/src/tool.ts | 9 ++--- packages/ai/test/loop-tools.types.ts | 50 ++++++++++++++++++++++++++++ packages/ai/tsconfig.types.json | 2 ++ 3 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 packages/ai/test/loop-tools.types.ts diff --git a/packages/ai/src/tool.ts b/packages/ai/src/tool.ts index 9fd9da30f25c..6d48cb6193be 100644 --- a/packages/ai/src/tool.ts +++ b/packages/ai/src/tool.ts @@ -74,14 +74,11 @@ export interface Definition, Success extends readonly toStructuredOutput?: (output: Success["Encoded"]) => unknown /** @internal */ readonly _decode: (input: unknown) => Effect.Effect, Schema.SchemaError> + // Method syntax keeps these parameters bivariant, so a concrete tool stays assignable to `AnyExecutableTool`. /** @internal */ - readonly _encode: (value: Schema.Schema.Type) => Effect.Effect + _encode(value: Schema.Schema.Type): Effect.Effect /** @internal */ - readonly _project: ( - parameters: Schema.Schema.Type, - id: ToolCallPart["id"], - output: unknown, - ) => ToolOutputType + _project(parameters: Schema.Schema.Type, id: ToolCallPart["id"], output: unknown): ToolOutputType /** @internal */ readonly _legacyResult: boolean /** @internal */ diff --git a/packages/ai/test/loop-tools.types.ts b/packages/ai/test/loop-tools.types.ts new file mode 100644 index 000000000000..843baa7a34ad --- /dev/null +++ b/packages/ai/test/loop-tools.types.ts @@ -0,0 +1,50 @@ +import { Effect, Schema } from "effect" +import { LLM } from "../src/effect.js" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import { Auth } from "../src/route.js" +import { Tool } from "../src/tool.js" +import { AI, ai } from "../src/index.js" + +const model = OpenAIChat.route.with({ auth: Auth.bearer("fixture") }).model({ id: "gpt-4o-mini" }) + +const add = AI.tool({ + description: "Add two numbers.", + parameters: Schema.Struct({ a: Schema.Number, b: Schema.Number }), + execute: (input) => input.a + input.b, +}) + +const echo = AI.tool({ + description: "Echo text.", + parameters: Schema.String, + execute: (input) => input.toUpperCase(), +}) + +const weather = Tool.make({ + description: "Get weather.", + parameters: Schema.Struct({ city: Schema.String }), + success: Schema.Struct({ forecast: Schema.String }), + execute: (input) => Effect.succeed({ forecast: input.city }), +}) + +const shout = Tool.make({ + description: "Shout text.", + parameters: Schema.String, + success: Schema.String, + execute: (input) => Effect.succeed(input.toUpperCase()), +}) + +const schemaOnly = Tool.make({ + description: "Get weather.", + parameters: Schema.Struct({ city: Schema.String }), + success: Schema.Struct({ forecast: Schema.String }), +}) + +ai.llm.loop({ model, prompt: "Add 2 and 3.", tools: { add } }) +ai.llm.loop({ model, prompt: "Get weather.", tools: { weather } }) +ai.llm.loop({ model, prompt: "Use any tool.", tools: { add, echo, weather, shout } }) +LLM.loop({ model, prompt: "Add 2 and 3.", tools: { add } }) +LLM.loop({ model, prompt: "Get weather.", tools: { weather } }) +LLM.loop({ model, prompt: "Use any tool.", tools: { add, echo, weather, shout } }) + +// @ts-expect-error The loop runs tools, so each one needs an execute handler. +LLM.loop({ model, prompt: "Get weather.", tools: { schemaOnly } }) diff --git a/packages/ai/tsconfig.types.json b/packages/ai/tsconfig.types.json index 911f47029d01..fd12c46e32a2 100644 --- a/packages/ai/tsconfig.types.json +++ b/packages/ai/tsconfig.types.json @@ -8,6 +8,8 @@ "include": [ "example/**/*.ts", "test/**/*.types.ts", + "test/loop.test.ts", + "test/promise.test.ts", "test/testing.test.ts", "test/testing-media.test.ts", "test/provider/checkpoint.test.ts" From e761e265d2d5e6ff4a1c0756ab8d8eeee0db501e Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" <219766164+opencode-agent[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:09:55 -0400 Subject: [PATCH 20/83] feat(tui): mark the selected composer suggestion under new designs (#60393) Co-authored-by: jlongster <17031+jlongster@users.noreply.github.com> --- .../tui/src/component/prompt/autocomplete.tsx | 153 ++++++++++++------ 1 file changed, 108 insertions(+), 45 deletions(-) diff --git a/packages/tui/src/component/prompt/autocomplete.tsx b/packages/tui/src/component/prompt/autocomplete.tsx index 561555165c17..444297a6e2ea 100644 --- a/packages/tui/src/component/prompt/autocomplete.tsx +++ b/packages/tui/src/component/prompt/autocomplete.tsx @@ -1,16 +1,32 @@ -import { measureEditText, type BoxRenderable, type TextareaRenderable, type ScrollBoxRenderable } from "@opentui/core" +import { + measureEditText, + type RGBA, + type BoxRenderable, + type TextareaRenderable, + type ScrollBoxRenderable, +} from "@opentui/core" import { pathToFileURL } from "node:url" import fuzzysort from "fuzzysort" import path from "path" import { firstBy } from "remeda" -import { createMemo, createResource, createEffect, onMount, onCleanup, Index, Show, createSignal } from "solid-js" +import { + createMemo, + createResource, + createEffect, + onMount, + onCleanup, + Index, + Show, + createSignal, + type JSX, +} from "solid-js" import { createStore } from "solid-js/store" import { useEditorContext } from "../../context/editor" import { useClient } from "../../context/client" import { useData } from "../../context/data" import { getScrollAcceleration } from "../../util/scroll" import { useTuiPaths } from "../../context/runtime" -import { useConfig } from "../../config" +import { useConfig, useNewDesigns } from "../../config" import { useLocation } from "../../context/location" import { useTheme } from "../../context/theme" import { SplitBorder } from "../../ui/border" @@ -82,6 +98,7 @@ export function Autocomplete(props: { const dimensions = useTerminalDimensions() const frecency = useFrecency() const config = useConfig().data + const newDesigns = useNewDesigns() const paths = useTuiPaths() const location = useLocation() const [store, setStore] = createStore({ @@ -849,6 +866,8 @@ export function Autocomplete(props: { return "No matching files, agents, or references" }) const emptyError = createMemo(() => store.visible === "reference" && !files.loading && visibleFiles().failed) + // The scrollbox paints this under the classic design; new designs paint it per row. + const rowBackground = () => (newDesigns() ? theme.background.raised.high : undefined) const labels = { skill: "skill", agent: "agent", @@ -864,6 +883,8 @@ export function Autocomplete(props: { width={position().width} zIndex={100} {...SplitBorder} + // Under new designs each row draws its own left rail so the selected row can show the selection bar. + border={newDesigns() ? ["right"] : SplitBorder.border} borderColor={theme.border.base} > - {emptyMessage()} - + + + {/* Under new designs the 1-row popup keeps the message on one line, so it never scrolls past the rail. */} + + {newDesigns() ? Locale.truncate(emptyMessage(), Math.max(1, position().width - 4)) : emptyMessage()} + + + } > {(option, index) => { @@ -900,57 +935,69 @@ export function Autocomplete(props: { return action !== undefined && action.id === confirming() } return ( - moveTo(index)} - onMouseDown={() => moveTo(index)} - onMouseUp={() => select()} > - moveTo(index)} + onMouseDown={() => moveTo(index)} + onMouseUp={() => select()} > - {Locale.truncateMiddle( - confirmingAction() ? (destructive()?.confirm ?? "") : option().display, - contentWidth(), - )} - - - - {" " + option().description?.replace(/\s+/g, " ").trim()} - - - - - {label()} + {Locale.truncateMiddle( + confirmingAction() ? (destructive()?.confirm ?? "") : option().display, + contentWidth(), + )} - - + + + {" " + option().description?.replace(/\s+/g, " ").trim()} + + + + + + {label()} + + + + ) }} @@ -958,3 +1005,19 @@ export function Autocomplete(props: { ) } + +// Under new designs the popup's left border is drawn per row, so the selected row's segment +// becomes the selection bar, matching dialog rows. `color` overrides the border color. +function AutocompleteRail(props: { enabled: boolean; color?: RGBA; children: JSX.Element }) { + const theme = useTheme() + return ( + + + + ┃ + + {props.children} + + + ) +} From e705b565624a6e6b1839d0f395023ec9cc1ed219 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Thu, 29 Oct 2026 21:29:53 -0500 Subject: [PATCH 21/83] feat(ai): type OpenRouter options on the Responses route (#60044) --- packages/ai/src/providers/openrouter.ts | 58 ++++++++++++++----- .../ai/src/providers/openrouter/responses.ts | 3 +- .../test/provider-options/openrouter.types.ts | 22 +++++++ packages/ai/test/provider-package.test.ts | 25 ++++++-- packages/ai/test/provider/openrouter.test.ts | 42 +++++++++++++- 5 files changed, 128 insertions(+), 22 deletions(-) diff --git a/packages/ai/src/providers/openrouter.ts b/packages/ai/src/providers/openrouter.ts index 09c042a98e8b..5ca224653290 100644 --- a/packages/ai/src/providers/openrouter.ts +++ b/packages/ai/src/providers/openrouter.ts @@ -8,6 +8,7 @@ import type { ProviderPackage } from "../provider-package.js" import { SystemOne } from "../protocols/system-one.js" import { OpenAIImages, type OpenAIImageSizing } from "../protocols/openai-images.js" import { MediaRoute } from "../route/media.js" +import { HttpTransport } from "../route/transport/index.js" import { OpenAIChat } from "../protocols/openai-chat.js" import { OpenResponses } from "../protocols/open-responses.js" import { cacheControl } from "../protocols/utils/cache.js" @@ -74,6 +75,9 @@ export interface OpenRouterOptions { export type OpenRouterProviderOptionsInput = OpenRouterOptions +export type OpenRouterResponsesProviderOptionsInput = OpenResponsesProviderOptionsInput & + Pick + export interface OpenRouterDecisionOptions { readonly [key: string]: unknown readonly provider?: OpenRouterProviderRouting @@ -85,7 +89,7 @@ export interface OpenRouterDecisionOptions { export type Config = Omit & ProviderAuthOption<"optional"> & { readonly baseURL?: string - readonly providerOptions?: OpenRouterProviderOptionsInput | OpenResponsesProviderOptionsInput + readonly providerOptions?: OpenRouterProviderOptionsInput | OpenRouterResponsesProviderOptionsInput } export type Settings = ProviderPackage.Settings & @@ -94,14 +98,18 @@ export type Settings = ProviderPackage readonly baseURL?: string } -const Options = Schema.Struct({ - usage: lenient(Schema.Union([Schema.Boolean, JsonObject])), +const SharedOptions = Schema.Struct({ models: lenient(Schema.Array(Schema.String)), provider: lenient(JsonObject), plugins: lenient(Schema.Array(JsonObject)), - web_search_options: lenient(JsonObject), debug: lenient(JsonObject), user: lenient(Schema.String), +}) + +const Options = Schema.Struct({ + ...SharedOptions.fields, + usage: lenient(Schema.Union([Schema.Boolean, JsonObject])), + web_search_options: lenient(JsonObject), reasoning: lenient(JsonObject), }) const decodeOptions = Schema.decodeUnknownSync(Options) @@ -166,12 +174,8 @@ const bodyOptions = (body: OpenAIChat.OpenAIChatBody, input: unknown, maxTokens: ...options, ...body, ...(usage !== undefined ? { usage } : {}), - ...(known.models !== undefined ? { models: known.models } : {}), - ...(known.provider !== undefined ? { provider: known.provider } : {}), - ...(known.plugins !== undefined ? { plugins: known.plugins } : {}), + ...sharedOptions(known), ...(known.web_search_options !== undefined ? { web_search_options: known.web_search_options } : {}), - ...(known.debug !== undefined ? { debug: known.debug } : {}), - ...(known.user !== undefined ? { user: known.user } : {}), ...(known.reasoning !== undefined ? { reasoning: fitReasoning(known.reasoning, maxTokens) } : {}), } } @@ -191,6 +195,32 @@ const imageSizing: OpenAIImageSizing = (request) => { } } +const sharedOptions = (known: typeof SharedOptions.Type) => ({ + ...(known.models !== undefined ? { models: known.models } : {}), + ...(known.provider !== undefined ? { provider: known.provider } : {}), + ...(known.plugins !== undefined ? { plugins: known.plugins } : {}), + ...(known.debug !== undefined ? { debug: known.debug } : {}), + ...(known.user !== undefined ? { user: known.user } : {}), +}) + +const OpenRouterResponsesBody = Schema.Struct({ + ...OpenResponses.OpenResponsesBody.fields, + ...SharedOptions.fields, +}) +type OpenRouterResponsesBody = Schema.Schema.Type + +const responsesProtocol = Protocol.make({ + id: "openrouter-responses", + body: { + schema: OpenRouterResponsesBody, + from: (request) => + OpenResponses.fromRequest(request).pipe( + Effect.map((body) => ({ ...body, ...sharedOptions(decodeOptions(request.providerOptions ?? {})) })), + ), + }, + stream: OpenResponses.protocol.stream, +}) + export const route = Route.make({ id: ADAPTER, provider: id, @@ -204,9 +234,9 @@ const responsesRoute = Route.make({ id: "openrouter-responses", provider: id, providerMetadataKey: "openrouter", - protocol: OpenResponses.protocol, + protocol: responsesProtocol, endpoint: Endpoint.path("/responses", { baseURL }), - transport: OpenResponses.httpTransport, + transport: HttpTransport.sseJson.with(), defaults: { providerOptions: { store: false, include: ["reasoning.encrypted_content"] } }, }) @@ -247,7 +277,7 @@ export const configure = (input: Config = {}) => { model: (modelID: string | ModelID) => chatRoute.model({ id: modelID, compatibility: { supportsPromptCacheKey: true } }), responses: (modelID: string | ModelID) => - configuredResponses.model({ id: modelID }), + configuredResponses.model({ id: modelID }), image, decision, configure, @@ -261,8 +291,8 @@ export const responses = provider.responses export const model: ProviderPackage.Model = (modelID, settings) => configure(config(settings)).model(modelID) export const responsesModel: ProviderPackage.Model< - Settings, - OpenResponsesProviderOptionsInput + Settings, + OpenRouterResponsesProviderOptionsInput > = (modelID, settings) => configure(config(settings)).responses(modelID) export const imageModel = (modelID: string, settings?: Settings) => { const input = config(settings) diff --git a/packages/ai/src/providers/openrouter/responses.ts b/packages/ai/src/providers/openrouter/responses.ts index 34a9c7f2e13b..efabaea27ded 100644 --- a/packages/ai/src/providers/openrouter/responses.ts +++ b/packages/ai/src/providers/openrouter/responses.ts @@ -1,4 +1,3 @@ -import type { OpenResponsesProviderOptionsInput } from "../open-responses-options.js" import type { OpenRouter } from "../openrouter.js" export { responsesModel as model } from "../openrouter.js" -export type Settings = OpenRouter.Settings +export type Settings = OpenRouter.Settings diff --git a/packages/ai/test/provider-options/openrouter.types.ts b/packages/ai/test/provider-options/openrouter.types.ts index ce1741711dda..ad1a7375e60f 100644 --- a/packages/ai/test/provider-options/openrouter.types.ts +++ b/packages/ai/test/provider-options/openrouter.types.ts @@ -31,3 +31,25 @@ LLM.request({ // @ts-expect-error OpenRouter usage must be boolean or an option record. providerOptions: { usage: "yes" }, }) + +const responses = OpenRouter.provider.responses("openai/gpt-5.4") + +LLM.request({ + model: responses, + prompt: "Hello", + providerOptions: { + reasoningEffort: "low", + models: ["openai/gpt-5.4-mini"], + provider: { only: ["openai"], sort: "future-sort", data_collection: "future-policy" }, + plugins: [{ id: "future-plugin", enabled: true }], + debug: { echo_upstream_body: true }, + user: "user_123", + }, +}) + +LLM.request({ + model: responses, + prompt: "Hello", + // @ts-expect-error OpenRouter fallback models must be a list of model IDs. + providerOptions: { models: "openai/gpt-5.4-mini" }, +}) diff --git a/packages/ai/test/provider-package.test.ts b/packages/ai/test/provider-package.test.ts index e2b02ddcbcca..46e1877b6008 100644 --- a/packages/ai/test/provider-package.test.ts +++ b/packages/ai/test/provider-package.test.ts @@ -60,9 +60,24 @@ describe("provider package entrypoints", () => { test("maps OpenRouter, DigitalOcean and Venice Responses entrypoints onto provider-owned routes", async () => { const providers = [ - ["openrouter", "https://openrouter.ai/api/v1", await import("@opencode/ai/providers/openrouter/responses")], - ["digitalocean", "https://inference.do-ai.run/v1", await import("@opencode/ai/providers/digitalocean/responses")], - ["venice", "https://api.venice.ai/api/v1", await import("@opencode/ai/providers/venice/responses")], + [ + "openrouter", + "https://openrouter.ai/api/v1", + "openrouter-responses", + await import("@opencode/ai/providers/openrouter/responses"), + ], + [ + "digitalocean", + "https://inference.do-ai.run/v1", + "open-responses", + await import("@opencode/ai/providers/digitalocean/responses"), + ], + [ + "venice", + "https://api.venice.ai/api/v1", + "open-responses", + await import("@opencode/ai/providers/venice/responses"), + ], ] as const const settings = { apiKey: "fixture", @@ -70,11 +85,11 @@ describe("provider package entrypoints", () => { body: { future_option: true }, reasoningEffort: "low", } - for (const [provider, baseURL, module] of providers) { + for (const [provider, baseURL, protocol, module] of providers) { const selected = module.model("gpt-5.4", settings) expect(selected.provider).toBe(provider) expect(selected.route.id).toBe(`${provider}-responses`) - expect(selected.route.protocol).toBe("open-responses") + expect(selected.route.protocol).toBe(protocol) expect(selected.route.endpoint).toMatchObject({ baseURL, path: "/responses" }) expect(selected.route.defaults.headers).toEqual(settings.headers) expect(selected.route.defaults.http?.body).toEqual(settings.body) diff --git a/packages/ai/test/provider/openrouter.test.ts b/packages/ai/test/provider/openrouter.test.ts index 22eb27c4e8f8..16e1b65b2821 100644 --- a/packages/ai/test/provider/openrouter.test.ts +++ b/packages/ai/test/provider/openrouter.test.ts @@ -5,7 +5,7 @@ import { LLMClient } from "../../src/route.js" import { compileRequest } from "../../src/route/client.js" import * as OpenRouter from "../../src/providers/openrouter.js" import { it } from "../lib/effect.js" -import { fixedResponse } from "../lib/http.js" +import { dynamicResponse, fixedResponse } from "../lib/http.js" import { sseEvents } from "../lib/sse.js" describe("OpenRouter", () => { @@ -391,6 +391,46 @@ describe("OpenRouter", () => { }), ) + it.effect("sends OpenRouter routing options on the Responses route", () => + LLMClient.generate( + LLM.request({ + model: OpenRouter.configure({ + apiKey: "test-key", + providerOptions: { + models: ["openai/gpt-5.4-mini"], + provider: { only: ["openai"], allow_fallbacks: false }, + plugins: [{ id: "response-healing" }], + debug: { echo_upstream_body: true }, + user: "user_123", + reasoningEffort: "low", + }, + }).responses("openai/gpt-5.4"), + prompt: "Hello", + }), + ).pipe( + Effect.provide( + dynamicResponse((input) => + Effect.sync(() => { + expect(input.request.url).toBe("https://openrouter.ai/api/v1/responses") + expect(JSON.parse(input.text)).toMatchObject({ + model: "openai/gpt-5.4", + store: false, + reasoning: { effort: "low" }, + models: ["openai/gpt-5.4-mini"], + provider: { only: ["openai"], allow_fallbacks: false }, + plugins: [{ id: "response-healing" }], + debug: { echo_upstream_body: true }, + user: "user_123", + }) + return input.respond(sseEvents({ type: "response.completed", response: { id: "resp_1" } }), { + headers: { "content-type": "text/event-stream" }, + }) + }), + ), + ), + ), + ) + it.effect("omits the prompt cache key when caching is disabled", () => Effect.gen(function* () { const prepared = yield* compileRequest( From 03491204c769f8244d0c7742f181fd4d2c6b049d Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Thu, 29 Oct 2026 21:31:05 -0500 Subject: [PATCH 22/83] fix(ai): don't send filename with file_url on Responses (#60382) --- packages/ai/src/protocols/open-responses.ts | 5 +++-- packages/ai/test/provider/explicit-compaction.test.ts | 2 +- packages/ai/test/provider/openai-responses.test.ts | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/ai/src/protocols/open-responses.ts b/packages/ai/src/protocols/open-responses.ts index 7e5b54126f16..c07db846e972 100644 --- a/packages/ai/src/protocols/open-responses.ts +++ b/packages/ai/src/protocols/open-responses.ts @@ -52,7 +52,7 @@ export const OpenResponsesInputImage = Schema.Struct({ }) export const OpenResponsesInputFile = Schema.Struct({ type: Schema.tag("input_file"), - filename: Schema.String, + filename: Schema.optional(Schema.String), detail: Schema.optional(Schema.String), file_data: Schema.optional(Schema.String), file_url: Schema.optional(Schema.String), @@ -590,11 +590,12 @@ const lowerMedia = Effect.fnUntraced(function* (part: MediaPart, request: LLMReq const location = url ?? (yield* ProviderShared.requireInlineMedia(adapter.name, part.media)).dataUrl if (part.media.kind !== "image") { if (part.media.kind === "video") return { type: "input_video" as const, video_url: location } + if (url) return { type: "input_file" as const, file_url: url, detail } return { type: "input_file" as const, filename: part.filename ?? (mime === "application/pdf" ? "document.pdf" : "file"), detail, - ...(url ? { file_url: url } : { file_data: location }), + file_data: location, } } return { diff --git a/packages/ai/test/provider/explicit-compaction.test.ts b/packages/ai/test/provider/explicit-compaction.test.ts index 0574132585e2..326a53abce5b 100644 --- a/packages/ai/test/provider/explicit-compaction.test.ts +++ b/packages/ai/test/provider/explicit-compaction.test.ts @@ -198,7 +198,7 @@ const retainedItems = [ content: [ { type: "input_image", image_url: "https://example.com/image.png" }, { type: "input_file", filename: "report.pdf", file_data: "data:application/pdf;base64,cGRm", detail: "high" }, - { type: "input_file", filename: "other.pdf", file_url: "https://example.com/report.pdf", detail: "low" }, + { type: "input_file", file_url: "https://example.com/report.pdf", detail: "low" }, ], }, checkpoint, diff --git a/packages/ai/test/provider/openai-responses.test.ts b/packages/ai/test/provider/openai-responses.test.ts index 661897121598..0f95ce50b3ef 100644 --- a/packages/ai/test/provider/openai-responses.test.ts +++ b/packages/ai/test/provider/openai-responses.test.ts @@ -1874,7 +1874,7 @@ describe("OpenAI Responses route", () => { expect(expectToolOutput(prepared.body).output).toEqual([ { type: "input_image", image_url: "https://example.com/image.png" }, - { type: "input_file", filename: "report.pdf", file_url: "https://example.com/report.pdf" }, + { type: "input_file", file_url: "https://example.com/report.pdf" }, ]) }), ) @@ -5130,7 +5130,7 @@ describe("OpenAI Responses route", () => { role: "user", content: [ { type: "input_image", image_url: "https://example.com/image.png" }, - { type: "input_file", filename: "report.pdf", file_url: "https://example.com/report.pdf" }, + { type: "input_file", file_url: "https://example.com/report.pdf" }, ], }, ]) From 4785478249d17e7c83110f6e694ba298b8987303 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Thu, 29 Oct 2026 19:36:03 -0700 Subject: [PATCH 23/83] fix(app): tidy the Extensions submenus (#59468) --- .../e2e/regression/session-summary.spec.ts | 14 +- packages/gui-plugins/src/details/details.css | 181 ++++++++++++------ .../gui-plugins/src/details/flyout-motion.ts | 26 +++ .../gui-plugins/src/details/server-panel.tsx | 3 + packages/ui/src/components/truncated-text.tsx | 3 +- 5 files changed, 169 insertions(+), 58 deletions(-) create mode 100644 packages/gui-plugins/src/details/flyout-motion.ts diff --git a/packages/app/e2e/regression/session-summary.spec.ts b/packages/app/e2e/regression/session-summary.spec.ts index f9cce652afad..4ea24f3a0af9 100644 --- a/packages/app/e2e/regression/session-summary.spec.ts +++ b/packages/app/e2e/regression/session-summary.spec.ts @@ -557,6 +557,8 @@ test("MCP rows toggle once per action and keep sign-in, errors, and management a } }) .toEqual({ width: 6, height: 6, alignment: 0, gap: 8 }) + // Like every other control in the menu, a row that toggles its server keeps the default cursor. + await expect(row("figma")).not.toHaveCSS("cursor", "pointer") await page.screenshot({ path: test.info().outputPath("mcp-toggles.png"), animations: "disabled" }) for (const [index, target] of ["label", "dot", "padding", "control", "keyboard"].entries()) { @@ -567,7 +569,11 @@ test("MCP rows toggle once per action and keep sign-in, errors, and management a ? await holdRoute(page, /\/api\/experimental\/mcp\/figma\/disconnect(?:\?|$)/, { method: "POST" }) : undefined - if (target === "label") await row("figma").locator('[data-slot="truncated-text-label"]').click() + if (target === "label") { + await row("figma").locator('[data-slot="truncated-text-label"]').click() + // A name that fits has nothing to reveal, so a click on it leaves no focus ring of its own. + await expect(row("figma").locator('[data-component="tooltip-v2-trigger"]')).not.toBeFocused() + } if (target === "dot") await row("figma").locator(".session-service-dot").click() @@ -842,6 +848,12 @@ test("long MCP lists stay in the viewport in a real RTL locale", async ({ page } const menu = page.getByRole("group", { name: "MCP", exact: true }) await expect(menu.locator(".session-mcp-row")).toHaveCount(30) await expect.poll(() => menu.evaluate((element) => element.scrollHeight > element.clientHeight)).toBe(true) + // Long names truncate; the list only scrolls vertically. + expect(await menu.evaluate((element) => element.scrollWidth - element.clientWidth)).toBe(0) + // The submenu shows and moves without motion unless its Knobs toggle is on. + expect( + await page.locator(".session-service-flyout").evaluate((element) => getComputedStyle(element).transitionDuration), + ).toBe("0s") await expect .poll(async () => { const bounds = (await menu.boundingBox())! diff --git a/packages/gui-plugins/src/details/details.css b/packages/gui-plugins/src/details/details.css index f12da4f62da3..d2f2e56ed1d5 100644 --- a/packages/gui-plugins/src/details/details.css +++ b/packages/gui-plugins/src/details/details.css @@ -71,11 +71,16 @@ .session-summary-row:focus-visible, .session-service-config:focus-visible, button.session-service-row:focus-visible, -.session-mcp-row:focus-within { +:is(.session-service-row, .session-mcp-row):has(:focus-visible) { outline: none; background: var(--v2-overlay-simple-overlay-hover); } +/* A name that reveals its full text on focus shows that focus on its row, never as a ring of its own. */ +:is(.session-service-pane, .session-service-drawer) [data-component="tooltip-v2-trigger"]:focus-visible { + outline: none; +} + @media (hover: hover) { button.session-summary-row:hover, .session-service-config:not(:disabled):hover, @@ -141,16 +146,10 @@ button.session-service-row:focus-visible, max-width: calc(100vw - 32px); pointer-events: none; visibility: hidden; - transition: - transform 0.3s var(--spring-snap), - visibility 0s linear 0.11s; &[data-open] { pointer-events: auto; visibility: visible; - transition: - transform 0.3s var(--spring-snap), - visibility 0s; } } @@ -162,10 +161,6 @@ button.session-service-row:focus-visible, scale: 0.96; translate: 4px 0; transform-origin: right top; - transition: - opacity 0.11s cubic-bezier(0.4, 0, 1, 1), - scale 0.11s cubic-bezier(0.4, 0, 1, 1), - translate 0.11s cubic-bezier(0.4, 0, 1, 1); &:dir(rtl) { translate: -4px 0; @@ -176,10 +171,6 @@ button.session-service-row:focus-visible, opacity: 1; scale: 1; translate: 0 0; - transition: - opacity 0.15s cubic-bezier(0.2, 0.8, 0.2, 1), - scale 0.15s cubic-bezier(0.2, 0.8, 0.2, 1), - translate 0.15s cubic-bezier(0.2, 0.8, 0.2, 1); } } @@ -198,39 +189,141 @@ button.session-service-row:focus-visible, font-weight: 440; line-height: var(--line-height-compact); clip-path: inset(0 0 calc(100% - var(--flyout-height)) 0 round 6px); - transition: clip-path 0.3s var(--spring-snap); +} + +/* Motion is off unless the "Extensions submenu motion" knob sets data-motion. */ +.session-service-flyout[data-motion] { + transition: + transform 0.3s var(--spring-snap), + visibility 0s linear 0.11s; + + &[data-open] { + transition: + transform 0.3s var(--spring-snap), + visibility 0s; + } + + .session-service-flyout-body { + transition: + opacity 0.11s cubic-bezier(0.4, 0, 1, 1), + scale 0.11s cubic-bezier(0.4, 0, 1, 1), + translate 0.11s cubic-bezier(0.4, 0, 1, 1); + } + + &[data-open] .session-service-flyout-body { + transition: + opacity 0.15s cubic-bezier(0.2, 0.8, 0.2, 1), + scale 0.15s cubic-bezier(0.2, 0.8, 0.2, 1), + translate 0.15s cubic-bezier(0.2, 0.8, 0.2, 1); + } + + .session-service-flyout-surface { + transition: clip-path 0.3s var(--spring-snap); + } } .session-service-pane { grid-area: 1 / 1; align-self: start; max-height: min(480px, calc(100dvh - 36px)); + /* Only vertical: long names truncate rather than scroll sideways. */ + overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; outline: none; + --session-service-scrollbar: 0px; /* Lists swap at once; only the box glides and resizes, so two lists never show together. */ &:not([data-active]) { visibility: hidden; pointer-events: none; } +} - /* A list taller than the viewport scrolls under soft edges. */ - &[data-overflow] { - mask-image: linear-gradient(to bottom, transparent, #000 12px, #000 calc(100% - 16px), transparent); +/* A long list keeps the menu's 2px inset at both ends, and fades only at an edge with rows scrolled past it. The + scrollbar's strip stays unmasked, so the thumb never fades. */ +@property --session-service-fade-start { + syntax: ""; + inherits: false; + initial-value: 0px; +} + +@property --session-service-fade-end { + syntax: ""; + inherits: false; + initial-value: 0px; +} + +@keyframes session-service-fade-start { + from { + --session-service-fade-start: 0px; + } + to { + --session-service-fade-start: 16px; + } +} - > .session-service-pane-content { - padding-block: 12px 16px; +@keyframes session-service-fade-end { + from { + --session-service-fade-end: 16px; + } + to { + --session-service-fade-end: 0px; + } +} + +@supports (animation-timeline: scroll()) { + .session-service-pane[data-overflow] { + mask-image: + linear-gradient(#000, #000), + linear-gradient( + to bottom, + transparent, + #000 var(--session-service-fade-start), + #000 calc(100% - var(--session-service-fade-end)), + transparent + ); + mask-size: + var(--session-service-scrollbar) 100%, + 100% 100%; + mask-position: + right top, + left top; + mask-repeat: no-repeat; + animation: + session-service-fade-start linear both, + session-service-fade-end linear both; + animation-timeline: scroll(self), scroll(self); + animation-range: + 0 16px, + calc(100% - 16px) 100%; + + &:dir(rtl) { + mask-position: + left top, + left top; } } } -.session-service-pane [data-slot="truncated-text-label"] { - text-overflow: clip; - mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent); +/* The thumb sits 6px inside the menu's edge and clear of its corners, rather than against the border. */ +@media (hover: hover) and (pointer: fine) { + @supports selector(::-webkit-scrollbar) { + .session-service-pane { + --session-service-scrollbar: 12px; + } - &:dir(rtl) { - mask-image: linear-gradient(to left, #000 calc(100% - 20px), transparent); + .session-service-pane::-webkit-scrollbar { + width: 12px; + } + + .session-service-pane::-webkit-scrollbar-track:vertical { + margin: 6px 0; + } + + .session-service-pane::-webkit-scrollbar-thumb { + border-width: 2px 4px; + } } } @@ -307,6 +400,12 @@ button.session-service-row:focus-visible, margin: 2px -2px; background: var(--v2-border-border-muted); } + +/* Inside a submenu's scroll box, a full-bleed separator would overflow it sideways. */ +.session-service-pane .session-service-config-separator { + width: auto; + margin-inline: 0; +} .session-service-config { display: inline-flex; align-items: center; @@ -316,12 +415,6 @@ button.session-service-row:focus-visible, text-align: start; text-decoration: none; cursor: pointer; - - &:focus-visible { - outline: 2px solid var(--v2-border-border-focus); - outline-offset: 2px; - border-radius: 2px; - } } .session-service-dot { display: grid; @@ -420,10 +513,6 @@ button.session-service-dot { letter-spacing: 0.05px; } -div.session-mcp-row { - cursor: pointer; -} - @media (max-width: 639px), (hover: none) { .session-mcp-row { min-height: 44px; @@ -484,24 +573,4 @@ div.session-mcp-row { .session-service-dot::before { animation: none; } - - /* No travel: the flyout and its lists only fade. */ - .session-service-flyout { - transition: visibility 0s linear 0.15s; - } - - .session-service-flyout[data-open] { - transition: visibility 0s; - } - - .session-service-flyout-surface { - transition: none; - } - - .session-service-flyout-body, - .session-service-flyout[data-open] .session-service-flyout-body { - scale: none; - translate: none; - transition: opacity 0.15s ease-out; - } } diff --git a/packages/gui-plugins/src/details/flyout-motion.ts b/packages/gui-plugins/src/details/flyout-motion.ts new file mode 100644 index 000000000000..46cc770f52fa --- /dev/null +++ b/packages/gui-plugins/src/details/flyout-motion.ts @@ -0,0 +1,26 @@ +import { createSignal, onCleanup } from "solid-js" +import { observeReducedMotion, prefersReducedMotion } from "@opencode/ui/motion" +import { motionTuning } from "@opencode/ui/motion-tuning" + +// The Extensions submenu's motion (fading in beside its row, gliding between rows and resizing to each list) is off +// unless this knob is on. Off, the submenu shows, moves and resizes on the frame it changes. +const toggle = motionTuning.toggle("details.flyout.motion", { + label: "Extensions submenu motion", + group: "Header", + subsection: "Extensions", + description: "The submenu fading in beside its row, gliding between rows and resizing to each list", + target: ".session-service-flyout", + value: false, +}) + +/** Whether the Extensions submenu animates: only with its knob on, and never under reduced motion. Reactive; call it + * inside a component so its listeners end with it. */ +export function createFlyoutMotion() { + const read = () => toggle() && !prefersReducedMotion() + const [motion, setMotion] = createSignal(read()) + + onCleanup(motionTuning.subscribe(() => setMotion(read()))) + onCleanup(observeReducedMotion(() => setMotion(read()))) + + return motion +} diff --git a/packages/gui-plugins/src/details/server-panel.tsx b/packages/gui-plugins/src/details/server-panel.tsx index fcca9bd905ec..58676c32dbed 100644 --- a/packages/gui-plugins/src/details/server-panel.tsx +++ b/packages/gui-plugins/src/details/server-panel.tsx @@ -27,6 +27,7 @@ import { createKeyed, useDrawer, usePlugin, type MountedSession } from "@opencod import { globalConfigDirectory, serviceConfigFile } from "./config-file" import { configuredLsps } from "./configured-lsp" import { builtinContext } from "@opencode/plugin/gui/builtin" +import { createFlyoutMotion } from "./flyout-motion" const services = [ { type: "mcp", icon: "mcp", label: "mcp" }, @@ -101,6 +102,7 @@ function ServiceMenu(props: ServiceProps & { mobile?: boolean; name: string }) { const ctx = usePlugin() const drawer = useDrawer() const id = createUniqueId() + const motion = createFlyoutMotion() // A new scope whenever visibility changes closes the flyout. const scope = createMemo( @@ -435,6 +437,7 @@ function ServiceMenu(props: ServiceProps & { mobile?: boolean; name: string }) { ref={flyout} class="session-service-flyout" data-open={active() !== undefined || undefined} + data-motion={motion() || undefined} inert={active() === undefined || undefined} style={{ transform: `translateY(${offset()}px)` }} onKeyDown={keydown} diff --git a/packages/ui/src/components/truncated-text.tsx b/packages/ui/src/components/truncated-text.tsx index c995f45d8f92..b5ce2dcf93df 100644 --- a/packages/ui/src/components/truncated-text.tsx +++ b/packages/ui/src/components/truncated-text.tsx @@ -17,7 +17,8 @@ export function TruncatedText(props: { text: string; class?: string }) { {props.text}} disabled={!store.truncated} - triggerTabIndex={store.truncated ? 0 : -1} + // Focusable only while there is more to reveal; a -1 would still let a click focus the name. + triggerTabIndex={store.truncated ? 0 : undefined} class={`truncated-text ${props.class ?? ""}`} contentClass="truncated-text-tooltip" > From c45aae77abc932ae53059cd2c254b9acd9d3e4e6 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Thu, 29 Oct 2026 21:37:15 -0500 Subject: [PATCH 24/83] chore(release): require notes for stable releases and remove old changelog tools (#60429) --- .github/release/plan-release.sh | 6 +- .github/release/publish-discord.sh | 2 +- .github/workflows/release.yml | 3 +- .gitignore | 1 - .opencode/command/changelog.md | 49 ----- script/changelog.ts | 76 -------- script/raw-changelog.ts | 283 ----------------------------- script/release.ts | 2 - 8 files changed, 8 insertions(+), 414 deletions(-) delete mode 100644 .opencode/command/changelog.md delete mode 100755 script/changelog.ts delete mode 100644 script/raw-changelog.ts diff --git a/.github/release/plan-release.sh b/.github/release/plan-release.sh index 1febdebc1349..62876f6f8c07 100755 --- a/.github/release/plan-release.sh +++ b/.github/release/plan-release.sh @@ -3,7 +3,7 @@ # (INPUT_BUMP, INPUT_VERSION) only, and writes them to $GITHUB_OUTPUT. Nothing here reads repository files. # # push or dispatch on dev -> dev 0.0.0-dev- npm tag dev, desktop -# dispatch on dev with bump/version -> latest x.y.z npm tag latest, releasers only +# dispatch on dev with bump/version -> latest x.y.z npm tag latest, releasers only, notes required # push or dispatch on beta -> beta 0.0.0-beta- desktop only # pull_request -> pr 0.0.0-pr- everything, dry run # @@ -20,6 +20,10 @@ case "$GITHUB_EVENT_NAME:$GITHUB_REF:$versioned" in *) die "$GITHUB_EVENT_NAME on $GITHUB_REF cannot publish (versioned: $versioned)" ;; esac +if [ "$channel" = latest ] && [ -z "${INPUT_RELEASE_NOTES//[[:space:]]/}" ]; then + die "Stable releases need release notes; generate them with ./script/release.ts --print" +fi + if [ "$channel" = latest ]; then actor=${GITHUB_TRIGGERING_ACTOR:-${GITHUB_ACTOR:-}} [ -n "$actor" ] || die "Stable releases can only be started by releasers; the triggering actor is unknown" diff --git a/.github/release/publish-discord.sh b/.github/release/publish-discord.sh index b22e13c1ee73..790428ab2ff8 100755 --- a/.github/release/publish-discord.sh +++ b/.github/release/publish-discord.sh @@ -9,7 +9,7 @@ payload=$(jq -n --arg tag "$tag" --arg notes "${OPENCODE_RELEASE_NOTES:-}" \ ($notes | if length > 4000 then .[:4000] + "\n\n[Full release notes](\($url))" else . end) as $description | { allowed_mentions: {parse: []}, - embeds: [{title: "OpenCode V2 \($tag)", url: $url, color: 2829099} + if $description == "" then {} else {description: $description} end] + embeds: [{title: "OpenCode V2 \($tag)", url: $url, description: $description, color: 2829099}] }') echo "$payload" | jq . if dry_run; then exit 0; fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fead99408e46..3c0a05594e76 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ on: required: false type: string release_notes: - description: "Reviewed V2 release notes for CHANGELOG.md and the GitHub release (optional)" + description: "Reviewed V2 release notes for CHANGELOG.md and the GitHub release (required with bump or version)" required: false type: string @@ -72,6 +72,7 @@ jobs: GH_TOKEN: ${{ github.token }} # reads the triggering actor's repository role for stable releases INPUT_BUMP: ${{ inputs.bump }} INPUT_VERSION: ${{ inputs.version }} + INPUT_RELEASE_NOTES: ${{ inputs.release_notes }} # A versioned release builds from a commit with its versions and changelog on the dispatched dev commit, # tagged v. Runs git only. diff --git a/.gitignore b/.gitignore index 477fdab9d85f..1b2296b95730 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,6 @@ target # Local dev files opencode-dev -UPCOMING_CHANGELOG.md RELEASE_REVIEW.md logs/ *.bun-build diff --git a/.opencode/command/changelog.md b/.opencode/command/changelog.md deleted file mode 100644 index b28d963d005a..000000000000 --- a/.opencode/command/changelog.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -model: opencode/gpt-5.4 ---- - -Create `UPCOMING_CHANGELOG.md` from the structured changelog input below. -If `UPCOMING_CHANGELOG.md` already exists, ignore its current contents completely. -Do not preserve, merge, or reuse text from the existing file. - -The input already contains the exact commit range since the last non-draft release. -The commits are already filtered to the release-relevant packages and grouped into -the release sections. Do not fetch GitHub releases, PRs, or build your own commit list. -The input may also include a `## Community Contributors Input` section. - -Before writing any entry you keep, inspect the real diff with -`git show --stat --format='' ` or `git show --format='' ` so you can -understand the actual code changes and not just the commit message (they may be misleading). -Do not use `git log` or author metadata when deciding attribution. - -Rules: - -- Write the final file with release sections in this order: - `## Core`, `## TUI`, `## Desktop`, `## SDK`, `## Extensions` -- Only include sections that have at least one notable entry -- Within each release section, keep bug fixes grouped under `### Bugfixes` -- Keep other notable entries under `### Improvements` when a section has bug fixes too -- Omit empty subsections -- Keep one bullet per commit you keep -- Skip commits that are entirely internal, CI, tests, refactors, or otherwise not user-facing -- Start each bullet with a capital letter -- Prefer what changed for users over what code changed internally -- Do not copy raw commit prefixes like `fix:` or `feat:` or trailing PR numbers like `(#123)` -- Community attribution is deterministic: only preserve an existing `(@username)` suffix from the changelog input -- If an input bullet has no `(@username)` suffix, do not add one -- Never add a new `(@username)` suffix from `git show`, commit authors, names, or email addresses -- If no notable entries remain and there is no contributor block, write exactly `No notable changes.` -- If no notable entries remain but there is a contributor block, omit all release sections and return only the contributor block -- If the input contains `## Community Contributors Input`, append the block below that heading to the end of the final file verbatim -- Do not add, remove, rewrite, or reorder contributor names or commit titles in that block -- Do not derive the thank-you section from the main summary bullets -- Do not include the heading `## Community Contributors Input` in the final file -- Focus on writing the least words to get your point across - users will skim read the changelog, so we should be precise - -**Importantly, the changelog is for users (who are at least slightly technical), they may use the TUI, Desktop, SDK, Plugins and so forth. Be thorough in understanding flow on effects may not be immediately apparent. e.g. a package upgrade looks internal but may patch a bug. Or a refactor may also stabilise some race condition that fixes bugs for users. The PR title/body + commit message will give you the authors context, usually containing the outcome not just technical detail** - - - -!`bun script/raw-changelog.ts $ARGUMENTS` - - diff --git a/script/changelog.ts b/script/changelog.ts deleted file mode 100755 index 971c38c11126..000000000000 --- a/script/changelog.ts +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bun - -import { rm } from "fs/promises" -import path from "path" -import { parseArgs } from "util" - -const root = path.resolve(import.meta.dir, "..") -const file = path.join(root, "UPCOMING_CHANGELOG.md") -const { values, positionals } = parseArgs({ - args: Bun.argv.slice(2), - options: { - from: { type: "string", short: "f" }, - to: { type: "string", short: "t" }, - variant: { type: "string", default: "low" }, - quiet: { type: "boolean", default: false }, - print: { type: "boolean", default: false }, - help: { type: "boolean", short: "h", default: false }, - }, - allowPositionals: true, -}) -const args = [...positionals] - -if (values.from) args.push("--from", values.from) -if (values.to) args.push("--to", values.to) - -if (values.help) { - console.log(` -Usage: bun script/changelog.ts [options] - -Generates UPCOMING_CHANGELOG.md by running the opencode changelog command. - -Options: - -f, --from Starting version (default: latest non-draft GitHub release) - -t, --to Ending ref (default: HEAD) - --variant Thinking variant for opencode run (default: low) - --quiet Suppress opencode command output unless it fails - --print Print the generated UPCOMING_CHANGELOG.md after success - -h, --help Show this help message - -Examples: - bun script/changelog.ts - bun script/changelog.ts --from 1.0.200 - bun script/changelog.ts -f 1.0.200 -t 1.0.205 -`) - process.exit(0) -} - -await rm(file, { force: true }) - -const quiet = values.quiet -const cmd = ["opencode", "run"] -cmd.push("--variant", values.variant) -cmd.push("--command", "changelog", "--", ...args) - -const proc = Bun.spawn(cmd, { - cwd: root, - stdin: "inherit", - stdout: quiet ? "pipe" : "inherit", - stderr: quiet ? "pipe" : "inherit", -}) - -const [out, err] = quiet - ? await Promise.all([new Response(proc.stdout).text(), new Response(proc.stderr).text()]) - : ["", ""] -const code = await proc.exited -if (code === 0) { - if (values.print) process.stdout.write(await Bun.file(file).text()) - process.exit(0) -} - -if (quiet) { - if (out) process.stdout.write(out) - if (err) process.stderr.write(err) -} - -process.exit(code) diff --git a/script/raw-changelog.ts b/script/raw-changelog.ts deleted file mode 100644 index effa0f1d4727..000000000000 --- a/script/raw-changelog.ts +++ /dev/null @@ -1,283 +0,0 @@ -#!/usr/bin/env bun - -import { $ } from "bun" -import { parseArgs } from "util" - -type Release = { - tag_name: string - draft: boolean -} - -type Commit = { - hash: string - author: string | null - message: string - areas: Set -} - -type User = Map> -type Diff = { - sha: string - login: string | null - message: string -} - -const repo = process.env.GH_REPO ?? "anomalyco/opencode" -const bot = ["actions-user", "github-actions[bot]", "opencode", "opencode-agent[bot]"] -const team = [ - ...(await Bun.file(new URL("../.github/TEAM_MEMBERS", import.meta.url)) - .text() - .then((x) => x.split(/\r?\n/).map((x) => x.trim())) - .then((x) => x.filter((x) => x && !x.startsWith("#")))), - ...bot, -] -const order = ["Core", "TUI", "Desktop", "SDK", "Extensions"] as const -const sections = { - core: "Core", - tui: "TUI", - app: "Desktop", - tauri: "Desktop", - sdk: "SDK", - plugin: "SDK", - "extensions/vscode": "Extensions", - github: "Extensions", -} as const - -function ref(input: string) { - if (input === "HEAD") return input - if (input.startsWith("v")) return input - if (input.match(/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/)) return `v${input}` - return input -} - -async function latest() { - const data = await $`gh api "/repos/${repo}/releases?per_page=100"`.json() - const release = (data as Release[]).find((item) => !item.draft) - if (!release) throw new Error("No releases found") - return release.tag_name.replace(/^v/, "") -} - -async function diff(base: string, head: string) { - const list: Diff[] = [] - for (let page = 1; ; page++) { - const text = - await $`gh api "/repos/${repo}/compare/${base}...${head}?per_page=100&page=${page}" --jq '.commits[] | {sha: .sha, login: .author.login, message: .commit.message}'`.text() - const batch = text - .split("\n") - .filter(Boolean) - .map((line) => JSON.parse(line) as Diff) - if (batch.length === 0) break - list.push(...batch) - if (batch.length < 100) break - } - return list -} - -function section(areas: Set) { - const priority = ["core", "tui", "app", "tauri", "sdk", "plugin", "extensions/vscode", "github"] - for (const area of priority) { - if (areas.has(area)) return sections[area as keyof typeof sections] - } - return "Core" -} - -function type(message: string) { - if (message.match(/fix/i)) return "Bugfixes" - return "Improvements" -} - -function reverted(commits: Commit[]) { - const seen = new Map() - - for (const commit of commits) { - const match = commit.message.match(/^Revert "(.+)"$/) - if (match) { - const msg = match[1]! - if (seen.has(msg)) seen.delete(msg) - else seen.set(commit.message, commit) - continue - } - - const revert = `Revert "${commit.message}"` - if (seen.has(revert)) { - seen.delete(revert) - continue - } - - seen.set(commit.message, commit) - } - - return [...seen.values()] -} - -async function commits(from: string, to: string) { - const base = ref(from) - const head = ref(to) - - const data = new Map() - for (const item of await diff(base, head)) { - data.set(item.sha, { login: item.login, message: item.message.split("\n")[0] ?? "" }) - } - - const log = - await $`git log ${base}..${head} --format=%H -- packages/opencode packages/plugin packages/desktop packages/app sdks/vscode packages/extensions github`.text() - - const list: Commit[] = [] - for (const hash of log.split("\n").filter(Boolean)) { - const item = data.get(hash) - if (!item) continue - if (item.message.match(/^(ignore:|test:|chore:|ci:|release:)/i)) continue - - const diff = await $`git diff-tree --no-commit-id --name-only -r ${hash}`.text() - const areas = new Set() - - for (const file of diff.split("\n").filter(Boolean)) { - if (file.startsWith("packages/opencode/src/cli/cmd/")) areas.add("tui") - else if (file.startsWith("packages/opencode/")) areas.add("core") - else if (file.startsWith("packages/desktop/src-tauri/")) areas.add("tauri") - else if (file.startsWith("packages/desktop/") || file.startsWith("packages/app/")) areas.add("app") - else if (file.startsWith("packages/plugin/")) areas.add("sdk") - else if (file.startsWith("sdks/vscode/") || file.startsWith("github/")) areas.add("extensions/vscode") - } - - if (areas.size === 0) continue - - list.push({ - hash: hash.slice(0, 7), - author: item.login, - message: item.message, - areas, - }) - } - - return reverted(list) -} - -async function contributors(from: string, to: string) { - const base = ref(from) - const head = ref(to) - - const users: User = new Map() - for (const item of await diff(base, head)) { - const title = item.message.split("\n")[0] ?? "" - if (!item.login || team.includes(item.login)) continue - if (title.match(/^(ignore:|test:|chore:|ci:|release:)/i)) continue - if (!users.has(item.login)) users.set(item.login, new Set()) - users.get(item.login)!.add(title) - } - - return users -} - -async function published(to: string) { - if (to === "HEAD") return - const body = await $`gh release view ${ref(to)} --repo ${repo} --json body --jq .body`.text().catch(() => "") - if (!body) return - - const lines = body.split(/\r?\n/) - const start = lines.findIndex((line) => line.startsWith("**Thank you to ")) - if (start < 0) return - return lines.slice(start).join("\n").trim() -} - -async function thanks(from: string, to: string, reuse: boolean) { - const release = reuse ? await published(to) : undefined - if (release) return release.split(/\r?\n/) - - const users = await contributors(from, to) - if (users.size === 0) return [] - - const lines = [`**Thank you to ${users.size} community contributor${users.size > 1 ? "s" : ""}:**`] - for (const [name, commits] of users) { - lines.push(`- @${name}:`) - for (const commit of commits) lines.push(` - ${commit}`) - } - return lines -} - -function format(from: string, to: string, list: Commit[], thanks: string[]) { - const grouped = new Map>() - for (const title of order) { - grouped.set( - title, - new Map([ - ["Improvements", []], - ["Bugfixes", []], - ]), - ) - } - - for (const commit of list) { - const attr = commit.author && !team.includes(commit.author) ? ` (@${commit.author})` : "" - grouped.get(section(commit.areas))!.get(type(commit.message))!.push(`- \`${commit.hash}\` ${commit.message}${attr}`) - } - - const lines = [`Last release: ${ref(from)}`, `Target ref: ${to}`, ""] - - if (list.length === 0) { - lines.push("No notable changes.") - } - - for (const title of order) { - const groups = grouped.get(title) - if (!groups || [...groups.values()].every((entries) => entries.length === 0)) continue - lines.push(`## ${title}`) - const improvements = groups.get("Improvements")! - const bugfixes = groups.get("Bugfixes")! - if (bugfixes.length === 0) { - lines.push(...improvements) - lines.push("") - continue - } - - for (const [subtitle, entries] of groups) { - if (entries.length === 0) continue - lines.push(`### ${subtitle}`) - lines.push(...entries) - lines.push("") - } - } - - if (thanks.length > 0) { - if (lines.at(-1) !== "") lines.push("") - lines.push("## Community Contributors Input") - lines.push("") - lines.push(...thanks) - } - - if (lines.at(-1) === "") lines.pop() - return lines.join("\n") -} - -if (import.meta.main) { - const { values } = parseArgs({ - args: Bun.argv.slice(2), - options: { - from: { type: "string", short: "f" }, - to: { type: "string", short: "t", default: "HEAD" }, - help: { type: "boolean", short: "h", default: false }, - }, - }) - - if (values.help) { - console.log(` -Usage: bun script/raw-changelog.ts [options] - -Options: - -f, --from Starting version (default: latest non-draft GitHub release) - -t, --to Ending ref (default: HEAD) - -h, --help Show this help message - -Examples: - bun script/raw-changelog.ts - bun script/raw-changelog.ts --from 1.0.200 - bun script/raw-changelog.ts -f 1.0.200 -t 1.0.205 -`) - process.exit(0) - } - - const to = values.to! - const from = values.from ?? (await latest()) - const list = await commits(from, to) - console.log(format(from, to, list, await thanks(from, to, !values.from))) -} diff --git a/script/release.ts b/script/release.ts index 92fdfeead37e..d6b98cf99a19 100755 --- a/script/release.ts +++ b/script/release.ts @@ -10,7 +10,6 @@ import { parseArgs } from "util" const root = path.resolve(import.meta.dir, "..") const review = path.join(root, "RELEASE_REVIEW.md") -const changelog = path.join(root, "UPCOMING_CHANGELOG.md") const { values, positionals } = parseArgs({ args: Bun.argv.slice(2), options: { @@ -86,7 +85,6 @@ const notes = document.match(/\s*([\s\S]*?)\s*