@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
@@ -0,0 +1,240 @@
1
+ /**
2
+ * 契约分域:plugin
3
+ *
4
+ * 从 `src/contract.ts` 拆出来的一个域(纯搬移,逐字未改)。调用方照旧 import
5
+ * `../contract.js`——那份文件现在只做转出,导出面一个没少。
6
+ *
7
+ * @module dsc/contract/plugin
8
+ */
9
+ import type { Modality, ThinkingLevel } from './mode.js';
10
+ /** 分叉结果:成功时带新会话的 jsonl 路径,UI 拿它直接切过去。 */
11
+ export type SessionForkResult = {
12
+ ok: true;
13
+ path: string;
14
+ } | {
15
+ ok: false;
16
+ error: string;
17
+ };
18
+ /** 插件管理页的一行(内置/外部统一投影;宿主启动时扫描的快照)。 */
19
+ export interface PluginInfoView {
20
+ /** 开关键:外部插件为文件名,内置为插件名。 */
21
+ file: string;
22
+ /** 显示名(外部插件取其 name 导出,缺省为去后缀文件名)。 */
23
+ name: string;
24
+ description: string;
25
+ enabled: boolean;
26
+ source: 'builtin' | 'external';
27
+ /** true = 有开关可拨(外部插件 + 官方可开关插件);false = 运行内核,不可停用。 */
28
+ toggleable: boolean;
29
+ /** 这个插件贡献的设置分区 id;undefined = 没有可配置项,详情页不画配置表单。 */
30
+ settingsSection?: string;
31
+ /** 插件声明的内核 API 版本;未声明时 undefined。 */
32
+ apiVersion?: number;
33
+ /** 加载失败/被自动停用的原因(回滚说明),正常时 undefined。 */
34
+ problem?: string;
35
+ /** 这个插件来自哪个组合包(bundle);单文件插件没有这一项。 */
36
+ bundle?: string;
37
+ /**
38
+ * 插件声明的 dsh 客户端(界面)能力名,**只列不加载**。
39
+ *
40
+ * dsh 的界面插件要一份 dsh 自己的客户端运行时,Pneuma 的壳是另一套契约,
41
+ * 真加载等于在页面里跑第二个框架。所以插件中心只把「它想让界面做什么」列出来。
42
+ */
43
+ clientCapabilities?: string[];
44
+ }
45
+ /**
46
+ * 第三方界面插件「装不上」的原因分档(`UiTrustView.problem` 的机器可读标签):
47
+ *
48
+ * - `manifest`:plugin.json 缺失、或没写 api(第三方必须声明区间);
49
+ * - `clash`:id 与内置插件撞名(第三方这份让路);
50
+ * - `version`:api 区间与当前壳不符(含 workspace: 前缀与非法区间);
51
+ * - `artifact`:plugin.json 声明齐了,但 ui/client.js 读不到。
52
+ *
53
+ * 为什么要有这一项:`problem` 是给人看的句子,界面按档画「下一步做什么」时**不许去猜
54
+ * 句子里有没有某个词**——档位在判定现场就知道,由判定的人标出来,两处文案才不互相绑架。
55
+ */
56
+ export type UiTrustProblemKind = 'manifest' | 'clash' | 'version' | 'artifact';
57
+ /**
58
+ * 界面插件的一条状态(插件中心「第三方界面插件」与「组合包界面」两张卡的数据源)。
59
+ *
60
+ * 两类来源,判定与装载的路是同一套,只有「凭什么算同意」不同:
61
+ *
62
+ * - `third-party`:`~/.dsc/plugins/<目录名>/{plugin.json, ui/client.js}`,手工放进去的,
63
+ * 首次发现要用户在插件中心答一次信任(写 plugins.json 的 `uiTrust`);
64
+ * - `package`:profile 里用 `numa plugin add` 装的组合包,`package.json` 的
65
+ * `dsh.client.platform = 'pneuma'` 声明界面半边——**装它那一步就是同意**,不再问。
66
+ * 启停键是 `<包名>/client`。
67
+ *
68
+ * 与宿主插件(`PluginInfoView`)不是一回事:那些住 `~/.dsc/plugins/*.js`,这份是界面半边。
69
+ */
70
+ export interface UiTrustView {
71
+ /** 目录名(第三方)或包名(组合包,可能带 `@scope/`);启停键的前半段。 */
72
+ name: string;
73
+ /**
74
+ * 启停键(plugins.json 条目树的 `file`):第三方 `<目录名>/ui/client.js`、
75
+ * 组合包 `<包名>/client`。界面别自己拼——两种形状不同,拼错就写成一条没人读的开关。
76
+ */
77
+ key: string;
78
+ /** 这一行的来源(决定卡片怎么讲「凭什么算同意」)。 */
79
+ origin: 'third-party' | 'package';
80
+ /**
81
+ * 包的版本号(`package.json` 的 `version`)。只有组合包行有:第三方目录是用户手工放的,
82
+ * 没有版本这个概念,一律 undefined——界面别拿空串占位,那会让「没版本」和「版本是空」混起来。
83
+ */
84
+ version?: string;
85
+ /** 装在哪个 profile(profile 目录名,如 `work`)。只有组合包行有;界面用它说清「来源」。 */
86
+ profile?: string;
87
+ /** plugin.json / `dsh.client` 声明的 `@dsc/ui` 版本区间;没写/读不到时 undefined。 */
88
+ api?: string;
89
+ /** 声明的载体(web/tui);缺省 `['web']`。 */
90
+ platforms: string[];
91
+ /** 有没有信任记录。组合包恒为 true(装进 profile 就是同意);第三方看 `uiTrust`。 */
92
+ trusted: boolean;
93
+ /** 答应的时刻(毫秒);组合包与未信任的第三方都没有这一项。 */
94
+ trustedAt?: number;
95
+ /** 启停开关(plugins.json entries,键见 `key`)。 */
96
+ enabled: boolean;
97
+ /** 现在装不上的原因(缺声明 / 没写 api / 与内置撞名 / api 区间不匹配 / 入口读不到);能装时 undefined。 */
98
+ problem?: string;
99
+ /** `problem` 属于哪一档;没有 problem 时 undefined(界面按档给下一步动作)。 */
100
+ problemKind?: UiTrustProblemKind;
101
+ }
102
+ /** 一个队友(智能体团队派出去的子智能体);侧栏「队友」这一档看到的行。 */
103
+ export interface TeammateView {
104
+ /** 队友名,例如 writer-1。 */
105
+ name: string;
106
+ /** 角色名,例如 writer。 */
107
+ role: string;
108
+ /** working = 正在干;idle = 干完待命;stopped = 被打断;failed = 出错。 */
109
+ state: 'working' | 'idle' | 'stopped' | 'failed';
110
+ /** 派给它的任务(截短了的)。 */
111
+ task: string;
112
+ /** 它的运行记录文件(只读查看用)。 */
113
+ file: string;
114
+ /** 谁派了它:'lead' = 主会话派的。 */
115
+ parent: string;
116
+ /** 第几层:1 = Lead 的直属队友。 */
117
+ depth: number;
118
+ /** 已发起的模型请求轮数。 */
119
+ rounds: number;
120
+ startedAt: number;
121
+ finishedAt?: number;
122
+ /**
123
+ * 出生会话 id(派它的那个会话,名册持久化下来的)。
124
+ * roster.json 是跨重启的台账,字段后加;老记录没有这一项,读档时按 undefined 处理。
125
+ */
126
+ sessionId?: string;
127
+ }
128
+ /** 可切换的模型(/model 补全与校验的数据源)。 */
129
+ export interface ModelChoiceView {
130
+ /** 可直接传给 /model 的完整值:`[端点/]模型名`。 */
131
+ value: string;
132
+ provider: string;
133
+ /** 端点的显示名(`displayName`;用户没填时等于 `provider`)——选择器的一级行画它。 */
134
+ providerDisplayName: string;
135
+ model: string;
136
+ /** 面板展示用说明(端点显示名 · 上下文窗口)。 */
137
+ description: string;
138
+ /** 上下文窗口(面板右侧标注用)。 */
139
+ contextWindow: number;
140
+ /** 这个模型支持的思考档位;思考面板据此收起不支持的档位。 */
141
+ thinkingLevels: ThinkingLevel[];
142
+ /** 这个模型能接受的输入类型。 */
143
+ modalities: Modality[];
144
+ }
145
+ /**
146
+ * 壳 `/` 菜单的一行。
147
+ *
148
+ * 只带元数据(名字 / 参数占位 / 说明 / 回合中能否用),handler 留在宿主注册表里——
149
+ * 壳不需要、也拿不到执行的实现,它只把名字回给 {@link DscRuntime.runUiCommand}。
150
+ */
151
+ export interface UiCommandView {
152
+ name: string;
153
+ /** 参数占位提示(空串 = 无参数)。 */
154
+ args: string;
155
+ description: string;
156
+ /**
157
+ * 中文短名(2–4 字),菜单第一列;缺省 = 这一行只显示英文名。
158
+ *
159
+ * 三端(桌面壳 / 手机 / TUI)都从这一份读,菜单文案就不会各写各的。菜单里**不再**
160
+ * 显示参数占位:命令选中后宿主已补一个空格,接着打就行,用法在 `/help` 里。
161
+ */
162
+ label?: string;
163
+ /**
164
+ * 这条命令要收一段自由输入(不是从候选里挑的参数)。
165
+ * 有它就表示:输入框回车时**不执行**,只把 `/<名字> ` 补进输入并显示 `hint`,
166
+ * 让用户在后面写要求;再按回车才带着写好的要求执行。
167
+ */
168
+ input?: {
169
+ hint: string;
170
+ };
171
+ /** 回合跑着时能不能用(`deny` 的行在菜单里标出来,派发那一步也由宿主再挡一次)。 */
172
+ duringTask: 'allow' | 'deny';
173
+ }
174
+ /** 技能来源标签(rank 小者赢得重名)。 */
175
+ export type SkillSourceLabel = 'project-dsc' | 'project-agents' | 'custom' | 'user-agents' | 'user-dsc' | 'user-dsh' | (string & {});
176
+ /** 技能清单一行(技能中心页与设置「技能」分区共用)。 */
177
+ export interface SkillInfoView {
178
+ /** kebab-case 名,同时是启停键。 */
179
+ name: string;
180
+ description: string;
181
+ /** frontmatter when-to-use(技能卡片第二行)。 */
182
+ whenToUse?: string;
183
+ source: SkillSourceLabel;
184
+ /** SKILL.md 绝对路径;插件注册的虚拟技能没有路径。 */
185
+ path?: string;
186
+ enabled: boolean;
187
+ /** 是否出现在模型可见目录里。 */
188
+ modelInvocable: boolean;
189
+ /** 是否注册成 `/技能名` 命令。 */
190
+ userInvocable: boolean;
191
+ /** false = 由插件注册、不可启停。 */
192
+ toggleable: boolean;
193
+ /** 发现或解析问题(名字非法、frontmatter 缺字段等),正常时 undefined。 */
194
+ problem?: string;
195
+ /** 项目技能还是全局技能:技能页按它分「全局 / 项目」两组(与 dsh 设置页同口径)。 */
196
+ scope?: 'project' | 'global';
197
+ /** 发现根目录(分组头显示「这批技能来自哪个目录」)。 */
198
+ root?: string;
199
+ }
200
+ /** 技能详情(正文按需读,不进模型目录)。 */
201
+ export interface SkillDetail extends SkillInfoView {
202
+ /** SKILL.md 去掉 frontmatter 之后的 markdown 正文。 */
203
+ content: string;
204
+ }
205
+ /** 技能读取结果。 */
206
+ export type SkillLoadResult = {
207
+ ok: true;
208
+ skill: SkillDetail;
209
+ } | {
210
+ ok: false;
211
+ error: string;
212
+ };
213
+ /** 一个技能市场源。 */
214
+ export interface MarketSource {
215
+ name: string;
216
+ url: string;
217
+ }
218
+ /** 市场源的健康投影(失败源保留错误原因,UI 才看得见为什么空)。 */
219
+ export interface MarketSourceView extends MarketSource {
220
+ ok: boolean;
221
+ error?: string;
222
+ }
223
+ /** 市场里的一条可安装技能。 */
224
+ export interface MarketSkillView {
225
+ name: string;
226
+ description: string;
227
+ /** 所属市场源名。 */
228
+ source: string;
229
+ version?: string;
230
+ /** 本地 ~/.dsc/skills 里是否已有同名技能。 */
231
+ installed: boolean;
232
+ }
233
+ /** 一次市场浏览的结果(当前源的条目 + 全部源的状态)。 */
234
+ export interface MarketBrowseResult {
235
+ sources: MarketSourceView[];
236
+ /** 本次条目来自哪个源。 */
237
+ source: string;
238
+ items: MarketSkillView[];
239
+ error?: string;
240
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,282 @@
1
+ /**
2
+ * 契约分域:runtime
3
+ *
4
+ * 从 `src/contract.ts` 拆出来的一个域(纯搬移,逐字未改)。调用方照旧 import
5
+ * `../contract.js`——那份文件现在只做转出,导出面一个没少。
6
+ *
7
+ * @module dsc/contract/runtime
8
+ */
9
+ import type { ApprovalRequestView } from './approval.js';
10
+ import type { ApprovalPolicy, ApprovalReviewer, CollaborationMode, EffortLevel, SandboxMode } from './mode.js';
11
+ import type { AskUserView, BackgroundWorkView, GoalView, PlanEntryView, PlanView, ScheduledTaskView, TodoView } from './task.js';
12
+ import type { ContextSegmentsView } from './transcript.js';
13
+ import type { TokenUsageView } from './usage.js';
14
+ /**
15
+ * 底部状态行数据:只放对话引擎自己的事实(哪条会话、哪个模型、这一轮在干什么)。
16
+ * 某个功能点的状态(权限模式、协作模式、审批卡……)不进这里,由那个功能点自己
17
+ * 往 {@link RuntimeSnapshot.surfaces} 里贡献自己那一块。
18
+ */
19
+ export interface StatusView {
20
+ sessionId: string | null;
21
+ /** 当前模型名;未知时 'unknown'。**裸名**(不带端点前缀)——它属于哪个端点看 {@link provider}。 */
22
+ model: string;
23
+ /**
24
+ * 当前模型属于哪个端点(config.yaml 里那一节的 `name`)。
25
+ *
26
+ * 为什么界面需要它:`model` 是裸名,而同一个模型 id 可以挂在两个端点下(`value` 才是
27
+ * `端点/模型`)。光有裸名,界面既画不出「这个模型是从哪来的」,也分不清清单里哪一条
28
+ * 才该打勾——0.6.71 输入区模型菜单的勾选基本不出现,根子就在这儿。
29
+ * 端点信息拿不到时是 undefined:这类值一律原样显示,不猜。
30
+ */
31
+ provider?: string;
32
+ effort: EffortLevel;
33
+ turnState: 'idle' | 'thinking' | 'working' | 'awaiting-approval';
34
+ usage: TokenUsageView | null;
35
+ /** 当前模型的上下文窗口(状态栏 context 进度条的分母;未知 0 = 不画刻度)。 */
36
+ contextWindow: number;
37
+ /**
38
+ * 最近一次请求的 prompt_tokens(权威占用读数,读数与空闲段按它算)。
39
+ * 为什么不用 usage 累计:那是整会话的计费和,多轮会把早已滚出窗口的内容也算进去,
40
+ * 条只会虚胖。还没有任何请求回过用量时为 0。
41
+ */
42
+ contextUsed: number;
43
+ /** 最近一次请求组装的内容类型分段(估算;没有请求记录时全 0 = 条上只有空闲段)。 */
44
+ contextSegments: ContextSegmentsView;
45
+ /**
46
+ * 会话进度:轮数 = 用户消息数(压缩摘要不算),步数 = 助手消息数(每次模型调用一步)。
47
+ *
48
+ * 口径对齐 dsh 的 `sessionStats`(turns:有回复的轮;steps:助手节点数),由宿主数
49
+ * 会话消息得出——界面不再自己按条目猜。还没有任何消息时是 `{0,0}`。
50
+ */
51
+ progress: {
52
+ turns: number;
53
+ steps: number;
54
+ };
55
+ /**
56
+ * 当前这一轮从哪一刻开始(最后一条非插话的用户消息 ts,毫秒);没在跑 = 不带这个字段。
57
+ *
58
+ * 为什么由宿主算(2026-10-30 报障):消息流末尾原来挂一行「正在调用 x,用时 31 分 49 秒」,
59
+ * 与过程组头说的是同一件事。那一行撤掉之后,用时改在底部状态栏显示——状态栏是独立插件,
60
+ * 读不到消息流,只能由宿主把这一个数摆进快照。
61
+ */
62
+ turnStartedAt?: number;
63
+ /**
64
+ * 正在压缩上下文时的时间戳(毫秒);没有这个字段 = 此刻没在压。
65
+ *
66
+ * 为什么界面需要它(0.7.2,2026-10-29 报障):`/compact` 要调一次模型做摘要,快的时候
67
+ * 几秒、慢的时候几十秒,这段时间会话里**一条消息都不动**,用户以为命令没生效。
68
+ * dsh 的做法是在消息流尾部挂一条「compact · 正在压缩…」的活动行;这里只给事实
69
+ * (什么时候开始的),动画与文案由界面自己画。
70
+ */
71
+ compactingSince?: number;
72
+ /**
73
+ * 会话费用估算(人民币):只有当 provider 是 DeepSeek 官方且模型在价目表里、
74
+ * 且至少回过一笔用量时才有。峰谷按北京时段分桶计价(见 core/pricing)。
75
+ */
76
+ cost?: {
77
+ total: number;
78
+ peakNow: boolean;
79
+ };
80
+ /** 当前会话的工作目录(状态栏显示;快照组装自 session.meta.cwd)。 */
81
+ cwd?: string;
82
+ /**
83
+ * 当前会话的 jsonl 绝对路径。sessionId 是 uuid,拿它当文件用会按进程 cwd
84
+ * 解析出 ENOENT(/fork 0.6.65 实锤)——需要落盘路径的命令一律用这个。
85
+ */
86
+ sessionPath?: string;
87
+ /**
88
+ * 当前会话一条消息都还没发过(日志还没落盘)。
89
+ *
90
+ * 为什么界面要知道:这种会话没有稳定身份——它一旦不是当前会话就既不进侧栏、路径也换新的,
91
+ * 输入框的草稿按路径分坑就会跟着丢(0.6.70 报障)。壳据此把这类会话的草稿记在工作区名下
92
+ * (见 ui-shell 的 plugins/composer/draft.ts)。
93
+ */
94
+ sessionUnsaved?: boolean;
95
+ }
96
+ /** 档位按钮的一项:档位 id + 按钮文字 + 悬浮说明。 */
97
+ export interface TierOption<T extends string> {
98
+ id: T;
99
+ label: string;
100
+ hint: string;
101
+ }
102
+ /**
103
+ * 协作模式投影:当前档位 + 可切的档位清单。
104
+ * 清单由 mode 插件给出,界面因此不必自己抄一份四档表。
105
+ */
106
+ export interface ModeSurface {
107
+ current: CollaborationMode;
108
+ options: TierOption<CollaborationMode>[];
109
+ }
110
+ /**
111
+ * 权限投影:当前档位 + 可切档位清单 + 当前审阅者 + 可切审阅者清单。
112
+ * 两根轴各给一份清单,界面因此不必自己抄一份档位表(清单只在 approval 插件里有一份)。
113
+ */
114
+ export interface PolicySurface {
115
+ current: ApprovalPolicy;
116
+ options: TierOption<ApprovalPolicy>[];
117
+ /** 「要问的事」现在给谁答。 */
118
+ reviewer: ApprovalReviewer;
119
+ reviewerOptions: TierOption<ApprovalReviewer>[];
120
+ }
121
+ /**
122
+ * 一个打包权限预设:把**沙箱档位**与**权限模式 + 审阅者**捆成一组,
123
+ * 界面上是「一颗旋钮同时管三件事」——分开选就会出现「完全访问 + 沙箱仍 workspace-write」
124
+ * 这种自相矛盾的组合(参考实现里预设 = 沙箱 + 审批 一对,此处再加上审阅者这一轴)。
125
+ */
126
+ export interface PermissionPresetView {
127
+ /** 预设标识(小写字母数字连字符)。 */
128
+ name: string;
129
+ /** 界面上的显示名。 */
130
+ label: string;
131
+ description: string;
132
+ /** 捆进来的沙箱档位。 */
133
+ sandbox: SandboxMode;
134
+ /** 捆进来的权限模式。 */
135
+ policy: ApprovalPolicy;
136
+ /** 捆进来的审阅者。 */
137
+ reviewer: ApprovalReviewer;
138
+ /** 出厂自带(删不掉,改不了)。 */
139
+ builtin: boolean;
140
+ }
141
+ /** 打包权限预设投影:当前生效的 + 新会话默认的 + 全部可选。 */
142
+ export interface PermissionPresetSurface {
143
+ /**
144
+ * 当前生效的预设名;两个旋钮的组合不匹配任何预设时为 `'custom'`
145
+ * (推导出来的状态,可以离开它,但不能选它——参考实现同义)。
146
+ */
147
+ current: string;
148
+ /** 新会话默认的预设名。 */
149
+ defaultName: string;
150
+ options: PermissionPresetView[];
151
+ }
152
+ /**
153
+ * 一个模式(预设)的投影:`~/.dsc/presets/<名字>.md` 一个文件读出来的那份声明。
154
+ * 界面上「查看配置」看的是文件原文(`readPreset`),这份投影只给卡片要用的字段。
155
+ */
156
+ export interface PresetView {
157
+ /** 模式标识(小写字母数字连字符)。 */
158
+ name: string;
159
+ /** 界面上的显示名。 */
160
+ label: string;
161
+ description: string;
162
+ /** 工具白名单;null = 全量,空数组 = 一个工具都不给。 */
163
+ tools: string[] | null;
164
+ /** 要去掉的骨架提示段 id。 */
165
+ drop: string[];
166
+ /** true = 正文替换整个系统提示(只留正文与 AGENTS.md 注入)。 */
167
+ replace: boolean;
168
+ /** 正文 = 这个模式追加给模型的提示词(编辑表单要拿它当初始值)。 */
169
+ prompt: string;
170
+ /** 出厂自带的四个之一(界面标「内置」,删不掉)。 */
171
+ builtin: boolean;
172
+ /** 文件有问题时的说明(例如 frontmatter 坏了、drop 里写了不认识的段)。 */
173
+ problem?: string;
174
+ }
175
+ /**
176
+ * 模式投影:当前会话用的 + 新会话默认用的 + 全部可选。
177
+ * 清单由 presets 插件给出,界面因此不必自己抄一份四个模式的名字。
178
+ */
179
+ export interface PresetSurface {
180
+ /** 当前会话用的模式名。 */
181
+ current: string;
182
+ /** 新会话默认用的模式名。 */
183
+ defaultName: string;
184
+ options: PresetView[];
185
+ /** 允许模式去掉的骨架提示段(界面画勾选框):名单只在 core/presets.ts 里有一份。 */
186
+ droppable: Array<{
187
+ id: string;
188
+ label: string;
189
+ }>;
190
+ }
191
+ /** 一个工具在界面上的投影(设置 → 模式 的工具多选;只读,不带 run)。 */
192
+ export interface ToolEntryView {
193
+ name: string;
194
+ /** 风险档:read 自动放行,write / exec 要过审批。 */
195
+ risk: 'read' | 'write' | 'exec';
196
+ description: string;
197
+ /** 只在列出的模式里露面;不写 = 所有模式都能看见它。 */
198
+ presets?: string[];
199
+ }
200
+ /** 读一个模式文件原文的结果(「查看配置」用;失败时 error 是给用户看的一句话)。 */
201
+ export type PresetFileView = {
202
+ ok: true;
203
+ name: string;
204
+ text: string;
205
+ } | {
206
+ ok: false;
207
+ error: string;
208
+ };
209
+ /** 新建或编辑一个模式的入参。 */
210
+ export interface PresetDraft {
211
+ /** null = 新建;否则是被编辑模式的原名(支持改名)。 */
212
+ oldName: string | null;
213
+ name: string;
214
+ label: string;
215
+ description: string;
216
+ /** 工具白名单;null = 全量。 */
217
+ tools: string[] | null;
218
+ drop: string[];
219
+ /** 省略 = 沿用旧文件里的值(表单还没暴露这一项)。 */
220
+ replace?: boolean;
221
+ /** 正文 = 这个模式追加给模型的提示词。 */
222
+ prompt: string;
223
+ }
224
+ /**
225
+ * 当前工作区的 git 读数(git 插件贡献):在哪个分支、脏不脏。
226
+ *
227
+ * 输入框上那颗分支钮(壳 `plugins/composer`)与状态面板的分支行都读它。宿主**轻读**
228
+ * (一条分支名 + 一条 `git status --porcelain -z` 数条数);状态面板那条重读(每文件
229
+ * 增删行数、未跟踪文件按内容数行)留在壳里自己按更松的节奏走。
230
+ */
231
+ export interface GitSurface {
232
+ /** 当前会话工作目录是不是 git 仓库。false 时其余字段按空处理,界面整块不画。 */
233
+ repo: boolean;
234
+ /** 分支名;HEAD 分离时给短 hash;仓库里一次提交都还没有时给 `(无提交)`。 */
235
+ branch: string;
236
+ /** true = HEAD 分离(`branch` 那一栏是 hash,不是分支名)。 */
237
+ detached: boolean;
238
+ /** 工作目录内有改动的文件数(含未跟踪;口径与「变更」页签一致)。 */
239
+ dirtyFileCount: number;
240
+ }
241
+ /**
242
+ * 快照里由各功能点贡献的界面片段。
243
+ *
244
+ * 内置那几项由对应插件自己登记(`ctx.surfaces.register`),组装快照的那一层不认识任何具体功能。
245
+ * 外部插件要加自己那一块就用声明合并,不要往上面塞字段:
246
+ * `declare module '@dsc/runtime/contract.js' { interface RuntimeSurfaces { memory: MyView } }`。
247
+ */
248
+ export interface RuntimeSurfaces {
249
+ /** 当前分支与改动计数(git 贡献);输入框那颗分支钮与状态面板的分支行读它。 */
250
+ git: GitSurface;
251
+ /** 挂起的审批卡(approval 贡献);同一时刻至多一张。 */
252
+ pendingApproval: ApprovalRequestView | null;
253
+ /** 权限模式与可切档位(approval 贡献)。 */
254
+ policy: PolicySurface;
255
+ /**
256
+ * 打包权限预设(permission-presets 贡献):沙箱 + 权限模式 + 审阅者 三合一。
257
+ * 输入框那颗权限旋钮与设置页都读它——分开选会出现「完全访问 + 沙箱仍工作区可写」
258
+ * 这种自相矛盾的组合,预设把它们锁在一起。
259
+ */
260
+ permissionPresets: PermissionPresetSurface;
261
+ /** 协作模式与可切档位(mode 贡献)。 */
262
+ mode: ModeSurface;
263
+ /** 模式(预设)与可切清单(presets 贡献)。 */
264
+ preset: PresetSurface;
265
+ /** 任务清单(todo 贡献);没有任务时 items 为空数组。 */
266
+ todos: TodoView;
267
+ /** 挂着等用户批的计划(plan 贡献);null = 无。 */
268
+ pendingPlan: PlanView | null;
269
+ /** 会话目标(goal 贡献);null = 没设目标。 */
270
+ goal: GoalView | null;
271
+ /** 模型发起的提问(ask 贡献);同一时刻至多一个,它自己可能带一批题目(见 AskUserView.questions)。 */
272
+ pendingQuestion: AskUserView | null;
273
+ /** 正在跑的后台作业与终端会话(tools-default 贡献):只出当前查看会话起的,没有就是空数组。 */
274
+ backgroundWorks: BackgroundWorkView[];
275
+ /** 本会话提交过的计划目录(plan 贡献):最新在前,上限 12;待批的那份不在其中。 */
276
+ planDirectory: PlanEntryView[];
277
+ /**
278
+ * 定点任务(schedule 贡献)。**可选**:schedule 插件默认关着,
279
+ * 关着时这份投影整个缺席(界面按空处理,与「未登记的键缺席」同一约定)。
280
+ */
281
+ scheduled?: ScheduledTaskView[];
282
+ }
@@ -0,0 +1 @@
1
+ export {};