@di-code/coding-agent 0.1.8 → 0.2.1
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.
- package/README.md +55 -624
- package/compositions/base.yml +3 -0
- package/dist/compositions.d.ts.map +1 -1
- package/dist/compositions.js +2 -0
- package/dist/compositions.js.map +1 -1
- package/dist/core/image-input.d.ts +1 -1
- package/dist/core/image-input.d.ts.map +1 -1
- package/dist/core/image-input.js +15 -4
- package/dist/core/image-input.js.map +1 -1
- package/dist/core/session/session-storage.d.ts.map +1 -1
- package/dist/core/session/session-storage.js +12 -1
- package/dist/core/session/session-storage.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +5 -1
- package/dist/main.js.map +1 -1
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +19 -0
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp-command-entry.d.ts +8 -0
- package/dist/mcp-command-entry.d.ts.map +1 -0
- package/dist/mcp-command-entry.js +56 -0
- package/dist/mcp-command-entry.js.map +1 -0
- package/dist/modes/interactive-state.d.ts.map +1 -1
- package/dist/modes/interactive-state.js +1 -4
- package/dist/modes/interactive-state.js.map +1 -1
- package/dist/modes/tree-selector.d.ts.map +1 -1
- package/dist/modes/tree-selector.js +1 -4
- package/dist/modes/tree-selector.js.map +1 -1
- package/dist/rpc/protocol.d.ts.map +1 -1
- package/dist/rpc/protocol.js +22 -0
- package/dist/rpc/protocol.js.map +1 -1
- package/dist/runtime/session-factory.d.ts.map +1 -1
- package/dist/runtime/session-factory.js +2 -1
- package/dist/runtime/session-factory.js.map +1 -1
- package/dist/web/assets/index-C-NyCPxd.css +1 -0
- package/dist/web/assets/{index-DPUaJqFJ.js → index-DgyxuNNG.js} +3 -3
- package/dist/web/assets/index-DgyxuNNG.js.map +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +9 -9
- package/dist/web/assets/index-BwfuGMvv.css +0 -1
- package/dist/web/assets/index-DPUaJqFJ.js.map +0 -1
package/dist/rpc/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/rpc/protocol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAU,CAAC;AAC/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AACrC,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAC/C,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACxD,kHAAkH;AAClH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACxD,MAAM,gCAAgC,GAAG,IAAI,CAAC,IAAI,CAAC,wBAAwB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AAErF,kGAAkG;AAClG,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,kBAAkB;IAClB,eAAe;IACf,eAAe;IACf,aAAa;IACb,cAAc;IACd,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,UAAU;IACV,eAAe;IACf,OAAO;IACP,OAAO;IACP,eAAe;IACf,YAAY;IACZ,WAAW;IACX,aAAa;IACb,aAAa;IACb,oBAAoB;IACpB,SAAS;IACT,wBAAwB;IACxB,WAAW;IACX,aAAa;IACb,eAAe;IACf,mBAAmB;IACnB,gBAAgB;IAChB,cAAc;IACd,sBAAsB;IACtB,mBAAmB;IACnB,YAAY;IACZ,qBAAqB;IACrB,2BAA2B;IAC3B,OAAO;IACP,QAAQ;IACR,mBAAmB;IACnB,mBAAmB;IACnB,oBAAoB;IACpB,kB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AAO,CAAC,QAAQ,KAAK,QAAQ;QACpC,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;QACjC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC;QACnC,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ;QACtC,CAAC,sBAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC;QAE/C,MAAM,IAAI,gBAAgB,CAAC,iBAAiB,EAAE,6CAA6C,CAAC,CAAC;AAC/F,CAAC;AACD,MAAM,UAAU,gBAAgB,CAAC,KAAuB;IACvD,OAAO;QACN,OAAO,EAAE,oBAAoB;QAC7B,IAAI,EAAE,UAAU;QAChB,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;QACjE,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;KACnD,CAAC;AACH,CAAC","sourcesContent":["import type { AssistantMessage } from \"@di-code/ai\";\nimport { validateWebManifest } from \"@di-code/plugin-runtime\";\nimport type { AgentSessionEvent } from \"../core/session.ts\";\n\nexport const RPC_PROTOCOL_VERSION = 1 as const;\nexport const RPC_MAX_ID_LENGTH = 128;\nexport const RPC_MAX_PROMPT_LENGTH = 1_000_000;\nexport const RPC_MAX_ATTACHMENTS_PER_REQUEST = 4;\nexport const RPC_MAX_ATTACHMENT_BYTES = 5 * 1024 * 1024;\n/** Allows one JSONL user entry containing a maximum-sized base64 image to be read in a single transcript page. */\nexport const RPC_MAX_TRANSCRIPT_BYTES = 8 * 1024 * 1024;\nconst RPC_MAX_ATTACHMENT_BASE64_LENGTH = Math.ceil(RPC_MAX_ATTACHMENT_BYTES / 3) * 4;\n\n/** v1 grows only by methods and optional fields. Clients must negotiate extended events first. */\nexport const RPC_METHODS = [\n\t\"prompt\",\n\t\"cancel\",\n\t\"get_state\",\n\t\"get_capabilities\",\n\t\"resume_events\",\n\t\"list_sessions\",\n\t\"new_session\",\n\t\"open_session\",\n\t\"inspect_session\",\n\t\"rename_session\",\n\t\"delete_session\",\n\t\"branch_session\",\n\t\"get_transcript\",\n\t\"get_tree\",\n\t\"navigate_tree\",\n\t\"steer\",\n\t\"retry\",\n\t\"get_operation\",\n\t\"get_models\",\n\t\"set_model\",\n\t\"get_runtime\",\n\t\"set_runtime\",\n\t\"set_thinking_level\",\n\t\"compact\",\n\t\"set_compaction_enabled\",\n\t\"get_usage\",\n\t\"list_skills\",\n\t\"get_resources\",\n\t\"get_product_state\",\n\t\"list_providers\",\n\t\"get_settings\",\n\t\"set_default_provider\",\n\t\"set_default_model\",\n\t\"set_locale\",\n\t\"set_permission_mode\",\n\t\"configure_custom_provider\",\n\t\"login\",\n\t\"logout\",\n\t\"get_project_trust\",\n\t\"set_project_trust\",\n\t\"list_context_files\",\n\t\"list_mcp_servers\",\n\t\"configure_mcp_server\",\n\t\"remove_mcp_server\",\n\t\"reconnect_mcp_server\",\n\t\"list_plugins\",\n\t\"list_web_contributions\",\n\t\"list_commands\",\n\t\"run_command\",\n\t\"set_plugin_enabled\",\n\t\"create_attachment\",\n\t\"approve_tool\",\n] as const;\nexport type RpcMethod = (typeof RPC_METHODS)[number];\n\nexport interface RpcRequest {\n\treadonly version: typeof RPC_PROTOCOL_VERSION;\n\treadonly kind: \"request\";\n\treadonly id: string;\n\treadonly method: RpcMethod;\n\treadonly params: Record<string, unknown>;\n}\n\nexport interface RpcSessionState {\n\treadonly sessionId: string;\n\treadonly modelId: string;\n\treadonly isStreaming: boolean;\n\treadonly messageCount: number;\n\treadonly sequence?: number;\n}\n\n/** Metadata for an opaque attachment handle kept only by its live RPC actor. */\nexport interface RpcAttachmentInfo {\n\treadonly id: string;\n\treadonly name: string;\n\treadonly contentType: \"image/png\" | \"image/jpeg\" | \"image/webp\" | \"image/gif\";\n\treadonly bytes: number;\n}\n\nexport interface RpcCapabilities {\n\treadonly methods: readonly RpcMethod[];\n\treadonly events: readonly RpcExtendedEventName[];\n\treadonly eventBufferSize: number;\n}\n\nexport type RpcExtendedEventName =\n\t| \"sequence\"\n\t| \"operation_update\"\n\t| \"snapshot_required\"\n\t| \"session_changed\"\n\t| \"tool_approval\"\n\t| \"product_audit\";\n\nexport interface RpcProductState {\n\treadonly projectTrusted: boolean;\n}\n\nexport interface RpcProviderSummary {\n\treadonly id: string;\n\treadonly name: string;\n\treadonly models: readonly {\n\t\treadonly id: string;\n\t\treadonly name: string;\n\t\treadonly input: readonly string[];\n\t\t/** Omitted when the model does not expose selectable reasoning levels. */\n\t\treadonly reasoningEfforts?: readonly (\"low\" | \"medium\" | \"high\" | \"max\")[];\n\t}[];\n\treadonly configured: boolean;\n}\n\nexport interface RpcSettingsSnapshot {\n\treadonly providers: readonly (RpcProviderSummary & {\n\t\treadonly api: string;\n\t\treadonly baseUrl?: string;\n\t\treadonly apiKeySource: \"environment\" | \"settings\" | \"missing\";\n\t})[];\n\treadonly defaults: { readonly providerId?: string; readonly modelId?: string };\n\treadonly runtime: { readonly providerId: string; readonly modelId: string; readonly thinkingLevel?: string };\n\treadonly locale?: \"en\" | \"zh-CN\";\n\treadonly permissionMode: \"ask\" | \"allow\" | \"deny\";\n\treadonly sources: Readonly<Record<string, \"environment\" | \"settings\" | \"default\" | \"runtime\">>;\n}\n\nexport interface RpcContextFileInfo {\n\treadonly path: string;\n\treadonly scope: string;\n\treadonly bytes: number;\n}\n\n/** A user-invocable command projected from the active composition or Skill catalog. */\nexport interface RpcCommandInfo {\n\treadonly name: string;\n\treadonly description: string;\n\treadonly kind: \"command\" | \"skill\";\n}\n\n/** A WebUI operation requested by a registered command. */\nexport interface RpcCommandAction {\n\treadonly command: string;\n\treadonly args: string;\n}\n\nexport interface RpcMcpServerInfo {\n\treadonly id: string;\n\treadonly scope?: string;\n\treadonly state: \"configured\" | \"connected\" | \"failed\" | \"disconnected\";\n\treadonly tools: number;\n\treadonly resources: number;\n\treadonly prompts: number;\n\treadonly diagnostic?: string;\n}\n\nexport type OperationStatus = \"queued\" | \"running\" | \"completed\" | \"failed\" | \"cancelled\" | \"crashed\";\nexport interface OperationState {\n\treadonly requestId: string;\n\treadonly kind: RpcMethod;\n\treadonly status: OperationStatus;\n\treadonly sessionId?: string;\n\treadonly message?: AssistantMessage;\n\treadonly error?: { readonly code: RpcErrorCode; readonly message: string };\n}\n\n/** Method-specific result fields are validated at the wire boundary. */\nexport type RpcSuccessResult = { readonly method: RpcMethod; readonly [key: string]: unknown };\n\nexport type RpcErrorCode =\n\t| \"PARSE_ERROR\"\n\t| \"INVALID_REQUEST\"\n\t| \"UNSUPPORTED_VERSION\"\n\t| \"METHOD_NOT_FOUND\"\n\t| \"INVALID_PARAMS\"\n\t| \"BUSY\"\n\t| \"NOT_FOUND\"\n\t| \"CANCELLED\"\n\t| \"DISPOSED\"\n\t| \"SESSION_IN_USE\"\n\t| \"INVALID_WORKSPACE\"\n\t| \"UNAUTHORIZED\"\n\t| \"INTERNAL_ERROR\"\n\t| \"PROCESS_EXIT\";\n\nconst RPC_ERROR_CODES: ReadonlySet<RpcErrorCode> = new Set([\n\t\"PARSE_ERROR\",\n\t\"INVALID_REQUEST\",\n\t\"UNSUPPORTED_VERSION\",\n\t\"METHOD_NOT_FOUND\",\n\t\"INVALID_PARAMS\",\n\t\"BUSY\",\n\t\"NOT_FOUND\",\n\t\"CANCELLED\",\n\t\"DISPOSED\",\n\t\"SESSION_IN_USE\",\n\t\"INVALID_WORKSPACE\",\n\t\"UNAUTHORIZED\",\n\t\"INTERNAL_ERROR\",\n\t\"PROCESS_EXIT\",\n]);\nconst LEGACY_EVENT_TYPES: ReadonlySet<AgentSessionEvent[\"type\"]> = new Set([\n\t\"agent_start\",\n\t\"turn_start\",\n\t\"message_start\",\n\t\"message_update\",\n\t\"message_end\",\n\t\"turn_end\",\n\t\"tool_execution_start\",\n\t\"tool_execution_end\",\n\t\"agent_end\",\n\t\"compaction_start\",\n\t\"compaction_end\",\n\t\"queue_update\",\n\t\"tree_navigated\",\n\t\"usage_update\",\n]);\nconst EXTENDED_EVENT_TYPES = new Set([\n\t\"snapshot_required\",\n\t\"operation_update\",\n\t\"session_changed\",\n\t\"tool_approval\",\n\t\"product_audit\",\n]);\nconst EXTENDED_EVENT_NAMES: ReadonlySet<RpcExtendedEventName> = new Set([\n\t\"sequence\",\n\t\"operation_update\",\n\t\"snapshot_required\",\n\t\"session_changed\",\n\t\"tool_approval\",\n\t\"product_audit\",\n]);\nconst ASSISTANT_STOP_REASONS = new Set([\"stop\", \"length\", \"tool_use\", \"error\", \"aborted\"]);\n\nexport interface RpcSuccessResponse {\n\treadonly version: typeof RPC_PROTOCOL_VERSION;\n\treadonly kind: \"response\";\n\treadonly id: string;\n\treadonly ok: true;\n\treadonly result: RpcSuccessResult;\n}\nexport interface RpcErrorResponse {\n\treadonly version: typeof RPC_PROTOCOL_VERSION;\n\treadonly kind: \"response\";\n\treadonly id?: string;\n\treadonly ok: false;\n\treadonly error: { readonly code: RpcErrorCode; readonly message: string };\n}\nexport interface RpcEventRecord {\n\treadonly version: typeof RPC_PROTOCOL_VERSION;\n\treadonly kind: \"event\";\n\treadonly requestId: string;\n\treadonly event:\n\t\t| AgentSessionEvent\n\t\t| {\n\t\t\t\treadonly type: \"product_audit\";\n\t\t\t\treadonly action:\n\t\t\t\t\t| \"login\"\n\t\t\t\t\t| \"logout\"\n\t\t\t\t\t| \"set_project_trust\"\n\t\t\t\t\t| \"configure_mcp_server\"\n\t\t\t\t\t| \"remove_mcp_server\"\n\t\t\t\t\t| \"reconnect_mcp_server\";\n\t\t\t\treadonly target?: string;\n\t\t\t\treadonly projectTrusted?: boolean;\n\t\t }\n\t\t| {\n\t\t\t\treadonly type: \"snapshot_required\" | \"operation_update\" | \"session_changed\" | \"tool_approval\";\n\t\t\t\treadonly [key: string]: unknown;\n\t\t };\n\treadonly sessionId?: string;\n\treadonly sequence?: number;\n}\nexport type RpcResponse = RpcSuccessResponse | RpcErrorResponse;\nexport type RpcServerMessage = RpcResponse | RpcEventRecord;\n\nexport class RpcProtocolError extends Error {\n\treadonly code: RpcErrorCode;\n\treadonly requestId?: string;\n\n\tconstructor(code: RpcErrorCode, message: string, requestId?: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RpcProtocolError\";\n\t\tthis.code = code;\n\t\tthis.requestId = requestId;\n\t}\n}\n\nfunction objectRecord(value: unknown): Record<string, unknown> | undefined {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value)\n\t\t? (value as Record<string, unknown>)\n\t\t: undefined;\n}\nfunction requiredId(value: unknown, field: string, requestId?: string): string {\n\tif (typeof value !== \"string\" || value.length === 0 || value.length > RPC_MAX_ID_LENGTH)\n\t\tthrow new RpcProtocolError(\n\t\t\t\"INVALID_REQUEST\",\n\t\t\t`${field} must be a non-empty string of at most ${RPC_MAX_ID_LENGTH} characters.`,\n\t\t\trequestId,\n\t\t);\n\treturn value;\n}\nfunction parseJsonObject(line: string): Record<string, unknown> {\n\ttry {\n\t\tconst result = objectRecord(JSON.parse(line));\n\t\tif (!result) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC input must be a JSON object.\");\n\t\treturn result;\n\t} catch (cause) {\n\t\tif (cause instanceof RpcProtocolError) throw cause;\n\t\tthrow new RpcProtocolError(\"PARSE_ERROR\", \"RPC input must be valid JSON.\");\n\t}\n}\nfunction assertVersion(record: Record<string, unknown>, requestId?: string): void {\n\tif (record.version !== RPC_PROTOCOL_VERSION)\n\t\tthrow new RpcProtocolError(\n\t\t\t\"UNSUPPORTED_VERSION\",\n\t\t\t`Unsupported RPC protocol version; expected ${RPC_PROTOCOL_VERSION}.`,\n\t\t\trequestId,\n\t\t);\n}\nfunction stringParam(params: Record<string, unknown>, name: string, id: string, optional = false): void {\n\tconst value = params[name];\n\tif (optional && value === undefined) return;\n\tif (typeof value !== \"string\" || value.length === 0 || value.length > RPC_MAX_PROMPT_LENGTH)\n\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", `${name} must be a non-empty string.`, id);\n}\nfunction booleanParam(params: Record<string, unknown>, name: string, id: string): void {\n\tif (typeof params[name] !== \"boolean\") throw new RpcProtocolError(\"INVALID_PARAMS\", `${name} must be a boolean.`, id);\n}\nfunction attachmentIdsParam(params: Record<string, unknown>, id: string): void {\n\tif (params.attachmentIds === undefined) return;\n\tif (\n\t\t!Array.isArray(params.attachmentIds) ||\n\t\tparams.attachmentIds.length > RPC_MAX_ATTACHMENTS_PER_REQUEST ||\n\t\t!params.attachmentIds.every(\n\t\t\t(value) => typeof value === \"string\" && value.length > 0 && value.length <= RPC_MAX_ID_LENGTH,\n\t\t)\n\t)\n\t\tthrow new RpcProtocolError(\n\t\t\t\"INVALID_PARAMS\",\n\t\t\t`attachmentIds must contain at most ${RPC_MAX_ATTACHMENTS_PER_REQUEST} attachment IDs.`,\n\t\t\tid,\n\t\t);\n}\nfunction attachmentDataParam(params: Record<string, unknown>, id: string): void {\n\tconst data = params.data;\n\tif (typeof data !== \"string\" || data.length === 0 || data.length > RPC_MAX_ATTACHMENT_BASE64_LENGTH)\n\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"Attachment data exceeds the permitted size.\", id);\n}\n\n/** Parses every public v1 method before any dispatcher or transport observes it. */\nexport function parseRpcRequest(line: string): RpcRequest {\n\tconst record = parseJsonObject(line);\n\tconst candidateId = typeof record.id === \"string\" ? record.id : undefined;\n\tassertVersion(record, candidateId);\n\tif (record.kind !== \"request\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", 'RPC request kind must be \"request\".', candidateId);\n\tconst id = requiredId(record.id, \"id\", candidateId);\n\tconst params = objectRecord(record.params);\n\tif (!params) throw new RpcProtocolError(\"INVALID_PARAMS\", \"RPC params must be an object.\", id);\n\tif (typeof record.method !== \"string\" || !RPC_METHODS.includes(record.method as RpcMethod))\n\t\tthrow new RpcProtocolError(\"METHOD_NOT_FOUND\", \"Unknown RPC method.\", id);\n\tconst method = record.method as RpcMethod;\n\tswitch (method) {\n\t\tcase \"prompt\":\n\t\tcase \"steer\":\n\t\t\tstringParam(params, \"message\", id);\n\t\t\tattachmentIdsParam(params, id);\n\t\t\tbreak;\n\t\tcase \"cancel\":\n\t\tcase \"get_operation\":\n\t\tcase \"open_session\":\n\t\tcase \"inspect_session\":\n\t\tcase \"rename_session\":\n\t\tcase \"delete_session\":\n\t\tcase \"navigate_tree\":\n\t\tcase \"set_model\":\n\t\tcase \"logout\":\n\t\tcase \"reconnect_mcp_server\":\n\t\t\tstringParam(\n\t\t\t\tparams,\n\t\t\t\tmethod === \"cancel\" || method === \"get_operation\"\n\t\t\t\t\t? \"requestId\"\n\t\t\t\t\t: method === \"open_session\"\n\t\t\t\t\t\t? \"sessionId\"\n\t\t\t\t\t\t: method === \"inspect_session\" || method === \"rename_session\" || method === \"delete_session\"\n\t\t\t\t\t\t\t? \"sessionId\"\n\t\t\t\t\t\t\t: method === \"navigate_tree\"\n\t\t\t\t\t\t\t\t? \"entryId\"\n\t\t\t\t\t\t\t\t: method === \"set_model\"\n\t\t\t\t\t\t\t\t\t? \"modelId\"\n\t\t\t\t\t\t\t\t\t: method === \"logout\"\n\t\t\t\t\t\t\t\t\t\t? \"providerId\"\n\t\t\t\t\t\t\t\t\t\t: \"serverId\",\n\t\t\t\tid,\n\t\t\t);\n\t\t\tif (method === \"rename_session\") stringParam(params, \"label\", id);\n\t\t\tif (method === \"delete_session\") stringParam(params, \"confirmation\", id);\n\t\t\tbreak;\n\t\tcase \"branch_session\":\n\t\t\tif (params.sessionId !== undefined) stringParam(params, \"sessionId\", id, true);\n\t\t\tif (params.entryId !== undefined) stringParam(params, \"entryId\", id, true);\n\t\t\tbreak;\n\t\tcase \"set_runtime\":\n\t\t\tstringParam(params, \"providerId\", id);\n\t\t\tstringParam(params, \"modelId\", id);\n\t\t\tbreak;\n\t\tcase \"run_command\":\n\t\t\tstringParam(params, \"name\", id);\n\t\t\tif (!/^[a-z][a-z0-9-]*(?::[a-z][a-z0-9-]*)?$/.test(params.name as string))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"run_command.name is invalid.\", id);\n\t\t\tif (params.args !== undefined && (typeof params.args !== \"string\" || params.args.length > RPC_MAX_PROMPT_LENGTH))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"args must be a string of at most 1,000,000 characters.\", id);\n\t\t\tbreak;\n\t\tcase \"set_default_provider\":\n\t\tcase \"set_default_model\":\n\t\tcase \"set_locale\":\n\t\tcase \"set_permission_mode\":\n\t\t\tstringParam(\n\t\t\t\tparams,\n\t\t\t\tmethod === \"set_default_provider\"\n\t\t\t\t\t? \"providerId\"\n\t\t\t\t\t: method === \"set_default_model\"\n\t\t\t\t\t\t? \"modelId\"\n\t\t\t\t\t\t: method === \"set_locale\"\n\t\t\t\t\t\t\t? \"locale\"\n\t\t\t\t\t\t\t: \"permissionMode\",\n\t\t\t\tid,\n\t\t\t);\n\t\t\tif (method === \"set_locale\" && params.locale !== \"en\" && params.locale !== \"zh-CN\")\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"locale must be en or zh-CN.\", id);\n\t\t\tif (\n\t\t\t\tmethod === \"set_permission_mode\" &&\n\t\t\t\tparams.permissionMode !== \"ask\" &&\n\t\t\t\tparams.permissionMode !== \"allow\" &&\n\t\t\t\tparams.permissionMode !== \"deny\"\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"permissionMode must be ask, allow, or deny.\", id);\n\t\t\tbreak;\n\t\tcase \"configure_custom_provider\":\n\t\t\tfor (const name of [\"api\", \"baseUrl\", \"apiKey\", \"modelId\"]) stringParam(params, name, id);\n\t\t\tif (![\"openai-responses\", \"openai-chat-completions\", \"anthropic-messages\"].includes(params.api as string))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"Unsupported custom Provider API.\", id);\n\t\t\tbreak;\n\t\tcase \"set_thinking_level\":\n\t\t\tif (\n\t\t\t\tparams.level !== undefined &&\n\t\t\t\tparams.level !== \"low\" &&\n\t\t\t\tparams.level !== \"medium\" &&\n\t\t\t\tparams.level !== \"high\" &&\n\t\t\t\tparams.level !== \"max\"\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"set_thinking_level.level must be a valid thinking level.\", id);\n\t\t\tbreak;\n\t\tcase \"retry\":\n\t\t\tstringParam(params, \"targetRequestId\", id);\n\t\t\tbreak;\n\t\tcase \"login\":\n\t\t\tstringParam(params, \"providerId\", id);\n\t\t\tstringParam(params, \"apiKey\", id);\n\t\t\tif (params.modelId !== undefined) stringParam(params, \"modelId\", id, true);\n\t\t\tif (params.api !== undefined) stringParam(params, \"api\", id, true);\n\t\t\tbreak;\n\t\tcase \"configure_mcp_server\":\n\t\t\tstringParam(params, \"serverId\", id);\n\t\t\tstringParam(params, \"scope\", id);\n\t\t\tif (!objectRecord(params.config)) throw new RpcProtocolError(\"INVALID_PARAMS\", \"config must be an object.\", id);\n\t\t\tbreak;\n\t\tcase \"remove_mcp_server\":\n\t\t\tstringParam(params, \"serverId\", id);\n\t\t\tif (params.scope !== undefined) stringParam(params, \"scope\", id, true);\n\t\t\tbreak;\n\t\tcase \"set_plugin_enabled\":\n\t\t\tstringParam(params, \"pluginId\", id);\n\t\t\tbooleanParam(params, \"enabled\", id);\n\t\t\tbreak;\n\t\tcase \"set_compaction_enabled\":\n\t\tcase \"set_project_trust\":\n\t\t\tbooleanParam(params, method === \"set_compaction_enabled\" ? \"enabled\" : \"trusted\", id);\n\t\t\tbreak;\n\t\tcase \"get_capabilities\":\n\t\t\tif (\n\t\t\t\tparams.events !== undefined &&\n\t\t\t\t(!Array.isArray(params.events) || !params.events.every((item) => typeof item === \"string\"))\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"get_capabilities.events must be a string array.\", id);\n\t\t\tbreak;\n\t\tcase \"resume_events\":\n\t\t\tif (\n\t\t\t\tparams.lastSequence !== undefined &&\n\t\t\t\t(!Number.isSafeInteger(params.lastSequence) || (params.lastSequence as number) < 0)\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"resume_events.lastSequence must be a non-negative integer.\", id);\n\t\t\tbreak;\n\t\tcase \"create_attachment\":\n\t\t\tstringParam(params, \"name\", id);\n\t\t\tstringParam(params, \"contentType\", id);\n\t\t\tattachmentDataParam(params, id);\n\t\t\tif (![\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"].includes(params.contentType as string))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"Attachment contentType is unsupported.\", id);\n\t\t\tbreak;\n\t\tcase \"get_transcript\":\n\t\t\tif (params.pageToken !== undefined) stringParam(params, \"pageToken\", id, true);\n\t\t\tif (\n\t\t\t\tparams.pageSize !== undefined &&\n\t\t\t\t(!Number.isSafeInteger(params.pageSize) || (params.pageSize as number) < 1 || (params.pageSize as number) > 200)\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"pageSize must be an integer between 1 and 200.\", id);\n\t\t\tif (\n\t\t\t\tparams.maxBytes !== undefined &&\n\t\t\t\t(!Number.isSafeInteger(params.maxBytes) ||\n\t\t\t\t\t(params.maxBytes as number) < 1024 ||\n\t\t\t\t\t(params.maxBytes as number) > RPC_MAX_TRANSCRIPT_BYTES)\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\n\t\t\t\t\t\"INVALID_PARAMS\",\n\t\t\t\t\t`maxBytes must be between 1024 and ${RPC_MAX_TRANSCRIPT_BYTES}.`,\n\t\t\t\t\tid,\n\t\t\t\t);\n\t\t\tbreak;\n\t\tcase \"approve_tool\":\n\t\t\tstringParam(params, \"approvalId\", id);\n\t\t\tbooleanParam(params, \"approved\", id);\n\t\t\tbreak;\n\t}\n\treturn { version: RPC_PROTOCOL_VERSION, kind: \"request\", id, method, params };\n}\n\nexport function parseRpcServerMessage(line: string): RpcServerMessage {\n\tconst record = parseJsonObject(line);\n\tassertVersion(record);\n\tif (record.kind === \"event\") {\n\t\trequiredId(record.requestId, \"requestId\");\n\t\tconst event = objectRecord(record.event);\n\t\tconst type = event?.type;\n\t\tif (\n\t\t\ttypeof type !== \"string\" ||\n\t\t\t(!LEGACY_EVENT_TYPES.has(type as AgentSessionEvent[\"type\"]) && !EXTENDED_EVENT_TYPES.has(type))\n\t\t)\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC event must contain a typed event object.\");\n\t\tif (!event) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC event must contain a typed event object.\");\n\t\tif (record.sequence !== undefined && (!Number.isSafeInteger(record.sequence) || (record.sequence as number) < 0))\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC event sequence is invalid.\");\n\t\tassertEvent(event, type);\n\t\treturn record as unknown as RpcEventRecord;\n\t}\n\tif (record.kind !== \"response\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", 'RPC server message kind must be \"response\" or \"event\".');\n\tif (record.ok === false) {\n\t\tconst error = objectRecord(record.error);\n\t\tif (\n\t\t\t!error ||\n\t\t\ttypeof error.code !== \"string\" ||\n\t\t\t!RPC_ERROR_CODES.has(error.code as RpcErrorCode) ||\n\t\t\ttypeof error.message !== \"string\"\n\t\t)\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC error response has an invalid error object.\");\n\t\tif (record.id !== undefined) requiredId(record.id, \"id\");\n\t\treturn record as unknown as RpcErrorResponse;\n\t}\n\tif (record.ok !== true) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC response ok must be a boolean.\");\n\trequiredId(record.id, \"id\");\n\tconst result = objectRecord(record.result);\n\tif (!result || typeof result.method !== \"string\" || !RPC_METHODS.includes(result.method as RpcMethod))\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC success response has an unknown method.\");\n\tassertSuccessResult(result);\n\treturn record as unknown as RpcSuccessResponse;\n}\nfunction assertSuccessResult(result: Record<string, unknown>): void {\n\tswitch (result.method as RpcMethod) {\n\t\tcase \"prompt\":\n\t\tcase \"retry\":\n\t\t\tassertAssistantMessage(result.message);\n\t\t\treturn;\n\t\tcase \"cancel\":\n\t\t\tif (typeof result.cancelled !== \"boolean\")\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC cancel result is invalid.\");\n\t\t\treturn;\n\t\tcase \"get_state\":\n\t\t\tassertState(result.state);\n\t\t\treturn;\n\t\tcase \"get_capabilities\":\n\t\t\tassertCapabilities(result);\n\t\t\treturn;\n\t\tcase \"resume_events\":\n\t\t\tif (typeof result.snapshotRequired !== \"boolean\")\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC resume_events result is invalid.\");\n\t\t\treturn;\n\t\tcase \"get_operation\":\n\t\t\tassertOperationState(result.operation);\n\t\t\treturn;\n\t\tcase \"create_attachment\":\n\t\t\tassertAttachmentInfo(result.attachment);\n\t\t\treturn;\n\t\tcase \"get_product_state\":\n\t\t\tassertProductState(result.state);\n\t\t\treturn;\n\t\tcase \"get_project_trust\":\n\t\t\tif (typeof result.trusted !== \"boolean\")\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC get_project_trust result is invalid.\");\n\t\t\treturn;\n\t\tcase \"list_sessions\":\n\t\t\tif (!Array.isArray(result.sessions))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC list_sessions result is invalid.\");\n\t\t\tfor (const session of result.sessions) assertSessionInfo(session);\n\t\t\treturn;\n\t\tcase \"new_session\":\n\t\tcase \"open_session\":\n\t\tcase \"rename_session\":\n\t\tcase \"branch_session\":\n\t\t\tassertSessionInfo(result.session);\n\t\t\treturn;\n\t\tcase \"inspect_session\":\n\t\t\tif (!objectRecord(result.snapshot))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC Session snapshot is invalid.\");\n\t\t\treturn;\n\t\tcase \"list_providers\":\n\t\t\tif (!Array.isArray(result.providers))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC providers result is invalid.\");\n\t\t\treturn;\n\t\tcase \"list_context_files\":\n\t\t\tif (!Array.isArray(result.files))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC context files result is invalid.\");\n\t\t\treturn;\n\t\tcase \"list_mcp_servers\":\n\t\t\tif (!Array.isArray(result.servers)) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC MCP result is invalid.\");\n\t\t\treturn;\n\t\tcase \"list_web_contributions\":\n\t\t\t{\n\t\t\t\tconst manifest = objectRecord(result.manifest);\n\t\t\t\tif (!manifest || !validateWebManifest(manifest))\n\t\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC Web contribution manifest is invalid.\");\n\t\t\t}\n\t\t\treturn;\n\t\tcase \"list_commands\":\n\t\t\tif (!Array.isArray(result.commands))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC commands result is invalid.\");\n\t\t\tfor (const command of result.commands) assertCommandInfo(command);\n\t\t\treturn;\n\t\tcase \"run_command\":\n\t\t\tif (typeof result.command !== \"string\" || !result.command)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC command result is invalid.\");\n\t\t\tif (result.action !== undefined) assertCommandAction(result.action);\n\t\t\treturn;\n\t\tcase \"configure_mcp_server\":\n\t\tcase \"reconnect_mcp_server\":\n\t\t\tif (!objectRecord(result.server)) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC MCP result is invalid.\");\n\t\t\treturn;\n\t\tcase \"login\":\n\t\t\tif (!objectRecord(result.provider)) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC login result is invalid.\");\n\t\t\treturn;\n\t\tcase \"set_project_trust\":\n\t\t\tif (typeof result.trusted !== \"boolean\")\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC trust result is invalid.\");\n\t\t\treturn;\n\t\tcase \"logout\":\n\t\tcase \"remove_mcp_server\":\n\t\t\treturn;\n\t\tcase \"get_settings\":\n\t\t\tif (!objectRecord(result.settings))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC settings result is invalid.\");\n\t\t\treturn;\n\t\tcase \"set_default_provider\":\n\t\tcase \"set_default_model\":\n\t\tcase \"set_locale\":\n\t\tcase \"set_permission_mode\":\n\t\tcase \"configure_custom_provider\":\n\t\t\treturn;\n\t}\n}\nfunction assertCapabilities(result: Record<string, unknown>): void {\n\tif (\n\t\t!Array.isArray(result.methods) ||\n\t\t!result.methods.every((method) => typeof method === \"string\" && RPC_METHODS.includes(method as RpcMethod)) ||\n\t\t!Array.isArray(result.events) ||\n\t\t!result.events.every(\n\t\t\t(event) => typeof event === \"string\" && EXTENDED_EVENT_NAMES.has(event as RpcExtendedEventName),\n\t\t) ||\n\t\t!Number.isSafeInteger(result.eventBufferSize) ||\n\t\t(result.eventBufferSize as number) < 0\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC get_capabilities result is invalid.\");\n}\nfunction assertSessionInfo(value: unknown): void {\n\tconst session = objectRecord(value);\n\tif (!session || typeof session.id !== \"string\" || !session.id || typeof session.label !== \"string\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC Session result is invalid.\");\n\tif (session.modifiedAt !== undefined && !Number.isFinite(session.modifiedAt))\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC Session modifiedAt is invalid.\");\n}\nfunction assertCommandInfo(value: unknown): void {\n\tconst command = objectRecord(value);\n\tif (\n\t\t!command ||\n\t\ttypeof command.name !== \"string\" ||\n\t\t!command.name ||\n\t\ttypeof command.description !== \"string\" ||\n\t\t(command.kind !== \"command\" && command.kind !== \"skill\")\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC command info is invalid.\");\n}\nfunction assertCommandAction(value: unknown): void {\n\tconst action = objectRecord(value);\n\tif (!action || typeof action.command !== \"string\" || !action.command || typeof action.args !== \"string\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC command action is invalid.\");\n}\nfunction assertOperationState(value: unknown): void {\n\tconst operation = objectRecord(value);\n\tif (\n\t\t!operation ||\n\t\ttypeof operation.requestId !== \"string\" ||\n\t\t!operation.requestId ||\n\t\ttypeof operation.kind !== \"string\" ||\n\t\t!RPC_METHODS.includes(operation.kind as RpcMethod) ||\n\t\ttypeof operation.status !== \"string\" ||\n\t\t![\"queued\", \"running\", \"completed\", \"failed\", \"cancelled\", \"crashed\"].includes(operation.status)\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC operation state is invalid.\");\n\tif (operation.sessionId !== undefined && typeof operation.sessionId !== \"string\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC operation session ID is invalid.\");\n\tif (operation.message !== undefined) assertAssistantMessage(operation.message);\n\tif (operation.error !== undefined) assertError(operation.error);\n}\nfunction assertAttachmentInfo(value: unknown): void {\n\tconst attachment = objectRecord(value);\n\tif (\n\t\t!attachment ||\n\t\ttypeof attachment.id !== \"string\" ||\n\t\t!attachment.id ||\n\t\ttypeof attachment.name !== \"string\" ||\n\t\t!attachment.name ||\n\t\ttypeof attachment.contentType !== \"string\" ||\n\t\t![\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"].includes(attachment.contentType) ||\n\t\t!Number.isSafeInteger(attachment.bytes) ||\n\t\t(attachment.bytes as number) < 0\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC attachment result is invalid.\");\n}\nfunction assertProductState(value: unknown): void {\n\tconst state = objectRecord(value);\n\tif (!state || typeof state.projectTrusted !== \"boolean\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC product state is invalid.\");\n}\nfunction assertError(value: unknown): void {\n\tconst error = objectRecord(value);\n\tif (\n\t\t!error ||\n\t\ttypeof error.code !== \"string\" ||\n\t\t!RPC_ERROR_CODES.has(error.code as RpcErrorCode) ||\n\t\ttypeof error.message !== \"string\"\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC error result is invalid.\");\n}\nfunction assertEvent(event: Record<string, unknown>, type: string): void {\n\tif (type === \"operation_update\") {\n\t\tassertOperationState(event.operation);\n\t\treturn;\n\t}\n\tif (type === \"session_changed\") {\n\t\tif (event.session !== undefined) assertSessionInfo(event.session);\n\t\treturn;\n\t}\n\tif (type === \"snapshot_required\") return;\n\tif (type === \"tool_approval\") {\n\t\tif (typeof event.approvalId !== \"string\")\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC tool_approval event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"product_audit\") {\n\t\tif (\n\t\t\ttypeof event.action !== \"string\" ||\n\t\t\t![\n\t\t\t\t\"login\",\n\t\t\t\t\"logout\",\n\t\t\t\t\"set_project_trust\",\n\t\t\t\t\"configure_mcp_server\",\n\t\t\t\t\"remove_mcp_server\",\n\t\t\t\t\"reconnect_mcp_server\",\n\t\t\t].includes(event.action) ||\n\t\t\t(event.target !== undefined && typeof event.target !== \"string\") ||\n\t\t\t(event.projectTrusted !== undefined && typeof event.projectTrusted !== \"boolean\")\n\t\t)\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC product_audit event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"tool_execution_start\") {\n\t\tif (typeof event.toolCallId !== \"string\" || typeof event.toolName !== \"string\" || !objectRecord(event.arguments))\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC tool event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"tool_execution_end\") {\n\t\tif (typeof event.toolCallId !== \"string\" || typeof event.toolName !== \"string\" || !objectRecord(event.result))\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC tool event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"message_start\" || type === \"message_end\") {\n\t\tif (!objectRecord(event.message)) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC message event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"message_update\") {\n\t\tconst update = objectRecord(event.event);\n\t\tif (!update || typeof update.type !== \"string\")\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC message update event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"turn_end\") {\n\t\tif (!objectRecord(event.message) || !Array.isArray(event.toolResults))\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC turn event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"agent_end\") {\n\t\tif (!Array.isArray(event.messages)) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC agent event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"compaction_start\") {\n\t\tif (event.reason !== \"threshold\" && event.reason !== \"manual\")\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC compaction event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"compaction_end\") {\n\t\tif (\n\t\t\t(event.reason !== \"threshold\" && event.reason !== \"manual\") ||\n\t\t\ttypeof event.success !== \"boolean\" ||\n\t\t\t(event.errorMessage !== undefined && typeof event.errorMessage !== \"string\")\n\t\t)\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC compaction event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"queue_update\") {\n\t\tif (!Array.isArray(event.steering) || !event.steering.every((item) => typeof item === \"string\"))\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC queue event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"tree_navigated\") {\n\t\tif (\n\t\t\ttypeof event.oldLeafId !== \"string\" ||\n\t\t\ttypeof event.newLeafId !== \"string\" ||\n\t\t\ttypeof event.selectedEntryId !== \"string\" ||\n\t\t\ttypeof event.restoredEditorText !== \"boolean\"\n\t\t)\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC tree event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"usage_update\" && !objectRecord(event.usage)) {\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC usage event is invalid.\");\n\t}\n}\nfunction assertState(value: unknown): void {\n\tconst state = objectRecord(value);\n\tif (\n\t\t!state ||\n\t\ttypeof state.sessionId !== \"string\" ||\n\t\t!state.sessionId ||\n\t\ttypeof state.modelId !== \"string\" ||\n\t\t!state.modelId ||\n\t\ttypeof state.isStreaming !== \"boolean\" ||\n\t\t!Number.isInteger(state.messageCount) ||\n\t\t(state.messageCount as number) < 0\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC get_state response has an invalid state.\");\n}\nfunction assertAssistantMessage(value: unknown): void {\n\tconst message = objectRecord(value);\n\tif (\n\t\t!message ||\n\t\tmessage.role !== \"assistant\" ||\n\t\t!Array.isArray(message.content) ||\n\t\ttypeof message.provider !== \"string\" ||\n\t\ttypeof message.model !== \"string\" ||\n\t\t!Number.isFinite(message.timestamp) ||\n\t\ttypeof message.stopReason !== \"string\" ||\n\t\t!ASSISTANT_STOP_REASONS.has(message.stopReason)\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC prompt response has an invalid message.\");\n}\nexport function rpcErrorResponse(error: RpcProtocolError): RpcErrorResponse {\n\treturn {\n\t\tversion: RPC_PROTOCOL_VERSION,\n\t\tkind: \"response\",\n\t\t...(error.requestId === undefined ? {} : { id: error.requestId }),\n\t\tok: false,\n\t\terror: { code: error.code, message: error.message },\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/rpc/protocol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAU,CA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,CAAC,CAAC;QACF,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ;QACpC,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;QACjC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC;QACnC,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ;QACtC,CAAC,sBAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC;QAE/C,MAAM,IAAI,gBAAgB,CAAC,iBAAiB,EAAE,6CAA6C,CAAC,CAAC;AAC/F,CAAC;AACD,MAAM,UAAU,gBAAgB,CAAC,KAAuB;IACvD,OAAO;QACN,OAAO,EAAE,oBAAoB;QAC7B,IAAI,EAAE,UAAU;QAChB,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;QACjE,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;KACnD,CAAC;AACH,CAAC","sourcesContent":["import type { AssistantMessage } from \"@di-code/ai\";\nimport { validateWebManifest } from \"@di-code/plugin-runtime\";\nimport type { AgentSessionEvent } from \"../core/session.ts\";\n\nexport const RPC_PROTOCOL_VERSION = 1 as const;\nexport const RPC_MAX_ID_LENGTH = 128;\nexport const RPC_MAX_PROMPT_LENGTH = 1_000_000;\nexport const RPC_MAX_ATTACHMENTS_PER_REQUEST = 4;\nexport const RPC_MAX_ATTACHMENT_BYTES = 5 * 1024 * 1024;\nconst RPC_MAX_ASSISTANT_IMAGE_BYTES = 5 * 1024 * 1024;\n/** Allows one JSONL user entry containing a maximum-sized base64 image to be read in a single transcript page. */\nexport const RPC_MAX_TRANSCRIPT_BYTES = 8 * 1024 * 1024;\nconst RPC_MAX_ATTACHMENT_BASE64_LENGTH = Math.ceil(RPC_MAX_ATTACHMENT_BYTES / 3) * 4;\n\n/** v1 grows only by methods and optional fields. Clients must negotiate extended events first. */\nexport const RPC_METHODS = [\n\t\"prompt\",\n\t\"cancel\",\n\t\"get_state\",\n\t\"get_capabilities\",\n\t\"resume_events\",\n\t\"list_sessions\",\n\t\"new_session\",\n\t\"open_session\",\n\t\"inspect_session\",\n\t\"rename_session\",\n\t\"delete_session\",\n\t\"branch_session\",\n\t\"get_transcript\",\n\t\"get_tree\",\n\t\"navigate_tree\",\n\t\"steer\",\n\t\"retry\",\n\t\"get_operation\",\n\t\"get_models\",\n\t\"set_model\",\n\t\"get_runtime\",\n\t\"set_runtime\",\n\t\"set_thinking_level\",\n\t\"compact\",\n\t\"set_compaction_enabled\",\n\t\"get_usage\",\n\t\"list_skills\",\n\t\"get_resources\",\n\t\"get_product_state\",\n\t\"list_providers\",\n\t\"get_settings\",\n\t\"set_default_provider\",\n\t\"set_default_model\",\n\t\"set_locale\",\n\t\"set_permission_mode\",\n\t\"configure_custom_provider\",\n\t\"login\",\n\t\"logout\",\n\t\"get_project_trust\",\n\t\"set_project_trust\",\n\t\"list_context_files\",\n\t\"list_mcp_servers\",\n\t\"configure_mcp_server\",\n\t\"remove_mcp_server\",\n\t\"reconnect_mcp_server\",\n\t\"list_plugins\",\n\t\"list_web_contributions\",\n\t\"list_commands\",\n\t\"run_command\",\n\t\"set_plugin_enabled\",\n\t\"create_attachment\",\n\t\"approve_tool\",\n] as const;\nexport type RpcMethod = (typeof RPC_METHODS)[number];\n\nexport interface RpcRequest {\n\treadonly version: typeof RPC_PROTOCOL_VERSION;\n\treadonly kind: \"request\";\n\treadonly id: string;\n\treadonly method: RpcMethod;\n\treadonly params: Record<string, unknown>;\n}\n\nexport interface RpcSessionState {\n\treadonly sessionId: string;\n\treadonly modelId: string;\n\treadonly isStreaming: boolean;\n\treadonly messageCount: number;\n\treadonly sequence?: number;\n}\n\n/** Metadata for an opaque attachment handle kept only by its live RPC actor. */\nexport interface RpcAttachmentInfo {\n\treadonly id: string;\n\treadonly name: string;\n\treadonly contentType: \"image/png\" | \"image/jpeg\" | \"image/webp\" | \"image/gif\";\n\treadonly bytes: number;\n}\n\nexport interface RpcCapabilities {\n\treadonly methods: readonly RpcMethod[];\n\treadonly events: readonly RpcExtendedEventName[];\n\treadonly eventBufferSize: number;\n}\n\nexport type RpcExtendedEventName =\n\t| \"sequence\"\n\t| \"operation_update\"\n\t| \"snapshot_required\"\n\t| \"session_changed\"\n\t| \"tool_approval\"\n\t| \"product_audit\";\n\nexport interface RpcProductState {\n\treadonly projectTrusted: boolean;\n}\n\nexport interface RpcProviderSummary {\n\treadonly id: string;\n\treadonly name: string;\n\treadonly models: readonly {\n\t\treadonly id: string;\n\t\treadonly name: string;\n\t\treadonly input: readonly string[];\n\t\t/** Omitted when the model does not expose selectable reasoning levels. */\n\t\treadonly reasoningEfforts?: readonly (\"low\" | \"medium\" | \"high\" | \"max\")[];\n\t}[];\n\treadonly configured: boolean;\n}\n\nexport interface RpcSettingsSnapshot {\n\treadonly providers: readonly (RpcProviderSummary & {\n\t\treadonly api: string;\n\t\treadonly baseUrl?: string;\n\t\treadonly apiKeySource: \"environment\" | \"settings\" | \"missing\";\n\t})[];\n\treadonly defaults: { readonly providerId?: string; readonly modelId?: string };\n\treadonly runtime: { readonly providerId: string; readonly modelId: string; readonly thinkingLevel?: string };\n\treadonly locale?: \"en\" | \"zh-CN\";\n\treadonly permissionMode: \"ask\" | \"allow\" | \"deny\";\n\treadonly sources: Readonly<Record<string, \"environment\" | \"settings\" | \"default\" | \"runtime\">>;\n}\n\nexport interface RpcContextFileInfo {\n\treadonly path: string;\n\treadonly scope: string;\n\treadonly bytes: number;\n}\n\n/** A user-invocable command projected from the active composition or Skill catalog. */\nexport interface RpcCommandInfo {\n\treadonly name: string;\n\treadonly description: string;\n\treadonly kind: \"command\" | \"skill\";\n}\n\n/** A WebUI operation requested by a registered command. */\nexport interface RpcCommandAction {\n\treadonly command: string;\n\treadonly args: string;\n}\n\nexport interface RpcMcpServerInfo {\n\treadonly id: string;\n\treadonly scope?: string;\n\treadonly state: \"configured\" | \"connected\" | \"failed\" | \"disconnected\";\n\treadonly tools: number;\n\treadonly resources: number;\n\treadonly prompts: number;\n\treadonly diagnostic?: string;\n}\n\nexport type OperationStatus = \"queued\" | \"running\" | \"completed\" | \"failed\" | \"cancelled\" | \"crashed\";\nexport interface OperationState {\n\treadonly requestId: string;\n\treadonly kind: RpcMethod;\n\treadonly status: OperationStatus;\n\treadonly sessionId?: string;\n\treadonly message?: AssistantMessage;\n\treadonly error?: { readonly code: RpcErrorCode; readonly message: string };\n}\n\n/** Method-specific result fields are validated at the wire boundary. */\nexport type RpcSuccessResult = { readonly method: RpcMethod; readonly [key: string]: unknown };\n\nexport type RpcErrorCode =\n\t| \"PARSE_ERROR\"\n\t| \"INVALID_REQUEST\"\n\t| \"UNSUPPORTED_VERSION\"\n\t| \"METHOD_NOT_FOUND\"\n\t| \"INVALID_PARAMS\"\n\t| \"BUSY\"\n\t| \"NOT_FOUND\"\n\t| \"CANCELLED\"\n\t| \"DISPOSED\"\n\t| \"SESSION_IN_USE\"\n\t| \"INVALID_WORKSPACE\"\n\t| \"UNAUTHORIZED\"\n\t| \"INTERNAL_ERROR\"\n\t| \"PROCESS_EXIT\";\n\nconst RPC_ERROR_CODES: ReadonlySet<RpcErrorCode> = new Set([\n\t\"PARSE_ERROR\",\n\t\"INVALID_REQUEST\",\n\t\"UNSUPPORTED_VERSION\",\n\t\"METHOD_NOT_FOUND\",\n\t\"INVALID_PARAMS\",\n\t\"BUSY\",\n\t\"NOT_FOUND\",\n\t\"CANCELLED\",\n\t\"DISPOSED\",\n\t\"SESSION_IN_USE\",\n\t\"INVALID_WORKSPACE\",\n\t\"UNAUTHORIZED\",\n\t\"INTERNAL_ERROR\",\n\t\"PROCESS_EXIT\",\n]);\nconst LEGACY_EVENT_TYPES: ReadonlySet<AgentSessionEvent[\"type\"]> = new Set([\n\t\"agent_start\",\n\t\"turn_start\",\n\t\"message_start\",\n\t\"message_update\",\n\t\"message_end\",\n\t\"turn_end\",\n\t\"tool_execution_start\",\n\t\"tool_execution_end\",\n\t\"agent_end\",\n\t\"compaction_start\",\n\t\"compaction_end\",\n\t\"queue_update\",\n\t\"tree_navigated\",\n\t\"usage_update\",\n]);\nconst EXTENDED_EVENT_TYPES = new Set([\n\t\"snapshot_required\",\n\t\"operation_update\",\n\t\"session_changed\",\n\t\"tool_approval\",\n\t\"product_audit\",\n]);\nconst EXTENDED_EVENT_NAMES: ReadonlySet<RpcExtendedEventName> = new Set([\n\t\"sequence\",\n\t\"operation_update\",\n\t\"snapshot_required\",\n\t\"session_changed\",\n\t\"tool_approval\",\n\t\"product_audit\",\n]);\nconst ASSISTANT_STOP_REASONS = new Set([\"stop\", \"length\", \"tool_use\", \"error\", \"aborted\"]);\n\nexport interface RpcSuccessResponse {\n\treadonly version: typeof RPC_PROTOCOL_VERSION;\n\treadonly kind: \"response\";\n\treadonly id: string;\n\treadonly ok: true;\n\treadonly result: RpcSuccessResult;\n}\nexport interface RpcErrorResponse {\n\treadonly version: typeof RPC_PROTOCOL_VERSION;\n\treadonly kind: \"response\";\n\treadonly id?: string;\n\treadonly ok: false;\n\treadonly error: { readonly code: RpcErrorCode; readonly message: string };\n}\nexport interface RpcEventRecord {\n\treadonly version: typeof RPC_PROTOCOL_VERSION;\n\treadonly kind: \"event\";\n\treadonly requestId: string;\n\treadonly event:\n\t\t| AgentSessionEvent\n\t\t| {\n\t\t\t\treadonly type: \"product_audit\";\n\t\t\t\treadonly action:\n\t\t\t\t\t| \"login\"\n\t\t\t\t\t| \"logout\"\n\t\t\t\t\t| \"set_project_trust\"\n\t\t\t\t\t| \"configure_mcp_server\"\n\t\t\t\t\t| \"remove_mcp_server\"\n\t\t\t\t\t| \"reconnect_mcp_server\";\n\t\t\t\treadonly target?: string;\n\t\t\t\treadonly projectTrusted?: boolean;\n\t\t }\n\t\t| {\n\t\t\t\treadonly type: \"snapshot_required\" | \"operation_update\" | \"session_changed\" | \"tool_approval\";\n\t\t\t\treadonly [key: string]: unknown;\n\t\t };\n\treadonly sessionId?: string;\n\treadonly sequence?: number;\n}\nexport type RpcResponse = RpcSuccessResponse | RpcErrorResponse;\nexport type RpcServerMessage = RpcResponse | RpcEventRecord;\n\nexport class RpcProtocolError extends Error {\n\treadonly code: RpcErrorCode;\n\treadonly requestId?: string;\n\n\tconstructor(code: RpcErrorCode, message: string, requestId?: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RpcProtocolError\";\n\t\tthis.code = code;\n\t\tthis.requestId = requestId;\n\t}\n}\n\nfunction objectRecord(value: unknown): Record<string, unknown> | undefined {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value)\n\t\t? (value as Record<string, unknown>)\n\t\t: undefined;\n}\nfunction requiredId(value: unknown, field: string, requestId?: string): string {\n\tif (typeof value !== \"string\" || value.length === 0 || value.length > RPC_MAX_ID_LENGTH)\n\t\tthrow new RpcProtocolError(\n\t\t\t\"INVALID_REQUEST\",\n\t\t\t`${field} must be a non-empty string of at most ${RPC_MAX_ID_LENGTH} characters.`,\n\t\t\trequestId,\n\t\t);\n\treturn value;\n}\nfunction parseJsonObject(line: string): Record<string, unknown> {\n\ttry {\n\t\tconst result = objectRecord(JSON.parse(line));\n\t\tif (!result) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC input must be a JSON object.\");\n\t\treturn result;\n\t} catch (cause) {\n\t\tif (cause instanceof RpcProtocolError) throw cause;\n\t\tthrow new RpcProtocolError(\"PARSE_ERROR\", \"RPC input must be valid JSON.\");\n\t}\n}\nfunction assertVersion(record: Record<string, unknown>, requestId?: string): void {\n\tif (record.version !== RPC_PROTOCOL_VERSION)\n\t\tthrow new RpcProtocolError(\n\t\t\t\"UNSUPPORTED_VERSION\",\n\t\t\t`Unsupported RPC protocol version; expected ${RPC_PROTOCOL_VERSION}.`,\n\t\t\trequestId,\n\t\t);\n}\nfunction stringParam(params: Record<string, unknown>, name: string, id: string, optional = false): void {\n\tconst value = params[name];\n\tif (optional && value === undefined) return;\n\tif (typeof value !== \"string\" || value.length === 0 || value.length > RPC_MAX_PROMPT_LENGTH)\n\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", `${name} must be a non-empty string.`, id);\n}\nfunction booleanParam(params: Record<string, unknown>, name: string, id: string): void {\n\tif (typeof params[name] !== \"boolean\") throw new RpcProtocolError(\"INVALID_PARAMS\", `${name} must be a boolean.`, id);\n}\nfunction attachmentIdsParam(params: Record<string, unknown>, id: string): void {\n\tif (params.attachmentIds === undefined) return;\n\tif (\n\t\t!Array.isArray(params.attachmentIds) ||\n\t\tparams.attachmentIds.length > RPC_MAX_ATTACHMENTS_PER_REQUEST ||\n\t\t!params.attachmentIds.every(\n\t\t\t(value) => typeof value === \"string\" && value.length > 0 && value.length <= RPC_MAX_ID_LENGTH,\n\t\t)\n\t)\n\t\tthrow new RpcProtocolError(\n\t\t\t\"INVALID_PARAMS\",\n\t\t\t`attachmentIds must contain at most ${RPC_MAX_ATTACHMENTS_PER_REQUEST} attachment IDs.`,\n\t\t\tid,\n\t\t);\n}\nfunction attachmentDataParam(params: Record<string, unknown>, id: string): void {\n\tconst data = params.data;\n\tif (typeof data !== \"string\" || data.length === 0 || data.length > RPC_MAX_ATTACHMENT_BASE64_LENGTH)\n\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"Attachment data exceeds the permitted size.\", id);\n}\n\n/** Parses every public v1 method before any dispatcher or transport observes it. */\nexport function parseRpcRequest(line: string): RpcRequest {\n\tconst record = parseJsonObject(line);\n\tconst candidateId = typeof record.id === \"string\" ? record.id : undefined;\n\tassertVersion(record, candidateId);\n\tif (record.kind !== \"request\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", 'RPC request kind must be \"request\".', candidateId);\n\tconst id = requiredId(record.id, \"id\", candidateId);\n\tconst params = objectRecord(record.params);\n\tif (!params) throw new RpcProtocolError(\"INVALID_PARAMS\", \"RPC params must be an object.\", id);\n\tif (typeof record.method !== \"string\" || !RPC_METHODS.includes(record.method as RpcMethod))\n\t\tthrow new RpcProtocolError(\"METHOD_NOT_FOUND\", \"Unknown RPC method.\", id);\n\tconst method = record.method as RpcMethod;\n\tswitch (method) {\n\t\tcase \"prompt\":\n\t\tcase \"steer\":\n\t\t\tstringParam(params, \"message\", id);\n\t\t\tattachmentIdsParam(params, id);\n\t\t\tbreak;\n\t\tcase \"cancel\":\n\t\tcase \"get_operation\":\n\t\tcase \"open_session\":\n\t\tcase \"inspect_session\":\n\t\tcase \"rename_session\":\n\t\tcase \"delete_session\":\n\t\tcase \"navigate_tree\":\n\t\tcase \"set_model\":\n\t\tcase \"logout\":\n\t\tcase \"reconnect_mcp_server\":\n\t\t\tstringParam(\n\t\t\t\tparams,\n\t\t\t\tmethod === \"cancel\" || method === \"get_operation\"\n\t\t\t\t\t? \"requestId\"\n\t\t\t\t\t: method === \"open_session\"\n\t\t\t\t\t\t? \"sessionId\"\n\t\t\t\t\t\t: method === \"inspect_session\" || method === \"rename_session\" || method === \"delete_session\"\n\t\t\t\t\t\t\t? \"sessionId\"\n\t\t\t\t\t\t\t: method === \"navigate_tree\"\n\t\t\t\t\t\t\t\t? \"entryId\"\n\t\t\t\t\t\t\t\t: method === \"set_model\"\n\t\t\t\t\t\t\t\t\t? \"modelId\"\n\t\t\t\t\t\t\t\t\t: method === \"logout\"\n\t\t\t\t\t\t\t\t\t\t? \"providerId\"\n\t\t\t\t\t\t\t\t\t\t: \"serverId\",\n\t\t\t\tid,\n\t\t\t);\n\t\t\tif (method === \"rename_session\") stringParam(params, \"label\", id);\n\t\t\tif (method === \"delete_session\") stringParam(params, \"confirmation\", id);\n\t\t\tbreak;\n\t\tcase \"branch_session\":\n\t\t\tif (params.sessionId !== undefined) stringParam(params, \"sessionId\", id, true);\n\t\t\tif (params.entryId !== undefined) stringParam(params, \"entryId\", id, true);\n\t\t\tbreak;\n\t\tcase \"set_runtime\":\n\t\t\tstringParam(params, \"providerId\", id);\n\t\t\tstringParam(params, \"modelId\", id);\n\t\t\tbreak;\n\t\tcase \"run_command\":\n\t\t\tstringParam(params, \"name\", id);\n\t\t\tif (!/^[a-z][a-z0-9-]*(?::[a-z][a-z0-9-]*)?$/.test(params.name as string))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"run_command.name is invalid.\", id);\n\t\t\tif (params.args !== undefined && (typeof params.args !== \"string\" || params.args.length > RPC_MAX_PROMPT_LENGTH))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"args must be a string of at most 1,000,000 characters.\", id);\n\t\t\tbreak;\n\t\tcase \"set_default_provider\":\n\t\tcase \"set_default_model\":\n\t\tcase \"set_locale\":\n\t\tcase \"set_permission_mode\":\n\t\t\tstringParam(\n\t\t\t\tparams,\n\t\t\t\tmethod === \"set_default_provider\"\n\t\t\t\t\t? \"providerId\"\n\t\t\t\t\t: method === \"set_default_model\"\n\t\t\t\t\t\t? \"modelId\"\n\t\t\t\t\t\t: method === \"set_locale\"\n\t\t\t\t\t\t\t? \"locale\"\n\t\t\t\t\t\t\t: \"permissionMode\",\n\t\t\t\tid,\n\t\t\t);\n\t\t\tif (method === \"set_locale\" && params.locale !== \"en\" && params.locale !== \"zh-CN\")\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"locale must be en or zh-CN.\", id);\n\t\t\tif (\n\t\t\t\tmethod === \"set_permission_mode\" &&\n\t\t\t\tparams.permissionMode !== \"ask\" &&\n\t\t\t\tparams.permissionMode !== \"allow\" &&\n\t\t\t\tparams.permissionMode !== \"deny\"\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"permissionMode must be ask, allow, or deny.\", id);\n\t\t\tbreak;\n\t\tcase \"configure_custom_provider\":\n\t\t\tfor (const name of [\"api\", \"baseUrl\", \"apiKey\", \"modelId\"]) stringParam(params, name, id);\n\t\t\tif (![\"openai-responses\", \"openai-chat-completions\", \"anthropic-messages\"].includes(params.api as string))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"Unsupported custom Provider API.\", id);\n\t\t\tbreak;\n\t\tcase \"set_thinking_level\":\n\t\t\tif (\n\t\t\t\tparams.level !== undefined &&\n\t\t\t\tparams.level !== \"low\" &&\n\t\t\t\tparams.level !== \"medium\" &&\n\t\t\t\tparams.level !== \"high\" &&\n\t\t\t\tparams.level !== \"max\"\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"set_thinking_level.level must be a valid thinking level.\", id);\n\t\t\tbreak;\n\t\tcase \"retry\":\n\t\t\tstringParam(params, \"targetRequestId\", id);\n\t\t\tbreak;\n\t\tcase \"login\":\n\t\t\tstringParam(params, \"providerId\", id);\n\t\t\tstringParam(params, \"apiKey\", id);\n\t\t\tif (params.modelId !== undefined) stringParam(params, \"modelId\", id, true);\n\t\t\tif (params.api !== undefined) stringParam(params, \"api\", id, true);\n\t\t\tbreak;\n\t\tcase \"configure_mcp_server\":\n\t\t\tstringParam(params, \"serverId\", id);\n\t\t\tstringParam(params, \"scope\", id);\n\t\t\tif (!objectRecord(params.config)) throw new RpcProtocolError(\"INVALID_PARAMS\", \"config must be an object.\", id);\n\t\t\tbreak;\n\t\tcase \"remove_mcp_server\":\n\t\t\tstringParam(params, \"serverId\", id);\n\t\t\tif (params.scope !== undefined) stringParam(params, \"scope\", id, true);\n\t\t\tbreak;\n\t\tcase \"set_plugin_enabled\":\n\t\t\tstringParam(params, \"pluginId\", id);\n\t\t\tbooleanParam(params, \"enabled\", id);\n\t\t\tbreak;\n\t\tcase \"set_compaction_enabled\":\n\t\tcase \"set_project_trust\":\n\t\t\tbooleanParam(params, method === \"set_compaction_enabled\" ? \"enabled\" : \"trusted\", id);\n\t\t\tbreak;\n\t\tcase \"get_capabilities\":\n\t\t\tif (\n\t\t\t\tparams.events !== undefined &&\n\t\t\t\t(!Array.isArray(params.events) || !params.events.every((item) => typeof item === \"string\"))\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"get_capabilities.events must be a string array.\", id);\n\t\t\tbreak;\n\t\tcase \"resume_events\":\n\t\t\tif (\n\t\t\t\tparams.lastSequence !== undefined &&\n\t\t\t\t(!Number.isSafeInteger(params.lastSequence) || (params.lastSequence as number) < 0)\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"resume_events.lastSequence must be a non-negative integer.\", id);\n\t\t\tbreak;\n\t\tcase \"create_attachment\":\n\t\t\tstringParam(params, \"name\", id);\n\t\t\tstringParam(params, \"contentType\", id);\n\t\t\tattachmentDataParam(params, id);\n\t\t\tif (![\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"].includes(params.contentType as string))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"Attachment contentType is unsupported.\", id);\n\t\t\tbreak;\n\t\tcase \"get_transcript\":\n\t\t\tif (params.pageToken !== undefined) stringParam(params, \"pageToken\", id, true);\n\t\t\tif (\n\t\t\t\tparams.pageSize !== undefined &&\n\t\t\t\t(!Number.isSafeInteger(params.pageSize) || (params.pageSize as number) < 1 || (params.pageSize as number) > 200)\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_PARAMS\", \"pageSize must be an integer between 1 and 200.\", id);\n\t\t\tif (\n\t\t\t\tparams.maxBytes !== undefined &&\n\t\t\t\t(!Number.isSafeInteger(params.maxBytes) ||\n\t\t\t\t\t(params.maxBytes as number) < 1024 ||\n\t\t\t\t\t(params.maxBytes as number) > RPC_MAX_TRANSCRIPT_BYTES)\n\t\t\t)\n\t\t\t\tthrow new RpcProtocolError(\n\t\t\t\t\t\"INVALID_PARAMS\",\n\t\t\t\t\t`maxBytes must be between 1024 and ${RPC_MAX_TRANSCRIPT_BYTES}.`,\n\t\t\t\t\tid,\n\t\t\t\t);\n\t\t\tbreak;\n\t\tcase \"approve_tool\":\n\t\t\tstringParam(params, \"approvalId\", id);\n\t\t\tbooleanParam(params, \"approved\", id);\n\t\t\tbreak;\n\t}\n\treturn { version: RPC_PROTOCOL_VERSION, kind: \"request\", id, method, params };\n}\n\nexport function parseRpcServerMessage(line: string): RpcServerMessage {\n\tconst record = parseJsonObject(line);\n\tassertVersion(record);\n\tif (record.kind === \"event\") {\n\t\trequiredId(record.requestId, \"requestId\");\n\t\tconst event = objectRecord(record.event);\n\t\tconst type = event?.type;\n\t\tif (\n\t\t\ttypeof type !== \"string\" ||\n\t\t\t(!LEGACY_EVENT_TYPES.has(type as AgentSessionEvent[\"type\"]) && !EXTENDED_EVENT_TYPES.has(type))\n\t\t)\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC event must contain a typed event object.\");\n\t\tif (!event) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC event must contain a typed event object.\");\n\t\tif (record.sequence !== undefined && (!Number.isSafeInteger(record.sequence) || (record.sequence as number) < 0))\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC event sequence is invalid.\");\n\t\tassertEvent(event, type);\n\t\treturn record as unknown as RpcEventRecord;\n\t}\n\tif (record.kind !== \"response\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", 'RPC server message kind must be \"response\" or \"event\".');\n\tif (record.ok === false) {\n\t\tconst error = objectRecord(record.error);\n\t\tif (\n\t\t\t!error ||\n\t\t\ttypeof error.code !== \"string\" ||\n\t\t\t!RPC_ERROR_CODES.has(error.code as RpcErrorCode) ||\n\t\t\ttypeof error.message !== \"string\"\n\t\t)\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC error response has an invalid error object.\");\n\t\tif (record.id !== undefined) requiredId(record.id, \"id\");\n\t\treturn record as unknown as RpcErrorResponse;\n\t}\n\tif (record.ok !== true) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC response ok must be a boolean.\");\n\trequiredId(record.id, \"id\");\n\tconst result = objectRecord(record.result);\n\tif (!result || typeof result.method !== \"string\" || !RPC_METHODS.includes(result.method as RpcMethod))\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC success response has an unknown method.\");\n\tassertSuccessResult(result);\n\treturn record as unknown as RpcSuccessResponse;\n}\nfunction assertSuccessResult(result: Record<string, unknown>): void {\n\tswitch (result.method as RpcMethod) {\n\t\tcase \"prompt\":\n\t\tcase \"retry\":\n\t\t\tassertAssistantMessage(result.message);\n\t\t\treturn;\n\t\tcase \"cancel\":\n\t\t\tif (typeof result.cancelled !== \"boolean\")\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC cancel result is invalid.\");\n\t\t\treturn;\n\t\tcase \"get_state\":\n\t\t\tassertState(result.state);\n\t\t\treturn;\n\t\tcase \"get_capabilities\":\n\t\t\tassertCapabilities(result);\n\t\t\treturn;\n\t\tcase \"resume_events\":\n\t\t\tif (typeof result.snapshotRequired !== \"boolean\")\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC resume_events result is invalid.\");\n\t\t\treturn;\n\t\tcase \"get_operation\":\n\t\t\tassertOperationState(result.operation);\n\t\t\treturn;\n\t\tcase \"create_attachment\":\n\t\t\tassertAttachmentInfo(result.attachment);\n\t\t\treturn;\n\t\tcase \"get_product_state\":\n\t\t\tassertProductState(result.state);\n\t\t\treturn;\n\t\tcase \"get_project_trust\":\n\t\t\tif (typeof result.trusted !== \"boolean\")\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC get_project_trust result is invalid.\");\n\t\t\treturn;\n\t\tcase \"list_sessions\":\n\t\t\tif (!Array.isArray(result.sessions))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC list_sessions result is invalid.\");\n\t\t\tfor (const session of result.sessions) assertSessionInfo(session);\n\t\t\treturn;\n\t\tcase \"new_session\":\n\t\tcase \"open_session\":\n\t\tcase \"rename_session\":\n\t\tcase \"branch_session\":\n\t\t\tassertSessionInfo(result.session);\n\t\t\treturn;\n\t\tcase \"inspect_session\":\n\t\t\tif (!objectRecord(result.snapshot))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC Session snapshot is invalid.\");\n\t\t\treturn;\n\t\tcase \"list_providers\":\n\t\t\tif (!Array.isArray(result.providers))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC providers result is invalid.\");\n\t\t\treturn;\n\t\tcase \"list_context_files\":\n\t\t\tif (!Array.isArray(result.files))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC context files result is invalid.\");\n\t\t\treturn;\n\t\tcase \"list_mcp_servers\":\n\t\t\tif (!Array.isArray(result.servers)) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC MCP result is invalid.\");\n\t\t\treturn;\n\t\tcase \"list_web_contributions\":\n\t\t\t{\n\t\t\t\tconst manifest = objectRecord(result.manifest);\n\t\t\t\tif (!manifest || !validateWebManifest(manifest))\n\t\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC Web contribution manifest is invalid.\");\n\t\t\t}\n\t\t\treturn;\n\t\tcase \"list_commands\":\n\t\t\tif (!Array.isArray(result.commands))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC commands result is invalid.\");\n\t\t\tfor (const command of result.commands) assertCommandInfo(command);\n\t\t\treturn;\n\t\tcase \"run_command\":\n\t\t\tif (typeof result.command !== \"string\" || !result.command)\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC command result is invalid.\");\n\t\t\tif (result.action !== undefined) assertCommandAction(result.action);\n\t\t\treturn;\n\t\tcase \"configure_mcp_server\":\n\t\tcase \"reconnect_mcp_server\":\n\t\t\tif (!objectRecord(result.server)) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC MCP result is invalid.\");\n\t\t\treturn;\n\t\tcase \"login\":\n\t\t\tif (!objectRecord(result.provider)) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC login result is invalid.\");\n\t\t\treturn;\n\t\tcase \"set_project_trust\":\n\t\t\tif (typeof result.trusted !== \"boolean\")\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC trust result is invalid.\");\n\t\t\treturn;\n\t\tcase \"logout\":\n\t\tcase \"remove_mcp_server\":\n\t\t\treturn;\n\t\tcase \"get_settings\":\n\t\t\tif (!objectRecord(result.settings))\n\t\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC settings result is invalid.\");\n\t\t\treturn;\n\t\tcase \"set_default_provider\":\n\t\tcase \"set_default_model\":\n\t\tcase \"set_locale\":\n\t\tcase \"set_permission_mode\":\n\t\tcase \"configure_custom_provider\":\n\t\t\treturn;\n\t}\n}\nfunction assertCapabilities(result: Record<string, unknown>): void {\n\tif (\n\t\t!Array.isArray(result.methods) ||\n\t\t!result.methods.every((method) => typeof method === \"string\" && RPC_METHODS.includes(method as RpcMethod)) ||\n\t\t!Array.isArray(result.events) ||\n\t\t!result.events.every(\n\t\t\t(event) => typeof event === \"string\" && EXTENDED_EVENT_NAMES.has(event as RpcExtendedEventName),\n\t\t) ||\n\t\t!Number.isSafeInteger(result.eventBufferSize) ||\n\t\t(result.eventBufferSize as number) < 0\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC get_capabilities result is invalid.\");\n}\nfunction assertSessionInfo(value: unknown): void {\n\tconst session = objectRecord(value);\n\tif (!session || typeof session.id !== \"string\" || !session.id || typeof session.label !== \"string\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC Session result is invalid.\");\n\tif (session.modifiedAt !== undefined && !Number.isFinite(session.modifiedAt))\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC Session modifiedAt is invalid.\");\n}\nfunction assertCommandInfo(value: unknown): void {\n\tconst command = objectRecord(value);\n\tif (\n\t\t!command ||\n\t\ttypeof command.name !== \"string\" ||\n\t\t!command.name ||\n\t\ttypeof command.description !== \"string\" ||\n\t\t(command.kind !== \"command\" && command.kind !== \"skill\")\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC command info is invalid.\");\n}\nfunction assertCommandAction(value: unknown): void {\n\tconst action = objectRecord(value);\n\tif (!action || typeof action.command !== \"string\" || !action.command || typeof action.args !== \"string\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC command action is invalid.\");\n}\nfunction assertOperationState(value: unknown): void {\n\tconst operation = objectRecord(value);\n\tif (\n\t\t!operation ||\n\t\ttypeof operation.requestId !== \"string\" ||\n\t\t!operation.requestId ||\n\t\ttypeof operation.kind !== \"string\" ||\n\t\t!RPC_METHODS.includes(operation.kind as RpcMethod) ||\n\t\ttypeof operation.status !== \"string\" ||\n\t\t![\"queued\", \"running\", \"completed\", \"failed\", \"cancelled\", \"crashed\"].includes(operation.status)\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC operation state is invalid.\");\n\tif (operation.sessionId !== undefined && typeof operation.sessionId !== \"string\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC operation session ID is invalid.\");\n\tif (operation.message !== undefined) assertAssistantMessage(operation.message);\n\tif (operation.error !== undefined) assertError(operation.error);\n}\nfunction assertAttachmentInfo(value: unknown): void {\n\tconst attachment = objectRecord(value);\n\tif (\n\t\t!attachment ||\n\t\ttypeof attachment.id !== \"string\" ||\n\t\t!attachment.id ||\n\t\ttypeof attachment.name !== \"string\" ||\n\t\t!attachment.name ||\n\t\ttypeof attachment.contentType !== \"string\" ||\n\t\t![\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"].includes(attachment.contentType) ||\n\t\t!Number.isSafeInteger(attachment.bytes) ||\n\t\t(attachment.bytes as number) < 0\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC attachment result is invalid.\");\n}\nfunction assertProductState(value: unknown): void {\n\tconst state = objectRecord(value);\n\tif (!state || typeof state.projectTrusted !== \"boolean\")\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC product state is invalid.\");\n}\nfunction assertError(value: unknown): void {\n\tconst error = objectRecord(value);\n\tif (\n\t\t!error ||\n\t\ttypeof error.code !== \"string\" ||\n\t\t!RPC_ERROR_CODES.has(error.code as RpcErrorCode) ||\n\t\ttypeof error.message !== \"string\"\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC error result is invalid.\");\n}\nfunction assertEvent(event: Record<string, unknown>, type: string): void {\n\tif (type === \"operation_update\") {\n\t\tassertOperationState(event.operation);\n\t\treturn;\n\t}\n\tif (type === \"session_changed\") {\n\t\tif (event.session !== undefined) assertSessionInfo(event.session);\n\t\treturn;\n\t}\n\tif (type === \"snapshot_required\") return;\n\tif (type === \"tool_approval\") {\n\t\tif (typeof event.approvalId !== \"string\")\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC tool_approval event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"product_audit\") {\n\t\tif (\n\t\t\ttypeof event.action !== \"string\" ||\n\t\t\t![\n\t\t\t\t\"login\",\n\t\t\t\t\"logout\",\n\t\t\t\t\"set_project_trust\",\n\t\t\t\t\"configure_mcp_server\",\n\t\t\t\t\"remove_mcp_server\",\n\t\t\t\t\"reconnect_mcp_server\",\n\t\t\t].includes(event.action) ||\n\t\t\t(event.target !== undefined && typeof event.target !== \"string\") ||\n\t\t\t(event.projectTrusted !== undefined && typeof event.projectTrusted !== \"boolean\")\n\t\t)\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC product_audit event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"tool_execution_start\") {\n\t\tif (typeof event.toolCallId !== \"string\" || typeof event.toolName !== \"string\" || !objectRecord(event.arguments))\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC tool event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"tool_execution_end\") {\n\t\tif (typeof event.toolCallId !== \"string\" || typeof event.toolName !== \"string\" || !objectRecord(event.result))\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC tool event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"message_start\" || type === \"message_end\") {\n\t\tif (!objectRecord(event.message)) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC message event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"message_update\") {\n\t\tconst update = objectRecord(event.event);\n\t\tif (!update || typeof update.type !== \"string\")\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC message update event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"turn_end\") {\n\t\tif (!objectRecord(event.message) || !Array.isArray(event.toolResults))\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC turn event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"agent_end\") {\n\t\tif (!Array.isArray(event.messages)) throw new RpcProtocolError(\"INVALID_REQUEST\", \"RPC agent event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"compaction_start\") {\n\t\tif (event.reason !== \"threshold\" && event.reason !== \"manual\")\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC compaction event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"compaction_end\") {\n\t\tif (\n\t\t\t(event.reason !== \"threshold\" && event.reason !== \"manual\") ||\n\t\t\ttypeof event.success !== \"boolean\" ||\n\t\t\t(event.errorMessage !== undefined && typeof event.errorMessage !== \"string\")\n\t\t)\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC compaction event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"queue_update\") {\n\t\tif (!Array.isArray(event.steering) || !event.steering.every((item) => typeof item === \"string\"))\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC queue event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"tree_navigated\") {\n\t\tif (\n\t\t\ttypeof event.oldLeafId !== \"string\" ||\n\t\t\ttypeof event.newLeafId !== \"string\" ||\n\t\t\ttypeof event.selectedEntryId !== \"string\" ||\n\t\t\ttypeof event.restoredEditorText !== \"boolean\"\n\t\t)\n\t\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC tree event is invalid.\");\n\t\treturn;\n\t}\n\tif (type === \"usage_update\" && !objectRecord(event.usage)) {\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC usage event is invalid.\");\n\t}\n}\nfunction assertState(value: unknown): void {\n\tconst state = objectRecord(value);\n\tif (\n\t\t!state ||\n\t\ttypeof state.sessionId !== \"string\" ||\n\t\t!state.sessionId ||\n\t\ttypeof state.modelId !== \"string\" ||\n\t\t!state.modelId ||\n\t\ttypeof state.isStreaming !== \"boolean\" ||\n\t\t!Number.isInteger(state.messageCount) ||\n\t\t(state.messageCount as number) < 0\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC get_state response has an invalid state.\");\n}\nfunction assertAssistantMessage(value: unknown): void {\n\tconst message = objectRecord(value);\n\tif (\n\t\t!message ||\n\t\tmessage.role !== \"assistant\" ||\n\t\t!Array.isArray(message.content) ||\n\t\t!message.content.every((content) => {\n\t\t\tconst block = objectRecord(content);\n\t\t\tif (!block || typeof block.type !== \"string\") return false;\n\t\t\tif (block.type === \"text\") return typeof block.text === \"string\";\n\t\t\tif (block.type === \"thinking\") return typeof block.thinking === \"string\";\n\t\t\tif (block.type === \"tool_call\")\n\t\t\t\treturn typeof block.id === \"string\" && typeof block.name === \"string\" && objectRecord(block.arguments);\n\t\t\tif (block.type !== \"image\" || typeof block.data !== \"string\" || typeof block.mimeType !== \"string\") return false;\n\t\t\tconst padding = block.data.endsWith(\"==\") ? 2 : block.data.endsWith(\"=\") ? 1 : 0;\n\t\t\tconst decodedBytes = Math.floor((block.data.length * 3) / 4) - padding;\n\t\t\treturn (\n\t\t\t\t/^image\\/[A-Za-z0-9.+-]+$/.test(block.mimeType) &&\n\t\t\t\tblock.data.length > 0 &&\n\t\t\t\tblock.data.length % 4 === 0 &&\n\t\t\t\t/^[A-Za-z0-9+/]*={0,2}$/.test(block.data) &&\n\t\t\t\tdecodedBytes > 0 &&\n\t\t\t\tdecodedBytes <= RPC_MAX_ASSISTANT_IMAGE_BYTES\n\t\t\t);\n\t\t}) ||\n\t\ttypeof message.provider !== \"string\" ||\n\t\ttypeof message.model !== \"string\" ||\n\t\t!Number.isFinite(message.timestamp) ||\n\t\ttypeof message.stopReason !== \"string\" ||\n\t\t!ASSISTANT_STOP_REASONS.has(message.stopReason)\n\t)\n\t\tthrow new RpcProtocolError(\"INVALID_REQUEST\", \"RPC prompt response has an invalid message.\");\n}\nexport function rpcErrorResponse(error: RpcProtocolError): RpcErrorResponse {\n\treturn {\n\t\tversion: RPC_PROTOCOL_VERSION,\n\t\tkind: \"response\",\n\t\t...(error.requestId === undefined ? {} : { id: error.requestId }),\n\t\tok: false,\n\t\terror: { code: error.code, message: error.message },\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-factory.d.ts","sourceRoot":"","sources":["../../src/runtime/session-factory.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"session-factory.d.ts","sourceRoot":"","sources":["../../src/runtime/session-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,KAAK,sBAAsB,EAM3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAgB,KAAK,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEnG,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC/F,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC3C,kEAAkE;IAClE,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrD,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,CAAC,EAAE,sBAAsB,CAAC;CAC/C;AAaD;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,CAiErE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { agentSessionKey, compactionRegistryKey, networkCapabilityKey, processCapabilityKey, toolApprovalKey, toolOutputKey, toolPolicyKey, toolRegistryKey, workspaceCapabilityKey, } from "@di-code/builtins";
|
|
1
|
+
import { agentSessionKey, compactionRegistryKey, imageGenerationCapabilityKey, networkCapabilityKey, processCapabilityKey, toolApprovalKey, toolOutputKey, toolPolicyKey, toolRegistryKey, workspaceCapabilityKey, } from "@di-code/builtins";
|
|
2
2
|
import { createServiceKey } from "@di-code/plugin-runtime";
|
|
3
3
|
import { createSkillCatalog } from "@di-code/skills";
|
|
4
4
|
import { AgentSession } from "../core/session.js";
|
|
@@ -35,6 +35,7 @@ export function installAgentSessionFactory(context) {
|
|
|
35
35
|
policy: context.require(toolPolicyKey),
|
|
36
36
|
approval: options.toolApproval ?? context.require(toolApprovalKey),
|
|
37
37
|
output: context.require(toolOutputKey),
|
|
38
|
+
imageGeneration: context.get(imageGenerationCapabilityKey),
|
|
38
39
|
skills: skillCatalog,
|
|
39
40
|
}),
|
|
40
41
|
...(options.externalTools ?? []),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-factory.js","sourceRoot":"","sources":["../../src/runtime/session-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EAEpB,eAAe,EACf,aAAa,EACb,aAAa,EACb,eAAe,EACf,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAgB,gBAAgB,EAAiB,MAAM,yBAAy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AAS,CAAC;QACb,MAAM,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1F,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACpC,cAAc,CAAC,GAAG,CAAC,sBAAsB,EAAE;YAC1C,KAAK;SACL,CAAC,CAAC;QACH,OAAO,IAAI,YAAY,CAAC;YACvB,GAAG,OAAO;YACV,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9F,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,KAAK;YAC3D,SAAS,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE;SACzC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,IAAI,EAAE;QACjB,UAAU,EAAE,CAAC;QACb,KAAK,MAAM,cAAc,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC,OAAO,EAAE;YAAE,MAAM,cAAc,CAAC,OAAO,EAAE,CAAC;QAC5F,eAAe,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC,CAAC;AACH,CAAC","sourcesContent":["import {\n\tagentSessionKey,\n\tcompactionRegistryKey,\n\tnetworkCapabilityKey,\n\tprocessCapabilityKey,\n\ttype ToolApprovalCapability,\n\ttoolApprovalKey,\n\ttoolOutputKey,\n\ttoolPolicyKey,\n\ttoolRegistryKey,\n\tworkspaceCapabilityKey,\n} from \"@di-code/builtins\";\nimport { type Context, createServiceKey, type Disposer } from \"@di-code/plugin-runtime\";\nimport { createSkillCatalog } from \"@di-code/skills\";\nimport type { SkillResource } from \"../core/resources/types.ts\";\nimport { AgentSession, type AgentSessionOptions, type AgentSessionTool } from \"../core/session.ts\";\n\nexport interface CompositionSessionOptions extends Omit<AgentSessionOptions, \"tools\" | \"skills\"> {\n\treadonly skills?: readonly SkillResource[];\n\t/** MCP tools already adapted by the product integration layer. */\n\treadonly externalTools?: readonly AgentSessionTool[];\n\t/** Per-session approval boundary; defaults to the composition capability. */\n\treadonly toolApproval?: ToolApprovalCapability;\n}\n\ninterface SessionDependencies {\n\treadonly tools: readonly AgentSessionTool[];\n}\n\nconst sessionDependenciesKey = createServiceKey<SessionDependencies>(\"session-dependencies\");\n\nfunction asCompositionSessionOptions(value: unknown): CompositionSessionOptions {\n\tif (typeof value !== \"object\" || value === null) throw new TypeError(\"AgentSessionFactory options must be an object\");\n\treturn value as CompositionSessionOptions;\n}\n\n/**\n * Installs the product AgentSession implementation behind the composition factory.\n * Each session receives an isolated Context and immutable tool snapshot; the factory disposer releases all scopes.\n */\nexport function installAgentSessionFactory(context: Context): Disposer {\n\tconst factory = context.require(agentSessionKey);\n\tconst sessionContexts = new Set<Context>();\n\tlet nextSessionId = 0;\n\n\tconst unregister = factory.register((input) => {\n\t\tconst options = asCompositionSessionOptions(input);\n\t\tconst workspace = { ...context.require(workspaceCapabilityKey), allowedRoot: options.allowedRoot };\n\t\tconst skillCatalog = createSkillCatalog(\n\t\t\t(options.skills ?? []).map((skill) => ({\n\t\t\t\tskill: {\n\t\t\t\t\t...skill,\n\t\t\t\t\tsource:\n\t\t\t\t\t\tskill.source ?? (skill.scope === \"explicit\" ? \"explicit\" : skill.scope === \"project\" ? \"project\" : \"user\"),\n\t\t\t\t\tuserInvocable: skill.userInvocable ?? true,\n\t\t\t\t},\n\t\t\t\tdiagnostics: [],\n\t\t\t})),\n\t\t);\n\t\tconst tools = Object.freeze([\n\t\t\t...context.require(toolRegistryKey).snapshot({\n\t\t\t\tworkspace,\n\t\t\t\tprocess: context.require(processCapabilityKey),\n\t\t\t\tnetwork: context.require(networkCapabilityKey),\n\t\t\t\tpolicy: context.require(toolPolicyKey),\n\t\t\t\tapproval: options.toolApproval ?? context.require(toolApprovalKey),\n\t\t\t\toutput: context.require(toolOutputKey),\n\t\t\t\tskills: skillCatalog,\n\t\t\t}),\n\t\t\t...(options.externalTools ?? []),\n\t\t]);\n\t\tconst compaction = context\n\t\t\t.require(compactionRegistryKey)\n\t\t\t.snapshot()\n\t\t\t.find((entry) => entry.name === \"tool-result\");\n\t\tconst prepareMessages = compaction\n\t\t\t? async (messages: readonly import(\"@di-code/ai\").Message[], signal?: AbortSignal) => {\n\t\t\t\t\tconst result = await compaction.compact({ messages }, signal);\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof result !== \"object\" ||\n\t\t\t\t\t\tresult === null ||\n\t\t\t\t\t\t!Array.isArray((result as { readonly messages?: unknown }).messages)\n\t\t\t\t\t)\n\t\t\t\t\t\tthrow new TypeError(\"tool-result compaction contribution must return { messages }\");\n\t\t\t\t\treturn (result as { readonly messages: readonly import(\"@di-code/ai\").Message[] }).messages;\n\t\t\t\t}\n\t\t\t: undefined;\n\t\tconst sessionContext = context.child({ id: `session-${++nextSessionId}`, isolate: true });\n\t\tsessionContexts.add(sessionContext);\n\t\tsessionContext.set(sessionDependenciesKey, {\n\t\t\ttools,\n\t\t});\n\t\treturn new AgentSession({\n\t\t\t...options,\n\t\t\t...(prepareMessages ? { compaction: { ...(options.compaction ?? {}), prepareMessages } } : {}),\n\t\t\ttools: sessionContext.require(sessionDependenciesKey).tools,\n\t\t\tonDispose: () => sessionContext.dispose(),\n\t\t});\n\t});\n\treturn async () => {\n\t\tunregister();\n\t\tfor (const sessionContext of [...sessionContexts].reverse()) await sessionContext.dispose();\n\t\tsessionContexts.clear();\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-factory.js","sourceRoot":"","sources":["../../src/runtime/session-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,qBAAqB,EACrB,4BAA4B,EAC5B,oBAAoB,EACpB,oBAAoB,EAEpB,eAAe,EACf,aAAa,EACb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,OAAO,CAAE,MAA0C,CAAC,QAAQ,CAAC;oBAEpE,MAAM,IAAI,SAAS,CAAC,8DAA8D,CAAC,CAAC;gBACrF,OAAQ,MAA0E,CAAC,QAAQ,CAAC;YAC7F,CAAC;YACF,CAAC,CAAC,SAAS,CAAC;QACb,MAAM,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1F,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACpC,cAAc,CAAC,GAAG,CAAC,sBAAsB,EAAE;YAC1C,KAAK;SACL,CAAC,CAAC;QACH,OAAO,IAAI,YAAY,CAAC;YACvB,GAAG,OAAO;YACV,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9F,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,KAAK;YAC3D,SAAS,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE;SACzC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,IAAI,EAAE;QACjB,UAAU,EAAE,CAAC;QACb,KAAK,MAAM,cAAc,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC,OAAO,EAAE;YAAE,MAAM,cAAc,CAAC,OAAO,EAAE,CAAC;QAC5F,eAAe,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC,CAAC;AACH,CAAC","sourcesContent":["import {\n\tagentSessionKey,\n\tcompactionRegistryKey,\n\timageGenerationCapabilityKey,\n\tnetworkCapabilityKey,\n\tprocessCapabilityKey,\n\ttype ToolApprovalCapability,\n\ttoolApprovalKey,\n\ttoolOutputKey,\n\ttoolPolicyKey,\n\ttoolRegistryKey,\n\tworkspaceCapabilityKey,\n} from \"@di-code/builtins\";\nimport { type Context, createServiceKey, type Disposer } from \"@di-code/plugin-runtime\";\nimport { createSkillCatalog } from \"@di-code/skills\";\nimport type { SkillResource } from \"../core/resources/types.ts\";\nimport { AgentSession, type AgentSessionOptions, type AgentSessionTool } from \"../core/session.ts\";\n\nexport interface CompositionSessionOptions extends Omit<AgentSessionOptions, \"tools\" | \"skills\"> {\n\treadonly skills?: readonly SkillResource[];\n\t/** MCP tools already adapted by the product integration layer. */\n\treadonly externalTools?: readonly AgentSessionTool[];\n\t/** Per-session approval boundary; defaults to the composition capability. */\n\treadonly toolApproval?: ToolApprovalCapability;\n}\n\ninterface SessionDependencies {\n\treadonly tools: readonly AgentSessionTool[];\n}\n\nconst sessionDependenciesKey = createServiceKey<SessionDependencies>(\"session-dependencies\");\n\nfunction asCompositionSessionOptions(value: unknown): CompositionSessionOptions {\n\tif (typeof value !== \"object\" || value === null) throw new TypeError(\"AgentSessionFactory options must be an object\");\n\treturn value as CompositionSessionOptions;\n}\n\n/**\n * Installs the product AgentSession implementation behind the composition factory.\n * Each session receives an isolated Context and immutable tool snapshot; the factory disposer releases all scopes.\n */\nexport function installAgentSessionFactory(context: Context): Disposer {\n\tconst factory = context.require(agentSessionKey);\n\tconst sessionContexts = new Set<Context>();\n\tlet nextSessionId = 0;\n\n\tconst unregister = factory.register((input) => {\n\t\tconst options = asCompositionSessionOptions(input);\n\t\tconst workspace = { ...context.require(workspaceCapabilityKey), allowedRoot: options.allowedRoot };\n\t\tconst skillCatalog = createSkillCatalog(\n\t\t\t(options.skills ?? []).map((skill) => ({\n\t\t\t\tskill: {\n\t\t\t\t\t...skill,\n\t\t\t\t\tsource:\n\t\t\t\t\t\tskill.source ?? (skill.scope === \"explicit\" ? \"explicit\" : skill.scope === \"project\" ? \"project\" : \"user\"),\n\t\t\t\t\tuserInvocable: skill.userInvocable ?? true,\n\t\t\t\t},\n\t\t\t\tdiagnostics: [],\n\t\t\t})),\n\t\t);\n\t\tconst tools = Object.freeze([\n\t\t\t...context.require(toolRegistryKey).snapshot({\n\t\t\t\tworkspace,\n\t\t\t\tprocess: context.require(processCapabilityKey),\n\t\t\t\tnetwork: context.require(networkCapabilityKey),\n\t\t\t\tpolicy: context.require(toolPolicyKey),\n\t\t\t\tapproval: options.toolApproval ?? context.require(toolApprovalKey),\n\t\t\t\toutput: context.require(toolOutputKey),\n\t\t\t\timageGeneration: context.get(imageGenerationCapabilityKey),\n\t\t\t\tskills: skillCatalog,\n\t\t\t}),\n\t\t\t...(options.externalTools ?? []),\n\t\t]);\n\t\tconst compaction = context\n\t\t\t.require(compactionRegistryKey)\n\t\t\t.snapshot()\n\t\t\t.find((entry) => entry.name === \"tool-result\");\n\t\tconst prepareMessages = compaction\n\t\t\t? async (messages: readonly import(\"@di-code/ai\").Message[], signal?: AbortSignal) => {\n\t\t\t\t\tconst result = await compaction.compact({ messages }, signal);\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof result !== \"object\" ||\n\t\t\t\t\t\tresult === null ||\n\t\t\t\t\t\t!Array.isArray((result as { readonly messages?: unknown }).messages)\n\t\t\t\t\t)\n\t\t\t\t\t\tthrow new TypeError(\"tool-result compaction contribution must return { messages }\");\n\t\t\t\t\treturn (result as { readonly messages: readonly import(\"@di-code/ai\").Message[] }).messages;\n\t\t\t\t}\n\t\t\t: undefined;\n\t\tconst sessionContext = context.child({ id: `session-${++nextSessionId}`, isolate: true });\n\t\tsessionContexts.add(sessionContext);\n\t\tsessionContext.set(sessionDependenciesKey, {\n\t\t\ttools,\n\t\t});\n\t\treturn new AgentSession({\n\t\t\t...options,\n\t\t\t...(prepareMessages ? { compaction: { ...(options.compaction ?? {}), prepareMessages } } : {}),\n\t\t\ttools: sessionContext.require(sessionDependenciesKey).tools,\n\t\t\tonDispose: () => sessionContext.dispose(),\n\t\t});\n\t});\n\treturn async () => {\n\t\tunregister();\n\t\tfor (const sessionContext of [...sessionContexts].reverse()) await sessionContext.dispose();\n\t\tsessionContexts.clear();\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{color:#18202a;font-synthesis:none;--ink:#18202a;--muted:#77808c;--line:#e6e8eb;--sidebar:#f1f3f5;--surface:#fff;--accent:#2957d6;--accent-soft:#e9efff;background:#f7f8fa;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}*{box-sizing:border-box}body{background:#f7f8fa;min-width:320px;min-height:100vh;margin:0;overflow:hidden}button,textarea,input{font:inherit}button{cursor:pointer;border:0}button:focus-visible,input:focus-visible,textarea:focus-visible{outline-offset:2px;outline:2px solid #5b7bea}.app-shell{grid-template-columns:264px minmax(0,1fr);height:100vh;min-height:0;display:grid;overflow:hidden}.app-shell.sidebar-collapsed{grid-template-columns:68px minmax(0,1fr)}.sidebar{background:var(--sidebar);border-right:1px solid var(--line);flex-direction:column;min-height:0;padding:16px 12px 12px;display:flex;overflow:hidden}.sidebar-topline{align-items:center;gap:9px;height:34px;padding:0 4px;display:flex}.mark{color:#fff;background:#1e2732;border-radius:7px;flex:none;place-items:center;width:26px;height:26px;display:grid}.wordmark{flex:1;font-size:15px;font-weight:700}.icon-button{color:#6f7884;background:0 0;border-radius:6px;flex:none;place-items:center;width:32px;height:32px;display:inline-grid}.icon-button:hover,.icon-button.is-active{color:var(--ink);background:#e4e7eb}.workspace-switcher{text-align:left;width:100%;color:var(--ink);background:0 0;border-radius:6px;align-items:center;gap:9px;margin-top:22px;padding:8px;font-size:13px;display:flex}.workspace-switcher:hover{background:#e7eaed}.workspace-avatar{color:#fff;background:#3c7b6e;border-radius:6px;place-items:center;width:23px;height:23px;font-size:11px;font-weight:700;display:grid}.workspace-name{min-width:0;color:inherit;appearance:none;cursor:pointer;background:0 0;border:0;outline:0;flex:1;font-weight:600}.workspace-switcher svg{pointer-events:none;flex:none}.new-session{color:#fff;background:#25303c;border-radius:6px;align-items:center;gap:9px;width:100%;margin-top:18px;padding:10px 9px;font-size:13px;display:flex}.new-session:hover{background:#344151}.shortcut{color:#aeb7c2;margin-left:auto;font-size:11px}.session-search{color:#8c949f;background:#e8ebee;border-radius:6px;align-items:center;gap:8px;height:34px;margin-top:12px;padding:0 9px;display:flex}.session-search input{width:100%;min-width:0;color:var(--ink);background:0 0;border:0;outline:0;font-size:12px}.session-search input::placeholder{color:#8c949f}.session-heading{color:#8b939e;text-transform:uppercase;letter-spacing:.06em;align-items:center;gap:7px;margin:24px 9px 8px;font-size:11px;font-weight:650;display:flex}.session-count{color:#9da4ad}.session-tree{flex:1;min-height:90px;overflow:auto}.tree-placeholder{color:#a0a8b1;margin:0;padding:12px 10px;font-size:12px;line-height:1.45}.session-item{color:#66707c;text-align:left;background:0 0;border-radius:5px;align-items:center;gap:8px;width:100%;padding:8px 9px;font-size:12px;display:flex}.session-item:hover{color:var(--ink);background:#e4e7ea}.session-item span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.sidebar-footer{border-top:1px solid #e1e4e7;gap:2px;padding-top:12px;display:grid}.footer-button{color:#6f7884;text-align:left;background:0 0;border-radius:5px;align-items:center;gap:9px;padding:9px;font-size:12px;display:flex}.footer-button:hover{color:var(--ink);background:#e5e8eb}.is-collapsed .sidebar-topline{justify-content:center}.is-collapsed .icon-button{display:none}.is-collapsed .sidebar-topline .icon-button{display:inline-grid}.collapsed-actions{justify-items:center;gap:8px;margin-top:20px;display:grid}.main-column{flex-direction:column;min-width:0;min-height:0;display:flex;overflow:hidden}.workspace-bar{border-bottom:1px solid var(--line);background:#ffffffc7;align-items:center;gap:10px;height:58px;padding:0 22px;display:flex}.workspace-bar>.icon-button{display:none}.bar-title{align-items:center;gap:8px;font-size:13px;font-weight:650;display:flex}.bar-title-dot{background:#3c7b6e;border-radius:50%;width:8px;height:8px}.bar-actions{align-items:center;gap:4px;margin-left:auto;display:flex}.bar-action{color:#6e7783;background:0 0;border-radius:5px;align-items:center;gap:7px;padding:7px 10px;font-size:12px;display:flex}.bar-action:hover{color:var(--ink);background:#f0f2f4}.main-content{flex-direction:column;flex:1;min-height:0;display:flex;position:relative;overflow-y:auto}.empty-state{text-align:center;width:min(560px,100% - 40px);margin:auto;transform:translateY(-6vh)}.empty-icon{color:#536273;background:#e9edf1;border:1px solid #dde2e7;border-radius:12px;place-items:center;width:46px;height:46px;margin:0 auto 18px;display:grid}.empty-state h1{margin:0;font-size:26px;font-weight:680;line-height:1.2}.empty-state p{max-width:420px;color:var(--muted);margin:12px auto 18px;font-size:14px;line-height:1.5}.example-link{color:var(--accent);background:var(--accent-soft);border-radius:5px;align-items:center;gap:6px;padding:7px 10px;font-size:12px;display:inline-flex}.composer-wrap{width:min(760px,100% - 40px);margin:auto auto 24px}.composer{background:var(--surface);border:1px solid #d9dde2;border-radius:9px;box-shadow:0 5px 20px #26303e0f}.composer textarea{resize:none;width:100%;min-height:58px;max-height:180px;color:var(--ink);background:0 0;border:0;outline:0;padding:15px 16px 8px;font-size:14px;display:block}.composer textarea::placeholder{color:#9aa2ad}.composer-toolbar{align-items:center;gap:3px;padding:7px 9px 9px;display:flex}.composer-tool{color:#788390;background:0 0;border-radius:5px;place-items:center;width:29px;height:29px;display:grid}.composer-spacer{flex:1}.model-select{color:#727c88;background:0 0;border-radius:5px;align-items:center;gap:6px;padding:6px 8px;font-size:11px;display:flex}.send-button{color:#fff;background:#25303c;border-radius:6px;place-items:center;width:30px;height:30px;display:grid}.send-button:disabled{color:#b7bec6;background:#e3e6e9}.composer-note{color:#a5acb5;text-align:center;margin:8px 0 0;font-size:10px}.loading-state{color:var(--muted);margin:auto;font-size:13px}.connection-banner{color:#90534f;background:#fff3f1;border:1px solid #f1d6d1;border-radius:6px;margin:16px auto 0;padding:9px 12px;font-size:12px}.session-item.is-active{color:var(--ink);background:#e4e7ea}.workspace-heading{color:#8b939e;text-transform:uppercase;letter-spacing:.06em;align-items:center;gap:7px;margin:22px 9px 8px;font-size:11px;font-weight:650;display:flex}.workspace-heading-actions{align-items:center;gap:1px;margin-left:auto;display:inline-flex}.workspace-heading-actions .icon-button{width:28px;height:28px}.workspace-add-overlay{z-index:30;background:#191f2640;place-items:center;padding:24px;display:grid;position:fixed;inset:0}.workspace-add-dialog{width:min(420px,100%);color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:18px;box-shadow:0 16px 48px #12192133}.workspace-pick-button{width:100%;color:var(--ink);border:1px solid var(--line);background:#f0f2f4;border-radius:5px;align-items:center;gap:7px;margin-top:18px;padding:10px 12px;font-size:12px;display:inline-flex}.workspace-pick-button:hover{background:#e7eaed}.workspace-drop-zone{color:var(--muted);text-align:center;border:1px dashed #b9c2cc;border-radius:6px;justify-items:center;gap:6px;margin-top:16px;padding:22px 12px;display:grid}.workspace-drop-zone svg{color:#5a789d}.workspace-drop-zone span{color:var(--ink);font-size:12px}.workspace-drop-zone small{font-size:11px}.workspace-add-header{border-bottom:1px solid var(--line);justify-content:space-between;align-items:flex-start;padding-bottom:14px;display:flex}.workspace-add-header h2{margin:0;font-size:18px}.workspace-add-note{color:var(--muted);margin:16px 0 0;font-size:12px;line-height:1.5}.workspace-add-field{color:var(--muted);gap:7px;margin-top:18px;font-size:12px;display:grid}.workspace-add-field input{width:100%;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:5px;padding:9px 10px;font-size:13px}.workspace-add-error{color:#9b453e;margin:10px 0 0;font-size:12px}.workspace-add-actions{justify-content:flex-end;gap:8px;margin-top:18px;display:flex}.workspace-add-actions button{color:var(--muted);background:0 0;border-radius:5px;padding:7px 11px;font-size:12px}.workspace-add-actions button:hover{color:var(--ink);background:#f0f2f4}.workspace-add-actions .workspace-add-submit{color:#fff;background:#25303c}.workspace-add-actions .workspace-add-submit:disabled{color:#aab2bb;cursor:not-allowed;background:#e3e6e9}.workspace-search{margin-top:0}.workspace-list{flex:1;min-height:90px;padding:2px 0 10px;overflow:auto}.workspace-section{margin:2px 0}.workspace-section-header-wrap{border-radius:6px;align-items:center;min-width:0;display:flex;position:relative}.workspace-section-header-wrap:hover,.workspace-section.is-active>.workspace-section-header-wrap{background:#e4e7ea}.workspace-section-header{color:#5f6975;text-align:left;background:0 0;border-radius:6px;flex:1;align-items:center;gap:8px;min-width:0;padding:8px;font-size:13px;display:flex}.workspace-section-header-wrap:hover .workspace-section-header,.workspace-section.is-active>.workspace-section-header-wrap .workspace-section-header{color:var(--ink)}.workspace-folder-icon{color:#65717e;flex:none;place-items:center;width:17px;height:17px;display:grid;position:relative}.workspace-folder-icon>svg:last-child{display:none;position:absolute}.workspace-section-header-wrap:hover .workspace-folder-icon>svg:first-child{display:none}.workspace-section-header-wrap:hover .workspace-folder-icon>svg:last-child{display:block}.workspace-section.is-active>.workspace-section-header-wrap .workspace-folder-icon{color:#376fda}.workspace-section-name{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-weight:600;overflow:hidden}.workspace-session-count{color:#929aa5;font-size:11px}.workspace-row-actions{opacity:0;align-items:center;gap:1px;padding-right:4px;display:inline-flex}.workspace-section-header-wrap:hover .workspace-row-actions,.workspace-section.is-active>.workspace-section-header-wrap .workspace-row-actions,.workspace-row-actions:focus-within{opacity:1}.workspace-row-actions .icon-button{width:26px;height:26px}.workspace-menu-anchor{position:relative}.workspace-action-menu{z-index:9;min-width:132px;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:6px;gap:2px;padding:5px;display:grid;position:absolute;top:calc(100% + 3px);right:0;box-shadow:0 10px 28px #17202b29}.workspace-action-menu button{color:inherit;text-align:left;background:0 0;border-radius:4px;padding:7px 8px;font-size:11px}.workspace-action-menu button:hover{background:#f0f2f4}.workspace-inline-name{border:1px solid var(--line);min-width:0;color:var(--ink);background:var(--surface);border-radius:4px;flex:1;padding:3px 5px;font-size:12px}.workspace-section-sessions{padding:0 0 4px 17px}.workspace-section-sessions .session-tree{min-height:0;overflow:visible}.workspace-section-sessions .session-item{padding-top:7px;padding-bottom:7px}.workspace-section-sessions .session-item-actions{margin-right:2px}.session-search svg{flex:none}.session-item-wrap{align-items:center;gap:2px;min-width:0;display:flex;position:relative}.session-item-wrap .session-item{flex:1;min-width:0}.session-item-actions{opacity:0;flex:none;display:flex;position:relative}.session-item-wrap:hover .session-item-actions,.session-item-wrap.is-active .session-item-actions,.session-item-actions:focus-within{opacity:1}.session-item-actions button{color:var(--muted);background:0 0;border:0;padding:4px}.session-more{border-radius:4px;place-items:center;display:grid}.session-more:hover,.session-more:focus-visible{color:var(--ink);background:#e4e7eb}.session-action-menu{z-index:9;background:var(--surface);border:1px solid var(--line);border-radius:6px;gap:2px;min-width:128px;padding:5px;display:grid;position:absolute;top:calc(100% + 3px);right:0;box-shadow:0 10px 28px #17202b29}.session-action-menu button{width:100%;color:var(--ink);text-align:left;border-radius:4px;align-items:center;gap:7px;padding:7px 8px;font-size:11px;display:flex}.session-action-menu button:hover{background:#f0f2f4}.session-filters{gap:4px;margin:6px 0;display:flex}.session-filters button{border:1px solid var(--line);color:var(--muted);background:0 0;border-radius:4px;padding:3px 7px;font-size:11px}.session-filters .is-selected{background:var(--accent-soft);color:var(--ink)}.session-inspect{z-index:20;background:var(--surface);border:1px solid var(--line);padding:18px;position:fixed;inset:12% 10%;overflow:auto;box-shadow:0 20px 60px #12192133}.session-inspect pre{white-space:pre-wrap;font-size:11px}.cancel-button{background:#9b453e}.attachment-input{display:none}.attachment-tray{flex-wrap:wrap;gap:6px;padding:10px 12px 0;display:flex}.attachment-chip{color:#536273;background:#edf0f3;border:1px solid #dfe4e8;border-radius:5px;align-items:center;gap:5px;max-width:100%;padding:5px 6px;font-size:11px;display:inline-flex}.attachment-chip span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.attachment-chip button{color:inherit;background:0 0;padding:1px;display:grid}.attachment-chip img{object-fit:cover;border-radius:3px;width:18px;height:18px}.connection-state{color:#5c6671;background:#eff2f5;border:1px solid #dbe0e5;border-radius:6px;align-self:center;margin-top:16px;padding:9px 12px;font-size:12px}.transcript{overflow-wrap:anywhere;gap:22px;width:min(760px,100% - 40px);margin:26px auto 16px;display:grid}.conversation-tabs{border-bottom:1px solid var(--line);gap:18px;width:min(760px,100% - 40px);margin:18px auto 0;display:flex}.conversation-tabs button{color:var(--muted);background:0 0;border-bottom:2px solid #0000;padding:9px 2px 10px;font-size:12px}.conversation-tabs button.is-selected{color:var(--ink);border-bottom-color:var(--accent);font-weight:650}.trajectory{gap:10px;width:min(760px,100% - 40px);min-height:180px;margin:18px auto 16px;display:grid;overflow:auto}.trajectory-row{color:var(--muted);grid-template-columns:18px minmax(0,1fr);align-items:start;gap:8px;font-size:12px;display:grid}.trajectory-row>svg{margin-top:10px}.trajectory-empty{color:var(--muted);font-size:13px}.trajectory-context,.trajectory-row.compaction-running,.trajectory-row.compaction-success,.trajectory-row.compaction-error{border:1px solid var(--line);background:var(--surface);border-radius:6px;padding:10px 12px}.trajectory-context summary{cursor:pointer;color:var(--ink);align-items:center;gap:7px;display:flex}.trajectory-context ul{gap:4px;margin:8px 0 0;padding-left:22px;display:grid}.trajectory-context li{color:var(--muted);justify-content:space-between;gap:8px;display:flex}.trajectory-context code{color:var(--ink);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.tool-card{border:1px solid var(--line);background:var(--surface);min-width:0;color:var(--ink);border-radius:7px;overflow:hidden}.tool-card-header{align-items:center;gap:7px;padding:10px 12px;display:flex}.tool-icon{color:#2f7a65;place-items:center;display:inline-grid}.tool-error .tool-icon,.tool-timeout .tool-icon,.tool-cancelled .tool-icon{color:#a04e48}.tool-status{color:var(--muted);margin-left:auto;font-size:11px}.tool-card-details,.tool-output,.tool-diff{border-top:1px solid var(--line);padding:8px 12px}.tool-card-details summary,.tool-output summary,.tool-diff summary{cursor:pointer;color:var(--muted);align-items:center;gap:5px;font-size:11px;display:flex}.tool-card pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:220px;color:var(--ink);margin:8px 0 0;font:11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;overflow:auto}.approval-bar{gap:6px;width:min(760px,100% - 40px);margin:0 auto 10px;display:grid}.approval-item{color:#77501f;background:#fff8e8;border:1px solid #ead9ad;border-radius:6px;flex-wrap:wrap;align-items:center;gap:8px;padding:10px 12px;font-size:12px;display:flex}.approval-item button{color:var(--ink);background:var(--surface);border:1px solid #d8cda9;border-radius:4px;align-items:center;gap:4px;padding:5px 8px;font-size:11px;display:inline-flex}.approval-item button:first-of-type{margin-left:auto}.approval-item code{color:#9a8864;font-size:10px}.spin{animation:.9s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.conversation-empty{color:var(--muted);margin:auto;font-size:13px}.message{gap:7px;display:grid}.message-user{background:#edf1f5;border-radius:7px;justify-self:end;max-width:min(88%,620px);padding:12px 14px}.message-label{color:var(--muted);font-size:11px;font-weight:700}.message-body{font-size:14px;line-height:1.65}.message-user .message-body{white-space:pre-wrap}.message-body>:first-child{margin-top:0}.message-body>:last-child{margin-bottom:0}.message-body p,.message-body ul,.message-body ol,.message-body blockquote,.message-body pre,.message-body table{margin:0 0 12px}.message-body h1,.message-body h2,.message-body h3,.message-body h4,.message-body h5,.message-body h6{color:var(--ink);margin:18px 0 8px;line-height:1.3}.message-body h1{font-size:22px}.message-body h2{font-size:19px}.message-body h3{font-size:16px}.message-body h4,.message-body h5,.message-body h6{font-size:14px}.message-body ul,.message-body ol{padding-left:24px}.message-body li+li{margin-top:4px}.message-body input[type=checkbox]{accent-color:var(--accent);margin:0 6px 0 0}.message-body a{color:var(--accent);text-underline-offset:2px;text-decoration:underline}.message-body a:hover{color:#1d45b5}.message-body :not(pre)>code{color:#4d5d70;background:#edf0f3;border:1px solid #e0e4e8;border-radius:4px;padding:2px 4px;font:.9em ui-monospace,SFMono-Regular,Consolas,monospace}.message-body pre{color:#dce5ee;background:#202a35;border-radius:6px;padding:12px;overflow:auto}.message-body pre code{font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace}.message-body blockquote{color:#566575;border-left:3px solid #aebdce;padding:2px 0 2px 12px}.message-body hr{background:var(--line);border:0;height:1px;margin:16px 0}.message-body table{border-spacing:0;border-collapse:collapse;max-width:100%;display:block;overflow-x:auto}.message-body th,.message-body td{border:1px solid var(--line);text-align:left;vertical-align:top;padding:7px 9px}.message-body th{background:#f2f4f6;font-weight:650}.message-skill{color:#536e9d;align-items:center;gap:6px;min-width:0;font-size:12px;display:inline-flex}.message-skill code{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:inherit;overflow:hidden}.message-images{grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:8px;display:grid}.message-images img{object-fit:contain;background:#fff;border:1px solid #d8dde2;border-radius:5px;max-width:100%;max-height:360px;display:block}.tool-images{gap:8px;margin-top:8px;display:grid}.tool-images img{object-fit:contain;background:#fff;border:1px solid #d8dde2;border-radius:5px;max-width:100%;max-height:360px;display:block}.message-error{color:#8f3833;background:#fff2f0;border:1px solid #efcbc7;border-radius:6px;padding:10px 12px}.message-error .message-label{color:#9b453e}.thinking{color:#586574;background:#f3f5f7;border:1px solid #e1e5e8;border-radius:6px;padding:8px 10px;font-size:12px}.thinking summary{cursor:pointer;align-items:center;gap:6px;display:flex}.thinking pre{white-space:pre-wrap;font:inherit;margin:8px 0 0;line-height:1.55}.message-retry,.runtime-action{color:#55616e;background:#edf0f3;border-radius:5px;justify-content:center;align-items:center;gap:6px;width:fit-content;padding:6px 8px;font-size:11px;display:inline-flex}.runtime-controls{width:min(760px,100% - 40px);color:var(--muted);flex-wrap:wrap;align-items:center;gap:8px;margin:auto auto 10px;font-size:11px;display:flex}.usage{align-items:center;gap:6px;margin-right:auto;display:inline-flex}.usage span{border-left:1px solid var(--line);padding-left:6px}.runtime-action.danger,.runtime-error{color:#9b453e}.runtime-action.danger{background:#fff0ee}.overlay{z-index:10;background:#191f2642;place-items:center;padding:24px;display:grid;position:fixed;inset:0}.settings-panel{background:#fff;border:1px solid #dfe3e7;border-radius:10px;grid-template-columns:170px minmax(0,1fr);width:min(680px,100%);max-height:min(700px,100vh - 48px);display:grid;overflow:hidden;box-shadow:0 16px 50px #1219212e}.settings-header{border-bottom:1px solid var(--line);grid-column:1/-1;justify-content:space-between;align-items:flex-start;padding:22px;display:flex}.eyebrow{color:#9099a4;letter-spacing:.08em;text-transform:uppercase;margin:0 0 5px;font-size:10px;font-weight:700}.settings-header h2{margin:0;font-size:20px}.settings-nav{border-right:1px solid var(--line);background:#f7f8fa;padding:16px 10px}.settings-nav-item{color:#707a86;text-align:left;background:0 0;border-radius:5px;width:100%;padding:9px 10px;font-size:12px}.settings-nav-item.is-selected,.settings-nav-item:hover{color:var(--ink);background:#e8ecf2;font-weight:600}.settings-content{padding:16px 22px;overflow:auto}.setting-row{border-bottom:1px solid var(--line);justify-content:space-between;align-items:center;gap:24px;padding:18px 0;display:flex}.setting-row>div:first-child{gap:5px;display:grid}.setting-row strong{font-size:13px}.setting-row span{color:var(--muted);font-size:11px}.setting-row code{color:#536273;background:#f1f3f5;border-radius:4px;padding:5px 7px;font-size:11px}.theme-options{gap:4px;display:flex!important}.theme-option{color:#78828e;background:#f3f5f7;border-radius:5px;align-items:center;gap:5px;padding:7px 8px;font-size:11px;display:inline-flex}.theme-option.is-selected{color:#254aab;background:#e7edff}@media (width<=800px){.app-shell,.app-shell.sidebar-collapsed{grid-template-columns:1fr}.sidebar{z-index:5;width:264px;transition:transform .18s;position:fixed;inset:0 auto 0 0;transform:translate(-101%);box-shadow:8px 0 24px #191f2614}.app-shell:not(.sidebar-collapsed) .sidebar{transform:translate(0)}.app-shell:not(.sidebar-collapsed):after{content:"";z-index:4;background:#191f262e;position:fixed;inset:0}.workspace-bar{padding:0 14px}.workspace-bar>.icon-button{display:inline-grid}.bar-actions .bar-action{display:none}.empty-state{transform:translateY(-4vh)}.composer-wrap{width:calc(100% - 24px);margin-bottom:14px}}@media (width<=480px){.workspace-bar{height:52px}.main-content{min-height:calc(100vh - 52px)}.empty-state{width:calc(100% - 32px)}.empty-state h1{font-size:22px}.empty-state p{font-size:13px}.composer textarea{min-height:52px}.settings-panel{grid-template-columns:1fr;max-height:calc(100vh - 24px)}.settings-nav{border-right:0;border-bottom:1px solid var(--line);gap:4px;display:flex;overflow-x:auto}.settings-nav-item{white-space:nowrap;width:auto}.settings-content{padding:8px 18px 18px}.setting-row{flex-direction:column;align-items:flex-start;gap:12px}.theme-options{flex-wrap:wrap}}@media (prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@media (prefers-color-scheme:dark){:root{color:#e7ebf0;--ink:#e7ebf0;--muted:#9ca6b2;--line:#303842;--sidebar:#20262d;--surface:#242b33;--accent-soft:#283a6e;background:#1b2026}body{background:#1b2026}.workspace-bar{background:#1c2229e6}.mark,.new-session{background:#10161c}.session-search{background:#2b323a}.composer,.settings-panel{background:#242b33;border-color:#3a434e}.settings-nav{background:#20262d;border-color:#303842}.setting-row code,.theme-option{background:#303842}.empty-icon{color:#c5cfda;background:#303842;border-color:#3b4550}}[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}[data-theme=light] body{background:#f7f8fa}[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--ink:#e7ebf0;--muted:#9ca6b2;--line:#303842;--sidebar:#20262d;--surface:#242b33;--accent-soft:#283a6e;background:#1b2026}[data-theme=dark] body{background:#1b2026}[data-theme=dark] .workspace-bar{background:#1c2229e6}[data-theme=dark] .sidebar{border-color:#303842}[data-theme=dark] .mark,[data-theme=dark] .new-session{background:#10161c}[data-theme=dark] .session-search{background:#2b323a}[data-theme=dark] .composer,[data-theme=dark] .settings-panel{background:#242b33;border-color:#3a434e}[data-theme=dark] .settings-nav{background:#20262d;border-color:#303842}[data-theme=dark] .setting-row code,[data-theme=dark] .theme-option{background:#303842}[data-theme=dark] .empty-icon{color:#c5cfda;background:#303842;border-color:#3b4550}.web-slot-sidebar,.web-slot-session-tree,.web-slot-settings{gap:6px;margin:8px 0;display:grid}.web-contribution-slot{max-width:100%;display:inline-flex}.web-contribution-badge,.web-contribution-tool{color:var(--muted);font-size:11px}.web-contribution-link{color:var(--accent);text-align:left;background:0 0;font-size:11px}.web-contribution-node{color:var(--muted);background:var(--surface);border-left:2px solid var(--accent);margin:6px 0;padding:6px 8px;font-size:11px}.app-shell.is-hero .main-column{background:var(--surface)}.app-shell.is-hero .main-content{overflow:hidden}.app-shell.is-hero .runtime-controls{display:none}.app-shell.is-hero .composer-wrap{margin:0 auto}.main-content.is-hero{justify-content:center}.main-content.is-hero .empty-state{margin:0 auto 18px;transform:none}.empty-brand{color:var(--ink);align-items:center;gap:8px;margin-bottom:18px;font-size:24px;font-weight:650;display:inline-flex}.empty-brand svg{color:#202936}.empty-brand small{color:#4770ba;background:#eaf0ff;border-radius:5px;padding:3px 6px;font-size:10px;font-weight:600}.hero-picker-row{justify-content:center;gap:18px;margin-top:30px;display:flex}.hero-picker{color:#596574;background:0 0;align-items:center;gap:6px;padding:5px 4px;font-size:12px;display:inline-flex}.hero-picker:hover{color:var(--ink)}.composer-hero{width:min(780px,100% - 40px);margin:0 auto}.composer-hero .composer{box-shadow:0 8px 32px #3657a01f}.composer-hero .composer-toolbar{padding-bottom:11px}.composer-hero textarea{min-height:68px;font-size:15px}.access-mode{color:#6e7783;background:0 0;border-radius:5px;align-items:center;gap:5px;padding:6px 7px;font-size:11px;display:inline-flex}.access-mode:hover,.model-select:hover,.context-meter:hover{color:var(--ink);background:#f0f2f4}.context-meter{color:#737e8a;background:0 0;border-radius:5px;min-width:31px;padding:6px;font-size:11px}.composer-menu-anchor{display:inline-flex;position:relative}.composer-menu{z-index:8;min-width:188px;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:7px;gap:2px;padding:6px;display:grid;position:absolute;bottom:calc(100% + 8px);left:0;box-shadow:0 10px 28px #17202b24}.composer-menu-right{left:auto;right:0}.composer-menu button{width:100%;color:inherit;text-align:left;background:0 0;border-radius:4px;align-items:center;gap:8px;padding:8px;font-size:12px;display:flex}.composer-menu button:hover{background:#f0f2f4}.composer-command-menu button.is-selected{background:#e8ecf2}.composer-menu button:disabled{cursor:not-allowed;opacity:.48}.composer-command-menu{min-width:236px;max-height:min(380px,100vh - 140px);overflow-y:auto}.composer-command-menu .menu-item-copy strong{color:var(--ink);font-size:12px;font-weight:600}.composer-menu p,.composer-menu span,.composer-menu strong{margin:2px 4px;font-size:11px;line-height:1.45}.composer-menu p,.composer-menu span{color:var(--muted)}.menu-item-copy{flex:1;gap:1px;display:grid;color:var(--ink)!important;font-size:12px!important}.menu-item-copy small{color:var(--muted);font-size:10px}.menu-item-skill small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.composer-model-menu{max-height:min(380px,100vh - 140px);overflow-y:auto}.composer-model-menu .menu-back{border-bottom:1px solid var(--line);border-radius:0;margin-bottom:4px}.model-group+.model-group{border-top:1px solid var(--line);margin-top:4px;padding-top:4px}.composer-menu .model-group>p{color:var(--muted);letter-spacing:.04em;text-transform:uppercase;margin:5px 8px 3px;font-size:10px;font-weight:700}.composer-menu .model-group button{justify-content:space-between}.composer-menu .model-group button[aria-checked=true]{color:#254aab;background:#eaf0ff}.composer-session-meta{min-height:34px;color:var(--muted);border-top:1px solid var(--line);align-items:center;gap:8px;padding:5px 12px 6px;font-size:11px;display:flex}.composer-session-meta>span:not(.composer-spacer){align-items:center;gap:4px;display:inline-flex}.composer-session-meta>span:not(.composer-spacer)+span:not(.composer-spacer){border-left:1px solid var(--line);padding-left:8px}.composer-session-meta button{color:#55616e;background:#edf0f3;border-radius:5px;align-items:center;gap:5px;padding:5px 7px;font-size:11px;display:inline-flex}.composer-session-meta button:hover{color:var(--ink);background:#e5e9ed}.composer-runtime-error{color:#9b453e}.context-menu{min-width:174px}.bar-session-title{text-overflow:ellipsis;white-space:nowrap;max-width:min(38vw,280px);overflow:hidden}.bar-mode{color:var(--muted);align-items:center;gap:6px;font-size:12px;font-weight:400;display:inline-flex}.session-log{border:1px solid var(--line);border-radius:999px;padding-inline:12px}.session-log-panel{background:var(--surface);border:1px solid var(--line);border-radius:8px;width:min(430px,100%);padding:22px;box-shadow:0 16px 50px #1219212e}.session-log-panel header{border-bottom:1px solid var(--line);justify-content:space-between;align-items:flex-start;padding-bottom:16px;display:flex}.session-log-panel h2{margin:0;font-size:19px}.session-log-panel dl{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:18px 0 0;display:grid}.session-log-panel dl div{background:#f4f6f8;border-radius:6px;padding:10px}.session-log-panel dt{color:var(--muted);font-size:11px}.session-log-panel dd{color:var(--ink);margin:4px 0 0;font-size:15px;font-weight:650}.conversation-tabs{margin-top:0;padding-top:10px}.main-content:not(.is-hero){background:var(--surface)}.main-content:not(.is-hero) .composer-wrap{z-index:3;background:linear-gradient(to bottom, transparent, var(--surface) 24px);margin-bottom:0;padding-top:24px;position:sticky;bottom:0}.main-content:not(.is-hero) .composer-note{padding-bottom:10px}.streaming-status{min-height:18px;color:var(--muted);align-items:center;gap:8px;font-size:12px;display:inline-flex}.turn-status{width:min(760px,100% - 40px);color:var(--muted);align-items:center;gap:8px;margin:0 auto 8px;font-size:12px;display:inline-flex}.compaction-status{width:min(760px,100% - 40px);color:var(--muted);align-items:center;gap:7px;margin:12px auto 8px;font-size:12px;display:flex}.streaming-dots{gap:3px;display:inline-flex}.streaming-dots i{background:currentColor;border-radius:50%;width:4px;height:4px;animation:1.1s ease-in-out infinite dot-bounce}.streaming-dots i:nth-child(2){animation-delay:.15s}.streaming-dots i:nth-child(3){animation-delay:.3s}@keyframes dot-bounce{0%,60%,to{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}.message{animation:.18s ease-out both message-in}@keyframes message-in{0%{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}.message-actions{color:#9099a4;align-items:center;gap:4px;min-height:24px;display:flex}.message-actions button{width:26px;height:26px;color:inherit;background:0 0;border-radius:5px;place-items:center;display:inline-grid}.message-actions button:hover{color:var(--ink);background:#eef1f4}.message-complete{color:#6a7888;align-items:center;gap:4px;margin-left:5px;font-size:10px;display:inline-flex}.conversation-skeleton{gap:14px;width:min(760px,100% - 40px);margin:48px auto;display:grid}.skeleton-line,.skeleton-block{background:linear-gradient(90deg,#edf0f3 25%,#f7f8fa 50%,#edf0f3 75%) 0 0/200% 100%;border-radius:5px;animation:1.4s ease-in-out infinite skeleton-shimmer}.skeleton-line{height:12px}.skeleton-line-short{width:30%}.skeleton-line-medium{width:52%}.skeleton-line-long{width:70%}.skeleton-block{width:100%;height:92px}@keyframes skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.session-tree{min-width:0;overflow-x:hidden}.session-item-wrap{min-width:0}.session-item-actions,.session-item>svg{flex:none}.session-item span{flex:1;min-width:0}.activity-timeline{color:#788390;gap:4px;min-width:0;font-size:12px;display:grid}.activity-timeline-live{min-height:22px}.activity-row,.activity-row summary{grid-template-columns:16px auto auto minmax(0,1fr) auto;align-items:center;column-gap:6px;min-width:0;display:grid}.activity-row{min-height:22px}.activity-row summary{cursor:pointer;list-style:none}.activity-row summary::-webkit-details-marker{display:none}.activity-row strong{color:#687482;font-size:12px;font-weight:500}.activity-icon{color:#8a96a2;place-items:center;display:inline-grid}.activity-separator{color:#b1b8c0}.activity-summary{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.activity-status{color:#579178;place-items:center;display:inline-grid}.activity-loading .activity-status{color:#647cbb}.activity-error .activity-status,.activity-cancelled .activity-status,.activity-timeout .activity-status{color:#a4514a}.activity-thinking{display:block}.activity-thinking[open]{padding:5px 0 2px}.activity-thinking pre{max-height:220px;color:var(--ink);white-space:pre-wrap;overflow-wrap:anywhere;background:#f4f6f8;border-left:2px solid #d9dfe5;margin:6px 0 0 22px;padding:8px 10px;font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace;overflow:auto}.activity-row-live{animation:.22s ease-out both activity-in}@keyframes activity-in{0%{opacity:.35;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-color-scheme:dark){.activity-row strong{color:#bdc5cf}.activity-icon{color:#a5afbb}.activity-separator{color:#737e8a}.activity-thinking pre{background:#20262d;border-left-color:#3e4854}}[data-theme=dark] .activity-row strong{color:#bdc5cf}[data-theme=dark] .activity-icon{color:#a5afbb}[data-theme=dark] .activity-separator{color:#737e8a}[data-theme=dark] .activity-thinking pre{background:#20262d;border-left-color:#3e4854}@media (width<=800px){.main-content.is-hero{padding-bottom:12vh}.composer-hero{width:calc(100% - 24px)}.hero-picker-row{gap:10px;margin-top:22px}.empty-brand{font-size:20px}.main-content:not(.is-hero) .composer-wrap{padding-top:16px}.composer-menu{min-width:0;position:fixed;bottom:82px;left:12px;right:12px}.composer-menu-right{left:12px;right:12px}.composer-session-meta{flex-wrap:wrap;gap:6px;padding-inline:10px}.composer-session-meta .composer-spacer{display:none}}.settings-panel{grid-template-rows:auto minmax(0,1fr);height:min(700px,100dvh - 48px);max-height:min(700px,100dvh - 48px)}.settings-nav,.settings-content{min-height:0;overflow-y:auto}.toast{z-index:20;border:1px solid var(--line);border-radius:6px;align-items:flex-start;gap:10px;width:min(420px,100% - 32px);padding:10px 12px;font-size:12px;line-height:1.45;display:flex;position:fixed;bottom:24px;right:24px;box-shadow:0 12px 28px #12192129}.toast-error{color:#8d3d37;background:#fff4f2;border-color:#efcdc8}.toast span{overflow-wrap:anywhere;flex:1}.toast button{color:currentColor;background:0 0;border-radius:4px;flex:none;place-items:center;width:24px;height:24px;margin:-4px -5px -4px 0;display:inline-grid}.toast button:hover{background:#8d3d371a}.tree-overlay{z-index:14}.tree-dialog{width:min(760px,100%);max-height:min(680px,100dvh - 48px);color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:8px;grid-template-rows:auto minmax(0,1fr) auto;display:grid;overflow:hidden;box-shadow:0 16px 50px #1219212e}.tree-dialog-header,.tree-dialog-footer{border-bottom:1px solid var(--line);justify-content:space-between;align-items:center;gap:12px;padding:16px 18px;display:flex}.tree-dialog-header h2{margin:0;font-size:16px}.tree-dialog-header .eyebrow{margin-bottom:3px}.tree-dialog-footer{border-top:1px solid var(--line);color:var(--muted);border-bottom:0;font-size:11px}.tree-dialog-list{min-height:160px;padding:8px;overflow:auto}.tree-dialog-node{width:100%;min-height:42px;color:var(--ink);text-align:left;background:0 0;border-radius:5px;grid-template-columns:auto 16px minmax(0,1fr);align-items:center;gap:7px;padding:6px 8px;display:grid}.tree-dialog-node:hover:not(:disabled),.tree-dialog-node.is-selected{background:#edf1f5}.tree-dialog-node:disabled{cursor:not-allowed;opacity:.54}.tree-dialog-branch{color:#a4adb7;white-space:pre;align-items:center;font:11px/1 ui-monospace,SFMono-Regular,Consolas,monospace;display:inline-flex}.tree-dialog-branch i{text-align:center;width:13px;font-style:normal;display:inline-block}.tree-dialog-branch b{font-weight:400}.tree-dialog-copy{gap:2px;min-width:0;display:grid}.tree-dialog-copy strong{color:#697582;font-size:10px;font-weight:650}.tree-dialog-copy span{color:var(--ink);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:1.3;overflow:hidden}.tree-dialog-icon{color:#788390}.tree-dialog-you{color:#397eaa}.tree-dialog-assistant{color:#4b8f68}.tree-dialog-tool{color:#8d7b50}.tree-dialog-empty{color:var(--muted);margin:14px 10px;font-size:12px}.tree-continue{color:#fff;background:#25303c;border-radius:5px;align-items:center;gap:6px;padding:7px 9px;font-size:12px;display:inline-flex}.tree-continue:disabled{color:#aeb6c0;background:#e4e7ea}@media (width<=480px){.settings-panel{height:calc(100dvh - 24px);max-height:calc(100dvh - 24px)}.settings-nav{overflow:auto hidden}.toast{bottom:16px;right:16px}}.settings-section h3{margin:0 0 6px;font-size:16px}.settings-section-note{color:var(--muted);margin:0 0 12px;font-size:11px;line-height:1.45}.setting-row small{color:var(--muted);margin-top:4px;font-size:11px;display:block}.setting-row select,.model-controls select,.onboarding-panel select,.onboarding-panel input,.login-row input{min-width:150px;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:5px;padding:7px 9px}.provider-list{gap:7px;display:grid}.provider-card{border:1px solid var(--line);border-radius:6px;align-items:center;gap:10px;padding:10px;display:flex}.provider-card.is-selected{background:var(--accent-soft);border-color:#7d9aee}.provider-card-main{color:var(--ink);text-align:left;background:0 0;flex:1;gap:3px;display:grid}.provider-card-main span,.provider-status,.readonly-note{color:var(--muted);font-size:11px}.status-settings{color:#3d6ca4}.status-environment{color:#5f6f61}.status-missing{color:#8c6c58}.model-controls{gap:12px;margin-top:14px;display:grid}.model-controls label,.onboarding-panel label{color:var(--muted);gap:6px;font-size:11px;display:grid}.login-row{flex-wrap:wrap;gap:7px;display:flex}.login-row button,.onboarding-panel button{color:#fff;background:#25303c;border-radius:5px;padding:8px 12px}.button-quiet{color:var(--ink)!important;background:#e9edf1!important}.settings-error{color:#90534f;background:#fff3f1;border:1px solid #f1d6d1;border-radius:5px;margin-bottom:10px;padding:8px 10px;font-size:11px}.settings-loading{color:var(--muted);font-size:12px}.onboarding-panel{background:var(--surface);border:1px solid var(--line);border-radius:8px;gap:12px;width:min(420px,100%);padding:24px;display:grid;box-shadow:0 16px 50px #1219212e}.onboarding-panel h2{margin:0;font-size:20px}.onboarding-panel p{color:var(--muted);margin:0;font-size:12px;line-height:1.45}.advanced-list{gap:6px;display:grid}.advanced-row{border-bottom:1px solid var(--line);justify-content:space-between;align-items:center;gap:10px;padding:10px 0;display:flex}.advanced-row>div:first-child{gap:4px;min-width:0;display:grid}.advanced-row strong{overflow-wrap:anywhere;font-size:12px}.advanced-row span{color:var(--muted);overflow-wrap:anywhere;font-size:11px}.advanced-meta,.advanced-actions{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:6px;display:flex}.advanced-meta code{color:#536273;background:#f1f3f5;border-radius:4px;padding:3px 5px;font-size:10px}.advanced-actions button,.inline-form button,.trust-toggle{color:var(--ink);border:1px solid var(--line);background:#edf0f3;border-radius:4px;padding:6px 8px;font-size:11px}.inline-form{flex-wrap:wrap;gap:6px;margin-top:14px;display:flex}.inline-form input,.inline-form select{min-width:0;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:5px;flex:1;padding:7px 8px;font-size:11px}.switch{color:var(--muted);white-space:nowrap;align-items:center;gap:6px;font-size:11px;display:inline-flex}.switch input{accent-color:var(--accent)}.trust-impact{background:var(--accent-soft);border:1px solid #cad6fa;border-radius:6px;gap:6px;margin:14px 0;padding:12px;display:grid}.trust-impact strong{font-size:13px}.trust-impact span,.trust-impact small{color:var(--muted);font-size:11px;line-height:1.4}.shortcut-list{color:var(--muted);gap:10px;font-size:12px;display:grid}.shortcut-list kbd{text-align:center;min-width:76px;color:var(--ink);border:1px solid var(--line);background:#edf0f3;border-bottom-width:2px;border-radius:4px;margin-right:8px;padding:4px 6px;font:11px ui-monospace,monospace;display:inline-block}.provider-selector{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.provider-choice{min-width:0;color:var(--ink);background:var(--surface);border:1px solid var(--line);text-align:left;border-radius:6px;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:8px;padding:10px;display:grid}.provider-choice:hover{background:#f7f9fc;border-color:#b9c7df}.provider-choice.is-selected{background:var(--accent-soft);border-color:#6f8ee0}.provider-choice>span{gap:2px;min-width:0;display:grid}.provider-choice strong,.provider-choice small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.provider-choice strong{font-size:12px}.provider-choice small{color:var(--muted);font-size:10px}.provider-choice em{white-space:nowrap;font-size:10px;font-style:normal}.provider-choice-custom{border-style:dashed;grid-column:span 2}.model-controls,.custom-provider-form{border-top:1px solid var(--line);gap:12px;margin-top:16px;padding-top:16px;display:grid}.model-controls h4,.custom-provider-heading h4{color:var(--ink);margin:0;font-size:13px}.custom-provider-heading{justify-content:space-between;align-items:center;gap:12px;display:flex}.custom-provider-heading>div{gap:3px;display:grid}.custom-provider-heading p{color:var(--muted);margin:0;font-size:11px}.custom-provider-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;display:grid}.custom-provider-grid label{min-width:0;color:var(--muted);gap:5px;font-size:11px;display:grid}.custom-provider-grid input,.custom-provider-grid select{width:100%;min-width:0;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:5px;padding:8px 9px}.custom-provider-wide{grid-column:1/-1}.custom-save{color:#fff;background:#25303c;border-radius:5px;justify-self:start;padding:8px 10px;font-size:12px}.custom-save:disabled{cursor:not-allowed;opacity:.48}.masked-key::placeholder{color:var(--ink);opacity:.72}.masked-key-indicator{color:var(--ink)}@media (width<=480px){.provider-selector,.custom-provider-grid{grid-template-columns:1fr}.provider-choice-custom,.custom-provider-wide{grid-column:auto}}
|