@toddzheng024/dscode-desktop 0.0.0-stage → 0.7.33

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 (484) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +120 -2
  3. package/THIRD_PARTY_NOTICES.md +30 -0
  4. package/bin/apply_patch +9 -0
  5. package/cordis.patch.yml +433 -0
  6. package/docs/CHANGELOG.md +641 -0
  7. package/docs/account-login.md +44 -0
  8. package/docs/auto-review.md +128 -0
  9. package/docs/browser-use.md +783 -0
  10. package/docs/computer-use.md +81 -0
  11. package/docs/custom-providers.md +88 -0
  12. package/docs/demo.md +76 -0
  13. package/docs/distribution.md +58 -0
  14. package/docs/dscode-ultra.md +75 -0
  15. package/docs/email.md +296 -0
  16. package/docs/exec.md +40 -0
  17. package/docs/hub-distribution.md +190 -0
  18. package/docs/memory.md +121 -0
  19. package/docs/opencode-go.md +61 -0
  20. package/docs/plugin-hub.md +68 -0
  21. package/docs/releases/0.2.0.md +28 -0
  22. package/docs/releases/0.3.0.md +21 -0
  23. package/docs/releases/0.4.0.md +20 -0
  24. package/docs/releases/0.5.0.md +19 -0
  25. package/docs/releases/0.6.0.md +20 -0
  26. package/docs/releases/0.7.0.md +22 -0
  27. package/docs/releases/0.7.1.md +20 -0
  28. package/docs/releases/0.7.10.md +10 -0
  29. package/docs/releases/0.7.11.md +17 -0
  30. package/docs/releases/0.7.12.md +11 -0
  31. package/docs/releases/0.7.13.md +12 -0
  32. package/docs/releases/0.7.14.md +11 -0
  33. package/docs/releases/0.7.15.md +11 -0
  34. package/docs/releases/0.7.16.md +10 -0
  35. package/docs/releases/0.7.17.md +12 -0
  36. package/docs/releases/0.7.18.md +13 -0
  37. package/docs/releases/0.7.19.md +8 -0
  38. package/docs/releases/0.7.2.md +19 -0
  39. package/docs/releases/0.7.20.md +10 -0
  40. package/docs/releases/0.7.21.md +9 -0
  41. package/docs/releases/0.7.22.md +11 -0
  42. package/docs/releases/0.7.23.md +14 -0
  43. package/docs/releases/0.7.24.md +11 -0
  44. package/docs/releases/0.7.25.md +8 -0
  45. package/docs/releases/0.7.26.md +18 -0
  46. package/docs/releases/0.7.27.md +8 -0
  47. package/docs/releases/0.7.28.md +22 -0
  48. package/docs/releases/0.7.29.md +12 -0
  49. package/docs/releases/0.7.3.md +23 -0
  50. package/docs/releases/0.7.30.md +19 -0
  51. package/docs/releases/0.7.31.md +14 -0
  52. package/docs/releases/0.7.32.md +14 -0
  53. package/docs/releases/0.7.33.md +30 -0
  54. package/docs/releases/0.7.4.md +16 -0
  55. package/docs/releases/0.7.5.md +18 -0
  56. package/docs/releases/0.7.6.md +29 -0
  57. package/docs/releases/0.7.7.md +36 -0
  58. package/docs/releases/0.7.8.md +14 -0
  59. package/docs/releases/0.7.9.md +15 -0
  60. package/docs/session-bridge.md +80 -0
  61. package/docs/session-cards.md +53 -0
  62. package/docs/session-communication.md +186 -0
  63. package/docs/session-metrics.md +41 -0
  64. package/docs/skills.md +81 -0
  65. package/docs/triggers.md +338 -0
  66. package/docs/tui-commands.md +204 -0
  67. package/extensions/browser/manifest.json +22 -0
  68. package/extensions/browser/popup.css +6 -0
  69. package/extensions/browser/popup.html +11 -0
  70. package/extensions/browser/popup.mjs +47 -0
  71. package/extensions/browser/protocol.mjs +168 -0
  72. package/extensions/browser/worker.mjs +94 -0
  73. package/icon.svg +7 -0
  74. package/locale/en.json +6 -0
  75. package/locale/zh-cn.json +6 -0
  76. package/node_modules/@deepseek-ai/node-addon-system/LICENSE +21 -0
  77. package/node_modules/@deepseek-ai/node-addon-system/README.i18n.yaml +6 -0
  78. package/node_modules/@deepseek-ai/node-addon-system/README.md +15 -0
  79. package/node_modules/@deepseek-ai/node-addon-system/README.zh.md +15 -0
  80. package/node_modules/@deepseek-ai/node-addon-system/lib/flock.d.ts +13 -0
  81. package/node_modules/@deepseek-ai/node-addon-system/lib/flock.js +51 -0
  82. package/node_modules/@deepseek-ai/node-addon-system/lib/index.d.ts +73 -0
  83. package/node_modules/@deepseek-ai/node-addon-system/lib/index.js +98 -0
  84. package/node_modules/@deepseek-ai/node-addon-system/package.json +45 -0
  85. package/node_modules/@deepseek-ai/node-addon-system/src/flock.c +164 -0
  86. package/node_modules/@deepseek-ai/node-addon-system/src/main.c +298 -0
  87. package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/LICENSE +28 -0
  88. package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/README.i18n.yaml +6 -0
  89. package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/README.md +9 -0
  90. package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/README.zh.md +9 -0
  91. package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/bin/system.node +0 -0
  92. package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/package.json +31 -0
  93. package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/prebuilds.json +6 -0
  94. package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/LICENSE +28 -0
  95. package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/README.i18n.yaml +6 -0
  96. package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/README.md +9 -0
  97. package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/README.zh.md +9 -0
  98. package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/bin/system.node +0 -0
  99. package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/package.json +31 -0
  100. package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/prebuilds.json +6 -0
  101. package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/LICENSE +28 -0
  102. package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/README.i18n.yaml +6 -0
  103. package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/README.md +11 -0
  104. package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/README.zh.md +11 -0
  105. package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/bin/glibc/system.node +0 -0
  106. package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/bin/landlock-run +0 -0
  107. package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/bin/musl/system.node +0 -0
  108. package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/package.json +31 -0
  109. package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/prebuilds.json +24 -0
  110. package/node_modules/@deepseek-ai/node-addon-system-linux-x64/LICENSE +28 -0
  111. package/node_modules/@deepseek-ai/node-addon-system-linux-x64/README.i18n.yaml +6 -0
  112. package/node_modules/@deepseek-ai/node-addon-system-linux-x64/README.md +11 -0
  113. package/node_modules/@deepseek-ai/node-addon-system-linux-x64/README.zh.md +11 -0
  114. package/node_modules/@deepseek-ai/node-addon-system-linux-x64/bin/glibc/system.node +0 -0
  115. package/node_modules/@deepseek-ai/node-addon-system-linux-x64/bin/landlock-run +0 -0
  116. package/node_modules/@deepseek-ai/node-addon-system-linux-x64/bin/musl/system.node +0 -0
  117. package/node_modules/@deepseek-ai/node-addon-system-linux-x64/package.json +31 -0
  118. package/node_modules/@deepseek-ai/node-addon-system-linux-x64/prebuilds.json +24 -0
  119. package/package.json +156 -4
  120. package/plugins/account/index.mjs +178 -0
  121. package/plugins/account/state.mjs +123 -0
  122. package/plugins/auto-review/audit.mjs +24 -0
  123. package/plugins/auto-review/index.mjs +267 -0
  124. package/plugins/auto-review/policy.mjs +92 -0
  125. package/plugins/browser/SKILL.md +158 -0
  126. package/plugins/browser/access.mjs +143 -0
  127. package/plugins/browser/config.mjs +60 -0
  128. package/plugins/browser/connection.mjs +385 -0
  129. package/plugins/browser/desktop-client.mjs +282 -0
  130. package/plugins/browser/desktop-host.mjs +74 -0
  131. package/plugins/browser/document-identity.mjs +57 -0
  132. package/plugins/browser/extension-relay.mjs +66 -0
  133. package/plugins/browser/files.mjs +32 -0
  134. package/plugins/browser/index.mjs +235 -0
  135. package/plugins/browser/mcp-entry.mjs +18 -0
  136. package/plugins/browser/mcp-tools.mjs +21 -0
  137. package/plugins/browser/presentation.mjs +45 -0
  138. package/plugins/browser/preview.mjs +77 -0
  139. package/plugins/browser/review.mjs +20 -0
  140. package/plugins/browser/screenshots.mjs +35 -0
  141. package/plugins/clipboard-image/clipboard-image.swift +56 -0
  142. package/plugins/clipboard-image/index.mjs +70 -0
  143. package/plugins/code-review/baseline.mjs +143 -0
  144. package/plugins/code-review/git.mjs +163 -0
  145. package/plugins/code-review/index.mjs +236 -0
  146. package/plugins/compaction/engine.mjs +304 -0
  147. package/plugins/compaction/tetris.mjs +65 -0
  148. package/plugins/compaction/threshold.mjs +98 -0
  149. package/plugins/computer-use/DESKTOP-SKILL.md +64 -0
  150. package/plugins/computer-use/desktop-host.mjs +75 -0
  151. package/plugins/computer-use/desktop-skill.mjs +28 -0
  152. package/plugins/computer-use/desktop-upstream.mjs +3 -0
  153. package/plugins/computer-use/index.mjs +37 -0
  154. package/plugins/cordis-config/plain.mjs +31 -0
  155. package/plugins/credentials/index.mjs +73 -0
  156. package/plugins/custom/adapter.mjs +110 -0
  157. package/plugins/custom/config.mjs +85 -0
  158. package/plugins/custom/desktop-client.mjs +150 -0
  159. package/plugins/custom/desktop-host.mjs +78 -0
  160. package/plugins/custom/images.mjs +32 -0
  161. package/plugins/custom/index.mjs +145 -0
  162. package/plugins/custom/wire.mjs +179 -0
  163. package/plugins/desktop/client.mjs +1041 -0
  164. package/plugins/desktop/index.mjs +10 -0
  165. package/plugins/desktop/shell-environment.mjs +9 -0
  166. package/plugins/desktop-workspace/hooks.mjs +29 -0
  167. package/plugins/desktop-workspace/index.mjs +37 -0
  168. package/plugins/dscode/board.mjs +260 -0
  169. package/plugins/dscode/child-target.mjs +11 -0
  170. package/plugins/dscode/control.mjs +17 -0
  171. package/plugins/dscode/desktop-client.mjs +55 -0
  172. package/plugins/dscode/desktop-host.mjs +37 -0
  173. package/plugins/dscode/index.mjs +270 -0
  174. package/plugins/email/cli.mjs +32 -0
  175. package/plugins/email/contacts.mjs +36 -0
  176. package/plugins/email/desktop-client.mjs +117 -0
  177. package/plugins/email/desktop-host.mjs +54 -0
  178. package/plugins/email/desktop-service.mjs +106 -0
  179. package/plugins/email/gmail-oauth.mjs +69 -0
  180. package/plugins/email/gmail-store.mjs +2 -0
  181. package/plugins/email/gmail.mjs +194 -0
  182. package/plugins/email/imap.mjs +136 -0
  183. package/plugins/email/inbox.d.mts +25 -0
  184. package/plugins/email/inbox.mjs +76 -0
  185. package/plugins/email/smtp.mjs +70 -0
  186. package/plugins/email/store.mjs +32 -0
  187. package/plugins/email-tools/index.mjs +46 -0
  188. package/plugins/exec/cli.mjs +64 -0
  189. package/plugins/exec/index.mjs +112 -0
  190. package/plugins/grok/adapter.mjs +114 -0
  191. package/plugins/grok/auth.mjs +76 -0
  192. package/plugins/grok/billing.mjs +146 -0
  193. package/plugins/grok/index.mjs +122 -0
  194. package/plugins/grok/models.mjs +129 -0
  195. package/plugins/grok/status.mjs +28 -0
  196. package/plugins/grok/wire.mjs +268 -0
  197. package/plugins/hub/catalog.mjs +82 -0
  198. package/plugins/hub/desktop-client.mjs +114 -0
  199. package/plugins/hub/desktop-host.mjs +129 -0
  200. package/plugins/i18n/messages.d.mts +21 -0
  201. package/plugins/i18n/messages.mjs +537 -0
  202. package/plugins/jev/approval.mjs +131 -0
  203. package/plugins/jev/client.mjs +74 -0
  204. package/plugins/jev/index.mjs +99 -0
  205. package/plugins/memory/content.mjs +57 -0
  206. package/plugins/memory/desktop-host.mjs +3 -0
  207. package/plugins/memory/index.mjs +168 -0
  208. package/plugins/memory/pipeline.mjs +79 -0
  209. package/plugins/memory/store.mjs +93 -0
  210. package/plugins/message-source/kind.mjs +20 -0
  211. package/plugins/opencode-go/adapter.mjs +96 -0
  212. package/plugins/opencode-go/command.mjs +128 -0
  213. package/plugins/opencode-go/index.mjs +120 -0
  214. package/plugins/opencode-go/models.mjs +58 -0
  215. package/plugins/opencode-go/oauth.mjs +194 -0
  216. package/plugins/opencode-go/search.mjs +86 -0
  217. package/plugins/opencode-go/usage.mjs +119 -0
  218. package/plugins/opencode-go/version.mjs +10 -0
  219. package/plugins/opencode-go/wire.mjs +73 -0
  220. package/plugins/openrouter/adapter.mjs +232 -0
  221. package/plugins/openrouter/index.mjs +123 -0
  222. package/plugins/openrouter/models.mjs +157 -0
  223. package/plugins/openrouter/search.mjs +113 -0
  224. package/plugins/openrouter/wire.mjs +101 -0
  225. package/plugins/providers/catalog.mjs +160 -0
  226. package/plugins/providers/chat-messages.mjs +120 -0
  227. package/plugins/providers/chat-stream.mjs +174 -0
  228. package/plugins/providers/desktop-client.mjs +84 -0
  229. package/plugins/providers/desktop-host.mjs +63 -0
  230. package/plugins/providers/effort.mjs +35 -0
  231. package/plugins/providers/http-errors.mjs +50 -0
  232. package/plugins/providers/openrouter-account.mjs +171 -0
  233. package/plugins/session-bridge/client.mjs +106 -0
  234. package/plugins/session-bridge/communication.mjs +260 -0
  235. package/plugins/session-bridge/index.mjs +68 -0
  236. package/plugins/session-bridge/mailbox.mjs +267 -0
  237. package/plugins/session-bridge/paths.mjs +21 -0
  238. package/plugins/session-bridge/server.mjs +172 -0
  239. package/plugins/session-bridge/tasks.mjs +229 -0
  240. package/plugins/session-cards/content.mjs +64 -0
  241. package/plugins/session-cards/index.mjs +38 -0
  242. package/plugins/session-cards/manager.mjs +140 -0
  243. package/plugins/session-metrics/attribution.mjs +30 -0
  244. package/plugins/session-metrics/balance.mjs +81 -0
  245. package/plugins/session-metrics/desktop-client.mjs +62 -0
  246. package/plugins/session-metrics/desktop-host.mjs +46 -0
  247. package/plugins/session-metrics/index.mjs +96 -0
  248. package/plugins/session-metrics/pricing.mjs +84 -0
  249. package/plugins/session-metrics/rate.mjs +59 -0
  250. package/plugins/session-metrics/store.mjs +75 -0
  251. package/plugins/session-metrics/turns.mjs +134 -0
  252. package/plugins/session-metrics/view.mjs +271 -0
  253. package/plugins/time-marks/desktop-host.mjs +2 -0
  254. package/plugins/time-marks/index.mjs +116 -0
  255. package/plugins/time-marks/marks.mjs +152 -0
  256. package/plugins/triggers/cli.mjs +558 -0
  257. package/plugins/triggers/commands.mjs +143 -0
  258. package/plugins/triggers/config.mjs +264 -0
  259. package/plugins/triggers/desktop-client.mjs +155 -0
  260. package/plugins/triggers/desktop-host.mjs +88 -0
  261. package/plugins/triggers/desktop-management.mjs +97 -0
  262. package/plugins/triggers/desktop-scheduler.mjs +125 -0
  263. package/plugins/triggers/host.mjs +24 -0
  264. package/plugins/triggers/index.mjs +27 -0
  265. package/plugins/triggers/job-cli.mjs +110 -0
  266. package/plugins/triggers/jobs.mjs +156 -0
  267. package/plugins/triggers/launchd.mjs +101 -0
  268. package/plugins/triggers/lease.mjs +24 -0
  269. package/plugins/triggers/log.mjs +104 -0
  270. package/plugins/triggers/management.mjs +181 -0
  271. package/plugins/triggers/options.mjs +117 -0
  272. package/plugins/triggers/overlay.mjs +7 -0
  273. package/plugins/triggers/poll.mjs +65 -0
  274. package/plugins/triggers/run.mjs +157 -0
  275. package/plugins/triggers/schedule.mjs +40 -0
  276. package/plugins/triggers/scheduler-service.mjs +46 -0
  277. package/plugins/triggers/scheduler.mjs +92 -0
  278. package/plugins/triggers/session-run.mjs +125 -0
  279. package/plugins/triggers/session.mjs +48 -0
  280. package/plugins/triggers/source-emit.mjs +19 -0
  281. package/plugins/triggers/source-host.mjs +78 -0
  282. package/plugins/triggers/source-ingress.mjs +70 -0
  283. package/plugins/triggers/source-sandbox.mjs +35 -0
  284. package/plugins/triggers/sources.mjs +45 -0
  285. package/plugins/triggers/spool.mjs +145 -0
  286. package/plugins/triggers/tools.mjs +67 -0
  287. package/plugins/triggers/unattended.mjs +18 -0
  288. package/plugins/tui-tools/composition.mjs +28 -0
  289. package/plugins/tui-tools/desktop-host.mjs +2 -0
  290. package/plugins/tui-tools/doctor-cli.mjs +22 -0
  291. package/plugins/tui-tools/doctor.mjs +148 -0
  292. package/plugins/tui-tools/hook-sources.mjs +113 -0
  293. package/plugins/tui-tools/hooks.mjs +23 -0
  294. package/plugins/tui-tools/index.mjs +268 -0
  295. package/plugins/tui-tools/sandbox-runner.mjs +123 -0
  296. package/plugins/tui-tools/shell.mjs +27 -0
  297. package/plugins/tui-tools/update.mjs +111 -0
  298. package/plugins/tui-tools/workspace-discovery.mjs +129 -0
  299. package/plugins/ultra/policy.mjs +42 -0
  300. package/plugins/worktree-subagent/worktree.mjs +56 -0
  301. package/runtime-sources.json +94 -0
  302. package/vendor/bash/LICENSE +21 -0
  303. package/vendor/bash/index.js +717 -0
  304. package/vendor/bash/types/background.d.ts +50 -0
  305. package/vendor/bash/types/index.d.ts +38 -0
  306. package/vendor/bash/types/render.d.ts +57 -0
  307. package/vendor/command-goal/LICENSE +21 -0
  308. package/vendor/command-goal/index.js +210 -0
  309. package/vendor/command-goal/types/index.d.ts +10 -0
  310. package/vendor/computer-use/LICENSE +21 -0
  311. package/vendor/computer-use/lib/approval-policy.js +12 -0
  312. package/vendor/computer-use/lib/approval-policy.js.map +1 -0
  313. package/vendor/computer-use/lib/artifacts.js +79 -0
  314. package/vendor/computer-use/lib/artifacts.js.map +1 -0
  315. package/vendor/computer-use/lib/backend.js +3 -0
  316. package/vendor/computer-use/lib/backend.js.map +1 -0
  317. package/vendor/computer-use/lib/client.js +369 -0
  318. package/vendor/computer-use/lib/client.js.map +1 -0
  319. package/vendor/computer-use/lib/config.js +159 -0
  320. package/vendor/computer-use/lib/config.js.map +1 -0
  321. package/vendor/computer-use/lib/confirmations.js +99 -0
  322. package/vendor/computer-use/lib/confirmations.js.map +1 -0
  323. package/vendor/computer-use/lib/diff.js +58 -0
  324. package/vendor/computer-use/lib/diff.js.map +1 -0
  325. package/vendor/computer-use/lib/errors.js +22 -0
  326. package/vendor/computer-use/lib/errors.js.map +1 -0
  327. package/vendor/computer-use/lib/exposure.js +244 -0
  328. package/vendor/computer-use/lib/exposure.js.map +1 -0
  329. package/vendor/computer-use/lib/index.js +66 -0
  330. package/vendor/computer-use/lib/index.js.map +1 -0
  331. package/vendor/computer-use/lib/leases.js +262 -0
  332. package/vendor/computer-use/lib/leases.js.map +1 -0
  333. package/vendor/computer-use/lib/providers/macos.js +243 -0
  334. package/vendor/computer-use/lib/providers/macos.js.map +1 -0
  335. package/vendor/computer-use/lib/providers/native-helper.js +726 -0
  336. package/vendor/computer-use/lib/providers/native-helper.js.map +1 -0
  337. package/vendor/computer-use/lib/providers/unsupported.js +51 -0
  338. package/vendor/computer-use/lib/providers/unsupported.js.map +1 -0
  339. package/vendor/computer-use/lib/service.js +608 -0
  340. package/vendor/computer-use/lib/service.js.map +1 -0
  341. package/vendor/computer-use/lib/skill.js +136 -0
  342. package/vendor/computer-use/lib/skill.js.map +1 -0
  343. package/vendor/computer-use/lib/target-resolver.js +180 -0
  344. package/vendor/computer-use/lib/target-resolver.js.map +1 -0
  345. package/vendor/computer-use/lib/tools.js +511 -0
  346. package/vendor/computer-use/lib/tools.js.map +1 -0
  347. package/vendor/computer-use/lib/types/approval-policy.d.ts +13 -0
  348. package/vendor/computer-use/lib/types/approval-policy.d.ts.map +1 -0
  349. package/vendor/computer-use/lib/types/artifacts.d.ts +10 -0
  350. package/vendor/computer-use/lib/types/artifacts.d.ts.map +1 -0
  351. package/vendor/computer-use/lib/types/backend.d.ts +124 -0
  352. package/vendor/computer-use/lib/types/backend.d.ts.map +1 -0
  353. package/vendor/computer-use/lib/types/client/index.d.ts +83 -0
  354. package/vendor/computer-use/lib/types/client/index.d.ts.map +1 -0
  355. package/vendor/computer-use/lib/types/config.d.ts +94 -0
  356. package/vendor/computer-use/lib/types/config.d.ts.map +1 -0
  357. package/vendor/computer-use/lib/types/confirmations.d.ts +23 -0
  358. package/vendor/computer-use/lib/types/confirmations.d.ts.map +1 -0
  359. package/vendor/computer-use/lib/types/diff.d.ts +5 -0
  360. package/vendor/computer-use/lib/types/diff.d.ts.map +1 -0
  361. package/vendor/computer-use/lib/types/errors.d.ts +15 -0
  362. package/vendor/computer-use/lib/types/errors.d.ts.map +1 -0
  363. package/vendor/computer-use/lib/types/exposure.d.ts +30 -0
  364. package/vendor/computer-use/lib/types/exposure.d.ts.map +1 -0
  365. package/vendor/computer-use/lib/types/index.d.ts +21 -0
  366. package/vendor/computer-use/lib/types/index.d.ts.map +1 -0
  367. package/vendor/computer-use/lib/types/leases.d.ts +81 -0
  368. package/vendor/computer-use/lib/types/leases.d.ts.map +1 -0
  369. package/vendor/computer-use/lib/types/providers/macos.d.ts +39 -0
  370. package/vendor/computer-use/lib/types/providers/macos.d.ts.map +1 -0
  371. package/vendor/computer-use/lib/types/providers/native-helper.d.ts +48 -0
  372. package/vendor/computer-use/lib/types/providers/native-helper.d.ts.map +1 -0
  373. package/vendor/computer-use/lib/types/providers/unsupported.d.ts +23 -0
  374. package/vendor/computer-use/lib/types/providers/unsupported.d.ts.map +1 -0
  375. package/vendor/computer-use/lib/types/service.d.ts +58 -0
  376. package/vendor/computer-use/lib/types/service.d.ts.map +1 -0
  377. package/vendor/computer-use/lib/types/skill.d.ts +14 -0
  378. package/vendor/computer-use/lib/types/skill.d.ts.map +1 -0
  379. package/vendor/computer-use/lib/types/target-resolver.d.ts +38 -0
  380. package/vendor/computer-use/lib/types/target-resolver.d.ts.map +1 -0
  381. package/vendor/computer-use/lib/types/tools.d.ts +6 -0
  382. package/vendor/computer-use/lib/types/tools.d.ts.map +1 -0
  383. package/vendor/computer-use/lib/types/types.d.ts +270 -0
  384. package/vendor/computer-use/lib/types/types.d.ts.map +1 -0
  385. package/vendor/computer-use/lib/types/web.d.ts +33 -0
  386. package/vendor/computer-use/lib/types/web.d.ts.map +1 -0
  387. package/vendor/computer-use/lib/types.js +9 -0
  388. package/vendor/computer-use/lib/types.js.map +1 -0
  389. package/vendor/computer-use/lib/web.js +188 -0
  390. package/vendor/computer-use/lib/web.js.map +1 -0
  391. package/vendor/computer-use/native/macos/Sources/Fixture/main.swift +412 -0
  392. package/vendor/computer-use/native/macos/Sources/Helper/CursorImage.swift +11 -0
  393. package/vendor/computer-use/native/macos/Sources/Helper/CursorMotion.swift +67 -0
  394. package/vendor/computer-use/native/macos/Sources/Helper/CursorOverlay.swift +840 -0
  395. package/vendor/computer-use/native/macos/Sources/Helper/TargetedPointer.swift +327 -0
  396. package/vendor/computer-use/native/macos/Sources/Helper/WindowNumberMatcher.swift +29 -0
  397. package/vendor/computer-use/native/macos/Sources/Helper/main.swift +1244 -0
  398. package/vendor/computer-use/native/macos/Sources/Monitor/main.swift +153 -0
  399. package/vendor/computer-use/native/macos/bin/dsh-computer-use-helper +0 -0
  400. package/vendor/computer-use/native/macos/manifest.json +14 -0
  401. package/vendor/persistent/LICENSE +21 -0
  402. package/vendor/persistent/index.js +411 -0
  403. package/vendor/persistent/types/index.d.ts +24 -0
  404. package/vendor/subagent/LICENSE +21 -0
  405. package/vendor/subagent/index.js +694 -0
  406. package/vendor/subagent/invariant.js +52 -0
  407. package/vendor/subagent/model-selection-settings.js +68 -0
  408. package/vendor/subagent/types/index.d.ts +82 -0
  409. package/vendor/subagent/types/invariant.d.ts +16 -0
  410. package/vendor/subagent/types/list-models.d.ts +10 -0
  411. package/vendor/subagent/types/model-selection-settings.d.ts +45 -0
  412. package/vendor/subagent/types/model-selection-state.d.ts +48 -0
  413. package/vendor/subagent/types/model-selection.d.ts +81 -0
  414. package/vendor/subagent-core/LICENSE +21 -0
  415. package/vendor/subagent-core/index.js +3202 -0
  416. package/vendor/subagent-core/invariant.js +76 -0
  417. package/vendor/subagent-core/typert.host.d.ts +3 -0
  418. package/vendor/subagent-core/typert.host.js +978 -0
  419. package/vendor/subagent-core/typert.remote-client.d.ts +25 -0
  420. package/vendor/subagent-core/typert.remote-client.js +114 -0
  421. package/vendor/subagent-core/types/archive-admission.d.ts +16 -0
  422. package/vendor/subagent-core/types/archive-admission.js +151 -0
  423. package/vendor/subagent-core/types/assistant-output.d.ts +48 -0
  424. package/vendor/subagent-core/types/assistant-output.js +73 -0
  425. package/vendor/subagent-core/types/catalog.d.ts +84 -0
  426. package/vendor/subagent-core/types/catalog.js +109 -0
  427. package/vendor/subagent-core/types/child-agent.d.ts +156 -0
  428. package/vendor/subagent-core/types/child-agent.js +213 -0
  429. package/vendor/subagent-core/types/client.d.ts +8 -0
  430. package/vendor/subagent-core/types/client.js +7 -0
  431. package/vendor/subagent-core/types/continuation-activation.d.ts +267 -0
  432. package/vendor/subagent-core/types/continuation-activation.js +700 -0
  433. package/vendor/subagent-core/types/continuation-messages.d.ts +62 -0
  434. package/vendor/subagent-core/types/continuation-messages.js +106 -0
  435. package/vendor/subagent-core/types/continuation.d.ts +124 -0
  436. package/vendor/subagent-core/types/continuation.js +455 -0
  437. package/vendor/subagent-core/types/control-types.d.ts +135 -0
  438. package/vendor/subagent-core/types/control-types.js +8 -0
  439. package/vendor/subagent-core/types/control.d.ts +45 -0
  440. package/vendor/subagent-core/types/control.js +79 -0
  441. package/vendor/subagent-core/types/depth.d.ts +31 -0
  442. package/vendor/subagent-core/types/depth.js +39 -0
  443. package/vendor/subagent-core/types/descriptor.d.ts +144 -0
  444. package/vendor/subagent-core/types/descriptor.js +193 -0
  445. package/vendor/subagent-core/types/error.d.ts +11 -0
  446. package/vendor/subagent-core/types/error.js +14 -0
  447. package/vendor/subagent-core/types/inbox.d.ts +43 -0
  448. package/vendor/subagent-core/types/inbox.js +61 -0
  449. package/vendor/subagent-core/types/index.d.ts +320 -0
  450. package/vendor/subagent-core/types/index.js +475 -0
  451. package/vendor/subagent-core/types/internal.d.ts +58 -0
  452. package/vendor/subagent-core/types/internal.js +58 -0
  453. package/vendor/subagent-core/types/invariant.d.ts +13 -0
  454. package/vendor/subagent-core/types/invariant.js +91 -0
  455. package/vendor/subagent-core/types/lifecycle.d.ts +113 -0
  456. package/vendor/subagent-core/types/lifecycle.js +180 -0
  457. package/vendor/subagent-core/types/list-children.d.ts +36 -0
  458. package/vendor/subagent-core/types/list-children.js +166 -0
  459. package/vendor/subagent-core/types/out-of-process.d.ts +118 -0
  460. package/vendor/subagent-core/types/out-of-process.js +219 -0
  461. package/vendor/subagent-core/types/projection-types.d.ts +82 -0
  462. package/vendor/subagent-core/types/projection-types.js +7 -0
  463. package/vendor/subagent-core/types/projection.d.ts +100 -0
  464. package/vendor/subagent-core/types/projection.js +157 -0
  465. package/vendor/subagent-core/types/run-settlement.d.ts +17 -0
  466. package/vendor/subagent-core/types/run-settlement.js +70 -0
  467. package/vendor/subagent-core/types/types.d.ts +377 -0
  468. package/vendor/subagent-core/types/types.js +19 -0
  469. package/vendor/subagent-driver/LICENSE +21 -0
  470. package/vendor/subagent-driver/index.js +255 -0
  471. package/vendor/subagent-driver/types/index.d.ts +33 -0
  472. package/vendor/subagent-driver/types/structured.d.ts +42 -0
  473. package/vendor/subagent-fork/LICENSE +21 -0
  474. package/vendor/subagent-fork/index.js +61 -0
  475. package/vendor/subagent-fork/types/index.d.ts +20 -0
  476. package/vendor/subagent-spawn/LICENSE +21 -0
  477. package/vendor/subagent-spawn/index.js +45 -0
  478. package/vendor/subagent-spawn/types/index.d.ts +19 -0
  479. package/vendor/terminal/LICENSE +21 -0
  480. package/vendor/terminal/index.js +1093 -0
  481. package/vendor/terminal/types/config.d.ts +82 -0
  482. package/vendor/terminal/types/index.d.ts +36 -0
  483. package/vendor/terminal/types/sanitize.d.ts +47 -0
  484. package/vendor/terminal/types/session.d.ts +87 -0
