@rithamnatani/agentmux 1.5.39

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 (235) hide show
  1. package/README.md +440 -0
  2. package/dist/clientFilter.d.ts +5 -0
  3. package/dist/clientFilter.d.ts.map +1 -0
  4. package/dist/clientFilter.js +31 -0
  5. package/dist/clientFilter.js.map +1 -0
  6. package/dist/config.d.ts +28 -0
  7. package/dist/config.d.ts.map +1 -0
  8. package/dist/config.js +112 -0
  9. package/dist/config.js.map +1 -0
  10. package/dist/constants.d.ts +115 -0
  11. package/dist/constants.d.ts.map +1 -0
  12. package/dist/constants.js +118 -0
  13. package/dist/constants.js.map +1 -0
  14. package/dist/execution.d.ts +23 -0
  15. package/dist/execution.d.ts.map +1 -0
  16. package/dist/execution.js +2 -0
  17. package/dist/execution.js.map +1 -0
  18. package/dist/httpServer.d.ts +12 -0
  19. package/dist/httpServer.d.ts.map +1 -0
  20. package/dist/httpServer.js +323 -0
  21. package/dist/httpServer.js.map +1 -0
  22. package/dist/index.d.ts +3 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +98 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/logger.d.ts +19 -0
  27. package/dist/logger.d.ts.map +1 -0
  28. package/dist/logger.js +172 -0
  29. package/dist/logger.js.map +1 -0
  30. package/dist/modelCatalog.d.ts +15 -0
  31. package/dist/modelCatalog.d.ts.map +1 -0
  32. package/dist/modelCatalog.generated.json +80 -0
  33. package/dist/modelCatalog.js +81 -0
  34. package/dist/modelCatalog.js.map +1 -0
  35. package/dist/router/config.d.ts +13 -0
  36. package/dist/router/config.d.ts.map +1 -0
  37. package/dist/router/config.js +198 -0
  38. package/dist/router/config.js.map +1 -0
  39. package/dist/router/defaultConfig.d.ts +13 -0
  40. package/dist/router/defaultConfig.d.ts.map +1 -0
  41. package/dist/router/defaultConfig.js +82 -0
  42. package/dist/router/defaultConfig.js.map +1 -0
  43. package/dist/router/executor.d.ts +35 -0
  44. package/dist/router/executor.d.ts.map +1 -0
  45. package/dist/router/executor.js +189 -0
  46. package/dist/router/executor.js.map +1 -0
  47. package/dist/router/modelMetadata.d.ts +5 -0
  48. package/dist/router/modelMetadata.d.ts.map +1 -0
  49. package/dist/router/modelMetadata.js +81 -0
  50. package/dist/router/modelMetadata.js.map +1 -0
  51. package/dist/router/quota.d.ts +4 -0
  52. package/dist/router/quota.d.ts.map +1 -0
  53. package/dist/router/quota.js +5 -0
  54. package/dist/router/quota.js.map +1 -0
  55. package/dist/router/router.d.ts +3 -0
  56. package/dist/router/router.d.ts.map +1 -0
  57. package/dist/router/router.js +141 -0
  58. package/dist/router/router.js.map +1 -0
  59. package/dist/router/types.d.ts +86 -0
  60. package/dist/router/types.d.ts.map +1 -0
  61. package/dist/router/types.js +2 -0
  62. package/dist/router/types.js.map +1 -0
  63. package/dist/routerConfig.d.ts +14 -0
  64. package/dist/routerConfig.d.ts.map +1 -0
  65. package/dist/routerConfig.js +194 -0
  66. package/dist/routerConfig.js.map +1 -0
  67. package/dist/serverApp.d.ts +43 -0
  68. package/dist/serverApp.d.ts.map +1 -0
  69. package/dist/serverApp.js +618 -0
  70. package/dist/serverApp.js.map +1 -0
  71. package/dist/service/bootstrap.d.ts +3 -0
  72. package/dist/service/bootstrap.d.ts.map +1 -0
  73. package/dist/service/bootstrap.js +32 -0
  74. package/dist/service/bootstrap.js.map +1 -0
  75. package/dist/service/manager.d.ts +6 -0
  76. package/dist/service/manager.d.ts.map +1 -0
  77. package/dist/service/manager.js +318 -0
  78. package/dist/service/manager.js.map +1 -0
  79. package/dist/service/paths.d.ts +10 -0
  80. package/dist/service/paths.d.ts.map +1 -0
  81. package/dist/service/paths.js +57 -0
  82. package/dist/service/paths.js.map +1 -0
  83. package/dist/service/renderers.d.ts +7 -0
  84. package/dist/service/renderers.d.ts.map +1 -0
  85. package/dist/service/renderers.js +110 -0
  86. package/dist/service/renderers.js.map +1 -0
  87. package/dist/service/runtime.d.ts +14 -0
  88. package/dist/service/runtime.d.ts.map +1 -0
  89. package/dist/service/runtime.js +129 -0
  90. package/dist/service/runtime.js.map +1 -0
  91. package/dist/service/types.d.ts +33 -0
  92. package/dist/service/types.d.ts.map +1 -0
  93. package/dist/service/types.js +2 -0
  94. package/dist/service/types.js.map +1 -0
  95. package/dist/taskClientPolicy.d.ts +16 -0
  96. package/dist/taskClientPolicy.d.ts.map +1 -0
  97. package/dist/taskClientPolicy.js +44 -0
  98. package/dist/taskClientPolicy.js.map +1 -0
  99. package/dist/taskStore.d.ts +12 -0
  100. package/dist/taskStore.d.ts.map +1 -0
  101. package/dist/taskStore.js +30 -0
  102. package/dist/taskStore.js.map +1 -0
  103. package/dist/tierConfig.d.ts +16 -0
  104. package/dist/tierConfig.d.ts.map +1 -0
  105. package/dist/tierConfig.js +70 -0
  106. package/dist/tierConfig.js.map +1 -0
  107. package/dist/tools/ask-claude.tool.d.ts +3 -0
  108. package/dist/tools/ask-claude.tool.d.ts.map +1 -0
  109. package/dist/tools/ask-claude.tool.js +30 -0
  110. package/dist/tools/ask-claude.tool.js.map +1 -0
  111. package/dist/tools/ask-codex.tool.d.ts +3 -0
  112. package/dist/tools/ask-codex.tool.d.ts.map +1 -0
  113. package/dist/tools/ask-codex.tool.js +29 -0
  114. package/dist/tools/ask-codex.tool.js.map +1 -0
  115. package/dist/tools/ask-cursor.tool.d.ts +3 -0
  116. package/dist/tools/ask-cursor.tool.d.ts.map +1 -0
  117. package/dist/tools/ask-cursor.tool.js +30 -0
  118. package/dist/tools/ask-cursor.tool.js.map +1 -0
  119. package/dist/tools/ask-gemini.tool.d.ts +3 -0
  120. package/dist/tools/ask-gemini.tool.d.ts.map +1 -0
  121. package/dist/tools/ask-gemini.tool.js +40 -0
  122. package/dist/tools/ask-gemini.tool.js.map +1 -0
  123. package/dist/tools/ask-opencode.tool.d.ts +3 -0
  124. package/dist/tools/ask-opencode.tool.d.ts.map +1 -0
  125. package/dist/tools/ask-opencode.tool.js +29 -0
  126. package/dist/tools/ask-opencode.tool.js.map +1 -0
  127. package/dist/tools/ask-router.tool.d.ts +20 -0
  128. package/dist/tools/ask-router.tool.d.ts.map +1 -0
  129. package/dist/tools/ask-router.tool.js +550 -0
  130. package/dist/tools/ask-router.tool.js.map +1 -0
  131. package/dist/tools/fetch-chunk.tool.d.ts +3 -0
  132. package/dist/tools/fetch-chunk.tool.d.ts.map +1 -0
  133. package/dist/tools/fetch-chunk.tool.js +58 -0
  134. package/dist/tools/fetch-chunk.tool.js.map +1 -0
  135. package/dist/tools/get-run.tool.d.ts +3 -0
  136. package/dist/tools/get-run.tool.d.ts.map +1 -0
  137. package/dist/tools/get-run.tool.js +53 -0
  138. package/dist/tools/get-run.tool.js.map +1 -0
  139. package/dist/tools/important-read-now.tool.d.ts +3 -0
  140. package/dist/tools/important-read-now.tool.d.ts.map +1 -0
  141. package/dist/tools/important-read-now.tool.js +31 -0
  142. package/dist/tools/important-read-now.tool.js.map +1 -0
  143. package/dist/tools/index.d.ts +12 -0
  144. package/dist/tools/index.d.ts.map +1 -0
  145. package/dist/tools/index.js +59 -0
  146. package/dist/tools/index.js.map +1 -0
  147. package/dist/tools/opencode-copilot-usage.tool.d.ts +3 -0
  148. package/dist/tools/opencode-copilot-usage.tool.d.ts.map +1 -0
  149. package/dist/tools/opencode-copilot-usage.tool.js +85 -0
  150. package/dist/tools/opencode-copilot-usage.tool.js.map +1 -0
  151. package/dist/tools/recommend-route.tool.d.ts +3 -0
  152. package/dist/tools/recommend-route.tool.d.ts.map +1 -0
  153. package/dist/tools/recommend-route.tool.js +88 -0
  154. package/dist/tools/recommend-route.tool.js.map +1 -0
  155. package/dist/tools/registry.d.ts +31 -0
  156. package/dist/tools/registry.d.ts.map +1 -0
  157. package/dist/tools/registry.js +105 -0
  158. package/dist/tools/registry.js.map +1 -0
  159. package/dist/tools/simple-tools.d.ts +12 -0
  160. package/dist/tools/simple-tools.d.ts.map +1 -0
  161. package/dist/tools/simple-tools.js +121 -0
  162. package/dist/tools/simple-tools.js.map +1 -0
  163. package/dist/tools/test-tool.example.d.ts +13 -0
  164. package/dist/tools/test-tool.example.d.ts.map +1 -0
  165. package/dist/tools/test-tool.example.js +32 -0
  166. package/dist/tools/test-tool.example.js.map +1 -0
  167. package/dist/tools/tiered-request.tool.d.ts +3 -0
  168. package/dist/tools/tiered-request.tool.d.ts.map +1 -0
  169. package/dist/tools/tiered-request.tool.js +147 -0
  170. package/dist/tools/tiered-request.tool.js.map +1 -0
  171. package/dist/utils/changeModeChunker.d.ts +11 -0
  172. package/dist/utils/changeModeChunker.d.ts.map +1 -0
  173. package/dist/utils/changeModeChunker.js +89 -0
  174. package/dist/utils/changeModeChunker.js.map +1 -0
  175. package/dist/utils/changeModeParser.d.ts +15 -0
  176. package/dist/utils/changeModeParser.d.ts.map +1 -0
  177. package/dist/utils/changeModeParser.js +67 -0
  178. package/dist/utils/changeModeParser.js.map +1 -0
  179. package/dist/utils/changeModeTranslator.d.ts +8 -0
  180. package/dist/utils/changeModeTranslator.d.ts.map +1 -0
  181. package/dist/utils/changeModeTranslator.js +70 -0
  182. package/dist/utils/changeModeTranslator.js.map +1 -0
  183. package/dist/utils/chunkCache.d.ts +22 -0
  184. package/dist/utils/chunkCache.d.ts.map +1 -0
  185. package/dist/utils/chunkCache.js +147 -0
  186. package/dist/utils/chunkCache.js.map +1 -0
  187. package/dist/utils/claudeExecutor.d.ts +3 -0
  188. package/dist/utils/claudeExecutor.d.ts.map +1 -0
  189. package/dist/utils/claudeExecutor.js +21 -0
  190. package/dist/utils/claudeExecutor.js.map +1 -0
  191. package/dist/utils/cliDetector.d.ts +20 -0
  192. package/dist/utils/cliDetector.d.ts.map +1 -0
  193. package/dist/utils/cliDetector.js +95 -0
  194. package/dist/utils/cliDetector.js.map +1 -0
  195. package/dist/utils/codexExecutor.d.ts +3 -0
  196. package/dist/utils/codexExecutor.d.ts.map +1 -0
  197. package/dist/utils/codexExecutor.js +19 -0
  198. package/dist/utils/codexExecutor.js.map +1 -0
  199. package/dist/utils/commandExecutor.d.ts +29 -0
  200. package/dist/utils/commandExecutor.d.ts.map +1 -0
  201. package/dist/utils/commandExecutor.js +487 -0
  202. package/dist/utils/commandExecutor.js.map +1 -0
  203. package/dist/utils/cursorCli.d.ts +3 -0
  204. package/dist/utils/cursorCli.d.ts.map +1 -0
  205. package/dist/utils/cursorCli.js +20 -0
  206. package/dist/utils/cursorCli.js.map +1 -0
  207. package/dist/utils/cursorExecutor.d.ts +3 -0
  208. package/dist/utils/cursorExecutor.d.ts.map +1 -0
  209. package/dist/utils/cursorExecutor.js +22 -0
  210. package/dist/utils/cursorExecutor.js.map +1 -0
  211. package/dist/utils/geminiExecutor.d.ts +4 -0
  212. package/dist/utils/geminiExecutor.d.ts.map +1 -0
  213. package/dist/utils/geminiExecutor.js +131 -0
  214. package/dist/utils/geminiExecutor.js.map +1 -0
  215. package/dist/utils/githubCli.d.ts +22 -0
  216. package/dist/utils/githubCli.d.ts.map +1 -0
  217. package/dist/utils/githubCli.js +131 -0
  218. package/dist/utils/githubCli.js.map +1 -0
  219. package/dist/utils/opencodeCatalog.d.ts +33 -0
  220. package/dist/utils/opencodeCatalog.d.ts.map +1 -0
  221. package/dist/utils/opencodeCatalog.js +171 -0
  222. package/dist/utils/opencodeCatalog.js.map +1 -0
  223. package/dist/utils/opencodeExecutor.d.ts +3 -0
  224. package/dist/utils/opencodeExecutor.d.ts.map +1 -0
  225. package/dist/utils/opencodeExecutor.js +16 -0
  226. package/dist/utils/opencodeExecutor.js.map +1 -0
  227. package/dist/utils/timeoutManager.d.ts +2 -0
  228. package/dist/utils/timeoutManager.d.ts.map +1 -0
  229. package/dist/utils/timeoutManager.js +2 -0
  230. package/dist/utils/timeoutManager.js.map +1 -0
  231. package/dist/utils/worktrunkIsolation.d.ts +26 -0
  232. package/dist/utils/worktrunkIsolation.d.ts.map +1 -0
  233. package/dist/utils/worktrunkIsolation.js +80 -0
  234. package/dist/utils/worktrunkIsolation.js.map +1 -0
  235. package/package.json +72 -0
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { executeOpencodeCLI } from '../utils/opencodeExecutor.js';
3
+ import { ERROR_MESSAGES, STATUS_MESSAGES } from '../constants.js';
4
+ const askOpencodeArgsSchema = z.object({
5
+ prompt: z.string().min(1).describe("The question or task for OpenCode. REQUIRED — MUST be a non-empty string. OpenCode has full filesystem access and will read files itself. Do NOT pre-read or inline file contents — just describe the task."),
6
+ model: z.string().min(1).describe("REQUIRED — you MUST first call List-OpenCode-Models, review the available models and their tiers, then select the best model for your task. Use the full provider/model format (e.g., 'google-vertex/gemini-2.5-flash'). Empty strings will be rejected."),
7
+ variant: z.string().min(1).optional().describe("Optional OpenCode model variant / provider-specific reasoning effort passed as --variant, for models that support variants."),
8
+ reasoningEffort: z.string().min(1).optional().describe("Deprecated alias for variant. Prefer variant."),
9
+ });
10
+ export const askOpencodeTool = {
11
+ name: "Ask-OpenCode",
12
+ description: "Ask OpenCode a question or give it a task. OpenCode supports multiple AI providers and has full filesystem access. You MUST call List-OpenCode-Models first to select an appropriate model. Use the full provider/model format for the model parameter. This tool is long-running (1-15 min); delegate this call to a sub-agent or background task.",
13
+ zodSchema: askOpencodeArgsSchema,
14
+ prompt: {
15
+ description: "Execute 'opencode run <prompt> -m <model>' to get OpenCode's response.",
16
+ },
17
+ category: 'opencode',
18
+ execution: { taskSupport: 'optional' },
19
+ timeoutClass: 'ask',
20
+ execute: async (args, context) => {
21
+ const { prompt, model, variant, reasoningEffort } = args;
22
+ if (!prompt?.trim()) {
23
+ throw new Error(ERROR_MESSAGES.NO_PROMPT_PROVIDED);
24
+ }
25
+ const result = await executeOpencodeCLI(prompt, model, (variant ?? reasoningEffort), context);
26
+ return `${STATUS_MESSAGES.OPENCODE_RESPONSE}\n${result}`;
27
+ }
28
+ };
29
+ //# sourceMappingURL=ask-opencode.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-opencode.tool.js","sourceRoot":"","sources":["../../src/tools/ask-op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B,CAAC,CAAC;QACrD,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,kBAAkB,CACrC,MAAgB,EAChB,KAAe,EACf,CAAC,OAAO,IAAI,eAAe,CAAuB,EAClD,OAAO,CACR,CAAC;QAEF,OAAO,GAAG,eAAe,CAAC,iBAAiB,KAAK,MAAM,EAAE,CAAC;IAC3D,CAAC;CACF,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ToolExecutionContext } from '../execution.js';
2
+ import { type RouterTier } from '../routerConfig.js';
3
+ import { type UnifiedTool } from './registry.js';
4
+ export declare function classifyRouterTier(prompt: string, forceHuge?: boolean): RouterTier;
5
+ export interface RouterDispatchOptions {
6
+ isolate?: boolean;
7
+ worktreeBranch?: string;
8
+ baseBranch?: string;
9
+ mode?: 'investigate' | 'patch' | 'verify';
10
+ readonly?: boolean;
11
+ detach?: boolean;
12
+ routerRunId?: string;
13
+ }
14
+ export declare function executeRouterTier(tier: RouterTier, prompt: string, context?: ToolExecutionContext, dispatch?: RouterDispatchOptions): Promise<string>;
15
+ export declare function startDetachedRouterTier(tier: RouterTier, prompt: string, context?: ToolExecutionContext, dispatch?: RouterDispatchOptions): string;
16
+ export declare function makeRouterTierTool(name: string, tier: RouterTier, description: string): UnifiedTool;
17
+ export declare const askSubagentTool: UnifiedTool;
18
+ export declare const routerTierTools: UnifiedTool[];
19
+ export declare function hasAnyRouterBackend(): boolean;
20
+ //# sourceMappingURL=ask-router.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-router.tool.d.ts","sourceRoot":"","sources":["../../src/tools/ask-router.tool.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG5D,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3F,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AA8HxE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,UAAU,CAchF;AAMD,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA2PD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,oBAAoB,EAC9B,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAoJjB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,oBAAoB,EAC9B,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,MAAM,CA6CR;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,WAAW,CAwBnG;AAED,eAAO,MAAM,eAAe,EAAE,WA2B7B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,WAAW,EA8CxC,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,OAAO,CAS7C"}
@@ -0,0 +1,550 @@
1
+ import { z } from 'zod';
2
+ import { mkdir, writeFile } from 'fs/promises';
3
+ import path from 'path';
4
+ import { randomUUID } from 'crypto';
5
+ import { ERROR_MESSAGES } from '../constants.js';
6
+ import { getRouterTiers } from '../routerConfig.js';
7
+ import { isToolBlockedForClient } from '../clientFilter.js';
8
+ import { getTool, toolRegistry } from './registry.js';
9
+ import { getRunsDir } from '../service/paths.js';
10
+ import { ensureWtWorktreeForRouter, formatRouterIsolationPreamble, resolveGitBranchAt, resolveGitTopLevel, } from '../utils/worktrunkIsolation.js';
11
+ const routerIsolationSchema = z.object({
12
+ isolate: z
13
+ .boolean()
14
+ .optional()
15
+ .default(true)
16
+ .describe('When true (default), create or select a Work Trunk (`wt`) worktree and run backend CLIs with cwd there so delegated agents do not touch the original checkout.'),
17
+ worktreeBranch: z
18
+ .string()
19
+ .optional()
20
+ .describe('Optional git branch name for `wt switch`. If omitted with isolate on, a unique ephemeral branch is created. If the branch does not exist yet, it is created from baseBranch (or the repo default).'),
21
+ baseBranch: z
22
+ .string()
23
+ .optional()
24
+ .describe('Optional base ref passed to `wt switch --create --base` when a new branch is created. Ignored when switching to an existing local branch.'),
25
+ mode: z
26
+ .enum(['investigate', 'patch', 'verify'])
27
+ .optional()
28
+ .describe('Optional router intent. investigate is read-only, patch allows implementation in the isolated worktree, and verify focuses on tests/checks.'),
29
+ readonly: z
30
+ .boolean()
31
+ .optional()
32
+ .describe('Optional alias for mode=investigate. When true, the router prepends a read-only instruction to the delegated prompt.'),
33
+ detach: z
34
+ .boolean()
35
+ .optional()
36
+ .default(true)
37
+ .describe('Optional, defaults to true. Return a router_run_id immediately and continue the delegated run in the MCP server background. Set false only when the caller is using real MCP task/background execution or can safely wait for the full result.'),
38
+ });
39
+ const routerArgsSchema = z
40
+ .object({
41
+ prompt: z.string().min(1).describe('The question or task to route to the best available subagent tier.'),
42
+ huge: z
43
+ .boolean()
44
+ .optional()
45
+ .describe('Optional. Force huge-tier routing for tasks that are context-heavy, need repeated compaction, or involve very long iterative loops over a large footprint.'),
46
+ })
47
+ .merge(routerIsolationSchema);
48
+ const forcedRouterArgsSchema = z
49
+ .object({
50
+ prompt: z.string().min(1).describe('The question or task to send through this tier.'),
51
+ })
52
+ .merge(routerIsolationSchema);
53
+ const quotaPatterns = [
54
+ /quota/i,
55
+ /rate.?limit/i,
56
+ /too many requests/i,
57
+ /resource exhausted/i,
58
+ /insufficient credits/i,
59
+ /usage limit/i,
60
+ /billing/i,
61
+ ];
62
+ const modelUnavailablePatterns = [
63
+ /model not found/i,
64
+ /unknown model/i,
65
+ /invalid model/i,
66
+ /did you mean/i,
67
+ /model .* not .*available/i,
68
+ /model .* unavailable/i,
69
+ ];
70
+ function isQuotaFailure(error) {
71
+ const message = error instanceof Error ? error.message : String(error);
72
+ return quotaPatterns.some((pattern) => pattern.test(message));
73
+ }
74
+ function isModelUnavailableFailure(error) {
75
+ const message = error instanceof Error ? error.message : String(error);
76
+ return modelUnavailablePatterns.some((pattern) => pattern.test(message));
77
+ }
78
+ function shouldFallback(error) {
79
+ if (isQuotaFailure(error))
80
+ return 'quota';
81
+ if (isModelUnavailableFailure(error))
82
+ return 'model_unavailable';
83
+ return undefined;
84
+ }
85
+ function isHugePrompt(prompt) {
86
+ return /\b(huge|very large|large codebase|entire repo|monorepo|multi[- ]?hour|long[- ]running|context|compact|compaction|many files|broad refactor|migration)\b/i.test(prompt);
87
+ }
88
+ function classifyNonHugePrompt(prompt) {
89
+ const normalized = prompt.toLowerCase();
90
+ if (/\b(crucial|critical|production incident|security|data loss|architecture|staff engineer|deep review)\b/.test(normalized)) {
91
+ return 'crucial';
92
+ }
93
+ if (/\b(complex|hard|design|refactor|debug|investigate|review|multi[- ]?step|integration)\b/.test(normalized)) {
94
+ return 'high';
95
+ }
96
+ if (/\b(implement|feature|test|tests|fix|modify|update|analyze|explain)\b/.test(normalized)) {
97
+ return 'medium';
98
+ }
99
+ if (/\b(simple|small|quick|summarize|question|lookup)\b/.test(normalized)) {
100
+ return 'low';
101
+ }
102
+ return 'trivial';
103
+ }
104
+ export function classifyRouterTier(prompt, forceHuge = false) {
105
+ const huge = forceHuge || isHugePrompt(prompt);
106
+ if (!huge) {
107
+ return classifyNonHugePrompt(prompt);
108
+ }
109
+ const nonHugeTier = classifyNonHugePrompt(prompt);
110
+ if (nonHugeTier === 'trivial' || nonHugeTier === 'low') {
111
+ return 'huge-trivial';
112
+ }
113
+ if (nonHugeTier === 'medium') {
114
+ return 'huge-medium';
115
+ }
116
+ return 'huge-hard';
117
+ }
118
+ function formatAttempt(candidate, status) {
119
+ return `${candidate.label} (${candidate.toolName}, ${candidate.model}): ${status}`;
120
+ }
121
+ function tailText(value, limit) {
122
+ if (value.length <= limit)
123
+ return value;
124
+ return `...${value.slice(-limit)}`;
125
+ }
126
+ function detachContext(context) {
127
+ if (!context)
128
+ return undefined;
129
+ return {
130
+ ...context,
131
+ signal: undefined,
132
+ onProgress: undefined,
133
+ };
134
+ }
135
+ function getRouterMode(dispatch) {
136
+ if (dispatch?.readonly)
137
+ return 'investigate';
138
+ return dispatch?.mode ?? 'default';
139
+ }
140
+ function applyModeInstruction(prompt, mode) {
141
+ if (mode === 'investigate') {
142
+ return 'Router mode: investigate/read-only. Do not edit files. Return findings, risks, and suggested next steps only.\n\n' + prompt;
143
+ }
144
+ if (mode === 'verify') {
145
+ return 'Router mode: verify. Focus on running checks, reading failures, and reporting verification results. Do not make implementation changes unless required to run verification.\n\n' + prompt;
146
+ }
147
+ if (mode === 'patch') {
148
+ return 'Router mode: patch. Implement changes only inside this delegated worktree and report changed files, tests run, and diff summary.\n\n' + prompt;
149
+ }
150
+ return prompt;
151
+ }
152
+ function routerHandoffPath(worktreePath) {
153
+ return path.join(worktreePath, 'AGENTMUX_HANDOFF.md');
154
+ }
155
+ function cleanupCommand(worktreePath, branch, isolated) {
156
+ if (!isolated || branch === '(unknown)' || branch === '(pending)')
157
+ return undefined;
158
+ return `wt -C ${JSON.stringify(worktreePath)} remove --yes --no-verify ${branch}`;
159
+ }
160
+ function formatHandoffInstruction(meta) {
161
+ const cleanup = cleanupCommand(meta.worktreePath, meta.branch, meta.isolated);
162
+ return [
163
+ '[Router handoff contract]',
164
+ `Maintain this progress file as you work: ${meta.handoffPath}`,
165
+ 'Update it after each meaningful step with: current status, completed steps, changed files, commands/tests run, blockers, and final summary.',
166
+ 'If you make changes, leave them in this worktree/branch for the orchestrator to inspect; do not delete the worktree yourself.',
167
+ cleanup ? `After review/merge, the orchestrator can clean up with: ${cleanup}` : undefined,
168
+ '',
169
+ '---',
170
+ '',
171
+ ].filter(Boolean).join('\n');
172
+ }
173
+ async function writeInitialHandoffFile(meta) {
174
+ try {
175
+ await mkdir(path.dirname(meta.handoffPath), { recursive: true });
176
+ const cleanup = cleanupCommand(meta.worktreePath, meta.branch, meta.isolated);
177
+ await writeFile(meta.handoffPath, [
178
+ '# AgentMux Handoff',
179
+ '',
180
+ `- Status: started`,
181
+ `- Tier: ${meta.tier}`,
182
+ `- Mode: ${meta.mode}`,
183
+ `- Worktree: ${meta.worktreePath}`,
184
+ `- Branch: ${meta.branch}`,
185
+ cleanup ? `- Cleanup after review: \`${cleanup}\`` : undefined,
186
+ '',
187
+ '## Task',
188
+ '',
189
+ meta.prompt,
190
+ '',
191
+ '## Progress',
192
+ '',
193
+ '- [ ] Started',
194
+ '',
195
+ '## Changed Files',
196
+ '',
197
+ '- None recorded yet',
198
+ '',
199
+ '## Commands And Tests',
200
+ '',
201
+ '- None recorded yet',
202
+ '',
203
+ '## Blockers',
204
+ '',
205
+ '- None',
206
+ '',
207
+ '## Final Summary',
208
+ '',
209
+ '- Pending',
210
+ '',
211
+ ].filter((line) => line !== undefined).join('\n'));
212
+ }
213
+ catch {
214
+ // Best effort only; router execution can still be recovered from the run ledger.
215
+ }
216
+ }
217
+ function candidateRecord(candidate) {
218
+ return {
219
+ label: candidate.label,
220
+ toolName: candidate.toolName,
221
+ backend: candidate.backend,
222
+ model: candidate.model,
223
+ extraArgs: candidate.extraArgs,
224
+ };
225
+ }
226
+ async function writeRouterRunRecord(record) {
227
+ try {
228
+ const runsDir = getRunsDir();
229
+ await mkdir(runsDir, { recursive: true });
230
+ await writeFile(path.join(runsDir, `${record.run_id}.json`), JSON.stringify(record, null, 2));
231
+ }
232
+ catch {
233
+ // Best effort only; router execution should not fail because the recovery ledger is unavailable.
234
+ }
235
+ }
236
+ async function prepareRouterExecution(prompt, context, dispatch) {
237
+ const isolate = dispatch?.isolate !== false;
238
+ const startCwd = context?.cwd ?? process.cwd();
239
+ if (!isolate) {
240
+ let worktreePath = startCwd;
241
+ let branch = '(unknown)';
242
+ try {
243
+ worktreePath = await resolveGitTopLevel(startCwd, context);
244
+ branch = await resolveGitBranchAt(worktreePath, context);
245
+ }
246
+ catch {
247
+ // Not a git checkout or git unavailable — still run with caller context.
248
+ }
249
+ const isolationMeta = { worktreePath, branch };
250
+ const mode = getRouterMode(dispatch);
251
+ return {
252
+ effectivePrompt: formatRouterIsolationPreamble(isolationMeta) + applyModeInstruction(prompt, mode),
253
+ execContext: context,
254
+ isolationMeta,
255
+ isolated: false,
256
+ };
257
+ }
258
+ const ensured = await ensureWtWorktreeForRouter({
259
+ startCwd,
260
+ worktreeBranch: dispatch?.worktreeBranch,
261
+ baseBranch: dispatch?.baseBranch,
262
+ context,
263
+ });
264
+ const isolationMeta = { worktreePath: ensured.worktreePath, branch: ensured.branch };
265
+ const execContext = { ...(context ?? {}), cwd: ensured.worktreePath };
266
+ const mode = getRouterMode(dispatch);
267
+ const handoffPath = routerHandoffPath(ensured.worktreePath);
268
+ return {
269
+ effectivePrompt: formatRouterIsolationPreamble(isolationMeta) +
270
+ formatHandoffInstruction({ ...isolationMeta, handoffPath, isolated: true }) +
271
+ applyModeInstruction(prompt, mode),
272
+ execContext,
273
+ isolationMeta,
274
+ handoffPath,
275
+ isolated: true,
276
+ };
277
+ }
278
+ function formatRouterEnvelope(record) {
279
+ return [
280
+ '```json',
281
+ JSON.stringify({
282
+ router_run_id: record.run_id,
283
+ status: record.status,
284
+ tier: record.tier,
285
+ mode: record.mode,
286
+ isolation: {
287
+ isolated: record.isolated,
288
+ worktree_path: record.worktree_path,
289
+ branch: record.branch,
290
+ handoff_path: record.handoff_path,
291
+ },
292
+ selected: record.selected,
293
+ attempts: record.attempts,
294
+ recovery: record.recovery,
295
+ error: record.error,
296
+ }, null, 2),
297
+ '```',
298
+ ].join('\n');
299
+ }
300
+ export async function executeRouterTier(tier, prompt, context, dispatch) {
301
+ if (!prompt.trim()) {
302
+ throw new Error(ERROR_MESSAGES.NO_PROMPT_PROVIDED);
303
+ }
304
+ const { effectivePrompt, execContext, isolationMeta, handoffPath, isolated } = await prepareRouterExecution(prompt, context, dispatch);
305
+ const attempts = [];
306
+ const candidates = getRouterTiers()[tier];
307
+ const routerRunId = dispatch?.routerRunId ?? randomUUID();
308
+ const mode = getRouterMode(dispatch);
309
+ const baseRecord = {
310
+ run_id: routerRunId,
311
+ kind: 'router',
312
+ timestamp: new Date().toISOString(),
313
+ status: 'started',
314
+ tier,
315
+ mode,
316
+ prompt_tail: tailText(prompt, 1000),
317
+ isolated,
318
+ worktree_path: isolationMeta.worktreePath,
319
+ branch: isolationMeta.branch,
320
+ handoff_path: handoffPath,
321
+ attempts,
322
+ recovery: {
323
+ inspect_run: `Call Get-Run with {"runId":"${routerRunId}"} for the persisted router envelope.`,
324
+ worktree_path: isolationMeta.worktreePath,
325
+ branch: isolationMeta.branch,
326
+ handoff_path: handoffPath,
327
+ cleanup_command: cleanupCommand(isolationMeta.worktreePath, isolationMeta.branch, isolated),
328
+ task_mode_hint: 'For long-running Ask-* calls, use your MCP client task/background mode when available; plain tool calls may be cut off by client request timeouts.',
329
+ },
330
+ };
331
+ if (handoffPath) {
332
+ await writeInitialHandoffFile({
333
+ handoffPath,
334
+ worktreePath: isolationMeta.worktreePath,
335
+ branch: isolationMeta.branch,
336
+ tier,
337
+ mode,
338
+ prompt,
339
+ isolated,
340
+ });
341
+ }
342
+ await writeRouterRunRecord(baseRecord);
343
+ for (const candidate of candidates) {
344
+ const tool = getTool(candidate.toolName);
345
+ if (!tool) {
346
+ attempts.push(formatAttempt(candidate, 'skipped; backend tool is unavailable'));
347
+ continue;
348
+ }
349
+ if (isToolBlockedForClient(tool, execContext?.clientName)) {
350
+ attempts.push(formatAttempt(candidate, 'skipped; excluded for host MCP client (no delegating to yourself)'));
351
+ continue;
352
+ }
353
+ const toolArgs = {
354
+ prompt: effectivePrompt,
355
+ model: candidate.model,
356
+ ...candidate.extraArgs,
357
+ };
358
+ if (candidate.backend === 'cursor' && isolated) {
359
+ toolArgs.workspace = isolationMeta.worktreePath;
360
+ // New `wt` worktrees are not trusted in Cursor until `--trust` is passed; router isolation
361
+ // always targets that path, so default trust on for headless agent runs.
362
+ toolArgs.trust = true;
363
+ // Isolated runs use a dedicated worktree (not the caller's primary checkout). `--force`
364
+ // avoids interactive confirmation for file edits there; scope stays under `workspace`.
365
+ toolArgs.force = true;
366
+ }
367
+ await writeRouterRunRecord({
368
+ ...baseRecord,
369
+ timestamp: new Date().toISOString(),
370
+ status: 'running',
371
+ selected: candidateRecord(candidate),
372
+ });
373
+ try {
374
+ const result = await tool.execute(toolArgs, execContext);
375
+ const record = {
376
+ ...baseRecord,
377
+ timestamp: new Date().toISOString(),
378
+ status: 'completed',
379
+ selected: candidateRecord(candidate),
380
+ result_tail: tailText(result, 2000),
381
+ };
382
+ await writeRouterRunRecord(record);
383
+ return [
384
+ `Router tier: ${tier}`,
385
+ `Selected: ${candidate.label} (${candidate.model})`,
386
+ `Router run: ${routerRunId} (Get-Run can inspect this router envelope)`,
387
+ isolated
388
+ ? `Isolation: worktree ${isolationMeta.worktreePath} (branch ${isolationMeta.branch})`
389
+ : `Isolation: off (preamble documents checkout ${isolationMeta.worktreePath}, branch ${isolationMeta.branch})`,
390
+ attempts.length > 0 ? `Prior attempts:\n${attempts.join('\n')}` : undefined,
391
+ result,
392
+ ]
393
+ .filter(Boolean)
394
+ .join('\n\n');
395
+ }
396
+ catch (error) {
397
+ const fallbackReason = shouldFallback(error);
398
+ const message = error instanceof Error ? error.message : String(error);
399
+ if (!fallbackReason) {
400
+ const record = {
401
+ ...baseRecord,
402
+ timestamp: new Date().toISOString(),
403
+ status: 'failed',
404
+ selected: candidateRecord(candidate),
405
+ error: message,
406
+ };
407
+ await writeRouterRunRecord(record);
408
+ throw new Error([
409
+ `Router tier "${tier}" failed while running ${candidate.label} (${candidate.model}).`,
410
+ formatRouterEnvelope(record),
411
+ ].join('\n\n'));
412
+ }
413
+ attempts.push(formatAttempt(candidate, `${fallbackReason} fallback; ${message}`));
414
+ await writeRouterRunRecord({
415
+ ...baseRecord,
416
+ timestamp: new Date().toISOString(),
417
+ selected: candidateRecord(candidate),
418
+ });
419
+ }
420
+ }
421
+ const record = {
422
+ ...baseRecord,
423
+ timestamp: new Date().toISOString(),
424
+ status: 'failed',
425
+ error: `No available router candidate succeeded for tier "${tier}".`,
426
+ };
427
+ await writeRouterRunRecord(record);
428
+ throw new Error([
429
+ `No available router candidate succeeded for tier "${tier}".`,
430
+ attempts.join('\n'),
431
+ formatRouterEnvelope(record),
432
+ ].join('\n\n'));
433
+ }
434
+ export function startDetachedRouterTier(tier, prompt, context, dispatch) {
435
+ const routerRunId = dispatch?.routerRunId ?? randomUUID();
436
+ const mode = getRouterMode(dispatch);
437
+ const queuedRecord = {
438
+ run_id: routerRunId,
439
+ kind: 'router',
440
+ timestamp: new Date().toISOString(),
441
+ status: 'queued',
442
+ tier,
443
+ mode,
444
+ prompt_tail: tailText(prompt, 1000),
445
+ isolated: dispatch?.isolate !== false,
446
+ worktree_path: context?.cwd ?? '(pending)',
447
+ branch: '(pending)',
448
+ attempts: [],
449
+ recovery: {
450
+ inspect_run: `Call Get-Run with {"runId":"${routerRunId}"} for the persisted router envelope.`,
451
+ worktree_path: context?.cwd ?? '(pending)',
452
+ branch: '(pending)',
453
+ task_mode_hint: 'Detached router run is executing in the MCP server background; poll Get-Run with this runId.',
454
+ },
455
+ };
456
+ void writeRouterRunRecord(queuedRecord).then(() => executeRouterTier(tier, prompt, detachContext(context), {
457
+ ...dispatch,
458
+ detach: false,
459
+ routerRunId,
460
+ }).catch(async (error) => {
461
+ const message = error instanceof Error ? error.message : String(error);
462
+ await writeRouterRunRecord({
463
+ ...queuedRecord,
464
+ timestamp: new Date().toISOString(),
465
+ status: 'failed',
466
+ error: message,
467
+ });
468
+ }));
469
+ return [
470
+ `Detached router run started: ${routerRunId}`,
471
+ `Tier: ${tier}`,
472
+ `Mode: ${mode}`,
473
+ 'Poll with Get-Run using this runId. Use latest:true only if you do not have the id.',
474
+ ].join('\n');
475
+ }
476
+ export function makeRouterTierTool(name, tier, description) {
477
+ return {
478
+ name,
479
+ description,
480
+ zodSchema: forcedRouterArgsSchema,
481
+ prompt: { description },
482
+ category: 'utility',
483
+ execution: { taskSupport: 'optional' },
484
+ timeoutClass: 'ask',
485
+ execute: async (args, ctx) => {
486
+ const dispatch = {
487
+ isolate: args.isolate,
488
+ worktreeBranch: args.worktreeBranch,
489
+ baseBranch: args.baseBranch,
490
+ mode: args.mode,
491
+ readonly: args.readonly,
492
+ detach: args.detach,
493
+ };
494
+ if (dispatch.detach !== false) {
495
+ return startDetachedRouterTier(tier, args.prompt, ctx, dispatch);
496
+ }
497
+ return executeRouterTier(tier, args.prompt, ctx, dispatch);
498
+ },
499
+ };
500
+ }
501
+ export const askSubagentTool = {
502
+ name: 'Ask-Subagent',
503
+ description: 'Route a prompt through the smart subagent router. It classifies ambiguity/scope (and optional huge context/compaction/loop-heavy routing), chooses the matching tier, then tries configured models in order with quota/model-unavailable fallback. By default each backend runs in an isolated Work Trunk (`wt`) worktree so delegates do not modify the original checkout. This can exceed interactive MCP call limits; use MCP task/background execution when available. If the client cannot request MCP tasks, set detach:true to return a router_run_id immediately and continue in the server background. Results and failures include a router_run_id retrievable with Get-Run.',
504
+ zodSchema: routerArgsSchema,
505
+ prompt: {
506
+ description: 'Route a prompt to the best available subagent tier.',
507
+ },
508
+ category: 'utility',
509
+ execution: { taskSupport: 'optional' },
510
+ timeoutClass: 'ask',
511
+ execute: async (args, ctx) => {
512
+ const prompt = args.prompt;
513
+ const tier = classifyRouterTier(prompt, Boolean(args.huge));
514
+ const dispatch = {
515
+ isolate: args.isolate,
516
+ worktreeBranch: args.worktreeBranch,
517
+ baseBranch: args.baseBranch,
518
+ mode: args.mode,
519
+ readonly: args.readonly,
520
+ detach: args.detach,
521
+ };
522
+ if (dispatch.detach !== false) {
523
+ return startDetachedRouterTier(tier, prompt, ctx, dispatch);
524
+ }
525
+ return executeRouterTier(tier, prompt, ctx, dispatch);
526
+ },
527
+ };
528
+ export const routerTierTools = [
529
+ makeRouterTierTool('Ask-Default', 'default', 'Ambiguous first pass when scope is unclear: prefer the cheapest safe models with quota/model-unavailable fallback (Gemini Flash Lite, then Copilot GPT-5 mini xhigh). Long runs should use MCP task/background mode or detach:true when the client lacks task support; router results include a Get-Run recovery id.'),
530
+ makeRouterTierTool('Ask-Trivial', 'trivial', 'Very narrow scope and low decision ambiguity; tiny discrete questions (Gemini Flash Lite, then Copilot GPT-5 mini xhigh on quota/model-unavailable fallback). Long runs should use MCP task/background mode or detach:true when the client lacks task support; router results include a Get-Run recovery id.'),
531
+ makeRouterTierTool('Ask-Low', 'low', 'Routine tasks with light ambiguity or small surface area (Gemini Flash, then Copilot GPT-5 mini xhigh on quota/model-unavailable fallback). Long runs should use MCP task/background mode or detach:true when the client lacks task support; router results include a Get-Run recovery id.'),
532
+ makeRouterTierTool('Ask-Medium', 'medium', 'Moderate ambiguity or multi-step implementation across several files; may need a stronger model (Ring 2.6 1T, Gemini 3.1 Pro preview, Codex GPT-5.4 mini medium on quota/model-unavailable fallbacks). The router skips backends that match the host MCP client. Long runs should use MCP task/background mode or detach:true when the client lacks task support; router results include a Get-Run recovery id.'),
533
+ makeRouterTierTool('Ask-High', 'high', 'High ambiguity, cross-cutting investigation, or unclear trade-offs (Gemini 3.1 Pro preview, then Cursor Composer 2 on quota/model-unavailable fallback). The router skips backends that match the host MCP client. Long runs should use MCP task/background mode or detach:true when the client lacks task support; router results include a Get-Run recovery id.'),
534
+ makeRouterTierTool('Ask-Crucial', 'crucial', 'Extremely rare, highest-stakes routing only (production incidents, irreversible migrations, security or data-loss exposure). Deliberately heavy; avoid for normal work (Codex GPT-5.5 low, then Gemini 3.1 Pro preview on quota/model-unavailable fallback). The router skips backends that match the host MCP client. Long runs should use MCP task/background mode or detach:true when the client lacks task support; router results include a Get-Run recovery id.'),
535
+ makeRouterTierTool('Ask-Huge-Trivial', 'huge-trivial', 'Huge context footprint or long shallow passes—large repo surface but low decision depth (summaries, wide scans; Copilot GPT-5 mini xhigh, then Gemini Flash Lite on quota/model-unavailable fallback). Use MCP task/background mode or detach:true when the client lacks task support; router results include a Get-Run recovery id.'),
536
+ makeRouterTierTool('Ask-Huge-Medium', 'huge-medium', 'Compaction- or loop-heavy medium-depth work across a very large footprint (Copilot GPT-5.4 mini xhigh, then Gemini 3.1 Pro preview on quota/model-unavailable fallback). Use MCP task/background mode or detach:true when the client lacks task support; router results include a Get-Run recovery id.'),
537
+ makeRouterTierTool('Ask-Huge-Hard', 'huge-hard', 'Huge footprint plus deep ambiguity or coordinated high-risk changes needing sustained reasoning (Copilot GPT-5.2 Codex xhigh, then Gemini 3.1 Pro preview on quota/model-unavailable fallback). Use MCP task/background mode or detach:true when the client lacks task support; router results include a Get-Run recovery id.'),
538
+ ];
539
+ export function hasAnyRouterBackend() {
540
+ const hasGemini = toolRegistry.some((t) => t.name === 'Ask-Gemini');
541
+ const hasOpenCode = toolRegistry.some((t) => t.name === 'Ask-OpenCode');
542
+ const hasCursor = toolRegistry.some((t) => t.name === 'Ask-Cursor');
543
+ const hasCodex = toolRegistry.some((t) => t.name === 'Ask-Codex');
544
+ if (hasGemini || hasOpenCode || hasCursor)
545
+ return true;
546
+ // Codex participates in tier fallbacks but cannot route alone (every tier starts with a non-codex
547
+ // primary or would immediately no-op when Codex is the sole CLI).
548
+ return [hasGemini, hasOpenCode, hasCursor, hasCodex].filter(Boolean).length >= 2;
549
+ }
550
+ //# sourceMappingURL=ask-router.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-router.tool.js","sourceRoot":"","sources":["../../src/tools/ask-router.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI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,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;IACpE,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC;IACxE,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;IACpE,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;IAClE,IAAI,SAAS,IAAI,WAAW,IAAI,SAAS;QAAE,OAAO,IAAI,CAAC;IACvD,kGAAkG;IAClG,kEAAkE;IAClE,OAAO,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { UnifiedTool } from './registry.js';
2
+ export declare const fetchChunkTool: UnifiedTool;
3
+ //# sourceMappingURL=fetch-chunk.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-chunk.tool.d.ts","sourceRoot":"","sources":["../../src/tools/fetch-chunk.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS5C,eAAO,MAAM,cAAc,EAAE,WA+D5B,CAAC"}