@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
@@ -7,6 +7,12 @@ const ui$1 = require("@dsc/ui");
7
7
  const uiPrimitives = require("@dsc/ui-primitives");
8
8
  const PAGE = "plugins";
9
9
  const KERNEL_PREVIEW = 3;
10
+ function isPackageRow(row) {
11
+ return row.origin === "package";
12
+ }
13
+ function keyOf(row) {
14
+ return row.key ?? `${row.name}/ui/client.js`;
15
+ }
10
16
  const ui = ui$1.defineUiPlugin({
11
17
  name: "插件中心",
12
18
  apply(ui2) {
@@ -34,7 +40,7 @@ function PluginsView() {
34
40
  setRows(Array.isArray(list) ? list : []);
35
41
  setNote("");
36
42
  }).catch((error) => {
37
- setNote(`读插件失败:${error instanceof Error ? error.message : String(error)}`);
43
+ setNote(`读插件失败:${uiPrimitives.humanErrorText(error).text}`);
38
44
  });
39
45
  };
40
46
  react.useEffect(() => {
@@ -46,7 +52,7 @@ function PluginsView() {
46
52
  setTrusts(Array.isArray(list) ? list : []);
47
53
  setTrustNote("");
48
54
  }).catch((error) => {
49
- setTrustNote(`读第三方界面插件状态失败:${text(error)}`);
55
+ setTrustNote(`读第三方界面插件状态失败:${uiPrimitives.humanErrorText(error).text}`);
50
56
  });
51
57
  };
52
58
  const confirmTrust = (row) => {
@@ -57,26 +63,26 @@ function PluginsView() {
57
63
  setTrustBusy(true);
58
64
  void native.invoke("setUiTrust", [row.name]).then((result) => {
59
65
  if (!result.ok) {
60
- ui$1.toastErr(`确认失败:${result.error ?? "未知原因"}`);
66
+ ui$1.toastErr(`确认失败:${uiPrimitives.humanErrorLine(result.error ?? "未知原因")}`);
61
67
  return;
62
68
  }
63
69
  ui$1.toastOk(result.notice ?? `已信任「${row.name}」`);
64
70
  setTrustOpen(null);
65
71
  loadTrusts();
66
72
  }).catch((error) => {
67
- ui$1.toastErr(`确认失败:${text(error)}`);
73
+ ui$1.toastErr(`确认失败:${uiPrimitives.humanErrorLine(error)}`);
68
74
  }).finally(() => {
69
75
  setTrustBusy(false);
70
76
  });
71
77
  };
72
78
  const toggleTrust = (row, next) => {
73
79
  setTrusts((current) => current.map((item) => item.name === row.name ? { ...item, enabled: next } : item));
74
- void channel.invoke("setPluginEnabled", [`${row.name}/ui/client.js`, next]).then(() => {
75
- ui$1.toastOk(`已${next ? "启用" : "停用"}第三方界面插件「${row.name}」,刷新页面(或重启宿主)后生效`);
80
+ void channel.invoke("setPluginEnabled", [keyOf(row), next]).then(() => {
81
+ ui$1.toastOk(`已${next ? "启用" : "停用"}界面插件「${row.name}」,刷新页面(或重启宿主)后生效`);
76
82
  setTimeout(loadTrusts, 600);
77
83
  }).catch((error) => {
78
84
  setTrusts((current) => current.map((item) => item.name === row.name ? { ...item, enabled: !next } : item));
79
- ui$1.toastErr(`没改成功:${text(error)}`);
85
+ ui$1.toastErr(`没改成功:${uiPrimitives.errText(error)}`);
80
86
  });
81
87
  };
82
88
  const toggle = (row, next) => {
@@ -95,7 +101,7 @@ function PluginsView() {
95
101
  return;
96
102
  }
97
103
  void native.invoke("restartHost").catch((reason) => {
98
- ui$1.toastErr(`重启失败:${reason instanceof Error ? reason.message : String(reason)}`);
104
+ ui$1.toastErr(`重启失败:${uiPrimitives.humanErrorLine(reason)}`);
99
105
  });
100
106
  };
101
107
  const installPlugin = () => {
@@ -108,11 +114,14 @@ function PluginsView() {
108
114
  ui$1.toastOk(`已安装 ${installed.join("、")},即时生效`);
109
115
  setTimeout(refresh, 600);
110
116
  }).catch((reason) => {
111
- ui$1.toastErr(`安装失败:${reason instanceof Error ? reason.message : String(reason)}`);
117
+ ui$1.toastErr(`安装失败:${uiPrimitives.humanErrorLine(reason)}`);
112
118
  });
113
119
  };
114
120
  const detail = detailFile === null ? null : (rows ?? []).find((row) => row.file === detailFile) ?? null;
115
121
  const custom = (rows ?? []).filter((row) => row.source === "external");
122
+ const thirdParty = trusts.filter((row) => !isPackageRow(row));
123
+ const packages = trusts.filter(isPackageRow);
124
+ const packageProfiles = [...new Set(packages.map((row) => row.profile).filter((v) => v !== void 0))];
116
125
  const official = (rows ?? []).filter((row) => row.source === "builtin" && row.toggleable);
117
126
  const kernel = (rows ?? []).filter((row) => row.source === "builtin" && !row.toggleable);
118
127
  const kernelShown = kernelOpen ? kernel : kernel.slice(0, KERNEL_PREVIEW);
@@ -160,20 +169,23 @@ function PluginsView() {
160
169
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "group-hint", children: "~/.dsc/plugins/*.js" })
161
170
  ] }),
