@swifty.js/swifty 0.0.30 → 0.0.31
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 +14 -0
- package/dist/agent-O6C4FCQY.js +4 -0
- package/dist/anthropic-CFM2DXMB.js +4 -0
- package/dist/checker-A6PGACKZ.js +4 -0
- package/dist/chunk-4ABFUBO4.js +601 -0
- package/dist/{chunk-K5ZK27BX.js → chunk-AGJYBJ5M.js} +1 -1
- package/dist/chunk-MVVSONAE.js +4 -0
- package/dist/chunk-OQCEP2F5.js +4 -0
- package/dist/{chunk-QFSCPD63.js → chunk-TCQ4EB4G.js} +1 -1
- package/dist/chunk-Y2UUXOQA.js +4 -0
- package/dist/chunk-YAXZ2OUD.js +150 -0
- package/dist/lib/agent-YRTROHXU.js +10 -0
- package/dist/lib/{anthropic-CL5IK7KN.js → anthropic-R6DMXE7U.js} +3 -4
- package/dist/lib/{checker-BS4MK3O6.js → checker-M7RKMKJQ.js} +2 -3
- package/dist/lib/{chunk-IYPTOY3Y.js → chunk-4MDCRPVV.js} +35 -26
- package/dist/lib/{chunk-RMB3J46W.js → chunk-A4MXZA5Q.js} +197 -36
- package/dist/lib/{chunk-7QPDFSQE.js → chunk-EWE5IWZE.js} +20 -10
- package/dist/lib/{chunk-KG4MJGKQ.js → chunk-FZ4Y6MBN.js} +1 -4
- package/dist/lib/{chunk-OOSNCCI7.js → chunk-J6AV7SIF.js} +143 -148
- package/dist/lib/{chunk-I7OPU4K2.js → chunk-OEPCNATU.js} +192 -32
- package/dist/lib/{chunk-PIL7M52F.js → chunk-XT67KGWE.js} +16 -3
- package/dist/lib/index.d.ts +856 -778
- package/dist/lib/index.js +2261 -749
- package/dist/lib/{openai-LH4E7ZQS.js → openai-5N42ZYIJ.js} +1 -1
- package/dist/lib/{tool-filter-CS6W2GMU.js → tool-filter-XG2GXFVN.js} +3 -2
- package/dist/main.js +140 -140
- package/dist/openai-NQYARTT6.js +34 -0
- package/dist/{server-IVIRQTO7.js → server-BNT2IIKB.js} +17 -17
- package/dist/tool-filter-5NDJMSTD.js +4 -0
- package/package.json +1 -1
- package/dist/agent-TCNIRVHD.js +0 -4
- package/dist/anthropic-7RIVSEDF.js +0 -4
- package/dist/checker-3LHDOATB.js +0 -4
- package/dist/chunk-2IBMB3ZM.js +0 -150
- package/dist/chunk-E55KH72M.js +0 -4
- package/dist/chunk-FA26MQ7K.js +0 -257
- package/dist/chunk-QCKJLO6X.js +0 -4
- package/dist/chunk-TKADLB2Q.js +0 -4
- package/dist/chunk-VA64DJNN.js +0 -4
- package/dist/lib/agent-IRY7KR5D.js +0 -11
- package/dist/lib/chunk-GHF2PSEW.js +0 -8
- package/dist/openai-RZLCY55V.js +0 -34
- package/dist/tool-filter-CG3KGQQW.js +0 -4
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import z, { z as z$1 } from 'zod';
|
|
1
2
|
import Anthropic from '@anthropic-ai/sdk';
|
|
2
|
-
import
|
|
3
|
+
import { BetaToolComputerUse20251124 } from '@anthropic-ai/sdk/resources/beta/messages/messages';
|
|
3
4
|
import OpenAI from 'openai';
|
|
4
|
-
import { ChatCompletionFunctionTool } from 'openai/resources/chat/completions';
|
|
5
|
-
import { FunctionTool } from 'openai/resources/responses/responses';
|
|
6
5
|
import { Logger } from 'pino';
|
|
7
6
|
import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
8
7
|
import { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
|
|
@@ -28,106 +27,41 @@ import { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
|
|
|
28
27
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
28
|
* SOFTWARE.
|
|
30
29
|
*/
|
|
31
|
-
interface
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
interface SkillInvocationRecord {
|
|
37
|
-
name: string;
|
|
38
|
-
body: string;
|
|
39
|
-
timestamp: number;
|
|
40
|
-
}
|
|
41
|
-
declare class RecoveryState {
|
|
42
|
-
private files;
|
|
43
|
-
private skills;
|
|
44
|
-
recordFileRead(path: string, content: string): void;
|
|
45
|
-
recordSkillInvocation(name: string, body: string): void;
|
|
46
|
-
snapshotFiles(limit?: number): FileReadRecord[];
|
|
47
|
-
snapshotSkills(): SkillInvocationRecord[];
|
|
48
|
-
buildRecoveryAttachment(toolSchemaNames: string[]): string;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Copyright (c) 2026 hangtiancheng
|
|
53
|
-
*
|
|
54
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
55
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
56
|
-
* in the Software without restriction, including without limitation the rights
|
|
57
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
58
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
59
|
-
* furnished to do so, subject to the following conditions:
|
|
60
|
-
*
|
|
61
|
-
* The above copyright notice and this permission notice shall be included in
|
|
62
|
-
* all copies or substantial portions of the Software.
|
|
63
|
-
*
|
|
64
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
65
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
66
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
67
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
68
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
69
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
70
|
-
* SOFTWARE.
|
|
71
|
-
*/
|
|
72
|
-
type DecisionEffect = "allow" | "deny" | "ask";
|
|
73
|
-
type PermissionMode = "default" | "acceptEdits" | "plan" | "bypassPermissions";
|
|
74
|
-
interface Decision {
|
|
75
|
-
effect: DecisionEffect;
|
|
76
|
-
reason: string;
|
|
77
|
-
}
|
|
78
|
-
type RuleEffect = DecisionEffect;
|
|
79
|
-
interface Rule {
|
|
80
|
-
tool: string;
|
|
81
|
-
pattern: string;
|
|
82
|
-
effect: RuleEffect;
|
|
83
|
-
}
|
|
84
|
-
declare function extractContent(toolName: string, args: Record<string, unknown>): string;
|
|
85
|
-
declare class PathSandbox {
|
|
86
|
-
private allowedRoots;
|
|
87
|
-
private denyWritePaths;
|
|
88
|
-
private projectDir;
|
|
89
|
-
constructor(projectDir: string);
|
|
90
|
-
addRoot(root: string): void;
|
|
91
|
-
addDenyWrite(path: string): void;
|
|
92
|
-
/**
|
|
93
|
-
* Check whether a path is in the deny-write list.
|
|
94
|
-
* denyWrite has the highest priority — even if the path is within an allowed root, writes are still denied.
|
|
95
|
-
*/
|
|
96
|
-
checkDenyWrite(filePath: string): Decision | null;
|
|
97
|
-
check(filePath: string): Decision | null;
|
|
98
|
-
}
|
|
99
|
-
declare function evaluateRules(rules: Rule[], toolName: string, content: string): RuleEffect | null;
|
|
100
|
-
declare class RuleEngine {
|
|
101
|
-
private userPath;
|
|
102
|
-
private projectPath;
|
|
103
|
-
private cache;
|
|
104
|
-
constructor(workDir: string);
|
|
105
|
-
private rulesFor;
|
|
106
|
-
snapshot(): Rule[];
|
|
107
|
-
evaluate(toolName: string, content: string): RuleEffect | null;
|
|
108
|
-
appendProjectRule(rule: Rule): void;
|
|
109
|
-
}
|
|
110
|
-
declare function isSafeCommand(command: string): boolean;
|
|
111
|
-
declare class PermissionChecker {
|
|
112
|
-
private readonly workDir;
|
|
113
|
-
mode: PermissionMode;
|
|
114
|
-
planFilePath: string;
|
|
115
|
-
sandboxEnabled: boolean;
|
|
116
|
-
sandboxAutoAllow: boolean;
|
|
117
|
-
private sandbox;
|
|
118
|
-
private ruleEngine;
|
|
119
|
-
constructor(workDir: string, mode?: PermissionMode);
|
|
120
|
-
forWorkDir(workDir: string): PermissionChecker;
|
|
121
|
-
check(toolName: string, category: "read" | "write" | "command", args: Record<string, unknown>): Decision;
|
|
122
|
-
allowExtraRoot(path: string): void;
|
|
123
|
-
allowAlways(toolName: string, args: Record<string, unknown>): void;
|
|
124
|
-
/**
|
|
125
|
-
* Generate a human-readable description of the tool action for display in HITL confirmation dialogs.
|
|
126
|
-
* Prioritizes extracting fields defined in contentFields (e.g., command, file_path);
|
|
127
|
-
* falls back to a key:value summary of parameters if no match is found.
|
|
128
|
-
*/
|
|
129
|
-
describeToolAction(toolName: string, args: Record<string, unknown>): string;
|
|
30
|
+
interface UsageInfo {
|
|
31
|
+
inputTokens: number;
|
|
32
|
+
outputTokens: number;
|
|
33
|
+
cacheReadInputTokens: number;
|
|
34
|
+
cacheCreationInputTokens: number;
|
|
130
35
|
}
|
|
36
|
+
/** Tool use delta: Input partial JSON */
|
|
37
|
+
type StreamEvent = {
|
|
38
|
+
type: "text_delta";
|
|
39
|
+
text: string;
|
|
40
|
+
} | {
|
|
41
|
+
type: "thinking_delta";
|
|
42
|
+
text: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: "thinking_complete";
|
|
45
|
+
thinking: string;
|
|
46
|
+
signature: string;
|
|
47
|
+
} | {
|
|
48
|
+
type: "tool_call_start";
|
|
49
|
+
toolName: string;
|
|
50
|
+
toolId: string;
|
|
51
|
+
} | {
|
|
52
|
+
type: "tool_call_delta";
|
|
53
|
+
text: string;
|
|
54
|
+
} | {
|
|
55
|
+
type: "tool_call_complete";
|
|
56
|
+
toolId: string;
|
|
57
|
+
toolName: string;
|
|
58
|
+
arguments: Record<string, unknown>;
|
|
59
|
+
providerItemId?: string;
|
|
60
|
+
} | {
|
|
61
|
+
type: "stream_end";
|
|
62
|
+
stopReason: string;
|
|
63
|
+
usage: UsageInfo;
|
|
64
|
+
};
|
|
131
65
|
|
|
132
66
|
/**
|
|
133
67
|
* Copyright (c) 2026 hangtiancheng
|
|
@@ -219,6 +153,87 @@ declare class FileHistory {
|
|
|
219
153
|
save(): void;
|
|
220
154
|
}
|
|
221
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Copyright (c) 2026 hangtiancheng
|
|
158
|
+
*
|
|
159
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
160
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
161
|
+
* in the Software without restriction, including without limitation the rights
|
|
162
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
163
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
164
|
+
* furnished to do so, subject to the following conditions:
|
|
165
|
+
*
|
|
166
|
+
* The above copyright notice and this permission notice shall be included in
|
|
167
|
+
* all copies or substantial portions of the Software.
|
|
168
|
+
*
|
|
169
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
170
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
171
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
172
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
173
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
174
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
175
|
+
* SOFTWARE.
|
|
176
|
+
*/
|
|
177
|
+
type DecisionEffect = "allow" | "deny" | "ask";
|
|
178
|
+
type PermissionMode = "default" | "acceptEdits" | "plan" | "bypassPermissions";
|
|
179
|
+
interface Decision {
|
|
180
|
+
effect: DecisionEffect;
|
|
181
|
+
reason: string;
|
|
182
|
+
}
|
|
183
|
+
type RuleEffect = DecisionEffect;
|
|
184
|
+
interface Rule {
|
|
185
|
+
tool: string;
|
|
186
|
+
pattern: string;
|
|
187
|
+
effect: RuleEffect;
|
|
188
|
+
}
|
|
189
|
+
declare function extractContent(toolName: string, args: Record<string, unknown>): string;
|
|
190
|
+
declare class PathSandbox {
|
|
191
|
+
private allowedRoots;
|
|
192
|
+
private denyWritePaths;
|
|
193
|
+
private projectDir;
|
|
194
|
+
constructor(projectDir: string);
|
|
195
|
+
addRoot(root: string): void;
|
|
196
|
+
addDenyWrite(path: string): void;
|
|
197
|
+
/**
|
|
198
|
+
* Check whether a path is in the deny-write list.
|
|
199
|
+
* denyWrite has the highest priority — even if the path is within an allowed root, writes are still denied.
|
|
200
|
+
*/
|
|
201
|
+
checkDenyWrite(filePath: string): Decision | null;
|
|
202
|
+
check(filePath: string): Decision | null;
|
|
203
|
+
}
|
|
204
|
+
declare function evaluateRules(rules: Rule[], toolName: string, content: string): RuleEffect | null;
|
|
205
|
+
declare class RuleEngine {
|
|
206
|
+
private userPath;
|
|
207
|
+
private projectPath;
|
|
208
|
+
private cache;
|
|
209
|
+
constructor(workDir: string);
|
|
210
|
+
private rulesFor;
|
|
211
|
+
snapshot(): Rule[];
|
|
212
|
+
evaluate(toolName: string, content: string): RuleEffect | null;
|
|
213
|
+
appendProjectRule(rule: Rule): void;
|
|
214
|
+
}
|
|
215
|
+
declare function isSafeCommand(command: string): boolean;
|
|
216
|
+
declare class PermissionChecker {
|
|
217
|
+
private readonly workDir;
|
|
218
|
+
mode: PermissionMode;
|
|
219
|
+
planFilePath: string;
|
|
220
|
+
sandboxEnabled: boolean;
|
|
221
|
+
sandboxAutoAllow: boolean;
|
|
222
|
+
private sandbox;
|
|
223
|
+
private ruleEngine;
|
|
224
|
+
constructor(workDir: string, mode?: PermissionMode);
|
|
225
|
+
forWorkDir(workDir: string): PermissionChecker;
|
|
226
|
+
check(toolName: string, category: "read" | "write" | "command", args: Record<string, unknown>): Decision;
|
|
227
|
+
allowExtraRoot(path: string): void;
|
|
228
|
+
allowAlways(toolName: string, args: Record<string, unknown>): void;
|
|
229
|
+
/**
|
|
230
|
+
* Generate a human-readable description of the tool action for display in HITL confirmation dialogs.
|
|
231
|
+
* Prioritizes extracting fields defined in contentFields (e.g., command, file_path);
|
|
232
|
+
* falls back to a key:value summary of parameters if no match is found.
|
|
233
|
+
*/
|
|
234
|
+
describeToolAction(toolName: string, args: Record<string, unknown>): string;
|
|
235
|
+
}
|
|
236
|
+
|
|
222
237
|
/**
|
|
223
238
|
* Copyright (c) 2026 hangtiancheng
|
|
224
239
|
*
|
|
@@ -305,6 +320,12 @@ interface ToolSchema {
|
|
|
305
320
|
};
|
|
306
321
|
eager_input_streaming?: boolean;
|
|
307
322
|
}
|
|
323
|
+
type ToolProtocol = "anthropic" | "openai" | "openai-compat";
|
|
324
|
+
type AnthropicToolSchema = ToolSchema | Anthropic.Tool | BetaToolComputerUse20251124;
|
|
325
|
+
type OpenAIResponsesToolSchema = OpenAI.Responses.FunctionTool | OpenAI.Responses.ComputerTool;
|
|
326
|
+
type OpenAICompatToolSchema = OpenAI.ChatCompletionFunctionTool;
|
|
327
|
+
type ProviderToolSchema = ToolSchema | AnthropicToolSchema | OpenAIResponsesToolSchema | OpenAICompatToolSchema;
|
|
328
|
+
type ProviderNativeToolSchema = BetaToolComputerUse20251124 | OpenAI.Responses.ComputerTool;
|
|
308
329
|
interface Tool {
|
|
309
330
|
name: string;
|
|
310
331
|
description: string;
|
|
@@ -323,6 +344,12 @@ interface Tool {
|
|
|
323
344
|
* trip, so they are never deferred and always ship their full schema.
|
|
324
345
|
*/
|
|
325
346
|
deferred?: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Return a provider-native declaration when the protocol supports this tool
|
|
349
|
+
* natively. Returning undefined lets the registry serialize schema() as a
|
|
350
|
+
* regular custom/function tool.
|
|
351
|
+
*/
|
|
352
|
+
providerSchema?(protocol: ToolProtocol): ProviderNativeToolSchema | undefined;
|
|
326
353
|
/**
|
|
327
354
|
* Whether this particular invocation can run concurrently with others,
|
|
328
355
|
* judged by actual arguments rather than just the tool category.
|
|
@@ -364,6 +391,7 @@ interface ToolUseBlock {
|
|
|
364
391
|
toolUseId: string;
|
|
365
392
|
toolName: string;
|
|
366
393
|
arguments: Record<string, unknown>;
|
|
394
|
+
providerItemId?: string;
|
|
367
395
|
}
|
|
368
396
|
interface ToolResultBlock {
|
|
369
397
|
toolUseId: string;
|
|
@@ -421,6 +449,253 @@ declare class ConversationManager {
|
|
|
421
449
|
} | null;
|
|
422
450
|
}
|
|
423
451
|
|
|
452
|
+
/**
|
|
453
|
+
* Copyright (c) 2026 hangtiancheng
|
|
454
|
+
*
|
|
455
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
456
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
457
|
+
* in the Software without restriction, including without limitation the rights
|
|
458
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
459
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
460
|
+
* furnished to do so, subject to the following conditions:
|
|
461
|
+
*
|
|
462
|
+
* The above copyright notice and this permission notice shall be included in
|
|
463
|
+
* all copies or substantial portions of the Software.
|
|
464
|
+
*
|
|
465
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
466
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
467
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
468
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
469
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
470
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
471
|
+
* SOFTWARE.
|
|
472
|
+
*/
|
|
473
|
+
|
|
474
|
+
declare const COMPACT_BOUNDARY = "compact_boundary";
|
|
475
|
+
/** Persisted form of a tool invocation. Stores a provider-agnostic internal representation rather than
|
|
476
|
+
* any vendor-specific wire format, so sessions can be restored even after switching providers. */
|
|
477
|
+
declare const ToolUseRecordSchema: z.ZodObject<{
|
|
478
|
+
tool_use_id: z.ZodString;
|
|
479
|
+
tool_name: z.ZodString;
|
|
480
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
481
|
+
provider_item_id: z.ZodOptional<z.ZodString>;
|
|
482
|
+
}, z.core.$strip>;
|
|
483
|
+
type ToolUseRecord = z.infer<typeof ToolUseRecordSchema>;
|
|
484
|
+
/** Persisted form of a tool result, paired with a ToolUseRecord via tool_use_id. */
|
|
485
|
+
declare const ToolResultRecordSchema: z.ZodObject<{
|
|
486
|
+
tool_use_id: z.ZodString;
|
|
487
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
488
|
+
content_blocks: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
489
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
490
|
+
}, z.core.$strip>;
|
|
491
|
+
type ToolResultRecord = z.infer<typeof ToolResultRecordSchema>;
|
|
492
|
+
declare const SessionMessageSchema: z.ZodObject<{
|
|
493
|
+
role: z.ZodString;
|
|
494
|
+
content: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
495
|
+
timestamp: z.ZodNumber;
|
|
496
|
+
type: z.ZodOptional<z.ZodString>;
|
|
497
|
+
tool_uses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
498
|
+
tool_use_id: z.ZodString;
|
|
499
|
+
tool_name: z.ZodString;
|
|
500
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
501
|
+
provider_item_id: z.ZodOptional<z.ZodString>;
|
|
502
|
+
}, z.core.$strip>>>;
|
|
503
|
+
tool_results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
504
|
+
tool_use_id: z.ZodString;
|
|
505
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
506
|
+
content_blocks: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
507
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
508
|
+
}, z.core.$strip>>>;
|
|
509
|
+
}, z.core.$strip>;
|
|
510
|
+
type SessionMessage = z.infer<typeof SessionMessageSchema>;
|
|
511
|
+
declare const KeptMessageSchema: z.ZodObject<{
|
|
512
|
+
role: z.ZodString;
|
|
513
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
514
|
+
tool_uses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
515
|
+
tool_use_id: z.ZodString;
|
|
516
|
+
tool_name: z.ZodString;
|
|
517
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
518
|
+
provider_item_id: z.ZodOptional<z.ZodString>;
|
|
519
|
+
}, z.core.$strip>>>;
|
|
520
|
+
tool_results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
521
|
+
tool_use_id: z.ZodString;
|
|
522
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
523
|
+
content_blocks: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
524
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
525
|
+
}, z.core.$strip>>>;
|
|
526
|
+
}, z.core.$strip>;
|
|
527
|
+
type KeptMessage = z.infer<typeof KeptMessageSchema>;
|
|
528
|
+
/** Conversation-layer tool blocks (camelCase) → persisted records (snake_case); empty values are omitted. */
|
|
529
|
+
declare function toolUsesToRecords(toolUses?: {
|
|
530
|
+
toolUseId: string;
|
|
531
|
+
toolName: string;
|
|
532
|
+
arguments?: Record<string, unknown>;
|
|
533
|
+
providerItemId?: string;
|
|
534
|
+
}[]): ToolUseRecord[];
|
|
535
|
+
declare function toolResultsToRecords(toolResults?: ToolResultBlock[]): ToolResultRecord[];
|
|
536
|
+
declare const CompactBoundaryPayloadSchema: z.ZodObject<{
|
|
537
|
+
summary: z.ZodString;
|
|
538
|
+
keep: z.ZodArray<z.ZodObject<{
|
|
539
|
+
role: z.ZodString;
|
|
540
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
541
|
+
tool_uses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
542
|
+
tool_use_id: z.ZodString;
|
|
543
|
+
tool_name: z.ZodString;
|
|
544
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
545
|
+
provider_item_id: z.ZodOptional<z.ZodString>;
|
|
546
|
+
}, z.core.$strip>>>;
|
|
547
|
+
tool_results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
548
|
+
tool_use_id: z.ZodString;
|
|
549
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
550
|
+
content_blocks: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
551
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
552
|
+
}, z.core.$strip>>>;
|
|
553
|
+
}, z.core.$strip>>;
|
|
554
|
+
}, z.core.$strip>;
|
|
555
|
+
type CompactBoundaryPayload = z.infer<typeof CompactBoundaryPayloadSchema>;
|
|
556
|
+
interface SessionInfo {
|
|
557
|
+
id: string;
|
|
558
|
+
firstMessage: string;
|
|
559
|
+
messageCount: number;
|
|
560
|
+
size: number;
|
|
561
|
+
modTime: Date;
|
|
562
|
+
}
|
|
563
|
+
declare function getSessionFilePath(workDir: string, sessionId: string): string;
|
|
564
|
+
declare function newSessionId(): string;
|
|
565
|
+
declare function saveMessage(workDir: string, sessionId: string, msg: SessionMessage): void;
|
|
566
|
+
declare function saveCompactBoundary(workDir: string, sessionId: string, payload: CompactBoundaryPayload): void;
|
|
567
|
+
declare function loadSession(workDir: string, sessionId: string): SessionMessage[];
|
|
568
|
+
interface RestoredMessage {
|
|
569
|
+
role: "user" | "assistant";
|
|
570
|
+
content: string | Record<string, unknown>[];
|
|
571
|
+
toolUses?: {
|
|
572
|
+
toolUseId: string;
|
|
573
|
+
toolName: string;
|
|
574
|
+
arguments?: Record<string, unknown>;
|
|
575
|
+
providerItemId?: string;
|
|
576
|
+
}[];
|
|
577
|
+
toolResults?: ToolResultBlock[];
|
|
578
|
+
}
|
|
579
|
+
declare function rebuildFromSession(saved: SessionMessage[]): RestoredMessage[];
|
|
580
|
+
declare function listSessions(workDir: string): SessionInfo[];
|
|
581
|
+
/**
|
|
582
|
+
* Cleans up expired sessions: deletes .jsonl files whose last modified time exceeds SESSION_EXPIRY_DAYS.
|
|
583
|
+
* Called during listSessions or on startup to prevent the session directory from growing indefinitely.
|
|
584
|
+
* Silently skips failures (best-effort).
|
|
585
|
+
*/
|
|
586
|
+
declare function cleanExpiredSessions(workDir: string): number;
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Copyright (c) 2026 hangtiancheng
|
|
590
|
+
*
|
|
591
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
592
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
593
|
+
* in the Software without restriction, including without limitation the rights
|
|
594
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
595
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
596
|
+
* furnished to do so, subject to the following conditions:
|
|
597
|
+
*
|
|
598
|
+
* The above copyright notice and this permission notice shall be included in
|
|
599
|
+
* all copies or substantial portions of the Software.
|
|
600
|
+
*
|
|
601
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
602
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
603
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
604
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
605
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
606
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
607
|
+
* SOFTWARE.
|
|
608
|
+
*/
|
|
609
|
+
|
|
610
|
+
type AgentEvent = {
|
|
611
|
+
type: "stream_text";
|
|
612
|
+
text: string;
|
|
613
|
+
} | {
|
|
614
|
+
type: "thinking_text";
|
|
615
|
+
text: string;
|
|
616
|
+
} | {
|
|
617
|
+
type: "thinking_complete";
|
|
618
|
+
thinking: string;
|
|
619
|
+
signature: string;
|
|
620
|
+
} | {
|
|
621
|
+
type: "tool_use";
|
|
622
|
+
toolName: string;
|
|
623
|
+
toolId: string;
|
|
624
|
+
args: Record<string, unknown>;
|
|
625
|
+
} | {
|
|
626
|
+
type: "tool_result";
|
|
627
|
+
toolName: string;
|
|
628
|
+
toolId: string;
|
|
629
|
+
output: string;
|
|
630
|
+
contentBlocks?: ToolResultContentBlock[];
|
|
631
|
+
isError: boolean;
|
|
632
|
+
elapsed: number;
|
|
633
|
+
} | {
|
|
634
|
+
type: "turn_complete";
|
|
635
|
+
} | {
|
|
636
|
+
type: "loop_complete";
|
|
637
|
+
stopReason: string;
|
|
638
|
+
} | {
|
|
639
|
+
type: "usage";
|
|
640
|
+
usage: UsageInfo;
|
|
641
|
+
} | {
|
|
642
|
+
type: "error";
|
|
643
|
+
error: Error;
|
|
644
|
+
} | {
|
|
645
|
+
type: "compact";
|
|
646
|
+
message: string;
|
|
647
|
+
boundary?: CompactBoundaryPayload | undefined;
|
|
648
|
+
} | {
|
|
649
|
+
type: "retry";
|
|
650
|
+
reason: string;
|
|
651
|
+
delay: number;
|
|
652
|
+
} | {
|
|
653
|
+
type: "permission_request";
|
|
654
|
+
toolName: string;
|
|
655
|
+
args: Record<string, unknown>;
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Copyright (c) 2026 hangtiancheng
|
|
660
|
+
*
|
|
661
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
662
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
663
|
+
* in the Software without restriction, including without limitation the rights
|
|
664
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
665
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
666
|
+
* furnished to do so, subject to the following conditions:
|
|
667
|
+
*
|
|
668
|
+
* The above copyright notice and this permission notice shall be included in
|
|
669
|
+
* all copies or substantial portions of the Software.
|
|
670
|
+
*
|
|
671
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
672
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
673
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
674
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
675
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
676
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
677
|
+
* SOFTWARE.
|
|
678
|
+
*/
|
|
679
|
+
interface FileReadRecord {
|
|
680
|
+
path: string;
|
|
681
|
+
content: string;
|
|
682
|
+
timestamp: number;
|
|
683
|
+
}
|
|
684
|
+
interface SkillInvocationRecord {
|
|
685
|
+
name: string;
|
|
686
|
+
body: string;
|
|
687
|
+
timestamp: number;
|
|
688
|
+
}
|
|
689
|
+
declare class RecoveryState {
|
|
690
|
+
private files;
|
|
691
|
+
private skills;
|
|
692
|
+
recordFileRead(path: string, content: string): void;
|
|
693
|
+
recordSkillInvocation(name: string, body: string): void;
|
|
694
|
+
snapshotFiles(limit?: number): FileReadRecord[];
|
|
695
|
+
snapshotSkills(): SkillInvocationRecord[];
|
|
696
|
+
buildRecoveryAttachment(toolSchemaNames: string[]): string;
|
|
697
|
+
}
|
|
698
|
+
|
|
424
699
|
/**
|
|
425
700
|
* Copyright (c) 2026 hangtiancheng
|
|
426
701
|
*
|
|
@@ -455,7 +730,7 @@ declare function globalConfigPath(): string;
|
|
|
455
730
|
*/
|
|
456
731
|
declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
457
732
|
type ThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
458
|
-
declare const ReasoningEffortSchema: z.ZodEnum<{
|
|
733
|
+
declare const ReasoningEffortSchema: z$1.ZodEnum<{
|
|
459
734
|
minimal: "minimal";
|
|
460
735
|
low: "low";
|
|
461
736
|
medium: "medium";
|
|
@@ -464,24 +739,24 @@ declare const ReasoningEffortSchema: z.ZodEnum<{
|
|
|
464
739
|
max: "max";
|
|
465
740
|
none: "none";
|
|
466
741
|
}>;
|
|
467
|
-
declare const AnthropicEffortSchema: z.ZodEnum<{
|
|
742
|
+
declare const AnthropicEffortSchema: z$1.ZodEnum<{
|
|
468
743
|
low: "low";
|
|
469
744
|
medium: "medium";
|
|
470
745
|
high: "high";
|
|
471
746
|
xhigh: "xhigh";
|
|
472
747
|
max: "max";
|
|
473
748
|
}>;
|
|
474
|
-
declare const ProviderConfigSchema: z.ZodObject<{
|
|
475
|
-
name: z.ZodString;
|
|
476
|
-
protocol: z.ZodEnum<{
|
|
749
|
+
declare const ProviderConfigSchema: z$1.ZodObject<{
|
|
750
|
+
name: z$1.ZodString;
|
|
751
|
+
protocol: z$1.ZodEnum<{
|
|
477
752
|
anthropic: "anthropic";
|
|
478
753
|
openai: "openai";
|
|
479
754
|
"openai-compat": "openai-compat";
|
|
480
755
|
}>;
|
|
481
|
-
base_url: z.ZodString;
|
|
482
|
-
model: z.ZodString;
|
|
483
|
-
api_key: z.ZodOptional<z.ZodString>;
|
|
484
|
-
thinking: z.ZodOptional<z.ZodEnum<{
|
|
756
|
+
base_url: z$1.ZodString;
|
|
757
|
+
model: z$1.ZodString;
|
|
758
|
+
api_key: z$1.ZodOptional<z$1.ZodString>;
|
|
759
|
+
thinking: z$1.ZodOptional<z$1.ZodEnum<{
|
|
485
760
|
off: "off";
|
|
486
761
|
minimal: "minimal";
|
|
487
762
|
low: "low";
|
|
@@ -490,10 +765,10 @@ declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
490
765
|
xhigh: "xhigh";
|
|
491
766
|
max: "max";
|
|
492
767
|
}>>;
|
|
493
|
-
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
494
|
-
thinking_level_map: z.ZodOptional<z.ZodObject<{
|
|
495
|
-
off: z.ZodOptional<z.ZodNullable<z.ZodLiteral<"none">>>;
|
|
496
|
-
minimal: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
768
|
+
reasoning: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
769
|
+
thinking_level_map: z$1.ZodOptional<z$1.ZodObject<{
|
|
770
|
+
off: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodLiteral<"none">>>;
|
|
771
|
+
minimal: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
497
772
|
minimal: "minimal";
|
|
498
773
|
low: "low";
|
|
499
774
|
medium: "medium";
|
|
@@ -502,7 +777,7 @@ declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
502
777
|
max: "max";
|
|
503
778
|
none: "none";
|
|
504
779
|
}>>>;
|
|
505
|
-
low: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
780
|
+
low: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
506
781
|
minimal: "minimal";
|
|
507
782
|
low: "low";
|
|
508
783
|
medium: "medium";
|
|
@@ -511,7 +786,7 @@ declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
511
786
|
max: "max";
|
|
512
787
|
none: "none";
|
|
513
788
|
}>>>;
|
|
514
|
-
medium: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
789
|
+
medium: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
515
790
|
minimal: "minimal";
|
|
516
791
|
low: "low";
|
|
517
792
|
medium: "medium";
|
|
@@ -520,7 +795,7 @@ declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
520
795
|
max: "max";
|
|
521
796
|
none: "none";
|
|
522
797
|
}>>>;
|
|
523
|
-
high: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
798
|
+
high: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
524
799
|
minimal: "minimal";
|
|
525
800
|
low: "low";
|
|
526
801
|
medium: "medium";
|
|
@@ -529,7 +804,7 @@ declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
529
804
|
max: "max";
|
|
530
805
|
none: "none";
|
|
531
806
|
}>>>;
|
|
532
|
-
xhigh: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
807
|
+
xhigh: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
533
808
|
minimal: "minimal";
|
|
534
809
|
low: "low";
|
|
535
810
|
medium: "medium";
|
|
@@ -538,7 +813,7 @@ declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
538
813
|
max: "max";
|
|
539
814
|
none: "none";
|
|
540
815
|
}>>>;
|
|
541
|
-
max: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
816
|
+
max: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
542
817
|
minimal: "minimal";
|
|
543
818
|
low: "low";
|
|
544
819
|
medium: "medium";
|
|
@@ -547,15 +822,15 @@ declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
547
822
|
max: "max";
|
|
548
823
|
none: "none";
|
|
549
824
|
}>>>;
|
|
550
|
-
}, z.core.$strict>>;
|
|
551
|
-
thinking_mode: z.ZodOptional<z.ZodEnum<{
|
|
825
|
+
}, z$1.core.$strict>>;
|
|
826
|
+
thinking_mode: z$1.ZodOptional<z$1.ZodEnum<{
|
|
552
827
|
budget: "budget";
|
|
553
828
|
adaptive: "adaptive";
|
|
554
829
|
}>>;
|
|
555
|
-
context_window: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
556
|
-
max_output_tokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
557
|
-
}, z.core.$loose>;
|
|
558
|
-
type ProviderConfig = z.infer<typeof ProviderConfigSchema>;
|
|
830
|
+
context_window: z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>;
|
|
831
|
+
max_output_tokens: z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>;
|
|
832
|
+
}, z$1.core.$loose>;
|
|
833
|
+
type ProviderConfig = z$1.infer<typeof ProviderConfigSchema>;
|
|
559
834
|
declare const DEFAULT_THINKING_LEVEL: ThinkingLevel;
|
|
560
835
|
declare const DEFAULT_CONTEXT_WINDOW = 1000000;
|
|
561
836
|
/**
|
|
@@ -577,9 +852,9 @@ declare function getThinkingLevel(provider: ProviderConfig): ThinkingLevel;
|
|
|
577
852
|
/** Thinking token budget for a level; 0 when thinking is off. */
|
|
578
853
|
declare function thinkingBudgetForLevel(level: ThinkingLevel): number;
|
|
579
854
|
/** Map a logical level using configured capabilities, not model-name guesses. */
|
|
580
|
-
declare function toReasoningEffort(level: ThinkingLevel, provider?: ProviderConfig): z.infer<typeof ReasoningEffortSchema> | null;
|
|
855
|
+
declare function toReasoningEffort(level: ThinkingLevel, provider?: ProviderConfig): z$1.infer<typeof ReasoningEffortSchema> | null;
|
|
581
856
|
/** Narrow adaptive efforts to the Anthropic SDK's legal values. */
|
|
582
|
-
declare function toAnthropicThinkingEffort(level: ThinkingLevel, provider: ProviderConfig): z.infer<typeof AnthropicEffortSchema> | null;
|
|
857
|
+
declare function toAnthropicThinkingEffort(level: ThinkingLevel, provider: ProviderConfig): z$1.infer<typeof AnthropicEffortSchema> | null;
|
|
583
858
|
/** Available logical levels; missing metadata preserves the existing defaults. */
|
|
584
859
|
declare function getSupportedThinkingLevels(provider: ProviderConfig): readonly ThinkingLevel[];
|
|
585
860
|
/** Lower unsupported requests to the nearest available level, never higher. */
|
|
@@ -594,51 +869,51 @@ declare function getContextWindow(provider: ProviderConfig): number;
|
|
|
594
869
|
*/
|
|
595
870
|
declare function getMaxOutputTokens(provider: ProviderConfig): number;
|
|
596
871
|
declare function resolveAPIKey(p: ProviderConfig): string;
|
|
597
|
-
declare const MCPServerConfigSchema: z.ZodObject<{
|
|
598
|
-
name: z.ZodString;
|
|
599
|
-
command: z.ZodOptional<z.ZodString>;
|
|
600
|
-
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
601
|
-
url: z.ZodOptional<z.ZodString>;
|
|
602
|
-
transport: z.ZodOptional<z.ZodString>;
|
|
603
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
604
|
-
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
605
|
-
}, z.core.$strip>;
|
|
606
|
-
type MCPServerConfig = z.infer<typeof MCPServerConfigSchema>;
|
|
607
|
-
declare const HookConfigSchema: z.ZodObject<{
|
|
608
|
-
id: z.ZodOptional<z.ZodString>;
|
|
609
|
-
event: z.ZodString;
|
|
610
|
-
condition: z.ZodOptional<z.ZodString>;
|
|
611
|
-
action: z.ZodObject<{
|
|
612
|
-
type: z.ZodString;
|
|
613
|
-
command: z.ZodOptional<z.ZodString>;
|
|
614
|
-
url: z.ZodOptional<z.ZodString>;
|
|
615
|
-
method: z.ZodOptional<z.ZodString>;
|
|
616
|
-
prompt: z.ZodOptional<z.ZodString>;
|
|
617
|
-
}, z.core.$strip>;
|
|
618
|
-
reject: z.ZodOptional<z.ZodBoolean>;
|
|
619
|
-
once: z.ZodOptional<z.ZodBoolean>;
|
|
620
|
-
async: z.ZodOptional<z.ZodBoolean>;
|
|
621
|
-
on_error: z.ZodOptional<z.ZodString>;
|
|
622
|
-
}, z.core.$strip>;
|
|
623
|
-
type HookConfig = z.infer<typeof HookConfigSchema>;
|
|
624
|
-
declare const SandboxYamlConfigSchema: z.ZodObject<{
|
|
625
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
626
|
-
auto_allow: z.ZodOptional<z.ZodBoolean>;
|
|
627
|
-
network_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
628
|
-
}, z.core.$strip>;
|
|
629
|
-
type SandboxYamlConfig = z.infer<typeof SandboxYamlConfigSchema>;
|
|
630
|
-
declare const AppConfigSchema: z.ZodObject<{
|
|
631
|
-
providers: z.ZodArray<z.ZodObject<{
|
|
632
|
-
name: z.ZodString;
|
|
633
|
-
protocol: z.ZodEnum<{
|
|
872
|
+
declare const MCPServerConfigSchema: z$1.ZodObject<{
|
|
873
|
+
name: z$1.ZodString;
|
|
874
|
+
command: z$1.ZodOptional<z$1.ZodString>;
|
|
875
|
+
args: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
876
|
+
url: z$1.ZodOptional<z$1.ZodString>;
|
|
877
|
+
transport: z$1.ZodOptional<z$1.ZodString>;
|
|
878
|
+
headers: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
879
|
+
env: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
880
|
+
}, z$1.core.$strip>;
|
|
881
|
+
type MCPServerConfig = z$1.infer<typeof MCPServerConfigSchema>;
|
|
882
|
+
declare const HookConfigSchema: z$1.ZodObject<{
|
|
883
|
+
id: z$1.ZodOptional<z$1.ZodString>;
|
|
884
|
+
event: z$1.ZodString;
|
|
885
|
+
condition: z$1.ZodOptional<z$1.ZodString>;
|
|
886
|
+
action: z$1.ZodObject<{
|
|
887
|
+
type: z$1.ZodString;
|
|
888
|
+
command: z$1.ZodOptional<z$1.ZodString>;
|
|
889
|
+
url: z$1.ZodOptional<z$1.ZodString>;
|
|
890
|
+
method: z$1.ZodOptional<z$1.ZodString>;
|
|
891
|
+
prompt: z$1.ZodOptional<z$1.ZodString>;
|
|
892
|
+
}, z$1.core.$strip>;
|
|
893
|
+
reject: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
894
|
+
once: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
895
|
+
async: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
896
|
+
on_error: z$1.ZodOptional<z$1.ZodString>;
|
|
897
|
+
}, z$1.core.$strip>;
|
|
898
|
+
type HookConfig = z$1.infer<typeof HookConfigSchema>;
|
|
899
|
+
declare const SandboxYamlConfigSchema: z$1.ZodObject<{
|
|
900
|
+
enabled: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
901
|
+
auto_allow: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
902
|
+
network_enabled: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
903
|
+
}, z$1.core.$strip>;
|
|
904
|
+
type SandboxYamlConfig = z$1.infer<typeof SandboxYamlConfigSchema>;
|
|
905
|
+
declare const AppConfigSchema: z$1.ZodObject<{
|
|
906
|
+
providers: z$1.ZodArray<z$1.ZodObject<{
|
|
907
|
+
name: z$1.ZodString;
|
|
908
|
+
protocol: z$1.ZodEnum<{
|
|
634
909
|
anthropic: "anthropic";
|
|
635
910
|
openai: "openai";
|
|
636
911
|
"openai-compat": "openai-compat";
|
|
637
912
|
}>;
|
|
638
|
-
base_url: z.ZodString;
|
|
639
|
-
model: z.ZodString;
|
|
640
|
-
api_key: z.ZodOptional<z.ZodString>;
|
|
641
|
-
thinking: z.ZodOptional<z.ZodEnum<{
|
|
913
|
+
base_url: z$1.ZodString;
|
|
914
|
+
model: z$1.ZodString;
|
|
915
|
+
api_key: z$1.ZodOptional<z$1.ZodString>;
|
|
916
|
+
thinking: z$1.ZodOptional<z$1.ZodEnum<{
|
|
642
917
|
off: "off";
|
|
643
918
|
minimal: "minimal";
|
|
644
919
|
low: "low";
|
|
@@ -647,10 +922,10 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
647
922
|
xhigh: "xhigh";
|
|
648
923
|
max: "max";
|
|
649
924
|
}>>;
|
|
650
|
-
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
651
|
-
thinking_level_map: z.ZodOptional<z.ZodObject<{
|
|
652
|
-
off: z.ZodOptional<z.ZodNullable<z.ZodLiteral<"none">>>;
|
|
653
|
-
minimal: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
925
|
+
reasoning: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
926
|
+
thinking_level_map: z$1.ZodOptional<z$1.ZodObject<{
|
|
927
|
+
off: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodLiteral<"none">>>;
|
|
928
|
+
minimal: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
654
929
|
minimal: "minimal";
|
|
655
930
|
low: "low";
|
|
656
931
|
medium: "medium";
|
|
@@ -659,7 +934,7 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
659
934
|
max: "max";
|
|
660
935
|
none: "none";
|
|
661
936
|
}>>>;
|
|
662
|
-
low: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
937
|
+
low: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
663
938
|
minimal: "minimal";
|
|
664
939
|
low: "low";
|
|
665
940
|
medium: "medium";
|
|
@@ -668,7 +943,7 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
668
943
|
max: "max";
|
|
669
944
|
none: "none";
|
|
670
945
|
}>>>;
|
|
671
|
-
medium: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
946
|
+
medium: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
672
947
|
minimal: "minimal";
|
|
673
948
|
low: "low";
|
|
674
949
|
medium: "medium";
|
|
@@ -677,7 +952,7 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
677
952
|
max: "max";
|
|
678
953
|
none: "none";
|
|
679
954
|
}>>>;
|
|
680
|
-
high: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
955
|
+
high: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
681
956
|
minimal: "minimal";
|
|
682
957
|
low: "low";
|
|
683
958
|
medium: "medium";
|
|
@@ -686,7 +961,7 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
686
961
|
max: "max";
|
|
687
962
|
none: "none";
|
|
688
963
|
}>>>;
|
|
689
|
-
xhigh: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
964
|
+
xhigh: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
690
965
|
minimal: "minimal";
|
|
691
966
|
low: "low";
|
|
692
967
|
medium: "medium";
|
|
@@ -695,7 +970,7 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
695
970
|
max: "max";
|
|
696
971
|
none: "none";
|
|
697
972
|
}>>>;
|
|
698
|
-
max: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
973
|
+
max: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
699
974
|
minimal: "minimal";
|
|
700
975
|
low: "low";
|
|
701
976
|
medium: "medium";
|
|
@@ -704,51 +979,51 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
704
979
|
max: "max";
|
|
705
980
|
none: "none";
|
|
706
981
|
}>>>;
|
|
707
|
-
}, z.core.$strict>>;
|
|
708
|
-
thinking_mode: z.ZodOptional<z.ZodEnum<{
|
|
982
|
+
}, z$1.core.$strict>>;
|
|
983
|
+
thinking_mode: z$1.ZodOptional<z$1.ZodEnum<{
|
|
709
984
|
budget: "budget";
|
|
710
985
|
adaptive: "adaptive";
|
|
711
986
|
}>>;
|
|
712
|
-
context_window: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
713
|
-
max_output_tokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
714
|
-
}, z.core.$loose>>;
|
|
715
|
-
permission_mode: z.ZodOptional<z.ZodString>;
|
|
716
|
-
mcp_servers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
717
|
-
name: z.ZodString;
|
|
718
|
-
command: z.ZodOptional<z.ZodString>;
|
|
719
|
-
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
720
|
-
url: z.ZodOptional<z.ZodString>;
|
|
721
|
-
transport: z.ZodOptional<z.ZodString>;
|
|
722
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
723
|
-
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
724
|
-
}, z.core.$strip>>>;
|
|
725
|
-
hooks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
726
|
-
id: z.ZodOptional<z.ZodString>;
|
|
727
|
-
event: z.ZodString;
|
|
728
|
-
condition: z.ZodOptional<z.ZodString>;
|
|
729
|
-
action: z.ZodObject<{
|
|
730
|
-
type: z.ZodString;
|
|
731
|
-
command: z.ZodOptional<z.ZodString>;
|
|
732
|
-
url: z.ZodOptional<z.ZodString>;
|
|
733
|
-
method: z.ZodOptional<z.ZodString>;
|
|
734
|
-
prompt: z.ZodOptional<z.ZodString>;
|
|
735
|
-
}, z.core.$strip>;
|
|
736
|
-
reject: z.ZodOptional<z.ZodBoolean>;
|
|
737
|
-
once: z.ZodOptional<z.ZodBoolean>;
|
|
738
|
-
async: z.ZodOptional<z.ZodBoolean>;
|
|
739
|
-
on_error: z.ZodOptional<z.ZodString>;
|
|
740
|
-
}, z.core.$strip>>>;
|
|
741
|
-
sandbox: z.ZodOptional<z.ZodObject<{
|
|
742
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
743
|
-
auto_allow: z.ZodOptional<z.ZodBoolean>;
|
|
744
|
-
network_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
745
|
-
}, z.core.$strip>>;
|
|
746
|
-
enable_coordinator_mode: z.ZodOptional<z.ZodBoolean>;
|
|
747
|
-
enable_fork: z.ZodOptional<z.ZodBoolean>;
|
|
748
|
-
}, z.core.$loose>;
|
|
987
|
+
context_window: z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>;
|
|
988
|
+
max_output_tokens: z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>;
|
|
989
|
+
}, z$1.core.$loose>>;
|
|
990
|
+
permission_mode: z$1.ZodOptional<z$1.ZodString>;
|
|
991
|
+
mcp_servers: z$1.ZodDefault<z$1.ZodArray<z$1.ZodObject<{
|
|
992
|
+
name: z$1.ZodString;
|
|
993
|
+
command: z$1.ZodOptional<z$1.ZodString>;
|
|
994
|
+
args: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
995
|
+
url: z$1.ZodOptional<z$1.ZodString>;
|
|
996
|
+
transport: z$1.ZodOptional<z$1.ZodString>;
|
|
997
|
+
headers: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
998
|
+
env: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
999
|
+
}, z$1.core.$strip>>>;
|
|
1000
|
+
hooks: z$1.ZodDefault<z$1.ZodArray<z$1.ZodObject<{
|
|
1001
|
+
id: z$1.ZodOptional<z$1.ZodString>;
|
|
1002
|
+
event: z$1.ZodString;
|
|
1003
|
+
condition: z$1.ZodOptional<z$1.ZodString>;
|
|
1004
|
+
action: z$1.ZodObject<{
|
|
1005
|
+
type: z$1.ZodString;
|
|
1006
|
+
command: z$1.ZodOptional<z$1.ZodString>;
|
|
1007
|
+
url: z$1.ZodOptional<z$1.ZodString>;
|
|
1008
|
+
method: z$1.ZodOptional<z$1.ZodString>;
|
|
1009
|
+
prompt: z$1.ZodOptional<z$1.ZodString>;
|
|
1010
|
+
}, z$1.core.$strip>;
|
|
1011
|
+
reject: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1012
|
+
once: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1013
|
+
async: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1014
|
+
on_error: z$1.ZodOptional<z$1.ZodString>;
|
|
1015
|
+
}, z$1.core.$strip>>>;
|
|
1016
|
+
sandbox: z$1.ZodOptional<z$1.ZodObject<{
|
|
1017
|
+
enabled: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1018
|
+
auto_allow: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1019
|
+
network_enabled: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1020
|
+
}, z$1.core.$strip>>;
|
|
1021
|
+
enable_coordinator_mode: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1022
|
+
enable_fork: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1023
|
+
}, z$1.core.$loose>;
|
|
749
1024
|
/** Whether fork is available. Defaults to enabled when not specified in config. */
|
|
750
1025
|
declare function forkEnabled(cfg: AppConfig): boolean;
|
|
751
|
-
type AppConfig = z.infer<typeof AppConfigSchema>;
|
|
1026
|
+
type AppConfig = z$1.infer<typeof AppConfigSchema>;
|
|
752
1027
|
declare function loadConfig(path?: string, options?: {
|
|
753
1028
|
allowEmptyProviders?: boolean;
|
|
754
1029
|
}): AppConfig;
|
|
@@ -809,62 +1084,6 @@ declare class HookEngine {
|
|
|
809
1084
|
}
|
|
810
1085
|
declare function validate(hooks: HookConfig[]): Error | null;
|
|
811
1086
|
|
|
812
|
-
/**
|
|
813
|
-
* Copyright (c) 2026 hangtiancheng
|
|
814
|
-
*
|
|
815
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
816
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
817
|
-
* in the Software without restriction, including without limitation the rights
|
|
818
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
819
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
820
|
-
* furnished to do so, subject to the following conditions:
|
|
821
|
-
*
|
|
822
|
-
* The above copyright notice and this permission notice shall be included in
|
|
823
|
-
* all copies or substantial portions of the Software.
|
|
824
|
-
*
|
|
825
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
826
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
827
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
828
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
829
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
830
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
831
|
-
* SOFTWARE.
|
|
832
|
-
*/
|
|
833
|
-
interface UsageInfo {
|
|
834
|
-
inputTokens: number;
|
|
835
|
-
outputTokens: number;
|
|
836
|
-
cacheReadInputTokens: number;
|
|
837
|
-
cacheCreationInputTokens: number;
|
|
838
|
-
}
|
|
839
|
-
/** Tool use delta: Input partial JSON */
|
|
840
|
-
type StreamEvent = {
|
|
841
|
-
type: "text_delta";
|
|
842
|
-
text: string;
|
|
843
|
-
} | {
|
|
844
|
-
type: "thinking_delta";
|
|
845
|
-
text: string;
|
|
846
|
-
} | {
|
|
847
|
-
type: "thinking_complete";
|
|
848
|
-
thinking: string;
|
|
849
|
-
signature: string;
|
|
850
|
-
} | {
|
|
851
|
-
type: "tool_call_start";
|
|
852
|
-
toolName: string;
|
|
853
|
-
toolId: string;
|
|
854
|
-
} | {
|
|
855
|
-
type: "tool_call_delta";
|
|
856
|
-
text: string;
|
|
857
|
-
} | {
|
|
858
|
-
type: "tool_call_complete";
|
|
859
|
-
toolId: string;
|
|
860
|
-
toolName: string;
|
|
861
|
-
arguments: Record<string, unknown>;
|
|
862
|
-
} | {
|
|
863
|
-
type: "stream_end";
|
|
864
|
-
stopReason: string;
|
|
865
|
-
usage: UsageInfo;
|
|
866
|
-
};
|
|
867
|
-
|
|
868
1087
|
/**
|
|
869
1088
|
* Copyright (c) 2026 hangtiancheng
|
|
870
1089
|
*
|
|
@@ -888,6 +1107,7 @@ type StreamEvent = {
|
|
|
888
1107
|
*/
|
|
889
1108
|
|
|
890
1109
|
declare class OpenAIClient implements LLMClient {
|
|
1110
|
+
readonly protocol: "openai";
|
|
891
1111
|
private client;
|
|
892
1112
|
private model;
|
|
893
1113
|
private systemPrompt;
|
|
@@ -895,16 +1115,17 @@ declare class OpenAIClient implements LLMClient {
|
|
|
895
1115
|
private thinkingLevel;
|
|
896
1116
|
private config;
|
|
897
1117
|
constructor(config: ProviderConfig, systemPrompt: string);
|
|
898
|
-
stream(conversation: ConversationManager, toolSchemas:
|
|
1118
|
+
stream(conversation: ConversationManager, toolSchemas: ProviderToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
899
1119
|
setSystemPrompt(prompt: string): void;
|
|
900
1120
|
setMaxOutputTokens(maxTokens: number): void;
|
|
901
1121
|
setThinkingLevel(level: ThinkingLevel): ThinkingLevel;
|
|
902
1122
|
getThinkingLevel(): ThinkingLevel;
|
|
903
1123
|
getSupportedThinkingLevels(): readonly ThinkingLevel[];
|
|
904
1124
|
}
|
|
905
|
-
type OpenAIMessageParam = OpenAI.Responses.EasyInputMessage | OpenAI.Responses.ResponseFunctionToolCall | OpenAI.Responses.ResponseInputItem.FunctionCallOutput | OpenAI.Responses.ResponseReasoningItem;
|
|
1125
|
+
type OpenAIMessageParam = OpenAI.Responses.EasyInputMessage | OpenAI.Responses.ResponseComputerToolCall | OpenAI.Responses.ResponseInputItem.ComputerCallOutput | OpenAI.Responses.ResponseFunctionToolCall | OpenAI.Responses.ResponseInputItem.FunctionCallOutput | OpenAI.Responses.ResponseReasoningItem;
|
|
906
1126
|
declare function buildOpenAIInput(messages: Message[]): OpenAIMessageParam[];
|
|
907
1127
|
declare class OpenAICompatClient implements LLMClient {
|
|
1128
|
+
readonly protocol: "openai-compat";
|
|
908
1129
|
private client;
|
|
909
1130
|
private model;
|
|
910
1131
|
private systemPrompt;
|
|
@@ -917,7 +1138,7 @@ declare class OpenAICompatClient implements LLMClient {
|
|
|
917
1138
|
setThinkingLevel(level: ThinkingLevel): ThinkingLevel;
|
|
918
1139
|
getThinkingLevel(): ThinkingLevel;
|
|
919
1140
|
getSupportedThinkingLevels(): readonly ThinkingLevel[];
|
|
920
|
-
stream(conversation: ConversationManager, toolSchemas:
|
|
1141
|
+
stream(conversation: ConversationManager, toolSchemas: ProviderToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
921
1142
|
}
|
|
922
1143
|
declare function buildChatCompletionMessages(messages: Message[]): OpenAI.ChatCompletionMessageParam[];
|
|
923
1144
|
|
|
@@ -953,7 +1174,10 @@ declare function buildChatCompletionMessages(messages: Message[]): OpenAI.ChatCo
|
|
|
953
1174
|
* built-in tools, so the array tail is often a deferred tool — we must scan
|
|
954
1175
|
* backwards. Built-in tools are never deferred, so a valid slot always exists.
|
|
955
1176
|
*/
|
|
956
|
-
declare function markToolsForCache(tools:
|
|
1177
|
+
declare function markToolsForCache(tools: {
|
|
1178
|
+
defer_loading?: boolean;
|
|
1179
|
+
cache_control?: Anthropic.CacheControlEphemeral | null;
|
|
1180
|
+
}[]): void;
|
|
957
1181
|
/**
|
|
958
1182
|
* Whether any tool in this batch has defer_loading set.
|
|
959
1183
|
*
|
|
@@ -961,10 +1185,11 @@ declare function markToolsForCache(tools: Pick<Anthropic.Tool, "defer_loading" |
|
|
|
961
1185
|
* recognize it reject the request outright, and the dispatch / eager paths do not
|
|
962
1186
|
* use it at all.
|
|
963
1187
|
*/
|
|
964
|
-
declare function needsToolSearchBeta(toolSchemas:
|
|
1188
|
+
declare function needsToolSearchBeta(toolSchemas: ProviderToolSchema[]): boolean;
|
|
965
1189
|
declare function fetchModelContextWindow(config: ProviderConfig): Promise<number>;
|
|
966
1190
|
declare function buildAnthropicMessages(messages: Message[]): Anthropic.MessageParam[];
|
|
967
1191
|
declare class AnthropicClient implements LLMClient {
|
|
1192
|
+
readonly protocol: "anthropic";
|
|
968
1193
|
private client;
|
|
969
1194
|
private model;
|
|
970
1195
|
/** Effective logical level for budget or explicitly configured adaptive mode. */
|
|
@@ -978,7 +1203,7 @@ declare class AnthropicClient implements LLMClient {
|
|
|
978
1203
|
setThinkingLevel(level: ThinkingLevel): ThinkingLevel;
|
|
979
1204
|
getThinkingLevel(): ThinkingLevel;
|
|
980
1205
|
getSupportedThinkingLevels(): readonly ThinkingLevel[];
|
|
981
|
-
stream(conversation: ConversationManager, toolSchemas:
|
|
1206
|
+
stream(conversation: ConversationManager, toolSchemas: ProviderToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
982
1207
|
}
|
|
983
1208
|
/**
|
|
984
1209
|
* @param messages
|
|
@@ -986,7 +1211,8 @@ declare class AnthropicClient implements LLMClient {
|
|
|
986
1211
|
declare function markLastUserTailForCache(messages: Anthropic.Messages.MessageParam[]): void;
|
|
987
1212
|
|
|
988
1213
|
interface LLMClient extends Partial<MaxTokensSetter>, Partial<ThinkingLevelControl> {
|
|
989
|
-
|
|
1214
|
+
readonly protocol?: ToolProtocol;
|
|
1215
|
+
stream(conversationManager: ConversationManager, toolSchemas: ProviderToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
990
1216
|
setSystemPrompt(prompt: string): void;
|
|
991
1217
|
}
|
|
992
1218
|
interface MaxTokensSetter {
|
|
@@ -994,8 +1220,8 @@ interface MaxTokensSetter {
|
|
|
994
1220
|
}
|
|
995
1221
|
/** Runtime control of the effective logical thinking level. */
|
|
996
1222
|
interface ThinkingLevelControl {
|
|
997
|
-
/**
|
|
998
|
-
setThinkingLevel(level: ThinkingLevel): ThinkingLevel
|
|
1223
|
+
/** Applies the level and returns the effective one, which may be clamped by the provider. */
|
|
1224
|
+
setThinkingLevel(level: ThinkingLevel): ThinkingLevel;
|
|
999
1225
|
getThinkingLevel(): ThinkingLevel;
|
|
1000
1226
|
getSupportedThinkingLevels?(): readonly ThinkingLevel[];
|
|
1001
1227
|
}
|
|
@@ -1135,9 +1361,11 @@ declare class ToolRegistry {
|
|
|
1135
1361
|
register(tool: Tool): void;
|
|
1136
1362
|
get(name: string): Tool | undefined;
|
|
1137
1363
|
listTools(): Tool[];
|
|
1138
|
-
getAllSchemas(
|
|
1139
|
-
getAllSchemas(protocol: "
|
|
1140
|
-
getAllSchemas(protocol: "openai
|
|
1364
|
+
getAllSchemas(): ToolSchema[];
|
|
1365
|
+
getAllSchemas(protocol: "anthropic", filter?: (name: string) => boolean): AnthropicToolSchema[];
|
|
1366
|
+
getAllSchemas(protocol: "openai", filter?: (name: string) => boolean): OpenAIResponsesToolSchema[];
|
|
1367
|
+
getAllSchemas(protocol: "openai-compat", filter?: (name: string) => boolean): OpenAICompatToolSchema[];
|
|
1368
|
+
getAllSchemas(protocol: ToolProtocol, filter?: (name: string) => boolean): ProviderToolSchema[];
|
|
1141
1369
|
/**
|
|
1142
1370
|
* Names of deferred tools not yet discovered, in lexicographic order.
|
|
1143
1371
|
*
|
|
@@ -1153,206 +1381,6 @@ declare class ToolRegistry {
|
|
|
1153
1381
|
isDiscovered(name: string): boolean;
|
|
1154
1382
|
}
|
|
1155
1383
|
|
|
1156
|
-
/**
|
|
1157
|
-
* Copyright (c) 2026 hangtiancheng
|
|
1158
|
-
*
|
|
1159
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1160
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
1161
|
-
* in the Software without restriction, including without limitation the rights
|
|
1162
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1163
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
1164
|
-
* furnished to do so, subject to the following conditions:
|
|
1165
|
-
*
|
|
1166
|
-
* The above copyright notice and this permission notice shall be included in
|
|
1167
|
-
* all copies or substantial portions of the Software.
|
|
1168
|
-
*
|
|
1169
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1170
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1171
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1172
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1173
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1174
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1175
|
-
* SOFTWARE.
|
|
1176
|
-
*/
|
|
1177
|
-
|
|
1178
|
-
declare const COMPACT_BOUNDARY = "compact_boundary";
|
|
1179
|
-
/** Persisted form of a tool invocation. Stores a provider-agnostic internal representation rather than
|
|
1180
|
-
* any vendor-specific wire format, so sessions can be restored even after switching providers. */
|
|
1181
|
-
declare const ToolUseRecordSchema: z$1.ZodObject<{
|
|
1182
|
-
tool_use_id: z$1.ZodString;
|
|
1183
|
-
tool_name: z$1.ZodString;
|
|
1184
|
-
arguments: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1185
|
-
}, z$1.core.$strip>;
|
|
1186
|
-
type ToolUseRecord = z$1.infer<typeof ToolUseRecordSchema>;
|
|
1187
|
-
/** Persisted form of a tool result, paired with a ToolUseRecord via tool_use_id. */
|
|
1188
|
-
declare const ToolResultRecordSchema: z$1.ZodObject<{
|
|
1189
|
-
tool_use_id: z$1.ZodString;
|
|
1190
|
-
content: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>]>;
|
|
1191
|
-
content_blocks: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnknown>>;
|
|
1192
|
-
is_error: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1193
|
-
}, z$1.core.$strip>;
|
|
1194
|
-
type ToolResultRecord = z$1.infer<typeof ToolResultRecordSchema>;
|
|
1195
|
-
declare const SessionMessageSchema: z$1.ZodObject<{
|
|
1196
|
-
role: z$1.ZodString;
|
|
1197
|
-
content: z$1.ZodDefault<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>]>>;
|
|
1198
|
-
timestamp: z$1.ZodNumber;
|
|
1199
|
-
type: z$1.ZodOptional<z$1.ZodString>;
|
|
1200
|
-
tool_uses: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1201
|
-
tool_use_id: z$1.ZodString;
|
|
1202
|
-
tool_name: z$1.ZodString;
|
|
1203
|
-
arguments: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1204
|
-
}, z$1.core.$strip>>>;
|
|
1205
|
-
tool_results: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1206
|
-
tool_use_id: z$1.ZodString;
|
|
1207
|
-
content: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>]>;
|
|
1208
|
-
content_blocks: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnknown>>;
|
|
1209
|
-
is_error: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1210
|
-
}, z$1.core.$strip>>>;
|
|
1211
|
-
}, z$1.core.$strip>;
|
|
1212
|
-
type SessionMessage = z$1.infer<typeof SessionMessageSchema>;
|
|
1213
|
-
declare const KeptMessageSchema: z$1.ZodObject<{
|
|
1214
|
-
role: z$1.ZodString;
|
|
1215
|
-
content: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>]>;
|
|
1216
|
-
tool_uses: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1217
|
-
tool_use_id: z$1.ZodString;
|
|
1218
|
-
tool_name: z$1.ZodString;
|
|
1219
|
-
arguments: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1220
|
-
}, z$1.core.$strip>>>;
|
|
1221
|
-
tool_results: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1222
|
-
tool_use_id: z$1.ZodString;
|
|
1223
|
-
content: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>]>;
|
|
1224
|
-
content_blocks: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnknown>>;
|
|
1225
|
-
is_error: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1226
|
-
}, z$1.core.$strip>>>;
|
|
1227
|
-
}, z$1.core.$strip>;
|
|
1228
|
-
type KeptMessage = z$1.infer<typeof KeptMessageSchema>;
|
|
1229
|
-
/** Conversation-layer tool blocks (camelCase) → persisted records (snake_case); empty values are omitted. */
|
|
1230
|
-
declare function toolUsesToRecords(toolUses?: {
|
|
1231
|
-
toolUseId: string;
|
|
1232
|
-
toolName: string;
|
|
1233
|
-
arguments?: Record<string, unknown>;
|
|
1234
|
-
}[]): ToolUseRecord[];
|
|
1235
|
-
declare function toolResultsToRecords(toolResults?: ToolResultBlock[]): ToolResultRecord[];
|
|
1236
|
-
declare const CompactBoundaryPayloadSchema: z$1.ZodObject<{
|
|
1237
|
-
summary: z$1.ZodString;
|
|
1238
|
-
keep: z$1.ZodArray<z$1.ZodObject<{
|
|
1239
|
-
role: z$1.ZodString;
|
|
1240
|
-
content: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>]>;
|
|
1241
|
-
tool_uses: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1242
|
-
tool_use_id: z$1.ZodString;
|
|
1243
|
-
tool_name: z$1.ZodString;
|
|
1244
|
-
arguments: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1245
|
-
}, z$1.core.$strip>>>;
|
|
1246
|
-
tool_results: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1247
|
-
tool_use_id: z$1.ZodString;
|
|
1248
|
-
content: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>]>;
|
|
1249
|
-
content_blocks: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnknown>>;
|
|
1250
|
-
is_error: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1251
|
-
}, z$1.core.$strip>>>;
|
|
1252
|
-
}, z$1.core.$strip>>;
|
|
1253
|
-
}, z$1.core.$strip>;
|
|
1254
|
-
type CompactBoundaryPayload = z$1.infer<typeof CompactBoundaryPayloadSchema>;
|
|
1255
|
-
interface SessionInfo {
|
|
1256
|
-
id: string;
|
|
1257
|
-
firstMessage: string;
|
|
1258
|
-
messageCount: number;
|
|
1259
|
-
size: number;
|
|
1260
|
-
modTime: Date;
|
|
1261
|
-
}
|
|
1262
|
-
declare function getSessionFilePath(workDir: string, sessionId: string): string;
|
|
1263
|
-
declare function newSessionId(): string;
|
|
1264
|
-
declare function saveMessage(workDir: string, sessionId: string, msg: SessionMessage): void;
|
|
1265
|
-
declare function saveCompactBoundary(workDir: string, sessionId: string, payload: CompactBoundaryPayload): void;
|
|
1266
|
-
declare function loadSession(workDir: string, sessionId: string): SessionMessage[];
|
|
1267
|
-
interface RestoredMessage {
|
|
1268
|
-
role: "user" | "assistant";
|
|
1269
|
-
content: string | Record<string, unknown>[];
|
|
1270
|
-
toolUses?: {
|
|
1271
|
-
toolUseId: string;
|
|
1272
|
-
toolName: string;
|
|
1273
|
-
arguments?: Record<string, unknown>;
|
|
1274
|
-
}[];
|
|
1275
|
-
toolResults?: ToolResultBlock[];
|
|
1276
|
-
}
|
|
1277
|
-
declare function rebuildFromSession(saved: SessionMessage[]): RestoredMessage[];
|
|
1278
|
-
declare function listSessions(workDir: string): SessionInfo[];
|
|
1279
|
-
/**
|
|
1280
|
-
* Cleans up expired sessions: deletes .jsonl files whose last modified time exceeds SESSION_EXPIRY_DAYS.
|
|
1281
|
-
* Called during listSessions or on startup to prevent the session directory from growing indefinitely.
|
|
1282
|
-
* Silently skips failures (best-effort).
|
|
1283
|
-
*/
|
|
1284
|
-
declare function cleanExpiredSessions(workDir: string): number;
|
|
1285
|
-
|
|
1286
|
-
/**
|
|
1287
|
-
* Copyright (c) 2026 hangtiancheng
|
|
1288
|
-
*
|
|
1289
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1290
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
1291
|
-
* in the Software without restriction, including without limitation the rights
|
|
1292
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1293
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
1294
|
-
* furnished to do so, subject to the following conditions:
|
|
1295
|
-
*
|
|
1296
|
-
* The above copyright notice and this permission notice shall be included in
|
|
1297
|
-
* all copies or substantial portions of the Software.
|
|
1298
|
-
*
|
|
1299
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1300
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1301
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1302
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1303
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1304
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1305
|
-
* SOFTWARE.
|
|
1306
|
-
*/
|
|
1307
|
-
|
|
1308
|
-
type AgentEvent = {
|
|
1309
|
-
type: "stream_text";
|
|
1310
|
-
text: string;
|
|
1311
|
-
} | {
|
|
1312
|
-
type: "thinking_text";
|
|
1313
|
-
text: string;
|
|
1314
|
-
} | {
|
|
1315
|
-
type: "thinking_complete";
|
|
1316
|
-
thinking: string;
|
|
1317
|
-
signature: string;
|
|
1318
|
-
} | {
|
|
1319
|
-
type: "tool_use";
|
|
1320
|
-
toolName: string;
|
|
1321
|
-
toolId: string;
|
|
1322
|
-
args: Record<string, unknown>;
|
|
1323
|
-
} | {
|
|
1324
|
-
type: "tool_result";
|
|
1325
|
-
toolName: string;
|
|
1326
|
-
toolId: string;
|
|
1327
|
-
output: string;
|
|
1328
|
-
contentBlocks?: ToolResultContentBlock[];
|
|
1329
|
-
isError: boolean;
|
|
1330
|
-
elapsed: number;
|
|
1331
|
-
} | {
|
|
1332
|
-
type: "turn_complete";
|
|
1333
|
-
} | {
|
|
1334
|
-
type: "loop_complete";
|
|
1335
|
-
stopReason: string;
|
|
1336
|
-
} | {
|
|
1337
|
-
type: "usage";
|
|
1338
|
-
usage: UsageInfo;
|
|
1339
|
-
} | {
|
|
1340
|
-
type: "error";
|
|
1341
|
-
error: Error;
|
|
1342
|
-
} | {
|
|
1343
|
-
type: "compact";
|
|
1344
|
-
message: string;
|
|
1345
|
-
boundary?: CompactBoundaryPayload | undefined;
|
|
1346
|
-
} | {
|
|
1347
|
-
type: "retry";
|
|
1348
|
-
reason: string;
|
|
1349
|
-
delay: number;
|
|
1350
|
-
} | {
|
|
1351
|
-
type: "permission_request";
|
|
1352
|
-
toolName: string;
|
|
1353
|
-
args: Record<string, unknown>;
|
|
1354
|
-
};
|
|
1355
|
-
|
|
1356
1384
|
/**
|
|
1357
1385
|
* Copyright (c) 2026 hangtiancheng
|
|
1358
1386
|
*
|
|
@@ -1457,49 +1485,11 @@ declare class Agent {
|
|
|
1457
1485
|
* Persist the most recently appended conversation message to the session log.
|
|
1458
1486
|
*
|
|
1459
1487
|
* Persistence lives in the main loop rather than in individual frontends: both
|
|
1460
|
-
* the TUI and Web share the same recording path, ensuring intermediate assistant
|
|
1461
|
-
* text and complete tool-call chains are captured for session restoration.
|
|
1462
|
-
* Skipped when sessionId is empty (one-shot invocations, sub-agents).
|
|
1463
|
-
*/
|
|
1464
|
-
private persistLastMessage;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
/**
|
|
1468
|
-
* Copyright (c) 2026 hangtiancheng
|
|
1469
|
-
*
|
|
1470
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1471
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
1472
|
-
* in the Software without restriction, including without limitation the rights
|
|
1473
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1474
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
1475
|
-
* furnished to do so, subject to the following conditions:
|
|
1476
|
-
*
|
|
1477
|
-
* The above copyright notice and this permission notice shall be included in
|
|
1478
|
-
* all copies or substantial portions of the Software.
|
|
1479
|
-
*
|
|
1480
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1481
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1482
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1483
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1484
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1485
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1486
|
-
* SOFTWARE.
|
|
1487
|
-
*/
|
|
1488
|
-
|
|
1489
|
-
interface ExecutionResult {
|
|
1490
|
-
toolId: string;
|
|
1491
|
-
toolName: string;
|
|
1492
|
-
result: ToolResult;
|
|
1493
|
-
elapsed: number;
|
|
1494
|
-
}
|
|
1495
|
-
declare class StreamingExecutor {
|
|
1496
|
-
private pending;
|
|
1497
|
-
private registry;
|
|
1498
|
-
private ctx;
|
|
1499
|
-
constructor(registry: ToolRegistry, ctx: ToolContext);
|
|
1500
|
-
submit(toolId: string, toolName: string, args: Record<string, unknown>): void;
|
|
1501
|
-
collectResults(): Promise<ExecutionResult[]>;
|
|
1502
|
-
hasPending(): boolean;
|
|
1488
|
+
* the TUI and Web share the same recording path, ensuring intermediate assistant
|
|
1489
|
+
* text and complete tool-call chains are captured for session restoration.
|
|
1490
|
+
* Skipped when sessionId is empty (one-shot invocations, sub-agents).
|
|
1491
|
+
*/
|
|
1492
|
+
private persistLastMessage;
|
|
1503
1493
|
}
|
|
1504
1494
|
|
|
1505
1495
|
/**
|
|
@@ -1524,67 +1514,21 @@ declare class StreamingExecutor {
|
|
|
1524
1514
|
* SOFTWARE.
|
|
1525
1515
|
*/
|
|
1526
1516
|
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
registry?: unknown;
|
|
1533
|
-
/** Returns the current permission mode */
|
|
1534
|
-
permissionMode?: () => string;
|
|
1535
|
-
/** Returns token usage [input, output] */
|
|
1536
|
-
tokenCount?: () => [number, number];
|
|
1537
|
-
/** Returns the number of currently enabled tools */
|
|
1538
|
-
toolCount?: () => number;
|
|
1539
|
-
/** Returns the list of memories */
|
|
1540
|
-
memoryList?: () => string[];
|
|
1541
|
-
/** Clears all memories */
|
|
1542
|
-
memoryClear?: () => void;
|
|
1543
|
-
/** Returns the current model name */
|
|
1544
|
-
model?: string;
|
|
1545
|
-
/** Returns the current effective thinking level */
|
|
1546
|
-
thinkingLevel?: () => ThinkingLevel;
|
|
1547
|
-
/** Returns the active client's available logical thinking levels */
|
|
1548
|
-
availableThinkingLevels?: () => readonly ThinkingLevel[];
|
|
1549
|
-
/** Sets the thinking level for the active client */
|
|
1550
|
-
setThinkingLevel?: (level: ThinkingLevel) => void;
|
|
1551
|
-
/** Persists the thinking level to the global config; throws on failure */
|
|
1552
|
-
persistThinkingLevel?: (level: ThinkingLevel) => void;
|
|
1553
|
-
}
|
|
1554
|
-
interface Command {
|
|
1555
|
-
name: string;
|
|
1556
|
-
aliases: string[];
|
|
1557
|
-
type: CommandType;
|
|
1558
|
-
description: string;
|
|
1559
|
-
handler: (ctx: CommandContext) => string;
|
|
1560
|
-
}
|
|
1561
|
-
declare class CommandRegistry {
|
|
1562
|
-
private commands;
|
|
1563
|
-
/** Alias to command name */
|
|
1564
|
-
private aliasMap;
|
|
1565
|
-
/**
|
|
1566
|
-
* Registers a command, checking for name and alias conflicts.
|
|
1567
|
-
* The name must not conflict with existing command names or aliases;
|
|
1568
|
-
* aliases must not conflict with existing command names or other aliases.
|
|
1569
|
-
*/
|
|
1570
|
-
register(cmd: Command): void;
|
|
1571
|
-
/**
|
|
1572
|
-
* Checks if a command would conflict with already registered commands.
|
|
1573
|
-
* Dynamic loaders (e.g., for user-defined commands) should call this method
|
|
1574
|
-
* before `register` to filter out conflicting entries, as `register` throws
|
|
1575
|
-
* an exception on conflict.
|
|
1576
|
-
*/
|
|
1577
|
-
hasConflict(cmd: Command): boolean;
|
|
1578
|
-
find(name: string): Command | undefined;
|
|
1579
|
-
complete(prefix: string): Command[];
|
|
1580
|
-
listCommands(): Command[];
|
|
1517
|
+
interface ExecutionResult {
|
|
1518
|
+
toolId: string;
|
|
1519
|
+
toolName: string;
|
|
1520
|
+
result: ToolResult;
|
|
1521
|
+
elapsed: number;
|
|
1581
1522
|
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1523
|
+
declare class StreamingExecutor {
|
|
1524
|
+
private pending;
|
|
1525
|
+
private registry;
|
|
1526
|
+
private ctx;
|
|
1527
|
+
constructor(registry: ToolRegistry, ctx: ToolContext);
|
|
1528
|
+
submit(toolId: string, toolName: string, args: Record<string, unknown>): void;
|
|
1529
|
+
collectResults(): Promise<ExecutionResult[]>;
|
|
1530
|
+
hasPending(): boolean;
|
|
1585
1531
|
}
|
|
1586
|
-
declare function parse(input: string): Parsed | null;
|
|
1587
|
-
declare function createDefaultRegistry(): CommandRegistry;
|
|
1588
1532
|
|
|
1589
1533
|
/**
|
|
1590
1534
|
* Copyright (c) 2026 hangtiancheng
|
|
@@ -1608,16 +1552,16 @@ declare function createDefaultRegistry(): CommandRegistry;
|
|
|
1608
1552
|
* SOFTWARE.
|
|
1609
1553
|
*/
|
|
1610
1554
|
|
|
1611
|
-
declare const FileMailMessageSchema: z
|
|
1612
|
-
from: z
|
|
1613
|
-
text: z
|
|
1614
|
-
timestamp: z
|
|
1615
|
-
read: z
|
|
1616
|
-
type: z
|
|
1617
|
-
requestId: z
|
|
1618
|
-
approve: z
|
|
1619
|
-
}, z
|
|
1620
|
-
type FileMailMessage = z
|
|
1555
|
+
declare const FileMailMessageSchema: z.ZodObject<{
|
|
1556
|
+
from: z.ZodString;
|
|
1557
|
+
text: z.ZodString;
|
|
1558
|
+
timestamp: z.ZodString;
|
|
1559
|
+
read: z.ZodOptional<z.ZodBoolean>;
|
|
1560
|
+
type: z.ZodOptional<z.ZodString>;
|
|
1561
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
1562
|
+
approve: z.ZodOptional<z.ZodBoolean>;
|
|
1563
|
+
}, z.core.$strip>;
|
|
1564
|
+
type FileMailMessage = z.infer<typeof FileMailMessageSchema>;
|
|
1621
1565
|
declare class FileMailbox {
|
|
1622
1566
|
private filePath;
|
|
1623
1567
|
constructor(dir: string, memberName: string);
|
|
@@ -1657,56 +1601,56 @@ declare class FileMailbox {
|
|
|
1657
1601
|
* SOFTWARE.
|
|
1658
1602
|
*/
|
|
1659
1603
|
|
|
1660
|
-
declare const ToolActivitySchema: z.ZodObject<{
|
|
1661
|
-
toolName: z.ZodString;
|
|
1662
|
-
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1663
|
-
activityDescription: z.ZodString;
|
|
1664
|
-
}, z.core.$strip>;
|
|
1665
|
-
type ToolActivity = z.infer<typeof ToolActivitySchema>;
|
|
1666
|
-
declare const AgentProgressSchema: z.ZodObject<{
|
|
1667
|
-
toolUseCount: z.ZodNumber;
|
|
1668
|
-
tokenCount: z.ZodNumber;
|
|
1669
|
-
lastActivity: z.ZodOptional<z.ZodObject<{
|
|
1670
|
-
toolName: z.ZodString;
|
|
1671
|
-
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1672
|
-
activityDescription: z.ZodString;
|
|
1673
|
-
}, z.core.$strip>>;
|
|
1674
|
-
recentActivities: z.ZodArray<z.ZodObject<{
|
|
1675
|
-
toolName: z.ZodString;
|
|
1676
|
-
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1677
|
-
activityDescription: z.ZodString;
|
|
1678
|
-
}, z.core.$strip>>;
|
|
1679
|
-
}, z.core.$strip>;
|
|
1680
|
-
type AgentProgress = z.infer<typeof AgentProgressSchema>;
|
|
1681
|
-
declare const TeammateUIStateSchema: z.ZodObject<{
|
|
1682
|
-
name: z.ZodString;
|
|
1683
|
-
teamName: z.ZodString;
|
|
1684
|
-
status: z.ZodEnum<{
|
|
1604
|
+
declare const ToolActivitySchema: z$1.ZodObject<{
|
|
1605
|
+
toolName: z$1.ZodString;
|
|
1606
|
+
input: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1607
|
+
activityDescription: z$1.ZodString;
|
|
1608
|
+
}, z$1.core.$strip>;
|
|
1609
|
+
type ToolActivity = z$1.infer<typeof ToolActivitySchema>;
|
|
1610
|
+
declare const AgentProgressSchema: z$1.ZodObject<{
|
|
1611
|
+
toolUseCount: z$1.ZodNumber;
|
|
1612
|
+
tokenCount: z$1.ZodNumber;
|
|
1613
|
+
lastActivity: z$1.ZodOptional<z$1.ZodObject<{
|
|
1614
|
+
toolName: z$1.ZodString;
|
|
1615
|
+
input: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1616
|
+
activityDescription: z$1.ZodString;
|
|
1617
|
+
}, z$1.core.$strip>>;
|
|
1618
|
+
recentActivities: z$1.ZodArray<z$1.ZodObject<{
|
|
1619
|
+
toolName: z$1.ZodString;
|
|
1620
|
+
input: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1621
|
+
activityDescription: z$1.ZodString;
|
|
1622
|
+
}, z$1.core.$strip>>;
|
|
1623
|
+
}, z$1.core.$strip>;
|
|
1624
|
+
type AgentProgress = z$1.infer<typeof AgentProgressSchema>;
|
|
1625
|
+
declare const TeammateUIStateSchema: z$1.ZodObject<{
|
|
1626
|
+
name: z$1.ZodString;
|
|
1627
|
+
teamName: z$1.ZodString;
|
|
1628
|
+
status: z$1.ZodEnum<{
|
|
1685
1629
|
completed: "completed";
|
|
1686
1630
|
failed: "failed";
|
|
1687
1631
|
running: "running";
|
|
1688
1632
|
idle: "idle";
|
|
1689
1633
|
stopped: "stopped";
|
|
1690
1634
|
}>;
|
|
1691
|
-
progress: z.ZodObject<{
|
|
1692
|
-
toolUseCount: z.ZodNumber;
|
|
1693
|
-
tokenCount: z.ZodNumber;
|
|
1694
|
-
lastActivity: z.ZodOptional<z.ZodObject<{
|
|
1695
|
-
toolName: z.ZodString;
|
|
1696
|
-
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1697
|
-
activityDescription: z.ZodString;
|
|
1698
|
-
}, z.core.$strip>>;
|
|
1699
|
-
recentActivities: z.ZodArray<z.ZodObject<{
|
|
1700
|
-
toolName: z.ZodString;
|
|
1701
|
-
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1702
|
-
activityDescription: z.ZodString;
|
|
1703
|
-
}, z.core.$strip>>;
|
|
1704
|
-
}, z.core.$strip>;
|
|
1705
|
-
startTime: z.ZodNumber;
|
|
1706
|
-
spinnerVerb: z.ZodString;
|
|
1707
|
-
lastMessage: z.ZodOptional<z.ZodString>;
|
|
1708
|
-
}, z.core.$strip>;
|
|
1709
|
-
type TeammateUIState = z.infer<typeof TeammateUIStateSchema>;
|
|
1635
|
+
progress: z$1.ZodObject<{
|
|
1636
|
+
toolUseCount: z$1.ZodNumber;
|
|
1637
|
+
tokenCount: z$1.ZodNumber;
|
|
1638
|
+
lastActivity: z$1.ZodOptional<z$1.ZodObject<{
|
|
1639
|
+
toolName: z$1.ZodString;
|
|
1640
|
+
input: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1641
|
+
activityDescription: z$1.ZodString;
|
|
1642
|
+
}, z$1.core.$strip>>;
|
|
1643
|
+
recentActivities: z$1.ZodArray<z$1.ZodObject<{
|
|
1644
|
+
toolName: z$1.ZodString;
|
|
1645
|
+
input: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1646
|
+
activityDescription: z$1.ZodString;
|
|
1647
|
+
}, z$1.core.$strip>>;
|
|
1648
|
+
}, z$1.core.$strip>;
|
|
1649
|
+
startTime: z$1.ZodNumber;
|
|
1650
|
+
spinnerVerb: z$1.ZodString;
|
|
1651
|
+
lastMessage: z$1.ZodOptional<z$1.ZodString>;
|
|
1652
|
+
}, z$1.core.$strip>;
|
|
1653
|
+
type TeammateUIState = z$1.infer<typeof TeammateUIStateSchema>;
|
|
1710
1654
|
declare function createProgress(): AgentProgress;
|
|
1711
1655
|
declare function recordToolUse(p: AgentProgress, toolName: string, input: Record<string, unknown>): void;
|
|
1712
1656
|
declare function recordTokens(p: AgentProgress, inputTokens: number, outputTokens: number): void;
|
|
@@ -1805,17 +1749,17 @@ declare class SharedTaskStore {
|
|
|
1805
1749
|
* three-state semantics: absent means just registered and not yet started,
|
|
1806
1750
|
* true means actively running, false means idle.
|
|
1807
1751
|
*/
|
|
1808
|
-
declare const TeamMemberEntrySchema: z
|
|
1809
|
-
agentId: z
|
|
1810
|
-
name: z
|
|
1811
|
-
agentType: z
|
|
1812
|
-
model: z
|
|
1813
|
-
joinedAt: z
|
|
1814
|
-
worktreePath: z
|
|
1815
|
-
backendType: z
|
|
1816
|
-
isActive: z
|
|
1817
|
-
}, z
|
|
1818
|
-
type TeamMemberEntry = z
|
|
1752
|
+
declare const TeamMemberEntrySchema: z.ZodObject<{
|
|
1753
|
+
agentId: z.ZodString;
|
|
1754
|
+
name: z.ZodString;
|
|
1755
|
+
agentType: z.ZodOptional<z.ZodString>;
|
|
1756
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1757
|
+
joinedAt: z.ZodNumber;
|
|
1758
|
+
worktreePath: z.ZodOptional<z.ZodString>;
|
|
1759
|
+
backendType: z.ZodOptional<z.ZodString>;
|
|
1760
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
1761
|
+
}, z.core.$strip>;
|
|
1762
|
+
type TeamMemberEntry = z.infer<typeof TeamMemberEntrySchema>;
|
|
1819
1763
|
/**
|
|
1820
1764
|
* On-disk representation of team configuration, stored at <teamsBaseDir>/<slug>/config.json.
|
|
1821
1765
|
*
|
|
@@ -1827,23 +1771,23 @@ type TeamMemberEntry = z$1.infer<typeof TeamMemberEntrySchema>;
|
|
|
1827
1771
|
* independent processes that need to know which team they belong to and who their
|
|
1828
1772
|
* peers are after startup; users restarting Swifty must be able to resume prior teams.
|
|
1829
1773
|
*/
|
|
1830
|
-
declare const TeamFileSchema: z
|
|
1831
|
-
name: z
|
|
1832
|
-
description: z
|
|
1833
|
-
createdAt: z
|
|
1834
|
-
leadAgentId: z
|
|
1835
|
-
members: z
|
|
1836
|
-
agentId: z
|
|
1837
|
-
name: z
|
|
1838
|
-
agentType: z
|
|
1839
|
-
model: z
|
|
1840
|
-
joinedAt: z
|
|
1841
|
-
worktreePath: z
|
|
1842
|
-
backendType: z
|
|
1843
|
-
isActive: z
|
|
1844
|
-
}, z
|
|
1845
|
-
}, z
|
|
1846
|
-
type TeamFile = z
|
|
1774
|
+
declare const TeamFileSchema: z.ZodObject<{
|
|
1775
|
+
name: z.ZodString;
|
|
1776
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1777
|
+
createdAt: z.ZodNumber;
|
|
1778
|
+
leadAgentId: z.ZodString;
|
|
1779
|
+
members: z.ZodArray<z.ZodObject<{
|
|
1780
|
+
agentId: z.ZodString;
|
|
1781
|
+
name: z.ZodString;
|
|
1782
|
+
agentType: z.ZodOptional<z.ZodString>;
|
|
1783
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1784
|
+
joinedAt: z.ZodNumber;
|
|
1785
|
+
worktreePath: z.ZodOptional<z.ZodString>;
|
|
1786
|
+
backendType: z.ZodOptional<z.ZodString>;
|
|
1787
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
1788
|
+
}, z.core.$strip>>;
|
|
1789
|
+
}, z.core.$strip>;
|
|
1790
|
+
type TeamFile = z.infer<typeof TeamFileSchema>;
|
|
1847
1791
|
/**
|
|
1848
1792
|
* Root directory for all team data. Placed under the user's home directory rather than
|
|
1849
1793
|
* the project directory because pane teammates are independent processes whose working
|
|
@@ -2066,37 +2010,37 @@ declare class TeamManager {
|
|
|
2066
2010
|
* SOFTWARE.
|
|
2067
2011
|
*/
|
|
2068
2012
|
|
|
2069
|
-
declare const CodeReviewMemberSchema: z
|
|
2070
|
-
name: z
|
|
2071
|
-
email: z
|
|
2072
|
-
role: z
|
|
2013
|
+
declare const CodeReviewMemberSchema: z.ZodObject<{
|
|
2014
|
+
name: z.ZodString;
|
|
2015
|
+
email: z.ZodString;
|
|
2016
|
+
role: z.ZodEnum<{
|
|
2073
2017
|
lead: "lead";
|
|
2074
2018
|
reviewer: "reviewer";
|
|
2075
2019
|
junior: "junior";
|
|
2076
2020
|
critic: "critic";
|
|
2077
2021
|
}>;
|
|
2078
|
-
expertise: z
|
|
2079
|
-
active: z
|
|
2080
|
-
}, z
|
|
2081
|
-
type CodeReviewMember = z
|
|
2082
|
-
declare const CodeReviewTeamSchema: z
|
|
2083
|
-
name: z
|
|
2084
|
-
members: z
|
|
2085
|
-
name: z
|
|
2086
|
-
email: z
|
|
2087
|
-
role: z
|
|
2022
|
+
expertise: z.ZodArray<z.ZodString>;
|
|
2023
|
+
active: z.ZodBoolean;
|
|
2024
|
+
}, z.core.$strip>;
|
|
2025
|
+
type CodeReviewMember = z.infer<typeof CodeReviewMemberSchema>;
|
|
2026
|
+
declare const CodeReviewTeamSchema: z.ZodObject<{
|
|
2027
|
+
name: z.ZodString;
|
|
2028
|
+
members: z.ZodArray<z.ZodObject<{
|
|
2029
|
+
name: z.ZodString;
|
|
2030
|
+
email: z.ZodString;
|
|
2031
|
+
role: z.ZodEnum<{
|
|
2088
2032
|
lead: "lead";
|
|
2089
2033
|
reviewer: "reviewer";
|
|
2090
2034
|
junior: "junior";
|
|
2091
2035
|
critic: "critic";
|
|
2092
2036
|
}>;
|
|
2093
|
-
expertise: z
|
|
2094
|
-
active: z
|
|
2095
|
-
}, z
|
|
2096
|
-
createdAt: z
|
|
2097
|
-
lastActive: z
|
|
2098
|
-
}, z
|
|
2099
|
-
type CodeReviewTeam = z
|
|
2037
|
+
expertise: z.ZodArray<z.ZodString>;
|
|
2038
|
+
active: z.ZodBoolean;
|
|
2039
|
+
}, z.core.$strip>>;
|
|
2040
|
+
createdAt: z.ZodString;
|
|
2041
|
+
lastActive: z.ZodString;
|
|
2042
|
+
}, z.core.$strip>;
|
|
2043
|
+
type CodeReviewTeam = z.infer<typeof CodeReviewTeamSchema>;
|
|
2100
2044
|
declare class CodeReviewManager {
|
|
2101
2045
|
private teams;
|
|
2102
2046
|
private configPath;
|
|
@@ -2232,6 +2176,92 @@ declare class ReviewSession {
|
|
|
2232
2176
|
getRequestSummary(id: string): string;
|
|
2233
2177
|
}
|
|
2234
2178
|
|
|
2179
|
+
/**
|
|
2180
|
+
* Copyright (c) 2026 hangtiancheng
|
|
2181
|
+
*
|
|
2182
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2183
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
2184
|
+
* in the Software without restriction, including without limitation the rights
|
|
2185
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2186
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
2187
|
+
* furnished to do so, subject to the following conditions:
|
|
2188
|
+
*
|
|
2189
|
+
* The above copyright notice and this permission notice shall be included in
|
|
2190
|
+
* all copies or substantial portions of the Software.
|
|
2191
|
+
*
|
|
2192
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2193
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2194
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2195
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2196
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2197
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
2198
|
+
* SOFTWARE.
|
|
2199
|
+
*/
|
|
2200
|
+
|
|
2201
|
+
type CommandType = "local" | "local_ui" | "prompt" | "skill_fork";
|
|
2202
|
+
interface CommandContext {
|
|
2203
|
+
workDir: string;
|
|
2204
|
+
args: string;
|
|
2205
|
+
conversation?: unknown;
|
|
2206
|
+
registry?: unknown;
|
|
2207
|
+
/** Returns the current permission mode */
|
|
2208
|
+
permissionMode?: () => string;
|
|
2209
|
+
/** Returns token usage [input, output] */
|
|
2210
|
+
tokenCount?: () => [number, number];
|
|
2211
|
+
/** Returns the number of currently enabled tools */
|
|
2212
|
+
toolCount?: () => number;
|
|
2213
|
+
/** Returns the list of memories */
|
|
2214
|
+
memoryList?: () => string[];
|
|
2215
|
+
/** Clears all memories */
|
|
2216
|
+
memoryClear?: () => void;
|
|
2217
|
+
/** Returns the current model name */
|
|
2218
|
+
model?: string;
|
|
2219
|
+
/** Returns the current effective thinking level */
|
|
2220
|
+
thinkingLevel?: () => ThinkingLevel;
|
|
2221
|
+
/** Returns the active client's available logical thinking levels */
|
|
2222
|
+
availableThinkingLevels?: () => readonly ThinkingLevel[];
|
|
2223
|
+
/** Sets the thinking level for the active client */
|
|
2224
|
+
setThinkingLevel?: (level: ThinkingLevel) => void;
|
|
2225
|
+
/** Persists the thinking level to the global config; throws on failure */
|
|
2226
|
+
persistThinkingLevel?: (level: ThinkingLevel) => void;
|
|
2227
|
+
}
|
|
2228
|
+
interface Command {
|
|
2229
|
+
name: string;
|
|
2230
|
+
aliases: string[];
|
|
2231
|
+
type: CommandType;
|
|
2232
|
+
description: string;
|
|
2233
|
+
handler: (ctx: CommandContext) => string;
|
|
2234
|
+
/** Skill-derived commands; excluded from the /help listing (see /skills). */
|
|
2235
|
+
isSkill?: boolean;
|
|
2236
|
+
}
|
|
2237
|
+
declare class CommandRegistry {
|
|
2238
|
+
private commands;
|
|
2239
|
+
/** Alias to command name */
|
|
2240
|
+
private aliasMap;
|
|
2241
|
+
/**
|
|
2242
|
+
* Registers a command, checking for name and alias conflicts.
|
|
2243
|
+
* The name must not conflict with existing command names or aliases;
|
|
2244
|
+
* aliases must not conflict with existing command names or other aliases.
|
|
2245
|
+
*/
|
|
2246
|
+
register(cmd: Command): void;
|
|
2247
|
+
/**
|
|
2248
|
+
* Checks if a command would conflict with already registered commands.
|
|
2249
|
+
* Dynamic loaders (e.g., for user-defined commands) should call this method
|
|
2250
|
+
* before `register` to filter out conflicting entries, as `register` throws
|
|
2251
|
+
* an exception on conflict.
|
|
2252
|
+
*/
|
|
2253
|
+
hasConflict(cmd: Command): boolean;
|
|
2254
|
+
find(name: string): Command | undefined;
|
|
2255
|
+
complete(prefix: string): Command[];
|
|
2256
|
+
listCommands(): Command[];
|
|
2257
|
+
}
|
|
2258
|
+
interface Parsed {
|
|
2259
|
+
name: string;
|
|
2260
|
+
args: string;
|
|
2261
|
+
}
|
|
2262
|
+
declare function parse(input: string): Parsed | null;
|
|
2263
|
+
declare function createDefaultRegistry(): CommandRegistry;
|
|
2264
|
+
|
|
2235
2265
|
/**
|
|
2236
2266
|
* Copyright (c) 2026 hangtiancheng
|
|
2237
2267
|
*
|
|
@@ -2352,8 +2382,8 @@ declare function estimateMessages(messages: Message[]): number;
|
|
|
2352
2382
|
declare function estimateTokens(conv: ConversationManager): number;
|
|
2353
2383
|
declare function computeKeepStartIndex(messages: Message[]): number;
|
|
2354
2384
|
declare function currentContextTokens(conv: ConversationManager, anchor?: UsageAnchor): number;
|
|
2355
|
-
declare function manageContext(conv: ConversationManager, client: LLMClient, contextWindow: number, maxOutput: number, trackingState: AutoCompactTrackingState, recoveryState: RecoveryState | null, toolSchemaNames: string[], toolSchemas:
|
|
2356
|
-
declare function forceCompact(conv: ConversationManager, client: LLMClient, recoveryState: RecoveryState | null, toolSchemaNames: string[], toolSchemas:
|
|
2385
|
+
declare function manageContext(conv: ConversationManager, client: LLMClient, contextWindow: number, maxOutput: number, trackingState: AutoCompactTrackingState, recoveryState: RecoveryState | null, toolSchemaNames: string[], toolSchemas: ProviderToolSchema[], sessionFilePath?: string, abortSignal?: AbortSignal): Promise<CompactResult>;
|
|
2386
|
+
declare function forceCompact(conv: ConversationManager, client: LLMClient, recoveryState: RecoveryState | null, toolSchemaNames: string[], toolSchemas: ProviderToolSchema[], sessionFilePath?: string, abortSignal?: AbortSignal, customInstructions?: string): Promise<CompactResult>;
|
|
2357
2387
|
|
|
2358
2388
|
/**
|
|
2359
2389
|
* Copyright (c) 2026 hangtiancheng
|
|
@@ -2651,7 +2681,7 @@ declare function closeLogger(): void;
|
|
|
2651
2681
|
/**
|
|
2652
2682
|
* Global logger export. Modules can import and use it at file top level:
|
|
2653
2683
|
* ```ts
|
|
2654
|
-
* import { logger } from "
|
|
2684
|
+
* import { logger } from "@/logger/logger.js";
|
|
2655
2685
|
* logger.warn({ module: "app" }, "something looks off");
|
|
2656
2686
|
* ```
|
|
2657
2687
|
* Before initLogger(), calls fall back to the silent target (pre-init logs
|
|
@@ -2788,25 +2818,6 @@ declare class MCPManager {
|
|
|
2788
2818
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
2789
2819
|
* SOFTWARE.
|
|
2790
2820
|
*/
|
|
2791
|
-
/**
|
|
2792
|
-
* Decides how MCP tools enter the context. Three modes, chosen once at session start
|
|
2793
|
-
* right after MCP connects:
|
|
2794
|
-
*
|
|
2795
|
-
* eager Total schema size is under one tenth of the context window, so load
|
|
2796
|
-
* everything into tools[] with no deferral. The context saved is not worth
|
|
2797
|
-
* taking on any extra risk for.
|
|
2798
|
-
* native Official Anthropic endpoints. Tools stay in tools[] with defer_loading but
|
|
2799
|
-
* the server hides them from the model; ToolSearch returns tool_reference and
|
|
2800
|
-
* the server expands the schema.
|
|
2801
|
-
* dispatch Other endpoints (domestic vendors, various proxy gateways) support neither
|
|
2802
|
-
* of the above, so we simulate it ourselves: MCP tools never enter tools[] and
|
|
2803
|
-
* everything goes through the single McpCall entry point.
|
|
2804
|
-
*
|
|
2805
|
-
* Why three modes: tools is rendered after system and before messages, so any change to
|
|
2806
|
-
* the array invalidates the prompt cache for the entire conversation history that follows.
|
|
2807
|
-
* Measured with a 20k-token history, appending one tool to the end of tools drops the
|
|
2808
|
-
* cache hit rate from 99.4% to 9.5%, effectively recomputing the whole history.
|
|
2809
|
-
*/
|
|
2810
2821
|
|
|
2811
2822
|
/** Below this share of the context window, skip deferral and load everything eagerly. */
|
|
2812
2823
|
declare const DEFAULT_EAGER_THRESHOLD_PERCENT = 10;
|
|
@@ -3361,21 +3372,21 @@ declare function buildSkillSection(catalog: SkillCatalog, workDir: string): stri
|
|
|
3361
3372
|
* SOFTWARE.
|
|
3362
3373
|
*/
|
|
3363
3374
|
|
|
3364
|
-
declare const QuestionOptionSchema: z.ZodObject<{
|
|
3365
|
-
label: z.ZodString;
|
|
3366
|
-
description: z.ZodOptional<z.ZodString>;
|
|
3367
|
-
}, z.core.$strip>;
|
|
3368
|
-
type QuestionOption = z.infer<typeof QuestionOptionSchema>;
|
|
3369
|
-
declare const QuestionSchema: z.ZodObject<{
|
|
3370
|
-
question: z.ZodString;
|
|
3371
|
-
header: z.ZodString;
|
|
3372
|
-
options: z.ZodArray<z.ZodObject<{
|
|
3373
|
-
label: z.ZodString;
|
|
3374
|
-
description: z.ZodOptional<z.ZodString>;
|
|
3375
|
-
}, z.core.$strip>>;
|
|
3376
|
-
multiSelect: z.ZodBoolean;
|
|
3377
|
-
}, z.core.$strip>;
|
|
3378
|
-
type Question = z.infer<typeof QuestionSchema>;
|
|
3375
|
+
declare const QuestionOptionSchema: z$1.ZodObject<{
|
|
3376
|
+
label: z$1.ZodString;
|
|
3377
|
+
description: z$1.ZodOptional<z$1.ZodString>;
|
|
3378
|
+
}, z$1.core.$strip>;
|
|
3379
|
+
type QuestionOption = z$1.infer<typeof QuestionOptionSchema>;
|
|
3380
|
+
declare const QuestionSchema: z$1.ZodObject<{
|
|
3381
|
+
question: z$1.ZodString;
|
|
3382
|
+
header: z$1.ZodString;
|
|
3383
|
+
options: z$1.ZodArray<z$1.ZodObject<{
|
|
3384
|
+
label: z$1.ZodString;
|
|
3385
|
+
description: z$1.ZodOptional<z$1.ZodString>;
|
|
3386
|
+
}, z$1.core.$strip>>;
|
|
3387
|
+
multiSelect: z$1.ZodBoolean;
|
|
3388
|
+
}, z$1.core.$strip>;
|
|
3389
|
+
type Question = z$1.infer<typeof QuestionSchema>;
|
|
3379
3390
|
type Asker = (questions: Question[]) => Promise<Record<string /** question text */, string /** user chosen answer */>>;
|
|
3380
3391
|
declare class AskUserQuestionTool implements Tool {
|
|
3381
3392
|
private ask;
|
|
@@ -4176,7 +4187,8 @@ declare class TaskManager {
|
|
|
4176
4187
|
* SOFTWARE.
|
|
4177
4188
|
*/
|
|
4178
4189
|
|
|
4179
|
-
type AllTools = "InstallSkill" | "LoadSkill" | "Agent" | "TaskStop" | "TaskCreate" | "TaskGet" | "TaskList" | "TaskUpdate" | "TeamCreate" | "SpawnTeammate" | "SendMessage" | "ListTeams" | "TeamDelete" | "SyntheticOutput" | "AskUserQuestion" | "Bash" | "PowerShell" | "EditFile" | "EnterWorktree" | "ExitPlanMode" | "ExitWorktree" | "ReadFile" | "ToolSearch" | "WriteFile" | "Glob" | "Grep" | "McpCall";
|
|
4190
|
+
type AllTools = "InstallSkill" | "LoadSkill" | "Agent" | "TaskStop" | "TaskCreate" | "TaskGet" | "TaskList" | "TaskUpdate" | "TeamCreate" | "SpawnTeammate" | "SendMessage" | "ListTeams" | "TeamDelete" | "SyntheticOutput" | "AskUserQuestion" | "Bash" | "PowerShell" | "ComputerUse" | "EditFile" | "EnterWorktree" | "ExitPlanMode" | "ExitWorktree" | "ReadFile" | "ToolSearch" | "WriteFile" | "Glob" | "Grep" | "McpCall";
|
|
4191
|
+
declare const MAIN_AGENT_ONLY_TOOLS: Set<AllTools>;
|
|
4180
4192
|
declare const SUBAGENT_DISALLOWED_TOOLS: Set<AllTools>;
|
|
4181
4193
|
declare const TEAMMATE_DISALLOWED_TOOLS: Set<AllTools>;
|
|
4182
4194
|
declare const CUSTOM_AGENT_DISALLOWED_TOOLS: Set<AllTools>;
|
|
@@ -4537,21 +4549,21 @@ declare class TeamDeleteTool implements Tool {
|
|
|
4537
4549
|
* SOFTWARE.
|
|
4538
4550
|
*/
|
|
4539
4551
|
|
|
4540
|
-
declare const TranscriptEntrySchema: z
|
|
4541
|
-
role: z
|
|
4542
|
-
content: z
|
|
4543
|
-
tool_uses: z
|
|
4544
|
-
tool_use_id: z
|
|
4545
|
-
tool_name: z
|
|
4546
|
-
arguments: z
|
|
4547
|
-
}, z
|
|
4548
|
-
tool_results: z
|
|
4549
|
-
tool_use_id: z
|
|
4550
|
-
content: z
|
|
4551
|
-
is_error: z
|
|
4552
|
-
}, z
|
|
4553
|
-
}, z
|
|
4554
|
-
type TranscriptEntry = z
|
|
4552
|
+
declare const TranscriptEntrySchema: z.ZodObject<{
|
|
4553
|
+
role: z.ZodString;
|
|
4554
|
+
content: z.ZodOptional<z.ZodString>;
|
|
4555
|
+
tool_uses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4556
|
+
tool_use_id: z.ZodString;
|
|
4557
|
+
tool_name: z.ZodString;
|
|
4558
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
4559
|
+
}, z.core.$strip>>>;
|
|
4560
|
+
tool_results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4561
|
+
tool_use_id: z.ZodString;
|
|
4562
|
+
content: z.ZodString;
|
|
4563
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
4564
|
+
}, z.core.$strip>>>;
|
|
4565
|
+
}, z.core.$strip>;
|
|
4566
|
+
type TranscriptEntry = z.infer<typeof TranscriptEntrySchema>;
|
|
4555
4567
|
/**
|
|
4556
4568
|
* Persists a teammate's conversation history to disk for debugging and troubleshooting.
|
|
4557
4569
|
* File path: .swifty/teams/{team}/transcripts/{agentId}.json
|
|
@@ -4661,6 +4673,69 @@ declare class BashTool implements Tool {
|
|
|
4661
4673
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4662
4674
|
}
|
|
4663
4675
|
|
|
4676
|
+
type ComputerUseEnvironment = "windows" | "mac" | "browser" | "linux" | "ubuntu";
|
|
4677
|
+
interface CommandResult {
|
|
4678
|
+
code: number;
|
|
4679
|
+
stdout: Buffer;
|
|
4680
|
+
stderr: string;
|
|
4681
|
+
}
|
|
4682
|
+
interface CommandOptions {
|
|
4683
|
+
env?: NodeJS.ProcessEnv;
|
|
4684
|
+
maxOutputBytes?: number;
|
|
4685
|
+
signal?: AbortSignal;
|
|
4686
|
+
timeoutMs?: number;
|
|
4687
|
+
}
|
|
4688
|
+
type CommandRunner = (command: string, args: readonly string[], options?: CommandOptions) => Promise<CommandResult>;
|
|
4689
|
+
interface ComputerUseToolOptions {
|
|
4690
|
+
displayHeightPx?: number;
|
|
4691
|
+
displayNumber?: number;
|
|
4692
|
+
displayWidthPx?: number;
|
|
4693
|
+
enableZoom?: boolean;
|
|
4694
|
+
environment?: ComputerUseEnvironment;
|
|
4695
|
+
platform?: NodeJS.Platform;
|
|
4696
|
+
runCommand?: CommandRunner;
|
|
4697
|
+
}
|
|
4698
|
+
declare class ComputerUseTool implements Tool {
|
|
4699
|
+
name: string;
|
|
4700
|
+
description: string;
|
|
4701
|
+
category: ToolCategory;
|
|
4702
|
+
deferred: boolean;
|
|
4703
|
+
private readonly displayHeightPx;
|
|
4704
|
+
private readonly displayNumber?;
|
|
4705
|
+
private readonly displayWidthPx;
|
|
4706
|
+
private readonly enableZoom;
|
|
4707
|
+
private readonly environment;
|
|
4708
|
+
private readonly platform;
|
|
4709
|
+
private readonly run;
|
|
4710
|
+
private coordinateScaleX;
|
|
4711
|
+
private coordinateScaleY;
|
|
4712
|
+
private macHelperPromise?;
|
|
4713
|
+
constructor(options?: ComputerUseToolOptions);
|
|
4714
|
+
isConcurrencySafe(_args: Record<string, unknown>): boolean;
|
|
4715
|
+
providerSchema(protocol: ToolProtocol): ProviderNativeToolSchema | undefined;
|
|
4716
|
+
schema(): ToolSchema;
|
|
4717
|
+
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4718
|
+
/** Execute one Anthropic-style action (also the per-item path for batches). */
|
|
4719
|
+
private runSingle;
|
|
4720
|
+
/**
|
|
4721
|
+
* Execute an OpenAI-style ordered action batch. Per the OpenAI computer
|
|
4722
|
+
* output contract, the result always carries the screenshot taken after the
|
|
4723
|
+
* batch ran, and status / safety checks are echoed so the model can continue.
|
|
4724
|
+
*/
|
|
4725
|
+
private executeBatch;
|
|
4726
|
+
private toNativeCoordinates;
|
|
4727
|
+
private executeNative;
|
|
4728
|
+
private executeMac;
|
|
4729
|
+
private runMacPayload;
|
|
4730
|
+
private getMacHelper;
|
|
4731
|
+
private compileMacHelper;
|
|
4732
|
+
private executeWindows;
|
|
4733
|
+
private executeLinux;
|
|
4734
|
+
private screenshot;
|
|
4735
|
+
private imageResult;
|
|
4736
|
+
private captureScreenshot;
|
|
4737
|
+
}
|
|
4738
|
+
|
|
4664
4739
|
/**
|
|
4665
4740
|
* Copyright (c) 2026 hangtiancheng
|
|
4666
4741
|
*
|
|
@@ -4955,29 +5030,32 @@ declare function isDiffTool(toolName: string): boolean;
|
|
|
4955
5030
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
4956
5031
|
* SOFTWARE.
|
|
4957
5032
|
*/
|
|
4958
|
-
declare const TOOL_SEARCH_TOOL_NAME = "ToolSearch";
|
|
4959
|
-
declare const MCP_CALL_TOOL_NAME = "McpCall";
|
|
4960
|
-
|
|
4961
5033
|
/**
|
|
4962
|
-
*
|
|
5034
|
+
* Unified call entry point for MCP tools.
|
|
4963
5035
|
*
|
|
4964
|
-
*
|
|
4965
|
-
*
|
|
4966
|
-
*
|
|
4967
|
-
*
|
|
4968
|
-
*
|
|
4969
|
-
* furnished to do so, subject to the following conditions:
|
|
5036
|
+
* MCP tools never enter tools[]. The model first reads the schema via ToolSearch,
|
|
5037
|
+
* then passes the tool name and arguments through McpCall. This keeps the tools
|
|
5038
|
+
* array byte-identical throughout the whole session, so the prompt cache prefix is
|
|
5039
|
+
* never broken — tools render after system and before messages, so any change to
|
|
5040
|
+
* the array forces the entire trailing history to be recomputed.
|
|
4970
5041
|
*
|
|
4971
|
-
* The
|
|
4972
|
-
*
|
|
5042
|
+
* The trade-off is that arguments are generated freely by the model with no schema
|
|
5043
|
+
* constraint at the interface level, so the JSON type is occasionally wrong.
|
|
5044
|
+
* coerceBySchema fixes values level by level against the target tool's full schema.
|
|
5045
|
+
* The fix-up rules must be identical, item by item, across all four languages:
|
|
4973
5046
|
*
|
|
4974
|
-
*
|
|
4975
|
-
*
|
|
4976
|
-
*
|
|
4977
|
-
*
|
|
4978
|
-
*
|
|
4979
|
-
*
|
|
4980
|
-
*
|
|
5047
|
+
* schema declares model provides coerced to
|
|
5048
|
+
* string number (not boolean) "8891"
|
|
5049
|
+
* integer / number numeric-looking string 5 / 5.0
|
|
5050
|
+
* boolean "true" / "false" true / false
|
|
5051
|
+
* array single-key obj, array val unwrap the inner array
|
|
5052
|
+
* array comma-separated string split on commas, trim spaces
|
|
5053
|
+
* object object recurse over properties
|
|
5054
|
+
* array array recurse each element via items
|
|
5055
|
+
*
|
|
5056
|
+
* Values that can't be fixed are passed through as-is, letting the MCP server
|
|
5057
|
+
* report its own error — a server-side domain error is more instructive to the
|
|
5058
|
+
* model than a local type error.
|
|
4981
5059
|
*/
|
|
4982
5060
|
|
|
4983
5061
|
declare function coerceBySchema(value: unknown, schema: unknown): unknown;
|
|
@@ -5440,28 +5518,28 @@ declare function buildWorktreeNotice(parentCwd: string, wtPath: string): string;
|
|
|
5440
5518
|
* SOFTWARE.
|
|
5441
5519
|
*/
|
|
5442
5520
|
|
|
5443
|
-
declare const TaskStatusSchema: z
|
|
5521
|
+
declare const TaskStatusSchema: z.ZodEnum<{
|
|
5444
5522
|
completed: "completed";
|
|
5445
5523
|
in_progress: "in_progress";
|
|
5446
5524
|
pending: "pending";
|
|
5447
5525
|
}>;
|
|
5448
|
-
type TaskStatus = z
|
|
5449
|
-
declare const TaskSchema: z
|
|
5450
|
-
id: z
|
|
5451
|
-
subject: z
|
|
5452
|
-
description: z
|
|
5453
|
-
status: z
|
|
5526
|
+
type TaskStatus = z.infer<typeof TaskStatusSchema>;
|
|
5527
|
+
declare const TaskSchema: z.ZodObject<{
|
|
5528
|
+
id: z.ZodString;
|
|
5529
|
+
subject: z.ZodString;
|
|
5530
|
+
description: z.ZodString;
|
|
5531
|
+
status: z.ZodEnum<{
|
|
5454
5532
|
completed: "completed";
|
|
5455
5533
|
in_progress: "in_progress";
|
|
5456
5534
|
pending: "pending";
|
|
5457
5535
|
}>;
|
|
5458
|
-
owner: z
|
|
5459
|
-
activeForm: z
|
|
5460
|
-
blocks: z
|
|
5461
|
-
blockedBy: z
|
|
5462
|
-
metadata: z
|
|
5463
|
-
}, z
|
|
5464
|
-
type Task$1 = z
|
|
5536
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
5537
|
+
activeForm: z.ZodOptional<z.ZodString>;
|
|
5538
|
+
blocks: z.ZodArray<z.ZodString>;
|
|
5539
|
+
blockedBy: z.ZodArray<z.ZodString>;
|
|
5540
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
5541
|
+
}, z.core.$strip>;
|
|
5542
|
+
type Task$1 = z.infer<typeof TaskSchema>;
|
|
5465
5543
|
declare class TaskStore {
|
|
5466
5544
|
private filePath;
|
|
5467
5545
|
constructor(workDir: string, listId: string);
|
|
@@ -5641,4 +5719,4 @@ declare class TaskUpdateTool implements Tool {
|
|
|
5641
5719
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
5642
5720
|
}
|
|
5643
5721
|
|
|
5644
|
-
export { ASYNC_AGENT_ALLOWED_TOOLS, Agent, type AgentConfig, type AgentDefinition, type AgentEvent, type AgentEventCallback, AgentEventLogger, type AgentEventSink, type AgentProgress, AgentProgressSchema, type AgentTask, AgentTool, AnthropicClient, type AppConfig, AskUserQuestionTool, type Asker, AuthenticationError, AutoCompactTrackingState, BASH_DESCRIPTION, BUILTIN_AGENTS, type Backup, BashTool, BwrapSandbox, CHARS_PER_TOKEN, COMPACT_BOUNDARY, CUSTOM_AGENT_DISALLOWED_TOOLS, CodeReviewManager, type CodeReviewMember, type CodeReviewTeam, type Command, type CommandContext, CommandRegistry, type CommandType, CommandUsageTracker, type CommentIssue, type CommentResolution, type CompactBoundaryPayload, type CompactResult, ConfigError, type ConnectResult, ContextTooLongError, ConversationManager, type CriticAssessment, type CriticEvaluation, DEFAULT_CONTEXT_WINDOW, DEFAULT_EAGER_THRESHOLD_PERCENT, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_THINKING_LEVEL, type Decision, type DecisionEffect, type DetectedIde, type DiffResult, EDIT_FILE_DESCRIPTION, EditFileTool, EnterWorktreeTool, type EnvironmentContext, type EventLogger, type EventName, ExitPlanModeTool, ExitWorktreeTool, FORK_QUERY_SOURCE, type FileFeedback, FileHistory, type FileMailMessage, FileMailbox, FileStateCache, GLOB_DESCRIPTION, GREP_DESCRIPTION, GlobTool, GrepTool, type HookConfig, HookConfigSchema, type HookContext, HookEngine, type HookResult, type HookRuntimeOptions, INTERRUPTED_TOOL_RESULT, type IdeAtMention, type IdeConnection, ImageTooLargeError, InstallSkillTool, type InstructionSource, type KeptMessage, type LLMClient, LLMError, ListTeamsTool, LoadSkillTool, MAX_DIMENSION_PX, MAX_HISTORY_ENTRIES, MAX_IMAGES_PER_MESSAGE, MAX_IMAGE_BYTES_PASSTHROUGH, MCPClient, MCPManager, type MCPServerConfig, type MCPTool, type MCPToolLike, MCPToolWrapper,
|
|
5722
|
+
export { ASYNC_AGENT_ALLOWED_TOOLS, Agent, type AgentConfig, type AgentDefinition, type AgentEvent, type AgentEventCallback, AgentEventLogger, type AgentEventSink, type AgentProgress, AgentProgressSchema, type AgentTask, AgentTool, AnthropicClient, type AnthropicToolSchema, type AppConfig, AskUserQuestionTool, type Asker, AuthenticationError, AutoCompactTrackingState, BASH_DESCRIPTION, BUILTIN_AGENTS, type Backup, BashTool, BwrapSandbox, CHARS_PER_TOKEN, COMPACT_BOUNDARY, CUSTOM_AGENT_DISALLOWED_TOOLS, CodeReviewManager, type CodeReviewMember, type CodeReviewTeam, type Command, type CommandContext, CommandRegistry, type CommandType, CommandUsageTracker, type CommentIssue, type CommentResolution, type CompactBoundaryPayload, type CompactResult, ComputerUseTool, type ComputerUseToolOptions, ConfigError, type ConnectResult, ContextTooLongError, ConversationManager, type CriticAssessment, type CriticEvaluation, DEFAULT_CONTEXT_WINDOW, DEFAULT_EAGER_THRESHOLD_PERCENT, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_THINKING_LEVEL, type Decision, type DecisionEffect, type DetectedIde, type DiffResult, EDIT_FILE_DESCRIPTION, EditFileTool, EnterWorktreeTool, type EnvironmentContext, type EventLogger, type EventName, ExitPlanModeTool, ExitWorktreeTool, FORK_QUERY_SOURCE, type FileFeedback, FileHistory, type FileMailMessage, FileMailbox, FileStateCache, GLOB_DESCRIPTION, GREP_DESCRIPTION, GlobTool, GrepTool, type HookConfig, HookConfigSchema, type HookContext, HookEngine, type HookResult, type HookRuntimeOptions, INTERRUPTED_TOOL_RESULT, type IdeAtMention, type IdeConnection, ImageTooLargeError, InstallSkillTool, type InstructionSource, type KeptMessage, type LLMClient, LLMError, ListTeamsTool, LoadSkillTool, MAIN_AGENT_ONLY_TOOLS, MAX_DIMENSION_PX, MAX_HISTORY_ENTRIES, MAX_IMAGES_PER_MESSAGE, MAX_IMAGE_BYTES_PASSTHROUGH, MCPClient, MCPManager, type MCPServerConfig, type MCPTool, type MCPToolLike, MCPToolWrapper, MCP_NAME_SEP, MCP_TOOL_PREFIX, MIN_THINKING_ANSWER_TOKENS, MIN_THINKING_BUDGET_TOKENS, MSG_PLAN_APPROVAL_REQUEST, MSG_PLAN_APPROVAL_RESPONSE, MSG_SHUTDOWN_REQUEST, MSG_SHUTDOWN_RESPONSE, MSG_TEXT, type MaxTokensSetter, McpCallTool, type McpLoadingMode, type Member, MemoryConsolidator, MemoryExtractor, type MemoryFile, type MemoryHeader, MemoryManager, type Message, NATIVE_TOOL_USE_BETA, NameRegistry, NetworkError, OpenAIClient, OpenAICompatClient, type OpenAICompatToolSchema, type OpenAIMessageParam, type OpenAIResponsesToolSchema, POWERSHELL_DESCRIPTION, PathSandbox, PermissionChecker, type PermissionMode, PowerShellTool, type PrintArgs, PromptBuilder, type ProviderConfig, ProviderConfigSchema, type ProviderNativeToolSchema, type ProviderToolSchema, type Question, type QuestionOption, READ_FILE_DESCRIPTION, REJECTED_TOOL_RESULT, RateLimitError, ReadFileTool, type RecallResult, RecoveryState, type RelevantMemory, type RemoteAgentHandle, RemoteServer, type RestoredMessage, type ReviewComment, type ReviewRequest, ReviewSession, type ReviewSummary, RuleEngine, type RunAgent, type RunCallbacks, SHUTDOWN_PREFIX, SKIP_DIRS, SUBAGENT_DISALLOWED_TOOLS, type Sandbox, type SandboxConfig, type SandboxYamlConfig, type SaveClipboardImageResult, SeatbeltSandbox, type Section, SendMessageTool, type SessionInfo, type SessionMessage, type SharedTask, SharedTaskStore, type Skill, SkillCatalog, type SkillForkHost, type SkillHost, type SkillMeta, type Snapshot, type SpawnConfig, SpawnTeammateTool, type Task$1 as StoredTask, type StreamEvent, StreamingExecutor, type SubagentRunOptions, SyntheticOutputTool, TEAMMATE_DISALLOWED_TOOLS, THINKING_BUDGETS, THINKING_LEVELS, TOOL_RESULT_PREVIEW_CHARS, type Task, TaskCreateTool$1 as TaskCreateTool, TaskGetTool$1 as TaskGetTool, TaskList, TaskListTool$1 as TaskListTool, TaskManager, type TaskStatus, TaskStopTool, TaskStore, type TaskUpdateFields, TaskUpdateTool$1 as TaskUpdateTool, Team, TeamCreateTool, TeamDeleteTool, type TeamFile, TeamManager, type TeamMemberEntry, TeamMemberEntrySchema, type TeamMode, TaskCreateTool as TeamTaskCreateTool, TaskGetTool as TeamTaskGetTool, TaskListTool as TeamTaskListTool, TaskUpdateTool as TeamTaskUpdateTool, type TeammateUIState, TeammateUIStateSchema, type ThinkingBlock, type ThinkingLevel, type ThinkingLevelControl, type Tool, type ToolActivity, ToolActivitySchema, type ToolCategory, type ToolContext, type ToolProtocol, ToolRegistry, type ToolResult, type ToolResultBlock, type ToolResultContentBlock, type ToolResultRecord, type ToolSchema, ToolSearchTool, type ToolUseBlock, type ToolUseRecord, type TranscriptEntry, type UsageAnchor, type UsageInfo, WRITE_FILE_DESCRIPTION, WebSocketTransport, type WorktreeResult, WriteFileTool, append, applyBudget, applyMode, approved, asCriticEvaluation, asError, asErrorString, asImageMediaType, asRecord, asString, boolArg, buildAnthropicMessages, buildChatCompletionMessages, buildDiff, buildMcpToolName, buildOpenAIInput, buildPlanModeExitReminder, buildPlanModeReentryReminder, buildPlanModeReminder, buildSkillSection, buildSystemPrompt, buildTeammateRegistry, buildWorktreeNotice, clampThinkingLevel, cleanExpiredSessions, clipboardImageFileName, cloneRegistryForFork, closeLogger, coerceBySchema, computeCompactThreshold, computeKeepStartIndex, connectToIde, contentToText, coordinatorActive, coordinatorReminder, coordinatorToolFilter, createAgentWorktree, createChildLogger, createClient, createDefaultCodeReviewTeam, createDefaultRegistry, createModelResolver, createProgress, createRemoteAgent, createSandbox, currentContextTokens, decideAndApply, decideMode, detectBackend, detectBackendFromEnv, detectEnvironment, detectIde, discoverInstructions, doingTasksSection, ensureToolPairing, environmentSection, escapeSkillXml, estimateMessages, estimateSchemaTokens, estimateTokens, evaluateRules, executingActionsSection, expandAtRefs, expandAtRefsWithImages, extractContent, fetchModelContextWindow, fileHistoryDir, filterToolsForAgent, forceCompact, forkEnabled, formatTokens, getContextWindow, getCurrentBranch, getCurrentPlanPath, getMaxOutputTokens, getMediaType, getNameRegistry, getOrCreatePlanPath, getSessionFilePath, getSupportedThinkingLevels, getThinkingLevel, globalConfigPath, handleCodeReviewCommand, hasWorktreeChanges, identitySection, initLogger, intArg, isCoordinatorTool, isCriticEvaluation, isDiffTool, isImagePath, isMcpToolLike, isObject, isOfficialAnthropicEndpoint, isPngBuffer, isRecord, isSafeCommand, isShutdownRequest, isSpillReadback, isToolResultContentBlock, isValidThinkingLevel, listSessions, load, loadAgentDefinitions, loadConfig, loadImageAttachment, loadInstructions, loadPlan, loadSession, loadTranscript, loadUserCommands, logger, manageContext, markLastUserTailForCache, markToolsForCache, maybeResizeAndDownsampleImage, mcpCallPermissionContent, mcpContentToToolOutput, mcpToolNamePrefix, measureSchemaChars, memoryAge, memoryAgeDays, memoryFreshnessText, needsToolSearchBeta, newRequestId, newSessionId, normalizeToolResultContentBlock, outputEfficiencySection, parse, parsePrintFlags, parseSkillFile, parseSkillPrompt, parseTeammateFlags, persistLargeResult, planApprovalRequest, planApprovalResponse, planExists, quickSort, randomCompletionVerb, randomVerb, readTeamFile, readWorktreeHeadSha, rebuildFromSession, record, recordError, recordExit, recordTokens, recordToolUse, recover, removeAgentWorktree, renderBody, replaceToolResultContent, resetPlanPath, resolveAPIKey, resolveGitDir, resolveModelId, runFork, runInline, runPrintMode, runTeammate, safeJSONParse, sanitizeNameSegment, sanitizeSegment, sanitizeTeamName, saveClipboardImage, saveCompactBoundary, saveMessage, savePlan, saveTranscript, shutdownRequest, shutdownResponse, sniffMediaType, spawnSubagent, spawnTeammate, storeClipboardImage, strArg, strList, summarizeActivities, systemSection, teamConfigPath, teamDir, teamsBaseDir, thinkingBudgetForLevel, toAnthropicThinkingEffort, toDisplayPreview, toReasoningEffort, toTry, toneStyleSection, toolResultsToRecords, toolUsesToRecords, usingToolsSection, validate, version, withProviderDefaults, writeTeamFile };
|