@chatcode/chatcode-cli 3.0.2 → 3.0.4-rc.1

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 (221) hide show
  1. package/README.i18n.yaml +10 -10
  2. package/README.md +26 -1
  3. package/README.zh.md +26 -1
  4. package/lib/bin.js +70 -75
  5. package/lib/{command-errors-CIYn1nnW.js → command-errors-BkCHTQHj.js} +12 -12
  6. package/lib/{command-trees-8o99Bws7.js → command-trees-5HFyC5sI.js} +2 -2
  7. package/lib/{component-identity-CnmIKHEF.js → component-identity-De91VHwW.js} +3 -3
  8. package/lib/{dist-DxjlHHph.js → dist-CsDWUvQ4.js} +238 -232
  9. package/lib/dsh-ecosystem-spec/protocols/profile-definitions.d.ts +13 -0
  10. package/lib/dsh-ecosystem-spec/protocols/profile-definitions.js +59 -0
  11. package/lib/dsh-ecosystem-spec/protocols/tui-channel-http.d.ts +15 -0
  12. package/lib/dsh-ecosystem-spec/protocols/tui-channel-http.js +32 -0
  13. package/lib/dsh-ecosystem-spec/protocols/tui-channel.d.ts +59 -0
  14. package/lib/dsh-ecosystem-spec/protocols/tui-channel.js +166 -0
  15. package/lib/dsh-ecosystem-spec/protocols/tui-contributions.d.ts +42 -0
  16. package/lib/dsh-ecosystem-spec/protocols/tui-contributions.js +143 -0
  17. package/lib/dsh-ecosystem-spec/registry/README.md +14 -0
  18. package/lib/dsh-ecosystem-spec/registry/contracts/decision-events-v1alpha1.json +13 -0
  19. package/lib/dsh-ecosystem-spec/registry/contracts/scene-v1alpha1.json +13 -0
  20. package/lib/dsh-ecosystem-spec/registry/contracts/settings-section-v1alpha1.json +13 -0
  21. package/lib/dsh-ecosystem-spec/registry/contracts/tui-channel-v1alpha1.json +30 -0
  22. package/lib/dsh-ecosystem-spec/registry/contracts/workspace-provider-v1alpha1.json +6 -0
  23. package/lib/dsh-ecosystem-spec/registry/host-descriptor.tui.example.json +56 -0
  24. package/lib/dsh-ecosystem-spec/registry/permissions-0.1.json +13 -0
  25. package/lib/dsh-ecosystem-spec/registry/registry-0.15.json +149 -0
  26. package/lib/dsh-ecosystem-spec/schemas/conformance-claim.schema.json +15 -0
  27. package/lib/dsh-ecosystem-spec/schemas/effect-ledger-record.schema.json +16 -0
  28. package/lib/dsh-ecosystem-spec/schemas/host-descriptor.schema.json +26 -0
  29. package/lib/{dump-config-BSTrhTT_.js → dump-config-BcH-VYuv.js} +5 -5
  30. package/lib/dump-config-CyopmD85.js +2 -0
  31. package/lib/{dump-config-schema-Cz4A13GB.js → dump-config-schema-DM0fb6Ns.js} +2 -2
  32. package/lib/{extension-events-DciGPKJa.js → extension-events-CdYCRP0o.js} +26 -26
  33. package/lib/{frames-7PAg0Q9b.js → frames-DOX-Jgk8.js} +4 -4
  34. package/lib/headless-compat.js +2 -2
  35. package/lib/{home-migration-DLaSvmfn.js → home-migration-BjDmRwBB.js} +23 -4
  36. package/lib/{host-access-CmD27uhQ.js → host-access-Bk4xps5E.js} +1 -1
  37. package/lib/{keymap-CFChEJ2W.js → keymap-CJ1kvLR2.js} +17 -16
  38. package/lib/{plugin-jvd9PCVt.js → plugin-XR7ncbnW.js} +3767 -2331
  39. package/lib/{plugin-DYHtreEd.js → plugin-eJjD6r12.js} +1 -1
  40. package/lib/{profile-boot-Blq7uqhx.js → profile-boot-BNQry1NM.js} +109 -14
  41. package/lib/profile-boot.js +2 -2
  42. package/lib/{scenes-ai_8sHDs.js → scenes-CAmWncZD.js} +3 -3
  43. package/lib/{settings-sections-QQ1-2lhL.js → settings-sections-CakcvBv9.js} +7 -3
  44. package/lib/startup-diagnostics-C_hRCp-q.js +91 -0
  45. package/lib/statusBarSettings-BPPS_Usm.js +382 -0
  46. package/lib/{supports-color-CcW-FGjr.js → supports-color-DyChQwlI.js} +2 -2
  47. package/lib/{themes-DTzG_9I_.js → themes-OjcUpZzw.js} +13 -13
  48. package/lib/tui-compat-command-trees.js +1 -1
  49. package/lib/tui-compat-extensions.js +4 -4
  50. package/lib/tui-compat-plugin-host.js +5 -5
  51. package/lib/tui-compat-scenes.js +1 -1
  52. package/lib/tui-compat-settings-sections.js +1 -1
  53. package/lib/tui-compat-working-activity.js +4 -4
  54. package/lib/tui-compat-workspaces.js +1 -1
  55. package/lib/tui-compat.js +44 -29
  56. package/lib/types/args.d.ts +2 -0
  57. package/lib/types/home-migration.d.ts +8 -0
  58. package/lib/types/permission-bypass.d.ts +16 -0
  59. package/lib/types/profile-boot.d.ts +12 -0
  60. package/lib/types/startup-diagnostics.d.ts +13 -0
  61. package/lib/types/tui-compat.d.ts +6 -0
  62. package/lib/types/web-browser.d.ts +6 -0
  63. package/lib/types/web-instance.d.ts +42 -0
  64. package/lib/web-browser-Vcgfdsv_.js +46 -0
  65. package/lib/web-instance-B0jec7cq.js +2 -0
  66. package/lib/web-instance-DbP7IHPv.js +280 -0
  67. package/lib/{workspaces-CznCgVHv.js → workspaces-XY7UdfXp.js} +2 -2
  68. package/package.json +40 -32
  69. package/runtime/manifest.json +4 -6
  70. package/runtime/node_modules/@deepseek-ai/dsh-agent-default-model/lib/index.js +34 -4
  71. package/runtime/node_modules/@deepseek-ai/dsh-agent-default-model/lib/types/index.d.ts +9 -0
  72. package/runtime/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-composition-reference/references/packages.md +2 -1
  73. package/runtime/node_modules/@deepseek-ai/dsh-api-gateway/lib/client.js +2 -0
  74. package/runtime/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/client/remote-stream.js +4 -0
  75. package/runtime/node_modules/@deepseek-ai/dsh-api-remotes/lib/client.js +39 -0
  76. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/index.js +6 -1
  77. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.host.js +10 -3
  78. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.remote-client.js +7 -0
  79. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/catalog.js +8 -1
  80. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/types.d.ts +10 -0
  81. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/index.js +28 -1
  82. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/typert.host.js +39 -0
  83. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/typert.remote-client.d.ts +2 -0
  84. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/typert.remote-client.js +32 -0
  85. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/types/index.d.ts +8 -0
  86. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/types/index.js +19 -1
  87. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/index.js +28 -0
  88. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/feed.js +17 -0
  89. package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/index.js +67 -19
  90. package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/types/index.d.ts +1 -1
  91. package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/types/profile-context.d.ts +11 -1
  92. package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/worker/profile-resolution-bootstrap.js +22 -3
  93. package/runtime/node_modules/@deepseek-ai/dsh-base/cordis.patch.yml +9 -3
  94. package/runtime/node_modules/@deepseek-ai/dsh-base/package.json +2 -1
  95. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/client.js +3 -2
  96. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/index.d.ts +2 -2
  97. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +1 -1
  98. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/client.js +1 -1
  99. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +60 -12
  100. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/types/client/directory.d.ts +3 -1
  101. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/types/client/locales.d.ts +6 -0
  102. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/markdown/CodeBlock.module.css +3 -5
  103. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/markdown/MarkdownText.module.css +23 -27
  104. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings/lib/types/client/contract/slots.d.ts +3 -1
  105. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/client.js +2 -2
  106. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/types/index.d.ts +2 -2
  107. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +8 -7
  108. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/types/client/SettingsDocumentAction.d.ts +1 -1
  109. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/types/client/settings-document-store.d.ts +2 -1
  110. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +33 -12
  111. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/types/client/locales.d.ts +2 -0
  112. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/lib/client.js +1 -1
  113. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  114. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +1 -1
  115. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +8 -1
  116. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/locales.d.ts +2 -0
  117. package/runtime/node_modules/@deepseek-ai/dsh-compaction-basic/lib/index.js +84 -8
  118. package/runtime/node_modules/@deepseek-ai/dsh-compaction-basic/lib/types/region.d.ts +9 -0
  119. package/runtime/node_modules/@deepseek-ai/dsh-compaction-basic/lib/types/summarizer.d.ts +7 -0
  120. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/index.js +35 -0
  121. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/brand.d.ts +11 -0
  122. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/brand.js +10 -0
  123. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/index.d.ts +28 -0
  124. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/index.js +36 -0
  125. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/package.json +42 -0
  126. package/runtime/node_modules/@deepseek-ai/dsh-config-editor/lib/index.js +102 -14
  127. package/runtime/node_modules/@deepseek-ai/dsh-config-editor/lib/types/index.d.ts +34 -4
  128. package/runtime/node_modules/@deepseek-ai/dsh-config-editor/package.json +1 -0
  129. package/runtime/node_modules/@deepseek-ai/dsh-host-webserver/lib/index.js +2 -1
  130. package/runtime/node_modules/@deepseek-ai/dsh-native-command/lib/index.js +21 -8
  131. package/runtime/node_modules/@deepseek-ai/dsh-native-command/lib/types/path-opener.d.ts +4 -6
  132. package/runtime/node_modules/@deepseek-ai/dsh-native-command/lib/types/path-opener.js +18 -7
  133. package/runtime/node_modules/@deepseek-ai/dsh-session-log-export/lib/client.js +3 -8
  134. package/runtime/node_modules/@deepseek-ai/dsh-session-log-export/lib/types/client/HeaderAction.d.ts +1 -1
  135. package/runtime/node_modules/@deepseek-ai/dsh-settings/lib/index.js +5 -4
  136. package/runtime/node_modules/@deepseek-ai/dsh-settings/lib/types/index.d.ts +4 -3
  137. package/runtime/node_modules/@deepseek-ai/dsh-settings/lib/types/index.js +4 -3
  138. package/runtime/node_modules/@deepseek-ai/dsh-skill/lib/types/index.d.ts +1 -1
  139. package/runtime/node_modules/@deepseek-ai/dsh-skill-filesystem/lib/index.js +7 -1
  140. package/runtime/node_modules/@deepseek-ai/dsh-storage/lib/types/backend.d.ts +4 -0
  141. package/runtime/node_modules/@deepseek-ai/dsh-storage-domain/lib/index.js +60 -0
  142. package/runtime/node_modules/@deepseek-ai/dsh-storage-domain/lib/types/domain.d.ts +15 -0
  143. package/runtime/node_modules/@deepseek-ai/dsh-storage-json/lib/index.js +25 -0
  144. package/runtime/node_modules/@deepseek-ai/dsh-storage-json/package.json +1 -0
  145. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/index.js +5472 -0
  146. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/command-args.d.ts +17 -0
  147. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/commands/tianti/cicd.d.ts +8 -0
  148. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/commands/tianti/tianti.d.ts +7 -0
  149. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/commands/tianti-deliver/tianti-deliver.d.ts +8 -0
  150. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/config.d.ts +27 -0
  151. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/index.d.ts +12 -0
  152. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/memory-config.d.ts +10 -0
  153. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/runtime.d.ts +105 -0
  154. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/aliases.d.ts +11 -0
  155. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/auth.d.ts +20 -0
  156. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/client.d.ts +206 -0
  157. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/config.d.ts +20 -0
  158. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/index.d.ts +6 -0
  159. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/log.d.ts +16 -0
  160. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/types.d.ts +136 -0
  161. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/codebase.d.ts +19 -0
  162. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/dynamicWorkflow.d.ts +10 -0
  163. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/engine.d.ts +8 -0
  164. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/executor.d.ts +11 -0
  165. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/executors.d.ts +15 -0
  166. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/index.d.ts +23 -0
  167. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/memorySuggestions.d.ts +12 -0
  168. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/openspec.d.ts +31 -0
  169. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/recommend.d.ts +8 -0
  170. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/render.d.ts +8 -0
  171. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/requirementContext.d.ts +12 -0
  172. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/scenarioUpgrade.d.ts +24 -0
  173. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/state.d.ts +16 -0
  174. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/store.d.ts +33 -0
  175. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/templates.d.ts +8 -0
  176. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/types.d.ts +385 -0
  177. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/writeReviewSync.d.ts +6 -0
  178. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/writeReview/index.d.ts +29 -0
  179. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/writeReview/store.d.ts +20 -0
  180. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/writeReview/types.d.ts +49 -0
  181. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/tools.d.ts +12 -0
  182. package/runtime/node_modules/@deepseek-ai/dsh-tianti/package.json +55 -0
  183. package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/api-catalog.js +57 -13
  184. package/runtime/node_modules/@deepseek-ai/dsh-web-app/presets/cordis.patch.yml +2 -1
  185. package/runtime/node_modules/@deepseek-ai/dsh-web-app/presets/ptc.patch.yml +2 -1
  186. package/runtime/node_modules/@deepseek-ai/dsh-web-app/presets/standard.patch.yml +2 -1
  187. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-D5kpKf--.css +1 -0
  188. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Dz_cDcce.js +133 -0
  189. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Dz_cDcce.js.map +1 -0
  190. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/chatcode-apple-touch-icon.png +0 -0
  191. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/chatcode-icon-32.png +0 -0
  192. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/chatcode-mask-icon.svg +1 -0
  193. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/favicon-dark.svg +1 -3
  194. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/favicon.ico +0 -0
  195. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/favicon.svg +1 -3
  196. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/index.html +8 -4
  197. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/preview.html +8 -4
  198. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/package.json +2 -1
  199. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/index.js +110 -33
  200. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/entity.d.ts +6 -0
  201. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/entity.js +23 -17
  202. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/index.d.ts +10 -0
  203. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/index.js +95 -21
  204. package/lib/dump-config-DBW7YLx-.js +0 -2
  205. package/lib/tuiDisplayPrefs-BCHRRcfe.js +0 -162
  206. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-DUvMhLle.css +0 -1
  207. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Q6zc2uHV.js +0 -127
  208. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Q6zc2uHV.js.map +0 -1
  209. package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/README.md +0 -9
  210. package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/bin/system.node +0 -0
  211. package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/package.json +0 -31
  212. package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/prebuilds.json +0 -6
  213. package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-x64/README.md +0 -9
  214. package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-x64/package.json +0 -31
  215. package/runtime/node_modules/@deepseek-ai/node-addon-system-darwin-x64/prebuilds.json +0 -6
  216. package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-arm64/README.md +0 -11
  217. package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-arm64/package.json +0 -31
  218. package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-arm64/prebuilds.json +0 -24
  219. package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-x64/README.md +0 -11
  220. package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-x64/package.json +0 -31
  221. package/runtime/node_modules/@deepseek-ai/node-addon-system-linux-x64/prebuilds.json +0 -24