162
171
  custom.map((row) => /* @__PURE__ */ jsxRuntime.jsx(PluginCard, { row, onToggle: toggle, onOpen: setDetailFile }, row.file)),
163
- custom.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "plugins-empty", children: [
164
- "尚未安装外部插件。点击「+ 添加插件」选择 .js 文件,或将文件放入 ",
165
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "~/.dsc/plugins/" }),
166
- " ",
167
- "后重启宿主。"
172
+ custom.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "empty-card compact", children: [
173
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "empty-card-icon", children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconPuzzle, { size: 18 }) }),
174
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "empty-card-title", children: "还没有外部插件" }),
175
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "empty-card-desc", children: [
176
+ "点右上角「+ 添加插件」选一个 .js 文件,或把它放进 ",
177
+ /* @__PURE__ */ jsxRuntime.jsx("code", { children: "~/.dsc/plugins/" }),
178
+ " 后重启宿主。"
179
+ ] })
168
180
  ] }),
169
- trusts.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
181
+ thirdParty.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
170
182
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "plugin-group-label", children: [
171
183
  /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconPuzzle, { size: 13 }),
172
184
  " 第三方界面插件 ",
173
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "count", children: trusts.length }),
185
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "count", children: thirdParty.length }),
174
186
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "group-hint", children: "~/.dsc/plugins/<目录名>/ui/client.js(信任一次后才装载)" })
175
187
  ] }),
176
- trusts.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
188
+ thirdParty.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
177
189
  TrustCard,
178
190
  {
179
191
  row,
@@ -192,6 +204,31 @@ function PluginsView() {
192
204
  row.name
193
205
  ))
194
206
  ] }) : null,
207
+ packages.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
208
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "plugin-group-label", children: [
209
+ /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconPuzzle, { size: 13 }),
210
+ " 组合包界面 ",
211
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "count", children: packages.length }),
212
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "group-hint", children: [
213
+ packageProfiles.length === 0 ? "" : `profile ${packageProfiles.join("、")} · `,
214
+ "profile 里装的包(package.json 的 dsh.client.platform = pneuma);装了就算同意,这里只开关"
215
+ ] })
216
+ ] }),
217
+ packages.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
218
+ TrustCard,
219
+ {
220
+ row,
221
+ open: false,
222
+ busy: false,
223
+ onOpen: () => void 0,
224
+ onConfirm: () => void 0,
225
+ onToggle: (next) => {
226
+ toggleTrust(row, next);
227
+ }
228
+ },
229
+ row.name
230
+ ))
231
+ ] }) : null,
195
232
  trustNote === "" ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "plugins-empty", children: trustNote }),
