lark-remote 0.1.6 → 0.1.7
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/CHANGELOG.md +23 -1
- package/README.en.md +9 -1
- package/README.md +14 -2
- package/dist/bridge/approval-coordinator.d.ts +57 -34
- package/dist/bridge/approval-coordinator.js +191 -40
- package/dist/bridge/inbound-media.d.ts +62 -0
- package/dist/bridge/inbound-media.js +282 -0
- package/dist/bridge/index.d.ts +78 -7
- package/dist/bridge/index.js +202 -79
- package/dist/bridge/queue-manager.d.ts +2 -1
- package/dist/bridge/queue-manager.js +1 -0
- package/dist/card/approval-render.js +152 -36
- package/dist/card/bash-card-session.d.ts +2 -24
- package/dist/card/bash-card-session.js +6 -73
- package/dist/card/bash-renderer.js +2 -3
- package/dist/card/card-budget.js +29 -75
- package/dist/card/card-session.d.ts +48 -0
- package/dist/card/card-session.js +86 -0
- package/dist/card/card-shared.d.ts +1 -12
- package/dist/card/card-shared.js +1 -26
- package/dist/card/run-card-session.d.ts +2 -55
- package/dist/card/run-card-session.js +6 -104
- package/dist/card/run-renderer.js +99 -232
- package/dist/card/run-state.d.ts +13 -0
- package/dist/card/run-state.js +25 -16
- package/dist/card/text-truncate.d.ts +13 -12
- package/dist/card/text-truncate.js +13 -63
- package/dist/common/fs.d.ts +8 -0
- package/dist/common/fs.js +17 -0
- package/dist/common/guards.d.ts +0 -20
- package/dist/common/guards.js +0 -43
- package/dist/common/sleep.d.ts +2 -0
- package/dist/common/sleep.js +5 -0
- package/dist/common/truncate.d.ts +39 -0
- package/dist/common/truncate.js +92 -0
- package/dist/config/codex-config.d.ts +1 -1
- package/dist/config/codex-config.js +1 -1
- package/dist/config/index.d.ts +88 -23
- package/dist/config/index.js +105 -34
- package/dist/connector/index.d.ts +69 -2
- package/dist/connector/index.js +107 -1
- package/dist/index.js +123 -105
- package/dist/instance-lock.js +4 -12
- package/dist/order/alias-resolve.d.ts +13 -0
- package/dist/order/alias-resolve.js +22 -0
- package/dist/order/alias-store.d.ts +38 -0
- package/dist/order/alias-store.js +106 -0
- package/dist/persistence/atomic-write.d.ts +8 -2
- package/dist/persistence/atomic-write.js +23 -7
- package/dist/restart.js +2 -1
- package/dist/router/card-helpers.d.ts +63 -0
- package/dist/router/card-helpers.js +146 -0
- package/dist/router/config/claude.js +25 -1
- package/dist/router/config/codex.js +29 -50
- package/dist/router/config/common/model-patch.d.ts +22 -0
- package/dist/router/config/common/model-patch.js +26 -0
- package/dist/router/config/common/render.js +5 -4
- package/dist/router/config/index.d.ts +12 -0
- package/dist/router/config/index.js +25 -1
- package/dist/router/config/kimi.d.ts +4 -1
- package/dist/router/config/kimi.js +27 -0
- package/dist/router/config/opencode.js +18 -5
- package/dist/router/config/pi.js +4 -5
- package/dist/router/config/types.d.ts +11 -2
- package/dist/router/index.d.ts +56 -21
- package/dist/router/index.js +373 -548
- package/dist/router/utils.d.ts +2 -0
- package/dist/router/utils.js +4 -0
- package/dist/runner/agent-choices-common.d.ts +16 -0
- package/dist/runner/agent-choices-common.js +31 -0
- package/dist/runner/claude/runner.d.ts +47 -10
- package/dist/runner/claude/runner.js +117 -46
- package/dist/runner/claude/session.d.ts +166 -0
- package/dist/runner/claude/session.js +749 -0
- package/dist/runner/codex/app-server/protocol-types.d.ts +31 -39
- package/dist/runner/codex/app-server/protocol-types.js +1 -12
- package/dist/runner/codex/app-server/runner.d.ts +42 -59
- package/dist/runner/codex/app-server/runner.js +160 -337
- package/dist/runner/codex/app-server/translator.d.ts +1 -21
- package/dist/runner/codex/app-server/translator.js +0 -18
- package/dist/runner/codex/index.d.ts +0 -2
- package/dist/runner/codex/index.js +0 -2
- package/dist/runner/common/acp/protocol-helpers.d.ts +14 -0
- package/dist/runner/common/acp/protocol-helpers.js +21 -0
- package/dist/runner/common/acp/protocol-types.d.ts +238 -0
- package/dist/runner/common/acp/protocol-types.js +75 -0
- package/dist/runner/common/connection-based-runner.d.ts +111 -0
- package/dist/runner/common/connection-based-runner.js +261 -0
- package/dist/runner/{codex/app-server → common/jsonrpc}/client.d.ts +14 -7
- package/dist/runner/{codex/app-server → common/jsonrpc}/client.js +27 -18
- package/dist/runner/common/jsonrpc/connection-manager.d.ts +125 -0
- package/dist/runner/{codex/app-server → common/jsonrpc}/connection-manager.js +63 -28
- package/dist/runner/{codex/app-server → common/jsonrpc}/transport.d.ts +5 -4
- package/dist/runner/{codex/app-server → common/jsonrpc}/transport.js +18 -19
- package/dist/runner/common/jsonrpc/types.d.ts +32 -0
- package/dist/runner/common/jsonrpc/types.js +9 -0
- package/dist/runner/common/process-stopper.d.ts +2 -1
- package/dist/runner/common/process-stopper.js +1 -0
- package/dist/runner/common/runner-utils.d.ts +6 -13
- package/dist/runner/common/runner-utils.js +6 -47
- package/dist/runner/common/spawning-runner.d.ts +24 -70
- package/dist/runner/common/spawning-runner.js +98 -152
- package/dist/runner/index.d.ts +4 -4
- package/dist/runner/index.js +4 -4
- package/dist/runner/kimi/acp/runner.d.ts +106 -0
- package/dist/runner/kimi/acp/runner.js +448 -0
- package/dist/runner/kimi/acp/translator.d.ts +124 -0
- package/dist/runner/kimi/acp/translator.js +336 -0
- package/dist/runner/kimi/index.d.ts +1 -1
- package/dist/runner/kimi/index.js +1 -1
- package/dist/runner/opencode/acp/index.d.ts +1 -0
- package/dist/runner/opencode/acp/index.js +2 -0
- package/dist/runner/opencode/acp/runner.d.ts +121 -0
- package/dist/runner/opencode/acp/runner.js +429 -0
- package/dist/runner/opencode/acp/translator.d.ts +119 -0
- package/dist/runner/opencode/acp/translator.js +345 -0
- package/dist/runner/opencode/index.d.ts +1 -1
- package/dist/runner/opencode/index.js +1 -1
- package/dist/runner/pi/index.d.ts +1 -1
- package/dist/runner/pi/index.js +1 -1
- package/dist/runner/pi/rpc/client.d.ts +52 -0
- package/dist/runner/pi/rpc/client.js +114 -0
- package/dist/runner/pi/rpc/index.d.ts +4 -0
- package/dist/runner/pi/rpc/index.js +4 -0
- package/dist/runner/pi/rpc/protocol-types.d.ts +127 -0
- package/dist/runner/pi/rpc/protocol-types.js +21 -0
- package/dist/runner/pi/rpc/runner.d.ts +80 -0
- package/dist/runner/pi/rpc/runner.js +199 -0
- package/dist/runner/pi/rpc/translator.d.ts +55 -0
- package/dist/runner/pi/rpc/translator.js +258 -0
- package/dist/runner/registry.d.ts +7 -8
- package/dist/runner/registry.js +3 -4
- package/dist/runner/resolve-agent-choices.js +18 -59
- package/dist/runner/sync-agent-choices.js +16 -67
- package/dist/runner/types.d.ts +43 -13
- package/dist/session/claude/session-index.js +2 -3
- package/dist/session/claude/session-reader.js +3 -6
- package/dist/session/claude/sessions.js +6 -13
- package/dist/session/codex/rollout-reader.d.ts +2 -2
- package/dist/session/codex/rollout-reader.js +14 -17
- package/dist/session/codex/sessions.d.ts +1 -1
- package/dist/session/codex/sessions.js +2 -2
- package/dist/session/common/content-blocks.d.ts +7 -0
- package/dist/session/common/content-blocks.js +13 -9
- package/dist/session/common/jsonl.d.ts +8 -25
- package/dist/session/common/jsonl.js +126 -261
- package/dist/session/common/pagination.d.ts +28 -0
- package/dist/session/common/pagination.js +33 -0
- package/dist/session/kimi/sessions.d.ts +34 -1
- package/dist/session/kimi/sessions.js +208 -98
- package/dist/session/opencode/sessions.d.ts +17 -3
- package/dist/session/opencode/sessions.js +29 -29
- package/dist/session/pi/sessions.d.ts +5 -1
- package/dist/session/pi/sessions.js +12 -16
- package/dist/session/session-store.d.ts +11 -1
- package/dist/session/session-store.js +75 -178
- package/dist/update/index.d.ts +2 -2
- package/dist/update/index.js +2 -2
- package/dist/update/install.d.ts +20 -2
- package/dist/update/install.js +51 -7
- package/package.json +1 -1
- package/dist/runner/codex/app-server/connection-manager.d.ts +0 -56
- package/dist/runner/codex/argv.d.ts +0 -33
- package/dist/runner/codex/argv.js +0 -40
- package/dist/runner/codex/factory.d.ts +0 -29
- package/dist/runner/codex/factory.js +0 -39
- package/dist/runner/codex/jsonl.d.ts +0 -37
- package/dist/runner/codex/jsonl.js +0 -221
- package/dist/runner/codex/runner.d.ts +0 -66
- package/dist/runner/codex/runner.js +0 -129
- package/dist/runner/common/exec-translator.d.ts +0 -73
- package/dist/runner/common/exec-translator.js +0 -105
- package/dist/runner/kimi/jsonl.d.ts +0 -28
- package/dist/runner/kimi/jsonl.js +0 -143
- package/dist/runner/kimi/runner.d.ts +0 -49
- package/dist/runner/kimi/runner.js +0 -105
- package/dist/runner/opencode/argv.d.ts +0 -32
- package/dist/runner/opencode/argv.js +0 -35
- package/dist/runner/opencode/jsonl.d.ts +0 -68
- package/dist/runner/opencode/jsonl.js +0 -295
- package/dist/runner/opencode/runner.d.ts +0 -61
- package/dist/runner/opencode/runner.js +0 -93
- package/dist/runner/pi/jsonl.d.ts +0 -128
- package/dist/runner/pi/jsonl.js +0 -249
- package/dist/runner/pi/runner.d.ts +0 -36
- package/dist/runner/pi/runner.js +0 -76
- package/dist/session/common/catch-up.d.ts +0 -12
- package/dist/session/common/catch-up.js +0 -31
|
@@ -7,51 +7,20 @@
|
|
|
7
7
|
* (`item/agentMessage/delta`) and snake_case only where the server requires it
|
|
8
8
|
* (e.g. permission profile fields).
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
11
|
-
jsonrpc: '2.0';
|
|
12
|
-
id: number | string;
|
|
13
|
-
method: string;
|
|
14
|
-
params?: unknown;
|
|
15
|
-
}
|
|
16
|
-
export interface JsonRpcNotification {
|
|
17
|
-
jsonrpc: '2.0';
|
|
18
|
-
method: string;
|
|
19
|
-
params?: unknown;
|
|
20
|
-
}
|
|
21
|
-
export interface JsonRpcSuccessResponse {
|
|
22
|
-
jsonrpc: '2.0';
|
|
23
|
-
id: number | string;
|
|
24
|
-
result: unknown;
|
|
25
|
-
}
|
|
26
|
-
export interface JsonRpcErrorResponse {
|
|
27
|
-
jsonrpc: '2.0';
|
|
28
|
-
id: number | string | null;
|
|
29
|
-
error: {
|
|
30
|
-
code: number;
|
|
31
|
-
message: string;
|
|
32
|
-
data?: unknown;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export type ServerMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcSuccessResponse | JsonRpcErrorResponse;
|
|
36
|
-
/** Standard JSON-RPC error codes. */
|
|
37
|
-
export declare const RpcErrorCode: {
|
|
38
|
-
readonly PARSE_ERROR: -32700;
|
|
39
|
-
readonly INVALID_REQUEST: -32600;
|
|
40
|
-
readonly METHOD_NOT_FOUND: -32601;
|
|
41
|
-
readonly INVALID_PARAMS: -32602;
|
|
42
|
-
readonly INTERNAL_ERROR: -32603;
|
|
43
|
-
/** Timeout error (custom, not standard JSON-RPC). */
|
|
44
|
-
readonly TIMEOUT_ERROR: -32000;
|
|
45
|
-
/** Connection lost / transport error (custom). */
|
|
46
|
-
readonly CONNECTION_LOST: -32001;
|
|
47
|
-
};
|
|
10
|
+
export type { JsonRpcRequest, JsonRpcNotification, JsonRpcSuccessResponse, JsonRpcErrorResponse, } from '../../common/jsonrpc/types.js';
|
|
48
11
|
export interface ClientInfo {
|
|
49
12
|
name: string;
|
|
50
13
|
version: string;
|
|
51
14
|
}
|
|
15
|
+
export interface InitializeCapabilities {
|
|
16
|
+
experimentalApi?: boolean;
|
|
17
|
+
requestAttestation?: boolean;
|
|
18
|
+
optOutNotificationMethods?: string[];
|
|
19
|
+
mcpServerOpenaiFormElicitation?: boolean;
|
|
20
|
+
}
|
|
52
21
|
export interface InitializeParams {
|
|
53
22
|
clientInfo: ClientInfo;
|
|
54
|
-
capabilities?:
|
|
23
|
+
capabilities?: InitializeCapabilities;
|
|
55
24
|
}
|
|
56
25
|
export interface InitializeResult {
|
|
57
26
|
serverInfo?: {
|
|
@@ -121,6 +90,28 @@ export interface ThreadResumeResponse {
|
|
|
121
90
|
model: string;
|
|
122
91
|
modelProvider: string;
|
|
123
92
|
}
|
|
93
|
+
/** `thread/settings/update` params (real v2 protocol). */
|
|
94
|
+
export interface ThreadSettingsUpdateParams {
|
|
95
|
+
threadId: string;
|
|
96
|
+
/** Override the approval policy for subsequent turns. */
|
|
97
|
+
approvalPolicy?: AskForApproval;
|
|
98
|
+
/** Override the sandbox policy for subsequent turns. */
|
|
99
|
+
sandboxPolicy?: SandboxPolicy;
|
|
100
|
+
/** Override the model for subsequent turns. */
|
|
101
|
+
model?: string | null;
|
|
102
|
+
/** Override the model provider for subsequent turns. */
|
|
103
|
+
modelProvider?: string | null;
|
|
104
|
+
}
|
|
105
|
+
export interface ThreadSettingsUpdateResponse {
|
|
106
|
+
}
|
|
107
|
+
/** Server→client notification after a settings update is applied. */
|
|
108
|
+
export interface ThreadSettingsUpdatedNotification {
|
|
109
|
+
method: 'thread/settings/updated';
|
|
110
|
+
params: {
|
|
111
|
+
threadId: string;
|
|
112
|
+
threadSettings: unknown;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
124
115
|
export interface ThreadCompactStartParams {
|
|
125
116
|
threadId: string;
|
|
126
117
|
}
|
|
@@ -268,6 +259,7 @@ export declare const NotificationMethod: {
|
|
|
268
259
|
readonly WARNING: "warning";
|
|
269
260
|
readonly THREAD_STARTED: "thread/started";
|
|
270
261
|
readonly THREAD_STATUS_CHANGED: "thread/status/changed";
|
|
262
|
+
readonly THREAD_SETTINGS_UPDATED: "thread/settings/updated";
|
|
271
263
|
readonly THREAD_COMPACTED: "thread/compacted";
|
|
272
264
|
readonly MODEL_REROUTED: "model/rerouted";
|
|
273
265
|
};
|
|
@@ -7,18 +7,6 @@
|
|
|
7
7
|
* (`item/agentMessage/delta`) and snake_case only where the server requires it
|
|
8
8
|
* (e.g. permission profile fields).
|
|
9
9
|
*/
|
|
10
|
-
/** Standard JSON-RPC error codes. */
|
|
11
|
-
export const RpcErrorCode = {
|
|
12
|
-
PARSE_ERROR: -32700,
|
|
13
|
-
INVALID_REQUEST: -32600,
|
|
14
|
-
METHOD_NOT_FOUND: -32601,
|
|
15
|
-
INVALID_PARAMS: -32602,
|
|
16
|
-
INTERNAL_ERROR: -32603,
|
|
17
|
-
/** Timeout error (custom, not standard JSON-RPC). */
|
|
18
|
-
TIMEOUT_ERROR: -32000,
|
|
19
|
-
/** Connection lost / transport error (custom). */
|
|
20
|
-
CONNECTION_LOST: -32001,
|
|
21
|
-
};
|
|
22
10
|
// =============================================================================
|
|
23
11
|
// Notifications (server → client)
|
|
24
12
|
// =============================================================================
|
|
@@ -42,6 +30,7 @@ export const NotificationMethod = {
|
|
|
42
30
|
WARNING: 'warning',
|
|
43
31
|
THREAD_STARTED: 'thread/started',
|
|
44
32
|
THREAD_STATUS_CHANGED: 'thread/status/changed',
|
|
33
|
+
THREAD_SETTINGS_UPDATED: 'thread/settings/updated',
|
|
45
34
|
THREAD_COMPACTED: 'thread/compacted',
|
|
46
35
|
MODEL_REROUTED: 'model/rerouted',
|
|
47
36
|
};
|
|
@@ -5,9 +5,16 @@
|
|
|
5
5
|
* Flow per run: acquire persistent connection → thread/start or thread/resume
|
|
6
6
|
* → turn/start → consume notifications (agent message deltas, approval server
|
|
7
7
|
* requests, …) until turn/completed → synthesize ResultEvent.
|
|
8
|
+
*
|
|
9
|
+
* Shares the ConnectionBasedRunner base with kimi/opencode: same notification
|
|
10
|
+
* queue + waitResolve pump, forceFinish/stopRequested semantics, turn idle
|
|
11
|
+
* watchdog, and ConnectionLostError respawn-and-retry-once.
|
|
8
12
|
*/
|
|
9
|
-
import type { AgentKind, AgentSessionReader, AgentEvent,
|
|
10
|
-
import {
|
|
13
|
+
import type { AgentKind, AgentSessionReader, AgentEvent, AgentStatusInfo, SpawnOptions } from '../../types.js';
|
|
14
|
+
import { JsonRpcClient } from '../../common/jsonrpc/client.js';
|
|
15
|
+
import { type TranslatorEvent } from './translator.js';
|
|
16
|
+
import { type AskForApproval, type SandboxMode, type SandboxPolicy, type InitializeResult } from './protocol-types.js';
|
|
17
|
+
import { ConnectionBasedRunner } from '../../common/connection-based-runner.js';
|
|
11
18
|
export interface CodexAppServerRunnerOptions {
|
|
12
19
|
kind: AgentKind;
|
|
13
20
|
sessionReader: AgentSessionReader;
|
|
@@ -31,90 +38,66 @@ export interface CodexAppServerRunnerOptions {
|
|
|
31
38
|
/** Configured approval policy (Codex 官方 AskForApproval 标准值). */
|
|
32
39
|
approvalPolicy?: AskForApproval;
|
|
33
40
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Map the client-side SandboxMode enum to the response-side SandboxPolicy
|
|
43
|
+
* object used by `thread/settings/update` (`sandboxPolicy`).
|
|
44
|
+
*/
|
|
45
|
+
export declare function sandboxModeToSandboxPolicy(mode: SandboxMode): SandboxPolicy;
|
|
46
|
+
export declare class CodexAppServerRunner extends ConnectionBasedRunner<JsonRpcClient<InitializeResult>, TranslatorEvent> {
|
|
38
47
|
private connectionManager;
|
|
39
|
-
private currentClient;
|
|
40
48
|
private currentTranslator;
|
|
41
|
-
private
|
|
42
|
-
private currentTurnId;
|
|
43
|
-
private lastEventAt;
|
|
44
|
-
private _isRunning;
|
|
49
|
+
private activeThreadId;
|
|
45
50
|
private model?;
|
|
46
51
|
private modelProvider?;
|
|
47
52
|
private reasoningEffort?;
|
|
48
53
|
private sandboxConfig?;
|
|
49
54
|
private approvalPolicyConfig?;
|
|
50
|
-
private readonly turnTimeoutMs;
|
|
51
55
|
/** Pending approval requests: requestId (JSON-RPC id) → kind + view. */
|
|
52
56
|
private pendingApprovals;
|
|
53
|
-
/** Notification queue consumed by the active run generator. */
|
|
54
|
-
private notificationQueue;
|
|
55
|
-
private waitResolve;
|
|
56
|
-
private forceFinish;
|
|
57
|
-
/** stop() 在 turn/start 响应前到达时置位,turn/start 完成后补发 interrupt。 */
|
|
58
|
-
private stopRequested;
|
|
59
57
|
constructor(opts: CodexAppServerRunnerOptions);
|
|
60
|
-
get
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
* Acquire the connection and set up the turn: thread/start(新会话)或
|
|
71
|
-
* thread/resume(按 sessionId 恢复既有线程)→ turn/start。
|
|
72
|
-
*/
|
|
73
|
-
private setupTurn;
|
|
58
|
+
protected get logTag(): string;
|
|
59
|
+
protected get turnTimeoutErrorMessage(): string;
|
|
60
|
+
protected get turnInterruptedErrorMessage(): string;
|
|
61
|
+
protected currentSessionId(): string | null;
|
|
62
|
+
protected shouldDeferStop(): boolean;
|
|
63
|
+
protected cancelCurrentTurn(): Promise<void>;
|
|
64
|
+
protected clearTurnState(): void;
|
|
65
|
+
protected releaseConnection(cwd: string): Promise<void>;
|
|
66
|
+
protected notifyIdle(cwd: string): void;
|
|
67
|
+
protected disposeConnections(): Promise<void>;
|
|
74
68
|
/**
|
|
75
69
|
* Run a compact operation on the current thread.
|
|
76
70
|
*/
|
|
77
71
|
runCompact(_message: string, opts: SpawnOptions): AsyncGenerator<AgentEvent>;
|
|
78
|
-
/**
|
|
79
|
-
* Stop the current turn by interrupting it.
|
|
80
|
-
*/
|
|
81
|
-
stop(_opts?: {
|
|
82
|
-
immediate?: boolean;
|
|
83
|
-
}): Promise<void>;
|
|
84
72
|
/**
|
|
85
73
|
* Respond to an approval server request. `response` is the bridge
|
|
86
74
|
* ApprovalAction (`{ action: 'accept' | 'accept_for_session' | 'decline' | 'cancel' }`).
|
|
87
75
|
*/
|
|
88
76
|
respondApproval(requestId: number | string, response: unknown): Promise<void>;
|
|
77
|
+
getStatusInfo(): AgentStatusInfo;
|
|
89
78
|
/**
|
|
90
|
-
*
|
|
79
|
+
* Unified approval-mode hot-update entry (called by the bridge via duck
|
|
80
|
+
* typing on active runs). Codex's `thread/settings/update` applies the new
|
|
81
|
+
* approval/sandbox policy to subsequent turns, even while the current turn
|
|
82
|
+
* is still active. This lets `/config` take effect without waiting for this
|
|
83
|
+
* workspace-lifetime runner to be recreated/evicted. Local fields are always
|
|
84
|
+
* updated so `/status` reflects the new config immediately; if there is no
|
|
85
|
+
* live thread, the next `thread/start`/`thread/resume` uses the new values
|
|
86
|
+
* anyway.
|
|
91
87
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
unregisterExitHandlers(): void;
|
|
97
|
-
getStatusInfo(): AgentStatusInfo;
|
|
88
|
+
updateApprovalMode(settings: {
|
|
89
|
+
approvalPolicy?: AskForApproval;
|
|
90
|
+
sandbox?: SandboxMode;
|
|
91
|
+
}): Promise<void>;
|
|
98
92
|
private buildThreadParams;
|
|
99
93
|
private buildTurnParams;
|
|
100
94
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*/
|
|
104
|
-
private consumeTurn;
|
|
105
|
-
/**
|
|
106
|
-
* Compute the current idle deadline. 0 disables the idle timeout; otherwise
|
|
107
|
-
* the deadline is based on the last received event, not the turn start time.
|
|
95
|
+
* Acquire the connection and set up the turn: thread/start(新会话)或
|
|
96
|
+
* thread/resume(按 sessionId 恢复既有线程)→ turn/start。
|
|
108
97
|
*/
|
|
109
|
-
|
|
110
|
-
private interruptCurrentTurn;
|
|
111
|
-
private waitForEvents;
|
|
98
|
+
protected setupTurn(message: string, opts: SpawnOptions): Promise<void>;
|
|
112
99
|
private handleNotification;
|
|
113
100
|
private handleServerRequest;
|
|
114
|
-
private pushEvents;
|
|
115
|
-
private wakeWaiters;
|
|
116
|
-
private failTurn;
|
|
117
|
-
private resetRunState;
|
|
118
101
|
private buildGrantedPermissions;
|
|
119
102
|
/** 拒绝权限审批:空 fileSystem + 关闭网络(真实 GrantedPermissionProfile)。 */
|
|
120
103
|
private denyAllPermissions;
|