@qqbrowser/qbot-dsh 0.0.15 → 0.1.0

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 (331) hide show
  1. package/config/agent-presets/code/agent.cordis.yml +2 -2
  2. package/config/agent-presets/standard/agent.cordis.yml +2 -2
  3. package/node_modules/@deepseek-ai/cordis-plugin-hmr/package.json +1 -1
  4. package/node_modules/@deepseek-ai/dsh-agent/package.json +1 -1
  5. package/node_modules/@deepseek-ai/dsh-agent-default-model/package.json +1 -1
  6. package/node_modules/@deepseek-ai/dsh-agent-instructions/package.json +1 -1
  7. package/node_modules/@deepseek-ai/dsh-agent-loop/package.json +1 -1
  8. package/node_modules/@deepseek-ai/dsh-agent-presets/package.json +1 -1
  9. package/node_modules/@deepseek-ai/dsh-agent-tool-presentation/package.json +1 -1
  10. package/node_modules/@deepseek-ai/dsh-anonymous-user-id/package.json +1 -1
  11. package/node_modules/@deepseek-ai/dsh-api-gateway/package.json +1 -1
  12. package/node_modules/@deepseek-ai/dsh-api-remotes/package.json +1 -1
  13. package/node_modules/@deepseek-ai/dsh-app-boot/package.json +1 -1
  14. package/node_modules/@deepseek-ai/dsh-atomic-write/package.json +1 -1
  15. package/node_modules/@deepseek-ai/dsh-attachment/lib/index.js +1 -1
  16. package/node_modules/@deepseek-ai/dsh-attachment/package.json +1 -1
  17. package/node_modules/@deepseek-ai/dsh-attachment-local/package.json +1 -1
  18. package/node_modules/@deepseek-ai/dsh-base/package.json +1 -1
  19. package/node_modules/@deepseek-ai/dsh-bash-local/package.json +1 -1
  20. package/node_modules/@deepseek-ai/dsh-bash-sandbox/package.json +1 -1
  21. package/node_modules/@deepseek-ai/dsh-brand/package.json +1 -1
  22. package/node_modules/@deepseek-ai/dsh-client-connection/lib/client.js +1 -1
  23. package/node_modules/@deepseek-ai/dsh-client-connection/package.json +1 -1
  24. package/node_modules/@deepseek-ai/dsh-client-hmr/package.json +1 -1
  25. package/node_modules/@deepseek-ai/dsh-client-locale/lib/client.js +1 -1
  26. package/node_modules/@deepseek-ai/dsh-client-locale/package.json +1 -1
  27. package/node_modules/@deepseek-ai/dsh-client-modules/package.json +1 -1
  28. package/node_modules/@deepseek-ai/dsh-client-runtime/lib/client.js +4 -4
  29. package/node_modules/@deepseek-ai/dsh-client-runtime/package.json +1 -1
  30. package/node_modules/@deepseek-ai/dsh-client-schema-form/package.json +1 -1
  31. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/lib/client.js +1 -1
  32. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/package.json +1 -1
  33. package/node_modules/@deepseek-ai/dsh-client-ui-attachment/package.json +1 -1
  34. package/node_modules/@deepseek-ai/dsh-client-ui-commands/lib/client.js +1 -1
  35. package/node_modules/@deepseek-ai/dsh-client-ui-commands/package.json +1 -1
  36. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +8 -8
  37. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/package.json +1 -1
  38. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/lib/client.js +3 -3
  39. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/package.json +1 -1
  40. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/client.js +1 -1
  41. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/package.json +1 -1
  42. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/lib/client.js +1 -1
  43. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/package.json +1 -1
  44. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-native/package.json +1 -1
  45. package/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/client.js +1 -1
  46. package/node_modules/@deepseek-ai/dsh-client-ui-goal/package.json +1 -1
  47. package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/lib/client.js +1 -1
  48. package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/package.json +1 -1
  49. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/lib/client.js +1 -1
  50. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/package.json +1 -1
  51. package/node_modules/@deepseek-ai/dsh-client-ui-layout/lib/client.js +1 -1
  52. package/node_modules/@deepseek-ai/dsh-client-ui-layout/package.json +1 -1
  53. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/lib/client.js +1 -1
  54. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/package.json +1 -1
  55. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +1 -1
  56. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/package.json +1 -1
  57. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/lib/client.js +1 -1
  58. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/package.json +1 -1
  59. package/node_modules/@deepseek-ai/dsh-client-ui-plan/lib/client.js +1 -1
  60. package/node_modules/@deepseek-ai/dsh-client-ui-plan/package.json +1 -1
  61. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/index.js +22 -22
  62. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +1 -1
  63. package/node_modules/@deepseek-ai/dsh-client-ui-settings/package.json +1 -1
  64. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +1 -1
  65. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/package.json +1 -1
  66. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +3 -3
  67. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/package.json +1 -1
  68. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/lib/client.js +1 -1
  69. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/package.json +1 -1
  70. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/client.js +1 -1
  71. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/package.json +1 -1
  72. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  73. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/package.json +1 -1
  74. package/node_modules/@deepseek-ai/dsh-client-ui-skill/lib/client.js +3 -3
  75. package/node_modules/@deepseek-ai/dsh-client-ui-skill/package.json +1 -1
  76. package/node_modules/@deepseek-ai/dsh-client-ui-slots/package.json +1 -1
  77. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/lib/client.js +1 -1
  78. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/package.json +1 -1
  79. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +1 -1
  80. package/node_modules/@deepseek-ai/dsh-client-ui-theme/package.json +1 -1
  81. package/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/client.js +4 -4
  82. package/node_modules/@deepseek-ai/dsh-client-ui-tool/package.json +1 -1
  83. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/lib/client.js +14 -14
  84. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/package.json +1 -1
  85. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/lib/client.js +1 -1
  86. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/package.json +1 -1
  87. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/lib/client.js +1 -1
  88. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/package.json +1 -1
  89. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +1 -1
  90. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/package.json +1 -1
  91. package/node_modules/@deepseek-ai/dsh-client-web/package.json +1 -1
  92. package/node_modules/@deepseek-ai/dsh-client-web-react/package.json +1 -1
  93. package/node_modules/@deepseek-ai/dsh-cmdline/package.json +1 -1
  94. package/node_modules/@deepseek-ai/dsh-code-runtime/package.json +1 -1
  95. package/node_modules/@deepseek-ai/dsh-code-runtime-worker-thread/package.json +1 -1
  96. package/node_modules/@deepseek-ai/dsh-command-compact/package.json +1 -1
  97. package/node_modules/@deepseek-ai/dsh-command-feedback/package.json +1 -1
  98. package/node_modules/@deepseek-ai/dsh-command-goal/package.json +1 -1
  99. package/node_modules/@deepseek-ai/dsh-commands/lib/typert.host.js +5 -2
  100. package/node_modules/@deepseek-ai/dsh-commands/package.json +1 -1
  101. package/node_modules/@deepseek-ai/dsh-compaction/package.json +1 -1
  102. package/node_modules/@deepseek-ai/dsh-compaction-basic/package.json +1 -1
  103. package/node_modules/@deepseek-ai/dsh-compaction-tool-result-pruner/package.json +1 -1
  104. package/node_modules/@deepseek-ai/dsh-content-review/package.json +1 -1
  105. package/node_modules/@deepseek-ai/dsh-cordis-client-runner/lib/client.js +4 -4
  106. package/node_modules/@deepseek-ai/dsh-cordis-client-runner/package.json +1 -1
  107. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/lib/typert.host.js +10 -4
  108. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/package.json +1 -1
  109. package/node_modules/@deepseek-ai/dsh-credentials/package.json +1 -1
  110. package/node_modules/@deepseek-ai/dsh-credentials-local/package.json +1 -1
  111. package/node_modules/@deepseek-ai/dsh-fs/package.json +1 -1
  112. package/node_modules/@deepseek-ai/dsh-fs-local/package.json +1 -1
  113. package/node_modules/@deepseek-ai/dsh-fs-observation-policy/package.json +1 -1
  114. package/node_modules/@deepseek-ai/dsh-fs-sandbox/package.json +1 -1
  115. package/node_modules/@deepseek-ai/dsh-goal/lib/typert.host.js +5 -2
  116. package/node_modules/@deepseek-ai/dsh-goal/package.json +1 -1
  117. package/node_modules/@deepseek-ai/dsh-goal-round-driver/package.json +1 -1
  118. package/node_modules/@deepseek-ai/dsh-headless/package.json +1 -1
  119. package/node_modules/@deepseek-ai/dsh-home-paths/package.json +1 -1
  120. package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/package.json +1 -1
  121. package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/index.js +7 -7
  122. package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/types/api/rpc.schema.js +1 -1
  123. package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/types/api-proxy.js +1 -1
  124. package/node_modules/@deepseek-ai/dsh-host-apiproxy/package.json +1 -1
  125. package/node_modules/@deepseek-ai/dsh-host-directory-picker/package.json +1 -1
  126. package/node_modules/@deepseek-ai/dsh-host-directory-picker-auto/package.json +1 -1
  127. package/node_modules/@deepseek-ai/dsh-host-directory-picker-browse/package.json +1 -1
  128. package/node_modules/@deepseek-ai/dsh-host-directory-picker-native/package.json +1 -1
  129. package/node_modules/@deepseek-ai/dsh-host-frontend-static/package.json +1 -1
  130. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/package.json +1 -1
  131. package/node_modules/@deepseek-ai/dsh-host-webserver/package.json +1 -1
  132. package/node_modules/@deepseek-ai/dsh-invariants/package.json +1 -1
  133. package/node_modules/@deepseek-ai/dsh-jobs/package.json +1 -1
  134. package/node_modules/@deepseek-ai/dsh-jobs-local/package.json +1 -1
  135. package/node_modules/@deepseek-ai/dsh-launch-environment/package.json +1 -1
  136. package/node_modules/@deepseek-ai/dsh-llm/lib/index.js +1 -1
  137. package/node_modules/@deepseek-ai/dsh-llm/lib/types/assembler.js +1 -1
  138. package/node_modules/@deepseek-ai/dsh-llm/package.json +1 -1
  139. package/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/index.js +1 -1
  140. package/node_modules/@deepseek-ai/dsh-llm-deepseek/package.json +1 -1
  141. package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/package.json +1 -1
  142. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +1 -1
  143. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/package.json +1 -1
  144. package/node_modules/@deepseek-ai/dsh-llm-retry/package.json +1 -1
  145. package/node_modules/@deepseek-ai/dsh-mcp-client/lib/index.js +3 -2
  146. package/node_modules/@deepseek-ai/dsh-mcp-client/package.json +1 -1
  147. package/node_modules/@deepseek-ai/dsh-message-feedback/package.json +1 -1
  148. package/node_modules/@deepseek-ai/dsh-native-command/package.json +1 -1
  149. package/node_modules/@deepseek-ai/dsh-output-retention/package.json +1 -1
  150. package/node_modules/@deepseek-ai/dsh-permission-presets/package.json +1 -1
  151. package/node_modules/@deepseek-ai/dsh-persona/package.json +1 -1
  152. package/node_modules/@deepseek-ai/dsh-plan-mode/package.json +1 -1
  153. package/node_modules/@deepseek-ai/dsh-pwsh-local/package.json +1 -1
  154. package/node_modules/@deepseek-ai/dsh-pwsh-sandbox/package.json +1 -1
  155. package/node_modules/@deepseek-ai/dsh-qb-auth/package.json +1 -1
  156. package/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/package.json +1 -1
  157. package/node_modules/@deepseek-ai/dsh-sandbox/package.json +1 -1
  158. package/node_modules/@deepseek-ai/dsh-sandbox-local/package.json +1 -1
  159. package/node_modules/@deepseek-ai/dsh-sandbox-policy/package.json +1 -1
  160. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/package.json +1 -1
  161. package/node_modules/@deepseek-ai/dsh-schedule/package.json +1 -1
  162. package/node_modules/@deepseek-ai/dsh-scope/package.json +1 -1
  163. package/node_modules/@deepseek-ai/dsh-session/package.json +1 -1
  164. package/node_modules/@deepseek-ai/dsh-session-checkpoint-policy/package.json +1 -1
  165. package/node_modules/@deepseek-ai/dsh-session-log-export/lib/client.js +1 -1
  166. package/node_modules/@deepseek-ai/dsh-session-log-export/package.json +1 -1
  167. package/node_modules/@deepseek-ai/dsh-session-persistence/package.json +1 -1
  168. package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/package.json +1 -1
  169. package/node_modules/@deepseek-ai/dsh-session-projection/package.json +1 -1
  170. package/node_modules/@deepseek-ai/dsh-session-projection-cache/package.json +1 -1
  171. package/node_modules/@deepseek-ai/dsh-session-query/lib/index.js +2 -2
  172. package/node_modules/@deepseek-ai/dsh-session-query/package.json +1 -1
  173. package/node_modules/@deepseek-ai/dsh-session-query-sqlite/package.json +1 -1
  174. package/node_modules/@deepseek-ai/dsh-session-reference/package.json +1 -1
  175. package/node_modules/@deepseek-ai/dsh-session-stats/package.json +1 -1
  176. package/node_modules/@deepseek-ai/dsh-session-telemetry/package.json +1 -1
  177. package/node_modules/@deepseek-ai/dsh-session-telemetry-otel/package.json +1 -1
  178. package/node_modules/@deepseek-ai/dsh-session-title/package.json +1 -1
  179. package/node_modules/@deepseek-ai/dsh-session-title-first-prompt-llm/package.json +1 -1
  180. package/node_modules/@deepseek-ai/dsh-session-title-llm/package.json +1 -1
  181. package/node_modules/@deepseek-ai/dsh-settings/package.json +1 -1
  182. package/node_modules/@deepseek-ai/dsh-settings-file/package.json +1 -1
  183. package/node_modules/@deepseek-ai/dsh-shell/package.json +1 -1
  184. package/node_modules/@deepseek-ai/dsh-shell-env/package.json +1 -1
  185. package/node_modules/@deepseek-ai/dsh-skill/package.json +1 -1
  186. package/node_modules/@deepseek-ai/dsh-skill-badge/package.json +1 -1
  187. package/node_modules/@deepseek-ai/dsh-skill-filesystem/package.json +1 -1
  188. package/node_modules/@deepseek-ai/dsh-spill/package.json +1 -1
  189. package/node_modules/@deepseek-ai/dsh-spill-local/package.json +1 -1
  190. package/node_modules/@deepseek-ai/dsh-spill-policy/package.json +1 -1
  191. package/node_modules/@deepseek-ai/dsh-storage/package.json +1 -1
  192. package/node_modules/@deepseek-ai/dsh-storage-domain/package.json +1 -1
  193. package/node_modules/@deepseek-ai/dsh-storage-json/package.json +1 -1
  194. package/node_modules/@deepseek-ai/dsh-subagent/package.json +1 -1
  195. package/node_modules/@deepseek-ai/dsh-subagent-fork-in-process/package.json +1 -1
  196. package/node_modules/@deepseek-ai/dsh-subagent-in-process-driver/package.json +1 -1
  197. package/node_modules/@deepseek-ai/dsh-subagent-spawn-in-process/package.json +1 -1
  198. package/node_modules/@deepseek-ai/dsh-subprocess/package.json +1 -1
  199. package/node_modules/@deepseek-ai/dsh-subprocess-local/package.json +1 -1
  200. package/node_modules/@deepseek-ai/dsh-system-prompt/package.json +1 -1
  201. package/node_modules/@deepseek-ai/dsh-terminal/package.json +1 -1
  202. package/node_modules/@deepseek-ai/dsh-terminal-bash/lib/index.js +1 -1
  203. package/node_modules/@deepseek-ai/dsh-terminal-bash/package.json +1 -1
  204. package/node_modules/@deepseek-ai/dsh-time-context/package.json +1 -1
  205. package/node_modules/@deepseek-ai/dsh-timeout/package.json +1 -1
  206. package/node_modules/@deepseek-ai/dsh-tmux-context/package.json +1 -1
  207. package/node_modules/@deepseek-ai/dsh-token-meter/package.json +1 -1
  208. package/node_modules/@deepseek-ai/dsh-tool-ask-user/package.json +1 -1
  209. package/node_modules/@deepseek-ai/dsh-tool-bash/package.json +1 -1
  210. package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/lib/index.js +7 -10
  211. package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/package.json +1 -1
  212. package/node_modules/@deepseek-ai/dsh-tool-call-timeout-policy/package.json +1 -1
  213. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/index.js +5 -2
  214. package/node_modules/@deepseek-ai/dsh-tool-cordis/package.json +1 -1
  215. package/node_modules/@deepseek-ai/dsh-tool-fs/lib/index.js +8 -8
  216. package/node_modules/@deepseek-ai/dsh-tool-fs/package.json +1 -1
  217. package/node_modules/@deepseek-ai/dsh-tool-fs-search/package.json +1 -1
  218. package/node_modules/@deepseek-ai/dsh-tool-goal/package.json +1 -1
  219. package/node_modules/@deepseek-ai/dsh-tool-jobs/package.json +1 -1
  220. package/node_modules/@deepseek-ai/dsh-tool-pwsh/package.json +1 -1
  221. package/node_modules/@deepseek-ai/dsh-tool-ralph/package.json +1 -1
  222. package/node_modules/@deepseek-ai/dsh-tool-skill/package.json +1 -1
  223. package/node_modules/@deepseek-ai/dsh-tool-str-replace-editor/package.json +1 -1
  224. package/node_modules/@deepseek-ai/dsh-tool-subagent/lib/index.js +2 -2
  225. package/node_modules/@deepseek-ai/dsh-tool-subagent/package.json +1 -1
  226. package/node_modules/@deepseek-ai/dsh-tool-subagent-control/package.json +1 -1
  227. package/node_modules/@deepseek-ai/dsh-tool-subagent-report/package.json +1 -1
  228. package/node_modules/@deepseek-ai/dsh-tool-todo/package.json +1 -1
  229. package/node_modules/@deepseek-ai/dsh-tool-web/package.json +1 -1
  230. package/node_modules/@deepseek-ai/dsh-tool-workflow/package.json +1 -1
  231. package/node_modules/@deepseek-ai/dsh-tools/lib/index.js +15 -15
  232. package/node_modules/@deepseek-ai/dsh-tools/lib/types/code-mode.js +8 -8
  233. package/node_modules/@deepseek-ai/dsh-tools/lib/types/py-types.js +3 -3
  234. package/node_modules/@deepseek-ai/dsh-tools/lib/types/ts-types.js +4 -4
  235. package/node_modules/@deepseek-ai/dsh-tools/package.json +1 -1
  236. package/node_modules/@deepseek-ai/dsh-typert-loader/package.json +1 -1
  237. package/node_modules/@deepseek-ai/dsh-typert-protocol/package.json +1 -1
  238. package/node_modules/@deepseek-ai/dsh-typert-registry/package.json +1 -1
  239. package/node_modules/@deepseek-ai/dsh-user-approval/package.json +1 -1
  240. package/node_modules/@deepseek-ai/dsh-user-questions/package.json +1 -1
  241. package/node_modules/@deepseek-ai/dsh-web/package.json +1 -1
  242. package/node_modules/@deepseek-ai/dsh-web-app/package.json +1 -1
  243. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/{index-BQQQ5Qt-.js → index-fPGOmJjK.js} +25 -25
  244. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/index.html +1 -1
  245. package/node_modules/@deepseek-ai/dsh-web-frontend/package.json +1 -1
  246. package/node_modules/@deepseek-ai/dsh-web-search-deepseek/package.json +1 -1
  247. package/node_modules/@deepseek-ai/dsh-web-search-dsh/package.json +1 -1
  248. package/node_modules/@deepseek-ai/dsh-workflow/package.json +1 -1
  249. package/node_modules/@deepseek-ai/dsh-workflow-worker-thread/package.json +1 -1
  250. package/node_modules/@deepseek-ai/dsh-workspace/package.json +1 -1
  251. package/node_modules/@tanstack/react-virtual/package.json +1 -1
  252. package/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs +7 -1
  253. package/node_modules/@tanstack/virtual-core/dist/cjs/utils.cjs +14 -4
  254. package/node_modules/@tanstack/virtual-core/dist/esm/index.js +1 -1
  255. package/node_modules/@tanstack/virtual-core/dist/esm/utils.js +2 -2
  256. package/node_modules/@tanstack/virtual-core/package.json +1 -1
  257. package/node_modules/hono/dist/cjs/client/utils.js +1 -1
  258. package/node_modules/hono/dist/cjs/context.js +4 -0
  259. package/node_modules/hono/dist/cjs/middleware/cors/index.js +1 -1
  260. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +1 -1
  261. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +1 -1
  262. package/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -2
  263. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +3 -1
  264. package/node_modules/hono/dist/cjs/router/linear-router/router.js +7 -2
  265. package/node_modules/hono/dist/cjs/router/pattern-router/router.js +3 -9
  266. package/node_modules/hono/dist/cjs/router/trie-router/node.js +43 -67
  267. package/node_modules/hono/dist/cjs/router/trie-router/router.js +3 -11
  268. package/node_modules/hono/dist/cjs/utils/ipaddr.js +5 -3
  269. package/node_modules/hono/dist/client/utils.js +1 -1
  270. package/node_modules/hono/dist/middleware/cors/index.js +1 -1
  271. package/node_modules/hono/dist/middleware/csrf/index.js +1 -1
  272. package/node_modules/hono/dist/middleware/etag/digest.js +1 -1
  273. package/node_modules/hono/dist/middleware/etag/index.js +1 -1
  274. package/node_modules/hono/dist/middleware/pretty-json/index.js +1 -1
  275. package/node_modules/hono/dist/router/linear-router/router.js +1 -1
  276. package/node_modules/hono/dist/router/pattern-router/router.js +1 -1
  277. package/node_modules/hono/dist/router/trie-router/node.js +1 -1
  278. package/node_modules/hono/dist/router/trie-router/router.js +1 -1
  279. package/node_modules/hono/dist/utils/ipaddr.js +1 -1
  280. package/node_modules/hono/package.json +1 -1
  281. package/node_modules/node-pty/lib/conpty_console_list_agent.js +11 -2
  282. package/node_modules/node-pty/lib/index.js +6 -6
  283. package/node_modules/node-pty/lib/shared/conout.js +2 -3
  284. package/node_modules/node-pty/lib/terminal.js +2 -2
  285. package/node_modules/node-pty/lib/unixTerminal.js +11 -6
  286. package/node_modules/node-pty/lib/utils.js +6 -7
  287. package/node_modules/node-pty/lib/windowsConoutConnection.js +24 -18
  288. package/node_modules/node-pty/lib/windowsPtyAgent.js +125 -101
  289. package/node_modules/node-pty/lib/windowsTerminal.js +14 -4
  290. package/node_modules/node-pty/lib/worker/conoutSocketWorker.js +3 -3
  291. package/node_modules/node-pty/package.json +1 -1
  292. package/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
  293. package/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
  294. package/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
  295. package/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
  296. package/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  297. package/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  298. package/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
  299. package/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
  300. package/node_modules/node-pty/scripts/post-install.js +1 -5
  301. package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-arm64/OpenConsole.exe +0 -0
  302. package/node_modules/node-pty/third_party/conpty/{1.23.251008001 → 1.25.260303002}/win10-arm64/conpty.dll +0 -0
  303. package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-x64/OpenConsole.exe +0 -0
  304. package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-x64/conpty.dll +0 -0
  305. package/package.json +1 -1
  306. package/node_modules/node-pty/deps/winpty/.drone.yml +0 -15
  307. package/node_modules/node-pty/deps/winpty/LICENSE +0 -21
  308. package/node_modules/node-pty/deps/winpty/configure +0 -167
  309. package/node_modules/node-pty/deps/winpty/misc/ConinMode.ps1 +0 -116
  310. package/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 +0 -51
  311. package/node_modules/node-pty/deps/winpty/misc/build32.sh +0 -9
  312. package/node_modules/node-pty/deps/winpty/misc/build64.sh +0 -9
  313. package/node_modules/node-pty/deps/winpty/misc/color-test.sh +0 -212
  314. package/node_modules/node-pty/deps/winpty/ship/build-pty4j-libpty.bat +0 -36
  315. package/node_modules/node-pty/deps/winpty/src/shared/GetCommitHash.bat +0 -13
  316. package/node_modules/node-pty/deps/winpty/src/shared/UpdateGenVersion.bat +0 -20
  317. package/node_modules/node-pty/deps/winpty/vcbuild.bat +0 -83
  318. package/node_modules/node-pty/lib/eventEmitter2.test.js +0 -30
  319. package/node_modules/node-pty/lib/terminal.test.js +0 -139
  320. package/node_modules/node-pty/lib/testUtils.test.js +0 -28
  321. package/node_modules/node-pty/lib/unixTerminal.test.js +0 -351
  322. package/node_modules/node-pty/lib/windowsPtyAgent.test.js +0 -90
  323. package/node_modules/node-pty/lib/windowsTerminal.test.js +0 -219
  324. package/node_modules/node-pty/prebuilds/win32-x64/pty.node +0 -0
  325. package/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
  326. package/node_modules/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
  327. package/node_modules/node-pty/scripts/gen-compile-commands.js +0 -8
  328. package/node_modules/node-pty/scripts/increment-version.js +0 -54
  329. package/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/OpenConsole.exe +0 -0
  330. package/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/OpenConsole.exe +0 -0
  331. package/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/conpty.dll +0 -0
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-token-meter","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./client":{"types":"./lib/types/client.d.ts","default":"./lib/types/client.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-compaction":"^0.0.15","@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/dsh-llm":"^0.0.15","@deepseek-ai/dsh-session":"^0.0.15","@deepseek-ai/dsh-session-projection":"^0.0.15","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"zod":"^4.4.3","@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-token-meter","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./client":{"types":"./lib/types/client.d.ts","default":"./lib/types/client.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-compaction":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-session-projection":"^0.1.0","@deepseek-ai/dsh-session":"^0.1.0"},"dependencies":{"zod":"^4.4.3","@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-ask-user","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.0.15","@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-tools":"^0.0.15","@deepseek-ai/dsh-user-questions":"^0.0.15"}}
1
+ {"name":"@deepseek-ai/dsh-tool-ask-user","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-tools":"^0.1.0","@deepseek-ai/dsh-user-questions":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-bash","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-shell-env":"^0.0.15","@deepseek-ai/dsh-agent":"^0.0.15","@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/dsh-shell":"^0.0.15","@deepseek-ai/dsh-sandbox":"^0.0.15","@deepseek-ai/dsh-jobs":"^0.0.15","@deepseek-ai/dsh-system-prompt":"^0.0.15","@deepseek-ai/dsh-sandbox-policy":"^0.0.15","@deepseek-ai/dsh-llm":"^0.0.15","@deepseek-ai/dsh-tools":"^0.0.15","@deepseek-ai/dsh-user-approval":"^0.0.15","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-bash","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-sandbox":"^0.1.0","@deepseek-ai/dsh-shell-env":"^0.1.0","@deepseek-ai/dsh-shell":"^0.1.0","@deepseek-ai/dsh-sandbox-policy":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-system-prompt":"^0.1.0","@deepseek-ai/dsh-jobs":"^0.1.0","@deepseek-ai/dsh-user-approval":"^0.1.0","@deepseek-ai/dsh-tools":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1,10 +1,7 @@
1
- var N=Object.defineProperty;var l=(e,t)=>N(e,"name",{value:t,configurable:!0});import{randomUUID as D}from"node:crypto";import w from"@deepseek-ai/schemastery";import{deadline as L,timeoutOf as j}from"@deepseek-ai/dsh-timeout";import{defineTool as H}from"@deepseek-ai/dsh-tools";var B=l(function(e,t,s){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var r,i;if(s){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],s&&(i=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");i&&(r=l(function(){try{i.call(this)}catch(n){return Promise.reject(n)}},"dispose")),e.stack.push({value:t,dispose:r,async:s})}else s&&e.stack.push({async:!0});return t},"__addDisposableResource"),W=(function(e){return function(t){function s(o){t.error=t.hasError?new e(o,t.error,"An error was suppressed during disposal."):o,t.hasError=!0}l(s,"fail");var r,i=0;function n(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(n);if(r.dispose){var o=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(o).then(n,function(a){return s(a),n()})}else i|=1}catch(a){s(a)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return l(n,"next"),n()}})(typeof SuppressedError=="function"?SuppressedError:function(e,t,s){var r=new Error(s);return r.name="SuppressedError",r.error=e,r.suppressed=t,r});const M="<response clipped><NOTE>To save on context only part of this file has been shown to you. You should retry this tool after you have searched inside the file with `grep -n` in order to find the line numbers of what you are looking for.</NOTE>",U=`<response clipped><NOTE>The beginning of this command output was dropped by the terminal scrollback limit. The following text is the earliest retained output.</NOTE>
2
- `,P="The persistent bash shell was reset; the next bash call starts from the workspace with a fresh current directory and environment.",g="__DSH_PERSISTENT_BASH_PROMPT__ ",k="PERSISTENT_BASH_TIMEOUT",O=1e3,q=25,A="Run commands in a persistent bash shell. State, including the current directory and exported environment variables, persists across calls for this agent.";function z(e,t,s=!1){return e.length<=t&&!s?e:e.length<=t?e+M:e.slice(0,t)+M}l(z,"maybeTruncate");function G(){const e=D();return{start:`__DSH_PERSISTENT_BASH_START_${e}__`,end:`__DSH_PERSISTENT_BASH_END_${e}:`}}l(G,"markers");function _(e){return`$'${e.replaceAll("\\","\\\\").replaceAll("'","\\'").replaceAll("\r","\\r").replaceAll(`
3
- `,"\\n")}'`}l(_,"quoteForBash");function F(e,t){return`printf '%s\\n' ${_(t.start)}; eval -- ${_(e)}; __dsh_persistent_bash_status=$?; printf '%s%s\\n' ${_(t.end)} "$__dsh_persistent_bash_status"`}l(F,"wrapCommand");function v(e){let t=e.replace(/\r?\n$/,"");for(;t.endsWith(g);)t=t.slice(0,-31);return t.endsWith(`
4
- `)?t.slice(0,-1):t}l(v,"stripPrompt");function Y(e,t){const s=e.text,r=s.lastIndexOf(t.end),i=/^(\d+)\r?\n/.exec(s.slice(r+t.end.length))?.[1];if(i===void 0)return;const n=s.lastIndexOf(t.start,r),o=n<0?0:n+t.start.length;return{text:v(s.slice(o,r).replace(/^\r?\n/,"")),incomplete:n<0,exitCode:Number(i)}}l(Y,"commandOutput");function K(e){return e.viewport.endsWith(g)||e.viewport.endsWith(`${g}\r
5
- `)||e.viewport.endsWith(`${g}
6
- `)}l(K,"promptCompleted");function I(e,t,s,r=!1){const i=e.text.lastIndexOf(t.start);if(i>=0)return{text:v(e.text.slice(i+t.start.length).replace(/^\r?\n/,"")),incomplete:!1};const n=s.lastIndexOf(t.start),o=n<0?s:s.slice(n+t.start.length).replace(/^\r?\n/,""),a=o.lastIndexOf(t.end);return{text:v((a<0?o:o.slice(0,a)).replaceAll(g,"")),incomplete:r||n<0}}l(I,"partialOutput");async function V(){await new Promise(e=>setTimeout(e,q))}l(V,"pause");function X(e,t){if(!(e.text.length===0||e.lineEnd<=t))return e.lineEnd}l(X,"nextScrollbackOffset");function T(e,t,s,r=e.terminals.read(t,s,{offset:0,count:O})){const i=r.text.length===0?[]:[r.text];let n=r.lineEnd,o=r.truncated;for(;!(n>=r.totalLines);){const a=e.terminals.read(t,s,{offset:n,count:O});o||=a.truncated,a.text.length>0&&i.unshift(a.text);const d=X(a,n);if(d===void 0||d>=a.totalLines)break;n=d}return{text:i.join(`
7
- `),truncated:o}}l(T,"retainedScrollback");function x(e,t){const s=z(e.text,t,e.incomplete);return $(e.incomplete&&e.text.length>0?U+s:s,e.exitCode!==void 0&&e.exitCode!==0?`[exit code: ${e.exitCode}]`:void 0)}l(x,"renderCaptured");function $(e,t){return t===void 0?e:e.length===0?t:`${e}
8
- ${t}`}l($,"appendStatusMarker");function J(e,t,s){return $(e,s!==null?`[shell killed by signal: ${s}]`:t!==null?`[shell exited: code ${t}]`:"[shell exited]")}l(J,"renderShellExitStatus");function Q(e,t){const s=new WeakMap,r=new Map,i=new Set,n=new WeakSet,o=new AbortController,a=l(async(c,p,u)=>{e.terminals.list(c).some(f=>f.sessionId===p)&&await e.terminals.kill(c,p,u)},"close");e.effect(()=>async()=>{o.abort(new Error("tool-bash-persistent disposed during shell creation")),await Promise.allSettled([...i]);const c=[...r].map(async([p,u])=>{await a(p,u,"tool-bash-persistent disposed")});await Promise.all(c),r.clear()},"tool-bash-persistent shell cleanup");const d=l(async(c,p)=>{s.delete(c);const u=r.get(c);r.delete(c),u!==void 0&&await a(c,u,p)},"reset");return{get:l((c,p)=>{const u=s.get(c);if(u!==void 0)return u;const f=AbortSignal.any([p,o.signal]),m=(async()=>{try{const h=c.session.header.cwd,E=await e.terminals.spawn(c,{type:t.backendType,...h===void 0?{}:{cwd:h}},f);r.set(c,E.sessionId),n.has(c)||(n.add(c),c.ctx.effect(()=>()=>{s.delete(c),r.delete(c)},"tool-bash-persistent owner cache cleanup"));const b=await e.terminals.startSend(c,E.sessionId,{text:`stty -echo; PS1=${_(g)}`,submit:!0,signal:f}).done;if(b.sessionStatus.kind==="exited"||b.waitReason==="timeout")throw new Error("persistent bash shell did not accept initialization");return E.sessionId}catch(h){throw await d(c,"persistent bash initialization failed"),h}})().finally(()=>{i.delete(m)});return i.add(m),s.set(c,m),m},"get"),reset:d}}l(Q,"persistentShells");async function Z(e,t,s,r,i,n){const o={stack:[],error:void 0,hasError:!1};try{const a=B(o,L(n,i.timeoutMs,k),!1),d=await t.get(s,a.signal),S=G(),c=F(r,S);let p=!0,u="",f=!1;for(;;){let m,h;try{m=e.terminals.startSend(s,d,{text:p?c:"",submit:p,signal:a.signal}),p=!1,h=await m.done}catch(y){throw await t.reset(s,"persistent bash send failed"),y}const E=m.readOutput();u=E.delta.length>0?u+E.delta:h.viewport,f||=E.truncated||h.truncated;const b=e.terminals.read(s,d,{offset:0,count:O}),C=j(a.signal,k);if(C!==void 0){const y=x(I(T(e,s,d,b),S,u,f),i.maxOutputChars);return await t.reset(s,"persistent bash command timed out"),[`Your command timed out after ${Math.round(C.timeoutMs/1e3)} seconds or experienced an OOM error. Below is partial output:`,y,P].join(`
9
- `)}if(a.signal.aborted&&(await t.reset(s,"persistent bash command aborted"),a.signal.throwIfAborted()),b.text.includes(S.end)){const y=Y(T(e,s,d,b),S);if(y!==void 0)return x(y,i.maxOutputChars)}if(h.sessionStatus.kind==="exited"){const y=T(e,s,d,b);return await t.reset(s,"persistent bash shell exited"),[J(x(I(y,S,u,f),i.maxOutputChars),h.sessionStatus.exitCode,h.sessionStatus.signal),P].filter(R=>R.length>0).join(`
10
- `)}if(K(h))return x(I(T(e,s,d,b),S,u,f),i.maxOutputChars);await V()}}catch(a){o.error=a,o.hasError=!0}finally{W(o)}}l(Z,"executeCommand");function tt(e,t){const s=Q(e,t),r=new WeakMap,i=l(async(n,o)=>{const a=(r.get(n)??Promise.resolve()).then(o,o),d=a.then(()=>{},()=>{});r.set(n,d);try{return await a}finally{r.get(n)===d&&r.delete(n)}},"serialized");e.tools.register(H({name:"bash",description:t.description,parameters:{command:{type:"string",required:!0,description:"The bash command to run. Relative path is preferred in the command."}},output:{schema:{type:"string"},render:l((n,o)=>[{type:"text",text:o}],"render")},async execute(n,o){if(n.command.trim().length===0)throw new Error("command must be a non-empty string");const a=o.agent;if(a===void 0)throw new Error("bash requires an owning agent session");return i(a,async()=>(o.signal.throwIfAborted(),Z(e,s,a,n.command,t,o.signal)))},presentCall:l(n=>({card:"terminal",title:n.command}),"presentCall")}))}l(tt,"registerPersistentBash");const et="tool-bash-persistent",st=["tools","terminals"],rt=w.object({backendType:w.string().default("shell"),timeoutMs:w.number().default(3e5),maxOutputChars:w.number().default(16e3),description:w.string().default(A)});function nt(e,t){const s={backendType:t.backendType??"shell",timeoutMs:t.timeoutMs??3e5,maxOutputChars:t.maxOutputChars??16e3,description:t.description??A};if(s.backendType.trim().length===0)throw new Error("tool-bash-persistent: backendType must be non-empty");if(!Number.isSafeInteger(s.timeoutMs)||s.timeoutMs<=0)throw new Error("tool-bash-persistent: timeoutMs must be a positive safe integer");if(!Number.isSafeInteger(s.maxOutputChars)||s.maxOutputChars<=0)throw new Error("tool-bash-persistent: maxOutputChars must be a positive safe integer");if(s.description.trim().length===0)throw new Error("tool-bash-persistent: description must be non-empty");tt(e,s)}l(nt,"apply");export{rt as Config,nt as apply,st as inject,et as name};
1
+ var R=Object.defineProperty;var l=(e,t)=>R(e,"name",{value:t,configurable:!0});import{randomUUID as $}from"node:crypto";import S from"@deepseek-ai/schemastery";import{deadline as D,timeoutOf as L}from"@deepseek-ai/dsh-timeout";import{defineTool as j}from"@deepseek-ai/dsh-tools";var B=l(function(e,t,s){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var r,i;if(s){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],s&&(i=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");i&&(r=l(function(){try{i.call(this)}catch(n){return Promise.reject(n)}},"dispose")),e.stack.push({value:t,dispose:r,async:s})}else s&&e.stack.push({async:!0});return t},"__addDisposableResource"),H=(function(e){return function(t){function s(a){t.error=t.hasError?new e(a,t.error,"An error was suppressed during disposal."):a,t.hasError=!0}l(s,"fail");var r,i=0;function n(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(n);if(r.dispose){var a=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(a).then(n,function(o){return s(o),n()})}else i|=1}catch(o){s(o)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return l(n,"next"),n()}})(typeof SuppressedError=="function"?SuppressedError:function(e,t,s){var r=new Error(s);return r.name="SuppressedError",r.error=e,r.suppressed=t,r});const C="<response clipped><NOTE>To save on context only part of this file has been shown to you. You should retry this tool after you have searched inside the file with `grep -n` in order to find the line numbers of what you are looking for.</NOTE>",U=`<response clipped><NOTE>The beginning of this command output was dropped by the terminal scrollback limit. The following text is the earliest retained output.</NOTE>
2
+ `,k="The persistent bash shell was reset; the next bash call starts from the workspace with a fresh current directory and environment.",M="PERSISTENT_BASH_TIMEOUT",_=1e3,q=25,A="Run commands in a persistent bash shell. State, including the current directory and exported environment variables, persists across calls for this agent.";function z(e,t,s=!1){return e.length<=t&&!s?e:e.length<=t?e+C:e.slice(0,t)+C}l(z,"maybeTruncate");function G(){const e=$();return{start:`__DSH_PERSISTENT_BASH_START_${e}__`,end:`__DSH_PERSISTENT_BASH_END_${e}:`}}l(G,"markers");function T(e){return`$'${e.replaceAll("\\","\\\\").replaceAll("'","\\'").replaceAll("\r","\\r").replaceAll(`
3
+ `,"\\n")}'`}l(T,"quoteForBash");function F(e,t){return`printf '%s\\n' ${T(t.start)}; eval -- ${T(e)}; __dsh_persistent_bash_status=$?; printf '%s%s\\n' ${T(t.end)} "$__dsh_persistent_bash_status"`}l(F,"wrapCommand");function O(e){return e.replace(/\r?\n$/,"")}l(O,"trimTrailingNewline");function W(e,t){const s=e.text,r=s.lastIndexOf(t.end),i=/^(\d+)\r?\n/.exec(s.slice(r+t.end.length))?.[1];if(i===void 0)return;const n=s.lastIndexOf(t.start,r),a=n<0?0:n+t.start.length;return{text:O(s.slice(a,r).replace(/^\r?\n/,"")),incomplete:n<0,exitCode:Number(i)}}l(W,"commandOutput");function v(e,t,s,r=!1){const i=e.text.lastIndexOf(t.start);if(i>=0)return{text:O(e.text.slice(i+t.start.length).replace(/^\r?\n/,"")),incomplete:!1};const n=s.lastIndexOf(t.start),a=n<0?s:s.slice(n+t.start.length).replace(/^\r?\n/,""),o=a.lastIndexOf(t.end);return{text:O(o<0?a:a.slice(0,o)),incomplete:r||n<0}}l(v,"partialOutput");async function Y(){await new Promise(e=>setTimeout(e,q))}l(Y,"pause");function K(e,t){if(!(e.text.length===0||e.lineEnd<=t))return e.lineEnd}l(K,"nextScrollbackOffset");function w(e,t,s,r=e.terminals.read(t,s,{offset:0,count:_})){const i=r.text.length===0?[]:[r.text];let n=r.lineEnd,a=r.truncated;for(;!(n>=r.totalLines);){const o=e.terminals.read(t,s,{offset:n,count:_});a||=o.truncated,o.text.length>0&&i.unshift(o.text);const d=K(o,n);if(d===void 0||d>=o.totalLines)break;n=d}return{text:i.join(`
4
+ `),truncated:a}}l(w,"retainedScrollback");function x(e,t){const s=z(e.text,t,e.incomplete);return P(e.incomplete&&e.text.length>0?U+s:s,e.exitCode!==void 0&&e.exitCode!==0?`[exit code: ${e.exitCode}]`:void 0)}l(x,"renderCaptured");function P(e,t){return t===void 0?e:e.length===0?t:`${e}
5
+ ${t}`}l(P,"appendStatusMarker");function V(e,t,s){return P(e,s!==null?`[shell killed by signal: ${s}]`:t!==null?`[shell exited: code ${t}]`:"[shell exited]")}l(V,"renderShellExitStatus");function X(e,t){const s=new WeakMap,r=new Map,i=new Set,n=new WeakSet,a=new AbortController,o=l(async(c,p,u)=>{e.terminals.list(c).some(h=>h.sessionId===p)&&await e.terminals.kill(c,p,u)},"close");e.effect(()=>async()=>{a.abort(new Error("tool-bash-persistent disposed during shell creation")),await Promise.allSettled([...i]);const c=[...r].map(async([p,u])=>{await o(p,u,"tool-bash-persistent disposed")});await Promise.all(c),r.clear()},"tool-bash-persistent shell cleanup");const d=l(async(c,p)=>{s.delete(c);const u=r.get(c);r.delete(c),u!==void 0&&await o(c,u,p)},"reset");return{get:l((c,p)=>{const u=s.get(c);if(u!==void 0)return u;const h=AbortSignal.any([p,a.signal]),m=(async()=>{try{const f=c.session.header.cwd,g=await e.terminals.spawn(c,{type:t.backendType,...f===void 0?{}:{cwd:f}},h);r.set(c,g.sessionId),n.has(c)||(n.add(c),c.ctx.effect(()=>()=>{s.delete(c),r.delete(c)},"tool-bash-persistent owner cache cleanup"));const b=await e.terminals.startSend(c,g.sessionId,{text:"stty -echo",submit:!0,signal:h}).done;if(b.sessionStatus.kind==="exited"||b.waitReason==="timeout")throw new Error("persistent bash shell did not accept initialization");return g.sessionId}catch(f){throw await d(c,"persistent bash initialization failed"),f}})().finally(()=>{i.delete(m)});return i.add(m),s.set(c,m),m},"get"),reset:d}}l(X,"persistentShells");async function J(e,t,s,r,i,n){const a={stack:[],error:void 0,hasError:!1};try{const o=B(a,D(n,i.timeoutMs,M),!1),d=await t.get(s,o.signal),E=G(),c=F(r,E);let p=!0,u="",h=!1;for(;;){let m,f;try{m=e.terminals.startSend(s,d,{text:p?c:"",submit:p,signal:o.signal}),p=!1,f=await m.done}catch(y){throw await t.reset(s,"persistent bash send failed"),y}const g=m.readOutput();u=g.delta.length>0?u+g.delta:f.viewport,h||=g.truncated||f.truncated;const b=e.terminals.read(s,d,{offset:0,count:_}),I=L(o.signal,M);if(I!==void 0){const y=x(v(w(e,s,d,b),E,u,h),i.maxOutputChars);return await t.reset(s,"persistent bash command timed out"),[`Your command timed out after ${Math.round(I.timeoutMs/1e3)} seconds or experienced an OOM error. Below is partial output:`,y,k].join(`
6
+ `)}if(o.signal.aborted&&(await t.reset(s,"persistent bash command aborted"),o.signal.throwIfAborted()),b.text.includes(E.end)){const y=W(w(e,s,d,b),E);if(y!==void 0)return x(y,i.maxOutputChars)}if(f.sessionStatus.kind==="exited"){const y=w(e,s,d,b);return await t.reset(s,"persistent bash shell exited"),[V(x(v(y,E,u,h),i.maxOutputChars),f.sessionStatus.exitCode,f.sessionStatus.signal),k].filter(N=>N.length>0).join(`
7
+ `)}if(f.waitReason==="stdin_read")return x(v(w(e,s,d,b),E,u,h),i.maxOutputChars);await Y()}}catch(o){a.error=o,a.hasError=!0}finally{H(a)}}l(J,"executeCommand");function Q(e,t){const s=X(e,t),r=new WeakMap,i=l(async(n,a)=>{const o=(r.get(n)??Promise.resolve()).then(a,a),d=o.then(()=>{},()=>{});r.set(n,d);try{return await o}finally{r.get(n)===d&&r.delete(n)}},"serialized");e.tools.register(j({name:"bash",description:t.description,parameters:{command:{type:"string",required:!0,description:"The bash command to run. Relative path is preferred in the command."}},output:{schema:{type:"string"},render:l((n,a)=>[{type:"text",text:a}],"render")},async execute(n,a){if(n.command.trim().length===0)throw new Error("command must be a non-empty string");const o=a.agent;if(o===void 0)throw new Error("bash requires an owning agent session");return i(o,async()=>(a.signal.throwIfAborted(),J(e,s,o,n.command,t,a.signal)))},presentCall:l(n=>({card:"terminal",title:n.command}),"presentCall")}))}l(Q,"registerPersistentBash");const Z="tool-bash-persistent",tt=["tools","terminals"],et=S.object({backendType:S.string().default("shell"),timeoutMs:S.number().default(3e5),maxOutputChars:S.number().default(16e3),description:S.string().default(A)});function st(e,t){const s={backendType:t.backendType??"shell",timeoutMs:t.timeoutMs??3e5,maxOutputChars:t.maxOutputChars??16e3,description:t.description??A};if(s.backendType.trim().length===0)throw new Error("tool-bash-persistent: backendType must be non-empty");if(!Number.isSafeInteger(s.timeoutMs)||s.timeoutMs<=0)throw new Error("tool-bash-persistent: timeoutMs must be a positive safe integer");if(!Number.isSafeInteger(s.maxOutputChars)||s.maxOutputChars<=0)throw new Error("tool-bash-persistent: maxOutputChars must be a positive safe integer");if(s.description.trim().length===0)throw new Error("tool-bash-persistent: description must be non-empty");Q(e,s)}l(st,"apply");export{et as Config,st as apply,tt as inject,Z as name};
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-bash-persistent","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/dsh-terminal":"^0.0.15","@deepseek-ai/dsh-timeout":"^0.0.15","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-tools":"^0.0.15","@deepseek-ai/dsh-agent":"^0.0.15"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-bash-persistent","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-terminal":"^0.1.0","@deepseek-ai/dsh-timeout":"^0.1.0","@deepseek-ai/dsh-tools":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-call-timeout-policy","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/dsh-llm":"^0.0.15","@deepseek-ai/dsh-timeout":"^0.0.15","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-tools":"^0.0.15"}}
1
+ {"name":"@deepseek-ai/dsh-tool-call-timeout-policy","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-timeout":"^0.1.0","@deepseek-ai/dsh-tools":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"}}
@@ -16,7 +16,7 @@ Only valid while the agent has produced nothing: swapping tools mid conversation
16
16
 
17
17
  The swap is a parent re-link, not an unmount: standing mounts are shared and permanent, so the old composition stays for its other agents and the new one is ensured BEFORE the link moves. An unknown or unusable preset therefore throws with the agent exactly as it was — there is no torn-down state to restore. The re-link runs through the binding this roster kept from the agent's mount — dsh-scope's only re-link authority. An agent that never composed one has nothing to re-link: the switch is then the agent's first bind, exactly a mount.`,parameters:[{name:"agentCtx",description:"the agent's scope context."},{name:"id",description:"the preset to compose the agent from instead."}],returns:"the preset now installed.",throws:["when the preset is unknown or its composition is unusable."]},{signature:"async standingKeyFor(id?: string): Promise<ScopeKey>",description:`The standing scope key of one preset, for a host reader with no agent.
18
18
 
19
- A cold transcript read resolves tool presenters against the composition the session recorded, and the standing mount makes that possible without resuming anything: ensuring the mount composes plugins but starts no agent, no session, and no turn.`,parameters:[{name:"id",description:"the preset id, or `undefined` for {@link defaultId}."}],returns:"the standing scope key readers pass as a registry view scope.",throws:["when the preset is unknown or its composition is unusable."]}]},{key:"agents",summary:"Agent service (`ctx.agents`): tracks live agents and carries the initiating Agent through one process-local asynchronous driver chain.",description:"Agent service (`ctx.agents`): tracks live agents and carries the initiating Agent through one process-local asynchronous driver chain. Agent *creation* is provided by whichever plugin implements the AgentFactory (`@deepseek-ai/dsh-agent-loop`), registered via setFactory.\n\nInitiator methods provide same-process causal attribution only. Ambient presence is neither liveness proof nor authorization; subjects and owners remain explicit, as does identity at worker, process, persistence, and wire boundaries. Returned Promise boundaries drain during teardown, except a nested lineage that starts an owning-fiber unload is excluded from its own drain.",methods:[{signature:"currentInitiator(): Agent | undefined",description:"Read the Agent that initiated the inherited asynchronous driver chain. Use this optional form for logging, tracing, metrics, or host attribution that also supports agentless calls. When a parent creates a child, setup reports the causal parent while `agentCtx.agent` identifies the child.",parameters:[],returns:"the inherited Agent, or `undefined` outside an initiator boundary and inside an explicit clearing boundary.",throws:["when this service instance has been disposed."]},{signature:"requireInitiator(): Agent",description:"Read the initiating Agent and fail when no initiator boundary is active. Use this for private helpers contractually below a driver, or for a deployment-owned outbound request whose contract forbids agentless calls. Generic or direct-call paths use optional lookup or explicit request fields.",parameters:[],returns:"the inherited Agent.",throws:["when no initiator is active or this service instance has been disposed."]},{signature:"withInitiator<T>(agent: Agent, operation: () => T): T",description:"Run an operation with one exact Agent as its process-local initiator. The exact synchronous value or Promise returned by the operation is preserved. Custom drivers and test harnesses wrap their complete returned foreground lifetime. A queue or wire receiver may establish this boundary only after validating explicit identity and resolving the exact live Agent; this method does neither. Detached work remains owned by the subsystem that starts it.",parameters:[{name:"agent",description:"initiating Agent to inherit; presence is neither liveness proof nor authorization."},{name:"operation",description:"synchronous or asynchronous operation to invoke."}],returns:"the exact value returned by `operation`.",throws:["when the initiator scope is closing/disposed, or when `operation` throws."]},{signature:"withoutInitiator<T>(operation: () => T): T",description:"Run an operation inside a boundary that hides any inherited initiating Agent. The exact synchronous value or Promise is preserved. Use this while creating lazy shared timers, queue pumps, pool maintenance, watchers, or exporters so they do not inherit the first Agent that happens to initialize them. It clears only initiator attribution, not explicit fields, and does not own or drain detached resources.",parameters:[{name:"operation",description:"synchronous or asynchronous operation to invoke without an initiator."}],returns:"the exact value returned by `operation`.",throws:["when the initiator scope is closing/disposed, or when `operation` throws."]},{signature:"setFactory(factory: AgentFactory): () => void",description:"Register the agent-creation factory (the loop calls this on construction, effect-scoped). A traced Cordis service is canonicalized to its concrete target; each create/resume call is then traced through that caller's context so ownership follows the caller without stacking proxy layers. Throws if a factory is already registered. Returns the disposer; on dispose the factory slot is cleared.",parameters:[{name:"factory",description:"the loop-owned factory {@link create}/{@link resume} delegate to."}],returns:"the disposer that clears the factory slot. The exact Cordis effect disposer (single-shot): composite (generator) effects may yield it directly — exact identity nests the teardown in order."},{signature:"async create(options: CreateAgentOptions): Promise<AgentHandle>",description:"Create and publish a new agent through the registered factory. Distinct from register (which records an already-constructed agent): this constructs the agent and its session. Rejects if no factory is registered or creation/setup fails. The resolved AgentHandle lets the owner tear down exactly this agent.",parameters:[{name:"options",description:"shared identity, session seed/metadata, and agent options."}],returns:"the handle after setup, rollback-covered publication, and loop start complete."},{signature:"async resume(options: ResumeAgentOptions): Promise<AgentHandle>",description:"Load a persisted session and resume an agent on it through the registered factory. Rejects if no factory is registered; the factory rejects if session persistence is not configured or persistence/setup fails.",parameters:[{name:"options",description:"persisted identity, configuration, and optional setup."}],returns:"the handle after setup, rollback-covered publication, and loop start complete."},{signature:"register(agent: Agent): () => void",description:"Register a live agent. Throws if an agent with the same id is already registered. Emits `agent/created` on registration and `agent/disposed` when the calling fiber is disposed — both with the agent's scope carrier (`scopeTarget(agent, agent)`): the subject is the agent in hand, so the emits are scope-filtered regardless of which context invoked `register` (calling through `agent.ctx` scopes EFFECTS; dispatch scoping always requires passing the carrier). Returns the disposer.",parameters:[{name:"agent",description:"the already-constructed agent to record in the store."}],returns:"the EXACT Cordis effect disposer (single-shot; a repeat call returns undefined without awaiting an in-flight teardown). Exact identity is load-bearing: a composite (generator) effect that owns a teardown ORDER — the agent factory's lifecycle chain — must yield THIS function so Cordis nests the unregistration at that yield position; yielding a wrapper would leave it disposing as a concurrent sibling on owner unload, unregistering the agent (and emitting `agent/disposed`) while its final turn is still draining."},{signature:"enter(agent: Agent, owner: Agent | undefined): () => void",description:"Insert an already-constructed agent without announcing it. This is the advanced ordered-lifecycle primitive used by the async agent factory: it first completes setup while the agent is unpublished, then assigns the returned detach closure into its pre-installed composite teardown before calling announce. Ordinary callers use register.",parameters:[{name:"agent",description:"the prepared, unpublished agent."},{name:"owner",description:"live agent whose scoped context created this agent, or undefined for a top-level runtime root. This is runtime ownership, not the resumed session's durable parent lineage."}],returns:"an idempotent closure that removes this exact entry and emits `agent/disposed` with listener failures contained. When called from a synchronous `agent/created` listener, removal and disposal wait until that creation dispatch unwinds."},{signature:"announce(agent: Agent): void",description:"Announce an agent previously inserted with enter.",parameters:[{name:"agent",description:"the live inserted agent to announce."}],throws:["if `agent` is not the exact live registry entry for its id, or its creation announcement already began (including a reentrant call from a creation listener)."]},{signature:"get(id: SessionId): Agent | undefined",description:"Look up a live agent.",parameters:[{name:"id",description:"the shared agent/session id to look up."}],returns:"the agent, or undefined when no live agent has that id."},{signature:"isOwnedBy(id: SessionId, owner: Agent): boolean",description:"Test whether a live agent was created through one exact parent agent's scoped context. Runtime ownership is independent of durable session lineage and remains unambiguous when unrelated providers reuse an id.",parameters:[{name:"id",description:"the candidate child agent's shared agent/session id."},{name:"owner",description:"the expected runtime creator agent."}],returns:"true only while the exact child entry is live under that owner."},{signature:"list(): Agent[]",description:"All live agents, in registration order.",parameters:[],returns:"a fresh array; mutating it does not affect the registry."},{signature:"roots(): Agent[]",description:"All live top-level agents in registration order. A top-level agent was created without an owning agent context; durable session lineage does not affect this runtime relation, so a resumed fork may still be a root.",parameters:[],returns:"a fresh array; mutating it does not affect the registry."}]},{key:"apiProxy",summary:"Root interface of the unified API.",description:"Root interface of the unified API. New client-request domain = one new file pair + one field here + one map row.",methods:[{signature:"downloads: DownloadsApi",description:"Host-only download surfaces (GET, no wire envelope); absent from IApiClient.",parameters:[]},{signature:"respond(message: ClientResponse): Promise<RpcReceipt>",description:"Response entry for server requests; not a domain method.",parameters:[{name:"message",description:"Client response carrying the server request's rpcId."}],returns:"Transport receipt for the response delivery."}]},{key:"approval",summary:"Approval service that applies session policy before answerers and logs every ask/outcome pair to the requesting session.",description:"Approval service that applies session policy before answerers and logs every ask/outcome pair to the requesting session. It exposes deterministic policy changes to the model through the runtime-context snapshot and switch notices.",methods:[{signature:"setPolicy(agent: Agent, policy: ApprovalPolicy): void",description:"Switch one live agent's policy and queue the transition for its next model step. Session initialization uses setApprovalPolicy directly because there is no previously visible policy to change.",parameters:[{name:"agent",description:"the live agent whose policy is changing."},{name:"policy",description:"the new effective policy."}]},{signature:"async request(req: ApprovalRequest): Promise<ApprovalOutcome>",description:"Ask the composed answerers to decide one readonly same-process request. The service borrows the request, agent, session, and live signal directly. The request requires an open turn because the audit pair must be enclosed by the durable log's commit/replay boundary; an idle ask rejects before appending anything. The answerer phase always produces an outcome: an aborted signal yields `'cancelled'`, a missing or throwing answerer yields `'unavailable'` (fail closed), and a rogue non-vocabulary return value is normalized to `'unavailable'`. A failure that prevents either audit append from committing still rejects because returning an unlogged decision would violate the pair. Session contains post-commit observer failures, so an authoritative append cannot reject the request or suppress its matching audit event.",parameters:[{name:"req",description:"the pending decision (agent, tool identity, reason, signal)."}],returns:"the closed outcome; `'allowed-once'` is the only grant.",throws:["when no turn is open or either audit event fails before the session append commit point."]},{signature:"overrideOf(session: Session): ApprovalPolicy | undefined",description:"Read the session override without applying the configured default.",parameters:[{name:"session",description:"session whose log supplies the override."}],returns:"the last logged policy, or `undefined` without one."}]},{key:"attachments",summary:"Immutable binary attachment service.",description:"Immutable binary attachment service. Implementations validate bytes before publishing a reference.",methods:[{signature:"abstract readonly imageLimits: ImageAttachmentLimits",description:"Deployment-resolved image policy used by authoritative and fast-path validation.",parameters:[]},{signature:"abstract validateImage(input: SaveImageAttachment): Promise<void>",description:"Validate one image without persisting it. Batch callers validate every member before saving any member.",parameters:[{name:"input",description:"encoded bytes, declared media type, and optional display name."}],returns:"completion after the encoded raster has been fully decoded."},{signature:"abstract saveImage(input: SaveImageAttachment): Promise<ImageAttachmentRef>",description:"Validate and durably commit one image before its owning session event is appended.",parameters:[{name:"input",description:"encoded bytes, declared media type, and optional display name."}],returns:"a durable content-addressed reference."},{signature:"abstract readImage(ref: ImageAttachmentRef, signal?: AbortSignal): Promise<StoredImageAttachment>",description:"Read one image and verify that bytes still match the recorded reference.",parameters:[{name:"ref",description:"durable reference from the session log."},{name:"signal",description:"optional cancellation for backend read and verification work."}],returns:"the verified bytes and canonical reference.",throws:["the signal reason when aborted, or a storage error when verification fails."]}]},{key:"clientModules",summary:"The web plugin table service: incremental `dsh.client` scan + wire composition + bundle route + index tap.",description:"The web plugin table service: incremental `dsh.client` scan + wire composition + bundle route + index tap. Construction runs the activation scan synchronously — a malformed declaration or missing bundle among the already-loaded entries aggregates into one loud throw (FAILED fiber; the boot activation audit reports it).",methods:[{signature:"graph(): WebBootGraph",description:"Current composed entry graph (stable object between changes).",parameters:[],returns:"the graph served as `window.__DSH_BOOT__`."},{signature:"clientPath(id: string): string | undefined",description:"Absolute path of an entry's client bundle.",parameters:[{name:"id",description:"entry id (package name)."}],returns:"the path, or undefined for an unknown id."},{signature:"rebuilt(id: string): string | undefined",description:"Re-hash one bundle (the HMR watch's registration hook — the only entry point through which bundle content changes reach the graph).",parameters:[{name:"id",description:"entry id (package name)."}],returns:"the new rev, or undefined for an unknown id."},{signature:"onRebuilt(listener: (id: string, rev: string) => void): () => void",description:"Subscribe to bundle rebuilds; fires only when the re-hash changed the rev.",parameters:[{name:"listener",description:"receives the entry id and its new bundle rev."}],returns:"the unsubscriber."},{signature:"onGraphChanged(listener: () => void): () => void",description:"Fires after any flush that recomposed the graph (row added/removed, or a rebuilt rev change). Pull model: listeners re-read graph.",parameters:[{name:"listener",description:"notified with no payload."}],returns:"the unsubscriber."}]},{key:"codeRuntime",summary:"Registers one `ctx.codeRuntime` implementation.",description:"Registers one `ctx.codeRuntime` implementation. Program, budget, abort, and substrate failures resolve in CodeRunResult; only Service Definition contract misuse rejects. Implementations bridge structured-cloneable bindings, materialize each declared namespace rejection class, treat programs as hostile peers, isolate runs from one another, and terminate and await in-flight runs during disposal.",methods:[{signature:"abstract readonly language: string",description:"The source language run expects `program` to be written in, as a lowercase identifier. Informational, not gating — a consumer that generates language-specific presentation (typed SDK stubs, usage instructions) switches on it and fails loud on a language it cannot present. Well-known values: `'typescript'` and `'python'`, those `dsh-tools` presents; only `'typescript'` has a published backend.",parameters:[]},{signature:"abstract readonly isolation: string",description:"The execution substrate, as a lowercase identifier. Informational, not gating — a descriptor so deployments and diagnostics can tell backends apart, not a security claim. Well-known values: `'worker-thread'`, `'process'`, `'container'`.",parameters:[]},{signature:"abstract run(request: CodeRunRequest): Promise<CodeRunResult>",description:"Execute one program against the request's bindings and capture what it emitted. See the class doc for the resolution contract (error is a result field; rejection means Service Definition contract misuse only).",parameters:[{name:"request",description:"the program, its bindings, and the abort signal; the request carries everything the runtime acts on, with no hidden defaults."}],returns:"the run's outcome: completion value (when transferable), the ordered log capture, and the failure (if any)."}]},{key:"commands",summary:"Human-command registry.",description:"Human-command registry. Plain-context definitions are global; definitions registered through a command-injected child of an agent context shadow globals for that agent.",methods:[{signature:"register(definition: CommandDefinition): () => void",description:"Register a global or calling-agent-scoped command.",parameters:[{name:"definition",description:"discovery metadata and direct UI handler."}],returns:"the exact effect disposer that unregisters this definition."},{signature:"@Remote list(agent: Agent): readonly CommandDescriptor[]",description:"List the effective immutable command descriptors for one agent.",parameters:[{name:"agent",description:"exact receiving agent and scoped-layer key."}],returns:"name-sorted descriptors after scoped shadowing."},{signature:"find(agent: Agent, name: string): CommandDefinition | undefined",description:"Resolve one effective command definition.",parameters:[{name:"agent",description:"exact receiving agent and scoped-layer key."},{name:"name",description:"command name without a slash."}],returns:"the scoped shadow or global definition."},{signature:"@Remote async execute( agent: Agent, line: string, signal: AbortSignal, ): Promise<CommandExecution | undefined>",description:"Parse and execute a known command without sending it to the model.\n\nA resolved command's lifecycle is logged: `command/run` is appended before the handler is invoked and `command/done` after settlement (a thrown or aborted handler settles as `kind: 'error'`). Both are direct log-only appends — no turn wraps them, and persistence drains them at ordinary checkpoints. Admission misses (syntax or unknown name) log nothing — they never entered a handler. A `command/run` append failure fails the execution loud; a `command/done` append failure on the handler-failure path is contained so the handler's own error stays the reported failure.",parameters:[{name:"agent",description:"exact receiving agent."},{name:"line",description:"complete slash-command line."},{name:"signal",description:"cancellation signal owned by the UI request."}],returns:"the settled execution (result + lifecycle pairing id), or `undefined` when syntax or name does not resolve."}]},{key:"compaction",summary:"Abstract compaction service.",description:"Abstract compaction service. Implementations own trigger policy, retention, and summarization, and may consume a separate measurement service. A successful run replaces the selected surface span with one summary node and prevents concurrent compaction of the same session. The replacement user message uses compactCheckpointSource with the transaction identity so consumers recognize and correlate it independently of the backend. Load one implementation per context as `ctx.compaction`.",methods:[{signature:"abstract compactIfNeeded( agent: CompactionAgentContext, trigger: CompactionTrigger, signal: AbortSignal, ): Promise<CompactionResult | null>",description:"Consider automatic compaction for one explicit trigger. Pressure policy uses the latest durable routed request, while context-overflow policy may force a useful balanced reduction even below the normal threshold. Return `null` when no safe range can be compacted. A single oversized retained unit or request envelope cannot be repaired through surface compaction.",parameters:[{name:"agent",description:"agent context owning the session surface and routing options."},{name:"trigger",description:"normal pressure or provider-confirmed context overflow."},{name:"signal",description:"cancellation signal; model-backed implementations must forward it."}],returns:"the compaction result, or `null` if no compaction was needed."},{signature:"abstract compactNow( agent: ManualCompactAgentContext, signal: AbortSignal, sourceCommandId?: CommandId, ): Promise<CompactionResult | null>",description:"Explicitly compact useful history even below automatic pressure thresholds. Implementations synchronously start an idle task before any asynchronous work, select a useful range without writing on a no-op, then append a standalone `compaction/start` before summarization. That durable marker is the compaction lock until one `compaction/end` attempt. Later waking prompts remain accepted in FIFO order and start only after the optional durability checkpoint and idle-task settlement. Context injected while the summary runs may sit between the marker pair; only the selected span must remain stable.",parameters:[{name:"agent",description:"idle agent whose durable history should be compacted."},{name:"signal",description:"cancellation scoped to this compaction request."},{name:"sourceCommandId",description:"initiating command identity for a manual compaction."}],returns:"the compaction result, or `null` when no safe useful range exists.",throws:["{@link ManualCompactionError} for expected busy, agent-cancellation, changed-span, summarization/shrink, commit-stage, or persistence failures; an aborted request preserves its exact abort reason. Failed attempts remain visible in the log."]},{signature:"abstract compactRegion( start: number, end: number, agent: CompactionAgentContext, signal?: AbortSignal, ): Promise<CompactionResult>",description:"Forcibly compact a range of surface nodes into a single summary node. `start` and `end` name an inclusive span by surface position, not numeric seq order; replacements can make visible seqs non-monotonic. Both edges must be balanced so assistant tool calls remain paired with their results. A model- backed implementation forwards cancellation and rejects active, missing, reversed, or unbalanced ranges. The target session is `agent.session`. Its replacement user message must use compactCheckpointSource with the transaction's `CompactionId`. Use toolPairingBalancedBefore and toolPairingBalancedAfter for the edge checks.",parameters:[{name:"start",description:"first surface seq, inclusive."},{name:"end",description:"last surface seq, inclusive."},{name:"agent",description:"context whose session is mutated and whose routing options guide summarization."},{name:"signal",description:"optional cancellation; model-backed implementations must forward it."}],returns:"the appended event seqs, summary, replaced range, and token accounting.",throws:["when compaction is active or the range is missing, reversed, or unbalanced."]}]},{key:"contentReview",summary:"The content-review service.",description:"The content-review service. A denied text throws ContentReviewFailedError carrying the client-visible replacement text; every other failure propagates as the transport's own error, leaving the caller to decide whether an unavailable reviewer blocks the request.",methods:[{signature:"async review(request: ContentReviewRequest): Promise<ContentReviewResult>",description:"Submit one text for review.",parameters:[{name:"request",description:"the text, its conversation stage, and an optional correlation id."}],returns:"the backend correlation id when the text is allowed."}]},{key:"credentials",summary:"Abstract credential service.",description:"Abstract credential service. Providers implement the four operations over their source layers; one seam-wide rule binds them all: an empty stored value is absent everywhere — `resolve` skips it, `describe` reports it unconfigured — so a blank never masquerades as a configured secret.",methods:[{signature:"abstract resolve(ref: CredentialRef): Promise<ResolvedCredential | undefined>",description:"Resolve one reference to its current value. Resolution is per call: consumers re-resolve at each operation and must not cache across operations — that per-operation read is what makes a changed credential reach the next operation without a restart.",parameters:[{name:"ref",description:"the reference to resolve."}],returns:"the value and its source, or `undefined` while unconfigured."},{signature:"abstract describe(ref: CredentialRef): Promise<CredentialInfo>",description:"Describe one reference for configuration surfaces without exposing the value.",parameters:[{name:"ref",description:"the reference to describe."}],returns:"configured state, supplying source, and writability."},{signature:"abstract set(ref: CredentialRef, value: string): Promise<void>",description:"Durably store one value in the provider-managed writable source. Rejects while a read-only source shadows the reference — the write would appear to succeed while resolution keeps returning the shadowing value — and rejects an empty value (use unset).",parameters:[{name:"ref",description:"the reference to store."},{name:"value",description:"the non-empty secret value."}]},{signature:"abstract unset(ref: CredentialRef): Promise<void>",description:"Remove one reference from the provider-managed writable source; removing an absent reference is a no-op. Rejects while a read-only source shadows the reference, like set.",parameters:[{name:"ref",description:"the reference to remove."}]}]},{key:"directoryPicker",summary:"Abstract directory-picking service.",description:"Abstract directory-picking service. Subclass, implement `capability()`, and load the subclass as a plugin — it registers as `ctx.directoryPicker` (one implementation per context; loading a second throws, cordis' standard duplicate-service behavior). The capability object must be stable for the service lifetime: consumers may capture it across calls.",methods:[{signature:"abstract capability(): DirectoryPickerCapability",description:"The backend's interaction capability.",parameters:[],returns:"the discriminated capability consumers switch on."}]},{key:"e2b",summary:"Creates one lazily consumable E2B SDK handle and deletes the sandbox at timeout or disposal.",description:"Creates one lazily consumable E2B SDK handle and deletes the sandbox at timeout or disposal. Creation begins at plugin construction; adapters await getSandbox before their first operation.",methods:[{signature:"readonly cwd: string",description:"Validated remote working directory shared by provider adapters.",parameters:[]},{signature:"readonly runtimeRoot: string",description:"Remote directory reserved for adapter-owned process and terminal state.",parameters:[]},{signature:"async getSandbox(): Promise<Sandbox>",description:"Return the shared live SDK handle.",parameters:[],returns:"the created sandbox after the configured cwd exists.",throws:["when E2B rejects creation or the service is disposing."]}]},{key:"fs",summary:"Abstract filesystem provider.",description:"Abstract filesystem provider. Targets must preserve identity across aliases; reads expose regular UTF-8 text or typed errors, listings are stable and content-free, and mutations are atomic. Optional guards add stale protection without changing the unguarded provider contract.",methods:[{signature:"abstract resolve(path: string, opts?: { cwd?: string; signal?: AbortSignal }): Promise<FsTarget>",description:"Resolve a model/plugin-supplied path into a stable FsTarget. May perform I/O (a remote/sandboxed backend may need a round-trip to map a path to a stable identity), hence async even though the local backend only normalizes + realpaths.",parameters:[{name:"path",description:"the path to resolve; relative paths resolve against `opts.cwd`."},{name:"opts",description:"optional cwd override and cancellation signal."}],returns:"the stable target; the same file yields the same `targetKey`."},{signature:"abstract processPath(target: FsTarget): string",description:"Return the canonical absolute path a subprocess in this filesystem's execution world can open. The path is deliberately separate from FsTarget.targetKey: consumers may pass this value to another OS capability, but must continue treating the target key as opaque.",parameters:[{name:"target",description:"the resolved target whose process path is required."}],returns:"an absolute path in the backend's execution world."},{signature:"abstract fileUrl(target: FsTarget): string",description:"Return the canonical `file:` URI for a target in this filesystem's execution world. Backends own URI encoding because the host platform may differ from the execution platform.",parameters:[{name:"target",description:"the resolved target to encode."}],returns:"the target's canonical file URI."},{signature:"abstract contains(parent: FsTarget, child: FsTarget): boolean",description:"Test canonical containment without exposing or parsing backend target keys. Both targets must come from this provider.",parameters:[{name:"parent",description:"canonical directory target."},{name:"child",description:"canonical candidate target."}],returns:"true when `child` is `parent` or a descendant of it."},{signature:"abstract stat(target: FsTarget, signal?: AbortSignal): Promise<FsInfo | undefined>",description:"Return target metadata, or `undefined` when the target does not exist.",parameters:[{name:"target",description:"the resolved target to stat."},{name:"signal",description:"aborts the metadata round-trip."}],returns:"metadata only, never content; undefined for an absent target."},{signature:"abstract lstat(path: string, opts?: { cwd?: string }, signal?: AbortSignal): Promise<FsPathInfo | undefined>",description:"Return path metadata without following the final path component when it is a symbolic link. This is intentionally path-shaped, not target-shaped: resolve follows symlinks to produce the stable identity used by normal reads/writes, while `lstat` lets a consumer reject the path itself before that follow happens.\n\n`opts.cwd` follows resolve's cwd rules. `undefined` means the path is absent.",parameters:[{name:"path",description:"the path to inspect; relative paths resolve against `opts.cwd`."},{name:"opts",description:"`cwd` overrides the backend's default base for relative paths."},{name:"signal",description:"aborts the metadata round-trip."}],returns:"metadata only, never content; undefined for an absent path."},{signature:"abstract readText(target: FsTarget, signal?: AbortSignal): Promise<string>",description:"Read the whole regular text file as a single decoded string.",parameters:[{name:"target",description:"the resolved target to read."},{name:"signal",description:"aborts the read."}],returns:"the full decoded UTF-8 content."},{signature:"abstract streamText(target: FsTarget, signal?: AbortSignal): Promise<AsyncIterable<string>>",description:"Stream the whole regular text file as decoded text chunks (same text semantics as readText, for large files). The backend owns cross-chunk UTF-8 decoding and binary rejection so the policy layer never touches raw bytes.",parameters:[{name:"target",description:"the resolved target to read."},{name:"signal",description:"aborts the stream, including between chunks."}],returns:"the chunk iterable, decoded and validated like {@link readText}."},{signature:"abstract readBytes(target: FsTarget, signal: AbortSignal | undefined, maxBytes: number): Promise<Uint8Array>",description:"Read the whole regular file as raw bytes with no decoding or binary rejection. The bound lives at this seam so a backend can never buffer an unbounded file: a target known or discovered to exceed `maxBytes` fails with `FS_TOO_LARGE` instead of returning a truncated result.",parameters:[{name:"target",description:"the resolved target to read."},{name:"signal",description:"aborts the read."},{name:"maxBytes",description:"inclusive byte cap on the complete content."}],returns:"the full raw content, at most `maxBytes` long."},{signature:"abstract listDir(target: FsTarget, signal?: AbortSignal): Promise<FsDirEntry[]>",description:"List direct children of a directory in stable name order. Returns resolved child targets plus cheap metadata only; never reads file contents.",parameters:[{name:"target",description:"the resolved directory target."},{name:"signal",description:"aborts the listing."}],returns:"one entry per direct child, in stable name order."},{signature:"abstract writeText( target: FsTarget, content: string, expected?: FsWriteIntent, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise<FsWriteOutcome>",description:"Atomically create or replace UTF-8 text. `expected` guards intent and staleness; omission allows unconditional overwrite.",parameters:[{name:"target",description:"the resolved target to write."},{name:"content",description:"the full new file content."},{name:"expected",description:"the write intent guarding the write; omit for unconditional."},{name:"signal",description:"aborts before atomic publication takes effect."},{name:"sandboxPolicy",description:"the per-call mode and workspace root this write runs under; a sandboxing backend fences the write by it, the bare backend ignores it. Omit to leave the backend its own default."}],returns:"the outcome, including the version the write produced."},{signature:"abstract editText( target: FsTarget, edit: FsEditRequest, expected?: { version: FsVersion }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise<FsEditOutcome>",description:"Atomically edit literal text. When supplied, the version guard is checked before matching so stale content reports `FS_STALE_VERSION`; omission edits the current content without a freshness precondition.",parameters:[{name:"target",description:"the resolved target to edit."},{name:"edit",description:"the literal search/replace request."},{name:"expected",description:"the version guard; omit for an unconditional edit."},{name:"signal",description:"aborts before atomic publication takes effect."},{name:"sandboxPolicy",description:"the per-call mode and workspace root this edit runs under; a sandboxing backend fences the edit by it, the bare backend ignores it. Omit to leave the backend its own default."}],returns:"the outcome, including the version the edit produced."}]},{key:"goals",summary:"Goal service (`ctx.goals`) backed exclusively by the owning session log.",description:"Goal service (`ctx.goals`) backed exclusively by the owning session log.",methods:[{signature:"get(agent: Agent): GoalView | undefined",description:"Read the current goal for one exact live agent.",parameters:[{name:"agent",description:"owning live agent."}],returns:"a fresh view or `undefined` when no goal is current.",throws:["{@link GoalError} when the agent is not the registry's live instance."]},{signature:"disarm(agent: Agent): GoalView | undefined",description:"Remove process-local continuation authority without changing durable goal phase or revision. Lifecycle owners use this before unloading a driver; a later human-authorized resume records the new activation edge.",parameters:[{name:"agent",description:"owning live agent."}],returns:"a fresh disarmed view, or `undefined` when no goal is current."},{signature:"create(agent: Agent, request: CreateGoalRequest): GoalView",description:"Create and arm a goal. A completed goal may be replaced; every other current phase must be cleared or resumed instead.",parameters:[{name:"agent",description:"owning live agent."},{name:"request",description:"objective and optional round cap."}],returns:"the created live view."},{signature:"@Remote('edit') edit(agent: Agent, ref: GoalRef, request: EditGoalRequest): GoalView",description:"Edit objective and/or round cap without changing phase.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."},{name:"request",description:"at least one replacement field."}],returns:"the edited view."},{signature:"@Remote('pause') pause(agent: Agent, ref: GoalRef): GoalView",description:"Pause an active goal and disarm automatic continuation.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."}],returns:"the paused view."},{signature:"@Remote('resume') resume(agent: Agent, ref: GoalRef): GoalView",description:"Resume and arm a stopped goal, or rearm an active goal after a session-start edge, while its round budget still has capacity.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."}],returns:"the active view."},{signature:"@Remote('complete') complete(agent: Agent, ref: GoalRef): GoalView",description:"Mark a current non-complete goal complete and disarm it.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."}],returns:"the completed view."},{signature:"block(agent: Agent, ref: GoalRef, reason: GoalBlockReason): GoalView",description:"Mark an active goal blocked and disarm it.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."},{name:"reason",description:"policy-owned stable code and human-readable explanation."}],returns:"the blocked view with its durable reason."},{signature:"@Remote('clear') clear(agent: Agent, ref: GoalRef): GoalRef",description:"Clear the current goal while retaining a durable tombstone and history.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."}],returns:"the tombstone ref whose revision is one past the cleared snapshot."},{signature:"@Remote('create') remoteExportCreate(agent: Agent, request: CreateGoalRequest): CreateGoalResult",description:"Create one Goal through the remote boundary.",parameters:[{name:"agent",description:"exact live Agent resolved from the wire identity."},{name:"request",description:"objective and optional round cap."}],returns:"the created Goal identity."}]},{key:"invariants",summary:"Package-owned invariant registry with global and regex-based selection.",description:"Package-owned invariant registry with global and regex-based selection.",methods:[{signature:"register(packageName: string, installer: InvariantInstaller): () => void",description:"Register one package's invariant installer. The package name is reserved even when filtering disables its checks. Enabled installers run in a child fiber; failure disposes that fiber and releases the reservation.",parameters:[{name:"packageName",description:"full npm package name that owns the contribution."},{name:"installer",description:"listener or startup-check installer for the child context."}],returns:"an effect-scoped disposer for the registration."}]},{key:"jobs",summary:"Abstract background job registry.",description:`Abstract background job registry. Subclass, implement the abstract methods, and load the subclass as a plugin — it registers as \`ctx.jobs\` (one implementation per context; loading a second throws, which is cordis' standard duplicate-service behavior).
19
+ A cold transcript read resolves tool presenters against the composition the session recorded, and the standing mount makes that possible without resuming anything: ensuring the mount composes plugins but starts no agent, no session, and no turn.`,parameters:[{name:"id",description:"the preset id, or `undefined` for {@link defaultId}."}],returns:"the standing scope key readers pass as a registry view scope.",throws:["when the preset is unknown or its composition is unusable."]}]},{key:"agents",summary:"Agent service (`ctx.agents`): tracks live agents and carries the initiating Agent through one process-local asynchronous driver chain.",description:"Agent service (`ctx.agents`): tracks live agents and carries the initiating Agent through one process-local asynchronous driver chain. Agent *creation* is provided by whichever plugin implements the AgentFactory (`@deepseek-ai/dsh-agent-loop`), registered via setFactory.\n\nInitiator methods provide same-process causal attribution only. Ambient presence is neither liveness proof nor authorization; subjects and owners remain explicit, as does identity at worker, process, persistence, and wire boundaries. Returned Promise boundaries drain during teardown, except a nested lineage that starts an owning-fiber unload is excluded from its own drain.",methods:[{signature:"currentInitiator(): Agent | undefined",description:"Read the Agent that initiated the inherited asynchronous driver chain. Use this optional form for logging, tracing, metrics, or host attribution that also supports agentless calls. When a parent creates a child, setup reports the causal parent while `agentCtx.agent` identifies the child.",parameters:[],returns:"the inherited Agent, or `undefined` outside an initiator boundary and inside an explicit clearing boundary.",throws:["when this service instance has been disposed."]},{signature:"requireInitiator(): Agent",description:"Read the initiating Agent and fail when no initiator boundary is active. Use this for private helpers contractually below a driver, or for a deployment-owned outbound request whose contract forbids agentless calls. Generic or direct-call paths use optional lookup or explicit request fields.",parameters:[],returns:"the inherited Agent.",throws:["when no initiator is active or this service instance has been disposed."]},{signature:"withInitiator<T>(agent: Agent, operation: () => T): T",description:"Run an operation with one exact Agent as its process-local initiator. The exact synchronous value or Promise returned by the operation is preserved. Custom drivers and test harnesses wrap their complete returned foreground lifetime. A queue or wire receiver may establish this boundary only after validating explicit identity and resolving the exact live Agent; this method does neither. Detached work remains owned by the subsystem that starts it.",parameters:[{name:"agent",description:"initiating Agent to inherit; presence is neither liveness proof nor authorization."},{name:"operation",description:"synchronous or asynchronous operation to invoke."}],returns:"the exact value returned by `operation`.",throws:["when the initiator scope is closing/disposed, or when `operation` throws."]},{signature:"withoutInitiator<T>(operation: () => T): T",description:"Run an operation inside a boundary that hides any inherited initiating Agent. The exact synchronous value or Promise is preserved. Use this while creating lazy shared timers, queue pumps, pool maintenance, watchers, or exporters so they do not inherit the first Agent that happens to initialize them. It clears only initiator attribution, not explicit fields, and does not own or drain detached resources.",parameters:[{name:"operation",description:"synchronous or asynchronous operation to invoke without an initiator."}],returns:"the exact value returned by `operation`.",throws:["when the initiator scope is closing/disposed, or when `operation` throws."]},{signature:"setFactory(factory: AgentFactory): () => void",description:"Register the agent-creation factory (the loop calls this on construction, effect-scoped). A traced Cordis service is canonicalized to its concrete target; each create/resume call is then traced through that caller's context so ownership follows the caller without stacking proxy layers. Throws if a factory is already registered. Returns the disposer; on dispose the factory slot is cleared.",parameters:[{name:"factory",description:"the loop-owned factory {@link create}/{@link resume} delegate to."}],returns:"the disposer that clears the factory slot. The exact Cordis effect disposer (single-shot): composite (generator) effects may yield it directly — exact identity nests the teardown in order."},{signature:"async create(options: CreateAgentOptions): Promise<AgentHandle>",description:"Create and publish a new agent through the registered factory. Distinct from register (which records an already-constructed agent): this constructs the agent and its session. Rejects if no factory is registered or creation/setup fails. The resolved AgentHandle lets the owner tear down exactly this agent.",parameters:[{name:"options",description:"shared identity, session seed/metadata, and agent options."}],returns:"the handle after setup, rollback-covered publication, and loop start complete."},{signature:"async resume(options: ResumeAgentOptions): Promise<AgentHandle>",description:"Load a persisted session and resume an agent on it through the registered factory. Rejects if no factory is registered; the factory rejects if session persistence is not configured or persistence/setup fails.",parameters:[{name:"options",description:"persisted identity, configuration, and optional setup."}],returns:"the handle after setup, rollback-covered publication, and loop start complete."},{signature:"register(agent: Agent): () => void",description:"Register a live agent. Throws if an agent with the same id is already registered. Emits `agent/created` on registration and `agent/disposed` when the calling fiber is disposed — both with the agent's scope carrier (`scopeTarget(agent, agent)`): the subject is the agent in hand, so the emits are scope-filtered regardless of which context invoked `register` (calling through `agent.ctx` scopes EFFECTS; dispatch scoping always requires passing the carrier). Returns the disposer.",parameters:[{name:"agent",description:"the already-constructed agent to record in the store."}],returns:"the EXACT Cordis effect disposer (single-shot; a repeat call returns undefined without awaiting an in-flight teardown). Exact identity is load-bearing: a composite (generator) effect that owns a teardown ORDER — the agent factory's lifecycle chain — must yield THIS function so Cordis nests the unregistration at that yield position; yielding a wrapper would leave it disposing as a concurrent sibling on owner unload, unregistering the agent (and emitting `agent/disposed`) while its final turn is still draining."},{signature:"enter(agent: Agent, owner: Agent | undefined): () => void",description:"Insert an already-constructed agent without announcing it. This is the advanced ordered-lifecycle primitive used by the async agent factory: it first completes setup while the agent is unpublished, then assigns the returned detach closure into its pre-installed composite teardown before calling announce. Ordinary callers use register.",parameters:[{name:"agent",description:"the prepared, unpublished agent."},{name:"owner",description:"live agent whose scoped context created this agent, or undefined for a top-level runtime root. This is runtime ownership, not the resumed session's durable parent lineage."}],returns:"an idempotent closure that removes this exact entry and emits `agent/disposed` with listener failures contained. When called from a synchronous `agent/created` listener, removal and disposal wait until that creation dispatch unwinds."},{signature:"announce(agent: Agent): void",description:"Announce an agent previously inserted with enter.",parameters:[{name:"agent",description:"the live inserted agent to announce."}],throws:["if `agent` is not the exact live registry entry for its id, or its creation announcement already began (including a reentrant call from a creation listener)."]},{signature:"get(id: SessionId): Agent | undefined",description:"Look up a live agent.",parameters:[{name:"id",description:"the shared agent/session id to look up."}],returns:"the agent, or undefined when no live agent has that id."},{signature:"isOwnedBy(id: SessionId, owner: Agent): boolean",description:"Test whether a live agent was created through one exact parent agent's scoped context. Runtime ownership is independent of durable session lineage and remains unambiguous when unrelated providers reuse an id.",parameters:[{name:"id",description:"the candidate child agent's shared agent/session id."},{name:"owner",description:"the expected runtime creator agent."}],returns:"true only while the exact child entry is live under that owner."},{signature:"list(): Agent[]",description:"All live agents, in registration order.",parameters:[],returns:"a fresh array; mutating it does not affect the registry."},{signature:"roots(): Agent[]",description:"All live top-level agents in registration order. A top-level agent was created without an owning agent context; durable session lineage does not affect this runtime relation, so a resumed fork may still be a root.",parameters:[],returns:"a fresh array; mutating it does not affect the registry."}]},{key:"apiProxy",summary:"Root interface of the unified API.",description:"Root interface of the unified API. New client-request domain = one new file pair + one field here + one map row.",methods:[{signature:"downloads: DownloadsApi",description:"Host-only download surfaces (GET, no wire envelope); absent from IApiClient.",parameters:[]},{signature:"respond(message: ClientResponse): Promise<RpcReceipt>",description:"Response entry for server requests; not a domain method.",parameters:[{name:"message",description:"Client response carrying the server request's rpcId."}],returns:"Transport receipt for the response delivery."}]},{key:"approval",summary:"Approval service that applies session policy before answerers and logs every ask/outcome pair to the requesting session.",description:"Approval service that applies session policy before answerers and logs every ask/outcome pair to the requesting session. It exposes deterministic policy changes to the model through the runtime-context snapshot and switch notices.",methods:[{signature:"setPolicy(agent: Agent, policy: ApprovalPolicy): void",description:"Switch one live agent's policy and queue the transition for its next model step. Session initialization uses setApprovalPolicy directly because there is no previously visible policy to change.",parameters:[{name:"agent",description:"the live agent whose policy is changing."},{name:"policy",description:"the new effective policy."}]},{signature:"async request(req: ApprovalRequest): Promise<ApprovalOutcome>",description:"Ask the composed answerers to decide one readonly same-process request. The service borrows the request, agent, session, and live signal directly. The request requires an open turn because the audit pair must be enclosed by the durable log's commit/replay boundary; an idle ask rejects before appending anything. The answerer phase always produces an outcome: an aborted signal yields `'cancelled'`, a missing or throwing answerer yields `'unavailable'` (fail closed), and a rogue non-vocabulary return value is normalized to `'unavailable'`. A failure that prevents either audit append from committing still rejects because returning an unlogged decision would violate the pair. Session contains post-commit observer failures, so an authoritative append cannot reject the request or suppress its matching audit event.",parameters:[{name:"req",description:"the pending decision (agent, tool identity, reason, signal)."}],returns:"the closed outcome; `'allowed-once'` is the only grant.",throws:["when no turn is open or either audit event fails before the session append commit point."]},{signature:"overrideOf(session: Session): ApprovalPolicy | undefined",description:"Read the session override without applying the configured default.",parameters:[{name:"session",description:"session whose log supplies the override."}],returns:"the last logged policy, or `undefined` without one."}]},{key:"attachments",summary:"Immutable binary attachment service.",description:"Immutable binary attachment service. Implementations validate bytes before publishing a reference.",methods:[{signature:"abstract readonly imageLimits: ImageAttachmentLimits",description:"Deployment-resolved image policy used by authoritative and fast-path validation.",parameters:[]},{signature:"abstract validateImage(input: SaveImageAttachment): Promise<void>",description:"Validate one image without persisting it. Batch callers validate every member before saving any member.",parameters:[{name:"input",description:"encoded bytes, declared media type, and optional display name."}],returns:"completion after the encoded raster has been fully decoded."},{signature:"async saveImages(inputs: readonly SaveImageAttachment[]): Promise<readonly ImageAttachmentRef[]>",description:"Validate one ordered image batch before committing any member. Validation failures start no writes; storage failures return no partial references, although already published content-addressed objects may stay unreachable until a future retention policy collects them.",parameters:[{name:"inputs",description:"encoded images in their owning message order."}],returns:"durable references in the exact input order."},{signature:"abstract saveImage(input: SaveImageAttachment): Promise<ImageAttachmentRef>",description:"Validate and durably commit one image before its owning session event is appended.",parameters:[{name:"input",description:"encoded bytes, declared media type, and optional display name."}],returns:"a durable content-addressed reference."},{signature:"abstract readImage(ref: ImageAttachmentRef, signal?: AbortSignal): Promise<StoredImageAttachment>",description:"Read one image and verify that bytes still match the recorded reference.",parameters:[{name:"ref",description:"durable reference from the session log."},{name:"signal",description:"optional cancellation for backend read and verification work."}],returns:"the verified bytes and canonical reference.",throws:["the signal reason when aborted, or a storage error when verification fails."]}]},{key:"clientModules",summary:"The web plugin table service: incremental `dsh.client` scan + wire composition + bundle route + index tap.",description:"The web plugin table service: incremental `dsh.client` scan + wire composition + bundle route + index tap. Construction runs the activation scan synchronously — a malformed declaration or missing bundle among the already-loaded entries aggregates into one loud throw (FAILED fiber; the boot activation audit reports it).",methods:[{signature:"graph(): WebBootGraph",description:"Current composed entry graph (stable object between changes).",parameters:[],returns:"the graph served as `window.__DSH_BOOT__`."},{signature:"clientPath(id: string): string | undefined",description:"Absolute path of an entry's client bundle.",parameters:[{name:"id",description:"entry id (package name)."}],returns:"the path, or undefined for an unknown id."},{signature:"rebuilt(id: string): string | undefined",description:"Re-hash one bundle (the HMR watch's registration hook — the only entry point through which bundle content changes reach the graph).",parameters:[{name:"id",description:"entry id (package name)."}],returns:"the new rev, or undefined for an unknown id."},{signature:"onRebuilt(listener: (id: string, rev: string) => void): () => void",description:"Subscribe to bundle rebuilds; fires only when the re-hash changed the rev.",parameters:[{name:"listener",description:"receives the entry id and its new bundle rev."}],returns:"the unsubscriber."},{signature:"onGraphChanged(listener: () => void): () => void",description:"Fires after any flush that recomposed the graph (row added/removed, or a rebuilt rev change). Pull model: listeners re-read graph.",parameters:[{name:"listener",description:"notified with no payload."}],returns:"the unsubscriber."}]},{key:"codeRuntime",summary:"Registers one `ctx.codeRuntime` implementation.",description:"Registers one `ctx.codeRuntime` implementation. Program, budget, abort, and substrate failures resolve in CodeRunResult; only Service Definition contract misuse rejects. Implementations bridge structured-cloneable bindings, materialize each declared namespace rejection class, treat programs as hostile peers, isolate runs from one another, and terminate and await in-flight runs during disposal.",methods:[{signature:"abstract readonly language: string",description:"The source language run expects `program` to be written in, as a lowercase identifier. Informational, not gating — a consumer that generates language-specific presentation (typed SDK stubs, usage instructions) switches on it and fails loud on a language it cannot present. Well-known values: `'typescript'` and `'python'`, those `dsh-tools` presents; only `'typescript'` has a published backend.",parameters:[]},{signature:"abstract readonly isolation: string",description:"The execution substrate, as a lowercase identifier. Informational, not gating — a descriptor so deployments and diagnostics can tell backends apart, not a security claim. Well-known values: `'worker-thread'`, `'process'`, `'container'`.",parameters:[]},{signature:"abstract run(request: CodeRunRequest): Promise<CodeRunResult>",description:"Execute one program against the request's bindings and capture what it emitted. See the class doc for the resolution contract (error is a result field; rejection means Service Definition contract misuse only).",parameters:[{name:"request",description:"the program, its bindings, and the abort signal; the request carries everything the runtime acts on, with no hidden defaults."}],returns:"the run's outcome: completion value (when transferable), the ordered log capture, and the failure (if any)."}]},{key:"commands",summary:"Human-command registry.",description:"Human-command registry. Plain-context definitions are global; definitions registered through a command-injected child of an agent context shadow globals for that agent.",methods:[{signature:"register(definition: CommandDefinition): () => void",description:"Register a global or calling-agent-scoped command.",parameters:[{name:"definition",description:"discovery metadata and direct UI handler."}],returns:"the exact effect disposer that unregisters this definition."},{signature:"@Remote list(agent: Agent): readonly CommandDescriptor[]",description:"List the effective immutable command descriptors for one agent.",parameters:[{name:"agent",description:"exact receiving agent and scoped-layer key."}],returns:"name-sorted descriptors after scoped shadowing."},{signature:"find(agent: Agent, name: string): CommandDefinition | undefined",description:"Resolve one effective command definition.",parameters:[{name:"agent",description:"exact receiving agent and scoped-layer key."},{name:"name",description:"command name without a slash."}],returns:"the scoped shadow or global definition."},{signature:"@Remote async execute( agent: Agent, line: string, signal: AbortSignal, ): Promise<CommandExecution | undefined>",description:"Parse and execute a known command without sending it to the model.\n\nA resolved command's lifecycle is logged: `command/run` is appended before the handler is invoked and `command/done` after settlement (a thrown or aborted handler settles as `kind: 'error'`). Both are direct log-only appends — no turn wraps them, and persistence drains them at ordinary checkpoints. Admission misses (syntax or unknown name) log nothing — they never entered a handler. A `command/run` append failure fails the execution loud; a `command/done` append failure on the handler-failure path is contained so the handler's own error stays the reported failure.",parameters:[{name:"agent",description:"exact receiving agent."},{name:"line",description:"complete slash-command line."},{name:"signal",description:"cancellation signal owned by the UI request."}],returns:"the settled execution (result + lifecycle pairing id), or `undefined` when syntax or name does not resolve."}]},{key:"compaction",summary:"Abstract compaction service.",description:"Abstract compaction service. Implementations own trigger policy, retention, and summarization, and may consume a separate measurement service. A successful run replaces the selected surface span with one summary node and prevents concurrent compaction of the same session. The replacement user message uses compactCheckpointSource with the transaction identity so consumers recognize and correlate it independently of the backend. Load one implementation per context as `ctx.compaction`.",methods:[{signature:"abstract compactIfNeeded( agent: CompactionAgentContext, trigger: CompactionTrigger, signal: AbortSignal, ): Promise<CompactionResult | null>",description:"Consider automatic compaction for one explicit trigger. Pressure policy uses the latest durable routed request, while context-overflow policy may force a useful balanced reduction even below the normal threshold. Return `null` when no safe range can be compacted. A single oversized retained unit or request envelope cannot be repaired through surface compaction.",parameters:[{name:"agent",description:"agent context owning the session surface and routing options."},{name:"trigger",description:"normal pressure or provider-confirmed context overflow."},{name:"signal",description:"cancellation signal; model-backed implementations must forward it."}],returns:"the compaction result, or `null` if no compaction was needed."},{signature:"abstract compactNow( agent: ManualCompactAgentContext, signal: AbortSignal, sourceCommandId?: CommandId, ): Promise<CompactionResult | null>",description:"Explicitly compact useful history even below automatic pressure thresholds. Implementations synchronously start an idle task before any asynchronous work, select a useful range without writing on a no-op, then append a standalone `compaction/start` before summarization. That durable marker is the compaction lock until one `compaction/end` attempt. Later waking prompts remain accepted in FIFO order and start only after the optional durability checkpoint and idle-task settlement. Context injected while the summary runs may sit between the marker pair; only the selected span must remain stable.",parameters:[{name:"agent",description:"idle agent whose durable history should be compacted."},{name:"signal",description:"cancellation scoped to this compaction request."},{name:"sourceCommandId",description:"initiating command identity for a manual compaction."}],returns:"the compaction result, or `null` when no safe useful range exists.",throws:["{@link ManualCompactionError} for expected busy, agent-cancellation, changed-span, summarization/shrink, commit-stage, or persistence failures; an aborted request preserves its exact abort reason. Failed attempts remain visible in the log."]},{signature:"abstract compactRegion( start: number, end: number, agent: CompactionAgentContext, signal?: AbortSignal, ): Promise<CompactionResult>",description:"Forcibly compact a range of surface nodes into a single summary node. `start` and `end` name an inclusive span by surface position, not numeric seq order; replacements can make visible seqs non-monotonic. Both edges must be balanced so assistant tool calls remain paired with their results. A model- backed implementation forwards cancellation and rejects active, missing, reversed, or unbalanced ranges. The target session is `agent.session`. Its replacement user message must use compactCheckpointSource with the transaction's `CompactionId`. Use toolPairingBalancedBefore and toolPairingBalancedAfter for the edge checks.",parameters:[{name:"start",description:"first surface seq, inclusive."},{name:"end",description:"last surface seq, inclusive."},{name:"agent",description:"context whose session is mutated and whose routing options guide summarization."},{name:"signal",description:"optional cancellation; model-backed implementations must forward it."}],returns:"the appended event seqs, summary, replaced range, and token accounting.",throws:["when compaction is active or the range is missing, reversed, or unbalanced."]}]},{key:"contentReview",summary:"The content-review service.",description:"The content-review service. A denied text throws ContentReviewFailedError carrying the client-visible replacement text; every other failure propagates as the transport's own error, leaving the caller to decide whether an unavailable reviewer blocks the request.",methods:[{signature:"async review(request: ContentReviewRequest): Promise<ContentReviewResult>",description:"Submit one text for review.",parameters:[{name:"request",description:"the text, its conversation stage, and an optional correlation id."}],returns:"the backend correlation id when the text is allowed."}]},{key:"credentials",summary:"Abstract credential service.",description:"Abstract credential service. Providers implement the four operations over their source layers; one seam-wide rule binds them all: an empty stored value is absent everywhere — `resolve` skips it, `describe` reports it unconfigured — so a blank never masquerades as a configured secret.",methods:[{signature:"abstract resolve(ref: CredentialRef): Promise<ResolvedCredential | undefined>",description:"Resolve one reference to its current value. Resolution is per call: consumers re-resolve at each operation and must not cache across operations — that per-operation read is what makes a changed credential reach the next operation without a restart.",parameters:[{name:"ref",description:"the reference to resolve."}],returns:"the value and its source, or `undefined` while unconfigured."},{signature:"abstract describe(ref: CredentialRef): Promise<CredentialInfo>",description:"Describe one reference for configuration surfaces without exposing the value.",parameters:[{name:"ref",description:"the reference to describe."}],returns:"configured state, supplying source, and writability."},{signature:"abstract set(ref: CredentialRef, value: string): Promise<void>",description:"Durably store one value in the provider-managed writable source. Rejects while a read-only source shadows the reference — the write would appear to succeed while resolution keeps returning the shadowing value — and rejects an empty value (use unset).",parameters:[{name:"ref",description:"the reference to store."},{name:"value",description:"the non-empty secret value."}]},{signature:"abstract unset(ref: CredentialRef): Promise<void>",description:"Remove one reference from the provider-managed writable source; removing an absent reference is a no-op. Rejects while a read-only source shadows the reference, like set.",parameters:[{name:"ref",description:"the reference to remove."}]}]},{key:"directoryPicker",summary:"Abstract directory-picking service.",description:"Abstract directory-picking service. Subclass, implement `capability()`, and load the subclass as a plugin — it registers as `ctx.directoryPicker` (one implementation per context; loading a second throws, cordis' standard duplicate-service behavior). The capability object must be stable for the service lifetime: consumers may capture it across calls.",methods:[{signature:"abstract capability(): DirectoryPickerCapability",description:"The backend's interaction capability.",parameters:[],returns:"the discriminated capability consumers switch on."}]},{key:"e2b",summary:"Creates one lazily consumable E2B SDK handle and deletes the sandbox at timeout or disposal.",description:"Creates one lazily consumable E2B SDK handle and deletes the sandbox at timeout or disposal. Creation begins at plugin construction; adapters await getSandbox before their first operation.",methods:[{signature:"readonly cwd: string",description:"Validated remote working directory shared by provider adapters.",parameters:[]},{signature:"readonly runtimeRoot: string",description:"Remote directory reserved for adapter-owned process and terminal state.",parameters:[]},{signature:"async getSandbox(): Promise<Sandbox>",description:"Return the shared live SDK handle.",parameters:[],returns:"the created sandbox after the configured cwd exists.",throws:["when E2B rejects creation or the service is disposing."]}]},{key:"fs",summary:"Abstract filesystem provider.",description:"Abstract filesystem provider. Targets must preserve identity across aliases; reads expose regular UTF-8 text or typed errors, listings are stable and content-free, and mutations are atomic. Optional guards add stale protection without changing the unguarded provider contract.",methods:[{signature:"abstract resolve(path: string, opts?: { cwd?: string; signal?: AbortSignal }): Promise<FsTarget>",description:"Resolve a model/plugin-supplied path into a stable FsTarget. May perform I/O (a remote/sandboxed backend may need a round-trip to map a path to a stable identity), hence async even though the local backend only normalizes + realpaths.",parameters:[{name:"path",description:"the path to resolve; relative paths resolve against `opts.cwd`."},{name:"opts",description:"optional cwd override and cancellation signal."}],returns:"the stable target; the same file yields the same `targetKey`."},{signature:"abstract processPath(target: FsTarget): string",description:"Return the canonical absolute path a subprocess in this filesystem's execution world can open. The path is deliberately separate from FsTarget.targetKey: consumers may pass this value to another OS capability, but must continue treating the target key as opaque.",parameters:[{name:"target",description:"the resolved target whose process path is required."}],returns:"an absolute path in the backend's execution world."},{signature:"abstract fileUrl(target: FsTarget): string",description:"Return the canonical `file:` URI for a target in this filesystem's execution world. Backends own URI encoding because the host platform may differ from the execution platform.",parameters:[{name:"target",description:"the resolved target to encode."}],returns:"the target's canonical file URI."},{signature:"abstract contains(parent: FsTarget, child: FsTarget): boolean",description:"Test canonical containment without exposing or parsing backend target keys. Both targets must come from this provider.",parameters:[{name:"parent",description:"canonical directory target."},{name:"child",description:"canonical candidate target."}],returns:"true when `child` is `parent` or a descendant of it."},{signature:"abstract stat(target: FsTarget, signal?: AbortSignal): Promise<FsInfo | undefined>",description:"Return target metadata, or `undefined` when the target does not exist.",parameters:[{name:"target",description:"the resolved target to stat."},{name:"signal",description:"aborts the metadata round-trip."}],returns:"metadata only, never content; undefined for an absent target."},{signature:"abstract lstat(path: string, opts?: { cwd?: string }, signal?: AbortSignal): Promise<FsPathInfo | undefined>",description:"Return path metadata without following the final path component when it is a symbolic link. This is intentionally path-shaped, not target-shaped: resolve follows symlinks to produce the stable identity used by normal reads/writes, while `lstat` lets a consumer reject the path itself before that follow happens.\n\n`opts.cwd` follows resolve's cwd rules. `undefined` means the path is absent.",parameters:[{name:"path",description:"the path to inspect; relative paths resolve against `opts.cwd`."},{name:"opts",description:"`cwd` overrides the backend's default base for relative paths."},{name:"signal",description:"aborts the metadata round-trip."}],returns:"metadata only, never content; undefined for an absent path."},{signature:"abstract readText(target: FsTarget, signal?: AbortSignal): Promise<string>",description:"Read the whole regular text file as a single decoded string.",parameters:[{name:"target",description:"the resolved target to read."},{name:"signal",description:"aborts the read."}],returns:"the full decoded UTF-8 content."},{signature:"abstract streamText(target: FsTarget, signal?: AbortSignal): Promise<AsyncIterable<string>>",description:"Stream the whole regular text file as decoded text chunks (same text semantics as readText, for large files). The backend owns cross-chunk UTF-8 decoding and binary rejection so the policy layer never touches raw bytes.",parameters:[{name:"target",description:"the resolved target to read."},{name:"signal",description:"aborts the stream, including between chunks."}],returns:"the chunk iterable, decoded and validated like {@link readText}."},{signature:"abstract readBytes(target: FsTarget, signal: AbortSignal | undefined, maxBytes: number): Promise<Uint8Array>",description:"Read the whole regular file as raw bytes with no decoding or binary rejection. The bound lives at this seam so a backend can never buffer an unbounded file: a target known or discovered to exceed `maxBytes` fails with `FS_TOO_LARGE` instead of returning a truncated result.",parameters:[{name:"target",description:"the resolved target to read."},{name:"signal",description:"aborts the read."},{name:"maxBytes",description:"inclusive byte cap on the complete content."}],returns:"the full raw content, at most `maxBytes` long."},{signature:"abstract listDir(target: FsTarget, signal?: AbortSignal): Promise<FsDirEntry[]>",description:"List direct children of a directory in stable name order. Returns resolved child targets plus cheap metadata only; never reads file contents.",parameters:[{name:"target",description:"the resolved directory target."},{name:"signal",description:"aborts the listing."}],returns:"one entry per direct child, in stable name order."},{signature:"abstract writeText( target: FsTarget, content: string, expected?: FsWriteIntent, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise<FsWriteOutcome>",description:"Atomically create or replace UTF-8 text. `expected` guards intent and staleness; omission allows unconditional overwrite.",parameters:[{name:"target",description:"the resolved target to write."},{name:"content",description:"the full new file content."},{name:"expected",description:"the write intent guarding the write; omit for unconditional."},{name:"signal",description:"aborts before atomic publication takes effect."},{name:"sandboxPolicy",description:"the per-call mode and workspace root this write runs under; a sandboxing backend fences the write by it, the bare backend ignores it. Omit to leave the backend its own default."}],returns:"the outcome, including the version the write produced."},{signature:"abstract editText( target: FsTarget, edit: FsEditRequest, expected?: { version: FsVersion }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise<FsEditOutcome>",description:"Atomically edit literal text. When supplied, the version guard is checked before matching so stale content reports `FS_STALE_VERSION`; omission edits the current content without a freshness precondition.",parameters:[{name:"target",description:"the resolved target to edit."},{name:"edit",description:"the literal search/replace request."},{name:"expected",description:"the version guard; omit for an unconditional edit."},{name:"signal",description:"aborts before atomic publication takes effect."},{name:"sandboxPolicy",description:"the per-call mode and workspace root this edit runs under; a sandboxing backend fences the edit by it, the bare backend ignores it. Omit to leave the backend its own default."}],returns:"the outcome, including the version the edit produced."}]},{key:"goals",summary:"Goal service (`ctx.goals`) backed exclusively by the owning session log.",description:"Goal service (`ctx.goals`) backed exclusively by the owning session log.",methods:[{signature:"get(agent: Agent): GoalView | undefined",description:"Read the current goal for one exact live agent.",parameters:[{name:"agent",description:"owning live agent."}],returns:"a fresh view or `undefined` when no goal is current.",throws:["{@link GoalError} when the agent is not the registry's live instance."]},{signature:"disarm(agent: Agent): GoalView | undefined",description:"Remove process-local continuation authority without changing durable goal phase or revision. Lifecycle owners use this before unloading a driver; a later human-authorized resume records the new activation edge.",parameters:[{name:"agent",description:"owning live agent."}],returns:"a fresh disarmed view, or `undefined` when no goal is current."},{signature:"create(agent: Agent, request: CreateGoalRequest): GoalView",description:"Create and arm a goal. A completed goal may be replaced; every other current phase must be cleared or resumed instead.",parameters:[{name:"agent",description:"owning live agent."},{name:"request",description:"objective and optional round cap."}],returns:"the created live view."},{signature:"@Remote('edit') edit(agent: Agent, ref: GoalRef, request: EditGoalRequest): GoalView",description:"Edit objective and/or round cap without changing phase.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."},{name:"request",description:"at least one replacement field."}],returns:"the edited view."},{signature:"@Remote('pause') pause(agent: Agent, ref: GoalRef): GoalView",description:"Pause an active goal and disarm automatic continuation.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."}],returns:"the paused view."},{signature:"@Remote('resume') resume(agent: Agent, ref: GoalRef): GoalView",description:"Resume and arm a stopped goal, or rearm an active goal after a session-start edge, while its round budget still has capacity.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."}],returns:"the active view."},{signature:"@Remote('complete') complete(agent: Agent, ref: GoalRef): GoalView",description:"Mark a current non-complete goal complete and disarm it.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."}],returns:"the completed view."},{signature:"block(agent: Agent, ref: GoalRef, reason: GoalBlockReason): GoalView",description:"Mark an active goal blocked and disarm it.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."},{name:"reason",description:"policy-owned stable code and human-readable explanation."}],returns:"the blocked view with its durable reason."},{signature:"@Remote('clear') clear(agent: Agent, ref: GoalRef): GoalRef",description:"Clear the current goal while retaining a durable tombstone and history.",parameters:[{name:"agent",description:"owning live agent."},{name:"ref",description:"expected current revision."}],returns:"the tombstone ref whose revision is one past the cleared snapshot."},{signature:"@Remote('create') remoteExportCreate(agent: Agent, request: CreateGoalRequest): CreateGoalResult",description:"Create one Goal through the remote boundary.",parameters:[{name:"agent",description:"exact live Agent resolved from the wire identity."},{name:"request",description:"objective and optional round cap."}],returns:"the created Goal identity."}]},{key:"invariants",summary:"Package-owned invariant registry with global and regex-based selection.",description:"Package-owned invariant registry with global and regex-based selection.",methods:[{signature:"register(packageName: string, installer: InvariantInstaller): () => void",description:"Register one package's invariant installer. The package name is reserved even when filtering disables its checks. Enabled installers run in a child fiber; failure disposes that fiber and releases the reservation.",parameters:[{name:"packageName",description:"full npm package name that owns the contribution."},{name:"installer",description:"listener or startup-check installer for the child context."}],returns:"an effect-scoped disposer for the registration."}]},{key:"jobs",summary:"Abstract background job registry.",description:`Abstract background job registry. Subclass, implement the abstract methods, and load the subclass as a plugin — it registers as \`ctx.jobs\` (one implementation per context; loading a second throws, which is cordis' standard duplicate-service behavior).
20
20
 
21
21
  Implementations must honor these semantics:
22
22
 
@@ -988,6 +988,9 @@ When a caller supplies an agent, human interaction is valid only for the exact l
988
988
  }`},{name:"ReasoningEffortId",declaration:"export type ReasoningEffortId = Branded<'ReasoningEffortId'>;"},{name:"RedactedSecret",declaration:`export interface RedactedSecret {
989
989
  path: string[];
990
990
  set: boolean;
991
+ }`},{name:"ReplayEnvelope",declaration:`export interface ReplayEnvelope {
992
+ response: unknown;
993
+ blocks?: readonly unknown[];
991
994
  }`},{name:"RequestContext",declaration:`export interface RequestContext {
992
995
  provider: string;
993
996
  model: string;
@@ -1593,7 +1596,7 @@ When a caller supplies an agent, human interaction is valid only for the exact l
1593
1596
  } | {
1594
1597
  type: 'finish';
1595
1598
  reason: FinishReason;
1596
- replayState?: unknown;
1599
+ replayState?: ReplayEnvelope;
1597
1600
  };`},{name:"SubagentCapabilities",declaration:`export interface SubagentCapabilities {
1598
1601
  readonly outputSchema: boolean;
1599
1602
  readonly depthLimit: boolean;
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-cordis","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.0.15","@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/dsh-cordis-host-runner":"^0.0.15","@deepseek-ai/dsh-llm":"^0.0.15","@deepseek-ai/dsh-scope":"^0.0.15","@deepseek-ai/dsh-system-prompt":"^0.0.15","@deepseek-ai/dsh-session":"^0.0.15","@deepseek-ai/dsh-tools":"^0.0.15","@deepseek-ai/cordis":"^4.0.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-cordis","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-cordis-host-runner":"^0.1.0","@deepseek-ai/dsh-scope":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-session":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-tools":"^0.1.0","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-system-prompt":"^0.1.0"}}
@@ -1,20 +1,20 @@
1
- var I=Object.defineProperty;var s=(e,t)=>I(e,"name",{value:t,configurable:!0});import c from"@deepseek-ai/schemastery";import{defineTool as h}from"@deepseek-ai/dsh-tools";import{FsError as p}from"@deepseek-ai/dsh-fs";import{ESCALATION_TARGETS as S,approveEscalation as j,canonicalPath as A,escalationHintMarker as B,sandboxDenialMarker as R,validateEscalationArgs as F}from"@deepseek-ai/dsh-sandbox";import{structuredPatch as N}from"diff";import{basename as q,extname as w}from"node:path";import{AttachmentError as O,AttachmentId as k}from"@deepseek-ai/dsh-attachment";import{createUserMessage as C}from"@deepseek-ai/dsh-llm";const D=2e3,U=51200;function G(){return{lines:[],totalLines:0,outputBytes:0,truncatedByBytes:!1}}s(G,"newAccumulator");function W(e,t){return e.length>t?`${e.substring(0,t)}... (line truncated to ${t} chars)`:e}s(W,"truncateLine");function z(e,t){return Buffer.byteLength(e,"utf8")+(t>0?1:0)}s(z,"lineByteSize");function H(e,t,i){if(e.totalLines+=1,e.truncatedByBytes||e.totalLines<i.offset||e.lines.length>=i.limit)return;const n=W(t,i.maxLineLength),r=z(n,e.lines.length);if(e.outputBytes+r>i.maxBytes){e.truncatedByBytes=!0;return}e.outputBytes+=r,e.lines.push({number:e.totalLines,text:n})}s(H,"consumeLine");function X(e){return e.endsWith("\r")?e.slice(0,-1):e}s(X,"stripCarriageReturn");function J(e,t,i){if(!e.truncatedByBytes&&t.offset>e.totalLines&&!(e.totalLines===0&&t.offset===1))throw new p(`offset ${t.offset} is out of range for "${i}" (${e.totalLines} lines)`,"FS_NOT_FOUND");return{lines:e.lines,totalLines:e.totalLines,truncatedByBytes:e.truncatedByBytes}}s(J,"finish");async function V(e,t,i){const n=G(),r=t.maxLineLength+1;let o="";function a(f){o.length>=r||(o+=f,o.length>r&&(o=o.slice(0,r)))}s(a,"appendToLineBuffer");function l(){H(n,X(o),t),o=""}s(l,"flushLine");for await(const f of e){let d=0,u;for(;(u=f.indexOf(`
2
- `,d))!==-1;)a(f.slice(d,u)),l(),d=u+1;a(f.slice(d))}return o.length>0&&l(),J(n,t,i)}s(V,"buildWindow");function Y(e,t){const i=t.lines.at(-1)?.number??Math.max(0,t.offset-1);let n;return t.truncatedByBytes?n=`(Output capped. Showing lines ${t.offset}-${i}. Use offset=${i+1} to continue.)`:i<t.totalLines?n=`(Showing lines ${t.offset}-${i} of ${t.totalLines}. Use offset=${i+1} to continue.)`:n=`(End of file - total ${t.totalLines} lines)`,`<path>${e}</path>
1
+ var P=Object.defineProperty;var s=(e,t)=>P(e,"name",{value:t,configurable:!0});import u from"@deepseek-ai/schemastery";import{defineTool as h}from"@deepseek-ai/dsh-tools";import{FsError as c}from"@deepseek-ai/dsh-fs";import{ESCALATION_TARGETS as M,approveEscalation as I,canonicalPath as S,escalationHintMarker as j,sandboxDenialMarker as A,validateEscalationArgs as B}from"@deepseek-ai/dsh-sandbox";import{structuredPatch as R}from"diff";import{basename as F,extname as g}from"node:path";import{AttachmentError as N,AttachmentId as q}from"@deepseek-ai/dsh-attachment";const O=2e3,k=51200;function C(){return{lines:[],totalLines:0,outputBytes:0,truncatedByBytes:!1}}s(C,"newAccumulator");function D(e,t){return e.length>t?`${e.substring(0,t)}... (line truncated to ${t} chars)`:e}s(D,"truncateLine");function G(e,t){return Buffer.byteLength(e,"utf8")+(t>0?1:0)}s(G,"lineByteSize");function U(e,t,n){if(e.totalLines+=1,e.truncatedByBytes||e.totalLines<n.offset||e.lines.length>=n.limit)return;const i=D(t,n.maxLineLength),r=G(i,e.lines.length);if(e.outputBytes+r>n.maxBytes){e.truncatedByBytes=!0;return}e.outputBytes+=r,e.lines.push({number:e.totalLines,text:i})}s(U,"consumeLine");function W(e){return e.endsWith("\r")?e.slice(0,-1):e}s(W,"stripCarriageReturn");function z(e,t,n){if(!e.truncatedByBytes&&t.offset>e.totalLines&&!(e.totalLines===0&&t.offset===1))throw new c(`offset ${t.offset} is out of range for "${n}" (${e.totalLines} lines)`,"FS_NOT_FOUND");return{lines:e.lines,totalLines:e.totalLines,truncatedByBytes:e.truncatedByBytes}}s(z,"finish");async function H(e,t,n){const i=C(),r=t.maxLineLength+1;let o="";function a(f){o.length>=r||(o+=f,o.length>r&&(o=o.slice(0,r)))}s(a,"appendToLineBuffer");function l(){U(i,W(o),t),o=""}s(l,"flushLine");for await(const f of e){let d=0,p;for(;(p=f.indexOf(`
2
+ `,d))!==-1;)a(f.slice(d,p)),l(),d=p+1;a(f.slice(d))}return o.length>0&&l(),z(i,t,n)}s(H,"buildWindow");function X(e,t){const n=t.lines.at(-1)?.number??Math.max(0,t.offset-1);let i;return t.truncatedByBytes?i=`(Output capped. Showing lines ${t.offset}-${n}. Use offset=${n+1} to continue.)`:n<t.totalLines?i=`(Showing lines ${t.offset}-${n} of ${t.totalLines}. Use offset=${n+1} to continue.)`:i=`(End of file - total ${t.totalLines} lines)`,`<path>${e}</path>
3
3
  <type>file</type>
4
4
  <content>
5
5
  ${t.lines.length>0?`${t.lines.map(r=>`${r.number}: ${r.text}`).join(`
6
6
  `)}
7
7
 
8
- ${n}`:n}
9
- </content>`}s(Y,"formatReadOutput");const b={ts:"ts",tsx:"tsx",mts:"ts",cts:"ts",js:"js",jsx:"jsx",mjs:"js",cjs:"js",json:"json",jsonc:"json",py:"py",rb:"rb",go:"go",rs:"rs",java:"java",c:"c",h:"c",cc:"cpp",cpp:"cpp",hpp:"cpp",cxx:"cpp",cs:"cs",kt:"kotlin",swift:"swift",php:"php",sh:"sh",bash:"sh",zsh:"sh",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",md:"md",markdown:"md",mdx:"mdx",html:"html",htm:"html",css:"css",scss:"scss",less:"less",sql:"sql",xml:"xml",lua:"lua"};function Z(e){const t=e.slice(Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"))+1),i=t.lastIndexOf(".");if(i<=0)return;const n=t.slice(i+1).toLowerCase();return Object.hasOwn(b,n)?b[n]:void 0}s(Z,"langFromPath");function K(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const{number:t,text:i}=e;return typeof t=="number"&&Number.isInteger(t)&&t>=1&&typeof i=="string"}s(K,"isFileTextLine");function Q(e){if(typeof e!="object"||e===null||Array.isArray(e))return;const{path:t,offset:i,lines:n,totalLines:r,lang:o}=e;if(typeof t!="string"||typeof r!="number"||typeof i!="number"||!Number.isInteger(i)||i<1||!Number.isInteger(r)||r<0||!Array.isArray(n)||!n.every(K)||o!==void 0&&typeof o!="string")return;let a=i-1;for(const{number:l}of n){if(l<=a||l>r)return;a=l}return{path:t,offset:i,lines:n,totalLines:r,...o===void 0?{}:{lang:o}}}s(Q,"readMetaFromMeta");const _=/(?:^|[\\/])\.\.(?:[\\/]|$)/;function ee(e,t){const i=e.agent?.session.header.cwd;return i===void 0||!_.test(i)&&!_.test(t)?i:A(i)}s(ee,"sessionCwd");function g(e,t,i){const n=i??ee(e,t);return{...n!==void 0?{cwd:n}:{},signal:e.signal}}s(g,"sessionResolveOptions");async function v(e,t,i){const n=await e.fs.resolve(i,g(t,i)),r=await e.fs.stat(n,t.signal);if(r===void 0)throw e.emit("fs/observed",n,{kind:"absent"},t),new p(`cannot read "${n.displayPath}": not found`,"FS_NOT_FOUND");if(r.type!=="file")throw new p(`cannot read "${n.displayPath}": not a regular file`,"FS_NOT_REGULAR_FILE");return{target:n,info:r}}s(v,"resolveRegularReadTarget");const te=2e3,ie=10485760;function E(e,t){if(!Number.isFinite(e)||!Number.isInteger(e)||e<1)throw new Error(`${t} must be a positive integer`);return e}s(E,"parsePositiveInteger");function L(e,t){if(e.file_path.trim().length===0)throw new Error("file_path must be a non-empty string");const i=e.offset===void 0?1:E(e.offset,"offset"),n=e.limit===void 0?t:E(e.limit,"limit");if(n>t)throw new Error(`limit must be less than or equal to ${t}`);return{filePath:e.file_path,offset:i,limit:n}}s(L,"parseReadArgs");function ne(e,t){e.systemPrompt.section({name:"tool:read",order:100,text:"Use the read tool — not shell commands like cat — to inspect text files. Results include line numbers. Use offset and limit to continue reading large files."}),e.tools.register(h({name:"read",description:"Read a UTF-8 text file and return line-numbered content.",parameters:{file_path:{type:"string",required:!0,description:"Path to read, resolved by the filesystem backend."},offset:{type:"number",description:"1-based first line to return. Defaults to 1."},limit:{type:"number",description:`Maximum number of lines to return. Defaults to ${t.limit}.`}},output:{schema:{type:"object",additionalProperties:!1,properties:{path:{type:"string",required:!0},offset:{type:"integer",required:!0},lines:{type:"array",required:!0,items:{type:"object",additionalProperties:!1,properties:{number:{type:"integer",required:!0},text:{type:"string",required:!0}}}},totalLines:{type:"integer",required:!0}}},render:s((i,n)=>{const r=L(i,t.limit),o=n.lines.at(-1)?.number??Math.max(0,n.offset-1),a=n.lines.length<r.limit&&o<n.totalLines;return[{type:"text",text:Y(n.path,{offset:n.offset,lines:n.lines,totalLines:n.totalLines,...a?{truncatedByBytes:!0}:{}})}]},"render"),presentationMeta:s((i,n)=>{const r=Z(n.path);return{path:n.path,offset:n.offset,lines:n.lines.map(({number:o,text:a})=>({number:o,text:a})),totalLines:n.totalLines,...r===void 0?{}:{lang:r}}},"presentationMeta")},isConcurrencySafe:s(()=>!0,"isConcurrencySafe"),async execute(i,n){const r=L(i,t.limit),{target:o,info:a}=await v(e,n,r.filePath),l=await V(a.size===void 0||a.size>=t.streamMinSize?await e.fs.streamText(o,n.signal):[await e.fs.readText(o,n.signal)],{offset:r.offset,limit:r.limit,maxLineLength:t.maxLineLength,maxBytes:t.maxBytes},o.displayPath),f={path:o.displayPath,offset:r.offset,lines:l.lines,totalLines:l.totalLines};return e.emit("fs/observed",o,{kind:"present",version:a.version},n),f},presentResult(i,n){if(n.isError)return;const r=Q(n.meta);if(r===void 0)return;const o=n.content.length===1?n.content[0]:void 0,a=o?.type==="text"?o.text:void 0;if(a===void 0)return;const l=/^<path>[^\n]*<\/path>\n<type>file<\/type>\n<content>\n([\s\S]*)\n<\/content>$/u.exec(a)?.[1];if(l!==void 0)return{card:"read",path:r.path,offset:r.offset,lines:r.lines,totalLines:r.totalLines,...r.lang===void 0?{}:{lang:r.lang},content:[{type:"text",text:l}]}},presentCall(i){const{offset:n,limit:r}=i,o=r!==void 0&&r>0?` (${n??1} - ${(n??1)+r-1})`:n!==void 0?` (from line ${n})`:"";return{card:"generic",title:`Read ${i.file_path}${o}`,kind:"read",locations:[{path:i.file_path,line:n??1}]}}}))}s(ne,"applyReadTool");function x(e,t,i){const n=N("","",t,i,void 0,void 0,{context:3}),r=[];for(const o of n.hunks){const a=[],l=[];for(const f of o.lines){if(f.startsWith("\\"))continue;const d=f.slice(1);f.startsWith("-")?a.push(d):(f.startsWith("+")||a.push(d),l.push(d))}r.push({path:e,oldText:a.length>0?a.join(`
8
+ ${i}`:i}
9
+ </content>`}s(X,"formatReadOutput");const w={ts:"ts",tsx:"tsx",mts:"ts",cts:"ts",js:"js",jsx:"jsx",mjs:"js",cjs:"js",json:"json",jsonc:"json",py:"py",rb:"rb",go:"go",rs:"rs",java:"java",c:"c",h:"c",cc:"cpp",cpp:"cpp",hpp:"cpp",cxx:"cpp",cs:"cs",kt:"kotlin",swift:"swift",php:"php",sh:"sh",bash:"sh",zsh:"sh",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",md:"md",markdown:"md",mdx:"mdx",html:"html",htm:"html",css:"css",scss:"scss",less:"less",sql:"sql",xml:"xml",lua:"lua"};function J(e){const t=e.slice(Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"))+1),n=t.lastIndexOf(".");if(n<=0)return;const i=t.slice(n+1).toLowerCase();return Object.hasOwn(w,i)?w[i]:void 0}s(J,"langFromPath");function V(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const{number:t,text:n}=e;return typeof t=="number"&&Number.isInteger(t)&&t>=1&&typeof n=="string"}s(V,"isFileTextLine");function Y(e){if(typeof e!="object"||e===null||Array.isArray(e))return;const{path:t,offset:n,lines:i,totalLines:r,lang:o}=e;if(typeof t!="string"||typeof r!="number"||typeof n!="number"||!Number.isInteger(n)||n<1||!Number.isInteger(r)||r<0||!Array.isArray(i)||!i.every(V)||o!==void 0&&typeof o!="string")return;let a=n-1;for(const{number:l}of i){if(l<=a||l>r)return;a=l}return{path:t,offset:n,lines:i,totalLines:r,...o===void 0?{}:{lang:o}}}s(Y,"readMetaFromMeta");const b=/(?:^|[\\/])\.\.(?:[\\/]|$)/;function Z(e,t){const n=e.agent?.session.header.cwd;return n===void 0||!b.test(n)&&!b.test(t)?n:S(n)}s(Z,"sessionCwd");function y(e,t,n){const i=n??Z(e,t);return{...i!==void 0?{cwd:i}:{},signal:e.signal}}s(y,"sessionResolveOptions");async function _(e,t,n){const i=await e.fs.resolve(n,y(t,n)),r=await e.fs.stat(i,t.signal);if(r===void 0)throw e.emit("fs/observed",i,{kind:"absent"},t),new c(`cannot read "${i.displayPath}": not found`,"FS_NOT_FOUND");if(r.type!=="file")throw new c(`cannot read "${i.displayPath}": not a regular file`,"FS_NOT_REGULAR_FILE");return{target:i,info:r}}s(_,"resolveRegularReadTarget");const K=2e3,Q=10485760;function v(e,t){if(!Number.isFinite(e)||!Number.isInteger(e)||e<1)throw new Error(`${t} must be a positive integer`);return e}s(v,"parsePositiveInteger");function E(e,t){if(e.file_path.trim().length===0)throw new Error("file_path must be a non-empty string");const n=e.offset===void 0?1:v(e.offset,"offset"),i=e.limit===void 0?t:v(e.limit,"limit");if(i>t)throw new Error(`limit must be less than or equal to ${t}`);return{filePath:e.file_path,offset:n,limit:i}}s(E,"parseReadArgs");function ee(e,t){e.systemPrompt.section({name:"tool:read",order:100,text:"Use the read tool — not shell commands like cat — to inspect text files. Results include line numbers. Use offset and limit to continue reading large files."}),e.tools.register(h({name:"read",description:"Read a UTF-8 text file and return line-numbered content.",parameters:{file_path:{type:"string",required:!0,description:"Path to read, resolved by the filesystem backend."},offset:{type:"number",description:"1-based first line to return. Defaults to 1."},limit:{type:"number",description:`Maximum number of lines to return. Defaults to ${t.limit}.`}},output:{schema:{type:"object",additionalProperties:!1,properties:{path:{type:"string",required:!0},offset:{type:"integer",required:!0},lines:{type:"array",required:!0,items:{type:"object",additionalProperties:!1,properties:{number:{type:"integer",required:!0},text:{type:"string",required:!0}}}},totalLines:{type:"integer",required:!0}}},render:s((n,i)=>{const r=E(n,t.limit),o=i.lines.at(-1)?.number??Math.max(0,i.offset-1),a=i.lines.length<r.limit&&o<i.totalLines;return[{type:"text",text:X(i.path,{offset:i.offset,lines:i.lines,totalLines:i.totalLines,...a?{truncatedByBytes:!0}:{}})}]},"render"),presentationMeta:s((n,i)=>{const r=J(i.path);return{path:i.path,offset:i.offset,lines:i.lines.map(({number:o,text:a})=>({number:o,text:a})),totalLines:i.totalLines,...r===void 0?{}:{lang:r}}},"presentationMeta")},isConcurrencySafe:s(()=>!0,"isConcurrencySafe"),async execute(n,i){const r=E(n,t.limit),{target:o,info:a}=await _(e,i,r.filePath),l=await H(a.size===void 0||a.size>=t.streamMinSize?await e.fs.streamText(o,i.signal):[await e.fs.readText(o,i.signal)],{offset:r.offset,limit:r.limit,maxLineLength:t.maxLineLength,maxBytes:t.maxBytes},o.displayPath),f={path:o.displayPath,offset:r.offset,lines:l.lines,totalLines:l.totalLines};return e.emit("fs/observed",o,{kind:"present",version:a.version},i),f},presentResult(n,i){if(i.isError)return;const r=Y(i.meta);if(r===void 0)return;const o=i.content.length===1?i.content[0]:void 0,a=o?.type==="text"?o.text:void 0;if(a===void 0)return;const l=/^<path>[^\n]*<\/path>\n<type>file<\/type>\n<content>\n([\s\S]*)\n<\/content>$/u.exec(a)?.[1];if(l!==void 0)return{card:"read",path:r.path,offset:r.offset,lines:r.lines,totalLines:r.totalLines,...r.lang===void 0?{}:{lang:r.lang},content:[{type:"text",text:l}]}},presentCall(n){const{offset:i,limit:r}=n,o=r!==void 0&&r>0?` (${i??1} - ${(i??1)+r-1})`:i!==void 0?` (from line ${i})`:"";return{card:"generic",title:`Read ${n.file_path}${o}`,kind:"read",locations:[{path:n.file_path,line:i??1}]}}}))}s(ee,"applyReadTool");function L(e,t,n){const i=R("","",t,n,void 0,void 0,{context:3}),r=[];for(const o of i.hunks){const a=[],l=[];for(const f of o.lines){if(f.startsWith("\\"))continue;const d=f.slice(1);f.startsWith("-")?a.push(d):(f.startsWith("+")||a.push(d),l.push(d))}r.push({path:e,oldText:a.length>0?a.join(`
10
10
  `):null,newText:l.join(`
11
- `)})}return r}s(x,"computeHunkDiffs");function re(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const{path:t,oldText:i,newText:n}=e;return typeof t=="string"&&(i===null||typeof i=="string")&&typeof n=="string"}s(re,"isFileDiff");function $(e){if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e.diffs;if(!(!Array.isArray(t)||t.length===0||!t.every(re)))return t}s($,"diffsFromMeta");const oe={FS_STALE_VERSION:"re-read the file, then retry",FS_NOT_OBSERVED:"read the file, then retry"};function T(e){if(!(e instanceof p))return e;const t=oe[e.code];return t?new p(`${e.message} — ${t}`,e.code,{cause:e}):e}s(T,"remediateFsError");function se(e){if(e.file_path.trim().length===0)throw new Error("file_path must be a non-empty string");return{filePath:e.file_path,content:e.content}}s(se,"parseWriteArgs");function ae(e,t){return`<path>${e}</path>
11
+ `)})}return r}s(L,"computeHunkDiffs");function te(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const{path:t,oldText:n,newText:i}=e;return typeof t=="string"&&(n===null||typeof n=="string")&&typeof i=="string"}s(te,"isFileDiff");function x(e){if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e.diffs;if(!(!Array.isArray(t)||t.length===0||!t.every(te)))return t}s(x,"diffsFromMeta");const ie={FS_STALE_VERSION:"re-read the file, then retry",FS_NOT_OBSERVED:"read the file, then retry"};function $(e){if(!(e instanceof c))return e;const t=ie[e.code];return t?new c(`${e.message} — ${t}`,e.code,{cause:e}):e}s($,"remediateFsError");function ne(e){if(e.file_path.trim().length===0)throw new Error("file_path must be a non-empty string");return{filePath:e.file_path,content:e.content}}s(ne,"parseWriteArgs");function re(e,t){return`<path>${e}</path>
12
12
  <type>file</type>
13
13
  <content>
14
14
  ${t.operation==="create"?"Created":"Updated"} file
15
- </content>`}s(ae,"formatWriteOutput");function le(e,t){e.systemPrompt.section({name:"tool:write",order:101,text:"Use the write tool to create files or completely replace file contents. Existing files are overwritten, so read an existing file first (the default fs-observation-policy requires it) and prefer edit for targeted changes."}),e.tools.register(h({name:"write",description:"Create or fully replace a UTF-8 text file.",parameters:{file_path:{type:"string",required:!0,description:"Path to write, resolved by the filesystem backend."},content:{type:"string",required:!0,description:"Full UTF-8 text content to write."},...t.escalationModes.length>0?t.schemaFields():{}},output:{schema:{type:"object",additionalProperties:!1,properties:{path:{type:"string",required:!0},operation:{type:"string",required:!0,enum:["create","update"]},before:{required:!0,oneOf:[{type:"string"},{type:"null"}]},after:{type:"string",required:!0}}},render:s((i,n)=>[{type:"text",text:ae(n.path,n)}],"render"),presentationMeta:s((i,n)=>({diffs:n.before===null?[]:x(i.file_path,n.before,n.after).map(({path:r,oldText:o,newText:a})=>({path:r,oldText:o,newText:a}))}),"presentationMeta")},async execute(i,n){const r=se(i),o=await t.resolvePolicy("write",i,n),a=await e.fs.resolve(r.filePath,g(n,r.filePath,o?.workspaceRoot)),l=await e.waterfall("fs/write-intent",a,n,()=>{});let f;try{f=await e.fs.writeText(a,r.content,l,n.signal,o)}catch(d){throw T(t.mapError(d,o))}return e.emit("fs/observed",a,{kind:"present",version:f.version},n),{path:a.displayPath,operation:f.operation,before:f.before,after:f.after}},presentCall(i){return{card:"diff",title:`Write ${i.file_path}`,diffs:[{path:i.file_path,oldText:null,newText:i.content}],locations:[{path:i.file_path}]}},presentResult(i,n){if(n.isError)return;const r=$(n.meta)??[{path:i.file_path,oldText:null,newText:i.content}];return{card:"diff",title:`Write ${i.file_path}`,diffs:r}}}))}s(le,"applyWriteTool");function fe(e){if(e.file_path.trim().length===0)throw new Error("file_path must be a non-empty string");if(e.old_string.length===0)throw new Error("old_string must be a non-empty string");if(e.old_string===e.new_string)throw new Error("old_string and new_string must differ");return{filePath:e.file_path,oldString:e.old_string,newString:e.new_string,replaceAll:e.replace_all??!1}}s(fe,"parseEditArgs");function de(e,t){return t?`The file ${e} has been updated. All occurrences were successfully replaced.`:`The file ${e} has been updated successfully.`}s(de,"formatEditOutput");function pe(e,t){e.systemPrompt.section({name:"tool:edit",order:102,text:"Use the edit tool for targeted changes to existing UTF-8 text files. It replaces literal old_string with new_string; by default old_string must appear exactly once. If old_string appears multiple times, provide a more specific old_string or set replace_all to true. Read the file first (the default fs-observation-policy requires it), unless you just created or edited it in this session."}),e.tools.register(h({name:"edit",description:"Edit an existing UTF-8 text file by replacing literal text.",parameters:{file_path:{type:"string",required:!0,description:"Path to edit, resolved by the filesystem backend."},old_string:{type:"string",required:!0,description:"Literal text to replace. Must match exactly."},new_string:{type:"string",required:!0,description:"Literal replacement text. Use an empty string to delete the match."},replace_all:{type:"boolean",description:"Replace all matches. Defaults to false; when false, old_string must appear exactly once."},...t.escalationModes.length>0?t.schemaFields():{}},output:{schema:{type:"object",additionalProperties:!1,properties:{path:{type:"string",required:!0},before:{type:"string",required:!0},after:{type:"string",required:!0}}},render:s((i,n)=>[{type:"text",text:de(n.path,i.replace_all??!1)}],"render"),presentationMeta:s((i,n)=>({diffs:x(i.file_path,n.before,n.after).map(({path:r,oldText:o,newText:a})=>({path:r,oldText:o,newText:a}))}),"presentationMeta")},async execute(i,n){const r=fe(i),o=await t.resolvePolicy("edit",i,n),a=await e.fs.resolve(r.filePath,g(n,r.filePath,o?.workspaceRoot));let l;try{const f=await e.waterfall("fs/edit-intent",a,n,()=>{});l=await e.fs.editText(a,{oldString:r.oldString,newString:r.newString,replaceAll:r.replaceAll},f,n.signal,o)}catch(f){throw T(t.mapError(f,o))}return e.emit("fs/observed",a,{kind:"present",version:l.version},n),{path:a.displayPath,before:l.before,after:l.after}},presentCall(i){return{card:"diff",title:`Edit ${i.file_path}`,diffs:[{path:i.file_path,oldText:i.old_string||null,newText:i.new_string}],locations:[{path:i.file_path}]}},presentResult(i,n){if(n.isError)return;const r=$(n.meta);if(r!==void 0)return{card:"diff",title:`Edit ${i.file_path}`,diffs:r}}}))}s(pe,"applyEditTool");const ue={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif"};function ce(e){return ue[w(e).toLowerCase()]}s(ce,"imageMediaTypeForPath");async function me(e,t,i){const n=t.agent?.session.requestHeader()?.config,r=n?.provider??t.agent?.options.provider,o=n?.model??t.agent?.options.model,a=e.get("llm");if(r===void 0||o===void 0||a===void 0)throw new Error(`cannot read "${i}" as an image: the current model route could not be resolved`);const l=await a.resolveModelInfo(r,o,t.signal);if(l.inputModalities===void 0||!l.inputModalities.includes("image"))throw new Error(`cannot read "${i}" as an image: model "${o}" does not declare image input; switch to an image-capable model to read images`)}s(me,"assertImageCapableRoute");function he(e){return{attachmentId:k(e.attachmentId),mediaType:e.mediaType,bytes:e.bytes,width:e.width,height:e.height,...e.name===void 0?{}:{name:e.name}}}s(he,"imageRefFromValue");function ye(e,t){return`<path>${e}</path>
15
+ </content>`}s(re,"formatWriteOutput");function oe(e,t){e.systemPrompt.section({name:"tool:write",order:101,text:"Use the write tool to create files or completely replace file contents. Existing files are overwritten, so read an existing file first (the default fs-observation-policy requires it) and prefer edit for targeted changes."}),e.tools.register(h({name:"write",description:"Create or fully replace a UTF-8 text file.",parameters:{file_path:{type:"string",required:!0,description:"Path to write, resolved by the filesystem backend."},content:{type:"string",required:!0,description:"Full UTF-8 text content to write."},...t.escalationModes.length>0?t.schemaFields():{}},output:{schema:{type:"object",additionalProperties:!1,properties:{path:{type:"string",required:!0},operation:{type:"string",required:!0,enum:["create","update"]},before:{required:!0,oneOf:[{type:"string"},{type:"null"}]},after:{type:"string",required:!0}}},render:s((n,i)=>[{type:"text",text:re(i.path,i)}],"render"),presentationMeta:s((n,i)=>({diffs:i.before===null?[]:L(n.file_path,i.before,i.after).map(({path:r,oldText:o,newText:a})=>({path:r,oldText:o,newText:a}))}),"presentationMeta")},async execute(n,i){const r=ne(n),o=await t.resolvePolicy("write",n,i),a=await e.fs.resolve(r.filePath,y(i,r.filePath,o?.workspaceRoot)),l=await e.waterfall("fs/write-intent",a,i,()=>{});let f;try{f=await e.fs.writeText(a,r.content,l,i.signal,o)}catch(d){throw $(t.mapError(d,o))}return e.emit("fs/observed",a,{kind:"present",version:f.version},i),{path:a.displayPath,operation:f.operation,before:f.before,after:f.after}},presentCall(n){return{card:"diff",title:`Write ${n.file_path}`,diffs:[{path:n.file_path,oldText:null,newText:n.content}],locations:[{path:n.file_path}]}},presentResult(n,i){if(i.isError)return;const r=x(i.meta)??[{path:n.file_path,oldText:null,newText:n.content}];return{card:"diff",title:`Write ${n.file_path}`,diffs:r}}}))}s(oe,"applyWriteTool");function se(e){if(e.file_path.trim().length===0)throw new Error("file_path must be a non-empty string");if(e.old_string.length===0)throw new Error("old_string must be a non-empty string");if(e.old_string===e.new_string)throw new Error("old_string and new_string must differ");return{filePath:e.file_path,oldString:e.old_string,newString:e.new_string,replaceAll:e.replace_all??!1}}s(se,"parseEditArgs");function ae(e,t){return t?`The file ${e} has been updated. All occurrences were successfully replaced.`:`The file ${e} has been updated successfully.`}s(ae,"formatEditOutput");function le(e,t){e.systemPrompt.section({name:"tool:edit",order:102,text:"Use the edit tool for targeted changes to existing UTF-8 text files. It replaces literal old_string with new_string; by default old_string must appear exactly once. If old_string appears multiple times, provide a more specific old_string or set replace_all to true. Read the file first (the default fs-observation-policy requires it), unless you just created or edited it in this session."}),e.tools.register(h({name:"edit",description:"Edit an existing UTF-8 text file by replacing literal text.",parameters:{file_path:{type:"string",required:!0,description:"Path to edit, resolved by the filesystem backend."},old_string:{type:"string",required:!0,description:"Literal text to replace. Must match exactly."},new_string:{type:"string",required:!0,description:"Literal replacement text. Use an empty string to delete the match."},replace_all:{type:"boolean",description:"Replace all matches. Defaults to false; when false, old_string must appear exactly once."},...t.escalationModes.length>0?t.schemaFields():{}},output:{schema:{type:"object",additionalProperties:!1,properties:{path:{type:"string",required:!0},before:{type:"string",required:!0},after:{type:"string",required:!0}}},render:s((n,i)=>[{type:"text",text:ae(i.path,n.replace_all??!1)}],"render"),presentationMeta:s((n,i)=>({diffs:L(n.file_path,i.before,i.after).map(({path:r,oldText:o,newText:a})=>({path:r,oldText:o,newText:a}))}),"presentationMeta")},async execute(n,i){const r=se(n),o=await t.resolvePolicy("edit",n,i),a=await e.fs.resolve(r.filePath,y(i,r.filePath,o?.workspaceRoot));let l;try{const f=await e.waterfall("fs/edit-intent",a,i,()=>{});l=await e.fs.editText(a,{oldString:r.oldString,newString:r.newString,replaceAll:r.replaceAll},f,i.signal,o)}catch(f){throw $(t.mapError(f,o))}return e.emit("fs/observed",a,{kind:"present",version:l.version},i),{path:a.displayPath,before:l.before,after:l.after}},presentCall(n){return{card:"diff",title:`Edit ${n.file_path}`,diffs:[{path:n.file_path,oldText:n.old_string||null,newText:n.new_string}],locations:[{path:n.file_path}]}},presentResult(n,i){if(i.isError)return;const r=x(i.meta);if(r!==void 0)return{card:"diff",title:`Edit ${n.file_path}`,diffs:r}}}))}s(le,"applyEditTool");const fe={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif"};function de(e){return fe[g(e).toLowerCase()]}s(de,"imageMediaTypeForPath");async function pe(e,t,n){const i=t.agent?.session.requestHeader()?.config,r=i?.provider??t.agent?.options.provider,o=i?.model??t.agent?.options.model,a=e.get("llm");if(r===void 0||o===void 0||a===void 0)throw new Error(`cannot read "${n}" as an image: the current model route could not be resolved`);const l=await a.resolveModelInfo(r,o,t.signal);if(l.inputModalities===void 0||!l.inputModalities.includes("image"))throw new Error(`cannot read "${n}" as an image: model "${o}" does not declare image input; switch to an image-capable model to read images`)}s(pe,"assertImageCapableRoute");function ce(e){return{attachmentId:q(e.attachmentId),mediaType:e.mediaType,bytes:e.bytes,width:e.width,height:e.height,...e.name===void 0?{}:{name:e.name}}}s(ce,"imageRefFromValue");function ue(e,t){return`<path>${e}</path>
16
16
  <type>image</type>
17
17
  <content>
18
18
  ${t.mediaType} image, ${t.width}x${t.height} px, ${t.bytes} bytes
19
- </content>`}s(ye,"formatImageReadOutput");function P(e){return[{type:"text",text:ye(e.path,e.image)},{type:"image",attachment:he(e.image)}]}s(P,"imageReadContent");function ge(e){e.tools.register(h({name:"read_image",description:"Read a PNG/JPEG/WebP/GIF file and return the image itself. Requires the current model to accept image input.",parameters:{file_path:{type:"string",required:!0,description:"Path to the image file, resolved by the filesystem backend."}},output:{schema:{type:"object",additionalProperties:!1,properties:{path:{type:"string",required:!0},image:{type:"object",additionalProperties:!1,required:!0,properties:{attachmentId:{type:"string",required:!0},mediaType:{type:"string",enum:["image/png","image/jpeg","image/webp","image/gif"],required:!0},bytes:{type:"integer",required:!0},width:{type:"integer",required:!0},height:{type:"integer",required:!0},name:{type:"string"}}}}},render:s((t,i)=>P(i),"render")},isConcurrencySafe:s(()=>!0,"isConcurrencySafe"),async execute(t,i){if(t.file_path.trim().length===0)throw new Error("file_path must be a non-empty string");const n=ce(t.file_path);if(n===void 0)throw new Error(`cannot read "${t.file_path}": read_image only accepts PNG/JPEG/WebP/GIF paths`);const r=e.get("attachments");if(r===void 0)throw new Error(`cannot read "${t.file_path}" as an image: no attachment service is mounted`);if(!r.imageLimits.mediaTypes.includes(n))throw new Error(`cannot read "${t.file_path}": ${n} images are not accepted by this deployment`);await me(e,i,t.file_path);const{target:o,info:a}=await v(e,i,t.file_path),l=Math.min(r.imageLimits.maxImageBytes,r.imageLimits.maxMessageImageBytes),f=await e.fs.readBytes(o,i.signal,l);let d;try{d=await r.saveImage({data:f,mediaType:n,name:q(o.displayPath)})}catch(m){if(!(m instanceof O)||m.code!=="IMAGE_TYPE_MISMATCH")throw m;const M=w(o.displayPath).toLowerCase();throw new Error(`cannot read "${o.displayPath}": the ${M} extension declares ${n}, but the bytes use a different image format; rename the file to match its actual format if it is PNG/JPEG/WebP/GIF, or convert it to one of those formats`,{cause:m})}e.emit("fs/observed",o,{kind:"present",version:a.version},i);const u={path:o.displayPath,image:{attachmentId:d.attachmentId,mediaType:d.mediaType,bytes:d.bytes,width:d.width,height:d.height,...d.name===void 0?{}:{name:d.name}}};return i.parent!==void 0&&i.deferContext(C({content:P(u),source:{kind:"plugin",plugin:"tool-fs"}})),u},presentCall(t){return{card:"generic",title:`Read image ${t.file_path}`,kind:"read",locations:[{path:t.file_path}]}}}))}s(ge,"applyReadImageTool");var we=class{static{s(this,"FsSandboxController")}ctx;escalationModes;policy;constructor(e){this.ctx=e;const t=e.fs.sandboxMode;if(this.escalationModes=t===void 0?[]:S,this.policy=t===void 0?void 0:e.get("sandboxPolicy"),t!==void 0&&this.policy===void 0)throw new Error("tool-fs: the mounted filesystem confines but ctx.sandboxPolicy is missing")}schemaFields(){return{sandbox_permissions:{type:"string",enum:[...this.escalationModes],description:"The wider sandbox mode this file operation needs. Only valid as a one-shot retry of an operation the sandbox just denied; requires justification and user approval."},justification:{type:"string",description:"Required with sandbox_permissions: one sentence for the user explaining why this exact file operation needs the wider access."}}}async resolvePolicy(e,t,i){F(t.sandbox_permissions,t.justification);const n=this.policy?.resolve({...i.agent?{session:i.agent.session}:{}});if(t.sandbox_permissions===void 0||t.justification===void 0)return n;if(this.escalationModes.length===0)throw new Error("sandbox_permissions is not available in this composition (no sandboxing filesystem to escalate)");const r=n,o=await j({requestedMode:t.sandbox_permissions,justification:t.justification,effectiveMode:r.mode,subject:"operation"},{approver:this.ctx.get("approval"),agent:i.agent,callId:i.callId,toolName:e,signal:i.signal});return{...r,mode:o}}mapError(e,t){if(!(e instanceof p)||e.code!=="FS_SANDBOX_DENIED")return e;const i=t.mode;return new p(`${R(i)}
20
- ${B("operation")}`,"FS_SANDBOX_DENIED",{cause:e})}};const be="tool-fs",_e=["tools","fs","systemPrompt"],ve=c.object({readLimit:c.number().default(te),readMaxLineLength:c.number().default(D),readMaxBytes:c.number().default(U),readStreamMinSize:c.number().default(ie)});function y(e,t){if(!Number.isInteger(t)||t<1)throw new Error(`tool-fs: ${e} must be a positive integer`)}s(y,"assertPositiveInteger");function Ee(e,t){const i=t;y("readLimit",i.readLimit),y("readMaxLineLength",i.readMaxLineLength),y("readMaxBytes",i.readMaxBytes),y("readStreamMinSize",i.readStreamMinSize),ne(e,{limit:i.readLimit,maxLineLength:i.readMaxLineLength,maxBytes:i.readMaxBytes,streamMinSize:i.readStreamMinSize}),e.inject(["attachments"],r=>{ge(r)});const n=new we(e);le(e,n),pe(e,n)}s(Ee,"apply");export{ve as Config,Ee as apply,_e as inject,be as name};
19
+ </content>`}s(ue,"formatImageReadOutput");function he(e){return[{type:"text",text:ue(e.path,e.image)},{type:"image",attachment:ce(e.image)}]}s(he,"imageReadContent");function me(e){e.tools.register(h({name:"read_image",description:"Read a PNG/JPEG/WebP/GIF file and return the image itself. Requires the current model to accept image input.",parameters:{file_path:{type:"string",required:!0,description:"Path to the image file, resolved by the filesystem backend."}},output:{schema:{type:"object",additionalProperties:!1,properties:{path:{type:"string",required:!0},image:{type:"object",additionalProperties:!1,required:!0,properties:{attachmentId:{type:"string",required:!0},mediaType:{type:"string",enum:["image/png","image/jpeg","image/webp","image/gif"],required:!0},bytes:{type:"integer",required:!0},width:{type:"integer",required:!0},height:{type:"integer",required:!0},name:{type:"string"}}}}},render:s((t,n)=>he(n),"render")},isConcurrencySafe:s(()=>!0,"isConcurrencySafe"),async execute(t,n){if(t.file_path.trim().length===0)throw new Error("file_path must be a non-empty string");const i=de(t.file_path);if(i===void 0)throw new Error(`cannot read "${t.file_path}": read_image only accepts PNG/JPEG/WebP/GIF paths`);const r=e.get("attachments");if(r===void 0)throw new Error(`cannot read "${t.file_path}" as an image: no attachment service is mounted`);if(!r.imageLimits.mediaTypes.includes(i))throw new Error(`cannot read "${t.file_path}": ${i} images are not accepted by this deployment`);await pe(e,n,t.file_path);const{target:o,info:a}=await _(e,n,t.file_path),l=Math.min(r.imageLimits.maxImageBytes,r.imageLimits.maxMessageImageBytes),f=await e.fs.readBytes(o,n.signal,l);let d;try{d=await r.saveImage({data:f,mediaType:i,name:F(o.displayPath)})}catch(p){if(!(p instanceof N)||p.code!=="IMAGE_TYPE_MISMATCH")throw p;const T=g(o.displayPath).toLowerCase();throw new Error(`cannot read "${o.displayPath}": the ${T} extension declares ${i}, but the bytes use a different image format; rename the file to match its actual format if it is PNG/JPEG/WebP/GIF, or convert it to one of those formats`,{cause:p})}return e.emit("fs/observed",o,{kind:"present",version:a.version},n),{path:o.displayPath,image:{attachmentId:d.attachmentId,mediaType:d.mediaType,bytes:d.bytes,width:d.width,height:d.height,...d.name===void 0?{}:{name:d.name}}}},presentCall(t){return{card:"generic",title:`Read image ${t.file_path}`,kind:"read",locations:[{path:t.file_path}]}}}))}s(me,"applyReadImageTool");var ye=class{static{s(this,"FsSandboxController")}ctx;escalationModes;policy;constructor(e){this.ctx=e;const t=e.fs.sandboxMode;if(this.escalationModes=t===void 0?[]:M,this.policy=t===void 0?void 0:e.get("sandboxPolicy"),t!==void 0&&this.policy===void 0)throw new Error("tool-fs: the mounted filesystem confines but ctx.sandboxPolicy is missing")}schemaFields(){return{sandbox_permissions:{type:"string",enum:[...this.escalationModes],description:"The wider sandbox mode this file operation needs. Only valid as a one-shot retry of an operation the sandbox just denied; requires justification and user approval."},justification:{type:"string",description:"Required with sandbox_permissions: one sentence for the user explaining why this exact file operation needs the wider access."}}}async resolvePolicy(e,t,n){B(t.sandbox_permissions,t.justification);const i=this.policy?.resolve({...n.agent?{session:n.agent.session}:{}});if(t.sandbox_permissions===void 0||t.justification===void 0)return i;if(this.escalationModes.length===0)throw new Error("sandbox_permissions is not available in this composition (no sandboxing filesystem to escalate)");const r=i,o=await I({requestedMode:t.sandbox_permissions,justification:t.justification,effectiveMode:r.mode,subject:"operation"},{approver:this.ctx.get("approval"),agent:n.agent,callId:n.callId,toolName:e,signal:n.signal});return{...r,mode:o}}mapError(e,t){if(!(e instanceof c)||e.code!=="FS_SANDBOX_DENIED")return e;const n=t.mode;return new c(`${A(n)}
20
+ ${j("operation")}`,"FS_SANDBOX_DENIED",{cause:e})}};const ge="tool-fs",we=["tools","fs","systemPrompt"],be=u.object({readLimit:u.number().default(K),readMaxLineLength:u.number().default(O),readMaxBytes:u.number().default(k),readStreamMinSize:u.number().default(Q)});function m(e,t){if(!Number.isInteger(t)||t<1)throw new Error(`tool-fs: ${e} must be a positive integer`)}s(m,"assertPositiveInteger");function _e(e,t){const n=t;m("readLimit",n.readLimit),m("readMaxLineLength",n.readMaxLineLength),m("readMaxBytes",n.readMaxBytes),m("readStreamMinSize",n.readStreamMinSize),ee(e,{limit:n.readLimit,maxLineLength:n.readMaxLineLength,maxBytes:n.readMaxBytes,streamMinSize:n.readStreamMinSize}),e.inject(["attachments"],r=>{me(r)});const i=new ye(e);oe(e,i),le(e,i)}s(_e,"apply");export{be as Config,_e as apply,we as inject,ge as name};
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-fs","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","dependencies":{"diff":"^9.0.0","@deepseek-ai/schemastery":"^3.18.1"},"peerDependencies":{"@deepseek-ai/dsh-attachment":"^0.0.15","@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/dsh-sandbox":"^0.0.15","@deepseek-ai/dsh-fs":"^0.0.15","@deepseek-ai/dsh-sandbox-policy":"^0.0.15","@deepseek-ai/dsh-session":"^0.0.15","@deepseek-ai/dsh-system-prompt":"^0.0.15","@deepseek-ai/dsh-llm":"^0.0.15","@deepseek-ai/dsh-tools":"^0.0.15","@deepseek-ai/dsh-user-approval":"^0.0.15","@deepseek-ai/cordis":"^4.0.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-fs","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","dependencies":{"diff":"^9.0.0","@deepseek-ai/schemastery":"^3.18.1"},"peerDependencies":{"@deepseek-ai/dsh-attachment":"^0.1.0","@deepseek-ai/dsh-fs":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-sandbox":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-sandbox-policy":"^0.1.0","@deepseek-ai/dsh-system-prompt":"^0.1.0","@deepseek-ai/dsh-session":"^0.1.0","@deepseek-ai/dsh-user-approval":"^0.1.0","@deepseek-ai/dsh-tools":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-fs-search","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","dependencies":{"@vscode/ripgrep":"^1.18.0","@deepseek-ai/schemastery":"^3.18.1"},"peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/dsh-llm":"^0.0.15","@deepseek-ai/dsh-session":"^0.0.15","@deepseek-ai/dsh-output-retention":"^0.0.15","@deepseek-ai/dsh-spill":"^0.0.15","@deepseek-ai/dsh-system-prompt":"^0.0.15","@deepseek-ai/dsh-tools":"^0.0.15","@deepseek-ai/dsh-timeout":"^0.0.15","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-subprocess":"^0.0.15"}}
1
+ {"name":"@deepseek-ai/dsh-tool-fs-search","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","dependencies":{"@vscode/ripgrep":"^1.18.0","@deepseek-ai/schemastery":"^3.18.1"},"peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-output-retention":"^0.1.0","@deepseek-ai/dsh-session":"^0.1.0","@deepseek-ai/dsh-spill":"^0.1.0","@deepseek-ai/dsh-subprocess":"^0.1.0","@deepseek-ai/dsh-system-prompt":"^0.1.0","@deepseek-ai/dsh-timeout":"^0.1.0","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-tools":"^0.1.0"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-goal","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/dsh-session":"^0.0.15","@deepseek-ai/dsh-llm":"^0.0.15","@deepseek-ai/dsh-tools":"^0.0.15","@deepseek-ai/dsh-goal":"^0.0.15","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-system-prompt":"^0.0.15","@deepseek-ai/dsh-agent":"^0.0.15"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-goal","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-goal":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-system-prompt":"^0.1.0","@deepseek-ai/dsh-session":"^0.1.0","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-tools":"^0.1.0"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-jobs","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","dependencies":{"@deepseek-ai/schemastery":"^3.18.1"},"peerDependencies":{"@deepseek-ai/dsh-agent":"^0.0.15","@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/dsh-llm":"^0.0.15","@deepseek-ai/dsh-output-retention":"^0.0.15","@deepseek-ai/dsh-system-prompt":"^0.0.15","@deepseek-ai/dsh-tools":"^0.0.15","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-jobs":"^0.0.15"}}
1
+ {"name":"@deepseek-ai/dsh-tool-jobs","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","dependencies":{"@deepseek-ai/schemastery":"^3.18.1"},"peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-system-prompt":"^0.1.0","@deepseek-ai/dsh-output-retention":"^0.1.0","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-tools":"^0.1.0","@deepseek-ai/dsh-jobs":"^0.1.0"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-pwsh","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.0.15","@deepseek-ai/dsh-shell":"^0.0.15","@deepseek-ai/dsh-shell-env":"^0.0.15","@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/dsh-llm":"^0.0.15","@deepseek-ai/dsh-sandbox":"^0.0.15","@deepseek-ai/dsh-sandbox-policy":"^0.0.15","@deepseek-ai/dsh-system-prompt":"^0.0.15","@deepseek-ai/dsh-tools":"^0.0.15","@deepseek-ai/dsh-user-approval":"^0.0.15","@deepseek-ai/dsh-jobs":"^0.0.15","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-pwsh","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-shell":"^0.1.0","@deepseek-ai/dsh-shell-env":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-sandbox":"^0.1.0","@deepseek-ai/dsh-sandbox-policy":"^0.1.0","@deepseek-ai/dsh-tools":"^0.1.0","@deepseek-ai/dsh-system-prompt":"^0.1.0","@deepseek-ai/dsh-jobs":"^0.1.0","@deepseek-ai/dsh-user-approval":"^0.1.0","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-ralph","version":"0.0.15","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.0.15","@deepseek-ai/dsh-invariants":"^0.0.15","@deepseek-ai/dsh-llm":"^0.0.15","@deepseek-ai/dsh-subagent":"^0.0.15","@deepseek-ai/dsh-tools":"^0.0.15","@deepseek-ai/dsh-system-prompt":"^0.0.15","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-workflow":"^0.0.15"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-ralph","version":"0.1.0","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0","@deepseek-ai/dsh-invariants":"^0.1.0","@deepseek-ai/dsh-llm":"^0.1.0","@deepseek-ai/dsh-subagent":"^0.1.0","@deepseek-ai/dsh-system-prompt":"^0.1.0","@deepseek-ai/dsh-tools":"^0.1.0","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-workflow":"^0.1.0"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}