196
233
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "plugin-group-label", children: [
197
234
  "官方可开关 ",
@@ -233,9 +270,20 @@ function PluginCard({
233
270
  row.apiVersion !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "plugin-apiver", children: [
234
271
  "API v",
235
272
  String(row.apiVersion)
273
+ ] }),
274
+ row.bundle !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "plugin-apiver", "data-bundle": row.bundle, children: [
275
+ "组合包 ",
276
+ row.bundle
236
277
  ] })
237
278
  ] }),
238
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: `plugin-desc${row.problem !== void 0 ? " problem" : ""}`, children: row.problem !== void 0 ? `⚠ ${row.problem}` : row.description === "" ? `${row.file} · 无描述` : row.description })
279
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `plugin-desc${row.problem !== void 0 ? " problem" : ""}`, children: [
280
+ row.problem !== void 0 ? `⚠ ${row.problem}` : row.description === "" ? `${row.file} · 无描述` : row.description,
281
+ row.clientCapabilities !== void 0 && row.clientCapabilities.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "plugin-desc", "data-client-capabilities": row.clientCapabilities.join(","), children: [
282
+ "界面能力(dsh 客户端插件):",
283
+ row.clientCapabilities.join("、"),
284
+ " · 只列不加载"
285
+ ] }) : null
286
+ ] })
239
287
  ] }),
240
288
  configurable ? /* @__PURE__ */ jsxRuntime.jsx(
241
289
  "button",
@@ -289,11 +337,34 @@ const TRUST_PROBLEM_TIERS = {
289
337
  next: "把插件目录改名,不要与内置插件的 id 相同。"
290
338
  }
291
339
  };
340
+ const PACKAGE_PROBLEM_TIERS = {
341
+ version: {
342
+ label: "版本不满足",
343
+ next: "升级宿主(壳)到满足这个包声明的 @dsc/ui 区间,或把这个包装成支持当前壳的版本。"
344
+ },
345
+ artifact: {
346
+ label: "读不到入口",
347
+ next: '检查这个包的 package.json:exports["./client"] 要指向包内真实存在的文件(装坏了就重装这个包)。'
348
+ },
349
+ manifest: {
350
+ label: "清单缺声明",
351
+ next: '检查这个包的 package.json:dsh.client.platform 要是 "pneuma",dsh.client.api 要写(如 "^2.0.0")。'
352
+ },
353
+ clash: {
354
+ label: "与已有插件撞名",
355
+ next: "这个包名与内置插件(或另一个界面插件)的 id 相同,装不进启动图;换个包名,或先停用撞名的那个。"
356
+ }
357
+ };
292
358
  const UNKNOWN_TRUST_PROBLEM = {
293
359
  label: "装不上",
294
360
  next: "照上面的原因检查 ~/.dsc/plugins/<目录名>/ 里的 plugin.json 与 ui/client.js。"
295
361
  };
