@dreb/coding-agent 2.49.0 → 2.50.0

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 (42) hide show
  1. package/README.md +15 -5
  2. package/agents/explore.md +8 -3
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +3 -1
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/core/agent-session.d.ts.map +1 -1
  7. package/dist/core/agent-session.js +1 -0
  8. package/dist/core/agent-session.js.map +1 -1
  9. package/dist/core/sdk.d.ts +3 -3
  10. package/dist/core/sdk.d.ts.map +1 -1
  11. package/dist/core/sdk.js +4 -3
  12. package/dist/core/sdk.js.map +1 -1
  13. package/dist/core/system-prompt.d.ts.map +1 -1
  14. package/dist/core/system-prompt.js +1 -0
  15. package/dist/core/system-prompt.js.map +1 -1
  16. package/dist/core/tools/index.d.ts +7 -0
  17. package/dist/core/tools/index.d.ts.map +1 -1
  18. package/dist/core/tools/index.js +6 -0
  19. package/dist/core/tools/index.js.map +1 -1
  20. package/dist/core/tools/subagent.d.ts.map +1 -1
  21. package/dist/core/tools/subagent.js +15 -9
  22. package/dist/core/tools/subagent.js.map +1 -1
  23. package/dist/core/tools/wait.d.ts.map +1 -1
  24. package/dist/core/tools/wait.js +2 -1
  25. package/dist/core/tools/wait.js.map +1 -1
  26. package/dist/core/tools/watch-github-ci.d.ts +35 -0
  27. package/dist/core/tools/watch-github-ci.d.ts.map +1 -0
  28. package/dist/core/tools/watch-github-ci.js +204 -0
  29. package/dist/core/tools/watch-github-ci.js.map +1 -0
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -2
  33. package/dist/index.js.map +1 -1
  34. package/docs/extensions.md +4 -2
  35. package/docs/mach6.md +3 -3
  36. package/docs/rpc.md +1 -1
  37. package/docs/sdk.md +4 -4
  38. package/package.json +1 -1
  39. package/skills/mach6-implement/SKILL.md +4 -3
  40. package/skills/mach6-issue/SKILL.md +6 -6
  41. package/skills/mach6-plan/SKILL.md +5 -5
  42. package/skills/mach6-publish/SKILL.md +3 -4
