@songtonyli/dsh-cli 0.1.31 → 0.1.32

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 (1814) hide show
  1. package/README.md +1 -1
  2. package/bin/dsh.mjs +1 -1
  3. package/node_modules/@deepseek-ai/cordis/README.md +4 -0
  4. package/node_modules/@deepseek-ai/cordis/package.json +4 -4
  5. package/node_modules/@deepseek-ai/cordis/src/index.ts +2 -0
  6. package/node_modules/@deepseek-ai/cordis-plugin-group/package.json +3 -3
  7. package/node_modules/@deepseek-ai/cordis-plugin-include/package.json +4 -4
  8. package/node_modules/@deepseek-ai/cordis-plugin-loader/README.md +4 -0
  9. package/node_modules/@deepseek-ai/cordis-plugin-loader/lib/index.js +87 -7
  10. package/node_modules/@deepseek-ai/cordis-plugin-loader/package.json +4 -3
  11. package/node_modules/@deepseek-ai/cordis-plugin-loader/src/config/diff.ts +45 -0
  12. package/node_modules/@deepseek-ai/cordis-plugin-loader/src/config/entry.ts +53 -7
  13. package/node_modules/@deepseek-ai/cordis-plugin-loader/src/index.ts +13 -1
  14. package/node_modules/@deepseek-ai/cordis-plugin-timer/package.json +3 -3
  15. package/node_modules/@deepseek-ai/cosmokit/README.md +6 -0
  16. package/node_modules/@deepseek-ai/cosmokit/lib/index.js +112 -19
  17. package/node_modules/@deepseek-ai/cosmokit/package.json +1 -1
  18. package/node_modules/@deepseek-ai/cosmokit/src/index.ts +2 -0
  19. package/node_modules/@deepseek-ai/cosmokit/src/types.ts +49 -23
  20. package/node_modules/@deepseek-ai/cosmokit/src/volatile.ts +86 -0
  21. package/node_modules/@deepseek-ai/dsh/README.i18n.yaml +2 -2
  22. package/node_modules/@deepseek-ai/dsh/README.md +1 -1
  23. package/node_modules/@deepseek-ai/dsh/README.zh.md +1 -1
  24. package/node_modules/@deepseek-ai/dsh/lib/bin.js +21 -5
  25. package/node_modules/@deepseek-ai/dsh/lib/{dump-config-Bb5YvFIX.js → dump-config-C-0P1h0W.js} +14 -3
  26. package/node_modules/@deepseek-ai/dsh/lib/dump-config-DaAE0NHG.js +2 -0
  27. package/node_modules/@deepseek-ai/dsh/lib/dump-config-schema-BgEU7VYz.js +41 -0
  28. package/node_modules/@deepseek-ai/dsh/lib/{plugin-DJ-rVHUS.js → plugin-CnNK4cws.js} +1 -1
  29. package/node_modules/@deepseek-ai/dsh/lib/{profile-boot-BNu17Y9U.js → profile-boot-DIiro1p-.js} +8 -15
  30. package/node_modules/@deepseek-ai/dsh/lib/profile-boot.js +1 -1
  31. package/node_modules/@deepseek-ai/dsh/package.json +113 -119
  32. package/node_modules/@deepseek-ai/dsh-acp/lib/index.js +7 -6
  33. package/node_modules/@deepseek-ai/dsh-acp/package.json +25 -25
  34. package/node_modules/@deepseek-ai/dsh-acp-app/package.json +6 -6
  35. package/node_modules/@deepseek-ai/dsh-agent/README.i18n.yaml +2 -2
  36. package/node_modules/@deepseek-ai/dsh-agent/README.md +3 -0
  37. package/node_modules/@deepseek-ai/dsh-agent/README.zh.md +3 -0
  38. package/node_modules/@deepseek-ai/dsh-agent/lib/index.js +40 -6
  39. package/node_modules/@deepseek-ai/dsh-agent/lib/types/archive-admission.js +35 -0
  40. package/node_modules/@deepseek-ai/dsh-agent/lib/types/consumed-work.js +5 -4
  41. package/node_modules/@deepseek-ai/dsh-agent/lib/types/index.js +4 -0
  42. package/node_modules/@deepseek-ai/dsh-agent/lib/types/model-selection.js +1 -2
  43. package/node_modules/@deepseek-ai/dsh-agent/package.json +27 -20
  44. package/node_modules/@deepseek-ai/dsh-agent-default-model/README.i18n.yaml +2 -2
  45. package/node_modules/@deepseek-ai/dsh-agent-default-model/README.md +9 -9
  46. package/node_modules/@deepseek-ai/dsh-agent-default-model/README.zh.md +9 -9
  47. package/node_modules/@deepseek-ai/dsh-agent-default-model/lib/index.js +26 -39
  48. package/node_modules/@deepseek-ai/dsh-agent-default-model/package.json +10 -10
  49. package/node_modules/@deepseek-ai/dsh-agent-instructions/lib/index.js +3 -2
  50. package/node_modules/@deepseek-ai/dsh-agent-instructions/package.json +25 -25
  51. package/node_modules/@deepseek-ai/dsh-agent-loop/README.i18n.yaml +2 -2
  52. package/node_modules/@deepseek-ai/dsh-agent-loop/README.md +3 -1
  53. package/node_modules/@deepseek-ai/dsh-agent-loop/README.zh.md +3 -1
  54. package/node_modules/@deepseek-ai/dsh-agent-loop/lib/index.js +39 -49
  55. package/node_modules/@deepseek-ai/dsh-agent-loop/package.json +26 -28
  56. package/node_modules/@deepseek-ai/{dsh-agent-presets → dsh-agent-preset}/README.i18n.yaml +3 -3
  57. package/node_modules/@deepseek-ai/dsh-agent-preset/README.md +94 -0
  58. package/node_modules/@deepseek-ai/dsh-agent-preset/README.zh.md +94 -0
  59. package/node_modules/@deepseek-ai/dsh-agent-preset/lib/index.js +29 -0
  60. package/node_modules/@deepseek-ai/dsh-agent-preset/package.json +49 -0
  61. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-composition-reference/SKILL.md +29 -0
  62. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-composition-reference/references/packages.md +506 -0
  63. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/SKILL.md +38 -0
  64. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/references/host-plugin.md +60 -0
  65. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/references/mcp-bundle.md +5 -0
  66. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/references/ui-plugin.md +13 -0
  67. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/references/verification.md +5 -0
  68. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/templates/decoration/client.js +22 -0
  69. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/templates/decoration/cordis.patch.yml +3 -0
  70. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/templates/decoration/index.js +2 -0
  71. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/templates/decoration/package.json +15 -0
  72. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/templates/mcp/cordis.patch.yml +8 -0
  73. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-plugin-development/templates/mcp/package.json +7 -0
  74. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/editing-cordis-compositions/SKILL.md +84 -0
  75. package/node_modules/@deepseek-ai/{dsh-api-authorization-controller → dsh-agent-preset-registry}/README.i18n.yaml +3 -3
  76. package/node_modules/@deepseek-ai/dsh-agent-preset-registry/README.md +107 -0
  77. package/node_modules/@deepseek-ai/dsh-agent-preset-registry/README.zh.md +107 -0
  78. package/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/index.js +781 -0
  79. package/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/invariant.js +806 -0
  80. package/node_modules/@deepseek-ai/{dsh-agent-presets → dsh-agent-preset-registry}/lib/typert.host.js +118 -270
  81. package/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/typert.remote-client.js +84 -0
  82. package/node_modules/@deepseek-ai/{dsh-agent-presets → dsh-agent-preset-registry}/lib/types/composition-inventory.js +9 -36
  83. package/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/types/definition.js +29 -0
  84. package/node_modules/@deepseek-ai/{dsh-agent-presets → dsh-agent-preset-registry}/lib/types/display.js +12 -3
  85. package/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/types/index.js +371 -0
  86. package/node_modules/@deepseek-ai/{dsh-agent-presets → dsh-agent-preset-registry}/lib/types/invariant.js +7 -19
  87. package/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/types/mount.js +243 -0
  88. package/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/types/preset.js +2 -0
  89. package/node_modules/@deepseek-ai/{dsh-agent-presets → dsh-agent-preset-registry}/lib/types/session.js +1 -1
  90. package/node_modules/@deepseek-ai/dsh-agent-preset-registry/package.json +96 -0
  91. package/node_modules/@deepseek-ai/dsh-agent-tool-presentation/README.i18n.yaml +2 -2
  92. package/node_modules/@deepseek-ai/dsh-agent-tool-presentation/README.md +3 -3
  93. package/node_modules/@deepseek-ai/dsh-agent-tool-presentation/README.zh.md +3 -3
  94. package/node_modules/@deepseek-ai/dsh-agent-tool-presentation/package.json +11 -11
  95. package/node_modules/@deepseek-ai/dsh-anonymous-user-id/package.json +7 -7
  96. package/node_modules/@deepseek-ai/{dsh-settings-file → dsh-api-account-controller}/README.i18n.yaml +3 -3
  97. package/node_modules/@deepseek-ai/dsh-api-account-controller/README.md +53 -0
  98. package/node_modules/@deepseek-ai/dsh-api-account-controller/README.zh.md +53 -0
  99. package/node_modules/@deepseek-ai/dsh-api-account-controller/lib/index.js +209 -0
  100. package/node_modules/@deepseek-ai/dsh-api-account-controller/lib/typert.host.js +273 -0
  101. package/node_modules/@deepseek-ai/dsh-api-account-controller/lib/typert.remote-client.js +267 -0
  102. package/node_modules/@deepseek-ai/dsh-api-account-controller/lib/types/index.js +116 -0
  103. package/node_modules/@deepseek-ai/dsh-api-account-controller/lib/types/types.js +2 -0
  104. package/node_modules/@deepseek-ai/{dsh-api-authorization-controller → dsh-api-account-controller}/package.json +13 -20
  105. package/node_modules/@deepseek-ai/dsh-api-gateway/README.i18n.yaml +2 -2
  106. package/node_modules/@deepseek-ai/dsh-api-gateway/README.md +9 -4
  107. package/node_modules/@deepseek-ai/dsh-api-gateway/README.zh.md +9 -4
  108. package/node_modules/@deepseek-ai/dsh-api-gateway/lib/client.js +294 -51
  109. package/node_modules/@deepseek-ai/dsh-api-gateway/lib/index.js +516 -92
  110. package/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/client/index.js +104 -14
  111. package/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/client/remote-events.js +2 -2
  112. package/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/client/stream-client.js +164 -11
  113. package/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/index.js +322 -33
  114. package/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/stream-protocol.js +10 -46
  115. package/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/stream-server.js +210 -23
  116. package/node_modules/@deepseek-ai/dsh-api-gateway/package.json +18 -13
  117. package/node_modules/@deepseek-ai/{dsh-llm-cursor → dsh-api-job-controller}/README.i18n.yaml +3 -3
  118. package/node_modules/@deepseek-ai/dsh-api-job-controller/README.md +69 -0
  119. package/node_modules/@deepseek-ai/dsh-api-job-controller/README.zh.md +69 -0
  120. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/client.js +367 -0
  121. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/index.js +377 -0
  122. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/typert.host.js +273 -0
  123. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/typert.remote-client.js +181 -0
  124. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/types/client/index.js +23 -0
  125. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/types/client/model.js +164 -0
  126. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/types/client/service.js +182 -0
  127. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/types/index.js +150 -0
  128. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/types/observe.js +107 -0
  129. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/types/rows.js +43 -0
  130. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/types/types.js +8 -0
  131. package/node_modules/@deepseek-ai/dsh-api-job-controller/lib/types/wake.js +59 -0
  132. package/node_modules/@deepseek-ai/dsh-api-job-controller/package.json +82 -0
  133. package/node_modules/@deepseek-ai/dsh-api-remotes/README.i18n.yaml +2 -2
  134. package/node_modules/@deepseek-ai/dsh-api-remotes/README.md +2 -0
  135. package/node_modules/@deepseek-ai/dsh-api-remotes/README.zh.md +2 -0
  136. package/node_modules/@deepseek-ai/dsh-api-remotes/lib/client.js +1751 -1017
  137. package/node_modules/@deepseek-ai/dsh-api-remotes/lib/types/client/index.js +7 -3
  138. package/node_modules/@deepseek-ai/dsh-api-remotes/package.json +40 -39
  139. package/node_modules/@deepseek-ai/dsh-api-session-controller/README.i18n.yaml +2 -2
  140. package/node_modules/@deepseek-ai/dsh-api-session-controller/README.md +31 -8
  141. package/node_modules/@deepseek-ai/dsh-api-session-controller/README.zh.md +31 -8
  142. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/client.js +603 -515
  143. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/index.js +299 -137
  144. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.host.js +373 -183
  145. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.remote-client.js +216 -124
  146. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/archived-session-gate.js +52 -0
  147. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/lineage.js +2 -1
  148. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/manager.js +249 -277
  149. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/projection-store.js +45 -13
  150. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/service.js +35 -47
  151. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/session.js +112 -50
  152. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/commands.js +72 -36
  153. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/control.js +2 -44
  154. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/history.js +1 -1
  155. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/index.js +117 -13
  156. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/list.js +24 -15
  157. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/skill-catalog.js +60 -50
  158. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/types.js +0 -1
  159. package/node_modules/@deepseek-ai/dsh-api-session-controller/package.json +68 -72
  160. package/node_modules/@deepseek-ai/dsh-api-settings-controller/README.i18n.yaml +2 -2
  161. package/node_modules/@deepseek-ai/dsh-api-settings-controller/README.md +1 -2
  162. package/node_modules/@deepseek-ai/dsh-api-settings-controller/README.zh.md +1 -2
  163. package/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/index.js +6 -78
  164. package/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/typert.host.js +33 -99
  165. package/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/typert.remote-client.js +32 -80
  166. package/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/types/index.js +6 -61
  167. package/node_modules/@deepseek-ai/dsh-api-settings-controller/package.json +16 -16
  168. package/node_modules/@deepseek-ai/dsh-api-terminal-controller/lib/typert.host.js +50 -22
  169. package/node_modules/@deepseek-ai/dsh-api-terminal-controller/lib/typert.remote-client.js +4 -4
  170. package/node_modules/@deepseek-ai/dsh-api-terminal-controller/package.json +20 -19
  171. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/README.i18n.yaml +2 -2
  172. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/README.md +16 -2
  173. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/README.zh.md +16 -2
  174. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/client.js +98 -6
  175. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/index.js +202 -15
  176. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/typert.host.js +161 -11
  177. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/typert.remote-client.js +121 -8
  178. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/client/index.js +4 -1
  179. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/client/model.js +70 -2
  180. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/client/service.js +33 -3
  181. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/commands.js +45 -7
  182. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/default-directory.js +65 -0
  183. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/feed.js +9 -1
  184. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/index.js +62 -5
  185. package/node_modules/@deepseek-ai/dsh-api-workspace-controller/package.json +21 -18
  186. package/node_modules/@deepseek-ai/dsh-api-workspace-files/README.i18n.yaml +2 -2
  187. package/node_modules/@deepseek-ai/dsh-api-workspace-files/README.md +26 -25
  188. package/node_modules/@deepseek-ai/dsh-api-workspace-files/README.zh.md +26 -25
  189. package/node_modules/@deepseek-ai/dsh-api-workspace-files/lib/client.js +41 -35
  190. package/node_modules/@deepseek-ai/dsh-api-workspace-files/lib/index.js +129 -121
  191. package/node_modules/@deepseek-ai/dsh-api-workspace-files/lib/typert.host.js +72 -141
  192. package/node_modules/@deepseek-ai/dsh-api-workspace-files/lib/typert.remote-client.js +61 -120
  193. package/node_modules/@deepseek-ai/dsh-api-workspace-files/lib/types/changes.js +106 -46
  194. package/node_modules/@deepseek-ai/dsh-api-workspace-files/lib/types/client/change-feed.js +34 -27
  195. package/node_modules/@deepseek-ai/dsh-api-workspace-files/lib/types/client/provider.js +13 -6
  196. package/node_modules/@deepseek-ai/dsh-api-workspace-files/lib/types/index.js +32 -53
  197. package/node_modules/@deepseek-ai/dsh-api-workspace-files/package.json +15 -14
  198. package/node_modules/@deepseek-ai/dsh-app-boot/README.i18n.yaml +2 -2
  199. package/node_modules/@deepseek-ai/dsh-app-boot/README.md +33 -15
  200. package/node_modules/@deepseek-ai/dsh-app-boot/README.zh.md +33 -15
  201. package/node_modules/@deepseek-ai/dsh-app-boot/lib/index.js +1647 -681
  202. package/node_modules/@deepseek-ai/dsh-app-boot/lib/worker/profile-resolution-bootstrap.js +255 -357
  203. package/node_modules/@deepseek-ai/dsh-app-boot/package.json +20 -18
  204. package/node_modules/@deepseek-ai/dsh-atomic-write/README.i18n.yaml +2 -2
  205. package/node_modules/@deepseek-ai/dsh-atomic-write/README.md +4 -4
  206. package/node_modules/@deepseek-ai/dsh-atomic-write/README.zh.md +4 -4
  207. package/node_modules/@deepseek-ai/dsh-atomic-write/package.json +3 -3
  208. package/node_modules/@deepseek-ai/dsh-attachment/package.json +5 -5
  209. package/node_modules/@deepseek-ai/dsh-attachment-local/package.json +9 -9
  210. package/node_modules/@deepseek-ai/dsh-authorization/README.i18n.yaml +2 -2
  211. package/node_modules/@deepseek-ai/dsh-authorization/README.md +2 -0
  212. package/node_modules/@deepseek-ai/dsh-authorization/README.zh.md +2 -0
  213. package/node_modules/@deepseek-ai/dsh-authorization/lib/index.js +16 -4
  214. package/node_modules/@deepseek-ai/dsh-authorization/lib/types/index.js +19 -4
  215. package/node_modules/@deepseek-ai/dsh-authorization/package.json +9 -9
  216. package/node_modules/@deepseek-ai/dsh-base/README.i18n.yaml +2 -2
  217. package/node_modules/@deepseek-ai/dsh-base/README.md +2 -0
  218. package/node_modules/@deepseek-ai/dsh-base/README.zh.md +2 -0
  219. package/node_modules/@deepseek-ai/dsh-base/cordis.patch.yml +20 -26
  220. package/node_modules/@deepseek-ai/dsh-base/package.json +94 -94
  221. package/node_modules/@deepseek-ai/dsh-bash-local/README.i18n.yaml +2 -2
  222. package/node_modules/@deepseek-ai/dsh-bash-local/README.md +7 -6
  223. package/node_modules/@deepseek-ai/dsh-bash-local/README.zh.md +7 -6
  224. package/node_modules/@deepseek-ai/dsh-bash-local/lib/index.js +153 -202
  225. package/node_modules/@deepseek-ai/dsh-bash-local/package.json +11 -13
  226. package/node_modules/@deepseek-ai/dsh-bash-sandbox/README.i18n.yaml +2 -2
  227. package/node_modules/@deepseek-ai/dsh-bash-sandbox/README.md +3 -3
  228. package/node_modules/@deepseek-ai/dsh-bash-sandbox/README.zh.md +3 -3
  229. package/node_modules/@deepseek-ai/dsh-bash-sandbox/lib/index.js +58 -63
  230. package/node_modules/@deepseek-ai/dsh-bash-sandbox/package.json +14 -14
  231. package/node_modules/@deepseek-ai/dsh-brand/package.json +3 -3
  232. package/node_modules/@deepseek-ai/dsh-chunked-list/package.json +3 -3
  233. package/node_modules/@deepseek-ai/dsh-client-connection/README.i18n.yaml +2 -2
  234. package/node_modules/@deepseek-ai/dsh-client-connection/README.md +7 -3
  235. package/node_modules/@deepseek-ai/dsh-client-connection/README.zh.md +7 -3
  236. package/node_modules/@deepseek-ai/dsh-client-connection/lib/client.js +169 -28
  237. package/node_modules/@deepseek-ai/dsh-client-connection/lib/index.js +98 -36
  238. package/node_modules/@deepseek-ai/dsh-client-connection/package.json +13 -10
  239. package/node_modules/@deepseek-ai/dsh-client-file-upload/lib/client.js +8 -12
  240. package/node_modules/@deepseek-ai/dsh-client-file-upload/lib/index.js +1 -0
  241. package/node_modules/@deepseek-ai/dsh-client-file-upload/lib/typert.host.js +46 -18
  242. package/node_modules/@deepseek-ai/dsh-client-file-upload/lib/types/client/runtime.js +5 -12
  243. package/node_modules/@deepseek-ai/dsh-client-file-upload/lib/types/protocol.js +5 -0
  244. package/node_modules/@deepseek-ai/dsh-client-file-upload/package.json +14 -14
  245. package/node_modules/@deepseek-ai/dsh-client-hmr/README.i18n.yaml +2 -2
  246. package/node_modules/@deepseek-ai/dsh-client-hmr/README.md +2 -2
  247. package/node_modules/@deepseek-ai/dsh-client-hmr/README.zh.md +2 -2
  248. package/node_modules/@deepseek-ai/dsh-client-hmr/lib/client.js +6 -4
  249. package/node_modules/@deepseek-ai/dsh-client-hmr/lib/index.js +8 -5
  250. package/node_modules/@deepseek-ai/dsh-client-hmr/package.json +8 -8
  251. package/node_modules/@deepseek-ai/dsh-client-locale/README.i18n.yaml +2 -2
  252. package/node_modules/@deepseek-ai/dsh-client-locale/README.md +9 -1
  253. package/node_modules/@deepseek-ai/dsh-client-locale/README.zh.md +9 -1
  254. package/node_modules/@deepseek-ai/dsh-client-locale/lib/client.js +225 -75
  255. package/node_modules/@deepseek-ai/dsh-client-locale/lib/index.js +9 -8
  256. package/node_modules/@deepseek-ai/dsh-client-locale/package.json +13 -11
  257. package/node_modules/@deepseek-ai/dsh-client-modules/README.i18n.yaml +2 -2
  258. package/node_modules/@deepseek-ai/dsh-client-modules/README.md +2 -1
  259. package/node_modules/@deepseek-ai/dsh-client-modules/README.zh.md +2 -1
  260. package/node_modules/@deepseek-ai/dsh-client-modules/lib/index.js +57 -36
  261. package/node_modules/@deepseek-ai/dsh-client-modules/lib/invariant.js +2 -2
  262. package/node_modules/@deepseek-ai/dsh-client-modules/package.json +8 -7
  263. package/node_modules/@deepseek-ai/dsh-client-resources/package.json +7 -6
  264. package/node_modules/@deepseek-ai/dsh-client-store/LICENSE +21 -0
  265. package/node_modules/@deepseek-ai/{dsh-client-ui-settings-unarchive-sessions → dsh-client-store}/README.i18n.yaml +3 -3
  266. package/node_modules/@deepseek-ai/dsh-client-store/README.md +48 -0
  267. package/node_modules/@deepseek-ai/dsh-client-store/README.zh.md +48 -0
  268. package/node_modules/@deepseek-ai/dsh-client-store/lib/index.js +180 -0
  269. package/node_modules/@deepseek-ai/dsh-client-store/lib/types/contract.d.ts +121 -0
  270. package/node_modules/@deepseek-ai/dsh-client-store/lib/types/index.d.ts +92 -0
  271. package/node_modules/@deepseek-ai/dsh-client-store/package.json +37 -0
  272. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/README.i18n.yaml +2 -2
  273. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/README.md +13 -31
  274. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/README.zh.md +22 -40
  275. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/lib/client.js +865 -1033
  276. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/package.json +21 -19
  277. package/node_modules/@deepseek-ai/dsh-client-ui-approval/lib/client.js +3 -3
  278. package/node_modules/@deepseek-ai/dsh-client-ui-approval/package.json +14 -14
  279. package/node_modules/@deepseek-ai/dsh-client-ui-attachment/README.i18n.yaml +2 -2
  280. package/node_modules/@deepseek-ai/dsh-client-ui-attachment/README.md +1 -1
  281. package/node_modules/@deepseek-ai/dsh-client-ui-attachment/README.zh.md +1 -1
  282. package/node_modules/@deepseek-ai/dsh-client-ui-attachment/lib/client.js +28 -8
  283. package/node_modules/@deepseek-ai/dsh-client-ui-attachment/package.json +11 -11
  284. package/node_modules/@deepseek-ai/dsh-client-ui-brand-official/package.json +6 -6
  285. package/node_modules/@deepseek-ai/dsh-client-ui-chat/README.i18n.yaml +2 -2
  286. package/node_modules/@deepseek-ai/dsh-client-ui-chat/README.md +62 -10
  287. package/node_modules/@deepseek-ai/dsh-client-ui-chat/README.zh.md +60 -10
  288. package/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/client.js +4808 -1393
  289. package/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/index.js +37 -10
  290. package/node_modules/@deepseek-ai/dsh-client-ui-chat/package.json +41 -37
  291. package/node_modules/@deepseek-ai/dsh-client-ui-commands/README.i18n.yaml +2 -2
  292. package/node_modules/@deepseek-ai/dsh-client-ui-commands/README.md +2 -0
  293. package/node_modules/@deepseek-ai/dsh-client-ui-commands/README.zh.md +2 -0
  294. package/node_modules/@deepseek-ai/dsh-client-ui-commands/lib/client.js +20 -12
  295. package/node_modules/@deepseek-ai/dsh-client-ui-commands/package.json +17 -16
  296. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/README.i18n.yaml +2 -2
  297. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/README.md +19 -5
  298. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/README.zh.md +19 -5
  299. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +1321 -349
  300. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/index.js +9 -8
  301. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/package.json +34 -32
  302. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/README.i18n.yaml +2 -2
  303. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/README.md +2 -2
  304. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/README.zh.md +2 -2
  305. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/lib/client.js +28 -25
  306. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/package.json +14 -14
  307. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/README.i18n.yaml +2 -2
  308. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/README.md +14 -7
  309. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/README.zh.md +14 -7
  310. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/client.js +628 -497
  311. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/index.js +17 -8
  312. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/package.json +31 -28
  313. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/lib/client.js +7 -7
  314. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/package.json +9 -9
  315. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-native/package.json +5 -5
  316. package/node_modules/@deepseek-ai/dsh-client-ui-goal/README.i18n.yaml +2 -2
  317. package/node_modules/@deepseek-ai/dsh-client-ui-goal/README.md +3 -1
  318. package/node_modules/@deepseek-ai/dsh-client-ui-goal/README.zh.md +3 -1
  319. package/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/client.js +18 -9
  320. package/node_modules/@deepseek-ai/dsh-client-ui-goal/package.json +16 -16
  321. package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/lib/client.js +13 -7
  322. package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/package.json +14 -13
  323. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/README.i18n.yaml +2 -2
  324. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/README.md +25 -18
  325. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/README.zh.md +29 -22
  326. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/lib/client.js +413 -63
  327. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/lib/index.js +5 -5
  328. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/package.json +26 -23
  329. package/node_modules/@deepseek-ai/dsh-client-ui-layout/README.i18n.yaml +2 -2
  330. package/node_modules/@deepseek-ai/dsh-client-ui-layout/README.md +6 -2
  331. package/node_modules/@deepseek-ai/dsh-client-ui-layout/README.zh.md +6 -2
  332. package/node_modules/@deepseek-ai/dsh-client-ui-layout/lib/client.js +75 -4
  333. package/node_modules/@deepseek-ai/dsh-client-ui-layout/package.json +10 -9
  334. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/README.i18n.yaml +2 -2
  335. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/README.md +3 -3
  336. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/README.zh.md +3 -3
  337. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/lib/client.js +15 -13
  338. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/package.json +18 -17
  339. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/README.i18n.yaml +2 -2
  340. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/README.md +4 -0
  341. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/README.zh.md +4 -0
  342. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +12 -9
  343. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/package.json +17 -16
  344. package/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/README.i18n.yaml +2 -2
  345. package/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/README.md +20 -8
  346. package/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/README.zh.md +20 -8
  347. package/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/lib/client.js +530 -195
  348. package/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/package.json +25 -15
  349. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/README.i18n.yaml +2 -2
  350. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/README.md +1 -1
  351. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/README.zh.md +1 -1
  352. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/lib/client.js +39 -100
  353. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/package.json +17 -16
  354. package/node_modules/@deepseek-ai/dsh-client-ui-plan/README.i18n.yaml +2 -2
  355. package/node_modules/@deepseek-ai/dsh-client-ui-plan/README.md +7 -5
  356. package/node_modules/@deepseek-ai/dsh-client-ui-plan/README.zh.md +8 -6
  357. package/node_modules/@deepseek-ai/dsh-client-ui-plan/lib/client.js +73 -60
  358. package/node_modules/@deepseek-ai/dsh-client-ui-plan/package.json +22 -21
  359. package/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/README.i18n.yaml +2 -2
  360. package/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/README.md +29 -8
  361. package/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/README.zh.md +29 -8
  362. package/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/lib/client.js +1095 -381
  363. package/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/package.json +16 -12
  364. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/README.i18n.yaml +2 -2
  365. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/README.md +25 -11
  366. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/README.zh.md +25 -11
  367. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/ConnectionIndicator.module.css +1 -10
  368. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/HoverCard.module.css +27 -0
  369. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/Menu.module.css +68 -48
  370. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/Modal.module.css +6 -2
  371. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/OnboardingSurface.module.css +1 -2
  372. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/PathLabel.module.css +28 -0
  373. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/RiskConfirmation.module.css +1 -1
  374. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/SegmentedControl.module.css +76 -0
  375. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/SegmentedTabs.module.css +55 -0
  376. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/StateDot.module.css +64 -37
  377. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/TerminalBlock.module.css +13 -6
  378. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/TextShimmer.module.css +27 -0
  379. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/Toast.module.css +31 -2
  380. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/Tooltip.module.css +12 -0
  381. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/index.js +5418 -2739
  382. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/markdown/MarkdownText.module.css +1 -1
  383. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/settings-form/SettingsForm.module.css +53 -0
  384. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/settings-form/fields.module.css +145 -0
  385. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/ConfigField.d.ts +33 -0
  386. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/DisclosureRow.d.ts +4 -1
  387. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/HoverCard.d.ts +14 -4
  388. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/LinkIcon.d.ts +15 -30
  389. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/Menu.d.ts +50 -5
  390. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/PathLabel.d.ts +13 -0
  391. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/PermissionIcon.d.ts +39 -0
  392. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/ReferenceIcon.d.ts +12 -7
  393. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/SegmentedControl.d.ts +35 -0
  394. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/SegmentedTabs.d.ts +26 -0
  395. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/SiteGlyph.d.ts +1 -1
  396. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/StateDot.d.ts +6 -4
  397. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/TerminalBlock.d.ts +15 -3
  398. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/TextShimmer.d.ts +13 -0
  399. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/Toast.d.ts +19 -2
  400. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/Tooltip.d.ts +12 -2
  401. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/code-file-types.d.ts +1 -1
  402. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/code-highlighting.d.ts +19 -0
  403. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/icons/index.d.ts +376 -195
  404. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/icons/props.d.ts +1 -1
  405. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/icons/shared-artwork.d.ts +36 -0
  406. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/index.d.ts +21 -4
  407. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/overlay-top-margin.d.ts +14 -0
  408. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/plugin-artwork.d.ts +17 -0
  409. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/settings-form/SettingsForm.d.ts +46 -0
  410. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/settings-form/fields.d.ts +69 -0
  411. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/settings-form/form-model.d.ts +214 -0
  412. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/useAnchoredMaxHeight.d.ts +4 -1
  413. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/useAnchoredPosition.d.ts +3 -1
  414. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +5 -3
  415. package/node_modules/@deepseek-ai/dsh-client-ui-reference/README.i18n.yaml +2 -2
  416. package/node_modules/@deepseek-ai/dsh-client-ui-reference/README.md +2 -0
  417. package/node_modules/@deepseek-ai/dsh-client-ui-reference/README.zh.md +2 -0
  418. package/node_modules/@deepseek-ai/dsh-client-ui-reference/lib/client.js +12 -3
  419. package/node_modules/@deepseek-ai/dsh-client-ui-reference/package.json +15 -15
  420. package/node_modules/@deepseek-ai/dsh-client-ui-renderer/lib/client.js +7 -5
  421. package/node_modules/@deepseek-ai/dsh-client-ui-renderer/package.json +5 -5
  422. package/node_modules/@deepseek-ai/dsh-client-ui-schedule/README.i18n.yaml +2 -2
  423. package/node_modules/@deepseek-ai/dsh-client-ui-schedule/README.md +1 -1
  424. package/node_modules/@deepseek-ai/dsh-client-ui-schedule/README.zh.md +1 -1
  425. package/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/client.js +7 -8
  426. package/node_modules/@deepseek-ai/dsh-client-ui-schedule/package.json +12 -12
  427. package/node_modules/@deepseek-ai/dsh-client-ui-session/README.i18n.yaml +2 -2
  428. package/node_modules/@deepseek-ai/dsh-client-ui-session/README.md +2 -0
  429. package/node_modules/@deepseek-ai/dsh-client-ui-session/README.zh.md +2 -0
  430. package/node_modules/@deepseek-ai/dsh-client-ui-session/lib/client.js +2 -3
  431. package/node_modules/@deepseek-ai/dsh-client-ui-session/package.json +10 -9
  432. package/node_modules/@deepseek-ai/dsh-client-ui-settings/README.i18n.yaml +2 -2
  433. package/node_modules/@deepseek-ai/dsh-client-ui-settings/README.md +20 -11
  434. package/node_modules/@deepseek-ai/dsh-client-ui-settings/README.zh.md +20 -11
  435. package/node_modules/@deepseek-ai/dsh-client-ui-settings/lib/client.js +281 -117
  436. package/node_modules/@deepseek-ai/dsh-client-ui-settings/lib/index.js +18 -4
  437. package/node_modules/@deepseek-ai/dsh-client-ui-settings/package.json +13 -10
  438. package/node_modules/@deepseek-ai/dsh-client-ui-settings-account/README.i18n.yaml +6 -0
  439. package/node_modules/@deepseek-ai/dsh-client-ui-settings-account/README.md +75 -0
  440. package/node_modules/@deepseek-ai/dsh-client-ui-settings-account/README.zh.md +75 -0
  441. package/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/client.js +2383 -0
  442. package/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/index.js +28 -0
  443. package/node_modules/@deepseek-ai/dsh-client-ui-settings-account/package.json +69 -0
  444. package/node_modules/@deepseek-ai/dsh-client-ui-settings-agent-loop/README.i18n.yaml +6 -0
  445. package/node_modules/@deepseek-ai/dsh-client-ui-settings-agent-loop/README.md +78 -0
  446. package/node_modules/@deepseek-ai/dsh-client-ui-settings-agent-loop/README.zh.md +78 -0
  447. package/node_modules/@deepseek-ai/dsh-client-ui-settings-agent-loop/lib/client.js +175 -0
  448. package/node_modules/@deepseek-ai/dsh-client-ui-settings-agent-loop/lib/index.js +12 -0
  449. package/node_modules/@deepseek-ai/dsh-client-ui-settings-agent-loop/package.json +60 -0
  450. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/README.i18n.yaml +2 -2
  451. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/README.md +17 -6
  452. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/README.zh.md +17 -6
  453. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +166 -36
  454. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/index.js +8 -8
  455. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/package.json +19 -15
  456. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/README.i18n.yaml +2 -2
  457. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/README.md +14 -11
  458. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/README.zh.md +25 -22
  459. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +1246 -180
  460. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/index.js +24 -4
  461. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/package.json +15 -10
  462. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/README.i18n.yaml +2 -2
  463. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/README.md +5 -3
  464. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/README.zh.md +5 -3
  465. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/lib/client.js +116 -61
  466. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/package.json +14 -12
  467. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/README.i18n.yaml +2 -2
  468. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/README.md +11 -46
  469. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/README.zh.md +15 -50
  470. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/client.js +15 -1753
  471. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/package.json +10 -14
  472. package/node_modules/@deepseek-ai/dsh-client-ui-settings-shell/README.i18n.yaml +6 -0
  473. package/node_modules/@deepseek-ai/dsh-client-ui-settings-shell/README.md +78 -0
  474. package/node_modules/@deepseek-ai/dsh-client-ui-settings-shell/README.zh.md +78 -0
  475. package/node_modules/@deepseek-ai/dsh-client-ui-settings-shell/lib/client.js +199 -0
  476. package/node_modules/@deepseek-ai/dsh-client-ui-settings-shell/lib/index.js +12 -0
  477. package/node_modules/@deepseek-ai/dsh-client-ui-settings-shell/package.json +60 -0
  478. package/node_modules/@deepseek-ai/dsh-client-ui-settings-signin/package.json +9 -8
  479. package/node_modules/@deepseek-ai/dsh-client-ui-settings-subagent/README.i18n.yaml +6 -0
  480. package/node_modules/@deepseek-ai/dsh-client-ui-settings-subagent/README.md +82 -0
  481. package/node_modules/@deepseek-ai/dsh-client-ui-settings-subagent/README.zh.md +82 -0
  482. package/node_modules/@deepseek-ai/dsh-client-ui-settings-subagent/lib/client.js +857 -0
  483. package/node_modules/@deepseek-ai/dsh-client-ui-settings-subagent/lib/index.js +13 -0
  484. package/node_modules/@deepseek-ai/dsh-client-ui-settings-subagent/package.json +61 -0
  485. package/node_modules/@deepseek-ai/dsh-client-ui-settings-web-search/README.i18n.yaml +6 -0
  486. package/node_modules/@deepseek-ai/dsh-client-ui-settings-web-search/README.md +79 -0
  487. package/node_modules/@deepseek-ai/dsh-client-ui-settings-web-search/README.zh.md +79 -0
  488. package/node_modules/@deepseek-ai/dsh-client-ui-settings-web-search/lib/client.js +324 -0
  489. package/node_modules/@deepseek-ai/dsh-client-ui-settings-web-search/lib/index.js +13 -0
  490. package/node_modules/@deepseek-ai/dsh-client-ui-settings-web-search/package.json +61 -0
  491. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/README.i18n.yaml +2 -2
  492. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/README.md +2 -2
  493. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/README.zh.md +2 -2
  494. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +35 -28
  495. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/package.json +12 -13
  496. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-browser/README.i18n.yaml +2 -2
  497. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-browser/README.md +13 -12
  498. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-browser/README.zh.md +13 -12
  499. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-browser/lib/client.js +1191 -429
  500. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-browser/package.json +16 -9
  501. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/README.i18n.yaml +2 -2
  502. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/README.md +46 -20
  503. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/README.zh.md +46 -20
  504. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/client.excel.js +133782 -0
  505. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/client.js +3766 -789
  506. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/client.pdf.js +37 -15
  507. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/index.js +13 -6
  508. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/package.json +34 -21
  509. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/README.i18n.yaml +2 -2
  510. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/README.md +11 -9
  511. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/README.zh.md +11 -9
  512. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/lib/client.js +316 -106
  513. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/package.json +15 -13
  514. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/README.i18n.yaml +2 -2
  515. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/README.md +10 -7
  516. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/README.zh.md +10 -7
  517. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/lib/client.js +323 -111
  518. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/package.json +15 -14
  519. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-terminal/README.i18n.yaml +2 -2
  520. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-terminal/README.md +3 -3
  521. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-terminal/README.zh.md +3 -3
  522. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-terminal/lib/client.js +24 -141
  523. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-terminal/lib/client.terminal.js +1 -1
  524. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-terminal/package.json +16 -15
  525. package/node_modules/@deepseek-ai/dsh-client-ui-skill/README.i18n.yaml +2 -2
  526. package/node_modules/@deepseek-ai/dsh-client-ui-skill/README.md +3 -1
  527. package/node_modules/@deepseek-ai/dsh-client-ui-skill/README.zh.md +3 -1
  528. package/node_modules/@deepseek-ai/dsh-client-ui-skill/lib/client.js +25 -24
  529. package/node_modules/@deepseek-ai/dsh-client-ui-skill/package.json +15 -15
  530. package/node_modules/@deepseek-ai/dsh-client-ui-slots/package.json +4 -4
  531. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/README.i18n.yaml +2 -2
  532. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/README.md +13 -7
  533. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/README.zh.md +13 -7
  534. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/lib/client.js +168 -260
  535. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/package.json +19 -19
  536. package/node_modules/@deepseek-ai/dsh-client-ui-theme/README.i18n.yaml +2 -2
  537. package/node_modules/@deepseek-ai/dsh-client-ui-theme/README.md +6 -4
  538. package/node_modules/@deepseek-ai/dsh-client-ui-theme/README.zh.md +6 -4
  539. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +172 -70
  540. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/index.js +14 -27
  541. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/styles/Montserrat-OFL.txt +93 -0
  542. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/styles/brand-font.css +24 -0
  543. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/styles/montserrat-light.woff2 +0 -0
  544. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/styles/montserrat-medium.woff2 +0 -0
  545. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/styles/montserrat-regular.woff2 +0 -0
  546. package/node_modules/@deepseek-ai/dsh-client-ui-theme/package.json +17 -15
  547. package/node_modules/@deepseek-ai/dsh-client-ui-tool/README.i18n.yaml +2 -2
  548. package/node_modules/@deepseek-ai/dsh-client-ui-tool/README.md +10 -2
  549. package/node_modules/@deepseek-ai/dsh-client-ui-tool/README.zh.md +10 -2
  550. package/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/client.js +1887 -204
  551. package/node_modules/@deepseek-ai/dsh-client-ui-tool/package.json +24 -23
  552. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/README.i18n.yaml +2 -2
  553. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/README.md +3 -1
  554. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/README.zh.md +3 -1
  555. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/lib/client.js +32 -44
  556. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/package.json +18 -17
  557. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/README.i18n.yaml +2 -2
  558. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/README.md +1 -1
  559. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/README.zh.md +1 -1
  560. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/lib/client.js +19 -13
  561. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/package.json +20 -19
  562. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/README.i18n.yaml +2 -2
  563. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/README.md +1 -1
  564. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/README.zh.md +1 -1
  565. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/lib/client.js +9 -8
  566. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/package.json +16 -15
  567. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/README.i18n.yaml +2 -2
  568. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/README.md +102 -11
  569. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/README.zh.md +102 -11
  570. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +2182 -1015
  571. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/package.json +26 -22
  572. package/node_modules/@deepseek-ai/dsh-cmdline/package.json +6 -6
  573. package/node_modules/@deepseek-ai/dsh-command-compact/package.json +12 -12
  574. package/node_modules/@deepseek-ai/dsh-command-feedback/package.json +15 -15
  575. package/node_modules/@deepseek-ai/dsh-command-goal/package.json +14 -14
  576. package/node_modules/@deepseek-ai/dsh-commands/lib/typert.host.js +46 -18
  577. package/node_modules/@deepseek-ai/dsh-commands/package.json +20 -20
  578. package/node_modules/@deepseek-ai/dsh-compaction/lib/index.js +2 -5
  579. package/node_modules/@deepseek-ai/dsh-compaction/lib/invariant.js +4 -22
  580. package/node_modules/@deepseek-ai/dsh-compaction/lib/types/checkpoint.js +2 -2
  581. package/node_modules/@deepseek-ai/dsh-compaction/lib/types/invariant.js +2 -3
  582. package/node_modules/@deepseek-ai/dsh-compaction/package.json +13 -13
  583. package/node_modules/@deepseek-ai/dsh-compaction-basic/README.i18n.yaml +2 -2
  584. package/node_modules/@deepseek-ai/dsh-compaction-basic/README.md +9 -8
  585. package/node_modules/@deepseek-ai/dsh-compaction-basic/README.zh.md +9 -8
  586. package/node_modules/@deepseek-ai/dsh-compaction-basic/lib/index.js +50 -19
  587. package/node_modules/@deepseek-ai/dsh-compaction-basic/package.json +27 -27
  588. package/node_modules/@deepseek-ai/dsh-compaction-image-offload/lib/index.js +1 -7
  589. package/node_modules/@deepseek-ai/dsh-compaction-image-offload/lib/types/image-offload.js +0 -3
  590. package/node_modules/@deepseek-ai/dsh-compaction-image-offload/lib/types/project-message.js +0 -5
  591. package/node_modules/@deepseek-ai/dsh-compaction-image-offload/package.json +18 -18
  592. package/node_modules/@deepseek-ai/dsh-compaction-tool-result-pruner/lib/index.js +3 -7
  593. package/node_modules/@deepseek-ai/dsh-compaction-tool-result-pruner/package.json +18 -18
  594. package/node_modules/@deepseek-ai/dsh-config-editor/README.i18n.yaml +6 -0
  595. package/node_modules/@deepseek-ai/dsh-config-editor/README.md +79 -0
  596. package/node_modules/@deepseek-ai/dsh-config-editor/README.zh.md +79 -0
  597. package/node_modules/@deepseek-ai/dsh-config-editor/lib/index.js +132 -0
  598. package/node_modules/@deepseek-ai/dsh-config-editor/package.json +54 -0
  599. package/node_modules/@deepseek-ai/dsh-cordis-client-runner/lib/client.js +878 -170
  600. package/node_modules/@deepseek-ai/dsh-cordis-client-runner/package.json +9 -9
  601. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/lib/index.js +6 -68
  602. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/lib/typert.host.js +107 -51
  603. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/lib/typert.remote-client.js +15 -15
  604. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/lib/types/index.js +5 -6
  605. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/lib/types/sandbox.js +0 -27
  606. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/package.json +20 -20
  607. package/node_modules/@deepseek-ai/dsh-credentials/package.json +6 -6
  608. package/node_modules/@deepseek-ai/dsh-credentials-local/package.json +12 -12
  609. package/node_modules/@deepseek-ai/dsh-deepseek-account/README.i18n.yaml +6 -0
  610. package/node_modules/@deepseek-ai/dsh-deepseek-account/README.md +63 -0
  611. package/node_modules/@deepseek-ai/dsh-deepseek-account/README.zh.md +63 -0
  612. package/node_modules/@deepseek-ai/dsh-deepseek-account/lib/index.js +35 -0
  613. package/node_modules/@deepseek-ai/dsh-deepseek-account/lib/types/index.js +36 -0
  614. package/node_modules/@deepseek-ai/dsh-deepseek-account/lib/types/types.js +2 -0
  615. package/node_modules/@deepseek-ai/dsh-deepseek-account/package.json +42 -0
  616. package/node_modules/@deepseek-ai/dsh-deepseek-account-platform/README.i18n.yaml +6 -0
  617. package/node_modules/@deepseek-ai/dsh-deepseek-account-platform/README.md +96 -0
  618. package/node_modules/@deepseek-ai/dsh-deepseek-account-platform/README.zh.md +96 -0
  619. package/node_modules/@deepseek-ai/dsh-deepseek-account-platform/lib/index.js +891 -0
  620. package/node_modules/@deepseek-ai/dsh-deepseek-account-platform/lib/types/details.js +55 -0
  621. package/node_modules/@deepseek-ai/dsh-deepseek-account-platform/lib/types/index.js +488 -0
  622. package/node_modules/@deepseek-ai/dsh-deepseek-account-platform/lib/types/logout.js +34 -0
  623. package/node_modules/@deepseek-ai/dsh-deepseek-account-platform/lib/types/protocol.js +210 -0
  624. package/node_modules/@deepseek-ai/dsh-deepseek-account-platform/lib/types/types.js +2 -0
  625. package/node_modules/@deepseek-ai/dsh-deepseek-account-platform/package.json +52 -0
  626. package/node_modules/@deepseek-ai/dsh-deepseek-llm-api-extensions/README.i18n.yaml +2 -2
  627. package/node_modules/@deepseek-ai/dsh-deepseek-llm-api-extensions/README.md +1 -1
  628. package/node_modules/@deepseek-ai/dsh-deepseek-llm-api-extensions/README.zh.md +1 -1
  629. package/node_modules/@deepseek-ai/dsh-deepseek-llm-api-extensions/package.json +3 -3
  630. package/node_modules/@deepseek-ai/dsh-deque/package.json +3 -3
  631. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/README.i18n.yaml +2 -2
  632. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/README.md +8 -4
  633. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/README.zh.md +8 -4
  634. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/lib/index.js +14 -74
  635. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/lib/invariant.js +6 -8
  636. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/lib/typert.host.js +51 -189
  637. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/lib/typert.remote-client.js +3 -151
  638. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/lib/types/client.js +1 -1
  639. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/lib/types/index.js +0 -41
  640. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/lib/types/projection.js +10 -10
  641. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/lib/types/roster.js +8 -4
  642. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/locale/en.json +6 -0
  643. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/locale/zh.json +6 -0
  644. package/node_modules/@deepseek-ai/dsh-experimental-agent-team/package.json +28 -26
  645. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-profile/README.i18n.yaml +2 -2
  646. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-profile/README.md +16 -4
  647. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-profile/README.zh.md +16 -4
  648. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-profile/cordis.patch.yml +3 -0
  649. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-profile/icon.svg +12 -0
  650. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-profile/locale/en.json +6 -0
  651. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-profile/locale/zh.json +6 -0
  652. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-profile/package.json +12 -7
  653. package/node_modules/@deepseek-ai/{dsh-experimental-agent-team-web-profile → dsh-experimental-api-speech-to-text}/README.i18n.yaml +3 -3
  654. package/node_modules/@deepseek-ai/dsh-experimental-api-speech-to-text/README.md +78 -0
  655. package/node_modules/@deepseek-ai/dsh-experimental-api-speech-to-text/README.zh.md +78 -0
  656. package/node_modules/@deepseek-ai/dsh-experimental-api-speech-to-text/lib/index.js +218 -0
  657. package/node_modules/@deepseek-ai/dsh-experimental-api-speech-to-text/lib/typert.host.js +432 -0
  658. package/node_modules/@deepseek-ai/dsh-experimental-api-speech-to-text/lib/typert.remote-client.js +311 -0
  659. package/node_modules/@deepseek-ai/dsh-experimental-api-speech-to-text/lib/types/index.js +142 -0
  660. package/node_modules/@deepseek-ai/dsh-experimental-api-speech-to-text/lib/types/types.js +2 -0
  661. package/node_modules/@deepseek-ai/dsh-experimental-api-speech-to-text/package.json +60 -0
  662. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-agent-team/README.i18n.yaml +2 -2
  663. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-agent-team/README.md +11 -9
  664. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-agent-team/README.zh.md +11 -9
  665. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-agent-team/lib/client.js +127 -562
  666. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-agent-team/locale/en.json +6 -0
  667. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-agent-team/locale/zh.json +6 -0
  668. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-agent-team/package.json +30 -27
  669. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-voice-input/README.i18n.yaml +6 -0
  670. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-voice-input/README.md +76 -0
  671. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-voice-input/README.zh.md +76 -0
  672. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-voice-input/lib/client.js +5714 -0
  673. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-voice-input/lib/index.js +6 -0
  674. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-voice-input/package.json +92 -0
  675. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text/README.i18n.yaml +6 -0
  676. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text/README.md +80 -0
  677. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text/README.zh.md +80 -0
  678. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text/lib/index.js +200 -0
  679. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text/lib/types/index.js +181 -0
  680. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text/lib/types/types.js +2 -0
  681. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text/lib/types/wave.js +24 -0
  682. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text/package.json +57 -0
  683. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text-sensevoice/README.i18n.yaml +6 -0
  684. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text-sensevoice/README.md +82 -0
  685. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text-sensevoice/README.zh.md +82 -0
  686. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text-sensevoice/lib/index.js +818 -0
  687. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text-sensevoice/lib/worker.js +219 -0
  688. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text-sensevoice/package.json +53 -0
  689. package/node_modules/@deepseek-ai/dsh-experimental-speech-to-text-sensevoice/runtime/assets.json +28 -0
  690. package/node_modules/@deepseek-ai/dsh-experimental-tool-agent-team/README.i18n.yaml +2 -2
  691. package/node_modules/@deepseek-ai/dsh-experimental-tool-agent-team/README.md +3 -3
  692. package/node_modules/@deepseek-ai/dsh-experimental-tool-agent-team/README.zh.md +3 -3
  693. package/node_modules/@deepseek-ai/dsh-experimental-tool-agent-team/lib/index.js +23 -24
  694. package/node_modules/@deepseek-ai/dsh-experimental-tool-agent-team/locale/en.json +6 -0
  695. package/node_modules/@deepseek-ai/dsh-experimental-tool-agent-team/locale/zh.json +6 -0
  696. package/node_modules/@deepseek-ai/dsh-experimental-tool-agent-team/package.json +27 -25
  697. package/node_modules/@deepseek-ai/dsh-experimental-voice-input-bundle/README.i18n.yaml +6 -0
  698. package/node_modules/@deepseek-ai/dsh-experimental-voice-input-bundle/README.md +77 -0
  699. package/node_modules/@deepseek-ai/dsh-experimental-voice-input-bundle/README.zh.md +77 -0
  700. package/node_modules/@deepseek-ai/dsh-experimental-voice-input-bundle/cordis.patch.yml +13 -0
  701. package/node_modules/@deepseek-ai/dsh-experimental-voice-input-bundle/icon.svg +9 -0
  702. package/node_modules/@deepseek-ai/dsh-experimental-voice-input-bundle/locale/en.json +6 -0
  703. package/node_modules/@deepseek-ai/dsh-experimental-voice-input-bundle/locale/zh.json +6 -0
  704. package/node_modules/@deepseek-ai/dsh-experimental-voice-input-bundle/package.json +54 -0
  705. package/node_modules/@deepseek-ai/dsh-file-reference/README.i18n.yaml +2 -2
  706. package/node_modules/@deepseek-ai/dsh-file-reference/README.md +1 -1
  707. package/node_modules/@deepseek-ai/dsh-file-reference/README.zh.md +1 -1
  708. package/node_modules/@deepseek-ai/dsh-file-reference/package.json +5 -5
  709. package/node_modules/@deepseek-ai/dsh-file-reference-local/README.i18n.yaml +2 -2
  710. package/node_modules/@deepseek-ai/dsh-file-reference-local/README.md +3 -4
  711. package/node_modules/@deepseek-ai/dsh-file-reference-local/README.zh.md +3 -4
  712. package/node_modules/@deepseek-ai/dsh-file-reference-local/package.json +12 -12
  713. package/node_modules/@deepseek-ai/dsh-fs/README.i18n.yaml +2 -2
  714. package/node_modules/@deepseek-ai/dsh-fs/README.md +7 -5
  715. package/node_modules/@deepseek-ai/dsh-fs/README.zh.md +7 -5
  716. package/node_modules/@deepseek-ai/dsh-fs/lib/index.js +12 -0
  717. package/node_modules/@deepseek-ai/dsh-fs/package.json +11 -11
  718. package/node_modules/@deepseek-ai/dsh-fs-local/README.i18n.yaml +2 -2
  719. package/node_modules/@deepseek-ai/dsh-fs-local/README.md +6 -3
  720. package/node_modules/@deepseek-ai/dsh-fs-local/README.zh.md +6 -3
  721. package/node_modules/@deepseek-ai/dsh-fs-local/lib/index.js +27 -0
  722. package/node_modules/@deepseek-ai/dsh-fs-local/package.json +8 -7
  723. package/node_modules/@deepseek-ai/dsh-fs-observation-policy/package.json +6 -6
  724. package/node_modules/@deepseek-ai/dsh-fs-sandbox/README.i18n.yaml +2 -2
  725. package/node_modules/@deepseek-ai/dsh-fs-sandbox/README.md +1 -1
  726. package/node_modules/@deepseek-ai/dsh-fs-sandbox/README.zh.md +1 -1
  727. package/node_modules/@deepseek-ai/dsh-fs-sandbox/package.json +12 -12
  728. package/node_modules/@deepseek-ai/dsh-goal/lib/typert.host.js +46 -18
  729. package/node_modules/@deepseek-ai/dsh-goal/package.json +25 -25
  730. package/node_modules/@deepseek-ai/dsh-goal-round-driver/lib/index.js +2 -3
  731. package/node_modules/@deepseek-ai/dsh-goal-round-driver/package.json +17 -17
  732. package/node_modules/@deepseek-ai/dsh-headless/lib/index.js +1 -1
  733. package/node_modules/@deepseek-ai/dsh-headless/lib/{json-stream-Bh4BGGk9.js → json-stream-BA-F3lfb.js} +4 -4
  734. package/node_modules/@deepseek-ai/dsh-headless/lib/startup.js +1 -1
  735. package/node_modules/@deepseek-ai/dsh-headless/package.json +22 -22
  736. package/node_modules/@deepseek-ai/dsh-hmr/README.i18n.yaml +2 -2
  737. package/node_modules/@deepseek-ai/dsh-hmr/README.md +1 -1
  738. package/node_modules/@deepseek-ai/dsh-hmr/README.zh.md +1 -1
  739. package/node_modules/@deepseek-ai/dsh-hmr/package.json +15 -15
  740. package/node_modules/@deepseek-ai/dsh-home-paths/package.json +3 -3
  741. package/node_modules/@deepseek-ai/dsh-hook-protocol/lib/index.js +1 -1
  742. package/node_modules/@deepseek-ai/dsh-hook-protocol/package.json +9 -9
  743. package/node_modules/@deepseek-ai/dsh-hooks-claude-code/lib/index.js +4 -7
  744. package/node_modules/@deepseek-ai/dsh-hooks-claude-code/package.json +23 -23
  745. package/node_modules/@deepseek-ai/dsh-hooks-codex/lib/index.js +3 -6
  746. package/node_modules/@deepseek-ai/dsh-hooks-codex/package.json +21 -21
  747. package/node_modules/@deepseek-ai/dsh-host-directory-picker/package.json +3 -3
  748. package/node_modules/@deepseek-ai/dsh-host-directory-picker-auto/package.json +18 -18
  749. package/node_modules/@deepseek-ai/dsh-host-directory-picker-browse/package.json +5 -5
  750. package/node_modules/@deepseek-ai/dsh-host-directory-picker-native/package.json +5 -5
  751. package/node_modules/@deepseek-ai/dsh-host-frontend-static/README.i18n.yaml +2 -2
  752. package/node_modules/@deepseek-ai/dsh-host-frontend-static/README.md +3 -1
  753. package/node_modules/@deepseek-ai/dsh-host-frontend-static/README.zh.md +3 -1
  754. package/node_modules/@deepseek-ai/dsh-host-frontend-static/lib/index.js +1 -1
  755. package/node_modules/@deepseek-ai/dsh-host-frontend-static/package.json +10 -10
  756. package/node_modules/@deepseek-ai/dsh-host-open-in-app/README.i18n.yaml +2 -2
  757. package/node_modules/@deepseek-ai/dsh-host-open-in-app/README.md +2 -0
  758. package/node_modules/@deepseek-ai/dsh-host-open-in-app/README.zh.md +2 -0
  759. package/node_modules/@deepseek-ai/dsh-host-open-in-app/lib/index.js +28 -81
  760. package/node_modules/@deepseek-ai/dsh-host-open-in-app/lib/types/icons.js +4 -49
  761. package/node_modules/@deepseek-ai/dsh-host-open-in-app/lib/types/index.js +8 -8
  762. package/node_modules/@deepseek-ai/dsh-host-open-in-app/lib/types/resolver.js +8 -27
  763. package/node_modules/@deepseek-ai/dsh-host-open-in-app/lib/types/shared.js +16 -7
  764. package/node_modules/@deepseek-ai/dsh-host-open-in-app/package.json +9 -9
  765. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/README.i18n.yaml +2 -2
  766. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/README.md +8 -4
  767. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/README.zh.md +8 -4
  768. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/lib/index.js +19 -11
  769. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/lib/typert.host.js +23 -4
  770. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/lib/typert.remote-client.js +23 -4
  771. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/lib/types/index.js +18 -10
  772. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/package.json +14 -12
  773. package/node_modules/@deepseek-ai/dsh-host-webserver/README.i18n.yaml +2 -2
  774. package/node_modules/@deepseek-ai/dsh-host-webserver/README.md +1 -1
  775. package/node_modules/@deepseek-ai/dsh-host-webserver/README.zh.md +1 -1
  776. package/node_modules/@deepseek-ai/dsh-host-webserver/lib/index.js +1 -0
  777. package/node_modules/@deepseek-ai/dsh-host-webserver/package.json +4 -4
  778. package/node_modules/@deepseek-ai/dsh-http-proxy/package.json +4 -4
  779. package/node_modules/@deepseek-ai/dsh-invariants/README.i18n.yaml +2 -2
  780. package/node_modules/@deepseek-ai/dsh-invariants/README.md +1 -1
  781. package/node_modules/@deepseek-ai/dsh-invariants/README.zh.md +1 -1
  782. package/node_modules/@deepseek-ai/dsh-invariants/package.json +4 -4
  783. package/node_modules/@deepseek-ai/dsh-jobs/README.i18n.yaml +2 -2
  784. package/node_modules/@deepseek-ai/dsh-jobs/README.md +18 -11
  785. package/node_modules/@deepseek-ai/dsh-jobs/README.zh.md +18 -11
  786. package/node_modules/@deepseek-ai/dsh-jobs/lib/index.js +74 -16
  787. package/node_modules/@deepseek-ai/dsh-jobs/lib/invariant.js +67 -17
  788. package/node_modules/@deepseek-ai/dsh-jobs/lib/types/archive-admission.js +43 -0
  789. package/node_modules/@deepseek-ai/dsh-jobs/lib/types/index.js +34 -16
  790. package/node_modules/@deepseek-ai/dsh-jobs/lib/types/invariant.js +90 -27
  791. package/node_modules/@deepseek-ai/dsh-jobs/lib/types/types.js +3 -2
  792. package/node_modules/@deepseek-ai/dsh-jobs/lib/types/view.js +9 -0
  793. package/node_modules/@deepseek-ai/dsh-jobs/package.json +22 -11
  794. package/node_modules/@deepseek-ai/dsh-jobs-local/README.i18n.yaml +2 -2
  795. package/node_modules/@deepseek-ai/dsh-jobs-local/README.md +18 -11
  796. package/node_modules/@deepseek-ai/dsh-jobs-local/README.zh.md +17 -10
  797. package/node_modules/@deepseek-ai/dsh-jobs-local/lib/index.js +566 -193
  798. package/node_modules/@deepseek-ai/dsh-jobs-local/package.json +16 -16
  799. package/node_modules/@deepseek-ai/dsh-launch-environment/package.json +3 -3
  800. package/node_modules/@deepseek-ai/dsh-lazy-require/package.json +3 -3
  801. package/node_modules/@deepseek-ai/dsh-llm/README.i18n.yaml +2 -2
  802. package/node_modules/@deepseek-ai/dsh-llm/README.md +11 -8
  803. package/node_modules/@deepseek-ai/dsh-llm/README.zh.md +11 -8
  804. package/node_modules/@deepseek-ai/dsh-llm/lib/index.js +41 -97
  805. package/node_modules/@deepseek-ai/dsh-llm/lib/typert.host.js +69 -13
  806. package/node_modules/@deepseek-ai/dsh-llm/lib/typert.remote-client.js +3 -3
  807. package/node_modules/@deepseek-ai/dsh-llm/lib/types/assembler.js +4 -4
  808. package/node_modules/@deepseek-ai/dsh-llm/lib/types/content.js +12 -64
  809. package/node_modules/@deepseek-ai/dsh-llm/lib/types/index.js +3 -1
  810. package/node_modules/@deepseek-ai/dsh-llm/lib/types/message.js +21 -16
  811. package/node_modules/@deepseek-ai/dsh-llm/package.json +11 -11
  812. package/node_modules/@deepseek-ai/dsh-llm-deepseek/README.i18n.yaml +2 -2
  813. package/node_modules/@deepseek-ai/dsh-llm-deepseek/README.md +35 -49
  814. package/node_modules/@deepseek-ai/dsh-llm-deepseek/README.zh.md +36 -50
  815. package/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/index.js +1132 -2048
  816. package/node_modules/@deepseek-ai/dsh-llm-deepseek/package.json +53 -43
  817. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.i18n.yaml +2 -2
  818. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.md +12 -9
  819. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.zh.md +11 -8
  820. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +84 -184
  821. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/package.json +30 -24
  822. package/node_modules/@deepseek-ai/dsh-llm-retry/package.json +25 -25
  823. package/node_modules/@deepseek-ai/dsh-mcp-client/package.json +23 -23
  824. package/node_modules/@deepseek-ai/dsh-mcp-resources/package.json +14 -14
  825. package/node_modules/@deepseek-ai/dsh-message-feedback/package.json +19 -19
  826. package/node_modules/@deepseek-ai/dsh-native-command/README.i18n.yaml +2 -2
  827. package/node_modules/@deepseek-ai/dsh-native-command/README.md +8 -9
  828. package/node_modules/@deepseek-ai/dsh-native-command/README.zh.md +8 -9
  829. package/node_modules/@deepseek-ai/dsh-native-command/lib/index.js +612 -3
  830. package/node_modules/@deepseek-ai/dsh-native-command/lib/types/desktop-entry.js +79 -0
  831. package/node_modules/@deepseek-ai/dsh-native-command/lib/types/file-applications-linux.js +70 -0
  832. package/node_modules/@deepseek-ai/dsh-native-command/lib/types/file-applications-windows.js +228 -0
  833. package/node_modules/@deepseek-ai/dsh-native-command/lib/types/file-applications.js +191 -0
  834. package/node_modules/@deepseek-ai/dsh-native-command/lib/types/index.js +10 -0
  835. package/node_modules/@deepseek-ai/dsh-native-command/lib/types/path-opener.js +230 -0
  836. package/node_modules/@deepseek-ai/dsh-native-command/lib/types/runner.js +27 -0
  837. package/node_modules/@deepseek-ai/dsh-native-command/lib/types/types.js +25 -0
  838. package/node_modules/@deepseek-ai/dsh-native-command/lib/types/url-opener.js +88 -0
  839. package/node_modules/@deepseek-ai/dsh-native-command/package.json +10 -5
  840. package/node_modules/@deepseek-ai/dsh-no-progress-reminder/lib/index.js +33 -57
  841. package/node_modules/@deepseek-ai/dsh-no-progress-reminder/package.json +15 -15
  842. package/node_modules/@deepseek-ai/dsh-office-to-pdf/README.i18n.yaml +2 -2
  843. package/node_modules/@deepseek-ai/dsh-office-to-pdf/README.md +2 -2
  844. package/node_modules/@deepseek-ai/dsh-office-to-pdf/README.zh.md +2 -2
  845. package/node_modules/@deepseek-ai/dsh-office-to-pdf/lib/index.js +4 -4
  846. package/node_modules/@deepseek-ai/dsh-office-to-pdf/lib/typert.host.js +41 -3
  847. package/node_modules/@deepseek-ai/dsh-office-to-pdf/lib/typert.remote-client.js +39 -1
  848. package/node_modules/@deepseek-ai/dsh-office-to-pdf/lib/types/index.js +4 -3
  849. package/node_modules/@deepseek-ai/dsh-office-to-pdf/package.json +11 -11
  850. package/node_modules/@deepseek-ai/dsh-output-retention/package.json +3 -3
  851. package/node_modules/@deepseek-ai/dsh-package-manifest/README.i18n.yaml +2 -2
  852. package/node_modules/@deepseek-ai/dsh-package-manifest/README.md +3 -1
  853. package/node_modules/@deepseek-ai/dsh-package-manifest/README.zh.md +3 -1
  854. package/node_modules/@deepseek-ai/dsh-package-manifest/package.json +3 -3
  855. package/node_modules/@deepseek-ai/dsh-permission-presets/README.i18n.yaml +2 -2
  856. package/node_modules/@deepseek-ai/dsh-permission-presets/README.md +1 -1
  857. package/node_modules/@deepseek-ai/dsh-permission-presets/README.zh.md +1 -1
  858. package/node_modules/@deepseek-ai/dsh-permission-presets/lib/index.js +16 -35
  859. package/node_modules/@deepseek-ai/dsh-permission-presets/lib/typert.host.js +54 -20
  860. package/node_modules/@deepseek-ai/dsh-permission-presets/lib/typert.remote-client.js +7 -1
  861. package/node_modules/@deepseek-ai/dsh-permission-presets/lib/types/index.js +14 -38
  862. package/node_modules/@deepseek-ai/dsh-permission-presets/package.json +23 -24
  863. package/node_modules/@deepseek-ai/dsh-persona/README.i18n.yaml +2 -2
  864. package/node_modules/@deepseek-ai/dsh-persona/README.md +1 -1
  865. package/node_modules/@deepseek-ai/dsh-persona/README.zh.md +1 -1
  866. package/node_modules/@deepseek-ai/dsh-persona/package.json +7 -7
  867. package/node_modules/@deepseek-ai/dsh-plan-mode/lib/index.js +1 -2
  868. package/node_modules/@deepseek-ai/dsh-plan-mode/lib/types/index.js +1 -1
  869. package/node_modules/@deepseek-ai/dsh-plan-mode/package.json +24 -24
  870. package/node_modules/@deepseek-ai/dsh-plugin-manager/README.i18n.yaml +2 -2
  871. package/node_modules/@deepseek-ai/dsh-plugin-manager/README.md +12 -2
  872. package/node_modules/@deepseek-ai/dsh-plugin-manager/README.zh.md +12 -2
  873. package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/index.js +371 -74
  874. package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/typert.host.js +203 -29
  875. package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/typert.remote-client.js +155 -15
  876. package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/index.js +210 -70
  877. package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/install-failure.js +1 -1
  878. package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/install-spec.js +16 -2
  879. package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/operations.js +35 -5
  880. package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/registry.js +95 -0
  881. package/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/tools.js +5 -1
  882. package/node_modules/@deepseek-ai/dsh-plugin-manager/package.json +37 -32
  883. package/node_modules/@deepseek-ai/dsh-plugin-package-inventory-deepseek/README.i18n.yaml +2 -2
  884. package/node_modules/@deepseek-ai/dsh-plugin-package-inventory-deepseek/README.md +1 -1
  885. package/node_modules/@deepseek-ai/dsh-plugin-package-inventory-deepseek/README.zh.md +1 -1
  886. package/node_modules/@deepseek-ai/dsh-plugin-package-inventory-deepseek/lib/index.js +1 -1
  887. package/node_modules/@deepseek-ai/dsh-plugin-package-inventory-deepseek/lib/types/index.js +1 -1
  888. package/node_modules/@deepseek-ai/dsh-plugin-package-inventory-deepseek/package.json +20 -20
  889. package/node_modules/@deepseek-ai/dsh-ptc-runtime/package.json +5 -5
  890. package/node_modules/@deepseek-ai/dsh-ptc-runtime-node/package.json +23 -23
  891. package/node_modules/@deepseek-ai/dsh-pwsh-local/README.i18n.yaml +2 -2
  892. package/node_modules/@deepseek-ai/dsh-pwsh-local/README.md +6 -5
  893. package/node_modules/@deepseek-ai/dsh-pwsh-local/README.zh.md +6 -5
  894. package/node_modules/@deepseek-ai/dsh-pwsh-local/lib/index.js +161 -196
  895. package/node_modules/@deepseek-ai/dsh-pwsh-local/package.json +11 -13
  896. package/node_modules/@deepseek-ai/dsh-pwsh-sandbox/README.i18n.yaml +2 -2
  897. package/node_modules/@deepseek-ai/dsh-pwsh-sandbox/README.md +5 -5
  898. package/node_modules/@deepseek-ai/dsh-pwsh-sandbox/README.zh.md +5 -5
  899. package/node_modules/@deepseek-ai/dsh-pwsh-sandbox/lib/index.js +58 -63
  900. package/node_modules/@deepseek-ai/dsh-pwsh-sandbox/package.json +14 -14
  901. package/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/lib/index.js +36 -60
  902. package/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/package.json +12 -12
  903. package/node_modules/@deepseek-ai/dsh-sandbox/package.json +8 -8
  904. package/node_modules/@deepseek-ai/dsh-sandbox-local/README.i18n.yaml +3 -3
  905. package/node_modules/@deepseek-ai/dsh-sandbox-local/README.md +3 -3
  906. package/node_modules/@deepseek-ai/dsh-sandbox-local/README.zh.md +3 -3
  907. package/node_modules/@deepseek-ai/dsh-sandbox-local/lib/index.js +3 -2
  908. package/node_modules/@deepseek-ai/dsh-sandbox-local/package.json +12 -12
  909. package/node_modules/@deepseek-ai/dsh-sandbox-policy/package.json +16 -16
  910. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/README.i18n.yaml +3 -3
  911. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/README.md +19 -15
  912. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/README.zh.md +17 -13
  913. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/index.js +1 -1
  914. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/runner.js +1 -1
  915. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/{types-CutH1Lgc.js → types-DxezulnA.js} +267 -78
  916. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/package.json +10 -10
  917. package/node_modules/@deepseek-ai/dsh-schedule/README.i18n.yaml +2 -2
  918. package/node_modules/@deepseek-ai/dsh-schedule/README.md +3 -1
  919. package/node_modules/@deepseek-ai/dsh-schedule/README.zh.md +4 -1
  920. package/node_modules/@deepseek-ai/dsh-schedule/lib/index.js +104 -37
  921. package/node_modules/@deepseek-ai/dsh-schedule/lib/types/index.js +61 -5
  922. package/node_modules/@deepseek-ai/dsh-schedule/lib/types/runtime.js +11 -1
  923. package/node_modules/@deepseek-ai/dsh-schedule/package.json +25 -23
  924. package/node_modules/@deepseek-ai/dsh-scope/package.json +5 -5
  925. package/node_modules/@deepseek-ai/dsh-sdk-app/README.i18n.yaml +2 -2
  926. package/node_modules/@deepseek-ai/dsh-sdk-app/README.md +2 -0
  927. package/node_modules/@deepseek-ai/dsh-sdk-app/README.zh.md +2 -0
  928. package/node_modules/@deepseek-ai/dsh-sdk-app/cordis.patch.yml +15 -0
  929. package/node_modules/@deepseek-ai/dsh-sdk-app/package.json +10 -8
  930. package/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-server/lib/index.js +1 -1
  931. package/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-server/package.json +25 -25
  932. package/node_modules/@deepseek-ai/dsh-sdk-minimal/package.json +31 -31
  933. package/node_modules/@deepseek-ai/dsh-sdk-protocol/package.json +9 -9
  934. package/node_modules/@deepseek-ai/dsh-session/README.i18n.yaml +2 -2
  935. package/node_modules/@deepseek-ai/dsh-session/README.md +11 -9
  936. package/node_modules/@deepseek-ai/dsh-session/README.zh.md +12 -8
  937. package/node_modules/@deepseek-ai/dsh-session/lib/index.js +215 -125
  938. package/node_modules/@deepseek-ai/dsh-session/lib/invariant.js +4 -1
  939. package/node_modules/@deepseek-ai/dsh-session/lib/types/fork.js +28 -0
  940. package/node_modules/@deepseek-ai/dsh-session/lib/types/index.js +56 -61
  941. package/node_modules/@deepseek-ai/dsh-session/lib/types/invariant.js +5 -1
  942. package/node_modules/@deepseek-ai/dsh-session/lib/types/known-event-types.js +1 -0
  943. package/node_modules/@deepseek-ai/dsh-session/lib/types/repair.js +52 -23
  944. package/node_modules/@deepseek-ai/dsh-session/lib/types/surface.js +73 -17
  945. package/node_modules/@deepseek-ai/dsh-session/lib/types/types.js +1 -1
  946. package/node_modules/@deepseek-ai/dsh-session/package.json +15 -11
  947. package/node_modules/@deepseek-ai/dsh-session-checkpoint-policy/package.json +18 -18
  948. package/node_modules/@deepseek-ai/dsh-session-format/package.json +4 -4
  949. package/node_modules/@deepseek-ai/dsh-session-format-catalog/README.i18n.yaml +2 -2
  950. package/node_modules/@deepseek-ai/dsh-session-format-catalog/README.md +5 -1
  951. package/node_modules/@deepseek-ai/dsh-session-format-catalog/README.zh.md +5 -1
  952. package/node_modules/@deepseek-ai/dsh-session-format-catalog/lib/index.js +55 -10
  953. package/node_modules/@deepseek-ai/dsh-session-format-catalog/lib/types/children.js +17 -0
  954. package/node_modules/@deepseek-ai/dsh-session-format-catalog/lib/types/generated.js +25 -11
  955. package/node_modules/@deepseek-ai/dsh-session-format-catalog/lib/types/historical.js +20 -0
  956. package/node_modules/@deepseek-ai/dsh-session-format-catalog/lib/types/index.js +2 -0
  957. package/node_modules/@deepseek-ai/dsh-session-format-catalog/package.json +11 -10
  958. package/node_modules/@deepseek-ai/dsh-session-format-v0-to-v1/package.json +6 -6
  959. package/node_modules/@deepseek-ai/dsh-session-format-v1-to-v2/package.json +8 -8
  960. package/node_modules/@deepseek-ai/dsh-session-format-v2-to-v3/package.json +6 -6
  961. package/node_modules/@deepseek-ai/dsh-session-format-v3-to-v4/README.i18n.yaml +6 -0
  962. package/node_modules/@deepseek-ai/dsh-session-format-v3-to-v4/README.md +350 -0
  963. package/node_modules/@deepseek-ai/dsh-session-format-v3-to-v4/README.zh.md +350 -0
  964. package/node_modules/@deepseek-ai/dsh-session-format-v3-to-v4/lib/index.js +1552 -0
  965. package/node_modules/@deepseek-ai/dsh-session-format-v3-to-v4/package.json +51 -0
  966. package/node_modules/@deepseek-ai/dsh-session-log-deepseek/lib/index.js +1 -0
  967. package/node_modules/@deepseek-ai/dsh-session-log-deepseek/lib/types/index.js +1 -0
  968. package/node_modules/@deepseek-ai/dsh-session-log-deepseek/package.json +19 -19
  969. package/node_modules/@deepseek-ai/dsh-session-log-export/README.i18n.yaml +2 -2
  970. package/node_modules/@deepseek-ai/dsh-session-log-export/README.md +6 -2
  971. package/node_modules/@deepseek-ai/dsh-session-log-export/README.zh.md +6 -2
  972. package/node_modules/@deepseek-ai/dsh-session-log-export/lib/client.js +43 -20
  973. package/node_modules/@deepseek-ai/dsh-session-log-export/lib/index.js +48 -17
  974. package/node_modules/@deepseek-ai/dsh-session-log-export/package.json +25 -23
  975. package/node_modules/@deepseek-ai/dsh-session-persistence/lib/index.js +2 -0
  976. package/node_modules/@deepseek-ai/dsh-session-persistence/package.json +11 -11
  977. package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/README.i18n.yaml +2 -2
  978. package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/README.md +6 -2
  979. package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/README.zh.md +6 -2
  980. package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/lib/index.js +210 -45
  981. package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/lib/worker.cjs +1456 -313
  982. package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/package.json +14 -14
  983. package/node_modules/@deepseek-ai/dsh-session-projection/package.json +5 -5
  984. package/node_modules/@deepseek-ai/dsh-session-projection-cache/README.i18n.yaml +2 -2
  985. package/node_modules/@deepseek-ai/dsh-session-projection-cache/README.md +2 -2
  986. package/node_modules/@deepseek-ai/dsh-session-projection-cache/README.zh.md +2 -2
  987. package/node_modules/@deepseek-ai/dsh-session-projection-cache/lib/index.js +71 -51
  988. package/node_modules/@deepseek-ai/dsh-session-projection-cache/package.json +13 -13
  989. package/node_modules/@deepseek-ai/dsh-session-query/lib/index.js +4 -5
  990. package/node_modules/@deepseek-ai/dsh-session-query/package.json +20 -20
  991. package/node_modules/@deepseek-ai/dsh-session-query-sqlite/package.json +13 -13
  992. package/node_modules/@deepseek-ai/dsh-session-reference/lib/index.js +5 -5
  993. package/node_modules/@deepseek-ai/dsh-session-reference/lib/typert.host.js +47 -19
  994. package/node_modules/@deepseek-ai/dsh-session-reference/lib/typert.remote-client.js +1 -1
  995. package/node_modules/@deepseek-ai/dsh-session-reference/lib/types/index.js +3 -7
  996. package/node_modules/@deepseek-ai/dsh-session-reference/lib/types/projection.js +1 -0
  997. package/node_modules/@deepseek-ai/dsh-session-reference/package.json +39 -39
  998. package/node_modules/@deepseek-ai/dsh-session-stats/package.json +11 -11
  999. package/node_modules/@deepseek-ai/dsh-session-telemetry/README.i18n.yaml +2 -2
  1000. package/node_modules/@deepseek-ai/dsh-session-telemetry/README.md +1 -1
  1001. package/node_modules/@deepseek-ai/dsh-session-telemetry/README.zh.md +1 -1
  1002. package/node_modules/@deepseek-ai/dsh-session-telemetry/lib/index.js +6 -5
  1003. package/node_modules/@deepseek-ai/dsh-session-telemetry/package.json +7 -7
  1004. package/node_modules/@deepseek-ai/dsh-session-telemetry-otel/package.json +23 -23
  1005. package/node_modules/@deepseek-ai/dsh-session-title/package.json +19 -19
  1006. package/node_modules/@deepseek-ai/dsh-session-title-first-prompt-llm/package.json +17 -17
  1007. package/node_modules/@deepseek-ai/dsh-session-title-llm/lib/index.js +1 -4
  1008. package/node_modules/@deepseek-ai/dsh-session-title-llm/package.json +13 -13
  1009. package/node_modules/@deepseek-ai/dsh-session-turn-outline/package.json +11 -11
  1010. package/node_modules/@deepseek-ai/dsh-settings/README.i18n.yaml +2 -2
  1011. package/node_modules/@deepseek-ai/dsh-settings/README.md +19 -96
  1012. package/node_modules/@deepseek-ai/dsh-settings/README.zh.md +25 -102
  1013. package/node_modules/@deepseek-ai/dsh-settings/lib/index.js +360 -426
  1014. package/node_modules/@deepseek-ai/dsh-settings/lib/types/index.js +271 -512
  1015. package/node_modules/@deepseek-ai/dsh-settings/lib/types/redact.js +14 -8
  1016. package/node_modules/@deepseek-ai/dsh-settings/lib/types/schema.js +85 -0
  1017. package/node_modules/@deepseek-ai/dsh-settings/lib/types/types.js +1 -9
  1018. package/node_modules/@deepseek-ai/dsh-settings/package.json +21 -17
  1019. package/node_modules/@deepseek-ai/dsh-shell/README.i18n.yaml +2 -2
  1020. package/node_modules/@deepseek-ai/dsh-shell/README.md +17 -10
  1021. package/node_modules/@deepseek-ai/dsh-shell/README.zh.md +17 -10
  1022. package/node_modules/@deepseek-ai/dsh-shell/lib/index.js +19 -21
  1023. package/node_modules/@deepseek-ai/dsh-shell/package.json +7 -9
  1024. package/node_modules/@deepseek-ai/dsh-shell-env/README.i18n.yaml +2 -2
  1025. package/node_modules/@deepseek-ai/dsh-shell-env/README.md +5 -5
  1026. package/node_modules/@deepseek-ai/dsh-shell-env/README.zh.md +5 -5
  1027. package/node_modules/@deepseek-ai/dsh-shell-env/lib/index.js +10 -1
  1028. package/node_modules/@deepseek-ai/dsh-shell-env/package.json +14 -12
  1029. package/node_modules/@deepseek-ai/dsh-skill/package.json +9 -9
  1030. package/node_modules/@deepseek-ai/dsh-skill-badge/package.json +5 -5
  1031. package/node_modules/@deepseek-ai/dsh-skill-filesystem/package.json +10 -10
  1032. package/node_modules/@deepseek-ai/dsh-skill-office/README.i18n.yaml +6 -0
  1033. package/node_modules/@deepseek-ai/dsh-skill-office/README.md +100 -0
  1034. package/node_modules/@deepseek-ai/dsh-skill-office/README.zh.md +100 -0
  1035. package/node_modules/@deepseek-ai/dsh-skill-office/assets/office-docx/SKILL.md +46 -0
  1036. package/node_modules/@deepseek-ai/dsh-skill-office/assets/office-pptx/SKILL.md +70 -0
  1037. package/node_modules/@deepseek-ai/dsh-skill-office/assets/office-xlsx/SKILL.md +56 -0
  1038. package/node_modules/@deepseek-ai/dsh-skill-office/assets/scripts/check_office.py +279 -0
  1039. package/node_modules/@deepseek-ai/dsh-skill-office/lib/index.js +80 -0
  1040. package/node_modules/@deepseek-ai/dsh-skill-office/package.json +43 -0
  1041. package/node_modules/@deepseek-ai/dsh-spill/package.json +9 -9
  1042. package/node_modules/@deepseek-ai/dsh-spill-local/package.json +11 -11
  1043. package/node_modules/@deepseek-ai/dsh-spill-policy/package.json +21 -21
  1044. package/node_modules/@deepseek-ai/dsh-storage/package.json +3 -3
  1045. package/node_modules/@deepseek-ai/dsh-storage-domain/package.json +8 -8
  1046. package/node_modules/@deepseek-ai/dsh-storage-json/package.json +6 -6
  1047. package/node_modules/@deepseek-ai/dsh-subagent/README.i18n.yaml +2 -2
  1048. package/node_modules/@deepseek-ai/dsh-subagent/README.md +9 -6
  1049. package/node_modules/@deepseek-ai/dsh-subagent/README.zh.md +9 -6
  1050. package/node_modules/@deepseek-ai/dsh-subagent/lib/index.js +301 -239
  1051. package/node_modules/@deepseek-ai/dsh-subagent/lib/typert.host.js +60 -89
  1052. package/node_modules/@deepseek-ai/dsh-subagent/lib/typert.remote-client.js +2 -56
  1053. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/archive-admission.js +151 -0
  1054. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/catalog.js +12 -6
  1055. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/control-types.js +2 -3
  1056. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/control.js +2 -40
  1057. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/index.js +29 -91
  1058. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/lifecycle.js +14 -19
  1059. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/list-children.js +45 -49
  1060. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/projection.js +10 -4
  1061. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/run-settlement.js +1 -1
  1062. package/node_modules/@deepseek-ai/dsh-subagent/package.json +57 -54
  1063. package/node_modules/@deepseek-ai/dsh-subagent-acp/package.json +24 -24
  1064. package/node_modules/@deepseek-ai/dsh-subagent-fork-in-process/package.json +18 -18
  1065. package/node_modules/@deepseek-ai/dsh-subagent-in-process-driver/package.json +26 -26
  1066. package/node_modules/@deepseek-ai/dsh-subagent-spawn-in-process/package.json +20 -20
  1067. package/node_modules/@deepseek-ai/dsh-subprocess/package.json +6 -6
  1068. package/node_modules/@deepseek-ai/dsh-subprocess-local/package.json +9 -9
  1069. package/node_modules/@deepseek-ai/dsh-system-prompt/lib/index.js +3 -3
  1070. package/node_modules/@deepseek-ai/dsh-system-prompt/package.json +10 -10
  1071. package/node_modules/@deepseek-ai/dsh-terminal/package.json +8 -8
  1072. package/node_modules/@deepseek-ai/dsh-terminal-bash/package.json +20 -20
  1073. package/node_modules/@deepseek-ai/dsh-time-context/lib/index.js +2 -3
  1074. package/node_modules/@deepseek-ai/dsh-time-context/lib/invariant.js +4 -4
  1075. package/node_modules/@deepseek-ai/dsh-time-context/package.json +23 -23
  1076. package/node_modules/@deepseek-ai/dsh-timeout/package.json +3 -3
  1077. package/node_modules/@deepseek-ai/dsh-tmux-context/lib/index.js +35 -57
  1078. package/node_modules/@deepseek-ai/dsh-tmux-context/package.json +14 -14
  1079. package/node_modules/@deepseek-ai/dsh-token-meter/lib/index.js +0 -7
  1080. package/node_modules/@deepseek-ai/dsh-token-meter/lib/types/estimate.js +0 -3
  1081. package/node_modules/@deepseek-ai/dsh-token-meter/lib/types/surface-fold.js +0 -5
  1082. package/node_modules/@deepseek-ai/dsh-token-meter/package.json +17 -17
  1083. package/node_modules/@deepseek-ai/dsh-tool-ask-user/package.json +11 -11
  1084. package/node_modules/@deepseek-ai/dsh-tool-bash/README.i18n.yaml +2 -2
  1085. package/node_modules/@deepseek-ai/dsh-tool-bash/README.md +16 -10
  1086. package/node_modules/@deepseek-ai/dsh-tool-bash/README.zh.md +16 -10
  1087. package/node_modules/@deepseek-ai/dsh-tool-bash/lib/index.js +421 -183
  1088. package/node_modules/@deepseek-ai/dsh-tool-bash/package.json +32 -32
  1089. package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/README.i18n.yaml +2 -2
  1090. package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/README.md +1 -1
  1091. package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/README.zh.md +1 -1
  1092. package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/lib/index.js +9 -3
  1093. package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/package.json +22 -22
  1094. package/node_modules/@deepseek-ai/dsh-tool-call-timeout-policy/package.json +9 -9
  1095. package/node_modules/@deepseek-ai/dsh-tool-cordis/README.i18n.yaml +2 -2
  1096. package/node_modules/@deepseek-ai/dsh-tool-cordis/README.md +6 -5
  1097. package/node_modules/@deepseek-ai/dsh-tool-cordis/README.zh.md +6 -5
  1098. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/index.js +4 -9980
  1099. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/api-catalog.js +7809 -0
  1100. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/config.js +93 -0
  1101. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/host.js +17 -0
  1102. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/index.js +57 -0
  1103. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/present.js +16 -0
  1104. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/providers.js +85 -0
  1105. package/node_modules/@deepseek-ai/dsh-tool-cordis/package.json +21 -12
  1106. package/node_modules/@deepseek-ai/dsh-tool-fs/package.json +30 -30
  1107. package/node_modules/@deepseek-ai/dsh-tool-fs-search/package.json +23 -23
  1108. package/node_modules/@deepseek-ai/dsh-tool-goal/lib/index.js +1 -2
  1109. package/node_modules/@deepseek-ai/dsh-tool-goal/package.json +20 -20
  1110. package/node_modules/@deepseek-ai/dsh-tool-jobs/README.i18n.yaml +2 -2
  1111. package/node_modules/@deepseek-ai/dsh-tool-jobs/README.md +9 -8
  1112. package/node_modules/@deepseek-ai/dsh-tool-jobs/README.zh.md +10 -9
  1113. package/node_modules/@deepseek-ai/dsh-tool-jobs/lib/index.js +110 -51
  1114. package/node_modules/@deepseek-ai/dsh-tool-jobs/package.json +18 -18
  1115. package/node_modules/@deepseek-ai/dsh-tool-present/README.i18n.yaml +2 -2
  1116. package/node_modules/@deepseek-ai/dsh-tool-present/README.md +1 -1
  1117. package/node_modules/@deepseek-ai/dsh-tool-present/README.zh.md +1 -1
  1118. package/node_modules/@deepseek-ai/dsh-tool-present/lib/index.js +1 -1
  1119. package/node_modules/@deepseek-ai/dsh-tool-present/lib/types/index.js +5 -4
  1120. package/node_modules/@deepseek-ai/dsh-tool-present/package.json +20 -20
  1121. package/node_modules/@deepseek-ai/dsh-tool-pwsh/README.i18n.yaml +2 -2
  1122. package/node_modules/@deepseek-ai/dsh-tool-pwsh/README.md +10 -5
  1123. package/node_modules/@deepseek-ai/dsh-tool-pwsh/README.zh.md +10 -5
  1124. package/node_modules/@deepseek-ai/dsh-tool-pwsh/lib/index.js +440 -207
  1125. package/node_modules/@deepseek-ai/dsh-tool-pwsh/package.json +31 -31
  1126. package/node_modules/@deepseek-ai/dsh-tool-pwsh-persistent/README.i18n.yaml +2 -2
  1127. package/node_modules/@deepseek-ai/dsh-tool-pwsh-persistent/README.md +1 -1
  1128. package/node_modules/@deepseek-ai/dsh-tool-pwsh-persistent/README.zh.md +1 -1
  1129. package/node_modules/@deepseek-ai/dsh-tool-pwsh-persistent/lib/index.js +9 -3
  1130. package/node_modules/@deepseek-ai/dsh-tool-pwsh-persistent/package.json +23 -23
  1131. package/node_modules/@deepseek-ai/dsh-tool-ralph/package.json +23 -23
  1132. package/node_modules/@deepseek-ai/dsh-tool-skill/package.json +15 -15
  1133. package/node_modules/@deepseek-ai/dsh-tool-str-replace-editor/package.json +20 -20
  1134. package/node_modules/@deepseek-ai/dsh-tool-subagent/README.i18n.yaml +2 -2
  1135. package/node_modules/@deepseek-ai/dsh-tool-subagent/README.md +1 -1
  1136. package/node_modules/@deepseek-ai/dsh-tool-subagent/README.zh.md +1 -1
  1137. package/node_modules/@deepseek-ai/dsh-tool-subagent/lib/index.js +2 -2
  1138. package/node_modules/@deepseek-ai/dsh-tool-subagent/lib/model-selection-settings.js +12 -38
  1139. package/node_modules/@deepseek-ai/dsh-tool-subagent/package.json +30 -32
  1140. package/node_modules/@deepseek-ai/dsh-tool-subagent-control/README.i18n.yaml +2 -2
  1141. package/node_modules/@deepseek-ai/dsh-tool-subagent-control/README.md +4 -4
  1142. package/node_modules/@deepseek-ai/dsh-tool-subagent-control/README.zh.md +4 -4
  1143. package/node_modules/@deepseek-ai/dsh-tool-subagent-control/lib/index.js +1 -1
  1144. package/node_modules/@deepseek-ai/dsh-tool-subagent-control/lib/types/index.js +1 -1
  1145. package/node_modules/@deepseek-ai/dsh-tool-subagent-control/lib/types/list-agents.js +10 -20
  1146. package/node_modules/@deepseek-ai/dsh-tool-subagent-control/package.json +21 -21
  1147. package/node_modules/@deepseek-ai/dsh-tool-todo/package.json +20 -20
  1148. package/node_modules/@deepseek-ai/dsh-tool-web/package.json +21 -21
  1149. package/node_modules/@deepseek-ai/dsh-tool-workflow/README.i18n.yaml +2 -2
  1150. package/node_modules/@deepseek-ai/dsh-tool-workflow/README.md +21 -8
  1151. package/node_modules/@deepseek-ai/dsh-tool-workflow/README.zh.md +21 -8
  1152. package/node_modules/@deepseek-ai/dsh-tool-workflow/lib/index.js +179 -11
  1153. package/node_modules/@deepseek-ai/dsh-tool-workflow/lib/types/index.js +147 -14
  1154. package/node_modules/@deepseek-ai/dsh-tool-workflow/lib/types/record.js +43 -0
  1155. package/node_modules/@deepseek-ai/dsh-tool-workflow/package.json +25 -21
  1156. package/node_modules/@deepseek-ai/dsh-tool-workspace-dependencies/README.i18n.yaml +6 -0
  1157. package/node_modules/@deepseek-ai/dsh-tool-workspace-dependencies/README.md +128 -0
  1158. package/node_modules/@deepseek-ai/dsh-tool-workspace-dependencies/README.zh.md +128 -0
  1159. package/node_modules/@deepseek-ai/dsh-tool-workspace-dependencies/lib/index.js +252 -0
  1160. package/node_modules/@deepseek-ai/dsh-tool-workspace-dependencies/package.json +44 -0
  1161. package/node_modules/@deepseek-ai/dsh-tools/README.i18n.yaml +2 -2
  1162. package/node_modules/@deepseek-ai/dsh-tools/README.md +4 -0
  1163. package/node_modules/@deepseek-ai/dsh-tools/README.zh.md +4 -0
  1164. package/node_modules/@deepseek-ai/dsh-tools/lib/index.js +5 -6
  1165. package/node_modules/@deepseek-ai/dsh-tools/lib/types/index.js +2 -1
  1166. package/node_modules/@deepseek-ai/dsh-tools/lib/types/ptc.js +1 -1
  1167. package/node_modules/@deepseek-ai/dsh-tools/lib/types/schema.js +1 -0
  1168. package/node_modules/@deepseek-ai/dsh-tools/package.json +27 -27
  1169. package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +2 -2
  1170. package/node_modules/@deepseek-ai/dsh-tui-app/README.md +10 -10
  1171. package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +10 -10
  1172. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +510 -113
  1173. package/node_modules/@deepseek-ai/dsh-tui-app/package.json +75 -75
  1174. package/node_modules/@deepseek-ai/dsh-typert-loader/lib/index.js +1 -0
  1175. package/node_modules/@deepseek-ai/dsh-typert-loader/package.json +9 -9
  1176. package/node_modules/@deepseek-ai/dsh-typert-protocol/README.i18n.yaml +2 -2
  1177. package/node_modules/@deepseek-ai/dsh-typert-protocol/README.md +7 -2
  1178. package/node_modules/@deepseek-ai/dsh-typert-protocol/README.zh.md +7 -2
  1179. package/node_modules/@deepseek-ai/dsh-typert-protocol/lib/index.js +66 -3
  1180. package/node_modules/@deepseek-ai/dsh-typert-protocol/lib/types/index.js +20 -2
  1181. package/node_modules/@deepseek-ai/dsh-typert-protocol/lib/types/json-value.js +61 -0
  1182. package/node_modules/@deepseek-ai/dsh-typert-protocol/package.json +6 -3
  1183. package/node_modules/@deepseek-ai/dsh-typert-registry/lib/client.js +3 -0
  1184. package/node_modules/@deepseek-ai/dsh-typert-registry/lib/index.js +3 -0
  1185. package/node_modules/@deepseek-ai/dsh-typert-registry/lib/types/service.js +6 -0
  1186. package/node_modules/@deepseek-ai/dsh-typert-registry/package.json +4 -4
  1187. package/node_modules/@deepseek-ai/dsh-user-approval/lib/index.js +1 -4
  1188. package/node_modules/@deepseek-ai/dsh-user-approval/lib/invariant.js +1 -4
  1189. package/node_modules/@deepseek-ai/dsh-user-approval/lib/types/index.js +1 -1
  1190. package/node_modules/@deepseek-ai/dsh-user-approval/package.json +18 -18
  1191. package/node_modules/@deepseek-ai/dsh-user-questions/package.json +9 -9
  1192. package/node_modules/@deepseek-ai/dsh-util-crypto/package.json +3 -3
  1193. package/node_modules/@deepseek-ai/dsh-util-time/package.json +3 -3
  1194. package/node_modules/@deepseek-ai/dsh-util-values/package.json +3 -3
  1195. package/node_modules/@deepseek-ai/dsh-util-workspace-path/package.json +3 -3
  1196. package/node_modules/@deepseek-ai/dsh-web/package.json +6 -6
  1197. package/node_modules/@deepseek-ai/dsh-web-app/README.i18n.yaml +2 -2
  1198. package/node_modules/@deepseek-ai/dsh-web-app/README.md +9 -6
  1199. package/node_modules/@deepseek-ai/dsh-web-app/README.zh.md +9 -6
  1200. package/node_modules/@deepseek-ai/dsh-web-app/cordis.patch.yml +51 -29
  1201. package/node_modules/@deepseek-ai/dsh-web-app/lib/index.js +293 -1
  1202. package/node_modules/@deepseek-ai/dsh-web-app/package.json +150 -102
  1203. package/node_modules/@deepseek-ai/dsh-web-app/presets/cordis.patch.yml +154 -0
  1204. package/node_modules/@deepseek-ai/dsh-web-app/presets/minimal.patch.yml +61 -0
  1205. package/node_modules/@deepseek-ai/dsh-web-app/presets/ptc.patch.yml +152 -0
  1206. package/node_modules/@deepseek-ai/dsh-web-app/presets/standard.patch.yml +146 -0
  1207. package/node_modules/@deepseek-ai/dsh-web-fetch-http/package.json +10 -10
  1208. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-DU8FBaxM.js +127 -0
  1209. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Uv-aF9RH.css +1 -0
  1210. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/favicon-dark.svg +3 -0
  1211. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/favicon.svg +0 -5
  1212. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/index.html +4 -3
  1213. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/manifest.webmanifest +3 -4
  1214. package/node_modules/@deepseek-ai/dsh-web-frontend/package.json +15 -10
  1215. package/node_modules/@deepseek-ai/dsh-web-search-deepseek/README.i18n.yaml +2 -2
  1216. package/node_modules/@deepseek-ai/dsh-web-search-deepseek/README.md +4 -4
  1217. package/node_modules/@deepseek-ai/dsh-web-search-deepseek/README.zh.md +4 -4
  1218. package/node_modules/@deepseek-ai/dsh-web-search-deepseek/lib/index.js +21 -29
  1219. package/node_modules/@deepseek-ai/dsh-web-search-deepseek/package.json +16 -18
  1220. package/node_modules/@deepseek-ai/dsh-web-search-exa/package.json +9 -9
  1221. package/node_modules/@deepseek-ai/dsh-web-search-perplexity/package.json +9 -9
  1222. package/node_modules/@deepseek-ai/dsh-webhook/lib/index.js +121 -50
  1223. package/node_modules/@deepseek-ai/dsh-webhook/lib/types/session.js +111 -46
  1224. package/node_modules/@deepseek-ai/dsh-webhook/package.json +25 -25
  1225. package/node_modules/@deepseek-ai/dsh-webhook-github/package.json +15 -15
  1226. package/node_modules/@deepseek-ai/dsh-win32-process/package.json +4 -4
  1227. package/node_modules/@deepseek-ai/dsh-workflow/package.json +13 -13
  1228. package/node_modules/@deepseek-ai/dsh-workflow-ptc/package.json +36 -36
  1229. package/node_modules/@deepseek-ai/dsh-workspace/README.i18n.yaml +2 -2
  1230. package/node_modules/@deepseek-ai/dsh-workspace/README.md +16 -4
  1231. package/node_modules/@deepseek-ai/dsh-workspace/README.zh.md +17 -4
  1232. package/node_modules/@deepseek-ai/dsh-workspace/lib/index.js +166 -25
  1233. package/node_modules/@deepseek-ai/dsh-workspace/lib/invariant.js +8 -3
  1234. package/node_modules/@deepseek-ai/dsh-workspace/lib/types/index.js +185 -21
  1235. package/node_modules/@deepseek-ai/dsh-workspace/lib/types/spec.js +11 -4
  1236. package/node_modules/@deepseek-ai/dsh-workspace/package.json +16 -16
  1237. package/node_modules/@deepseek-ai/dsh-workspace-changes/package.json +16 -16
  1238. package/node_modules/@deepseek-ai/schemastery/README.md +4 -0
  1239. package/node_modules/@deepseek-ai/schemastery/lib/index.cjs +40 -1
  1240. package/node_modules/@deepseek-ai/schemastery/lib/index.mjs +41 -2
  1241. package/node_modules/@deepseek-ai/schemastery/package.json +2 -2
  1242. package/node_modules/@deepseek-ai/schemastery/src/index.ts +93 -33
  1243. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +0 -1
  1244. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +0 -1
  1245. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +0 -1
  1246. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +0 -1
  1247. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +0 -1
  1248. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +0 -2
  1249. package/node_modules/@eslint-community/regexpp/LICENSE +21 -0
  1250. package/node_modules/@eslint-community/regexpp/README.md +177 -0
  1251. package/node_modules/@eslint-community/regexpp/index.js +3042 -0
  1252. package/node_modules/@eslint-community/regexpp/index.mjs +3032 -0
  1253. package/node_modules/@eslint-community/regexpp/package.json +71 -0
  1254. package/node_modules/ajv/.runkit_example.js +23 -0
  1255. package/node_modules/ajv/LICENSE +22 -0
  1256. package/node_modules/ajv/README.md +207 -0
  1257. package/node_modules/ajv/dist/2019.js +61 -0
  1258. package/node_modules/ajv/dist/2020.js +55 -0
  1259. package/node_modules/ajv/dist/ajv.js +50 -0
  1260. package/node_modules/ajv/dist/compile/codegen/code.js +156 -0
  1261. package/node_modules/ajv/dist/compile/codegen/index.js +697 -0
  1262. package/node_modules/ajv/dist/compile/codegen/scope.js +143 -0
  1263. package/node_modules/ajv/dist/compile/errors.js +123 -0
  1264. package/node_modules/ajv/dist/compile/index.js +242 -0
  1265. package/node_modules/ajv/dist/compile/jtd/parse.js +350 -0
  1266. package/node_modules/ajv/dist/compile/jtd/serialize.js +236 -0
  1267. package/node_modules/ajv/dist/compile/jtd/types.js +14 -0
  1268. package/node_modules/ajv/dist/compile/names.js +28 -0
  1269. package/node_modules/ajv/dist/compile/ref_error.js +12 -0
  1270. package/node_modules/ajv/dist/compile/resolve.js +155 -0
  1271. package/node_modules/ajv/dist/compile/rules.js +26 -0
  1272. package/node_modules/ajv/dist/compile/util.js +178 -0
  1273. package/node_modules/ajv/dist/compile/validate/applicability.js +19 -0
  1274. package/node_modules/ajv/dist/compile/validate/boolSchema.js +50 -0
  1275. package/node_modules/ajv/dist/compile/validate/dataType.js +203 -0
  1276. package/node_modules/ajv/dist/compile/validate/defaults.js +35 -0
  1277. package/node_modules/ajv/dist/compile/validate/index.js +520 -0
  1278. package/node_modules/ajv/dist/compile/validate/keyword.js +124 -0
  1279. package/node_modules/ajv/dist/compile/validate/subschema.js +81 -0
  1280. package/node_modules/ajv/dist/core.js +618 -0
  1281. package/node_modules/ajv/dist/jtd.js +72 -0
  1282. package/node_modules/ajv/dist/refs/data.json +13 -0
  1283. package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js +28 -0
  1284. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json +53 -0
  1285. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json +17 -0
  1286. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json +57 -0
  1287. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json +14 -0
  1288. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json +37 -0
  1289. package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json +90 -0
  1290. package/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json +39 -0
  1291. package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +30 -0
  1292. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json +48 -0
  1293. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json +17 -0
  1294. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json +51 -0
  1295. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
  1296. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json +37 -0
  1297. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
  1298. package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json +90 -0
  1299. package/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json +55 -0
  1300. package/node_modules/ajv/dist/refs/json-schema-draft-06.json +137 -0
  1301. package/node_modules/ajv/dist/refs/json-schema-draft-07.json +151 -0
  1302. package/node_modules/ajv/dist/refs/json-schema-secure.json +88 -0
  1303. package/node_modules/ajv/dist/refs/jtd-schema.js +118 -0
  1304. package/node_modules/ajv/dist/runtime/equal.js +7 -0
  1305. package/node_modules/ajv/dist/runtime/parseJson.js +185 -0
  1306. package/node_modules/ajv/dist/runtime/quote.js +30 -0
  1307. package/node_modules/ajv/dist/runtime/re2.js +6 -0
  1308. package/node_modules/ajv/dist/runtime/timestamp.js +42 -0
  1309. package/node_modules/ajv/dist/runtime/ucs2length.js +24 -0
  1310. package/node_modules/ajv/dist/runtime/uri.js +6 -0
  1311. package/node_modules/ajv/dist/runtime/validation_error.js +11 -0
  1312. package/node_modules/ajv/dist/standalone/index.js +90 -0
  1313. package/node_modules/ajv/dist/standalone/instance.js +35 -0
  1314. package/node_modules/ajv/dist/types/index.js +3 -0
  1315. package/node_modules/ajv/dist/types/json-schema.js +3 -0
  1316. package/node_modules/ajv/dist/types/jtd-schema.js +3 -0
  1317. package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +49 -0
  1318. package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +106 -0
  1319. package/node_modules/ajv/dist/vocabularies/applicator/allOf.js +23 -0
  1320. package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +12 -0
  1321. package/node_modules/ajv/dist/vocabularies/applicator/contains.js +95 -0
  1322. package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +85 -0
  1323. package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +11 -0
  1324. package/node_modules/ajv/dist/vocabularies/applicator/if.js +66 -0
  1325. package/node_modules/ajv/dist/vocabularies/applicator/index.js +44 -0
  1326. package/node_modules/ajv/dist/vocabularies/applicator/items.js +52 -0
  1327. package/node_modules/ajv/dist/vocabularies/applicator/items2020.js +30 -0
  1328. package/node_modules/ajv/dist/vocabularies/applicator/not.js +26 -0
  1329. package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +60 -0
  1330. package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +75 -0
  1331. package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +12 -0
  1332. package/node_modules/ajv/dist/vocabularies/applicator/properties.js +54 -0
  1333. package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +38 -0
  1334. package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +13 -0
  1335. package/node_modules/ajv/dist/vocabularies/code.js +131 -0
  1336. package/node_modules/ajv/dist/vocabularies/core/id.js +10 -0
  1337. package/node_modules/ajv/dist/vocabularies/core/index.js +16 -0
  1338. package/node_modules/ajv/dist/vocabularies/core/ref.js +122 -0
  1339. package/node_modules/ajv/dist/vocabularies/discriminator/index.js +104 -0
  1340. package/node_modules/ajv/dist/vocabularies/discriminator/types.js +9 -0
  1341. package/node_modules/ajv/dist/vocabularies/draft2020.js +23 -0
  1342. package/node_modules/ajv/dist/vocabularies/draft7.js +17 -0
  1343. package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +30 -0
  1344. package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +51 -0
  1345. package/node_modules/ajv/dist/vocabularies/dynamic/index.js +9 -0
  1346. package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +16 -0
  1347. package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +10 -0
  1348. package/node_modules/ajv/dist/vocabularies/errors.js +3 -0
  1349. package/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
  1350. package/node_modules/ajv/dist/vocabularies/format/index.js +6 -0
  1351. package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js +71 -0
  1352. package/node_modules/ajv/dist/vocabularies/jtd/elements.js +24 -0
  1353. package/node_modules/ajv/dist/vocabularies/jtd/enum.js +43 -0
  1354. package/node_modules/ajv/dist/vocabularies/jtd/error.js +20 -0
  1355. package/node_modules/ajv/dist/vocabularies/jtd/index.js +29 -0
  1356. package/node_modules/ajv/dist/vocabularies/jtd/metadata.js +25 -0
  1357. package/node_modules/ajv/dist/vocabularies/jtd/nullable.js +22 -0
  1358. package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js +15 -0
  1359. package/node_modules/ajv/dist/vocabularies/jtd/properties.js +149 -0
  1360. package/node_modules/ajv/dist/vocabularies/jtd/ref.js +67 -0
  1361. package/node_modules/ajv/dist/vocabularies/jtd/type.js +69 -0
  1362. package/node_modules/ajv/dist/vocabularies/jtd/union.js +12 -0
  1363. package/node_modules/ajv/dist/vocabularies/jtd/values.js +51 -0
  1364. package/node_modules/ajv/dist/vocabularies/metadata.js +18 -0
  1365. package/node_modules/ajv/dist/vocabularies/next.js +8 -0
  1366. package/node_modules/ajv/dist/vocabularies/unevaluated/index.js +7 -0
  1367. package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +40 -0
  1368. package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +65 -0
  1369. package/node_modules/ajv/dist/vocabularies/validation/const.js +25 -0
  1370. package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +12 -0
  1371. package/node_modules/ajv/dist/vocabularies/validation/enum.js +48 -0
  1372. package/node_modules/ajv/dist/vocabularies/validation/index.js +33 -0
  1373. package/node_modules/ajv/dist/vocabularies/validation/limitContains.js +15 -0
  1374. package/node_modules/ajv/dist/vocabularies/validation/limitItems.js +24 -0
  1375. package/node_modules/ajv/dist/vocabularies/validation/limitLength.js +27 -0
  1376. package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +27 -0
  1377. package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +24 -0
  1378. package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +26 -0
  1379. package/node_modules/ajv/dist/vocabularies/validation/pattern.js +33 -0
  1380. package/node_modules/ajv/dist/vocabularies/validation/required.js +79 -0
  1381. package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +64 -0
  1382. package/node_modules/ajv/lib/2019.ts +81 -0
  1383. package/node_modules/ajv/lib/2020.ts +75 -0
  1384. package/node_modules/ajv/lib/ajv.ts +70 -0
  1385. package/node_modules/ajv/lib/compile/codegen/code.ts +169 -0
  1386. package/node_modules/ajv/lib/compile/codegen/index.ts +852 -0
  1387. package/node_modules/ajv/lib/compile/codegen/scope.ts +215 -0
  1388. package/node_modules/ajv/lib/compile/errors.ts +184 -0
  1389. package/node_modules/ajv/lib/compile/index.ts +324 -0
  1390. package/node_modules/ajv/lib/compile/jtd/parse.ts +411 -0
  1391. package/node_modules/ajv/lib/compile/jtd/serialize.ts +277 -0
  1392. package/node_modules/ajv/lib/compile/jtd/types.ts +16 -0
  1393. package/node_modules/ajv/lib/compile/names.ts +27 -0
  1394. package/node_modules/ajv/lib/compile/ref_error.ts +13 -0
  1395. package/node_modules/ajv/lib/compile/resolve.ts +149 -0
  1396. package/node_modules/ajv/lib/compile/rules.ts +50 -0
  1397. package/node_modules/ajv/lib/compile/util.ts +213 -0
  1398. package/node_modules/ajv/lib/compile/validate/applicability.ts +22 -0
  1399. package/node_modules/ajv/lib/compile/validate/boolSchema.ts +47 -0
  1400. package/node_modules/ajv/lib/compile/validate/dataType.ts +230 -0
  1401. package/node_modules/ajv/lib/compile/validate/defaults.ts +32 -0
  1402. package/node_modules/ajv/lib/compile/validate/index.ts +582 -0
  1403. package/node_modules/ajv/lib/compile/validate/keyword.ts +171 -0
  1404. package/node_modules/ajv/lib/compile/validate/subschema.ts +135 -0
  1405. package/node_modules/ajv/lib/core.ts +892 -0
  1406. package/node_modules/ajv/lib/jtd.ts +132 -0
  1407. package/node_modules/ajv/lib/refs/data.json +13 -0
  1408. package/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts +28 -0
  1409. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json +53 -0
  1410. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json +17 -0
  1411. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json +57 -0
  1412. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json +14 -0
  1413. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json +37 -0
  1414. package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json +90 -0
  1415. package/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json +39 -0
  1416. package/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts +30 -0
  1417. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json +48 -0
  1418. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json +17 -0
  1419. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json +51 -0
  1420. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
  1421. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json +37 -0
  1422. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
  1423. package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json +90 -0
  1424. package/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json +55 -0
  1425. package/node_modules/ajv/lib/refs/json-schema-draft-06.json +137 -0
  1426. package/node_modules/ajv/lib/refs/json-schema-draft-07.json +151 -0
  1427. package/node_modules/ajv/lib/refs/json-schema-secure.json +88 -0
  1428. package/node_modules/ajv/lib/refs/jtd-schema.ts +130 -0
  1429. package/node_modules/ajv/lib/runtime/equal.ts +7 -0
  1430. package/node_modules/ajv/lib/runtime/parseJson.ts +177 -0
  1431. package/node_modules/ajv/lib/runtime/quote.ts +31 -0
  1432. package/node_modules/ajv/lib/runtime/re2.ts +6 -0
  1433. package/node_modules/ajv/lib/runtime/timestamp.ts +46 -0
  1434. package/node_modules/ajv/lib/runtime/ucs2length.ts +20 -0
  1435. package/node_modules/ajv/lib/runtime/uri.ts +6 -0
  1436. package/node_modules/ajv/lib/runtime/validation_error.ts +13 -0
  1437. package/node_modules/ajv/lib/standalone/index.ts +100 -0
  1438. package/node_modules/ajv/lib/standalone/instance.ts +36 -0
  1439. package/node_modules/ajv/lib/types/index.ts +244 -0
  1440. package/node_modules/ajv/lib/types/json-schema.ts +187 -0
  1441. package/node_modules/ajv/lib/types/jtd-schema.ts +273 -0
  1442. package/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts +56 -0
  1443. package/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +118 -0
  1444. package/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +22 -0
  1445. package/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts +14 -0
  1446. package/node_modules/ajv/lib/vocabularies/applicator/contains.ts +109 -0
  1447. package/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts +112 -0
  1448. package/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts +11 -0
  1449. package/node_modules/ajv/lib/vocabularies/applicator/if.ts +80 -0
  1450. package/node_modules/ajv/lib/vocabularies/applicator/index.ts +53 -0
  1451. package/node_modules/ajv/lib/vocabularies/applicator/items.ts +59 -0
  1452. package/node_modules/ajv/lib/vocabularies/applicator/items2020.ts +36 -0
  1453. package/node_modules/ajv/lib/vocabularies/applicator/not.ts +38 -0
  1454. package/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts +82 -0
  1455. package/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts +91 -0
  1456. package/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts +12 -0
  1457. package/node_modules/ajv/lib/vocabularies/applicator/properties.ts +57 -0
  1458. package/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts +50 -0
  1459. package/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts +13 -0
  1460. package/node_modules/ajv/lib/vocabularies/code.ts +168 -0
  1461. package/node_modules/ajv/lib/vocabularies/core/id.ts +10 -0
  1462. package/node_modules/ajv/lib/vocabularies/core/index.ts +16 -0
  1463. package/node_modules/ajv/lib/vocabularies/core/ref.ts +129 -0
  1464. package/node_modules/ajv/lib/vocabularies/discriminator/index.ts +113 -0
  1465. package/node_modules/ajv/lib/vocabularies/discriminator/types.ts +12 -0
  1466. package/node_modules/ajv/lib/vocabularies/draft2020.ts +23 -0
  1467. package/node_modules/ajv/lib/vocabularies/draft7.ts +17 -0
  1468. package/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts +31 -0
  1469. package/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts +51 -0
  1470. package/node_modules/ajv/lib/vocabularies/dynamic/index.ts +9 -0
  1471. package/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts +14 -0
  1472. package/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts +10 -0
  1473. package/node_modules/ajv/lib/vocabularies/errors.ts +18 -0
  1474. package/node_modules/ajv/lib/vocabularies/format/format.ts +120 -0
  1475. package/node_modules/ajv/lib/vocabularies/format/index.ts +6 -0
  1476. package/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts +89 -0
  1477. package/node_modules/ajv/lib/vocabularies/jtd/elements.ts +32 -0
  1478. package/node_modules/ajv/lib/vocabularies/jtd/enum.ts +45 -0
  1479. package/node_modules/ajv/lib/vocabularies/jtd/error.ts +23 -0
  1480. package/node_modules/ajv/lib/vocabularies/jtd/index.ts +37 -0
  1481. package/node_modules/ajv/lib/vocabularies/jtd/metadata.ts +24 -0
  1482. package/node_modules/ajv/lib/vocabularies/jtd/nullable.ts +21 -0
  1483. package/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts +15 -0
  1484. package/node_modules/ajv/lib/vocabularies/jtd/properties.ts +184 -0
  1485. package/node_modules/ajv/lib/vocabularies/jtd/ref.ts +76 -0
  1486. package/node_modules/ajv/lib/vocabularies/jtd/type.ts +75 -0
  1487. package/node_modules/ajv/lib/vocabularies/jtd/union.ts +12 -0
  1488. package/node_modules/ajv/lib/vocabularies/jtd/values.ts +58 -0
  1489. package/node_modules/ajv/lib/vocabularies/metadata.ts +17 -0
  1490. package/node_modules/ajv/lib/vocabularies/next.ts +8 -0
  1491. package/node_modules/ajv/lib/vocabularies/unevaluated/index.ts +7 -0
  1492. package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts +47 -0
  1493. package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +85 -0
  1494. package/node_modules/ajv/lib/vocabularies/validation/const.ts +28 -0
  1495. package/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts +23 -0
  1496. package/node_modules/ajv/lib/vocabularies/validation/enum.ts +54 -0
  1497. package/node_modules/ajv/lib/vocabularies/validation/index.ts +49 -0
  1498. package/node_modules/ajv/lib/vocabularies/validation/limitContains.ts +16 -0
  1499. package/node_modules/ajv/lib/vocabularies/validation/limitItems.ts +26 -0
  1500. package/node_modules/ajv/lib/vocabularies/validation/limitLength.ts +30 -0
  1501. package/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts +42 -0
  1502. package/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts +26 -0
  1503. package/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts +34 -0
  1504. package/node_modules/ajv/lib/vocabularies/validation/pattern.ts +39 -0
  1505. package/node_modules/ajv/lib/vocabularies/validation/required.ts +98 -0
  1506. package/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts +79 -0
  1507. package/node_modules/ajv/package.json +104 -0
  1508. package/node_modules/fast-uri/.gitattributes +2 -0
  1509. package/node_modules/fast-uri/.github/dependabot.yml +13 -0
  1510. package/node_modules/fast-uri/.github/workflows/ci.yml +106 -0
  1511. package/node_modules/fast-uri/.github/workflows/lock-threads.yml +19 -0
  1512. package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +24 -0
  1513. package/node_modules/fast-uri/LICENSE +30 -0
  1514. package/node_modules/fast-uri/README.md +152 -0
  1515. package/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
  1516. package/node_modules/fast-uri/benchmark/equal.mjs +51 -0
  1517. package/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
  1518. package/node_modules/fast-uri/benchmark/package.json +17 -0
  1519. package/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
  1520. package/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
  1521. package/node_modules/fast-uri/eslint.config.js +6 -0
  1522. package/node_modules/fast-uri/index.js +631 -0
  1523. package/node_modules/fast-uri/lib/schemes.js +272 -0
  1524. package/node_modules/fast-uri/lib/utils.js +747 -0
  1525. package/node_modules/fast-uri/package.json +56 -0
  1526. package/node_modules/fast-uri/test/ajv.test.js +43 -0
  1527. package/node_modules/fast-uri/test/component-safe-serialization.test.js +163 -0
  1528. package/node_modules/fast-uri/test/equal.test.js +145 -0
  1529. package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +503 -0
  1530. package/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
  1531. package/node_modules/fast-uri/test/ipv6-canonical.test.js +34 -0
  1532. package/node_modules/fast-uri/test/ipv6-validation.test.js +124 -0
  1533. package/node_modules/fast-uri/test/malformed-percent.test.js +77 -0
  1534. package/node_modules/fast-uri/test/malformed-urn.test.js +61 -0
  1535. package/node_modules/fast-uri/test/parse.test.js +327 -0
  1536. package/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
  1537. package/node_modules/fast-uri/test/reserved-path-normalization.test.js +109 -0
  1538. package/node_modules/fast-uri/test/resolve.test.js +87 -0
  1539. package/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
  1540. package/node_modules/fast-uri/test/scheme-validation.test.js +124 -0
  1541. package/node_modules/fast-uri/test/security-normalization.test.js +178 -0
  1542. package/node_modules/fast-uri/test/security.test.js +431 -0
  1543. package/node_modules/fast-uri/test/serialize.test.js +151 -0
  1544. package/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
  1545. package/node_modules/fast-uri/test/uri-js.test.js +912 -0
  1546. package/node_modules/fast-uri/test/urn-full-input.test.js +29 -0
  1547. package/node_modules/fast-uri/test/util.test.js +38 -0
  1548. package/node_modules/fast-uri/test/websocket-query-preservation.test.js +24 -0
  1549. package/node_modules/fast-uri/tsconfig.json +9 -0
  1550. package/node_modules/fast-uri/types/index.test-d.ts +17 -0
  1551. package/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
  1552. package/node_modules/json-schema-traverse/.github/FUNDING.yml +2 -0
  1553. package/node_modules/json-schema-traverse/.github/workflows/build.yml +28 -0
  1554. package/node_modules/json-schema-traverse/.github/workflows/publish.yml +27 -0
  1555. package/node_modules/json-schema-traverse/LICENSE +21 -0
  1556. package/node_modules/json-schema-traverse/README.md +95 -0
  1557. package/node_modules/json-schema-traverse/index.js +93 -0
  1558. package/node_modules/json-schema-traverse/package.json +38 -0
  1559. package/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
  1560. package/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
  1561. package/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
  1562. package/node_modules/require-from-string/index.js +34 -0
  1563. package/node_modules/require-from-string/license +21 -0
  1564. package/node_modules/require-from-string/package.json +25 -0
  1565. package/node_modules/require-from-string/readme.md +56 -0
  1566. package/node_modules/sherpa-onnx-node/README.md +11 -0
  1567. package/node_modules/sherpa-onnx-node/addon-static-import.js +70 -0
  1568. package/node_modules/sherpa-onnx-node/addon.js +98 -0
  1569. package/node_modules/sherpa-onnx-node/audio-tagg.js +45 -0
  1570. package/node_modules/sherpa-onnx-node/keyword-spotter.js +68 -0
  1571. package/node_modules/sherpa-onnx-node/non-streaming-asr.js +158 -0
  1572. package/node_modules/sherpa-onnx-node/non-streaming-speaker-diarization.js +38 -0
  1573. package/node_modules/sherpa-onnx-node/non-streaming-speech-denoiser.js +32 -0
  1574. package/node_modules/sherpa-onnx-node/non-streaming-tts.js +116 -0
  1575. package/node_modules/sherpa-onnx-node/online-speech-denoiser.js +46 -0
  1576. package/node_modules/sherpa-onnx-node/package.json +56 -0
  1577. package/node_modules/sherpa-onnx-node/punctuation.js +43 -0
  1578. package/node_modules/sherpa-onnx-node/resampler.js +80 -0
  1579. package/node_modules/sherpa-onnx-node/sherpa-onnx.js +49 -0
  1580. package/node_modules/sherpa-onnx-node/speaker-identification.js +152 -0
  1581. package/node_modules/sherpa-onnx-node/spoken-language-identification.js +38 -0
  1582. package/node_modules/sherpa-onnx-node/streaming-asr.js +181 -0
  1583. package/node_modules/sherpa-onnx-node/types.js +788 -0
  1584. package/node_modules/sherpa-onnx-node/vad.js +134 -0
  1585. package/package.json +318 -272
  1586. package/node_modules/@bufbuild/protobuf/README.md +0 -41
  1587. package/node_modules/@bufbuild/protobuf/dist/commonjs/clone.js +0 -66
  1588. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/boot.js +0 -18
  1589. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/enum.js +0 -31
  1590. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/extension.js +0 -28
  1591. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/file.js +0 -18
  1592. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/index.js +0 -39
  1593. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/message.js +0 -24
  1594. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/service.js +0 -27
  1595. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/symbols.js +0 -43
  1596. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/types.js +0 -15
  1597. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/boot.js +0 -105
  1598. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/embed.js +0 -244
  1599. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/enum.js +0 -58
  1600. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/extension.js +0 -28
  1601. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/file.js +0 -35
  1602. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/index.js +0 -39
  1603. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/message.js +0 -24
  1604. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/restore-json-names.js +0 -29
  1605. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/scalar.js +0 -67
  1606. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/service.js +0 -27
  1607. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/symbols.js +0 -74
  1608. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/types.js +0 -15
  1609. package/node_modules/@bufbuild/protobuf/dist/commonjs/create.js +0 -296
  1610. package/node_modules/@bufbuild/protobuf/dist/commonjs/descriptors.js +0 -53
  1611. package/node_modules/@bufbuild/protobuf/dist/commonjs/equals.js +0 -209
  1612. package/node_modules/@bufbuild/protobuf/dist/commonjs/extensions.js +0 -168
  1613. package/node_modules/@bufbuild/protobuf/dist/commonjs/fields.js +0 -45
  1614. package/node_modules/@bufbuild/protobuf/dist/commonjs/from-binary.js +0 -415
  1615. package/node_modules/@bufbuild/protobuf/dist/commonjs/from-json.js +0 -1037
  1616. package/node_modules/@bufbuild/protobuf/dist/commonjs/index.js +0 -55
  1617. package/node_modules/@bufbuild/protobuf/dist/commonjs/is-message.js +0 -33
  1618. package/node_modules/@bufbuild/protobuf/dist/commonjs/json-value.js +0 -15
  1619. package/node_modules/@bufbuild/protobuf/dist/commonjs/merge.js +0 -70
  1620. package/node_modules/@bufbuild/protobuf/dist/commonjs/package.json +0 -4
  1621. package/node_modules/@bufbuild/protobuf/dist/commonjs/proto-int64.js +0 -131
  1622. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/error.js +0 -36
  1623. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/guard.js +0 -78
  1624. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/index.js +0 -41
  1625. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/message.js +0 -157
  1626. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/names.js +0 -115
  1627. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/nested-types.js +0 -110
  1628. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/path.js +0 -376
  1629. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-check.js +0 -292
  1630. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-types.js +0 -16
  1631. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect.js +0 -469
  1632. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/scalar.js +0 -129
  1633. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/unsafe.js +0 -149
  1634. package/node_modules/@bufbuild/protobuf/dist/commonjs/registry.js +0 -954
  1635. package/node_modules/@bufbuild/protobuf/dist/commonjs/to-binary.js +0 -437
  1636. package/node_modules/@bufbuild/protobuf/dist/commonjs/to-json.js +0 -625
  1637. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/from-text.js +0 -684
  1638. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/index.js +0 -21
  1639. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/is-group-like.js +0 -47
  1640. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/reader.js +0 -481
  1641. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/to-text.js +0 -358
  1642. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/writer.js +0 -220
  1643. package/node_modules/@bufbuild/protobuf/dist/commonjs/types.js +0 -15
  1644. package/node_modules/@bufbuild/protobuf/dist/commonjs/unknown-enum.js +0 -26
  1645. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/base64-encoding.js +0 -188
  1646. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/binary-encoding.js +0 -726
  1647. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/index.js +0 -37
  1648. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/size-delimited.js +0 -191
  1649. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-encoding.js +0 -106
  1650. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-format.js +0 -199
  1651. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/varint.js +0 -334
  1652. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/any.js +0 -75
  1653. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/duration.js +0 -39
  1654. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/any_pb.js +0 -27
  1655. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/api_pb.js +0 -39
  1656. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/compiler/plugin_pb.js +0 -68
  1657. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/cpp_features_pb.js +0 -60
  1658. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/descriptor_pb.js +0 -892
  1659. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/duration_pb.js +0 -27
  1660. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/empty_pb.js +0 -27
  1661. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/field_mask_pb.js +0 -27
  1662. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/go_features_pb.js +0 -126
  1663. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/java_features_pb.js +0 -106
  1664. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/source_context_pb.js +0 -27
  1665. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/struct_pb.js +0 -59
  1666. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/timestamp_pb.js +0 -27
  1667. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/type_pb.js +0 -242
  1668. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/wrappers_pb.js +0 -67
  1669. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/index.js +0 -48
  1670. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/json.js +0 -44
  1671. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/timestamp.js +0 -57
  1672. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/wrappers.js +0 -66
  1673. package/node_modules/@bufbuild/protobuf/dist/esm/clone.js +0 -63
  1674. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/boot.js +0 -14
  1675. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/enum.js +0 -26
  1676. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/extension.js +0 -25
  1677. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/file.js +0 -14
  1678. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/index.js +0 -23
  1679. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/message.js +0 -21
  1680. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/service.js +0 -24
  1681. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/symbols.js +0 -40
  1682. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/types.js +0 -14
  1683. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.js +0 -101
  1684. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/embed.js +0 -239
  1685. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/enum.js +0 -53
  1686. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/extension.js +0 -25
  1687. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js +0 -32
  1688. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.js +0 -23
  1689. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/message.js +0 -21
  1690. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/restore-json-names.js +0 -26
  1691. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/scalar.js +0 -63
  1692. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/service.js +0 -24
  1693. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/symbols.js +0 -71
  1694. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/types.js +0 -14
  1695. package/node_modules/@bufbuild/protobuf/dist/esm/create.js +0 -293
  1696. package/node_modules/@bufbuild/protobuf/dist/esm/descriptors.js +0 -50
  1697. package/node_modules/@bufbuild/protobuf/dist/esm/equals.js +0 -206
  1698. package/node_modules/@bufbuild/protobuf/dist/esm/extensions.js +0 -159
  1699. package/node_modules/@bufbuild/protobuf/dist/esm/fields.js +0 -41
  1700. package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +0 -409
  1701. package/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +0 -1029
  1702. package/node_modules/@bufbuild/protobuf/dist/esm/index.js +0 -29
  1703. package/node_modules/@bufbuild/protobuf/dist/esm/is-message.js +0 -30
  1704. package/node_modules/@bufbuild/protobuf/dist/esm/json-value.js +0 -14
  1705. package/node_modules/@bufbuild/protobuf/dist/esm/merge.js +0 -67
  1706. package/node_modules/@bufbuild/protobuf/dist/esm/package.json +0 -4
  1707. package/node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js +0 -128
  1708. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/error.js +0 -31
  1709. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.js +0 -71
  1710. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/index.js +0 -21
  1711. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/message.js +0 -152
  1712. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/names.js +0 -109
  1713. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/nested-types.js +0 -105
  1714. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/path.js +0 -369
  1715. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.js +0 -284
  1716. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-types.js +0 -14
  1717. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +0 -464
  1718. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/scalar.js +0 -124
  1719. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/unsafe.js +0 -140
  1720. package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +0 -948
  1721. package/node_modules/@bufbuild/protobuf/dist/esm/to-binary.js +0 -433
  1722. package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +0 -620
  1723. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/from-text.js +0 -680
  1724. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/index.js +0 -15
  1725. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/is-group-like.js +0 -44
  1726. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/reader.js +0 -477
  1727. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/to-text.js +0 -355
  1728. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/writer.js +0 -214
  1729. package/node_modules/@bufbuild/protobuf/dist/esm/types.js +0 -14
  1730. package/node_modules/@bufbuild/protobuf/dist/esm/unknown-enum.js +0 -23
  1731. package/node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.js +0 -184
  1732. package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +0 -721
  1733. package/node_modules/@bufbuild/protobuf/dist/esm/wire/index.js +0 -18
  1734. package/node_modules/@bufbuild/protobuf/dist/esm/wire/size-delimited.js +0 -186
  1735. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +0 -101
  1736. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-format.js +0 -195
  1737. package/node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js +0 -325
  1738. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/any.js +0 -69
  1739. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/duration.js +0 -35
  1740. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/any_pb.js +0 -24
  1741. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.js +0 -36
  1742. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js +0 -65
  1743. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/cpp_features_pb.js +0 -57
  1744. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +0 -888
  1745. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/duration_pb.js +0 -24
  1746. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/empty_pb.js +0 -24
  1747. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.js +0 -24
  1748. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +0 -123
  1749. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/java_features_pb.js +0 -103
  1750. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/source_context_pb.js +0 -24
  1751. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/struct_pb.js +0 -56
  1752. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js +0 -24
  1753. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.js +0 -239
  1754. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/wrappers_pb.js +0 -64
  1755. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/index.js +0 -32
  1756. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/json.js +0 -41
  1757. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/timestamp.js +0 -50
  1758. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js +0 -61
  1759. package/node_modules/@bufbuild/protobuf/package.json +0 -136
  1760. package/node_modules/@deepseek-ai/dsh-agent-presets/README.md +0 -195
  1761. package/node_modules/@deepseek-ai/dsh-agent-presets/README.zh.md +0 -195
  1762. package/node_modules/@deepseek-ai/dsh-agent-presets/lib/index.js +0 -1820
  1763. package/node_modules/@deepseek-ai/dsh-agent-presets/lib/invariant.js +0 -1838
  1764. package/node_modules/@deepseek-ai/dsh-agent-presets/lib/typert.remote-client.js +0 -207
  1765. package/node_modules/@deepseek-ai/dsh-agent-presets/lib/types/authoring.js +0 -176
  1766. package/node_modules/@deepseek-ai/dsh-agent-presets/lib/types/discovery.js +0 -316
  1767. package/node_modules/@deepseek-ai/dsh-agent-presets/lib/types/index.js +0 -799
  1768. package/node_modules/@deepseek-ai/dsh-agent-presets/lib/types/metadata.js +0 -92
  1769. package/node_modules/@deepseek-ai/dsh-agent-presets/lib/types/mount.js +0 -386
  1770. package/node_modules/@deepseek-ai/dsh-agent-presets/lib/types/preset.js +0 -11
  1771. package/node_modules/@deepseek-ai/dsh-agent-presets/lib/types/specifier.js +0 -41
  1772. package/node_modules/@deepseek-ai/dsh-agent-presets/package.json +0 -98
  1773. package/node_modules/@deepseek-ai/dsh-agent-presets/presets/cordis/agent.cordis.yml +0 -283
  1774. package/node_modules/@deepseek-ai/dsh-agent-presets/presets/cordis/preset.yml +0 -3
  1775. package/node_modules/@deepseek-ai/dsh-agent-presets/presets/cordis/skills/cordis-plugin-development/SKILL.md +0 -108
  1776. package/node_modules/@deepseek-ai/dsh-agent-presets/presets/cordis/skills/editing-cordis-compositions/SKILL.md +0 -102
  1777. package/node_modules/@deepseek-ai/dsh-agent-presets/presets/minimal/agent.cordis.yml +0 -69
  1778. package/node_modules/@deepseek-ai/dsh-agent-presets/presets/minimal/preset.yml +0 -3
  1779. package/node_modules/@deepseek-ai/dsh-agent-presets/presets/ptc/agent.cordis.yml +0 -287
  1780. package/node_modules/@deepseek-ai/dsh-agent-presets/presets/ptc/preset.yml +0 -3
  1781. package/node_modules/@deepseek-ai/dsh-agent-presets/presets/standard/agent.cordis.yml +0 -266
  1782. package/node_modules/@deepseek-ai/dsh-agent-presets/presets/standard/preset.yml +0 -3
  1783. package/node_modules/@deepseek-ai/dsh-api-authorization-controller/README.md +0 -138
  1784. package/node_modules/@deepseek-ai/dsh-api-authorization-controller/README.zh.md +0 -138
  1785. package/node_modules/@deepseek-ai/dsh-api-authorization-controller/lib/index.js +0 -501
  1786. package/node_modules/@deepseek-ai/dsh-api-authorization-controller/lib/typert.host.js +0 -350
  1787. package/node_modules/@deepseek-ai/dsh-api-authorization-controller/lib/typert.remote-client.js +0 -249
  1788. package/node_modules/@deepseek-ai/dsh-api-authorization-controller/lib/types/index.js +0 -424
  1789. package/node_modules/@deepseek-ai/dsh-api-authorization-controller/lib/types/types.js +0 -12
  1790. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/queue-mirror.js +0 -61
  1791. package/node_modules/@deepseek-ai/dsh-client-ui-settings-unarchive-sessions/README.md +0 -112
  1792. package/node_modules/@deepseek-ai/dsh-client-ui-settings-unarchive-sessions/README.zh.md +0 -112
  1793. package/node_modules/@deepseek-ai/dsh-client-ui-settings-unarchive-sessions/lib/client.js +0 -216
  1794. package/node_modules/@deepseek-ai/dsh-client-ui-settings-unarchive-sessions/lib/index.js +0 -6
  1795. package/node_modules/@deepseek-ai/dsh-client-ui-settings-unarchive-sessions/package.json +0 -66
  1796. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-web-profile/README.md +0 -98
  1797. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-web-profile/README.zh.md +0 -98
  1798. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-web-profile/cordis.patch.yml +0 -6
  1799. package/node_modules/@deepseek-ai/dsh-experimental-agent-team-web-profile/package.json +0 -47
  1800. package/node_modules/@deepseek-ai/dsh-llm-cursor/README.md +0 -142
  1801. package/node_modules/@deepseek-ai/dsh-llm-cursor/README.zh.md +0 -142
  1802. package/node_modules/@deepseek-ai/dsh-llm-cursor/lib/index.js +0 -3050
  1803. package/node_modules/@deepseek-ai/dsh-llm-cursor/package.json +0 -62
  1804. package/node_modules/@deepseek-ai/dsh-settings/lib/invariant.js +0 -35
  1805. package/node_modules/@deepseek-ai/dsh-settings/lib/types/invariant.js +0 -41
  1806. package/node_modules/@deepseek-ai/dsh-settings-file/README.md +0 -150
  1807. package/node_modules/@deepseek-ai/dsh-settings-file/README.zh.md +0 -150
  1808. package/node_modules/@deepseek-ai/dsh-settings-file/lib/index.js +0 -285
  1809. package/node_modules/@deepseek-ai/dsh-settings-file/package.json +0 -47
  1810. package/node_modules/@deepseek-ai/dsh-subprocess-local/lib/runner-launch-UEJ3Ntqn.js +0 -1511
  1811. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-8VXBH-f-.js +0 -127
  1812. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-lP1BfJ4l.css +0 -1
  1813. /package/node_modules/@deepseek-ai/{dsh-agent-presets → dsh-agent-preset-registry}/lib/types/types.js +0 -0
  1814. /package/node_modules/@deepseek-ai/{dsh-experimental-agent-team-web-profile → dsh-experimental-voice-input-bundle}/lib/index.js +0 -0
@@ -1,2016 +1,1165 @@
1
- import { CONTEXT_WINDOW_EXCEEDED_CODE, EMPTY_RESPONSE_CODE, IMAGE_OFFLOAD_REQUIRED_CODE, LlmAdapter, LlmError, ProviderRequestId, QUOTA_EXCEEDED_CODE, ReasoningEffortId, RetryPolicySchema, ToolCallId, assertUsableApiKey, attributionHeaders, contentHasImage, isContextWindowExceededError, isQuotaExceededError, offloadedImageText, projectOffloadedImages, requestImageHandleText, requiredImageOffload, resolveImageAttachmentAccess, resolveRetryPolicy, textOnlyImageText } from "@deepseek-ai/dsh-llm";
1
+ import { IMAGE_OFFLOAD_REQUIRED_CODE, LlmAdapter, LlmError, ProviderRequestId, ReasoningEffortId, RetryPolicySchema, ToolCallId, assertUsableApiKey, attributionHeaders, contentHasImage, isContextWindowExceededError, isQuotaExceededError, offloadedImageText, projectOffloadedImages, requestImageHandleText, requiredImageOffload, resolveImageAttachmentAccess, resolveRetryPolicy, textOnlyImageText } from "@deepseek-ai/dsh-llm";
2
2
  import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
3
- import { assertNever, deepEqualJson } from "@deepseek-ai/dsh-util-values";
3
+ import { deepEqualJson } from "@deepseek-ai/dsh-util-values";
4
4
  import { getOrCreateAnonymousUserId } from "@deepseek-ai/dsh-anonymous-user-id";
5
5
  import { MAX_TIMER_DELAY_MS, deadline, idleWatchdog, timeoutOf } from "@deepseek-ai/dsh-timeout";
6
- import { ImageVariantId, longEdgeDimensions, requestImageDimensions } from "@deepseek-ai/dsh-attachment";
7
- import { EventSourceParserStream } from "eventsource-parser/stream";
8
- import { brandString } from "@deepseek-ai/dsh-brand";
9
6
  import { createHash } from "node:crypto";
10
7
  import { mkdir, readFile } from "node:fs/promises";
11
8
  import { dirname, join } from "node:path";
12
9
  import { withFileLock, writeFileAtomic } from "@deepseek-ai/dsh-atomic-write";
13
10
  import { resolveDshHome } from "@deepseek-ai/dsh-home-paths";
11
+ import { ImageVariantId, longEdgeDimensions, requestImageDimensions } from "@deepseek-ai/dsh-attachment";
12
+ import { EventSourceParserStream } from "eventsource-parser/stream";
14
13
  import z from "@deepseek-ai/schemastery";
14
+ import { isVolatile } from "@deepseek-ai/cosmokit";
15
15
  import { credentialRef } from "@deepseek-ai/dsh-credentials";
16
- //#region lib/types/protocols/chat-completions/serialize.js
17
- /**
18
- * Serialize harness messages into DeepSeek chat completions. Text-only
19
- * requests retain string user content; the image path resolves durable
20
- * attachments into ordered file-id or inline parts. Tool-result images follow their
21
- * string-only tool messages in a separate user message.
22
- * @module dsh-llm-deepseek/serialize
23
- */
24
- const TOOL_RESULT_IMAGE_TEXT = "Attached image(s) from tool result:";
25
- /** Validate the adapter-owned effort before resolving its DeepSeek wire fields. */
26
- function reasoningEffort(effort) {
27
- if (effort === "off" || effort === "low" || effort === "high" || effort === "max") return effort;
28
- throw new LlmError(`DeepSeek does not support reasoning effort "${effort}"`, "UNSUPPORTED_REASONING_EFFORT");
29
- }
30
- /** Resolve one legal thinking/effort pair without exposing `off` as a wire effort. */
31
- function resolveThinking(options, defaults) {
32
- if (options.purpose === "session-title") return { thinking: "disabled" };
33
- const effort = options.reasoningEffort === void 0 ? defaults.reasoningEffort : reasoningEffort(options.reasoningEffort);
34
- if (defaults.thinking === "disabled" && effort !== void 0 && effort !== "off") throw new LlmError(`DeepSeek deployment does not support reasoning effort "${effort}"`, "UNSUPPORTED_REASONING_EFFORT");
35
- if (effort === "off") return { thinking: "disabled" };
36
- if (effort === "low" || effort === "high" || effort === "max") return {
37
- thinking: "enabled",
38
- reasoningEffort: effort
39
- };
40
- return defaults.thinking === void 0 ? {} : { thinking: defaults.thinking };
41
- }
42
- /** Join the text blocks of a message (used for user/tool-result content). */
43
- function flattenText(blocks) {
44
- return blocks.filter((block) => block.type === "text").map((block) => block.text).join("");
45
- }
46
- /** Reject core image content before any text-flattening path can silently erase it. */
47
- function assertTextOnly(blocks) {
48
- if (contentHasImage(blocks)) throw new LlmError("The DeepSeek chat-completions adapter does not support image content.", "UNSUPPORTED_CONTENT");
49
- }
50
- /** Reject roles whose DeepSeek history format cannot carry image input. */
51
- function assertSupportedImageRoles(messages) {
52
- for (const message of messages) if (message.role !== "user" && contentHasImage(message.content)) throw new LlmError(`The DeepSeek chat-completions adapter cannot represent image content in a ${message.role} message.`, "UNSUPPORTED_CONTENT");
53
- }
54
- /** Describe the exact request preview and its model-callable coordinate system. */
55
- function imageHandle(ref, version, resolveAccess, precededByContent) {
56
- return {
57
- type: "text",
58
- text: `${precededByContent ? "\n" : ""}${requestImageHandleText(ref, version, resolveAccess?.(ref))}`
59
- };
60
- }
61
- /** Resolve one durable image into its descriptor and transient DeepSeek image part. */
62
- async function imageParts(block, images, location, precededByContent) {
63
- const version = images.requestImages.get(block.attachment.attachmentId);
64
- if (version === void 0) throw new LlmError(`DeepSeek request image ${block.attachment.attachmentId} was not prepared.`, "INVALID_REQUEST");
65
- const image = images.representation.kind === "file" ? {
66
- type: "file",
67
- file_id: await images.representation.resolveFileId(version, block, location)
68
- } : {
69
- type: "image_url",
70
- image_url: { url: `data:${version.mediaType};base64,${Buffer.from(version.data).toString("base64")}` }
71
- };
72
- return [imageHandle(block.attachment, version, images.resolveImageAccess, precededByContent), image];
73
- }
74
- /** Convert user or nested tool-result blocks into ordered wire parts. */
75
- async function contentParts(blocks, images, message, nextImage) {
76
- const parts = [];
77
- for (const block of blocks) switch (block.type) {
78
- case "text":
79
- if (block.text.length > 0) parts.push({
80
- type: "text",
81
- text: block.text
82
- });
83
- break;
84
- case "image":
85
- nextImage.value += 1;
86
- parts.push(...await imageParts(block, images, {
87
- message,
88
- image: nextImage.value
89
- }, parts.length > 0));
90
- break;
91
- case "tool-result":
92
- parts.push(...await contentParts(block.content, images, message, nextImage));
93
- break;
94
- default: break;
95
- }
96
- return parts;
97
- }
98
- /** Keep text-only user messages on the compact string wire form. */
99
- function userContent(parts) {
100
- const text = [];
101
- for (const part of parts) {
102
- if (part.type !== "text") return [...parts];
103
- text.push(part.text);
16
+ //#region lib/types/model-info.js
17
+ /** Protocol-independent model capabilities and reasoning choices. */
18
+ const OFF_REASONING_EFFORT = ReasoningEffortId("off");
19
+ const LOW_REASONING_EFFORT = ReasoningEffortId("low");
20
+ const HIGH_REASONING_EFFORT = ReasoningEffortId("high");
21
+ const MAX_REASONING_EFFORT = ReasoningEffortId("max");
22
+ const REASONING_EFFORTS = [
23
+ {
24
+ id: OFF_REASONING_EFFORT,
25
+ name: "Off",
26
+ description: "Use for simple tasks that do not need reasoning."
27
+ },
28
+ {
29
+ id: LOW_REASONING_EFFORT,
30
+ name: "Low",
31
+ description: "Prefer for routine or latency-sensitive tasks."
32
+ },
33
+ {
34
+ id: HIGH_REASONING_EFFORT,
35
+ name: "High",
36
+ description: "The default balance for most tasks."
37
+ },
38
+ {
39
+ id: MAX_REASONING_EFFORT,
40
+ name: "Max",
41
+ description: "Reserve for the hardest quality-first tasks."
104
42
  }
105
- return text.join("");
106
- }
107
- /** Serialize one assistant message (text + reasoning + tool calls). */
108
- function serializeAssistant(message) {
109
- const text = flattenText(message.content);
110
- const reasoning = message.content.filter((block) => block.type === "reasoning").map((block) => block.text).join("");
111
- const toolCalls = message.content.filter((block) => block.type === "tool-call").map((block) => ({
112
- id: block.id,
113
- type: "function",
114
- function: {
115
- name: block.name,
116
- arguments: block.arguments
117
- }
118
- }));
43
+ ];
44
+ const OFF_ONLY_REASONING_EFFORTS = [{
45
+ id: OFF_REASONING_EFFORT,
46
+ name: "Off",
47
+ description: "Use for simple tasks that do not need reasoning."
48
+ }];
49
+ /** Advertise one catalog entry.
50
+ * @param provider - registered provider id.
51
+ * @param model - advisory catalog entry.
52
+ * @returns selector metadata.
53
+ */
54
+ function catalogModelInfo(provider, model) {
119
55
  return {
120
- role: "assistant",
121
- content: text,
122
- ...reasoning.length > 0 ? { reasoning_content: reasoning } : {},
123
- ...toolCalls.length > 0 ? { tool_calls: toolCalls } : {}
56
+ provider,
57
+ id: model.id,
58
+ name: model.name ?? model.id,
59
+ ...model.description === void 0 ? {} : { description: model.description },
60
+ inputModalities: model.inputModalities ?? ["text"]
124
61
  };
125
62
  }
126
- /**
127
- * Serialize the conversation. `tool-result` blocks become standalone
128
- * `{role: 'tool'}` messages; the harness puts each tool result in its own
129
- * user-role message, so a mixed user message contributes its text first and
130
- * its tool results as separate wire messages after.
131
- * @param messages - the harness conversation, in order.
132
- * @returns the wire messages; order preserved, each tool result expanded into its own entry.
133
- */
134
- function serializeMessages(messages) {
135
- const wire = [];
136
- for (const message of messages) {
137
- assertTextOnly(message.content);
138
- if (message.role === "system") {
139
- wire.push({
140
- role: "system",
141
- content: flattenText(message.content)
142
- });
143
- continue;
144
- }
145
- if (message.role === "assistant") {
146
- wire.push(serializeAssistant(message));
147
- continue;
148
- }
149
- const toolResults = message.content.filter((block) => block.type === "tool-result");
150
- const text = flattenText(message.content);
151
- if (text.length > 0 || toolResults.length === 0) wire.push({
152
- role: "user",
153
- content: text
154
- });
155
- for (const result of toolResults) wire.push({
156
- role: "tool",
157
- tool_call_id: result.toolCallId,
158
- content: flattenText(result.content) || "(no output)"
159
- });
160
- }
161
- return wire;
162
- }
163
- /**
164
- * Serialize image-capable history after resolving durable attachments.
165
- * Consecutive tool results keep string `tool` messages and share one following
166
- * user message containing their images.
167
- * @param messages - request history whose offloaded occurrences are already placeholder text.
168
- * @param images - prepared request versions, one provider representation, and its budget.
169
- * @returns ordered DeepSeek wire messages.
63
+ /** Resolve model capabilities against one configuration generation.
64
+ * @param connection - validated connection facts.
65
+ * @param provider - registered provider id.
66
+ * @param model - requested wire model id.
67
+ * @returns effective model metadata for this operation.
170
68
  */
171
- async function serializeMessagesWithImages(messages, images) {
172
- assertSupportedImageRoles(messages);
173
- const wire = [];
174
- let pendingToolImages = [];
175
- const flushToolImages = () => {
176
- if (pendingToolImages.length === 0) return;
177
- wire.push({
178
- role: "user",
179
- content: [{
180
- type: "text",
181
- text: TOOL_RESULT_IMAGE_TEXT
182
- }, ...pendingToolImages]
183
- });
184
- pendingToolImages = [];
185
- };
186
- for (const [messageIndex, message] of messages.entries()) {
187
- const nextImage = { value: 0 };
188
- if (message.role === "system") {
189
- flushToolImages();
190
- wire.push({
191
- role: "system",
192
- content: flattenText(message.content)
193
- });
194
- continue;
195
- }
196
- if (message.role === "assistant") {
197
- flushToolImages();
198
- wire.push(serializeAssistant(message));
199
- continue;
200
- }
201
- const regular = message.content.filter((block) => block.type !== "tool-result");
202
- const toolResults = message.content.filter((block) => block.type === "tool-result");
203
- const content = userContent(await contentParts(regular, images, messageIndex + 1, nextImage));
204
- if (content.length > 0 || toolResults.length === 0) {
205
- flushToolImages();
206
- wire.push({
207
- role: "user",
208
- content
209
- });
210
- }
211
- for (const result of toolResults) {
212
- const parts = await contentParts(result.content, images, messageIndex + 1, nextImage);
213
- const imageParts = parts.filter((part) => part.type !== "text");
214
- const text = parts.filter((part) => part.type === "text").map((part) => part.text).join("");
215
- wire.push({
216
- role: "tool",
217
- tool_call_id: result.toolCallId,
218
- content: text || "(no output)"
219
- });
220
- pendingToolImages.push(...imageParts);
221
- }
222
- }
223
- flushToolImages();
224
- return wire;
225
- }
226
- /** Assemble request fields shared by text-only and image-capable conversion. */
227
- function requestWithMessages(options, messages, defaults) {
228
- const tools = options.tools?.map((tool) => ({
229
- type: "function",
230
- function: {
231
- name: tool.name,
232
- description: tool.description,
233
- parameters: tool.parameters
234
- }
235
- }));
236
- const resolvedThinking = resolveThinking(options, defaults);
69
+ function modelInfo(connection, provider, model) {
70
+ const configured = connection.models.find((entry) => entry.id === model);
71
+ const contextWindow = configured?.contextWindow ?? connection.defaultContextWindow;
237
72
  return {
238
- model: options.model,
239
- messages,
240
- stream: true,
241
- stream_options: { include_usage: true },
242
- ...resolvedThinking.thinking !== void 0 ? { thinking: { type: resolvedThinking.thinking } } : {},
243
- ...resolvedThinking.reasoningEffort !== void 0 ? { reasoning_effort: resolvedThinking.reasoningEffort } : {},
244
- ...tools !== void 0 && tools.length > 0 ? { tools } : {},
245
- ...options.temperature !== void 0 ? { temperature: options.temperature } : {},
246
- ...options.maxTokens === void 0 ? {} : { max_tokens: options.maxTokens },
247
- ...options.stop !== void 0 ? { stop: options.stop } : {}
73
+ ...configured === void 0 ? {
74
+ provider,
75
+ id: model,
76
+ name: model,
77
+ inputModalities: ["text"]
78
+ } : catalogModelInfo(provider, configured),
79
+ context: { contextWindow },
80
+ defaultMaxTokens: configured?.maxTokens ?? connection.maxTokens,
81
+ ...configured?.systemPromptUpdate === void 0 ? {} : { systemPromptUpdate: configured.systemPromptUpdate },
82
+ ...connection.defaults.thinking === "disabled" ? { reasoning: {
83
+ efforts: OFF_ONLY_REASONING_EFFORTS,
84
+ defaultEffort: OFF_REASONING_EFFORT
85
+ } } : { reasoning: {
86
+ efforts: REASONING_EFFORTS,
87
+ defaultEffort: connection.defaults.reasoningEffort === "off" ? OFF_REASONING_EFFORT : connection.defaults.reasoningEffort === "low" ? LOW_REASONING_EFFORT : connection.defaults.reasoningEffort === "max" ? MAX_REASONING_EFFORT : HIGH_REASONING_EFFORT
88
+ } }
248
89
  };
249
90
  }
91
+ //#endregion
92
+ //#region lib/types/file-id.js
93
+ /** DeepSeek Files API identifiers. @module dsh-llm-deepseek/file-id */
250
94
  /**
251
- * Build the full wire request. Always streaming (`stream: true`, usage
252
- * reporting on); optional fields are omitted rather than sent as null, so
253
- * provider defaults apply.
254
- * @param options - the harness request (model, history, system, tools, sampling).
255
- * @param defaults - adapter-level thinking defaults; undefined fields put nothing on the wire.
256
- * @returns the chat-completions request body.
95
+ * Brand a provider-returned file identifier after wire validation.
96
+ * @param id - non-empty Files API identifier.
97
+ * @returns the same string with its provider identity attached at type level.
257
98
  */
258
- function serializeRequest(options, defaults = {}) {
259
- const messages = [];
260
- if (options.system !== void 0) messages.push({
261
- role: "system",
262
- content: options.system
263
- });
264
- messages.push(...serializeMessages(options.messages));
265
- return requestWithMessages(options, messages, defaults);
99
+ function DeepSeekFileId(id) {
100
+ return id;
266
101
  }
267
102
  /**
268
- * Reject a request whose retained occurrences, at their exact request-version
269
- * byte lengths under this representation, still exceed the route budget. The
270
- * failure names how many more oldest retained occurrences need durable
271
- * omission before the request can be retried.
103
+ * Brand a locally derived namespace digest.
104
+ * @param scope - SHA-256 digest of endpoint and API key.
105
+ * @returns the same string with namespace identity attached at type level.
272
106
  */
273
- function assertRetainedImagesFit(messages, images) {
274
- const representation = images.representation.kind === "file" ? "raw" : "base64";
275
- const offloadImages = requiredImageOffload(messages, {
276
- representation,
277
- maxBytes: images.maxRequestImageBytes,
278
- ...images.maxImagesPerRequest === void 0 ? {} : { maxImages: images.maxImagesPerRequest },
279
- ...images.byteQuantum === void 0 ? {} : { byteQuantum: images.byteQuantum },
280
- ...images.countQuantum === void 0 ? {} : { countQuantum: images.countQuantum }
281
- }, (block) => {
282
- const version = images.requestImages.get(block.attachment.attachmentId);
283
- if (version === void 0) throw new LlmError(`DeepSeek request image ${block.attachment.attachmentId} was not prepared.`, "INVALID_REQUEST");
284
- return version.bytes;
285
- });
286
- if (offloadImages > 0) throw new LlmError(`DeepSeek ${representation} request images exceed the route budget; ${offloadImages} more oldest occurrence(s) must be offloaded.`, IMAGE_OFFLOAD_REQUIRED_CODE, { offloadImages });
107
+ function DeepSeekFileScope(scope) {
108
+ return scope;
287
109
  }
110
+ //#endregion
111
+ //#region lib/types/messages-api.js
112
+ /** Shared DeepSeek Messages API endpoint and header policy. @module dsh-llm-deepseek/messages-api */
113
+ /** Required opt-in for Messages file operations and file-referenced image requests. */
114
+ const MESSAGES_FILES_BETA = "files-api-2025-04-14";
288
115
  /**
289
- * Build one image-capable request while keeping durable bytes out of session
290
- * messages. Offloaded occurrences become per-image text; retained occurrences
291
- * must fit the route budget at their exact request-version byte lengths.
292
- * @param options - harness request containing image-capable user content.
293
- * @param images - request versions, optional current access resolver, and request bounds.
294
- * @param defaults - adapter-level thinking defaults.
295
- * @returns the fully materialized DeepSeek request body.
116
+ * Resolve the API root without duplicating an explicit provider version path.
117
+ * @param baseURL - validated configured endpoint root.
118
+ * @returns the root beneath which Messages resources are exposed.
296
119
  */
297
- async function serializeRequestWithImages(options, images, defaults = {}) {
298
- assertSupportedImageRoles(options.messages);
299
- assertRetainedImagesFit(options.messages, images);
300
- const requestMessages = projectOffloadedImages(options.messages, (ref) => offloadedImageText(ref, images.resolveImageAccess?.(ref)));
301
- const messages = [];
302
- if (options.system !== void 0) messages.push({
303
- role: "system",
304
- content: options.system
305
- });
306
- messages.push(...await serializeMessagesWithImages(requestMessages, images));
307
- return requestWithMessages(options, messages, defaults);
120
+ function messagesApiRoot(baseURL) {
121
+ const base = baseURL.replace(/\/+$/u, "");
122
+ return new URL(base).pathname.endsWith("/v1") ? base : `${base}/v1`;
308
123
  }
309
124
  //#endregion
310
- //#region lib/types/common/image-tokens.js
125
+ //#region lib/types/files-api.js
126
+ /** DeepSeek Files API transport. @module dsh-llm-deepseek/files-api */
127
+ /** Minimum provider-supported file lifetime. */
128
+ const MIN_FILE_EXPIRY_SECONDS = 3600;
129
+ /** Maximum provider-supported file lifetime. */
130
+ const MAX_FILE_EXPIRY_SECONDS = 2592e3;
131
+ /** Maximum Files API upload size. */
132
+ const MAX_FILE_UPLOAD_BYTES = 128 * 1024 * 1024;
133
+ /** Current per-key file-count quota. */
134
+ const MAX_STORED_FILE_COUNT = 1e4;
135
+ /** Current per-key storage quota. */
136
+ const MAX_STORED_FILE_BYTES = 25 * 1024 * 1024 * 1024;
137
+ /** Files API operation failure with its HTTP status retained for recovery policy. */
138
+ var DeepSeekFilesError = class extends LlmError {
139
+ /** Parsed provider detail used only for error classification. */
140
+ detail;
141
+ /**
142
+ * @param message - user-readable provider failure.
143
+ * @param status - HTTP status returned by the Files API.
144
+ * @param detail - provider error fields joined for classification.
145
+ */
146
+ constructor(message, status, detail) {
147
+ super(message, status === 401 || status === 403 ? "AUTH" : status === 429 ? "RATE_LIMIT" : status >= 500 ? "SERVER" : "FILES_API", { status });
148
+ this.name = "DeepSeekFilesError";
149
+ this.detail = detail;
150
+ }
151
+ };
311
152
  /**
312
- * DeepSeek vision-token accounting: the provider's published image-token
313
- * calculator (api-docs.deepseek.com, Token & Token Usage) ported verbatim in
314
- * its current `v41` configuration. The provider scales an image below
315
- * 544×544 total pixels up, aligns it to a 14px-patch grid, downsamples 3:1
316
- * per axis into token cells, and caps one image at 1024 tokens by solving the
317
- * largest aspect-preserving grid inside that budget. The count is exact: this
318
- * configuration has no alignment pad and no aspect-ratio clamp. Actual usage
319
- * remains authoritative.
320
- *
321
- * @module dsh-llm-deepseek/image-tokens
153
+ * Whether an upload failure reports a provider storage or file-count quota.
154
+ * @param error - Files API operation failure.
155
+ * @returns whether one bounded remote cleanup and upload retry may recover.
322
156
  */
323
- /** Vision patch edge in pixels. */
324
- const PATCH_SIZE = 14;
325
- /** Per-axis patch-to-token downsampling ratio. */
326
- const DOWNSAMPLE_RATIO = 3;
327
- /** Provider cap on tokens for one request image. */
328
- const MAX_IMAGE_TOKENS = 1024;
329
- /** Total-pixel floor; smaller images are scaled up before grid projection. */
330
- const MIN_PIXELS = 544 * 544;
331
- /** Pixels covered by one token cell along either axis. */
332
- const CELL_SIZE = PATCH_SIZE * DOWNSAMPLE_RATIO;
333
- const intDiv = (value, divisor) => Math.floor(value / divisor);
334
- const ceilDiv = (value, divisor) => Math.floor((value + divisor - 1) / divisor);
335
- /** Token count of one grid: every row carries a separator, plus two framing tokens. */
336
- function gridTokens(gridHeight, gridWidth) {
337
- return gridHeight * (gridWidth + 1) + 2;
157
+ function isFilesQuotaError(error) {
158
+ return error instanceof DeepSeekFilesError && /(?:quota|storage|stored files|file count|too many files)/iu.test(error.detail);
338
159
  }
339
- /** Token-cell count along one padded pixel axis. */
340
- function gridCells(paddedLength) {
341
- return ceilDiv(intDiv(paddedLength, PATCH_SIZE), DOWNSAMPLE_RATIO);
160
+ function invalidResponse(operation) {
161
+ return new LlmError(`DeepSeek Files API returned an invalid ${operation} response.`, "INVALID_RESPONSE");
342
162
  }
343
- /** Solve the largest grid within `budget` tokens preserving the aspect ratio. */
344
- function solveResizeRatio(height, width, budget) {
345
- const aspect = height / width;
346
- const idealGridWidth = Math.sqrt((budget - 2) / aspect + .25) - .5;
347
- const idealGridHeight = idealGridWidth * aspect;
348
- let bestHeight;
349
- let bestWidth;
350
- if (idealGridWidth < 1) {
351
- const solvedGridWidth = 1;
352
- const solvedGridHeight = intDiv(budget - 2, 2);
353
- bestWidth = solvedGridWidth * CELL_SIZE;
354
- bestHeight = solvedGridHeight * CELL_SIZE;
355
- } else if (idealGridHeight < 1) {
356
- const solvedGridHeight = 1;
357
- bestWidth = (intDiv(budget - 2, solvedGridHeight) - 1) * CELL_SIZE;
358
- bestHeight = solvedGridHeight * CELL_SIZE;
359
- } else {
360
- const solvedGridWidth = Math.trunc(idealGridWidth);
361
- const solvedGridHeight = Math.trunc(idealGridHeight);
362
- const scale = Math.min(solvedGridWidth * CELL_SIZE / width, solvedGridHeight * CELL_SIZE / height);
363
- bestWidth = Math.trunc(width * scale / PATCH_SIZE) * PATCH_SIZE;
364
- bestHeight = Math.trunc(height * scale / PATCH_SIZE) * PATCH_SIZE;
163
+ /** Decode successful Files JSON with operation context; body transport and abort failures retain their identity. */
164
+ async function responseJson(response, operation) {
165
+ try {
166
+ return await response.json();
167
+ } catch (error) {
168
+ if (!(error instanceof SyntaxError)) throw error;
169
+ throw new LlmError(`DeepSeek Files API returned invalid JSON for ${operation} (HTTP ${response.status}).`, "INVALID_RESPONSE", {
170
+ status: response.status,
171
+ cause: error
172
+ });
365
173
  }
366
- const gridHeight = gridCells(bestHeight);
367
- const gridWidth = gridCells(bestWidth);
174
+ }
175
+ function parseFileObject(value, operation) {
176
+ if (value === null || typeof value !== "object" || Array.isArray(value)) throw invalidResponse(operation);
177
+ const wire = value;
178
+ const createdAt = typeof wire.created_at === "string" ? Math.floor(Date.parse(wire.created_at) / 1e3) : NaN;
179
+ if (typeof wire.id !== "string" || wire.id.length === 0 || wire.type !== "file" || typeof wire.mime_type !== "string" || typeof wire.size_bytes !== "number" || !Number.isSafeInteger(wire.size_bytes) || wire.size_bytes < 0 || !Number.isSafeInteger(createdAt) || createdAt < 0 || typeof wire.filename !== "string" || wire.filename.length === 0) throw invalidResponse(operation);
368
180
  return {
369
- gridHeight,
370
- gridWidth,
371
- bestHeight,
372
- bestWidth,
373
- numTokens: gridTokens(gridHeight, gridWidth)
181
+ id: DeepSeekFileId(wire.id),
182
+ bytes: wire.size_bytes,
183
+ createdAt,
184
+ filename: wire.filename
374
185
  };
375
186
  }
376
- /** Project padded pixel dimensions onto the largest in-budget token grid. */
377
- function safeResize(height, width, paddedHeight, paddedWidth) {
378
- const gridHeight = gridCells(paddedHeight);
379
- const gridWidth = gridCells(paddedWidth);
380
- const direct = {
381
- gridHeight,
382
- gridWidth,
383
- bestHeight: paddedHeight,
384
- bestWidth: paddedWidth,
385
- numTokens: gridTokens(gridHeight, gridWidth)
187
+ function providerErrorDetail$1(value) {
188
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return { detail: "" };
189
+ const error = value.error;
190
+ if (error === null || typeof error !== "object" || Array.isArray(error)) return { detail: "" };
191
+ const fields = error;
192
+ const message = typeof fields.message === "string" ? fields.message : void 0;
193
+ return {
194
+ ...message === void 0 ? {} : { message },
195
+ detail: [
196
+ fields.code,
197
+ fields.type,
198
+ fields.message
199
+ ].filter((field) => typeof field === "string").join(" ")
386
200
  };
387
- if (direct.numTokens <= MAX_IMAGE_TOKENS) return direct;
388
- const solved = solveResizeRatio(height, width, MAX_IMAGE_TOKENS);
389
- /* v8 ignore next 3 -- the published solver's assertion; the closed-form
390
- solve stays within the budget for every positive geometry. */
391
- if (solved.numTokens > MAX_IMAGE_TOKENS) throw new Error(`deepseek image tokens: no grid fits the token budget for ${width}x${height}`);
392
- return solved;
393
201
  }
394
- /** One scale-pad-project pass; the caller iterates it to a fixpoint. */
395
- function resizeOnce(width, height) {
396
- let scaledWidth = width;
397
- let scaledHeight = height;
398
- const pixels = scaledWidth * scaledHeight;
399
- if (pixels < MIN_PIXELS && pixels > 0) {
400
- const scale = Math.sqrt(MIN_PIXELS / pixels);
401
- scaledWidth = Math.trunc(scaledWidth * scale);
402
- scaledHeight = Math.trunc(scaledHeight * scale);
202
+ /** Direct Files client retaining the configured URL root and refusing redirects before credentials can leave its origin. */
203
+ var DeepSeekFilesClient = class {
204
+ baseURL;
205
+ accountCredential;
206
+ apiKey;
207
+ fetchImpl;
208
+ /**
209
+ * @param options - endpoint, API-key snapshot, and optional test transport.
210
+ */
211
+ constructor(options) {
212
+ this.apiKey = options.apiKey;
213
+ this.accountCredential = options.accountCredential === true;
214
+ this.fetchImpl = options.fetch ?? globalThis.fetch;
215
+ this.baseURL = messagesApiRoot(options.baseURL);
403
216
  }
404
- const paddedWidth = ceilDiv(scaledWidth, PATCH_SIZE) * PATCH_SIZE;
405
- const paddedHeight = ceilDiv(scaledHeight, PATCH_SIZE) * PATCH_SIZE;
406
- return safeResize(scaledHeight, scaledWidth, paddedHeight, paddedWidth);
407
- }
408
- function sameResize(a, b) {
409
- return a.gridHeight === b.gridHeight && a.gridWidth === b.gridWidth && a.bestHeight === b.bestHeight && a.bestWidth === b.bestWidth && a.numTokens === b.numTokens;
410
- }
411
- /**
412
- * Dimensions the harness sends so the provider keeps the whole image: the
413
- * source itself when its patch-padded grid fits the token cap, otherwise the
414
- * source aspect ratio at the solved grid's long edge. The provider pads the
415
- * short edge to whole patches on its side. Rounding the aspect-preserving
416
- * short edge can change the token count from the source's solved grid;
417
- * request pricing uses the sent dimensions. Small images are never enlarged.
418
- * @param width - positive integer source width in pixels.
419
- * @param height - positive integer source height in pixels.
420
- * @returns the request dimensions to encode.
421
- */
422
- function deepSeekRequestImageDimensions(width, height) {
423
- const paddedWidth = ceilDiv(width, PATCH_SIZE) * PATCH_SIZE;
424
- if (gridTokens(gridCells(ceilDiv(height, PATCH_SIZE) * PATCH_SIZE), gridCells(paddedWidth)) <= MAX_IMAGE_TOKENS) return {
425
- width,
426
- height
427
- };
428
- const solved = solveResizeRatio(height, width, MAX_IMAGE_TOKENS);
429
- return longEdgeDimensions(width, height, width >= height ? solved.bestWidth : solved.bestHeight);
430
- }
431
- /**
432
- * Vision tokens DeepSeek charges for one request image of the given
433
- * dimensions.
434
- * @param width - positive integer request-image width in pixels.
435
- * @param height - positive integer request-image height in pixels.
436
- * @returns the provider vision-token price, at most 1024.
437
- */
438
- function deepSeekImageTokens(width, height) {
439
- let result = resizeOnce(width, height);
440
- for (let iteration = 1; iteration < 10; iteration += 1) {
441
- const next = resizeOnce(result.bestWidth, result.bestHeight);
442
- if (sameResize(next, result)) return result.numTokens;
443
- result = next;
217
+ async request(path, init, signal) {
218
+ let response;
219
+ try {
220
+ const headers = new Headers(attributionHeaders());
221
+ headers.set(this.accountCredential ? "x-dsh-auth-token" : "x-api-key", this.apiKey);
222
+ headers.set("anthropic-version", "2023-06-01");
223
+ headers.set("anthropic-beta", MESSAGES_FILES_BETA);
224
+ response = await this.fetchImpl(`${this.baseURL}${path}`, {
225
+ ...init,
226
+ redirect: "error",
227
+ headers,
228
+ ...signal === void 0 ? {} : { signal }
229
+ });
230
+ } catch (error) {
231
+ if (signal?.aborted) throw error;
232
+ throw new LlmError(`DeepSeek Files API request to ${this.baseURL} failed`, "TRANSPORT", { cause: error });
233
+ }
234
+ if (response.ok) return response;
235
+ let parsed;
236
+ try {
237
+ parsed = await response.json();
238
+ } catch {}
239
+ const { message, detail } = providerErrorDetail$1(parsed);
240
+ throw new DeepSeekFilesError(message ?? `DeepSeek Files API error (HTTP ${response.status})`, response.status, detail);
444
241
  }
445
- /* v8 ignore next 2 -- the published solver's non-convergence guard; every
446
- pass is a projection, so a second identical pass is a fixpoint. */
447
- throw new Error(`deepseek image tokens: resize did not converge for ${width}x${height}`);
448
- }
242
+ /**
243
+ * Upload one image with an explicit expiry.
244
+ * @param input - deterministic request-version bytes, media type, filename, lifetime, and cancellation.
245
+ * @returns the validated file and reuse deadline. Messages omits expiry metadata;
246
+ * its deadline uses upload creation plus the requested lifetime.
247
+ */
248
+ async upload(input) {
249
+ if (input.data.byteLength > 134217728) throw new LlmError("DeepSeek Files API upload exceeds 128 MiB.", "INVALID_REQUEST");
250
+ if (!Number.isSafeInteger(input.expiresAfterSeconds) || input.expiresAfterSeconds < 3600 || input.expiresAfterSeconds > 2592e3) throw new LlmError("DeepSeek file expiry must be between 3600 and 2592000 seconds.", "INVALID_REQUEST");
251
+ const form = new FormData();
252
+ form.set("expires_after[anchor]", "created_at");
253
+ form.set("expires_after[seconds]", String(input.expiresAfterSeconds));
254
+ form.set("file", new Blob([Uint8Array.from(input.data).buffer], { type: input.mediaType }), input.filename);
255
+ const file = parseFileObject(await responseJson(await this.request("/files", {
256
+ method: "POST",
257
+ body: form
258
+ }, input.signal), "upload"), "upload");
259
+ return {
260
+ ...file,
261
+ expiresAt: file.createdAt + input.expiresAfterSeconds
262
+ };
263
+ }
264
+ /**
265
+ * List one provider-ordered page of files.
266
+ * @param options - pagination and cancellation.
267
+ * @returns the validated page with null cursors omitted.
268
+ */
269
+ async list(options = {}) {
270
+ const query = new URLSearchParams();
271
+ if (options.after !== void 0) query.set("after_id", options.after);
272
+ if (options.limit !== void 0) query.set("limit", String(options.limit));
273
+ const value = await responseJson(await this.request(`/files?${query.toString()}`, { method: "GET" }, options.signal), "list");
274
+ if (value === null || typeof value !== "object" || Array.isArray(value)) throw invalidResponse("list");
275
+ const wire = value;
276
+ const firstId = wire.first_id ?? void 0;
277
+ const lastId = wire.last_id ?? void 0;
278
+ if (!Array.isArray(wire.data) || typeof wire.has_more !== "boolean" || firstId !== void 0 && typeof firstId !== "string" || lastId !== void 0 && typeof lastId !== "string") throw invalidResponse("list");
279
+ return {
280
+ data: wire.data.map((item) => parseFileObject(item, "list")),
281
+ ...typeof firstId === "string" ? { firstId: DeepSeekFileId(firstId) } : {},
282
+ ...typeof lastId === "string" ? { lastId: DeepSeekFileId(lastId) } : {},
283
+ hasMore: wire.has_more
284
+ };
285
+ }
286
+ /**
287
+ * Retrieve one file object.
288
+ * @param fileId - provider file identifier.
289
+ * @param signal - request cancellation.
290
+ * @returns the validated file object.
291
+ */
292
+ async retrieve(fileId, signal) {
293
+ return parseFileObject(await responseJson(await this.request(`/files/${encodeURIComponent(fileId)}`, { method: "GET" }, signal), "retrieve"), "retrieve");
294
+ }
295
+ /**
296
+ * Delete one provider file.
297
+ * @param fileId - provider file identifier.
298
+ * @param signal - request cancellation.
299
+ */
300
+ async delete(fileId, signal) {
301
+ const value = await responseJson(await this.request(`/files/${encodeURIComponent(fileId)}`, { method: "DELETE" }, signal), "delete");
302
+ if (value === null || typeof value !== "object" || Array.isArray(value)) throw invalidResponse("delete");
303
+ const wire = value;
304
+ if (wire.id !== fileId || wire.type !== "file_deleted") throw invalidResponse("delete");
305
+ }
306
+ };
449
307
  //#endregion
450
- //#region lib/types/common/request-pricing.js
451
- /**
452
- * Provider-side request-image pricing for DeepSeek routes: prices every
453
- * retained surface occurrence at its per-model request target with
454
- * the published vision-token accounting, and every occurrence the surface
455
- * marks offloaded as its placeholder text. Consumed synchronously by the
456
- * token meter through `LlmAdapter.imageRequestPricing`; provider usage
457
- * remains the authoritative anchor for completed requests.
458
- *
459
- * @module dsh-llm-deepseek/request-pricing
460
- */
461
- /** Default bound on accumulated file-referenced image bytes per request. */
462
- const DEFAULT_MAX_REQUEST_FILES_BYTES = 128 * 1024 * 1024;
463
- /** Provider request image-count limit. */
464
- const DEFAULT_MAX_IMAGES_PER_REQUEST = 600;
465
- /** Total-pixel budget matching provider low-detail image input. */
466
- const DEFAULT_LOW_DETAIL_IMAGE_PIXEL_BUDGET = 512 * 512;
467
- /** Encoded-byte target for one deterministic model-request image; the smallest quality-ladder output is used when no quality fits. */
468
- const DEFAULT_REQUEST_IMAGE_MAX_BYTES = 2 * 1024 * 1024;
469
- /**
470
- * Provider per-side limit for a request carrying 15 or more images, applied
471
- * to every request image so the image count never changes a projection.
472
- */
473
- const REQUEST_IMAGE_MAX_DIMENSION = 4096;
308
+ //#region lib/types/upload-index.js
309
+ /** Durable DeepSeek attachment-to-file-id index. @module dsh-llm-deepseek/upload-index */
310
+ var InvalidUploadIndexError = class extends Error {};
474
311
  /**
475
- * Resolve the encoded-byte target one DeepSeek model route applies to every request image.
476
- * @param model - Advertised model route and its optional image overrides.
477
- * @returns the route's encoded-byte target.
478
- * @internal
312
+ * Derive a non-secret stable index namespace without persisting or logging the API key.
313
+ * @param baseURL - normalized provider endpoint namespace.
314
+ * @param apiKey - resolved credential used only as hash input.
315
+ * @returns branded SHA-256 namespace digest.
479
316
  */
480
- function resolveRequestImageMaxBytes(model) {
481
- return model.imageMaxBytes ?? 2097152;
317
+ function deepSeekFileScope(baseURL, apiKey) {
318
+ return DeepSeekFileScope(createHash("sha256").update(baseURL.replace(/\/+$/u, "")).update("\0").update(apiKey).digest("hex"));
482
319
  }
483
- /**
484
- * Resolve the deterministic request target one DeepSeek model route chooses
485
- * for one source image: the published token grid unless the model overrides
486
- * it with a pixel budget, then the provider per-side limit, then the route's
487
- * encoded-byte target. Small images are never enlarged.
488
- * @param model - Advertised model route and its optional image overrides.
489
- * @param source - intrinsic dimensions of the normalized attachment.
490
- * @returns Complete request dimensions and encoded-byte target.
491
- * @internal
492
- */
493
- function resolveRequestImageTarget(model, source) {
494
- const budget = model.imagePixelBudget === "low" ? DEFAULT_LOW_DETAIL_IMAGE_PIXEL_BUDGET : model.imagePixelBudget;
495
- const projected = budget === void 0 ? deepSeekRequestImageDimensions(source.width, source.height) : requestImageDimensions(source.width, source.height, budget);
320
+ function absent(error) {
321
+ return error?.code === "ENOENT";
322
+ }
323
+ function parseRecord(value) {
324
+ if (value === null || typeof value !== "object" || Array.isArray(value)) throw new InvalidUploadIndexError("llm-deepseek: upload index contains a non-object record");
325
+ const record = value;
326
+ if (typeof record.scope !== "string" || !/^[0-9a-f]{64}$/u.test(record.scope) || typeof record.attachmentId !== "string" || !/^sha256:[0-9a-f]{64}$/u.test(record.attachmentId) || typeof record.variantId !== "string" || !/^sha256:[0-9a-f]{64}$/u.test(record.variantId) || typeof record.fileId !== "string" || record.fileId.length === 0 || !Number.isSafeInteger(record.bytes) || record.bytes < 0 || !Number.isSafeInteger(record.createdAt) || record.createdAt < 0 || !Number.isSafeInteger(record.expiresAt) || record.expiresAt < 0) throw new InvalidUploadIndexError("llm-deepseek: upload index contains an invalid record");
496
327
  return {
497
- ...Math.max(projected.width, projected.height) > 4096 ? longEdgeDimensions(source.width, source.height, REQUEST_IMAGE_MAX_DIMENSION) : projected,
498
- maxBytes: resolveRequestImageMaxBytes(model)
328
+ scope: DeepSeekFileScope(record.scope),
329
+ attachmentId: record.attachmentId,
330
+ variantId: ImageVariantId(record.variantId),
331
+ fileId: DeepSeekFileId(record.fileId),
332
+ bytes: record.bytes,
333
+ createdAt: record.createdAt,
334
+ expiresAt: record.expiresAt
499
335
  };
500
336
  }
501
- /**
502
- * Price one occurrence a text-only route substitutes with deterministic text,
503
- * reproducing the `projectImagesForTextModel` substitution `LlmRuntime`
504
- * applies before dispatching to a route without the `image` modality.
505
- */
506
- function textOnlyPrice(block) {
337
+ function parseIndex(text) {
338
+ let value;
339
+ try {
340
+ value = JSON.parse(text);
341
+ } catch (error) {
342
+ throw new InvalidUploadIndexError("llm-deepseek: upload index is not valid JSON", { cause: error });
343
+ }
344
+ if (value === null || typeof value !== "object" || Array.isArray(value)) throw new InvalidUploadIndexError("llm-deepseek: upload index is not an object");
345
+ const index = value;
346
+ if (index.formatVersion !== 3 || !Array.isArray(index.records)) throw new InvalidUploadIndexError("llm-deepseek: unsupported upload index format");
347
+ const records = index.records.map(parseRecord);
348
+ const keys = /* @__PURE__ */ new Set();
349
+ for (const record of records) {
350
+ const key = `${record.scope}\0${record.variantId}`;
351
+ if (keys.has(key)) throw new InvalidUploadIndexError("llm-deepseek: upload index contains duplicate mappings");
352
+ keys.add(key);
353
+ }
507
354
  return {
508
- visualTokens: 0,
509
- text: textOnlyImageText(block.attachment)
355
+ formatVersion: 3,
356
+ records
510
357
  };
511
358
  }
512
- /**
513
- * Build the request-image pricing for one DeepSeek route from a validated
514
- * connection snapshot. Uncatalogued and text-only models price every
515
- * occurrence as its deterministic text substitution; image-capable models
516
- * price an offloaded occurrence as its placeholder text and a retained one by
517
- * its projected request dimensions, with each occurrence's handle or
518
- * placeholder text built through the same access resolution the serializer
519
- * uses. Access paths resolve at pricing time, so a path that changes before
520
- * the request only shifts the text price by its own length.
521
- * @param connection - validated connection facts of the pricing resolution.
522
- * @param model - exact model id named by the request header.
523
- * @param resolveAccess - current execution-world access resolution shared with request serialization.
524
- * @returns synchronous per-occurrence pricing for the route.
525
- */
526
- function deepSeekImageRequestPricing(connection, model, resolveAccess) {
527
- const catalogModel = connection.models.find((entry) => entry.id === model);
528
- if (catalogModel?.inputModalities?.includes("image") !== true) return { priceImages: (images) => images.map(textOnlyPrice) };
529
- return { priceImages: (images) => images.map(({ attachment: ref, offloaded }) => {
530
- if (offloaded === true) return {
531
- visualTokens: 0,
532
- text: offloadedImageText(ref, resolveAccess?.(ref))
533
- };
534
- const target = resolveRequestImageTarget(catalogModel, ref);
535
- return {
536
- visualTokens: deepSeekImageTokens(target.width, target.height),
537
- text: requestImageHandleText(ref, target, resolveAccess?.(ref))
538
- };
539
- }) };
540
- }
541
- //#endregion
542
- //#region lib/types/common/model-info.js
543
- /** Protocol-independent model capabilities and reasoning choices. */
544
- const OFF_REASONING_EFFORT = ReasoningEffortId("off");
545
- const LOW_REASONING_EFFORT = ReasoningEffortId("low");
546
- const HIGH_REASONING_EFFORT = ReasoningEffortId("high");
547
- const MAX_REASONING_EFFORT = ReasoningEffortId("max");
548
- const REASONING_EFFORTS = [
549
- {
550
- id: OFF_REASONING_EFFORT,
551
- name: "Off",
552
- description: "Use for simple tasks that do not need reasoning."
553
- },
554
- {
555
- id: LOW_REASONING_EFFORT,
556
- name: "Low",
557
- description: "Prefer for routine or latency-sensitive tasks."
558
- },
559
- {
560
- id: HIGH_REASONING_EFFORT,
561
- name: "High",
562
- description: "The default balance for most tasks."
563
- },
564
- {
565
- id: MAX_REASONING_EFFORT,
566
- name: "Max",
567
- description: "Reserve for the hardest quality-first tasks."
568
- }
569
- ];
570
- const OFF_ONLY_REASONING_EFFORTS = [{
571
- id: OFF_REASONING_EFFORT,
572
- name: "Off",
573
- description: "Use for simple tasks that do not need reasoning."
574
- }];
575
- /** Advertise one catalog entry.
576
- * @param provider - registered provider id.
577
- * @param model - advisory catalog entry.
578
- * @returns selector metadata.
579
- */
580
- function catalogModelInfo(provider, model) {
581
- return {
582
- provider,
583
- id: model.id,
584
- name: model.name ?? model.id,
585
- ...model.description === void 0 ? {} : { description: model.description },
586
- inputModalities: model.inputModalities ?? ["text"]
587
- };
588
- }
589
- /** Resolve model capabilities against one configuration generation.
590
- * @param connection - validated connection facts.
591
- * @param provider - registered provider id.
592
- * @param model - requested wire model id.
593
- * @returns effective model metadata for this operation.
594
- */
595
- function modelInfo(connection, provider, model) {
596
- const configured = connection.models.find((entry) => entry.id === model);
597
- const contextWindow = configured?.contextWindow ?? connection.defaultContextWindow;
598
- return {
599
- ...configured === void 0 ? {
600
- provider,
601
- id: model,
602
- name: model,
603
- inputModalities: ["text"]
604
- } : catalogModelInfo(provider, configured),
605
- context: { contextWindow },
606
- defaultMaxTokens: configured?.maxTokens ?? connection.maxTokens,
607
- ...configured?.systemPromptUpdate === void 0 ? {} : { systemPromptUpdate: configured.systemPromptUpdate },
608
- ...connection.defaults.thinking === "disabled" ? { reasoning: {
609
- efforts: OFF_ONLY_REASONING_EFFORTS,
610
- defaultEffort: OFF_REASONING_EFFORT
611
- } } : { reasoning: {
612
- efforts: REASONING_EFFORTS,
613
- defaultEffort: connection.defaults.reasoningEffort === "off" ? OFF_REASONING_EFFORT : connection.defaults.reasoningEffort === "low" ? LOW_REASONING_EFFORT : connection.defaults.reasoningEffort === "max" ? MAX_REASONING_EFFORT : HIGH_REASONING_EFFORT
614
- } }
615
- };
616
- }
617
- //#endregion
618
- //#region lib/types/common/request-files.js
619
- /** Shared Files resolution, bounded stale-id recovery, and normalized-image diagnostics. */
620
- var __addDisposableResource$2 = function(env, value, async) {
621
- if (value !== null && value !== void 0) {
622
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
623
- var dispose, inner;
624
- if (async) {
625
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
626
- dispose = value[Symbol.asyncDispose];
627
- }
628
- if (dispose === void 0) {
629
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
630
- dispose = value[Symbol.dispose];
631
- if (async) inner = dispose;
632
- }
633
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
634
- if (inner) dispose = function() {
635
- try {
636
- inner.call(this);
637
- } catch (e) {
638
- return Promise.reject(e);
639
- }
640
- };
641
- env.stack.push({
642
- value,
643
- dispose,
644
- async
645
- });
646
- } else if (async) env.stack.push({ async: true });
647
- return value;
648
- };
649
- var __disposeResources$2 = (function(SuppressedError) {
650
- return function(env) {
651
- function fail(e) {
652
- env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
653
- env.hasError = true;
654
- }
655
- var r, s = 0;
656
- function next() {
657
- while (r = env.stack.pop()) try {
658
- if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
659
- if (r.dispose) {
660
- var result = r.dispose.call(r.value);
661
- if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
662
- fail(e);
663
- return next();
664
- });
665
- } else s |= 1;
666
- } catch (e) {
667
- fail(e);
668
- }
669
- if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
670
- if (env.hasError) throw env.error;
671
- }
672
- return next();
673
- };
674
- })(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
675
- var e = new Error(message);
676
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
677
- });
678
- /** A file upload failure eligible for request-wide inline fallback. */
679
- var FileResolutionFailure = class extends Error {
680
- constructor(cause) {
681
- super("DeepSeek Files API could not resolve a request image.", { cause });
682
- this.name = "FileResolutionFailure";
683
- }
684
- };
685
- function providerRejectedNormalizedImage(detail) {
686
- return /(?:unsupported|invalid|cannot read|failed to (?:decode|process)).{0,40}image/iu.test(detail) || /image.{0,40}(?:unsupported|invalid|cannot be decoded)/iu.test(detail);
687
- }
688
- function providerRejectedFileId(detail) {
689
- const file = /\bfile(?:[_ -]?(?:id|api|not[_ -]?found|deleted|expired))?/iu.test(detail);
690
- const missing = /(?:expired|not[_ -]?found|deleted|do(?:es)? not exist|not created under (?:this|your) account)/iu.test(detail);
691
- const invalidId = /(?:invalid.{0,20}file[_ -]?(?:id|api)|file[_ -]?(?:id|api).{0,20}invalid)/iu.test(detail);
692
- return file && (missing || invalidId);
693
- }
694
- function detailNamesFileId(detail, fileId) {
695
- let index = detail.indexOf(fileId);
696
- while (index >= 0) {
697
- const before = detail[index - 1];
698
- const after = detail[index + fileId.length];
699
- if ((before === void 0 || !/[\p{L}\p{N}_-]/u.test(before)) && (after === void 0 || !/[\p{L}\p{N}_-]/u.test(after))) return true;
700
- index = detail.indexOf(fileId, index + 1);
701
- }
702
- return false;
703
- }
704
- function staleMappings(files, detail) {
705
- const unique = [...new Map(files.map((file) => [`${file.version.variantId}\0${file.fileId}`, file])).values()];
706
- const exact = unique.filter((file) => detailNamesFileId(detail, file.fileId));
707
- return exact.length > 0 ? exact : unique;
708
- }
709
- function normalizedImageFacts(file) {
710
- const version = file.version;
711
- const name = version.attachment.name ?? version.attachment.attachmentId;
712
- const colour = version.hasAlpha ? "sRGBA" : "sRGB";
713
- return `"${name}" at message ${file.location.message}, image ${file.location.image} (${version.mediaType}, 8-bit ${colour}, ${version.width}x${version.height})`;
714
- }
715
- function normalizedImageDiagnostic(files, providerMessage, providerDetail) {
716
- const target = files.find((file) => detailNamesFileId(providerDetail, file.fileId)) ?? (files.length === 1 ? files[0] : void 0);
717
- if (target !== void 0) return `DeepSeek rejected normalized image ${normalizedImageFacts(target)}: ${providerMessage}. The provider rejected bytes already normalized by the harness; PNG, JPEG, WebP, and GIF remain supported input formats.`;
718
- return `DeepSeek rejected a normalized request image: ${providerMessage}. Candidate images: ${[...new Map(files.map((file) => [`${file.version.variantId}\0${file.location.message}\0${file.location.image}`, file])).values()].map(normalizedImageFacts).join("; ")}. The provider rejected bytes already normalized by the harness; PNG, JPEG, WebP, and GIF remain supported input formats.`;
359
+ function reusable(record, now, refreshMarginMs) {
360
+ return record.expiresAt - now > refreshMarginMs;
719
361
  }
720
- /** Files state owned by one model request, including at most one stale-id retry. */
721
- var RequestFiles = class {
722
- files;
723
- connection;
724
- policy;
725
- timeoutMs;
726
- signal;
727
- activity;
728
- used = [];
729
- retried = false;
730
- constructor(files, connection, policy, timeoutMs, signal, activity) {
731
- this.files = files;
732
- this.connection = connection;
733
- this.policy = policy;
734
- this.timeoutMs = timeoutMs;
735
- this.signal = signal;
736
- this.activity = activity;
737
- }
738
- /** Reset occurrence tracking before serializing the next HTTP attempt. */
739
- beginAttempt() {
740
- this.used = [];
741
- }
362
+ /** Atomic local index shared by every DeepSeek session in this DSH home. */
363
+ var DeepSeekUploadIndex = class {
364
+ /** Absolute owner-private JSON index path. */
365
+ path;
742
366
  /**
743
- * Resolve a retained image under its own upload deadline.
744
- * @param version - prepared request image.
745
- * @param location - occurrence used by provider-rejection diagnostics.
746
- * @returns the reusable provider id.
367
+ * @param path - explicit test path; omission uses `DSH_HOME/llm-deepseek/files-v3.json`.
747
368
  */
748
- async resolve(version, location) {
749
- const env_1 = {
750
- stack: [],
751
- error: void 0,
752
- hasError: false
753
- };
369
+ constructor(path = join(resolveDshHome(), "llm-deepseek", "files-v3.json")) {
370
+ this.path = path;
371
+ }
372
+ async load() {
754
373
  try {
755
- const limit = __addDisposableResource$2(env_1, deadline(this.signal, this.timeoutMs, "DEEPSEEK_FILES_API_TIMEOUT"), false);
756
- let resolved;
757
- try {
758
- resolved = await this.files.ensureUploaded(version, this.connection, this.policy, limit.signal);
759
- } catch (error) {
760
- if (this.signal.aborted) throw error;
761
- throw new FileResolutionFailure(error);
762
- }
763
- this.activity();
764
- this.used.push({
765
- version,
766
- fileId: resolved.record.fileId,
767
- location
768
- });
769
- return resolved.record.fileId;
770
- } catch (e_1) {
771
- env_1.error = e_1;
772
- env_1.hasError = true;
773
- } finally {
774
- __disposeResources$2(env_1);
374
+ return parseIndex(await readFile(this.path, "utf8"));
375
+ } catch (error) {
376
+ if (absent(error) || error instanceof InvalidUploadIndexError) return {
377
+ formatVersion: 3,
378
+ records: []
379
+ };
380
+ throw error;
775
381
  }
776
382
  }
383
+ async save(index) {
384
+ await writeFileAtomic(this.path, `${JSON.stringify(index, void 0, 2)}\n`, {
385
+ mode: 384,
386
+ dirMode: 448
387
+ });
388
+ }
777
389
  /**
778
- * Invalidate rejected mappings; only the first stale-id response permits another request.
779
- * @param detail - provider error fields used for stale-id classification.
780
- * @returns whether the caller should serialize and dispatch again.
390
+ * Read one reusable mapping.
391
+ * @param scope - endpoint/API-key namespace.
392
+ * @param variantId - complete request-image transformation identity.
393
+ * @param now - current Unix time in milliseconds.
394
+ * @param refreshMarginMs - remaining lifetime below which a mapping is not reused.
395
+ * @returns the mapping when it has enough lifetime remaining.
781
396
  */
782
- async retry(detail) {
783
- if (this.used.length === 0 || !providerRejectedFileId(detail)) return false;
784
- await Promise.all(staleMappings(this.used, detail).map((file) => this.files.invalidate(file.version, file.fileId, this.connection)));
785
- if (this.retried) return false;
786
- this.retried = true;
787
- return true;
397
+ async get(scope, variantId, now, refreshMarginMs) {
398
+ const record = (await this.load()).records.find((candidate) => candidate.scope === scope && candidate.variantId === variantId);
399
+ return record !== void 0 && reusable(record, now, refreshMarginMs) ? record : void 0;
788
400
  }
789
401
  /**
790
- * Attribute a normalized-image rejection to the actual uploaded image occurrences.
791
- * @param status - rejected request's HTTP status.
792
- * @param message - provider's error message.
793
- * @param detail - provider error classification fields.
794
- * @returns the image diagnostic or the original provider message.
402
+ * Publish a completed upload unless another process already published a reusable mapping.
403
+ * @param candidate - completed remote upload.
404
+ * @param now - current Unix time in milliseconds.
405
+ * @param refreshMarginMs - minimum reusable remaining lifetime.
406
+ * @returns the winning record and whether the candidate entered the index.
795
407
  */
796
- errorMessage(status, message, detail) {
797
- return status === 400 && this.used.length > 0 && providerRejectedNormalizedImage(detail) ? normalizedImageDiagnostic(this.used, message, detail) : message;
798
- }
799
- };
800
- //#endregion
801
- //#region lib/types/common/request-extensions.js
802
- /** Prepare plugin-contributed request fields and commit their delivery after HTTP acceptance. */
803
- /**
804
- * Merge contributions without replacing protocol-owned fields. Preparation and
805
- * acceptance failures retain the same error category across DeepSeek protocols.
806
- * @param body - serialized protocol request before extension fields.
807
- * @param options - request identity, purpose, and cancellation.
808
- * @param prepare - contributor registry captured for this adapter.
809
- * @returns HTTP payload and a commit to invoke only after a successful HTTP response.
810
- */
811
- async function prepareRequestExtensions(body, options, prepare) {
812
- let extensions;
813
- try {
814
- extensions = await prepare({
815
- body,
816
- ...options
817
- });
818
- } catch (error) {
819
- throw new LlmError("DeepSeek request extension preparation failed", "REQUEST_EXTENSION", { cause: error });
820
- }
821
- for (const field of Object.keys(extensions.fields)) if (Object.hasOwn(body, field)) throw new LlmError(`DeepSeek request extension field ${JSON.stringify(field)} collides with the base request`, "REQUEST_EXTENSION");
822
- return {
823
- payload: JSON.stringify({
824
- ...body,
825
- ...extensions.fields
826
- }),
827
- async accept() {
828
- try {
829
- await extensions.accept();
830
- } catch (error) {
831
- throw new LlmError("DeepSeek request extension acceptance failed", "REQUEST_EXTENSION", { cause: error });
832
- }
833
- }
834
- };
835
- }
836
- /**
837
- * Parse an SSE byte stream into data payloads. Yields `[DONE]` as the final
838
- * value and returns; throws `LlmError('STREAM_CLOSED')` when the stream ends
839
- * without it (truncated response — the model call cannot be trusted).
840
- * @param stream - raw SSE bytes; reads may split anywhere, including mid-UTF-8 sequence.
841
- * @param onComment - optional transport-activity callback; comments never enter the yielded payload stream.
842
- * @returns each event's data payload in arrival order, the `[DONE]` sentinel last.
843
- */
844
- async function* parseSse$1(stream, onComment) {
845
- const events = stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream({ onComment }));
846
- for await (const { data } of events) {
847
- yield data;
848
- if (data === "[DONE]") return;
849
- }
850
- throw new LlmError("SSE stream ended without [DONE]", "STREAM_CLOSED");
851
- }
852
- //#endregion
853
- //#region lib/types/protocols/chat-completions/translate.js
854
- /**
855
- * Translate DeepSeek SSE payloads with one stateful harness block per content, reasoning, or tool
856
- * call index. An empty initial reasoning delta does not open a block. Finish reason and the latest
857
- * usage are deferred until `[DONE]`, covering both finish-attached and trailing usage-only shapes
858
- * while ensuring no chunk follows `finish`.
859
- *
860
- * Translate DeepSeek wire chunks into the harness `StreamChunk` protocol.
861
- * @module dsh-llm-deepseek/translate
862
- */
863
- /**
864
- * Map the wire finish_reason vocabulary to the harness FinishReason.
865
- * @param reason - the wire `finish_reason` string.
866
- * @returns the mapped reason; unrecognized values (content_filter, …) become `{kind: 'error'}` with the uppercased value as `code`.
867
- */
868
- function mapFinishReason(reason) {
869
- switch (reason) {
870
- case "stop": return { kind: "stop" };
871
- case "tool_calls": return { kind: "tool-calls" };
872
- case "length": return { kind: "max-tokens" };
873
- default: return {
874
- kind: "error",
875
- failure: {
876
- message: `model stopped: ${reason}`,
877
- code: reason.toUpperCase()
878
- }
879
- };
880
- }
881
- }
882
- /**
883
- * Map wire usage fields. DeepSeek's `prompt_tokens` INCLUDES cache hits
884
- * (`prompt_tokens = prompt_cache_hit_tokens + prompt_cache_miss_tokens`,
885
- * api/create-chat-completion); the harness TokenUsage convention is
886
- * DISJOINT counts, so cache reads are subtracted out of `inputTokens`.
887
- * @param usage - wire usage from the finish chunk or the trailing usage-only chunk.
888
- * @returns disjoint harness counts; an exact total is present only when the
889
- * aggregate prompt/completion counters are valid and agree with any wire total.
890
- */
891
- function mapUsage(usage) {
892
- const cacheRead = usage.prompt_tokens_details?.cached_tokens ?? usage.prompt_cache_hit_tokens;
893
- const reasoning = usage.completion_tokens_details?.reasoning_tokens;
894
- const combined = usage.prompt_tokens + usage.completion_tokens;
895
- const hasExactTotal = Number.isSafeInteger(usage.prompt_tokens) && usage.prompt_tokens >= 0 && Number.isSafeInteger(usage.completion_tokens) && usage.completion_tokens >= 0 && Number.isSafeInteger(combined) && (usage.total_tokens === void 0 || usage.total_tokens === combined);
896
- return {
897
- inputTokens: usage.prompt_tokens - (cacheRead ?? 0),
898
- outputTokens: usage.completion_tokens,
899
- ...hasExactTotal ? { totalTokens: combined } : {},
900
- ...cacheRead !== void 0 ? { cacheReadTokens: cacheRead } : {},
901
- ...reasoning !== void 0 ? { reasoningTokens: reasoning } : {}
902
- };
903
- }
904
- /**
905
- * Accept one streamed identity field for a tool call. `id` and `name` are
906
- * identity, not accumulation: the wire sends each once, on the call's first
907
- * delta. A continuation delta that re-sends the field empty — or `null`, which
908
- * some OpenAI-compatible gateways fill in — means "no update", never "clear".
909
- * @param current - the identity established by an earlier delta of this call.
910
- * @param incoming - the field as parsed from this delta. The wire type is a
911
- * claim about a remote encoder, so anything but a non-empty string leaves the
912
- * established value alone rather than overwriting it.
913
- * @returns the identity in force after this delta.
914
- */
915
- function acceptIdentity(current, incoming) {
916
- return typeof incoming === "string" && incoming.length > 0 ? incoming : current;
917
- }
918
- /** Assemble the final ContentBlock for one open block. */
919
- function closeBlock(block) {
920
- switch (block.kind) {
921
- case "text": return {
922
- type: "text",
923
- text: block.text
924
- };
925
- case "reasoning": return {
926
- type: "reasoning",
927
- text: block.text
928
- };
929
- case "tool-call": return {
930
- type: "tool-call",
931
- id: brandString(block.callId ?? ""),
932
- name: block.name ?? "",
933
- arguments: block.text
934
- };
935
- }
936
- }
937
- /**
938
- * Consume SSE data payloads (ending with `[DONE]`) and yield StreamChunks.
939
- * Malformed JSON payloads abort the stream with `MALFORMED_RESPONSE`.
940
- * @param payloads - SSE data payloads from {@link parseSse}, `[DONE]`-terminated.
941
- * @returns deltas as they arrive; `block-end`s, `usage`, and `finish` are all deferred to the `[DONE]` sentinel.
942
- * A `stop` (or absent) finish with no opened blocks is a degenerate provider completion and maps to an
943
- * `EMPTY_RESPONSE` error finish instead of a successful empty message.
944
- */
945
- async function* translate$1(payloads) {
946
- let nextIndex = 0;
947
- let textBlock;
948
- let reasoningBlock;
949
- const toolBlocks = /* @__PURE__ */ new Map();
950
- const order = [];
951
- let pendingFinish;
952
- let pendingUsage;
953
- function open(kind) {
954
- const block = {
955
- index: nextIndex++,
956
- kind,
957
- text: ""
958
- };
959
- order.push(block);
960
- return block;
961
- }
962
- for await (const payload of payloads) {
963
- if (payload === "[DONE]") {
964
- for (const block of order) yield {
965
- type: "block-end",
966
- index: block.index,
967
- block: closeBlock(block)
968
- };
969
- if (pendingUsage) yield {
970
- type: "usage",
971
- usage: pendingUsage
972
- };
973
- const reason = pendingFinish ?? { kind: "stop" };
974
- yield {
975
- type: "finish",
976
- reason: reason.kind === "stop" && order.length === 0 ? {
977
- kind: "error",
978
- failure: {
979
- message: "model returned a completed response with no content",
980
- code: EMPTY_RESPONSE_CODE
981
- }
982
- } : reason
983
- };
984
- return;
985
- }
986
- let chunk;
987
- try {
988
- chunk = JSON.parse(payload);
989
- } catch {
990
- throw new LlmError(`malformed SSE payload: ${payload.slice(0, 120)}`, "MALFORMED_RESPONSE");
991
- }
992
- for (const choice of chunk.choices ?? []) {
993
- const delta = choice.delta;
994
- const reasoning = delta?.reasoning_content;
995
- if (typeof reasoning === "string" && reasoning.length > 0) {
996
- if (!reasoningBlock) {
997
- reasoningBlock = open("reasoning");
998
- yield {
999
- type: "block-start",
1000
- index: reasoningBlock.index,
1001
- blockType: "reasoning"
1002
- };
1003
- }
1004
- reasoningBlock.text += reasoning;
1005
- yield {
1006
- type: "reasoning-delta",
1007
- index: reasoningBlock.index,
1008
- text: reasoning
1009
- };
1010
- }
1011
- const content = delta?.content;
1012
- if (typeof content === "string" && content.length > 0) {
1013
- if (!textBlock) {
1014
- textBlock = open("text");
1015
- yield {
1016
- type: "block-start",
1017
- index: textBlock.index,
1018
- blockType: "text"
1019
- };
1020
- }
1021
- textBlock.text += content;
1022
- yield {
1023
- type: "text-delta",
1024
- index: textBlock.index,
1025
- text: content
1026
- };
1027
- }
1028
- for (const call of delta?.tool_calls ?? []) {
1029
- let block = toolBlocks.get(call.index);
1030
- if (!block) {
1031
- block = open("tool-call");
1032
- toolBlocks.set(call.index, block);
1033
- yield {
1034
- type: "block-start",
1035
- index: block.index,
1036
- blockType: "tool-call"
1037
- };
1038
- }
1039
- block.callId = acceptIdentity(block.callId, call.id);
1040
- block.name = acceptIdentity(block.name, call.function?.name);
1041
- const fragment = call.function?.arguments ?? "";
1042
- block.text += fragment;
1043
- yield {
1044
- type: "tool-call-delta",
1045
- index: block.index,
1046
- id: brandString(block.callId ?? ""),
1047
- ...block.name !== void 0 ? { name: block.name } : {},
1048
- argumentsDelta: fragment
1049
- };
1050
- }
1051
- if (typeof choice.finish_reason === "string") pendingFinish = mapFinishReason(choice.finish_reason);
1052
- }
1053
- if (chunk.usage) pendingUsage = mapUsage(chunk.usage);
1054
- }
1055
- throw new LlmError("SSE payload stream ended without [DONE]", "STREAM_CLOSED");
1056
- }
1057
- //#endregion
1058
- //#region lib/types/protocols/chat-completions/adapter.js
1059
- /**
1060
- * `DeepSeekAdapter`: fetch + SSE against a DeepSeek (OpenAI-compatible)
1061
- * chat-completions endpoint, emitting harness StreamChunks. The adapter is
1062
- * transport-only: connection facts arrive through a thunk resolved once per
1063
- * operation and the bearer token through a per-request resolver, so the
1064
- * registering plugin owns validation, layering, and credential policy.
1065
- *
1066
- * @module dsh-llm-deepseek/adapter
1067
- */
1068
- var __addDisposableResource$1 = function(env, value, async) {
1069
- if (value !== null && value !== void 0) {
1070
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
1071
- var dispose, inner;
1072
- if (async) {
1073
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
1074
- dispose = value[Symbol.asyncDispose];
1075
- }
1076
- if (dispose === void 0) {
1077
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
1078
- dispose = value[Symbol.dispose];
1079
- if (async) inner = dispose;
1080
- }
1081
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
1082
- if (inner) dispose = function() {
1083
- try {
1084
- inner.call(this);
1085
- } catch (e) {
1086
- return Promise.reject(e);
1087
- }
1088
- };
1089
- env.stack.push({
1090
- value,
1091
- dispose,
1092
- async
408
+ async commit(candidate, now, refreshMarginMs) {
409
+ await mkdir(dirname(this.path), {
410
+ recursive: true,
411
+ mode: 448
1093
412
  });
1094
- } else if (async) env.stack.push({ async: true });
1095
- return value;
1096
- };
1097
- var __disposeResources$1 = (function(SuppressedError) {
1098
- return function(env) {
1099
- function fail(e) {
1100
- env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
1101
- env.hasError = true;
1102
- }
1103
- var r, s = 0;
1104
- function next() {
1105
- while (r = env.stack.pop()) try {
1106
- if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
1107
- if (r.dispose) {
1108
- var result = r.dispose.call(r.value);
1109
- if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
1110
- fail(e);
1111
- return next();
1112
- });
1113
- } else s |= 1;
1114
- } catch (e) {
1115
- fail(e);
1116
- }
1117
- if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
1118
- if (env.hasError) throw env.error;
1119
- }
1120
- return next();
1121
- };
1122
- })(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
1123
- var e = new Error(message);
1124
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1125
- });
1126
- const STREAM_IDLE_TIMEOUT_CODE = "LLM_STREAM_IDLE_TIMEOUT";
1127
- function collectImageRefs(content, refs) {
1128
- for (const block of content) if (block.type === "image" && block.offloaded !== true) refs.set(block.attachment.attachmentId, block.attachment);
1129
- else if (block.type === "tool-result") collectImageRefs(block.content, refs);
1130
- }
1131
- async function prepareRequestImages(options, attachments, model, signal) {
1132
- const refs = /* @__PURE__ */ new Map();
1133
- for (const message of options.messages) collectImageRefs(message.content, refs);
1134
- const orderedRefs = [...refs.values()];
1135
- const projected = await Promise.all(orderedRefs.map((ref) => attachments.readImageRequest(ref, resolveRequestImageTarget(model, ref), signal)));
1136
- return new Map(orderedRefs.map((ref, index) => [ref.attachmentId, projected[index]]));
1137
- }
1138
- function providerRetryAfterMs(value) {
1139
- if (value === null) return void 0;
1140
- if (/^\d+$/.test(value)) {
1141
- const delay = Number(value) * 1e3;
1142
- return Number.isFinite(delay) && delay > 0 ? delay : void 0;
1143
- }
1144
- const delay = Date.parse(value) - Date.now();
1145
- return Number.isFinite(delay) && delay > 0 ? delay : void 0;
1146
- }
1147
- function requestId(headers) {
1148
- const value = headers.get("x-request-id") ?? headers.get("x-deepseek-request-id");
1149
- return value === null || value.length === 0 ? void 0 : ProviderRequestId(value);
1150
- }
1151
- /**
1152
- * Map an HTTP status to a stable LlmError code.
1153
- * @param status - status of a non-2xx provider response.
1154
- * @param error - parsed provider error body, when available.
1155
- * @returns the normalized harness error code.
1156
- */
1157
- function httpErrorCode(status, error) {
1158
- if (status === 401 || status === 403) return "AUTH";
1159
- if (status === 413) return "INVALID_REQUEST";
1160
- const detail = [
1161
- error?.code,
1162
- error?.type,
1163
- error?.message
1164
- ].filter(Boolean).join(" ");
1165
- if (isQuotaExceededError(detail)) return QUOTA_EXCEEDED_CODE;
1166
- if (status === 429) return "RATE_LIMIT";
1167
- if (status === 400) {
1168
- if (isContextWindowExceededError(detail)) return CONTEXT_WINDOW_EXCEEDED_CODE;
1169
- return "INVALID_REQUEST";
1170
- }
1171
- if (status >= 500) return "SERVER";
1172
- return `HTTP_${status}`;
1173
- }
1174
- /**
1175
- * The first real `LlmAdapter`. One instance serves every model name it was
1176
- * registered under (the harness model name IS the wire model name).
1177
- *
1178
- * One stable signal reaches both initial fetch and body reads. Caller aborts
1179
- * map to `ABORTED`; the configured per-read idle watchdog maps to `TIMEOUT`.
1180
- */
1181
- var ChatCompletionsAdapter = class extends LlmAdapter {
1182
- config;
1183
- files;
1184
- constructor(config) {
1185
- super();
1186
- this.config = config;
1187
- this.files = config.resolveFiles();
1188
- }
1189
- providerInfo(provider) {
1190
- return {
1191
- id: provider,
1192
- name: "DeepSeek"
1193
- };
1194
- }
1195
- providerRetryPolicy(_provider) {
1196
- return this.config.options().retryPolicy;
1197
- }
1198
- imageRequestPricing(_provider, model) {
1199
- const attachments = this.config.resolveAttachments?.();
1200
- const resolveAccess = attachments === void 0 ? void 0 : (ref) => this.config.resolveImageAccess?.(attachments, ref);
1201
- return deepSeekImageRequestPricing(this.config.options(), model, resolveAccess);
1202
- }
1203
- listModels(provider) {
1204
- return Promise.resolve(this.config.options().models.map((model) => catalogModelInfo(provider, model)));
1205
- }
1206
- resolveModel(provider, model, _signal) {
1207
- return Promise.resolve(modelInfo(this.config.options(), provider, model));
1208
- }
1209
- prepareCall(provider, model, _signal) {
1210
- const connection = this.config.options();
1211
- return Promise.resolve({
1212
- model: modelInfo(connection, provider, model),
1213
- stream: (options) => this.streamWithConnection(options, connection)
413
+ return withFileLock(this.path, async () => {
414
+ const index = await this.load();
415
+ const existing = index.records.find((record) => record.scope === candidate.scope && record.variantId === candidate.variantId && reusable(record, now, refreshMarginMs));
416
+ if (existing !== void 0) return {
417
+ record: existing,
418
+ accepted: false
419
+ };
420
+ const records = index.records.filter((record) => reusable(record, now, refreshMarginMs) && !(record.scope === candidate.scope && record.variantId === candidate.variantId));
421
+ records.push(candidate);
422
+ await this.save({
423
+ formatVersion: 3,
424
+ records
425
+ });
426
+ return {
427
+ record: candidate,
428
+ accepted: true
429
+ };
1214
430
  });
1215
431
  }
1216
- stream(options) {
1217
- return this.streamWithConnection(options, this.config.options());
1218
- }
1219
- async *streamWithConnection(options, connection) {
1220
- const env_1 = {
1221
- stack: [],
1222
- error: void 0,
1223
- hasError: false
1224
- };
1225
- try {
1226
- const hasImages = options.messages.some((message) => contentHasImage(message.content));
1227
- let attachments;
1228
- if (hasImages) {
1229
- if (connection.models.find((entry) => entry.id === options.model)?.inputModalities?.includes("image") !== true) throw new LlmError(`DeepSeek model "${options.model}" does not accept image input.`, "UNSUPPORTED_CONTENT");
1230
- attachments = this.config.resolveAttachments?.();
1231
- if (attachments === void 0) throw new LlmError("DeepSeek image conversion requires the durable attachment service.", "UNSUPPORTED_CONTENT");
1232
- }
1233
- const apiKey = await this.config.resolveApiKey(connection);
1234
- const userId = this.config.resolveUserId();
1235
- const consumer = new AbortController();
1236
- const watchdog = __addDisposableResource$1(env_1, idleWatchdog(options.signal === void 0 ? consumer.signal : AbortSignal.any([options.signal, consumer.signal]), connection.streamIdleTimeoutMs, STREAM_IDLE_TIMEOUT_CODE), false);
1237
- const iterator = this.request(options, watchdog.signal, connection, apiKey, userId, attachments, () => {
1238
- watchdog.pulse();
1239
- })[Symbol.asyncIterator]();
1240
- let exhausted = false;
1241
- try {
1242
- while (true) {
1243
- const result = await watchdog.next(iterator);
1244
- if (result.done) {
1245
- exhausted = true;
1246
- return;
1247
- }
1248
- yield result.value;
1249
- }
1250
- } catch (error) {
1251
- if (timeoutOf(watchdog.signal, STREAM_IDLE_TIMEOUT_CODE) !== void 0) throw new LlmError(`DeepSeek stream idle timeout after ${connection.streamIdleTimeoutMs}ms`, "TIMEOUT", { cause: error });
1252
- if (options.signal?.aborted) throw new LlmError("DeepSeek request aborted by caller", "ABORTED", { cause: error });
1253
- if (error instanceof LlmError) throw error;
1254
- throw new LlmError(`DeepSeek API stream from ${connection.baseURL} failed`, "TRANSPORT", { cause: error });
1255
- } finally {
1256
- consumer.abort("DeepSeek stream consumer stopped");
1257
- if (!exhausted && iterator.return !== void 0) try {
1258
- await iterator.return();
1259
- } catch (_abortedTransportTeardown) {}
1260
- }
1261
- } catch (e_1) {
1262
- env_1.error = e_1;
1263
- env_1.hasError = true;
1264
- } finally {
1265
- __disposeResources$1(env_1);
1266
- }
1267
- }
1268
- async *request(options, signal, connection, apiKey, userId, attachments, onActivity) {
1269
- const headers = {
1270
- "authorization": `Bearer ${apiKey}`,
1271
- "content-type": "application/json",
1272
- "accept": "text/event-stream",
1273
- ...attributionHeaders(),
1274
- "x-deepseek-harness-user-id": String(userId),
1275
- ...options.sessionId !== void 0 ? { "x-deepseek-harness-session-id": String(options.sessionId) } : {},
1276
- ...options.purpose === "compaction" ? { "x-deepseek-harness-compact": "1" } : {}
1277
- };
1278
- const fileConnection = {
1279
- baseURL: connection.baseURL,
1280
- apiKey,
1281
- protocol: connection.protocol
1282
- };
1283
- const model = connection.models.find((entry) => entry.id === options.model);
1284
- const resolveImageAccess = attachments === void 0 ? void 0 : (ref) => this.config.resolveImageAccess?.(attachments, ref);
1285
- const imageAccessOptions = resolveImageAccess === void 0 ? {} : { resolveImageAccess };
1286
- const requestOptions = options;
1287
- const requestImages = attachments === void 0 || model === void 0 ? /* @__PURE__ */ new Map() : await prepareRequestImages(requestOptions, attachments, model, signal);
1288
- let representation = "file";
1289
- const requestFiles = new RequestFiles(this.files, fileConnection, connection.filePolicy, connection.filesApiTimeoutMs, signal, onActivity);
1290
- while (true) {
1291
- requestFiles.beginAttempt();
1292
- let body;
1293
- if (attachments === void 0) body = serializeRequest(requestOptions, connection.defaults);
1294
- else if (representation === "base64") body = await serializeRequestWithImages(requestOptions, {
1295
- representation: { kind: "base64" },
1296
- requestImages,
1297
- ...imageAccessOptions,
1298
- maxRequestImageBytes: connection.maxInlineRequestImageBytes,
1299
- maxImagesPerRequest: connection.maxImagesPerRequest,
1300
- byteQuantum: connection.inlineImageOffloadByteQuantum,
1301
- countQuantum: connection.imageOffloadCountQuantum
1302
- }, connection.defaults);
1303
- else try {
1304
- body = await serializeRequestWithImages(requestOptions, {
1305
- representation: {
1306
- kind: "file",
1307
- resolveFileId: (version, _block, location) => requestFiles.resolve(version, location)
1308
- },
1309
- requestImages,
1310
- ...imageAccessOptions,
1311
- maxRequestImageBytes: connection.maxRequestFilesBytes,
1312
- maxImagesPerRequest: connection.maxImagesPerRequest,
1313
- byteQuantum: connection.imageOffloadByteQuantum,
1314
- countQuantum: connection.imageOffloadCountQuantum
1315
- }, connection.defaults);
1316
- } catch (error) {
1317
- if (!(error instanceof FileResolutionFailure)) throw error;
1318
- representation = "base64";
1319
- continue;
1320
- }
1321
- const extensions = await prepareRequestExtensions(body, {
1322
- signal,
1323
- ...options.sessionId === void 0 ? {} : { sessionId: String(options.sessionId) },
1324
- ...options.purpose === void 0 ? {} : { purpose: options.purpose }
1325
- }, this.config.prepareExtensions);
1326
- let response;
1327
- try {
1328
- response = await fetch(`${connection.baseURL}/chat/completions`, {
1329
- method: "POST",
1330
- headers,
1331
- body: extensions.payload,
1332
- signal
1333
- });
1334
- } catch (error) {
1335
- if (signal.aborted) throw error;
1336
- throw new LlmError(`DeepSeek API request to ${connection.baseURL} failed`, "TRANSPORT", { cause: error });
1337
- }
1338
- if (!response.ok) {
1339
- let message = `DeepSeek API error (HTTP ${response.status})`;
1340
- let providerError;
1341
- const rawResponse = await response.text();
1342
- try {
1343
- providerError = JSON.parse(rawResponse).error;
1344
- if (providerError?.message) message = providerError.message;
1345
- } catch {}
1346
- const detail = [
1347
- providerError?.code,
1348
- providerError?.type,
1349
- providerError?.message
1350
- ].filter((field) => typeof field === "string").join(" ");
1351
- if (await requestFiles.retry(detail)) continue;
1352
- message = requestFiles.errorMessage(response.status, message, detail);
1353
- const delay = providerRetryAfterMs(response.headers.get("retry-after"));
1354
- const id = requestId(response.headers);
1355
- throw new LlmError(message, httpErrorCode(response.status, providerError), {
1356
- cause: new Error(rawResponse.length > 0 ? rawResponse : `DeepSeek HTTP ${response.status}`),
1357
- status: response.status,
1358
- ...delay === void 0 ? {} : { providerRetryAfterMs: delay },
1359
- ...id === void 0 ? {} : { requestId: id }
1360
- });
1361
- }
1362
- await extensions.accept();
1363
- if (!response.body) throw new LlmError("DeepSeek API returned no response body", "EMPTY_RESPONSE");
1364
- yield* translate$1(parseSse$1(response.body, onActivity));
1365
- return;
1366
- }
432
+ /**
433
+ * Remove one exact mapping without deleting a concurrently installed successor.
434
+ * @param scope - endpoint/API-key namespace.
435
+ * @param variantId - complete request-image transformation identity.
436
+ * @param fileId - exact remote generation being invalidated.
437
+ */
438
+ async remove(scope, variantId, fileId) {
439
+ await mkdir(dirname(this.path), {
440
+ recursive: true,
441
+ mode: 448
442
+ });
443
+ await withFileLock(this.path, async () => {
444
+ const index = await this.load();
445
+ const records = index.records.filter((record) => !(record.scope === scope && record.variantId === variantId && record.fileId === fileId));
446
+ if (records.length !== index.records.length) await this.save({
447
+ formatVersion: 3,
448
+ records
449
+ });
450
+ });
1367
451
  }
1368
- };
1369
- //#endregion
1370
- //#region lib/types/common/file-id.js
1371
- /** DeepSeek Files API identifiers. @module dsh-llm-deepseek/file-id */
1372
- /**
1373
- * Brand a provider-returned file identifier after wire validation.
1374
- * @param id - non-empty Files API identifier.
1375
- * @returns the same string with its provider identity attached at type level.
1376
- */
1377
- function DeepSeekFileId(id) {
1378
- return id;
1379
- }
1380
- /**
1381
- * Brand a locally derived namespace digest.
1382
- * @param scope - SHA-256 digest of endpoint and API key.
1383
- * @returns the same string with namespace identity attached at type level.
1384
- */
1385
- function DeepSeekFileScope(scope) {
1386
- return scope;
1387
- }
1388
- //#endregion
1389
- //#region lib/types/common/messages-api.js
1390
- /** Shared DeepSeek Messages API endpoint and header policy. @module dsh-llm-deepseek/messages-api */
1391
- /** Required opt-in for Messages file operations and file-referenced image requests. */
1392
- const MESSAGES_FILES_BETA = "files-api-2025-04-14";
1393
- /**
1394
- * Resolve the API root without duplicating an explicit provider version path.
1395
- * @param baseURL - validated configured endpoint root.
1396
- * @returns the root beneath which Messages resources are exposed.
1397
- */
1398
- function messagesApiRoot(baseURL) {
1399
- const base = baseURL.replace(/\/+$/u, "");
1400
- return new URL(base).pathname.endsWith("/v1") ? base : `${base}/v1`;
1401
- }
1402
- //#endregion
1403
- //#region lib/types/common/files-api.js
1404
- /** DeepSeek Files API transport for Chat Completions and Messages endpoints. @module dsh-llm-deepseek/files-api */
1405
- /** Minimum provider-supported file lifetime. */
1406
- const MIN_FILE_EXPIRY_SECONDS = 3600;
1407
- /** Maximum provider-supported file lifetime. */
1408
- const MAX_FILE_EXPIRY_SECONDS = 2592e3;
1409
- /** Maximum Files API upload size. */
1410
- const MAX_FILE_UPLOAD_BYTES = 128 * 1024 * 1024;
1411
- /** Current per-key file-count quota. */
1412
- const MAX_STORED_FILE_COUNT = 1e4;
1413
- /** Current per-key storage quota. */
1414
- const MAX_STORED_FILE_BYTES = 25 * 1024 * 1024 * 1024;
1415
- /** Files API operation failure with its HTTP status retained for recovery policy. */
1416
- var DeepSeekFilesError = class extends LlmError {
1417
- /** Parsed provider detail used only for error classification. */
1418
- detail;
1419
452
  /**
1420
- * @param message - user-readable provider failure.
1421
- * @param status - HTTP status returned by the Files API.
1422
- * @param detail - provider error fields joined for classification.
453
+ * Remove every local mapping for one remote namespace.
454
+ * @param scope - endpoint/API-key namespace.
1423
455
  */
1424
- constructor(message, status, detail) {
1425
- super(message, status === 401 || status === 403 ? "AUTH" : status === 429 ? "RATE_LIMIT" : status >= 500 ? "SERVER" : "FILES_API", { status });
1426
- this.name = "DeepSeekFilesError";
1427
- this.detail = detail;
456
+ async clear(scope) {
457
+ await mkdir(dirname(this.path), {
458
+ recursive: true,
459
+ mode: 448
460
+ });
461
+ await withFileLock(this.path, async () => {
462
+ const index = await this.load();
463
+ const records = index.records.filter((record) => record.scope !== scope);
464
+ if (records.length !== index.records.length) await this.save({
465
+ formatVersion: 3,
466
+ records
467
+ });
468
+ });
1428
469
  }
1429
470
  };
1430
- /**
1431
- * Whether an upload failure reports a provider storage or file-count quota.
1432
- * @param error - Files API operation failure.
1433
- * @returns whether one bounded remote cleanup and upload retry may recover.
1434
- */
1435
- function isFilesQuotaError(error) {
1436
- return error instanceof DeepSeekFilesError && /(?:quota|storage|stored files|file count|too many files)/iu.test(error.detail);
471
+ //#endregion
472
+ //#region lib/types/file-store.js
473
+ /** DeepSeek Files API upload reuse, invalidation, and quota recovery. @module dsh-llm-deepseek/file-store */
474
+ /** Shared Files-store limit for each request image, including file-id references. */
475
+ const MAX_IMAGE_BYTES = 32 * 1024 * 1024;
476
+ const OWNED_FILE_PREFIX = "dsh-";
477
+ /** The Files resource's parent URL identifies the upload namespace. */
478
+ function fileScope(connection) {
479
+ return deepSeekFileScope(messagesApiRoot(connection.baseURL), connection.apiKey);
1437
480
  }
1438
- function invalidResponse(operation) {
1439
- return new LlmError(`DeepSeek Files API returned an invalid ${operation} response.`, "INVALID_RESPONSE");
481
+ function abortReason(signal) {
482
+ const reason = signal.reason;
483
+ return reason instanceof Error ? reason : new Error("DeepSeek file upload cancelled with a non-Error reason.", { cause: reason });
1440
484
  }
1441
- function parseFileObject(value, operation) {
1442
- if (value === null || typeof value !== "object" || Array.isArray(value)) throw invalidResponse(operation);
1443
- const wire = value;
1444
- if (typeof wire.id !== "string" || wire.id.length === 0 || wire.object !== "file" || !Number.isSafeInteger(wire.bytes) || wire.bytes < 0 || !Number.isSafeInteger(wire.created_at) || wire.created_at < 0 || typeof wire.filename !== "string" || wire.filename.length === 0 || wire.purpose !== "user_data" || wire.expires_at !== void 0 && (!Number.isSafeInteger(wire.expires_at) || wire.expires_at < 0)) throw invalidResponse(operation);
1445
- return {
1446
- id: DeepSeekFileId(wire.id),
1447
- bytes: wire.bytes,
1448
- createdAt: wire.created_at,
1449
- filename: wire.filename,
1450
- purpose: "user_data",
1451
- ...wire.expires_at === void 0 ? {} : { expiresAt: wire.expires_at }
485
+ function uploadFailure(error) {
486
+ return error instanceof Error ? error : new Error("DeepSeek file upload failed with a non-Error reason.", { cause: error });
487
+ }
488
+ function waitForUpload(operation, signal) {
489
+ signal?.throwIfAborted();
490
+ operation.waiters += 1;
491
+ let released = false;
492
+ const release = (cancelledReason) => {
493
+ if (released) return;
494
+ released = true;
495
+ operation.waiters -= 1;
496
+ if (cancelledReason !== void 0 && operation.waiters === 0 && !operation.settled) operation.controller.abort(cancelledReason);
1452
497
  };
498
+ if (signal === void 0) return operation.promise.finally(() => {
499
+ release();
500
+ });
501
+ return new Promise((resolve, reject) => {
502
+ const abort = () => {
503
+ const reason = abortReason(signal);
504
+ release(reason);
505
+ reject(reason);
506
+ };
507
+ signal.addEventListener("abort", abort, { once: true });
508
+ operation.promise.then((value) => {
509
+ signal.removeEventListener("abort", abort);
510
+ release();
511
+ resolve(value);
512
+ }, (error) => {
513
+ signal.removeEventListener("abort", abort);
514
+ release();
515
+ reject(uploadFailure(error));
516
+ });
517
+ });
1453
518
  }
1454
- /** Normalize the Messages wire object without interpreting omitted expiration as permanence. */
1455
- function parseMessagesFile(value, operation) {
1456
- if (value === null || typeof value !== "object" || Array.isArray(value)) throw invalidResponse(operation);
1457
- const wire = value;
1458
- const createdAt = typeof wire.created_at === "string" ? Math.floor(Date.parse(wire.created_at) / 1e3) : NaN;
1459
- if (wire.type !== "file" || typeof wire.mime_type !== "string" || !Number.isSafeInteger(createdAt)) throw invalidResponse(operation);
1460
- return parseFileObject({
1461
- id: wire.id,
1462
- object: "file",
1463
- bytes: wire.size_bytes,
1464
- created_at: createdAt,
1465
- filename: wire.filename,
1466
- purpose: "user_data"
1467
- }, operation);
519
+ function extension(mediaType) {
520
+ switch (mediaType) {
521
+ case "image/png": return "png";
522
+ case "image/jpeg": return "jpeg";
523
+ case "image/webp": return "webp";
524
+ case "image/gif": return "gif";
525
+ }
1468
526
  }
1469
- function providerErrorDetail$1(value) {
1470
- if (value === null || typeof value !== "object" || Array.isArray(value)) return { detail: "" };
1471
- const error = value.error;
1472
- if (error === null || typeof error !== "object" || Array.isArray(error)) return { detail: "" };
1473
- const fields = error;
1474
- const message = typeof fields.message === "string" ? fields.message : void 0;
1475
- return {
1476
- ...message === void 0 ? {} : { message },
1477
- detail: [
1478
- fields.code,
1479
- fields.type,
1480
- fields.message
1481
- ].filter((field) => typeof field === "string").join(" ")
1482
- };
527
+ function filename(version) {
528
+ return `${OWNED_FILE_PREFIX}${String(version.attachment.attachmentId).slice(7, 23)}-${String(version.variantId).slice(7, 15)}.${extension(version.mediaType)}`;
1483
529
  }
1484
- /** Direct Files client retaining the configured URL root and refusing redirects before credentials can leave its origin. */
1485
- var DeepSeekFilesClient = class {
1486
- baseURL;
1487
- apiKey;
530
+ /** User-scoped durable file-id reuse for the DeepSeek route. */
531
+ var DeepSeekFileStore = class {
532
+ index;
533
+ now;
1488
534
  fetchImpl;
1489
- protocol;
1490
- path;
535
+ inflight = /* @__PURE__ */ new Map();
536
+ /**
537
+ * @param options - testable index, clock, and transport boundaries.
538
+ */
539
+ constructor(options = {}) {
540
+ this.index = options.index ?? new DeepSeekUploadIndex();
541
+ this.now = options.now ?? Date.now;
542
+ this.fetchImpl = options.fetch;
543
+ }
544
+ client(connection) {
545
+ return new DeepSeekFilesClient({
546
+ baseURL: connection.baseURL,
547
+ apiKey: connection.apiKey,
548
+ ...connection.accountCredential === void 0 ? {} : { accountCredential: connection.accountCredential },
549
+ ...this.fetchImpl === void 0 ? {} : { fetch: this.fetchImpl }
550
+ });
551
+ }
1491
552
  /**
1492
- * @param options - endpoint, API-key snapshot, and optional test transport.
553
+ * Resolve or upload one deterministic request image. Concurrent calls share one upload while retaining independent waits.
554
+ * @param version - deterministic model-request bytes and complete transformation identity.
555
+ * @param connection - endpoint and API-key snapshot.
556
+ * @param policy - expiry and quota-recovery policy.
557
+ * @param signal - cancellation of this wait; shared transport stops when no waiter remains.
558
+ * @returns a reusable file id and whether this call published a new upload.
1493
559
  */
1494
- constructor(options) {
1495
- this.apiKey = options.apiKey;
1496
- this.fetchImpl = options.fetch ?? globalThis.fetch;
1497
- this.protocol = options.protocol;
1498
- this.baseURL = this.protocol === "messages" ? messagesApiRoot(options.baseURL) : options.baseURL.replace(/\/+$/u, "");
1499
- this.path = "/files";
1500
- }
1501
- parseFile(value, operation) {
1502
- return this.protocol === "messages" ? parseMessagesFile(value, operation) : parseFileObject(value, operation);
560
+ ensureUploaded(version, connection, policy, signal) {
561
+ signal?.throwIfAborted();
562
+ const key = `${fileScope(connection)}\0${version.variantId}`;
563
+ let active = this.inflight.get(key);
564
+ if (active?.controller.signal.aborted) {
565
+ this.inflight.delete(key);
566
+ active = void 0;
567
+ }
568
+ if (active !== void 0) return waitForUpload(active, signal);
569
+ const controller = new AbortController();
570
+ const shared = {
571
+ controller,
572
+ settled: false,
573
+ waiters: 0,
574
+ promise: void 0
575
+ };
576
+ shared.promise = this.ensureUploadedOnce(version, connection, policy, controller.signal).then((value) => {
577
+ shared.settled = true;
578
+ return value;
579
+ }, (error) => {
580
+ shared.settled = true;
581
+ throw uploadFailure(error);
582
+ });
583
+ this.inflight.set(key, shared);
584
+ shared.promise.finally(() => {
585
+ if (this.inflight.get(key) === shared) this.inflight.delete(key);
586
+ }).catch(() => {});
587
+ return waitForUpload(shared, signal);
1503
588
  }
1504
- async request(path, init, signal) {
1505
- let response;
1506
- try {
1507
- const headers = new Headers(attributionHeaders());
1508
- if (this.protocol === "messages") {
1509
- headers.set("x-api-key", this.apiKey);
1510
- headers.set("anthropic-version", "2023-06-01");
1511
- headers.set("anthropic-beta", MESSAGES_FILES_BETA);
1512
- } else headers.set("authorization", `Bearer ${this.apiKey}`);
1513
- response = await this.fetchImpl(`${this.baseURL}${path}`, {
1514
- ...init,
1515
- redirect: "error",
1516
- headers,
1517
- ...signal === void 0 ? {} : { signal }
589
+ async ensureUploadedOnce(version, connection, policy, signal) {
590
+ if (version.bytes > 33554432) throw new LlmError("DeepSeek image exceeds the 32 MiB per-image limit.", "INVALID_REQUEST");
591
+ const scope = fileScope(connection);
592
+ const now = this.now();
593
+ const marginMs = policy.refreshMarginSeconds * 1e3;
594
+ const cached = await this.index.get(scope, version.variantId, now, marginMs);
595
+ if (cached !== void 0) return {
596
+ record: cached,
597
+ uploaded: false
598
+ };
599
+ const client = this.client(connection);
600
+ const upload = async () => {
601
+ const remote = await client.upload({
602
+ data: version.data,
603
+ mediaType: version.mediaType,
604
+ filename: filename(version),
605
+ expiresAfterSeconds: policy.expiresAfterSeconds,
606
+ signal
1518
607
  });
608
+ if (remote.bytes !== version.data.byteLength) throw new LlmError("DeepSeek Files API upload response does not match the submitted image.", "INVALID_RESPONSE");
609
+ return {
610
+ scope,
611
+ attachmentId: version.attachment.attachmentId,
612
+ variantId: version.variantId,
613
+ fileId: remote.id,
614
+ bytes: remote.bytes,
615
+ createdAt: remote.createdAt * 1e3,
616
+ expiresAt: remote.expiresAt * 1e3
617
+ };
618
+ };
619
+ let candidate;
620
+ try {
621
+ candidate = await upload();
1519
622
  } catch (error) {
1520
- if (signal?.aborted) throw error;
1521
- throw new LlmError(`DeepSeek Files API request to ${this.baseURL} failed`, "TRANSPORT", { cause: error });
623
+ if (!isFilesQuotaError(error)) throw error;
624
+ if (await this.reclaimOldestOwned(connection, policy.quotaCleanupBatch, signal) === 0) throw error;
625
+ candidate = await upload();
1522
626
  }
1523
- if (response.ok) return response;
1524
- let parsed;
1525
- try {
1526
- parsed = await response.json();
627
+ const committed = await this.index.commit(candidate, this.now(), marginMs);
628
+ if (!committed.accepted) try {
629
+ await client.delete(candidate.fileId, signal);
1527
630
  } catch {}
1528
- const { message, detail } = providerErrorDetail$1(parsed);
1529
- throw new DeepSeekFilesError(message ?? `DeepSeek Files API error (HTTP ${response.status})`, response.status, detail);
631
+ return {
632
+ record: committed.record,
633
+ uploaded: committed.accepted
634
+ };
1530
635
  }
1531
636
  /**
1532
- * Upload one image with an explicit expiry.
1533
- * @param input - deterministic request-version bytes, media type, filename, lifetime, and cancellation.
1534
- * @returns the validated file and reuse deadline. Messages omits expiry metadata;
1535
- * its deadline uses upload creation plus the requested lifetime.
637
+ * Invalidate one exact local mapping after a model request rejects its remote id.
638
+ * @param version - request-image version whose remote generation failed.
639
+ * @param fileId - exact rejected file id.
640
+ * @param connection - endpoint and API-key snapshot.
1536
641
  */
1537
- async upload(input) {
1538
- if (input.data.byteLength > 134217728) throw new LlmError("DeepSeek Files API upload exceeds 128 MiB.", "INVALID_REQUEST");
1539
- if (!Number.isSafeInteger(input.expiresAfterSeconds) || input.expiresAfterSeconds < 3600 || input.expiresAfterSeconds > 2592e3) throw new LlmError("DeepSeek file expiry must be between 3600 and 2592000 seconds.", "INVALID_REQUEST");
1540
- const form = new FormData();
1541
- if (this.protocol === "chat-completions") form.set("purpose", "user_data");
1542
- form.set("expires_after[anchor]", "created_at");
1543
- form.set("expires_after[seconds]", String(input.expiresAfterSeconds));
1544
- form.set("file", new Blob([Uint8Array.from(input.data).buffer], { type: input.mediaType }), input.filename);
1545
- const response = await this.request(this.path, {
1546
- method: "POST",
1547
- body: form
1548
- }, input.signal);
1549
- const file = this.parseFile(await response.json(), "upload");
1550
- if (this.protocol === "messages") return {
1551
- ...file,
1552
- expiresAt: file.createdAt + input.expiresAfterSeconds
1553
- };
1554
- if (file.expiresAt === void 0) throw invalidResponse("upload");
1555
- return {
1556
- ...file,
1557
- expiresAt: file.expiresAt
1558
- };
642
+ async invalidate(version, fileId, connection) {
643
+ await this.index.remove(fileScope(connection), version.variantId, fileId);
1559
644
  }
1560
645
  /**
1561
- * List one page of files. Ordering applies only to Chat Completions; Messages owns its page order.
1562
- * @param options - pagination, ordering, and cancellation.
1563
- * @returns the validated page with null Messages cursors omitted.
646
+ * Delete the indexed remote file for one attachment and remove its local mapping.
647
+ * @param version - exact request-image version to release.
648
+ * @param connection - endpoint and API-key snapshot.
649
+ * @param policy - expiry policy used to locate a reusable mapping.
650
+ * @param signal - request cancellation.
651
+ * @returns whether an indexed file existed and was deleted.
1564
652
  */
1565
- async list(options = {}) {
1566
- const query = new URLSearchParams(this.protocol === "messages" ? {} : { purpose: "user_data" });
1567
- if (options.after !== void 0) query.set(this.protocol === "messages" ? "after_id" : "after", options.after);
1568
- if (options.limit !== void 0) query.set("limit", String(options.limit));
1569
- if (options.order !== void 0 && this.protocol === "chat-completions") query.set("order", options.order);
1570
- const value = await (await this.request(`${this.path}?${query.toString()}`, { method: "GET" }, options.signal)).json();
1571
- if (value === null || typeof value !== "object" || Array.isArray(value)) throw invalidResponse("list");
1572
- const wire = value;
1573
- const firstId = this.protocol === "messages" ? wire.first_id ?? void 0 : wire.first_id;
1574
- const lastId = this.protocol === "messages" ? wire.last_id ?? void 0 : wire.last_id;
1575
- if (this.protocol === "chat-completions" && wire.object !== "list" || !Array.isArray(wire.data) || typeof wire.has_more !== "boolean" || firstId !== void 0 && typeof firstId !== "string" || lastId !== void 0 && typeof lastId !== "string") throw invalidResponse("list");
1576
- return {
1577
- data: wire.data.map((item) => this.parseFile(item, "list")),
1578
- ...typeof firstId === "string" ? { firstId: DeepSeekFileId(firstId) } : {},
1579
- ...typeof lastId === "string" ? { lastId: DeepSeekFileId(lastId) } : {},
1580
- hasMore: wire.has_more
1581
- };
653
+ async release(version, connection, policy, signal) {
654
+ const scope = fileScope(connection);
655
+ const record = await this.index.get(scope, version.variantId, this.now(), policy.refreshMarginSeconds * 1e3);
656
+ if (record === void 0) return false;
657
+ await this.client(connection).delete(record.fileId, signal);
658
+ await this.index.remove(scope, version.variantId, record.fileId);
659
+ return true;
1582
660
  }
1583
661
  /**
1584
- * Retrieve one file object.
1585
- * @param fileId - provider file identifier.
662
+ * Delete the oldest provider files whose names identify harness ownership.
663
+ * @param connection - endpoint and API-key snapshot.
664
+ * @param count - positive maximum number of files to delete.
1586
665
  * @param signal - request cancellation.
1587
- * @returns the validated file object.
666
+ * @returns number of successfully deleted files.
1588
667
  */
1589
- async retrieve(fileId, signal) {
1590
- const response = await this.request(`${this.path}/${encodeURIComponent(fileId)}`, { method: "GET" }, signal);
1591
- return this.parseFile(await response.json(), "retrieve");
668
+ async reclaimOldestOwned(connection, count, signal) {
669
+ const client = this.client(connection);
670
+ let after;
671
+ const owned = [];
672
+ while (true) {
673
+ const page = await client.list({
674
+ ...after === void 0 ? {} : { after },
675
+ limit: 1e3,
676
+ ...signal === void 0 ? {} : { signal }
677
+ });
678
+ for (const file of page.data) {
679
+ if (!file.filename.startsWith(OWNED_FILE_PREFIX)) continue;
680
+ owned.push({
681
+ id: file.id,
682
+ createdAt: file.createdAt
683
+ });
684
+ }
685
+ owned.sort((left, right) => left.createdAt - right.createdAt);
686
+ owned.splice(count);
687
+ if (!page.hasMore || page.lastId === void 0 || page.lastId === after) break;
688
+ after = page.lastId;
689
+ }
690
+ for (const file of owned) await client.delete(file.id, signal);
691
+ return owned.length;
1592
692
  }
1593
693
  /**
1594
- * Delete one provider file.
1595
- * @param fileId - provider file identifier.
694
+ * Delete every remote harness-owned file in the active API-key namespace and clear its index.
695
+ * @param connection - endpoint and API-key snapshot.
1596
696
  * @param signal - request cancellation.
697
+ * @returns number of deleted files.
1597
698
  */
1598
- async delete(fileId, signal) {
1599
- const value = await (await this.request(`${this.path}/${encodeURIComponent(fileId)}`, { method: "DELETE" }, signal)).json();
1600
- if (value === null || typeof value !== "object" || Array.isArray(value)) throw invalidResponse("delete");
1601
- const wire = value;
1602
- if (wire.id !== fileId || (this.protocol === "messages" ? wire.type !== "file_deleted" : wire.object !== "file" || wire.deleted !== true)) throw invalidResponse("delete");
699
+ async releaseAll(connection, signal) {
700
+ let total = 0;
701
+ for (;;) {
702
+ const deleted = await this.reclaimOldestOwned(connection, 1e3, signal);
703
+ total += deleted;
704
+ if (deleted < 1e3) break;
705
+ }
706
+ await this.index.clear(fileScope(connection));
707
+ return total;
708
+ }
709
+ };
710
+ //#endregion
711
+ //#region lib/types/request-files.js
712
+ /** Shared Files resolution, bounded stale-id recovery, and normalized-image diagnostics. */
713
+ var __addDisposableResource$1 = function(env, value, async) {
714
+ if (value !== null && value !== void 0) {
715
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
716
+ var dispose, inner;
717
+ if (async) {
718
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
719
+ dispose = value[Symbol.asyncDispose];
720
+ }
721
+ if (dispose === void 0) {
722
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
723
+ dispose = value[Symbol.dispose];
724
+ if (async) inner = dispose;
725
+ }
726
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
727
+ if (inner) dispose = function() {
728
+ try {
729
+ inner.call(this);
730
+ } catch (e) {
731
+ return Promise.reject(e);
732
+ }
733
+ };
734
+ env.stack.push({
735
+ value,
736
+ dispose,
737
+ async
738
+ });
739
+ } else if (async) env.stack.push({ async: true });
740
+ return value;
741
+ };
742
+ var __disposeResources$1 = (function(SuppressedError) {
743
+ return function(env) {
744
+ function fail(e) {
745
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
746
+ env.hasError = true;
747
+ }
748
+ var r, s = 0;
749
+ function next() {
750
+ while (r = env.stack.pop()) try {
751
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
752
+ if (r.dispose) {
753
+ var result = r.dispose.call(r.value);
754
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
755
+ fail(e);
756
+ return next();
757
+ });
758
+ } else s |= 1;
759
+ } catch (e) {
760
+ fail(e);
761
+ }
762
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
763
+ if (env.hasError) throw env.error;
764
+ }
765
+ return next();
766
+ };
767
+ })(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
768
+ var e = new Error(message);
769
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
770
+ });
771
+ /** A file upload failure eligible for request-wide inline fallback. */
772
+ var FileResolutionFailure = class extends Error {
773
+ constructor(cause) {
774
+ super("DeepSeek Files API could not resolve a request image.", { cause });
775
+ this.name = "FileResolutionFailure";
1603
776
  }
1604
777
  };
1605
- //#endregion
1606
- //#region lib/types/common/upload-index.js
1607
- /** Durable DeepSeek attachment-to-file-id index. @module dsh-llm-deepseek/upload-index */
1608
- var InvalidUploadIndexError = class extends Error {};
1609
- /**
1610
- * Derive a non-secret stable index namespace without persisting or logging the API key.
1611
- * @param baseURL - normalized provider endpoint namespace.
1612
- * @param apiKey - resolved credential used only as hash input.
1613
- * @returns branded SHA-256 namespace digest.
1614
- */
1615
- function deepSeekFileScope(baseURL, apiKey) {
1616
- return DeepSeekFileScope(createHash("sha256").update(baseURL.replace(/\/+$/u, "")).update("\0").update(apiKey).digest("hex"));
1617
- }
1618
- function absent(error) {
1619
- return error?.code === "ENOENT";
778
+ function providerRejectedNormalizedImage(detail) {
779
+ return /(?:unsupported|invalid|cannot read|failed to (?:decode|process)).{0,40}image/iu.test(detail) || /image.{0,40}(?:unsupported|invalid|cannot be decoded)/iu.test(detail);
1620
780
  }
1621
- function parseRecord(value) {
1622
- if (value === null || typeof value !== "object" || Array.isArray(value)) throw new InvalidUploadIndexError("llm-deepseek: upload index contains a non-object record");
1623
- const record = value;
1624
- if (typeof record.scope !== "string" || !/^[0-9a-f]{64}$/u.test(record.scope) || typeof record.attachmentId !== "string" || !/^sha256:[0-9a-f]{64}$/u.test(record.attachmentId) || typeof record.variantId !== "string" || !/^sha256:[0-9a-f]{64}$/u.test(record.variantId) || typeof record.fileId !== "string" || record.fileId.length === 0 || !Number.isSafeInteger(record.bytes) || record.bytes < 0 || !Number.isSafeInteger(record.createdAt) || record.createdAt < 0 || !Number.isSafeInteger(record.expiresAt) || record.expiresAt < 0) throw new InvalidUploadIndexError("llm-deepseek: upload index contains an invalid record");
1625
- return {
1626
- scope: DeepSeekFileScope(record.scope),
1627
- attachmentId: record.attachmentId,
1628
- variantId: ImageVariantId(record.variantId),
1629
- fileId: DeepSeekFileId(record.fileId),
1630
- bytes: record.bytes,
1631
- createdAt: record.createdAt,
1632
- expiresAt: record.expiresAt
1633
- };
781
+ function providerRejectedFileId(detail) {
782
+ const file = /\bfile(?:[_ -]?(?:id|api|not[_ -]?found|deleted|expired))?/iu.test(detail);
783
+ const missing = /(?:expired|not[_ -]?found|deleted|do(?:es)? not exist|not created under (?:this|your) account)/iu.test(detail);
784
+ const invalidId = /(?:invalid.{0,20}file[_ -]?(?:id|api)|file[_ -]?(?:id|api).{0,20}invalid)/iu.test(detail);
785
+ return file && (missing || invalidId);
1634
786
  }
1635
- function parseIndex(text) {
1636
- let value;
1637
- try {
1638
- value = JSON.parse(text);
1639
- } catch (error) {
1640
- throw new InvalidUploadIndexError("llm-deepseek: upload index is not valid JSON", { cause: error });
1641
- }
1642
- if (value === null || typeof value !== "object" || Array.isArray(value)) throw new InvalidUploadIndexError("llm-deepseek: upload index is not an object");
1643
- const index = value;
1644
- if (index.formatVersion !== 3 || !Array.isArray(index.records)) throw new InvalidUploadIndexError("llm-deepseek: unsupported upload index format");
1645
- const records = index.records.map(parseRecord);
1646
- const keys = /* @__PURE__ */ new Set();
1647
- for (const record of records) {
1648
- const key = `${record.scope}\0${record.variantId}`;
1649
- if (keys.has(key)) throw new InvalidUploadIndexError("llm-deepseek: upload index contains duplicate mappings");
1650
- keys.add(key);
787
+ function detailNamesFileId(detail, fileId) {
788
+ let index = detail.indexOf(fileId);
789
+ while (index >= 0) {
790
+ const before = detail[index - 1];
791
+ const after = detail[index + fileId.length];
792
+ if ((before === void 0 || !/[\p{L}\p{N}_-]/u.test(before)) && (after === void 0 || !/[\p{L}\p{N}_-]/u.test(after))) return true;
793
+ index = detail.indexOf(fileId, index + 1);
1651
794
  }
1652
- return {
1653
- formatVersion: 3,
1654
- records
1655
- };
795
+ return false;
1656
796
  }
1657
- function reusable(record, now, refreshMarginMs) {
1658
- return record.expiresAt - now > refreshMarginMs;
797
+ function staleMappings(files, detail) {
798
+ const unique = [...new Map(files.map((file) => [`${file.version.variantId}\0${file.fileId}`, file])).values()];
799
+ const exact = unique.filter((file) => detailNamesFileId(detail, file.fileId));
800
+ return exact.length > 0 ? exact : unique;
1659
801
  }
1660
- /** Atomic local index shared by every DeepSeek session in this DSH home. */
1661
- var DeepSeekUploadIndex = class {
1662
- /** Absolute owner-private JSON index path. */
1663
- path;
1664
- /**
1665
- * @param path - explicit test path; omission uses `DSH_HOME/llm-deepseek/files-v3.json`.
1666
- */
1667
- constructor(path = join(resolveDshHome(), "llm-deepseek", "files-v3.json")) {
1668
- this.path = path;
1669
- }
1670
- async load() {
1671
- try {
1672
- return parseIndex(await readFile(this.path, "utf8"));
1673
- } catch (error) {
1674
- if (absent(error) || error instanceof InvalidUploadIndexError) return {
1675
- formatVersion: 3,
1676
- records: []
1677
- };
1678
- throw error;
1679
- }
1680
- }
1681
- async save(index) {
1682
- await writeFileAtomic(this.path, `${JSON.stringify(index, void 0, 2)}\n`, {
1683
- mode: 384,
1684
- dirMode: 448
1685
- });
802
+ function normalizedImageFacts(file) {
803
+ const version = file.version;
804
+ const name = version.attachment.name ?? version.attachment.attachmentId;
805
+ const colour = version.hasAlpha ? "sRGBA" : "sRGB";
806
+ return `"${name}" at message ${file.location.message}, image ${file.location.image} (${version.mediaType}, 8-bit ${colour}, ${version.width}x${version.height})`;
807
+ }
808
+ function normalizedImageDiagnostic(files, providerMessage, providerDetail) {
809
+ const target = files.find((file) => detailNamesFileId(providerDetail, file.fileId)) ?? (files.length === 1 ? files[0] : void 0);
810
+ if (target !== void 0) return `DeepSeek rejected normalized image ${normalizedImageFacts(target)}: ${providerMessage}. The provider rejected bytes already normalized by the harness; PNG, JPEG, WebP, and GIF remain supported input formats.`;
811
+ return `DeepSeek rejected a normalized request image: ${providerMessage}. Candidate images: ${[...new Map(files.map((file) => [`${file.version.variantId}\0${file.location.message}\0${file.location.image}`, file])).values()].map(normalizedImageFacts).join("; ")}. The provider rejected bytes already normalized by the harness; PNG, JPEG, WebP, and GIF remain supported input formats.`;
812
+ }
813
+ /** Files state owned by one model request, including at most one stale-id retry. */
814
+ var RequestFiles = class {
815
+ files;
816
+ connection;
817
+ policy;
818
+ timeoutMs;
819
+ signal;
820
+ activity;
821
+ used = [];
822
+ retried = false;
823
+ constructor(files, connection, policy, timeoutMs, signal, activity) {
824
+ this.files = files;
825
+ this.connection = connection;
826
+ this.policy = policy;
827
+ this.timeoutMs = timeoutMs;
828
+ this.signal = signal;
829
+ this.activity = activity;
1686
830
  }
1687
- /**
1688
- * Read one reusable mapping.
1689
- * @param scope - endpoint/API-key namespace.
1690
- * @param variantId - complete request-image transformation identity.
1691
- * @param now - current Unix time in milliseconds.
1692
- * @param refreshMarginMs - remaining lifetime below which a mapping is not reused.
1693
- * @returns the mapping when it has enough lifetime remaining.
1694
- */
1695
- async get(scope, variantId, now, refreshMarginMs) {
1696
- const record = (await this.load()).records.find((candidate) => candidate.scope === scope && candidate.variantId === variantId);
1697
- return record !== void 0 && reusable(record, now, refreshMarginMs) ? record : void 0;
831
+ /** Reset occurrence tracking before serializing the next HTTP attempt. */
832
+ beginAttempt() {
833
+ this.used = [];
1698
834
  }
1699
835
  /**
1700
- * Publish a completed upload unless another process already published a reusable mapping.
1701
- * @param candidate - completed remote upload.
1702
- * @param now - current Unix time in milliseconds.
1703
- * @param refreshMarginMs - minimum reusable remaining lifetime.
1704
- * @returns the winning record and whether the candidate entered the index.
836
+ * Resolve a retained image under its own upload deadline.
837
+ * @param version - prepared request image.
838
+ * @param location - occurrence used by provider-rejection diagnostics.
839
+ * @returns the reusable provider id.
1705
840
  */
1706
- async commit(candidate, now, refreshMarginMs) {
1707
- await mkdir(dirname(this.path), {
1708
- recursive: true,
1709
- mode: 448
1710
- });
1711
- return withFileLock(this.path, async () => {
1712
- const index = await this.load();
1713
- const existing = index.records.find((record) => record.scope === candidate.scope && record.variantId === candidate.variantId && reusable(record, now, refreshMarginMs));
1714
- if (existing !== void 0) return {
1715
- record: existing,
1716
- accepted: false
1717
- };
1718
- const records = index.records.filter((record) => reusable(record, now, refreshMarginMs) && !(record.scope === candidate.scope && record.variantId === candidate.variantId));
1719
- records.push(candidate);
1720
- await this.save({
1721
- formatVersion: 3,
1722
- records
841
+ async resolve(version, location) {
842
+ const env_1 = {
843
+ stack: [],
844
+ error: void 0,
845
+ hasError: false
846
+ };
847
+ try {
848
+ const limit = __addDisposableResource$1(env_1, deadline(this.signal, this.timeoutMs, "DEEPSEEK_FILES_API_TIMEOUT"), false);
849
+ let resolved;
850
+ try {
851
+ resolved = await this.files.ensureUploaded(version, this.connection, this.policy, limit.signal);
852
+ } catch (error) {
853
+ if (this.signal.aborted) throw error;
854
+ throw new FileResolutionFailure(error);
855
+ }
856
+ this.activity();
857
+ this.used.push({
858
+ version,
859
+ fileId: resolved.record.fileId,
860
+ location
1723
861
  });
1724
- return {
1725
- record: candidate,
1726
- accepted: true
1727
- };
1728
- });
862
+ return resolved.record.fileId;
863
+ } catch (e_1) {
864
+ env_1.error = e_1;
865
+ env_1.hasError = true;
866
+ } finally {
867
+ __disposeResources$1(env_1);
868
+ }
1729
869
  }
1730
870
  /**
1731
- * Remove one exact mapping without deleting a concurrently installed successor.
1732
- * @param scope - endpoint/API-key namespace.
1733
- * @param variantId - complete request-image transformation identity.
1734
- * @param fileId - exact remote generation being invalidated.
871
+ * Invalidate rejected mappings; only the first stale-id response permits another request.
872
+ * @param detail - provider error fields used for stale-id classification.
873
+ * @returns whether the caller should serialize and dispatch again.
1735
874
  */
1736
- async remove(scope, variantId, fileId) {
1737
- await mkdir(dirname(this.path), {
1738
- recursive: true,
1739
- mode: 448
1740
- });
1741
- await withFileLock(this.path, async () => {
1742
- const index = await this.load();
1743
- const records = index.records.filter((record) => !(record.scope === scope && record.variantId === variantId && record.fileId === fileId));
1744
- if (records.length !== index.records.length) await this.save({
1745
- formatVersion: 3,
1746
- records
1747
- });
1748
- });
875
+ async retry(detail) {
876
+ if (this.used.length === 0 || !providerRejectedFileId(detail)) return false;
877
+ await Promise.all(staleMappings(this.used, detail).map((file) => this.files.invalidate(file.version, file.fileId, this.connection)));
878
+ if (this.retried) return false;
879
+ this.retried = true;
880
+ return true;
1749
881
  }
1750
882
  /**
1751
- * Remove every local mapping for one remote namespace.
1752
- * @param scope - endpoint/API-key namespace.
883
+ * Attribute a normalized-image rejection to the actual uploaded image occurrences.
884
+ * @param status - rejected request's HTTP status.
885
+ * @param message - provider's error message.
886
+ * @param detail - provider error classification fields.
887
+ * @returns the image diagnostic or the original provider message.
1753
888
  */
1754
- async clear(scope) {
1755
- await mkdir(dirname(this.path), {
1756
- recursive: true,
1757
- mode: 448
1758
- });
1759
- await withFileLock(this.path, async () => {
1760
- const index = await this.load();
1761
- const records = index.records.filter((record) => record.scope !== scope);
1762
- if (records.length !== index.records.length) await this.save({
1763
- formatVersion: 3,
1764
- records
1765
- });
889
+ errorMessage(status, message, detail) {
890
+ return status === 400 && this.used.length > 0 && providerRejectedNormalizedImage(detail) ? normalizedImageDiagnostic(this.used, message, detail) : message;
891
+ }
892
+ };
893
+ //#endregion
894
+ //#region lib/types/request-extensions.js
895
+ /** Prepare plugin-contributed request fields and commit their delivery after HTTP acceptance. */
896
+ /**
897
+ * Merge contributions without replacing Messages fields. Preparation and
898
+ * acceptance failures report REQUEST_EXTENSION.
899
+ * @param body - serialized Messages request before extension fields.
900
+ * @param options - request identity, purpose, and cancellation.
901
+ * @param prepare - contributor registry captured for this adapter.
902
+ * @returns HTTP payload and a commit to invoke only after a successful HTTP response.
903
+ */
904
+ async function prepareRequestExtensions(body, options, prepare) {
905
+ let extensions;
906
+ try {
907
+ extensions = await prepare({
908
+ body,
909
+ ...options
1766
910
  });
911
+ } catch (error) {
912
+ throw new LlmError("DeepSeek request extension preparation failed", "REQUEST_EXTENSION", { cause: error });
1767
913
  }
1768
- };
914
+ for (const field of Object.keys(extensions.fields)) if (Object.hasOwn(body, field)) throw new LlmError(`DeepSeek request extension field ${JSON.stringify(field)} collides with the base request`, "REQUEST_EXTENSION");
915
+ return {
916
+ payload: JSON.stringify({
917
+ ...body,
918
+ ...extensions.fields
919
+ }),
920
+ async accept() {
921
+ try {
922
+ await extensions.accept();
923
+ } catch (error) {
924
+ throw new LlmError("DeepSeek request extension acceptance failed", "REQUEST_EXTENSION", { cause: error });
925
+ }
926
+ }
927
+ };
928
+ }
1769
929
  //#endregion
1770
- //#region lib/types/common/file-store.js
1771
- /** DeepSeek Files API upload reuse, invalidation, and quota recovery. @module dsh-llm-deepseek/file-store */
1772
- /** Shared Files-store limit for each request image, including file-id references. */
1773
- const MAX_IMAGE_BYTES = 32 * 1024 * 1024;
1774
- const OWNED_FILE_PREFIX = "dsh-";
1775
- /** The Files resource's parent URL distinguishes custom protocol namespaces. */
1776
- function fileScope(connection) {
1777
- return deepSeekFileScope(connection.protocol === "messages" ? messagesApiRoot(connection.baseURL) : connection.baseURL, connection.apiKey);
930
+ //#region lib/types/image-tokens.js
931
+ /**
932
+ * DeepSeek vision-token accounting: the provider's published image-token
933
+ * calculator (api-docs.deepseek.com, Token & Token Usage) ported verbatim in
934
+ * its current `v41` configuration. The provider scales an image below
935
+ * 544×544 total pixels up, aligns it to a 14px-patch grid, downsamples 3:1
936
+ * per axis into token cells, and caps one image at 1024 tokens by solving the
937
+ * largest aspect-preserving grid inside that budget. The count is exact: this
938
+ * configuration has no alignment pad and no aspect-ratio clamp. Actual usage
939
+ * remains authoritative.
940
+ *
941
+ * @module dsh-llm-deepseek/image-tokens
942
+ */
943
+ /** Vision patch edge in pixels. */
944
+ const PATCH_SIZE = 14;
945
+ /** Per-axis patch-to-token downsampling ratio. */
946
+ const DOWNSAMPLE_RATIO = 3;
947
+ /** Provider cap on tokens for one request image. */
948
+ const MAX_IMAGE_TOKENS = 1024;
949
+ /** Total-pixel floor; smaller images are scaled up before grid projection. */
950
+ const MIN_PIXELS = 544 * 544;
951
+ /** Pixels covered by one token cell along either axis. */
952
+ const CELL_SIZE = PATCH_SIZE * DOWNSAMPLE_RATIO;
953
+ const intDiv = (value, divisor) => Math.floor(value / divisor);
954
+ const ceilDiv = (value, divisor) => Math.floor((value + divisor - 1) / divisor);
955
+ /** Token count of one grid: every row carries a separator, plus two framing tokens. */
956
+ function gridTokens(gridHeight, gridWidth) {
957
+ return gridHeight * (gridWidth + 1) + 2;
1778
958
  }
1779
- function abortReason(signal) {
1780
- const reason = signal.reason;
1781
- return reason instanceof Error ? reason : new Error("DeepSeek file upload cancelled with a non-Error reason.", { cause: reason });
959
+ /** Token-cell count along one padded pixel axis. */
960
+ function gridCells(paddedLength) {
961
+ return ceilDiv(intDiv(paddedLength, PATCH_SIZE), DOWNSAMPLE_RATIO);
1782
962
  }
1783
- function uploadFailure(error) {
1784
- return error instanceof Error ? error : new Error("DeepSeek file upload failed with a non-Error reason.", { cause: error });
963
+ /** Solve the largest grid within `budget` tokens preserving the aspect ratio. */
964
+ function solveResizeRatio(height, width, budget) {
965
+ const aspect = height / width;
966
+ const idealGridWidth = Math.sqrt((budget - 2) / aspect + .25) - .5;
967
+ const idealGridHeight = idealGridWidth * aspect;
968
+ let bestHeight;
969
+ let bestWidth;
970
+ if (idealGridWidth < 1) {
971
+ const solvedGridWidth = 1;
972
+ const solvedGridHeight = intDiv(budget - 2, 2);
973
+ bestWidth = solvedGridWidth * CELL_SIZE;
974
+ bestHeight = solvedGridHeight * CELL_SIZE;
975
+ } else if (idealGridHeight < 1) {
976
+ const solvedGridHeight = 1;
977
+ bestWidth = (intDiv(budget - 2, solvedGridHeight) - 1) * CELL_SIZE;
978
+ bestHeight = solvedGridHeight * CELL_SIZE;
979
+ } else {
980
+ const solvedGridWidth = Math.trunc(idealGridWidth);
981
+ const solvedGridHeight = Math.trunc(idealGridHeight);
982
+ const scale = Math.min(solvedGridWidth * CELL_SIZE / width, solvedGridHeight * CELL_SIZE / height);
983
+ bestWidth = Math.trunc(width * scale / PATCH_SIZE) * PATCH_SIZE;
984
+ bestHeight = Math.trunc(height * scale / PATCH_SIZE) * PATCH_SIZE;
985
+ }
986
+ const gridHeight = gridCells(bestHeight);
987
+ const gridWidth = gridCells(bestWidth);
988
+ return {
989
+ gridHeight,
990
+ gridWidth,
991
+ bestHeight,
992
+ bestWidth,
993
+ numTokens: gridTokens(gridHeight, gridWidth)
994
+ };
1785
995
  }
1786
- function waitForUpload(operation, signal) {
1787
- signal?.throwIfAborted();
1788
- operation.waiters += 1;
1789
- let released = false;
1790
- const release = (cancelledReason) => {
1791
- if (released) return;
1792
- released = true;
1793
- operation.waiters -= 1;
1794
- if (cancelledReason !== void 0 && operation.waiters === 0 && !operation.settled) operation.controller.abort(cancelledReason);
996
+ /** Project padded pixel dimensions onto the largest in-budget token grid. */
997
+ function safeResize(height, width, paddedHeight, paddedWidth) {
998
+ const gridHeight = gridCells(paddedHeight);
999
+ const gridWidth = gridCells(paddedWidth);
1000
+ const direct = {
1001
+ gridHeight,
1002
+ gridWidth,
1003
+ bestHeight: paddedHeight,
1004
+ bestWidth: paddedWidth,
1005
+ numTokens: gridTokens(gridHeight, gridWidth)
1795
1006
  };
1796
- if (signal === void 0) return operation.promise.finally(() => {
1797
- release();
1798
- });
1799
- return new Promise((resolve, reject) => {
1800
- const abort = () => {
1801
- const reason = abortReason(signal);
1802
- release(reason);
1803
- reject(reason);
1804
- };
1805
- signal.addEventListener("abort", abort, { once: true });
1806
- operation.promise.then((value) => {
1807
- signal.removeEventListener("abort", abort);
1808
- release();
1809
- resolve(value);
1810
- }, (error) => {
1811
- signal.removeEventListener("abort", abort);
1812
- release();
1813
- reject(uploadFailure(error));
1814
- });
1815
- });
1007
+ if (direct.numTokens <= MAX_IMAGE_TOKENS) return direct;
1008
+ const solved = solveResizeRatio(height, width, MAX_IMAGE_TOKENS);
1009
+ /* v8 ignore next 3 -- the published solver's assertion; the closed-form
1010
+ solve stays within the budget for every positive geometry. */
1011
+ if (solved.numTokens > MAX_IMAGE_TOKENS) throw new Error(`deepseek image tokens: no grid fits the token budget for ${width}x${height}`);
1012
+ return solved;
1816
1013
  }
1817
- function extension(mediaType) {
1818
- switch (mediaType) {
1819
- case "image/png": return "png";
1820
- case "image/jpeg": return "jpeg";
1821
- case "image/webp": return "webp";
1822
- case "image/gif": return "gif";
1014
+ /** One scale-pad-project pass; the caller iterates it to a fixpoint. */
1015
+ function resizeOnce(width, height) {
1016
+ let scaledWidth = width;
1017
+ let scaledHeight = height;
1018
+ const pixels = scaledWidth * scaledHeight;
1019
+ if (pixels < MIN_PIXELS && pixels > 0) {
1020
+ const scale = Math.sqrt(MIN_PIXELS / pixels);
1021
+ scaledWidth = Math.trunc(scaledWidth * scale);
1022
+ scaledHeight = Math.trunc(scaledHeight * scale);
1823
1023
  }
1024
+ const paddedWidth = ceilDiv(scaledWidth, PATCH_SIZE) * PATCH_SIZE;
1025
+ const paddedHeight = ceilDiv(scaledHeight, PATCH_SIZE) * PATCH_SIZE;
1026
+ return safeResize(scaledHeight, scaledWidth, paddedHeight, paddedWidth);
1824
1027
  }
1825
- function filename(version) {
1826
- return `${OWNED_FILE_PREFIX}${String(version.attachment.attachmentId).slice(7, 23)}-${String(version.variantId).slice(7, 15)}.${extension(version.mediaType)}`;
1028
+ function sameResize(a, b) {
1029
+ return a.gridHeight === b.gridHeight && a.gridWidth === b.gridWidth && a.bestHeight === b.bestHeight && a.bestWidth === b.bestWidth && a.numTokens === b.numTokens;
1030
+ }
1031
+ /**
1032
+ * Dimensions the harness sends so the provider keeps the whole image: the
1033
+ * source itself when its patch-padded grid fits the token cap, otherwise the
1034
+ * source aspect ratio at the solved grid's long edge. The provider pads the
1035
+ * short edge to whole patches on its side. Rounding the aspect-preserving
1036
+ * short edge can change the token count from the source's solved grid;
1037
+ * request pricing uses the sent dimensions. Small images are never enlarged.
1038
+ * @param width - positive integer source width in pixels.
1039
+ * @param height - positive integer source height in pixels.
1040
+ * @returns the request dimensions to encode.
1041
+ */
1042
+ function deepSeekRequestImageDimensions(width, height) {
1043
+ const paddedWidth = ceilDiv(width, PATCH_SIZE) * PATCH_SIZE;
1044
+ if (gridTokens(gridCells(ceilDiv(height, PATCH_SIZE) * PATCH_SIZE), gridCells(paddedWidth)) <= MAX_IMAGE_TOKENS) return {
1045
+ width,
1046
+ height
1047
+ };
1048
+ const solved = solveResizeRatio(height, width, MAX_IMAGE_TOKENS);
1049
+ return longEdgeDimensions(width, height, width >= height ? solved.bestWidth : solved.bestHeight);
1050
+ }
1051
+ /**
1052
+ * Vision tokens DeepSeek charges for one request image of the given
1053
+ * dimensions.
1054
+ * @param width - positive integer request-image width in pixels.
1055
+ * @param height - positive integer request-image height in pixels.
1056
+ * @returns the provider vision-token price, at most 1024.
1057
+ */
1058
+ function deepSeekImageTokens(width, height) {
1059
+ let result = resizeOnce(width, height);
1060
+ for (let iteration = 1; iteration < 10; iteration += 1) {
1061
+ const next = resizeOnce(result.bestWidth, result.bestHeight);
1062
+ if (sameResize(next, result)) return result.numTokens;
1063
+ result = next;
1064
+ }
1065
+ /* v8 ignore next 2 -- the published solver's non-convergence guard; every
1066
+ pass is a projection, so a second identical pass is a fixpoint. */
1067
+ throw new Error(`deepseek image tokens: resize did not converge for ${width}x${height}`);
1068
+ }
1069
+ //#endregion
1070
+ //#region lib/types/request-pricing.js
1071
+ /**
1072
+ * Provider-side request-image pricing for DeepSeek routes: prices every
1073
+ * retained surface occurrence at its per-model request target with
1074
+ * the published vision-token accounting, and every occurrence the surface
1075
+ * marks offloaded as its placeholder text. Consumed synchronously by the
1076
+ * token meter through `LlmAdapter.imageRequestPricing`; provider usage
1077
+ * remains the authoritative anchor for completed requests.
1078
+ *
1079
+ * @module dsh-llm-deepseek/request-pricing
1080
+ */
1081
+ /** Default bound on accumulated file-referenced image bytes per request. */
1082
+ const DEFAULT_MAX_REQUEST_FILES_BYTES = 128 * 1024 * 1024;
1083
+ /** Provider request image-count limit. */
1084
+ const DEFAULT_MAX_IMAGES_PER_REQUEST = 600;
1085
+ /** Total-pixel budget matching provider low-detail image input. */
1086
+ const DEFAULT_LOW_DETAIL_IMAGE_PIXEL_BUDGET = 512 * 512;
1087
+ /** Encoded-byte target for one deterministic model-request image; the smallest quality-ladder output is used when no quality fits. */
1088
+ const DEFAULT_REQUEST_IMAGE_MAX_BYTES = 2 * 1024 * 1024;
1089
+ /**
1090
+ * Provider per-side limit for a request carrying 15 or more images, applied
1091
+ * to every request image so the image count never changes a projection.
1092
+ */
1093
+ const REQUEST_IMAGE_MAX_DIMENSION = 4096;
1094
+ /**
1095
+ * Resolve the encoded-byte target one DeepSeek model route applies to every request image.
1096
+ * @param model - Advertised model route and its optional image overrides.
1097
+ * @returns the route's encoded-byte target.
1098
+ * @internal
1099
+ */
1100
+ function resolveRequestImageMaxBytes(model) {
1101
+ return model.imageMaxBytes ?? 2097152;
1102
+ }
1103
+ /**
1104
+ * Resolve the deterministic request target one DeepSeek model route chooses
1105
+ * for one source image: the published token grid unless the model overrides
1106
+ * it with a pixel budget, then the provider per-side limit, then the route's
1107
+ * encoded-byte target. Small images are never enlarged.
1108
+ * @param model - Advertised model route and its optional image overrides.
1109
+ * @param source - intrinsic dimensions of the normalized attachment.
1110
+ * @returns Complete request dimensions and encoded-byte target.
1111
+ * @internal
1112
+ */
1113
+ function resolveRequestImageTarget(model, source) {
1114
+ const budget = model.imagePixelBudget === "low" ? DEFAULT_LOW_DETAIL_IMAGE_PIXEL_BUDGET : model.imagePixelBudget;
1115
+ const projected = budget === void 0 ? deepSeekRequestImageDimensions(source.width, source.height) : requestImageDimensions(source.width, source.height, budget);
1116
+ return {
1117
+ ...Math.max(projected.width, projected.height) > 4096 ? longEdgeDimensions(source.width, source.height, REQUEST_IMAGE_MAX_DIMENSION) : projected,
1118
+ maxBytes: resolveRequestImageMaxBytes(model)
1119
+ };
1120
+ }
1121
+ /**
1122
+ * Price one occurrence a text-only route substitutes with deterministic text,
1123
+ * reproducing the `projectImagesForTextModel` substitution `LlmRuntime`
1124
+ * applies before dispatching to a route without the `image` modality.
1125
+ */
1126
+ function textOnlyPrice(block) {
1127
+ return {
1128
+ visualTokens: 0,
1129
+ text: textOnlyImageText(block.attachment)
1130
+ };
1827
1131
  }
1828
- /** User-scoped durable file-id reuse for the DeepSeek route. */
1829
- var DeepSeekFileStore = class {
1830
- index;
1831
- now;
1832
- fetchImpl;
1833
- inflight = /* @__PURE__ */ new Map();
1834
- /**
1835
- * @param options - testable index, clock, and transport boundaries.
1836
- */
1837
- constructor(options = {}) {
1838
- this.index = options.index ?? new DeepSeekUploadIndex();
1839
- this.now = options.now ?? Date.now;
1840
- this.fetchImpl = options.fetch;
1841
- }
1842
- client(connection) {
1843
- return new DeepSeekFilesClient({
1844
- baseURL: connection.baseURL,
1845
- apiKey: connection.apiKey,
1846
- protocol: connection.protocol,
1847
- ...this.fetchImpl === void 0 ? {} : { fetch: this.fetchImpl }
1848
- });
1849
- }
1850
- /**
1851
- * Resolve or upload one deterministic request image. Concurrent calls share one upload while retaining independent waits.
1852
- * @param version - deterministic model-request bytes and complete transformation identity.
1853
- * @param connection - endpoint and API-key snapshot.
1854
- * @param policy - expiry and quota-recovery policy.
1855
- * @param signal - cancellation of this wait; shared transport stops when no waiter remains.
1856
- * @returns a reusable file id and whether this call published a new upload.
1857
- */
1858
- ensureUploaded(version, connection, policy, signal) {
1859
- signal?.throwIfAborted();
1860
- const key = `${fileScope(connection)}\0${version.variantId}`;
1861
- let active = this.inflight.get(key);
1862
- if (active?.controller.signal.aborted) {
1863
- this.inflight.delete(key);
1864
- active = void 0;
1865
- }
1866
- if (active !== void 0) return waitForUpload(active, signal);
1867
- const controller = new AbortController();
1868
- const shared = {
1869
- controller,
1870
- settled: false,
1871
- waiters: 0,
1872
- promise: void 0
1873
- };
1874
- shared.promise = this.ensureUploadedOnce(version, connection, policy, controller.signal).then((value) => {
1875
- shared.settled = true;
1876
- return value;
1877
- }, (error) => {
1878
- shared.settled = true;
1879
- throw uploadFailure(error);
1880
- });
1881
- this.inflight.set(key, shared);
1882
- shared.promise.finally(() => {
1883
- if (this.inflight.get(key) === shared) this.inflight.delete(key);
1884
- }).catch(() => {});
1885
- return waitForUpload(shared, signal);
1886
- }
1887
- async ensureUploadedOnce(version, connection, policy, signal) {
1888
- if (version.bytes > 33554432) throw new LlmError("DeepSeek image exceeds the 32 MiB per-image limit.", "INVALID_REQUEST");
1889
- const scope = fileScope(connection);
1890
- const now = this.now();
1891
- const marginMs = policy.refreshMarginSeconds * 1e3;
1892
- const cached = await this.index.get(scope, version.variantId, now, marginMs);
1893
- if (cached !== void 0) return {
1894
- record: cached,
1895
- uploaded: false
1896
- };
1897
- const client = this.client(connection);
1898
- const upload = async () => {
1899
- const remote = await client.upload({
1900
- data: version.data,
1901
- mediaType: version.mediaType,
1902
- filename: filename(version),
1903
- expiresAfterSeconds: policy.expiresAfterSeconds,
1904
- signal
1905
- });
1906
- if (remote.bytes !== version.data.byteLength) throw new LlmError("DeepSeek Files API upload response does not match the submitted image.", "INVALID_RESPONSE");
1907
- return {
1908
- scope,
1909
- attachmentId: version.attachment.attachmentId,
1910
- variantId: version.variantId,
1911
- fileId: remote.id,
1912
- bytes: remote.bytes,
1913
- createdAt: remote.createdAt * 1e3,
1914
- expiresAt: remote.expiresAt * 1e3
1915
- };
1132
+ /**
1133
+ * Build the request-image pricing for one DeepSeek route from a validated
1134
+ * connection snapshot. Uncatalogued and text-only models price every
1135
+ * occurrence as its deterministic text substitution; image-capable models
1136
+ * price an offloaded occurrence as its placeholder text and a retained one by
1137
+ * its projected request dimensions, with each occurrence's handle or
1138
+ * placeholder text built through the same access resolution the serializer
1139
+ * uses. Access paths resolve at pricing time, so a path that changes before
1140
+ * the request only shifts the text price by its own length.
1141
+ * @param connection - validated connection facts of the pricing resolution.
1142
+ * @param model - exact model id named by the request header.
1143
+ * @param resolveAccess - current execution-world access resolution shared with request serialization.
1144
+ * @returns synchronous per-occurrence pricing for the route.
1145
+ */
1146
+ function deepSeekImageRequestPricing(connection, model, resolveAccess) {
1147
+ const catalogModel = connection.models.find((entry) => entry.id === model);
1148
+ if (catalogModel?.inputModalities?.includes("image") !== true) return { priceImages: (images) => images.map(textOnlyPrice) };
1149
+ return { priceImages: (images) => images.map(({ attachment: ref, offloaded }) => {
1150
+ if (offloaded === true) return {
1151
+ visualTokens: 0,
1152
+ text: offloadedImageText(ref, resolveAccess?.(ref))
1916
1153
  };
1917
- let candidate;
1918
- try {
1919
- candidate = await upload();
1920
- } catch (error) {
1921
- if (!isFilesQuotaError(error)) throw error;
1922
- if (await this.reclaimOldestOwned(connection, policy.quotaCleanupBatch, signal) === 0) throw error;
1923
- candidate = await upload();
1924
- }
1925
- const committed = await this.index.commit(candidate, this.now(), marginMs);
1926
- if (!committed.accepted) try {
1927
- await client.delete(candidate.fileId, signal);
1928
- } catch {}
1154
+ const target = resolveRequestImageTarget(catalogModel, ref);
1929
1155
  return {
1930
- record: committed.record,
1931
- uploaded: committed.accepted
1156
+ visualTokens: deepSeekImageTokens(target.width, target.height),
1157
+ text: requestImageHandleText(ref, target, resolveAccess?.(ref))
1932
1158
  };
1933
- }
1934
- /**
1935
- * Invalidate one exact local mapping after a model request rejects its remote id.
1936
- * @param version - request-image version whose remote generation failed.
1937
- * @param fileId - exact rejected file id.
1938
- * @param connection - endpoint and API-key snapshot.
1939
- */
1940
- async invalidate(version, fileId, connection) {
1941
- await this.index.remove(fileScope(connection), version.variantId, fileId);
1942
- }
1943
- /**
1944
- * Delete the indexed remote file for one attachment and remove its local mapping.
1945
- * @param version - exact request-image version to release.
1946
- * @param connection - endpoint and API-key snapshot.
1947
- * @param policy - expiry policy used to locate a reusable mapping.
1948
- * @param signal - request cancellation.
1949
- * @returns whether an indexed file existed and was deleted.
1950
- */
1951
- async release(version, connection, policy, signal) {
1952
- const scope = fileScope(connection);
1953
- const record = await this.index.get(scope, version.variantId, this.now(), policy.refreshMarginSeconds * 1e3);
1954
- if (record === void 0) return false;
1955
- await this.client(connection).delete(record.fileId, signal);
1956
- await this.index.remove(scope, version.variantId, record.fileId);
1957
- return true;
1958
- }
1959
- /**
1960
- * Delete the oldest provider files whose names identify harness ownership.
1961
- * @param connection - endpoint and API-key snapshot.
1962
- * @param count - positive maximum number of files to delete.
1963
- * @param signal - request cancellation.
1964
- * @returns number of successfully deleted files.
1965
- */
1966
- async reclaimOldestOwned(connection, count, signal) {
1967
- const client = this.client(connection);
1968
- let after;
1969
- const owned = [];
1970
- while (connection.protocol === "messages" || owned.length < count) {
1971
- const page = await client.list({
1972
- ...after === void 0 ? {} : { after },
1973
- limit: 1e3,
1974
- order: "asc",
1975
- ...signal === void 0 ? {} : { signal }
1976
- });
1977
- for (const file of page.data) {
1978
- if (!file.filename.startsWith(OWNED_FILE_PREFIX)) continue;
1979
- owned.push({
1980
- id: file.id,
1981
- createdAt: file.createdAt
1982
- });
1983
- if (connection.protocol === "chat-completions" && owned.length === count) break;
1984
- }
1985
- if (connection.protocol === "messages") {
1986
- owned.sort((left, right) => left.createdAt - right.createdAt);
1987
- owned.splice(count);
1988
- }
1989
- if (!page.hasMore || page.lastId === void 0 || page.lastId === after) break;
1990
- after = page.lastId;
1991
- }
1992
- for (const file of owned) await client.delete(file.id, signal);
1993
- return owned.length;
1994
- }
1995
- /**
1996
- * Delete every remote harness-owned file in the active API-key namespace and clear its index.
1997
- * @param connection - endpoint and API-key snapshot.
1998
- * @param signal - request cancellation.
1999
- * @returns number of deleted files.
2000
- */
2001
- async releaseAll(connection, signal) {
2002
- let total = 0;
2003
- for (;;) {
2004
- const deleted = await this.reclaimOldestOwned(connection, 1e3, signal);
2005
- total += deleted;
2006
- if (deleted < 1e3) break;
2007
- }
2008
- await this.index.clear(fileScope(connection));
2009
- return total;
2010
- }
2011
- };
1159
+ }) };
1160
+ }
2012
1161
  //#endregion
2013
- //#region lib/types/protocols/messages/images.js
1162
+ //#region lib/types/images.js
2014
1163
  /** Deterministic Messages image preparation for Files references and bounded inline fallback. */
2015
1164
  function bounds(connection, representation) {
2016
1165
  return {
@@ -2023,7 +1172,6 @@ function bounds(connection, representation) {
2023
1172
  }
2024
1173
  function* imageRefs(blocks) {
2025
1174
  for (const block of blocks) if (block.type === "image") yield block.attachment;
2026
- else if (block.type === "tool-result") yield* imageRefs(block.content);
2027
1175
  }
2028
1176
  /** Normalize retained image references before converting Messages content.
2029
1177
  * @param history - durable history; never mutated.
@@ -2043,7 +1191,7 @@ async function prepareImages(history, connection, modelId, attachments, access,
2043
1191
  };
2044
1192
  const model = connection.models.find((entry) => entry.id === modelId);
2045
1193
  if (model?.inputModalities?.includes("image") !== true || attachments === void 0) throw new LlmError("DeepSeek Messages image input requires a vision model and attachment service", "UNSUPPORTED_CONTENT");
2046
- if (messages.some((message) => message.role !== "user" && contentHasImage(message.content))) throw new LlmError("DeepSeek Messages supports images only in user messages and tool results", "UNSUPPORTED_CONTENT");
1194
+ if (messages.some((message) => message.role !== "user" && message.role !== "tool" && contentHasImage(message.content))) throw new LlmError("DeepSeek Messages supports images only in user messages and tool results", "UNSUPPORTED_CONTENT");
2047
1195
  for (const message of messages) for (const ref of imageRefs(message.content)) if (!versions.has(ref.attachmentId)) versions.set(ref.attachmentId, await attachments.readImageRequest(ref, resolveRequestImageTarget(model, ref), signal));
2048
1196
  assertImagesFit(messages, versions, connection, "raw");
2049
1197
  return {
@@ -2087,7 +1235,7 @@ async function prepareFileIds(messages, versions, files) {
2087
1235
  return ids;
2088
1236
  }
2089
1237
  //#endregion
2090
- //#region lib/types/protocols/messages/replay.js
1238
+ //#region lib/types/replay.js
2091
1239
  /** Minimal native thinking metadata; durable Harness blocks own all response text. */
2092
1240
  /** Reject malformed JSON objects at provider and durable-data reads.
2093
1241
  * @param value - untrusted decoded JSON.
@@ -2141,18 +1289,17 @@ function validateReplay(message, model) {
2141
1289
  if (!Array.isArray(envelope.blocks) || envelope.blocks.length !== message.content.length) return fail("block count mismatch");
2142
1290
  const blocks = envelope.blocks.map((value, index) => {
2143
1291
  const block = object(value, "INVALID_REPLAY_STATE");
2144
- if (block.type !== message.content[index]?.type || ![
2145
- "text",
2146
- "reasoning",
2147
- "tool-call"
2148
- ].includes(String(block.type))) return fail("block type mismatch");
1292
+ if (block.type !== message.content[index]?.type || block.type !== "text" && block.type !== "reasoning" && block.type !== "tool-call") return fail("block type mismatch");
2149
1293
  if (block.signature !== void 0 && (block.type !== "reasoning" || typeof block.signature !== "string")) return fail("invalid signature");
2150
- return block;
1294
+ return {
1295
+ type: block.type,
1296
+ ...typeof block.signature === "string" ? { signature: block.signature } : {}
1297
+ };
2151
1298
  });
2152
1299
  return response.model === model ? blocks : void 0;
2153
1300
  }
2154
1301
  //#endregion
2155
- //#region lib/types/protocols/messages/serialize.js
1302
+ //#region lib/types/serialize.js
2156
1303
  /** Map system snapshots and conversation turns to Messages using the configured route capability. */
2157
1304
  function unsupported(type) {
2158
1305
  throw new LlmError(`DeepSeek Messages cannot represent ${type}`, "UNSUPPORTED_CONTENT");
@@ -2191,6 +1338,8 @@ function assistant(message, model, onReplayDegrade) {
2191
1338
  });
2192
1339
  }
2193
1340
  /** Serialize one complete request using already prepared image bytes.
1341
+ * User and tool-result content omits reasoning and tool-call blocks.
1342
+ * Empty user messages are skipped; empty tool results retain their call ids.
2194
1343
  * @param options - provider-neutral request.
2195
1344
  * @param connection - validated defaults and thinking policy.
2196
1345
  * @param history - image-projected history with complete system snapshots; durable messages remain unchanged.
@@ -2208,6 +1357,7 @@ function serialize(options, connection, history, images, access, onReplayDegrade
2208
1357
  type: "text",
2209
1358
  text: block.text
2210
1359
  }] : [];
1360
+ if (block.type === "reasoning" || block.type === "tool-call") return [];
2211
1361
  if (block.type !== "image") return unsupported(`user/tool-result content ${block.type}`);
2212
1362
  const version = images.get(block.attachment.attachmentId);
2213
1363
  if (version === void 0) throw new LlmError("DeepSeek Messages request image is missing", "INVALID_REQUEST");
@@ -2239,7 +1389,10 @@ function serialize(options, connection, history, images, access, onReplayDegrade
2239
1389
  if (messages.at(-1)?.role !== "user") return unsupported("system update without a preceding user or tool-result turn");
2240
1390
  messages.push(...systemUpdates.splice(0));
2241
1391
  };
1392
+ if (options.tools?.some((tool) => tool.deferLoading === true)) return unsupported("deferred tool loading");
2242
1393
  for (const message of history) {
1394
+ if (message.role === "developer") return unsupported("developer message");
1395
+ if (message.content.some((block) => block.type === "tool-addition" || block.type === "tool-removal")) return unsupported("tool-change blocks outside developer messages");
2243
1396
  if (message.role === "system") {
2244
1397
  const texts = message.content.filter((block) => block.type === "text");
2245
1398
  if (texts.length !== message.content.length) return unsupported("non-text system message");
@@ -2257,19 +1410,18 @@ function serialize(options, connection, history, images, access, onReplayDegrade
2257
1410
  continue;
2258
1411
  }
2259
1412
  if (message.role === "assistant") flushSystemUpdates();
2260
- const content = message.role === "assistant" ? assistant(message, options.model, onReplayDegrade) : message.content.flatMap((block) => {
2261
- if (block.type !== "tool-result") return input([block]);
2262
- return [{
2263
- type: "tool_result",
2264
- tool_use_id: block.toolCallId,
2265
- content: input(block.content),
2266
- ...block.isError === void 0 ? {} : { is_error: block.isError }
2267
- }];
2268
- });
1413
+ const content = message.role === "assistant" ? assistant(message, options.model, onReplayDegrade) : message.role === "tool" ? [{
1414
+ type: "tool_result",
1415
+ tool_use_id: message.toolCallId,
1416
+ content: input(message.content),
1417
+ ...message.isError === void 0 ? {} : { is_error: message.isError }
1418
+ }] : message.content.flatMap((block) => input([block]));
1419
+ if (message.role === "user" && content.length === 0) continue;
1420
+ const wireRole = message.role === "tool" ? "user" : message.role;
2269
1421
  const previous = messages.at(-1);
2270
- if (previous?.role === message.role) previous.content.push(...content);
1422
+ if (previous?.role === wireRole) previous.content.push(...content);
2271
1423
  else messages.push({
2272
- role: message.role,
1424
+ role: wireRole,
2273
1425
  content
2274
1426
  });
2275
1427
  }
@@ -2312,7 +1464,7 @@ function serialize(options, connection, history, images, access, onReplayDegrade
2312
1464
  };
2313
1465
  }
2314
1466
  //#endregion
2315
- //#region lib/types/protocols/messages/transport.js
1467
+ //#region lib/types/transport.js
2316
1468
  /** Normalize HTTP and in-band Messages errors into provider-neutral failures. */
2317
1469
  /** Read only provider error fields used by bounded Files recovery.
2318
1470
  * @param raw - decoded HTTP error response.
@@ -2358,7 +1510,7 @@ function providerError(raw, status, headers) {
2358
1510
  });
2359
1511
  }
2360
1512
  //#endregion
2361
- //#region lib/types/protocols/messages/sse.js
1513
+ //#region lib/types/sse.js
2362
1514
  /** SSE framing delegated to eventsource-parser; JSON errors remain provider failures. */
2363
1515
  /** Decode complete SSE frames without treating an unterminated tail as an event.
2364
1516
  * @param body - provider response bytes.
@@ -2382,7 +1534,7 @@ async function* parseSse(body, activity) {
2382
1534
  }
2383
1535
  }
2384
1536
  //#endregion
2385
- //#region lib/types/protocols/messages/translate.js
1537
+ //#region lib/types/translate.js
2386
1538
  /** Translate Messages events while preserving block order and cumulative usage. */
2387
1539
  /** Decode a required string from provider JSON.
2388
1540
  * @param value - provider field.
@@ -2600,7 +1752,7 @@ async function* translate(events, model) {
2600
1752
  throw new LlmError("DeepSeek Messages stream ended before message_stop", "STREAM_CLOSED");
2601
1753
  }
2602
1754
  //#endregion
2603
- //#region lib/types/protocols/messages/adapter.js
1755
+ //#region lib/types/adapter.js
2604
1756
  /** Direct Messages transport with one cancellable lifecycle per model request. */
2605
1757
  var __addDisposableResource = function(env, value, async) {
2606
1758
  if (value !== null && value !== void 0) {
@@ -2661,11 +1813,17 @@ var __disposeResources = (function(SuppressedError) {
2661
1813
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2662
1814
  });
2663
1815
  /** DeepSeek provider using Messages content and native thinking replay. */
2664
- var DeepSeekMessagesAdapter = class extends LlmAdapter {
1816
+ var DeepSeekAdapter = class extends LlmAdapter {
2665
1817
  dependencies;
1818
+ files;
1819
+ imageAccess = (ref) => {
1820
+ const attachments = this.dependencies.resolveAttachments?.();
1821
+ return attachments === void 0 ? void 0 : this.dependencies.resolveImageAccess?.(attachments, ref);
1822
+ };
2666
1823
  constructor(dependencies) {
2667
1824
  super();
2668
1825
  this.dependencies = dependencies;
1826
+ this.files = dependencies.resolveFiles?.() ?? new DeepSeekFileStore();
2669
1827
  }
2670
1828
  providerInfo(provider) {
2671
1829
  return {
@@ -2674,27 +1832,27 @@ var DeepSeekMessagesAdapter = class extends LlmAdapter {
2674
1832
  };
2675
1833
  }
2676
1834
  providerRetryPolicy(_provider) {
2677
- return this.dependencies.connection().retryPolicy;
1835
+ return this.dependencies.options().retryPolicy;
2678
1836
  }
2679
1837
  listModels(provider) {
2680
- const connection = this.dependencies.connection();
1838
+ const connection = this.dependencies.options();
2681
1839
  return Promise.resolve(connection.models.map((model) => catalogModelInfo(provider, model)));
2682
1840
  }
2683
- resolveModel(provider, model) {
2684
- return Promise.resolve(modelInfo(this.dependencies.connection(), provider, model));
1841
+ resolveModel(provider, model, _signal) {
1842
+ return Promise.resolve(modelInfo(this.dependencies.options(), provider, model));
2685
1843
  }
2686
1844
  imageRequestPricing(_provider, model) {
2687
- return deepSeekImageRequestPricing(this.dependencies.connection(), model, this.dependencies.imageAccess);
1845
+ return deepSeekImageRequestPricing(this.dependencies.options(), model, this.imageAccess);
2688
1846
  }
2689
- prepareCall(provider, model) {
2690
- const connection = this.dependencies.connection();
1847
+ prepareCall(provider, model, _signal) {
1848
+ const connection = this.dependencies.options();
2691
1849
  return Promise.resolve({
2692
1850
  model: modelInfo(connection, provider, model),
2693
1851
  stream: (options) => this.generate(options, connection)
2694
1852
  });
2695
1853
  }
2696
1854
  stream(options) {
2697
- return this.generate(options, this.dependencies.connection());
1855
+ return this.generate(options, this.dependencies.options());
2698
1856
  }
2699
1857
  async *generate(options, connection) {
2700
1858
  const env_1 = {
@@ -2734,12 +1892,13 @@ var DeepSeekMessagesAdapter = class extends LlmAdapter {
2734
1892
  }
2735
1893
  async *request(options, connection, signal, activity) {
2736
1894
  signal.throwIfAborted();
2737
- const { messages, versions } = await prepareImages(options.messages, connection, options.model, this.dependencies.attachments(), this.dependencies.imageAccess, signal);
2738
- const key = await this.dependencies.apiKey(connection);
2739
- const files = new RequestFiles(this.dependencies.files(), {
1895
+ const { messages, versions } = await prepareImages(options.messages, connection, options.model, this.dependencies.resolveAttachments?.(), this.imageAccess, signal);
1896
+ const accountToken = await this.dependencies.resolveAccountToken?.(connection);
1897
+ const key = accountToken ?? await this.dependencies.resolveApiKey(connection);
1898
+ const files = new RequestFiles(this.files, {
2740
1899
  baseURL: connection.baseURL,
2741
1900
  apiKey: key,
2742
- protocol: "messages"
1901
+ accountCredential: accountToken !== void 0
2743
1902
  }, connection.filePolicy, connection.filesApiTimeoutMs, signal, activity);
2744
1903
  let inline = false;
2745
1904
  while (true) {
@@ -2753,7 +1912,7 @@ var DeepSeekMessagesAdapter = class extends LlmAdapter {
2753
1912
  inline = true;
2754
1913
  continue;
2755
1914
  }
2756
- const extensions = await prepareRequestExtensions(serialize(options, connection, inline ? inlineImages(messages, versions, connection) : messages, versions, this.dependencies.imageAccess, (reason) => {
1915
+ const extensions = await prepareRequestExtensions(serialize(options, connection, inline ? inlineImages(messages, versions, connection) : messages, versions, this.imageAccess, (reason) => {
2757
1916
  this.dependencies.onReplayDegrade?.({
2758
1917
  provider: options.provider,
2759
1918
  model: options.model,
@@ -2774,10 +1933,10 @@ var DeepSeekMessagesAdapter = class extends LlmAdapter {
2774
1933
  ...attributionHeaders(),
2775
1934
  "content-type": "application/json",
2776
1935
  "accept": "text/event-stream",
2777
- "x-api-key": key,
1936
+ ...accountToken === void 0 ? { "x-api-key": key } : { "x-dsh-auth-token": accountToken },
2778
1937
  "anthropic-version": "2023-06-01",
2779
1938
  ...fileIds === void 0 || fileIds.size === 0 ? {} : { "anthropic-beta": MESSAGES_FILES_BETA },
2780
- "x-deepseek-harness-user-id": this.dependencies.userId(),
1939
+ "x-deepseek-harness-user-id": this.dependencies.resolveUserId(),
2781
1940
  ...options.sessionId === void 0 ? {} : { "x-deepseek-harness-session-id": String(options.sessionId) },
2782
1941
  ...options.purpose === "compaction" ? { "x-deepseek-harness-compact": "1" } : {}
2783
1942
  }
@@ -2804,66 +1963,7 @@ var DeepSeekMessagesAdapter = class extends LlmAdapter {
2804
1963
  }
2805
1964
  };
2806
1965
  //#endregion
2807
- //#region lib/types/adapter.js
2808
- /** Select a DeepSeek wire implementation from one validated configuration generation. */
2809
- /** One provider route with protocol-local transport and shared credentials and model configuration. */
2810
- var DeepSeekAdapter = class extends LlmAdapter {
2811
- dependencies;
2812
- files;
2813
- constructor(dependencies) {
2814
- super();
2815
- this.dependencies = dependencies;
2816
- this.files = dependencies.resolveFiles?.() ?? new DeepSeekFileStore();
2817
- }
2818
- implementation() {
2819
- const connection = this.dependencies.options();
2820
- switch (connection.protocol) {
2821
- case "messages": return new DeepSeekMessagesAdapter({
2822
- connection: () => connection,
2823
- apiKey: this.dependencies.resolveApiKey,
2824
- userId: this.dependencies.resolveUserId,
2825
- attachments: () => this.dependencies.resolveAttachments?.(),
2826
- imageAccess: (ref) => {
2827
- const attachments = this.dependencies.resolveAttachments?.();
2828
- return attachments === void 0 ? void 0 : this.dependencies.resolveImageAccess?.(attachments, ref);
2829
- },
2830
- files: () => this.files,
2831
- prepareExtensions: this.dependencies.prepareExtensions,
2832
- ...this.dependencies.onReplayDegrade === void 0 ? {} : { onReplayDegrade: this.dependencies.onReplayDegrade }
2833
- });
2834
- case "chat-completions": return new ChatCompletionsAdapter({
2835
- ...this.dependencies,
2836
- options: () => connection,
2837
- resolveFiles: () => this.files
2838
- });
2839
- /* v8 ignore next -- protocol is validated at configuration resolution. */
2840
- default: return assertNever(connection.protocol, "DeepSeek protocol");
2841
- }
2842
- }
2843
- providerInfo(provider) {
2844
- return this.implementation().providerInfo(provider);
2845
- }
2846
- providerRetryPolicy(provider) {
2847
- return this.implementation().providerRetryPolicy(provider);
2848
- }
2849
- listModels(provider) {
2850
- return this.implementation().listModels(provider);
2851
- }
2852
- resolveModel(provider, model, signal) {
2853
- return this.implementation().resolveModel(provider, model, signal);
2854
- }
2855
- imageRequestPricing(provider, model) {
2856
- return this.implementation().imageRequestPricing(provider, model);
2857
- }
2858
- prepareCall(provider, model, signal) {
2859
- return this.implementation().prepareCall(provider, model, signal);
2860
- }
2861
- stream(options) {
2862
- return this.implementation().stream(options);
2863
- }
2864
- };
2865
- //#endregion
2866
- //#region lib/types/common/defaults.js
1966
+ //#region lib/types/defaults.js
2867
1967
  /** Shared provider limits and Chat Files API defaults. */
2868
1968
  /** Default maximum idle interval while an adapter stream read is outstanding. */
2869
1969
  const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 3e5;
@@ -2888,8 +1988,8 @@ const DEFAULT_FILE_QUOTA_CLEANUP_BATCH = 100;
2888
1988
  /** Default deadline for resolving one request image through the Files API. */
2889
1989
  const DEFAULT_FILES_API_TIMEOUT_MS = 6e4;
2890
1990
  //#endregion
2891
- //#region lib/types/common/models.js
2892
- /** Default catalog shared by every DeepSeek protocol. */
1991
+ //#region lib/types/models.js
1992
+ /** Default DeepSeek model catalog. */
2893
1993
  /** Advisory official model entries; deployments may replace the catalog. */
2894
1994
  const DEFAULT_MODELS = [{
2895
1995
  id: "deepseek-flash",
@@ -2905,9 +2005,15 @@ const DEFAULT_MODELS = [{
2905
2005
  }];
2906
2006
  //#endregion
2907
2007
  //#region lib/types/config.js
2908
- /** Plugin configuration and complete request-local resolution for DeepSeek. */
2909
2008
  const DEFAULT_API_KEY_ENV = "DEEPSEEK_API_KEY";
2910
2009
  const MODEL_MODALITIES = ["text", "image"];
2010
+ /** Read the current value behind every reference of a validated Config.
2011
+ * @param config Parsed plugin Config.
2012
+ * @returns Plain options for the resolver.
2013
+ */
2014
+ function plainOptions(config) {
2015
+ return Object.fromEntries(Object.entries(config).map(([key, value]) => [key, isVolatile(value) ? value.get() : value]));
2016
+ }
2911
2017
  const catalogModel = z.object({
2912
2018
  id: z.string().required(),
2913
2019
  name: z.string(),
@@ -2920,36 +2026,33 @@ const catalogModel = z.object({
2920
2026
  systemPromptUpdate: z.const("in-history")
2921
2027
  });
2922
2028
  const Config = z.object({
2923
- protocol: z.union(["chat-completions", "messages"]).default("messages"),
2924
- apiKeyEnv: z.string().role("credential-ref").default(DEFAULT_API_KEY_ENV),
2925
- baseURL: z.string(),
2926
- thinking: z.union(["enabled", "disabled"]),
2029
+ apiKeyEnv: z.string().role("credential-ref").default(DEFAULT_API_KEY_ENV).volatile(),
2030
+ baseURL: z.string().volatile(),
2031
+ thinking: z.union(["enabled", "disabled"]).volatile(),
2927
2032
  reasoningEffort: z.union([
2928
2033
  "off",
2929
2034
  "low",
2930
2035
  "high",
2931
2036
  "max"
2932
- ]),
2933
- maxTokens: z.number().step(1).min(1).max(Number.MAX_SAFE_INTEGER).default(DEFAULT_MAX_TOKENS),
2934
- defaultContextWindow: z.number().step(1).min(1).default(DEFAULT_CONTEXT_WINDOW),
2935
- models: z.array(catalogModel).default(DEFAULT_MODELS),
2936
- streamIdleTimeoutMs: z.number().min(Number.MIN_VALUE).max(MAX_TIMER_DELAY_MS).default(DEFAULT_STREAM_IDLE_TIMEOUT_MS),
2937
- maxRequestFilesBytes: z.number().step(1).min(1).default(DEFAULT_MAX_REQUEST_FILES_BYTES),
2938
- maxInlineRequestImageBytes: z.number().step(1).min(1).default(DEFAULT_MAX_INLINE_REQUEST_IMAGE_BYTES),
2939
- maxImagesPerRequest: z.number().step(1).min(1).default(600),
2940
- imageOffloadByteQuantum: z.number().step(1).min(1).default(DEFAULT_IMAGE_OFFLOAD_BYTE_QUANTUM),
2941
- inlineImageOffloadByteQuantum: z.number().step(1).min(1).default(DEFAULT_INLINE_IMAGE_OFFLOAD_BYTE_QUANTUM),
2942
- imageOffloadCountQuantum: z.number().step(1).min(1).default(20),
2943
- filesApiTimeoutMs: z.number().min(Number.MIN_VALUE).max(MAX_TIMER_DELAY_MS).default(DEFAULT_FILES_API_TIMEOUT_MS),
2944
- fileExpiresAfterSeconds: z.number().step(1).min(3600).max(2592e3).default(DEFAULT_FILE_EXPIRY_SECONDS),
2945
- fileRefreshMarginSeconds: z.number().step(1).min(0).default(DEFAULT_FILE_REFRESH_MARGIN_SECONDS),
2946
- fileQuotaCleanupBatch: z.number().step(1).min(1).max(1e3).default(100),
2947
- retryPolicy: RetryPolicySchema
2037
+ ]).volatile(),
2038
+ maxTokens: z.number().step(1).min(1).max(Number.MAX_SAFE_INTEGER).default(DEFAULT_MAX_TOKENS).volatile(),
2039
+ defaultContextWindow: z.number().step(1).min(1).default(DEFAULT_CONTEXT_WINDOW).volatile(),
2040
+ models: z.array(catalogModel).default(DEFAULT_MODELS).volatile(),
2041
+ streamIdleTimeoutMs: z.number().min(Number.MIN_VALUE).max(MAX_TIMER_DELAY_MS).default(DEFAULT_STREAM_IDLE_TIMEOUT_MS).volatile(),
2042
+ maxRequestFilesBytes: z.number().step(1).min(1).default(DEFAULT_MAX_REQUEST_FILES_BYTES).volatile(),
2043
+ maxInlineRequestImageBytes: z.number().step(1).min(1).default(DEFAULT_MAX_INLINE_REQUEST_IMAGE_BYTES).volatile(),
2044
+ maxImagesPerRequest: z.number().step(1).min(1).default(600).volatile(),
2045
+ imageOffloadByteQuantum: z.number().step(1).min(1).default(DEFAULT_IMAGE_OFFLOAD_BYTE_QUANTUM).volatile(),
2046
+ inlineImageOffloadByteQuantum: z.number().step(1).min(1).default(DEFAULT_INLINE_IMAGE_OFFLOAD_BYTE_QUANTUM).volatile(),
2047
+ imageOffloadCountQuantum: z.number().step(1).min(1).default(20).volatile(),
2048
+ filesApiTimeoutMs: z.number().min(Number.MIN_VALUE).max(MAX_TIMER_DELAY_MS).default(DEFAULT_FILES_API_TIMEOUT_MS).volatile(),
2049
+ fileExpiresAfterSeconds: z.number().step(1).min(3600).max(2592e3).default(DEFAULT_FILE_EXPIRY_SECONDS).volatile(),
2050
+ fileRefreshMarginSeconds: z.number().step(1).min(0).default(DEFAULT_FILE_REFRESH_MARGIN_SECONDS).volatile(),
2051
+ fileQuotaCleanupBatch: z.number().step(1).min(1).max(1e3).default(100).volatile(),
2052
+ retryPolicy: RetryPolicySchema.volatile()
2948
2053
  });
2949
2054
  /** Public API default; the internal endpoint comes from $DEEPSEEK_BASE_URL. */
2950
- const PUBLIC_BASE_URL = "https://api.deepseek.com";
2951
- /** Official Messages protocol root. */
2952
- const MESSAGES_BASE_URL = "https://api.deepseek.com/anthropic";
2055
+ const PUBLIC_BASE_URL = "https://api.deepseek.com/anthropic";
2953
2056
  /** Environment variable naming this provider's endpoint, honored only from trusted layers. */
2954
2057
  const BASE_URL_ENV = "DEEPSEEK_BASE_URL";
2955
2058
  /** Resolve, validate, and detach the advisory model catalog. */
@@ -3001,8 +2104,7 @@ function resolveModels(models) {
3001
2104
  * @returns validated connection facts plus the credential reference.
3002
2105
  */
3003
2106
  function resolveAdapterOptions(config, environment) {
3004
- const protocol = config.protocol ?? "messages";
3005
- if (protocol !== "chat-completions" && protocol !== "messages") throw new Error("llm-deepseek: protocol must be chat-completions or messages");
2107
+ if (Object.hasOwn(config, "protocol")) throw new Error("llm-deepseek: protocol is not configurable; remove it and use a Messages-compatible baseURL");
3006
2108
  if (config.thinking === "disabled" && config.reasoningEffort !== void 0 && config.reasoningEffort !== "off") throw new Error("llm-deepseek: only reasoningEffort \"off\" can be configured when thinking is disabled");
3007
2109
  if (config.defaultContextWindow !== void 0 && (!Number.isInteger(config.defaultContextWindow) || config.defaultContextWindow <= 0)) throw new Error("llm-deepseek: defaultContextWindow must be a positive integer");
3008
2110
  if (config.maxTokens !== void 0 && (!Number.isSafeInteger(config.maxTokens) || config.maxTokens <= 0)) throw new Error("llm-deepseek: maxTokens must be a positive safe integer");
@@ -3031,13 +2133,10 @@ function resolveAdapterOptions(config, environment) {
3031
2133
  if (!Number.isSafeInteger(fileRefreshMarginSeconds) || fileRefreshMarginSeconds < 0 || fileRefreshMarginSeconds >= fileExpiresAfterSeconds) throw new Error("llm-deepseek: fileRefreshMarginSeconds must be a non-negative integer below fileExpiresAfterSeconds");
3032
2134
  const fileQuotaCleanupBatch = config.fileQuotaCleanupBatch ?? 100;
3033
2135
  if (!Number.isSafeInteger(fileQuotaCleanupBatch) || fileQuotaCleanupBatch < 1 || fileQuotaCleanupBatch > 1e3) throw new Error("llm-deepseek: fileQuotaCleanupBatch must be an integer from 1 through 1000");
3034
- const baseURL = config.baseURL ?? environment?.get(BASE_URL_ENV)?.value ?? (protocol === "messages" ? "https://api.deepseek.com/anthropic" : "https://api.deepseek.com");
3035
- if (protocol === "messages") {
3036
- const parsed = new URL(baseURL);
3037
- if (!["http:", "https:"].includes(parsed.protocol) || parsed.username || parsed.password || parsed.search || parsed.hash) throw new Error("llm-deepseek: Messages baseURL must be an HTTP(S) root without credentials, query, or fragment");
3038
- }
2136
+ const baseURL = config.baseURL ?? environment?.get(BASE_URL_ENV)?.value ?? "https://api.deepseek.com/anthropic";
2137
+ const parsed = new URL(baseURL);
2138
+ if (!["http:", "https:"].includes(parsed.protocol) || parsed.username || parsed.password || parsed.search || parsed.hash) throw new Error("llm-deepseek: Messages baseURL must be an HTTP(S) root without credentials, query, or fragment");
3039
2139
  return {
3040
- protocol,
3041
2140
  apiKeyEnv: credentialRef(config.apiKeyEnv ?? DEFAULT_API_KEY_ENV),
3042
2141
  baseURL,
3043
2142
  defaults: {
@@ -3070,25 +2169,10 @@ const inject = ["llm"];
3070
2169
  const NS = "llm-deepseek";
3071
2170
  const PROVIDER = "deepseek-official";
3072
2171
  function apply(ctx, config) {
3073
- let current = () => config;
3074
- let lastRaw;
3075
- let lastGood;
3076
- const options = () => {
3077
- const raw = current();
3078
- if (raw === lastRaw && lastGood !== void 0) return lastGood;
3079
- try {
3080
- const next = resolveAdapterOptions(raw, launchEnvironmentOf(ctx));
3081
- lastRaw = raw;
3082
- lastGood = next;
3083
- return next;
3084
- } catch (error) {
3085
- if (lastGood === void 0) throw error;
3086
- lastRaw = raw;
3087
- ctx.logger.error("llm-deepseek: keeping the last good configuration after an invalid settings section");
3088
- ctx.logger.error(error);
3089
- return lastGood;
3090
- }
3091
- };
2172
+ ctx.inject(["settings"], (child) => {
2173
+ child.effect(() => child.settings.configure({ auto: false }, ctx.fiber));
2174
+ });
2175
+ const options = () => resolveAdapterOptions(plainOptions(config), launchEnvironmentOf(ctx));
3092
2176
  options();
3093
2177
  const resolveApiKey = async (connection) => {
3094
2178
  const ref = connection.apiKeyEnv;
@@ -3110,6 +2194,7 @@ function apply(ctx, config) {
3110
2194
  ctx.logger.warn(`llm-deepseek: unusable Messages replay state on assistant history for route "${provider}/${model}"; sending provider-neutral content (${reason})`);
3111
2195
  },
3112
2196
  resolveApiKey,
2197
+ resolveAccountToken: (connection) => ctx.get("deepseekAccount")?.resolveToken(connection.baseURL) ?? Promise.resolve(void 0),
3113
2198
  resolveUserId,
3114
2199
  resolveAttachments: () => ctx.get("attachments"),
3115
2200
  resolveImageAccess: (attachments, ref) => resolveImageAttachmentAccess(attachments, (hostPath) => ctx.get("fs")?.processPathFromHostPath(hostPath), ref),
@@ -3123,25 +2208,24 @@ function apply(ctx, config) {
3123
2208
  ctx.llm.registerConfigurableProviders([{
3124
2209
  provider: PROVIDER,
3125
2210
  displayName: "DeepSeek",
3126
- settingsNs: NS,
2211
+ settingsNs: ctx.fiber.entry?.options.id ?? NS,
3127
2212
  settingsPath: []
3128
2213
  }]);
3129
2214
  const registration = ctx.llm.registerAdapter([PROVIDER], adapter);
3130
2215
  let registeredPolicy = options().retryPolicy;
3131
2216
  const ensureRegistrationFacts = () => {
3132
- const policy = options().retryPolicy;
2217
+ let policy;
2218
+ try {
2219
+ policy = options().retryPolicy;
2220
+ } catch (error) {
2221
+ ctx.logger.warn(error);
2222
+ return;
2223
+ }
3133
2224
  if (deepEqualJson(policy, registeredPolicy)) return;
3134
2225
  registration.replace([PROVIDER]);
3135
2226
  registeredPolicy = policy;
3136
2227
  };
3137
- ctx.inject(["settings"], (settingsCtx) => {
3138
- settingsCtx.settings.installSection(ctx, NS, Config, config, {
3139
- setSource: (source) => {
3140
- current = source;
3141
- },
3142
- onChange: ensureRegistrationFacts
3143
- });
3144
- });
2228
+ ctx.on("loader/volatile-update", ensureRegistrationFacts);
3145
2229
  }
3146
2230
  //#endregion
3147
- export { Config, DEFAULT_CONTEXT_WINDOW, DEFAULT_FILES_API_TIMEOUT_MS, DEFAULT_FILE_EXPIRY_SECONDS, DEFAULT_FILE_QUOTA_CLEANUP_BATCH, DEFAULT_FILE_REFRESH_MARGIN_SECONDS, DEFAULT_IMAGE_OFFLOAD_BYTE_QUANTUM, DEFAULT_IMAGE_OFFLOAD_COUNT_QUANTUM, DEFAULT_INLINE_IMAGE_OFFLOAD_BYTE_QUANTUM, DEFAULT_LOW_DETAIL_IMAGE_PIXEL_BUDGET, DEFAULT_MAX_IMAGES_PER_REQUEST, DEFAULT_MAX_INLINE_REQUEST_IMAGE_BYTES, DEFAULT_MAX_REQUEST_FILES_BYTES, DEFAULT_MAX_TOKENS, DEFAULT_REQUEST_IMAGE_MAX_BYTES, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DeepSeekAdapter, DeepSeekFileId, DeepSeekFileStore, DeepSeekFilesClient, DeepSeekUploadIndex, MAX_FILE_EXPIRY_SECONDS, MAX_FILE_UPLOAD_BYTES, MAX_IMAGE_BYTES, MAX_STORED_FILE_BYTES, MAX_STORED_FILE_COUNT, MESSAGES_BASE_URL, MIN_FILE_EXPIRY_SECONDS, PUBLIC_BASE_URL, REQUEST_IMAGE_MAX_DIMENSION, apply, deepSeekFileScope, deepSeekImageRequestPricing, deepSeekImageTokens, deepSeekRequestImageDimensions, inject, name, resolveAdapterOptions, resolveRequestImageMaxBytes, resolveRequestImageTarget };
2231
+ export { Config, DEFAULT_CONTEXT_WINDOW, DEFAULT_FILES_API_TIMEOUT_MS, DEFAULT_FILE_EXPIRY_SECONDS, DEFAULT_FILE_QUOTA_CLEANUP_BATCH, DEFAULT_FILE_REFRESH_MARGIN_SECONDS, DEFAULT_IMAGE_OFFLOAD_BYTE_QUANTUM, DEFAULT_IMAGE_OFFLOAD_COUNT_QUANTUM, DEFAULT_INLINE_IMAGE_OFFLOAD_BYTE_QUANTUM, DEFAULT_LOW_DETAIL_IMAGE_PIXEL_BUDGET, DEFAULT_MAX_IMAGES_PER_REQUEST, DEFAULT_MAX_INLINE_REQUEST_IMAGE_BYTES, DEFAULT_MAX_REQUEST_FILES_BYTES, DEFAULT_MAX_TOKENS, DEFAULT_REQUEST_IMAGE_MAX_BYTES, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DeepSeekAdapter, DeepSeekFileId, DeepSeekFileStore, DeepSeekFilesClient, DeepSeekUploadIndex, MAX_FILE_EXPIRY_SECONDS, MAX_FILE_UPLOAD_BYTES, MAX_IMAGE_BYTES, MAX_STORED_FILE_BYTES, MAX_STORED_FILE_COUNT, MIN_FILE_EXPIRY_SECONDS, PUBLIC_BASE_URL, REQUEST_IMAGE_MAX_DIMENSION, apply, deepSeekFileScope, deepSeekImageRequestPricing, deepSeekImageTokens, deepSeekRequestImageDimensions, inject, name, plainOptions, resolveAdapterOptions, resolveRequestImageMaxBytes, resolveRequestImageTarget };