@waq666/pneuma 0.7.1 → 0.8.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 (416) hide show
  1. package/README.md +242 -206
  2. package/bin/dsc.js +9 -3
  3. package/bin/headless.cjs +1 -1
  4. package/lib/adapter/transcript.d.ts +19 -2
  5. package/lib/adapter/transcript.js +71 -14
  6. package/lib/app/AgentsOverlay.js +7 -6
  7. package/lib/app/App.js +1 -1
  8. package/lib/app/ApprovalCard.js +15 -9
  9. package/lib/app/ChatView.d.ts +3 -1
  10. package/lib/app/ChatView.js +21 -17
  11. package/lib/app/Composer.js +22 -4
  12. package/lib/app/MarkdownView.js +2 -1
  13. package/lib/app/ModelPicker.js +7 -6
  14. package/lib/app/PickerFrame.d.ts +4 -0
  15. package/lib/app/PickerFrame.js +18 -0
  16. package/lib/app/PlanReviewCard.js +2 -1
  17. package/lib/app/PresetPicker.js +8 -7
  18. package/lib/app/SessionPicker.js +21 -20
  19. package/lib/app/SettingsOverlay.js +1 -1
  20. package/lib/app/SkillsPicker.js +7 -6
  21. package/lib/app/StatusBar.js +3 -15
  22. package/lib/app/TaskStrips.js +1 -4
  23. package/lib/app/TimelineRail.js +2 -1
  24. package/lib/app/ToolCard.js +2 -6
  25. package/lib/app/Welcome.d.ts +1 -0
  26. package/lib/app/Welcome.js +1 -4
  27. package/lib/app/click.d.ts +0 -2
  28. package/lib/app/click.js +2 -21
  29. package/lib/app/display-width.d.ts +16 -0
  30. package/lib/app/display-width.js +33 -0
  31. package/lib/app/markdown.d.ts +1 -3
  32. package/lib/app/markdown.js +2 -19
  33. package/lib/app/scroll-model.js +1 -1
  34. package/lib/contract/approval.d.ts +91 -0
  35. package/lib/contract/approval.js +1 -0
  36. package/lib/contract/mode.d.ts +69 -0
  37. package/lib/contract/mode.js +1 -0
  38. package/lib/contract/plugin.d.ts +240 -0
  39. package/lib/contract/plugin.js +1 -0
  40. package/lib/contract/runtime.d.ts +282 -0
  41. package/lib/contract/runtime.js +1 -0
  42. package/lib/contract/session.d.ts +208 -0
  43. package/lib/contract/session.js +36 -0
  44. package/lib/contract/settings.d.ts +242 -0
  45. package/lib/contract/settings.js +1 -0
  46. package/lib/contract/snapshot.d.ts +453 -0
  47. package/lib/contract/snapshot.js +1 -0
  48. package/lib/contract/task.d.ts +189 -0
  49. package/lib/contract/task.js +10 -0
  50. package/lib/contract/transcript.d.ts +358 -0
  51. package/lib/contract/transcript.js +1 -0
  52. package/lib/contract/usage.d.ts +132 -0
  53. package/lib/contract/usage.js +10 -0
  54. package/lib/contract.d.ts +20 -1968
  55. package/lib/contract.js +19 -30
  56. package/lib/core/agent-roles.d.ts +1 -1
  57. package/lib/core/agent-roles.js +6 -5
  58. package/lib/core/approval-floor.d.ts +9 -0
  59. package/lib/core/approval-floor.js +152 -25
  60. package/lib/core/attachments.d.ts +185 -0
  61. package/lib/core/attachments.js +425 -0
  62. package/lib/core/bytes.d.ts +14 -0
  63. package/lib/core/bytes.js +28 -0
  64. package/lib/core/call-meaning.d.ts +20 -0
  65. package/lib/core/call-meaning.js +347 -0
  66. package/lib/core/cdp/actions.js +6 -0
  67. package/lib/core/cdp/launch.js +2 -2
  68. package/lib/core/cdp/report.d.ts +27 -0
  69. package/lib/core/cdp/report.js +50 -0
  70. package/lib/core/cdp/ring-buffer.d.ts +25 -0
  71. package/lib/core/cdp/ring-buffer.js +44 -0
  72. package/lib/core/cdp/snapshot.js +5 -9
  73. package/lib/core/cdp/transport.js +1 -1
  74. package/lib/core/clamp.d.ts +20 -0
  75. package/lib/core/clamp.js +24 -0
  76. package/lib/core/clock.d.ts +16 -0
  77. package/lib/core/clock.js +20 -0
  78. package/lib/core/command-policy.js +33 -1
  79. package/lib/core/commands-completion.d.ts +28 -0
  80. package/lib/core/commands-completion.js +108 -30
  81. package/lib/core/compact.d.ts +36 -6
  82. package/lib/core/compact.js +89 -17
  83. package/lib/core/desktop-control.js +1 -3
  84. package/lib/core/dsh-compat/llm-usage-event.d.ts +78 -0
  85. package/lib/core/dsh-compat/llm-usage-event.js +91 -0
  86. package/lib/core/dsh-compat/presentation.d.ts +84 -0
  87. package/lib/core/dsh-compat/presentation.js +105 -0
  88. package/lib/core/dsh-compat/resolve-hook.d.ts +3 -3
  89. package/lib/core/dsh-compat/resolve-hook.js +41 -13
  90. package/lib/core/dsh-compat/service-map.d.ts +52 -0
  91. package/lib/core/dsh-compat/service-map.js +87 -0
  92. package/lib/core/dsh-compat/session-bridge.d.ts +107 -0
  93. package/lib/core/dsh-compat/session-bridge.js +376 -0
  94. package/lib/core/dsh-compat/session-events.d.ts +54 -0
  95. package/lib/core/dsh-compat/session-events.js +297 -0
  96. package/lib/core/dsh-compat/shims/credentials.d.ts +62 -0
  97. package/lib/core/dsh-compat/shims/credentials.js +86 -0
  98. package/lib/core/dsh-compat/shims/home-paths.d.ts +77 -0
  99. package/lib/core/dsh-compat/shims/home-paths.js +143 -0
  100. package/lib/core/dsh-compat/tools-facade.d.ts +31 -1
  101. package/lib/core/dsh-compat/tools-facade.js +207 -3
  102. package/lib/core/err-text.d.ts +5 -0
  103. package/lib/core/err-text.js +5 -0
  104. package/lib/core/events.d.ts +31 -2
  105. package/lib/core/git-info.d.ts +127 -15
  106. package/lib/core/git-info.js +315 -34
  107. package/lib/core/git-surface.d.ts +17 -0
  108. package/lib/core/git-surface.js +7 -0
  109. package/lib/core/hooks.d.ts +19 -2
  110. package/lib/core/hooks.js +57 -13
  111. package/lib/core/host-methods.d.ts +1 -1
  112. package/lib/core/host-methods.js +4 -0
  113. package/lib/core/image-diet.js +1 -4
  114. package/lib/core/json-text.d.ts +11 -0
  115. package/lib/core/json-text.js +18 -0
  116. package/lib/core/learnings/skill-write.d.ts +1 -7
  117. package/lib/core/learnings/skill-write.js +3 -37
  118. package/lib/core/lifecycle-hooks.d.ts +11 -3
  119. package/lib/core/lifecycle-hooks.js +33 -42
  120. package/lib/core/llm.d.ts +42 -0
  121. package/lib/core/llm.js +40 -25
  122. package/lib/core/loop.d.ts +11 -1
  123. package/lib/core/loop.js +95 -28
  124. package/lib/core/lsp/client.js +30 -17
  125. package/lib/core/lsp/normalize.d.ts +0 -2
  126. package/lib/core/lsp/normalize.js +1 -6
  127. package/lib/core/lsp/servers.js +1 -4
  128. package/lib/core/mcp.d.ts +18 -0
  129. package/lib/core/mcp.js +60 -16
  130. package/lib/core/microcompact.d.ts +45 -0
  131. package/lib/core/microcompact.js +128 -0
  132. package/lib/core/native-bridge.js +2 -10
  133. package/lib/core/path-policy.d.ts +13 -1
  134. package/lib/core/path-policy.js +87 -18
  135. package/lib/core/permission-presets.d.ts +9 -5
  136. package/lib/core/permission-presets.js +14 -7
  137. package/lib/core/permission-scope.d.ts +65 -0
  138. package/lib/core/permission-scope.js +109 -0
  139. package/lib/core/plugin-bundle.d.ts +95 -0
  140. package/lib/core/plugin-bundle.js +137 -0
  141. package/lib/core/plugin-loader.d.ts +36 -1
  142. package/lib/core/plugin-loader.js +336 -12
  143. package/lib/core/plugin-patch.d.ts +64 -0
  144. package/lib/core/plugin-patch.js +146 -0
  145. package/lib/core/plugin-registry.d.ts +14 -0
  146. package/lib/core/plugin-registry.js +2 -0
  147. package/lib/core/prefs.js +40 -2
  148. package/lib/core/presets.d.ts +11 -0
  149. package/lib/core/presets.js +61 -22
  150. package/lib/core/profile-dir.d.ts +5 -0
  151. package/lib/core/profile-dir.js +40 -0
  152. package/lib/core/prompt.js +55 -19
  153. package/lib/core/ptc.d.ts +8 -2
  154. package/lib/core/ptc.js +18 -4
  155. package/lib/core/records.d.ts +16 -0
  156. package/lib/core/records.js +22 -0
  157. package/lib/core/remote/notify.js +1 -3
  158. package/lib/core/remote/push.js +2 -6
  159. package/lib/core/sandbox/execpolicy.js +27 -3
  160. package/lib/core/sandbox/net-proxy.js +2 -2
  161. package/lib/core/sandbox/policy.d.ts +1 -1
  162. package/lib/core/sandbox/policy.js +21 -15
  163. package/lib/core/sandbox/win/account.js +1 -4
  164. package/lib/core/sandbox/win/acl.js +1 -6
  165. package/lib/core/sandbox/win/backend.d.ts +24 -3
  166. package/lib/core/sandbox/win/backend.js +73 -23
  167. package/lib/core/sandbox/win/doctor.js +1 -4
  168. package/lib/core/sandbox/win/runner-entry.js +1 -6
  169. package/lib/core/sandbox/win/setup.js +1 -4
  170. package/lib/core/sandbox/win/utf16.d.ts +11 -0
  171. package/lib/core/sandbox/win/utf16.js +15 -0
  172. package/lib/core/sandbox/win/wfp.js +1 -4
  173. package/lib/core/schedule/rule.d.ts +0 -17
  174. package/lib/core/schedule/rule.js +1 -3
  175. package/lib/core/schedule/runner.d.ts +5 -2
  176. package/lib/core/schedule/runner.js +32 -9
  177. package/lib/core/schedule/store.d.ts +0 -2
  178. package/lib/core/schedule/store.js +2 -9
  179. package/lib/core/session-index.d.ts +50 -0
  180. package/lib/core/session-index.js +169 -3
  181. package/lib/core/session.d.ts +89 -13
  182. package/lib/core/session.js +385 -32
  183. package/lib/core/shell-quote.d.ts +21 -0
  184. package/lib/core/shell-quote.js +24 -0
  185. package/lib/core/side-ask.d.ts +52 -0
  186. package/lib/core/side-ask.js +89 -0
  187. package/lib/core/skills.d.ts +16 -0
  188. package/lib/core/skills.js +45 -8
  189. package/lib/core/snapshot-throttle.d.ts +8 -0
  190. package/lib/core/snapshot-throttle.js +24 -0
  191. package/lib/core/spill.d.ts +11 -5
  192. package/lib/core/spill.js +35 -36
  193. package/lib/core/strings.d.ts +21 -0
  194. package/lib/core/strings.js +33 -0
  195. package/lib/core/terminal-env.d.ts +61 -0
  196. package/lib/core/terminal-env.js +327 -0
  197. package/lib/core/text-format.d.ts +17 -0
  198. package/lib/core/text-format.js +26 -0
  199. package/lib/core/todo-reminder.d.ts +19 -14
  200. package/lib/core/todo-reminder.js +14 -23
  201. package/lib/core/token-estimate.d.ts +18 -2
  202. package/lib/core/token-estimate.js +10 -2
  203. package/lib/core/tool-result-prune.d.ts +42 -0
  204. package/lib/core/tool-result-prune.js +47 -0
  205. package/lib/core/tool-search.d.ts +3 -2
  206. package/lib/core/tool-search.js +3 -2
  207. package/lib/core/tools/bash.d.ts +35 -3
  208. package/lib/core/tools/bash.js +168 -41
  209. package/lib/core/tools/fs-tools.js +18 -17
  210. package/lib/core/tools/image-tool.d.ts +2 -0
  211. package/lib/core/tools/image-tool.js +59 -0
  212. package/lib/core/tools/path-args.d.ts +4 -0
  213. package/lib/core/tools/path-args.js +22 -0
  214. package/lib/core/tools/search-tools.d.ts +30 -0
  215. package/lib/core/tools/search-tools.js +321 -34
  216. package/lib/core/tools.d.ts +82 -0
  217. package/lib/core/tools.js +21 -0
  218. package/lib/core/transcript-text.d.ts +19 -0
  219. package/lib/core/transcript-text.js +44 -0
  220. package/lib/core/ui-boot-source.d.ts +5 -0
  221. package/lib/core/ui-boot-source.js +10 -3
  222. package/lib/core/ui-bundles.d.ts +80 -6
  223. package/lib/core/ui-bundles.js +700 -76
  224. package/lib/core/ui-events.d.ts +10 -0
  225. package/lib/core/ui-events.js +25 -0
  226. package/lib/core/ui-methods.d.ts +1 -1
  227. package/lib/core/ui-methods.js +42 -13
  228. package/lib/core/ui-route.js +11 -7
  229. package/lib/core/ui-server.d.ts +6 -0
  230. package/lib/core/ui-server.js +106 -1
  231. package/lib/core/unified-diff.d.ts +35 -0
  232. package/lib/core/unified-diff.js +86 -0
  233. package/lib/core/usage-log.js +39 -0
  234. package/lib/core/web-http.d.ts +1 -1
  235. package/lib/core/web-http.js +1 -3
  236. package/lib/host/kernel.js +57 -41
  237. package/lib/plugins/agent.js +101 -20
  238. package/lib/plugins/approval-floor.js +12 -8
  239. package/lib/plugins/approval.js +252 -80
  240. package/lib/plugins/ask.js +60 -8
  241. package/lib/plugins/browser.js +32 -84
  242. package/lib/plugins/commands.js +167 -57
  243. package/lib/plugins/compact.d.ts +2 -2
  244. package/lib/plugins/compact.js +200 -30
  245. package/lib/plugins/computer-use.js +34 -18
  246. package/lib/plugins/dock-browser.js +24 -65
  247. package/lib/plugins/dsh-compat.js +7 -0
  248. package/lib/plugins/file-review.js +59 -15
  249. package/lib/plugins/git.js +16 -8
  250. package/lib/plugins/goal.js +9 -8
  251. package/lib/plugins/hooks.js +4 -2
  252. package/lib/plugins/host-stdio.js +14 -16
  253. package/lib/plugins/lifecycle-hooks.d.ts +5 -4
  254. package/lib/plugins/lifecycle-hooks.js +12 -10
  255. package/lib/plugins/llm.js +74 -33
  256. package/lib/plugins/lsp.js +22 -27
  257. package/lib/plugins/mcp.js +16 -17
  258. package/lib/plugins/memory.js +3 -24
  259. package/lib/plugins/microcompact.d.ts +4 -1
  260. package/lib/plugins/microcompact.js +117 -19
  261. package/lib/plugins/mode.js +30 -11
  262. package/lib/plugins/permission-presets.d.ts +2 -1
  263. package/lib/plugins/permission-presets.js +55 -35
  264. package/lib/plugins/plugin-manager.js +4 -6
  265. package/lib/plugins/presets.js +56 -27
  266. package/lib/plugins/prompt.js +54 -11
  267. package/lib/plugins/ptc.d.ts +13 -0
  268. package/lib/plugins/ptc.js +121 -24
  269. package/lib/plugins/remote/types.d.ts +1 -1
  270. package/lib/plugins/remote/types.js +11 -0
  271. package/lib/plugins/remote.js +14 -15
  272. package/lib/plugins/runtime.js +91 -14
  273. package/lib/plugins/sandbox.js +181 -60
  274. package/lib/plugins/schedule.js +12 -11
  275. package/lib/plugins/self-improve.js +28 -18
  276. package/lib/plugins/session-search.js +18 -13
  277. package/lib/plugins/session-title.js +1 -1
  278. package/lib/plugins/session.js +103 -25
  279. package/lib/plugins/settings.js +16 -40
  280. package/lib/plugins/skills.js +18 -1
  281. package/lib/plugins/spill.js +18 -11
  282. package/lib/plugins/subagent.js +208 -42
  283. package/lib/plugins/team.js +11 -5
  284. package/lib/plugins/todo.d.ts +1 -1
  285. package/lib/plugins/todo.js +25 -19
  286. package/lib/plugins/tool-search.js +47 -28
  287. package/lib/plugins/tools-default.js +89 -5
  288. package/lib/plugins/tools.js +3 -3
  289. package/lib/plugins/transcript.js +116 -9
  290. package/lib/plugins/web-search.d.ts +1 -1
  291. package/lib/plugins/web-search.js +25 -16
  292. package/lib/plugins/webserver.js +40 -7
  293. package/lib/remote/assets/app-B3Id1EBq.js +14 -0
  294. package/lib/remote/assets/index.html +2 -2
  295. package/lib/remote/assets/{style-DIB6729x.css → style-NtlpbKOI.css} +1 -1
  296. package/lib/services/types.d.ts +247 -29
  297. package/lib/tools/plugin-cli.d.ts +1 -0
  298. package/lib/tools/plugin-cli.js +209 -0
  299. package/lib/ui/assets/app-B-Jx5dnh.js +90 -0
  300. package/lib/ui/assets/{chunk-BajyYBss.js → chunk-Bfdlo8Me.js} +1 -1
  301. package/lib/ui/assets/chunk-DGX-i4eb.js +12 -0
  302. package/lib/ui/assets/index.html +62 -14
  303. package/lib/ui/assets/style-WzxwEPaE.css +1 -0
  304. package/lib/ui/frames.js +1 -3
  305. package/lib/ui/index.d.ts +30 -1
  306. package/lib/ui/index.js +29 -0
  307. package/lib/ui/manifest.d.ts +24 -6
  308. package/lib/ui/manifest.js +3 -2
  309. package/lib/ui/plugins/actions/bundle.json +8 -0
  310. package/lib/ui/plugins/actions/client.js +43 -0
  311. package/lib/ui/plugins/ask/bundle.json +8 -0
  312. package/lib/ui/plugins/ask/client.js +415 -0
  313. package/lib/ui/plugins/browser/bundle.json +8 -0
  314. package/lib/ui/plugins/composer/bundle.json +9 -0
  315. package/lib/ui/plugins/composer/client.js +1806 -1087
  316. package/lib/ui/plugins/files/bundle.json +8 -0
  317. package/lib/ui/plugins/files/client.js +13 -98
  318. package/lib/ui/plugins/manifest.json +1 -104
  319. package/lib/ui/plugins/palette/bundle.json +8 -0
  320. package/lib/ui/plugins/palette/client.js +360 -0
  321. package/lib/ui/plugins/plugins/bundle.json +8 -0
  322. package/lib/ui/plugins/plugins/client.js +116 -38
  323. package/lib/ui/plugins/preview/bundle.json +8 -0
  324. package/lib/ui/plugins/preview/client.js +6 -16
  325. package/lib/ui/plugins/prompt/bundle.json +8 -0
  326. package/lib/ui/plugins/prompt/client.js +81 -47
  327. package/lib/ui/plugins/sessions/bundle.json +8 -0
  328. package/lib/ui/plugins/sessions/client.js +157 -111
  329. package/lib/ui/plugins/settings/bundle.json +8 -0
  330. package/lib/ui/plugins/settings/client.js +184 -170
  331. package/lib/ui/plugins/skills/bundle.json +8 -0
  332. package/lib/ui/plugins/skills/client.js +161 -79
  333. package/lib/ui/plugins/status/bundle.json +8 -0
  334. package/lib/ui/plugins/status/client.js +165 -26
  335. package/lib/ui/plugins/statusbar/bundle.json +9 -0
  336. package/lib/ui/plugins/statusbar/client.js +100 -144
  337. package/lib/ui/plugins/tasks/bundle.json +8 -0
  338. package/lib/ui/plugins/team/bundle.json +8 -0
  339. package/lib/ui/plugins/team/client.js +60 -58
  340. package/lib/ui/plugins/terminal/bundle.json +8 -0
  341. package/lib/ui/plugins/terminal/client.js +1 -7
  342. package/lib/ui/plugins/trace/bundle.json +11 -0
  343. package/lib/ui/plugins/trace/client.js +86 -179
  344. package/lib/ui/plugins/transcript/bundle.json +8 -0
  345. package/lib/ui/plugins/transcript/client.js +1608 -1243
  346. package/lib/ui/sdk/@dsc/ui/index.d.ts +54 -16
  347. package/lib/ui/sdk/@dsc/ui/package.json +1 -1
  348. package/lib/ui/sdk/@dsc/ui-core/contract.d.ts +20 -1968
  349. package/lib/ui/sdk/@dsc/ui-core/core/attachments.d.ts +185 -0
  350. package/lib/ui/sdk/@dsc/ui-core/core/bytes.d.ts +14 -0
  351. package/lib/ui/sdk/@dsc/ui-core/core/err-text.d.ts +18 -0
  352. package/lib/ui/sdk/@dsc/ui-core/core/git-surface.d.ts +17 -0
  353. package/lib/ui/sdk/@dsc/ui-core/core/json-text.d.ts +11 -0
  354. package/lib/ui/sdk/@dsc/ui-core/core/path-policy.d.ts +44 -0
  355. package/lib/ui/sdk/@dsc/ui-core/core/records.d.ts +16 -0
  356. package/lib/ui/sdk/@dsc/ui-core/core/throughput.d.ts +46 -0
  357. package/lib/ui/sdk/@dsc/ui-core/core/token-estimate.d.ts +18 -2
  358. package/lib/ui/sdk/@dsc/ui-core/core/unified-diff.d.ts +35 -0
  359. package/lib/ui/sdk/@dsc/ui-core/package.json +1 -1
  360. package/lib/ui/sdk/@dsc/ui-core/ui/index.d.ts +30 -1
  361. package/lib/ui/sdk/@dsc/ui-core/ui/manifest.d.ts +24 -6
  362. package/lib/ui/sdk/@dsc/ui-core/ui/services.d.ts +19 -8
  363. package/lib/ui/sdk/@dsc/ui-core/ui/signal.d.ts +49 -0
  364. package/lib/ui/sdk/@dsc/ui-dockkit/dock-model.d.ts +17 -3
  365. package/lib/ui/sdk/@dsc/ui-dockkit/dock-state.d.ts +1 -1
  366. package/lib/ui/sdk/@dsc/ui-dockkit/package.json +1 -1
  367. package/lib/ui/sdk/@dsc/ui-layout/app.d.ts +4 -0
  368. package/lib/ui/sdk/@dsc/ui-layout/appearance.d.ts +6 -1
  369. package/lib/ui/sdk/@dsc/ui-layout/host-channel.d.ts +21 -0
  370. package/lib/ui/sdk/@dsc/ui-layout/index.d.ts +1 -0
  371. package/lib/ui/sdk/@dsc/ui-layout/package.json +1 -1
  372. package/lib/ui/sdk/@dsc/ui-layout/page-state.d.ts +1 -1
  373. package/lib/ui/sdk/@dsc/ui-layout/runtime-context.d.ts +10 -1
  374. package/lib/ui/sdk/@dsc/ui-layout/thread-view.d.ts +1 -1
  375. package/lib/ui/sdk/@dsc/ui-layout/usage-today.d.ts +11 -0
  376. package/lib/ui/sdk/@dsc/ui-primitives/dialog-focus.d.ts +30 -0
  377. package/lib/ui/sdk/@dsc/ui-primitives/error-text.d.ts +12 -0
  378. package/lib/ui/sdk/@dsc/ui-primitives/git-surface.d.ts +9 -0
  379. package/lib/ui/sdk/@dsc/ui-primitives/highlight.d.ts +23 -0
  380. package/lib/ui/sdk/@dsc/ui-primitives/humanize-error.d.ts +35 -0
  381. package/lib/ui/sdk/@dsc/ui-primitives/icons-workspace.d.ts +33 -0
  382. package/lib/ui/sdk/@dsc/ui-primitives/icons.d.ts +21 -3
  383. package/lib/ui/sdk/@dsc/ui-primitives/image-lightbox.d.ts +21 -0
  384. package/lib/ui/sdk/@dsc/ui-primitives/index.d.ts +16 -0
  385. package/lib/ui/sdk/@dsc/ui-primitives/markdown.d.ts +10 -14
  386. package/lib/ui/sdk/@dsc/ui-primitives/package.json +1 -1
  387. package/lib/ui/sdk/@dsc/ui-primitives/panels.d.ts +31 -8
  388. package/lib/ui/sdk/@dsc/ui-primitives/paths.d.ts +2 -0
  389. package/lib/ui/sdk/@dsc/ui-primitives/review-findings-card.d.ts +25 -0
  390. package/lib/ui/sdk/@dsc/ui-primitives/review-findings.d.ts +64 -0
  391. package/lib/ui/sdk/@dsc/ui-primitives/review-notice-card.d.ts +27 -0
  392. package/lib/ui/sdk/@dsc/ui-primitives/review-notice.d.ts +80 -0
  393. package/lib/ui/sdk/@dsc/ui-primitives/signal.d.ts +9 -0
  394. package/lib/ui/sdk/@dsc/ui-primitives/sizes.d.ts +15 -0
  395. package/lib/ui/sdk/@dsc/ui-primitives/skeleton.d.ts +39 -0
  396. package/lib/ui/sdk/@dsc/ui-primitives/snapshot.d.ts +46 -0
  397. package/lib/ui/sdk/@dsc/ui-primitives/thread-resizer.d.ts +3 -3
  398. package/lib/ui/sdk/@dsc/ui-primitives/throughput.d.ts +13 -0
  399. package/lib/ui/sdk/@dsc/ui-primitives/tokens.d.ts +9 -0
  400. package/lib/ui/sdk/@dsc/ui-primitives/tool-args.d.ts +1 -1
  401. package/lib/ui/sdk/@dsc/ui-primitives/tool-summary.d.ts +30 -6
  402. package/lib/ui/sdk/@dsc/ui-primitives/unified-diff.d.ts +10 -0
  403. package/lib/ui/sdk/@dsc/ui-renderer/boot.d.ts +10 -1
  404. package/lib/ui/sdk/@dsc/ui-renderer/cordis-host.d.ts +113 -0
  405. package/lib/ui/sdk/@dsc/ui-renderer/package.json +1 -1
  406. package/lib/ui/sdk/@dsc/ui-slots/package.json +1 -1
  407. package/lib/ui/services.d.ts +19 -8
  408. package/lib/ui/services.js +20 -12
  409. package/lib/ui/signal.d.ts +49 -0
  410. package/lib/ui/signal.js +57 -0
  411. package/lib/ui/tui-plugins.js +36 -16
  412. package/package.json +71 -58
  413. package/lib/remote/assets/app-DAcUCOEn.js +0 -14
  414. package/lib/ui/assets/app-B70nVIKd.js +0 -69
  415. package/lib/ui/assets/chunk-BGcgwlCI.js +0 -12
  416. package/lib/ui/assets/style-Bq01xH_b.css +0 -1