@@ -1 +1 @@
1
- {"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../../../src/core/tools/wait.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK7D,gHAAgH;AAChH,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,aAAa,EAAE,SAAS,aAAa,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,eAAe;IAC/B,sGAAsG;IACtG,gBAAgB,CAAC,EAAE,MAAM,SAAS,aAAa,EAAE,CAAC;CAClD;AAKD,QAAA,MAAM,UAAU;;EAMd,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAKtD,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM,CAMxF;AAED,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAE,EACtF,KAAK,EAAE,GAAG,GACR,MAAM,CAOR;AAKD,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,OAAO,UAAU,EAAE,eAAe,GAAG,SAAS,CAsC7F,CAAC;AAOF,wBAAgB,wBAAwB,CACvC,OAAO,CAAC,EAAE,eAAe,GACvB,cAAc,CAAC,OAAO,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC,CAiBhE","sourcesContent":["/**\n * Wait tool — explicit no-op for models that don't know how to end a turn.\n *\n * Some models (notably Kimi) invent useless `bash` calls to simulate waiting.\n * This tool gives them a sanctioned no-op action that cleanly ends the turn.\n */\n\nimport { Text } from \"@dreb/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\n\n// ============================================================================\n// Types\n\n/** Minimal shape of a running background agent (avoids importing from subagent.ts to prevent circular deps). */\nexport interface WaitAgentInfo {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n}\n\nexport interface WaitToolDetails {\n\treason: string | undefined;\n\trunningAgents: readonly WaitAgentInfo[];\n}\n\nexport interface WaitToolOptions {\n\t/** Returns currently running background agents. Injected by the factory to avoid circular imports. */\n\tgetRunningAgents?: () => readonly WaitAgentInfo[];\n}\n\n// ============================================================================\n// Schema\n\nconst waitSchema = Type.Object({\n\treason: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Optional reason for waiting (e.g. 'background subagent still running')\",\n\t\t}),\n\t),\n});\n\nexport type WaitToolInput = Static<typeof waitSchema>;\n\n// ============================================================================\n// Render helpers\n\nexport function formatWaitCall(args: { reason?: string } | undefined, theme: any): string {\n\tconst reason = args?.reason;\n\tif (reason) {\n\t\treturn `${theme.fg(\"toolTitle\", theme.bold(\"wait\"))} ${theme.fg(\"muted\", reason)}`;\n\t}\n\treturn theme.fg(\"toolTitle\", theme.bold(\"wait\"));\n}\n\nexport function formatWaitResult(\n\tresult: { content: Array<{ type: string; text?: string }>; details?: WaitToolDetails },\n\ttheme: any,\n): string {\n\tconst agents = result.details?.runningAgents ?? [];\n\tif (agents.length > 0) {\n\t\tconst agentList = agents.map((a) => `${a.agentId.slice(0, 12)} ${a.agentType}`).join(\", \");\n\t\treturn theme.fg(\"muted\", `→ doing nothing (waiting on: ${agentList})`);\n\t}\n\treturn theme.fg(\"muted\", \"→ doing nothing — no subagents running\");\n}\n\n// ============================================================================\n// Tool definition (singleton — no cwd or callback dependencies)\n\nexport const waitToolDefinition: ToolDefinition<typeof waitSchema, WaitToolDetails | undefined> = {\n\tname: \"wait\",\n\tlabel: \"wait\",\n\tdescription:\n\t\t\"Do nothing and end your turn. Use this when you are explicitly told to wait, or when background subagents are running and you have no other work to do.\",\n\n\tparameters: waitSchema,\n\n\tpromptSnippet: \"Do nothing and end your turn (use when waiting for background work to complete)\",\n\n\tpromptGuidelines: [\n\t\t\"Use `wait` only when explicitly told to wait, or when background subagents are still running and you have no other work to do\",\n\t\t\"Do NOT use `wait` as a general-purpose delay or sleep — it returns immediately\",\n\t\t\"If you need to wait for something, call `wait` once — do not loop or call it repeatedly\",\n\t],\n\n\tasync execute(_toolCallId, params: WaitToolInput, _signal?, _onUpdate?, _ctx?) {\n\t\tconst reason = params.reason?.trim() || undefined;\n\t\tconst text = reason ? `Waiting: ${reason}` : \"Waiting…\";\n\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\tdetails: { reason, runningAgents: [] as WaitAgentInfo[] },\n\t\t\tendTurn: true,\n\t\t};\n\t},\n\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\ttext.setText(formatWaitCall(args, theme));\n\t\treturn text;\n\t},\n\n\trenderResult(result, _options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\ttext.setText(formatWaitResult(result as any, theme));\n\t\treturn text;\n\t},\n};\n\n// ============================================================================\n// Factory — accepts optional getRunningAgents callback to show background agent\n// status in the result. The callback is injected here (rather than imported from\n// subagent.ts) to avoid a circular dependency through model-resolver → args → index.\n\nexport function createWaitToolDefinition(\n\toptions?: WaitToolOptions,\n): ToolDefinition<typeof waitSchema, WaitToolDetails | undefined> {\n\tif (!options?.getRunningAgents) return waitToolDefinition;\n\n\treturn {\n\t\t...waitToolDefinition,\n\t\tasync execute(_toolCallId, params: WaitToolInput, _signal?, _onUpdate?, _ctx?) {\n\t\t\tconst reason = params.reason?.trim() || undefined;\n\t\t\tconst runningAgents = options.getRunningAgents!();\n\t\t\tconst text = reason ? `Waiting: ${reason}` : \"Waiting…\";\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\t\tdetails: { reason, runningAgents },\n\t\t\t\tendTurn: true,\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../../../src/core/tools/wait.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK7D,gHAAgH;AAChH,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,aAAa,EAAE,SAAS,aAAa,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,eAAe;IAC/B,sGAAsG;IACtG,gBAAgB,CAAC,EAAE,MAAM,SAAS,aAAa,EAAE,CAAC;CAClD;AAKD,QAAA,MAAM,UAAU;;EAMd,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAKtD,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM,CAMxF;AAED,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAE,EACtF,KAAK,EAAE,GAAG,GACR,MAAM,CAOR;AAKD,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,OAAO,UAAU,EAAE,eAAe,GAAG,SAAS,CAuC7F,CAAC;AAOF,wBAAgB,wBAAwB,CACvC,OAAO,CAAC,EAAE,eAAe,GACvB,cAAc,CAAC,OAAO,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC,CAiBhE","sourcesContent":["/**\n * Wait tool — explicit no-op for models that don't know how to end a turn.\n *\n * Some models (notably Kimi) invent useless `bash` calls to simulate waiting.\n * This tool gives them a sanctioned no-op action that cleanly ends the turn.\n */\n\nimport { Text } from \"@dreb/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\n\n// ============================================================================\n// Types\n\n/** Minimal shape of a running background agent (avoids importing from subagent.ts to prevent circular deps). */\nexport interface WaitAgentInfo {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n}\n\nexport interface WaitToolDetails {\n\treason: string | undefined;\n\trunningAgents: readonly WaitAgentInfo[];\n}\n\nexport interface WaitToolOptions {\n\t/** Returns currently running background agents. Injected by the factory to avoid circular imports. */\n\tgetRunningAgents?: () => readonly WaitAgentInfo[];\n}\n\n// ============================================================================\n// Schema\n\nconst waitSchema = Type.Object({\n\treason: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Optional reason for waiting (e.g. 'background subagent still running')\",\n\t\t}),\n\t),\n});\n\nexport type WaitToolInput = Static<typeof waitSchema>;\n\n// ============================================================================\n// Render helpers\n\nexport function formatWaitCall(args: { reason?: string } | undefined, theme: any): string {\n\tconst reason = args?.reason;\n\tif (reason) {\n\t\treturn `${theme.fg(\"toolTitle\", theme.bold(\"wait\"))} ${theme.fg(\"muted\", reason)}`;\n\t}\n\treturn theme.fg(\"toolTitle\", theme.bold(\"wait\"));\n}\n\nexport function formatWaitResult(\n\tresult: { content: Array<{ type: string; text?: string }>; details?: WaitToolDetails },\n\ttheme: any,\n): string {\n\tconst agents = result.details?.runningAgents ?? [];\n\tif (agents.length > 0) {\n\t\tconst agentList = agents.map((a) => `${a.agentId.slice(0, 12)} ${a.agentType}`).join(\", \");\n\t\treturn theme.fg(\"muted\", `→ doing nothing (waiting on: ${agentList})`);\n\t}\n\treturn theme.fg(\"muted\", \"→ doing nothing — no subagents running\");\n}\n\n// ============================================================================\n// Tool definition (singleton — no cwd or callback dependencies)\n\nexport const waitToolDefinition: ToolDefinition<typeof waitSchema, WaitToolDetails | undefined> = {\n\tname: \"wait\",\n\tlabel: \"wait\",\n\tdescription:\n\t\t\"Do nothing and end your turn. Use this only when explicitly told to wait or when background subagents are running and you have no other work. It does not wait for GitHub CI; use watch_github_ci for that.\",\n\n\tparameters: waitSchema,\n\n\tpromptSnippet: \"Do nothing and end your turn (use when waiting for background work to complete)\",\n\n\tpromptGuidelines: [\n\t\t\"Use `wait` only when explicitly told to wait, or when background subagents are still running and you have no other work to do\",\n\t\t\"Do NOT use `wait` as a general-purpose delay or sleep — it returns immediately\",\n\t\t\"Do NOT use `wait` for GitHub CI; use `watch_github_ci`, which blocks until checks pass or fail\",\n\t\t\"If you need to wait for something, call `wait` once — do not loop or call it repeatedly\",\n\t],\n\n\tasync execute(_toolCallId, params: WaitToolInput, _signal?, _onUpdate?, _ctx?) {\n\t\tconst reason = params.reason?.trim() || undefined;\n\t\tconst text = reason ? `Waiting: ${reason}` : \"Waiting…\";\n\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\tdetails: { reason, runningAgents: [] as WaitAgentInfo[] },\n\t\t\tendTurn: true,\n\t\t};\n\t},\n\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\ttext.setText(formatWaitCall(args, theme));\n\t\treturn text;\n\t},\n\n\trenderResult(result, _options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\ttext.setText(formatWaitResult(result as any, theme));\n\t\treturn text;\n\t},\n};\n\n// ============================================================================\n// Factory — accepts optional getRunningAgents callback to show background agent\n// status in the result. The callback is injected here (rather than imported from\n// subagent.ts) to avoid a circular dependency through model-resolver → args → index.\n\nexport function createWaitToolDefinition(\n\toptions?: WaitToolOptions,\n): ToolDefinition<typeof waitSchema, WaitToolDetails | undefined> {\n\tif (!options?.getRunningAgents) return waitToolDefinition;\n\n\treturn {\n\t\t...waitToolDefinition,\n\t\tasync execute(_toolCallId, params: WaitToolInput, _signal?, _onUpdate?, _ctx?) {\n\t\t\tconst reason = params.reason?.trim() || undefined;\n\t\t\tconst runningAgents = options.getRunningAgents!();\n\t\t\tconst text = reason ? `Waiting: ${reason}` : \"Waiting…\";\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\t\tdetails: { reason, runningAgents },\n\t\t\t\tendTurn: true,\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
@@ -35,12 +35,13 @@ export function formatWaitResult(result, theme) {
35
35
  export const waitToolDefinition = {
36
36
  name: "wait",
37
37
  label: "wait",
38
- description: "Do nothing and end your turn. Use this when you are explicitly told to wait, or when background subagents are running and you have no other work to do.",
38
+ description: "Do nothing and end your turn. Use this only when explicitly told to wait or when background subagents are running and you have no other work. It does not wait for GitHub CI; use watch_github_ci for that.",
39
39
  parameters: waitSchema,
40
40
  promptSnippet: "Do nothing and end your turn (use when waiting for background work to complete)",
41
41
  promptGuidelines: [
42
42
  "Use `wait` only when explicitly told to wait, or when background subagents are still running and you have no other work to do",
43
43
  "Do NOT use `wait` as a general-purpose delay or sleep — it returns immediately",
44
+ "Do NOT use `wait` for GitHub CI; use `watch_github_ci`, which blocks until checks pass or fail",
44
45
  "If you need to wait for something, call `wait` once — do not loop or call it repeatedly",
45
46
  ],
46
47
  async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
@@ -1 +1 @@
1
- {"version":3,"file":"wait.js","sourceRoot":"","sources":["../../../src/core/tools/wait.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAuBtD,+EAA+E;AAC/E,SAAS;AAET,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,IAAI,CAAC,QAAQ,CACpB,IAAI,CAAC,MAAM,CAAC;QACX,WAAW,EAAE,wEAAwE;KACrF,CAAC,CACF;CACD,CAAC,CAAC;AAIH,+EAA+E;AAC/E,iBAAiB;AAEjB,MAAM,UAAU,cAAc,CAAC,IAAqC,EAAE,KAAU,EAAU;IACzF,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC;IAC5B,IAAI,MAAM,EAAE,CAAC;QACZ,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;IACpF,CAAC;IACD,OAAO,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAAA,CACjD;AAED,MAAM,UAAU,gBAAgB,CAC/B,MAAsF,EACtF,KAAU,EACD;IACT,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,EAAE,aAAa,IAAI,EAAE,CAAC;IACnD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,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AAO,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IAAA,CACZ;IAED,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;QAC9C,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QAChG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAa,EAAE,KAAK,CAAC,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IAAA,CACZ;CACD,CAAC;AAEF,+EAA+E;AAC/E,kFAAgF;AAChF,iFAAiF;AACjF,yFAAqF;AAErF,MAAM,UAAU,wBAAwB,CACvC,OAAyB,EACwC;IACjE,IAAI,CAAC,OAAO,EAAE,gBAAgB;QAAE,OAAO,kBAAkB,CAAC;IAE1D,OAAO;QACN,GAAG,kBAAkB;QACrB,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,MAAqB,EAAE,OAAQ,EAAE,SAAU,EAAE,IAAK,EAAE;YAC9E,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;YAClD,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAiB,EAAE,CAAC;YAClD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,YAAY,MAAM,EAAE,CAAC,CAAC,CAAC,YAAU,CAAC;YAExD,OAAO;gBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC;gBAC1C,OAAO,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE;gBAClC,OAAO,EAAE,IAAI;aACb,CAAC;QAAA,CACF;KACD,CAAC;AAAA,CACF","sourcesContent":["/**\n * Wait tool — explicit no-op for models that don't know how to end a turn.\n *\n * Some models (notably Kimi) invent useless `bash` calls to simulate waiting.\n * This tool gives them a sanctioned no-op action that cleanly ends the turn.\n */\n\nimport { Text } from \"@dreb/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\n\n// ============================================================================\n// Types\n\n/** Minimal shape of a running background agent (avoids importing from subagent.ts to prevent circular deps). */\nexport interface WaitAgentInfo {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n}\n\nexport interface WaitToolDetails {\n\treason: string | undefined;\n\trunningAgents: readonly WaitAgentInfo[];\n}\n\nexport interface WaitToolOptions {\n\t/** Returns currently running background agents. Injected by the factory to avoid circular imports. */\n\tgetRunningAgents?: () => readonly WaitAgentInfo[];\n}\n\n// ============================================================================\n// Schema\n\nconst waitSchema = Type.Object({\n\treason: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Optional reason for waiting (e.g. 'background subagent still running')\",\n\t\t}),\n\t),\n});\n\nexport type WaitToolInput = Static<typeof waitSchema>;\n\n// ============================================================================\n// Render helpers\n\nexport function formatWaitCall(args: { reason?: string } | undefined, theme: any): string {\n\tconst reason = args?.reason;\n\tif (reason) {\n\t\treturn `${theme.fg(\"toolTitle\", theme.bold(\"wait\"))} ${theme.fg(\"muted\", reason)}`;\n\t}\n\treturn theme.fg(\"toolTitle\", theme.bold(\"wait\"));\n}\n\nexport function formatWaitResult(\n\tresult: { content: Array<{ type: string; text?: string }>; details?: WaitToolDetails },\n\ttheme: any,\n): string {\n\tconst agents = result.details?.runningAgents ?? [];\n\tif (agents.length > 0) {\n\t\tconst agentList = agents.map((a) => `${a.agentId.slice(0, 12)} ${a.agentType}`).join(\", \");\n\t\treturn theme.fg(\"muted\", `→ doing nothing (waiting on: ${agentList})`);\n\t}\n\treturn theme.fg(\"muted\", \"→ doing nothing — no subagents running\");\n}\n\n// ============================================================================\n// Tool definition (singleton — no cwd or callback dependencies)\n\nexport const waitToolDefinition: ToolDefinition<typeof waitSchema, WaitToolDetails | undefined> = {\n\tname: \"wait\",\n\tlabel: \"wait\",\n\tdescription:\n\t\t\"Do nothing and end your turn. Use this when you are explicitly told to wait, or when background subagents are running and you have no other work to do.\",\n\n\tparameters: waitSchema,\n\n\tpromptSnippet: \"Do nothing and end your turn (use when waiting for background work to complete)\",\n\n\tpromptGuidelines: [\n\t\t\"Use `wait` only when explicitly told to wait, or when background subagents are still running and you have no other work to do\",\n\t\t\"Do NOT use `wait` as a general-purpose delay or sleep — it returns immediately\",\n\t\t\"If you need to wait for something, call `wait` once — do not loop or call it repeatedly\",\n\t],\n\n\tasync execute(_toolCallId, params: WaitToolInput, _signal?, _onUpdate?, _ctx?) {\n\t\tconst reason = params.reason?.trim() || undefined;\n\t\tconst text = reason ? `Waiting: ${reason}` : \"Waiting…\";\n\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\tdetails: { reason, runningAgents: [] as WaitAgentInfo[] },\n\t\t\tendTurn: true,\n\t\t};\n\t},\n\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\ttext.setText(formatWaitCall(args, theme));\n\t\treturn text;\n\t},\n\n\trenderResult(result, _options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\ttext.setText(formatWaitResult(result as any, theme));\n\t\treturn text;\n\t},\n};\n\n// ============================================================================\n// Factory — accepts optional getRunningAgents callback to show background agent\n// status in the result. The callback is injected here (rather than imported from\n// subagent.ts) to avoid a circular dependency through model-resolver → args → index.\n\nexport function createWaitToolDefinition(\n\toptions?: WaitToolOptions,\n): ToolDefinition<typeof waitSchema, WaitToolDetails | undefined> {\n\tif (!options?.getRunningAgents) return waitToolDefinition;\n\n\treturn {\n\t\t...waitToolDefinition,\n\t\tasync execute(_toolCallId, params: WaitToolInput, _signal?, _onUpdate?, _ctx?) {\n\t\t\tconst reason = params.reason?.trim() || undefined;\n\t\t\tconst runningAgents = options.getRunningAgents!();\n\t\t\tconst text = reason ? `Waiting: ${reason}` : \"Waiting…\";\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\t\tdetails: { reason, runningAgents },\n\t\t\t\tendTurn: true,\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"wait.js","sourceRoot":"","sources":["../../../src/core/tools/wait.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAuBtD,+EAA+E;AAC/E,SAAS;AAET,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,IAAI,CAAC,QAAQ,CACpB,IAAI,CAAC,MAAM,CAAC;QACX,WAAW,EAAE,wEAAwE;KACrF,CAAC,CACF;CACD,CAAC,CAAC;AAIH,+EAA+E;AAC/E,iBAAiB;AAEjB,MAAM,UAAU,cAAc,CAAC,IAAqC,EAAE,KAAU,EAAU;IACzF,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC;IAC5B,IAAI,MAAM,EAAE,CAAC;QACZ,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;IACpF,CAAC;IACD,OAAO,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAAA,CACjD;AAED,MAAM,UAAU,gBAAgB,CAC/B,MAAsF,EACtF,KAAU,EACD;IACT,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,EAAE,aAAa,IAAI,EAAE,CAAC;IACnD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,SAAS,GAA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CACF","sourcesContent":["/**\n * Wait tool — explicit no-op for models that don't know how to end a turn.\n *\n * Some models (notably Kimi) invent useless `bash` calls to simulate waiting.\n * This tool gives them a sanctioned no-op action that cleanly ends the turn.\n */\n\nimport { Text } from \"@dreb/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\n\n// ============================================================================\n// Types\n\n/** Minimal shape of a running background agent (avoids importing from subagent.ts to prevent circular deps). */\nexport interface WaitAgentInfo {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n}\n\nexport interface WaitToolDetails {\n\treason: string | undefined;\n\trunningAgents: readonly WaitAgentInfo[];\n}\n\nexport interface WaitToolOptions {\n\t/** Returns currently running background agents. Injected by the factory to avoid circular imports. */\n\tgetRunningAgents?: () => readonly WaitAgentInfo[];\n}\n\n// ============================================================================\n// Schema\n\nconst waitSchema = Type.Object({\n\treason: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Optional reason for waiting (e.g. 'background subagent still running')\",\n\t\t}),\n\t),\n});\n\nexport type WaitToolInput = Static<typeof waitSchema>;\n\n// ============================================================================\n// Render helpers\n\nexport function formatWaitCall(args: { reason?: string } | undefined, theme: any): string {\n\tconst reason = args?.reason;\n\tif (reason) {\n\t\treturn `${theme.fg(\"toolTitle\", theme.bold(\"wait\"))} ${theme.fg(\"muted\", reason)}`;\n\t}\n\treturn theme.fg(\"toolTitle\", theme.bold(\"wait\"));\n}\n\nexport function formatWaitResult(\n\tresult: { content: Array<{ type: string; text?: string }>; details?: WaitToolDetails },\n\ttheme: any,\n): string {\n\tconst agents = result.details?.runningAgents ?? [];\n\tif (agents.length > 0) {\n\t\tconst agentList = agents.map((a) => `${a.agentId.slice(0, 12)} ${a.agentType}`).join(\", \");\n\t\treturn theme.fg(\"muted\", `→ doing nothing (waiting on: ${agentList})`);\n\t}\n\treturn theme.fg(\"muted\", \"→ doing nothing — no subagents running\");\n}\n\n// ============================================================================\n// Tool definition (singleton — no cwd or callback dependencies)\n\nexport const waitToolDefinition: ToolDefinition<typeof waitSchema, WaitToolDetails | undefined> = {\n\tname: \"wait\",\n\tlabel: \"wait\",\n\tdescription:\n\t\t\"Do nothing and end your turn. Use this only when explicitly told to wait or when background subagents are running and you have no other work. It does not wait for GitHub CI; use watch_github_ci for that.\",\n\n\tparameters: waitSchema,\n\n\tpromptSnippet: \"Do nothing and end your turn (use when waiting for background work to complete)\",\n\n\tpromptGuidelines: [\n\t\t\"Use `wait` only when explicitly told to wait, or when background subagents are still running and you have no other work to do\",\n\t\t\"Do NOT use `wait` as a general-purpose delay or sleep — it returns immediately\",\n\t\t\"Do NOT use `wait` for GitHub CI; use `watch_github_ci`, which blocks until checks pass or fail\",\n\t\t\"If you need to wait for something, call `wait` once — do not loop or call it repeatedly\",\n\t],\n\n\tasync execute(_toolCallId, params: WaitToolInput, _signal?, _onUpdate?, _ctx?) {\n\t\tconst reason = params.reason?.trim() || undefined;\n\t\tconst text = reason ? `Waiting: ${reason}` : \"Waiting…\";\n\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\tdetails: { reason, runningAgents: [] as WaitAgentInfo[] },\n\t\t\tendTurn: true,\n\t\t};\n\t},\n\n\trenderCall(args, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\ttext.setText(formatWaitCall(args, theme));\n\t\treturn text;\n\t},\n\n\trenderResult(result, _options, theme, context) {\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\ttext.setText(formatWaitResult(result as any, theme));\n\t\treturn text;\n\t},\n};\n\n// ============================================================================\n// Factory — accepts optional getRunningAgents callback to show background agent\n// status in the result. The callback is injected here (rather than imported from\n// subagent.ts) to avoid a circular dependency through model-resolver → args → index.\n\nexport function createWaitToolDefinition(\n\toptions?: WaitToolOptions,\n): ToolDefinition<typeof waitSchema, WaitToolDetails | undefined> {\n\tif (!options?.getRunningAgents) return waitToolDefinition;\n\n\treturn {\n\t\t...waitToolDefinition,\n\t\tasync execute(_toolCallId, params: WaitToolInput, _signal?, _onUpdate?, _ctx?) {\n\t\t\tconst reason = params.reason?.trim() || undefined;\n\t\t\tconst runningAgents = options.getRunningAgents!();\n\t\t\tconst text = reason ? `Waiting: ${reason}` : \"Waiting…\";\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\t\tdetails: { reason, runningAgents },\n\t\t\t\tendTurn: true,\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import type { AgentTool } from "@dreb/agent-core";
2
+ import { type Static } from "@sinclair/typebox";
3
+ import type { ToolDefinition } from "../extensions/types.js";
4
+ declare const watchGithubCiSchema: import("@sinclair/typebox").TObject<{
5
+ pr: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
6
+ }>;
7
+ export type WatchGithubCiToolInput = Static<typeof watchGithubCiSchema>;
8
+ export interface WatchGithubCiToolDetails {
9
+ status: "watching" | "passed" | "failed";
10
+ exitCode?: number;
11
+ outputTruncated: boolean;
12
+ }
13
+ export interface GithubCiOperations {
14
+ exec: (args: readonly string[], cwd: string, options: {
15
+ onData: (data: Buffer) => void;
16
+ signal?: AbortSignal;
17
+ env: NodeJS.ProcessEnv;
18
+ }) => Promise<{
19
+ exitCode: number | null;
20
+ }>;
21
+ }
22
+ export interface WatchGithubCiToolOptions {
23
+ operations?: GithubCiOperations;
24
+ }
25
+ export declare function createLocalGithubCiOperations(): GithubCiOperations;
26
+ export declare function createWatchGithubCiToolDefinition(cwd: string, options?: WatchGithubCiToolOptions): ToolDefinition<typeof watchGithubCiSchema, WatchGithubCiToolDetails>;
27
+ export declare function createWatchGithubCiTool(cwd: string, options?: WatchGithubCiToolOptions): AgentTool<typeof watchGithubCiSchema>;
28
+ export declare const watchGithubCiToolDefinition: ToolDefinition<import("@sinclair/typebox").TObject<{
29
+ pr: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
30
+ }>, WatchGithubCiToolDetails, any>;
31
+ export declare const watchGithubCiTool: AgentTool<import("@sinclair/typebox").TObject<{
32
+ pr: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
33
+ }>, any>;
34
+ export {};
35
+ //# sourceMappingURL=watch-github-ci.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-github-ci.d.ts","sourceRoot":"","sources":["../../../src/core/tools/watch-github-ci.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAGtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK7D,QAAA,MAAM,mBAAmB;;EAOvB,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAExE,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,CACL,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QACR,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QAC/B,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;KACvB,KACG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,wBAAwB;IACxC,UAAU,CAAC,EAAE,kBAAkB,CAAC;CAChC;AAgCD,wBAAgB,6BAA6B,IAAI,kBAAkB,CA0ClE;AAYD,wBAAgB,iCAAiC,CAChD,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,wBAAwB,GAChC,cAAc,CAAC,OAAO,mBAAmB,EAAE,wBAAwB,CAAC,CAsHtE;AAED,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,wBAAwB,GAChC,SAAS,CAAC,OAAO,mBAAmB,CAAC,CAEvC;AAED,eAAO,MAAM,2BAA2B;;kCAAmD,CAAC;AAC5F,eAAO,MAAM,iBAAiB;;QAAyC,CAAC","sourcesContent":["import { spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport type { AgentTool } from \"@dreb/agent-core\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { waitForChildProcess } from \"../../utils/child-process.js\";\nimport { getShellEnv, killProcessTree } from \"../../utils/shell.js\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\nimport { renderTerminalOutput } from \"./terminal-render.js\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.js\";\nimport { DEFAULT_MAX_BYTES, truncateTail } from \"./truncate.js\";\n\nconst watchGithubCiSchema = Type.Object({\n\tpr: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional pull request number, URL, or branch. Omit to use the pull request for the current branch.\",\n\t\t}),\n\t),\n});\n\nexport type WatchGithubCiToolInput = Static<typeof watchGithubCiSchema>;\n\nexport interface WatchGithubCiToolDetails {\n\tstatus: \"watching\" | \"passed\" | \"failed\";\n\texitCode?: number;\n\toutputTruncated: boolean;\n}\n\nexport interface GithubCiOperations {\n\texec: (\n\t\targs: readonly string[],\n\t\tcwd: string,\n\t\toptions: {\n\t\t\tonData: (data: Buffer) => void;\n\t\t\tsignal?: AbortSignal;\n\t\t\tenv: NodeJS.ProcessEnv;\n\t\t},\n\t) => Promise<{ exitCode: number | null }>;\n}\n\nexport interface WatchGithubCiToolOptions {\n\toperations?: GithubCiOperations;\n}\n\n/**\n * Substrings (matched case-insensitively) that identify a `gh pr checks` CLI-level\n * failure rather than a real failed-check result. `gh pr checks` exits 1 for both,\n * and `--json` is incompatible with `--watch`, so the captured output is the only\n * way to tell them apart. These signatures are specific enough that they will not\n * appear in a normal check-status table.\n */\nconst GH_CLI_FAILURE_SIGNATURES = [\n\t\"no pull requests found\",\n\t\"could not resolve to a pullrequest\",\n\t\"failed to run git\",\n\t\"not a git repository\",\n\t\"http 401\",\n\t\"bad credentials\",\n\t\"could not parse\",\n\t\"invalid pull request\",\n\t\"authentication required\",\n\t\"could not find repository\",\n];\n\nfunction detectGhCliFailure(output: string): string | null {\n\tconst lower = output.toLowerCase();\n\tfor (const signature of GH_CLI_FAILURE_SIGNATURES) {\n\t\tif (lower.includes(signature)) {\n\t\t\treturn signature;\n\t\t}\n\t}\n\treturn null;\n}\n\nexport function createLocalGithubCiOperations(): GithubCiOperations {\n\treturn {\n\t\texec: (args, cwd, { onData, signal, env }) =>\n\t\t\tnew Promise((resolve, reject) => {\n\t\t\t\tif (!existsSync(cwd)) {\n\t\t\t\t\treject(new Error(`Working directory does not exist: ${cwd}`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\treject(new Error(\"aborted\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst child = spawn(\"gh\", [...args], {\n\t\t\t\t\tcwd,\n\t\t\t\t\tdetached: true,\n\t\t\t\t\tenv,\n\t\t\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\t\t});\n\t\t\t\tchild.stdout?.on(\"data\", onData);\n\t\t\t\tchild.stderr?.on(\"data\", onData);\n\n\t\t\t\tconst onAbort = () => {\n\t\t\t\t\tif (child.pid) killProcessTree(child.pid);\n\t\t\t\t};\n\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\twaitForChildProcess(child)\n\t\t\t\t\t.then((exitCode) => {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\t\t\treject(new Error(\"aborted\"));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresolve({ exitCode });\n\t\t\t\t\t})\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t});\n\t\t\t}),\n\t};\n}\n\nfunction formatOutput(chunks: readonly Buffer[], omittedEarlierOutput: boolean): { text: string; truncated: boolean } {\n\tconst rendered = renderTerminalOutput(Buffer.concat(chunks).toString(\"utf-8\"));\n\tconst truncation = truncateTail(rendered);\n\tconst prefix = omittedEarlierOutput ? \"[Earlier watch output omitted]\\n\" : \"\";\n\treturn {\n\t\ttext: `${prefix}${truncation.content || \"(no output)\"}`,\n\t\ttruncated: omittedEarlierOutput || truncation.truncated,\n\t};\n}\n\nexport function createWatchGithubCiToolDefinition(\n\tcwd: string,\n\toptions?: WatchGithubCiToolOptions,\n): ToolDefinition<typeof watchGithubCiSchema, WatchGithubCiToolDetails> {\n\tconst operations = options?.operations ?? createLocalGithubCiOperations();\n\n\treturn {\n\t\tname: \"watch_github_ci\",\n\t\tlabel: \"watch GitHub CI\",\n\t\tdescription:\n\t\t\t\"Watch GitHub pull-request checks until they pass or fail. Uses the current branch's pull request by default, or an optional pull request number, URL, or branch. Returns the final GitHub CLI output without requiring user input.\",\n\t\tpromptSnippet: \"Watch GitHub pull-request CI until checks pass or fail\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use `watch_github_ci` to wait for GitHub pull-request checks instead of asking the user, polling with repeated commands, sleeping, or using `wait`\",\n\t\t\t\"`watch_github_ci` blocks until the selected pull request's checks pass or fail; omit `pr` to use the current branch's pull request\",\n\t\t],\n\t\tparameters: watchGithubCiSchema,\n\t\tasync execute(_toolCallId, params, signal, onUpdate) {\n\t\t\tconst selector = params.pr?.trim();\n\t\t\tif (params.pr !== undefined && !selector) {\n\t\t\t\tthrow new Error(\"Pull request selector must not be blank.\");\n\t\t\t}\n\t\t\tif (selector?.startsWith(\"-\")) {\n\t\t\t\tthrow new Error(\"Pull request selector must not begin with '-'.\");\n\t\t\t}\n\n\t\t\tconst args = [\"pr\", \"checks\", ...(selector ? [selector] : []), \"--watch\", \"--fail-fast\"];\n\t\t\tconst chunks: Buffer[] = [];\n\t\t\tlet chunksBytes = 0;\n\t\t\tlet omittedEarlierOutput = false;\n\t\t\tlet outputTruncated = false;\n\t\t\tconst maxBufferedBytes = DEFAULT_MAX_BYTES * 2;\n\n\t\t\tconst details = (status: WatchGithubCiToolDetails[\"status\"], exitCode?: number) => ({\n\t\t\t\tstatus,\n\t\t\t\texitCode,\n\t\t\t\toutputTruncated,\n\t\t\t});\n\t\t\tconst currentOutput = (): string => {\n\t\t\t\tconst formatted = formatOutput(chunks, omittedEarlierOutput);\n\t\t\t\toutputTruncated = formatted.truncated;\n\t\t\t\treturn formatted.text;\n\t\t\t};\n\t\t\tconst onData = (data: Buffer) => {\n\t\t\t\tchunks.push(data);\n\t\t\t\tchunksBytes += data.length;\n\t\t\t\twhile (chunksBytes > maxBufferedBytes) {\n\t\t\t\t\tconst excess = chunksBytes - maxBufferedBytes;\n\t\t\t\t\tconst first = chunks[0];\n\t\t\t\t\tif (first.length <= excess) {\n\t\t\t\t\t\tchunks.shift();\n\t\t\t\t\t\tchunksBytes -= first.length;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tchunks[0] = first.subarray(excess);\n\t\t\t\t\t\tchunksBytes -= excess;\n\t\t\t\t\t}\n\t\t\t\t\tomittedEarlierOutput = true;\n\t\t\t\t}\n\t\t\t\tonUpdate?.({\n\t\t\t\t\tcontent: [{ type: \"text\", text: currentOutput() }],\n\t\t\t\t\tdetails: details(\"watching\"),\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tonUpdate?.({ content: [], details: details(\"watching\") });\n\n\t\t\tlet exitCode: number | null;\n\t\t\ttry {\n\t\t\t\t({ exitCode } = await operations.exec(args, cwd, {\n\t\t\t\t\tonData,\n\t\t\t\t\tsignal,\n\t\t\t\t\tenv: {\n\t\t\t\t\t\t...getShellEnv(),\n\t\t\t\t\t\tGH_PAGER: \"cat\",\n\t\t\t\t\t\tGH_EDITOR: \"cat\",\n\t\t\t\t\t\tNO_COLOR: \"1\",\n\t\t\t\t\t},\n\t\t\t\t}));\n\t\t\t} catch (error) {\n\t\t\t\tconst output = chunks.length > 0 ? `${currentOutput()}\\n\\n` : \"\";\n\t\t\t\tif (error instanceof Error && error.message === \"aborted\") {\n\t\t\t\t\tthrow new Error(`${output}GitHub CI watch aborted.`);\n\t\t\t\t}\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\tthrow new Error(`${output}GitHub CI watch could not run: ${message}`);\n\t\t\t}\n\n\t\t\tconst output = currentOutput();\n\t\t\tif (exitCode === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `GitHub CI checks passed.\\n\\n${output}` }],\n\t\t\t\t\tdetails: details(\"passed\", exitCode),\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (exitCode === 1) {\n\t\t\t\tconst cliFailure = detectGhCliFailure(output);\n\t\t\t\tif (cliFailure !== null) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`GitHub CI watch could not query checks: the GitHub CLI reported an error (matched \"${cliFailure}\"). This is a CLI-level failure such as a bad pull-request selector, no pull request for the branch, a missing repository, or an authentication problem — not a failed-check result. Re-check the selector and \\`gh auth status\\`.\\n\\n${output}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: `GitHub CI checks did not pass. The GitHub CLI exited with code 1.\\n\\n${output}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: details(\"failed\", exitCode),\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (exitCode === 8) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`GitHub CI watch exited while checks were still pending (exit code 8); refusing to treat this as a terminal result.\\n\\n${output}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new Error(\n\t\t\t\t`GitHub CI watch exited unexpectedly${exitCode === null ? \" without an exit code\" : ` with code ${exitCode}`}.\\n\\n${output}`,\n\t\t\t);\n\t\t},\n\t};\n}\n\nexport function createWatchGithubCiTool(\n\tcwd: string,\n\toptions?: WatchGithubCiToolOptions,\n): AgentTool<typeof watchGithubCiSchema> {\n\treturn wrapToolDefinition(createWatchGithubCiToolDefinition(cwd, options));\n}\n\nexport const watchGithubCiToolDefinition = createWatchGithubCiToolDefinition(process.cwd());\nexport const watchGithubCiTool = createWatchGithubCiTool(process.cwd());\n"]}
@@ -0,0 +1,204 @@
1
+ import { spawn } from "node:child_process";
2
+ import { existsSync } from "node:fs";
3
+ import { Type } from "@sinclair/typebox";
4
+ import { waitForChildProcess } from "../../utils/child-process.js";
5
+ import { getShellEnv, killProcessTree } from "../../utils/shell.js";
6
+ import { renderTerminalOutput } from "./terminal-render.js";
7
+ import { wrapToolDefinition } from "./tool-definition-wrapper.js";
8
+ import { DEFAULT_MAX_BYTES, truncateTail } from "./truncate.js";
9
+ const watchGithubCiSchema = Type.Object({
10
+ pr: Type.Optional(Type.String({
11
+ description: "Optional pull request number, URL, or branch. Omit to use the pull request for the current branch.",
12
+ })),
13
+ });
14
+ /**
15
+ * Substrings (matched case-insensitively) that identify a `gh pr checks` CLI-level
16
+ * failure rather than a real failed-check result. `gh pr checks` exits 1 for both,
17
+ * and `--json` is incompatible with `--watch`, so the captured output is the only
18
+ * way to tell them apart. These signatures are specific enough that they will not
19
+ * appear in a normal check-status table.
20
+ */
21
+ const GH_CLI_FAILURE_SIGNATURES = [
22
+ "no pull requests found",
23
+ "could not resolve to a pullrequest",
24
+ "failed to run git",
25
+ "not a git repository",
26
+ "http 401",
27
+ "bad credentials",
28
+ "could not parse",
29
+ "invalid pull request",
30
+ "authentication required",
31
+ "could not find repository",
32
+ ];
33
+ function detectGhCliFailure(output) {
34
+ const lower = output.toLowerCase();
35
+ for (const signature of GH_CLI_FAILURE_SIGNATURES) {
36
+ if (lower.includes(signature)) {
37
+ return signature;
38
+ }
39
+ }
40
+ return null;
41
+ }
42
+ export function createLocalGithubCiOperations() {
43
+ return {
44
+ exec: (args, cwd, { onData, signal, env }) => new Promise((resolve, reject) => {
45
+ if (!existsSync(cwd)) {
46
+ reject(new Error(`Working directory does not exist: ${cwd}`));
47
+ return;
48
+ }
49
+ if (signal?.aborted) {
50
+ reject(new Error("aborted"));
51
+ return;
52
+ }
53
+ const child = spawn("gh", [...args], {
54
+ cwd,
55
+ detached: true,
56
+ env,
57
+ stdio: ["ignore", "pipe", "pipe"],
58
+ });
59
+ child.stdout?.on("data", onData);
60
+ child.stderr?.on("data", onData);
61
+ const onAbort = () => {
62
+ if (child.pid)
63
+ killProcessTree(child.pid);
64
+ };
65
+ signal?.addEventListener("abort", onAbort, { once: true });
66
+ waitForChildProcess(child)
67
+ .then((exitCode) => {
68
+ signal?.removeEventListener("abort", onAbort);
69
+ if (signal?.aborted) {
70
+ reject(new Error("aborted"));
71
+ return;
72
+ }
73
+ resolve({ exitCode });
74
+ })
75
+ .catch((error) => {
76
+ signal?.removeEventListener("abort", onAbort);
77
+ reject(error);
78
+ });
79
+ }),
80
+ };
81
+ }
82
+ function formatOutput(chunks, omittedEarlierOutput) {
83
+ const rendered = renderTerminalOutput(Buffer.concat(chunks).toString("utf-8"));
84
+ const truncation = truncateTail(rendered);
85
+ const prefix = omittedEarlierOutput ? "[Earlier watch output omitted]\n" : "";
86
+ return {
87
+ text: `${prefix}${truncation.content || "(no output)"}`,
88
+ truncated: omittedEarlierOutput || truncation.truncated,
89
+ };
90
+ }
91
+ export function createWatchGithubCiToolDefinition(cwd, options) {
92
+ const operations = options?.operations ?? createLocalGithubCiOperations();
93
+ return {
94
+ name: "watch_github_ci",
95
+ label: "watch GitHub CI",
96
+ description: "Watch GitHub pull-request checks until they pass or fail. Uses the current branch's pull request by default, or an optional pull request number, URL, or branch. Returns the final GitHub CLI output without requiring user input.",
97
+ promptSnippet: "Watch GitHub pull-request CI until checks pass or fail",
98
+ promptGuidelines: [
99
+ "Use `watch_github_ci` to wait for GitHub pull-request checks instead of asking the user, polling with repeated commands, sleeping, or using `wait`",
100
+ "`watch_github_ci` blocks until the selected pull request's checks pass or fail; omit `pr` to use the current branch's pull request",
101
+ ],
102
+ parameters: watchGithubCiSchema,
103
+ async execute(_toolCallId, params, signal, onUpdate) {
104
+ const selector = params.pr?.trim();
105
+ if (params.pr !== undefined && !selector) {
106
+ throw new Error("Pull request selector must not be blank.");
107
+ }
108
+ if (selector?.startsWith("-")) {
109
+ throw new Error("Pull request selector must not begin with '-'.");
110
+ }
111
+ const args = ["pr", "checks", ...(selector ? [selector] : []), "--watch", "--fail-fast"];
112
+ const chunks = [];
113
+ let chunksBytes = 0;
114
+ let omittedEarlierOutput = false;
115
+ let outputTruncated = false;
116
+ const maxBufferedBytes = DEFAULT_MAX_BYTES * 2;
117
+ const details = (status, exitCode) => ({
118
+ status,
119
+ exitCode,
120
+ outputTruncated,
121
+ });
122
+ const currentOutput = () => {
123
+ const formatted = formatOutput(chunks, omittedEarlierOutput);
124
+ outputTruncated = formatted.truncated;
125
+ return formatted.text;
126
+ };
127
+ const onData = (data) => {
128
+ chunks.push(data);
129
+ chunksBytes += data.length;
130
+ while (chunksBytes > maxBufferedBytes) {
131
+ const excess = chunksBytes - maxBufferedBytes;
132
+ const first = chunks[0];
133
+ if (first.length <= excess) {
134
+ chunks.shift();
135
+ chunksBytes -= first.length;
136
+ }
137
+ else {
138
+ chunks[0] = first.subarray(excess);
139
+ chunksBytes -= excess;
140
+ }
141
+ omittedEarlierOutput = true;
142
+ }
143
+ onUpdate?.({
144
+ content: [{ type: "text", text: currentOutput() }],
145
+ details: details("watching"),
146
+ });
147
+ };
148
+ onUpdate?.({ content: [], details: details("watching") });
149
+ let exitCode;
150
+ try {
151
+ ({ exitCode } = await operations.exec(args, cwd, {
152
+ onData,
153
+ signal,
154
+ env: {
155
+ ...getShellEnv(),
156
+ GH_PAGER: "cat",
157
+ GH_EDITOR: "cat",
158
+ NO_COLOR: "1",
159
+ },
160
+ }));
161
+ }
162
+ catch (error) {
163
+ const output = chunks.length > 0 ? `${currentOutput()}\n\n` : "";
164
+ if (error instanceof Error && error.message === "aborted") {
165
+ throw new Error(`${output}GitHub CI watch aborted.`);
166
+ }
167
+ const message = error instanceof Error ? error.message : String(error);
168
+ throw new Error(`${output}GitHub CI watch could not run: ${message}`);
169
+ }
170
+ const output = currentOutput();
171
+ if (exitCode === 0) {
172
+ return {
173
+ content: [{ type: "text", text: `GitHub CI checks passed.\n\n${output}` }],
174
+ details: details("passed", exitCode),
175
+ };
176
+ }
177
+ if (exitCode === 1) {
178
+ const cliFailure = detectGhCliFailure(output);
179
+ if (cliFailure !== null) {
180
+ throw new Error(`GitHub CI watch could not query checks: the GitHub CLI reported an error (matched "${cliFailure}"). This is a CLI-level failure such as a bad pull-request selector, no pull request for the branch, a missing repository, or an authentication problem — not a failed-check result. Re-check the selector and \`gh auth status\`.\n\n${output}`);
181
+ }
182
+ return {
183
+ content: [
184
+ {
185
+ type: "text",
186
+ text: `GitHub CI checks did not pass. The GitHub CLI exited with code 1.\n\n${output}`,
187
+ },
188
+ ],
189
+ details: details("failed", exitCode),
190
+ };
191
+ }
192
+ if (exitCode === 8) {
193
+ throw new Error(`GitHub CI watch exited while checks were still pending (exit code 8); refusing to treat this as a terminal result.\n\n${output}`);
194
+ }
195
+ throw new Error(`GitHub CI watch exited unexpectedly${exitCode === null ? " without an exit code" : ` with code ${exitCode}`}.\n\n${output}`);
196
+ },
197
+ };
198
+ }
199
+ export function createWatchGithubCiTool(cwd, options) {
200
+ return wrapToolDefinition(createWatchGithubCiToolDefinition(cwd, options));
201
+ }
202
+ export const watchGithubCiToolDefinition = createWatchGithubCiToolDefinition(process.cwd());
203
+ export const watchGithubCiTool = createWatchGithubCiTool(process.cwd());
204
+ //# sourceMappingURL=watch-github-ci.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-github-ci.js","sourceRoot":"","sources":["../../../src/core/tools/watch-github-ci.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEhE,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAChB,IAAI,CAAC,MAAM,CAAC;QACX,WAAW,EACV,oGAAoG;KACrG,CAAC,CACF;CACD,CAAC,CAAC;AA0BH;;;;;;GAMG;AACH,MAAM,yBAAyB,GAAG;IACjC,wBAAwB;IACxB,oCAAoC;IACpC,mBAAmB;IACnB,sBAAsB;IACtB,UAAU;IACV,iBAAiB;IACjB,iBAAiB;IACjB,sBAAsB;IACtB,yBAAyB;IACzB,2BAA2B;CAC3B,CAAC;AAEF,SAAS,kBAAkB,CAAC,MAAc,EAAiB;IAC1D,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACnC,KAAK,MAAM,SAAS,IAAI,yBAAyB,EAAE,CAAC;QACnD,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;Y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AC;YACD,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CACd,yHAAyH,MAAM,EAAE,CACjI,CAAC;YACH,CAAC;YACD,MAAM,IAAI,KAAK,CACd,sCAAsC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,cAAc,QAAQ,EAAE,QAAQ,MAAM,EAAE,CAC5H,CAAC;QAAA,CACF;KACD,CAAC;AAAA,CACF;AAED,MAAM,UAAU,uBAAuB,CACtC,GAAW,EACX,OAAkC,EACM;IACxC,OAAO,kBAAkB,CAAC,iCAAiC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAAA,CAC3E;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,iCAAiC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAC5F,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["import { spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport type { AgentTool } from \"@dreb/agent-core\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { waitForChildProcess } from \"../../utils/child-process.js\";\nimport { getShellEnv, killProcessTree } from \"../../utils/shell.js\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\nimport { renderTerminalOutput } from \"./terminal-render.js\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.js\";\nimport { DEFAULT_MAX_BYTES, truncateTail } from \"./truncate.js\";\n\nconst watchGithubCiSchema = Type.Object({\n\tpr: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Optional pull request number, URL, or branch. Omit to use the pull request for the current branch.\",\n\t\t}),\n\t),\n});\n\nexport type WatchGithubCiToolInput = Static<typeof watchGithubCiSchema>;\n\nexport interface WatchGithubCiToolDetails {\n\tstatus: \"watching\" | \"passed\" | \"failed\";\n\texitCode?: number;\n\toutputTruncated: boolean;\n}\n\nexport interface GithubCiOperations {\n\texec: (\n\t\targs: readonly string[],\n\t\tcwd: string,\n\t\toptions: {\n\t\t\tonData: (data: Buffer) => void;\n\t\t\tsignal?: AbortSignal;\n\t\t\tenv: NodeJS.ProcessEnv;\n\t\t},\n\t) => Promise<{ exitCode: number | null }>;\n}\n\nexport interface WatchGithubCiToolOptions {\n\toperations?: GithubCiOperations;\n}\n\n/**\n * Substrings (matched case-insensitively) that identify a `gh pr checks` CLI-level\n * failure rather than a real failed-check result. `gh pr checks` exits 1 for both,\n * and `--json` is incompatible with `--watch`, so the captured output is the only\n * way to tell them apart. These signatures are specific enough that they will not\n * appear in a normal check-status table.\n */\nconst GH_CLI_FAILURE_SIGNATURES = [\n\t\"no pull requests found\",\n\t\"could not resolve to a pullrequest\",\n\t\"failed to run git\",\n\t\"not a git repository\",\n\t\"http 401\",\n\t\"bad credentials\",\n\t\"could not parse\",\n\t\"invalid pull request\",\n\t\"authentication required\",\n\t\"could not find repository\",\n];\n\nfunction detectGhCliFailure(output: string): string | null {\n\tconst lower = output.toLowerCase();\n\tfor (const signature of GH_CLI_FAILURE_SIGNATURES) {\n\t\tif (lower.includes(signature)) {\n\t\t\treturn signature;\n\t\t}\n\t}\n\treturn null;\n}\n\nexport function createLocalGithubCiOperations(): GithubCiOperations {\n\treturn {\n\t\texec: (args, cwd, { onData, signal, env }) =>\n\t\t\tnew Promise((resolve, reject) => {\n\t\t\t\tif (!existsSync(cwd)) {\n\t\t\t\t\treject(new Error(`Working directory does not exist: ${cwd}`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\treject(new Error(\"aborted\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst child = spawn(\"gh\", [...args], {\n\t\t\t\t\tcwd,\n\t\t\t\t\tdetached: true,\n\t\t\t\t\tenv,\n\t\t\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\t\t});\n\t\t\t\tchild.stdout?.on(\"data\", onData);\n\t\t\t\tchild.stderr?.on(\"data\", onData);\n\n\t\t\t\tconst onAbort = () => {\n\t\t\t\t\tif (child.pid) killProcessTree(child.pid);\n\t\t\t\t};\n\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\n\t\t\t\twaitForChildProcess(child)\n\t\t\t\t\t.then((exitCode) => {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\t\t\treject(new Error(\"aborted\"));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresolve({ exitCode });\n\t\t\t\t\t})\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t});\n\t\t\t}),\n\t};\n}\n\nfunction formatOutput(chunks: readonly Buffer[], omittedEarlierOutput: boolean): { text: string; truncated: boolean } {\n\tconst rendered = renderTerminalOutput(Buffer.concat(chunks).toString(\"utf-8\"));\n\tconst truncation = truncateTail(rendered);\n\tconst prefix = omittedEarlierOutput ? \"[Earlier watch output omitted]\\n\" : \"\";\n\treturn {\n\t\ttext: `${prefix}${truncation.content || \"(no output)\"}`,\n\t\ttruncated: omittedEarlierOutput || truncation.truncated,\n\t};\n}\n\nexport function createWatchGithubCiToolDefinition(\n\tcwd: string,\n\toptions?: WatchGithubCiToolOptions,\n): ToolDefinition<typeof watchGithubCiSchema, WatchGithubCiToolDetails> {\n\tconst operations = options?.operations ?? createLocalGithubCiOperations();\n\n\treturn {\n\t\tname: \"watch_github_ci\",\n\t\tlabel: \"watch GitHub CI\",\n\t\tdescription:\n\t\t\t\"Watch GitHub pull-request checks until they pass or fail. Uses the current branch's pull request by default, or an optional pull request number, URL, or branch. Returns the final GitHub CLI output without requiring user input.\",\n\t\tpromptSnippet: \"Watch GitHub pull-request CI until checks pass or fail\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use `watch_github_ci` to wait for GitHub pull-request checks instead of asking the user, polling with repeated commands, sleeping, or using `wait`\",\n\t\t\t\"`watch_github_ci` blocks until the selected pull request's checks pass or fail; omit `pr` to use the current branch's pull request\",\n\t\t],\n\t\tparameters: watchGithubCiSchema,\n\t\tasync execute(_toolCallId, params, signal, onUpdate) {\n\t\t\tconst selector = params.pr?.trim();\n\t\t\tif (params.pr !== undefined && !selector) {\n\t\t\t\tthrow new Error(\"Pull request selector must not be blank.\");\n\t\t\t}\n\t\t\tif (selector?.startsWith(\"-\")) {\n\t\t\t\tthrow new Error(\"Pull request selector must not begin with '-'.\");\n\t\t\t}\n\n\t\t\tconst args = [\"pr\", \"checks\", ...(selector ? [selector] : []), \"--watch\", \"--fail-fast\"];\n\t\t\tconst chunks: Buffer[] = [];\n\t\t\tlet chunksBytes = 0;\n\t\t\tlet omittedEarlierOutput = false;\n\t\t\tlet outputTruncated = false;\n\t\t\tconst maxBufferedBytes = DEFAULT_MAX_BYTES * 2;\n\n\t\t\tconst details = (status: WatchGithubCiToolDetails[\"status\"], exitCode?: number) => ({\n\t\t\t\tstatus,\n\t\t\t\texitCode,\n\t\t\t\toutputTruncated,\n\t\t\t});\n\t\t\tconst currentOutput = (): string => {\n\t\t\t\tconst formatted = formatOutput(chunks, omittedEarlierOutput);\n\t\t\t\toutputTruncated = formatted.truncated;\n\t\t\t\treturn formatted.text;\n\t\t\t};\n\t\t\tconst onData = (data: Buffer) => {\n\t\t\t\tchunks.push(data);\n\t\t\t\tchunksBytes += data.length;\n\t\t\t\twhile (chunksBytes > maxBufferedBytes) {\n\t\t\t\t\tconst excess = chunksBytes - maxBufferedBytes;\n\t\t\t\t\tconst first = chunks[0];\n\t\t\t\t\tif (first.length <= excess) {\n\t\t\t\t\t\tchunks.shift();\n\t\t\t\t\t\tchunksBytes -= first.length;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tchunks[0] = first.subarray(excess);\n\t\t\t\t\t\tchunksBytes -= excess;\n\t\t\t\t\t}\n\t\t\t\t\tomittedEarlierOutput = true;\n\t\t\t\t}\n\t\t\t\tonUpdate?.({\n\t\t\t\t\tcontent: [{ type: \"text\", text: currentOutput() }],\n\t\t\t\t\tdetails: details(\"watching\"),\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tonUpdate?.({ content: [], details: details(\"watching\") });\n\n\t\t\tlet exitCode: number | null;\n\t\t\ttry {\n\t\t\t\t({ exitCode } = await operations.exec(args, cwd, {\n\t\t\t\t\tonData,\n\t\t\t\t\tsignal,\n\t\t\t\t\tenv: {\n\t\t\t\t\t\t...getShellEnv(),\n\t\t\t\t\t\tGH_PAGER: \"cat\",\n\t\t\t\t\t\tGH_EDITOR: \"cat\",\n\t\t\t\t\t\tNO_COLOR: \"1\",\n\t\t\t\t\t},\n\t\t\t\t}));\n\t\t\t} catch (error) {\n\t\t\t\tconst output = chunks.length > 0 ? `${currentOutput()}\\n\\n` : \"\";\n\t\t\t\tif (error instanceof Error && error.message === \"aborted\") {\n\t\t\t\t\tthrow new Error(`${output}GitHub CI watch aborted.`);\n\t\t\t\t}\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\tthrow new Error(`${output}GitHub CI watch could not run: ${message}`);\n\t\t\t}\n\n\t\t\tconst output = currentOutput();\n\t\t\tif (exitCode === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `GitHub CI checks passed.\\n\\n${output}` }],\n\t\t\t\t\tdetails: details(\"passed\", exitCode),\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (exitCode === 1) {\n\t\t\t\tconst cliFailure = detectGhCliFailure(output);\n\t\t\t\tif (cliFailure !== null) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`GitHub CI watch could not query checks: the GitHub CLI reported an error (matched \"${cliFailure}\"). This is a CLI-level failure such as a bad pull-request selector, no pull request for the branch, a missing repository, or an authentication problem — not a failed-check result. Re-check the selector and \\`gh auth status\\`.\\n\\n${output}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: `GitHub CI checks did not pass. The GitHub CLI exited with code 1.\\n\\n${output}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: details(\"failed\", exitCode),\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (exitCode === 8) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`GitHub CI watch exited while checks were still pending (exit code 8); refusing to treat this as a terminal result.\\n\\n${output}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new Error(\n\t\t\t\t`GitHub CI watch exited unexpectedly${exitCode === null ? \" without an exit code\" : ` with code ${exitCode}`}.\\n\\n${output}`,\n\t\t\t);\n\t\t},\n\t};\n}\n\nexport function createWatchGithubCiTool(\n\tcwd: string,\n\toptions?: WatchGithubCiToolOptions,\n): AgentTool<typeof watchGithubCiSchema> {\n\treturn wrapToolDefinition(createWatchGithubCiToolDefinition(cwd, options));\n}\n\nexport const watchGithubCiToolDefinition = createWatchGithubCiToolDefinition(process.cwd());\nexport const watchGithubCiTool = createWatchGithubCiTool(process.cwd());\n"]}
package/dist/index.d.ts CHANGED
@@ -12,12 +12,12 @@ export type { PackageManager, PathMetadata, ProgressCallback, ProgressEvent, Res
12
12
  export { DefaultPackageManager } from "./core/package-manager.js";
13
13
  export type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from "./core/resource-loader.js";
14
14
  export { DefaultResourceLoader } from "./core/resource-loader.js";
15
- export { type CreateAgentSessionOptions, type CreateAgentSessionResult, createAgentSession, createBashTool, createCodingTools, createEditTool, createFindTool, createGrepTool, createLsTool, createReadOnlyTools, createReadTool, createWriteTool, type PromptTemplate, readOnlyTools, } from "./core/sdk.js";
15
+ export { type CreateAgentSessionOptions, type CreateAgentSessionResult, createAgentSession, createBashTool, createCodingTools, createEditTool, createFindTool, createGrepTool, createLsTool, createReadOnlyTools, createReadTool, createWatchGithubCiTool, createWriteTool, type PromptTemplate, readOnlyTools, } from "./core/sdk.js";
16
16
  export { type BranchSummaryEntry, buildSessionContext, type CompactionEntry, CURRENT_SESSION_VERSION, type CustomEntry, type CustomMessageEntry, type FileEntry, getLatestCompactionEntry, type ModelChangeEntry, migrateSessionEntries, type NewSessionOptions, parseSessionEntries, type SessionContext, type SessionEntry, type SessionEntryBase, type SessionHeader, type SessionInfo, type SessionInfoEntry, SessionManager, type SessionMessageEntry, type ThinkingLevelChangeEntry, } from "./core/session-manager.js";
17
17
  export { type CompactionSettings, type ImageSettings, type PackageSource, type RetrySettings, SettingsManager, } from "./core/settings-manager.js";
18
18
  export { formatSkillsForPrompt, type LoadSkillsFromDirOptions, type LoadSkillsResult, loadSkills, loadSkillsFromDir, type Skill, type SkillFrontmatter, } from "./core/skills.js";
19
19
  export { createSyntheticSourceInfo } from "./core/source-info.js";
20
- export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, bashTool, bashToolDefinition, codingTools, createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, editTool, editToolDefinition, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, findTool, findToolDefinition, formatSize, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, grepTool, grepToolDefinition, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, lsTool, lsToolDefinition, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, readTool, readToolDefinition, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, type WriteOperations, type WriteToolInput, type WriteToolOptions, withFileMutationQueue, writeTool, writeToolDefinition, } from "./core/tools/index.js";
20
+ export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, bashTool, bashToolDefinition, codingTools, createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLocalGithubCiOperations, createLsToolDefinition, createReadToolDefinition, createWatchGithubCiToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, editTool, editToolDefinition, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, findTool, findToolDefinition, formatSize, type GithubCiOperations, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, grepTool, grepToolDefinition, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, lsTool, lsToolDefinition, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, readTool, readToolDefinition, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, type WatchGithubCiToolDetails, type WatchGithubCiToolInput, type WatchGithubCiToolOptions, type WriteOperations, type WriteToolInput, type WriteToolOptions, watchGithubCiTool, watchGithubCiToolDefinition, withFileMutationQueue, writeTool, writeToolDefinition, } from "./core/tools/index.js";
21
21
  export { main } from "./main.js";
22
22
  export { InteractiveMode, type InteractiveModeOptions, type PrintModeOptions, runPrintMode, runRpcMode, } from "./modes/index.js";
23
23
  export { ArminComponent, AssistantMessageComponent, BashExecutionComponent, BorderedLoader, BranchSummaryMessageComponent, CompactionSummaryMessageComponent, CustomEditor, CustomMessageComponent, DynamicBorder, ExtensionEditorComponent, ExtensionInputComponent, ExtensionSelectorComponent, FooterComponent, keyHint, keyText, LoginDialogComponent, ModelSelectorComponent, OAuthSelectorComponent, type RenderDiffOptions, rawKeyHint, renderDiff, SessionSelectorComponent, type SettingsCallbacks, type SettingsConfig, SettingsSelectorComponent, ShowImagesSelectorComponent, SkillInvocationMessageComponent, ThemeSelectorComponent, ThinkingSelectorComponent, ToolExecutionComponent, type ToolExecutionOptions, TreeSelectorComponent, truncateToVisualLines, UserMessageComponent, UserMessageSelectorComponent, type VisualTruncateResult, } from "./modes/interactive/components/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,YAAY,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,WAAW,EACX,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,eAAe,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EACd,KAAK,cAAc,EACnB,YAAY,EACZ,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE7F,YAAY,EACX,aAAa,EACb,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,0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,EACrB,YAAY,EACZ,UAAU,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,cAAc,EACd,6BAA6B,EAC7B,iCAAiC,EACjC,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,OAAO,EACP,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,UAAU,EACV,UAAU,EACV,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,KAAK,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport { getAgentDir, getSecretsDir, loadProvidersEnv, VERSION } from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.js\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionForkEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionSwitchEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.js\";\nexport {\n\tcreateExtensionRuntime,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.js\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.js\";\nexport { convertToLlm } from \"./core/messages.js\";\nexport { ModelRegistry } from \"./core/model-registry.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.js\";\nexport { DefaultPackageManager } from \"./core/package-manager.js\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.js\";\nexport { DefaultResourceLoader } from \"./core/resource-loader.js\";\n// SDK for programmatic usage\nexport {\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\t// Factory\n\tcreateAgentSession,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\t// Pre-built tools (use process.cwd())\n\treadOnlyTools,\n} from \"./core/sdk.js\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.js\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.js\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.js\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.js\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcodingTools,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\teditToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tfindToolDefinition,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\tgrepToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\tlsToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n\twriteTool,\n\twriteToolDefinition,\n} from \"./core/tools/index.js\";\n// Main entry point\nexport { main } from \"./main.js\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype PrintModeOptions,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.js\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.js\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Clipboard utilities\nexport { type ClipboardResult, copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.js\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.js\";\n"]}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,YAAY,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,WAAW,EACX,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,eAAe,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,iBAAiB,EACtB,K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C5B,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,KAAK,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport { getAgentDir, getSecretsDir, loadProvidersEnv, VERSION } from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.js\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionForkEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionSwitchEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.js\";\nexport {\n\tcreateExtensionRuntime,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.js\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.js\";\nexport { convertToLlm } from \"./core/messages.js\";\nexport { ModelRegistry } from \"./core/model-registry.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.js\";\nexport { DefaultPackageManager } from \"./core/package-manager.js\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.js\";\nexport { DefaultResourceLoader } from \"./core/resource-loader.js\";\n// SDK for programmatic usage\nexport {\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\t// Factory\n\tcreateAgentSession,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWatchGithubCiTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\t// Pre-built tools (use process.cwd())\n\treadOnlyTools,\n} from \"./core/sdk.js\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.js\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.js\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.js\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.js\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcodingTools,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLocalGithubCiOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWatchGithubCiToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\teditToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tfindToolDefinition,\n\tformatSize,\n\ttype GithubCiOperations,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\tgrepToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\tlsToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WatchGithubCiToolDetails,\n\ttype WatchGithubCiToolInput,\n\ttype WatchGithubCiToolOptions,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twatchGithubCiTool,\n\twatchGithubCiToolDefinition,\n\twithFileMutationQueue,\n\twriteTool,\n\twriteToolDefinition,\n} from \"./core/tools/index.js\";\n// Main entry point\nexport { main } from \"./main.js\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype PrintModeOptions,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.js\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.js\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Clipboard utilities\nexport { type ClipboardResult, copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.js\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.js\";\n"]}
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ export {
17
17
  // Factory
18
18
  createAgentSession, createBashTool,
19
19
  // Tool factories (for custom cwd)
20
- createCodingTools, createEditTool, createFindTool, createGrepTool, createLsTool, createReadOnlyTools, createReadTool, createWriteTool,
20
+ createCodingTools, createEditTool, createFindTool, createGrepTool, createLsTool, createReadOnlyTools, createReadTool, createWatchGithubCiTool, createWriteTool,
21
21
  // Pre-built tools (use process.cwd())
22
22
  readOnlyTools, } from "./core/sdk.js";
23
23
  export { buildSessionContext, CURRENT_SESSION_VERSION, getLatestCompactionEntry, migrateSessionEntries, parseSessionEntries, SessionManager, } from "./core/session-manager.js";
@@ -26,7 +26,7 @@ export { SettingsManager, } from "./core/settings-manager.js";
26
26
  export { formatSkillsForPrompt, loadSkills, loadSkillsFromDir, } from "./core/skills.js";
27
27
  export { createSyntheticSourceInfo } from "./core/source-info.js";
28
28
  // Tools
29
- export { bashTool, bashToolDefinition, codingTools, createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, editTool, editToolDefinition, findTool, findToolDefinition, formatSize, grepTool, grepToolDefinition, lsTool, lsToolDefinition, readTool, readToolDefinition, truncateHead, truncateLine, truncateTail, withFileMutationQueue, writeTool, writeToolDefinition, } from "./core/tools/index.js";
29
+ export { bashTool, bashToolDefinition, codingTools, createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLocalGithubCiOperations, createLsToolDefinition, createReadToolDefinition, createWatchGithubCiToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, editTool, editToolDefinition, findTool, findToolDefinition, formatSize, grepTool, grepToolDefinition, lsTool, lsToolDefinition, readTool, readToolDefinition, truncateHead, truncateLine, truncateTail, watchGithubCiTool, watchGithubCiToolDefinition, withFileMutationQueue, writeTool, writeToolDefinition, } from "./core/tools/index.js";
30
30
  // Main entry point
31
31
  export { main } from "./main.js";
32
32
  // Run modes for programmatic SDK usage
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,0BAA0B;AAC1B,OAAO,EAGN,WAAW,EAEX,sBAAsB,EACtB,0BAA0B,GAE1B,MAAM,wBAAwB,CAAC;AAChC,aAAa;AACb,OAAO,EAMN,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EAEd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAA0C,MAAM,qBAAqB,CAAC;AA+E7F,OAAO,EACN,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,E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M,uBAAuB,CAAC;AAC/B,mBAAmB;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,uCAAuC;AACvC,OAAO,EACN,eAAe,EAGf,YAAY,EACZ,UAAU,GACV,MAAM,kBAAkB,CAAC;AAC1B,+BAA+B;AAC/B,OAAO,EACN,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,cAAc,EACd,6BAA6B,EAC7B,iCAAiC,EACjC,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,OAAO,EACP,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EAEtB,UAAU,EACV,UAAU,EACV,wBAAwB,EAGxB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EAEtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,GAE5B,MAAM,yCAAyC,CAAC;AACjD,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,sBAAsB;AACtB,OAAO,EAAwB,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport { getAgentDir, getSecretsDir, loadProvidersEnv, VERSION } from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.js\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionForkEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionSwitchEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.js\";\nexport {\n\tcreateExtensionRuntime,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.js\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.js\";\nexport { convertToLlm } from \"./core/messages.js\";\nexport { ModelRegistry } from \"./core/model-registry.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.js\";\nexport { DefaultPackageManager } from \"./core/package-manager.js\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.js\";\nexport { DefaultResourceLoader } from \"./core/resource-loader.js\";\n// SDK for programmatic usage\nexport {\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\t// Factory\n\tcreateAgentSession,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\t// Pre-built tools (use process.cwd())\n\treadOnlyTools,\n} from \"./core/sdk.js\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.js\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.js\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.js\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.js\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcodingTools,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\teditToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tfindToolDefinition,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\tgrepToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\tlsToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n\twriteTool,\n\twriteToolDefinition,\n} from \"./core/tools/index.js\";\n// Main entry point\nexport { main } from \"./main.js\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype PrintModeOptions,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.js\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.js\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Clipboard utilities\nexport { type ClipboardResult, copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.js\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,0BAA0B;AAC1B,OAAO,EAGN,WAAW,EAEX,sBAAsB,EACtB,0BAA0B,GAE1B,MAAM,wBAAwB,CAAC;AAChC,aAAa;AACb,OAAO,EAMN,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EAEd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,oBAA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,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport { getAgentDir, getSecretsDir, loadProvidersEnv, VERSION } from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.js\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionForkEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionSwitchEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.js\";\nexport {\n\tcreateExtensionRuntime,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.js\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.js\";\nexport { convertToLlm } from \"./core/messages.js\";\nexport { ModelRegistry } from \"./core/model-registry.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.js\";\nexport { DefaultPackageManager } from \"./core/package-manager.js\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.js\";\nexport { DefaultResourceLoader } from \"./core/resource-loader.js\";\n// SDK for programmatic usage\nexport {\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\t// Factory\n\tcreateAgentSession,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWatchGithubCiTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\t// Pre-built tools (use process.cwd())\n\treadOnlyTools,\n} from \"./core/sdk.js\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.js\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.js\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.js\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.js\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcodingTools,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLocalGithubCiOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWatchGithubCiToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\teditToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tfindToolDefinition,\n\tformatSize,\n\ttype GithubCiOperations,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\tgrepToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\tlsToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WatchGithubCiToolDetails,\n\ttype WatchGithubCiToolInput,\n\ttype WatchGithubCiToolOptions,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twatchGithubCiTool,\n\twatchGithubCiToolDefinition,\n\twithFileMutationQueue,\n\twriteTool,\n\twriteToolDefinition,\n} from \"./core/tools/index.js\";\n// Main entry point\nexport { main } from \"./main.js\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype PrintModeOptions,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.js\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.js\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Clipboard utilities\nexport { type ClipboardResult, copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.js\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.js\";\n"]}
@@ -613,7 +613,7 @@ In the default parallel tool execution mode, sibling tool calls from the same as
613
613
  import { isToolCallEventType } from "@dreb/coding-agent";
614
614
 
615
615
  dreb.on("tool_call", async (event, ctx) => {
616
- // event.toolName - "bash", "read", "write", "edit", "grep", "find", "ls", "web_search", "web_fetch", "subagent", "wait", "search", "ask_user", "skill", "tasks_update", "suggest_next", or custom tool names
616
+ // event.toolName - "bash", "read", "write", "edit", "grep", "find", "ls", "web_search", "web_fetch", "subagent", "wait", "watch_github_ci", "search", "ask_user", "skill", "tasks_update", "suggest_next", or custom tool names
617
617
  // event.toolCallId
618
618
  // event.input - tool parameters
619
619
 
@@ -1518,7 +1518,7 @@ async execute(toolCallId, params) {
1518
1518
 
1519
1519
  ### Overriding Built-in Tools
1520
1520
 
1521
- Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, `web_search`, `web_fetch`, `subagent`, `wait`, `search`, `ask_user`) by registering a tool with the same name. Interactive mode displays a warning when this happens. The factory-only tools (`skill`, `tasks_update`, `suggest_next`) can also be overridden.
1521
+ Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, `web_search`, `web_fetch`, `subagent`, `wait`, `watch_github_ci`, `search`, `ask_user`) by registering a tool with the same name. Interactive mode displays a warning when this happens. The factory-only tools (`skill`, `tasks_update`, `suggest_next`) can also be overridden.
1522
1522
 
1523
1523
  ```bash
1524
1524
  # Extension's read tool replaces built-in read
@@ -1549,6 +1549,8 @@ Built-in tool implementations:
1549
1549
  - [ls.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/ls.ts) - `LsToolDetails`
1550
1550
  - [web.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/web.ts) - `web_search` and `web_fetch`
1551
1551
  - [subagent.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/subagent.ts)
1552
+ - [wait.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/wait.ts)
1553
+ - [watch-github-ci.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/watch-github-ci.ts) - `watch_github_ci`
1552
1554
  - [skill.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/skill.ts) - factory-only
1553
1555
  - [tasks.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/tasks.ts) - factory-only
1554
1556