@kabmo-labs/kabmo 0.42.0 → 0.42.2

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 (195) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +592 -593
  3. package/dist/client/static/js/{CsvGrid-20k047ht.js → CsvGrid-g6rek8y9.js} +1 -1
  4. package/dist/client/static/js/{DocxView-qpvhfcmg.js → DocxView-41t9ryws.js} +2 -2
  5. package/dist/client/static/js/{DrawioView-178skky8.js → DrawioView-mfxhfz1h.js} +1 -1
  6. package/dist/client/static/js/{ImageView-460th5qa.js → ImageView-bxqw3t4k.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-5cv0dty8.js → LayoutWrapper-zt14rv9m.js} +2 -2
  8. package/dist/client/static/js/{Modal-wks6p4r5.js → Modal-cm35g20x.js} +10 -10
  9. package/dist/client/static/js/{PdfView-y51g03nr.js → PdfView-bek8k888.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-rsmvn7ks.js → SessionsView-gn53zyn7.js} +1 -1
  11. package/dist/client/static/js/{SheetView-z7yvb05v.js → SheetView-vezssf6b.js} +1 -1
  12. package/dist/client/static/js/{SvgPreview-yehgzhem.js → SvgPreview-f1qaw73k.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-6zxpcy8b.js → abnfDiagram-O67JEVCF-4qn94h52.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-cagtcfhk.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-m98sgh3c.js → architectureDiagram-NJMV4G6O-tbewzdya.js} +3 -3
  16. package/dist/client/static/js/{blockDiagram-BEXU5L5S-cp7rervg.js → blockDiagram-BEXU5L5S-njgnwckz.js} +2 -2
  17. package/dist/client/static/js/{c4Diagram-YGBWAQC7-t31recqm.js → c4Diagram-YGBWAQC7-f58pcvbk.js} +1 -1
  18. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-fy8x3dkx.js → classDiagram-v2-NBCMYWYE-52g73vyw.js} +3 -3
  19. package/dist/client/static/js/{cose-bilkent-JH36ORCC-va7ybm9e.js → cose-bilkent-JH36ORCC-ptdnshzh.js} +1 -1
  20. package/dist/client/static/js/cynefin-OW5HDTMX-6g2ydrss.js +1 -0
  21. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-4k0k429c.js → cynefinDiagram-VND7K2PF-qabfdkzr.js} +1 -1
  22. package/dist/client/static/js/{dagre-6A5THRUB-ykdhxq6t.js → dagre-6A5THRUB-kyf5jetf.js} +2 -2
  23. package/dist/client/static/js/{diagram-22UHCM2B-5nvwx7b6.js → diagram-22UHCM2B-bxrsjtv9.js} +4 -4
  24. package/dist/client/static/js/{diagram-3UASUU5V-hc7zsjgw.js → diagram-3UASUU5V-0f41s00j.js} +1 -1
  25. package/dist/client/static/js/{diagram-ATOU4E4O-97ae07y7.js → diagram-ATOU4E4O-0z1zx9h1.js} +1 -1
  26. package/dist/client/static/js/{diagram-CDSNMT55-b56nnbbs.js → diagram-CDSNMT55-znrmr6bk.js} +3 -3
  27. package/dist/client/static/js/{diagram-MLGK6HIB-37rygr9k.js → diagram-MLGK6HIB-jfe2jhk0.js} +1 -1
  28. package/dist/client/static/js/{diagram-MPIPVDR6-wv3vhhfk.js → diagram-MPIPVDR6-2kaawmwa.js} +1 -1
  29. package/dist/client/static/js/{dockerfile-0efb1z6e.js → dockerfile-12exatm9.js} +1 -1
  30. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-13fv7vxg.js → ebnfDiagram-ZINNZB2B-s5n37rfp.js} +1 -1
  31. package/dist/client/static/js/{elixir-mabagxwa.js → elixir-szk51ehr.js} +1 -1
  32. package/dist/client/static/js/{elk-276RUBZZ-xam60ktz.js → elk-276RUBZZ-433rd9fp.js} +1 -1
  33. package/dist/client/static/js/{erDiagram-OPXOYQCR-24ctv2ee.js → erDiagram-OPXOYQCR-key6ah0b.js} +2 -2
  34. package/dist/client/static/js/eventmodeling-NTZA5JFV-b774qbn2.js +1 -0
  35. package/dist/client/static/js/flowDiagram-KWPJA3E3-nznq0n36.js +1 -0
  36. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-766a8fqw.js → ganttDiagram-FUAMR5RP-4efkhmca.js} +2 -2
  37. package/dist/client/static/js/gitGraph-4MIJSDKK-b047d6vk.js +1 -0
  38. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-fmwjkgh6.js → gitGraphDiagram-X574FWY7-ac376y2k.js} +1 -1
  39. package/dist/client/static/js/html-tbz83eke.js +1 -0
  40. package/dist/client/static/js/{index-13xbwcbz.js → index-02543wk3.js} +1 -1
  41. package/dist/client/static/js/{index-sx809d6d.js → index-0e9nkc0g.js} +1 -1
  42. package/dist/client/static/js/{index-1c0pnsjd.js → index-0gbj4270.js} +1 -1
  43. package/dist/client/static/js/{index-z6kpc98a.js → index-0pabfaac.js} +1 -1
  44. package/dist/client/static/js/{index-4mstdh41.js → index-1t5ybx9v.js} +1 -1
  45. package/dist/client/static/js/{index-9vdbnvmk.js → index-1y3rzw6b.js} +1 -1
  46. package/dist/client/static/js/{index-qj34r6d0.js → index-38xv8h4t.js} +1 -1
  47. package/dist/client/static/js/{index-4j8rgr4p.js → index-50mdqev0.js} +1 -1
  48. package/dist/client/static/js/{index-zvazj4va.js → index-5jnvz9hw.js} +1 -1
  49. package/dist/client/static/js/{index-97qst4k9.js → index-77t0nvt1.js} +1 -1
  50. package/dist/client/static/js/{index-x7f5ysch.js → index-7a2efrbj.js} +1 -1
  51. package/dist/client/static/js/{index-yvxa7hd8.js → index-82vk27q1.js} +1 -1
  52. package/dist/client/static/js/{index-nbexks3x.js → index-8k7vjp8b.js} +1 -1
  53. package/dist/client/static/js/{index-sq3r1xhf.js → index-8kbp24xg.js} +1 -1
  54. package/dist/client/static/js/{index-zjydzxhm.js → index-b0v6gwym.js} +2 -2
  55. package/dist/client/static/js/{index-grczkttn.js → index-b42t14wk.js} +7 -7
  56. package/dist/client/static/js/{index-13dr1t1r.js → index-cz50ha6x.js} +23 -23
  57. package/dist/client/static/js/{index-8jqawh3r.js → index-dtj73vs1.js} +1 -1
  58. package/dist/client/static/js/{index-7t63akyt.js → index-dzmar8jr.js} +1 -1
  59. package/dist/client/static/js/{index-2x9eqztp.js → index-f33c4paw.js} +1 -1
  60. package/dist/client/static/js/{index-xxe52zrm.js → index-fb6pw9xb.js} +1 -1
  61. package/dist/client/static/js/{index-6ge6gk9w.js → index-gp57dx2v.js} +1 -1
  62. package/dist/client/static/js/{index-2hpy58d0.js → index-gsxebrq9.js} +2 -2
  63. package/dist/client/static/js/{index-czagykbq.js → index-pxtff3ez.js} +2 -2
  64. package/dist/client/static/js/{index-8hgm0abr.js → index-pzvr1699.js} +187 -183
  65. package/dist/client/static/js/{index-dydwcp3n.js → index-r9db1gsf.js} +1 -1
  66. package/dist/client/static/js/{index-b4y5g48d.js → index-raca8tsh.js} +1 -1
  67. package/dist/client/static/js/{index-95en3p3g.js → index-rf29f3fq.js} +4 -4
  68. package/dist/client/static/js/{index-sz3mxjvy.js → index-s4gv0rpk.js} +1 -1
  69. package/dist/client/static/js/{index-a9t9gdew.js → index-v3f7we4n.js} +4 -4
  70. package/dist/client/static/js/{index-ejdnjh5c.js → index-yjmm73jm.js} +1 -1
  71. package/dist/client/static/js/{index-1rxa9zxp.js → index-ykfd2fyj.js} +1 -1
  72. package/dist/client/static/js/{index-4z4ax55k.js → index-yzda8j2d.js} +6 -6
  73. package/dist/client/static/js/{index-vcn1kcpy.js → index-z78bzryw.js} +3 -3
  74. package/dist/client/static/js/{index-tqycj126.js → index-zndbhb9w.js} +1 -1
  75. package/dist/client/static/js/{index-ka2rc2cr.js → index-zs73zwjz.js} +3 -3
  76. package/dist/client/static/js/{index-xe5cqwnf.js → index-zs7sjv6x.js} +1 -1
  77. package/dist/client/static/js/{index-hzwr5fm9.js → index-zw621xez.js} +3 -3
  78. package/dist/client/static/js/info-A6RAGUB7-n495k952.js +1 -0
  79. package/dist/client/static/js/{infoDiagram-VRGFBTTK-tqytmzp1.js → infoDiagram-VRGFBTTK-4e7ej63f.js} +2 -2
  80. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-rp77ff6m.js → ishikawaDiagram-OU5B5YK6-k3yet1ec.js} +2 -2
  81. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-c7bxrhf1.js → journeyDiagram-ZHPQQLJL-qe352kyd.js} +2 -2
  82. package/dist/client/static/js/{kanban-definition-PNTS6WVX-j2pxewqq.js → kanban-definition-PNTS6WVX-58hag75n.js} +4 -4
  83. package/dist/client/static/js/{mermaid.core-cqqe1krg.js → mermaid.core-6e89h6vm.js} +2 -2
  84. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-s03k32p9.js → mindmap-definition-NLK3R4M7-ncsam2fm.js} +1 -1
  85. package/dist/client/static/js/one-dark-pro-qmyne0tn.js +1 -0
  86. package/dist/client/static/js/one-light-dj0ecjcj.js +1 -0
  87. package/dist/client/static/js/packet-AYTQ26CC-zajj62z6.js +1 -0
  88. package/dist/client/static/js/{pegDiagram-GJSIUBJH-dfg2j0zc.js → pegDiagram-GJSIUBJH-b5ckc39d.js} +1 -1
  89. package/dist/client/static/js/{perl-5vxax0nr.js → perl-dtn1fccw.js} +1 -1
  90. package/dist/client/static/js/{php-hgrgdq63.js → php-7av78hch.js} +1 -1
  91. package/dist/client/static/js/pie-WAS4IAKB-1ve78y5f.js +1 -0
  92. package/dist/client/static/js/{pieDiagram-5QR66LMP-pshd1j79.js → pieDiagram-5QR66LMP-s4d47ve8.js} +2 -2
  93. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-cvvvmtk2.js → quadrantDiagram-O4NWA36T-zm0ekvjz.js} +1 -1
  94. package/dist/client/static/js/radar-RG4KPBEZ-8rqadb58.js +1 -0
  95. package/dist/client/static/js/railroad-74A4TZTK-v6ppm8dy.js +1 -0
  96. package/dist/client/static/js/railroad-abnf-HS5TGJTU-9j6bae14.js +1 -0
  97. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-56cpyt0g.js +1 -0
  98. package/dist/client/static/js/railroad-peg-WCYAUIDC-yfdmspf4.js +1 -0
  99. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-h53p3sha.js → railroadDiagram-XR7U4H2S-52vdqf53.js} +1 -1
  100. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-bdv2fkxd.js → requirementDiagram-PLB6GJNP-7kf8bmk9.js} +1 -1
  101. package/dist/client/static/js/{ruby-8pxcn21w.js → ruby-s2bqr910.js} +1 -1
  102. package/dist/client/static/js/{rust-j80dxgjg.js → rust-q98kssv3.js} +1 -1
  103. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-xqnnvmhy.js → sankeyDiagram-IPEJSGJF-bcb9f54a.js} +1 -1
  104. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-3p67305f.js → sequenceDiagram-PO4LG4MO-76ywvj7g.js} +3 -3
  105. package/dist/client/static/js/{sizeCapture-INFHLROL-f87525h7.js → sizeCapture-INFHLROL-p9bsf5dc.js} +1 -1
  106. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-e5st1fy3.js → stateDiagram-v2-GCMORJYK-1ecfb3fs.js} +1 -1
  107. package/dist/client/static/js/{swimlanes-2SLR337P-ceghkbez.js → swimlanes-2SLR337P-2pyjr946.js} +1 -1
  108. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-vc8hvfya.js → swimlanesDiagram-TC7HE7FX-qr5hdxm4.js} +1 -1
  109. package/dist/client/static/js/{timeline-definition-EJHVYXUP-f7evs443.js → timeline-definition-EJHVYXUP-4csxwmn2.js} +3 -3
  110. package/dist/client/static/js/treeView-Q6P3EWNA-vwpg3wp8.js +1 -0
  111. package/dist/client/static/js/treemap-WGGIJYW6-htfxwd32.js +1 -0
  112. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-0gpn21p7.js → usecaseDiagram-POWQR4AR-0p1jnbsn.js} +7 -7
  113. package/dist/client/static/js/{vennDiagram-UO4OBE2U-4spzy428.js → vennDiagram-UO4OBE2U-y1hgdet4.js} +2 -2
  114. package/dist/client/static/js/{vue-xm1dxpmy.js → vue-cbqm4bed.js} +1 -1
  115. package/dist/client/static/js/wardley-WFR3VGLG-hapfjkzq.js +1 -0
  116. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-745xr2pa.js → wardleyDiagram-VNRHLVJA-p578yrgm.js} +2 -2
  117. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-7dr9qwx5.js → xychartDiagram-PMCCYNJV-b08b4ah0.js} +3 -3
  118. package/package.json +1 -1
  119. package/src/cli/lib/commands/session.js +12 -1
  120. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +14 -123
  121. package/src/client/components/workspace/chat-timeline/OrchestrationNotice.tsx +214 -0
  122. package/src/client/components/workspace/chat-timeline/UserTurn.test.tsx +126 -0
  123. package/src/client/components/workspace/chat-timeline/UserTurn.tsx +183 -0
  124. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody.tsx +3 -3
  125. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolRowActions.tsx +45 -0
  126. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/tool-view.ts +14 -4
  127. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Card.tsx +2 -12
  128. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Compact.tsx +42 -38
  129. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Minimal.tsx +25 -21
  130. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Trace.tsx +41 -29
  131. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +47 -43
  132. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/parity.test.tsx +136 -0
  133. package/src/client/hooks/chat/timeline/composer-modes.ts +10 -7
  134. package/src/client/hooks/chat/timeline/plan-review-republish.test.ts +121 -0
  135. package/src/client/hooks/chat/timeline/plan-review.ts +12 -3
  136. package/src/server/lib/harness/acp/acp-audit.server.ts +1 -1
  137. package/src/server/lib/harness/acp/session-exit.ts +39 -5
  138. package/src/server/lib/harness/acp/session-turns.ts +67 -12
  139. package/src/server/lib/harness/acp/session.test.ts +61 -0
  140. package/src/server/lib/harness/acp/session.ts +15 -25
  141. package/src/server/lib/harness/acp/turn-outcome.server.test.ts +97 -0
  142. package/src/server/lib/harness/acp/turn-outcome.server.ts +71 -0
  143. package/src/server/lib/harness/acp/turn-silence.ts +52 -0
  144. package/src/server/lib/harness/acp/turn.test.ts +85 -3
  145. package/src/server/lib/harness/acp/turn.ts +62 -4
  146. package/src/server/lib/lifecycle/after-listen.ts +10 -0
  147. package/src/server/lib/omp/rpc/frame-fold-contract.ts +21 -0
  148. package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +4 -0
  149. package/src/server/lib/omp/rpc/frame-fold.ts +25 -2
  150. package/src/server/lib/omp/rpc/manager.ts +9 -8
  151. package/src/server/lib/omp/rpc/retry-saga.ts +54 -0
  152. package/src/server/lib/omp/rpc/run-settle.server.ts +38 -5
  153. package/src/server/lib/omp/rpc/run-settle.test.ts +5 -2
  154. package/src/server/lib/omp/rpc/session-commands-dialog.test.ts +6 -20
  155. package/src/server/lib/omp/rpc/session-commands-mapping.test.ts +131 -0
  156. package/src/server/lib/omp/rpc/session-commands.test.ts +95 -116
  157. package/src/server/lib/omp/rpc/session-commands.ts +38 -17
  158. package/src/server/lib/omp/rpc/terminal-settle.test.ts +223 -0
  159. package/src/server/lib/omp/rpc/terminal-settle.ts +127 -29
  160. package/src/server/lib/omp/session/scan.ts +15 -2
  161. package/src/server/lib/omp/session/session-discovery.test.ts +21 -0
  162. package/src/server/lib/sessions/notify.server.test.ts +11 -3
  163. package/src/server/lib/sessions/notify.server.ts +67 -42
  164. package/src/server/lib/sessions/spawn.server.test.ts +5 -1
  165. package/src/server/lib/sessions/spawn.server.ts +8 -3
  166. package/src/server/routes/sessions/answer.test.ts +62 -0
  167. package/src/server/routes/sessions/answer.ts +13 -2
  168. package/src/shared/lib/chat/composer/delegation.ts +11 -7
  169. package/src/shared/lib/chat/export-markdown.ts +19 -0
  170. package/src/shared/lib/chat/orchestration/notice.test.ts +118 -0
  171. package/src/shared/lib/chat/orchestration/notice.ts +183 -0
  172. package/src/shared/lib/chat/timeline/omp-callbacks.ts +6 -1
  173. package/src/shared/lib/chat/timeline/tool-render-mode.ts +3 -3
  174. package/src/shared/lib/icons/tint-hues.generated.ts +36 -36
  175. package/src/shared/lib/omp/session/operator-title.test.ts +21 -0
  176. package/src/shared/lib/omp/session/operator-title.ts +28 -0
  177. package/dist/client/static/js/architecture-7GRP2DOG-9q06651f.js +0 -1
  178. package/dist/client/static/js/cynefin-OW5HDTMX-w7a38g4g.js +0 -1
  179. package/dist/client/static/js/eventmodeling-NTZA5JFV-6wrjccyw.js +0 -1
  180. package/dist/client/static/js/flowDiagram-KWPJA3E3-19vjkg84.js +0 -1
  181. package/dist/client/static/js/gitGraph-4MIJSDKK-4je2p50v.js +0 -1
  182. package/dist/client/static/js/html-bwyt0ayy.js +0 -1
  183. package/dist/client/static/js/info-A6RAGUB7-k0z5qdew.js +0 -1
  184. package/dist/client/static/js/one-dark-pro-9tt0a020.js +0 -1
  185. package/dist/client/static/js/one-light-5fg4r0ra.js +0 -1
  186. package/dist/client/static/js/packet-AYTQ26CC-6cnvmb2z.js +0 -1
  187. package/dist/client/static/js/pie-WAS4IAKB-m9z1mztn.js +0 -1
  188. package/dist/client/static/js/radar-RG4KPBEZ-8m9rkex6.js +0 -1
  189. package/dist/client/static/js/railroad-74A4TZTK-wc55emj8.js +0 -1
  190. package/dist/client/static/js/railroad-abnf-HS5TGJTU-2y2rnrzq.js +0 -1
  191. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-zzcc9x0v.js +0 -1
  192. package/dist/client/static/js/railroad-peg-WCYAUIDC-z82na5nb.js +0 -1
  193. package/dist/client/static/js/treeView-Q6P3EWNA-kzh6cm3f.js +0 -1
  194. package/dist/client/static/js/treemap-WGGIJYW6-wz5ed560.js +0 -1
  195. package/dist/client/static/js/wardley-WFR3VGLG-zewbfccz.js +0 -1
