@chatcode/chatcode-cli 3.0.3 → 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 (174) hide show
  1. package/README.i18n.yaml +10 -10
  2. package/README.md +16 -1
  3. package/README.zh.md +16 -1
  4. package/lib/bin.js +62 -11
  5. package/lib/{command-errors-CBJRI2gy.js → command-errors-BkCHTQHj.js} +12 -12
  6. package/lib/{command-trees-Dvq4C7a4.js → command-trees-5HFyC5sI.js} +2 -2
  7. package/lib/{component-identity-DPdJglJO.js → component-identity-De91VHwW.js} +3 -3
  8. package/lib/{dist-w_sIm4VD.js → dist-CsDWUvQ4.js} +231 -231
  9. package/lib/{dump-config-CauO75nE.js → dump-config-BcH-VYuv.js} +5 -5
  10. package/lib/dump-config-CyopmD85.js +2 -0
  11. package/lib/{dump-config-schema-CObLWWaW.js → dump-config-schema-DM0fb6Ns.js} +2 -2
  12. package/lib/{extension-events-Be9LWvHD.js → extension-events-CdYCRP0o.js} +26 -26
  13. package/lib/{frames-7PAg0Q9b.js → frames-DOX-Jgk8.js} +4 -4
  14. package/lib/headless-compat.js +2 -2
  15. package/lib/{host-access-DeCjoRQP.js → host-access-Bk4xps5E.js} +1 -1
  16. package/lib/{keymap-CRUxM_qn.js → keymap-CJ1kvLR2.js} +17 -16
  17. package/lib/{plugin-CDFSDE_y.js → plugin-XR7ncbnW.js} +2928 -2240
  18. package/lib/{plugin-Cn-hyYY8.js → plugin-eJjD6r12.js} +1 -1
  19. package/lib/{profile-boot-SJGbpLgN.js → profile-boot-BNQry1NM.js} +97 -14
  20. package/lib/profile-boot.js +2 -2
  21. package/lib/{scenes-D6jV1EEi.js → scenes-CAmWncZD.js} +3 -3
  22. package/lib/{settings-sections-DJQRNBo9.js → settings-sections-CakcvBv9.js} +7 -3
  23. package/lib/statusBarSettings-BPPS_Usm.js +382 -0
  24. package/lib/{supports-color-CcW-FGjr.js → supports-color-DyChQwlI.js} +2 -2
  25. package/lib/{themes-BCly4_y9.js → themes-OjcUpZzw.js} +13 -13
  26. package/lib/tui-compat-command-trees.js +1 -1
  27. package/lib/tui-compat-extensions.js +3 -3
  28. package/lib/tui-compat-plugin-host.js +5 -5
  29. package/lib/tui-compat-scenes.js +1 -1
  30. package/lib/tui-compat-settings-sections.js +1 -1
  31. package/lib/tui-compat-working-activity.js +4 -4
  32. package/lib/tui-compat-workspaces.js +1 -1
  33. package/lib/tui-compat.js +9 -26
  34. package/lib/types/args.d.ts +2 -0
  35. package/lib/types/permission-bypass.d.ts +16 -0
  36. package/lib/types/profile-boot.d.ts +12 -0
  37. package/lib/types/tui-compat.d.ts +4 -0
  38. package/lib/types/web-browser.d.ts +6 -0
  39. package/lib/types/web-instance.d.ts +42 -0
  40. package/lib/web-browser-Vcgfdsv_.js +46 -0
  41. package/lib/web-instance-B0jec7cq.js +2 -0
  42. package/lib/web-instance-DbP7IHPv.js +280 -0
  43. package/lib/{workspaces-Bb3kCAFb.js → workspaces-XY7UdfXp.js} +2 -2
  44. package/package.json +34 -32
  45. package/runtime/manifest.json +4 -2
  46. package/runtime/node_modules/@deepseek-ai/dsh-agent-default-model/lib/index.js +34 -4
  47. package/runtime/node_modules/@deepseek-ai/dsh-agent-default-model/lib/types/index.d.ts +9 -0
  48. package/runtime/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-composition-reference/references/packages.md +2 -1
  49. package/runtime/node_modules/@deepseek-ai/dsh-api-gateway/lib/client.js +2 -0
  50. package/runtime/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/client/remote-stream.js +4 -0
  51. package/runtime/node_modules/@deepseek-ai/dsh-api-remotes/lib/client.js +39 -0
  52. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/index.js +6 -1
  53. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.host.js +10 -3
  54. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.remote-client.js +7 -0
  55. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/catalog.js +8 -1
  56. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/types.d.ts +10 -0
  57. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/index.js +28 -1
  58. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/typert.host.js +39 -0
  59. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/typert.remote-client.d.ts +2 -0
  60. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/typert.remote-client.js +32 -0
  61. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/types/index.d.ts +8 -0
  62. package/runtime/node_modules/@deepseek-ai/dsh-api-settings-controller/lib/types/index.js +19 -1
  63. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/index.js +28 -0
  64. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/feed.js +17 -0
  65. package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/index.js +67 -19
  66. package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/types/index.d.ts +1 -1
  67. package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/types/profile-context.d.ts +11 -1
  68. package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/worker/profile-resolution-bootstrap.js +22 -3
  69. package/runtime/node_modules/@deepseek-ai/dsh-base/cordis.patch.yml +9 -3
  70. package/runtime/node_modules/@deepseek-ai/dsh-base/package.json +2 -1
  71. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/client.js +3 -2
  72. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/index.d.ts +2 -2
  73. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +1 -1
  74. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/client.js +1 -1
  75. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +60 -12
  76. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/types/client/directory.d.ts +3 -1
  77. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/types/client/locales.d.ts +6 -0
  78. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/markdown/CodeBlock.module.css +3 -5
  79. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/markdown/MarkdownText.module.css +23 -27
  80. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings/lib/types/client/contract/slots.d.ts +3 -1
  81. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/client.js +2 -2
  82. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/types/index.d.ts +2 -2
  83. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +8 -7
  84. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/types/client/SettingsDocumentAction.d.ts +1 -1
  85. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/types/client/settings-document-store.d.ts +2 -1
  86. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +33 -12
  87. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/types/client/locales.d.ts +2 -0
  88. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/lib/client.js +1 -1
  89. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  90. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +1 -1
  91. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +8 -1
  92. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/locales.d.ts +2 -0
  93. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/index.js +35 -0
  94. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/brand.d.ts +11 -0
  95. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/brand.js +10 -0
  96. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/index.d.ts +28 -0
  97. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/lib/types/index.js +36 -0
  98. package/runtime/node_modules/@deepseek-ai/dsh-computer-use/package.json +42 -0
  99. package/runtime/node_modules/@deepseek-ai/dsh-config-editor/lib/index.js +102 -14
  100. package/runtime/node_modules/@deepseek-ai/dsh-config-editor/lib/types/index.d.ts +34 -4
  101. package/runtime/node_modules/@deepseek-ai/dsh-config-editor/package.json +1 -0
  102. package/runtime/node_modules/@deepseek-ai/dsh-host-webserver/lib/index.js +2 -1
  103. package/runtime/node_modules/@deepseek-ai/dsh-native-command/lib/index.js +21 -8
  104. package/runtime/node_modules/@deepseek-ai/dsh-native-command/lib/types/path-opener.d.ts +4 -6
  105. package/runtime/node_modules/@deepseek-ai/dsh-native-command/lib/types/path-opener.js +18 -7
  106. package/runtime/node_modules/@deepseek-ai/dsh-settings/lib/index.js +5 -4
  107. package/runtime/node_modules/@deepseek-ai/dsh-settings/lib/types/index.d.ts +4 -3
  108. package/runtime/node_modules/@deepseek-ai/dsh-settings/lib/types/index.js +4 -3
  109. package/runtime/node_modules/@deepseek-ai/dsh-storage/lib/types/backend.d.ts +4 -0
  110. package/runtime/node_modules/@deepseek-ai/dsh-storage-domain/lib/index.js +60 -0
  111. package/runtime/node_modules/@deepseek-ai/dsh-storage-domain/lib/types/domain.d.ts +15 -0
  112. package/runtime/node_modules/@deepseek-ai/dsh-storage-json/lib/index.js +25 -0
  113. package/runtime/node_modules/@deepseek-ai/dsh-storage-json/package.json +1 -0
  114. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/index.js +5472 -0
  115. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/command-args.d.ts +17 -0
  116. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/commands/tianti/cicd.d.ts +8 -0
  117. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/commands/tianti/tianti.d.ts +7 -0
  118. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/commands/tianti-deliver/tianti-deliver.d.ts +8 -0
  119. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/config.d.ts +27 -0
  120. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/index.d.ts +12 -0
  121. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/memory-config.d.ts +10 -0
  122. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/runtime.d.ts +105 -0
  123. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/aliases.d.ts +11 -0
  124. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/auth.d.ts +20 -0
  125. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/client.d.ts +206 -0
  126. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/config.d.ts +20 -0
  127. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/index.d.ts +6 -0
  128. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/log.d.ts +16 -0
  129. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/types.d.ts +136 -0
  130. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/codebase.d.ts +19 -0
  131. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/dynamicWorkflow.d.ts +10 -0
  132. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/engine.d.ts +8 -0
  133. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/executor.d.ts +11 -0
  134. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/executors.d.ts +15 -0
  135. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/index.d.ts +23 -0
  136. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/memorySuggestions.d.ts +12 -0
  137. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/openspec.d.ts +31 -0
  138. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/recommend.d.ts +8 -0
  139. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/render.d.ts +8 -0
  140. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/requirementContext.d.ts +12 -0
  141. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/scenarioUpgrade.d.ts +24 -0
  142. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/state.d.ts +16 -0
  143. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/store.d.ts +33 -0
  144. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/templates.d.ts +8 -0
  145. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/types.d.ts +385 -0
  146. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/wanmaDevelopmentWorkflow/writeReviewSync.d.ts +6 -0
  147. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/writeReview/index.d.ts +29 -0
  148. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/writeReview/store.d.ts +20 -0
  149. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/writeReview/types.d.ts +49 -0
  150. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/tools.d.ts +12 -0
  151. package/runtime/node_modules/@deepseek-ai/dsh-tianti/package.json +55 -0
  152. package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/api-catalog.js +57 -13
  153. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-D5kpKf--.css +1 -0
  154. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Dz_cDcce.js +133 -0
  155. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Dz_cDcce.js.map +1 -0
  156. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/chatcode-apple-touch-icon.png +0 -0
  157. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/chatcode-icon-32.png +0 -0
  158. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/chatcode-mask-icon.svg +1 -0
  159. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/favicon-dark.svg +1 -3
  160. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/favicon.ico +0 -0
  161. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/favicon.svg +1 -3
  162. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/index.html +8 -4
  163. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/preview.html +8 -4
  164. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/package.json +2 -1
  165. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/index.js +110 -33
  166. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/entity.d.ts +6 -0
  167. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/entity.js +23 -17
  168. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/index.d.ts +10 -0
  169. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/index.js +95 -21
  170. package/lib/dump-config-CijLv_kn.js +0 -2
  171. package/lib/tuiDisplayPrefs-Dm_fULiR.js +0 -204
  172. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-DUvMhLle.css +0 -1
  173. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Q6zc2uHV.js +0 -127
  174. package/runtime/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/index-Q6zc2uHV.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { r as INSTALL_ANCHOR, t as CHATCODE_PROFILE_TEMPLATES } from "./profile-boot-SJGbpLgN.js";