296
- function trustProblemTier(kind) {
362
+ const UNKNOWN_PACKAGE_PROBLEM = {
363
+ label: "装不上",
364
+ next: '照上面的原因检查这个包的 package.json(`dsh.client` 段)与 exports["./client"]。'
365
+ };
366
+ function trustProblemTier(kind, origin) {
367
+ if (origin === "package") return kind === void 0 ? UNKNOWN_PACKAGE_PROBLEM : PACKAGE_PROBLEM_TIERS[kind];
297
368
  return kind === void 0 ? UNKNOWN_TRUST_PROBLEM : TRUST_PROBLEM_TIERS[kind];
298
369
  }
299
370
  function TrustCard({
@@ -305,9 +376,10 @@ function TrustCard({
305
376
  onToggle
306
377
  }) {
307
378
  const hello = ui$1.useHostChannel().getHello();
379
+ const fromPackage = isPackageRow(row);
308
380
  const trustedAt = row.trustedAt === void 0 ? "" : `(${new Date(row.trustedAt).toLocaleDateString()})`;
309
- const tier = row.problem === void 0 ? null : trustProblemTier(row.problemKind);
310
- const desc = row.problem !== void 0 && tier !== null ? `⚠ ${tier.label}:${row.problem}` : row.trusted ? "已确认信任,可以启停(停用或启用都在刷新页面后生效)" : "未信任:还没有信任记录——首次安装需要在插件中心确认一次(它将能调用宿主的界面方法)";
381
+ const tier = row.problem === void 0 ? null : trustProblemTier(row.problemKind, row.origin);
382
+ const desc = row.problem !== void 0 && tier !== null ? `⚠ ${tier.label}:${row.problem}` : row.trusted ? fromPackage ? "组合包自带界面半,装进 profile 就算同意——这里只开关,刷新页面后生效" : "已确认信任,可以启停(停用或启用都在刷新页面后生效)" : "未信任:还没有信任记录——首次安装需要在插件中心确认一次(它将能调用宿主的界面方法)";
311
383
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "trust-card", "data-trust": row.name, children: [
312
384
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `plugin-row${row.enabled ? "" : " off"}`, children: [
313
385
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "plugin-icon", style: { background: iconColor(row.name) }, children: row.name.slice(0, 1).toUpperCase() }),
@@ -319,10 +391,19 @@ function TrustCard({
319
391
  row.api
320
392
  ] }) : null,
321
393
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "plugin-apiver", children: row.platforms.join("/") }),
394
+ row.version !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "plugin-apiver", "data-version": row.version, children: [
395
+ "v",
396
+ row.version
397
+ ] }) : null,
398
+ row.profile !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "plugin-apiver", "data-profile": row.profile, children: [
399
+ "profile ",
400
+ row.profile
401
+ ] }) : null,
322
402
  row.trusted ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "plugin-apiver", children: [
323
403
  "已信任",
324
404
  trustedAt
325
- ] }) : null
405
+ ] }) : null,
406
+ row.trusted && !row.enabled ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "plugin-apiver", children: "已停用" }) : null
326
407
  ] }),
327
408
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: `plugin-desc${row.problem !== void 0 ? " problem" : ""}`, children: desc }),
328
409
  tier !== null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "trust-next", children: [
@@ -330,7 +411,7 @@ function TrustCard({
330
411
  tier.next
331
412
  ] }) : null
332
413
  ] }),
333
- row.problem === void 0 && !row.trusted ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "btn-primary", onClick: onOpen, children: open ? "收起" : "查看并信任" }) : null,
414
+ !fromPackage && row.problem === void 0 && !row.trusted ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "btn-primary", onClick: onOpen, children: open ? "收起" : "查看并信任" }) : null,
334
415
  row.trusted ? /* @__PURE__ */ jsxRuntime.jsx(
335
416
  "button",
336
417
  {
@@ -429,7 +510,10 @@ function PluginDetail({
429
510
  ] }),
430
511
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "plugin-detail-config", children: [
431
512
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-group-title", children: "配置" }),
432
- section === void 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-empty", children: "正在读取配置…" }) : section === null ? plugin.enabled ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-empty", children: "该插件没有可配置项。" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-empty", children: "插件已停用,启用后才能配置。" }) : /* @__PURE__ */ jsxRuntime.jsx(ConfigFields, { section, onAction: loadSection })
513
+ section === void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "settings-loading", role: "status", "aria-label": "正在读取插件配置", children: [
514
+ /* @__PURE__ */ jsxRuntime.jsx(uiPrimitives.SkeletonText, { lines: 3 }),
515
+ /* @__PURE__ */ jsxRuntime.jsx(uiPrimitives.Skeleton, { width: 132, height: 30, radius: 8 })
516
+ ] }) : section === null ? plugin.enabled ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-empty", children: "该插件没有可配置项。" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-empty", children: "插件已停用,启用后才能配置。" }) : /* @__PURE__ */ jsxRuntime.jsx(ConfigFields, { section, onAction: loadSection })
433
517
  ] })
434
518
  ] });
435
519
  }
