dal-code 1.0.41 → 1.0.43

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 (114) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/NOTICE +2 -1
  3. package/PRIVACY.md +6 -0
  4. package/dist/cli/startup-ui.js +1 -1
  5. package/dist/core/agent-session.js +9 -9
  6. package/dist/core/bug-report.js +5 -5
  7. package/dist/core/extensions/index.d.ts +1 -1
  8. package/dist/core/extensions/types.d.ts +17 -0
  9. package/dist/core/sandbox/shell-sandbox.js +7 -5
  10. package/dist/core/settings-manager.d.ts +0 -5
  11. package/dist/core/settings-manager.js +1 -1
  12. package/dist/core/tools/bash.d.ts +1 -0
  13. package/dist/core/tools/bash.js +13 -13
  14. package/dist/core/tools/index.d.ts +1 -1
  15. package/dist/core/tools/index.js +1 -1
  16. package/dist/dal/manifest.js +1 -1
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +1 -1
  19. package/dist/main.js +3 -3
  20. package/dist/modes/rpc/approvals.js +1 -0
  21. package/dist/modes/rpc/message-meta.js +1 -0
  22. package/dist/modes/rpc/rpc-client.d.ts +19 -1
  23. package/dist/modes/rpc/rpc-client.js +3 -3
  24. package/dist/modes/rpc/rpc-mode.js +1 -1
  25. package/dist/modes/rpc/rpc-types.d.ts +80 -1
  26. package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
  27. package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
  28. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  29. package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
  30. package/dist/node_modules/@dalcode/dal-compat/package.json +2 -2
  31. package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
  32. package/dist/node_modules/@dalcode/dal-dap/src/install.js +2 -2
  33. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  34. package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
  35. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  36. package/dist/node_modules/@dalcode/dal-guard/src/index.js +2 -1
  37. package/dist/node_modules/@dalcode/dal-guard/src/workspace.js +2 -2
  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-learn/package.json +2 -2
  42. package/dist/node_modules/@dalcode/dal-lsp/package.json +3 -3
  43. package/dist/node_modules/@dalcode/dal-mcp/package.json +5 -5
  44. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  45. package/dist/node_modules/@dalcode/dal-office/src/index.d.ts +1 -0
  46. package/dist/node_modules/@dalcode/dal-office/src/index.js +1 -1
  47. package/dist/node_modules/@dalcode/dal-office/src/render/deck-source.d.ts +10 -0
  48. package/dist/node_modules/@dalcode/dal-office/src/render/deck-source.js +2 -0
  49. package/dist/node_modules/@dalcode/dal-office/src/render/pptx.js +3 -3
  50. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +2 -2
  51. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  52. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +2 -2
  53. package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
  54. package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
  55. package/dist/node_modules/@dalcode/dal-remote/LICENSE +21 -0
  56. package/dist/node_modules/@dalcode/dal-remote/package.json +32 -0
  57. package/dist/node_modules/@dalcode/dal-remote/src/cli.js +10 -0
  58. package/dist/node_modules/@dalcode/dal-remote/src/index.js +1 -0
  59. package/dist/node_modules/@dalcode/dal-remote/src/install.js +8 -0
  60. package/dist/node_modules/@dalcode/dal-remote/src/paths.js +1 -0
  61. package/dist/node_modules/@dalcode/dal-remote/src/service.js +8 -0
  62. package/dist/node_modules/@dalcode/dal-remote/src/spec.js +1 -0
  63. package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
  64. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  65. package/dist/node_modules/@dalcode/dal-router/package.json +4 -4
  66. package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
  67. package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
  68. package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
  69. package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
  70. package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
  71. package/dist/node_modules/@dalcode/dal-subagent/src/background.js +8 -8
  72. package/dist/node_modules/@dalcode/dal-subagent/src/index.js +19 -19
  73. package/dist/node_modules/@dalcode/dal-subagent/src/progress.js +1 -0
  74. package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -3
  75. package/dist/node_modules/@dalcode/dal-telemetry/src/config.js +3 -3
  76. package/dist/node_modules/@dalcode/dal-telemetry/src/consent.js +1 -0
  77. package/dist/node_modules/@dalcode/dal-telemetry/src/failure-reporting.js +2 -2
  78. package/dist/node_modules/@dalcode/dal-telemetry/src/index.js +4 -4
  79. package/dist/node_modules/@dalcode/dal-telemetry/src/reporter.js +1 -1
  80. package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
  81. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  82. package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
  83. package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
  84. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  85. package/dist/node_modules/@dalcode/dal-workflow/src/lean-code.js +1 -1
  86. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  87. package/dist/node_modules/@earendil-works/chord/package.json +1 -1
  88. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  89. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  90. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  91. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  92. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  93. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  94. package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
  95. package/dist/node_modules/@earendil-works/pi-client/package.json +3 -3
  96. package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
  97. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  98. package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
  99. package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
  100. package/dist/node_modules/@earendil-works/pi-server/package.json +3 -3
  101. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  102. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  103. package/dist/sdk/index.d.ts +1 -1
  104. package/dist/sdk/office.d.ts +1 -1
  105. package/dist/sdk/office.js +1 -1
  106. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  107. package/examples/extensions/gondolin/package-lock.json +2 -2
  108. package/examples/extensions/gondolin/package.json +1 -1
  109. package/examples/extensions/sandbox/package-lock.json +2 -2
  110. package/examples/extensions/sandbox/package.json +1 -1
  111. package/examples/extensions/with-deps/package-lock.json +2 -2
  112. package/examples/extensions/with-deps/package.json +1 -1
  113. package/npm-shrinkwrap.json +2 -2
  114. package/package.json +1 -1