1
+ import { r as INSTALL_ANCHOR, t as CHATCODE_PROFILE_TEMPLATES } from "./profile-boot-BNQry1NM.js";
2
2
  import { existsSync } from "node:fs";
3
3
  import { DEFAULT_PROFILE_BUNDLES, initProfile, readProfileCompatibility, resolveProfileDir } from "@deepseek-ai/dsh-app-boot";
4
4
  import { join } from "node:path";
@@ -1,9 +1,10 @@
1
1
  import { i as synchronizeLegacyHomeEnvironment, r as resolveChatCodeCliHome } from "./chatcode-home-B93iESZd.js";
2
2
  import { n as startStartupPhase, r as traceStartupPlugins } from "./startup-diagnostics-C_hRCp-q.js";
3
+ import { n as registerWebInstance } from "./web-instance-DbP7IHPv.js";
3
4
  import { createRequire } from "node:module";
4
- import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
5
+ import { existsSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
5
6
  import { fileURLToPath } from "node:url";
6
- import { PROFILE_PATCH_FILENAME, PROFILE_TEMPLATES, PluginPackages, boot, bundlePatchPaths, createRuntimeResolution, getDshRuntimeVersion, initProfile, installFailLoud, loadOverlayPatches, loadProfile, readProfilePatches, reportSkippedBundles, resolveProfileDir } from "@deepseek-ai/dsh-app-boot";
7
+ import { PROFILE_PATCH_FILENAME, PROFILE_TEMPLATES, PluginPackages, boot, bundlePatchPaths, createRuntimeResolution, getDshRuntimeVersion, initProfile, installFailLoud, loadOverlayPatches, loadProfile, readProfileManifest, readProfilePatches, reportSkippedBundles, resolveProfileDir, writeProfileManifest } from "@deepseek-ai/dsh-app-boot";
7
8
  import { dirname, extname, join, resolve } from "node:path";
8
9
  import { installProxyFromEnvironment } from "@deepseek-ai/dsh-http-proxy";
9
10
  import { DSH_LAUNCH_ENVIRONMENT_KEY } from "@deepseek-ai/dsh-launch-environment";
@@ -72,6 +73,40 @@ function createProcessShutdown(dispose, forceExit = (code) => {
72
73
  };
73
74
  }
74
75
  //#endregion
76
+ //#region lib/types/permission-bypass.js
77
+ /** Process-local permission overrides for explicitly unrestricted CLI launches. */
78
+ /**
79
+ * Allow tool approval requests and remove file confinement until this root is disposed.
80
+ * Session permission events and saved profile settings remain unchanged, including on resume.
81
+ * ApprovalService still records its asked/decided pair and honors cancellation.
82
+ * @param ctx - profile root, before application plugins mount.
83
+ */
84
+ function installPermissionBypass(ctx) {
85
+ ctx.provide("chatcodePermissionBypass", true);
86
+ ctx.inject(["sandboxPolicy", "approval"], (child) => {
87
+ child.effect(() => {
88
+ const sandbox = child.sandboxPolicy;
89
+ const approval = child.approval;
90
+ const resolveDescriptor = Object.getOwnPropertyDescriptor(sandbox, "resolve");
91
+ const policyDescriptor = Object.getOwnPropertyDescriptor(approval, "overrideOf");
92
+ const resolve = sandbox.resolve.bind(sandbox);
93
+ sandbox.resolve = (request) => ({
94
+ ...resolve(request),
95
+ mode: "danger-full-access"
96
+ });
97
+ approval.overrideOf = () => "ask";
98
+ const releaseAnswerer = child.on("approval/request", (request) => Promise.resolve(request.signal?.aborted ? "cancelled" : "allowed-once"), { prepend: true });
99
+ return () => {
100
+ releaseAnswerer();
101
+ if (resolveDescriptor === void 0) Reflect.deleteProperty(sandbox, "resolve");
102
+ else Object.defineProperty(sandbox, "resolve", resolveDescriptor);
103
+ if (policyDescriptor === void 0) Reflect.deleteProperty(approval, "overrideOf");
104
+ else Object.defineProperty(approval, "overrideOf", policyDescriptor);
105
+ };
106
+ });
107
+ });
108
+ }
109
+ //#endregion
75
110
  //#region lib/types/profile-boot.js
76
111
  /**
77
112
  * Shared profile boot for every ChatCode CLI surface: resolve the profile, stack its
@@ -91,13 +126,15 @@ const CHATCODE_PROFILE_TEMPLATES = {
91
126
  web: { bundles: [
92
127
  "@deepseek-ai/dsh-base",
93
128
  "@deepseek-ai/dsh-web-app",
94
- "dshmarket"
129
+ "dshmarket",
130
+ "dsh-computer-use"
95
131
  ] },
96
132
  cli: { bundles: [
97
133
  "@deepseek-ai/dsh-base",
98
134
  "@deepseek-harness-tui/dsh-tui",
99
135
  "dsh-llm-chatcode-config",
100
- "dshmarket"
136
+ "dshmarket",
137
+ "dsh-computer-use"
101
138
  ] }
102
139
  };
103
140
  /** Exact compatibility bridge for ChatCode-owned releases qualified against this upstream runtime. */
@@ -111,6 +148,7 @@ const CHATCODE_PACKAGE_ALIASES = {
111
148
  "@chatcode/cco-better-sidebar": "dsh-better-sidebar",
112
149
  "@chatcode/cco-builtin-browser": "dsh-builtin-browser",
113
150
  "@chatcode/cco-chat-import": "dsh-chat-import",
151
+ "@chatcode/cco-computer-use": "dsh-computer-use",
114
152
  "@chatcode/cco-llm-chatcode-config": "dsh-llm-chatcode-config",
115
153
  "@chatcode/cco-market": "dshmarket"
116
154
  };
@@ -200,12 +238,20 @@ function homePatchPath() {
200
238
  }
201
239
  /** Absolute path of this dsh installation's package.json (both anchors: src/ and lib/ sit one level under apps/cli). */
202
240
  const INSTALL_ANCHOR = fileURLToPath(new URL("../package.json", import.meta.url));
203
- /** Return one fork-owned package staged inside the published launcher. */
204
- function embeddedRuntimePackageDir(packageName, installAnchor = INSTALL_ANCHOR) {
241
+ /** Read the installation mode once per embedded-runtime lookup or traversal. */
242
+ function embeddedRuntimeRoot(installAnchor) {
205
243
  if (JSON.parse(readFileSync(installAnchor, "utf8")).dependencies?.["@deepseek-ai/dsh-app-boot"]?.startsWith("workspace:") === true) return void 0;
206
- const packageDir = join(dirname(installAnchor), "runtime", "node_modules", ...packageName.split("/"));
244
+ return join(dirname(installAnchor), "runtime", "node_modules");
245
+ }
246
+ function embeddedPackageDir(packageName, runtimeRoot) {
247
+ const packageDir = join(runtimeRoot, ...packageName.split("/"));
207
248
  return existsSync(join(packageDir, "package.json")) ? packageDir : void 0;
208
249
  }
250
+ /** Return one fork-owned package staged inside the published launcher. */
251
+ function embeddedRuntimePackageDir(packageName, installAnchor = INSTALL_ANCHOR) {
252
+ const runtimeRoot = embeddedRuntimeRoot(installAnchor);
253
+ return runtimeRoot === void 0 ? void 0 : embeddedPackageDir(packageName, runtimeRoot);
254
+ }
209
255
  /** Prefer a staged fork manifest while retaining source-checkout and old-package compatibility. */
210
256
  function installedPackageManifest(packageName, installAnchor) {
211
257
  const embedded = embeddedRuntimePackageDir(packageName, installAnchor);
@@ -214,8 +260,10 @@ function installedPackageManifest(packageName, installAnchor) {
214
260
  }
215
261
  /** Re-anchor shipped bundle patches at their staged fork implementations. */
216
262
  function preferEmbeddedProfileLayers(profile, installAnchor = INSTALL_ANCHOR) {
263
+ const runtimeRoot = embeddedRuntimeRoot(installAnchor);
264
+ if (runtimeRoot === void 0) return profile;
217
265
  const layers = profile.layers.map((layer) => {
218
- const packageDir = embeddedRuntimePackageDir(layer.packageName, installAnchor);
266
+ const packageDir = embeddedPackageDir(layer.packageName, runtimeRoot);
219
267
  if (packageDir === void 0 || packageDir === layer.packageDir) return layer;
220
268
  const declaredPatch = JSON.parse(readFileSync(join(packageDir, "package.json"), "utf8")).dsh?.bundle?.patch;
221
269
  if (declaredPatch === void 0) return layer;
@@ -234,9 +282,11 @@ function preferEmbeddedProfileLayers(profile, installAnchor = INSTALL_ANCHOR) {
234
282
  }
235
283
  /** Point the loader interception table at staged fork packages. */
236
284
  function preferEmbeddedRuntimeResolution(resolution, installAnchor = INSTALL_ANCHOR) {
285
+ const runtimeRoot = embeddedRuntimeRoot(installAnchor);
286
+ if (runtimeRoot === void 0) return resolution;
237
287
  let changed = false;
238
288
  const entries = resolution.entries.map((entry) => {
239
- const packageDir = embeddedRuntimePackageDir(entry.name, installAnchor);
289
+ const packageDir = embeddedPackageDir(entry.name, runtimeRoot);
240
290
  if (packageDir === void 0) return entry;
241
291
  const declarer = join(packageDir, "package.json");
242
292
  if (packageDir === entry.packageDir && entry.declarer === declarer && entry.scope === "installation") return entry;
@@ -258,7 +308,7 @@ function preferEmbeddedRuntimeResolution(resolution, installAnchor = INSTALL_ANC
258
308
  const embeddedEntries = [];
259
309
  for (const name of packageNames) {
260
310
  if (known.has(name)) continue;
261
- const packageDir = embeddedRuntimePackageDir(name, installAnchor);
311
+ const packageDir = embeddedPackageDir(name, runtimeRoot);
262
312
  if (packageDir === void 0) continue;
263
313
  const manifest = JSON.parse(readFileSync(join(packageDir, "package.json"), "utf8"));
264
314
  embeddedEntries.push(Object.freeze({
@@ -350,6 +400,21 @@ function chatCodeProfilePatchFiles(profile, installAnchor = INSTALL_ANCHOR) {
350
400
  return path;
351
401
  });
352
402
  }
403
+ /**
404
+ * Deduplicate overlay files shared by startup, YAML dumps, and schema dumps.
405
+ * @param files - product and command-line overlay paths, in application order.
406
+ * @returns absolute paths in first-occurrence order, preserving relative-resource bases;
407
+ * missing files remain in the result for the patch loader to diagnose.
408
+ */
409
+ function uniqueProfilePatchFiles(files) {
410
+ const unique = /* @__PURE__ */ new Map();
411
+ for (const patchFile of files) {
412
+ const file = resolve(patchFile);
413
+ const identity = existsSync(file) ? realpathSync(file) : file;
414
+ if (!unique.has(identity)) unique.set(identity, file);
415
+ }
416
+ return [...unique.values()];
417
+ }
353
418
  /** Resolve embedded compatibility plugins from the active source or built CLI tree. */
354
419
  function resolveEmbeddedHeadlessCompat(patches) {
355
420
  const extension = extname(fileURLToPath(import.meta.url)) === ".ts" ? ".ts" : ".js";
@@ -428,6 +493,20 @@ function prepareProfile(name, userLayer = true, fromDefaultProfile) {
428
493
  const dir = resolveProfileDir(name, home);
429
494
  const template = Object.hasOwn(CHATCODE_PROFILE_TEMPLATES, name) ? CHATCODE_PROFILE_TEMPLATES[name] : void 0;
430
495
  if (template !== void 0 && !existsSync(join(dir, "package.json"))) initProfile(dir, template.bundles);
496
+ if (name === "web" || name === "cli") {
497
+ const manifest = readProfileManifest(NAME, dir);
498
+ const bundles = manifest.dsh?.profile?.bundles;
499
+ if (bundles?.includes("@deepseek-ai/dsh-base") && !bundles.includes("dsh-computer-use")) writeProfileManifest(dir, {
500
+ ...manifest,
501
+ dsh: {
502
+ ...manifest.dsh,
503
+ profile: {
504
+ ...manifest.dsh?.profile,
505
+ bundles: [...bundles, "dsh-computer-use"]
506
+ }
507
+ }
508
+ });
509
+ }
431
510
  const profile = preferEmbeddedProfileLayers(restoreTrustedTuiLayer(loadProfile(NAME, name, INSTALL_ANCHOR, home, {
432
511
  pluginCommand: "chatcode-cli",
433
512
  trustedVersionExemptions: CHATCODE_TRUSTED_VERSION_EXEMPTIONS,
@@ -458,8 +537,7 @@ async function composeProfile(name, patchFiles, fromDefaultProfile, resolvedProf
458
537
  profile
459
538
  };
460
539
  const resolution = preferEmbeddedRuntimeResolution(await createRuntimeResolution(resolutionOptions), resolutionOptions.installAnchor);
461
- const productPatchFiles = resolvedProfile === void 0 ? chatCodeProfilePatchFiles(name, INSTALL_ANCHOR) : [];
462
- const uniquePatchFiles = [...new Set([...productPatchFiles, ...patchFiles].map((file) => resolve(file)))];
540
+ const uniquePatchFiles = uniqueProfilePatchFiles([...resolvedProfile === void 0 ? chatCodeProfilePatchFiles(name, INSTALL_ANCHOR) : [], ...patchFiles]);
463
541
  const ownCompatPatch = resolve(join(dirname(INSTALL_ANCHOR), "headless-compat.cordis.patch.yml"));
464
542
  return {
465
543
  profile,
@@ -527,16 +605,18 @@ async function runProfile(options) {
527
605
  cwd: process.cwd(),
528
606
  home: resolveChatCodeCliHome(),
529
607
  overlays: composed.overlays,
608
+ transformPatches: resolveChatCodePackageAliases,
530
609
  trustedVersionExemptions: CHATCODE_TRUSTED_VERSION_EXEMPTIONS,
531
610
  telemetryDisabledEnv: process.env.DSH_TELEMETRY_DISABLED
532
611
  };
533
- const patches = resolveChatCodePackageAliases(readProfilePatches(NAME, profileContext, composed.profile));
612
+ const patches = readProfilePatches(NAME, profileContext, composed.profile);
534
613
  const finishActivation = startStartupPhase("plugin-activation");
535
614
  let stopPluginTrace;
536
615
  const ctx = await boot(NAME, rootConfig, patches, async (hostCtx) => {
537
616
  stopPluginTrace = traceStartupPlugins(hostCtx);
538
617
  app.current = hostCtx;
539
618
  installProfileInvocationAccessor(hostCtx);
619
+ if (options.dangerouslySkipPermissions === true) installPermissionBypass(hostCtx);
540
620
  hostCtx.provide("profileContext", profileContext);
541
621
  hostCtx.provide(DSH_LAUNCH_ENVIRONMENT_KEY, options.environment);
542
622
  await hostCtx.plugin(PluginPackages, { resolution: composed.resolution });
@@ -551,6 +631,9 @@ async function runProfile(options) {
551
631
  finishActivation();
552
632
  app.current = ctx;
553
633
  if (!signalShutdown.signal.aborted && ctx.fiber.state === 2 && ctx.get("loader") !== void 0) appReady.commit();
634
+ if (options.webInstance !== void 0 && !signalShutdown.signal.aborted) await registerWebInstance(ctx, options.webInstance, () => {
635
+ shutdown.interrupt(0);
636
+ });
554
637
  return {
555
638
  ctx,
556
639
  shutdown
@@ -565,4 +648,4 @@ async function runProfile(options) {
565
648
  }
566
649
  }
567
650
  //#endregion
568
- export { chatCodeProfilePatchFiles as a, initializeProfileFromDefault as c, preferEmbeddedRuntimeResolution as d, prepareProfile as f, runProfile as h, PROFILE_ROOT_FILENAME as i, installProfileInvocationAccessor as l, restoreTrustedTuiLayer as m, CHATCODE_TRUSTED_VERSION_EXEMPTIONS as n, embeddedRuntimePackageDir as o, resolveChatCodePackageAliases as p, INSTALL_ANCHOR as r, homePatchPath as s, CHATCODE_PROFILE_TEMPLATES as t, preferEmbeddedProfileLayers as u };
651
+ export { chatCodeProfilePatchFiles as a, initializeProfileFromDefault as c, preferEmbeddedRuntimeResolution as d, prepareProfile as f, uniqueProfilePatchFiles as g, runProfile as h, PROFILE_ROOT_FILENAME as i, installProfileInvocationAccessor as l, restoreTrustedTuiLayer as m, CHATCODE_TRUSTED_VERSION_EXEMPTIONS as n, embeddedRuntimePackageDir as o, resolveChatCodePackageAliases as p, INSTALL_ANCHOR as r, homePatchPath as s, CHATCODE_PROFILE_TEMPLATES as t, preferEmbeddedProfileLayers as u };
@@ -1,2 +1,2 @@
1
- import { a as chatCodeProfilePatchFiles, c as initializeProfileFromDefault, d as preferEmbeddedRuntimeResolution, f as prepareProfile, h as runProfile, i as PROFILE_ROOT_FILENAME, l as installProfileInvocationAccessor, m as restoreTrustedTuiLayer, n as CHATCODE_TRUSTED_VERSION_EXEMPTIONS, o as embeddedRuntimePackageDir, p as resolveChatCodePackageAliases, r as INSTALL_ANCHOR, s as homePatchPath, t as CHATCODE_PROFILE_TEMPLATES, u as preferEmbeddedProfileLayers } from "./profile-boot-SJGbpLgN.js";
2
- export { CHATCODE_PROFILE_TEMPLATES, CHATCODE_TRUSTED_VERSION_EXEMPTIONS, INSTALL_ANCHOR, PROFILE_ROOT_FILENAME, chatCodeProfilePatchFiles, embeddedRuntimePackageDir, homePatchPath, initializeProfileFromDefault, installProfileInvocationAccessor, preferEmbeddedProfileLayers, preferEmbeddedRuntimeResolution, prepareProfile, resolveChatCodePackageAliases, restoreTrustedTuiLayer, runProfile };
1
+ import { a as chatCodeProfilePatchFiles, c as initializeProfileFromDefault, d as preferEmbeddedRuntimeResolution, f as prepareProfile, g as uniqueProfilePatchFiles, h as runProfile, i as PROFILE_ROOT_FILENAME, l as installProfileInvocationAccessor, m as restoreTrustedTuiLayer, n as CHATCODE_TRUSTED_VERSION_EXEMPTIONS, o as embeddedRuntimePackageDir, p as resolveChatCodePackageAliases, r as INSTALL_ANCHOR, s as homePatchPath, t as CHATCODE_PROFILE_TEMPLATES, u as preferEmbeddedProfileLayers } from "./profile-boot-BNQry1NM.js";
2
+ export { CHATCODE_PROFILE_TEMPLATES, CHATCODE_TRUSTED_VERSION_EXEMPTIONS, INSTALL_ANCHOR, PROFILE_ROOT_FILENAME, chatCodeProfilePatchFiles, embeddedRuntimePackageDir, homePatchPath, initializeProfileFromDefault, installProfileInvocationAccessor, preferEmbeddedProfileLayers, preferEmbeddedRuntimeResolution, prepareProfile, resolveChatCodePackageAliases, restoreTrustedTuiLayer, runProfile, uniqueProfilePatchFiles };
@@ -1,7 +1,7 @@
1
- import { a as compositionRoot, i as bindCallerEffect, n as activationFiber, o as concreteService, s as requirePluginCaller } from "./host-access-DeCjoRQP.js";
2
- import { n as componentIdentityOf } from "./component-identity-DPdJglJO.js";
1
+ import { a as compositionRoot, i as bindCallerEffect, n as activationFiber, o as concreteService, s as requirePluginCaller } from "./host-access-Bk4xps5E.js";
2
+ import { n as componentIdentityOf } from "./component-identity-De91VHwW.js";
3
3
  import { Service } from "@deepseek-ai/cordis";
4
- //#region ../../node_modules/.pnpm/@chatcode+cco-tui@0.10.0-rc.16_08ea48c8555976e562c6368d51cb542b/node_modules/@chatcode/cco-tui/lib/types/dsh-adapter/scenes.js
4
+ //#region ../../../dsh-TUI/lib/types/dsh-adapter/scenes.js
5
5
  /** Provider-neutral full-screen scene registry for terminal front doors. */
6
6
  const name = "dsh-tui-scenes";
7
7
  /**
@@ -1,6 +1,6 @@
1
- import { a as compositionRoot, i as bindCallerEffect, n as activationFiber, o as concreteService, s as requirePluginCaller } from "./host-access-DeCjoRQP.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 { Service } from "@deepseek-ai/cordis";
3
- //#region ../../node_modules/.pnpm/@chatcode+cco-tui@0.10.0-rc.16_08ea48c8555976e562c6368d51cb542b/node_modules/@chatcode/cco-tui/lib/types/dsh-adapter/credentialRefGuard.js
3
+ //#region ../../../dsh-TUI/lib/types/dsh-adapter/credentialRefGuard.js
4
4
  /**
5
5
  * Credential-ref reservation guard for the plugin settings-section seam.
6
6
  *
@@ -49,7 +49,7 @@ function vetSectionSecretRefs(section) {
49
49
  };
50
50
  }
51
51
  //#endregion
52
- //#region ../../node_modules/.pnpm/@chatcode+cco-tui@0.10.0-rc.16_08ea48c8555976e562c6368d51cb542b/node_modules/@chatcode/cco-tui/lib/types/dsh-adapter/settings-sections.js
52
+ //#region ../../../dsh-TUI/lib/types/dsh-adapter/settings-sections.js
53
53
  /**
54
54
  * Plugin settings-section extension seam for terminal front doors.
55
55
  *
@@ -157,6 +157,10 @@ function registerSection(runtime, section, owner) {
157
157
  path: Object.freeze([...field.path]),
158
158
  descriptions: field.descriptions === void 0 ? void 0 : Object.freeze({ ...field.descriptions }),
159
159
  hintDescriptions: field.hintDescriptions === void 0 ? void 0 : Object.freeze({ ...field.hintDescriptions }),
160
+ confirmEnable: field.confirmEnable === void 0 ? void 0 : Object.freeze({
161
+ ...field.confirmEnable,
162
+ descriptions: field.confirmEnable.descriptions === void 0 ? void 0 : Object.freeze({ ...field.confirmEnable.descriptions })
163
+ }),
160
164
  options: field.options === void 0 ? void 0 : Object.freeze(field.options.map((option) => Object.freeze({
161
165
  ...option,
162
166
  descriptions: option.descriptions === void 0 ? void 0 : Object.freeze({ ...option.descriptions })
@@ -0,0 +1,382 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ //#region ../../../dsh-TUI/lib/types/dsh-adapter/settingsCompat.js
3
+ /** Mark display fields editable on hosts that support volatile Config references. */
4
+ function withLiveSettings(schema, fields) {
5
+ for (const key of fields) {
6
+ const field = schema.dict?.[String(key)];
7
+ if (field === void 0) continue;
8
+ if (field.volatile) schema.dict[String(key)] = field.volatile();
9
+ else Object.assign(field.meta, { volatile: true });
10
+ }
11
+ return schema;
12
+ }
13
+ /** Keep plain Config consumers reading the latest snapshots without exposing references. */
14
+ function liveConfigValues(config) {
15
+ return new Proxy(config, { get(target, key, receiver) {
16
+ const value = Reflect.get(target, key, receiver);
17
+ if (value && typeof value === "object" && Symbol.for("cosmokit.volatile.write") in value && "get" in value && typeof value.get === "function") return value.get();
18
+ return value;
19
+ } });
20
+ }
21
+ /** Observe display settings without remounting the TUI or creating another session. */
22
+ function displaySettingsScope(owner, settingsCtx, ns, schema, config) {
23
+ const settings = settingsCtx.settings;
24
+ if (typeof settings.register === "function") {
25
+ const scope = settings.register(ns, schema);
26
+ return {
27
+ get: () => scope.get(),
28
+ watch: (listener) => scope.watch(listener),
29
+ legacy: true
30
+ };
31
+ }
32
+ const get = () => Object.fromEntries(Object.keys(schema.dict ?? {}).map((key) => [key, Reflect.get(config, key)]));
33
+ const events = owner;
34
+ return {
35
+ get,
36
+ watch: (listener) => events.on("loader/volatile-update", () => listener(get())),
37
+ legacy: false
38
+ };
39
+ }
40
+ /** Read effective values on new hosts; retain support for older descriptor implementations. */
41
+ function settingsValue(settings, ns) {
42
+ const descriptor = settings.describe().find((row) => row.ns === ns);
43
+ return descriptor && "value" in descriptor ? descriptor.value : settings.get?.(ns);
44
+ }
45
+ //#endregion
46
+ //#region ../../../dsh-TUI/lib/types/tuiDisplayPrefs.js
47
+ /** Default footer shows account-wide tokens today and current context usage. */
48
+ const DEFAULT_STATUS_BAR = Object.freeze({
49
+ compact: true,
50
+ tokenDashboard: true,
51
+ model: false,
52
+ thinking: false,
53
+ cwd: false,
54
+ contextUsage: true,
55
+ cache: false,
56
+ tokens: false,
57
+ tps: false,
58
+ gitBranch: false,
59
+ sessionTitle: false,
60
+ sessionId: false,
61
+ goal: false,
62
+ mode: false,
63
+ contextBar: false,
64
+ activity: false,
65
+ trajectory: false,
66
+ shortcutHint: false
67
+ });
68
+ const TOOL_BACKGROUNDS = new Set([
69
+ "none",
70
+ "subtle",
71
+ "strong"
72
+ ]);
73
+ const SCROLL_GUTTERS = new Set([
74
+ "timeline",
75
+ "scrollbar",
76
+ "hidden"
77
+ ]);
78
+ const STATUS_BAR_KEYS = Object.keys(DEFAULT_STATUS_BAR);
79
+ /** Normalize untrusted/config-layer values without mutating the input. */
80
+ function normalizeToolBackground(value) {
81
+ return typeof value === "string" && TOOL_BACKGROUNDS.has(value) ? value : "none";
82
+ }
83
+ /** Same normalize contract as toolBackground; `timeline` is the default. */
84
+ function normalizeScrollGutter(value) {
85
+ return typeof value === "string" && SCROLL_GUTTERS.has(value) ? value : "timeline";
86
+ }
87
+ /** Merge a partial settings value over the stable status-bar defaults. */
88
+ function normalizeStatusBar(value) {
89
+ const normalized = { ...DEFAULT_STATUS_BAR };
90
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return normalized;
91
+ const input = value;
92
+ for (const key of STATUS_BAR_KEYS) if (typeof input[key] === "boolean") normalized[key] = input[key];
93
+ return normalized;
94
+ }
95
+ function formatTokenCount(value) {
96
+ const rounded = Math.max(0, Math.round(value));
97
+ if (rounded < 1e3) return String(rounded);
98
+ if (rounded < 1e6) return `${(rounded / 1e3).toFixed(rounded < 1e4 ? 1 : 0)}k`;
99
+ return `${(rounded / 1e6).toFixed(rounded < 1e7 ? 1 : 0)}m`;
100
+ }
101
+ /**
102
+ * Format context-window usage for future status-line consumers.
103
+ * Invalid or unavailable inputs intentionally produce no field.
104
+ */
105
+ function formatContextUsage(used, contextWindow, compact = true) {
106
+ if (!Number.isFinite(used) || !Number.isFinite(contextWindow) || used === void 0 || contextWindow === void 0 || contextWindow <= 0) return;
107
+ const safeUsed = Math.max(0, used);
108
+ const percent = Math.min(999, safeUsed / contextWindow * 100);
109
+ const percentText = `${percent < 10 ? percent.toFixed(1) : Math.round(percent)}%`;
110
+ const counts = `${formatTokenCount(safeUsed)}/${formatTokenCount(contextWindow)}`;
111
+ return compact ? `${percentText} (${counts})` : `${counts} (${percentText})`;
112
+ }
113
+ /** Page inset per preset: `{ x }` = blank columns per side, `{ y }` = blank
114
+ * rows top/bottom. `normal` is the default and matches the original
115
+ * hard-coded inset (2 columns / 1 row). */
116
+ const PAGE_MARGIN_PRESETS = Object.freeze({
117
+ none: {
118
+ x: 0,
119
+ y: 0
120
+ },
121
+ slim: {
122
+ x: 1,
123
+ y: 1
124
+ },
125
+ normal: {
126
+ x: 2,
127
+ y: 1
128
+ },
129
+ roomy: {
130
+ x: 4,
131
+ y: 2
132
+ }
133
+ });
134
+ const DEFAULT_PAGE_MARGIN = "normal";
135
+ const PAGE_MARGIN_MODES = new Set([
136
+ "none",
137
+ "slim",
138
+ "normal",
139
+ "roomy"
140
+ ]);
141
+ const PAGE_MARGIN_SPEC_RE = /^(\d{1,2})(?:[x×,,](\d{1,2}))?$/u;
142
+ function isPageMarginMode(value) {
143
+ return PAGE_MARGIN_MODES.has(value);
144
+ }
145
+ /** Parse a custom spec (canonicalizes `N` → `Nx1`); undefined when invalid
146
+ * or out of bounds. */
147
+ function parsePageMarginSpec(text) {
148
+ const match = PAGE_MARGIN_SPEC_RE.exec(text.trim().toLowerCase());
149
+ if (match === null) return void 0;
150
+ const x = Number.parseInt(match[1], 10);
151
+ const y = match[2] === void 0 ? 1 : Number.parseInt(match[2], 10);
152
+ if (x > 8 || y > 4) return void 0;
153
+ return `${x}x${y}`;
154
+ }
155
+ /** Normalize untrusted/config-layer values without mutating the input:
156
+ * preset names and valid custom specs pass through, everything else falls
157
+ * back to the default preset. */
158
+ function normalizePageMargin(value) {
159
+ if (typeof value === "string") {
160
+ if (isPageMarginMode(value)) return value;
161
+ const spec = parsePageMarginSpec(value);
162
+ if (spec !== void 0) return spec;
163
+ }
164
+ return DEFAULT_PAGE_MARGIN;
165
+ }
166
+ /** Resolve a stored setting to its geometry (presets via the table, custom
167
+ * specs via their numbers; anything unparseable → the default preset). */
168
+ function resolvePageMargin(setting) {
169
+ if (isPageMarginMode(setting)) return PAGE_MARGIN_PRESETS[setting];
170
+ const spec = parsePageMarginSpec(setting);
171
+ if (spec !== void 0) {
172
+ const [x, y] = spec.split("x");
173
+ return {
174
+ x: Number.parseInt(x, 10),
175
+ y: Number.parseInt(y, 10)
176
+ };
177
+ }
178
+ return PAGE_MARGIN_PRESETS[DEFAULT_PAGE_MARGIN];
179
+ }
180
+ const pageMarginListeners = /* @__PURE__ */ new Set();
181
+ let pageMarginState = DEFAULT_PAGE_MARGIN;
182
+ /** Subscribe to page-margin setting changes; returns the unsubscribe fn. */
183
+ function subscribePageMargin(listener) {
184
+ pageMarginListeners.add(listener);
185
+ return () => {
186
+ pageMarginListeners.delete(listener);
187
+ };
188
+ }
189
+ /** Current applied setting (normalized; safe for useSyncExternalStore —
190
+ * a primitive string identity is stable). */
191
+ function getPageMarginSetting() {
192
+ return normalizePageMargin(pageMarginState);
193
+ }
194
+ /** Apply a new setting (normalized, no-op when unchanged). Returns the
195
+ * value that ended up applied — useful for the plugin to mirror the
196
+ * channel. */
197
+ function applyPageMargin(setting) {
198
+ const next = normalizePageMargin(setting);
199
+ if (next !== pageMarginState) {
200
+ pageMarginState = next;
201
+ for (const listener of [...pageMarginListeners]) listener();
202
+ }
203
+ return next;
204
+ }
205
+ //#endregion
206
+ //#region ../../../dsh-TUI/lib/types/dsh-adapter/statusBarSettings.js
207
+ /** Shared status-footer settings declarations and validation. */
208
+ /**
209
+ * Build the complete footer schema for both composition and live settings.
210
+ * @returns A schema retaining every supported status field.
211
+ */
212
+ function createStatusBarSchema() {
213
+ const fields = Object.fromEntries(Object.entries(DEFAULT_STATUS_BAR).map(([key, value]) => [key, z.boolean().default(value)]));
214
+ return z.object(fields).default({ ...DEFAULT_STATUS_BAR });
215
+ }
216
+ /** Fields shown by the status-bar settings group. */
217
+ const STATUS_BAR_FIELDS = [
218
+ {
219
+ path: ["statusBar", "tokenDashboard"],
220
+ label: "Show daily token dashboard",
221
+ descriptions: { zh: "显示今日 Token 看板" },
222
+ hint: "Show account-wide tokens used today. Context occupancy follows Show context usage.",
223
+ hintDescriptions: { zh: "显示平台账号今日总 Token 消耗;上下文占用由“显示上下文用量”控制。" },
224
+ group: "status-bar",
225
+ kind: "boolean"
226
+ },
227
+ {
228
+ path: ["statusBar", "compact"],
229
+ label: "Compact status bar",
230
+ descriptions: { zh: "紧凑状态栏" },
231
+ hint: "Prefer the compact status presentation when terminal space allows.",
232
+ hintDescriptions: { zh: "终端空间允许时优先使用紧凑状态栏布局。" },
233
+ group: "status-bar",
234
+ kind: "boolean"
235
+ },
236
+ {
237
+ path: ["statusBar", "model"],
238
+ label: "Show model",
239
+ descriptions: { zh: "显示模型" },
240
+ hint: "Show the current model name in the status bar.",
241
+ hintDescriptions: { zh: "在状态栏显示当前模型名称。" },
242
+ group: "status-bar",
243
+ kind: "boolean"
244
+ },
245
+ {
246
+ path: ["statusBar", "thinking"],
247
+ label: "Show thinking",
248
+ descriptions: { zh: "显示思考" },
249
+ hint: "Show the live reasoning effort or thinking mode.",
250
+ hintDescriptions: { zh: "显示当前推理强度或思考模式。" },
251
+ group: "status-bar",
252
+ kind: "boolean"
253
+ },
254
+ {
255
+ path: ["statusBar", "cwd"],
256
+ label: "Show working directory",
257
+ descriptions: { zh: "显示工作目录" },
258
+ hint: "Show the session working directory.",
259
+ hintDescriptions: { zh: "显示当前会话的工作目录。" },
260
+ group: "status-bar",
261
+ kind: "boolean"
262
+ },
263
+ {
264
+ path: ["statusBar", "contextUsage"],
265
+ label: "Show context usage",
266
+ descriptions: { zh: "显示上下文用量" },
267
+ hint: "Show current context-window consumption in the dashboard, or the status line when the dashboard is hidden.",
268
+ hintDescriptions: { zh: "显示当前上下文窗口占用;今日看板开启时显示在看板内,关闭时显示在状态行。" },
269
+ group: "status-bar",
270
+ kind: "boolean"
271
+ },
272
+ {
273
+ path: ["statusBar", "cache"],
274
+ label: "Show cache",
275
+ descriptions: { zh: "显示缓存" },
276
+ hint: "Show prompt-cache hit information.",
277
+ hintDescriptions: { zh: "显示提示词缓存命中信息。" },
278
+ group: "status-bar",
279
+ kind: "boolean"
280
+ },
281
+ {
282
+ path: ["statusBar", "tokens"],
283
+ label: "Show token totals",
284
+ descriptions: { zh: "显示 Token 总量" },
285
+ hint: "Show running input and output token totals.",
286
+ hintDescriptions: { zh: "显示累计输入与输出 Token。" },
287
+ group: "status-bar",
288
+ kind: "boolean"
289
+ },
290
+ {
291
+ path: ["statusBar", "tps"],
292
+ label: "Show output speed",
293
+ descriptions: { zh: "显示输出速度" },
294
+ hint: "Show live and recent tokens-per-second metrics.",
295
+ hintDescriptions: { zh: "显示实时及近期每秒 Token 指标。" },
296
+ group: "status-bar",
297
+ kind: "boolean"
298
+ },
299
+ {
300
+ path: ["statusBar", "gitBranch"],
301
+ label: "Show git branch",
302
+ descriptions: { zh: "显示 Git 分支" },
303
+ hint: "Show the current git branch when available.",
304
+ hintDescriptions: { zh: "可用时显示当前 Git 分支。" },
305
+ group: "status-bar",
306
+ kind: "boolean"
307
+ },
308
+ {
309
+ path: ["statusBar", "sessionTitle"],
310
+ label: "Show session title",
311
+ descriptions: { zh: "显示会话标题" },
312
+ hint: "Show the current session title.",
313
+ hintDescriptions: { zh: "显示当前会话标题。" },
314
+ group: "status-bar",
315
+ kind: "boolean"
316
+ },
317
+ {
318
+ path: ["statusBar", "sessionId"],
319
+ label: "Show session id",
320
+ descriptions: { zh: "显示会话 ID" },
321
+ hint: "Show the short session id (# + first 8 chars) — it matches the session log filename for --resume.",
322
+ hintDescriptions: { zh: "显示短会话 ID(# + 前 8 位)——与日志文件名对应,方便 --resume 定位。" },
323
+ group: "status-bar",
324
+ kind: "boolean"
325
+ },
326
+ {
327
+ path: ["statusBar", "goal"],
328
+ label: "Show goal status",
329
+ descriptions: { zh: "显示 Goal 状态" },
330
+ hint: "Show a compact goal chip (phase glyph + rounds) in the status footer while a goal exists.",
331
+ hintDescriptions: { zh: "存在 Goal 时,在底部状态栏显示紧凑的 Goal 状态(阶段符号与轮次)。" },
332
+ group: "status-bar",
333
+ kind: "boolean"
334
+ },
335
+ {
336
+ path: ["statusBar", "mode"],
337
+ label: "Show session mode",
338
+ descriptions: { zh: "显示会话模式" },
339
+ hint: "Show the active non-default session mode.",
340
+ hintDescriptions: { zh: "显示当前启用的非默认会话模式。" },
341
+ group: "status-bar",
342
+ kind: "boolean"
343
+ },
344
+ {
345
+ path: ["statusBar", "contextBar"],
346
+ label: "Show context progress bar",
347
+ descriptions: { zh: "显示上下文进度条" },
348
+ hint: "Show the segmented context progress bar on its own footer row.",
349
+ hintDescriptions: { zh: "在底部单独一行显示分段上下文进度条。" },
350
+ group: "status-bar",
351
+ kind: "boolean"
352
+ },
353
+ {
354
+ path: ["statusBar", "activity"],
355
+ label: "Show activity summary",
356
+ descriptions: { zh: "显示活动摘要" },
357
+ hint: "Show the idle working-activity summary.",
358
+ hintDescriptions: { zh: "显示空闲时的工作活动摘要。" },
359
+ group: "status-bar",
360
+ kind: "boolean"
361
+ },
362
+ {
363
+ path: ["statusBar", "trajectory"],
364
+ label: "Show trajectory strip",
365
+ descriptions: { zh: "显示轨迹条" },
366
+ hint: "Show the animated mini trajectory strip at the footer edge.",
367
+ hintDescriptions: { zh: "在状态栏边缘显示动态迷你轨迹条。" },
368
+ group: "status-bar",
369
+ kind: "boolean"
370
+ },
371
+ {
372
+ path: ["statusBar", "shortcutHint"],
373
+ label: "Show shortcut reminder",
374
+ descriptions: { zh: "显示快捷键提示" },
375
+ hint: "Control only the idle `? for shortcuts` reminder; pressing ? and the Esc shortcut hints are unaffected.",
376
+ hintDescriptions: { zh: "仅控制空闲时的 `? for shortcuts` 提示;按 ? 打开快捷键以及 Esc 快捷提示均不受影响。" },
377
+ group: "status-bar",
378
+ kind: "boolean"
379
+ }
380
+ ];
381
+ //#endregion
382
+ export { settingsValue as _, formatContextUsage as a, normalizePageMargin as c, normalizeToolBackground as d, parsePageMarginSpec as f, liveConfigValues as g, displaySettingsScope as h, applyPageMargin as i, normalizeScrollGutter as l, subscribePageMargin as m, createStatusBarSchema as n, getPageMarginSetting as o, resolvePageMargin as p, DEFAULT_PAGE_MARGIN as r, isPageMarginMode as s, STATUS_BAR_FIELDS as t, normalizeStatusBar as u, withLiveSettings as v };