@@ -445,7 +529,7 @@ function ConfigFields({ section, onAction }) {
445
529
  void channel.invoke("getSectionValues", [section.id]).then((next) => {
446
530
  if (alive) setValues(next);
447
531
  }).catch((error) => {
448
- if (alive) setNote({ tone: "error", text: `读取设置失败:${text(error)}` });
532
+ if (alive) setNote({ tone: "error", text: `读取设置失败:${uiPrimitives.humanErrorText(error).text}` });
449
533
  });
450
534
  return () => {
451
535
  alive = false;
@@ -458,27 +542,27 @@ function ConfigFields({ section, onAction }) {
458
542
  setNote(null);
459
543
  void channel.invoke("setSettingValue", [section.id, key, value]).then((result) => {
460
544
  if (!result.ok) {
461
- setNote({ tone: "error", text: `保存失败:${result.error}` });
545
+ setNote({ tone: "error", text: `保存失败:${uiPrimitives.humanErrorText(result.error).text}` });
462
546
  return;
463
547
  }
464
548
  if (result.notice !== void 0) setNote({ tone: "ok", text: result.notice });
465
549
  reload();
466
550
  }).catch((error) => {
467
- setNote({ tone: "error", text: `保存失败:${text(error)}` });
551
+ setNote({ tone: "error", text: `保存失败:${uiPrimitives.humanErrorText(error).text}` });
468
552
  });
469
553
  };
470
554
  const act = (action) => {
471
555
  setNote(null);
472
556
  void channel.invoke("runSettingAction", [section.id, action]).then((result) => {
473
557
  if (!result.ok) {
474
- setNote({ tone: "error", text: `操作失败:${result.error}` });
558
+ setNote({ tone: "error", text: `操作失败:${uiPrimitives.humanErrorText(result.error).text}` });
475
559
  return;
476
560
  }
477
561
  if (result.notice !== void 0) setNote({ tone: "ok", text: result.notice });
478
562
  reload();
479
563
  onAction();
480
564
  }).catch((error) => {
481
- setNote({ tone: "error", text: `操作失败:${text(error)}` });
565
+ setNote({ tone: "error", text: `操作失败:${uiPrimitives.humanErrorText(error).text}` });
482
566
  });
483
567
  };
484
568
  const render = (field, index) => {
@@ -524,7 +608,7 @@ function ConfigFields({ section, onAction }) {
524
608
  void native.invoke("openPath", [field.text]).then((problem) => {
525
609
  if (problem !== "") setNote({ tone: "error", text: `打开失败:${problem}` });
526
610
  }).catch((error) => {
527
- setNote({ tone: "error", text: `打开失败:${text(error)}` });
611
+ setNote({ tone: "error", text: `打开失败:${uiPrimitives.errText(error)}` });
528
612
  });
529
613
  },
530
614
  children: "打开"
@@ -669,14 +753,8 @@ function ConfigFields({ section, onAction }) {
669
753
  note === null ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: `settings-note${note.tone === "error" ? " error" : ""}`, children: note.text })
670
754
  ] });
671
755
  }
672
- function iconColor(name) {
673
- const palette = ["#4c8dff", "#a06bff", "#2fb27c", "#e0a13a", "#e05a5a", "#3ab6c9"];
674
- let hash = 0;
675
- for (const ch of name) hash = (hash * 31 + (ch.codePointAt(0) ?? 0)) % 997;
676
- return palette[hash % palette.length] ?? palette[0];
677
- }
678
- function text(error) {
679
- return error instanceof Error ? error.message : String(error);
756
+ function iconColor(_name) {
757
+ return "var(--dsc-fill-tertiary)";
680
758
  }
681
759
  exports.default = ui;
682
760
  };
@@ -0,0 +1,8 @@
1
+ {
2
+ "apiVersion": "0.8.1",
3
+ "file": "client.js",
4
+ "platforms": [
5
+ "web"
6
+ ],
7
+ "api": "^0.8.1"
8
+ }
@@ -4,6 +4,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4
4
  const jsxRuntime = require("react/jsx-runtime");
5
5
  const react = require("react");
6
6
  const ui$1 = require("@dsc/ui");
7
+ const uiPrimitives = require("@dsc/ui-primitives");
7
8
  const ui = ui$1.defineUiPlugin({
8
9
  name: "文件预览",
9
10
  apply() {
@@ -12,7 +13,7 @@ const ui = ui$1.defineUiPlugin({
12
13
  }
13
14
  });
14
15
  function PreviewTab({ tab }) {
15
- const cwd = ui$1.useHostSelector(readCwd);
16
+ const cwd = ui$1.useHostSelector(uiPrimitives.readCwd);
16
17
  const path = tab.path ?? "";
17
18
  if (path === "") {
18
19
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "file-preview-empty", children: "这张预览页签没有文件路径(关掉它,从文件树重新点一个)。" });
@@ -69,7 +70,7 @@ function PreviewBody({ path, cwd }) {
69
70
  ] });
