@qoder-ai/qoder-agent-sdk 1.0.15 → 1.0.17

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 (57) hide show
  1. package/README.md +159 -24
  2. package/dist/auth.d.ts +4 -1
  3. package/dist/core/constants.d.ts +7 -2
  4. package/dist/core/deferred-transport.d.ts +23 -0
  5. package/dist/core/errors.d.ts +0 -8
  6. package/dist/core/process-transport.d.ts +3 -0
  7. package/dist/core/runtime-launch-options.d.ts +10 -1
  8. package/dist/core/transport.d.ts +2 -4
  9. package/dist/index.d.ts +13 -13
  10. package/dist/index.js +27 -22
  11. package/dist/mcp/sdk-mcp-server.d.ts +13 -1
  12. package/dist/mcp/tool-policy.d.ts +6 -0
  13. package/dist/protocol/agents.d.ts +0 -3
  14. package/dist/protocol/common.d.ts +27 -9
  15. package/dist/protocol/control.d.ts +40 -12
  16. package/dist/protocol/index.d.ts +4 -3
  17. package/dist/protocol/index.js +1 -1
  18. package/dist/protocol/mcp.d.ts +29 -0
  19. package/dist/protocol/messages.d.ts +38 -18
  20. package/dist/protocol/model-prompt-patches.d.ts +18 -0
  21. package/dist/protocol/version.d.ts +1 -1
  22. package/dist/query/query-runner.d.ts +16 -6
  23. package/dist/session/session-fork.d.ts +1 -27
  24. package/dist/session/session-import.d.ts +10 -0
  25. package/dist/session/session-manager.d.ts +3 -1
  26. package/dist/session/session-materializer.d.ts +15 -0
  27. package/dist/session/session-store.d.ts +45 -0
  28. package/dist/session/transcript-mirror.d.ts +25 -0
  29. package/dist/session/transcript-paths.d.ts +1 -2
  30. package/dist/types/auth.d.ts +27 -2
  31. package/dist/types/common.d.ts +1 -1
  32. package/dist/types/control.d.ts +13 -1
  33. package/dist/types/hooks.d.ts +1 -1
  34. package/dist/types/index.d.ts +2 -3
  35. package/dist/types/mcp.d.ts +9 -3
  36. package/dist/types/messages.d.ts +21 -2
  37. package/dist/types/options.d.ts +50 -10
  38. package/dist/types/session.d.ts +17 -7
  39. package/dist/types/settings.d.ts +19 -232
  40. package/package.json +4 -14
  41. package/dist/bridge/bridge-api.d.ts +0 -14
  42. package/dist/bridge/bridge-session.d.ts +0 -6
  43. package/dist/bridge/ccr-client.d.ts +0 -72
  44. package/dist/bridge/index.d.ts +0 -9
  45. package/dist/bridge/index.js +0 -3
  46. package/dist/bridge/sse-transport.d.ts +0 -37
  47. package/dist/browser/browser-query.d.ts +0 -24
  48. package/dist/browser/index.d.ts +0 -14
  49. package/dist/browser/index.js +0 -9
  50. package/dist/browser/websocket-transport.d.ts +0 -40
  51. package/dist/direct-connect/direct-connect-transport.d.ts +0 -31
  52. package/dist/direct-connect/url-parser.d.ts +0 -14
  53. package/dist/embed/embed.d.ts +0 -2
  54. package/dist/embed/embed.js +0 -1
  55. package/dist/embed/extract-from-bunfs.d.ts +0 -5
  56. package/dist/types/bridge.d.ts +0 -62
  57. package/dist/types/browser.d.ts +0 -26
package/README.md CHANGED
@@ -95,52 +95,59 @@ single call needs to override the package default.
95
95
 
96
96
  Every SDK query needs an explicit authentication option.
97
97
 
