dal-code 1.0.54 → 1.0.55

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 (140) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/NOTICE +11 -0
  3. package/dist/bundle/chunks/{anthropic-messages-UHE6F2IE.js → anthropic-messages-LJWWEQIU.js} +1 -1
  4. package/dist/bundle/chunks/{azure-openai-responses-EK4W2MKL.js → azure-openai-responses-GK4VH6GM.js} +1 -1
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
  6. package/dist/bundle/chunks/{chunk-K4B5ABCQ.js → chunk-2XX4WZT6.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-CSZTBJOE.js → chunk-3ANBT7AT.js} +1 -1
  8. package/dist/bundle/chunks/{chunk-SCYK4XNE.js → chunk-44EXLOHK.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-3ZHZINH3.js → chunk-5TGFM4KW.js} +2 -2
  10. package/dist/bundle/chunks/{chunk-RKLUP6JT.js → chunk-6U37J6E7.js} +343 -343
  11. package/dist/bundle/chunks/{chunk-EH7SFF47.js → chunk-AL3DFAIM.js} +2 -2
  12. package/dist/bundle/chunks/{chunk-356BFRU3.js → chunk-D3HKK2ZD.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-IDZ3QKHZ.js → chunk-DBT5OS5V.js} +1 -1
  14. package/dist/bundle/chunks/{chunk-VIS5PYQO.js → chunk-DWMC4U2M.js} +1 -1
  15. package/dist/bundle/chunks/{chunk-K7VBBYTT.js → chunk-F5SIUTR7.js} +1 -1
  16. package/dist/bundle/chunks/{chunk-O7G23ELK.js → chunk-GX37DI5S.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-FE533CCR.js → chunk-KSF7BFGS.js} +1 -1
  18. package/dist/bundle/chunks/{chunk-L3RBW36Y.js → chunk-NMU45EFT.js} +1 -1
  19. package/dist/bundle/chunks/{chunk-2C7JTP5O.js → chunk-PRBATF6B.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-4DMD6C65.js → chunk-SCSGNIU5.js} +1 -1
  21. package/dist/bundle/chunks/{chunk-33MCYYJ3.js → chunk-SMPERFJU.js} +1 -1
  22. package/dist/bundle/chunks/{chunk-XRF4A4KI.js → chunk-SNBVCTMQ.js} +2 -2
  23. package/dist/bundle/chunks/{chunk-R7FBN5UP.js → chunk-YDOF6JVP.js} +2 -2
  24. package/dist/bundle/chunks/{chunk-B5GJW7C2.js → chunk-ZYP3V3TD.js} +1 -1
  25. package/dist/bundle/chunks/{cli-XOLEGZVC.js → cli-VKNCK5P5.js} +1 -1
  26. package/dist/bundle/chunks/{cli-YJV3WN2N.js → cli-Z44UHMMU.js} +1 -1
  27. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-KNGB64NR.js → cloudflare-workers-ai-system-one-G4E4L26A.js} +1 -1
  28. package/dist/bundle/chunks/{easter-egg-3d-5TFBCTIS.js → easter-egg-3d-W2F3ROZ6.js} +1 -1
  29. package/dist/bundle/chunks/{execute-6PNQ63VS.js → execute-3FWM3EMV.js} +1 -1
  30. package/dist/bundle/chunks/{google-generative-ai-YJN7TGWU.js → google-generative-ai-HVFDKPI3.js} +1 -1
  31. package/dist/bundle/chunks/{google-vertex-3BVJFMMZ.js → google-vertex-6E4HATAC.js} +1 -1
  32. package/dist/bundle/chunks/{llama-cpp-classify-JVUWNG3E.js → llama-cpp-classify-3HAEJDKO.js} +1 -1
  33. package/dist/bundle/chunks/{mcp-PC3Y3FBI.js → mcp-SGBPG7LV.js} +1 -1
  34. package/dist/bundle/chunks/{mistral-conversations-O6YIQAS5.js → mistral-conversations-6UC2WYUC.js} +1 -1
  35. package/dist/bundle/chunks/{office-AXLGVCMO.js → office-2F4B572E.js} +1 -1
  36. package/dist/bundle/chunks/{openai-codex-responses-YQ5NNPTG.js → openai-codex-responses-WPSZR4EE.js} +1 -1
  37. package/dist/bundle/chunks/{openai-completions-R4I3PKBD.js → openai-completions-2RGIFVKJ.js} +1 -1
  38. package/dist/bundle/chunks/{openai-decisions-IUHMKKHZ.js → openai-decisions-BLZVYNRQ.js} +1 -1
  39. package/dist/bundle/chunks/{openai-responses-E2PHOQF4.js → openai-responses-N65DO7MB.js} +1 -1
  40. package/dist/bundle/chunks/{openrouter-images-NCMLTKZW.js → openrouter-images-LQ4VP5P7.js} +1 -1
  41. package/dist/bundle/chunks/{pi-messages-GLTSGLSO.js → pi-messages-VYTRLMVB.js} +1 -1
  42. package/dist/bundle/chunks/{review-KXWT7T3V.js → review-MKITXKSI.js} +1 -1
  43. package/dist/bundle/chunks/{router-26PXJ7YH.js → router-RL7OYANY.js} +1 -1
  44. package/dist/bundle/chunks/{runtime-LJBCO7CX.js → runtime-KB5ZUQB6.js} +1 -1
  45. package/dist/bundle/chunks/{sdk-6GP346VB.js → sdk-C5BAFGNR.js} +1 -1
  46. package/dist/bundle/chunks/sync-AQUDRXHM.js +7 -0
  47. package/dist/bundle/chunks/{typesafe-system-one-GQFHU7SQ.js → typesafe-system-one-6ZFGVJMV.js} +1 -1
  48. package/dist/bundle/chunks/{usage-MY7HTXQB.js → usage-CK3QZLTW.js} +1 -1
  49. package/dist/bundle/chunks/{virtual-modules-BEBLHRXC.js → virtual-modules-GRXCAWTO.js} +1 -1
  50. package/dist/bundle/cli-runtime.js +1 -1
  51. package/dist/bundle/index.js +1 -1
  52. package/dist/bundle/rpc-entry.js +1 -1
  53. package/dist/core/extensions/index.d.ts +1 -1
  54. package/dist/core/extensions/types.d.ts +9 -5
  55. package/dist/core/tools/bash.js +1 -1
  56. package/dist/core/tools/edit.js +2 -3
  57. package/dist/core/tools/renderers/bash.js +1 -1
  58. package/dist/core/tools/renderers/edit.js +2 -2
  59. package/dist/modes/interactive/components/assistant-message.d.ts +3 -0
  60. package/dist/modes/interactive/components/assistant-message.js +2 -2
  61. package/dist/modes/interactive/components/diff.d.ts +22 -0
  62. package/dist/modes/interactive/components/diff.js +4 -3
  63. package/dist/modes/interactive/components/keybinding-hints.js +1 -1
  64. package/dist/modes/interactive/components/panel-line.js +1 -0
  65. package/dist/modes/interactive/components/status-indicator.d.ts +23 -1
  66. package/dist/modes/interactive/components/status-indicator.js +1 -1
  67. package/dist/modes/interactive/components/tool-execution.d.ts +2 -2
  68. package/dist/modes/interactive/components/tool-execution.js +5 -5
  69. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  70. package/dist/modes/interactive/interactive-mode.js +18 -18
  71. package/dist/modes/interactive/theme/dark.json +4 -0
  72. package/dist/modes/interactive/theme/light.json +4 -0
  73. package/dist/modes/interactive/theme/system-theme.js +1 -1
  74. package/dist/modes/interactive/theme/theme-tokens.d.ts +10 -0
  75. package/dist/modes/interactive/theme/theme-tokens.js +1 -1
  76. package/dist/modes/rpc/rpc-types.d.ts +2 -6
  77. package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
  78. package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
  79. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  80. package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
  81. package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
  82. package/dist/node_modules/@dalcode/dal-compat/package.json +2 -2
  83. package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
  84. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  85. package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
  86. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  87. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  88. package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
  89. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  90. package/dist/node_modules/@dalcode/dal-learn/package.json +2 -2
  91. package/dist/node_modules/@dalcode/dal-learn/src/engine.js +2 -2
  92. package/dist/node_modules/@dalcode/dal-learn/src/index.js +14 -14
  93. package/dist/node_modules/@dalcode/dal-learn/src/lessons.js +4 -4
  94. package/dist/node_modules/@dalcode/dal-learn/src/safety.js +2 -2
  95. package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
  96. package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
  97. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  98. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +2 -2
  99. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  100. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +2 -2
  101. package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
  102. package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
  103. package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
  104. package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
  105. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  106. package/dist/node_modules/@dalcode/dal-router/package.json +6 -6
  107. package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
  108. package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
  109. package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
  110. package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
  111. package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
  112. package/dist/node_modules/@dalcode/dal-sync/package.json +4 -4
  113. package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -4
  114. package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
  115. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  116. package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
  117. package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
  118. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  119. package/dist/node_modules/@dalcode/dal-workflow/src/todo.js +4 -4
  120. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  121. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  122. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  123. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  124. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
  125. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
  126. package/dist/node_modules/@earendil-works/pi-ai/package.json +3 -3
  127. package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
  128. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  129. package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
  130. package/dist/node_modules/@earendil-works/pi-schema/package.json +1 -1
  131. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  132. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  133. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  134. package/examples/extensions/gondolin/package-lock.json +2 -2
  135. package/examples/extensions/gondolin/package.json +1 -1
  136. package/examples/extensions/with-deps/package-lock.json +2 -2
  137. package/examples/extensions/with-deps/package.json +1 -1
  138. package/npm-shrinkwrap.json +2 -2
  139. package/package.json +1 -1
  140. package/dist/bundle/chunks/sync-ONQZCAYG.js +0 -7