70
71
  }
71
72
  function PatchTab({ tab }) {
72
- const cwd = ui$1.useHostSelector(readCwd);
73
+ const cwd = ui$1.useHostSelector(uiPrimitives.readCwd);
73
74
  const path = tab.path ?? "";
74
75
  const source = ui$1.useDockPatchSource(path);
75
76
  if (path === "") {
@@ -131,7 +132,7 @@ function renderBody(read, fsRead) {
131
132
  if (read.tooLarge) {
132
133
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "file-preview-empty", children: [
133
134
  "文件过大(",
134
- formatSize(read.size ?? 0),
135
+ uiPrimitives.formatBytes(read.size ?? 0),
135
136
  "),仅支持预览 10MB 以内的文件。"
136
137
  ] });
137
138
  }
@@ -141,7 +142,7 @@ function renderBody(read, fsRead) {
141
142
  if (read.kind === "binary") {
142
143
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "file-preview-empty", children: [
143
144
  "二进制文件(",
144
- formatSize(read.size ?? 0),
145
+ uiPrimitives.formatBytes(read.size ?? 0),
145
146
  "),暂不支持预览。"
146
147
  ] });
147
148
  }
@@ -154,7 +155,7 @@ function renderBody(read, fsRead) {
154
155
  "这类文件(",
155
156
  read.mime ?? "未知类型",
156
157
  ",",
157
- formatSize(read.size ?? 0),
158
+ uiPrimitives.formatBytes(read.size ?? 0),
158
159
  ")要看内容请用「系统打开」。"
159
160
  ] });
160
161
  }
@@ -182,16 +183,5 @@ function shortPath(path, cwd) {
182
183
  const base = `${cwd.replace(/\\/g, "/").replace(/\/+$/, "")}/`;
183
184
  return posix.toLowerCase().startsWith(base.toLowerCase()) ? posix.slice(base.length) : posix;
184
185
  }
185
- function formatSize(size) {
186
- if (size < 1024) return `${String(size)}B`;
187
- if (size < 1024 * 1024) return `${String(Math.max(1, Math.round(size / 1024)))}KB`;
188
- return `${(size / 1024 / 1024).toFixed(1)}MB`;
189
- }
190
- function readCwd(snapshot) {
191
- const status = snapshot?.["status"];
192
- if (typeof status !== "object" || status === null) return null;
193
- const value = status["cwd"];
194
- return typeof value === "string" && value !== "" ? value : null;
195
- }
196
186
  exports.default = ui;
197
187
  };
@@ -0,0 +1,8 @@
1
+ {
2
+ "apiVersion": "0.8.1",
3
+ "file": "client.js",
4
+ "platforms": [
5
+ "web"
6
+ ],
7
+ "api": "^0.8.1"
8
+ }
@@ -149,6 +149,10 @@ function readOwnerLabel(snapshot) {
149
149
  if (!Array.isArray(sessions)) return "后台会话";
150
150
  return sessions.find((item) => item.id === request.sessionPath)?.title ?? "后台会话";
151
151
  }
152
+ const GENERIC_REASONS = /* @__PURE__ */ new Set(["需要授权", "工作区内的改动需要确认"]);
153
+ function isGenericReason(reason) {
154
+ return GENERIC_REASONS.has(reason);
155
+ }
152
156
  const ApprovalCard = react.memo(function ApprovalCard2({ request }) {
153
157
  const channel = ui$1.useHostChannel();
154
158
  const scopes = request.scopes.length > 0 ? request.scopes : ["once"];
@@ -203,13 +207,13 @@ const ApprovalCard = react.memo(function ApprovalCard2({ request }) {
203
207
  title: request.suggestedRule === null ? "这类动作不给持久化" : `往规则文件写一条:${request.suggestedRule.join(" ")}… 以后照它自动放行`
204
208
  }
205
209
  ];
206
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `approval risk-${risk.tone}`, children: [
210
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `approval risk-${risk.tone}`, title: modeLine, children: [
207
211
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "approval-head", children: [
208
212
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tool-name", children: request.toolName }),
209
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: `risk-badge tone-${risk.tone}`, children: risk.label }),
210
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "approval-mode", children: modeLine })
213
+ request.risk === "low" ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: `risk-badge tone-${risk.tone}`, children: risk.label })
211
214
  ] }),
