@swifty.js/swifty 0.0.32 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +64 -0
  2. package/dist/acp-5WRTN2LL.js +14 -0
  3. package/dist/agent-3CAPJCPD.js +4 -0
  4. package/dist/anthropic-FXRRA63E.js +4 -0
  5. package/dist/{bwrap-TPE6G4BM.js → bwrap-ZTS67W2K.js} +1 -1
  6. package/dist/checker-3O7QF7XV.js +4 -0
  7. package/dist/chunk-2U4IWZ6E.js +4 -0
  8. package/dist/chunk-35X3GW25.js +4 -0
  9. package/dist/{chunk-NERVCUWE.js → chunk-4C3KJLJV.js} +1 -1
  10. package/dist/chunk-4HSQBZBI.js +4 -0
  11. package/dist/{chunk-JMF2DWGY.js → chunk-4PQYUHSN.js} +1 -1
  12. package/dist/chunk-6I3HEMIE.js +4 -0
  13. package/dist/{chunk-TKQ5T5VO.js → chunk-7JQHFZRD.js} +2 -2
  14. package/dist/{chunk-S35E7OYL.js → chunk-C5WLP3DH.js} +1 -1
  15. package/dist/chunk-FUKVR3XO.js +608 -0
  16. package/dist/chunk-FZORZF22.js +16 -0
  17. package/dist/chunk-G2TE2QZM.js +4 -0
  18. package/dist/chunk-I7XJSLRI.js +4 -0
  19. package/dist/{chunk-2EV72T5X.js → chunk-IKQTIDRL.js} +1 -1
  20. package/dist/chunk-IZ7QOBSB.js +4 -0
  21. package/dist/chunk-LC7ZWLIH.js +4 -0
  22. package/dist/chunk-LHSUYZO5.js +4 -0
  23. package/dist/chunk-M4D66APS.js +67 -0
  24. package/dist/chunk-NAAAN2TD.js +60 -0
  25. package/dist/chunk-NCZR3AGA.js +65 -0
  26. package/dist/{server-QMMIYNXW.js → chunk-PXQD6GWP.js} +15 -15
  27. package/dist/{chunk-FPQ2LBL4.js → chunk-QQVDL4QT.js} +1 -1
  28. package/dist/{chunk-TCQ4EB4G.js → chunk-TNF3EHFY.js} +1 -1
  29. package/dist/chunk-XGUH7SGV.js +4 -0
  30. package/dist/chunk-YIKI3EPG.js +150 -0
  31. package/dist/chunk-YKWIZE5D.js +4 -0
  32. package/dist/{devtools-OJ75EP3T.js → devtools-WJM4UVVT.js} +1 -1
  33. package/dist/esm-46WSO26W.js +4 -0
  34. package/dist/esm-4DBD7ONK.js +229 -0
  35. package/dist/esm-6EDGM6QS.js +4 -0
  36. package/dist/esm-D6BB3FBR.js +4 -0
  37. package/dist/esm-P2KEXEEK.js +4 -0
  38. package/dist/esm-XYKZYVLV.js +4 -0
  39. package/dist/esm-YJVVI2QX.js +4 -0
  40. package/dist/getMachineId-bsd-NBOQ3GRQ.js +4 -0
  41. package/dist/getMachineId-darwin-6VBNSUFR.js +5 -0
  42. package/dist/getMachineId-linux-RQ33NIOO.js +4 -0
  43. package/dist/getMachineId-unsupported-IWOYPUHZ.js +4 -0
  44. package/dist/getMachineId-win-ITT3WXP6.js +4 -0
  45. package/dist/lib/{agent-3OEC4SOB.js → agent-NNYCUIOF.js} +1 -1
  46. package/dist/lib/{checker-QNMXPZ7C.js → checker-UPY4CXUL.js} +1 -1
  47. package/dist/lib/{chunk-UH5M7FDP.js → chunk-AFYPVA5C.js} +252 -20
  48. package/dist/lib/{chunk-SOOSTGHI.js → chunk-CFYAZWDA.js} +8 -2
  49. package/dist/lib/chunk-GTHYQZRL.js +31 -0
  50. package/dist/lib/{chunk-4BPKIIQD.js → chunk-LDWFI6MR.js} +6 -4
  51. package/dist/lib/index.d.ts +229 -152
  52. package/dist/lib/index.js +1096 -575
  53. package/dist/lib/providers-UJEWP7C7.js +419 -0
  54. package/dist/lib/{tool-filter-IMIU7CW2.js → tool-filter-BFEINZIA.js} +1 -1
  55. package/dist/main.js +189 -181
  56. package/dist/{node-GXMM4JG3.js → node-A6KBFKOV.js} +1 -1
  57. package/dist/{openai-M7B2TITO.js → openai-WPEICAZ4.js} +1 -1
  58. package/dist/providers-WNYZUMZ3.js +6 -0
  59. package/dist/{seatbelt-3GM2YGXV.js → seatbelt-PSPJ5LBR.js} +1 -1
  60. package/dist/server-YPBLBRDN.js +4 -0
  61. package/dist/src-3A5BCUSZ.js +4 -0
  62. package/dist/src-CRYFVH7Y.js +12 -0
  63. package/dist/src-Y77IB66J.js +4 -0
  64. package/dist/src-ZCW4GCG2.js +4 -0
  65. package/dist/{tool-filter-7LLVAHD5.js → tool-filter-X6IYME2K.js} +1 -1
  66. package/dist/turndown.es-WNOSVZF6.js +83 -0
  67. package/package.json +30 -4
  68. package/dist/agent-2DUTUJFX.js +0 -4
  69. package/dist/anthropic-KR5MXB5I.js +0 -4
  70. package/dist/checker-RKAWOOXC.js +0 -4
  71. package/dist/chunk-4YVJP2CO.js +0 -4
  72. package/dist/chunk-BWWNI2FK.js +0 -121
  73. package/dist/chunk-LTFPTWX4.js +0 -612
  74. package/dist/chunk-TW7RHCDS.js +0 -150
  75. package/dist/chunk-X3UA5OZL.js +0 -4
@@ -267,13 +267,16 @@ interface ToolResult {
267
267
  contentBlocks?: ToolResultContentBlock[];
268
268
  isError: boolean;
269
269
  }
270
+ type PermissionRequestHandler = (toolName: string, args: Record<string, unknown>, decision: Decision, toolCallId: string) => Promise<"allow" | "deny" | "allowAlways">;
270
271
  interface ToolContext {
271
272
  workDir: string;
273
+ toolCallId?: string;
274
+ backgroundTaskId?: string;
272
275
  abortSignal?: AbortSignal;
273
276
  fileHistory?: FileHistory | undefined;
274
277
  fileStateCache?: FileStateCache | undefined;
275
278
  permissionChecker?: PermissionChecker;
276
- onPermissionRequest?: (toolName: string, args: Record<string, unknown>, decision: Decision) => Promise<"allow" | "deny" | "allowAlways">;
279
+ onPermissionRequest?: PermissionRequestHandler;
277
280
  }
278
281
  /**
279
282
  * How MCP tools enter the context, written into ToolRegistry by mcp/strategy
@@ -572,7 +575,7 @@ interface RestoredMessage {
572
575
  toolUses?: {
573
576
  toolUseId: string;
574
577
  toolName: string;
575
- arguments?: Record<string, unknown>;
578
+ arguments: Record<string, unknown>;
576
579
  providerItemId?: string;
577
580
  }[];
578
581
  toolResults?: ToolResultBlock[];
@@ -1457,7 +1460,7 @@ interface AgentConfig {
1457
1460
  * each turn, the caller maintains the injected set across turns.
1458
1461
  */
1459
1462
  onMemoriesSurfaced?: (paths: string[]) => void;
1460
- onPermissionRequest?: (toolName: string, args: Record<string, unknown>, decision: Decision) => Promise<"allow" | "deny" | "allowAlways">;
1463
+ onPermissionRequest?: PermissionRequestHandler;
1461
1464
  }