@@ -0,0 +1,183 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The text Kabmo itself injects into a transcript, and the one parser both ends
8
+ * read it with.
9
+ *
10
+ * Three prompts in a session are written by Kabmo, not by a human:
11
+ *
12
+ * - the orchestration contract the composer prepends to a delegating message
13
+ * (`formatDelegationPrompt`),
14
+ * - the dispatched-worker brief a spawned child opens with
15
+ * (`dispatchedWorkerPrompt`),
16
+ * - the child-outcome notice a finishing worker sends its coordinator
17
+ * (`renderChildOutcomeNotice`).
18
+ *
19
+ * All three travel as ordinary prompts, so omp stores them as `role: "user"`
20
+ * turns and the timeline drew them as the operator's own bubbles — a 1 KB
21
+ * contract, a shell heredoc and a worker report, indistinguishable from
22
+ * something a person typed. The envelope below is what makes them
23
+ * recognizable: the server writes it, the client parses it, and the timeline
24
+ * renders a card instead of a bubble.
25
+ *
26
+ * The envelope is also the FORMAT: a bracketed marker survives omp's JSONL
27
+ * round trip untouched (unlike a `customType`, which only a `custom_message`
28
+ * carries), and it reads as a labelled block to the model that consumes it.
29
+ */
30
+
31
+ /** Envelope markers. One pair per injected prompt; the closing tag repeats the
32
+ * opening name so a truncated body is still attributable. */
33
+ export const ORCHESTRATION_CONTRACT = {
34
+ open: '[kabmo orchestration contract]',
35
+ close: '[/kabmo orchestration contract]',
36
+ } as const;
37
+
38
+ export const WORKER_BRIEF = {
39
+ open: '[kabmo dispatched worker]',
40
+ close: '[/kabmo dispatched worker]',
41
+ } as const;
42
+
43
+ export const CHILD_OUTCOME = {
44
+ open: '[kabmo child outcome]',
45
+ close: '[/kabmo child outcome]',
46
+ } as const;
47
+
48
+ export type OrchestrationKind = 'contract' | 'worker' | 'outcome';
49
+
50
+ export interface OrchestrationBlock {
51
+ kind: OrchestrationKind;
52
+ /** The text between the markers — the injected instruction itself. */
53
+ body: string;
54
+ /** What followed the closing marker: the operator's own words, when the
55
+ * contract was prepended to a message they typed. Empty for a notice. */
56
+ rest: string;
57
+ }
58
+
59
+ const ENVELOPES: readonly { kind: OrchestrationKind; open: string; close: string }[] = [
60
+ { kind: 'contract', ...ORCHESTRATION_CONTRACT },
61
+ { kind: 'worker', ...WORKER_BRIEF },
62
+ { kind: 'outcome', ...CHILD_OUTCOME },
63
+ ];
64
+
65
+ /**
66
+ * Split a user turn into the injected block and the operator's own text.
67
+ *
68
+ * Returns null for anything a human wrote, so the caller keeps the ordinary
69
+ * bubble. A block whose closing marker is missing is NOT an envelope: a
70
+ * half-written marker is prose, and guessing would swallow the rest of the
71
+ * message.
72
+ */
73
+ export function parseOrchestrationBlock(content: string): OrchestrationBlock | null {
74
+ const text = content.trimStart();
75
+ for (const envelope of ENVELOPES) {
76
+ if (!text.startsWith(envelope.open)) continue;
77
+ const closeAt = text.indexOf(envelope.close, envelope.open.length);
78
+ if (closeAt === -1) return null;
79
+ return {
80
+ kind: envelope.kind,
81
+ body: text.slice(envelope.open.length, closeAt).trim(),
82
+ rest: text.slice(closeAt + envelope.close.length).trim(),
83
+ };
84
+ }
85
+ return null;
86
+ }
87
+
88
+ /** One worker's outcome, as the notice carries it. */
89
+ export interface ChildOutcomeEntry {
90
+ sessionId: string;
91
+ title?: string | null;
92
+ status: 'completed' | 'failed' | 'interrupted';
93
+ /** The child's final assistant text, already excerpted by the caller. */
94
+ output?: string | null;
95
+ /** Why it failed or was interrupted, when known. */
96
+ failure?: string | null;
97
+ }
98
+
99
+ /** Separator between two workers in one notice. */
100
+ const ENTRY_SEPARATOR = '\n---\n';
101
+
102
+ /** Longest reason line carried into the notice. A provider error can be a
103
+ * multi-kilobyte HTML page; the coordinator needs the first sentence. */
104
+ const MAX_REASON_CHARS = 600;
105
+
106
+ function reasonOf(entry: ChildOutcomeEntry): string {
107
+ const reason = (entry.failure ?? '').replace(/\s+/g, ' ').trim();
108
+ if (!reason) return entry.status === 'interrupted' ? 'The run was interrupted.' : 'The run failed.';
109
+ return reason.length <= MAX_REASON_CHARS ? reason : `${reason.slice(0, MAX_REASON_CHARS - 1)}…`;
110
+ }
111
+
112
+ function renderEntry(entry: ChildOutcomeEntry): string {
113
+ const lines = [`session: ${entry.sessionId}`, `status: ${entry.status}`];
114
+ const title = entry.title?.trim();
115
+ if (title) lines.push(`title: ${title.replace(/\s+/g, ' ').trim()}`);
116
+ if (entry.status === 'completed') {
117
+ lines.push('output:', entry.output?.trim() || 'No final output was recorded.');
118
+ return lines.join('\n');
119
+ }
120
+ lines.push(`reason: ${reasonOf(entry)}`);
121
+ // The coordinator's next move, stated once per failed worker: a report that
122
+ // only says "failed" invites a resend of the same task, which is how one
123
+ // broken worker became a loop. No `kabmo session output` pointer here — a
124
+ // failed run has no assistant answer to print, so the reason above IS the
125
+ // detail, and pointing at an empty command is a dead end.
126
+ lines.push('next: report this failure to the user instead of resending the task');
127
+ return lines.join('\n');
128
+ }
129
+
130
+ /**
131
+ * The notice body for one worker or a coalesced batch.
132
+ *
133
+ * One envelope, one entry per worker, `---` between them: the coordinator reads
134
+ * a list, and the timeline parses the same text into one card per worker.
135
+ */
136
+ export function renderChildOutcomeNotice(items: readonly ChildOutcomeEntry[]): string {
137
+ const body = items.map(renderEntry).join(ENTRY_SEPARATOR);
138
+ return `${CHILD_OUTCOME.open}\n${body}\n${CHILD_OUTCOME.close}`;
139
+ }
140
+
141
+ const STATUSES: Readonly<Record<string, ChildOutcomeEntry['status']>> = {
142
+ completed: 'completed',
143
+ failed: 'failed',
144
+ interrupted: 'interrupted',
145
+ };
146
+
147
+ /**
148
+ * Read a notice body back into entries.
149
+ *
150
+ * Tolerant by design: an unknown status is read as `failed` (a worker whose
151
+ * outcome cannot be classified is not a success), and a chunk with no
152
+ * `session:` line is dropped rather than rendered as a blank card.
153
+ */
154
+ export function parseChildOutcomeNotice(body: string): ChildOutcomeEntry[] {
155
+ const entries: ChildOutcomeEntry[] = [];
156
+ for (const chunk of body.split(ENTRY_SEPARATOR)) {
157
+ const lines = chunk.split('\n');
158
+ const fields = new Map<string, string>();
159
+ let output: string | null = null;
160
+ for (let index = 0; index < lines.length; index += 1) {
161
+ const line = lines[index] as string;
162
+ const match = /^([a-z]+):\s?(.*)$/.exec(line);
163
+ if (!match) continue;
164
+ const key = match[1] as string;
165
+ if (key === 'output') {
166
+ output = lines.slice(index + 1).join('\n').trim();
167
+ break;
168
+ }
169
+ fields.set(key, (match[2] as string).trim());
170
+ }
171
+ const sessionId = fields.get('session');
172
+ if (!sessionId) continue;
173
+ const status = STATUSES[fields.get('status') ?? ''] ?? 'failed';
174
+ entries.push({
175
+ sessionId,
176
+ status,
177
+ ...(fields.get('title') ? { title: fields.get('title') as string } : {}),
178
+ ...(output !== null ? { output } : {}),
179
+ ...(fields.get('reason') ? { failure: fields.get('reason') as string } : {}),
180
+ });
181
+ }
182
+ return entries;
183
+ }
@@ -16,6 +16,7 @@ import type { Dispatch, SetStateAction } from 'preact/compat';
16
16
  import type { ChatMessageData, ExtensionUiDialogRequest, IncomingExtensionUiRequest, OmpAgentCallbacks } from '@/shared/types';
