@qoder-ai/qoder-agent-sdk 1.0.57 → 1.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,48 +23,38 @@ installed if your application uses SDK tools or MCP integration.
23
23
 
24
24
  ## Runtime Behavior
25
25
 
26
- The npm package uses `WorkerTransport.default` for `query()` by default. During
27
- `npm install`, its postinstall script downloads the Worker runtime selected by
28
- the package's pinned CLI version into `dist/_worker`. It does not download the
29
- process CLI unless `QODER_INSTALL_BUNDLED_CLI=1` is set.
30
-
31
- You can still select a transport explicitly on the same `query()` entry:
32
-
33
- ```ts
34
- import {
35
- qodercliAuth,
36
- query,
37
- WorkerTransport,
38
- } from "@qoder-ai/qoder-agent-sdk";
39
-
40
- const q = query({
41
- prompt: "Summarize this repository.",
42
- options: {
43
- auth: qodercliAuth(),
44
- transport: WorkerTransport.default,
45
- },
46
- });
47
- ```
48
-
49
- The worker transport uses the runtime installed at
50
- `dist/_worker/qoder-worker-runtime.obf.mjs`. To use another Worker runtime,
51
- pass its path explicitly with
52
- `new WorkerTransport({ pathToQoderWorkerRuntime })`. Environment variables do
53
- not override the Worker runtime entry.
54
-
55
- The package includes a `dist/runtime-manifest.json` that records the default
56
- runtime and the URL template for qodercli Worker runtime artifacts. At
57
- installation time, the SDK resolves exactly one artifact for its own brand,
58
- the current operating system, and the current architecture. It does not fall
59
- back to the universal artifact. The SDK package itself does not need to host a
60
- copy of the archive. The presence of `dist/_worker` is used as an integrity
61
- check after installation, not as the mode selector.
62
-
63
- The installed Worker runtime is self-contained. Platform packages include the
64
- matching native keychain, PTY, image-processing, and ripgrep assets. Linux
65
- packages retain both glibc and musl image-processing bindings. OpenHarmony does
66
- not have an install-delivered platform artifact and must use an explicitly
67
- supplied runtime source.
26
+ `query()` always runs through a process-wide qodercli daemon. The first query
27
+ starts that daemon and reuses it for later queries in the same process; pass
28
+ `options.daemon` to bind a query to a daemon you started yourself with
29
+ `startDaemon()`. The daemon owns the CLI process boundary, so the SDK does not
30
+ spawn a separate CLI per query. Call `shutdownDaemon()` before your host
31
+ process exits to stop the shared daemon.
32
+
33
+ During `npm install`, the postinstall script downloads the CLI binary selected
34
+ by the package's pinned CLI version into `dist/_bundled`; worker packages also
35
+ deliver the worker runtime into `dist/_worker`.
36
+
37
+ The daemon launches qodercli either as a native process carrier or as a Node
38
+ worker runtime. `startDaemon()` / `initDaemon()` accept
39
+ `launchMode: 'process' | 'worker'`; without it, the first query's
40
+ `options.transport` (`ProcessTransport` or `WorkerTransport`) selects the
41
+ carrier, otherwise the package's `DEFAULT_RUNTIME_TRANSPORT` applies. Worker
42
+ mode launches the bundled `dist/_worker` runtime, or the runtime passed through
43
+ `pathToQoderWorkerRuntime`; when no worker runtime is available the daemon
44
+ falls back to the process carrier. A later query whose launch mode differs from
45
+ the ready daemon is rejected with `DaemonConfigurationConflictError`.
46
+
47
+ The process carrier uses `pathToQoderCLIExecutable` when provided, then
48
+ `QODERCLI_PATH`, then the bundled CLI, then a locally installed `qodercli`.
49
+ JavaScript CLI entries run through `executable` (or the SDK host's Node binary).
50
+
51
+ `Options.transport`, `ProcessTransport`, and `WorkerTransport` remain
52
+ available: selecting either transport no longer spawns a per-query process or
53
+ worker, it selects the shared daemon's carrier. Query options that configure
54
+ the CLI process, such as `pathToQoderCLIExecutable`, `executable`,
55
+ `executableArgs`, `env`, `proxy`, `vpcEndpoint`, and `auth`, configure the
56
+ shared daemon instead. Because the daemon is shared, every query in one process
57
+ must pass compatible daemon-level options.
68
58
 
69
59
  If your environment blocks install scripts or network downloads, skip postinstall
70
60
  runtime downloads:
@@ -73,27 +63,13 @@ runtime downloads:
73
63
  QODER_SKIP_DOWNLOAD=1 npm install @qoder-ai/qoder-agent-sdk zod
74
64
  ```
75
65
 
76
- `QODER_SKIP_DOWNLOAD` only affects install-time downloads. It does not change the
77
- package's default runtime. Then point the process transport at an existing
78
- `qodercli`:
66
+ `QODER_SKIP_DOWNLOAD` only affects install-time downloads. Point the daemon at
67
+ an existing `qodercli` with:
79
68
 
80
69
  ```bash
81
70
  export QODERCLI_PATH=/absolute/path/to/qodercli
82
71
  ```
83
72
 
84
- To use an existing Worker runtime, pass its absolute path through
85
- `new WorkerTransport({ pathToQoderWorkerRuntime })`.
86
-
87
- `query()` is the only query entry point and defaults to Worker. Pass
88
- `transport: ProcessTransport.default`,
89
- `transport: WorkerTransport.default`, or a custom transport provider when a
90
- single call needs to override the package default.
91
-
92
- `pathToQoderCLIExecutable` accepts either local runtime form. Native binaries
93
- and ordinary CLI `.js`/`.mjs` entries use the process transport; recognized
94
- `qoder-worker-runtime*.mjs` entries use the Worker transport. An explicit
95
- `transport` provider always takes precedence over automatic path selection.
96
-
97
73
  ## Authentication
98
74
 
99
75
  Every SDK query needs an explicit authentication option.
@@ -452,8 +428,8 @@ non-fatal `system/mirror_error` messages. Each append batch is submitted once:
452
428
  the SDK does not retry a mutation whose commit outcome may be unknown.
453
429
  `loadTimeoutMs` defaults to 60,000 ms.
454
430
  Session storage cannot be combined with `persistSession: false`, file
455
- checkpointing, custom transports, or the Cloud Agent runtime. Session storage
456
- supports the built-in Process and Worker transports. Use
431
+ checkpointing, or the Cloud Agent runtime. It works on daemon-backed queries.
432
+ Use
457
433
  `importSessionToStore(sessionId, store, options)` to copy an existing local main
458
434
  transcript, child-agent transcripts, and metadata into a store.
459
435
 
@@ -2,7 +2,9 @@ export type DefaultRuntimeTransport = 'process' | 'worker';
2
2
  /**
3
3
  * The default transport baked into the packaged SDK bundle.
4
4
  *
5
- * Development / plain `tsc` builds default to `process`. Release bundles replace
6
- * `__QODER_DEFAULT_RUNTIME_TRANSPORT__` through esbuild `define`.
5
+ * Development / plain `tsc` builds default to `process`. Legacy bundles may
6
+ * replace `__QODER_DEFAULT_RUNTIME_TRANSPORT__` through esbuild `define`; the
7
+ * value is retained for integrations that read it, while every Query now
8
+ * executes through the process-wide daemon.
7
9
  */
8
10
  export declare const DEFAULT_RUNTIME_TRANSPORT: DefaultRuntimeTransport;
@@ -2,6 +2,18 @@
2
2
  * Custom error types for the Qoder Agent SDK.
3
3
  */
4
4
  import type { SDKResultMessage } from '../protocol/messages.js';
5
+ export declare class QoderCliProcessError extends Error {
6
+ readonly code: "QODER_CLI_PROCESS_ERROR";
7
+ readonly exitCode?: number | null;
8
+ readonly signal?: NodeJS.Signals | null;
9
+ readonly stderr?: string;
10
+ constructor(message: string, options?: {
11
+ exitCode?: number | null;
12
+ signal?: NodeJS.Signals | null;
13
+ stderr?: string;
14
+ cause?: unknown;
15
+ });
16
+ }
5
17
  /** JSONL 帧超过传输预算;输入与输出使用不同错误码,避免把执行端输出问题归因于用户输入。 */
6
18
  export declare class FrameTooLargeError extends Error {
7
19
  readonly direction: 'input' | 'output';
@@ -1,40 +1,22 @@
1
1
  /**
2
- * ProcessTransport — Spawns qodercli as a child process and
3
- * manages stdin/stdout communication using JSONL (JSON Lines) format.
2
+ * ProcessTransport compatibility surface.
4
3
  *
5
- * This is the primary transport for Node.js environments. It:
6
- * 1. Builds CLI arguments from the provided options
7
- * 2. Spawns the CLI process (or delegates to a custom spawner)
8
- * 3. Reads stdout line-by-line, parsing each as JSON
9
- * 4. Writes to stdin as JSON + newline
10
- * 5. Handles graceful shutdown: close stdin → wait → SIGTERM → wait → SIGKILL
4
+ * The child-process implementation is gone: selecting this transport now runs
5
+ * the Query through the process-wide daemon. The exported types and members
6
+ * stay so existing integrations keep compiling and keep the same behavior.
11
7
  */
12
8
  import type { QueryTransportProvider, Transport } from './transport.js';
13
- import type { StdoutMessage } from '../types/control.js';
14
9
  import type { SdkPluginConfig, ToolConfig } from '../types/common.js';
15
10
  import type { PermissionMode } from '../types/permissions.js';
16
11
  import type { McpServerConfigForProcessTransport, McpServerToolPolicy } from '../types/mcp.js';
17
12
  import type { InternalAuthOptions } from '../types/auth.js';
18
13
  import type { SecurityScanOptions, SpawnedProcess, SpawnOptions, SettingSource } from '../types/options.js';
19
14
  import type { DiagnosticsSink } from './sdk-diagnostics.js';
20
- export declare class QoderCliProcessError extends Error {
21
- readonly code: "QODER_CLI_PROCESS_ERROR";
22
- readonly exitCode?: number | null;
23
- readonly signal?: NodeJS.Signals | null;
24
- readonly stderr?: string;
25
- constructor(message: string, options?: {
26
- exitCode?: number | null;
27
- signal?: NodeJS.Signals | null;
28
- stderr?: string;
29
- cause?: unknown;
30
- });
31
- }
32
- /**
33
- * Options for configuring the ProcessTransport.
34
- *
35
- * These map 1:1 to the CLI flags and environment variables that the
36
- * qodercli understands.
37
- */
15
+ export { QoderCliProcessError } from './errors.js';
16
+ type ToolsOption = string[] | {
17
+ type: 'preset';
18
+ preset: 'qodercli';
19
+ };
38
20
  export interface ProcessTransportOptions {
39
21
  /** Path to the Qoder CLI executable (binary or script) */
40
22
  pathToQoderCLIExecutable?: string;
@@ -120,95 +102,7 @@ export interface ProcessTransportOptions {
120
102
  */
121
103
  onAuthExpired?: () => void;
122
104
  }
123
- type ToolsOption = string[] | {
124
- type: 'preset';
125
- preset: 'qodercli';
126
- };
127
- export declare class ProcessTransport implements Transport, QueryTransportProvider<ProcessTransportOptions> {
105
+ export declare class ProcessTransport implements QueryTransportProvider<ProcessTransportOptions> {
128
106
  static readonly default: ProcessTransport;
129
- private process;
130
- private customHandle;
131
- private options;
132
- private ready;
133
- private closed;
134
- private shutdownStarted;
135
- private initializePromise;
136
- private authExpiredFired;
137
- private pendingInput;
138
- private diagnostics?;
139
- private processExitError;
140
- private processStopped;
141
- private closeTimer;
142
- private killTimer;
143
- private stderrTail;
144
- private launchOptionsBuilder;
145
- constructor(options?: ProcessTransportOptions);
146
107
  create(options: ProcessTransportOptions): Transport;
147
- /**
148
- * Build CLI arguments, resolve the executable, spawn the process,
149
- * and mark the transport as ready.
150
- */
151
- initialize(): Promise<void>;
152
- private _doInitialize;
153
- /** Write a JSON line to stdin. */
154
- write(data: string): void;
155
- private writeReadyLine;
156
- private flushPendingInput;
157
- /** Whether the transport is ready to send/receive. */
158
- isReady(): boolean;
159
- /** Signal that no more input will be sent (close stdin). */
160
- endInput(): void;
161
- private endReadyInput;
162
- /**
163
- * Async generator that yields parsed JSON messages from stdout.
164
- *
165
- * Uses readline to split stdout into lines. Each non-empty line is
166
- * expected to be a complete JSON object (JSONL format).
167
- *
168
- * The generator completes when:
169
- * - The readline interface closes (process exited or stdout ended)
170
- * - The transport is closed
171
- */
172
- readMessages(): AsyncGenerator<StdoutMessage, void, unknown>;
173
- /**
174
- * Close the transport with graceful shutdown:
175
- *
176
- * 1. Close stdin (signal to CLI that no more input is coming)
177
- * 2. Wait CLOSE_GRACE_MS for the process to exit on its own
178
- * 3. Send SIGTERM
179
- * 4. Wait KILL_GRACE_MS for the process to exit
180
- * 5. Send SIGKILL if still running
181
- */
182
- close(): void;
183
- /** 回收进程资源,不改变调用方主动关闭状态;异常仍由读取循环传播。 */
184
- private shutdownProcess;
185
- private hasProcessStopped;
186
- private finishProcess;
187
- private observeProcess;
188
- /**
189
- * Get the underlying process PID, if available.
190
- */
191
- get pid(): number | undefined;
192
- /**
193
- * Get the stdout stream from the process or custom handle.
194
- */
195
- private getStdout;
196
- private appendStderr;
197
- private createSpawnError;
198
- private createProcessExitError;
199
- private getStderrTail;
200
- private waitForProcessExit;
201
- /**
202
- * Resolve the executable command and arguments.
203
- *
204
- * If the CLI path is a script file (.js/.mjs/.ts/.tsx/.jsx), we need
205
- * an interpreter (node/bun/deno). Otherwise the path is a native binary
206
- * and is used directly as the command.
207
- */
208
- private resolveExecutable;
209
- /** 清理 runtime 已消费或不再可能消费的启动制品。 */
210
- private cleanupLaunchArtifacts;
211
- /** Fire `onAuthExpired` at most once per session. */
212
- private fireAuthExpired;
213
- }
214
- export {};
108
+ }
@@ -1,6 +1,16 @@
1
- import { type ProcessTransportOptions } from './process-transport.js';
1
+ import type { ProcessTransportOptions } from './process-transport.js';
2
+ import type { RuntimeLaunchOptions } from './runtime-launch-options.js';
2
3
  import type { QueryTransportProvider, Transport } from './transport.js';
4
+ /** SDK-internal options for the daemon session transport provider. */
5
+ export interface DaemonQueryTransportOptions extends RuntimeLaunchOptions {
6
+ /** SDK-internal: config root created by SessionStore materialization. */
7
+ materializedSessionConfigDir?: string;
8
+ }
9
+ /**
10
+ * Options a custom transport provider receives. Kept as the historical
11
+ * `ProcessTransportOptions` shape so existing providers keep compiling.
12
+ */
3
13
  export type QueryTransportCreateOptions = ProcessTransportOptions;
4
14
  export type QueryTransportProviderOption = QueryTransportProvider<QueryTransportCreateOptions>;
5
15
  export declare function isQueryTransportProvider(value: unknown): value is QueryTransportProviderOption;
6
- export declare function createQueryTransport(provider: QueryTransportProviderOption, options: QueryTransportCreateOptions): Transport;
16
+ export declare function createQueryTransport<T extends object>(provider: QueryTransportProvider<T>, options: T): Transport;
@@ -1,16 +1,14 @@
1
1
  /**
2
- * WorkerTransport — runs qoder-worker-runtime inside a Node worker thread.
2
+ * WorkerTransport compatibility surface.
3
3
  *
4
- * This transport keeps the existing SDK stream-json protocol but replaces the
5
- * child-process boundary with worker stdin/stdout/stderr streams. It is meant
6
- * for hosts that already own a Node runtime, including Node SEA hosts, and want
7
- * to avoid spawning a second qoder SEA process.
4
+ * The worker-thread implementation is gone: selecting this transport now runs
5
+ * the Query through the process-wide daemon. The exported classes, helpers and
6
+ * option types stay so existing integrations keep compiling and running.
8
7
  */
9
8
  import type { QueryTransportProvider, Transport } from './transport.js';
10
9
  import type { ProcessTransportOptions } from './process-transport.js';
11
- import type { StdoutMessage } from '../types/control.js';
12
10
  import type { DiagnosticsSink } from './sdk-diagnostics.js';
13
- import { type RuntimeLaunchOptions } from './runtime-launch-options.js';
11
+ import type { RuntimeLaunchOptions } from './runtime-launch-options.js';
14
12
  import { hasResolvableQoderWorkerRuntime, resolveQoderWorkerRuntimePath } from './worker-runtime-path.js';
15
13
  export { hasResolvableQoderWorkerRuntime, resolveQoderWorkerRuntimePath };
16
14
  export declare class QoderWorkerRuntimeError extends Error {
@@ -49,52 +47,10 @@ export interface WorkerRuntimeTransportOptions extends RuntimeLaunchOptions, Wor
49
47
  onAuthExpired?: () => void;
50
48
  }
51
49
  export declare class WorkerTransport implements QueryTransportProvider<ProcessTransportOptions> {
52
- static readonly default: WorkerTransport;
53
50
  private readonly options;
51
+ static readonly default: WorkerTransport;
54
52
  constructor(options?: WorkerTransportOptions);
53
+ /** query() 用它把 worker 选择映射成 daemon 的宿主形态。 */
54
+ getPathToQoderWorkerRuntime(): string | undefined;
55
55
  create(options: ProcessTransportOptions): Transport;
56
- }
57
- export declare class WorkerRuntimeTransport implements Transport {
58
- private worker;
59
- private options;
60
- private ready;
61
- private closed;
62
- private initializePromise;
63
- private authExpiredFired;
64
- private pendingInput;
65
- private diagnostics?;
66
- private workerExitError;
67
- private stderrTail;
68
- private observedExitCode;
69
- private launchOptionsBuilder;
70
- private closeTimer;
71
- private closePromise;
72
- private abortSignal?;
73
- private abortListener?;
74
- constructor(options?: WorkerRuntimeTransportOptions);
75
- initialize(): Promise<void>;
76
- private _doInitialize;
77
- write(data: string): void;
78
- isReady(): boolean;
79
- endInput(): void;
80
- readMessages(): AsyncGenerator<StdoutMessage, void, unknown>;
81
- close(): Promise<void>;
82
- private performClose;
83
- get threadId(): number | undefined;
84
- private writeReadyLine;
85
- private flushPendingInput;
86
- private endReadyInput;
87
- private destroyWorkerStreams;
88
- private appendStderr;
89
- private createWorkerError;
90
- private createWorkerExitError;
91
- private getStderrTail;
92
- private recordWorkerExit;
93
- private recordSuppressedWorkerExit;
94
- private formatStderrTailForDiagnostics;
95
- private waitForWorkerExit;
96
- private clearCloseTimer;
97
- private cleanupAbortListener;
98
- private cleanupLaunchArtifacts;
99
- private fireAuthExpired;
100
56
  }
@@ -280,6 +280,7 @@ export declare class DaemonConnection {
280
280
  private readOutput;
281
281
  private acceptFrame;
282
282
  private rememberTimedOutRequestId;
283
+ private abandonSessionFromLateResponse;
283
284
  private routeSessionMessage;
284
285
  private acceptControlResponse;
285
286
  private hasPendingSessionRequest;
@@ -1,4 +1,6 @@
1
1
  import type { InternalAuthOptions } from '../types/auth.js';
2
+ import type { QueryTransportProvider } from '../core/transport.js';
3
+ import type { DaemonQueryTransportOptions } from '../core/query-transport.js';
2
4
  import { type Daemon } from './start-daemon.js';
3
5
  export interface InitDaemonOptions {
4
6
  auth: InternalAuthOptions;
@@ -13,6 +15,10 @@ export interface InitDaemonOptions {
13
15
  /** 语义同 `StartDaemonOptions.vpcEndpoint`。 */
14
16
  vpcEndpoint?: string;
15
17
  env?: Record<string, string | undefined>;
18
+ /** 宿主形态:process=spawn CLI 二进制;worker=Node 跑 worker runtime。缺省 process。 */
19
+ launchMode?: 'process' | 'worker';
20
+ /** worker 形态下覆盖 worker runtime 产物路径。 */
21
+ pathToQoderWorkerRuntime?: string;
16
22
  /** 语义同 `StartDaemonOptions.stderr`:daemon 子进程 stderr 的实时回调。 */
17
23
  stderr?: (data: string) => void;
18
24
  /** 语义同 `StartDaemonOptions.debug`。 */
@@ -20,16 +26,24 @@ export interface InitDaemonOptions {
20
26
  /** 语义同 `StartDaemonOptions.debugFile`。 */
21
27
  debugFile?: string;
22
28
  }
23
- export type DaemonFallbackReason = 'protocol_version_mismatch' | 'daemon_unavailable';
24
- export type DaemonInitResult = {
25
- mode: 'daemon';
29
+ export interface GlobalDaemonHandle {
30
+ /**
31
+ * A daemon-shaped handle that resolves every call against the initialization
32
+ * started by `acquireGlobalDaemon`. It is usable before the handshake
33
+ * completes; asynchronous members wait for readiness instead of failing.
34
+ */
26
35
  daemon: Daemon;
27
- } | {
28
- mode: 'direct';
29
- reason: DaemonFallbackReason;
30
- };
36
+ transportProvider: QueryTransportProvider<DaemonQueryTransportOptions>;
37
+ }
31
38
  export declare class DaemonConfigurationConflictError extends Error {
32
39
  constructor();
33
40
  }
34
- export declare function initDaemon(options: InitDaemonOptions): Promise<DaemonInitResult>;
41
+ export declare function initDaemon(options: InitDaemonOptions): Promise<Daemon>;
42
+ /**
43
+ * Start a query handle backed by the process-wide daemon. The daemon starts
44
+ * immediately, and each Query's session transport waits for that same
45
+ * initialization; a failure rejects the Query instead of falling back to a
46
+ * direct CLI transport.
47
+ */
48
+ export declare function acquireGlobalDaemon(options: InitDaemonOptions): GlobalDaemonHandle;
35
49
  export declare function shutdownDaemon(): Promise<void>;
@@ -0,0 +1,13 @@
1
+ import type { ProcessTransportOptions } from '../core/process-transport.js';
2
+ import type { Transport } from '../core/transport.js';
3
+ /**
4
+ * Built-in Process/Worker transport selections keep their public surface but
5
+ * execute through the process-wide daemon. This adapter is used when a caller
6
+ * invokes the legacy provider's `create()` directly; `query()` routes the same
7
+ * selections without reaching the provider.
8
+ */
9
+ export interface LegacyDaemonLaunch {
10
+ readonly launchMode: 'process' | 'worker';
11
+ readonly pathToQoderWorkerRuntime?: string;
12
+ }
13
+ export declare function createLegacyDaemonTransport(options: ProcessTransportOptions, launch: LegacyDaemonLaunch): Transport;
@@ -1,6 +1,6 @@
1
1
  import type { InternalAuthOptions } from '../types/auth.js';
2
- import type { ProcessTransportOptions } from '../core/process-transport.js';
3
2
  import type { QueryTransportProvider } from '../core/transport.js';
3
+ import type { DaemonQueryTransportOptions } from '../core/query-transport.js';
4
4
  import type { DaemonGetModelsParams, DaemonValidateByokModelParams } from './protocol.js';
5
5
  import type { BYOKProviderInfo, ByokConfigCheckResult, ByokConfigInfo, ByokConfigReference, CheckByokConfigInput, CreateByokConfigInput, DeleteByokConfigInput, UpdateByokConfigInput } from '../protocol/control.js';
6
6
  import type { AccountInfo, ModelInfo, UsageInfo } from '../protocol/common.js';
@@ -46,6 +46,13 @@ export interface StartDaemonOptions {
46
46
  */
47
47
  heartbeatTimeoutMs?: number;
48
48
  pathToQoderCLIExecutable?: string;
49
+ /**
50
+ * 宿主形态:`process` spawn CLI 二进制;`worker` 用 Node 跑 worker runtime
51
+ * (老 Windows 无法运行 Bun 二进制时使用)。缺省 `process`。
52
+ */
53
+ launchMode?: 'process' | 'worker';
54
+ /** worker 形态下覆盖 worker runtime 产物路径;缺省用随包/已安装产物。 */
55
+ pathToQoderWorkerRuntime?: string;
49
56
  /**
50
57
  * 运行 CLI 脚本入口的解释器(node/bun/deno 等),语义与 `query()` 的
51
58
  * `Options.executable` 一致:只在解析出的 CLI 入口是脚本文件(.js/.mjs/.ts/...)
@@ -234,7 +241,7 @@ interface InternalDaemonRuntime {
234
241
  * when unset, or when the CLI does not support bypass updates).
235
242
  */
236
243
  noProxy: string | null;
237
- readonly transportProvider: QueryTransportProvider<ProcessTransportOptions>;
244
+ readonly transportProvider: QueryTransportProvider<DaemonQueryTransportOptions>;
238
245
  }
239
246
  export declare function getDaemonRuntime(daemon: Daemon): InternalDaemonRuntime | undefined;
240
247
  export declare function startDaemon(options: StartDaemonOptions): Promise<Daemon>;
package/dist/index.d.ts CHANGED
@@ -56,14 +56,14 @@ export { startup } from './query/startup.js';
56
56
  export type { StartupParams, WarmQuery } from './query/startup.js';
57
57
  export { resolveSettings } from './settings/resolve-settings.js';
58
58
  export { initDaemon, shutdownDaemon } from './daemon/global-daemon.js';
59
- export type { DaemonFallbackReason, DaemonInitResult, InitDaemonOptions, } from './daemon/global-daemon.js';
59
+ export type { InitDaemonOptions } from './daemon/global-daemon.js';
60
60
  export { startDaemon } from './daemon/start-daemon.js';
61
+ export { DEFAULT_RUNTIME_TRANSPORT } from './core/default-runtime.js';
62
+ export { ProcessTransport, QoderCliProcessError } from './core/process-transport.js';
63
+ export { hasResolvableQoderWorkerRuntime, QoderWorkerRuntimeError, WorkerTransport, resolveQoderWorkerRuntimePath, } from './core/worker-transport.js';
61
64
  export type { Daemon, DaemonState, DaemonSessionInfo, SessionRuntimeState, StartDaemonOptions, } from './daemon/start-daemon.js';
62
65
  export type { DaemonGetModelsParams, DaemonValidateByokModelParams, DaemonValidatePluginsParams, DaemonSetProxyParams, } from './daemon/protocol.js';
63
66
  export { DAEMON_PROXY_BYPASS_CAPABILITY, DAEMON_PROXY_CAPABILITY, DAEMON_VALIDATE_PLUGINS_CAPABILITY, } from './daemon/protocol.js';
64
- export { DEFAULT_RUNTIME_TRANSPORT, } from './core/default-runtime.js';
65
- export { ProcessTransport, QoderCliProcessError, } from './core/process-transport.js';
66
- export { hasResolvableQoderWorkerRuntime, QoderWorkerRuntimeError, WorkerTransport, resolveQoderWorkerRuntimePath, } from './core/worker-transport.js';
67
67
  export { DEFAULT_ACCESS_TOKEN_ENV_VAR, DEFAULT_SERVICE_ACCOUNT_ENV_VAR, accessToken, accessTokenFromEnv, jobToken, qodercliAuth, serviceAccount, serviceAccountFromEnv, } from './auth.js';
68
68
  export { createSdkMcpServer, tool } from './mcp/sdk-mcp-server.js';
69
69
  export type { AnyZodRawShape, InferShape, SdkMcpToolDefinition, ToolExtras, CreateSdkMcpServerOptions, } from './mcp/sdk-mcp-server.js';
@@ -98,9 +98,9 @@ export type { FetchJobToken, JobTokenAuthOptions, JobTokenRequest, JobTokenResul
98
98
  export type { Base64ImageSource, UrlImageSource, URLImageSource, ImageSource, ImageContentBlock, ImageBlockParam, ContentBlock, MessageParam, 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';
99
99
  export type { SDKMessage, SDKAssistantMessage, SDKToolNonExecutionKind, SDKToolResultMeta, SDKMessageOrigin, SDKSelectedSkill, SDKArtifactInfo, SDKArtifactUpdateMessage, SDKAvailableModelsUpdateMessage, SDKCommandsChangedMessage, SDKUserMessage, SDKUserMessageReplay, SDKResultMessage, SDKResultSuccess, SDKResultError, SDKSystemMessage, SDKSystemInitMessage, SDKSystemMessageSubtype, SDKSystemMessageBySubtype, SDKPartialAssistantMessage, SDKCompactBoundaryMessage, SDKStatusMessage, SDKAPIRetryMessage, SDKModelQueueStatusMessage, SDKControlRequestProgressMessage, SDKCommandLifecycleMessage, SDKToolProgressMessage, SDKHookDiagnosticsMessage, SDKHookStartedMessage, SDKHookProgressMessage, SDKHookResponseMessage, SDKPermissionDeniedMessage, SDKMirrorErrorMessage, SDKTaskNotificationMessage, SDKTaskStartedMessage, SDKTaskProgressMessage, SDKTaskUpdatedMessage, SDKBackgroundTasksChangedMessage, SDKSessionStateChangedMessage, SDKPlanModeChangedMessage, SDKSessionTitleChangedMessage, SDKFilesPersistedEvent, SDKElicitationCompleteMessage, SDKPromptSuggestionMessage, SDKCloudAgentEventMessage, SDKMemoryGenerationMessage, SDKMemoryConsumptionMessage, SDKSkillEvolutionMessage, SDKAgentsMdSizeWarningMessage, SDKPermissionDenial, } from './types/messages.js';
100
100
  export type { DefaultRuntimeTransport, } from './core/default-runtime.js';
101
- export type { QueryTransportCreateOptions, QueryTransportProviderOption, } from './core/query-transport.js';
102
101
  export type { ProcessTransportOptions } from './core/process-transport.js';
103
102
  export type { WorkerRuntimeTransportOptions, WorkerTransportOptions, } from './core/worker-transport.js';
103
+ export type { QueryTransportCreateOptions, QueryTransportProviderOption, } from './core/query-transport.js';
104
104
  export type { QueryTransportProvider, Transport, } from './core/transport.js';
105
105
  export type { Options, QueryTransportOptions, Query, RemoteProjectionEnableOptions, RemoteProjectionCheckpoint, SpawnOptions, SpawnedProcess, ElicitationRequest, ElicitationResult, OnElicitation, PromptRequest, PromptRequestOption, PromptResponse, CanUseTool, SecurityScanOptions, } from './types/options.js';
106
106
  export type { ArtifactGroup, SessionArtifactBase, SessionArtifact, ResolveSessionArtifactsResult, ResolveSessionArtifacts, } from './types/artifacts.js';