212
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-args", children: request.argsSummary }),
215
+ request.meaning === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-meaning", children: request.meaning }),
216
+ request.diff === void 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-args", title: request.argsSummary, children: request.argsSummary }) : null,
213
217
  request.escalation === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "approval-escalation", "data-approval-escalation": "", children: [
214
218
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-escalation-line", children: `模型请求放宽沙箱:${request.escalation.effect}${request.escalation.scope === "session" ? "(它想要本会话一直放宽)" : ""}` }),
215
219
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-escalation-why", children: `理由:${request.escalation.justification}` })
@@ -245,7 +249,7 @@ const ApprovalCard = react.memo(function ApprovalCard2({ request }) {
245
249
  request.diff.fellBack === true ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-diff-note", children: "读不到文件当前内容,以下按参数推算" }) : null,
246
250
  diffOpen ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-diff-body", children: request.diff.hunks.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "tc-intended-note", children: "不会有实际改动。" }) : /* @__PURE__ */ jsxRuntime.jsx(DiffRows, { hunks: request.diff.hunks }) }) : null
247
251
  ] }),
248
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-reason", children: request.reason }),
252
+ isGenericReason(request.reason) ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-reason", children: request.reason }),
249
253
  request.hardline ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-hardline", children: "这一步被安全策略判为不可放行,只能拒绝。" }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "approval-actions", children: [
250
254
  keys.filter((entry) => scopes.includes(entry.scope)).map((entry) => /* @__PURE__ */ jsxRuntime.jsxs(
251
255
  "button",
@@ -269,7 +273,7 @@ const ApprovalCard = react.memo(function ApprovalCard2({ request }) {
269
273
  {
270
274
  type: "button",
271
275
  className: "btn danger",
272
- title: "不执行这一步,并把拒绝原因回给模型",
276
+ title: "不执行这一步,并把拒绝原因回给模型;5 分钟没人答也按拒绝处理",
273
277
  disabled: busy,
274
278
  onClick: () => {
275
279
  answer("reject");
@@ -279,8 +283,7 @@ const ApprovalCard = react.memo(function ApprovalCard2({ request }) {
279
283
  /* @__PURE__ */ jsxRuntime.jsx("kbd", { children: "n" })
280
284
  ]
281
285
  }
282
- ),
283
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hint", children: "5 分钟没人答按拒绝处理" })
286
+ )
284
287
  ] }),
285
288
  fault === null ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shell-composer-fault", children: [
286
289
  "没交上去:",
@@ -463,6 +466,7 @@ function AskComposer({ items }) {
463
466
  const [busy, setBusy] = react.useState(false);
464
467
  const [fault, setFault] = react.useState(null);
465
468
  const sent = react.useRef(0);
469
+ const [open, setOpen] = react.useState(true);
466
470
  const index = Math.min(focus, items.length - 1);
467
471
  const item = items[index];
468
472
  const draft = drafts[item.key] ?? EMPTY_DRAFT;
@@ -537,51 +541,81 @@ function AskComposer({ items }) {
537
541
  event.preventDefault();
538
542
  if (answered(draft)) continueFlow();
539
543
  };
540
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-card", "data-ask-count": items.length, children: [
541
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-panel", "data-ask-index": index, "data-ask-key": item.key, children: [
542
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-question", children: [
544
+ const bodyId = "ask-body-" + String(index);
545
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-card", "data-ask-count": items.length, "data-open": open ? "true" : "false", children: [
546
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-head", children: [
547
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-head-text", children: [
543
548
  item.header === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-header", children: item.header }),
544
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-text", children: item.question })
549
+ open ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-head-title", children: item.question })
545
550
  ] }),
