dal-code 1.0.25 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/NOTICE +7 -0
  3. package/dal-docs/README.md +13 -0
  4. package/dist/cli/args.d.ts +3 -0
  5. package/dist/cli/args.js +14 -14
  6. package/dist/core/agent-session-services.d.ts +2 -0
  7. package/dist/core/agent-session-services.js +1 -1
  8. package/dist/core/agent-session.d.ts +14 -1
  9. package/dist/core/agent-session.js +8 -7
  10. package/dist/core/background-processes.d.ts +73 -0
  11. package/dist/core/background-processes.js +7 -0
  12. package/dist/core/extensions/index.d.ts +1 -1
  13. package/dist/core/extensions/loader.js +1 -1
  14. package/dist/core/extensions/permission-surface.js +1 -1
  15. package/dist/core/extensions/runner.js +1 -1
  16. package/dist/core/extensions/types.d.ts +3 -0
  17. package/dist/core/host-capabilities.d.ts +50 -0
  18. package/dist/core/host-capabilities.js +2 -0
  19. package/dist/core/permissions/rules.d.ts +45 -0
  20. package/dist/core/permissions/rules.js +1 -0
  21. package/dist/core/permissions/shell-words.js +2 -0
  22. package/dist/core/permissions/tool-policy.d.ts +46 -0
  23. package/dist/core/permissions/tool-policy.js +1 -0
  24. package/dist/core/sandbox/availability.d.ts +9 -0
  25. package/dist/core/sandbox/availability.js +1 -0
  26. package/dist/core/sandbox/denial.d.ts +25 -0
  27. package/dist/core/sandbox/denial.js +3 -0
  28. package/dist/core/sandbox/index.d.ts +5 -0
  29. package/dist/core/sandbox/index.js +1 -0
  30. package/dist/core/sandbox/policy.d.ts +66 -0
  31. package/dist/core/sandbox/policy.js +1 -0
  32. package/dist/core/sandbox/runtime.d.ts +31 -0
  33. package/dist/core/sandbox/runtime.js +1 -0
  34. package/dist/core/sandbox/shell-sandbox.d.ts +119 -0
  35. package/dist/core/sandbox/shell-sandbox.js +5 -0
  36. package/dist/core/sdk.d.ts +3 -0
  37. package/dist/core/sdk.js +1 -1
  38. package/dist/core/settings-manager.d.ts +20 -0
  39. package/dist/core/settings-manager.js +1 -1
  40. package/dist/core/tools/bash.d.ts +15 -1
  41. package/dist/core/tools/bash.js +16 -14
  42. package/dist/core/tools/find.js +11 -11
  43. package/dist/core/tools/grep.js +10 -10
  44. package/dist/core/tools/index.d.ts +1 -0
  45. package/dist/core/tools/index.js +1 -1
  46. package/dist/core/tools/ls.js +6 -6
  47. package/dist/core/tools/powershell.d.ts +1 -1
  48. package/dist/core/tools/powershell.js +2 -2
  49. package/dist/core/tools/process.d.ts +26 -0
  50. package/dist/core/tools/process.js +22 -0
  51. package/dist/core/tools/read.js +15 -15
  52. package/dist/dal/builtins.js +2 -2
  53. package/dist/dal/child-env.js +1 -1
  54. package/dist/dal/manifest.d.ts +32 -0
  55. package/dist/dal/manifest.js +1 -0
  56. package/dist/index.d.ts +8 -3
  57. package/dist/index.js +1 -1
  58. package/dist/main.js +4 -4
  59. package/dist/modes/index.d.ts +2 -2
  60. package/dist/modes/print-mode.js +6 -4
  61. package/dist/modes/rpc/rpc-client.d.ts +24 -1
  62. package/dist/modes/rpc/rpc-client.js +4 -1
  63. package/dist/modes/rpc/rpc-mode.js +1 -1
  64. package/dist/modes/rpc/rpc-types.d.ts +82 -0
  65. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  66. package/dist/node_modules/@dalcode/dal-bridge/src/index.js +1 -1
  67. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  68. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  69. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  70. package/dist/node_modules/@dalcode/dal-interactive/LICENSE +21 -0
  71. package/dist/node_modules/@dalcode/dal-interactive/package.json +33 -0
  72. package/dist/node_modules/@dalcode/dal-interactive/src/handoff.js +28 -0
  73. package/dist/node_modules/@dalcode/dal-interactive/src/index.js +1 -0
  74. package/dist/node_modules/@dalcode/dal-interactive/src/interactive-shell.js +1 -0
  75. package/dist/node_modules/@dalcode/dal-interactive/src/questionnaire.js +3 -0
  76. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  77. package/dist/node_modules/@dalcode/dal-lsp/package.json +3 -3
  78. package/dist/node_modules/@dalcode/dal-mcp/package.json +5 -5
  79. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  80. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +2 -2
  81. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  82. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +2 -2
  83. package/dist/node_modules/@dalcode/dal-plugins/package.json +2 -2
  84. package/dist/node_modules/@dalcode/dal-review/LICENSE +21 -0
  85. package/dist/node_modules/@dalcode/dal-review/package.json +34 -0
  86. package/dist/node_modules/@dalcode/dal-review/src/args.d.ts +13 -0
  87. package/dist/node_modules/@dalcode/dal-review/src/args.js +1 -0
  88. package/dist/node_modules/@dalcode/dal-review/src/core.d.ts +6 -0
  89. package/dist/node_modules/@dalcode/dal-review/src/core.js +1 -0
  90. package/dist/node_modules/@dalcode/dal-review/src/findings.d.ts +23 -0
  91. package/dist/node_modules/@dalcode/dal-review/src/findings.js +4 -0
  92. package/dist/node_modules/@dalcode/dal-review/src/index.js +1 -0
  93. package/dist/node_modules/@dalcode/dal-review/src/prompt.d.ts +3 -0
  94. package/dist/node_modules/@dalcode/dal-review/src/prompt.js +29 -0
  95. package/dist/node_modules/@dalcode/dal-review/src/runner.d.ts +91 -0
  96. package/dist/node_modules/@dalcode/dal-review/src/runner.js +2 -0
  97. package/dist/node_modules/@dalcode/dal-review/src/targets.d.ts +33 -0
  98. package/dist/node_modules/@dalcode/dal-review/src/targets.js +17 -0
  99. package/dist/node_modules/@dalcode/dal-review/src/types.d.ts +94 -0
  100. package/dist/node_modules/@dalcode/dal-review/src/types.js +1 -0
  101. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  102. package/dist/node_modules/@dalcode/dal-router/package.json +4 -4
  103. package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
  104. package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
  105. package/dist/node_modules/@dalcode/dal-subagent/src/agents.js +2 -2
  106. package/dist/node_modules/@dalcode/dal-subagent/src/index.js +12 -12
  107. package/dist/node_modules/@dalcode/dal-subagent/src/process-runner.js +3 -3
  108. package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
  109. package/dist/node_modules/@dalcode/dal-terminal/LICENSE +21 -0
  110. package/dist/node_modules/@dalcode/dal-terminal/package.json +33 -0
  111. package/dist/node_modules/@dalcode/dal-terminal/src/contract.d.ts +60 -0
  112. package/dist/node_modules/@dalcode/dal-terminal/src/contract.js +7 -0
  113. package/dist/node_modules/@dalcode/dal-terminal/src/index.js +6 -0
  114. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  115. package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
  116. package/dist/node_modules/@dalcode/dal-web/src/config.js +2 -2
  117. package/dist/node_modules/@dalcode/dal-web/src/index.js +4 -4
  118. package/dist/node_modules/@dalcode/dal-web/src/search.js +4 -4
  119. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  120. package/dist/node_modules/@dalcode/dal-workflow/src/index.js +4 -4
  121. package/dist/node_modules/@dalcode/dal-workflow/src/plan-mode.js +13 -13
  122. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  123. package/dist/node_modules/@earendil-works/chord/package.json +1 -1
  124. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +4 -0
  125. package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +1 -1
  126. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +4 -4
  127. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  128. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  129. package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
  130. package/dist/node_modules/@earendil-works/pi-client/package.json +3 -3
  131. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  132. package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
  133. package/dist/node_modules/@earendil-works/pi-server/package.json +5 -5
  134. package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/package.json +3 -3
  135. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  136. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  137. package/dist/sdk/index.d.ts +6 -2
  138. package/dist/sdk/index.js +1 -1
  139. package/dist/sdk/review.d.ts +1 -0
  140. package/dist/sdk/review.js +1 -0
  141. package/dist/sdk/subagents.d.ts +8 -0
  142. package/dist/sdk/subagents.js +1 -0
  143. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  144. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  145. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  146. package/examples/extensions/gondolin/package-lock.json +2 -2
  147. package/examples/extensions/gondolin/package.json +1 -1
  148. package/examples/extensions/sandbox/index.ts +6 -0
  149. package/examples/extensions/sandbox/package-lock.json +2 -2
  150. package/examples/extensions/sandbox/package.json +1 -1
  151. package/examples/extensions/with-deps/package-lock.json +2 -2
  152. package/examples/extensions/with-deps/package.json +1 -1
  153. package/npm-shrinkwrap.json +75 -5
  154. package/package.json +6 -1
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@dalcode/dal-interactive",
3
+ "version": "1.0.26",
4
+ "private": true,
5
+ "description": "Terminal-UI conveniences adopted from pi's example extensions: the questionnaire tool (the model asks you questions), /handoff (carry context into a new session) and interactive ! commands (vim, git rebase -i, htop). Active only in the TUI; stands down under DAL Code.",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./src/index.js",
9
+ "exports": {
10
+ ".": "./src/index.js",
11
+ "./package.json": "./package.json"
12
+ },
13
+ "files": [
14
+ "src"
15
+ ],
16
+ "pi": {
17
+ "extensions": [
18
+ "./src/index.js"
19
+ ]
20
+ },
21
+ "dependencies": {
22
+ "@dalcode/dal-pi-kit": "1.0.26",
23
+ "typebox": "1.3.7"
24
+ },
25
+ "peerDependencies": {
26
+ "@earendil-works/pi-coding-agent": "^1.0.9"
27
+ },
28
+ "peerDependenciesMeta": {
29
+ "@earendil-works/pi-coding-agent": {
30
+ "optional": false
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,28 @@
1
+ var w=Object.defineProperty;var a=(e,o)=>w(e,"name",{value:o,configurable:!0});var x=Object.defineProperty,r=a((e,o)=>x(e,"name",{value:o,configurable:!0}),"i");import{t as n}from"@dalcode/dal-pi-kit";import{uuidv7 as C}from"@earendil-works/pi-ai";import{BorderedLoader as b,convertToLlm as k,serializeConversation as S}from"@earendil-works/pi-coding-agent";const T=`You are a context transfer assistant. Given a conversation history and the user's goal for a new thread, generate a focused prompt that:
2
+
3
+ 1. Summarizes relevant context from the conversation (decisions made, approaches taken, key findings)
4
+ 2. Lists any relevant files that were discussed or modified
5
+ 3. Clearly states the next task based on the user's goal
6
+ 4. Is self-contained - the new thread should be able to proceed without the old conversation
7
+
8
+ Format your response as a prompt the user can send to start the new thread. Be concise but include all necessary context. Do not include any preamble like "Here's the prompt" - just output the prompt itself.
9
+
10
+ Example output format:
11
+ ## Context
12
+ We've been working on X. Key decisions:
13
+ - Decision 1
14
+ - Decision 2
15
+
16
+ Files involved:
17
+ - path/to/file1.ts
18
+ - path/to/file2.ts
19
+
20
+ ## Task
21
+ [Clear description of what to do next based on user's goal]`;function m(e){if(e.type==="message")return e.message;if(e.type==="compaction")return{role:"compactionSummary",summary:e.summary,tokensBefore:e.tokensBefore,timestamp:new Date(e.timestamp).getTime()}}a(m,"h"),r(m,"entryToMessage");function p(e){let o=-1;for(let u=e.length-1;u>=0;u--)if(e[u].type==="compaction"){o=u;break}if(o<0)return e.map(m).filter(u=>u!==void 0);const s=e[o],t=s.type==="compaction"?e.findIndex(u=>u.id===s.firstKeptEntryId):-1;return[s,...t>=0?e.slice(t,o):[],...e.slice(o+1)].map(m).filter(u=>u!==void 0)}a(p,"B"),r(p,"getHandoffMessages");function g(e,o){e.registerCommand("handoff",{description:n("\u628A\u5F53\u524D\u8FDB\u5C55\u4EA4\u63A5\u5230\u4E00\u4E2A\u65B0\u4F1A\u8BDD\uFF1A\u751F\u6210\u53EF\u7F16\u8F91\u7684\u4EA4\u63A5\u63D0\u793A"),handler:r(async(s,t)=>{if(t.mode!=="tui"){t.ui.notify(n("/handoff \u53EA\u80FD\u5728\u7EC8\u7AEF\u754C\u9762\u4E2D\u4F7F\u7528"),"error");return}if(!t.model){t.ui.notify(n("\u8FD8\u6CA1\u6709\u9009\u62E9\u6A21\u578B"),"error");return}const u=s.trim();if(!u){t.ui.notify(n("\u7528\u6CD5\uFF1A/handoff <\u65B0\u4F1A\u8BDD\u8981\u505A\u7684\u4E8B>"),"error");return}const A=p(t.sessionManager.getBranch());if(A.length===0){t.ui.notify(n("\u8FD8\u6CA1\u6709\u53EF\u4EA4\u63A5\u7684\u5BF9\u8BDD"),"error");return}const E=k(A),F=S(E),v=t.sessionManager.getSessionFile(),h=await t.ui.custom((f,B,H,l)=>{const c=new b(f,B,n("\u6B63\u5728\u751F\u6210\u4EA4\u63A5\u63D0\u793A\u2026"));return c.onAbort=()=>l(null),r(async()=>{if(o)return o(F,u,c.signal);const i={role:"user",content:[{type:"text",text:`## Conversation History
22
+
23
+ ${F}
24
+
25
+ ## User's Goal for New Thread
26
+
27
+ ${u}`}],timestamp:Date.now()},D=await t.modelRegistry.complete(t.model,{systemPrompt:T,messages:[i]},{signal:c.signal,cacheRetention:"none",sessionId:C()});return D.stopReason==="aborted"?null:D.content.filter(d=>d.type==="text").map(d=>d.text).join(`
28
+ `)},"doGenerate")().then(l).catch(i=>{t.ui.notify(`${n("\u751F\u6210\u4EA4\u63A5\u63D0\u793A\u5931\u8D25\uFF1A")}${i instanceof Error?i.message:String(i)}`,"error"),l(null)}),c});if(h===null){t.ui.notify(n("\u5DF2\u53D6\u6D88"),"info");return}const y=await t.ui.editor(n("\u7F16\u8F91\u4EA4\u63A5\u63D0\u793A"),h);if(y===void 0){t.ui.notify(n("\u5DF2\u53D6\u6D88"),"info");return}(await t.newSession({parentSession:v,withSession:r(async f=>{f.ui.setEditorText(y),f.ui.notify(n("\u4EA4\u63A5\u63D0\u793A\u5DF2\u653E\u8FDB\u8F93\u5165\u6846\uFF0C\u786E\u8BA4\u540E\u53D1\u9001\u3002"),"info")},"withSession")})).cancelled&&t.ui.notify(n("\u6CA1\u6709\u65B0\u5EFA\u4F1A\u8BDD"),"info")},"handler")})}a(g,"D"),r(g,"registerHandoff");export{p as getHandoffMessages,g as registerHandoff};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var t=(e,r)=>c(e,"name",{value:r,configurable:!0});var l=Object.defineProperty,a=t((e,r)=>l(e,"name",{value:r,configurable:!0}),"t");import{registerHandoff as d}from"./handoff.js";import{registerInteractiveShell as g}from"./interactive-shell.js";import{QUESTIONNAIRE_TOOL as i,registerQuestionnaire as I}from"./questionnaire.js";import{getHandoffMessages as u,registerHandoff as O}from"./handoff.js";import{isInteractiveCommand as v,registerInteractiveShell as p}from"./interactive-shell.js";import{QUESTIONNAIRE_TOOL as E,registerQuestionnaire as T}from"./questionnaire.js";function o(e=process.env){return!!(e.DALCODE_BRIDGE_URL&&e.DALCODE_BRIDGE_TOKEN)}t(o,"l"),a(o,"underDalCodeDesktop");function n(e){o()||(I(e),d(e),g(e),e.on("session_start",async(r,f)=>{if(f.mode==="tui")return;const s=e.getActiveTools();s.includes(i)&&e.setActiveTools(s.filter(m=>m!==i))}))}t(n,"m"),a(n,"dalInteractive");export{E as QUESTIONNAIRE_TOOL,n as default,u as getHandoffMessages,v as isInteractiveCommand,O as registerHandoff,p as registerInteractiveShell,T as registerQuestionnaire};
@@ -0,0 +1 @@
1
+ var F=Object.defineProperty;var n=(i,t)=>F(i,"name",{value:t,configurable:!0});var f=Object.defineProperty,c=n((i,t)=>f(i,"name",{value:t,configurable:!0}),"n");import{spawnSync as E}from"node:child_process";import{t as a}from"@dalcode/dal-pi-kit";import{getShellEnv as v}from"@earendil-works/pi-coding-agent";const C=["vim","nvim","vi","nano","emacs","pico","micro","helix","hx","kak","less","more","most","git commit","git rebase","git merge","git cherry-pick","git revert","git add -p","git add --patch","git add -i","git add --interactive","git stash -p","git stash --patch","git reset -p","git reset --patch","git checkout -p","git checkout --patch","git difftool","git mergetool","htop","top","btop","glances","ranger","nnn","lf","mc","vifm","tig","lazygit","gitui","fzf","sk","ssh","telnet","mosh","psql","mysql","sqlite3","mongosh","redis-cli","kubectl edit","kubectl exec -it","docker exec -it","docker run -it","tmux","screen","ncdu"];function m(){const i=process.env.INTERACTIVE_COMMANDS?.split(",").map(e=>e.trim()).filter(Boolean)??[],t=new Set(process.env.INTERACTIVE_EXCLUDE?.split(",").map(e=>e.trim().toLowerCase())??[]);return[...C,...i].filter(e=>!t.has(e.toLowerCase()))}n(m,"v"),c(m,"getInteractiveCommands");function l(i){const t=i.trim().toLowerCase(),e=m();for(const r of e){const s=r.toLowerCase();if(t===s||t.startsWith(`${s} `)||t.startsWith(`${s} `))return!0;const u=t.lastIndexOf("|");if(u!==-1){const o=t.slice(u+1).trim();if(o===s||o.startsWith(`${s} `))return!0}}return!1}n(l,"I"),c(l,"isInteractiveCommand");function d(i){i.on("user_bash",async(t,e)=>{let r=t.command,s=!1;if((r.startsWith("i ")||r.startsWith("i "))&&(s=!0,r=r.slice(2).trim()),!(s||l(r)))return;if(e.mode!=="tui")return{result:{output:a("\uFF08\u4EA4\u4E92\u5F0F\u547D\u4EE4\u53EA\u80FD\u5728\u7EC8\u7AEF\u754C\u9762\u4E2D\u8FD0\u884C\uFF09"),exitCode:1,cancelled:!1,truncated:!1}};const u=await e.ui.custom((o,x,A,p)=>{o.stop(),process.stdout.write("\x1B[2J\x1B[H");const g=process.env.SHELL||"/bin/sh",h=E(g,["-c",r],{stdio:"inherit",cwd:e.cwd,env:v()});return o.start(),o.requestRender(!0),p(h.status),{render:c(()=>[],"render"),invalidate:c(()=>{},"invalidate")}});return{result:{output:u===0?a("\uFF08\u4EA4\u4E92\u5F0F\u547D\u4EE4\u5DF2\u5B8C\u6210\uFF09"):a("\uFF08\u4EA4\u4E92\u5F0F\u547D\u4EE4\u9000\u51FA\uFF0C\u9000\u51FA\u7801 {code}\uFF09").replace("{code}",String(u)),exitCode:u??1,cancelled:!1,truncated:!1}}})}n(d,"A"),c(d,"registerInteractiveShell");export{l as isInteractiveCommand,d as registerInteractiveShell};
@@ -0,0 +1,3 @@
1
+ var ae=Object.defineProperty;var l=(T,h)=>ae(T,"name",{value:h,configurable:!0});var ce=Object.defineProperty,s=l((T,h)=>ce(T,"name",{value:h,configurable:!0}),"s");import{t as a}from"@dalcode/dal-pi-kit";import{Editor as fe,Key as b,matchesKey as E,Text as R,visibleWidth as de,wrapTextWithAnsi as ee}from"@earendil-works/pi-tui";import{Type as c}from"typebox";const pe=c.Object({value:c.String({description:"The value returned when selected"}),label:c.String({description:"Display label for the option"}),description:c.Optional(c.String({description:"Optional description shown below label"}))}),ge=c.Object({id:c.String({description:"Unique identifier for this question"}),label:c.Optional(c.String({description:"Short contextual label for tab bar, e.g. 'Scope', 'Priority' (defaults to Q1, Q2)"})),prompt:c.String({description:"The full question text to display"}),options:c.Array(pe,{description:"Available options to choose from"}),allowOther:c.Optional(c.Boolean({description:"Allow 'Type something' option (default: true)"}))}),he=c.Object({questions:c.Array(ge,{description:"Questions to ask the user"})});function z(T,h=[]){return{content:[{type:"text",text:T}],details:{questions:h,answers:[],cancelled:!0}}}l(z,"V"),s(z,"errorResult");const te="questionnaire";function ne(T){T.registerTool({name:te,label:a("\u95EE\u5377"),description:"Ask the user one or more questions. Use for clarifying requirements, getting preferences, or confirming decisions. For single questions, shows a simple option list. For multiple questions, shows a tab-based interface.",promptSnippet:"questionnaire - ask the user multiple-choice questions when a decision is theirs to make",promptGuidelines:["Use questionnaire only for decisions you cannot infer from the request or the code; give 2-5 concrete options per question."],parameters:he,async execute(h,v,O,Q,q){if(q.mode!=="tui")return z("Error: UI not available (running in non-interactive mode)");if(v.questions.length===0)return z("Error: No questions provided");const r=v.questions.map((f,t)=>({...f,label:f.label||`Q${t+1}`,allowOther:f.allowOther!==!1})),u=r.length>1,D=r.length+1,U=await q.ui.custom((f,t,H,ie)=>{let p=0,$=0,y=!1,S=null,C;const j=new Map,re={borderColor:s(e=>t.fg("accent",e),"borderColor"),selectList:{selectedPrefix:s(e=>t.fg("accent",e),"selectedPrefix"),selectedText:s(e=>t.fg("accent",e),"selectedText"),description:s(e=>t.fg("muted",e),"description"),scrollInfo:s(e=>t.fg("dim",e),"scrollInfo"),noMatch:s(e=>t.fg("warning",e),"noMatch")}},B=new fe(f,re);function F(){C=void 0,f.requestRender()}l(F,"A"),s(F,"refresh");function M(e){ie({questions:r,answers:Array.from(j.values()),cancelled:e})}l(M,"P"),s(M,"submit");function P(){return r[p]}l(P,"k"),s(P,"currentQuestion");function _(){const e=P();if(!e)return[];const n=[...e.options];return e.allowOther&&n.push({value:"__other__",label:a("\u81EA\u5DF1\u8F93\u5165\u2026"),isOther:!0}),n}l(_,"F"),s(_,"currentOptions");function W(){return r.every(e=>j.has(e.id))}l(W,"L"),s(W,"allAnswered");function N(){if(!u){M(!1);return}p<r.length-1?p++:p=r.length,$=0,F()}l(N,"K"),s(N,"advanceAfterAnswer");function K(e,n,m,x,k){j.set(e,{id:e,value:n,label:m,wasCustom:x,index:k})}l(K,"D"),s(K,"saveAnswer"),B.onSubmit=e=>{if(!S)return;const n=e.trim()||a("\uFF08\u672A\u4F5C\u7B54\uFF09");K(S,n,n,!0),y=!1,S=null,B.setText(""),N()};function J(e){if(y){if(E(e,b.escape)){y=!1,S=null,B.setText(""),F();return}B.handleInput(e),F();return}const n=P(),m=_();if(u){if(E(e,b.tab)||E(e,b.right)){p=(p+1)%D,$=0,F();return}if(E(e,b.shift("tab"))||E(e,b.left)){p=(p-1+D)%D,$=0,F();return}}if(p===r.length){E(e,b.enter)&&W()?M(!1):E(e,b.escape)&&M(!0);return}if(E(e,b.up)){$=Math.max(0,$-1),F();return}if(E(e,b.down)){$=Math.min(m.length-1,$+1),F();return}if(E(e,b.enter)&&n){const x=m[$];if(x.isOther){y=!0,S=n.id,B.setText(""),F();return}K(n.id,x.value,x.label,!1,$+1),N();return}E(e,b.escape)&&M(!0)}l(J,"Z"),s(J,"handleInput");function V(e){if(C)return C;const n=[],m=Math.max(1,e),x=P(),k=_();function Y(i){n.push(...ee(i,m))}l(Y,"te"),s(Y,"addWrapped");function d(i,o){const w=de(i);if(w>=m){Y(i+o);return}const A=ee(o,m-w),I=" ".repeat(w);for(let g=0;g<A.length;g++)n.push(`${g===0?i:I}${A[g]}`)}if(l(d,"d"),s(d,"addWrappedWithPrefix"),n.push(t.fg("accent","\u2500".repeat(m))),u){const i=["\u2190 "];for(let g=0;g<r.length;g++){const G=g===p,Z=j.has(r[g].id),se=r[g].label,ue=Z?"\u25A0":"\u25A1",oe=Z?"success":"muted",X=` ${ue} ${se} `,le=G?t.bg("selectedBg",t.fg("text",X)):t.fg(oe,X);i.push(`${le} `)}const o=W(),w=p===r.length,A=` \u2713 ${a("\u63D0\u4EA4")} `,I=w?t.bg("selectedBg",t.fg("text",A)):t.fg(o?"success":"dim",A);i.push(`${I} \u2192`),d(" ",i.join("")),n.push("")}function L(){for(let i=0;i<k.length;i++){const o=k[i],w=i===$,A=o.isOther===!0,I=w?t.fg("accent","> "):" ",g=`${i+1}. ${o.label}${A&&y?" \u270E":""}`,G=w||A&&y?"accent":"text";d(I,t.fg(G,g)),o.description&&d(" ",t.fg("muted",o.description))}}if(l(L,"G"),s(L,"renderOptions"),y&&x){d(" ",t.fg("text",x.prompt)),n.push(""),L(),n.push(""),d(" ",t.fg("muted",a("\u4F60\u7684\u56DE\u7B54\uFF1A")));for(const i of B.render(Math.max(1,m-2)))n.push(` ${i}`);n.push(""),d(" ",t.fg("dim",a("Enter \u63D0\u4EA4 \u2022 Esc \u53D6\u6D88")))}else if(p===r.length){d(" ",t.fg("accent",t.bold(a("\u53EF\u4EE5\u63D0\u4EA4\u4E86")))),n.push("");for(const i of r){const o=j.get(i.id);if(o){const w=o.wasCustom?a("\uFF08\u81EA\u586B\uFF09"):"",A=`${t.fg("muted",`${i.label}: `)}${t.fg("text",w+o.label)}`;d(" ",A)}}if(n.push(""),W())d(" ",t.fg("success",a("\u6309 Enter \u63D0\u4EA4")));else{const i=r.filter(o=>!j.has(o.id)).map(o=>o.label).join(", ");d(" ",t.fg("warning",`${a("\u8FD8\u6CA1\u56DE\u7B54\uFF1A")}${i}`))}}else x&&(d(" ",t.fg("text",x.prompt)),n.push(""),L());if(n.push(""),!y){const i=u?a("Tab/\u2190\u2192 \u5207\u6362\u95EE\u9898 \u2022 \u2191\u2193 \u9009\u62E9 \u2022 Enter \u786E\u8BA4 \u2022 Esc \u53D6\u6D88"):a("\u2191\u2193 \u9009\u62E9 \u2022 Enter \u786E\u8BA4 \u2022 Esc \u53D6\u6D88");d(" ",t.fg("dim",i))}return n.push(t.fg("accent","\u2500".repeat(m))),C=n,n}return l(V,"ee"),s(V,"render"),{render:V,invalidate:s(()=>{C=void 0},"invalidate"),handleInput:J}});return U.cancelled?{content:[{type:"text",text:"User cancelled the questionnaire"}],details:U}:{content:[{type:"text",text:U.answers.map(f=>{const t=r.find(H=>H.id===f.id)?.label||f.id;return f.wasCustom?`${t}: user wrote: ${f.label}`:`${t}: user selected: ${f.index}. ${f.label}`}).join(`
2
+ `)}],details:U}},renderCall(h,v,O){const Q=h.questions||[],q=Q.length,r=Q.map(D=>D.label||D.id).join(", ");let u=v.fg("toolTitle",v.bold(`${a("\u95EE\u5377")} `));return u+=v.fg("muted",`${q} ${a("\u4E2A\u95EE\u9898")}`),r&&(u+=v.fg("dim",` (${r})`)),new R(u,0,0)},renderResult(h,v,O,Q){const q=h.details;if(!q){const u=h.content[0];return new R(u?.type==="text"?u.text:"",0,0)}if(q.cancelled)return new R(O.fg("warning",a("\u5DF2\u53D6\u6D88")),0,0);const r=q.answers.map(u=>{if(u.wasCustom)return`${O.fg("success","\u2713 ")}${O.fg("accent",u.id)}: ${O.fg("muted",a("\uFF08\u81EA\u586B\uFF09"))}${u.label}`;const D=u.index?`${u.index}. ${u.label}`:u.label;return`${O.fg("success","\u2713 ")}${O.fg("accent",u.id)}: ${D}`});return new R(r.join(`
3
+ `),0,0)}})}l(ne,"xe"),s(ne,"registerQuestionnaire");export{te as QUESTIONNAIRE_TOOL,ne as registerQuestionnaire};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-lang",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -17,8 +17,8 @@
17
17
  ]
18
18
  },
