@github/copilot-sdk-darwin-arm64 1.0.15-unstable.35663726336.gcb2a8cc → 1.0.15

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.
Files changed (37) hide show
  1. package/copilot-sdk/cliVersion.d.ts +1 -1
  2. package/copilot-sdk/client.d.ts +3 -0
  3. package/copilot-sdk/docs/extensions.md +1 -1
  4. package/copilot-sdk/docs/workflows.md +255 -0
  5. package/copilot-sdk/extension.d.ts +6 -6
  6. package/copilot-sdk/extension.js +1631 -415
  7. package/copilot-sdk/generated/rpc.d.ts +11905 -7399
  8. package/copilot-sdk/generated/session-events.d.ts +965 -143
  9. package/copilot-sdk/index.d.ts +3 -3
  10. package/copilot-sdk/index.js +1627 -411
  11. package/copilot-sdk/installationConfirmation.d.ts +19 -0
  12. package/copilot-sdk/schema.d.ts +4 -0
  13. package/copilot-sdk/session.d.ts +20 -19
  14. package/copilot-sdk/types.d.ts +66 -69
  15. package/copilot-sdk/workflow.d.ts +367 -0
  16. package/package.json +1 -1
  17. package/plugins/computer-use/Copilot Computer Use.app/Contents/CodeResources +0 -0
  18. package/plugins/computer-use/Copilot Computer Use.app/Contents/Info.plist +2 -2
  19. package/plugins/computer-use/Copilot Computer Use.app/Contents/MacOS/Copilot Computer Use +0 -0
  20. package/plugins/computer-use/Copilot Computer Use.app/Contents/Resources/Assets.car +0 -0
  21. package/plugins/computer-use/Copilot Computer Use.app/Contents/Resources/icon.icns +0 -0
  22. package/plugins/computer-use/Copilot Computer Use.app/Contents/_CodeSignature/CodeResources +4 -4
  23. package/plugins/computer-use/computer-use-mcp +0 -0
  24. package/plugins/computer-use/{.mcp.json → mcp.json} +2 -1
  25. package/plugins/computer-use/plugin.json +6 -0
  26. package/prebuilds/darwin-arm64/copilot-runtime +0 -0
  27. package/prebuilds/darwin-arm64/runtime.node +2 -2
  28. package/preloads/extension_bootstrap.mjs +3 -4
  29. package/ripgrep/bin/darwin-arm64/rg +0 -0
  30. package/schemas/api.schema.json +7448 -3952
  31. package/schemas/session-events.schema.json +1129 -820
  32. package/tgrep/bin/darwin-arm64/tgrep +0 -0
  33. package/copilot-sdk/docs/factories.md +0 -296
  34. package/copilot-sdk/docs/factory-patterns.md +0 -194
  35. package/copilot-sdk/factory.d.ts +0 -327
  36. package/plugins/computer-use/.plugin/plugin.json +0 -6
  37. package/sdk/index.js +0 -1465