17
17
  import { triggerChatCompletionSound } from '@/client/hooks/ui/notification-sound';
18
18
  import { isNoticeRow } from '@/shared/lib/chat/notice-row';
19
+ import { parseOrchestrationBlock } from '@/shared/lib/chat/orchestration/notice';
19
20
  import {
20
21
  bindStreamingCoalescer,
21
22
  disposeStreamingCoalescer,
@@ -150,10 +151,14 @@ export function createOmpAgentCallbacks(deps: OmpAgentCallbacksDeps): OmpAgentCa
150
151
  // user frame (a genuine steering delivery) appends normally
151
152
  // instead of reconciling into a row that is already final.
152
153
  optimisticUserIdRef.current = null;
154
+ // A delegating turn echoes the CONTRACT (the card), not the
155
+ // operator's sentence: keeping the optimistic text hid the card
156
+ // until a reload. See `orchestration/notice.ts`.
157
+ const echoed = typeof msg.content === 'string' ? msg.content : '';
153
158
  const reconciled: ChatMessageData = {
154
159
  ...msg,
155
160
  id: msg.id,
156
- content: prev[pIdx].content,
161
+ content: parseOrchestrationBlock(echoed) ? msg.content : prev[pIdx].content,
157
162
  date: prev[pIdx].date,
158
163
  attachments: msg.attachments?.length ? msg.attachments : prev[pIdx].attachments,
159
164
  };
@@ -15,8 +15,8 @@
15
15
  * - `compact` — one status line per call, facts inline, body inset on demand.
16
16
  * - `trace` — a vertical rail per section, one node per call.
17
17
  * - `minimal` — a faint line per call, read as part of the answer.
18
- * - `tui` — omp's own terminal frame: a rounded box drawn from glyphs,
19
- * with the header riding the top border.
18
+ * - `tui` — omp's terminal transcript: one coloured status line per
19
+ * call, the output hanging under a hairline.
20
20
  *
21
21
  * **The mode NAMES and the copy live here**; the markup lives in
22
22
  * `tool-renderers/styles/`. A mode added here without a renderer is a build
@@ -82,6 +82,6 @@ export const TOOL_RENDER_MODE_COPY: Record<ToolRenderMode, ToolRenderModeCopy> =
82
82
  tui: {
83
83
  label: 'TUI',
84
84
  description:
85
- "omp's terminal frame: a rounded box with the header on the top border, the way the TUI draws a call.",
85
+ "omp's terminal transcript: one coloured status line per call, with the output hanging under it.",
86
86
  },
87
87
  };