package/lib/tui-compat.js CHANGED
@@ -1,7 +1,7 @@
1
- import { n as DEFAULT_STATUS_BAR, s as normalizePageMargin } from "./tuiDisplayPrefs-BCHRRcfe.js";
2
- import { t as SHORTCUT_ACTIONS } from "./keymap-CFChEJ2W.js";
1
+ import { c as normalizePageMargin, g as liveConfigValues, n as createStatusBarSchema, v as withLiveSettings } from "./statusBarSettings-BPPS_Usm.js";
2
+ import { t as SHORTCUT_ACTIONS } from "./keymap-CJ1kvLR2.js";
3
3
  import z from "@deepseek-ai/schemastery";
4
- //#region ../../node_modules/.pnpm/@chatcode+cco-tui@0.10.0-rc.9_08ea48c8555976e562c6368d51cb542b/node_modules/@chatcode/cco-tui/lib/types/force-production-react.js
4
+ //#region ../../../dsh-TUI/lib/types/force-production-react.js
5
5
  /**
6
6
  * React-reconciler selects its dev/production build at require time from
7
7
  * NODE_ENV; the dev build records one performance.measure() per render into
@@ -14,10 +14,18 @@ import z from "@deepseek-ai/schemastery";
14
14
  */
15
15
  process.env.NODE_ENV ??= "production";
