@microsoft/copilot-sdk 2.0.0-preview.0 → 2.0.0-preview.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.
@@ -42,14 +42,10 @@ async function joinSession(config = {}) {
42
42
  mode: "coding-agent",
43
43
  _internalConnection: { kind: "parent-process" }
44
44
  });
45
- const {
46
- extensionSdkPath: _stripped,
47
- skillProvider: _strippedSkillProvider,
48
- imageGeneration: _strippedImageGeneration,
49
- workflows,
50
- requestedEnvironmentVariables,
51
- ...rest
52
- } = config;
45
+ const { workflows, requestedEnvironmentVariables, ...rest } = config;
46
+ const { sdkPath: _stripped, ...extensions } = config.extensions ?? {};
47
+ const { provider: _strippedSkillProvider, ...skills } = config.skills ?? {};
48
+ const { imageGeneration: _strippedImageGeneration, ...tools } = config.tools ?? {};
53
49
  void _stripped;
54
50
  void _strippedSkillProvider;
55
51
  void _strippedImageGeneration;
@@ -57,7 +53,13 @@ async function joinSession(config = {}) {
57
53
  sessionId,
58
54
  {
59
55
  ...rest,
60
- onPermissionRequest: config.onPermissionRequest ?? import_types.defaultJoinSessionPermissionHandler,
56
+ extensions,
57
+ skills,
58
+ tools,
59
+ permissions: {
60
+ ...rest.permissions,
61
+ onRequest: config.permissions?.onRequest ?? import_types.defaultJoinSessionPermissionHandler
62
+ },
61
63
  suppressResumeEvent: config.suppressResumeEvent ?? true
62
64
  },
63
65
  { workflows },
@@ -1596,7 +1596,7 @@ function createInternalServerRpc(connection) {
1596
1596
  */
1597
1597
  setHookDisabled: async (params) => connection.sendRequest("user.settings.setHookDisabled", params),
1598
1598
  /**
1599
- * Reads the user's settings document exactly as `user.settings.load` does, but from a caller-supplied configuration directory instead of the one the server resolved for itself. Use this when a consumer scopes a session to its own Copilot home — the SDK's per-session `configDir` override — so the settings read match the directory that session actually uses. An absent or empty `configDir` resolves the server's own home, making this identical to `user.settings.load`. Hook-validation relaxations are deliberately not caller-supplied: they continue to come from the server's environment, so a consumer cannot widen the host's hook policy through this method.
1599
+ * Reads the user's settings document as `user.settings.loadWithWarning` does, without its warning, but from a caller-supplied configuration directory instead of the one the server resolved for itself. Use this when a consumer scopes a session to its own Copilot home — the SDK's per-session `configDir` override — so the settings read match the directory that session actually uses. An absent or empty `configDir` resolves the server's own home, making this identical to the `settings` that `user.settings.loadWithWarning` returns. Hook-validation relaxations are deliberately not caller-supplied: they continue to come from the server's environment, so a consumer cannot widen the host's hook policy through this method.
1600
1600
  *
1601
1601
  * @param params Selects the configuration directory whose user settings to read.
1602
1602
  *
@@ -1604,7 +1604,7 @@ function createInternalServerRpc(connection) {
1604
1604
  */
1605
1605
  loadForConfigDir: async (params) => connection.sendRequest("user.settings.loadForConfigDir", params),
1606
1606
  /**
1607
- * Reads a repository's checked-in settings document as stored, normalized, together with any diagnostic raised while reading it. This is the repository half of the layering `user.settings.get` reports: `user.settings.load` reads the user's own document, and this reads the one a repository checks in to govern the keys `user.settings.governanceKeys` lists as repo-governable. A document that fails to parse, or that sets a key a repository may not govern, is reported through `warning` while the settings that did load are still returned, so a consumer surfaces the diagnostic and continues rather than failing the session. When `repoRoot` is the user's home directory the Claude-compatible configuration is skipped, so a home-directory session does not inherit a personal config as repository policy.
1607
+ * Reads a repository's checked-in settings document as stored, normalized, together with any diagnostic raised while reading it. This is the repository half of the layering `user.settings.get` reports: `user.settings.loadWithWarning` reads the user's own document, and this reads the one a repository checks in to govern the keys `user.settings.listGovernanceKeys` lists as repo-governable. A document that fails to parse, or that sets a key a repository may not govern, is reported through `warning` while the settings that did load are still returned, so a consumer surfaces the diagnostic and continues rather than failing the session. When `repoRoot` is the user's home directory the Claude-compatible configuration is skipped, so a home-directory session does not inherit a personal config as repository policy.
1608
1608
  *
1609
1609
  * @param params Selects the repository whose checked-in settings to read.
1610
1610
  *
@@ -1620,13 +1620,13 @@ function createInternalServerRpc(connection) {
1620
1620
  */
1621
1621
  loadAndMergeRepo: async (params) => connection.sendRequest("user.settings.loadAndMergeRepo", params),
1622
1622
  /**
1623
- * Reports the on-disk path of the settings document `user.settings.load` and `user.settings.set` read and write. Resolved the same way those methods resolve it, so a host that shows or opens the settings file names the file the runtime actually uses, including the extensionless legacy `settings` file when that is what is present.
1623
+ * Reports the on-disk path of the settings document `user.settings.loadWithWarning` and `user.settings.set` read and write. Resolved the same way those methods resolve it, so a host that shows or opens the settings file names the file the runtime actually uses, including the extensionless legacy `settings` file when that is what is present.
1624
1624
  *
1625
1625
  * @returns The on-disk location of the user's settings document.
1626
1626
  */
1627
1627
  getPath: async () => connection.sendRequest("user.settings.getPath", {}),
1628
1628
  /**
1629
- * Reads the user's stored settings together with the diagnostic raised while reading them. This is `user.settings.load` plus the reason part of the document was ignored: that one answers the document alone, so a caller cannot tell a clean read from a salvaged one. Read this when the caller is about to write the file back, where accepting a partial parse would discard every value the loader could not read. The settings that did load are still reported alongside the warning, so a consumer may surface it and continue instead of failing.
1629
+ * Reads the user's stored settings together with the diagnostic raised while reading them. This is `user.settings.loadForConfigDir` without a `configDir` plus the reason part of the document was ignored: that one answers the document alone, so a caller cannot tell a clean read from a salvaged one. Read this when the caller is about to write the file back, where accepting a partial parse would discard every value the loader could not read. The settings that did load are still reported alongside the warning, so a consumer may surface it and continue instead of failing.
1630
1630
  *
1631
1631
  * @returns The user's stored settings, together with any diagnostic raised while reading them.
1632
1632
  */
@@ -1688,7 +1688,7 @@ function createInternalServerRpc(connection) {
1688
1688
  */
1689
1689
  migrateStaffLogLevelOnce: async (params) => connection.sendRequest("user.settings.migrateStaffLogLevelOnce", params),
1690
1690
  /**
1691
- * Runs the one-time cleanup that removes obsolete CLI-owned settings and legacy rubber-duck keys from the user's settings document, and reports what it did. Idempotent and safe to call on every startup: with nothing obsolete left it reports `unchanged` and writes nothing. The cleanup preserves every key it does not recognize, so a setting written by a newer host is never dropped by an older one, and a document that fails to parse is reported `invalid` and left untouched rather than rewritten from a partial read. The cleaned document is not returned: it is written before this replies, so `user.settings.load` reads it authoritatively. A host that surfaces unrecognized keys through `user.settings.unknownKeys` wants this first, because the keys this retires would otherwise be shown to the user as if they were misspelled settings.
1691
+ * Runs the one-time cleanup that removes obsolete CLI-owned settings and legacy rubber-duck keys from the user's settings document, and reports what it did. Idempotent and safe to call on every startup: with nothing obsolete left it reports `unchanged` and writes nothing. The cleanup preserves every key it does not recognize, so a setting written by a newer host is never dropped by an older one, and a document that fails to parse is reported `invalid` and left untouched rather than rewritten from a partial read. The cleaned document is not returned: it is written before this replies, so `user.settings.loadWithWarning` reads it authoritatively. A host that surfaces unrecognized keys through `user.settings.getUnknownKeysWarning` wants this first, because the keys this retires would otherwise be shown to the user as if they were misspelled settings.
1692
1692
  *
1693
1693
  * @param params Selects the configuration directory whose settings document to clean.
1694
1694
  *
@@ -1696,7 +1696,7 @@ function createInternalServerRpc(connection) {
1696
1696
  */
1697
1697
  migrateObsoleteOnDisk: async (params) => connection.sendRequest("user.settings.migrateObsoleteOnDisk", params),
1698
1698
  /**
1699
- * Resolves the on-disk locations of the settings files this runtime reads, so a consumer can show or open them. The user path is the same file `user.settings.get`, `user.settings.load`, and `user.settings.set` operate on. Supply `repoRoot` to also resolve that repository's checked-in and local settings paths. A path is reported whether or not the file exists.
1699
+ * Resolves the on-disk locations of the settings files this runtime reads, so a consumer can show or open them. The user path is the same file `user.settings.get`, `user.settings.loadWithWarning`, and `user.settings.set` operate on. Supply `repoRoot` to also resolve that repository's checked-in and local settings paths. A path is reported whether or not the file exists.
1700
1700
  *
1701
1701
  * @param params Selects which settings file paths to resolve.
1702
1702
  *
@@ -4858,7 +4858,7 @@ function createSessionRpc(connection, sessionId) {
4858
4858
  *
4859
4859
  * @param params Model identifier to use when re-tokenizing the session's existing messages.
4860
4860
  *
4861
- * @returns Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session.
4861
+ * @returns Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.usage_info` events. Returns zeros for an empty session.
4862
4862
  */
4863
4863
  recomputeContextTokens: async (params) => connection.sendRequest("session.metadata.recomputeContextTokens", { ...params, sessionId })
4864
4864
  },
@@ -22,7 +22,7 @@ __export(sdkProtocolVersion_exports, {
22
22
  getSdkProtocolVersion: () => getSdkProtocolVersion
23
23
  });
24
24
  module.exports = __toCommonJS(sdkProtocolVersion_exports);
25
- const SDK_PROTOCOL_VERSION = 3;
25
+ const SDK_PROTOCOL_VERSION = 4;
26
26
  function getSdkProtocolVersion() {
27
27
  return SDK_PROTOCOL_VERSION;
28
28
  }
@@ -524,7 +524,7 @@ class CopilotSession {
524
524
  this._transcriptRecovery = recovery;
525
525
  }
526
526
  /**
527
- * Outcome of the `permissionMode` requested when this session was created
527
+ * Outcome of the `permissions.mode` requested when this session was created
528
528
  * or resumed: whether it was applied, and the authoritative mode the
529
529
  * session started in. Undefined when no mode was requested.
530
530
  */
@@ -1893,7 +1893,7 @@ class CopilotSession {
1893
1893
  /**
1894
1894
  * Sets the open-canvas snapshot for this session.
1895
1895
  *
1896
- * @param instances - The `openCanvases` array from the `session.resume` response.
1896
+ * @param instances - The `canvases.open` array from the `session.resume` response.
1897
1897
  * @internal This method is typically called internally when resuming a session.
1898
1898
  */
1899
1899
  setOpenCanvases(instances) {
@@ -69,7 +69,7 @@ class ToolSet {
69
69
  }
70
70
  /**
71
71
  * Returns a defensive copy of the accumulated filter strings, suitable for
72
- * passing as {@link SessionConfigBase.availableTools}.
72
+ * passing as {@link SessionOptionsBase.tools.availableTools}.
73
73
  */
74
74
  toArray() {
75
75
  return [...this.items];
package/dist/cjs/types.js CHANGED
@@ -45,39 +45,67 @@ const RuntimeConnection = {
45
45
  /**
46
46
  * Spawn a runtime child process and communicate over its stdin/stdout.
47
47
  */
48
- forStdio(opts = {}) {
49
- return { kind: "stdio", path: opts.path, args: opts.args, env: opts.env };
48
+ forSpawnedStdio(opts = {}) {
49
+ return {
50
+ kind: "spawned-stdio",
51
+ path: opts.path,
52
+ args: opts.args,
53
+ env: opts.env,
54
+ workingDirectory: opts.workingDirectory,
55
+ baseDirectory: opts.baseDirectory,
56
+ sessionIdleTimeoutSeconds: opts.sessionIdleTimeoutSeconds
57
+ };
50
58
  },
51
59
  /**
52
60
  * Spawn a runtime child process that listens on a TCP socket and connect to it.
53
61
  */
54
- forTcp(opts = {}) {
62
+ forSpawnedTcp(opts = {}) {
55
63
  return {
56
- kind: "tcp",
57
- port: opts.port,
58
- connectionToken: opts.connectionToken,
64
+ kind: "spawned-tcp",
59
65
  path: opts.path,
60
66
  args: opts.args,
61
- env: opts.env
67
+ env: opts.env,
68
+ workingDirectory: opts.workingDirectory,
69
+ baseDirectory: opts.baseDirectory,
70
+ sessionIdleTimeoutSeconds: opts.sessionIdleTimeoutSeconds,
71
+ port: opts.port,
72
+ connectionToken: opts.connectionToken
62
73
  };
63
74
  },
64
75
  /**
65
- * Connect to an already-running runtime at the given URL. The SDK does not
66
- * spawn a process in this mode.
76
+ * Connect to an already-running runtime over plaintext TCP without owning its lifetime.
67
77
  */
68
- forUri(url, opts = {}) {
69
- return { kind: "uri", url, connectionToken: opts.connectionToken };
78
+ forTcp(host, port, opts = {}) {
79
+ return { kind: "tcp", host, port, connectionToken: opts.connectionToken };
70
80
  },
71
81
  /**
72
82
  * Host the runtime in-process over the native runtime library's C ABI (FFI).
73
83
  *
74
84
  * The default when no connection or environment override is supplied.
75
- * Runtime configuration from `gitHubToken`, `telemetry` and
85
+ * Runtime configuration from `github.token`, `observability.telemetry` and
76
86
  * `baseDirectory` is scoped to this host, not the process environment.
77
87
  * Client-level `env` and `workingDirectory` are unsupported.
78
88
  */
79
89
  forInProcess(options = {}) {
80
- return { kind: "inprocess", ...options };
90
+ return { ...options, kind: "inprocess" };
91
+ },
92
+ /**
93
+ * Resolves the SDK/deployment default at factory-call time, without starting a runtime.
94
+ * Honors COPILOT_SDK_DEFAULT_CONNECTION (stdio/inprocess, case-insensitive);
95
+ * unset or empty uses the installed SDK's default. Invalid values throw.
96
+ * Use a concrete factory when the hosting mode must be fixed.
97
+ */
98
+ forDefault(options = {}) {
99
+ const value = process.env.COPILOT_SDK_DEFAULT_CONNECTION;
100
+ if (value?.toLowerCase() === "stdio") {
101
+ return RuntimeConnection.forSpawnedStdio(options);
102
+ }
103
+ if (!value || value.toLowerCase() === "inprocess") {
104
+ return RuntimeConnection.forInProcess(options);
105
+ }
106
+ throw new Error(
107
+ `Invalid COPILOT_SDK_DEFAULT_CONNECTION value '${value}'. Expected 'inprocess', 'stdio', or unset.`
108
+ );
81
109
  }
82
110
  };
83
111
  function convertMcpCallToolResult(callResult) {
@@ -1,2 +1,2 @@
1
- export declare const COPILOT_CLI_VERSION = "1.0.106-9.unstable.r43755488033.g11df7b2";
1
+ export declare const COPILOT_CLI_VERSION = "1.0.113-0.unstable.r43977958116.g150b9c6";
2
2
  export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
@@ -1,4 +1,4 @@
1
- const COPILOT_CLI_VERSION = "1.0.106-9.unstable.r43755488033.g11df7b2";
1
+ const COPILOT_CLI_VERSION = "1.0.113-0.unstable.r43977958116.g150b9c6";
2
2
  const COPILOT_CLI_USE_NPM_PACKAGE = false;
3
3
  export {
4
4
  COPILOT_CLI_USE_NPM_PACKAGE,
package/dist/client.d.ts CHANGED
@@ -2,7 +2,7 @@ import { createServerRpc } from "./generated/rpc.js";
2
2
  import { CopilotDecisions } from "./decisions.js";
3
3
  import { CopilotSession } from "./session.js";
4
4
  import { AhpHost, type AhpHostOptions } from "./host.js";
5
- import type { CopilotClientOptions, GetAuthStatusResponse, GetStatusResponse, ModelInfo, ResumeSessionConfig, SessionConfig, SessionLifecycleEventType, SessionLifecycleHandler, SessionListFilter, SessionMetadata, TypedSessionLifecycleHandler } from "./types.js";
5
+ import type { CopilotClientOptions, GetAuthStatusResponse, GetStatusResponse, Model, ResumeSessionOptions, CreateSessionOptions, SessionLifecycleEventType, SessionLifecycleHandler, SessionListFilter, SessionMetadata, TypedSessionLifecycleHandler } from "./types.js";
6
6
  export declare class CopilotClient {
7
7
  private cliStartTimeout;
8
8
  private cliProcess;
@@ -87,18 +87,6 @@ export declare class CopilotClient {
87
87
  get decisions(): CopilotDecisions;
88
88
  private logDebugTiming;
89
89
  private logDebug;
90
- /**
91
- * Environment variable that overrides the transport when the caller does not set
92
- * {@link CopilotClientOptions.connection}. Accepts `"inprocess"` or `"stdio"`
93
- * (case-insensitive); unset selects the in-process transport. Any other value
94
- * is an error.
95
- */
96
- private static readonly DEFAULT_CONNECTION_ENV_VAR;
97
- /**
98
- * Resolves the default {@link RuntimeConnection} for the no-connection case,
99
- * honoring {@link CopilotClient.DEFAULT_CONNECTION_ENV_VAR}.
100
- */
101
- private static resolveDefaultConnection;
102
90
  /**
103
91
  * Creates a new CopilotClient instance.
104
92
  *
@@ -112,30 +100,25 @@ export declare class CopilotClient {
112
100
  * // Connect to an existing runtime
113
101
  * const client = new CopilotClient({
114
102
  * mode: "coding-agent",
115
- * connection: RuntimeConnection.forUri("localhost:3000"),
103
+ * runtime: RuntimeConnection.forTcp("localhost", 3000),
116
104
  * });
117
- *
105
+ * *
118
106
  * // Spawn the runtime over TCP on a chosen port
119
107
  * const client = new CopilotClient({
120
108
  * mode: "coding-agent",
121
- * connection: RuntimeConnection.forTcp({ port: 9001 }),
109
+ * runtime: RuntimeConnection.forSpawnedTcp({ port: 9001 }),
122
110
  * });
123
- *
111
+ * *
124
112
  * // Use a custom runtime binary
125
113
  * const client = new CopilotClient({
126
114
  * mode: "coding-agent",
127
- * connection: RuntimeConnection.forStdio({ path: "/usr/local/bin/copilot" }),
128
- * logLevel: "debug",
115
+ * runtime: RuntimeConnection.forSpawnedStdio({ path: "/usr/local/bin/copilot" }),
116
+ * observability: { logLevel: "debug" },
129
117
  * });
130
118
  * ```
131
119
  */
132
120
  constructor(options: CopilotClientOptions);
133
121
  private connectionExtraArgs;
134
- /**
135
- * Parse CLI URL into host and port
136
- * Supports raw TCP addresses: "host:port", "[ipv6]:port", "http://host:port", or just "port"
137
- */
138
- private parseCliUrl;
139
122
  private validateSessionFsConfig;
140
123
  private setupSessionFs;
141
124
  private setupClientGlobalHandlers;
@@ -146,7 +129,7 @@ export declare class CopilotClient {
146
129
  /**
147
130
  * Starts the runtime host and establishes a connection.
148
131
  *
149
- * An explicit {@link RuntimeConnection.forUri} only establishes the connection.
132
+ * An explicit {@link RuntimeConnection.forTcp} only establishes the connection.
150
133
  * Otherwise, starts an in-process host or the explicitly selected subprocess.
151
134
  * If its subprocess survives a lost connection, it is terminated before restarting.
152
135
  *
@@ -199,7 +182,11 @@ export declare class CopilotClient {
199
182
  * @example
200
183
  * ```typescript
201
184
  * await using client = new CopilotClient({ mode: "coding-agent" });
202
- * const session = await client.createSession({ onPermissionRequest: approveAll });
185
+ * const session = await client.createSession({
186
+ * permissions: {
187
+ * onRequest: approveAll,
188
+ * },
189
+ * });
203
190
  * await session.sendAndWait("Hello");
204
191
  * // client.stop() is called automatically when the block exits.
205
192
  * ```
@@ -239,6 +226,8 @@ export declare class CopilotClient {
239
226
  private killCliProcess;
240
227
  /** Mode-specific defaults spread under the caller's config (app values win). */
241
228
  private configDefaultsForMode;
229
+ private applyModeDefaults;
230
+ private validateSessionCredentials;
242
231
  /** Mode-specific default for enableExperimentalMode. */
243
232
  private experimentalModeForMode;
244
233
  /**
@@ -255,12 +244,12 @@ export declare class CopilotClient {
255
244
  * Mode-specific options applied via session.options.update after create/resume.
256
245
  *
257
246
  * In empty mode, defaults the four overridable feature flags to safe values
258
- * (caller values from `config` win). `installedPlugins=[]` is unconditional
259
- * in empty mode. `includedBuiltinSkills` defaults to `[]`, but callers can
247
+ * (caller values from `config` win). `plugins.installed=[]` is unconditional
248
+ * in empty mode. `skills.includedBuiltinSkills` defaults to `[]`, but callers can
260
249
  * explicitly allow selected runtime-bundled skills.
261
250
  */
262
251
  private updateSessionOptionsForMode;
263
- createSession(config: SessionConfig): Promise<CopilotSession>;
252
+ createSession(config: CreateSessionOptions): Promise<CopilotSession>;
264
253
  private invalidateSessionInitializations;
265
254
  private getSessionInitializationSignal;
266
255
  private runInitializationCallback;
@@ -281,16 +270,24 @@ export declare class CopilotClient {
281
270
  * @example
282
271
  * ```typescript
283
272
  * // Resume a previous session
284
- * const session = await client.resumeSession("session-123", { onPermissionRequest: approveAll });
285
- *
273
+ * const session = await client.resumeSession("session-123", {
274
+ * permissions: {
275
+ * onRequest: approveAll
276
+ * }
277
+ * });
278
+ * *
286
279
  * // Resume with new tools
287
280
  * const session = await client.resumeSession("session-123", {
288
- * onPermissionRequest: approveAll,
289
- * tools: [myNewTool]
281
+ * permissions: {
282
+ * onRequest: approveAll
283
+ * },
284
+ * tools: {
285
+ * definitions: [myNewTool]
286
+ * }
290
287
  * });
291
288
  * ```
292
289
  */
293
- resumeSession(sessionId: string, config: ResumeSessionConfig): Promise<CopilotSession>;
290
+ resumeSession(sessionId: string, config: ResumeSessionOptions): Promise<CopilotSession>;
294
291
  private resumeSessionInternal;
295
292
  private resumeSessionWithInitialization;
296
293
  private requireAutoModeRecovery;
@@ -322,8 +319,7 @@ export declare class CopilotClient {
322
319
  *
323
320
  * @param message - Optional message to include in the ping
324
321
  * @returns A promise that resolves with the ping response containing the message and timestamp
325
- * @throws Error if the client is not connected, or if a {@link start} in progress when
326
- * this was called fails
322
+ * @throws Error if startup fails, the connection is unavailable, or shutdown is in progress
327
323
  *
328
324
  * @example
329
325
  * ```typescript
@@ -345,13 +341,11 @@ export declare class CopilotClient {
345
341
  */
346
342
  getAuthStatus(): Promise<GetAuthStatusResponse>;
347
343
  /**
348
- * Returns the connection for a request that must not start the client. A
349
- * {@link start} already in progress is awaited, so the request never precedes the
350
- * `connect` handshake or the provider registrations that follow it. A caller that
351
- * queues before it calls this passes the startup it observed first, because
352
- * `startPromise` is cleared once that startup settles.
344
+ * Lazily starts the client or joins its current startup. Await the observed
345
+ * attempt directly so its failure cannot turn into a retry within this request.
353
346
  */
354
347
  private getStartedConnection;
348
+ private assertNotStopping;
355
349
  /**
356
350
  * List available models with their metadata.
357
351
  *
@@ -361,10 +355,12 @@ export declare class CopilotClient {
361
355
  * Results are cached after the first successful call to avoid rate limiting.
362
356
  * The cache is cleared when the client disconnects.
363
357
  *
364
- * @throws Error if not connected, or if a {@link start} in progress when this was
365
- * called fails (when no custom handler is set)
358
+ * Starts the client if needed, unless a custom handler is set.
359
+ *
360
+ * @throws Error if startup fails, the connection is retired, or shutdown is in
361
+ * progress (when no custom handler is set)
366
362
  */
367
- listModels(): Promise<ModelInfo[]>;
363
+ listModels(): Promise<Model[]>;
368
364
  /**
369
365
  * Send the `connect` handshake (carrying the optional token) and verify the
370
366
  * server's protocol version. Falls back to `ping` against legacy servers
@@ -384,7 +380,11 @@ export declare class CopilotClient {
384
380
  * ```typescript
385
381
  * const lastId = await client.getLastSessionId();
386
382
  * if (lastId) {
387
- * const session = await client.resumeSession(lastId, { onPermissionRequest: approveAll });
383
+ * const session = await client.resumeSession(lastId, {
384
+ * permissions: {
385
+ * onRequest: approveAll,
386
+ * },
387
+ * });
388
388
  * }
389
389
  * ```
390
390
  */
@@ -525,6 +525,7 @@ export declare class CopilotClient {
525
525
  * ```
526
526
  */
527
527
  onLifecycle(handler: SessionLifecycleHandler): () => void;
528
+ private static normalizeEnvironment;
528
529
  /**
529
530
  * Builds runtime configuration for child processes and the per-host FFI snapshot.
530
531
  * Typed auth, home, keychain, and telemetry options override the effective env.