@@ -32,42 +32,42 @@ import type { PaperBucket } from '@/shared/lib/icons/icon-tone';
32
32
 
33
33
  export const ICON_HUES: Readonly<Record<string, number>> = {
34
34
  Activity: 240, AlignJustify: 100, AlignLeft: 150, Archive: 50, ArchiveRestore: 90, ArrowDown: 100,
35
- ArrowDownToLine: 330, ArrowLeft: 350, ArrowRight: 80, ArrowUp: 150, ArrowUpDown: 310, ArrowUpRight: 70,
36
- BarChart3: 150, BellRing: 260, Blocks: 110, Bot: 220, Box: 260, Boxes: 220,
37
- Brain: 350, BrainCircuit: 300, Briefcase: 310, Camera: 60, CaseSensitive: 110, ChevronDown: 120,
38
- ChevronLeft: 250, ChevronRight: 300, ChevronUp: 250, ChevronsUpDown: 80, Circle: 50, CircleCheck: 350,
39
- CircleDashed: 120, CircleDot: 240, ClipboardCopy: 280, ClipboardList: 290, ClipboardPaste: 200, Cloud: 340,
40
- CloudDownload: 300, Code: 200, Code2: 260, Coins: 210, Columns: 280, Columns2: 20,
41
- Command: 100, Component: 200, Copy: 320, CopyPlus: 40, CornerDownLeft: 10, Cpu: 250,
42
- Database: 280, Dice5: 50, Diff: 300, DollarSign: 220, Download: 210, DownloadCloud: 180,
43
- Edit2: 210, Ellipsis: 100, ExternalLink: 60, Eye: 20, EyeOff: 350, File: 310,
44
- FileCode: 260, FileCog: 340, FileDiff: 280, FileEdit: 270, FileImage: 40, FilePlus: 350,
45
- FilePlus2: 350, FileSearch: 310, FileText: 80, Files: 320, Flag: 350, FlaskConical: 170,
46
- Folder: 290, FolderGit: 190, FolderGit2: 190, FolderInput: 310, FolderOpen: 330, FolderPlus: 250,
47
- FolderSearch: 10, FolderTree: 10, Gamepad2: 300, GitBranch: 30, GitCommitVertical: 240, GitCompare: 340,
48
- GitFork: 30, GitMerge: 90, GitPullRequest: 10, Globe: 340, GraduationCap: 190, GripVertical: 350,
49
- Hammer: 310, Hand: 200, HardDrive: 0, Hash: 330, Heading: 250, Heart: 270,
50
- History: 110, Home: 20, Image: 140, Key: 240, KeyRound: 240, Keyboard: 120,
51
- Laptop: 170, Layers: 30, LayoutTemplate: 170, Leaf: 50, Library: 160, Lightbulb: 0,
52
- List: 170, ListChecks: 320, ListFilter: 230, ListOrdered: 220, ListTodo: 210, ListTree: 330,
53
- Loader2: 40, Lock: 220, LockKeyhole: 270, LockOpen: 180, LogIn: 140, LogOut: 190,
54
- Maximize: 310, Maximize2: 270, Menu: 100, MessageSquare: 150, MessageSquareOff: 40, MessageSquarePlus: 350,
55
- MessagesSquare: 220, Mic: 160, MicOff: 170, Minimize: 290, Minimize2: 130, Minus: 110,
56
- Monitor: 250, Moon: 80, MoreHorizontal: 160, MousePointerClick: 70, MoveVertical: 300, Music: 280,
57
- Package: 270, PackageOpen: 230, Paintbrush: 250, Palette: 320, PanelLeft: 280, PanelLeftClose: 160,
58
- PanelRight: 330, PanelRightClose: 350, Paperclip: 310, Pause: 10, Pencil: 0, PencilLine: 260,
59
- Pin: 0, PinOff: 50, Pipette: 120, Play: 310, Plug: 50, Plus: 210,
60
- Power: 340, Puzzle: 50, Quote: 110, Radio: 320, Ratio: 160, RefreshCw: 180,
61
- Regex: 280, Replace: 190, ReplaceAll: 140, Rocket: 210, RotateCcw: 330, RotateCw: 0,
62
- Rows: 160, Rows3: 250, Save: 40, SaveAll: 190, Scissors: 260, Search: 250,
63
- Send: 110, Server: 300, ServerCog: 50, Settings: 240, Settings2: 20, Shield: 160,
64
- Shrink: 160, Sliders: 290, SlidersHorizontal: 50, Smartphone: 20, Space: 290, Sparkles: 180,
65
- Square: 60, SquareFunction: 220, SquarePen: 10, Star: 170, StickyNote: 100, Store: 340,
66
- Sun: 90, Tablet: 290, Tag: 310, Target: 200, Terminal: 210, TextSelect: 220,
67
- Ticket: 170, TriangleAlert: 210, Type: 170, Undo2: 310, Upload: 0, UploadCloud: 50,
68
- User: 140, Variable: 330, Volume2: 270, VolumeX: 50, Wand2: 270, WandSparkles: 40,
69
- Waypoints: 30, WholeWord: 240, WrapText: 340, Wrench: 0, X: 230, Zap: 120,
70
- ZoomIn: 250, ZoomOut: 340,
35
+ ArrowDownToLine: 330, ArrowLeft: 350, ArrowRight: 80, ArrowRightLeft: 290, ArrowUp: 150, ArrowUpDown: 310,
36
+ ArrowUpRight: 70, BarChart3: 150, BellRing: 260, Blocks: 110, Bot: 220, Box: 260,
37
+ Boxes: 220, Brain: 350, BrainCircuit: 300, Briefcase: 310, Camera: 60, CaseSensitive: 110,
38
+ ChevronDown: 120, ChevronLeft: 250, ChevronRight: 300, ChevronUp: 250, ChevronsUpDown: 80, Circle: 50,
39
+ CircleCheck: 350, CircleDashed: 120, CircleDot: 240, ClipboardCopy: 280, ClipboardList: 290, ClipboardPaste: 200,
40
+ Cloud: 340, CloudDownload: 300, Code: 200, Code2: 260, Coins: 210, Columns: 280,
41
+ Columns2: 20, Command: 100, Component: 200, Copy: 320, CopyPlus: 40, CornerDownLeft: 10,
42
+ Cpu: 250, Database: 280, Dice5: 50, Diff: 300, DollarSign: 220, Download: 210,
43
+ DownloadCloud: 180, Edit2: 210, Ellipsis: 100, ExternalLink: 60, Eye: 20, EyeOff: 350,
44
+ File: 310, FileCode: 260, FileCog: 340, FileDiff: 280, FileEdit: 270, FileImage: 40,
45
+ FilePlus: 350, FilePlus2: 350, FileSearch: 310, FileText: 80, Files: 320, Flag: 350,
46
+ FlaskConical: 170, Folder: 290, FolderGit: 190, FolderGit2: 190, FolderInput: 310, FolderOpen: 330,
47
+ FolderPlus: 250, FolderSearch: 10, FolderTree: 10, Gamepad2: 300, GitBranch: 30, GitCommitVertical: 240,
48
+ GitCompare: 340, GitFork: 30, GitMerge: 90, GitPullRequest: 10, Globe: 340, GraduationCap: 190,
49
+ GripVertical: 350, Hammer: 310, Hand: 200, HardDrive: 0, Hash: 330, Heading: 250,
50
+ Heart: 270, History: 110, Home: 20, Image: 140, Key: 240, KeyRound: 240,
51
+ Keyboard: 120, Laptop: 170, Layers: 30, LayoutTemplate: 170, Leaf: 50, Library: 160,
52
+ Lightbulb: 0, List: 170, ListChecks: 320, ListFilter: 230, ListOrdered: 220, ListTodo: 210,
53
+ ListTree: 330, Loader2: 40, Lock: 220, LockKeyhole: 270, LockOpen: 180, LogIn: 140,
54
+ LogOut: 190, Maximize: 310, Maximize2: 270, Menu: 100, MessageSquare: 150, MessageSquareOff: 40,
55
+ MessageSquarePlus: 350, MessagesSquare: 220, Mic: 160, MicOff: 170, Minimize: 290, Minimize2: 130,
56
+ Minus: 110, Monitor: 250, Moon: 80, MoreHorizontal: 160, MousePointerClick: 70, MoveVertical: 300,
57
+ Music: 280, Package: 270, PackageOpen: 230, Paintbrush: 250, Palette: 320, PanelLeft: 280,
58
+ PanelLeftClose: 160, PanelRight: 330, PanelRightClose: 350, Paperclip: 310, Pause: 10, Pencil: 0,
59
+ PencilLine: 260, Pin: 0, PinOff: 50, Pipette: 120, Play: 310, Plug: 50,
60
+ Plus: 210, Power: 340, Puzzle: 50, Quote: 110, Radio: 320, Ratio: 160,
61
+ RefreshCw: 180, Regex: 280, Replace: 190, ReplaceAll: 140, Rocket: 210, RotateCcw: 330,
62
+ RotateCw: 0, Rows: 160, Rows3: 250, Save: 40, SaveAll: 190, Scissors: 260,
63
+ Search: 250, Send: 110, Server: 300, ServerCog: 50, Settings: 240, Settings2: 20,
64
+ Shield: 160, Shrink: 160, Sliders: 290, SlidersHorizontal: 50, Smartphone: 20, Space: 290,
65
+ Sparkles: 180, Square: 60, SquareFunction: 220, SquarePen: 10, Star: 170, StickyNote: 100,
66
+ Store: 340, Sun: 90, Tablet: 290, Tag: 310, Target: 200, Terminal: 210,
67
+ TextSelect: 220, Ticket: 170, TriangleAlert: 210, Type: 170, Undo2: 310, Upload: 0,
68
+ UploadCloud: 50, User: 140, Variable: 330, Volume2: 270, VolumeX: 50, Wand2: 270,
69
+ WandSparkles: 40, Waypoints: 30, WholeWord: 240, Workflow: 240, WrapText: 340, Wrench: 0,
70
+ X: 230, Zap: 120, ZoomIn: 250, ZoomOut: 340,
71
71
  };