19
19
  "dependencies": {
20
- "@dalcode/dal-pi-kit": "1.0.25",
21
- "@dalcode/dal-bridge": "1.0.25"
20
+ "@dalcode/dal-pi-kit": "1.0.26",
21
+ "@dalcode/dal-bridge": "1.0.26"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@earendil-works/pi-coding-agent": "^1.0.9"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-lsp",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -19,8 +19,8 @@
19
19
  ]
20
20
  },
21
21
  "dependencies": {
22
- "@dalcode/dal-bridge": "1.0.25",
23
- "@dalcode/dal-pi-kit": "1.0.25",
22
+ "@dalcode/dal-bridge": "1.0.26",
23
+ "@dalcode/dal-pi-kit": "1.0.26",
24
24
  "cross-spawn": "7.0.6",
25
25
  "typebox": "1.3.7"
26
26
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-mcp",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -26,10 +26,10 @@
26
26
  ]
27
27
  },
28
28
  "dependencies": {
29
- "@dalcode/dal-bridge": "1.0.25",
30
- "@dalcode/dal-guard": "1.0.25",
31
- "@dalcode/dal-pi-kit": "1.0.25",
32
- "@dalcode/deepailab": "1.0.25",
29
+ "@dalcode/dal-bridge": "1.0.26",
30
+ "@dalcode/dal-guard": "1.0.26",
31
+ "@dalcode/dal-pi-kit": "1.0.26",
32
+ "@dalcode/deepailab": "1.0.26",
33
33
  "cross-spawn": "7.0.6"
34
34
  },
35
35
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-office",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -17,7 +17,7 @@
17
17
  ]
18
18
  },
19
19
  "dependencies": {
20
- "@dalcode/dal-pi-kit": "1.0.25",
20
+ "@dalcode/dal-pi-kit": "1.0.26",
21
21
  "docx": "9.7.1",
22
22
  "echarts": "6.1.0",
23
23
  "exceljs": "4.4.0",