98
- To reuse the local `qodercli` login state:
98
+ | Authentication method | Identity | Use case |
99
+ | --- | --- | --- |
100
+ | Personal Access Token (PAT) | A Qoder user | Automation that needs the user's permissions and data |
101
+ | Service Account | An organization workload | Services and jobs that should not depend on a personal account |
102
+ | Local `qodercli` session | The signed-in user | Interactive development on a workstation |
103
+
104
+ For a PAT, generate a token at
105
+ [qoder.com/account/integrations](https://qoder.com/account/integrations), store
106
+ it in a secret manager, and expose it through the default environment variable:
107
+
108
+ ```bash
109
+ export QODER_PERSONAL_ACCESS_TOKEN=your-token
110
+ ```
99
111
 
100
112
  ```ts
101
- import { qodercliAuth, query } from "@qoder-ai/qoder-agent-sdk";
113
+ import { accessTokenFromEnv, query } from "@qoder-ai/qoder-agent-sdk";
102
114
 
103
115
  const q = query({
104
116
  prompt: "Summarize this repository.",
105
117
  options: {
106
- auth: qodercliAuth(),
118
+ auth: accessTokenFromEnv(),
107
119
  cwd: process.cwd(),
108
120
  },
109
121
  });
110
122
  ```
111
123
 
112
- To authenticate with a personal access token:
113
-
114
- Generate a Personal Access Token at
115
- [qoder.com/account/integrations](https://qoder.com/account/integrations):
116
-
117
- 1. Sign in to your Qoder account.
118
- 2. Open the integrations page.
119
- 3. Create a new PAT, choosing the expiry and scopes you need.
120
- 4. Copy the token immediately. The value cannot be retrieved again after the
121
- page is closed.
122
-
123
- Use separate tokens for local scripts, CI, and production services when
124
- possible, so each environment can be revoked independently. Do not hard-code
125
- tokens in source code.
126
-
127
- ```bash
128
- export QODER_PERSONAL_ACCESS_TOKEN=your-token
129
- ```
124
+ For a Service Account, read the key from your secret manager and pass it
125
+ directly to the SDK:
130
126
 
131
127
  ```ts
132
- import { accessTokenFromEnv, query } from "@qoder-ai/qoder-agent-sdk";
128
+ import { query, serviceAccount } from "@qoder-ai/qoder-agent-sdk";
129
+
130
+ // Get the Service Account key from the host's secret manager adapter.
131
+ const serviceAccountKey = await readSecret("qoder-service-account-key");
133
132
 
134
133
  const q = query({
135
134
  prompt: "Summarize this repository.",
136
135
  options: {
137
- auth: accessTokenFromEnv(),
136
+ auth: serviceAccount({ serviceAccountKey }),
138
137
  cwd: process.cwd(),
139
138
  },
140
139
  });
141
140
  ```
142
141
 
143
- `accessTokenFromEnv()` reads `QODER_PERSONAL_ACCESS_TOKEN` by default.
142
+ The SDK and CLI obtain and refresh short-lived Service Account tokens for this
143
+ authentication method. A host can retain the Service Account key and use
144
+ `serviceAccount({ fetchServiceAccountToken })` to obtain and refresh
145
+ short-lived SATs for qodercli. See the
146
+ [host callback example](examples/service-account-token-demo/demo.mjs) for a
147
+ complete Token exchange and query. To reuse a signed-in developer
148
+ workstation, use `qodercliAuth()`. See the
149
+ [SDK authentication guide](docs/public/en/cli/sdk/authentication.mdx) for
150
+ complete setup instructions and security guidance.
144
151
 
145
152
  ## Quick Start
146
153
 
@@ -306,6 +313,101 @@ workflows that need state across multiple turns. Runtime helpers include
306
313
  `q.streamInput(...)`, `q.interrupt()`, `q.setPermissionMode(...)`,
307
314
  `q.mcpAuthenticate(...)`, and `q.mcpSubmitOAuthCallbackUrl(...)`.
308
315
 
316
+ Streaming user messages support three delivery priorities:
317
+
318
+ - `priority: "now"` stops the current response and handles the message immediately.
319
+ - `priority: "next"` is the default and handles the message at the next suitable point.
320
+ - `priority: "later"` waits until the current response finishes.
321
+
322
+ `shouldQuery: false` adds the message to the conversation without starting a
323
+ response by itself. Its processing time still follows `priority`.
324
+
325
+ Assign `uuid` to messages that need delivery tracking or cancellation.
326
+ Do not reuse UUIDs within a session. `await q.interrupt()` stops the current
327
+ response without closing the session. `await q.cancelAsyncMessage(uuid)` returns
328
+ `true` when the queued message is cancelled and `false` when it can no longer
329
+ be cancelled.
330
+
331
+ ## External Session Storage
332
+
333
+ Queries persist their local session by default. Set `persistSession: false` for
334
+ an ephemeral query that must not create resumable session state. Ephemeral
335
+ queries cannot use `sessionStore` because mirroring starts from locally
336
+ committed transcript entries.
337
+
338
+ Use `sessionStore` when a host needs durable transcripts outside the local
339
+ machine. The SDK mirrors entries after qodercli commits them locally. A later
340
+ process can restore the same session before qodercli starts:
341
+
342
+ ```text
343
+ qodercli commit -> SDK append(key, entries) -> external store
344
+ external store -> SDK load(key) -> temporary QODER_CONFIG_DIR -> qodercli resume
345
+ ```
346
+
347
+ ```ts
348
+ import {
349
+ InMemorySessionStore,
350
+ qodercliAuth,
351
+ query,
352
+ } from "@qoder-ai/qoder-agent-sdk";
353
+
354
+ const sessionStore = new InMemorySessionStore();
355
+
356
+ const first = query({
357
+ prompt: "Inspect this project.",
358
+ options: {
359
+ auth: qodercliAuth(),
360
+ cwd: "/path/to/project",
361
+ sessionStore,
362
+ },
363
+ });
364
+
365
+ for await (const message of first) {
366
+ console.dir(message, { depth: null });
367
+ }
368
+
369
+ const resumed = query({
370
+ prompt: "Continue the analysis.",
371
+ options: {
372
+ auth: qodercliAuth(),
373
+ cwd: "/path/to/project",
374
+ resume: "11111111-1111-4111-8111-111111111111",
375
+ sessionStore,
376
+ },
377
+ });
378
+ ```
379
+
380
+ Every store implements `append(key, entries)` and `load(key)`. Implement
381
+ `listSessions(projectKey)` for `continue: true` and session listing,
382
+ `listSubkeys(key)` to restore and inspect child-agent transcripts, and
383
+ `delete(key)` for deletion. Entries are opaque JSON objects and must remain in
384
+ append order. A child transcript uses an opaque `subpath` such as
385
+ `subagents/agent-<id>`; the key does not include the on-disk `.jsonl`
386
+ extension.
387
+
388
+ When `load()` returns `null` or an empty array for an explicit `resume`, the SDK
389
+ falls back to the same local session ID. Store-backed `continue` starts a new
390
+ session when `listSessions()` has no restorable session. Unsafe subpaths are
391
+ ignored, and missing or empty child transcripts do not prevent restoration of
392
+ the main session.
393
+
394
+ `sessionStoreFlush: "batched"` is the default. `"eager"` starts each append
395
+ without waiting for the result boundary. Final append failures are emitted as
396
+ non-fatal `system/mirror_error` messages. `loadTimeoutMs` defaults to 60,000 ms.
397
+ Session storage cannot be combined with `persistSession: false`, file
398
+ checkpointing, custom transports, or the Cloud Agent runtime. Session storage
399
+ supports the built-in Process and Worker transports. Use
400
+ `importSessionToStore(sessionId, store, options)` to copy an existing local main
401
+ transcript, child-agent transcripts, and metadata into a store.
402
+
403
+ ### Production stores
404
+
405
+ The SDK exports the `SessionStore` interface but does not ship a
406
+ production-ready external storage implementation. Implement the interface
407
+ against shared storage operated by your application, then validate its
408
+ append/load ordering, project isolation, subkey handling, and deletion behavior
409
+ with the shared conformance suite under `examples/session-stores/`.
410
+
309
411
  ## Custom Tools
310
412
 
311
413
  You can expose JavaScript or TypeScript functions to Qoder Agent as in-process
@@ -344,6 +446,39 @@ const q = query({
344
446
  });
345
447
  ```
346
448
 
449
+ For stdio, SSE, and Streamable HTTP MCP servers, set `timeout` to the hard
450
+ wall-clock limit for each tool call. The value is in milliseconds, progress
451
+ notifications do not extend it, and values below 1,000 ms are ignored.
452
+
453
+ An effective server `timeout` overrides `MCP_TOOL_TIMEOUT`. If neither is set,
454
+ the CLI uses 100,000,000 ms (about 27.8 hours). Connection and discovery
455
+ requests are independent: they use `MCP_TIMEOUT`, which defaults to 30,000 ms.
456
+
457
+ ```ts
458
+ const q = query({
459
+ prompt: "Run the long report.",
460
+ options: {
461
+ auth: qodercliAuth(),
462
+ mcpServers: {
463
+ reports: {
464
+ type: "stdio",
465
+ command: "report-mcp-server",
466
+ timeout: 1_800_000,
467
+ },
468
+ },
469
+ allowedTools: ["mcp__reports__run_report"],
470
+ },
471
+ });
472
+ ```
473
+
474
+ The CLI also protects silent tool calls with an idle timeout: 30 minutes for
475
+ stdio and 5 minutes for remote transports. Progress resets the idle timer but
476
+ not the hard timeout. Set `QODER_MCP_TOOL_IDLE_TIMEOUT` to adjust the global
477
+ idle baseline, or to `0` to disable it; a valid server `timeout` can extend the
478
+ idle limit up to the hard timeout. In-process servers returned by
479
+ `createSdkMcpServer()` do not expose a server-level `timeout` field and do not
480
+ use the idle watchdog.
481
+
347
482
  ## Hooks
348
483
 
349
484
  Hooks are deterministic callbacks invoked at specific points in the agent loop.
package/dist/auth.d.ts CHANGED
@@ -1,6 +1,9 @@
1
- import type { AuthOptions, FetchJobToken, JobTokenAuthOptions } from './types/auth.js';
1
+ import type { AuthOptions, FetchJobToken, JobTokenAuthOptions, ServiceAccountAuthOptions, ServiceAccountCredentials } from './types/auth.js';
2
2
  export declare const DEFAULT_ACCESS_TOKEN_ENV_VAR = "QODER_PERSONAL_ACCESS_TOKEN";
3
+ export declare const DEFAULT_SERVICE_ACCOUNT_ENV_VAR = "QODER_SERVICE_ACCOUNT_KEY";
3
4
  export declare function accessToken(token: string): AuthOptions;
4
5
  export declare function accessTokenFromEnv(envVar?: string): AuthOptions;
5
6
  export declare function qodercliAuth(): AuthOptions;
7
+ export declare function serviceAccount(credentials: ServiceAccountCredentials): ServiceAccountAuthOptions;
8
+ export declare function serviceAccountFromEnv(envVar?: string): ServiceAccountAuthOptions;
6
9
  export declare function jobToken(fetchJobToken: FetchJobToken): JobTokenAuthOptions;
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Hook events supported by the public SDK hook registration API.
8
8
  */
9
- export declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "UserPromptSubmit", "SessionStart", "SessionEnd", "Stop", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "CwdChanged", "InstructionsLoaded", "FileChanged", "PermissionRequest"];
9
+ export declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "UserPromptSubmit", "SessionStart", "SessionEnd", "Stop", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "CwdChanged", "InstructionsLoaded", "FileChanged", "PermissionRequest", "PermissionDenied"];
10
10
  /**
11
11
  * All supported exit reasons for session termination.
12
12
  */
@@ -24,7 +24,7 @@ export declare const KILL_GRACE_MS = 5000;
24
24
  /**
25
25
  * Current SDK version, sent to CLI as QODER_AGENT_SDK_VERSION environment variable.
26
26
  */
27
- export declare const SDK_VERSION = "1.0.15";
27
+ export declare const SDK_VERSION = "1.0.16";
28
28
  /**
29
29
  * Value for the `--permission-prompt-tool` CLI flag.
30
30
  *
@@ -33,6 +33,11 @@ export declare const SDK_VERSION = "1.0.15";
33
33
  * to resolve them via the `canUseTool` callback.
34
34
  */
35
35
  export declare const PERMISSION_PROMPT_TOOL_STDIO = "stdio";
36
+ /**
37
+ * Exit code the Qoder CLI emits for `FATAL_AUTHENTICATION_ERROR`.
38
+ * See qodercli-next packages/core/src/utils/exitCodes.ts.
39
+ */
40
+ export declare const CLI_EXIT_CODE_AUTH_ERROR = 41;
36
41
  /**
37
42
  * Built-in qodercli tools exposed by SDK sessions when callers do not pass
38
43
  * `options.tools`.
@@ -0,0 +1,23 @@
1
+ import type { StdoutMessage } from '../types/control.js';
2
+ import type { Transport } from './transport.js';
3
+ export declare class DeferredTransport implements Transport {
4
+ private readonly bootstrap;
5
+ private transport;
6
+ private bootstrapPromise;
7
+ private readonly pending;
8
+ private closed;
9
+ constructor(bootstrap: () => Promise<{
10
+ transport: Transport;
11
+ cleanup?: () => Promise<void>;
12
+ }>);
13
+ private cleanup;
14
+ private cleanupPromise;
15
+ initialize(): Promise<void>;
16
+ write(data: string): void;
17
+ close(): void;
18
+ isReady(): boolean;
19
+ readMessages(): AsyncGenerator<StdoutMessage, void, unknown>;
20
+ endInput(): void;
21
+ private getTransport;
22
+ private runCleanup;
23
+ }
@@ -8,14 +8,6 @@
8
8
  export declare class AbortError extends Error {
9
9
  constructor(message?: string);
10
10
  }
11
- /**
12
- * Thrown when a direct-connect transport encounters an error.
13
- * Direct-connect is an alternative transport that connects to a
14
- * running qodercli server via network rather than spawning a subprocess.
15
- */
16
- export declare class DirectConnectError extends Error {
17
- constructor(message: string);
18
- }
19
11
  /**
20
12
  * Thrown when the CLI's wire protocol version is incompatible with the
21
13
  * version this SDK was built against (cross-major mismatch).
@@ -70,6 +70,7 @@ export interface ProcessTransportOptions {
70
70
  continue?: boolean;
71
71
  resume?: string;
72
72
  forkSession?: boolean;
73
+ persistSession?: boolean;
73
74
  maxTurns?: number;
74
75
  permissionMode?: PermissionMode;
75
76
  allowDangerouslySkipPermissions?: boolean;
@@ -78,6 +79,8 @@ export interface ProcessTransportOptions {
78
79
  canUseTool?: boolean;
79
80
  includePartialMessages?: boolean;
80
81
  includeHookEvents?: boolean;
82
+ /** Request SDK-internal post-commit transcript frames from qodercli. */
83
+ sessionMirror?: boolean;
81
84
  allowedTools?: string[];
82
85
  disallowedTools?: string[];
83
86
  tools?: ToolsOption;
@@ -2,12 +2,17 @@ import type { DiagnosticsSink } from './sdk-diagnostics.js';
2
2
  import type { SdkPluginConfig, ToolConfig } from '../types/common.js';
3
3
  import type { InternalAuthOptions } from '../types/auth.js';
4
4
  import type { PermissionMode } from '../types/permissions.js';
5
- import type { McpServerConfigForProcessTransport, McpServerToolPolicy } from '../types/mcp.js';
5
+ import type { McpServerConfigForProcessTransport } from '../protocol/mcp.js';
6
+ import type { McpServerToolPolicy } from '../types/mcp.js';
6
7
  import type { SettingSource } from '../types/options.js';
7
8
  export declare class AuthAccessTokenEnvVarError extends Error {
8
9
  readonly code: "auth_access_token_env_var_not_configured";
9
10
  constructor(envVar: string);
10
11
  }
12
+ export declare class AuthServiceAccountEnvVarError extends Error {
13
+ readonly code: "auth_service_account_env_var_not_configured";
14
+ constructor(envVar: string);
15
+ }
11
16
  type ToolsOption = string[] | {
12
17
  type: 'preset';
13
18
  preset: 'qodercli';
@@ -24,6 +29,7 @@ export interface RuntimeLaunchOptions {
24
29
  continue?: boolean;
25
30
  resume?: string;
26
31
  forkSession?: boolean;
32
+ persistSession?: boolean;
27
33
  maxTurns?: number;
28
34
  permissionMode?: PermissionMode;
29
35
  allowDangerouslySkipPermissions?: boolean;
@@ -31,6 +37,7 @@ export interface RuntimeLaunchOptions {
31
37
  canUseTool?: boolean;
32
38
  includePartialMessages?: boolean;
33
39
  includeHookEvents?: boolean;
40
+ sessionMirror?: boolean;
34
41
  allowedTools?: string[];
35
42
  disallowedTools?: string[];
36
43
  tools?: ToolsOption;
@@ -65,6 +72,7 @@ export declare class RuntimeLaunchOptionsBuilder {
65
72
  cleanupGeneratedSettings(): void;
66
73
  cleanupAuthPayload(): Promise<void>;
67
74
  buildEnv(): Record<string, string>;
75
+ private serviceAccountCredentialEnvVars;
68
76
  buildArgs(): string[];
69
77
  private buildSettingsArg;
70
78
  private applyFileCheckpointingSetting;
@@ -79,6 +87,7 @@ export declare class RuntimeLaunchOptionsBuilder {
79
87
  private writeGeneratedSettingsFile;
80
88
  private createAuthPayloadFile;
81
89
  private buildAuthPayload;
90
+ private resolveServiceAccountKey;
82
91
  private resolveAccessToken;
83
92
  }
84
93
  export {};
@@ -4,10 +4,8 @@
4
4
  * A Transport abstracts the bidirectional communication channel between
5
5
  * the SDK and the CLI. All transports must implement this interface.
6
6
  *
7
- * Implementations:
8
- * - ProcessTransport: spawns CLI as a subprocess, uses stdin/stdout (Node.js)
9
- * - WebSocketTransport: connects via WebSocket (browser environments)
10
- * - DirectConnectTransport: connects to a direct-connect server
7
+ * The default implementation spawns qodercli as a subprocess and uses
8
+ * stdin/stdout. Custom transports can implement this interface.
11
9
  */
12
10
  import type { StdoutMessage } from '../types/control.js';
13
11
  export interface Transport {
package/dist/index.d.ts CHANGED
@@ -55,31 +55,35 @@ export { query } from './query/query.js';
55
55
  export { DEFAULT_RUNTIME_TRANSPORT, } from './core/default-runtime.js';
56
56
  export { ProcessTransport, QoderCliProcessError, } from './core/process-transport.js';
57
57
  export { hasResolvableQoderWorkerRuntime, QoderWorkerRuntimeError, WorkerTransport, resolveQoderWorkerRuntimePath, } from './core/worker-transport.js';
58
- export { DEFAULT_ACCESS_TOKEN_ENV_VAR, accessToken, accessTokenFromEnv, jobToken, qodercliAuth, } from './auth.js';
58
+ export { DEFAULT_ACCESS_TOKEN_ENV_VAR, DEFAULT_SERVICE_ACCOUNT_ENV_VAR, accessToken, accessTokenFromEnv, jobToken, qodercliAuth, serviceAccount, serviceAccountFromEnv, } from './auth.js';
59
59
  export { createSdkMcpServer, tool } from './mcp/sdk-mcp-server.js';
60
60
  export type { AnyZodRawShape, InferShape, SdkMcpToolDefinition, ToolExtras, CreateSdkMcpServerOptions, } from './mcp/sdk-mcp-server.js';
61
61
  export type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
62
62
  export type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';
63
- export { listSessions, getSessionInfo, getSessionMessages, getSubagentMessages, listSubagents, renameSession, tagSession, } from './session/session-manager.js';
63
+ export { listSessions, getSessionInfo, getSessionMessages, getSubagentMessages, listSubagents, renameSession, tagSession, deleteSession, } from './session/session-manager.js';
64
64
  export { forkSession } from './session/session-fork.js';
65
+ export { InMemorySessionStore } from './session/session-store.js';
66
+ export { importSessionToStore } from './session/session-import.js';
67
+ export type { ImportSessionToStoreOptions } from './session/session-import.js';
68
+ export type { SessionKey, SessionStore, SessionStoreEntry, SessionStoreFlush, } from './session/session-store.js';
65
69
  export { listPlugins, enablePlugin, disablePlugin, installPlugin, uninstallPlugin } from './global/plugins.js';
66
70
  export type { PluginDetails, PluginResources, InstallPluginResult, UninstallPluginResult } from './types/plugins.js';
67
71
  export { submitFeedback } from './feedback.js';
68
72
  export type { SubmitFeedbackParams, SubmitFeedbackOptions, IntegrationMode, } from './feedback.js';
69
- export { AbortError, DirectConnectError, ModelPolicyTimeoutError, ProtocolVersionMismatchError, } from './core/errors.js';
73
+ export { AbortError, ModelPolicyTimeoutError, ProtocolVersionMismatchError, } from './core/errors.js';
74
+ export { AuthAccessTokenEnvVarError, AuthServiceAccountEnvVarError, } from './core/runtime-launch-options.js';
70
75
  export { WIRE_PROTOCOL_VERSION } from './protocol/version.js';
71
- export { DirectConnectTransport } from './direct-connect/direct-connect-transport.js';
72
- export { parseDirectConnectUrl } from './direct-connect/url-parser.js';
76
+ export type { ModelPromptPatch, ModelPromptPatches, } from './protocol/model-prompt-patches.js';
73
77
  export { HOOK_EVENTS, EXIT_REASONS } from './core/constants.js';
74
78
  import * as coreTypes from './types/index.js';
75
79
  export { coreTypes };
76
- export type { AccessTokenInput, AuthOptions } from './types/auth.js';
80
+ export type { AccessTokenInput, AuthOptions, FetchServiceAccountToken, ServiceAccountAuthOptions, ServiceAccountCredentials, ServiceAccountKeyInput, ServiceAccountTokenResult, } from './types/auth.js';
77
81
  /**
78
82
  * @internal Internal auth types for first-party host integration, not general public use.
79
83
  */
80
84
  export type { FetchJobToken, JobTokenAuthOptions, JobTokenRequest, JobTokenResult, } from './types/auth.js';
81
- export type { AccountInfo, UsageAddOnQuotaBucket, UsageInfo, UsageOrgResourcePackage, UsageQuotaBucket, ApiKeySource, ExitReason, FastModeState, ConfigScope, SettingSource, SDKAssistantMessageError, SDKStatus, EffortLevel, ThinkingAdaptive, ThinkingEnabled, ThinkingDisabled, ThinkingConfig, OutputFormatType, JsonSchemaOutputFormat, OutputFormat, BaseOutputFormat, ModelInfo, ModelSource, ServerModelJson, ServerModelJsonValue, ModelStrategy, ModelPromotion, LocalizedModelText, ModelContextConfig, ModelContextWindowEntry, ModelEffortEntry, ModelThinkingConfig, ModelThinkingDisabled, ModelThinkingEnabled, ModelUsage, NonNullableUsage, SlashCommand, ToolConfig, SdkPluginConfig, } from './types/common.js';
82
- export type { SDKMessage, SDKAssistantMessage, SDKUserMessage, SDKUserMessageReplay, SDKResultMessage, SDKResultSuccess, SDKResultError, SDKSystemMessage, SDKSystemInitMessage, SDKSystemMessageSubtype, SDKSystemMessageBySubtype, SDKPartialAssistantMessage, SDKCompactBoundaryMessage, SDKStatusMessage, SDKAPIRetryMessage, SDKLocalCommandOutputMessage, SDKHookStartedMessage, SDKHookProgressMessage, SDKHookResponseMessage, SDKPermissionDeniedMessage, SDKTaskNotificationMessage, SDKTaskStartedMessage, SDKTaskProgressMessage, SDKSessionStateChangedMessage, SDKSessionTitleChangedMessage, SDKBridgeStateMessage, SDKFilesPersistedEvent, SDKElicitationCompleteMessage, SDKPromptSuggestionMessage, SDKCloudAgentEventMessage, SDKPermissionDenial, } from './types/messages.js';
85
+ export type { AccountInfo, UsageAddOnQuotaBucket, UsageInfo, UsageOrgResourcePackage, UsageQuotaBucket, SessionCreditsUsage, ApiKeySource, ExitReason, FastModeState, ConfigScope, SettingSource, SDKAssistantMessageError, SDKStatus, EffortLevel, ThinkingAdaptive, ThinkingEnabled, ThinkingDisabled, ThinkingConfig, ModelInfo, ModelSource, ServerModelJson, ServerModelJsonValue, ModelStrategy, ModelPromotion, LocalizedModelText, ModelContextConfig, ModelContextWindowEntry, ModelEffortEntry, ModelThinkingConfig, ModelThinkingDisabled, ModelThinkingEnabled, ModelUsage, NonNullableUsage, SlashCommand, ToolConfig, SdkPluginConfig, } from './types/common.js';
86
+ export type { SDKMessage, SDKAssistantMessage, SDKUserMessage, SDKUserMessageReplay, SDKResultMessage, SDKResultSuccess, SDKResultError, SDKSystemMessage, SDKSystemInitMessage, SDKSystemMessageSubtype, SDKSystemMessageBySubtype, SDKPartialAssistantMessage, SDKCompactBoundaryMessage, SDKStatusMessage, SDKAPIRetryMessage, SDKHookStartedMessage, SDKHookProgressMessage, SDKHookResponseMessage, SDKPermissionDeniedMessage, SDKMirrorErrorMessage, SDKTaskNotificationMessage, SDKTaskStartedMessage, SDKTaskProgressMessage, SDKSessionStateChangedMessage, SDKSessionTitleChangedMessage, SDKFilesPersistedEvent, SDKElicitationCompleteMessage, SDKPromptSuggestionMessage, SDKCloudAgentEventMessage, SDKPermissionDenial, } from './types/messages.js';
83
87
  export type { DefaultRuntimeTransport, } from './core/default-runtime.js';
84
88
  export type { QueryTransportCreateOptions, QueryTransportProviderOption, } from './core/query-transport.js';
85
89
  export type { ProcessTransportOptions } from './core/process-transport.js';
@@ -96,12 +100,8 @@ export type { SDKSessionInfo, SessionMessage, ListSessionsOptions, GetSessionInf
96
100
  export type { Settings, ResolvedSettings, ResolvedSettingsSource, } from './types/settings.js';
97
101
  export { filterEscalatingDefaultMode } from './types/settings.js';
98
102
  export type { QoderModelPurpose } from './types/control.js';
99
- export type { SDKControlRequest, SDKControlResponse, SDKControlInitializeResponse, SDKControlGetContextUsageResponse, SDKControlGetUsageInfoRequest, SDKControlGetUsageInfoResponse, SDKControlAddDirectoriesResponse, SDKControlReloadPluginsResponse, } from './types/control.js';
103
+ export type { SDKControlRequest, SDKControlResponse, SDKControlInterruptResponse, SDKControlInitializeResponse, SDKControlGetContextUsageResponse, SDKControlGetUsageInfoRequest, SDKControlGetUsageInfoResponse, SDKControlAddDirectoriesResponse, SDKControlReloadPluginsResponse, } from './types/control.js';
100
104
  export type { SDKControlGetModelPolicyRequest, SDKControlGetModelPolicyResponse, SDKCapabilities, ModelPolicyContext, ModelPolicyResult, ModelPolicyProvider, } from './types/model-policy-provider.js';
101
105
  export type { SDKControlGetByokConfigRequest, SDKControlGetByokConfigResponse, SDKControlValidateByokModelRequest, SDKControlValidateByokModelResponse, BYOKModelValidationInput, BYOKProviderInfo, BYOKModelTypeInfo, BYOKModelInfo, CustomModel, } from './types/byok.js';
102
- export type { SessionState, BridgeSessionHandle, AttachBridgeSessionOptions, RemoteCredentials, } from './types/bridge.js';
103
- export type { OAuthCredential, AuthMessage, WebSocketOptions, BrowserQueryOptions, } from './types/browser.js';
104
106
  export type { AgentInput, AgentOutput, BashInput, FileReadInput, FileReadOutput, FileEditInput, FileWriteInput, GlobInput, GrepInput, WebFetchInput, WebSearchInput, AskUserQuestionInput, NotebookEditInput, ExitPlanModeInput, TodoWriteInput, ToolInputSchemas, ToolOutputSchemas, } from './types/tools.js';
105
- export type { DirectConnectOptions } from './direct-connect/direct-connect-transport.js';
106
- export type { DirectConnectUrlResult } from './direct-connect/url-parser.js';
107
107
  export type { FeedbackResult } from './types/account.js';