1462
1465
  declare class Agent {
1463
1466
  private announcedDeferred;
@@ -1513,6 +1516,29 @@ declare class Agent {
1513
1516
  private persistLastMessage;
1514
1517
  }
1515
1518
 
1519
+ type TelemetryObservationKind = "agent" | "generation" | "tool";
1520
+ type TelemetryAttributes = Record<string, string | number | boolean>;
1521
+ interface TelemetryObservationUpdate {
1522
+ completionStartTime?: Date;
1523
+ level?: "DEFAULT" | "ERROR" | "WARNING";
1524
+ metadata?: Record<string, unknown>;
1525
+ model?: string;
1526
+ statusMessage?: string;
1527
+ usageDetails?: Record<string, number>;
1528
+ }
1529
+ interface TelemetryObservation {
1530
+ end(): void;
1531
+ recordException(error: unknown): void;
1532
+ startChild(kind: TelemetryObservationKind, name: string, attributes?: TelemetryAttributes): TelemetryObservation;
1533
+ update(update: TelemetryObservationUpdate): void;
1534
+ }
1535
+
1536
+ interface AgentTelemetry {
1537
+ observation: TelemetryObservation;
1538
+ protocol: string;
1539
+ startedAt: number;
1540
+ }
1541
+
1516
1542
  /**
1517
1543
  * Copyright (c) 2026 hangtiancheng
1518
1544
  *
@@ -1545,7 +1571,8 @@ declare class StreamingExecutor {
1545
1571
  private pending;
1546
1572
  private registry;
1547
1573
  private ctx;
1548
- constructor(registry: ToolRegistry, ctx: ToolContext);
1574
+ private telemetry;
1575
+ constructor(registry: ToolRegistry, ctx: ToolContext, telemetry: AgentTelemetry);
1549
1576
  submit(toolId: string, toolName: string, args: Record<string, unknown>): void;
1550
1577
  collectResults(): Promise<ExecutionResult[]>;
1551
1578
  hasPending(): boolean;
@@ -1975,9 +2002,19 @@ declare const ToolActivitySchema: z$1.ZodObject<{
1975
2002
  activityDescription: z$1.ZodString;
1976
2003
  }, z$1.core.$strip>;
1977
2004
  type ToolActivity = z$1.infer<typeof ToolActivitySchema>;
2005
+ declare const ActiveToolSchema: z$1.ZodObject<{
2006
+ toolId: z$1.ZodString;
2007
+ toolName: z$1.ZodString;
2008
+ }, z$1.core.$strip>;
2009
+ type ActiveTool = z$1.infer<typeof ActiveToolSchema>;
1978
2010
  declare const AgentProgressSchema: z$1.ZodObject<{
1979
2011
  toolUseCount: z$1.ZodNumber;
2012
+ turnCount: z$1.ZodNumber;
1980
2013
  tokenCount: z$1.ZodNumber;
2014
+ activeTools: z$1.ZodArray<z$1.ZodObject<{
2015
+ toolId: z$1.ZodString;
2016
+ toolName: z$1.ZodString;
2017
+ }, z$1.core.$strip>>;
1981
2018
  lastActivity: z$1.ZodOptional<z$1.ZodObject<{
1982
2019
  toolName: z$1.ZodString;
1983
2020
  input: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
@@ -2002,7 +2039,12 @@ declare const TeammateUIStateSchema: z$1.ZodObject<{
2002
2039
  }>;
2003
2040
  progress: z$1.ZodObject<{
2004
2041
  toolUseCount: z$1.ZodNumber;
2042
+ turnCount: z$1.ZodNumber;
2005
2043
  tokenCount: z$1.ZodNumber;
2044
+ activeTools: z$1.ZodArray<z$1.ZodObject<{
2045
+ toolId: z$1.ZodString;
2046
+ toolName: z$1.ZodString;
2047
+ }, z$1.core.$strip>>;
2006
2048
  lastActivity: z$1.ZodOptional<z$1.ZodObject<{
2007
2049
  toolName: z$1.ZodString;
2008
2050
  input: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
@@ -2014,6 +2056,7 @@ declare const TeammateUIStateSchema: z$1.ZodObject<{
2014
2056
  activityDescription: z$1.ZodString;
2015
2057
  }, z$1.core.$strip>>;
2016
2058
  }, z$1.core.$strip>;
2059
+ originToolCallId: z$1.ZodOptional<z$1.ZodString>;
2017
2060
  startTime: z$1.ZodNumber;
2018
2061
  spinnerVerb: z$1.ZodString;
2019
2062
  lastMessage: z$1.ZodOptional<z$1.ZodString>;
@@ -2021,6 +2064,10 @@ declare const TeammateUIStateSchema: z$1.ZodObject<{
2021
2064
  type TeammateUIState = z$1.infer<typeof TeammateUIStateSchema>;
2022
2065
  declare function createProgress(): AgentProgress;
2023
2066
  declare function recordToolUse(p: AgentProgress, toolName: string, input: Record<string, unknown>): void;
2067
+ declare function recordToolStart(p: AgentProgress, toolId: string, toolName: string, input: Record<string, unknown>): void;
2068
+ declare function recordToolResult(p: AgentProgress, toolId: string): void;
2069
+ declare function recordTurnComplete(p: AgentProgress): void;
2070
+ declare function clearActiveTools(p: AgentProgress): void;
2024
2071
  declare function recordTokens(p: AgentProgress, inputTokens: number, outputTokens: number): void;
2025
2072
  declare function summarizeActivities(activities: ToolActivity[]): string;
2026
2073
  declare function formatTokens(n: number): string;
@@ -2171,6 +2218,12 @@ declare function teamsBaseDir(): string;
2171
2218
  */
2172
2219
  declare function sanitizeTeamName(name: string): string;
2173
2220
  declare function teamDir(name: string): string;
2221
+ /**
2222
+ * Lists every team that has data on disk, keyed by the (already sanitized)
2223
+ * team directory name. Returns an empty list when the base dir does not exist.
2224
+ * Used to sweep residual teams left behind by previous sessions.
2225
+ */
2226
+ declare function listTeamNames(): string[];
2174
2227
  declare function teamConfigPath(name: string): string;
2175
2228
  /**
2176
2229
  * Reads team configuration. Returns null when the file does not exist, allowing the
@@ -2206,17 +2259,107 @@ declare function writeTeamFile(name: string, file: TeamFile): void;
2206
2259
  * SOFTWARE.
2207
2260
  */
2208
2261
 
2209
- type TeamMode = "in-process" | "tmux" | "iterm";
2210
- type AgentEventCallback = (event: {
2211
- type: string;
2212
- toolName?: string;
2213
- args?: Record<string, unknown>;
2214
- usage?: {
2262
+ interface AgentDefinition {
2263
+ name: string;
2264
+ description: string;
2265
+ tools?: string[];
2266
+ disallowedTools?: string[];
2267
+ systemPromptOverride?: string;
2268
+ maxTurns?: number;
2269
+ model?: string;
2270
+ permissionMode?: PermissionMode;
2271
+ background?: boolean;
2272
+ isolation?: "worktree";
2273
+ initialPrompt?: string;
2274
+ omitMarkdown?: boolean;
2275
+ skills?: string[];
2276
+ memory?: boolean;
2277
+ mcpServers?: string[];
2278
+ }
2279
+ declare const BUILTIN_AGENTS: AgentDefinition[];
2280
+
2281
+ /**
2282
+ * Copyright (c) 2026 hangtiancheng
2283
+ *
2284
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
2285
+ * of this software and associated documentation files (the "Software"), to deal
2286
+ * in the Software without restriction, including without limitation the rights
2287
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2288
+ * copies of the Software, and to permit persons to whom the Software is
2289
+ * furnished to do so, subject to the following conditions:
2290
+ *
2291
+ * The above copyright notice and this permission notice shall be included in
2292
+ * all copies or substantial portions of the Software.
2293
+ *
2294
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2295
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2296
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2297
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2298
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2299
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2300
+ * SOFTWARE.
2301
+ */
2302
+
2303
+ /**
2304
+ * Marker appended to a subagent's output when its run was interrupted. Shared
2305
+ * with the TUI so restored transcripts can render interrupted Agent cards with
2306
+ * the same "stopped" styling as live ones.
2307
+ */
2308
+ declare const SUBAGENT_INTERRUPTED_MARKER = "[Interrupted]";
2309
+ type SubagentProgressEvent = {
2310
+ type: "tool_use";
2311
+ toolId: string;
2312
+ toolName: string;
2313
+ args: Record<string, unknown>;
2314
+ } | {
2315
+ type: "tool_result";
2316
+ toolId: string;
2317
+ } | {
2318
+ type: "usage";
2319
+ usage: {
2215
2320
  inputTokens: number;
2216
2321
  outputTokens: number;
2217
2322
  };
2218
- text?: string;
2219
- }) => void;
2323
+ } | {
2324
+ type: "turn_complete";
2325
+ };
2326
+ type AgentEventSink = (event: SubagentProgressEvent) => void;
2327
+ interface SubagentRunOptions {
2328
+ abortSignal?: AbortSignal;
2329
+ background?: boolean;
2330
+ onPermissionRequest?: AgentConfig["onPermissionRequest"];
2331
+ permissionMode?: PermissionChecker["mode"];
2332
+ conversation?: ConversationManager;
2333
+ }
2334
+ declare function spawnSubagent(definition: AgentDefinition, prompt: string, parentClient: LLMClient, parentRegistry: ToolRegistry, parentProvider: ProviderConfig, workDir: string, onProgress?: (p: {
2335
+ turn?: number;
2336
+ lastTool?: string;
2337
+ }) => void, onEvent?: AgentEventSink, modelOverride?: string, checkerOverride?: PermissionChecker, options?: SubagentRunOptions): Promise<string>;
2338
+
2339
+ /**
2340
+ * Copyright (c) 2026 hangtiancheng
2341
+ *
2342
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
2343
+ * of this software and associated documentation files (the "Software"), to deal
2344
+ * in the Software without restriction, including without limitation the rights
2345
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2346
+ * copies of the Software, and to permit persons to whom the Software is
2347
+ * furnished to do so, subject to the following conditions:
2348
+ *
2349
+ * The above copyright notice and this permission notice shall be included in
2350
+ * all copies or substantial portions of the Software.
2351
+ *
2352
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2353
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2354
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2355
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2356
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2357
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2358
+ * SOFTWARE.
2359
+ */
2360
+
2361
+ type TeamMode = "in-process" | "tmux" | "iterm";
2362
+ type AgentEventCallback = (event: SubagentProgressEvent) => void;
2220
2363
  interface Member {
2221
2364
  name: string;
2222
2365
  active: boolean;
@@ -2280,7 +2423,7 @@ declare class Team {
2280
2423
  * Falls back to in-process when the external backend is unavailable (tmux not installed,
2281
2424
  * non-iTerm environment, etc.) to avoid crashes.
2282
2425
  */
2283
- spawnTeammate(name: string, task: string, runAgent: RunAgent, checker?: PermissionChecker, providerBaseUrl?: string): void;
2426
+ spawnTeammate(name: string, task: string, runAgent: RunAgent, checker?: PermissionChecker, providerBaseUrl?: string, originToolCallId?: string): void;
2284
2427
  /**
2285
2428
  * tmux / iTerm backend: launches the teammate as an independent process in a new pane / tab.
2286
2429
  * The teammate process connects back to the team via the same mailbox directory pointed to
@@ -2347,7 +2490,15 @@ declare class TeamManager {
2347
2490
  /** Retrieves the team's shared task store; loads from disk (tasks.json) when not cached in memory (e.g. in a teammate process). */
2348
2491
  getTaskStore(teamName: string): SharedTaskStore;
2349
2492
  list(): Team[];
2493
+ stopAll(): Promise<void>;
2350
2494
  delete(name: string): Promise<void>;
2495
+ /**
2496
+ * Deletes every team: in-memory teams are stopped and unregistered, then any
2497
+ * residual team directories on disk (e.g. leftovers from previous sessions,
2498
+ * which never appear in list()) are removed too. Enforces the single-team
2499
+ * invariant before a new team is created.
2500
+ */
2501
+ deleteAll(): Promise<void>;
2351
2502
  getAllTeammateStates(): TeammateUIState[];
2352
2503
  /**
2353
2504
  * Reads all unread messages from the team lead's mailbox and returns them in XML tag format.
@@ -3811,47 +3962,6 @@ declare function buildSystemPrompt(env: EnvironmentContext): string;
3811
3962
  /** Periodic conversation reminders preserve guidance without changing the cached system prefix. */
3812
3963
  declare function coordinatorReminder(iteration?: number): string;
3813
3964
 
3814
- /**
3815
- * Copyright (c) 2026 hangtiancheng
3816
- *
3817
- * Permission is hereby granted, free of charge, to any person obtaining a copy
3818
- * of this software and associated documentation files (the "Software"), to deal
3819
- * in the Software without restriction, including without limitation the rights
3820
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3821
- * copies of the Software, and to permit persons to whom the Software is
3822
- * furnished to do so, subject to the following conditions:
3823
- *
3824
- * The above copyright notice and this permission notice shall be included in
3825
- * all copies or substantial portions of the Software.
3826
- *
3827
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3828
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3829
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3830
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3831
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3832
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3833
- * SOFTWARE.
3834
- */
3835
-
3836
- interface AgentDefinition {
3837
- name: string;
3838
- description: string;
3839
- tools?: string[];
3840
- disallowedTools?: string[];
3841
- systemPromptOverride?: string;
3842
- maxTurns?: number;
3843
- model?: string;
3844
- permissionMode?: PermissionMode;
3845
- background?: boolean;
3846
- isolation?: "worktree";
3847
- initialPrompt?: string;
3848
- omitMarkdown?: boolean;
3849
- skills?: string[];
3850
- memory?: boolean;
3851
- mcpServers?: string[];
3852
- }
3853
- declare const BUILTIN_AGENTS: AgentDefinition[];
3854
-
3855
3965
  declare function buildSubagentInstructions(definition: AgentDefinition): string;
3856
3966
  declare function buildTeammatePrompt(team: string, name: string, task: string): string;
3857
3967
 
@@ -3958,6 +4068,39 @@ declare class AgentEventLogger {
3958
4068
  onEvent(ev: AgentEvent): void;
3959
4069
  }
3960
4070
 
4071
+ type AgentTaskStatus = "running" | "completed" | "failed" | "cancelled";
4072
+ interface AgentTask {
4073
+ id: string;
4074
+ name: string;
4075
+ originToolCallId?: string;
4076
+ status: AgentTaskStatus;
4077
+ output: string;
4078
+ cancel: () => void;
4079
+ done: Promise<void>;
4080
+ }
4081
+ interface CreateTaskOptions {
4082
+ originToolCallId?: string;
4083
+ }
4084
+ declare class TaskManager {
4085
+ private tasks;
4086
+ private notifiedTaskIds;
4087
+ private listeners;
4088
+ private nextId;
4089
+ create(name: string, runner: (task: AgentTask) => Promise<string>, cancel: () => void, options?: CreateTaskOptions): AgentTask;
4090
+ get(id: string): AgentTask | undefined;
4091
+ list(): AgentTask[];
4092
+ subscribe(listener: (tasks: AgentTask[]) => void): () => void;
4093
+ private emitChange;
4094
+ hasRunning(): boolean;
4095
+ stop(id: string): boolean;
4096
+ stopAndWait(id: string): Promise<boolean>;
4097
+ stopAll(): Promise<void>;
4098
+ waitAll(): Promise<void>;
4099
+ drainNotifications(): AgentTask[];
4100
+ clear(): void;
4101
+ }
4102
+ declare function formatAgentTaskNotification(task: AgentTask): string;
4103
+
3961
4104
  /**
3962
4105
  * Copyright (c) 2026 hangtiancheng
3963
4106
  *
@@ -4030,7 +4173,7 @@ declare class AskUserQuestionTool implements Tool {
4030
4173
 
4031
4174
  /** Callbacks injected into each agent run for permission and user-interaction flows. */
4032
4175
  interface RunCallbacks {
4033
- onPermissionRequest: (toolName: string, args: Record<string, unknown>, decision: Decision) => Promise<"allow" | "deny" | "allowAlways">;
4176
+ onPermissionRequest: PermissionRequestHandler;
4034
4177
  }
4035
4178
  /** Encapsulates ALL agent state needed by the remote server. */
4036
4179
  interface RemoteAgentHandle {
@@ -4048,6 +4191,7 @@ interface RemoteAgentHandle {
4048
4191
  hookEngine: HookEngine | null;
4049
4192
  recoveryState: RecoveryState;
4050
4193
  teamManager: TeamManager;
4194
+ backgroundTaskManager: TaskManager;
4051
4195
  enableCoordinatorMode: boolean;
4052
4196
  forkDisabled: boolean;
4053
4197
  memoryManager: MemoryManager;
@@ -4068,7 +4212,8 @@ interface CreateRemoteAgentOptions {
4068
4212
  mcpServers?: MCPServerConfig[];
4069
4213
  enableCoordinatorMode: boolean;
4070
4214
  forkDisabled: boolean;
4071
- askUser: Asker;
4215
+ askUser?: Asker;
4216
+ sessionId?: string;
4072
4217
  }
4073
4218
  /**
4074
4219
  * Initializes the full agent stack: tools, LLM client, conversation, session,
@@ -4389,6 +4534,7 @@ declare class AgentTool implements Tool {
4389
4534
  private definitions;
4390
4535
  private registry;
4391
4536
  private conversation?;
4537
+ private taskManager;
4392
4538
  querySource: string;
4393
4539
  /** Optional: Team manager, enables the team_name parameter. */
4394
4540
  private teamManager?;
@@ -4409,7 +4555,7 @@ declare class AgentTool implements Tool {
4409
4555
  private teamProviderBaseUrl?;
4410
4556
  private spawnHandler;
4411
4557
  private forkHandler?;
4412
- constructor(workDir: string, registry: ToolRegistry, spawnHandler: (def: AgentDefinition, prompt: string, bg: boolean, modelOverride?: string, workDirOverride?: string, context?: ToolContext) => Promise<string>, conversation?: ConversationManager, forkHandler?: (prompt: string, conversation: ConversationManager, registry: ToolRegistry, modelOverride?: string, context?: ToolContext) => Promise<string>);
4558
+ constructor(workDir: string, registry: ToolRegistry, spawnHandler: (def: AgentDefinition, prompt: string, bg: boolean, modelOverride?: string, workDirOverride?: string, context?: ToolContext) => Promise<string>, conversation?: ConversationManager, forkHandler?: (prompt: string, conversation: ConversationManager, registry: ToolRegistry, modelOverride?: string, context?: ToolContext) => Promise<string>, taskManager?: TaskManager);
4413
4559
  /**
4414
4560
  * Sets the team manager and teammate run callback, enabling the team_name parameter.
4415
4561
  * Once configured, the Agent tool can spawn teammates directly without requiring a separate SpawnTeammate tool.
@@ -4418,6 +4564,7 @@ declare class AgentTool implements Tool {
4418
4564
  schema(): ToolSchema;
4419
4565
  private buildDescription;
4420
4566
  execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
4567
+ private startBackground;
4421
4568
  /**
4422
4569
  * Team-member mode: Spawns a persistent teammate in the specified team.
4423
4570
  * Delegates to Team.spawnTeammate() to start the idle-poll main loop.
@@ -4481,90 +4628,7 @@ declare function loadAgentDefinitions(workDir: string): AgentDefinition[];
4481
4628
  * SOFTWARE.
4482
4629
  */
4483
4630
 
4484
- type AgentEventSink = (event: {
4485
- type: string;
4486
- toolName?: string;
4487
- args?: Record<string, unknown>;
4488
- usage?: {
4489
- inputTokens: number;
4490
- outputTokens: number;
4491
- };
4492
- text?: string;
4493
- }) => void;
4494
- interface SubagentRunOptions {
4495
- abortSignal?: AbortSignal;
4496
- background?: boolean;
4497
- onPermissionRequest?: AgentConfig["onPermissionRequest"];
4498
- permissionMode?: PermissionChecker["mode"];
4499
- conversation?: ConversationManager;
4500
- }
4501
- declare function spawnSubagent(definition: AgentDefinition, prompt: string, parentClient: LLMClient, parentRegistry: ToolRegistry, parentProvider: ProviderConfig, workDir: string, onProgress?: (p: {
4502
- turn?: number;
4503
- lastTool?: string;
4504
- }) => void, onEvent?: AgentEventSink, modelOverride?: string, checkerOverride?: PermissionChecker, options?: SubagentRunOptions): Promise<string>;
4505
-
4506
- /**
4507
- * Copyright (c) 2026 hangtiancheng
4508
- *
4509
- * Permission is hereby granted, free of charge, to any person obtaining a copy
4510
- * of this software and associated documentation files (the "Software"), to deal
4511
- * in the Software without restriction, including without limitation the rights
4512
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4513
- * copies of the Software, and to permit persons to whom the Software is
4514
- * furnished to do so, subject to the following conditions:
4515
- *
4516
- * The above copyright notice and this permission notice shall be included in
4517
- * all copies or substantial portions of the Software.
4518
- *
4519
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4520
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4521
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4522
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4523
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4524
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4525
- * SOFTWARE.
4526
- */
4527
- interface AgentTask {
4528
- id: string;
4529
- name: string;
4530
- status: "running" | "completed" | "failed" | "cancelled";
4531
- output: string;
4532
- cancel: () => void;
4533
- }
4534
- declare class TaskManager {
4535
- private tasks;
4536
- private nextId;
4537
- create(name: string, runner: () => Promise<string>, cancel: () => void): AgentTask;
4538
- get(id: string): AgentTask | undefined;
4539
- list(): AgentTask[];
4540
- /** Abort a running task; returns whether a task was actually stopped. Returns false for tasks that have already finished. */
4541
- stop(id: string): boolean;
4542
- drainNotifications(): AgentTask[];
4543
- }
4544
-
4545
- /**
4546
- * Copyright (c) 2026 hangtiancheng
4547
- *
4548
- * Permission is hereby granted, free of charge, to any person obtaining a copy
4549
- * of this software and associated documentation files (the "Software"), to deal
4550
- * in the Software without restriction, including without limitation the rights
4551
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4552
- * copies of the Software, and to permit persons to whom the Software is
4553
- * furnished to do so, subject to the following conditions:
4554
- *
4555
- * The above copyright notice and this permission notice shall be included in
4556
- * all copies or substantial portions of the Software.
4557
- *
4558
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4559
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4560
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4561
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4562
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4563
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4564
- * SOFTWARE.
4565
- */
4566
-
4567
- 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";
4631
+ 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" | "WebFetch" | "McpCall";
4568
4632
  declare const MAIN_AGENT_ONLY_TOOLS: Set<AllTools>;
4569
4633
  declare const SUBAGENT_DISALLOWED_TOOLS: Set<AllTools>;
4570
4634
  declare const TEAMMATE_DISALLOWED_TOOLS: Set<AllTools>;
@@ -4812,21 +4876,14 @@ declare function getNameRegistry(): NameRegistry;
4812
4876
  * SOFTWARE.
4813
4877
  */
4814
4878
 
4815
- /**
4816
- * Abort a running teammate.
4817
- * Use this to cut losses early when the Coordinator dispatched in the wrong direction,
4818
- * rather than waiting for the teammate to finish misguided work.
4819
- *
4820
- * Wired to TeamManager instead of the background task table: in coordinator mode the Lead
4821
- * dispatches teammates whose cancel handles are held by the Team — they don't appear in
4822
- * the background task table.
4823
- */
4879
+ /** Abort a running teammate or one-shot background Agent task. */
4824
4880
  declare class TaskStopTool implements Tool {
4825
4881
  private teamManager;
4882
+ private taskManager?;
4826
4883
  name: string;
4827
4884
  description: string;
4828
4885
  category: ToolCategory;
4829
- constructor(teamManager: TeamManager);
4886
+ constructor(teamManager: TeamManager, taskManager?: TaskManager | undefined);
4830
4887
  schema(): ToolSchema;
4831
4888
  execute(_ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
4832
4889
  /** List all current teammate names for the model, so it doesn't keep retrying with a misremembered name */
@@ -5265,6 +5322,7 @@ declare const EDIT_FILE_DESCRIPTION = "Replace exact text in an existing file an
5265
5322
  declare const WRITE_FILE_DESCRIPTION = "Write complete UTF-8 content to file_path, creating parent directories and overwriting existing content. Use for new files or complete rewrites; prefer EditFile for targeted changes.\n- file_path is absolute or relative to the Agent's working directory. Existing files require ReadFile first; re-read if the cached state is stale.\n- content includes any desired trailing newline; an empty string creates or truncates an empty file. Avoid unrelated files or unsolicited documentation.";
5266
5323
  declare const GLOB_DESCRIPTION = "Find files by glob pattern (e.g. \"**/*.ts\", \"*.{ts,tsx}\"). Return paths relative to path, sorted newest modification first.\n- path is absolute or relative to the Agent's working directory (default \".\"); never search the filesystem root.\n- Includes dotfiles; traversal skips fixed directories such as .git, .agents, .swifty, node_modules, dist, and __pycache__, not rules from .gitignore.\n- At most 1000 matches; narrow limited searches rather than treating them as exhaustive. Prefer this over shell find/ls.";
5267
5324
  declare const GREP_DESCRIPTION = "Search file content with a case-insensitive, line-by-line JavaScript-style regex pattern; return file:line:content with 1-based lines and working-directory-relative paths.\n- path is a file or directory, absolute or relative to the Agent's working directory (default \".\"). Escape regex backslashes in JSON. No multiline matching or general PCRE support.\n- include is an optional glob: \"*.ts\" matches names at any depth; patterns with \"/\" match working-directory-relative paths. A direct file path is searched without this filter.\n- Traversal includes dotfiles but skips fixed directories such as .git, .agents, .swifty, node_modules, dist, and __pycache__, not .gitignore rules. Binary/unreadable files are skipped; directory symlinks are not traversed.\n- At most 500 matching lines. Narrow searches; never search the filesystem root. Use ReadFile for context and this tool instead of shell grep/rg.";
5325
+ declare const WEB_FETCH_DESCRIPTION = "Fetch a URL over HTTP(S) and return its content as Markdown. Use it to retrieve and analyze web pages.\n- url must be a fully-formed http or https URL; redirects are followed automatically and the final URL is reported when it differs.\n- HTML is converted to Markdown; other text formats (plain text, JSON, XML, Markdown) are returned as-is. Binary content (images, PDFs, archives) is rejected.\n- Responses over 10MB are rejected and results are truncated at 100K characters. Successful fetches are cached for 15 minutes.";
5268
5326
 
5269
5327
  /**
5270
5328
  * Copyright (c) 2026 hangtiancheng
@@ -5700,6 +5758,11 @@ declare function utf8ByteLength(value: string): number;
5700
5758
  declare function takeUtf8Prefix(value: string, maxBytes: number): string;
5701
5759
  declare function formatShellOutput(prompt: string, command: string, stdout: string, stderr: string, truncated: boolean): string;
5702
5760
 
5761
+ declare const MACOS_SNIPPET = "\nimport AppKit\nimport ApplicationServices\nimport Foundation\n\nfunc fail(_ message: String) -> Never {\n FileHandle.standardError.write(Data(message.utf8))\n exit(2)\n}\n\nguard let encoded = ProcessInfo.processInfo.environment[\"SWIFTY_COMPUTER_INPUT\"],\n let data = Data(base64Encoded: encoded),\n let object = try? JSONSerialization.jsonObject(with: data),\n let input = object as? [String: Any],\n let action = input[\"action\"] as? String\nelse {\n fail(\"Invalid computer action payload.\")\n}\n\nlet keyCodes: [String: CGKeyCode] = [\n \"A\": 0, \"S\": 1, \"D\": 2, \"F\": 3, \"H\": 4, \"G\": 5, \"Z\": 6, \"X\": 7,\n \"C\": 8, \"V\": 9, \"B\": 11, \"Q\": 12, \"W\": 13, \"E\": 14, \"R\": 15,\n \"Y\": 16, \"T\": 17, \"1\": 18, \"2\": 19, \"3\": 20, \"4\": 21, \"6\": 22,\n \"5\": 23, \"=\": 24, \"9\": 25, \"7\": 26, \"-\": 27, \"8\": 28, \"0\": 29,\n \"]\": 30, \"O\": 31, \"U\": 32, \"[\": 33, \"I\": 34, \"P\": 35, \"RETURN\": 36,\n \"ENTER\": 36, \"L\": 37, \"J\": 38, \"'\": 39, \"K\": 40, \";\": 41, \"\\\": 42,\n \",\": 43, \"/\": 44, \"N\": 45, \"M\": 46, \".\": 47, \"TAB\": 48, \"SPACE\": 49,\n \"GRAVE\": 50, \"BACKTICK\": 50, \"BACKSPACE\": 51, \"DELETE\": 51, \"ESC\": 53, \"ESCAPE\": 53,\n \"CMD\": 55, \"COMMAND\": 55, \"META\": 55, \"SHIFT\": 56, \"CAPSLOCK\": 57,\n \"ALT\": 58, \"OPTION\": 58, \"CTRL\": 59, \"CONTROL\": 59, \"LEFT\": 123,\n \"RIGHT\": 124, \"DOWN\": 125, \"UP\": 126, \"HOME\": 115, \"END\": 119,\n \"PAGEUP\": 116, \"PAGEDOWN\": 121, \"F1\": 122, \"F2\": 120, \"F3\": 99,\n \"F4\": 118, \"F5\": 96, \"F6\": 97, \"F7\": 98, \"F8\": 100, \"F9\": 101,\n \"F10\": 109, \"F11\": 103, \"F12\": 111,\n]\n\nfunc number(_ name: String) -> CGFloat {\n guard let value = input[name] as? NSNumber else { fail(\"Missing \" + name + \".\") }\n return CGFloat(value.doubleValue)\n}\n\nfunc keys() -> [String] {\n return (input[\"keys\"] as? [String] ?? []).map { $0.uppercased() }\n}\n\nfunc keyCode(_ name: String) -> CGKeyCode {\n guard let code = keyCodes[name.uppercased()] else { fail(\"Unsupported key: \" + name) }\n return code\n}\n\nfunc keyEvent(_ name: String, _ down: Bool) {\n guard let event = CGEvent(keyboardEventSource: nil, virtualKey: keyCode(name), keyDown: down)\n else {\n fail(\"Unable to create keyboard event.\")\n }\n event.post(tap: .cghidEventTap)\n}\n\nfunc withKeys(_ names: [String], _ body: () -> Void) {\n for name in names { keyEvent(name, true) }\n body()\n for name in names.reversed() { keyEvent(name, false) }\n}\n\nfunc mouseEvent(_ type: CGEventType, _ point: CGPoint, _ button: CGMouseButton, clicks: Int64 = 1) {\n guard\n let event = CGEvent(\n mouseEventSource: nil, mouseType: type, mouseCursorPosition: point, mouseButton: button)\n else {\n fail(\"Unable to create mouse event.\")\n }\n event.setIntegerValueField(.mouseEventClickState, value: clicks)\n event.post(tap: .cghidEventTap)\n}\n\nif action == \"screen_size\" {\n let bounds = CGDisplayBounds(CGMainDisplayID())\n print(\"\\(Int(bounds.width)),\\(Int(bounds.height))\")\n exit(0)\n}\n\nif action == \"cursor_position\" {\n guard let event = CGEvent(source: nil) else { fail(\"Unable to read cursor position.\") }\n print(\"\\(Int(event.location.x)),\\(Int(event.location.y))\")\n exit(0)\n}\n\nif !AXIsProcessTrusted() {\n fail(\n \"Accessibility permission is required. Enable it for the terminal running Swifty in System Settings > Privacy & Security > Accessibility.\"\n )\n}\n\nlet point = CGPoint(\n x: (input[\"x\"] as? NSNumber)?.doubleValue ?? 0,\n y: (input[\"y\"] as? NSNumber)?.doubleValue ?? 0\n)\nlet heldKeys = keys()\n\nswitch action {\ncase \"mouse_move\":\n withKeys(heldKeys) { mouseEvent(.mouseMoved, point, .left) }\ncase \"left_mouse_down\":\n mouseEvent(.leftMouseDown, CGEvent(source: nil)?.location ?? point, .left)\ncase \"left_mouse_up\":\n mouseEvent(.leftMouseUp, CGEvent(source: nil)?.location ?? point, .left)\ncase \"mouse_click\":\n let buttonName = input[\"button\"] as? String ?? \"left\"\n let button: CGMouseButton =\n buttonName == \"right\" ? .right : buttonName == \"middle\" ? .center : .left\n let downType: CGEventType =\n button == .right ? .rightMouseDown : button == .center ? .otherMouseDown : .leftMouseDown\n let upType: CGEventType =\n button == .right ? .rightMouseUp : button == .center ? .otherMouseUp : .leftMouseUp\n let count = (input[\"clicks\"] as? NSNumber)?.int64Value ?? 1\n withKeys(heldKeys) {\n mouseEvent(.mouseMoved, point, button)\n for click in 1...count {\n mouseEvent(downType, point, button, clicks: click)\n mouseEvent(upType, point, button, clicks: click)\n Thread.sleep(forTimeInterval: 0.08)\n }\n }\ncase \"left_click_drag\":\n guard let path = input[\"path\"] as? [[String: NSNumber]], let first = path.first else {\n fail(\"Drag path is missing.\")\n }\n let start = CGPoint(x: first[\"x\"]?.doubleValue ?? 0, y: first[\"y\"]?.doubleValue ?? 0)\n withKeys(heldKeys) {\n mouseEvent(.mouseMoved, start, .left)\n mouseEvent(.leftMouseDown, start, .left)\n for item in path.dropFirst() {\n let next = CGPoint(x: item[\"x\"]?.doubleValue ?? 0, y: item[\"y\"]?.doubleValue ?? 0)\n mouseEvent(.leftMouseDragged, next, .left)\n Thread.sleep(forTimeInterval: 0.02)\n }\n let end = path.last ?? first\n mouseEvent(\n .leftMouseUp, CGPoint(x: end[\"x\"]?.doubleValue ?? 0, y: end[\"y\"]?.doubleValue ?? 0), .left)\n }\ncase \"scroll\":\n if let x = input[\"x\"] as? NSNumber, let y = input[\"y\"] as? NSNumber {\n mouseEvent(.mouseMoved, CGPoint(x: x.doubleValue, y: y.doubleValue), .left)\n }\n let horizontal = Int32((input[\"scrollX\"] as? NSNumber)?.intValue ?? 0)\n let vertical = Int32((input[\"scrollY\"] as? NSNumber)?.intValue ?? 0)\n withKeys(heldKeys) {\n CGEvent(\n scrollWheelEvent2Source: nil, units: .line, wheelCount: 2, wheel1: -vertical,\n wheel2: -horizontal, wheel3: 0)?.post(tap: .cghidEventTap)\n }\ncase \"key\", \"hold_key\":\n let names = keys()\n if names.isEmpty { fail(\"No keys supplied.\") }\n for name in names { keyEvent(name, true) }\n if action == \"hold_key\" {\n Thread.sleep(forTimeInterval: (input[\"duration\"] as? NSNumber)?.doubleValue ?? 0)\n }\n for name in names.reversed() { keyEvent(name, false) }\ncase \"type\":\n let text = input[\"text\"] as? String ?? \"\"\n let units = Array(text.utf16)\n units.withUnsafeBufferPointer { buffer in\n guard let down = CGEvent(keyboardEventSource: nil, virtualKey: 0, keyDown: true),\n let up = CGEvent(keyboardEventSource: nil, virtualKey: 0, keyDown: false)\n else {\n fail(\"Unable to create text input events.\")\n }\n down.keyboardSetUnicodeString(stringLength: units.count, unicodeString: buffer.baseAddress)\n up.keyboardSetUnicodeString(stringLength: units.count, unicodeString: buffer.baseAddress)\n down.post(tap: .cghidEventTap)\n up.post(tap: .cghidEventTap)\n }\ndefault:\n fail(\"Unsupported action: \" + action)\n}\n";
5762
+ declare const WINDOWS_PWSH_SNIPPET = "\n$ErrorActionPreference = 'Stop';\nAdd-Type -AssemblyName System.Drawing;\nAdd-Type -AssemblyName System.Windows.Forms;\n$bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds;\n$bitmap = New-Object System.Drawing.Bitmap $bounds.Width, $bounds.Height;\n$graphics = [System.Drawing.Graphics]::FromImage($bitmap);\n$graphics.CopyFromScreen($bounds.X, $bounds.Y, 0, 0, $bounds.Size);\n$bitmap.Save($env:SWIFTY_SCREENSHOT_PATH, [System.Drawing.Imaging.ImageFormat]::Png);\n$graphics.Dispose(); $bitmap.Dispose();\nWrite-Output \"$($bounds.Width),$($bounds.Height)\"\n";
5763
+ declare const WINDOWS_CSHARP_SNIPPET = "\nusing System;\nusing System.Drawing;\nusing System.Runtime.InteropServices;\nusing System.Windows.Forms;\n\npublic static class SwiftyComputer\n{\n [StructLayout(LayoutKind.Sequential)]\n private struct INPUT { public uint type; public InputUnion value; }\n [StructLayout(LayoutKind.Explicit)]\n private struct InputUnion { [FieldOffset(0)] public KEYBDINPUT keyboard; }\n [StructLayout(LayoutKind.Sequential)]\n private struct KEYBDINPUT\n {\n public ushort virtualKey;\n public ushort scanCode;\n public uint flags;\n public uint time;\n public UIntPtr extraInfo;\n }\n\n [DllImport(\"user32.dll\")]\n private static extern void mouse_event(uint flags, uint dx, uint dy, int data, UIntPtr extraInfo);\n [DllImport(\"user32.dll\", SetLastError = true)]\n private static extern uint SendInput(uint count, INPUT[] inputs, int size);\n\n private static void SendKeyboard(ushort virtualKey, ushort scanCode, uint flags)\n {\n var inputs = new[] {\n new INPUT {\n type = 1,\n value = new InputUnion {\n keyboard = new KEYBDINPUT {\n virtualKey = virtualKey,\n scanCode = scanCode,\n flags = flags,\n extraInfo = UIntPtr.Zero\n }\n }\n }\n };\n if (SendInput(1, inputs, Marshal.SizeOf(typeof(INPUT))) != 1)\n {\n throw new InvalidOperationException(\"SendInput failed.\");\n }\n }\n\n public static void Move(int x, int y) { Cursor.Position = new Point(x, y); }\n public static Point Position() { return Cursor.Position; }\n public static void Mouse(uint flags, int data = 0) { mouse_event(flags, 0, 0, data, UIntPtr.Zero); }\n public static void Key(int virtualKey, bool down) { SendKeyboard((ushort)virtualKey, 0, down ? 0u : 2u); }\n public static void Text(string text)\n {\n foreach (char value in text)\n {\n SendKeyboard(0, value, 4u);\n SendKeyboard(0, value, 6u);\n }\n }\n}\n";
5764
+ declare const WINDOWS_PWSH_INCLUDES_CSHARP_SNIPPET = "\n$ErrorActionPreference = 'Stop'\nAdd-Type -AssemblyName System.Drawing\nAdd-Type -AssemblyName System.Windows.Forms\nAdd-Type -TypeDefinition @'\n\nusing System;\nusing System.Drawing;\nusing System.Runtime.InteropServices;\nusing System.Windows.Forms;\n\npublic static class SwiftyComputer\n{\n [StructLayout(LayoutKind.Sequential)]\n private struct INPUT { public uint type; public InputUnion value; }\n [StructLayout(LayoutKind.Explicit)]\n private struct InputUnion { [FieldOffset(0)] public KEYBDINPUT keyboard; }\n [StructLayout(LayoutKind.Sequential)]\n private struct KEYBDINPUT\n {\n public ushort virtualKey;\n public ushort scanCode;\n public uint flags;\n public uint time;\n public UIntPtr extraInfo;\n }\n\n [DllImport(\"user32.dll\")]\n private static extern void mouse_event(uint flags, uint dx, uint dy, int data, UIntPtr extraInfo);\n [DllImport(\"user32.dll\", SetLastError = true)]\n private static extern uint SendInput(uint count, INPUT[] inputs, int size);\n\n private static void SendKeyboard(ushort virtualKey, ushort scanCode, uint flags)\n {\n var inputs = new[] {\n new INPUT {\n type = 1,\n value = new InputUnion {\n keyboard = new KEYBDINPUT {\n virtualKey = virtualKey,\n scanCode = scanCode,\n flags = flags,\n extraInfo = UIntPtr.Zero\n }\n }\n }\n };\n if (SendInput(1, inputs, Marshal.SizeOf(typeof(INPUT))) != 1)\n {\n throw new InvalidOperationException(\"SendInput failed.\");\n }\n }\n\n public static void Move(int x, int y) { Cursor.Position = new Point(x, y); }\n public static Point Position() { return Cursor.Position; }\n public static void Mouse(uint flags, int data = 0) { mouse_event(flags, 0, 0, data, UIntPtr.Zero); }\n public static void Key(int virtualKey, bool down) { SendKeyboard((ushort)virtualKey, 0, down ? 0u : 2u); }\n public static void Text(string text)\n {\n foreach (char value in text)\n {\n SendKeyboard(0, value, 4u);\n SendKeyboard(0, value, 6u);\n }\n }\n}\n\n'@\n\n$payload = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($env:SWIFTY_COMPUTER_INPUT)) | ConvertFrom-Json\nfunction Resolve-Key([string]$name) {\n switch ($name.ToUpperInvariant()) {\n 'CTRL' { return 0x11 }\n 'CONTROL' { return 0x11 }\n 'SHIFT' { return 0x10 }\n 'ALT' { return 0x12 }\n 'OPTION' { return 0x12 }\n 'CMD' { return 0x5B }\n 'COMMAND' { return 0x5B }\n 'META' { return 0x5B }\n 'WIN' { return 0x5B }\n 'WINDOWS' { return 0x5B }\n 'ENTER' { return 0x0D }\n 'RETURN' { return 0x0D }\n 'ESC' { return 0x1B }\n 'ESCAPE' { return 0x1B }\n 'BACKSPACE' { return 0x08 }\n 'DELETE' { return 0x2E }\n 'TAB' { return 0x09 }\n 'SPACE' { return 0x20 }\n 'LEFT' { return 0x25 }\n 'UP' { return 0x26 }\n 'RIGHT' { return 0x27 }\n 'DOWN' { return 0x28 }\n 'HOME' { return 0x24 }\n 'END' { return 0x23 }\n 'PAGEUP' { return 0x21 }\n 'PAGEDOWN' { return 0x22 }\n default {\n if ($name.Length -eq 1) { return [int][char]$name.ToUpperInvariant() }\n try { return [int]([System.Enum]::Parse([System.Windows.Forms.Keys], $name, $true)) }\n catch { throw \"Unsupported key: $name\" }\n }\n }\n}\nfunction Key-Down($keys) { foreach ($key in $keys) { [SwiftyComputer]::Key((Resolve-Key $key), $true) } }\nfunction Key-Up($keys) { for ($i = $keys.Count - 1; $i -ge 0; $i--) { [SwiftyComputer]::Key((Resolve-Key $keys[$i]), $false) } }\nfunction Move-To($value) {\n $bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds\n [SwiftyComputer]::Move($bounds.X + [int]$value.x, $bounds.Y + [int]$value.y)\n}\n\n$keys = @($payload.keys)\nswitch ($payload.action) {\n 'cursor_position' {\n $bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds\n $point = [SwiftyComputer]::Position()\n Write-Output \"$(($point.X - $bounds.X)),$(($point.Y - $bounds.Y))\"\n }\n 'mouse_move' { Key-Down $keys; Move-To $payload; Key-Up $keys }\n 'left_mouse_down' { [SwiftyComputer]::Mouse(0x0002) }\n 'left_mouse_up' { [SwiftyComputer]::Mouse(0x0004) }\n 'mouse_click' {\n Move-To $payload\n Key-Down $keys\n $down = switch ($payload.button) { 'right' { 0x0008 } 'middle' { 0x0020 } default { 0x0002 } }\n $up = switch ($payload.button) { 'right' { 0x0010 } 'middle' { 0x0040 } default { 0x0004 } }\n for ($i = 0; $i -lt [int]$payload.clicks; $i++) {\n [SwiftyComputer]::Mouse($down); [SwiftyComputer]::Mouse($up); Start-Sleep -Milliseconds 80\n }\n Key-Up $keys\n }\n 'left_click_drag' {\n Key-Down $keys\n Move-To $payload.path[0]\n [SwiftyComputer]::Mouse(0x0002)\n foreach ($point in $payload.path | Select-Object -Skip 1) { Move-To $point; Start-Sleep -Milliseconds 20 }\n [SwiftyComputer]::Mouse(0x0004)\n Key-Up $keys\n }\n 'scroll' {\n if ($null -ne $payload.x -and $null -ne $payload.y) { Move-To $payload }\n Key-Down $keys\n [SwiftyComputer]::Mouse(0x0800, - ([int]$payload.scrollY * 120))\n [SwiftyComputer]::Mouse(0x01000, [int]$payload.scrollX * 120)\n Key-Up $keys\n }\n 'key' { Key-Down $keys; Key-Up $keys }\n 'hold_key' { Key-Down $keys; Start-Sleep -Milliseconds ([int]([double]$payload.duration * 1000)); Key-Up $keys }\n 'type' { [SwiftyComputer]::Text([string]$payload.text) }\n default { throw \"Unsupported action: $($payload.action)\" }\n}\n";
5765
+
5703
5766
  /**
5704
5767
  * Copyright (c) 2026 hangtiancheng
5705
5768
  *
@@ -5973,7 +6036,12 @@ declare function useTeammateStates(manager: TeamManager): {
5973
6036
  status: "completed" | "failed" | "running" | "idle" | "stopped";
5974
6037
  progress: {
5975
6038
  toolUseCount: number;
6039
+ turnCount: number;
5976
6040
  tokenCount: number;
6041
+ activeTools: {
6042
+ toolId: string;
6043
+ toolName: string;
6044
+ }[];
5977
6045
  recentActivities: {
5978
6046
  toolName: string;
5979
6047
  input: Record<string, unknown>;
@@ -5987,6 +6055,7 @@ declare function useTeammateStates(manager: TeamManager): {
5987
6055
  };
5988
6056
  startTime: number;
5989
6057
  spinnerVerb: string;
6058
+ originToolCallId?: string | undefined;
5990
6059
  lastMessage?: string | undefined;
5991
6060
  }[];
5992
6061
 
@@ -6014,6 +6083,7 @@ declare function useTeammateStates(manager: TeamManager): {
6014
6083
  /** Resolve symlinks even when the final file or some parent directories do not exist yet. */
6015
6084
  declare function canonicalPath(path: string): string;
6016
6085
  declare function isPathWithin(root: string, path: string): boolean;
6086
+ declare function compactPath(path: string): string;
6017
6087
 
6018
6088
  /**
6019
6089
  * Copyright (c) 2026 hangtiancheng
@@ -6302,6 +6372,8 @@ declare function runPrintMode(args: PrintArgs): Promise<void>;
6302
6372
  declare function record(text: string): void;
6303
6373
  /** Records an exception with its full stack trace. `context` identifies the originating layer. */
6304
6374
  declare function recordError(context: string, error: unknown): void;
6375
+ /** True when `err` is a write failure caused by the terminal or its reader vanishing. */
6376
+ declare function isTerminalGone(err: unknown): boolean;
6305
6377
  /**
6306
6378
  * Writes the exit marker; subsequent calls are no-ops.
6307
6379
  *
@@ -6318,6 +6390,11 @@ declare function recordExit(code: number | string): void;
6318
6390
  * to the top of the event loop (which would otherwise only print to the terminal
6319
6391
  * and be lost once it closes). Together they determine the exit mode:
6320
6392
  * crash + exit → crashed; start + exit only → clean shutdown; start only → killed externally.
6393
+ *
6394
+ * A terminal that disappears under a live session (window closed, VS Code main
6395
+ * process dying, ssh dropped) fails every later write with EIO/EPIPE. Those are
6396
+ * recorded as a single `terminal closed` line and exit 0, so they read as a
6397
+ * clean shutdown rather than a crash; see `isTerminalGone`.
6321
6398
  */
6322
6399
  declare function recover(): void;
6323
6400
 
@@ -6400,4 +6477,4 @@ declare function runTeammate(args: TeammateArgs): Promise<void>;
6400
6477
  */
6401
6478
  declare const version: string;
6402
6479
 
6403
- export { ASYNC_AGENT_ALLOWED_TOOLS, type ActivityStatus, 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, DARK_THEME, DEFAULT_CONTEXT_WINDOW, DEFAULT_EAGER_THRESHOLD_PERCENT, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_THINKING_LEVEL, type Decision, type DecisionEffect, type DetectedIde, type DiffResult, type DiscoveredModel, 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, ICONS, INTERRUPTED_TOOL_RESULT, type IdeAtMention, type IdeConnection, ImageTooLargeError, InstallSkillTool, type InstructionSource, type InteractionSummary, type KeptMessage, LIGHT_THEME, type LLMClient, LLMError, ListTeamsTool, LoadSkillTool, MAIN_AGENT_ONLY_TOOLS, MAX_DIMENSION_PX, MAX_HISTORY_ENTRIES, MAX_IMAGES_PER_MESSAGE, MAX_IMAGE_BYTES_PASSTHROUGH, MAX_SHELL_OUTPUT_BYTES, MCPClient, MCPManager, type MCPServerConfig, type MCPTool, type MCPToolLike, MCPToolWrapper, MCP_INSTRUCTIONS_MARKER, 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 McpInstruction, type McpInstructionSource, type McpLoadingMode, type Member, MemoryConsolidator, MemoryExtractor, type MemoryFile, type MemoryHeader, MemoryManager, MemoryPermissionChecker, 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, ProviderLoginSchema, type ProviderNativeToolSchema, type ProviderToolSchema, type Question, type QuestionOption, READ_FILE_DESCRIPTION, REJECTED_TOOL_RESULT, RateLimitError, ReadFileTool, type RecallResult, type ReconcileResult, RecoveryState, type RelevantMemory, type ReminderHistory, type RemoteAgentHandle, RemoteServer, type RestoredMessage, type ReviewComment, type ReviewRequest, ReviewSession, type ReviewSummary, RuleEngine, type RunAgent, type RunCallbacks, SHUTDOWN_PREFIX, SKIP_DIRS, SUBAGENT_DISALLOWED_TOOLS, SUMMARY_INSTRUCTIONS, 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 StoredTask, type StoredTaskStatus, type StreamEvent, StreamingExecutor, type SubagentRunOptions, SyntheticOutputTool, TEAMMATE_DISALLOWED_TOOLS, THEME, THINKING_BUDGETS, THINKING_LEVELS, TOOL_RESULT_PREVIEW_CHARS, type Task, TaskCreateTool, TaskGetTool, TaskList, TaskListTool, TaskManager, TaskStopTool, TaskStore, type TaskUpdateFields, TaskUpdateTool, Team, TeamCreateTool, TeamDeleteTool, type TeamFile, TeamManager, type TeamMemberEntry, TeamMemberEntrySchema, type TeamMode, TeamTaskCreateTool, TeamTaskGetTool, TeamTaskListTool, TeamTaskUpdateTool, type TeammateUIState, TeammateUIStateSchema, type ThemePalette, 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, activityStatusColor, append, applyBudget, applyMode, approved, asCriticEvaluation, asError, asErrorString, asImageMediaType, asRecord, asString, boolArg, buildAnthropicMessages, buildChatCompletionMessages, buildCompactionSummaryMessage, buildComposedToolFilter, buildDiff, buildMcpToolName, buildOpenAIInput, buildPlanModeExitReminder, buildPlanModeReentryReminder, buildPlanModeReminder, buildSkillSection, buildSubagentInstructions, buildSummaryInstructions, buildSummaryPrompt, buildSystemPrompt, buildTeammatePrompt, buildTeammateRegistry, buildWorktreeNotice, canonicalPath, clampThinkingLevel, cleanExpiredSessions, clipboardImageFileName, cloneRegistryForFork, closeLogger, coerceBySchema, computeCompactThreshold, computeKeepStartIndex, connectToIde, contentToText, coordinatorActive, coordinatorReminder, coordinatorToolFilter, countMcpTools, createAgentWorktree, createChildLogger, createClient, createDefaultCodeReviewTeam, createDefaultRegistry, createModelResolver, createProgress, createRemoteAgent, createSandbox, createToolRegistry, currentContextTokens, decideAndApply, decideMode, detectBackend, detectBackendFromEnv, detectEnvironment, detectIde, discoverInstructions, discoverModels, doingTasksSection, ensureToolPairing, environmentSection, escapeSkillXml, estimateMessages, estimateSchemaTokens, estimateTokens, evaluateRules, executingActionsSection, expandAtRefs, expandAtRefsWithImages, expandMcpServerConfigEnvironment, extractContent, extractWrittenPaths, fetchModelContextWindow, fileHistoryDir, filterToolsForAgent, forceCompact, forkEnabled, formatInteractionSummary, formatShellOutput, formatTokens, formatToolArgs, getContextWindow, getCurrentBranch, getCurrentPlanPath, getMaxOutputTokens, getMediaType, getNameRegistry, getOrCreatePlanPath, getSessionFilePath, getSupportedThinkingLevels, getThinkingLevel, globalConfigPath, handleCodeReviewCommand, hasWorktreeChanges, identitySection, initLogger, intArg, isCoordinatorTool, isCriticEvaluation, isDiffTool, isImagePath, isMcpToolLike, isObject, isOfficialAnthropicEndpoint, isPathWithin, isPngBuffer, isRecord, isSafeCommand, isShutdownRequest, isSpillReadback, isToolResultContentBlock, isValidThinkingLevel, listSessions, load, loadAgentDefinitions, loadConfig, loadImageAttachment, loadInstructions, loadPlan, loadProjectMcpServers, loadSession, loadTranscript, loadUserCommands, logger, manageContext, markLastUserTailForCache, markToolsForCache, maybeResizeAndDownsampleImage, mcpCallPermissionContent, mcpContentToToolOutput, mcpToolNamePrefix, measureSchemaChars, memoryAge, memoryAgeDays, memoryFreshnessText, modelListUrl, needsToolSearchBeta, newRequestId, newSessionId, normalizeToolResultContentBlock, outputEfficiencySection, parse, parsePrintFlags, parseRemoteAddress, parseSkillFile, parseSkillPrompt, parseTeammateFlags, persistLargeResult, persistThinkingLevel, planApprovalRequest, planApprovalResponse, planExists, randomCompletionVerb, randomVerb, readTeamFile, readWorktreeHeadSha, rebuildFromSession, record, recordError, recordExit, recordTokens, recordToolUse, recover, removeAgentWorktree, removeMcpTools, renderBody, replaceToolResultContent, resetPlanPath, resolveAPIKey, resolveGitDir, resolveModelId, restoreRemoteSession, runFork, runInline, runPrintMode, runTeammate, safeJSONParse, sanitizeNameSegment, sanitizeSegment, sanitizeTeamName, saveClipboardImage, saveCompactBoundary, saveMessage, savePlan, saveProvider, saveTranscript, setThemeMode, shutdownRequest, shutdownResponse, sniffMediaType, spawnSubagent, spawnTeammate, storeClipboardImage, strArg, strList, summarizeActivities, syncMcpInstructions, systemSection, takeUtf8Prefix, teamConfigPath, teamDir, teamsBaseDir, thinkingBudgetForLevel, thinkingLevelColor, toAnthropicThinkingEffort, toDisplayPreview, toReasoningEffort, toTry, toneStyleSection, toolResultsToRecords, toolUsesToRecords, useFollowUpQueue, useIdeInput, useTeammateStates, usingToolsSection, utf8ByteLength, validate, version, wireSkillsToRegistry, withFileMutationQueue, withProjectMcpServers, withProviderDefaults, writeTeamFile };
6480
+ export { ASYNC_AGENT_ALLOWED_TOOLS, type ActiveTool, ActiveToolSchema, type ActivityStatus, Agent, type AgentConfig, type AgentDefinition, type AgentEvent, type AgentEventCallback, AgentEventLogger, type AgentEventSink, type AgentProgress, AgentProgressSchema, type AgentTask, type AgentTaskStatus, 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 CreateRemoteAgentOptions, type CriticAssessment, type CriticEvaluation, DARK_THEME, DEFAULT_CONTEXT_WINDOW, DEFAULT_EAGER_THRESHOLD_PERCENT, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_THINKING_LEVEL, type Decision, type DecisionEffect, type DetectedIde, type DiffResult, type DiscoveredModel, 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, ICONS, INTERRUPTED_TOOL_RESULT, type IdeAtMention, type IdeConnection, ImageTooLargeError, InstallSkillTool, type InstructionSource, type InteractionSummary, type KeptMessage, LIGHT_THEME, type LLMClient, LLMError, ListTeamsTool, LoadSkillTool, MACOS_SNIPPET, MAIN_AGENT_ONLY_TOOLS, MAX_DIMENSION_PX, MAX_HISTORY_ENTRIES, MAX_IMAGES_PER_MESSAGE, MAX_IMAGE_BYTES_PASSTHROUGH, MAX_SHELL_OUTPUT_BYTES, MCPClient, MCPManager, type MCPServerConfig, type MCPTool, type MCPToolLike, MCPToolWrapper, MCP_INSTRUCTIONS_MARKER, 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 McpInstruction, type McpInstructionSource, type McpLoadingMode, type Member, MemoryConsolidator, MemoryExtractor, type MemoryFile, type MemoryHeader, MemoryManager, MemoryPermissionChecker, type Message, NATIVE_TOOL_USE_BETA, NameRegistry, NetworkError, OpenAIClient, OpenAICompatClient, type OpenAICompatToolSchema, type OpenAIMessageParam, type OpenAIResponsesToolSchema, POWERSHELL_DESCRIPTION, PathSandbox, PermissionChecker, type PermissionMode, type PermissionRequestHandler, PowerShellTool, type PrintArgs, PromptBuilder, type ProviderConfig, ProviderConfigSchema, ProviderLoginSchema, type ProviderNativeToolSchema, type ProviderToolSchema, type Question, type QuestionOption, READ_FILE_DESCRIPTION, REJECTED_TOOL_RESULT, RateLimitError, ReadFileTool, type RecallResult, type ReconcileResult, RecoveryState, type RelevantMemory, type ReminderHistory, type RemoteAgentHandle, RemoteServer, type RestoredMessage, type ReviewComment, type ReviewRequest, ReviewSession, type ReviewSummary, RuleEngine, type RunAgent, type RunCallbacks, SHUTDOWN_PREFIX, SKIP_DIRS, SUBAGENT_DISALLOWED_TOOLS, SUBAGENT_INTERRUPTED_MARKER, SUMMARY_INSTRUCTIONS, 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 StoredTask, type StoredTaskStatus, type StreamEvent, StreamingExecutor, type SubagentProgressEvent, type SubagentRunOptions, SyntheticOutputTool, TEAMMATE_DISALLOWED_TOOLS, THEME, THINKING_BUDGETS, THINKING_LEVELS, TOOL_RESULT_PREVIEW_CHARS, type Task, TaskCreateTool, TaskGetTool, TaskList, TaskListTool, TaskManager, TaskStopTool, TaskStore, type TaskUpdateFields, TaskUpdateTool, Team, TeamCreateTool, TeamDeleteTool, type TeamFile, TeamManager, type TeamMemberEntry, TeamMemberEntrySchema, type TeamMode, TeamTaskCreateTool, TeamTaskGetTool, TeamTaskListTool, TeamTaskUpdateTool, type TeammateUIState, TeammateUIStateSchema, type ThemePalette, 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, WEB_FETCH_DESCRIPTION, WINDOWS_CSHARP_SNIPPET, WINDOWS_PWSH_INCLUDES_CSHARP_SNIPPET, WINDOWS_PWSH_SNIPPET, WRITE_FILE_DESCRIPTION, WebSocketTransport, type WorktreeResult, WriteFileTool, activityStatusColor, append, applyBudget, applyMode, approved, asCriticEvaluation, asError, asErrorString, asImageMediaType, asRecord, asString, boolArg, buildAnthropicMessages, buildChatCompletionMessages, buildCompactionSummaryMessage, buildComposedToolFilter, buildDiff, buildMcpToolName, buildOpenAIInput, buildPlanModeExitReminder, buildPlanModeReentryReminder, buildPlanModeReminder, buildSkillSection, buildSubagentInstructions, buildSummaryInstructions, buildSummaryPrompt, buildSystemPrompt, buildTeammatePrompt, buildTeammateRegistry, buildWorktreeNotice, canonicalPath, clampThinkingLevel, cleanExpiredSessions, clearActiveTools, clipboardImageFileName, cloneRegistryForFork, closeLogger, coerceBySchema, compactPath, computeCompactThreshold, computeKeepStartIndex, connectToIde, contentToText, coordinatorActive, coordinatorReminder, coordinatorToolFilter, countMcpTools, createAgentWorktree, createChildLogger, createClient, createDefaultCodeReviewTeam, createDefaultRegistry, createModelResolver, createProgress, createRemoteAgent, createSandbox, createToolRegistry, currentContextTokens, decideAndApply, decideMode, detectBackend, detectBackendFromEnv, detectEnvironment, detectIde, discoverInstructions, discoverModels, doingTasksSection, ensureToolPairing, environmentSection, escapeSkillXml, estimateMessages, estimateSchemaTokens, estimateTokens, evaluateRules, executingActionsSection, expandAtRefs, expandAtRefsWithImages, expandMcpServerConfigEnvironment, extractContent, extractWrittenPaths, fetchModelContextWindow, fileHistoryDir, filterToolsForAgent, forceCompact, forkEnabled, formatAgentTaskNotification, formatInteractionSummary, formatShellOutput, formatTokens, formatToolArgs, getContextWindow, getCurrentBranch, getCurrentPlanPath, getMaxOutputTokens, getMediaType, getNameRegistry, getOrCreatePlanPath, getSessionFilePath, getSupportedThinkingLevels, getThinkingLevel, globalConfigPath, handleCodeReviewCommand, hasWorktreeChanges, identitySection, initLogger, intArg, isCoordinatorTool, isCriticEvaluation, isDiffTool, isImagePath, isMcpToolLike, isObject, isOfficialAnthropicEndpoint, isPathWithin, isPngBuffer, isRecord, isSafeCommand, isShutdownRequest, isSpillReadback, isTerminalGone, isToolResultContentBlock, isValidThinkingLevel, listSessions, listTeamNames, load, loadAgentDefinitions, loadConfig, loadImageAttachment, loadInstructions, loadPlan, loadProjectMcpServers, loadSession, loadTranscript, loadUserCommands, logger, manageContext, markLastUserTailForCache, markToolsForCache, maybeResizeAndDownsampleImage, mcpCallPermissionContent, mcpContentToToolOutput, mcpToolNamePrefix, measureSchemaChars, memoryAge, memoryAgeDays, memoryFreshnessText, modelListUrl, needsToolSearchBeta, newRequestId, newSessionId, normalizeToolResultContentBlock, outputEfficiencySection, parse, parsePrintFlags, parseRemoteAddress, parseSkillFile, parseSkillPrompt, parseTeammateFlags, persistLargeResult, persistThinkingLevel, planApprovalRequest, planApprovalResponse, planExists, randomCompletionVerb, randomVerb, readTeamFile, readWorktreeHeadSha, rebuildFromSession, record, recordError, recordExit, recordTokens, recordToolResult, recordToolStart, recordToolUse, recordTurnComplete, recover, removeAgentWorktree, removeMcpTools, renderBody, replaceToolResultContent, resetPlanPath, resolveAPIKey, resolveGitDir, resolveModelId, restoreRemoteSession, runFork, runInline, runPrintMode, runTeammate, safeJSONParse, sanitizeNameSegment, sanitizeSegment, sanitizeTeamName, saveClipboardImage, saveCompactBoundary, saveMessage, savePlan, saveProvider, saveTranscript, setThemeMode, shutdownRequest, shutdownResponse, sniffMediaType, spawnSubagent, spawnTeammate, storeClipboardImage, strArg, strList, summarizeActivities, syncMcpInstructions, systemSection, takeUtf8Prefix, teamConfigPath, teamDir, teamsBaseDir, thinkingBudgetForLevel, thinkingLevelColor, toAnthropicThinkingEffort, toDisplayPreview, toReasoningEffort, toTry, toneStyleSection, toolResultsToRecords, toolUsesToRecords, useFollowUpQueue, useIdeInput, useTeammateStates, usingToolsSection, utf8ByteLength, validate, version, wireSkillsToRegistry, withFileMutationQueue, withProjectMcpServers, withProviderDefaults, writeTeamFile };