@@ -0,0 +1,153 @@
1
+ import AppKit
2
+ import CoreGraphics
3
+ import Darwin
4
+ import Foundation
5
+
6
+ private func argument(_ name: String, default fallback: Int) -> Int {
7
+ let values = ProcessInfo.processInfo.arguments
8
+ guard let index = values.firstIndex(of: name), values.indices.contains(index + 1),
9
+ let value = Int(values[index + 1]), value > 0 else { return fallback }
10
+ return value
11
+ }
12
+
13
+ private func stringArgument(_ name: String) -> String? {
14
+ let values = ProcessInfo.processInfo.arguments
15
+ guard let index = values.firstIndex(of: name), values.indices.contains(index + 1) else { return nil }
16
+ return values[index + 1]
17
+ }
18
+
19
+ private func optionalIntegerArgument(_ name: String) -> Int32? {
20
+ guard let value = stringArgument(name), let parsed = Int32(value), parsed > 0 else { return nil }
21
+ return parsed
22
+ }
23
+
24
+ private func cursorLocation() -> CGPoint {
25
+ CGEvent(source: nil)?.location ?? .zero
26
+ }
27
+
28
+ private func frontmostPid() -> pid_t? {
29
+ NSWorkspace.shared.frontmostApplication?.processIdentifier
30
+ }
31
+
32
+ private func matchingWindows(ownerPid: pid_t?, title: String?) -> [[String: Any]] {
33
+ guard let windows = CGWindowListCopyWindowInfo(
34
+ [.optionOnScreenOnly, .excludeDesktopElements],
35
+ kCGNullWindowID
36
+ ) as? [[String: Any]] else { return [] }
37
+ return windows.filter { window in
38
+ if let ownerPid,
39
+ (window[kCGWindowOwnerPID as String] as? NSNumber)?.int32Value != ownerPid { return false }
40
+ if let title,
41
+ (window[kCGWindowName as String] as? String) != title { return false }
42
+ return true
43
+ }
44
+ }
45
+
46
+ private let durationMs = argument("--duration-ms", default: 1200)
47
+ private let intervalMicros = useconds_t(argument("--interval-micros", default: 1000))
48
+ private let windowOwnerPid = stringArgument("--window-owner-pid").flatMap { Int32($0) }
49
+ private let windowTitle = stringArgument("--window-title")
50
+ private let monitoredSourcePid = optionalIntegerArgument("--source-pid")
51
+ private let baselineCursor = cursorLocation()
52
+ private let baselineFrontmostPid = frontmostPid()
53
+ private var maximumCursorDistance = 0.0
54
+ private var observedFrontmostPids = Set<Int32>()
55
+ private var maximumMatchingWindowCount = 0
56
+ private var matchingWindowFrames: [[String: Any]] = []
57
+ private var matchingWindowNumbers: [Int] = []
58
+ private var seenWindowFrames = Set<String>()
59
+ private var monitoredSourcePointerEvents = 0
60
+ private var pointerEventSourceCounts: [String: Int] = [:]
61
+ private var samples = 0
62
+
63
+ private let pointerMask = [
64
+ CGEventType.mouseMoved,
65
+ .leftMouseDown,
66
+ .leftMouseUp,
67
+ .leftMouseDragged,
68
+ .rightMouseDown,
69
+ .rightMouseUp,
70
+ .rightMouseDragged,
71
+ .otherMouseDown,
72
+ .otherMouseUp,
73
+ .otherMouseDragged,
74
+ .scrollWheel,
75
+ ].reduce(CGEventMask(0)) { mask, type in
76
+ mask | (CGEventMask(1) << type.rawValue)
77
+ }
78
+ private let eventTap = CGEvent.tapCreate(
79
+ tap: .cgSessionEventTap,
80
+ place: .headInsertEventTap,
81
+ options: .listenOnly,
82
+ eventsOfInterest: pointerMask,
83
+ callback: { _, _, event, _ in
84
+ let sourcePid = event.getIntegerValueField(.eventSourceUnixProcessID)
85
+ pointerEventSourceCounts[String(sourcePid), default: 0] += 1
86
+ if let monitoredSourcePid, sourcePid == Int64(monitoredSourcePid) {
87
+ monitoredSourcePointerEvents += 1
88
+ }
89
+ return Unmanaged.passUnretained(event)
90
+ },
91
+ userInfo: nil
92
+ )
93
+ private let eventTapSource = eventTap.map {
94
+ CFMachPortCreateRunLoopSource(kCFAllocatorDefault, $0, 0)
95
+ }
96
+
97
+ if let eventTap, let eventTapSource {
98
+ CFRunLoopAddSource(CFRunLoopGetCurrent(), eventTapSource, .defaultMode)
99
+ CGEvent.tapEnable(tap: eventTap, enable: true)
100
+ }
101
+
102
+ if let baselineFrontmostPid { observedFrontmostPids.insert(baselineFrontmostPid) }
103
+ FileHandle.standardOutput.write(Data("READY\n".utf8))
104
+
105
+ let deadline = DispatchTime.now().uptimeNanoseconds + UInt64(durationMs) * 1_000_000
106
+ while DispatchTime.now().uptimeNanoseconds < deadline {
107
+ let location = cursorLocation()
108
+ let distance = hypot(location.x - baselineCursor.x, location.y - baselineCursor.y)
109
+ maximumCursorDistance = max(maximumCursorDistance, distance)
110
+ if let pid = frontmostPid() { observedFrontmostPids.insert(pid) }
111
+ let windows = matchingWindows(ownerPid: windowOwnerPid, title: windowTitle)
112
+ maximumMatchingWindowCount = max(maximumMatchingWindowCount, windows.count)
113
+ if let first = windows.first,
114
+ let bounds = first[kCGWindowBounds as String] as? [String: Any] {
115
+ let frameKey = ["X", "Y", "Width", "Height"]
116
+ .map { String(describing: bounds[$0] ?? "") }
117
+ .joined(separator: ",")
118
+ if seenWindowFrames.insert(frameKey).inserted {
119
+ matchingWindowFrames.append(bounds)
120
+ }
121
+ if let number = (first[kCGWindowNumber as String] as? NSNumber)?.intValue,
122
+ !matchingWindowNumbers.contains(number) {
123
+ matchingWindowNumbers.append(number)
124
+ }
125
+ }
126
+ samples += 1
127
+ if eventTapSource != nil {
128
+ CFRunLoopRunInMode(.defaultMode, Double(intervalMicros) / 1_000_000, true)
129
+ } else {
130
+ usleep(intervalMicros)
131
+ }
132
+ }
133
+
134
+ let finalCursor = cursorLocation()
135
+ let finalFrontmostPid = frontmostPid()
136
+ let result: [String: Any] = [
137
+ "baselineCursor": ["x": baselineCursor.x, "y": baselineCursor.y],
138
+ "finalCursor": ["x": finalCursor.x, "y": finalCursor.y],
139
+ "maximumCursorDistance": maximumCursorDistance,
140
+ "baselineFrontmostPid": baselineFrontmostPid.map(Int.init) as Any,
141
+ "observedFrontmostPids": observedFrontmostPids.sorted().map(Int.init),
142
+ "finalFrontmostPid": finalFrontmostPid.map(Int.init) as Any,
143
+ "samples": samples,
144
+ "maximumMatchingWindowCount": maximumMatchingWindowCount,
145
+ "matchingWindowFrames": matchingWindowFrames,
146
+ "matchingWindowNumbers": matchingWindowNumbers,
147
+ "eventTapAvailable": eventTap != nil,
148
+ "monitoredSourcePointerEvents": monitoredSourcePointerEvents,
149
+ "pointerEventSourceCounts": pointerEventSourceCounts,
150
+ ]
151
+ let data = try JSONSerialization.data(withJSONObject: result, options: [.sortedKeys])
152
+ FileHandle.standardOutput.write(data)
153
+ FileHandle.standardOutput.write(Data("\n".utf8))
@@ -0,0 +1,14 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "helperVersion": "0.3.3",
4
+ "sourceSha256": "b5de65a33e53689c5b490d8f6641a6577ba61a6f6f45798210b0df65bd0ced07",
5
+ "binary": {
6
+ "path": "bin/dsh-computer-use-helper",
7
+ "sha256": "55325e0008d755bf2b1d408bcfd5cdb80842ec2a0fa5312da6961eb65d7d6dd3",
8
+ "architectures": [
9
+ "arm64",
10
+ "x86_64"
11
+ ],
12
+ "minimumMacOS": "14.0"
13
+ }
14
+ }
@@ -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,411 @@
1
+ // dscode-shell-capture-v1
2
+ // dscode-stdin-stall-v2
3
+ const STDIN_STALL_MS = 5000;
4
+ const STDIN_STALL_NOTE = "\n[Interrupted after 5s with no output: the command held the terminal without producing anything, and this tool cannot supply terminal input. Give it stdin (a heredoc, `< file` or `< /dev/null`) or use a non-interactive form.]";
5
+ // dscode-shell-reset-v1
6
+ import { randomUUID } from "node:crypto";
7
+ import z from "@deepseek-ai/schemastery";
8
+ import { truncateWithoutSplittingSurrogatePair } from "@deepseek-ai/dsh-output-retention";
9
+ import { deadline, timeoutOf } from "@deepseek-ai/dsh-timeout";
10
+ import { defineTool } from "@deepseek-ai/dsh-tools";
11
+ //#region lib/types/index.js
12
+ /**
13
+ * Model-facing persistent `bash` tool over the owner-scoped PTY seam.
14
+ * @module @deepseek-ai/dsh-tool-bash-persistent
15
+ */
16
+ var __addDisposableResource = function(env, value, async) {
17
+ if (value !== null && value !== void 0) {
18
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
19
+ var dispose, inner;
20
+ if (async) {
21
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
22
+ dispose = value[Symbol.asyncDispose];
23
+ }
24
+ if (dispose === void 0) {
25
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
26
+ dispose = value[Symbol.dispose];
27
+ if (async) inner = dispose;
28
+ }
29
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
30
+ if (inner) dispose = function() {
31
+ try {
32
+ inner.call(this);
33
+ } catch (e) {
34
+ return Promise.reject(e);
35
+ }
36
+ };
37
+ env.stack.push({
38
+ value,
39
+ dispose,
40
+ async
41
+ });
42
+ } else if (async) env.stack.push({ async: true });
43
+ return value;
44
+ };
45
+ var __disposeResources = (function(SuppressedError) {
46
+ return function(env) {
47
+ function fail(e) {
48
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
49
+ env.hasError = true;
50
+ }
51
+ var r, s = 0;
52
+ function next() {
53
+ while (r = env.stack.pop()) try {
54
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
55
+ if (r.dispose) {
56
+ var result = r.dispose.call(r.value);
57
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
58
+ fail(e);
59
+ return next();
60
+ });
61
+ } else s |= 1;
62
+ } catch (e) {
63
+ fail(e);
64
+ }
65
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
66
+ if (env.hasError) throw env.error;
67
+ }
68
+ return next();
69
+ };
70
+ })(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
71
+ var e = new Error(message);
72
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
73
+ });
74
+ const TRUNCATED_MESSAGE = "<response clipped><NOTE>To save on context only part of this file has been shown to you. You should retry this tool after you have searched inside the file with `grep -n` in order to find the line numbers of what you are looking for.</NOTE>";
75
+ const LOST_PREFIX_MESSAGE = "<response clipped><NOTE>The beginning of this command output was dropped by the terminal scrollback limit. The following text is the earliest retained output.</NOTE>\n";
76
+ const SHELL_RESET_MESSAGE = "The persistent bash shell was reset; the next bash call starts from the workspace with a fresh current directory and environment.";
77
+ const TIMEOUT_STATUS_MARKER = "[Command timed out or OOM]";
78
+ const TIMEOUT_CODE = "PERSISTENT_BASH_TIMEOUT";
79
+ const SCROLLBACK_PAGE_LINES = 1e3;
80
+ const POLL_INTERVAL_MS = 25;
81
+ const DEFAULT_DESCRIPTION = "Run commands in a persistent bash shell. State, including the current directory and exported environment variables, persists across calls for this agent.";
82
+ function maybeTruncate(content, maxOutputChars, incomplete = false) {
83
+ if (content.length <= maxOutputChars && !incomplete) return content;
84
+ return content.length <= maxOutputChars ? content + TRUNCATED_MESSAGE : truncateWithoutSplittingSurrogatePair(content, maxOutputChars) + TRUNCATED_MESSAGE;
85
+ }
86
+ function markers() {
87
+ const nonce = randomUUID();
88
+ return {
89
+ start: `__DSH_PERSISTENT_BASH_START_${nonce}__`,
90
+ end: `__DSH_PERSISTENT_BASH_END_${nonce}:`
91
+ };
92
+ }
93
+ function quoteForBash(value) {
94
+ return `$'${value.replaceAll("\\", "\\\\").replaceAll("'", "\\'").replaceAll("\r", "\\r").replaceAll("\n", "\\n")}'`;
95
+ }
96
+ function wrapCommand(command, marker) {
97
+ return `printf '%s\\n' ${quoteForBash(marker.start)}; eval -- ${quoteForBash(command)}; __dsh_persistent_bash_status=$?; printf '%s%s\\n' ${quoteForBash(marker.end)} "$__dsh_persistent_bash_status"`;
98
+ }
99
+ function trimTrailingNewline(text) {
100
+ return text.replace(/(?:\r?\n)+$/, "");
101
+ }
102
+ function commandOutput(snapshot, marker) {
103
+ const text = snapshot.text;
104
+ const end = text.lastIndexOf(marker.end);
105
+ const status = /^(\d+)\r?\n/.exec(text.slice(end + marker.end.length))?.[1];
106
+ if (status === void 0) return void 0;
107
+ const startMarker = text.lastIndexOf(marker.start, end);
108
+ const start = startMarker < 0 ? 0 : startMarker + marker.start.length;
109
+ return {
110
+ text: trimTrailingNewline(text.slice(start, end).replace(/^\r?\n/, "")),
111
+ incomplete: startMarker < 0,
112
+ exitCode: Number(status)
113
+ };
114
+ }
115
+ function partialOutput(snapshot, marker, fallback, fallbackTruncated = false) {
116
+ const startMarker = snapshot.text.lastIndexOf(marker.start);
117
+ if (startMarker >= 0) return {
118
+ text: trimTrailingNewline(snapshot.text.slice(startMarker + marker.start.length).replace(/^\r?\n/, "")),
119
+ incomplete: false
120
+ };
121
+ const fallbackStart = fallback.lastIndexOf(marker.start);
122
+ const afterStart = fallbackStart < 0 ? fallback : fallback.slice(fallbackStart + marker.start.length).replace(/^\r?\n/, "");
123
+ const fallbackEnd = afterStart.lastIndexOf(marker.end);
124
+ return {
125
+ text: trimTrailingNewline(fallbackEnd < 0 ? afterStart : afterStart.slice(0, fallbackEnd)),
126
+ incomplete: fallbackTruncated || fallbackStart < 0
127
+ };
128
+ }
129
+ async function pause() {
130
+ await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
131
+ }
132
+ function nextScrollbackOffset(page, offset) {
133
+ if (page.text.length === 0 || page.lineEnd <= offset) return void 0;
134
+ return page.lineEnd;
135
+ }
136
+ function retainedScrollback(ctx, owner, id, latest = ctx.terminals.read(owner, id, {
137
+ offset: 0,
138
+ count: SCROLLBACK_PAGE_LINES
139
+ })) {
140
+ const pages = latest.text.length === 0 ? [] : [latest.text];
141
+ let offset = latest.lineEnd;
142
+ let truncated = latest.truncated;
143
+ while (true) {
144
+ if (offset >= latest.totalLines) break;
145
+ const page = ctx.terminals.read(owner, id, {
146
+ offset,
147
+ count: SCROLLBACK_PAGE_LINES
148
+ });
149
+ truncated ||= page.truncated;
150
+ if (page.text.length > 0) pages.unshift(page.text);
151
+ const next = nextScrollbackOffset(page, offset);
152
+ if (next === void 0 || next >= page.totalLines) break;
153
+ offset = next;
154
+ }
155
+ return {
156
+ text: pages.join("\n"),
157
+ truncated
158
+ };
159
+ }
160
+ function renderCaptured(output, maxOutputChars) {
161
+ const rendered = maybeTruncate(output.text, maxOutputChars, output.incomplete);
162
+ return appendStatusMarker(output.incomplete && output.text.length > 0 ? LOST_PREFIX_MESSAGE + rendered : rendered, output.exitCode !== void 0 ? `[Command finished with exit code ${output.exitCode}]` : void 0);
163
+ }
164
+ function appendStatusMarker(content, marker) {
165
+ if (marker === void 0) return content;
166
+ return content.length === 0 ? marker : `${content}\n${marker}`;
167
+ }
168
+ function renderShellExitStatus(content, exitCode, signal) {
169
+ return appendStatusMarker(content, signal !== null ? `[shell killed by signal: ${signal}]` : exitCode !== null ? `[shell exited: code ${exitCode}]` : "[shell exited]");
170
+ }
171
+ /**
172
+ * Render the exited-session result, reset the owner's shell, and reset the
173
+ * message that tells the model the next call starts fresh.
174
+ * @param shells - the owner-scoped registry to reset.
175
+ * @param status - the exited session status (exit code and signal).
176
+ * @returns the complete model-facing result.
177
+ */
178
+ async function respondToSessionExit(ctx, shells, owner, id, status, marker, fallback, fallbackTruncated, config) {
179
+ const window = ctx.terminals.read(owner, id, { capture: true });
180
+ const snapshot = window.text.length > 0 ? window : retainedScrollback(ctx, owner, id);
181
+ await shells.reset(owner, "persistent bash shell exited");
182
+ return [renderShellExitStatus(renderCaptured(partialOutput(snapshot, marker, fallback, fallbackTruncated), config.maxOutputChars), status.exitCode, status.signal), SHELL_RESET_MESSAGE].filter((part) => part.length > 0).join("\n");
183
+ }
184
+ function persistentShells(ctx, config) {
185
+ const pending = /* @__PURE__ */ new WeakMap();
186
+ const live = /* @__PURE__ */ new Map();
187
+ const creating = /* @__PURE__ */ new Set();
188
+ const ownerCleanupInstalled = /* @__PURE__ */ new WeakSet();
189
+ const lifecycle = new AbortController();
190
+ const close = async (owner, id, reason) => {
191
+ if (!ctx.terminals.list(owner).some((snapshot) => snapshot.sessionId === id)) return;
192
+ await ctx.terminals.kill(owner, id, reason);
193
+ };
194
+ ctx.effect(() => async () => {
195
+ lifecycle.abort(/* @__PURE__ */ new Error("tool-bash-persistent disposed during shell creation"));
196
+ await Promise.allSettled([...creating]);
197
+ const closing = [...live].map(async ([owner, id]) => {
198
+ await close(owner, id, "tool-bash-persistent disposed");
199
+ });
200
+ await Promise.all(closing);
201
+ live.clear();
202
+ }, "tool-bash-persistent shell cleanup");
203
+ const reset = async (owner, reason) => {
204
+ pending.delete(owner);
205
+ const id = live.get(owner);
206
+ live.delete(owner);
207
+ if (id !== void 0) await close(owner, id, reason);
208
+ };
209
+ const get = (owner, signal) => {
210
+ const liveId = live.get(owner);
211
+ if (liveId !== undefined && !ctx.terminals.list(owner).some(s => s.sessionId === liveId && s.status.kind !== "exited")) { pending.delete(owner); live.delete(owner); }
212
+ const existing = pending.get(owner);
213
+ if (existing !== void 0) return existing;
214
+ const combinedSignal = AbortSignal.any([signal, lifecycle.signal]);
215
+ const tracked = (async () => {
216
+ try {
217
+ const cwd = owner.session.header.cwd;
218
+ const spawned = await ctx.terminals.spawn(owner, {
219
+ type: config.backendType,
220
+ ...cwd === void 0 ? {} : { cwd }
221
+ }, combinedSignal);
222
+ live.set(owner, spawned.sessionId);
223
+ if (!ownerCleanupInstalled.has(owner)) {
224
+ ownerCleanupInstalled.add(owner);
225
+ owner.ctx.effect(() => () => {
226
+ pending.delete(owner);
227
+ live.delete(owner);
228
+ }, "tool-bash-persistent owner cache cleanup");
229
+ }
230
+ const result = await ctx.terminals.startSend(owner, spawned.sessionId, {
231
+ text: "stty -echo",
232
+ submit: true,
233
+ signal: combinedSignal
234
+ }).done;
235
+ if (result.sessionStatus.kind === "exited" || result.waitReason === "timeout") throw new Error("persistent bash shell did not accept initialization");
236
+ return spawned.sessionId;
237
+ } catch (error) {
238
+ await reset(owner, "persistent bash initialization failed");
239
+ throw error;
240
+ }
241
+ })().finally(() => {
242
+ creating.delete(tracked);
243
+ });
244
+ creating.add(tracked);
245
+ pending.set(owner, tracked);
246
+ return tracked;
247
+ };
248
+ return {
249
+ get,
250
+ reset
251
+ };
252
+ }
253
+ async function executeCommand(ctx, shells, owner, command, config, upstream) {
254
+ const env_1 = {
255
+ stack: [],
256
+ error: void 0,
257
+ hasError: false
258
+ };
259
+ try {
260
+ const commandDeadline = __addDisposableResource(env_1, deadline(upstream, config.timeoutMs, TIMEOUT_CODE), false);
261
+ let id;
262
+ try {
263
+ id = await shells.get(owner, commandDeadline.signal);
264
+ } catch (error) {
265
+ if (upstream.aborted && error === upstream.reason) return "";
266
+ throw error;
267
+ }
268
+ const marker = markers();
269
+ const wrapped = wrapCommand(command, marker);
270
+ const startedAt = Date.now();
271
+ let stdinWaited = false;
272
+ let stdinStalled = false;
273
+ let first = true;
274
+ let fallback = "";
275
+ let fallbackTruncated = false;
276
+ while (true) {
277
+ const status = ctx.terminals.list(owner).find((session) => session.sessionId === id)?.status;
278
+ if (status?.kind === "exited") return await respondToSessionExit(ctx, shells, owner, id, status, marker, fallback, fallbackTruncated, config);
279
+ let operation;
280
+ let result;
281
+ try {
282
+ operation = ctx.terminals.startSend(owner, id, {
283
+ text: first ? wrapped : "",
284
+ capture: first,
285
+ submit: first,
286
+ signal: commandDeadline.signal
287
+ });
288
+ first = false;
289
+ result = await operation.done;
290
+ } catch (error) {
291
+ await shells.reset(owner, "persistent bash send failed");
292
+ throw error;
293
+ }
294
+ const incremental = operation.readOutput();
295
+ fallback = incremental.delta.length > 0 ? fallback + incremental.delta : result.viewport;
296
+ fallbackTruncated ||= incremental.truncated || result.truncated;
297
+ const captured = ctx.terminals.read(owner, id, { capture: true });
298
+ fallbackTruncated ||= captured.truncated;
299
+ const timedOut = timeoutOf(commandDeadline.signal, TIMEOUT_CODE);
300
+ if (timedOut !== void 0) {
301
+ const partial = renderCaptured(partialOutput(captured, marker, fallback, fallbackTruncated), config.maxOutputChars);
302
+ await shells.reset(owner, "persistent bash command timed out");
303
+ return [
304
+ `Your command timed out after ${Math.round(timedOut.timeoutMs / 1e3)} seconds or experienced an OOM error. Below is partial output:`,
305
+ appendStatusMarker(partial, TIMEOUT_STATUS_MARKER),
306
+ SHELL_RESET_MESSAGE
307
+ ].join("\n");
308
+ }
309
+ if (commandDeadline.signal.aborted) {
310
+ await shells.reset(owner, "persistent bash command aborted");
311
+ return "";
312
+ }
313
+ if (captured.text.includes(marker.end)) {
314
+ const complete = commandOutput(captured, marker);
315
+ if (complete !== void 0) return renderCaptured(complete, config.maxOutputChars) + (stdinStalled ? STDIN_STALL_NOTE : "");
316
+ }
317
+ if (result.sessionStatus.kind === "exited") return await respondToSessionExit(ctx, shells, owner, id, result.sessionStatus, marker, fallback, fallbackTruncated, config);
318
+ const partial = renderCaptured(partialOutput(captured, marker, fallback, fallbackTruncated), config.maxOutputChars);
319
+ if (result.waitReason === "stdin_read") stdinWaited = true;
320
+ if (result.waitReason === "stdin_read" && partial.length > 0) return partial;
321
+ if (stdinWaited && partial.length === 0 && !stdinStalled && Date.now() - startedAt >= STDIN_STALL_MS) {
322
+ stdinStalled = true;
323
+ try {
324
+ await ctx.terminals.signal(owner, id, "SIGINT");
325
+ } catch (_unsignallableForeground) {
326
+ stdinStalled = false;
327
+ return partial;
328
+ }
329
+ }
330
+ await pause();
331
+ }
332
+ } catch (e_1) {
333
+ env_1.error = e_1;
334
+ env_1.hasError = true;
335
+ } finally {
336
+ __disposeResources(env_1);
337
+ }
338
+ }
339
+ /**
340
+ * Register the model-facing persistent `bash` tool.
341
+ * @param ctx - plugin context carrying tools and the owner-scoped PTY service.
342
+ * @param config - selected PTY backend and command deadline.
343
+ */
344
+ function registerPersistentBash(ctx, config) {
345
+ const shells = persistentShells(ctx, config);
346
+ const queues = /* @__PURE__ */ new WeakMap();
347
+ const serialized = async (owner, operation) => {
348
+ const run = (queues.get(owner) ?? Promise.resolve()).then(operation, operation);
349
+ const tail = run.then(() => void 0, () => void 0);
350
+ queues.set(owner, tail);
351
+ try {
352
+ return await run;
353
+ } finally {
354
+ if (queues.get(owner) === tail) queues.delete(owner);
355
+ }
356
+ };
357
+ ctx.tools.register(defineTool({
358
+ name: "bash",
359
+ description: config.description,
360
+ parameters: { command: {
361
+ type: "string",
362
+ required: true,
363
+ description: "The bash command to run. Relative path is preferred in the command."
364
+ } },
365
+ output: {
366
+ schema: { type: "string" },
367
+ render: (_args, value) => [{
368
+ type: "text",
369
+ text: value
370
+ }]
371
+ },
372
+ async execute(args, exec) {
373
+ if (args.command.trim().length === 0) throw new Error("command must be a non-empty string");
374
+ const owner = exec.agent;
375
+ if (owner === void 0) throw new Error("bash requires an owning agent session");
376
+ return serialized(owner, async () => {
377
+ if (exec.signal.aborted) return "";
378
+ return executeCommand(ctx, shells, owner, args.command, config, exec.signal);
379
+ });
380
+ },
381
+ presentCall: (args) => ({
382
+ card: "terminal",
383
+ title: args.command
384
+ })
385
+ }));
386
+ }
387
+ const name = "tool-bash-persistent";
388
+ const inject = ["tools", "terminals"];
389
+ /** Runtime configuration schema for the persistent Bash tool. */
390
+ const Config = z.object({
391
+ backendType: z.string().default("shell"),
392
+ timeoutMs: z.number().default(3e5),
393
+ maxOutputChars: z.number().default(16e3),
394
+ description: z.string().default(DEFAULT_DESCRIPTION)
395
+ });
396
+ /** Register one owner-scoped persistent `bash` tool. */
397
+ function apply(ctx, config) {
398
+ const resolved = {
399
+ backendType: config.backendType ?? "shell",
400
+ timeoutMs: config.timeoutMs ?? 3e5,
401
+ maxOutputChars: config.maxOutputChars ?? 16e3,
402
+ description: config.description ?? DEFAULT_DESCRIPTION
403
+ };
404
+ if (resolved.backendType.trim().length === 0) throw new Error("tool-bash-persistent: backendType must be non-empty");
405
+ if (!Number.isSafeInteger(resolved.timeoutMs) || resolved.timeoutMs <= 0) throw new Error("tool-bash-persistent: timeoutMs must be a positive safe integer");
406
+ if (!Number.isSafeInteger(resolved.maxOutputChars) || resolved.maxOutputChars <= 0) throw new Error("tool-bash-persistent: maxOutputChars must be a positive safe integer");
407
+ if (resolved.description.trim().length === 0) throw new Error("tool-bash-persistent: description must be non-empty");
408
+ registerPersistentBash(ctx, resolved);
409
+ }
410
+ //#endregion
411
+ export { Config, apply, inject, name };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Model-facing persistent `bash` tool over the owner-scoped PTY seam.
3
+ * @module @deepseek-ai/dsh-tool-bash-persistent
4
+ */
5
+ import type { Context } from '@deepseek-ai/cordis';
6
+ import z from '@deepseek-ai/schemastery';
7
+ export declare const name = "tool-bash-persistent";
8
+ export declare const inject: string[];
9
+ /** Configuration for the persistent Bash tool. */
10
+ export interface Config {
11
+ /** PTY backend used for each owner-isolated persistent shell (default `shell`). */
12
+ backendType?: string;
13
+ /** Wall-clock limit for one command (default 300000). */
14
+ timeoutMs?: number;
15
+ /** Maximum returned command-output characters before clipping (default 16000). */
16
+ maxOutputChars?: number;
17
+ /** Model-facing tool description; deployments may describe their environment. */
18
+ description?: string;
19
+ }
20
+ /** Runtime configuration schema for the persistent Bash tool. */
21
+ export declare const Config: z<Config>;
22
+ /** Register one owner-scoped persistent `bash` tool. */
23
+ export declare function apply(ctx: Context, config: Config): void;
24
+ //# sourceMappingURL=index.d.ts.map
@@ -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.