dal-code 1.0.32 → 1.0.34

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 (103) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/NOTICE +8 -0
  3. package/dist/core/agent-session.d.ts +3 -0
  4. package/dist/core/agent-session.js +8 -8
  5. package/dist/core/bash-executor.js +1 -1
  6. package/dist/core/bug-report.js +4 -4
  7. package/dist/core/compaction/branch-summarization.js +2 -2
  8. package/dist/core/compaction/compaction.d.ts +4 -2
  9. package/dist/core/compaction/compaction.js +13 -13
  10. package/dist/core/compaction/index.d.ts +1 -0
  11. package/dist/core/compaction/index.js +1 -1
  12. package/dist/core/compaction/tool-output-pruning.d.ts +19 -0
  13. package/dist/core/compaction/tool-output-pruning.js +7 -0
  14. package/dist/core/compaction/utils.d.ts +1 -0
  15. package/dist/core/compaction/utils.js +9 -9
  16. package/dist/core/sdk.js +1 -1
  17. package/dist/core/settings-manager.d.ts +11 -2
  18. package/dist/core/settings-manager.js +1 -1
  19. package/dist/core/source-info.d.ts +1 -0
  20. package/dist/core/source-info.js +1 -1
  21. package/dist/core/system-prompt.d.ts +3 -0
  22. package/dist/core/system-prompt.js +19 -13
  23. package/dist/core/tools/bash.d.ts +1 -1
  24. package/dist/core/tools/bash.js +19 -15
  25. package/dist/core/tools/output-accumulator.js +3 -3
  26. package/dist/core/tools/output-condense.js +3 -0
  27. package/dist/core/tools/powershell.d.ts +1 -1
  28. package/dist/core/tools/powershell.js +1 -1
  29. package/dist/dal/manifest.js +1 -1
  30. package/dist/modes/interactive/interactive-mode.js +13 -13
  31. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  32. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  33. package/dist/node_modules/@dalcode/dal-goal/LICENSE +45 -0
  34. package/dist/node_modules/@dalcode/dal-goal/package.json +35 -0
  35. package/dist/node_modules/@dalcode/dal-goal/src/core.js +10 -0
  36. package/dist/node_modules/@dalcode/dal-goal/src/index.js +7 -0
  37. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  38. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  39. package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
  40. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  41. package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -3
  42. package/dist/node_modules/@dalcode/dal-lsp/src/checkers.js +4 -0
  43. package/dist/node_modules/@dalcode/dal-lsp/src/index.js +8 -6
  44. package/dist/node_modules/@dalcode/dal-mcp/package.json +5 -5
  45. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  46. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +3 -2
  47. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  48. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +3 -2
  49. package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -2
  50. package/dist/node_modules/@dalcode/dal-plugins/src/brand.d.ts +17 -0
  51. package/dist/node_modules/@dalcode/dal-plugins/src/brand.js +1 -1
  52. package/dist/node_modules/@dalcode/dal-plugins/src/index.js +12 -8
  53. package/dist/node_modules/@dalcode/dal-plugins/src/manage.js +8 -8
  54. package/dist/node_modules/@dalcode/dal-plugins/src/market.js +4 -0
  55. package/dist/node_modules/@dalcode/dal-plugins/src/settings.js +1 -1
  56. package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
  57. package/dist/node_modules/@dalcode/dal-rewind/LICENSE +24 -0
  58. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  59. package/dist/node_modules/@dalcode/dal-router/package.json +4 -4
  60. package/dist/node_modules/@dalcode/dal-router/src/index.js +4 -4
  61. package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
  62. package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
  63. package/dist/node_modules/@dalcode/dal-subagent/src/index.js +14 -13
  64. package/dist/node_modules/@dalcode/dal-subagent/src/process-runner.js +3 -3
  65. package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
  66. package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
  67. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  68. package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
  69. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  70. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  71. package/dist/node_modules/@dalcode/deepailab/src/index.js +3 -3
  72. package/dist/node_modules/@earendil-works/chord/package.json +1 -1
  73. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  74. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  75. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  76. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  77. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  78. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +1 -0
  79. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +1 -1
  80. package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
  81. package/dist/node_modules/@earendil-works/pi-client/package.json +3 -3
  82. package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
  83. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  84. package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
  85. package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
  86. package/dist/node_modules/@earendil-works/pi-server/package.json +3 -3
  87. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  88. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  89. package/dist/sdk/index.d.ts +1 -0
  90. package/dist/sdk/index.js +1 -1
  91. package/dist/utils/clipboard-image.js +1 -1
  92. package/dist/utils/clipboard.js +1 -1
  93. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  94. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  95. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  96. package/examples/extensions/gondolin/package-lock.json +2 -2
  97. package/examples/extensions/gondolin/package.json +1 -1
  98. package/examples/extensions/sandbox/package-lock.json +2 -2
  99. package/examples/extensions/sandbox/package.json +1 -1
  100. package/examples/extensions/with-deps/package-lock.json +2 -2
  101. package/examples/extensions/with-deps/package.json +1 -1
  102. package/npm-shrinkwrap.json +2 -2
  103. package/package.json +1 -1