@@ -1 +1 @@
1
- import{createRequire as r}from"node:module";const u=r(import.meta.url);import{McpOAuthAuthorizationRequiredError as e,McpOAuthCredentialStore as t,McpServerConnection as o,McpServerLog as i,McpSignInCancelledError as p,createDefaultTransport as c,createMcpAuthProvider as m,signInMcpServer as n}from"./chunk-4DMD6C65.js";import"./chunk-356BFRU3.js";import"./chunk-SE42OS3U.js";import"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import"./chunk-XRF4A4KI.js";import"./chunk-JXWJOIH4.js";export{e as McpOAuthAuthorizationRequiredError,t as McpOAuthCredentialStore,o as McpServerConnection,i as McpServerLog,p as McpSignInCancelledError,c as createDefaultTransport,m as createMcpAuthProvider,n as signInMcpServer};
1
+ import{createRequire as r}from"node:module";const u=r(import.meta.url);import{McpOAuthAuthorizationRequiredError as e,McpOAuthCredentialStore as t,McpServerConnection as o,McpServerLog as i,McpSignInCancelledError as p,createDefaultTransport as c,createMcpAuthProvider as m,signInMcpServer as n}from"./chunk-SCSGNIU5.js";import"./chunk-D3HKK2ZD.js";import"./chunk-SE42OS3U.js";import"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import"./chunk-SNBVCTMQ.js";import"./chunk-JXWJOIH4.js";export{e as McpOAuthAuthorizationRequiredError,t as McpOAuthCredentialStore,o as McpServerConnection,i as McpServerLog,p as McpSignInCancelledError,c as createDefaultTransport,m as createMcpAuthProvider,n as signInMcpServer};
@@ -1 +1 @@
1
- var m=Object.defineProperty;var t=(r,o)=>m(r,"name",{value:o,configurable:!0});import{createRequire as a}from"node:module";const Z=a(import.meta.url);import{BUILTIN_AGENT_DESCRIPTIONS as i,READ_ONLY_TOOL_NAMES as p}from"./chunk-CSZTBJOE.js";import"./chunk-VIS5PYQO.js";import{DAL_HOOK_ENTRY_TYPE as n,dalHookActivity as s,isDalHookActivity as l,runDalHookEvent as E,runNotificationHooks as _,runUserPromptSubmitHooks as N}from"./chunk-L3RBW36Y.js";import{BUNDLED_EXTENSION_PACKAGES as O,DAL_TOOL_NAMES as A,DefaultPackageManager as S,HOST_CAPABILITIES_ENV as T,HOST_TOKEN_ENV as I,HOST_TOKEN_HEADER as c,HOST_URL_ENV as u,RpcClient as D,RpcCommandError as R,SessionManager as L,SettingsManager as d,buildProjectMap as P,formatProjectMapPrompt as H,getDefaultSessionDirs as f,listBundledExtensions as C,listToolCatalog as g,loadProjectContextFiles as k,loadSkills as M,parseFrontmatter as v,parseSessionEntries as B,toolDisplayLabel as w}from"./chunk-RKLUP6JT.js";import{ModelRuntime as y,PROJECT_HOOKS_FILE_ENV as F,loadDalHooks as K,projectHooksFileFromEnv as V}from"./chunk-R7FBN5UP.js";import"./chunk-3ZHZINH3.js";import"./chunk-3YGHTGYM.js";import"./chunk-356BFRU3.js";import"./chunk-SE42OS3U.js";import"./chunk-K7VBBYTT.js";import"./chunk-EH7SFF47.js";import"./chunk-6QGV3IWD.js";import{CONFIG_DIR_NAME as b,SHARED_SKILL_CONFIG_DIRS as x,VERSION as Y,getAgentDir as j,getExamplesPath as G}from"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import{getLanguage as U,translate as e}from"./chunk-XRF4A4KI.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-K4B5ABCQ.js";import"./chunk-4LDEEFCY.js";import"./chunk-SCYK4XNE.js";import"./chunk-JXWJOIH4.js";var q=/(?<![\w@./\\~-])(?:pi|Pi)(?![\w/-]|\.\w)/g;function h(r){return r.replace(q,"DAL")}t(h,"brandText");var J="terminal",X=1;function z(r=U()){let o=[...p];return[{name:"scout",description:e(i.scout,r),tools:o,readOnly:!0},{name:"worker",description:e(i.worker,r),readOnly:!1},{name:"reviewer",description:e(i.reviewer,r),tools:o,readOnly:!0}]}t(z,"listBuiltinSubagents");export{O as BUNDLED_EXTENSION_PACKAGES,b as CONFIG_DIR_NAME,n as DAL_HOOK_ENTRY_TYPE,A as DAL_TOOL_NAMES,S as DefaultPackageManager,T as HOST_CAPABILITIES_ENV,I as HOST_TOKEN_ENV,c as HOST_TOKEN_HEADER,u as HOST_URL_ENV,y as ModelRuntime,F as PROJECT_HOOKS_FILE_ENV,D as RpcClient,R as RpcCommandError,x as SHARED_SKILL_CONFIG_DIRS,L as SessionManager,d as SettingsManager,J as TERMINAL_CAPABILITY,X as TERMINAL_CAPABILITY_VERSION,Y as VERSION,h as brandText,P as buildProjectMap,s as dalHookActivity,H as formatProjectMapPrompt,j as getAgentDir,f as getDefaultSessionDirs,G as getExamplesPath,l as isDalHookActivity,z as listBuiltinSubagents,C as listBundledExtensions,g as listToolCatalog,K as loadDalHooks,k as loadProjectContextFiles,M as loadSkills,v as parseFrontmatter,B as parseSessionEntries,V as projectHooksFileFromEnv,E as runDalHookEvent,_ as runNotificationHooks,N as runUserPromptSubmitHooks,w as toolDisplayLabel};
1
+ var m=Object.defineProperty;var t=(r,o)=>m(r,"name",{value:o,configurable:!0});import{createRequire as a}from"node:module";const Z=a(import.meta.url);import{BUILTIN_AGENT_DESCRIPTIONS as i,READ_ONLY_TOOL_NAMES as p}from"./chunk-3ANBT7AT.js";import"./chunk-DWMC4U2M.js";import{DAL_HOOK_ENTRY_TYPE as n,dalHookActivity as s,isDalHookActivity as l,runDalHookEvent as E,runNotificationHooks as _,runUserPromptSubmitHooks as N}from"./chunk-NMU45EFT.js";import{BUNDLED_EXTENSION_PACKAGES as O,DAL_TOOL_NAMES as A,DefaultPackageManager as S,HOST_CAPABILITIES_ENV as T,HOST_TOKEN_ENV as I,HOST_TOKEN_HEADER as c,HOST_URL_ENV as u,RpcClient as D,RpcCommandError as R,SessionManager as L,SettingsManager as d,buildProjectMap as P,formatProjectMapPrompt as H,getDefaultSessionDirs as f,listBundledExtensions as C,listToolCatalog as g,loadProjectContextFiles as k,loadSkills as M,parseFrontmatter as v,parseSessionEntries as B,toolDisplayLabel as w}from"./chunk-6U37J6E7.js";import{ModelRuntime as y,PROJECT_HOOKS_FILE_ENV as F,loadDalHooks as K,projectHooksFileFromEnv as V}from"./chunk-YDOF6JVP.js";import"./chunk-5TGFM4KW.js";import"./chunk-3YGHTGYM.js";import"./chunk-D3HKK2ZD.js";import"./chunk-SE42OS3U.js";import"./chunk-F5SIUTR7.js";import"./chunk-AL3DFAIM.js";import"./chunk-6QGV3IWD.js";import{CONFIG_DIR_NAME as b,SHARED_SKILL_CONFIG_DIRS as x,VERSION as Y,getAgentDir as j,getExamplesPath as G}from"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import{getLanguage as U,translate as e}from"./chunk-SNBVCTMQ.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-2XX4WZT6.js";import"./chunk-4LDEEFCY.js";import"./chunk-44EXLOHK.js";import"./chunk-JXWJOIH4.js";var q=/(?<![\w@./\\~-])(?:pi|Pi)(?![\w/-]|\.\w)/g;function h(r){return r.replace(q,"DAL")}t(h,"brandText");var J="terminal",X=1;function z(r=U()){let o=[...p];return[{name:"scout",description:e(i.scout,r),tools:o,readOnly:!0},{name:"worker",description:e(i.worker,r),readOnly:!1},{name:"reviewer",description:e(i.reviewer,r),tools:o,readOnly:!0}]}t(z,"listBuiltinSubagents");export{O as BUNDLED_EXTENSION_PACKAGES,b as CONFIG_DIR_NAME,n as DAL_HOOK_ENTRY_TYPE,A as DAL_TOOL_NAMES,S as DefaultPackageManager,T as HOST_CAPABILITIES_ENV,I as HOST_TOKEN_ENV,c as HOST_TOKEN_HEADER,u as HOST_URL_ENV,y as ModelRuntime,F as PROJECT_HOOKS_FILE_ENV,D as RpcClient,R as RpcCommandError,x as SHARED_SKILL_CONFIG_DIRS,L as SessionManager,d as SettingsManager,J as TERMINAL_CAPABILITY,X as TERMINAL_CAPABILITY_VERSION,Y as VERSION,h as brandText,P as buildProjectMap,s as dalHookActivity,H as formatProjectMapPrompt,j as getAgentDir,f as getDefaultSessionDirs,G as getExamplesPath,l as isDalHookActivity,z as listBuiltinSubagents,C as listBundledExtensions,g as listToolCatalog,K as loadDalHooks,k as loadProjectContextFiles,M as loadSkills,v as parseFrontmatter,B as parseSessionEntries,V as projectHooksFileFromEnv,E as runDalHookEvent,_ as runNotificationHooks,N as runUserPromptSubmitHooks,w as toolDisplayLabel};
@@ -0,0 +1,7 @@
1
+ var be=Object.defineProperty;var i=(e,t)=>be(e,"name",{value:t,configurable:!0});import{createRequire as he}from"node:module";const qt=he(import.meta.url);import"./chunk-NMU45EFT.js";import"./chunk-6U37J6E7.js";import"./chunk-YDOF6JVP.js";import"./chunk-5TGFM4KW.js";import"./chunk-3YGHTGYM.js";import"./chunk-D3HKK2ZD.js";import"./chunk-SE42OS3U.js";import"./chunk-F5SIUTR7.js";import"./chunk-AL3DFAIM.js";import"./chunk-6QGV3IWD.js";import"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import{DATA_FORMAT_KEY as ye,declaredDataFormat as C,reportNewerDataFormat as J,t as w,withFileLockSync as R,writeFileAtomicSync as k}from"./chunk-SNBVCTMQ.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-2XX4WZT6.js";import"./chunk-4LDEEFCY.js";import"./chunk-44EXLOHK.js";import"./chunk-JXWJOIH4.js";import{existsSync as ge,readFileSync as Ee}from"node:fs";import{join as Ae}from"node:path";import{createHash as ve,randomBytes as Se}from"node:crypto";import{existsSync as G,mkdirSync as F,readdirSync as we,readFileSync as q,rmSync as ke,statSync as _e}from"node:fs";import{join as A}from"node:path";import{join as Ie}from"node:path";import{homedir as xe}from"node:os";var Ce=[[/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,"<private-key>"],[/\b(?:sk|pk|rk)-[A-Za-z0-9_-]{8,}/g,"<secret>"],[/\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi,"Bearer <secret>"],[/\beyJ[A-Za-z0-9._-]{16,}/g,"<secret>"],[/\b(?:ghp|gho|ghu|ghs|ghr|github_pat)_[A-Za-z0-9_]{8,}/g,"<secret>"],[/\bglpat-[A-Za-z0-9_-]{8,}/g,"<secret>"],[/\bAKIA[0-9A-Z]{12,}/g,"<secret>"],[/\bxox[abposr]-[A-Za-z0-9-]{8,}/g,"<secret>"],[/\bnpm_[A-Za-z0-9]{20,}/g,"<secret>"],[/\b([A-Za-z0-9_.-]*(?:token|secret|password|passwd|api[_-]?key|access[_-]?key|private[_-]?key|auth|cookie|session)[A-Za-z0-9_.-]*)(["']?\s*[:=]\s*["']?)([^\s"',;]{4,})/gi,"$1$2<secret>"],[/(\b[a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/gi,"$1<secret>@"],[/[A-Za-z0-9+/_-]{40,}={0,2}/g,"<opaque>"]];function N(e){let t=e;for(let[r,n]of Ce)t=t.replace(r,n);let s=xe();return s&&s.length>1&&(t=t.split(s).join("~")),t=t.replace(/(?:\/Users\/|\/home\/|[A-Za-z]:\\Users\\)[^\s/\\]+/g,"~"),t}i(N,"redact");var Re=[{reason:"weakens_safety",pattern:/\b(?:skip|bypass|disable|ignore|override|turn off|circumvent)\b[^\n]{0,40}\b(?:approvals?|permissions?|sandbox(?:es)?|safety|guards?|confirmations?|hooks?|polic(?:y|ies)|protections?)\b/i},{reason:"weakens_safety",pattern:/(?:跳过|绕过|关闭|禁用|忽略|无视)[^。\n]{0,12}(?:审批|权限|确认|沙箱|安全|保护|钩子|拦截)/u},{reason:"weakens_safety",pattern:/(?:不要|不必|无需)(?![^。\n]{0,6}未经)[^。\n]{0,6}(?:审批|确认|沙箱)/u},{reason:"weakens_safety",pattern:/\b(?:skip|disable)\b[^\n]{0,20}\btests?\b|--no-verify\b/i},{reason:"weakens_safety",pattern:/--dangerously|\byolo\b|bypassPermissions|\bsudo\b|chmod\s+777|rm\s+-rf\s+[/~]/i},{reason:"exfiltrates",pattern:/\b(?:curl|wget|scp|rsync|nc|upload|send|post|exfiltrate|share)\b[^\n]{0,60}\b(?:tokens?|keys?|secrets?|passwords?|credentials?|cookies?|env|\.ssh|sessions?)\b/i},{reason:"exfiltrates",pattern:/(?:上传|发送|发到|外发|分享|传到)[^。\n]{0,20}(?:密钥|令牌|密码|凭据|凭证|cookie|环境变量|私钥)/iu},{reason:"installs",pattern:/\b(?:npm|pnpm|bun)\s+(?:i|install|add)\b[^\n]*?(?:\s-g\b|--global\b)|\byarn\s+global\s+add\b/i},{reason:"installs",pattern:/\b(?:brew|apt(?:-get)?|yum|dnf|pacman|apk|choco|winget|scoop|snap|cargo|gem|pipx)\s+(?:install|add)\b|\bgo\s+install\b|\buv\s+tool\s+install\b/i},{reason:"installs",pattern:/\b(?:npm\s+(?:i|install)|pnpm\s+(?:add|i|install)|yarn\s+add|bun\s+add)\s+(?!(?:in|at|from|first|before|after|then|and|again|once|for|inside|to|with|when|so|instead|works|fails|succeeds)\b)[@a-z][\w@./-]*/i},{reason:"installs",pattern:/\|\s*(?:sudo\s+)?(?:ba|z)?sh\b|\binstall(?:er)?\s+script\b/i},{reason:"installs",pattern:/\b(?:npx|npm\s+exec)\b[^\n`]*?\s(?:-y|--yes)\b|\bnpx\s+(?:-\S+\s+)*@?[a-z][\w./-]*@[\w.^~*-]+|\b(?:pnpm|yarn)\s+dlx\b|\bbunx\b|\buvx\b|\bpipx\s+run\b/i},{reason:"installs",pattern:/全局安装|从[^。\n]{1,30}下载|下载(?:并|后)?(?:运行|执行|安装)/u},{reason:"concrete_value",pattern:/\bhttps?:\/\/|\bwww\./i},{reason:"concrete_value",pattern:/<(?:secret|opaque|private-key)>/},{reason:"concrete_value",pattern:/[A-Za-z0-9+/=_-]{40,}/},{reason:"concrete_value",pattern:/\b\d{1,3}(?:\.\d{1,3}){3}\b/},{reason:"concrete_value",pattern:/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/},{reason:"concrete_value",pattern:/(?:\/Users\/|\/home\/|[A-Za-z]:\\Users\\)[^\s/\\]+/}];function Fe(e){let t=[e.content,e.rootCause??"",e.note??""].join(`
2
+ `);for(let{reason:r,pattern:n}of Re)if(n.test(t))return r;let s=e.content.trim().length;if(s<6||s>320)return"length"}i(Fe,"rejectLesson");var Ne=[{category:"deletion",pattern:/\b(?:rm|rmdir|del|unlink|truncate|shred)\b|\bdelet(?:e|es|ed|ing)\b|\bremov(?:e|es|ed|ing)\b|\bdrop\s+(?:table|database|schema)\b|\bgit\s+(?:clean|reset\s+--hard|push\s+[^\n]*--force|branch\s+-D)\b|\bwip(?:e|ing)\b|\bpurge\b|删除|删掉|清空|清除|覆盖(?!率)|重置/iu},{category:"permissions",pattern:/\b(?:chmod|chown|sudo|setfacl|icacls)\b|\bpermissions?\b|\bapprov(?:al|e)s?\b|\bsandbox\b|\bguard\b|\bescalat\w*|权限|审批|放行|沙箱|提权/iu},{category:"credentials",pattern:/\b(?:tokens?|secrets?|passwords?|passwd|credentials?|api[\s_-]?keys?|private\s+keys?|ssh\s+keys?|auth(?:\.json)?|login|cookies?|\.env)\b|凭据|凭证|密钥|密码|令牌|登录|私钥/iu},{category:"network",pattern:/\b(?:curl|wget|http|https|proxy|download|upload|dns|ssh|scp|rsync|webhook)\b|联网|下载|上传|代理|外网/iu},{category:"publishing",pattern:/\b(?:publish|release|deploy|push|git\s+tag|merge\s+to\s+main)\b|发布|发版|上线|部署|推送|合并到主/iu}],$=String.raw`(?:package\.json|package-lock\.json|lock\s?files?|pnpm-lock|yarn\.lock|requirements[\w.-]*\.txt|pyproject\.toml|Cargo\.toml|go\.mod|\.github\/workflows[\w./-]*|CI\s+config(?:uration)?)`,H=/\b(?:npm|pnpm|yarn|bun)[ \t]+(?:i|install|add)[ \t]+(?:-{1,2}[\w-]+[ \t]+)*[@a-z][\w@./-]*|\bpip3?[ \t]+install[ \t]+(?!-r\b)[a-z]|--save-dev\b|\binstall(?:ing)?\s+(?:the\s+|a\s+|an\s+|it\s+)?(?:missing\s+)?(?:tool|package|module|librar\w*|runner|linter|dependenc\w*)|as\s+a\s+dev-?dependency|(?:安装|装上|装一下|补装)\s*(?:缺少的|缺失的)?\s*(?:工具|依赖|包|插件|运行器)|装依赖/iu,$e=new RegExp(String.raw`\b(?:fix|edit|change|modify|update|rewrite|patch|add\b[^.;\n]{0,40}?\bto)\b[^.;\n]{0,40}?${$}|\b(?:fix|edit|change|modify|update|rewrite|patch)\b[^.;\n]{0,12}?\b(?:the\s+)?(?:npm\s+|test\s+|lint\s+|build\s+)?scripts?\b|(?:改|修改|改写|修复)[^。;;\n]{0,6}?(?:测试|npm|lint|构建)?\s*脚本|${$}[^.;\n]{0,20}?\b(?:should|must)\s+be\s+(?:changed|edited|updated|fixed)|(?:改|修改|编辑|调整|修复|补上|加到|写进)[^。;;\n]{0,12}?${$}`,"iu"),Y=/\b(?:before|instead\s+of|rather\s+than|don'?t|do\s+not|never|avoid|without)\b[^.;\n]{0,24}$|(?:不要|别|不许|先别|而不是|避免|不用)[^。;;\n]{0,8}$/iu;function je(e){if(H.test(e)){let s=e.search(H);if(!Y.test(e.slice(Math.max(0,s-30),s)))return!0}let t=$e.exec(e);return!!(t&&!Y.test(e.slice(Math.max(0,t.index-30),t.index)))}i(je,"prescribesDependencyChange");function Te(e){let t=Ne.filter(({pattern:s})=>ze(e,s)).map(({category:s})=>s);return je(e)?[...t,"dependencies"]:t}i(Te,"riskOf");var Oe=/[。;;,,!?!?\n]|\.(?=\s|$)/u,De=/\b(?:don'?t|do\s+not|never|avoid|stop|instead\s+of|rather\s+than|refuse|no\s+longer)\b|不要|不得|不能|不应|不该|(?<![区分类级识特个差告])别(?![的处人名])|切勿|勿|禁止|避免|停止|不再|而不是|而非|拒绝|不可|严禁|防止/iu,Le=/^\s*(?:当|如果|若|假如|一旦|万一|when\b|if\b|once\b|whenever\b)/iu,V=/就|则|便|\bthen\b/iu,Be=/(?:时|之后|以后|的时候)\s*$/u;function Me(e){return Le.test(e)?V.test(e)?[e]:[]:Be.test(e)&&!V.test(e)?[]:[e]}i(Me,"prescriptiveParts");function ze(e,t){let s=new RegExp(t.source,t.flags.includes("g")?t.flags:`${t.flags}g`);for(let r of e.split(Oe))for(let n of Me(r))for(let a of n.matchAll(s))if(!De.test(n.slice(0,a.index)))return!0;return!1}i(ze,"prescribedIn");var Pe=[["typecheck",/\btsc\b(?!.*--build)|\bmypy\b|\bpyright\b|\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:typecheck|type-check|check-types)\b/],["test",/\b(?:vitest|jest|mocha|ava|pytest|tox|rspec|phpunit)\b|\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?test\b|\bnode\s+--test\b|\b(?:go|cargo|dotnet|mix|deno)\s+test\b|\bmake\s+test\b|\bgradlew?\s+test\b|\bmvn\s+test\b/],["lint",/\b(?:eslint|biome|ruff|flake8|pylint|golangci-lint|clippy|prettier\s+--check)\b|\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:lint|check)\b/],["build",/\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?build\b|\b(?:cargo|go|dotnet|swift)\s+build\b|\bmake\b(?!\s+test)|\bgradlew?\s+(?:build|assemble)\b|\bmvn\s+(?:package|install)\b|\btsc\s+--build\b|\bvite\s+build\b|\bwebpack\b/],["install",/^(?:npm\s+(?:ci|install|i)|pnpm\s+(?:install|i)|yarn(?:\s+install)?|bun\s+install|pip3?\s+install\s+(?:-r|-e|\.)|poetry\s+install|uv\s+sync|bundle\s+install|composer\s+install|go\s+mod\s+download)(?:\s|$)/]],Ze=/^(?:tail|head|grep|egrep|fgrep|cat|less|more|tee|wc|sort|uniq|cut|column|sed|awk|nl)\b/,Ue=/^(?:head|grep|egrep|fgrep|cut|sed|awk)\b/,Ke=/^(?:echo|printf|cat|ls|pwd|true|false|:|#|sed|awk|grep|rg|head|tail|wc|find|git\s+(?:diff|status|log|show|stash|add)|set|export|printenv|which|whereis|type|command\s+-v|test\s|\[|stat|file|(?:node|npm|pnpm|yarn|bun|npx)\s+(?:-v|--version)|(?:npm|pnpm|yarn)\s+(?:ls|list|view|info|bin|root|config|why))(?:\b|(?=\s|$))/;function Je(e){let t=e.replace(/<<-?\s*(['"]?)(\w+)\1([^\n]*)\n[\s\S]*?\n[ \t]*\2[ \t]*(?=\n|$)/g,"<<$2$3").replace(/\s*\d*>&\d+/g,""),s=[],r=[],n="",a,o=i(()=>{r.push(n.trim()),n=""},"endStage"),d=i(()=>{o();let c=r.filter(Boolean);c.length&&s.push(c),r=[]},"endStatement");for(let c=0;c<t.length;c++){let l=t[c];if(a){if(l==="\\"&&a==='"'){n+=l+(t[c+1]??""),c++;continue}l===a&&(a=void 0),n+=l;continue}l==="'"||l==='"'?(a=l,n+=l):l==="\\"?(n+=l+(t[c+1]??""),c++):l===";"||l===`
3
+ `?d():(l==="&"||l==="|")&&t[c+1]===l?(d(),c++):l==="&"?d():l==="|"?o():n+=l}return d(),s}i(Je,"splitStatements");function Ge(e){let t=[],s=!1;for(let r of Je(e)){let n=[...r],a=!1;for(;n.length>1&&Ze.test(n.at(-1));)Ue.test(n.at(-1))&&(a=!0),n.pop();let o=n.join(" | ").replace(/\s+/g," ");/^cd\s/.test(o)?t.push(o):!Ke.test(o)&&j(o)&&(t.push(o),a&&(s=!0))}for(;t.length&&/^cd\s/.test(t.at(-1));)t.pop();return{statements:t,selected:s}}i(Ge,"checkParts");function j(e){for(let[t,s]of Pe)if(s.test(e))return t}i(j,"intentOf");var W=120,X=/^(?:at\s|\S+\s\(\S+:\d+:\d+\)$|(?:file:\/\/)?\S+\.(?:[cm]?[jt]sx?|py|go|rs|rb|java|kt|php)(?::\d+){1,2}$|.*\bnode:internal\/|Node\.js v\d)/,Q=/^(?:>?\s*\d+\s*\|.*|[\s|]*\^+[\s^~]*|(?:if|else|for|while|switch|const|let|var|return|function|class|import|export|async|await|def|try|catch)\b.*|\}.*)$|\bthrow new\b|=>|[;{]$/,ee=/^(?:(?:duration_ms|type|location|failureType|code|stack|operator|expected|actual|generatedMessage|name):|\.{3}$|-{3}$|TAP version|Subtest:|1\.\.\d+$|(?:tests|suites|pass|fail|cancelled|skipped|todo|duration_ms)\s+\d|Command exited with code)/,qe=/^(?:E\s+)?(?:Uncaught\s+)?(?:[A-Z][\w.]*(?:Error|Exception)|Error|error(?: TS\d+|\[E\d+\])?)(?:\s*\[[\w-]+\])?:\s*\S|\berror TS\d+:\s*\S/,He=/^(?:expected\b.*\b(?:received|to (?:be|equal)|but got)\b|(?:Expected|Received)(?: value)?:\s*\S|.+\s!==?\s.+)/i,Ye=/^(?:FAIL(?:ED)?\b|not ok \d+|[✖×✗]\s|--- FAIL:?)/,Ve=/not found|no such|cannot|can't|unable|error|fail|missing|denied|unknown|invalid|找不到|不存在|失败|错误/i;function We(e){let t=e.trim().replace(/^#\s?/,"").trim();return t!==""&&(X.test(t)||Q.test(t)||ee.test(t))}i(We,"isUntellingReason");function Xe(e){let t=e.findIndex(n=>He.test(n));if(t<0)return;let s=e[t],r=/^Expected(?: value)?:/i.test(s)?e.slice(t+1,t+4).find(n=>/^Received(?: value)?:/i.test(n)):void 0;return r?`${s}, ${r}`:s}i(Xe,"comparison");function Qe(e){let t=N(e).replace(/\s+/g," ").trim();return t.length>W?`${t.slice(0,W-1)}\u2026`:t}i(Qe,"clipReason");function et(e){let t=[];for(let s=0;s<e.length;s++){let r=/^error:\s*(.*)$/.exec(e[s]);if(!r)continue;let n=r[1].replace(/^'(.*)'$/,"$1").replace(/^"(.*)"$/,"$1");if(/^\|-?$/.test(n)){let o=[];for(let d=s+1;d<e.length&&o.length<2&&!/^[a-z_]+:\s/i.test(e[d]);d++)o.push(e[d]);n=o.join(" ")}if(!n||n==="test failed")continue;let a="";for(let o=s+1;o<Math.min(e.length,s+12)&&!/^(?:\.{3}|not ok|ok)\b/.test(e[o]);o++){let d=/^name:\s*'?([\w.]+)'?$/.exec(e[o]);if(d){a=d[1];break}}t.push(a&&!n.startsWith(a)?`${a}: ${n}`:n)}return t}i(et,"tapErrors");function tt(e){let t=e.split(/\r?\n/).map(n=>n.trim().replace(/^#\s?/,"").trim()).filter(Boolean),s=t.filter(n=>!X.test(n)&&!Q.test(n)&&!ee.test(n)),r=et(t)[0]??s.find(n=>qe.test(n))??Xe(s)??s.find(n=>Ye.test(n))??s.find(n=>Ve.test(n))??"";return Qe(r)}i(tt,"failureReason");function te(e){let t="",s=[];for(let r of Ge(e).statements){let n=/^cd\s+("[^"]+"|'[^']+'|\S+)$/.exec(r);if(n){let o=n[1].replace(/^["']|["']$/g,"");t=t&&!o.startsWith("/")?`${t}/${o}`:o;continue}let a=r.replace(/\s+/g," ").trim();s.some(o=>o.dir===t&&o.check===a)||s.push({dir:t,check:a,...j(a)?{intent:j(a)}:{}})}return s}i(te,"segmentsOf");function st(e,t){return e===t||` ${e} `.includes(` ${t} `)||` ${t} `.includes(` ${e} `)}i(st,"overlaps");function nt(e,t){let s=te(e),r=te(t),n=i((h,f)=>h.dir===f.dir&&h.check===f.check,"same"),a=s.filter(h=>!r.some(f=>n(h,f)));if(a.length===0)return;let o=new Set(a.map(h=>h.intent)),d=r.filter(h=>!s.some(f=>n(h,f))||o.has(h.intent)),c=a.filter(h=>d.some(f=>f.intent===h.intent));if(c.length===0||d.length===0||[...c,...d].some(h=>/^(?:\/|~|\$)/.test(h.dir))||c.some(h=>d.some(f=>f.dir===h.dir&&st(h.check,f.check))))return;let l=i(h=>{let f=h[0].dir;if(h.some(p=>p.dir!==f))return;let u=h.map(p=>p.check).join(" && ");return f?`cd ${f} && ${u}`:u},"joined"),b=l(c),g=l(d);if(!(!b||!g||b===g))return{bad:b,good:g}}i(nt,"fixCommands");var rt=/command not found|: not found|is not (?:set|defined)|Missing script|Cannot find (?:module|package)|ERR_MODULE_NOT_FOUND|ENOENT|No such file|unknown (?:option|command|script|flag)|not recognized as|No test files|No tests found|permission denied|EACCES|找不到|未设置|不存在|未找到/i,it=/AssertionError|^\s*(?:Expected|Received)(?: value)?:|\bexpected\b.*\b(?:received|to (?:be|equal)|but got)\b|\s!==?\s|^not ok \d+|^#\s*fail\s+[1-9]|^\s*\d+ (?:failing|failed)\b|Tests?:\s+\d+ failed|\berror TS\d+:|\d+ problems? \(\d+ errors?/im;function at(e){return it.test(e)&&!rt.test(e)}i(at,"codeFailed");import{mkdirSync as ot,readFileSync as ut}from"node:fs";import{dirname as dt}from"node:path";var T=1;function se(e){let t;try{t=ut(e,"utf8")}catch{return}try{let s=JSON.parse(t);return s&&typeof s=="object"&&!Array.isArray(s)?s:void 0}catch{return}}i(se,"readRaw");function ct(e,t){let s=se(e),r=s!==void 0&&C(s)>T;return r&&J(e),{value:t(s),readOnly:r}}i(ct,"readDoc");function lt(e,t,s){return ot(dt(e),{recursive:!0,mode:448}),R(e,()=>{let r=se(e);if(r!==void 0&&C(r)>T){J(e);return}let n=s(t(r));if(n===void 0)return;let a={...r??{},...n,[ye]:T};return k(e,`${JSON.stringify(a,null," ")}
4
+ `,{mode:384}),n})}i(lt,"updateDoc");function m(e,t){return typeof e=="string"?e.trim().slice(0,t):""}i(m,"str");function v(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):0}i(v,"num");function O(e,t,s){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.length>0).map(r=>r.slice(0,s)).slice(-t):[]}i(O,"strList");function D(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&!Array.isArray(t)):[]}i(D,"records");var Ts=10080*60*1e3,pt=["harmful","ineffective","unused","user","malformed"],ft=6,mt=12,bt=20,ht=["candidate","active","awaiting_user","retired","undone","expired"],yt=["failure_then_fix","user_correction","repeated_detour","guard_denial","success_workflow","imported"],gt=["helpful","harmful","neutral"],Et=["deletion","permissions","credentials","network","publishing","dependencies"];function ne(e){return Ie(e,"lessons.json")}i(ne,"lessonsPath");function At(e){let t=m(e.id,16),s=m(e.content,400);if(!/^[lu]-\d{4,6}$/.test(t)||!s)return;let r=ht.includes(e.status)?e.status:"candidate",n=e.fix,a=e.proof,o=e.origin;return{...e,id:t,scope:e.scope==="user"?"user":"project",section:m(e.section,40)||"general",content:s,rootCause:m(e.rootCause,400),...m(e.signature,300)?{signature:m(e.signature,300)}:{},...n&&typeof n.good=="string"?{fix:{intent:m(n.intent,20),bad:m(n.bad,200),good:m(n.good,200)}}:{},status:r,risk:O(e.risk,5,20).filter(d=>Et.includes(d)),sessions:O(e.sessions,mt,80),evidence:D(e.evidence).map(d=>({sessionId:m(d.sessionId,80),at:m(d.at,32),signal:yt.includes(d.signal)?d.signal:"user_correction",note:m(d.note,300)})).slice(-ft),...a&&typeof a.at=="string"?{proof:{kind:a.kind==="outcome"?"outcome":"test",at:m(a.at,32),sessionId:m(a.sessionId,80),note:m(a.note,300)}}:{},helpful:v(e.helpful),harmful:v(e.harmful),...v(e.neutral)>0?{neutral:v(e.neutral)}:{},...v(e.injections)>0?{injections:v(e.injections)}:{},...m(e.lastInjectedAt,32)?{lastInjectedAt:m(e.lastInjectedAt,32)}:{},feedback:D(e.feedback).filter(d=>gt.includes(d.tag)).map(d=>({sessionId:m(d.sessionId,80),tag:d.tag,at:m(d.at,32),why:m(d.why,200)})).slice(-bt),created:m(e.created,32),updated:m(e.updated,32),...m(e.activatedAt,32)?{activatedAt:m(e.activatedAt,32)}:{},...["sessions","proof","user","import","trial"].includes(e.activatedBy)?{activatedBy:e.activatedBy}:{},...m(e.lastHelpfulAt,32)?{lastHelpfulAt:m(e.lastHelpfulAt,32)}:{},...m(e.retiredAt,32)?{retiredAt:m(e.retiredAt,32)}:{},...pt.includes(e.retiredReason)?{retiredReason:e.retiredReason}:{},...o&&o.kind==="desktop"?{origin:{kind:"desktop",projectId:m(o.projectId,32),ruleId:m(o.ruleId,16)}}:{}}}i(At,"parseLesson");var _=i(e=>e.replace(/\s+/g," ").trim(),"fold");function vt(e){if(!e.fix||!e.signature?.startsWith("fix:")||e.activatedBy==="user"||e.activatedBy==="import")return!1;let t=nt(e.fix.bad,e.fix.good);return!t||_(t.bad)!==_(e.fix.bad)||_(t.good)!==_(e.fix.good)||We(e.rootCause)||e.rootCause.trim()&&!tt(e.rootCause)||at(e.rootCause)?!0:Fe({content:e.content})!==void 0}i(vt,"isMalformed");var St=["candidate","active","awaiting_user"];function wt(e){return!St.includes(e.status)||!vt(e)?e:{...e,status:"retired",retiredAt:e.updated||e.created,retiredReason:"malformed"}}i(wt,"retireMalformed");function kt(e){if(e.activatedBy==="user"||e.activatedBy==="import")return e;let t=Te(e.fix?`${e.fix.good}
5
+ ${e.rootCause??""}`:e.content);return t.length===e.risk.length&&t.every(s=>e.risk.includes(s))?e:t.some(s=>!e.risk.includes(s))&&e.status==="active"?{...e,risk:t,status:"awaiting_user"}:t.length===0&&e.status==="awaiting_user"?{...e,risk:t,status:"candidate"}:{...e,risk:t}}i(kt,"recheckRisk");function re(e){let t=D(e?.lessons).map(At).filter(a=>a!==void 0).map(wt).map(kt),s=t.reduce((a,o)=>Math.max(a,Number(o.id.slice(2))),0),r={},n=e?.imported;if(n&&typeof n=="object"&&!Array.isArray(n))for(let[a,o]of Object.entries(n))r[a]=O(o,1e3,16);return{nextId:Math.max(v(e?.nextId),s+1,1),lessons:t,imported:r}}i(re,"parseLessonsDoc");function ie(e){return ct(ne(e),re).value}i(ie,"readLessons");function ae(e,t){return lt(ne(e),re,t)}i(ae,"updateLessons");var Os=new Set("the and for with this that these those from into when then than before after instead only each every use used using run runs running ran make makes made keep edit edits editing file files project projects here there what which while where your you our are was were has have had not but all any its one two fails fail failed failing passes pass passed should must can will just also more most first last same src lib test tests js mjs cjs ts tsx jsx json md py go rs txt yaml yml".split(" ")),Ds=new Set("\u672C\u9879 \u9879\u76EE \u76EE\u91CC \u6539\u7528 \u4F1A\u5931 \u5931\u8D25 \u4F7F\u7528 \u65F6\u5019 \u4E4B\u524D \u4E4B\u540E \u6587\u4EF6 \u8FD0\u884C \u4E00\u4E0B \u8FD9\u4E2A \u90A3\u4E2A \u53EF\u4EE5 \u9700\u8981 \u4E0D\u8981 \u5982\u679C \u7136\u540E \u73B0\u5728 \u5DF2\u7ECF \u6211\u4EEC \u4F60\u7684 \u4E00\u4E2A \u4EC0\u4E48 \u600E\u4E48 \u4E3A\u4EC0\u4E48 \u5E2E\u6211 \u770B\u770B \u95EE\u9898 \u4EE3\u7801".split(" ")),_t=256*1024,oe=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,ue=1,S=class extends Error{static{i(this,"SyncHttpError")}status;constructor(e){super(`dal sync request failed (${e})`),this.status=e}},L=i(e=>A(e,"skills"),"skillsDir"),de=i(e=>A(e,"learned","user"),"userLessonsDir"),B=i(e=>A(e,"sync","state.json"),"statePath");function M(e){return Array.isArray(e)?`[${e.map(M).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[s])=>t<s?-1:t>s?1:0).map(([t,s])=>`${JSON.stringify(t)}:${M(s)}`).join(",")}}`:JSON.stringify(e)}i(M,"stable");function I(e){return ve("sha256").update(M(e)).digest("hex")}i(I,"contentHash");function z(e){return typeof e=="string"?N(e):Array.isArray(e)?e.map(z):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,s])=>[t,z(s)])):e}i(z,"redactDeep");var ce=["section","content","rootCause","signature","fix","status","risk","helpful","harmful","neutral","injections","lastInjectedAt","created","updated","activatedAt","activatedBy","lastHelpfulAt","retiredAt","retiredReason"],It=["helpful","harmful","neutral","injections"],xt=["lastInjectedAt","lastHelpfulAt"];function Ct(e,t){let s={...t};for(let r of It){let n=e[r]??0,a=typeof t[r]=="number"?t[r]:0;n>a&&(s[r]=n)}for(let r of xt){let n=e[r],a=typeof t[r]=="string"?t[r]:void 0;n&&(!a||Date.parse(n)>Date.parse(a))&&(s[r]=n)}return s}i(Ct,"mergeLesson");function Rt(e){let t={};for(let s of ce)e[s]!==void 0&&(t[s]=e[s]);return z(t)}i(Rt,"lessonContent");function Ft(e){let t=L(e);if(!G(t))return[];let s=[];for(let r of we(t)){if(!oe.test(r)||r.length>64)continue;let n=A(t,r,"SKILL.md"),a,o;try{let c=_e(n);if(!c.isFile())continue;a=q(n,"utf8"),o=c.mtimeMs}catch{continue}let d={name:r,body:N(a)};s.push({id:`skill.${r}`,kind:"skill",content:d,hash:I(d),updatedAt:o})}return s}i(Ft,"readSkills");function Nt(e){let t=de(e);return G(A(t,"lessons.json"))?(ie(t).lessons.some(s=>s.scope==="user"&&!s.syncId)&&ae(t,s=>({...s,lessons:s.lessons.map(r=>r.scope==="user"&&!r.syncId?{...r,syncId:$t()}:r)})),ie(t).lessons.filter(s=>s.scope==="user"&&typeof s.syncId=="string").map(s=>{let r=Rt(s);return{id:`lesson.${s.syncId}`,kind:"lesson",content:r,hash:I(r),updatedAt:Date.parse(s.updated)||0}})):[]}i(Nt,"readLessonItems");function $t(){return Se(8).toString("hex")}i($t,"newSyncId");function le(e){return[...Ft(e),...Nt(e)]}i(le,"readLocalItems");function jt(e,t,s,r=()=>!1){if(t.startsWith("skill.")){let c=t.slice(6);if(!oe.test(c)||typeof s.body!="string")return;F(A(L(e),c),{recursive:!0}),k(A(L(e),c,"SKILL.md"),s.body);return}if(!t.startsWith("lesson."))return;let n=t.slice(7),a={};for(let c of ce)s[c]!==void 0&&(a[c]=s[c]);let o=a.content;if(typeof o!="string"||!o)return;let d=de(e);F(d,{recursive:!0,mode:448}),ae(d,c=>{let l=c.lessons,b=l.find(f=>f.syncId===n)??l.find(f=>f.scope==="user"&&(!f.syncId||r(f.syncId))&&f.content===a.content);if(b)return{...c,lessons:l.map(f=>f===b?{...f,...Ct(f,a),syncId:n}:f)};let g=new Date().toISOString(),h={id:`u-${String(c.nextId).padStart(4,"0")}`,scope:"user",section:"general",rootCause:"",status:"candidate",risk:[],sessions:[],evidence:[],helpful:0,harmful:0,feedback:[],created:g,updated:g,...a,content:o,syncId:n};return{...c,nextId:c.nextId+1,lessons:[...l,h]}})}i(jt,"applyRemoteItem");function P(e){try{let t=JSON.parse(q(B(e),"utf8"));if(t.formatVersion!==ue||typeof t.account!="string")return;let s=t.items&&typeof t.items=="object"?t.items:{};return{account:t.account,items:s,lastRun:typeof t.lastRun=="string"?t.lastRun:void 0,lastError:typeof t.lastError=="string"?t.lastError:void 0,lastErrorStatus:typeof t.lastErrorStatus=="number"?t.lastErrorStatus:void 0}}catch{return}}i(P,"readState");function pe(e,t){let s=B(e);F(A(e,"sync"),{recursive:!0,mode:448}),R(s,()=>k(s,`${JSON.stringify({formatVersion:ue,...t},null," ")}
6
+ `,{mode:384}))}i(pe,"writeState");function Tt(e){ke(B(e),{force:!0})}i(Tt,"clearState");async function Ot(e,t,s){let r=P(e),n={account:t,items:r?.account===t?{...r.items}:{}},a={uploaded:0,downloaded:0,deletedRemote:0,conflicts:0,refused:[]},o=i(()=>pe(e,{...n,lastRun:new Date().toISOString()}),"save"),d=new Map((await s.manifest()).map(u=>[u.id,u])),c=new Map(le(e).map(u=>[u.id,u])),l=i(u=>{let p=`lesson.${u}`;return!n.items[p]&&!d.has(p)},"neverSynced"),b=new Set,g=i((u,p)=>{jt(e,u,p.content,l),n.items[u]={version:p.version,hash:I(p.content)},b.add(u),a.downloaded++},"apply"),h=i(async u=>{let p=await s.get(u);return p?(g(u,p),!0):!1},"download"),f=i(async(u,p)=>{let y=n.items[u.id];if(y?.refused===u.hash)return;if(Buffer.byteLength(JSON.stringify(u.content))>_t){n.items[u.id]={version:y?.version??0,hash:y?.hash??"",refused:u.hash},a.refused.push(u.id);return}let E=await s.put(u.id,u.kind,p,u.content);E.status==="written"?(n.items[u.id]={version:E.version,hash:u.hash},a.uploaded++):E.status==="conflict"?a.conflicts++:(n.items[u.id]={version:y?.version??0,hash:y?.hash??"",refused:u.hash},a.refused.push(u.id))},"upload");for(let u of d.values()){let p=n.items[u.id]?.remoteDeleted?void 0:n.items[u.id],y=c.get(u.id);if(!y){if(p&&p.version===u.version){await s.remove(u.id)&&a.deletedRemote++,delete n.items[u.id];continue}await h(u.id);continue}if(p&&p.version===u.version)continue;if(p&&y.hash===p.hash){await h(u.id);continue}let E=await s.get(u.id);if(!E)continue;let K=I(E.content);if(K===y.hash){n.items[u.id]={version:E.version,hash:K};continue}a.conflicts++,Date.parse(u.updatedAt)>y.updatedAt?g(u.id,E):await f(y,E.version)}c=new Map(le(e).map(u=>[u.id,u]));for(let u of b){let p=c.get(u);p&&n.items[u]&&(n.items[u].hash=p.hash)}for(let u of c.values()){let p=n.items[u.id],y=d.get(u.id);if(y){p&&p.version===y.version&&u.hash!==p.hash&&await f(u,y.version);continue}if(p&&u.hash===p.hash){!p.remoteDeleted&&p.version>0&&(n.items[u.id]={...p,remoteDeleted:!0});continue}await f(u,0)}for(let u of Object.keys(n.items))!c.has(u)&&!d.has(u)&&delete n.items[u];return o(),a}i(Ot,"runSync");function Dt(e){let t=`${e.apiBase.replace(/\/+$/,"")}/portal/dal-sync`,s=e.fetch??fetch;async function r(o,d,c){let l=await e.token();if(!l)throw new S(401);let b=await s(`${t}${d}`,{method:o,headers:{Authorization:`Bearer ${l}`,Accept:"application/json",...c===void 0?{}:{"Content-Type":"application/json"}},body:c===void 0?void 0:JSON.stringify(c),signal:AbortSignal.timeout(e.timeoutMs??2e4)}),g=await b.json().catch(()=>null);return{status:b.status,data:g}}i(r,"call");let n=i(o=>o&&typeof o=="object"&&!Array.isArray(o)?o:{},"record"),a=i(o=>`/items/${encodeURIComponent(o)}`,"item");return{async manifest(){let{status:o,data:d}=await r("GET","/manifest");if(o!==200)throw new S(o);let c=n(d).items;return(Array.isArray(c)?c:[]).flatMap(l=>{let b=n(l);return typeof b.id!="string"||b.kind!=="skill"&&b.kind!=="lesson"?[]:[{id:b.id,kind:b.kind,version:Number(b.version)||0,updatedAt:typeof b.updatedAt=="string"?b.updatedAt:new Date(0).toISOString()}]})},async get(o){let{status:d,data:c}=await r("GET",a(o));if(d===404)return;if(d!==200)throw new S(d);let l=n(c);return{version:Number(l.version)||0,content:n(l.content)}},async put(o,d,c,l){let{status:b,data:g}=await r("PUT",a(o),{kind:d,baseVersion:c,content:l,device:e.device.slice(0,64)});if(b===200)return{status:"written",version:Number(n(g).version)||0};if(b===409)return{status:"conflict"};if(b===413||b===422||b===400)return{status:"refused",reason:String(n(g).error??b)};throw new S(b)},async remove(o){let{status:d}=await r("DELETE",a(o));if(d===200)return!0;if(d===404)return!1;throw new S(d)},async removeAll(){let{status:o,data:d}=await r("DELETE","");if(o!==200)throw new S(o);return Number(n(d).removed)||0}}}i(Dt,"createHttpRemote");var x="dalSync",Lt="https://deepailab.ai/dal-sync",fe=i(e=>Ae(e,"settings.json"),"settingsPath");function Z(e){try{let t=JSON.parse(Ee(e,"utf8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:void 0}catch{return}}i(Z,"readJson");function me(e){return process.env.DAL_SYNC==="0"?!1:Z(fe(e))?.[x]?.enabled===!0}i(me,"syncEnabled");function Bt(e,t){let s=fe(e);R(s,()=>{if(ge(s)&&Z(s)===void 0)throw new Error(`${s} is not valid JSON; not overwriting it`);let r=Z(s)??{};if(C(r)>1)throw new Error(`${s} was written by a newer DAL; not overwriting it`);let n=r[x]??{};r[x]={...n,enabled:t},k(s,`${JSON.stringify(r,null,2)}
7
+ `)})}i(Bt,"saveSyncEnabled");function Mt(e,t){return e.replace(/\{(\w+)\}/g,(s,r)=>r in t?String(t[r]):s)}i(Mt,"fill");function U(e){return e instanceof S?e.status:0}i(U,"syncErrorStatus");function zt(e){let t=U(e);return t===401?w("\u672A\u767B\u5F55 DeepAILab\uFF0C\u6216\u767B\u5F55\u5DF2\u8FC7\u671F\uFF1B\u767B\u5F55\u540E\u4F1A\u81EA\u52A8\u7EE7\u7EED\u540C\u6B65\u3002"):t===404?w("\u540C\u6B65\u670D\u52A1\u5C1A\u672A\u5F00\u653E\uFF0C\u5F00\u653E\u540E\u4F1A\u81EA\u52A8\u5F00\u59CB\u3002"):t===503?w("\u540C\u6B65\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u7A0D\u540E\u81EA\u52A8\u91CD\u8BD5\u3002"):t?Mt(w("\u540C\u6B65\u8BF7\u6C42\u5931\u8D25\uFF08{status}\uFF09\uFF0C\u7A0D\u540E\u81EA\u52A8\u91CD\u8BD5\u3002"),{status:t}):w("\u7F51\u7EDC\u4E0D\u53EF\u7528\uFF0C\u7A0D\u540E\u81EA\u52A8\u91CD\u8BD5\u3002")}i(zt,"syncErrorText");function Pt(e){let t=P(e),s=t?Object.values(t.items).filter(r=>!r.remoteDeleted&&r.version>0).length:0;return{enabled:me(e),synced:s,...t?.lastRun?{lastRun:t.lastRun}:{},...t?.lastError?{lastError:t.lastError}:{},...t?.lastError&&t.lastErrorStatus!==void 0?{lastErrorStatus:t.lastErrorStatus}:{}}}i(Pt,"syncStatus");function Zt(e){return Dt(e)}i(Zt,"syncRemote");async function Ut(e,t,s){try{return await Ot(e,t,s)}catch(r){let n=P(e),a=n?.account===t;throw pe(e,{account:t,items:a?n.items:{},lastRun:a?n.lastRun:void 0,lastError:zt(r),lastErrorStatus:U(r)}),r}}i(Ut,"syncOnce");async function Kt(e,t){let s=await t.removeAll();return Tt(e),s}i(Kt,"removeCloudCopies");export{x as SETTINGS_KEY,Lt as SYNC_CONSOLE_URL,Kt as removeCloudCopies,Bt as saveSyncEnabled,me as syncEnabled,U as syncErrorStatus,Ut as syncOnce,Zt as syncRemote,Pt as syncStatus};
@@ -1 +1 @@
1
- var p=Object.defineProperty;var r=(e,t)=>p(e,"name",{value:t,configurable:!0});import{createRequire as a}from"node:module";const d=a(import.meta.url);import{classifySystemOne as s}from"./chunk-O7G23ELK.js";import{isRecord as i}from"./chunk-IDZ3QKHZ.js";import"./chunk-ML5DIOWR.js";import"./chunk-33MCYYJ3.js";import"./chunk-UTB4DTYQ.js";import"./chunk-K4B5ABCQ.js";import"./chunk-4LDEEFCY.js";import"./chunk-SCYK4XNE.js";import"./chunk-JXWJOIH4.js";var m={api:"typesafe-system-one",label:"System One API",detectCompat:r(e=>e.provider==="openrouter"||e.baseUrl.includes("openrouter.ai")?{imageInput:"state-image-urls",sendImageOptInHeader:!1}:{imageInput:"assets",sendImageOptInHeader:!0},"detectCompat"),url:r(e=>new URL("systemone",`${e.baseUrl.replace(/\/+$/u,"")}/`),"url"),payload:r((e,t)=>({model:e.id,...t}),"payload"),output:r(e=>{if(!i(e))throw new Error("System One API returned an unexpected response");return e},"output")},n=r((e,t,o)=>s(m,e,t,o),"classify");export{n as classify};
1
+ var p=Object.defineProperty;var r=(e,t)=>p(e,"name",{value:t,configurable:!0});import{createRequire as a}from"node:module";const d=a(import.meta.url);import{classifySystemOne as s}from"./chunk-GX37DI5S.js";import{isRecord as i}from"./chunk-DBT5OS5V.js";import"./chunk-ML5DIOWR.js";import"./chunk-SMPERFJU.js";import"./chunk-UTB4DTYQ.js";import"./chunk-2XX4WZT6.js";import"./chunk-4LDEEFCY.js";import"./chunk-44EXLOHK.js";import"./chunk-JXWJOIH4.js";var m={api:"typesafe-system-one",label:"System One API",detectCompat:r(e=>e.provider==="openrouter"||e.baseUrl.includes("openrouter.ai")?{imageInput:"state-image-urls",sendImageOptInHeader:!1}:{imageInput:"assets",sendImageOptInHeader:!0},"detectCompat"),url:r(e=>new URL("systemone",`${e.baseUrl.replace(/\/+$/u,"")}/`),"url"),payload:r((e,t)=>({model:e.id,...t}),"payload"),output:r(e=>{if(!i(e))throw new Error("System One API returned an unexpected response");return e},"output")},n=r((e,t,o)=>s(m,e,t,o),"classify");export{n as classify};
@@ -1 +1 @@
1
- var k=Object.defineProperty;var i=(e,t)=>k(e,"name",{value:t,configurable:!0});import{createRequire as v}from"node:module";const pe=v(import.meta.url);import"./chunk-L3RBW36Y.js";import"./chunk-RKLUP6JT.js";import"./chunk-R7FBN5UP.js";import"./chunk-3ZHZINH3.js";import"./chunk-3YGHTGYM.js";import"./chunk-356BFRU3.js";import"./chunk-SE42OS3U.js";import"./chunk-K7VBBYTT.js";import"./chunk-EH7SFF47.js";import"./chunk-6QGV3IWD.js";import{getAgentDir as F}from"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import{declaredDataFormat as B,reportNewerDataFormat as C,t as U,writeFileAtomicSync as L}from"./chunk-XRF4A4KI.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-K4B5ABCQ.js";import"./chunk-4LDEEFCY.js";import"./chunk-SCYK4XNE.js";import"./chunk-JXWJOIH4.js";import{readdir as W,readFile as I,stat as x}from"node:fs/promises";import{homedir as z}from"node:os";import{join as E}from"node:path";var P="sessions",V="usage-cache.json",w=1,T="dal-tool-repair",H=10,q=['"role":"assistant"','"type":"session"','"type":"usage"','"type":"compaction"','"type":"branch_summary"',`"customType":"${T}"`].flatMap(e=>[Buffer.from(e),Buffer.from(e.replace(":",": "))]),G=[Buffer.from('"role":"toolResult"'),Buffer.from('"role": "toolResult"')],J=[Buffer.from('"usage":{'),Buffer.from('"usage": {')],D=i((e,t)=>t.some(r=>e.includes(r)),"includesAny");function Y(e){let t=e.length>1024?e.subarray(0,1024):e;if(D(t,q))return!0;if(!D(t,G))return!1;let r=e.length>4096?e.subarray(e.length-4096):e;return D(r,J)}i(Y,"mightCarryUsage");var g=i(e=>typeof e=="number"&&Number.isFinite(e)?e:0,"finite");function A(e){if(!e||typeof e!="object")return;let t=e,r=t.cost,a={input:g(t.input),output:g(t.output),cacheRead:g(t.cacheRead),cacheWrite:g(t.cacheWrite),cost:typeof r=="number"?g(r):r&&typeof r=="object"?g(r.total):0};return a.cost===0&&a.input+a.output+a.cacheRead+a.cacheWrite===0?void 0:a}i(A,"amountOf");function S(...e){for(let t of e){let r=typeof t=="number"?t:Date.parse(String(t??""));if(Number.isFinite(r)&&r>0)return r}return 0}i(S,"timeOf");var j=i(e=>`${e.input}:${e.output}:${e.cacheRead}:${e.cacheWrite}`,"fingerprint");function K(e){let t={sessionId:"",cwd:"",records:[],toolRepairs:[]},r=i((n,d,o,f,s)=>{let p=n==="model"&&!s?`${d}:${f}:${j(o)}`:`${n}:${s}:${f}:${j(o)}`;t.records.push({source:n,label:d,timestamp:f,key:p,...o})},"add"),a=0;for(;a<e.length;){let n=e.indexOf(H,a);n===-1&&(n=e.length);let d=e.subarray(a,n);if(a=n+1,d.length===0||!Y(d))continue;let o;try{o=JSON.parse(d.toString("utf8"))}catch{continue}let f=typeof o.id=="string"?o.id:"";if(o.type==="session"){typeof o.id=="string"&&(t.sessionId=o.id),typeof o.cwd=="string"&&(t.cwd=o.cwd);continue}if(o.type==="usage"){let u=A(o.usage);u&&o.provider&&o.model&&r("model",`${o.provider}/${o.model}`,u,S(o.timestamp),f);continue}if(o.type==="custom"&&o.customType===T){let u=Array.isArray(o.data?.repairs)?o.data.repairs.length:0;u>0&&t.toolRepairs?.push({timestamp:S(o.timestamp),key:f,count:u});continue}if(o.type==="compaction"||o.type==="branch_summary"){let u=A(o.usage);u&&r("housekeeping","",u,S(o.timestamp),f);continue}let s=o.message;if(o.type!=="message"||!s)continue;let p=A(s.usage);if(!p)continue;let y=S(s.timestamp,o.timestamp);if(s.role==="assistant"&&s.provider&&s.model)r("model",`${s.provider}/${s.model}`,p,y,"");else if(s.role==="toolResult"){let u=s.toolName??"";r(u==="task"?"subagents":"tools",u,p,y,f)}}return t}i(K,"parseSessionBuffer");async function O(e,t=[]){let r;try{r=await W(e,{withFileTypes:!0})}catch{return t}for(let a of r){let n=E(e,a.name);a.isDirectory()?await O(n,t):a.isFile()&&a.name.endsWith(".jsonl")&&t.push(n)}return t}i(O,"sessionFiles");async function Q(e){try{let t=JSON.parse(await I(e,"utf8"));if(B(t)>w)return C(e),{doc:{formatVersion:w,files:{}},writable:!1};let r=t.files;if(r&&typeof r=="object")return{doc:{formatVersion:w,files:r},writable:!0}}catch{}return{doc:{formatVersion:w,files:{}},writable:!0}}i(Q,"readCache");async function X(e){let t=E(e,V),{doc:r,writable:a}=await Q(t),n={},d=!1,o=(await O(E(e,P))).sort(),f=[];for(let s of o){let p;try{p=await x(s)}catch{continue}let y=r.files[s];if(y&&y.size===p.size&&y.mtimeMs===p.mtimeMs&&y.parsed)n[s]=y;else{let u;try{u=await I(s)}catch{continue}n[s]={size:p.size,mtimeMs:p.mtimeMs,parsed:K(u)},d=!0}f.push(n[s].parsed)}if(Object.keys(r.files).length!==Object.keys(n).length&&(d=!0),a&&d)try{L(t,JSON.stringify({formatVersion:w,files:n}))}catch{}return f}i(X,"loadSessions");function Z(e){if(!e)return"?";let t=z(),r;e===t||e.startsWith(`${t}/`)?r=t:r=/^(\/Users\/[^/]+|\/home\/[^/]+)(?=\/|$)/.exec(e)?.[1];let a=(r===void 0?e:e.slice(r.length)).split(/[\\/]/).filter(Boolean).slice(0,2);return r===void 0?`/${a.join("/")}`:a.length>0?`~/${a.join("/")}`:"~"}i(Z,"projectLabel");function ee(e){let t=e.trim().toLowerCase();if(t==="")return{kind:"days",days:30,label:"30d"};if(t==="today")return{kind:"today",label:"today"};if(t==="all")return{kind:"all",label:"all"};let r=/^(\d{1,4})d$/.exec(t);if(r){let a=Number(r[1]);if(a>=1)return{kind:"days",days:a,label:`${a}d`}}}i(ee,"parseUsageRange");var _=i(()=>({input:0,output:0,cacheRead:0,cacheWrite:0,cost:0}),"empty");function M(e,t){e.input+=t.input,e.output+=t.output,e.cacheRead+=t.cacheRead,e.cacheWrite+=t.cacheWrite,e.cost+=t.cost}i(M,"addInto");function te(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}i(te,"startOfLocalDay");function re(e){let t=new Date(e),r=i(a=>String(a).padStart(2,"0"),"pad");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`}i(re,"dayKey");function oe(e,t){if(e.kind==="all")return Number.NEGATIVE_INFINITY;let r=te(t);if(e.kind==="today")return r;let a=new Date(r);return a.setDate(a.getDate()-(e.days-1)),a.getTime()}i(oe,"rangeStart");function ae(e){return e.source==="model"?e.label:e.source}i(ae,"modelKey");var ie={subagents:"\u5B50\u52A9\u624B",tools:"\u5DE5\u5177",housekeeping:"\u4E0A\u4E0B\u6587\u6574\u7406"};function se(e,t,r){let a=oe(t,r),n=new Set,d=_(),o={day:new Map,model:new Map,project:new Map},f={day:new Map,model:new Map,project:new Map},s=new Set,p=i((l,c,m,$,R)=>{let h=o[l].get(c);h||(h={key:c,label:m,sessions:0,..._()},o[l].set(c,h)),M(h,R);let b=f[l].get(c);b||(b=new Set,f[l].set(c,b)),b.add($),h.sessions=b.size},"bump");for(let l of e){if(!l.sessionId)continue;let c=Z(l.cwd);for(let m of l.records){if(m.timestamp<a||m.timestamp>r||n.has(m.key))continue;n.add(m.key),M(d,m),s.add(l.sessionId);let $=ae(m),R=re(m.timestamp);p("day",R,R,l.sessionId,m),p("model",$,m.source==="model"?m.label:U(ie[m.source]),l.sessionId,m),p("project",c,c,l.sessionId,m)}}let y=0,u=new Set;for(let l of e)for(let c of l.toolRepairs??[])c.timestamp<a||c.timestamp>r||u.has(c.key)||(u.add(c.key),y+=c.count);let N=i((l,c)=>c.cost-l.cost||l.label.localeCompare(c.label),"byCost");return{range:t,sessions:s.size,total:d,byDay:[...o.day.values()].sort((l,c)=>c.key.localeCompare(l.key)),byModel:[...o.model.values()].sort(N),byProject:[...o.project.values()].sort(N),toolRepairs:y}}i(se,"buildReport");async function ne(e){let t=await X(e.agentDir??F());return se(t,e.range,e.now??Date.now())}i(ne,"collectUsage");async function le(e){let t=ee(e.range);if(!t)throw new Error(`Unknown usage range: ${String(e.range)}`);return ne({range:t,...e.agentDir?{agentDir:e.agentDir}:{}})}i(le,"collectUsage2");export{le as collectUsage};
1
+ var k=Object.defineProperty;var i=(e,t)=>k(e,"name",{value:t,configurable:!0});import{createRequire as v}from"node:module";const pe=v(import.meta.url);import"./chunk-NMU45EFT.js";import"./chunk-6U37J6E7.js";import"./chunk-YDOF6JVP.js";import"./chunk-5TGFM4KW.js";import"./chunk-3YGHTGYM.js";import"./chunk-D3HKK2ZD.js";import"./chunk-SE42OS3U.js";import"./chunk-F5SIUTR7.js";import"./chunk-AL3DFAIM.js";import"./chunk-6QGV3IWD.js";import{getAgentDir as F}from"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import{declaredDataFormat as B,reportNewerDataFormat as C,t as U,writeFileAtomicSync as L}from"./chunk-SNBVCTMQ.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-2XX4WZT6.js";import"./chunk-4LDEEFCY.js";import"./chunk-44EXLOHK.js";import"./chunk-JXWJOIH4.js";import{readdir as W,readFile as I,stat as x}from"node:fs/promises";import{homedir as z}from"node:os";import{join as E}from"node:path";var P="sessions",V="usage-cache.json",w=1,T="dal-tool-repair",H=10,q=['"role":"assistant"','"type":"session"','"type":"usage"','"type":"compaction"','"type":"branch_summary"',`"customType":"${T}"`].flatMap(e=>[Buffer.from(e),Buffer.from(e.replace(":",": "))]),G=[Buffer.from('"role":"toolResult"'),Buffer.from('"role": "toolResult"')],J=[Buffer.from('"usage":{'),Buffer.from('"usage": {')],D=i((e,t)=>t.some(r=>e.includes(r)),"includesAny");function Y(e){let t=e.length>1024?e.subarray(0,1024):e;if(D(t,q))return!0;if(!D(t,G))return!1;let r=e.length>4096?e.subarray(e.length-4096):e;return D(r,J)}i(Y,"mightCarryUsage");var g=i(e=>typeof e=="number"&&Number.isFinite(e)?e:0,"finite");function A(e){if(!e||typeof e!="object")return;let t=e,r=t.cost,a={input:g(t.input),output:g(t.output),cacheRead:g(t.cacheRead),cacheWrite:g(t.cacheWrite),cost:typeof r=="number"?g(r):r&&typeof r=="object"?g(r.total):0};return a.cost===0&&a.input+a.output+a.cacheRead+a.cacheWrite===0?void 0:a}i(A,"amountOf");function S(...e){for(let t of e){let r=typeof t=="number"?t:Date.parse(String(t??""));if(Number.isFinite(r)&&r>0)return r}return 0}i(S,"timeOf");var j=i(e=>`${e.input}:${e.output}:${e.cacheRead}:${e.cacheWrite}`,"fingerprint");function K(e){let t={sessionId:"",cwd:"",records:[],toolRepairs:[]},r=i((n,d,o,f,s)=>{let p=n==="model"&&!s?`${d}:${f}:${j(o)}`:`${n}:${s}:${f}:${j(o)}`;t.records.push({source:n,label:d,timestamp:f,key:p,...o})},"add"),a=0;for(;a<e.length;){let n=e.indexOf(H,a);n===-1&&(n=e.length);let d=e.subarray(a,n);if(a=n+1,d.length===0||!Y(d))continue;let o;try{o=JSON.parse(d.toString("utf8"))}catch{continue}let f=typeof o.id=="string"?o.id:"";if(o.type==="session"){typeof o.id=="string"&&(t.sessionId=o.id),typeof o.cwd=="string"&&(t.cwd=o.cwd);continue}if(o.type==="usage"){let u=A(o.usage);u&&o.provider&&o.model&&r("model",`${o.provider}/${o.model}`,u,S(o.timestamp),f);continue}if(o.type==="custom"&&o.customType===T){let u=Array.isArray(o.data?.repairs)?o.data.repairs.length:0;u>0&&t.toolRepairs?.push({timestamp:S(o.timestamp),key:f,count:u});continue}if(o.type==="compaction"||o.type==="branch_summary"){let u=A(o.usage);u&&r("housekeeping","",u,S(o.timestamp),f);continue}let s=o.message;if(o.type!=="message"||!s)continue;let p=A(s.usage);if(!p)continue;let y=S(s.timestamp,o.timestamp);if(s.role==="assistant"&&s.provider&&s.model)r("model",`${s.provider}/${s.model}`,p,y,"");else if(s.role==="toolResult"){let u=s.toolName??"";r(u==="task"?"subagents":"tools",u,p,y,f)}}return t}i(K,"parseSessionBuffer");async function O(e,t=[]){let r;try{r=await W(e,{withFileTypes:!0})}catch{return t}for(let a of r){let n=E(e,a.name);a.isDirectory()?await O(n,t):a.isFile()&&a.name.endsWith(".jsonl")&&t.push(n)}return t}i(O,"sessionFiles");async function Q(e){try{let t=JSON.parse(await I(e,"utf8"));if(B(t)>w)return C(e),{doc:{formatVersion:w,files:{}},writable:!1};let r=t.files;if(r&&typeof r=="object")return{doc:{formatVersion:w,files:r},writable:!0}}catch{}return{doc:{formatVersion:w,files:{}},writable:!0}}i(Q,"readCache");async function X(e){let t=E(e,V),{doc:r,writable:a}=await Q(t),n={},d=!1,o=(await O(E(e,P))).sort(),f=[];for(let s of o){let p;try{p=await x(s)}catch{continue}let y=r.files[s];if(y&&y.size===p.size&&y.mtimeMs===p.mtimeMs&&y.parsed)n[s]=y;else{let u;try{u=await I(s)}catch{continue}n[s]={size:p.size,mtimeMs:p.mtimeMs,parsed:K(u)},d=!0}f.push(n[s].parsed)}if(Object.keys(r.files).length!==Object.keys(n).length&&(d=!0),a&&d)try{L(t,JSON.stringify({formatVersion:w,files:n}))}catch{}return f}i(X,"loadSessions");function Z(e){if(!e)return"?";let t=z(),r;e===t||e.startsWith(`${t}/`)?r=t:r=/^(\/Users\/[^/]+|\/home\/[^/]+)(?=\/|$)/.exec(e)?.[1];let a=(r===void 0?e:e.slice(r.length)).split(/[\\/]/).filter(Boolean).slice(0,2);return r===void 0?`/${a.join("/")}`:a.length>0?`~/${a.join("/")}`:"~"}i(Z,"projectLabel");function ee(e){let t=e.trim().toLowerCase();if(t==="")return{kind:"days",days:30,label:"30d"};if(t==="today")return{kind:"today",label:"today"};if(t==="all")return{kind:"all",label:"all"};let r=/^(\d{1,4})d$/.exec(t);if(r){let a=Number(r[1]);if(a>=1)return{kind:"days",days:a,label:`${a}d`}}}i(ee,"parseUsageRange");var _=i(()=>({input:0,output:0,cacheRead:0,cacheWrite:0,cost:0}),"empty");function M(e,t){e.input+=t.input,e.output+=t.output,e.cacheRead+=t.cacheRead,e.cacheWrite+=t.cacheWrite,e.cost+=t.cost}i(M,"addInto");function te(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}i(te,"startOfLocalDay");function re(e){let t=new Date(e),r=i(a=>String(a).padStart(2,"0"),"pad");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`}i(re,"dayKey");function oe(e,t){if(e.kind==="all")return Number.NEGATIVE_INFINITY;let r=te(t);if(e.kind==="today")return r;let a=new Date(r);return a.setDate(a.getDate()-(e.days-1)),a.getTime()}i(oe,"rangeStart");function ae(e){return e.source==="model"?e.label:e.source}i(ae,"modelKey");var ie={subagents:"\u5B50\u52A9\u624B",tools:"\u5DE5\u5177",housekeeping:"\u4E0A\u4E0B\u6587\u6574\u7406"};function se(e,t,r){let a=oe(t,r),n=new Set,d=_(),o={day:new Map,model:new Map,project:new Map},f={day:new Map,model:new Map,project:new Map},s=new Set,p=i((l,c,m,$,R)=>{let h=o[l].get(c);h||(h={key:c,label:m,sessions:0,..._()},o[l].set(c,h)),M(h,R);let b=f[l].get(c);b||(b=new Set,f[l].set(c,b)),b.add($),h.sessions=b.size},"bump");for(let l of e){if(!l.sessionId)continue;let c=Z(l.cwd);for(let m of l.records){if(m.timestamp<a||m.timestamp>r||n.has(m.key))continue;n.add(m.key),M(d,m),s.add(l.sessionId);let $=ae(m),R=re(m.timestamp);p("day",R,R,l.sessionId,m),p("model",$,m.source==="model"?m.label:U(ie[m.source]),l.sessionId,m),p("project",c,c,l.sessionId,m)}}let y=0,u=new Set;for(let l of e)for(let c of l.toolRepairs??[])c.timestamp<a||c.timestamp>r||u.has(c.key)||(u.add(c.key),y+=c.count);let N=i((l,c)=>c.cost-l.cost||l.label.localeCompare(c.label),"byCost");return{range:t,sessions:s.size,total:d,byDay:[...o.day.values()].sort((l,c)=>c.key.localeCompare(l.key)),byModel:[...o.model.values()].sort(N),byProject:[...o.project.values()].sort(N),toolRepairs:y}}i(se,"buildReport");async function ne(e){let t=await X(e.agentDir??F());return se(t,e.range,e.now??Date.now())}i(ne,"collectUsage");async function le(e){let t=ee(e.range);if(!t)throw new Error(`Unknown usage range: ${String(e.range)}`);return ne({range:t,...e.agentDir?{agentDir:e.agentDir}:{}})}i(le,"collectUsage2");export{le as collectUsage};
@@ -1 +1 @@
1
- var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});import{createRequire as u}from"node:module";const Tr=u(import.meta.url);import{dist_exports as i}from"./chunk-L3RBW36Y.js";import{DAL_ENGINE_PACKAGE_NAMES as n,dist_exports as p}from"./chunk-RKLUP6JT.js";import{CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY as M,CACHE_WARMING_MAX_AGE_MS as S,CACHE_WARMING_MAX_IDLE_AGE_MS as v,CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS as R,all_exports as l,anthropicMessagesApi as N,azureOpenAIResponsesApi as O,bedrockConverseStreamApi as P,compile_exports as m,complete as y,completeSimple as h,createFauxCore as x,envApiKeyAuth as f,evaluateCacheWarming as D,fauxAssistantMessage as H,fauxProvider as V,fauxText as G,fauxThinking as L,fauxToolCall as k,generateImages as w,generateImagesOpenRouter as b,getApiProvider as U,getApiProviders as z,getCacheWarmingDelayMs as K,getCacheWarmingRequestOptions as W,getImageModel as B,getImageModels as F,getImageProviders as Y,getImagesApiProvider as q,getModel as J,getModels as X,getOverflowPatterns as j,getPromptCacheTtlMs as Z,getProviders as $,googleGenerativeAIApi as Q,googleVertexApi as ee,isCacheWarmingReplayable as te,isContextOverflow as re,isRecoverableLength as se,lazyOAuth as ie,mistralConversationsApi as oe,openAICodexResponsesApi as ae,openAICompletionsApi as ne,openAIResponsesApi as pe,piMessagesApi as le,registerApiProvider as me,registerBuiltInApiProviders as Ae,registerBuiltInImagesApiProviders as ge,registerFauxProvider as de,registerImagesApiProvider as Ie,resetApiProviders as _e,setBedrockProviderLoader as Te,setBedrockProviderModule as Ce,stream as Ee,streamAnthropic as ce,streamAzureOpenAIResponses as ue,streamGoogle as Me,streamGoogleVertex as Se,streamMistral as ve,streamOpenAICodexResponses as Re,streamOpenAICompletions as Ne,streamOpenAIResponses as Oe,streamSimple as Pe,streamSimpleAnthropic as ye,streamSimpleAzureOpenAIResponses as he,streamSimpleGoogle as xe,streamSimpleGoogleVertex as fe,streamSimpleMistral as De,streamSimpleOpenAICodexResponses as He,streamSimpleOpenAICompletions as Ve,streamSimpleOpenAIResponses as Ge,unregisterApiProviders as Le,validateToolArguments as ke,validateToolCall as we,value_exports as A}from"./chunk-R7FBN5UP.js";import"./chunk-3ZHZINH3.js";import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as be,build_exports as g,isAccountLimitAssistantError as Ue,isNetworkAssistantError as ze,isRetryableAssistantError as Ke,retryAssistantCall as We,retryDelayMs as Be,typebox_exports as d}from"./chunk-3YGHTGYM.js";import"./chunk-356BFRU3.js";import"./chunk-SE42OS3U.js";import"./chunk-K7VBBYTT.js";import{dist_exports as I}from"./chunk-EH7SFF47.js";import"./chunk-6QGV3IWD.js";import"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import"./chunk-XRF4A4KI.js";import{uuidv7 as Fe}from"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import{ANTHROPIC_API_KEY_ENV as Ye,ANTHROPIC_AUTH_TOKEN_ENV as qe,ANTHROPIC_FEDERATION_RULE_ID_ENV as Je,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV as Xe,ANTHROPIC_OAUTH_TOKEN_ENV as je,ANTHROPIC_ORGANIZATION_ID_ENV as Ze,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV as $e,ANTHROPIC_WORKSPACE_ID_ENV as Qe,findEnvKeys as et,getEnvApiKey as tt,setEnvApiKeyPolicy as rt}from"./chunk-723ZGEZ2.js";import{cleanupSessionResources as st,registerSessionResourceCleanup as it}from"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import{StreamingJsonParser as ot,ToolCallArgumentsStream as at,parseJsonWithRepair as nt,parseStreamingJson as pt,parseToolCallArguments as lt,repairJson as mt}from"./chunk-FFMDRXC4.js";import{AI_TELEMETRY_SCHEMA as At,InMemoryCredentialStore as gt,InMemoryModelsStore as dt,ModelsError as It,calculateCost as _t,clampThinkingLevel as Tt,collapseSystemMessages as Ct,createInitialSystemMessage as Et,createModels as ct,createProvider as ut,declarationsEqual as Mt,defaultProviderAuthContext as St,getCurrentSystemMessage as vt,getCurrentSystemPrompt as Rt,getCurrentTools as Nt,getDeclaredTools as Ot,getInitialSystemMessage as Pt,getModelType as yt,getSupportedThinkingLevels as ht,getToolStateChanges as xt,hasApi as ft,hasNonAdditiveToolChanges as Dt,hasToolRedefinitions as Ht,isModelType as Vt,lazyApi as Gt,lazyStream as Lt,modelsAreEqual as kt,models_exports as _,normalizeContext as wt,resolveTranscript as bt,resolveTranscriptTools as Ut,setAmbientAuthPolicy as zt,toToolDeclaration as Kt,withoutInitialSystemMessage as Wt}from"./chunk-K4B5ABCQ.js";import{AssistantMessageEventStream as Bt,EventStream as Ft,appendAssistantMessageDiagnostic as Yt,createAssistantMessageDiagnostic as qt,createAssistantMessageEventStream as Jt,extractDiagnosticError as Xt,firstTokenTimeoutMessage as jt,formatThrownValue as Zt,withFirstTokenTimeout as $t}from"./chunk-4LDEEFCY.js";import{PI_AI_VERSION as Qt,PI_ATTRIBUTION as er,contentText as tr,formatUserAgent as rr,getAttributionHeaders as sr,getClientVersion as ir,getIdentityHeaders as or,getOpenCodeSessionHeaders as ar,getSystemMessageText as nr,mergeClientIdentity as pr,renderSystemMessageUpdate as lr,withClientIdentity as mr}from"./chunk-SCYK4XNE.js";import{__export as Ar}from"./chunk-JXWJOIH4.js";var T={},s={};Ar(s,{AI_TELEMETRY_SCHEMA:e(()=>At,"AI_TELEMETRY_SCHEMA"),ANTHROPIC_API_KEY_ENV:e(()=>Ye,"ANTHROPIC_API_KEY_ENV"),ANTHROPIC_AUTH_TOKEN_ENV:e(()=>qe,"ANTHROPIC_AUTH_TOKEN_ENV"),ANTHROPIC_FEDERATION_RULE_ID_ENV:e(()=>Je,"ANTHROPIC_FEDERATION_RULE_ID_ENV"),ANTHROPIC_IDENTITY_TOKEN_FILE_ENV:e(()=>Xe,"ANTHROPIC_IDENTITY_TOKEN_FILE_ENV"),ANTHROPIC_OAUTH_TOKEN_ENV:e(()=>je,"ANTHROPIC_OAUTH_TOKEN_ENV"),ANTHROPIC_ORGANIZATION_ID_ENV:e(()=>Ze,"ANTHROPIC_ORGANIZATION_ID_ENV"),ANTHROPIC_SERVICE_ACCOUNT_ID_ENV:e(()=>$e,"ANTHROPIC_SERVICE_ACCOUNT_ID_ENV"),ANTHROPIC_WORKSPACE_ID_ENV:e(()=>Qe,"ANTHROPIC_WORKSPACE_ID_ENV"),AssistantMessageEventStream:e(()=>Bt,"AssistantMessageEventStream"),CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY:e(()=>M,"CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY"),CACHE_WARMING_MAX_AGE_MS:e(()=>S,"CACHE_WARMING_MAX_AGE_MS"),CACHE_WARMING_MAX_IDLE_AGE_MS:e(()=>v,"CACHE_WARMING_MAX_IDLE_AGE_MS"),CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS:e(()=>R,"CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS"),DEFAULT_MAX_AGENT_RETRY_DELAY_MS:e(()=>be,"DEFAULT_MAX_AGENT_RETRY_DELAY_MS"),EventStream:e(()=>Ft,"EventStream"),InMemoryCredentialStore:e(()=>gt,"InMemoryCredentialStore"),InMemoryModelsStore:e(()=>dt,"InMemoryModelsStore"),ModelsError:e(()=>It,"ModelsError"),PI_AI_VERSION:e(()=>Qt,"PI_AI_VERSION"),PI_ATTRIBUTION:e(()=>er,"PI_ATTRIBUTION"),StreamingJsonParser:e(()=>ot,"StreamingJsonParser"),StringEnum:e(()=>gr,"StringEnum"),ToolCallArgumentsStream:e(()=>at,"ToolCallArgumentsStream"),Type:e(()=>d,"Type"),anthropicMessagesApi:e(()=>N,"anthropicMessagesApi"),appendAssistantMessageDiagnostic:e(()=>Yt,"appendAssistantMessageDiagnostic"),azureOpenAIResponsesApi:e(()=>O,"azureOpenAIResponsesApi"),bedrockConverseStreamApi:e(()=>P,"bedrockConverseStreamApi"),calculateCost:e(()=>_t,"calculateCost"),clampThinkingLevel:e(()=>Tt,"clampThinkingLevel"),cleanupSessionResources:e(()=>st,"cleanupSessionResources"),collapseSystemMessages:e(()=>Ct,"collapseSystemMessages"),complete:e(()=>y,"complete"),completeSimple:e(()=>h,"completeSimple"),contentText:e(()=>tr,"contentText"),createAssistantMessageDiagnostic:e(()=>qt,"createAssistantMessageDiagnostic"),createAssistantMessageEventStream:e(()=>Jt,"createAssistantMessageEventStream"),createFauxCore:e(()=>x,"createFauxCore"),createInitialSystemMessage:e(()=>Et,"createInitialSystemMessage"),createModels:e(()=>ct,"createModels"),createProvider:e(()=>ut,"createProvider"),declarationsEqual:e(()=>Mt,"declarationsEqual"),defaultProviderAuthContext:e(()=>St,"defaultProviderAuthContext"),envApiKeyAuth:e(()=>f,"envApiKeyAuth"),evaluateCacheWarming:e(()=>D,"evaluateCacheWarming"),extractDiagnosticError:e(()=>Xt,"extractDiagnosticError"),fauxAssistantMessage:e(()=>H,"fauxAssistantMessage"),fauxProvider:e(()=>V,"fauxProvider"),fauxText:e(()=>G,"fauxText"),fauxThinking:e(()=>L,"fauxThinking"),fauxToolCall:e(()=>k,"fauxToolCall"),findEnvKeys:e(()=>et,"findEnvKeys"),firstTokenTimeoutMessage:e(()=>jt,"firstTokenTimeoutMessage"),formatThrownValue:e(()=>Zt,"formatThrownValue"),formatUserAgent:e(()=>rr,"formatUserAgent"),generateImages:e(()=>w,"generateImages"),generateImagesOpenRouter:e(()=>b,"generateImagesOpenRouter"),getApiProvider:e(()=>U,"getApiProvider"),getApiProviders:e(()=>z,"getApiProviders"),getAttributionHeaders:e(()=>sr,"getAttributionHeaders"),getCacheWarmingDelayMs:e(()=>K,"getCacheWarmingDelayMs"),getCacheWarmingRequestOptions:e(()=>W,"getCacheWarmingRequestOptions"),getClientVersion:e(()=>ir,"getClientVersion"),getCurrentSystemMessage:e(()=>vt,"getCurrentSystemMessage"),getCurrentSystemPrompt:e(()=>Rt,"getCurrentSystemPrompt"),getCurrentTools:e(()=>Nt,"getCurrentTools"),getDeclaredTools:e(()=>Ot,"getDeclaredTools"),getEnvApiKey:e(()=>tt,"getEnvApiKey"),getIdentityHeaders:e(()=>or,"getIdentityHeaders"),getImageModel:e(()=>B,"getImageModel"),getImageModels:e(()=>F,"getImageModels"),getImageProviders:e(()=>Y,"getImageProviders"),getImagesApiProvider:e(()=>q,"getImagesApiProvider"),getInitialSystemMessage:e(()=>Pt,"getInitialSystemMessage"),getModel:e(()=>J,"getModel"),getModelType:e(()=>yt,"getModelType"),getModels:e(()=>X,"getModels"),getOpenCodeSessionHeaders:e(()=>ar,"getOpenCodeSessionHeaders"),getOverflowPatterns:e(()=>j,"getOverflowPatterns"),getPromptCacheTtlMs:e(()=>Z,"getPromptCacheTtlMs"),getProviders:e(()=>$,"getProviders"),getSupportedThinkingLevels:e(()=>ht,"getSupportedThinkingLevels"),getSystemMessageText:e(()=>nr,"getSystemMessageText"),getToolStateChanges:e(()=>xt,"getToolStateChanges"),googleGenerativeAIApi:e(()=>Q,"googleGenerativeAIApi"),googleVertexApi:e(()=>ee,"googleVertexApi"),hasApi:e(()=>ft,"hasApi"),hasNonAdditiveToolChanges:e(()=>Dt,"hasNonAdditiveToolChanges"),hasToolRedefinitions:e(()=>Ht,"hasToolRedefinitions"),isAccountLimitAssistantError:e(()=>Ue,"isAccountLimitAssistantError"),isCacheWarmingReplayable:e(()=>te,"isCacheWarmingReplayable"),isContextOverflow:e(()=>re,"isContextOverflow"),isModelType:e(()=>Vt,"isModelType"),isNetworkAssistantError:e(()=>ze,"isNetworkAssistantError"),isRecoverableLength:e(()=>se,"isRecoverableLength"),isRetryableAssistantError:e(()=>Ke,"isRetryableAssistantError"),lazyApi:e(()=>Gt,"lazyApi"),lazyOAuth:e(()=>ie,"lazyOAuth"),lazyStream:e(()=>Lt,"lazyStream"),mergeClientIdentity:e(()=>pr,"mergeClientIdentity"),mistralConversationsApi:e(()=>oe,"mistralConversationsApi"),modelsAreEqual:e(()=>kt,"modelsAreEqual"),normalizeContext:e(()=>wt,"normalizeContext"),openAICodexResponsesApi:e(()=>ae,"openAICodexResponsesApi"),openAICompletionsApi:e(()=>ne,"openAICompletionsApi"),openAIResponsesApi:e(()=>pe,"openAIResponsesApi"),parseJsonWithRepair:e(()=>nt,"parseJsonWithRepair"),parseStreamingJson:e(()=>pt,"parseStreamingJson"),parseToolCallArguments:e(()=>lt,"parseToolCallArguments"),piMessagesApi:e(()=>le,"piMessagesApi"),registerApiProvider:e(()=>me,"registerApiProvider"),registerBuiltInApiProviders:e(()=>Ae,"registerBuiltInApiProviders"),registerBuiltInImagesApiProviders:e(()=>ge,"registerBuiltInImagesApiProviders"),registerFauxProvider:e(()=>de,"registerFauxProvider"),registerImagesApiProvider:e(()=>Ie,"registerImagesApiProvider"),registerSessionResourceCleanup:e(()=>it,"registerSessionResourceCleanup"),renderSystemMessageUpdate:e(()=>lr,"renderSystemMessageUpdate"),repairJson:e(()=>mt,"repairJson"),resetApiProviders:e(()=>_e,"resetApiProviders"),resolveTranscript:e(()=>bt,"resolveTranscript"),resolveTranscriptTools:e(()=>Ut,"resolveTranscriptTools"),retryAssistantCall:e(()=>We,"retryAssistantCall"),retryDelayMs:e(()=>Be,"retryDelayMs"),setAmbientAuthPolicy:e(()=>zt,"setAmbientAuthPolicy"),setBedrockProviderLoader:e(()=>Te,"setBedrockProviderLoader"),setBedrockProviderModule:e(()=>Ce,"setBedrockProviderModule"),setEnvApiKeyPolicy:e(()=>rt,"setEnvApiKeyPolicy"),stream:e(()=>Ee,"stream"),streamAnthropic:e(()=>ce,"streamAnthropic"),streamAzureOpenAIResponses:e(()=>ue,"streamAzureOpenAIResponses"),streamGoogle:e(()=>Me,"streamGoogle"),streamGoogleVertex:e(()=>Se,"streamGoogleVertex"),streamMistral:e(()=>ve,"streamMistral"),streamOpenAICodexResponses:e(()=>Re,"streamOpenAICodexResponses"),streamOpenAICompletions:e(()=>Ne,"streamOpenAICompletions"),streamOpenAIResponses:e(()=>Oe,"streamOpenAIResponses"),streamSimple:e(()=>Pe,"streamSimple"),streamSimpleAnthropic:e(()=>ye,"streamSimpleAnthropic"),streamSimpleAzureOpenAIResponses:e(()=>he,"streamSimpleAzureOpenAIResponses"),streamSimpleGoogle:e(()=>xe,"streamSimpleGoogle"),streamSimpleGoogleVertex:e(()=>fe,"streamSimpleGoogleVertex"),streamSimpleMistral:e(()=>De,"streamSimpleMistral"),streamSimpleOpenAICodexResponses:e(()=>He,"streamSimpleOpenAICodexResponses"),streamSimpleOpenAICompletions:e(()=>Ve,"streamSimpleOpenAICompletions"),streamSimpleOpenAIResponses:e(()=>Ge,"streamSimpleOpenAIResponses"),toToolDeclaration:e(()=>Kt,"toToolDeclaration"),unregisterApiProviders:e(()=>Le,"unregisterApiProviders"),uuidv7:e(()=>Fe,"uuidv7"),validateToolArguments:e(()=>ke,"validateToolArguments"),validateToolCall:e(()=>we,"validateToolCall"),withClientIdentity:e(()=>mr,"withClientIdentity"),withFirstTokenTimeout:e(()=>$t,"withFirstTokenTimeout"),withoutInitialSystemMessage:e(()=>Wt,"withoutInitialSystemMessage")});function gr(r,t){return d.Unsafe({type:"string",enum:r,...t?.description&&{description:t.description},...t?.default&&{default:t.default}})}e(gr,"StringEnum");var o={typebox:g,"typebox/compile":m,"typebox/value":A,"@sinclair/typebox":g,"@sinclair/typebox/compile":m,"@sinclair/typebox/value":A,"@earendil-works/pi-agent-core":p,"@earendil-works/pi-tui":I,"@earendil-works/pi-ai":s,"@earendil-works/pi-ai/compat":s,"@earendil-works/pi-ai/models":_,"@earendil-works/pi-ai/oauth":T,"@earendil-works/pi-ai/providers/all":l,"@earendil-works/pi-coding-agent":i,"@mariozechner/pi-agent-core":p,"@mariozechner/pi-tui":I,"@mariozechner/pi-ai":s,"@mariozechner/pi-ai/compat":s,"@mariozechner/pi-ai/models":_,"@mariozechner/pi-ai/oauth":T,"@mariozechner/pi-ai/providers/all":l,"@mariozechner/pi-coding-agent":i},dr={sdk:e(()=>import("./sdk-6GP346VB.js"),"sdk"),office:e(()=>import("./office-AXLGVCMO.js"),"office"),mcp:e(()=>import("./mcp-PC3Y3FBI.js"),"mcp"),router:e(()=>import("./router-26PXJ7YH.js"),"router"),rewind:e(()=>import("./rewind-2OYLDDHH.js"),"rewind"),review:e(()=>import("./review-KXWT7T3V.js"),"review"),usage:e(()=>import("./usage-MY7HTXQB.js"),"usage"),sync:e(()=>import("./sync-ONQZCAYG.js"),"sync")};for(let r of n)o[r]=i;for(let[r,t]of Object.entries(dr)){let a,C={enumerable:!0,get:e(()=>(a??=t(),a),"get")};for(let E of n)Object.defineProperty(o,`${E}/${r}`,C)}export{o as VIRTUAL_MODULES};
1
+ var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});import{createRequire as u}from"node:module";const Tr=u(import.meta.url);import{dist_exports as i}from"./chunk-NMU45EFT.js";import{DAL_ENGINE_PACKAGE_NAMES as n,dist_exports as p}from"./chunk-6U37J6E7.js";import{CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY as M,CACHE_WARMING_MAX_AGE_MS as S,CACHE_WARMING_MAX_IDLE_AGE_MS as v,CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS as R,all_exports as l,anthropicMessagesApi as N,azureOpenAIResponsesApi as O,bedrockConverseStreamApi as P,compile_exports as m,complete as y,completeSimple as h,createFauxCore as x,envApiKeyAuth as f,evaluateCacheWarming as D,fauxAssistantMessage as H,fauxProvider as V,fauxText as G,fauxThinking as L,fauxToolCall as k,generateImages as w,generateImagesOpenRouter as b,getApiProvider as U,getApiProviders as z,getCacheWarmingDelayMs as K,getCacheWarmingRequestOptions as W,getImageModel as B,getImageModels as F,getImageProviders as Y,getImagesApiProvider as q,getModel as J,getModels as X,getOverflowPatterns as j,getPromptCacheTtlMs as Z,getProviders as $,googleGenerativeAIApi as Q,googleVertexApi as ee,isCacheWarmingReplayable as te,isContextOverflow as re,isRecoverableLength as se,lazyOAuth as ie,mistralConversationsApi as oe,openAICodexResponsesApi as ae,openAICompletionsApi as ne,openAIResponsesApi as pe,piMessagesApi as le,registerApiProvider as me,registerBuiltInApiProviders as Ae,registerBuiltInImagesApiProviders as ge,registerFauxProvider as de,registerImagesApiProvider as Ie,resetApiProviders as _e,setBedrockProviderLoader as Te,setBedrockProviderModule as Ce,stream as Ee,streamAnthropic as ce,streamAzureOpenAIResponses as ue,streamGoogle as Me,streamGoogleVertex as Se,streamMistral as ve,streamOpenAICodexResponses as Re,streamOpenAICompletions as Ne,streamOpenAIResponses as Oe,streamSimple as Pe,streamSimpleAnthropic as ye,streamSimpleAzureOpenAIResponses as he,streamSimpleGoogle as xe,streamSimpleGoogleVertex as fe,streamSimpleMistral as De,streamSimpleOpenAICodexResponses as He,streamSimpleOpenAICompletions as Ve,streamSimpleOpenAIResponses as Ge,unregisterApiProviders as Le,validateToolArguments as ke,validateToolCall as we,value_exports as A}from"./chunk-YDOF6JVP.js";import"./chunk-5TGFM4KW.js";import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as be,build_exports as g,isAccountLimitAssistantError as Ue,isNetworkAssistantError as ze,isRetryableAssistantError as Ke,retryAssistantCall as We,retryDelayMs as Be,typebox_exports as d}from"./chunk-3YGHTGYM.js";import"./chunk-D3HKK2ZD.js";import"./chunk-SE42OS3U.js";import"./chunk-F5SIUTR7.js";import{dist_exports as I}from"./chunk-AL3DFAIM.js";import"./chunk-6QGV3IWD.js";import"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import"./chunk-SNBVCTMQ.js";import{uuidv7 as Fe}from"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import{ANTHROPIC_API_KEY_ENV as Ye,ANTHROPIC_AUTH_TOKEN_ENV as qe,ANTHROPIC_FEDERATION_RULE_ID_ENV as Je,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV as Xe,ANTHROPIC_OAUTH_TOKEN_ENV as je,ANTHROPIC_ORGANIZATION_ID_ENV as Ze,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV as $e,ANTHROPIC_WORKSPACE_ID_ENV as Qe,findEnvKeys as et,getEnvApiKey as tt,setEnvApiKeyPolicy as rt}from"./chunk-723ZGEZ2.js";import{cleanupSessionResources as st,registerSessionResourceCleanup as it}from"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import{StreamingJsonParser as ot,ToolCallArgumentsStream as at,parseJsonWithRepair as nt,parseStreamingJson as pt,parseToolCallArguments as lt,repairJson as mt}from"./chunk-FFMDRXC4.js";import{AI_TELEMETRY_SCHEMA as At,InMemoryCredentialStore as gt,InMemoryModelsStore as dt,ModelsError as It,calculateCost as _t,clampThinkingLevel as Tt,collapseSystemMessages as Ct,createInitialSystemMessage as Et,createModels as ct,createProvider as ut,declarationsEqual as Mt,defaultProviderAuthContext as St,getCurrentSystemMessage as vt,getCurrentSystemPrompt as Rt,getCurrentTools as Nt,getDeclaredTools as Ot,getInitialSystemMessage as Pt,getModelType as yt,getSupportedThinkingLevels as ht,getToolStateChanges as xt,hasApi as ft,hasNonAdditiveToolChanges as Dt,hasToolRedefinitions as Ht,isModelType as Vt,lazyApi as Gt,lazyStream as Lt,modelsAreEqual as kt,models_exports as _,normalizeContext as wt,resolveTranscript as bt,resolveTranscriptTools as Ut,setAmbientAuthPolicy as zt,toToolDeclaration as Kt,withoutInitialSystemMessage as Wt}from"./chunk-2XX4WZT6.js";import{AssistantMessageEventStream as Bt,EventStream as Ft,appendAssistantMessageDiagnostic as Yt,createAssistantMessageDiagnostic as qt,createAssistantMessageEventStream as Jt,extractDiagnosticError as Xt,firstTokenTimeoutMessage as jt,formatThrownValue as Zt,withFirstTokenTimeout as $t}from"./chunk-4LDEEFCY.js";import{PI_AI_VERSION as Qt,PI_ATTRIBUTION as er,contentText as tr,formatUserAgent as rr,getAttributionHeaders as sr,getClientVersion as ir,getIdentityHeaders as or,getOpenCodeSessionHeaders as ar,getSystemMessageText as nr,mergeClientIdentity as pr,renderSystemMessageUpdate as lr,withClientIdentity as mr}from"./chunk-44EXLOHK.js";import{__export as Ar}from"./chunk-JXWJOIH4.js";var T={},s={};Ar(s,{AI_TELEMETRY_SCHEMA:e(()=>At,"AI_TELEMETRY_SCHEMA"),ANTHROPIC_API_KEY_ENV:e(()=>Ye,"ANTHROPIC_API_KEY_ENV"),ANTHROPIC_AUTH_TOKEN_ENV:e(()=>qe,"ANTHROPIC_AUTH_TOKEN_ENV"),ANTHROPIC_FEDERATION_RULE_ID_ENV:e(()=>Je,"ANTHROPIC_FEDERATION_RULE_ID_ENV"),ANTHROPIC_IDENTITY_TOKEN_FILE_ENV:e(()=>Xe,"ANTHROPIC_IDENTITY_TOKEN_FILE_ENV"),ANTHROPIC_OAUTH_TOKEN_ENV:e(()=>je,"ANTHROPIC_OAUTH_TOKEN_ENV"),ANTHROPIC_ORGANIZATION_ID_ENV:e(()=>Ze,"ANTHROPIC_ORGANIZATION_ID_ENV"),ANTHROPIC_SERVICE_ACCOUNT_ID_ENV:e(()=>$e,"ANTHROPIC_SERVICE_ACCOUNT_ID_ENV"),ANTHROPIC_WORKSPACE_ID_ENV:e(()=>Qe,"ANTHROPIC_WORKSPACE_ID_ENV"),AssistantMessageEventStream:e(()=>Bt,"AssistantMessageEventStream"),CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY:e(()=>M,"CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY"),CACHE_WARMING_MAX_AGE_MS:e(()=>S,"CACHE_WARMING_MAX_AGE_MS"),CACHE_WARMING_MAX_IDLE_AGE_MS:e(()=>v,"CACHE_WARMING_MAX_IDLE_AGE_MS"),CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS:e(()=>R,"CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS"),DEFAULT_MAX_AGENT_RETRY_DELAY_MS:e(()=>be,"DEFAULT_MAX_AGENT_RETRY_DELAY_MS"),EventStream:e(()=>Ft,"EventStream"),InMemoryCredentialStore:e(()=>gt,"InMemoryCredentialStore"),InMemoryModelsStore:e(()=>dt,"InMemoryModelsStore"),ModelsError:e(()=>It,"ModelsError"),PI_AI_VERSION:e(()=>Qt,"PI_AI_VERSION"),PI_ATTRIBUTION:e(()=>er,"PI_ATTRIBUTION"),StreamingJsonParser:e(()=>ot,"StreamingJsonParser"),StringEnum:e(()=>gr,"StringEnum"),ToolCallArgumentsStream:e(()=>at,"ToolCallArgumentsStream"),Type:e(()=>d,"Type"),anthropicMessagesApi:e(()=>N,"anthropicMessagesApi"),appendAssistantMessageDiagnostic:e(()=>Yt,"appendAssistantMessageDiagnostic"),azureOpenAIResponsesApi:e(()=>O,"azureOpenAIResponsesApi"),bedrockConverseStreamApi:e(()=>P,"bedrockConverseStreamApi"),calculateCost:e(()=>_t,"calculateCost"),clampThinkingLevel:e(()=>Tt,"clampThinkingLevel"),cleanupSessionResources:e(()=>st,"cleanupSessionResources"),collapseSystemMessages:e(()=>Ct,"collapseSystemMessages"),complete:e(()=>y,"complete"),completeSimple:e(()=>h,"completeSimple"),contentText:e(()=>tr,"contentText"),createAssistantMessageDiagnostic:e(()=>qt,"createAssistantMessageDiagnostic"),createAssistantMessageEventStream:e(()=>Jt,"createAssistantMessageEventStream"),createFauxCore:e(()=>x,"createFauxCore"),createInitialSystemMessage:e(()=>Et,"createInitialSystemMessage"),createModels:e(()=>ct,"createModels"),createProvider:e(()=>ut,"createProvider"),declarationsEqual:e(()=>Mt,"declarationsEqual"),defaultProviderAuthContext:e(()=>St,"defaultProviderAuthContext"),envApiKeyAuth:e(()=>f,"envApiKeyAuth"),evaluateCacheWarming:e(()=>D,"evaluateCacheWarming"),extractDiagnosticError:e(()=>Xt,"extractDiagnosticError"),fauxAssistantMessage:e(()=>H,"fauxAssistantMessage"),fauxProvider:e(()=>V,"fauxProvider"),fauxText:e(()=>G,"fauxText"),fauxThinking:e(()=>L,"fauxThinking"),fauxToolCall:e(()=>k,"fauxToolCall"),findEnvKeys:e(()=>et,"findEnvKeys"),firstTokenTimeoutMessage:e(()=>jt,"firstTokenTimeoutMessage"),formatThrownValue:e(()=>Zt,"formatThrownValue"),formatUserAgent:e(()=>rr,"formatUserAgent"),generateImages:e(()=>w,"generateImages"),generateImagesOpenRouter:e(()=>b,"generateImagesOpenRouter"),getApiProvider:e(()=>U,"getApiProvider"),getApiProviders:e(()=>z,"getApiProviders"),getAttributionHeaders:e(()=>sr,"getAttributionHeaders"),getCacheWarmingDelayMs:e(()=>K,"getCacheWarmingDelayMs"),getCacheWarmingRequestOptions:e(()=>W,"getCacheWarmingRequestOptions"),getClientVersion:e(()=>ir,"getClientVersion"),getCurrentSystemMessage:e(()=>vt,"getCurrentSystemMessage"),getCurrentSystemPrompt:e(()=>Rt,"getCurrentSystemPrompt"),getCurrentTools:e(()=>Nt,"getCurrentTools"),getDeclaredTools:e(()=>Ot,"getDeclaredTools"),getEnvApiKey:e(()=>tt,"getEnvApiKey"),getIdentityHeaders:e(()=>or,"getIdentityHeaders"),getImageModel:e(()=>B,"getImageModel"),getImageModels:e(()=>F,"getImageModels"),getImageProviders:e(()=>Y,"getImageProviders"),getImagesApiProvider:e(()=>q,"getImagesApiProvider"),getInitialSystemMessage:e(()=>Pt,"getInitialSystemMessage"),getModel:e(()=>J,"getModel"),getModelType:e(()=>yt,"getModelType"),getModels:e(()=>X,"getModels"),getOpenCodeSessionHeaders:e(()=>ar,"getOpenCodeSessionHeaders"),getOverflowPatterns:e(()=>j,"getOverflowPatterns"),getPromptCacheTtlMs:e(()=>Z,"getPromptCacheTtlMs"),getProviders:e(()=>$,"getProviders"),getSupportedThinkingLevels:e(()=>ht,"getSupportedThinkingLevels"),getSystemMessageText:e(()=>nr,"getSystemMessageText"),getToolStateChanges:e(()=>xt,"getToolStateChanges"),googleGenerativeAIApi:e(()=>Q,"googleGenerativeAIApi"),googleVertexApi:e(()=>ee,"googleVertexApi"),hasApi:e(()=>ft,"hasApi"),hasNonAdditiveToolChanges:e(()=>Dt,"hasNonAdditiveToolChanges"),hasToolRedefinitions:e(()=>Ht,"hasToolRedefinitions"),isAccountLimitAssistantError:e(()=>Ue,"isAccountLimitAssistantError"),isCacheWarmingReplayable:e(()=>te,"isCacheWarmingReplayable"),isContextOverflow:e(()=>re,"isContextOverflow"),isModelType:e(()=>Vt,"isModelType"),isNetworkAssistantError:e(()=>ze,"isNetworkAssistantError"),isRecoverableLength:e(()=>se,"isRecoverableLength"),isRetryableAssistantError:e(()=>Ke,"isRetryableAssistantError"),lazyApi:e(()=>Gt,"lazyApi"),lazyOAuth:e(()=>ie,"lazyOAuth"),lazyStream:e(()=>Lt,"lazyStream"),mergeClientIdentity:e(()=>pr,"mergeClientIdentity"),mistralConversationsApi:e(()=>oe,"mistralConversationsApi"),modelsAreEqual:e(()=>kt,"modelsAreEqual"),normalizeContext:e(()=>wt,"normalizeContext"),openAICodexResponsesApi:e(()=>ae,"openAICodexResponsesApi"),openAICompletionsApi:e(()=>ne,"openAICompletionsApi"),openAIResponsesApi:e(()=>pe,"openAIResponsesApi"),parseJsonWithRepair:e(()=>nt,"parseJsonWithRepair"),parseStreamingJson:e(()=>pt,"parseStreamingJson"),parseToolCallArguments:e(()=>lt,"parseToolCallArguments"),piMessagesApi:e(()=>le,"piMessagesApi"),registerApiProvider:e(()=>me,"registerApiProvider"),registerBuiltInApiProviders:e(()=>Ae,"registerBuiltInApiProviders"),registerBuiltInImagesApiProviders:e(()=>ge,"registerBuiltInImagesApiProviders"),registerFauxProvider:e(()=>de,"registerFauxProvider"),registerImagesApiProvider:e(()=>Ie,"registerImagesApiProvider"),registerSessionResourceCleanup:e(()=>it,"registerSessionResourceCleanup"),renderSystemMessageUpdate:e(()=>lr,"renderSystemMessageUpdate"),repairJson:e(()=>mt,"repairJson"),resetApiProviders:e(()=>_e,"resetApiProviders"),resolveTranscript:e(()=>bt,"resolveTranscript"),resolveTranscriptTools:e(()=>Ut,"resolveTranscriptTools"),retryAssistantCall:e(()=>We,"retryAssistantCall"),retryDelayMs:e(()=>Be,"retryDelayMs"),setAmbientAuthPolicy:e(()=>zt,"setAmbientAuthPolicy"),setBedrockProviderLoader:e(()=>Te,"setBedrockProviderLoader"),setBedrockProviderModule:e(()=>Ce,"setBedrockProviderModule"),setEnvApiKeyPolicy:e(()=>rt,"setEnvApiKeyPolicy"),stream:e(()=>Ee,"stream"),streamAnthropic:e(()=>ce,"streamAnthropic"),streamAzureOpenAIResponses:e(()=>ue,"streamAzureOpenAIResponses"),streamGoogle:e(()=>Me,"streamGoogle"),streamGoogleVertex:e(()=>Se,"streamGoogleVertex"),streamMistral:e(()=>ve,"streamMistral"),streamOpenAICodexResponses:e(()=>Re,"streamOpenAICodexResponses"),streamOpenAICompletions:e(()=>Ne,"streamOpenAICompletions"),streamOpenAIResponses:e(()=>Oe,"streamOpenAIResponses"),streamSimple:e(()=>Pe,"streamSimple"),streamSimpleAnthropic:e(()=>ye,"streamSimpleAnthropic"),streamSimpleAzureOpenAIResponses:e(()=>he,"streamSimpleAzureOpenAIResponses"),streamSimpleGoogle:e(()=>xe,"streamSimpleGoogle"),streamSimpleGoogleVertex:e(()=>fe,"streamSimpleGoogleVertex"),streamSimpleMistral:e(()=>De,"streamSimpleMistral"),streamSimpleOpenAICodexResponses:e(()=>He,"streamSimpleOpenAICodexResponses"),streamSimpleOpenAICompletions:e(()=>Ve,"streamSimpleOpenAICompletions"),streamSimpleOpenAIResponses:e(()=>Ge,"streamSimpleOpenAIResponses"),toToolDeclaration:e(()=>Kt,"toToolDeclaration"),unregisterApiProviders:e(()=>Le,"unregisterApiProviders"),uuidv7:e(()=>Fe,"uuidv7"),validateToolArguments:e(()=>ke,"validateToolArguments"),validateToolCall:e(()=>we,"validateToolCall"),withClientIdentity:e(()=>mr,"withClientIdentity"),withFirstTokenTimeout:e(()=>$t,"withFirstTokenTimeout"),withoutInitialSystemMessage:e(()=>Wt,"withoutInitialSystemMessage")});function gr(r,t){return d.Unsafe({type:"string",enum:r,...t?.description&&{description:t.description},...t?.default&&{default:t.default}})}e(gr,"StringEnum");var o={typebox:g,"typebox/compile":m,"typebox/value":A,"@sinclair/typebox":g,"@sinclair/typebox/compile":m,"@sinclair/typebox/value":A,"@earendil-works/pi-agent-core":p,"@earendil-works/pi-tui":I,"@earendil-works/pi-ai":s,"@earendil-works/pi-ai/compat":s,"@earendil-works/pi-ai/models":_,"@earendil-works/pi-ai/oauth":T,"@earendil-works/pi-ai/providers/all":l,"@earendil-works/pi-coding-agent":i,"@mariozechner/pi-agent-core":p,"@mariozechner/pi-tui":I,"@mariozechner/pi-ai":s,"@mariozechner/pi-ai/compat":s,"@mariozechner/pi-ai/models":_,"@mariozechner/pi-ai/oauth":T,"@mariozechner/pi-ai/providers/all":l,"@mariozechner/pi-coding-agent":i},dr={sdk:e(()=>import("./sdk-C5BAFGNR.js"),"sdk"),office:e(()=>import("./office-2F4B572E.js"),"office"),mcp:e(()=>import("./mcp-SGBPG7LV.js"),"mcp"),router:e(()=>import("./router-RL7OYANY.js"),"router"),rewind:e(()=>import("./rewind-2OYLDDHH.js"),"rewind"),review:e(()=>import("./review-MKITXKSI.js"),"review"),usage:e(()=>import("./usage-CK3QZLTW.js"),"usage"),sync:e(()=>import("./sync-AQUDRXHM.js"),"sync")};for(let r of n)o[r]=i;for(let[r,t]of Object.entries(dr)){let a,C={enumerable:!0,get:e(()=>(a??=t(),a),"get")};for(let E of n)Object.defineProperty(o,`${E}/${r}`,C)}export{o as VIRTUAL_MODULES};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- var o=Object.defineProperty;var r=(i,t)=>o(i,"name",{value:t,configurable:!0});import{createRequire as p}from"node:module";const a=p(import.meta.url);import{configureHttpDispatcher as m,main as e}from"./chunks/chunk-RKLUP6JT.js";import"./chunks/chunk-R7FBN5UP.js";import"./chunks/chunk-3ZHZINH3.js";import"./chunks/chunk-3YGHTGYM.js";import"./chunks/chunk-356BFRU3.js";import"./chunks/chunk-SE42OS3U.js";import"./chunks/chunk-K7VBBYTT.js";import"./chunks/chunk-EH7SFF47.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME as s}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-XRF4A4KI.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-K4B5ABCQ.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-SCYK4XNE.js";import"./chunks/chunk-JXWJOIH4.js";function n(){process.title=s,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),m()}r(n,"setupCli"),n(),e(process.argv.slice(2));
2
+ var o=Object.defineProperty;var r=(i,t)=>o(i,"name",{value:t,configurable:!0});import{createRequire as p}from"node:module";const a=p(import.meta.url);import{configureHttpDispatcher as m,main as e}from"./chunks/chunk-6U37J6E7.js";import"./chunks/chunk-YDOF6JVP.js";import"./chunks/chunk-5TGFM4KW.js";import"./chunks/chunk-3YGHTGYM.js";import"./chunks/chunk-D3HKK2ZD.js";import"./chunks/chunk-SE42OS3U.js";import"./chunks/chunk-F5SIUTR7.js";import"./chunks/chunk-AL3DFAIM.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME as s}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-SNBVCTMQ.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-2XX4WZT6.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-44EXLOHK.js";import"./chunks/chunk-JXWJOIH4.js";function n(){process.title=s,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),m()}r(n,"setupCli"),n(),e(process.argv.slice(2));
@@ -1 +1 @@
1
- import{createRequire as e}from"node:module";const cn=e(import.meta.url);import{DAL_HOOK_ENTRY_TYPE as o,DAL_HOOK_NOTIFICATION_CHANNEL as t,STALE_AFTER_MS as r,ShowImagesSelectorComponent as n,ThemeSelectorComponent as i,WORKSPACE_LOCK_DIR_NAME as a,WORKSPACE_LOCK_FILE as s,buildDalHookInput as l,claimWorkspace as c,dalHookActivity as m,dalHooksExtension as p,decideDalHooks as d,defaultWorkspaceLockDir as E,engineToolInput as S,formatDalHookActivity as T,gitDirOf as u,hookToolInput as g,hookToolName as C,isDalHookActivity as R,readWorkspaceLock as _,releaseWorkspace as D,reportDalHookProblems as A,runDalCommandHook as h,runDalHookEvent as k,runDalHooks as P,runNotificationHooks as L,runPostToolUseHooks as O,runPreToolUseHooks as H,runSessionStartHooks as I,runStopHooks as f,runUserPromptSubmitHooks as M,selectDalHooks as N,shellCommandDirectory as F,toolMatchNames as y,workspaceLockIsLive as x,workspaceLockPath as v,workspaceOwnerSessionId as U}from"./chunks/chunk-L3RBW36Y.js";import{ADAPTATION_FILE as b,AgentSession as B,AgentSessionRuntime as w,AssistantMessageComponent as K,BackgroundProcessManager as W,BashExecutionComponent as j,BorderedLoader as V,BranchSummaryMessageComponent as G,CURRENT_SESSION_VERSION as z,CompactionSummaryMessageComponent as X,CustomEditor as q,CustomMessageComponent as Y,DEFAULT_COMPACTION_SETTINGS as J,DefaultPackageManager as Q,DefaultResourceLoader as Z,DynamicBorder as $,ENGINE_MARKET_CACHE_FILE as ee,ExtensionEditorComponent as oe,ExtensionFatalError as te,ExtensionInputComponent as re,ExtensionRunner as ne,ExtensionSelectorComponent as ie,FooterComponent as ae,HOST_CAPABILITIES_ENV as se,HOST_TOKEN_ENV as le,HOST_TOKEN_HEADER as ce,HOST_URL_ENV as me,HostCallError as pe,HostCapabilities as de,InteractiveMode as Ee,LoginDialogComponent as Se,MARKET_SECTIONS as Te,MAX_BACKGROUND_PROCESSES as ue,ModelRegistry as ge,ModelSelectorComponent as Ce,OAuthSelectorComponent as Re,PROTECTED_WRITE_NAMES as _e,REQUIRED_EXTENSION_FAILED as De,RequiredExtensionError as Ae,RpcClient as he,RpcCommandError as ke,SANDBOX_ENV as Pe,SessionManager as Le,SessionSelectorComponent as Oe,SettingsManager as He,SettingsSelectorComponent as Ie,ShellSandbox as fe,SkillInvocationMessageComponent as Me,ThinkingSelectorComponent as Ne,ToolExecutionComponent as Fe,TreeSelectorComponent as ye,UserMessageComponent as xe,UserMessageSelectorComponent as ve,adaptPackage as Ue,adaptationState as be,agentLogPath as Be,appendAgentLog as we,applyCommunityEnv as Ke,buildContextEntries as We,buildProjectMap as je,buildRuleSet as Ve,buildSessionContext as Ge,buildSessionProjection as ze,calculateContextTokens as Xe,collectEntriesForBranchSummary as qe,communityEnv as Ye,compact as Je,convertToLlm as Qe,convertToPng as Ze,copyToClipboard as $e,createAgentSession as eo,createAgentSessionFromServices as oo,createAgentSessionRuntime as to,createAgentSessionServices as ro,createBashTool as no,createBashToolDefinition as io,createCodemodeExtension as ao,createCodingTools as so,createEditTool as lo,createEditToolDefinition as co,createEventBus as mo,createExtensionRuntime as po,createFindTool as Eo,createFindToolDefinition as So,createGrepTool as To,createGrepToolDefinition as uo,createLocalBashOperations as go,createLocalPowerShellOperations as Co,createLsTool as Ro,createLsToolDefinition as _o,createMcpExtension as Do,createPowerShellTool as Ao,createPowerShellToolDefinition as ho,createProcessToolDefinition as ko,createReadOnlyTools as Po,createReadTool as Lo,createReadToolDefinition as Oo,createSyntheticSourceInfo as Ho,createToolSearchExtension as Io,createWriteTool as fo,createWriteToolDefinition as Mo,defineTool as No,describeProjectFacts as Fo,detectProjectFacts as yo,detectSandboxAvailability as xo,detectSupportedImageMimeTypeFromFile as vo,discoverAndLoadExtensions as Uo,ensurePackageAdapted as bo,estimateTokens as Bo,evaluateToolPolicy as wo,expandTempDirVariable as Ko,fetchSignedMarket as Wo,findCutPoint as jo,findTurnStartIndex as Vo,formatDimensionNote as Go,formatProjectMapPrompt as zo,formatSkillsForPrompt as Xo,generateBranchSummary as qo,generateDiffString as Yo,generateSummary as Jo,generateSummaryWithUsage as Qo,generateUnifiedPatch as Zo,getHostCapabilities as $o,getLastAssistantUsage as et,getLatestCompactionEntry as ot,getProcessShellSandbox as tt,getToolDenial as rt,isAdaptablePackage as nt,isBashToolResult as it,isEditToolResult as at,isFatalExtensionError as st,isFindToolResult as lt,isGrepToolResult as ct,isHostExtensionPath as mt,isLsToolResult as pt,isPowerShellToolResult as dt,isReadOnlyBashCommand as Et,isReadToolResult as St,isToolCallEventType as Tt,isWriteToolResult as ut,loadMcpRuntime as gt,loadProjectContextFiles as Ct,loadSkills as Rt,loadSkillsFromDir as _t,main as Dt,markHostExtensionPaths as At,marketCacheDir as ht,matchPermissionRules as kt,migrateSessionEntries as Pt,normalizeForFuzzyMatch as Lt,parseArgs as Ot,parseFrontmatter as Ht,parseHostCapabilities as It,parsePermissionRule as ft,parseSessionEntries as Mt,parseSkillBlock as Nt,prepareBranchEntries as Ft,projectPackageManager as yt,readAccessDenial as xt,readAdaptation as vt,readSignedSection as Ut,registerPermissionAskHandler as bt,registerSandboxEscalationHandler as Bt,registerShellExecutionGuard as wt,renderDiff as Kt,resizeImage as Wt,resolveCliModel as jt,resolveMarketEndpoint as Vt,resolveModelScopeWithDiagnostics as Gt,resolveSandboxPolicy as zt,resolveToCwd as Xt,runPrintMode as qt,runRpcMode as Yt,scanHardcodedPiPaths as Jt,serializeConversation as Qt,sessionEntryToContextMessages as Zt,shellExecutionRefusal as $t,shouldCompact as er,simpleCommands as or,stripFrontmatter as tr,systemTempDirs as rr,tryEnsurePackageAdapted as nr,unwrapCommand as ir,verifyAdaptation as ar,verifySignedSection as sr,withFileMutationQueue as lr,wrapRegisteredTool as cr,wrapRegisteredTools as mr}from"./chunks/chunk-RKLUP6JT.js";import{CredentialSynchronizationError as pr,DALCODE_PROJECT_DIR_NAME as dr,DEFAULT_HOOK_TIMEOUT_SECONDS as Er,ModelRuntime as Sr,PROJECT_HOOKS_FILE_ENV as Tr,ProjectTrustStore as ur,TRUST_REQUIRING_PROJECT_HOOK_FILES as gr,VIRTUAL_MODEL_STATE_ENTRY as Cr,dalHookSourceFiles as Rr,deriveHookName as _r,hasTrustRequiringProjectResources as Dr,loadDalHooks as Ar,openBrowser as hr,projectFileDeclaresHooks as kr,projectHooksFileFromEnv as Pr}from"./chunks/chunk-R7FBN5UP.js";import{formatReadLineRange as Lr,truncateToVisualLines as Or}from"./chunks/chunk-3ZHZINH3.js";import"./chunks/chunk-3YGHTGYM.js";import{readStoredCredential as Hr}from"./chunks/chunk-356BFRU3.js";import{DEFAULT_MAX_BYTES as Ir,DEFAULT_MAX_LINES as fr,DEFAULT_SHELL_ENV_EXCLUDES as Mr,applyShellEnvironmentPolicy as Nr,formatSize as Fr,getPowerShellConfig as yr,getShellConfig as xr,getShellEnv as vr,isDalCodeCredentialName as Ur,truncateHead as br,truncateLine as Br,truncateTail as wr,withoutDalCodeCredentials as Kr}from"./chunks/chunk-SE42OS3U.js";import{ArminComponent as Wr}from"./chunks/chunk-K7VBBYTT.js";import{Theme as jr,getLanguageFromPath as Vr,getMarkdownTheme as Gr,getSelectListTheme as zr,getSettingsListTheme as Xr,highlightCode as qr,initTheme as Yr,keyHint as Jr,keyText as Qr,rawKeyHint as Zr}from"./chunks/chunk-EH7SFF47.js";import"./chunks/chunk-6QGV3IWD.js";import{CONFIG_DIR_NAME as $r,SHARED_SKILL_CONFIG_DIRS as en,VERSION as on,getAgentDir as tn,getDocsPath as rn,getExamplesPath as nn,getPackageDir as an,getReadmePath as sn}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-XRF4A4KI.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-K4B5ABCQ.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-SCYK4XNE.js";import"./chunks/chunk-JXWJOIH4.js";export{b as ADAPTATION_FILE,B as AgentSession,w as AgentSessionRuntime,Wr as ArminComponent,K as AssistantMessageComponent,W as BackgroundProcessManager,j as BashExecutionComponent,V as BorderedLoader,G as BranchSummaryMessageComponent,$r as CONFIG_DIR_NAME,z as CURRENT_SESSION_VERSION,X as CompactionSummaryMessageComponent,pr as CredentialSynchronizationError,q as CustomEditor,Y as CustomMessageComponent,dr as DALCODE_PROJECT_DIR_NAME,o as DAL_HOOK_ENTRY_TYPE,t as DAL_HOOK_NOTIFICATION_CHANNEL,J as DEFAULT_COMPACTION_SETTINGS,Er as DEFAULT_HOOK_TIMEOUT_SECONDS,Ir as DEFAULT_MAX_BYTES,fr as DEFAULT_MAX_LINES,Mr as DEFAULT_SHELL_ENV_EXCLUDES,Q as DefaultPackageManager,Z as DefaultResourceLoader,$ as DynamicBorder,ee as ENGINE_MARKET_CACHE_FILE,oe as ExtensionEditorComponent,te as ExtensionFatalError,re as ExtensionInputComponent,ne as ExtensionRunner,ie as ExtensionSelectorComponent,ae as FooterComponent,se as HOST_CAPABILITIES_ENV,le as HOST_TOKEN_ENV,ce as HOST_TOKEN_HEADER,me as HOST_URL_ENV,pe as HostCallError,de as HostCapabilities,Ee as InteractiveMode,Se as LoginDialogComponent,Te as MARKET_SECTIONS,ue as MAX_BACKGROUND_PROCESSES,ge as ModelRegistry,Sr as ModelRuntime,Ce as ModelSelectorComponent,Re as OAuthSelectorComponent,Tr as PROJECT_HOOKS_FILE_ENV,_e as PROTECTED_WRITE_NAMES,ur as ProjectTrustStore,De as REQUIRED_EXTENSION_FAILED,Ae as RequiredExtensionError,he as RpcClient,ke as RpcCommandError,Pe as SANDBOX_ENV,en as SHARED_SKILL_CONFIG_DIRS,r as STALE_AFTER_MS,Le as SessionManager,Oe as SessionSelectorComponent,He as SettingsManager,Ie as SettingsSelectorComponent,fe as ShellSandbox,n as ShowImagesSelectorComponent,Me as SkillInvocationMessageComponent,gr as TRUST_REQUIRING_PROJECT_HOOK_FILES,jr as Theme,i as ThemeSelectorComponent,Ne as ThinkingSelectorComponent,Fe as ToolExecutionComponent,ye as TreeSelectorComponent,xe as UserMessageComponent,ve as UserMessageSelectorComponent,on as VERSION,Cr as VIRTUAL_MODEL_STATE_ENTRY,a as WORKSPACE_LOCK_DIR_NAME,s as WORKSPACE_LOCK_FILE,Ue as adaptPackage,be as adaptationState,Be as agentLogPath,we as appendAgentLog,Ke as applyCommunityEnv,Nr as applyShellEnvironmentPolicy,We as buildContextEntries,l as buildDalHookInput,je as buildProjectMap,Ve as buildRuleSet,Ge as buildSessionContext,ze as buildSessionProjection,Xe as calculateContextTokens,c as claimWorkspace,qe as collectEntriesForBranchSummary,Ye as communityEnv,Je as compact,Qe as convertToLlm,Ze as convertToPng,$e as copyToClipboard,eo as createAgentSession,oo as createAgentSessionFromServices,to as createAgentSessionRuntime,ro as createAgentSessionServices,no as createBashTool,io as createBashToolDefinition,ao as createCodemodeExtension,so as createCodingTools,lo as createEditTool,co as createEditToolDefinition,mo as createEventBus,po as createExtensionRuntime,Eo as createFindTool,So as createFindToolDefinition,To as createGrepTool,uo as createGrepToolDefinition,go as createLocalBashOperations,Co as createLocalPowerShellOperations,Ro as createLsTool,_o as createLsToolDefinition,Do as createMcpExtension,Ao as createPowerShellTool,ho as createPowerShellToolDefinition,ko as createProcessToolDefinition,Po as createReadOnlyTools,Lo as createReadTool,Oo as createReadToolDefinition,Ho as createSyntheticSourceInfo,Io as createToolSearchExtension,fo as createWriteTool,Mo as createWriteToolDefinition,m as dalHookActivity,Rr as dalHookSourceFiles,p as dalHooksExtension,d as decideDalHooks,E as defaultWorkspaceLockDir,No as defineTool,_r as deriveHookName,Fo as describeProjectFacts,yo as detectProjectFacts,xo as detectSandboxAvailability,vo as detectSupportedImageMimeTypeFromFile,Uo as discoverAndLoadExtensions,S as engineToolInput,bo as ensurePackageAdapted,Bo as estimateTokens,wo as evaluateToolPolicy,Ko as expandTempDirVariable,Wo as fetchSignedMarket,jo as findCutPoint,Vo as findTurnStartIndex,T as formatDalHookActivity,Go as formatDimensionNote,zo as formatProjectMapPrompt,Lr as formatReadLineRange,Fr as formatSize,Xo as formatSkillsForPrompt,qo as generateBranchSummary,Yo as generateDiffString,Jo as generateSummary,Qo as generateSummaryWithUsage,Zo as generateUnifiedPatch,tn as getAgentDir,rn as getDocsPath,nn as getExamplesPath,$o as getHostCapabilities,Vr as getLanguageFromPath,et as getLastAssistantUsage,ot as getLatestCompactionEntry,Gr as getMarkdownTheme,an as getPackageDir,yr as getPowerShellConfig,tt as getProcessShellSandbox,sn as getReadmePath,zr as getSelectListTheme,Xr as getSettingsListTheme,xr as getShellConfig,vr as getShellEnv,rt as getToolDenial,u as gitDirOf,Dr as hasTrustRequiringProjectResources,qr as highlightCode,g as hookToolInput,C as hookToolName,Yr as initTheme,nt as isAdaptablePackage,it as isBashToolResult,Ur as isDalCodeCredentialName,R as isDalHookActivity,at as isEditToolResult,st as isFatalExtensionError,lt as isFindToolResult,ct as isGrepToolResult,mt as isHostExtensionPath,pt as isLsToolResult,dt as isPowerShellToolResult,Et as isReadOnlyBashCommand,St as isReadToolResult,Tt as isToolCallEventType,ut as isWriteToolResult,Jr as keyHint,Qr as keyText,Ar as loadDalHooks,gt as loadMcpRuntime,Ct as loadProjectContextFiles,Rt as loadSkills,_t as loadSkillsFromDir,Dt as main,At as markHostExtensionPaths,ht as marketCacheDir,kt as matchPermissionRules,Pt as migrateSessionEntries,Lt as normalizeForFuzzyMatch,hr as openBrowser,Ot as parseArgs,Ht as parseFrontmatter,It as parseHostCapabilities,ft as parsePermissionRule,Mt as parseSessionEntries,Nt as parseSkillBlock,Ft as prepareBranchEntries,kr as projectFileDeclaresHooks,Pr as projectHooksFileFromEnv,yt as projectPackageManager,Zr as rawKeyHint,xt as readAccessDenial,vt as readAdaptation,Ut as readSignedSection,Hr as readStoredCredential,_ as readWorkspaceLock,bt as registerPermissionAskHandler,Bt as registerSandboxEscalationHandler,wt as registerShellExecutionGuard,D as releaseWorkspace,Kt as renderDiff,A as reportDalHookProblems,Wt as resizeImage,jt as resolveCliModel,Vt as resolveMarketEndpoint,Gt as resolveModelScopeWithDiagnostics,zt as resolveSandboxPolicy,Xt as resolveToCwd,h as runDalCommandHook,k as runDalHookEvent,P as runDalHooks,L as runNotificationHooks,O as runPostToolUseHooks,H as runPreToolUseHooks,qt as runPrintMode,Yt as runRpcMode,I as runSessionStartHooks,f as runStopHooks,M as runUserPromptSubmitHooks,Jt as scanHardcodedPiPaths,N as selectDalHooks,Qt as serializeConversation,Zt as sessionEntryToContextMessages,F as shellCommandDirectory,$t as shellExecutionRefusal,er as shouldCompact,or as simpleCommands,tr as stripFrontmatter,rr as systemTempDirs,y as toolMatchNames,br as truncateHead,Br as truncateLine,wr as truncateTail,Or as truncateToVisualLines,nr as tryEnsurePackageAdapted,ir as unwrapCommand,ar as verifyAdaptation,sr as verifySignedSection,lr as withFileMutationQueue,Kr as withoutDalCodeCredentials,x as workspaceLockIsLive,v as workspaceLockPath,U as workspaceOwnerSessionId,cr as wrapRegisteredTool,mr as wrapRegisteredTools};
1
+ import{createRequire as e}from"node:module";const cn=e(import.meta.url);import{DAL_HOOK_ENTRY_TYPE as o,DAL_HOOK_NOTIFICATION_CHANNEL as t,STALE_AFTER_MS as r,ShowImagesSelectorComponent as n,ThemeSelectorComponent as i,WORKSPACE_LOCK_DIR_NAME as a,WORKSPACE_LOCK_FILE as s,buildDalHookInput as l,claimWorkspace as c,dalHookActivity as m,dalHooksExtension as p,decideDalHooks as d,defaultWorkspaceLockDir as E,engineToolInput as S,formatDalHookActivity as T,gitDirOf as u,hookToolInput as g,hookToolName as C,isDalHookActivity as R,readWorkspaceLock as _,releaseWorkspace as D,reportDalHookProblems as A,runDalCommandHook as h,runDalHookEvent as k,runDalHooks as P,runNotificationHooks as L,runPostToolUseHooks as O,runPreToolUseHooks as H,runSessionStartHooks as I,runStopHooks as f,runUserPromptSubmitHooks as M,selectDalHooks as N,shellCommandDirectory as F,toolMatchNames as y,workspaceLockIsLive as x,workspaceLockPath as v,workspaceOwnerSessionId as U}from"./chunks/chunk-NMU45EFT.js";import{ADAPTATION_FILE as b,AgentSession as B,AgentSessionRuntime as w,AssistantMessageComponent as K,BackgroundProcessManager as W,BashExecutionComponent as j,BorderedLoader as V,BranchSummaryMessageComponent as G,CURRENT_SESSION_VERSION as z,CompactionSummaryMessageComponent as X,CustomEditor as q,CustomMessageComponent as Y,DEFAULT_COMPACTION_SETTINGS as J,DefaultPackageManager as Q,DefaultResourceLoader as Z,DynamicBorder as $,ENGINE_MARKET_CACHE_FILE as ee,ExtensionEditorComponent as oe,ExtensionFatalError as te,ExtensionInputComponent as re,ExtensionRunner as ne,ExtensionSelectorComponent as ie,FooterComponent as ae,HOST_CAPABILITIES_ENV as se,HOST_TOKEN_ENV as le,HOST_TOKEN_HEADER as ce,HOST_URL_ENV as me,HostCallError as pe,HostCapabilities as de,InteractiveMode as Ee,LoginDialogComponent as Se,MARKET_SECTIONS as Te,MAX_BACKGROUND_PROCESSES as ue,ModelRegistry as ge,ModelSelectorComponent as Ce,OAuthSelectorComponent as Re,PROTECTED_WRITE_NAMES as _e,REQUIRED_EXTENSION_FAILED as De,RequiredExtensionError as Ae,RpcClient as he,RpcCommandError as ke,SANDBOX_ENV as Pe,SessionManager as Le,SessionSelectorComponent as Oe,SettingsManager as He,SettingsSelectorComponent as Ie,ShellSandbox as fe,SkillInvocationMessageComponent as Me,ThinkingSelectorComponent as Ne,ToolExecutionComponent as Fe,TreeSelectorComponent as ye,UserMessageComponent as xe,UserMessageSelectorComponent as ve,adaptPackage as Ue,adaptationState as be,agentLogPath as Be,appendAgentLog as we,applyCommunityEnv as Ke,buildContextEntries as We,buildProjectMap as je,buildRuleSet as Ve,buildSessionContext as Ge,buildSessionProjection as ze,calculateContextTokens as Xe,collectEntriesForBranchSummary as qe,communityEnv as Ye,compact as Je,convertToLlm as Qe,convertToPng as Ze,copyToClipboard as $e,createAgentSession as eo,createAgentSessionFromServices as oo,createAgentSessionRuntime as to,createAgentSessionServices as ro,createBashTool as no,createBashToolDefinition as io,createCodemodeExtension as ao,createCodingTools as so,createEditTool as lo,createEditToolDefinition as co,createEventBus as mo,createExtensionRuntime as po,createFindTool as Eo,createFindToolDefinition as So,createGrepTool as To,createGrepToolDefinition as uo,createLocalBashOperations as go,createLocalPowerShellOperations as Co,createLsTool as Ro,createLsToolDefinition as _o,createMcpExtension as Do,createPowerShellTool as Ao,createPowerShellToolDefinition as ho,createProcessToolDefinition as ko,createReadOnlyTools as Po,createReadTool as Lo,createReadToolDefinition as Oo,createSyntheticSourceInfo as Ho,createToolSearchExtension as Io,createWriteTool as fo,createWriteToolDefinition as Mo,defineTool as No,describeProjectFacts as Fo,detectProjectFacts as yo,detectSandboxAvailability as xo,detectSupportedImageMimeTypeFromFile as vo,discoverAndLoadExtensions as Uo,ensurePackageAdapted as bo,estimateTokens as Bo,evaluateToolPolicy as wo,expandTempDirVariable as Ko,fetchSignedMarket as Wo,findCutPoint as jo,findTurnStartIndex as Vo,formatDimensionNote as Go,formatProjectMapPrompt as zo,formatSkillsForPrompt as Xo,generateBranchSummary as qo,generateDiffString as Yo,generateSummary as Jo,generateSummaryWithUsage as Qo,generateUnifiedPatch as Zo,getHostCapabilities as $o,getLastAssistantUsage as et,getLatestCompactionEntry as ot,getProcessShellSandbox as tt,getToolDenial as rt,isAdaptablePackage as nt,isBashToolResult as it,isEditToolResult as at,isFatalExtensionError as st,isFindToolResult as lt,isGrepToolResult as ct,isHostExtensionPath as mt,isLsToolResult as pt,isPowerShellToolResult as dt,isReadOnlyBashCommand as Et,isReadToolResult as St,isToolCallEventType as Tt,isWriteToolResult as ut,loadMcpRuntime as gt,loadProjectContextFiles as Ct,loadSkills as Rt,loadSkillsFromDir as _t,main as Dt,markHostExtensionPaths as At,marketCacheDir as ht,matchPermissionRules as kt,migrateSessionEntries as Pt,normalizeForFuzzyMatch as Lt,parseArgs as Ot,parseFrontmatter as Ht,parseHostCapabilities as It,parsePermissionRule as ft,parseSessionEntries as Mt,parseSkillBlock as Nt,prepareBranchEntries as Ft,projectPackageManager as yt,readAccessDenial as xt,readAdaptation as vt,readSignedSection as Ut,registerPermissionAskHandler as bt,registerSandboxEscalationHandler as Bt,registerShellExecutionGuard as wt,renderDiff as Kt,resizeImage as Wt,resolveCliModel as jt,resolveMarketEndpoint as Vt,resolveModelScopeWithDiagnostics as Gt,resolveSandboxPolicy as zt,resolveToCwd as Xt,runPrintMode as qt,runRpcMode as Yt,scanHardcodedPiPaths as Jt,serializeConversation as Qt,sessionEntryToContextMessages as Zt,shellExecutionRefusal as $t,shouldCompact as er,simpleCommands as or,stripFrontmatter as tr,systemTempDirs as rr,tryEnsurePackageAdapted as nr,unwrapCommand as ir,verifyAdaptation as ar,verifySignedSection as sr,withFileMutationQueue as lr,wrapRegisteredTool as cr,wrapRegisteredTools as mr}from"./chunks/chunk-6U37J6E7.js";import{CredentialSynchronizationError as pr,DALCODE_PROJECT_DIR_NAME as dr,DEFAULT_HOOK_TIMEOUT_SECONDS as Er,ModelRuntime as Sr,PROJECT_HOOKS_FILE_ENV as Tr,ProjectTrustStore as ur,TRUST_REQUIRING_PROJECT_HOOK_FILES as gr,VIRTUAL_MODEL_STATE_ENTRY as Cr,dalHookSourceFiles as Rr,deriveHookName as _r,hasTrustRequiringProjectResources as Dr,loadDalHooks as Ar,openBrowser as hr,projectFileDeclaresHooks as kr,projectHooksFileFromEnv as Pr}from"./chunks/chunk-YDOF6JVP.js";import{formatReadLineRange as Lr,truncateToVisualLines as Or}from"./chunks/chunk-5TGFM4KW.js";import"./chunks/chunk-3YGHTGYM.js";import{readStoredCredential as Hr}from"./chunks/chunk-D3HKK2ZD.js";import{DEFAULT_MAX_BYTES as Ir,DEFAULT_MAX_LINES as fr,DEFAULT_SHELL_ENV_EXCLUDES as Mr,applyShellEnvironmentPolicy as Nr,formatSize as Fr,getPowerShellConfig as yr,getShellConfig as xr,getShellEnv as vr,isDalCodeCredentialName as Ur,truncateHead as br,truncateLine as Br,truncateTail as wr,withoutDalCodeCredentials as Kr}from"./chunks/chunk-SE42OS3U.js";import{ArminComponent as Wr}from"./chunks/chunk-F5SIUTR7.js";import{Theme as jr,getLanguageFromPath as Vr,getMarkdownTheme as Gr,getSelectListTheme as zr,getSettingsListTheme as Xr,highlightCode as qr,initTheme as Yr,keyHint as Jr,keyText as Qr,rawKeyHint as Zr}from"./chunks/chunk-AL3DFAIM.js";import"./chunks/chunk-6QGV3IWD.js";import{CONFIG_DIR_NAME as $r,SHARED_SKILL_CONFIG_DIRS as en,VERSION as on,getAgentDir as tn,getDocsPath as rn,getExamplesPath as nn,getPackageDir as an,getReadmePath as sn}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-SNBVCTMQ.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-2XX4WZT6.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-44EXLOHK.js";import"./chunks/chunk-JXWJOIH4.js";export{b as ADAPTATION_FILE,B as AgentSession,w as AgentSessionRuntime,Wr as ArminComponent,K as AssistantMessageComponent,W as BackgroundProcessManager,j as BashExecutionComponent,V as BorderedLoader,G as BranchSummaryMessageComponent,$r as CONFIG_DIR_NAME,z as CURRENT_SESSION_VERSION,X as CompactionSummaryMessageComponent,pr as CredentialSynchronizationError,q as CustomEditor,Y as CustomMessageComponent,dr as DALCODE_PROJECT_DIR_NAME,o as DAL_HOOK_ENTRY_TYPE,t as DAL_HOOK_NOTIFICATION_CHANNEL,J as DEFAULT_COMPACTION_SETTINGS,Er as DEFAULT_HOOK_TIMEOUT_SECONDS,Ir as DEFAULT_MAX_BYTES,fr as DEFAULT_MAX_LINES,Mr as DEFAULT_SHELL_ENV_EXCLUDES,Q as DefaultPackageManager,Z as DefaultResourceLoader,$ as DynamicBorder,ee as ENGINE_MARKET_CACHE_FILE,oe as ExtensionEditorComponent,te as ExtensionFatalError,re as ExtensionInputComponent,ne as ExtensionRunner,ie as ExtensionSelectorComponent,ae as FooterComponent,se as HOST_CAPABILITIES_ENV,le as HOST_TOKEN_ENV,ce as HOST_TOKEN_HEADER,me as HOST_URL_ENV,pe as HostCallError,de as HostCapabilities,Ee as InteractiveMode,Se as LoginDialogComponent,Te as MARKET_SECTIONS,ue as MAX_BACKGROUND_PROCESSES,ge as ModelRegistry,Sr as ModelRuntime,Ce as ModelSelectorComponent,Re as OAuthSelectorComponent,Tr as PROJECT_HOOKS_FILE_ENV,_e as PROTECTED_WRITE_NAMES,ur as ProjectTrustStore,De as REQUIRED_EXTENSION_FAILED,Ae as RequiredExtensionError,he as RpcClient,ke as RpcCommandError,Pe as SANDBOX_ENV,en as SHARED_SKILL_CONFIG_DIRS,r as STALE_AFTER_MS,Le as SessionManager,Oe as SessionSelectorComponent,He as SettingsManager,Ie as SettingsSelectorComponent,fe as ShellSandbox,n as ShowImagesSelectorComponent,Me as SkillInvocationMessageComponent,gr as TRUST_REQUIRING_PROJECT_HOOK_FILES,jr as Theme,i as ThemeSelectorComponent,Ne as ThinkingSelectorComponent,Fe as ToolExecutionComponent,ye as TreeSelectorComponent,xe as UserMessageComponent,ve as UserMessageSelectorComponent,on as VERSION,Cr as VIRTUAL_MODEL_STATE_ENTRY,a as WORKSPACE_LOCK_DIR_NAME,s as WORKSPACE_LOCK_FILE,Ue as adaptPackage,be as adaptationState,Be as agentLogPath,we as appendAgentLog,Ke as applyCommunityEnv,Nr as applyShellEnvironmentPolicy,We as buildContextEntries,l as buildDalHookInput,je as buildProjectMap,Ve as buildRuleSet,Ge as buildSessionContext,ze as buildSessionProjection,Xe as calculateContextTokens,c as claimWorkspace,qe as collectEntriesForBranchSummary,Ye as communityEnv,Je as compact,Qe as convertToLlm,Ze as convertToPng,$e as copyToClipboard,eo as createAgentSession,oo as createAgentSessionFromServices,to as createAgentSessionRuntime,ro as createAgentSessionServices,no as createBashTool,io as createBashToolDefinition,ao as createCodemodeExtension,so as createCodingTools,lo as createEditTool,co as createEditToolDefinition,mo as createEventBus,po as createExtensionRuntime,Eo as createFindTool,So as createFindToolDefinition,To as createGrepTool,uo as createGrepToolDefinition,go as createLocalBashOperations,Co as createLocalPowerShellOperations,Ro as createLsTool,_o as createLsToolDefinition,Do as createMcpExtension,Ao as createPowerShellTool,ho as createPowerShellToolDefinition,ko as createProcessToolDefinition,Po as createReadOnlyTools,Lo as createReadTool,Oo as createReadToolDefinition,Ho as createSyntheticSourceInfo,Io as createToolSearchExtension,fo as createWriteTool,Mo as createWriteToolDefinition,m as dalHookActivity,Rr as dalHookSourceFiles,p as dalHooksExtension,d as decideDalHooks,E as defaultWorkspaceLockDir,No as defineTool,_r as deriveHookName,Fo as describeProjectFacts,yo as detectProjectFacts,xo as detectSandboxAvailability,vo as detectSupportedImageMimeTypeFromFile,Uo as discoverAndLoadExtensions,S as engineToolInput,bo as ensurePackageAdapted,Bo as estimateTokens,wo as evaluateToolPolicy,Ko as expandTempDirVariable,Wo as fetchSignedMarket,jo as findCutPoint,Vo as findTurnStartIndex,T as formatDalHookActivity,Go as formatDimensionNote,zo as formatProjectMapPrompt,Lr as formatReadLineRange,Fr as formatSize,Xo as formatSkillsForPrompt,qo as generateBranchSummary,Yo as generateDiffString,Jo as generateSummary,Qo as generateSummaryWithUsage,Zo as generateUnifiedPatch,tn as getAgentDir,rn as getDocsPath,nn as getExamplesPath,$o as getHostCapabilities,Vr as getLanguageFromPath,et as getLastAssistantUsage,ot as getLatestCompactionEntry,Gr as getMarkdownTheme,an as getPackageDir,yr as getPowerShellConfig,tt as getProcessShellSandbox,sn as getReadmePath,zr as getSelectListTheme,Xr as getSettingsListTheme,xr as getShellConfig,vr as getShellEnv,rt as getToolDenial,u as gitDirOf,Dr as hasTrustRequiringProjectResources,qr as highlightCode,g as hookToolInput,C as hookToolName,Yr as initTheme,nt as isAdaptablePackage,it as isBashToolResult,Ur as isDalCodeCredentialName,R as isDalHookActivity,at as isEditToolResult,st as isFatalExtensionError,lt as isFindToolResult,ct as isGrepToolResult,mt as isHostExtensionPath,pt as isLsToolResult,dt as isPowerShellToolResult,Et as isReadOnlyBashCommand,St as isReadToolResult,Tt as isToolCallEventType,ut as isWriteToolResult,Jr as keyHint,Qr as keyText,Ar as loadDalHooks,gt as loadMcpRuntime,Ct as loadProjectContextFiles,Rt as loadSkills,_t as loadSkillsFromDir,Dt as main,At as markHostExtensionPaths,ht as marketCacheDir,kt as matchPermissionRules,Pt as migrateSessionEntries,Lt as normalizeForFuzzyMatch,hr as openBrowser,Ot as parseArgs,Ht as parseFrontmatter,It as parseHostCapabilities,ft as parsePermissionRule,Mt as parseSessionEntries,Nt as parseSkillBlock,Ft as prepareBranchEntries,kr as projectFileDeclaresHooks,Pr as projectHooksFileFromEnv,yt as projectPackageManager,Zr as rawKeyHint,xt as readAccessDenial,vt as readAdaptation,Ut as readSignedSection,Hr as readStoredCredential,_ as readWorkspaceLock,bt as registerPermissionAskHandler,Bt as registerSandboxEscalationHandler,wt as registerShellExecutionGuard,D as releaseWorkspace,Kt as renderDiff,A as reportDalHookProblems,Wt as resizeImage,jt as resolveCliModel,Vt as resolveMarketEndpoint,Gt as resolveModelScopeWithDiagnostics,zt as resolveSandboxPolicy,Xt as resolveToCwd,h as runDalCommandHook,k as runDalHookEvent,P as runDalHooks,L as runNotificationHooks,O as runPostToolUseHooks,H as runPreToolUseHooks,qt as runPrintMode,Yt as runRpcMode,I as runSessionStartHooks,f as runStopHooks,M as runUserPromptSubmitHooks,Jt as scanHardcodedPiPaths,N as selectDalHooks,Qt as serializeConversation,Zt as sessionEntryToContextMessages,F as shellCommandDirectory,$t as shellExecutionRefusal,er as shouldCompact,or as simpleCommands,tr as stripFrontmatter,rr as systemTempDirs,y as toolMatchNames,br as truncateHead,Br as truncateLine,wr as truncateTail,Or as truncateToVisualLines,nr as tryEnsurePackageAdapted,ir as unwrapCommand,ar as verifyAdaptation,sr as verifySignedSection,lr as withFileMutationQueue,Kr as withoutDalCodeCredentials,x as workspaceLockIsLive,v as workspaceLockPath,U as workspaceOwnerSessionId,cr as wrapRegisteredTool,mr as wrapRegisteredTools};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as r}from"node:module";const m=r(import.meta.url);import{configureHttpDispatcher as i,main as o}from"./chunks/chunk-RKLUP6JT.js";import"./chunks/chunk-R7FBN5UP.js";import"./chunks/chunk-3ZHZINH3.js";import"./chunks/chunk-3YGHTGYM.js";import"./chunks/chunk-356BFRU3.js";import"./chunks/chunk-SE42OS3U.js";import"./chunks/chunk-K7VBBYTT.js";import"./chunks/chunk-EH7SFF47.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME as p}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-XRF4A4KI.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-K4B5ABCQ.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-SCYK4XNE.js";import"./chunks/chunk-JXWJOIH4.js";process.title=`${p}-rpc`,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),i(),o(["--mode","rpc",...process.argv.slice(2)]);
2
+ import{createRequire as r}from"node:module";const m=r(import.meta.url);import{configureHttpDispatcher as i,main as o}from"./chunks/chunk-6U37J6E7.js";import"./chunks/chunk-YDOF6JVP.js";import"./chunks/chunk-5TGFM4KW.js";import"./chunks/chunk-3YGHTGYM.js";import"./chunks/chunk-D3HKK2ZD.js";import"./chunks/chunk-SE42OS3U.js";import"./chunks/chunk-F5SIUTR7.js";import"./chunks/chunk-AL3DFAIM.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME as p}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-SNBVCTMQ.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-2XX4WZT6.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-44EXLOHK.js";import"./chunks/chunk-JXWJOIH4.js";process.title=`${p}-rpc`,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),i(),o(["--mode","rpc",...process.argv.slice(2)]);
@@ -4,6 +4,6 @@ export { ExtensionFatalError, isFatalExtensionError, REQUIRED_EXTENSION_FAILED,
4
4
  export { createExtensionRuntime, discoverAndLoadExtensions, loadExtensionFromFactory, loadExtensions, } from "./loader.ts";
5
5
  export type { ExtensionErrorListener, ForkHandler, NavigateTreeHandler, NewSessionHandler, ShutdownHandler, SwitchSessionHandler, } from "./runner.ts";
6
6
  export { ExtensionRunner } from "./runner.ts";
7
- export type { AfterProviderResponseEvent, AgentActivityOutcome, AgentBeforeSettleEvent, AgentBeforeSettleEventResult, AgentEndEvent, AgentSettledEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppendEntryHandler, AppKeybinding, ApprovalOptionKind, ApprovalPrompt, ApprovalSource, AutocompleteProviderFactory, BashToolCallEvent, BashToolResultEvent, BeforeAgentStartCustomEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeAgentStartUserEvent, BeforeProviderHeadersEvent, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BoundaryContextPreview, BoundaryResult, BoundaryState, BuildSystemPromptOptions, CacheWarmingDecisionEvent, CacheWarmingDecisionEventResult, CompactionEntryDraft, CompactOptions, ContextEditEntryDraft, ContextEvent, ContextEventResult, ContextUsage, ContextWithSystemEvent, CustomEntryDraft, CustomMessageEntryDraft, CustomToolCallEvent, CustomToolResultEvent, EditorFactory, EditToolCallEvent, EditToolResultEvent, EntryRenderer, EntryRenderOptions, ExecOptions, ExecResult, ExecuteToolOptions, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionMode, ExtensionRuntime, ExtensionShortcut, ExtensionToolContext, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionVirtualModel, ExtensionWidgetOptions, FindToolCallEvent, FindToolResultEvent, GetActiveToolsHandler, GetAllToolsHandler, GetCommandsHandler, GetThinkingLevelHandler, GetToolAllowlistHandler, GetToolDenylistHandler, GrepToolCallEvent, GrepToolResultEvent, InlineExtension, InputEvent, InputEventResult, InputSource, IsToolAllowedHandler, KeybindingHints, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, LsToolResultEvent, MarkdownMessageType, MarkdownTransformContext, MarkdownTransformer, MarkdownTransformerOptions, MarkdownTransformerRegistration, McpServersChangeEvent, MessageEndEvent, MessageEndEventResult, MessageRenderer, MessageRenderOptions, MessageStartEvent, MessageUpdateEvent, ModelPickerEntry, ModelPickerEntryState, ModelSelectEvent, ModelSelectSource, NormalizedBuildSystemPromptOptions, PowerShellToolCallEvent, PowerShellToolResultEvent, ProjectTrustContext, ProjectTrustEvent, ProjectTrustEventDecision, ProjectTrustEventResult, ProjectTrustHandler, ProviderChatModelConfig, ProviderConfig, ProviderModelConfig, ProviderStreamEvent, ReadToolCallEvent, ReadToolResultEvent, RegisteredCommand, RegisteredModelPickerEntry, RegisteredTool, ReplacedSessionContext, ResolvedCommand, ResourcesDiscoverEvent, ResourcesDiscoverResult, SendMessageHandler, SendUserMessageHandler, SessionBeforeCompactEvent, SessionBeforeCompactResult, SessionBeforeForkEvent, SessionBeforeForkResult, SessionBeforeSwitchEvent, SessionBeforeSwitchResult, SessionBeforeTreeEvent, SessionBeforeTreeResult, SessionBoundaryDraft, SessionCompactEvent, SessionCompactFailedEvent, SessionEvent, SessionInfoChangedEvent, SessionShutdownEvent, SessionStartEvent, SessionTreeEvent, SetActiveToolsHandler, SetLabelHandler, SetModelHandler, SetThinkingLevelHandler, TerminalInputHandler, ThinkingLevelSelectEvent, ToolAnnotations, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionEndEvent, ToolExecutionMode, ToolExecutionStartEvent, ToolExecutionUpdateEvent, ToolExposure, ToolInfo, ToolLoadout, ToolLoadoutChanges, ToolNamespace, ToolRendererResolver, ToolRenderers, ToolRenderResultOptions, ToolResultEvent, ToolResultEventResult, TreePreparation, TurnEndEvent, TurnEndEventResult, TurnStartEvent, UIPromptEndEvent, UIPromptKind, UIPromptStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, WriteToolResultEvent, } from "./types.ts";
7
+ export type { AfterProviderResponseEvent, AgentActivityOutcome, AgentBeforeSettleEvent, AgentBeforeSettleEventResult, AgentEndEvent, AgentSettledEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppendEntryHandler, AppKeybinding, ApprovalOptionKind, ApprovalPrompt, ApprovalSource, AutocompleteProviderFactory, BashToolCallEvent, BashToolResultEvent, BeforeAgentStartCustomEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeAgentStartUserEvent, BeforeProviderHeadersEvent, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BoundaryContextPreview, BoundaryResult, BoundaryState, BuildSystemPromptOptions, CacheWarmingDecisionEvent, CacheWarmingDecisionEventResult, CompactionEntryDraft, CompactOptions, ContextEditEntryDraft, ContextEvent, ContextEventResult, ContextUsage, ContextWithSystemEvent, CustomEntryDraft, CustomMessageEntryDraft, CustomToolCallEvent, CustomToolResultEvent, EditorFactory, EditToolCallEvent, EditToolResultEvent, EntryRenderer, EntryRenderOptions, ExecOptions, ExecResult, ExecuteToolOptions, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionMode, ExtensionPanel, ExtensionPanelLineStyle, ExtensionRuntime, ExtensionShortcut, ExtensionToolContext, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionVirtualModel, ExtensionWidgetOptions, FindToolCallEvent, FindToolResultEvent, GetActiveToolsHandler, GetAllToolsHandler, GetCommandsHandler, GetThinkingLevelHandler, GetToolAllowlistHandler, GetToolDenylistHandler, GrepToolCallEvent, GrepToolResultEvent, InlineExtension, InputEvent, InputEventResult, InputSource, IsToolAllowedHandler, KeybindingHints, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, LsToolResultEvent, MarkdownMessageType, MarkdownTransformContext, MarkdownTransformer, MarkdownTransformerOptions, MarkdownTransformerRegistration, McpServersChangeEvent, MessageEndEvent, MessageEndEventResult, MessageRenderer, MessageRenderOptions, MessageStartEvent, MessageUpdateEvent, ModelPickerEntry, ModelPickerEntryState, ModelSelectEvent, ModelSelectSource, NormalizedBuildSystemPromptOptions, PowerShellToolCallEvent, PowerShellToolResultEvent, ProjectTrustContext, ProjectTrustEvent, ProjectTrustEventDecision, ProjectTrustEventResult, ProjectTrustHandler, ProviderChatModelConfig, ProviderConfig, ProviderModelConfig, ProviderStreamEvent, ReadToolCallEvent, ReadToolResultEvent, RegisteredCommand, RegisteredModelPickerEntry, RegisteredTool, ReplacedSessionContext, ResolvedCommand, ResourcesDiscoverEvent, ResourcesDiscoverResult, SendMessageHandler, SendUserMessageHandler, SessionBeforeCompactEvent, SessionBeforeCompactResult, SessionBeforeForkEvent, SessionBeforeForkResult, SessionBeforeSwitchEvent, SessionBeforeSwitchResult, SessionBeforeTreeEvent, SessionBeforeTreeResult, SessionBoundaryDraft, SessionCompactEvent, SessionCompactFailedEvent, SessionEvent, SessionInfoChangedEvent, SessionShutdownEvent, SessionStartEvent, SessionTreeEvent, SetActiveToolsHandler, SetLabelHandler, SetModelHandler, SetThinkingLevelHandler, TerminalInputHandler, ThinkingLevelSelectEvent, ToolAnnotations, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionEndEvent, ToolExecutionMode, ToolExecutionStartEvent, ToolExecutionUpdateEvent, ToolExposure, ToolInfo, ToolLoadout, ToolLoadoutChanges, ToolNamespace, ToolRendererResolver, ToolRenderers, ToolRenderResultOptions, ToolResultEvent, ToolResultEventResult, TreePreparation, TurnEndEvent, TurnEndEventResult, TurnStartEvent, UIPromptEndEvent, UIPromptKind, UIPromptStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, WriteToolResultEvent, } from "./types.ts";
8
8
  export { defineTool, extensionPanelLines, isBashToolResult, isEditToolResult, isFindToolResult, isGrepToolResult, isLsToolResult, isPowerShellToolResult, isReadToolResult, isToolCallEventType, isWriteToolResult, resolveExtensionNotify, } from "./types.ts";
9
9
  export { wrapRegisteredTool, wrapRegisteredTools } from "./wrapper.ts";
@@ -76,11 +76,7 @@ export interface ExtensionUIContext {
76
76
  level?: "info" | "warning" | "error";
77
77
  message: string;
78
78
  }): void;