@@ -1,5 +1,7 @@
1
- var G=Object.defineProperty;var m=(n,e)=>G(n,"name",{value:e,configurable:!0});import{spawnSync as Q}from"node:child_process";import{mkdirSync as V,mkdtempSync as z,rmSync as J}from"node:fs";import{tmpdir as Z}from"node:os";import{isAbsolute as P,join as q,relative as ee,resolve as oe}from"node:path";import{fill as y,t as h}from"../../dal/i18n.js";import{detectSandboxAvailability as ne}from"./availability.js";import{collectBlockedAccesses as O}from"./denial.js";import{detectNetworkCommand as T,FAIL_FAST_NETWORK_ENV as U,networkDomainsFor as te,packageCacheDirs as ie}from"./package-managers.js";import{domainMatches as B,expandPath as L,filesystemRules as ae}from"./policy.js";import{acquireSandboxRuntime as se,ensureFilteringProxy as re,proxyUnavailableReason as M,registerNetworkGrant as le,releaseSandboxRuntime as de,violationsForCommand as ce,wrapCommand as me}from"./runtime.js";import{prepareWindowsCommand as he}from"./windows.js";const j=Symbol.for("dal.sandbox.escalationHandlers"),k=globalThis;k[j]instanceof Set||(k[j]=new Set);const R=k[j];function Re(n){return R.add(n),()=>{R.delete(n)}}m(Re,"registerSandboxEscalationHandler");const F=Symbol.for("dal.sandbox.processSandbox");function Ae(n){k[F]=n}m(Ae,"setProcessShellSandbox");function Ne(){return k[F]}m(Ne,"getProcessShellSandbox");const K=new Map;function fe(n){const e=K.get(n);if(e)return e;const o=Q("git",["rev-parse","--absolute-git-dir","--git-common-dir"],{cwd:n,encoding:"utf8",timeout:3e3}),r=[];if(o.status===0)for(const s of o.stdout.split(`
2
- `)){const i=s.trim();if(!i)continue;const t=P(i)?i:oe(n,i),a=ee(n,t);(a.startsWith("..")||P(a))&&r.push(t)}const l=[...new Set(r)];return K.set(n,l),l}m(fe,"gitDirsOutside");function S(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.trim().length>0).map(e=>e.trim()):[]}m(S,"cleanList");let pe=0;class Ie{static{m(this,"ShellSandbox")}policy;onEscalation;onEvent;availabilityOverride;sessionDomains=new Set;sessionWritable=new Set;holdsRuntime=!1;sharedScratch;ownScratch;constructor(e){this.policy=e.policy,this.onEscalation=e.onEscalation,this.onEvent=e.onEvent,this.availabilityOverride=e.availability,this.sharedScratch=e.scratchDir,this.active&&(se(),this.holdsRuntime=!0)}scratchDir(){return this.sharedScratch?this.sharedScratch():(this.ownScratch??=we(),this.ownScratch)}async dispose(){this.ownScratch&&(J(this.ownScratch,{recursive:!0,force:!0}),this.ownScratch=void 0),this.holdsRuntime&&(this.holdsRuntime=!1,await de())}get level(){return this.policy.level}get active(){return this.policy.level!=="off"}availability(){return this.availabilityOverride??ne()}status(){const e=this.availability(),o=M();return{level:this.policy.level,levelSource:this.policy.levelSource,enforced:this.active&&e.available,platform:e.platform,...e.mechanism?{mechanism:e.mechanism}:{},...this.active&&!e.available&&e.reason?{unavailableReason:e.reason}:{},...e.isolationTier?{isolationTier:e.isolationTier}:{},...e.limitations?.length?{limitations:[...e.limitations]}:{},network:{allowedDomains:[...this.policy.network.allowedDomains],deniedDomains:[...this.policy.network.deniedDomains],...o?{proxyError:o}:{}},sessionAllowances:{domains:[...this.sessionDomains],writablePaths:[...this.sessionWritable]}}}describeForModel(){if(!this.active)return;const e=this.policy.level==="read-only"?"writes only to $TMPDIR (session scratch)":"writes only to the working directory, $TMPDIR (session scratch) and package caches (agent/editor config, git hooks and .env stay read-only)",o=this.policy.network.allowedDomains,r=(o.length>0?`network off except ${o.join(", ")}`:"network off")+(this.policy.level==="workspace-write"?" (package installs via npm/pnpm/yarn/pip/uv/cargo/go and curl/wget/git clone ask the user for their hosts by themselves: run them plainly, without sandbox_escalation)":"");return`OS sandbox (${this.policy.level}): ${e}; ${r}; ~/.ssh and other credentials unreadable. Use sandbox_escalation only after the result says the sandbox blocked something the task needs.`}unavailableRefusal(){if(!this.active)return;const e=this.availability();if(!e.available)return[`Command refused: the sandbox level is "${this.policy.level}", but ${e.reason??"the OS sandbox is unavailable."}`,"Commands are not run without the sandbox unless the user says so explicitly.",'The user can fix the sandbox, or opt out explicitly with `dal --sandbox off` or "sandbox": { "level": "off" } in ~/.dal/agent/settings.json.','A single command can still run if the user approves it: retry with sandbox_escalation {"mode":"unsandboxed","justification":"..."}.'].join(`
3
- `)}planNetworkEscalation(e){if(this.policy.level!=="workspace-write"||!this.availability().available)return;const o=T(e.command);if(!o)return;const r=[...this.policy.network.allowedDomains,...this.sessionDomains],l=this.policy.network.deniedDomains,s=te(o,e.cwd).filter(t=>!r.some(a=>B(t,a))&&!l.some(a=>B(t,a)));if(s.length===0)return;const i=o.ecosystems.length>0?"package-install":"download";return{mode:"allow",allow_domains:s,trigger:i,justification:i==="package-install"?h("\u8FD9\u6761\u547D\u4EE4\u8981\u5B89\u88C5\u4F9D\u8D56\uFF0C\u9700\u8981\u4ECE\u8F6F\u4EF6\u6E90\u4E0B\u8F7D\u3002"):h("\u8FD9\u6761\u547D\u4EE4\u8981\u4ECE\u7F51\u4E0A\u4E0B\u8F7D\u6587\u4EF6\u3002")}}async prepare(e){const o=this.policy.level;if(o==="off")return H(e.command,{level:o,sandboxed:!1});const r=this.unavailableRefusal();if(r&&e.escalation?.mode!=="unsandboxed")throw new Error(r);let l=[],s=[],i;const t=e.escalation||r?void 0:this.planNetworkEscalation(e),a=t?await this.approveEscalation(e,t,t.trigger):void 0;if(t&&a&&a.decidedBy!=="none"){const f={request:a.request,decision:a.decision};if(i=f,!f.decision.approved)throw new Error(`The user did not allow network access for this command${f.decision.message?` (${f.decision.message})`:""}: it needs ${t.allow_domains.join(", ")}. Do not retry it with sandbox_escalation; continue without it or ask the user.`);l=a.allowDomains,s=a.allowWrite}else if(e.escalation){const{decidedBy:f,allowDomains:x,allowWrite:_,...w}=await this.approveEscalation(e,e.escalation);if(i=w,!w.decision.approved)throw new Error(`Sandbox escalation refused${w.decision.message?`: ${w.decision.message}`:"."} Do not retry the same escalation; continue without it or ask the user.`);if(w.request.mode==="unsandboxed")return H(e.command,{level:o,sandboxed:!1,escalation:i});l=x,s=_}const d=this.availability(),v=e.shellKind??"bash";if(v!=="bash"&&d.mechanism!=="mxc")throw new Error(`Command refused: ${v} commands cannot run inside the ${d.mechanism??"OS"} sandbox, and the sandbox level is "${o}". Use the bash tool, or the user can opt out with \`dal --sandbox off\`.`);const p=this.scratchDir();o==="workspace-write"&&ue(T(e.command)?.managers);const u=ae(this.policy,e.cwd,{gitDirs:this.policy.level==="workspace-write"?fe(e.cwd):[],extraWrite:[...this.sessionWritable,...s],scratchDir:p}),c={allowedDomains:[...this.policy.network.allowedDomains,...this.sessionDomains,...l],deniedDomains:this.policy.network.deniedDomains,refusals:[]},D=`${process.pid}-${++pe}`,g=c.allowedDomains.length===0;if(d.mechanism==="mxc"&&d.mxc){const f=g?{...e.env??process.env,...U}:e.env;return this.prepareWindows({...e,...f?{env:f}:{}},{level:o,shellKind:v,scratch:p,rules:u,grant:c,runId:D,escalation:i,availability:d})}const b=ve(p),E=g?Object.entries(U).map(([f,x])=>` ${f}=${x}`).join(""):"",A=`export DAL_SANDBOX_RUN=${D} TMPDIR=${b} TMP=${b} TEMP=${b}${E}
4
- ${e.command}`,X=Date.now(),$=await me({command:A,shell:e.shell,allowWrite:u.allowWrite,denyWrite:u.denyWrite,denyRead:u.denyRead,allowLocalBinding:e.background===!0||this.policy.network.allowLocalBinding,...d.ripgrep?{ripgrep:d.ripgrep}:{}},c),W={level:o,sandboxed:!0,...i?{escalation:i}:{}};let N=!1;return{command:$.command,sandboxed:!0,details:W,finish:m(async(f,x)=>{if(N)return W.denial;if(N=!0,$.release(),f===0)return;const _=d.platform==="darwin"?await ce(A,X,400):[],w=O({refusals:c.refusals,violations:_,output:x});if(!w)return;const I=$.proxied?void 0:M(),C={level:o,platform:d.platform,command:e.command,cwd:e.cwd,blocked:w,scratchDir:p,...I&&w.some(Y=>Y.kind==="network")?{networkProxyError:I}:{}};return W.denial=C,this.onEvent?.({type:"sandbox_denied",toolCallId:e.toolCallId,toolName:e.toolName,denial:C}),C},"finish")}}async prepareWindows(e,o){const{level:r,grant:l,availability:s}=o,i=s.mxc;if(!i)throw new Error("Command refused: the Windows sandbox (mxc) is not loaded.");let t,a;if(l.allowedDomains.length>0){const c=await re();"port"in c?t=c.port:a=c.error}const d=he({runtime:i,kind:o.shellKind,shellPath:e.shell,command:e.command,cwd:e.cwd,level:r,rules:o.rules,env:e.env??process.env,scratchDir:o.scratch,runId:o.runId,...t!==void 0?{proxyPort:t}:{},allowLocalNetwork:e.background===!0||this.policy.network.allowLocalBinding}),v=le(l),p={level:r,sandboxed:!0,...o.escalation?{escalation:o.escalation}:{}};let u=!1;return{command:d.command,sandboxed:!0,details:p,finish:m(async(c,D)=>{if(u)return p.denial;if(u=!0,v(),d.cleanup(),c===0)return;const g=O({refusals:l.refusals,violations:[],output:D});if(!g)return;const b={level:r,platform:s.platform,command:e.command,cwd:e.cwd,blocked:g,scratchDir:o.scratch,...a&&g.some(E=>E.kind==="network")?{networkProxyError:a}:{}};return p.denial=b,this.onEvent?.({type:"sandbox_denied",toolCallId:e.toolCallId,toolName:e.toolName,denial:b}),b},"finish")}}uiApprovals=Promise.resolve();queueUiApproval(e){const o=this.uiApprovals.then(e,e);return this.uiApprovals=o.catch(()=>{}),o}async approveEscalation(e,o,r){const l=o.mode==="unsandboxed"?"unsandboxed":"allow",s={toolCallId:e.toolCallId,toolName:e.toolName,command:e.command,cwd:e.cwd,level:this.policy.level,mode:l,justification:typeof o.justification=="string"?o.justification.trim():"",allowDomains:l==="allow"?S(o.allow_domains):[],allowWrite:l==="allow"?S(o.allow_write).map(t=>L(t,e.cwd)):[],background:e.background===!0,...r?{trigger:r}:{}},i=m((t,a)=>{const d=t.approved&&t.scope==="session"&&l==="unsandboxed"?{...t,scope:"once"}:t,v=d.approved&&l==="allow"?d.grant:void 0,p=[...new Set([...s.allowDomains,...S(v?.allowDomains)])],u=[...new Set([...s.allowWrite,...S(v?.allowWrite).map(c=>L(c,e.cwd))])];if(d.approved&&d.scope==="session"){for(const c of p)this.sessionDomains.add(c);for(const c of u)this.sessionWritable.add(c)}return r&&a==="none"||this.onEvent?.({type:"sandbox_escalation",toolCallId:e.toolCallId,toolName:e.toolName,request:s,decision:d,decidedBy:a}),{request:s,decision:d,decidedBy:a,allowDomains:p,allowWrite:u}},"finish");if(!s.justification)return i({approved:!1,message:"an escalation needs a justification"},"none");if(l==="allow"&&s.allowDomains.length===0&&s.allowWrite.length===0)return i({approved:!1,message:'mode "allow" needs allow_domains or allow_write'},"none");if(this.onEscalation){const t=await this.onEscalation(s,e.ctx);if(t)return i(t,"sdk")}for(const t of R){const a=await t(s,e.ctx);if(a)return i(a,"handler")}if(e.ctx?.hasUI){const t=e.ctx;return i(await this.queueUiApproval(()=>be(s,t,e.signal)),"ui")}return i({approved:!1,message:"nobody is available to approve it (no interactive UI and no approver configured)"},"none")}}function H(n,e){return{command:n,sandboxed:!1,details:e,finish:m(async()=>{},"finish")}}m(H,"passthrough");function ue(n){if(!(!n||n.length===0))for(const e of ie(n))try{V(e,{recursive:!0,mode:448})}catch{}}m(ue,"ensurePackageCaches");function we(){return z(q(Z(),"dal-sandbox-"))}m(we,"createScratchDir");function ve(n){return`'${n.replace(/'/g,"'\\''")}'`}m(ve,"shellQuote");async function be(n,e,o){if(o?.aborted)return{approved:!1,message:"the turn was interrupted before the user answered"};const r=h("\u4EC5\u672C\u6B21\u5141\u8BB8"),l=h("\u672C\u4F1A\u8BDD\u5185\u90FD\u5141\u8BB8"),s=h("\u62D2\u7EDD"),i=n.mode==="unsandboxed"?h("\u5728\u6C99\u7BB1\u4E4B\u5916\u8FD0\u884C\u547D\u4EE4\uFF08\u53EF\u8BBF\u95EE\u4F60\u7684\u5168\u90E8\u6587\u4EF6\u548C\u7F51\u7EDC\uFF09"):[n.allowDomains.length>0?y(h("\u8BBF\u95EE {domains}"),{domains:n.allowDomains.join(", ")}):"",n.allowWrite.length>0?y(h("\u5199\u5165 {paths}"),{paths:n.allowWrite.join(", ")}):""].filter(Boolean).join(h("\uFF0C\u5E76")),t=[y(h("\u52A9\u624B\u60F3\u8981{what}\u3002"),{what:i}),y(h("\u547D\u4EE4\uFF1A{command}"),{command:n.command}),y(h("\u76EE\u5F55\uFF1A{cwd}"),{cwd:n.cwd}),n.trigger?y(h("\u539F\u56E0\uFF1A{reason}"),{reason:n.justification}):y(h("\u52A9\u624B\u7ED9\u7684\u7406\u7531\uFF08\u672A\u7ECF\u6838\u5B9E\uFF09\uFF1A{reason}"),{reason:n.justification})].join(`
5
- `),a=n.mode==="unsandboxed"?[r,s]:[r,l,s],d=await e.ui.select(t,a,o?{signal:o}:void 0);return o?.aborted?{approved:!1,message:"the turn was interrupted before the user answered"}:d===r?{approved:!0,scope:"once"}:d===l?{approved:!0,scope:"session"}:{approved:!1,message:"the user declined"}}m(be,"askThroughUi");export{Ie as ShellSandbox,we as createScratchDir,Ne as getProcessShellSandbox,Re as registerSandboxEscalationHandler,Ae as setProcessShellSandbox};
1
+ var G=Object.defineProperty;var m=(e,o)=>G(e,"name",{value:o,configurable:!0});import{spawnSync as Q}from"node:child_process";import{mkdirSync as V,mkdtempSync as z,rmSync as J}from"node:fs";import{tmpdir as Z}from"node:os";import{isAbsolute as P,join as q,relative as oo,resolve as eo}from"node:path";import{fill as v,t as h}from"../../dal/i18n.js";import{detectSandboxAvailability as no}from"./availability.js";import{collectBlockedAccesses as O}from"./denial.js";import{detectNetworkCommand as T,FAIL_FAST_NETWORK_ENV as U,networkDomainsFor as io,packageCacheDirs as ao}from"./package-managers.js";import{domainMatches as B,expandPath as L,filesystemRules as to}from"./policy.js";import{acquireSandboxRuntime as so,ensureFilteringProxy as ro,proxyUnavailableReason as M,registerNetworkGrant as lo,releaseSandboxRuntime as co,violationsForCommand as mo,wrapCommand as ho}from"./runtime.js";import{prepareWindowsCommand as fo}from"./windows.js";const C=Symbol.for("dal.sandbox.escalationHandlers"),k=globalThis;k[C]instanceof Set||(k[C]=new Set);const N=k[C];function Io(e){return N.add(e),()=>{N.delete(e)}}m(Io,"registerSandboxEscalationHandler");const F=Symbol.for("dal.sandbox.processSandbox");function Ro(e){k[F]=e}m(Ro,"setProcessShellSandbox");function Ao(){return k[F]}m(Ao,"getProcessShellSandbox");const K=new Map;function po(e){const o=K.get(e);if(o)return o;const n=Q("git",["rev-parse","--absolute-git-dir","--git-common-dir"],{cwd:e,encoding:"utf8",timeout:3e3}),r=[];if(n.status===0)for(const s of n.stdout.split(`
2
+ `)){const a=s.trim();if(!a)continue;const i=P(a)?a:eo(e,a),t=oo(e,i);(t.startsWith("..")||P(t))&&r.push(i)}const l=[...new Set(r)];return K.set(e,l),l}m(po,"gitDirsOutside");function S(e){return Array.isArray(e)?e.filter(o=>typeof o=="string"&&o.trim().length>0).map(o=>o.trim()):[]}m(S,"cleanList");let uo=0;class Po{static{m(this,"ShellSandbox")}policy;onEscalation;onEvent;availabilityOverride;sessionDomains=new Set;sessionWritable=new Set;holdsRuntime=!1;sharedScratch;ownScratch;constructor(o){this.policy=o.policy,this.onEscalation=o.onEscalation,this.onEvent=o.onEvent,this.availabilityOverride=o.availability,this.sharedScratch=o.scratchDir,this.active&&(so(),this.holdsRuntime=!0)}scratchDir(){return this.sharedScratch?this.sharedScratch():(this.ownScratch??=bo(),this.ownScratch)}async dispose(){this.ownScratch&&(J(this.ownScratch,{recursive:!0,force:!0}),this.ownScratch=void 0),this.holdsRuntime&&(this.holdsRuntime=!1,await co())}get level(){return this.policy.level}get active(){return this.policy.level!=="off"}availability(){return this.availabilityOverride??no()}status(){const o=this.availability(),n=M();return{level:this.policy.level,levelSource:this.policy.levelSource,enforced:this.active&&o.available,platform:o.platform,...o.mechanism?{mechanism:o.mechanism}:{},...this.active&&!o.available&&o.reason?{unavailableReason:o.reason}:{},...o.isolationTier?{isolationTier:o.isolationTier}:{},...o.limitations?.length?{limitations:[...o.limitations]}:{},network:{allowedDomains:[...this.policy.network.allowedDomains],deniedDomains:[...this.policy.network.deniedDomains],...n?{proxyError:n}:{}},sessionAllowances:{domains:[...this.sessionDomains],writablePaths:[...this.sessionWritable]}}}describeForModel(){if(!this.active)return;const o=this.policy.level==="read-only"?"writes only to $TMPDIR (session scratch)":"writes only to the working directory, $TMPDIR (session scratch) and package caches (agent/editor config, git hooks and .env stay read-only)",n=this.policy.network.allowedDomains,r=(n.length>0?`network off except ${n.join(", ")}`:"network off")+(this.policy.level==="workspace-write"?" (package installs via npm/pnpm/yarn/pip/uv/cargo/go and curl/wget/git clone ask the user for their hosts by themselves: run them plainly, without sandbox_escalation)":"");return`OS sandbox (${this.policy.level}): ${o}; ${r}; ~/.ssh and other credentials unreadable. Use sandbox_escalation only after the result says the sandbox blocked something the task needs.`}unavailableRefusal(){if(!this.active)return;const o=this.availability();if(!o.available)return[`Command refused: the sandbox level is "${this.policy.level}", but ${o.reason??"the OS sandbox is unavailable."}`,"Commands are not run without the sandbox unless the user says so explicitly.",'The user can fix the sandbox, or opt out explicitly with `dal --sandbox off` or "sandbox": { "level": "off" } in ~/.dal/agent/settings.json.','A single command can still run if the user approves it: retry with sandbox_escalation {"mode":"unsandboxed","justification":"..."}.'].join(`
3
+ `)}planNetworkEscalation(o){if(this.policy.level!=="workspace-write"||!this.availability().available)return;const n=T(o.command);if(!n)return;const r=[...this.policy.network.allowedDomains,...this.sessionDomains],l=this.policy.network.deniedDomains,s=io(n,o.cwd).filter(i=>!r.some(t=>B(i,t))&&!l.some(t=>B(i,t)));if(s.length===0)return;const a=n.ecosystems.length>0?"package-install":"download";return{mode:"allow",allow_domains:s,trigger:a,justification:a==="package-install"?h("\u8FD9\u6761\u547D\u4EE4\u8981\u5B89\u88C5\u4F9D\u8D56\uFF0C\u9700\u8981\u4ECE\u8F6F\u4EF6\u6E90\u4E0B\u8F7D\u3002"):h("\u8FD9\u6761\u547D\u4EE4\u8981\u4ECE\u7F51\u4E0A\u4E0B\u8F7D\u6587\u4EF6\u3002")}}async prepare(o){const n=this.policy.level;if(n==="off")return H(o.command,{level:n,sandboxed:!1});const r=this.unavailableRefusal();if(r&&o.escalation?.mode!=="unsandboxed")throw new Error(r);let l=[],s=[],a;const i=o.escalation||r?void 0:this.planNetworkEscalation(o),t=i?await this.approveEscalation(o,i,i.trigger):void 0;if(i&&t&&t.decidedBy!=="none"){const f={request:t.request,decision:t.decision};if(a=f,!f.decision.approved)throw new Error(`The user did not allow network access for this command${f.decision.message?` (${f.decision.message})`:""}: it needs ${i.allow_domains.join(", ")}. Do not retry it with sandbox_escalation; continue without it or ask the user.`);l=t.allowDomains,s=t.allowWrite}else if(o.escalation){const{decidedBy:f,allowDomains:x,allowWrite:j,...b}=await this.approveEscalation(o,o.escalation);if(a=b,!b.decision.approved)throw new Error(`Sandbox escalation refused${b.decision.message?`: ${b.decision.message}`:"."} Do not retry the same escalation; continue without it or ask the user.`);if(b.request.mode==="unsandboxed")return H(o.command,{level:n,sandboxed:!1,escalation:a});l=x,s=j}const d=this.availability(),p=o.shellKind??"bash";if(p!=="bash"&&d.mechanism!=="mxc")throw new Error(`Command refused: ${p} commands cannot run inside the ${d.mechanism??"OS"} sandbox, and the sandbox level is "${n}". Use the bash tool, or the user can opt out with \`dal --sandbox off\`.`);const u=this.scratchDir();n==="workspace-write"&&wo(T(o.command)?.managers);const w=to(this.policy,o.cwd,{gitDirs:this.policy.level==="workspace-write"?po(o.cwd):[],extraWrite:[...this.sessionWritable,...s],scratchDir:u}),c={allowedDomains:[...this.policy.network.allowedDomains,...this.sessionDomains,...l],deniedDomains:this.policy.network.deniedDomains,refusals:[]},D=`${process.pid}-${++uo}`,g=c.allowedDomains.length===0;if(d.mechanism==="mxc"&&d.mxc){const f=g?{...o.env??process.env,...U}:o.env;return this.prepareWindows({...o,...f?{env:f}:{}},{level:n,shellKind:p,scratch:u,rules:w,grant:c,runId:D,escalation:a,availability:d})}const y=vo(u),E=g?Object.entries(U).map(([f,x])=>` ${f}=${x}`).join(""):"",I=`export DAL_SANDBOX_RUN=${D} TMPDIR=${y} TMP=${y} TEMP=${y}${E}
4
+ ${o.command}`,X=Date.now(),W=await ho({command:I,shell:o.shell,allowWrite:w.allowWrite,denyWrite:w.denyWrite,denyRead:w.denyRead,allowLocalBinding:o.background===!0||this.policy.network.allowLocalBinding,...d.ripgrep?{ripgrep:d.ripgrep}:{}},c),$={level:n,sandboxed:!0,...a?{escalation:a}:{}};let R=!1;return{command:W.command,sandboxed:!0,details:$,finish:m(async(f,x)=>{if(R)return $.denial;if(R=!0,W.release(),f===0)return;const j=d.platform==="darwin"?await mo(I,X,400):[],b=O({refusals:c.refusals,violations:j,output:x});if(!b)return;const A=W.proxied?void 0:M(),_={level:n,platform:d.platform,command:o.command,cwd:o.cwd,blocked:b,scratchDir:u,...A&&b.some(Y=>Y.kind==="network")?{networkProxyError:A}:{}};return $.denial=_,this.onEvent?.({type:"sandbox_denied",toolCallId:o.toolCallId,toolName:o.toolName,denial:_}),_},"finish")}}async prepareWindows(o,n){const{level:r,grant:l,availability:s}=n,a=s.mxc;if(!a)throw new Error("Command refused: the Windows sandbox (mxc) is not loaded.");let i,t;if(l.allowedDomains.length>0){const c=await ro();"port"in c?i=c.port:t=c.error}const d=fo({runtime:a,kind:n.shellKind,shellPath:o.shell,command:o.command,cwd:o.cwd,level:r,rules:n.rules,env:o.env??process.env,scratchDir:n.scratch,runId:n.runId,...i!==void 0?{proxyPort:i}:{},allowLocalNetwork:o.background===!0||this.policy.network.allowLocalBinding}),p=lo(l),u={level:r,sandboxed:!0,...n.escalation?{escalation:n.escalation}:{}};let w=!1;return{command:d.command,sandboxed:!0,details:u,finish:m(async(c,D)=>{if(w)return u.denial;if(w=!0,p(),d.cleanup(),c===0)return;const g=O({refusals:l.refusals,violations:[],output:D});if(!g)return;const y={level:r,platform:s.platform,command:o.command,cwd:o.cwd,blocked:g,scratchDir:n.scratch,...t&&g.some(E=>E.kind==="network")?{networkProxyError:t}:{}};return u.denial=y,this.onEvent?.({type:"sandbox_denied",toolCallId:o.toolCallId,toolName:o.toolName,denial:y}),y},"finish")}}uiApprovals=Promise.resolve();queueUiApproval(o){const n=this.uiApprovals.then(o,o);return this.uiApprovals=n.catch(()=>{}),n}async approveEscalation(o,n,r){const l=n.mode==="unsandboxed"?"unsandboxed":"allow",s={toolCallId:o.toolCallId,toolName:o.toolName,command:o.command,cwd:o.cwd,level:this.policy.level,mode:l,justification:typeof n.justification=="string"?n.justification.trim():"",allowDomains:l==="allow"?S(n.allow_domains):[],allowWrite:l==="allow"?S(n.allow_write).map(i=>L(i,o.cwd)):[],background:o.background===!0,...r?{trigger:r}:{}},a=m((i,t)=>{const d=i.approved&&i.scope==="session"&&l==="unsandboxed"?{...i,scope:"once"}:i,p=d.approved&&l==="allow"?d.grant:void 0,u=[...new Set([...s.allowDomains,...S(p?.allowDomains)])],w=[...new Set([...s.allowWrite,...S(p?.allowWrite).map(c=>L(c,o.cwd))])];if(d.approved&&d.scope==="session"){for(const c of u)this.sessionDomains.add(c);for(const c of w)this.sessionWritable.add(c)}return r&&t==="none"||this.onEvent?.({type:"sandbox_escalation",toolCallId:o.toolCallId,toolName:o.toolName,request:s,decision:d,decidedBy:t}),{request:s,decision:d,decidedBy:t,allowDomains:u,allowWrite:w}},"finish");if(!s.justification)return a({approved:!1,message:"an escalation needs a justification"},"none");if(l==="allow"&&s.allowDomains.length===0&&s.allowWrite.length===0)return a({approved:!1,message:'mode "allow" needs allow_domains or allow_write'},"none");if(this.onEscalation){const i=await this.onEscalation(s,o.ctx);if(i)return a(i,"sdk")}for(const i of N){const t=await i(s,o.ctx);if(t)return a(t,"handler")}if(o.ctx?.hasUI){const i=o.ctx;return a(await this.queueUiApproval(()=>yo(s,i,o.signal)),"ui")}return a({approved:!1,message:"nobody is available to approve it (no interactive UI and no approver configured)"},"none")}}function H(e,o){return{command:e,sandboxed:!1,details:o,finish:m(async()=>{},"finish")}}m(H,"passthrough");function wo(e){if(!(!e||e.length===0))for(const o of ao(e))try{V(o,{recursive:!0,mode:448})}catch{}}m(wo,"ensurePackageCaches");function bo(){return z(q(Z(),"dal-sandbox-"))}m(bo,"createScratchDir");function vo(e){return`'${e.replace(/'/g,"'\\''")}'`}m(vo,"shellQuote");async function yo(e,o,n){if(n?.aborted)return{approved:!1,message:"the turn was interrupted before the user answered"};const r=h("\u4EC5\u672C\u6B21\u5141\u8BB8"),l=h("\u672C\u4F1A\u8BDD\u5185\u90FD\u5141\u8BB8"),s=h("\u62D2\u7EDD"),a=e.mode==="unsandboxed"?h("\u5728\u6C99\u7BB1\u4E4B\u5916\u8FD0\u884C\u547D\u4EE4\uFF08\u53EF\u8BBF\u95EE\u4F60\u7684\u5168\u90E8\u6587\u4EF6\u548C\u7F51\u7EDC\uFF09"):[e.allowDomains.length>0?v(h("\u8BBF\u95EE {domains}"),{domains:e.allowDomains.join(", ")}):"",e.allowWrite.length>0?v(h("\u5199\u5165 {paths}"),{paths:e.allowWrite.join(", ")}):""].filter(Boolean).join(h("\uFF0C\u5E76")),i=[v(h("\u52A9\u624B\u60F3\u8981{what}\u3002"),{what:a}),v(h("\u547D\u4EE4\uFF1A{command}"),{command:e.command}),v(h("\u76EE\u5F55\uFF1A{cwd}"),{cwd:e.cwd}),e.trigger?v(h("\u539F\u56E0\uFF1A{reason}"),{reason:e.justification}):v(h("\u52A9\u624B\u7ED9\u7684\u7406\u7531\uFF08\u672A\u7ECF\u6838\u5B9E\uFF09\uFF1A{reason}"),{reason:e.justification})].join(`
5
+ `),t=e.mode==="unsandboxed"?[r,s]:[r,l,s],d=v(h("\u52A9\u624B\u60F3\u8981{what}\u3002"),{what:a}),p=await o.ui.select(i,t,{...n?{signal:n}:{},approval:{source:"sandbox",toolCallId:e.toolCallId,toolName:e.toolName,args:{command:e.command,cwd:e.cwd,mode:e.mode,...e.allowDomains.length>0?{allowDomains:e.allowDomains}:{},...e.allowWrite.length>0?{allowWrite:e.allowWrite}:{},justification:e.justification},risk:{level:e.mode==="unsandboxed"?"high":"medium",reason:e.trigger?e.justification:v(h("\u52A9\u624B\u7ED9\u7684\u7406\u7531\uFF08\u672A\u7ECF\u6838\u5B9E\uFF09\uFF1A{reason}"),{reason:e.justification}),ruleId:`sandbox:${e.mode}`},title:d,description:i.split(`
6
+ `).slice(1).join(`
7
+ `),options:e.mode==="unsandboxed"?["allow_once","deny"]:["allow_once","allow_session","deny"]}});return n?.aborted?{approved:!1,message:"the turn was interrupted before the user answered"}:p===r?{approved:!0,scope:"once"}:p===l?{approved:!0,scope:"session"}:{approved:!1,message:"the user declined"}}m(yo,"askThroughUi");export{Po as ShellSandbox,bo as createScratchDir,Ao as getProcessShellSandbox,Io as registerSandboxEscalationHandler,Ro as setProcessShellSandbox};
@@ -114,8 +114,6 @@ export interface Settings {
114
114
  npmCommand?: string[];
115
115
  collapseChangelog?: boolean;
116
116
  enableInstallTelemetry?: boolean;
117
- enableAnalytics?: boolean;
118
- trackingId?: string;
119
117
  deviceId?: string;
120
118
  packages?: PackageSource[];
121
119
  extensions?: string[];
@@ -323,9 +321,6 @@ export declare class SettingsManager {
323
321
  setCollapseChangelog(collapse: boolean): void;
324
322
  getEnableInstallTelemetry(): boolean;
325
323
  setEnableInstallTelemetry(enabled: boolean): void;
326
- getEnableAnalytics(): boolean;
327
- getTrackingId(): string | undefined;
328
- setEnableAnalytics(enabled: boolean): void;
329
324
  getOrCreateDeviceId(): string;
330
325
  getPackages(): PackageSource[];
331
326
  setPackages(packages: PackageSource[]): void;
@@ -1 +1 @@
1
- var O=Object.defineProperty;var a=(o,e)=>O(o,"name",{value:e,configurable:!0});import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as A}from"@earendil-works/pi-ai";import{randomUUID as v}from"crypto";import{existsSync as P,mkdirSync as N,readFileSync as D}from"fs";import{dirname as R,join as m}from"path";import W from"proper-lockfile";import{CONFIG_DIR_NAME as j,getAgentDir as _}from"../config.js";import{normalizePath as C,resolvePath as f}from"../utils/paths.js";import{stripBom as E}from"../utils/text.js";import{DEFAULT_HTTP_IDLE_TIMEOUT_MS as $,parseHttpIdleTimeoutMs as U}from"./http-dispatcher.js";import{declaredDataFormat as S,reportNewerDataFormat as B,writeFileAtomicSync as H}from"./shared-data.js";const V=8e4,q={reserveTokens:16384,keepRecentTokens:2e4,maxContextTokens:V},X=32e3,G=5,K=["off","streaming","idle"];function b(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}a(b,"isMergeableObject");function w(o,e){const t={...o};for(const s of Object.keys(e)){const i=e[s];if(i===void 0)continue;const r=o[s];t[s]=b(r)&&b(i)?w(r,i):i}return t}a(w,"deepMergeObjects");const Q=["read","bash","edit","write"];function p(o){return typeof o=="string"&&(o.startsWith("+")||o.startsWith("-"))}a(p,"isToolModifier");function ce(o){const e=o.filter(p);if(e.length===0)return;if(e.length<o.length)return"tool names cannot be mixed with +name or -name entries";const t=e.find(s=>s.includes("*"));if(t)return`+name and -name entries take exact tool names, not patterns: ${t}`}a(ce,"getToolListError");function z(o,e){const t=[...o];for(const s of e){if(!p(s))continue;const i=s.slice(1),r=t.indexOf(i);s.startsWith("+")&&r===-1&&i?t.push(i):s.startsWith("-")&&r!==-1&&t.splice(r,1)}return t}a(z,"applyToolModifiers");function J(o,e){return e===void 0?o:!Array.isArray(o)||!Array.isArray(e)||!e.every(p)?e:[...o,...e]}a(J,"mergeDefaultTools");function Y(o){const e=o.filter(t=>!p(t));return z(e.length>0||o.length===0?e:Q,o)}a(Y,"resolveDefaultTools");function h(o,e){const t=w(o,e),s=J(o.defaultTools,e.defaultTools);return s===void 0?t:{...t,defaultTools:s}}a(h,"deepMergeSettings");function x(o,e){const t=U(o);if(t!==void 0)return t;if(o!==void 0)throw new Error(`Invalid ${e} setting: ${String(o)}`)}a(x,"parseTimeoutSetting");const k=1;function M(o,e,t){return{scope:o,...t?{path:t}:{},error:e instanceof Error?e:new Error(String(e))}}a(M,"toSettingsError");class Z{static{a(this,"FileSettingsStorage")}globalSettingsPath;projectSettingsPath;constructor(e,t){const s=f(e),i=f(t);this.globalSettingsPath=m(i,"settings.json"),this.projectSettingsPath=m(s,j,"settings.json")}acquireLockSyncWithRetry(e){let i;for(let r=1;r<=100;r++)try{return W.lockSync(e,{realpath:!1})}catch(n){if((typeof n=="object"&&n!==null&&"code"in n?String(n.code):void 0)!=="ELOCKED"||r===100)throw n;i=n;const g=Date.now();for(;Date.now()-g<20;);}throw i??new Error("Failed to acquire settings lock")}withLock(e,t){const s=e==="global"?this.globalSettingsPath:this.projectSettingsPath,i=R(s);let r;try{const n=P(s);n&&(r=this.acquireLockSyncWithRetry(s));const l=n?D(s,"utf-8"):void 0,g=t(l);g!==void 0&&(P(i)||N(i,{recursive:!0}),r||(r=this.acquireLockSyncWithRetry(s)),H(s,g))}finally{r&&r()}}}class ee{static{a(this,"InMemorySettingsStorage")}global;project;withLock(e,t){const s=e==="global"?this.global:this.project,i=t(s);i!==void 0&&(e==="global"?this.global=i:this.project=i)}}class d{static{a(this,"SettingsManager")}storage;globalSettings;projectSettings;settings;projectTrusted;modifiedFields=new Set;modifiedNestedFields=new Map;modifiedProjectFields=new Set;modifiedProjectNestedFields=new Map;globalSettingsLoadError=null;projectSettingsLoadError=null;writeQueue=Promise.resolve();errors;settingsPaths;constructor(e,t,s,i=null,r=null,n=[],l=!0,g={}){this.storage=e,this.globalSettings=t,this.projectSettings=s,this.projectTrusted=l,this.globalSettingsLoadError=i,this.projectSettingsLoadError=r,this.errors=[...n],this.settingsPaths=g,this.settings=h(this.globalSettings,this.projectSettings),this.reportNewerFormatScopes()}static create(e,t=_(),s={}){const i=f(e),r=f(t),n=new Z(i,r);return d.fromStorageWithPaths(n,s,{global:m(r,"settings.json"),project:m(i,j,"settings.json")})}static fromStorage(e,t={}){return d.fromStorageWithPaths(e,t)}static fromStorageWithPaths(e,t,s={}){const i=t.projectTrusted??!0,r=d.tryLoadFromStorage(e,"global"),n=d.tryLoadFromStorage(e,"project",i),l=[];return r.error&&l.push(M("global",r.error,s.global)),n.error&&l.push(M("project",n.error,s.project)),new d(e,r.settings,n.settings,r.error,n.error,l,i,s)}static inMemory(e={},t={}){const s=new ee,i=d.migrateSettings(structuredClone(e));return s.withLock("global",()=>JSON.stringify(i,null,2)),d.fromStorage(s,t)}static loadFromStorage(e,t,s=!0){if(t==="project"&&!s)return{};let i;if(e.withLock(t,n=>{i=n}),!i)return{};const r=JSON.parse(E(i));return d.migrateSettings(r)}static tryLoadFromStorage(e,t,s=!0){try{return{settings:d.loadFromStorage(e,t,s),error:null}}catch(i){return{settings:{},error:i}}}static migrateSettings(e){if("queueMode"in e&&!("steeringMode"in e)&&(e.steeringMode=e.queueMode,delete e.queueMode),!("transport"in e)&&typeof e.websockets=="boolean"&&(e.transport=e.websockets?"websocket":"sse",delete e.websockets),"skills"in e&&typeof e.skills=="object"&&e.skills!==null&&!Array.isArray(e.skills)){const t=e.skills;t.enableSkillCommands!==void 0&&e.enableSkillCommands===void 0&&(e.enableSkillCommands=t.enableSkillCommands),Array.isArray(t.customDirectories)&&t.customDirectories.length>0?e.skills=t.customDirectories:delete e.skills}if("retry"in e&&typeof e.retry=="object"&&e.retry!==null&&!Array.isArray(e.retry)){const t=e.retry,s=typeof t.provider=="object"&&t.provider!==null?t.provider:void 0;typeof t.maxDelayMs=="number"&&(s?.maxRetryDelayMs===void 0||s?.maxRetryDelayMs===null)&&(t.provider={...s??{},maxRetryDelayMs:t.maxDelayMs}),delete t.maxDelayMs}return e}getSettings(){return structuredClone(this.settings)}getGlobalSettings(){return structuredClone(this.globalSettings)}getProjectSettings(){return structuredClone(this.projectSettings)}isProjectTrusted(){return this.projectTrusted}setProjectTrusted(e){if(this.projectTrusted===e)return;if(this.projectTrusted=e,this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear(),!e){this.projectSettings={},this.projectSettingsLoadError=null,this.settings=h(this.globalSettings,this.projectSettings);return}const t=d.tryLoadFromStorage(this.storage,"project",e);this.projectSettings=t.settings,this.projectSettingsLoadError=t.error,t.error&&this.recordError("project",t.error),this.settings=h(this.globalSettings,this.projectSettings)}async reload(){await this.writeQueue;const e=d.tryLoadFromStorage(this.storage,"global");e.error?(this.globalSettingsLoadError=e.error,this.recordError("global",e.error)):(this.globalSettings=e.settings,this.globalSettingsLoadError=null),this.modifiedFields.clear(),this.modifiedNestedFields.clear(),this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear();const t=d.tryLoadFromStorage(this.storage,"project",this.projectTrusted);t.error?(this.projectSettingsLoadError=t.error,this.recordError("project",t.error)):(this.projectSettings=t.settings,this.projectSettingsLoadError=null),this.settings=h(this.globalSettings,this.projectSettings),this.reportNewerFormatScopes()}applyOverrides(e){this.settings=h(this.settings,e)}markModified(e,t){this.modifiedFields.add(e),t&&(this.modifiedNestedFields.has(e)||this.modifiedNestedFields.set(e,new Set),this.modifiedNestedFields.get(e).add(t))}markProjectModified(e,t){this.modifiedProjectFields.add(e),t&&(this.modifiedProjectNestedFields.has(e)||this.modifiedProjectNestedFields.set(e,new Set),this.modifiedProjectNestedFields.get(e).add(t))}assertProjectTrustedForWrite(){if(!this.projectTrusted)throw new Error("Project is not trusted; refusing to write project settings")}reportNewerFormat(e){B(this.settingsPaths[e]??`${e} settings.json`)}reportNewerFormatScopes(){S(this.globalSettings)>k&&this.reportNewerFormat("global"),S(this.projectSettings)>k&&this.reportNewerFormat("project")}recordError(e,t){this.errors.push(M(e,t,this.settingsPaths[e]))}clearModifiedScope(e){if(e==="global"){this.modifiedFields.clear(),this.modifiedNestedFields.clear();return}this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear()}enqueueWrite(e,t){this.writeQueue=this.writeQueue.then(()=>{e==="project"&&this.assertProjectTrustedForWrite(),t(),this.clearModifiedScope(e)}).catch(s=>{this.recordError(e,s)})}cloneModifiedNestedFields(e){const t=new Map;for(const[s,i]of e.entries())t.set(s,new Set(i));return t}persistScopedSettings(e,t,s,i){this.storage.withLock(e,r=>{const n=r?JSON.parse(E(r)):{};if(S(n)>k){this.reportNewerFormat(e);return}const l=r?d.migrateSettings(n):{},g={...l};for(const c of s){const u=t[c];if(i.has(c)&&typeof u=="object"&&u!==null){const F=i.get(c),L=l[c]??{},I=u,T={...L};for(const y of F)T[y]=I[y];g[c]=T}else g[c]=u}return JSON.stringify(g,null,2)})}save(){if(this.settings=h(this.globalSettings,this.projectSettings),this.globalSettingsLoadError)return;const e=structuredClone(this.globalSettings),t=new Set(this.modifiedFields),s=this.cloneModifiedNestedFields(this.modifiedNestedFields);this.enqueueWrite("global",()=>{this.persistScopedSettings("global",e,t,s)})}saveProjectSettings(e){if(this.assertProjectTrustedForWrite(),this.projectSettings=structuredClone(e),this.settings=h(this.globalSettings,this.projectSettings),this.projectSettingsLoadError)return;const t=structuredClone(this.projectSettings),s=new Set(this.modifiedProjectFields),i=this.cloneModifiedNestedFields(this.modifiedProjectNestedFields);this.enqueueWrite("project",()=>{this.persistScopedSettings("project",t,s,i)})}updateProjectSettings(e,t){this.assertProjectTrustedForWrite();const s=structuredClone(this.projectSettings);t(s),this.markProjectModified(e),this.saveProjectSettings(s)}async flush(){await this.writeQueue}drainErrors(){const e=[...this.errors];return this.errors=[],e}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(e){this.globalSettings.lastChangelogVersion=e,this.markModified("lastChangelogVersion"),this.save()}getSessionDir(){const e=this.settings.sessionDir;return e&&C(e)}getDefaultProvider(){return this.settings.defaultProvider}getDefaultModel(){return this.settings.defaultModel}setDefaultProvider(e){this.globalSettings.defaultProvider=e,this.markModified("defaultProvider"),this.save()}setDefaultModel(e){this.globalSettings.defaultModel=e,this.markModified("defaultModel"),this.save()}setDefaultModelAndProvider(e,t){this.globalSettings.defaultProvider=e,this.globalSettings.defaultModel=t,this.markModified("defaultProvider"),this.markModified("defaultModel"),this.save()}getSteeringMode(){return this.settings.steeringMode||"one-at-a-time"}setSteeringMode(e){this.globalSettings.steeringMode=e,this.markModified("steeringMode"),this.save()}getFollowUpMode(){return this.settings.followUpMode||"one-at-a-time"}setFollowUpMode(e){this.globalSettings.followUpMode=e,this.markModified("followUpMode"),this.save()}getThemeSetting(){const e=this.settings.theme;if(typeof e=="string")return e}getTheme(){const e=this.getThemeSetting();return e?.includes("/")?void 0:e}setTheme(e){this.globalSettings.theme=e,this.markModified("theme"),this.save()}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(e){this.globalSettings.defaultThinkingLevel=e,this.markModified("defaultThinkingLevel"),this.save()}getModelThinkingLevel(e,t){return this.settings.modelThinkingLevels?.[`${e}/${t}`]}getAllModelThinkingLevels(){return{...this.settings.modelThinkingLevels??{}}}setModelThinkingLevel(e,t,s){this.globalSettings.modelThinkingLevels||(this.globalSettings.modelThinkingLevels={}),this.globalSettings.modelThinkingLevels[`${e}/${t}`]=s,this.markModified("modelThinkingLevels"),this.save()}removeModelThinkingLevel(e,t){this.globalSettings.modelThinkingLevels&&(delete this.globalSettings.modelThinkingLevels[`${e}/${t}`],Object.keys(this.globalSettings.modelThinkingLevels).length===0&&delete this.globalSettings.modelThinkingLevels,this.markModified("modelThinkingLevels"),this.save())}getTransport(){return this.settings.transport??"auto"}setTransport(e){this.globalSettings.transport=e,this.markModified("transport"),this.save()}getCompactionEnabled(){return this.settings.compaction?.enabled??!0}setCompactionEnabled(e){this.globalSettings.compaction||(this.globalSettings.compaction={}),this.globalSettings.compaction.enabled=e,this.markModified("compaction","enabled"),this.save()}getCompactionTokenSetting(e,t){const s=this.settings.compaction,i=s?.[e];if(i!==void 0&&(typeof i!="number"||!Number.isSafeInteger(i)||i<0))throw new Error(`Invalid compaction.${e} setting: ${String(i)}. Expected a non-negative safe integer.`);const r=t?`${t.provider}/${t.id}`:void 0,n=r!==void 0?s?.modelOverrides?.[r]:void 0;if(n!==void 0&&!b(n))throw new Error(`Invalid compaction.modelOverrides["${r}"] setting: ${String(n)}. Expected an object.`);const l=n?.[e];if(l!==void 0&&(typeof l!="number"||!Number.isSafeInteger(l)||l<0))throw new Error(`Invalid compaction.modelOverrides["${r}"].${e} setting: ${String(l)}. Expected a non-negative safe integer.`);return l??i??q[e]}getCompactionReserveTokens(e){return this.getCompactionTokenSetting("reserveTokens",e)}getCompactionKeepRecentTokens(e){return this.getCompactionTokenSetting("keepRecentTokens",e)}getCompactionSettings(e){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(e),keepRecentTokens:this.getCompactionKeepRecentTokens(e),maxContextTokens:this.getCompactionMaxContextTokens(e),pruneToolOutputs:this.getCompactionPruneToolOutputs()}}getCompactionMaxContextTokens(e){return this.getCompactionTokenSetting("maxContextTokens",e)}getCompactionPruneToolOutputs(){const e=this.settings.compaction?.pruneToolOutputs;if(e!==void 0&&typeof e!="boolean")throw new Error(`Invalid compaction.pruneToolOutputs setting: ${String(e)}. Expected a boolean.`);return e??!0}getCompactionSummaryModel(){const e=this.settings.compaction?.summaryModel;if(e===void 0||e==="")return;const t=typeof e=="string"?e.indexOf("/"):-1;if(typeof e!="string"||t<=0||t===e.length-1)throw new Error(`Invalid compaction.summaryModel setting: ${String(e)}. Expected "provider/modelId".`);return{provider:e.slice(0,t),modelId:e.slice(t+1)}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??16384,skipPrompt:this.settings.branchSummary?.skipPrompt??!1}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??!1}getRetryEnabled(){return this.settings.retry?.enabled??!0}setRetryEnabled(e){this.globalSettings.retry||(this.globalSettings.retry={}),this.globalSettings.retry.enabled=e,this.markModified("retry","enabled"),this.save()}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??G,baseDelayMs:this.settings.retry?.baseDelayMs??2e3,maxAgentDelayMs:this.settings.retry?.maxAgentDelayMs??A}}getMaxOutputTokens(){const e=this.settings.maxOutputTokens;if(e===void 0)return X;if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new Error(`Invalid maxOutputTokens setting: ${String(e)}. Expected a non-negative safe integer.`);return e}getOutputTokenLimit(e){const t=this.getMaxOutputTokens();return t>0&&(e<=0||e>t)?t:e}getHttpIdleTimeoutMs(){return x(this.settings.httpIdleTimeoutMs,"httpIdleTimeoutMs")??$}setHttpIdleTimeoutMs(e){if(!Number.isFinite(e)||e<0)throw new Error(`Invalid httpIdleTimeoutMs setting: ${String(e)}`);this.globalSettings.httpIdleTimeoutMs=Math.floor(e),this.markModified("httpIdleTimeoutMs"),this.save()}getCacheWarmingMode(){const e=this.globalSettings.cacheWarming;return e!==void 0&&K.includes(e)?e:"streaming"}setCacheWarmingMode(e){this.globalSettings.cacheWarming=e,this.markModified("cacheWarming"),this.save()}getProviderRetrySettings(){return{timeoutMs:this.settings.retry?.provider?.timeoutMs,maxRetries:this.settings.retry?.provider?.maxRetries,maxRetryDelayMs:this.settings.retry?.provider?.maxRetryDelayMs??6e4}}getWebSocketConnectTimeoutMs(){return x(this.settings.websocketConnectTimeoutMs,"websocketConnectTimeoutMs")}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!0}getShowCacheMissNotices(){return this.settings.showCacheMissNotices??!1}getExternalEditorCommand(){const e=this.settings.externalEditor;if(typeof e=="string"&&e.trim()!=="")return e;const t=process.env.VISUAL||process.env.EDITOR;return t||(process.platform==="win32"?"notepad":"nano")}setHideThinkingBlock(e){this.globalSettings.hideThinkingBlock=e,this.markModified("hideThinkingBlock"),this.save()}setShowCacheMissNotices(e){this.globalSettings.showCacheMissNotices=e,this.markModified("showCacheMissNotices"),this.save()}getShellPath(){const e=this.settings.shellPath;return e&&C(e)}setShellPath(e){this.globalSettings.shellPath=e,this.markModified("shellPath"),this.save()}getQuietStartup(){const e=this.settings.quietStartup;return e===!1?!1:e==="header"?e:!0}setQuietStartup(e){this.globalSettings.quietStartup=e,this.markModified("quietStartup"),this.save()}getDefaultProjectTrust(){const e=this.globalSettings.defaultProjectTrust;return e==="always"||e==="never"?e:"ask"}setDefaultProjectTrust(e){this.globalSettings.defaultProjectTrust=e,this.markModified("defaultProjectTrust"),this.save()}getShellCommandPrefix(){return this.settings.shellCommandPrefix}getShellEnvironmentPolicy(){const e=this.globalSettings.shellEnvironment??{},t=[...e.exclude??[],...this.projectSettings.shellEnvironment?.exclude??[]];return{...e.inherit!==void 0?{inherit:e.inherit}:{},...t.length>0?{exclude:t}:{},...e.include!==void 0?{include:[...e.include]}:{},...e.set!==void 0?{set:{...e.set}}:{}}}getPermissionRuleSources(){return{...this.globalSettings.permissions?{user:structuredClone(this.globalSettings.permissions)}:{},...this.projectSettings.permissions?{project:structuredClone(this.projectSettings.permissions)}:{}}}getSandboxSettingsSources(){return{...this.globalSettings.sandbox?{global:structuredClone(this.globalSettings.sandbox)}:{},...this.projectSettings.sandbox?{project:structuredClone(this.projectSettings.sandbox)}:{}}}setShellCommandPrefix(e){this.globalSettings.shellCommandPrefix=e,this.markModified("shellCommandPrefix"),this.save()}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(e){this.globalSettings.npmCommand=e?[...e]:void 0,this.markModified("npmCommand"),this.save()}getCollapseChangelog(){return this.settings.collapseChangelog??!0}setCollapseChangelog(e){this.globalSettings.collapseChangelog=e,this.markModified("collapseChangelog"),this.save()}getEnableInstallTelemetry(){return this.settings.enableInstallTelemetry??!0}setEnableInstallTelemetry(e){this.globalSettings.enableInstallTelemetry=e,this.markModified("enableInstallTelemetry"),this.save()}getEnableAnalytics(){return this.settings.enableAnalytics??!1}getTrackingId(){return this.settings.trackingId}setEnableAnalytics(e){this.globalSettings.enableAnalytics=e,this.markModified("enableAnalytics"),e&&!this.globalSettings.trackingId&&(this.globalSettings.trackingId=v(),this.markModified("trackingId")),this.save()}getOrCreateDeviceId(){return this.globalSettings.deviceId||(this.globalSettings.deviceId=v(),this.markModified("deviceId"),this.save()),this.globalSettings.deviceId}getPackages(){return[...this.settings.packages??[]]}setPackages(e){this.globalSettings.packages=e,this.markModified("packages"),this.save()}setProjectPackages(e){this.updateProjectSettings("packages",t=>{t.packages=e})}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(e){this.globalSettings.extensions=e,this.markModified("extensions"),this.save()}setProjectExtensionPaths(e){this.updateProjectSettings("extensions",t=>{t.extensions=e})}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(e){this.globalSettings.skills=e,this.markModified("skills"),this.save()}setProjectSkillPaths(e){this.updateProjectSettings("skills",t=>{t.skills=e})}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(e){this.globalSettings.prompts=e,this.markModified("prompts"),this.save()}setProjectPromptTemplatePaths(e){this.updateProjectSettings("prompts",t=>{t.prompts=e})}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(e){this.globalSettings.themes=e,this.markModified("themes"),this.save()}setProjectThemePaths(e){this.updateProjectSettings("themes",t=>{t.themes=e})}getEnableSkillCommands(){return this.settings.enableSkillCommands??!0}setEnableSkillCommands(e){this.globalSettings.enableSkillCommands=e,this.markModified("enableSkillCommands"),this.save()}getFactoryEnabled(){return this.settings.factoryEnabled??!0}setFactoryEnabled(e){this.globalSettings.factoryEnabled=e,this.markModified("factoryEnabled"),this.save()}getThinkingBudgets(){return this.settings.thinkingBudgets}getTerminalCapabilityOverrides(){const e=this.settings.terminal,t=e?.images;return{...t==="kitty"||t==="iterm2"?{images:t}:t===!1?{images:null}:{},...typeof e?.trueColor=="boolean"?{trueColor:e.trueColor}:{},...typeof e?.hyperlinks=="boolean"?{hyperlinks:e.hyperlinks}:{}}}getShowImages(){return this.settings.terminal?.showImages??!0}setShowImages(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showImages=e,this.markModified("terminal","showImages"),this.save()}getImageWidthCells(){const e=this.settings.terminal?.imageWidthCells;return typeof e!="number"||!Number.isFinite(e)?60:Math.max(1,Math.floor(e))}setImageWidthCells(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.imageWidthCells=Math.max(1,Math.floor(e)),this.markModified("terminal","imageWidthCells"),this.save()}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"}setClearOnShrink(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.clearOnShrink=e,this.markModified("terminal","clearOnShrink"),this.save()}getShowTerminalProgress(){return this.settings.terminal?.showTerminalProgress??!1}setShowTerminalProgress(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showTerminalProgress=e,this.markModified("terminal","showTerminalProgress"),this.save()}getTuiMode(){return this.settings.tuiMode==="fullscreen"?"fullscreen":(this.settings.tuiMode==="regular"||this.settings.tuiMode,"regular")}setTuiMode(e){this.globalSettings.tuiMode=e,this.markModified("tuiMode"),this.save()}getFullscreenExitOutput(){return this.settings.fullscreenExitOutput==="resume-hint"?"resume-hint":"transcript"}setFullscreenExitOutput(e){this.globalSettings.fullscreenExitOutput=e,this.markModified("fullscreenExitOutput"),this.save()}getFullscreenScrollbar(){const e=this.settings.fullscreenScrollbar;return e==="always"||e==="hidden"?e:"auto"}setFullscreenScrollbar(e){this.globalSettings.fullscreenScrollbar=e,this.markModified("fullscreenScrollbar"),this.save()}getFullscreenCopyOnSelect(){return this.settings.fullscreenCopyOnSelect??!0}setFullscreenCopyOnSelect(e){this.globalSettings.fullscreenCopyOnSelect=e,this.markModified("fullscreenCopyOnSelect"),this.save()}getFullscreenWheelScrollLines(){const e=this.settings.fullscreenWheelScrollLines;return typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.min(100,Math.floor(e))):"auto"}setFullscreenWheelScrollLines(e){this.globalSettings.fullscreenWheelScrollLines=e==="auto"?e:Math.max(1,Math.min(100,Math.floor(e))),this.markModified("fullscreenWheelScrollLines"),this.save()}getImageAutoResize(){return this.settings.images?.autoResize??!0}setImageAutoResize(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.autoResize=e,this.markModified("images","autoResize"),this.save()}getBlockImages(){return this.settings.images?.blockImages??!1}setBlockImages(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.blockImages=e,this.markModified("images","blockImages"),this.save()}getEnabledModels(){return this.settings.enabledModels}getDefaultTools(){const e=this.settings.defaultTools;if(e!==void 0)return Y(Array.isArray(e)?e.filter(t=>typeof t=="string"):[])}setEnabledModels(e){this.globalSettings.enabledModels=e,this.markModified("enabledModels"),this.save()}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??"tree"}setDoubleEscapeAction(e){this.globalSettings.doubleEscapeAction=e,this.markModified("doubleEscapeAction"),this.save()}getTreeFilterMode(){const e=this.settings.treeFilterMode;return e&&["default","no-tools","user-only","labeled-only","all"].includes(e)?e:"default"}setTreeFilterMode(e){this.globalSettings.treeFilterMode=e,this.markModified("treeFilterMode"),this.save()}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(e){this.globalSettings.showHardwareCursor=e,this.markModified("showHardwareCursor"),this.save()}getEditorPaddingX(){return this.settings.editorPaddingX??1}setEditorPaddingX(e){this.globalSettings.editorPaddingX=Math.max(0,Math.min(3,Math.floor(e))),this.markModified("editorPaddingX"),this.save()}getOutputPad(){return this.settings.outputPad===1?1:0}setOutputPad(e){this.globalSettings.outputPad=e,this.markModified("outputPad"),this.save()}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??5}setAutocompleteMaxVisible(e){this.globalSettings.autocompleteMaxVisible=Math.max(3,Math.min(20,Math.floor(e))),this.markModified("autocompleteMaxVisible"),this.save()}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??" "}getMermaidRenderingMode(){const e=this.settings.markdown?.mermaid;return e==="off"||e==="final"?e:"streaming"}setMermaidRenderingMode(e){this.globalSettings.markdown??={},this.globalSettings.markdown.mermaid=e,this.markModified("markdown","mermaid"),this.save()}getWarnings(){return{...this.settings.warnings??{}}}setWarnings(e){this.globalSettings.warnings={...e},this.markModified("warnings"),this.save()}}export{K as CACHE_WARMING_MODES,V as DEFAULT_COMPACTION_MAX_CONTEXT_TOKENS,X as DEFAULT_MAX_OUTPUT_TOKENS,G as DEFAULT_MAX_RETRIES,Q as DEFAULT_TOOL_NAMES,Z as FileSettingsStorage,ee as InMemorySettingsStorage,k as SETTINGS_FORMAT_VERSION,d as SettingsManager,z as applyToolModifiers,ce as getToolListError,p as isToolModifier};
1
+ var N=Object.defineProperty;var a=(r,e)=>N(r,"name",{value:e,configurable:!0});import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as O}from"@earendil-works/pi-ai";import{randomUUID as A}from"crypto";import{existsSync as P,mkdirSync as D,readFileSync as R}from"fs";import{dirname as W,join as m}from"path";import _ from"proper-lockfile";import{CONFIG_DIR_NAME as E,getAgentDir as $}from"../config.js";import{normalizePath as w,resolvePath as f}from"../utils/paths.js";import{stripBom as k}from"../utils/text.js";import{DEFAULT_HTTP_IDLE_TIMEOUT_MS as U,parseHttpIdleTimeoutMs as B}from"./http-dispatcher.js";import{declaredDataFormat as p,reportNewerDataFormat as H,writeFileAtomicSync as V}from"./shared-data.js";const q=8e4,X={reserveTokens:16384,keepRecentTokens:2e4,maxContextTokens:q},K=32e3,G=5,Q=["off","streaming","idle"];function M(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}a(M,"isMergeableObject");function C(r,e){const t={...r};for(const s of Object.keys(e)){const i=e[s];if(i===void 0)continue;const o=r[s];t[s]=M(o)&&M(i)?C(o,i):i}return t}a(C,"deepMergeObjects");const z=["read","bash","edit","write"];function S(r){return typeof r=="string"&&(r.startsWith("+")||r.startsWith("-"))}a(S,"isToolModifier");function me(r){const e=r.filter(S);if(e.length===0)return;if(e.length<r.length)return"tool names cannot be mixed with +name or -name entries";const t=e.find(s=>s.includes("*"));if(t)return`+name and -name entries take exact tool names, not patterns: ${t}`}a(me,"getToolListError");function J(r,e){const t=[...r];for(const s of e){if(!S(s))continue;const i=s.slice(1),o=t.indexOf(i);s.startsWith("+")&&o===-1&&i?t.push(i):s.startsWith("-")&&o!==-1&&t.splice(o,1)}return t}a(J,"applyToolModifiers");function Y(r,e){return e===void 0?r:!Array.isArray(r)||!Array.isArray(e)||!e.every(S)?e:[...r,...e]}a(Y,"mergeDefaultTools");function Z(r){const e=r.filter(t=>!S(t));return J(e.length>0||r.length===0?e:z,r)}a(Z,"resolveDefaultTools");function h(r,e){const t=C(r,e),s=Y(r.defaultTools,e.defaultTools);return s===void 0?t:{...t,defaultTools:s}}a(h,"deepMergeSettings");function x(r,e){const t=B(r);if(t!==void 0)return t;if(r!==void 0)throw new Error(`Invalid ${e} setting: ${String(r)}`)}a(x,"parseTimeoutSetting");const b=1,T=["enableAnalytics","trackingId"];function ee(r){let e;try{e=JSON.parse(k(r))}catch{return}if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e;if(!(p(t)>b)&&T.some(s=>s in t)){for(const s of T)delete t[s];return JSON.stringify(t,null,2)}}a(ee,"withoutRetiredKeys");function y(r,e,t){return{scope:r,...t?{path:t}:{},error:e instanceof Error?e:new Error(String(e))}}a(y,"toSettingsError");class te{static{a(this,"FileSettingsStorage")}globalSettingsPath;projectSettingsPath;constructor(e,t){const s=f(e),i=f(t);this.globalSettingsPath=m(i,"settings.json"),this.projectSettingsPath=m(s,E,"settings.json")}acquireLockSyncWithRetry(e){let i;for(let o=1;o<=100;o++)try{return _.lockSync(e,{realpath:!1})}catch(n){if((typeof n=="object"&&n!==null&&"code"in n?String(n.code):void 0)!=="ELOCKED"||o===100)throw n;i=n;const g=Date.now();for(;Date.now()-g<20;);}throw i??new Error("Failed to acquire settings lock")}withLock(e,t){const s=e==="global"?this.globalSettingsPath:this.projectSettingsPath,i=W(s);let o;try{const n=P(s);n&&(o=this.acquireLockSyncWithRetry(s));const l=n?R(s,"utf-8"):void 0,g=t(l);g!==void 0&&(P(i)||D(i,{recursive:!0}),o||(o=this.acquireLockSyncWithRetry(s)),V(s,g))}finally{o&&o()}}}class se{static{a(this,"InMemorySettingsStorage")}global;project;withLock(e,t){const s=e==="global"?this.global:this.project,i=t(s);i!==void 0&&(e==="global"?this.global=i:this.project=i)}}class d{static{a(this,"SettingsManager")}storage;globalSettings;projectSettings;settings;projectTrusted;modifiedFields=new Set;modifiedNestedFields=new Map;modifiedProjectFields=new Set;modifiedProjectNestedFields=new Map;globalSettingsLoadError=null;projectSettingsLoadError=null;writeQueue=Promise.resolve();errors;settingsPaths;constructor(e,t,s,i=null,o=null,n=[],l=!0,g={}){this.storage=e,this.globalSettings=t,this.projectSettings=s,this.projectTrusted=l,this.globalSettingsLoadError=i,this.projectSettingsLoadError=o,this.errors=[...n],this.settingsPaths=g,this.settings=h(this.globalSettings,this.projectSettings),this.reportNewerFormatScopes()}static create(e,t=$(),s={}){const i=f(e),o=f(t),n=new te(i,o);return d.fromStorageWithPaths(n,s,{global:m(o,"settings.json"),project:m(i,E,"settings.json")})}static fromStorage(e,t={}){return d.fromStorageWithPaths(e,t)}static fromStorageWithPaths(e,t,s={}){const i=t.projectTrusted??!0,o=d.tryLoadFromStorage(e,"global"),n=d.tryLoadFromStorage(e,"project",i),l=[];return o.error&&l.push(y("global",o.error,s.global)),n.error&&l.push(y("project",n.error,s.project)),new d(e,o.settings,n.settings,o.error,n.error,l,i,s)}static inMemory(e={},t={}){const s=new se,i=d.migrateSettings(structuredClone(e));return s.withLock("global",()=>JSON.stringify(i,null,2)),d.fromStorage(s,t)}static loadFromStorage(e,t,s=!0){if(t==="project"&&!s)return{};let i;if(e.withLock(t,n=>(i=n,t==="global"&&n?ee(n):void 0)),!i)return{};const o=JSON.parse(k(i));return d.migrateSettings(o)}static tryLoadFromStorage(e,t,s=!0){try{return{settings:d.loadFromStorage(e,t,s),error:null}}catch(i){return{settings:{},error:i}}}static migrateSettings(e){for(const t of T)delete e[t];if("queueMode"in e&&!("steeringMode"in e)&&(e.steeringMode=e.queueMode,delete e.queueMode),!("transport"in e)&&typeof e.websockets=="boolean"&&(e.transport=e.websockets?"websocket":"sse",delete e.websockets),"skills"in e&&typeof e.skills=="object"&&e.skills!==null&&!Array.isArray(e.skills)){const t=e.skills;t.enableSkillCommands!==void 0&&e.enableSkillCommands===void 0&&(e.enableSkillCommands=t.enableSkillCommands),Array.isArray(t.customDirectories)&&t.customDirectories.length>0?e.skills=t.customDirectories:delete e.skills}if("retry"in e&&typeof e.retry=="object"&&e.retry!==null&&!Array.isArray(e.retry)){const t=e.retry,s=typeof t.provider=="object"&&t.provider!==null?t.provider:void 0;typeof t.maxDelayMs=="number"&&(s?.maxRetryDelayMs===void 0||s?.maxRetryDelayMs===null)&&(t.provider={...s??{},maxRetryDelayMs:t.maxDelayMs}),delete t.maxDelayMs}return e}getSettings(){return structuredClone(this.settings)}getGlobalSettings(){return structuredClone(this.globalSettings)}getProjectSettings(){return structuredClone(this.projectSettings)}isProjectTrusted(){return this.projectTrusted}setProjectTrusted(e){if(this.projectTrusted===e)return;if(this.projectTrusted=e,this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear(),!e){this.projectSettings={},this.projectSettingsLoadError=null,this.settings=h(this.globalSettings,this.projectSettings);return}const t=d.tryLoadFromStorage(this.storage,"project",e);this.projectSettings=t.settings,this.projectSettingsLoadError=t.error,t.error&&this.recordError("project",t.error),this.settings=h(this.globalSettings,this.projectSettings)}async reload(){await this.writeQueue;const e=d.tryLoadFromStorage(this.storage,"global");e.error?(this.globalSettingsLoadError=e.error,this.recordError("global",e.error)):(this.globalSettings=e.settings,this.globalSettingsLoadError=null),this.modifiedFields.clear(),this.modifiedNestedFields.clear(),this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear();const t=d.tryLoadFromStorage(this.storage,"project",this.projectTrusted);t.error?(this.projectSettingsLoadError=t.error,this.recordError("project",t.error)):(this.projectSettings=t.settings,this.projectSettingsLoadError=null),this.settings=h(this.globalSettings,this.projectSettings),this.reportNewerFormatScopes()}applyOverrides(e){this.settings=h(this.settings,e)}markModified(e,t){this.modifiedFields.add(e),t&&(this.modifiedNestedFields.has(e)||this.modifiedNestedFields.set(e,new Set),this.modifiedNestedFields.get(e).add(t))}markProjectModified(e,t){this.modifiedProjectFields.add(e),t&&(this.modifiedProjectNestedFields.has(e)||this.modifiedProjectNestedFields.set(e,new Set),this.modifiedProjectNestedFields.get(e).add(t))}assertProjectTrustedForWrite(){if(!this.projectTrusted)throw new Error("Project is not trusted; refusing to write project settings")}reportNewerFormat(e){H(this.settingsPaths[e]??`${e} settings.json`)}reportNewerFormatScopes(){p(this.globalSettings)>b&&this.reportNewerFormat("global"),p(this.projectSettings)>b&&this.reportNewerFormat("project")}recordError(e,t){this.errors.push(y(e,t,this.settingsPaths[e]))}clearModifiedScope(e){if(e==="global"){this.modifiedFields.clear(),this.modifiedNestedFields.clear();return}this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear()}enqueueWrite(e,t){this.writeQueue=this.writeQueue.then(()=>{e==="project"&&this.assertProjectTrustedForWrite(),t(),this.clearModifiedScope(e)}).catch(s=>{this.recordError(e,s)})}cloneModifiedNestedFields(e){const t=new Map;for(const[s,i]of e.entries())t.set(s,new Set(i));return t}persistScopedSettings(e,t,s,i){this.storage.withLock(e,o=>{const n=o?JSON.parse(k(o)):{};if(p(n)>b){this.reportNewerFormat(e);return}const l=o?d.migrateSettings(n):{},g={...l};for(const c of s){const u=t[c];if(i.has(c)&&typeof u=="object"&&u!==null){const F=i.get(c),L=l[c]??{},I=u,v={...L};for(const j of F)v[j]=I[j];g[c]=v}else g[c]=u}return JSON.stringify(g,null,2)})}save(){if(this.settings=h(this.globalSettings,this.projectSettings),this.globalSettingsLoadError)return;const e=structuredClone(this.globalSettings),t=new Set(this.modifiedFields),s=this.cloneModifiedNestedFields(this.modifiedNestedFields);this.enqueueWrite("global",()=>{this.persistScopedSettings("global",e,t,s)})}saveProjectSettings(e){if(this.assertProjectTrustedForWrite(),this.projectSettings=structuredClone(e),this.settings=h(this.globalSettings,this.projectSettings),this.projectSettingsLoadError)return;const t=structuredClone(this.projectSettings),s=new Set(this.modifiedProjectFields),i=this.cloneModifiedNestedFields(this.modifiedProjectNestedFields);this.enqueueWrite("project",()=>{this.persistScopedSettings("project",t,s,i)})}updateProjectSettings(e,t){this.assertProjectTrustedForWrite();const s=structuredClone(this.projectSettings);t(s),this.markProjectModified(e),this.saveProjectSettings(s)}async flush(){await this.writeQueue}drainErrors(){const e=[...this.errors];return this.errors=[],e}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(e){this.globalSettings.lastChangelogVersion=e,this.markModified("lastChangelogVersion"),this.save()}getSessionDir(){const e=this.settings.sessionDir;return e&&w(e)}getDefaultProvider(){return this.settings.defaultProvider}getDefaultModel(){return this.settings.defaultModel}setDefaultProvider(e){this.globalSettings.defaultProvider=e,this.markModified("defaultProvider"),this.save()}setDefaultModel(e){this.globalSettings.defaultModel=e,this.markModified("defaultModel"),this.save()}setDefaultModelAndProvider(e,t){this.globalSettings.defaultProvider=e,this.globalSettings.defaultModel=t,this.markModified("defaultProvider"),this.markModified("defaultModel"),this.save()}getSteeringMode(){return this.settings.steeringMode||"one-at-a-time"}setSteeringMode(e){this.globalSettings.steeringMode=e,this.markModified("steeringMode"),this.save()}getFollowUpMode(){return this.settings.followUpMode||"one-at-a-time"}setFollowUpMode(e){this.globalSettings.followUpMode=e,this.markModified("followUpMode"),this.save()}getThemeSetting(){const e=this.settings.theme;if(typeof e=="string")return e}getTheme(){const e=this.getThemeSetting();return e?.includes("/")?void 0:e}setTheme(e){this.globalSettings.theme=e,this.markModified("theme"),this.save()}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(e){this.globalSettings.defaultThinkingLevel=e,this.markModified("defaultThinkingLevel"),this.save()}getModelThinkingLevel(e,t){return this.settings.modelThinkingLevels?.[`${e}/${t}`]}getAllModelThinkingLevels(){return{...this.settings.modelThinkingLevels??{}}}setModelThinkingLevel(e,t,s){this.globalSettings.modelThinkingLevels||(this.globalSettings.modelThinkingLevels={}),this.globalSettings.modelThinkingLevels[`${e}/${t}`]=s,this.markModified("modelThinkingLevels"),this.save()}removeModelThinkingLevel(e,t){this.globalSettings.modelThinkingLevels&&(delete this.globalSettings.modelThinkingLevels[`${e}/${t}`],Object.keys(this.globalSettings.modelThinkingLevels).length===0&&delete this.globalSettings.modelThinkingLevels,this.markModified("modelThinkingLevels"),this.save())}getTransport(){return this.settings.transport??"auto"}setTransport(e){this.globalSettings.transport=e,this.markModified("transport"),this.save()}getCompactionEnabled(){return this.settings.compaction?.enabled??!0}setCompactionEnabled(e){this.globalSettings.compaction||(this.globalSettings.compaction={}),this.globalSettings.compaction.enabled=e,this.markModified("compaction","enabled"),this.save()}getCompactionTokenSetting(e,t){const s=this.settings.compaction,i=s?.[e];if(i!==void 0&&(typeof i!="number"||!Number.isSafeInteger(i)||i<0))throw new Error(`Invalid compaction.${e} setting: ${String(i)}. Expected a non-negative safe integer.`);const o=t?`${t.provider}/${t.id}`:void 0,n=o!==void 0?s?.modelOverrides?.[o]:void 0;if(n!==void 0&&!M(n))throw new Error(`Invalid compaction.modelOverrides["${o}"] setting: ${String(n)}. Expected an object.`);const l=n?.[e];if(l!==void 0&&(typeof l!="number"||!Number.isSafeInteger(l)||l<0))throw new Error(`Invalid compaction.modelOverrides["${o}"].${e} setting: ${String(l)}. Expected a non-negative safe integer.`);return l??i??X[e]}getCompactionReserveTokens(e){return this.getCompactionTokenSetting("reserveTokens",e)}getCompactionKeepRecentTokens(e){return this.getCompactionTokenSetting("keepRecentTokens",e)}getCompactionSettings(e){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(e),keepRecentTokens:this.getCompactionKeepRecentTokens(e),maxContextTokens:this.getCompactionMaxContextTokens(e),pruneToolOutputs:this.getCompactionPruneToolOutputs()}}getCompactionMaxContextTokens(e){return this.getCompactionTokenSetting("maxContextTokens",e)}getCompactionPruneToolOutputs(){const e=this.settings.compaction?.pruneToolOutputs;if(e!==void 0&&typeof e!="boolean")throw new Error(`Invalid compaction.pruneToolOutputs setting: ${String(e)}. Expected a boolean.`);return e??!0}getCompactionSummaryModel(){const e=this.settings.compaction?.summaryModel;if(e===void 0||e==="")return;const t=typeof e=="string"?e.indexOf("/"):-1;if(typeof e!="string"||t<=0||t===e.length-1)throw new Error(`Invalid compaction.summaryModel setting: ${String(e)}. Expected "provider/modelId".`);return{provider:e.slice(0,t),modelId:e.slice(t+1)}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??16384,skipPrompt:this.settings.branchSummary?.skipPrompt??!1}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??!1}getRetryEnabled(){return this.settings.retry?.enabled??!0}setRetryEnabled(e){this.globalSettings.retry||(this.globalSettings.retry={}),this.globalSettings.retry.enabled=e,this.markModified("retry","enabled"),this.save()}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??G,baseDelayMs:this.settings.retry?.baseDelayMs??2e3,maxAgentDelayMs:this.settings.retry?.maxAgentDelayMs??O}}getMaxOutputTokens(){const e=this.settings.maxOutputTokens;if(e===void 0)return K;if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new Error(`Invalid maxOutputTokens setting: ${String(e)}. Expected a non-negative safe integer.`);return e}getOutputTokenLimit(e){const t=this.getMaxOutputTokens();return t>0&&(e<=0||e>t)?t:e}getHttpIdleTimeoutMs(){return x(this.settings.httpIdleTimeoutMs,"httpIdleTimeoutMs")??U}setHttpIdleTimeoutMs(e){if(!Number.isFinite(e)||e<0)throw new Error(`Invalid httpIdleTimeoutMs setting: ${String(e)}`);this.globalSettings.httpIdleTimeoutMs=Math.floor(e),this.markModified("httpIdleTimeoutMs"),this.save()}getCacheWarmingMode(){const e=this.globalSettings.cacheWarming;return e!==void 0&&Q.includes(e)?e:"streaming"}setCacheWarmingMode(e){this.globalSettings.cacheWarming=e,this.markModified("cacheWarming"),this.save()}getProviderRetrySettings(){return{timeoutMs:this.settings.retry?.provider?.timeoutMs,maxRetries:this.settings.retry?.provider?.maxRetries,maxRetryDelayMs:this.settings.retry?.provider?.maxRetryDelayMs??6e4}}getWebSocketConnectTimeoutMs(){return x(this.settings.websocketConnectTimeoutMs,"websocketConnectTimeoutMs")}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!0}getShowCacheMissNotices(){return this.settings.showCacheMissNotices??!1}getExternalEditorCommand(){const e=this.settings.externalEditor;if(typeof e=="string"&&e.trim()!=="")return e;const t=process.env.VISUAL||process.env.EDITOR;return t||(process.platform==="win32"?"notepad":"nano")}setHideThinkingBlock(e){this.globalSettings.hideThinkingBlock=e,this.markModified("hideThinkingBlock"),this.save()}setShowCacheMissNotices(e){this.globalSettings.showCacheMissNotices=e,this.markModified("showCacheMissNotices"),this.save()}getShellPath(){const e=this.settings.shellPath;return e&&w(e)}setShellPath(e){this.globalSettings.shellPath=e,this.markModified("shellPath"),this.save()}getQuietStartup(){const e=this.settings.quietStartup;return e===!1?!1:e==="header"?e:!0}setQuietStartup(e){this.globalSettings.quietStartup=e,this.markModified("quietStartup"),this.save()}getDefaultProjectTrust(){const e=this.globalSettings.defaultProjectTrust;return e==="always"||e==="never"?e:"ask"}setDefaultProjectTrust(e){this.globalSettings.defaultProjectTrust=e,this.markModified("defaultProjectTrust"),this.save()}getShellCommandPrefix(){return this.settings.shellCommandPrefix}getShellEnvironmentPolicy(){const e=this.globalSettings.shellEnvironment??{},t=[...e.exclude??[],...this.projectSettings.shellEnvironment?.exclude??[]];return{...e.inherit!==void 0?{inherit:e.inherit}:{},...t.length>0?{exclude:t}:{},...e.include!==void 0?{include:[...e.include]}:{},...e.set!==void 0?{set:{...e.set}}:{}}}getPermissionRuleSources(){return{...this.globalSettings.permissions?{user:structuredClone(this.globalSettings.permissions)}:{},...this.projectSettings.permissions?{project:structuredClone(this.projectSettings.permissions)}:{}}}getSandboxSettingsSources(){return{...this.globalSettings.sandbox?{global:structuredClone(this.globalSettings.sandbox)}:{},...this.projectSettings.sandbox?{project:structuredClone(this.projectSettings.sandbox)}:{}}}setShellCommandPrefix(e){this.globalSettings.shellCommandPrefix=e,this.markModified("shellCommandPrefix"),this.save()}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(e){this.globalSettings.npmCommand=e?[...e]:void 0,this.markModified("npmCommand"),this.save()}getCollapseChangelog(){return this.settings.collapseChangelog??!0}setCollapseChangelog(e){this.globalSettings.collapseChangelog=e,this.markModified("collapseChangelog"),this.save()}getEnableInstallTelemetry(){return this.settings.enableInstallTelemetry??!0}setEnableInstallTelemetry(e){this.globalSettings.enableInstallTelemetry=e,this.markModified("enableInstallTelemetry"),this.save()}getOrCreateDeviceId(){return this.globalSettings.deviceId||(this.globalSettings.deviceId=A(),this.markModified("deviceId"),this.save()),this.globalSettings.deviceId}getPackages(){return[...this.settings.packages??[]]}setPackages(e){this.globalSettings.packages=e,this.markModified("packages"),this.save()}setProjectPackages(e){this.updateProjectSettings("packages",t=>{t.packages=e})}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(e){this.globalSettings.extensions=e,this.markModified("extensions"),this.save()}setProjectExtensionPaths(e){this.updateProjectSettings("extensions",t=>{t.extensions=e})}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(e){this.globalSettings.skills=e,this.markModified("skills"),this.save()}setProjectSkillPaths(e){this.updateProjectSettings("skills",t=>{t.skills=e})}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(e){this.globalSettings.prompts=e,this.markModified("prompts"),this.save()}setProjectPromptTemplatePaths(e){this.updateProjectSettings("prompts",t=>{t.prompts=e})}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(e){this.globalSettings.themes=e,this.markModified("themes"),this.save()}setProjectThemePaths(e){this.updateProjectSettings("themes",t=>{t.themes=e})}getEnableSkillCommands(){return this.settings.enableSkillCommands??!0}setEnableSkillCommands(e){this.globalSettings.enableSkillCommands=e,this.markModified("enableSkillCommands"),this.save()}getFactoryEnabled(){return this.settings.factoryEnabled??!0}setFactoryEnabled(e){this.globalSettings.factoryEnabled=e,this.markModified("factoryEnabled"),this.save()}getThinkingBudgets(){return this.settings.thinkingBudgets}getTerminalCapabilityOverrides(){const e=this.settings.terminal,t=e?.images;return{...t==="kitty"||t==="iterm2"?{images:t}:t===!1?{images:null}:{},...typeof e?.trueColor=="boolean"?{trueColor:e.trueColor}:{},...typeof e?.hyperlinks=="boolean"?{hyperlinks:e.hyperlinks}:{}}}getShowImages(){return this.settings.terminal?.showImages??!0}setShowImages(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showImages=e,this.markModified("terminal","showImages"),this.save()}getImageWidthCells(){const e=this.settings.terminal?.imageWidthCells;return typeof e!="number"||!Number.isFinite(e)?60:Math.max(1,Math.floor(e))}setImageWidthCells(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.imageWidthCells=Math.max(1,Math.floor(e)),this.markModified("terminal","imageWidthCells"),this.save()}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"}setClearOnShrink(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.clearOnShrink=e,this.markModified("terminal","clearOnShrink"),this.save()}getShowTerminalProgress(){return this.settings.terminal?.showTerminalProgress??!1}setShowTerminalProgress(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showTerminalProgress=e,this.markModified("terminal","showTerminalProgress"),this.save()}getTuiMode(){return this.settings.tuiMode==="fullscreen"?"fullscreen":(this.settings.tuiMode==="regular"||this.settings.tuiMode,"regular")}setTuiMode(e){this.globalSettings.tuiMode=e,this.markModified("tuiMode"),this.save()}getFullscreenExitOutput(){return this.settings.fullscreenExitOutput==="resume-hint"?"resume-hint":"transcript"}setFullscreenExitOutput(e){this.globalSettings.fullscreenExitOutput=e,this.markModified("fullscreenExitOutput"),this.save()}getFullscreenScrollbar(){const e=this.settings.fullscreenScrollbar;return e==="always"||e==="hidden"?e:"auto"}setFullscreenScrollbar(e){this.globalSettings.fullscreenScrollbar=e,this.markModified("fullscreenScrollbar"),this.save()}getFullscreenCopyOnSelect(){return this.settings.fullscreenCopyOnSelect??!0}setFullscreenCopyOnSelect(e){this.globalSettings.fullscreenCopyOnSelect=e,this.markModified("fullscreenCopyOnSelect"),this.save()}getFullscreenWheelScrollLines(){const e=this.settings.fullscreenWheelScrollLines;return typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.min(100,Math.floor(e))):"auto"}setFullscreenWheelScrollLines(e){this.globalSettings.fullscreenWheelScrollLines=e==="auto"?e:Math.max(1,Math.min(100,Math.floor(e))),this.markModified("fullscreenWheelScrollLines"),this.save()}getImageAutoResize(){return this.settings.images?.autoResize??!0}setImageAutoResize(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.autoResize=e,this.markModified("images","autoResize"),this.save()}getBlockImages(){return this.settings.images?.blockImages??!1}setBlockImages(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.blockImages=e,this.markModified("images","blockImages"),this.save()}getEnabledModels(){return this.settings.enabledModels}getDefaultTools(){const e=this.settings.defaultTools;if(e!==void 0)return Z(Array.isArray(e)?e.filter(t=>typeof t=="string"):[])}setEnabledModels(e){this.globalSettings.enabledModels=e,this.markModified("enabledModels"),this.save()}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??"tree"}setDoubleEscapeAction(e){this.globalSettings.doubleEscapeAction=e,this.markModified("doubleEscapeAction"),this.save()}getTreeFilterMode(){const e=this.settings.treeFilterMode;return e&&["default","no-tools","user-only","labeled-only","all"].includes(e)?e:"default"}setTreeFilterMode(e){this.globalSettings.treeFilterMode=e,this.markModified("treeFilterMode"),this.save()}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(e){this.globalSettings.showHardwareCursor=e,this.markModified("showHardwareCursor"),this.save()}getEditorPaddingX(){return this.settings.editorPaddingX??1}setEditorPaddingX(e){this.globalSettings.editorPaddingX=Math.max(0,Math.min(3,Math.floor(e))),this.markModified("editorPaddingX"),this.save()}getOutputPad(){return this.settings.outputPad===1?1:0}setOutputPad(e){this.globalSettings.outputPad=e,this.markModified("outputPad"),this.save()}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??5}setAutocompleteMaxVisible(e){this.globalSettings.autocompleteMaxVisible=Math.max(3,Math.min(20,Math.floor(e))),this.markModified("autocompleteMaxVisible"),this.save()}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??" "}getMermaidRenderingMode(){const e=this.settings.markdown?.mermaid;return e==="off"||e==="final"?e:"streaming"}setMermaidRenderingMode(e){this.globalSettings.markdown??={},this.globalSettings.markdown.mermaid=e,this.markModified("markdown","mermaid"),this.save()}getWarnings(){return{...this.settings.warnings??{}}}setWarnings(e){this.globalSettings.warnings={...e},this.markModified("warnings"),this.save()}}export{Q as CACHE_WARMING_MODES,q as DEFAULT_COMPACTION_MAX_CONTEXT_TOKENS,K as DEFAULT_MAX_OUTPUT_TOKENS,G as DEFAULT_MAX_RETRIES,z as DEFAULT_TOOL_NAMES,te as FileSettingsStorage,se as InMemorySettingsStorage,b as SETTINGS_FORMAT_VERSION,d as SettingsManager,J as applyToolModifiers,me as getToolListError,S as isToolModifier};
@@ -61,6 +61,7 @@ export interface ShellExecutionRequest {
61
61
  }