@@ -1,21 +1,25 @@
1
- var pe=Object.defineProperty;var l=(t,e)=>pe(t,"name",{value:e,configurable:!0});import{constants as fe}from"node:fs";import{access as he}from"node:fs/promises";import{constants as we}from"node:os";import{ToolExecutionError as Se}from"@earendil-works/pi-agent-core";import{Container as be,Text as F,truncateToWidth as xe}from"@earendil-works/pi-tui";import{spawn as Oe}from"child_process";import{Type as m}from"typebox";import{fill as v,t as E}from"../../dal/i18n.js";import{keyHint as Ee}from"../../modes/interactive/components/keybinding-hints.js";import{truncateToVisualLines as _e}from"../../modes/interactive/components/visual-truncate.js";import{theme as S}from"../../modes/interactive/theme/theme.js";import{waitForChildProcess as $e}from"../../utils/child-process.js";import{getShellConfig as Q,getShellEnv as Z,killProcessTree as ee,trackDetachedChildPid as ye,untrackDetachedChildPid as Te}from"../../utils/shell.js";import{describeDenialForModel as Pe}from"../sandbox/denial.js";import{getProcessShellSandbox as ge}from"../sandbox/shell-sandbox.js";import{isReadOnlyBashCommand as Ce}from"./bash-read-only.js";import{OutputAccumulator as Le}from"./output-accumulator.js";import{countOutputLines as ve,formatCollapsedSummary as Ie,getTextOutput as te,invalidArgText as De,str as ne,truncateDisplay as Ae}from"./render-utils.js";import{wrapToolDefinition as Fe}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as G,DEFAULT_MAX_LINES as Me,formatSize as N}from"./truncate.js";const ie=2147483647,ke=1024*1024,Ne=ie/1e3,oe=12e4;function Be(t){if(t===void 0)return oe;if(!Number.isFinite(t)||t<=0)throw new Error("Invalid timeout: must be a finite number of seconds");const e=t*1e3;if(e>ie)throw new Error(`Invalid timeout: maximum is ${Ne} seconds`);return e}l(Be,"resolveTimeoutMs");const se=m.Object({command:m.String({description:"Shell command to execute"}),description:m.String({description:`One short line, in the user's language, saying what this command does and why \u2014 shown in place of the command itself. Describe the intent, not the syntax: "Find hardcoded key names", not "run grep with --exclude-dir". 3-10 words.`}),timeout:m.Optional(m.Number({description:"Timeout in seconds. Defaults to 120; raise it for genuinely long-running commands."}))}),Re=m.Optional(m.Object({mode:m.Union([m.Literal("allow"),m.Literal("unsandboxed")],{description:'"allow": run sandboxed with the extra domains / writable paths below. "unsandboxed": run outside the sandbox entirely.'}),justification:m.String({description:"One sentence for the user saying why this access is needed. The user must approve it."}),allow_domains:m.Optional(m.Array(m.String(),{description:"Domains to allow, e.g. registry.npmjs.org"})),allow_write:m.Optional(m.Array(m.String(),{description:"Paths to make writable"}))},{description:"Only after the sandbox blocked this command: ask the user for the access it needs. Never use it pre-emptively."})),Ue=m.Object({...se.properties,sandbox_escalation:Re}),re={snippet:"Execute bash commands (ls, grep, find, etc.)",guidelines:["You can inspect PI_* environment variables for current model and session details."]},je=m.Object({output:m.String({description:"Combined stdout and stderr, possibly truncated"}),truncated:m.Boolean(),full_output_path:m.Optional(m.String({description:"Full output, when truncated"})),exit_code:m.Number(),wall_time_seconds:m.Number()});function Ge(t,e){return{exec:l(async(i,s,{onData:u,signal:d,timeout:O,env:b})=>{const c=Be(O);if(d?.aborted)throw new Error("aborted");const x=e();try{await he(s,fe.F_OK)}catch{throw new Error(`Working directory does not exist: ${s}
2
- Cannot execute ${t} commands.`)}const p=x.commandTransport==="stdin",r=Oe(x.shell,p?x.args:[...x.args,i],{cwd:s,detached:process.platform!=="win32",env:b??Z(),stdio:[p?"pipe":"ignore","pipe","pipe"],windowsHide:!0});p&&(r.stdin?.on("error",()=>{}),r.stdin?.end(i)),r.pid&&ye(r.pid);let h=!1,n;const o=l(()=>{r.pid&&ee(r.pid)},"onAbort");try{c!==void 0&&(n=setTimeout(()=>{h=!0,r.pid&&ee(r.pid)},c)),r.stdout?.on("data",u),r.stderr?.on("data",u),d&&(d.aborted?o():d.addEventListener("abort",o,{once:!0}));const f=await $e(r);if(d?.aborted)throw new Error("aborted");if(h)throw new Error(`timeout:${(c??oe)/1e3}`);const T=r.signalCode;return{exitCode:f??(T?128+(we.signals[T]??0):1)}}finally{r.pid&&Te(r.pid),n&&clearTimeout(n),d&&d.removeEventListener("abort",o)}},"exec")}}l(Ge,"createLocalShellOperations");function We(t){return Ge("bash",()=>Q(t?.shellPath))}l(We,"createLocalBashOperations");const W=new Set;function $t(t){return W.add(t),()=>{W.delete(t)}}l($t,"registerShellExecutionGuard");async function He(t){for(const e of W){let i;try{i=await e(t)}catch(s){return`Command refused: the safety check could not run (${s instanceof Error?s.message:String(s)}).`}if(i!==void 0)return i}}l(He,"shellExecutionRefusal");function Ve(t,e,i,s,u){const d={...Z()};if(delete d.PI_SESSION_ID,delete d.PI_SESSION_FILE,delete d.PI_PROVIDER,delete d.PI_MODEL,delete d.PI_REASONING_LEVEL,s&&u){const b=u.model;d.PI_SESSION_ID=u.sessionManager.getSessionId();const c=u.sessionManager.getSessionFile();c&&(d.PI_SESSION_FILE=c),b&&(d.PI_PROVIDER=b.provider,d.PI_MODEL=b.id),u.thinkingLevel&&(d.PI_REASONING_LEVEL=u.thinkingLevel)}const O={command:t,cwd:e,env:d};return i?i(O):O}l(Ve,"resolveSpawnContext");const Xe=5,Ke=100;class Ye extends be{static{l(this,"BashResultRenderComponent")}state={cachedWidth:void 0,cachedLines:void 0,cachedSkipped:void 0}}function ze(t){const e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;const i=Math.floor(e),s=Math.floor(i/60),u=i%60;return s<60?`${s}m ${u}s`:`${Math.floor(s/60)}h ${s%60}m ${u}s`}l(ze,"formatDuration");function qe(t,e,i=!1){const s=ne(t?.command),u=ne(t?.description)?.trim(),d=t?.timeout,O=d?S.fg("muted",v(E(" (\u8D85\u65F6 {seconds} \u79D2)"),{seconds:d})):"";if(u){const c=S.fg("toolTitle",S.bold(u))+O;return!i||!s?c:`${c}
3
- ${S.fg("muted",` \u23BF ${e} ${s.trim()}`)}`}const b=s===null?De(S):s?S.fg("dim",Ae(s.replace(/\s+/g," ").trim(),42)):S.fg("dim","\u2026");return`${S.fg("toolTitle",S.bold(e))} ${b}${O}`}l(qe,"formatShellCall");function Je(t,e,i,s,u,d,O,b){const c=t.state;t.clear();const x=Qe(i,u,d,b);if(!i.expanded&&!O){const n=te(e,s),o=ve(n),f=[];o>0&&f.push(v(E("{count} \u884C"),{count:o})),x&&f.push(x);const T=Ie(S,f);T&&t.addChild(new F(T,0,0));return}let p=te(e,s).trim();const r=e.details?.truncation,h=e.details?.fullOutputPath;if(!i.isPartial&&r?.truncated&&h&&p.endsWith("]")){const n=p.lastIndexOf(`
1
+ var he=Object.defineProperty;var u=(t,e)=>he(t,"name",{value:e,configurable:!0});import{constants as Se}from"node:fs";import{access as we}from"node:fs/promises";import{constants as be}from"node:os";import{ToolExecutionError as xe}from"@earendil-works/pi-agent-core";import{Container as Oe,Text as k,truncateToWidth as Ee}from"@earendil-works/pi-tui";import{spawn as _e}from"child_process";import{Type as m}from"typebox";import{fill as I,t as $}from"../../dal/i18n.js";import{keyHint as $e}from"../../modes/interactive/components/keybinding-hints.js";import{truncateToVisualLines as ye}from"../../modes/interactive/components/visual-truncate.js";import{theme as w}from"../../modes/interactive/theme/theme.js";import{waitForChildProcess as Pe}from"../../utils/child-process.js";import{writeOutputFile as Le}from"../../utils/output-files.js";import{getShellConfig as ee,getShellEnv as te,killProcessTree as ne,trackDetachedChildPid as Te,untrackDetachedChildPid as Ce}from"../../utils/shell.js";import{describeDenialForModel as ge}from"../sandbox/denial.js";import{getProcessShellSandbox as ve}from"../sandbox/shell-sandbox.js";import{isReadOnlyBashCommand as Ie}from"./bash-read-only.js";import{OutputAccumulator as De}from"./output-accumulator.js";import{condenseShellOutput as Ae,outputCondenseDisabled as Fe}from"./output-condense.js";import{countOutputLines as Me,formatCollapsedSummary as Ne,getTextOutput as oe,invalidArgText as ke,str as ie,truncateDisplay as Re}from"./render-utils.js";import{wrapToolDefinition as Be}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as V,DEFAULT_MAX_LINES as Ue,formatSize as R}from"./truncate.js";const se=2147483647,Ge=1024*1024,je=se/1e3,re=12e4;function Ve(t){if(t===void 0)return re;if(!Number.isFinite(t)||t<=0)throw new Error("Invalid timeout: must be a finite number of seconds");const e=t*1e3;if(e>se)throw new Error(`Invalid timeout: maximum is ${je} seconds`);return e}u(Ve,"resolveTimeoutMs");const ae=m.Object({command:m.String({description:"Shell command to execute"}),description:m.String({description:`One short line, in the user's language, saying what this command does and why \u2014 shown in place of the command itself. Describe the intent, not the syntax: "Find hardcoded key names", not "run grep with --exclude-dir". 3-10 words.`}),timeout:m.Optional(m.Number({description:"Timeout in seconds. Defaults to 120; raise it for genuinely long-running commands."}))}),We=m.Optional(m.Object({mode:m.Union([m.Literal("allow"),m.Literal("unsandboxed")],{description:'"allow": run sandboxed with the extra domains / writable paths below. "unsandboxed": run outside the sandbox entirely.'}),justification:m.String({description:"One sentence for the user saying why this access is needed. The user must approve it."}),allow_domains:m.Optional(m.Array(m.String(),{description:"Domains to allow, e.g. registry.npmjs.org"})),allow_write:m.Optional(m.Array(m.String(),{description:"Paths to make writable"}))},{description:"Only after the sandbox blocked this command: ask the user for the access it needs. Never use it pre-emptively."})),He=m.Object({...ae.properties,sandbox_escalation:We}),de={snippet:"Execute bash commands (ls, grep, find, etc.)",guidelines:["You can inspect DAL_* environment variables for current model and session details."]},Xe=m.Object({output:m.String({description:"Combined stdout and stderr, possibly truncated"}),truncated:m.Boolean(),full_output_path:m.Optional(m.String({description:"Full output, when truncated"})),exit_code:m.Number(),wall_time_seconds:m.Number()});function Ke(t,e){return{exec:u(async(o,s,{onData:c,signal:a,timeout:O,env:h})=>{const l=Ve(O);if(a?.aborted)throw new Error("aborted");const x=e();try{await we(s,Se.F_OK)}catch{throw new Error(`Working directory does not exist: ${s}
2
+ Cannot execute ${t} commands.`)}const p=x.commandTransport==="stdin",r=_e(x.shell,p?x.args:[...x.args,o],{cwd:s,detached:process.platform!=="win32",env:h??te(),stdio:[p?"pipe":"ignore","pipe","pipe"],windowsHide:!0});p&&(r.stdin?.on("error",()=>{}),r.stdin?.end(o)),r.pid&&Te(r.pid);let S=!1,n;const i=u(()=>{r.pid&&ne(r.pid)},"onAbort");try{l!==void 0&&(n=setTimeout(()=>{S=!0,r.pid&&ne(r.pid)},l)),r.stdout?.on("data",c),r.stderr?.on("data",c),a&&(a.aborted?i():a.addEventListener("abort",i,{once:!0}));const f=await Pe(r);if(a?.aborted)throw new Error("aborted");if(S)throw new Error(`timeout:${(l??re)/1e3}`);const L=r.signalCode;return{exitCode:f??(L?128+(be.signals[L]??0):1)}}finally{r.pid&&Ce(r.pid),n&&clearTimeout(n),a&&a.removeEventListener("abort",i)}},"exec")}}u(Ke,"createLocalShellOperations");function Ye(t){return Ke("bash",()=>ee(t?.shellPath))}u(Ye,"createLocalBashOperations");const W=new Set;function It(t){return W.add(t),()=>{W.delete(t)}}u(It,"registerShellExecutionGuard");async function ze(t){for(const e of W){let o;try{o=await e(t)}catch(s){return`Command refused: the safety check could not run (${s instanceof Error?s.message:String(s)}).`}if(o!==void 0)return o}}u(ze,"shellExecutionRefusal");const qe=["SESSION_ID","SESSION_FILE","PROVIDER","MODEL","REASONING_LEVEL"];function Je(t,e,o,s,c){const a={...te()};if(delete a.PI_SESSION_ID,delete a.PI_SESSION_FILE,delete a.PI_PROVIDER,delete a.PI_MODEL,delete a.PI_REASONING_LEVEL,s&&c){const h=c.model;a.PI_SESSION_ID=c.sessionManager.getSessionId();const l=c.sessionManager.getSessionFile();l&&(a.PI_SESSION_FILE=l),h&&(a.PI_PROVIDER=h.provider,a.PI_MODEL=h.id),c.thinkingLevel&&(a.PI_REASONING_LEVEL=c.thinkingLevel)}for(const h of qe){delete a[`DAL_${h}`];const l=a[`PI_${h}`];l!==void 0&&(a[`DAL_${h}`]=l)}const O={command:t,cwd:e,env:a};return o?o(O):O}u(Je,"resolveSpawnContext");const Qe=5,Ze=100;class et extends Oe{static{u(this,"BashResultRenderComponent")}state={cachedWidth:void 0,cachedLines:void 0,cachedSkipped:void 0}}function tt(t){const e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;const o=Math.floor(e),s=Math.floor(o/60),c=o%60;return s<60?`${s}m ${c}s`:`${Math.floor(s/60)}h ${s%60}m ${c}s`}u(tt,"formatDuration");function nt(t,e,o=!1){const s=ie(t?.command),c=ie(t?.description)?.trim(),a=t?.timeout,O=a?w.fg("muted",I($(" (\u8D85\u65F6 {seconds} \u79D2)"),{seconds:a})):"";if(c){const l=w.fg("toolTitle",w.bold(c))+O;return!o||!s?l:`${l}
3
+ ${w.fg("muted",` \u23BF ${e} ${s.trim()}`)}`}const h=s===null?ke(w):s?w.fg("dim",Re(s.replace(/\s+/g," ").trim(),42)):w.fg("dim","\u2026");return`${w.fg("toolTitle",w.bold(e))} ${h}${O}`}u(nt,"formatShellCall");function ot(t,e,o,s,c,a,O,h){const l=t.state;t.clear();const x=it(o,c,a,h);if(!o.expanded&&!O){const n=oe(e,s),i=Me(n),f=[];i>0&&f.push(I($("{count} \u884C"),{count:i})),x&&f.push(x);const L=Ne(w,f);L&&t.addChild(new k(L,0,0));return}let p=oe(e,s).trim();const r=e.details?.truncation,S=e.details?.fullOutputPath;if(!o.isPartial&&r?.truncated&&S&&p.endsWith("]")){const n=p.lastIndexOf(`
4
4
 
5
- [`);n!==-1&&p.slice(n).includes(h)&&(p=p.slice(0,n).trimEnd())}if(p){const n=p.split(`
6
- `).map(o=>S.fg("toolOutput",o)).join(`
7
- `);i.expanded?t.addChild(new F(`
8
- ${n}`,0,0)):t.addChild({render:l(o=>{if(c.cachedLines===void 0||c.cachedWidth!==o){const f=_e(n,Xe,o);c.cachedLines=f.visualLines,c.cachedSkipped=f.skippedCount,c.cachedWidth=o}if(c.cachedSkipped&&c.cachedSkipped>0){const f=S.fg("muted",v(E("... (\u524D\u9762\u8FD8\u6709 {count} \u884C\uFF0C"),{count:c.cachedSkipped}))+` ${Ee("app.tools.expand",E("\u5373\u53EF\u5C55\u5F00"))}${S.fg("muted",")")}`;return["",xe(f,o,"..."),...c.cachedLines??[]]}return["",...c.cachedLines??[]]},"render"),invalidate:l(()=>{c.cachedWidth=void 0,c.cachedLines=void 0,c.cachedSkipped=void 0},"invalidate")})}if(r?.truncated||h){const n=[];h&&n.push(v(E("\u5B8C\u6574\u8F93\u51FA\uFF1A{path}"),{path:h})),r?.truncated&&(r.truncatedBy==="lines"?n.push(v(E("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A {shown}/{total} \u884C"),{shown:r.outputLines,total:r.totalLines})):n.push(v(E("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A\u4E86 {shown} \u884C\uFF08\u4E0A\u9650 {limit}\uFF09"),{shown:r.outputLines,limit:N(r.maxBytes??G)}))),t.addChild(new F(`
9
- ${S.fg("warning",`[${n.join(". ")}]`)}`,0,0))}x&&t.addChild(new F(`
10
- ${S.fg("muted",x)}`,0,0))}l(Je,"rebuildBashResultRenderComponent");function Qe(t,e,i,s){let u;if(!t.isPartial&&s!==void 0)u=s;else if(e!==void 0)u=(i??Date.now())-e;else return;if(!(!t.isPartial&&u<100))return`${t.isPartial?E("\u5DF2\u8FD0\u884C"):E("\u8017\u65F6")} ${ze(u)}`}l(Qe,"bashTimingLabel");function Ze(t,e,i){const s=i?.operations??e.defaultOperations?.()??We({shellPath:i?.shellPath}),u=i?.commandPrefix,d=i?.exposeSessionEnvironment??!0,O=i?.spawnHook,b=i?.sandbox,c=i?.operations===void 0,x=b?.describeForModel();return{name:e.name,label:e.label,description:`Execute a ${e.shellName} command in the current working directory. Returns stdout and stderr. Output is truncated to last ${Me} lines or ${G/1024}KB (whichever is hit first). If truncated, full output is saved to a temp file. Optionally provide a timeout in seconds.${x?` ${x}`:""}`,promptSnippet:e.promptSnippet,promptGuidelines:d&&e.promptGuidelines?[...e.promptGuidelines]:void 0,executionMode:"sequential",executionModeFor:e.readOnlyCommand&&!u?p=>e.readOnlyCommand?.(p?.command)?"parallel":void 0:void 0,parameters:b?.active?Ue:se,outputSchema:je,constrainedSampling:{type:"json_schema",strict:"prefer"},async execute(p,r,h,n,o){const{command:f,timeout:T}=r;n&&n({content:[],details:void 0});const H=await He({toolName:e.name,command:f,cwd:o?.cwd||t,sessionFile:o?.sessionManager?.getSessionFile()});if(H!==void 0)throw new Error(H);const ae=u?`${u}
11
- ${f}`:f,L=Ve(ae,o?.cwd||t,O,d,o),B=b??(c?ge():void 0);let _;if(B?.active){if(!e.sandboxShell)throw new Error(`Command refused: ${e.shellName} commands cannot run inside the OS sandbox yet, and the sandbox level is "${B.level}". Use the bash tool, or the user can opt out with \`dal --sandbox off\`.`);_=await B.prepare({command:L.command,cwd:L.cwd,shell:e.sandboxShell(i?.shellPath),shellKind:e.sandboxShellKind??"bash",env:L.env,toolCallId:p,toolName:e.name,escalation:r.sandbox_escalation,ctx:o,signal:h})}const P=new Le({tempFilePrefix:e.tempFilePrefix});let V=!0,I,R=!1,X=0;const U=l(()=>{if(!n||!R)return;R=!1,X=Date.now();const a=P.snapshot({persistIfTruncated:!0});n({content:[{type:"text",text:a.content||""}],details:{truncation:a.truncation.truncated?a.truncation:void 0,fullOutputPath:a.fullOutputPath}})},"emitOutputUpdate"),j=l(()=>{I&&(clearTimeout(I),I=void 0)},"clearUpdateTimer"),de=l(()=>{if(!n)return;R=!0;const a=Ke-(Date.now()-X);if(a<=0){j(),U();return}I??=setTimeout(()=>{I=void 0,U()},a)},"scheduleOutputUpdate"),le=l(a=>{V&&(P.append(a),de())},"handleData"),K=l(async()=>{V=!1,P.finish(),j(),U();const a=P.snapshot({persistIfTruncated:!0});return await P.closeTempFile(),a},"finishOutput"),Y=l((a,$="(no output)")=>{const w=a.truncation;let y=a.content||$,A;if(w.truncated){A={truncation:w,fullOutputPath:a.fullOutputPath};const M=w.totalLines-w.outputLines+1,g=w.totalLines;if(w.lastLinePartial){const k=N(P.getLastLineBytes());y+=`
5
+ [`);n!==-1&&p.slice(n).includes(S)&&(p=p.slice(0,n).trimEnd())}if(p){const n=p.split(`
6
+ `).map(i=>w.fg("toolOutput",i)).join(`
7
+ `);o.expanded?t.addChild(new k(`
8
+ ${n}`,0,0)):t.addChild({render:u(i=>{if(l.cachedLines===void 0||l.cachedWidth!==i){const f=ye(n,Qe,i);l.cachedLines=f.visualLines,l.cachedSkipped=f.skippedCount,l.cachedWidth=i}if(l.cachedSkipped&&l.cachedSkipped>0){const f=w.fg("muted",I($("... (\u524D\u9762\u8FD8\u6709 {count} \u884C\uFF0C"),{count:l.cachedSkipped}))+` ${$e("app.tools.expand",$("\u5373\u53EF\u5C55\u5F00"))}${w.fg("muted",")")}`;return["",Ee(f,i,"..."),...l.cachedLines??[]]}return["",...l.cachedLines??[]]},"render"),invalidate:u(()=>{l.cachedWidth=void 0,l.cachedLines=void 0,l.cachedSkipped=void 0},"invalidate")})}if(r?.truncated||S){const n=[];S&&n.push(I($("\u5B8C\u6574\u8F93\u51FA\uFF1A{path}"),{path:S})),r?.truncated&&(r.truncatedBy==="lines"?n.push(I($("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A {shown}/{total} \u884C"),{shown:r.outputLines,total:r.totalLines})):n.push(I($("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A\u4E86 {shown} \u884C\uFF08\u4E0A\u9650 {limit}\uFF09"),{shown:r.outputLines,limit:R(r.maxBytes??V)}))),t.addChild(new k(`
9
+ ${w.fg("warning",`[${n.join(". ")}]`)}`,0,0))}x&&t.addChild(new k(`
10
+ ${w.fg("muted",x)}`,0,0))}u(ot,"rebuildBashResultRenderComponent");function it(t,e,o,s){let c;if(!t.isPartial&&s!==void 0)c=s;else if(e!==void 0)c=(o??Date.now())-e;else return;if(!(!t.isPartial&&c<100))return`${t.isPartial?$("\u5DF2\u8FD0\u884C"):$("\u8017\u65F6")} ${tt(c)}`}u(it,"bashTimingLabel");function st(t,e,o){const s=o?.operations??e.defaultOperations?.()??Ye({shellPath:o?.shellPath}),c=o?.commandPrefix,a=o?.exposeSessionEnvironment??!0,O=o?.spawnHook,h=o?.sandbox,l=o?.operations===void 0,x=h?.describeForModel();return{name:e.name,label:e.label,description:`Execute a ${e.shellName} command in the current working directory. Returns stdout and stderr. Output is truncated to last ${Ue} lines or ${V/1024}KB (whichever is hit first). If truncated, full output is saved to a temp file. Optionally provide a timeout in seconds.${x?` ${x}`:""}`,promptSnippet:e.promptSnippet,promptGuidelines:a&&e.promptGuidelines?[...e.promptGuidelines]:void 0,executionMode:"sequential",executionModeFor:e.readOnlyCommand&&!c?p=>e.readOnlyCommand?.(p?.command)?"parallel":void 0:void 0,parameters:h?.active?He:ae,outputSchema:Xe,constrainedSampling:{type:"json_schema",strict:"prefer"},async execute(p,r,S,n,i){const{command:f,timeout:L}=r;n&&n({content:[],details:void 0});const H=await ze({toolName:e.name,command:f,cwd:i?.cwd||t,sessionFile:i?.sessionManager?.getSessionFile()});if(H!==void 0)throw new Error(H);const le=c?`${c}
11
+ ${f}`:f,g=Je(le,i?.cwd||t,O,a,i),B=h??(l?ve():void 0);let y;if(B?.active){if(!e.sandboxShell)throw new Error(`Command refused: ${e.shellName} commands cannot run inside the OS sandbox yet, and the sandbox level is "${B.level}". Use the bash tool, or the user can opt out with \`dal --sandbox off\`.`);y=await B.prepare({command:g.command,cwd:g.cwd,shell:e.sandboxShell(o?.shellPath),shellKind:e.sandboxShellKind??"bash",env:g.env,toolCallId:p,toolName:e.name,escalation:r.sandbox_escalation,ctx:i,signal:S})}const T=new De({tempFilePrefix:e.tempFilePrefix});let X=!0,D,U=!1,K=0;const G=u(()=>{if(!n||!U)return;U=!1,K=Date.now();const d=T.snapshot({persistIfTruncated:!0});n({content:[{type:"text",text:d.content||""}],details:{truncation:d.truncation.truncated?d.truncation:void 0,fullOutputPath:d.fullOutputPath}})},"emitOutputUpdate"),j=u(()=>{D&&(clearTimeout(D),D=void 0)},"clearUpdateTimer"),ue=u(()=>{if(!n)return;U=!0;const d=Ze-(Date.now()-K);if(d<=0){j(),G();return}D??=setTimeout(()=>{D=void 0,G()},d)},"scheduleOutputUpdate"),ce=u(d=>{X&&(T.append(d),ue())},"handleData"),Y=u(async()=>{X=!1,T.finish(),j(),G();const d=T.snapshot({persistIfTruncated:!0});return await T.closeTempFile(),d},"finishOutput"),z=u((d,E="(no output)",P)=>{const b=d.truncation;let _=P?.text||d.content||E;P&&(_+=b.truncated?`
12
12
 
13
- [Showing last ${N(w.outputBytes)} of line ${g} (line is ${k}). Full output: ${a.fullOutputPath}]`}else w.truncatedBy==="lines"?y+=`
13
+ [Condensed: ${P.summary}.]`:`
14
14
 
15
- [Showing lines ${M}-${g} of ${w.totalLines}. Full output: ${a.fullOutputPath}]`:y+=`
15
+ [Condensed: ${P.summary}. Full output: ${P.fullOutputPath}]`);let v;if(b.truncated){v={truncation:b,fullOutputPath:d.fullOutputPath};const F=b.totalLines-b.outputLines+1,M=b.totalLines;if(b.lastLinePartial){const N=R(T.getLastLineBytes());_+=`
16
16
 
17
- [Showing lines ${M}-${g} of ${w.totalLines} (${N(G)} limit). Full output: ${a.fullOutputPath}]`}return{text:y,details:A}},"formatOutput"),D=l((a,$)=>`${a?`${a}
17
+ [Showing last ${R(b.outputBytes)} of line ${M} (line is ${N}). Full output: ${d.fullOutputPath}]`}else b.truncatedBy==="lines"?_+=`
18
18
 
19
- `:""}${$}`,"appendStatus"),ue=performance.now();try{let a;try{a=(await s.exec(_?.command??L.command,L.cwd,{onData:le,signal:h,timeout:T,env:L.env})).exitCode}catch(C){const ce=await K(),{text:J}=Y(ce,"");if(await _?.finish(null,""),C instanceof Error&&C.message==="aborted")throw new Error(D(J,"Command aborted"));if(C instanceof Error&&C.message.startsWith("timeout:")){const me=C.message.split(":")[1];throw new Error(D(J,`Command timed out after ${me} seconds`))}throw C}const $=await K(),{text:w,details:y}=Y($),A=await _?.finish(a,$.content||"");if(A&&_)throw new Se(`${D(w,`Command exited with code ${a??"(none)"}`)}
19
+ [Showing lines ${F}-${M} of ${b.totalLines}. Full output: ${d.fullOutputPath}]`:_+=`
20
20
 
21
- ${Pe(A)}`,{...y,sandbox:_.details});if(a===null)throw new Error(D(w,"Command terminated without an exit code"));const M=Math.round((performance.now()-ue)/100)/10,g=await P.readFullOutput(ke),k={output:g.content,truncated:g.truncated,...g.truncated&&$.fullOutputPath?{full_output_path:$.fullOutputPath}:{},exit_code:a,wall_time_seconds:M},z=_?.details.escalation?_.details:void 0,q=z?{...y,sandbox:z}:y;return a!==0?{content:[{type:"text",text:D(w,`Command exited with code ${a}`)}],details:q,structuredContent:k,isError:!0}:{content:[{type:"text",text:w}],details:q,structuredContent:k}}finally{j()}},renderCall(p,r,h){const n=h.state;h.executionStarted&&n.startedAt===void 0&&(n.startedAt=Date.now(),n.endedAt=void 0);const o=h.lastComponent??new F("",0,0);return o.setText(qe(p,e.prompt,h.expanded===!0)),o},renderResult(p,r,h,n){const o=n.state;o.startedAt!==void 0&&r.isPartial&&!o.interval&&(o.interval=setInterval(()=>n.invalidate(),1e3)),(!r.isPartial||n.isError)&&(o.endedAt??=Date.now(),o.interval&&(clearInterval(o.interval),o.interval=void 0));const f=n.lastComponent??new Ye;return Je(f,p,r,n.showImages,o.startedAt,o.endedAt,n.isError,n.durationMs),f.invalidate(),f}}}l(Ze,"createShellToolDefinition");const et={name:"bash",label:"bash",shellName:"bash",prompt:"$",promptSnippet:re.snippet,promptGuidelines:re.guidelines,tempFilePrefix:"pi-bash",readOnlyCommand:Ce,sandboxShell:l(t=>Q(t).shell,"sandboxShell")};function tt(t,e){return Ze(t,et,e)}l(tt,"createBashToolDefinition");function yt(t,e){const i=tt(t,e),s=Fe(i);return Object.assign(s,{promptSnippet:i.promptSnippet,promptGuidelines:i.promptGuidelines}),s}l(yt,"createBashTool");export{re as bashToolSystemPromptContribution,yt as createBashTool,tt as createBashToolDefinition,We as createLocalBashOperations,Ge as createLocalShellOperations,Ze as createShellToolDefinition,$t as registerShellExecutionGuard,Re as sandboxEscalationSchema};
21
+ [Showing lines ${F}-${M} of ${b.totalLines} (${R(V)} limit). Full output: ${d.fullOutputPath}]`}return{text:_,details:v}},"formatOutput"),A=u((d,E)=>`${d?`${d}
22
+
23
+ `:""}${E}`,"appendStatus"),me=performance.now();try{let d;try{d=(await s.exec(y?.command??g.command,g.cwd,{onData:ce,signal:S,timeout:L,env:g.env})).exitCode}catch(C){const pe=await Y(),{text:Z}=z(pe,"");if(await y?.finish(null,""),C instanceof Error&&C.message==="aborted")throw new Error(A(Z,"Command aborted"));if(C instanceof Error&&C.message.startsWith("timeout:")){const fe=C.message.split(":")[1];throw new Error(A(Z,`Command timed out after ${fe} seconds`))}throw C}const E=await Y(),P=Fe()?void 0:Ae(E.content),b=P&&{...P,fullOutputPath:E.fullOutputPath??await Le(e.tempFilePrefix,".log",E.content)},{text:_,details:v}=z(E,void 0,b),F=await y?.finish(d,E.content||"");if(F&&y)throw new xe(`${A(_,`Command exited with code ${d??"(none)"}`)}
24
+
25
+ ${ge(F)}`,{...v,sandbox:y.details});if(d===null)throw new Error(A(_,"Command terminated without an exit code"));const M=Math.round((performance.now()-me)/100)/10,N=await T.readFullOutput(Ge),q={output:N.content,truncated:N.truncated,...N.truncated&&E.fullOutputPath?{full_output_path:E.fullOutputPath}:{},exit_code:d,wall_time_seconds:M},J=y?.details.escalation?y.details:void 0,Q=J?{...v,sandbox:J}:v;return d!==0?{content:[{type:"text",text:A(_,`Command exited with code ${d}`)}],details:Q,structuredContent:q,isError:!0}:{content:[{type:"text",text:_}],details:Q,structuredContent:q}}finally{j()}},renderCall(p,r,S){const n=S.state;S.executionStarted&&n.startedAt===void 0&&(n.startedAt=Date.now(),n.endedAt=void 0);const i=S.lastComponent??new k("",0,0);return i.setText(nt(p,e.prompt,S.expanded===!0)),i},renderResult(p,r,S,n){const i=n.state;i.startedAt!==void 0&&r.isPartial&&!i.interval&&(i.interval=setInterval(()=>n.invalidate(),1e3)),(!r.isPartial||n.isError)&&(i.endedAt??=Date.now(),i.interval&&(clearInterval(i.interval),i.interval=void 0));const f=n.lastComponent??new et;return ot(f,p,r,n.showImages,i.startedAt,i.endedAt,n.isError,n.durationMs),f.invalidate(),f}}}u(st,"createShellToolDefinition");const rt={name:"bash",label:"bash",shellName:"bash",prompt:"$",promptSnippet:de.snippet,promptGuidelines:de.guidelines,tempFilePrefix:"dal-bash",readOnlyCommand:Ie,sandboxShell:u(t=>ee(t).shell,"sandboxShell")};function at(t,e){return st(t,rt,e)}u(at,"createBashToolDefinition");function Dt(t,e){const o=at(t,e),s=Be(o);return Object.assign(s,{promptSnippet:o.promptSnippet,promptGuidelines:o.promptGuidelines}),s}u(Dt,"createBashTool");export{de as bashToolSystemPromptContribution,Dt as createBashTool,at as createBashToolDefinition,Ye as createLocalBashOperations,Ke as createLocalShellOperations,st as createShellToolDefinition,It as registerShellExecutionGuard,We as sandboxEscalationSchema};
@@ -1,8 +1,8 @@
1
- var f=Object.defineProperty;var a=(r,t)=>f(r,"name",{value:t,configurable:!0});import{open as p}from"node:fs/promises";import{createOutputFileStream as x}from"../../utils/output-files.js";import{DEFAULT_MAX_BYTES as y,DEFAULT_MAX_LINES as B,truncateTail as L}from"./truncate.js";function c(r){return Buffer.byteLength(r,"utf-8")}a(c,"byteLength");class S{static{a(this,"OutputAccumulator")}maxLines;maxBytes;maxRollingBytes;tempFilePrefix;decoder=new TextDecoder;rawChunks=[];tailText="";tailBytes=0;tailStartsAtLineBoundary=!0;totalRawBytes=0;totalDecodedBytes=0;completedLines=0;totalLines=0;currentLineBytes=0;hasOpenLine=!1;finished=!1;tempFilePath;tempFileStream;constructor(t={}){this.maxLines=t.maxLines??B,this.maxBytes=t.maxBytes??y,this.maxRollingBytes=Math.max(this.maxBytes*2,1),this.tempFilePrefix=t.tempFilePrefix??"pi-output"}append(t){if(this.finished)throw new Error("Cannot append to a finished output accumulator");this.totalRawBytes+=t.length,this.appendDecodedText(this.decoder.decode(t,{stream:!0})),this.tempFileStream||this.shouldUseTempFile()?(this.ensureTempFile(),this.tempFileStream?.write(t)):t.length>0&&this.rawChunks.push(t)}finish(){this.finished||(this.finished=!0,this.appendDecodedText(this.decoder.decode()),this.shouldUseTempFile()&&this.ensureTempFile())}snapshot(t={}){const e=L(this.getSnapshotText(),{maxLines:this.maxLines,maxBytes:this.maxBytes}),s=this.totalLines>this.maxLines||this.totalDecodedBytes>this.maxBytes,n=s?e.truncatedBy??(this.totalDecodedBytes>this.maxBytes?"bytes":"lines"):null,i={...e,truncated:s,truncatedBy:n,totalLines:this.totalLines,totalBytes:this.totalDecodedBytes,maxLines:this.maxLines,maxBytes:this.maxBytes};return t.persistIfTruncated&&i.truncated&&this.ensureTempFile(),{content:i.content,truncation:i,fullOutputPath:this.tempFilePath}}async closeTempFile(){if(!this.tempFileStream)return;const t=this.tempFileStream;this.tempFileStream=void 0,await new Promise((e,s)=>{const n=a(h=>{t.off("finish",i),s(h)},"onError"),i=a(()=>{t.off("error",n),e()},"onFinish");t.once("error",n),t.once("finish",i),t.end()})}async readFullOutput(t){if(!this.tempFilePath)return{content:new TextDecoder().decode(Buffer.concat(this.rawChunks)),truncated:!1};const e=await p(this.tempFilePath,"r");try{const s=(await e.stat()).size;if(s<=t)return{content:new TextDecoder().decode(await e.readFile()),truncated:!1};const n=Math.floor(t/2),i=t-n,h=Buffer.alloc(n),l=Buffer.alloc(i);await e.read(h,0,n,0),await e.read(l,0,i,s-i);const u=new TextDecoder().decode(h,{stream:!0});let o=0;for(;o<l.length&&(l[o]&192)===128;)o++;const m=new TextDecoder().decode(l.subarray(o)),d=s-n-i;return{content:`${u}
1
+ var f=Object.defineProperty;var a=(r,t)=>f(r,"name",{value:t,configurable:!0});import{open as p}from"node:fs/promises";import{createOutputFileStream as x}from"../../utils/output-files.js";import{DEFAULT_MAX_BYTES as y,DEFAULT_MAX_LINES as B,truncateTail as L}from"./truncate.js";function c(r){return Buffer.byteLength(r,"utf-8")}a(c,"byteLength");class S{static{a(this,"OutputAccumulator")}maxLines;maxBytes;maxRollingBytes;tempFilePrefix;decoder=new TextDecoder;rawChunks=[];tailText="";tailBytes=0;tailStartsAtLineBoundary=!0;totalRawBytes=0;totalDecodedBytes=0;completedLines=0;totalLines=0;currentLineBytes=0;hasOpenLine=!1;finished=!1;tempFilePath;tempFileStream;constructor(t={}){this.maxLines=t.maxLines??B,this.maxBytes=t.maxBytes??y,this.maxRollingBytes=Math.max(this.maxBytes*2,1),this.tempFilePrefix=t.tempFilePrefix??"dal-output"}append(t){if(this.finished)throw new Error("Cannot append to a finished output accumulator");this.totalRawBytes+=t.length,this.appendDecodedText(this.decoder.decode(t,{stream:!0})),this.tempFileStream||this.shouldUseTempFile()?(this.ensureTempFile(),this.tempFileStream?.write(t)):t.length>0&&this.rawChunks.push(t)}finish(){this.finished||(this.finished=!0,this.appendDecodedText(this.decoder.decode()),this.shouldUseTempFile()&&this.ensureTempFile())}snapshot(t={}){const e=L(this.getSnapshotText(),{maxLines:this.maxLines,maxBytes:this.maxBytes}),s=this.totalLines>this.maxLines||this.totalDecodedBytes>this.maxBytes,n=s?e.truncatedBy??(this.totalDecodedBytes>this.maxBytes?"bytes":"lines"):null,i={...e,truncated:s,truncatedBy:n,totalLines:this.totalLines,totalBytes:this.totalDecodedBytes,maxLines:this.maxLines,maxBytes:this.maxBytes};return t.persistIfTruncated&&i.truncated&&this.ensureTempFile(),{content:i.content,truncation:i,fullOutputPath:this.tempFilePath}}async closeTempFile(){if(!this.tempFileStream)return;const t=this.tempFileStream;this.tempFileStream=void 0,await new Promise((e,s)=>{const n=a(l=>{t.off("finish",i),s(l)},"onError"),i=a(()=>{t.off("error",n),e()},"onFinish");t.once("error",n),t.once("finish",i),t.end()})}async readFullOutput(t){if(!this.tempFilePath)return{content:new TextDecoder().decode(Buffer.concat(this.rawChunks)),truncated:!1};const e=await p(this.tempFilePath,"r");try{const s=(await e.stat()).size;if(s<=t)return{content:new TextDecoder().decode(await e.readFile()),truncated:!1};const n=Math.floor(t/2),i=t-n,l=Buffer.alloc(n),h=Buffer.alloc(i);await e.read(l,0,n,0),await e.read(h,0,i,s-i);const u=new TextDecoder().decode(l,{stream:!0});let o=0;for(;o<h.length&&(h[o]&192)===128;)o++;const d=new TextDecoder().decode(h.subarray(o)),m=s-n-i;return{content:`${u}
2
2
 
3
- [... ${d} bytes omitted ...]
3
+ [... ${m} bytes omitted ...]
4
4
 
5
- ${m}`,truncated:!0}}finally{await e.close()}}getLastLineBytes(){return this.currentLineBytes}appendDecodedText(t){if(t.length===0)return;const e=c(t);this.totalDecodedBytes+=e,this.tailText+=t,this.tailBytes+=e,this.tailBytes>this.maxRollingBytes*2&&this.trimTail();let s=0,n=-1;for(let i=t.indexOf(`
5
+ ${d}`,truncated:!0}}finally{await e.close()}}getLastLineBytes(){return this.currentLineBytes}appendDecodedText(t){if(t.length===0)return;const e=c(t);this.totalDecodedBytes+=e,this.tailText+=t,this.tailBytes+=e,this.tailBytes>this.maxRollingBytes*2&&this.trimTail();let s=0,n=-1;for(let i=t.indexOf(`
6
6
  `);i!==-1;i=t.indexOf(`
7
7
  `,i+1))s++,n=i;if(s===0)this.currentLineBytes+=e,this.hasOpenLine=!0;else{this.completedLines+=s;const i=t.slice(n+1);this.currentLineBytes=c(i),this.hasOpenLine=i.length>0}this.totalLines=this.completedLines+(this.hasOpenLine?1:0)}trimTail(){const t=Buffer.from(this.tailText,"utf-8");if(t.length<=this.maxRollingBytes){this.tailBytes=t.length;return}let e=t.length-this.maxRollingBytes;for(;e<t.length&&(t[e]&192)===128;)e++;this.tailStartsAtLineBoundary=e===0?this.tailStartsAtLineBoundary:t[e-1]===10,this.tailText=t.subarray(e).toString("utf-8"),this.tailBytes=c(this.tailText)}getSnapshotText(){if(this.tailStartsAtLineBoundary)return this.tailText;const t=this.tailText.indexOf(`
8
8
  `);return t===-1?this.tailText:this.tailText.slice(t+1)}shouldUseTempFile(){return this.totalRawBytes>this.maxBytes||this.totalDecodedBytes>this.maxBytes||this.totalLines>this.maxLines}ensureTempFile(){if(this.tempFilePath)return;const{path:t,stream:e}=x(this.tempFilePrefix,".log");this.tempFilePath=t,this.tempFileStream=e;for(const s of this.rawChunks)this.tempFileStream.write(s);this.rawChunks=[]}}export{S as OutputAccumulator};
@@ -0,0 +1,3 @@
1
+ var I=Object.defineProperty;var d=(o,t)=>I(o,"name",{value:t,configurable:!0});const g=/\b(?:error|errors|fail|failed|failure|failing|fatal|panic|exception|traceback|assert(?:ion)?|denied|segfault)\b|✗|✘|×/i,E=[/^\s*[✓✔√]\s+\S/,/^\s*PASS\s+\S/,/^\s*ok \d+ - /,/\sPASSED(?:\s+\[\s*\d+%\])?\s*$/,/^\s*--- PASS: /,/^=== (?:RUN|PAUSE|CONT|NAME)\s/,/^test \S.* \.\.\. ok$/],m=/\bwarn(?:ing)?s?\b/i,M=10,O=8,R=.15;function D(o){const t=o.split(`
2
+ `).map(e=>{const n=e.lastIndexOf("\r",e.length-2);return n===-1?e:e.slice(n+1)}),N=t.filter(e=>E.some(n=>n.test(e))).length>=10,s=[],f=new Set;let r=0,a=-1,l=0,c=0,i=0;for(const e of t){const n=g.test(e);if(N&&!n&&E.some(u=>u.test(e))){r++,a===-1&&(a=s.length,s.push(""));continue}const h=s.length>0?s[s.length-1]:void 0;if(!n&&e.trim()!==""&&e===h){i++,c++;continue}if(i>0&&(s.push(`[previous line repeated ${i} more times]`),i=0),!n&&m.test(e)){const u=e.trim();if(f.has(u)){l++;continue}f.add(u)}s.push(e)}i>0&&s.push(`[previous line repeated ${i} more times]`),a!==-1&&(s[a]=`[${r} passing test lines collapsed]`);const _=r+l+c,S=s.join(`
3
+ `);if(_<8||S.length>o.length*(1-.15))return;const p=[];return r>0&&p.push(`${r} passing test lines collapsed`),l>0&&p.push(`${l} duplicate warning lines removed`),c>0&&p.push(`${c} repeated lines collapsed`),{text:S,summary:p.join(", ")}}d(D,"condenseShellOutput");function P(o=process.env){const t=o.DAL_TOOL_OUTPUT_CONDENSE?.trim().toLowerCase();return t==="0"||t==="off"||t==="false"}d(P,"outputCondenseDisabled");export{D as condenseShellOutput,P as outputCondenseDisabled};
@@ -1,7 +1,7 @@
1
1
  import { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, type createBashTool, createShellToolDefinition } from "./bash.ts";
2
2
  export declare const powershellToolSystemPromptContribution: {
3
3
  readonly snippet: "Execute PowerShell commands";
4
- readonly guidelines: readonly ["You can inspect PI_* environment variables for current model and session details."];
4
+ readonly guidelines: readonly ["You can inspect DAL_* environment variables for current model and session details."];
5
5
  };
6
6
  export type PowerShellOperations = BashOperations;
7
7
  export type PowerShellSpawnContext = BashSpawnContext;
@@ -1,2 +1,2 @@
1
1
  var p=Object.defineProperty;var t=(e,o)=>p(e,"name",{value:o,configurable:!0});import{getPowerShellConfig as r}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 h(){const e=s("PowerShell",r);return{exec:t((o,n,l)=>e.exec(`${m}${o}`,n,l),"exec")}}t(h,"createLocalPowerShellOperations");const u={name:"powershell",label:"powershell",shellName:"PowerShell",prompt:"PS>",promptSnippet:i.snippet,promptGuidelines:i.guidelines,tempFilePrefix:"pi-powershell",defaultOperations:h,sandboxShell:t(()=>process.platform==="win32"?r().shell:"pwsh","sandboxShell"),sandboxShellKind:"powershell"};function S(e,o){return c(e,u,o)}t(S,"createPowerShellToolDefinition");function x(e,o){const n=S(e,o),l=a(n);return Object.assign(l,{promptSnippet:n.promptSnippet,promptGuidelines:n.promptGuidelines}),l}t(x,"createPowerShellTool");export{h as createLocalPowerShellOperations,x as createPowerShellTool,S as createPowerShellToolDefinition,i as powershellToolSystemPromptContribution};
2
+ `,i={snippet:"Execute PowerShell commands",guidelines:["You can inspect DAL_* environment variables for current model and session details."]};function h(){const e=s("PowerShell",r);return{exec:t((o,l,n)=>e.exec(`${m}${o}`,l,n),"exec")}}t(h,"createLocalPowerShellOperations");const u={name:"powershell",label:"powershell",shellName:"PowerShell",prompt:"PS>",promptSnippet:i.snippet,promptGuidelines:i.guidelines,tempFilePrefix:"dal-powershell",defaultOperations:h,sandboxShell:t(()=>process.platform==="win32"?r().shell:"pwsh","sandboxShell"),sandboxShellKind:"powershell"};function d(e,o){return c(e,u,o)}t(d,"createPowerShellToolDefinition");function x(e,o){const l=d(e,o),n=a(l);return Object.assign(n,{promptSnippet:l.promptSnippet,promptGuidelines:l.promptGuidelines}),n}t(x,"createPowerShellTool");export{h as createLocalPowerShellOperations,x as createPowerShellTool,d as createPowerShellToolDefinition,i as powershellToolSystemPromptContribution};
@@ -1 +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};
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-goal",label:"\u76EE\u6807\u6A21\u5F0F",description:"\u8BBE\u5B9A\u4E00\u4E2A\u76EE\u6807\uFF0C\u52A9\u624B\u6301\u7EED\u5DE5\u4F5C\u76F4\u5230\u9A8C\u8BC1\u5B8C\u6210\uFF0C\u6709\u7EED\u8DD1\u6B21\u6570\u548C token \u4E0A\u9650\uFF08/goal\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:"goal_complete",label:"\u5B8C\u6210\u76EE\u6807",summary:"\u76EE\u6807\u7ECF\u9A8C\u8BC1\u5168\u90E8\u5B8C\u6210\u65F6\u7ED3\u675F\u76EE\u6807",source:"@dalcode/dal-goal",readOnly:!0,availability:"opt-in"},{name:"goal_blocked",label:"\u76EE\u6807\u53D7\u963B",summary:"\u76EE\u6807\u786E\u5B9E\u65E0\u6CD5\u7EE7\u7EED\u3001\u9700\u8981\u4F60\u5904\u7406\u65F6\u505C\u4E0B",source:"@dalcode/dal-goal",readOnly:!0,availability:"opt-in"},{name:"goal_wait",label:"\u76EE\u6807\u7B49\u5F85",summary:"\u76EE\u6807\u7B49\u5F85\u5916\u90E8\u4E8B\u4EF6\u65F6\u6682\u505C\u81EA\u52A8\u7EED\u8DD1",source:"@dalcode/dal-goal",readOnly:!0,availability:"opt-in"},{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};