@qoder-ai/qoder-agent-sdk 1.0.55 → 1.0.56

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.
@@ -63,6 +63,12 @@ export interface DaemonInitializeOptions {
63
63
  * An empty string clears a previously configured proxy.
64
64
  */
65
65
  proxy?: string;
66
+ /**
67
+ * Proxy bypass list applied during the handshake (`daemon_proxy_bypass_v1`).
68
+ * Replaces `NO_PROXY` / `no_proxy` in the daemon process; an empty string
69
+ * clears both.
70
+ */
71
+ noProxy?: string;
66
72
  }
67
73
  export type DaemonRequestHandler = (request: DaemonControlRequestFrame) => Promise<JsonValue>;
68
74
  export declare class DaemonRpcError extends Error {
@@ -170,8 +176,21 @@ export declare class DaemonConnection {
170
176
  /**
171
177
  * Switches the daemon-level (process-wide) proxy, or clears it with
172
178
  * `undefined` / `null` / an empty string. Returns the normalized value.
179
+ *
180
+ * `noProxy` omitted leaves the current bypass list unchanged; `null`
181
+ * restores the value inherited at daemon startup; a string replaces both
182
+ * `NO_PROXY` and `no_proxy`.
183
+ */
184
+ setProxy(proxy?: string | null, noProxy?: string | null): Promise<string | null>;
185
+ /**
186
+ * Same as `setProxy`, but also returns the effective bypass list. Gated on
187
+ * `daemon_proxy_bypass_v1` when `noProxy` is supplied so an older CLI cannot
188
+ * silently ignore the field.
173
189
  */
174
- setProxy(proxy?: string | null): Promise<string | null>;
190
+ setProxySettings(proxy?: string | null, noProxy?: string | null): Promise<{
191
+ proxy: string | null;
192
+ noProxy: string | null;
193
+ }>;
175
194
  /**
176
195
  * 同步占用一个声明 id。opening/open 直接抛冲突;closing 则排队,ready 在
177
196
  * 前一次 close 出清后兑现。未声明 id(daemon 现 mint)不会撞,调用方不占用。
@@ -8,6 +8,8 @@ export interface InitDaemonOptions {
8
8
  /** 语义同 `StartDaemonOptions.executableArgs`。 */
9
9
  executableArgs?: string[];
10
10
  proxy?: string;
11
+ /** 语义同 `StartDaemonOptions.noProxy`。 */
12
+ noProxy?: string;
11
13
  /** 语义同 `StartDaemonOptions.vpcEndpoint`。 */
12
14
  vpcEndpoint?: string;
13
15
  env?: Record<string, string | undefined>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * JSON.stringify leaves U+2028/U+2029 raw inside strings. They are valid JSON,
3
+ * but Node's readline treats them as line breaks, which splits one NDJSON frame
4
+ * into several. Escape them so every reader that only honours "\n" stays compatible.
5
+ */
6
+ export declare function escapeJsonLineSeparators(line: string): string;
7
+ /**
8
+ * Split an NDJSON stream on "\n" only. CRLF is accepted by stripping the
9
+ * trailing "\r"; U+2028/U+2029 remain content and are never treated as
10
+ * terminators.
11
+ */
12
+ export declare function readNdjsonLines(input: AsyncIterable<Buffer | string>): AsyncGenerator<string>;
@@ -28,6 +28,13 @@ export declare const DAEMON_VALIDATE_PLUGINS_CAPABILITY = "daemon_validate_plugi
28
28
  * and switch it later via `daemon.setproxy`.
29
29
  */
30
30
  export declare const DAEMON_PROXY_CAPABILITY = "daemon_proxy_v1";
31
+ /**
32
+ * The daemon accepts a `no_proxy` bypass list alongside the process-wide proxy
33
+ * (`initialize` and `daemon.setproxy`), and applies it to its own environment.
34
+ * Older CLIs ignore the field, so callers must gate on this capability instead
35
+ * of assuming the bypass list was applied.
36
+ */
37
+ export declare const DAEMON_PROXY_BYPASS_CAPABILITY = "daemon_proxy_bypass_v1";
31
38
  export type JsonPrimitive = string | number | boolean | null;
32
39
  export type JsonValue = JsonPrimitive | JsonValue[] | {
33
40
  [key: string]: JsonValue;
@@ -78,12 +85,26 @@ export interface DaemonSessionUpdatedStatusEventFrame {
78
85
  export interface KeepAliveFrame {
79
86
  type: "keep_alive";
80
87
  }
88
+ /**
89
+ * Connection-level fatal signal emitted by the CLI when its NDJSON reader
90
+ * cannot recover the frame boundary (for example one user message split into
91
+ * multiple lines). It carries metadata only, never frame content.
92
+ */
93
+ export interface DaemonProtocolErrorFrame {
94
+ type: "protocol_error";
95
+ code: string;
96
+ message?: string;
97
+ malformed_lines?: number;
98
+ malformed_bytes?: number;
99
+ last_frame_type?: string;
100
+ last_frame_session_id?: string;
101
+ }
81
102
  /** A raw Query message carrying a daemon-local Session route. */
82
103
  export type DaemonWireSessionMessage = JsonObject & {
83
104
  type: string;
84
105
  session_id?: string;
85
106
  };
86
- export type DaemonProtocolFrame = DaemonControlRequestFrame | DaemonControlResponseFrame | DaemonSessionUpdatedStatusEventFrame | KeepAliveFrame | DaemonWireSessionMessage;
107
+ export type DaemonProtocolFrame = DaemonControlRequestFrame | DaemonControlResponseFrame | DaemonSessionUpdatedStatusEventFrame | KeepAliveFrame | DaemonProtocolErrorFrame | DaemonWireSessionMessage;
87
108
  export type InitializeDaemonParams = {
88
109
  daemon_protocol_version: typeof DAEMON_PROTOCOL_VERSION;
89
110
  sdk_version: string;
@@ -102,6 +123,12 @@ export type InitializeDaemonParams = {
102
123
  * empty string clears a previously configured proxy.
103
124
  */
104
125
  proxy?: string;
126
+ /**
127
+ * Proxy bypass list applied during the handshake (`daemon_proxy_bypass_v1`).
128
+ * Replaces `NO_PROXY` / `no_proxy` in the daemon process; an empty string
129
+ * clears both.
130
+ */
131
+ no_proxy?: string;
105
132
  };
106
133
  export type InitializeDaemonResult = {
107
134
  daemon_protocol_version: typeof DAEMON_PROTOCOL_VERSION;
@@ -260,9 +287,17 @@ export type DaemonValidatePluginsResult = {
260
287
  export type DaemonSetProxyParams = {
261
288
  /** `null` clears the daemon-level proxy. */
262
289
  proxy: string | null;
290
+ /**
291
+ * Replaces the daemon's `NO_PROXY` / `no_proxy`. `null` restores the value
292
+ * inherited at daemon startup; an empty string clears both. Omitted leaves
293
+ * the current bypass list unchanged.
294
+ */
295
+ no_proxy?: string | null;
263
296
  };
264
297
  export type DaemonSetProxyResult = {
265
298
  proxy: string | null;
299
+ /** Present only when the request carried `no_proxy`. */
300
+ no_proxy?: string | null;
266
301
  };
267
302
  export type DaemonGetUsageInfoParams = Record<string, never>;
268
303
  export type DaemonGetUsageInfoResult = {
@@ -55,6 +55,12 @@ export interface StartDaemonOptions {
55
55
  * 账号面与所有会话(`daemon_proxy_v1`)。运行期可用 `daemon.setProxy()` 切换。
56
56
  */
57
57
  proxy?: string;
58
+ /**
59
+ * daemon 进程级代理绕过名单:握手时随 `daemon.initialize` 写入
60
+ * `NO_PROXY` / `no_proxy`(`daemon_proxy_bypass_v1`)。空串表示清空;
61
+ * 运行期可用 `daemon.setProxy(proxy, { noProxy })` 切换或恢复。
62
+ */
63
+ noProxy?: string;
58
64
  /**
59
65
  * VPC private-deployment endpoint for the daemon process (CN deployments only).
60
66
  * Written to `QODERCN_VPC_ENDPOINT` / `QODER_VPC_ENDPOINT` before spawn; the CLI
@@ -105,13 +111,26 @@ export interface Daemon {
105
111
  * Set or clear the daemon-level (process-wide) proxy for every Session.
106
112
  * `undefined` / `null` / an empty string clears it. Requires
107
113
  * `daemon_proxy_v1`; resolves with the normalized proxy (or null).
114
+ *
115
+ * `options.noProxy` replaces the daemon's bypass list (`null` restores the
116
+ * value inherited at startup, an empty string clears it). Supplying it
117
+ * requires `daemon_proxy_bypass_v1`; omitting it leaves the current list
118
+ * unchanged.
108
119
  */
109
- setProxy(proxy?: string | null): Promise<string | null>;
120
+ setProxy(proxy?: string | null, options?: {
121
+ noProxy?: string | null;
122
+ }): Promise<string | null>;
110
123
  /**
111
124
  * The daemon-level proxy currently in effect (`null` when unset/cleared, or
112
125
  * when the CLI does not support `daemon_proxy_v1`).
113
126
  */
114
127
  getProxy(): string | null;
128
+ /**
129
+ * The daemon-level proxy bypass list currently tracked by the SDK (`null`
130
+ * when unset/cleared or when the CLI does not support
131
+ * `daemon_proxy_bypass_v1`).
132
+ */
133
+ getNoProxy(): string | null;
115
134
  /**
116
135
  * Explicitly lands credentials and reports whether the daemon is authenticated.
117
136
  *
@@ -182,6 +201,12 @@ interface InternalDaemonRuntime {
182
201
  /** Local CLI launch context for feedback that bypasses the daemon. */
183
202
  readonly hostActionLaunch: {
184
203
  proxy?: string;
204
+ /**
205
+ * `undefined` uses the env as-is; `null` also uses the env (the CLI
206
+ * restored its startup value); a string overrides `NO_PROXY` / `no_proxy`
207
+ * for the one-shot CLI launch.
208
+ */
209
+ noProxy?: string | null;
185
210
  cliPath?: string;
186
211
  env?: Record<string, string | undefined>;
187
212
  };
@@ -198,6 +223,11 @@ interface InternalDaemonRuntime {
198
223
  * when the CLI ignored the handshake proxy). Updated by `setProxy`.
199
224
  */
200
225
  proxy: string | null;
226
+ /**
227
+ * The daemon-level proxy bypass list currently applied by the CLI (`null`
228
+ * when unset, or when the CLI does not support bypass updates).
229
+ */
230
+ noProxy: string | null;
201
231
  readonly transportProvider: QueryTransportProvider<ProcessTransportOptions>;
202
232
  }
203
233
  export declare function getDaemonRuntime(daemon: Daemon): InternalDaemonRuntime | undefined;
package/dist/index.d.ts CHANGED
@@ -60,7 +60,7 @@ export type { DaemonFallbackReason, DaemonInitResult, InitDaemonOptions, } from
60
60
  export { startDaemon } from './daemon/start-daemon.js';
61
61
  export type { Daemon, DaemonState, DaemonSessionInfo, SessionRuntimeState, StartDaemonOptions, } from './daemon/start-daemon.js';
62
62
  export type { DaemonGetModelsParams, DaemonValidateByokModelParams, DaemonValidatePluginsParams, DaemonSetProxyParams, } from './daemon/protocol.js';
63
- export { DAEMON_PROXY_CAPABILITY, DAEMON_VALIDATE_PLUGINS_CAPABILITY, } from './daemon/protocol.js';
63
+ export { DAEMON_PROXY_BYPASS_CAPABILITY, DAEMON_PROXY_CAPABILITY, DAEMON_VALIDATE_PLUGINS_CAPABILITY, } from './daemon/protocol.js';
64
64
  export { DEFAULT_RUNTIME_TRANSPORT, } from './core/default-runtime.js';
65
65
  export { ProcessTransport, QoderCliProcessError, } from './core/process-transport.js';
66
66
  export { hasResolvableQoderWorkerRuntime, QoderWorkerRuntimeError, WorkerTransport, resolveQoderWorkerRuntimePath, } from './core/worker-transport.js';
@@ -96,7 +96,7 @@ export type { AccessTokenInput, AuthOptions, FetchServiceAccountToken, ServiceAc
96
96
  */
97
97
  export type { FetchJobToken, JobTokenAuthOptions, JobTokenRequest, JobTokenResult, } from './types/auth.js';
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
- 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, 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';
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, 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
101
  export type { QueryTransportCreateOptions, QueryTransportProviderOption, } from './core/query-transport.js';
102
102
  export type { ProcessTransportOptions } from './core/process-transport.js';