72
72
 
73
73
  /**
@@ -21,6 +21,7 @@
21
21
  import { describe, expect, test } from 'bun:test';
22
22
 
23
23
  import {
24
+ countSkillPromptMarkers,
24
25
  firstOperatorTitleFromPrefix,
25
26
  operatorTitleFromEntry,
26
27
  skillChip,
@@ -90,6 +91,26 @@ describe('firstOperatorTitleFromPrefix', () => {
90
91
  });
91
92
  });
92
93
 
94
+ describe('countSkillPromptMarkers', () => {
95
+ test('counts the compact marker omp actually writes', () => {
96
+ const prefix = '{"type":"custom_message","customType":"skill-prompt","content":"[IMPORTANT: User invoked the \\"antislop-ui\\" skill';
97
+ expect(countSkillPromptMarkers(prefix)).toBe(1);
98
+ });
99
+
100
+ test('counts a marker with a space after the colon', () => {
101
+ expect(countSkillPromptMarkers('{"customType": "skill-prompt"}')).toBe(1);
102
+ });
103
+
104
+ test('an unrelated customType is not a skill turn', () => {
105
+ expect(countSkillPromptMarkers('{"type":"custom","customType":"system-prompt-digest"}')).toBe(0);
106
+ });
107
+
108
+ test('a value cut by the window still counts', () => {
109
+ // The 4 KiB window can end inside the value; the turn is still there.
110
+ expect(countSkillPromptMarkers('{"customType":"skill-pro')).toBe(1);
111
+ });
112
+ });
113
+
93
114
  describe('skillChip', () => {
94
115
  test('appends args only when they exist', () => {
95
116
  expect(skillChip('diagnose')).toBe('/skill:diagnose');
@@ -94,6 +94,34 @@ export function operatorTitleFromEntry(record: Record<string, unknown>): string
94
94
  return textOfContent(message.content).trim() || undefined;
95
95
  }
96
96
 
97
+ /**
98
+ * How many `/skill:` turns a RAW-JSONL prefix window holds.
99
+ *
100
+ * The sidebar's "is this a chat at all" test counts `"type":"message"` entries,
101
+ * and a skill turn is `custom_message` — so a session opened with `/skill:` and
102
+ * whose expanded SKILL.md fills the whole 4 KiB window reported ZERO messages
103
+ * and its row was dropped from the list entirely (measured: 8 real chats in one
104
+ * project, 0.8–8.6 MB each, all invisible). The marker is read as a PROPERTY
105
+ * for the same reason the title reader does: the window can cut the entry, and
106
+ * the value itself can be cut mid-string.
107
+ */
108
+ export function countSkillPromptMarkers(content: string): number {
109
+ let count = 0;
110
+ let marker = content.indexOf('"customType"');
111
+ while (marker !== -1) {
112
+ const value = extractStringProperty(content, 'customType', marker);
113
+ // A window that ends inside the value yields its fragment (`skill-pro`);
114
+ // no other custom type starts with `skill-`, so a long-enough prefix is
115
+ // the same fact as the whole word.
116
+ if (value === SKILL_PROMPT_CUSTOM_TYPE
117
+ || (value !== undefined && value.length >= 8 && SKILL_PROMPT_CUSTOM_TYPE.startsWith(value))) {
118
+ count++;
119
+ }
120
+ marker = content.indexOf('"customType"', marker + 12);
121
+ }
122
+ return count;
123
+ }
124
+
97
125
  /**
98
126
  * Title text of the operator's opening turn inside a RAW-JSONL prefix window.
99
127
  *
@@ -1 +0,0 @@
1
- import{Tf}from"./index-grczkttn.js";export{Tf as createArchitectureServices};
@@ -1 +0,0 @@
1
- import{Cf}from"./index-grczkttn.js";export{Cf as createCynefinServices};
@@ -1 +0,0 @@
1
- import{Df}from"./index-grczkttn.js";export{Df as createEventModelingServices};
@@ -1 +0,0 @@
1
- import"./index-13dr1t1r.js";import"./index-tqycj126.js";import{Sh}from"./index-a9t9gdew.js";export{Sh as diagram};
@@ -1 +0,0 @@
1
- import{Ef}from"./index-grczkttn.js";export{Ef as createGitGraphServices};
@@ -1 +0,0 @@
1
- import{Tn}from"./index-zjydzxhm.js";import"./index-xf36nmbm.js";import"./index-sk9ej289.js";export{Tn as default};
@@ -1 +0,0 @@
1
- import{Bf}from"./index-grczkttn.js";export{Bf as createInfoServices};
@@ -1 +0,0 @@
1
- import{lA}from"./index-8hgm0abr.js";export{lA as default};
@@ -1 +0,0 @@
1
- import{sA}from"./index-8hgm0abr.js";export{sA as default};
@@ -1 +0,0 @@
1
- import{If}from"./index-grczkttn.js";export{If as createPacketServices};
@@ -1 +0,0 @@
1
- import{_f}from"./index-grczkttn.js";export{_f as createPieServices};
@@ -1 +0,0 @@
1
- import{kf}from"./index-grczkttn.js";export{kf as createRadarServices};
@@ -1 +0,0 @@
1
- import{xl}from"./index-grczkttn.js";export{xl as createRailroadServices};
@@ -1 +0,0 @@
1
- import{Cl}from"./index-grczkttn.js";export{Cl as createRailroadAbnfServices};
@@ -1 +0,0 @@
1
- import{wl}from"./index-grczkttn.js";export{wl as createRailroadEbnfServices};
@@ -1 +0,0 @@
1
- import{El}from"./index-grczkttn.js";export{El as createRailroadPegServices};
@@ -1 +0,0 @@
1
- import{Sf}from"./index-grczkttn.js";export{Sf as createTreeViewServices};
@@ -1 +0,0 @@
1
- import{xf}from"./index-grczkttn.js";export{xf as createTreemapServices};
@@ -1 +0,0 @@
1
- import{wf}from"./index-grczkttn.js";export{wf as createWardleyServices};