@@ -14,7 +14,8 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
14
14
  * @module dsc-tui/app/SessionPicker
15
15
  */
16
16
  import { Box, Text } from 'ink';
17
- import { ACCENT, BORDER, GAP, MARK, PAD, SEP, STATUS_COLOR, TEXT } from './theme.js';
17
+ import { PickerFrame } from './PickerFrame.js';
18
+ import { ACCENT, MARK, SEP, STATUS_COLOR, TEXT } from './theme.js';
18
19
  const shortDate = (createdAt) => {
19
20
  const date = new Date(createdAt);
20
21
  const pad = (value) => String(value).padStart(2, '0');
@@ -34,23 +35,23 @@ export function SessionPicker({ level = 'sessions', workspaces = [], workspaceTi
34
35
  : workspaceTitle !== null
35
36
  ? `恢复会话 › ${workspaceTitle}`
36
37
  : '恢复会话';
37
- return (_jsx(Box, { borderStyle: "round", borderColor: BORDER.active, paddingX: PAD.inline, flexDirection: "column", flexGrow: 1, overflowY: "hidden", gap: GAP.none, children: _jsxs(Box, { flexShrink: 0, flexDirection: "column", gap: GAP.none, children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, wrap: "truncate-end", children: [title, loading ? '(读取中…)' : `(${total} ${workspaceLevel ? '个工作区' : '条'})`, total > (workspaceLevel ? workspaces.length : sessions.length)
38
- ? ` · 显示 ${start + 1}–${start + (workspaceLevel ? workspaces.length : sessions.length)}`
39
- : '', _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "Tab \u5207", page === 'active' ? '归档' : '活动', "\u9875"] })] }), _jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, children: ["\u7B5B\u9009", ' '] }), _jsxs(Text, { ...(query === '' ? TEXT.secondary : TEXT.body), children: [query === ''
40
- ? workspaceLevel
41
- ? '(直接输入按名称/目录过滤)'
42
- : '(直接输入按标题/目录/id 过滤)'
43
- : query, buffer === null ? _jsx(Text, { ...TEXT.secondary, children: "\u258F" }) : null] })] }), buffer !== null ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, wrap: "truncate-end", children: ["\u6539\u540D\uFF1A", buffer, "\u258F\uFF08Enter \u786E\u8BA4 \u00B7 Esc \u53D6\u6D88\uFF09"] })) : null, workspaceLevel ? (_jsxs(_Fragment, { children: [workspaces.length === 0 && !loading ? (_jsx(Text, { ...TEXT.secondary, children: "\uFF08\u6CA1\u6709\u5339\u914D\u7684\u5DE5\u4F5C\u533A\uFF09" })) : null, workspaces.map((workspace, position) => {
44
- const selected = start + position === safeIndex;
45
- return (_jsxs(Text, { color: selected ? ACCENT : undefined, wrap: "truncate-end", children: [selected ? MARK.selected : MARK.idle, workspace.name, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, workspace.count, " \u6761"] }), _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u6700\u8FD1 ", shortDate(workspace.latest)] }), workspace.current ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, children: [SEP.gap, "\u2190 \u5F53\u524D"] })) : null] }, workspace.cwd || '(无目录)'));
46
- })] })) : (_jsxs(_Fragment, { children: [sessions.length === 0 && !loading ? (_jsx(Text, { ...TEXT.secondary, children: "\uFF08\u6CA1\u6709\u5339\u914D\u7684\u4F1A\u8BDD\uFF09" })) : null, sessions.map((session, position) => {
47
- // v2 的 id 是 jsonl 文件路径;展示取文件名前 8 位
48
- const shortId = (session.id.split(/[\\/]/).pop() ?? session.id)
49
- .replace(/\.jsonl$/, '')
50
- .slice(0, 8);
51
- const selected = start + position === safeIndex;
52
- const state = sessionStates[session.id];
53
- const dot = state !== undefined ? STATE_DOT[state] : undefined;
54
- return (_jsxs(Box, { children: [_jsx(Text, { ...TEXT.label, color: selected ? ACCENT : undefined, children: selected ? MARK.selected : MARK.idle }), session.pinnedAt !== undefined ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, children: ["\u2605", ' '] })) : null, _jsx(Text, { ...TEXT.secondary, children: shortDate(session.createdAt) }), _jsxs(Text, { ...TEXT.body, color: selected ? ACCENT : undefined, wrap: "truncate-end", children: [SEP.gap, session.title ?? (session.cwd || '(无目录)')] }), dot !== undefined ? (_jsxs(Text, { ...TEXT.label, color: dot.color, children: [SEP.gap, dot.mark] })) : null, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, shortId] })] }, session.id));
55
- })] })), buffer !== null ? null : (_jsx(Text, { ...TEXT.secondary, wrap: "truncate-end", children: workspaceLevel ? (_jsxs(_Fragment, { children: ["\u2191\u2193 \u9009\u62E9 \u00B7 Enter \u8FDB\u5165\u5DE5\u4F5C\u533A \u00B7 \u9F20\u6807\u70B9\u51FB\u9009\u4E2D\u3001\u518D\u70B9\u8FDB\u5165 \u00B7 \u6EDA\u8F6E\u79FB\u52A8", ' · ', "Tab \u5207", page === 'active' ? '归档' : '活动', "\u9875 \u00B7 Esc \u5173\u95ED"] })) : (_jsxs(_Fragment, { children: ["\u2191\u2193 \u9009\u62E9 \u00B7 Enter \u6253\u5F00 \u00B7 \u9F20\u6807\u70B9\u51FB\u9009\u4E2D\u3001\u518D\u70B9\u6253\u5F00 \u00B7 \u6EDA\u8F6E\u79FB\u52A8", ' · ', "Ctrl+R \u6539\u540D \u00B7 Ctrl+P \u7F6E\u9876", page === 'active' ? ' · Ctrl+A 归档' : ' · Ctrl+U 恢复', ' · ', "Ctrl+F \u5206\u53C9", armed ? '' : ' · Ctrl+X 删除(再按一次确认)', armed ? _jsx(Text, { ...TEXT.label, color: STATUS_COLOR.failed, children: " \u00B7 \u518D\u6309\u4E00\u6B21 Ctrl+X \u786E\u8BA4\u6C38\u4E45\u5220\u9664" }) : null, ' · ', workspaceTitle !== null ? 'Esc 返回工作区列表' : 'Esc 关闭'] })) }))] }) }));
38
+ return (_jsxs(PickerFrame, { children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, wrap: "truncate-end", children: [title, loading ? '(读取中…)' : `(${total} ${workspaceLevel ? '个工作区' : '条'})`, total > (workspaceLevel ? workspaces.length : sessions.length)
39
+ ? ` · 显示 ${start + 1}–${start + (workspaceLevel ? workspaces.length : sessions.length)}`
40
+ : '', _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "Tab \u5207", page === 'active' ? '归档' : '活动', "\u9875"] })] }), _jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, children: ["\u7B5B\u9009", ' '] }), _jsxs(Text, { ...(query === '' ? TEXT.secondary : TEXT.body), children: [query === ''
41
+ ? workspaceLevel
42
+ ? '(直接输入按名称/目录过滤)'
43
+ : '(直接输入按标题/目录/id 过滤)'
44
+ : query, buffer === null ? _jsx(Text, { ...TEXT.secondary, children: "\u258F" }) : null] })] }), buffer !== null ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, wrap: "truncate-end", children: ["\u6539\u540D\uFF1A", buffer, "\u258F\uFF08Enter \u786E\u8BA4 \u00B7 Esc \u53D6\u6D88\uFF09"] })) : null, workspaceLevel ? (_jsxs(_Fragment, { children: [workspaces.length === 0 && !loading ? (_jsx(Text, { ...TEXT.secondary, children: "\uFF08\u6CA1\u6709\u5339\u914D\u7684\u5DE5\u4F5C\u533A\uFF09" })) : null, workspaces.map((workspace, position) => {
45
+ const selected = start + position === safeIndex;
46
+ return (_jsxs(Text, { color: selected ? ACCENT : undefined, wrap: "truncate-end", children: [selected ? MARK.selected : MARK.idle, workspace.name, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, workspace.count, " \u6761"] }), _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u6700\u8FD1 ", shortDate(workspace.latest)] }), workspace.current ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, children: [SEP.gap, "\u2190 \u5F53\u524D"] })) : null] }, workspace.cwd || '(无目录)'));
47
+ })] })) : (_jsxs(_Fragment, { children: [sessions.length === 0 && !loading ? (_jsx(Text, { ...TEXT.secondary, children: "\uFF08\u6CA1\u6709\u5339\u914D\u7684\u4F1A\u8BDD\uFF09" })) : null, sessions.map((session, position) => {
48
+ // v2 的 id 是 jsonl 文件路径;展示取文件名前 8 位
49
+ const shortId = (session.id.split(/[\\/]/).pop() ?? session.id)
50
+ .replace(/\.jsonl$/, '')
51
+ .slice(0, 8);
52
+ const selected = start + position === safeIndex;
53
+ const state = sessionStates[session.id];
54
+ const dot = state !== undefined ? STATE_DOT[state] : undefined;
55
+ return (_jsxs(Box, { children: [_jsx(Text, { ...TEXT.label, color: selected ? ACCENT : undefined, children: selected ? MARK.selected : MARK.idle }), session.pinnedAt !== undefined ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, children: ["\u2605", ' '] })) : null, _jsx(Text, { ...TEXT.secondary, children: shortDate(session.createdAt) }), _jsxs(Text, { ...TEXT.body, color: selected ? ACCENT : undefined, wrap: "truncate-end", children: [SEP.gap, session.title ?? (session.cwd || '(无目录)')] }), dot !== undefined ? (_jsxs(Text, { ...TEXT.label, color: dot.color, children: [SEP.gap, dot.mark] })) : null, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, shortId] })] }, session.id));
56
+ })] })), buffer !== null ? null : (_jsx(Text, { ...TEXT.secondary, wrap: "truncate-end", children: workspaceLevel ? (_jsxs(_Fragment, { children: ["\u2191\u2193 \u9009\u62E9 \u00B7 Enter \u8FDB\u5165\u5DE5\u4F5C\u533A \u00B7 \u9F20\u6807\u70B9\u51FB\u9009\u4E2D\u3001\u518D\u70B9\u8FDB\u5165 \u00B7 \u6EDA\u8F6E\u79FB\u52A8", ' · ', "Tab \u5207", page === 'active' ? '归档' : '活动', "\u9875 \u00B7 Esc \u5173\u95ED"] })) : (_jsxs(_Fragment, { children: ["\u2191\u2193 \u9009\u62E9 \u00B7 Enter \u6253\u5F00 \u00B7 \u9F20\u6807\u70B9\u51FB\u9009\u4E2D\u3001\u518D\u70B9\u6253\u5F00 \u00B7 \u6EDA\u8F6E\u79FB\u52A8", ' · ', "Ctrl+R \u6539\u540D \u00B7 Ctrl+P \u7F6E\u9876", page === 'active' ? ' · Ctrl+A 归档' : ' · Ctrl+U 恢复', ' · ', "Ctrl+F \u5206\u53C9", armed ? '' : ' · Ctrl+X 删除(再按一次确认)', armed ? _jsx(Text, { ...TEXT.label, color: STATUS_COLOR.failed, children: " \u00B7 \u518D\u6309\u4E00\u6B21 Ctrl+X \u786E\u8BA4\u6C38\u4E45\u5220\u9664" }) : null, ' · ', workspaceTitle !== null ? 'Esc 返回工作区列表' : 'Esc 关闭'] })) }))] }));
56
57
  }