79
- setPanel(id: string, panel?: {
80
- title?: string;
81
- lines?: string[];
82
- placement?: "aux" | "status";
83
- }): void;
79
+ setPanel(id: string, panel?: ExtensionPanel): void;
84
80
  requestInput(options: {
85
81
  title: string;
86
82
  placeholder?: string;
@@ -150,6 +146,14 @@ export declare function resolveExtensionNotify(message: string | {
150
146
  message: string;
151
147
  type: "info" | "warning" | "error" | undefined;
152
148
  };
149
+ export type ExtensionPanelLineStyle = "default" | "active" | "done" | "muted";
150
+ export interface ExtensionPanel {
151
+ title?: string;
152
+ lines?: string[];
153
+ displayLines?: string[];
154
+ lineStyles?: ExtensionPanelLineStyle[];
155
+ placement?: "aux" | "status";
156
+ }
153
157
  export declare function extensionPanelLines(panel?: {
154
158
  title?: string;
155
159
  lines?: string[];
@@ -1,6 +1,6 @@
1
1
  var Le=Object.defineProperty;var s=(t,e)=>Le(t,"name",{value:e,configurable:!0});import{constants as Te}from"node:fs";import{access as Ce}from"node:fs/promises";import{constants as Pe}from"node:os";import{ToolExecutionError as ue}from"@earendil-works/pi-agent-core";import{Container as De,Text as V,truncateToWidth as ve}from"@earendil-works/pi-tui";import{spawn as Ie}from"child_process";import{Type as l}from"typebox";import{fill as Y,t as A}from"../../dal/i18n.js";import{keyHint as Ae}from"../../modes/interactive/components/keybinding-hints.js";import{truncateToVisualLines as ke}from"../../modes/interactive/components/visual-truncate.js";import{theme as E}from"../../modes/interactive/theme/theme.js";import{waitForChildProcess as Me}from"../../utils/child-process.js";import{writeOutputFile as Fe}from"../../utils/output-files.js";import{getShellConfig as ce,getShellEnv as me,killProcessTree as pe,trackDetachedChildPid as Ne,untrackDetachedChildPid as Be}from"../../utils/shell.js";import{missingManagedToolHint as Re}from"../../utils/tools-manager.js";import{describeDenialForModel as Ue}from"../sandbox/denial.js";import{getProcessShellSandbox as Ge}from"../sandbox/shell-sandbox.js";import{toolDenial as He,withToolDenial as je}from"../tool-denial.js";import{isReadOnlyBashCommand as We}from"./bash-read-only.js";import{OutputAccumulator as Ve}from"./output-accumulator.js";import{condenseShellOutput as Ye,outputCondenseDisabled as Xe}from"./output-condense.js";import{countOutputLines as Ke,formatCollapsedSummary as qe,getTextOutput as fe,invalidArgText as ze,str as he,truncateDisplay as Je}from"./render-utils.js";import{wrapToolDefinition as Qe}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as Ze,formatSize as et,SHELL_OUTPUT_MAX_CHARS as ee,truncateHeadTail as tt}from"./truncate.js";const we=2147483647,Se=1024*1024,nt=8*1024*1024,ot=we/1e3,te=12e4,ne=30;function it(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>we)throw new Error(`Invalid timeout: maximum is ${ot} seconds`);return e}s(it,"resolveTimeoutMs");const xe=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."}))}),st=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."})),rt=l.Object({...xe.properties,sandbox_escalation:st}),be={snippet:"Execute bash commands (ls, grep, find, etc.)",guidelines:["You can inspect DAL_* environment variables for current model and session details."]},at=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()});class Ee extends Error{static{s(this,"ShellTimeoutError")}shellExit;constructor(e,n){super(`timeout:${e}`),this.shellExit=n}}function dt(t,e){return{exec:s(async(n,o,{onData:u,signal:i,timeout:L,env:w,yieldTo:c})=>{const $=it(L);if(i?.aborted)throw new Error("aborted");const S=e();try{await Ce(o,Te.F_OK)}catch{throw new Error(`Working directory does not exist: ${o}
2
2
  Cannot execute ${t} commands.`)}const x=S.commandTransport==="stdin",r=Ie(S.shell,x?S.args:[...S.args,n],{cwd:o,detached:process.platform!=="win32",env:w??me(),stdio:[x?"pipe":"ignore","pipe","pipe"],windowsHide:!0});x&&(r.stdin?.on("error",()=>{}),r.stdin?.end(n)),r.pid&&Ne(r.pid);const a=performance.now();let p;r.once("exit",()=>{p=performance.now()-a});let h=!1,m=!1,f;const T=new Promise(U=>{f=s(()=>U("yielded"),"onYielded")});let R,D;const k=s(()=>{r.pid&&pe(r.pid)},"onAbort");try{$!==void 0&&(D=setTimeout(()=>{if(c&&r.exitCode===null&&r.signalCode===null&&c(r)){m=!0,f?.();return}h=!0,R=p,r.pid&&pe(r.pid)},$)),r.stdout?.on("data",u),r.stderr?.on("data",u),i&&(i.aborted?k():i.addEventListener("abort",k,{once:!0}));const U=Me(r),C=await Promise.race([U,T]);if(C==="yielded")return U.catch(()=>{}),{exitCode:null,yielded:!0};const O=C;if(i?.aborted)throw new Error("aborted");const g=r.signalCode,M=O??(g?128+(Pe.signals[g]??0):1);if(h)throw new Ee(($??te)/1e3,R!==void 0?{exitCode:M,afterSeconds:Math.round(R/100)/10}:void 0);return{exitCode:M}}finally{r.pid&&!m&&Be(r.pid),D&&clearTimeout(D),i&&i.removeEventListener("abort",k)}},"exec")}}s(dt,"createLocalShellOperations");function lt(t){return dt("bash",()=>ce(t?.shellPath))}s(lt,"createLocalBashOperations");const oe=Symbol.for("dal.shell.executionGuards"),ie=globalThis;ie[oe]instanceof Set||(ie[oe]=new Set);const se=ie[oe];function Kt(t){return se.add(t),()=>{se.delete(t)}}s(Kt,"registerShellExecutionGuard");async function ut(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}}s(ut,"shellExecutionRefusal");const ct=["SESSION_ID","SESSION_FILE","PROVIDER","MODEL","REASONING_LEVEL"];function mt(t,e,n,o,u){const i={...me()};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 c=u.sessionManager.getSessionFile();c&&(i.PI_SESSION_FILE=c),w&&(i.PI_PROVIDER=w.provider,i.PI_MODEL=w.id),u.thinkingLevel&&(i.PI_REASONING_LEVEL=u.thinkingLevel)}for(const w of ct){delete i[`DAL_${w}`];const c=i[`PI_${w}`];c!==void 0&&(i[`DAL_${w}`]=c)}const L={command:t,cwd:e,env:i};return n?n(L):L}s(mt,"resolveSpawnContext");const pt=5,ft=100;class ht extends De{static{s(this,"BashResultRenderComponent")}state={cachedWidth:void 0,cachedLines:void 0,cachedSkipped:void 0}}function wt(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`}s(wt,"formatDuration");function St(t,e,n=!1){const o=he(t?.command),u=he(t?.description)?.trim(),i="";if(u){const w=E.fg("toolTitle",E.bold(u))+i;return!n||!o?w:`${w}
3
- ${E.fg("muted",` \u23BF ${e} ${o.trim()}`)}`}const L=o===null?ze(E):o?E.fg("dim",Je(o.replace(/\s+/g," ").trim(),42)):E.fg("dim","\u2026");return`${E.fg("toolTitle",E.bold(e))} ${L}${i}`}s(St,"formatShellCall");function xt(t,e,n,o,u,i,L,w){const c=t.state;t.clear();const $=bt(n,u,i,w);if(!n.expanded&&!L){const a=fe(e,o),p=Ke(a),h=[];p>0&&h.push(Y(A("{count} \u884C"),{count:p})),$&&h.push($);const m=qe(E,h);m&&t.addChild(new V(m,0,0));return}let S=fe(e,o).trim();const x=e.details?.truncation,r=e.details?.fullOutputPath;if(!n.isPartial&&x?.truncated&&r&&S.endsWith("]")){const a=S.lastIndexOf(`
3
+ ${E.fg("muted",` ${e} ${o.trim()}`)}`}const L=o===null?ze(E):o?E.fg("dim",Je(o.replace(/\s+/g," ").trim(),42)):E.fg("dim","\u2026");return`${E.fg("toolTitle",E.bold(e))} ${L}${i}`}s(St,"formatShellCall");function xt(t,e,n,o,u,i,L,w){const c=t.state;t.clear();const $=bt(n,u,i,w);if(!n.expanded&&!L){const a=fe(e,o),p=Ke(a),h=[];p>0&&h.push(Y(A("{count} \u884C"),{count:p})),$&&h.push($);const m=qe(E,h);m&&t.addChild(new V(m,0,0));return}let S=fe(e,o).trim();const x=e.details?.truncation,r=e.details?.fullOutputPath;if(!n.isPartial&&x?.truncated&&r&&S.endsWith("]")){const a=S.lastIndexOf(`
4
4
 
5
5
  [`);a!==-1&&S.slice(a).includes(r)&&(S=S.slice(0,a).trimEnd())}if(S){const a=S.split(`
6
6
  `).map(p=>E.fg("toolOutput",p)).join(`
@@ -1,3 +1,2 @@
1
- var $=Object.defineProperty;var d=(e,t)=>$(e,"name",{value:t,configurable:!0});import{Box as b,Container as W,Spacer as x,Text as E}from"@earendil-works/pi-tui";import{constants as A}from"fs";import{access as L,readFile as k,writeFile as q}from"fs/promises";import{Type as g}from"typebox";import{renderDiff as S}from"../../modes/interactive/components/diff.js";import{splitBom as N}from"../../utils/text.js";import{applyEditsToNormalizedContent as z,applyReplacementsToOriginal as J,computeEditsDiff as M,generateEditDiff as U,normalizeToLF as G}from"./edit-diff.js";import{withFileMutationQueue as H}from"./file-mutation-queue.js";import{resolveToCwd as Q}from"./path-utils.js";import{renderToolPath as X,str as P}from"./render-utils.js";import{wrapToolDefinition as V}from"./tool-definition-wrapper.js";const Y=g.Object({oldText:g.String({description:"Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call."}),newText:g.String({description:"Replacement text for this targeted edit."})},{}),Z=g.Object({path:g.String({description:"Path to the file to edit (relative or absolute)"}),edits:g.Array(Y,{description:"One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead."})},{}),D={snippet:"Make precise file edits with exact text replacement, including multiple disjoint edits in one call",guidelines:["Use edit for targeted changes. Batch changes to one file in a single call.","Each edits[].oldText must exactly and uniquely match the original file. Keep matches short and non-overlapping; merge nearby changes without including large unchanged regions."]};function O(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.oldText=="string"&&typeof t.newText=="string"}d(O,"isSingleEditInput");const ee={readFile:d(e=>k(e),"readFile"),writeFile:d((e,t)=>q(e,t,"utf-8"),"writeFile"),access:d(e=>L(e,A.R_OK|A.W_OK),"access")};function te(e){if(!e||typeof e!="object")return e;const t=e;if(typeof t.edits=="string")try{const o=JSON.parse(t.edits);Array.isArray(o)?t.edits=o:O(o)&&(t.edits=[o])}catch{}else O(t.edits)&&(t.edits=[t.edits]);const i=t;if(typeof i.oldText!="string"||typeof i.newText!="string")return t;const r=Array.isArray(i.edits)?[...i.edits]:[];r.push({oldText:i.oldText,newText:i.newText});const{oldText:f,newText:a,...n}=i;return{...n,edits:r}}d(te,"prepareEditArguments");function re(e){if(!Array.isArray(e.edits)||e.edits.length===0)throw new Error("Edit tool input is invalid. edits must contain at least one replacement.");return{path:e.path,edits:e.edits}}d(re,"validateEditInput");function ie(){return Object.assign(new b(0,0),{preview:void 0,previewArgsKey:void 0,previewPending:!1,settledError:!1})}d(ie,"createEditCallRenderComponent");function ne(e,t){if(t instanceof b){const r=t;return e.callComponent=r,r}if(e.callComponent)return e.callComponent;const i=ie();return e.callComponent=i,i}d(ne,"getEditCallRenderComponent");function F(e){if(!e)return null;const t=typeof e.path=="string"?e.path:typeof e.file_path=="string"?e.file_path:null;return t?Array.isArray(e.edits)&&e.edits.length>0&&e.edits.every(i=>typeof i?.oldText=="string"&&typeof i?.newText=="string")?{path:t,edits:e.edits}:typeof e.oldText=="string"&&typeof e.newText=="string"?{path:t,edits:[{oldText:e.oldText,newText:e.newText}]}:null:null}d(F,"getRenderablePreviewInput");function oe(e){let t=0,i=0;for(const r of e.split(`
2
- `))r.startsWith("+")&&!r.startsWith("+++")&&t++,r.startsWith("-")&&!r.startsWith("---")&&i++;return{additions:t,removals:i}}d(oe,"diffStats");function se(e,t,i){const r=X(P(e?.file_path??e?.path),t,i);return`${t.fg("toolTitle",t.bold("edit"))} ${r}`}d(se,"formatEditCall");function de(e,t,i,r,f){const a=P(e?.file_path??e?.path),n=t&&!("error"in t)?t.diff:void 0,o=t&&"error"in t?t.error:void 0;if(f){const c=i.content.filter(l=>l.type==="text").map(l=>l.text||"").join(`
3
- `);return!c||c===o?void 0:r.fg("error",c)}const s=i.details?.diff;if(s&&s!==n)return S(s,{filePath:a??void 0})}d(de,"formatEditResult");function ae(e,t,i){return e?"error"in e?r=>i.bg("toolErrorBg",r):r=>i.bg("toolSuccessBg",r):t?r=>i.bg("toolErrorBg",r):r=>i.bg("toolPendingBg",r)}d(ae,"getEditHeaderBg");function K(e,t,i,r,f,a){e.setPaddingX(a),e.setBgFn("error"in(e.preview??{})||e.settledError?ae(e.preview,e.settledError,i):void 0),e.clear();let n=se(t,i,r);if(!f&&e.preview&&!("error"in e.preview)){const{additions:s,removals:c}=oe(e.preview.diff);n+=i.fg("muted",` +${s} / -${c}`)}if(e.addChild(new E(n,0,0)),!e.preview||!f&&!("error"in e.preview))return e;const o="error"in e.preview?i.fg("error",e.preview.error):S(e.preview.diff);return e.addChild(new x(1)),e.addChild(new E(o,0,0)),e}d(K,"buildEditCallComponent");function _(e,t,i){const r=e.preview,f=r===void 0||("error"in r&&"error"in t?r.error!==t.error:"error"in r!="error"in t)||!("error"in r)&&!("error"in t)&&(r.diff!==t.diff||r.firstChangedLine!==t.firstChangedLine);return e.preview=t,e.previewArgsKey=i,e.previewPending=!1,f}d(_,"setEditPreview");function le(e,t){const i=t?.operations??ee;return{name:"edit",label:"edit",description:"Edit a single file using exact text replacement. Every edits[].oldText must match a unique, non-overlapping region of the original file. If two changes affect the same block or nearby lines, merge them into one edit instead of emitting overlapping edits. Do not include large unchanged regions just to connect distant changes.",promptSnippet:D.snippet,promptGuidelines:[...D.guidelines],parameters:Z,constrainedSampling:{type:"json_schema",strict:"prefer"},renderShell:"self",prepareArguments:te,async execute(r,f,a,n,o){const{path:s,edits:c}=re(f),l=Q(s,o?.cwd||e);return H(l,async()=>{const p=d(()=>{if(a?.aborted)throw new Error("Operation aborted")},"throwIfAborted");p();try{await i.access(l)}catch(y){p();const B=y instanceof Error&&"code"in y?`Error code: ${y.code}`:String(y);throw new Error(`Could not edit file: ${s}. ${B}.`)}p();const w=(await i.readFile(l)).toString("utf-8");p();const{bom:u,text:m}=N(w),T=G(m),{baseContent:I,newContent:C,replacements:v}=z(T,c,s),R=U(s,I,C,v);p();const j=u+(m===T?C:J(m,v));return await i.writeFile(l,j),p(),{content:[{type:"text",text:`Successfully replaced ${c.length} block(s) in ${s}.`}],details:R}})},renderCall(r,f,a){const n=ne(a.state,a.lastComponent),o=F(r),s=o?JSON.stringify({path:o.path,edits:o.edits}):void 0;if(n.previewArgsKey!==s&&(n.preview=void 0,n.previewArgsKey=s,n.previewPending=!1,n.settledError=!1),a.argsComplete&&o&&!n.preview&&!n.previewPending){n.previewPending=!0;const c=s;M(o.path,o.edits,a.cwd).then(l=>{n.previewArgsKey===c&&(_(n,l,c),a.invalidate())})}return K(n,r,f,a.cwd,a.expanded,a.outputPad)},renderResult(r,f,a,n){const o=n.state.callComponent,s=F(n.args),c=s?JSON.stringify({path:s.path,edits:s.edits}):void 0,l=r,p=n.isError?void 0:l.details?.diff;let h=!1;o&&(typeof p=="string"&&(h=_(o,{diff:p,firstChangedLine:l.details?.firstChangedLine},c)||h),o.settledError!==n.isError&&(o.settledError=n.isError,h=!0),h&&K(o,n.args,a,n.cwd,f.expanded,n.outputPad));const w=de(n.args,o?.preview,l,a,n.isError),u=n.lastComponent??new W;return u.clear(),w&&(u.addChild(new x(1)),u.addChild(new E(w,1+n.outputPad,0))),u}}}d(le,"createEditToolDefinition");function ve(e,t){return V(le(e,t))}d(ve,"createEditTool");export{ve as createEditTool,le as createEditToolDefinition,D as editToolSystemPromptContribution};
1
+ var B=Object.defineProperty;var d=(e,t)=>B(e,"name",{value:t,configurable:!0});import{Box as E,Container as $,Spacer as x,Text as C}from"@earendil-works/pi-tui";import{constants as A}from"fs";import{access as L,readFile as k,writeFile as q}from"fs/promises";import{Type as h}from"typebox";import{DiffView as S,diffLineCounts as N,formatDiffLineCounts as z}from"../../modes/interactive/components/diff.js";import{splitBom as J}from"../../utils/text.js";import{applyEditsToNormalizedContent as M,applyReplacementsToOriginal as U,computeEditsDiff as W,generateEditDiff as G,normalizeToLF as H}from"./edit-diff.js";import{withFileMutationQueue as Q}from"./file-mutation-queue.js";import{resolveToCwd as V}from"./path-utils.js";import{renderToolPath as X,str as Y}from"./render-utils.js";import{wrapToolDefinition as Z}from"./tool-definition-wrapper.js";const ee=h.Object({oldText:h.String({description:"Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call."}),newText:h.String({description:"Replacement text for this targeted edit."})},{}),te=h.Object({path:h.String({description:"Path to the file to edit (relative or absolute)"}),edits:h.Array(ee,{description:"One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead."})},{}),P={snippet:"Make precise file edits with exact text replacement, including multiple disjoint edits in one call",guidelines:["Use edit for targeted changes. Batch changes to one file in a single call.","Each edits[].oldText must exactly and uniquely match the original file. Keep matches short and non-overlapping; merge nearby changes without including large unchanged regions."]};function D(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.oldText=="string"&&typeof t.newText=="string"}d(D,"isSingleEditInput");const re={readFile:d(e=>k(e),"readFile"),writeFile:d((e,t)=>q(e,t,"utf-8"),"writeFile"),access:d(e=>L(e,A.R_OK|A.W_OK),"access")};function ie(e){if(!e||typeof e!="object")return e;const t=e;if(typeof t.edits=="string")try{const o=JSON.parse(t.edits);Array.isArray(o)?t.edits=o:D(o)&&(t.edits=[o])}catch{}else D(t.edits)&&(t.edits=[t.edits]);const r=t;if(typeof r.oldText!="string"||typeof r.newText!="string")return t;const i=Array.isArray(r.edits)?[...r.edits]:[];i.push({oldText:r.oldText,newText:r.newText});const{oldText:l,newText:s,...n}=r;return{...n,edits:i}}d(ie,"prepareEditArguments");function ne(e){if(!Array.isArray(e.edits)||e.edits.length===0)throw new Error("Edit tool input is invalid. edits must contain at least one replacement.");return{path:e.path,edits:e.edits}}d(ne,"validateEditInput");function oe(){return Object.assign(new E(0,0),{preview:void 0,previewArgsKey:void 0,previewPending:!1,settledError:!1})}d(oe,"createEditCallRenderComponent");function se(e,t){if(t instanceof E){const i=t;return e.callComponent=i,i}if(e.callComponent)return e.callComponent;const r=oe();return e.callComponent=r,r}d(se,"getEditCallRenderComponent");function O(e){if(!e)return null;const t=typeof e.path=="string"?e.path:typeof e.file_path=="string"?e.file_path:null;return t?Array.isArray(e.edits)&&e.edits.length>0&&e.edits.every(r=>typeof r?.oldText=="string"&&typeof r?.newText=="string")?{path:t,edits:e.edits}:typeof e.oldText=="string"&&typeof e.newText=="string"?{path:t,edits:[{oldText:e.oldText,newText:e.newText}]}:null:null}d(O,"getRenderablePreviewInput");function de(e,t,r){const i=X(Y(e?.file_path??e?.path),t,r);return`${t.fg("toolTitle",t.bold("edit"))} ${i}`}d(de,"formatEditCall");function ae(e,t,r,i,l){const s=t&&!("error"in t)?t.diff:void 0,n=t&&"error"in t?t.error:void 0;if(l){const a=r.content.filter(f=>f.type==="text").map(f=>f.text||"").join(`
2
+ `);return!a||a===n?void 0:new C(i.fg("error",a),0,0)}const o=r.details?.diff;if(o&&o!==s)return new S(o)}d(ae,"formatEditResult");function le(e,t,r){return e?"error"in e?i=>r.bg("toolErrorBg",i):i=>r.bg("toolSuccessBg",i):t?i=>r.bg("toolErrorBg",i):i=>r.bg("toolPendingBg",i)}d(le,"getEditHeaderBg");function F(e,t,r,i,l,s){e.setPaddingX(s),e.setBgFn("error"in(e.preview??{})||e.settledError?le(e.preview,e.settledError,r):void 0),e.clear();let n=de(t,r,i);if(!l&&e.preview&&!("error"in e.preview)){const o=z(N(e.preview.diff));o&&(n+=r.fg("muted",` ${o}`))}return e.addChild(new C(n,0,0)),!e.preview||!l&&!("error"in e.preview)||(e.addChild(new x(1)),e.addChild("error"in e.preview?new C(r.fg("error",e.preview.error),0,0):new S(e.preview.diff))),e}d(F,"buildEditCallComponent");function K(e,t,r){const i=e.preview,l=i===void 0||("error"in i&&"error"in t?i.error!==t.error:"error"in i!="error"in t)||!("error"in i)&&!("error"in t)&&(i.diff!==t.diff||i.firstChangedLine!==t.firstChangedLine);return e.preview=t,e.previewArgsKey=r,e.previewPending=!1,l}d(K,"setEditPreview");function fe(e,t){const r=t?.operations??re;return{name:"edit",label:"edit",description:"Edit a single file using exact text replacement. Every edits[].oldText must match a unique, non-overlapping region of the original file. If two changes affect the same block or nearby lines, merge them into one edit instead of emitting overlapping edits. Do not include large unchanged regions just to connect distant changes.",promptSnippet:P.snippet,promptGuidelines:[...P.guidelines],parameters:te,constrainedSampling:{type:"json_schema",strict:"prefer"},renderShell:"self",prepareArguments:ie,async execute(i,l,s,n,o){const{path:a,edits:f}=ne(l),c=V(a,o?.cwd||e);return Q(c,async()=>{const p=d(()=>{if(s?.aborted)throw new Error("Operation aborted")},"throwIfAborted");p();try{await r.access(c)}catch(m){p();const j=m instanceof Error&&"code"in m?`Error code: ${m.code}`:String(m);throw new Error(`Could not edit file: ${a}. ${j}.`)}p();const y=(await r.readFile(c)).toString("utf-8");p();const{bom:u,text:g}=J(y),T=H(g),{baseContent:_,newContent:b,replacements:v}=M(T,f,a),I=G(a,_,b,v);p();const R=u+(g===T?b:U(g,v));return await r.writeFile(c,R),p(),{content:[{type:"text",text:`Successfully replaced ${f.length} block(s) in ${a}.`}],details:I}})},renderCall(i,l,s){const n=se(s.state,s.lastComponent),o=O(i),a=o?JSON.stringify({path:o.path,edits:o.edits}):void 0;if(n.previewArgsKey!==a&&(n.preview=void 0,n.previewArgsKey=a,n.previewPending=!1,n.settledError=!1),s.argsComplete&&o&&!n.preview&&!n.previewPending){n.previewPending=!0;const f=a;W(o.path,o.edits,s.cwd).then(c=>{n.previewArgsKey===f&&(K(n,c,f),s.invalidate())})}return F(n,i,l,s.cwd,s.expanded,s.outputPad)},renderResult(i,l,s,n){const o=n.state.callComponent,a=O(n.args),f=a?JSON.stringify({path:a.path,edits:a.edits}):void 0,c=i,p=n.isError?void 0:c.details?.diff;let w=!1;o&&(typeof p=="string"&&(w=K(o,{diff:p,firstChangedLine:c.details?.firstChangedLine},f)||w),o.settledError!==n.isError&&(o.settledError=n.isError,w=!0),w&&F(o,n.args,s,n.cwd,l.expanded,n.outputPad));const y=ae(n.args,o?.preview,c,s,n.isError),u=n.lastComponent??new $;if(u.clear(),!y)return u;u.addChild(new x(1));const g=new E(1+n.outputPad,0);return g.addChild(y),u.addChild(g),u}}}d(fe,"createEditToolDefinition");function ve(e,t){return Z(fe(e,t))}d(ve,"createEditTool");export{ve as createEditTool,fe as createEditToolDefinition,P as editToolSystemPromptContribution};
@@ -1,5 +1,5 @@
1
1
  var S=Object.defineProperty;var c=(n,i)=>S(n,"name",{value:i,configurable:!0});import{Container as A,Spacer as C,Text as p}from"@earendil-works/pi-tui";import{fill as $,t as f}from"../../../dal/i18n.js";import{keyHint as v}from"../../../modes/interactive/components/keybinding-hints.js";import{VisualLinePreview as P}from"../../../modes/interactive/components/visual-truncate.js";import{theme as d}from"../../../modes/interactive/theme/theme.js";import{getTextOutput as E,invalidArgText as x,str as w}from"../render-utils.js";import{DEFAULT_MAX_BYTES as _,formatSize as L}from"../truncate.js";const O=5,k=100;function g(n){const i=n/1e3;if(i<60)return`${i.toFixed(1)}s`;const r=Math.floor(i),e=Math.floor(r/60),t=r%60;return e<60?`${e}m ${t}s`:`${Math.floor(e/60)}h ${e%60}m ${t}s`}c(g,"formatDuration");function D(n,i,r){const e=w(n?.command),t=w(n?.description)?.trim(),a="",l=e===null?x(d):e||d.fg("toolOutput","...");if(!t)return d.fg("toolTitle",d.bold(`${i} ${l}`))+a;const o=d.fg("toolTitle",d.bold(t))+a;return r?`${o}
2
- ${d.fg("muted",` \u23BF ${i} ${e??""}`.trimEnd())}`:o}c(D,"formatShellCall");function B(n,i,r,e,t,a,l){n.clear();let o=E(i,e).trim();const u=i.details?.truncation,h=i.details?.fullOutputPath;if(!r.isPartial&&u?.truncated&&h&&o.endsWith("]")){const s=o.lastIndexOf(`
2
+ ${d.fg("muted",` ${i} ${e??""}`.trimEnd())}`:o}c(D,"formatShellCall");function B(n,i,r,e,t,a,l){n.clear();let o=E(i,e).trim();const u=i.details?.truncation,h=i.details?.fullOutputPath;if(!r.isPartial&&u?.truncated&&h&&o.endsWith("]")){const s=o.lastIndexOf(`
3
3
 
4
4
  [`);s!==-1&&o.slice(s).includes(h)&&(o=o.slice(0,s).trimEnd())}if(o){const s=o.split(`
5
5
  `).map(m=>d.fg("toolOutput",m)).join(`
@@ -1,2 +1,2 @@
1
- var P=Object.defineProperty;var f=(e,i)=>P(e,"name",{value:i,configurable:!0});import{Box as w,Container as T,Spacer as C,Text as g}from"@earendil-works/pi-tui";import{renderDiff as c}from"../../../modes/interactive/components/diff.js";import{computeEditsDiff as b}from"../edit-diff.js";import{renderToolPath as K,str as y}from"../render-utils.js";function A(){return Object.assign(new w(1,1,e=>e),{preview:void 0,previewArgsKey:void 0,previewPending:!1,settledError:!1})}f(A,"createEditCallRenderComponent");function B(e,i){if(i instanceof w){const r=i;return e.callComponent=r,r}if(e.callComponent)return e.callComponent;const t=A();return e.callComponent=t,t}f(B,"getEditCallRenderComponent");function h(e){if(!e)return null;const i=typeof e.path=="string"?e.path:typeof e.file_path=="string"?e.file_path:null;return i?Array.isArray(e.edits)&&e.edits.length>0&&e.edits.every(t=>typeof t?.oldText=="string"&&typeof t?.newText=="string")?{path:i,edits:e.edits}:typeof e.oldText=="string"&&typeof e.newText=="string"?{path:i,edits:[{oldText:e.oldText,newText:e.newText}]}:null:null}f(h,"getRenderablePreviewInput");function R(e,i,t){const r=K(y(e?.file_path??e?.path),i,t);return`${i.fg("toolTitle",i.bold("edit"))} ${r}`}f(R,"formatEditCall");function D(e,i,t,r,n){const d=y(e?.file_path??e?.path),s=i&&!("error"in i)?i.diff:void 0,l=i&&"error"in i?i.error:void 0;if(n){const o=t.content.filter(a=>a.type==="text").map(a=>a.text||"").join(`
2
- `);return!o||o===l?void 0:r.fg("error",o)}const u=t.details?.diff;if(u&&u!==s)return c(u,{filePath:d??void 0})}f(D,"formatEditResult");function _(e,i,t){return e?"error"in e?r=>t.bg("toolErrorBg",r):r=>t.bg("toolSuccessBg",r):i?r=>t.bg("toolErrorBg",r):r=>t.bg("toolPendingBg",r)}f(_,"getEditHeaderBg");function E(e,i,t,r,n){if(e.setBgFn(_(e.preview,e.settledError,t)),e.setPaddingX(n),e.clear(),e.addChild(new g(R(i,t,r),0,0)),!e.preview)return e;const d="error"in e.preview?t.fg("error",e.preview.error):c(e.preview.diff);return e.addChild(new C(1)),e.addChild(new g(d,0,0)),e}f(E,"buildEditCallComponent");function v(e,i,t){const r=e.preview,n=r===void 0||("error"in r&&"error"in i?r.error!==i.error:"error"in r!="error"in i)||!("error"in r)&&!("error"in i)&&(r.diff!==i.diff||r.firstChangedLine!==i.firstChangedLine);return e.preview=i,e.previewArgsKey=t,e.previewPending=!1,n}f(v,"setEditPreview");const j={renderCall(e,i,t){const r=B(t.state,t.lastComponent),n=h(e),d=n?JSON.stringify({path:n.path,edits:n.edits}):void 0;if(r.previewArgsKey!==d&&(r.preview=void 0,r.previewArgsKey=d,r.previewPending=!1,r.settledError=!1),t.argsComplete&&n&&!r.preview&&!r.previewPending){r.previewPending=!0;const s=d;b(n.path,n.edits,t.cwd).then(l=>{r.previewArgsKey===s&&(v(r,l,s),t.invalidate())})}return E(r,e,i,t.cwd,t.outputPad)},renderResult(e,i,t,r){const n=r.state.callComponent,d=h(r.args),s=d?JSON.stringify({path:d.path,edits:d.edits}):void 0,l=e,u=r.isError?void 0:l.details?.diff;let o=!1;n&&(typeof u=="string"&&(o=v(n,{diff:u,firstChangedLine:l.details?.firstChangedLine},s)||o),n.settledError!==r.isError&&(n.settledError=r.isError,o=!0),o&&E(n,r.args,t,r.cwd,r.outputPad));const a=D(r.args,n?.preview,l,t,r.isError),p=r.lastComponent??new T;return p.clear(),a&&(p.addChild(new C(1)),p.addChild(new g(a,r.outputPad,0))),p}};export{j as editRenderers};
1
+ var P=Object.defineProperty;var s=(e,i)=>P(e,"name",{value:i,configurable:!0});import{Box as p,Container as T,Spacer as c,Text as g}from"@earendil-works/pi-tui";import{DiffView as y,diffLineCounts as b,formatDiffLineCounts as K}from"../../../modes/interactive/components/diff.js";import{computeEditsDiff as A}from"../edit-diff.js";import{renderToolPath as B,str as D}from"../render-utils.js";function R(){return Object.assign(new p(1,1,e=>e),{preview:void 0,previewArgsKey:void 0,previewPending:!1,settledError:!1})}s(R,"createEditCallRenderComponent");function L(e,i){if(i instanceof p){const r=i;return e.callComponent=r,r}if(e.callComponent)return e.callComponent;const n=R();return e.callComponent=n,n}s(L,"getEditCallRenderComponent");function v(e){if(!e)return null;const i=typeof e.path=="string"?e.path:typeof e.file_path=="string"?e.file_path:null;return i?Array.isArray(e.edits)&&e.edits.length>0&&e.edits.every(n=>typeof n?.oldText=="string"&&typeof n?.newText=="string")?{path:i,edits:e.edits}:typeof e.oldText=="string"&&typeof e.newText=="string"?{path:i,edits:[{oldText:e.oldText,newText:e.newText}]}:null:null}s(v,"getRenderablePreviewInput");function _(e,i,n){const r=B(D(e?.file_path??e?.path),i,n);return`${i.fg("toolTitle",i.bold("edit"))} ${r}`}s(_,"formatEditCall");function S(e,i,n,r,t){const d=i&&!("error"in i)?i.diff:void 0,f=i&&"error"in i?i.error:void 0;if(t){const u=n.content.filter(l=>l.type==="text").map(l=>l.text||"").join(`
2
+ `);return!u||u===f?void 0:new g(r.fg("error",u),0,0)}const o=n.details?.diff;if(o&&o!==d)return new y(o)}s(S,"formatEditResult");function I(e,i,n){return e?"error"in e?r=>n.bg("toolErrorBg",r):r=>n.bg("toolSuccessBg",r):i?r=>n.bg("toolErrorBg",r):r=>n.bg("toolPendingBg",r)}s(I,"getEditHeaderBg");function h(e,i,n,r,t){e.setBgFn(I(e.preview,e.settledError,n)),e.setPaddingX(t),e.clear();let d=_(i,n,r);if(e.preview&&!("error"in e.preview)){const f=K(b(e.preview.diff));f&&(d+=n.fg("muted",` ${f}`))}return e.addChild(new g(d,0,0)),e.preview&&(e.addChild(new c(1)),e.addChild("error"in e.preview?new g(n.fg("error",e.preview.error),0,0):new y(e.preview.diff))),e}s(h,"buildEditCallComponent");function E(e,i,n){const r=e.preview,t=r===void 0||("error"in r&&"error"in i?r.error!==i.error:"error"in r!="error"in i)||!("error"in r)&&!("error"in i)&&(r.diff!==i.diff||r.firstChangedLine!==i.firstChangedLine);return e.preview=i,e.previewArgsKey=n,e.previewPending=!1,t}s(E,"setEditPreview");const m={renderCall(e,i,n){const r=L(n.state,n.lastComponent),t=v(e),d=t?JSON.stringify({path:t.path,edits:t.edits}):void 0;if(r.previewArgsKey!==d&&(r.preview=void 0,r.previewArgsKey=d,r.previewPending=!1,r.settledError=!1),n.argsComplete&&t&&!r.preview&&!r.previewPending){r.previewPending=!0;const f=d;A(t.path,t.edits,n.cwd).then(o=>{r.previewArgsKey===f&&(E(r,o,f),n.invalidate())})}return h(r,e,i,n.cwd,n.outputPad)},renderResult(e,i,n,r){const t=r.state.callComponent,d=v(r.args),f=d?JSON.stringify({path:d.path,edits:d.edits}):void 0,o=e,u=r.isError?void 0:o.details?.diff;let l=!1;t&&(typeof u=="string"&&(l=E(t,{diff:u,firstChangedLine:o.details?.firstChangedLine},f)||l),t.settledError!==r.isError&&(t.settledError=r.isError,l=!0),l&&h(t,r.args,n,r.cwd,r.outputPad));const w=S(r.args,t?.preview,o,n,r.isError),a=r.lastComponent??new T;if(a.clear(),!w)return a;a.addChild(new c(1));const C=new p(r.outputPad,0);return C.addChild(w),a.addChild(C),a}};export{m as editRenderers};
@@ -16,6 +16,7 @@ export declare class AssistantMessageComponent extends Container {
16
16
  private messageId?;
17
17
  private timestamp?;
18
18
  private thinkingVisibilityOverrides;
19
+ private thinkingTimes;
19
20
  private markdownSlots;
20
21
  constructor(message?: AssistantMessage, hideThinkingBlock?: boolean, markdownTheme?: MarkdownTheme, hiddenThinkingLabel?: string, outputPad?: number, markdownTransformers?: readonly MarkdownTransformer[], messageId?: string, timestamp?: string);
21
22
  isBlank(): boolean;
@@ -25,5 +26,7 @@ export declare class AssistantMessageComponent extends Container {
25
26
  isThinkingLive(): boolean;
26
27
  setOutputPad(padding: number): void;
27
28
  render(width: number): string[];
29
+ private trackThinkingRun;
30
+ private thoughtLine;
28
31
  updateContent(message: AssistantMessage, isStreaming?: boolean): void;
29
32
  }