dal-code 1.0.25 → 1.0.26

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 (154) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/NOTICE +7 -0
  3. package/dal-docs/README.md +13 -0
  4. package/dist/cli/args.d.ts +3 -0
  5. package/dist/cli/args.js +14 -14
  6. package/dist/core/agent-session-services.d.ts +2 -0
  7. package/dist/core/agent-session-services.js +1 -1
  8. package/dist/core/agent-session.d.ts +14 -1
  9. package/dist/core/agent-session.js +8 -7
  10. package/dist/core/background-processes.d.ts +73 -0
  11. package/dist/core/background-processes.js +7 -0
  12. package/dist/core/extensions/index.d.ts +1 -1
  13. package/dist/core/extensions/loader.js +1 -1
  14. package/dist/core/extensions/permission-surface.js +1 -1
  15. package/dist/core/extensions/runner.js +1 -1
  16. package/dist/core/extensions/types.d.ts +3 -0
  17. package/dist/core/host-capabilities.d.ts +50 -0
  18. package/dist/core/host-capabilities.js +2 -0
  19. package/dist/core/permissions/rules.d.ts +45 -0
  20. package/dist/core/permissions/rules.js +1 -0
  21. package/dist/core/permissions/shell-words.js +2 -0
  22. package/dist/core/permissions/tool-policy.d.ts +46 -0
  23. package/dist/core/permissions/tool-policy.js +1 -0
  24. package/dist/core/sandbox/availability.d.ts +9 -0
  25. package/dist/core/sandbox/availability.js +1 -0
  26. package/dist/core/sandbox/denial.d.ts +25 -0
  27. package/dist/core/sandbox/denial.js +3 -0
  28. package/dist/core/sandbox/index.d.ts +5 -0
  29. package/dist/core/sandbox/index.js +1 -0
  30. package/dist/core/sandbox/policy.d.ts +66 -0
  31. package/dist/core/sandbox/policy.js +1 -0
  32. package/dist/core/sandbox/runtime.d.ts +31 -0
  33. package/dist/core/sandbox/runtime.js +1 -0
  34. package/dist/core/sandbox/shell-sandbox.d.ts +119 -0
  35. package/dist/core/sandbox/shell-sandbox.js +5 -0
  36. package/dist/core/sdk.d.ts +3 -0
  37. package/dist/core/sdk.js +1 -1
  38. package/dist/core/settings-manager.d.ts +20 -0
  39. package/dist/core/settings-manager.js +1 -1
  40. package/dist/core/tools/bash.d.ts +15 -1
  41. package/dist/core/tools/bash.js +16 -14
  42. package/dist/core/tools/find.js +11 -11
  43. package/dist/core/tools/grep.js +10 -10
  44. package/dist/core/tools/index.d.ts +1 -0
  45. package/dist/core/tools/index.js +1 -1
  46. package/dist/core/tools/ls.js +6 -6
  47. package/dist/core/tools/powershell.d.ts +1 -1
  48. package/dist/core/tools/powershell.js +2 -2
  49. package/dist/core/tools/process.d.ts +26 -0
  50. package/dist/core/tools/process.js +22 -0
  51. package/dist/core/tools/read.js +15 -15
  52. package/dist/dal/builtins.js +2 -2
  53. package/dist/dal/child-env.js +1 -1
  54. package/dist/dal/manifest.d.ts +32 -0
  55. package/dist/dal/manifest.js +1 -0
  56. package/dist/index.d.ts +8 -3
  57. package/dist/index.js +1 -1
  58. package/dist/main.js +4 -4
  59. package/dist/modes/index.d.ts +2 -2
  60. package/dist/modes/print-mode.js +6 -4
  61. package/dist/modes/rpc/rpc-client.d.ts +24 -1
  62. package/dist/modes/rpc/rpc-client.js +4 -1
  63. package/dist/modes/rpc/rpc-mode.js +1 -1
  64. package/dist/modes/rpc/rpc-types.d.ts +82 -0
  65. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  66. package/dist/node_modules/@dalcode/dal-bridge/src/index.js +1 -1
  67. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  68. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  69. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  70. package/dist/node_modules/@dalcode/dal-interactive/LICENSE +21 -0
  71. package/dist/node_modules/@dalcode/dal-interactive/package.json +33 -0
  72. package/dist/node_modules/@dalcode/dal-interactive/src/handoff.js +28 -0
  73. package/dist/node_modules/@dalcode/dal-interactive/src/index.js +1 -0
  74. package/dist/node_modules/@dalcode/dal-interactive/src/interactive-shell.js +1 -0
  75. package/dist/node_modules/@dalcode/dal-interactive/src/questionnaire.js +3 -0
  76. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  77. package/dist/node_modules/@dalcode/dal-lsp/package.json +3 -3
  78. package/dist/node_modules/@dalcode/dal-mcp/package.json +5 -5
  79. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  80. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +2 -2
  81. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  82. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +2 -2
  83. package/dist/node_modules/@dalcode/dal-plugins/package.json +2 -2
  84. package/dist/node_modules/@dalcode/dal-review/LICENSE +21 -0
  85. package/dist/node_modules/@dalcode/dal-review/package.json +34 -0
  86. package/dist/node_modules/@dalcode/dal-review/src/args.d.ts +13 -0
  87. package/dist/node_modules/@dalcode/dal-review/src/args.js +1 -0
  88. package/dist/node_modules/@dalcode/dal-review/src/core.d.ts +6 -0
  89. package/dist/node_modules/@dalcode/dal-review/src/core.js +1 -0
  90. package/dist/node_modules/@dalcode/dal-review/src/findings.d.ts +23 -0
  91. package/dist/node_modules/@dalcode/dal-review/src/findings.js +4 -0
  92. package/dist/node_modules/@dalcode/dal-review/src/index.js +1 -0
  93. package/dist/node_modules/@dalcode/dal-review/src/prompt.d.ts +3 -0
  94. package/dist/node_modules/@dalcode/dal-review/src/prompt.js +29 -0
  95. package/dist/node_modules/@dalcode/dal-review/src/runner.d.ts +91 -0
  96. package/dist/node_modules/@dalcode/dal-review/src/runner.js +2 -0
  97. package/dist/node_modules/@dalcode/dal-review/src/targets.d.ts +33 -0
  98. package/dist/node_modules/@dalcode/dal-review/src/targets.js +17 -0
  99. package/dist/node_modules/@dalcode/dal-review/src/types.d.ts +94 -0
  100. package/dist/node_modules/@dalcode/dal-review/src/types.js +1 -0
  101. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  102. package/dist/node_modules/@dalcode/dal-router/package.json +4 -4
  103. package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
  104. package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
  105. package/dist/node_modules/@dalcode/dal-subagent/src/agents.js +2 -2
  106. package/dist/node_modules/@dalcode/dal-subagent/src/index.js +12 -12
  107. package/dist/node_modules/@dalcode/dal-subagent/src/process-runner.js +3 -3
  108. package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
  109. package/dist/node_modules/@dalcode/dal-terminal/LICENSE +21 -0
  110. package/dist/node_modules/@dalcode/dal-terminal/package.json +33 -0
  111. package/dist/node_modules/@dalcode/dal-terminal/src/contract.d.ts +60 -0
  112. package/dist/node_modules/@dalcode/dal-terminal/src/contract.js +7 -0
  113. package/dist/node_modules/@dalcode/dal-terminal/src/index.js +6 -0
  114. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  115. package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
  116. package/dist/node_modules/@dalcode/dal-web/src/config.js +2 -2
  117. package/dist/node_modules/@dalcode/dal-web/src/index.js +4 -4
  118. package/dist/node_modules/@dalcode/dal-web/src/search.js +4 -4
  119. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  120. package/dist/node_modules/@dalcode/dal-workflow/src/index.js +4 -4
  121. package/dist/node_modules/@dalcode/dal-workflow/src/plan-mode.js +13 -13
  122. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  123. package/dist/node_modules/@earendil-works/chord/package.json +1 -1
  124. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +4 -0
  125. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +1 -1
  126. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +4 -4
  127. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  128. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  129. package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
  130. package/dist/node_modules/@earendil-works/pi-client/package.json +3 -3
  131. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  132. package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
  133. package/dist/node_modules/@earendil-works/pi-server/package.json +5 -5
  134. package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/package.json +3 -3
  135. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  136. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  137. package/dist/sdk/index.d.ts +6 -2
  138. package/dist/sdk/index.js +1 -1
  139. package/dist/sdk/review.d.ts +1 -0
  140. package/dist/sdk/review.js +1 -0
  141. package/dist/sdk/subagents.d.ts +8 -0
  142. package/dist/sdk/subagents.js +1 -0
  143. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  144. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  145. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  146. package/examples/extensions/gondolin/package-lock.json +2 -2
  147. package/examples/extensions/gondolin/package.json +1 -1
  148. package/examples/extensions/sandbox/index.ts +6 -0
  149. package/examples/extensions/sandbox/package-lock.json +2 -2
  150. package/examples/extensions/sandbox/package.json +1 -1
  151. package/examples/extensions/with-deps/package-lock.json +2 -2
  152. package/examples/extensions/with-deps/package.json +1 -1
  153. package/npm-shrinkwrap.json +75 -5
  154. package/package.json +6 -1