@@ -0,0 +1,19 @@
1
+ import { type CancellationToken, type MessageConnection } from "vscode-jsonrpc/node.js";
2
+ import type { InstallationConfirmationRequest, InstallationDecision, InstallationsConfirmResult } from "./generated/rpc.js";
3
+ /** The `installations.confirm` receiver, invoked with the transport's request cancellation. */
4
+ export interface InstallationConfirmationReceiver {
5
+ confirm(request: InstallationConfirmationRequest, token: CancellationToken): Promise<InstallationsConfirmResult>;
6
+ }
7
+ /**
8
+ * Collects an explicit human decision for the complete runtime review.
9
+ * Match operationId and policySessionId to the exact action registered by the host
10
+ * before displaying it. Refuse unknown actions or incomplete reviews; never infer
11
+ * authority from the current session or a global pending slot.
12
+ *
13
+ * The SDK echoes the original challenge and fingerprint. Separately spawned UI
14
+ * work must observe the token to retire itself when the request or connection ends.
15
+ * Registering this callback does not enable installation capabilities.
16
+ * @experimental
17
+ */
18
+ export type InstallationConfirmationHandler = (request: InstallationConfirmationRequest, token: CancellationToken) => InstallationDecision | Promise<InstallationDecision>;
19
+ export declare function createInstallationConfirmationAdapter(connection: MessageConnection, handler: InstallationConfirmationHandler): InstallationConfirmationReceiver;
@@ -0,0 +1,4 @@
1
+ import type { ResponseSchema, ZodSchema } from "./types.js";
2
+ export declare function isZodSchema(value: unknown): value is ZodSchema;
3
+ export declare function toJsonSchema(schema: ZodSchema | Record<string, unknown> | undefined): Record<string, unknown> | undefined;
4
+ export declare function isResponseSchema(value: unknown): value is ResponseSchema;
@@ -1,8 +1,8 @@
1
1
  import { createSessionRpc } from "./generated/rpc.js";
2
2
  import type { ModelSwitchAutoTierResult } from "./generated/rpc.js";
3
3
  import type { OpenCanvasInstance } from "./generated/rpc.js";
4
- import type { MessageOptions, ContextTier, ReasoningEffort, ReasoningSummary, AutoTier, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, TypedSessionEventHandler } from "./types.js";
5
- import { type SessionFactoryApi } from "./factory.js";
4
+ import type { MessageOptions, ResponseSchema, ContextTier, ReasoningEffort, ReasoningSummary, AutoTier, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, TypedSessionEventHandler } from "./types.js";
5
+ import { type SessionWorkflowApi } from "./workflow.js";
6
6
  /** Assistant message event - the final response from the assistant. */