@@ -17,7 +17,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
17
17
  * @module dsc-tui/app/SettingsOverlay
18
18
  */
19
19
  import { Box, Text, useStdout } from 'ink';
20
- import { displayWidth } from './click.js';
20
+ import { displayWidth } from './display-width.js';
21
21
  import { focusableRows } from './settings-model.js';
22
22
  import { ACCENT, BORDER, GAP, MARK, PAD, PALETTE, SEP, STATUS_COLOR, TEXT } from './theme.js';
23
23
  /** 设置页固定框架行数:外框上下边 2 + 标题 1 + 底部 notice 1 + 提示条 1。 */
@@ -8,12 +8,13 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
8
8
  *
9
9
  * @module dsc-tui/app/SkillsPicker
10
10
  */
11
- import { Box, Text } from 'ink';
12
- import { ACCENT, BORDER, GAP, MARK, PAD, SEP, STATUS_COLOR, TEXT } from './theme.js';
11
+ import { Text } from 'ink';
12
+ import { PickerFrame } from './PickerFrame.js';
13
+ import { ACCENT, MARK, SEP, STATUS_COLOR, TEXT } from './theme.js';
13
14
  export function SkillsPicker({ skills, index, query, }) {
14
15
  const safeIndex = Math.min(index, Math.max(0, skills.length - 1));
15
- return (_jsx(Box, { borderStyle: "round", borderColor: BORDER.active, paddingX: PAD.inline, flexDirection: "column", flexGrow: 1, overflowY: "hidden", gap: GAP.none, children: _jsxs(Box, { flexShrink: 0, flexDirection: "column", gap: GAP.none, children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, wrap: "truncate-end", children: ["\u6280\u80FD\uFF08", skills.length, " \u4E2A\uFF09", _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u70B9\u51FB\u9009\u4E2D\u3001\u518D\u70B9\u56DE\u586B \u00B7 Enter \u628A /\u6280\u80FD\u540D \u704C\u56DE\u8F93\u5165\u884C \u00B7 \u542F\u505C\u5728\u684C\u9762\u7AEF\u6280\u80FD\u4E2D\u5FC3"] })] }), _jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, children: ["\u7B5B\u9009", ' '] }), _jsxs(Text, { ...(query === '' ? TEXT.secondary : TEXT.body), children: [query === '' ? '(直接输入按名字/描述/来源过滤)' : query, _jsx(Text, { ...TEXT.secondary, children: "\u258F" })] })] }), skills.length === 0 ? _jsx(Text, { ...TEXT.secondary, children: "\uFF08\u6CA1\u6709\u5339\u914D\u7684\u6280\u80FD\uFF09" }) : null, skills.map((skill, position) => {
16
- const selected = position === safeIndex;
17
- return (_jsxs(Text, { color: selected ? ACCENT : undefined, wrap: "truncate-end", children: [selected ? MARK.selected : MARK.idle, "/", skill.name, !skill.userInvocable ? _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u4E0D\u8FDB\u76EE\u5F55"] }) : null, !skill.enabled ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, children: [SEP.gap, "\u5DF2\u505C\u7528"] })) : null, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, skill.source] }), _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, skill.description] }), skill.problem !== undefined ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.failed, children: [SEP.gap, "\u6CE8\u610F\uFF1A", skill.problem] })) : null] }, skill.name));
18
- }), _jsx(Text, { ...TEXT.secondary, wrap: "truncate-end", children: "\u2191\u2193 \u9009\u62E9 \u00B7 Enter \u56DE\u586B \u00B7 Esc \u5173\u95ED \u00B7 \u505C\u7528\u7684\u6280\u80FD\u8981\u5148\u5728\u684C\u9762\u7AEF\u6280\u80FD\u4E2D\u5FC3\u542F\u7528\u624D\u4F1A\u88AB\u52A0\u8F7D" })] }) }));
16
+ return (_jsxs(PickerFrame, { children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, wrap: "truncate-end", children: ["\u6280\u80FD\uFF08", skills.length, " \u4E2A\uFF09", _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u70B9\u51FB\u9009\u4E2D\u3001\u518D\u70B9\u56DE\u586B \u00B7 Enter \u628A /\u6280\u80FD\u540D \u704C\u56DE\u8F93\u5165\u884C \u00B7 \u542F\u505C\u5728\u684C\u9762\u7AEF\u6280\u80FD\u4E2D\u5FC3"] })] }), _jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, children: ["\u7B5B\u9009", ' '] }), _jsxs(Text, { ...(query === '' ? TEXT.secondary : TEXT.body), children: [query === '' ? '(直接输入按名字/描述/来源过滤)' : query, _jsx(Text, { ...TEXT.secondary, children: "\u258F" })] })] }), skills.length === 0 ? _jsx(Text, { ...TEXT.secondary, children: "\uFF08\u6CA1\u6709\u5339\u914D\u7684\u6280\u80FD\uFF09" }) : null, skills.map((skill, position) => {
17
+ const selected = position === safeIndex;
18
+ return (_jsxs(Text, { color: selected ? ACCENT : undefined, wrap: "truncate-end", children: [selected ? MARK.selected : MARK.idle, "/", skill.name, !skill.userInvocable ? _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u4E0D\u8FDB\u76EE\u5F55"] }) : null, !skill.enabled ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, children: [SEP.gap, "\u5DF2\u505C\u7528"] })) : null, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, skill.source] }), _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, skill.description] }), skill.problem !== undefined ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.failed, children: [SEP.gap, "\u6CE8\u610F\uFF1A", skill.problem] })) : null] }, skill.name));
19
+ }), _jsx(Text, { ...TEXT.secondary, wrap: "truncate-end", children: "\u2191\u2193 \u9009\u62E9 \u00B7 Enter \u56DE\u586B \u00B7 Esc \u5173\u95ED \u00B7 \u505C\u7528\u7684\u6280\u80FD\u8981\u5148\u5728\u684C\u9762\u7AEF\u6280\u80FD\u4E2D\u5FC3\u542F\u7528\u624D\u4F1A\u88AB\u52A0\u8F7D" })] }));
19
20
  }
@@ -19,8 +19,9 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
19
19
  import { useRef } from 'react';
20
20
  import { Box, Text, useStdout } from 'ink';
21
21
  import { measuredSpan, useClickRegion } from './click.js';
22
- import { displayWidth } from './markdown.js';
22
+ import { displayWidth } from './display-width.js';
23
23
  import { PAD, PALETTE, SEP, STATUS_COLOR, TEXT } from './theme.js';
24
+ import { compactTokens, shortCwd } from '../core/text-format.js';
24
25
  /** 回合状态词:中文硬编码,本项目不做 i18n。 */
25
26
  const TURN_LABEL = {
26
27
  idle: '空闲',
@@ -43,11 +44,6 @@ const BACKGROUND_DOT = {
43
44
  };
44
45
  /** 会话 jsonl 路径的短标识(文件名去后缀取前 8 位)。 */
45
46
  export const shortId = (sessionPath) => (sessionPath.split(/[\\/]/).pop() ?? sessionPath).replace(/\.jsonl$/, '').slice(0, 8);
46
- /** cwd 尾部显示:太长时只留最后两段(Windows 盘符段算一段)。 */
47
- const shortCwd = (cwd) => {
48
- const parts = cwd.split(/[\\/]/).filter((part) => part !== '');
49
- return parts.length <= 2 ? cwd : `…${parts.slice(-2).join('/')}`;
50
- };
51
47
  /** 段的显示宽度(chip 按渲染文本 `mark id` 算)。 */
52
48
  const segmentWidth = (segment) => {
53
49
  if (segment.kind === 'chip') {
@@ -77,14 +73,6 @@ function fitSegments(left, right, budget) {
77
73
  }
78
74
  return { left: leftFitted, right: rightFitted };
79
75
  }
80
- /** token 数的人话格式(dsh StatusMetrics 同口径):988 / 3.4k / 12k / 1.0M。 */
81
- const fmtTokens = (value) => {
82
- if (value >= 1_000_000)
83
- return `${(value / 1_000_000).toFixed(1)}M`;
84
- if (value >= 1000)
85
- return `${(value / 1000).toFixed(1)}k`;
86
- return String(value);
87
- };
88
76
  /** 后台会话芯片:一枚状态点 + 短 id,整枚可点,点了开那个会话的转录浮层。 */
89
77
  function BackgroundChip({ sessionPath, state, onOpen, registerClick, }) {
90
78
  const ref = useRef(null);
@@ -147,7 +135,7 @@ export function StatusBar({ status, surfaces, subagents, queued, config, onOpenA
147
135
  left.push({
148
136
  kind: 'text',
149
137
  id: 'tokens',
150
- text: `tok ${fmtTokens(usage.inputTokens)}↑ ${fmtTokens(usage.outputTokens)}↓`,
138
+ text: `tok ${compactTokens(usage.inputTokens)}↑ ${compactTokens(usage.outputTokens)}↓`,
151
139
  tone: 'secondary',
152
140
  priority: 0,
153
141
  });
@@ -9,10 +9,7 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
9
9
  */
10
10
  import { Box, Text } from 'ink';
11
11
  import { GAP, STATUS_COLOR, TEXT } from './theme.js';
12
- const oneLine = (text, limit) => {
13
- const flat = text.replace(/\s+/g, ' ').trim();
14
- return flat.length > limit ? `${flat.slice(0, limit)}…` : flat;
15
- };
12
+ import { oneLine } from '../core/strings.js';
16
13
  /** 目标阶段词与颜色。 */
17
14
  const GOAL_PHASE = {
18
15
  active: { text: '进行中', color: STATUS_COLOR.pending },
@@ -27,7 +27,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
27
27
  */
28
28
  import { Box, Text } from 'ink';
29
29
  import { useEffect, useRef, useState } from 'react';
30
- import { absoluteTop, displayWidth, measuredSpan, useClickRegion } from './click.js';
30
+ import { absoluteTop, measuredSpan, useClickRegion } from './click.js';
31
+ import { displayWidth } from './display-width.js';
31
32
  import { useGutterPointer } from './pointer.js';
32
33
  import { railHitRow, RAIL_GLYPH, RAIL_WIDTH, } from './scroll-model.js';
33
34
  import { PALETTE, RAIL_COLOR } from './theme.js';
@@ -18,6 +18,7 @@ import { Box, Text } from 'ink';
18
18
  import { useRef } from 'react';
19
19
  import { measuredSpan, useClickRegion } from './click.js';
20
20
  import { GAP, INDENT, SEP, STATUS_COLOR, TEXT } from './theme.js';
21
+ import { oneLine } from '../core/strings.js';
21
22
  /** 状态标签:中文硬编码,配色只取 `STATUS_COLOR` 里的状态色。 */
22
23
  const STATUS_LABEL = {
23
24
  // 模型吐了工具名、参数还没到齐(对照 dsh 的 preparing 阶段):与「执行中」同色,
@@ -40,11 +41,6 @@ const fmtDuration = (ms) => {
40
41
  return `${(ms / 1000).toFixed(1)}s`;
41
42
  return `${Math.floor(ms / 60_000)}m${Math.round((ms % 60_000) / 1000)}s`;
42
43
  };
43
- /** 单行化并截断。 */
44
- const oneLine = (text, limit) => {
45
- const flat = text.replace(/\s+/g, ' ').trim();
46
- return flat.length > limit ? `${flat.slice(0, limit)}…` : flat;
47
- };
48
44
  export function ToolCard({ call, expanded, onToggle, registerClick, }) {
49
45
  const status = STATUS_LABEL[call.status];
50
46
  const ref = useRef(null);
@@ -60,5 +56,5 @@ export function ToolCard({ call, expanded, onToggle, registerClick, }) {
60
56
  return true;
61
57
  });
62
58
  const hasResult = call.resultText !== undefined && call.resultText !== '';
63
- return (_jsxs(Box, { ref: ref, flexDirection: "column", marginLeft: INDENT.tool, gap: GAP.none, children: [_jsxs(Box, { children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { ...TEXT.secondary, children: `⚙ 调用 ${call.name} 工具` }) }), _jsxs(Box, { flexShrink: 0, children: [_jsxs(Text, { ...TEXT.label, color: status.color, children: [SEP.dot, status.text] }), call.durationMs !== undefined ? (_jsxs(Text, { ...TEXT.label, color: status.color, children: [' ', "\u00B7 ", fmtDuration(call.durationMs)] })) : null] })] }), expanded && call.argsText !== '' ? (_jsx(Box, { marginLeft: INDENT.detail, children: _jsxs(Text, { ...TEXT.secondary, wrap: "truncate-end", children: ["\u25B8 ", oneLine(call.argsText, ARG_PREVIEW_LIMIT)] }) })) : null, expanded && hasResult ? (_jsx(Box, { marginLeft: INDENT.detail, children: _jsxs(Text, { ...TEXT.secondary, children: ["\u21B3 ", oneLine(call.resultText ?? '', RESULT_PREVIEW_LIMIT)] }) })) : null] }));
59
+ return (_jsxs(Box, { ref: ref, flexDirection: "column", marginLeft: INDENT.tool, gap: GAP.none, children: [_jsxs(Box, { children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { ...TEXT.secondary, children: `⚙ 调用 ${call.name === '' ? '未知' : call.name} 工具` }) }), _jsxs(Box, { flexShrink: 0, children: [_jsxs(Text, { ...TEXT.label, color: status.color, children: [SEP.dot, status.text] }), call.durationMs !== undefined ? (_jsxs(Text, { ...TEXT.label, color: status.color, children: [' ', "\u00B7 ", fmtDuration(call.durationMs)] })) : null] })] }), expanded && call.argsText !== '' ? (_jsx(Box, { marginLeft: INDENT.detail, children: _jsxs(Text, { ...TEXT.secondary, wrap: "truncate-end", children: ["\u25B8 ", oneLine(call.argsText, ARG_PREVIEW_LIMIT)] }) })) : null, expanded && hasResult ? (_jsx(Box, { marginLeft: INDENT.detail, children: _jsxs(Text, { ...TEXT.secondary, children: ["\u21B3 ", oneLine(call.resultText ?? '', RESULT_PREVIEW_LIMIT)] }) })) : null] }));
64
60
  }
@@ -1,4 +1,5 @@
1
1
  import type { JSX } from 'react';
2
+ /** cwd 尾部显示:太长时只留最后两段(与 StatusBar 同一规则)。 */
2
3
  export declare function Welcome({ model, effort, cwd, }: {
3
4
  model: string;
4
5
  effort: string;
@@ -16,6 +16,7 @@ import { Box, Text, useStdout } from 'ink';
16
16
  import { DSC_VERSION } from '../core/version.js';
17
17
  import { KEYS } from './keymap.js';
18
18
  import { GAP, PALETTE, TEXT } from './theme.js';
19
+ import { shortCwd } from '../core/text-format.js';
19
20
  /** 5 行 × 5 列点阵字形(方块字,参照 dsh splashFonts 的 bold 款)。 */
20
21
  const GLYPHS = {
21
22
  M: ['█ █', '██ ██', '█ █ █', '█ █', '█ █'],
@@ -54,10 +55,6 @@ function BigWord({ rows, from, to }) {
54
55
  return (_jsx(Box, { flexDirection: "column", children: rows.map((row, index) => (_jsx(Text, { bold: true, color: lerpColor(from, to, index / 4), children: row }, index))) }));
55
56
  }
56
57
  /** cwd 尾部显示:太长时只留最后两段(与 StatusBar 同一规则)。 */
57
- const shortCwd = (cwd) => {
58
- const parts = cwd.split(/[\\/]/).filter((part) => part !== '');
59
- return parts.length <= 2 ? cwd : `…${parts.slice(-2).join('/')}`;
60
- };
61
58
  export function Welcome({ model, effort, cwd, }) {
62
59
  const { stdout } = useStdout();
63
60
  const columns = stdout?.columns ?? 100;
@@ -1,7 +1,5 @@
1
1
  import type { RefObject } from 'react';
2
2
  import type { DOMElement } from 'ink';
3
- /** 与终端一致的显示宽度:CJK/全角/emoji 记 2 列,其余记 1 列。 */
4
- export declare function displayWidth(text: string): number;
5
3
  /** 节点在帧内的绝对行(0 基);量不到(非 TTY 管道、未挂载)返回 null。 */
6
4
  export declare function absoluteTop(node: DOMElement | null | undefined): number | null;
7
5
  /** 节点在帧内的绝对列(0 基);量不到返回 null(同一行里多块区域分列命中用)。 */
package/lib/app/click.js CHANGED
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * 鼠标点击命中基础设施(原版 ink 没有命中测试,这里是 dsc 的最小实现)。
3
3
  *
4
- * 组成三件事:
5
- * - `displayWidth`:按显示宽度数列(CJK/全角记 2 列),卡片页脚「按键按钮」的列区间
6
- * 就靠它和渲染同源计算;
4
+ * 组成两件事(显示宽度是第三件,已独立成 `app/display-width.ts`,卡片页脚的列区间
5
+ * 与渲染同源计算就靠它):
7
6
  * - `absoluteTop` / `measuredHeight`:沿 ink DOM 的 parentNode 链累加 yoga 的
8
7
  * getComputedTop,得到节点在帧内的绝对行——帧恒定为「终端行数 − 1」且从屏顶排
9
8
  * (App 根盒),帧内行就是屏幕行;
@@ -17,24 +16,6 @@
17
16
  * @module dsc-tui/app/click
18
17
  */
19
18
  import { useEffect, useRef } from 'react';
20
- /** 与终端一致的显示宽度:CJK/全角/emoji 记 2 列,其余记 1 列。 */
21
- export function displayWidth(text) {
22
- let width = 0;
23
- for (const char of text) {
24
- const code = char.codePointAt(0) ?? 0;
25
- width += isWideCodePoint(code) ? 2 : 1;
26
- }
27
- return width;
28
- }
29
- const isWideCodePoint = (code) => (code >= 0x1100 && code <= 0x115f) ||
30
- (code >= 0x2e80 && code <= 0xa4cf) ||
31
- (code >= 0xac00 && code <= 0xd7a3) ||
32
- (code >= 0xf900 && code <= 0xfaff) ||
33
- (code >= 0xfe30 && code <= 0xfe4f) ||
34
- (code >= 0xff00 && code <= 0xff60) ||
35
- (code >= 0xffe0 && code <= 0xffe6) ||
36
- (code >= 0x1f300 && code <= 0x1faff) ||
37
- (code >= 0x20000 && code <= 0x3fffd);
38
19
  /** 节点在帧内的绝对行(0 基);量不到(非 TTY 管道、未挂载)返回 null。 */
39
20
  export function absoluteTop(node) {
40
21
  let y = 0;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 终端显示宽度(全仓库唯一一份)。
3
+ *
4
+ * 为什么单独一个模块:`displayWidth` + `isWideCodePoint` 此前在 `src/app/click.ts` 与
5
+ * `src/app/markdown.ts` 各写一遍(后者注释说是「避免互相 import 循环」,实际是避免让
6
+ * 纯文本模块拖进 React/ink)。抽成第三个无依赖模块,两边都引,谁也不欠谁。
7
+ *
8
+ * 口径:CJK / 全角 / 常用 emoji 记 2 列,其余 1 列。表格列宽、点击命中区、换行计算
9
+ * 必须与渲染同源,否则终端里对不齐。
10
+ *
11
+ * @module dsc-tui/app/display-width
12
+ */
13
+ /** 与终端一致的显示宽度:CJK/全角/emoji 记 2 列,其余记 1 列。 */
14
+ export declare function displayWidth(text: string): number;
15
+ /** 码位属不属于「双宽」区间。 */
16
+ export declare function isWideCodePoint(code: number): boolean;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * 终端显示宽度(全仓库唯一一份)。
3
+ *
4
+ * 为什么单独一个模块:`displayWidth` + `isWideCodePoint` 此前在 `src/app/click.ts` 与
5
+ * `src/app/markdown.ts` 各写一遍(后者注释说是「避免互相 import 循环」,实际是避免让
6
+ * 纯文本模块拖进 React/ink)。抽成第三个无依赖模块,两边都引,谁也不欠谁。
7
+ *
8
+ * 口径:CJK / 全角 / 常用 emoji 记 2 列,其余 1 列。表格列宽、点击命中区、换行计算
9
+ * 必须与渲染同源,否则终端里对不齐。
10
+ *
11
+ * @module dsc-tui/app/display-width
12
+ */
13
+ /** 与终端一致的显示宽度:CJK/全角/emoji 记 2 列,其余记 1 列。 */
14
+ export function displayWidth(text) {
15
+ let width = 0;
16
+ for (const char of text) {
17
+ const code = char.codePointAt(0) ?? 0;
18
+ width += isWideCodePoint(code) ? 2 : 1;
19
+ }
20
+ return width;
21
+ }
22
+ /** 码位属不属于「双宽」区间。 */
23
+ export function isWideCodePoint(code) {
24
+ return ((code >= 0x1100 && code <= 0x115f) ||
25
+ (code >= 0x2e80 && code <= 0xa4cf) ||
26
+ (code >= 0xac00 && code <= 0xd7a3) ||
27
+ (code >= 0xf900 && code <= 0xfaff) ||
28
+ (code >= 0xfe30 && code <= 0xfe4f) ||
29
+ (code >= 0xff00 && code <= 0xff60) ||
30
+ (code >= 0xffe0 && code <= 0xffe6) ||
31
+ (code >= 0x1f300 && code <= 0x1faff) ||
32
+ (code >= 0x20000 && code <= 0x3fffd));
33
+ }
@@ -5,7 +5,7 @@
5
5
  * 语法按普通文本渲染,永远不比裸文本差。
6
6
  *
7
7
  * 纯函数、无 React 依赖;渲染在 MarkdownView.tsx。显示宽度一律按 CJK=2
8
- * (与 click.ts 的 displayWidth 同源语义),表格列宽才会和终端对得上。
8
+ * (`display-width.ts` 那份,与点击命中区、换行计算同源),表格列宽才会和终端对得上。
9
9
  *
10
10
  * @module dsc-tui/app/markdown
11
11
  */
@@ -48,7 +48,5 @@ export type MarkdownBlock = {
48
48
  */
49
49
  export declare function parseInline(text: string, base?: Partial<MarkdownSpan>): MarkdownSpan[];
50
50
  export declare function parseMarkdown(source: string): MarkdownBlock[];
51
- /** 与终端一致的显示宽度:CJK/全角记 2(与 click.ts 同源实现,避免互相 import 循环)。 */
52
- export declare function displayWidth(text: string): number;
53
51
  /** 按显示宽度补空格到指定列数(超宽截断加省略号)。 */
54
52
  export declare function padCell(text: string, width: number): string;
@@ -5,10 +5,11 @@
5
5
  * 语法按普通文本渲染,永远不比裸文本差。
6
6
  *
7
7
  * 纯函数、无 React 依赖;渲染在 MarkdownView.tsx。显示宽度一律按 CJK=2
8
- * (与 click.ts 的 displayWidth 同源语义),表格列宽才会和终端对得上。
8
+ * (`display-width.ts` 那份,与点击命中区、换行计算同源),表格列宽才会和终端对得上。
9
9
  *
10
10
  * @module dsc-tui/app/markdown
11
11
  */
12
+ import { displayWidth } from './display-width.js';
12
13
  /**
13
14
  * 行内解析:`代码`、**粗体**、__粗体__、*斜体*、_斜体_(贴词的 _ 不算,snake_case
14
15
  * 不误伤)、[文本](url)。嵌套(粗体里套代码)递归展开,样式叠加。
@@ -150,24 +151,6 @@ export function parseMarkdown(source) {
150
151
  }
151
152
  return blocks;
152
153
  }
153
- /** 与终端一致的显示宽度:CJK/全角记 2(与 click.ts 同源实现,避免互相 import 循环)。 */
154
- export function displayWidth(text) {
155
- let width = 0;
156
- for (const char of text) {
157
- const code = char.codePointAt(0) ?? 0;
158
- width += isWideCodePoint(code) ? 2 : 1;
159
- }
160
- return width;
161
- }
162
- const isWideCodePoint = (code) => (code >= 0x1100 && code <= 0x115f) ||
163
- (code >= 0x2e80 && code <= 0xa4cf) ||
164
- (code >= 0xac00 && code <= 0xd7a3) ||
165
- (code >= 0xf900 && code <= 0xfaff) ||
166
- (code >= 0xfe30 && code <= 0xfe4f) ||
167
- (code >= 0xff00 && code <= 0xff60) ||
168
- (code >= 0xffe0 && code <= 0xffe6) ||
169
- (code >= 0x1f300 && code <= 0x1faff) ||
170
- (code >= 0x20000 && code <= 0x3fffd);
171
154
  /** 按显示宽度补空格到指定列数(超宽截断加省略号)。 */
172
155
  export function padCell(text, width) {
173
156
  const current = displayWidth(text);
@@ -1,4 +1,4 @@
1
- import { displayWidth } from './click.js';
1
+ import { displayWidth } from './display-width.js';
2
2
  /** 窗口上下各多渲染几行:滚动时不留白,也不至于把整篇都拉进来。 */
3
3
  export const OVERSCAN_LINES = 8;
4
4
  /** 行高表:条目 id → 显示行数。宽度变了(刻度栏出现/消失)就整体作废。 */
@@ -0,0 +1,91 @@
1
+ /**
2
+ * 契约分域:approval
3
+ *
4
+ * 从 `src/contract.ts` 拆出来的一个域(纯搬移,逐字未改)。调用方照旧 import
5
+ * `../contract.js`——那份文件现在只做转出,导出面一个没少。
6
+ *
7
+ * @module dsc/contract/approval
8
+ */
9
+ import type { ApprovalPolicy, ApprovalReviewer, CollaborationMode } from './mode.js';
10
+ import type { DiffHunkView } from './transcript.js';
11
+ /**
12
+ * 审批卡内嵌的「将做的改动」(codex 审批弹窗内嵌 diff 的同位能力):宿主在弹卡前
13
+ * 读盘上现值、按工具语义推演出这次 write / edit 将产生的差异。
14
+ * 算不出来(非 write/edit、参数不齐)时整个字段缺省。
15
+ */
16
+ export interface ApprovalDiffView {
17
+ /** 目标绝对路径。 */
18
+ path: string;
19
+ added: number;
20
+ removed: number;
21
+ /** 推演出的差异段(与 ChangedFileView.hunks 同一形状,审批卡直接渲染)。 */
22
+ hunks: DiffHunkView[];
23
+ /** true = hunks 超行数预算被砍过尾。 */
24
+ truncated?: boolean;
25
+ /** `added` = 新建文件(改前不存在 / 从空串起算);`modified` = 改已有文件。 */
26
+ status: 'added' | 'modified';
27
+ /** true = 盘上现值没读到(工作区外 / 文件还不存在),差异是从参数推算的。 */
28
+ fellBack?: boolean;
29
+ /** 仅 edit:old 在盘上匹配不到 / 匹配多处——照参数执行会失败,卡片要提示。 */
30
+ mismatch?: 'missing' | 'ambiguous';
31
+ }
32
+ /**
33
+ * 模型这次在请求「放宽沙箱」(工具参数里带了成对的 sandbox_permissions + justification)。
34
+ * 卡片上要摊开说清批的是什么——不然「这次允许」批下去的是一句看不懂的话。
35
+ */
36
+ export interface ApprovalEscalationView {
37
+ /** 请求放宽到哪一档。 */
38
+ permission: 'workspace-write' | 'danger-full-access';
39
+ /** 模型填的持续意图(once / session);真正生效的授权档位永远是用户在卡上点的那个。 */
40
+ scope: 'once' | 'session';
41
+ /** 为什么必须写到范围之外(模型给的一句话)。 */
42
+ justification: string;
43
+ /** 这一档的人话说明(「留在沙箱内,只放宽这一次的写边界」这类)。 */
44
+ effect: string;
45
+ }
46
+ /** 待用户决定的工具审批请求(视图投影)。 */
47
+ export interface ApprovalRequestView {
48
+ /** adapter 内部关联 id;answerApproval 不需要它(同一时刻至多一个挂起审批)。 */
49
+ id: string;
50
+ toolName: string;
51
+ /**
52
+ * 参数摘要(单行、已截断、已遮红)。
53
+ *
54
+ * 命令类工具给的是**命令原文**,不是 JSON:`{"command":"…"}` 这层壳只增加噪音,
55
+ * 而卡上那一行本来就要给人读。
56
+ */
57
+ argsSummary: string;
58
+ /**
59
+ * 这次调用「要干什么」的中文一句话(0.7.1):命令类解读命令,写类说清动哪个文件。
60
+ * 卡片把它画在工具名下面——不用读命令行,也知道点「允许」是放行什么。缺省 = 认不出来。
61
+ */
62
+ meaning?: string;
63
+ /** 为什么要问:命中的危险模式或规则,中文一句话。 */
64
+ reason: string;
65
+ /** 风险档位:critical 表示只有它不会被任何自动档带走。 */
66
+ risk: 'low' | 'medium' | 'high' | 'critical';
67
+ /** 「永久允许」将往 `~/.dsc/policy.rules` 写的前缀;null = 这个动作不许持久化。 */
68
+ suggestedRule: string[] | null;
69
+ /** true = 命中硬地板,界面不该给出任何放行按钮。 */
70
+ hardline: boolean;
71
+ /** 这张卡允许哪些授权档位(危险动作会把 always 摘掉)。 */
72
+ scopes: Array<'once' | 'session' | 'always'>;
73
+ /** 当前权限模式、审阅者与协作模式(卡片上说明现在是哪一档、谁来审)。 */
74
+ policy: ApprovalPolicy;
75
+ reviewer: ApprovalReviewer;
76
+ mode: CollaborationMode;
77
+ /** 发起审批的会话 jsonl 路径(0.6.49):后台会话的卡弹到当前视图时,界面据此标注「来自哪个会话」。 */
78
+ sessionPath?: string;
79
+ /** write / edit 的「将做的改动」;其他工具或推演不出时缺省。 */
80
+ diff?: ApprovalDiffView;
81
+ /** 模型这次在请求放宽沙箱;没请求时缺省(卡片上就不画那一段)。 */
82
+ escalation?: ApprovalEscalationView;
83
+ }
84
+ /**
85
+ * 审批应答。
86
+ * allow-once 只放过这一次;
87
+ * allow-session 同一会话内同类动作不再问(按会话 id 键控,切会话失效);
88
+ * allow-always 往 `~/.dsc/policy.rules` 追加一条前缀规则(危险动作不给这个选项);
89
+ * reject 拒。
90
+ */
91
+ export type ApprovalAnswer = 'allow-once' | 'allow-session' | 'allow-always' | 'reject';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,69 @@
1
+ /**
2
+ * 契约分域:mode
3
+ *
4
+ * 从 `src/contract.ts` 拆出来的一个域(纯搬移,逐字未改)。调用方照旧 import
5
+ * `../contract.js`——那份文件现在只做转出,导出面一个没少。
6
+ *
7
+ * @module dsc/contract/mode
8
+ */
9
+ import type { UserFileAttachment } from '../core/attachments.js';
10
+ export type { UserFileAttachment };
11
+ /** deepseek adapter 的思考强度档位。default = 不声明思考字段(跟随端点默认)。 */
12
+ export type EffortLevel = 'default' | 'off' | 'low' | 'high' | 'max';
13
+ /** 思考强度档位里可被模型声明的四档(default 不是模型能力,是「不发字段」)。 */
14
+ export type ThinkingLevel = Exclude<EffortLevel, 'default'>;
15
+ /**
16
+ * 思考档位用哪个请求字段发给端点:
17
+ * thinking —— DeepSeek / GLM 的 `thinking:{type}`,只有开关,低/高/最大都发 enabled;
18
+ * reasoning-effort —— OpenAI 与多数网关的 `reasoning_effort`,按档位发线上值(见 EffortMap);
19
+ * none —— 端点没有思考参数,选哪档都不发字段。
20
+ */
21
+ export type ThinkingParam = 'thinking' | 'reasoning-effort' | 'none';
22
+ /** 模型能接受的输入类型(text 恒含;video 目前只作声明,dsc 还没有发视频的通道)。 */
23
+ export type Modality = 'text' | 'image' | 'video';
24
+ /** `reasoning-effort` 下每档要发的线上值;null = 该档不发字段。 */
25
+ export type EffortMap = Partial<Record<ThinkingLevel, string | null>>;
26
+ /**
27
+ * 权限模式——「问出来的那些事,怎么裁」。**只决定自动放行集**:
28
+ * readonly —— 仅查看:读类命令放行,write/exec 类一律拒绝(连卡都不弹);
29
+ * auto-edit —— 工作区自动编辑:工作目录内的 write/edit 与只读命令自动放行,
30
+ * 其余(工作区外写入、exec 类)成为「要问的事」;
31
+ * full-access —— 完全访问:全部工具自动放行(灾难地板仍拒)。
32
+ *
33
+ * 「要问的事」交给谁答,是**另一根轴**({@link ApprovalReviewer}),不再混在这一档里:
34
+ * 上一版把「AI 审查」做成第四档,逼出的是四个互相排斥的选项——「只读 + AI 复核」
35
+ * 这种用户真实想要的组合根本表达不出来。codex 的 `approvals_reviewer` 与参考实现的
36
+ * `auto` 都是把「谁来审」抽出来的做法,这里跟齐。
37
+ */
38
+ export type ApprovalPolicy = 'readonly' | 'auto-edit' | 'full-access';
39
+ /**
40
+ * 审批审阅者——「要问的事,先给谁看」:
41
+ * user —— 本人:弹审批卡等用户点(出厂默认);
42
+ * auto-review —— AI 复核:先给模型判官看一眼,判 allow 就放行,判 deny 或判不出来
43
+ * 再落回人工卡。复核**发生在自动放行之前**,所以「完全访问 + AI 复核」
44
+ * 等价于旧版的「AI 审查」档(每一次调用都过模型,codex 的
45
+ * `strict_auto_review` 同义)。
46
+ *
47
+ * 与权限模式正交:任何一档都能配上这两位中的任何一位(只读档下没有事情可问,
48
+ * 复核者自然不会被问到——这不是特例,是「无可问之事」的正常结果)。
49
+ */
50
+ export type ApprovalReviewer = 'user' | 'auto-review';
51
+ /**
52
+ * 沙箱档位(「能不能写」这一轴;形制照 codex 的 `sandbox_mode`,与参考实现逐字相同):
53
+ * read-only 只读:任何写盘与越界命令都拒;
54
+ * workspace-write 工作区可写:工作区 + 沙箱私有临时目录可写,越界拒(默认档);
55
+ * danger-full-access 不设围栏(等同关掉沙箱)。
56
+ *
57
+ * 定义住这里而不是 `services/types.ts`:打包权限预设({@link PermissionPresetView})
58
+ * 要把它和权限模式一起投影给界面,而界面只依赖契约模块——两边各写一份迟早会漂。
59
+ */
60
+ export type SandboxMode = 'read-only' | 'workspace-write' | 'danger-full-access';
61
+ /**
62
+ * 协作模式(这一轮允许模型把手伸多远)。与权限模式是两根独立的旋钮:
63
+ * 模式决定要不要问、能问什么;权限模式决定问出来之后怎么裁。
64
+ * build 执行 —— 默认档,闸门不拦,全交给权限模式与审批卡;
65
+ * plan 计划 —— 只读 + 只读命令,产出 .dsc/plans 下的计划文件等用户批;
66
+ * explore 探索 —— 只读答疑,任何改动当场拒;
67
+ * quiet 免打扰 —— 不弹审批卡:工作区内写自动放行,需要问的一律当场拒。
68
+ */
69
+ export type CollaborationMode = 'build' | 'plan' | 'explore' | 'quiet';
@@ -0,0 +1 @@
1
+ export {};