@qqbrowser/qbot-dsh 0.1.5 → 0.1.6

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 (219) hide show
  1. package/config/agent-presets/code/agent.cordis.yml +2 -0
  2. package/config/agent-presets/standard/agent.cordis.yml +2 -0
  3. package/cordis.patch.yml +4 -0
  4. package/lib/client.js +1 -1
  5. package/node_modules/@deepseek-ai/dsh-agent/package.json +1 -1
  6. package/node_modules/@deepseek-ai/dsh-agent-default-model/package.json +1 -1
  7. package/node_modules/@deepseek-ai/dsh-agent-instructions/package.json +1 -1
  8. package/node_modules/@deepseek-ai/dsh-agent-loop/package.json +1 -1
  9. package/node_modules/@deepseek-ai/dsh-agent-presets/package.json +1 -1
  10. package/node_modules/@deepseek-ai/dsh-agent-tool-presentation/package.json +1 -1
  11. package/node_modules/@deepseek-ai/dsh-anonymous-user-id/package.json +1 -1
  12. package/node_modules/@deepseek-ai/dsh-api-gateway/package.json +1 -1
  13. package/node_modules/@deepseek-ai/dsh-api-remotes/package.json +1 -1
  14. package/node_modules/@deepseek-ai/dsh-app-boot/package.json +1 -1
  15. package/node_modules/@deepseek-ai/dsh-attachment/package.json +1 -1
  16. package/node_modules/@deepseek-ai/dsh-attachment-local/package.json +1 -1
  17. package/node_modules/@deepseek-ai/dsh-base/cordis.patch.yml +2 -0
  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-browser-jsapi/LICENSE +21 -0
  22. package/node_modules/@deepseek-ai/dsh-browser-jsapi/lib/index.js +1 -0
  23. package/node_modules/@deepseek-ai/dsh-browser-jsapi/lib/invariant.js +1 -0
  24. package/node_modules/@deepseek-ai/dsh-browser-jsapi/lib/types/index.js +1 -0
  25. package/node_modules/@deepseek-ai/dsh-browser-jsapi/lib/types/invariant.js +1 -0
  26. package/node_modules/@deepseek-ai/dsh-browser-jsapi/lib/types/types.js +1 -0
  27. package/node_modules/@deepseek-ai/dsh-browser-jsapi/package.json +1 -0
  28. package/node_modules/@deepseek-ai/dsh-client-connection/lib/client.js +13 -13
  29. package/node_modules/@deepseek-ai/dsh-client-connection/package.json +1 -1
  30. package/node_modules/@deepseek-ai/dsh-client-hmr/package.json +1 -1
  31. package/node_modules/@deepseek-ai/dsh-client-locale/lib/client.js +1 -1
  32. package/node_modules/@deepseek-ai/dsh-client-locale/package.json +1 -1
  33. package/node_modules/@deepseek-ai/dsh-client-modules/lib/client.js +1 -1
  34. package/node_modules/@deepseek-ai/dsh-client-modules/lib/index.js +3 -3
  35. package/node_modules/@deepseek-ai/dsh-client-runtime/lib/client.js +4 -4
  36. package/node_modules/@deepseek-ai/dsh-client-runtime/package.json +1 -1
  37. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/lib/client.js +1 -1
  38. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/package.json +1 -1
  39. package/node_modules/@deepseek-ai/dsh-client-ui-commands/lib/client.js +1 -1
  40. package/node_modules/@deepseek-ai/dsh-client-ui-commands/package.json +1 -1
  41. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +5 -5
  42. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/package.json +1 -1
  43. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/lib/client.js +1 -1
  44. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/package.json +1 -1
  45. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/client.js +1 -1
  46. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/package.json +1 -1
  47. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/lib/client.js +1 -1
  48. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/package.json +1 -1
  49. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-native/package.json +1 -1
  50. package/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/client.js +1 -1
  51. package/node_modules/@deepseek-ai/dsh-client-ui-goal/package.json +1 -1
  52. package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/lib/client.js +1 -1
  53. package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/package.json +1 -1
  54. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/lib/client.js +1 -1
  55. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/package.json +1 -1
  56. package/node_modules/@deepseek-ai/dsh-client-ui-jsapi-bridge/LICENSE +21 -0
  57. package/node_modules/@deepseek-ai/dsh-client-ui-jsapi-bridge/lib/client.js +1 -0
  58. package/node_modules/@deepseek-ai/dsh-client-ui-jsapi-bridge/lib/index.js +1 -0
  59. package/node_modules/@deepseek-ai/dsh-client-ui-jsapi-bridge/lib/invariant.js +1 -0
  60. package/node_modules/@deepseek-ai/dsh-client-ui-jsapi-bridge/package.json +1 -0
  61. package/node_modules/@deepseek-ai/dsh-client-ui-layout/lib/client.js +1 -1
  62. package/node_modules/@deepseek-ai/dsh-client-ui-layout/package.json +1 -1
  63. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/lib/client.js +1 -1
  64. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/package.json +1 -1
  65. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +1 -1
  66. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/package.json +1 -1
  67. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/lib/client.js +1 -1
  68. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/package.json +1 -1
  69. package/node_modules/@deepseek-ai/dsh-client-ui-plan/lib/client.js +1 -1
  70. package/node_modules/@deepseek-ai/dsh-client-ui-plan/package.json +1 -1
  71. package/node_modules/@deepseek-ai/dsh-client-ui-settings/package.json +1 -1
  72. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +1 -1
  73. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/package.json +1 -1
  74. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +1 -1
  75. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/package.json +1 -1
  76. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/lib/client.js +1 -1
  77. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/package.json +1 -1
  78. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/client.js +1 -1
  79. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/package.json +1 -1
  80. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  81. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/package.json +1 -1
  82. package/node_modules/@deepseek-ai/dsh-client-ui-skill/lib/client.js +1 -1
  83. package/node_modules/@deepseek-ai/dsh-client-ui-skill/package.json +1 -1
  84. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/lib/client.js +1 -1
  85. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/package.json +1 -1
  86. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +1 -1
  87. package/node_modules/@deepseek-ai/dsh-client-ui-theme/package.json +1 -1
  88. package/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/client.js +1 -1
  89. package/node_modules/@deepseek-ai/dsh-client-ui-tool/package.json +1 -1
  90. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/lib/client.js +3 -3
  91. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/package.json +1 -1
  92. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/lib/client.js +1 -1
  93. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/package.json +1 -1
  94. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/lib/client.js +1 -1
  95. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/package.json +1 -1
  96. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +1 -1
  97. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/package.json +1 -1
  98. package/node_modules/@deepseek-ai/dsh-client-web/lib/index.js +2 -2
  99. package/node_modules/@deepseek-ai/dsh-client-web/package.json +1 -1
  100. package/node_modules/@deepseek-ai/dsh-code-runtime-worker-thread/package.json +1 -1
  101. package/node_modules/@deepseek-ai/dsh-command-compact/package.json +1 -1
  102. package/node_modules/@deepseek-ai/dsh-command-feedback/package.json +1 -1
  103. package/node_modules/@deepseek-ai/dsh-command-goal/package.json +1 -1
  104. package/node_modules/@deepseek-ai/dsh-commands/package.json +1 -1
  105. package/node_modules/@deepseek-ai/dsh-compaction/package.json +1 -1
  106. package/node_modules/@deepseek-ai/dsh-compaction-basic/package.json +1 -1
  107. package/node_modules/@deepseek-ai/dsh-compaction-tool-result-pruner/package.json +1 -1
  108. package/node_modules/@deepseek-ai/dsh-cordis-client-runner/package.json +1 -1
  109. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/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-sandbox/package.json +1 -1
  113. package/node_modules/@deepseek-ai/dsh-goal/package.json +1 -1
  114. package/node_modules/@deepseek-ai/dsh-goal-round-driver/package.json +1 -1
  115. package/node_modules/@deepseek-ai/dsh-headless/package.json +1 -1
  116. package/node_modules/@deepseek-ai/dsh-home-paths/package.json +1 -1
  117. package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/index.js +7 -7
  118. package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/types/api/browser-jsapi.js +1 -0
  119. package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/types/api/browser-jsapi.schema.js +1 -0
  120. package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/types/api/events.schema.js +1 -1
  121. package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/types/api-proxy.js +1 -1
  122. package/node_modules/@deepseek-ai/dsh-host-apiproxy/package.json +1 -1
  123. package/node_modules/@deepseek-ai/dsh-host-directory-picker-auto/package.json +1 -1
  124. package/node_modules/@deepseek-ai/dsh-host-directory-picker-browse/package.json +1 -1
  125. package/node_modules/@deepseek-ai/dsh-host-frontend-static/package.json +1 -1
  126. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/package.json +1 -1
  127. package/node_modules/@deepseek-ai/dsh-jobs/package.json +1 -1
  128. package/node_modules/@deepseek-ai/dsh-jobs-local/package.json +1 -1
  129. package/node_modules/@deepseek-ai/dsh-llm/package.json +1 -1
  130. package/node_modules/@deepseek-ai/dsh-llm-deepseek/package.json +1 -1
  131. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/package.json +1 -1
  132. package/node_modules/@deepseek-ai/dsh-llm-retry/package.json +1 -1
  133. package/node_modules/@deepseek-ai/dsh-mcp-client/package.json +1 -1
  134. package/node_modules/@deepseek-ai/dsh-message-feedback/package.json +1 -1
  135. package/node_modules/@deepseek-ai/dsh-permission-presets/package.json +1 -1
  136. package/node_modules/@deepseek-ai/dsh-plan-mode/package.json +1 -1
  137. package/node_modules/@deepseek-ai/dsh-pwsh-local/package.json +1 -1
  138. package/node_modules/@deepseek-ai/dsh-pwsh-sandbox/package.json +1 -1
  139. package/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/package.json +1 -1
  140. package/node_modules/@deepseek-ai/dsh-sandbox/package.json +1 -1
  141. package/node_modules/@deepseek-ai/dsh-sandbox-local/package.json +1 -1
  142. package/node_modules/@deepseek-ai/dsh-sandbox-policy/package.json +1 -1
  143. package/node_modules/@deepseek-ai/dsh-schedule/package.json +1 -1
  144. package/node_modules/@deepseek-ai/dsh-session/lib/index.js +1 -1
  145. package/node_modules/@deepseek-ai/dsh-session/lib/types/known-event-types.js +1 -1
  146. package/node_modules/@deepseek-ai/dsh-session/package.json +1 -1
  147. package/node_modules/@deepseek-ai/dsh-session-checkpoint-policy/package.json +1 -1
  148. package/node_modules/@deepseek-ai/dsh-session-log-export/package.json +1 -1
  149. package/node_modules/@deepseek-ai/dsh-session-persistence/package.json +1 -1
  150. package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/package.json +1 -1
  151. package/node_modules/@deepseek-ai/dsh-session-projection/package.json +1 -1
  152. package/node_modules/@deepseek-ai/dsh-session-projection-cache/package.json +1 -1
  153. package/node_modules/@deepseek-ai/dsh-session-query/package.json +1 -1
  154. package/node_modules/@deepseek-ai/dsh-session-query-sqlite/package.json +1 -1
  155. package/node_modules/@deepseek-ai/dsh-session-reference/package.json +1 -1
  156. package/node_modules/@deepseek-ai/dsh-session-stats/package.json +1 -1
  157. package/node_modules/@deepseek-ai/dsh-session-telemetry/package.json +1 -1
  158. package/node_modules/@deepseek-ai/dsh-session-telemetry-otel/package.json +1 -1
  159. package/node_modules/@deepseek-ai/dsh-session-title/package.json +1 -1
  160. package/node_modules/@deepseek-ai/dsh-session-title-first-prompt-llm/package.json +1 -1
  161. package/node_modules/@deepseek-ai/dsh-session-title-llm/package.json +1 -1
  162. package/node_modules/@deepseek-ai/dsh-settings/package.json +1 -1
  163. package/node_modules/@deepseek-ai/dsh-settings-file/package.json +1 -1
  164. package/node_modules/@deepseek-ai/dsh-shell/package.json +1 -1
  165. package/node_modules/@deepseek-ai/dsh-shell-env/package.json +1 -1
  166. package/node_modules/@deepseek-ai/dsh-skill-filesystem/package.json +1 -1
  167. package/node_modules/@deepseek-ai/dsh-spill/package.json +1 -1
  168. package/node_modules/@deepseek-ai/dsh-spill-local/package.json +1 -1
  169. package/node_modules/@deepseek-ai/dsh-spill-policy/package.json +1 -1
  170. package/node_modules/@deepseek-ai/dsh-storage-domain/package.json +1 -1
  171. package/node_modules/@deepseek-ai/dsh-storage-json/package.json +1 -1
  172. package/node_modules/@deepseek-ai/dsh-subagent/package.json +1 -1
  173. package/node_modules/@deepseek-ai/dsh-subagent-fork-in-process/package.json +1 -1
  174. package/node_modules/@deepseek-ai/dsh-subagent-in-process-driver/package.json +1 -1
  175. package/node_modules/@deepseek-ai/dsh-subagent-spawn-in-process/package.json +1 -1
  176. package/node_modules/@deepseek-ai/dsh-subprocess/package.json +1 -1
  177. package/node_modules/@deepseek-ai/dsh-terminal/package.json +1 -1
  178. package/node_modules/@deepseek-ai/dsh-terminal-bash/package.json +1 -1
  179. package/node_modules/@deepseek-ai/dsh-time-context/package.json +1 -1
  180. package/node_modules/@deepseek-ai/dsh-timeout/package.json +1 -1
  181. package/node_modules/@deepseek-ai/dsh-tmux-context/package.json +1 -1
  182. package/node_modules/@deepseek-ai/dsh-token-meter/package.json +1 -1
  183. package/node_modules/@deepseek-ai/dsh-tool-ask-user/package.json +1 -1
  184. package/node_modules/@deepseek-ai/dsh-tool-bash/package.json +1 -1
  185. package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/package.json +1 -1
  186. package/node_modules/@deepseek-ai/dsh-tool-browser/LICENSE +21 -0
  187. package/node_modules/@deepseek-ai/dsh-tool-browser/lib/index.js +1 -0
  188. package/node_modules/@deepseek-ai/dsh-tool-browser/lib/invariant.js +1 -0
  189. package/node_modules/@deepseek-ai/dsh-tool-browser/package.json +1 -0
  190. package/node_modules/@deepseek-ai/dsh-tool-call-timeout-policy/package.json +1 -1
  191. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/index.js +14 -5
  192. package/node_modules/@deepseek-ai/dsh-tool-cordis/package.json +1 -1
  193. package/node_modules/@deepseek-ai/dsh-tool-fs/package.json +1 -1
  194. package/node_modules/@deepseek-ai/dsh-tool-fs-search/package.json +1 -1
  195. package/node_modules/@deepseek-ai/dsh-tool-goal/package.json +1 -1
  196. package/node_modules/@deepseek-ai/dsh-tool-jobs/package.json +1 -1
  197. package/node_modules/@deepseek-ai/dsh-tool-pwsh/package.json +1 -1
  198. package/node_modules/@deepseek-ai/dsh-tool-ralph/package.json +1 -1
  199. package/node_modules/@deepseek-ai/dsh-tool-skill/package.json +1 -1
  200. package/node_modules/@deepseek-ai/dsh-tool-str-replace-editor/package.json +1 -1
  201. package/node_modules/@deepseek-ai/dsh-tool-subagent/package.json +1 -1
  202. package/node_modules/@deepseek-ai/dsh-tool-subagent-control/package.json +1 -1
  203. package/node_modules/@deepseek-ai/dsh-tool-subagent-report/package.json +1 -1
  204. package/node_modules/@deepseek-ai/dsh-tool-todo/package.json +1 -1
  205. package/node_modules/@deepseek-ai/dsh-tool-web/package.json +1 -1
  206. package/node_modules/@deepseek-ai/dsh-tool-workflow/package.json +1 -1
  207. package/node_modules/@deepseek-ai/dsh-tools/package.json +1 -1
  208. package/node_modules/@deepseek-ai/dsh-typert-registry/package.json +1 -1
  209. package/node_modules/@deepseek-ai/dsh-user-approval/package.json +1 -1
  210. package/node_modules/@deepseek-ai/dsh-user-questions/package.json +1 -1
  211. package/node_modules/@deepseek-ai/dsh-web-app/cordis.patch.yml +3 -0
  212. package/node_modules/@deepseek-ai/dsh-web-app/package.json +1 -1
  213. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/{index-fPGOmJjK.js → index-DfZHS_gV.js} +31 -31
  214. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/index.html +1 -1
  215. package/node_modules/@deepseek-ai/dsh-web-search-deepseek/package.json +1 -1
  216. package/node_modules/@deepseek-ai/dsh-workflow/package.json +1 -1
  217. package/node_modules/@deepseek-ai/dsh-workflow-worker-thread/package.json +1 -1
  218. package/node_modules/@deepseek-ai/dsh-workspace/package.json +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-bash","version":"0.1.0-rc.7","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-rc.7","@deepseek-ai/dsh-shell-env":"^0.1.0-rc.7","@deepseek-ai/dsh-sandbox":"^0.1.0-rc.7","@deepseek-ai/dsh-sandbox-policy":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/dsh-jobs":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-user-approval":"^0.1.0-rc.7","@deepseek-ai/dsh-shell":"^0.1.0-rc.7"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-bash","version":"0.1.0-rc.7","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":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-sandbox":"^0.1.0-rc.7","@deepseek-ai/dsh-sandbox-policy":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/dsh-jobs":"^0.1.0-rc.7","@deepseek-ai/dsh-user-approval":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-shell-env":"^0.1.0-rc.7"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-bash-persistent","version":"0.1.0-rc.7","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-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-timeout":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-terminal":"^0.1.0-rc.7"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-bash-persistent","version":"0.1.0-rc.7","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-rc.7","@deepseek-ai/dsh-timeout":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-agent":"^0.1.0-rc.7"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ var E=Object.defineProperty;var t=(e,s)=>E(e,"name",{value:s,configurable:!0});import{assertNever as C}from"@deepseek-ai/dsh-llm";import{defineTool as O,validateJsonSchemaValue as A,valueSchemaSpecToJsonSchema as T}from"@deepseek-ai/dsh-tools";import{BrowserJsapiError as h}from"@deepseek-ai/dsh-browser-jsapi";function a(e,s){if(typeof e!="object"||e===null||Array.isArray(e))return"";const l=e[s];return typeof l=="string"?l:""}t(a,"titleField");function w(e,s){if(typeof e!="object"||e===null||Array.isArray(e))return"";const l=e[s];return typeof l=="number"?String(l):""}t(w,"titleNumberField");const o=" Must be a non-empty string.",g=" Epoch milliseconds; must not be negative.",J=20,j={type:"number",default:J,description:`Maximum results to return. Clamped to 1-100 and truncated to an integer by the browser; defaults to ${String(J)}.`},v={type:"object",additionalProperties:!0,properties:{id:{type:"string",required:!0,description:"Stable bookmark id, accepted by bookmarks.remove."},title:{type:"string",required:!0},url:{type:"string",description:"Absent on folders."},parentId:{type:"string"},dateAdded:{type:"number",description:"Epoch milliseconds."}}},S={type:"object",additionalProperties:!0,properties:{id:{type:"string",required:!0},title:{type:"string",required:!0},url:{type:"string",description:"Absent on folders."},dateAdded:{type:"number",description:"Epoch milliseconds."},children:{type:"json",description:"Nested BookmarkTreeNode array on folders; absent on leaves."}}},q={type:"object",additionalProperties:!0,properties:{id:{type:"number",description:"Stable tab id, accepted by tabs.get, tabs.update, tabs.remove and tabs.reload; absent for a tab that has not finished initializing."},windowId:{type:"number",required:!0},index:{type:"number",required:!0,description:"Zero-based position of the tab in its window."},title:{type:"string",description:"Page title; absent before the tab finishes loading."},url:{type:"string",description:"Page URL; absent on the new-tab page."},active:{type:"boolean",required:!0,description:"Whether this tab is the active tab in its window."},pinned:{type:"boolean",required:!0,description:"Whether this tab is pinned."},status:{type:"string",description:"Loading status: loading or complete."}}},U={type:"object",additionalProperties:!0,properties:{visitId:{type:"string",required:!0},visitTime:{type:"number",required:!0,description:"Epoch milliseconds of this visit."},referringVisitId:{type:"string",description:"The visit that referred the user here, if any."},transition:{type:"string",description:"How the user reached this page: link, typed, reload, and so on."}}},R=[{permission:"history",summary:"Search the user's browsing history by page title or URL text.",readReason:"Read your browser history"},{permission:"bookmarks",summary:"Read and edit the user's bookmarks, including the folder tree.",readReason:"Read your bookmarks"},{permission:"tabs",summary:"Read and act on the user's open browser tabs.",readReason:"Read your open tabs"},{permission:"qbSkin",summary:"Read and change the browser's skin (theme) and its appearance settings.",readReason:"Read your skin settings"}],N=[{method:"history.search",permission:"history",access:"read",description:"Search the user's browser history by page title or URL text. Returns matching visits, most recent first.",params:{type:"object",additionalProperties:!1,properties:{text:{type:"string",required:!0,description:`Text to match against page titles and URLs.${o} An empty search is rejected, not treated as "everything".`},limit:j,startTime:{type:"number",description:`Only visits at or after this time match.${g}`},endTime:{type:"number",description:`Only visits at or before this time match.${g}`}}},returns:{type:"array",description:"Matching visits, most recent first.",items:{type:"object",additionalProperties:!0,properties:{url:{type:"string",required:!0},title:{type:"string",required:!0},visitTime:{type:"number",required:!0,description:"Epoch milliseconds of the last visit."},visitCount:{type:"number"}}}},title:t(e=>`Search browser history: ${JSON.stringify(a(e,"text"))}`,"title"),kind:"search"},{method:"bookmarks.search",permission:"bookmarks",access:"read",description:"Search the user's browser bookmarks by title or URL text. Prefer this over bookmarks.getTree when looking for specific bookmarks: it returns a flat, bounded list, and each result's parentId locates its folder.",params:{type:"object",additionalProperties:!1,properties:{query:{type:"string",required:!0,description:`Text to match against bookmark titles and URLs.${o} An empty query is rejected, not treated as "everything".`},limit:j}},returns:{type:"array",description:"Matching bookmarks.",items:v},title:t(e=>`Search bookmarks: ${JSON.stringify(a(e,"query"))}`,"title"),kind:"search"},{method:"bookmarks.getTree",permission:"bookmarks",access:"read",description:"Read the user's full browser bookmark tree. Folders carry nested children; leaf nodes carry a url. Takes no arguments and accepts no limit, so a real profile can return thousands of nodes in one result — use bookmarks.search when looking for specific bookmarks, and read this only when the folder structure itself is the goal.",params:{type:"object",additionalProperties:!1,properties:{}},returns:{type:"array",description:"The tree roots, with folders nesting through children.",items:S},title:t(()=>"Read bookmark tree","title"),kind:"read"},{method:"bookmarks.create",permission:"bookmarks",access:"write",description:"Create one browser bookmark. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{title:{type:"string",required:!0,description:`Bookmark title.${o}`},url:{type:"string",required:!0,description:`Bookmark target URL.${o} Must be absolute and parseable, e.g. https://example.com/page.`},parentId:{type:"string",description:"Folder id to create the bookmark in; defaults to the browser's default location."}}},returns:v,title:t(e=>`Create bookmark: ${JSON.stringify(a(e,"title"))}`,"title"),kind:"edit"},{method:"bookmarks.remove",permission:"bookmarks",access:"write",description:"Remove one browser bookmark by id. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{id:{type:"string",required:!0,description:`Id of the bookmark to remove, from bookmarks.search or bookmarks.getTree.${o}`}}},returns:{type:"json",description:"No payload; a non-error result means the bookmark was removed."},title:t(e=>`Remove bookmark: ${JSON.stringify(a(e,"id"))}`,"title"),kind:"delete"},{method:"bookmarks.get",permission:"bookmarks",access:"read",description:"Read one bookmark or folder by id.",params:{type:"object",additionalProperties:!1,properties:{id:{type:"string",required:!0,description:`Id of the bookmark to read, from bookmarks.search or bookmarks.getTree.${o}`}}},returns:{type:"array",description:"The bookmark(s) with the given id.",items:S},title:t(e=>`Read bookmark: ${JSON.stringify(a(e,"id"))}`,"title"),kind:"read"},{method:"bookmarks.getChildren",permission:"bookmarks",access:"read",description:"Read the direct children of one bookmark folder. Prefer this over bookmarks.getTree when only one folder's contents are needed.",params:{type:"object",additionalProperties:!1,properties:{id:{type:"string",required:!0,description:`Folder id whose children to read, from bookmarks.getTree.${o}`}}},returns:{type:"array",description:"The folder's direct children.",items:S},title:t(e=>`Read bookmark folder: ${JSON.stringify(a(e,"id"))}`,"title"),kind:"read"},{method:"bookmarks.getSubTree",permission:"bookmarks",access:"read",description:"Read one bookmark folder and everything under it, nested through children. Prefer bookmarks.getChildren when only one level is needed.",params:{type:"object",additionalProperties:!1,properties:{id:{type:"string",required:!0,description:`Folder id whose subtree to read, from bookmarks.getTree.${o}`}}},returns:{type:"array",description:"The subtree rooted at the given folder.",items:S},title:t(e=>`Read bookmark subtree: ${JSON.stringify(a(e,"id"))}`,"title"),kind:"read"},{method:"bookmarks.update",permission:"bookmarks",access:"write",description:"Change one bookmark's title or URL. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{id:{type:"string",required:!0,description:`Id of the bookmark to update, from bookmarks.search or bookmarks.getTree.${o}`},title:{type:"string",description:"New bookmark title."},url:{type:"string",description:`New bookmark URL.${o} Must be absolute and parseable when provided.`}}},returns:v,title:t(e=>`Update bookmark: ${JSON.stringify(a(e,"id"))}`,"title"),kind:"edit"},{method:"bookmarks.move",permission:"bookmarks",access:"write",description:"Move one bookmark to a different folder or position. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{id:{type:"string",required:!0,description:`Id of the bookmark to move, from bookmarks.search or bookmarks.getTree.${o}`},parentId:{type:"string",description:"Folder id to move the bookmark into; defaults to its current folder."},index:{type:"number",description:"Zero-based position within the destination folder."}}},returns:v,title:t(e=>`Move bookmark: ${JSON.stringify(a(e,"id"))}`,"title"),kind:"edit"},{method:"history.getVisits",permission:"history",access:"read",description:"Read every visit to one URL from the browser history, most recent first.",params:{type:"object",additionalProperties:!1,properties:{url:{type:"string",required:!0,description:`URL whose visits to read.${o} Must be absolute and parseable.`}}},returns:{type:"array",description:"Visits to the URL, most recent first.",items:U},title:t(e=>`Read visits: ${JSON.stringify(a(e,"url"))}`,"title"),kind:"read"},{method:"history.addUrl",permission:"history",access:"write",description:"Add one URL to the browser history. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{url:{type:"string",required:!0,description:`URL to add.${o} Must be absolute and parseable.`},title:{type:"string",description:"Optional page title."}}},returns:{type:"json",description:"No payload; a non-error result means the visit was added."},title:t(e=>`Add history entry: ${JSON.stringify(a(e,"url"))}`,"title"),kind:"edit"},{method:"history.deleteUrl",permission:"history",access:"write",description:"Remove every visit to one URL from the browser history. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{url:{type:"string",required:!0,description:`URL whose visits to remove.${o} Must be absolute and parseable.`}}},returns:{type:"json",description:"No payload; a non-error result means the visits were removed."},title:t(e=>`Delete history for: ${JSON.stringify(a(e,"url"))}`,"title"),kind:"delete"},{method:"history.deleteRange",permission:"history",access:"write",description:"Remove all browser history within a time range. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{startTime:{type:"number",required:!0,description:`Remove visits at or after this time.${g}`},endTime:{type:"number",required:!0,description:`Remove visits at or before this time.${g}`}}},returns:{type:"json",description:"No payload; a non-error result means the range was removed."},title:t(()=>"Delete history range","title"),kind:"delete"},{method:"history.deleteAll",permission:"history",access:"write",description:"Clear the entire browser history. Asks the user's approval on every call; prefer history.deleteUrl or history.deleteRange for a narrower removal.",params:{type:"object",additionalProperties:!1,properties:{}},returns:{type:"json",description:"No payload; a non-error result means the history was cleared."},title:t(()=>"Clear all browser history","title"),kind:"delete"},{method:"tabs.query",permission:"tabs",access:"read",description:"Find the user's open tabs by exact title, URL pattern, active/pinned state, or current window. Returns one entry per matching tab; use tabs.get when the tab id is already known.",params:{type:"object",additionalProperties:!1,properties:{title:{type:"string",description:"Match tabs whose title equals this text."},url:{type:"string",description:"Match tabs whose URL matches this pattern, e.g. https://example.com/*."},active:{type:"boolean",description:"Only the active tab of each window when true."},pinned:{type:"boolean",description:"Only pinned (true) or unpinned (false) tabs."},currentWindow:{type:"boolean",description:"Only tabs in the current window when true."},limit:j}},returns:{type:"array",description:"Matching tabs.",items:q},title:t(e=>`Query tabs: ${JSON.stringify(a(e,"title"))}`,"title"),kind:"search"},{method:"tabs.get",permission:"tabs",access:"read",description:"Read one open tab by id.",params:{type:"object",additionalProperties:!1,properties:{tabId:{type:"number",required:!0,description:"Id of the tab to read, from tabs.query."}}},returns:q,title:t(e=>`Read tab: ${w(e,"tabId")}`,"title"),kind:"read"},{method:"tabs.create",permission:"tabs",access:"write",description:"Open a new browser tab. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{url:{type:"string",description:`URL to open.${o} Must be absolute and parseable when provided; omit for a blank tab.`},active:{type:"boolean",description:"Whether the new tab becomes the active tab; defaults to the browser default."},pinned:{type:"boolean",description:"Whether the new tab is pinned."},windowId:{type:"number",description:"Window to create the tab in; defaults to the current window."}}},returns:q,title:t(e=>`Open tab: ${JSON.stringify(a(e,"url"))}`,"title"),kind:"edit"},{method:"tabs.update",permission:"tabs",access:"write",description:"Change one open tab's URL, active state, or pinned state. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{tabId:{type:"number",required:!0,description:"Id of the tab to update, from tabs.query."},url:{type:"string",description:`New URL to navigate the tab to.${o} Must be absolute and parseable when provided.`},active:{type:"boolean",description:"Whether to make this the active tab."},pinned:{type:"boolean",description:"Whether to pin or unpin the tab."}}},returns:q,title:t(e=>`Update tab: ${w(e,"tabId")}`,"title"),kind:"edit"},{method:"tabs.remove",permission:"tabs",access:"write",description:"Close one or more browser tabs. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{tabIds:{type:"array",required:!0,items:{type:"number"},description:"Ids of the tabs to close, from tabs.query. At least one id."}}},returns:{type:"json",description:"No payload; a non-error result means the tabs were closed."},title:t(e=>`Close tabs: ${JSON.stringify(a(e,"tabIds"))}`,"title"),kind:"delete"},{method:"tabs.reload",permission:"tabs",access:"write",description:"Reload one tab. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{tabId:{type:"number",description:"Tab to reload; defaults to the active tab of the current window."},bypassCache:{type:"boolean",description:"Whether to bypass the browser cache (hard reload)."}}},returns:{type:"json",description:"No payload; a non-error result means the tab was reloaded."},title:t(e=>`Reload tab: ${w(e,"tabId")}`,"title"),kind:"edit"},{method:"qbSkin.setSkin",permission:"qbSkin",access:"write",description:"Apply a skin by its skin detail JSON. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{skinDetail:{type:"string",required:!0,description:`Skin detail JSON string.${o}`}}},returns:{type:"json",description:"The browser's result JSON; result_code 0 means success."},title:t(()=>"Set skin","title"),kind:"edit"},{method:"qbSkin.getCurrentSkin",permission:"qbSkin",access:"read",description:"Read the current skin's detail JSON.",params:{type:"object",additionalProperties:!1,properties:{}},returns:{type:"json",description:"The current skin's detail JSON."},title:t(()=>"Read current skin","title"),kind:"read"},{method:"qbSkin.setColorSchemeMode",permission:"qbSkin",access:"write",description:"Set the color scheme mode (light/dark/system). Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{colorScheme:{type:"number",required:!0,description:"Color scheme mode; the browser maps 0 to system, 1 to light, 2 to dark."}}},returns:{type:"json",description:"The browser's result JSON; result_code 0 means success."},title:t(e=>`Set color scheme: ${w(e,"colorScheme")}`,"title"),kind:"edit"},{method:"qbSkin.getColorSchemeMode",permission:"qbSkin",access:"read",description:"Read the current color scheme mode (light/dark/system).",params:{type:"object",additionalProperties:!1,properties:{}},returns:{type:"json",description:"Result JSON carrying color_scheme."},title:t(()=>"Read color scheme mode","title"),kind:"read"},{method:"qbSkin.getCurrentSkinType",permission:"qbSkin",access:"read",description:"Read the current skin type as an integer.",params:{type:"object",additionalProperties:!1,properties:{}},returns:{type:"json",description:"Result JSON carrying skin_type."},title:t(()=>"Read current skin type","title"),kind:"read"},{method:"qbSkin.setDefaultSkin",permission:"qbSkin",access:"write",description:"Reset to the browser's default skin. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{}},returns:{type:"json",description:"The browser's result JSON; result_code 0 means success."},title:t(()=>"Set default skin","title"),kind:"edit"},{method:"qbSkin.setScreenBg",permission:"qbSkin",access:"write",description:"Set the current skin as the desktop wallpaper. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{}},returns:{type:"json",description:"The browser's result JSON; result_code 0 means success."},title:t(()=>"Set screen background","title"),kind:"edit"},{method:"qbSkin.setScreenBgWithImage",permission:"qbSkin",access:"write",description:"Save a base64-encoded image and set it as the desktop wallpaper. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{data:{type:"string",required:!0,description:`Base64-encoded image data.${o}`},data_type:{type:"string",required:!0,enum:["base64","binary"],description:'Data encoding; the browser currently accepts only "base64".'},file_name:{type:"string",required:!0,description:`File name to save the image under.${o}`},over_write:{type:"boolean",description:"Whether to overwrite an existing file with the same name."}}},returns:{type:"json",description:"The browser's result JSON; result_code 0 means success, file_name names the saved image."},title:t(e=>`Set wallpaper: ${JSON.stringify(a(e,"file_name"))}`,"title"),kind:"edit"},{method:"qbSkin.getFrameInfoById",permission:"qbSkin",access:"read",description:"Read the browser window frame geometry (bounds, rebar height, side panel width, zoom) by window id.",params:{type:"object",additionalProperties:!1,properties:{windowId:{type:"string",required:!0,description:`Window id, as a decimal string; "0" selects the last active window.${o}`}}},returns:{type:"json",description:"Frame info JSON with width, height, rebar, sidewidth, aiowidth and zoom."},title:t(e=>`Read frame info: ${JSON.stringify(a(e,"windowId"))}`,"title"),kind:"read"},{method:"qbSkin.saveFile",permission:"qbSkin",access:"write",description:"Save a base64-encoded image into the local skin directory and apply it as the current skin. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{data:{type:"string",required:!0,description:`Base64-encoded image data.${o}`},data_type:{type:"string",required:!0,enum:["base64","binary"],description:'Data encoding; the browser currently accepts only "base64".'},file_name:{type:"string",required:!0,description:`File name to save the image under.${o}`},over_write:{type:"boolean",description:"Whether to overwrite an existing file with the same name."}}},returns:{type:"json",description:"The browser's result JSON; result_code 0 means success, file_name names the saved image."},title:t(e=>`Save skin file: ${JSON.stringify(a(e,"file_name"))}`,"title"),kind:"edit"},{method:"qbSkin.readFile",permission:"qbSkin",access:"read",description:"Read one file from the local skin directory, returned as base64.",params:{type:"object",additionalProperties:!1,properties:{fileName:{type:"string",required:!0,description:`File name to read from the local skin directory.${o}`}}},returns:{type:"json",description:"The browser's result JSON; content holds the base64 file data."},title:t(e=>`Read skin file: ${JSON.stringify(a(e,"fileName"))}`,"title"),kind:"read"},{method:"qbSkin.getHistory",permission:"qbSkin",access:"read",description:"Read the skin history: recently applied internal and local skins.",params:{type:"object",additionalProperties:!1,properties:{}},returns:{type:"json",description:"History model with an items array of { key: { type, id }, detail?, timestamp }."},title:t(()=>"Read skin history","title"),kind:"read"},{method:"qbSkin.deleteHistory",permission:"qbSkin",access:"write",description:"Delete one skin history item. Asks the user's approval on every call.",params:{type:"object",additionalProperties:!1,properties:{keyJson:{type:"string",required:!0,description:`JSON of the item key to delete, e.g. {"type":"local","id":"<id>"}.${o}`}}},returns:{type:"json",description:"Result object with a succeeded boolean."},title:t(()=>"Delete skin history item","title"),kind:"delete"}];var $=class extends Error{static{t(this,"BrowserManifestError")}constructor(e){super(e),this.name="BrowserManifestError"}};function _(e,s){const l=new Map(e.map(p=>[p.permission,p])),m=new Map;for(const p of s){if(m.has(p.method))throw new $(`browser manifest declares '${p.method}' twice`);const k=l.get(p.permission);if(k===void 0)throw new $(`browser manifest method '${p.method}' names undeclared capability '${p.permission}'`);m.set(p.method,{descriptor:p,capability:k,paramsSchema:T(p.params),returnsSchema:T(p.returns)})}return m}t(_,"compileManifest");const y=_(R,N);function L(e){return R.map(s=>{const l=N.filter(m=>m.permission===s.permission);return{permission:s.permission,summary:s.summary,reads:l.filter(m=>m.access==="read").length,writes:l.filter(m=>m.access==="write").length,granted:e(s.permission)}})}t(L,"capabilityIndex");function M(e){if(R.some(s=>s.permission===e))return[...y.values()].filter(s=>s.descriptor.permission===e).map(s=>({method:s.descriptor.method,access:s.descriptor.access,description:s.descriptor.description,params:s.paramsSchema,returns:s.returnsSchema}))}t(M,"capabilityMethods");function x(e){return e}t(x,"BrowserAccessId");const D="tool-browser",B=["tools","browserJsapi"],b="browser_capabilities",u="browser_call",W=`List the browser capabilities available in this session, or get the exact call schema for one of them. Call with no arguments for the capability index, then call again with a permission name to get every method under it with its parameter schema. Use the schema to build ${u} arguments. This tool only reads its own catalog: it never touches the browser and never asks the user for approval.`,F=`Call one browser method by its wire name. Get the method name and its exact parameter schema from ${b} first — this tool rejects a method it does not know and parameters that do not match the schema. Read methods ask the user for approval once per capability per session; write methods ask on every call. The first call into a capability blocks while the user answers that prompt, which can take a while and is normal; a PERMISSION_DENIED result means the user declined, so do not retry the same call.`,V={type:"object",additionalProperties:!1,properties:{permission:{type:"string",required:!0},summary:{type:"string",required:!0},reads:{type:"number",required:!0},writes:{type:"number",required:!0},granted:{type:"boolean",required:!0}}},H={type:"object",additionalProperties:!1,properties:{method:{type:"string",required:!0},access:{type:"string",required:!0},description:{type:"string",required:!0},params:{type:"json",required:!0},returns:{type:"json",required:!0}}};function z(e,s){if(s===void 0)throw new h(`${e} requires an agent-owned session`,"UNAVAILABLE");return s}t(z,"requireAgent");function G(e){const s=y.get(e);if(s===void 0)throw new h(`'${e}' is not a known browser method. Call ${b} with no arguments to list capabilities, then ${b} with a permission to get its methods and schemas.`,"UNKNOWN_METHOD");return s}t(G,"requireMethod");function Z(e){const s=new Map;function l(r,i){return s.get(r)?.has(i)===!0}t(l,"isGranted");async function m(r){const i=r.agent.session.id;if(r.remember!==void 0&&l(i,r.remember))return;const d=e.get("approval");if(d===void 0)throw new h(`${u} cannot ask for browser data access: no approval service is mounted`,"PERMISSION_DENIED");const c=await d.request({agent:r.agent,toolName:u,callId:r.callId,reason:r.reason,signal:r.signal});switch(c){case"allowed-once":if(r.remember!==void 0){const n=s.get(i)??new Set;n.add(r.remember),s.set(i,n)}return;case"rejected":throw new h(`the user rejected browser data access for ${u}`,"PERMISSION_DENIED");case"cancelled":throw new h(`the browser data access approval for ${u} was cancelled`,"ABORTED");case"unavailable":throw new h(`no approval answerer is available for ${u}`,"PERMISSION_DENIED");default:return C(c)}}t(m,"gate");async function p(r,i){const d=crypto.randomUUID(),c=r.agent.session;c.append("browser/requested",{id:d,method:r.method,toolName:u,callId:r.callId});try{const n=await i();return c.append("browser/resolved",{id:d,outcome:"ok"}),n}catch(n){throw c.append("browser/resolved",{id:d,outcome:"error",code:n instanceof h?n.code:"INTERNAL"}),n}}t(p,"audited");function k(r,i,d,c){const{descriptor:n}=r,f={agent:c,callId:d.callId,signal:d.signal};return n.access==="write"?{...f,reason:n.title(i)}:{...f,reason:r.capability.readReason,remember:n.permission}}t(k,"gateInput"),e.tools.register(O({name:b,description:W,parameters:{permission:{type:"string",description:'Capability to expand, from the index (e.g. "bookmarks"). Omit for the index.'}},output:{schema:{type:"object",additionalProperties:!1,properties:{capabilities:{type:"array",items:V},permission:{type:"string"},methods:{type:"array",items:H}}},render:t((r,i)=>[{type:"text",text:JSON.stringify(i)}],"render")},presentCall:t(r=>({card:"generic",title:r.permission===void 0?"List browser capabilities":`Read browser capability: ${r.permission}`,kind:"read"}),"presentCall"),isConcurrencySafe:t(()=>!0,"isConcurrencySafe"),execute(r,i){const d=i.agent?.session.id;if(r.permission===void 0)return Promise.resolve({capabilities:L(n=>d!==void 0&&l(d,n))});const c=M(r.permission);if(c===void 0)throw new h(`'${r.permission}' is not a browser capability. Call ${b} with no arguments to list them.`,"INVALID_PARAMS");return Promise.resolve({permission:r.permission,methods:c})}})),e.tools.register(O({name:u,description:F,parameters:{method:{type:"string",required:!0,description:`Wire method name from ${b}, e.g. "bookmarks.search".`},params:{type:"json",required:!0,description:`Arguments matching the method's parameter schema from ${b}. Pass {} when it declares no properties.`}},output:{schema:{type:"object",additionalProperties:!1,properties:{method:{type:"string",required:!0},result:{type:"json",required:!0}}},render:t((r,i)=>[{type:"text",text:JSON.stringify(i.result)}],"render")},presentCall:t(r=>{const i=y.get(r.method);return i===void 0?{card:"generic",title:`Browser call: ${r.method}`,kind:"other"}:{card:"generic",title:i.descriptor.title(r.params),kind:i.descriptor.kind}},"presentCall"),isConcurrencySafe:t(r=>y.get(r.method)?.descriptor.access==="read","isConcurrencySafe"),async execute(r,i){const d=G(r.method),c=A(d.paramsSchema,r.params,"params");if(c.length>0)throw new h(`params for '${r.method}' do not match its schema: ${c.join("; ")}. Call ${b} with permission '${d.descriptor.permission}' for the exact schema.`,"INVALID_PARAMS");const n=z(u,i.agent);await m(k(d,r.params,i,n));const f=await p({agent:n,callId:i.callId,method:r.method},async()=>{const I=await e.browserJsapi.call({method:r.method,params:r.params},n.session.id,i.signal),P=A(d.returnsSchema,I,"result");if(P.length>0)throw new h(`the browser host page answered '${r.method}' with a result violating its contract: `+P.join("; "),"INTERNAL");return I});return{method:r.method,result:f}}}))}t(Z,"apply");export{R as BROWSER_CAPABILITIES,y as BROWSER_JSAPI_MANIFEST,N as BROWSER_JSAPI_METHODS,x as BrowserAccessId,$ as BrowserManifestError,Z as apply,L as capabilityIndex,M as capabilityMethods,_ as compileManifest,B as inject,D as name};
@@ -0,0 +1 @@
1
+ var o=Object.defineProperty;var e=(s,n)=>o(s,"name",{value:n,configurable:!0});const t="@deepseek-ai/dsh-tool-browser",r="tool-browser-invariant",i=["invariants"],a=e(()=>{},"install"),c=e(s=>Promise.resolve(s.invariants.register(t,a)),"apply");export{c as apply,i as inject,r as name};
@@ -0,0 +1 @@
1
+ {"name":"@deepseek-ai/dsh-tool-browser","version":"0.1.0-rc.7","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-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-browser-jsapi":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-brand":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-user-approval":"^0.1.0-rc.7"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-call-timeout-policy","version":"0.1.0-rc.7","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-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-timeout":"^0.1.0-rc.7"}}
1
+ {"name":"@deepseek-ai/dsh-tool-call-timeout-policy","version":"0.1.0-rc.7","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-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-timeout":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"}}
@@ -1,4 +1,4 @@
1
- var F=Object.defineProperty;var a=(e,n)=>F(e,"name",{value:n,configurable:!0});import{CordisDynamicPackageId as w,CordisDynamicPluginId as u,HOST_BUILTIN_INSPECTION as O}from"@deepseek-ai/dsh-cordis-host-runner";import{createUserMessage as L}from"@deepseek-ai/dsh-llm";import{defineTool as p}from"@deepseek-ai/dsh-tools";const j=[{key:"agentDefaultModel",summary:"Owns the default model selection independently of any Host or transport.",description:"Owns the default model selection independently of any Host or transport. The composition entry remains usable without a settings provider; when one is mounted, its user layer is read live.",methods:[{signature:"currentSelection(): ModelSelection",description:"Read the current default model selection.",parameters:[],returns:"a detached provider, model, and optional reasoning selection."},{signature:"async saveSelection(next: ModelSelection): Promise<void>",description:"Save the complete default model selection. A deployment without a settings provider keeps its composition entry.",parameters:[{name:"next",description:"resolved selection accepted by an entry point."}],returns:"fulfillment after the optional settings write settles."}]},{key:"agentLoop",summary:"Concrete agent factory and driver service.",description:"Concrete agent factory and driver service.",methods:[{signature:"readonly config: ResolvedConfig",description:"Validated configuration owned by the agent-loop service.",parameters:[]},{signature:"create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Agent",description:"Create an agent and session under one caller-supplied identity, owned by the accessing fiber. Constructor-driven config calls mint a fresh combined id before entering this boundary.",parameters:[{name:"id",description:"shared agent/session identity."},{name:"options",description:"concrete loop options."},{name:"meta",description:"optional fresh-session workspace metadata."}],returns:"the published running agent."},{signature:"async createAgent(ownerCtx: Context, options: CreateAgentOptions): Promise<AgentHandle>",description:"Create an owned agent on a caller-supplied session id.",parameters:[{name:"ownerCtx",description:"caller context that structurally owns the lifecycle."},{name:"options",description:"identities, session seed/metadata, loop options, setup, and cancellation."}],returns:"the published handle."},{signature:"async resume(ownerCtx: Context, options: ResumeAgentOptions): Promise<AgentHandle>",description:"Resume an owned agent from the configured persistence service.",parameters:[{name:"ownerCtx",description:"caller context that owns load, setup, and the live lifecycle."},{name:"options",description:"persisted identity, loop options, setup, and cancellation."}],returns:"the published handle."}]},{key:"agentPresets",summary:"Registry over the deployment's agent presets.",description:"Registry over the deployment's agent presets.\n\nDiscovery is unmemoized: `list()` and `resolve()` re-read the roots on every call so a preset authored while the process runs is visible immediately, and a preset deleted underneath a picker disappears from the next read.",methods:[{signature:"async list(): Promise<AgentPreset[]>",description:"Every preset the configured roots currently supply.",parameters:[],returns:"the presets, first-root-wins per id."},{signature:"async resolve(id?: string): Promise<AgentPreset>",description:`Resolve one preset by id.
1
+ var O=Object.defineProperty;var a=(e,n)=>O(e,"name",{value:n,configurable:!0});import{CordisDynamicPackageId as w,CordisDynamicPluginId as u,HOST_BUILTIN_INSPECTION as F}from"@deepseek-ai/dsh-cordis-host-runner";import{createUserMessage as L}from"@deepseek-ai/dsh-llm";import{defineTool as p}from"@deepseek-ai/dsh-tools";const j=[{key:"agentDefaultModel",summary:"Owns the default model selection independently of any Host or transport.",description:"Owns the default model selection independently of any Host or transport. The composition entry remains usable without a settings provider; when one is mounted, its user layer is read live.",methods:[{signature:"currentSelection(): ModelSelection",description:"Read the current default model selection.",parameters:[],returns:"a detached provider, model, and optional reasoning selection."},{signature:"async saveSelection(next: ModelSelection): Promise<void>",description:"Save the complete default model selection. A deployment without a settings provider keeps its composition entry.",parameters:[{name:"next",description:"resolved selection accepted by an entry point."}],returns:"fulfillment after the optional settings write settles."}]},{key:"agentLoop",summary:"Concrete agent factory and driver service.",description:"Concrete agent factory and driver service.",methods:[{signature:"readonly config: ResolvedConfig",description:"Validated configuration owned by the agent-loop service.",parameters:[]},{signature:"create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Agent",description:"Create an agent and session under one caller-supplied identity, owned by the accessing fiber. Constructor-driven config calls mint a fresh combined id before entering this boundary.",parameters:[{name:"id",description:"shared agent/session identity."},{name:"options",description:"concrete loop options."},{name:"meta",description:"optional fresh-session workspace metadata."}],returns:"the published running agent."},{signature:"async createAgent(ownerCtx: Context, options: CreateAgentOptions): Promise<AgentHandle>",description:"Create an owned agent on a caller-supplied session id.",parameters:[{name:"ownerCtx",description:"caller context that structurally owns the lifecycle."},{name:"options",description:"identities, session seed/metadata, loop options, setup, and cancellation."}],returns:"the published handle."},{signature:"async resume(ownerCtx: Context, options: ResumeAgentOptions): Promise<AgentHandle>",description:"Resume an owned agent from the configured persistence service.",parameters:[{name:"ownerCtx",description:"caller context that owns load, setup, and the live lifecycle."},{name:"options",description:"persisted identity, loop options, setup, and cancellation."}],returns:"the published handle."}]},{key:"agentPresets",summary:"Registry over the deployment's agent presets.",description:"Registry over the deployment's agent presets.\n\nDiscovery is unmemoized: `list()` and `resolve()` re-read the roots on every call so a preset authored while the process runs is visible immediately, and a preset deleted underneath a picker disappears from the next read.",methods:[{signature:"async list(): Promise<AgentPreset[]>",description:"Every preset the configured roots currently supply.",parameters:[],returns:"the presets, first-root-wins per id."},{signature:"async resolve(id?: string): Promise<AgentPreset>",description:`Resolve one preset by id.
2
2
 
3
3
  A broken preset resolves — deleting one, reading one, and reporting one all need the row — and the mounting paths refuse it AFTER resolution through resolveMountable.`,parameters:[{name:"id",description:"the preset id, or `undefined` for {@link defaultId}."}],returns:"the resolved preset.",throws:["when no configured root supplies that id."]},{signature:"async mount(agentCtx: Context, id?: string): Promise<AgentPreset>",description:"Compose one agent from a preset: ensure the preset's standing mount, then parent the agent's scope key to it so the mount's registrations and listeners cover this agent.\n\nCall from the agent factory's `setup(agentCtx)`; a rejection there rolls the agent creation back, so a broken preset never yields a half-composed session.",parameters:[{name:"agentCtx",description:"the agent's scope context."},{name:"id",description:"the preset id, or `undefined` for {@link defaultId}."}],returns:"the preset that was composed, for the caller to record.",throws:["when the preset is unknown or its composition is unusable."]},{signature:"composeFrom(agentCtx: Context, parentCtx: Context): string | undefined",description:`Join one agent to the SAME standing composition another already runs on.
4
4
 
@@ -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:"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:"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:"browserJsapi",summary:"`ctx.browserJsapi`: one active delivery provider plus a `call()` API.",description:"`ctx.browserJsapi`: one active delivery provider plus a `call()` API. Providers are single-slot; registration is effect-scoped and disposed with the calling fiber.",methods:[{signature:"registerProvider(provider: BrowserJsapiProvider): () => void",description:"Register the delivery provider. Only one provider may be active in a context.",parameters:[{name:"provider",description:"implementation that delivers calls to a web client."}],returns:"Disposer that unregisters this provider."},{signature:"async call(request: BrowserJsapiRequest, sessionId: SessionId, signal?: AbortSignal): Promise<JsonValue>",description:"Deliver one call through the active provider and await the browser host page's result. This is the seam's explicit resolve step: an absent `request.timeoutMs` is filled from the configured default here, never inside a provider.",parameters:[{name:"request",description:"method and params; `timeoutMs` optionally overrides the configured default."},{name:"sessionId",description:"owning session, echoed into frames for client routing."},{name:"signal",description:"abort of the owning tool call."}],returns:"the browser host page's JSON result.",throws:["{BrowserJsapiError} `ABORTED` when the signal is already aborted, `INVALID_PARAMS` for an empty method, or `UNAVAILABLE` when no provider is registered; provider failures propagate unchanged."]}]},{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:"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
 
@@ -155,7 +155,13 @@ When a caller supplies an agent, human interaction is valid only for the exact l
155
155
  key: DshEnvironmentKey;
156
156
  }`},{name:"Branded",declaration:`export type Branded<B extends string> = string & {
157
157
  readonly [BRAND]: B;
158
- };`},{name:"CancelOptions",declaration:`export interface CancelOptions {
158
+ };`},{name:"BrowserJsapiProvider",declaration:`export interface BrowserJsapiProvider {
159
+ call(request: ResolvedBrowserJsapiRequest, sessionId: SessionId, signal: AbortSignal): Promise<JsonValue>;
160
+ }`},{name:"BrowserJsapiRequest",declaration:`export interface BrowserJsapiRequest {
161
+ method: string;
162
+ params: JsonValue;
163
+ timeoutMs?: number;
164
+ }`},{name:"CancelOptions",declaration:`export interface CancelOptions {
159
165
  keepInbox?: boolean | undefined;
160
166
  }`},{name:"ClientResponse",declaration:`export interface ClientResponse {
161
167
  type: 'client-response';
@@ -975,6 +981,8 @@ When a caller supplies an agent, human interaction is valid only for the exact l
975
981
  kind: 'retry';
976
982
  } | undefined;`},{name:"RequestHeaderReason",declaration:"export type RequestHeaderReason = 'initial' | 'resume' | 'change';"},{name:"RequestRunOutcome",declaration:"export type RequestRunOutcome = 'approved' | 'completed' | 'rejected' | 'cancelled' | 'failed';"},{name:"ResolvedAlwaysRetryPolicy",declaration:`export interface ResolvedAlwaysRetryPolicy extends ResolvedRetryBackoff {
977
983
  readonly mode: 'always';
984
+ }`},{name:"ResolvedBrowserJsapiRequest",declaration:`export interface ResolvedBrowserJsapiRequest extends BrowserJsapiRequest {
985
+ timeoutMs: number;
978
986
  }`},{name:"ResolvedCredential",declaration:`export interface ResolvedCredential {
979
987
  value: string;
980
988
  source: string;
@@ -2024,6 +2032,7 @@ When a caller supplies an agent, human interaction is valid only for the exact l
2024
2032
  rev: string;
2025
2033
  inject?: string[];
2026
2034
  immediately?: boolean;
2035
+ config?: Record<string, unknown>;
2027
2036
  }`},{name:"WebBootGraph",declaration:`export interface WebBootGraph {
2028
2037
  rev: string;
2029
2038
  entries: WebBootEntry[];
@@ -2129,7 +2138,7 @@ When a caller supplies an agent, human interaction is valid only for the exact l
2129
2138
  maxTotalAgents?: number;
2130
2139
  parent: Agent;
2131
2140
  signal?: AbortSignal;
2132
- }`},{name:"WorkflowStopReason",declaration:"export type WorkflowStopReason = 'completed' | 'cancelled' | 'error';"}];function k(e){const n=new Set;let t=[...e];for(;t.length>0;){const r=[];for(const o of x){if(n.has(o.name))continue;const i=new RegExp(`\b${o.name}\b`);t.some(s=>i.test(s))&&(n.add(o.name),r.push(o.declaration))}t=r}return x.filter(r=>n.has(r.name))}a(k,"referencedTypeClosure");function B(e){return/^[A-Za-z_$][\w$]*$/.test(e)?`ctx.${e}`:`ctx[${JSON.stringify(e)}]`}a(B,"contextProperty");function N(e,n=j){if(e===void 0)return{mode:"catalog",services:n.map(r=>({key:r.key,description:r.summary,methods:r.methods.map(o=>({signature:o.signature}))}))};const t=n.find(r=>r.key===e);if(t===void 0)throw new Error(`no catalogued Service named "${e}"`);return{mode:"service",service:{key:t.key,description:t.description,access:{optional:{expression:`ctx.get(${JSON.stringify(t.key)})`,requiresUndefinedCheck:!0},hardDependency:{inject:[t.key],expression:B(t.key)}},methods:t.methods},referencedTypes:k(t.methods.map(r=>r.signature))}}a(N,"queryServiceApi");function W(e,n=S){if(e===void 0)return{mode:"catalog",events:n.map(r=>({name:r.name,description:r.summary,mode:r.mode,signature:r.signature}))};const t=n.find(r=>r.name===e);if(t===void 0)throw new Error(`no catalogued Event named "${e}"`);return{mode:"event",event:{name:t.name,description:t.description,mode:t.mode,signature:t.signature,parameters:t.parameters},referencedTypes:k([t.signature])}}a(W,"queryEventApi");const m={PENDING:0,LOADING:1,ACTIVE:2,FAILED:3,DISPOSED:4,UNLOADING:5};m.PENDING,m.LOADING,m.ACTIVE,m.FAILED,m.DISPOSED,m.UNLOADING;function U(e){const n=e.reflect.store;return Object.getOwnPropertySymbols(n).map(t=>n[t]).filter(t=>t!==void 0)}a(U,"liveImpls");function V(e,n){let t=e;for(;;){if(t===n)return!0;const r=t.parent.fiber;if(r===t)return!1;t=r}}a(V,"withinFiber");function R(e,n){return U(e).filter(t=>V(t.fiber,n)).map(t=>t.name).sort()}a(R,"providedServices");function f(e,n){return Object.keys(n.inject).filter(t=>e.get(t)===void 0)}a(f,"missingServices");function H(){return{card:"generic",kind:"read",title:"List Cordis Inspect Providers"}}a(H,"presentInspectListCall");function _(e){return{card:"generic",kind:"read",title:`Query Cordis ${e.platform} ${e.provider}.${e.method}`}}a(_,"presentInspectQueryCall");function G(e){return{card:"generic",kind:"read",title:`Inspect ${e.pluginId===void 0?"dynamic Cordis Plugins":e.packageId===void 0?e.pluginId:`${e.pluginId}/${e.packageId}`}`}}a(G,"presentInspectSelfCall");function J(e){const n=e.plugin.kind==="new"?`new ${e.plugin.idPrefix}-*`:e.plugin.pluginId;return{card:"generic",kind:"execute",title:`Register Cordis Plugin "${e.name}" for ${n}: ${e.purpose}`,rawInput:e.code}}a(J,"presentDefineCall");function z(e){return{card:"generic",kind:"delete",title:`Remove Cordis Plugin ${e.pluginId}`}}a(z,"presentUndefineCall");function K(e){return{card:"generic",kind:"execute",title:`${e.mode==="update"?"Update":"Run"} Cordis Plugin ${e.pluginId} · ${e.packageId}`}}a(K,"presentRunCall");function Q(e){return{card:"generic",kind:"execute",title:`Stop Cordis Plugin ${e.pluginId}`}}a(Q,"presentStopCall");const $=`# Dynamic Cordis Plugins
2141
+ }`},{name:"WorkflowStopReason",declaration:"export type WorkflowStopReason = 'completed' | 'cancelled' | 'error';"}];function k(e){const n=new Set;let t=[...e];for(;t.length>0;){const r=[];for(const o of x){if(n.has(o.name))continue;const i=new RegExp(`\b${o.name}\b`);t.some(s=>i.test(s))&&(n.add(o.name),r.push(o.declaration))}t=r}return x.filter(r=>n.has(r.name))}a(k,"referencedTypeClosure");function B(e){return/^[A-Za-z_$][\w$]*$/.test(e)?`ctx.${e}`:`ctx[${JSON.stringify(e)}]`}a(B,"contextProperty");function N(e,n=j){if(e===void 0)return{mode:"catalog",services:n.map(r=>({key:r.key,description:r.summary,methods:r.methods.map(o=>({signature:o.signature}))}))};const t=n.find(r=>r.key===e);if(t===void 0)throw new Error(`no catalogued Service named "${e}"`);return{mode:"service",service:{key:t.key,description:t.description,access:{optional:{expression:`ctx.get(${JSON.stringify(t.key)})`,requiresUndefinedCheck:!0},hardDependency:{inject:[t.key],expression:B(t.key)}},methods:t.methods},referencedTypes:k(t.methods.map(r=>r.signature))}}a(N,"queryServiceApi");function W(e,n=S){if(e===void 0)return{mode:"catalog",events:n.map(r=>({name:r.name,description:r.summary,mode:r.mode,signature:r.signature}))};const t=n.find(r=>r.name===e);if(t===void 0)throw new Error(`no catalogued Event named "${e}"`);return{mode:"event",event:{name:t.name,description:t.description,mode:t.mode,signature:t.signature,parameters:t.parameters},referencedTypes:k([t.signature])}}a(W,"queryEventApi");const m={PENDING:0,LOADING:1,ACTIVE:2,FAILED:3,DISPOSED:4,UNLOADING:5};m.PENDING,m.LOADING,m.ACTIVE,m.FAILED,m.DISPOSED,m.UNLOADING;function U(e){const n=e.reflect.store;return Object.getOwnPropertySymbols(n).map(t=>n[t]).filter(t=>t!==void 0)}a(U,"liveImpls");function V(e,n){let t=e;for(;;){if(t===n)return!0;const r=t.parent.fiber;if(r===t)return!1;t=r}}a(V,"withinFiber");function R(e,n){return U(e).filter(t=>V(t.fiber,n)).map(t=>t.name).sort()}a(R,"providedServices");function f(e,n){return Object.keys(n.inject).filter(t=>e.get(t)===void 0)}a(f,"missingServices");function H(){return{card:"generic",kind:"read",title:"List Cordis Inspect Providers"}}a(H,"presentInspectListCall");function J(e){return{card:"generic",kind:"read",title:`Query Cordis ${e.platform} ${e.provider}.${e.method}`}}a(J,"presentInspectQueryCall");function _(e){return{card:"generic",kind:"read",title:`Inspect ${e.pluginId===void 0?"dynamic Cordis Plugins":e.packageId===void 0?e.pluginId:`${e.pluginId}/${e.packageId}`}`}}a(_,"presentInspectSelfCall");function G(e){const n=e.plugin.kind==="new"?`new ${e.plugin.idPrefix}-*`:e.plugin.pluginId;return{card:"generic",kind:"execute",title:`Register Cordis Plugin "${e.name}" for ${n}: ${e.purpose}`,rawInput:e.code}}a(G,"presentDefineCall");function z(e){return{card:"generic",kind:"delete",title:`Remove Cordis Plugin ${e.pluginId}`}}a(z,"presentUndefineCall");function K(e){return{card:"generic",kind:"execute",title:`${e.mode==="update"?"Update":"Run"} Cordis Plugin ${e.pluginId} · ${e.packageId}`}}a(K,"presentRunCall");function Q(e){return{card:"generic",kind:"execute",title:`Stop Cordis Plugin ${e.pluginId}`}}a(Q,"presentStopCall");const $=`# Dynamic Cordis Plugins
2133
2142
 
2134
2143
  Dynamic Cordis plugins temporarily extend the current DSH process. A Plugin uses apply(ctx) to consume Services, listen to Events, provide Services, register model Tools, or register browser UI in Slots.
2135
2144
 
@@ -2233,7 +2242,7 @@ return {
2233
2242
  - Do not wait inside a Tool for approval or browser work that can happen only after the current turn ends.
2234
2243
  - Asynchronous success, rejection, and runtime errors update Run state and notify you through steering context.
2235
2244
  - After a technical failure, use cordis_inspect_self to read the exact Package source and its message/stack. Define a corrected Package under the same Plugin and retry autonomously.
2236
- - Use the cordis-plugin-development Skill for other failure causes, repair procedures, and complete extension patterns.`,I={type:"object",properties:{},additionalProperties:!1},P={description:"JSON data owned by this inspect provider."},Y=T("service","Exact Service key. Omit it for the compact Service and method-signature directory."),Z=T("event","Exact Event name. Omit it for the compact Event and listener-signature directory."),X={description:"Compact Service directory, or one exact Service contract with only its referenced type declarations."},ee={description:"Compact Event directory, or one exact Event contract with only its referenced type declarations."},ne=S.filter(e=>!e.name.startsWith("cordis/"));function te(e){return[b("Service","Progressive Host Service discovery: compact capability/signature directory, then one exact coding contract.","listService",n=>N(C(n,"service")),Y,X),b("Event","Progressive Host Event discovery: compact listener directory, then one exact event contract.","listEvents",n=>W(C(n,"event"),ne),Z,ee),b("Builtin","Plain-JavaScript symbols available to a dynamic Host half.","listBuiltins",()=>({builtins:O,referencedTypes:[]})),{manifest:{id:"Tool",description:"Tools visible to the requesting Agent, including scoped and dynamic registrations.",methods:[{name:"listTools",description:"Return every Tool schema currently callable by this Agent.",inputSchema:I,outputSchema:P}]},query(n,t,r){if(n!=="listTools")throw new Error(`unknown Tool inspect method "${n}"`);return Promise.resolve({tools:e.tools.schemas(r.agent)})}}]}a(te,"hostInspectProviders");function b(e,n,t,r,o=I,i=P){return{manifest:{id:e,description:n,methods:[{name:t,description:n,inputSchema:o,outputSchema:i}]},async query(s,l){if(s!==t)throw new Error(`unknown ${e} inspect method "${s}"`);return await r(l)}}}a(b,"registration");function T(e,n){return{type:"object",properties:{[e]:{type:"string",description:n}},additionalProperties:!1}}a(T,"exactInput");function C(e,n){if(e==null||Array.isArray(e)||typeof e!="object")return;const t=e[n];return typeof t=="string"?t:void 0}a(C,"readExact");const A="tool-cordis",re=["tools","systemPrompt","dynamicCordisRunner","cordisInspect"];function g(e){if(e.agent===void 0)throw new Error("Cordis dynamic tools require an Agent-backed session");return e.agent}a(g,"requireAgent");function ae(e){e.systemPrompt.section({name:"tool:cordis",order:115,text:$});for(const n of te(e))e.effect(()=>e.cordisInspect.register(n),`tool-cordis: inspect ${n.manifest.id}`);e.tools.register(p({name:"cordis_inspect_list",description:"List every Cordis Inspect Provider currently known to the Host, including local Host Providers and the latest manifests synchronized from the Client. Each entry includes its platform, purpose, read-only methods, and input/output schemas. Call this Tool before creating or modifying a Package, then select the provider and method for cordis_inspect_query from its result. Do not guess names or treat an Inspect method as a business Service that Plugin code can call.",parameters:{},output:{schema:{type:"json"},render:a((n,t)=>[{type:"text",text:JSON.stringify(t,null,2)}],"render")},execute(n,t){return Promise.resolve({providers:e.cordisInspect.list()})},presentCall:H})),e.tools.register(p({name:"cordis_inspect_query",description:"Run a read-only query explicitly declared by an Inspect Provider. platform, provider, and method must come from cordis_inspect_list, and input must satisfy that method's schema. Use this Tool before cordis_define to read exact Service methods, Event modes, Builtin signatures, Tool schemas, theme tokens, or live Slot trees and props. Host queries run locally. A Client query waits for the first valid page response and remains pending until a page answers or the Tool is cancelled. This Tool cannot invoke business Service methods or modify the runtime. For Service.listService and Event.listEvents, query without input to navigate the compact signature directory, then query the exact service or event for its structured contract and referenced types. For Slots.listSubTree, query without root to navigate the compact tree, then query the exact root for its complete registration contract and props.",parameters:{platform:{type:"string",required:!0,enum:["host","client"],description:"Runtime platform that owns the Provider."},provider:{type:"string",required:!0,description:"Exact Provider ID returned by cordis_inspect_list."},method:{type:"string",required:!0,description:"Exact method name declared by the Provider manifest."},input:{type:"json",description:"Optional query input; it must satisfy the method input schema."}},output:{schema:{type:"json"},render:a((n,t)=>[{type:"text",text:JSON.stringify(t,null,2)}],"render")},async execute(n,t){const r=await e.cordisInspect.query(n.platform,n.provider,n.method,n.input,g(t),t.signal);return{platform:n.platform,provider:n.provider,method:n.method,data:r}},presentCall:_})),e.tools.register(p({name:"cordis_inspect_self",description:"Inspect dynamic Cordis objects owned by the current Session at increasing levels of detail. With no IDs, list only Plugin summaries. With pluginId alone, return version pointers, the latest Run, and every Package summary. Only pluginId plus packageId returns that immutable Package's Host/Client source and runtime diagnostics. packageId cannot be supplied alone. Query an exact Package before handling @pluginId, repairing an asynchronous failure, or defining an updated version. This Tool is read-only: it neither executes code nor changes version pointers.",parameters:{pluginId:{type:"string",description:"Stable Plugin ID returned by cordis_define or injected by @pluginId; omit it to list every current Plugin."},packageId:{type:"string",description:"Exact immutable Package ID owned by pluginId; when specified, source and diagnostics are returned."}},output:{schema:{type:"json"},render:a((n,t)=>[{type:"text",text:JSON.stringify(t,null,2)}],"render")},execute(n,t){const r=g(t);if(n.packageId!==void 0&&n.pluginId===void 0)throw new Error("cordis_inspect_self packageId requires pluginId");if(n.pluginId===void 0)return Promise.resolve({mode:"plugins",plugins:e.dynamicCordisRunner.listPlugins(r).map(i=>v(i))});const o=u(n.pluginId);if(n.packageId===void 0){const i=e.dynamicCordisRunner.inspectPlugin(r,o);return Promise.resolve({mode:"plugin",...v(i),packages:i.packages.map(s=>({...s,packageId:String(s.packageId),isCurrent:s.packageId===i.currentPackageId,isNext:s.packageId===i.nextPackageId}))})}return Promise.resolve(se(e,r,o,w(n.packageId)))},presentCall:G})),e.tools.register(p({name:"cordis_define",description:'Define an immutable Cordis Package. For a new Plugin, use kind:"new" and provide only a semantic prefix of 3–6 lowercase English letters; the Host returns the final pluginId and packageId. To modify an existing Plugin, use kind:"existing" with its exact pluginId to append a Package without overwriting older versions. Provide at least one of code.host and code.client. Each value is a plain JavaScript function body that returns a Cordis Plugin; no TypeScript, JSX, or import transformation occurs. Query Inspect before depending on a Service, Event, Builtin, Slot, or token. Define only validates parameters and syntax and records source: it does not request approval, execute apply, or change currentPackageId. On success, call cordis_run with the returned IDs.',parameters:{plugin:{required:!0,oneOf:[{type:"object",additionalProperties:!1,properties:{kind:{type:"string",const:"new",required:!0},idPrefix:{type:"string",required:!0,description:"Suggested semantic prefix of 3–6 lowercase English letters; the Host adds a unique numeric suffix."}}},{type:"object",additionalProperties:!1,properties:{kind:{type:"string",const:"existing",required:!0},pluginId:{type:"string",required:!0,description:"Exact ID of an existing Plugin; the new Package is appended to that instance."}}}]},name:{type:"string",required:!0,description:"Short, readable Package name."},purpose:{type:"string",required:!0,description:"One-sentence, user-facing description of the Package purpose."},code:{type:"object",additionalProperties:!1,required:!0,properties:{host:{type:"string",description:"Plain JavaScript function body that returns the Host-half Cordis Plugin."},client:{type:"string",description:"Plain JavaScript function body that returns the browser Client-half Cordis Plugin."}}}},output:{schema:{type:"object",additionalProperties:!1,properties:{pluginId:{type:"string",required:!0},packageId:{type:"string",required:!0},name:{type:"string",required:!0},purpose:{type:"string",required:!0},hasHostHalf:{type:"boolean",required:!0},hasClientHalf:{type:"boolean",required:!0}}},render:a((n,t)=>[{type:"text",text:`Defined ${t.pluginId}/${t.packageId} (${t.name}); it is not running yet. Use cordis_run to activate this Package.`}],"render"),presentationMeta:a((n,t)=>({pluginId:t.pluginId,packageId:t.packageId}),"presentationMeta")},execute(n,t){const r=n.plugin.kind==="new"?{kind:"new",idPrefix:n.plugin.idPrefix}:{kind:"existing",pluginId:u(n.plugin.pluginId)},o=e.dynamicCordisRunner.define({sessionId:g(t).id,plugin:r,name:n.name,purpose:n.purpose,code:{...n.code.host===void 0?{}:{host:n.code.host},...n.code.client===void 0?{}:{client:n.code.client}}});return Promise.resolve({...o,pluginId:String(o.pluginId),packageId:String(o.packageId)})},presentCall:J})),e.tools.register(p({name:"cordis_run",description:'Activate one exact Package of a dynamic Plugin. Use mode:"run" for the first activation, restarting currentPackageId, or rollback. When current exists, use mode:"update" to switch to a different Package, even if the Plugin is currently stopped. An unauthorized Client Package creates an approval request and returns awaiting-approval; an authorized Package returns starting and continues asynchronously in the browser. Neither result waits for the final outcome inside the Tool. currentPackageId changes only after complete success; on failure, the old current and target next remain. Asynchronous success, rejection, or technical failure is reported through state and steering. After a technical failure, read diagnostics with cordis_inspect_self, correct the same Plugin, and retry autonomously. Do not request approval again after the user rejects it.',parameters:{pluginId:{type:"string",required:!0,description:"Stable Plugin ID returned by cordis_define."},packageId:{type:"string",required:!0,description:"Exact immutable Package ID to activate under that Plugin."},mode:{type:"string",required:!0,enum:["run","update"],description:"Use run for the first activation, restarting current, or rollback; use update to switch from current to a different Package."}},output:{schema:{type:"json"},render:a((n,t)=>{const r=q(t),o=h(r,"pluginId"),i=h(r,"packageId"),s=h(r,"pluginRunId");return[{type:"text",text:r.status==="awaiting-approval"?`${o}/${i} is awaiting user approval (${s}).`:r.status==="starting"?`${o}/${i} is starting asynchronously (${s}).`:`${o}/${i} is running (${s}).`}]},"render"),presentationMeta:a((n,t)=>{const r=q(t);return{pluginId:h(r,"pluginId"),packageId:h(r,"packageId"),pluginRunId:h(r,"pluginRunId")}},"presentationMeta")},async execute(n,t){const r=g(t),o=u(n.pluginId),i=w(n.packageId),s=await e.dynamicCordisRunner.run(r,o,i,n.mode,t.signal);if(!s.ok)throw new Error(s.message);if(s.status!=="running")return{status:s.status,pluginId:n.pluginId,packageId:n.packageId,pluginRunId:String(s.pluginRunId),mode:s.mode,...s.currentPackageId===void 0?{}:{currentPackageId:String(s.currentPackageId)},nextPackageId:String(s.nextPackageId)};const l=e.dynamicCordisRunner.snapshot(r).find(c=>c.pluginId===o),d=l?.activeRun?.pluginRunId===s.pluginRunId?l.activeRun.fiber:void 0;return{status:"running",pluginId:n.pluginId,packageId:n.packageId,pluginRunId:String(s.pluginRunId),currentPackageId:String(s.currentPackageId),...s.nextPackageId===void 0?{}:{nextPackageId:String(s.nextPackageId)},host:{status:d===void 0?"absent":f(e,d).length===0?"running":"waiting",provides:d===void 0?[]:R(e,d),waitingFor:d===void 0?[]:f(e,d)},client:{status:s.clientWaitingFor===void 0?"absent":s.clientWaitingFor.length===0?"running":"waiting",waitingFor:[...s.clientWaitingFor??[]]}}},presentCall:K})),e.tools.register(p({name:"cordis_stop",description:"Stop the current Run of a dynamic Plugin and cancel unfinished approval or activation requests. Retain the Plugin, every immutable Package, grants, currentPackageId, and nextPackageId so it can later run or update directly. Stopping an already stopped Plugin succeeds idempotently. Use this Tool to disable effects temporarily; use cordis_undefine for permanent removal.",parameters:{pluginId:{type:"string",required:!0,description:"Stable dynamic Plugin ID to stop."}},output:{schema:{type:"object",additionalProperties:!1,properties:{pluginId:{type:"string",required:!0}}},render:a((n,t)=>[{type:"text",text:`Dynamic Plugin ${t.pluginId} is stopped; its definition and versions remain.`}],"render")},async execute(n,t){const r=await e.dynamicCordisRunner.stop(g(t),u(n.pluginId));if(!r.ok&&r.reason!=="not-running")throw new Error(r.message);return{pluginId:n.pluginId}},presentCall:Q})),e.tools.register(p({name:"cordis_undefine",description:'Permanently remove a dynamic Plugin owned by the current Session. If it is running or awaiting approval, first stop it and cancel the request, then delete every Package, grant, and version pointer. After this returns, its pluginId, packageIds, @ reference, and Package business views are invalid; historical cards retain only a "Plugin removed" record. Do not call this Tool when versions must remain available for restart or rollback; use cordis_stop instead.',parameters:{pluginId:{type:"string",required:!0,description:"Stable dynamic Plugin ID to remove permanently."}},output:{schema:{type:"object",additionalProperties:!1,properties:{pluginId:{type:"string",required:!0},wasRunning:{type:"boolean",required:!0}}},render:a((n,t)=>[{type:"text",text:`Removed dynamic Plugin ${t.pluginId} and all of its Packages.`}],"render")},async execute(n,t){const r=await e.dynamicCordisRunner.undefine(g(t),u(n.pluginId));if(!r.ok)throw new Error(r.message);return{pluginId:n.pluginId,wasRunning:r.wasRunning}},presentCall:z})),e.on("agent/pre-step",async({agent:n,messages:t,signal:r},o)=>{const i=await o();if(i.kind==="reject")return i;const s=oe(t);if(s.length===0)return i;r.throwIfAborted();const l=s.map(d=>{const c=e.dynamicCordisRunner.reference(n,u(d));return L({content:[{type:"text",text:c===void 0?de(d):ie(c)}],source:{kind:"plugin",plugin:A,form:"instructions"}})});return{kind:"enter",messages:[...i.messages,...l]}})}a(ae,"apply");function q(e){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("expected a JSON object");return e}a(q,"requireJsonObject");function h(e,n){const t=e[n];if(typeof t!="string")throw new Error(`expected JSON string field "${n}"`);return t}a(h,"requireJsonString");function v(e){const n=e.latestRun,t=E(e);return{pluginId:String(e.pluginId),name:e.name,packageCount:e.packages?.length??1,state:t,...e.currentPackageId===void 0?{}:{currentPackageId:String(e.currentPackageId)},...e.nextPackageId===void 0?{}:{nextPackageId:String(e.nextPackageId)},...e.activeRun===void 0?{}:{activeRun:{pluginRunId:String(e.activeRun.pluginRunId),packageId:String(e.activeRun.packageId)}},...n?.status!=="awaiting-approval"?{}:{pendingApproval:{pluginRunId:String(n.pluginRunId),packageId:String(n.packageId),mode:n.mode}}}}a(v,"selfSummary");function E(e){const n=e.latestRun?.status;return n==="awaiting-approval"?"awaiting-approval":n==="client-pending"||n==="starting-host"?"client-pending":n==="failed"||n==="rejected"||n==="cancelled"?"failed":n==="waiting"?"waiting":n==="running"||e.activeRun!==void 0?"running":e.currentPackageId===void 0?"defined":"stopped"}a(E,"selfState");function se(e,n,t,r){const o=e.dynamicCordisRunner.inspectPackage(n,t,r),i=e.dynamicCordisRunner.snapshot(n).find(y=>y.pluginId===t),s=i?.packages.find(y=>y.packageId===r),l=i?.activeRun?.packageId===r?i.activeRun:void 0,d=o.latestRun?.packageId===r?o.latestRun:void 0,c=l?.fiber===void 0?[...d?.host.waitingFor??[]]:f(e,l.fiber),D=s?.hasHostHalf!==!0?"absent":d?.host.status??(l===void 0?"stopped":c.length===0?"running":"waiting"),M=s?.hasClientHalf!==!0?"absent":d?.client.status??"stopped";return{mode:"package",plugin:v(o),packageId:String(r),name:o.name,purpose:o.purpose,code:o.code,runtime:{state:E(o),host:{status:D,provides:l?.fiber===void 0?[]:R(e,l.fiber),waitingFor:c,handlers:l?.handlers??[],...d?.host.error===void 0?{}:{error:d.host.error}},client:{status:M,waitingFor:[...d?.client.waitingFor??[]],...d?.client.error===void 0?{}:{error:d.client.error},...l?.renderFailure===void 0?{}:{renderFailure:l.renderFailure}}}}}a(se,"inspectSelfPackage");function oe(e){const n=new Set,t=/(?:^|\s)@([a-z]{3,6}-\d+)(?=\s|$)/g;for(const r of e){if(r.source.kind!=="user")continue;const o=r.content.flatMap(i=>i.type==="text"?[i.text]:[]).join(`
2245
+ - Use the cordis-plugin-development Skill for other failure causes, repair procedures, and complete extension patterns.`,I={type:"object",properties:{},additionalProperties:!1},P={description:"JSON data owned by this inspect provider."},Y=T("service","Exact Service key. Omit it for the compact Service and method-signature directory."),Z=T("event","Exact Event name. Omit it for the compact Event and listener-signature directory."),X={description:"Compact Service directory, or one exact Service contract with only its referenced type declarations."},ee={description:"Compact Event directory, or one exact Event contract with only its referenced type declarations."},ne=S.filter(e=>!e.name.startsWith("cordis/"));function te(e){return[b("Service","Progressive Host Service discovery: compact capability/signature directory, then one exact coding contract.","listService",n=>N(C(n,"service")),Y,X),b("Event","Progressive Host Event discovery: compact listener directory, then one exact event contract.","listEvents",n=>W(C(n,"event"),ne),Z,ee),b("Builtin","Plain-JavaScript symbols available to a dynamic Host half.","listBuiltins",()=>({builtins:F,referencedTypes:[]})),{manifest:{id:"Tool",description:"Tools visible to the requesting Agent, including scoped and dynamic registrations.",methods:[{name:"listTools",description:"Return every Tool schema currently callable by this Agent.",inputSchema:I,outputSchema:P}]},query(n,t,r){if(n!=="listTools")throw new Error(`unknown Tool inspect method "${n}"`);return Promise.resolve({tools:e.tools.schemas(r.agent)})}}]}a(te,"hostInspectProviders");function b(e,n,t,r,o=I,i=P){return{manifest:{id:e,description:n,methods:[{name:t,description:n,inputSchema:o,outputSchema:i}]},async query(s,l){if(s!==t)throw new Error(`unknown ${e} inspect method "${s}"`);return await r(l)}}}a(b,"registration");function T(e,n){return{type:"object",properties:{[e]:{type:"string",description:n}},additionalProperties:!1}}a(T,"exactInput");function C(e,n){if(e==null||Array.isArray(e)||typeof e!="object")return;const t=e[n];return typeof t=="string"?t:void 0}a(C,"readExact");const A="tool-cordis",re=["tools","systemPrompt","dynamicCordisRunner","cordisInspect"];function g(e){if(e.agent===void 0)throw new Error("Cordis dynamic tools require an Agent-backed session");return e.agent}a(g,"requireAgent");function ae(e){e.systemPrompt.section({name:"tool:cordis",order:115,text:$});for(const n of te(e))e.effect(()=>e.cordisInspect.register(n),`tool-cordis: inspect ${n.manifest.id}`);e.tools.register(p({name:"cordis_inspect_list",description:"List every Cordis Inspect Provider currently known to the Host, including local Host Providers and the latest manifests synchronized from the Client. Each entry includes its platform, purpose, read-only methods, and input/output schemas. Call this Tool before creating or modifying a Package, then select the provider and method for cordis_inspect_query from its result. Do not guess names or treat an Inspect method as a business Service that Plugin code can call.",parameters:{},output:{schema:{type:"json"},render:a((n,t)=>[{type:"text",text:JSON.stringify(t,null,2)}],"render")},execute(n,t){return Promise.resolve({providers:e.cordisInspect.list()})},presentCall:H})),e.tools.register(p({name:"cordis_inspect_query",description:"Run a read-only query explicitly declared by an Inspect Provider. platform, provider, and method must come from cordis_inspect_list, and input must satisfy that method's schema. Use this Tool before cordis_define to read exact Service methods, Event modes, Builtin signatures, Tool schemas, theme tokens, or live Slot trees and props. Host queries run locally. A Client query waits for the first valid page response and remains pending until a page answers or the Tool is cancelled. This Tool cannot invoke business Service methods or modify the runtime. For Service.listService and Event.listEvents, query without input to navigate the compact signature directory, then query the exact service or event for its structured contract and referenced types. For Slots.listSubTree, query without root to navigate the compact tree, then query the exact root for its complete registration contract and props.",parameters:{platform:{type:"string",required:!0,enum:["host","client"],description:"Runtime platform that owns the Provider."},provider:{type:"string",required:!0,description:"Exact Provider ID returned by cordis_inspect_list."},method:{type:"string",required:!0,description:"Exact method name declared by the Provider manifest."},input:{type:"json",description:"Optional query input; it must satisfy the method input schema."}},output:{schema:{type:"json"},render:a((n,t)=>[{type:"text",text:JSON.stringify(t,null,2)}],"render")},async execute(n,t){const r=await e.cordisInspect.query(n.platform,n.provider,n.method,n.input,g(t),t.signal);return{platform:n.platform,provider:n.provider,method:n.method,data:r}},presentCall:J})),e.tools.register(p({name:"cordis_inspect_self",description:"Inspect dynamic Cordis objects owned by the current Session at increasing levels of detail. With no IDs, list only Plugin summaries. With pluginId alone, return version pointers, the latest Run, and every Package summary. Only pluginId plus packageId returns that immutable Package's Host/Client source and runtime diagnostics. packageId cannot be supplied alone. Query an exact Package before handling @pluginId, repairing an asynchronous failure, or defining an updated version. This Tool is read-only: it neither executes code nor changes version pointers.",parameters:{pluginId:{type:"string",description:"Stable Plugin ID returned by cordis_define or injected by @pluginId; omit it to list every current Plugin."},packageId:{type:"string",description:"Exact immutable Package ID owned by pluginId; when specified, source and diagnostics are returned."}},output:{schema:{type:"json"},render:a((n,t)=>[{type:"text",text:JSON.stringify(t,null,2)}],"render")},execute(n,t){const r=g(t);if(n.packageId!==void 0&&n.pluginId===void 0)throw new Error("cordis_inspect_self packageId requires pluginId");if(n.pluginId===void 0)return Promise.resolve({mode:"plugins",plugins:e.dynamicCordisRunner.listPlugins(r).map(i=>v(i))});const o=u(n.pluginId);if(n.packageId===void 0){const i=e.dynamicCordisRunner.inspectPlugin(r,o);return Promise.resolve({mode:"plugin",...v(i),packages:i.packages.map(s=>({...s,packageId:String(s.packageId),isCurrent:s.packageId===i.currentPackageId,isNext:s.packageId===i.nextPackageId}))})}return Promise.resolve(se(e,r,o,w(n.packageId)))},presentCall:_})),e.tools.register(p({name:"cordis_define",description:'Define an immutable Cordis Package. For a new Plugin, use kind:"new" and provide only a semantic prefix of 3–6 lowercase English letters; the Host returns the final pluginId and packageId. To modify an existing Plugin, use kind:"existing" with its exact pluginId to append a Package without overwriting older versions. Provide at least one of code.host and code.client. Each value is a plain JavaScript function body that returns a Cordis Plugin; no TypeScript, JSX, or import transformation occurs. Query Inspect before depending on a Service, Event, Builtin, Slot, or token. Define only validates parameters and syntax and records source: it does not request approval, execute apply, or change currentPackageId. On success, call cordis_run with the returned IDs.',parameters:{plugin:{required:!0,oneOf:[{type:"object",additionalProperties:!1,properties:{kind:{type:"string",const:"new",required:!0},idPrefix:{type:"string",required:!0,description:"Suggested semantic prefix of 3–6 lowercase English letters; the Host adds a unique numeric suffix."}}},{type:"object",additionalProperties:!1,properties:{kind:{type:"string",const:"existing",required:!0},pluginId:{type:"string",required:!0,description:"Exact ID of an existing Plugin; the new Package is appended to that instance."}}}]},name:{type:"string",required:!0,description:"Short, readable Package name."},purpose:{type:"string",required:!0,description:"One-sentence, user-facing description of the Package purpose."},code:{type:"object",additionalProperties:!1,required:!0,properties:{host:{type:"string",description:"Plain JavaScript function body that returns the Host-half Cordis Plugin."},client:{type:"string",description:"Plain JavaScript function body that returns the browser Client-half Cordis Plugin."}}}},output:{schema:{type:"object",additionalProperties:!1,properties:{pluginId:{type:"string",required:!0},packageId:{type:"string",required:!0},name:{type:"string",required:!0},purpose:{type:"string",required:!0},hasHostHalf:{type:"boolean",required:!0},hasClientHalf:{type:"boolean",required:!0}}},render:a((n,t)=>[{type:"text",text:`Defined ${t.pluginId}/${t.packageId} (${t.name}); it is not running yet. Use cordis_run to activate this Package.`}],"render"),presentationMeta:a((n,t)=>({pluginId:t.pluginId,packageId:t.packageId}),"presentationMeta")},execute(n,t){const r=n.plugin.kind==="new"?{kind:"new",idPrefix:n.plugin.idPrefix}:{kind:"existing",pluginId:u(n.plugin.pluginId)},o=e.dynamicCordisRunner.define({sessionId:g(t).id,plugin:r,name:n.name,purpose:n.purpose,code:{...n.code.host===void 0?{}:{host:n.code.host},...n.code.client===void 0?{}:{client:n.code.client}}});return Promise.resolve({...o,pluginId:String(o.pluginId),packageId:String(o.packageId)})},presentCall:G})),e.tools.register(p({name:"cordis_run",description:'Activate one exact Package of a dynamic Plugin. Use mode:"run" for the first activation, restarting currentPackageId, or rollback. When current exists, use mode:"update" to switch to a different Package, even if the Plugin is currently stopped. An unauthorized Client Package creates an approval request and returns awaiting-approval; an authorized Package returns starting and continues asynchronously in the browser. Neither result waits for the final outcome inside the Tool. currentPackageId changes only after complete success; on failure, the old current and target next remain. Asynchronous success, rejection, or technical failure is reported through state and steering. After a technical failure, read diagnostics with cordis_inspect_self, correct the same Plugin, and retry autonomously. Do not request approval again after the user rejects it.',parameters:{pluginId:{type:"string",required:!0,description:"Stable Plugin ID returned by cordis_define."},packageId:{type:"string",required:!0,description:"Exact immutable Package ID to activate under that Plugin."},mode:{type:"string",required:!0,enum:["run","update"],description:"Use run for the first activation, restarting current, or rollback; use update to switch from current to a different Package."}},output:{schema:{type:"json"},render:a((n,t)=>{const r=q(t),o=h(r,"pluginId"),i=h(r,"packageId"),s=h(r,"pluginRunId");return[{type:"text",text:r.status==="awaiting-approval"?`${o}/${i} is awaiting user approval (${s}).`:r.status==="starting"?`${o}/${i} is starting asynchronously (${s}).`:`${o}/${i} is running (${s}).`}]},"render"),presentationMeta:a((n,t)=>{const r=q(t);return{pluginId:h(r,"pluginId"),packageId:h(r,"packageId"),pluginRunId:h(r,"pluginRunId")}},"presentationMeta")},async execute(n,t){const r=g(t),o=u(n.pluginId),i=w(n.packageId),s=await e.dynamicCordisRunner.run(r,o,i,n.mode,t.signal);if(!s.ok)throw new Error(s.message);if(s.status!=="running")return{status:s.status,pluginId:n.pluginId,packageId:n.packageId,pluginRunId:String(s.pluginRunId),mode:s.mode,...s.currentPackageId===void 0?{}:{currentPackageId:String(s.currentPackageId)},nextPackageId:String(s.nextPackageId)};const l=e.dynamicCordisRunner.snapshot(r).find(c=>c.pluginId===o),d=l?.activeRun?.pluginRunId===s.pluginRunId?l.activeRun.fiber:void 0;return{status:"running",pluginId:n.pluginId,packageId:n.packageId,pluginRunId:String(s.pluginRunId),currentPackageId:String(s.currentPackageId),...s.nextPackageId===void 0?{}:{nextPackageId:String(s.nextPackageId)},host:{status:d===void 0?"absent":f(e,d).length===0?"running":"waiting",provides:d===void 0?[]:R(e,d),waitingFor:d===void 0?[]:f(e,d)},client:{status:s.clientWaitingFor===void 0?"absent":s.clientWaitingFor.length===0?"running":"waiting",waitingFor:[...s.clientWaitingFor??[]]}}},presentCall:K})),e.tools.register(p({name:"cordis_stop",description:"Stop the current Run of a dynamic Plugin and cancel unfinished approval or activation requests. Retain the Plugin, every immutable Package, grants, currentPackageId, and nextPackageId so it can later run or update directly. Stopping an already stopped Plugin succeeds idempotently. Use this Tool to disable effects temporarily; use cordis_undefine for permanent removal.",parameters:{pluginId:{type:"string",required:!0,description:"Stable dynamic Plugin ID to stop."}},output:{schema:{type:"object",additionalProperties:!1,properties:{pluginId:{type:"string",required:!0}}},render:a((n,t)=>[{type:"text",text:`Dynamic Plugin ${t.pluginId} is stopped; its definition and versions remain.`}],"render")},async execute(n,t){const r=await e.dynamicCordisRunner.stop(g(t),u(n.pluginId));if(!r.ok&&r.reason!=="not-running")throw new Error(r.message);return{pluginId:n.pluginId}},presentCall:Q})),e.tools.register(p({name:"cordis_undefine",description:'Permanently remove a dynamic Plugin owned by the current Session. If it is running or awaiting approval, first stop it and cancel the request, then delete every Package, grant, and version pointer. After this returns, its pluginId, packageIds, @ reference, and Package business views are invalid; historical cards retain only a "Plugin removed" record. Do not call this Tool when versions must remain available for restart or rollback; use cordis_stop instead.',parameters:{pluginId:{type:"string",required:!0,description:"Stable dynamic Plugin ID to remove permanently."}},output:{schema:{type:"object",additionalProperties:!1,properties:{pluginId:{type:"string",required:!0},wasRunning:{type:"boolean",required:!0}}},render:a((n,t)=>[{type:"text",text:`Removed dynamic Plugin ${t.pluginId} and all of its Packages.`}],"render")},async execute(n,t){const r=await e.dynamicCordisRunner.undefine(g(t),u(n.pluginId));if(!r.ok)throw new Error(r.message);return{pluginId:n.pluginId,wasRunning:r.wasRunning}},presentCall:z})),e.on("agent/pre-step",async({agent:n,messages:t,signal:r},o)=>{const i=await o();if(i.kind==="reject")return i;const s=oe(t);if(s.length===0)return i;r.throwIfAborted();const l=s.map(d=>{const c=e.dynamicCordisRunner.reference(n,u(d));return L({content:[{type:"text",text:c===void 0?de(d):ie(c)}],source:{kind:"plugin",plugin:A,form:"instructions"}})});return{kind:"enter",messages:[...i.messages,...l]}})}a(ae,"apply");function q(e){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("expected a JSON object");return e}a(q,"requireJsonObject");function h(e,n){const t=e[n];if(typeof t!="string")throw new Error(`expected JSON string field "${n}"`);return t}a(h,"requireJsonString");function v(e){const n=e.latestRun,t=E(e);return{pluginId:String(e.pluginId),name:e.name,packageCount:e.packages?.length??1,state:t,...e.currentPackageId===void 0?{}:{currentPackageId:String(e.currentPackageId)},...e.nextPackageId===void 0?{}:{nextPackageId:String(e.nextPackageId)},...e.activeRun===void 0?{}:{activeRun:{pluginRunId:String(e.activeRun.pluginRunId),packageId:String(e.activeRun.packageId)}},...n?.status!=="awaiting-approval"?{}:{pendingApproval:{pluginRunId:String(n.pluginRunId),packageId:String(n.packageId),mode:n.mode}}}}a(v,"selfSummary");function E(e){const n=e.latestRun?.status;return n==="awaiting-approval"?"awaiting-approval":n==="client-pending"||n==="starting-host"?"client-pending":n==="failed"||n==="rejected"||n==="cancelled"?"failed":n==="waiting"?"waiting":n==="running"||e.activeRun!==void 0?"running":e.currentPackageId===void 0?"defined":"stopped"}a(E,"selfState");function se(e,n,t,r){const o=e.dynamicCordisRunner.inspectPackage(n,t,r),i=e.dynamicCordisRunner.snapshot(n).find(y=>y.pluginId===t),s=i?.packages.find(y=>y.packageId===r),l=i?.activeRun?.packageId===r?i.activeRun:void 0,d=o.latestRun?.packageId===r?o.latestRun:void 0,c=l?.fiber===void 0?[...d?.host.waitingFor??[]]:f(e,l.fiber),D=s?.hasHostHalf!==!0?"absent":d?.host.status??(l===void 0?"stopped":c.length===0?"running":"waiting"),M=s?.hasClientHalf!==!0?"absent":d?.client.status??"stopped";return{mode:"package",plugin:v(o),packageId:String(r),name:o.name,purpose:o.purpose,code:o.code,runtime:{state:E(o),host:{status:D,provides:l?.fiber===void 0?[]:R(e,l.fiber),waitingFor:c,handlers:l?.handlers??[],...d?.host.error===void 0?{}:{error:d.host.error}},client:{status:M,waitingFor:[...d?.client.waitingFor??[]],...d?.client.error===void 0?{}:{error:d.client.error},...l?.renderFailure===void 0?{}:{renderFailure:l.renderFailure}}}}}a(se,"inspectSelfPackage");function oe(e){const n=new Set,t=/(?:^|\s)@([a-z]{3,6}-\d+)(?=\s|$)/g;for(const r of e){if(r.source.kind!=="user")continue;const o=r.content.flatMap(i=>i.type==="text"?[i.text]:[]).join(`
2237
2246
  `);for(const i of o.matchAll(t))i[1]!==void 0&&n.add(i[1])}return[...n]}a(oe,"referencedPluginIds");function ie(e){const n=e.currentPackageId===void 0?"run":"update";return["<cordis_dynamic_plugin_context>",JSON.stringify(e,null,2),"",`The user explicitly referenced @${e.pluginId}. Use Package ${e.packageId} as the base for this modification.`,`Before modifying it, call cordis_inspect_self with pluginId="${e.pluginId}" and packageId="${e.packageId}" to read the exact metadata and source.`,`Use cordis_define with plugin.kind="existing" and the original pluginId="${e.pluginId}" to append an immutable Package.`,`Do not create a new Plugin for this request. After cordis_define succeeds, call cordis_run mode="${n}" with the returned packageId.`,"</cordis_dynamic_plugin_context>"].join(`
2238
2247
  `)}a(ie,"renderReference");function de(e){return["<cordis_dynamic_plugin_context>",`The user explicitly referenced @${e}, but this Plugin is unavailable in the current Session.`,"It may have been removed, belong to another Session, or have been lost when the DSH process restarted.","Do not claim that it was updated or silently create a replacement Plugin. Tell the user that the reference is currently unavailable.","</cordis_dynamic_plugin_context>"].join(`
2239
2248
  `)}a(de,"renderUnavailableReference");export{ae as apply,re as inject,A as name};
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-cordis","version":"0.1.0-rc.7","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-rc.7","@deepseek-ai/dsh-cordis-host-runner":"^0.1.0-rc.7","@deepseek-ai/dsh-scope":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-tools":"^0.1.0-rc.7"}}
1
+ {"name":"@deepseek-ai/dsh-tool-cordis","version":"0.1.0-rc.7","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-rc.7","@deepseek-ai/dsh-scope":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-fs","version":"0.1.0-rc.7","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-rc.7","@deepseek-ai/dsh-fs":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-sandbox":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-sandbox-policy":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-user-approval":"^0.1.0-rc.7"}}
1
+ {"name":"@deepseek-ai/dsh-tool-fs","version":"0.1.0-rc.7","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-rc.7","@deepseek-ai/dsh-fs":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-sandbox":"^0.1.0-rc.7","@deepseek-ai/dsh-sandbox-policy":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/dsh-user-approval":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-fs-search","version":"0.1.0-rc.7","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-rc.7","@deepseek-ai/dsh-output-retention":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-spill":"^0.1.0-rc.7","@deepseek-ai/dsh-subprocess":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-timeout":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-fs-search","version":"0.1.0-rc.7","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-output-retention":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-spill":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-subprocess":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-timeout":"^0.1.0-rc.7"}}
@@ -1 +1 @@
1
- {"name":"@deepseek-ai/dsh-tool-goal","version":"0.1.0-rc.7","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-rc.7","@deepseek-ai/dsh-goal":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
1
+ {"name":"@deepseek-ai/dsh-tool-goal","version":"0.1.0-rc.7","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-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-tools":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-goal":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}