@zusehq/serve 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-BKZzhoKT.mjs","names":["deploymentProfiles","packageMetadata.version"],"sources":["../package.json","../../client-runtime/src/connection.ts","../../contracts/src/ids.ts","../../contracts/src/agent.ts","../../contracts/src/analytics.ts","../../contracts/src/browser-shared.ts","../../contracts/src/composer.ts","../../contracts/src/fs.ts","../../contracts/src/naming.ts","../../contracts/src/pokemon.ts","../../contracts/src/worktree.ts","../../contracts/src/session.ts","../../contracts/src/attachment.ts","../../contracts/src/deployment-profiles.json","../../contracts/src/deployment.ts","../../contracts/src/auth.ts","../../contracts/src/autonomy.ts","../../contracts/src/browser.ts","../../contracts/src/cloud-workspaces.ts","../../contracts/src/cloud-billing.ts","../../contracts/src/connect.ts","../../contracts/src/context.ts","../../contracts/src/diagnostics.ts","../../contracts/src/workspace.ts","../../contracts/src/external-thread.ts","../../contracts/src/git.ts","../../contracts/src/handshake.ts","../../contracts/src/host.ts","../../contracts/src/keybindings.ts","../../contracts/src/linear.ts","../../contracts/src/machines.ts","../../contracts/src/mcp.ts","../../contracts/src/network-access.ts","../../contracts/src/pairing.ts","../../contracts/src/permission.ts","../../contracts/src/ping.ts","../../contracts/src/power.ts","../../contracts/src/pty.ts","../../contracts/src/relay.ts","../../contracts/src/repository-settings.ts","../../contracts/src/settings.ts","../../contracts/src/skill.ts","../../contracts/src/usage.ts","../../contracts/src/usage-limits.ts","../../contracts/src/rpc.ts","../../contracts/src/serve.ts","../../contracts/src/ssh.ts","../../contracts/src/tailnet.ts","../../client-runtime/src/ws-protocol.ts","../src/agent-cli.ts","../src/cli.ts"],"sourcesContent":["","import { Data, Effect, type Layer, ManagedRuntime, Scope } from \"effect\";\nimport type { Rpc } from \"effect/unstable/rpc\";\nimport { RpcClient, type RpcGroup } from \"effect/unstable/rpc\";\nimport type { RpcClientError } from \"effect/unstable/rpc/RpcClientError\";\n\nexport type ConnectionOptions = {\n\treadonly key: string;\n\treadonly endpoint: string;\n\treadonly token?: string | null;\n};\n\nexport type ClientSession<Client> = {\n\treadonly client: Client;\n\treadonly dispose: () => Promise<void>;\n};\n\nexport type ClientConnector<Options extends ConnectionOptions, Client> = (\n\toptions: Options,\n) => Promise<ClientSession<Client>>;\n\nexport class WireProtocolMismatchError extends Data.TaggedError(\n\t\"WireProtocolMismatchError\",\n)<{\n\treadonly expectedVersion: number;\n\treadonly receivedVersion: number;\n}> {}\n\nexport type VersionHandshake<Client, Error> = {\n\treadonly protocolVersion: number;\n\treadonly perform: (\n\t\tclient: Client,\n\t\thello: { readonly protocolVersion: number },\n\t) => Effect.Effect<{ readonly protocolVersion: number }, Error>;\n};\n\nexport const validateProtocolVersion = (\n\texpectedVersion: number,\n\treceivedVersion: number,\n): Effect.Effect<void, WireProtocolMismatchError> =>\n\texpectedVersion === receivedVersion\n\t\t? Effect.void\n\t\t: Effect.fail(\n\t\t\t\tnew WireProtocolMismatchError({\n\t\t\t\t\texpectedVersion,\n\t\t\t\t\treceivedVersion,\n\t\t\t\t}),\n\t\t\t);\n\nexport const withWireProtocolVersion = (\n\turl: string,\n\tprotocolVersion: number,\n): string => {\n\tconst parsed = new URL(url);\n\tparsed.searchParams.set(\"wireVersion\", String(protocolVersion));\n\treturn parsed.toString();\n};\n\n/**\n * Own the Effect runtime and scope behind a client connection. Transport\n * adapters supply only their protocol layer and scoped client constructor.\n */\nexport const makeManagedClientSession = async <\n\tRequirements,\n\tLayerError,\n\tClient,\n\tClientError,\n>(\n\tlayer: Layer.Layer<Requirements, LayerError>,\n\tmakeClient: (\n\t\tscope: Scope.Scope,\n\t) => Effect.Effect<Client, ClientError, Requirements>,\n): Promise<ClientSession<Client>> => {\n\tconst runtime = ManagedRuntime.make(layer);\n\ttry {\n\t\tconst client = await runtime.runPromise(makeClient(runtime.scope));\n\t\treturn { client, dispose: () => runtime.dispose() };\n\t} catch (cause) {\n\t\tawait runtime.dispose();\n\t\tthrow cause;\n\t}\n};\n\n/** Build a scoped Effect RPC client without exposing runtime scope to apps. */\nexport const makeRpcClientSession = <\n\tRpcs extends Rpc.Any,\n\tLayerError,\n\tHandshakeError = never,\n>(\n\tlayer: Layer.Layer<\n\t\tRpcClient.Protocol | Exclude<Rpc.MiddlewareClient<Rpcs>, Scope.Scope>,\n\t\tLayerError\n\t>,\n\tgroup: RpcGroup.RpcGroup<Rpcs>,\n\thandshake?: VersionHandshake<\n\t\tRpcClient.RpcClient<Rpcs, RpcClientError>,\n\t\tHandshakeError\n\t>,\n) =>\n\tmakeManagedClientSession(layer, (scope) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst client = yield* RpcClient.make(group).pipe(\n\t\t\t\tEffect.provideService(Scope.Scope, scope),\n\t\t\t);\n\t\t\tif (handshake !== undefined) {\n\t\t\t\tconst welcome = yield* handshake.perform(client, {\n\t\t\t\t\tprotocolVersion: handshake.protocolVersion,\n\t\t\t\t});\n\t\t\t\tyield* validateProtocolVersion(\n\t\t\t\t\thandshake.protocolVersion,\n\t\t\t\t\twelcome.protocolVersion,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn client;\n\t\t}),\n\t);\n","import { Schema } from \"effect\";\n\nconst TrimmedNonEmptyString = Schema.Trim.check(Schema.isNonEmpty());\n\nconst makeEntityId = <Brand extends string>(brand: Brand) =>\n\tTrimmedNonEmptyString.pipe(Schema.brand(brand));\n\nexport const FolderId = makeEntityId(\"FolderId\");\nexport type FolderId = typeof FolderId.Type;\n\nexport const PtyId = makeEntityId(\"PtyId\");\nexport type PtyId = typeof PtyId.Type;\n\nexport const AgentSessionId = makeEntityId(\"AgentSessionId\");\nexport type AgentSessionId = typeof AgentSessionId.Type;\n\nexport const AgentTurnId = makeEntityId(\"AgentTurnId\");\nexport type AgentTurnId = typeof AgentTurnId.Type;\n\nexport const AgentItemId = makeEntityId(\"AgentItemId\");\nexport type AgentItemId = typeof AgentItemId.Type;\n\nexport const MessageId = makeEntityId(\"MessageId\");\nexport type MessageId = typeof MessageId.Type;\n\nexport const WorktreeId = makeEntityId(\"WorktreeId\");\nexport type WorktreeId = typeof WorktreeId.Type;\n\nexport const ChatId = makeEntityId(\"ChatId\");\nexport type ChatId = typeof ChatId.Type;\n\nexport const EnvironmentId = makeEntityId(\"EnvironmentId\");\nexport type EnvironmentId = typeof EnvironmentId.Type;\n\nexport const AuthTokenId = makeEntityId(\"AuthTokenId\");\nexport type AuthTokenId = typeof AuthTokenId.Type;\n\nexport const CommandId = makeEntityId(\"CommandId\");\nexport type CommandId = typeof CommandId.Type;\n\nexport const EventId = makeEntityId(\"EventId\");\nexport type EventId = typeof EventId.Type;\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { AgentItemId, AgentSessionId, AgentTurnId, FolderId } from \"./ids.ts\";\n\n/**\n * Identifier for a provider implementation (driver). v1 ships claude + codex;\n * the literal union is the contract — adding a new provider is an additive\n * change here plus a new driver in `@zuse/agents`.\n */\nexport const ProviderId = Schema.Literals([\n \"claude\",\n \"codex\",\n \"grok\",\n \"gemini\",\n \"cursor\",\n \"opencode\",\n \"kiro\",\n]);\nexport type ProviderId = typeof ProviderId.Type;\n\n/**\n * How a session is being driven. `spawn-cli` is just a PTY launch with a known\n * argv; `sdk` runs through the in-process adapter and emits structured events.\n */\nexport const SessionMode = Schema.Literals([\"spawn-cli\", \"sdk\"]);\nexport type SessionMode = typeof SessionMode.Type;\n\n/**\n * High-level session lifecycle state. Mirrors what the side-panel chip shows.\n */\nexport const AgentStatus = Schema.Literals([\n \"idle\",\n \"starting\",\n \"running\",\n \"waiting\",\n \"closed\",\n \"error\",\n]);\nexport type AgentStatus = typeof AgentStatus.Type;\n\n/**\n * How permission prompts behave for a session (or a sub-agent). Originally\n * declared in `session.ts`; lifted here so `AgentDefinition.permissionMode`\n * can reuse the same literal set without an import cycle.\n *\n * - `approval-required` — prompt every write/Bash/Network/Task/MCP call.\n * - `auto-accept-edits` — also auto-allow Edit / Write / MultiEdit /\n * NotebookEdit. Bash / Network / Task / MCP still prompt.\n * - `auto-accept-edits-and-bash` — auto-allow file edits AND Bash. Network\n * (WebFetch / WebSearch) and MCP/Other still prompt.\n * - `full-access` — auto-allow everything except sensitive paths. Plan\n * mode (ExitPlanMode) ALWAYS prompts regardless of runtime mode.\n */\nexport const RuntimeMode = Schema.Literals([\n \"approval-required\",\n \"auto-accept-edits\",\n \"auto-accept-edits-and-bash\",\n \"full-access\",\n]);\nexport type RuntimeMode = typeof RuntimeMode.Type;\nexport const DEFAULT_RUNTIME_MODE: RuntimeMode = \"approval-required\";\n\n/**\n * SDK-level lifecycle mode. Distinct from `RuntimeMode` (which controls our\n * own auto-allow policy): this maps onto the Claude Agent SDK's\n * `Options.permissionMode`.\n *\n * - `default` — normal operation; `canUseTool` decides each call.\n * - `plan` — agent reads / explores only and ends turns by calling the\n * SDK's built-in `ExitPlanMode` tool with a proposed plan.\n * - `acceptEdits` — file edits skip the prompt; everything else goes\n * through `canUseTool`. Equivalent to RuntimeMode `auto-accept-edits`.\n *\n * The two modes coexist: `permissionMode: 'plan'` short-circuits all\n * write/exec tools regardless of `RuntimeMode`. Approving the plan\n * switches `permissionMode` back to `default` and the existing `RuntimeMode`\n * resumes governing prompts.\n */\nexport const PermissionMode = Schema.Literals([\n \"default\",\n \"plan\",\n \"acceptEdits\",\n]);\nexport type PermissionMode = typeof PermissionMode.Type;\nexport const DEFAULT_PERMISSION_MODE: PermissionMode = \"default\";\n\n/**\n * Canonical reasoning effort levels exposed to the user. Providers map these\n * to their native concept:\n * - Claude → `maxThinkingTokens` (low=5k, medium=15k, high=60k) + SDK\n * `effort` enum (low/medium/high/xhigh/max). `ultracode` is a Claude\n * Code preset that normalizes to `xhigh` + `settings.ultracode: true`.\n * - Codex → `reasoning_effort` enum (supported tiers pass through).\n * - Gemini Pro → `thinkingConfig.thinkingBudget` (low=4k, medium=16k, high=32k)\n *\n * Providers/models that don't support thinking simply omit the descriptor\n * from `ModelDescriptor.optionDescriptors`, which hides the FE picker.\n */\nexport const ReasoningLevel = Schema.Literals([\n \"low\",\n \"medium\",\n \"high\",\n \"xhigh\",\n \"max\",\n \"ultra\",\n \"ultracode\",\n]);\nexport type ReasoningLevel = typeof ReasoningLevel.Type;\n\n/**\n * A single UI control a model exposes. The renderer renders these\n * dynamically from `ModelDescriptor.optionDescriptors`, so adding a new\n * per-model knob is a wire change + driver change — no FE switch needed.\n */\nexport const SelectOptionDescriptor = Schema.Struct({\n kind: Schema.Literal(\"select\"),\n id: Schema.String,\n label: Schema.String,\n options: Schema.Array(\n Schema.Struct({ id: Schema.String, label: Schema.String }),\n ),\n defaultId: Schema.optional(Schema.String),\n /**\n * Option ids in this list are *prompt-injected* rather than forwarded to\n * the SDK as a knob value. The driver prepends the option id (e.g. the\n * literal word for a prompt-only mode) to the user prompt and unsets the\n * underlying SDK field.\n */\n promptInjectedValues: Schema.optional(Schema.Array(Schema.String)),\n});\nexport type SelectOptionDescriptor = typeof SelectOptionDescriptor.Type;\n\nexport const BooleanOptionDescriptor = Schema.Struct({\n kind: Schema.Literal(\"boolean\"),\n id: Schema.String,\n label: Schema.String,\n defaultValue: Schema.optional(Schema.Boolean),\n});\nexport type BooleanOptionDescriptor = typeof BooleanOptionDescriptor.Type;\n\nexport const OptionDescriptor = Schema.Union([\n SelectOptionDescriptor,\n BooleanOptionDescriptor,\n]);\nexport type OptionDescriptor = typeof OptionDescriptor.Type;\n\n/**\n * Per-provider verdict on whether the installed CLI is new enough for the\n * SDK we ship against.\n *\n * - `ok` — version parsed and meets/exceeds the SDK's minimum\n * - `outdated` — version parsed but is below the minimum (`cliVersionMinRequired`\n * carries the floor so the renderer can render \"Codex 0.27.0 < 0.128.0\")\n * - `unknown` — no `--version` output, parser failed, or no minimum tracked\n * for this provider. Treat as \"let them try\" so a parser bug doesn't\n * block a legitimate session start.\n */\nexport const CliVersionStatus = Schema.Literals([\"ok\", \"outdated\", \"unknown\"]);\nexport type CliVersionStatus = typeof CliVersionStatus.Type;\n\n/**\n * Version-gated Codex features. The installed Codex CLI only speaks these on\n * recent releases, so we surface support as a capability list on\n * {@link AgentAvailability} (computed from `cliVersion` against per-feature\n * floors in `availability.ts`) and the renderer shows/hides the matching\n * control. Adding a feature here is additive — pair it with a floor in\n * `CODEX_FEATURE_FLOORS` and a UI gate.\n *\n * - `goalMode` — `thread/goal/*` RPCs (the goal banner + `/goal`).\n * - `fastMode` — `serviceTier: \"fast\"` on `turn/start` (1.5× speed tier).\n */\nexport const CodexFeature = Schema.Literals([\"goalMode\", \"fastMode\"]);\nexport type CodexFeature = typeof CodexFeature.Type;\n\n/**\n * Per-provider verdict on whether a *newer published release* exists, distinct\n * from {@link CliVersionStatus} (which is the blocking SDK floor). This layer\n * is purely informational — it powers the \"update available\" hover affordance\n * in settings and the launch toast, and never blocks a session.\n *\n * - `current` — installed version is at or ahead of the latest published\n * - `behind` — a newer version is published (`latestVersion` carries it)\n * - `unknown` — couldn't reach the registry, parse failed, or the provider\n * isn't published to a registry we check (e.g. curl-installed CLIs)\n */\nexport const LatestVersionStatus = Schema.Literals([\n \"current\",\n \"behind\",\n \"unknown\",\n]);\nexport type LatestVersionStatus = typeof LatestVersionStatus.Type;\n\n/**\n * Server-side verdict on whether a provider is usable right now. Distinct\n * from `cliVersionStatus` (which only describes the CLI version) and from\n * `authStatus` (which only describes credentials): this is the rolled-up\n * dot color the UI shows.\n *\n * - `ready` — installed, authenticated, version ok\n * - `warning` — usable but something needs attention (e.g. update\n * available, auth verification failed but credentials look\n * present)\n * - `error` — unusable (e.g. CLI installed but auth probe returned 401,\n * account/read RPC failed, etc.)\n * - `disabled` — user toggled the provider off in settings; renderer-only\n */\nexport const ProviderHealthStatus = Schema.Literals([\n \"ready\",\n \"warning\",\n \"error\",\n \"disabled\",\n]);\nexport type ProviderHealthStatus = typeof ProviderHealthStatus.Type;\n\n/**\n * Whether the credential check actually verified the user is signed in\n * (e.g. Codex `account/read` returned a chatgpt account). `unknown` means\n * the probe couldn't reach a verification endpoint (offline, app-server\n * spawn failed) — distinct from `unauthenticated` which is a confirmed\n * \"no credentials\".\n */\nexport const ProviderAuthStatus = Schema.Literals([\n\t\"authenticated\",\n\t\"unauthenticated\",\n\t\"unknown\",\n]);\nexport type ProviderAuthStatus = typeof ProviderAuthStatus.Type;\n\n/** Verification state for an API key kept in the app-managed keychain. */\nexport const ProviderApiKeyStatus = Schema.Literals([\n\t\"verified\",\n\t\"unverified\",\n\t\"invalid\",\n]);\nexport type ProviderApiKeyStatus = typeof ProviderApiKeyStatus.Type;\n\nexport const ProviderRuntimeKind = Schema.Literals([\"cli\", \"bundledSdk\"]);\nexport type ProviderRuntimeKind = typeof ProviderRuntimeKind.Type;\n\n/**\n * Static availability report for a provider runtime and app-managed\n * credentials. Legacy CLI fields remain required for older clients;\n * consumers should prefer runtime metadata when present.\n */\nexport const AgentAvailability = Schema.Struct({\n\tproviderId: ProviderId,\n\tdisplayName: Schema.String,\n\t/** Runtime used to start this provider. Older clients may omit this field. */\n\truntimeKind: Schema.optional(ProviderRuntimeKind),\n\t/** Provider-level runtime readiness, independent of authentication. */\n\truntimeAvailable: Schema.optional(Schema.Boolean),\n\tcliInstalled: Schema.Boolean,\n cliVersion: Schema.optional(Schema.String),\n cliPath: Schema.optional(Schema.String),\n\tcliLoggedIn: Schema.Boolean,\n\thasApiKey: Schema.Boolean,\n\t/** Absent when no app-managed API key is configured. */\n\tapiKeyStatus: Schema.optional(ProviderApiKeyStatus),\n /**\n * Computed verdict on whether `cliVersion` meets the SDK's minimum. The\n * renderer renders an \"Upgrade Codex\" card when this is `\"outdated\"` so\n * the user sees the upgrade path *before* attempting to start a session.\n */\n cliVersionStatus: Schema.optional(CliVersionStatus),\n /**\n * Minimum CLI version the bundled SDK requires (e.g. `\"0.128.0\"`). Set in\n * tandem with `cliVersionStatus`; rendered inside the upgrade card.\n */\n cliVersionMinRequired: Schema.optional(Schema.String),\n /**\n * Version-gated features the *installed CLI* supports, computed by comparing\n * `cliVersion` against per-feature floors (see `CODEX_FEATURE_FLOORS` in\n * availability.ts). Values are {@link CodexFeature} ids. Empty/omitted when\n * the version is unknown or no features are gated for this provider. The\n * renderer reads this to show/hide feature controls *before* a session\n * exists (the live `model/list` `serviceTiers` refine it per-model once a\n * session is connected — see the `Capabilities` event).\n */\n capabilities: Schema.optional(Schema.Array(Schema.String)),\n /**\n * One-line shell command we recommend the user run to fix an outdated\n * CLI. Co-located with the version probe so renderer doesn't need its\n * own per-provider install lookup.\n */\n cliUpgradeCommand: Schema.optional(Schema.String),\n /**\n * Latest version published to the registry (e.g. `\"1.0.140\"`), when we were\n * able to resolve one. Set in tandem with `latestVersionStatus`.\n */\n latestVersion: Schema.optional(Schema.String),\n /**\n * Verdict on whether a newer published release exists. Drives the\n * informational \"update available\" UI (hover icon + launch toast) — never\n * blocks a session. `\"unknown\"` for providers we don't version-check (no\n * registry package) or when the registry lookup failed.\n */\n latestVersionStatus: Schema.optional(LatestVersionStatus),\n /**\n * Copy-able one-liner the user can run to update to the latest published\n * release (e.g. `\"npm i -g @openai/codex@latest\"`). Distinct from\n * `cliUpgradeCommand` (which targets the blocking SDK floor) — though they\n * often coincide.\n */\n updateCommand: Schema.optional(Schema.String),\n /**\n * Verified auth state. Distinct from `cliLoggedIn` (which only checks for\n * a credential file): set when an out-of-process probe (Codex\n * `account/read`, Claude credentials.json parse, etc.) confirmed the\n * credential is live.\n */\n authStatus: Schema.optional(ProviderAuthStatus),\n /** Account email pulled from the verified credential, when available. */\n authEmail: Schema.optional(Schema.String),\n /** Human-readable subscription label, e.g. \"ChatGPT Plus Subscription\". */\n authLabel: Schema.optional(Schema.String),\n /** Kind of credential, e.g. \"chatgpt\", \"apiKey\", \"amazonBedrock\". */\n authType: Schema.optional(Schema.String),\n /**\n * Rolled-up health verdict for the dot color in settings. Optional so\n * older clients without server-side classification just see a neutral\n * card — the renderer falls back to deriving from cliInstalled / login.\n */\n status: Schema.optional(ProviderHealthStatus),\n /**\n * One-line user-facing detail to render under the headline when status\n * is `warning` or `error` — typically the underlying probe error.\n */\n statusMessage: Schema.optional(Schema.String),\n /**\n * Wall-clock time of the most recent probe. Renderer renders this as\n * \"Checked X ago\" in the providers settings header. Encoded as an ISO\n * string over the wire so it survives the RPC's JSON hop.\n */\n lastCheckedAt: Schema.optional(Schema.DateFromString),\n});\nexport type AgentAvailability = typeof AgentAvailability.Type;\n\n/**\n * Coarse classifier for stream-side errors so the renderer can render\n * the right CTA (Retry vs \"Sign in to Codex\" vs \"Connection lost\"). The\n * default is `generic` — drivers only set this when they have positive\n * evidence (e.g. parsed a 401 from the SDK).\n */\nexport const AgentErrorKind = Schema.Literals([\"auth\", \"network\", \"generic\"]);\nexport type AgentErrorKind = typeof AgentErrorKind.Type;\n\n// ---------------------------------------------------------------------------\n// Provider event union consumed by the conversation runtime. The split is\n// intentionally broad so ingestion can handle each kind without a giant\n// switch on payload shape.\n// ---------------------------------------------------------------------------\n\nconst StartedEvent = Schema.TaggedStruct(\"Started\", {\n sessionId: AgentSessionId,\n providerId: ProviderId,\n mode: SessionMode,\n});\n\nconst StatusEvent = Schema.TaggedStruct(\"Status\", {\n status: AgentStatus,\n});\n\nconst AuthEvent = Schema.TaggedStruct(\"Auth\", {\n sdkConfigured: Schema.Boolean,\n});\n\nconst VersionEvent = Schema.TaggedStruct(\"Version\", {\n cliVersion: Schema.optional(Schema.String),\n sdkVersion: Schema.optional(Schema.String),\n});\n\nconst CapabilitiesEvent = Schema.TaggedStruct(\"Capabilities\", {\n capabilities: Schema.Array(Schema.String),\n});\n\n/** Absolute, monotonically revised text emitted for one stable provider item. */\nexport const ProviderMessageCheckpoint = Schema.Struct({\n /** Revisions start at 1 and increase for every accepted cumulative value. */\n revision: Schema.Number,\n /** Final promotion is itself a strictly newer revision. */\n final: Schema.Boolean,\n});\nexport type ProviderMessageCheckpoint =\n typeof ProviderMessageCheckpoint.Type;\n\nconst AssistantMessageEvent = Schema.TaggedStruct(\"AssistantMessage\", {\n itemId: AgentItemId,\n text: Schema.String,\n checkpoint: Schema.optional(ProviderMessageCheckpoint),\n /** True when the provider emitted a dedicated final plan item. */\n isPlan: Schema.optional(Schema.Boolean),\n // `parentItemId` is set when this message originated inside a sub-agent —\n // the value is the parent's `Agent` tool_use itemId so the renderer can\n // group nested rows under one collapsible wrapper. Absent for top-level.\n parentItemId: Schema.optional(AgentItemId),\n});\n\nconst ThinkingEvent = Schema.TaggedStruct(\"Thinking\", {\n itemId: AgentItemId,\n text: Schema.String,\n redacted: Schema.Boolean,\n checkpoint: Schema.optional(ProviderMessageCheckpoint),\n parentItemId: Schema.optional(AgentItemId),\n});\n\n/**\n * Normalized Tool-Call Contract\n * -----------------------------\n * All drivers emit `ToolUseEvent` / `ToolResultEvent` with the canonical\n * shape Claude produces. The renderer at\n * `apps/renderer/src/components/tool-row.tsx` switches on `tool` and reads\n * specific keys out of `input` — to keep every provider's row rendering\n * identical, ACP drivers translate native frames into these shapes\n * (`@zuse/agents/drivers/acp/translate`).\n *\n * tool input keys result `output`\n * --------- ------------------------------------ -------------------\n * Edit { file_path, old_string, new_string } diff text or {}\n * MultiEdit { file_path, edits: [...] } diff text or {}\n * Write { file_path, content } \"\"\n * Read { file_path, offset?, limit? } file slice (string\n * or [{type:\"text\"}])\n * ViewImage { file_path } multimodal image block\n * Bash { command, description? } stdout/stderr text\n * `description` only when it's a human-written summary\n * distinct from the command — drivers must not echo the\n * command / first line / title into it (see\n * `isRedundantShellDescription` in `shell-display.ts`).\n * Grep { pattern, path?, glob?, output_mode? } match listing\n * Glob { pattern, path? } file listing\n * WebSearch { query } result array (or\n * empty for\n * `queryOnly` models)\n * WebFetch { url, prompt? } page summary text\n * TodoWrite { todos: [...] } \"\"\n *\n * Adding a new tool: extend this block AND add a `case` in tool-row.tsx so\n * the renderer knows how to label/render it. Unknown tools fall through to\n * the default Wrench row, which is correct but unstyled.\n */\nconst ToolUseEvent = Schema.TaggedStruct(\"ToolUse\", {\n itemId: AgentItemId,\n tool: Schema.String,\n input: Schema.Unknown,\n parentItemId: Schema.optional(AgentItemId),\n backgroundTask: Schema.optional(\n Schema.Struct({\n taskId: Schema.String,\n }),\n ),\n subagent: Schema.optional(\n Schema.Struct({\n childSessionId: Schema.String,\n presentation: Schema.Literals([\"inline\", \"detached\"]),\n }),\n ),\n});\n\nconst ToolResultEvent = Schema.TaggedStruct(\"ToolResult\", {\n itemId: AgentItemId,\n output: Schema.Unknown,\n isError: Schema.Boolean,\n parentItemId: Schema.optional(AgentItemId),\n});\n\n/**\n * Phase 3 surface — the SDK asks the user before doing something dangerous\n * (running a shell command, writing outside the workspace, etc.). v2 just\n * auto-denies and emits this so the UI can toast \"Phase 3 will let you allow\n * this.\"\n */\nconst PermissionRequestEvent = Schema.TaggedStruct(\"PermissionRequest\", {\n itemId: AgentItemId,\n kind: Schema.String,\n details: Schema.Unknown,\n // Carries the parent Agent tool_use itemId when the requesting tool ran\n // inside a sub-agent context. The toast prepends \"via <name> · <model> ·\"\n // when set so the user sees who's actually asking.\n parentItemId: Schema.optional(AgentItemId),\n});\n\n/**\n * Closing summary for a sub-agent run. Emitted when the parent's\n * `Agent` tool_result lands; the wrapper-row footer reads from this when\n * collapsed.\n */\nconst SubagentSummaryEvent = Schema.TaggedStruct(\"SubagentSummary\", {\n itemId: AgentItemId,\n agentName: Schema.String,\n model: Schema.String,\n turns: Schema.Number,\n durationMs: Schema.Number,\n summary: Schema.String,\n isError: Schema.Boolean,\n childSessionId: Schema.optional(Schema.String),\n presentation: Schema.optional(Schema.Literals([\"inline\", \"detached\"])),\n});\n\n/** Native provider progress for a running child agent. */\nconst SubagentProgressEvent = Schema.TaggedStruct(\"SubagentProgress\", {\n\tchildId: Schema.String,\n\tparentId: Schema.String,\n\tchildSessionId: Schema.String,\n\tstatus: Schema.String,\n\tdurationMs: Schema.Number,\n\tturns: Schema.Number,\n\ttoolCalls: Schema.Number,\n\ttokens: Schema.Number,\n\tcontextPercentage: Schema.Number,\n\ttoolsUsed: Schema.Array(Schema.String),\n\terrorCount: Schema.Number,\n});\n\n/**\n * Per-turn token usage. Emitted on every SDK `result` message; tagged with\n * `parentItemId` when the result belongs to a sub-agent. The renderer\n * accumulates these into the per-agent footer.\n */\nconst UsageDeltaEvent = Schema.TaggedStruct(\"UsageDelta\", {\n parentItemId: Schema.optional(AgentItemId),\n inputTokens: Schema.Number,\n outputTokens: Schema.Number,\n cacheReadTokens: Schema.Number,\n cacheCreationTokens: Schema.Number,\n model: Schema.String,\n});\n\nexport const ContextUsagePrecision = Schema.Literals([\n \"exact\",\n \"estimated\",\n \"capacity-only\",\n]);\nexport type ContextUsagePrecision = typeof ContextUsagePrecision.Type;\n\nconst ContextUsageEvent = Schema.TaggedStruct(\"ContextUsage\", {\n providerId: ProviderId,\n usedTokens: Schema.NullOr(Schema.Number),\n windowTokens: Schema.NullOr(Schema.Number),\n precision: ContextUsagePrecision,\n source: Schema.optional(Schema.String),\n});\n\nconst ContextCompactionEvent = Schema.TaggedStruct(\"ContextCompaction\", {\n itemId: AgentItemId,\n providerId: ProviderId,\n startedAt: Schema.Number,\n durationMs: Schema.Number,\n beforeTokens: Schema.NullOr(Schema.Number),\n afterTokens: Schema.NullOr(Schema.Number),\n status: Schema.Literals([\"in_progress\", \"completed\"]),\n});\n\nconst UsageLimitEvent = Schema.TaggedStruct(\"UsageLimit\", {\n providerId: ProviderId,\n label: Schema.String,\n usedPercent: Schema.NullOr(Schema.Number),\n // ISO-8601 string, not a `Date` schema: the value crosses IPC and the\n // persistence layer as JSON, and a `DateFromString` transform trips the\n // struct constructor (which validates against the decoded `Date` side).\n resetsAt: Schema.NullOr(Schema.String),\n windowMinutes: Schema.NullOr(Schema.Number),\n});\n\nconst CompletedEvent = Schema.TaggedStruct(\"Completed\", {\n reason: Schema.Literals([\"ended\", \"interrupted\", \"error\"]),\n});\n\n/**\n * Emitted when the user interrupts a running turn. Unlike `Error`, this is a\n * normal user action — the renderer shows a muted \"Interrupted by user\" badge\n * (no red error bubble) and the session stays out of the error state. Drivers\n * emit this in place of `Error` when they know the turn ended because of an\n * explicit interrupt (see the Claude driver, which otherwise surfaces the\n * SDK's `error_during_execution` result as a bogus error).\n */\nconst InterruptedEvent = Schema.TaggedStruct(\"Interrupted\", {});\n\nconst ErrorEvent = Schema.TaggedStruct(\"Error\", {\n message: Schema.String,\n /**\n * Optional classifier so the renderer can pick the right CTA without\n * regexing the message. Drivers set this when they have positive evidence\n * (e.g. Codex SDK reported a 401, or fetch threw ECONN). Absent → the\n * renderer falls back to its own heuristic classification.\n */\n kind: Schema.optional(AgentErrorKind),\n /** Provider that produced the error, when known. */\n providerId: Schema.optional(ProviderId),\n});\n\n/**\n * Driver-emitted side-channel for the SDK's resume token. Claude exposes\n * its session UUID as `session_id` on every message; Codex exposes its\n * thread id via the `thread.started` event. Each driver captures the token\n * on first sight and emits this event so the conversation domain can persist it onto\n * `sessions.cursor` / `sessions.resume_strategy`. Lifecycle-only — never\n * persisted as a chat row.\n */\nconst SessionCursorEvent = Schema.TaggedStruct(\"SessionCursor\", {\n cursor: Schema.String,\n\tproviderEventCursor: Schema.optional(Schema.String),\n strategy: Schema.Literals([\n \"claude-session-id\",\n \"codex-thread-id\",\n \"grok-session-id\",\n \"cursor-session-id\",\n \"gemini-session-id\",\n \"opencode-session-id\",\n \"kiro-session-id\",\n ]),\n});\n\nconst ProviderNotificationMetadataEvent = Schema.TaggedStruct(\n\t\"ProviderNotificationMetadata\",\n\t{\n\t\teventId: Schema.optional(Schema.String),\n\t\tpromptId: Schema.optional(Schema.String),\n\t\tisReplay: Schema.Boolean,\n\t\ttimestampMs: Schema.optional(Schema.Number),\n\t\tstreamStartMs: Schema.optional(Schema.Number),\n\t\tturnStartMs: Schema.optional(Schema.Number),\n\t\ttotalTokens: Schema.optional(Schema.Number),\n\t\tstopReason: Schema.optional(Schema.String),\n\t},\n);\n\n/**\n * Structured question shape used by both `UserQuestionEvent` and the\n * persisted `userQuestion` message row: a question with N preset options and\n * optional multi-select. The renderer always offers an additional \"Other\"\n * free-text field — there is no need to include it in `options`.\n */\nexport const UserQuestion = Schema.Struct({\n question: Schema.String,\n options: Schema.Array(Schema.String),\n multiSelect: Schema.optional(Schema.Boolean),\n});\nexport type UserQuestion = typeof UserQuestion.Type;\n\n/**\n * Emitted when the agent calls the in-process `AskUserQuestion` tool. The\n * renderer subscribes to this and renders a question card. `itemId` is the\n * SDK's `tool_use.id` so the eventual answer maps back to a single tool\n * call.\n */\nconst UserQuestionEvent = Schema.TaggedStruct(\"UserQuestion\", {\n itemId: AgentItemId,\n questions: Schema.Array(UserQuestion),\n parentItemId: Schema.optional(AgentItemId),\n});\n\nexport const PlanApprovalOutcome = Schema.Literals([\n\t\"approved\",\n\t\"cancelled\",\n\t\"abandoned\",\n]);\nexport type PlanApprovalOutcome = typeof PlanApprovalOutcome.Type;\n\n/** Blocking native plan review request. */\nconst PlanApprovalRequestedEvent = Schema.TaggedStruct(\n\t\"PlanApprovalRequested\",\n\t{\n\t\tsessionId: AgentSessionId,\n\t\ttoolCallId: AgentItemId,\n\t\tplan: Schema.String,\n\t},\n);\n\n/**\n * Emitted when `Query.setPermissionMode` succeeds. The renderer uses it to\n * keep the chat-header chip in sync without a round-trip.\n */\nconst PermissionModeChangedEvent = Schema.TaggedStruct(\n \"PermissionModeChanged\",\n { mode: PermissionMode },\n);\n\nconst GoalStatus = Schema.Literals([\n \"active\",\n \"paused\",\n \"budgetLimited\",\n \"usageLimited\",\n \"blocked\",\n \"complete\",\n]);\n\nconst GoalPayload = Schema.Struct({\n threadId: Schema.String,\n objective: Schema.String,\n status: GoalStatus,\n tokenBudget: Schema.NullOr(Schema.Number),\n tokensUsed: Schema.Number,\n timeUsedSeconds: Schema.Number,\n createdAt: Schema.Number,\n updatedAt: Schema.Number,\n});\n\nconst GoalUpdatedEvent = Schema.TaggedStruct(\"GoalUpdated\", {\n goal: GoalPayload,\n});\n\nconst GoalClearedEvent = Schema.TaggedStruct(\"GoalCleared\", {});\n\nexport const AgentEvent = Schema.Union([\n StartedEvent,\n StatusEvent,\n AuthEvent,\n VersionEvent,\n CapabilitiesEvent,\n AssistantMessageEvent,\n ThinkingEvent,\n ToolUseEvent,\n ToolResultEvent,\n PermissionRequestEvent,\n SubagentSummaryEvent,\n\tSubagentProgressEvent,\n UsageDeltaEvent,\n ContextUsageEvent,\n ContextCompactionEvent,\n UsageLimitEvent,\n SessionCursorEvent,\n\tProviderNotificationMetadataEvent,\n UserQuestionEvent,\n\tPlanApprovalRequestedEvent,\n PermissionModeChangedEvent,\n GoalUpdatedEvent,\n GoalClearedEvent,\n CompletedEvent,\n InterruptedEvent,\n ErrorEvent,\n]);\nexport type AgentEvent = typeof AgentEvent.Type;\n\n/**\n * Application-owned correlation envelope for provider runtime events.\n * Provider-native identifiers remain adapter metadata; every event that can\n * mutate a turn projection carries the exact application turn id supplied to\n * `send`/`interrupt`.\n */\nexport const ProviderEventEnvelope = Schema.Union([\n\tSchema.Struct({\n\t\tscope: Schema.Literal(\"session\"),\n\t\tevent: AgentEvent,\n\t}),\n\tSchema.Struct({\n\t\tscope: Schema.Literal(\"turn\"),\n\t\tturnId: AgentTurnId,\n\t\tevent: AgentEvent,\n\t}),\n]);\nexport type ProviderEventEnvelope = typeof ProviderEventEnvelope.Type;\n\n// ---------------------------------------------------------------------------\n// RPC inputs\n// ---------------------------------------------------------------------------\n\n/**\n * Definition of a sub-agent that the main agent can delegate to. Mirror of\n * the Claude Agent SDK's `AgentDefinition` shape (subset we expose now —\n * `skills`, `mcpServers`, `memory`, `effort`, `background`, and `isolation`\n * are reserved for follow-ups).\n *\n * `permissionMode` shadows the session's runtime mode for tool calls made\n * inside this sub-agent — used by `test-runner` to keep Bash prompts on\n * even when the parent session runs in `full-access`.\n */\nexport const AgentDefinition = Schema.Struct({\n description: Schema.String,\n prompt: Schema.String,\n tools: Schema.optional(Schema.Array(Schema.String)),\n disallowedTools: Schema.optional(Schema.Array(Schema.String)),\n model: Schema.optional(Schema.String),\n maxTurns: Schema.optional(Schema.Number),\n permissionMode: Schema.optional(RuntimeMode),\n});\nexport type AgentDefinition = typeof AgentDefinition.Type;\n\nexport const StartSessionInput = Schema.Struct({\n folderId: FolderId,\n providerId: ProviderId,\n mode: SessionMode,\n initialPrompt: Schema.optional(Schema.String),\n\t/** Exact application turn correlated with `initialPrompt`. */\n\tinitialTurnId: Schema.optional(AgentTurnId),\n /**\n * Internal Zuse-provided workspace context. The renderer does not set this;\n * ProviderService fills it after resolving the project/worktree cwd so\n * drivers can pass it through native system/developer instruction channels\n * where available.\n */\n workspaceInstructions: Schema.optional(Schema.String),\n // Optional caller-supplied id. When omitted, ProviderService mints a fresh\n // one. The conversation domain uses this to lazy-restart a closed session without\n // moving its persisted history to a new row.\n sessionId: Schema.optional(AgentSessionId),\n // Optional provider-specific model id (e.g. \"claude-opus-4-7\"). Drivers\n // forward it to the SDK; omitting it lets the SDK pick its own default.\n model: Schema.optional(Schema.String),\n // Sub-agents the main agent may delegate to. Keys are the `subagent_type`\n // the SDK reports back on `Agent` tool_use blocks; values define each\n // sub-agent's prompt, tool subset, model, and permission mode. Empty /\n // omitted means no sub-agents — session behaves as before.\n agents: Schema.optional(Schema.Record(Schema.String, AgentDefinition)),\n // Master toggle. When the renderer wants to start a Claude session with\n // sub-agents disabled even though presets exist, it sends this as false.\n // Defaults true when `agents` is non-empty; the driver only adds `Agent`\n // to `allowedTools` when the effective value is true.\n enableSubagents: Schema.optional(Schema.Boolean),\n /**\n * Optional absolute path the agent should run in. When omitted, the\n * provider resolves cwd from `folderId` (the project's main checkout).\n * The conversation domain populates this with a worktree path when a session was\n * created against a worktree, so the SDK runs in the worktree dir.\n */\n cwdOverride: Schema.optional(Schema.String),\n /**\n * SDK lifecycle mode passed to `Options.permissionMode`. Defaults to\n * `default`. Pass `plan` to start the session in plan mode — the agent\n * will explore read-only and propose a plan via `ExitPlanMode`.\n */\n permissionMode: Schema.optional(PermissionMode),\n /**\n * When true, future MCP servers register without `alwaysLoad`, letting\n * the SDK delegate to its built-in tool search instead of inflating the\n * tool list every turn. No-op today (no MCP tools shipped yet); ready\n * for 0.04.\n */\n toolSearch: Schema.optional(Schema.Boolean),\n /**\n * When true AND a resume cursor is supplied, the driver FORKS the resumed\n * transcript into a fresh provider session instead of continuing it\n * (Claude `Options.forkSession`, Codex `thread/fork`), leaving the source\n * transcript untouched. Ignored without a resume cursor, and by providers\n * that lack native fork support (they fall back to a transcript copy at a\n * higher layer). Backs the \"Fork chat\" feature.\n */\n forkFromResume: Schema.optional(Schema.Boolean),\n /**\n * Opaque per-model knob values. Keys map to\n * `ModelDescriptor.optionDescriptors[].id` (e.g. `\"reasoning\"`); values\n * are the selected option id (for example, `\"low\"` or `\"ultra\"`) for\n * selects or `\"true\" | \"false\"` for booleans. Drivers consume what they support\n * and ignore the rest — the FE composer renders only the descriptors\n * the current model declared, so no value should arrive that the driver\n * can't interpret.\n */\n modelOptions: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\nexport type StartSessionInput = typeof StartSessionInput.Type;\n\n/**\n * What each model declares about itself — the source of truth the renderer\n * uses to decide whether to show the reasoning picker, plan-mode toggle,\n * and to label WebSearch result behavior. Driver behavior is keyed off the\n * same descriptors so FE and BE stay in lockstep.\n *\n * - `optionDescriptors`: per-model knobs the composer renders (reasoning,\n * etc.). Omitting the descriptor hides the control.\n * - `supportsPlanMode`: whether the plan-mode toggle is shown for this\n * model. `true` for every model today (native for Claude/Cursor,\n * emulated via dev-instructions prefix for Codex/Grok/Gemini); set\n * `false` only when there's a hard reason not to allow planning.\n * - `supportsWebSearch`: `\"native\"` (driver emits real results),\n * `\"queryOnly\"` (driver emits the query but no results), or omitted\n * (provider doesn't search).\n */\nexport interface ModelOption {\n readonly id: string;\n readonly label: string;\n /**\n * Optional small picker badge for launch/newness callouts.\n */\n readonly badgeLabel?: string;\n /**\n * Preferred default for this provider. When omitted, the first visible model\n * remains the fallback default.\n */\n readonly defaultModel?: boolean;\n /**\n * Whether this model appears in normal picker/default selectors before the\n * user opts it back in from provider settings. Omitted means visible.\n */\n readonly defaultVisible?: boolean;\n readonly optionDescriptors?: ReadonlyArray<OptionDescriptor>;\n readonly supportsPlanMode?: boolean;\n readonly supportsWebSearch?: \"native\" | \"queryOnly\";\n}\n\n/**\n * Reasoning descriptor for Codex/Gemini/Cursor and the `reasoning` knob name\n * used across non-Claude providers. Models can append provider-supported\n * tiers beyond the standard low/medium/high set.\n */\nconst reasoningSelectDescriptor = (\n defaultId: ReasoningLevel = \"medium\",\n additionalOptions: ReadonlyArray<{ id: ReasoningLevel; label: string }> = [],\n): SelectOptionDescriptor => ({\n kind: \"select\",\n id: \"reasoning\",\n label: \"Reasoning\",\n options: [\n { id: \"low\", label: \"Low\" },\n { id: \"medium\", label: \"Medium\" },\n { id: \"high\", label: \"High\" },\n ...additionalOptions,\n ],\n defaultId,\n});\n\nconst extraHighReasoningOption = {\n id: \"xhigh\",\n label: \"Extra High\",\n} as const;\n\nconst gpt56ExtendedReasoningOptions = [\n extraHighReasoningOption,\n { id: \"max\", label: \"Max\" },\n { id: \"ultra\", label: \"Ultra\" },\n] as const;\n\nconst gpt56Model = (id: string, label: string): ModelOption => ({\n id,\n label,\n optionDescriptors: [\n reasoningSelectDescriptor(\"medium\", gpt56ExtendedReasoningOptions),\n ],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n});\n\n/**\n * Per-model effort descriptor for the Claude provider. Each model declares\n * its own supported tiers (see `MODELS_BY_PROVIDER.claude` below); `ultracode`\n * is special — see `ReasoningLevel` docs. The knob id is `effort` rather\n * than `reasoning` to make driver-side mapping explicit.\n */\nconst claudeEffortDescriptor = (args: {\n options: ReadonlyArray<{ id: string; label: string }>;\n defaultId: string;\n promptInjectedValues?: ReadonlyArray<string>;\n}): SelectOptionDescriptor => ({\n kind: \"select\",\n id: \"effort\",\n label: \"Reasoning\",\n options: args.options,\n defaultId: args.defaultId,\n ...(args.promptInjectedValues !== undefined\n ? { promptInjectedValues: args.promptInjectedValues }\n : {}),\n});\n\n/**\n * Boolean descriptor for a per-model toggle. Used by Claude (`fastMode` halves\n * the token cost and roughly doubles throughput at the cost of some quality;\n * `thinking` enables Haiku 4.5's always-on adaptive thinking) and by Codex\n * (`fastMode` → `serviceTier: \"fast\"`, the 1.5× speed tier on the latest\n * models). The driver keys behavior off the descriptor `id`.\n */\nconst booleanDescriptor = (\n id: string,\n label: string,\n): BooleanOptionDescriptor => ({\n kind: \"boolean\",\n id,\n label,\n});\n\n/**\n * Standard `contextWindow` descriptor used by every Claude 4.x model that\n * supports the 1M variant. Driver-side, picking `\"1m\"` rewrites the API\n * model id to `${slug}[1m]`. We default to `\"1m\"` because Anthropic now\n * routes most Claude 4.x sessions to the 1M window by default.\n */\nconst claudeContextWindowDescriptor = (): SelectOptionDescriptor => ({\n kind: \"select\",\n id: \"contextWindow\",\n label: \"Context Window\",\n options: [\n { id: \"200k\", label: \"200k\" },\n { id: \"1m\", label: \"1M\" },\n ],\n defaultId: \"1m\",\n});\n\nconst staticContextWindowDescriptor = (\n id: string,\n label: string,\n): SelectOptionDescriptor => ({\n kind: \"select\",\n id: \"contextWindow\",\n label: \"Context Window\",\n options: [{ id, label }],\n defaultId: id,\n});\n\nexport const MODELS_BY_PROVIDER: Record<\n ProviderId,\n ReadonlyArray<ModelOption>\n> = {\n // Claude catalog. Effort tiers and per-model knobs match\n // the published Claude Agent SDK contract. Ordering = newest first so the\n // picker accordion opens on the latest recommended model by default.\n claude: [\n {\n id: \"claude-fable-5\",\n label: \"Fable 5\",\n badgeLabel: \"Available now\",\n optionDescriptors: [\n claudeEffortDescriptor({\n options: [\n { id: \"low\", label: \"Low\" },\n { id: \"medium\", label: \"Medium\" },\n { id: \"high\", label: \"High\" },\n { id: \"xhigh\", label: \"Extra High\" },\n { id: \"max\", label: \"Max\" },\n { id: \"ultracode\", label: \"Ultracode\" },\n ],\n defaultId: \"high\",\n }),\n booleanDescriptor(\"fastMode\", \"Fast Mode\"),\n claudeContextWindowDescriptor(),\n ],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n {\n id: \"claude-opus-5\",\n label: \"Opus 5\",\n badgeLabel: \"New\",\n optionDescriptors: [\n claudeEffortDescriptor({\n options: [\n { id: \"low\", label: \"Low\" },\n { id: \"medium\", label: \"Medium\" },\n { id: \"high\", label: \"High\" },\n { id: \"xhigh\", label: \"Extra High\" },\n { id: \"max\", label: \"Max\" },\n { id: \"ultracode\", label: \"Ultracode\" },\n ],\n defaultId: \"high\",\n }),\n staticContextWindowDescriptor(\"1m\", \"1M\"),\n ],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n {\n id: \"claude-sonnet-5\",\n label: \"Sonnet 5\",\n badgeLabel: \"New\",\n defaultModel: true,\n optionDescriptors: [\n claudeEffortDescriptor({\n options: [\n { id: \"low\", label: \"Low\" },\n { id: \"medium\", label: \"Medium\" },\n { id: \"high\", label: \"High\" },\n { id: \"max\", label: \"Max\" },\n { id: \"ultracode\", label: \"Ultracode\" },\n ],\n defaultId: \"high\",\n }),\n claudeContextWindowDescriptor(),\n ],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n {\n id: \"claude-opus-4-8\",\n label: \"Opus 4.8\",\n optionDescriptors: [\n claudeEffortDescriptor({\n options: [\n { id: \"low\", label: \"Low\" },\n { id: \"medium\", label: \"Medium\" },\n { id: \"high\", label: \"High\" },\n { id: \"xhigh\", label: \"Extra High\" },\n { id: \"max\", label: \"Max\" },\n { id: \"ultracode\", label: \"Ultracode\" },\n ],\n defaultId: \"high\",\n }),\n booleanDescriptor(\"fastMode\", \"Fast Mode\"),\n claudeContextWindowDescriptor(),\n ],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n {\n id: \"claude-opus-4-7\",\n label: \"Opus 4.7\",\n optionDescriptors: [\n claudeEffortDescriptor({\n options: [\n { id: \"low\", label: \"Low\" },\n { id: \"medium\", label: \"Medium\" },\n { id: \"high\", label: \"High\" },\n { id: \"xhigh\", label: \"Extra High\" },\n { id: \"max\", label: \"Max\" },\n { id: \"ultracode\", label: \"Ultracode\" },\n ],\n defaultId: \"xhigh\",\n }),\n booleanDescriptor(\"fastMode\", \"Fast Mode\"),\n claudeContextWindowDescriptor(),\n ],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n {\n id: \"claude-opus-4-6\",\n label: \"Opus 4.6\",\n optionDescriptors: [\n claudeEffortDescriptor({\n options: [\n { id: \"low\", label: \"Low\" },\n { id: \"medium\", label: \"Medium\" },\n { id: \"high\", label: \"High\" },\n { id: \"max\", label: \"Max\" },\n { id: \"ultracode\", label: \"Ultracode\" },\n ],\n defaultId: \"high\",\n }),\n booleanDescriptor(\"fastMode\", \"Fast Mode\"),\n claudeContextWindowDescriptor(),\n ],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n {\n id: \"claude-sonnet-4-6\",\n label: \"Sonnet 4.6\",\n defaultVisible: false,\n optionDescriptors: [\n claudeEffortDescriptor({\n options: [\n { id: \"low\", label: \"Low\" },\n { id: \"medium\", label: \"Medium\" },\n { id: \"high\", label: \"High\" },\n { id: \"max\", label: \"Max\" },\n { id: \"ultracode\", label: \"Ultracode\" },\n ],\n defaultId: \"high\",\n }),\n claudeContextWindowDescriptor(),\n ],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n {\n id: \"claude-haiku-4-5\",\n label: \"Haiku 4.5\",\n optionDescriptors: [booleanDescriptor(\"thinking\", \"Thinking\")],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n ],\n codex: [\n gpt56Model(\"gpt-5.6-sol\", \"GPT-5.6 Sol\"),\n gpt56Model(\"gpt-5.6-terra\", \"GPT-5.6 Terra\"),\n gpt56Model(\"gpt-5.6-luna\", \"GPT-5.6 Luna\"),\n {\n id: \"gpt-5.5\",\n label: \"GPT-5.5\",\n defaultModel: true,\n // Fast tier supported — see gpt-5.4 note above.\n optionDescriptors: [\n reasoningSelectDescriptor(\"medium\", [extraHighReasoningOption]),\n booleanDescriptor(\"fastMode\", \"Fast\"),\n ],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n {\n id: \"gpt-5.4\",\n label: \"GPT-5.4\",\n // `fastMode` → `serviceTier: \"fast\"`. OpenAI only offers the fast tier on\n // the latest models (GPT-5.4 / GPT-5.5); older Codex CLIs don't accept\n // the field, so the toggle is additionally gated on the `fastMode`\n // capability (CLI version) + the live model's `serviceTiers`.\n optionDescriptors: [\n reasoningSelectDescriptor(\"medium\"),\n booleanDescriptor(\"fastMode\", \"Fast\"),\n ],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n {\n id: \"gpt-5.4-mini\",\n label: \"GPT-5.4 mini\",\n optionDescriptors: [reasoningSelectDescriptor(\"medium\")],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n {\n id: \"gpt-5.3-codex\",\n label: \"GPT-5.3 Codex\",\n defaultVisible: false,\n optionDescriptors: [reasoningSelectDescriptor(\"medium\")],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n {\n id: \"gpt-5.3-codex-spark\",\n label: \"GPT-5.3 Codex Spark\",\n defaultVisible: false,\n optionDescriptors: [reasoningSelectDescriptor(\"medium\")],\n supportsPlanMode: true,\n supportsWebSearch: \"native\",\n },\n ],\n // Seed list — Grok CLI's `-m` flag accepts any model id it knows, so a\n // custom slug typed by the user still works; this list is just what the\n // picker shows by default. `grok-build` unlocks with a paid Grok entitlement\n // such as SuperGrok or X Premium+. Passing a slug the account can't access yields\n // a clean 403 surfaced through grok's streaming-json `type: \"error\"`\n // envelope, so no client-side validation needed.\n grok: [\n {\n id: \"grok-build\",\n label: \"Grok Build\",\n supportsPlanMode: true,\n supportsWebSearch: \"queryOnly\",\n },\n {\n id: \"grok-4.6\",\n label: \"Grok 4.6\",\n badgeLabel: \"New\",\n supportsPlanMode: true,\n supportsWebSearch: \"queryOnly\",\n },\n {\n id: \"grok-4.5\",\n label: \"Grok 4.5\",\n supportsPlanMode: true,\n supportsWebSearch: \"queryOnly\",\n },\n {\n id: \"grok-composer-2.5-fast\",\n label: \"Grok Composer 2.5 Fast\",\n supportsPlanMode: true,\n supportsWebSearch: \"queryOnly\",\n },\n {\n id: \"grok-4\",\n label: \"Grok 4\",\n defaultVisible: false,\n supportsPlanMode: true,\n supportsWebSearch: \"queryOnly\",\n },\n {\n id: \"grok-4-fast\",\n label: \"Grok 4 Fast\",\n supportsPlanMode: true,\n supportsWebSearch: \"queryOnly\",\n },\n {\n id: \"grok-code-fast-1\",\n label: \"Grok Code Fast\",\n defaultVisible: false,\n supportsPlanMode: true,\n supportsWebSearch: \"queryOnly\",\n },\n ],\n // Gemini CLI accepts any model slug it knows via the ACP `_meta.model`\n // hint; this list is just what the picker offers by default. Gemini's\n // ACP server does not expose a runtime reasoning-effort knob (the\n // native gemini CLI doesn't show one either), so no reasoning descriptor\n // is declared — the FE picker is hidden across the whole provider.\n gemini: [\n {\n id: \"gemini-3-pro-preview\",\n label: \"Gemini 3 Pro\",\n supportsPlanMode: true,\n supportsWebSearch: \"queryOnly\",\n },\n {\n id: \"gemini-3-flash-preview\",\n label: \"Gemini 3 Flash\",\n supportsPlanMode: true,\n supportsWebSearch: \"queryOnly\",\n },\n {\n id: \"gemini-2.5-pro\",\n label: \"Gemini 2.5 Pro\",\n defaultVisible: false,\n supportsPlanMode: true,\n supportsWebSearch: \"queryOnly\",\n },\n {\n id: \"gemini-2.5-flash\",\n label: \"Gemini 2.5 Flash\",\n defaultVisible: false,\n supportsPlanMode: true,\n supportsWebSearch: \"queryOnly\",\n },\n ],\n // Kiro CLI (`kiro-cli acp`) speaks standard ACP. Model ids match\n // `kiro-cli chat --list-models --format json`. Effort can be passed at\n // spawn time via `kiro-cli acp --effort …` and at runtime via\n // `session/set_model` does not carry effort — so we surface effort as a\n // model option that the driver applies on process start / next turn.\n kiro: [\n {\n id: \"auto\",\n label: \"Auto\",\n supportsPlanMode: true,\n },\n {\n id: \"claude-opus-5\",\n label: \"Claude Opus 5\",\n badgeLabel: \"Experimental\",\n optionDescriptors: [staticContextWindowDescriptor(\"1m\", \"1M\")],\n supportsPlanMode: true,\n },\n {\n id: \"claude-sonnet-5\",\n label: \"Claude Sonnet 5\",\n optionDescriptors: [staticContextWindowDescriptor(\"1m\", \"1M\")],\n supportsPlanMode: true,\n },\n {\n id: \"claude-opus-4.8\",\n label: \"Claude Opus 4.8\",\n optionDescriptors: [staticContextWindowDescriptor(\"1m\", \"1M\")],\n supportsPlanMode: true,\n },\n {\n id: \"gpt-5.6-sol\",\n label: \"GPT-5.6 Sol\",\n badgeLabel: \"Experimental\",\n supportsPlanMode: true,\n },\n {\n id: \"gpt-5.6-terra\",\n label: \"GPT-5.6 Terra\",\n badgeLabel: \"Experimental\",\n supportsPlanMode: true,\n },\n {\n id: \"gpt-5.6-luna\",\n label: \"GPT-5.6 Luna\",\n badgeLabel: \"Experimental\",\n supportsPlanMode: true,\n },\n {\n id: \"claude-opus-4.7\",\n label: \"Claude Opus 4.7\",\n defaultVisible: false,\n optionDescriptors: [staticContextWindowDescriptor(\"1m\", \"1M\")],\n supportsPlanMode: true,\n },\n {\n id: \"claude-opus-4.6\",\n label: \"Claude Opus 4.6\",\n defaultVisible: false,\n optionDescriptors: [staticContextWindowDescriptor(\"1m\", \"1M\")],\n supportsPlanMode: true,\n },\n {\n id: \"claude-sonnet-4.6\",\n label: \"Claude Sonnet 4.6\",\n defaultVisible: false,\n optionDescriptors: [staticContextWindowDescriptor(\"1m\", \"1M\")],\n supportsPlanMode: true,\n },\n {\n id: \"claude-sonnet-4.5\",\n label: \"Claude Sonnet 4.5\",\n defaultVisible: false,\n supportsPlanMode: true,\n },\n {\n id: \"claude-haiku-4.5\",\n label: \"Claude Haiku 4.5\",\n defaultVisible: false,\n supportsPlanMode: true,\n },\n {\n id: \"minimax-m2.5\",\n label: \"MiniMax M2.5\",\n defaultVisible: false,\n supportsPlanMode: true,\n },\n {\n id: \"glm-5\",\n label: \"GLM-5\",\n defaultVisible: false,\n supportsPlanMode: true,\n },\n {\n id: \"deepseek-3.2\",\n label: \"DeepSeek 3.2\",\n badgeLabel: \"Experimental\",\n defaultVisible: false,\n supportsPlanMode: true,\n },\n {\n id: \"qwen3-coder-next\",\n label: \"Qwen3 Coder Next\",\n badgeLabel: \"Experimental\",\n defaultVisible: false,\n supportsPlanMode: true,\n },\n ],\n // The bundled SDK exposes a broad model catalog. This curated shortlist is\n // only the picker seed, not a whitelist. The `default` slug maps to the\n // SDK's default composer model.\n cursor: [\n { id: \"default\", label: \"Auto\", supportsPlanMode: true },\n { id: \"composer-2\", label: \"Composer 2\", supportsPlanMode: true },\n { id: \"composer-2.5\", label: \"Composer 2.5\", supportsPlanMode: true },\n { id: \"gpt-5.5\", label: \"GPT-5.5\", supportsPlanMode: true },\n {\n id: \"gpt-5.3-codex\",\n label: \"Codex 5.3\",\n defaultVisible: false,\n supportsPlanMode: true,\n },\n {\n id: \"claude-sonnet-4-6\",\n label: \"Sonnet 4.6\",\n optionDescriptors: [staticContextWindowDescriptor(\"1m\", \"1M\")],\n supportsPlanMode: true,\n },\n {\n id: \"claude-opus-4-7\",\n label: \"Opus 4.7\",\n defaultVisible: false,\n optionDescriptors: [staticContextWindowDescriptor(\"1m\", \"1M\")],\n supportsPlanMode: true,\n },\n {\n id: \"gemini-3.1-pro\",\n label: \"Gemini 3.1 Pro\",\n defaultVisible: false,\n supportsPlanMode: true,\n },\n ],\n // OpenCode is a meta-provider: it spawns a local `opencode serve` and\n // forwards prompts to whichever underlying provider (anthropic, openai,\n // google, …) the user has authenticated locally via `opencode auth login`.\n // Model ids carry a `<providerID>/<modelID>` slug so the driver can split\n // them on the slash before calling `session.prompt`.\n //\n // The list below is the static seed shown when the inventory RPC hasn't\n // resolved yet (or fails). At runtime the renderer calls\n // `agent.opencodeInventory` and replaces this list with the\n // dynamically-discovered set of connected providers + models. The\n // dedicated plan-mode toggle covers build/plan agent switching, so we\n // don't expose an agent dropdown per-model. Reasoning/variant pickers\n // are rendered dynamically from each model's `variants` array.\n opencode: [\n {\n id: \"anthropic/claude-sonnet-4-5\",\n label: \"Anthropic · Claude Sonnet 4.5\",\n supportsPlanMode: true,\n },\n {\n id: \"openai/gpt-5\",\n label: \"OpenAI · GPT-5\",\n supportsPlanMode: true,\n },\n {\n id: \"google/gemini-2.5-pro\",\n label: \"Google · Gemini 2.5 Pro\",\n supportsPlanMode: true,\n },\n ],\n};\n\nexport const defaultModelFor = (providerId: ProviderId): string =>\n (MODELS_BY_PROVIDER[providerId].find(\n (m) => m.defaultModel === true && m.defaultVisible !== false,\n ) ??\n MODELS_BY_PROVIDER[providerId].find((m) => m.defaultVisible !== false) ??\n MODELS_BY_PROVIDER[providerId][0]!)!.id;\n\nexport type ModelEnabledByProvider = Record<\n ProviderId,\n Record<string, boolean>\n>;\n\nexport const defaultModelEnabledByProvider = (): ModelEnabledByProvider => {\n const out = {} as ModelEnabledByProvider;\n for (const providerId of Object.keys(MODELS_BY_PROVIDER) as ProviderId[]) {\n out[providerId] = {};\n for (const model of MODELS_BY_PROVIDER[providerId]) {\n out[providerId][model.id] = model.defaultVisible !== false;\n }\n }\n return out;\n};\n\nexport const isModelVisible = (\n providerId: ProviderId,\n modelId: string,\n modelEnabledByProvider?: Partial<\n Record<ProviderId, Partial<Record<string, boolean>>>\n >,\n): boolean => {\n const override = modelEnabledByProvider?.[providerId]?.[modelId];\n if (typeof override === \"boolean\") return override;\n const descriptor = findModelDescriptor(providerId, modelId);\n if (descriptor === undefined) return true;\n return descriptor.defaultVisible !== false;\n};\n\nexport const visibleModelsForProvider = (\n providerId: ProviderId,\n modelEnabledByProvider?: Partial<\n Record<ProviderId, Partial<Record<string, boolean>>>\n >,\n options?: { readonly includeModelId?: string | null },\n): ReadonlyArray<ModelOption> => {\n const includeModelId = options?.includeModelId ?? null;\n return MODELS_BY_PROVIDER[providerId].filter(\n (model) =>\n isModelVisible(providerId, model.id, modelEnabledByProvider) ||\n model.id === includeModelId,\n );\n};\n\n/**\n * Look up a model's descriptor by `(providerId, modelId)`. Returns\n * `undefined` when the slug isn't in our curated list (e.g. user typed\n * a custom slug), in which case the caller should fall through to\n * provider-level defaults.\n */\nexport const findModelDescriptor = (\n providerId: ProviderId,\n modelId: string,\n): ModelOption | undefined =>\n MODELS_BY_PROVIDER[providerId].find((m) => m.id === modelId);\n\n/**\n * Aliases for codex model slugs that no longer work — current Codex CLI rejects\n * `gpt-5-codex` / `gpt-5` when the user is on a ChatGPT account. We rewrite\n * persisted user settings and incoming requests through this map so existing\n * sessions don't crash.\n */\nexport const MODEL_ALIASES_BY_PROVIDER: Record<\n ProviderId,\n Record<string, string>\n> = {\n // Short / vendor-formatted slugs and pre-pricing-reset names route to the\n // canonical slugs above, so a user typing `opus` or `sonnet-4.6`\n // resolves to the current model id.\n claude: {\n opus: \"claude-opus-5\",\n \"opus-5\": \"claude-opus-5\",\n \"claude-opus-5\": \"claude-opus-5\",\n \"opus-4.8\": \"claude-opus-4-8\",\n \"claude-opus-4.8\": \"claude-opus-4-8\",\n \"opus-4.7\": \"claude-opus-4-7\",\n \"claude-opus-4.7\": \"claude-opus-4-7\",\n \"opus-4.6\": \"claude-opus-4-6\",\n \"claude-opus-4.6\": \"claude-opus-4-6\",\n fable: \"claude-fable-5\",\n \"fable-5\": \"claude-fable-5\",\n \"claude-fable-5\": \"claude-fable-5\",\n sonnet: \"claude-sonnet-5\",\n \"sonnet-5\": \"claude-sonnet-5\",\n \"claude-sonnet-5\": \"claude-sonnet-5\",\n \"sonnet-4.6\": \"claude-sonnet-4-6\",\n \"claude-sonnet-4.6\": \"claude-sonnet-4-6\",\n haiku: \"claude-haiku-4-5\",\n \"haiku-4.5\": \"claude-haiku-4-5\",\n \"claude-haiku-4.5\": \"claude-haiku-4-5\",\n },\n codex: {\n \"gpt-5-codex\": \"gpt-5.5\",\n \"gpt-5\": \"gpt-5.5\",\n },\n grok: {\n \"grok-4.6-latest\": \"grok-4.6\",\n \"grok-4.5-latest\": \"grok-4.5\",\n \"grok-build-latest\": \"grok-4.6\",\n },\n gemini: {\n \"gemini-3-pro\": \"gemini-3-pro-preview\",\n \"gemini-3.1-pro-preview\": \"gemini-3-pro-preview\",\n },\n kiro: {\n // Common shorthand / dotted-vs-hyphen variants users may persist.\n \"claude-opus-4-8\": \"claude-opus-4.8\",\n \"claude-opus-4-7\": \"claude-opus-4.7\",\n \"claude-opus-4-6\": \"claude-opus-4.6\",\n \"claude-sonnet-4-6\": \"claude-sonnet-4.6\",\n \"claude-sonnet-4-5\": \"claude-sonnet-4.5\",\n \"claude-haiku-4-5\": \"claude-haiku-4.5\",\n },\n // Cursor retired the old `gpt-5` / `sonnet-4*` / `opus-4.x` slugs sometime\n // around 2025-11. Existing user settings persisted by earlier builds get\n // re-aliased to current cursor catalogue entries so re-opening the app\n // doesn't send the agent a slug it'll silently ignore.\n cursor: {\n // Legacy slugs persisted by earlier builds.\n \"gpt-5\": \"composer-2\",\n \"sonnet-4\": \"claude-sonnet-4-6\",\n \"sonnet-4-thinking\": \"claude-sonnet-4-6\",\n \"opus-4.1\": \"claude-opus-4-7\",\n // Earlier runtime variants normalize to SDK-supported base models so a\n // previously persisted choice does not fail during agent creation.\n \"composer-2-fast\": \"composer-2\",\n \"composer-2.5-fast\": \"composer-2.5\",\n \"gpt-5.5-medium\": \"gpt-5.5\",\n \"gpt-5.5-medium-fast\": \"gpt-5.5\",\n \"gpt-5.5-high\": \"gpt-5.5\",\n \"gpt-5.5-high-fast\": \"gpt-5.5\",\n \"gpt-5.5-low\": \"gpt-5.5\",\n \"gpt-5.5-low-fast\": \"gpt-5.5\",\n \"gpt-5.5-extra-high\": \"gpt-5.5\",\n \"gpt-5.5-extra-high-fast\": \"gpt-5.5\",\n \"gpt-5.5-none\": \"gpt-5.5\",\n \"gpt-5.5-none-fast\": \"gpt-5.5\",\n \"gpt-5.4-high\": \"gpt-5.4\",\n \"gpt-5.4-high-fast\": \"gpt-5.4\",\n \"gpt-5.3-codex-fast\": \"gpt-5.3-codex\",\n auto: \"default\",\n },\n opencode: {},\n};\n\nexport const resolveModelSlug = (\n providerId: ProviderId,\n slug: string,\n): string => MODEL_ALIASES_BY_PROVIDER[providerId][slug] ?? slug;\n\n/**\n * Per-million-token USD pricing used by the renderer to compute the\n * \"saved ~$X\" line in the per-agent cost footer. Numbers are reference\n * values — keep aligned with vendor pricing pages. The wire stays just\n * numbers; conversion to currency happens renderer-side.\n */\nexport interface ModelPricing {\n readonly input: number;\n readonly output: number;\n readonly cacheRead: number;\n readonly cacheCreate: number;\n}\n\nexport const MODEL_PRICING: Record<string, ModelPricing> = {\n // 2026-05 Anthropic pricing reset — every Opus 4.x tier landed at the\n // same $5/$25 per-million numbers. `fastMode` (Opus only) doubles those\n // to $10 in / $50 out for ~2.5x throughput; we don't encode that here,\n // the renderer's cost footer applies the multiplier when the session\n // flips the boolean. 1M context window: no per-token premium.\n \"claude-opus-5\": {\n input: 5,\n output: 25,\n cacheRead: 0.5,\n cacheCreate: 6.25,\n },\n \"claude-opus-4-8\": {\n input: 5,\n output: 25,\n cacheRead: 0.5,\n cacheCreate: 6.25,\n },\n \"claude-opus-4-7\": {\n input: 5,\n output: 25,\n cacheRead: 0.5,\n cacheCreate: 6.25,\n },\n \"claude-opus-4-6\": {\n input: 5,\n output: 25,\n cacheRead: 0.5,\n cacheCreate: 6.25,\n },\n \"claude-fable-5\": {\n input: 10,\n output: 50,\n cacheRead: 1,\n cacheCreate: 12.5,\n },\n \"claude-sonnet-5\": {\n input: 3,\n output: 15,\n cacheRead: 0.3,\n cacheCreate: 3.75,\n },\n \"claude-sonnet-4-6\": {\n input: 3,\n output: 15,\n cacheRead: 0.3,\n cacheCreate: 3.75,\n },\n \"claude-haiku-4-5\": {\n input: 1,\n output: 5,\n cacheRead: 0.1,\n cacheCreate: 1.25,\n },\n};\n\nexport const SendInput = Schema.Struct({\n sessionId: AgentSessionId,\n text: Schema.String,\n /**\n * Per-turn override of the session's `modelOptions` (see\n * `StartSessionInput.modelOptions`). When omitted, drivers reuse the\n * value supplied at session start.\n */\n modelOptions: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\nexport type SendInput = typeof SendInput.Type;\n\nexport const InterruptInput = Schema.Struct({\n sessionId: AgentSessionId,\n turnId: Schema.optional(AgentTurnId),\n});\nexport type InterruptInput = typeof InterruptInput.Type;\n\nexport const CloseInput = Schema.Struct({\n sessionId: AgentSessionId,\n});\nexport type CloseInput = typeof CloseInput.Type;\n\nexport const SetCredentialInput = Schema.Struct({\n providerId: ProviderId,\n apiKey: Schema.String,\n});\nexport type SetCredentialInput = typeof SetCredentialInput.Type;\n\nexport const CredentialSetResult = Schema.Struct({\n verification: Schema.Literals([\"verified\", \"unverified\", \"notChecked\"]),\n warning: Schema.optional(Schema.String),\n});\nexport type CredentialSetResult = typeof CredentialSetResult.Type;\n\n// ---------------------------------------------------------------------------\n// Wire errors\n// ---------------------------------------------------------------------------\n\nexport class ProviderNotAvailableError extends Schema.TaggedErrorClass<ProviderNotAvailableError>()(\n \"ProviderNotAvailableError\",\n { providerId: ProviderId, reason: Schema.String },\n) {}\n\nexport class AgentSessionNotFoundError extends Schema.TaggedErrorClass<AgentSessionNotFoundError>()(\n \"AgentSessionNotFoundError\",\n { sessionId: AgentSessionId },\n) {}\n\nexport class AgentSessionStartError extends Schema.TaggedErrorClass<AgentSessionStartError>()(\n \"AgentSessionStartError\",\n { providerId: ProviderId, reason: Schema.String },\n) {}\n\nexport class CredentialStoreError extends Schema.TaggedErrorClass<CredentialStoreError>()(\n \"CredentialStoreError\",\n { providerId: ProviderId, reason: Schema.String },\n) {}\n\nexport class CredentialValidationError extends Schema.TaggedErrorClass<CredentialValidationError>()(\n \"CredentialValidationError\",\n { providerId: ProviderId, reason: Schema.String },\n) {}\n\n// ---------------------------------------------------------------------------\n// RPC definitions. Not yet registered in `MemoizeRpcs` — handlers come\n// online in PR 3 (availability), PR 4 (credentials), PR 5/6 (sessions). Each\n// of those PRs adds its RPC to the group when its handler exists.\n// ---------------------------------------------------------------------------\n\nexport const ProviderAvailabilityRpc = Rpc.make(\"provider.availability\", {\n payload: Schema.Struct({ refresh: Schema.optional(Schema.Boolean) }),\n success: Schema.Array(AgentAvailability),\n});\n\nexport const ProviderSetCredentialRpc = Rpc.make(\"provider.setCredential\", {\n payload: SetCredentialInput,\n success: CredentialSetResult,\n error: Schema.Union([CredentialStoreError, CredentialValidationError]),\n});\n\nexport const ProviderRemoveCredentialRpc = Rpc.make(\n \"provider.removeCredential\",\n {\n payload: Schema.Struct({ providerId: ProviderId }),\n success: Schema.Void,\n error: CredentialStoreError,\n },\n);\n\n// ---------------------------------------------------------------------------\n// OpenCode dynamic inventory — single RPC the renderer calls when the user\n// opens the model picker for the opencode provider. Returns the\n// SDK-discovered set of connected providers + their models, and the set of\n// locally-defined agents (build, plan, plus any custom ones). The renderer\n// merges this into the static `MODELS_BY_PROVIDER.opencode` seed so the\n// picker reflects what the user actually has connected/configured.\n//\n// Lives next to the per-provider availability probe so it's discoverable\n// alongside the other agent.* RPCs; the handler short-lives an\n// `opencode serve` to make the SDK calls and tears it down on return.\n// ---------------------------------------------------------------------------\n\nexport const OpencodeInventoryModel = Schema.Struct({\n id: Schema.String,\n label: Schema.String,\n /**\n * Variant names exposed by this opencode model — e.g. `[\"high\", \"medium\",\n * \"low\"]` for reasoning models, `[\"super-high\"]` for some, or `[]` for\n * models without a variant axis. Sourced from `provider.list()`'s\n * per-model `variants` map. The renderer renders a \"reasoning\" picker\n * only when this array is non-empty.\n */\n variants: Schema.Array(Schema.String),\n});\nexport type OpencodeInventoryModel = typeof OpencodeInventoryModel.Type;\n\nexport const OpencodeInventoryProvider = Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n models: Schema.Array(OpencodeInventoryModel),\n /**\n * `true` when opencode reports this provider in `provider.list().connected`\n * — i.e. it has a stored credential (via `auth.set`) or an injected custom\n * definition — so its models are actually usable. The catalog now returns\n * every provider opencode knows about (~150), most of them unconnected; the\n * settings UI uses this flag to split \"connected\" from \"available to add\".\n */\n connected: Schema.Boolean,\n /**\n * `true` for user-defined OpenAI-compatible providers we inject via\n * `OPENCODE_CONFIG_CONTENT` (see `settings.opencodeCustomProviders`), as\n * opposed to entries from opencode's built-in models.dev catalog.\n */\n custom: Schema.Boolean,\n /**\n * Name of the environment variable this provider's key is read from\n * (`provider.list().env[0]`, e.g. `\"OPENAI_API_KEY\"`, `\"GITHUB_TOKEN\"`).\n * Used as the API-key input placeholder. Empty for oauth-only / custom.\n */\n apiKeyEnv: Schema.String,\n /**\n * models.dev doc URL for this provider (the \"Get an API key\" link).\n * Empty when unknown (custom providers, or if the catalog fetch failed).\n */\n apiKeyUrl: Schema.String,\n});\nexport type OpencodeInventoryProvider = typeof OpencodeInventoryProvider.Type;\n\nexport const OpencodeInventoryAgent = Schema.Struct({\n name: Schema.String,\n mode: Schema.Literals([\"primary\", \"all\"]),\n description: Schema.optional(Schema.String),\n});\nexport type OpencodeInventoryAgent = typeof OpencodeInventoryAgent.Type;\n\nexport const OpencodeInventory = Schema.Struct({\n providers: Schema.Array(OpencodeInventoryProvider),\n agents: Schema.Array(OpencodeInventoryAgent),\n});\nexport type OpencodeInventory = typeof OpencodeInventory.Type;\n\nexport const ProviderOpencodeInventoryRpc = Rpc.make(\n \"provider.opencode.inventory\",\n {\n payload: Schema.Struct({}),\n success: OpencodeInventory,\n // Reused — `AgentSessionStartError` already carries `providerId` + `reason`\n // and the failure mode here (\"opencode not installed\", \"spawn failed\") is\n // the same shape the renderer already knows how to surface.\n error: AgentSessionStartError,\n },\n);\n\n// ---------------------------------------------------------------------------\n// Kiro live model inventory. Prefer control-plane ListAvailableModels; fall\n// back to `kiro-cli chat --list-models`. The renderer merges this into the\n// static `MODELS_BY_PROVIDER.kiro` seed so the picker reflects the account's\n// currently-available catalog (which varies by tier / region).\n// ---------------------------------------------------------------------------\n\nexport const KiroInventoryModel = Schema.Struct({\n id: Schema.String,\n label: Schema.String,\n description: Schema.NullOr(Schema.String),\n contextWindow: Schema.NullOr(Schema.Number),\n rateMultiplier: Schema.NullOr(Schema.Number),\n supportsImages: Schema.Boolean,\n});\nexport type KiroInventoryModel = typeof KiroInventoryModel.Type;\n\nexport const KiroInventory = Schema.Struct({\n models: Schema.Array(KiroInventoryModel),\n defaultModelId: Schema.String,\n});\nexport type KiroInventory = typeof KiroInventory.Type;\n\nexport const ProviderKiroInventoryRpc = Rpc.make(\"provider.kiro.inventory\", {\n payload: Schema.Struct({}),\n success: KiroInventory,\n error: AgentSessionStartError,\n});\n\n// ---------------------------------------------------------------------------\n// OpenCode provider management. The settings UI lets the user connect any of\n// opencode's ~150 catalog providers by pasting an API key, and define custom\n// OpenAI-compatible providers from a base URL. Keys are written through to\n// opencode's own persistent `auth.json` (via the SDK `auth.set`) so they also\n// work when the user runs `opencode` in a terminal; custom provider *shapes*\n// live in our settings.json and are injected at spawn. Each handler\n// short-lives an `opencode serve` to make the SDK call, mirroring\n// `agent.opencodeInventory`.\n// ---------------------------------------------------------------------------\n\n/** A single model exposed by a user-defined OpenAI-compatible provider. */\nexport const OpencodeCustomModel = Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n});\nexport type OpencodeCustomModel = typeof OpencodeCustomModel.Type;\n\n/**\n * User-defined OpenAI-compatible provider. `id` is the slug opencode keys the\n * provider by (also the `auth.set` id); `apiKey` is only present on the\n * add/update RPC payload — it is never persisted to settings.json, only to\n * opencode's `auth.json`.\n */\nexport const OpencodeCustomProvider = Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n baseURL: Schema.String,\n /**\n * The AI-SDK provider package opencode loads for this endpoint (e.g.\n * `\"@ai-sdk/openai-compatible\"`, `\"@openrouter/ai-sdk-provider\"`). Picked\n * from a small preset list in the UI; defaults to OpenAI-compatible.\n */\n npm: Schema.String,\n models: Schema.Array(OpencodeCustomModel),\n});\nexport type OpencodeCustomProvider = typeof OpencodeCustomProvider.Type;\n\nexport const ProviderOpencodeSetAuthRpc = Rpc.make(\n \"provider.opencode.setAuth\",\n {\n payload: Schema.Struct({\n providerId: Schema.String,\n apiKey: Schema.String,\n }),\n success: Schema.Void,\n error: AgentSessionStartError,\n },\n);\n\nexport const ProviderOpencodeRemoveAuthRpc = Rpc.make(\n \"provider.opencode.removeAuth\",\n {\n payload: Schema.Struct({ providerId: Schema.String }),\n success: Schema.Void,\n error: AgentSessionStartError,\n },\n);\n\nexport const ProviderOpencodeAddCustomRpc = Rpc.make(\n \"provider.opencode.addCustom\",\n {\n payload: Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n baseURL: Schema.String,\n npm: Schema.String,\n apiKey: Schema.String,\n models: Schema.Array(OpencodeCustomModel),\n }),\n success: Schema.Void,\n error: AgentSessionStartError,\n },\n);\n\nexport const ProviderOpencodeRemoveCustomRpc = Rpc.make(\n \"provider.opencode.removeCustom\",\n {\n payload: Schema.Struct({ id: Schema.String }),\n success: Schema.Void,\n error: AgentSessionStartError,\n },\n);\n\n// ---------------------------------------------------------------------------\n// One-click sign-in flow. The renderer subscribes to `provider.startLogin`,\n// which spawns the provider's `login` subcommand server-side, extracts the\n// OAuth URL the CLI prints, and reports progress back as a stream of\n// `LoginEvent`s. Supported providers have a real handler; other providers\n// resolve to an immediate `done(ok=false)`.\n// ---------------------------------------------------------------------------\n\nexport const LoginEvent = Schema.Union([\n Schema.TaggedStruct(\"url\", { url: Schema.String }),\n Schema.TaggedStruct(\"log\", { text: Schema.String }),\n Schema.TaggedStruct(\"done\", {\n ok: Schema.Boolean,\n reason: Schema.optional(Schema.String),\n }),\n]);\nexport type LoginEvent = typeof LoginEvent.Type;\n\nexport const ProviderStartLoginRpc = Rpc.make(\"provider.startLogin\", {\n payload: Schema.Struct({ providerId: ProviderId }),\n success: LoginEvent,\n error: AgentSessionStartError,\n stream: true,\n});\n\n// ---------------------------------------------------------------------------\n// One-click provider CLI update. The renderer subscribes to\n// `agent.updateProvider`, which spawns the provider's install/upgrade command\n// in a login shell (so `npm`/`bun` are on PATH and `curl … | bash` installers\n// work), streams the command's output back as `log` lines, and ends with a\n// terminal `done`. On success the renderer re-probes availability so the new\n// version is reflected immediately.\n// ---------------------------------------------------------------------------\n\nexport const ProviderUpdateEvent = Schema.Union([\n Schema.TaggedStruct(\"log\", { text: Schema.String }),\n Schema.TaggedStruct(\"done\", {\n ok: Schema.Boolean,\n reason: Schema.optional(Schema.String),\n }),\n]);\nexport type ProviderUpdateEvent = typeof ProviderUpdateEvent.Type;\n\nexport const ProviderUpdateRpc = Rpc.make(\"provider.update\", {\n payload: Schema.Struct({ providerId: ProviderId }),\n success: ProviderUpdateEvent,\n error: AgentSessionStartError,\n stream: true,\n});\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nexport const AnalyticsIdentityKind = Schema.Literals([\"anonymous\", \"account\"]);\nexport type AnalyticsIdentityKind = typeof AnalyticsIdentityKind.Type;\n\n/** The intentionally narrow analytics context shared with trusted clients. */\nexport class AnalyticsContext extends Schema.Class<AnalyticsContext>(\n\t\"AnalyticsContext\",\n)({\n\tenabled: Schema.Boolean,\n\tdistinctId: Schema.String,\n\tidentityKind: AnalyticsIdentityKind,\n}) {}\n\nexport const AnalyticsGetContextRpc = Rpc.make(\"analytics.getContext\", {\n\tsuccess: AnalyticsContext,\n});\n\nexport const AnalyticsContextChangesRpc = Rpc.make(\"analytics.contextChanges\", {\n\tsuccess: AnalyticsContext,\n\tstream: true,\n});\n","import { Schema } from \"effect\";\n\nexport const BrowserViewportMode = Schema.Literals([\n\t\"fill\",\n\t\"phone\",\n\t\"tablet\",\n\t\"laptop\",\n\t\"desktop\",\n\t\"custom\",\n]);\nexport type BrowserViewportMode = typeof BrowserViewportMode.Type;\n\nexport const BrowserOverlayShape = Schema.Union([\n\tSchema.TaggedStruct(\"Rectangle\", {\n\t\tid: Schema.String,\n\t\tx: Schema.Number,\n\t\ty: Schema.Number,\n\t\twidth: Schema.Number,\n\t\theight: Schema.Number,\n\t\tcolor: Schema.optional(Schema.String),\n\t}),\n\tSchema.TaggedStruct(\"Highlight\", {\n\t\tid: Schema.String,\n\t\tx: Schema.Number,\n\t\ty: Schema.Number,\n\t\twidth: Schema.Number,\n\t\theight: Schema.Number,\n\t\tcolor: Schema.optional(Schema.String),\n\t}),\n\tSchema.TaggedStruct(\"Arrow\", {\n\t\tid: Schema.String,\n\t\tfromX: Schema.Number,\n\t\tfromY: Schema.Number,\n\t\ttoX: Schema.Number,\n\t\ttoY: Schema.Number,\n\t\tcolor: Schema.optional(Schema.String),\n\t}),\n\tSchema.TaggedStruct(\"Label\", {\n\t\tid: Schema.String,\n\t\tx: Schema.Number,\n\t\ty: Schema.Number,\n\t\ttext: Schema.String,\n\t\tcolor: Schema.optional(Schema.String),\n\t}),\n\tSchema.TaggedStruct(\"Freehand\", {\n\t\tid: Schema.String,\n\t\tpoints: Schema.Array(Schema.Struct({ x: Schema.Number, y: Schema.Number })),\n\t\tcolor: Schema.optional(Schema.String),\n\t}),\n]);\nexport type BrowserOverlayShape = typeof BrowserOverlayShape.Type;\n","import { Effect, Schema } from \"effect\";\n\nimport { ProviderId } from \"./agent.ts\";\nimport { BrowserOverlayShape, BrowserViewportMode } from \"./browser-shared.ts\";\n\n/**\n * Reference to an uploaded attachment. The renderer carries this on\n * `ComposerInput` and on persisted user-rich messages; the actual bytes live\n * under the desktop app's userData directory and are served to the renderer\n * via the `zuse://attachments/<id>` custom protocol.\n *\n * `id` shape: `<sessionSegment>-<uuid>` (sanitised session id + v4 UUID).\n */\nexport const AttachmentRef = Schema.Struct({\n\tid: Schema.String,\n\tmimeType: Schema.String,\n\toriginalName: Schema.String,\n});\nexport type AttachmentRef = typeof AttachmentRef.Type;\n\n/**\n * Reference to a file or directory the user tagged into the composer via the\n * `@` popover. Paths are workspace-rooted; the server expands the contents at\n * send time so the provider sees the files inline.\n */\nexport const FileRef = Schema.Struct({\n\trelPath: Schema.String,\n\tabsPath: Schema.String,\n\tkind: Schema.Literals([\"file\", \"directory\"]),\n});\nexport type FileRef = typeof FileRef.Type;\n\n/**\n * Reference to a provider-defined skill the user invoked from the slash\n * popover. Memoize never inlines the skill body; the driver expands it\n * provider-side so semantics match the underlying CLI.\n */\nexport const SkillRef = Schema.Struct({\n\tname: Schema.String,\n\tscope: Schema.Literals([\"global\", \"project\"]),\n\targs: Schema.String,\n\tproviderId: ProviderId,\n});\nexport type SkillRef = typeof SkillRef.Type;\n\n/**\n * A region of code the user pinned with a comment. Created by selecting one or\n * more lines in the file editor / diff view and typing a note; annotations\n * stack into a tray above the composer and travel with the submission. Unlike\n * `FileRef`, no code snippet crosses the wire — `relPath` + the line range\n * already pinpoints the region and the agent reads the file itself. The server\n * serialises these into a numbered list appended to the prompt text.\n */\nexport const CodeAnnotation = Schema.Struct({\n\t/** Client-generated v4 UUID — list keys + removal. */\n\tid: Schema.String,\n\t/**\n\t * Workspace-rooted path, for display + the model (the agent's cwd is the\n\t * workspace root, so a relative path resolves). For files outside any\n\t * project folder this holds the absolute path instead.\n\t */\n\trelPath: Schema.String,\n\t/** Absolute path used by renderer affordances that can reopen the target. */\n\tabsPath: Schema.String,\n\t/** 1-based, inclusive. `startLine === endLine` for a single line. */\n\tstartLine: Schema.Number,\n\tendLine: Schema.Number,\n\tcomment: Schema.String,\n\t/** Diff side for branch-review annotations. Omitted for plain file notes. */\n\tdiffSide: Schema.optional(Schema.Literals([\"additions\", \"deletions\"])),\n\t/** Exact diff line that owns the annotation slot after range normalization. */\n\tdiffAnchorLine: Schema.optional(Schema.Number),\n\t/** Previous path when the selected line belongs to a renamed file. */\n\toldPath: Schema.optional(Schema.String),\n\t/** Comparison ref shown when the annotation was created. */\n\tbaseRef: Schema.optional(Schema.String),\n});\nexport type CodeAnnotation = typeof CodeAnnotation.Type;\n\nexport const BrowserAnnotationRect = Schema.Struct({\n\tx: Schema.Number,\n\ty: Schema.Number,\n\twidth: Schema.Number,\n\theight: Schema.Number,\n});\nexport type BrowserAnnotationRect = typeof BrowserAnnotationRect.Type;\n\nexport const BrowserAnnotationPoint = Schema.Struct({\n\tx: Schema.Number,\n\ty: Schema.Number,\n});\nexport type BrowserAnnotationPoint = typeof BrowserAnnotationPoint.Type;\n\nexport const BrowserAnnotationElement = Schema.Struct({\n\ttagName: Schema.String,\n\tselector: Schema.NullOr(Schema.String),\n\tlabel: Schema.String,\n\trect: BrowserAnnotationRect,\n\ttextPreview: Schema.String,\n});\nexport type BrowserAnnotationElement = typeof BrowserAnnotationElement.Type;\n\nexport const BrowserAnnotationRegion = Schema.Struct({\n\tid: Schema.String,\n\trect: BrowserAnnotationRect,\n});\nexport type BrowserAnnotationRegion = typeof BrowserAnnotationRegion.Type;\n\nexport const BrowserAnnotationStroke = Schema.Struct({\n\tid: Schema.String,\n\tpoints: Schema.Array(BrowserAnnotationPoint),\n\tbounds: BrowserAnnotationRect,\n});\nexport type BrowserAnnotationStroke = typeof BrowserAnnotationStroke.Type;\n\n/**\n * A visual annotation the user made directly on the Browser preview. The\n * screenshot travels through the existing attachment path, so the structured\n * annotation never carries raw image bytes or full page text.\n */\nexport const BrowserAnnotation = Schema.Struct({\n\t_tag: Schema.Literal(\"browser\"),\n\tid: Schema.String,\n\tcomment: Schema.String,\n\tcreatedAt: Schema.String,\n\tpageUrl: Schema.String,\n\tpageTitle: Schema.NullOr(Schema.String),\n\telements: Schema.Array(BrowserAnnotationElement),\n\tregions: Schema.Array(BrowserAnnotationRegion),\n\tstrokes: Schema.Array(BrowserAnnotationStroke),\n\toverlays: Schema.optional(Schema.Array(BrowserOverlayShape)),\n\tviewport: Schema.optional(\n\t\tSchema.Struct({\n\t\t\tmode: BrowserViewportMode,\n\t\t\twidth: Schema.Number,\n\t\t\theight: Schema.Number,\n\t\t\tscrollX: Schema.Number,\n\t\t\tscrollY: Schema.Number,\n\t\t\tdeviceScaleFactor: Schema.Number,\n\t\t}),\n\t),\n\tscreenshotAttachment: Schema.NullOr(AttachmentRef),\n});\nexport type BrowserAnnotation = typeof BrowserAnnotation.Type;\n\nexport const ComposerAnnotation = Schema.Union([\n\tCodeAnnotation,\n\tBrowserAnnotation,\n]);\nexport type ComposerAnnotation = typeof ComposerAnnotation.Type;\n\n/**\n * The full payload of a single composer submission. `text` is the editor\n * document with `@` / `/` tokens preserved as plain text; the typed arrays\n * give the server enough metadata to expand each segment without re-parsing.\n */\nexport class ComposerInput extends Schema.Class<ComposerInput>(\"ComposerInput\")(\n\t{\n\t\ttext: Schema.String,\n\t\tattachments: Schema.Array(AttachmentRef),\n\t\tfileRefs: Schema.Array(FileRef),\n\t\tskillRefs: Schema.Array(SkillRef),\n\t\tannotations: Schema.Array(ComposerAnnotation).pipe(\n\t\t\tSchema.withConstructorDefault(Effect.succeed([])),\n\t\t\tSchema.withDecodingDefaultType(Effect.succeed([])),\n\t\t),\n\t\t/** Preserve the submission mode while this input waits in the durable queue. */\n\t\tasGoal: Schema.optional(Schema.Boolean),\n\t},\n) {}\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { CommandId, FolderId, WorktreeId } from \"./ids.ts\";\n\n/**\n * One entry in a directory listing — either a file or a subdirectory. The\n * `path` is forward-slash, project-root-relative; the right-pane file tree\n * uses it as both the React key and the payload for the next `fs.tree` call\n * when the user expands a directory.\n */\nexport class FsEntry extends Schema.Class<FsEntry>(\"FsEntry\")({\n\tname: Schema.String,\n\tpath: Schema.String,\n\tkind: Schema.Literals([\"file\", \"directory\"]),\n}) {}\n\nexport class FsFolderNotFoundError extends Schema.TaggedErrorClass<FsFolderNotFoundError>()(\n\t\"FsFolderNotFoundError\",\n\t{ folderId: FolderId },\n) {}\n\nexport class DirectoryUnavailableError extends Schema.TaggedErrorClass<DirectoryUnavailableError>()(\n\t\"DirectoryUnavailableError\",\n\t{\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.NullOr(WorktreeId),\n\t\treason: Schema.Literals([\"project-missing\", \"worktree-missing\"]),\n\t},\n) {}\n\nexport class FsPathOutsideError extends Schema.TaggedErrorClass<FsPathOutsideError>()(\n\t\"FsPathOutsideError\",\n\t{ folderId: FolderId, path: Schema.String },\n) {}\n\nexport class FsReadError extends Schema.TaggedErrorClass<FsReadError>()(\n\t\"FsReadError\",\n\t{ folderId: FolderId, path: Schema.String, reason: Schema.String },\n) {}\n\nexport class FsAlreadyExistsError extends Schema.TaggedErrorClass<FsAlreadyExistsError>()(\n\t\"FsAlreadyExistsError\",\n\t{ folderId: FolderId, path: Schema.String },\n) {}\n\nexport class FsTooLargeError extends Schema.TaggedErrorClass<FsTooLargeError>()(\n\t\"FsTooLargeError\",\n\t{\n\t\tfolderId: FolderId,\n\t\tpath: Schema.String,\n\t\tsize: Schema.Number,\n\t\tlimit: Schema.Number,\n\t},\n) {}\n\nexport class FsConflictError extends Schema.TaggedErrorClass<FsConflictError>()(\n\t\"FsConflictError\",\n\t{\n\t\tfolderId: FolderId,\n\t\tpath: Schema.String,\n\t\texpectedMtime: Schema.String,\n\t\tactualMtime: Schema.String,\n\t},\n) {}\n\n/**\n * A command id is an idempotency key, so it may only ever describe one exact\n * file write. Reusing it with a different target or payload is rejected\n * instead of returning an unrelated prior receipt.\n */\nexport class FsCommandReuseError extends Schema.TaggedErrorClass<FsCommandReuseError>()(\n\t\"FsCommandReuseError\",\n\t{\n\t\tcommandId: CommandId,\n\t\treason: Schema.Literals([\"target-mismatch\", \"payload-mismatch\"]),\n\t},\n) {}\n\n// External-file errors mirror the in-folder ones but key off an absolute\n// `path` instead of a `folderId` — the `fs.*ExternalFile` RPCs operate\n// outside any project folder, so there's no folder id to carry.\nexport class FsExternalReadError extends Schema.TaggedErrorClass<FsExternalReadError>()(\n\t\"FsExternalReadError\",\n\t{ path: Schema.String, reason: Schema.String },\n) {}\n\nexport class FsExternalTooLargeError extends Schema.TaggedErrorClass<FsExternalTooLargeError>()(\n\t\"FsExternalTooLargeError\",\n\t{ path: Schema.String, size: Schema.Number, limit: Schema.Number },\n) {}\n\nexport class FsExternalConflictError extends Schema.TaggedErrorClass<FsExternalConflictError>()(\n\t\"FsExternalConflictError\",\n\t{\n\t\tpath: Schema.String,\n\t\texpectedMtime: Schema.String,\n\t\tactualMtime: Schema.String,\n\t},\n) {}\n\nconst FsErrors = Schema.Union([\n\tFsFolderNotFoundError,\n\tDirectoryUnavailableError,\n\tFsPathOutsideError,\n\tFsReadError,\n]);\n\nconst FsReadExternalFileErrors = Schema.Union([\n\tFsExternalReadError,\n\tFsExternalTooLargeError,\n]);\n\nconst FsWriteExternalFileErrors = Schema.Union([\n\tFsExternalReadError,\n\tFsExternalTooLargeError,\n\tFsExternalConflictError,\n]);\n\nconst FsReadFileErrors = Schema.Union([\n\tFsFolderNotFoundError,\n\tDirectoryUnavailableError,\n\tFsPathOutsideError,\n\tFsReadError,\n\tFsTooLargeError,\n]);\n\nconst FsWriteFileErrors = Schema.Union([\n\tFsFolderNotFoundError,\n\tDirectoryUnavailableError,\n\tFsPathOutsideError,\n\tFsReadError,\n\tFsConflictError,\n\tFsCommandReuseError,\n\tFsTooLargeError,\n]);\n\nconst FsCreateErrors = Schema.Union([\n\tFsFolderNotFoundError,\n\tDirectoryUnavailableError,\n\tFsPathOutsideError,\n\tFsReadError,\n\tFsAlreadyExistsError,\n]);\n\n/**\n * List one directory level. `path` is project-root-relative (use \"\" or omit\n * for the root). The right-pane tree calls this lazily as the user expands\n * directories — no recursive walk on the server. Skips `.git` and\n * `node_modules`; everything else is returned, sorted dirs-first then by name.\n */\nexport const FsTreeRpc = Rpc.make(\"fs.tree\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tpath: Schema.optional(Schema.String),\n\t\t/**\n\t\t * When set, list inside the worktree's path instead of the project's\n\t\t * main checkout. The worktree must belong to `folderId`; otherwise the\n\t\t * server falls back to the main checkout silently.\n\t\t */\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Array(FsEntry),\n\terror: FsErrors,\n});\n\nexport const FsTreeWatchEvent = Schema.Union([\n\tSchema.TaggedStruct(\"ready\", {\n\t\tepoch: Schema.String,\n\t\tsequence: Schema.Number,\n\t}),\n\tSchema.TaggedStruct(\"changed\", {\n\t\tepoch: Schema.String,\n\t\tsequence: Schema.Number,\n\t\tpaths: Schema.Array(Schema.String),\n\t}),\n\tSchema.TaggedStruct(\"gap\", {\n\t\tepoch: Schema.String,\n\t\tsequence: Schema.Number,\n\t\treason: Schema.String,\n\t}),\n]);\nexport type FsTreeWatchEvent = typeof FsTreeWatchEvent.Type;\n\n/**\n * Live stream of filesystem changes under the current project/worktree root.\n * `ready` proves the server watcher was attached before a client reads its\n * snapshot. Subsequent `changed` frames carry a stream-local monotonic\n * sequence. `gap` means the watcher can no longer prove continuity and the\n * client must attach a replacement watcher and perform a full reconciliation.\n */\nexport const FsWatchTreeRpc = Rpc.make(\"fs.watchTree\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: FsTreeWatchEvent,\n\terror: FsErrors,\n\tstream: true,\n});\n\n/**\n * The shape returned by `fs.readFile`. Text files come back with their\n * UTF-8 contents and the modification time used as an optimistic-concurrency\n * token by `fs.writeFile`. Files that fail UTF-8 decoding return their bytes as\n * `kind: \"binary\"` so supported formats can be previewed without another read.\n */\nexport const FsFileContent = Schema.Union([\n\tSchema.Struct({\n\t\tkind: Schema.Literal(\"text\"),\n\t\tcontent: Schema.String,\n\t\tmtime: Schema.String,\n\t\tsize: Schema.Number,\n\t}),\n\tSchema.Struct({\n\t\tkind: Schema.Literal(\"binary\"),\n\t\tbytes: Schema.Uint8ArrayFromBase64,\n\t\tsize: Schema.Number,\n\t}),\n]);\n\n/**\n * Read a single file's contents. Path is project-root-relative. Files\n * larger than the server-side cap (5 MB) reject with `FsTooLargeError`;\n * non-UTF-8 files come back as `kind: \"binary\"`. The renderer file editor\n * stores the returned `mtime` and passes it back on `fs.writeFile` so the\n * server can reject writes when the file changed on disk underneath us.\n */\nexport const FsReadFileRpc = Rpc.make(\"fs.readFile\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tpath: Schema.String,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: FsFileContent,\n\terror: FsReadFileErrors,\n});\n\n/**\n * Write a single file. `expectedMtime` is the mtime the renderer received\n * from the most recent `fs.readFile` (or the most recent successful write).\n * If the file's mtime on disk no longer matches, the server rejects with\n * `FsConflictError` and the renderer surfaces a \"file changed on disk\"\n * toast. Same 5 MB cap applies to incoming content.\n */\nexport const FsWriteFileRpc = Rpc.make(\"fs.writeFile\", {\n\tpayload: Schema.Struct({\n\t\t/** Stable identity makes a lost write response safe to retry. */\n\t\tcommandId: CommandId,\n\t\tfolderId: FolderId,\n\t\tpath: Schema.String,\n\t\tcontent: Schema.String,\n\t\texpectedMtime: Schema.String,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Struct({\n\t\tmtime: Schema.String,\n\t}),\n\terror: FsWriteFileErrors,\n});\n\n/**\n * Create an empty file inside the project/worktree root. Fails if the target\n * already exists; parent directories must already exist.\n */\nexport const FsCreateFileRpc = Rpc.make(\"fs.createFile\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tpath: Schema.String,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Struct({}),\n\terror: FsCreateErrors,\n});\n\n/**\n * Create a single directory inside the project/worktree root. Fails if the\n * target already exists; parent directories must already exist.\n */\nexport const FsCreateDirectoryRpc = Rpc.make(\"fs.createDirectory\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tpath: Schema.String,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Struct({}),\n\terror: FsCreateErrors,\n});\n\n/**\n * Remove a file or directory tree inside the project/worktree root. This is\n * intentionally scoped to the same project-relative path validation as every\n * other local fs RPC.\n */\nexport const FsRemoveRpc = Rpc.make(\"fs.remove\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tpath: Schema.String,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Struct({}),\n\terror: FsErrors,\n});\n\n/**\n * List every file path under the project/worktree root in one shot, for the\n * path-first `@pierre/trees` file tree (which wants the full path universe up\n * front and virtualizes the visible window itself). Paths are forward-slash,\n * project-root-relative, dirs-first-then-name sorted. Skips `.git`,\n * `node_modules`, and other noise dirs. Capped at `MAX_TREE_PATHS`; once the\n * cap is hit, `truncated` is `true` and the list stops early.\n */\nexport const FsListPathsRpc = Rpc.make(\"fs.listPaths\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Struct({\n\t\tpaths: Schema.Array(Schema.String),\n\t\ttruncated: Schema.Boolean,\n\t}),\n\terror: FsErrors,\n});\n\n/**\n * Rename/move a file or directory inside the project/worktree root. Powers the\n * file tree's inline rename and drag-and-drop. Both paths are project-relative\n * and validated for containment; fails if the destination already exists.\n */\nexport const FsMoveRpc = Rpc.make(\"fs.move\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tfromPath: Schema.String,\n\t\ttoPath: Schema.String,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Struct({}),\n\terror: FsCreateErrors,\n});\n\n/**\n * Read a file by absolute path, outside any project folder — backs opening\n * agent-written plan/markdown files that live elsewhere on disk. Same UTF-8\n * decode, 5 MB cap, and `mtime` concurrency token as `fs.readFile`.\n * Deliberately not sandboxed to a folder: a local desktop app reading a file\n * the user explicitly opened.\n */\nexport const FsReadExternalFileRpc = Rpc.make(\"fs.readExternalFile\", {\n\tpayload: Schema.Struct({\n\t\tpath: Schema.String,\n\t}),\n\tsuccess: FsFileContent,\n\terror: FsReadExternalFileErrors,\n});\n\n/**\n * Write a file by absolute path. Same optimistic-concurrency (`expectedMtime`)\n * and 5 MB cap as `fs.writeFile`. Pairs with `fs.readExternalFile` for editing\n * files outside the workspace.\n */\nexport const FsWriteExternalFileRpc = Rpc.make(\"fs.writeExternalFile\", {\n\tpayload: Schema.Struct({\n\t\tpath: Schema.String,\n\t\tcontent: Schema.String,\n\t\texpectedMtime: Schema.String,\n\t}),\n\tsuccess: Schema.Struct({\n\t\tmtime: Schema.String,\n\t}),\n\terror: FsWriteExternalFileErrors,\n});\n","import { Effect, Schema } from \"effect\";\n\nexport const NameProvenance = Schema.Literals([\n\t\"pending\",\n\t\"automatic\",\n\t\"manual\",\n]);\nexport type NameProvenance = typeof NameProvenance.Type;\n\nexport const NameProvenanceField = NameProvenance.pipe(\n\tSchema.withConstructorDefault(Effect.succeed(\"manual\" as const)),\n\tSchema.withDecodingDefaultType(Effect.succeed(\"manual\" as const)),\n);\n","import { Rpc } from \"effect/unstable/rpc\";\nimport { Schema } from \"effect\";\n\nimport { WorktreeId } from \"./ids.ts\";\n\nexport const PokemonRarity = Schema.Literals([\n \"common\",\n \"uncommon\",\n \"rare\",\n \"epic\",\n \"legendary\",\n]);\nexport type PokemonRarity = typeof PokemonRarity.Type;\n\nexport class PokemonSummary extends Schema.Class<PokemonSummary>(\n \"PokemonSummary\",\n)({\n number: Schema.Number,\n slug: Schema.String,\n name: Schema.String,\n generation: Schema.Number,\n rarity: PokemonRarity,\n points: Schema.Number,\n spriteUrl: Schema.NullOr(Schema.String),\n}) {}\n\nexport class PokemonSpriteVariant extends Schema.Class<PokemonSpriteVariant>(\n \"PokemonSpriteVariant\",\n)({\n id: Schema.String,\n label: Schema.String,\n spriteUrl: Schema.NullOr(Schema.String),\n}) {}\n\nexport class PokemonEvolutionStep extends Schema.Class<PokemonEvolutionStep>(\n \"PokemonEvolutionStep\",\n)({\n number: Schema.Number,\n slug: Schema.String,\n name: Schema.String,\n rarity: PokemonRarity,\n unlocked: Schema.Boolean,\n spriteUrl: Schema.NullOr(Schema.String),\n silhouetteUrl: Schema.String,\n}) {}\n\nexport class PokemonPokedexEntry extends Schema.Class<PokemonPokedexEntry>(\n \"PokemonPokedexEntry\",\n)({\n number: Schema.Number,\n slug: Schema.String,\n name: Schema.String,\n generation: Schema.Number,\n rarity: PokemonRarity,\n points: Schema.Number,\n unlocked: Schema.Boolean,\n unlockedAt: Schema.NullOr(Schema.DateFromString),\n worktreeId: Schema.NullOr(WorktreeId),\n spriteUrl: Schema.NullOr(Schema.String),\n silhouetteUrl: Schema.String,\n variants: Schema.Array(PokemonSpriteVariant),\n evolutionLine: Schema.Array(PokemonEvolutionStep),\n}) {}\n\nexport class PokemonNotFoundError extends Schema.TaggedErrorClass<PokemonNotFoundError>()(\n \"PokemonNotFoundError\",\n { number: Schema.Number },\n) {}\n\nexport const PokemonPokedexRpc = Rpc.make(\"pokemon.pokedex\", {\n payload: Schema.Struct({}),\n success: Schema.Array(PokemonPokedexEntry),\n});\n\nexport const PokemonEnsureSpriteCachedRpc = Rpc.make(\n \"pokemon.ensureSpriteCached\",\n {\n payload: Schema.Struct({ number: Schema.Number }),\n success: PokemonPokedexEntry,\n error: PokemonNotFoundError,\n },\n);\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { FolderId, WorktreeId } from \"./ids.ts\";\nimport { NameProvenanceField } from \"./naming.ts\";\nimport { PokemonSummary } from \"./pokemon.ts\";\n\nexport const WorktreeSetupStatus = Schema.Literals([\n\t\"pending\",\n\t\"running\",\n\t\"succeeded\",\n\t\"failed\",\n\t\"skipped\",\n]);\nexport type WorktreeSetupStatus = typeof WorktreeSetupStatus.Type;\n\n/**\n * A git worktree owned by memoize. Lives at\n * `~/.zuse/<repo-name>-<projectId-short>/<name>/` so it stays out of the\n * source repo (no `.git/info/exclude` rewriting, no stray entries in `git\n * status`, no `.zuse/` paths leaking into file pickers). Fresh branches may\n * receive a one-time semantic name after their first submitted turn succeeds.\n */\nexport class Worktree extends Schema.Class<Worktree>(\"Worktree\")({\n\tid: WorktreeId,\n\tprojectId: FolderId,\n\tpath: Schema.String,\n\tname: Schema.String,\n\tbranch: Schema.String,\n\tbranchProvenance: NameProvenanceField,\n\tbaseBranch: Schema.String,\n\tcreatedAt: Schema.DateFromString,\n\tsetupStatus: WorktreeSetupStatus,\n\tsetupOutput: Schema.String,\n\tsetupStartedAt: Schema.NullOr(Schema.DateFromString),\n\tsetupFinishedAt: Schema.NullOr(Schema.DateFromString),\n\tpokemon: Schema.NullOr(PokemonSummary),\n}) {}\n\nexport class WorktreeNotFoundError extends Schema.TaggedErrorClass<WorktreeNotFoundError>()(\n\t\"WorktreeNotFoundError\",\n\t{ worktreeId: WorktreeId },\n) {}\n\n/**\n * Live setup events streamed while a worktree's setup script runs. `chunk`\n * carries the FULL accumulated (already-truncated) output so the renderer can\n * replace `setupOutput` wholesale; `status` carries each setupStatus\n * transition + timestamps. The stream completes once setup reaches a terminal\n * status (succeeded / failed / skipped).\n */\nexport const WorktreeSetupChunk = Schema.TaggedStruct(\"chunk\", {\n\tworktreeId: WorktreeId,\n\toutput: Schema.String,\n});\n\nexport const WorktreeSetupStatusEvent = Schema.TaggedStruct(\"status\", {\n\tworktreeId: WorktreeId,\n\tstatus: WorktreeSetupStatus,\n\tsetupStartedAt: Schema.NullOr(Schema.DateFromString),\n\tsetupFinishedAt: Schema.NullOr(Schema.DateFromString),\n});\n\nexport const WorktreeSetupEvent = Schema.Union([\n\tWorktreeSetupChunk,\n\tWorktreeSetupStatusEvent,\n]);\nexport type WorktreeSetupEvent = typeof WorktreeSetupEvent.Type;\n\nexport class WorktreeCreateError extends Schema.TaggedErrorClass<WorktreeCreateError>()(\n\t\"WorktreeCreateError\",\n\t{ projectId: FolderId, reason: Schema.String },\n) {}\n\nexport class WorktreeRemoveError extends Schema.TaggedErrorClass<WorktreeRemoveError>()(\n\t\"WorktreeRemoveError\",\n\t{ worktreeId: WorktreeId, reason: Schema.String },\n) {}\n\nexport class WorktreeCheckpointError extends Schema.TaggedErrorClass<WorktreeCheckpointError>()(\n\t\"WorktreeCheckpointError\",\n\t{ worktreeId: WorktreeId, reason: Schema.String },\n) {}\n\nexport class WorktreeSetupError extends Schema.TaggedErrorClass<WorktreeSetupError>()(\n\t\"WorktreeSetupError\",\n\t{ worktreeId: WorktreeId, reason: Schema.String },\n) {}\n\nexport const WorktreeBranchRenameReason = Schema.Literals([\n\t\"invalid\",\n\t\"conflict\",\n\t\"detached\",\n\t\"mismatch\",\n\t\"published\",\n\t\"git-failed\",\n\t\"rollback-failed\",\n]);\nexport type WorktreeBranchRenameReason = typeof WorktreeBranchRenameReason.Type;\n\nexport class WorktreeBranchRenameError extends Schema.TaggedErrorClass<WorktreeBranchRenameError>()(\n\t\"WorktreeBranchRenameError\",\n\t{\n\t\tworktreeId: WorktreeId,\n\t\treason: WorktreeBranchRenameReason,\n\t\tmessage: Schema.String,\n\t},\n) {}\n\nconst WorktreeErrors = Schema.Union([\n\tWorktreeCreateError,\n\tWorktreeRemoveError,\n\tWorktreeNotFoundError,\n\tWorktreeCheckpointError,\n\tWorktreeSetupError,\n\tWorktreeBranchRenameError,\n]);\n\n/**\n * Optional source for a worktree checkout. When omitted, `worktree.create`\n * behaves as before: allocate a fresh Pokémon branch off `origin/<default>`.\n * When present, the worktree checks out an EXISTING ref instead:\n * - `branch` → check out that branch (tracking `origin/<branch>` when it's a\n * remote branch), used by the \"Create from → Branches\" picker.\n * - `pr` → `gh pr checkout <number>` inside the new worktree, used by\n * \"Create from → PRs\" (handles fork PRs + tracking).\n * The directory still gets a Pokémon name/mascot; only the checked-out branch\n * differs.\n */\nexport const WorktreeCreateSource = Schema.Union([\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"branch\"),\n\t\tbranch: Schema.String,\n\t\tremote: Schema.NullOr(Schema.String),\n\t}),\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"pr\"),\n\t\tnumber: Schema.Number,\n\t\theadRefName: Schema.String,\n\t}),\n]);\nexport type WorktreeCreateSource = typeof WorktreeCreateSource.Type;\n\nexport const WorktreeCreateRpc = Rpc.make(\"worktree.create\", {\n\tpayload: Schema.Struct({\n\t\tprojectId: FolderId,\n\t\tsource: Schema.optional(WorktreeCreateSource),\n\t}),\n\tsuccess: Worktree,\n\terror: WorktreeCreateError,\n});\n\nexport const WorktreeListRpc = Rpc.make(\"worktree.list\", {\n\tpayload: Schema.Struct({ projectId: FolderId }),\n\tsuccess: Schema.Array(Worktree),\n});\n\nexport const WorktreeGetRpc = Rpc.make(\"worktree.get\", {\n\tpayload: Schema.Struct({ worktreeId: WorktreeId }),\n\tsuccess: Schema.NullOr(Worktree),\n});\n\nexport const WorktreeRenameBranchRpc = Rpc.make(\"worktree.renameBranch\", {\n\tpayload: Schema.Struct({ worktreeId: WorktreeId, name: Schema.String }),\n\tsuccess: Worktree,\n\terror: Schema.Union([WorktreeNotFoundError, WorktreeBranchRenameError]),\n});\n\n/**\n * Subscribe to a worktree's live setup output + status. Mirrors `pty.output`:\n * a long-lived stream the renderer drains while `setupStatus === \"running\"`.\n * Seeds the current persisted snapshot on subscribe so a late subscriber\n * (after a fast setup already finished) still sees the terminal state.\n */\nexport const WorktreeSetupStreamRpc = Rpc.make(\"worktree.setupStream\", {\n\tpayload: Schema.Struct({ worktreeId: WorktreeId }),\n\tsuccess: WorktreeSetupEvent,\n\terror: WorktreeNotFoundError,\n\tstream: true,\n});\n\nexport const WorktreeRerunSetupRpc = Rpc.make(\"worktree.rerunSetup\", {\n\tpayload: Schema.Struct({ worktreeId: WorktreeId }),\n\tsuccess: Worktree,\n\terror: WorktreeErrors,\n});\n\nexport const WorktreeStartRunRpc = Rpc.make(\"worktree.startRun\", {\n\tpayload: Schema.Struct({ worktreeId: WorktreeId }),\n\tsuccess: Schema.Struct({\n\t\tcwd: Schema.String,\n\t\tscript: Schema.String,\n\t\tenv: Schema.Record(Schema.String, Schema.String),\n\t}),\n\terror: WorktreeErrors,\n});\n\n/** Remove a worktree checkout after checkpointing any dirty state. */\nexport const WorktreeRemoveRpc = Rpc.make(\"worktree.remove\", {\n\tpayload: Schema.Struct({ worktreeId: WorktreeId }),\n\tsuccess: Schema.Void,\n\terror: WorktreeErrors,\n});\n","import { Effect, Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport {\n\tAgentDefinition,\n\tContextUsagePrecision,\n\tPermissionMode,\n\tPlanApprovalOutcome,\n\tProviderId,\n\tProviderMessageCheckpoint,\n\tRuntimeMode,\n\tUserQuestion,\n} from \"./agent.ts\";\nimport {\n\tAttachmentRef,\n\tComposerAnnotation,\n\tComposerInput,\n\tFileRef,\n\tSkillRef,\n} from \"./composer.ts\";\nimport { DirectoryUnavailableError } from \"./fs.ts\";\nimport {\n\tAgentItemId,\n\tAgentSessionId,\n\tAgentTurnId,\n\tChatId,\n\tCommandId,\n\tFolderId,\n\tMessageId,\n\tWorktreeId,\n} from \"./ids.ts\";\nimport { NameProvenanceField } from \"./naming.ts\";\nimport { Worktree } from \"./worktree.ts\";\n\nexport {\n\tDEFAULT_PERMISSION_MODE,\n\tDEFAULT_RUNTIME_MODE,\n\tPermissionMode,\n\tRuntimeMode,\n} from \"./agent.ts\";\nexport { ChatId } from \"./ids.ts\";\n\n/**\n * A session is one chat thread inside a project. The id matches the underlying\n * provider session id (`AgentSessionId`) so the persistence layer and the\n * provider's in-memory map stay in lockstep.\n */\nexport const SessionId = AgentSessionId;\nexport type SessionId = AgentSessionId;\n\n/**\n * Persisted lifecycle state of a session. Mirrors the `sessions.status` column.\n * `booting` — row exists; provider boot (CLI spawn + SDK handshake) is in\n * flight on a background fiber. Transitions to `idle`/`running`\n * on success, `error` on failure. Stale `booting` rows from a\n * crashed daemon are cleaned up at boot.\n * `idle` — row exists but no provider session is currently driving it.\n * `running` — provider session is alive and its event stream is being consumed.\n * `closed` — turn ended normally or session was closed by the user.\n * `error` — provider terminated the session with an error.\n */\nexport const SessionStatus = Schema.Literals([\n\t\"booting\",\n\t\"idle\",\n\t\"running\",\n\t\"closed\",\n\t\"error\",\n]);\nexport type SessionStatus = typeof SessionStatus.Type;\n\n/**\n * How (if at all) a session can resume after the provider session is gone.\n * Captured at start time; the renderer uses it to decide whether to expose\n * a \"Resumable\" affordance on stopped sessions.\n *\n * - `claude-session-id` — Claude SDK's `session_id` is stored in `cursor`\n * and passed back as `options.resume` on the next start.\n * - `codex-thread-id` — Codex SDK's thread id is stored in `cursor` and\n * passed back via `Codex.resumeThread(id)`. Codex doesn't replay prior\n * items on resume; the renderer's persisted timeline is the source of\n * truth for what came before.\n * - `none` — no resume; sending again starts a fresh provider session\n * under the same DB row (existing chat-MVP behavior).\n */\nexport const ResumeStrategy = Schema.Literals([\n\t\"claude-session-id\",\n\t\"codex-thread-id\",\n\t\"grok-session-id\",\n\t\"cursor-session-id\",\n\t\"gemini-session-id\",\n\t\"opencode-session-id\",\n\t\"kiro-session-id\",\n\t\"none\",\n]);\nexport type ResumeStrategy = typeof ResumeStrategy.Type;\n\n// `RuntimeMode` and `DEFAULT_RUNTIME_MODE` are defined in `agent.ts` so the\n// new `AgentDefinition.permissionMode` can reuse the same literal set\n// without an import cycle. Re-exported above for back-compat with the\n// existing `import { RuntimeMode } from \"@zuse/contracts\"` callers.\n\nexport class Session extends Schema.Class<Session>(\"Session\")({\n\tid: SessionId,\n\tprojectId: FolderId,\n\ttitle: Schema.String,\n\ttitleProvenance: NameProvenanceField,\n\tproviderId: ProviderId,\n\tmodel: Schema.String,\n\tstatus: SessionStatus,\n\tarchivedAt: Schema.NullOr(Schema.DateFromString),\n\tcursor: Schema.NullOr(Schema.String),\n\tproviderEventCursor: Schema.optional(Schema.NullOr(Schema.String)),\n\tresumeStrategy: ResumeStrategy,\n\truntimeMode: RuntimeMode,\n\t/**\n\t * Optional git worktree the session runs in. When null, the session runs\n\t * in the project's main checkout (`projects.path`). Mirrors the owning\n\t * chat's `worktreeId` — sessions in a chat always share its worktree;\n\t * server-side `chat.setWorktree` updates both. Locked once the chat has\n\t * any message recorded.\n\t */\n\tworktreeId: Schema.NullOr(WorktreeId),\n\t/**\n\t * Chat (sidebar entry) this session belongs to. Every session is a tab\n\t * inside exactly one chat — the chat row is the container; sessions are\n\t * its uniform members. CASCADEs on chat delete.\n\t */\n\tchatId: ChatId,\n\t/**\n\t * If this session was forked from another, the source session id. Null\n\t * for sessions started fresh. Reserved for the upcoming \"fork from\n\t * message\" feature — column ships now so the future capability is a\n\t * pure code change.\n\t */\n\tforkedFromSessionId: Schema.NullOr(SessionId),\n\t/**\n\t * The message in the source session the fork branched from, when\n\t * applicable. Paired with `forkedFromSessionId`.\n\t */\n\tforkedFromMessageId: Schema.NullOr(MessageId),\n\t/**\n\t * SDK lifecycle mode. Distinct from `runtimeMode` (our own auto-allow\n\t * policy). `plan` means the agent is currently restricted to read-only\n\t * tools and is expected to end its turn by calling `ExitPlanMode`.\n\t */\n\tpermissionMode: PermissionMode,\n\t/**\n\t * Whether deferred tool loading was enabled at session start. Mirrors\n\t * `StartSessionInput.toolSearch`. No behavioural effect today; reserved\n\t * for the 0.04 code-index MCP servers.\n\t */\n\ttoolSearch: Schema.Boolean,\n\tcreatedAt: Schema.DateFromString,\n\tupdatedAt: Schema.DateFromString,\n}) {}\n\n/**\n * Conventional chat-message role. `tool` is used for tool_result rows so\n * markdown renderers can pick a distinct visual treatment without sniffing\n * `content._tag`.\n */\nexport const MessageRole = Schema.Literals([\n\t\"user\",\n\t\"assistant\",\n\t\"system\",\n\t\"tool\",\n]);\nexport type MessageRole = typeof MessageRole.Type;\n\n/**\n * Attribution for a user-role message injected by ANOTHER agent (via the\n * zuse-orchestration create_thread / send_to_thread tools) rather than typed\n * by the human. Additive + optional: old rows decode without it.\n */\nexport const MessageOrigin = Schema.Struct({\n\tchatId: ChatId,\n\tsessionId: SessionId,\n\tproviderId: ProviderId,\n});\nexport type MessageOrigin = typeof MessageOrigin.Type;\n\nconst UserContent = Schema.TaggedStruct(\"user\", {\n\ttext: Schema.String,\n\torigin: Schema.optional(MessageOrigin),\n\tgoal: Schema.optional(Schema.Boolean),\n});\n\n/**\n * User message that carries chips: typed file/directory tags, image\n * attachments, and skill invocations. Coexists with `user` — old rows still\n * render via the plain `user` variant. The renderer prefers `user_rich` when\n * a submission has any non-text segments.\n */\nconst UserRichContent = Schema.TaggedStruct(\"user_rich\", {\n\ttext: Schema.String,\n\tattachments: Schema.Array(AttachmentRef),\n\tfileRefs: Schema.Array(FileRef),\n\tskillRefs: Schema.Array(SkillRef),\n\t// Additive + back-compat: rows persisted before code annotations existed\n\t// decode with an empty list rather than failing.\n\tannotations: Schema.Array(ComposerAnnotation).pipe(\n\t\tSchema.withDecodingDefaultType(Effect.succeed([])),\n\t),\n\torigin: Schema.optional(MessageOrigin),\n\tgoal: Schema.optional(Schema.Boolean),\n});\n\nconst AssistantContent = Schema.TaggedStruct(\"assistant\", {\n\titemId: Schema.optional(AgentItemId),\n\ttext: Schema.String,\n\tcheckpoint: Schema.optional(ProviderMessageCheckpoint),\n\t/** Preserves a provider's dedicated final-plan item through persistence. */\n\tisPlan: Schema.optional(Schema.Boolean),\n\tparentItemId: Schema.optional(AgentItemId),\n});\n\n/**\n * Extended-thinking / reasoning text emitted by the model before its final\n * answer. `redacted` mirrors Anthropic's `redacted_thinking` blocks where\n * the content is hidden but the row still appears so users see something\n * was thought about.\n */\nconst ThinkingContent = Schema.TaggedStruct(\"thinking\", {\n\titemId: AgentItemId,\n\ttext: Schema.String,\n\tredacted: Schema.Boolean,\n\tcheckpoint: Schema.optional(ProviderMessageCheckpoint),\n\tparentItemId: Schema.optional(AgentItemId),\n});\n\nconst ToolUseContent = Schema.TaggedStruct(\"tool_use\", {\n\titemId: AgentItemId,\n\ttool: Schema.String,\n\tinput: Schema.Unknown,\n\tparentItemId: Schema.optional(AgentItemId),\n\tbackgroundTask: Schema.optional(\n\t\tSchema.Struct({\n\t\t\ttaskId: Schema.String,\n\t\t}),\n\t),\n\tsubagent: Schema.optional(\n\t\tSchema.Struct({\n\t\t\tchildSessionId: Schema.String,\n\t\t\tpresentation: Schema.Literals([\"inline\", \"detached\"]),\n\t\t}),\n\t),\n});\n\nconst ToolResultContent = Schema.TaggedStruct(\"tool_result\", {\n\titemId: AgentItemId,\n\toutput: Schema.Unknown,\n\tisError: Schema.Boolean,\n\tparentItemId: Schema.optional(AgentItemId),\n});\n\nconst ErrorContent = Schema.TaggedStruct(\"error\", {\n\tmessage: Schema.String,\n});\n\n/**\n * Persisted marker for a turn the user explicitly interrupted. Rendered as a\n * small muted \"Interrupted by user\" badge — distinct from `error`, which is a\n * real failure. Carries no fields; its presence in the message list is the\n * whole signal.\n */\nconst InterruptedContent = Schema.TaggedStruct(\"interrupted\", {});\n\n/**\n * Closing summary persisted for a sub-agent run. Mirrors the streaming\n * `SubagentSummaryEvent` so resume parity holds: the wrapper-row footer\n * reads `summary` / `turns` / `durationMs` from this row when collapsed.\n */\nconst SubagentSummaryContent = Schema.TaggedStruct(\"subagent_summary\", {\n\titemId: AgentItemId,\n\tagentName: Schema.String,\n\tmodel: Schema.String,\n\tturns: Schema.Number,\n\tdurationMs: Schema.Number,\n\tsummary: Schema.String,\n\tisError: Schema.Boolean,\n\tchildSessionId: Schema.optional(Schema.String),\n\tpresentation: Schema.optional(Schema.Literals([\"inline\", \"detached\"])),\n});\n\nconst SubagentProgressContent = Schema.TaggedStruct(\"subagent_progress\", {\n\tchildId: Schema.String,\n\tparentId: Schema.String,\n\tchildSessionId: Schema.String,\n\tstatus: Schema.String,\n\tdurationMs: Schema.Number,\n\tturns: Schema.Number,\n\ttoolCalls: Schema.Number,\n\ttokens: Schema.Number,\n\tcontextPercentage: Schema.Number,\n\ttoolsUsed: Schema.Array(Schema.String),\n\terrorCount: Schema.Number,\n});\n\n/**\n * Per-turn token usage. Persisted (rather than transient) so resume parity\n * gives us the per-agent cost footer for free. `parentItemId` set means\n * the usage belongs to a sub-agent; absent means main-agent usage.\n */\nconst UsageContent = Schema.TaggedStruct(\"usage\", {\n\tparentItemId: Schema.optional(AgentItemId),\n\tinputTokens: Schema.Number,\n\toutputTokens: Schema.Number,\n\tcacheReadTokens: Schema.Number,\n\tcacheCreationTokens: Schema.Number,\n\tmodel: Schema.String,\n});\n\nconst ContextUsageContent = Schema.TaggedStruct(\"context_usage\", {\n\tproviderId: ProviderId,\n\tusedTokens: Schema.NullOr(Schema.Number),\n\twindowTokens: Schema.NullOr(Schema.Number),\n\tprecision: ContextUsagePrecision,\n\tsource: Schema.optional(Schema.String),\n});\n\nconst ContextCompactionContent = Schema.TaggedStruct(\"context_compaction\", {\n\titemId: AgentItemId,\n\tproviderId: ProviderId,\n\tstartedAt: Schema.Number,\n\tdurationMs: Schema.Number,\n\tbeforeTokens: Schema.NullOr(Schema.Number),\n\tafterTokens: Schema.NullOr(Schema.Number),\n\tstatus: Schema.Literals([\"in_progress\", \"completed\"]).pipe(\n\t\tSchema.withDecodingDefaultType(Effect.succeed(\"completed\" as const)),\n\t),\n});\n\nconst UsageLimitContent = Schema.TaggedStruct(\"usage_limit\", {\n\tproviderId: ProviderId,\n\tlabel: Schema.String,\n\tusedPercent: Schema.NullOr(Schema.Number),\n\t// ISO-8601 string — see `UsageLimitEvent` in agent.ts for why this isn't\n\t// a `Date` schema (constructor validates against the decoded `Date`).\n\tresetsAt: Schema.NullOr(Schema.String),\n\twindowMinutes: Schema.NullOr(Schema.Number),\n});\n\n/**\n * Persisted form of a `UserQuestion` event. `itemId` is the SDK's\n * `tool_use.id` for the AskUserQuestion call; the paired\n * `user_question_answer` row uses the same `itemId`.\n */\nconst UserQuestionContent = Schema.TaggedStruct(\"user_question\", {\n\titemId: AgentItemId,\n\tquestions: Schema.Array(UserQuestion),\n\tparentItemId: Schema.optional(AgentItemId),\n});\n\n/**\n * One answer per question. `questionIndex` indexes into the original\n * `questions` array. `selected` lists picked option indices (empty when the\n * user typed free-text); `other` is the free-text \"Other\" entry. Either\n * field may be empty, but never both.\n */\nconst UserQuestionAnswerContent = Schema.TaggedStruct(\"user_question_answer\", {\n\titemId: AgentItemId,\n\tanswers: Schema.Array(\n\t\tSchema.Struct({\n\t\t\tquestionIndex: Schema.Number,\n\t\t\tselected: Schema.Array(Schema.Number),\n\t\t\tother: Schema.optional(Schema.String),\n\t\t}),\n\t),\n\tparentItemId: Schema.optional(AgentItemId),\n});\n\n/**\n * Tagged-union of all renderable message payloads. Persisted as the JSON blob\n * in `messages.content_json`; the `_tag` mirrors the `messages.kind` column.\n * Keep the shape additive — new tags become new rendered variants in the\n * renderer without touching existing rows.\n */\nexport const MessageContent = Schema.Union([\n\tUserContent,\n\tUserRichContent,\n\tAssistantContent,\n\tThinkingContent,\n\tToolUseContent,\n\tToolResultContent,\n\tErrorContent,\n\tInterruptedContent,\n\tSubagentSummaryContent,\n\tSubagentProgressContent,\n\tUsageContent,\n\tContextUsageContent,\n\tContextCompactionContent,\n\tUsageLimitContent,\n\tUserQuestionContent,\n\tUserQuestionAnswerContent,\n]);\nexport type UserQuestionAnswer =\n\t(typeof UserQuestionAnswerContent.Type)[\"answers\"][number];\nexport type MessageContent = typeof MessageContent.Type;\n\nexport class Message extends Schema.Class<Message>(\"Message\")({\n\tid: MessageId,\n\tsessionId: SessionId,\n\trole: MessageRole,\n\tcontent: MessageContent,\n\tcreatedAt: Schema.DateFromString,\n}) {}\n\n/**\n * A `Message` tagged with its global monotonic `sequence` from the event log.\n * Clients record the highest `sequence` they have seen per session and pass it\n * back as `sinceSequence` on reconnect to resume gap-free (no full replay, no\n * in-memory dedup Set). This is what `messages.stream` emits.\n */\nexport class MessageEnvelope extends Schema.Class<MessageEnvelope>(\n\t\"MessageEnvelope\",\n)({\n\tsequence: Schema.Number,\n\tmessage: Message,\n}) {}\n\nexport class QueuedMessage extends Schema.Class<QueuedMessage>(\"QueuedMessage\")(\n\t{\n\t\tid: Schema.String,\n\t\tsessionId: SessionId,\n\t\tinput: ComposerInput,\n\t\tposition: Schema.Number,\n\t\tcreatedAt: Schema.DateFromString,\n\t\tupdatedAt: Schema.DateFromString,\n\t\t/** Held items are durable and visible but cannot be claimed yet. */\n\t\tready: Schema.Boolean.pipe(\n\t\t\tSchema.withConstructorDefault(Effect.succeed(true)),\n\t\t\tSchema.withDecodingDefaultType(Effect.succeed(true)),\n\t\t),\n\t},\n) {}\n\nexport class QueuedMessageNotFoundError extends Schema.TaggedErrorClass<QueuedMessageNotFoundError>()(\n\t\"QueuedMessageNotFoundError\",\n\t{ sessionId: SessionId, queueId: Schema.String },\n) {}\n\n/** Queue bounds keep the canonical reconnect snapshot below its wire budget. */\nexport const MAX_SESSION_QUEUE_ITEMS = 100;\nexport const MAX_SESSION_QUEUE_INPUT_BYTES = 128 * 1024;\nexport const MAX_SESSION_QUEUE_TOTAL_BYTES = 384 * 1024;\n\nexport class QueuedMessageCapacityError extends Schema.TaggedErrorClass<QueuedMessageCapacityError>()(\n\t\"QueuedMessageCapacityError\",\n\t{\n\t\tsessionId: SessionId,\n\t\treason: Schema.Literals([\n\t\t\t\"too-many-items\",\n\t\t\t\"item-too-large\",\n\t\t\t\"queue-too-large\",\n\t\t]),\n\t\tlimit: Schema.Number,\n\t\tactual: Schema.Number,\n\t},\n) {}\n\nexport class QueueState extends Schema.Class<QueueState>(\"QueueState\")({\n\titems: Schema.Array(QueuedMessage),\n\tpaused: Schema.Boolean,\n}) {}\n\nexport const SessionTimelineTurnPhase = Schema.Literals([\n\t\"requested\",\n\t\"starting\",\n\t\"running\",\n\t\"interrupt-requested\",\n\t\"interrupt-acknowledged\",\n]);\nexport type SessionTimelineTurnPhase = typeof SessionTimelineTurnPhase.Type;\n\nexport const SessionTimelineTurn = Schema.Struct({\n\tturnId: AgentTurnId,\n\tphase: SessionTimelineTurnPhase,\n});\nexport type SessionTimelineTurn = typeof SessionTimelineTurn.Type;\n\nexport class SessionTimelineProjection extends Schema.Class<SessionTimelineProjection>(\n\t\"SessionTimelineProjection\",\n)({\n\tmessages: Schema.Array(Message),\n\t/** Sequence immediately before the oldest materialized message, if any. */\n\tolderMessageSequence: Schema.optional(Schema.NullOr(Schema.Number)),\n\tstatus: SessionStatus,\n\tcurrentTurn: Schema.NullOr(SessionTimelineTurn),\n\tqueue: QueueState,\n\tpermissionMode: PermissionMode,\n\truntimeMode: RuntimeMode,\n}) {}\n\nexport const SessionTimelineEvent = Schema.Union([\n\tSchema.TaggedStruct(\"Noop\", {}),\n\tSchema.TaggedStruct(\"MessagePersisted\", { message: Message }),\n\tSchema.TaggedStruct(\"StatusSet\", { status: SessionStatus }),\n\tSchema.TaggedStruct(\"TurnStarted\", {\n\t\tturnId: AgentTurnId,\n\t\tphase: SessionTimelineTurnPhase,\n\t}),\n\tSchema.TaggedStruct(\"TurnPhaseSet\", {\n\t\tturnId: AgentTurnId,\n\t\tphase: SessionTimelineTurnPhase,\n\t}),\n\tSchema.TaggedStruct(\"TurnSettled\", {\n\t\tturnId: AgentTurnId,\n\t\toutcome: Schema.Literals([\"completed\", \"interrupted\", \"error\"]),\n\t}),\n\tSchema.TaggedStruct(\"PermissionModeSet\", { permissionMode: PermissionMode }),\n\tSchema.TaggedStruct(\"RuntimeModeSet\", { runtimeMode: RuntimeMode }),\n\tSchema.TaggedStruct(\"QueuePausedSet\", { paused: Schema.Boolean }),\n\tSchema.TaggedStruct(\"QueueEnqueued\", { item: QueuedMessage }),\n\tSchema.TaggedStruct(\"QueueUpdated\", {\n\t\tqueueId: Schema.String,\n\t\tinput: ComposerInput,\n\t\tupdatedAt: Schema.DateFromString,\n\t\tready: Schema.Boolean,\n\t}),\n\tSchema.TaggedStruct(\"QueueRemoved\", { queueId: Schema.String }),\n\tSchema.TaggedStruct(\"QueueReordered\", {\n\t\tqueueIds: Schema.Array(Schema.String),\n\t}),\n]);\nexport type SessionTimelineEvent = typeof SessionTimelineEvent.Type;\n\n/** Durable cursor for one database epoch and one session stream. */\nexport const SessionStreamCursor = Schema.Struct({\n\tepoch: Schema.String,\n\tversion: Schema.Number,\n});\nexport type SessionStreamCursor = typeof SessionStreamCursor.Type;\n\nexport const SessionTimelineFrame = Schema.Union([\n\tSchema.Struct({\n\t\tkind: Schema.Literal(\"snapshot\"),\n\t\tsessionId: SessionId,\n\t\tthroughVersion: Schema.Number,\n\t\tprojection: SessionTimelineProjection,\n\t\t/** Present on new runtimes; omitted by older peers during protocol rollout. */\n\t\tcursor: Schema.optional(SessionStreamCursor),\n\t\t/** Sequence immediately before the oldest included message, if any. */\n\t\tolderMessageSequence: Schema.optional(Schema.NullOr(Schema.Number)),\n\t}),\n\tSchema.Struct({\n\t\tkind: Schema.Literal(\"event\"),\n\t\tsessionId: SessionId,\n\t\tstreamVersion: Schema.Number,\n\t\teventId: Schema.String,\n\t\tevent: SessionTimelineEvent,\n\t\tcursor: Schema.optional(SessionStreamCursor),\n\t}),\n\tSchema.Struct({\n\t\tkind: Schema.Literal(\"synchronized\"),\n\t\tsessionId: SessionId,\n\t\tthroughVersion: Schema.Number,\n\t\tcursor: Schema.optional(SessionStreamCursor),\n\t}),\n\tSchema.Struct({\n\t\tkind: Schema.Literal(\"reset-required\"),\n\t\tsessionId: SessionId,\n\t\tthroughVersion: Schema.Number,\n\t\tcursor: SessionStreamCursor,\n\t\treason: Schema.Literals([\"restored\", \"compacted\", \"cursor-invalid\"]),\n\t}),\n]);\nexport type SessionTimelineFrame = typeof SessionTimelineFrame.Type;\n\nexport class SessionNotFoundError extends Schema.TaggedErrorClass<SessionNotFoundError>()(\n\t\"SessionNotFoundError\",\n\t{ sessionId: SessionId },\n) {}\n\nexport class SessionStartError extends Schema.TaggedErrorClass<SessionStartError>()(\n\t\"SessionStartError\",\n\t{ providerId: ProviderId, reason: Schema.String },\n) {}\n\nexport class GoalUnsupportedError extends Schema.TaggedErrorClass<GoalUnsupportedError>()(\n\t\"GoalUnsupportedError\",\n\t{ providerId: ProviderId },\n) {}\n\nexport const ThreadGoalStatus = Schema.Literals([\n\t\"active\",\n\t\"paused\",\n\t\"budgetLimited\",\n\t\"usageLimited\",\n\t\"blocked\",\n\t\"complete\",\n]);\nexport type ThreadGoalStatus = typeof ThreadGoalStatus.Type;\n\nexport class ThreadGoal extends Schema.Class<ThreadGoal>(\"ThreadGoal\")({\n\tthreadId: Schema.String,\n\tobjective: Schema.String,\n\tstatus: ThreadGoalStatus,\n\ttokenBudget: Schema.NullOr(Schema.Number),\n\ttokensUsed: Schema.Number,\n\ttimeUsedSeconds: Schema.Number,\n\tcreatedAt: Schema.Number,\n\tupdatedAt: Schema.Number,\n}) {}\n\nexport const ThreadGoalSetInput = Schema.Struct({\n\tobjective: Schema.optional(Schema.String),\n\tstatus: Schema.optional(ThreadGoalStatus),\n\ttokenBudget: Schema.optional(Schema.NullOr(Schema.Number)),\n});\nexport type ThreadGoalSetInput = typeof ThreadGoalSetInput.Type;\n\n/**\n * Raised by `session.setWorktree` when the session already has at least one\n * recorded user message. cwd cannot be changed mid-conversation — the\n * renderer collapses the picker to a read-only chip in this case.\n */\nexport class SessionAlreadyStartedError extends Schema.TaggedErrorClass<SessionAlreadyStartedError>()(\n\t\"SessionAlreadyStartedError\",\n\t{ sessionId: SessionId },\n) {}\n\n// ---------------------------------------------------------------------------\n// Session RPCs\n// ---------------------------------------------------------------------------\n\nexport const SessionListRpc = Rpc.make(\"session.list\", {\n\tpayload: Schema.Struct({\n\t\tprojectId: FolderId,\n\t\tincludeArchived: Schema.optional(Schema.Boolean),\n\t}),\n\tsuccess: Schema.Array(Session),\n});\n\nexport const SessionGetRpc = Rpc.make(\"session.get\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Session,\n\terror: SessionNotFoundError,\n});\n\nexport const SessionSummaryChange = Schema.Union([\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"snapshot\"),\n\t\tcursor: Schema.Number,\n\t\tsessions: Schema.Array(Session),\n\t}),\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"change\"),\n\t\tsequence: Schema.Number,\n\t\tsession: Session,\n\t}),\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"remove\"),\n\t\tsequence: Schema.Number,\n\t\tsessionId: SessionId,\n\t}),\n]);\nexport type SessionSummaryChange = typeof SessionSummaryChange.Type;\n\n/** One authoritative snapshot followed by cursor-ordered session summary changes. */\nexport const SessionStreamChangesRpc = Rpc.make(\"session.streamChanges\", {\n\tpayload: Schema.Struct({ projectId: FolderId }),\n\tsuccess: SessionSummaryChange,\n\tstream: true,\n});\n\nexport const SessionCreateRpc = Rpc.make(\"session.create\", {\n\tpayload: Schema.Struct({\n\t\t/** Stable identity minted by optimistic clients before the RPC starts. */\n\t\tsessionId: Schema.optional(SessionId),\n\t\t/**\n\t\t * The chat (sidebar entry) the new session is created in. Worktree\n\t\t * and project are inherited from the chat row — clients never pick\n\t\t * them at session-create time anymore.\n\t\t */\n\t\tchatId: ChatId,\n\t\tproviderId: ProviderId,\n\t\tmodel: Schema.String,\n\t\ttitle: Schema.optional(Schema.String),\n\t\tinitialPrompt: Schema.optional(Schema.String),\n\t\truntimeMode: Schema.optional(RuntimeMode),\n\t\t// Sub-agents the new session may delegate to. The renderer reads\n\t\t// these from the user's preset settings and injects them at create\n\t\t// time so the wire stays the single source of truth.\n\t\tagents: Schema.optional(Schema.Record(Schema.String, AgentDefinition)),\n\t\tenableSubagents: Schema.optional(Schema.Boolean),\n\t\t/**\n\t\t * Start the session in plan mode. The agent will explore read-only\n\t\t * and end its first turn by calling `ExitPlanMode`. Defaults to\n\t\t * `'default'` (immediate execution).\n\t\t */\n\t\tpermissionMode: Schema.optional(PermissionMode),\n\t\tmodelOptions: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n\t\t/**\n\t\t * Persist the deferred-tools toggle for this session. Reserved for\n\t\t * 0.04 code-index MCP servers; no-op today.\n\t\t */\n\t\ttoolSearch: Schema.optional(Schema.Boolean),\n\t}),\n\tsuccess: Session,\n\terror: SessionStartError,\n});\n\n/**\n * Switch the worktree a session runs in. Allowed only before the first user\n * message is recorded — `SessionAlreadyStartedError` otherwise. `null` means\n * \"run in the main checkout.\"\n */\nexport const SessionSetWorktreeRpc = Rpc.make(\"session.setWorktree\", {\n\tpayload: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\tworktreeId: Schema.NullOr(WorktreeId),\n\t}),\n\tsuccess: Schema.Void,\n\terror: Schema.Union([SessionNotFoundError, SessionAlreadyStartedError]),\n});\n\nexport const SessionRenameRpc = Rpc.make(\"session.rename\", {\n\tpayload: Schema.Struct({\n\t\tcommandId: CommandId,\n\t\tsessionId: SessionId,\n\t\ttitle: Schema.String,\n\t}),\n\tsuccess: Session,\n\terror: SessionNotFoundError,\n});\n\nexport const SessionSetModelRpc = Rpc.make(\"session.setModel\", {\n\tpayload: Schema.Struct({ sessionId: SessionId, model: Schema.String }),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\n/**\n * Switch a session's provider (and the model it runs under). Allowed only\n * before the first user message is recorded — the new CLI cannot read the\n * prior CLI's transcript, so mid-chat swaps would silently drop context.\n * Returns `SessionAlreadyStartedError` once the session has started.\n */\nexport const SessionSetProviderRpc = Rpc.make(\"session.setProvider\", {\n\tpayload: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\tproviderId: ProviderId,\n\t\tmodel: Schema.String,\n\t}),\n\tsuccess: Schema.Void,\n\terror: Schema.Union([SessionNotFoundError, SessionAlreadyStartedError]),\n});\n\nexport const SessionArchiveRpc = Rpc.make(\"session.archive\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\nexport const SessionUnarchiveRpc = Rpc.make(\"session.unarchive\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\nexport const SessionDeleteRpc = Rpc.make(\"session.delete\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\n/**\n * Where a forked conversation lands. `tab` creates a new session inside the\n * source chat (sharing its worktree); `chat` creates a fresh sidebar chat\n * (with its own worktree) for isolated parallel exploration.\n */\nexport const ForkDestination = Schema.Literals([\"tab\", \"chat\"]);\nexport type ForkDestination = typeof ForkDestination.Type;\n\n/**\n * How the fork inherited its context. `resume` means the provider forked the\n * live transcript so the new session has real agent memory (Claude\n * `forkSession` / Codex `thread/fork`); `copy` means the visible transcript\n * was replayed into the new session (no KV memory) because the fork point was\n * not the conversation tail, or the provider lacks native fork support.\n */\nexport const ForkMode = Schema.Literals([\"resume\", \"copy\"]);\nexport type ForkMode = typeof ForkMode.Type;\n\n/**\n * Serialise a session's transcript to Markdown, optionally truncated at\n * `uptoMessageId` (inclusive). Backs the \"Attach transcript\" handoff button\n * and the copy-mode fork context file.\n */\nexport const SessionExportTranscriptRpc = Rpc.make(\"session.exportTranscript\", {\n\tpayload: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\tuptoMessageId: Schema.optional(MessageId),\n\t}),\n\tsuccess: Schema.Struct({ markdown: Schema.String }),\n\terror: SessionNotFoundError,\n});\n\n/**\n * The most recent `ExitPlanMode` plan text for a session, or `null` if it has\n * never proposed a plan. Backs the plan context chip between sessions in one\n * chat — cheap enough to probe candidate sources without hydrating their full\n * message log.\n */\nexport const SessionLatestPlanRpc = Rpc.make(\"session.latestPlan\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Schema.Struct({ plan: Schema.NullOr(Schema.String) }),\n\terror: SessionNotFoundError,\n});\n\n// ---------------------------------------------------------------------------\n// Chats (sidebar containers; each chat hosts ≥1 session as tabs)\n// ---------------------------------------------------------------------------\n\n/**\n * A chat is the sidebar-level container. It owns a workspace (project +\n * optional worktree) and a title; the actual conversations live in its\n * child sessions, every one of which carries the chat's `chatId`. The\n * chat row itself has no provider state and no messages — it's metadata.\n *\n * `activeSessionId` is the last tab the user was on, persisted server-side\n * so a future tab restore works across reloads / devices.\n */\nexport class Chat extends Schema.Class<Chat>(\"Chat\")({\n\tid: ChatId,\n\tprojectId: FolderId,\n\tworktreeId: Schema.NullOr(WorktreeId),\n\ttitle: Schema.String,\n\ttitleProvenance: NameProvenanceField,\n\tactiveSessionId: Schema.NullOr(SessionId),\n\t/**\n\t * Lineage. When an agent spawns this chat via the orchestration\n\t * control-plane tools, this records the session that spawned it so the\n\t * sidebar can nest agent-spawned chats under their parent and badge them.\n\t * `null` for user-created chats.\n\t */\n\toriginSessionId: Schema.NullOr(SessionId),\n\tarchivedAt: Schema.NullOr(Schema.DateFromString),\n\t/**\n\t * Read/unread tracking. `lastMessageAt` advances every time a message is\n\t * persisted in any of the chat's sessions; `lastReadAt` advances when the\n\t * user views the chat. A chat is unread when `lastMessageAt > lastReadAt`.\n\t * `lastMessageAt` is null until the first message; `lastReadAt` is seeded to\n\t * the creation time so a freshly created chat starts read.\n\t */\n\tlastMessageAt: Schema.NullOr(Schema.DateFromString),\n\tlastReadAt: Schema.NullOr(Schema.DateFromString),\n\tcreatedAt: Schema.DateFromString,\n\tupdatedAt: Schema.DateFromString,\n}) {}\n\nexport class ChatNotFoundError extends Schema.TaggedErrorClass<ChatNotFoundError>()(\n\t\"ChatNotFoundError\",\n\t{ chatId: ChatId },\n) {}\n\nexport class ChatNotArchivedError extends Schema.TaggedErrorClass<ChatNotArchivedError>()(\n\t\"ChatNotArchivedError\",\n\t{ chatId: ChatId },\n) {}\n\n/**\n * Raised by `chat.setWorktree` when any session in the chat already has a\n * recorded user message. Worktrees are immutable past the first message —\n * mirrors the per-session `SessionAlreadyStartedError` semantics.\n */\nexport class ChatAlreadyStartedError extends Schema.TaggedErrorClass<ChatAlreadyStartedError>()(\n\t\"ChatAlreadyStartedError\",\n\t{ chatId: ChatId },\n) {}\n\nexport class ChatArchiveScriptError extends Schema.TaggedErrorClass<ChatArchiveScriptError>()(\n\t\"ChatArchiveScriptError\",\n\t{\n\t\tchatId: ChatId,\n\t\texitCode: Schema.NullOr(Schema.Number),\n\t\tsignal: Schema.NullOr(Schema.String),\n\t\toutput: Schema.String,\n\t},\n) {}\n\nexport class ChatArchiveTimeoutError extends Schema.TaggedErrorClass<ChatArchiveTimeoutError>()(\n\t\"ChatArchiveTimeoutError\",\n\t{ chatId: ChatId, timeoutMs: Schema.Number, output: Schema.String },\n) {}\n\nexport class ChatArchiveWorktreeError extends Schema.TaggedErrorClass<ChatArchiveWorktreeError>()(\n\t\"ChatArchiveWorktreeError\",\n\t{ chatId: ChatId, reason: Schema.String },\n) {}\n\nexport const ChatArchiveJobStatus = Schema.Literals([\n\t\"queued\",\n\t\"running\",\n\t\"completed\",\n\t\"failed\",\n\t\"forced\",\n\t\"cancelled\",\n]);\nexport type ChatArchiveJobStatus = typeof ChatArchiveJobStatus.Type;\n\nexport const ChatArchiveJob = Schema.Struct({\n\tchatId: ChatId,\n\tstatus: ChatArchiveJobStatus,\n\tphase: Schema.String,\n\terror: Schema.NullOr(Schema.String),\n\tcleanupOutput: Schema.String,\n\tupdatedAt: Schema.DateFromString,\n});\nexport type ChatArchiveJob = typeof ChatArchiveJob.Type;\n\nexport const ChatDirectoryStatus = Schema.Union([\n\tSchema.TaggedStruct(\"available\", {}),\n\tSchema.TaggedStruct(\"restorable\", {}),\n\tSchema.TaggedStruct(\"unavailable\", {\n\t\treason: Schema.Literals([\n\t\t\t\"project-missing\",\n\t\t\t\"worktree-missing\",\n\t\t\t\"restore-unavailable\",\n\t\t]),\n\t}),\n]);\nexport type ChatDirectoryStatus = typeof ChatDirectoryStatus.Type;\n\nconst ChatArchiveErrors = Schema.Union([\n\tChatNotFoundError,\n\tChatArchiveScriptError,\n\tChatArchiveTimeoutError,\n\tChatArchiveWorktreeError,\n]);\n\nconst ArchiveCleanupSummary = Schema.Struct({\n\tran: Schema.Boolean,\n\toutput: Schema.String,\n});\n\nconst WorktreeCheckpointSummary = Schema.Struct({\n\tarchiveCommit: Schema.String,\n\tcheckpointCreated: Schema.Boolean,\n\tarchiveRef: Schema.NullOr(Schema.String),\n\tbranch: Schema.String,\n});\n\nexport const ChatArchiveResult = Schema.Struct({\n\tchat: Chat,\n\tcleanup: Schema.NullOr(ArchiveCleanupSummary),\n\tcheckpoint: Schema.NullOr(WorktreeCheckpointSummary),\n\tjob: Schema.NullOr(ChatArchiveJob),\n});\nexport type ChatArchiveResult = typeof ChatArchiveResult.Type;\n\nexport const ChatUnarchiveResult = Schema.Struct({\n\tchat: Chat,\n\tsessions: Schema.Array(Session),\n\tworktree: Schema.NullOr(Worktree),\n\tdirectoryStatus: ChatDirectoryStatus,\n});\nexport type ChatUnarchiveResult = typeof ChatUnarchiveResult.Type;\n\nexport const ChatArchivePreview = Schema.Struct({\n\tchat: Chat,\n\tsessions: Schema.Array(Session),\n});\nexport type ChatArchivePreview = typeof ChatArchivePreview.Type;\n\nexport const ChatListRpc = Rpc.make(\"chat.list\", {\n\tpayload: Schema.Struct({\n\t\tprojectId: FolderId,\n\t\tincludeArchived: Schema.optional(Schema.Boolean),\n\t}),\n\tsuccess: Schema.Array(Chat),\n});\n\nexport const ChatGetRpc = Rpc.make(\"chat.get\", {\n\tpayload: Schema.Struct({ chatId: ChatId }),\n\tsuccess: Chat,\n\terror: ChatNotFoundError,\n});\n\nexport const ChatArchivePreviewRpc = Rpc.make(\"chat.archivePreview\", {\n\tpayload: Schema.Struct({ chatId: ChatId }),\n\tsuccess: ChatArchivePreview,\n\terror: Schema.Union([ChatNotFoundError, ChatNotArchivedError]),\n});\n\n/**\n * Create a new chat AND its initial session in one transaction. Returns\n * both so the renderer can land on the new session immediately without a\n * follow-up round-trip. The chat's `activeSessionId` is set to the new\n * session id.\n *\n * When `initialPrompt` is supplied, `initialMessage` is the persisted user\n * message — the renderer seeds it into its messages store so the chat view\n * never flashes the empty state while the live stream is connecting.\n */\nexport const ChatWorkspacePolicy = Schema.Union([\n\tSchema.TaggedStruct(\"fresh\", {}),\n\tSchema.TaggedStruct(\"existing\", { worktreeId: WorktreeId }),\n\tSchema.TaggedStruct(\"main\", {}),\n]);\nexport type ChatWorkspacePolicy = typeof ChatWorkspacePolicy.Type;\n\nexport const ChatCreationOperationStatus = Schema.Literals([\n\t\"pending\",\n\t\"creating_workspace\",\n\t\"creating_chat\",\n\t\"succeeded\",\n\t\"failed\",\n]);\nexport type ChatCreationOperationStatus =\n\ttypeof ChatCreationOperationStatus.Type;\n\nexport const ChatCreationOperation = Schema.Struct({\n\toperationId: Schema.String,\n\tchatId: ChatId,\n\tinitialSessionId: SessionId,\n\tprojectId: FolderId,\n\tproviderId: ProviderId,\n\tmodel: Schema.String,\n\ttitle: Schema.NullOr(Schema.String),\n\truntimeMode: RuntimeMode,\n\tpermissionMode: PermissionMode,\n\ttoolSearch: Schema.Boolean,\n\tprompt: Schema.NullOr(Schema.String),\n\tstartupInput: Schema.NullOr(ComposerInput),\n\tstartupQueueId: Schema.NullOr(Schema.String),\n\tstartupReady: Schema.Boolean,\n\tworkspacePolicy: ChatWorkspacePolicy,\n\tworktreeId: Schema.NullOr(WorktreeId),\n\tstatus: ChatCreationOperationStatus,\n\terror: Schema.NullOr(Schema.String),\n\tcreatedAt: Schema.DateFromString,\n\tupdatedAt: Schema.DateFromString,\n});\nexport type ChatCreationOperation = typeof ChatCreationOperation.Type;\n\nexport const ChatCreationListRpc = Rpc.make(\"chat.creation.list\", {\n\tpayload: Schema.Struct({ projectId: FolderId }),\n\tsuccess: Schema.Array(ChatCreationOperation),\n});\n\nexport const ChatCreationSummaryChange = Schema.Union([\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"snapshot\"),\n\t\toperations: Schema.Array(ChatCreationOperation),\n\t}),\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"change\"),\n\t\toperation: ChatCreationOperation,\n\t}),\n]);\nexport type ChatCreationSummaryChange = typeof ChatCreationSummaryChange.Type;\n\nexport const ChatCreationStreamRpc = Rpc.make(\"chat.creation.stream\", {\n\tpayload: Schema.Struct({ projectId: FolderId }),\n\tsuccess: ChatCreationSummaryChange,\n\tstream: true,\n});\n\nexport const ChatCreationDiscardRpc = Rpc.make(\"chat.creation.discard\", {\n\tpayload: Schema.Struct({ operationId: Schema.String }),\n\tsuccess: Schema.Struct({ discarded: Schema.Boolean }),\n});\n\nexport const ChatCreateRpc = Rpc.make(\"chat.create\", {\n\tpayload: Schema.Struct({\n\t\t/** Stable identities minted before optimistic entities are inserted. */\n\t\toperationId: Schema.optional(Schema.String),\n\t\tchatId: Schema.optional(ChatId),\n\t\tinitialSessionId: Schema.optional(SessionId),\n\t\tprojectId: FolderId,\n\t\tproviderId: ProviderId,\n\t\tmodel: Schema.String,\n\t\ttitle: Schema.optional(Schema.String),\n\t\tinitialPrompt: Schema.optional(Schema.String),\n\t\truntimeMode: Schema.optional(RuntimeMode),\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\t/** Server-owned workspace bootstrap. Supersedes `worktreeId` when set. */\n\t\tworkspacePolicy: Schema.optional(ChatWorkspacePolicy),\n\t\tstartupInput: Schema.optional(ComposerInput),\n\t\tstartupQueueId: Schema.optional(Schema.String),\n\t\t/** False while attachment or generated context preparation is pending. */\n\t\tstartupReady: Schema.optional(Schema.Boolean),\n\t\tagents: Schema.optional(Schema.Record(Schema.String, AgentDefinition)),\n\t\tenableSubagents: Schema.optional(Schema.Boolean),\n\t\tpermissionMode: Schema.optional(PermissionMode),\n\t\ttoolSearch: Schema.optional(Schema.Boolean),\n\t\t/**\n\t\t * Lineage — set by orchestration control-plane tools to the spawning\n\t\t * session id. Omitted for user-created chats.\n\t\t */\n\t\toriginSessionId: Schema.optional(SessionId),\n\t\tmodelOptions: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n\t\t/** Return after durable rows exist while provider startup continues. */\n\t\tbackground: Schema.optional(Schema.Boolean),\n\t}),\n\tsuccess: Schema.Struct({\n\t\tchat: Chat,\n\t\tinitialSession: Session,\n\t\tinitialMessage: Schema.NullOr(Message),\n\t}),\n\terror: SessionStartError,\n});\n\nexport const ChatRenameRpc = Rpc.make(\"chat.rename\", {\n\tpayload: Schema.Struct({ chatId: ChatId, title: Schema.String }),\n\tsuccess: Chat,\n\terror: ChatNotFoundError,\n});\n\n/**\n * Branch a conversation from a specific message into a new tab or chat. The\n * server picks `resume` vs `copy` based on the fork point and provider; the\n * new session records `forkedFromSessionId` / `forkedFromMessageId`.\n * `providerId` / `model` default to the source session's; `worktreeId` only\n * applies to `destination: \"chat\"`. (Declared here — below `Chat` — because\n * its success payload references the `Chat` class.)\n */\nexport const SessionForkRpc = Rpc.make(\"session.fork\", {\n\tpayload: Schema.Struct({\n\t\tsourceSessionId: SessionId,\n\t\tfromMessageId: MessageId,\n\t\tdestination: ForkDestination,\n\t\tproviderId: Schema.optional(ProviderId),\n\t\tmodel: Schema.optional(Schema.String),\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\ttitle: Schema.optional(Schema.String),\n\t}),\n\tsuccess: Schema.Struct({\n\t\tchat: Chat,\n\t\tsession: Session,\n\t\tforkMode: ForkMode,\n\t}),\n\terror: Schema.Union([SessionNotFoundError, SessionStartError]),\n});\n\n/**\n * Snapshot-plus-live feed of chat rows for one project. Each subscription\n * first emits the current non-archived chats, then carries live patches. The\n * server subscribes before reading the snapshot, so reconnecting clients cannot\n * miss a chat/session mutation in the handoff between backfill and live events.\n */\nexport const ChatSummaryChange = Schema.Union([\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"snapshot\"),\n\t\tchats: Schema.Array(Chat),\n\t}),\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"change\"),\n\t\tchat: Chat,\n\t}),\n]);\nexport type ChatSummaryChange = typeof ChatSummaryChange.Type;\n\nexport const ChatStreamChangesRpc = Rpc.make(\"chat.streamChanges\", {\n\tpayload: Schema.Struct({ projectId: FolderId }),\n\tsuccess: ChatSummaryChange,\n\tstream: true,\n});\n\n/**\n * Change the chat's worktree. Allowed only when no session in the chat has\n * any user message yet — fails with `ChatAlreadyStartedError` otherwise.\n * Updates `chat.worktreeId` AND mirrors the change onto every member\n * session's `worktreeId` so renderer reads of `session.worktreeId` stay\n * accurate without a second round-trip.\n */\n/**\n * Mark a chat read by stamping `last_read_at` to \"now\". Returns the refreshed\n * chat so the renderer can reconcile its optimistic patch. Idempotent.\n */\nexport const ChatMarkReadRpc = Rpc.make(\"chat.markRead\", {\n\tpayload: Schema.Struct({ chatId: ChatId }),\n\tsuccess: Chat,\n\terror: ChatNotFoundError,\n});\n\nexport const ChatSetWorktreeRpc = Rpc.make(\"chat.setWorktree\", {\n\tpayload: Schema.Struct({\n\t\tchatId: ChatId,\n\t\tworktreeId: Schema.NullOr(WorktreeId),\n\t}),\n\tsuccess: Chat,\n\terror: Schema.Union([ChatNotFoundError, ChatAlreadyStartedError]),\n});\n\n/**\n * Record the user's last-active tab within this chat. Called whenever the\n * tab strip selection changes so a future click on this chat's sidebar\n * row restores the correct tab. No-op if `sessionId` doesn't belong to\n * the chat (defensive against races).\n */\nexport const ChatSetActiveSessionRpc = Rpc.make(\"chat.setActiveSession\", {\n\tpayload: Schema.Struct({ chatId: ChatId, sessionId: SessionId }),\n\tsuccess: Schema.Void,\n\terror: ChatNotFoundError,\n});\n\nexport const ChatArchiveRpc = Rpc.make(\"chat.archive\", {\n\tpayload: Schema.Struct({\n\t\tchatId: ChatId,\n\t\t/** Ignored compatibility field for older clients. */\n\t\tforce: Schema.optional(Schema.Boolean),\n\t}),\n\tsuccess: ChatArchiveResult,\n\terror: ChatArchiveErrors,\n});\n\nexport const ChatArchiveStatusRpc = Rpc.make(\"chat.archiveStatus\", {\n\tpayload: Schema.Struct({ chatId: ChatId }),\n\tsuccess: Schema.NullOr(ChatArchiveJob),\n\terror: ChatNotFoundError,\n});\n\nexport const ChatArchiveJobsRpc = Rpc.make(\"chat.archiveJobs\", {\n\tpayload: Schema.Struct({ projectId: FolderId }),\n\tsuccess: Schema.Array(ChatArchiveJob),\n});\n\nexport const ChatDirectoryStatusRpc = Rpc.make(\"chat.directoryStatus\", {\n\tpayload: Schema.Struct({ chatId: ChatId }),\n\tsuccess: ChatDirectoryStatus,\n\terror: ChatNotFoundError,\n});\n\nexport const ChatUnarchiveRpc = Rpc.make(\"chat.unarchive\", {\n\tpayload: Schema.Struct({ chatId: ChatId }),\n\tsuccess: ChatUnarchiveResult,\n\terror: Schema.Union([ChatNotFoundError, ChatArchiveWorktreeError]),\n});\n\nexport const ChatDeleteRpc = Rpc.make(\"chat.delete\", {\n\tpayload: Schema.Struct({ chatId: ChatId }),\n\tsuccess: Schema.Void,\n\terror: ChatNotFoundError,\n});\n\n// ---------------------------------------------------------------------------\n// Message RPCs\n// ---------------------------------------------------------------------------\n\nexport const MessagesListRpc = Rpc.make(\"messages.list\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Schema.Array(Message),\n\terror: SessionNotFoundError,\n});\n\n/**\n * Send a user turn. The legacy `text` field stays accepted alongside the\n * richer `input` form so the renderer can migrate the composer to\n * `ComposerInput` in a follow-up phase without a wire flag-day. Server\n * prefers `input` when both are present.\n */\nexport const MessagesSendRpc = Rpc.make(\"messages.send\", {\n\tpayload: Schema.Struct({\n\t\tcommandId: CommandId,\n\t\tsessionId: SessionId,\n\t\ttext: Schema.optional(Schema.String),\n\t\tinput: Schema.optional(ComposerInput),\n\t\tasGoal: Schema.optional(Schema.Boolean),\n\t\tmodelOptions: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n\t\t// Optional renderer-minted id for the user message. When present the\n\t\t// server persists the row under this id instead of generating one, so the\n\t\t// renderer can insert the message optimistically and have the live-stream\n\t\t// echo dedupe against it. Omitted by non-interactive callers (queue\n\t\t// flush), which keep server-generated ids.\n\t\tclientMessageId: Schema.optional(MessageId),\n\t}),\n\tsuccess: Schema.Void,\n\terror: Schema.Union([SessionNotFoundError, DirectoryUnavailableError]),\n});\n\n/** Durable outcome of an exact-turn interrupt request. */\nexport const TurnInterruptReceipt = Schema.Union([\n\tSchema.TaggedStruct(\"requested\", {\n\t\tturnId: AgentTurnId,\n\t}),\n\tSchema.TaggedStruct(\"not-active\", {\n\t\treason: Schema.Literals([\"no-active-turn\", \"turn-mismatch\"]),\n\t\texpectedTurnId: Schema.NullOr(AgentTurnId),\n\t\tactualTurnId: Schema.NullOr(AgentTurnId),\n\t}),\n]);\nexport type TurnInterruptReceipt = typeof TurnInterruptReceipt.Type;\n\nexport const MessagesInterruptRpc = Rpc.make(\"messages.interrupt\", {\n\tpayload: Schema.Struct({\n\t\tcommandId: CommandId,\n\t\tsessionId: SessionId,\n\t\t/** Fences retries to the turn visible when the user pressed Stop. */\n\t\texpectedTurnId: Schema.optional(AgentTurnId),\n\t}),\n\tsuccess: TurnInterruptReceipt,\n\terror: SessionNotFoundError,\n});\n\nexport const MessagesQueueListRpc = Rpc.make(\"messages.queue.list\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: QueueState,\n\terror: SessionNotFoundError,\n});\n\nexport const MessagesQueueAddRpc = Rpc.make(\"messages.queue.add\", {\n\tpayload: Schema.Struct({\n\t\tcommandId: CommandId,\n\t\tsessionId: SessionId,\n\t\t/** Stable identity used to make persistence retries idempotent. */\n\t\tqueueId: Schema.optional(Schema.String),\n\t\tinput: ComposerInput,\n\t\t/** Persist visibly now, but do not claim until an update finalizes it. */\n\t\tready: Schema.optional(Schema.Boolean),\n\t\t/** Skip the idle auto-flush when restoring a cancelled composer edit. */\n\t\tflush: Schema.optional(Schema.Boolean),\n\t}),\n\tsuccess: QueuedMessage,\n\terror: Schema.Union([SessionNotFoundError, QueuedMessageCapacityError]),\n});\n\nexport const MessagesQueueUpdateRpc = Rpc.make(\"messages.queue.update\", {\n\tpayload: Schema.Struct({\n\t\tcommandId: CommandId,\n\t\tsessionId: SessionId,\n\t\tqueueId: Schema.String,\n\t\tinput: ComposerInput,\n\t}),\n\tsuccess: QueuedMessage,\n\terror: Schema.Union([\n\t\tSessionNotFoundError,\n\t\tQueuedMessageNotFoundError,\n\t\tQueuedMessageCapacityError,\n\t]),\n});\n\nexport const MessagesQueueDeleteRpc = Rpc.make(\"messages.queue.delete\", {\n\tpayload: Schema.Struct({\n\t\tcommandId: CommandId,\n\t\tsessionId: SessionId,\n\t\tqueueId: Schema.String,\n\t}),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\n/**\n * Run one durable queued item next. The server owns the idle-vs-running\n * decision, active-turn resolution, interruption, and successor identity.\n */\nexport const MessagesQueueRunNextRpc = Rpc.make(\"messages.queue.runNext\", {\n\tpayload: Schema.Struct({\n\t\tcommandId: CommandId,\n\t\tsessionId: SessionId,\n\t\tqueueId: Schema.String,\n\t}),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\nexport const MessagesQueueReorderRpc = Rpc.make(\"messages.queue.reorder\", {\n\tpayload: Schema.Struct({\n\t\tcommandId: CommandId,\n\t\tsessionId: SessionId,\n\t\tqueueIds: Schema.Array(Schema.String),\n\t}),\n\tsuccess: Schema.Array(QueuedMessage),\n\terror: SessionNotFoundError,\n});\n\nexport const MessagesQueueFlushRpc = Rpc.make(\"messages.queue.flush\", {\n\tpayload: Schema.Struct({ commandId: CommandId, sessionId: SessionId }),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\nexport const MessagesQueueResumeRpc = Rpc.make(\"messages.queue.resume\", {\n\tpayload: Schema.Struct({ commandId: CommandId, sessionId: SessionId }),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\n/**\n * Re-open a stopped or failed session against the provider. A persisted\n * cursor resumes provider context when supported; without one, the provider\n * starts a fresh process attached to the same durable application session.\n */\nexport const SessionResumeRpc = Rpc.make(\"session.resume\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Session,\n\terror: Schema.Union([SessionNotFoundError, SessionStartError]),\n});\n\n/**\n * Set the per-session permission posture. Takes effect on the next tool call —\n * if a turn is in flight when the toggle changes, the running canUseTool\n * callbacks observe the new mode without restarting the SDK.\n */\nexport const SessionSetRuntimeModeRpc = Rpc.make(\"session.setRuntimeMode\", {\n\tpayload: Schema.Struct({\n\t\tcommandId: CommandId,\n\t\tsessionId: SessionId,\n\t\truntimeMode: RuntimeMode,\n\t}),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\n/**\n * Switch the SDK lifecycle mode (plan / default / acceptEdits) on a live\n * session. Calls `Query.setPermissionMode` under the hood; the driver\n * emits a `PermissionModeChanged` event so the renderer chip stays in\n * sync without polling.\n */\nexport const SessionSetPermissionModeRpc = Rpc.make(\n\t\"session.setPermissionMode\",\n\t{\n\t\tpayload: Schema.Struct({\n\t\t\tcommandId: CommandId,\n\t\t\tsessionId: SessionId,\n\t\t\tmode: PermissionMode,\n\t\t}),\n\t\tsuccess: Schema.Void,\n\t\terror: SessionNotFoundError,\n\t},\n);\n\n/**\n * Resolve the pending `AskUserQuestion` tool call identified by `itemId`.\n * The driver returns the answers as the tool result, the SDK turn unwinds,\n * and the renderer paints a paired `user_question_answer` row.\n */\nexport const SessionAnswerQuestionRpc = Rpc.make(\"session.answerQuestion\", {\n\tpayload: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\titemId: Schema.String,\n\t\tanswers: Schema.Array(\n\t\t\tSchema.Struct({\n\t\t\t\tquestionIndex: Schema.Number,\n\t\t\t\tselected: Schema.Array(Schema.Number),\n\t\t\t\tother: Schema.optional(Schema.String),\n\t\t\t}),\n\t\t),\n\t}),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\nexport const SessionPlanRespondRpc = Rpc.make(\"session.plan.respond\", {\n\tpayload: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\ttoolCallId: Schema.String,\n\t\toutcome: PlanApprovalOutcome,\n\t\tfeedback: Schema.optional(Schema.String),\n\t}),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\nexport const SessionMcpUpdateRpc = Rpc.make(\"session.mcp.update\", {\n\tpayload: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\tservers: Schema.Array(Schema.Unknown),\n\t}),\n\tsuccess: Schema.Void,\n\terror: SessionNotFoundError,\n});\n\n/** Ordered durable session-domain feed with cursor-based replay. */\nexport const SessionEventsRpc = Rpc.make(\"session.events\", {\n\tpayload: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\tafterVersion: Schema.optional(Schema.Number),\n\t\tstreamEpoch: Schema.optional(Schema.String),\n\t\thasProjection: Schema.optional(Schema.Boolean),\n\t}),\n\tsuccess: SessionTimelineFrame,\n\terror: SessionNotFoundError,\n\tstream: true,\n});\n\n/** Lightweight durable cursor used to detect an open-but-stalled event stream. */\nexport const SessionEventsHeadRpc = Rpc.make(\"session.events.head\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Schema.Struct({\n\t\tthroughVersion: Schema.Number,\n\t\tstreamEpoch: Schema.optional(Schema.String),\n\t}),\n\terror: SessionNotFoundError,\n});\n\n/** Older timeline messages, newest page first on the wire then rendered ascending. */\nexport const SessionMessagesPageRpc = Rpc.make(\"session.messages.page\", {\n\tpayload: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\tbeforeSequence: Schema.optional(Schema.Number),\n\t\tlimit: Schema.optional(Schema.Number),\n\t}),\n\tsuccess: Schema.Struct({\n\t\tmessages: Schema.Array(Message),\n\t\tolderMessageSequence: Schema.NullOr(Schema.Number),\n\t}),\n\terror: SessionNotFoundError,\n});\n\nexport const SessionGoalGetRpc = Rpc.make(\"session.goal.get\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Schema.NullOr(ThreadGoal),\n\terror: Schema.Union([SessionNotFoundError, GoalUnsupportedError]),\n});\n\nexport const SessionGoalSetRpc = Rpc.make(\"session.goal.set\", {\n\tpayload: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\tgoal: ThreadGoalSetInput,\n\t}),\n\tsuccess: ThreadGoal,\n\terror: Schema.Union([\n\t\tSessionNotFoundError,\n\t\tSessionStartError,\n\t\tGoalUnsupportedError,\n\t]),\n});\n\nexport const SessionGoalClearRpc = Rpc.make(\"session.goal.clear\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Schema.Void,\n\terror: Schema.Union([SessionNotFoundError, GoalUnsupportedError]),\n});\n\nexport const SessionGoalStreamRpc = Rpc.make(\"session.goal.stream\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\tgoal: Schema.NullOr(ThreadGoal),\n\t}),\n\terror: Schema.Union([SessionNotFoundError, GoalUnsupportedError]),\n\tstream: true,\n});\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { SessionId, SessionNotFoundError } from \"./session.ts\";\n\nexport class AttachmentTooLargeError extends Schema.TaggedErrorClass<AttachmentTooLargeError>()(\n\t\"AttachmentTooLargeError\",\n\t{\n\t\tsessionId: SessionId,\n\t\tsizeBytes: Schema.Number,\n\t\tlimit: Schema.Number,\n\t},\n) {}\n\nexport class AttachmentBadMimeError extends Schema.TaggedErrorClass<AttachmentBadMimeError>()(\n\t\"AttachmentBadMimeError\",\n\t{\n\t\tsessionId: SessionId,\n\t\tmimeType: Schema.String,\n\t},\n) {}\n\n/**\n * Upload an image attachment for a session. Bytes land in the workspace's\n * gitignored `.context/files/` directory; the returned id is what the\n * renderer stores on `ComposerInput.attachments` and renders via\n * `zuse://attachments/<id>`.\n *\n * `rootPath` is an optional fallback workspace root the renderer already\n * knows. The server prefers to resolve the cwd from `sessionId`, but for a\n * brand-new chat whose session row does not exist yet the fallback keeps\n * drop/paste working; when neither resolves, the upload falls back to the\n * legacy userData attachments directory.\n */\nexport const AttachmentUploadRpc = Rpc.make(\"attachments.upload\", {\n\tpayload: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\tbytes: Schema.Uint8ArrayFromBase64,\n\t\tmimeType: Schema.String,\n\t\toriginalName: Schema.String,\n\t\trootPath: Schema.optional(Schema.String),\n\t}),\n\tsuccess: Schema.Struct({\n\t\tid: Schema.String,\n\t\tsizeBytes: Schema.Number,\n\t\tmimeType: Schema.String,\n\t\text: Schema.String,\n\t}),\n\terror: Schema.Union([\n\t\tAttachmentTooLargeError,\n\t\tAttachmentBadMimeError,\n\t\tSessionNotFoundError,\n\t]),\n});\n","","import deploymentProfiles from \"./deployment-profiles.json\" with {\n\ttype: \"json\",\n};\n\n/** Public relay and identity configuration for each hosted deployment. */\nexport const PUBLIC_DEPLOYMENT_PROFILES = deploymentProfiles;\n\nexport const PRODUCTION_RELAY_URL =\n\tPUBLIC_DEPLOYMENT_PROFILES.production.relayUrl;\nexport const STAGING_RELAY_URL = PUBLIC_DEPLOYMENT_PROFILES.staging.relayUrl;\nexport const WORKOS_PUBLIC_CLIENT_ID =\n\tPUBLIC_DEPLOYMENT_PROFILES.production.workosPublicClientId;\nexport const WORKOS_STAGING_PUBLIC_CLIENT_ID =\n\tPUBLIC_DEPLOYMENT_PROFILES.staging.workosPublicClientId;\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nexport {\n\tPRODUCTION_RELAY_URL,\n\tPUBLIC_DEPLOYMENT_PROFILES,\n\tSTAGING_RELAY_URL,\n\tWORKOS_PUBLIC_CLIENT_ID,\n\tWORKOS_STAGING_PUBLIC_CLIENT_ID,\n} from \"./deployment.ts\";\n\n/** Canonical hosted product origin shared by Serve and browser clients. */\nexport const HOSTED_APP_URL = \"https://code.zuse.sh\";\n\n/**\n * WorkOS AuthKit identity — the first user-account primitive in Zuse.\n *\n * The desktop app authenticates the user against WorkOS via a PKCE OAuth flow\n * (public client, no secret) that round-trips through the system browser and a\n * `zuse://auth/callback` deep link. The access/refresh tokens never cross\n * this wire — they live only in the OS keychain on the server side, mirroring\n * the `apiKey:` / `browserCred:` discipline. Only the non-secret profile and an\n * expiry timestamp are renderer-visible.\n *\n * This contract is transport-agnostic on purpose: a future mobile shell or\n * headless WS server reuses these exact schemas (see ADR 0007).\n */\n\n/** Non-secret identity surfaced to the renderer for display. */\nexport class AuthUser extends Schema.Class<AuthUser>(\"AuthUser\")({\n\tid: Schema.String,\n\temail: Schema.String,\n\tfirstName: Schema.NullOr(Schema.String),\n\tlastName: Schema.NullOr(Schema.String),\n\tprofilePictureUrl: Schema.NullOr(Schema.String),\n}) {}\n\n/**\n * A live session. `expiresAt` is the access token's expiry (epoch ms) — the\n * renderer never sees the token itself, but the timestamp lets the UI reason\n * about staleness if it ever wants to. `organizationId` is null for personal\n * (non-org) sign-ins.\n */\nexport class AuthSession extends Schema.Class<AuthSession>(\"AuthSession\")({\n\tuser: AuthUser,\n\torganizationId: Schema.NullOr(Schema.String),\n\texpiresAt: Schema.Number,\n}) {}\n\n/**\n * The complete renderer-visible auth state. A tagged union so the renderer\n * switches on `_tag` rather than null-checking a session. `auth.getSession`\n * returns this once on cold load; `auth.sessionChanges` re-emits it on every\n * sign-in / sign-out / refresh.\n */\nexport const AuthState = Schema.Union([\n\tSchema.TaggedStruct(\"SignedOut\", {}),\n\tSchema.TaggedStruct(\"SignedIn\", { session: AuthSession }),\n]);\nexport type AuthState = typeof AuthState.Type;\n\n/** The OAuth flow failed (config missing, network, token exchange, bad callback). */\nexport class AuthFlowError extends Schema.TaggedErrorClass<AuthFlowError>()(\n\t\"AuthFlowError\",\n\t{ reason: Schema.String },\n) {}\n\n/** The user closed the browser / never completed sign-in before the timeout. */\nexport class AuthCancelledError extends Schema.TaggedErrorClass<AuthCancelledError>()(\n\t\"AuthCancelledError\",\n\t{},\n) {}\n\n// ---------------------------------------------------------------------------\n// RPCs\n// ---------------------------------------------------------------------------\n\n/**\n * Cold-load the current session. Runs a refresh-on-demand if the stored access\n * token is near expiry. Never fails — a missing/invalid session resolves to\n * `SignedOut` so the renderer can always render a definite state.\n */\nexport const AuthGetSessionRpc = Rpc.make(\"auth.getSession\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: AuthState,\n});\n\n/**\n * Begin sign-in. The server opens the system browser to WorkOS and BLOCKS this\n * request until the `zuse://auth/callback` deep link resolves the flow (or\n * a 5-minute timeout fires → `AuthCancelledError`). Resolves to the new\n * `SignedIn` state.\n */\nexport const AuthSignInRpc = Rpc.make(\"auth.signIn\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: AuthState,\n\terror: Schema.Union([AuthFlowError, AuthCancelledError]),\n});\n\n/** Clear the stored session and broadcast `SignedOut`. */\nexport const AuthSignOutRpc = Rpc.make(\"auth.signOut\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: Schema.Void,\n});\n\n/**\n * Live broadcast of auth state. The renderer subscribes once on boot (like\n * `permission.requests`) so a sign-in completed in the blocking `auth.signIn`\n * call, a sign-out, or a background refresh all propagate to every view.\n */\nexport const AuthSessionChangesRpc = Rpc.make(\"auth.sessionChanges\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: AuthState,\n\tstream: true,\n});\n","import { Schema } from \"effect\";\n\n/**\n * How much an agent is allowed to orchestrate other work on its own — spawn\n * git worktrees, open new chats/sessions (\"threads\"), and (later phases)\n * drive loops. The orchestration tools are built in; mutating calls are still\n * routed through the normal permission system.\n *\n * - `off` → legacy persisted value. Treated like\n * `approval-gated` by current runtimes.\n * - `approval-gated` → tools registered; every spawn routes through the\n * normal permission prompt, so the user approves each\n * one. \"Always allow for session/folder\" still\n * persists via the existing permission broker.\n * - `autonomous` → tools registered; spawns may auto-approve, bounded\n * by per-loop budgets + the global kill switch. The\n * unattended auto-approve path is unsafe without the\n * kill switch, which ships with the loop engine, so\n * until then `autonomous` behaves like `approval-gated`.\n */\nexport const AutonomyLevel = Schema.Literals([\n \"off\",\n \"approval-gated\",\n \"autonomous\",\n]);\nexport type AutonomyLevel = typeof AutonomyLevel.Type;\n\nexport const DEFAULT_AUTONOMY_LEVEL: AutonomyLevel = \"approval-gated\";\n\n/**\n * Whether `level` enables the control-plane tools at all. Kept for old callers;\n * current runtimes expose the built-in tools for every managed session.\n */\nexport const autonomyEnablesOrchestration = (_level: AutonomyLevel): boolean =>\n true;\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { AgentSessionId } from \"./ids.ts\";\n\nexport {\n\tBrowserOverlayShape,\n\tBrowserViewportMode,\n} from \"./browser-shared.ts\";\n\nimport { BrowserOverlayShape, BrowserViewportMode } from \"./browser-shared.ts\";\n\nexport const BrowserTarget = Schema.Union([\n\tSchema.TaggedStruct(\"Ref\", { ref: Schema.String }),\n\tSchema.TaggedStruct(\"Role\", {\n\t\trole: Schema.String,\n\t\tname: Schema.optional(Schema.String),\n\t\texact: Schema.optional(Schema.Boolean),\n\t}),\n\tSchema.TaggedStruct(\"Text\", {\n\t\ttext: Schema.String,\n\t\texact: Schema.optional(Schema.Boolean),\n\t}),\n\tSchema.TaggedStruct(\"Css\", { selector: Schema.String }),\n\tSchema.TaggedStruct(\"Point\", { x: Schema.Number, y: Schema.Number }),\n]);\nexport type BrowserTarget = typeof BrowserTarget.Type;\n\nexport const BrowserReadiness = Schema.Literals([\n\t\"immediate\",\n\t\"dom-ready\",\n\t\"load\",\n]);\nexport type BrowserReadiness = typeof BrowserReadiness.Type;\n\n/**\n * In-app agent browser bridge.\n *\n * MCP tools run in the server process; the `<webview>` lives in the renderer.\n * So every agent browser action round-trips server → renderer → server,\n * mirroring `permission.ts`: the server broadcasts a `BrowserCommandRequest`\n * on `browser.commands`, the renderer drives the webview, and posts the\n * outcome back via `browser.respond`, which resolves a server-side Deferred.\n *\n * Every capability is a union member here — a wire change, never a\n * stringly-typed addition. v2 members (FillForm/Network/Dialog + the Wait and\n * Screenshot extensions) ride the same request/respond round-trip as v1.\n */\nexport const BrowserCommand = Schema.Union([\n\t/** Load a URL into the shared in-app webview and wait for it to settle. */\n\tSchema.TaggedStruct(\"Navigate\", {\n\t\turl: Schema.String,\n\t\treadiness: Schema.optional(BrowserReadiness),\n\t\tenvironmentPort: Schema.optional(Schema.Number),\n\t\tenvironmentProtocol: Schema.optional(Schema.Literals([\"http\", \"https\"])),\n\t}),\n\tSchema.TaggedStruct(\"Status\", {}),\n\tSchema.TaggedStruct(\"Resize\", {\n\t\tmode: BrowserViewportMode,\n\t\twidth: Schema.optional(Schema.Number),\n\t\theight: Schema.optional(Schema.Number),\n\t\torientation: Schema.optional(Schema.Literals([\"portrait\", \"landscape\"])),\n\t\tlockAspectRatio: Schema.optional(Schema.Boolean),\n\t}),\n\t/**\n\t * Capture the page. Default is the visible viewport via `capturePage`;\n\t * `fullPage` captures beyond the viewport through CDP\n\t * (`Page.captureScreenshot`) when the debugger is attached.\n\t */\n\tSchema.TaggedStruct(\"Screenshot\", {\n\t\tfullPage: Schema.optional(Schema.Boolean),\n\t}),\n\t/**\n\t * Snapshot the page for targeting. v2: the renderer prefers a pruned\n\t * accessibility tree over CDP (roles/names/states, interactive elements\n\t * carrying `ref=eN` mapped to backendNodeIds renderer-side) and falls back\n\t * to v1's injected DOM walk when CDP isn't attached. Cheaper for the model\n\t * than a screenshot and robust to scroll/DPI.\n\t */\n\tSchema.TaggedStruct(\"Snapshot\", {\n\t\tscreenshot: Schema.optional(Schema.Literals([\"viewport\", \"full-page\"])),\n\t}),\n\t/** Click the element carrying this snapshot `ref`. */\n\tSchema.TaggedStruct(\"Click\", {\n\t\tref: Schema.optional(Schema.String),\n\t\ttarget: Schema.optional(BrowserTarget),\n\t}),\n\t/**\n\t * Type into the element with this `ref`. `submit` presses Enter afterward\n\t * (e.g. to submit a search box / login form).\n\t */\n\tSchema.TaggedStruct(\"Type\", {\n\t\tref: Schema.optional(Schema.String),\n\t\ttarget: Schema.optional(BrowserTarget),\n\t\ttext: Schema.String,\n\t\tsubmit: Schema.optional(Schema.Boolean),\n\t}),\n\t/**\n\t * Settle after navigation/AJAX. Wait a fixed `ms`, poll until a CSS\n\t * `selector` appears, or poll until `text` shows up in the page's visible\n\t * text (selector wins over text; either wins over ms). `timeoutMs` bounds\n\t * the poll — capped renderer-side below the bridge's 30s deadline so a\n\t * hopeless wait fails as a clean tool error, not a bridge timeout.\n\t */\n\tSchema.TaggedStruct(\"Wait\", {\n\t\tms: Schema.optional(Schema.Number),\n\t\tselector: Schema.optional(Schema.String),\n\t\ttext: Schema.optional(Schema.String),\n\t\ttimeoutMs: Schema.optional(Schema.Number),\n\t}),\n\tSchema.TaggedStruct(\"WaitFor\", {\n\t\ttarget: Schema.optional(BrowserTarget),\n\t\tselector: Schema.optional(Schema.String),\n\t\ttext: Schema.optional(Schema.String),\n\t\turlIncludes: Schema.optional(Schema.String),\n\t\tloadingComplete: Schema.optional(Schema.Boolean),\n\t\tms: Schema.optional(Schema.Number),\n\t\ttimeoutMs: Schema.optional(Schema.Number),\n\t}),\n\t/**\n\t * Scroll the page (or a `ref` into view). `direction` moves the viewport;\n\t * `ref` (when given) scrolls that element to center instead.\n\t */\n\tSchema.TaggedStruct(\"Scroll\", {\n\t\tdirection: Schema.optional(\n\t\t\tSchema.Literals([\"up\", \"down\", \"top\", \"bottom\"]),\n\t\t),\n\t\tref: Schema.optional(Schema.String),\n\t}),\n\t/** Hover an element by `ref` (reveal menus / tooltips). */\n\tSchema.TaggedStruct(\"Hover\", { ref: Schema.String }),\n\t/** Choose an option in a <select> by `ref`, matching value or visible label. */\n\tSchema.TaggedStruct(\"Select\", { ref: Schema.String, value: Schema.String }),\n\t/**\n\t * Press a key (Enter, Tab, Escape, ArrowDown, …) on the element `ref`, or on\n\t * whatever is focused when `ref` is omitted.\n\t */\n\tSchema.TaggedStruct(\"Press\", {\n\t\tkey: Schema.String,\n\t\tref: Schema.optional(Schema.String),\n\t}),\n\t/**\n\t * Read the visible text of the page, or of one element when `ref` is given.\n\t * Cheaper than a screenshot for confirming content / verifying a flow.\n\t */\n\tSchema.TaggedStruct(\"Read\", { ref: Schema.optional(Schema.String) }),\n\t/** Browser history / reload — back, forward, or reload the current page. */\n\tSchema.TaggedStruct(\"History\", {\n\t\taction: Schema.Literals([\"back\", \"forward\", \"reload\"]),\n\t}),\n\t/** Return recent console messages + page errors captured since last load. */\n\tSchema.TaggedStruct(\"Console\", {}),\n\t/**\n\t * Fill several fields in one round-trip — inputs/textareas and <select>s by\n\t * snapshot `ref`. One permission prompt covers the whole form. `submit`\n\t * presses Enter in the last filled field afterward.\n\t */\n\tSchema.TaggedStruct(\"FillForm\", {\n\t\tfields: Schema.Array(\n\t\t\tSchema.Struct({\n\t\t\t\tref: Schema.String,\n\t\t\t\tvalue: Schema.String,\n\t\t\t}),\n\t\t),\n\t\tsubmit: Schema.optional(Schema.Boolean),\n\t}),\n\t/**\n\t * Network activity captured since the last page load (CDP Network domain,\n\t * buffered in main). No `id` → compact request list, optionally substring-\n\t * filtered by `filter`. With `id` → one request's detail incl. response\n\t * headers and a truncated body.\n\t */\n\tSchema.TaggedStruct(\"Network\", {\n\t\tfilter: Schema.optional(Schema.String),\n\t\tid: Schema.optional(Schema.String),\n\t}),\n\t/**\n\t * Resolve the pending JavaScript dialog (alert/confirm/prompt/beforeunload)\n\t * via `Page.handleJavaScriptDialog`. `promptText` answers a prompt() when\n\t * accepting. Fails cleanly when no dialog is open.\n\t */\n\tSchema.TaggedStruct(\"Dialog\", {\n\t\taction: Schema.Literals([\"accept\", \"dismiss\"]),\n\t\tpromptText: Schema.optional(Schema.String),\n\t}),\n\t/**\n\t * Autofill + submit the saved (DUMMY/TEST) credentials for this origin.\n\t * SECURITY: the command carries ONLY the origin — never the password. The\n\t * desktop main process injects the secret directly into the isolated page,\n\t * so it never enters renderer state, agent args/results, or LLM context.\n\t */\n\tSchema.TaggedStruct(\"Login\", { origin: Schema.String }),\n\tSchema.TaggedStruct(\"Inspect\", { target: BrowserTarget }),\n\tSchema.TaggedStruct(\"Evaluate\", {\n\t\texpression: Schema.String,\n\t\tawaitPromise: Schema.optional(Schema.Boolean),\n\t}),\n\tSchema.TaggedStruct(\"RecordingStart\", {}),\n\tSchema.TaggedStruct(\"RecordingStop\", {}),\n\tSchema.TaggedStruct(\"Overlay\", {\n\t\taction: Schema.Literals([\"add\", \"remove\", \"undo\", \"redo\", \"clear\"]),\n\t\tshape: Schema.optional(BrowserOverlayShape),\n\t\tid: Schema.optional(Schema.String),\n\t}),\n]);\nexport type BrowserCommand = typeof BrowserCommand.Type;\n\n/**\n * Renderer-visible summary of a saved browser credential. Deliberately omits\n * the password — the settings UI only ever sees the origin + username, mirroring\n * the `hasApiKey` boolean exposure for provider API keys.\n */\nexport class BrowserCredentialSummary extends Schema.Class<BrowserCredentialSummary>(\n\t\"BrowserCredentialSummary\",\n)({\n\torigin: Schema.String,\n\tusername: Schema.String,\n}) {}\n\n/**\n * One outstanding command. `id` is the server-minted handle the renderer\n * echoes back on `browser.respond`. `sessionId` is the agent session that\n * issued it — the renderer uses it only for display/attribution today.\n */\nexport class BrowserCommandRequest extends Schema.Class<BrowserCommandRequest>(\n\t\"BrowserCommandRequest\",\n)({\n\tid: Schema.String,\n\tsessionId: AgentSessionId,\n\tcommand: BrowserCommand,\n}) {}\n\n/**\n * Renderer's reply for one command. `ok=false` carries a human-readable\n * `error` the tool surfaces to the agent. Successful results fill the\n * command-specific optional fields:\n * - Navigate → `url`, `title`\n * - Screenshot → `screenshot` (base64 PNG, no data-URL prefix)\n */\nexport class BrowserCommandResult extends Schema.Class<BrowserCommandResult>(\n\t\"BrowserCommandResult\",\n)({\n\tid: Schema.String,\n\tok: Schema.Boolean,\n\terror: Schema.optional(Schema.String),\n\turl: Schema.optional(Schema.String),\n\ttitle: Schema.optional(Schema.String),\n\tscreenshot: Schema.optional(Schema.String),\n\t/**\n\t * Snapshot → a11y-tree text (CDP path) or JSON array of\n\t * `{ ref, role, name, value }` (v1 DOM fallback).\n\t */\n\tsnapshot: Schema.optional(Schema.String),\n\t/** Click/Type/Scroll/… → short human-readable note for the agent. */\n\tdetail: Schema.optional(Schema.String),\n\t/**\n\t * Read → page/element text; Console → console + error log;\n\t * Network → request list or one request's detail.\n\t */\n\ttext: Schema.optional(Schema.String),\n\t/** Command-tagged structured response. New commands use this field. */\n\tpayload: Schema.optional(Schema.Unknown),\n}) {}\n\nexport class BrowserCommandNotFoundError extends Schema.TaggedErrorClass<BrowserCommandNotFoundError>()(\n\t\"BrowserCommandNotFoundError\",\n\t{ id: Schema.String },\n) {}\n\n// ---------------------------------------------------------------------------\n// RPCs\n// ---------------------------------------------------------------------------\n\n/**\n * Live stream of pending browser commands. The renderer's BrowserPane\n * subscribes once (independent of which right-pane tab is active) and\n * executes each against the webview. Broadcasting once and filtering on the\n * client mirrors `permission.requests`.\n */\nexport const BrowserCommandsRpc = Rpc.make(\"browser.commands\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: BrowserCommandRequest,\n\tstream: true,\n});\n\n/**\n * Renderer posts the outcome of a command back here; the server resolves the\n * Deferred the MCP tool handler is awaiting. Fails if the id is unknown\n * (already resolved, timed out, or from a previous server run).\n */\nexport const BrowserRespondRpc = Rpc.make(\"browser.respond\", {\n\tpayload: Schema.Struct({ result: BrowserCommandResult }),\n\tsuccess: Schema.Void,\n\terror: BrowserCommandNotFoundError,\n});\n\n// ---------------------------------------------------------------------------\n// Browser credentials (DUMMY / TEST passwords only — see settings UI warning).\n// Stored in the encrypted app vault. Write-only from the UI's perspective; the\n// password is injected into the isolated page by the desktop main process.\n// ---------------------------------------------------------------------------\n\n/** Save (or overwrite) the dummy credential for an origin. */\nexport const BrowserSetCredentialRpc = Rpc.make(\"browser.setCredential\", {\n\tpayload: Schema.Struct({\n\t\torigin: Schema.String,\n\t\tusername: Schema.String,\n\t\tpassword: Schema.String,\n\t}),\n\tsuccess: Schema.Void,\n});\n\n/** List saved credentials (origin + username only — never the password). */\nexport const BrowserListCredentialsRpc = Rpc.make(\"browser.listCredentials\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: Schema.Array(BrowserCredentialSummary),\n});\n\nexport const BrowserRemoveCredentialRpc = Rpc.make(\"browser.removeCredential\", {\n\tpayload: Schema.Struct({ origin: Schema.String }),\n\tsuccess: Schema.Void,\n});\n","import { Effect, Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\nimport { ProviderId } from \"./agent.ts\";\nimport { AgentSessionId, ChatId } from \"./ids.ts\";\nimport {\n\tMessage,\n\tSessionStreamCursor,\n\tSessionTimelineProjection,\n} from \"./session.ts\";\n\nexport const CLOUD_WORKSPACE_OFFER_ID = \"cloud-workspace-standard-v1\" as const;\n\nexport const CloudProjectState = Schema.Literals([\n\t\"connected\",\n\t\"preparing\",\n\t\"ready\",\n\t\"failed\",\n]);\nexport type CloudProjectState = typeof CloudProjectState.Type;\n\nexport const CloudProjectBuildState = Schema.Literals([\n\t\"queued\",\n\t\"building\",\n\t\"sanitizing\",\n\t\"ready\",\n\t\"failed\",\n]);\nexport type CloudProjectBuildState = typeof CloudProjectBuildState.Type;\n\nexport const CloudWorkspaceState = Schema.Literals([\n\t\"queued\",\n\t\"provisioning\",\n\t\"setup\",\n\t\"ready\",\n\t\"pausing\",\n\t\"paused\",\n\t\"resuming\",\n\t\"archiving\",\n\t\"archived\",\n\t\"deleting\",\n\t\"deleted\",\n\t\"failed\",\n]);\nexport type CloudWorkspaceState = typeof CloudWorkspaceState.Type;\n\nexport const CloudWorkspaceDesiredState = Schema.Literals([\n\t\"ready\",\n\t\"paused\",\n\t\"archived\",\n\t\"deleted\",\n]);\nexport type CloudWorkspaceDesiredState = typeof CloudWorkspaceDesiredState.Type;\n\nexport const CloudWorkspaceStartupPhase = Schema.Literals([\n\t\"allocating\",\n\t\"booting\",\n\t\"authenticating-runtime\",\n\t\"syncing-repository\",\n\t\"starting-agent\",\n\t\"running\",\n\t\"failed\",\n]);\nexport type CloudWorkspaceStartupPhase = typeof CloudWorkspaceStartupPhase.Type;\n\nexport class CloudWorkspaceStartupTimings extends Schema.Class<CloudWorkspaceStartupTimings>(\n\t\"CloudWorkspaceStartupTimings\",\n)({\n\trequestedAt: Schema.optional(Schema.Number),\n\tresumeRequestedAt: Schema.optional(Schema.Number),\n\tallocatedAt: Schema.optional(Schema.Number),\n\tallocationDurationMs: Schema.optional(Schema.Number),\n\tenrolledAt: Schema.optional(Schema.Number),\n\truntimeReadyAt: Schema.optional(Schema.Number),\n\tenrollmentDurationMs: Schema.optional(Schema.Number),\n\tnetworkOpenedAt: Schema.optional(Schema.Number),\n\tcredentialInstallDurationMs: Schema.optional(Schema.Number),\n\trepositoryReadyAt: Schema.optional(Schema.Number),\n\trepositoryDurationMs: Schema.optional(Schema.Number),\n\tconnectedAt: Schema.optional(Schema.Number),\n\tconnectionDurationMs: Schema.optional(Schema.Number),\n\tdurableChatCreatedAt: Schema.optional(Schema.Number),\n\tchatCreateDurationMs: Schema.optional(Schema.Number),\n\tagentStartedAt: Schema.optional(Schema.Number),\n\tagentStartDurationMs: Schema.optional(Schema.Number),\n\tlaunchDurationMs: Schema.optional(Schema.Number),\n\tproviderResumedAt: Schema.optional(Schema.Number),\n\tproviderResumeDurationMs: Schema.optional(Schema.Number),\n}) {}\n\nexport const CloudWorkspaceRuntimeState = Schema.Literals([\n\t\"offline\",\n\t\"connecting\",\n\t\"online\",\n]);\nexport type CloudWorkspaceRuntimeState = typeof CloudWorkspaceRuntimeState.Type;\n\nexport const CloudCredentialKind = Schema.Literals([\n\t\"github\",\n\t\"claude\",\n\t\"codex\",\n]);\nexport type CloudCredentialKind = typeof CloudCredentialKind.Type;\n\nexport class CloudProviderOption extends Schema.Class<CloudProviderOption>(\n\t\"CloudProviderOption\",\n)({\n\tproviderId: Schema.String,\n\tdisplayName: Schema.String,\n}) {}\n\nexport class CloudProviderList extends Schema.Class<CloudProviderList>(\n\t\"CloudProviderList\",\n)({\n\tproviders: Schema.Array(CloudProviderOption),\n}) {}\n\nexport class CloudProjectBuildStatus extends Schema.Class<CloudProjectBuildStatus>(\n\t\"CloudProjectBuildStatus\",\n)({\n\tbuildId: Schema.String,\n\tproviderId: Schema.String,\n\tstate: CloudProjectBuildState,\n\terrorCode: Schema.optional(Schema.String),\n\tcreatedAt: Schema.Number,\n\tupdatedAt: Schema.Number,\n}) {}\n\nexport class CloudProject extends Schema.Class<CloudProject>(\"CloudProject\")({\n\tprojectId: Schema.String,\n\trepositoryIdentity: Schema.String,\n\trepositoryUrl: Schema.String,\n\tdisplayName: Schema.String,\n\tdefaultBranch: Schema.String,\n\tvisibility: Schema.Literals([\"public\", \"private\"]),\n\tstate: CloudProjectState,\n\tactiveBuilds: Schema.Record(Schema.String, Schema.String),\n\tlatestBuilds: Schema.Record(Schema.String, CloudProjectBuildStatus),\n\tcreatedAt: Schema.Number,\n\tupdatedAt: Schema.Number,\n}) {}\n\nexport class CloudProjectList extends Schema.Class<CloudProjectList>(\n\t\"CloudProjectList\",\n)({ projects: Schema.Array(CloudProject) }) {}\n\nexport class CloudProjectConnectRequest extends Schema.Class<CloudProjectConnectRequest>(\n\t\"CloudProjectConnectRequest\",\n)({\n\trepositoryUrl: Schema.String,\n\tdefaultBranch: Schema.String,\n\tvisibility: Schema.Literals([\"public\", \"private\"]),\n\tdisplayName: Schema.optional(Schema.String),\n\tcloudEnvironment: Schema.optional(\n\t\tSchema.Record(Schema.String, Schema.String),\n\t),\n\tsecretBindings: Schema.optional(Schema.Array(Schema.String)),\n\tidempotencyKey: Schema.String,\n}) {}\n\nexport class CloudProjectBuild extends Schema.Class<CloudProjectBuild>(\n\t\"CloudProjectBuild\",\n)({\n\tbuildId: Schema.String,\n\tprojectId: Schema.String,\n\tproviderId: Schema.String,\n\tstate: CloudProjectBuildState,\n\tsourceCommit: Schema.optional(Schema.String),\n\ttemplateVersion: Schema.String,\n\tconfigurationDigest: Schema.String,\n\tcreatedAt: Schema.Number,\n\tupdatedAt: Schema.Number,\n}) {}\n\nexport class CloudProjectPrepareRequest extends Schema.Class<CloudProjectPrepareRequest>(\n\t\"CloudProjectPrepareRequest\",\n)({\n\tprojectId: Schema.String,\n\tproviderId: Schema.String,\n\tidempotencyKey: Schema.String,\n}) {}\n\nexport class CloudWorkspace extends Schema.Class<CloudWorkspace>(\n\t\"CloudWorkspace\",\n)({\n\tworkspaceId: Schema.String,\n\tprojectId: Schema.String,\n\tbuildId: Schema.String,\n\tproviderId: Schema.String,\n\tbranch: Schema.String,\n\tbaseRef: Schema.String,\n\tstate: CloudWorkspaceState,\n\tdesiredState: CloudWorkspaceDesiredState,\n\tstatusCode: Schema.String,\n\tstartupPhase: CloudWorkspaceStartupPhase,\n\tstartupTimings: CloudWorkspaceStartupTimings,\n\truntimeState: CloudWorkspaceRuntimeState,\n\trevision: Schema.Number,\n\tchatId: ChatId,\n\tinitialSessionId: AgentSessionId,\n\tcreatedAt: Schema.Number,\n\tupdatedAt: Schema.Number,\n\tlastActivityAt: Schema.Number,\n}) {}\n\nexport class CloudWorkspaceLaunch extends Schema.Class<CloudWorkspaceLaunch>(\n\t\"CloudWorkspaceLaunch\",\n)({\n\tworkspace: CloudWorkspace,\n\tchatId: ChatId,\n\tinitialSessionId: AgentSessionId,\n}) {}\n\nexport class CloudWorkspaceConnection extends Schema.Class<CloudWorkspaceConnection>(\n\t\"CloudWorkspaceConnection\",\n)({\n\tworkspaceId: Schema.String,\n\twsUrl: Schema.String,\n\tprotocol: Schema.String,\n\trole: Schema.Literal(\"client\"),\n\tgeneration: Schema.Number,\n\tgatewayEpoch: Schema.Number,\n\tcredential: Schema.String,\n\texpiresAt: Schema.Number,\n}) {}\n\n/**\n * Last-known runtime metadata for catalog/sidebar rendering. This deliberately\n * cannot carry transcript, queue, file, Git, or terminal payloads.\n */\nexport class CloudWorkspaceRuntimeSummary extends Schema.Class<CloudWorkspaceRuntimeSummary>(\n\t\"CloudWorkspaceRuntimeSummary\",\n)({\n\tsummaryRevision: Schema.Number,\n\ttitle: Schema.String,\n\tlastActivityAt: Schema.Number,\n\tsessionHeadVersion: Schema.Number,\n}) {}\n\n/** Last-known cloud workspace metadata available without a live runtime. */\nexport class CloudChatSummary extends Schema.Class<CloudChatSummary>(\n\t\"CloudChatSummary\",\n)({\n\tworkspaceId: Schema.String,\n\tprojectId: Schema.String,\n\trepositoryIdentity: Schema.String,\n\trepositoryDisplayName: Schema.String,\n\tchatId: ChatId,\n\tinitialSessionId: AgentSessionId,\n\ttitle: Schema.String,\n\tbranch: Schema.String,\n\tproviderId: Schema.String,\n\tagent: ProviderId,\n\tmodel: Schema.String,\n\tstate: CloudWorkspaceState,\n\tdesiredState: CloudWorkspaceDesiredState,\n\truntimeState: CloudWorkspaceRuntimeState,\n\tstatusCode: Schema.String,\n\tstartupPhase: CloudWorkspaceStartupPhase,\n\trevision: Schema.Number,\n\t/** Monotonic within the current runtime generation. */\n\tsummaryRevision: Schema.Number.pipe(\n\t\tSchema.withConstructorDefault(Effect.succeed(0)),\n\t\tSchema.withDecodingDefaultType(Effect.succeed(0)),\n\t),\n\t/** Authoritative runtime session head represented by this summary. */\n\tsessionHeadVersion: Schema.Number.pipe(\n\t\tSchema.withConstructorDefault(Effect.succeed(0)),\n\t\tSchema.withDecodingDefaultType(Effect.succeed(0)),\n\t),\n\tunread: Schema.Boolean,\n\tlastMessageAt: Schema.NullOr(Schema.Number),\n\tarchivedAt: Schema.optional(Schema.Number),\n\tcreatedAt: Schema.Number,\n\tupdatedAt: Schema.Number,\n}) {}\n\nexport class CloudChatList extends Schema.Class<CloudChatList>(\"CloudChatList\")(\n\t{\n\t\tchats: Schema.Array(CloudChatSummary),\n\t},\n) {}\n\nexport const CLOUD_TRANSCRIPT_CHECKPOINT_SCHEMA_VERSION = 1 as const;\n\nexport class CloudTranscriptCheckpointPayload extends Schema.Class<CloudTranscriptCheckpointPayload>(\n\t\"CloudTranscriptCheckpointPayload\",\n)({\n\tschemaVersion: Schema.Literal(CLOUD_TRANSCRIPT_CHECKPOINT_SCHEMA_VERSION),\n\tworkspaceId: Schema.String,\n\tsessionId: AgentSessionId,\n\tcursor: SessionStreamCursor,\n\tprojection: SessionTimelineProjection,\n}) {}\n\nexport class CloudTranscriptCheckpointMetadata extends Schema.Class<CloudTranscriptCheckpointMetadata>(\n\t\"CloudTranscriptCheckpointMetadata\",\n)({\n\tworkspaceId: Schema.String,\n\tsessionId: AgentSessionId,\n\truntimeGeneration: Schema.Number,\n\tcursor: SessionStreamCursor,\n\tobjectKey: Schema.String,\n\tciphertextSha256: Schema.String,\n\tciphertextBytes: Schema.Number,\n\tcreatedAt: Schema.Number,\n}) {}\n\nexport class CloudTranscriptCheckpointUpload extends Schema.Class<CloudTranscriptCheckpointUpload>(\n\t\"CloudTranscriptCheckpointUpload\",\n)({\n\tsessionId: AgentSessionId,\n\tcursor: SessionStreamCursor,\n\tciphertext: Schema.String,\n\tciphertextSha256: Schema.String,\n}) {}\n\nexport class CloudTranscriptCheckpointAccess extends Schema.Class<CloudTranscriptCheckpointAccess>(\n\t\"CloudTranscriptCheckpointAccess\",\n)({\n\tmetadata: CloudTranscriptCheckpointMetadata,\n\tciphertext: Schema.String,\n\ttranscriptKey: Schema.String,\n}) {}\n\nexport class CloudTranscriptCheckpointResult extends Schema.Class<CloudTranscriptCheckpointResult>(\n\t\"CloudTranscriptCheckpointResult\",\n)({\n\tcheckpoint: Schema.NullOr(CloudTranscriptCheckpointAccess),\n}) {}\n\nexport class CloudTranscriptMessagePagePayload extends Schema.Class<CloudTranscriptMessagePagePayload>(\n\t\"CloudTranscriptMessagePagePayload\",\n)({\n\tschemaVersion: Schema.Literal(CLOUD_TRANSCRIPT_CHECKPOINT_SCHEMA_VERSION),\n\tworkspaceId: Schema.String,\n\tsessionId: AgentSessionId,\n\tcursor: SessionStreamCursor,\n\tbeforeSequence: Schema.Number,\n\tmessages: Schema.Array(Message),\n\tolderMessageSequence: Schema.NullOr(Schema.Number),\n}) {}\n\nexport class CloudTranscriptMessagePageUpload extends Schema.Class<CloudTranscriptMessagePageUpload>(\n\t\"CloudTranscriptMessagePageUpload\",\n)({\n\tsessionId: AgentSessionId,\n\tcursor: SessionStreamCursor,\n\tbeforeSequence: Schema.Number,\n\tciphertext: Schema.String,\n\tciphertextSha256: Schema.String,\n}) {}\n\nexport class CloudTranscriptMessagePageResult extends Schema.Class<CloudTranscriptMessagePageResult>(\n\t\"CloudTranscriptMessagePageResult\",\n)({\n\tpage: Schema.NullOr(\n\t\tSchema.Struct({\n\t\t\tcursor: SessionStreamCursor,\n\t\t\tbeforeSequence: Schema.Number,\n\t\t\tciphertext: Schema.String,\n\t\t\tciphertextSha256: Schema.String,\n\t\t\ttranscriptKey: Schema.String,\n\t\t}),\n\t),\n}) {}\n\nexport class CloudWorkspaceList extends Schema.Class<CloudWorkspaceList>(\n\t\"CloudWorkspaceList\",\n)({ workspaces: Schema.Array(CloudWorkspace) }) {}\n\nexport class CloudWorkspaceCreateRequest extends Schema.Class<CloudWorkspaceCreateRequest>(\n\t\"CloudWorkspaceCreateRequest\",\n)({\n\tprojectId: Schema.String,\n\tproviderId: Schema.String,\n\tbaseRef: Schema.String,\n\tbranch: Schema.optional(Schema.String),\n\tagent: Schema.String,\n\tmodel: Schema.String,\n\tcredentialKinds: Schema.optional(Schema.Array(CloudCredentialKind)),\n\tsecretBindings: Schema.optional(Schema.Array(Schema.String)),\n\tpermissions: Schema.optional(Schema.Array(Schema.String)),\n\tfirstMessage: Schema.optional(Schema.String),\n\tidempotencyKey: Schema.String,\n}) {}\n\nexport class CloudWorkspaceActionRequest extends Schema.Class<CloudWorkspaceActionRequest>(\n\t\"CloudWorkspaceActionRequest\",\n)({\n\tworkspaceId: Schema.String,\n\tcommandId: Schema.optional(Schema.String),\n}) {}\n\nexport class CloudWorkspaceResumeRequest extends Schema.Class<CloudWorkspaceResumeRequest>(\n\t\"CloudWorkspaceResumeRequest\",\n)({\n\tworkspaceId: Schema.String,\n\tcommandId: Schema.optional(Schema.String),\n\t/** The gateway proved that Relay's online projection has no runtime socket. */\n\trecoverRuntime: Schema.optional(Schema.Boolean),\n}) {}\n\n/**\n * A short-lived grant for the workspace runtime's WebSocket SSH bridge. The\n * relay stages the hashed ticket inside the sandbox; the desktop's\n * ProxyCommand bridge presents the plain ticket when it connects to `wsUrl`.\n */\nexport class CloudWorkspaceSshAccess extends Schema.Class<CloudWorkspaceSshAccess>(\n\t\"CloudWorkspaceSshAccess\",\n)({\n\tworkspaceId: Schema.String,\n\twsUrl: Schema.String,\n\tticket: Schema.String,\n\texpiresAt: Schema.Number,\n\tuser: Schema.String,\n\tworkspacePath: Schema.String,\n}) {}\n\nexport class CloudCredentialConnection extends Schema.Class<CloudCredentialConnection>(\n\t\"CloudCredentialConnection\",\n)({\n\tkind: CloudCredentialKind,\n\tstate: Schema.Literals([\"connected\", \"disconnected\", \"error\"]),\n\tversion: Schema.Number,\n\taccountLabel: Schema.optional(Schema.String),\n\tupdatedAt: Schema.Number,\n}) {}\n\nexport class CloudCredentialList extends Schema.Class<CloudCredentialList>(\n\t\"CloudCredentialList\",\n)({ credentials: Schema.Array(CloudCredentialConnection) }) {}\n\nexport class CloudCredentialConnectRequest extends Schema.Class<CloudCredentialConnectRequest>(\n\t\"CloudCredentialConnectRequest\",\n)({\n\tkind: CloudCredentialKind,\n\tcredentialType: Schema.Literals([\n\t\t\"api-key\",\n\t\t\"oauth-token\",\n\t\t\"repository-token\",\n\t\t\"native-store\",\n\t]),\n\tsecret: Schema.String,\n\taccountLabel: Schema.optional(Schema.String),\n}) {}\n\nexport class CloudCredentialDisconnectRequest extends Schema.Class<CloudCredentialDisconnectRequest>(\n\t\"CloudCredentialDisconnectRequest\",\n)({ kind: CloudCredentialKind }) {}\n\nexport class CloudWorkspaceOpError extends Schema.TaggedErrorClass<CloudWorkspaceOpError>()(\n\t\"CloudWorkspaceOpError\",\n\t{\n\t\tcode: Schema.Literals([\n\t\t\t\"not-found\",\n\t\t\t\"not-allowed\",\n\t\t\t\"invalid-request\",\n\t\t\t\"entitlement-required\",\n\t\t\t\"provider-unavailable\",\n\t\t\t\"project-not-ready\",\n\t\t\t\"credential-required\",\n\t\t\t\"branch-in-use\",\n\t\t\t\"conflict\",\n\t\t\t\"billing-hold\",\n\t\t]),\n\t},\n) {}\n\nexport const CloudProvidersRpc = Rpc.make(\"cloud.providers\", {\n\tpayload: Schema.Void,\n\tsuccess: CloudProviderList,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudProjectsListRpc = Rpc.make(\"cloud.projects.list\", {\n\tpayload: Schema.Void,\n\tsuccess: CloudProjectList,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudProjectsConnectRpc = Rpc.make(\"cloud.projects.connect\", {\n\tpayload: CloudProjectConnectRequest,\n\tsuccess: CloudProject,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudProjectsPrepareRpc = Rpc.make(\"cloud.projects.prepare\", {\n\tpayload: CloudProjectPrepareRequest,\n\tsuccess: CloudProjectBuild,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudWorkspacesListRpc = Rpc.make(\"cloud.workspaces.list\", {\n\tpayload: Schema.Struct({ projectId: Schema.optional(Schema.String) }),\n\tsuccess: CloudWorkspaceList,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudWorkspacesGetRpc = Rpc.make(\"cloud.workspaces.get\", {\n\tpayload: CloudWorkspaceActionRequest,\n\tsuccess: CloudWorkspace,\n\terror: CloudWorkspaceOpError,\n});\n/**\n * One monotonic lifecycle control stream for a workspace. The server adapts\n * Relay's current REST surface; clients never own lifecycle polling loops.\n */\nexport const CloudWorkspacesWatchRpc = Rpc.make(\"cloud.workspaces.watch\", {\n\tpayload: Schema.Struct({\n\t\tworkspaceId: Schema.String,\n\t\tafterRevision: Schema.optional(Schema.Number),\n\t}),\n\tsuccess: CloudWorkspace,\n\terror: CloudWorkspaceOpError,\n\tstream: true,\n});\nexport const CloudWorkspacesCreateRpc = Rpc.make(\"cloud.workspaces.create\", {\n\tpayload: CloudWorkspaceCreateRequest,\n\tsuccess: CloudWorkspaceLaunch,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudWorkspacesConnectRpc = Rpc.make(\"cloud.workspaces.connect\", {\n\tpayload: CloudWorkspaceActionRequest,\n\tsuccess: CloudWorkspaceConnection,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudChatsListRpc = Rpc.make(\"cloud.chats.list\", {\n\tpayload: Schema.Struct({\n\t\tprojectId: Schema.optional(Schema.String),\n\t\tscope: Schema.optional(Schema.Literals([\"active\", \"archived\", \"all\"])),\n\t}),\n\tsuccess: CloudChatList,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudWorkspacesPauseRpc = Rpc.make(\"cloud.workspaces.pause\", {\n\tpayload: CloudWorkspaceActionRequest,\n\tsuccess: CloudWorkspace,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudWorkspacesResumeRpc = Rpc.make(\"cloud.workspaces.resume\", {\n\tpayload: CloudWorkspaceResumeRequest,\n\tsuccess: CloudWorkspace,\n\terror: CloudWorkspaceOpError,\n});\n/** Restart the runtime of a running workspace in place (same sandbox). */\nexport const CloudWorkspacesRestartRpc = Rpc.make(\"cloud.workspaces.restart\", {\n\tpayload: CloudWorkspaceActionRequest,\n\tsuccess: CloudWorkspace,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudWorkspacesSshAccessRpc = Rpc.make(\n\t\"cloud.workspaces.sshAccess\",\n\t{\n\t\tpayload: CloudWorkspaceActionRequest,\n\t\tsuccess: CloudWorkspaceSshAccess,\n\t\terror: CloudWorkspaceOpError,\n\t},\n);\nexport const CloudWorkspacesArchiveRpc = Rpc.make(\"cloud.workspaces.archive\", {\n\tpayload: CloudWorkspaceActionRequest,\n\tsuccess: CloudWorkspace,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudWorkspacesUnarchiveRpc = Rpc.make(\n\t\"cloud.workspaces.unarchive\",\n\t{\n\t\tpayload: CloudWorkspaceActionRequest,\n\t\tsuccess: CloudWorkspace,\n\t\terror: CloudWorkspaceOpError,\n\t},\n);\nexport const CloudWorkspacesDeleteRpc = Rpc.make(\"cloud.workspaces.delete\", {\n\tpayload: CloudWorkspaceActionRequest,\n\tsuccess: CloudWorkspace,\n\terror: CloudWorkspaceOpError,\n});\n\nexport const CloudTranscriptCheckpointGetRpc = Rpc.make(\n\t\"cloud.transcript.get\",\n\t{\n\t\tpayload: Schema.Struct({\n\t\t\tworkspaceId: Schema.String,\n\t\t\tsessionId: AgentSessionId,\n\t\t\tcursor: Schema.optional(SessionStreamCursor),\n\t\t}),\n\t\tsuccess: CloudTranscriptCheckpointResult,\n\t\terror: CloudWorkspaceOpError,\n\t},\n);\n\nexport const CloudTranscriptMessagePageGetRpc = Rpc.make(\n\t\"cloud.transcript.messages.page\",\n\t{\n\t\tpayload: Schema.Struct({\n\t\t\tworkspaceId: Schema.String,\n\t\t\tsessionId: AgentSessionId,\n\t\t\tcursor: SessionStreamCursor,\n\t\t\tbeforeSequence: Schema.Number,\n\t\t}),\n\t\tsuccess: CloudTranscriptMessagePageResult,\n\t\terror: CloudWorkspaceOpError,\n\t},\n);\nexport const CloudCredentialsListRpc = Rpc.make(\"cloud.credentials.list\", {\n\tpayload: Schema.Void,\n\tsuccess: CloudCredentialList,\n\terror: CloudWorkspaceOpError,\n});\nexport const CloudCredentialsImportLocalRpc = Rpc.make(\n\t\"cloud.credentials.importLocal\",\n\t{\n\t\tpayload: Schema.Struct({ kind: CloudCredentialKind }),\n\t\tsuccess: CloudCredentialConnection,\n\t\terror: CloudWorkspaceOpError,\n\t},\n);\nexport const CloudCredentialsDisconnectRpc = Rpc.make(\n\t\"cloud.credentials.disconnect\",\n\t{\n\t\tpayload: CloudCredentialDisconnectRequest,\n\t\tsuccess: CloudCredentialConnection,\n\t\terror: CloudWorkspaceOpError,\n\t},\n);\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\nimport { CloudWorkspaceOpError } from \"./cloud-workspaces.ts\";\n\nexport const CloudBillingStatus = Schema.Literals([\n\t\"active\",\n\t\"grace\",\n\t\"billing-hold\",\n\t\"ended\",\n\t\"manual\",\n]);\nexport type CloudBillingStatus = typeof CloudBillingStatus.Type;\n\nexport class CloudBillingSummary extends Schema.Class<CloudBillingSummary>(\n\t\"CloudBillingSummary\",\n)({\n\tcurrency: Schema.Literal(\"USD\"),\n\tstatus: CloudBillingStatus,\n\tperiodStart: Schema.Number,\n\tperiodEnd: Schema.Number,\n\tbasePriceMicros: Schema.Number,\n\tincludedProviderCostMicros: Schema.Number,\n\tproviderCostMicros: Schema.Number,\n\tincludedUsedMicros: Schema.Number,\n\tincludedRemainingMicros: Schema.Number,\n\toverageProviderCostMicros: Schema.Number,\n\toverageChargeMicros: Schema.Number,\n\toverageCapMicros: Schema.Number,\n\tmarkupBasisPoints: Schema.Number,\n\tcurrentInvoiceEstimateMicros: Schema.Number,\n\tlastProviderReconciledAt: Schema.optional(Schema.Number),\n\tlastPolarReconciledAt: Schema.optional(Schema.Number),\n\tusageProvisional: Schema.Boolean,\n}) {}\n\nexport class CloudBillingUsageItem extends Schema.Class<CloudBillingUsageItem>(\n\t\"CloudBillingUsageItem\",\n)({\n\tentryId: Schema.String,\n\tresourceKind: Schema.Literals([\"workspace\", \"build\", \"other\"]),\n\tresourceId: Schema.String,\n\tprovider: Schema.String,\n\tproviderExecutionId: Schema.optional(Schema.String),\n\tstartedAt: Schema.Number,\n\tendedAt: Schema.Number,\n\tvcpuCount: Schema.Number,\n\tmemoryMib: Schema.Number,\n\tproviderCostMicros: Schema.Number,\n\tstatus: Schema.Literals([\"provisional\", \"confirmed\", \"corrected\"]),\n}) {}\n\nexport class CloudBillingUsagePage extends Schema.Class<CloudBillingUsagePage>(\n\t\"CloudBillingUsagePage\",\n)({\n\titems: Schema.Array(CloudBillingUsageItem),\n\tnextCursor: Schema.optional(Schema.String),\n}) {}\n\nexport class CloudBillingUsageRequest extends Schema.Class<CloudBillingUsageRequest>(\n\t\"CloudBillingUsageRequest\",\n)({\n\tcursor: Schema.optional(Schema.String),\n\tlimit: Schema.optional(Schema.Number),\n}) {}\n\nexport class CloudBillingCapRequest extends Schema.Class<CloudBillingCapRequest>(\n\t\"CloudBillingCapRequest\",\n)({\n\toverageCapMicros: Schema.Number,\n\tidempotencyKey: Schema.String,\n}) {}\n\nexport const CloudBillingSummaryRpc = Rpc.make(\"cloud.billing.summary\", {\n\tpayload: Schema.Void,\n\tsuccess: CloudBillingSummary,\n\terror: CloudWorkspaceOpError,\n});\n\nexport const CloudBillingUsageRpc = Rpc.make(\"cloud.billing.usage\", {\n\tpayload: CloudBillingUsageRequest,\n\tsuccess: CloudBillingUsagePage,\n\terror: CloudWorkspaceOpError,\n});\n\nexport const CloudBillingSetCapRpc = Rpc.make(\"cloud.billing.setCap\", {\n\tpayload: CloudBillingCapRequest,\n\tsuccess: CloudBillingSummary,\n\terror: CloudWorkspaceOpError,\n});\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { EnvironmentId } from \"./ids.ts\";\n\n/** Conventional loopback port for a local desktop environment. */\nexport const DEFAULT_LOCAL_DESKTOP_PORT = 47837;\n\n// ---------------------------------------------------------------------------\n// Environment abstraction\n// ---------------------------------------------------------------------------\n//\n// An *environment* is a host running `@zusehq/server`. The same headless server\n// binary runs on the laptop, on an SSH dev-box, or on a cloud container — only\n// `providerKind` and the endpoint differ. Clients (desktop renderer, mobile,\n// browser) pick an environment without caring where it physically runs, which\n// is the seam that lets cloud-hosted worktrees drop in later with no client or\n// server-core refactor.\n//\n// These types + RPC definitions lock that contract now. The local-pairing and\n// cloud-link handlers (and registration into the RPC group) land with the\n// auth/pairing and relay PRs; until then these are exported definitions only.\n\n/**\n * Where an environment physically runs.\n * - `desktop`: on the user's machine (IPC in-process, or WS + tunnel for reach)\n * - `ssh`: on a remote dev-box, launched by the desktop and tunneled back\n * - `cloud`: on a cloud container/microVM, provisioned by the control plane\n */\nexport const ProviderKind = Schema.Literals([\"desktop\", \"ssh\", \"cloud\"]);\nexport type ProviderKind = typeof ProviderKind.Type;\n\n/** The reachable URLs for an environment's RPC surface. */\nexport class EnvironmentEndpoint extends Schema.Class<EnvironmentEndpoint>(\n \"EnvironmentEndpoint\",\n)({\n httpBaseUrl: Schema.String,\n wsBaseUrl: Schema.String,\n}) {}\n\nexport const AdvertisedEndpointProviderKind = Schema.Literals([\n \"core\",\n \"tunnel\",\n \"manual\",\n \"private-network\",\n]);\nexport type AdvertisedEndpointProviderKind =\n typeof AdvertisedEndpointProviderKind.Type;\n\nexport const AdvertisedEndpointReachability = Schema.Literals([\n \"loopback\",\n \"lan\",\n \"public\",\n \"tunnel\",\n \"private-network\",\n]);\nexport type AdvertisedEndpointReachability =\n typeof AdvertisedEndpointReachability.Type;\n\nexport const AdvertisedEndpointHostedHttpsCompatibility = Schema.Literals([\n \"compatible\",\n \"mixed-content-blocked\",\n \"unknown\",\n]);\nexport type AdvertisedEndpointHostedHttpsCompatibility =\n typeof AdvertisedEndpointHostedHttpsCompatibility.Type;\n\nexport const AdvertisedEndpointStatus = Schema.Literals([\n \"available\",\n \"unavailable\",\n \"unknown\",\n]);\nexport type AdvertisedEndpointStatus = typeof AdvertisedEndpointStatus.Type;\n\nexport const AdvertisedEndpointCompatibility = Schema.Struct({\n hostedHttpsApp: AdvertisedEndpointHostedHttpsCompatibility,\n});\nexport type AdvertisedEndpointCompatibility =\n typeof AdvertisedEndpointCompatibility.Type;\n\nexport class AdvertisedEndpoint extends Schema.Class<AdvertisedEndpoint>(\n \"AdvertisedEndpoint\",\n)({\n id: Schema.String,\n label: Schema.String,\n providerKind: AdvertisedEndpointProviderKind,\n httpBaseUrl: Schema.String,\n wsBaseUrl: Schema.String,\n reachability: AdvertisedEndpointReachability,\n compatibility: AdvertisedEndpointCompatibility,\n status: AdvertisedEndpointStatus,\n isDefault: Schema.Boolean,\n}) {}\n\nexport const CapabilityFeature = Schema.Literals([\n \"agents\",\n \"chats\",\n \"files\",\n \"diffs\",\n \"terminals\",\n \"approvals\",\n \"questions\",\n \"previews\",\n \"notifications\",\n \"runtime-update\",\n]);\nexport type CapabilityFeature = typeof CapabilityFeature.Type;\n\nexport class CapabilityManifest extends Schema.Class<CapabilityManifest>(\n \"CapabilityManifest\",\n)({\n version: Schema.Literal(1),\n features: Schema.Array(CapabilityFeature),\n}) {}\n\nexport const EnvironmentServiceState = Schema.Literals([\n \"starting\",\n \"healthy\",\n \"degraded\",\n \"stopped\",\n \"updating\",\n]);\nexport type EnvironmentServiceState = typeof EnvironmentServiceState.Type;\n\nexport class EnvironmentEndpointHealth extends Schema.Class<EnvironmentEndpointHealth>(\n \"EnvironmentEndpointHealth\",\n)({\n lan: Schema.optional(\n Schema.Literals([\"available\", \"unavailable\", \"unknown\"]),\n ),\n managed: Schema.optional(\n Schema.Literals([\"available\", \"unavailable\", \"unknown\"]),\n ),\n checkedAt: Schema.Number,\n}) {}\n\n/**\n * Everything a client needs to identify and reach an environment. Keyed by\n * `environmentId` (never by \"this laptop\"), so the relay and clients treat\n * desktop / ssh / cloud uniformly.\n */\nexport class EnvironmentDescriptor extends Schema.Class<EnvironmentDescriptor>(\n \"EnvironmentDescriptor\",\n)({\n environmentId: EnvironmentId,\n providerKind: ProviderKind,\n endpoint: EnvironmentEndpoint,\n advertisedEndpoints: Schema.optional(Schema.Array(AdvertisedEndpoint)),\n label: Schema.optional(Schema.String),\n runtimeVersion: Schema.optional(Schema.String),\n wireProtocolVersion: Schema.optional(Schema.Number),\n capabilities: Schema.optional(CapabilityManifest),\n serviceState: Schema.optional(EnvironmentServiceState),\n endpointHealth: Schema.optional(EnvironmentEndpointHealth),\n lastHeartbeat: Schema.optional(Schema.Number),\n}) {}\n\n// ---------------------------------------------------------------------------\n// Errors\n// ---------------------------------------------------------------------------\n\nexport class ConnectAuthError extends Schema.TaggedErrorClass<ConnectAuthError>()(\n \"ConnectAuthError\",\n { reason: Schema.String },\n) {}\n\n// ---------------------------------------------------------------------------\n// Connect / link RPC definitions (not yet registered in the RPC group)\n// ---------------------------------------------------------------------------\n\n/**\n * Describe this environment to a client that has already authenticated to it\n * (local bearer token over WS). Returns the descriptor the client stores in its\n * connection catalog.\n */\nexport const ConnectDescribeRpc = Rpc.make(\"connect.describe\", {\n payload: Schema.Void,\n success: EnvironmentDescriptor,\n error: ConnectAuthError,\n});\n\n/**\n * Cloud-link step 1: the environment signs a relay-issued challenge with its\n * local bearer credential, proving control of the host. The signed proof is\n * submitted to the relay by the client to complete linking.\n */\nexport const ConnectLinkProofRpc = Rpc.make(\"connect.linkProof\", {\n payload: Schema.Struct({\n challenge: Schema.String,\n relayIssuer: Schema.String,\n endpoint: EnvironmentEndpoint,\n }),\n success: Schema.Struct({ proof: Schema.String }),\n error: ConnectAuthError,\n});\n\n/**\n * Cloud-link step 2: persist relay-issued credentials on the environment so\n * future connections route through the managed endpoint without re-pairing.\n */\nexport const ConnectRelayConfigRpc = Rpc.make(\"connect.relayConfig\", {\n payload: Schema.Struct({\n relayUrl: Schema.String,\n relayIssuer: Schema.String,\n environmentId: EnvironmentId,\n environmentCredential: Schema.String,\n mintPublicKey: Schema.optional(Schema.String),\n }),\n success: Schema.Void,\n error: ConnectAuthError,\n});\n\n// ---------------------------------------------------------------------------\n// Relay link orchestration (renderer ↔ server)\n// ---------------------------------------------------------------------------\n//\n// The desktop self-registers with the relay: because it is already\n// WorkOS-signed-in and holds its Ed25519 identity, the server runs the whole\n// link flow (challenge → sign → submit → persist → heartbeat). The renderer's\n// \"Devices\" pane drives it with these RPCs.\n\n/** Whether this environment is linked to a relay, plus how to describe it. */\nexport class RelayLinkStatus extends Schema.Class<RelayLinkStatus>(\n \"RelayLinkStatus\",\n)({\n linked: Schema.Boolean,\n relayUrl: Schema.optional(Schema.String),\n environmentId: Schema.optional(EnvironmentId),\n label: Schema.optional(Schema.String),\n heartbeatActive: Schema.Boolean,\n advertisedEndpoints: Schema.optional(Schema.Array(AdvertisedEndpoint)),\n}) {}\n\n/** Link this environment to a relay under the signed-in WorkOS account. */\nexport const RelayLinkRpc = Rpc.make(\"relay.link\", {\n payload: Schema.Struct({\n relayUrl: Schema.String,\n label: Schema.optional(Schema.String),\n }),\n success: RelayLinkStatus,\n error: ConnectAuthError,\n});\n\n/** Current relay link status. */\nexport const RelayStatusRpc = Rpc.make(\"relay.status\", {\n payload: Schema.Void,\n success: RelayLinkStatus,\n error: ConnectAuthError,\n});\n\n/** Remove this environment's relay link. */\nexport const RelayUnlinkRpc = Rpc.make(\"relay.unlink\", {\n payload: Schema.Void,\n success: Schema.Void,\n error: ConnectAuthError,\n});\n","import { Rpc } from \"effect/unstable/rpc\";\nimport { Schema } from \"effect\";\n\nimport { SessionId } from \"./session.ts\";\n\n/**\n * Raised when the server cannot figure out where to write a context file —\n * e.g. the session row is gone and no fallback workspace root was supplied.\n */\nexport class ContextWriteError extends Schema.TaggedErrorClass<ContextWriteError>()(\n \"ContextWriteError\",\n {\n sessionId: SessionId,\n reason: Schema.String,\n },\n) {}\n\n/**\n * Persist a chunk of text as a file under the workspace's gitignored\n * `.context/files/` directory and hand back its paths. The renderer uses\n * this when a large paste would otherwise flood the composer: instead of\n * inlining the text it drops a `@.context/files/paste-<uuid>.md` file chip,\n * which flows through the normal `FileRef` pipeline so the agent reads the\n * file from its own cwd.\n *\n * `rootPath` is an optional fallback workspace root the renderer already\n * knows (`useActiveWorkspaceRoot`). The server prefers to resolve the cwd\n * from `sessionId`, but for a brand-new chat whose session row does not\n * exist yet the fallback keeps paste-to-file working.\n */\nexport const ContextSaveTextRpc = Rpc.make(\"context.saveText\", {\n payload: Schema.Struct({\n sessionId: SessionId,\n text: Schema.String,\n ext: Schema.String,\n rootPath: Schema.optional(Schema.String),\n }),\n success: Schema.Struct({\n relPath: Schema.String,\n absPath: Schema.String,\n }),\n error: ContextWriteError,\n});\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nexport const DiagnosticSeverity = Schema.Literals([\n\t\"debug\",\n\t\"info\",\n\t\"warn\",\n\t\"error\",\n\t\"fatal\",\n]);\nexport type DiagnosticSeverity = typeof DiagnosticSeverity.Type;\n\nexport const DiagnosticRecoveryStatus = Schema.Literals([\n\t\"not-needed\",\n\t\"unresolved\",\n\t\"recovering\",\n\t\"recovered\",\n\t\"failed\",\n]);\nexport type DiagnosticRecoveryStatus = typeof DiagnosticRecoveryStatus.Type;\n\nexport const DiagnosticRuntimeKind = Schema.Literals([\"desktop\", \"serve\"]);\nexport type DiagnosticRuntimeKind = typeof DiagnosticRuntimeKind.Type;\n\nexport const DiagnosticCaptureMode = Schema.Literals([\"incident\", \"full\"]);\nexport type DiagnosticCaptureMode = typeof DiagnosticCaptureMode.Type;\n\nexport const DiagnosticEvent = Schema.Struct({\n\tid: Schema.String,\n\tcreatedAt: Schema.String,\n\tseverity: DiagnosticSeverity,\n\tsource: Schema.String,\n\tcategory: Schema.String,\n\tmessage: Schema.String,\n\tdetail: Schema.optional(Schema.String),\n\tfingerprint: Schema.String,\n\trunId: Schema.String,\n\trecoveryStatus: DiagnosticRecoveryStatus,\n\ttraceId: Schema.optional(Schema.String),\n\tspanId: Schema.optional(Schema.String),\n\tprojectId: Schema.optional(Schema.NullOr(Schema.String)),\n\tchatId: Schema.optional(Schema.NullOr(Schema.String)),\n\tsessionId: Schema.optional(Schema.NullOr(Schema.String)),\n\tproviderId: Schema.optional(Schema.NullOr(Schema.String)),\n\tdurationMs: Schema.optional(Schema.Number),\n\truntimeKind: Schema.optional(DiagnosticRuntimeKind),\n\tcaptureMode: Schema.optional(DiagnosticCaptureMode),\n});\nexport type DiagnosticEvent = typeof DiagnosticEvent.Type;\n\nexport const DiagnosticFailureGroup = Schema.Struct({\n\tfingerprint: Schema.String,\n\tseverity: DiagnosticSeverity,\n\tsource: Schema.String,\n\tmessage: Schema.String,\n\tcount: Schema.Number,\n\tfirstSeenAt: Schema.String,\n\tlastSeenAt: Schema.String,\n\trecoveredCount: Schema.Number,\n});\nexport type DiagnosticFailureGroup = typeof DiagnosticFailureGroup.Type;\n\nexport class DiagnosticsOverviewResult extends Schema.Class<DiagnosticsOverviewResult>(\n\t\"DiagnosticsOverviewResult\",\n)({\n\tstatus: Schema.Literals([\"healthy\", \"degraded\", \"failing\"]),\n\trunId: Schema.String,\n\treadAt: Schema.String,\n\teventCount: Schema.Number,\n\terrorCount: Schema.Number,\n\twarningCount: Schema.Number,\n\tfatalCount: Schema.Number,\n\tslowOperationCount: Schema.Number,\n\tparseErrorCount: Schema.Number,\n\tunseenCount: Schema.Number,\n\tstorageBytes: Schema.Number,\n\tcapturePaused: Schema.Boolean,\n\tcaptureMode: DiagnosticCaptureMode,\n\tfullCaptureEndsAt: Schema.NullOr(Schema.String),\n\tdroppedEventCount: Schema.Number,\n\ttruncatedEventCount: Schema.Number,\n\tpreviousRunUnclean: Schema.Boolean,\n\tlatestIncidents: Schema.Array(DiagnosticEvent),\n\tcommonFailures: Schema.Array(DiagnosticFailureGroup),\n\tslowestOperations: Schema.Array(DiagnosticEvent),\n\ttopOperations: Schema.Array(\n\t\tSchema.Struct({\n\t\t\tname: Schema.String,\n\t\t\tcount: Schema.Number,\n\t\t\tfailureCount: Schema.Number,\n\t\t\taverageDurationMs: Schema.Number,\n\t\t\tp95DurationMs: Schema.Number,\n\t\t\tmaxDurationMs: Schema.Number,\n\t\t}),\n\t),\n}) {}\n\nexport class DiagnosticsEventsResult extends Schema.Class<DiagnosticsEventsResult>(\n\t\"DiagnosticsEventsResult\",\n)({\n\tevents: Schema.Array(DiagnosticEvent),\n\tnextCursor: Schema.NullOr(Schema.String),\n\ttotal: Schema.Number,\n}) {}\n\nexport const DiagnosticProcess = Schema.Struct({\n\tpid: Schema.Number,\n\tparentPid: Schema.Number,\n\tdepth: Schema.Number,\n\tname: Schema.String,\n\tcommand: Schema.String,\n\tcpuPercent: Schema.Number,\n\trssBytes: Schema.Number,\n\tuptimeSeconds: Schema.Number,\n\tchildPids: Schema.Array(Schema.Number),\n});\nexport type DiagnosticProcess = typeof DiagnosticProcess.Type;\n\nexport class DiagnosticsProcessesResult extends Schema.Class<DiagnosticsProcessesResult>(\n\t\"DiagnosticsProcessesResult\",\n)({\n\tsupported: Schema.Boolean,\n\treadAt: Schema.String,\n\tserverPid: Schema.Number,\n\tprocesses: Schema.Array(DiagnosticProcess),\n\ttotalCpuPercent: Schema.Number,\n\ttotalRssBytes: Schema.Number,\n\terror: Schema.optional(Schema.String),\n}) {}\n\nexport class DiagnosticsSignalResult extends Schema.Class<DiagnosticsSignalResult>(\n\t\"DiagnosticsSignalResult\",\n)({ signaled: Schema.Boolean, message: Schema.optional(Schema.String) }) {}\n\nexport class DiagnosticsCaptureResult extends Schema.Class<DiagnosticsCaptureResult>(\n\t\"DiagnosticsCaptureResult\",\n)({\n\tcaptureMode: DiagnosticCaptureMode,\n\tfullCaptureEndsAt: Schema.NullOr(Schema.String),\n}) {}\n\nexport const DiagnosticsCapturePayload = Schema.Union([\n\tSchema.Struct({ mode: Schema.Literal(\"incident\") }),\n\tSchema.Struct({\n\t\tmode: Schema.Literal(\"full\"),\n\t\tdurationMinutes: Schema.Literals([5, 15, 30]),\n\t}),\n]);\nexport type DiagnosticsCapturePayload = typeof DiagnosticsCapturePayload.Type;\n\nconst DiagnosticArtifactName = Schema.String;\nconst DiagnosticsLogEntry = Schema.Struct({\n\tcreatedAt: Schema.String,\n\tlevel: Schema.Literals([\"debug\", \"info\", \"warn\", \"error\"]),\n\tsource: Schema.String,\n\tmessage: Schema.String,\n\tdetail: Schema.optional(Schema.String),\n});\nconst DiagnosticsUiAction = Schema.Struct({\n\tcreatedAt: Schema.String,\n\taction: Schema.String,\n\tdetail: Schema.optional(Schema.String),\n});\nconst DiagnosticsClientContext = Schema.Struct({\n\tview: Schema.optional(Schema.String),\n\tsettingsSection: Schema.optional(Schema.String),\n\tactiveMainTab: Schema.optional(Schema.String),\n\tselectedFolderId: Schema.optional(Schema.NullOr(Schema.String)),\n\tselectedChatId: Schema.optional(Schema.NullOr(Schema.String)),\n\tactiveSessionId: Schema.optional(Schema.NullOr(Schema.String)),\n\topenFile: Schema.optional(Schema.NullOr(Schema.String)),\n\trightSidebarOpen: Schema.optional(Schema.Boolean),\n\tleftSidebarOpen: Schema.optional(Schema.Boolean),\n\trecentUiActions: Schema.Array(DiagnosticsUiAction),\n\trendererLogs: Schema.Array(DiagnosticsLogEntry),\n\tmainProcessLogs: Schema.Array(DiagnosticsLogEntry),\n});\n\nexport class DiagnosticsExportResult extends Schema.Class<DiagnosticsExportResult>(\n\t\"DiagnosticsExportResult\",\n)({\n\tdiagnosticId: Schema.String,\n\tcreatedAt: Schema.DateFromString,\n\tbundlePath: Schema.String,\n\tsummary: Schema.String,\n\tincluded: Schema.Array(DiagnosticArtifactName),\n}) {}\n\nexport class DiagnosticsExportError extends Schema.TaggedErrorClass<DiagnosticsExportError>()(\n\t\"DiagnosticsExportError\",\n\t{ reason: Schema.String },\n) {}\n\nconst DiagnosticsError = DiagnosticsExportError;\n\nexport const DiagnosticsOverviewRpc = Rpc.make(\"diagnostics.overview\", {\n\tpayload: Schema.Struct({ since: Schema.optional(Schema.String) }),\n\tsuccess: DiagnosticsOverviewResult,\n\terror: DiagnosticsError,\n});\n\nexport const DiagnosticsEventsRpc = Rpc.make(\"diagnostics.events\", {\n\tpayload: Schema.Struct({\n\t\tcursor: Schema.optional(Schema.String),\n\t\tlimit: Schema.optional(Schema.Number),\n\t\tseverities: Schema.optional(Schema.Array(DiagnosticSeverity)),\n\t\tsource: Schema.optional(Schema.String),\n\t\tsearch: Schema.optional(Schema.String),\n\t\tsince: Schema.optional(Schema.String),\n\t}),\n\tsuccess: DiagnosticsEventsResult,\n\terror: DiagnosticsError,\n});\n\nexport const DiagnosticsProcessesRpc = Rpc.make(\"diagnostics.processes\", {\n\tsuccess: DiagnosticsProcessesResult,\n\terror: DiagnosticsError,\n});\n\nexport const DiagnosticsSignalRpc = Rpc.make(\"diagnostics.signalProcess\", {\n\tpayload: Schema.Struct({\n\t\tpid: Schema.Number,\n\t\tsignal: Schema.Literals([\"interrupt\", \"terminate\", \"kill\"]),\n\t}),\n\tsuccess: DiagnosticsSignalResult,\n\terror: DiagnosticsError,\n});\n\nexport const DiagnosticsIngestRpc = Rpc.make(\"diagnostics.ingest\", {\n\tpayload: Schema.Struct({ events: Schema.Array(DiagnosticEvent) }),\n\tsuccess: Schema.Void,\n\terror: DiagnosticsError,\n});\n\nexport const DiagnosticsCaptureRpc = Rpc.make(\"diagnostics.capture\", {\n\tpayload: DiagnosticsCapturePayload,\n\tsuccess: DiagnosticsCaptureResult,\n\terror: DiagnosticsError,\n});\n\nexport const DiagnosticsExportRpc = Rpc.make(\"diagnostics.export\", {\n\tpayload: Schema.Struct({\n\t\tclientContext: Schema.optional(DiagnosticsClientContext),\n\t\tsince: Schema.optional(Schema.String),\n\t\tincludeSessionEvents: Schema.optional(Schema.Boolean),\n\t}),\n\tsuccess: DiagnosticsExportResult,\n\terror: DiagnosticsExportError,\n});\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { DirectoryUnavailableError, FsFolderNotFoundError } from \"./fs.ts\";\nimport { FolderId, WorktreeId } from \"./ids.ts\";\n\nexport class Folder extends Schema.Class<Folder>(\"Folder\")({\n\tid: FolderId,\n\tpath: Schema.String,\n\tname: Schema.String,\n\taddedAt: Schema.DateFromString,\n}) {}\n\nexport const WorkspaceDirectoryEntryKind = Schema.Literals([\n\t\"directory\",\n\t\"file\",\n]);\nexport type WorkspaceDirectoryEntryKind =\n\ttypeof WorkspaceDirectoryEntryKind.Type;\n\nexport class WorkspaceDirectoryEntry extends Schema.Class<WorkspaceDirectoryEntry>(\n\t\"WorkspaceDirectoryEntry\",\n)({\n\tname: Schema.String,\n\tpath: Schema.String,\n\tkind: WorkspaceDirectoryEntryKind,\n}) {}\n\nexport class WorkspaceDirectoryListing extends Schema.Class<WorkspaceDirectoryListing>(\n\t\"WorkspaceDirectoryListing\",\n)({\n\tpath: Schema.String,\n\tparent: Schema.NullOr(Schema.String),\n\tentries: Schema.Array(WorkspaceDirectoryEntry),\n}) {}\n\nexport class WorkspaceDuplicatePathError extends Schema.TaggedErrorClass<WorkspaceDuplicatePathError>()(\n\t\"WorkspaceDuplicatePathError\",\n\t{ path: Schema.String },\n) {}\n\nexport class WorkspaceNotFoundError extends Schema.TaggedErrorClass<WorkspaceNotFoundError>()(\n\t\"WorkspaceNotFoundError\",\n\t{ folderId: FolderId },\n) {}\n\nexport class WorkspaceInvalidPathError extends Schema.TaggedErrorClass<WorkspaceInvalidPathError>()(\n\t\"WorkspaceInvalidPathError\",\n\t{ path: Schema.String, reason: Schema.String },\n) {}\n\n/**\n * Returned when `git clone` (or any prerequisite step like resolving the\n * derived folder name, or creating the parent dir) fails. `reason` carries\n * trimmed stderr or a human-readable explanation; the renderer surfaces it\n * inline under the URL field.\n */\nexport class WorkspaceCloneFailedError extends Schema.TaggedErrorClass<WorkspaceCloneFailedError>()(\n\t\"WorkspaceCloneFailedError\",\n\t{ url: Schema.String, reason: Schema.String },\n) {}\n\n/**\n * Returned when template scaffolding fails. `step` is \"mkdir\" | \"git-init\"\n * | \"template\" | \"install\" | \"gh-create\" — lets the dialog point the user\n * at the right corrective action. `reason` is trimmed stderr.\n */\nexport class WorkspaceCreateFailedError extends Schema.TaggedErrorClass<WorkspaceCreateFailedError>()(\n\t\"WorkspaceCreateFailedError\",\n\t{\n\t\tname: Schema.String,\n\t\tstep: Schema.Literals([\n\t\t\t\"mkdir\",\n\t\t\t\"git-init\",\n\t\t\t\"template\",\n\t\t\t\"install\",\n\t\t\t\"gh-create\",\n\t\t]),\n\t\treason: Schema.String,\n\t},\n) {}\n\n/**\n * One entry in the Clone-dialog's recents list. Populated by\n * `workspace.listGithubRepos` which shells out to `gh repo list --json`.\n * `sshUrl` is preferred when the user has SSH keys; `httpsUrl` is the\n * gh-CLI-friendly fallback.\n */\nexport class GithubRepoSummary extends Schema.Class<GithubRepoSummary>(\n\t\"GithubRepoSummary\",\n)({\n\tnameWithOwner: Schema.String,\n\tdescription: Schema.NullOr(Schema.String),\n\tsshUrl: Schema.String,\n\thttpsUrl: Schema.String,\n\tisPrivate: Schema.Boolean,\n\tdefaultBranch: Schema.String,\n\tupdatedAt: Schema.DateFromString,\n}) {}\n\n/**\n * Identifier for the \"Quick start\" template grid. Adding a card later is\n * a one-line change here + a new branch in `project-scaffold-live.ts`.\n */\nexport const ProjectTemplate = Schema.Literals([\n\t\"empty\",\n\t\"nextjs\",\n\t\"turborepo\",\n]);\nexport type ProjectTemplate = typeof ProjectTemplate.Type;\n\nexport const WorkspaceAddRpc = Rpc.make(\"workspace.add\", {\n\tpayload: Schema.Struct({ path: Schema.String }),\n\tsuccess: Folder,\n\terror: Schema.Union([WorkspaceDuplicatePathError, WorkspaceInvalidPathError]),\n});\n\nexport const WorkspaceListRpc = Rpc.make(\"workspace.list\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: Schema.Array(Folder),\n});\n\n/** Current workspace folders, followed by a fresh snapshot after add/remove. */\nexport const WorkspaceStreamChangesRpc = Rpc.make(\"workspace.streamChanges\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: Schema.Array(Folder),\n\tstream: true,\n});\n\nexport const WorkspaceRemoveRpc = Rpc.make(\"workspace.remove\", {\n\tpayload: Schema.Struct({ folderId: FolderId }),\n\tsuccess: Schema.Void,\n\terror: WorkspaceNotFoundError,\n});\n\nexport const WorkspacePickFolderRpc = Rpc.make(\"workspace.pickFolder\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: Schema.NullOr(Schema.String),\n});\n\n/**\n * Browse a directory on the RPC-owning environment. Unlike `fs.tree`, this is\n * intentionally not project-scoped because it is used to choose where a new\n * project will be created. Empty input resolves to the environment's default\n * project parent (`~/Developer` when present, otherwise home).\n */\nexport const WorkspaceBrowseDirectoryRpc = Rpc.make(\n\t\"workspace.browseDirectory\",\n\t{\n\t\tpayload: Schema.Struct({ path: Schema.String }),\n\t\tsuccess: WorkspaceDirectoryListing,\n\t\terror: WorkspaceInvalidPathError,\n\t},\n);\n\nexport const WorkspaceGetSelectedRpc = Rpc.make(\"workspace.getSelected\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: Schema.NullOr(FolderId),\n});\n\nexport const WorkspaceSetSelectedRpc = Rpc.make(\"workspace.setSelected\", {\n\tpayload: Schema.Struct({ folderId: Schema.NullOr(FolderId) }),\n\tsuccess: Schema.Void,\n});\n\n/**\n * Clone a public/private repo into `<parent>/<derived-name>` and register\n * the result as a workspace folder. Folder name is derived from the URL's\n * last path segment with `.git` stripped — server fails with\n * `WorkspaceCloneFailedError` if the derivation is empty.\n *\n * The handler chains: derive name → ensure target doesn't already exist →\n * `git clone --progress <url> <parent>/<name>` → `WorkspaceService.add`.\n * A `null` or empty `parent` means \"use a sensible default\" (resolved on\n * the server: `~/Developer` if it exists, else home).\n */\nexport const WorkspaceCloneRepoRpc = Rpc.make(\"workspace.cloneRepo\", {\n\tpayload: Schema.Struct({\n\t\turl: Schema.String,\n\t\tparent: Schema.String,\n\t}),\n\tsuccess: Folder,\n\terror: Schema.Union([\n\t\tWorkspaceCloneFailedError,\n\t\tWorkspaceInvalidPathError,\n\t\tWorkspaceDuplicatePathError,\n\t]),\n});\n\n/**\n * Create a new project from a template, run `git init`, and register it.\n * `name` is validated (`^[a-z0-9][a-z0-9-_]*$`) so downstream `bunx\n * create-next-app <name>` invocations never reject the argument.\n *\n * `alsoCreateGithubRepo`, when true, runs `gh repo create --private\n * --source . --push` after the scaffold. The renderer only enables the\n * checkbox when `gh` is authenticated — see `workspace.ghAuthStatus`.\n */\nexport const WorkspaceCreateProjectRpc = Rpc.make(\"workspace.createProject\", {\n\tpayload: Schema.Struct({\n\t\tname: Schema.String,\n\t\tparent: Schema.String,\n\t\ttemplate: ProjectTemplate,\n\t\talsoCreateGithubRepo: Schema.optional(Schema.Boolean),\n\t}),\n\tsuccess: Folder,\n\terror: Schema.Union([\n\t\tWorkspaceCreateFailedError,\n\t\tWorkspaceInvalidPathError,\n\t\tWorkspaceDuplicatePathError,\n\t]),\n});\n\n/**\n * Returns the signed-in user's GitHub repos (most recently pushed first)\n * for the Clone dialog's \"Recent repos\" list. Empty array when `gh` is\n * missing, the user isn't signed in, or the call errors — the renderer\n * shows a one-line `gh auth login` hint instead.\n */\nexport const WorkspaceListGithubReposRpc = Rpc.make(\n\t\"workspace.listGithubRepos\",\n\t{\n\t\tpayload: Schema.Struct({ limit: Schema.optional(Schema.Number) }),\n\t\tsuccess: Schema.Array(GithubRepoSummary),\n\t},\n);\n\n/**\n * Quick \"is gh signed in?\" probe so the Quick start dialog can disable\n * its \"Also create a private GitHub repo\" checkbox when it would just\n * fail. Returns `false` for missing gh, signed-out, or any error — the\n * dialog never needs to distinguish.\n */\nexport const WorkspaceGhAuthStatusRpc = Rpc.make(\"workspace.ghAuthStatus\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: Schema.Struct({ authenticated: Schema.Boolean }),\n});\n\n/**\n * Walk the project's file tree honouring `.gitignore` and return up to\n * `limit` matches against `query`. Backs the composer's `@` file picker.\n * Empty `query` returns the most recently touched entries (server's call).\n *\n * When `worktreeId` is set the walk is rooted at the worktree's path instead\n * of the project's main checkout, so a session running on a worktree only\n * surfaces files that actually live in that worktree. Mirrors the optional\n * `worktreeId` on the `fs.*` RPCs; the server falls back to the project root\n * silently if the worktree doesn't belong to `projectId`.\n */\nexport const WorkspaceSearchFilesRpc = Rpc.make(\"workspace.searchFiles\", {\n\tpayload: Schema.Struct({\n\t\tprojectId: FolderId,\n\t\tquery: Schema.String,\n\t\tlimit: Schema.optional(Schema.Number),\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Array(\n\t\tSchema.Struct({\n\t\t\trelPath: Schema.String,\n\t\t\tabsPath: Schema.String,\n\t\t\tkind: Schema.Literals([\"file\", \"directory\"]),\n\t\t}),\n\t),\n\terror: Schema.Union([FsFolderNotFoundError, DirectoryUnavailableError]),\n});\n","import { Rpc } from \"effect/unstable/rpc\";\nimport { Schema } from \"effect\";\n\nimport { ProviderId } from \"./agent.ts\";\nimport { Chat, Message, ResumeStrategy, Session } from \"./session.ts\";\nimport { Worktree } from \"./worktree.ts\";\nimport { Folder } from \"./workspace.ts\";\n\nexport class ExternalThread extends Schema.Class<ExternalThread>(\n \"ExternalThread\",\n)({\n id: Schema.String,\n providerId: ProviderId,\n title: Schema.String,\n preview: Schema.String,\n projectPath: Schema.String,\n projectName: Schema.String,\n updatedAt: Schema.DateFromString,\n sourcePath: Schema.NullOr(Schema.String),\n cursor: Schema.String,\n resumeStrategy: ResumeStrategy,\n available: Schema.Boolean,\n}) {}\n\nexport const ContinueExternalThreadInput = Schema.Struct({\n providerId: ProviderId,\n cursor: Schema.String,\n projectPath: Schema.String,\n title: Schema.optional(Schema.String),\n sourcePath: Schema.optional(Schema.NullOr(Schema.String)),\n});\nexport type ContinueExternalThreadInput =\n typeof ContinueExternalThreadInput.Type;\n\nexport class ContinueExternalThreadResult extends Schema.Class<ContinueExternalThreadResult>(\n \"ContinueExternalThreadResult\",\n)({\n project: Folder,\n worktree: Schema.NullOr(Worktree),\n chat: Chat,\n session: Session,\n messages: Schema.Array(Message),\n}) {}\n\nexport const ExternalThreadsListRpc = Rpc.make(\"externalThreads.list\", {\n payload: Schema.Struct({\n limit: Schema.optional(Schema.Number),\n }),\n success: Schema.Array(ExternalThread),\n});\n\nexport const ExternalThreadsContinueRpc = Rpc.make(\"externalThreads.continue\", {\n payload: ContinueExternalThreadInput,\n success: ContinueExternalThreadResult,\n});\n","import { Effect, Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { FolderId, WorktreeId } from \"./ids.ts\";\n\nexport class GitCommit extends Schema.Class<GitCommit>(\"GitCommit\")({\n\tsha: Schema.String,\n\tshortSha: Schema.String,\n\tsubject: Schema.String,\n\tauthorName: Schema.String,\n\tauthoredAt: Schema.DateFromString,\n\tparents: Schema.Array(Schema.String),\n}) {}\n\nexport class GitStatusSummary extends Schema.Class<GitStatusSummary>(\n\t\"GitStatusSummary\",\n)({\n\tbranch: Schema.NullOr(Schema.String),\n\tahead: Schema.Number,\n\tbehind: Schema.Number,\n\tdirtyFiles: Schema.Number,\n}) {}\n\nexport const GitBranchKind = Schema.Literals([\"local\", \"remote\"]);\nexport type GitBranchKind = typeof GitBranchKind.Type;\n\nexport class GitBranchInfo extends Schema.Class<GitBranchInfo>(\"GitBranchInfo\")(\n\t{\n\t\tname: Schema.String,\n\t\tcurrent: Schema.Boolean,\n\t\tremote: Schema.NullOr(Schema.String),\n\t\tupstream: Schema.NullOr(Schema.String),\n\t\tkind: GitBranchKind,\n\t},\n) {}\n\nexport class GitNotARepoError extends Schema.TaggedErrorClass<GitNotARepoError>()(\n\t\"GitNotARepoError\",\n\t{ folderId: FolderId },\n) {}\n\nexport class GitNotInstalledError extends Schema.TaggedErrorClass<GitNotInstalledError>()(\n\t\"GitNotInstalledError\",\n\t{},\n) {}\n\nexport class GitCommandError extends Schema.TaggedErrorClass<GitCommandError>()(\n\t\"GitCommandError\",\n\t{ folderId: FolderId, reason: Schema.String },\n) {}\n\nexport class GitFolderNotFoundError extends Schema.TaggedErrorClass<GitFolderNotFoundError>()(\n\t\"GitFolderNotFoundError\",\n\t{ folderId: FolderId },\n) {}\n\nconst GitErrors = Schema.Union([\n\tGitNotARepoError,\n\tGitNotInstalledError,\n\tGitCommandError,\n\tGitFolderNotFoundError,\n]);\n\nexport const GitLogRpc = Rpc.make(\"git.log\", {\n\tpayload: Schema.Struct({ folderId: FolderId, limit: Schema.Number }),\n\tsuccess: Schema.Array(GitCommit),\n\terror: GitErrors,\n});\n\nexport const GitStatusRpc = Rpc.make(\"git.status\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\t/**\n\t\t * When set, run `git status` inside the worktree path so the branch +\n\t\t * dirty/ahead counts reflect the worktree, not the main checkout.\n\t\t */\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: GitStatusSummary,\n\terror: GitErrors,\n});\n\nexport const GitBranchesRpc = Rpc.make(\"git.branches\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Array(GitBranchInfo),\n\terror: GitErrors,\n});\n\nexport const GitSwitchBranchRpc = Rpc.make(\"git.switchBranch\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\tbranch: Schema.String,\n\t\tremote: Schema.optional(Schema.NullOr(Schema.String)),\n\t}),\n\tsuccess: GitStatusSummary,\n\terror: GitErrors,\n});\n\nexport const GitRenameBranchRpc = Rpc.make(\"git.renameBranch\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\tname: Schema.String,\n\t}),\n\tsuccess: GitStatusSummary,\n\terror: GitErrors,\n});\n\n/**\n * `git config user.name` for the folder, trimmed. Returns an empty string\n * when unset. Used by the auto-namer to build `username/<slug>` branch names\n * (the name is slugified before use).\n */\nexport const GitUserNameRpc = Rpc.make(\"git.userName\", {\n\tpayload: Schema.Struct({ folderId: FolderId }),\n\tsuccess: Schema.Struct({ userName: Schema.String }),\n\terror: GitErrors,\n});\n\n/**\n * Coalesced invalidation for one explicit repository checkout. The first\n * frame is emitted immediately, then filesystem/index/HEAD changes advance a\n * monotonic revision. Clients re-read their materialized Git resource after\n * each revision; no transcript or patch payload is duplicated in this stream.\n */\nexport const GitWorkspaceChangesRpc = Rpc.make(\"git.workspaceChanges\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Struct({ revision: Schema.Number }),\n\terror: GitErrors,\n\tstream: true,\n});\n\nexport class GitOriginInfo extends Schema.Class<GitOriginInfo>(\"GitOriginInfo\")(\n\t{\n\t\thost: Schema.String,\n\t\towner: Schema.String,\n\t\trepo: Schema.String,\n\t\t/** Credential-free URL suitable for cloning on another environment. */\n\t\tcloneUrl: Schema.optional(Schema.String),\n\t},\n) {}\n\nexport const GitOriginRpc = Rpc.make(\"git.origin\", {\n\tpayload: Schema.Struct({ folderId: FolderId }),\n\tsuccess: Schema.NullOr(GitOriginInfo),\n\terror: GitErrors,\n});\n\n/**\n * State of the GitHub PR (if any) opened from the folder's current HEAD branch\n * against its upstream. `gh pr view --json state,additions,deletions,...` is\n * the source of truth — when `gh` is missing or no PR exists, this returns\n * `{ state: \"none\" }` and the renderer falls back to a plain timestamp.\n */\nexport const GitPrState = Schema.Literals([\"none\", \"open\", \"closed\", \"merged\"]);\nexport type GitPrState = typeof GitPrState.Type;\n\n/**\n * Aggregated CI rollup status for the PR's HEAD commit.\n * none — PR has no required checks, or `gh` couldn't read the rollup.\n * pending — at least one check still running / queued.\n * success — all checks passed.\n * failure — at least one check failed (cancelled / errored counts as fail).\n */\nexport const GitPrChecks = Schema.Literals([\n\t\"none\",\n\t\"pending\",\n\t\"success\",\n\t\"failure\",\n]);\nexport type GitPrChecks = typeof GitPrChecks.Type;\n\n/**\n * Merge-conflict state from `gh pr view --json mergeable`.\n * clean — GitHub says the PR is mergeable.\n * conflicting — at least one path in the branch conflicts with the base.\n * unknown — GitHub hasn't computed it yet, no PR exists, or `gh` couldn't read it.\n */\nexport const GitPrMergeable = Schema.Literals([\n\t\"clean\",\n\t\"conflicting\",\n\t\"unknown\",\n]);\nexport type GitPrMergeable = typeof GitPrMergeable.Type;\n\nexport class GitPrInfo extends Schema.Class<GitPrInfo>(\"GitPrInfo\")({\n\tstate: GitPrState,\n\tbranch: Schema.NullOr(Schema.String),\n\tbaseBranch: Schema.NullOr(Schema.String),\n\tadditions: Schema.Number,\n\tdeletions: Schema.Number,\n\tnumber: Schema.NullOr(Schema.Number),\n\turl: Schema.NullOr(Schema.String),\n\tisDraft: Schema.Boolean,\n\tchecks: GitPrChecks,\n\tmergeable: GitPrMergeable,\n\t/**\n\t * Per-check counts derived from the same `statusCheckRollup` that feeds\n\t * `checks`. Lets the top bar render \"N checks running\" without the heavier\n\t * `prDetails` round-trip. `checksTotal === 0` means the PR has no checks.\n\t */\n\tchecksTotal: Schema.Number,\n\tchecksRunning: Schema.Number,\n\tchecksPassing: Schema.Number,\n\tchecksFailing: Schema.Number,\n\t/**\n\t * True when GitHub has a pending auto-merge request on this PR (`gh pr view\n\t * --json autoMergeRequest` is non-null). Reflects the \"Auto-merge on success\"\n\t * toggle's real, server-side state.\n\t */\n\tautoMergeEnabled: Schema.Boolean,\n}) {}\n\nexport const GitPrStateRpc = Rpc.make(\"git.prState\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\t/**\n\t\t * When set, runs `gh pr view` inside the worktree's path so the result\n\t\t * reflects the worktree's branch — each worktree has its own branch,\n\t\t * each branch has its own PR (or none).\n\t\t */\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: GitPrInfo,\n\terror: GitErrors,\n});\n\nexport class GitPrComment extends Schema.Class<GitPrComment>(\"GitPrComment\")({\n\tauthor: Schema.String,\n\tauthorAvatarUrl: Schema.optional(Schema.NullOr(Schema.String)),\n\tbody: Schema.String,\n\tcreatedAt: Schema.DateFromString,\n}) {}\n\nexport const GitPrReviewState = Schema.Literals([\n\t\"approved\",\n\t\"changes_requested\",\n\t\"commented\",\n\t\"dismissed\",\n\t\"pending\",\n]);\nexport type GitPrReviewState = typeof GitPrReviewState.Type;\n\nexport class GitPrReview extends Schema.Class<GitPrReview>(\"GitPrReview\")({\n\tauthor: Schema.String,\n\tauthorAvatarUrl: Schema.optional(Schema.NullOr(Schema.String)),\n\tstate: GitPrReviewState,\n\tbody: Schema.String,\n\tsubmittedAt: Schema.NullOr(Schema.DateFromString),\n}) {}\n\nexport class GitPrFile extends Schema.Class<GitPrFile>(\"GitPrFile\")({\n\tpath: Schema.String,\n\tadditions: Schema.Number,\n\tdeletions: Schema.Number,\n}) {}\n\nexport const GitPrCheckRunStatus = Schema.Literals([\n\t\"queued\",\n\t\"in_progress\",\n\t\"completed\",\n\t\"pending\",\n]);\nexport type GitPrCheckRunStatus = typeof GitPrCheckRunStatus.Type;\n\nexport const GitPrCheckRunConclusion = Schema.Literals([\n\t\"success\",\n\t\"failure\",\n\t\"cancelled\",\n\t\"skipped\",\n\t\"neutral\",\n\t\"timed_out\",\n\t\"action_required\",\n]);\nexport type GitPrCheckRunConclusion = typeof GitPrCheckRunConclusion.Type;\n\nexport class GitPrCheckRun extends Schema.Class<GitPrCheckRun>(\"GitPrCheckRun\")(\n\t{\n\t\tname: Schema.String,\n\t\tstatus: GitPrCheckRunStatus,\n\t\tconclusion: Schema.NullOr(GitPrCheckRunConclusion),\n\t\turl: Schema.NullOr(Schema.String),\n\t\tworkflowName: Schema.optional(Schema.NullOr(Schema.String)),\n\t\trunId: Schema.optional(Schema.NullOr(Schema.String)),\n\t\tjobId: Schema.optional(Schema.NullOr(Schema.String)),\n\t\trunnerName: Schema.optional(Schema.NullOr(Schema.String)),\n\t\trunnerGroupName: Schema.optional(Schema.NullOr(Schema.String)),\n\t\tstartedAt: Schema.optional(Schema.NullOr(Schema.DateFromString)),\n\t\tcompletedAt: Schema.optional(Schema.NullOr(Schema.DateFromString)),\n\t\trunUrl: Schema.optional(Schema.NullOr(Schema.String)),\n\t},\n) {}\n\n/**\n * Heavier per-PR payload than {@link GitPrInfo}: title, body, reviews, comments,\n * files changed, and the per-run check breakdown. Fetched lazily when the PR\n * pane is open — `git.prState` keeps its lightweight contract for the sidebar.\n */\nexport class GitPrDetails extends Schema.Class<GitPrDetails>(\"GitPrDetails\")({\n\tstate: GitPrState,\n\tnumber: Schema.NullOr(Schema.Number),\n\turl: Schema.NullOr(Schema.String),\n\tisDraft: Schema.Boolean,\n\tchecks: GitPrChecks,\n\tmergeable: GitPrMergeable,\n\tadditions: Schema.Number,\n\tdeletions: Schema.Number,\n\ttitle: Schema.String,\n\tbody: Schema.String,\n\tauthor: Schema.String,\n\tbaseBranch: Schema.NullOr(Schema.String),\n\theadBranch: Schema.NullOr(Schema.String),\n\tcomments: Schema.Array(GitPrComment),\n\treviews: Schema.Array(GitPrReview),\n\tfiles: Schema.Array(GitPrFile),\n\tcheckRuns: Schema.Array(GitPrCheckRun),\n}) {}\n\nexport const GitPrDetailsRpc = Rpc.make(\"git.prDetails\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: GitPrDetails,\n\terror: GitErrors,\n});\n\n/** Post one inline review comment to the pull request for the current branch. */\nexport const GitCreateReviewCommentRpc = Rpc.make(\"git.createReviewComment\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\tpath: Schema.String,\n\t\tline: Schema.Number,\n\t\tside: Schema.Literals([\"additions\", \"deletions\"]),\n\t\tbody: Schema.String,\n\t}),\n\tsuccess: Schema.Struct({ url: Schema.NullOr(Schema.String) }),\n\terror: GitErrors,\n});\n\n/** Identity used to author review comments from the current GitHub account. */\nexport const GitReviewIdentityRpc = Rpc.make(\"git.reviewIdentity\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.NullOr(\n\t\tSchema.Struct({\n\t\t\tname: Schema.String,\n\t\t\tavatarUrl: Schema.NullOr(Schema.String),\n\t\t}),\n\t),\n\terror: GitErrors,\n});\n\n/**\n * Lightweight PR row for the \"Create from…\" picker. One entry per open PR from\n * `gh pr list`. `headRefName` is the PR's branch — the picker checks it out\n * into a worktree and pins the new chat to it. `updatedAt` drives the \"most\n * recently touched first\" ordering the picker shows.\n */\nexport class GitPrSummary extends Schema.Class<GitPrSummary>(\"GitPrSummary\")({\n\tnumber: Schema.Number,\n\ttitle: Schema.String,\n\tauthor: Schema.String,\n\theadRefName: Schema.String,\n\tisDraft: Schema.Boolean,\n\tstate: Schema.String,\n\tupdatedAt: Schema.DateFromString,\n}) {}\n\n/**\n * Lightweight issue row for the \"Create from…\" picker. Selecting one fetches\n * its Markdown (`git.issueMarkdown`) to attach + pre-fill the composer; issues\n * have no branch so they never check out a worktree.\n */\nexport class GitIssueSummary extends Schema.Class<GitIssueSummary>(\n\t\"GitIssueSummary\",\n)({\n\tnumber: Schema.Number,\n\ttitle: Schema.String,\n\tauthor: Schema.String,\n\tstate: Schema.String,\n\tlabels: Schema.Array(Schema.String),\n\tupdatedAt: Schema.DateFromString,\n}) {}\n\n/**\n * List open PRs via `gh pr list`. Collapses to an empty array when `gh` is\n * missing / unauthenticated / the repo has no GitHub remote — the picker just\n * shows an empty PRs tab rather than surfacing an error.\n */\nexport const GitListPrsRpc = Rpc.make(\"git.listPrs\", {\n\tpayload: Schema.Struct({ folderId: FolderId }),\n\tsuccess: Schema.Array(GitPrSummary),\n\terror: GitErrors,\n});\n\n/** List open issues via `gh issue list`. Same graceful degradation as listPrs. */\nexport const GitListIssuesRpc = Rpc.make(\"git.listIssues\", {\n\tpayload: Schema.Struct({ folderId: FolderId }),\n\tsuccess: Schema.Array(GitIssueSummary),\n\terror: GitErrors,\n});\n\n/**\n * Render a single issue (`gh issue view`) as Markdown so it can be written to\n * `.context/files/` and attached to a new chat as an `@`-file. The server does\n * the JSON→Markdown formatting so both drivers get identical text.\n */\nexport const GitIssueMarkdownRpc = Rpc.make(\"git.issueMarkdown\", {\n\tpayload: Schema.Struct({ folderId: FolderId, number: Schema.Number }),\n\tsuccess: Schema.Struct({\n\t\tnumber: Schema.Number,\n\t\ttitle: Schema.String,\n\t\turl: Schema.String,\n\t\tmarkdown: Schema.String,\n\t}),\n\terror: GitErrors,\n});\n\n/**\n * Captured CI failure artifact. The server pulled logs for every failing\n * check via `gh run view --log-failed`, concatenated them with run-name\n * dividers, and wrote them to `.zuse/failing-checks-<ts>.txt` inside the\n * worktree. The renderer attaches `relPath` to the composer so the agent can\n * read it as `@<relPath>`.\n */\nexport class GitFailingChecksArtifact extends Schema.Class<GitFailingChecksArtifact>(\n\t\"GitFailingChecksArtifact\",\n)({\n\trelPath: Schema.String,\n\tabsPath: Schema.String,\n\tfailingCount: Schema.Number,\n}) {}\n\nexport const GitFixFailingChecksRpc = Rpc.make(\"git.fixFailingChecks\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: GitFailingChecksArtifact,\n\terror: GitErrors,\n});\n\n/**\n * One entry from `git status --porcelain=v2`. `staged` means the index has\n * changes (X column ≠ '.'); `kind` is the dominant working-tree state. We\n * collapse renames/copies to a path that matches the working-tree side so the\n * Diff tab can wire a click to \"open this file in the editor.\"\n */\nexport const GitChangeKind = Schema.Literals([\n\t\"modified\",\n\t\"added\",\n\t\"deleted\",\n\t\"renamed\",\n\t\"copied\",\n\t\"untracked\",\n\t\"ignored\",\n\t\"unmerged\",\n\t\"type_changed\",\n]);\nexport type GitChangeKind = typeof GitChangeKind.Type;\n\nexport class GitChange extends Schema.Class<GitChange>(\"GitChange\")({\n\tpath: Schema.String,\n\t/**\n\t * Original path for renamed / copied files (the location HEAD knew the\n\t * file under). `null` for every other kind. Lets the renderer surface\n\t * \"old → new\" so a move doesn't silently look like an unrelated edit.\n\t */\n\toldPath: Schema.NullOr(Schema.String),\n\tstaged: Schema.Boolean,\n\tkind: GitChangeKind,\n}) {}\n\nexport const GitChangesRpc = Rpc.make(\"git.changes\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Array(GitChange),\n\terror: GitErrors,\n});\n\n/** One file in the branch review range (merge-base through the worktree). */\nexport class GitReviewFile extends Schema.Class<GitReviewFile>(\"GitReviewFile\")(\n\t{\n\t\tpath: Schema.String,\n\t\toldPath: Schema.NullOr(Schema.String),\n\t\tkind: GitChangeKind,\n\t\tadditions: Schema.Number,\n\t\tdeletions: Schema.Number,\n\t\tbinary: Schema.Boolean,\n\t\tconflict: Schema.Boolean,\n\t\thasUncommittedChanges: Schema.Boolean,\n\t},\n) {}\n\n/** Comparison range used by the multi-file reviewer. */\nexport const GitReviewScope = Schema.Literals([\"unstaged\", \"staged\", \"branch\"]);\nexport type GitReviewScope = typeof GitReviewScope.Type;\n\n/** Stable comparison metadata used by the dock and the multi-file reviewer. */\nexport class GitReviewSummary extends Schema.Class<GitReviewSummary>(\n\t\"GitReviewSummary\",\n)({\n\tbaseRef: Schema.NullOr(Schema.String),\n\theadRef: Schema.NullOr(Schema.String).pipe(\n\t\tSchema.withConstructorDefault(Effect.succeed(null)),\n\t\tSchema.withDecodingDefaultType(Effect.succeed(null)),\n\t),\n\tscope: GitReviewScope.pipe(\n\t\tSchema.withConstructorDefault(Effect.succeed(\"branch\" as const)),\n\t\tSchema.withDecodingDefaultType(Effect.succeed(\"branch\" as const)),\n\t),\n\tbaseSha: Schema.String,\n\theadSha: Schema.String,\n\tfiles: Schema.Array(GitReviewFile),\n\tadditions: Schema.Number,\n\tdeletions: Schema.Number,\n}) {}\n\nexport const GitReviewSummaryRpc = Rpc.make(\"git.reviewSummary\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\tscope: Schema.optional(GitReviewScope),\n\t}),\n\tsuccess: GitReviewSummary,\n\terror: GitErrors,\n});\n\n/**\n * Diff modes returned by `git.diff`. `worktree` is the common case\n * (tracked file with edits); `untracked` is a synthetic /dev/null diff\n * for new files; `deleted` means the file is gone from the working\n * tree but still in HEAD; `binary` and `unchanged` carry no patch text.\n */\nexport const GitDiffMode = Schema.Literals([\n\t\"worktree\",\n\t\"untracked\",\n\t\"deleted\",\n\t\"binary\",\n\t\"unchanged\",\n]);\nexport type GitDiffMode = typeof GitDiffMode.Type;\n\nexport class GitDiffResult extends Schema.Class<GitDiffResult>(\"GitDiffResult\")(\n\t{\n\t\tmode: GitDiffMode,\n\t\tpatch: Schema.String,\n\t\ttruncated: Schema.Boolean,\n\t\tbytes: Schema.Number,\n\t},\n) {}\n\nexport const GitDiffRpc = Rpc.make(\"git.diff\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\tpath: Schema.String,\n\t}),\n\tsuccess: GitDiffResult,\n\terror: GitErrors,\n});\n\nexport class GitReviewPatch extends Schema.Class<GitReviewPatch>(\n\t\"GitReviewPatch\",\n)({\n\tpath: Schema.String,\n\tresult: GitDiffResult,\n\terror: Schema.NullOr(Schema.String),\n}) {}\n\n/** Streams complete per-file patches in review order for incremental rendering. */\nexport const GitReviewPatchesRpc = Rpc.make(\"git.reviewPatches\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\tscope: Schema.optional(GitReviewScope),\n\t}),\n\tsuccess: GitReviewPatch,\n\terror: GitErrors,\n\tstream: true,\n});\n\nexport class GitReviewFileContents extends Schema.Class<GitReviewFileContents>(\n\t\"GitReviewFileContents\",\n)({\n\toldContent: Schema.NullOr(Schema.String),\n\tnewContent: Schema.NullOr(Schema.String),\n\tmtime: Schema.NullOr(Schema.String),\n}) {}\n\n/** Full text is fetched only when hunk expansion or inline editing needs it. */\nexport const GitReviewFileContentsRpc = Rpc.make(\"git.reviewFileContents\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\tpath: Schema.String,\n\t\toldPath: Schema.optional(Schema.NullOr(Schema.String)),\n\t}),\n\tsuccess: GitReviewFileContents,\n\terror: GitErrors,\n});\n\nexport const GitCommitRpc = Rpc.make(\"git.commit\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\tmessage: Schema.String,\n\t\t/**\n\t\t * Explicit set of paths to commit. When provided (and non-empty), only\n\t\t * these paths are staged + committed (`git add -- <paths>` then\n\t\t * `git commit -m … -- <paths>`), so the Changes tab can let the user pick\n\t\t * which files go into the commit. Omitted/empty falls back to the legacy\n\t\t * \"commit everything\" behaviour (`git add -A`).\n\t\t */\n\t\tpaths: Schema.optional(Schema.Array(Schema.String)),\n\t}),\n\tsuccess: Schema.Struct({ sha: Schema.String }),\n\terror: GitErrors,\n});\n\nexport const GitPushRpc = Rpc.make(\"git.push\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Struct({ output: Schema.String }),\n\terror: GitErrors,\n});\n\n/**\n * Persist a resolved merge-conflict file: write the final (marker-free)\n * contents to disk and `git add` it so the path leaves the unmerged state.\n * Backs the Changes tab's inline `@pierre/diffs` `UnresolvedFile` resolver.\n */\nexport const GitResolveConflictRpc = Rpc.make(\"git.resolveConflict\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\tpath: Schema.String,\n\t\tcontents: Schema.String,\n\t}),\n\tsuccess: Schema.Struct({}),\n\terror: GitErrors,\n});\n\n/**\n * Merge method passed to `gh pr merge`. Mirrors GitHub's three merge buttons;\n * the renderer remembers the last-used value (default `merge`).\n */\nexport const GitMergeMethod = Schema.Literals([\"merge\", \"squash\", \"rebase\"]);\nexport type GitMergeMethod = typeof GitMergeMethod.Type;\n\n/**\n * Direct PR merge via `gh pr merge`. No agent involved.\n * merge — merge now: `gh pr merge --<method> [--delete-branch]`\n * enable-auto — arm GitHub-native auto-merge so the PR merges once required\n * checks pass: `gh pr merge --auto --<method> [--delete-branch]`\n * (requires the repo's \"Allow auto-merge\" setting).\n * disable-auto — cancel a pending auto-merge: `gh pr merge --disable-auto`.\n * `gh`'s stderr is surfaced verbatim via GitCommandError so the renderer can\n * show e.g. \"auto-merge is not allowed for this repository\".\n */\nexport const GitMergePrRpc = Rpc.make(\"git.mergePr\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\taction: Schema.Literals([\"merge\", \"enable-auto\", \"disable-auto\"]),\n\t\tmethod: GitMergeMethod,\n\t\tdeleteBranch: Schema.Boolean,\n\t}),\n\tsuccess: Schema.Struct({ output: Schema.String }),\n\terror: GitErrors,\n});\n\n/**\n * Mark a draft PR ready for review via `gh pr ready`. No agent involved.\n */\nexport const GitMarkReadyRpc = Rpc.make(\"git.markReady\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Struct({ output: Schema.String }),\n\terror: GitErrors,\n});\n\n// Initialize a git repository in a project folder that doesn't have one yet.\n// Surfaced from the Changes tab's \"not a Git repository\" empty state. Always\n// runs against the folder root (a worktree can't exist without a repo), so no\n// `worktreeId` here.\nexport const GitInitRpc = Rpc.make(\"git.init\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t}),\n\tsuccess: Schema.Struct({ branch: Schema.String }),\n\terror: GitErrors,\n});\n\n/**\n * Discard a single file's uncommitted changes. Behaviour depends on `kind`:\n * - untracked → delete the new file from disk (`git clean -f`)\n * - everything else → restore index + working tree to HEAD (`git restore`)\n * Surfaced from the Changes tab's per-row hover \"revert\" affordance, always\n * behind a confirm dialog. `kind` lets the server pick the right git command\n * without re-running `status`.\n */\nexport const GitRevertFileRpc = Rpc.make(\"git.revertFile\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\tpath: Schema.String,\n\t\toldPath: Schema.optional(Schema.NullOr(Schema.String)),\n\t\tkind: GitChangeKind,\n\t}),\n\tsuccess: Schema.Struct({ reverted: Schema.Boolean }),\n\terror: GitErrors,\n});\n\n/** Restore one review entry to its merge-base state as a new worktree edit. */\nexport const GitRestoreFileToBaseRpc = Rpc.make(\"git.restoreFileToBase\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t\tpath: Schema.String,\n\t\toldPath: Schema.optional(Schema.NullOr(Schema.String)),\n\t}),\n\tsuccess: Schema.Struct({ restored: Schema.Boolean }),\n\terror: GitErrors,\n});\n\n/**\n * Discard every uncommitted change in the working tree: `git reset --hard\n * HEAD` followed by `git clean -fd` to also remove untracked files/dirs.\n * Destructive and unrecoverable — the Changes tab gates this behind a strong\n * confirm dialog (\"Revert all\").\n */\nexport const GitRevertAllRpc = Rpc.make(\"git.revertAll\", {\n\tpayload: Schema.Struct({\n\t\tfolderId: FolderId,\n\t\tworktreeId: Schema.optional(Schema.NullOr(WorktreeId)),\n\t}),\n\tsuccess: Schema.Struct({ reverted: Schema.Boolean }),\n\terror: GitErrors,\n});\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nexport const WIRE_PROTOCOL_VERSION = 5 as const;\n\nexport class WireHello extends Schema.Class<WireHello>(\"WireHello\")({\n\tprotocolVersion: Schema.Number,\n}) {}\n\nexport class WireWelcome extends Schema.Class<WireWelcome>(\"WireWelcome\")({\n\tprotocolVersion: Schema.Number,\n}) {}\n\nexport class WireProtocolRejected extends Schema.TaggedErrorClass<WireProtocolRejected>()(\n\t\"WireProtocolRejected\",\n\t{\n\t\texpectedVersion: Schema.Number,\n\t\treceivedVersion: Schema.Number,\n\t},\n) {}\n\nexport const ConnectHandshakeRpc = Rpc.make(\"connect.handshake\", {\n\tpayload: WireHello,\n\tsuccess: WireWelcome,\n\terror: WireProtocolRejected,\n});\n","import { Schema } from \"effect\";\n\nexport const HostPlatform = Schema.Literals([\"darwin\", \"linux\", \"win32\"]);\nexport type HostPlatform = typeof HostPlatform.Type;\n\nexport const HostCapabilityId = Schema.Literals([\n\t\"backgroundService\",\n\t\"browserCookieImport\",\n\t\"deepEnergy\",\n\t\"nativeCredentialStore\",\n\t\"nearbyDiscovery\",\n\t\"notchTray\",\n\t\"openTargets\",\n\t\"powerTelemetry\",\n\t\"processInspection\",\n\t\"updater\",\n]);\nexport type HostCapabilityId = typeof HostCapabilityId.Type;\n\nexport const HostCapabilityState = Schema.Literals([\n\t\"available\",\n\t\"unavailable\",\n]);\nexport type HostCapabilityState = typeof HostCapabilityState.Type;\n\nexport const HostDescriptor = Schema.Struct({\n\tplatform: HostPlatform,\n\tarch: Schema.String,\n\tpackaged: Schema.Boolean,\n\tdisplayServer: Schema.NullOr(Schema.Literals([\"x11\", \"wayland\"])),\n\tcapabilities: Schema.Record(HostCapabilityId, HostCapabilityState),\n});\nexport type HostDescriptor = typeof HostDescriptor.Type;\n","import { Rpc } from \"effect/unstable/rpc\";\nimport { Schema } from \"effect\";\n\n/**\n * Every action the renderer can dispatch via a keybinding or menu click. The\n * literal union is the contract: handlers are wired up in\n * `apps/renderer/src/lib/commands.ts`, and the settings UI iterates over this\n * list to render the editor. Adding a command is an additive change here +\n * a default in `apps/renderer/src/lib/default-keybindings.ts` + a handler.\n *\n * - `*` commands without a dot are top-level menu actions (also surfaced\n * as Electron menu accelerators by the main process).\n * - `composer.*` commands fire inside the chat composer (CodeMirror).\n * - `editor.*` commands fire inside the file editor (CodeMirror).\n */\nexport const Command = Schema.Literals([\n // menu / global\n \"new-chat\",\n \"open-project\",\n \"settings\",\n \"close-tab\",\n \"toggle-left-sidebar\",\n \"toggle-right-sidebar\",\n \"toggle-terminal\",\n \"focus-composer\",\n // navigation — drive tabs / chats / panes from the keyboard\n \"next-tab\",\n \"prev-tab\",\n \"select-tab-1\",\n \"select-tab-2\",\n \"select-tab-3\",\n \"select-tab-4\",\n \"select-tab-5\",\n \"select-tab-6\",\n \"select-tab-7\",\n \"select-tab-8\",\n \"select-last-tab\",\n \"new-tab\",\n \"next-chat\",\n \"prev-chat\",\n \"next-panel\",\n \"prev-panel\",\n \"focus-next-pane\",\n \"focus-prev-pane\",\n \"open-chat-switcher\",\n // composer (chat input)\n \"composer.submit\",\n \"composer.newline\",\n \"composer.forceSubmit\",\n \"composer.togglePlanMode\",\n // file editor\n \"editor.save\",\n \"editor.annotate\",\n]);\nexport type Command = typeof Command.Type;\n\n/**\n * One user-defined keybinding override. `key` is the human-writable form\n * (`\"mod+shift+n\"`, `\"enter\"`, `\"shift+tab\"`); the parser in\n * `keybindings-parse.ts` converts it to a `KeybindingShortcut` for matching.\n * `when` is an optional boolean expression evaluated against the current\n * context (e.g. `\"composerFocus && !settingsOpen\"`).\n *\n * Rules are stored in order; later rules win over earlier ones on the same\n * key+context — matching common editor precedence.\n *\n * Declared as a `Schema.Struct` (not `Schema.Class`) on purpose: rules are\n * pure data with no methods, and the renderer constructs plain objects when\n * sending edits over RPC — `Schema.Class` would reject those for not being\n * actual class instances. Matches the `RepositorySettingsPatch` convention.\n */\nexport const KeybindingRule = Schema.Struct({\n key: Schema.String,\n command: Command,\n when: Schema.optional(Schema.String),\n});\nexport type KeybindingRule = typeof KeybindingRule.Type;\n\n/**\n * Wire-shape of `keybindings.json`. v1 stores only user overrides — the\n * defaults are baked into the renderer (`default-keybindings.ts`) so a new\n * build can change them without rewriting the user's file.\n */\nexport class KeybindingsFile extends Schema.Class<KeybindingsFile>(\n \"KeybindingsFile\",\n)({\n schemaVersion: Schema.Literal(1),\n rules: Schema.Array(KeybindingRule),\n}) {}\n\n/** Safety cap. Truncates oldest if exceeded. */\nexport const MAX_KEYBINDING_RULES = 256;\n\nexport const KeybindingsGetRpc = Rpc.make(\"keybindings.get\", {\n success: KeybindingsFile,\n});\n\nexport const KeybindingsReplaceRpc = Rpc.make(\"keybindings.replace\", {\n payload: Schema.Struct({ rules: Schema.Array(KeybindingRule) }),\n success: KeybindingsFile,\n});\n\n/**\n * Live stream of the merged rules array. Emits once on subscribe with the\n * current file, then re-emits whenever the file changes (RPC write or\n * external hand-edit picked up by the file watcher).\n */\nexport const KeybindingsStreamRpc = Rpc.make(\"keybindings.stream\", {\n success: KeybindingsFile,\n stream: true,\n});\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { AttachmentRef } from \"./composer.ts\";\nimport { SessionId } from \"./session.ts\";\n\nexport class LinearConnection extends Schema.Class<LinearConnection>(\n\t\"LinearConnection\",\n)({\n\tworkspaceId: Schema.String,\n\tworkspaceName: Schema.String,\n\tworkspaceKey: Schema.String,\n\tviewerName: Schema.String,\n\tviewerEmail: Schema.String,\n\tconnectedAt: Schema.DateFromString,\n\tstatus: Schema.Literals([\"connected\", \"reauthRequired\"]),\n}) {}\n\nexport class LinearIssueRef extends Schema.Class<LinearIssueRef>(\n\t\"LinearIssueRef\",\n)({\n\tworkspaceId: Schema.String,\n\tissueId: Schema.String,\n\tidentifier: Schema.String,\n}) {}\n\nexport class LinearIssueSummary extends Schema.Class<LinearIssueSummary>(\n\t\"LinearIssueSummary\",\n)({\n\tworkspaceId: Schema.String,\n\tworkspaceName: Schema.String,\n\tissueId: Schema.String,\n\tidentifier: Schema.String,\n\ttitle: Schema.String,\n\tstate: Schema.String,\n\tstateType: Schema.String,\n\tstateColor: Schema.NullOr(Schema.String),\n\tpriority: Schema.Number,\n\tassignee: Schema.NullOr(Schema.String),\n\tassigneeAvatarUrl: Schema.NullOr(Schema.String),\n\tlabels: Schema.Array(Schema.String),\n\tupdatedAt: Schema.DateFromString,\n}) {}\n\nexport class LinearContextFile extends Schema.Class<LinearContextFile>(\n\t\"LinearContextFile\",\n)({\n\tissue: LinearIssueRef,\n\trelPath: Schema.String,\n\tabsPath: Schema.String,\n}) {}\n\nexport class LinearContextWarning extends Schema.Class<LinearContextWarning>(\n\t\"LinearContextWarning\",\n)({\n\tissue: LinearIssueRef,\n\tmessage: Schema.String,\n}) {}\n\nexport class LinearIntegrationError extends Schema.TaggedErrorClass<LinearIntegrationError>()(\n\t\"LinearIntegrationError\",\n\t{ reason: Schema.String },\n) {}\n\nexport const LinearListConnectionsRpc = Rpc.make(\"linear.listConnections\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: Schema.Array(LinearConnection),\n\terror: LinearIntegrationError,\n});\n\nexport const LinearConnectRpc = Rpc.make(\"linear.connect\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: LinearConnection,\n\terror: LinearIntegrationError,\n});\n\nexport const LinearDisconnectRpc = Rpc.make(\"linear.disconnect\", {\n\tpayload: Schema.Struct({ workspaceId: Schema.String }),\n\tsuccess: Schema.Void,\n\terror: LinearIntegrationError,\n});\n\nexport const LinearListIssuesRpc = Rpc.make(\"linear.listIssues\", {\n\tpayload: Schema.Struct({\n\t\tquery: Schema.optional(Schema.String),\n\t\tworkspaceIds: Schema.optional(Schema.Array(Schema.String)),\n\t\tcursor: Schema.optional(Schema.String),\n\t}),\n\tsuccess: Schema.Struct({\n\t\tissues: Schema.Array(LinearIssueSummary),\n\t\tnextCursor: Schema.NullOr(Schema.String),\n\t}),\n\terror: LinearIntegrationError,\n});\n\nexport const LinearPrepareContextRpc = Rpc.make(\"linear.prepareContext\", {\n\tpayload: Schema.Struct({\n\t\tsessionId: SessionId,\n\t\tissues: Schema.Array(LinearIssueRef),\n\t\trootPath: Schema.optional(Schema.String),\n\t}),\n\tsuccess: Schema.Struct({\n\t\tfiles: Schema.Array(LinearContextFile),\n\t\tattachments: Schema.Array(AttachmentRef),\n\t\twarnings: Schema.Array(LinearContextWarning),\n\t}),\n\terror: LinearIntegrationError,\n});\n","import { Effect, Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { EnvironmentEndpoint } from \"./connect.ts\";\nimport { EnvironmentId } from \"./ids.ts\";\n\n// ---------------------------------------------------------------------------\n// Managed cloud machines\n// ---------------------------------------------------------------------------\n\nexport const PERSISTENT_STANDARD_OFFER_ID = \"persistent-standard-v1\" as const;\n\nexport const MachineArchitecture = Schema.Literals([\"x86_64\"]);\nexport type MachineArchitecture = typeof MachineArchitecture.Type;\n\nexport const MachineOfferKind = Schema.Literals([\"persistent\", \"sandbox\"]);\nexport type MachineOfferKind = typeof MachineOfferKind.Type;\n\nexport class MachineOffer extends Schema.Class<MachineOffer>(\"MachineOffer\")({\n\tofferId: Schema.String,\n\tkind: MachineOfferKind.pipe(\n\t\tSchema.withDecodingDefaultKey(Effect.succeed(\"persistent\" as const)),\n\t),\n\tdisplayName: Schema.String,\n\tarchitecture: MachineArchitecture,\n\tvcpuCount: Schema.Number,\n\tmemoryMib: Schema.Number,\n\tdiskGib: Schema.Number,\n\tlocation: Schema.String,\n\tmonthlyPriceCents: Schema.Number,\n\tcurrency: Schema.String,\n\tautomaticBackups: Schema.Boolean,\n\tavailable: Schema.Boolean,\n}) {}\n\nexport class MachineOfferList extends Schema.Class<MachineOfferList>(\n\t\"MachineOfferList\",\n)({\n\toffers: Schema.Array(MachineOffer),\n}) {}\n\nexport const MachineState = Schema.Literals([\n\t\"creating\",\n\t\"bootstrapping\",\n\t\"enrolling\",\n\t\"ready\",\n\t\"suspending\",\n\t\"suspended\",\n\t\"resuming\",\n\t\"destroying\",\n\t\"destroyed\",\n\t\"failed\",\n]);\nexport type MachineState = typeof MachineState.Type;\n\nexport const DesiredMachineState = Schema.Literals([\n\t\"ready\",\n\t\"suspended\",\n\t\"destroyed\",\n]);\nexport type DesiredMachineState = typeof DesiredMachineState.Type;\n\n/**\n * Stable, user-safe status codes. Provider responses and raw errors are kept\n * inside the relay and are never exposed through this contract.\n */\nexport const MachineStatusCode = Schema.Literals([\n\t\"creation-queued\",\n\t\"provider-provisioning\",\n\t\"bootstrap-pending\",\n\t\"enrollment-pending\",\n\t\"ready\",\n\t\"suspension-queued\",\n\t\"suspended\",\n\t\"resume-queued\",\n\t\"cancellation-scheduled\",\n\t\"recovery-available\",\n\t\"destruction-queued\",\n\t\"destroyed\",\n\t\"provider-unavailable\",\n\t\"bootstrap-failed\",\n\t\"enrollment-failed\",\n\t\"reconciliation-failed\",\n]);\nexport type MachineStatusCode = typeof MachineStatusCode.Type;\n\nexport const MachineBootPhase = Schema.Literals([\n\t\"bootstrap-started\",\n\t\"runtime-installed\",\n\t\"developer-tools-installed\",\n\t\"zuse-started\",\n\t\"account-setup-available\",\n\t\"service-started\",\n\t\"failed\",\n]);\nexport type MachineBootPhase = typeof MachineBootPhase.Type;\n\nexport class MachineRecord extends Schema.Class<MachineRecord>(\"MachineRecord\")(\n\t{\n\t\tmachineId: Schema.String,\n\t\toffer: MachineOffer,\n\t\tlabel: Schema.optional(Schema.String),\n\t\tstate: MachineState,\n\t\tdesiredState: DesiredMachineState,\n\t\tstatusCode: MachineStatusCode,\n\t\tbootPhase: Schema.optional(MachineBootPhase),\n\t\tenvironmentId: Schema.optional(EnvironmentId),\n\t\tcreatedAt: Schema.Number,\n\t\tpaidThrough: Schema.optional(Schema.Number),\n\t\trecoveryDeadline: Schema.optional(Schema.Number),\n\t},\n) {}\n\nexport class MachineList extends Schema.Class<MachineList>(\"MachineList\")({\n\tmachines: Schema.Array(MachineRecord),\n}) {}\n\nexport class MachineCreateRequest extends Schema.Class<MachineCreateRequest>(\n\t\"MachineCreateRequest\",\n)({\n\tofferId: Schema.String,\n\tlabel: Schema.optional(Schema.String),\n\tidempotencyKey: Schema.String,\n}) {}\n\nexport class MachineIdRequest extends Schema.Class<MachineIdRequest>(\n\t\"MachineIdRequest\",\n)({\n\tmachineId: Schema.String,\n}) {}\n\nexport class MachineDestroyRequest extends Schema.Class<MachineDestroyRequest>(\n\t\"MachineDestroyRequest\",\n)({\n\tmachineId: Schema.String,\n\tconfirmation: Schema.Literal(\"destroy\"),\n}) {}\n\n// --- enrollment -------------------------------------------------------------\n\nexport class MachineEnrollRequest extends Schema.Class<MachineEnrollRequest>(\n\t\"MachineEnrollRequest\",\n)({\n\tmachineId: Schema.String,\n\tenvironmentId: EnvironmentId,\n\tenvironmentPublicKey: Schema.String,\n\tproof: Schema.String,\n\tendpoint: EnvironmentEndpoint,\n\torigin: Schema.Struct({\n\t\tlocalHttpHost: Schema.String,\n\t\tlocalHttpPort: Schema.Number,\n\t}),\n\tlabel: Schema.optional(Schema.String),\n}) {}\n\nexport class CloudRuntimeCredential extends Schema.Class<CloudRuntimeCredential>(\n\t\"CloudRuntimeCredential\",\n)({\n\tkind: Schema.Literals([\"github\", \"claude\", \"codex\"]),\n\tcredentialType: Schema.Literals([\n\t\t\"api-key\",\n\t\t\"oauth-token\",\n\t\t\"repository-token\",\n\t\t\"native-store\",\n\t]),\n\tsecret: Schema.String,\n\tversion: Schema.Number,\n}) {}\n\nexport class MachineEnrollResponse extends Schema.Class<MachineEnrollResponse>(\n\t\"MachineEnrollResponse\",\n)({\n\tenvironmentId: EnvironmentId,\n\tendpoint: EnvironmentEndpoint,\n\trelayIssuer: Schema.String,\n\tenvironmentCredential: Schema.String,\n\tmintPublicKey: Schema.String,\n\ttunnelHostname: Schema.optional(Schema.String),\n\tconnectorToken: Schema.optional(Schema.String),\n\tcloudCredentials: Schema.optional(Schema.Array(CloudRuntimeCredential)),\n}) {}\n\nexport class MachineBootStatusRequest extends Schema.Class<MachineBootStatusRequest>(\n\t\"MachineBootStatusRequest\",\n)({\n\tphase: MachineBootPhase,\n\tstatusCode: Schema.optional(MachineStatusCode),\n}) {}\n\n// --- billing and entitlements -----------------------------------------------\n\nexport const EntitlementKind = Schema.Literals([\n\t\"persistent-machine\",\n\t\"cloud-workspace\",\n\t\"usage-credits\",\n]);\nexport type EntitlementKind = typeof EntitlementKind.Type;\n\nexport const EntitlementStatus = Schema.Literals([\n\t\"pending\",\n\t\"active\",\n\t\"grace\",\n\t\"ended\",\n]);\nexport type EntitlementStatus = typeof EntitlementStatus.Type;\n\nexport class EntitlementRecord extends Schema.Class<EntitlementRecord>(\n\t\"EntitlementRecord\",\n)({\n\tentitlementId: Schema.String,\n\tkind: EntitlementKind,\n\tstatus: EntitlementStatus,\n\tofferId: Schema.optional(Schema.String),\n\tmachineId: Schema.optional(Schema.String),\n\tpaidThrough: Schema.optional(Schema.Number),\n\tcreditBalance: Schema.optional(Schema.Number),\n}) {}\n\nexport class EntitlementList extends Schema.Class<EntitlementList>(\n\t\"EntitlementList\",\n)({\n\tentitlements: Schema.Array(EntitlementRecord),\n}) {}\n\nexport class BillingCheckoutRequest extends Schema.Class<BillingCheckoutRequest>(\n\t\"BillingCheckoutRequest\",\n)({\n\tofferId: Schema.String,\n}) {}\n\nexport class BillingCheckout extends Schema.Class<BillingCheckout>(\n\t\"BillingCheckout\",\n)({\n\tcheckoutUrl: Schema.String,\n}) {}\n\nexport class BillingPortal extends Schema.Class<BillingPortal>(\"BillingPortal\")(\n\t{\n\t\tportalUrl: Schema.String,\n\t},\n) {}\n\n// --- client-visible errors --------------------------------------------------\n\nexport const MachineErrorCode = Schema.Literals([\n\t\"not-found\",\n\t\"not-allowed\",\n\t\"invalid-offer\",\n\t\"invalid-state\",\n\t\"entitlement-required\",\n\t\"machine-limit-reached\",\n\t\"billing-unavailable\",\n\t\"provider-unavailable\",\n\t\"enrollment-expired\",\n\t\"enrollment-rejected\",\n\t\"credential-required\",\n\t\"branch-in-use\",\n\t\"conflict\",\n\t\"invalid-request\",\n]);\nexport type MachineErrorCode = typeof MachineErrorCode.Type;\n\nexport class MachineOpError extends Schema.TaggedErrorClass<MachineOpError>()(\n\t\"MachineOpError\",\n\t{\n\t\tcode: MachineErrorCode,\n\t},\n) {}\n\n// ---------------------------------------------------------------------------\n// Desktop control-plane RPCs\n// ---------------------------------------------------------------------------\n\nexport const MachinesOffersRpc = Rpc.make(\"machines.offers\", {\n\tpayload: Schema.Void,\n\tsuccess: MachineOfferList,\n\terror: MachineOpError,\n});\n\nexport const MachinesListRpc = Rpc.make(\"machines.list\", {\n\tpayload: Schema.Void,\n\tsuccess: MachineList,\n\terror: MachineOpError,\n});\n\nexport const MachinesGetRpc = Rpc.make(\"machines.get\", {\n\tpayload: MachineIdRequest,\n\tsuccess: MachineRecord,\n\terror: MachineOpError,\n});\n\nexport const MachinesCreateRpc = Rpc.make(\"machines.create\", {\n\tpayload: MachineCreateRequest,\n\tsuccess: MachineRecord,\n\terror: MachineOpError,\n});\n\nexport const MachinesCancelRpc = Rpc.make(\"machines.cancel\", {\n\tpayload: MachineIdRequest,\n\tsuccess: MachineRecord,\n\terror: MachineOpError,\n});\n\nexport const MachinesRecoverRpc = Rpc.make(\"machines.recover\", {\n\tpayload: MachineIdRequest,\n\tsuccess: MachineRecord,\n\terror: MachineOpError,\n});\n\nexport const MachinesDestroyRpc = Rpc.make(\"machines.destroy\", {\n\tpayload: MachineDestroyRequest,\n\tsuccess: MachineRecord,\n\terror: MachineOpError,\n});\n\nexport const MachinesCheckoutRpc = Rpc.make(\"machines.checkout\", {\n\tpayload: BillingCheckoutRequest,\n\tsuccess: BillingCheckout,\n\terror: MachineOpError,\n});\n\nexport const MachinesBillingPortalRpc = Rpc.make(\"machines.billingPortal\", {\n\tpayload: Schema.Void,\n\tsuccess: BillingPortal,\n\terror: MachineOpError,\n});\n\nexport const MachinesEntitlementsRpc = Rpc.make(\"machines.entitlements\", {\n\tpayload: Schema.Void,\n\tsuccess: EntitlementList,\n\terror: MachineOpError,\n});\n\n// ---------------------------------------------------------------------------\n// RPCs served by a cloud machine\n// ---------------------------------------------------------------------------\n\nexport const SshMode = Schema.Literals([\"authorized-keys\", \"tailnet-identity\"]);\nexport type SshMode = typeof SshMode.Type;\n\nexport class MachineSshKey extends Schema.Class<MachineSshKey>(\"MachineSshKey\")(\n\t{\n\t\tfingerprint: Schema.String,\n\t\tpublicKey: Schema.String,\n\t\tlabel: Schema.optional(Schema.String),\n\t},\n) {}\n\nexport class MachineSshKeysAddRpcPayload extends Schema.Class<MachineSshKeysAddRpcPayload>(\n\t\"MachineSshKeysAddRpcPayload\",\n)({\n\tpublicKey: Schema.String,\n\tlabel: Schema.optional(Schema.String),\n}) {}\n\nexport const MachineSshKeysAddRpc = Rpc.make(\"machine.sshKeys.add\", {\n\tpayload: MachineSshKeysAddRpcPayload,\n\tsuccess: MachineSshKey,\n\terror: MachineOpError,\n});\n\nexport const MachineSshKeysListRpc = Rpc.make(\"machine.sshKeys.list\", {\n\tpayload: Schema.Void,\n\tsuccess: Schema.Struct({ keys: Schema.Array(MachineSshKey) }),\n\terror: MachineOpError,\n});\n\nexport const MachineSshKeysRemoveRpc = Rpc.make(\"machine.sshKeys.remove\", {\n\tpayload: Schema.Struct({ fingerprint: Schema.String }),\n\tsuccess: Schema.Void,\n\terror: MachineOpError,\n});\n\nexport class MachinePrivateNetworkStatus extends Schema.Class<MachinePrivateNetworkStatus>(\n\t\"MachinePrivateNetworkStatus\",\n)({\n\tenabled: Schema.Boolean,\n\tprivateIp: Schema.optional(Schema.String),\n\tdnsName: Schema.optional(Schema.String),\n\tsshMode: SshMode,\n}) {}\n\nexport const MachinePrivateNetworkEnableRpc = Rpc.make(\n\t\"machine.privateNetwork.enable\",\n\t{\n\t\tpayload: Schema.Struct({\n\t\t\tauthKey: Schema.String,\n\t\t\tsshMode: SshMode,\n\t\t}),\n\t\tsuccess: MachinePrivateNetworkStatus,\n\t\terror: MachineOpError,\n\t},\n);\n\nexport const MachinePrivateNetworkStatusRpc = Rpc.make(\n\t\"machine.privateNetwork.status\",\n\t{\n\t\tpayload: Schema.Void,\n\t\tsuccess: MachinePrivateNetworkStatus,\n\t\terror: MachineOpError,\n\t},\n);\n\nexport const MachineSshModeSetRpc = Rpc.make(\"machine.sshMode.set\", {\n\tpayload: Schema.Struct({ mode: SshMode }),\n\tsuccess: MachinePrivateNetworkStatus,\n\terror: MachineOpError,\n});\n\nexport const MachineRuntimeUpdateState = Schema.Literals([\n\t\"current\",\n\t\"update-available\",\n\t\"updating\",\n\t\"failed\",\n\t\"unavailable\",\n]);\nexport type MachineRuntimeUpdateState = typeof MachineRuntimeUpdateState.Type;\n\nexport const MachineRuntimeUpdatePhase = Schema.Literals([\n\t\"idle\",\n\t\"checking\",\n\t\"queued\",\n\t\"downloading\",\n\t\"installing\",\n\t\"developer-tools\",\n\t\"restarting\",\n\t\"verifying\",\n\t\"complete\",\n\t\"rolling-back\",\n\t\"failed\",\n]);\nexport type MachineRuntimeUpdatePhase = typeof MachineRuntimeUpdatePhase.Type;\n\nexport const MachineRuntimeUpdateFailureCode = Schema.Literals([\n\t\"check-failed\",\n\t\"target-version-unavailable\",\n\t\"install-failed\",\n\t\"health-check-failed\",\n\t\"rollback-complete\",\n]);\nexport type MachineRuntimeUpdateFailureCode =\n\ttypeof MachineRuntimeUpdateFailureCode.Type;\n\nexport class MachineRuntimeStatus extends Schema.Class<MachineRuntimeStatus>(\n\t\"MachineRuntimeStatus\",\n)({\n\tstate: MachineRuntimeUpdateState,\n\tphase: MachineRuntimeUpdatePhase,\n\tprogressPercent: Schema.Number,\n\ttargetAppVersion: Schema.String,\n\tinstalledAppVersion: Schema.optional(Schema.String),\n\tinstalledRuntimeVersion: Schema.optional(Schema.String),\n\ttargetRuntimeVersion: Schema.optional(Schema.String),\n\tupdatedAt: Schema.optional(Schema.Number),\n\tfailureCode: Schema.optional(MachineRuntimeUpdateFailureCode),\n}) {}\n\nexport const MachineRuntimeTargetRpc = Rpc.make(\"machine.runtime.target\", {\n\tpayload: Schema.Void,\n\tsuccess: Schema.Struct({ appVersion: Schema.String }),\n\terror: MachineOpError,\n});\n\nexport const MachineRuntimeStatusRpc = Rpc.make(\"machine.runtime.status\", {\n\tpayload: Schema.Struct({ targetAppVersion: Schema.String }),\n\tsuccess: MachineRuntimeStatus,\n\terror: MachineOpError,\n});\n\nexport const MachineRuntimeUpdateRpc = Rpc.make(\"machine.runtime.update\", {\n\tpayload: Schema.Struct({ targetAppVersion: Schema.String }),\n\tsuccess: MachineRuntimeStatus,\n\terror: MachineOpError,\n});\n\nexport class MachineResourceSample extends Schema.Class<MachineResourceSample>(\n\t\"MachineResourceSample\",\n)({\n\tsampledAt: Schema.Number,\n\tcpuCores: Schema.Number,\n\tcpuPercent: Schema.Number,\n\tmemTotalBytes: Schema.Number,\n\tmemUsedBytes: Schema.Number,\n\tdiskTotalBytes: Schema.Number,\n\tdiskUsedBytes: Schema.Number,\n\t/** Filesystem the disk numbers describe (the workspace root when present). */\n\tdiskPath: Schema.String,\n}) {}\n\nexport const MachineResourcesWatchRpc = Rpc.make(\"machine.resources.watch\", {\n\tpayload: Schema.Struct({ intervalMs: Schema.optional(Schema.Number) }),\n\tsuccess: MachineResourceSample,\n\terror: MachineOpError,\n\tstream: true,\n});\n\n// ---------------------------------------------------------------------------\n// Cloud-machine account access\n// ---------------------------------------------------------------------------\n\nexport const AccountAccessProvider = Schema.Literals([\n\t\"github\",\n\t\"claude\",\n\t\"codex\",\n]);\nexport type AccountAccessProvider = typeof AccountAccessProvider.Type;\n\nexport const AccountAccessState = Schema.Literals([\n\t\"missing-tool\",\n\t\"disconnected\",\n\t\"authorizing\",\n\t\"connected\",\n\t\"error\",\n]);\nexport type AccountAccessState = typeof AccountAccessState.Type;\n\nexport const AccountAccessAuthKind = Schema.Literals([\n\t\"device\",\n\t\"api-key\",\n\t\"oauth-token\",\n]);\nexport type AccountAccessAuthKind = typeof AccountAccessAuthKind.Type;\n\nexport class AccountAccessProviderStatus extends Schema.Class<AccountAccessProviderStatus>(\n\t\"AccountAccessProviderStatus\",\n)({\n\tproviderId: AccountAccessProvider,\n\tstate: AccountAccessState,\n\tinstalled: Schema.Boolean,\n\taccountLabel: Schema.optional(Schema.String),\n\tauthKind: Schema.optional(AccountAccessAuthKind),\n\tlastSyncedAt: Schema.optional(Schema.Number),\n\terrorCode: Schema.optional(Schema.String),\n}) {}\n\nexport class AccountAccessStatus extends Schema.Class<AccountAccessStatus>(\n\t\"AccountAccessStatus\",\n)({\n\tproviders: Schema.Array(AccountAccessProviderStatus),\n}) {}\n\nexport class LocalAccountDescriptor extends Schema.Class<LocalAccountDescriptor>(\n\t\"LocalAccountDescriptor\",\n)({\n\tproviderId: AccountAccessProvider,\n\tinstalled: Schema.Boolean,\n\tdetected: Schema.Boolean,\n\taccountLabel: Schema.optional(Schema.String),\n\taction: Schema.Literals([\"device-login\", \"sealed-transfer\"]),\n}) {}\n\nexport class LocalAccountDescriptorList extends Schema.Class<LocalAccountDescriptorList>(\n\t\"LocalAccountDescriptorList\",\n)({\n\taccounts: Schema.Array(LocalAccountDescriptor),\n}) {}\n\nexport class AccountAccessPreparedImport extends Schema.Class<AccountAccessPreparedImport>(\n\t\"AccountAccessPreparedImport\",\n)({\n\ttransferId: Schema.String,\n\taccountId: Schema.String,\n\tenvironmentId: EnvironmentId,\n\trecipientPublicKey: Schema.String,\n\texpiresAt: Schema.Number,\n\tenvironmentProof: Schema.String,\n}) {}\n\nexport class AccountAccessSealedCredential extends Schema.Class<AccountAccessSealedCredential>(\n\t\"AccountAccessSealedCredential\",\n)({\n\tephemeralPublicKey: Schema.String,\n\tnonce: Schema.String,\n\tciphertext: Schema.String,\n}) {}\n\nexport class AccountAccessCreateClaudeTransferRequest extends Schema.Class<AccountAccessCreateClaudeTransferRequest>(\n\t\"AccountAccessCreateClaudeTransferRequest\",\n)({\n\tprepared: AccountAccessPreparedImport,\n}) {}\n\nexport const AccountAccessClaudeTransferContinuation = Schema.Union([\n\tSchema.TaggedStruct(\"code\", {\n\t\ttransferId: Schema.String,\n\t\tcode: Schema.String,\n\t}),\n\tSchema.TaggedStruct(\"cancel\", {\n\t\ttransferId: Schema.String,\n\t}),\n]);\nexport type AccountAccessClaudeTransferContinuation =\n\ttypeof AccountAccessClaudeTransferContinuation.Type;\n\nexport class AccountAccessImportRequest extends Schema.Class<AccountAccessImportRequest>(\n\t\"AccountAccessImportRequest\",\n)({\n\ttransferId: Schema.String,\n\tsealed: AccountAccessSealedCredential,\n}) {}\n\nexport const AccountAccessTransferEvent = Schema.Union([\n\tSchema.TaggedStruct(\"progress\", { message: Schema.String }),\n\tSchema.TaggedStruct(\"input-ready\", {}),\n\tSchema.TaggedStruct(\"verification\", {\n\t\turl: Schema.String,\n\t\tcode: Schema.optional(Schema.String),\n\t}),\n\tSchema.TaggedStruct(\"sealed\", { sealed: AccountAccessSealedCredential }),\n\tSchema.TaggedStruct(\"done\", {\n\t\tok: Schema.Boolean,\n\t\treason: Schema.optional(Schema.String),\n\t}),\n]);\nexport type AccountAccessTransferEvent = typeof AccountAccessTransferEvent.Type;\n\nexport const AccountAccessErrorCode = Schema.Literals([\n\t\"not-allowed\",\n\t\"not-signed-in\",\n\t\"unsupported-provider\",\n\t\"tool-not-installed\",\n\t\"login-failed\",\n\t\"transfer-expired\",\n\t\"transfer-replayed\",\n\t\"transfer-rejected\",\n\t\"credential-store-failed\",\n\t\"cleanup-failed\",\n\t\"credential-export-failed\",\n]);\nexport type AccountAccessErrorCode = typeof AccountAccessErrorCode.Type;\n\nexport class AccountAccessOpError extends Schema.TaggedErrorClass<AccountAccessOpError>()(\n\t\"AccountAccessOpError\",\n\t{ code: AccountAccessErrorCode },\n) {}\n\nexport const AccountAccessStatusRpc = Rpc.make(\"accountAccess.status\", {\n\tpayload: Schema.Void,\n\tsuccess: AccountAccessStatus,\n\terror: AccountAccessOpError,\n});\n\nexport const AccountAccessDetectLocalRpc = Rpc.make(\n\t\"accountAccess.detectLocal\",\n\t{\n\t\tpayload: Schema.Void,\n\t\tsuccess: LocalAccountDescriptorList,\n\t\terror: AccountAccessOpError,\n\t},\n);\n\nexport const AccountAccessStartLoginRpc = Rpc.make(\"accountAccess.startLogin\", {\n\tpayload: Schema.Struct({\n\t\tproviderId: Schema.Literals([\"github\", \"codex\"]),\n\t}),\n\tsuccess: AccountAccessTransferEvent,\n\terror: AccountAccessOpError,\n\tstream: true,\n});\n\nexport const AccountAccessPrepareImportRpc = Rpc.make(\n\t\"accountAccess.prepareImport\",\n\t{\n\t\tpayload: Schema.Struct({\n\t\t\taccountId: Schema.String,\n\t\t\tproviderId: Schema.Literal(\"claude\"),\n\t\t}),\n\t\tsuccess: AccountAccessPreparedImport,\n\t\terror: AccountAccessOpError,\n\t},\n);\n\nexport const AccountAccessCreateClaudeTransferRpc = Rpc.make(\n\t\"accountAccess.createClaudeTransfer\",\n\t{\n\t\tpayload: AccountAccessCreateClaudeTransferRequest,\n\t\tsuccess: AccountAccessTransferEvent,\n\t\terror: AccountAccessOpError,\n\t\tstream: true,\n\t},\n);\n\nexport const AccountAccessContinueClaudeTransferRpc = Rpc.make(\n\t\"accountAccess.continueClaudeTransfer\",\n\t{\n\t\tpayload: AccountAccessClaudeTransferContinuation,\n\t\tsuccess: Schema.Void,\n\t\terror: AccountAccessOpError,\n\t},\n);\n\nexport const AccountAccessImportRpc = Rpc.make(\"accountAccess.import\", {\n\tpayload: AccountAccessImportRequest,\n\tsuccess: AccountAccessProviderStatus,\n\terror: AccountAccessOpError,\n});\n\nexport const AccountAccessDisconnectRpc = Rpc.make(\"accountAccess.disconnect\", {\n\tpayload: Schema.Struct({ providerId: AccountAccessProvider }),\n\tsuccess: AccountAccessProviderStatus,\n\terror: AccountAccessOpError,\n});\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { ProviderId } from \"./agent.ts\";\nimport { FolderId } from \"./ids.ts\";\n\n// ---------------------------------------------------------------------------\n// User MCP servers. Zuse keeps NO registry of its own: it reconciles native\n// config files with provider-reported servers, plugins, and connected apps.\n// Config sources include `~/.claude.json` (user + per-project \"local\"\n// scopes), the project `.mcp.json` (project scope), and\n// `~/.codex/config.toml [mcp_servers.*]`. Zuse shows the reconciled inventory,\n// injects only compatible configured servers into agent sessions, and stores\n// only enable/disable overrides (keys, never server definitions) in settings.\n// See specs/self-orchestration/decisions/0032-mcp-connector-passthrough.md.\n// ---------------------------------------------------------------------------\n\n/**\n * Where a server definition came from. The configured Claude scopes mirror\n * native precedence (local > project > user); plugin/app sources are native\n * provider-managed entries. `codex` is the user's config entry and\n * `codex-app` covers provider-managed apps. `builtin` covers Zuse's\n * in-process servers, which are always injected and shown as connected.\n */\nexport const McpServerSource = Schema.Literals([\n\t\"claude-user\",\n\t\"claude-project\",\n\t\"claude-local\",\n\t\"claude-plugin\",\n\t\"claude-app\",\n\t\"codex\",\n\t\"codex-app\",\n\t\"builtin\",\n]);\nexport type McpServerSource = typeof McpServerSource.Type;\n\nexport const McpTransport = Schema.Literals([\"stdio\", \"http\", \"sse\"]);\nexport type McpTransport = typeof McpTransport.Type;\n\nexport const McpServerKind = Schema.Literals([\n\t\"configured\",\n\t\"builtin\",\n\t\"provider\",\n\t\"app-group\",\n\t\"app\",\n]);\nexport type McpServerKind = typeof McpServerKind.Type;\n\nexport const McpAuthenticationAction = Schema.Literals([\n\t\"native-oauth\",\n\t\"open-url\",\n]);\nexport type McpAuthenticationAction = typeof McpAuthenticationAction.Type;\n\n/**\n * One configured or provider-reported inventory entry. Env/header *values*\n * never cross the wire (they may hold secrets) — only variable names, so the\n * UI can surface unmet requirements like \"env var FOO is not set\".\n */\nexport const McpServerDescriptor = Schema.Struct({\n\t/**\n\t * Stable identity across refreshes: `<family>:<name>` where family is\n\t * `claude` | `codex` | `builtin` (Claude scopes collapse to one effective\n\t * server per name, `source` records the winning scope). Also the key used\n\t * by the enable/disable overrides in settings.\n\t */\n\tkey: Schema.String,\n\tname: Schema.String,\n\tsource: McpServerSource,\n\tkind: McpServerKind,\n\t/** Parent aggregate for virtual connector rows. */\n\tparentKey: Schema.NullOr(Schema.String),\n\t/** Providers whose sessions can actually call this entry. */\n\tavailableProviders: Schema.Array(ProviderId),\n\ttransport: Schema.NullOr(McpTransport),\n\t/** stdio only. */\n\tcommand: Schema.NullOr(Schema.String),\n\targs: Schema.Array(Schema.String),\n\t/** http/sse only. */\n\turl: Schema.NullOr(Schema.String),\n\t/** Names of env vars / headers the config references (values withheld). */\n\tenvVarNames: Schema.Array(Schema.String),\n\t/** `enabled = false` in the native config itself (codex supports this). */\n\tenabledInConfig: Schema.Boolean,\n\t/** Effective Zuse-side toggle (global ∪ per-repository overrides). */\n\tdisabledByZuse: Schema.Boolean,\n\t/** False for provider-managed entries with no safe native mutation API. */\n\ttoggleSupported: Schema.Boolean,\n\t/** Authentication action offered by the UI, if any. */\n\tauthenticationAction: Schema.NullOr(McpAuthenticationAction),\n\t/** Provider-owned connect/manage URL; never contains held credentials. */\n\tmanageUrl: Schema.NullOr(Schema.String),\n});\nexport type McpServerDescriptor = typeof McpServerDescriptor.Type;\n\nexport const McpServerState = Schema.Literals([\n\t\"connected\",\n\t\"connecting\",\n\t\"error\",\n\t\"needs-auth\",\n\t\"disabled\",\n]);\nexport type McpServerState = typeof McpServerState.Type;\n\n/**\n * A prerequisite the server needs before it can connect, shown under the\n * row in the popover/settings (\"command not found: uvx\", \"env var\n * LINEAR_API_KEY is not set\", \"authentication required\").\n */\nexport const McpRequirement = Schema.Struct({\n\tkind: Schema.Literals([\"command\", \"env\", \"auth\"]),\n\tdetail: Schema.String,\n\tsatisfied: Schema.Boolean,\n});\nexport type McpRequirement = typeof McpRequirement.Type;\n\nexport const McpServerStatus = Schema.Struct({\n\tkey: Schema.String,\n\tname: Schema.String,\n\tsource: McpServerSource,\n\tstate: McpServerState,\n\ttoolCount: Schema.NullOr(Schema.Number),\n\ttoolNames: Schema.Array(Schema.String),\n\t/** Human-readable failure reason when `state === \"error\"`. */\n\terror: Schema.NullOr(Schema.String),\n\t/** How the server authenticates when `state === \"needs-auth\"`. */\n\tauthMethod: Schema.NullOr(Schema.Literals([\"oauth\", \"token\"])),\n\trequirements: Schema.Array(McpRequirement),\n\t/** Epoch ms of the probe that produced this status; 0 = never probed. */\n\tcheckedAt: Schema.Number,\n});\nexport type McpServerStatus = typeof McpServerStatus.Type;\n\nexport class McpConfigError extends Schema.TaggedErrorClass<McpConfigError>()(\n\t\"McpConfigError\",\n\t{ key: Schema.NullOr(Schema.String), reason: Schema.String },\n) {}\n\n/**\n * Filter for list/refresh. `projectId` resolves the project-scoped Claude\n * configs (`.mcp.json` + `~/.claude.json#projects[cwd]`) and applies\n * per-repository disable overrides; absent means user-level scopes only.\n * `provider` narrows to entries usable by that provider's sessions; absent\n * means the complete cross-provider inventory.\n */\nconst McpScopePayload = Schema.Struct({\n\tprojectId: Schema.optional(FolderId),\n\tprovider: Schema.optional(ProviderId),\n});\n\n/**\n * Unified inventory + last-known statuses. Returns the cached snapshot after\n * one initial provider discovery; `mcp.refresh` explicitly forces a new\n * discovery and status probe.\n */\nexport const McpListRpc = Rpc.make(\"mcp.list\", {\n\tpayload: McpScopePayload,\n\tsuccess: Schema.Struct({\n\t\tservers: Schema.Array(McpServerDescriptor),\n\t\tstatuses: Schema.Array(McpServerStatus),\n\t}),\n\terror: McpConfigError,\n});\n\nexport const McpRefreshRpc = Rpc.make(\"mcp.refresh\", {\n\tpayload: McpScopePayload,\n\tsuccess: Schema.Struct({\n\t\tservers: Schema.Array(McpServerDescriptor),\n\t\tstatuses: Schema.Array(McpServerStatus),\n\t}),\n\terror: McpConfigError,\n});\n\n/**\n * Zuse-side enable/disable override (never rewrites claude configs; for\n * codex-source servers it writes the native `enabled` flag, which is the\n * documented Codex semantics). Omitted `projectId` toggles globally.\n */\nexport const McpSetEnabledRpc = Rpc.make(\"mcp.setEnabled\", {\n\tpayload: Schema.Struct({\n\t\tkey: Schema.String,\n\t\tenabled: Schema.Boolean,\n\t\tprojectId: Schema.optional(FolderId),\n\t}),\n\tsuccess: Schema.Void,\n\terror: McpConfigError,\n});\n\nexport const McpAuthenticateEvent = Schema.Union([\n\tSchema.TaggedStruct(\"browser-opened\", { url: Schema.String }),\n\tSchema.TaggedStruct(\"completed\", {}),\n\tSchema.TaggedStruct(\"failed\", { error: Schema.String }),\n]);\nexport type McpAuthenticateEvent = typeof McpAuthenticateEvent.Type;\n\n/**\n * Runs the OAuth flow for a `needs-auth` server: discovery + dynamic client\n * registration + PKCE with a loopback redirect for claude-source servers,\n * codex-native `mcpServer/oauth/login` for codex-source ones. Emits\n * progress until the browser round-trip completes.\n */\nexport const McpAuthenticateRpc = Rpc.make(\"mcp.authenticate\", {\n\tpayload: Schema.Struct({\n\t\tkey: Schema.String,\n\t\tprojectId: Schema.optional(FolderId),\n\t}),\n\tsuccess: McpAuthenticateEvent,\n\terror: McpConfigError,\n\tstream: true,\n});\n","import { Schema } from \"effect\";\n\nexport const NetworkAccessMode = Schema.Literals([\n\t\"local-only\",\n\t\"network-accessible\",\n]);\nexport type NetworkAccessMode = typeof NetworkAccessMode.Type;\n\nexport class NetworkAccessState extends Schema.Class<NetworkAccessState>(\n\t\"NetworkAccessState\",\n)({\n\tmode: NetworkAccessMode,\n\tadvertisedHost: Schema.NullOr(Schema.String),\n\tendpointUrl: Schema.NullOr(Schema.String),\n\tport: Schema.Number,\n}) {}\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { AuthTokenId } from \"./ids.ts\";\n\nexport class PairingStartResult extends Schema.Class<PairingStartResult>(\n\t\"PairingStartResult\",\n)({\n\tpairingUrl: Schema.String,\n\tbrowserUrl: Schema.String,\n\tcode: Schema.String,\n\tqrText: Schema.String,\n\texpiresAt: Schema.DateFromString,\n}) {}\n\nexport class AuthTokenSummary extends Schema.Class<AuthTokenSummary>(\n\t\"AuthTokenSummary\",\n)({\n\tid: AuthTokenId,\n\tdeviceId: Schema.optional(Schema.String),\n\tlabel: Schema.optional(Schema.String),\n\tcreatedAt: Schema.DateFromString,\n\tlastUsedAt: Schema.optional(Schema.DateFromString),\n\trevokedAt: Schema.optional(Schema.DateFromString),\n}) {}\n\nexport class PairingError extends Schema.TaggedErrorClass<PairingError>()(\n\t\"PairingError\",\n\t{ reason: Schema.String },\n) {}\n\nexport class NearbyPairingRequest extends Schema.Class<NearbyPairingRequest>(\n\t\"NearbyPairingRequest\",\n)({\n\trequestId: Schema.String,\n\tdeviceId: Schema.String,\n\tdeviceLabel: Schema.String,\n\tdeviceModel: Schema.optional(Schema.String),\n\tdeviceIdentifier: Schema.String,\n\tdevicePublicKey: Schema.String,\n\tephemeralPublicKey: Schema.String,\n\tclientNonce: Schema.String,\n\tserverNonce: Schema.String,\n\tsafetyPhrase: Schema.String,\n\tcreatedAt: Schema.DateFromString,\n\texpiresAt: Schema.DateFromString,\n}) {}\n\nexport const PairingStartRpc = Rpc.make(\"pairing.start\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: PairingStartResult,\n\terror: PairingError,\n});\n\nexport const PairingListTokensRpc = Rpc.make(\"pairing.listTokens\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: Schema.Array(AuthTokenSummary),\n\terror: PairingError,\n});\n\nexport const PairingRevokeTokenRpc = Rpc.make(\"pairing.revokeToken\", {\n\tpayload: Schema.Struct({ tokenId: AuthTokenId }),\n\tsuccess: Schema.Void,\n\terror: PairingError,\n});\n\nexport const PairingListNearbyRequestsRpc = Rpc.make(\n\t\"pairing.listNearbyRequests\",\n\t{\n\t\tpayload: Schema.Struct({}),\n\t\tsuccess: Schema.Array(NearbyPairingRequest),\n\t\terror: PairingError,\n\t},\n);\n\nexport const PairingResolveNearbyRequestRpc = Rpc.make(\n\t\"pairing.resolveNearbyRequest\",\n\t{\n\t\tpayload: Schema.Struct({\n\t\t\trequestId: Schema.String,\n\t\t\tdecision: Schema.Literals([\"allow\", \"deny\", \"block\"]),\n\t\t}),\n\t\tsuccess: Schema.Literals([\"approved\", \"denied\"]),\n\t\terror: PairingError,\n\t},\n);\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { FolderId } from \"./ids.ts\";\nimport { SessionId } from \"./session.ts\";\n\n/**\n * What the agent is asking permission to do. The discriminated union keeps the\n * UI copy and the matcher honest — adding a new kind is a wire change, not a\n * stringly-typed addition. `detail` on the request carries kind-specific data\n * (cwd, args, etc.) that the toast renders for context.\n */\nexport const PermissionKind = Schema.Union([\n\tSchema.TaggedStruct(\"FileWrite\", { path: Schema.String }),\n\tSchema.TaggedStruct(\"Bash\", { command: Schema.String }),\n\tSchema.TaggedStruct(\"Network\", { url: Schema.String }),\n\t// Catch-all for tools we don't classify yet (`Read`, `Glob`, MCP, …). The\n\t// server defaults these to AllowOnce auto-pass for now; surfacing the union\n\t// member keeps the protocol open without a separate \"unknown\" path.\n\tSchema.TaggedStruct(\"Other\", {\n\t\ttool: Schema.String,\n\t\tsummary: Schema.String,\n\t}),\n]);\nexport type PermissionKind = typeof PermissionKind.Type;\n\n/**\n * User's choice in the toast. `AllowForSession` is enforced in the in-process\n * driver loop (server short-circuits a re-prompt with the same kind+key\n * within the same session). `AlwaysAllow` is plumbing for a later folder /\n * global allow-list UI — Phase 4 never produces it.\n */\nexport const PermissionDecision = Schema.Union([\n\tSchema.TaggedStruct(\"AllowOnce\", {}),\n\tSchema.TaggedStruct(\"AllowForSession\", {}),\n\tSchema.TaggedStruct(\"Deny\", {}),\n\tSchema.TaggedStruct(\"AlwaysAllow\", {\n\t\tscope: Schema.Literals([\"folder\", \"global\"]),\n\t}),\n]);\nexport type PermissionDecision = typeof PermissionDecision.Type;\n\n/**\n * One outstanding prompt. `id` is the server-minted handle the renderer hands\n * back via `permission.decide`. Multiple requests can be in flight for the\n * same session; the toast shows them one at a time.\n */\nexport class PermissionRequest extends Schema.Class<PermissionRequest>(\n\t\"PermissionRequest\",\n)({\n\tid: Schema.String,\n\tsessionId: SessionId,\n\tkind: PermissionKind,\n\trequestedAt: Schema.DateFromString,\n\t/**\n\t * When true, the renderer disables `AllowForSession` and `AlwaysAllow` so\n\t * the user can't silence future matching prompts by accident.\n\t *\n\t * Set server-side for more than just credential files:\n\t * - sensitive paths (`.env`, `.ssh`, keys, etc.) on file ops\n\t * - plan mode (every bash / mutating / network gate)\n\t * - a few always-prompt tools (e.g. browser login, ExitPlanMode)\n\t *\n\t * Do not treat `forcePrompt` as \"this path is sensitive\" in the UI —\n\t * bash/network prompts almost never are; they usually mean plan mode.\n\t */\n\tforcePrompt: Schema.Boolean,\n}) {}\n\n/**\n * One row from `permission_decisions`, denormalized for the inspector UI.\n * Mirrors the table columns but keeps the kind as the structured wire type\n * so the renderer doesn't re-parse JSON.\n */\nexport class SavedDecision extends Schema.Class<SavedDecision>(\"SavedDecision\")(\n\t{\n\t\trequestId: Schema.String,\n\t\tsessionId: SessionId,\n\t\tprojectId: Schema.NullOr(FolderId),\n\t\tkind: PermissionKind,\n\t\tdecision: Schema.Literals([\n\t\t\t\"AllowOnce\",\n\t\t\t\"AllowForSession\",\n\t\t\t\"AlwaysAllow\",\n\t\t\t\"Deny\",\n\t\t]),\n\t\tscope: Schema.Literals([\"session\", \"folder\", \"global\"]),\n\t\tdecidedAt: Schema.DateFromString,\n\t},\n) {}\n\nexport class PermissionRequestNotFoundError extends Schema.TaggedErrorClass<PermissionRequestNotFoundError>()(\n\t\"PermissionRequestNotFoundError\",\n\t{ requestId: Schema.String },\n) {}\n\nexport const PermissionRequestChange = Schema.Union([\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"snapshot\"),\n\t\trequests: Schema.Array(PermissionRequest),\n\t}),\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"change\"),\n\t\trequest: PermissionRequest,\n\t}),\n\tSchema.Struct({\n\t\t_tag: Schema.Literal(\"remove\"),\n\t\trequestId: Schema.String,\n\t}),\n]);\nexport type PermissionRequestChange = typeof PermissionRequestChange.Type;\n\n// ---------------------------------------------------------------------------\n// RPCs\n// ---------------------------------------------------------------------------\n\n/**\n * Live stream of pending requests across every session. The renderer\n * filters by selected session; broadcasting once and filtering on the\n * client is cheaper than per-session subscriptions and means a session\n * switch doesn't have to tear anything down on the server.\n */\nexport const PermissionRequestsRpc = Rpc.make(\"permission.requests\", {\n\tpayload: Schema.Struct({}),\n\tsuccess: PermissionRequestChange,\n\tstream: true,\n});\n\nexport const PermissionDecideRpc = Rpc.make(\"permission.decide\", {\n\tpayload: Schema.Struct({\n\t\trequestId: Schema.String,\n\t\tdecision: PermissionDecision,\n\t}),\n\tsuccess: Schema.Void,\n\terror: PermissionRequestNotFoundError,\n});\n\n/**\n * Cold-load helper for renderer hydration. Returns every request that the\n * server is still awaiting a decision for, scoped to one session. Used on\n * mount and after a reconnection so the toast comes back without waiting for\n * the next stream message.\n */\nexport const PermissionListPendingRpc = Rpc.make(\"permission.listPending\", {\n\tpayload: Schema.Struct({ sessionId: SessionId }),\n\tsuccess: Schema.Array(PermissionRequest),\n});\n\n/**\n * Inspector RPCs. `listDecisions` returns saved decisions optionally filtered\n * by project (typical use is per-project from the projects sidebar). `revoke`\n * deletes a single row by `requestId` so the next matching request re-prompts.\n */\nexport const PermissionListDecisionsRpc = Rpc.make(\"permission.listDecisions\", {\n\tpayload: Schema.Struct({\n\t\tprojectId: Schema.optional(FolderId),\n\t}),\n\tsuccess: Schema.Array(SavedDecision),\n});\n\nexport const PermissionRevokeDecisionRpc = Rpc.make(\n\t\"permission.revokeDecision\",\n\t{\n\t\tpayload: Schema.Struct({ requestId: Schema.String }),\n\t\tsuccess: Schema.Void,\n\t},\n);\n","import { Rpc } from \"effect/unstable/rpc\";\nimport { Schema } from \"effect\";\n\nexport class PingResult extends Schema.Class<PingResult>(\"PingResult\")({\n message: Schema.Literal(\"pong\"),\n receivedAt: Schema.DateFromString,\n}) {}\n\nexport class PingError extends Schema.TaggedErrorClass<PingError>()(\"PingError\", {\n message: Schema.String,\n}) {}\n\nexport const PingRpc = Rpc.make(\"ping.ping\", {\n payload: Schema.Struct({}),\n success: PingResult,\n error: PingError,\n});\n","import { Schema } from \"effect\";\n\nexport const POWER_STATE_CHANNEL = \"zuse:power-state\" as const;\nexport const POWER_SUBSCRIBE_CHANNEL = \"zuse:power-subscribe\" as const;\nexport const POWER_UNSUBSCRIBE_CHANNEL = \"zuse:power-unsubscribe\" as const;\nexport const POWER_GET_STATE_CHANNEL = \"zuse:power-get-state\" as const;\nexport const POWER_START_RECORDING_CHANNEL =\n\t\"zuse:power-start-recording\" as const;\nexport const POWER_STOP_RECORDING_CHANNEL =\n\t\"zuse:power-stop-recording\" as const;\nexport const POWER_EXPORT_RECORDING_CHANNEL =\n\t\"zuse:power-export-recording\" as const;\nexport const POWER_REPORT_WORKLOAD_CHANNEL =\n\t\"zuse:power-report-workload\" as const;\nexport const POWER_REPORT_LAG_CHANNEL = \"zuse:power-report-lag\" as const;\nexport const POWER_GET_HISTORY_CHANNEL = \"zuse:power-get-history\" as const;\nexport const POWER_CLEAR_HISTORY_CHANNEL = \"zuse:power-clear-history\" as const;\nexport const POWER_RECORDING_DURATION_MINUTES = [5, 15, 30] as const;\n\nexport const PowerSource = Schema.Literals([\"battery\", \"ac\", \"unknown\"]);\nexport type PowerSource = typeof PowerSource.Type;\n\nexport const PowerThermalState = Schema.Literals([\n\t\"unknown\",\n\t\"nominal\",\n\t\"fair\",\n\t\"serious\",\n\t\"critical\",\n]);\nexport type PowerThermalState = typeof PowerThermalState.Type;\n\nexport const PowerProcessType = Schema.Literals([\n\t\"main\",\n\t\"renderer\",\n\t\"gpu\",\n\t\"utility\",\n\t\"other\",\n]);\nexport type PowerProcessType = typeof PowerProcessType.Type;\n\nexport const PowerMemoryKind = Schema.Literals([\"private\", \"working-set\"]);\nexport type PowerMemoryKind = typeof PowerMemoryKind.Type;\n\nexport const PerformanceConfidence = Schema.Literals([\"low\", \"medium\", \"high\"]);\nexport type PerformanceConfidence = typeof PerformanceConfidence.Type;\n\nexport const PerformanceCapabilityState = Schema.Literals([\n\t\"supported\",\n\t\"estimated\",\n\t\"unavailable\",\n]);\nexport type PerformanceCapabilityState = typeof PerformanceCapabilityState.Type;\n\nexport const PerformanceCapability = Schema.Struct({\n\tstate: PerformanceCapabilityState,\n\treason: Schema.optional(Schema.String),\n});\nexport type PerformanceCapability = typeof PerformanceCapability.Type;\n\nexport class PerformanceCapabilities extends Schema.Class<PerformanceCapabilities>(\n\t\"PerformanceCapabilities\",\n)({\n\tprocessMetrics: PerformanceCapability,\n\tidleWakeups: PerformanceCapability,\n\tbatteryLevel: PerformanceCapability,\n\tbatteryDrain: PerformanceCapability,\n\tthermalPressure: PerformanceCapability,\n\texactTemperature: PerformanceCapability,\n\tdeepEnergy: PerformanceCapability,\n}) {}\n\nexport const PowerWorkloadState = Schema.Struct({\n\tactiveAgents: Schema.Number,\n\tactiveTerminals: Schema.Number,\n\tbrowserSessions: Schema.Number,\n\tactiveBrowserSessions: Schema.Number,\n\tbrowserRecordings: Schema.Number,\n\tindexing: Schema.Boolean,\n});\nexport type PowerWorkloadState = typeof PowerWorkloadState.Type;\n\nexport class PowerProcessMetric extends Schema.Class<PowerProcessMetric>(\n\t\"PowerProcessMetric\",\n)({\n\tprocessType: PowerProcessType,\n\tpid: Schema.Number,\n\tcreationTimeMs: Schema.Number,\n\tname: Schema.optional(Schema.String),\n\tcpuPercent: Schema.Number,\n\tcumulativeCpuSeconds: Schema.NullOr(Schema.Number),\n\tidleWakeupsPerSecond: Schema.Number,\n\tmemoryBytes: Schema.Number,\n\tmemoryKind: PowerMemoryKind,\n}) {}\n\nexport class PowerSnapshot extends Schema.Class<PowerSnapshot>(\"PowerSnapshot\")(\n\t{\n\t\tcapturedAt: Schema.String,\n\t\tpowerSource: PowerSource,\n\t\tthermalState: PowerThermalState,\n\t\twindowVisible: Schema.Boolean,\n\t\tprocesses: Schema.Array(PowerProcessMetric),\n\t\tworkload: PowerWorkloadState,\n\t\ttotalCpuPercent: Schema.Number,\n\t\ttotalIdleWakeupsPerSecond: Schema.Number,\n\t\ttotalMemoryBytes: Schema.Number,\n\t\tmemoryKind: PowerMemoryKind,\n\t\tlogicalCpuCount: Schema.optional(Schema.Number),\n\t\teventLoopP99Ms: Schema.optional(Schema.Number),\n\t\tbatteryPercent: Schema.optional(Schema.NullOr(Schema.Number)),\n\t\tisCharging: Schema.optional(Schema.NullOr(Schema.Boolean)),\n\t},\n) {}\n\nexport const LagKind = Schema.Literals([\n\t\"long-task\",\n\t\"long-animation-frame\",\n\t\"animation-stall\",\n\t\"input-latency\",\n\t\"react-commit\",\n\t\"rpc\",\n\t\"event-loop\",\n\t\"gc\",\n]);\nexport type LagKind = typeof LagKind.Type;\n\nexport const StallCause = Schema.Literals([\n\t\"script\",\n\t\"style-layout\",\n\t\"react-render\",\n\t\"input-handler\",\n\t\"rpc\",\n\t\"event-loop\",\n\t\"gc\",\n\t\"workload\",\n\t\"unknown\",\n]);\nexport type StallCause = typeof StallCause.Type;\n\nconst SanitizedStallText = Schema.String.check(\n\tSchema.isMaxLength(120),\n\tSchema.isPattern(/^[a-zA-Z0-9_.$: -]*$/),\n);\nconst SanitizedStallContext = Schema.Array(SanitizedStallText).check(\n\tSchema.isMaxLength(8),\n);\n\nexport class StallAttribution extends Schema.Class<StallAttribution>(\n\t\"StallAttribution\",\n)({\n\tcause: StallCause,\n\tlabel: SanitizedStallText,\n\tconfidence: PerformanceConfidence,\n\tblockingDurationMs: Schema.optional(Schema.Number),\n\trenderDurationMs: Schema.optional(Schema.Number),\n\tstyleLayoutDurationMs: Schema.optional(Schema.Number),\n\tscriptInvoker: Schema.optional(SanitizedStallText),\n\tscriptFunction: Schema.optional(SanitizedStallText),\n\tscriptSource: Schema.optional(SanitizedStallText),\n\tscriptPosition: Schema.optional(Schema.Number),\n\treactPhase: Schema.optional(\n\t\tSchema.Literals([\"mount\", \"update\", \"nested-update\"]),\n\t),\n\treactBaseDurationMs: Schema.optional(Schema.Number),\n\trecentActions: SanitizedStallContext,\n\tactiveWorkloads: SanitizedStallContext,\n\trelatedOperations: SanitizedStallContext,\n}) {}\n\nexport class LagSample extends Schema.Class<LagSample>(\"LagSample\")({\n\tid: Schema.String,\n\tcapturedAt: Schema.String,\n\tkind: LagKind,\n\tdurationMs: Schema.Number,\n\tsource: Schema.Literals([\"renderer\", \"main\", \"server\"]),\n\tname: Schema.optional(Schema.String),\n\tsessionId: Schema.optional(Schema.NullOr(Schema.String)),\n\tattribution: Schema.optional(StallAttribution),\n}) {}\n\nexport class WorkloadInterval extends Schema.Class<WorkloadInterval>(\n\t\"WorkloadInterval\",\n)({\n\tid: Schema.String,\n\tkind: Schema.String,\n\tstartedAt: Schema.String,\n\tendedAt: Schema.optional(Schema.NullOr(Schema.String)),\n\tprojectId: Schema.optional(Schema.NullOr(Schema.String)),\n\tsessionId: Schema.optional(Schema.NullOr(Schema.String)),\n\tproviderId: Schema.optional(Schema.NullOr(Schema.String)),\n}) {}\n\nexport class PerformanceIncident extends Schema.Class<PerformanceIncident>(\n\t\"PerformanceIncident\",\n)({\n\tid: Schema.String,\n\tkind: Schema.Literals([\n\t\t\"cpu\",\n\t\t\"wakeups\",\n\t\t\"memory-growth\",\n\t\t\"battery-drain\",\n\t\t\"thermal\",\n\t\t\"lag\",\n\t]),\n\tseverity: Schema.Literals([\"info\", \"warn\", \"error\"]),\n\tstartedAt: Schema.String,\n\tendedAt: Schema.String,\n\tmessage: Schema.String,\n\tvalue: Schema.Number,\n\tunit: Schema.String,\n\toccurrences: Schema.Number,\n\tconfidence: PerformanceConfidence,\n\tlikelyContributor: Schema.optional(Schema.String),\n}) {}\n\nexport class ProcessResourceSample extends Schema.Class<ProcessResourceSample>(\n\t\"ProcessResourceSample\",\n)({\n\tprocessType: PowerProcessType,\n\tpid: Schema.Number,\n\tname: Schema.optional(Schema.String),\n\taverageCpuPercent: Schema.Number,\n\tpeakCpuPercent: Schema.Number,\n\tcpuSeconds: Schema.NullOr(Schema.Number),\n\taverageIdleWakeupsPerSecond: Schema.Number,\n\tpeakMemoryBytes: Schema.Number,\n\tmemoryGrowthBytes: Schema.Number,\n}) {}\n\nexport class PerformanceOverview extends Schema.Class<PerformanceOverview>(\n\t\"PerformanceOverview\",\n)({\n\treadAt: Schema.String,\n\tsampleCount: Schema.Number,\n\taverageCpuPercent: Schema.Number,\n\tpeakCpuPercent: Schema.Number,\n\tpeakMemoryBytes: Schema.Number,\n\tmemoryGrowthBytes: Schema.Number,\n\taverageIdleWakeupsPerSecond: Schema.Number,\n\teventLoopP99Ms: Schema.Number,\n\tbatteryDrainPercentPerHour: Schema.NullOr(Schema.Number),\n\tbatteryDrainConfidence: PerformanceConfidence,\n\tthermalState: PowerThermalState,\n\tresponsiveness: Schema.Literals([\"good\", \"degraded\", \"poor\"]),\n\tincidents: Schema.Array(PerformanceIncident),\n\thotspots: Schema.Array(ProcessResourceSample),\n}) {}\n\nexport class PerformanceHistory extends Schema.Class<PerformanceHistory>(\n\t\"PerformanceHistory\",\n)({\n\treadAt: Schema.String,\n\tsince: Schema.String,\n\tcapabilities: PerformanceCapabilities,\n\tsamples: Schema.Array(PowerSnapshot),\n\tlagSamples: Schema.Array(LagSample),\n\toverview: PerformanceOverview,\n\tstorageBytes: Schema.Number,\n\tpartial: Schema.Boolean,\n\twarnings: Schema.Array(Schema.String),\n}) {}\n\nexport const PowerSummary = Schema.Struct({\n\tstartedAt: Schema.String,\n\tendedAt: Schema.String,\n\tdurationMs: Schema.Number,\n\tsampleCount: Schema.Number,\n\taverageCpuPercent: Schema.Number,\n\tpeakCpuPercent: Schema.Number,\n\taverageIdleWakeupsPerSecond: Schema.Number,\n\tpeakIdleWakeupsPerSecond: Schema.Number,\n\tstartMemoryBytes: Schema.Number,\n\tendMemoryBytes: Schema.Number,\n\tmemoryChangeBytes: Schema.Number,\n\tpeakMemoryBytes: Schema.Number,\n\tmemoryKind: PowerMemoryKind,\n\tpeakProcessCount: Schema.Number,\n});\nexport type PowerSummary = typeof PowerSummary.Type;\n\nexport const PowerRecordingDurationMinutes = Schema.Literals(\n\tPOWER_RECORDING_DURATION_MINUTES,\n);\nexport type PowerRecordingDurationMinutes =\n\ttypeof PowerRecordingDurationMinutes.Type;\n\nexport class PowerActiveRecording extends Schema.Class<PowerActiveRecording>(\n\t\"PowerActiveRecording\",\n)({\n\tid: Schema.String,\n\tstartedAt: Schema.String,\n\tendsAt: Schema.String,\n\tdurationMinutes: PowerRecordingDurationMinutes,\n\tsampleCount: Schema.Number,\n\tdeepProfileStatus: Schema.optional(\n\t\tSchema.Literals([\"authorizing\", \"collecting\", \"complete\", \"unavailable\"]),\n\t),\n}) {}\n\nexport class DeepEnergySummary extends Schema.Class<DeepEnergySummary>(\n\t\"DeepEnergySummary\",\n)({\n\tstatus: Schema.Literals([\"complete\", \"unavailable\", \"cancelled\"]),\n\tcpuPowerMw: Schema.NullOr(Schema.Number),\n\tgpuPowerMw: Schema.NullOr(Schema.Number),\n\tanePowerMw: Schema.NullOr(Schema.Number),\n\tcombinedPowerMw: Schema.NullOr(Schema.Number),\n\tthermalPressure: Schema.optional(Schema.String),\n\treason: Schema.optional(Schema.String),\n}) {}\n\nexport class PowerSpikeSample extends Schema.Class<PowerSpikeSample>(\n\t\"PowerSpikeSample\",\n)({\n\tcapturedAt: Schema.String,\n\ttotalCpuPercent: Schema.Number,\n\ttotalIdleWakeupsPerSecond: Schema.Number,\n\ttotalMemoryBytes: Schema.Number,\n\tworkload: PowerWorkloadState,\n}) {}\n\nexport class PowerCompletedRecording extends Schema.Class<PowerCompletedRecording>(\n\t\"PowerCompletedRecording\",\n)({\n\tid: Schema.String,\n\tstartedAt: Schema.String,\n\tendedAt: Schema.String,\n\tdurationMinutes: PowerRecordingDurationMinutes,\n\tsummary: PowerSummary,\n\thighestSamples: Schema.Array(PowerSpikeSample),\n\tdeepEnergy: Schema.optional(DeepEnergySummary),\n}) {}\n\nexport class PowerMonitorState extends Schema.Class<PowerMonitorState>(\n\t\"PowerMonitorState\",\n)({\n\tlatestSnapshot: Schema.NullOr(PowerSnapshot),\n\tfiveMinuteSummary: Schema.NullOr(PowerSummary),\n\tactiveRecording: Schema.NullOr(PowerActiveRecording),\n\tlatestRecording: Schema.NullOr(PowerCompletedRecording),\n}) {}\n\nexport class PowerInteractionMeasurement extends Schema.Class<PowerInteractionMeasurement>(\n\t\"PowerInteractionMeasurement\",\n)({\n\trecordedAt: Schema.String,\n\tname: Schema.String,\n\tdurationMs: Schema.Number,\n}) {}\n\nexport class PowerExportResult extends Schema.Class<PowerExportResult>(\n\t\"PowerExportResult\",\n)({\n\tjsonPath: Schema.String,\n\tmarkdownPath: Schema.String,\n}) {}\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { PtyId } from \"./ids.ts\";\n\n/**\n * Output emitted by a live PTY. The stream completes after the `exit` event;\n * renderers should treat that as a terminal-closed signal.\n */\nexport const PtyDataEvent = Schema.TaggedStruct(\"data\", {\n sequence: Schema.Number,\n bytes: Schema.String,\n});\n\nexport const PtyExitEvent = Schema.TaggedStruct(\"exit\", {\n sequence: Schema.Number,\n exitCode: Schema.NullOr(Schema.Number),\n signal: Schema.NullOr(Schema.Number),\n});\n\nexport const PtyCursorEvent = Schema.TaggedStruct(\"cursor\", {\n sequence: Schema.Number,\n});\n\nexport const PtyGapEvent = Schema.TaggedStruct(\"gap\", {\n requestedAfter: Schema.Number,\n earliestAvailable: Schema.Number,\n latestAvailable: Schema.Number,\n});\n\nexport const PtyEvent = Schema.Union([\n PtyDataEvent,\n PtyExitEvent,\n PtyCursorEvent,\n PtyGapEvent,\n]);\n\nexport class PtyNotFoundError extends Schema.TaggedErrorClass<PtyNotFoundError>()(\n \"PtyNotFoundError\",\n { ptyId: PtyId },\n) {}\n\nexport class PtySpawnError extends Schema.TaggedErrorClass<PtySpawnError>()(\n \"PtySpawnError\",\n { reason: Schema.String },\n) {}\n\n/**\n * Optional override for what process the PTY hosts. Omitted → host the user's\n * default login shell (Phase 1 behavior). Present → spawn `cmd` with `args` as\n * the PTY's foreground process, used by spawn-CLI agent launches so closing\n * the pane terminates the agent rather than just one shell among many.\n */\nexport const PtyCommand = Schema.Struct({\n cmd: Schema.String,\n args: Schema.Array(Schema.String),\n env: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\nexport type PtyCommand = typeof PtyCommand.Type;\n\nexport const PtyOpenRpc = Rpc.make(\"pty.open\", {\n payload: Schema.Struct({\n cwd: Schema.String,\n cols: Schema.Number,\n rows: Schema.Number,\n command: Schema.optional(PtyCommand),\n }),\n success: Schema.Struct({ ptyId: PtyId }),\n error: PtySpawnError,\n});\n\nexport const PtyWriteRpc = Rpc.make(\"pty.write\", {\n payload: Schema.Struct({ ptyId: PtyId, data: Schema.String }),\n success: Schema.Void,\n error: PtyNotFoundError,\n});\n\nexport const PtyResizeRpc = Rpc.make(\"pty.resize\", {\n payload: Schema.Struct({\n ptyId: PtyId,\n cols: Schema.Number,\n rows: Schema.Number,\n }),\n success: Schema.Void,\n error: PtyNotFoundError,\n});\n\nexport const PtyCloseRpc = Rpc.make(\"pty.close\", {\n payload: Schema.Struct({ ptyId: PtyId }),\n success: Schema.Void,\n error: PtyNotFoundError,\n});\n\nexport const PtyOutputRpc = Rpc.make(\"pty.output\", {\n payload: Schema.Struct({\n ptyId: PtyId,\n afterSequence: Schema.optional(Schema.Number),\n }),\n success: PtyEvent,\n error: PtyNotFoundError,\n stream: true,\n});\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\nimport {\n\tCapabilityManifest,\n\tConnectAuthError,\n\tEnvironmentEndpoint,\n\tEnvironmentEndpointHealth,\n\tEnvironmentServiceState,\n\tProviderKind,\n} from \"./connect.ts\";\nimport { EnvironmentId } from \"./ids.ts\";\n\n// ---------------------------------------------------------------------------\n// Relay HTTP contract\n// ---------------------------------------------------------------------------\n//\n// The relay is a thin control plane reached over HTTP (not the WS RPC surface):\n// it links a WorkOS account to the environments it controls, brokers short-lived\n// DPoP-bound connect tokens, and reports presence. It is never in the data path.\n//\n// These are the shared request/response shapes + path builders used by the\n// desktop (self-registration) and mobile (discovery) clients, and mirrored by\n// `@zuse/relay`. Auth is carried in headers, not bodies:\n// - WorkOS bearer: `Authorization: Bearer <workos access token>`\n// - DPoP-bound access token: `Authorization: DPoP <token>` + `DPoP: <proof>`\n// - environment credential: `Authorization: Bearer zenv_…`\n\n/** Paths, centralised so client + relay never drift. */\nexport const RelayPaths = {\n\tauthToken: \"/v1/auth/token\",\n\tlinkChallenges: \"/v1/client/environment-link-challenges\",\n\tlinks: \"/v1/client/environment-links\",\n\t/** Unlink (WorkOS bearer): deprovisions the managed tunnel + removes the env. */\n\tunlink: \"/v1/client/environment-unlink\",\n\tenvironments: \"/v1/environments\",\n\tdpopToken: \"/v1/client/dpop-token\",\n\tdevices: \"/v1/mobile/devices\",\n\tclients: \"/v1/clients\",\n\tclient: (clientId: string) => `/v1/clients/${encodeURIComponent(clientId)}`,\n\taccount: \"/v1/account\",\n\tstatus: (environmentId: string) =>\n\t\t`/v1/environments/${encodeURIComponent(environmentId)}/status`,\n\tconnect: (environmentId: string) =>\n\t\t`/v1/environments/${encodeURIComponent(environmentId)}/connect`,\n\theartbeat: (environmentId: string) =>\n\t\t`/v1/environments/${encodeURIComponent(environmentId)}/heartbeat`,\n\tagentActivity: (environmentId: string) =>\n\t\t`/v1/environments/${encodeURIComponent(environmentId)}/agent-activity`,\n\tmachineOffers: \"/v1/machine-offers\",\n\tmachines: \"/v1/machines\",\n\tmachine: (machineId: string) =>\n\t\t`/v1/machines/${encodeURIComponent(machineId)}`,\n\tmachineCancel: (machineId: string) =>\n\t\t`/v1/machines/${encodeURIComponent(machineId)}/cancel`,\n\tmachineRecover: (machineId: string) =>\n\t\t`/v1/machines/${encodeURIComponent(machineId)}/recover`,\n\tmachineDestroy: (machineId: string) =>\n\t\t`/v1/machines/${encodeURIComponent(machineId)}/destroy`,\n\tmachineEnroll: \"/v1/machines/enroll\",\n\tmachineBootStatus: (machineId: string) =>\n\t\t`/v1/machines/${encodeURIComponent(machineId)}/boot-status`,\n\tbillingCheckout: \"/v1/billing/checkout\",\n\tbillingCheckoutComplete: \"/v1/billing/checkout/complete\",\n\tbillingEntitlements: \"/v1/billing/entitlements\",\n\tbillingPortal: \"/v1/billing/portal\",\n\tbillingWebhook: \"/v1/billing/webhook\",\n\tbillingProviderWebhook: (providerId: string) =>\n\t\t`/v1/billing/webhook/${encodeURIComponent(providerId)}`,\n\tcloudBillingSummary: \"/v1/cloud/billing/summary\",\n\tcloudBillingUsage: \"/v1/cloud/billing/usage\",\n\tcloudBillingCap: \"/v1/cloud/billing/cap\",\n\tcloudProviders: \"/v1/cloud/providers\",\n\tcloudProjects: \"/v1/cloud/projects\",\n\tcloudProjectPrepare: (projectId: string) =>\n\t\t`/v1/cloud/projects/${encodeURIComponent(projectId)}/prepare`,\n\tcloudWorkspaces: \"/v1/cloud/workspaces\",\n\tcloudWorkspace: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}`,\n\tcloudWorkspaceConnectionTicket: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/gateway/ticket`,\n\tcloudWorkspaceSshAccess: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/ssh-access`,\n\tcloudWorkspaceGateway: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/gateway`,\n\tcloudWorkspaceBootstrap: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/runtime/bootstrap`,\n\tcloudWorkspaceBootstrapAck: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/runtime/bootstrap/ack`,\n\tcloudWorkspaceRuntimeCredentialsRenew: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/runtime/credentials/renew`,\n\tcloudWorkspaceActivity: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/runtime/activity`,\n\tcloudWorkspaceSummary: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/runtime/summary`,\n\tcloudWorkspaceRuntimeTranscriptCheckpoint: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/runtime/transcript-checkpoint`,\n\tcloudWorkspaceRuntimeTranscriptMessagePage: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/runtime/transcript-message-page`,\n\tcloudWorkspaceTranscriptCheckpoint: (\n\t\tworkspaceId: string,\n\t\tsessionId: string,\n\t) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/sessions/${encodeURIComponent(sessionId)}/transcript-checkpoint`,\n\tcloudWorkspaceTranscriptMessagePage: (\n\t\tworkspaceId: string,\n\t\tsessionId: string,\n\t) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/sessions/${encodeURIComponent(sessionId)}/transcript-message-page`,\n\tcloudChats: \"/v1/cloud/chats\",\n\tcloudWorkspaceAction: (workspaceId: string, action: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/${encodeURIComponent(action)}`,\n\tcloudWorkspaceReady: (workspaceId: string) =>\n\t\t`/v1/cloud/workspaces/${encodeURIComponent(workspaceId)}/ready`,\n\tcloudCredentials: \"/v1/cloud/credentials\",\n\tcloudCredentialDisconnect: (kind: string) =>\n\t\t`/v1/cloud/credentials/${encodeURIComponent(kind)}/disconnect`,\n} as const;\n\nexport const RelayAuthTokenGrant = Schema.Union([\n\tSchema.Struct({\n\t\tgrantType: Schema.Literal(\"authorization_code\"),\n\t\tcode: Schema.String,\n\t\tcodeVerifier: Schema.String,\n\t}),\n\tSchema.Struct({\n\t\tgrantType: Schema.Literal(\"refresh_token\"),\n\t\trefreshToken: Schema.String,\n\t}),\n]);\nexport type RelayAuthTokenGrant = typeof RelayAuthTokenGrant.Type;\n\nexport const RelayAuthTokenResponse = Schema.Struct({\n\taccess_token: Schema.String,\n\trefresh_token: Schema.String,\n});\nexport type RelayAuthTokenResponse = typeof RelayAuthTokenResponse.Type;\n\n/** DPoP access-token scopes the relay recognises. */\nexport const RelayScope = Schema.Literals([\n\t\"environment:status\",\n\t\"environment:connect\",\n\t\"mobile:registration\",\n]);\nexport type RelayScope = typeof RelayScope.Type;\n\n// --- link challenge (desktop, WorkOS bearer) ---------------------------------\n\nexport class RelayLinkChallenge extends Schema.Class<RelayLinkChallenge>(\n\t\"RelayLinkChallenge\",\n)({\n\tchallengeId: Schema.String,\n\tchallenge: Schema.String,\n\trelayIssuer: Schema.String,\n\texpiresAt: Schema.Number,\n}) {}\n\n// --- link (desktop, WorkOS bearer) -------------------------------------------\n//\n// The desktop signs an Ed25519 JWT over { challenge, environmentId } (aud =\n// relayIssuer, typ = \"environment-link-proof+jwt\") and sends its public key so\n// the relay can verify this and every later proof.\n\nexport class RelayLinkRequest extends Schema.Class<RelayLinkRequest>(\n\t\"RelayLinkRequest\",\n)({\n\tchallengeId: Schema.String,\n\tproof: Schema.String,\n\tenvironmentId: EnvironmentId,\n\t/** The environment's Ed25519 public key, as a JWK JSON string. */\n\tenvironmentPublicKey: Schema.String,\n\tproviderKind: ProviderKind,\n\tendpoint: EnvironmentEndpoint,\n\tlabel: Schema.optional(Schema.String),\n\truntimeVersion: Schema.optional(Schema.String),\n\twireProtocolVersion: Schema.optional(Schema.Number),\n\tcapabilities: Schema.optional(CapabilityManifest),\n\tserviceState: Schema.optional(EnvironmentServiceState),\n}) {}\n\nexport class RelayLinkResponse extends Schema.Class<RelayLinkResponse>(\n\t\"RelayLinkResponse\",\n)({\n\tenvironmentId: EnvironmentId,\n\tendpoint: EnvironmentEndpoint,\n\trelayIssuer: Schema.String,\n\t/** Plaintext per-environment credential (`zenv_…`); the relay stores only its hash. */\n\tenvironmentCredential: Schema.String,\n\t/** Relay Ed25519 public key (JWK JSON) for verifying minted tokens. */\n\tmintPublicKey: Schema.String,\n}) {}\n\n// --- discovery (mobile/desktop, WorkOS bearer) -------------------------------\n\nexport class RelayEnvironmentRecord extends Schema.Class<RelayEnvironmentRecord>(\n\t\"RelayEnvironmentRecord\",\n)({\n\tenvironmentId: EnvironmentId,\n\tlabel: Schema.optional(Schema.String),\n\tproviderKind: ProviderKind,\n\tendpoint: Schema.optional(EnvironmentEndpoint),\n\tlinkedAt: Schema.Number,\n\truntimeVersion: Schema.optional(Schema.String),\n\twireProtocolVersion: Schema.optional(Schema.Number),\n\tcapabilities: Schema.optional(CapabilityManifest),\n\tserviceState: Schema.optional(EnvironmentServiceState),\n\tendpointHealth: Schema.optional(EnvironmentEndpointHealth),\n\tlastHeartbeat: Schema.optional(Schema.Number),\n\t/** Public environment identity used to verify environment-authored handoffs. */\n\tenvironmentPublicKey: Schema.optional(Schema.String),\n}) {}\n\nexport class RelayEnvironmentList extends Schema.Class<RelayEnvironmentList>(\n\t\"RelayEnvironmentList\",\n)({\n\tenvironments: Schema.Array(RelayEnvironmentRecord),\n}) {}\n\n// --- dpop token exchange (WorkOS bearer + DPoP proof) ------------------------\n\nexport class RelayAccessToken extends Schema.Class<RelayAccessToken>(\n\t\"RelayAccessToken\",\n)({\n\taccessToken: Schema.String,\n\texpiresIn: Schema.Number,\n}) {}\n\n// --- presence (mobile, DPoP) -------------------------------------------------\n\nexport const RelayPresence = Schema.Literals([\"online\", \"offline\"]);\nexport type RelayPresence = typeof RelayPresence.Type;\n\nexport class RelayEnvironmentStatus extends Schema.Class<RelayEnvironmentStatus>(\n\t\"RelayEnvironmentStatus\",\n)({\n\tstatus: RelayPresence,\n\tendpoint: EnvironmentEndpoint,\n\tendpointCandidates: Schema.optional(\n\t\tSchema.Array(\n\t\t\tSchema.Struct({\n\t\t\t\tkind: Schema.Literals([\"private-network\", \"managed-tunnel\"]),\n\t\t\t\tendpoint: EnvironmentEndpoint,\n\t\t\t}),\n\t\t),\n\t),\n\tcheckedAt: Schema.Number,\n}) {}\n\n// --- connect (mobile, DPoP) --------------------------------------------------\n\nexport class RelayConnectGrant extends Schema.Class<RelayConnectGrant>(\n\t\"RelayConnectGrant\",\n)({\n\tendpoint: EnvironmentEndpoint,\n\tendpointCandidates: Schema.optional(\n\t\tSchema.Array(\n\t\t\tSchema.Struct({\n\t\t\t\tkind: Schema.Literals([\"private-network\", \"managed-tunnel\"]),\n\t\t\t\tendpoint: EnvironmentEndpoint,\n\t\t\t}),\n\t\t),\n\t),\n\tconnectToken: Schema.String,\n\texpiresAt: Schema.Number,\n}) {}\n\nexport class RelayLocalPairingBinding extends Schema.Class<RelayLocalPairingBinding>(\n\t\"RelayLocalPairingBinding\",\n)({\n\tserverNonce: Schema.String,\n\tdevicePublicKey: Schema.String,\n\ttransportCertificatePin: Schema.String,\n}) {}\n\nexport const EnvironmentsListRpc = Rpc.make(\"environments.list\", {\n\tpayload: Schema.Void,\n\tsuccess: RelayEnvironmentList,\n\terror: ConnectAuthError,\n});\n\nexport const EnvironmentConnectRpc = Rpc.make(\"environments.connect\", {\n\tpayload: Schema.Struct({ environmentId: EnvironmentId }),\n\tsuccess: RelayConnectGrant,\n\terror: ConnectAuthError,\n});\n\n// --- device registration (mobile, DPoP) --------------------------------------\n\nexport class RelayDeviceRegistration extends Schema.Class<RelayDeviceRegistration>(\n\t\"RelayDeviceRegistration\",\n)({\n\tdeviceId: Schema.String,\n\tplatform: Schema.Literals([\"ios\", \"android\", \"web\", \"desktop\"]),\n\tpushToken: Schema.optional(Schema.String),\n\tdpopJwk: Schema.optional(Schema.Unknown),\n}) {}\n\nexport class RelayAuthorizedClient extends Schema.Class<RelayAuthorizedClient>(\n\t\"RelayAuthorizedClient\",\n)({\n\tclientId: Schema.String,\n\tplatform: Schema.Literals([\"ios\", \"android\", \"web\", \"desktop\"]),\n\tlabel: Schema.optional(Schema.String),\n\tlastSeenAt: Schema.Number,\n}) {}\n\nexport class RelayAuthorizedClientList extends Schema.Class<RelayAuthorizedClientList>(\n\t\"RelayAuthorizedClientList\",\n)({\n\tclients: Schema.Array(RelayAuthorizedClient),\n}) {}\n\nexport class RelayControlError extends Schema.TaggedErrorClass<RelayControlError>()(\n\t\"RelayControlError\",\n\t{ reason: Schema.String },\n) {}\n\nexport const RelayEnvironmentsRpc = Rpc.make(\"relay.environments\", {\n\tpayload: Schema.Void,\n\tsuccess: RelayEnvironmentList,\n\terror: RelayControlError,\n});\n\nexport const RelayConnectEnvironmentRpc = Rpc.make(\"relay.connectEnvironment\", {\n\tpayload: Schema.Struct({ environmentId: EnvironmentId }),\n\tsuccess: RelayConnectGrant,\n\terror: RelayControlError,\n});\n\nexport const RelayClientsRpc = Rpc.make(\"relay.clients\", {\n\tpayload: Schema.Void,\n\tsuccess: RelayAuthorizedClientList,\n\terror: RelayControlError,\n});\n\nexport const RelayRevokeClientRpc = Rpc.make(\"relay.revokeClient\", {\n\tpayload: Schema.Struct({ clientId: Schema.String }),\n\tsuccess: Schema.Void,\n\terror: RelayControlError,\n});\n","import { Effect, Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { ProviderId, RuntimeMode } from \"./agent.ts\";\nimport { FolderId } from \"./ids.ts\";\n\n/**\n * Per-repository overrides on top of the global Settings. A `null` field\n * means \"fall through to global default\"; the renderer is responsible for\n * collapsing this layer at read-time. Persisted in `.zuse/settings.json`\n * under the repository root.\n */\nexport class RepositorySettings extends Schema.Class<RepositorySettings>(\n\t\"RepositorySettings\",\n)({\n\tprojectId: FolderId,\n\tdefaultProviderId: Schema.NullOr(ProviderId),\n\tdefaultModel: Schema.NullOr(Schema.String),\n\tdefaultRuntimeMode: Schema.NullOr(RuntimeMode),\n\t/**\n\t * If true, every new chat created in this repo pre-creates a worktree at\n\t * session start. The composer's workspace picker still appears (so the\n\t * user can flip back to \"Current checkout\" before the first message).\n\t */\n\tautoCreateWorktree: Schema.Boolean,\n\t/**\n\t * Optional override for the worktree base dir. `null` means the global\n\t * default: `~/.zuse/<repo-name>-<projectId-short>/`.\n\t */\n\tworktreeBaseDir: Schema.NullOr(Schema.String),\n\t/**\n\t * Optional user-authored shell body to run before archiving a chat that is\n\t * bound to a worktree. Empty/null means archive without cleanup.\n\t */\n\tarchiveCleanupScript: Schema.NullOr(Schema.String),\n\tsetupScript: Schema.NullOr(Schema.String),\n\trunScript: Schema.NullOr(Schema.String),\n\tautoRunAfterSetup: Schema.Boolean,\n\tenvironmentVariables: Schema.Record(Schema.String, Schema.String),\n\t/** Non-secret overrides applied only while preparing or running in cloud. */\n\tcloudEnvironmentVariables: Schema.Record(Schema.String, Schema.String).pipe(\n\t\tSchema.withDecodingDefaultKey(Effect.succeed({})),\n\t),\n\t/**\n\t * Newline-separated gitignore-style patterns for local files that should be\n\t * linked into every Zuse worktree from the main checkout. Empty means \"use\n\t * Zuse's built-in env-file discovery fallback\".\n\t */\n\tfileIncludeGlobs: Schema.String,\n\t/**\n\t * User MCP servers switched off for this repository, by descriptor key\n\t * (`claude:<name>` / `codex:<name>`). Unioned with the global\n\t * `mcpDisabledServers` list at read-time.\n\t */\n\tmcpDisabledServers: Schema.Array(Schema.String),\n}) {}\n\n/**\n * Patch shape for `repository.settings.update`. Every field is optional;\n * absent means \"leave unchanged\". Use `null` explicitly to clear an\n * override back to the global default.\n */\nexport const RepositorySettingsPatch = Schema.Struct({\n\tdefaultProviderId: Schema.optional(Schema.NullOr(ProviderId)),\n\tdefaultModel: Schema.optional(Schema.NullOr(Schema.String)),\n\tdefaultRuntimeMode: Schema.optional(Schema.NullOr(RuntimeMode)),\n\tautoCreateWorktree: Schema.optional(Schema.Boolean),\n\tworktreeBaseDir: Schema.optional(Schema.NullOr(Schema.String)),\n\tarchiveCleanupScript: Schema.optional(Schema.NullOr(Schema.String)),\n\tsetupScript: Schema.optional(Schema.NullOr(Schema.String)),\n\trunScript: Schema.optional(Schema.NullOr(Schema.String)),\n\tautoRunAfterSetup: Schema.optional(Schema.Boolean),\n\tenvironmentVariables: Schema.optional(\n\t\tSchema.Record(Schema.String, Schema.String),\n\t),\n\tcloudEnvironmentVariables: Schema.optional(\n\t\tSchema.Record(Schema.String, Schema.String),\n\t),\n\tfileIncludeGlobs: Schema.optional(Schema.String),\n\tmcpDisabledServers: Schema.optional(Schema.Array(Schema.String)),\n});\nexport type RepositorySettingsPatch = typeof RepositorySettingsPatch.Type;\n\n/**\n * On-disk `.zuse/settings.json` shape. It intentionally omits `projectId`\n * because the file lives inside a single repository.\n */\nexport const RepositorySettingsFile = Schema.Struct({\n\tschemaVersion: Schema.Literal(1),\n\tdefaultProviderId: Schema.NullOr(ProviderId),\n\tdefaultModel: Schema.NullOr(Schema.String),\n\tdefaultRuntimeMode: Schema.NullOr(RuntimeMode),\n\tautoCreateWorktree: Schema.Boolean,\n\tworktreeBaseDir: Schema.NullOr(Schema.String),\n\tarchiveCleanupScript: Schema.NullOr(Schema.String),\n\tsetupScript: Schema.NullOr(Schema.String),\n\trunScript: Schema.NullOr(Schema.String),\n\tautoRunAfterSetup: Schema.Boolean,\n\tenvironmentVariables: Schema.Record(Schema.String, Schema.String),\n\tcloudEnvironmentVariables: Schema.Record(Schema.String, Schema.String).pipe(\n\t\tSchema.withDecodingDefaultKey(Effect.succeed({})),\n\t),\n\tfileIncludeGlobs: Schema.String,\n\tmcpDisabledServers: Schema.Array(Schema.String),\n});\nexport type RepositorySettingsFile = typeof RepositorySettingsFile.Type;\n\nexport const RepositorySettingsGetRpc = Rpc.make(\"repositorySettings.get\", {\n\tpayload: Schema.Struct({ projectId: FolderId }),\n\tsuccess: RepositorySettings,\n});\n\nexport const RepositorySettingsUpdateRpc = Rpc.make(\n\t\"repositorySettings.update\",\n\t{\n\t\tpayload: Schema.Struct({\n\t\t\tprojectId: FolderId,\n\t\t\tpatch: RepositorySettingsPatch,\n\t\t}),\n\t\tsuccess: RepositorySettings,\n\t},\n);\n","import { Schema, Struct } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport {\n\tAgentDefinition,\n\tOpencodeCustomProvider,\n\tProviderId,\n\tRuntimeMode,\n} from \"./agent.ts\";\nimport { AutonomyLevel } from \"./autonomy.ts\";\nimport { GitMergeMethod } from \"./git.ts\";\n\n/**\n * Per-preset overlay matching the renderer's old localStorage shape. Storing\n * a partial overlay (rather than a full `AgentDefinition`) means a future\n * memoize build can update the seed prompts/models and the user picks them\n * up automatically — only fields they've explicitly customised stick.\n */\nexport const SubagentPresetState = Schema.Struct({\n\tenabled: Schema.Boolean,\n\toverrides: AgentDefinition.mapFields(Struct.map(Schema.optional)),\n});\nexport type SubagentPresetState = typeof SubagentPresetState.Type;\n\nexport const CompletionSoundPreset = Schema.Literals([\n\t\"chime\",\n\t\"soft\",\n\t\"pop\",\n\t\"bell\",\n\t\"rise\",\n\t\"bloom\",\n]);\nexport type CompletionSoundPreset = typeof CompletionSoundPreset.Type;\n\nexport const AppearanceMode = Schema.Literals([\"system\", \"light\", \"dark\"]);\nexport type AppearanceMode = typeof AppearanceMode.Type;\n\n/**\n * How the auto-namer (PR: \"auto-name chat + branch after first message\")\n * shapes a worktree's git branch once it has an LLM-derived title slug.\n * - `username-slug` → `<git-user>/<slug>` (e.g. `swarajbachu/dark-mode`)\n * - `slug` → `<slug>` (e.g. `dark-mode`)\n * - `feat-slug` → `feat/<slug>` (e.g. `feat/dark-mode`)\n * - `custom` → `<branchNamingPrefix>/<slug>` (user-defined prefix)\n * Default is `username-slug`, mirroring the convention most teams use.\n */\nexport const BranchNamingStyle = Schema.Literals([\n\t\"username-slug\",\n\t\"slug\",\n\t\"feat-slug\",\n\t\"custom\",\n]);\nexport type BranchNamingStyle = typeof BranchNamingStyle.Type;\n\nexport const MergePrefs = Schema.Struct({\n\tmethod: GitMergeMethod,\n\tdeleteBranch: Schema.Boolean,\n});\nexport type MergePrefs = typeof MergePrefs.Type;\n\n/**\n * Wire-shape of `settings.json`. Owned by the main process; rendered to and\n * mutated from the renderer over RPC. The renderer keeps a hot cache in a\n * Zustand store that subscribes to `settings.stream`.\n *\n * Fields here used to live in `localStorage[\"memoize.settings.v1\"]` and\n * `localStorage[\"memoize.subagents\"]`. A one-time migration on first launch\n * after this PR copies the values across (see `apps/desktop/src/config-store.ts`).\n */\nexport class SettingsFile extends Schema.Class<SettingsFile>(\"SettingsFile\")({\n\tschemaVersion: Schema.Literal(1),\n\tdefaultProviderId: ProviderId,\n\tdefaultModelByProvider: Schema.Record(ProviderId, Schema.String),\n\tdefaultRuntimeMode: RuntimeMode,\n\tdefaultAutoCreateWorktree: Schema.Boolean,\n\t/**\n\t * Legacy autonomy level for new sessions. Current runtimes expose the\n\t * built-in orchestration tools by default and route mutating calls through\n\t * the normal permission system; see {@link AutonomyLevel}.\n\t */\n\tdefaultAutonomyLevel: AutonomyLevel,\n\tonboardingCompleted: Schema.Boolean,\n\tappearanceMode: AppearanceMode,\n\tcompletionSoundEnabled: Schema.Boolean,\n\tcompletionSoundPreset: CompletionSoundPreset,\n\t/**\n\t * Per-provider on/off toggle from the Providers settings card. Defaults\n\t * to `true` for every provider; flipping it to `false` filters the\n\t * provider from the new-session picker without uninstalling its CLI.\n\t */\n\tproviderEnabled: Schema.Record(ProviderId, Schema.Boolean),\n\t/**\n\t * Per-model visibility toggles from provider settings. Missing entries are\n\t * filled from each model's catalog `defaultVisible` flag by config-store.\n\t */\n\tmodelEnabledByProvider: Schema.Record(\n\t\tProviderId,\n\t\tSchema.Record(Schema.String, Schema.Boolean),\n\t),\n\t/**\n\t * OpenCode is a meta-harness fronting ~150 model providers. These four\n\t * fields drive the in-app OpenCode provider manager. They are keyed by\n\t * opencode's own *sub-provider* id (e.g. `\"openai\"`, `\"openrouter\"`, or a\n\t * custom slug) — a free-form string, unlike the six-member {@link ProviderId}\n\t * the maps above use. Credentials are NOT stored here; API keys live in\n\t * opencode's `auth.json` (written via `agent.opencodeSetProviderAuth`).\n\t *\n\t * Which connected sub-providers appear in the model picker. Missing entry ⇒\n\t * visible (a newly connected provider shows by default).\n\t */\n\topencodeProviderVisible: Schema.Record(Schema.String, Schema.Boolean),\n\t/** Per-sub-provider model visibility. Missing entry ⇒ visible. */\n\topencodeModelVisibleByProvider: Schema.Record(\n\t\tSchema.String,\n\t\tSchema.Record(Schema.String, Schema.Boolean),\n\t),\n\t/**\n\t * User-defined OpenAI-compatible providers (no secrets — the API key lives\n\t * in opencode's `auth.json`). Injected into every `opencode serve` we spawn\n\t * via `OPENCODE_CONFIG_CONTENT` so both inventory and sessions see them.\n\t */\n\topencodeCustomProviders: Schema.Array(OpencodeCustomProvider),\n\t/**\n\t * User MCP servers switched off globally, by descriptor key\n\t * (`claude:<name>` / `codex:<name>` — see `McpServerDescriptor.key`).\n\t * Server *definitions* never live here; the user's native Claude/Codex\n\t * config files are the source of truth and this stores only overrides.\n\t */\n\tmcpDisabledServers: Schema.Array(Schema.String),\n\tsubagents: Schema.Struct({\n\t\tenableForNewSessions: Schema.Boolean,\n\t\tpresets: Schema.Record(Schema.String, SubagentPresetState),\n\t}),\n\t/**\n\t * Branch-name shape the auto-namer uses when it renames a new chat's\n\t * worktree branch from the first message. See {@link BranchNamingStyle}.\n\t */\n\tbranchNamingStyle: BranchNamingStyle,\n\t/**\n\t * User-defined prefix used only when `branchNamingStyle === \"custom\"`,\n\t * slash-joined before the slug (e.g. prefix `wip` → `wip/dark-mode`).\n\t * Empty falls back to a bare slug.\n\t */\n\tbranchNamingPrefix: Schema.String,\n\tmergePrefs: MergePrefs,\n\t/**\n\t * macOS-only notch tray. The main process only shows it on likely notched\n\t * MacBook built-in displays; unsupported hardware keeps the preference but\n\t * renders nothing.\n\t */\n\tnotchTrayEnabled: Schema.Boolean,\n\t/** Keep the notch tray expanded instead of only expanding on hover. */\n\tnotchTrayPinned: Schema.Boolean,\n}) {}\n\n/**\n * Patch shape for `settings.update`. Every field optional; absent means\n * \"leave unchanged\". This is intentionally flat — nested patches into\n * `subagents.presets` are common enough that callers send a full\n * `subagents` payload rather than a deep merge.\n */\nexport const SettingsPatch = Schema.Struct({\n\tdefaultProviderId: Schema.optional(ProviderId),\n\tdefaultModelByProvider: Schema.optional(\n\t\tSchema.Record(ProviderId, Schema.String),\n\t),\n\tdefaultRuntimeMode: Schema.optional(RuntimeMode),\n\tdefaultAutoCreateWorktree: Schema.optional(Schema.Boolean),\n\tdefaultAutonomyLevel: Schema.optional(AutonomyLevel),\n\tonboardingCompleted: Schema.optional(Schema.Boolean),\n\tappearanceMode: Schema.optional(AppearanceMode),\n\tcompletionSoundEnabled: Schema.optional(Schema.Boolean),\n\tcompletionSoundPreset: Schema.optional(CompletionSoundPreset),\n\tproviderEnabled: Schema.optional(Schema.Record(ProviderId, Schema.Boolean)),\n\tmodelEnabledByProvider: Schema.optional(\n\t\tSchema.Record(ProviderId, Schema.Record(Schema.String, Schema.Boolean)),\n\t),\n\topencodeProviderVisible: Schema.optional(\n\t\tSchema.Record(Schema.String, Schema.Boolean),\n\t),\n\topencodeModelVisibleByProvider: Schema.optional(\n\t\tSchema.Record(Schema.String, Schema.Record(Schema.String, Schema.Boolean)),\n\t),\n\topencodeCustomProviders: Schema.optional(\n\t\tSchema.Array(OpencodeCustomProvider),\n\t),\n\tmcpDisabledServers: Schema.optional(Schema.Array(Schema.String)),\n\tsubagents: Schema.optional(\n\t\tSchema.Struct({\n\t\t\tenableForNewSessions: Schema.Boolean,\n\t\t\tpresets: Schema.Record(Schema.String, SubagentPresetState),\n\t\t}),\n\t),\n\tbranchNamingStyle: Schema.optional(BranchNamingStyle),\n\tbranchNamingPrefix: Schema.optional(Schema.String),\n\tmergePrefs: Schema.optional(MergePrefs),\n\tnotchTrayEnabled: Schema.optional(Schema.Boolean),\n\tnotchTrayPinned: Schema.optional(Schema.Boolean),\n});\nexport type SettingsPatch = typeof SettingsPatch.Type;\n\nexport const SettingsGetRpc = Rpc.make(\"settings.get\", {\n\tsuccess: SettingsFile,\n});\n\nexport const SettingsUpdateRpc = Rpc.make(\"settings.update\", {\n\tpayload: Schema.Struct({ patch: SettingsPatch }),\n\tsuccess: SettingsFile,\n});\n\n/**\n * Live stream of the settings file. Emits once on subscribe with the\n * current value, then on every change (RPC update or external hand-edit\n * picked up by the file watcher).\n */\nexport const SettingsStreamRpc = Rpc.make(\"settings.stream\", {\n\tsuccess: SettingsFile,\n\tstream: true,\n});\n\n/**\n * Renderer → main: ship the contents of any pre-existing localStorage blobs\n * exactly once so the main process can write them into `settings.json` /\n * `keybindings.json`. The main process ignores subsequent calls if a config\n * file already exists on disk. Returns the resolved (possibly merged)\n * settings so the renderer can drop its localStorage immediately.\n *\n * Both payload fields are optional `string` (the raw localStorage value):\n * - `settingsV1Raw`: the old `memoize.settings.v1` blob\n * - `subagentsRaw`: the old `memoize.subagents` blob (zustand persist envelope)\n */\nexport const SettingsMigrateLocalStorageRpc = Rpc.make(\n\t\"settings.migrateLocalStorage\",\n\t{\n\t\tpayload: Schema.Struct({\n\t\t\tsettingsV1Raw: Schema.optional(Schema.String),\n\t\t\tsubagentsRaw: Schema.optional(Schema.String),\n\t\t}),\n\t\tsuccess: SettingsFile,\n\t},\n);\n","import { Rpc } from \"effect/unstable/rpc\";\nimport { Schema } from \"effect\";\n\nimport { ProviderId } from \"./agent.ts\";\nimport { FolderId } from \"./ids.ts\";\nimport { SessionId, SessionNotFoundError } from \"./session.ts\";\n\n/**\n * One skill discovered by a provider driver. Memoize owns no skill format;\n * the driver normalises the underlying agent's parsed metadata into this\n * shape so the renderer is provider-agnostic.\n */\nexport class Skill extends Schema.Class<Skill>(\"Skill\")({\n name: Schema.String,\n scope: Schema.Literals([\"global\", \"project\"]),\n description: Schema.String,\n arguments: Schema.Array(\n Schema.Struct({\n name: Schema.String,\n description: Schema.String,\n optional: Schema.Boolean,\n }),\n ),\n filePath: Schema.NullOr(Schema.String),\n providerId: ProviderId,\n}) {}\n\n/**\n * One-shot fetch of the active session's skill list (initial hydrate). For\n * live updates use `skill.stream`.\n */\nexport const SkillListRpc = Rpc.make(\"skill.list\", {\n payload: Schema.Struct({ sessionId: SessionId }),\n success: Schema.Array(Skill),\n error: SessionNotFoundError,\n});\n\n/**\n * One-shot fetch for a draft composer before a real session row exists.\n * Skill discovery only needs the provider and project checkout, so the\n * landing composer can hydrate slash-command skills without creating a\n * temporary server session.\n */\nexport const SkillListForProjectRpc = Rpc.make(\"skill.listForProject\", {\n payload: Schema.Struct({\n projectId: FolderId,\n providerId: ProviderId,\n }),\n success: Schema.Array(Skill),\n});\n\n/**\n * Live skill list for a session — emits the full new list on every provider\n * change notification. Same pattern as `messages.stream`.\n */\nexport const SkillStreamRpc = Rpc.make(\"skill.stream\", {\n payload: Schema.Struct({ sessionId: SessionId }),\n success: Schema.Array(Skill),\n error: SessionNotFoundError,\n stream: true,\n});\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\nimport { ProviderId } from \"./agent.ts\";\nimport { FolderId } from \"./ids.ts\";\n\nexport const UsageSourceId = Schema.Literals([\n\t\"zuse\",\n\t\"memoize\",\n\t\"claude\",\n\t\"codex\",\n\t\"opencode\",\n\t\"amp\",\n\t\"pi\",\n\t\"grok\",\n]);\nexport type UsageSourceId = typeof UsageSourceId.Type;\n\nexport const UsageBucket = Schema.Literals([\n\t\"daily\",\n\t\"weekly\",\n\t\"monthly\",\n\t\"session\",\n]);\nexport type UsageBucket = typeof UsageBucket.Type;\n\nconst UsageCostStatus = Schema.Literals([\"known\", \"partial\", \"unknown\"]);\n\nexport class UsageSummary extends Schema.Class<UsageSummary>(\"UsageSummary\")({\n\tinputTokens: Schema.Number,\n\toutputTokens: Schema.Number,\n\tcacheReadTokens: Schema.Number,\n\tcacheCreationTokens: Schema.Number,\n\treasoningTokens: Schema.Number,\n\tcostUsd: Schema.NullOr(Schema.Number),\n\tcostStatus: UsageCostStatus,\n\trecordCount: Schema.Number,\n\tpossibleDuplicateCount: Schema.Number,\n}) {}\n\nexport class UsageGroup extends Schema.Class<UsageGroup>(\"UsageGroup\")({\n\tkey: Schema.String,\n\tlabel: Schema.String,\n\tstartedAt: Schema.NullOr(Schema.DateFromString),\n\tendedAt: Schema.NullOr(Schema.DateFromString),\n\tsourceIds: Schema.Array(UsageSourceId),\n\tinputTokens: Schema.Number,\n\toutputTokens: Schema.Number,\n\tcacheReadTokens: Schema.Number,\n\tcacheCreationTokens: Schema.Number,\n\treasoningTokens: Schema.Number,\n\tcostUsd: Schema.NullOr(Schema.Number),\n\tcostStatus: UsageCostStatus,\n\trecordCount: Schema.Number,\n\tpossibleDuplicateCount: Schema.Number,\n}) {}\n\nexport class UsageRecord extends Schema.Class<UsageRecord>(\"UsageRecord\")({\n\tid: Schema.String,\n\tsourceId: UsageSourceId,\n\tsourceLabel: Schema.String,\n\tproviderId: Schema.String,\n\tmodel: Schema.String,\n\tsessionId: Schema.NullOr(Schema.String),\n\tprojectPath: Schema.NullOr(Schema.String),\n\tworkspacePath: Schema.NullOr(Schema.String),\n\tstartedAt: Schema.DateFromString,\n\tendedAt: Schema.DateFromString,\n\tinputTokens: Schema.Number,\n\toutputTokens: Schema.Number,\n\tcacheReadTokens: Schema.Number,\n\tcacheCreationTokens: Schema.Number,\n\treasoningTokens: Schema.Number,\n\tcostUsd: Schema.NullOr(Schema.Number),\n\tcostStatus: Schema.Literals([\"known\", \"unknown\"]),\n\tprovenance: Schema.String,\n\tconfidence: Schema.Literals([\"exact\", \"partial\", \"estimated\"]),\n\tfingerprint: Schema.String,\n\tpossibleDuplicate: Schema.Boolean,\n}) {}\n\nexport class UsageSourceStatus extends Schema.Class<UsageSourceStatus>(\n\t\"UsageSourceStatus\",\n)({\n\tid: UsageSourceId,\n\tlabel: Schema.String,\n\tdetected: Schema.Boolean,\n\trecordCount: Schema.Number,\n\tpaths: Schema.Array(Schema.String),\n\twarning: Schema.NullOr(Schema.String),\n}) {}\n\nexport class UsageReport extends Schema.Class<UsageReport>(\"UsageReport\")({\n\tbucket: UsageBucket,\n\tgeneratedAt: Schema.DateFromString,\n\tsummary: UsageSummary,\n\tgroups: Schema.Array(UsageGroup),\n\tbySource: Schema.Array(UsageGroup),\n\tbyModel: Schema.Array(UsageGroup),\n\tbySession: Schema.Array(UsageGroup),\n\trecords: Schema.Array(UsageRecord),\n\tsources: Schema.Array(UsageSourceStatus),\n}) {}\n\nexport class UsageOverview extends Schema.Class<UsageOverview>(\"UsageOverview\")(\n\t{\n\t\tbucket: UsageBucket,\n\t\tgeneratedAt: Schema.DateFromString,\n\t\tsummary: UsageSummary,\n\t\tsessionCount: Schema.Number,\n\t\tpreviousSummary: Schema.NullOr(UsageSummary),\n\t\tpreviousSessionCount: Schema.NullOr(Schema.Number),\n\t\tgroups: Schema.Array(UsageGroup),\n\t\tbySource: Schema.Array(UsageGroup),\n\t\tbyModel: Schema.Array(UsageGroup),\n\t\tbyProject: Schema.Array(UsageGroup),\n\t\tpreviousBySource: Schema.Array(UsageGroup),\n\t\tpreviousByModel: Schema.Array(UsageGroup),\n\t\tpreviousByProject: Schema.Array(UsageGroup),\n\t\tsources: Schema.Array(UsageSourceStatus),\n\t},\n) {}\n\nexport class UsageSessionsPage extends Schema.Class<UsageSessionsPage>(\n\t\"UsageSessionsPage\",\n)({\n\trows: Schema.Array(UsageGroup),\n\ttotal: Schema.Number,\n\tnextOffset: Schema.NullOr(Schema.Number),\n}) {}\n\nexport const UsageReportRpc = Rpc.make(\"usage.report\", {\n\tpayload: Schema.Struct({\n\t\tbucket: Schema.optional(UsageBucket),\n\t\tsourceIds: Schema.optional(Schema.Array(UsageSourceId)),\n\t\tsince: Schema.optional(Schema.DateFromString),\n\t\tuntil: Schema.optional(Schema.DateFromString),\n\t\ttimezone: Schema.optional(Schema.String),\n\t\tprojectId: Schema.optional(FolderId),\n\t\tincludePossibleDuplicates: Schema.optional(Schema.Boolean),\n\t\tforceRefresh: Schema.optional(Schema.Boolean),\n\t}),\n\tsuccess: UsageReport,\n});\n\nexport const UsageOverviewRpc = Rpc.make(\"usage.overview\", {\n\tpayload: Schema.Struct({\n\t\tsince: Schema.optional(Schema.DateFromString),\n\t\tuntil: Schema.optional(Schema.DateFromString),\n\t\ttimezone: Schema.optional(Schema.String),\n\t\tprojectId: Schema.optional(FolderId),\n\t\tforceRefresh: Schema.optional(Schema.Boolean),\n\t}),\n\tsuccess: UsageOverview,\n});\n\nexport const UsageSessionsRpc = Rpc.make(\"usage.sessions\", {\n\tpayload: Schema.Struct({\n\t\tsince: Schema.optional(Schema.DateFromString),\n\t\tuntil: Schema.optional(Schema.DateFromString),\n\t\ttimezone: Schema.optional(Schema.String),\n\t\tprojectId: Schema.optional(FolderId),\n\t\tquery: Schema.optional(Schema.String),\n\t\tproviderId: Schema.optional(ProviderId),\n\t\tsort: Schema.optional(Schema.Literals([\"tokens\", \"cost\", \"last-active\"])),\n\t\toffset: Schema.optional(Schema.Number),\n\t\tlimit: Schema.optional(Schema.Number),\n\t}),\n\tsuccess: UsageSessionsPage,\n});\n","import { Schema } from \"effect\";\nimport { Rpc } from \"effect/unstable/rpc\";\n\nimport { ProviderId } from \"./agent.ts\";\n\nexport const UsageLimitScope = Schema.Literals([\n\t\"session\",\n\t\"weekly\",\n\t\"model\",\n\t\"overall\",\n]);\nexport type UsageLimitScope = typeof UsageLimitScope.Type;\n\nexport class UsageLimitWindow extends Schema.Class<UsageLimitWindow>(\n\t\"UsageLimitWindow\",\n)({\n\tid: Schema.String,\n\tlabel: Schema.String,\n\tscope: UsageLimitScope,\n\tusedPercent: Schema.NullOr(Schema.Number),\n\tresetsAt: Schema.NullOr(Schema.String),\n\twindowMinutes: Schema.NullOr(Schema.Number),\n}) {}\n\nexport class ProviderUsageLimits extends Schema.Class<ProviderUsageLimits>(\n\t\"ProviderUsageLimits\",\n)({\n\tproviderId: ProviderId,\n\tplanLabel: Schema.NullOr(Schema.String),\n\twindows: Schema.Array(UsageLimitWindow),\n\tcreditsRemaining: Schema.NullOr(Schema.Number),\n\tfetchedAt: Schema.String,\n\tsource: Schema.Literals([\"api\", \"session-event\", \"cache\"]),\n\tunavailableReason: Schema.optional(\n\t\tSchema.Literals([\n\t\t\t\"no-credentials\",\n\t\t\t\"expired\",\n\t\t\t\"scope-missing\",\n\t\t\t\"unsupported\",\n\t\t\t\"error\",\n\t\t]),\n\t),\n}) {}\n\nexport class UsageLimitHistoryPoint extends Schema.Class<UsageLimitHistoryPoint>(\n\t\"UsageLimitHistoryPoint\",\n)({\n\tproviderId: ProviderId,\n\twindowId: Schema.String,\n\tcapturedAt: Schema.DateFromString,\n\tusedPercent: Schema.NullOr(Schema.Number),\n}) {}\n\nexport const UsageLimitsRpc = Rpc.make(\"usage.limits\", {\n\tpayload: Schema.Struct({\n\t\tforceRefresh: Schema.optional(Schema.Boolean),\n\t\tproviderId: Schema.optional(ProviderId),\n\t}),\n\tsuccess: Schema.Struct({ providers: Schema.Array(ProviderUsageLimits) }),\n});\n\nexport const UsageLimitsHistoryRpc = Rpc.make(\"usage.limits.history\", {\n\tpayload: Schema.Struct({\n\t\tproviderId: Schema.optional(ProviderId),\n\t\tsince: Schema.optional(Schema.DateFromString),\n\t}),\n\tsuccess: Schema.Struct({ points: Schema.Array(UsageLimitHistoryPoint) }),\n});\n","import { RpcGroup } from \"effect/unstable/rpc\";\nimport {\n\tProviderAvailabilityRpc,\n\tProviderKiroInventoryRpc,\n\tProviderOpencodeAddCustomRpc,\n\tProviderOpencodeInventoryRpc,\n\tProviderOpencodeRemoveAuthRpc,\n\tProviderOpencodeRemoveCustomRpc,\n\tProviderOpencodeSetAuthRpc,\n\tProviderRemoveCredentialRpc,\n\tProviderSetCredentialRpc,\n\tProviderStartLoginRpc,\n\tProviderUpdateRpc,\n} from \"./agent.ts\";\nimport {\n\tAnalyticsContextChangesRpc,\n\tAnalyticsGetContextRpc,\n} from \"./analytics.ts\";\nimport { AttachmentUploadRpc } from \"./attachment.ts\";\nimport {\n\tAuthGetSessionRpc,\n\tAuthSessionChangesRpc,\n\tAuthSignInRpc,\n\tAuthSignOutRpc,\n} from \"./auth.ts\";\nimport {\n\tBrowserCommandsRpc,\n\tBrowserListCredentialsRpc,\n\tBrowserRemoveCredentialRpc,\n\tBrowserRespondRpc,\n\tBrowserSetCredentialRpc,\n} from \"./browser.ts\";\nimport {\n\tCloudBillingSetCapRpc,\n\tCloudBillingSummaryRpc,\n\tCloudBillingUsageRpc,\n} from \"./cloud-billing.ts\";\nimport {\n\tCloudChatsListRpc,\n\tCloudCredentialsDisconnectRpc,\n\tCloudCredentialsImportLocalRpc,\n\tCloudCredentialsListRpc,\n\tCloudProjectsConnectRpc,\n\tCloudProjectsListRpc,\n\tCloudProjectsPrepareRpc,\n\tCloudProvidersRpc,\n\tCloudTranscriptCheckpointGetRpc,\n\tCloudTranscriptMessagePageGetRpc,\n\tCloudWorkspacesArchiveRpc,\n\tCloudWorkspacesConnectRpc,\n\tCloudWorkspacesCreateRpc,\n\tCloudWorkspacesDeleteRpc,\n\tCloudWorkspacesGetRpc,\n\tCloudWorkspacesListRpc,\n\tCloudWorkspacesPauseRpc,\n\tCloudWorkspacesRestartRpc,\n\tCloudWorkspacesResumeRpc,\n\tCloudWorkspacesSshAccessRpc,\n\tCloudWorkspacesUnarchiveRpc,\n\tCloudWorkspacesWatchRpc,\n} from \"./cloud-workspaces.ts\";\nimport {\n\tConnectDescribeRpc,\n\tConnectLinkProofRpc,\n\tConnectRelayConfigRpc,\n\tRelayLinkRpc,\n\tRelayStatusRpc,\n\tRelayUnlinkRpc,\n} from \"./connect.ts\";\nimport { ContextSaveTextRpc } from \"./context.ts\";\nimport {\n\tDiagnosticsCaptureRpc,\n\tDiagnosticsEventsRpc,\n\tDiagnosticsExportRpc,\n\tDiagnosticsIngestRpc,\n\tDiagnosticsOverviewRpc,\n\tDiagnosticsProcessesRpc,\n\tDiagnosticsSignalRpc,\n} from \"./diagnostics.ts\";\nimport {\n\tExternalThreadsContinueRpc,\n\tExternalThreadsListRpc,\n} from \"./external-thread.ts\";\nimport {\n\tFsCreateDirectoryRpc,\n\tFsCreateFileRpc,\n\tFsListPathsRpc,\n\tFsMoveRpc,\n\tFsReadExternalFileRpc,\n\tFsReadFileRpc,\n\tFsRemoveRpc,\n\tFsTreeRpc,\n\tFsWatchTreeRpc,\n\tFsWriteExternalFileRpc,\n\tFsWriteFileRpc,\n} from \"./fs.ts\";\nimport {\n\tGitBranchesRpc,\n\tGitChangesRpc,\n\tGitCommitRpc,\n\tGitCreateReviewCommentRpc,\n\tGitDiffRpc,\n\tGitFixFailingChecksRpc,\n\tGitInitRpc,\n\tGitIssueMarkdownRpc,\n\tGitListIssuesRpc,\n\tGitListPrsRpc,\n\tGitLogRpc,\n\tGitMarkReadyRpc,\n\tGitMergePrRpc,\n\tGitOriginRpc,\n\tGitPrDetailsRpc,\n\tGitPrStateRpc,\n\tGitPushRpc,\n\tGitResolveConflictRpc,\n\tGitRestoreFileToBaseRpc,\n\tGitRevertAllRpc,\n\tGitRevertFileRpc,\n\tGitReviewFileContentsRpc,\n\tGitReviewIdentityRpc,\n\tGitReviewPatchesRpc,\n\tGitReviewSummaryRpc,\n\tGitStatusRpc,\n\tGitSwitchBranchRpc,\n\tGitUserNameRpc,\n\tGitWorkspaceChangesRpc,\n} from \"./git.ts\";\nimport { ConnectHandshakeRpc } from \"./handshake.ts\";\nimport {\n\tKeybindingsGetRpc,\n\tKeybindingsReplaceRpc,\n\tKeybindingsStreamRpc,\n} from \"./keybindings.ts\";\nimport {\n\tLinearConnectRpc,\n\tLinearDisconnectRpc,\n\tLinearListConnectionsRpc,\n\tLinearListIssuesRpc,\n\tLinearPrepareContextRpc,\n} from \"./linear.ts\";\nimport {\n\tAccountAccessContinueClaudeTransferRpc,\n\tAccountAccessCreateClaudeTransferRpc,\n\tAccountAccessDetectLocalRpc,\n\tAccountAccessDisconnectRpc,\n\tAccountAccessImportRpc,\n\tAccountAccessPrepareImportRpc,\n\tAccountAccessStartLoginRpc,\n\tAccountAccessStatusRpc,\n\tMachinePrivateNetworkEnableRpc,\n\tMachinePrivateNetworkStatusRpc,\n\tMachineResourcesWatchRpc,\n\tMachineRuntimeStatusRpc,\n\tMachineRuntimeTargetRpc,\n\tMachineRuntimeUpdateRpc,\n\tMachineSshKeysAddRpc,\n\tMachineSshKeysListRpc,\n\tMachineSshKeysRemoveRpc,\n\tMachineSshModeSetRpc,\n\tMachinesBillingPortalRpc,\n\tMachinesCancelRpc,\n\tMachinesCheckoutRpc,\n\tMachinesCreateRpc,\n\tMachinesDestroyRpc,\n\tMachinesEntitlementsRpc,\n\tMachinesGetRpc,\n\tMachinesListRpc,\n\tMachinesOffersRpc,\n\tMachinesRecoverRpc,\n} from \"./machines.ts\";\nimport {\n\tMcpAuthenticateRpc,\n\tMcpListRpc,\n\tMcpRefreshRpc,\n\tMcpSetEnabledRpc,\n} from \"./mcp.ts\";\nimport {\n\tPairingListNearbyRequestsRpc,\n\tPairingListTokensRpc,\n\tPairingResolveNearbyRequestRpc,\n\tPairingRevokeTokenRpc,\n\tPairingStartRpc,\n} from \"./pairing.ts\";\nimport {\n\tPermissionDecideRpc,\n\tPermissionListDecisionsRpc,\n\tPermissionListPendingRpc,\n\tPermissionRequestsRpc,\n\tPermissionRevokeDecisionRpc,\n} from \"./permission.ts\";\nimport { PingRpc } from \"./ping.ts\";\nimport { PokemonEnsureSpriteCachedRpc, PokemonPokedexRpc } from \"./pokemon.ts\";\nimport {\n\tPtyCloseRpc,\n\tPtyOpenRpc,\n\tPtyOutputRpc,\n\tPtyResizeRpc,\n\tPtyWriteRpc,\n} from \"./pty.ts\";\nimport {\n\tEnvironmentConnectRpc,\n\tEnvironmentsListRpc,\n\tRelayClientsRpc,\n\tRelayConnectEnvironmentRpc,\n\tRelayEnvironmentsRpc,\n\tRelayRevokeClientRpc,\n} from \"./relay.ts\";\nimport {\n\tRepositorySettingsGetRpc,\n\tRepositorySettingsUpdateRpc,\n} from \"./repository-settings.ts\";\nimport {\n\tChatArchiveJobsRpc,\n\tChatArchivePreviewRpc,\n\tChatArchiveRpc,\n\tChatArchiveStatusRpc,\n\tChatCreateRpc,\n\tChatCreationDiscardRpc,\n\tChatCreationListRpc,\n\tChatCreationStreamRpc,\n\tChatDeleteRpc,\n\tChatDirectoryStatusRpc,\n\tChatGetRpc,\n\tChatListRpc,\n\tChatMarkReadRpc,\n\tChatRenameRpc,\n\tChatSetActiveSessionRpc,\n\tChatSetWorktreeRpc,\n\tChatStreamChangesRpc,\n\tChatUnarchiveRpc,\n\tMessagesInterruptRpc,\n\tMessagesListRpc,\n\tMessagesQueueAddRpc,\n\tMessagesQueueDeleteRpc,\n\tMessagesQueueFlushRpc,\n\tMessagesQueueListRpc,\n\tMessagesQueueReorderRpc,\n\tMessagesQueueResumeRpc,\n\tMessagesQueueRunNextRpc,\n\tMessagesQueueUpdateRpc,\n\tMessagesSendRpc,\n\tSessionAnswerQuestionRpc,\n\tSessionArchiveRpc,\n\tSessionCreateRpc,\n\tSessionDeleteRpc,\n\tSessionEventsHeadRpc,\n\tSessionEventsRpc,\n\tSessionExportTranscriptRpc,\n\tSessionForkRpc,\n\tSessionGetRpc,\n\tSessionGoalClearRpc,\n\tSessionGoalGetRpc,\n\tSessionGoalSetRpc,\n\tSessionGoalStreamRpc,\n\tSessionLatestPlanRpc,\n\tSessionListRpc,\n\tSessionMcpUpdateRpc,\n\tSessionMessagesPageRpc,\n\tSessionPlanRespondRpc,\n\tSessionRenameRpc,\n\tSessionResumeRpc,\n\tSessionSetModelRpc,\n\tSessionSetPermissionModeRpc,\n\tSessionSetProviderRpc,\n\tSessionSetRuntimeModeRpc,\n\tSessionSetWorktreeRpc,\n\tSessionStreamChangesRpc,\n\tSessionUnarchiveRpc,\n} from \"./session.ts\";\nimport {\n\tSettingsGetRpc,\n\tSettingsMigrateLocalStorageRpc,\n\tSettingsStreamRpc,\n\tSettingsUpdateRpc,\n} from \"./settings.ts\";\nimport {\n\tSkillListForProjectRpc,\n\tSkillListRpc,\n\tSkillStreamRpc,\n} from \"./skill.ts\";\nimport { UsageOverviewRpc, UsageReportRpc, UsageSessionsRpc } from \"./usage.ts\";\nimport { UsageLimitsHistoryRpc, UsageLimitsRpc } from \"./usage-limits.ts\";\nimport {\n\tWorkspaceAddRpc,\n\tWorkspaceBrowseDirectoryRpc,\n\tWorkspaceCloneRepoRpc,\n\tWorkspaceCreateProjectRpc,\n\tWorkspaceGetSelectedRpc,\n\tWorkspaceGhAuthStatusRpc,\n\tWorkspaceListGithubReposRpc,\n\tWorkspaceListRpc,\n\tWorkspacePickFolderRpc,\n\tWorkspaceRemoveRpc,\n\tWorkspaceSearchFilesRpc,\n\tWorkspaceSetSelectedRpc,\n\tWorkspaceStreamChangesRpc,\n} from \"./workspace.ts\";\nimport {\n\tWorktreeCreateRpc,\n\tWorktreeGetRpc,\n\tWorktreeListRpc,\n\tWorktreeRemoveRpc,\n\tWorktreeRenameBranchRpc,\n\tWorktreeRerunSetupRpc,\n\tWorktreeSetupStreamRpc,\n\tWorktreeStartRunRpc,\n} from \"./worktree.ts\";\n\n/**\n * The single source of truth for every RPC method exposed by the main process.\n * Both server (apps/desktop) and client (apps/renderer) build against this.\n *\n * Add new RPCs by importing them here and including them in the group.\n */\nexport const MemoizeRpcs = RpcGroup.make(\n\tPingRpc,\n\tAnalyticsGetContextRpc,\n\tAnalyticsContextChangesRpc,\n\tAuthGetSessionRpc,\n\tAuthSignInRpc,\n\tAuthSignOutRpc,\n\tAuthSessionChangesRpc,\n\tLinearListConnectionsRpc,\n\tLinearConnectRpc,\n\tLinearDisconnectRpc,\n\tLinearListIssuesRpc,\n\tLinearPrepareContextRpc,\n\tPairingStartRpc,\n\tPairingListTokensRpc,\n\tPairingRevokeTokenRpc,\n\tPairingListNearbyRequestsRpc,\n\tPairingResolveNearbyRequestRpc,\n\tConnectHandshakeRpc,\n\tConnectDescribeRpc,\n\tConnectLinkProofRpc,\n\tConnectRelayConfigRpc,\n\tRelayLinkRpc,\n\tRelayStatusRpc,\n\tRelayUnlinkRpc,\n\tEnvironmentsListRpc,\n\tEnvironmentConnectRpc,\n\tCloudBillingSummaryRpc,\n\tCloudBillingUsageRpc,\n\tCloudBillingSetCapRpc,\n\tCloudProvidersRpc,\n\tCloudProjectsListRpc,\n\tCloudProjectsConnectRpc,\n\tCloudProjectsPrepareRpc,\n\tCloudWorkspacesListRpc,\n\tCloudWorkspacesGetRpc,\n\tCloudWorkspacesWatchRpc,\n\tCloudWorkspacesCreateRpc,\n\tCloudWorkspacesConnectRpc,\n\tCloudChatsListRpc,\n\tCloudWorkspacesPauseRpc,\n\tCloudWorkspacesResumeRpc,\n\tCloudWorkspacesRestartRpc,\n\tCloudWorkspacesSshAccessRpc,\n\tCloudWorkspacesArchiveRpc,\n\tCloudWorkspacesUnarchiveRpc,\n\tCloudWorkspacesDeleteRpc,\n\tCloudTranscriptCheckpointGetRpc,\n\tCloudTranscriptMessagePageGetRpc,\n\tCloudCredentialsListRpc,\n\tCloudCredentialsImportLocalRpc,\n\tCloudCredentialsDisconnectRpc,\n\tMachinesOffersRpc,\n\tMachinesListRpc,\n\tMachinesGetRpc,\n\tMachinesCreateRpc,\n\tMachinesCancelRpc,\n\tMachinesRecoverRpc,\n\tMachinesDestroyRpc,\n\tMachinesCheckoutRpc,\n\tMachinesBillingPortalRpc,\n\tMachinesEntitlementsRpc,\n\tMachineSshKeysAddRpc,\n\tMachineSshKeysListRpc,\n\tMachineSshKeysRemoveRpc,\n\tMachinePrivateNetworkEnableRpc,\n\tMachinePrivateNetworkStatusRpc,\n\tMachineRuntimeTargetRpc,\n\tMachineRuntimeStatusRpc,\n\tMachineRuntimeUpdateRpc,\n\tMachineResourcesWatchRpc,\n\tMachineSshModeSetRpc,\n\tAccountAccessStatusRpc,\n\tAccountAccessDetectLocalRpc,\n\tAccountAccessStartLoginRpc,\n\tAccountAccessPrepareImportRpc,\n\tAccountAccessCreateClaudeTransferRpc,\n\tAccountAccessContinueClaudeTransferRpc,\n\tAccountAccessImportRpc,\n\tAccountAccessDisconnectRpc,\n\tRelayEnvironmentsRpc,\n\tRelayConnectEnvironmentRpc,\n\tRelayClientsRpc,\n\tRelayRevokeClientRpc,\n\tWorkspaceAddRpc,\n\tWorkspaceBrowseDirectoryRpc,\n\tWorkspaceListRpc,\n\tWorkspaceRemoveRpc,\n\tWorkspacePickFolderRpc,\n\tWorkspaceGetSelectedRpc,\n\tWorkspaceSetSelectedRpc,\n\tWorkspaceStreamChangesRpc,\n\tWorkspaceSearchFilesRpc,\n\tWorkspaceCloneRepoRpc,\n\tWorkspaceCreateProjectRpc,\n\tWorkspaceListGithubReposRpc,\n\tWorkspaceGhAuthStatusRpc,\n\tExternalThreadsListRpc,\n\tExternalThreadsContinueRpc,\n\tPtyOpenRpc,\n\tPtyWriteRpc,\n\tPtyResizeRpc,\n\tPtyCloseRpc,\n\tPtyOutputRpc,\n\tGitLogRpc,\n\tGitStatusRpc,\n\tGitBranchesRpc,\n\tGitSwitchBranchRpc,\n\tGitUserNameRpc,\n\tGitWorkspaceChangesRpc,\n\tGitOriginRpc,\n\tGitPrStateRpc,\n\tGitPrDetailsRpc,\n\tGitListPrsRpc,\n\tGitListIssuesRpc,\n\tGitIssueMarkdownRpc,\n\tGitChangesRpc,\n\tGitReviewSummaryRpc,\n\tGitReviewPatchesRpc,\n\tGitReviewFileContentsRpc,\n\tGitReviewIdentityRpc,\n\tGitDiffRpc,\n\tGitCommitRpc,\n\tGitCreateReviewCommentRpc,\n\tGitPushRpc,\n\tGitResolveConflictRpc,\n\tGitMergePrRpc,\n\tGitMarkReadyRpc,\n\tGitInitRpc,\n\tGitFixFailingChecksRpc,\n\tGitRevertFileRpc,\n\tGitRestoreFileToBaseRpc,\n\tGitRevertAllRpc,\n\tFsTreeRpc,\n\tFsWatchTreeRpc,\n\tFsListPathsRpc,\n\tFsMoveRpc,\n\tFsReadFileRpc,\n\tFsWriteFileRpc,\n\tFsCreateFileRpc,\n\tFsCreateDirectoryRpc,\n\tFsRemoveRpc,\n\tFsReadExternalFileRpc,\n\tFsWriteExternalFileRpc,\n\tProviderAvailabilityRpc,\n\tProviderRemoveCredentialRpc,\n\tProviderSetCredentialRpc,\n\tProviderOpencodeInventoryRpc,\n\tProviderKiroInventoryRpc,\n\tProviderOpencodeSetAuthRpc,\n\tProviderOpencodeRemoveAuthRpc,\n\tProviderOpencodeAddCustomRpc,\n\tProviderOpencodeRemoveCustomRpc,\n\tProviderStartLoginRpc,\n\tProviderUpdateRpc,\n\tChatArchivePreviewRpc,\n\tMcpListRpc,\n\tMcpRefreshRpc,\n\tMcpSetEnabledRpc,\n\tMcpAuthenticateRpc,\n\tChatListRpc,\n\tChatGetRpc,\n\tChatCreateRpc,\n\tChatCreationListRpc,\n\tChatCreationStreamRpc,\n\tChatCreationDiscardRpc,\n\tChatRenameRpc,\n\tChatMarkReadRpc,\n\tChatStreamChangesRpc,\n\tChatSetWorktreeRpc,\n\tChatSetActiveSessionRpc,\n\tChatArchiveRpc,\n\tChatArchiveStatusRpc,\n\tChatArchiveJobsRpc,\n\tChatDirectoryStatusRpc,\n\tChatUnarchiveRpc,\n\tChatDeleteRpc,\n\tSessionListRpc,\n\tSessionStreamChangesRpc,\n\tSessionMcpUpdateRpc,\n\tSessionGetRpc,\n\tSessionCreateRpc,\n\tSessionRenameRpc,\n\tSessionGoalGetRpc,\n\tSessionGoalSetRpc,\n\tSessionGoalClearRpc,\n\tSessionGoalStreamRpc,\n\tSessionSetModelRpc,\n\tSessionSetProviderRpc,\n\tSessionArchiveRpc,\n\tSessionUnarchiveRpc,\n\tSessionDeleteRpc,\n\tSessionEventsHeadRpc,\n\tSessionEventsRpc,\n\tSessionMessagesPageRpc,\n\tSessionForkRpc,\n\tSessionExportTranscriptRpc,\n\tSessionLatestPlanRpc,\n\tSessionResumeRpc,\n\tSessionSetRuntimeModeRpc,\n\tSessionSetPermissionModeRpc,\n\tSessionAnswerQuestionRpc,\n\tSessionPlanRespondRpc,\n\tSessionSetWorktreeRpc,\n\tMessagesListRpc,\n\tMessagesSendRpc,\n\tMessagesInterruptRpc,\n\tMessagesQueueListRpc,\n\tMessagesQueueAddRpc,\n\tMessagesQueueUpdateRpc,\n\tMessagesQueueDeleteRpc,\n\tMessagesQueueRunNextRpc,\n\tMessagesQueueReorderRpc,\n\tMessagesQueueFlushRpc,\n\tMessagesQueueResumeRpc,\n\tAttachmentUploadRpc,\n\tContextSaveTextRpc,\n\tSkillListRpc,\n\tSkillListForProjectRpc,\n\tSkillStreamRpc,\n\tPermissionRequestsRpc,\n\tPermissionDecideRpc,\n\tPermissionListPendingRpc,\n\tPermissionListDecisionsRpc,\n\tPermissionRevokeDecisionRpc,\n\tPokemonPokedexRpc,\n\tPokemonEnsureSpriteCachedRpc,\n\tBrowserCommandsRpc,\n\tBrowserRespondRpc,\n\tBrowserSetCredentialRpc,\n\tBrowserListCredentialsRpc,\n\tBrowserRemoveCredentialRpc,\n\tWorktreeCreateRpc,\n\tWorktreeListRpc,\n\tWorktreeGetRpc,\n\tWorktreeRenameBranchRpc,\n\tWorktreeRerunSetupRpc,\n\tWorktreeSetupStreamRpc,\n\tWorktreeStartRunRpc,\n\tWorktreeRemoveRpc,\n\tRepositorySettingsGetRpc,\n\tRepositorySettingsUpdateRpc,\n\tSettingsGetRpc,\n\tSettingsUpdateRpc,\n\tSettingsStreamRpc,\n\tSettingsMigrateLocalStorageRpc,\n\tUsageReportRpc,\n\tUsageOverviewRpc,\n\tUsageSessionsRpc,\n\tUsageLimitsRpc,\n\tUsageLimitsHistoryRpc,\n\tDiagnosticsExportRpc,\n\tDiagnosticsOverviewRpc,\n\tDiagnosticsEventsRpc,\n\tDiagnosticsProcessesRpc,\n\tDiagnosticsSignalRpc,\n\tDiagnosticsIngestRpc,\n\tDiagnosticsCaptureRpc,\n\tKeybindingsGetRpc,\n\tKeybindingsReplaceRpc,\n\tKeybindingsStreamRpc,\n\tSessionSetWorktreeRpc,\n);\nexport type MemoizeRpcs = typeof MemoizeRpcs;\n\n/**\n * The Electron IPC channel name used to transport RPC frames in both\n * directions. The frame body is the bytes/string emitted by the configured\n * `RpcSerialization` (we use NDJSON in v1 — see `apps/desktop/src/runtime.ts`).\n *\n * Renderer → main: `ipcRenderer.send(IPC_CHANNEL, frame)`\n * Main → renderer: `webContents.send(IPC_CHANNEL, frame)`\n */\nexport const IPC_CHANNEL = \"zuse:rpc\" as const;\n","import { Schema } from \"effect\";\n\n/** Headless runtime release tested against this desktop wire contract. */\nexport const COMPATIBLE_SERVE_RUNTIME_VERSION = \"0.1.2\" as const;\n\nexport const ServeServiceState = Schema.Literals([\n\t\"running\",\n\t\"stopped\",\n\t\"missing\",\n]);\nexport type ServeServiceState = typeof ServeServiceState.Type;\n\nexport const ServeTunnelState = Schema.Literals([\"configured\", \"unavailable\"]);\nexport type ServeTunnelState = typeof ServeTunnelState.Type;\n\n/** Stable JSON emitted by `zuse serve status --json`. */\nexport const ServeStatusV1 = Schema.Struct({\n\tschemaVersion: Schema.Literal(1),\n\tcomputer: Schema.String,\n\tservice: ServeServiceState,\n\ttunnel: ServeTunnelState,\n\truntimeVersion: Schema.String,\n\tagents: Schema.Array(Schema.String),\n\treachable: Schema.Boolean,\n\tenvironmentId: Schema.NullOr(Schema.String),\n\tdurable: Schema.Boolean,\n\tdataDir: Schema.String,\n\tappUrl: Schema.String,\n});\nexport type ServeStatusV1 = typeof ServeStatusV1.Type;\n","import { Schema } from \"effect\";\n\nimport { EnvironmentDescriptor } from \"./connect.ts\";\nimport { EnvironmentId } from \"./ids.ts\";\n\nexport const SshHostSource = Schema.Literals([\"ssh-config\", \"tailscale\"]);\nexport type SshHostSource = typeof SshHostSource.Type;\n\nconst HostAlias = Schema.String.check(\n\tSchema.isMinLength(1),\n\tSchema.makeFilter((value) =>\n\t\t/^[A-Za-z0-9][A-Za-z0-9._:%-]*$/u.test(value)\n\t\t\t? undefined\n\t\t\t: \"SSH host contains unsupported characters.\",\n\t),\n);\nconst Username = Schema.String.check(\n\tSchema.isMinLength(1),\n\tSchema.makeFilter((value) =>\n\t\t/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(value)\n\t\t\t? undefined\n\t\t\t: \"SSH username contains unsupported characters.\",\n\t),\n);\nconst Port = Schema.Number.check(\n\tSchema.isInt(),\n\tSchema.makeFilter((value) =>\n\t\tvalue >= 1 && value <= 65_535\n\t\t\t? undefined\n\t\t\t: \"SSH port must be between 1 and 65535.\",\n\t),\n);\n\nexport class SshEnvironmentTarget extends Schema.Class<SshEnvironmentTarget>(\n\t\"SshEnvironmentTarget\",\n)({\n\talias: HostAlias,\n\thostname: Schema.String.check(Schema.isMinLength(1)),\n\tusername: Schema.NullOr(Username),\n\tport: Schema.NullOr(Port),\n}) {}\n\nexport class DiscoveredSshHost extends Schema.Class<DiscoveredSshHost>(\n\t\"DiscoveredSshHost\",\n)({\n\talias: Schema.String,\n\thostname: Schema.String,\n\tusername: Schema.NullOr(Schema.String),\n\tport: Schema.NullOr(Schema.Number),\n\tsource: SshHostSource,\n\tonline: Schema.NullOr(Schema.Boolean),\n\tos: Schema.NullOr(Schema.String),\n\tdisplayName: Schema.String,\n}) {}\n\nexport class RemoteEnvironmentProfile extends Schema.Class<RemoteEnvironmentProfile>(\n\t\"RemoteEnvironmentProfile\",\n)({\n\tprofileId: Schema.String,\n\tenvironmentId: EnvironmentId,\n\tlabel: Schema.String,\n\ttarget: SshEnvironmentTarget,\n\tlastConnectedAt: Schema.String,\n}) {}\n\nexport class SshEnvironmentConnection extends Schema.Class<SshEnvironmentConnection>(\n\t\"SshEnvironmentConnection\",\n)({\n\tprofile: RemoteEnvironmentProfile,\n\tdescriptor: EnvironmentDescriptor,\n}) {}\n\nexport const EnsureSshEnvironmentInput = Schema.Union([\n\tSchema.Struct({ profileId: Schema.String }),\n\tSchema.Struct({\n\t\ttarget: SshEnvironmentTarget,\n\t\tlabel: Schema.optional(Schema.String),\n\t}),\n]);\nexport type EnsureSshEnvironmentInput = typeof EnsureSshEnvironmentInput.Type;\n","import { Schema } from \"effect\";\n\nimport { EnvironmentDescriptor } from \"./connect.ts\";\nimport { EnvironmentId } from \"./ids.ts\";\n\nexport const TailnetShareAvailability = Schema.Literals([\n\t\"not-installed\",\n\t\"signed-out\",\n\t\"approval-required\",\n\t\"available\",\n\t\"conflict\",\n\t\"error\",\n]);\nexport type TailnetShareAvailability = typeof TailnetShareAvailability.Type;\n\nexport const TailnetServeConflictReason = Schema.Literals([\n\t\"foreign-app\",\n\t\"unresponsive-owner\",\n\t\"unrecognized-config\",\n]);\nexport type TailnetServeConflictReason = typeof TailnetServeConflictReason.Type;\n\nexport class TailnetServeConflict extends Schema.Class<TailnetServeConflict>(\n\t\"TailnetServeConflict\",\n)({\n\treason: TailnetServeConflictReason,\n\ttargetPort: Schema.NullOr(Schema.Number),\n\tcanReplace: Schema.Boolean,\n}) {}\n\nexport const TailnetShareManagedBy = Schema.Literals([\n\t\"this-app\",\n\t\"zuse-serve\",\n]);\nexport type TailnetShareManagedBy = typeof TailnetShareManagedBy.Type;\n\nexport class TailnetShareState extends Schema.Class<TailnetShareState>(\n\t\"TailnetShareState\",\n)({\n\tavailability: TailnetShareAvailability,\n\tenabled: Schema.Boolean,\n\tdnsName: Schema.NullOr(Schema.String),\n\thttpsUrl: Schema.NullOr(Schema.String),\n\tbackendState: Schema.NullOr(Schema.String),\n\tport: Schema.Number,\n\tdetail: Schema.NullOr(Schema.String),\n\tapprovalUrl: Schema.NullOr(Schema.String),\n\tmanagedBy: Schema.NullOr(TailnetShareManagedBy),\n\tconflict: Schema.NullOr(TailnetServeConflict),\n}) {}\n\nexport class TailnetEnvironmentProfile extends Schema.Class<TailnetEnvironmentProfile>(\n\t\"TailnetEnvironmentProfile\",\n)({\n\tprofileId: Schema.String,\n\tenvironmentId: EnvironmentId,\n\tlabel: Schema.String,\n\thttpBaseUrl: Schema.String,\n\twsBaseUrl: Schema.String,\n\tlastConnectedAt: Schema.String,\n}) {}\n\nexport const EnsureTailnetEnvironmentInput = Schema.Union([\n\tSchema.Struct({ profileId: Schema.String }),\n\tSchema.Struct({\n\t\tpairingLink: Schema.String,\n\t\tlabel: Schema.optional(Schema.String),\n\t}),\n]);\nexport type EnsureTailnetEnvironmentInput =\n\ttypeof EnsureTailnetEnvironmentInput.Type;\n\nexport class TailnetEnvironmentConnection extends Schema.Class<TailnetEnvironmentConnection>(\n\t\"TailnetEnvironmentConnection\",\n)({\n\tdescriptor: EnvironmentDescriptor,\n\tprofile: TailnetEnvironmentProfile,\n\twsUrl: Schema.String,\n}) {}\n","import { WIRE_PROTOCOL_VERSION } from \"@zuse/contracts\";\nimport { type Duration, Layer } from \"effect\";\nimport { RpcClient, RpcSerialization } from \"effect/unstable/rpc\";\nimport { Socket } from \"effect/unstable/socket\";\nimport { withWireProtocolVersion } from \"./connection.ts\";\n\nexport type WsProtocolOptions = {\n\treadonly key?: string;\n\treadonly environmentId?: string;\n\treadonly host: string;\n\treadonly port: number;\n\treadonly token?: string | null;\n\treadonly wsBaseUrl?: string | null;\n\t/** Changes whenever discovery replaces the disposable local route. */\n\treadonly routeGeneration?: number;\n\treadonly pathType?: \"lan\" | \"apple-peer\";\n\t/** Pinned Ed25519 identity used to authenticate a rediscovered local route. */\n\treadonly serverPublicKey?: string;\n\treadonly serverKeyPin?: string;\n\t/** Refresh a short-lived same-account grant while keeping the local route. */\n\treadonly refreshAccountGrant?: boolean;\n};\n\nexport type WsProtocolLayerOptions = {\n\treadonly openTimeout?: Duration.Input;\n\treadonly makeWebSocket?: (\n\t\turl: string,\n\t\tprotocols?: string | Array<string>,\n\t) => globalThis.WebSocket;\n\treadonly onClose?: (event: WebSocketCloseInfo) => void;\n};\n\nexport type WebSocketCloseInfo = {\n\treadonly code: number;\n\treadonly reason: string;\n\treadonly wasClean: boolean;\n};\n\ntype WebSocketConstructor = NonNullable<\n\tWsProtocolLayerOptions[\"makeWebSocket\"]\n>;\n\nexport const observeWebSocketConstructor =\n\t(\n\t\tmakeWebSocket: WebSocketConstructor,\n\t\tonClose: (event: WebSocketCloseInfo) => void,\n\t): WebSocketConstructor =>\n\t(url, protocols) => {\n\t\tconst socket = makeWebSocket(url, protocols);\n\t\tsocket.addEventListener(\n\t\t\t\"close\",\n\t\t\t(event) => {\n\t\t\t\tconst close = event as unknown as WebSocketCloseInfo;\n\t\t\t\tonClose({\n\t\t\t\t\tcode: close.code,\n\t\t\t\t\treason: close.reason,\n\t\t\t\t\twasClean: close.wasClean,\n\t\t\t\t});\n\t\t\t},\n\t\t\t{ once: true },\n\t\t);\n\t\treturn socket;\n\t};\n\nexport const connectionKey = (host: string, port: number): string =>\n\t`${host.trim()}:${port}`;\n\nexport const wsUrl = ({ host, port }: WsProtocolOptions): string =>\n\t`ws://${host.trim()}:${port}`;\n\nexport const authenticatedWsUrl = (options: WsProtocolOptions): string => {\n\tconst base = options.wsBaseUrl?.trim();\n\tconst url = new URL(base && base.length > 0 ? base : wsUrl(options));\n\tif (options.token?.trim()) {\n\t\turl.searchParams.set(\"token\", options.token.trim());\n\t}\n\treturn withWireProtocolVersion(url.toString(), WIRE_PROTOCOL_VERSION);\n};\n\nexport const wsClientProtocolLayer = (\n\tendpoint: string | WsProtocolOptions,\n\toptions?: WsProtocolLayerOptions,\n): Layer.Layer<RpcClient.Protocol> => {\n\tconst makeWebSocket =\n\t\toptions?.onClose === undefined\n\t\t\t? options?.makeWebSocket\n\t\t\t: observeWebSocketConstructor(\n\t\t\t\t\toptions.makeWebSocket ??\n\t\t\t\t\t\t((url, protocols) => new globalThis.WebSocket(url, protocols)),\n\t\t\t\t\toptions.onClose,\n\t\t\t\t);\n\treturn RpcClient.layerProtocolSocket().pipe(\n\t\tLayer.provide(\n\t\t\tSocket.layerWebSocket(\n\t\t\t\ttypeof endpoint === \"string\" ? endpoint : authenticatedWsUrl(endpoint),\n\t\t\t\t{ openTimeout: options?.openTimeout },\n\t\t\t),\n\t\t),\n\t\tLayer.provide(\n\t\t\tmakeWebSocket === undefined\n\t\t\t\t? Socket.layerWebSocketConstructorGlobal\n\t\t\t\t: Layer.succeed(Socket.WebSocketConstructor, makeWebSocket),\n\t\t),\n\t\tLayer.provide(RpcSerialization.layerJson),\n\t);\n};\n","import { randomUUID } from \"node:crypto\";\nimport { readFile, stat } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport {\n\tbasename,\n\tdirname,\n\tisAbsolute,\n\tjoin,\n\trelative,\n\tresolve,\n} from \"node:path\";\n\nimport { makeRpcClientSession } from \"@zuse/client-runtime/connection\";\nimport { wsClientProtocolLayer } from \"@zuse/client-runtime/ws-protocol\";\nimport {\n\ttype AttachmentRef,\n\ttype ChatId,\n\tCommandId,\n\tComposerInput,\n\ttype FileRef,\n\ttype LinearIssueRef,\n\tMemoizeRpcs,\n\ttype MessageId,\n\tMODELS_BY_PROVIDER,\n\ttype PermissionMode,\n\ttype ProviderId,\n\ttype RuntimeMode,\n\ttype SessionId,\n\tWIRE_PROTOCOL_VERSION,\n\ttype WorktreeId,\n} from \"@zuse/contracts\";\nimport { Effect } from \"effect\";\n\ntype RpcClient = Awaited<ReturnType<typeof connect>>[\"client\"];\n\nconst commandId = (kind: string): CommandId =>\n\tCommandId.make(`${kind}:${randomUUID()}`);\n\nconst GROUPS = new Set([\n\t\"commands\",\n\t\"computer\",\n\t\"project\",\n\t\"model\",\n\t\"chat\",\n\t\"session\",\n\t\"thread\",\n]);\nexport const isAgentCliCommand = (argv: ReadonlyArray<string>): boolean =>\n\targv[0] !== undefined && GROUPS.has(argv[0]);\n\nexport class CliError extends Error {\n\tconstructor(\n\t\treadonly code: string,\n\t\tmessage: string,\n\t\treadonly details?: unknown,\n\t) {\n\t\tsuper(message);\n\t}\n}\n\nconst success = (data: unknown): void => {\n\tprocess.stdout.write(\n\t\t`${JSON.stringify({ schemaVersion: 1, ok: true, data })}\\n`,\n\t);\n};\n\nconst failure = (cause: unknown): void => {\n\tconst error =\n\t\tcause instanceof CliError\n\t\t\t? cause\n\t\t\t: new CliError(\n\t\t\t\t\t\"internal_error\",\n\t\t\t\t\tcause instanceof Error ? cause.message : String(cause),\n\t\t\t\t);\n\tprocess.stdout.write(\n\t\t`${JSON.stringify({\n\t\t\tschemaVersion: 1,\n\t\t\tok: false,\n\t\t\terror: {\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: error.message,\n\t\t\t\t...(error.details === undefined ? {} : { details: error.details }),\n\t\t\t},\n\t\t})}\\n`,\n\t);\n\tprocess.exitCode =\n\t\terror.code === \"invalid_input\" ? 2 : error.code === \"unauthorized\" ? 3 : 1;\n};\n\ntype Args = {\n\treadonly positionals: string[];\n\treadonly flags: Map<string, string[]>;\n};\nconst parse = (argv: ReadonlyArray<string>): Args => {\n\tconst positionals: string[] = [];\n\tconst flags = new Map<string, string[]>();\n\tfor (let i = 0; i < argv.length; i += 1) {\n\t\tconst value = argv[i];\n\t\tif (value === undefined) break;\n\t\tif (!value.startsWith(\"--\")) {\n\t\t\tpositionals.push(value);\n\t\t\tcontinue;\n\t\t}\n\t\tconst [rawKey, inline] = value.slice(2).split(\"=\", 2);\n\t\tif (!rawKey)\n\t\t\tthrow new CliError(\"invalid_input\", `Invalid option ${value}.`);\n\t\tconst next = argv[i + 1];\n\t\tlet optionValue = inline ?? \"true\";\n\t\tif (inline === undefined && next !== undefined && !next.startsWith(\"--\")) {\n\t\t\toptionValue = next;\n\t\t\ti += 1;\n\t\t}\n\t\tflags.set(rawKey, [...(flags.get(rawKey) ?? []), optionValue]);\n\t}\n\treturn { positionals, flags };\n};\nconst one = (args: Args, name: string): string | undefined =>\n\targs.flags.get(name)?.at(-1);\nconst many = (args: Args, name: string): string[] => args.flags.get(name) ?? [];\nconst required = (value: string | undefined, name: string): string => {\n\tif (!value) throw new CliError(\"invalid_input\", `${name} is required.`);\n\treturn value;\n};\nconst bool = (args: Args, name: string): boolean => one(args, name) === \"true\";\nconst readStdin = async (): Promise<string> => {\n\tconst chunks: Buffer[] = [];\n\tfor await (const chunk of process.stdin) chunks.push(Buffer.from(chunk));\n\treturn Buffer.concat(chunks).toString(\"utf8\");\n};\nconst expandInputJson = async (\n\targv: ReadonlyArray<string>,\n): Promise<string[]> => {\n\tconst result = [...argv];\n\tconst index = result.findIndex(\n\t\t(value) => value === \"--input-json\" || value.startsWith(\"--input-json=\"),\n\t);\n\tif (index < 0) return result;\n\tconst inline = result[index]?.split(\"=\", 2)[1];\n\tconst source = inline ?? result[index + 1];\n\tif (source === undefined)\n\t\tthrow new CliError(\n\t\t\t\"invalid_input\",\n\t\t\t\"--input-json requires JSON, a file path prefixed with @, or - for stdin.\",\n\t\t);\n\tconst raw =\n\t\tsource === \"-\"\n\t\t\t? await readStdin()\n\t\t\t: source.startsWith(\"@\")\n\t\t\t\t? await readFile(resolve(source.slice(1)), \"utf8\")\n\t\t\t\t: source;\n\tlet input: unknown;\n\ttry {\n\t\tinput = JSON.parse(raw);\n\t} catch {\n\t\tthrow new CliError(\"invalid_input\", \"--input-json is not valid JSON.\");\n\t}\n\tif (input === null || typeof input !== \"object\" || Array.isArray(input))\n\t\tthrow new CliError(\"invalid_input\", \"--input-json must contain an object.\");\n\tresult.splice(index, inline === undefined ? 2 : 1);\n\tfor (const [key, value] of Object.entries(input as Record<string, unknown>)) {\n\t\tfor (const item of Array.isArray(value) ? value : [value]) {\n\t\t\tif (item === false || item === null || item === undefined) continue;\n\t\t\tresult.push(`--${key}`, item === true ? \"true\" : String(item));\n\t\t}\n\t}\n\treturn result;\n};\nconst promptFor = async (args: Args, message = false): Promise<string> => {\n\tconst direct =\n\t\tone(args, message ? \"message\" : \"prompt\") ?? one(args, \"prompt\");\n\tif (direct !== undefined) return direct;\n\tconst file = one(args, \"prompt-file\");\n\tif (file === undefined) return \"\";\n\treturn file === \"-\" ? readStdin() : readFile(resolve(file), \"utf8\");\n};\n\ntype LocalCliAccess = {\n\treadonly schemaVersion: 1;\n\treadonly wsUrl: string;\n\treadonly token: string;\n};\nconst installedCliAccessCandidates = (\n\tenv: NodeJS.ProcessEnv,\n\tplatform = process.platform,\n): ReadonlyArray<string> => {\n\tconst configured = env.ZUSE_USER_DATA_DIR?.trim();\n\tif (configured) return [join(resolve(configured), \"cli-access.json\")];\n\tif (platform === \"darwin\")\n\t\treturn [\n\t\t\tjoin(\n\t\t\t\thomedir(),\n\t\t\t\t\"Library\",\n\t\t\t\t\"Application Support\",\n\t\t\t\t\"Zuse Alpha\",\n\t\t\t\t\"cli-access.json\",\n\t\t\t),\n\t\t];\n\tif (platform === \"win32\" && env.APPDATA?.trim())\n\t\treturn [join(resolve(env.APPDATA), \"Zuse Alpha\", \"cli-access.json\")];\n\tconst config = env.XDG_CONFIG_HOME?.trim() || join(homedir(), \".config\");\n\treturn [join(resolve(config), \"Zuse Alpha\", \"cli-access.json\")];\n};\nconst localCliAccess = async (\n\tenv: NodeJS.ProcessEnv,\n): Promise<LocalCliAccess | null> => {\n\tconst explicit = env.ZUSE_DEV_CLI_ACCESS_FILE?.trim();\n\tconst candidates: string[] = explicit\n\t\t? [resolve(explicit)]\n\t\t: [...installedCliAccessCandidates(env)];\n\tlet cursor = resolve(process.cwd());\n\twhile (true) {\n\t\tconst instance = env.ZUSE_DEV_INSTANCE?.trim() || \"default\";\n\t\tcandidates.push(\n\t\t\tjoin(cursor, \".zuse\", \"dev-instances\", instance, \"cli-access.json\"),\n\t\t);\n\t\tconst parent = dirname(cursor);\n\t\tif (parent === cursor) break;\n\t\tcursor = parent;\n\t}\n\tfor (const candidate of candidates) {\n\t\ttry {\n\t\t\tconst parsed = JSON.parse(\n\t\t\t\tawait readFile(candidate, \"utf8\"),\n\t\t\t) as Partial<LocalCliAccess>;\n\t\t\tif (\n\t\t\t\tparsed.schemaVersion === 1 &&\n\t\t\t\ttypeof parsed.wsUrl === \"string\" &&\n\t\t\t\ttypeof parsed.token === \"string\"\n\t\t\t)\n\t\t\t\treturn parsed as LocalCliAccess;\n\t\t} catch {\n\t\t\t// Continue to the next repository ancestor.\n\t\t}\n\t}\n\treturn null;\n};\n\nconst endpoint = async (\n\targs: Args,\n\tenv: NodeJS.ProcessEnv,\n): Promise<string> => {\n\tconst computer = one(args, \"computer\") ?? \"local\";\n\tif (computer !== \"local\" && one(args, \"ws-url\") === undefined) {\n\t\tthrow new CliError(\n\t\t\t\"computer_unavailable\",\n\t\t\t\"A connected computer requires --ws-url and, when protected, --token.\",\n\t\t\t{ computer },\n\t\t);\n\t}\n\tconst access =\n\t\tone(args, \"ws-url\") === undefined && env.ZUSE_WS_URL === undefined\n\t\t\t? await localCliAccess(env)\n\t\t\t: null;\n\tconst raw =\n\t\tone(args, \"ws-url\") ??\n\t\tenv.ZUSE_WS_URL ??\n\t\taccess?.wsUrl ??\n\t\t`ws://127.0.0.1:${env.ZUSE_PORT ?? \"47837\"}/rpc`;\n\tconst url = new URL(raw);\n\tif (url.pathname === \"/\") url.pathname = \"/rpc\";\n\turl.searchParams.set(\"wireVersion\", String(WIRE_PROTOCOL_VERSION));\n\tconst token = one(args, \"token\") ?? env.ZUSE_TOKEN ?? access?.token;\n\tif (token !== undefined) url.searchParams.set(\"token\", token);\n\treturn url.toString();\n};\n\nconst connect = async (args: Args, env: NodeJS.ProcessEnv) => {\n\tconst layer = wsClientProtocolLayer(await endpoint(args, env));\n\treturn makeRpcClientSession(layer, MemoizeRpcs, {\n\t\tprotocolVersion: WIRE_PROTOCOL_VERSION,\n\t\tperform: (client, hello) => client[\"connect.handshake\"](hello),\n\t});\n};\nconst rpc = <A>(effect: Effect.Effect<A, unknown>): Promise<A> =>\n\tEffect.runPromise(effect);\n\nconst commandManifest = () => ({\n\tcommands: [\n\t\t\"computer list\",\n\t\t\"project list\",\n\t\t\"model list\",\n\t\t\"chat list\",\n\t\t\"chat get\",\n\t\t\"chat create\",\n\t\t\"chat rename\",\n\t\t\"chat archive\",\n\t\t\"chat unarchive\",\n\t\t\"chat delete\",\n\t\t\"chat workspace\",\n\t\t\"session list\",\n\t\t\"session get\",\n\t\t\"session create\",\n\t\t\"session read\",\n\t\t\"session send\",\n\t\t\"session fork\",\n\t\t\"session model\",\n\t\t\"session provider\",\n\t\t\"session rename\",\n\t\t\"session archive\",\n\t\t\"session unarchive\",\n\t\t\"session delete\",\n\t\t\"session transcript\",\n\t\t\"session plan\",\n\t\t\"session plan-respond\",\n\t\t\"session answer\",\n\t\t\"session queue-list\",\n\t\t\"session queue-add\",\n\t\t\"session queue-update\",\n\t\t\"session queue-delete\",\n\t\t\"session queue-reorder\",\n\t\t\"session queue-run-next\",\n\t\t\"session queue-flush\",\n\t\t\"session queue-resume\",\n\t\t\"session mode\",\n\t\t\"session interrupt\",\n\t\t\"session resume\",\n\t],\n\tcommonOptions: [\"--computer\", \"--ws-url\", \"--token\", \"--project\"],\n\tcontextOptions: [\"--attach\", \"--file\", \"--linear\", \"--transcript\", \"--plan\"],\n\tdeleteRequires: \"--confirm\",\n\tschemaVersion: 1,\n});\n\nconst resolveProject = async (client: RpcClient, args: Args) => {\n\tconst projects = await rpc(client[\"workspace.list\"]({}));\n\tconst selector = one(args, \"project\");\n\tif (!selector) {\n\t\tif (projects.length === 1 && projects[0] !== undefined) return projects[0];\n\t\tconst cwd = resolve(process.cwd());\n\t\tconst matches = projects.filter(\n\t\t\t(project) =>\n\t\t\t\tcwd === resolve(project.path) ||\n\t\t\t\tcwd.startsWith(`${resolve(project.path)}/`),\n\t\t);\n\t\tif (matches.length === 1 && matches[0] !== undefined) return matches[0];\n\t\tthrow new CliError(\n\t\t\t\"project_required\",\n\t\t\t\"--project is required when the project cannot be inferred uniquely.\",\n\t\t\t{\n\t\t\t\tcandidates: projects.map(({ id, name, path }) => ({ id, name, path })),\n\t\t\t},\n\t\t);\n\t}\n\tconst matches = projects.filter(\n\t\t(p) =>\n\t\t\tp.id === selector ||\n\t\t\tp.name === selector ||\n\t\t\tresolve(p.path) === resolve(selector),\n\t);\n\tif (matches.length !== 1)\n\t\tthrow new CliError(\n\t\t\tmatches.length ? \"ambiguous_selector\" : \"project_not_found\",\n\t\t\t`Project selector matched ${matches.length} projects.`,\n\t\t\t{ candidates: matches },\n\t\t);\n\tconst match = matches[0];\n\tif (match === undefined)\n\t\tthrow new CliError(\"project_not_found\", \"Project not found.\");\n\treturn match;\n};\n\nconst provider = (args: Args): ProviderId => {\n\tconst value = one(args, \"provider\") ?? \"codex\";\n\tif (!(value in MODELS_BY_PROVIDER))\n\t\tthrow new CliError(\"invalid_provider\", `Unknown provider ${value}.`, {\n\t\t\tproviders: Object.keys(MODELS_BY_PROVIDER),\n\t\t});\n\treturn value as ProviderId;\n};\nconst model = (args: Args, p: ProviderId): string =>\n\tone(args, \"model\") ??\n\tMODELS_BY_PROVIDER[p].find((m) => m.defaultModel)?.id ??\n\tMODELS_BY_PROVIDER[p][0]?.id ??\n\t\"default\";\nconst permission = (args: Args): PermissionMode => {\n\tconst raw = one(args, \"permission\") ?? \"default\";\n\tconst value = raw === \"accept-edits\" ? \"acceptEdits\" : raw;\n\tif (![\"default\", \"plan\", \"acceptEdits\"].includes(value))\n\t\tthrow new CliError(\n\t\t\t\"invalid_permission_mode\",\n\t\t\t`Unknown permission mode ${value}.`,\n\t\t);\n\treturn value as PermissionMode;\n};\nconst runtime = (args: Args): RuntimeMode => {\n\tconst value = one(args, \"runtime\") ?? \"approval-required\";\n\tif (\n\t\t![\n\t\t\t\"approval-required\",\n\t\t\t\"auto-accept-edits\",\n\t\t\t\"auto-accept-edits-and-bash\",\n\t\t\t\"full-access\",\n\t\t].includes(value)\n\t)\n\t\tthrow new CliError(\n\t\t\t\"invalid_runtime_mode\",\n\t\t\t`Unknown runtime mode ${value}.`,\n\t\t);\n\treturn value as RuntimeMode;\n};\nconst asSessionId = (value: string): SessionId => value as SessionId;\nconst asChatId = (value: string): ChatId => value as ChatId;\nconst asMessageId = (value: string): MessageId => value as MessageId;\n\nconst jsonObject = (value: string | undefined, name: string): unknown => {\n\tconst raw = required(value, name);\n\ttry {\n\t\treturn JSON.parse(raw);\n\t} catch {\n\t\tthrow new CliError(\"invalid_input\", `${name} must be valid JSON.`);\n\t}\n};\n\nconst mimeFor = (path: string): string => {\n\tconst ext = path.toLowerCase().split(\".\").at(-1);\n\tconst mime = {\n\t\tpng: \"image/png\",\n\t\tjpg: \"image/jpeg\",\n\t\tjpeg: \"image/jpeg\",\n\t\tgif: \"image/gif\",\n\t\twebp: \"image/webp\",\n\t\tavif: \"image/avif\",\n\t}[ext ?? \"\"];\n\tif (!mime)\n\t\tthrow new CliError(\n\t\t\t\"unsupported_attachment\",\n\t\t\t`Unsupported image attachment: ${path}.`,\n\t\t);\n\treturn mime;\n};\n\nconst contextFor = async (\n\tclient: RpcClient,\n\targs: Args,\n\tsessionId: string,\n\tproject: { id: string; path: string },\n) => {\n\tconst attachments: AttachmentRef[] = [];\n\tconst fileRefs: FileRef[] = [];\n\tfor (const inputPath of many(args, \"attach\")) {\n\t\tconst absPath = resolve(inputPath);\n\t\tconst bytes = await readFile(absPath);\n\t\tconst mimeType = mimeFor(absPath);\n\t\tconst uploaded = await rpc(\n\t\t\tclient[\"attachments.upload\"]({\n\t\t\t\tsessionId: asSessionId(sessionId),\n\t\t\t\tbytes,\n\t\t\t\tmimeType,\n\t\t\t\toriginalName: basename(absPath),\n\t\t\t\trootPath: project.path,\n\t\t\t}),\n\t\t);\n\t\tattachments.push({\n\t\t\tid: uploaded.id,\n\t\t\tmimeType: uploaded.mimeType,\n\t\t\toriginalName: basename(absPath),\n\t\t});\n\t}\n\tfor (const inputPath of many(args, \"file\")) {\n\t\tconst absPath = resolve(project.path, inputPath);\n\t\tconst relPath = relative(project.path, absPath);\n\t\tif (relPath.startsWith(\"..\") || isAbsolute(relPath))\n\t\t\tthrow new CliError(\n\t\t\t\t\"path_outside_project\",\n\t\t\t\t`${inputPath} is outside the selected project.`,\n\t\t\t);\n\t\tconst info = await stat(absPath).catch(() => null);\n\t\tif (!info)\n\t\t\tthrow new CliError(\"file_not_found\", `${inputPath} does not exist.`);\n\t\tfileRefs.push({\n\t\t\trelPath,\n\t\t\tabsPath,\n\t\t\tkind: info.isDirectory() ? \"directory\" : \"file\",\n\t\t});\n\t}\n\tconst warnings: unknown[] = [];\n\tfor (const sourceSession of many(args, \"transcript\")) {\n\t\tconst source = await rpc(\n\t\t\tclient[\"session.get\"]({ sessionId: asSessionId(sourceSession) }),\n\t\t);\n\t\tif (source.projectId !== project.id)\n\t\t\tthrow new CliError(\n\t\t\t\t\"project_session_mismatch\",\n\t\t\t\t\"Transcript source must belong to the selected project.\",\n\t\t\t);\n\t\tconst throughMessage = one(args, \"through-message\");\n\t\tconst exported = await rpc(\n\t\t\tclient[\"session.exportTranscript\"]({\n\t\t\t\tsessionId: asSessionId(sourceSession),\n\t\t\t\t...(throughMessage\n\t\t\t\t\t? { uptoMessageId: asMessageId(throughMessage) }\n\t\t\t\t\t: {}),\n\t\t\t}),\n\t\t);\n\t\tconst saved = await rpc(\n\t\t\tclient[\"context.saveText\"]({\n\t\t\t\tsessionId: asSessionId(sessionId),\n\t\t\t\ttext: exported.markdown,\n\t\t\t\text: \"md\",\n\t\t\t\trootPath: project.path,\n\t\t\t}),\n\t\t);\n\t\tfileRefs.push({ ...saved, kind: \"file\" });\n\t}\n\tfor (const sourceSession of many(args, \"plan\")) {\n\t\tconst source = await rpc(\n\t\t\tclient[\"session.get\"]({ sessionId: asSessionId(sourceSession) }),\n\t\t);\n\t\tif (source.projectId !== project.id)\n\t\t\tthrow new CliError(\n\t\t\t\t\"project_session_mismatch\",\n\t\t\t\t\"Plan source must belong to the selected project.\",\n\t\t\t);\n\t\tconst { plan } = await rpc(\n\t\t\tclient[\"session.latestPlan\"]({ sessionId: asSessionId(sourceSession) }),\n\t\t);\n\t\tif (plan === null)\n\t\t\tthrow new CliError(\n\t\t\t\t\"plan_not_found\",\n\t\t\t\t`Session ${sourceSession} has no proposed plan.`,\n\t\t\t);\n\t\tconst saved = await rpc(\n\t\t\tclient[\"context.saveText\"]({\n\t\t\t\tsessionId: asSessionId(sessionId),\n\t\t\t\ttext: plan,\n\t\t\t\text: \"md\",\n\t\t\t\trootPath: project.path,\n\t\t\t}),\n\t\t);\n\t\tfileRefs.push({ ...saved, kind: \"file\" });\n\t}\n\tfor (const issueSelector of many(args, \"linear\")) {\n\t\tconst workspace = one(args, \"linear-workspace\");\n\t\tconst result = await rpc(\n\t\t\tclient[\"linear.listIssues\"]({\n\t\t\t\tquery: issueSelector,\n\t\t\t\t...(workspace ? { workspaceIds: [workspace] } : {}),\n\t\t\t}),\n\t\t);\n\t\tconst matches = result.issues.filter(\n\t\t\t(issue) =>\n\t\t\t\tissue.identifier.toLowerCase() === issueSelector.toLowerCase() ||\n\t\t\t\tissue.issueId === issueSelector,\n\t\t);\n\t\tif (matches.length !== 1)\n\t\t\tthrow new CliError(\n\t\t\t\tmatches.length ? \"ambiguous_linear_issue\" : \"linear_issue_not_found\",\n\t\t\t\t`Linear selector matched ${matches.length} exact issues.`,\n\t\t\t\t{ candidates: result.issues },\n\t\t\t);\n\t\tconst issue = matches[0];\n\t\tif (issue === undefined)\n\t\t\tthrow new CliError(\"linear_issue_not_found\", \"Linear issue not found.\");\n\t\tconst prepared = await rpc(\n\t\t\tclient[\"linear.prepareContext\"]({\n\t\t\t\tsessionId: asSessionId(sessionId),\n\t\t\t\tissues: [\n\t\t\t\t\t{\n\t\t\t\t\t\tworkspaceId: issue.workspaceId,\n\t\t\t\t\t\tissueId: issue.issueId,\n\t\t\t\t\t\tidentifier: issue.identifier,\n\t\t\t\t\t} satisfies LinearIssueRef,\n\t\t\t\t],\n\t\t\t\trootPath: project.path,\n\t\t\t}),\n\t\t);\n\t\tfileRefs.push(\n\t\t\t...prepared.files.map(({ relPath, absPath }) => ({\n\t\t\t\trelPath,\n\t\t\t\tabsPath,\n\t\t\t\tkind: \"file\" as const,\n\t\t\t})),\n\t\t);\n\t\tattachments.push(...prepared.attachments);\n\t\twarnings.push(...prepared.warnings);\n\t}\n\treturn { attachments, fileRefs, warnings };\n};\n\nconst composer = (\n\ttext: string,\n\tcontext: Awaited<ReturnType<typeof contextFor>>,\n) =>\n\tnew ComposerInput({\n\t\ttext,\n\t\tattachments: context.attachments,\n\t\tfileRefs: context.fileRefs,\n\t\tskillRefs: [],\n\t\tannotations: [],\n\t});\n\nconst execute = async (\n\targv: ReadonlyArray<string>,\n\tenv: NodeJS.ProcessEnv,\n): Promise<unknown> => {\n\tconst args = parse(argv);\n\tlet [group, action] = args.positionals;\n\tif (group === \"commands\") return commandManifest();\n\tif (group === \"thread\") {\n\t\tgroup = action === \"create\" ? \"chat\" : \"session\";\n\t}\n\tlet session: Awaited<ReturnType<typeof connect>>;\n\ttry {\n\t\tsession = await connect(args, env);\n\t} catch (cause) {\n\t\tif (cause instanceof Error && cause.message.includes(\"SocketOpenError\"))\n\t\t\tthrow new CliError(\n\t\t\t\t\"unauthorized\",\n\t\t\t\t\"Could not open the Zuse RPC connection. Pass a connected --ws-url and --token, or target a loopback server running with local authentication.\",\n\t\t\t);\n\t\tthrow cause;\n\t}\n\ttry {\n\t\tconst client = session.client;\n\t\tif (group === \"computer\" && action === \"list\") {\n\t\t\tconst [current, connected] = await Promise.all([\n\t\t\t\trpc(client[\"connect.describe\"]()),\n\t\t\t\trpc(client[\"environments.list\"]()),\n\t\t\t]);\n\t\t\treturn {\n\t\t\t\tcurrent,\n\t\t\t\tcomputers: connected.environments,\n\t\t\t};\n\t\t}\n\t\tif (group === \"project\" && action === \"list\")\n\t\t\treturn { projects: await rpc(client[\"workspace.list\"]({})) };\n\t\tif (group === \"model\" && action === \"list\") {\n\t\t\tconst availability = await rpc(\n\t\t\t\tclient[\"provider.availability\"]({ refresh: bool(args, \"refresh\") }),\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tproviders: Object.entries(MODELS_BY_PROVIDER).map(\n\t\t\t\t\t([providerId, models]) => ({\n\t\t\t\t\t\tproviderId,\n\t\t\t\t\t\tavailability:\n\t\t\t\t\t\t\tavailability.find((item) => item.providerId === providerId) ??\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\tmodels,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t\tconst project = await resolveProject(client, args);\n\t\tif (group === \"chat\" && action === \"list\")\n\t\t\treturn {\n\t\t\t\tchats: await rpc(\n\t\t\t\t\tclient[\"chat.list\"]({\n\t\t\t\t\t\tprojectId: project.id,\n\t\t\t\t\t\tincludeArchived: bool(args, \"include-archived\"),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t};\n\t\tif (group === \"chat\" && action === \"get\")\n\t\t\treturn {\n\t\t\t\tchat: await rpc(\n\t\t\t\t\tclient[\"chat.get\"]({\n\t\t\t\t\t\tchatId: asChatId(\n\t\t\t\t\t\t\trequired(one(args, \"chat\") ?? args.positionals[2], \"--chat\"),\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t};\n\t\tif (group === \"chat\" && action === \"rename\")\n\t\t\treturn {\n\t\t\t\tchat: await rpc(\n\t\t\t\t\tclient[\"chat.rename\"]({\n\t\t\t\t\t\tchatId: asChatId(required(one(args, \"chat\"), \"--chat\")),\n\t\t\t\t\t\ttitle: required(one(args, \"title\"), \"--title\"),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t};\n\t\tif (group === \"chat\" && action === \"archive\")\n\t\t\treturn {\n\t\t\t\tresult: await rpc(\n\t\t\t\t\tclient[\"chat.archive\"]({\n\t\t\t\t\t\tchatId: asChatId(required(one(args, \"chat\"), \"--chat\")),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t};\n\t\tif (group === \"chat\" && action === \"unarchive\")\n\t\t\treturn {\n\t\t\t\tresult: await rpc(\n\t\t\t\t\tclient[\"chat.unarchive\"]({\n\t\t\t\t\t\tchatId: asChatId(required(one(args, \"chat\"), \"--chat\")),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t};\n\t\tif (group === \"chat\" && action === \"delete\") {\n\t\t\tif (!bool(args, \"confirm\"))\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"confirmation_required\",\n\t\t\t\t\t\"chat delete requires --confirm.\",\n\t\t\t\t);\n\t\t\tconst chatId = asChatId(required(one(args, \"chat\"), \"--chat\"));\n\t\t\tawait rpc(client[\"chat.delete\"]({ chatId }));\n\t\t\treturn { chatId, deleted: true };\n\t\t}\n\t\tif (group === \"chat\" && action === \"workspace\") {\n\t\t\tconst workspace = required(one(args, \"workspace\"), \"--workspace\");\n\t\t\treturn {\n\t\t\t\tchat: await rpc(\n\t\t\t\t\tclient[\"chat.setWorktree\"]({\n\t\t\t\t\t\tchatId: asChatId(required(one(args, \"chat\"), \"--chat\")),\n\t\t\t\t\t\tworktreeId: workspace === \"main\" ? null : (workspace as WorktreeId),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t\tif (group === \"session\" && action === \"list\")\n\t\t\treturn {\n\t\t\t\tsessions: (\n\t\t\t\t\tawait rpc(\n\t\t\t\t\t\tclient[\"session.list\"]({\n\t\t\t\t\t\t\tprojectId: project.id,\n\t\t\t\t\t\t\tincludeArchived: bool(args, \"include-archived\"),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t).filter((s) => !one(args, \"chat\") || s.chatId === one(args, \"chat\")),\n\t\t\t};\n\t\tif (group === \"session\" && action === \"get\")\n\t\t\treturn {\n\t\t\t\tsession: await rpc(\n\t\t\t\t\tclient[\"session.get\"]({\n\t\t\t\t\t\tsessionId: asSessionId(\n\t\t\t\t\t\t\trequired(\n\t\t\t\t\t\t\t\tone(args, \"session\") ?? args.positionals[2],\n\t\t\t\t\t\t\t\t\"--session\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t};\n\t\tif (group === \"session\" && action === \"fork\") {\n\t\t\tconst sourceSessionId = asSessionId(\n\t\t\t\trequired(one(args, \"session\") ?? args.positionals[2], \"--session\"),\n\t\t\t);\n\t\t\tconst sourceSession = await rpc(\n\t\t\t\tclient[\"session.get\"]({ sessionId: sourceSessionId }),\n\t\t\t);\n\t\t\tif (sourceSession.projectId !== project.id)\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"project_session_mismatch\",\n\t\t\t\t\t\"The source session does not belong to the selected project.\",\n\t\t\t\t);\n\t\t\tconst destination = one(args, \"destination\") ?? \"tab\";\n\t\t\tif (destination !== \"tab\" && destination !== \"chat\")\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"invalid_input\",\n\t\t\t\t\t\"--destination must be tab or chat.\",\n\t\t\t\t);\n\t\t\tif (one(args, \"provider\") && !one(args, \"model\"))\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"invalid_input\",\n\t\t\t\t\t\"Forking to another provider requires --model.\",\n\t\t\t\t);\n\t\t\tconst workspace = one(args, \"workspace\");\n\t\t\tlet createdWorktree: WorktreeId | null = null;\n\t\t\tlet worktreeId: WorktreeId | null | undefined;\n\t\t\tif (destination === \"chat\") {\n\t\t\t\tif (workspace === undefined || workspace === \"fresh\") {\n\t\t\t\t\tconst created = await rpc(\n\t\t\t\t\t\tclient[\"worktree.create\"]({ projectId: project.id }),\n\t\t\t\t\t);\n\t\t\t\t\tcreatedWorktree = created.id;\n\t\t\t\t\tworktreeId = created.id;\n\t\t\t\t} else {\n\t\t\t\t\tworktreeId = workspace === \"main\" ? null : (workspace as WorktreeId);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn await rpc(\n\t\t\t\t\tclient[\"session.fork\"]({\n\t\t\t\t\t\tsourceSessionId,\n\t\t\t\t\t\tfromMessageId: asMessageId(\n\t\t\t\t\t\t\trequired(one(args, \"message\"), \"--message\"),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdestination,\n\t\t\t\t\t\t...(one(args, \"provider\") ? { providerId: provider(args) } : {}),\n\t\t\t\t\t\t...(one(args, \"model\") ? { model: one(args, \"model\") } : {}),\n\t\t\t\t\t\t...(destination === \"chat\"\n\t\t\t\t\t\t\t? { worktreeId: worktreeId ?? null }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(one(args, \"title\") ? { title: one(args, \"title\") } : {}),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t} catch (cause) {\n\t\t\t\tif (createdWorktree !== null)\n\t\t\t\t\tawait rpc(\n\t\t\t\t\t\tclient[\"worktree.remove\"]({ worktreeId: createdWorktree }),\n\t\t\t\t\t).catch(() => undefined);\n\t\t\t\tthrow cause;\n\t\t\t}\n\t\t}\n\t\tif (group === \"chat\" && action === \"create\") {\n\t\t\tconst p = provider(args);\n\t\t\tconst m = model(args, p);\n\t\t\tconst prompt = await promptFor(args);\n\t\t\tconst initialSessionId = asSessionId(`s_${randomUUID()}`);\n\t\t\tconst context = await contextFor(client, args, initialSessionId, project);\n\t\t\tconst workspace = one(args, \"workspace\") ?? \"fresh\";\n\t\t\tconst workspacePolicy =\n\t\t\t\tworkspace === \"main\"\n\t\t\t\t\t? ({ _tag: \"main\" } as const)\n\t\t\t\t\t: workspace === \"fresh\"\n\t\t\t\t\t\t? ({ _tag: \"fresh\" } as const)\n\t\t\t\t\t\t: ({\n\t\t\t\t\t\t\t\t_tag: \"existing\",\n\t\t\t\t\t\t\t\tworktreeId: workspace as WorktreeId,\n\t\t\t\t\t\t\t} as const);\n\t\t\tconst created = await rpc(\n\t\t\t\tclient[\"chat.create\"]({\n\t\t\t\t\toperationId: one(args, \"idempotency-key\") ?? randomUUID(),\n\t\t\t\t\tinitialSessionId,\n\t\t\t\t\tprojectId: project.id,\n\t\t\t\t\tproviderId: p,\n\t\t\t\t\tmodel: m,\n\t\t\t\t\ttitle: one(args, \"title\"),\n\t\t\t\t\truntimeMode: runtime(args),\n\t\t\t\t\tpermissionMode: permission(args),\n\t\t\t\t\tworkspacePolicy,\n\t\t\t\t\t...(prompt || context.attachments.length || context.fileRefs.length\n\t\t\t\t\t\t? { startupInput: composer(prompt, context) }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\tbackground: true,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn { ...created, warnings: context.warnings };\n\t\t}\n\t\tif (group === \"session\" && action === \"create\") {\n\t\t\tconst p = provider(args);\n\t\t\tconst m = model(args, p);\n\t\t\tconst prompt = await promptFor(args);\n\t\t\tconst requestedSessionId =\n\t\t\t\tone(args, \"idempotency-key\") ?? `s_${randomUUID()}`;\n\t\t\tconst context = await contextFor(\n\t\t\t\tclient,\n\t\t\t\targs,\n\t\t\t\trequestedSessionId,\n\t\t\t\tproject,\n\t\t\t);\n\t\t\tconst created = await rpc(\n\t\t\t\tclient[\"session.create\"]({\n\t\t\t\t\tsessionId: asSessionId(requestedSessionId),\n\t\t\t\t\tchatId: asChatId(required(one(args, \"chat\"), \"--chat\")),\n\t\t\t\t\tproviderId: p,\n\t\t\t\t\tmodel: m,\n\t\t\t\t\ttitle: one(args, \"title\"),\n\t\t\t\t\truntimeMode: runtime(args),\n\t\t\t\t\tpermissionMode: permission(args),\n\t\t\t\t}),\n\t\t\t);\n\t\t\tif (prompt || context.attachments.length || context.fileRefs.length)\n\t\t\t\tawait rpc(\n\t\t\t\t\tclient[\"messages.send\"]({\n\t\t\t\t\t\tcommandId: commandId(\"message-send\"),\n\t\t\t\t\t\tsessionId: created.id,\n\t\t\t\t\t\tinput: composer(prompt, context),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\treturn { session: created, warnings: context.warnings };\n\t\t}\n\t\tconst selectedSessionId = asSessionId(\n\t\t\trequired(one(args, \"session\") ?? args.positionals[2], \"--session\"),\n\t\t);\n\t\tconst selectedSession = await rpc(\n\t\t\tclient[\"session.get\"]({ sessionId: selectedSessionId }),\n\t\t);\n\t\tif (selectedSession.projectId !== project.id)\n\t\t\tthrow new CliError(\n\t\t\t\t\"project_session_mismatch\",\n\t\t\t\t\"The selected session does not belong to the selected project.\",\n\t\t\t\t{\n\t\t\t\t\tsessionProjectId: selectedSession.projectId,\n\t\t\t\t\tselectedProjectId: project.id,\n\t\t\t\t},\n\t\t\t);\n\t\tif (group === \"session\" && action === \"read\") {\n\t\t\tconst limitRaw = one(args, \"limit\");\n\t\t\tconst limit = limitRaw === undefined ? undefined : Number(limitRaw);\n\t\t\tif (limit !== undefined && (!Number.isInteger(limit) || limit < 0))\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"invalid_input\",\n\t\t\t\t\t\"--limit must be a non-negative integer.\",\n\t\t\t\t);\n\t\t\tconst messages = await rpc(\n\t\t\t\tclient[\"messages.list\"]({ sessionId: selectedSessionId }),\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tsession: selectedSession,\n\t\t\t\tmessages: limit !== undefined ? messages.slice(-limit) : messages,\n\t\t\t};\n\t\t}\n\t\tif (group === \"session\" && action === \"transcript\")\n\t\t\treturn await rpc(\n\t\t\t\tclient[\"session.exportTranscript\"]({\n\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\t...(one(args, \"through-message\")\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tuptoMessageId: asMessageId(\n\t\t\t\t\t\t\t\t\trequired(one(args, \"through-message\"), \"--through-message\"),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}),\n\t\t\t\t}),\n\t\t\t);\n\t\tif (group === \"session\" && action === \"plan\")\n\t\t\treturn await rpc(\n\t\t\t\tclient[\"session.latestPlan\"]({ sessionId: selectedSessionId }),\n\t\t\t);\n\t\tif (group === \"session\" && action === \"model\") {\n\t\t\tawait rpc(\n\t\t\t\tclient[\"session.setModel\"]({\n\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\tmodel: required(one(args, \"model\"), \"--model\"),\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tsession: await rpc(\n\t\t\t\t\tclient[\"session.get\"]({ sessionId: selectedSessionId }),\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t\tif (group === \"session\" && action === \"provider\") {\n\t\t\tconst nextProvider = provider(args);\n\t\t\tawait rpc(\n\t\t\t\tclient[\"session.setProvider\"]({\n\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\tproviderId: nextProvider,\n\t\t\t\t\tmodel: model(args, nextProvider),\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tsession: await rpc(\n\t\t\t\t\tclient[\"session.get\"]({ sessionId: selectedSessionId }),\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t\tif (group === \"session\" && action === \"rename\")\n\t\t\treturn {\n\t\t\t\tsession: await rpc(\n\t\t\t\t\tclient[\"session.rename\"]({\n\t\t\t\t\t\tcommandId: commandId(\"session-rename\"),\n\t\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\t\ttitle: required(one(args, \"title\"), \"--title\"),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t};\n\t\tif (group === \"session\" && action === \"archive\") {\n\t\t\tawait rpc(client[\"session.archive\"]({ sessionId: selectedSessionId }));\n\t\t\treturn { sessionId: selectedSessionId, archived: true };\n\t\t}\n\t\tif (group === \"session\" && action === \"unarchive\") {\n\t\t\tawait rpc(client[\"session.unarchive\"]({ sessionId: selectedSessionId }));\n\t\t\treturn { sessionId: selectedSessionId, archived: false };\n\t\t}\n\t\tif (group === \"session\" && action === \"delete\") {\n\t\t\tif (!bool(args, \"confirm\"))\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"confirmation_required\",\n\t\t\t\t\t\"session delete requires --confirm.\",\n\t\t\t\t);\n\t\t\tawait rpc(client[\"session.delete\"]({ sessionId: selectedSessionId }));\n\t\t\treturn { sessionId: selectedSessionId, deleted: true };\n\t\t}\n\t\tif (group === \"session\" && action === \"send\") {\n\t\t\tconst context = await contextFor(\n\t\t\t\tclient,\n\t\t\t\targs,\n\t\t\t\tselectedSessionId,\n\t\t\t\tproject,\n\t\t\t);\n\t\t\tconst text = await promptFor(args, true);\n\t\t\tif (one(args, \"permission\"))\n\t\t\t\tawait rpc(\n\t\t\t\t\tclient[\"session.setPermissionMode\"]({\n\t\t\t\t\t\tcommandId: commandId(\"session-permission-mode\"),\n\t\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\t\tmode: permission(args),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\tif (one(args, \"runtime\"))\n\t\t\t\tawait rpc(\n\t\t\t\t\tclient[\"session.setRuntimeMode\"]({\n\t\t\t\t\t\tcommandId: commandId(\"session-runtime-mode\"),\n\t\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\t\truntimeMode: runtime(args),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\tawait rpc(\n\t\t\t\tclient[\"messages.send\"]({\n\t\t\t\t\tcommandId: commandId(\"message-send\"),\n\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\tinput: composer(text, context),\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tsession: await rpc(\n\t\t\t\t\tclient[\"session.get\"]({ sessionId: selectedSessionId }),\n\t\t\t\t),\n\t\t\t\twarnings: context.warnings,\n\t\t\t};\n\t\t}\n\t\tif (group === \"session\" && action === \"plan-respond\") {\n\t\t\tconst outcome = required(one(args, \"outcome\"), \"--outcome\");\n\t\t\tif (![\"approved\", \"cancelled\", \"abandoned\"].includes(outcome))\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"invalid_input\",\n\t\t\t\t\t\"--outcome must be approved, cancelled, or abandoned.\",\n\t\t\t\t);\n\t\t\tawait rpc(\n\t\t\t\tclient[\"session.plan.respond\"]({\n\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\ttoolCallId: required(one(args, \"tool-call\"), \"--tool-call\"),\n\t\t\t\t\toutcome: outcome as \"approved\" | \"cancelled\" | \"abandoned\",\n\t\t\t\t\t...(one(args, \"feedback\") ? { feedback: one(args, \"feedback\") } : {}),\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn { sessionId: selectedSessionId, outcome };\n\t\t}\n\t\tif (group === \"session\" && action === \"answer\") {\n\t\t\tconst answers = jsonObject(one(args, \"answers-json\"), \"--answers-json\");\n\t\t\tif (!Array.isArray(answers))\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"invalid_input\",\n\t\t\t\t\t\"--answers-json must contain an array.\",\n\t\t\t\t);\n\t\t\tawait rpc(\n\t\t\t\tclient[\"session.answerQuestion\"]({\n\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\titemId: required(one(args, \"item\"), \"--item\"),\n\t\t\t\t\tanswers: answers as Array<{\n\t\t\t\t\t\tquestionIndex: number;\n\t\t\t\t\t\tselected: number[];\n\t\t\t\t\t\tother?: string;\n\t\t\t\t\t}>,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn { sessionId: selectedSessionId, answered: true };\n\t\t}\n\t\tif (group === \"session\" && action === \"queue-list\")\n\t\t\treturn await rpc(\n\t\t\t\tclient[\"messages.queue.list\"]({ sessionId: selectedSessionId }),\n\t\t\t);\n\t\tif (\n\t\t\tgroup === \"session\" &&\n\t\t\t(action === \"queue-add\" || action === \"queue-update\")\n\t\t) {\n\t\t\tconst context = await contextFor(\n\t\t\t\tclient,\n\t\t\t\targs,\n\t\t\t\tselectedSessionId,\n\t\t\t\tproject,\n\t\t\t);\n\t\t\tconst input = composer(await promptFor(args, true), context);\n\t\t\tif (action === \"queue-add\")\n\t\t\t\treturn {\n\t\t\t\t\titem: await rpc(\n\t\t\t\t\t\tclient[\"messages.queue.add\"]({\n\t\t\t\t\t\t\tcommandId: commandId(\"queue-add\"),\n\t\t\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t...(one(args, \"queue\") ? { queueId: one(args, \"queue\") } : {}),\n\t\t\t\t\t\t\tready: !bool(args, \"draft\"),\n\t\t\t\t\t\t\tflush: !bool(args, \"no-flush\"),\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\twarnings: context.warnings,\n\t\t\t\t};\n\t\t\treturn {\n\t\t\t\titem: await rpc(\n\t\t\t\t\tclient[\"messages.queue.update\"]({\n\t\t\t\t\t\tcommandId: commandId(\"queue-update\"),\n\t\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\t\tqueueId: required(one(args, \"queue\"), \"--queue\"),\n\t\t\t\t\t\tinput,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t\twarnings: context.warnings,\n\t\t\t};\n\t\t}\n\t\tif (group === \"session\" && action === \"queue-delete\") {\n\t\t\tconst queueId = required(one(args, \"queue\"), \"--queue\");\n\t\t\tawait rpc(\n\t\t\t\tclient[\"messages.queue.delete\"]({\n\t\t\t\t\tcommandId: commandId(\"queue-delete\"),\n\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\tqueueId,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn { sessionId: selectedSessionId, queueId, deleted: true };\n\t\t}\n\t\tif (group === \"session\" && action === \"queue-reorder\")\n\t\t\treturn {\n\t\t\t\titems: await rpc(\n\t\t\t\t\tclient[\"messages.queue.reorder\"]({\n\t\t\t\t\t\tcommandId: commandId(\"queue-reorder\"),\n\t\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\t\tqueueIds: many(args, \"queue\"),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t};\n\t\tif (group === \"session\" && action === \"queue-run-next\") {\n\t\t\tconst queueId = required(one(args, \"queue\"), \"--queue\");\n\t\t\tawait rpc(\n\t\t\t\tclient[\"messages.queue.runNext\"]({\n\t\t\t\t\tcommandId: commandId(\"queue-run-next\"),\n\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\tqueueId,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn { sessionId: selectedSessionId, queueId, started: true };\n\t\t}\n\t\tif (group === \"session\" && action === \"queue-flush\") {\n\t\t\tawait rpc(\n\t\t\t\tclient[\"messages.queue.flush\"]({\n\t\t\t\t\tcommandId: commandId(\"queue-flush\"),\n\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn { sessionId: selectedSessionId, flushed: true };\n\t\t}\n\t\tif (group === \"session\" && action === \"queue-resume\") {\n\t\t\tawait rpc(\n\t\t\t\tclient[\"messages.queue.resume\"]({\n\t\t\t\t\tcommandId: commandId(\"queue-resume\"),\n\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn { sessionId: selectedSessionId, resumed: true };\n\t\t}\n\t\tif (group === \"session\" && action === \"mode\") {\n\t\t\tif (!one(args, \"permission\") && !one(args, \"runtime\"))\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"invalid_input\",\n\t\t\t\t\t\"session mode requires --permission or --runtime.\",\n\t\t\t\t);\n\t\t\tif (one(args, \"permission\"))\n\t\t\t\tawait rpc(\n\t\t\t\t\tclient[\"session.setPermissionMode\"]({\n\t\t\t\t\t\tcommandId: commandId(\"session-permission-mode\"),\n\t\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\t\tmode: permission(args),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\tif (one(args, \"runtime\"))\n\t\t\t\tawait rpc(\n\t\t\t\t\tclient[\"session.setRuntimeMode\"]({\n\t\t\t\t\t\tcommandId: commandId(\"session-runtime-mode\"),\n\t\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t\t\truntimeMode: runtime(args),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\treturn {\n\t\t\t\tsession: await rpc(\n\t\t\t\t\tclient[\"session.get\"]({ sessionId: selectedSessionId }),\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t\tif (group === \"session\" && action === \"interrupt\") {\n\t\t\tawait rpc(\n\t\t\t\tclient[\"messages.interrupt\"]({\n\t\t\t\t\tcommandId: commandId(\"message-interrupt\"),\n\t\t\t\t\tsessionId: selectedSessionId,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn { sessionId: selectedSessionId, interrupted: true };\n\t\t}\n\t\tif (group === \"session\" && action === \"resume\")\n\t\t\treturn {\n\t\t\t\tsession: await rpc(\n\t\t\t\t\tclient[\"session.resume\"]({ sessionId: selectedSessionId }),\n\t\t\t\t),\n\t\t\t};\n\t\tthrow new CliError(\n\t\t\t\"invalid_input\",\n\t\t\t`Unknown command: ${args.positionals.join(\" \")}.`,\n\t\t);\n\t} finally {\n\t\tawait session.dispose();\n\t}\n};\n\nexport const runAgentCli = async (\n\targv: ReadonlyArray<string>,\n\tenv: NodeJS.ProcessEnv = process.env,\n): Promise<void> => {\n\ttry {\n\t\tsuccess(await execute(await expandInputJson(argv), env));\n\t} catch (cause) {\n\t\tfailure(cause);\n\t}\n};\n\nexport const __testing = {\n\tparse,\n\texecute,\n\tcommandManifest,\n\texpandInputJson,\n\tlocalCliAccess,\n\tendpoint,\n};\n","import packageMetadata from \"../package.json\" with { type: \"json\" };\nimport { isAgentCliCommand, runAgentCli } from \"./agent-cli.ts\";\nimport type { ServeCli } from \"./cli-types.ts\";\n\nexport const runServeCli: ServeCli = async (\n\targv,\n\tenv = process.env,\n): Promise<void> => {\n\tif (isAgentCliCommand(argv)) return runAgentCli(argv, env);\n\tconst { runServePackageCli } = await import(\"@zusehq/server/serve-cli\");\n\treturn runServePackageCli(argv, env, {\n\t\tpackageVersion: packageMetadata.version,\n\t});\n};\n"],"mappings":";;;;;;;;;;;ACoBA,IAAa,4BAAb,cAA+C,KAAK,YACnD,2BACD,CAAC,CAGE,CAAC;AAUJ,MAAa,2BACZ,iBACA,oBAEA,oBAAoB,kBACjB,OAAO,OACP,OAAO,KACP,IAAI,0BAA0B;CAC7B;CACA;AACD,CAAC,CACF;AAEH,MAAa,2BACZ,KACA,oBACY;CACZ,MAAM,SAAS,IAAI,IAAI,GAAG;CAC1B,OAAO,aAAa,IAAI,eAAe,OAAO,eAAe,CAAC;CAC9D,OAAO,OAAO,SAAS;AACxB;;;;;AAMA,MAAa,2BAA2B,OAMvC,OACA,eAGoC;CACpC,MAAM,UAAU,eAAe,KAAK,KAAK;CACzC,IAAI;EAEH,OAAO;GAAE,QAAA,MADY,QAAQ,WAAW,WAAW,QAAQ,KAAK,CAAC;GAChD,eAAe,QAAQ,QAAQ;EAAE;CACnD,SAAS,OAAO;EACf,MAAM,QAAQ,QAAQ;EACtB,MAAM;CACP;AACD;;AAGA,MAAa,wBAKZ,OAIA,OACA,cAKA,yBAAyB,QAAQ,UAChC,OAAO,IAAI,aAAa;CACvB,MAAM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,yBACA,gCACA,+BACA,mBACA,iBACA,gBACA,mBACA,mBACA,oBACA,oBACA,qBACA,0BACA,yBACA,sBACA,uBACA,yBACA,gCACA,gCACA,yBACA,yBACA,yBACA,0BACA,sBACA,wBACA,6BACA,4BACA,+BACA,sCACA,wCACA,wBACA,4BACA,sBACA,4BACA,iBACA,sBACA,iBACA,6BACA,kBACA,oBACA,wBACA,yBACA,yBACA,2BACA,yBACA,uBACA,2BACA,6BACA,0BACA,wBACA,4BACA,YACA,aACA,cACA,aACA,cACA,WACA,cACA,gBACA,oBACA,gBACA,wBACA,cACA,eACA,iBACA,eACA,kBACA,qBACA,eACA,qBACA,qBACA,0BACA,sBACA,YACA,cACA,2BACA,YACA,uBACA,eACA,iBACA,YACA,wBACA,kBACA,yBACA,iBACA,WACA,gBACA,gBACA,WACA,eACA,gBACA,iBACA,sBACA,aACA,uBACA,wBACA,yBACA,6BACA,0BACA,8BACA,0BACA,4BACA,+BACA,8BACA,iCACA,uBACA,mBACA,uBACA,YACA,eACA,kBACA,oBACA,aACA,YACA,eACA,qBACA,uBACA,wBACA,eACA,iBACA,sBACA,oBACA,yBACA,gBACA,sBACA,oBACA,wBACA,kBACA,eACA,gBACA,yBACA,qBACA,eACA,kBACA,kBACA,mBACA,mBACA,qBACA,sBACA,oBACA,uBACA,mBACA,qBACA,kBACA,sBACA,kBACA,wBACA,gBACA,4BACA,sBACA,kBACA,0BACA,6BACA,0BACA,uBACA,uBACA,iBACA,iBACA,sBACA,sBACA,qBACA,wBACA,wBACA,yBACA,yBACA,uBACA,wBACA,qBACA,oBACA,cACA,wBACA,gBACA,uBACA,qBACA,0BACA,4BACA,6BACA,mBACA,8BACA,oBACA,mBACA,yBACA,2BACA,4BACA,mBACA,iBACA,gBACA,yBACA,uBACA,wBACA,qBACA,mBACA,0BACA,6BACA,gBACA,mBACA,mBACA,gCACA,gBACA,kBACA,kBACA,gBACA,uBACA,sBACA,wBACA,sBACA,yBACA,sBACA,sBACA,uBACA,mBACA,uB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