@x-otto/tools 0.0.1-alpha.0 → 0.0.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -31
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
# @x-otto/tools
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Module Purpose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Provides registration, grouping, and discovery of tools available to the agent. A single source-of-truth TOOL_NODES table of 13 nodes, activated on demand via three cumulative presets.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Core Features
|
|
8
8
|
|
|
9
|
-
|
|
|
9
|
+
| Preset | Nodes |
|
|
10
10
|
| -------- | ------------------------------------------------------------------------------------- |
|
|
11
|
-
| minimal | `read` / `bash
|
|
12
|
-
| standard | + `write` / `edit` / `find` / `grep` / `ls` / `web_search` / `web_fetch` / `tool_search` / `task_delegate
|
|
13
|
-
| full | + `fork_call` / `agent_call` / `team_run` / `grill_me` / `session_manager` / `skill` / `memory_record` / `memory_read` / `capture_file_state` / `learn` / `task_inspect` / `task_control` / `write_todos
|
|
11
|
+
| minimal | `read` / `bash` (2 nodes) |
|
|
12
|
+
| standard | + `write` / `edit` / `find` / `grep` / `ls` / `web_search` / `web_fetch` / `tool_search` / `task_delegate` (7 nodes) |
|
|
13
|
+
| full | + `fork_call` / `agent_call` / `team_run` / `grill_me` / `session_manager` / `skill` / `memory_record` / `memory_read` / `capture_file_state` / `learn` / `task_inspect` / `task_control` / `write_todos` (16 nodes, full orchestration + session + skill + memory + team) |
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Installation
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
pnpm add @x-otto/tools
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Quick Start
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
24
|
import { createToolRegistry } from '@x-otto/tools'
|
|
@@ -29,37 +29,37 @@ const registry = createToolRegistry({ preset: 'standard' })
|
|
|
29
29
|
const tools = registry.getTools() // AgentTool[]
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Tool Exposure
|
|
33
33
|
|
|
34
|
-
|
|
|
34
|
+
| State | Meaning |
|
|
35
35
|
| -------- | --------------------------------------------- |
|
|
36
|
-
| `direct` |
|
|
37
|
-
| `deferred` |
|
|
38
|
-
| `hidden` |
|
|
36
|
+
| `direct` | Enters the model's tool table directly (default) |
|
|
37
|
+
| `deferred` | Exposed on demand via `tool_search` (default for MCP tools) |
|
|
38
|
+
| `hidden` | Dispatchable only, never enters the table |
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
The tool table is sorted stably by name to keep the prompt-cache prefix stable.
|
|
41
41
|
|
|
42
|
-
##
|
|
42
|
+
## Directory Overview
|
|
43
43
|
|
|
44
44
|
```
|
|
45
45
|
src/
|
|
46
|
-
types.ts #
|
|
47
|
-
tool-registry.ts #
|
|
48
|
-
binary-executor-registry.ts #
|
|
46
|
+
types.ts # core types
|
|
47
|
+
tool-registry.ts # tool registry (TOOL_NODES + 3-tier presets + exposure projection)
|
|
48
|
+
binary-executor-registry.ts # binary tool management
|
|
49
49
|
builtin-tools/
|
|
50
|
-
fs/ #
|
|
51
|
-
search/ #
|
|
52
|
-
shell/ #
|
|
53
|
-
web/ #
|
|
54
|
-
orchestration/ #
|
|
55
|
-
session/ #
|
|
56
|
-
skill/ #
|
|
57
|
-
memory/ #
|
|
50
|
+
fs/ # filesystem tools
|
|
51
|
+
search/ # search tools
|
|
52
|
+
shell/ # shell tools
|
|
53
|
+
web/ # web tools
|
|
54
|
+
orchestration/ # orchestration tools
|
|
55
|
+
session/ # session tools
|
|
56
|
+
skill/ # skill tools
|
|
57
|
+
memory/ # memory tools
|
|
58
58
|
index.ts
|
|
59
|
-
tests/ # 41
|
|
59
|
+
tests/ # 41 test files
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
##
|
|
62
|
+
## Development Commands
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
65
|
pnpm --filter @x-otto/tools build
|
|
@@ -67,6 +67,6 @@ pnpm --filter @x-otto/tools typecheck
|
|
|
67
67
|
pnpm --filter @x-otto/tools clean
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
##
|
|
70
|
+
## Related Packages
|
|
71
71
|
|
|
72
|
-
`@x-otto/agent
|
|
72
|
+
`@x-otto/agent`, `@x-otto/shared`, `@x-otto/env`, `@x-otto/mcp`, `@x-otto/orchestration-contracts`
|
package/dist/index.d.ts
CHANGED
|
@@ -98,12 +98,18 @@ declare const CronCreateArgs: z.ZodObject<{
|
|
|
98
98
|
recurring: z.ZodBoolean;
|
|
99
99
|
name: z.ZodOptional<z.ZodString>;
|
|
100
100
|
maxDurationMs: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
102
|
+
job: "job";
|
|
103
|
+
session: "session";
|
|
104
|
+
}>>;
|
|
101
105
|
}, z.core.$strip>;
|
|
102
106
|
type CronCreateArgs = z.infer<typeof CronCreateArgs>;
|
|
103
107
|
interface CronCreateResult {
|
|
104
108
|
taskId: string;
|
|
105
109
|
nextFireAt: number;
|
|
106
110
|
name: string;
|
|
111
|
+
/** RFC-357 D3: echoed back so the tool result can confirm which target was actually used. */
|
|
112
|
+
target?: 'job' | 'session';
|
|
107
113
|
}
|
|
108
114
|
type ScheduleCreateCallback = (input: CronCreateArgs) => CronCreateResult;
|
|
109
115
|
//#endregion
|
|
@@ -774,10 +780,10 @@ declare const WriteTodosArgsSchema: z.ZodObject<{
|
|
|
774
780
|
title: z.ZodString;
|
|
775
781
|
status: z.ZodEnum<{
|
|
776
782
|
pending: "pending";
|
|
777
|
-
failed: "failed";
|
|
778
783
|
in_progress: "in_progress";
|
|
779
784
|
done: "done";
|
|
780
785
|
skipped: "skipped";
|
|
786
|
+
failed: "failed";
|
|
781
787
|
}>;
|
|
782
788
|
}, z.core.$strip>>;
|
|
783
789
|
}, z.core.$strip>;
|
|
@@ -816,11 +822,11 @@ declare const TaskInspectArgsSchema: z.ZodObject<{
|
|
|
816
822
|
}>;
|
|
817
823
|
taskId: z.ZodOptional<z.ZodString>;
|
|
818
824
|
statusFilter: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
819
|
-
all: "all";
|
|
820
825
|
pending: "pending";
|
|
826
|
+
failed: "failed";
|
|
827
|
+
all: "all";
|
|
821
828
|
running: "running";
|
|
822
829
|
completed: "completed";
|
|
823
|
-
failed: "failed";
|
|
824
830
|
cancelled: "cancelled";
|
|
825
831
|
}>>>;
|
|
826
832
|
}, z.core.$strip>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/hitl/grill-me.ts","../src/binary/binary-executor.ts","../src/binary/binary-executor-registry.ts","../src/orchestration/delegate-job.ts","../src/memory/memory-archive.ts","../src/scheduling/create.ts","../src/scheduling/list.ts","../src/scheduling/delete.ts","../src/scheduling/run.ts","../src/scheduling/cancel.ts","../src/orchestration/capability-gap.ts","../src/shell/execution-backend.ts","../src/shell/process.ts","../src/shell/sandbox/types.ts","../src/shell/background-types.ts","../src/orchestration/capture-file-state.ts","../src/orchestration/learn.ts","../src/orchestration/list-models.ts","../src/session/session-manager.ts","../src/skill/skill.ts","../src/memory/memory-record.ts","../src/memory/memory-read.ts","../src/orchestration/delegation-runners.ts","../src/register-builtin.ts","../src/types.ts","../src/tool-registry.ts","../src/tool-nodes.ts","../src/fs/read.ts","../src/fs/write.ts","../src/fs/edit.ts","../src/orchestration/write-todos.ts","../src/orchestration/agent-call-description.ts","../src/orchestration/task-inspect.ts","../src/orchestration/task-control.ts","../src/orchestration/tool-search.ts","../src/orchestration/constants.ts","../src/web/fetch.ts","../src/web/search.ts","../src/lsp/types.ts","../src/lsp/lsp-server-manager.ts","../src/lsp/lsp-client.ts","../src/lsp/lsp-wrapper.ts","../src/lsp/definition.ts","../src/lsp/references.ts","../src/lsp/symbols.ts","../src/lsp/diagnostics.ts","../src/lsp/rename.ts","../src/shell/sandbox/noop.ts","../src/shell/sandbox/macos-seatbelt.ts","../src/shell/sandbox/bubblewrap.ts","../src/shell/sandbox/platform.ts"],"mappings":";;;;;;;;KAIY,YAAA,IACV,SAAA,UACA,QAAA,EAAU,IAAA,CAAK,aAAA,YACZ,OAAA,CAAQ,WAAA;AAAA,cASP,iBAAA,EAAiB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;KAWlB,WAAA,GAAc,CAAA,CAAE,KAAA,QAAa,iBAAA;AAAA,iBAElB,aAAA,CAAc,YAAA,UAAsB,KAAA,GAAQ,YAAA,GAAe,SAAA,CAAU,WAAA;;;UCIpE,0BAAA,SAAmC,wBAAA;;;;;EAKlD,SAAA;AAAA;AAAA,UAGe,yBAAA;EACf,MAAA;EACA,MAAA;EACA,QAAA;EDrCW;ECuCX,SAAA;AAAA;AAAA,UAGe,UAAA;EACf,IAAA;EACA,OAAA;EACA,OAAA,CAAQ,IAAA,YAAgB,OAAA,GAAU,0BAAA,GAA6B,OAAA,CAAQ,yBAAA;AAAA;;;cC5C5D,0BAAA;EAAA,QACH,QAAA;EAER,GAAA,CAAI,IAAA;EAIJ,GAAA,CAAI,IAAA,WAAe,UAAA;EAInB,QAAA,CAAS,IAAA,EAAM,UAAA;EAQf,UAAA,CAAW,IAAA;EAQL,SAAA,CAAA,GAAa,OAAA;EAQb,MAAA,CAAO,IAAA,WAAe,OAAA,CAAQ,UAAA;EAapC,OAAA,CAAA;AAAA;AAAA,cAKW,gCAAA,GACX,WAAA,UACA,cAAA,GAAiB,cAAA,KAChB,0BAAA;;;;KC5BS,QAAA,IAAY,KAAA;EAAS,MAAA;EAAgB,KAAA;EA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,OAAA;cAEL,OAAA,GAAS,iBAAA;EAQrB,IAAA,CAAK,KAAA,EAAO,gBAAA,GAAmB,iBAAA;EAuEzB,OAAA,CAAA,GAAW,OAAA;AAAA;AAAA,iBASH,uBAAA,CAAwB,OAAA,GAAU,iBAAA,GAAoB,iBAAA;;;;;;UC7HrD,sBAAA;;EAEf,OAAA;;AlDbF;;;EkDkBE,aAAA;ElDhBU;;;;EkDqBV,aAAA;ElDtBA;;;;EkD2BA,KAAA;AAAA;;;AlDzBuB;;;iBkDiCT,uBAAA,CAAA;;;;;;;;;iBAmBA,qBAAA,CAAsB,OAAA,GAAS,sBAAA,GAA8B,eAAA;;;;;;;;;;;iBA8C7D,0BAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/hitl/grill-me.ts","../src/binary/binary-executor.ts","../src/binary/binary-executor-registry.ts","../src/orchestration/delegate-job.ts","../src/memory/memory-archive.ts","../src/scheduling/create.ts","../src/scheduling/list.ts","../src/scheduling/delete.ts","../src/scheduling/run.ts","../src/scheduling/cancel.ts","../src/orchestration/capability-gap.ts","../src/shell/execution-backend.ts","../src/shell/process.ts","../src/shell/sandbox/types.ts","../src/shell/background-types.ts","../src/orchestration/capture-file-state.ts","../src/orchestration/learn.ts","../src/orchestration/list-models.ts","../src/session/session-manager.ts","../src/skill/skill.ts","../src/memory/memory-record.ts","../src/memory/memory-read.ts","../src/orchestration/delegation-runners.ts","../src/register-builtin.ts","../src/types.ts","../src/tool-registry.ts","../src/tool-nodes.ts","../src/fs/read.ts","../src/fs/write.ts","../src/fs/edit.ts","../src/orchestration/write-todos.ts","../src/orchestration/agent-call-description.ts","../src/orchestration/task-inspect.ts","../src/orchestration/task-control.ts","../src/orchestration/tool-search.ts","../src/orchestration/constants.ts","../src/web/fetch.ts","../src/web/search.ts","../src/lsp/types.ts","../src/lsp/lsp-server-manager.ts","../src/lsp/lsp-client.ts","../src/lsp/lsp-wrapper.ts","../src/lsp/definition.ts","../src/lsp/references.ts","../src/lsp/symbols.ts","../src/lsp/diagnostics.ts","../src/lsp/rename.ts","../src/shell/sandbox/noop.ts","../src/shell/sandbox/macos-seatbelt.ts","../src/shell/sandbox/bubblewrap.ts","../src/shell/sandbox/platform.ts"],"mappings":";;;;;;;;KAIY,YAAA,IACV,SAAA,UACA,QAAA,EAAU,IAAA,CAAK,aAAA,YACZ,OAAA,CAAQ,WAAA;AAAA,cASP,iBAAA,EAAiB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;KAWlB,WAAA,GAAc,CAAA,CAAE,KAAA,QAAa,iBAAA;AAAA,iBAElB,aAAA,CAAc,YAAA,UAAsB,KAAA,GAAQ,YAAA,GAAe,SAAA,CAAU,WAAA;;;UCIpE,0BAAA,SAAmC,wBAAA;;;;;EAKlD,SAAA;AAAA;AAAA,UAGe,yBAAA;EACf,MAAA;EACA,MAAA;EACA,QAAA;EDrCW;ECuCX,SAAA;AAAA;AAAA,UAGe,UAAA;EACf,IAAA;EACA,OAAA;EACA,OAAA,CAAQ,IAAA,YAAgB,OAAA,GAAU,0BAAA,GAA6B,OAAA,CAAQ,yBAAA;AAAA;;;cC5C5D,0BAAA;EAAA,QACH,QAAA;EAER,GAAA,CAAI,IAAA;EAIJ,GAAA,CAAI,IAAA,WAAe,UAAA;EAInB,QAAA,CAAS,IAAA,EAAM,UAAA;EAQf,UAAA,CAAW,IAAA;EAQL,SAAA,CAAA,GAAa,OAAA;EAQb,MAAA,CAAO,IAAA,WAAe,OAAA,CAAQ,UAAA;EAapC,OAAA,CAAA;AAAA;AAAA,cAKW,gCAAA,GACX,WAAA,UACA,cAAA,GAAiB,cAAA,KAChB,0BAAA;;;;KC5BS,QAAA,IAAY,KAAA;EAAS,MAAA;EAAgB,KAAA;EAAe,SAAA;AAAA;EAA0B,KAAA;AAAA;;;;;;;;;AHhC1F;;;;;;UIaiB,gBAAA;EACf,IAAA;EACA,SAAA;EACA,YAAA;EACA,OAAA;AAAA;AAAA,KAGU,WAAA,IAAe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;AAAA;AAAA,iBASH,uBAAA,CAAwB,OAAA,GAAU,iBAAA,GAAoB,iBAAA;;;;;;UC7HrD,sBAAA;;EAEf,OAAA;;AlDbF;;;EkDkBE,aAAA;ElDhBU;;;;EkDqBV,aAAA;ElDtBA;;;;EkD2BA,KAAA;AAAA;;;AlDzBuB;;;iBkDiCT,uBAAA,CAAA;;;;;;;;;iBAmBA,qBAAA,CAAsB,OAAA,GAAS,sBAAA,GAA8B,eAAA;;;;;;;;;;;iBA8C7D,0BAAA,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{z as e}from"zod";import{API_IMAGE_DIMENSION_LIMIT_PX as t,PROVIDER_IMAGE_INLINE_MAX_BYTES as n,buildAllowedEnv as r,createLogger as i,createProjectOverflowLogPath as a,createTempLoggerPath as o,exists as s,formatBytes as c,getHomeDir as l,getThirdPartyToolBinaryDir as u,getThirdPartyToolDir as d,invariant as f,isDirectory as p,isFile as m,mime as h,mkdirp as g,normalizePath as _,parseJsonc as v,probeImageDimensions as y,sweepStaleProjectOverflowLogs as ee,sweepStaleTempLogs as te,toTruncationMeta as b,truncateHead as x,truncateLine as ne,truncateTail as S}from"@x-otto/shared";import C from"os";import w,{homedir as re,tmpdir as ie}from"node:os";import{appendFileSync as ae,chmodSync as oe,closeSync as se,copyFileSync as ce,createReadStream as le,createWriteStream as ue,existsSync as T,mkdirSync as E,openSync as de,readFileSync as fe,readdirSync as pe,realpathSync as me,renameSync as he,rmSync as D,statSync as O,writeFileSync as ge}from"node:fs";import{glob as _e,readFile as k,rename as ve,stat as ye,unlink as be,writeFile as A}from"node:fs/promises";import{createHash as xe,randomUUID as Se}from"node:crypto";import{dirname as j,extname as Ce,join as M,relative as N,resolve as P}from"node:path";import{Readable as we}from"node:stream";import{pipeline as Te}from"node:stream/promises";import{setTimeout as Ee}from"node:timers/promises";import{spawn as F}from"node:child_process";import{OTTO_PROJECT_DIR as De,OTTO_USER_AGENT as Oe,SETTING_OFFLINE_MODE_ENABLED as ke,normalizeEnv as I}from"@x-otto/env";import{createInterface as Ae}from"node:readline";import{Worker as je}from"node:worker_threads";import{diffLines as Me}from"diff";import{WORKFLOW_SLOTS as Ne}from"@x-otto/ai";import{checkDelegationDepth as Pe,createTodoStore as Fe}from"@x-otto/orchestration-contracts";import{fileURLToPath as Ie,pathToFileURL as L}from"node:url";const Le=e.object({label:e.string(),rationale:e.string().describe(`选这项的含义/利弊(plain language)`),recommended:e.boolean().optional(),preview:e.string().optional().describe(`两段具体产物并排对比`)}),Re=e.object({header:e.string().max(24).describe(`短主题标签(≤24 字),便于 UI/日志`),question:e.string().describe(`一个清晰具体的关键问题`),background:e.string().describe(`详细背景与前因后果(grill 纪律:必填)`),recommendation:e.string().describe(`推荐答案 + 理由(必填);无真人应答时被自动采纳`),options:e.array(Le).optional(),allowFreeform:e.boolean().optional().default(!0),multiSelect:e.boolean().optional().default(!1),evidence:e.array(e.string()).optional().describe(`引用的本地证据/社区方案`)});function ze(e,t){return{name:`grill_me`,description:`Ask the human ONE key decision with detailed background and a required recommendation. Advisory only — never authorizes side effects (those still pass permission/approval). Use when a single fork genuinely needs a human steer; otherwise decide yourself.`,parameters:Re,readonly:!1,async execute({params:e,agentName:n,sessionId:r}){if(!t||!r)return{content:[{type:`text`,text:`grill_me is not available in this context. If you need clarification, return your open question in your result so the lead/main agent can ask the human.`}],isError:!0,errorKind:`runtime`};let i=await t(r,{header:e.header,question:e.question,background:e.background,recommendation:e.recommendation,options:e.options,allowFreeform:e.allowFreeform,multiSelect:e.multiSelect,evidence:e.evidence,askedBy:n??`agent`});return{content:[{type:`text`,text:`${i.resolvedBy===`auto_recommendation`?`(无真人应答,已采纳推荐)`:``}${i.answer}`}],details:{resolvedBy:i.resolvedBy,acceptedRecommendation:i.acceptedRecommendation,selectedOptionLabels:i.selectedOptionLabels,freeformText:i.freeformText}}}}}const R=I(process.env.TOOLS_MAX_OUTPUT_LINES,2e3),z=I(process.env.TOOLS_MAX_OUTPUT_BYTES,60*1024),B=I(process.env.TOOLS_EXECUTE_TIMEOUT_MS,3e4),Be=I(process.env.TOOLS_BINARY_DOWNLOAD_TIMEOUT_MS,12e5),Ve=I(process.env.TOOLS_MAX_WRITE_BYTES,10*1024*1024),V=I(process.env.TOOLS_MAX_FETCH_BYTES,5*1024*1024),He=I(process.env.TOOLS_BINARY_PROBE_TIMEOUT_MS,5e3);function H(e,t){return Object.assign(Error(e),{errorKind:t})}const Ue=i(`@x-otto/tools:binary`),We=256*1024;async function Ge(e,t=[`--version`]){try{return(await Ke(e,t,{timeout:He})).status===0}catch{return!1}}function Ke(e,t,n){return new Promise((r,i)=>{let a=F(e,t,{stdio:[`ignore`,`ignore`,`pipe`]}),o=``;a.stderr?.on(`data`,e=>{o+=e.toString()}),n?.timeout&&setTimeout(()=>{a.kill(),i(Error(`timeout`))},n.timeout),a.on(`close`,e=>r({status:e,stderr:o})),a.on(`error`,i)})}async function qe(e,t=e){let n=w.platform()===`win32`?`.exe`:``,r=u(t,e)+n;try{if(T(r))return r}catch{Ue.debug(`Error checking existence of ${r}, will try PATH lookup: %s`,r)}return await Ge(e)?e:null}async function Je(e,t,n){if(!t){Ue.warn(`No checksum configured for %s — integrity not verified`,n);return}let r=xe(`sha256`);r.update(await k(e));let i=r.digest(`hex`);if(i.toLowerCase()!==t.toLowerCase())throw H(`Checksum mismatch for ${n}: expected ${t}, got ${i}`,`validation`)}async function Ye(e,t,n){let r=async(t,n)=>{try{let{status:e,stderr:r}=await Ke(t,n);if(e!==0)throw Error(r?.trim()||`exit code ${e}`)}catch(t){throw H(`Failed to extract ${e}: ${t instanceof Error?t.message:String(t)}`,`io`)}};if(e.endsWith(`.tar.gz`)||e.endsWith(`.tgz`)){await r(`tar`,[`xzf`,t,`-C`,n]);return}if(e.endsWith(`.zip`)){w.platform()===`win32`?await r(`powershell`,[`-NoProfile`,`-Command`,`Expand-Archive -LiteralPath '${t}' -DestinationPath '${n}' -Force`]):await r(`unzip`,[`-o`,`-q`,t,`-d`,n]);return}throw H(`Unsupported archive format: ${e}`,`validation`)}async function Xe(e,t){let n=Date.now()+Be;for(;;){try{return se(de(e,`wx`)),!0}catch(e){if(e.code!==`EEXIST`)throw e}try{if(Date.now()-O(e).mtimeMs>3e5){let t=`${e}.stale-${Se()}`;try{he(e,t),D(t,{force:!0})}catch{}continue}}catch{continue}if(T(t)||Date.now()>n)return!1;await Ee(200)}}async function Ze(e){let{name:t,cacheDir:n,url:r,checksum:i}=e,a=w.platform(),o=d(),s=t+(a===`win32`?`.exe`:``),c=P(o,n),l=P(c,s),u=P(o,`${n}.lock`),f=Se(),p=P(o,`${n}-${f}.download`),m=P(o,`${n}-extract-${f}`);if(E(o,{recursive:!0}),await Xe(u,l))try{if(T(l))return;let e=await fetch(r,{headers:{"User-Agent":Oe},signal:AbortSignal.timeout(Be)});if(!e.ok||!e.body)throw H(`Failed to download: ${e.status}`,`network`);let t=ue(p);await Te(we.fromWeb(e.body),t),await Je(p,i,r),E(c,{recursive:!0}),E(m,{recursive:!0}),await Ye(r,p,m);let n=Qe(m,s);if(!n)throw H(`Binary ${s} not found in archive`,`not_found`);ce(n,l),a!==`win32`&&oe(l,493)}catch(e){return Ue.warn(e),e instanceof Error?e:Error(String(e))}finally{D(p,{force:!0}),D(m,{recursive:!0,force:!0}),D(u,{force:!0})}}function Qe(e,t){let n=[e];for(;n.length>0;){let e=n.pop(),r;try{r=pe(e,{encoding:`utf-8`})}catch{continue}for(let i of r){let r=M(e,i);try{let e=O(r);if(e.isDirectory())n.push(r);else if(e.isFile()&&i===t)return r}catch{continue}}}}var U=class{get cacheDir(){return`${this.name}-${this.version}`}projectRoot;downloadTask=null;lastDownloadError;processTracker;constructor(e,t){this.projectRoot=e,this.processTracker=t}resolveChecksum(){}async ensure(){let e=await qe(this.name,this.cacheDir);if(e)return e;if(ke)throw H(`${this.name} not found and offline mode is enabled`,`not_found`);this.downloadTask||=this.download().finally(()=>{this.downloadTask=null}),await this.downloadTask;let t=await qe(this.name,this.cacheDir);if(!t){let e=this.lastDownloadError,t=H(`${this.name}: download failed${e?` — ${e.message}`:` (binary not found)`}`,`not_found`);throw e&&(t.cause=e),t}return t}async download(){let e=this.resolveUrl();f(e,`No download URL for ${this.name}`),this.lastDownloadError=await Ze({name:this.name,cacheDir:this.cacheDir,url:e,checksum:this.resolveChecksum()})}async execute(e,t){let n=await this.ensure(),r=t?.maxBuffer;return new Promise((i,a)=>{let o=F(n,e,{cwd:t?.cwd,env:t?.env,timeout:t?.timeout,signal:t?.signal});this.processTracker?.registerChild({command:n,args:e,owner:{type:`agent-tool`,id:`binary`},category:`tool`,lifecycle:`evictable`,cwd:typeof t?.cwd==`string`?t.cwd:void 0},o);let s=[],c=[],l=0,u=0,d=!1,f,p=()=>{try{o.kill(`SIGTERM`)}catch{}f=setTimeout(()=>{try{o.kill(`SIGKILL`)}catch{}},2e3),f.unref?.()};o.stdout.on(`data`,e=>{if(!d){if(r!==void 0&&l+e.byteLength>r){let t=r-l;t>0&&(s.push(e.subarray(0,t)),l=r),d=!0,p();return}s.push(e),l+=e.byteLength}}),o.stderr.on(`data`,e=>{if(u>=We)return;let t=We-u;e.byteLength>t?(c.push(e.subarray(0,t)),u=We):(c.push(e),u+=e.byteLength)}),o.on(`error`,e=>{f&&clearTimeout(f),a(e)}),o.on(`close`,e=>{if(f&&clearTimeout(f),!d&&e!==0)return a(Error(`Process exited with code ${e}: ${Buffer.concat(c).toString()}`));i({stdout:Buffer.concat(s).toString(),stderr:Buffer.concat(c).toString(),exitCode:d?0:e,truncated:d})})})}};function $e(e,t,n){return`https://github.com/${e}/releases/download/v${t}/${n}`}const et={"fd-v10.4.2-aarch64-apple-darwin.tar.gz":`623dc0afc81b92e4d4606b380d7bc91916ba7b97814263e554d50923a39e480a`,"fd-v10.4.2-aarch64-unknown-linux-gnu.tar.gz":`6c51f7c5446b3338b1e401ff15dc194c590bb2fa64fd43ff3278300f073adec5`,"fd-v10.4.2-x86_64-unknown-linux-gnu.tar.gz":`def59805cd14b5651b68990855f426ad087f3b96881296d963910431ba3143c8`,"fd-v10.4.2-aarch64-pc-windows-msvc.zip":`4f9110c2d5b33a7f760bfa5510f4c113d828109f7277d421b1053a9943c0fc92`,"fd-v10.4.2-x86_64-pc-windows-msvc.zip":`b2816e506390a89941c63c9187d58a3cc10e9a55f2ef0685f9ea0eccaf7c98c8`};var tt=class extends U{name=`fd`;version=`10.4.2`;repository=`sharkdp/fd`;constructor(e,t){super(e,t)}resolveAsset(){let e=C.platform(),t=C.arch();switch(e){case`darwin`:return t===`arm64`?`fd-v${this.version}-aarch64-apple-darwin.tar.gz`:`fd-v${this.version}-x86_64-apple-darwin.tar.gz`;case`linux`:return t===`arm64`?`fd-v${this.version}-aarch64-unknown-linux-gnu.tar.gz`:`fd-v${this.version}-x86_64-unknown-linux-gnu.tar.gz`;case`win32`:return t===`arm64`?`fd-v${this.version}-aarch64-pc-windows-msvc.zip`:`fd-v${this.version}-x86_64-pc-windows-msvc.zip`}throw Error(`Unsupported platform/architecture: ${e}/${t}`)}resolveUrl(){return $e(this.repository,this.version,this.resolveAsset())}resolveChecksum(){return et[this.resolveAsset()]}};const nt=(e,t)=>new tt(e,t);function rt(e,t,n){return`https://github.com/${e}/releases/download/${t}/${n}`}const it={"ripgrep-15.1.0-aarch64-apple-darwin.tar.gz":`378e973289176ca0c6054054ee7f631a065874a352bf43f0fa60ef079b6ba715`,"ripgrep-15.1.0-x86_64-apple-darwin.tar.gz":`64811cb24e77cac3057d6c40b63ac9becf9082eedd54ca411b475b755d334882`,"ripgrep-15.1.0-aarch64-unknown-linux-gnu.tar.gz":`2b661c6ef508e902f388e9098d9c4c5aca72c87b55922d94abdba830b4dc885e`,"ripgrep-15.1.0-x86_64-unknown-linux-musl.tar.gz":`1c9297be4a084eea7ecaedf93eb03d058d6faae29bbc57ecdaf5063921491599`,"ripgrep-15.1.0-aarch64-pc-windows-msvc.zip":`00d931fb5237c9696ca49308818edb76d8eb6fc132761cb2a1bd616b2df02f8e`,"ripgrep-15.1.0-x86_64-pc-windows-msvc.zip":`124510b94b6baa3380d051fdf4650eaa80a302c876d611e9dba0b2e18d87493a`};var at=class extends U{name=`rg`;repository=`BurntSushi/ripgrep`;version=`15.1.0`;constructor(e,t){super(e,t)}resolveAsset(){let e=C.platform(),t=C.arch();switch(e){case`darwin`:return t===`arm64`?`ripgrep-${this.version}-aarch64-apple-darwin.tar.gz`:`ripgrep-${this.version}-x86_64-apple-darwin.tar.gz`;case`linux`:return t===`arm64`?`ripgrep-${this.version}-aarch64-unknown-linux-gnu.tar.gz`:`ripgrep-${this.version}-x86_64-unknown-linux-musl.tar.gz`;case`win32`:return t===`arm64`?`ripgrep-${this.version}-aarch64-pc-windows-msvc.zip`:`ripgrep-${this.version}-x86_64-pc-windows-msvc.zip`}throw Error(`Unsupported platform/architecture: ${e}/${t}`)}resolveUrl(){return rt(this.repository,this.version,this.resolveAsset())}resolveChecksum(){return it[this.resolveAsset()]}};const ot=(e,t)=>new at(e,t),st=i(`@x-otto/tools:binary-executor-registry`);var ct=class{binaries=new Map;has(e){return this.binaries.has(e)}get(e){return this.binaries.get(e)}register(e){this.binaries.has(e.name)?st.warn(`Tool ${e.name} is already registered, skipping`):this.binaries.set(e.name,e)}unregister(e){this.binaries.has(e)?this.binaries.delete(e):st.warn(`Tool ${e} is not registered, skipping`)}async ensureAll(){for(let e of this.binaries.values())e instanceof U&&await e.ensure()}async ensure(e){let t=this.binaries.get(e);if(!t)throw Error(`Tool ${e} not found in registry`);return t instanceof U&&await t.ensure(),t}dispose(){this.binaries.clear()}};const lt=(e,t)=>{let n=new ct;return n.register(nt(e,t)),n.register(ot(e,t)),n};function ut(e){return typeof e==`function`?e():e}const dt=()=>({chunks:Buffer.alloc(0),stdout:Buffer.alloc(0),stderr:Buffer.alloc(0),exitCode:-1,timedOut:!1}),ft=(e,t)=>{try{process.kill(-e,t)}catch{try{process.kill(e,t)}catch{}}},pt=new class{name=`local`;execute(e,t,n,i){let{cwd:a,env:o,timeout:s,signal:c}=n;return new Promise((n,l)=>{if(c?.aborted){l(Error(`Process execution aborted before start`));return}let u=dt(),d=[],f=[],p=[],m,h=()=>{let e=y.pid;if(e!==void 0){if(process.platform===`win32`){F(`taskkill`,[`/F`,`/T`,`/PID`,`${e}`],{stdio:`ignore`,detached:!0});return}ft(e,`SIGTERM`),m=setTimeout(()=>ft(e,`SIGKILL`),2e3)}},g=setTimeout(()=>{u.timedOut=!0,h()},s),_=()=>h();c?.addEventListener(`abort`,_,{once:!0});let v=()=>{clearTimeout(g),m&&clearTimeout(m),c?.removeEventListener(`abort`,_)},y=F(e,t,{cwd:a,env:r(o),stdio:[`ignore`,`pipe`,`pipe`],detached:process.platform!==`win32`});y.stdout?.on(`data`,e=>{d.push(e),p.push(e),i?.(e,`stdout`)}),y.stderr?.on(`data`,e=>{f.push(e),p.push(e),i?.(e,`stderr`)}),y.on(`error`,e=>{v(),l(e)}),y.on(`close`,e=>{u.exitCode=e??-1,u.stdout=Buffer.concat(d),u.stderr=Buffer.concat(f),u.chunks=Buffer.concat(p),v(),u.timedOut?l(Error(`Process timed out after ${s}ms`)):n(u)})})}};function mt(e,t,n){let i=e,a=t,o=n.cwd,s=n.env;if(n.sandbox){let e=n.projectRoot??o,t=n.sandbox.wrap({command:i,args:a,options:{timeout:0,cwd:o,env:s,projectRoot:e},projectRoot:e});i=t.command,a=t.args,o=t.options.cwd??o,s=t.options.env}let c=n.onOutputChunk!==void 0,l,u;if(c){u=de(n.logPath,`a`),l=F(i,a,{cwd:o,env:r(s),stdio:[`ignore`,`pipe`,`pipe`],detached:process.platform!==`win32`});let e=(e,t)=>{if(u!==void 0)try{ae(u,e)}catch{}n.onOutputChunk?.(e,t)};l.stdout?.on(`data`,t=>e(t,`stdout`)),l.stderr?.on(`data`,t=>e(t,`stderr`)),l.once(`exit`,()=>{if(u!==void 0){try{se(u)}catch{}u=void 0}}),l.stdout?.unref?.(),l.stderr?.unref?.()}else{let e=de(n.logPath,`a`);try{l=F(i,a,{cwd:o,env:r(s),stdio:[`ignore`,e,e],detached:process.platform!==`win32`})}finally{se(e)}}l.once(`error`,e=>{try{ae(n.logPath,`\n[otto] background spawn error: ${e.message}\n`)}catch{}}),l.unref();let d=l.pid;if(d===void 0)throw Error(`Failed to spawn background process (no pid)`);return{child:l,pid:d}}function ht(e,t,n){let r=n.sandbox;if(r){let i=n.projectRoot??n.cwd??process.cwd(),a=r.wrap({command:e,args:t,options:n,projectRoot:i});e=a.command,t=a.args,n=a.options}let{cwd:i,env:a,timeout:o,signal:s,onProgress:c}=n;return(ut(n.backend)??pt).execute(e,t,{cwd:i,env:a,timeout:o,signal:s},c)}const gt=/\b(https?|wss?):\/\/([-\w.]+)(?::(\d{2,5}))?(\/[^\s)\],."']*)?/i,_t=/\b(?:listening on\s+(?:port\s+)?|(?:running\s+)?at\s+:|on\s+:|port[:\s]+)(\d{2,5})\b/i;function vt(e){return/^wss?$/i.test(e)?`ws`:`http`}function yt(e){let t=e.match(gt);if(t){let[e,n,,r]=t,i=r?Number(r):void 0;return{url:e,port:i!==void 0&&i>0&&i<=65535?i:void 0,protocol:vt(n)}}let n=e.match(_t);if(n){let e=Number(n[1]);if(e>0&&e<=65535)return{port:e,protocol:`tcp`}}return null}const bt=e.object({command:e.string().describe(`Shell command to execute`),targetDir:e.string().optional().describe(`Working directory (relative to project root)`),timeout:e.number().int().min(1e3).optional().describe(`Timeout (ms), default 30000`),run_in_background:e.boolean().optional().describe(`Run as a long-lived background process (dev servers, watchers). Returns immediately with a background id; read output with bash_output and stop with kill_shell. Auto-killed when the session ends.`)}),xt=i(`@x-otto/tools:bash`);function St(e,t,n,r,i){return{name:`bash`,description:`Execute a shell command and return stdout/stderr. Default timeout is 30 seconds.`,parameters:bt,async execute({params:a,signal:o,id:s,sessionId:c}){let l=P(e,a.targetDir??`.`),u=a.timeout??B,d=typeof n==`function`?n({command:a.command}):n,f=ut(i);return a.run_in_background?!r||!c?{content:[{type:`text`,text:`Background execution is unavailable in this context (no process registry / session). Re-run without run_in_background, or run a short-lived foreground command.`}],isError:!0,errorKind:`runtime`}:Tt(a.command,l,e,d,r,c,s):await Dt(a.command,l,e,u,t,o,d,f)}}}function Ct(e){let t=e.match(/(?:--port[ =]|-p\s+|localhost:|0\.0\.0\.0:|127\.0\.0\.1:|http\.server\s+)(\d{2,5})\b/i);if(t){let e=Number(t[1]);if(e>0&&e<=65535)return e}}function wt(e){let t=``;return n=>{t+=n.toString(`utf-8`);let r;for(;(r=t.indexOf(`
|
|
2
2
|
`))!==-1;){let n=t.slice(0,r);t=t.slice(r+1);let i=yt(n);i&&e(i)}}}function Tt(e,t,n,r,i,a,s){let c=`bg_${a}_${s}`,l=o();te(Et,Date.now());try{let o=wt(e=>{i.updateDetectedService(c,e)}),{child:s,pid:u}=mt(`sh`,[`-c`,e],{cwd:t,projectRoot:n,sandbox:r,logPath:l,onOutputChunk:e=>o(e)}),d=Ct(e);try{i.register({id:c,sessionId:a,child:s,command:e,cwd:t,logPath:l,port:d})}catch(e){try{process.kill(-u,`SIGKILL`)}catch{try{s.kill(`SIGKILL`)}catch{}}throw e}return{content:[{type:`text`,text:`Started in background.\nid: ${c}\npid: ${u}\nlog: ${l}${d?`\nlikely port: ${d}`:``}\n\nRead output with bash_output(background_id="${c}"); stop it with kill_shell(background_id="${c}"). It is auto-killed when the session ends.`}],details:{backgroundProcessId:c,pid:u,logPath:l,port:d}}}catch(e){let t=e instanceof Error?e.message:String(e);return xt.warn({err:t},`Failed to start background process`),{content:[{type:`text`,text:`Failed to start background process: ${t}`}],isError:!0,errorKind:`runtime`}}}const Et=60*6e4;async function Dt(e,t,n,r,i,s,l,u){let d=z*2,f=[],p=0,m=0,h=0,g=0,_,v,y=()=>{if(!i)return;let e=S(Buffer.concat(f).toString(`utf-8`),{maxLines:R,maxBytes:z});i({content:[{type:`text`,text:e.content||``}],details:{truncation:b(e),outputPath:_}})},x=await ht(`sh`,[`-c`,e],{timeout:r,signal:s,cwd:t,sandbox:l,projectRoot:n,backend:u,onProgress:e=>{if(f.push(e),p+=e.byteLength,m+=e.byteLength,p>z&&!_){te(Et,Date.now()),ee(6048e5,Date.now());let e=a();try{E(j(e),{recursive:!0})}catch{e=o()}_=e,v=ue(e),v.on(`error`,e=>{xt.warn({err:e.message},`bash overflow log write failed; disabling overflow log`),v=void 0,_=void 0});for(let e of f)v.write(e)}else v&&v.write(e);for(;m>d&&f.length>1;){let e=f.shift();e&&(m-=e.byteLength)}h+=e.byteLength;let t=Date.now();h>=4096&&t-g>=100&&(h=0,g=t,y())}});v?.end();let ne=Buffer.concat(f).toString(`utf-8`),C=S(ne,{maxLines:R,maxBytes:z}),w=C.content||`(no output)`,re={truncation:b(C),outputPath:_};if(C.truncated){let e=C.totalLines-C.outputLines+1,t=C.totalLines,n=_?` Full output: ${_}`:``;if(C.lastLinePartial){let e=c(Buffer.byteLength(ne.split(`
|
|
3
|
-
`).pop()||``,`utf-8`));w+=`\n\n(Showing last ${c(C.outputBytes)} of line ${t} (line is ${e}).${n})`}else C.truncatedBy===`lines`?w+=`\n\n(Showing lines ${e}-${t} of ${C.totalLines}.${n})`:w+=`\n\n(Showing lines ${e}-${t} of ${C.totalLines} (${c(z)} limit).${n})`}return x.exitCode===0?{content:[{type:`text`,text:w}],details:re}:(w+=`\n\nCommand exited with code ${x.exitCode}`,{content:[{type:`text`,text:w}],isError:!0,errorKind:`runtime`,details:re})}const Ot=e.object({background_id:e.string().describe(`Background process id returned by bash with run_in_background:true`),block:e.boolean().optional().describe(`Wait until the process exits before returning (default false)`),timeout_ms:e.number().int().min(0).max(6e5).optional().describe(`Max wait when block=true (ms), default from TOOLS_EXECUTE_TIMEOUT_MS (30000)`)}),kt=e=>new Promise(t=>setTimeout(t,e));async function At(e){if(!e.logPath)return`(no output captured)`;let t;try{t=await k(e.logPath,`utf-8`)}catch{return`(output log unavailable)`}return S(t,{maxLines:R,maxBytes:z}).content||`(no output yet)`}function jt(e){return{name:`bash_output`,description:`Read accumulated output and status of a background process started by bash run_in_background.`,parameters:Ot,readonly:!0,async execute({params:t,sessionId:n}){let r=t.background_id,i=n?e.getForSession(n,r):e.get(r);if(!i)return{content:[{type:`text`,text:`No background process with id "${r}".`}],isError:!0,errorKind:`not_found`};let a=Date.now()+(t.timeout_ms??B);for(;t.block&&i.status===`running`&&Date.now()<a;){await kt(200);let t=e.get(r);if(!t)return{content:[{type:`text`,text:`[status: untracked]\nBackground process "${r}" is no longer tracked (likely evicted at the process limit).`}],details:{status:`untracked`,logPath:i.logPath}};i=t}let o=await At(i);return{content:[{type:`text`,text:`${i.status===`running`?`[status: running]`:`[status: ${i.status}${i.exitCode===void 0?``:`, exit ${i.exitCode}`}]`}\n${o}`}],details:{status:i.status,exitCode:i.exitCode,logPath:i.logPath}}}}}const Mt=e.object({background_id:e.string().describe(`Background process id (returned by bash run_in_background) to stop`)});function Nt(e){return{name:`kill_shell`,description:`Stop a background process started by bash with run_in_background:true.`,parameters:Mt,async execute({params:t,sessionId:n}){let r=t.background_id,i=n?e.getForSession(n,r):e.get(r);return i?i.status!==`running`&&i.status!==`killing`?{content:[{type:`text`,text:`Background process "${r}" already ${i.status}.`}]}:(await e.kill(r),{content:[{type:`text`,text:`Stopped background process "${r}".`}]}):{content:[{type:`text`,text:`No background process with id "${r}".`}],isError:!0,errorKind:`not_found`}}}}const Pt=i(`@x-otto/tools:find`),Ft=e.object({pattern:e.string().describe(`File name pattern with optional wildcards (*, ?), e.g. "*.ts", "data-??.json"`),path:e.string().optional().describe(`Search starting path (default is project root)`),limit:e.number().int().min(1).max(1e3).optional().default(1e3).describe(`Maximum number of results to return`)});function It(e,t={}){return{name:`find`,description:`Search for files by glob pattern. Returns matching file paths relative to the search directory. Respects .gitignore. Output is truncated to ${R} results or ${z/1024}KB (whichever is hit first).`,parameters:Ft,pathParams:[`path`],readonly:!0,async execute({params:n}){let r=_(P(e,n.path??`.`)),i=n.limit??R;if(!await s(r))throw H(`Search path does not exist: ${n.path}`,`not_found`);if(!await p(r))throw H(`Search path is not a directory: ${n.path}`,`validation`);return await Bt(r,n.pattern,i,t.glob,t.binaryExecutorRegistry)}}}const Lt=new Set([`node_modules`,`.git`,`dist`,`build`,`.next`,`target`,`vendor`]);async function Rt(e,t,n){let r=[`--glob`,`--color=never`,`--hidden`,`--max-results`,String(n)],i=new Set,a=M(t,`.gitignore`);await s(a)&&i.add(a);try{let e=Date.now(),n=_e(
|
|
3
|
+
`).pop()||``,`utf-8`));w+=`\n\n(Showing last ${c(C.outputBytes)} of line ${t} (line is ${e}).${n})`}else C.truncatedBy===`lines`?w+=`\n\n(Showing lines ${e}-${t} of ${C.totalLines}.${n})`:w+=`\n\n(Showing lines ${e}-${t} of ${C.totalLines} (${c(z)} limit).${n})`}return x.exitCode===0?{content:[{type:`text`,text:w}],details:re}:(w+=`\n\nCommand exited with code ${x.exitCode}`,{content:[{type:`text`,text:w}],isError:!0,errorKind:`runtime`,details:re})}const Ot=e.object({background_id:e.string().describe(`Background process id returned by bash with run_in_background:true`),block:e.boolean().optional().describe(`Wait until the process exits before returning (default false)`),timeout_ms:e.number().int().min(0).max(6e5).optional().describe(`Max wait when block=true (ms), default from TOOLS_EXECUTE_TIMEOUT_MS (30000)`)}),kt=e=>new Promise(t=>setTimeout(t,e));async function At(e){if(!e.logPath)return`(no output captured)`;let t;try{t=await k(e.logPath,`utf-8`)}catch{return`(output log unavailable)`}return S(t,{maxLines:R,maxBytes:z}).content||`(no output yet)`}function jt(e){return{name:`bash_output`,description:`Read accumulated output and status of a background process started by bash run_in_background.`,parameters:Ot,readonly:!0,async execute({params:t,sessionId:n}){let r=t.background_id,i=n?e.getForSession(n,r):e.get(r);if(!i)return{content:[{type:`text`,text:`No background process with id "${r}".`}],isError:!0,errorKind:`not_found`};let a=Date.now()+(t.timeout_ms??B);for(;t.block&&i.status===`running`&&Date.now()<a;){await kt(200);let t=e.get(r);if(!t)return{content:[{type:`text`,text:`[status: untracked]\nBackground process "${r}" is no longer tracked (likely evicted at the process limit).`}],details:{status:`untracked`,logPath:i.logPath}};i=t}let o=await At(i);return{content:[{type:`text`,text:`${i.status===`running`?`[status: running]`:`[status: ${i.status}${i.exitCode===void 0?``:`, exit ${i.exitCode}`}]`}\n${o}`}],details:{status:i.status,exitCode:i.exitCode,logPath:i.logPath}}}}}const Mt=e.object({background_id:e.string().describe(`Background process id (returned by bash run_in_background) to stop`)});function Nt(e){return{name:`kill_shell`,description:`Stop a background process started by bash with run_in_background:true.`,parameters:Mt,async execute({params:t,sessionId:n}){let r=t.background_id,i=n?e.getForSession(n,r):e.get(r);return i?i.status!==`running`&&i.status!==`killing`?{content:[{type:`text`,text:`Background process "${r}" already ${i.status}.`}]}:(await e.kill(r),{content:[{type:`text`,text:`Stopped background process "${r}".`}]}):{content:[{type:`text`,text:`No background process with id "${r}".`}],isError:!0,errorKind:`not_found`}}}}const Pt=i(`@x-otto/tools:find`),Ft=e.object({pattern:e.string().describe(`File name pattern with optional wildcards (*, ?), e.g. "*.ts", "data-??.json"`),path:e.string().optional().describe(`Search starting path (default is project root)`),limit:e.number().int().min(1).max(1e3).optional().default(1e3).describe(`Maximum number of results to return`)});function It(e,t={}){return{name:`find`,description:`Search for files by glob pattern. Returns matching file paths relative to the search directory. Respects .gitignore. Output is truncated to ${R} results or ${z/1024}KB (whichever is hit first).`,parameters:Ft,pathParams:[`path`],readonly:!0,async execute({params:n}){let r=_(P(e,n.path??`.`)),i=n.limit??R;if(!await s(r))throw H(`Search path does not exist: ${n.path}`,`not_found`);if(!await p(r))throw H(`Search path is not a directory: ${n.path}`,`validation`);return await Bt(r,n.pattern,i,t.glob,t.binaryExecutorRegistry)}}}const Lt=new Set([`node_modules`,`.git`,`dist`,`build`,`.next`,`target`,`vendor`]);async function Rt(e,t,n){let r=[`--glob`,`--color=never`,`--hidden`,`--max-results`,String(n)],i=new Set,a=M(t,`.gitignore`);await s(a)&&i.add(a);try{let e=Date.now(),n=_e(`**/`,{cwd:t,exclude:e=>Lt.has(e)});for await(let r of n){let n=M(t,r,`.gitignore`);if(await s(n)&&i.add(n),i.size>=200||Date.now()-e>1500){Pt.warn({normalizedSearchDir:t,found:i.size,elapsedMs:Date.now()-e},`find: .gitignore discovery hit time/count budget, stopping early (best-effort)`);break}}}catch{}for(let e of i)r.push(`--ignore-file`,e);return r.push(`--`,e,t),r}function zt(e,t,n,r=[]){let i=e.length>=t,a=x(e.join(`
|
|
4
4
|
`),{maxLines:R,maxBytes:z}),o=a.content,s={},l=[];i&&(l.push(n),s.resultLimitReached=t),a.truncated&&(l.push(`${c(z)} limit reached`),s.truncation=b(a));for(let e of r)l.push(e.text),s[e.detailKey]=e.detailValue;return l.length>0&&(o+=`\n\n(${l.join(`. `)})`),{content:[{type:`text`,text:o}],details:s}}async function Bt(e,t,n,r,i){if(typeof r==`function`){Pt.debug(`Using custom glob implementation for find tool`);let i=await r(t,e,{ignore:[`**/node_modules/**`,`**/.git/**`],limit:n});return i.length===0?{content:[{type:`text`,text:`No files found matching pattern`}]}:zt(i.map(t=>t.startsWith(e)?t.slice(e.length+1):N(e,t)),n,`${n} results limit reached`)}Pt.debug(`No custom glob provided, using fd binary for find tool`);let a=await i?.ensure(`fd`);if(!a)throw H(`Find tool requires a glob implementation or fd binary available`,`runtime`);let o=await Rt(t,e,n),s=await a.execute(o,{maxBuffer:z*4});if(s.exitCode!==0)return{content:[{type:`text`,text:s.stderr?.trim()||`fd exited with code ${s.exitCode}`}]};let c=s.stdout?.trim()||``;if(!c)return{content:[{type:`text`,text:`No files found matching pattern`}]};let l=c.split(`
|
|
5
5
|
`),u=[];for(let t of l){let n=t.replace(/\r$/,``).trim();if(!n)continue;let r=n.endsWith(`/`)||n.endsWith(`\\`),i=n;i=n.startsWith(e)?n.slice(e.length+1):N(e,n),r&&!i.endsWith(`/`)&&(i+=`/`),u.push(i)}let d=s.truncated?[{text:`output exceeded buffer limit; results are incomplete (refine the pattern)`,detailKey:`bufferTruncated`,detailValue:!0}]:[];return zt(u,n,`${n} results limit reached. Use limit=${n*2} for more, or refine pattern`,d)}const Vt=z*8,Ht=e.object({pattern:e.string().describe(`Search pattern (regex or literal string)`),path:e.string().optional().describe(`Directory or file to search (default: current directory)`),glob:e.string().optional().describe(`Filter files by glob pattern, e.g. "*.ts" or "**/*.spec.ts"`),ignoreCase:e.boolean().optional().describe(`Case-insensitive search (default: false)`),literal:e.boolean().optional().describe(`Treat pattern as literal string instead of regex (default: false)`),context:e.number().int().min(0).optional().describe(`Number of lines to show before and after each match (default: 0)`),limit:e.number().int().min(1).optional().describe(`Maximum number of matches to return (default: 100)`)});function Ut(e,t){return{name:`grep`,description:`Search file contents for pattern matches. Returns matching lines with file paths and line numbers. Respects .gitignore. Truncated to 100 matches or ${z/1024}KB. Long lines truncated to 500 chars.`,parameters:Ht,pathParams:[`path`],readonly:!0,async execute({params:n}){let r=_(P(e,n.path??`.`));if(!await s(r))throw H(`Search path does not exist: ${n.path??`.`}`,`not_found`);return await Yt(n.pattern,r,e,n.glob,n.literal??!1,n.ignoreCase??!1,n.context??0,n.limit??100,t.binaryToolExecutorRegistry,t.processTracker)}}}function Wt(e,t,n,r,i,a,o){let s=[`--json`,`--line-number`,`--color=never`,`--hidden`];return n&&s.push(`--ignore-case`),r&&s.push(`--fixed-strings`),i&&s.push(`--glob`,i),a!=null&&s.push(`--max-count`,String(a)),o!=null&&o>0&&s.push(`--context`,String(o)),s.push(`--`,e,t),s}function Gt(e){let t=[];for(let n of e.split(`
|
|
6
6
|
`))if(n.trim())try{let e=JSON.parse(n);if(e.type===`match`||e.type===`context`){let n=e.data;t.push({kind:e.type,path:n.path?.text??``,lineNumber:n.line_number??0,text:n.lines?.text?.replace(/\n$/,``)??``})}}catch{}return t}function Kt(e,t,n){return e.startsWith(t)?N(t,e):N(n,e)}function qt(e,t,n,r){let i=e.reduce((e,t)=>e+(t.kind===`match`?1:0),0),a=[],o=0,s=0,c=null,l=0,u=!1;for(let i of e){if(i.kind===`match`){if(o>=r)break;o++,o>=r&&(u=!0)}else if(u&&(i.path!==c||i.lineNumber!==l+1))break;c!==null&&(i.path!==c||i.lineNumber>l+1)&&a.push(`--`);let{text:e}=ne(i.text,500);i.text.length>500&&s++;let d=i.kind===`match`?`:`:`-`,f=Kt(i.path,t,n);a.push(`${f}${d}${i.lineNumber}${d} ${e}`),c=i.path,l=i.lineNumber}return{text:a.join(`
|
|
@@ -79,8 +79,8 @@ import{z as e}from"zod";import{API_IMAGE_DIMENSION_LIMIT_PX as t,PROVIDER_IMAGE_
|
|
|
79
79
|
`).trim();return n||(i+=`
|
|
80
80
|
|
|
81
81
|
(Note: results were scraped from search HTML and may be incomplete or out of date. Set BRAVE_SEARCH_API_KEY to use the official Brave Search API for reliable results.)`),i}var Kn=class{id=`brave-api`;reliable=!0;constructor(e,t=fetch){this.apiKey=e,this.fetchImpl=t}async search(e,t,n){let r=new URLSearchParams({q:e,count:String(t)}),i=await this.fetchImpl(`https://api.search.brave.com/res/v1/web/search?${r}`,{headers:{"X-Subscription-Token":this.apiKey,Accept:`application/json`},signal:n??AbortSignal.timeout(B)});if(!i.ok)throw Error(`Brave Search API error: HTTP ${i.status}`);return((await i.json()).web?.results??[]).slice(0,t).map(e=>({title:e.title??``,url:e.url??``,snippet:e.description??``})).filter(e=>e.url)}},qn=class{id=`brave-html`;reliable=!1;constructor(e=fetch){this.fetchImpl=e}async search(e,t,n){let r=new URLSearchParams({q:e,source:`web`}),i=await this.fetchImpl(`https://search.brave.com/search?${r}`,{headers:{"User-Agent":`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36`,Accept:`text/html,application/xhtml+xml`,"Accept-Language":`en-US,en;q=0.9`},redirect:`follow`,signal:n??AbortSignal.timeout(B)});if(!i.ok)throw Error(`Search request failed: HTTP ${i.status}`);return Wn(await i.text(),t)}};function Jn(e={},t=process.env){if(e.provider)return e.provider;let n=e.apiKey??t.BRAVE_SEARCH_API_KEY;return n?new Kn(n,e.fetchImpl):new qn(e.fetchImpl)}function Yn(e,t={}){return{name:`web_search`,description:`Search the web and return results with titles, URLs, and snippets. Use this to discover relevant pages before fetching them with web_fetch.`,parameters:Un,readonly:!0,async execute({params:e,signal:n}){let{query:r,limit:i=10}=e,a=Jn(t),o;try{o=await a.search(r,i,n)}catch(e){return{content:[{type:`text`,text:e instanceof Error?e.message:`Search request failed`}],isError:!0,errorKind:`network`}}return{content:[{type:`text`,text:Gn(r,o,a.reliable)}],details:{query:r,provider:a.id,reliable:a.reliable,resultCount:o.length,results:o}}}}}function K(e,t){return{content:[{type:`text`,text:`${e} not available: this capability is not configured in the host.${t?` ${t}`:``}`}],isError:!0,errorKind:`runtime`}}function Xn(e){if(e.length===0)return``;let t=e.slice(0,8),n=e.length>8?`… and ${e.length-8} more — pass any name, fuzzy match applies.`:``;return[`Available agents:`,...t.map(e=>{let t=e.description.length>80?e.description.slice(0,77)+`…`:e.description,n=[];e.slot&&n.push(`slot=${e.slot}`),e.readOnly&&n.push(`read-only`);let r=n.length>0?` (${n.join(`, `)})`:``;return`- **${e.name}**: ${t}${r}`}),n,`Pass the agent name — fuzzy match applies for unknown names.`].filter(Boolean).join(`
|
|
82
|
-
`)}const Zn=e.string().optional().describe(`Optional child session ID. When used with sticky mode, later calls can reuse the same child context.`),Qn=e.enum([`ephemeral`,`sticky`]).optional().default(`ephemeral`).describe(`Child session lifecycle. ephemeral deletes the child session after the task; sticky keeps it for later reuse.`),$n=e.enum(Ne).optional().describe(`Model slot to use for this task`),er=e.object({prompt:e.string().describe(`Task description to delegate (for mode=team, the input handed to the team)`),subagent:e.string().optional().describe(`Agent name to delegate the task to (e.g. "explore"). Used by mode=sync/background.`),category:e.string().optional().describe(`Task category — drives automatic model selection for the sub-agent. Use "search"/"quick" for shallow/high-volume work (routes to a cheaper, faster model) and "deep"/"critique"/"review" for work needing strong reasoning (routes to the powerful model). Set this on mode=sync/background whenever the task fits a category, even without a named subagent.`),team:e.string().optional().describe(`Declared team name (see .otto/teams/*.md). Required for mode=team.`),mode:e.enum([`sync`,`background`,`fork`,`team`]).optional().default(`sync`).describe(`Execution mode. 'sync' (default): delegate to a sub-agent (subagent/category) in the shared workspace, returns inline — use for tracked subtasks that edit files or whose output you need now. 'background': same but detached and READ-ONLY (no edit/write/bash) — analysis/research only. 'fork': run a self-contained side quest in a fresh ISOLATED session that does NOT inherit your history/system-prompt/tools (put all needed context in prompt) — best for summarization, batch checks, in-context Q&A. 'team': run a declared multi-agent team (sequential/parallel/hierarchical/handoff/router) from .otto/teams/*.md on the prompt.`),sessionId:Zn,sessionMode:Qn,slot:$n,model:e.string().optional().describe("Explicit model id chosen by capability strength (overrides slot/category). Pick only models marked usable by list_models; unauthenticated or rate-limit-risky models (e.g. subscription-OAuth Claude) are rejected and fall back. Prefer leaving this unset and using `category` so the host picks a usable model automatically."),taskIds:e.array(e.string()).optional().describe(`Task IDs from the parent write_todos list that this sub-agent is responsible for completing.`),tracked:e.boolean().optional().default(!0).describe(`Host governance: true (default) = full task tracking (recorded, retryable, todo-sync). false = lightweight probe (no record/retry, ephemeral, synchronous) — use for quick agent opinions/reviews; requires explicit subagent name.`)}).refine(e=>{let t=e.mode??`sync`;return e.tracked===!1?t===`sync`&&e.subagent!==void 0&&e.category===void 0&&e.team===void 0&&e.sessionId===void 0&&e.sessionMode===void 0&&e.taskIds===void 0:t===`team`?e.team!==void 0:t===`fork`?!0:e.subagent!==void 0||e.category!==void 0},{message:`mode=sync/background requires subagent or category; mode=team requires team; mode=fork needs only prompt; tracked:false requires explicit subagent with mode=sync (no category/team/sessionId/sessionMode/taskIds)`});async function tr(e,t,n,r){if(!e)return;let i;if(n&&n.length>0)i=n.filter(e=>r.some(t=>t.id===e&&t.status!==`done`));else{let e=r.filter(e=>e.status===`in_progress`);e.length===1&&(i=[e[0].id])}if(!(!i||i.length===0)&&(await e({action:`update`,todos:r.map(e=>i.includes(e.id)?{...e,status:`done`}:e),sessionId:t})).ok)return`✓ auto-synced parent task list: ${i.join(`, `)} → done`}async function nr(e,t,n,r,i){if(!e)return K(`task_delegate (mode=fork)`);let{childDepth:a,exceeded:o}=Pe(n,i);if(o)return{isError:!0,errorKind:`validation`,content:[{type:`text`,text:`fork rejected: delegation depth ${a} exceeds max ${i}`}]};let s=await e(t,a,r);return s.ok?{content:[{type:`text`,text:s.value||`(no output)`}]}:{content:[{type:`text`,text:`Fork failed: ${s.error}`}],isError:!0,errorKind:`runtime`}}async function rr(e,t,n,r,i){if(!e)return K(`task_delegate (mode=team)`,`Declare a team in .otto/teams/*.md.`);if(!t)return{content:[{type:`text`,text:`mode=team requires a team name`}],isError:!0,errorKind:`validation`};let a=await e(t,n,r,i);return a.success?{content:[{type:`text`,text:a.output??``}],details:{team:t,pattern:a.pattern}}:{content:[{type:`text`,text:`Team "${t}" failed: ${a.error}`}],isError:!0,errorKind:`runtime`}}function ir(e,t,n,r,i,a=1,o,s){let c=Xn((s??[]).map(e=>({name:e.name,description:e.description,slot:e.preferredModelTier})));return{name:`task_delegate`,description:`Delegate work to a sub-agent, an isolated fork, or a declared team. mode=sync/background → sub-agent (provide subagent/category); mode=fork → fresh isolated self-contained session (prompt only, no inheritance); mode=team → declared multi-agent team (provide team). tracked:false (sync only, explicit subagent) → lightweight probe: no task record, no retry, returns inline — use for quick agent opinions/reviews.`+(c?`\n${c}`:``),parameters:er,isConcurrencySafe:e=>e?.mode===`fork`||e?.mode===`team`||e?.sessionMode!==`sticky`,lifecycleAsync:e=>(e?.mode===`sync`||e?.mode===void 0)&&e?.sessionMode!==`sticky`&&e?.tracked!==!1,lifecycleAsyncNote:`Note: the delegated sub-agent may edit files in the shared workspace while it runs. Until you receive its completion notice, do not read or write paths its task may touch.`,async execute({params:e,depth:s,signal:c,sessionId:l}){if(e.tracked===!1){if((e.mode??`sync`)!==`sync`||e.category!==void 0||e.team!==void 0||e.sessionId!==void 0||e.sessionMode!==void 0||e.taskIds!==void 0||e.subagent===void 0)return{isError:!0,errorKind:`validation`,content:[{type:`text`,text:`tracked:false requires explicit subagent with mode=sync (no category/team/sessionId/sessionMode/taskIds)`}]};if(!o)return K(`task_delegate (tracked:false)`);let t=await o(e.subagent,e.prompt,{slot:e.slot,model:e.model,depth:s,signal:c});return t.ok?{content:[{type:`text`,text:t.value||`(no output)`}]}:{content:[{type:`text`,text:`Agent call failed: ${t.error}`}],isError:!0,errorKind:`runtime`}}if(e.mode===`fork`)return nr(r,e.prompt,s,c,a);if(e.mode===`team`)return rr(i,e.team,e.prompt,c,s);if(!t)return K(`task_delegate`);let
|
|
83
|
-
`)}],details:{mode:e.mode,status:r,sessionId:e.sessionId,sessionMode:e.sessionMode,...o?{todoSync:o}:{}}}}return{content:[{type:`text`,text:`Task delegation failed: ${
|
|
82
|
+
`)}const Zn=e.string().optional().describe(`Optional child session ID. When used with sticky mode, later calls can reuse the same child context.`),Qn=e.enum([`ephemeral`,`sticky`]).optional().default(`ephemeral`).describe(`Child session lifecycle. ephemeral deletes the child session after the task; sticky keeps it for later reuse.`),$n=e.enum(Ne).optional().describe(`Model slot to use for this task`),er=e.object({prompt:e.string().describe(`Task description to delegate (for mode=team, the input handed to the team)`),subagent:e.string().optional().describe(`Agent name to delegate the task to (e.g. "explore"). Used by mode=sync/background.`),category:e.string().optional().describe(`Task category — drives automatic model selection for the sub-agent. Use "search"/"quick" for shallow/high-volume work (routes to a cheaper, faster model) and "deep"/"critique"/"review" for work needing strong reasoning (routes to the powerful model). Set this on mode=sync/background whenever the task fits a category, even without a named subagent.`),team:e.string().optional().describe(`Declared team name (see .otto/teams/*.md). Required for mode=team.`),mode:e.enum([`sync`,`background`,`fork`,`team`]).optional().default(`sync`).describe(`Execution mode. 'sync' (default): delegate to a sub-agent (subagent/category) in the shared workspace, returns inline — use for tracked subtasks that edit files or whose output you need now. 'background': same but detached and READ-ONLY (no edit/write/bash) — analysis/research only. 'fork': run a self-contained side quest in a fresh ISOLATED session that does NOT inherit your history/system-prompt/tools (put all needed context in prompt) — best for summarization, batch checks, in-context Q&A. 'team': run a declared multi-agent team (sequential/parallel/hierarchical/handoff/router) from .otto/teams/*.md on the prompt.`),sessionId:Zn,sessionMode:Qn,slot:$n,model:e.string().optional().describe("Explicit model id chosen by capability strength (overrides slot/category). Pick only models marked usable by list_models; unauthenticated or rate-limit-risky models (e.g. subscription-OAuth Claude) are rejected and fall back. Prefer leaving this unset and using `category` so the host picks a usable model automatically."),taskIds:e.array(e.string()).optional().describe(`Task IDs from the parent write_todos list that this sub-agent is responsible for completing.`),tracked:e.boolean().optional().default(!0).describe(`Host governance: true (default) = full task tracking (recorded, retryable, todo-sync). false = lightweight probe (no record/retry, ephemeral, synchronous) — use for quick agent opinions/reviews; requires explicit subagent name.`)}).refine(e=>{let t=e.mode??`sync`;return e.tracked===!1?t===`sync`&&e.subagent!==void 0&&e.category===void 0&&e.team===void 0&&e.sessionId===void 0&&e.sessionMode===void 0&&e.taskIds===void 0:t===`team`?e.team!==void 0:t===`fork`?!0:e.subagent!==void 0||e.category!==void 0},{message:`mode=sync/background requires subagent or category; mode=team requires team; mode=fork needs only prompt; tracked:false requires explicit subagent with mode=sync (no category/team/sessionId/sessionMode/taskIds)`});async function tr(e,t,n,r){if(!e)return;let i;if(n&&n.length>0)i=n.filter(e=>r.some(t=>t.id===e&&t.status!==`done`));else{let e=r.filter(e=>e.status===`in_progress`);e.length===1&&(i=[e[0].id])}if(!(!i||i.length===0)&&(await e({action:`update`,todos:r.map(e=>i.includes(e.id)?{...e,status:`done`}:e),sessionId:t})).ok)return`✓ auto-synced parent task list: ${i.join(`, `)} → done`}async function nr(e,t,n,r,i){if(!e)return K(`task_delegate (mode=fork)`);let{childDepth:a,exceeded:o}=Pe(n,i);if(o)return{isError:!0,errorKind:`validation`,content:[{type:`text`,text:`fork rejected: delegation depth ${a} exceeds max ${i}`}]};let s=await e(t,a,r);return s.ok?{content:[{type:`text`,text:s.value||`(no output)`}]}:{content:[{type:`text`,text:`Fork failed: ${s.error}`}],isError:!0,errorKind:`runtime`}}async function rr(e,t,n,r,i){if(!e)return K(`task_delegate (mode=team)`,`Declare a team in .otto/teams/*.md.`);if(!t)return{content:[{type:`text`,text:`mode=team requires a team name`}],isError:!0,errorKind:`validation`};let a=await e(t,n,r,i);return a.success?{content:[{type:`text`,text:a.output??``}],details:{team:t,pattern:a.pattern}}:{content:[{type:`text`,text:`Team "${t}" failed: ${a.error}`}],isError:!0,errorKind:`runtime`}}function ir(e,t,n,r,i,a=1,o,s){let c=Xn((s??[]).map(e=>({name:e.name,description:e.description,slot:e.preferredModelTier})));return{name:`task_delegate`,description:`Delegate work to a sub-agent, an isolated fork, or a declared team. mode=sync/background → sub-agent (provide subagent/category); mode=fork → fresh isolated self-contained session (prompt only, no inheritance); mode=team → declared multi-agent team (provide team). tracked:false (sync only, explicit subagent) → lightweight probe: no task record, no retry, returns inline — use for quick agent opinions/reviews.`+(c?`\n${c}`:``),parameters:er,isConcurrencySafe:e=>e?.mode===`fork`||e?.mode===`team`||e?.sessionMode!==`sticky`,lifecycleAsync:e=>(e?.mode===`sync`||e?.mode===void 0)&&e?.sessionMode!==`sticky`&&e?.tracked!==!1,lifecycleAsyncNote:`Note: the delegated sub-agent may edit files in the shared workspace while it runs. Until you receive its completion notice, do not read or write paths its task may touch.`,async execute({params:e,depth:s,signal:c,sessionId:l,parentTaskId:u}){if(e.tracked===!1){if((e.mode??`sync`)!==`sync`||e.category!==void 0||e.team!==void 0||e.sessionId!==void 0||e.sessionMode!==void 0||e.taskIds!==void 0||e.subagent===void 0)return{isError:!0,errorKind:`validation`,content:[{type:`text`,text:`tracked:false requires explicit subagent with mode=sync (no category/team/sessionId/sessionMode/taskIds)`}]};if(!o)return K(`task_delegate (tracked:false)`);let t=await o(e.subagent,e.prompt,{slot:e.slot,model:e.model,depth:s,signal:c,parentTaskId:u});return t.ok?{content:[{type:`text`,text:t.value||`(no output)`}]}:{content:[{type:`text`,text:`Agent call failed: ${t.error}`}],isError:!0,errorKind:`runtime`}}if(e.mode===`fork`)return nr(r,e.prompt,s,c,a);if(e.mode===`team`)return rr(i,e.team,e.prompt,c,s);if(!t)return K(`task_delegate`);let d=[];if(e.mode!==`background`&&n){let e=await n({action:`update`,todos:[],sessionId:l});e.ok&&(d=e.value)}let f=e.prompt;e.taskIds&&e.taskIds.length>0&&(f=`You are responsible for completing parent task item(s): ${e.taskIds.map(e=>`"${e}"`).join(`, `)}. When done, your host will auto-sync these to "done". No need to call write_todos for parent items.\n\n${e.prompt}`);let p=await t({prompt:f,subagent:e.subagent,category:e.category,mode:e.mode,sessionId:e.sessionId,sessionMode:e.sessionMode,slot:e.slot,model:e.model,depth:s,signal:c,parentTaskId:u});if(p.ok){let{id:t,status:r,output:i}=p.value,a=e.mode===`background`,o=a?void 0:await tr(n,l,e.taskIds,d),s=[];return a?s.push(`Task delegated in background${t?`: ${t}`:``}`):s.push(`Task delegated successfully`),i&&s.push(i),o&&s.push(o),{content:[{type:`text`,text:s.join(`
|
|
83
|
+
`)}],details:{mode:e.mode,status:r,sessionId:e.sessionId,sessionMode:e.sessionMode,...o?{todoSync:o}:{}}}}return{content:[{type:`text`,text:`Task delegation failed: ${p.error}`}],isError:!0,errorKind:`runtime`}}}}const ar=e.object({prompt:e.string().describe(`Self-contained instruction for the background job. It runs in an isolated git worktree with full tools (incl. file edits + MCP), so include all needed context.`),title:e.string().optional().describe(`Short label for the job (shown in the /jobs panel). Defaults to a slice of the prompt.`)});function or(e){return{name:`delegate_job`,description:`Delegate a file-changing task to an isolated background job. Runs in a separate git worktree with full tools (edits + MCP), then produces a REVIEWABLE DIFF — it does NOT touch your working tree directly. Use for independent changes you want isolated and audited (e.g. a self-contained refactor) while you keep working. The diff is applied by the user via /job apply (autonomous apply is off by default). For read-only background analysis use task_delegate(background); for in-conversation edits use task_delegate(sync).`,parameters:ar,async execute({params:t,sessionId:n}){if(!e)return K(`delegate_job`);if(!n)return{isError:!0,errorKind:`validation`,content:[{type:`text`,text:`delegate_job requires a session context (no sessionId available).`}]};let r=t.title?.trim()||t.prompt.replace(/\s+/g,` `).slice(0,48),{jobId:i}=e({prompt:t.prompt,title:r,sessionId:n});return{content:[{type:`text`,text:`Delegated background job ${i} (isolated worktree). It will produce a reviewable diff; you'll get a notification when it's ready. The user applies it with /job apply ${i} (or reviews it in the /jobs panel). It does not modify the current working tree.`}],details:{jobId:i,origin:`main`}}}}}const sr=e.object({need:e.string().min(1).describe(`What capability is missing, in plain language (e.g. "query Jira issue status"). Describe the user-facing need, not an implementation.`),searchTerms:e.array(e.string().min(1)).min(1).describe(`Keywords to search the plugin ecosystem with (e.g. ["jira", "issue tracker"]). Use 2-4 distinct terms; a single narrow term often misses existing plugins.`)});function cr(e){return[...new Set(e.map(e=>e.trim().toLowerCase()).filter(Boolean))].sort().join(`|`)}function lr(e){return`plugin-${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).split(`-`).filter(Boolean).slice(0,3).join(`-`)||`custom`}`}function ur(e){let t=new Set;return{name:`capability_gap`,description:`Report a capability you lack and discover whether the plugin ecosystem already provides it. Use this when the user asks for something you genuinely cannot do with your current tools — instead of only saying "I can't", check whether a plugin exists, and if not, get a blueprint for building one. This tool only returns guidance: it never installs anything (installation always requires explicit user approval).`,parameters:sr,async execute({params:n}){if(!e)return K(`capability_gap`);let r=cr(n.searchTerms),i=t.has(r);if(t.add(r),i)return{content:[{type:`text`,text:`Already reported this capability gap earlier in the session (search terms: ${n.searchTerms.join(`, `)}). Don't re-report it — either act on the earlier guidance, or tell the user plainly that this capability is unavailable.`}],details:{deduped:!0}};let a=await e(n.searchTerms);if(!a){let e=lr(n.need);return{content:[{type:`text`,text:`Could not reach the plugin registry (network or configuration issue), so it is unknown whether an existing plugin provides "${n.need}".\n\nYou can still offer to build it: ask the user whether they want a plugin scaffolded, then\n otto extension create ${e} --with-tool\nand use delegate_job to implement it in an isolated worktree (produces a reviewable diff).`}],details:{suggestion:`generate`,registryReachable:!1}}}let{hits:o,warnings:s}=a,c=s.length>0?`\n\nRegistry warnings:\n${s.map(e=>`- ${e}`).join(`
|
|
84
84
|
`)}`:``;if(o.length>0){let e=o.map(e=>{let t=e.capabilities?.length?` [declares: ${e.capabilities.join(`, `)}]`:``,n=e.stale?` (cached index may be out of date)`:``;return`- ${e.id} — ${e.description}${t} (from ${e.sourceName})${n}\n install: otto extension install ${e.id}`});return{content:[{type:`text`,text:`Found ${o.length} existing plugin(s) that may provide "${n.need}":\n\n${e.join(`
|
|
85
85
|
`)}\n\nTell the user what you found and let THEM run the install command — you cannot install it yourself, and installing high-risk capabilities requires their explicit approval.`+c}],details:{suggestion:`install`,hits:o.length}}}let l=lr(n.need);return{content:[{type:`text`,text:`No existing plugin in the ecosystem provides "${n.need}".\n\nYou can offer to build one. Blueprint:\n 1. Ask the user whether they want this capability added as a plugin.\n 2. Scaffold it: otto extension create ${l} --with-tool\n 3. Implement it with delegate_job (isolated worktree, produces a reviewable diff) — describe the tool's name, parameters, and behaviour in the job prompt.\n 4. The user reviews the diff (/job apply), then installs it — installation and any high-risk capability grants always go through their explicit approval.`+c}],details:{suggestion:`generate`,hits:0}}}}}const dr=e.object({action:e.enum([`get`,`list`,`output`]).describe(`get task by ID, list all tasks, or get background task output`),taskId:e.string().optional().describe(`Task ID (required for get/output actions)`),statusFilter:e.enum([`all`,`pending`,`running`,`completed`,`failed`,`cancelled`]).optional().default(`all`).describe(`Filter by status (list action only)`)});function fr(e,t){let{get:n,list:r,output:i}=t;return{name:`task_inspect`,description:`Inspect tasks: get details by ID, list with optional status filter, or get background task output.`,parameters:dr,readonly:!0,async execute({params:e}){switch(e.action){case`get`:{if(!n)return K(`task_inspect(get)`);if(!e.taskId)return{content:[{type:`text`,text:`taskId is required for get action`}],isError:!0,errorKind:`validation`};let t=await n(e.taskId);if(!t.ok)return{content:[{type:`text`,text:t.error}],isError:!0,errorKind:`runtime`};let r=t.value,i=r.status===`failed`||!!r.error;return{content:[{type:`text`,text:[`Task: ${r.id}`,`Status: ${r.status}`,r.prompt?`Prompt: ${r.prompt}`:void 0,`Output: ${r.output??`N/A`}`,r.error?`Error: ${r.error}`:void 0].filter(e=>!!e).join(`
|
|
86
86
|
`)}],isError:i,details:{task:r}}}case`list`:{if(!r)return K(`task_inspect(list)`);let t=await r(e.statusFilter===`all`?void 0:e.statusFilter);if(t.ok){let e=t.value;return e.length===0?{content:[{type:`text`,text:`No tasks found.`}]}:{content:[{type:`text`,text:e.map(e=>`- [${e.status}] ${e.id}: ${e.prompt.slice(0,80)}`).join(`
|
|
@@ -109,7 +109,7 @@ import{z as e}from"zod";import{API_IMAGE_DIMENSION_LIMIT_PX as t,PROVIDER_IMAGE_
|
|
|
109
109
|
`)}]}}}}const fi=e.object({filePath:e.string().describe(`Absolute path to the file`),severity:e.enum([`error`,`warning`,`information`,`hint`,`all`]).optional().describe(`Filter by severity level`)});function pi(e){return{name:`lsp_diagnostics`,description:`Get errors, warnings, hints from language server BEFORE running build.`,parameters:fi,pathParams:[`filePath`],readonly:!0,async execute({params:e}){let t=await Z(e.filePath,async t=>await t.diagnostics(e.filePath)),n=[];if(t&&(Array.isArray(t)?n=t:t.items&&(n=t.items)),n=Br(n,e.severity),n.length===0)return{content:[{type:`text`,text:`No diagnostics found`}]};let r=n.length,i=r>200,a=(i?n.slice(0,200):n).map(zr);return i&&a.unshift(`Found ${r} diagnostics (showing first 200):`),{content:[{type:`text`,text:a.join(`
|
|
110
110
|
`)}]}}}}const mi=e.object({filePath:e.string().describe(`Absolute path to the file`),line:e.number().int().min(1).describe(`1-based line number`),character:e.number().int().min(0).describe(`0-based character offset`)});function hi(e){return{name:`lsp_prepare_rename`,description:`Check if rename is valid. Use BEFORE lsp_rename.`,parameters:mi,pathParams:[`filePath`],async execute({params:e}){return{content:[{type:`text`,text:Vr(await Z(e.filePath,async t=>await t.prepareRename(e.filePath,e.line,e.character)))}]}}}}const gi=e.object({filePath:e.string().describe(`Absolute path to the file`),line:e.number().int().min(1).describe(`1-based line number`),character:e.number().int().min(0).describe(`0-based character offset`),newName:e.string().describe(`New symbol name`)});function _i(e){return{name:`lsp_rename`,description:`Rename symbol across entire workspace. APPLIES changes to all files.`,parameters:gi,pathParams:[`filePath`],async execute({params:e}){return{content:[{type:`text`,text:Hr(await Nr(await Z(e.filePath,async t=>await t.rename(e.filePath,e.line,e.character,e.newName))))}]}}}}const vi=e.object({action:e.enum([`list`,`create`,`remove`,`compact`]).describe(`Session management action to perform`),sessionId:e.string().optional().describe(`Session ID (required for remove/compact)`),title:e.string().optional().describe(`New session title (optional when creating)`)});function yi(e){let{sessionManager:t}=e;return{name:`session_manager`,description:`Manage conversation sessions: list, create, remove, compact.`,parameters:vi,async execute({params:e}){if(!t)throw Error(`SessionManager is not provided in options`);return await bi(e.action,t,e.sessionId,e.title)}}}async function bi(e,t,n,r){switch(e){case`list`:{let e=await t.list();return{content:[{type:`text`,text:e.length===0?`No sessions found.`:e.map(e=>`- ${e.id}: ${e.title} (${e.messageCount} messages)`).join(`
|
|
111
111
|
`)}]}}case`create`:return{content:[{type:`text`,text:`Session created: ${(await t.create(r)).id}`}]};case`remove`:{if(!n)throw Error(`sessionId required for remove`);let e=await t.remove(n);return{content:[{type:`text`,text:e?`Session ${n} removed`:`Session not found`}],isError:!e}}case`compact`:{if(!n)throw Error(`sessionId required for compact`);let e=await t.compact(n);return{content:[{type:`text`,text:e?`Session ${n} compacted`:`Compact failed`}],isError:!e}}}}const xi=e.object({action:e.enum([`load`,`execute`]).describe(`'load' to register a skill; 'execute' to run it (auto-loads if needed)`),path:e.string().optional().describe(`SKILL.md file path, relative to project root (load action)`),name:e.string().optional().describe(`Skill name (execute action; if path is also given, loads first)`)});function Si(e,t,n){return{name:`skill`,description:`Load or execute a reusable skill (workflow template). Use action=load to register a SKILL.md; use action=execute to run a loaded skill (auto-loads via path if not yet registered).`,parameters:xi,pathParams:[`path`],resolvePath:t=>P(e,t),async execute({params:e}){switch(e.action){case`load`:{if(!e.path)return{content:[{type:`text`,text:`path is required for load action`}],isError:!0,errorKind:`validation`};let n=await t(e.path);return n.success?{content:[{type:`text`,text:`Skill "${n.name}" loaded from ${e.path}`}]}:{content:[{type:`text`,text:`Failed to load skill: ${n.error}`}],isError:!0,errorKind:`runtime`}}case`execute`:if(!n)return K(`skill(execute)`);if(e.path){let r=await t(e.path);if(!r.success)return{content:[{type:`text`,text:`Failed to load skill: ${r.error}`}],isError:!0,errorKind:`runtime`};let i=r.name??e.name;return i?Ci(await n(i)):{content:[{type:`text`,text:`Cannot execute: no skill name resolved from path or argument`}],isError:!0,errorKind:`validation`}}return e.name?Ci(await n(e.name)):{content:[{type:`text`,text:`name or path is required for execute action`}],isError:!0,errorKind:`validation`}}}}}function Ci(e){return e.success?{content:[{type:`text`,text:e.content??`Skill executed successfully`}]}:{content:[{type:`text`,text:`Skill failed: ${e.error}`}],isError:!0,errorKind:`runtime`}}const wi=e.object({name:e.string().describe(`Short, stable memory title (used as the lookup key)`),description:e.string().describe(`One-line hook shown in the always-visible memory index`),content:e.string().describe(`The full fact to remember across sessions`),scope:e.enum([`workspace`,`local`,`project-shared`]).optional().default(`workspace`).describe(`Memory scope (default 'workspace'). Use 'workspace' for durable structured facts stored in the AutoMemory index+entry store, portable across machines (preferences, gotchas, decisions). Use 'local' for machine-specific facts that should never sync to other devices (local absolute paths, installed plugins/extensions, environment quirks, OS-specific gotchas). Use 'project-shared' for team-visible project conventions that belong in AGENTS.md (build/test commands, code style, architecture decisions all contributors should see when opening this project) — written directly to the project AGENTS.md file, never edit/write it directly.`)});function Ti(e){return{name:`memory_record`,description:`Persist a fact across sessions (auto-memory). The memory index is injected into future sessions; use memory_read to retrieve full entries.`,parameters:wi,async execute({params:t}){return e?(await e(t),{content:[{type:`text`,text:`Memory "${t.name}" recorded.`}]}):{content:[{type:`text`,text:`Auto-memory is not configured. Set storage.memory in createApp() options.`}],isError:!0,errorKind:`runtime`}}}}const Ei=e.object({name:e.string().describe(`The memory title as shown in the memory index`)});function Di(e){return{name:`memory_read`,description:`Read the full content of a persisted memory entry by its name (see the memory index in the system prompt).`,parameters:Ei,readonly:!0,async execute({params:t}){if(!e)return{content:[{type:`text`,text:`Auto-memory is not configured. Set storage.memory in createApp() options.`}],isError:!0,errorKind:`runtime`};let n=await e(t.name);return n===null?{content:[{type:`text`,text:`Memory "${t.name}" not found.`}],isError:!0,errorKind:`not_found`}:{content:[{type:`text`,text:n}]}}}}const Oi=/^archive:(.+):(\d+)$/;function ki(e){let t=Oi.exec(e);return t?{sessionId:t[1],index:Number.parseInt(t[2],10)}:null}const Ai=e.object({archivePath:e.string().describe(`The archive id shown in a compaction summary, in the form "archive:<sessionId>:<n>".`)}),ji=e.object({}),Mi=`Conversation archive recall is not available in this session (no session-entry backed storage).`;function Ni(e,t){let n=ki(e);return n?!t||n.sessionId!==t?{content:[{type:`text`,text:`This archive belongs to a different conversation and cannot be read from here.`}],isError:!0,errorKind:`permission`}:null:{content:[{type:`text`,text:`Invalid archive id "${e}". Expected the form "archive:<sessionId>:<n>" exactly as shown in the compaction summary.`}],isError:!0,errorKind:`validation`}}function Pi(e){return{name:`memory_archive_read`,description:`Read the full original messages behind a compaction summary. Use this when a summary is marked low-fidelity, or when you need details the summary does not cover. Pass the archive id shown in the summary.`,parameters:Ai,readonly:!0,async execute({params:t,sessionId:n}){if(!e)return{content:[{type:`text`,text:Mi}],isError:!0,errorKind:`runtime`};let r=Ni(t.archivePath,n);if(r)return r;let i=await e(t.archivePath);return i?{content:[{type:`text`,text:i}]}:{content:[{type:`text`,text:`Archive "${t.archivePath}" not found in this conversation.`}],isError:!0,errorKind:`not_found`}}}}function Fi(e){return{name:`memory_archive_list`,description:`List the compaction archives of the current conversation (each entry = one folded chunk of earlier history, with its archive id and a summary preview).`,parameters:ji,readonly:!0,async execute({sessionId:t}){if(!e||!t)return{content:[{type:`text`,text:Mi}],isError:!0,errorKind:`runtime`};let n=await e(t);return n.length===0?{content:[{type:`text`,text:`No compaction archives yet in this conversation.`}]}:{content:[{type:`text`,text:n.map(e=>`- ${e.path} — ${e.messageCount} messages, ${new Date(e.timestamp).toISOString()}\n ${e.summary}`).join(`
|
|
112
|
-
`)}]}}}}const Ii=e.object({cron:e.string().describe(`5-field cron expression (minute hour dom month dow). Examples: "0 9 * * 1-5" = weekdays 9am, "*/30 * * * *" = every 30 min`),prompt:e.string().describe(`Natural language instruction for the agent to execute at the scheduled time`),recurring:e.boolean().describe(`true = run on schedule repeatedly, false = one-shot (delete after first fire)`),name:e.string().optional().describe(`Short label for the task (shown in schedule list)`),maxDurationMs:e.number().int().positive().optional().describe(`Timeout in milliseconds for a single fire attempt (default 300000 = 5 minutes). Raise this for tasks expected to take longer.`)});function Li(e){return{name:`schedule_create`,description:`Schedule a recurring or one-shot scheduled task. The task
|
|
112
|
+
`)}]}}}}const Ii=e.object({cron:e.string().describe(`5-field cron expression (minute hour dom month dow). Examples: "0 9 * * 1-5" = weekdays 9am, "*/30 * * * *" = every 30 min`),prompt:e.string().describe(`Natural language instruction for the agent to execute at the scheduled time`),recurring:e.boolean().describe(`true = run on schedule repeatedly, false = one-shot (delete after first fire)`),name:e.string().optional().describe(`Short label for the task (shown in schedule list)`),maxDurationMs:e.number().int().positive().optional().describe(`Timeout in milliseconds for a single fire attempt (default 300000 = 5 minutes). Raise this for tasks expected to take longer.`),target:e.enum([`job`,`session`]).optional().describe(`Where the prompt fires. Default "job": isolated git worktree, produces a diff for /job apply — use for tasks expected to change files, needing independent review, or that should stay decoupled from this conversation (e.g. "scan dependencies for updates every morning"). "session": injects the prompt into THIS conversation when it fires (no worktree, no diff) — use for polling/check-in/report-back tasks whose result should continue this conversation and that typically do not change files (e.g. "check on the long-running eval every 10 minutes and only speak up when there is real progress, it finishes, or it crashes"). A visible notice is shown when a model-created session task is first created and each time it fires.`)});function Li(e){return{name:`schedule_create`,description:`Schedule a recurring or one-shot scheduled task. The task fires automatically — see the "target" parameter for whether it runs as an isolated background job or continues this conversation.`,parameters:Ii,execute:async({params:t})=>{if(!e)return{content:[{type:`text`,text:`Schedule scheduling is not available in this session.`}],isError:!0};let n;try{n=e(t)}catch(e){return{content:[{type:`text`,text:e instanceof Error?e.message:String(e)}],isError:!0}}let r=n.target===`session`?` (fires into this conversation)`:``;return{content:[{type:`text`,text:`Schedule created: ${n.taskId} — "${n.name}"${r}\nNext fire: ${new Date(n.nextFireAt).toLocaleString()}\nUse schedule_list to view all schedules, schedule_delete to remove.`}]}}}}function Ri(t){return{name:`schedule_list`,description:`List all scheduled tasks with their IDs, cron schedules, and next fire times.`,parameters:e.object({}),execute:async()=>{if(!t)return{content:[{type:`text`,text:`Cron scheduling is not available.`}],isError:!0};let e=t();return e.length===0?{content:[{type:`text`,text:`No scheduled tasks.`}]}:{content:[{type:`text`,text:e.map(e=>{let t=e.enabled?`◉`:`○`,n=e.recurring?e.cronExpression:`one-shot`,r=new Date(e.nextFireAt).toLocaleString(),i=e.lastFiredAt?` last: ${new Date(e.lastFiredAt).toLocaleString()}`:``;return`${t} ${e.id} ${e.name}\n ${n} next: ${r}${i}`}).join(`
|
|
113
113
|
`)}]}}}}const zi=e.object({task_id:e.string().describe(`ID of the scheduled task to delete`)});function Bi(e){return{name:`schedule_delete`,description:`Delete a scheduled task by ID. Irreversible.`,parameters:zi,execute:async({params:t})=>{if(!e)return{content:[{type:`text`,text:`Cron scheduling is not available.`}],isError:!0};let n=e(t.task_id);return{content:[{type:`text`,text:n?`Schedule "${t.task_id}" deleted.`:`Schedule "${t.task_id}" not found.`}],isError:!n}}}}const Vi=e.object({task_id:e.string().describe(`ID of the scheduled task to run immediately`)});function Hi(e){return{name:`schedule_run`,description:`Run a scheduled task immediately (does not affect its regular schedule).`,parameters:Vi,execute:async({params:t})=>{if(!e)return{content:[{type:`text`,text:`Cron scheduling is not available.`}],isError:!0};try{return e(t.task_id),{content:[{type:`text`,text:`Schedule "${t.task_id}" triggered.`}]}}catch(e){return{content:[{type:`text`,text:`Failed to run schedule "${t.task_id}": ${e instanceof Error?e.message:String(e)}`}],isError:!0}}}}}const Ui=e.object({task_id:e.string().describe(`ID of the scheduled task whose currently running job should be canceled`)});function Wi(e){return{name:`schedule_cancel`,description:`Cancel the currently running job of a scheduled task. The schedule definition is not affected — the task will fire again at its next cron-triggered time. Only works on jobs that are still running or waiting for input; an already-completed or ready (diff-produced) job cannot be canceled.`,parameters:Ui,execute:async({params:t})=>{if(!e)return{content:[{type:`text`,text:`Schedule cancel is not available in this session.`}],isError:!0};let n=e(t.task_id);return n.ok?{content:[{type:`text`,text:`Schedule task "${t.task_id}" canceled. The task will fire again at its next scheduled time.`}]}:{content:[{type:`text`,text:`Cannot cancel schedule "${t.task_id}": ${n.reason??`unknown reason`}.`}],isError:!0}}}}const Q=(...e)=>e,Gi=[`Use read to understand existing code before making changes. Read targeted ranges instead of entire large files.`,`Prefer edit over write for modifying existing files — edit replaces exact text and is safer against accidental overwrites.`,`Use write only for creating new files or when the entire file content needs replacement. Prefer editing an existing file over creating a new one.`,`Always verify file existence with read before editing to avoid operating on stale assumptions.`,`For edit: provide enough surrounding context to avoid ambiguous matches.`].join(`
|
|
114
114
|
`),Ki=[`Use bash for running tests, installing dependencies, build commands, git operations, and system tasks that have no dedicated tool.`,"For long-lived service processes (dev servers, watchers, `http.server`), pass run_in_background:true instead of a blocking call or a trailing `&`. It returns immediately with a background id.","Then use bash_output to read its accumulated output and kill_shell to stop it. Background processes are auto-killed when the session ends — no manual cleanup of `&` jobs.",`Avoid programs requiring interactive input.`,`Prefer dedicated tools (read, write, edit, grep, find) over shell equivalents (cat, sed, grep) for file operations.`,`Avoid destructive commands (rm -rf, git reset --hard, DROP TABLE) without explicit user approval.`,`Set reasonable timeouts for long-running commands. Kill stale processes rather than waiting indefinitely.`,`Always check the exit code; on failure, inspect stdout/stderr before deciding next steps.`,`Prefer non-interactive flags, e.g. git --no-pager, --non-interactive.`].join(`
|
|
115
115
|
`),qi=[`Use find to locate files by name or glob pattern; use grep to search file contents by text or regex.`,"Start broad (find) then narrow (grep → read) to efficiently navigate unfamiliar codebases. There is no dedicated listing tool — for ad-hoc directory listing run `ls` via bash.",`Combine grep results with read to understand full context around matches.`,`grep should use precise patterns; prefer regex alternation for multiple candidates rather than many separate searches.`].join(`
|