@@ -1,13 +1,13 @@
1
- var mt=Object.defineProperty;var i=(n,o)=>mt(n,"name",{value:o,configurable:!0});import{readFile as ht,stat as gt}from"node:fs/promises";import{createInterface as xt}from"node:readline";import{Text as ot}from"@earendil-works/pi-tui";import{spawn as Tt}from"child_process";import it from"path";import{Type as a}from"typebox";import{fill as v,t as b}from"../../dal/i18n.js";import{keyHint as $t}from"../../modes/interactive/components/keybinding-hints.js";import{ensureTool as bt}from"../../utils/tools-manager.js";import{resolveToCwd as wt}from"./path-utils.js";import{countOutputLines as yt,formatCollapsedSummary as Lt,getTextOutput as at,invalidArgText as Ot,shortenPath as Et,str as B}from"./render-utils.js";import{wrapToolDefinition as St}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as I,formatSize as st,GREP_MAX_LINE_LENGTH as ct,truncateHead as vt,truncateLine as lt}from"./truncate.js";const Ct=a.Object({pattern:a.String({description:"Search pattern (regex or literal string)"}),path:a.Optional(a.String({description:"Directory or file to search (default: current directory)"})),glob:a.Optional(a.String({description:"Filter files by glob pattern, e.g. '*.ts' or '**/*.spec.ts'"})),ignoreCase:a.Optional(a.Boolean({description:"Case-insensitive search (default: false)"})),literal:a.Optional(a.Boolean({description:"Treat pattern as literal string instead of regex (default: false)"})),context:a.Optional(a.Number({description:"Number of lines to show before and after each match (default: 0)"})),limit:a.Optional(a.Number({description:"Maximum number of matches to return (default: 100)"}))}),Mt={snippet:"Search file contents for patterns (respects .gitignore)",guidelines:[]},pt=100,_t={isDirectory:i(async n=>(await gt(n)).isDirectory(),"isDirectory"),readFile:i(n=>ht(n,"utf-8"),"readFile")};function Dt(n,o){const f=B(n?.pattern),d=B(n?.path),m=d!==null?Et(d||"."):null,c=B(n?.glob),r=n?.limit,l=Ot(o);let x=o.fg("toolTitle",o.bold("grep"))+" "+(f===null?l:o.fg("accent",`/${f||""}/`))+o.fg("toolOutput",v(b(" \u4F4D\u4E8E {path}"),{path:m===null?l:m}));return c&&(x+=o.fg("toolOutput",` (${c})`)),r!==void 0&&(x+=o.fg("toolOutput",` limit ${r}`)),x}i(Dt,"formatGrepCall");function Ft(n,o,f,d,m){if(!o.expanded&&!m){const s=yt(at(n,d));return Lt(f,s>0?[v(b("{count} \u884C"),{count:s})]:[])}const c=at(n,d).trim();let r="";if(c){const s=c.split(`
2
- `),O=o.expanded?s.length:15,z=s.slice(0,O),D=s.length-O;r+=`
3
- ${z.map(F=>f.fg("toolOutput",F)).join(`
4
- `)}`,D>0&&(r+=`${f.fg("muted",`
5
- ${v(b("... (\u8FD8\u6709 {count} \u884C\uFF0C"),{count:D})}`)} ${$t("app.tools.expand",b("\u5373\u53EF\u5C55\u5F00"))}${f.fg("muted",")")}`)}const l=n.details?.matchLimitReached,x=n.details?.truncation,L=n.details?.linesTruncated;if(l||x?.truncated||L){const s=[];l&&s.push(v(b("\u4E0A\u9650 {count} \u5904\u5339\u914D"),{count:l})),x?.truncated&&s.push(v(b("\u4E0A\u9650 {size}"),{size:st(x.maxBytes??I)})),L&&s.push(b("\u90E8\u5206\u884C\u88AB\u622A\u65AD")),r+=`
6
- ${f.fg("warning",v(b("[\u5DF2\u622A\u65AD\uFF1A{reasons}]"),{reasons:s.join(", ")}))}`}return r}i(Ft,"formatGrepResult");function Pt(n,o){const f=o?.operations;return{name:"grep",label:"grep",description:`Search file contents for a pattern. Returns matching lines with file paths and line numbers. Respects .gitignore. Output is truncated to ${pt} matches or ${I/1024}KB (whichever is hit first). Long lines are truncated to ${ct} chars.`,promptSnippet:Mt.snippet,parameters:Ct,async execute(d,{pattern:m,path:c,glob:r,ignoreCase:l,literal:x,context:L,limit:s},O,z,D){return new Promise((F,w)=>{if(O?.aborted){w(new Error("Operation aborted"));return}let U=!1;const $=i(E=>{U||(U=!0,E())},"settle");(async()=>{try{const E=await bt("rg");if(!E){$(()=>w(new Error("ripgrep (rg) is not available and could not be downloaded")));return}const P=wt(c||".",D?.cwd||n),H=f??_t;let X;try{X=await H.isDirectory(P)}catch{$(()=>w(new Error(`Path not found: ${P}`)));return}const C=L&&L>0?L:0,M=Math.max(1,s??pt),j=i(e=>{if(X){const t=it.relative(P,e);if(t&&!t.startsWith(".."))return t.replace(/\\/g,"/")}return it.basename(e)},"formatPath"),J=new Map,ut=i(async e=>{let t=J.get(e);if(!t){try{t=(await H.readFile(e)).replace(/\r\n/g,`
1
+ var gt=Object.defineProperty;var i=(n,o)=>gt(n,"name",{value:o,configurable:!0});import{readFile as xt,stat as Tt}from"node:fs/promises";import{createInterface as wt}from"node:readline";import{Text as at}from"@earendil-works/pi-tui";import{spawn as $t}from"child_process";import B from"path";import{Type as a}from"typebox";import{fill as C,t as b}from"../../dal/i18n.js";import{keyHint as bt}from"../../modes/interactive/components/keybinding-hints.js";import{ensureTool as yt}from"../../utils/tools-manager.js";import{readAccessDenial as st}from"../permissions/tool-policy.js";import{resolveToCwd as Lt}from"./path-utils.js";import{countOutputLines as Ot,formatCollapsedSummary as Et,getTextOutput as ct,invalidArgText as St,shortenPath as vt,str as I}from"./render-utils.js";import{wrapToolDefinition as Ct}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as z,formatSize as lt,GREP_MAX_LINE_LENGTH as pt,truncateHead as Dt,truncateLine as ut}from"./truncate.js";const Mt=a.Object({pattern:a.String({description:"Search pattern (regex or literal string)"}),path:a.Optional(a.String({description:"Directory or file to search (default: current directory)"})),glob:a.Optional(a.String({description:"Filter files by glob pattern, e.g. '*.ts' or '**/*.spec.ts'"})),ignoreCase:a.Optional(a.Boolean({description:"Case-insensitive search (default: false)"})),literal:a.Optional(a.Boolean({description:"Treat pattern as literal string instead of regex (default: false)"})),context:a.Optional(a.Number({description:"Number of lines to show before and after each match (default: 0)"})),limit:a.Optional(a.Number({description:"Maximum number of matches to return (default: 100)"}))}),_t={snippet:"Search file contents for patterns (respects .gitignore)",guidelines:[]},ft=100,At={isDirectory:i(async n=>(await Tt(n)).isDirectory(),"isDirectory"),readFile:i(n=>xt(n,"utf-8"),"readFile")};function Ft(n,o){const l=I(n?.pattern),d=I(n?.path),m=d!==null?vt(d||"."):null,p=I(n?.glob),r=n?.limit,u=St(o);let x=o.fg("toolTitle",o.bold("grep"))+" "+(l===null?u:o.fg("accent",`/${l||""}/`))+o.fg("toolOutput",C(b(" \u4F4D\u4E8E {path}"),{path:m===null?u:m}));return p&&(x+=o.fg("toolOutput",` (${p})`)),r!==void 0&&(x+=o.fg("toolOutput",` limit ${r}`)),x}i(Ft,"formatGrepCall");function Pt(n,o,l,d,m){if(!o.expanded&&!m){const s=Ot(ct(n,d));return Et(l,s>0?[C(b("{count} \u884C"),{count:s})]:[])}const p=ct(n,d).trim();let r="";if(p){const s=p.split(`
2
+ `),O=o.expanded?s.length:15,U=s.slice(0,O),F=s.length-O;r+=`
3
+ ${U.map(P=>l.fg("toolOutput",P)).join(`
4
+ `)}`,F>0&&(r+=`${l.fg("muted",`
5
+ ${C(b("... (\u8FD8\u6709 {count} \u884C\uFF0C"),{count:F})}`)} ${bt("app.tools.expand",b("\u5373\u53EF\u5C55\u5F00"))}${l.fg("muted",")")}`)}const u=n.details?.matchLimitReached,x=n.details?.truncation,L=n.details?.linesTruncated;if(u||x?.truncated||L){const s=[];u&&s.push(C(b("\u4E0A\u9650 {count} \u5904\u5339\u914D"),{count:u})),x?.truncated&&s.push(C(b("\u4E0A\u9650 {size}"),{size:lt(x.maxBytes??z)})),L&&s.push(b("\u90E8\u5206\u884C\u88AB\u622A\u65AD")),r+=`
6
+ ${l.fg("warning",C(b("[\u5DF2\u622A\u65AD\uFF1A{reasons}]"),{reasons:s.join(", ")}))}`}return r}i(Pt,"formatGrepResult");function Rt(n,o){const l=o?.operations;return{name:"grep",label:"grep",description:`Search file contents for a pattern. Returns matching lines with file paths and line numbers. Respects .gitignore. Output is truncated to ${ft} matches or ${z/1024}KB (whichever is hit first). Long lines are truncated to ${pt} chars.`,promptSnippet:_t.snippet,parameters:Mt,async execute(d,{pattern:m,path:p,glob:r,ignoreCase:u,literal:x,context:L,limit:s},O,U,F){return new Promise((P,$)=>{if(O?.aborted){$(new Error("Operation aborted"));return}let H=!1;const T=i(E=>{H||(H=!0,E())},"settle");(async()=>{try{const E=await yt("rg");if(!E){T(()=>$(new Error("ripgrep (rg) is not available and could not be downloaded")));return}const S=Lt(p||".",F?.cwd||n),X=l??At,J=l?void 0:st(S);if(J){T(()=>$(new Error(J)));return}let K;try{K=await X.isDirectory(S)}catch{T(()=>$(new Error(`Path not found: ${S}`)));return}const D=L&&L>0?L:0,M=Math.max(1,s??ft),V=i(e=>{if(K){const t=B.relative(S,e);if(t&&!t.startsWith(".."))return t.replace(/\\/g,"/")}return B.basename(e)},"formatPath"),W=new Map,dt=i(async e=>{let t=W.get(e);if(!t){try{t=(await X.readFile(e)).replace(/\r\n/g,`
7
7
  `).replace(/\r/g,`
8
8
  `).split(`
9
- `)}catch{t=[]}J.set(e,t)}return t},"getFileLines"),_=["--json","--line-number","--color=never","--hidden"];l&&_.push("--ignore-case"),x&&_.push("--fixed-strings"),r&&_.push("--glob",r),_.push("--",m,P);const S=Tt(E,_,{stdio:["ignore","pipe","pipe"]}),K=xt({input:S.stdout});let V="",R=0,W=!1,A=!1,Y=!1,q=!1;const k=[],Q=i(()=>{K.close(),O?.removeEventListener("abort",tt)},"cleanup"),Z=i((e=!1)=>{S.killed||(q=e,S.kill())},"stopChild"),tt=i(()=>{Y=!0,Z()},"onAbort");O?.addEventListener("abort",tt,{once:!0}),S.stderr?.on("data",e=>{V+=e.toString()});const ft=i(async(e,t)=>{const p=j(e),T=await ut(e);if(!T.length)return[`${p}:${t}: (unable to read file)`];const u=[],y=C>0?Math.max(1,t-C):t,h=C>0?Math.min(T.length,t+C):t;for(let g=y;g<=h;g++){const G=(T[g-1]??"").replace(/\r/g,""),N=g===t,{text:rt,wasTruncated:dt}=lt(G);dt&&(A=!0),N?u.push(`${p}:${g}: ${rt}`):u.push(`${p}-${g}- ${rt}`)}return u},"formatBlock"),et=[];K.on("line",e=>{if(!e.trim()||R>=M)return;let t;try{t=JSON.parse(e)}catch{return}if(t.type==="match"){R++;const p=t.data?.path?.text,T=t.data?.line_number,u=t.data?.lines?.text;p&&typeof T=="number"&&et.push({filePath:p,lineNumber:T,lineText:u}),R>=M&&(W=!0,Z(!0))}}),S.on("error",e=>{Q(),$(()=>w(new Error(`Failed to run ripgrep: ${e.message}`)))}),S.on("close",async e=>{if(Q(),Y){$(()=>w(new Error("Operation aborted")));return}if(!q&&e!==0&&e!==1){const h=V.trim()||`ripgrep exited with code ${e}`;$(()=>w(new Error(h)));return}if(R===0){$(()=>F({content:[{type:"text",text:"No matches found"}],details:void 0}));return}for(const h of et)if(C===0&&h.lineText!==void 0){const g=j(h.filePath),nt=h.lineText.replace(/\r\n/g,`
10
- `).replace(/\r/g,"").replace(/\n$/,""),{text:G,wasTruncated:N}=lt(nt);N&&(A=!0),k.push(`${g}:${h.lineNumber}: ${G}`)}else{const g=await ft(h.filePath,h.lineNumber);k.push(...g)}const t=k.join(`
11
- `),p=vt(t,{maxLines:Number.MAX_SAFE_INTEGER});let T=p.content;const u={},y=[];W&&(y.push(`${M} matches limit reached. Use limit=${M*2} for more, or refine pattern`),u.matchLimitReached=M),p.truncated&&(y.push(`${st(I)} limit reached`),u.truncation=p),A&&(y.push(`Some lines truncated to ${ct} chars. Use read tool to see full lines`),u.linesTruncated=!0),y.length>0&&(T+=`
9
+ `)}catch{t=[]}W.set(e,t)}return t},"getFileLines"),_=["--json","--line-number","--color=never","--hidden"];u&&_.push("--ignore-case"),x&&_.push("--fixed-strings"),r&&_.push("--glob",r),_.push("--",m,S);const v=$t(E,_,{stdio:["ignore","pipe","pipe"]}),Y=wt({input:v.stdout});let j="",A=0,q=!1,R=!1,Q=!1,Z=!1;const k=[],tt=i(()=>{Y.close(),O?.removeEventListener("abort",nt)},"cleanup"),et=i((e=!1)=>{v.killed||(Z=e,v.kill())},"stopChild"),nt=i(()=>{Q=!0,et()},"onAbort");O?.addEventListener("abort",nt,{once:!0}),v.stderr?.on("data",e=>{j+=e.toString()});const mt=i(async(e,t)=>{const c=V(e),w=await dt(e);if(!w.length)return[`${c}:${t}: (unable to read file)`];const f=[],y=D>0?Math.max(1,t-D):t,h=D>0?Math.min(w.length,t+D):t;for(let g=y;g<=h;g++){const G=(w[g-1]??"").replace(/\r/g,""),N=g===t,{text:it,wasTruncated:ht}=ut(G);ht&&(R=!0),N?f.push(`${c}:${g}: ${it}`):f.push(`${c}-${g}- ${it}`)}return f},"formatBlock"),rt=[];Y.on("line",e=>{if(!e.trim()||A>=M)return;let t;try{t=JSON.parse(e)}catch{return}if(t.type==="match"){A++;const c=t.data?.path?.text,w=t.data?.line_number,f=t.data?.lines?.text;if(c&&!l&&st(B.resolve(S,c))){A--;return}c&&typeof w=="number"&&rt.push({filePath:c,lineNumber:w,lineText:f}),A>=M&&(q=!0,et(!0))}}),v.on("error",e=>{tt(),T(()=>$(new Error(`Failed to run ripgrep: ${e.message}`)))}),v.on("close",async e=>{if(tt(),Q){T(()=>$(new Error("Operation aborted")));return}if(!Z&&e!==0&&e!==1){const h=j.trim()||`ripgrep exited with code ${e}`;T(()=>$(new Error(h)));return}if(A===0){T(()=>P({content:[{type:"text",text:"No matches found"}],details:void 0}));return}for(const h of rt)if(D===0&&h.lineText!==void 0){const g=V(h.filePath),ot=h.lineText.replace(/\r\n/g,`
10
+ `).replace(/\r/g,"").replace(/\n$/,""),{text:G,wasTruncated:N}=ut(ot);N&&(R=!0),k.push(`${g}:${h.lineNumber}: ${G}`)}else{const g=await mt(h.filePath,h.lineNumber);k.push(...g)}const t=k.join(`
11
+ `),c=Dt(t,{maxLines:Number.MAX_SAFE_INTEGER});let w=c.content;const f={},y=[];q&&(y.push(`${M} matches limit reached. Use limit=${M*2} for more, or refine pattern`),f.matchLimitReached=M),c.truncated&&(y.push(`${lt(z)} limit reached`),f.truncation=c),R&&(y.push(`Some lines truncated to ${pt} chars. Use read tool to see full lines`),f.linesTruncated=!0),y.length>0&&(w+=`
12
12
 
13
- [${y.join(". ")}]`),$(()=>F({content:[{type:"text",text:T}],details:Object.keys(u).length>0?u:void 0}))})}catch(E){$(()=>w(E))}})()})},renderCall(d,m,c){const r=c.lastComponent??new ot("",0,0);return r.setText(Dt(d,m)),r},renderResult(d,m,c,r){const l=r.lastComponent??new ot("",0,0);return l.setText(Ft(d,m,c,r.showImages,r.isError)),l}}}i(Pt,"createGrepToolDefinition");function Vt(n,o){return St(Pt(n,o))}i(Vt,"createGrepTool");export{Vt as createGrepTool,Pt as createGrepToolDefinition,Mt as grepToolSystemPromptContribution};
13
+ [${y.join(". ")}]`),T(()=>P({content:[{type:"text",text:w}],details:Object.keys(f).length>0?f:void 0}))})}catch(E){T(()=>$(E))}})()})},renderCall(d,m,p){const r=p.lastComponent??new at("",0,0);return r.setText(Ft(d,m)),r},renderResult(d,m,p,r){const u=r.lastComponent??new at("",0,0);return u.setText(Pt(d,m,p,r.showImages,r.isError)),u}}}i(Rt,"createGrepToolDefinition");function qt(n,o){return Ct(Rt(n,o))}i(qt,"createGrepTool");export{qt as createGrepTool,Rt as createGrepToolDefinition,_t as grepToolSystemPromptContribution};
@@ -5,6 +5,7 @@ export { createFindTool, createFindToolDefinition, type FindOperations, type Fin
5
5
  export { createGrepTool, createGrepToolDefinition, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, } from "./grep.ts";
6
6
  export { createLsTool, createLsToolDefinition, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, } from "./ls.ts";
7
7
  export { createLocalPowerShellOperations, createPowerShellTool, createPowerShellToolDefinition, type PowerShellOperations, type PowerShellSpawnContext, type PowerShellSpawnHook, type PowerShellToolDetails, type PowerShellToolInput, type PowerShellToolOptions, } from "./powershell.ts";
8
+ export { createProcessToolDefinition, type ProcessToolDetails, type ProcessToolInput } from "./process.ts";
8
9
  export { createReadTool, createReadToolDefinition, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, } from "./read.ts";
9
10
  export { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, } from "./truncate.ts";
10
11
  export { createWriteTool, createWriteToolDefinition, type WriteOperations, type WriteToolInput, type WriteToolOptions, } from "./write.ts";
@@ -1 +1 @@
1
- var b=Object.defineProperty;var a=(r,e)=>b(r,"name",{value:e,configurable:!0});import{createBashTool as H,createBashToolDefinition as I,createLocalBashOperations as Q,registerShellExecutionGuard as Y}from"./bash.js";import{createEditTool as q,createEditToolDefinition as v}from"./edit.js";import{withFileMutationQueue as K}from"./file-mutation-queue.js";import{createFindTool as V,createFindToolDefinition as Z}from"./find.js";import{createGrepTool as ee,createGrepToolDefinition as re}from"./grep.js";import{createLsTool as ae,createLsToolDefinition as oe}from"./ls.js";import{createLocalPowerShellOperations as ie,createPowerShellTool as ne,createPowerShellToolDefinition as fe}from"./powershell.js";import{createReadTool as ue,createReadToolDefinition as he}from"./read.js";import{DEFAULT_MAX_BYTES as se,DEFAULT_MAX_LINES as me,formatSize as De,truncateHead as xe,truncateLine as de,truncateTail as ge}from"./truncate.js";import{createWriteTool as be,createWriteToolDefinition as Ee}from"./write.js";import{createBashTool as i,createBashToolDefinition as n}from"./bash.js";import{createEditTool as f,createEditToolDefinition as T}from"./edit.js";import{createFindTool as u,createFindToolDefinition as h}from"./find.js";import{createGrepTool as c,createGrepToolDefinition as s}from"./grep.js";import{createLsTool as m,createLsToolDefinition as D}from"./ls.js";import{createPowerShellTool as g,createPowerShellToolDefinition as p}from"./powershell.js";import{createReadTool as o,createReadToolDefinition as l}from"./read.js";import{createWriteTool as x,createWriteToolDefinition as d}from"./write.js";const O=new Set(["read","bash","powershell","edit","write","grep","find","ls"]);function U(r,e,t){switch(r){case"read":return l(e,t?.read);case"bash":return n(e,t?.bash);case"powershell":return p(e,t?.powershell);case"edit":return T(e,t?.edit);case"write":return d(e,t?.write);case"grep":return s(e,t?.grep);case"find":return h(e,t?.find);case"ls":return D(e,t?.ls);default:throw new Error(`Unknown tool name: ${r}`)}}a(U,"createToolDefinition");function W(r,e,t){switch(r){case"read":return o(e,t?.read);case"bash":return i(e,t?.bash);case"powershell":return g(e,t?.powershell);case"edit":return f(e,t?.edit);case"write":return x(e,t?.write);case"grep":return c(e,t?.grep);case"find":return u(e,t?.find);case"ls":return m(e,t?.ls);default:throw new Error(`Unknown tool name: ${r}`)}}a(W,"createTool");function _(r,e){return[l(r,e?.read),n(r,e?.bash),T(r,e?.edit),d(r,e?.write)]}a(_,"createCodingToolDefinitions");function M(r,e){return[l(r,e?.read),s(r,e?.grep),h(r,e?.find),D(r,e?.ls)]}a(M,"createReadOnlyToolDefinitions");function k(r,e){return{read:l(r,e?.read),bash:n(r,e?.bash),powershell:p(r,e?.powershell),edit:T(r,e?.edit),write:d(r,e?.write),grep:s(r,e?.grep),find:h(r,e?.find),ls:D(r,e?.ls)}}a(k,"createAllToolDefinitions");function y(r,e){return[o(r,e?.read),i(r,e?.bash),f(r,e?.edit),x(r,e?.write)]}a(y,"createCodingTools");function C(r,e){return[o(r,e?.read),c(r,e?.grep),u(r,e?.find),m(r,e?.ls)]}a(C,"createReadOnlyTools");function X(r,e){return{read:o(r,e?.read),bash:i(r,e?.bash),powershell:g(r,e?.powershell),edit:f(r,e?.edit),write:x(r,e?.write),grep:c(r,e?.grep),find:u(r,e?.find),ls:m(r,e?.ls)}}a(X,"createAllTools");export{se as DEFAULT_MAX_BYTES,me as DEFAULT_MAX_LINES,O as allToolNames,k as createAllToolDefinitions,X as createAllTools,H as createBashTool,I as createBashToolDefinition,_ as createCodingToolDefinitions,y as createCodingTools,q as createEditTool,v as createEditToolDefinition,V as createFindTool,Z as createFindToolDefinition,ee as createGrepTool,re as createGrepToolDefinition,Q as createLocalBashOperations,ie as createLocalPowerShellOperations,ae as createLsTool,oe as createLsToolDefinition,ne as createPowerShellTool,fe as createPowerShellToolDefinition,M as createReadOnlyToolDefinitions,C as createReadOnlyTools,ue as createReadTool,he as createReadToolDefinition,W as createTool,U as createToolDefinition,be as createWriteTool,Ee as createWriteToolDefinition,De as formatSize,Y as registerShellExecutionGuard,xe as truncateHead,de as truncateLine,ge as truncateTail,K as withFileMutationQueue};
1
+ var b=Object.defineProperty;var o=(r,e)=>b(r,"name",{value:e,configurable:!0});import{createBashTool as H,createBashToolDefinition as I,createLocalBashOperations as Q,registerShellExecutionGuard as Y}from"./bash.js";import{createEditTool as q,createEditToolDefinition as v}from"./edit.js";import{withFileMutationQueue as K}from"./file-mutation-queue.js";import{createFindTool as V,createFindToolDefinition as Z}from"./find.js";import{createGrepTool as ee,createGrepToolDefinition as re}from"./grep.js";import{createLsTool as oe,createLsToolDefinition as ae}from"./ls.js";import{createLocalPowerShellOperations as le,createPowerShellTool as ne,createPowerShellToolDefinition as fe}from"./powershell.js";import{createProcessToolDefinition as ue}from"./process.js";import{createReadTool as he,createReadToolDefinition as se}from"./read.js";import{DEFAULT_MAX_BYTES as De,DEFAULT_MAX_LINES as xe,formatSize as de,truncateHead as ge,truncateLine as pe,truncateTail as be}from"./truncate.js";import{createWriteTool as Le,createWriteToolDefinition as Se}from"./write.js";import{createBashTool as l,createBashToolDefinition as n}from"./bash.js";import{createEditTool as f,createEditToolDefinition as T}from"./edit.js";import{createFindTool as u,createFindToolDefinition as c}from"./find.js";import{createGrepTool as h,createGrepToolDefinition as s}from"./grep.js";import{createLsTool as m,createLsToolDefinition as D}from"./ls.js";import{createPowerShellTool as g,createPowerShellToolDefinition as p}from"./powershell.js";import{createReadTool as a,createReadToolDefinition as i}from"./read.js";import{createWriteTool as x,createWriteToolDefinition as d}from"./write.js";const O=new Set(["read","bash","powershell","edit","write","grep","find","ls"]);function U(r,e,t){switch(r){case"read":return i(e,t?.read);case"bash":return n(e,t?.bash);case"powershell":return p(e,t?.powershell);case"edit":return T(e,t?.edit);case"write":return d(e,t?.write);case"grep":return s(e,t?.grep);case"find":return c(e,t?.find);case"ls":return D(e,t?.ls);default:throw new Error(`Unknown tool name: ${r}`)}}o(U,"createToolDefinition");function W(r,e,t){switch(r){case"read":return a(e,t?.read);case"bash":return l(e,t?.bash);case"powershell":return g(e,t?.powershell);case"edit":return f(e,t?.edit);case"write":return x(e,t?.write);case"grep":return h(e,t?.grep);case"find":return u(e,t?.find);case"ls":return m(e,t?.ls);default:throw new Error(`Unknown tool name: ${r}`)}}o(W,"createTool");function _(r,e){return[i(r,e?.read),n(r,e?.bash),T(r,e?.edit),d(r,e?.write)]}o(_,"createCodingToolDefinitions");function M(r,e){return[i(r,e?.read),s(r,e?.grep),c(r,e?.find),D(r,e?.ls)]}o(M,"createReadOnlyToolDefinitions");function k(r,e){return{read:i(r,e?.read),bash:n(r,e?.bash),powershell:p(r,e?.powershell),edit:T(r,e?.edit),write:d(r,e?.write),grep:s(r,e?.grep),find:c(r,e?.find),ls:D(r,e?.ls)}}o(k,"createAllToolDefinitions");function y(r,e){return[a(r,e?.read),l(r,e?.bash),f(r,e?.edit),x(r,e?.write)]}o(y,"createCodingTools");function C(r,e){return[a(r,e?.read),h(r,e?.grep),u(r,e?.find),m(r,e?.ls)]}o(C,"createReadOnlyTools");function X(r,e){return{read:a(r,e?.read),bash:l(r,e?.bash),powershell:g(r,e?.powershell),edit:f(r,e?.edit),write:x(r,e?.write),grep:h(r,e?.grep),find:u(r,e?.find),ls:m(r,e?.ls)}}o(X,"createAllTools");export{De as DEFAULT_MAX_BYTES,xe as DEFAULT_MAX_LINES,O as allToolNames,k as createAllToolDefinitions,X as createAllTools,H as createBashTool,I as createBashToolDefinition,_ as createCodingToolDefinitions,y as createCodingTools,q as createEditTool,v as createEditToolDefinition,V as createFindTool,Z as createFindToolDefinition,ee as createGrepTool,re as createGrepToolDefinition,Q as createLocalBashOperations,le as createLocalPowerShellOperations,oe as createLsTool,ae as createLsToolDefinition,ne as createPowerShellTool,fe as createPowerShellToolDefinition,ue as createProcessToolDefinition,M as createReadOnlyToolDefinitions,C as createReadOnlyTools,he as createReadTool,se as createReadToolDefinition,W as createTool,U as createToolDefinition,Le as createWriteTool,Se as createWriteToolDefinition,de as formatSize,Y as registerShellExecutionGuard,ge as truncateHead,pe as truncateLine,be as truncateTail,K as withFileMutationQueue};
@@ -1,9 +1,9 @@
1
- var I=Object.defineProperty;var m=(e,n)=>I(e,"name",{value:n,configurable:!0});import{readdir as k,stat as F}from"node:fs/promises";import{Text as R}from"@earendil-works/pi-tui";import M from"path";import{Type as L}from"typebox";import{fill as y,t as d}from"../../dal/i18n.js";import{keyHint as N}from"../../modes/interactive/components/keybinding-hints.js";import{pathExists as U,resolveToCwd as z}from"./path-utils.js";import{countOutputLines as B,formatCollapsedSummary as j,getTextOutput as v,renderToolPath as H,str as X}from"./render-utils.js";import{wrapToolDefinition as G}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as O,formatSize as P,truncateHead as K}from"./truncate.js";const Y=L.Object({path:L.Optional(L.String({description:"Directory to list (default: current directory)"})),limit:L.Optional(L.Number({description:"Maximum number of entries to return (default: 500)"}))}),q={snippet:"List directory contents",guidelines:[]},_=500,J={exists:U,stat:F,readdir:k};function Q(e,n,o){const a=e?.limit,c=H(X(e?.path),n,o,{emptyFallback:"."});let i=`${n.fg("toolTitle",n.bold("ls"))} ${c}`;return a!==void 0&&(i+=n.fg("toolOutput",y(d(" (\u4E0A\u9650 {limit})"),{limit:a}))),i}m(Q,"formatLsCall");function V(e,n,o,a,c){if(!n.expanded&&!c){const r=B(v(e,a));return j(o,r>0?[y(d("{count} \u884C"),{count:r})]:[])}const i=v(e,a).trim();let t="";if(i){const r=i.split(`
2
- `),u=n.expanded?r.length:20,x=r.slice(0,u),s=r.length-u;t+=`
1
+ var k=Object.defineProperty;var m=(n,e)=>k(n,"name",{value:e,configurable:!0});import{readdir as F,stat as M}from"node:fs/promises";import{Text as v}from"@earendil-works/pi-tui";import N from"path";import{Type as w}from"typebox";import{fill as y,t as d}from"../../dal/i18n.js";import{keyHint as U}from"../../modes/interactive/components/keybinding-hints.js";import{readAccessDenial as z}from"../permissions/tool-policy.js";import{pathExists as B,resolveToCwd as H}from"./path-utils.js";import{countOutputLines as X,formatCollapsedSummary as j,getTextOutput as A,renderToolPath as G,str as K}from"./render-utils.js";import{wrapToolDefinition as Y}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as O,formatSize as P,truncateHead as q}from"./truncate.js";const J=w.Object({path:w.Optional(w.String({description:"Directory to list (default: current directory)"})),limit:w.Optional(w.Number({description:"Maximum number of entries to return (default: 500)"}))}),Q={snippet:"List directory contents",guidelines:[]},_=500,V={exists:B,stat:M,readdir:F};function W(n,e,o){const a=n?.limit,u=G(K(n?.path),e,o,{emptyFallback:"."});let i=`${e.fg("toolTitle",e.bold("ls"))} ${u}`;return a!==void 0&&(i+=e.fg("toolOutput",y(d(" (\u4E0A\u9650 {limit})"),{limit:a}))),i}m(W,"formatLsCall");function Z(n,e,o,a,u){if(!e.expanded&&!u){const r=X(A(n,a));return j(o,r>0?[y(d("{count} \u884C"),{count:r})]:[])}const i=A(n,a).trim();let t="";if(i){const r=i.split(`
2
+ `),c=e.expanded?r.length:20,x=r.slice(0,c),s=r.length-c;t+=`
3
3
  ${x.map(p=>o.fg("toolOutput",p)).join(`
4
4
  `)}`,s>0&&(t+=`${o.fg("muted",`
5
- ${y(d("... (\u8FD8\u6709 {count} \u884C\uFF0C"),{count:s})}`)} ${N("app.tools.expand",d("\u5373\u53EF\u5C55\u5F00"))}${o.fg("muted",")")}`)}const l=e.details?.entryLimitReached,h=e.details?.truncation;if(l||h?.truncated){const r=[];l&&r.push(y(d("\u4E0A\u9650 {count} \u4E2A\u6761\u76EE"),{count:l})),h?.truncated&&r.push(y(d("\u4E0A\u9650 {size}"),{size:P(h.maxBytes??O)})),t+=`
6
- ${o.fg("warning",y(d("[\u5DF2\u622A\u65AD\uFF1A{reasons}]"),{reasons:r.join(", ")}))}`}return t}m(V,"formatLsResult");function W(e,n){const o=n?.operations??J;return{name:"ls",label:"ls",description:`List directory contents. Returns entries sorted alphabetically, with '/' suffix for directories. Includes dotfiles. Output is truncated to ${_} entries or ${O/1024}KB (whichever is hit first).`,promptSnippet:q.snippet,parameters:Y,async execute(a,{path:c,limit:i},t,l,h){return new Promise((r,u)=>{if(t?.aborted){u(new Error("Operation aborted"));return}const x=m(()=>u(new Error("Operation aborted")),"onAbort");t?.addEventListener("abort",x,{once:!0}),(async()=>{try{const s=z(c||".",h?.cwd||e),p=i??_;if(!await o.exists(s)){u(new Error(`Path not found: ${s}`));return}if(!(await o.stat(s)).isDirectory()){u(new Error(`Not a directory: ${s}`));return}let $;try{$=await o.readdir(s)}catch(f){u(new Error(`Cannot read directory: ${f.message}`));return}$.sort((f,g)=>f.toLowerCase().localeCompare(g.toLowerCase()));const w=[];let C=!1;for(const f of $){if(w.length>=p){C=!0;break}const g=M.join(s,f);let D="";try{(await o.stat(g)).isDirectory()&&(D="/")}catch{continue}w.push(f+D)}if(t?.removeEventListener("abort",x),w.length===0){r({content:[{type:"text",text:"(empty directory)"}],details:void 0});return}const A=w.join(`
7
- `),E=K(A,{maxLines:Number.MAX_SAFE_INTEGER});let S=E.content;const b={},T=[];C&&(T.push(`${p} entries limit reached. Use limit=${p*2} for more`),b.entryLimitReached=p),E.truncated&&(T.push(`${P(O)} limit reached`),b.truncation=E),T.length>0&&(S+=`
5
+ ${y(d("... (\u8FD8\u6709 {count} \u884C\uFF0C"),{count:s})}`)} ${U("app.tools.expand",d("\u5373\u53EF\u5C55\u5F00"))}${o.fg("muted",")")}`)}const l=n.details?.entryLimitReached,h=n.details?.truncation;if(l||h?.truncated){const r=[];l&&r.push(y(d("\u4E0A\u9650 {count} \u4E2A\u6761\u76EE"),{count:l})),h?.truncated&&r.push(y(d("\u4E0A\u9650 {size}"),{size:P(h.maxBytes??O)})),t+=`
6
+ ${o.fg("warning",y(d("[\u5DF2\u622A\u65AD\uFF1A{reasons}]"),{reasons:r.join(", ")}))}`}return t}m(Z,"formatLsResult");function tt(n,e){const o=e?.operations??V;return{name:"ls",label:"ls",description:`List directory contents. Returns entries sorted alphabetically, with '/' suffix for directories. Includes dotfiles. Output is truncated to ${_} entries or ${O/1024}KB (whichever is hit first).`,promptSnippet:Q.snippet,parameters:J,async execute(a,{path:u,limit:i},t,l,h){return new Promise((r,c)=>{if(t?.aborted){c(new Error("Operation aborted"));return}const x=m(()=>c(new Error("Operation aborted")),"onAbort");t?.addEventListener("abort",x,{once:!0}),(async()=>{try{const s=H(u||".",h?.cwd||n),p=i??_,C=e?.operations?void 0:z(s);if(C){c(new Error(C));return}if(!await o.exists(s)){c(new Error(`Path not found: ${s}`));return}if(!(await o.stat(s)).isDirectory()){c(new Error(`Not a directory: ${s}`));return}let T;try{T=await o.readdir(s)}catch(f){c(new Error(`Cannot read directory: ${f.message}`));return}T.sort((f,g)=>f.toLowerCase().localeCompare(g.toLowerCase()));const L=[];let S=!1;for(const f of T){if(L.length>=p){S=!0;break}const g=N.join(s,f);let R="";try{(await o.stat(g)).isDirectory()&&(R="/")}catch{continue}L.push(f+R)}if(t?.removeEventListener("abort",x),L.length===0){r({content:[{type:"text",text:"(empty directory)"}],details:void 0});return}const I=L.join(`
7
+ `),$=q(I,{maxLines:Number.MAX_SAFE_INTEGER});let D=$.content;const b={},E=[];S&&(E.push(`${p} entries limit reached. Use limit=${p*2} for more`),b.entryLimitReached=p),$.truncated&&(E.push(`${P(O)} limit reached`),b.truncation=$),E.length>0&&(D+=`
8
8
 
9
- [${T.join(". ")}]`),r({content:[{type:"text",text:S}],details:Object.keys(b).length>0?b:void 0})}catch(s){t?.removeEventListener("abort",x),u(s)}})()})},renderCall(a,c,i){const t=i.lastComponent??new R("",0,0);return t.setText(Q(a,c,i.cwd)),t},renderResult(a,c,i,t){const l=t.lastComponent??new R("",0,0);return l.setText(V(a,c,i,t.showImages,t.isError)),l}}}m(W,"createLsToolDefinition");function pt(e,n){return G(W(e,n))}m(pt,"createLsTool");export{pt as createLsTool,W as createLsToolDefinition,q as lsToolSystemPromptContribution};
9
+ [${E.join(". ")}]`),r({content:[{type:"text",text:D}],details:Object.keys(b).length>0?b:void 0})}catch(s){t?.removeEventListener("abort",x),c(s)}})()})},renderCall(a,u,i){const t=i.lastComponent??new v("",0,0);return t.setText(W(a,u,i.cwd)),t},renderResult(a,u,i,t){const l=t.lastComponent??new v("",0,0);return l.setText(Z(a,u,i,t.showImages,t.isError)),l}}}m(tt,"createLsToolDefinition");function yt(n,e){return Y(tt(n,e))}m(yt,"createLsTool");export{yt as createLsTool,tt as createLsToolDefinition,Q as lsToolSystemPromptContribution};
@@ -10,7 +10,7 @@ export type PowerShellSpawnContext = BashSpawnContext;
10
10
  export type PowerShellSpawnHook = BashSpawnHook;
11
11
  export type PowerShellToolDetails = BashToolDetails;
12
12
  export type PowerShellToolInput = BashToolInput;
13
- export interface PowerShellToolOptions extends Pick<BashToolOptions, "operations" | "exposeSessionEnvironment" | "spawnHook"> {
13
+ export interface PowerShellToolOptions extends Pick<BashToolOptions, "operations" | "exposeSessionEnvironment" | "spawnHook" | "sandbox"> {
14
14
  }
15
15
  export declare function createLocalPowerShellOperations(): PowerShellOperations;
16
16
  export declare function createPowerShellToolDefinition(cwd: string, options?: PowerShellToolOptions): ReturnType<typeof createShellToolDefinition>;
@@ -1,2 +1,2 @@
1
- var l=Object.defineProperty;var n=(o,e)=>l(o,"name",{value:e,configurable:!0});import{getPowerShellConfig as p}from"../../utils/shell.js";import{createLocalShellOperations as s,createShellToolDefinition as c}from"./bash.js";import{wrapToolDefinition as a}from"./tool-definition-wrapper.js";const m=`try { [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 } catch {}
2
- `,i={snippet:"Execute PowerShell commands",guidelines:["You can inspect PI_* environment variables for current model and session details."]};function u(){const o=s("PowerShell",p);return{exec:n((e,t,r)=>o.exec(`${m}${e}`,t,r),"exec")}}n(u,"createLocalPowerShellOperations");const h={name:"powershell",label:"powershell",shellName:"PowerShell",prompt:"PS>",promptSnippet:i.snippet,promptGuidelines:i.guidelines,tempFilePrefix:"pi-powershell"};function S(o,e){return c(o,h,{...e,operations:e?.operations??u()})}n(S,"createPowerShellToolDefinition");function T(o,e){const t=S(o,e),r=a(t);return Object.assign(r,{promptSnippet:t.promptSnippet,promptGuidelines:t.promptGuidelines}),r}n(T,"createPowerShellTool");export{u as createLocalPowerShellOperations,T as createPowerShellTool,S as createPowerShellToolDefinition,i as powershellToolSystemPromptContribution};
1
+ var l=Object.defineProperty;var n=(e,o)=>l(e,"name",{value:o,configurable:!0});import{getPowerShellConfig as p}from"../../utils/shell.js";import{createLocalShellOperations as s,createShellToolDefinition as c}from"./bash.js";import{wrapToolDefinition as a}from"./tool-definition-wrapper.js";const m=`try { [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 } catch {}
2
+ `,i={snippet:"Execute PowerShell commands",guidelines:["You can inspect PI_* environment variables for current model and session details."]};function u(){const e=s("PowerShell",p);return{exec:n((o,t,r)=>e.exec(`${m}${o}`,t,r),"exec")}}n(u,"createLocalPowerShellOperations");const h={name:"powershell",label:"powershell",shellName:"PowerShell",prompt:"PS>",promptSnippet:i.snippet,promptGuidelines:i.guidelines,tempFilePrefix:"pi-powershell",defaultOperations:u};function f(e,o){return c(e,h,o)}n(f,"createPowerShellToolDefinition");function T(e,o){const t=f(e,o),r=a(t);return Object.assign(r,{promptSnippet:t.promptSnippet,promptGuidelines:t.promptGuidelines}),r}n(T,"createPowerShellTool");export{u as createLocalPowerShellOperations,T as createPowerShellTool,f as createPowerShellToolDefinition,i as powershellToolSystemPromptContribution};
@@ -0,0 +1,26 @@
1
+ import { type Static, Type } from "typebox";
2
+ import type { BackgroundProcessInfo, BackgroundProcessManager } from "../background-processes.ts";
3
+ import type { ToolDefinition } from "../extensions/types.ts";
4
+ declare const processSchema: Type.TObject<{
5
+ action: Type.TUnion<[
6
+ Type.TLiteral<"start">,
7
+ Type.TLiteral<"output">,
8
+ Type.TLiteral<"status">,
9
+ Type.TLiteral<"stop">,
10
+ Type.TLiteral<"list">
11
+ ]>;
12
+ command: Type.TOptional<Type.TString>;
13
+ name: Type.TOptional<Type.TString>;
14
+ id: Type.TOptional<Type.TString>;
15
+ tail: Type.TOptional<Type.TNumber>;
16
+ wait_seconds: Type.TOptional<Type.TNumber>;
17
+ }>;
18
+ export type ProcessToolInput = Static<typeof processSchema>;
19
+ export interface ProcessToolDetails {
20
+ process?: BackgroundProcessInfo;
21
+ processes?: BackgroundProcessInfo[];
22
+ }
23
+ export declare function createProcessToolDefinition(cwd: string, manager: BackgroundProcessManager, options?: {
24
+ sandboxed?: boolean;
25
+ }): ToolDefinition<typeof processSchema, ProcessToolDetails | undefined>;
26
+ export {};
@@ -0,0 +1,22 @@
1
+ var L=Object.defineProperty;var l=(t,e)=>L(t,"name",{value:e,configurable:!0});import{ToolExecutionError as _}from"@earendil-works/pi-agent-core";import{Text as $}from"@earendil-works/pi-tui";import{Type as n}from"typebox";import{theme as x}from"../../modes/interactive/theme/theme.js";import{describeDenialForModel as g}from"../sandbox/denial.js";import{sandboxEscalationSchema as E}from"./bash.js";import{getTextOutput as U}from"./render-utils.js";import{truncateTail as k}from"./truncate.js";const S=n.Object({action:n.Union([n.Literal("start"),n.Literal("output"),n.Literal("status"),n.Literal("stop"),n.Literal("list")],{description:'"start" a command; read its "output" (new output since the last read, or the last `tail` lines); "status" (running?, exit code, listening ports); "stop" it; "list" all.'}),command:n.Optional(n.String({description:'Shell command to start (action "start")'})),name:n.Optional(n.String({description:'Short label, e.g. "dev server" (action "start")'})),id:n.Optional(n.String({description:'Process id returned by "start" (output / status / stop)'})),tail:n.Optional(n.Number({description:'Return the last N lines instead of new output (action "output")'})),wait_seconds:n.Optional(n.Number({description:'Seconds to wait before reporting, so a starting server can print its URL (start / output; default 2 for "start", max 30)'}))}),P=n.Object({...S.properties,sandbox_escalation:E}),j=400,v=32*1024;function p(t){const e=[`${t.id}${t.name?` (${t.name})`:""}: ${t.state}`];t.pid&&e.push(`pid ${t.pid}`),t.state!=="running"&&t.exitCode!==void 0&&e.push(`exit code ${t.exitCode??"none"}`),t.signal&&e.push(`signal ${t.signal}`),t.ports.length>0&&e.push(`ports ${t.ports.join(", ")}`),t.urls.length>0&&e.push(`urls ${t.urls.join(" ")}`),t.sandboxed&&e.push("sandboxed");const i=[e.join(", "),`command: ${t.command}`,`log: ${t.logFile}`];return t.sandboxed&&!t.portsReachableFromHost&&t.ports.length>0&&i.push("note: on Linux the sandbox gives the process its own network namespace; these ports are not reachable from outside the sandbox."),i.join(`
2
+ `)}l(p,"describe");function y(t,e){return new Promise(i=>{if(t<=0||e?.aborted)return i();const a=setTimeout(i,t);e?.addEventListener("abort",()=>{clearTimeout(a),i()},{once:!0})})}l(y,"sleep");function T(t,e){const i=typeof t=="number"&&Number.isFinite(t)&&t>=0?t:e;return Math.min(i,30)*1e3}l(T,"waitMs");function f(t){if(!t)return"(no new output)";const e=k(t,{maxLines:j,maxBytes:v});return e.truncated?`[showing the last ${e.outputLines} of ${e.totalLines} lines]
3
+ ${e.content}`:e.content}l(f,"limitOutput");function G(t,e,i={}){return{name:"process",label:"process",description:'Run long-lived commands in the background \u2014 dev servers, watchers, anything that does not exit by itself \u2014 and check on them later. "start" returns an id right away; use "output" to read what it printed, "status" to see whether it runs and which ports it listens on, "stop" to end it. Use bash, not this, for commands that finish. Processes are stopped when the session ends.'+(i.sandboxed?" Processes run in the same OS sandbox as bash; they may listen on localhost, but outbound network follows the sandbox rules.":""),promptSnippet:"Start and manage background processes (dev servers, watchers)",promptGuidelines:['Start dev servers and watchers with the process tool (action "start"), not bash: bash waits for the command to finish and kills it at its timeout.'],parameters:i.sandboxed?P:S,async execute(a,s,m,h,d){const r=s.action;if(r==="list"){const o=e.list();return{content:[{type:"text",text:o.length>0?o.map(p).join(`
4
+
5
+ `):"No background processes."}],details:{processes:o}}}if(r==="start"){const o=s.command?.trim();if(!o)throw new Error('action "start" needs a command');const b=await e.start({command:o,cwd:d?.cwd||t,...s.name?{name:s.name}:{},toolCallId:a,escalation:s.sandbox_escalation,ctx:d});await y(T(s.wait_seconds,2),m);const{text:w,info:c}=e.read(b.id);if(c.denial)throw new _(`${p(c)}
6
+
7
+ ${f(w)}
8
+
9
+ ${g(c.denial)}`,{process:c});return{content:[{type:"text",text:`Started.
10
+ ${p(c)}
11
+
12
+ Output so far:
13
+ ${f(w)}`}],details:{process:c}}}const u=s.id?.trim();if(!u)throw new Error(`action "${r}" needs the id returned by "start"`);if(r==="output"){await y(T(s.wait_seconds,0),m);const o=typeof s.tail=="number"&&s.tail>0?Math.floor(s.tail):void 0,{text:b,truncated:w,info:c}=e.read(u,o!==void 0?{tail:o}:{}),O=w?`
14
+ [earlier output is in ${c.logFile}]`:"";return{content:[{type:"text",text:`${p(c)}
15
+
16
+ ${f(b)}${O}`}],details:{process:c}}}if(r==="status"){const o=e.status(u),b=o.denial?`
17
+
18
+ ${g(o.denial)}`:"";return{content:[{type:"text",text:`${p(o)}${b}`}],details:{process:o}}}if(r==="stop"){const o=await e.stop(u);return{content:[{type:"text",text:`Stopped.
19
+ ${p(o)}`}],details:{process:o}}}throw new Error(`Unknown action: ${String(r)}`)},renderCall(a,s,m){const h=m.lastComponent??new $("",0,0),d=a?.action??"\u2026",r=d==="start"?a?.name??a?.command??"":a?.id??"";return h.setText(`${x.fg("toolTitle",x.bold(`process ${d}`))} ${x.fg("dim",String(r))}`),h},renderResult(a,s,m,h){const d=h.lastComponent??new $("",0,0),r=U(a,!1).trim(),u=r.split(`
20
+ `);return d.setText(s.expanded?`
21
+ ${x.fg("toolOutput",r)}`:`
22
+ ${x.fg("toolOutput",u[0]??"")}`),d}}}l(G,"createProcessToolDefinition");export{G as createProcessToolDefinition};
@@ -1,22 +1,22 @@
1
- var q=Object.defineProperty;var r=(e,t)=>q(e,"name",{value:t,configurable:!0});import{basename as j,dirname as W,isAbsolute as Y,relative as J,resolve as G,sep as K}from"node:path";import{Text as H}from"@earendil-works/pi-tui";import{constants as Q}from"fs";import{access as Z,readFile as ee}from"fs/promises";import{Type as T}from"typebox";import{getReadmePath as te}from"../../config.js";import{fill as I,t as S}from"../../dal/i18n.js";import{keyHint as ne}from"../../modes/interactive/components/keybinding-hints.js";import{getLanguageFromPath as ie,highlightCode as oe}from"../../modes/interactive/theme/theme.js";import{processImage as se}from"../../utils/image-process.js";import{detectSupportedImageMimeTypeFromFile as re}from"../../utils/mime.js";import{formatPathRelativeToCwdOrAbsolute as ae}from"../../utils/paths.js";import{resolveReadPathAsync as le,resolveToCwd as fe}from"./path-utils.js";import{getTextOutput as de,renderToolPath as ce,replaceTabs as F,str as N}from"./render-utils.js";import{wrapToolDefinition as me}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as y,DEFAULT_MAX_LINES as V,formatSize as O,truncateHead as ue}from"./truncate.js";const pe=T.Object({path:T.String({description:"Path to the file to read (relative or absolute)"}),offset:T.Optional(T.Number({description:"Line number to start reading from (1-indexed)"})),limit:T.Optional(T.Number({description:"Maximum number of lines to read"}))}),X={snippet:"Read file contents",guidelines:["Use read to examine files instead of cat or sed."]},ge=new Set(["AGENTS.override.md","AGENTS.md","AGENTS.MD","CLAUDE.md","CLAUDE.MD"]),he={readFile:r(e=>ee(e),"readFile"),access:r(e=>Z(e,Q.R_OK),"access"),detectImageMimeType:re};function k(e,t){if(e?.offset===void 0&&e?.limit===void 0)return"";const n=e.offset??1,i=e.limit!==void 0?n+e.limit-1:"";return t.fg("warning",`:${n}${i?`-${i}`:""}`)}r(k,"formatReadLineRange");function $e(e,t,n){const i=ce(N(e?.file_path??e?.path),t,n);return`${t.fg("toolTitle",t.bold("read"))} ${i}${k(e,t)}`}r($e,"formatReadCall");function be(e){let t=e.length;for(;t>0&&e[t-1]==="";)t--;return e.slice(0,t)}r(be,"trimTrailingEmptyLines");function Le(e){if(!(!e||e.input.includes("image")))return"[Current model does not support images. The image will be omitted from this request.]"}r(Le,"getNonVisionImageNote");function we(e){return e.split(K).join("/")}r(we,"toPosixPath");function xe(e){const t=W(te()),n=J(G(t),G(e));if(n===""||n===".."||n.startsWith(`..${K}`)||Y(n))return;const i=we(n);if(i==="README.md"||i.startsWith("docs/")||i.startsWith("dal-docs/")||i.startsWith("examples/"))return{kind:"docs",label:i}}r(xe,"getPiDocsClassification");function Te(e,t){const n=N(e?.file_path??e?.path);if(!n)return;const i=fe(n,t),d=j(i);if(d==="SKILL.md")return{kind:"skill",label:j(W(i))||d};const c=xe(i);if(c)return c;if(ge.has(d))return{kind:"resource",label:ae(i,t)}}r(Te,"getCompactReadClassification");function ye(e,t,n){return e.kind==="skill"?n.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m ")+n.fg("customMessageText",e.label)+k(t,n):n.fg("toolTitle",n.bold(`read ${e.kind}`))+" "+n.fg("accent",e.label)+k(t,n)}r(ye,"formatCompactReadCall");function Re(e,t,n,i,d,c,m){if(!n.expanded&&!m)return"";const f=N(e?.file_path??e?.path),a=de(t,d),l=!m&&f?ie(f):void 0,U=l?oe(F(a),l):a.split(`
2
- `),L=be(U),P=n.expanded?L.length:10,R=L.slice(0,P),$=L.length-P;let g=`
3
- ${R.map(x=>l?F(x):i.fg("toolOutput",F(x))).join(`
1
+ var Y=Object.defineProperty;var r=(e,t)=>Y(e,"name",{value:t,configurable:!0});import{basename as W,dirname as G,isAbsolute as J,relative as Q,resolve as K,sep as H}from"node:path";import{Text as V}from"@earendil-works/pi-tui";import{constants as Z}from"fs";import{access as ee,readFile as te}from"fs/promises";import{Type as x}from"typebox";import{getReadmePath as ne}from"../../config.js";import{fill as I,t as S}from"../../dal/i18n.js";import{keyHint as ie}from"../../modes/interactive/components/keybinding-hints.js";import{getLanguageFromPath as oe,highlightCode as se}from"../../modes/interactive/theme/theme.js";import{processImage as re}from"../../utils/image-process.js";import{detectSupportedImageMimeTypeFromFile as ae}from"../../utils/mime.js";import{formatPathRelativeToCwdOrAbsolute as le}from"../../utils/paths.js";import{readAccessDenial as fe}from"../permissions/tool-policy.js";import{resolveReadPathAsync as de,resolveToCwd as ce}from"./path-utils.js";import{getTextOutput as me,renderToolPath as ue,replaceTabs as N,str as k}from"./render-utils.js";import{wrapToolDefinition as pe}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as T,DEFAULT_MAX_LINES as X,formatSize as A,truncateHead as ge}from"./truncate.js";const he=x.Object({path:x.String({description:"Path to the file to read (relative or absolute)"}),offset:x.Optional(x.Number({description:"Line number to start reading from (1-indexed)"})),limit:x.Optional(x.Number({description:"Maximum number of lines to read"}))}),q={snippet:"Read file contents",guidelines:["Use read to examine files instead of cat or sed."]},$e=new Set(["AGENTS.override.md","AGENTS.md","AGENTS.MD","CLAUDE.md","CLAUDE.MD"]),be={readFile:r(e=>te(e),"readFile"),access:r(e=>ee(e,Z.R_OK),"access"),detectImageMimeType:ae};function U(e,t){if(e?.offset===void 0&&e?.limit===void 0)return"";const n=e.offset??1,i=e.limit!==void 0?n+e.limit-1:"";return t.fg("warning",`:${n}${i?`-${i}`:""}`)}r(U,"formatReadLineRange");function Le(e,t,n){const i=ue(k(e?.file_path??e?.path),t,n);return`${t.fg("toolTitle",t.bold("read"))} ${i}${U(e,t)}`}r(Le,"formatReadCall");function we(e){let t=e.length;for(;t>0&&e[t-1]==="";)t--;return e.slice(0,t)}r(we,"trimTrailingEmptyLines");function xe(e){if(!(!e||e.input.includes("image")))return"[Current model does not support images. The image will be omitted from this request.]"}r(xe,"getNonVisionImageNote");function Te(e){return e.split(H).join("/")}r(Te,"toPosixPath");function ye(e){const t=G(ne()),n=Q(K(t),K(e));if(n===""||n===".."||n.startsWith(`..${H}`)||J(n))return;const i=Te(n);if(i==="README.md"||i.startsWith("docs/")||i.startsWith("dal-docs/")||i.startsWith("examples/"))return{kind:"docs",label:i}}r(ye,"getPiDocsClassification");function Re(e,t){const n=k(e?.file_path??e?.path);if(!n)return;const i=ce(n,t),d=W(i);if(d==="SKILL.md")return{kind:"skill",label:W(G(i))||d};const c=ye(i);if(c)return c;if($e.has(d))return{kind:"resource",label:le(i,t)}}r(Re,"getCompactReadClassification");function Ee(e,t,n){return e.kind==="skill"?n.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m ")+n.fg("customMessageText",e.label)+U(t,n):n.fg("toolTitle",n.bold(`read ${e.kind}`))+" "+n.fg("accent",e.label)+U(t,n)}r(Ee,"formatCompactReadCall");function Ce(e,t,n,i,d,c,m){if(!n.expanded&&!m)return"";const f=k(e?.file_path??e?.path),a=me(t,d),l=!m&&f?oe(f):void 0,z=l?se(N(a),l):a.split(`
2
+ `),L=we(z),O=n.expanded?L.length:10,y=L.slice(0,O),$=L.length-O;let g=`
3
+ ${y.map(R=>l?N(R):i.fg("toolOutput",N(R))).join(`
4
4
  `)}`;$>0&&(g+=`${i.fg("muted",`
5
- ${I(S("... (\u8FD8\u6709 {count} \u884C\uFF0C"),{count:$})}`)} ${ne("app.tools.expand",S("\u5373\u53EF\u5C55\u5F00"))}${i.fg("muted",")")}`);const o=t.details?.truncation;return o?.truncated&&(o.firstLineExceedsLimit?g+=`
6
- ${i.fg("warning",I(S("[\u9996\u884C\u8D85\u51FA {limit} \u4E0A\u9650]"),{limit:O(o.maxBytes??y)}))}`:o.truncatedBy==="lines"?g+=`
7
- ${i.fg("warning",I(S("[\u5DF2\u622A\u65AD\uFF1A\u663E\u793A {shown}/{total} \u884C\uFF08\u4E0A\u9650 {max} \u884C\uFF09]"),{shown:o.outputLines,total:o.totalLines,max:o.maxLines??V}))}`:g+=`
8
- ${i.fg("warning",I(S("[\u5DF2\u622A\u65AD\uFF1A\u663E\u793A\u4E86 {shown} \u884C\uFF08\u4E0A\u9650 {limit}\uFF09]"),{shown:o.outputLines,limit:O(o.maxBytes??y)}))}`),g}r(Re,"formatReadResult");function Ce(e,t){const n=t?.autoResizeImages??!0,i=t?.resizeOptions,d=t?.operations??he;return{name:"read",label:"read",description:`Read the contents of a file. Supports text files and images (jpg, png, gif, webp, bmp). Images are sent as attachments. For text files, output is truncated to ${V} lines or ${y/1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,promptSnippet:X.snippet,promptGuidelines:[...X.guidelines],parameters:pe,constrainedSampling:{type:"json_schema",strict:"prefer"},async execute(c,{path:m,offset:f,limit:a},l,U,L){return new Promise((P,R)=>{if(l?.aborted){R(new Error("Operation aborted"));return}let $=!1;const g=r(()=>{$=!0,R(new Error("Operation aborted"))},"onAbort");l?.addEventListener("abort",g,{once:!0}),(async()=>{try{const o=await le(m,L?.cwd||e);if($||(await d.access(o),$))return;const x=d.detectImageMimeType?await d.detectImageMimeType(o):void 0;let A,_;const M=Le(L?.model);if(x){const z=await d.readFile(o),b=await se(z,x,{autoResizeImages:n,resizeOptions:L?.model?.inputLimits?.images?.resize??i});if(b.ok){let s=`Read image file [${b.mimeType}]`;b.hints.length>0&&(s+=`
5
+ ${I(S("... (\u8FD8\u6709 {count} \u884C\uFF0C"),{count:$})}`)} ${ie("app.tools.expand",S("\u5373\u53EF\u5C55\u5F00"))}${i.fg("muted",")")}`);const o=t.details?.truncation;return o?.truncated&&(o.firstLineExceedsLimit?g+=`
6
+ ${i.fg("warning",I(S("[\u9996\u884C\u8D85\u51FA {limit} \u4E0A\u9650]"),{limit:A(o.maxBytes??T)}))}`:o.truncatedBy==="lines"?g+=`
7
+ ${i.fg("warning",I(S("[\u5DF2\u622A\u65AD\uFF1A\u663E\u793A {shown}/{total} \u884C\uFF08\u4E0A\u9650 {max} \u884C\uFF09]"),{shown:o.outputLines,total:o.totalLines,max:o.maxLines??X}))}`:g+=`
8
+ ${i.fg("warning",I(S("[\u5DF2\u622A\u65AD\uFF1A\u663E\u793A\u4E86 {shown} \u884C\uFF08\u4E0A\u9650 {limit}\uFF09]"),{shown:o.outputLines,limit:A(o.maxBytes??T)}))}`),g}r(Ce,"formatReadResult");function Se(e,t){const n=t?.autoResizeImages??!0,i=t?.resizeOptions,d=t?.operations??be;return{name:"read",label:"read",description:`Read the contents of a file. Supports text files and images (jpg, png, gif, webp, bmp). Images are sent as attachments. For text files, output is truncated to ${X} lines or ${T/1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,promptSnippet:q.snippet,promptGuidelines:[...q.guidelines],parameters:he,constrainedSampling:{type:"json_schema",strict:"prefer"},async execute(c,{path:m,offset:f,limit:a},l,z,L){return new Promise((O,y)=>{if(l?.aborted){y(new Error("Operation aborted"));return}let $=!1;const g=r(()=>{$=!0,y(new Error("Operation aborted"))},"onAbort");l?.addEventListener("abort",g,{once:!0}),(async()=>{try{const o=await de(m,L?.cwd||e);if($)return;const R=t?.operations?void 0:fe(o);if(R)throw new Error(R);if(await d.access(o),$)return;const _=d.detectImageMimeType?await d.detectImageMimeType(o):void 0;let P,D;const M=xe(L?.model);if(_){const B=await d.readFile(o),b=await re(B,_,{autoResizeImages:n,resizeOptions:L?.model?.inputLimits?.images?.resize??i});if(b.ok){let s=`Read image file [${b.mimeType}]`;b.hints.length>0&&(s+=`
9
9
  ${b.hints.join(`
10
10
  `)}`),M&&(s+=`
11
- ${M}`),A=[{type:"text",text:s},{type:"image",data:b.data,mimeType:b.mimeType}]}else{let s=`Read image file [${x}]
11
+ ${M}`),P=[{type:"text",text:s},{type:"image",data:b.data,mimeType:b.mimeType}]}else{let s=`Read image file [${_}]
12
12
  ${b.message}`;M&&(s+=`
13
- ${M}`),A=[{type:"text",text:s}]}}else{const s=(await d.readFile(o)).toString("utf-8").split(`
14
- `),B=s.length,u=f?Math.max(0,f-1):0,C=u+1;if(u>=s.length)throw new Error(`Offset ${f} is beyond end of file (${s.length} lines total)`);let D,E;if(a!==void 0){const p=Math.min(u+a,s.length);D=s.slice(u,p).join(`
15
- `),E=p-u}else D=s.slice(u).join(`
16
- `);const h=ue(D);let w;if(h.firstLineExceedsLimit){const p=O(Buffer.byteLength(s[u],"utf-8"));w=`[Line ${C} is ${p}, exceeds ${O(y)} limit. Use bash: sed -n '${C}p' ${m} | head -c ${y}]`,_={truncation:h}}else if(h.truncated){const p=C+h.outputLines-1,v=p+1;w=h.content,h.truncatedBy==="lines"?w+=`
13
+ ${M}`),P=[{type:"text",text:s}]}}else{const s=(await d.readFile(o)).toString("utf-8").split(`
14
+ `),j=s.length,u=f?Math.max(0,f-1):0,E=u+1;if(u>=s.length)throw new Error(`Offset ${f} is beyond end of file (${s.length} lines total)`);let F,C;if(a!==void 0){const p=Math.min(u+a,s.length);F=s.slice(u,p).join(`
15
+ `),C=p-u}else F=s.slice(u).join(`
16
+ `);const h=ge(F);let w;if(h.firstLineExceedsLimit){const p=A(Buffer.byteLength(s[u],"utf-8"));w=`[Line ${E} is ${p}, exceeds ${A(T)} limit. Use bash: sed -n '${E}p' ${m} | head -c ${T}]`,D={truncation:h}}else if(h.truncated){const p=E+h.outputLines-1,v=p+1;w=h.content,h.truncatedBy==="lines"?w+=`
17
17
 
18
- [Showing lines ${C}-${p} of ${B}. Use offset=${v} to continue.]`:w+=`
18
+ [Showing lines ${E}-${p} of ${j}. Use offset=${v} to continue.]`:w+=`
19
19
 
20
- [Showing lines ${C}-${p} of ${B} (${O(y)} limit). Use offset=${v} to continue.]`,_={truncation:h}}else if(E!==void 0&&u+E<s.length){const p=s.length-(u+E),v=u+E+1;w=`${h.content}
20
+ [Showing lines ${E}-${p} of ${j} (${A(T)} limit). Use offset=${v} to continue.]`,D={truncation:h}}else if(C!==void 0&&u+C<s.length){const p=s.length-(u+C),v=u+C+1;w=`${h.content}
21
21
 
22
- [${p} more lines in file. Use offset=${v} to continue.]`}else w=h.content;A=[{type:"text",text:w}]}if($)return;l?.removeEventListener("abort",g),P({content:A,details:_})}catch(o){l?.removeEventListener("abort",g),$||R(o)}})()})},renderCall(c,m,f){const a=f.lastComponent??new H("",0,0),l=f.expanded?void 0:Te(c,f.cwd);return a.setText(l?ye(l,c,m):$e(c,m,f.cwd)),a},renderResult(c,m,f,a){const l=a.lastComponent??new H("",0,0);return l.setText(Re(a.args,c,m,f,a.showImages,a.cwd,a.isError)),l}}}r(Ce,"createReadToolDefinition");function We(e,t){return me(Ce(e,t))}r(We,"createReadTool");export{We as createReadTool,Ce as createReadToolDefinition,X as readToolSystemPromptContribution};
22
+ [${p} more lines in file. Use offset=${v} to continue.]`}else w=h.content;P=[{type:"text",text:w}]}if($)return;l?.removeEventListener("abort",g),O({content:P,details:D})}catch(o){l?.removeEventListener("abort",g),$||y(o)}})()})},renderCall(c,m,f){const a=f.lastComponent??new V("",0,0),l=f.expanded?void 0:Re(c,f.cwd);return a.setText(l?Ee(l,c,m):Le(c,m,f.cwd)),a},renderResult(c,m,f,a){const l=a.lastComponent??new V("",0,0);return l.setText(Ce(a.args,c,m,f,a.showImages,a.cwd,a.isError)),l}}}r(Se,"createReadToolDefinition");function He(e,t){return pe(Se(e,t))}r(He,"createReadTool");export{He as createReadTool,Se as createReadToolDefinition,q as readToolSystemPromptContribution};
@@ -1,3 +1,3 @@
1
- var c=Object.defineProperty;var r=(a,e)=>c(a,"name",{value:e,configurable:!0});import{execFileSync as s}from"node:child_process";import{readFileSync as i}from"node:fs";import{createRequire as p}from"node:module";import{dirname as f,join as P}from"node:path";import{setAmbientAuthPolicy as u,setEnvApiKeyPolicy as y}from"@earendil-works/pi-ai";import{houseProvidersEnforced as m,isProviderConfigurable as T}from"../core/house-providers.js";function b(){if(!m())return;const a=r(e=>T(e),"allowed");y(a),u(a)}r(b,"applyDalEnvApiKeyPolicy");const g=["@dalcode/dal-plugins","@dalcode/deepailab","@dalcode/dal-gateway","@dalcode/dal-guard","@dalcode/dal-lsp","@dalcode/dal-subagent","@dalcode/dal-router","@dalcode/dal-mcp","@dalcode/dal-skills","@dalcode/dal-office","@dalcode/dal-web","@dalcode/dal-workflow","@dalcode/dal-tool-catalog","@dalcode/dal-halo","@dalcode/dal-lang","@dalcode/dal-bridge","@dalcode/dal-telemetry","@dalcode/dal-rewind","cc-safety-net"],x=new Set(["@dalcode/dal-guard","cc-safety-net"]);function h(){const a=p(import.meta.url),e=[];for(const o of g)try{const t=a.resolve(`${o}/package.json`),n=JSON.parse(i(t,"utf8"));for(const l of n.pi?.extensions??[])e.push(P(f(t),l))}catch(t){x.has(o)&&process.stderr.write(`dal: \u5B89\u5168\u6269\u5C55 ${o} \u52A0\u8F7D\u5931\u8D25\uFF0C\u5371\u9669\u547D\u4EE4\u7684\u5BA1\u6279\u95E8\u5DF2\u5931\u6548 \u2014 ${t instanceof Error?t.message:String(t)}
1
+ var p=Object.defineProperty;var t=(n,o)=>p(n,"name",{value:o,configurable:!0});import{execFileSync as a}from"node:child_process";import{readFileSync as P}from"node:fs";import{createRequire as l}from"node:module";import{dirname as f,join as u}from"node:path";import{setAmbientAuthPolicy as m,setEnvApiKeyPolicy as T}from"@earendil-works/pi-ai";import{houseProvidersEnforced as y,isProviderConfigurable as d}from"../core/house-providers.js";import{BUNDLED_EXTENSION_PACKAGES as E,SAFETY_CRITICAL_PACKAGES as S}from"./manifest.js";function C(){if(!y())return;const n=t(o=>d(o),"allowed");T(n),m(n)}t(C,"applyDalEnvApiKeyPolicy");import{BUNDLED_EXTENSION_PACKAGES as K,SAFETY_CRITICAL_PACKAGES as b}from"./manifest.js";function x(){const n=l(import.meta.url),o=[];for(const e of E)try{const r=n.resolve(`${e}/package.json`),s=JSON.parse(P(r,"utf8"));for(const c of s.pi?.extensions??[])o.push(u(f(r),c))}catch(r){S.has(e)&&process.stderr.write(`dal: \u5B89\u5168\u6269\u5C55 ${e} \u52A0\u8F7D\u5931\u8D25\uFF0C\u5371\u9669\u547D\u4EE4\u7684\u5BA1\u6279\u95E8\u5DF2\u5931\u6548 \u2014 ${r instanceof Error?r.message:String(r)}
2
2
  \u91CD\u65B0\u5B89\u88C5\u53EF\u6062\u590D\uFF1Anpm i -g dal-code@latest
3
- `)}return e}r(h,"bundledPackageExtensionPaths");function H(){return h()}r(H,"dalBuiltinExtensionPaths");function R(){if(!(process.platform!=="darwin"||["HTTPS_PROXY","https_proxy","HTTP_PROXY","http_proxy","ALL_PROXY","all_proxy"].some(e=>process.env[e])))try{const e=s("scutil",["--proxy"],{encoding:"utf8",timeout:2e3}),o=r(d=>e.match(new RegExp(`${d}\\s*:\\s*(\\S+)`))?.[1],"get"),t=r(d=>o(`${d}Enable`)==="1","enabled"),n=t("HTTPS")?`http://${o("HTTPSProxy")}:${o("HTTPSPort")}`:t("HTTP")?`http://${o("HTTPProxy")}:${o("HTTPPort")}`:void 0;if(!n||n.includes("undefined"))return;process.env.HTTPS_PROXY=n,process.env.HTTP_PROXY=n;const l=new Set((process.env.NO_PROXY??process.env.no_proxy??"").split(",").filter(Boolean));for(const d of["localhost","127.0.0.1","::1"])l.add(d);process.env.NO_PROXY=[...l].join(",")}catch{}}r(R,"applyDalSystemProxyFallback");export{g as BUNDLED_EXTENSION_PACKAGES,b as applyDalEnvApiKeyPolicy,R as applyDalSystemProxyFallback,H as dalBuiltinExtensionPaths};
3
+ `)}return o}t(x,"bundledPackageExtensionPaths");function N(){return x()}t(N,"dalBuiltinExtensionPaths");function X(){if(!(process.platform!=="darwin"||["HTTPS_PROXY","https_proxy","HTTP_PROXY","http_proxy","ALL_PROXY","all_proxy"].some(o=>process.env[o])))try{const o=a("scutil",["--proxy"],{encoding:"utf8",timeout:2e3}),e=t(i=>o.match(new RegExp(`${i}\\s*:\\s*(\\S+)`))?.[1],"get"),r=t(i=>e(`${i}Enable`)==="1","enabled"),s=r("HTTPS")?`http://${e("HTTPSProxy")}:${e("HTTPSPort")}`:r("HTTP")?`http://${e("HTTPProxy")}:${e("HTTPPort")}`:void 0;if(!s||s.includes("undefined"))return;process.env.HTTPS_PROXY=s,process.env.HTTP_PROXY=s;const c=new Set((process.env.NO_PROXY??process.env.no_proxy??"").split(",").filter(Boolean));for(const i of["localhost","127.0.0.1","::1"])c.add(i);process.env.NO_PROXY=[...c].join(",")}catch{}}t(X,"applyDalSystemProxyFallback");export{K as BUNDLED_EXTENSION_PACKAGES,b as SAFETY_CRITICAL_PACKAGES,C as applyDalEnvApiKeyPolicy,X as applyDalSystemProxyFallback,N as dalBuiltinExtensionPaths};
@@ -1 +1 @@
1
- var T=Object.defineProperty;var E=(e,n)=>T(e,"name",{value:n,configurable:!0});const A=["*KEY*","*SECRET*","*TOKEN*","*PASSWORD*","*CREDENTIAL*","AWS_*","AZURE_*","GOOGLE_APPLICATION_CREDENTIALS","GH_*","GITHUB_TOKEN","NPM_TOKEN"],f=["PATH","HOME","USER","LOGNAME","SHELL","TMPDIR","TMP","TEMP","LANG","LC_*","TERM","COLORTERM","NO_COLOR","TZ","XDG_*","SYSTEMROOT","WINDIR","COMSPEC","PATHEXT","USERPROFILE","APPDATA","LOCALAPPDATA"];function i(e){const n=e.map(t=>new RegExp(`^${t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`,"i"));return t=>n.some(r=>r.test(t))}E(i,"patternMatcher");const L=i(A),R=i(f);function u(e){return/^DALCODE_/i.test(e)&&/(TOKEN|SECRET|KEY|PASSWORD|CREDENTIAL)/i.test(e)}E(u,"isDalCodeCredentialName");function C(e){const n={};for(const[t,r]of Object.entries(e))u(t)||(n[t]=r);return n}E(C,"withoutDalCodeCredentials");function S(e,n={}){const t=n.inherit??"all",r=i(n.include??[]),O=i(n.exclude??[]),c={};for(const[o,s]of Object.entries(e))t==="none"||t==="core"&&!R(o)||u(o)||L(o)&&!r(o)||O(o)||(c[o]=s);for(const[o,s]of Object.entries(n.set??{}))u(o)||(c[o]=s);return c}E(S,"applyShellEnvironmentPolicy");let l={};function P(e){l=e??{}}E(P,"configureShellEnvironment");function D(){return l}E(D,"currentShellEnvironmentPolicy");export{A as DEFAULT_SHELL_ENV_EXCLUDES,S as applyShellEnvironmentPolicy,P as configureShellEnvironment,D as currentShellEnvironmentPolicy,u as isDalCodeCredentialName,C as withoutDalCodeCredentials};
1
+ var T=Object.defineProperty;var E=(e,n)=>T(e,"name",{value:n,configurable:!0});const A=["*KEY*","*SECRET*","*TOKEN*","*PASSWORD*","*CREDENTIAL*","AWS_*","AZURE_*","GOOGLE_APPLICATION_CREDENTIALS","GH_*","GITHUB_TOKEN","NPM_TOKEN"],L=["PATH","HOME","USER","LOGNAME","SHELL","TMPDIR","TMP","TEMP","LANG","LC_*","TERM","COLORTERM","NO_COLOR","TZ","XDG_*","SYSTEMROOT","WINDIR","COMSPEC","PATHEXT","USERPROFILE","APPDATA","LOCALAPPDATA"];function i(e){const n=e.map(t=>new RegExp(`^${t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`,"i"));return t=>n.some(r=>r.test(t))}E(i,"patternMatcher");const f=i(A),R=i(L);function u(e){return/^(DALCODE_|DAL_HOST_)/i.test(e)&&/(TOKEN|SECRET|KEY|PASSWORD|CREDENTIAL)/i.test(e)}E(u,"isDalCodeCredentialName");function a(e){const n={};for(const[t,r]of Object.entries(e))u(t)||(n[t]=r);return n}E(a,"withoutDalCodeCredentials");function C(e,n={}){const t=n.inherit??"all",r=i(n.include??[]),O=i(n.exclude??[]),c={};for(const[o,s]of Object.entries(e))t==="none"||t==="core"&&!R(o)||u(o)||f(o)&&!r(o)||O(o)||(c[o]=s);for(const[o,s]of Object.entries(n.set??{}))u(o)||(c[o]=s);return c}E(C,"applyShellEnvironmentPolicy");let l={};function P(e){l=e??{}}E(P,"configureShellEnvironment");function D(){return l}E(D,"currentShellEnvironmentPolicy");export{A as DEFAULT_SHELL_ENV_EXCLUDES,C as applyShellEnvironmentPolicy,P as configureShellEnvironment,D as currentShellEnvironmentPolicy,u as isDalCodeCredentialName,a as withoutDalCodeCredentials};
@@ -0,0 +1,32 @@
1
+ export type ManifestLanguage = "zh" | "en";
2
+ export type BundledExtensionActivation = "always" | "dal-code" | "host-capability" | "halo-app" | "tui";
3
+ export declare const BUNDLED_EXTENSION_PACKAGES: readonly string[];
4
+ export declare const SAFETY_CRITICAL_PACKAGES: ReadonlySet<string>;
5
+ export interface BundledExtensionInfo {
6
+ name: string;
7
+ label: string;
8
+ description: string;
9
+ enabledByDefault: true;
10
+ canDisable: false;
11
+ safetyCritical: boolean;
12
+ activation: BundledExtensionActivation;
13
+ installed: boolean;
14
+ version: string;
15
+ extensions: string[];
16
+ }
17
+ export declare function listBundledExtensions(language?: ManifestLanguage): BundledExtensionInfo[];
18
+ export type ToolAvailability = "default" | "opt-in" | "on-demand" | "dal-code" | "host" | "reviewer" | "mcp" | "tui";
19
+ export declare const DAL_TOOL_NAMES: {
20
+ readonly builtin: readonly string[];
21
+ readonly extensions: Readonly<Record<string, readonly string[]>>;
22
+ };
23
+ export interface ToolCatalogEntry {
24
+ name: string;
25
+ label: string;
26
+ summary: string;
27
+ source: string;
28
+ readOnly: boolean;
29
+ availability: ToolAvailability;
30
+ }
31
+ export declare function listToolCatalog(language?: ManifestLanguage): ToolCatalogEntry[];
32
+ export declare function toolDisplayLabel(name: string, language?: ManifestLanguage): string;
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var i=(e,a)=>s(e,"name",{value:a,configurable:!0});import{createRequire as m}from"node:module";import{getLanguage as t,translate as o}from"@dalcode/dal-pi-kit";const n=[{package:"@dalcode/dal-plugins",label:"\u63D2\u4EF6\u517C\u5BB9",description:"\u8BA9\u793E\u533A\u63D2\u4EF6\u5728 DAL \u4E2D\u53EF\u7528\uFF0C\u5E76\u63D0\u4F9B\u63D2\u4EF6\u641C\u7D22",activation:"always"},{package:"@dalcode/deepailab",label:"DeepAILab \u8D26\u53F7",description:"DeepAILab \u767B\u5F55\u3001\u5957\u9910\u4E0E\u6A21\u578B\u63D0\u4F9B\u65B9\uFF08/login\u3001/account\uFF09",activation:"always"},{package:"@dalcode/dal-gateway",label:"DAL \u7F51\u5173",description:"\u7ECF DAL \u7F51\u5173\u8C03\u7528\u6A21\u578B",activation:"always"},{package:"@dalcode/dal-guard",label:"\u547D\u4EE4\u5BA1\u6279",description:"\u9AD8\u98CE\u9669\u547D\u4EE4\u6267\u884C\u524D\u8BF7\u4F60\u786E\u8BA4\uFF08/guard\uFF09",activation:"always",safetyCritical:!0},{package:"@dalcode/dal-lsp",label:"\u8BED\u8A00\u670D\u52A1\u5668",description:"\u67E5\u7C7B\u578B\u9519\u8BEF\u3001\u5B9A\u4E49\u4E0E\u5F15\u7528",activation:"always"},{package:"@dalcode/dal-subagent",label:"\u5B50\u52A9\u624B",description:"\u6D3E\u51FA\u5B50\u52A9\u624B\u5E76\u884C\u5904\u7406\u4EFB\u52A1",activation:"always"},{package:"@dalcode/dal-router",label:"\u667A\u80FD\u8DEF\u7531",description:"\u6309\u4EFB\u52A1\u81EA\u52A8\u6311\u9009\u6A21\u578B\uFF08/factory\uFF09",activation:"always"},{package:"@dalcode/dal-mcp",label:"MCP",description:"\u8FDE\u63A5 MCP \u670D\u52A1\u5668\u5E76\u4F7F\u7528\u5176\u5DE5\u5177\uFF08/mcp\uFF09",activation:"always"},{package:"@dalcode/dal-skills",label:"\u6280\u80FD",description:"\u641C\u7D22\u548C\u52A0\u8F7D\u672C\u5730\u4E0E\u4E91\u7AEF\u6280\u80FD\uFF08/skills\uFF09",activation:"always"},{package:"@dalcode/dal-office",label:"\u529E\u516C\u6587\u6863",description:"\u751F\u6210\u3001\u8BFB\u53D6\u548C\u4FEE\u6539 PPT\u3001Word\u3001Excel\u3001\u56FE\u8868",activation:"always"},{package:"@dalcode/dal-web",label:"\u8054\u7F51",description:"\u7F51\u9875\u641C\u7D22\u4E0E\u7F51\u9875\u8BFB\u53D6\uFF08/web\uFF09",activation:"always"},{package:"@dalcode/dal-workflow",label:"\u8BA1\u5212\u4E0E\u5F85\u529E",description:"\u8BA1\u5212\u6A21\u5F0F\u3001\u5F85\u529E\u6E05\u5355\u548C\u5B8C\u6210\u63D0\u9192\uFF08/plan\u3001/todos\uFF09",activation:"always"},{package:"@dalcode/dal-tool-catalog",label:"\u5DE5\u5177\u76EE\u5F55",description:"\u529E\u516C\u3001\u8054\u7F51\u7B49\u5DE5\u5177\u6309\u9700\u52A0\u8F7D\uFF0C\u8282\u7701\u4E0A\u4E0B\u6587",activation:"always"},{package:"@dalcode/dal-halo",label:"Halo",description:"\u5728 Halo \u7075\u52A8\u5C9B\u4E0A\u663E\u793A\u8FDB\u5EA6\u548C\u5BA1\u6279",activation:"halo-app"},{package:"@dalcode/dal-lang",label:"\u754C\u9762\u8BED\u8A00",description:"\u5207\u6362\u4E2D\u6587\u6216\u82F1\u6587\u754C\u9762\uFF08/lang\uFF09",activation:"always"},{package:"@dalcode/dal-bridge",label:"DAL Code \u6865\u63A5",description:"\u5728 DAL Code \u4E2D\u628A\u5BA1\u6279\u3001\u8BA1\u5212\u548C\u63D0\u95EE\u4EA4\u7ED9\u7F16\u8F91\u5668",activation:"dal-code"},{package:"@dalcode/dal-telemetry",label:"\u4F7F\u7528\u7EDF\u8BA1",description:"\u533F\u540D\u4F7F\u7528\u7EDF\u8BA1\uFF08/telemetry\uFF09",activation:"always"},{package:"@dalcode/dal-rewind",label:"\u68C0\u67E5\u70B9",description:"\u6BCF\u8F6E\u6539\u52A8\u81EA\u52A8\u7559\u68C0\u67E5\u70B9\uFF0C\u53EF\u56DE\u9000\uFF08/rewind\uFF09",activation:"always"},{package:"@dalcode/dal-review",label:"\u4EE3\u7801\u8BC4\u5BA1",description:"\u53EA\u8BFB\u8BC4\u5BA1\u6539\u52A8\uFF0C\u6309\u4E25\u91CD\u7A0B\u5EA6\u5217\u51FA\u95EE\u9898\uFF08/review\uFF09",activation:"always"},{package:"@dalcode/dal-interactive",label:"\u7EC8\u7AEF\u4EA4\u4E92",description:"\u95EE\u5377\u63D0\u95EE\u3001/handoff \u4EA4\u63A5\u5230\u65B0\u4F1A\u8BDD\u3001!vim \u7B49\u4EA4\u4E92\u5F0F\u547D\u4EE4\uFF08\u4EC5\u7EC8\u7AEF\u754C\u9762\uFF09",activation:"tui"},{package:"@dalcode/dal-terminal",label:"\u7EC8\u7AEF\u4E0A\u4E0B\u6587",description:"\u5BBF\u4E3B\u7A0B\u5E8F\u63D0\u4F9B\u7EC8\u7AEF\u65F6\uFF0C\u52A9\u624B\u53EF\u8BFB\u53D6\u7EC8\u7AEF\u8F93\u51FA\uFF08@terminal\uFF09",activation:"host-capability"},{package:"cc-safety-net",label:"\u5371\u9669\u547D\u4EE4\u62E6\u622A",description:"\u6267\u884C\u524D\u62E6\u4E0B rm -rf\u3001\u5F3A\u5236\u63A8\u9001\u7B49\u7834\u574F\u6027\u547D\u4EE4",activation:"always",safetyCritical:!0}],p=n.map(e=>e.package),v=new Set(n.filter(e=>e.safetyCritical).map(e=>e.package));function u(e){try{const l=m(import.meta.url)(`${e}/package.json`);return{version:l.version??"",extensions:[...l.pi?.extensions??[]]}}catch{return}}i(u,"installedManifest");function g(e=t()){return n.map(a=>{const l=u(a.package);return{name:a.package,label:o(a.label,e),description:o(a.description,e),enabledByDefault:!0,canDisable:!1,safetyCritical:a.safetyCritical===!0,activation:a.activation,installed:l!==void 0,version:l?.version??"",extensions:l?.extensions??[]}})}i(g,"listBundledExtensions");const d=[{name:"read",label:"\u8BFB\u53D6\u6587\u4EF6",summary:"\u8BFB\u53D6\u6587\u4EF6\u5185\u5BB9\uFF0C\u4E5F\u80FD\u770B\u56FE\u7247",source:"core",readOnly:!0,availability:"default"},{name:"bash",label:"\u8FD0\u884C\u547D\u4EE4",summary:"\u5728\u7EC8\u7AEF\u91CC\u8FD0\u884C\u547D\u4EE4",source:"core",readOnly:!1,availability:"default"},{name:"edit",label:"\u7F16\u8F91\u6587\u4EF6",summary:"\u6309\u539F\u6587\u66FF\u6362\u4FEE\u6539\u6587\u4EF6",source:"core",readOnly:!1,availability:"default"},{name:"write",label:"\u5199\u5165\u6587\u4EF6",summary:"\u65B0\u5EFA\u6216\u8986\u76D6\u6587\u4EF6",source:"core",readOnly:!1,availability:"default"},{name:"grep",label:"\u641C\u7D22\u5185\u5BB9",summary:"\u5728\u6587\u4EF6\u91CC\u641C\u7D22\u6587\u672C",source:"core",readOnly:!0,availability:"opt-in"},{name:"find",label:"\u67E5\u627E\u6587\u4EF6",summary:"\u6309\u540D\u79F0\u67E5\u627E\u6587\u4EF6",source:"core",readOnly:!0,availability:"opt-in"},{name:"ls",label:"\u5217\u51FA\u76EE\u5F55",summary:"\u5217\u51FA\u76EE\u5F55\u5185\u5BB9",source:"core",readOnly:!0,availability:"opt-in"},{name:"powershell",label:"\u8FD0\u884C PowerShell",summary:"\u5728 Windows \u4E0A\u7528 PowerShell \u8FD0\u884C\u547D\u4EE4",source:"core",readOnly:!1,availability:"opt-in"},{name:"process",label:"\u540E\u53F0\u8FDB\u7A0B",summary:"\u5728\u540E\u53F0\u8FD0\u884C\u5F00\u53D1\u670D\u52A1\u5668\u7B49\u957F\u65F6\u95F4\u547D\u4EE4\uFF0C\u968F\u65F6\u67E5\u770B\u8F93\u51FA",source:"core",readOnly:!1,availability:"default"},{name:"plugin_search",label:"\u641C\u7D22\u63D2\u4EF6",summary:"\u641C\u7D22\u53EF\u5B89\u88C5\u7684\u63D2\u4EF6",source:"@dalcode/dal-plugins",readOnly:!0,availability:"default"},{name:"lsp",label:"\u8BED\u8A00\u670D\u52A1\u5668",summary:"\u67E5\u7C7B\u578B\u9519\u8BEF\u3001\u7B26\u53F7\u3001\u5B9A\u4E49\u4E0E\u5F15\u7528",source:"@dalcode/dal-lsp",readOnly:!0,availability:"on-demand"},{name:"task",label:"\u5B50\u52A9\u624B",summary:"\u6D3E\u51FA\u5B50\u52A9\u624B\u5904\u7406\u4E00\u9879\u5B50\u4EFB\u52A1",source:"@dalcode/dal-subagent",readOnly:!1,availability:"default"},{name:"mcp",label:"MCP \u5DE5\u5177",summary:"\u8C03\u7528\u5DF2\u8FDE\u63A5 MCP \u670D\u52A1\u5668\u7684\u5DE5\u5177",source:"@dalcode/dal-mcp",readOnly:!1,availability:"mcp"},{name:"skill",label:"\u6280\u80FD",summary:"\u641C\u7D22\u5E76\u52A0\u8F7D\u4E13\u9879\u4EFB\u52A1\u6307\u5F15",source:"@dalcode/dal-skills",readOnly:!0,availability:"default"},{name:"office_ppt_plan",label:"\u89C4\u5212 PPT",summary:"\u5148\u5217\u51FA PPT \u7684\u9875\u9762\u5927\u7EB2",source:"@dalcode/dal-office",readOnly:!0,availability:"on-demand"},{name:"office_ppt_generate",label:"\u751F\u6210 PPT",summary:"\u751F\u6210 PowerPoint \u6F14\u793A\u6587\u7A3F",source:"@dalcode/dal-office",readOnly:!1,availability:"on-demand"},{name:"office_doc_generate",label:"\u751F\u6210 Word",summary:"\u751F\u6210 Word \u6587\u6863",source:"@dalcode/dal-office",readOnly:!1,availability:"on-demand"},{name:"office_md_generate",label:"\u751F\u6210 Markdown",summary:"\u751F\u6210 Markdown \u6587\u6863",source:"@dalcode/dal-office",readOnly:!1,availability:"on-demand"},{name:"office_sheet_generate",label:"\u751F\u6210\u8868\u683C",summary:"\u751F\u6210 Excel \u8868\u683C",source:"@dalcode/dal-office",readOnly:!1,availability:"on-demand"},{name:"office_chart_generate",label:"\u751F\u6210\u56FE\u8868",summary:"\u751F\u6210 ECharts \u56FE\u8868",source:"@dalcode/dal-office",readOnly:!1,availability:"on-demand"},{name:"office_drawio_generate",label:"\u751F\u6210\u6D41\u7A0B\u56FE",summary:"\u751F\u6210 draw.io \u56FE",source:"@dalcode/dal-office",readOnly:!1,availability:"on-demand"},{name:"office_read_file",label:"\u8BFB\u53D6\u6587\u6863",summary:"\u8BFB\u53D6 Word\u3001PPT\u3001Excel\u3001PDF\u3001CSV",source:"@dalcode/dal-office",readOnly:!0,availability:"on-demand"},{name:"office_docx_edit",label:"\u4FEE\u6539 Word",summary:"\u6309\u4F4D\u7F6E\u4FEE\u6539\u5DF2\u6709\u7684 Word \u6587\u6863",source:"@dalcode/dal-office",readOnly:!1,availability:"on-demand"},{name:"office_pptx_edit",label:"\u4FEE\u6539 PPT",summary:"\u6309\u4F4D\u7F6E\u4FEE\u6539\u5DF2\u6709\u7684 PPT",source:"@dalcode/dal-office",readOnly:!1,availability:"on-demand"},{name:"office_xlsx_edit",label:"\u4FEE\u6539\u8868\u683C",summary:"\u6309\u4F4D\u7F6E\u4FEE\u6539\u5DF2\u6709\u7684 Excel",source:"@dalcode/dal-office",readOnly:!1,availability:"on-demand"},{name:"web_search",label:"\u7F51\u9875\u641C\u7D22",summary:"\u8054\u7F51\u641C\u7D22\u6700\u65B0\u4FE1\u606F",source:"@dalcode/dal-web",readOnly:!0,availability:"on-demand"},{name:"web_fetch",label:"\u8BFB\u53D6\u7F51\u9875",summary:"\u8BFB\u53D6\u7F51\u9875\u6B63\u6587",source:"@dalcode/dal-web",readOnly:!0,availability:"on-demand"},{name:"todo",label:"\u5F85\u529E\u6E05\u5355",summary:"\u7EF4\u62A4\u672C\u6B21\u4EFB\u52A1\u7684\u5F85\u529E\u6E05\u5355",source:"@dalcode/dal-workflow",readOnly:!0,availability:"default"},{name:"tool_catalog",label:"\u5DE5\u5177\u76EE\u5F55",summary:"\u67E5\u770B\u5E76\u542F\u7528\u6309\u9700\u52A0\u8F7D\u7684\u5DE5\u5177\u5206\u7EC4",source:"@dalcode/dal-tool-catalog",readOnly:!0,availability:"default"},{name:"submit_plan",label:"\u63D0\u4EA4\u8BA1\u5212",summary:"\u628A\u8BA1\u5212\u4EA4\u7ED9\u4F60\u5BA1\u6279",source:"@dalcode/dal-bridge",readOnly:!0,availability:"dal-code"},{name:"ask_user",label:"\u8BE2\u95EE\u4F60",summary:"\u5F00\u5DE5\u524D\u7528\u5361\u7247\u786E\u8BA4\u5173\u952E\u51B3\u5B9A",source:"@dalcode/dal-bridge",readOnly:!0,availability:"dal-code"},{name:"review_report",label:"\u63D0\u4EA4\u8BC4\u5BA1\u7ED3\u679C",summary:"\u8BC4\u5BA1\u52A9\u624B\u63D0\u4EA4\u53D1\u73B0\u7684\u95EE\u9898",source:"@dalcode/dal-review",readOnly:!0,availability:"reviewer"},{name:"questionnaire",label:"\u95EE\u5377",summary:"\u7528\u9009\u62E9\u9898\u5411\u4F60\u786E\u8BA4\u9700\u6C42\u6216\u504F\u597D",source:"@dalcode/dal-interactive",readOnly:!0,availability:"tui"},{name:"terminal_read",label:"\u8BFB\u53D6\u7EC8\u7AEF",summary:"\u8BFB\u53D6\u7EC8\u7AEF\u6700\u8FD1\u7684\u8F93\u51FA",source:"@dalcode/dal-terminal",readOnly:!0,availability:"host"}],w=(()=>{const e={};for(const a of d){if(a.source==="core")continue;const l=e[a.source]??[];l.push(a.name),e[a.source]=l}return{builtin:d.filter(a=>a.source==="core").map(a=>a.name),extensions:e}})();function O(e=t()){return d.map(a=>({name:a.name,label:o(a.label,e),summary:o(a.summary,e),source:a.source,readOnly:a.readOnly,availability:a.availability}))}i(O,"listToolCatalog");function _(e,a=t()){const l=d.find(c=>c.name===e);if(l)return o(l.label,a);const r=e.match(/^mcp__(.+?)__(.+)$/);return r?`${r[1]} \xB7 ${r[2]}`:e}i(_,"toolDisplayLabel");export{p as BUNDLED_EXTENSION_PACKAGES,w as DAL_TOOL_NAMES,v as SAFETY_CRITICAL_PACKAGES,g as listBundledExtensions,O as listToolCatalog,_ as toolDisplayLabel};
package/dist/index.d.ts CHANGED
@@ -2,33 +2,38 @@ export { type Args, parseArgs } from "./cli/args.ts";
2
2
  export { CONFIG_DIR_NAME, getAgentDir, getDocsPath, getExamplesPath, getPackageDir, getReadmePath, SHARED_SKILL_CONFIG_DIRS, VERSION, } from "./config.ts";
3
3
  export { AgentSession, type AgentSessionConfig, type AgentSessionEvent, type AgentSessionEventListener, type ModelCycleResult, type ParsedSkillBlock, type PromptOptions, parseSkillBlock, type SessionStats, } from "./core/agent-session.ts";
4
4
  export { readStoredCredential } from "./core/auth-storage.ts";
5
+ export { type BackgroundProcessEvent, type BackgroundProcessInfo, BackgroundProcessManager, type BackgroundProcessState, MAX_BACKGROUND_PROCESSES, } from "./core/background-processes.ts";
5
6
  export type { CacheWarmingDecision, CacheWarmingStatus } from "./core/cache-warmer.ts";
6
7
  export { type BranchPreparation, type BranchSummaryResult, type CollectEntriesResult, type CompactionResult, type CutPointResult, calculateContextTokens, collectEntriesForBranchSummary, compact, DEFAULT_COMPACTION_SETTINGS, estimateTokens, type FileOperations, findCutPoint, findTurnStartIndex, type GenerateBranchSummaryOptions, generateBranchSummary, generateSummary, generateSummaryWithUsage, getLastAssistantUsage, prepareBranchEntries, serializeConversation, shouldCompact, } from "./core/compaction/index.ts";
7
8
  export { createEventBus, type EventBus, type EventBusController } from "./core/event-bus.ts";
8
9
  export type { AfterProviderResponseEvent, AgentActivityOutcome, AgentBeforeSettleEvent, AgentBeforeSettleEventResult, AgentEndEvent, AgentSettledEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppKeybinding, AutocompleteProviderFactory, BashToolCallEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderHeadersEvent, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BoundaryContextPreview, BoundaryResult, BoundaryState, BuildSystemPromptOptions, CacheWarmingDecisionEvent, CacheWarmingDecisionEventResult, CompactionEntryDraft, CompactOptions, ContextEditEntryDraft, ContextEvent, ContextEventResult, ContextUsage, ContextWithSystemEvent, CustomEntryDraft, CustomMessageEntryDraft, CustomToolCallEvent, EditToolCallEvent, EntryRenderer, EntryRenderOptions, ExecOptions, ExecResult, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionRuntime, ExtensionShortcut, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetOptions, FindToolCallEvent, GrepToolCallEvent, InlineExtension, InputEvent, InputEventResult, InputSource, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, MarkdownTransformContext, MarkdownTransformer, MessageEndEvent, MessageEndEventResult, MessageRenderer, MessageRenderOptions, MessageStartEvent, MessageUpdateEvent, ModelPickerEntry, ModelPickerEntryState, ModelSelectEvent, ModelSelectSource, NormalizedBuildSystemPromptOptions, PowerShellToolCallEvent, ProjectTrustContext, ProjectTrustEvent, ProjectTrustEventDecision, ProjectTrustEventResult, ProjectTrustHandler, ProviderConfig, ProviderModelConfig, ReadToolCallEvent, RegisteredCommand, RegisteredModelPickerEntry, RegisteredTool, ResolvedCommand, ResourcesDiscoverEvent, ResourcesDiscoverResult, SessionBeforeCompactEvent, SessionBeforeCompactResult, SessionBeforeForkEvent, SessionBeforeForkResult, SessionBeforeSwitchEvent, SessionBeforeSwitchResult, SessionBeforeTreeEvent, SessionBeforeTreeResult, SessionBoundaryDraft, SessionCompactEvent, SessionCompactFailedEvent, SessionInfoChangedEvent, SessionShutdownEvent, SessionStartEvent, SessionTreeEvent, SlashCommandInfo, SlashCommandSource, SourceInfo, TerminalInputHandler, ThinkingLevelSelectEvent, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionEndEvent, ToolExecutionMode, ToolExecutionStartEvent, ToolExecutionUpdateEvent, ToolInfo, ToolRenderResultOptions, ToolResultEvent, ToolResultEventResult, TurnEndEvent, TurnEndEventResult, TurnStartEvent, UIPromptEndEvent, UIPromptKind, UIPromptStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, } from "./core/extensions/index.ts";
9
10
  export { createExtensionRuntime, defineTool, discoverAndLoadExtensions, ExtensionRunner, isBashToolResult, isEditToolResult, isFindToolResult, isGrepToolResult, isLsToolResult, isPowerShellToolResult, isReadToolResult, isToolCallEventType, isWriteToolResult, wrapRegisteredTool, wrapRegisteredTools, } from "./core/extensions/index.ts";
10
11
  export type { ReadonlyFooterDataProvider } from "./core/footer-data-provider.ts";
12
+ export { getHostCapabilities, HOST_CAPABILITIES_ENV, HOST_TOKEN_ENV, HOST_TOKEN_HEADER, HOST_URL_ENV, HostCallError, type HostCallErrorCode, type HostCallOptions, type HostCallRequest, HostCapabilities, type HostCapabilitiesListener, type HostCapability, type HostCapabilitySource, type HostTransport, parseHostCapabilities, } from "./core/host-capabilities.ts";
11
13
  export { convertToLlm } from "./core/messages.ts";
12
14
  export { ModelRegistry } from "./core/model-registry.ts";
13
15
  export { type ModelScopeDiagnostic, type ResolveCliModelResult, type ResolveModelScopeResult, resolveCliModel, resolveModelScopeWithDiagnostics, type ScopedModel, } from "./core/model-resolver.ts";
14
16
  export { type CreateModelRuntimeOptions, CredentialSynchronizationError, type CredentialSynchronizationOperation, ModelRuntime, type ModelRuntimeAuthOverrides, } from "./core/model-runtime.ts";
15
17
  export type { PackageManager, PathMetadata, ProgressCallback, ProgressEvent, ResolvedPaths, ResolvedResource, } from "./core/package-manager.ts";
16
18
  export { DefaultPackageManager } from "./core/package-manager.ts";
19
+ export { buildRuleSet, matchPermissionRules, type PermissionBehavior, type PermissionRule, type PermissionRuleSet, type PermissionRuleSource, parsePermissionRule, type RuleCall, type RuleVerdict, } from "./core/permissions/rules.ts";
20
+ export { evaluateToolPolicy, type PermissionAskHandler, type PermissionAskRequest, readAccessDenial, registerPermissionAskHandler, type ToolPolicyDecision, } from "./core/permissions/tool-policy.ts";
17
21
  export { buildProjectMap, formatProjectMapPrompt, type ProjectMap, type ProjectMapOptions, } from "./core/project-map.ts";
18
22
  export type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from "./core/resource-loader.ts";
19
23
  export { DefaultResourceLoader, loadProjectContextFiles } from "./core/resource-loader.ts";
24
+ export { detectSandboxAvailability, type ResolvedSandboxPolicy, registerSandboxEscalationHandler, resolveSandboxPolicy, SANDBOX_ENV, type SandboxAvailability, type SandboxBlockedAccess, type SandboxDenial, type SandboxEscalationDecision, type SandboxEscalationHandler, type SandboxEscalationInput, type SandboxEscalationRequest, type SandboxEvent, type SandboxLevel, type SandboxOptions, type SandboxRunDetails, type SandboxSettings, type SandboxStatus, ShellSandbox, } from "./core/sandbox/index.ts";
20
25
  export { AgentSessionRuntime, type AgentSessionRuntimeDiagnostic, type AgentSessionServices, type CreateAgentSessionFromServicesOptions, type CreateAgentSessionOptions, type CreateAgentSessionResult, type CreateAgentSessionRuntimeFactory, type CreateAgentSessionRuntimeResult, type CreateAgentSessionServicesOptions, createAgentSession, createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, createBashTool, createCodingTools, createEditTool, createFindTool, createGrepTool, createLsTool, createPowerShellTool, createReadOnlyTools, createReadTool, createWriteTool, type PromptTemplate, } from "./core/sdk.ts";
21
26
  export { type BranchSummaryEntry, buildContextEntries, buildSessionContext, buildSessionProjection, type CompactionEntry, type ContextEditableContent, type ContextEditEntry, CURRENT_SESSION_VERSION, type CustomEntry, type CustomMessageEntry, type FileEntry, getLatestCompactionEntry, type ModelChangeEntry, migrateSessionEntries, type NewSessionOptions, type ProjectedSessionEntry, parseSessionEntries, type SessionContext, type SessionEntry, type SessionEntryBase, type SessionHeader, type SessionInfo, type SessionInfoEntry, SessionManager, type SessionMessageEntry, type SessionProjection, type SessionTreeNode, sessionEntryToContextMessages, type ThinkingLevelChangeEntry, } from "./core/session-manager.ts";
22
27
  export { type CacheWarmingMode, type CompactionModelOverride, type CompactionSettings, type DefaultProjectTrust, type FullscreenExitOutput, type ImageSettings, type PackageSource, type RetrySettings, SettingsManager, type SettingsManagerCreateOptions, type TuiMode, } from "./core/settings-manager.ts";
23
28
  export { formatSkillsForPrompt, type LoadSkillsFromDirOptions, type LoadSkillsResult, loadSkills, loadSkillsFromDir, type Skill, type SkillFrontmatter, } from "./core/skills.ts";
24
29
  export { createSyntheticSourceInfo } from "./core/source-info.ts";
25
30
  export { type EditDiffResult, generateDiffString, generateUnifiedPatch } from "./core/tools/edit-diff.ts";
26
- export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLocalPowerShellOperations, createLsToolDefinition, createPowerShellToolDefinition, createReadToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, formatSize, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, type PowerShellOperations, type PowerShellSpawnContext, type PowerShellSpawnHook, type PowerShellToolDetails, type PowerShellToolInput, type PowerShellToolOptions, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, registerShellExecutionGuard, type ShellExecutionGuard, type ShellExecutionRequest, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, type WriteOperations, type WriteToolInput, type WriteToolOptions, withFileMutationQueue, } from "./core/tools/index.ts";
31
+ export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLocalPowerShellOperations, createLsToolDefinition, createPowerShellToolDefinition, createProcessToolDefinition, createReadToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, formatSize, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, type PowerShellOperations, type PowerShellSpawnContext, type PowerShellSpawnHook, type PowerShellToolDetails, type PowerShellToolInput, type PowerShellToolOptions, type ProcessToolDetails, type ProcessToolInput, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, registerShellExecutionGuard, type ShellExecutionGuard, type ShellExecutionRequest, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, type WriteOperations, type WriteToolInput, type WriteToolOptions, withFileMutationQueue, } from "./core/tools/index.ts";
27
32
  export { hasTrustRequiringProjectResources, type ProjectTrustDecision, ProjectTrustStore, type ProjectTrustStoreEntry, type ProjectTrustUpdate, } from "./core/trust-manager.ts";
28
33
  export { applyShellEnvironmentPolicy, DEFAULT_SHELL_ENV_EXCLUDES, isDalCodeCredentialName, type ShellEnvironmentPolicy, withoutDalCodeCredentials, } from "./dal/child-env.ts";
29
34
  export * from "./dal/hooks/index.ts";
30
35
  export { type MainOptions, main } from "./main.ts";
31
- export { InteractiveMode, type InteractiveModeOptions, type JsonAgentSessionEvent, type ModelInfo, type PrintModeOptions, RpcClient, type RpcClientOptions, type RpcCommand, type RpcEventListener, type RpcExtensionUIRequest, type RpcExtensionUIResponse, type RpcResponse, type RpcSessionState, runPrintMode, runRpcMode, } from "./modes/index.ts";
36
+ export { InteractiveMode, type InteractiveModeOptions, type JsonAgentSessionEvent, type ModelInfo, type PrintModeOptions, RpcClient, type RpcClientOptions, type RpcCommand, type RpcEventListener, type RpcExitListener, type RpcExtensionUIRequest, type RpcExtensionUIResponse, type RpcHostRequest, type RpcHostRequestHandler, type RpcHostResponse, type RpcProcessExit, type RpcResponse, type RpcSessionState, runPrintMode, runRpcMode, } from "./modes/index.ts";
32
37
  export { ArminComponent, AssistantMessageComponent, BashExecutionComponent, BorderedLoader, BranchSummaryMessageComponent, CompactionSummaryMessageComponent, CustomEditor, type CustomEditorOptions, 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.ts";
33
38
  export { getLanguageFromPath, getMarkdownTheme, getSelectListTheme, getSettingsListTheme, highlightCode, initTheme, Theme, type ThemeColor, } from "./modes/interactive/theme/theme.ts";
34
39
  export { copyToClipboard } from "./utils/clipboard.ts";
@@ -36,4 +41,4 @@ export { parseFrontmatter, stripFrontmatter } from "./utils/frontmatter.ts";
36
41
  export { convertToPng } from "./utils/image-convert.ts";
37
42
  export { formatDimensionNote, type ResizedImage, resizeImage } from "./utils/image-resize.ts";
38
43
  export { detectSupportedImageMimeTypeFromFile } from "./utils/mime.ts";
39
- export { getPowerShellConfig, getShellConfig } from "./utils/shell.ts";
44
+ export { getPowerShellConfig, getShellConfig, getShellEnv } from "./utils/shell.ts";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{parseArgs as t}from"./cli/args.js";import{CONFIG_DIR_NAME as n,getAgentDir as i,getDocsPath as a,getExamplesPath as s,getPackageDir as l,getReadmePath as m,SHARED_SKILL_CONFIG_DIRS as p,VERSION as c}from"./config.js";import{AgentSession as g,parseSkillBlock as T}from"./core/agent-session.js";import{readStoredCredential as f}from"./core/auth-storage.js";import{calculateContextTokens as C,collectEntriesForBranchSummary as x,compact as E,DEFAULT_COMPACTION_SETTINGS as h,estimateTokens as R,findCutPoint as D,findTurnStartIndex as M,generateBranchSummary as L,generateSummary as P,generateSummaryWithUsage as A,getLastAssistantUsage as y,prepareBranchEntries as F,serializeConversation as I,shouldCompact as _}from"./core/compaction/index.js";import{createEventBus as B}from"./core/event-bus.js";import{createExtensionRuntime as N,defineTool as w,discoverAndLoadExtensions as O,ExtensionRunner as U,isBashToolResult as G,isEditToolResult as j,isFindToolResult as b,isGrepToolResult as H,isLsToolResult as W,isPowerShellToolResult as z,isReadToolResult as V,isToolCallEventType as X,isWriteToolResult as K,wrapRegisteredTool as q,wrapRegisteredTools as Q}from"./core/extensions/index.js";import{convertToLlm as J}from"./core/messages.js";import{ModelRegistry as $}from"./core/model-registry.js";import{resolveCliModel as oe,resolveModelScopeWithDiagnostics as te}from"./core/model-resolver.js";import{CredentialSynchronizationError as ne,ModelRuntime as ie}from"./core/model-runtime.js";import{DefaultPackageManager as se}from"./core/package-manager.js";import{buildProjectMap as me,formatProjectMapPrompt as pe}from"./core/project-map.js";import{DefaultResourceLoader as Se,loadProjectContextFiles as ge}from"./core/resource-loader.js";import{AgentSessionRuntime as de,createAgentSession as fe,createAgentSessionFromServices as ue,createAgentSessionRuntime as Ce,createAgentSessionServices as xe,createBashTool as Ee,createCodingTools as he,createEditTool as Re,createFindTool as De,createGrepTool as Me,createLsTool as Le,createPowerShellTool as Pe,createReadOnlyTools as Ae,createReadTool as ye,createWriteTool as Fe}from"./core/sdk.js";import{buildContextEntries as _e,buildSessionContext as ke,buildSessionProjection as Be,CURRENT_SESSION_VERSION as ve,getLatestCompactionEntry as Ne,migrateSessionEntries as we,parseSessionEntries as Oe,SessionManager as Ue,sessionEntryToContextMessages as Ge}from"./core/session-manager.js";import{SettingsManager as be}from"./core/settings-manager.js";import{formatSkillsForPrompt as We,loadSkills as ze,loadSkillsFromDir as Ve}from"./core/skills.js";import{createSyntheticSourceInfo as Ke}from"./core/source-info.js";import{generateDiffString as Qe,generateUnifiedPatch as Ye}from"./core/tools/edit-diff.js";import{createBashToolDefinition as Ze,createEditToolDefinition as $e,createFindToolDefinition as eo,createGrepToolDefinition as oo,createLocalBashOperations as to,createLocalPowerShellOperations as ro,createLsToolDefinition as no,createPowerShellToolDefinition as io,createReadToolDefinition as ao,createWriteToolDefinition as so,DEFAULT_MAX_BYTES as lo,DEFAULT_MAX_LINES as mo,formatSize as po,registerShellExecutionGuard as co,truncateHead as So,truncateLine as go,truncateTail as To,withFileMutationQueue as fo}from"./core/tools/index.js";import{hasTrustRequiringProjectResources as Co,ProjectTrustStore as xo}from"./core/trust-manager.js";import{applyShellEnvironmentPolicy as ho,DEFAULT_SHELL_ENV_EXCLUDES as Ro,isDalCodeCredentialName as Do,withoutDalCodeCredentials as Mo}from"./dal/child-env.js";export*from"./dal/hooks/index.js";import{main as Ao}from"./main.js";import{InteractiveMode as Fo,RpcClient as Io,runPrintMode as _o,runRpcMode as ko}from"./modes/index.js";import{ArminComponent as vo,AssistantMessageComponent as No,BashExecutionComponent as wo,BorderedLoader as Oo,BranchSummaryMessageComponent as Uo,CompactionSummaryMessageComponent as Go,CustomEditor as jo,CustomMessageComponent as bo,DynamicBorder as Ho,ExtensionEditorComponent as Wo,ExtensionInputComponent as zo,ExtensionSelectorComponent as Vo,FooterComponent as Xo,keyHint as Ko,keyText as qo,LoginDialogComponent as Qo,ModelSelectorComponent as Yo,OAuthSelectorComponent as Jo,rawKeyHint as Zo,renderDiff as $o,SessionSelectorComponent as et,SettingsSelectorComponent as ot,ShowImagesSelectorComponent as tt,SkillInvocationMessageComponent as rt,ThemeSelectorComponent as nt,ThinkingSelectorComponent as it,ToolExecutionComponent as at,TreeSelectorComponent as st,truncateToVisualLines as lt,UserMessageComponent as mt,UserMessageSelectorComponent as pt}from"./modes/interactive/components/index.js";import{getLanguageFromPath as St,getMarkdownTheme as gt,getSelectListTheme as Tt,getSettingsListTheme as dt,highlightCode as ft,initTheme as ut,Theme as Ct}from"./modes/interactive/theme/theme.js";import{copyToClipboard as Et}from"./utils/clipboard.js";import{parseFrontmatter as Rt,stripFrontmatter as Dt}from"./utils/frontmatter.js";import{convertToPng as Lt}from"./utils/image-convert.js";import{formatDimensionNote as At,resizeImage as yt}from"./utils/image-resize.js";import{detectSupportedImageMimeTypeFromFile as It}from"./utils/mime.js";import{getPowerShellConfig as kt,getShellConfig as Bt}from"./utils/shell.js";export{g as AgentSession,de as AgentSessionRuntime,vo as ArminComponent,No as AssistantMessageComponent,wo as BashExecutionComponent,Oo as BorderedLoader,Uo as BranchSummaryMessageComponent,n as CONFIG_DIR_NAME,ve as CURRENT_SESSION_VERSION,Go as CompactionSummaryMessageComponent,ne as CredentialSynchronizationError,jo as CustomEditor,bo as CustomMessageComponent,h as DEFAULT_COMPACTION_SETTINGS,lo as DEFAULT_MAX_BYTES,mo as DEFAULT_MAX_LINES,Ro as DEFAULT_SHELL_ENV_EXCLUDES,se as DefaultPackageManager,Se as DefaultResourceLoader,Ho as DynamicBorder,Wo as ExtensionEditorComponent,zo as ExtensionInputComponent,U as ExtensionRunner,Vo as ExtensionSelectorComponent,Xo as FooterComponent,Fo as InteractiveMode,Qo as LoginDialogComponent,$ as ModelRegistry,ie as ModelRuntime,Yo as ModelSelectorComponent,Jo as OAuthSelectorComponent,xo as ProjectTrustStore,Io as RpcClient,p as SHARED_SKILL_CONFIG_DIRS,Ue as SessionManager,et as SessionSelectorComponent,be as SettingsManager,ot as SettingsSelectorComponent,tt as ShowImagesSelectorComponent,rt as SkillInvocationMessageComponent,Ct as Theme,nt as ThemeSelectorComponent,it as ThinkingSelectorComponent,at as ToolExecutionComponent,st as TreeSelectorComponent,mt as UserMessageComponent,pt as UserMessageSelectorComponent,c as VERSION,ho as applyShellEnvironmentPolicy,_e as buildContextEntries,me as buildProjectMap,ke as buildSessionContext,Be as buildSessionProjection,C as calculateContextTokens,x as collectEntriesForBranchSummary,E as compact,J as convertToLlm,Lt as convertToPng,Et as copyToClipboard,fe as createAgentSession,ue as createAgentSessionFromServices,Ce as createAgentSessionRuntime,xe as createAgentSessionServices,Ee as createBashTool,Ze as createBashToolDefinition,he as createCodingTools,Re as createEditTool,$e as createEditToolDefinition,B as createEventBus,N as createExtensionRuntime,De as createFindTool,eo as createFindToolDefinition,Me as createGrepTool,oo as createGrepToolDefinition,to as createLocalBashOperations,ro as createLocalPowerShellOperations,Le as createLsTool,no as createLsToolDefinition,Pe as createPowerShellTool,io as createPowerShellToolDefinition,Ae as createReadOnlyTools,ye as createReadTool,ao as createReadToolDefinition,Ke as createSyntheticSourceInfo,Fe as createWriteTool,so as createWriteToolDefinition,w as defineTool,It as detectSupportedImageMimeTypeFromFile,O as discoverAndLoadExtensions,R as estimateTokens,D as findCutPoint,M as findTurnStartIndex,At as formatDimensionNote,pe as formatProjectMapPrompt,po as formatSize,We as formatSkillsForPrompt,L as generateBranchSummary,Qe as generateDiffString,P as generateSummary,A as generateSummaryWithUsage,Ye as generateUnifiedPatch,i as getAgentDir,a as getDocsPath,s as getExamplesPath,St as getLanguageFromPath,y as getLastAssistantUsage,Ne as getLatestCompactionEntry,gt as getMarkdownTheme,l as getPackageDir,kt as getPowerShellConfig,m as getReadmePath,Tt as getSelectListTheme,dt as getSettingsListTheme,Bt as getShellConfig,Co as hasTrustRequiringProjectResources,ft as highlightCode,ut as initTheme,G as isBashToolResult,Do as isDalCodeCredentialName,j as isEditToolResult,b as isFindToolResult,H as isGrepToolResult,W as isLsToolResult,z as isPowerShellToolResult,V as isReadToolResult,X as isToolCallEventType,K as isWriteToolResult,Ko as keyHint,qo as keyText,ge as loadProjectContextFiles,ze as loadSkills,Ve as loadSkillsFromDir,Ao as main,we as migrateSessionEntries,t as parseArgs,Rt as parseFrontmatter,Oe as parseSessionEntries,T as parseSkillBlock,F as prepareBranchEntries,Zo as rawKeyHint,f as readStoredCredential,co as registerShellExecutionGuard,$o as renderDiff,yt as resizeImage,oe as resolveCliModel,te as resolveModelScopeWithDiagnostics,_o as runPrintMode,ko as runRpcMode,I as serializeConversation,Ge as sessionEntryToContextMessages,_ as shouldCompact,Dt as stripFrontmatter,So as truncateHead,go as truncateLine,To as truncateTail,lt as truncateToVisualLines,fo as withFileMutationQueue,Mo as withoutDalCodeCredentials,q as wrapRegisteredTool,Q as wrapRegisteredTools};
1
+ import{parseArgs as t}from"./cli/args.js";import{CONFIG_DIR_NAME as n,getAgentDir as i,getDocsPath as a,getExamplesPath as s,getPackageDir as l,getReadmePath as m,SHARED_SKILL_CONFIG_DIRS as c,VERSION as p}from"./config.js";import{AgentSession as g,parseSkillBlock as d}from"./core/agent-session.js";import{readStoredCredential as f}from"./core/auth-storage.js";import{BackgroundProcessManager as C,MAX_BACKGROUND_PROCESSES as x}from"./core/background-processes.js";import{calculateContextTokens as h,collectEntriesForBranchSummary as R,compact as D,DEFAULT_COMPACTION_SETTINGS as P,estimateTokens as A,findCutPoint as M,findTurnStartIndex as L,generateBranchSummary as _,generateSummary as y,generateSummaryWithUsage as I,getLastAssistantUsage as F,prepareBranchEntries as N,serializeConversation as O,shouldCompact as B}from"./core/compaction/index.js";import{createEventBus as k}from"./core/event-bus.js";import{createExtensionRuntime as b,defineTool as U,discoverAndLoadExtensions as w,ExtensionRunner as G,isBashToolResult as V,isEditToolResult as j,isFindToolResult as K,isGrepToolResult as W,isLsToolResult as X,isPowerShellToolResult as z,isReadToolResult as q,isToolCallEventType as Q,isWriteToolResult as Y,wrapRegisteredTool as J,wrapRegisteredTools as Z}from"./core/extensions/index.js";import{getHostCapabilities as ee,HOST_CAPABILITIES_ENV as oe,HOST_TOKEN_ENV as te,HOST_TOKEN_HEADER as re,HOST_URL_ENV as ne,HostCallError as ie,HostCapabilities as ae,parseHostCapabilities as se}from"./core/host-capabilities.js";import{convertToLlm as me}from"./core/messages.js";import{ModelRegistry as pe}from"./core/model-registry.js";import{resolveCliModel as ge,resolveModelScopeWithDiagnostics as de}from"./core/model-resolver.js";import{CredentialSynchronizationError as fe,ModelRuntime as ue}from"./core/model-runtime.js";import{DefaultPackageManager as xe}from"./core/package-manager.js";import{buildRuleSet as he,matchPermissionRules as Re,parsePermissionRule as De}from"./core/permissions/rules.js";import{evaluateToolPolicy as Ae,readAccessDenial as Me,registerPermissionAskHandler as Le}from"./core/permissions/tool-policy.js";import{buildProjectMap as ye,formatProjectMapPrompt as Ie}from"./core/project-map.js";import{DefaultResourceLoader as Ne,loadProjectContextFiles as Oe}from"./core/resource-loader.js";import{detectSandboxAvailability as ve,registerSandboxEscalationHandler as ke,resolveSandboxPolicy as He,SANDBOX_ENV as be,ShellSandbox as Ue}from"./core/sandbox/index.js";import{AgentSessionRuntime as Ge,createAgentSession as Ve,createAgentSessionFromServices as je,createAgentSessionRuntime as Ke,createAgentSessionServices as We,createBashTool as Xe,createCodingTools as ze,createEditTool as qe,createFindTool as Qe,createGrepTool as Ye,createLsTool as Je,createPowerShellTool as Ze,createReadOnlyTools as $e,createReadTool as eo,createWriteTool as oo}from"./core/sdk.js";import{buildContextEntries as ro,buildSessionContext as no,buildSessionProjection as io,CURRENT_SESSION_VERSION as ao,getLatestCompactionEntry as so,migrateSessionEntries as lo,parseSessionEntries as mo,SessionManager as co,sessionEntryToContextMessages as po}from"./core/session-manager.js";import{SettingsManager as go}from"./core/settings-manager.js";import{formatSkillsForPrompt as fo,loadSkills as uo,loadSkillsFromDir as Co}from"./core/skills.js";import{createSyntheticSourceInfo as Eo}from"./core/source-info.js";import{generateDiffString as Ro,generateUnifiedPatch as Do}from"./core/tools/edit-diff.js";import{createBashToolDefinition as Ao,createEditToolDefinition as Mo,createFindToolDefinition as Lo,createGrepToolDefinition as _o,createLocalBashOperations as yo,createLocalPowerShellOperations as Io,createLsToolDefinition as Fo,createPowerShellToolDefinition as No,createProcessToolDefinition as Oo,createReadToolDefinition as Bo,createWriteToolDefinition as vo,DEFAULT_MAX_BYTES as ko,DEFAULT_MAX_LINES as Ho,formatSize as bo,registerShellExecutionGuard as Uo,truncateHead as wo,truncateLine as Go,truncateTail as Vo,withFileMutationQueue as jo}from"./core/tools/index.js";import{hasTrustRequiringProjectResources as Wo,ProjectTrustStore as Xo}from"./core/trust-manager.js";import{applyShellEnvironmentPolicy as qo,DEFAULT_SHELL_ENV_EXCLUDES as Qo,isDalCodeCredentialName as Yo,withoutDalCodeCredentials as Jo}from"./dal/child-env.js";export*from"./dal/hooks/index.js";import{main as et}from"./main.js";import{InteractiveMode as tt,RpcClient as rt,runPrintMode as nt,runRpcMode as it}from"./modes/index.js";import{ArminComponent as st,AssistantMessageComponent as lt,BashExecutionComponent as mt,BorderedLoader as ct,BranchSummaryMessageComponent as pt,CompactionSummaryMessageComponent as St,CustomEditor as gt,CustomMessageComponent as dt,DynamicBorder as Tt,ExtensionEditorComponent as ft,ExtensionInputComponent as ut,ExtensionSelectorComponent as Ct,FooterComponent as xt,keyHint as Et,keyText as ht,LoginDialogComponent as Rt,ModelSelectorComponent as Dt,OAuthSelectorComponent as Pt,rawKeyHint as At,renderDiff as Mt,SessionSelectorComponent as Lt,SettingsSelectorComponent as _t,ShowImagesSelectorComponent as yt,SkillInvocationMessageComponent as It,ThemeSelectorComponent as Ft,ThinkingSelectorComponent as Nt,ToolExecutionComponent as Ot,TreeSelectorComponent as Bt,truncateToVisualLines as vt,UserMessageComponent as kt,UserMessageSelectorComponent as Ht}from"./modes/interactive/components/index.js";import{getLanguageFromPath as Ut,getMarkdownTheme as wt,getSelectListTheme as Gt,getSettingsListTheme as Vt,highlightCode as jt,initTheme as Kt,Theme as Wt}from"./modes/interactive/theme/theme.js";import{copyToClipboard as zt}from"./utils/clipboard.js";import{parseFrontmatter as Qt,stripFrontmatter as Yt}from"./utils/frontmatter.js";import{convertToPng as Zt}from"./utils/image-convert.js";import{formatDimensionNote as er,resizeImage as or}from"./utils/image-resize.js";import{detectSupportedImageMimeTypeFromFile as rr}from"./utils/mime.js";import{getPowerShellConfig as ir,getShellConfig as ar,getShellEnv as sr}from"./utils/shell.js";export{g as AgentSession,Ge as AgentSessionRuntime,st as ArminComponent,lt as AssistantMessageComponent,C as BackgroundProcessManager,mt as BashExecutionComponent,ct as BorderedLoader,pt as BranchSummaryMessageComponent,n as CONFIG_DIR_NAME,ao as CURRENT_SESSION_VERSION,St as CompactionSummaryMessageComponent,fe as CredentialSynchronizationError,gt as CustomEditor,dt as CustomMessageComponent,P as DEFAULT_COMPACTION_SETTINGS,ko as DEFAULT_MAX_BYTES,Ho as DEFAULT_MAX_LINES,Qo as DEFAULT_SHELL_ENV_EXCLUDES,xe as DefaultPackageManager,Ne as DefaultResourceLoader,Tt as DynamicBorder,ft as ExtensionEditorComponent,ut as ExtensionInputComponent,G as ExtensionRunner,Ct as ExtensionSelectorComponent,xt as FooterComponent,oe as HOST_CAPABILITIES_ENV,te as HOST_TOKEN_ENV,re as HOST_TOKEN_HEADER,ne as HOST_URL_ENV,ie as HostCallError,ae as HostCapabilities,tt as InteractiveMode,Rt as LoginDialogComponent,x as MAX_BACKGROUND_PROCESSES,pe as ModelRegistry,ue as ModelRuntime,Dt as ModelSelectorComponent,Pt as OAuthSelectorComponent,Xo as ProjectTrustStore,rt as RpcClient,be as SANDBOX_ENV,c as SHARED_SKILL_CONFIG_DIRS,co as SessionManager,Lt as SessionSelectorComponent,go as SettingsManager,_t as SettingsSelectorComponent,Ue as ShellSandbox,yt as ShowImagesSelectorComponent,It as SkillInvocationMessageComponent,Wt as Theme,Ft as ThemeSelectorComponent,Nt as ThinkingSelectorComponent,Ot as ToolExecutionComponent,Bt as TreeSelectorComponent,kt as UserMessageComponent,Ht as UserMessageSelectorComponent,p as VERSION,qo as applyShellEnvironmentPolicy,ro as buildContextEntries,ye as buildProjectMap,he as buildRuleSet,no as buildSessionContext,io as buildSessionProjection,h as calculateContextTokens,R as collectEntriesForBranchSummary,D as compact,me as convertToLlm,Zt as convertToPng,zt as copyToClipboard,Ve as createAgentSession,je as createAgentSessionFromServices,Ke as createAgentSessionRuntime,We as createAgentSessionServices,Xe as createBashTool,Ao as createBashToolDefinition,ze as createCodingTools,qe as createEditTool,Mo as createEditToolDefinition,k as createEventBus,b as createExtensionRuntime,Qe as createFindTool,Lo as createFindToolDefinition,Ye as createGrepTool,_o as createGrepToolDefinition,yo as createLocalBashOperations,Io as createLocalPowerShellOperations,Je as createLsTool,Fo as createLsToolDefinition,Ze as createPowerShellTool,No as createPowerShellToolDefinition,Oo as createProcessToolDefinition,$e as createReadOnlyTools,eo as createReadTool,Bo as createReadToolDefinition,Eo as createSyntheticSourceInfo,oo as createWriteTool,vo as createWriteToolDefinition,U as defineTool,ve as detectSandboxAvailability,rr as detectSupportedImageMimeTypeFromFile,w as discoverAndLoadExtensions,A as estimateTokens,Ae as evaluateToolPolicy,M as findCutPoint,L as findTurnStartIndex,er as formatDimensionNote,Ie as formatProjectMapPrompt,bo as formatSize,fo as formatSkillsForPrompt,_ as generateBranchSummary,Ro as generateDiffString,y as generateSummary,I as generateSummaryWithUsage,Do as generateUnifiedPatch,i as getAgentDir,a as getDocsPath,s as getExamplesPath,ee as getHostCapabilities,Ut as getLanguageFromPath,F as getLastAssistantUsage,so as getLatestCompactionEntry,wt as getMarkdownTheme,l as getPackageDir,ir as getPowerShellConfig,m as getReadmePath,Gt as getSelectListTheme,Vt as getSettingsListTheme,ar as getShellConfig,sr as getShellEnv,Wo as hasTrustRequiringProjectResources,jt as highlightCode,Kt as initTheme,V as isBashToolResult,Yo as isDalCodeCredentialName,j as isEditToolResult,K as isFindToolResult,W as isGrepToolResult,X as isLsToolResult,z as isPowerShellToolResult,q as isReadToolResult,Q as isToolCallEventType,Y as isWriteToolResult,Et as keyHint,ht as keyText,Oe as loadProjectContextFiles,uo as loadSkills,Co as loadSkillsFromDir,et as main,Re as matchPermissionRules,lo as migrateSessionEntries,t as parseArgs,Qt as parseFrontmatter,se as parseHostCapabilities,De as parsePermissionRule,mo as parseSessionEntries,d as parseSkillBlock,N as prepareBranchEntries,At as rawKeyHint,Me as readAccessDenial,f as readStoredCredential,Le as registerPermissionAskHandler,ke as registerSandboxEscalationHandler,Uo as registerShellExecutionGuard,Mt as renderDiff,or as resizeImage,ge as resolveCliModel,de as resolveModelScopeWithDiagnostics,He as resolveSandboxPolicy,nt as runPrintMode,it as runRpcMode,O as serializeConversation,po as sessionEntryToContextMessages,B as shouldCompact,Yt as stripFrontmatter,wo as truncateHead,Go as truncateLine,Vo as truncateTail,vt as truncateToVisualLines,jo as withFileMutationQueue,Jo as withoutDalCodeCredentials,J as wrapRegisteredTool,Z as wrapRegisteredTools};