16
16
  //#endregion
17
- //#region ../../node_modules/.pnpm/@chatcode+cco-tui@0.10.0-rc.9_08ea48c8555976e562c6368d51cb542b/node_modules/@chatcode/cco-tui/lib/types/dsh-adapter/index.js
17
+ //#region ../../../dsh-TUI/lib/types/dsh-adapter/index.js
18
+ /**
19
+ * dsh-tui plugin entry. The TUI implementation lives in `./plugin.tsx` (its
20
+ * render path is JSX); this module owns the plugin surface (`name`/`inject`/
21
+ * `Config`/`apply`) at the canonical `src/index.ts` location and delegates
22
+ * `apply` through a dynamic import so entry-scanning tooling and the Loader
23
+ * resolve a plain `.ts` module.
24
+ * @module @chatcode/cco-tui
25
+ */
18
26
  const name = "dsh-tui";
19
- const inject = ["agents"];
20
- const Config = z.object({
27
+ const inject$1 = ["agents"];
28
+ const Config$1 = withLiveSettings(z.object({
21
29
  sessionId: z.string().required(false),
22
30
  provider: z.string().required(false),
23
31
  model: z.string().required(false),
@@ -51,26 +59,10 @@ const Config = z.object({
51
59
  promptSessionLabel: z.boolean().default(false),
52
60
  expandEditor: z.boolean().default(true),
53
61
  smoothStreaming: z.boolean().default(true),
54
- statusBar: z.object({
55
- compact: z.boolean().default(DEFAULT_STATUS_BAR.compact),
56
- tokenDashboard: z.boolean().default(DEFAULT_STATUS_BAR.tokenDashboard),
57
- model: z.boolean().default(DEFAULT_STATUS_BAR.model),
58
- thinking: z.boolean().default(DEFAULT_STATUS_BAR.thinking),
59
- cwd: z.boolean().default(DEFAULT_STATUS_BAR.cwd),
60
- contextUsage: z.boolean().default(DEFAULT_STATUS_BAR.contextUsage),
61
- cache: z.boolean().default(DEFAULT_STATUS_BAR.cache),
62
- tokens: z.boolean().default(DEFAULT_STATUS_BAR.tokens),
63
- tps: z.boolean().default(DEFAULT_STATUS_BAR.tps),
64
- gitBranch: z.boolean().default(DEFAULT_STATUS_BAR.gitBranch),
65
- sessionTitle: z.boolean().default(DEFAULT_STATUS_BAR.sessionTitle),
66
- sessionId: z.boolean().default(DEFAULT_STATUS_BAR.sessionId),
67
- goal: z.boolean().default(DEFAULT_STATUS_BAR.goal),
68
- mode: z.boolean().default(DEFAULT_STATUS_BAR.mode),
69
- contextBar: z.boolean().default(DEFAULT_STATUS_BAR.contextBar),
70
- activity: z.boolean().default(DEFAULT_STATUS_BAR.activity),
71
- trajectory: z.boolean().default(DEFAULT_STATUS_BAR.trajectory),
72
- shortcutHint: z.boolean().default(DEFAULT_STATUS_BAR.shortcutHint)
73
- }).default({ ...DEFAULT_STATUS_BAR }),
62
+ whale: z.boolean().default(true),
63
+ minimal: z.boolean().default(false),
64
+ recapOnOpen: z.boolean().default(true),
65
+ statusBar: createStatusBarSchema(),
74
66
  shortcuts: z.object(Object.fromEntries(SHORTCUT_ACTIONS.map((action) => [action.id, z.string().required(false)]))).required(false),
75
67
  modes: z.array(z.object({
76
68
  id: z.string(),
@@ -83,7 +75,24 @@ const Config = z.object({
83
75
  ]).required(false),
84
76
  approval: z.union(["ask", "never"]).required(false)
85
77
  })).required(false)
86
- });
78
+ }), [
79
+ "fullscreen",
80
+ "lang",
81
+ "diffLayout",
82
+ "thinkingFold",
83
+ "toolBackground",
84
+ "scrollGutter",
85
+ "pageMargin",
86
+ "foldTerminalCommand",
87
+ "promptSessionLabel",
88
+ "expandEditor",
89
+ "smoothStreaming",
90
+ "statusBar",
91
+ "shortcuts",
92
+ "whale",
93
+ "minimal",
94
+ "recapOnOpen"
95
+ ]);
87
96
  /**
88
97
  * Start the interactive TUI front door, delegating to the JSX implementation
89
98
  * in `./plugin.tsx` (see its module doc for the full contract).
@@ -92,8 +101,14 @@ const Config = z.object({
92
101
  * @returns a promise settling when the TUI teardown completes.
93
102
  */
94
103
  async function apply(ctx, config) {
95
- const { apply: ccTuiApply } = await import("./plugin-jvd9PCVt.js");
96
- return ccTuiApply(ctx, config);
104
+ const { apply: ccTuiApply } = await import("./plugin-XR7ncbnW.js");
105
+ return ccTuiApply(ctx, liveConfigValues(config));
97
106
  }
98
107
  //#endregion
108
+ //#region lib/types/tui-compat.js
109
+ /** Validate the TUI's declared live fields using the launcher's own schema runtime. */
110
+ const Config = new z(Config$1.toJSON());
111
+ /** Wait for the shared model default before the TUI creates its first session. */
112
+ const inject = [...inject$1, "agentDefaultModel"];
113
+ //#endregion
99
114
  export { Config, apply, inject, name };
@@ -34,6 +34,8 @@ interface ProfileInvocation {
34
34
  patches: string[];
35
35
  /** Everything after the launcher's own flags, verbatim, for injected app plugins. */
36
36
  args: string[];
37
+ /** Explicitly unrestricted file access and automatic tool approval for this process. */
38
+ dangerouslySkipPermissions?: true;
37
39
  }
38
40
  /** Print a composed profile tree and exit without booting. */
39
41
  interface DumpConfigInvocation {
@@ -49,6 +49,14 @@ export declare function isTransientMigrationPath(relativePath: string, kind: Hom
49
49
  export declare function resolveHomeMigrationRoots(env?: Record<string, string | undefined>): HomeMigrationRoots;
50
50
  /** Find legacy trees with durable entries that are still absent from the canonical home. */
51
51
  export declare function detectPendingHomeMigrations(roots: HomeMigrationRoots): Promise<HomeMigrationPlan[]>;
52
+ /**
53
+ * Probe the legacy roots for a startup reminder without descending or reading file contents.
54
+ * A positive result reports legacy data, not a claim that it still needs copying;
55
+ * the explicit migration command owns destination comparison and fingerprinting.
56
+ * @param roots - legacy directories and their canonical destinations.
57
+ * @returns whether either distinct, readable legacy root contains a durable entry.
58
+ */
59
+ export declare function hasLegacyHomeData(roots: HomeMigrationRoots): Promise<boolean>;
52
60
  /** Inspect both trees and return a deterministic, side-effect-free migration plan. */
53
61
  export declare function planHomeMigration(source: string, destination: string): Promise<HomeMigrationPlan>;
54
62
  /** Apply exactly one reviewed plan without overwriting destinations or removing legacy data. */
@@ -0,0 +1,16 @@
1
+ /** Process-local permission overrides for explicitly unrestricted CLI launches. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ declare module '@deepseek-ai/cordis' {
4
+ interface Context {
5
+ /** Process-local tool approval and sandbox override installed by the launcher. */
6
+ chatcodePermissionBypass?: true;
7
+ }
8
+ }
9
+ /**
10
+ * Allow tool approval requests and remove file confinement until this root is disposed.
11
+ * Session permission events and saved profile settings remain unchanged, including on resume.
12
+ * ApprovalService still records its asked/decided pair and honors cancellation.
13
+ * @param ctx - profile root, before application plugins mount.
14
+ */
15
+ export declare function installPermissionBypass(ctx: Context): void;
16
+ //# sourceMappingURL=permission-bypass.d.ts.map
@@ -14,6 +14,7 @@ import type { PatchOptions } from '@deepseek-ai/cordis-plugin-include';
14
14
  import { type ProfileContext, type Profile, type ProfileTemplate, type RuntimeResolution } from '@deepseek-ai/dsh-app-boot';
15
15
  import { type LaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment';
16
16
  import { type ProcessShutdown } from './process-shutdown.ts';
17
+ import { type WebInstanceRegistration } from './web-instance.ts';
17
18
  /** Profile templates shipped by ChatCode CLI in addition to the upstream runtime profiles. */
18
19
  export declare const CHATCODE_PROFILE_TEMPLATES: Readonly<Record<string, ProfileTemplate>>;
19
20
  /** Exact compatibility bridge for ChatCode-owned releases qualified against this upstream runtime. */
@@ -55,6 +56,13 @@ export declare function preferEmbeddedRuntimeResolution(resolution: RuntimeResol
55
56
  export declare function restoreTrustedTuiLayer(profile: Profile, installAnchor?: string, runtimeVersion?: string): Profile;
56
57
  /** Resolve installed ChatCode product patches without changing persisted profiles. */
57
58
  export declare function chatCodeProfilePatchFiles(profile: string, installAnchor?: string): string[];
59
+ /**
60
+ * Deduplicate overlay files shared by startup, YAML dumps, and schema dumps.
61
+ * @param files - product and command-line overlay paths, in application order.
62
+ * @returns absolute paths in first-occurrence order, preserving relative-resource bases;
63
+ * missing files remain in the result for the patch loader to diagnose.
64
+ */
65
+ export declare function uniqueProfilePatchFiles(files: readonly string[]): string[];
58
66
  /** Root config filename inside a profile directory. */
59
67
  export declare const PROFILE_ROOT_FILENAME = "cordis.yml";
60
68
  /**
@@ -94,6 +102,10 @@ export interface ResolvedProfileRuntime {
94
102
  }
95
103
  /** Options for {@link runProfile}. */
96
104
  export interface RunProfileOptions {
105
+ /** Private Web registration supplied by the serialized public Web launcher. */
106
+ webInstance?: WebInstanceRegistration | undefined;
107
+ /** Unrestricted file access and automatic tool approval for this process only. */
108
+ dangerouslySkipPermissions?: boolean | undefined;
97
109
  /** This run's frozen environment snapshot, provided before any entry mounts. */
98
110
  environment: LaunchEnvironmentSnapshot;
99
111
  /** The profile name to boot. */
@@ -1,4 +1,5 @@
1
1
  /** Save original startup diagnostics while keeping the terminal report concise. */
2
+ import { type Context } from '@deepseek-ai/cordis';
2
3
  import type { StartupError } from '@deepseek-ai/dsh-app-boot';
3
4
  /** Launcher-owned context; no environment values or plugin configurations are collected. */
4
5
  interface StartupDiagnosticContext {
@@ -6,6 +7,18 @@ interface StartupDiagnosticContext {
6
7
  version: string;
7
8
  profile: string;
8
9
  }
10
+ /**
11
+ * Trace one startup phase to stderr when CHATCODE_CLI_STARTUP_TRACE=1.
12
+ * @param phase - launcher-owned label; exclude paths, arguments and configuration values.
13
+ * @returns a callback recording the elapsed milliseconds when the phase completes.
14
+ */
15
+ export declare function startStartupPhase(phase: string): () => void;
16
+ /**
17
+ * Trace plugin activation until the launcher's initial boot settles.
18
+ * @param ctx - the root context before profile entries mount.
19
+ * @returns the listener disposer; call before handing control to the interactive surface.
20
+ */
21
+ export declare function traceStartupPlugins(ctx: Context): () => void;
9
22
  /**
10
23
  * Print the startup summary and save a private, uniquely named report under DSH_HOME/logs.
11
24
  * Failed writes print the complete report to stderr instead of claiming a saved path.
@@ -1,3 +1,9 @@
1
1
  /** Exact-version TUI bridge owned by the ChatCode launcher. */
2
2
  export * from '@deepseek-harness-tui/dsh-tui';
3
+ import { Config as tuiConfig } from '@deepseek-harness-tui/dsh-tui';
4
+ import Schema from '@deepseek-ai/schemastery';
5
+ /** Validate the TUI's declared live fields using the launcher's own schema runtime. */
6
+ export declare const Config: Schema<tuiConfig | NoInfer<Partial<tuiConfig>>, tuiConfig | NoInfer<Partial<tuiConfig>>, "plain">;
7
+ /** Wait for the shared model default before the TUI creates its first session. */
8
+ export declare const inject: string[];
3
9
  //# sourceMappingURL=tui-compat.d.ts.map
@@ -0,0 +1,6 @@
1
+ /** Open a verified instance URL with the OS browser launcher in a scrubbed Node child.
2
+ * @param url - authenticated loopback URL returned by the running Web instance.
3
+ * @returns after the browser launcher exits successfully; rejects without hiding the printed URL.
4
+ */
5
+ export declare function openWebBrowser(url: string): Promise<void>;
6
+ //# sourceMappingURL=web-browser.d.ts.map
@@ -0,0 +1,42 @@
1
+ import { Context } from '@deepseek-ai/cordis';
2
+ import { type Branded } from '@deepseek-ai/dsh-brand';
3
+ /** Process identity retained in the private file and verified control replies. */
4
+ export type WebInstanceId = Branded<'ChatCodeWebInstanceId'>;
5
+ /** A usage diagnostic already printed by the Web app's own argument parser. */
6
+ export declare class WebUsageError extends Error {
7
+ readonly exitCode: number;
8
+ /** @param exitCode - exit status selected by the app argument parser. */
9
+ constructor(exitCode: number);
10
+ }
11
+ /** A registration whose lifetime belongs to this Web process, not a requesting TUI. */
12
+ export interface WebInstanceRegistration {
13
+ path: string;
14
+ id: WebInstanceId;
15
+ secret: string;
16
+ }
17
+ /** Resolve the private instance record under the launcher's canonical home.
18
+ * @param home - absolute ChatCode CLI home.
19
+ * @returns the one default Web registration path.
20
+ */
21
+ export declare function webInstancePath(home: string): string;
22
+ /** Install authenticated local control routes and publish only after the profile is ready.
23
+ * @param ctx - root profile context, after the application tree has settled.
24
+ * @param registration - random process identity and private record path.
25
+ * @param stop - whole-profile shutdown, invoked only for authenticated explicit off requests.
26
+ * @returns after the initial registration has been written; returns without registering for help-only launches.
27
+ */
28
+ export declare function registerWebInstance(ctx: Context, registration: WebInstanceRegistration, stop: () => void): Promise<void>;
29
+ /** Operations used by the launcher; the first boot remains in the foreground. */
30
+ export interface ManagedWebOptions {
31
+ home: string;
32
+ args: readonly string[];
33
+ start(registration: WebInstanceRegistration | undefined, args: readonly string[]): Promise<void>;
34
+ open(url: string): Promise<void>;
35
+ print(line: string): void;
36
+ }
37
+ /** Start once or reopen a verified existing instance; off waits for its listener to close.
38
+ * @param options - canonical home, app arguments, and launcher-owned boot/browser operations.
39
+ * @returns after boot, reuse, or an explicit stop has settled.
40
+ */
41
+ export declare function runManagedWeb(options: ManagedWebOptions): Promise<void>;
42
+ //# sourceMappingURL=web-instance.d.ts.map
@@ -0,0 +1,46 @@
1
+ import { spawn } from "node:child_process";
2
+ import { scrubbedParentEnv } from "@deepseek-ai/dsh-subprocess";
3
+ //#region lib/types/web-browser.js
4
+ /** Reopen an authenticated Web URL without inheriting project browser commands or secrets. */
5
+ /** Open a verified instance URL with the OS browser launcher in a scrubbed Node child.
6
+ * @param url - authenticated loopback URL returned by the running Web instance.
7
+ * @returns after the browser launcher exits successfully; rejects without hiding the printed URL.
8
+ */
9
+ async function openWebBrowser(url) {
10
+ const script = `
11
+ try {
12
+ const { default: open } = await import(${JSON.stringify(import.meta.resolve("open"))});
13
+ const launcher = await open(process.argv[1]);
14
+ if (process.platform === 'win32') {
15
+ const code = launcher.exitCode ?? await new Promise((resolve, reject) => {
16
+ launcher.ref();
17
+ launcher.once('error', reject);
18
+ launcher.once('close', resolve);
19
+ });
20
+ if (code !== 0) throw new Error('Browser launcher failed');
21
+ }
22
+ process.exitCode = 0;
23
+ } catch {
24
+ process.exitCode = 1;
25
+ }
26
+ `;
27
+ const child = spawn(process.execPath, [
28
+ "--input-type=module",
29
+ "--eval",
30
+ script,
31
+ url
32
+ ], {
33
+ env: scrubbedParentEnv(),
34
+ stdio: "ignore",
35
+ windowsHide: true
36
+ });
37
+ await new Promise((resolve, reject) => {
38
+ child.once("error", reject);
39
+ child.once("close", (code) => {
40
+ if (code === 0) resolve();
41
+ else reject(/* @__PURE__ */ new Error("无法自动打开浏览器;请使用上方访问链接。"));
42
+ });
43
+ });
44
+ }
45
+ //#endregion
46
+ export { openWebBrowser };
@@ -0,0 +1,2 @@
1
+ import { r as runManagedWeb, t as WebUsageError } from "./web-instance-DbP7IHPv.js";
2
+ export { WebUsageError, runManagedWeb };
@@ -0,0 +1,280 @@
1
+ import { dirname, join } from "node:path";
2
+ import { randomBytes, timingSafeEqual } from "node:crypto";
3
+ import { mkdir, readFile, rm } from "node:fs/promises";
4
+ import { provideCmdline } from "@deepseek-ai/dsh-cmdline";
5
+ import { request } from "node:http";
6
+ import { connect } from "node:net";
7
+ import { Context } from "@deepseek-ai/cordis";
8
+ import { brandString } from "@deepseek-ai/dsh-brand";
9
+ import { withFileLock, writeFileAtomic } from "@deepseek-ai/dsh-atomic-write";
10
+ import * as WebStartup from "@deepseek-ai/dsh-web-app/startup";
11
+ //#region lib/types/web-instance.js
12
+ /** Private, verified Web instance discovery shared by terminal and standalone launches. */
13
+ const CONTROL_PATH = "/.chatcode-cli/web-instance";
14
+ const START_WAIT_MS = 12e4;
15
+ /** A usage diagnostic already printed by the Web app's own argument parser. */
16
+ var WebUsageError = class extends Error {
17
+ exitCode;
18
+ /** @param exitCode - exit status selected by the app argument parser. */
19
+ constructor(exitCode) {
20
+ super("Web command-line parsing finished");
21
+ this.exitCode = exitCode;
22
+ }
23
+ };
24
+ async function validateArguments(args) {
25
+ const ctx = new Context();
26
+ let code;
27
+ provideCmdline(ctx, {
28
+ args,
29
+ exit: (value) => {
30
+ code = value;
31
+ },
32
+ ready: { onReady: () => () => {} }
33
+ });
34
+ try {
35
+ WebStartup.apply(ctx);
36
+ } finally {
37
+ await ctx.fiber.dispose();
38
+ }
39
+ if (code !== void 0) throw new WebUsageError(code);
40
+ }
41
+ /** Resolve the private instance record under the launcher's canonical home.
42
+ * @param home - absolute ChatCode CLI home.
43
+ * @returns the one default Web registration path.
44
+ */
45
+ function webInstancePath(home) {
46
+ return join(home, "web", "instance.json");
47
+ }
48
+ function isRecord(value) {
49
+ return typeof value === "object" && value !== null && !Array.isArray(value);
50
+ }
51
+ function localUrl(value, token) {
52
+ if (typeof value !== "string") return void 0;
53
+ try {
54
+ const url = new URL(value);
55
+ if (url.protocol !== "http:" || url.hostname !== "127.0.0.1" || url.port === "" || url.username !== "" || url.password !== "" || url.hash !== "" || url.pathname !== "/") return void 0;
56
+ if (token ? !url.searchParams.get("token") : url.search !== "") return void 0;
57
+ return url;
58
+ } catch {
59
+ return;
60
+ }
61
+ }
62
+ async function readInstance(path) {
63
+ let text;
64
+ try {
65
+ text = await readFile(path, "utf8");
66
+ } catch (error) {
67
+ if (error.code === "ENOENT") return void 0;
68
+ throw error;
69
+ }
70
+ let value;
71
+ try {
72
+ value = JSON.parse(text);
73
+ } catch (_invalidJson) {
74
+ throw new Error("Web 实例登记无法解析;未启动或关闭任何进程。");
75
+ }
76
+ if (!isRecord(value) || value.version !== 1 || typeof value.id !== "string" || typeof value.pid !== "number" || !Number.isInteger(value.pid) || value.pid < 1 || value.pid > 2147483647 || typeof value.secret !== "string" || !/^[a-f0-9]{64}$/u.test(value.secret) || typeof value.origin !== "string" || localUrl(value.origin, false) === void 0) throw new Error("Web 实例登记无效;未启动或关闭任何进程。");
77
+ return {
78
+ version: 1,
79
+ id: brandString(value.id),
80
+ pid: value.pid,
81
+ origin: value.origin,
82
+ secret: value.secret
83
+ };
84
+ }
85
+ function processExists(pid) {
86
+ try {
87
+ process.kill(pid, 0);
88
+ return true;
89
+ } catch (error) {
90
+ if (error.code === "ESRCH") return false;
91
+ throw error;
92
+ }
93
+ }
94
+ /** Local HTTP avoids inherited proxies and never follows a redirect carrying the management secret. */
95
+ async function control(record, method) {
96
+ return new Promise((resolve, reject) => {
97
+ const req = request(`${record.origin}${CONTROL_PATH}`, {
98
+ method,
99
+ headers: {
100
+ authorization: `Bearer ${record.secret}`,
101
+ connection: "close"
102
+ }
103
+ }, (res) => {
104
+ const chunks = [];
105
+ let size = 0;
106
+ res.on("data", (chunk) => {
107
+ size += chunk.length;
108
+ if (size > 16384) req.destroy(/* @__PURE__ */ new Error("Web 实例响应过大。"));
109
+ else chunks.push(chunk);
110
+ });
111
+ res.on("error", reject);
112
+ res.on("end", () => {
113
+ try {
114
+ if (res.statusCode !== 200) throw new Error("Web 实例未通过认证;不会复用或关闭此端口上的其他服务。");
115
+ const value = JSON.parse(Buffer.concat(chunks).toString("utf8"));
116
+ if (!isRecord(value) || value.id !== record.id || value.pid !== record.pid || localUrl(value.url, true)?.origin !== record.origin || typeof value.url !== "string") throw new Error("Web 实例身份不匹配;未关闭任何进程。");
117
+ resolve({
118
+ id: record.id,
119
+ pid: record.pid,
120
+ url: value.url
121
+ });
122
+ } catch (error) {
123
+ reject(error instanceof Error ? error : new Error("Web 实例响应无效。", { cause: error }));
124
+ }
125
+ });
126
+ });
127
+ req.setTimeout(2e3, () => req.destroy(/* @__PURE__ */ new Error("Web 实例暂未响应;请稍后重试。")));
128
+ req.on("error", (error) => {
129
+ if (error.code === "ECONNREFUSED") resolve(void 0);
130
+ else reject(error);
131
+ });
132
+ req.end();
133
+ });
134
+ }
135
+ /** Install authenticated local control routes and publish only after the profile is ready.
136
+ * @param ctx - root profile context, after the application tree has settled.
137
+ * @param registration - random process identity and private record path.
138
+ * @param stop - whole-profile shutdown, invoked only for authenticated explicit off requests.
139
+ * @returns after the initial registration has been written; returns without registering for help-only launches.
140
+ */
141
+ async function registerWebInstance(ctx, registration, stop) {
142
+ if (ctx.get("webServer") === void 0 || ctx.get("connection") === void 0) return;
143
+ let disposed = false;
144
+ let published = Promise.resolve();
145
+ const status = () => {
146
+ const web = ctx.get("webServer");
147
+ const connection = ctx.get("connection");
148
+ if (web === void 0 || connection === void 0) throw new Error("Web 服务正在重载。");
149
+ return {
150
+ id: registration.id,
151
+ pid: process.pid,
152
+ url: connection.authenticatedUrl(`http://127.0.0.1:${web.port}`)
153
+ };
154
+ };
155
+ ctx.inject(["webServer", "connection"], (owner) => {
156
+ owner.effect(() => owner.webServer.register({
157
+ kind: "exact",
158
+ path: CONTROL_PATH,
159
+ handler(req, res) {
160
+ res.setHeader("cache-control", "no-store");
161
+ const auth = req.headers.authorization ?? "";
162
+ const expected = `Bearer ${registration.secret}`;
163
+ if (![
164
+ "127.0.0.1",
165
+ "::ffff:127.0.0.1",
166
+ "::1"
167
+ ].includes(req.socket.remoteAddress ?? "") || Buffer.byteLength(auth) !== Buffer.byteLength(expected) || !timingSafeEqual(Buffer.from(auth), Buffer.from(expected))) {
168
+ res.writeHead(401).end();
169
+ return;
170
+ }
171
+ if (req.method !== "GET" && req.method !== "POST") {
172
+ res.writeHead(405).end();
173
+ return;
174
+ }
175
+ if (disposed) {
176
+ res.writeHead(503).end();
177
+ return;
178
+ }
179
+ res.setHeader("content-type", "application/json");
180
+ if (req.method === "POST") res.once("finish", stop);
181
+ res.end(JSON.stringify(status()));
182
+ }
183
+ }));
184
+ const current = status();
185
+ published = published.then(() => writeFileAtomic(registration.path, JSON.stringify({
186
+ version: 1,
187
+ id: current.id,
188
+ pid: current.pid,
189
+ origin: new URL(current.url).origin,
190
+ secret: registration.secret
191
+ }), {
192
+ mode: 384,
193
+ dirMode: 448
194
+ }));
195
+ return published;
196
+ });
197
+ ctx.effect(() => async () => {
198
+ disposed = true;
199
+ await published;
200
+ if ((await readInstance(registration.path))?.id === registration.id) await rm(registration.path, { force: true });
201
+ });
202
+ await ctx.loader.await();
203
+ await published;
204
+ }
205
+ function listenerOpen(origin) {
206
+ return new Promise((resolve, reject) => {
207
+ const socket = connect({
208
+ host: "127.0.0.1",
209
+ port: Number(new URL(origin).port)
210
+ });
211
+ socket.once("connect", () => {
212
+ socket.destroy();
213
+ resolve(true);
214
+ });
215
+ socket.setTimeout(1e3, () => {
216
+ socket.destroy();
217
+ resolve(true);
218
+ });
219
+ socket.once("error", (error) => {
220
+ socket.destroy();
221
+ if (error.code === "ECONNREFUSED") resolve(false);
222
+ else reject(error);
223
+ });
224
+ });
225
+ }
226
+ /** Start once or reopen a verified existing instance; off waits for its listener to close.
227
+ * @param options - canonical home, app arguments, and launcher-owned boot/browser operations.
228
+ * @returns after boot, reuse, or an explicit stop has settled.
229
+ */
230
+ async function runManagedWeb(options) {
231
+ const action = options.args[0] === "on" || options.args[0] === "off" ? options.args[0] : "on";
232
+ const args = options.args[0] === action ? options.args.slice(1) : options.args;
233
+ const portFlag = args.findIndex((arg) => arg === "--port" || arg.startsWith("--port="));
234
+ const port = portFlag < 0 ? void 0 : args[portFlag]?.split("=")[1] ?? args[portFlag + 1];
235
+ if (args.includes("--help") || args.includes("-h") || port === "0") {
236
+ if (action === "off" && port === "0") throw new Error("Web off 不支持随机端口。");
237
+ await options.start(void 0, args);
238
+ return;
239
+ }
240
+ await validateArguments(args);
241
+ const path = webInstancePath(options.home);
242
+ await mkdir(dirname(path), {
243
+ recursive: true,
244
+ mode: 448
245
+ });
246
+ await withFileLock(path, async () => {
247
+ const record = await readInstance(path);
248
+ const existing = record !== void 0 && processExists(record.pid) ? await control(record, "GET") : void 0;
249
+ if (record !== void 0 && processExists(record.pid) && existing === void 0) throw new Error("登记的 Web 进程仍在运行,但服务尚未就绪;请稍后重试,不会重复启动。");
250
+ if (existing !== void 0 && record !== void 0) {
251
+ if (port !== void 0 && Number(port) !== Number(new URL(existing.url).port)) throw new Error("已有 Web 实例使用不同端口;请先执行 cco web off,再指定新端口启动。");
252
+ if (action === "off") {
253
+ await control(record, "POST");
254
+ const deadline = Date.now() + 6e3;
255
+ while (await listenerOpen(record.origin)) {
256
+ if (Date.now() >= deadline) throw new Error("Web 正在关闭,但端口尚未释放;请稍后重试。");
257
+ await new Promise((resolve) => setTimeout(resolve, 50));
258
+ }
259
+ if ((await readInstance(path))?.id === record.id) await rm(path, { force: true });
260
+ options.print("cco web: stopped");
261
+ } else {
262
+ options.print(`cco web: ${existing.url}`);
263
+ if (!args.includes("--no-open")) await options.open(existing.url);
264
+ }
265
+ return;
266
+ }
267
+ if (record !== void 0) await rm(path, { force: true });
268
+ if (action === "off") {
269
+ options.print("cco web: stopped");
270
+ return;
271
+ }
272
+ await options.start({
273
+ path,
274
+ id: brandString(randomBytes(16).toString("hex")),
275
+ secret: randomBytes(32).toString("hex")
276
+ }, args);
277
+ }, { waitMs: START_WAIT_MS });
278
+ }
279
+ //#endregion
280
+ export { webInstancePath as i, registerWebInstance as n, runManagedWeb as r, WebUsageError as t };
@@ -1,8 +1,8 @@
1
- import { a as compositionRoot, i as bindCallerEffect, n as activationFiber, o as concreteService, s as requirePluginCaller } from "./host-access-CmD27uhQ.js";
1
+ import { a as compositionRoot, i as bindCallerEffect, n as activationFiber, o as concreteService, s as requirePluginCaller } from "./host-access-Bk4xps5E.js";
2
2
  import { fileURLToPath, pathToFileURL } from "node:url";
3
3
  import { basename, isAbsolute, resolve } from "node:path";
4
4
  import { Service } from "@deepseek-ai/cordis";
5
- //#region ../../node_modules/.pnpm/@chatcode+cco-tui@0.10.0-rc.9_08ea48c8555976e562c6368d51cb542b/node_modules/@chatcode/cco-tui/lib/types/dsh-adapter/workspaces.js
5
+ //#region ../../../dsh-TUI/lib/types/dsh-adapter/workspaces.js
6
6
  /**
7
7
  * Workspace-target extension seam for terminal front doors.
8
8
  *