546
- item.options.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ask-options", role: item.multiSelect ? "group" : "radiogroup", children: item.options.map((option) => {
547
- const picked = draft.picked.includes(option.label);
548
- return /* @__PURE__ */ jsxRuntime.jsxs(
549
- "button",
550
- {
551
- type: "button",
552
- className: `ask-option${picked ? " picked" : ""}`,
553
- role: item.multiSelect ? "checkbox" : "radio",
554
- "aria-checked": picked,
555
- title: option.description ?? "",
556
- disabled: busy,
557
- onClick: () => {
558
- choose(option.label);
559
- },
560
- children: [
561
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-option-label", children: option.label }),
562
- option.description === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-option-desc", children: option.description })
563
- ]
564
- },
565
- option.label
566
- );
567
- }) }) : null,
568
- item.freeText ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ask-free", children: /* @__PURE__ */ jsxRuntime.jsx(
569
- "input",
551
+ /* @__PURE__ */ jsxRuntime.jsx(
552
+ "button",
570
553
  {
571
- className: "ask-input",
572
- "data-ask-input": index,
573
- autoFocus: item.options.length === 0,
574
- placeholder: item.multiSelect ? "可以多选,或在这里直接写答案" : "也可以直接写答案",
575
- value: draft.free,
554
+ type: "button",
555
+ className: "ask-fold",
556
+ "aria-expanded": open,
557
+ "aria-controls": bodyId,
576
558
  disabled: busy,
577
- onChange: (event) => {
578
- writeFree(event.target.value);
559
+ title: open ? "收起提问卡" : "展开提问卡",
560
+ onClick: () => {
561
+ setOpen(!open);
579
562
  },
580
- onKeyDown: onFreeKeyDown
563
+ children: open ? /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconChevronDown, { size: 14 }) : /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconChevronRight, { size: 14 })
581
564
  }
582
- ) }) : null
583
- ] }, item.key),
584
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-foot", children: [
565
+ )
566
+ ] }),
567
+ /* @__PURE__ */ jsxRuntime.jsxs(
568
+ "div",
569
+ {
570
+ className: "ask-panel",
571
+ id: bodyId,
572
+ "data-ask-index": index,
573
+ "data-ask-key": item.key,
574
+ hidden: !open,
575
+ children: [
576
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ask-question", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-text", children: item.question }) }),
577
+ item.options.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ask-options", role: item.multiSelect ? "group" : "radiogroup", children: item.options.map((option) => {
578
+ const picked = draft.picked.includes(option.label);
579
+ return /* @__PURE__ */ jsxRuntime.jsxs(
580
+ "button",
581
+ {
582
+ type: "button",
583
+ className: `ask-option${picked ? " picked" : ""}`,
584
+ role: item.multiSelect ? "checkbox" : "radio",
585
+ "aria-checked": picked,
586
+ title: option.description ?? "",
587
+ disabled: busy,
588
+ onClick: () => {
589
+ choose(option.label);
590
+ },
591
+ children: [
592
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-option-label", children: option.label }),
593
+ option.description === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-option-desc", children: option.description })
594
+ ]
595
+ },
596
+ option.label
597
+ );
598
+ }) }) : null,
599
+ item.freeText ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ask-free", children: /* @__PURE__ */ jsxRuntime.jsx(
600
+ "input",
601
+ {
602
+ className: "ask-input",
603
+ "data-ask-input": index,
604
+ autoFocus: item.options.length === 0,
605
+ placeholder: item.multiSelect ? "可以多选,或在这里直接写答案" : "也可以直接写答案",
606
+ value: draft.free,
607
+ disabled: busy,
608
+ onChange: (event) => {
609
+ writeFree(event.target.value);
610
+ },
611
+ onKeyDown: onFreeKeyDown
612
+ }
613
+ ) }) : null
614
+ ]
615
+ },
616
+ item.key
617
+ ),
618
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-foot", hidden: !open, children: [
585
619
  items.length > 1 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-pager", children: [
586
620
  /* @__PURE__ */ jsxRuntime.jsx(
587
621
  "button",
@@ -0,0 +1,8 @@
1
+ {
2
+ "apiVersion": "0.8.1",
3
+ "file": "client.js",
4
+ "platforms": [
5
+ "web"
6
+ ],
7
+ "api": "^0.8.1"
8
+ }