@github/copilot-linux-arm64
Advanced tools
| /** | ||
| * Builder that produces a list of source-qualified tool filter strings for | ||
| * {@link SessionConfigBase.availableTools}. | ||
| * | ||
| * Tools are classified by the runtime at registration time (not from name | ||
| * parsing), so `addBuiltIn("foo")` matches only tools the runtime registered | ||
| * as built-in, even if an MCP server or custom-agent extension happens to | ||
| * register a tool with the same wire name. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const tools = new ToolSet() | ||
| * .addBuiltIn(BuiltInTools.Isolated) | ||
| * .addMcp("*") | ||
| * .addCustom("*"); | ||
| * | ||
| * const session = await client.createSession({ | ||
| * availableTools: tools, | ||
| * // ... | ||
| * }); | ||
| * ``` | ||
| */ | ||
| export declare class ToolSet { | ||
| private readonly items; | ||
| /** | ||
| * Adds one or more built-in tool patterns. | ||
| * | ||
| * @param name A specific built-in tool name (e.g. `"bash"`) or `"*"` to match all | ||
| * built-in tools. | ||
| */ | ||
| addBuiltIn(name: string): ToolSet; | ||
| /** | ||
| * Adds a list of built-in tool patterns (e.g. {@link BuiltInTools.Isolated}). | ||
| */ | ||
| addBuiltIn(names: readonly string[]): ToolSet; | ||
| /** | ||
| * Adds a custom tool pattern. Matches tools registered via the SDK's | ||
| * `tools` option or via custom agents. | ||
| * | ||
| * @param name A specific custom tool name or `"*"` to match all custom tools. | ||
| */ | ||
| addCustom(name: string): ToolSet; | ||
| /** | ||
| * Adds an MCP tool pattern. Matches tools advertised by any configured | ||
| * MCP server. | ||
| * | ||
| * @param toolName The runtime's canonical wire name for the MCP tool | ||
| * (e.g. `"github-list_issues"`), or `"*"` to match all MCP tools from | ||
| * any server. | ||
| */ | ||
| addMcp(toolName: string): ToolSet; | ||
| /** | ||
| * Returns a defensive copy of the accumulated filter strings, suitable for | ||
| * passing as {@link SessionConfigBase.availableTools}. | ||
| */ | ||
| toArray(): string[]; | ||
| } | ||
| /** | ||
| * Curated sets of built-in tool names for common scenarios. Each constant is | ||
| * meant to be passed to {@link ToolSet.addBuiltIn}. | ||
| */ | ||
| export declare const BuiltInTools: { | ||
| /** | ||
| * Built-in tools that operate only within the bounds of a single session — | ||
| * no host filesystem access outside the session, no cross-session state, | ||
| * no host environment access, no network. Safe to enable in `Mode = "empty"` | ||
| * scenarios (e.g. multi-tenant servers) without leaking host capabilities. | ||
| * | ||
| * **Contract:** tools in this set MUST NOT be extended (even behind options | ||
| * or args) to read or write state outside the session boundary. Adding | ||
| * cross-session or host-state behavior to one of these tools is a | ||
| * breaking change that requires removing it from this set. | ||
| */ | ||
| readonly Isolated: readonly string[]; | ||
| }; |
+34
-71
@@ -0,1 +1,3 @@ | ||
| import type { CanvasJsonSchema, CanvasProviderCloseRequest, CanvasProviderInvokeActionRequest, CanvasProviderOpenRequest, CanvasProviderOpenResult } from "./generated/rpc.js"; | ||
| export type { CanvasJsonSchema, CanvasHostContext, CanvasHostContextCapabilities, } from "./generated/rpc.js"; | ||
| /** | ||
@@ -5,10 +7,11 @@ * Extension-owned canvases declared via | ||
| * | ||
| * The runtime sends provider callbacks directly as `canvas.open`, | ||
| * `canvas.close`, and `canvas.action.invoke` JSON-RPC requests. The SDK | ||
| * routes those requests by `canvasId` to the in-process handlers bound by | ||
| * `createCanvas`. Re-opening with an existing `instanceId` is how the host | ||
| * focuses an existing panel; reload is a renderer-only concern. | ||
| * The runtime sends provider callbacks as `canvas.open`, `canvas.close`, and | ||
| * `canvas.action.invoke` JSON-RPC requests via the codegen client session API | ||
| * pipeline. The SDK routes those requests by `canvasId` to the in-process | ||
| * handlers bound by `createCanvas`. Re-opening with an existing `instanceId` | ||
| * is how the host focuses an existing panel; reload is a renderer-only concern. | ||
| * | ||
| * @experimental Canvas types are part of an experimental wire-protocol surface | ||
| * and may change or be removed in future SDK or CLI releases. | ||
| */ | ||
| /** JSON Schema object used for canvas inputs. */ | ||
| export type CanvasJsonSchema = Record<string, unknown>; | ||
| /** | ||
@@ -22,2 +25,5 @@ * A single agent-callable action contributed by a canvas. The metadata | ||
| * lifecycle verbs. | ||
| * | ||
| * @experimental This type is part of an experimental wire-protocol surface | ||
| * and may change or be removed in future SDK or CLI releases. | ||
| */ | ||
@@ -32,3 +38,3 @@ export interface CanvasAction { | ||
| /** Required per-action dispatch handler. */ | ||
| handler: (ctx: CanvasActionContext) => Promise<unknown> | unknown; | ||
| handler: (ctx: CanvasProviderInvokeActionRequest) => Promise<unknown> | unknown; | ||
| } | ||
@@ -38,2 +44,5 @@ /** | ||
| * `session.create` / `session.resume`. | ||
| * | ||
| * @experimental This type is part of an experimental wire-protocol surface | ||
| * and may change or be removed in future SDK or CLI releases. | ||
| */ | ||
@@ -52,63 +61,8 @@ export interface CanvasDeclaration { | ||
| } | ||
| /** Response returned from `open`. */ | ||
| export interface CanvasOpenResponse { | ||
| /** URL the host should render. Optional for native canvases. */ | ||
| url?: string; | ||
| /** Provider-supplied title shown in host chrome. */ | ||
| title?: string; | ||
| /** Provider-supplied status text shown in host chrome. */ | ||
| status?: string; | ||
| } | ||
| /** Host capabilities passed to canvas callbacks. */ | ||
| export interface CanvasHostContext { | ||
| capabilities?: { | ||
| canvases?: boolean; | ||
| }; | ||
| } | ||
| /** Context handed to a canvas's `open` handler. */ | ||
| export interface CanvasOpenContext { | ||
| /** Session that requested the canvas. */ | ||
| sessionId: string; | ||
| /** Extension id that owns the canvas. */ | ||
| extensionId: string; | ||
| /** Canvas id (matches the declaring `CanvasDeclaration.id`). */ | ||
| canvasId: string; | ||
| /** Stable instance id supplied by the runtime. */ | ||
| instanceId: string; | ||
| /** Validated `input` payload, shaped by `CanvasDeclaration.inputSchema`. */ | ||
| input: unknown; | ||
| /** Host capabilities supplied by the runtime. */ | ||
| host?: CanvasHostContext; | ||
| } | ||
| /** Context handed to a canvas action handler. */ | ||
| export interface CanvasActionContext { | ||
| /** Session that invoked the action. */ | ||
| sessionId: string; | ||
| /** Extension id that owns the canvas. */ | ||
| extensionId: string; | ||
| /** Canvas id targeted by the action. */ | ||
| canvasId: string; | ||
| /** Instance id targeted by the action. */ | ||
| instanceId: string; | ||
| /** Action name from `CanvasAction.name`. */ | ||
| actionName: string; | ||
| /** Validated `input` payload, shaped by the action's `inputSchema`. */ | ||
| input: unknown; | ||
| /** Host capabilities supplied by the runtime. */ | ||
| host?: CanvasHostContext; | ||
| } | ||
| /** Context handed to a canvas's `onClose` handler. */ | ||
| export interface CanvasLifecycleContext { | ||
| /** Session owning the canvas instance. */ | ||
| sessionId: string; | ||
| /** Extension id that owns the canvas. */ | ||
| extensionId: string; | ||
| /** Canvas id (matches the declaring `CanvasDeclaration.id`). */ | ||
| canvasId: string; | ||
| /** Instance id this lifecycle event applies to. */ | ||
| instanceId: string; | ||
| /** Host capabilities supplied by the runtime. */ | ||
| host?: CanvasHostContext; | ||
| } | ||
| /** Structured error returned from canvas handlers. */ | ||
| /** | ||
| * Structured error returned from canvas handlers. | ||
| * | ||
| * @experimental This class is part of an experimental wire-protocol surface | ||
| * and may change or be removed in future SDK or CLI releases. | ||
| */ | ||
| export declare class CanvasError extends Error { | ||
@@ -123,2 +77,5 @@ readonly code: string; | ||
| * {@link CanvasDeclaration} fields with the in-process handler closures. | ||
| * | ||
| * @experimental This interface is part of an experimental wire-protocol surface | ||
| * and may change or be removed in future SDK or CLI releases. | ||
| */ | ||
@@ -141,3 +98,3 @@ export interface CanvasOptions { | ||
| /** Required. Open a new canvas instance. */ | ||
| open: (ctx: CanvasOpenContext) => Promise<CanvasOpenResponse> | CanvasOpenResponse; | ||
| open: (ctx: CanvasProviderOpenRequest) => Promise<CanvasProviderOpenResult> | CanvasProviderOpenResult; | ||
| /** | ||
@@ -148,3 +105,3 @@ * Optional. Notified when a canvas instance is closed by the user, the | ||
| */ | ||
| onClose?: (ctx: CanvasLifecycleContext) => Promise<void> | void; | ||
| onClose?: (ctx: CanvasProviderCloseRequest) => Promise<void> | void; | ||
| } | ||
@@ -158,2 +115,5 @@ /** A registered canvas: declarative metadata + in-process handler closures. | ||
| * the same JSON-RPC wire protocol; the divergence is API ergonomics only. | ||
| * | ||
| * @experimental This class is part of an experimental wire-protocol surface | ||
| * and may change or be removed in future SDK or CLI releases. | ||
| */ | ||
@@ -171,3 +131,6 @@ export declare class Canvas { | ||
| * `canvasId`. Both shapes target the same JSON-RPC wire protocol. | ||
| * | ||
| * @experimental This function is part of an experimental wire-protocol surface | ||
| * and may change or be removed in future SDK or CLI releases. | ||
| */ | ||
| export declare function createCanvas(options: CanvasOptions): Canvas; |
+21
-29
@@ -75,2 +75,3 @@ import { createServerRpc } from "./generated/rpc.js"; | ||
| get rpc(): ReturnType<typeof createServerRpc>; | ||
| private logDebugTiming; | ||
| /** | ||
@@ -136,4 +137,5 @@ * Creates a new CopilotClient instance. | ||
| * 1. Closes all active sessions (releases in-memory resources) | ||
| * 2. Closes the JSON-RPC connection | ||
| * 3. Terminates the CLI server process (if spawned by this client) | ||
| * 2. Requests runtime shutdown for SDK-owned CLI processes | ||
| * 3. Closes the JSON-RPC connection | ||
| * 4. Terminates the CLI server process (if spawned by this client) | ||
| * | ||
@@ -195,30 +197,22 @@ * Note: session data on disk is preserved, so sessions can be resumed later. | ||
| forceStop(): Promise<void>; | ||
| /** Mode-specific defaults spread under the caller's config (app values win). */ | ||
| private configDefaultsForMode; | ||
| /** | ||
| * Creates a new conversation session with the Copilot CLI. | ||
| * Returns the systemMessage config to use, adjusted for the current mode. | ||
| * In empty mode we ensure the environment_context section is removed | ||
| * unless the app has already taken control of it. `append` (and | ||
| * unspecified) mode is promoted to `customize` so we can also strip | ||
| * environment_context; the caller's `content` is preserved verbatim | ||
| * because the runtime appends it as additional instructions in both | ||
| * customize and append modes. | ||
| */ | ||
| private getSystemMessageConfigForMode; | ||
| /** | ||
| * Mode-specific options applied via session.options.update after create/resume. | ||
| * | ||
| * Sessions maintain conversation state, handle events, and manage tool execution. | ||
| * If the client is not connected, this method automatically starts the connection. | ||
| * | ||
| * @param config - Optional configuration for the session | ||
| * @returns A promise that resolves with the created session | ||
| * @throws Error if the client fails to start | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * // Basic session | ||
| * const session = await client.createSession({ onPermissionRequest: approveAll }); | ||
| * | ||
| * // Session with model and tools | ||
| * const session = await client.createSession({ | ||
| * onPermissionRequest: approveAll, | ||
| * model: "gpt-4", | ||
| * tools: [{ | ||
| * name: "get_weather", | ||
| * description: "Get weather for a location", | ||
| * parameters: { type: "object", properties: { location: { type: "string" } } }, | ||
| * handler: async (args) => ({ temperature: 72 }) | ||
| * }] | ||
| * }); | ||
| * ``` | ||
| * In empty mode, defaults the four overridable feature flags to safe values | ||
| * (caller values from `config` win). `installedPlugins=[]` is unconditional | ||
| * in empty mode — apps that need custom plugins should switch modes. | ||
| */ | ||
| private updateSessionOptionsForMode; | ||
| createSession(config: SessionConfig): Promise<CopilotSession>; | ||
@@ -473,4 +467,2 @@ /** | ||
| private handleSystemMessageTransform; | ||
| private handleCanvasProviderRequest; | ||
| private handleCanvasActionInvokeRequest; | ||
| } |
@@ -121,2 +121,3 @@ # Agent Extension Authoring Guide | ||
| onPostToolUse: async (input, invocation) => { ... }, | ||
| onPostToolUseFailure: async (input, invocation) => { ... }, | ||
| onSessionStart: async (input, invocation) => { ... }, | ||
@@ -128,3 +129,3 @@ onSessionEnd: async (input, invocation) => { ... }, | ||
| All hook inputs include `timestamp` (unix ms) and `cwd` (working directory). | ||
| All hook inputs include `timestamp` (`Date`) and `workingDirectory`. | ||
| All handlers receive `invocation: { sessionId: string }` as the second argument. | ||
@@ -135,3 +136,3 @@ All handlers may return `void`/`undefined` (no-op) or an output object. | ||
| **Input:** `{ prompt: string, timestamp, cwd }` | ||
| **Input:** `{ prompt: string, timestamp, workingDirectory }` | ||
@@ -146,3 +147,3 @@ **Output (all fields optional):** | ||
| **Input:** `{ toolName: string, toolArgs: unknown, timestamp, cwd }` | ||
| **Input:** `{ toolName: string, toolArgs: unknown, timestamp, workingDirectory }` | ||
@@ -159,4 +160,7 @@ **Output (all fields optional):** | ||
| **Input:** `{ toolName: string, toolArgs: unknown, toolResult: ToolResultObject, timestamp, cwd }` | ||
| **Input:** `{ toolName: string, toolArgs: unknown, toolResult: ToolResultObject, timestamp, workingDirectory }` | ||
| Fires only when the tool returned a successful result. To observe non-success | ||
| outcomes, register `onPostToolUseFailure` as well. | ||
| **Output (all fields optional):** | ||
@@ -168,5 +172,25 @@ | Field | Type | Effect | | ||
| ### onPostToolUseFailure | ||
| **Input:** `{ toolName: string, toolArgs: unknown, error: string, timestamp, workingDirectory }` | ||
| Fires after a tool execution whose result was `"failure"`. `onPostToolUse` | ||
| does **not** fire for these outcomes, so register this handler to observe or | ||
| react to them — useful for telemetry, replay buffers, fault-injection tests, | ||
| or pairing pre/post tool tracking that would otherwise leak when the tool | ||
| fails. Note the input shape differs from `onPostToolUse`: only `error` (the | ||
| stringified failure message) is provided, not the full `toolResult`. | ||
| **Output (all fields optional):** | ||
| | Field | Type | Effect | | ||
| |-------|------|--------| | ||
| | `additionalContext` | `string` | Appended as hidden guidance the model sees alongside the failed tool result | | ||
| Note: only `"failure"` results trigger this hook. Other non-success | ||
| `resultType` values (`"rejected"`, `"denied"`, `"timeout"`) do not currently | ||
| fire it. | ||
| ### onSessionStart | ||
| **Input:** `{ source: "startup" \| "resume" \| "new", initialPrompt?: string, timestamp, cwd }` | ||
| **Input:** `{ source: "startup" \| "resume" \| "new", initialPrompt?: string, timestamp, workingDirectory }` | ||
@@ -180,3 +204,3 @@ **Output (all fields optional):** | ||
| **Input:** `{ reason: "complete" \| "error" \| "abort" \| "timeout" \| "user_exit", finalMessage?: string, error?: string, timestamp, cwd }` | ||
| **Input:** `{ reason: "complete" \| "error" \| "abort" \| "timeout" \| "user_exit", finalMessage?: string, error?: string, timestamp, workingDirectory }` | ||
@@ -191,3 +215,3 @@ **Output (all fields optional):** | ||
| **Input:** `{ error: string, errorContext: "model_call" \| "tool_execution" \| "system" \| "user_input", recoverable: boolean, timestamp, cwd }` | ||
| **Input:** `{ error: string, errorContext: "model_call" \| "tool_execution" \| "system" \| "user_input", recoverable: boolean, timestamp, workingDirectory }` | ||
@@ -194,0 +218,0 @@ **Output (all fields optional):** |
@@ -155,12 +155,13 @@ # Copilot CLI Extension Examples | ||
| | Hook | Fires When | Can Modify | | ||
| | ----------------------- | ------------------------- | ------------------------------------------- | | ||
| | `onUserPromptSubmitted` | User sends a message | The prompt text, add context | | ||
| | `onPreToolUse` | Before a tool executes | Tool args, permission decision, add context | | ||
| | `onPostToolUse` | After a tool executes | Tool result, add context | | ||
| | `onSessionStart` | Session starts or resumes | Add context, modify config | | ||
| | `onSessionEnd` | Session ends | Cleanup actions, summary | | ||
| | `onErrorOccurred` | An error occurs | Error handling strategy (retry/skip/abort) | | ||
| | Hook | Fires When | Can Modify | | ||
| | ----------------------- | ---------------------------------------- | ------------------------------------------- | | ||
| | `onUserPromptSubmitted` | User sends a message | The prompt text, add context | | ||
| | `onPreToolUse` | Before a tool executes | Tool args, permission decision, add context | | ||
| | `onPostToolUse` | After a tool executes successfully | Tool result, add context | | ||
| | `onPostToolUseFailure` | After a tool execution returns a failure | Add hidden guidance to the model | | ||
| | `onSessionStart` | Session starts or resumes | Add context | | ||
| | `onSessionEnd` | Session ends | Cleanup actions, summary | | ||
| | `onErrorOccurred` | An error occurs | Error handling strategy (retry/skip/abort) | | ||
| All hook inputs include `timestamp` (unix ms) and `cwd` (working directory). | ||
| All hook inputs include `timestamp` (`Date`) and `workingDirectory`. | ||
@@ -271,8 +272,14 @@ ### Modifying the user's message | ||
| ### Augmenting tool results with extra context | ||
| ### Reacting when a tool fails | ||
| `onPostToolUse` only fires for successful tool executions. To observe or react | ||
| to failures, register `onPostToolUseFailure`. The input includes | ||
| `input.error` (the stringified failure message); only `additionalContext` on | ||
| the return value is consumed by the runtime, and it is appended as hidden | ||
| guidance alongside the failed tool result. | ||
| ```js | ||
| hooks: { | ||
| onPostToolUse: async (input) => { | ||
| if (input.toolName === "bash" && input.toolResult?.resultType === "failure") { | ||
| onPostToolUseFailure: async (input) => { | ||
| if (input.toolName === "bash") { | ||
| return { | ||
@@ -413,3 +420,3 @@ additionalContext: "The command failed. Try a different approach.", | ||
| | `assistant.message` | Agent's final response | `content`, `messageId`, `toolRequests` | | ||
| | `assistant.streaming_delta` | Token-by-token streaming (ephemeral) | `totalResponseSizeBytes` | | ||
| | `assistant.message_delta` | Message content chunks (ephemeral) | `deltaContent` | | ||
| | `tool.execution_start` | A tool is about to run | `toolCallId`, `toolName`, `arguments` | | ||
@@ -628,4 +635,7 @@ | `tool.execution_complete` | A tool finished running | `toolCallId`, `toolName`, `success`, `result`, `error` | | ||
| const cmd = String(input.toolArgs?.command || ""); | ||
| if (/rm\\s+-rf\\s+\\/ / i.test(cmd) || /Remove-Item\\s+.*-Recurse/i.test(cmd)) { | ||
| return { permissionDecision: "deny" }; | ||
| if (/rm\\s+-rf\\s+\//i.test(cmd) || /Remove-Item\\s+.*-Recurse/i.test(cmd)) { | ||
| return { | ||
| permissionDecision: "deny", | ||
| permissionDecisionReason: "Destructive commands are not allowed.", | ||
| }; | ||
| } | ||
@@ -632,0 +642,0 @@ } |
| import type { CopilotSession } from "./session.js"; | ||
| import { type ExtensionInfo, type PermissionHandler, type ResumeSessionConfig } from "./types.js"; | ||
| export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasActionContext, type CanvasDeclaration, type CanvasHostContext, type CanvasJsonSchema, type CanvasLifecycleContext, type CanvasOpenContext, type CanvasOpenResponse, type CanvasOptions, } from "./canvas.js"; | ||
| export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest"> & { | ||
| export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js"; | ||
| export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest" | "extensionSdkPath"> & { | ||
| onPermissionRequest?: PermissionHandler; | ||
@@ -6,0 +6,0 @@ }; |
@@ -8,6 +8,7 @@ /** | ||
| export { RuntimeConnection } from "./types.js"; | ||
| export { BuiltInTools, ToolSet } from "./toolSet.js"; | ||
| export { CopilotSession, type AssistantMessageEvent } from "./session.js"; | ||
| export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasActionContext, type CanvasDeclaration, type CanvasHostContext, type CanvasJsonSchema, type CanvasLifecycleContext, type CanvasOpenContext, type CanvasOpenResponse, type CanvasOptions, } from "./canvas.js"; | ||
| export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasHostContextCapabilities, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js"; | ||
| export { defineTool, approveAll, convertMcpCallToolResult, createSessionFsAdapter, SYSTEM_MESSAGE_SECTIONS, } from "./types.js"; | ||
| export type * from "./generated/session-events.js"; | ||
| export type { CommandContext, CommandDefinition, CommandHandler, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientOptions, StdioRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolTelemetry, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js"; | ||
| export type { CommandContext, CommandDefinition, CommandHandler, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, MessageOptions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ProviderModelConfig, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolTelemetry, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js"; |
| import { createSessionRpc } from "./generated/rpc.js"; | ||
| import type { OpenCanvasInstance } from "./generated/rpc.js"; | ||
| import type { MessageOptions, ReasoningEffort, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, TypedSessionEventHandler } from "./types.js"; | ||
| import type { MessageOptions, ContextTier, ReasoningEffort, ReasoningSummary, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, TypedSessionEventHandler } from "./types.js"; | ||
| /** Assistant message event - the final response from the assistant. */ | ||
@@ -172,7 +172,11 @@ export type AssistantMessageEvent = Extract<SessionEvent, { | ||
| on(handler: SessionEventHandler): () => void; | ||
| private upsertOpenCanvasFromEvent; | ||
| private removeOpenCanvasFromEvent; | ||
| private removeOpenCanvas; | ||
| private upsertOpenCanvas; | ||
| /** | ||
| * Snapshot of canvas instances that were already open when the session was | ||
| * resumed. Populated from the `session.resume` response; empty for freshly | ||
| * created sessions. Returns a defensive copy — mutating the returned array | ||
| * has no effect on the session. | ||
| * Snapshot of canvas instances currently known to be open for this session. | ||
| * Populated from the `session.resume` response and live `session.canvas.opened` | ||
| * and `session.canvas.closed` events. Returns a defensive copy — mutating the | ||
| * returned array has no effect on the session. | ||
| */ | ||
@@ -265,2 +269,4 @@ get openCanvases(): OpenCanvasInstance[]; | ||
| reasoningEffort?: ReasoningEffort; | ||
| reasoningSummary?: ReasoningSummary; | ||
| contextTier?: ContextTier; | ||
| modelCapabilities?: ModelCapabilitiesOverride; | ||
@@ -267,0 +273,0 @@ }): Promise<void>; |
+6
-6
@@ -9,8 +9,8 @@ #!/usr/bin/env node | ||
| var He=Object.create;var D=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var je=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,Ue=Object.prototype.hasOwnProperty;var j=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var v=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Ve=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of je(t))!Ue.call(e,n)&&n!==r&&D(e,n,{get:()=>t[n],enumerable:!(o=De(t,n))||o.enumerable});return e};var Be=(e,t,r)=>(r=e!=null?He(Me(e)):{},Ve(t||!e||!e.__esModule?D(r,"default",{value:e,enumerable:!0}):r,e));var X=v((Mt,K)=>{"use strict";var Y=()=>process.platform==="linux",_=null,Ke=()=>{if(!_)if(Y()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,_=process.report.getReport(),process.report.excludeNetwork=e}else _={};return _};K.exports={isLinux:Y,getReport:Ke}});var Q=v((Ut,z)=>{"use strict";var y=j("fs"),Xe="/usr/bin/ldd",ze="/proc/self/exe",C=2048,Qe=e=>{let t=y.openSync(e,"r"),r=Buffer.alloc(C),o=y.readSync(t,r,0,C,0);return y.close(t,()=>{}),r.subarray(0,o)},Ze=e=>new Promise((t,r)=>{y.open(e,"r",(o,n)=>{if(o)r(o);else{let s=Buffer.alloc(C);y.read(n,s,0,C,0,(i,c)=>{t(s.subarray(0,c)),y.close(n,()=>{})})}})});z.exports={LDD_PATH:Xe,SELF_PATH:ze,readFileSync:Qe,readFile:Ze}});var ee=v((Vt,Z)=>{"use strict";var et=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),o=e.readUInt16LE(56);for(let n=0;n<o;n++){let s=t+n*r;if(e.readUInt32LE(s)===3){let c=e.readUInt32LE(s+8),h=e.readUInt32LE(s+32);return e.subarray(c,c+h).toString().replace(/\0.*$/g,"")}}return null};Z.exports={interpreterPath:et}});var Ee=v((Bt,be)=>{"use strict";var re=j("child_process"),{isLinux:b,getReport:ne}=X(),{LDD_PATH:w,SELF_PATH:oe,readFile:A,readFileSync:I}=Q(),{interpreterPath:se}=ee(),l,f,d,ie="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",m="",ce=()=>m||new Promise(e=>{re.exec(ie,(t,r)=>{m=t?" ":r,e(m)})}),ae=()=>{if(!m)try{m=re.execSync(ie,{encoding:"utf8"})}catch{m=" "}return m},p="glibc",ue=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,g="musl",tt=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),le=()=>{let e=ne();return e.header&&e.header.glibcVersionRuntime?p:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(tt)?g:null},fe=e=>{let[t,r]=e.split(/[\r\n]+/);return t&&t.includes(p)?p:r&&r.includes(g)?g:null},de=e=>{if(e){if(e.includes("/ld-musl-"))return g;if(e.includes("/ld-linux-"))return p}return null},pe=e=>(e=e.toString(),e.includes("musl")?g:e.includes("GNU C Library")?p:null),rt=async()=>{if(f!==void 0)return f;f=null;try{let e=await A(w);f=pe(e)}catch{}return f},nt=()=>{if(f!==void 0)return f;f=null;try{let e=I(w);f=pe(e)}catch{}return f},ot=async()=>{if(l!==void 0)return l;l=null;try{let e=await A(oe),t=se(e);l=de(t)}catch{}return l},st=()=>{if(l!==void 0)return l;l=null;try{let e=I(oe),t=se(e);l=de(t)}catch{}return l},me=async()=>{let e=null;if(b()&&(e=await ot(),!e&&(e=await rt(),e||(e=le()),!e))){let t=await ce();e=fe(t)}return e},ge=()=>{let e=null;if(b()&&(e=st(),!e&&(e=nt(),e||(e=le()),!e))){let t=ae();e=fe(t)}return e},it=async()=>b()&&await me()!==p,ct=()=>b()&&ge()!==p,at=async()=>{if(d!==void 0)return d;d=null;try{let t=(await A(w)).match(ue);t&&(d=t[1])}catch{}return d},ut=()=>{if(d!==void 0)return d;d=null;try{let t=I(w).match(ue);t&&(d=t[1])}catch{}return d},he=()=>{let e=ne();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},te=e=>e.trim().split(/\s+/)[1],ye=e=>{let[t,r,o]=e.split(/[\r\n]+/);return t&&t.includes(p)?te(t):r&&o&&r.includes(g)?te(o):null},lt=async()=>{let e=null;if(b()&&(e=await at(),e||(e=he()),!e)){let t=await ce();e=ye(t)}return e},ft=()=>{let e=null;if(b()&&(e=ut(),e||(e=he()),!e)){let t=ae();e=ye(t)}return e};be.exports={GLIBC:p,MUSL:g,family:me,familySync:ge,isNonGlibcLinux:it,isNonGlibcLinuxSync:ct,version:lt,versionSync:ft}});import St from"node:module";import{basename as kt,dirname as Tt,join as At}from"node:path";import*as $e from"node:sea";import{fileURLToPath as It,pathToFileURL as P}from"node:url";import{basename as dt,join as N}from"node:path";var M="0.0.1";import{readdir as qe,access as Ge,constants as We}from"node:fs/promises";import{join as a,basename as U}from"node:path";import{homedir as x}from"node:os";function B(){return process.env.XDG_CACHE_HOME||a(x(),".cache")}function q(){if(process.argv.includes("--no-auto-update")||process.argv.includes("--prefer-version"))return!1;let e=process.env.COPILOT_AUTO_UPDATE;return!(e&&e.toLowerCase()==="false")}function G(){let e=process.argv.indexOf("--prefer-version");if(!(e===-1||e+1>=process.argv.length))return process.argv[e+1]}function Je(){if(process.platform==="darwin")return a(x(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||a(x(),".cache");return a(e,"copilot")}return a(B(),"copilot")}function W(){let e=[];return process.env.COPILOT_CACHE_HOME&&e.push(a(process.env.COPILOT_CACHE_HOME,"pkg")),e.push(a(Je(),"pkg")),e.push(a(B(),"copilot","pkg")),process.env.COPILOT_HOME&&e.push(a(process.env.COPILOT_HOME,"pkg")),e.push(a(x(),".copilot","pkg")),[...new Set(e)]}function V(e){let t=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(t)return[Number(t[1]),Number(t[2]),Number(t[3])]}function Ye(e,t){let r=V(e),o=V(t);if(!r&&!o)return 0;if(!r)return-1;if(!o)return 1;for(let i=0;i<3;i++)if(r[i]!==o[i])return r[i]-o[i];let n=e.includes("-"),s=t.includes("-");return n!==s?n?-1:1:e.localeCompare(t)}async function J(e,...t){let r=[];for(let o of t){let n;try{n=await qe(o)}catch{continue}for(let s of n){let i=a(o,s);try{await Ge(a(i,e),We.R_OK),r.push(i)}catch{continue}}}return r.sort((o,n)=>{let s=Ye(U(n),U(o));return s!==0?s:o.localeCompare(n)}),r}import{join as xe}from"node:path";var O=Be(Ee(),1);function L(e={}){return(e.platform??process.platform)!=="linux"?"gnu":(e.detectLibcFamily??O.familySync)()===O.MUSL?"musl":"gnu"}function F(e=process.platform,t){let r=t??(e==="linux"?L():"gnu");return e==="linux"&&r==="musl"?"linuxmusl":e}function ve(e=process.platform,t,r=process.arch){return`${F(e,t)}-${r}`}function _e(){let e=ve();return W().flatMap(t=>[xe(t,"universal"),xe(t,e)])}function pt(){return process.env.COPILOT_CLI_VERSION?process.env.COPILOT_CLI_VERSION:"1.0.64-3"}async function Ce(e,t){let r=N(e,"app.js"),o=pt()===M,n=G();if(t&&(n||q()&&!o)){let s=_e(),i=await J("app.js",...s);if(n){let c=i.find(h=>dt(h)===n);c?r=N(c,"app.js"):process.stderr.write(`Warning: preferred version ${n} not found in package cache, using built-in version | ||
| `)}else i.length>0&&(r=N(i[0],"app.js"))}return r}import{existsSync as mt}from"node:fs";import{basename as gt,resolve as ht}from"node:path";var we="extension_bootstrap.mjs";function Oe(e,t,r=mt){let o=e.find(i=>gt(i)===we);if(!o)return;process.stderr.write(`[extension-fork] resolveBootstrapPath: __dir=${t}, argv-bootstrap=${o} | ||
| `);let n=ht(t,"preloads",we),s=r(n);if(process.stderr.write(`[extension-fork] resolveBootstrapPath: localBootstrap=${n}, localExists=${s} | ||
| `),s)return n}import Ie from"node:path";import{fileURLToPath as Pt}from"node:url";function yt(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let t=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),r=e.substring(0,t).trim();return r?`${r} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function Le(e){let t;if(e instanceof Error)t=String(e);else if(typeof e=="object"&&e!==null)try{t=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else t=String(e);return yt(t)}import{createRequire as bt}from"node:module";import{platform as Et,type as vt}from"node:os";import{join as Pe,resolve as xt}from"node:path";import{fileURLToPath as _t}from"node:url";function Ct(){let e=ke(),t=e==="linux"?L({platform:e}):"gnu";return`${F(e,t)}-${process.arch}`}function wt(){let e=ke(),{arch:t}=process;switch(e){case"win32":return`win32-${t}-msvc`;case"darwin":return`darwin-${t}`;case"linux":return`linux-${t}-${L({platform:e})}`;default:throw new Error(`Unsupported platform: ${e}/${t}`)}}var u;function ke(){if(u!==void 0)return u;switch(vt()){case"Windows_NT":u="win32";break;case"Darwin":u="darwin";break;case"Linux":u="linux";break;case"AIX":u="aix";break;case"FreeBSD":case"DragonFly":u="freebsd";break;case"OpenBSD":u="openbsd";break;case"NetBSD":u="netbsd";break;case"SunOS":u="sunos";break;default:u=Et();break}return u}function Te(e,t){let r=Ct(),o=`${e}.node`,n=`${e}.${wt()}.node`,s=[];for(let c of t){let h=xt(c),$=Pe(h,"prebuilds",r,o),k=Se($);if(k.ok)return k.value;s.push({path:$,err:k.err});let H=Pe(h,n),T=Se(H);if(T.ok)return T.value;s.push({path:H,err:T.err})}let i=s.map(c=>` ${c.path}: ${Ot(c.err)}`).join(` | ||
| var Ue=Object.create;var j=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var We=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty;var B=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var x=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Ye=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ge(t))!qe.call(e,o)&&o!==r&&j(e,o,{get:()=>t[o],enumerable:!(n=Ve(t,o))||n.enumerable});return e};var Ke=(e,t,r)=>(r=e!=null?Ue(We(e)):{},Ye(t||!e||!e.__esModule?j(r,"default",{value:e,enumerable:!0}):r,e));var Q=x((Xt,z)=>{"use strict";var X=()=>process.platform==="linux",w=null,et=()=>{if(!w)if(X()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,w=process.report.getReport(),process.report.excludeNetwork=e}else w={};return w};z.exports={isLinux:X,getReport:et}});var ee=x((zt,Z)=>{"use strict";var b=B("fs"),tt="/usr/bin/ldd",rt="/proc/self/exe",S=2048,nt=e=>{let t=b.openSync(e,"r"),r=Buffer.alloc(S),n=b.readSync(t,r,0,S,0);return b.close(t,()=>{}),r.subarray(0,n)},ot=e=>new Promise((t,r)=>{b.open(e,"r",(n,o)=>{if(n)r(n);else{let s=Buffer.alloc(S);b.read(o,s,0,S,0,(i,a)=>{t(s.subarray(0,a)),b.close(o,()=>{})})}})});Z.exports={LDD_PATH:tt,SELF_PATH:rt,readFileSync:nt,readFile:ot}});var re=x((Qt,te)=>{"use strict";var st=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),n=e.readUInt16LE(56);for(let o=0;o<n;o++){let s=t+o*r;if(e.readUInt32LE(s)===3){let a=e.readUInt32LE(s+8),h=e.readUInt32LE(s+32);return e.subarray(a,a+h).toString().replace(/\0.*$/g,"")}}return null};te.exports={interpreterPath:st}});var ve=x((Zt,xe)=>{"use strict";var oe=B("child_process"),{isLinux:y,getReport:se}=Q(),{LDD_PATH:C,SELF_PATH:ie,readFile:A,readFileSync:I}=ee(),{interpreterPath:ae}=re(),l,f,d,ce="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",m="",ue=()=>m||new Promise(e=>{oe.exec(ce,(t,r)=>{m=t?" ":r,e(m)})}),le=()=>{if(!m)try{m=oe.execSync(ce,{encoding:"utf8"})}catch{m=" "}return m},p="glibc",fe=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,g="musl",it=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),de=()=>{let e=se();return e.header&&e.header.glibcVersionRuntime?p:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(it)?g:null},pe=e=>{let[t,r]=e.split(/[\r\n]+/);return t&&t.includes(p)?p:r&&r.includes(g)?g:null},me=e=>{if(e){if(e.includes("/ld-musl-"))return g;if(e.includes("/ld-linux-"))return p}return null},ge=e=>(e=e.toString(),e.includes("musl")?g:e.includes("GNU C Library")?p:null),at=async()=>{if(f!==void 0)return f;f=null;try{let e=await A(C);f=ge(e)}catch{}return f},ct=()=>{if(f!==void 0)return f;f=null;try{let e=I(C);f=ge(e)}catch{}return f},ut=async()=>{if(l!==void 0)return l;l=null;try{let e=await A(ie),t=ae(e);l=me(t)}catch{}return l},lt=()=>{if(l!==void 0)return l;l=null;try{let e=I(ie),t=ae(e);l=me(t)}catch{}return l},he=async()=>{let e=null;if(y()&&(e=await ut(),!e&&(e=await at(),e||(e=de()),!e))){let t=await ue();e=pe(t)}return e},be=()=>{let e=null;if(y()&&(e=lt(),!e&&(e=ct(),e||(e=de()),!e))){let t=le();e=pe(t)}return e},ft=async()=>y()&&await he()!==p,dt=()=>y()&&be()!==p,pt=async()=>{if(d!==void 0)return d;d=null;try{let t=(await A(C)).match(fe);t&&(d=t[1])}catch{}return d},mt=()=>{if(d!==void 0)return d;d=null;try{let t=I(C).match(fe);t&&(d=t[1])}catch{}return d},ye=()=>{let e=se();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},ne=e=>e.trim().split(/\s+/)[1],Ee=e=>{let[t,r,n]=e.split(/[\r\n]+/);return t&&t.includes(p)?ne(t):r&&n&&r.includes(g)?ne(n):null},gt=async()=>{let e=null;if(y()&&(e=await pt(),e||(e=ye()),!e)){let t=await ue();e=Ee(t)}return e},ht=()=>{let e=null;if(y()&&(e=mt(),e||(e=ye()),!e)){let t=le();e=Ee(t)}return e};xe.exports={GLIBC:p,MUSL:g,family:he,familySync:be,isNonGlibcLinux:ft,isNonGlibcLinuxSync:dt,version:gt,versionSync:ht}});import Mt from"node:module";import{basename as Dt,dirname as jt,join as Bt}from"node:path";import*as Be from"node:sea";import{fileURLToPath as Ut,pathToFileURL as k}from"node:url";import{basename as bt,join as R}from"node:path";var U="0.0.1";import{readdir as Je,access as Xe,constants as ze}from"node:fs/promises";import{join as c,basename as V}from"node:path";import{homedir as v}from"node:os";function W(){return process.env.XDG_CACHE_HOME||c(v(),".cache")}function q(){if(process.argv.includes("--no-auto-update")||process.argv.includes("--prefer-version"))return!1;let e=process.env.COPILOT_AUTO_UPDATE;return!(e&&e.toLowerCase()==="false")}function Y(){let e=process.argv.indexOf("--prefer-version");if(!(e===-1||e+1>=process.argv.length))return process.argv[e+1]}function Qe(){if(process.platform==="darwin")return c(v(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||c(v(),".cache");return c(e,"copilot")}return c(W(),"copilot")}function K(){let e=[];return process.env.COPILOT_CACHE_HOME&&e.push(c(process.env.COPILOT_CACHE_HOME,"pkg")),e.push(c(Qe(),"pkg")),e.push(c(W(),"copilot","pkg")),process.env.COPILOT_HOME&&e.push(c(process.env.COPILOT_HOME,"pkg")),e.push(c(v(),".copilot","pkg")),[...new Set(e)]}function G(e){let t=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(t)return[Number(t[1]),Number(t[2]),Number(t[3])]}function Ze(e,t){let r=G(e),n=G(t);if(!r&&!n)return 0;if(!r)return-1;if(!n)return 1;for(let i=0;i<3;i++)if(r[i]!==n[i])return r[i]-n[i];let o=e.includes("-"),s=t.includes("-");return o!==s?o?-1:1:e.localeCompare(t)}async function J(e,...t){let r=[];for(let n of t){let o;try{o=await Je(n)}catch{continue}for(let s of o){let i=c(n,s);try{await Xe(c(i,e),ze.R_OK),r.push(i)}catch{continue}}}return r.sort((n,o)=>{let s=Ze(V(o),V(n));return s!==0?s:n.localeCompare(o)}),r}import{join as Se}from"node:path";var _=Ke(ve(),1);function O(e={}){return(e.platform??process.platform)!=="linux"?"gnu":(e.detectLibcFamily??_.familySync)()===_.MUSL?"musl":"gnu"}function N(e=process.platform,t){let r=t??(e==="linux"?O():"gnu");return e==="linux"&&r==="musl"?"linuxmusl":e}function we(e=process.platform,t,r=process.arch){return`${N(e,t)}-${r}`}function Ce(){let e=we();return K().flatMap(t=>[Se(t,"universal"),Se(t,e)])}function yt(){return process.env.COPILOT_CLI_VERSION?process.env.COPILOT_CLI_VERSION:"1.0.64"}async function _e(e,t){let r=R(e,"app.js"),n=yt()===U,o=Y();if(t&&(o||q()&&!n)){let s=Ce(),i=await J("app.js",...s);if(o){let a=i.find(h=>bt(h)===o);a?r=R(a,"app.js"):process.stderr.write(`Warning: preferred version ${o} not found in package cache, using built-in version | ||
| `)}else i.length>0&&(r=R(i[0],"app.js"))}return r}import{existsSync as Et}from"node:fs";import{basename as xt,resolve as vt}from"node:path";var Oe="extension_bootstrap.mjs";function ke(e,t,r=Et){let n=e.find(i=>xt(i)===Oe);if(!n)return;process.stderr.write(`[extension-fork] resolveBootstrapPath: __dir=${t}, argv-bootstrap=${n} | ||
| `);let o=vt(t,"preloads",Oe),s=r(o);if(process.stderr.write(`[extension-fork] resolveBootstrapPath: localBootstrap=${o}, localExists=${s} | ||
| `),s)return o}var wt=new Set(["--server","--headless","--acp"]),St=new Set(["completion","help","init","login","mcp","plugin","update","version"]);function Ct(e){return e==="--prompt"||e.startsWith("--prompt=")||e==="-p"||e.startsWith("-p")&&e.length>2}function _t(e){if(e.some(r=>wt.has(r)||Ct(r)))return!0;let t=e.find(r=>!r.startsWith("-"));return t!==void 0&&St.has(t)}function Le(e){return!_t(e)}var Ot="github.copilot.cli.typeahead.capture",Pe=Symbol.for(Ot);function F(){let e=globalThis,t=e[Pe];return t||(t={buffer:[],capturing:!1,listener:null,exitHandler:null},e[Pe]=t),t}var H=class{detachListener(t){t.listener&&(process.stdin.removeListener("data",t.listener),t.listener=null)}clearExitHandler(t){t.exitHandler&&(process.removeListener("exit",t.exitHandler),t.exitHandler=null)}start(){let t=F();if(!process.stdin.isTTY||typeof process.stdin.setRawMode!="function"||t.capturing)return;try{process.stdin.setRawMode(!0)}catch{return}if(!t.exitHandler){let n=()=>{if(t.capturing)try{process.stdin.setRawMode(!1)}catch{}};t.exitHandler=n,process.once("exit",n)}let r=n=>{if(n.length===1&&n[0]===3){this.dispose(),process.kill(process.pid,"SIGINT");return}t.buffer.push(Buffer.from(n))};t.listener=r,process.stdin.on("data",r),process.stdin.unref(),t.capturing=!0}drain(){let t=F();if(this.detachListener(t),this.clearExitHandler(t),t.capturing=!1,t.buffer.length===0)return null;let r=Buffer.concat(t.buffer);return t.buffer=[],r}dispose(){let t=F();if(this.detachListener(t),this.clearExitHandler(t),t.buffer=[],!!t.capturing){try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),t.capturing=!1}}},Te=new H;import $e from"node:path";import{fileURLToPath as $t}from"node:url";function kt(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let t=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),r=e.substring(0,t).trim();return r?`${r} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function Ae(e){let t;if(e instanceof Error)t=String(e);else if(typeof e=="object"&&e!==null)try{t=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else t=String(e);return kt(t)}import{createRequire as Lt}from"node:module";import{platform as Pt,type as Tt}from"node:os";import{join as Ie,resolve as At}from"node:path";import{fileURLToPath as It}from"node:url";function Nt(){let e=Re(),t=e==="linux"?O({platform:e}):"gnu";return`${N(e,t)}-${process.arch}`}function Rt(){let e=Re(),{arch:t}=process;switch(e){case"win32":return`win32-${t}-msvc`;case"darwin":return`darwin-${t}`;case"linux":return`linux-${t}-${O({platform:e})}`;default:throw new Error(`Unsupported platform: ${e}/${t}`)}}var u;function Re(){if(u!==void 0)return u;switch(Tt()){case"Windows_NT":u="win32";break;case"Darwin":u="darwin";break;case"Linux":u="linux";break;case"AIX":u="aix";break;case"FreeBSD":case"DragonFly":u="freebsd";break;case"OpenBSD":u="openbsd";break;case"NetBSD":u="netbsd";break;case"SunOS":u="sunos";break;default:u=Pt();break}return u}function Fe(e,t){let r=Nt(),n=`${e}.node`,o=`${e}.${Rt()}.node`,s=[];for(let a of t){let h=At(a),M=Ie(h,"prebuilds",r,n),P=Ne(M);if(P.ok)return P.value;s.push({path:M,err:P.err});let D=Ie(h,o),T=Ne(D);if(T.ok)return T.value;s.push({path:D,err:T.err})}let i=s.map(a=>` ${a.path}: ${Ft(a.err)}`).join(` | ||
| `);throw new Error(`Native addon "${e}" not found for ${r}. Tried: | ||
| ${i}`)}function Ot(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}}function Se(e){try{return{ok:!0,value:Lt(e)}}catch(t){return{ok:!1,err:t}}}function Lt(e){return bt(_t(import.meta.url))(e)}var E,Ae=Ie.dirname(Pt(import.meta.url));function Fe(){if(E){if(E.kind==="ok")return E.addon;throw E.error}try{let e=Te("cli-native",[Ae,Ie.resolve(Ae,"..","native","cli")]);return E={kind:"ok",addon:e},e}catch(e){let t=e instanceof Error?e:new Error(`Failed to load cli-native addon: ${Le(e)}`);throw E={kind:"error",error:t},t}}function Ne(){if(process.platform==="win32")return Fe()}try{St.enableCompileCache?.()}catch{}var R=Tt(It(import.meta.url)),Ft=$e.isSea();process.report.reportOnFatalError=!0;process.report.excludeEnv=!0;if(process.platform==="win32")try{let e=Ne();if(!e)throw new Error("loadWin32NativeAddon returned undefined on win32");e.enableCrashReporting(),e.installExceptionFilter()}catch{}var S=process.argv.find(e=>kt(e).startsWith("conpty_console_list_agent")),Re=Oe(process.argv,R);if(S){let e=S.endsWith(".js")?S:S+".js";await import(P(e).href)}else if(Re)await import(P(Re).href);else if(process.env.COPILOT_VOICE_SERVER_MODE==="1"){let e=At(R,"voice-server.js");try{let{runVoiceServer:t}=await import(P(e).href);await t()}catch(t){process.stderr.write(`voice server: fatal at ${e}: ${t.stack??String(t)} | ||
| `),process.exit(1)}}else if(process.env.COPILOT_SHUTDOWN_FLUSH){try{let{url:e,headers:t,body:r}=JSON.parse(process.env.COPILOT_SHUTDOWN_FLUSH);await fetch(e,{method:"POST",headers:t,body:r,signal:AbortSignal.timeout(3e4)})}catch{}process.exit(0)}else{let e=await Ce(R,Ft);await import(P(e).href)} | ||
| ${i}`)}function Ft(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}}function Ne(e){try{return{ok:!0,value:Ht(e)}}catch(t){return{ok:!1,err:t}}}function Ht(e){return Lt(It(import.meta.url))(e)}var E,He=$e.dirname($t(import.meta.url));function Me(){if(E){if(E.kind==="ok")return E.addon;throw E.error}try{let e=Fe("cli-native",[He,$e.resolve(He,"..","native","cli")]);return E={kind:"ok",addon:e},e}catch(e){let t=e instanceof Error?e:new Error(`Failed to load cli-native addon: ${Ae(e)}`);throw E={kind:"error",error:t},t}}function De(){if(process.platform==="win32")return Me()}try{Mt.enableCompileCache?.()}catch{}var $=jt(Ut(import.meta.url)),Vt=Be.isSea();process.report.reportOnFatalError=!0;process.report.excludeEnv=!0;if(process.platform==="win32")try{let e=De();if(!e)throw new Error("loadWin32NativeAddon returned undefined on win32");e.enableCrashReporting(),e.installExceptionFilter()}catch{}var L=process.argv.find(e=>Dt(e).startsWith("conpty_console_list_agent")),je=ke(process.argv,$);if(L){let e=L.endsWith(".js")?L:L+".js";await import(k(e).href)}else if(je)await import(k(je).href);else if(process.env.COPILOT_VOICE_SERVER_MODE==="1"){let e=Bt($,"voice-server.js");try{let{runVoiceServer:t}=await import(k(e).href);await t()}catch(t){process.stderr.write(`voice server: fatal at ${e}: ${t.stack??String(t)} | ||
| `),process.exit(1)}}else if(process.env.COPILOT_SHUTDOWN_FLUSH){try{let{url:e,headers:t,body:r}=JSON.parse(process.env.COPILOT_SHUTDOWN_FLUSH);await fetch(e,{method:"POST",headers:t,body:r,signal:AbortSignal.timeout(3e4)})}catch{}process.exit(0)}else{Le(process.argv.slice(2))&&Te.start();let e=await _e($,Vt);await import(k(e).href)} |
+1
-1
| { | ||
| "name": "@github/copilot-linux-arm64", | ||
| "version": "1.0.64-3", | ||
| "version": "1.0.64", | ||
| "description": "GitHub Copilot CLI for linux-arm64", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.md", |
@@ -1,2 +0,2 @@ | ||
| (()=>{const stack=new Error().stack;stack&&(globalThis._sentryDebugIds=globalThis._sentryDebugIds||{},globalThis._sentryDebugIds[stack]="8987d944-b2b4-510a-b7c6-388a2de1a1ea",globalThis._sentryDebugIdIdentifier="sentry-dbid-8987d944-b2b4-510a-b7c6-388a2de1a1ea");})(); | ||
| (()=>{const stack=new Error().stack;stack&&(globalThis._sentryDebugIds=globalThis._sentryDebugIds||{},globalThis._sentryDebugIds[stack]="628e9d2d-212f-52d0-816f-b13d2309989c",globalThis._sentryDebugIdIdentifier="sentry-dbid-628e9d2d-212f-52d0-816f-b13d2309989c");})(); | ||
@@ -53,4 +53,4 @@ /*--------------------------------------------------------------------------------------------- | ||
| const __dirname = __path.dirname(__filename); | ||
| import{parentPort as T,workerData as B}from"node:worker_threads";var m=class{initialQueue=[];initialQueueResolvers=Promise.withResolvers();logWriter=null;writePromise=this.initialQueueResolvers.promise;setLogWriter(r){this.logWriter=r;for(let t of this.initialQueue)this.writePromise=this.logWriter.writeLog(t.method,t.message);this.initialQueue=[],this.initialQueueResolvers.resolve()}async flush(){await this.writePromise}async dispose(){await this.flush()}outputPath(){return this.logWriter?.outputPath()}logToLevel(r,t){this.logWriter?this.writePromise=this.logWriter.writeLog(r,t):this.initialQueue.push({method:r,message:t})}info(r){this.logToLevel("info",r)}debug(r){this.logToLevel("debug",r)}warning(r){this.logToLevel("warning",r)}error(r){this.logToLevel("error",r instanceof Error?r.message:r)}log(r){this.error(r)}isDebug(){return!1}shouldLog(r){return!0}notice(r){this.info(r instanceof Error?r.message:r)}startGroup(r,t){this.info(`--- Start of group: ${r} ---`)}endGroup(r){this.info("--- End of group ---")}},u=new m;import{createRequire as j}from"node:module";import*as o from"node:fs/promises";import*as a from"node:path";import{createHash as W}from"node:crypto";import{join as l,basename as ne}from"node:path";import{homedir as h}from"node:os";function F(){return process.env.XDG_CACHE_HOME||l(h(),".cache")}function b(){if(process.platform==="darwin")return l(h(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||l(h(),".cache");return l(e,"copilot")}return l(F(),"copilot")}function D(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let r=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),t=e.substring(0,r).trim();return t?`${t} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function y(e){let r;if(e instanceof Error)r=String(e);else if(typeof e=="object"&&e!==null)try{r=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else r=String(e);return D(r)}var H=1,S=".complete";var w={"win32-x64":"win-x64","win32-arm64":"win-arm64","linux-x64":"linux-x64","darwin-arm64":"osx-arm64"};function I(){return typeof __foundryRequire<"u"&&__foundryRequire||j(import.meta.url)}var f;function U(){if(f)return f;try{let e=I()("foundry-local-sdk/script/install-utils.cjs");if(typeof e.runInstall!="function")throw new Error(`Expected exports {runInstall: function}, got: ${JSON.stringify(Object.fromEntries(Object.entries(e).map(([r,t])=>[r,typeof t])))}`);return f=e,f}catch(e){throw new Error(`Failed to load foundry-local-sdk/script/install-utils.cjs: ${y(e)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}var g;function J(){if(g)return g;try{let e=I()("foundry-local-sdk/deps_versions.json");if(typeof e["foundry-local-core"]?.nuget!="string"||typeof e.onnxruntime?.version!="string"||typeof e["onnxruntime-genai"]?.version!="string")throw new Error('deps_versions.json is missing one of the expected version keys: ["foundry-local-core"].nuget, .onnxruntime.version, ["onnxruntime-genai"].version');return g=e,g}catch(e){throw new Error(`Failed to load foundry-local-sdk/deps_versions.json: ${y(e)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}function O(e=process.platform){let r=J();return[{name:"Microsoft.AI.Foundry.Local.Core",version:r["foundry-local-core"].nuget},{name:e==="linux"?"Microsoft.ML.OnnxRuntime.Gpu.Linux":"Microsoft.ML.OnnxRuntime.Foundry",version:r.onnxruntime.version},{name:"Microsoft.ML.OnnxRuntimeGenAI.Foundry",version:r["onnxruntime-genai"].version}]}function C(e){return e==="win32"?".dll":e==="darwin"?".dylib":".so"}function G(e,r){return a.join(e,`Microsoft.AI.Foundry.Local.Core${C(r)}`)}function V(e){let r=C(e),t=e==="win32"?"":"lib";return[`Microsoft.AI.Foundry.Local.Core${r}`,`${t}onnxruntime${r}`,`${t}onnxruntime-genai${r}`]}function q(e,r=process.platform,t=process.arch){let n=w[`${r}-${t}`];if(!n)throw new Error(`Voice mode not supported on ${r}-${t}`);let s=e??process.env.COPILOT_CACHE_HOME??b(),i=O(r),c=W("sha256").update(JSON.stringify({schema:H,artifacts:i})).digest("hex").slice(0,12);return a.join(s,"foundry",c,n)}async function _(e={}){let r=e.platform??process.platform,t=e.arch??process.arch,n=`${r}-${t}`;if(!w[n])throw new Error(`Voice mode is not supported on ${n}. Supported platforms: ${Object.keys(w).join(", ")}.`);let i=q(e.cacheRoot,r,t),c=G(i,r),d=V(r);return await R(i,d)?{corePath:c}:(e.onDownloadStart?.(),await Y(i,r,d,e.runInstall),{corePath:c})}async function R(e,r){return await v(a.join(e,S))?(await Promise.all(r.map(n=>v(a.join(e,n))))).every(Boolean):!1}async function v(e){try{return await o.access(e),!0}catch{return!1}}async function Y(e,r,t,n){let s=a.dirname(e);await o.mkdir(s,{recursive:!0});let i=a.join(s,`.tmp-${a.basename(e)}-${process.pid}-${Date.now()}`);await o.mkdir(i,{recursive:!0});try{let c=n??U().runInstall,d=O(r);await X(()=>c(d,{binDir:i}));for(let P of t)if(!await v(a.join(i,P)))throw new Error(`Foundry runtime download finished but required file is missing: ${P}. RID for ${r} may not be supported by the published packages.`);await o.writeFile(a.join(i,S),""),await K(i,e,t)}catch(c){throw await o.rm(i,{recursive:!0,force:!0}).catch(()=>{}),c}}async function K(e,r,t){try{await o.rename(e,r)}catch(n){let s=n.code;if(s==="ENOTEMPTY"||s==="EEXIST"||s==="EPERM"){if(await R(r,t)){await o.rm(e,{recursive:!0,force:!0}).catch(()=>{});return}await o.rm(r,{recursive:!0,force:!0}),await o.rename(e,r);return}throw n}}async function X(e){let r=process.stdout.write.bind(process.stdout),t=process.stderr.write.bind(process.stderr);process.stdout.write=(()=>!0),process.stderr.write=(()=>!0);try{return await e()}finally{process.stdout.write=r,process.stderr.write=t}}var E=class extends Error{constructor(t,n,s){super(t,s);this.code=n;this.name="VoiceBackendError"}code};function $(e){return e instanceof E?{message:e.message,code:e.code}:e instanceof Error?{message:e.message}:{message:String(e)}}function M(e){return e instanceof Error?e:new Error(String(e))}var z=16;function k(e){return N(e,new WeakSet,0)}function N(e,r,t){if(t>=z)return"<cause chain truncated>";if(typeof e=="object"&&e!==null){if(r.has(e))return"<cyclic cause>";r.add(e)}if(!(e instanceof Error))return String(e);let n=e.stack??`${e.name}: ${e.message}`;if(e.cause===void 0)return n;let s=N(e.cause,r,t+1);return`${n} | ||
| Caused by: ${s}`}var x=16*1024,L=class{constructor(r){this.port=r}port;writeLog(r,t){let n={kind:"log",level:r,message:Q(t)};try{this.port.postMessage(n)}catch{}return Promise.resolve()}outputPath(){return"<voice-worker>"}};function A(e,r=u){r.setLogWriter(new L(e))}function Q(e){return e.length<=x?e:`${e.slice(0,x)}\u2026 [truncated, ${e.length-x} more chars]`}if(!T)throw new Error("voice-installer.worker.js must be loaded as a worker thread.");var p=T;A(p);var Z=B??{};async function ee(){try{let r={kind:"ok",location:await _({cacheRoot:Z.cacheRoot,onDownloadStart:()=>{let t={kind:"download-started"};p.postMessage(t)}})};p.postMessage(r)}catch(e){let r=M(e);u.error(`[voice-installer worker] install failed: ${k(r)}`);let t={kind:"error",error:$(r)};p.postMessage(t)}finally{setImmediate(()=>process.exit(0))}}ee().catch(e=>{u.error(`[voice-installer worker] fatal: ${k(e)}`),process.exit(1)}); | ||
| import{parentPort as T,workerData as B}from"node:worker_threads";var m=class{initialQueue=[];initialQueueResolvers=Promise.withResolvers();logWriter=null;writePromise=this.initialQueueResolvers.promise;setLogWriter(r){this.logWriter=r;for(let t of this.initialQueue)this.writePromise=this.logWriter.writeLog(t.method,t.message);this.initialQueue=[],this.initialQueueResolvers.resolve()}async flush(){await this.writePromise}async dispose(){await this.flush()}outputPath(){return this.logWriter?.outputPath()}logToLevel(r,t){this.logWriter?this.writePromise=this.logWriter.writeLog(r,t):this.initialQueue.push({method:r,message:t})}info(r){this.logToLevel("info",r)}debug(r){this.logToLevel("debug",r)}warning(r){this.logToLevel("warning",r)}error(r){this.logToLevel("error",r instanceof Error?r.message:r)}log(r){this.error(r)}isDebug(){return!1}shouldLog(r){return!0}notice(r){this.info(r instanceof Error?r.message:r)}startGroup(r,t){this.info(`--- Start of group: ${r} ---`)}endGroup(r){this.info("--- End of group ---")}},u=new m;import{createRequire as D}from"node:module";import*as o from"node:fs/promises";import*as a from"node:path";import{createHash as W}from"node:crypto";import{join as l,basename as ne}from"node:path";import{homedir as h}from"node:os";function j(){return process.env.XDG_CACHE_HOME||l(h(),".cache")}function P(){if(process.platform==="darwin")return l(h(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||l(h(),".cache");return l(e,"copilot")}return l(j(),"copilot")}function F(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let r=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),t=e.substring(0,r).trim();return t?`${t} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function y(e){let r;if(e instanceof Error)r=String(e);else if(typeof e=="object"&&e!==null)try{r=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else r=String(e);return F(r)}var H=1,S=".complete";var w={"win32-x64":"win-x64","win32-arm64":"win-arm64","linux-x64":"linux-x64","darwin-arm64":"osx-arm64"};function C(){return typeof __foundryRequire<"u"&&__foundryRequire||D(import.meta.url)}var f;function U(){if(f)return f;try{let e=C()("foundry-local-sdk/script/install-utils.cjs");if(typeof e.runInstall!="function")throw new Error(`Expected exports {runInstall: function}, got: ${JSON.stringify(Object.fromEntries(Object.entries(e).map(([r,t])=>[r,typeof t])))}`);return f=e,f}catch(e){throw new Error(`Failed to load foundry-local-sdk/script/install-utils.cjs: ${y(e)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}var g;function J(){if(g)return g;try{let e=C()("foundry-local-sdk/deps_versions.json");if(typeof e["foundry-local-core"]?.nuget!="string"||typeof e.onnxruntime?.version!="string"||typeof e["onnxruntime-genai"]?.version!="string")throw new Error('deps_versions.json is missing one of the expected version keys: ["foundry-local-core"].nuget, .onnxruntime.version, ["onnxruntime-genai"].version');return g=e,g}catch(e){throw new Error(`Failed to load foundry-local-sdk/deps_versions.json: ${y(e)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}function I(e=process.platform){let r=J();return[{name:"Microsoft.AI.Foundry.Local.Core",version:r["foundry-local-core"].nuget},{name:e==="linux"?"Microsoft.ML.OnnxRuntime.Gpu.Linux":"Microsoft.ML.OnnxRuntime.Foundry",version:r.onnxruntime.version},{name:"Microsoft.ML.OnnxRuntimeGenAI.Foundry",version:r["onnxruntime-genai"].version}]}function O(e){return e==="win32"?".dll":e==="darwin"?".dylib":".so"}function G(e,r){return a.join(e,`Microsoft.AI.Foundry.Local.Core${O(r)}`)}function V(e){let r=O(e),t=e==="win32"?"":"lib";return[`Microsoft.AI.Foundry.Local.Core${r}`,`${t}onnxruntime${r}`,`${t}onnxruntime-genai${r}`]}function q(e,r=process.platform,t=process.arch){let n=w[`${r}-${t}`];if(!n)throw new Error(`Voice mode not supported on ${r}-${t}`);let i=e??process.env.COPILOT_CACHE_HOME??P(),s=I(r),c=W("sha256").update(JSON.stringify({schema:H,artifacts:s})).digest("hex").slice(0,12);return a.join(i,"foundry",c,n)}async function _(e={}){let r=e.platform??process.platform,t=e.arch??process.arch,n=`${r}-${t}`;if(!w[n])throw new Error(`Voice mode is not supported on ${n}. Supported platforms: ${Object.keys(w).join(", ")}.`);let s=q(e.cacheRoot,r,t),c=G(s,r),d=V(r);return await R(s,d)?{corePath:c}:(e.onDownloadStart?.(),await Y(s,r,d,e.runInstall),{corePath:c})}async function R(e,r){return await v(a.join(e,S))?(await Promise.all(r.map(n=>v(a.join(e,n))))).every(Boolean):!1}async function v(e){try{return await o.access(e),!0}catch{return!1}}async function Y(e,r,t,n){let i=a.dirname(e);await o.mkdir(i,{recursive:!0});let s=a.join(i,`.tmp-${a.basename(e)}-${process.pid}-${Date.now()}`);await o.mkdir(s,{recursive:!0});try{let c=n??U().runInstall,d=I(r);await X(()=>c(d,{binDir:s}));for(let b of t)if(!await v(a.join(s,b)))throw new Error(`Foundry runtime download finished but required file is missing: ${b}. RID for ${r} may not be supported by the published packages.`);await o.writeFile(a.join(s,S),""),await K(s,e,t)}catch(c){throw await o.rm(s,{recursive:!0,force:!0}).catch(()=>{}),c}}async function K(e,r,t){try{await o.rename(e,r)}catch(n){let i=n.code;if(i==="ENOTEMPTY"||i==="EEXIST"||i==="EPERM"){if(await R(r,t)){await o.rm(e,{recursive:!0,force:!0}).catch(()=>{});return}await o.rm(r,{recursive:!0,force:!0}),await o.rename(e,r);return}throw n}}async function X(e){let r=process.stdout.write.bind(process.stdout),t=process.stderr.write.bind(process.stderr);process.stdout.write=(()=>!0),process.stderr.write=(()=>!0);try{return await e()}finally{process.stdout.write=r,process.stderr.write=t}}var E=class extends Error{constructor(t,n,i){super(t,i);this.code=n;this.name="VoiceBackendError"}code};function $(e){return e instanceof E?{message:e.message,code:e.code}:e instanceof Error?{message:e.message}:{message:String(e)}}function N(e){return e instanceof Error?e:new Error(String(e))}var z=16;function k(e){return M(e,new WeakSet,0)}function M(e,r,t){if(t>=z)return"<cause chain truncated>";if(typeof e=="object"&&e!==null){if(r.has(e))return"<cyclic cause>";r.add(e)}if(!(e instanceof Error))return String(e);let n=e.stack??`${e.name}: ${e.message}`;if(e.cause===void 0)return n;let i=M(e.cause,r,t+1);return`${n} | ||
| Caused by: ${i}`}var x=16*1024,L=class{constructor(r){this.port=r}port;writeLog(r,t){let n={kind:"log",level:r,message:Q(t)};try{this.port.postMessage(n)}catch{}return Promise.resolve()}outputPath(){return"<voice-worker>"}};function A(e,r=u){r.setLogWriter(new L(e))}function Q(e){return e.length<=x?e:`${e.slice(0,x)}\u2026 [truncated, ${e.length-x} more chars]`}if(!T)throw new Error("voice-installer.worker.js must be loaded as a worker thread.");var p=T;A(p);var Z=B??{};async function ee(){try{let r={kind:"ok",location:await _({cacheRoot:Z.cacheRoot,onDownloadStart:()=>{let t={kind:"download-started"};p.postMessage(t)}})};p.postMessage(r)}catch(e){let r=N(e);u.error(`[voice-installer worker] install failed: ${k(r)}`);let t={kind:"error",error:$(r)};p.postMessage(t)}finally{setImmediate(()=>process.exit(0))}}ee().catch(e=>{u.error(`[voice-installer worker] fatal: ${k(e)}`),process.exit(1)}); | ||
| //# sourceMappingURL=voice-installer.worker.js.map |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
330878775
0.17%214
0.47%230818
3.92%5
-16.67%145
-0.68%