7
7
  export type AssistantMessageEvent = Extract<SessionEvent, {
8
8
  type: "assistant.message";
@@ -48,8 +48,8 @@ export declare class CopilotSession {
48
48
  private canvases;
49
49
  private bearerTokenProviders;
50
50
  private commandHandlers;
51
- private factories;
52
- private factoryAbortControllers;
51
+ private workflows;
52
+ private workflowAbortControllers;
53
53
  private permissionHandler?;
54
54
  private mcpAuthHandler?;
55
55
  private userInputHandler?;
@@ -65,25 +65,19 @@ export declare class CopilotSession {
65
65
  private _capabilities;
66
66
  private openCanvasInstances;
67
67
  private disconnected;
68
+ private readonly pendingStructuredWaits;
68
69
  private disconnecting;
69
70
  private onDisconnected?;
70
71
  /**
71
- * Friendly factory API for running registered factories by name or handle.
72
+ * Friendly workflow API for running registered workflows by name or handle.
72
73
  *
73
- * @experimental Part of the experimental Agent Factories surface and may
74
+ * @experimental Part of the experimental Dynamic Workflows surface and may
74
75
  * change or be removed in future SDK or CLI releases.
75
76
  */
76
- readonly factory: SessionFactoryApi;
77
+ readonly workflow: SessionWorkflowApi;
78
+ private settleWorkflowRun;
77
79
  /**
78
- * Resolve a start/resume envelope into the terminal envelope callers expect.
79
- *
80
- * The CLI may answer `session.factory.run` and `session.factory.resume`
81
- * before the run settles, so a non-terminal envelope is followed by a wait
82
- * on the run's terminal state.
83
- */
84
- private settleFactoryRun;
85
- /**
86
- * Resolve when a factory run reaches a terminal status.
80
+ * Resolve when a workflow run reaches a terminal status.
87
81
  *
88
82
  * The subscription is installed *before* the first read so a transition
89
83
  * landing between the two cannot be missed, and re-reads are serialized so
@@ -92,7 +86,7 @@ export declare class CopilotSession {
92
86
  * collapse into a single in-flight read. A bounded periodic re-read keeps a
93
87
  * dropped invalidation from leaving the wait pending forever.
94
88
  */
95
- private waitForFactoryRun;
89
+ private waitForWorkflowRun;
96
90
  /**
97
91
  * Typed session-scoped RPC methods.
98
92
  */
@@ -122,13 +116,14 @@ export declare class CopilotSession {
122
116
  */
123
117
  get ui(): SessionUiApi;
124
118
  /**
125
- * Sends a message to this session and waits for the response.
119
+ * Sends a message to this session and returns once it is admitted.
126
120
  *
127
121
  * The message is processed asynchronously. Subscribe to events via {@link on}
128
122
  * to receive streaming responses and other session events.
129
123
  *
130
124
  * @param options - The message options including the prompt and optional attachments
131
- * @returns A promise that resolves with the message ID of the response
125
+ * @returns The submitted user message's ID, not an assistant response ID.
126
+ * When this send starts a run, root assistant messages carry it as originatingMessageId.
132
127
  * @throws Error if the session has been disconnected or the connection fails
133
128
  *
134
129
  * @example
@@ -149,6 +144,10 @@ export declare class CopilotSession {
149
144
  * assistant has finished processing the message.
150
145
  *
151
146
  * Events are still delivered to handlers registered via {@link on} while waiting.
147
+ * Sub-agent events with a non-empty `agentId` do not complete the wait or supply its reply.
148
+ * With a schema as the second argument, returns its parsed, validated result.
149
+ * Structured waits select only root-agent output originating from this send;
150
+ * other queued work may delay session.idle but cannot replace the result.
152
151
  *
153
152
  * @param options - The message options including the prompt and optional attachments
154
153
  * @param timeout - Timeout in milliseconds (default: 60000). Controls how long to wait; does not abort in-flight agent work.
@@ -165,7 +164,9 @@ export declare class CopilotSession {
165
164
  * ```
166
165
  */
167
166
  sendAndWait(prompt: string, timeout?: number): Promise<AssistantMessageEvent | undefined>;
167
+ sendAndWait<TResult>(options: MessageOptions | string, responseSchema: ResponseSchema<TResult>, timeout?: number): Promise<TResult>;
168
168
  sendAndWait(options: MessageOptions, timeout?: number): Promise<AssistantMessageEvent | undefined>;
169
+ private sendAndWaitForStructuredMessage;
169
170
  /**
170
171
  * Subscribes to events from this session.
171
172
  *
@@ -4,14 +4,16 @@
4
4
  import type { Canvas } from "./canvas.js";
5
5
  import type { SessionFsProvider } from "./sessionFsProvider.js";
6
6
  import type { CopilotRequestHandler } from "./copilotRequestHandler.js";
7
- import type { AutoTier, PermissionRequest as GeneratedPermissionRequest, PermissionRequestedData as GeneratedPermissionRequestedData, PermissionRequestedEvent as GeneratedPermissionRequestedEvent, ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
7
+ import type { InstallationConfirmationHandler } from "./installationConfirmation.js";
8
+ export type { InstallationConfirmationHandler } from "./installationConfirmation.js";
9
+ import type { AttachmentExtensionContext as GeneratedExtensionContextAttachment, AutoTier, PermissionRequest as GeneratedPermissionRequest, PermissionRequestedData as GeneratedPermissionRequestedData, PermissionRequestedEvent as GeneratedPermissionRequestedEvent, ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
8
10
  import type { CopilotSession } from "./session.js";
9
- import type { FactoryJsonSchema, JsonValue } from "./factory.js";
10
- import type { GitHubTokenAcquireRequest, GitHubTokenAcquireResult, GitHubTelemetryNotification, ModelBillingTokenPrices, OpenCanvasInstance, RemoteSessionMode, CurrentToolMetadata } from "./generated/rpc.js";
11
+ import type { JsonValue } from "./workflow.js";
12
+ import type { ExtensionLaunchProviderHandler as GeneratedExtensionLaunchProvider, GitHubTokenAcquireRequest, GitHubTokenAcquireResult, GitHubTelemetryNotification, ModelBillingTokenPrices, DiagnosticsConfiguration, OpenCanvasInstance, RemoteSessionMode, CurrentToolMetadata } from "./generated/rpc.js";
11
13
  import type { ToolSet } from "./toolSet.js";
12
14
  export type { RemoteSessionMode } from "./generated/rpc.js";
13
15
  export type { CurrentToolMetadata } from "./generated/rpc.js";
14
- export type { GitHubTokenAcquireReason, GitHubTokenAcquireResult, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, } from "./generated/rpc.js";
16
+ export type { ConnectorAccountRequest, ConnectorAvailability, ConnectorCapabilities, ConnectorCatalogEntry, ConnectorCatalogResult, ConnectorCatalogStatus, ConnectorConnectRequest, ConnectorConnectResult, ConnectorContinueRequest, ConnectorDisconnectResult, ConnectorMcpStatus, ConnectorReconcileRequest, ConnectorRuntimeStatus, ConnectorStatus, ExtensionLaunchProfile, ExtensionLaunchProviderResolveRequest, ExtensionLaunchProviderResolveResult, GitHubTokenAcquireReason, GitHubTokenAcquireResult, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, InstallationConfirmationRequest, InstallationConfirmationResponse, InstallationDecision, InstallationReview, McpInstallationReview, } from "./generated/rpc.js";
15
17
  /**
16
18
  * Arguments passed to a session's {@link GitHubTokenProvider}.
17
19
  *
@@ -282,6 +284,20 @@ export interface CopilotClientOptions {
282
284
  * startup before any sessions can be created.
283
285
  */
284
286
  builtinPluginDirectories?: readonly string[];
287
+ /**
288
+ * Connection-level extension launch profile provider.
289
+ * When set, the client registers the provider during startup before any
290
+ * session can be created.
291
+ *
292
+ * @experimental
293
+ */
294
+ extensionLaunchProvider?: ExtensionLaunchProvider;
295
+ /**
296
+ * Connection-global human review for experimental installation operations.
297
+ * Does not register or enable installation capabilities on the runtime.
298
+ * @experimental
299
+ */
300
+ installationConfirmationHandler?: InstallationConfirmationHandler;
285
301
  /**
286
302
  * Log level for the Copilot runtime. When omitted, the runtime uses its
287
303
  * own default (currently `"info"`).
@@ -409,6 +425,8 @@ export interface CopilotClientOptions {
409
425
  */
410
426
  clientInfo?: CopilotClientInfo;
411
427
  }
428
+ /** Resolves launch profiles for extension entrypoints discovered by the runtime. */
429
+ export type ExtensionLaunchProvider = GeneratedExtensionLaunchProvider;
412
430
  /**
413
431
  * Configuration for creating a session
414
432
  */
@@ -510,6 +528,13 @@ export interface ZodSchema<T = unknown> {
510
528
  _output: T;
511
529
  toJSONSchema(): Record<string, unknown>;
512
530
  }
531
+ /**
532
+ * A Zod-compatible output schema that both describes and parses a typed result.
533
+ * TypeScript types are erased at runtime, so typed output requires a schema value.
534
+ */
535
+ export interface ResponseSchema<T = unknown> extends ZodSchema<T> {
536
+ parse(value: unknown): T;
537
+ }
513
538
  /**
514
539
  * Tool definition. Parameters can be either:
515
540
  * - A Zod schema (provides type inference for handler)
@@ -1605,6 +1630,8 @@ export interface McpAuthStaticClientConfig {
1605
1630
  grantType?: "client_credentials";
1606
1631
  /** Whether this is a public OAuth client. */
1607
1632
  publicClient?: boolean;
1633
+ /** Configured OAuth scope string used when the server challenge omits scope. */
1634
+ scope?: string;
1608
1635
  }
1609
1636
  /** MCP OAuth request that the SDK host can satisfy with a host-acquired token. */
1610
1637
  export interface McpAuthRequest {
@@ -1673,69 +1700,6 @@ export interface CanvasProviderIdentity {
1673
1700
  /** Optional display name surfaced as the canvas extension name. */
1674
1701
  name?: string;
1675
1702
  }
1676
- /**
1677
- * Static resource ceilings declared by a factory before it runs.
1678
- *
1679
- * @experimental Part of the experimental Agent Factories surface and may
1680
- * change or be removed in future SDK or CLI releases.
1681
- */
1682
- export interface FactoryLimits {
1683
- /** Maximum number of factory subagents that may run concurrently. Must be positive when present. */
1684
- maxConcurrentSubagents?: number;
1685
- /** Maximum total number of factory subagents that may be spawned. Must be positive when present. */
1686
- maxTotalSubagents?: number;
1687
- /** Maximum AI credits consumed by factory subagents and descendants. This post-paid ceiling is soft. */
1688
- maxAiCredits?: number;
1689
- /**
1690
- * Maximum accumulated active-execution time, in seconds. Active execution includes the entire extension body,
1691
- * subprocess waits, queued-agent waits, and sleeps. The limit is armed from the remaining headroom when a run
1692
- * resumes; time between attempts is not counted. Must be finite and positive when present.
1693
- */
1694
- timeoutSeconds?: number;
1695
- }
1696
- /**
1697
- * Registration metadata for an extension-authored factory.
1698
- *
1699
- * @experimental Part of the experimental Agent Factories surface and may
1700
- * change or be removed in future SDK or CLI releases.
1701
- */
1702
- export interface FactoryMeta {
1703
- /** Stable factory name used for invocation. */
1704
- name: string;
1705
- /** Human-readable factory description. */
1706
- description: string;
1707
- /** Display metadata for the progress phases the factory may report. */
1708
- phases: Array<{
1709
- title: string;
1710
- detail?: string;
1711
- }>;
1712
- /**
1713
- * Optional declared shape of the arguments this factory expects as `ctx.args`.
1714
- *
1715
- * Declaring one is strongly recommended for any factory that reads `ctx.args`.
1716
- * When the model invokes the factory through the `run_factory` tool, the CLI
1717
- * validates `args` against this declaration **before** the run starts, so a
1718
- * malformed call is rejected with a correction hint and retried without ever
1719
- * creating a run row, prompting the user for permission, or spending credits. A
1720
- * factory that declares nothing is never validated: a malformed call starts,
1721
- * takes an approval, spends credits, and then fails inside the factory body.
1722
- * `factories_manage` with `operation: "inspect"` reports the declared shape so an
1723
- * agent can read it before invoking.
1724
- *
1725
- * This covers the model's `run_factory` path only. `session.factory.run(...)` is
1726
- * not validated against the declaration, so a factory should still check
1727
- * `ctx.args` rather than assume the declared shape held.
1728
- *
1729
- * Enforcement covers structure — types, required properties, and enum/const
1730
- * values. Finer constraints such as `minLength`, `pattern`, and
1731
- * `additionalProperties` are recorded in the declaration but not enforced. See
1732
- * {@link FactoryJsonSchema} for the accepted subset. A declaration outside that
1733
- * subset is rejected at registration.
1734
- */
1735
- argsSchema?: FactoryJsonSchema;
1736
- /** Optional resource ceilings presented to the user before execution. */
1737
- limits?: FactoryLimits;
1738
- }
1739
1703
  /**
1740
1704
  * Provider-scoped options for the Copilot API (CAPI).
1741
1705
  *
@@ -1905,6 +1869,16 @@ export interface SessionConfigBase {
1905
1869
  * the session to the long-context tier; omit or use "default" otherwise.
1906
1870
  */
1907
1871
  contextTier?: ContextTier;
1872
+ /**
1873
+ * Enables session-scoped MCP diagnostic capture at the requested level.
1874
+ *
1875
+ * Diagnostics are off by default. At `"debug"` and `"trace"` levels, entries
1876
+ * can contain MCP payloads, tool arguments, paths, and server stderr. Do not
1877
+ * upload entries as telemetry or export them without deliberate host action.
1878
+ * Omit this option when resuming a resident session to preserve its current
1879
+ * diagnostic level.
1880
+ */
1881
+ diagnostics?: DiagnosticsConfiguration;
1908
1882
  /** Per-property overrides for model capabilities, deep-merged over runtime defaults. */
1909
1883
  modelCapabilities?: ModelCapabilitiesOverride;
1910
1884
  /**
@@ -2448,6 +2422,14 @@ export interface SessionConfig extends SessionConfigBase {
2448
2422
  * Optional custom session ID. If not provided, the server generates one.
2449
2423
  */
2450
2424
  sessionId?: string;
2425
+ /**
2426
+ * Invalidates the process-wide custom-instruction discovery cache before
2427
+ * creating this session. Use when instruction files changed in the same runtime.
2428
+ * Other sessions in this runtime may observe updated instructions on later turns
2429
+ * or discovery. This does not watch files or enable disabled instruction loading.
2430
+ * @default false
2431
+ */
2432
+ refreshCustomInstructions?: boolean;
2451
2433
  /**
2452
2434
  * Creates a remote session in the cloud instead of a local session.
2453
2435
  * The optional repository is associated with the cloud session.
@@ -2740,6 +2722,8 @@ export interface ProviderModelConfig {
2740
2722
  * Message provenance, independent of delivery mode.
2741
2723
  */
2742
2724
  export type MessageSource = "user" | "system" | `agent-${string}`;
2725
+ /** Structured context contributed by an extension. */
2726
+ export type ExtensionContextAttachment = GeneratedExtensionContextAttachment;
2743
2727
  export interface MessageOptions {
2744
2728
  /**
2745
2729
  * The prompt/message to send
@@ -2752,7 +2736,7 @@ export interface MessageOptions {
2752
2736
  */
2753
2737
  source?: MessageSource;
2754
2738
  /**
2755
- * File, directory, selection, or blob attachments
2739
+ * File, directory, selection, blob, or extension context attachments
2756
2740
  */
2757
2741
  attachments?: Array<{
2758
2742
  type: "file";
@@ -2782,7 +2766,7 @@ export interface MessageOptions {
2782
2766
  data: string;
2783
2767
  mimeType: string;
2784
2768
  displayName?: string;
2785
- }>;
2769
+ } | ExtensionContextAttachment>;
2786
2770
  /**
2787
2771
  * Message delivery mode
2788
2772
  * - "enqueue": Add to queue (default)
@@ -2802,6 +2786,19 @@ export interface MessageOptions {
2802
2786
  * If provided, this is shown in the timeline instead of `prompt`.
2803
2787
  */
2804
2788
  displayPrompt?: string;
2789
+ /**
2790
+ * JSON Schema or a Zod schema for this run's output, including requests after tool calls.
2791
+ * Independent sends do not inherit it. Ordinary immediate steering retains the active
2792
+ * schema and origin, even when promoted to a follow-up after the model request finishes.
2793
+ * Specifying a schema with mode "immediate" is rejected, even while idle.
2794
+ * This is not a persisted session default and does not survive a context reset.
2795
+ *
2796
+ * sendAndWait still returns an assistant message event. For a typed result, pass a
2797
+ * Zod-compatible schema as sendAndWait's second argument instead.
2798
+ * Streaming events remain text and may include intermediate messages.
2799
+ * Use rpc.send's responseFormat for provider-specific name, description and strict options.
2800
+ */
2801
+ responseSchema?: ZodSchema | Record<string, unknown>;
2805
2802
  }
2806
2803
  /**
2807
2804
  * All possible event type strings from SessionEvent