62
62
  export type ShellExecutionGuard = (request: ShellExecutionRequest) => Promise<string | undefined> | string | undefined;
63
63
  export declare function registerShellExecutionGuard(guard: ShellExecutionGuard): () => void;
64
+ export declare function shellExecutionRefusal(request: ShellExecutionRequest): Promise<string | undefined>;
64
65
  export interface BashSpawnContext {
65
66
  command: string;
66
67
  cwd: string;
@@ -1,20 +1,20 @@
1
- var _e=Object.defineProperty;var r=(t,e)=>_e(t,"name",{value:e,configurable:!0});import{constants as ye}from"node:fs";import{access as ge}from"node:fs/promises";import{constants as $e}from"node:os";import{ToolExecutionError as Le}from"@earendil-works/pi-agent-core";import{Container as Ce,Text as G,truncateToWidth as Te}from"@earendil-works/pi-tui";import{spawn as Pe}from"child_process";import{Type as l}from"typebox";import{fill as U,t as I}from"../../dal/i18n.js";import{keyHint as Ie}from"../../modes/interactive/components/keybinding-hints.js";import{truncateToVisualLines as ve}from"../../modes/interactive/components/visual-truncate.js";import{theme as x}from"../../modes/interactive/theme/theme.js";import{waitForChildProcess as De}from"../../utils/child-process.js";import{writeOutputFile as Ae}from"../../utils/output-files.js";import{getShellConfig as ae,getShellEnv as de,killProcessTree as le,trackDetachedChildPid as ke,untrackDetachedChildPid as Me}from"../../utils/shell.js";import{missingManagedToolHint as Fe}from"../../utils/tools-manager.js";import{describeDenialForModel as Ne}from"../sandbox/denial.js";import{getProcessShellSandbox as Be}from"../sandbox/shell-sandbox.js";import{isReadOnlyBashCommand as Re}from"./bash-read-only.js";import{OutputAccumulator as Ue}from"./output-accumulator.js";import{condenseShellOutput as He,outputCondenseDisabled as je}from"./output-condense.js";import{countOutputLines as Ge,formatCollapsedSummary as We,getTextOutput as ue,invalidArgText as Ve,str as ce,truncateDisplay as Xe}from"./render-utils.js";import{wrapToolDefinition as Ye}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as Ke,formatSize as qe,SHELL_OUTPUT_MAX_CHARS as ee,truncateHeadTail as ze}from"./truncate.js";const me=2147483647,pe=1024*1024,Je=8*1024*1024,Qe=me/1e3,te=12e4,ne=30;function Ze(t){if(t===void 0)return te;if(!Number.isFinite(t)||t<=0)throw new Error("Invalid timeout: must be a finite number of seconds");const e=t*1e3;if(e>me)throw new Error(`Invalid timeout: maximum is ${Qe} seconds`);return e}r(Ze,"resolveTimeoutMs");const fe=l.Object({command:l.String({description:"Shell command to execute"}),description:l.String({description:`What it does and why, 3-10 words in the user's language, shown instead of the command: "Find hardcoded key names", not "run grep"`}),timeout:l.Optional(l.Number({description:"Seconds to wait for the command (default in the tool description). Raise it for long builds."}))}),et=l.Optional(l.Object({mode:l.Union([l.Literal("allow"),l.Literal("unsandboxed")],{description:'"allow": stay sandboxed with the domains/paths below; "unsandboxed": run outside the sandbox'}),justification:l.String({description:"Why, in one sentence for the user, who must approve it"}),allow_domains:l.Optional(l.Array(l.String(),{description:"e.g. registry.npmjs.org"})),allow_write:l.Optional(l.Array(l.String(),{description:"Paths to make writable"}))},{description:"Only after the sandbox blocked this command: the access it needs. Never pre-emptively."})),tt=l.Object({...fe.properties,sandbox_escalation:et}),he={snippet:"Execute bash commands (ls, grep, find, etc.)",guidelines:["You can inspect DAL_* environment variables for current model and session details."]},nt=l.Object({output:l.String({description:"Combined stdout and stderr, possibly truncated"}),truncated:l.Boolean(),full_output_path:l.Optional(l.String({description:"Full output, when truncated"})),exit_code:l.Number({description:"-1 while the command runs in the background"}),background_id:l.Optional(l.String({description:"Background process id, when it is still running"})),wall_time_seconds:l.Number()});function ot(t,e){return{exec:r(async(n,o,{onData:u,signal:i,timeout:g,env:w,yieldTo:s})=>{const $=Ze(g);if(i?.aborted)throw new Error("aborted");const S=e();try{await ge(o,ye.F_OK)}catch{throw new Error(`Working directory does not exist: ${o}
2
- Cannot execute ${t} commands.`)}const b=S.commandTransport==="stdin",c=Pe(S.shell,b?S.args:[...S.args,n],{cwd:o,detached:process.platform!=="win32",env:w??de(),stdio:[b?"pipe":"ignore","pipe","pipe"],windowsHide:!0});b&&(c.stdin?.on("error",()=>{}),c.stdin?.end(n)),c.pid&&ke(c.pid);let a=!1,m=!1,h;const p=new Promise(A=>{h=r(()=>A("yielded"),"onYielded")});let f;const O=r(()=>{c.pid&&le(c.pid)},"onAbort");try{$!==void 0&&(f=setTimeout(()=>{if(s&&c.exitCode===null&&c.signalCode===null&&s(c)){m=!0,h?.();return}a=!0,c.pid&&le(c.pid)},$)),c.stdout?.on("data",u),c.stderr?.on("data",u),i&&(i.aborted?O():i.addEventListener("abort",O,{once:!0}));const A=De(c),H=await Promise.race([A,p]);if(H==="yielded")return A.catch(()=>{}),{exitCode:null,yielded:!0};const V=H;if(i?.aborted)throw new Error("aborted");if(a)throw new Error(`timeout:${($??te)/1e3}`);const L=c.signalCode;return{exitCode:V??(L?128+($e.signals[L]??0):1)}}finally{c.pid&&!m&&Me(c.pid),f&&clearTimeout(f),i&&i.removeEventListener("abort",O)}},"exec")}}r(ot,"createLocalShellOperations");function it(t){return ot("bash",()=>ae(t?.shellPath))}r(it,"createLocalBashOperations");const oe=new Set;function jt(t){return oe.add(t),()=>{oe.delete(t)}}r(jt,"registerShellExecutionGuard");async function st(t){for(const e of oe){let n;try{n=await e(t)}catch(o){return`Command refused: the safety check could not run (${o instanceof Error?o.message:String(o)}).`}if(n!==void 0)return n}}r(st,"shellExecutionRefusal");const rt=["SESSION_ID","SESSION_FILE","PROVIDER","MODEL","REASONING_LEVEL"];function at(t,e,n,o,u){const i={...de()};if(delete i.PI_SESSION_ID,delete i.PI_SESSION_FILE,delete i.PI_PROVIDER,delete i.PI_MODEL,delete i.PI_REASONING_LEVEL,o&&u){const w=u.model;i.PI_SESSION_ID=u.sessionManager.getSessionId();const s=u.sessionManager.getSessionFile();s&&(i.PI_SESSION_FILE=s),w&&(i.PI_PROVIDER=w.provider,i.PI_MODEL=w.id),u.thinkingLevel&&(i.PI_REASONING_LEVEL=u.thinkingLevel)}for(const w of rt){delete i[`DAL_${w}`];const s=i[`PI_${w}`];s!==void 0&&(i[`DAL_${w}`]=s)}const g={command:t,cwd:e,env:i};return n?n(g):g}r(at,"resolveSpawnContext");const dt=5,lt=100;class ut extends Ce{static{r(this,"BashResultRenderComponent")}state={cachedWidth:void 0,cachedLines:void 0,cachedSkipped:void 0}}function ct(t){const e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e),o=Math.floor(n/60),u=n%60;return o<60?`${o}m ${u}s`:`${Math.floor(o/60)}h ${o%60}m ${u}s`}r(ct,"formatDuration");function mt(t,e,n=!1){const o=ce(t?.command),u=ce(t?.description)?.trim(),i=t?.timeout,g=i?x.fg("muted",U(I(" (\u8D85\u65F6 {seconds} \u79D2)"),{seconds:i})):"";if(u){const s=x.fg("toolTitle",x.bold(u))+g;return!n||!o?s:`${s}
3
- ${x.fg("muted",` \u23BF ${e} ${o.trim()}`)}`}const w=o===null?Ve(x):o?x.fg("dim",Xe(o.replace(/\s+/g," ").trim(),42)):x.fg("dim","\u2026");return`${x.fg("toolTitle",x.bold(e))} ${w}${g}`}r(mt,"formatShellCall");function pt(t,e,n,o,u,i,g,w){const s=t.state;t.clear();const $=ft(n,u,i,w);if(!n.expanded&&!g){const a=ue(e,o),m=Ge(a),h=[];m>0&&h.push(U(I("{count} \u884C"),{count:m})),$&&h.push($);const p=We(x,h);p&&t.addChild(new G(p,0,0));return}let S=ue(e,o).trim();const b=e.details?.truncation,c=e.details?.fullOutputPath;if(!n.isPartial&&b?.truncated&&c&&S.endsWith("]")){const a=S.lastIndexOf(`
1
+ var ye=Object.defineProperty;var r=(t,e)=>ye(t,"name",{value:e,configurable:!0});import{constants as $e}from"node:fs";import{access as Le}from"node:fs/promises";import{constants as Te}from"node:os";import{ToolExecutionError as Ce}from"@earendil-works/pi-agent-core";import{Container as Pe,Text as j,truncateToWidth as Ie}from"@earendil-works/pi-tui";import{spawn as ve}from"child_process";import{Type as l}from"typebox";import{fill as U,t as I}from"../../dal/i18n.js";import{keyHint as De}from"../../modes/interactive/components/keybinding-hints.js";import{truncateToVisualLines as Ae}from"../../modes/interactive/components/visual-truncate.js";import{theme as x}from"../../modes/interactive/theme/theme.js";import{waitForChildProcess as ke}from"../../utils/child-process.js";import{writeOutputFile as Me}from"../../utils/output-files.js";import{getShellConfig as le,getShellEnv as ue,killProcessTree as ce,trackDetachedChildPid as Fe,untrackDetachedChildPid as Ne}from"../../utils/shell.js";import{missingManagedToolHint as Be}from"../../utils/tools-manager.js";import{describeDenialForModel as Re}from"../sandbox/denial.js";import{getProcessShellSandbox as Ue}from"../sandbox/shell-sandbox.js";import{isReadOnlyBashCommand as Ge}from"./bash-read-only.js";import{OutputAccumulator as He}from"./output-accumulator.js";import{condenseShellOutput as je,outputCondenseDisabled as We}from"./output-condense.js";import{countOutputLines as Ve,formatCollapsedSummary as Ye,getTextOutput as me,invalidArgText as Xe,str as pe,truncateDisplay as Ke}from"./render-utils.js";import{wrapToolDefinition as qe}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as ze,formatSize as Je,SHELL_OUTPUT_MAX_CHARS as ee,truncateHeadTail as Qe}from"./truncate.js";const fe=2147483647,he=1024*1024,Ze=8*1024*1024,et=fe/1e3,te=12e4,ne=30;function tt(t){if(t===void 0)return te;if(!Number.isFinite(t)||t<=0)throw new Error("Invalid timeout: must be a finite number of seconds");const e=t*1e3;if(e>fe)throw new Error(`Invalid timeout: maximum is ${et} seconds`);return e}r(tt,"resolveTimeoutMs");const we=l.Object({command:l.String({description:"Shell command to execute"}),description:l.String({description:`What it does and why, 3-10 words in the user's language, shown instead of the command: "Find hardcoded key names", not "run grep"`}),timeout:l.Optional(l.Number({description:"Seconds to wait for the command (default in the tool description). Raise it for long builds."}))}),nt=l.Optional(l.Object({mode:l.Union([l.Literal("allow"),l.Literal("unsandboxed")],{description:'"allow": stay sandboxed with the domains/paths below; "unsandboxed": run outside the sandbox'}),justification:l.String({description:"Why, in one sentence for the user, who must approve it"}),allow_domains:l.Optional(l.Array(l.String(),{description:"e.g. registry.npmjs.org"})),allow_write:l.Optional(l.Array(l.String(),{description:"Paths to make writable"}))},{description:"Only after the sandbox blocked this command: the access it needs. Never pre-emptively."})),ot=l.Object({...we.properties,sandbox_escalation:nt}),Se={snippet:"Execute bash commands (ls, grep, find, etc.)",guidelines:["You can inspect DAL_* environment variables for current model and session details."]},it=l.Object({output:l.String({description:"Combined stdout and stderr, possibly truncated"}),truncated:l.Boolean(),full_output_path:l.Optional(l.String({description:"Full output, when truncated"})),exit_code:l.Number({description:"-1 while the command runs in the background"}),background_id:l.Optional(l.String({description:"Background process id, when it is still running"})),wall_time_seconds:l.Number()});function st(t,e){return{exec:r(async(n,o,{onData:u,signal:i,timeout:y,env:w,yieldTo:s})=>{const $=tt(y);if(i?.aborted)throw new Error("aborted");const S=e();try{await Le(o,$e.F_OK)}catch{throw new Error(`Working directory does not exist: ${o}
2
+ Cannot execute ${t} commands.`)}const b=S.commandTransport==="stdin",c=ve(S.shell,b?S.args:[...S.args,n],{cwd:o,detached:process.platform!=="win32",env:w??ue(),stdio:[b?"pipe":"ignore","pipe","pipe"],windowsHide:!0});b&&(c.stdin?.on("error",()=>{}),c.stdin?.end(n)),c.pid&&Fe(c.pid);let a=!1,m=!1,h;const p=new Promise(A=>{h=r(()=>A("yielded"),"onYielded")});let f;const _=r(()=>{c.pid&&ce(c.pid)},"onAbort");try{$!==void 0&&(f=setTimeout(()=>{if(s&&c.exitCode===null&&c.signalCode===null&&s(c)){m=!0,h?.();return}a=!0,c.pid&&ce(c.pid)},$)),c.stdout?.on("data",u),c.stderr?.on("data",u),i&&(i.aborted?_():i.addEventListener("abort",_,{once:!0}));const A=ke(c),G=await Promise.race([A,p]);if(G==="yielded")return A.catch(()=>{}),{exitCode:null,yielded:!0};const V=G;if(i?.aborted)throw new Error("aborted");if(a)throw new Error(`timeout:${($??te)/1e3}`);const L=c.signalCode;return{exitCode:V??(L?128+(Te.signals[L]??0):1)}}finally{c.pid&&!m&&Ne(c.pid),f&&clearTimeout(f),i&&i.removeEventListener("abort",_)}},"exec")}}r(st,"createLocalShellOperations");function rt(t){return st("bash",()=>le(t?.shellPath))}r(rt,"createLocalBashOperations");const oe=Symbol.for("dal.shell.executionGuards"),ie=globalThis;ie[oe]instanceof Set||(ie[oe]=new Set);const se=ie[oe];function Wt(t){return se.add(t),()=>{se.delete(t)}}r(Wt,"registerShellExecutionGuard");async function at(t){for(const e of se){let n;try{n=await e(t)}catch(o){return`Command refused: the safety check could not run (${o instanceof Error?o.message:String(o)}).`}if(n!==void 0)return n}}r(at,"shellExecutionRefusal");const dt=["SESSION_ID","SESSION_FILE","PROVIDER","MODEL","REASONING_LEVEL"];function lt(t,e,n,o,u){const i={...ue()};if(delete i.PI_SESSION_ID,delete i.PI_SESSION_FILE,delete i.PI_PROVIDER,delete i.PI_MODEL,delete i.PI_REASONING_LEVEL,o&&u){const w=u.model;i.PI_SESSION_ID=u.sessionManager.getSessionId();const s=u.sessionManager.getSessionFile();s&&(i.PI_SESSION_FILE=s),w&&(i.PI_PROVIDER=w.provider,i.PI_MODEL=w.id),u.thinkingLevel&&(i.PI_REASONING_LEVEL=u.thinkingLevel)}for(const w of dt){delete i[`DAL_${w}`];const s=i[`PI_${w}`];s!==void 0&&(i[`DAL_${w}`]=s)}const y={command:t,cwd:e,env:i};return n?n(y):y}r(lt,"resolveSpawnContext");const ut=5,ct=100;class mt extends Pe{static{r(this,"BashResultRenderComponent")}state={cachedWidth:void 0,cachedLines:void 0,cachedSkipped:void 0}}function pt(t){const e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e),o=Math.floor(n/60),u=n%60;return o<60?`${o}m ${u}s`:`${Math.floor(o/60)}h ${o%60}m ${u}s`}r(pt,"formatDuration");function ft(t,e,n=!1){const o=pe(t?.command),u=pe(t?.description)?.trim(),i=t?.timeout,y=i?x.fg("muted",U(I(" (\u8D85\u65F6 {seconds} \u79D2)"),{seconds:i})):"";if(u){const s=x.fg("toolTitle",x.bold(u))+y;return!n||!o?s:`${s}
3
+ ${x.fg("muted",` \u23BF ${e} ${o.trim()}`)}`}const w=o===null?Xe(x):o?x.fg("dim",Ke(o.replace(/\s+/g," ").trim(),42)):x.fg("dim","\u2026");return`${x.fg("toolTitle",x.bold(e))} ${w}${y}`}r(ft,"formatShellCall");function ht(t,e,n,o,u,i,y,w){const s=t.state;t.clear();const $=wt(n,u,i,w);if(!n.expanded&&!y){const a=me(e,o),m=Ve(a),h=[];m>0&&h.push(U(I("{count} \u884C"),{count:m})),$&&h.push($);const p=Ye(x,h);p&&t.addChild(new j(p,0,0));return}let S=me(e,o).trim();const b=e.details?.truncation,c=e.details?.fullOutputPath;if(!n.isPartial&&b?.truncated&&c&&S.endsWith("]")){const a=S.lastIndexOf(`
4
4
 
5
5
  [`);a!==-1&&S.slice(a).includes(c)&&(S=S.slice(0,a).trimEnd())}if(S){const a=S.split(`
6
6
  `).map(m=>x.fg("toolOutput",m)).join(`
7
- `);n.expanded?t.addChild(new G(`
8
- ${a}`,0,0)):t.addChild({render:r(m=>{if(s.cachedLines===void 0||s.cachedWidth!==m){const h=ve(a,dt,m);s.cachedLines=h.visualLines,s.cachedSkipped=h.skippedCount,s.cachedWidth=m}if(s.cachedSkipped&&s.cachedSkipped>0){const h=x.fg("muted",U(I("... (\u524D\u9762\u8FD8\u6709 {count} \u884C\uFF0C"),{count:s.cachedSkipped}))+` ${Ie("app.tools.expand",I("\u5373\u53EF\u5C55\u5F00"))}${x.fg("muted",")")}`;return["",Te(h,m,"..."),...s.cachedLines??[]]}return["",...s.cachedLines??[]]},"render"),invalidate:r(()=>{s.cachedWidth=void 0,s.cachedLines=void 0,s.cachedSkipped=void 0},"invalidate")})}if(b?.truncated||c){const a=[];c&&a.push(U(I("\u5B8C\u6574\u8F93\u51FA\uFF1A{path}"),{path:c})),b?.truncated&&(b.truncatedBy==="lines"?a.push(U(I("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A {shown}/{total} \u884C"),{shown:b.outputLines,total:b.totalLines})):a.push(U(I("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A\u4E86 {shown} \u884C\uFF08\u4E0A\u9650 {limit}\uFF09"),{shown:b.outputLines,limit:qe(b.maxBytes??Ke)}))),t.addChild(new G(`
9
- ${x.fg("warning",`[${a.join(". ")}]`)}`,0,0))}$&&t.addChild(new G(`
10
- ${x.fg("muted",$)}`,0,0))}r(pt,"rebuildBashResultRenderComponent");function ft(t,e,n,o){let u;if(!t.isPartial&&o!==void 0)u=o;else if(e!==void 0)u=(n??Date.now())-e;else return;if(!(!t.isPartial&&u<100))return`${t.isPartial?I("\u5DF2\u8FD0\u884C"):I("\u8017\u65F6")} ${ct(u)}`}r(ft,"bashTimingLabel");function ht(t,e,n){const o=n?.operations??e.defaultOperations?.()??it({shellPath:n?.shellPath}),u=n?.commandPrefix,i=n?.exposeSessionEnvironment??!0,g=n?.spawnHook,w=n?.sandbox,s=n?.operations===void 0,$=w?.describeForModel(),S=n?.background;let b=!1;const c=r(a=>`Execute a ${e.shellName} command in the current working directory; returns stdout and stderr. Long output is cut to its start and end (error lines kept) and the full output saved to a file named in the result. ${a?`A command still running after \`timeout\` seconds (default ${ne}) keeps running in the background: you get its id and the output so far, then use the process tool to poll or kill it.`:`A command still running after \`timeout\` seconds (default ${te/1e3}) is killed.`}${$?` ${$}`:""}`,"describe");return{name:e.name,label:e.label,description:c(!1),prepareLoadout:S&&s?a=>(b=a.declared.some(m=>m.name==="process"),b?{descriptions:{[e.name]:c(!0)}}:void 0):void 0,promptSnippet:e.promptSnippet,promptGuidelines:i&&e.promptGuidelines?[...e.promptGuidelines]:void 0,executionMode:"sequential",executionModeFor:e.readOnlyCommand&&!u?a=>e.readOnlyCommand?.(a?.command)?"parallel":void 0:void 0,parameters:w?.active?tt:fe,outputSchema:nt,constrainedSampling:{type:"json_schema",strict:"prefer"},async execute(a,m,h,p,f){const{command:O,timeout:A}=m;p&&p({content:[],details:void 0});const H=await st({toolName:e.name,command:O,cwd:f?.cwd||t,sessionFile:f?.sessionManager?.getSessionFile()});if(H!==void 0)throw new Error(H);const V=u?`${u}
11
- ${O}`:O,L=at(V,f?.cwd||t,g,i,f),X=w??(s?Be():void 0);let C;if(X?.active){if(!e.sandboxShell)throw new Error(`Command refused: ${e.shellName} commands cannot run inside the OS sandbox yet, and the sandbox level is "${X.level}". Use the bash tool, or the user can opt out with \`dal --sandbox off\`.`);C=await X.prepare({command:L.command,cwd:L.cwd,shell:e.sandboxShell(n?.shellPath),shellKind:e.sandboxShellKind??"bash",env:L.env,toolCallId:a,toolName:e.name,escalation:m.sandbox_escalation,ctx:f,signal:h})}const P=new Ue({tempFilePrefix:e.tempFilePrefix,maxBytes:ee});let W=!0,j,Y=!1,ie=0;const K=r(()=>{if(!p||!Y)return;Y=!1,ie=Date.now();const d=P.snapshot({persistIfTruncated:!0});p({content:[{type:"text",text:d.content||""}],details:{truncation:d.truncation.truncated?d.truncation:void 0,fullOutputPath:d.fullOutputPath}})},"emitOutputUpdate"),q=r(()=>{j&&(clearTimeout(j),j=void 0)},"clearUpdateTimer"),we=r(()=>{if(!p)return;Y=!0;const d=lt-(Date.now()-ie);if(d<=0){q(),K();return}j??=setTimeout(()=>{j=void 0,K()},d)},"scheduleOutputUpdate"),Se=r(d=>{W&&(P.append(d),we())},"handleData"),be=r(async()=>{W=!1,P.finish(),q(),K();const d=P.snapshot({persistIfTruncated:!0});return await P.closeTempFile(),d},"finishOutput"),z=r(async(d="(no output)")=>{const _=await be(),k=await P.readFullOutput(Je),T=je()?void 0:He(k.content),E=ze(T?.text??k.content,ee);let D=_.fullOutputPath;(E.truncated||T)&&!D&&(D=await Ae(e.tempFilePrefix,".log",k.content));let M=E.content||d,B;const R=_.truncation.totalLines;return E.truncated?(B={truncation:{content:E.content,truncated:!0,truncatedBy:"bytes",totalLines:R,totalBytes:_.truncation.totalBytes,outputLines:E.headLines+E.tailLines,outputBytes:Buffer.byteLength(E.content,"utf-8"),lastLinePartial:!1,firstLineExceedsLimit:!1,maxLines:R,maxBytes:ee},fullOutputPath:D},M+=`
7
+ `);n.expanded?t.addChild(new j(`
8
+ ${a}`,0,0)):t.addChild({render:r(m=>{if(s.cachedLines===void 0||s.cachedWidth!==m){const h=Ae(a,ut,m);s.cachedLines=h.visualLines,s.cachedSkipped=h.skippedCount,s.cachedWidth=m}if(s.cachedSkipped&&s.cachedSkipped>0){const h=x.fg("muted",U(I("... (\u524D\u9762\u8FD8\u6709 {count} \u884C\uFF0C"),{count:s.cachedSkipped}))+` ${De("app.tools.expand",I("\u5373\u53EF\u5C55\u5F00"))}${x.fg("muted",")")}`;return["",Ie(h,m,"..."),...s.cachedLines??[]]}return["",...s.cachedLines??[]]},"render"),invalidate:r(()=>{s.cachedWidth=void 0,s.cachedLines=void 0,s.cachedSkipped=void 0},"invalidate")})}if(b?.truncated||c){const a=[];c&&a.push(U(I("\u5B8C\u6574\u8F93\u51FA\uFF1A{path}"),{path:c})),b?.truncated&&(b.truncatedBy==="lines"?a.push(U(I("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A {shown}/{total} \u884C"),{shown:b.outputLines,total:b.totalLines})):a.push(U(I("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A\u4E86 {shown} \u884C\uFF08\u4E0A\u9650 {limit}\uFF09"),{shown:b.outputLines,limit:Je(b.maxBytes??ze)}))),t.addChild(new j(`
9
+ ${x.fg("warning",`[${a.join(". ")}]`)}`,0,0))}$&&t.addChild(new j(`
10
+ ${x.fg("muted",$)}`,0,0))}r(ht,"rebuildBashResultRenderComponent");function wt(t,e,n,o){let u;if(!t.isPartial&&o!==void 0)u=o;else if(e!==void 0)u=(n??Date.now())-e;else return;if(!(!t.isPartial&&u<100))return`${t.isPartial?I("\u5DF2\u8FD0\u884C"):I("\u8017\u65F6")} ${pt(u)}`}r(wt,"bashTimingLabel");function St(t,e,n){const o=n?.operations??e.defaultOperations?.()??rt({shellPath:n?.shellPath}),u=n?.commandPrefix,i=n?.exposeSessionEnvironment??!0,y=n?.spawnHook,w=n?.sandbox,s=n?.operations===void 0,$=w?.describeForModel(),S=n?.background;let b=!1;const c=r(a=>`Execute a ${e.shellName} command in the current working directory; returns stdout and stderr. Long output is cut to its start and end (error lines kept) and the full output saved to a file named in the result. ${a?`A command still running after \`timeout\` seconds (default ${ne}) keeps running in the background: you get its id and the output so far, then use the process tool to poll or kill it.`:`A command still running after \`timeout\` seconds (default ${te/1e3}) is killed.`}${$?` ${$}`:""}`,"describe");return{name:e.name,label:e.label,description:c(!1),prepareLoadout:S&&s?a=>(b=a.declared.some(m=>m.name==="process"),b?{descriptions:{[e.name]:c(!0)}}:void 0):void 0,promptSnippet:e.promptSnippet,promptGuidelines:i&&e.promptGuidelines?[...e.promptGuidelines]:void 0,executionMode:"sequential",executionModeFor:e.readOnlyCommand&&!u?a=>e.readOnlyCommand?.(a?.command)?"parallel":void 0:void 0,parameters:w?.active?ot:we,outputSchema:it,constrainedSampling:{type:"json_schema",strict:"prefer"},async execute(a,m,h,p,f){const{command:_,timeout:A}=m;p&&p({content:[],details:void 0});const G=await at({toolName:e.name,command:_,cwd:f?.cwd||t,sessionFile:f?.sessionManager?.getSessionFile()});if(G!==void 0)throw new Error(G);const V=u?`${u}
11
+ ${_}`:_,L=lt(V,f?.cwd||t,y,i,f),Y=w??(s?Ue():void 0);let T;if(Y?.active){if(!e.sandboxShell)throw new Error(`Command refused: ${e.shellName} commands cannot run inside the OS sandbox yet, and the sandbox level is "${Y.level}". Use the bash tool, or the user can opt out with \`dal --sandbox off\`.`);T=await Y.prepare({command:L.command,cwd:L.cwd,shell:e.sandboxShell(n?.shellPath),shellKind:e.sandboxShellKind??"bash",env:L.env,toolCallId:a,toolName:e.name,escalation:m.sandbox_escalation,ctx:f,signal:h})}const P=new He({tempFilePrefix:e.tempFilePrefix,maxBytes:ee});let W=!0,H,X=!1,re=0;const K=r(()=>{if(!p||!X)return;X=!1,re=Date.now();const d=P.snapshot({persistIfTruncated:!0});p({content:[{type:"text",text:d.content||""}],details:{truncation:d.truncation.truncated?d.truncation:void 0,fullOutputPath:d.fullOutputPath}})},"emitOutputUpdate"),q=r(()=>{H&&(clearTimeout(H),H=void 0)},"clearUpdateTimer"),be=r(()=>{if(!p)return;X=!0;const d=ct-(Date.now()-re);if(d<=0){q(),K();return}H??=setTimeout(()=>{H=void 0,K()},d)},"scheduleOutputUpdate"),xe=r(d=>{W&&(P.append(d),be())},"handleData"),Ee=r(async()=>{W=!1,P.finish(),q(),K();const d=P.snapshot({persistIfTruncated:!0});return await P.closeTempFile(),d},"finishOutput"),z=r(async(d="(no output)")=>{const O=await Ee(),k=await P.readFullOutput(Ze),C=We()?void 0:je(k.content),E=Qe(C?.text??k.content,ee);let D=O.fullOutputPath;(E.truncated||C)&&!D&&(D=await Me(e.tempFilePrefix,".log",k.content));let M=E.content||d,B;const R=O.truncation.totalLines;return E.truncated?(B={truncation:{content:E.content,truncated:!0,truncatedBy:"bytes",totalLines:R,totalBytes:O.truncation.totalBytes,outputLines:E.headLines+E.tailLines,outputBytes:Buffer.byteLength(E.content,"utf-8"),lastLinePartial:!1,firstLineExceedsLimit:!1,maxLines:R,maxBytes:ee},fullOutputPath:D},M+=`
12
12
 
13
- [Truncated: first ${E.headLines} and last ${E.tailLines} of ${E.totalLines} lines shown${T?`, after condensing ${R} lines (${T.summary})`:""}; read more with read (offset/limit) or grep. Full output: ${D}]`):T&&(B={fullOutputPath:D},M+=`
13
+ [Truncated: first ${E.headLines} and last ${E.tailLines} of ${E.totalLines} lines shown${C?`, after condensing ${R} lines (${C.summary})`:""}; read more with read (offset/limit) or grep. Full output: ${D}]`):C&&(B={fullOutputPath:D},M+=`
14
14
 
15
- [Condensed: ${T.summary}. Full output: ${D}]`),{text:M,details:B,snapshot:_}},"modelOutput"),N=r((d,_)=>`${d?`${d}
15
+ [Condensed: ${C.summary}. Full output: ${D}]`),{text:M,details:B,snapshot:O}},"modelOutput"),N=r((d,O)=>`${d?`${d}
16
16
 
17
- `:""}${_}`,"appendStatus"),se=performance.now();let v;const J=S&&s&&b?d=>{W=!1;try{return v=S.adopt({child:d,command:O,cwd:L.cwd,...C?{prepared:C}:{},...P.handOff()}),!0}catch{return W=!0,!1}}:void 0;try{let d;try{const y=await o.exec(C?.command??L.command,L.cwd,{onData:Se,signal:h,timeout:A??(J?ne:void 0),env:L.env,...J?{yieldTo:J}:{}});if(y.yielded&&v){const{text:F,details:Z}=await z(""),xe=A??ne,Ee=v.urls.length>0?` It printed ${v.urls.join(" ")}.`:"",Oe=`[Still running after ${xe}s, now in the background as ${v.id}.${Ee} For new output and the exit code call process with action "poll" and id "${v.id}"; "kill" stops it.]`,re=await P.readFullOutput(pe);return{content:[{type:"text",text:N(F,Oe)}],details:{...Z,background:v},structuredContent:{output:re.content,truncated:re.truncated,exit_code:-1,background_id:v.id,wall_time_seconds:Math.round((performance.now()-se)/100)/10}}}d=y.exitCode}catch(y){const{text:F}=await z("");if(await C?.finish(null,""),y instanceof Error&&y.message==="aborted")throw new Error(N(F,"Command aborted"));if(y instanceof Error&&y.message.startsWith("timeout:")){const Z=y.message.split(":")[1];throw new Error(N(F,`Command timed out after ${Z} seconds`))}throw y}const{text:_,details:k,snapshot:T}=await z(),E=await C?.finish(d,T.content||"");if(E&&C)throw new Le(`${N(_,`Command exited with code ${d??"(none)"}`)}
17
+ `:""}${O}`,"appendStatus"),ae=performance.now();let v;const J=S&&s&&b?d=>{W=!1;try{return v=S.adopt({child:d,command:_,cwd:L.cwd,...T?{prepared:T}:{},...P.handOff()}),!0}catch{return W=!0,!1}}:void 0;try{let d;try{const g=await o.exec(T?.command??L.command,L.cwd,{onData:xe,signal:h,timeout:A??(J?ne:void 0),env:L.env,...J?{yieldTo:J}:{}});if(g.yielded&&v){const{text:F,details:Z}=await z(""),_e=A??ne,Oe=v.urls.length>0?` It printed ${v.urls.join(" ")}.`:"",ge=`[Still running after ${_e}s, now in the background as ${v.id}.${Oe} For new output and the exit code call process with action "poll" and id "${v.id}"; "kill" stops it.]`,de=await P.readFullOutput(he);return{content:[{type:"text",text:N(F,ge)}],details:{...Z,background:v},structuredContent:{output:de.content,truncated:de.truncated,exit_code:-1,background_id:v.id,wall_time_seconds:Math.round((performance.now()-ae)/100)/10}}}d=g.exitCode}catch(g){const{text:F}=await z("");if(await T?.finish(null,""),g instanceof Error&&g.message==="aborted")throw new Error(N(F,"Command aborted"));if(g instanceof Error&&g.message.startsWith("timeout:")){const Z=g.message.split(":")[1];throw new Error(N(F,`Command timed out after ${Z} seconds`))}throw g}const{text:O,details:k,snapshot:C}=await z(),E=await T?.finish(d,C.content||"");if(E&&T)throw new Ce(`${N(O,`Command exited with code ${d??"(none)"}`)}
18
18
 
19
- ${Ne(E)}`,{...k,sandbox:C.details});if(d===null)throw new Error(N(_,"Command terminated without an exit code"));const D=Math.round((performance.now()-se)/100)/10,M=await P.readFullOutput(pe),B={output:M.content,truncated:M.truncated,...M.truncated&&T.fullOutputPath?{full_output_path:T.fullOutputPath}:{},exit_code:d,wall_time_seconds:D},R=C?.details.escalation?C.details:void 0,Q=R?{...k,sandbox:R}:k;if(d!==0){const y=d===127?await Fe(_):void 0,F=N(_,`Command exited with code ${d}`);return{content:[{type:"text",text:y?`${F}
20
- ${y}`:F}],details:Q,structuredContent:B,isError:!0}}return{content:[{type:"text",text:_}],details:Q,structuredContent:B}}finally{q()}},renderCall(a,m,h){const p=h.state;h.executionStarted&&p.startedAt===void 0&&(p.startedAt=Date.now(),p.endedAt=void 0);const f=h.lastComponent??new G("",0,0);return f.setText(mt(a,e.prompt,h.expanded===!0)),f},renderResult(a,m,h,p){const f=p.state;f.startedAt!==void 0&&m.isPartial&&!f.interval&&(f.interval=setInterval(()=>p.invalidate(),1e3)),(!m.isPartial||p.isError)&&(f.endedAt??=Date.now(),f.interval&&(clearInterval(f.interval),f.interval=void 0));const O=p.lastComponent??new ut;return pt(O,a,m,p.showImages,f.startedAt,f.endedAt,p.isError,p.durationMs),O.invalidate(),O}}}r(ht,"createShellToolDefinition");const wt={name:"bash",label:"bash",shellName:"bash",prompt:"$",promptSnippet:he.snippet,promptGuidelines:he.guidelines,tempFilePrefix:"dal-bash",readOnlyCommand:Re,sandboxShell:r(t=>ae(t).shell,"sandboxShell")};function St(t,e){return ht(t,wt,e)}r(St,"createBashToolDefinition");function Gt(t,e){const n=St(t,e),o=Ye(n);return Object.assign(o,{promptSnippet:n.promptSnippet,promptGuidelines:n.promptGuidelines}),o}r(Gt,"createBashTool");export{he as bashToolSystemPromptContribution,Gt as createBashTool,St as createBashToolDefinition,it as createLocalBashOperations,ot as createLocalShellOperations,ht as createShellToolDefinition,jt as registerShellExecutionGuard,et as sandboxEscalationSchema};
19
+ ${Re(E)}`,{...k,sandbox:T.details});if(d===null)throw new Error(N(O,"Command terminated without an exit code"));const D=Math.round((performance.now()-ae)/100)/10,M=await P.readFullOutput(he),B={output:M.content,truncated:M.truncated,...M.truncated&&C.fullOutputPath?{full_output_path:C.fullOutputPath}:{},exit_code:d,wall_time_seconds:D},R=T?.details.escalation?T.details:void 0,Q=R?{...k,sandbox:R}:k;if(d!==0){const g=d===127?await Be(O):void 0,F=N(O,`Command exited with code ${d}`);return{content:[{type:"text",text:g?`${F}
20
+ ${g}`:F}],details:Q,structuredContent:B,isError:!0}}return{content:[{type:"text",text:O}],details:Q,structuredContent:B}}finally{q()}},renderCall(a,m,h){const p=h.state;h.executionStarted&&p.startedAt===void 0&&(p.startedAt=Date.now(),p.endedAt=void 0);const f=h.lastComponent??new j("",0,0);return f.setText(ft(a,e.prompt,h.expanded===!0)),f},renderResult(a,m,h,p){const f=p.state;f.startedAt!==void 0&&m.isPartial&&!f.interval&&(f.interval=setInterval(()=>p.invalidate(),1e3)),(!m.isPartial||p.isError)&&(f.endedAt??=Date.now(),f.interval&&(clearInterval(f.interval),f.interval=void 0));const _=p.lastComponent??new mt;return ht(_,a,m,p.showImages,f.startedAt,f.endedAt,p.isError,p.durationMs),_.invalidate(),_}}}r(St,"createShellToolDefinition");const bt={name:"bash",label:"bash",shellName:"bash",prompt:"$",promptSnippet:Se.snippet,promptGuidelines:Se.guidelines,tempFilePrefix:"dal-bash",readOnlyCommand:Ge,sandboxShell:r(t=>le(t).shell,"sandboxShell")};function xt(t,e){return St(t,bt,e)}r(xt,"createBashToolDefinition");function Vt(t,e){const n=xt(t,e),o=qe(n);return Object.assign(o,{promptSnippet:n.promptSnippet,promptGuidelines:n.promptGuidelines}),o}r(Vt,"createBashTool");export{Se as bashToolSystemPromptContribution,Vt as createBashTool,xt as createBashToolDefinition,rt as createLocalBashOperations,st as createLocalShellOperations,St as createShellToolDefinition,Wt as registerShellExecutionGuard,nt as sandboxEscalationSchema,at as shellExecutionRefusal};
@@ -1,4 +1,4 @@
1
- export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashTool, createBashToolDefinition, createLocalBashOperations, registerShellExecutionGuard, type ShellExecutionGuard, type ShellExecutionRequest, } from "./bash.ts";
1
+ export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashTool, createBashToolDefinition, createLocalBashOperations, registerShellExecutionGuard, type ShellExecutionGuard, type ShellExecutionRequest, shellExecutionRefusal, } from "./bash.ts";
2
2
  export { createEditTool, createEditToolDefinition, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, } from "./edit.ts";
3
3
  export { withFileMutationQueue } from "./file-mutation-queue.ts";
4
4
  export { createFindTool, createFindToolDefinition, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, } from "./find.ts";
@@ -1 +1 @@
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
+ var E=Object.defineProperty;var o=(r,e)=>E(r,"name",{value:e,configurable:!0});import{createBashTool as H,createBashToolDefinition as I,createLocalBashOperations as Q,registerShellExecutionGuard as Y,shellExecutionRefusal as j}from"./bash.js";import{createEditTool as v,createEditToolDefinition as J}from"./edit.js";import{withFileMutationQueue as N}from"./file-mutation-queue.js";import{createFindTool as Z,createFindToolDefinition as w}from"./find.js";import{createGrepTool as re,createGrepToolDefinition as te}from"./grep.js";import{createLsTool as ae,createLsToolDefinition as le}from"./ls.js";import{createLocalPowerShellOperations as ne,createPowerShellTool as fe,createPowerShellToolDefinition as Te}from"./powershell.js";import{createProcessToolDefinition as ce}from"./process.js";import{createReadTool as se,createReadToolDefinition as me}from"./read.js";import{DEFAULT_MAX_BYTES as xe,DEFAULT_MAX_LINES as de,formatSize as ge,truncateHead as pe,truncateLine as Ee,truncateTail as be}from"./truncate.js";import{createWriteTool as Se,createWriteToolDefinition as Fe}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 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 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 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 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 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[l(r,e?.read),n(r,e?.bash),T(r,e?.edit),d(r,e?.write)]}o(_,"createCodingToolDefinitions");function M(r,e){return[l(r,e?.read),s(r,e?.grep),c(r,e?.find),D(r,e?.ls)]}o(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:c(r,e?.find),ls:D(r,e?.ls)}}o(k,"createAllToolDefinitions");function y(r,e){return[a(r,e?.read),i(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:i(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{xe as DEFAULT_MAX_BYTES,de as DEFAULT_MAX_LINES,O as allToolNames,k as createAllToolDefinitions,X as createAllTools,H as createBashTool,I as createBashToolDefinition,_ as createCodingToolDefinitions,y as createCodingTools,v as createEditTool,J as createEditToolDefinition,Z as createFindTool,w as createFindToolDefinition,re as createGrepTool,te as createGrepToolDefinition,Q as createLocalBashOperations,ne as createLocalPowerShellOperations,ae as createLsTool,le as createLsToolDefinition,fe as createPowerShellTool,Te as createPowerShellToolDefinition,ce as createProcessToolDefinition,M as createReadOnlyToolDefinitions,C as createReadOnlyTools,se as createReadTool,me as createReadToolDefinition,W as createTool,U as createToolDefinition,Se as createWriteTool,Fe as createWriteToolDefinition,ge as formatSize,Y as registerShellExecutionGuard,j as shellExecutionRefusal,pe as truncateHead,Ee as truncateLine,be as truncateTail,N as withFileMutationQueue};
@@ -1 +1 @@
1
- var s=Object.defineProperty;var i=(e,a)=>s(e,"name",{value:a,configurable:!0});import{createRequire as u}from"node:module";import{getLanguage as r,translate as d}from"@dalcode/dal-pi-kit";const c=[{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-dap",label:"\u8C03\u8BD5\u5668",description:"\u8C03\u8BD5 Python \u548C Node.js \u7A0B\u5E8F\uFF1A\u65AD\u70B9\u3001\u5355\u6B65\u3001\u67E5\u770B\u8C03\u7528\u6808\u4E0E\u53D8\u91CF",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-capabilities",label:"\u80FD\u529B\u4E2D\u5FC3",description:"\u6309\u4EFB\u52A1\u81EA\u52A8\u542F\u7528\u5BA1\u6838\u8FC7\u7684\u8FDE\u63A5\u5668\u3001\u6280\u80FD\u548C\u6269\u5C55\uFF0C\u9700\u8981\u65F6\u81EA\u52A8\u5B89\u88C5\uFF08/capabilities\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\uFF1B\u6A21\u578B\u53D1\u6765\u7684\u5DE5\u5177\u53C2\u6570\u6709\u683C\u5F0F\u5C0F\u9519\u65F6\u5148\u81EA\u52A8\u4FEE\u6B63\u518D\u8C03\u7528",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\uFF1B\u53EA\u63D0\u7B80\u5316\u5EFA\u8BAE\u3001\u4E0D\u6539\u4EE3\u7801\uFF08/simplify\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-learn",label:"\u81EA\u6211\u8FDB\u5316",description:"\u4ECE\u8FC7\u5F80\u4F1A\u8BDD\u5B66\u7ECF\u9A8C\u3001\u8BB0\u4F4F\u9879\u76EE\u7684\u547D\u4EE4\u548C\u4F4D\u7F6E\uFF0C\u91CD\u590D\u7684\u6D41\u7A0B\u53EF\u8D77\u8349\u6210\u6280\u80FD\uFF08/lessons\uFF09",activation:"always"},{package:"@dalcode/dal-recall",label:"\u4F1A\u8BDD\u68C0\u7D22",description:"\u5728\u8FC7\u5F80\u4F1A\u8BDD\u91CC\u641C\u7D22\u4E4B\u524D\u505A\u8FC7\u7684\u51B3\u5B9A\u548C\u7EA6\u5B9A\uFF08session_search\uFF09",activation:"always"},{package:"@dalcode/dal-usage",label:"\u7528\u91CF\u7EDF\u8BA1",description:"\u8DE8\u4F1A\u8BDD\u6C47\u603B token \u548C\u8D39\u7528\uFF0C\u6309\u5929\u3001\u6A21\u578B\u3001\u9879\u76EE\u67E5\u770B\uFF08/usage\uFF09\uFF1B\u53EF\u8BBE\u8D39\u7528\u4E0A\u9650\uFF08--max-cost\u3001/budget\uFF09\u548C\u8FD0\u884C\u65F6\u957F\u4E0A\u9650\uFF08--max-time\uFF09",activation:"always"},{package:"@dalcode/dal-awake",label:"\u957F\u4EFB\u52A1\u9632\u4F11\u7720",description:"\u4EFB\u52A1\u8FD0\u884C\u8F83\u4E45\u65F6\u8BA9\u7535\u8111\u4FDD\u6301\u5524\u9192\uFF08\u5C4F\u5E55\u4ECD\u53EF\u7184\u706D\uFF09\uFF0C\u7ED3\u675F\u540E\u6062\u590D\uFF1B\u4E0D\u6253\u6270\uFF08/awake\uFF09",activation:"always"},{package:"@dalcode/dal-statusline",label:"\u81EA\u5B9A\u4E49\u72B6\u6001\u884C",description:"\u5728\u5E95\u90E8\u72B6\u6001\u680F\u52A0\u4E00\u884C\u81EA\u5DF1\u7684\u5185\u5BB9\uFF1A\u6A21\u677F\u6216\u547D\u4EE4\uFF08/statusline\uFF09",activation:"tui"},{package:"@dalcode/dal-advisor",label:"\u7B2C\u4E8C\u610F\u89C1",description:"\u7531\u6A21\u578B\u8C03\u7528\uFF1A\u8BF7\u53E6\u4E00\u4E2A\u5F3A\u6A21\u578B\u590D\u6838\u5F53\u524D\u65B9\u6848\u5E76\u6307\u51FA\u98CE\u9669\uFF0C\u8D39\u7528\u8BA1\u5165\u4F1A\u8BDD\uFF0C\u6BCF\u4F1A\u8BDD\u6709\u6B21\u6570\u4E0A\u9650",activation:"always"},{package:"@dalcode/dal-compat",label:"Claude Code \u517C\u5BB9",description:"\u6CBF\u7528 Claude Code \u7684\u89C4\u5219\uFF1A\u7528\u6237\u548C\u9879\u76EE .claude/rules/ \u4E0E .claude/CLAUDE.md\u3001\u8BF4\u660E\u6587\u4EF6\u91CC\u7684 @\u6587\u4EF6 \u5F15\u7528\u3001\u5B50\u76EE\u5F55\u91CC\u7684 AGENTS.md",activation:"always"},{package:"@dalcode/dal-structured",label:"\u7ED3\u6784\u5316\u8F93\u51FA",description:"dal -p --output-schema \u6309 JSON Schema \u8F93\u51FA\u6700\u7EC8\u56DE\u7B54\uFF0C\u4E0D\u7B26\u5408\u65F6\u975E\u96F6\u9000\u51FA\uFF0C\u7528\u4E8E\u811A\u672C\u548C CI",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/btw \u65C1\u8DEF\u63D0\u95EE\u3001!vim \u7B49\u4EA4\u4E92\u5F0F\u547D\u4EE4\uFF08\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},{package:"@dalcode/dal-rtk",label:"\u547D\u4EE4\u8F93\u51FA\u538B\u7F29\uFF08rtk\uFF09",description:"\u68C0\u6D4B\u5230\u4F60\u88C5\u4E86 rtk \u65F6\uFF0C\u52A9\u624B\u8FD0\u884C\u7684\u547D\u4EE4\u8F93\u51FA\u7ECF\u5B83\u538B\u7F29\u3001\u8282\u7701\u4E0A\u4E0B\u6587\uFF1B\u6CA1\u88C5\u5219\u4EC0\u4E48\u90FD\u4E0D\u505A\uFF08/rtk\uFF09",activation:"always"}],f=c.map(e=>e.package),v=new Set(c.filter(e=>e.safetyCritical).map(e=>e.package));function m(e){try{const l=u(import.meta.url)(`${e}/package.json`);return{version:l.version??"",extensions:[...l.pi?.extensions??[]]}}catch{return}}i(m,"installedManifest");function g(e=r()){return c.map(a=>{const l=m(a.package);return{name:a.package,label:d(a.label,e),description:d(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 o=[{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:"debug",label:"\u8C03\u8BD5\u5668",summary:"\u8BBE\u65AD\u70B9\u3001\u5355\u6B65\u8FD0\u884C\u7A0B\u5E8F\u5E76\u67E5\u770B\u53D8\u91CF",source:"@dalcode/dal-dap",readOnly:!1,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\u6216 PDF \u94FE\u63A5\u7684\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:"session_search",label:"\u641C\u7D22\u8FC7\u5F80\u4F1A\u8BDD",summary:"\u641C\u7D22\u8FC7\u5F80\u4F1A\u8BDD\u91CC\u7684\u51B3\u5B9A\u548C\u7EA6\u5B9A",source:"@dalcode/dal-recall",readOnly:!0,availability:"default"},{name:"advisor",label:"\u7B2C\u4E8C\u610F\u89C1",summary:"\u8BF7\u53E6\u4E00\u4E2A\u5F3A\u6A21\u578B\u590D\u6838\u5F53\u524D\u65B9\u6848\u5E76\u6307\u51FA\u98CE\u9669",source:"@dalcode/dal-advisor",readOnly:!0,availability:"default"},{name:"structured_output",label:"\u7ED3\u6784\u5316\u8F93\u51FA",summary:"\u6309 --output-schema \u7ED9\u51FA JSON \u683C\u5F0F\u7684\u6700\u7EC8\u56DE\u7B54",source:"@dalcode/dal-structured",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 o){if(a.source==="core")continue;const l=e[a.source]??[];l.push(a.name),e[a.source]=l}return{builtin:o.filter(a=>a.source==="core").map(a=>a.name),extensions:e}})();function k(e=r()){return o.map(a=>({name:a.name,label:d(a.label,e),summary:d(a.summary,e),source:a.source,readOnly:a.readOnly,availability:a.availability}))}i(k,"listToolCatalog");function O(e,a=r()){const l=o.find(n=>n.name===e);if(l)return d(l.label,a);const t=e.match(/^mcp__(.+?)__(.+)$/);return t?`${t[1]} \xB7 ${t[2]}`:e}i(O,"toolDisplayLabel");export{f as BUNDLED_EXTENSION_PACKAGES,w as DAL_TOOL_NAMES,v as SAFETY_CRITICAL_PACKAGES,g as listBundledExtensions,k as listToolCatalog,O as toolDisplayLabel};
1
+ var s=Object.defineProperty;var i=(e,a)=>s(e,"name",{value:a,configurable:!0});import{createRequire as u}from"node:module";import{getLanguage as r,translate as d}from"@dalcode/dal-pi-kit";const c=[{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-dap",label:"\u8C03\u8BD5\u5668",description:"\u8C03\u8BD5 Python \u548C Node.js \u7A0B\u5E8F\uFF1A\u65AD\u70B9\u3001\u5355\u6B65\u3001\u67E5\u770B\u8C03\u7528\u6808\u4E0E\u53D8\u91CF",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-capabilities",label:"\u80FD\u529B\u4E2D\u5FC3",description:"\u6309\u4EFB\u52A1\u81EA\u52A8\u542F\u7528\u5BA1\u6838\u8FC7\u7684\u8FDE\u63A5\u5668\u3001\u6280\u80FD\u548C\u6269\u5C55\uFF0C\u9700\u8981\u65F6\u81EA\u52A8\u5B89\u88C5\uFF08/capabilities\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\uFF1B\u6A21\u578B\u53D1\u6765\u7684\u5DE5\u5177\u53C2\u6570\u6709\u683C\u5F0F\u5C0F\u9519\u65F6\u5148\u81EA\u52A8\u4FEE\u6B63\u518D\u8C03\u7528",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\uFF1B\u53EA\u63D0\u7B80\u5316\u5EFA\u8BAE\u3001\u4E0D\u6539\u4EE3\u7801\uFF08/simplify\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-learn",label:"\u81EA\u6211\u8FDB\u5316",description:"\u4ECE\u8FC7\u5F80\u4F1A\u8BDD\u5B66\u7ECF\u9A8C\u3001\u8BB0\u4F4F\u9879\u76EE\u7684\u547D\u4EE4\u548C\u4F4D\u7F6E\uFF0C\u91CD\u590D\u7684\u6D41\u7A0B\u53EF\u8D77\u8349\u6210\u6280\u80FD\uFF08/lessons\uFF09",activation:"always"},{package:"@dalcode/dal-recall",label:"\u4F1A\u8BDD\u68C0\u7D22",description:"\u5728\u8FC7\u5F80\u4F1A\u8BDD\u91CC\u641C\u7D22\u4E4B\u524D\u505A\u8FC7\u7684\u51B3\u5B9A\u548C\u7EA6\u5B9A\uFF08session_search\uFF09",activation:"always"},{package:"@dalcode/dal-usage",label:"\u7528\u91CF\u7EDF\u8BA1",description:"\u8DE8\u4F1A\u8BDD\u6C47\u603B token \u548C\u8D39\u7528\uFF0C\u6309\u5929\u3001\u6A21\u578B\u3001\u9879\u76EE\u67E5\u770B\uFF08/usage\uFF09\uFF1B\u53EF\u8BBE\u8D39\u7528\u4E0A\u9650\uFF08--max-cost\u3001/budget\uFF09\u548C\u8FD0\u884C\u65F6\u957F\u4E0A\u9650\uFF08--max-time\uFF09",activation:"always"},{package:"@dalcode/dal-awake",label:"\u957F\u4EFB\u52A1\u9632\u4F11\u7720",description:"\u4EFB\u52A1\u8FD0\u884C\u8F83\u4E45\u65F6\u8BA9\u7535\u8111\u4FDD\u6301\u5524\u9192\uFF08\u5C4F\u5E55\u4ECD\u53EF\u7184\u706D\uFF09\uFF0C\u7ED3\u675F\u540E\u6062\u590D\uFF1B\u4E0D\u6253\u6270\uFF08/awake\uFF09",activation:"always"},{package:"@dalcode/dal-remote",label:"\u624B\u673A\u7AEF\u8FDC\u7A0B",description:"\u8BA9 DAL Code \u624B\u673A\u7AEF\u8FDE\u63A5\u8FD9\u53F0\u673A\u5668\uFF1Adal remote enable \u5F00\u542F\uFF0C\u9ED8\u8BA4\u5173\u95ED\uFF08/remote\uFF09",activation:"always"},{package:"@dalcode/dal-statusline",label:"\u81EA\u5B9A\u4E49\u72B6\u6001\u884C",description:"\u5728\u5E95\u90E8\u72B6\u6001\u680F\u52A0\u4E00\u884C\u81EA\u5DF1\u7684\u5185\u5BB9\uFF1A\u6A21\u677F\u6216\u547D\u4EE4\uFF08/statusline\uFF09",activation:"tui"},{package:"@dalcode/dal-advisor",label:"\u7B2C\u4E8C\u610F\u89C1",description:"\u7531\u6A21\u578B\u8C03\u7528\uFF1A\u8BF7\u53E6\u4E00\u4E2A\u5F3A\u6A21\u578B\u590D\u6838\u5F53\u524D\u65B9\u6848\u5E76\u6307\u51FA\u98CE\u9669\uFF0C\u8D39\u7528\u8BA1\u5165\u4F1A\u8BDD\uFF0C\u6BCF\u4F1A\u8BDD\u6709\u6B21\u6570\u4E0A\u9650",activation:"always"},{package:"@dalcode/dal-compat",label:"Claude Code \u517C\u5BB9",description:"\u6CBF\u7528 Claude Code \u7684\u89C4\u5219\uFF1A\u7528\u6237\u548C\u9879\u76EE .claude/rules/ \u4E0E .claude/CLAUDE.md\u3001\u8BF4\u660E\u6587\u4EF6\u91CC\u7684 @\u6587\u4EF6 \u5F15\u7528\u3001\u5B50\u76EE\u5F55\u91CC\u7684 AGENTS.md",activation:"always"},{package:"@dalcode/dal-structured",label:"\u7ED3\u6784\u5316\u8F93\u51FA",description:"dal -p --output-schema \u6309 JSON Schema \u8F93\u51FA\u6700\u7EC8\u56DE\u7B54\uFF0C\u4E0D\u7B26\u5408\u65F6\u975E\u96F6\u9000\u51FA\uFF0C\u7528\u4E8E\u811A\u672C\u548C CI",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/btw \u65C1\u8DEF\u63D0\u95EE\u3001!vim \u7B49\u4EA4\u4E92\u5F0F\u547D\u4EE4\uFF08\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},{package:"@dalcode/dal-rtk",label:"\u547D\u4EE4\u8F93\u51FA\u538B\u7F29\uFF08rtk\uFF09",description:"\u68C0\u6D4B\u5230\u4F60\u88C5\u4E86 rtk \u65F6\uFF0C\u52A9\u624B\u8FD0\u884C\u7684\u547D\u4EE4\u8F93\u51FA\u7ECF\u5B83\u538B\u7F29\u3001\u8282\u7701\u4E0A\u4E0B\u6587\uFF1B\u6CA1\u88C5\u5219\u4EC0\u4E48\u90FD\u4E0D\u505A\uFF08/rtk\uFF09",activation:"always"}],f=c.map(e=>e.package),v=new Set(c.filter(e=>e.safetyCritical).map(e=>e.package));function m(e){try{const l=u(import.meta.url)(`${e}/package.json`);return{version:l.version??"",extensions:[...l.pi?.extensions??[]]}}catch{return}}i(m,"installedManifest");function g(e=r()){return c.map(a=>{const l=m(a.package);return{name:a.package,label:d(a.label,e),description:d(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 o=[{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:"debug",label:"\u8C03\u8BD5\u5668",summary:"\u8BBE\u65AD\u70B9\u3001\u5355\u6B65\u8FD0\u884C\u7A0B\u5E8F\u5E76\u67E5\u770B\u53D8\u91CF",source:"@dalcode/dal-dap",readOnly:!1,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\u6216 PDF \u94FE\u63A5\u7684\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:"session_search",label:"\u641C\u7D22\u8FC7\u5F80\u4F1A\u8BDD",summary:"\u641C\u7D22\u8FC7\u5F80\u4F1A\u8BDD\u91CC\u7684\u51B3\u5B9A\u548C\u7EA6\u5B9A",source:"@dalcode/dal-recall",readOnly:!0,availability:"default"},{name:"advisor",label:"\u7B2C\u4E8C\u610F\u89C1",summary:"\u8BF7\u53E6\u4E00\u4E2A\u5F3A\u6A21\u578B\u590D\u6838\u5F53\u524D\u65B9\u6848\u5E76\u6307\u51FA\u98CE\u9669",source:"@dalcode/dal-advisor",readOnly:!0,availability:"default"},{name:"structured_output",label:"\u7ED3\u6784\u5316\u8F93\u51FA",summary:"\u6309 --output-schema \u7ED9\u51FA JSON \u683C\u5F0F\u7684\u6700\u7EC8\u56DE\u7B54",source:"@dalcode/dal-structured",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 o){if(a.source==="core")continue;const l=e[a.source]??[];l.push(a.name),e[a.source]=l}return{builtin:o.filter(a=>a.source==="core").map(a=>a.name),extensions:e}})();function k(e=r()){return o.map(a=>({name:a.name,label:d(a.label,e),summary:d(a.summary,e),source:a.source,readOnly:a.readOnly,availability:a.availability}))}i(k,"listToolCatalog");function O(e,a=r()){const l=o.find(n=>n.name===e);if(l)return d(l.label,a);const t=e.match(/^mcp__(.+?)__(.+)$/);return t?`${t[1]} \xB7 ${t[2]}`:e}i(O,"toolDisplayLabel");export{f as BUNDLED_EXTENSION_PACKAGES,w as DAL_TOOL_NAMES,v as SAFETY_CRITICAL_PACKAGES,g as listBundledExtensions,k as listToolCatalog,O as toolDisplayLabel};
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { type BackgroundProcessEvent, type BackgroundProcessInfo, BackgroundProc
6
6
  export type { CacheWarmingDecision, CacheWarmingStatus } from "./core/cache-warmer.ts";
7
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";
8
8
  export { createEventBus, type EventBus, type EventBusController } from "./core/event-bus.ts";
9
- export type { AfterProviderResponseEvent, AgentActivityOutcome, AgentBeforeSettleEvent, AgentBeforeSettleEventResult, AgentEndEvent, AgentSettledEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppKeybinding, AutocompleteProviderFactory, BashToolCallEvent, BeforeAgentStartCustomEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeAgentStartUserEvent, BeforeProviderHeadersEvent, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BoundaryContextPreview, BoundaryResult, BoundaryState, BuildSystemPromptOptions, CacheWarmingDecisionEvent, CacheWarmingDecisionEventResult, CompactionEntryDraft, CompactOptions, ContextEditEntryDraft, ContextEvent, ContextEventResult, ContextUsage, ContextWithSystemEvent, CustomEntryDraft, CustomMessageEntryDraft, CustomToolCallEvent, EditToolCallEvent, EntryRenderer, EntryRenderOptions, ExecOptions, ExecResult, ExecuteToolOptions, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionRuntime, ExtensionShortcut, ExtensionToolContext, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionVirtualModel, ExtensionWidgetOptions, FindToolCallEvent, GrepToolCallEvent, InlineExtension, InputEvent, InputEventResult, InputSource, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, MarkdownTransformContext, MarkdownTransformer, McpServersChangeEvent, MessageEndEvent, MessageEndEventResult, MessageRenderer, MessageRenderOptions, MessageStartEvent, MessageUpdateEvent, ModelPickerEntry, ModelPickerEntryState, ModelSelectEvent, ModelSelectSource, NormalizedBuildSystemPromptOptions, PowerShellToolCallEvent, ProjectTrustContext, ProjectTrustEvent, ProjectTrustEventDecision, ProjectTrustEventResult, ProjectTrustHandler, ProviderChatModelConfig, ProviderConfig, ProviderModelConfig, ProviderStreamEvent, 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, ToolAnnotations, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionEndEvent, ToolExecutionMode, ToolExecutionStartEvent, ToolExecutionUpdateEvent, ToolExposure, ToolInfo, ToolLoadout, ToolLoadoutChanges, ToolNamespace, ToolRendererResolver, ToolRenderers, ToolRenderResultOptions, ToolResultEvent, ToolResultEventResult, TurnEndEvent, TurnEndEventResult, TurnStartEvent, UIPromptEndEvent, UIPromptKind, UIPromptStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, } from "./core/extensions/index.ts";
9
+ export type { AfterProviderResponseEvent, AgentActivityOutcome, AgentBeforeSettleEvent, AgentBeforeSettleEventResult, AgentEndEvent, AgentSettledEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppKeybinding, ApprovalOptionKind, ApprovalPrompt, ApprovalSource, AutocompleteProviderFactory, BashToolCallEvent, BeforeAgentStartCustomEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeAgentStartUserEvent, BeforeProviderHeadersEvent, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BoundaryContextPreview, BoundaryResult, BoundaryState, BuildSystemPromptOptions, CacheWarmingDecisionEvent, CacheWarmingDecisionEventResult, CompactionEntryDraft, CompactOptions, ContextEditEntryDraft, ContextEvent, ContextEventResult, ContextUsage, ContextWithSystemEvent, CustomEntryDraft, CustomMessageEntryDraft, CustomToolCallEvent, EditToolCallEvent, EntryRenderer, EntryRenderOptions, ExecOptions, ExecResult, ExecuteToolOptions, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionRuntime, ExtensionShortcut, ExtensionToolContext, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionVirtualModel, ExtensionWidgetOptions, FindToolCallEvent, GrepToolCallEvent, InlineExtension, InputEvent, InputEventResult, InputSource, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, MarkdownTransformContext, MarkdownTransformer, McpServersChangeEvent, MessageEndEvent, MessageEndEventResult, MessageRenderer, MessageRenderOptions, MessageStartEvent, MessageUpdateEvent, ModelPickerEntry, ModelPickerEntryState, ModelSelectEvent, ModelSelectSource, NormalizedBuildSystemPromptOptions, PowerShellToolCallEvent, ProjectTrustContext, ProjectTrustEvent, ProjectTrustEventDecision, ProjectTrustEventResult, ProjectTrustHandler, ProviderChatModelConfig, ProviderConfig, ProviderModelConfig, ProviderStreamEvent, 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, ToolAnnotations, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionEndEvent, ToolExecutionMode, ToolExecutionStartEvent, ToolExecutionUpdateEvent, ToolExposure, ToolInfo, ToolLoadout, ToolLoadoutChanges, ToolNamespace, ToolRendererResolver, ToolRenderers, ToolRenderResultOptions, ToolResultEvent, ToolResultEventResult, TurnEndEvent, TurnEndEventResult, TurnStartEvent, UIPromptEndEvent, UIPromptKind, UIPromptStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, } from "./core/extensions/index.ts";
10
10
  export { createExtensionRuntime, defineTool, discoverAndLoadExtensions, ExtensionRunner, isBashToolResult, isEditToolResult, isFindToolResult, isGrepToolResult, isLsToolResult, isPowerShellToolResult, isReadToolResult, isToolCallEventType, isWriteToolResult, wrapRegisteredTool, wrapRegisteredTools, } from "./core/extensions/index.ts";
11
11
  export type { ReadonlyFooterDataProvider } from "./core/footer-data-provider.ts";
12
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";
@@ -30,7 +30,7 @@ export { type CacheWarmingMode, type CompactionModelOverride, type CompactionSet
30
30
  export { formatSkillsForPrompt, type LoadSkillsFromDirOptions, type LoadSkillsResult, loadSkills, loadSkillsFromDir, type Skill, type SkillFrontmatter, } from "./core/skills.ts";
31
31
  export { createSyntheticSourceInfo } from "./core/source-info.ts";
32
32
  export { type EditDiffResult, generateDiffString, generateUnifiedPatch, normalizeForFuzzyMatch, } from "./core/tools/edit-diff.ts";
33
- 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";
33
+ 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, shellExecutionRefusal, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, type WriteOperations, type WriteToolInput, type WriteToolOptions, withFileMutationQueue, } from "./core/tools/index.ts";
34
34
  export { resolveToCwd } from "./core/tools/path-utils.ts";
35
35
  export { hasTrustRequiringProjectResources, type ProjectTrustDecision, ProjectTrustStore, type ProjectTrustStoreEntry, type ProjectTrustUpdate, } from "./core/trust-manager.ts";
36
36
  export { type ModelRoute, type ModelRouteReason, type ModelRouteRequest, VIRTUAL_MODEL_STATE_ENTRY, type VirtualModelDefinition, type VirtualModelStateData, } from "./core/virtual-models.ts";