@kabmo-labs/kabmo 0.42.0 → 0.42.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.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +592 -593
- package/dist/client/static/js/{CsvGrid-20k047ht.js → CsvGrid-8gdp5b49.js} +1 -1
- package/dist/client/static/js/{DocxView-qpvhfcmg.js → DocxView-j9sphgra.js} +2 -2
- package/dist/client/static/js/{DrawioView-178skky8.js → DrawioView-xsgjc7d8.js} +1 -1
- package/dist/client/static/js/{ImageView-460th5qa.js → ImageView-ve9hc519.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-5cv0dty8.js → LayoutWrapper-5mqffvkc.js} +2 -2
- package/dist/client/static/js/{Modal-wks6p4r5.js → Modal-50whypff.js} +10 -10
- package/dist/client/static/js/{PdfView-y51g03nr.js → PdfView-afd5cg54.js} +1 -1
- package/dist/client/static/js/{SessionsView-rsmvn7ks.js → SessionsView-7719nvy0.js} +1 -1
- package/dist/client/static/js/{SheetView-z7yvb05v.js → SheetView-gfzgxb4r.js} +1 -1
- package/dist/client/static/js/{SvgPreview-yehgzhem.js → SvgPreview-225pkb99.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-6zxpcy8b.js → abnfDiagram-O67JEVCF-z70sk69m.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-cagtcfhk.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-m98sgh3c.js → architectureDiagram-NJMV4G6O-pf1gpkje.js} +3 -3
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-cp7rervg.js → blockDiagram-BEXU5L5S-sr25kbn6.js} +2 -2
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-t31recqm.js → c4Diagram-YGBWAQC7-znstpg86.js} +1 -1
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-fy8x3dkx.js → classDiagram-v2-NBCMYWYE-7n0pdcd8.js} +3 -3
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-va7ybm9e.js → cose-bilkent-JH36ORCC-zn3qw4c4.js} +1 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-6g2ydrss.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-4k0k429c.js → cynefinDiagram-VND7K2PF-3z41vtzs.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-ykdhxq6t.js → dagre-6A5THRUB-5j3zn883.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-5nvwx7b6.js → diagram-22UHCM2B-ryw1w2kh.js} +4 -4
- package/dist/client/static/js/{diagram-3UASUU5V-hc7zsjgw.js → diagram-3UASUU5V-p91q4gkh.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-97ae07y7.js → diagram-ATOU4E4O-22dn73g4.js} +1 -1
- package/dist/client/static/js/{diagram-CDSNMT55-b56nnbbs.js → diagram-CDSNMT55-589p9n53.js} +3 -3
- package/dist/client/static/js/{diagram-MLGK6HIB-37rygr9k.js → diagram-MLGK6HIB-ezw06wbx.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-wv3vhhfk.js → diagram-MPIPVDR6-cfwrsvk1.js} +1 -1
- package/dist/client/static/js/{dockerfile-0efb1z6e.js → dockerfile-r4k7q34y.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-13fv7vxg.js → ebnfDiagram-ZINNZB2B-3rv2wvbf.js} +1 -1
- package/dist/client/static/js/{elixir-mabagxwa.js → elixir-szk51ehr.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-xam60ktz.js → elk-276RUBZZ-ma40kneq.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-24ctv2ee.js → erDiagram-OPXOYQCR-xwstsfqa.js} +2 -2
- package/dist/client/static/js/eventmodeling-NTZA5JFV-b774qbn2.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-evp84v09.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-766a8fqw.js → ganttDiagram-FUAMR5RP-qxyx9tr9.js} +2 -2
- package/dist/client/static/js/gitGraph-4MIJSDKK-b047d6vk.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-fmwjkgh6.js → gitGraphDiagram-X574FWY7-v6sg7bkh.js} +1 -1
- package/dist/client/static/js/html-tbz83eke.js +1 -0
- package/dist/client/static/js/{index-xxe52zrm.js → index-001vebsp.js} +1 -1
- package/dist/client/static/js/{index-4j8rgr4p.js → index-0nca2nhp.js} +1 -1
- package/dist/client/static/js/{index-nbexks3x.js → index-0p43qr4k.js} +1 -1
- package/dist/client/static/js/{index-yvxa7hd8.js → index-2w9j2nj4.js} +1 -1
- package/dist/client/static/js/{index-2x9eqztp.js → index-313ctswm.js} +1 -1
- package/dist/client/static/js/{index-ka2rc2cr.js → index-3d40c0a7.js} +3 -3
- package/dist/client/static/js/{index-sq3r1xhf.js → index-4y0ayjfx.js} +1 -1
- package/dist/client/static/js/{index-qj34r6d0.js → index-5599dngt.js} +1 -1
- package/dist/client/static/js/{index-hzwr5fm9.js → index-5asf5625.js} +3 -3
- package/dist/client/static/js/{index-dydwcp3n.js → index-6dxs0tvg.js} +1 -1
- package/dist/client/static/js/{index-a9t9gdew.js → index-6eq445nn.js} +4 -4
- package/dist/client/static/js/{index-4z4ax55k.js → index-869bpqcs.js} +6 -6
- package/dist/client/static/js/{index-97qst4k9.js → index-8fvmyv7t.js} +1 -1
- package/dist/client/static/js/{index-vcn1kcpy.js → index-8pdz41yh.js} +3 -3
- package/dist/client/static/js/{index-zvazj4va.js → index-9hzfvjrb.js} +1 -1
- package/dist/client/static/js/{index-9vdbnvmk.js → index-9ss64g4g.js} +1 -1
- package/dist/client/static/js/{index-zjydzxhm.js → index-b0v6gwym.js} +2 -2
- package/dist/client/static/js/{index-ejdnjh5c.js → index-b37ewyvk.js} +1 -1
- package/dist/client/static/js/{index-z6kpc98a.js → index-b3d2k7ec.js} +1 -1
- package/dist/client/static/js/{index-grczkttn.js → index-b42t14wk.js} +7 -7
- package/dist/client/static/js/{index-1c0pnsjd.js → index-cqaz1281.js} +1 -1
- package/dist/client/static/js/{index-sx809d6d.js → index-df4yxfzd.js} +1 -1
- package/dist/client/static/js/{index-2hpy58d0.js → index-gsxebrq9.js} +2 -2
- package/dist/client/static/js/{index-sz3mxjvy.js → index-kh6vp5w5.js} +1 -1
- package/dist/client/static/js/{index-x7f5ysch.js → index-mphhvgm9.js} +1 -1
- package/dist/client/static/js/{index-13xbwcbz.js → index-mq6s2faf.js} +1 -1
- package/dist/client/static/js/{index-xe5cqwnf.js → index-mvykbyhe.js} +1 -1
- package/dist/client/static/js/{index-czagykbq.js → index-pxtff3ez.js} +2 -2
- package/dist/client/static/js/{index-tqycj126.js → index-q3qpm7jn.js} +1 -1
- package/dist/client/static/js/{index-6ge6gk9w.js → index-qh753ynv.js} +1 -1
- package/dist/client/static/js/{index-8hgm0abr.js → index-rt6ac0kk.js} +175 -171
- package/dist/client/static/js/{index-b4y5g48d.js → index-sr7sdm2t.js} +1 -1
- package/dist/client/static/js/{index-8jqawh3r.js → index-v5dbrq83.js} +1 -1
- package/dist/client/static/js/{index-1rxa9zxp.js → index-w5q9ymf4.js} +1 -1
- package/dist/client/static/js/{index-4mstdh41.js → index-x7a5jpvq.js} +1 -1
- package/dist/client/static/js/{index-7t63akyt.js → index-x7m6dmt4.js} +1 -1
- package/dist/client/static/js/{index-13dr1t1r.js → index-xsts4pqm.js} +23 -23
- package/dist/client/static/js/{index-95en3p3g.js → index-y1p3bdsw.js} +4 -4
- package/dist/client/static/js/info-A6RAGUB7-n495k952.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-tqytmzp1.js → infoDiagram-VRGFBTTK-0anekyhb.js} +2 -2
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-rp77ff6m.js → ishikawaDiagram-OU5B5YK6-zxpmfkjb.js} +2 -2
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-c7bxrhf1.js → journeyDiagram-ZHPQQLJL-1e86fzra.js} +2 -2
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-j2pxewqq.js → kanban-definition-PNTS6WVX-e85hhmr1.js} +4 -4
- package/dist/client/static/js/{mermaid.core-cqqe1krg.js → mermaid.core-jpcrnzyw.js} +2 -2
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-s03k32p9.js → mindmap-definition-NLK3R4M7-xwy5928e.js} +1 -1
- package/dist/client/static/js/one-dark-pro-r0tswz8r.js +1 -0
- package/dist/client/static/js/one-light-xzcfrptf.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-zajj62z6.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-dfg2j0zc.js → pegDiagram-GJSIUBJH-7dy6pw26.js} +1 -1
- package/dist/client/static/js/{perl-5vxax0nr.js → perl-dtn1fccw.js} +1 -1
- package/dist/client/static/js/{php-hgrgdq63.js → php-7av78hch.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-1ve78y5f.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-pshd1j79.js → pieDiagram-5QR66LMP-nrv2t5yn.js} +2 -2
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-cvvvmtk2.js → quadrantDiagram-O4NWA36T-3nt63xr8.js} +1 -1
- package/dist/client/static/js/radar-RG4KPBEZ-8rqadb58.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-v6ppm8dy.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-9j6bae14.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-56cpyt0g.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-yfdmspf4.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-h53p3sha.js → railroadDiagram-XR7U4H2S-evm05hzp.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-bdv2fkxd.js → requirementDiagram-PLB6GJNP-tzrcmktj.js} +1 -1
- package/dist/client/static/js/{ruby-8pxcn21w.js → ruby-s2bqr910.js} +1 -1
- package/dist/client/static/js/{rust-j80dxgjg.js → rust-pcvgybk3.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-xqnnvmhy.js → sankeyDiagram-IPEJSGJF-jvjd5rz8.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-3p67305f.js → sequenceDiagram-PO4LG4MO-0zvjwx29.js} +3 -3
- package/dist/client/static/js/{sizeCapture-INFHLROL-f87525h7.js → sizeCapture-INFHLROL-6t6g0edv.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-e5st1fy3.js → stateDiagram-v2-GCMORJYK-nb13b23a.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-ceghkbez.js → swimlanes-2SLR337P-ef8vmg6f.js} +1 -1
- package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-vc8hvfya.js → swimlanesDiagram-TC7HE7FX-f4sx355z.js} +1 -1
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-f7evs443.js → timeline-definition-EJHVYXUP-3bfph698.js} +3 -3
- package/dist/client/static/js/treeView-Q6P3EWNA-vwpg3wp8.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-htfxwd32.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-0gpn21p7.js → usecaseDiagram-POWQR4AR-vj6yj6tc.js} +7 -7
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-4spzy428.js → vennDiagram-UO4OBE2U-9xyyabaq.js} +2 -2
- package/dist/client/static/js/{vue-xm1dxpmy.js → vue-cbqm4bed.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-hapfjkzq.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-745xr2pa.js → wardleyDiagram-VNRHLVJA-zpcwgv9d.js} +2 -2
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-7dr9qwx5.js → xychartDiagram-PMCCYNJV-pdr2rms2.js} +3 -3
- package/package.json +1 -1
- package/src/cli/lib/commands/session.js +12 -1
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +14 -123
- package/src/client/components/workspace/chat-timeline/OrchestrationNotice.tsx +214 -0
- package/src/client/components/workspace/chat-timeline/UserTurn.test.tsx +126 -0
- package/src/client/components/workspace/chat-timeline/UserTurn.tsx +183 -0
- package/src/client/hooks/chat/timeline/composer-modes.ts +10 -7
- package/src/client/hooks/chat/timeline/plan-review-republish.test.ts +121 -0
- package/src/client/hooks/chat/timeline/plan-review.ts +12 -3
- package/src/server/lib/harness/acp/acp-audit.server.ts +1 -1
- package/src/server/lib/harness/acp/session-exit.ts +39 -5
- package/src/server/lib/harness/acp/session-turns.ts +67 -12
- package/src/server/lib/harness/acp/session.test.ts +61 -0
- package/src/server/lib/harness/acp/session.ts +15 -25
- package/src/server/lib/harness/acp/turn-outcome.server.test.ts +97 -0
- package/src/server/lib/harness/acp/turn-outcome.server.ts +71 -0
- package/src/server/lib/harness/acp/turn-silence.ts +52 -0
- package/src/server/lib/harness/acp/turn.test.ts +85 -3
- package/src/server/lib/harness/acp/turn.ts +62 -4
- package/src/server/lib/lifecycle/after-listen.ts +10 -0
- package/src/server/lib/omp/rpc/frame-fold-contract.ts +21 -0
- package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +4 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +25 -2
- package/src/server/lib/omp/rpc/manager.ts +9 -8
- package/src/server/lib/omp/rpc/retry-saga.ts +54 -0
- package/src/server/lib/omp/rpc/run-settle.server.ts +38 -5
- package/src/server/lib/omp/rpc/run-settle.test.ts +5 -2
- package/src/server/lib/omp/rpc/session-commands-dialog.test.ts +6 -20
- package/src/server/lib/omp/rpc/session-commands-mapping.test.ts +131 -0
- package/src/server/lib/omp/rpc/session-commands.test.ts +95 -116
- package/src/server/lib/omp/rpc/session-commands.ts +38 -17
- package/src/server/lib/omp/rpc/terminal-settle.test.ts +223 -0
- package/src/server/lib/omp/rpc/terminal-settle.ts +127 -29
- package/src/server/lib/sessions/notify.server.test.ts +11 -3
- package/src/server/lib/sessions/notify.server.ts +67 -42
- package/src/server/lib/sessions/spawn.server.test.ts +5 -1
- package/src/server/lib/sessions/spawn.server.ts +8 -3
- package/src/server/routes/sessions/answer.test.ts +62 -0
- package/src/server/routes/sessions/answer.ts +13 -2
- package/src/shared/lib/chat/composer/delegation.ts +11 -7
- package/src/shared/lib/chat/export-markdown.ts +19 -0
- package/src/shared/lib/chat/orchestration/notice.test.ts +118 -0
- package/src/shared/lib/chat/orchestration/notice.ts +183 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +6 -1
- package/src/shared/lib/icons/tint-hues.generated.ts +36 -36
- package/dist/client/static/js/architecture-7GRP2DOG-9q06651f.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-w7a38g4g.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-6wrjccyw.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-19vjkg84.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-4je2p50v.js +0 -1
- package/dist/client/static/js/html-bwyt0ayy.js +0 -1
- package/dist/client/static/js/info-A6RAGUB7-k0z5qdew.js +0 -1
- package/dist/client/static/js/one-dark-pro-9tt0a020.js +0 -1
- package/dist/client/static/js/one-light-5fg4r0ra.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-6cnvmb2z.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-m9z1mztn.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-8m9rkex6.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-wc55emj8.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-2y2rnrzq.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-zzcc9x0v.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-z82na5nb.js +0 -1
- package/dist/client/static/js/treeView-Q6P3EWNA-kzh6cm3f.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-wz5ed560.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-zewbfccz.js +0 -1
|
@@ -30,6 +30,7 @@ import { getLiveSession, harnessOfSession, startNewRpcSession } from '@/server/l
|
|
|
30
30
|
import { harnessProbeModels } from '@/server/lib/harness/probe-cache.server';
|
|
31
31
|
import { getDb } from '@/server/db.server';
|
|
32
32
|
import { harnessDescriptor, type HarnessId } from '@/shared/lib/harness/catalog';
|
|
33
|
+
import { WORKER_BRIEF } from '@/shared/lib/chat/orchestration/notice';
|
|
33
34
|
import type { SelectedModel } from '@/shared/types/models';
|
|
34
35
|
import type { AgentImage } from '@/shared/types/omp/agent';
|
|
35
36
|
import { MAX_SESSION_DEPTH } from '@/server/lib/sessions/relation-types';
|
|
@@ -205,10 +206,14 @@ async function resolveSpawnModel(
|
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
/** What a child receives before its task: identity, the one control verb, and
|
|
208
|
-
* the completion rule. Kabmo, not the orchestrator, writes this.
|
|
209
|
+
* the completion rule. Kabmo, not the orchestrator, writes this.
|
|
210
|
+
*
|
|
211
|
+
* The TASK rides INSIDE the envelope: the whole opening turn is Kabmo's
|
|
212
|
+
* framing, so the timeline draws one card for it instead of a user bubble
|
|
213
|
+
* quoting a preamble the operator never typed. */
|
|
209
214
|
function dispatchedWorkerPrompt(parentSessionId: string, sessionId: string, task: string): string {
|
|
210
215
|
return [
|
|
211
|
-
|
|
216
|
+
WORKER_BRIEF.open,
|
|
212
217
|
`You are session ${sessionId}; your coordinator is session ${parentSessionId}.`,
|
|
213
218
|
'The coordinator cannot see this chat.',
|
|
214
219
|
'',
|
|
@@ -219,10 +224,10 @@ function dispatchedWorkerPrompt(parentSessionId: string, sessionId: string, task
|
|
|
219
224
|
'',
|
|
220
225
|
'Do only this task. When you finish, your final message is your report: what you did,',
|
|
221
226
|
'what you found, what is left. Do not send a separate acknowledgement.',
|
|
222
|
-
'[/kabmo dispatched worker]',
|
|
223
227
|
'',
|
|
224
228
|
'TASK',
|
|
225
229
|
task,
|
|
230
|
+
WORKER_BRIEF.close,
|
|
226
231
|
].join('\n');
|
|
227
232
|
}
|
|
228
233
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `GET /api/sessions/:id/answer` — the last closed answer, and why a run failed.
|
|
8
|
+
*
|
|
9
|
+
* The failure half exists because a FAILED run has no answer at all: the
|
|
10
|
+
* command printed "No assistant answer recorded." for a worker whose provider
|
|
11
|
+
* had said exactly why it stopped, so a coordinator had nothing to report and
|
|
12
|
+
* nothing to act on. Both fields are read from their own durable row, so the
|
|
13
|
+
* answer survives a restart and the reason survives the process that wrote it.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
17
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
18
|
+
import { getDb } from '@/server/db.server';
|
|
19
|
+
import { getSessionAnswer } from '@/server/routes/sessions/answer';
|
|
20
|
+
import { saveSessionAnswer } from '@/server/lib/sessions/answers.server';
|
|
21
|
+
import { markStreamStatus } from '@/shared/lib/omp/session/stream-state.server';
|
|
22
|
+
|
|
23
|
+
beforeEach(isolateDb);
|
|
24
|
+
afterEach(releaseDb);
|
|
25
|
+
|
|
26
|
+
async function read(sessionId: string): Promise<{ answer: string | null; failure: string | null }> {
|
|
27
|
+
const response = await getSessionAnswer({
|
|
28
|
+
request: new Request(`http://localhost/api/sessions/${sessionId}/answer`),
|
|
29
|
+
params: { sessionId },
|
|
30
|
+
} as never);
|
|
31
|
+
return (await (response as Response).json()) as { answer: string | null; failure: string | null };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe('the session answer route', () => {
|
|
35
|
+
test('a completed run reports its answer and no failure', async () => {
|
|
36
|
+
await saveSessionAnswer('s1', 'all done');
|
|
37
|
+
await markStreamStatus('s1', 'finish');
|
|
38
|
+
|
|
39
|
+
expect(await read('s1')).toMatchObject({ answer: 'all done', failure: null });
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('a failed run reports the reason, which is all it has', async () => {
|
|
43
|
+
await markStreamStatus('s1', 'finish', undefined, '400 The model is unavailable');
|
|
44
|
+
|
|
45
|
+
const body = await read('s1');
|
|
46
|
+
expect(body.answer).toBeNull();
|
|
47
|
+
expect(body.failure).toBe('400 The model is unavailable');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('a session that never ran reports neither', async () => {
|
|
51
|
+
expect(await read('never-ran')).toMatchObject({ answer: null, failure: null });
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('a new run clears the previous failure', async () => {
|
|
55
|
+
await markStreamStatus('s1', 'finish', undefined, 'boom');
|
|
56
|
+
await markStreamStatus('s1', 'stream');
|
|
57
|
+
|
|
58
|
+
expect((await read('s1')).failure).toBeNull();
|
|
59
|
+
// The row itself is what the route reads; keep the handle honest.
|
|
60
|
+
expect(await getDb()).toBeDefined();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -4,21 +4,32 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* GET /api/sessions/:sessionId/answer — the last assistant text a turn closed
|
|
7
|
+
* GET /api/sessions/:sessionId/answer — the last assistant text a turn closed,
|
|
8
|
+
* and why the run failed when it did.
|
|
8
9
|
*
|
|
9
10
|
* ACP has no transcript for `/api/chat/:id` to read after the process dies, so
|
|
10
11
|
* `kabmo session output` needs this row. A null answer is a real state (the
|
|
11
12
|
* session has not answered yet), not an error.
|
|
13
|
+
*
|
|
14
|
+
* `failure` rides along because a FAILED run has no answer at all: without it
|
|
15
|
+
* the command printed "No assistant answer recorded." for a worker whose
|
|
16
|
+
* provider had said exactly why, and a coordinator had nothing to report.
|
|
12
17
|
*/
|
|
13
18
|
|
|
14
19
|
import { json } from '@/server/lib/remix-compat';
|
|
15
20
|
import type { LoaderFunctionArgs } from '@/server/lib/remix-compat';
|
|
16
21
|
import { methodNotAllowed } from '@/server/lib/route-adapter';
|
|
17
22
|
import { loadSessionAnswer } from '@/server/lib/sessions/answers.server';
|
|
23
|
+
import { loadStreamStates } from '@/shared/lib/omp/session/stream-state.server';
|
|
18
24
|
|
|
19
25
|
export async function getSessionAnswer({ request, params }: LoaderFunctionArgs) {
|
|
20
26
|
if (request.method !== 'GET') return methodNotAllowed({ request, params });
|
|
21
27
|
const sessionId = params.sessionId;
|
|
22
28
|
if (!sessionId) return json({ error: 'Missing session id' }, { status: 400 });
|
|
23
|
-
|
|
29
|
+
const states = await loadStreamStates();
|
|
30
|
+
return json({
|
|
31
|
+
sessionId,
|
|
32
|
+
answer: await loadSessionAnswer(sessionId),
|
|
33
|
+
failure: states[sessionId]?.failure ?? null,
|
|
34
|
+
});
|
|
24
35
|
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { harnessDescriptor, harnessIdForName, type HarnessId } from '@/shared/lib/harness/catalog';
|
|
21
|
+
import { ORCHESTRATION_CONTRACT } from '@/shared/lib/chat/orchestration/notice';
|
|
21
22
|
|
|
22
23
|
export interface HarnessDelegation {
|
|
23
24
|
harness: HarnessId;
|
|
@@ -158,12 +159,14 @@ export function delegationCommand(delegation: HarnessDelegation, index: number):
|
|
|
158
159
|
*/
|
|
159
160
|
export function formatDelegationPrompt(plan: DelegationPlan): string {
|
|
160
161
|
const lines = [
|
|
161
|
-
|
|
162
|
+
ORCHESTRATION_CONTRACT.open,
|
|
162
163
|
'You are the orchestrator for this message. Start each worker below with the exact command,',
|
|
163
164
|
'then end your turn. A worker sees nothing of this conversation: its TASK is the whole brief.',
|
|
164
|
-
'
|
|
165
|
-
'
|
|
166
|
-
'
|
|
165
|
+
'',
|
|
166
|
+
'Kabmo sends a worker outcome back as ONE message, when that worker is done. A worker that',
|
|
167
|
+
'is still retrying a provider error reports nothing until it stops, so silence is not a',
|
|
168
|
+
'result. Do not poll, do not resend a task, and do not delegate work that is not listed',
|
|
169
|
+
'here unless the user asks.',
|
|
167
170
|
'',
|
|
168
171
|
'Workers:',
|
|
169
172
|
];
|
|
@@ -177,9 +180,10 @@ export function formatDelegationPrompt(plan: DelegationPlan): string {
|
|
|
177
180
|
});
|
|
178
181
|
lines.push(
|
|
179
182
|
'',
|
|
180
|
-
'When
|
|
181
|
-
'
|
|
182
|
-
'
|
|
183
|
+
'When an outcome arrives, report it to the user. A completed worker carries its report; a',
|
|
184
|
+
'failed one carries the reason it gave — report that failure, never resend the task.',
|
|
185
|
+
'Reconcile conflicting reports; do not relay one verbatim.',
|
|
186
|
+
ORCHESTRATION_CONTRACT.close,
|
|
183
187
|
);
|
|
184
188
|
if (plan.orchestratorText) lines.push('', plan.orchestratorText);
|
|
185
189
|
return lines.join('\n');
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import type { AgentActionData, ChatMessageData, ToolCallData } from '@/shared/types';
|
|
20
20
|
import { isNoticeRow, messageAnswerText } from '@/shared/lib/chat/notice-row';
|
|
21
|
+
import { parseOrchestrationBlock } from '@/shared/lib/chat/orchestration/notice';
|
|
21
22
|
|
|
22
23
|
export interface SessionMarkdownInput {
|
|
23
24
|
id: string;
|
|
@@ -84,11 +85,29 @@ function toolCallBlock(call: ToolCallData | AgentActionData): string[] {
|
|
|
84
85
|
return lines;
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
/** The heading an injected prompt exports under. Kabmo wrote it, so it is not
|
|
89
|
+
* filed as the operator's own turn — the same distinction the timeline draws
|
|
90
|
+
* with a card. */
|
|
91
|
+
const ORCHESTRATION_HEADING: Record<string, string> = {
|
|
92
|
+
contract: '## Orchestration',
|
|
93
|
+
worker: '## Worker brief',
|
|
94
|
+
outcome: '## Worker outcome',
|
|
95
|
+
};
|
|
96
|
+
|
|
87
97
|
function messageBlock(msg: ChatMessageData): string[] {
|
|
88
98
|
if (isNoticeRow(msg)) {
|
|
89
99
|
return ['## System notice', '', quote(msg.notice)];
|
|
90
100
|
}
|
|
91
101
|
|
|
102
|
+
const injected = msg.role === 'user' ? parseOrchestrationBlock(messageAnswerText(msg)) : null;
|
|
103
|
+
if (injected) {
|
|
104
|
+
const lines = [ORCHESTRATION_HEADING[injected.kind] ?? '## Orchestration', '', injected.body];
|
|
105
|
+
// The operator's own words stay their turn, exactly as the timeline keeps
|
|
106
|
+
// their bubble beside the card.
|
|
107
|
+
if (injected.rest) lines.push('', '## User', '', injected.rest);
|
|
108
|
+
return lines;
|
|
109
|
+
}
|
|
110
|
+
|
|
92
111
|
const heading = msg.role === 'user' ? '## User' : '## Assistant';
|
|
93
112
|
const lines: string[] = [heading];
|
|
94
113
|
const content = messageAnswerText(msg).trim();
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The injected-prompt envelope, and the outcome format both ends read.
|
|
8
|
+
*
|
|
9
|
+
* The reason this is a shared module and not two copies: the server WRITES the
|
|
10
|
+
* text a coordinator receives and the client PARSES it back into a card. A
|
|
11
|
+
* format that only one side knew would render a worker report as the
|
|
12
|
+
* operator's own message, which is exactly the bug this replaced.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { describe, expect, test } from 'bun:test';
|
|
16
|
+
import {
|
|
17
|
+
CHILD_OUTCOME,
|
|
18
|
+
ORCHESTRATION_CONTRACT,
|
|
19
|
+
WORKER_BRIEF,
|
|
20
|
+
parseChildOutcomeNotice,
|
|
21
|
+
parseOrchestrationBlock,
|
|
22
|
+
renderChildOutcomeNotice,
|
|
23
|
+
} from '@/shared/lib/chat/orchestration/notice';
|
|
24
|
+
|
|
25
|
+
describe('parseOrchestrationBlock', () => {
|
|
26
|
+
test('leaves anything a human wrote alone', () => {
|
|
27
|
+
expect(parseOrchestrationBlock('fix the sidebar, please')).toBeNull();
|
|
28
|
+
// A marker in the MIDDLE of prose is content, not an envelope.
|
|
29
|
+
expect(parseOrchestrationBlock('see [kabmo child outcome] handling')).toBeNull();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('splits the contract from the words the operator typed', () => {
|
|
33
|
+
const text = [
|
|
34
|
+
ORCHESTRATION_CONTRACT.open,
|
|
35
|
+
'You are the orchestrator for this message.',
|
|
36
|
+
ORCHESTRATION_CONTRACT.close,
|
|
37
|
+
'',
|
|
38
|
+
'koordinasikan timnya',
|
|
39
|
+
].join('\n');
|
|
40
|
+
const block = parseOrchestrationBlock(text);
|
|
41
|
+
expect(block?.kind).toBe('contract');
|
|
42
|
+
expect(block?.body).toBe('You are the orchestrator for this message.');
|
|
43
|
+
expect(block?.rest).toBe('koordinasikan timnya');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('a worker brief is one block with no operator text', () => {
|
|
47
|
+
const text = `${WORKER_BRIEF.open}\nYou are session c1.\n\nTASK\ncheck the log\n${WORKER_BRIEF.close}`;
|
|
48
|
+
const block = parseOrchestrationBlock(text);
|
|
49
|
+
expect(block?.kind).toBe('worker');
|
|
50
|
+
expect(block?.body).toContain('check the log');
|
|
51
|
+
expect(block?.rest).toBe('');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('an unterminated marker stays prose', () => {
|
|
55
|
+
// A truncated write must not swallow the rest of the message.
|
|
56
|
+
const text = `${ORCHESTRATION_CONTRACT.open}\nhalf a contract`;
|
|
57
|
+
expect(parseOrchestrationBlock(text)).toBeNull();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe('child outcome notices', () => {
|
|
62
|
+
test('one worker round-trips with its reason intact', () => {
|
|
63
|
+
const text = renderChildOutcomeNotice([
|
|
64
|
+
{
|
|
65
|
+
sessionId: 'c1',
|
|
66
|
+
title: 'Agent 1',
|
|
67
|
+
status: 'failed',
|
|
68
|
+
failure: '400 The model agnes-2-5-flash:free is currently unavailable.',
|
|
69
|
+
},
|
|
70
|
+
]);
|
|
71
|
+
expect(text.startsWith(CHILD_OUTCOME.open)).toBe(true);
|
|
72
|
+
const block = parseOrchestrationBlock(text);
|
|
73
|
+
expect(block?.kind).toBe('outcome');
|
|
74
|
+
const [entry] = parseChildOutcomeNotice(block?.body ?? '');
|
|
75
|
+
expect(entry).toEqual({
|
|
76
|
+
sessionId: 'c1',
|
|
77
|
+
title: 'Agent 1',
|
|
78
|
+
status: 'failed',
|
|
79
|
+
failure: '400 The model agnes-2-5-flash:free is currently unavailable.',
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('a completed worker carries its whole output, newlines included', () => {
|
|
84
|
+
const output = '**Report**\n\n- did one thing\n- did another';
|
|
85
|
+
const body = parseOrchestrationBlock(
|
|
86
|
+
renderChildOutcomeNotice([{ sessionId: 'c1', status: 'completed', output }]),
|
|
87
|
+
);
|
|
88
|
+
const [entry] = parseChildOutcomeNotice(body?.body ?? '');
|
|
89
|
+
expect(entry?.output).toBe(output);
|
|
90
|
+
expect(entry?.failure).toBeUndefined();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('a batch keeps every worker, in order', () => {
|
|
94
|
+
const body = parseOrchestrationBlock(
|
|
95
|
+
renderChildOutcomeNotice([
|
|
96
|
+
{ sessionId: 'c1', status: 'completed', output: 'first' },
|
|
97
|
+
{ sessionId: 'c2', status: 'interrupted' },
|
|
98
|
+
]),
|
|
99
|
+
);
|
|
100
|
+
const entries = parseChildOutcomeNotice(body?.body ?? '');
|
|
101
|
+
expect(entries.map((entry) => entry.sessionId)).toEqual(['c1', 'c2']);
|
|
102
|
+
expect(entries[1]?.failure).toContain('interrupted');
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test('a failure states the next step so the task is not resent', () => {
|
|
106
|
+
const text = renderChildOutcomeNotice([{ sessionId: 'c9', status: 'failed', failure: 'boom' }]);
|
|
107
|
+
expect(text).toContain('instead of resending');
|
|
108
|
+
// A failed run has no assistant answer, so `session output` would print
|
|
109
|
+
// nothing — the reason above is the detail.
|
|
110
|
+
expect(text).not.toContain('kabmo session output');
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test('an unclassifiable status reads as failed, and a blank chunk is dropped', () => {
|
|
114
|
+
const entries = parseChildOutcomeNotice('session: c1\nstatus: weird\nreason: x\n---\nno session here');
|
|
115
|
+
expect(entries).toHaveLength(1);
|
|
116
|
+
expect(entries[0]?.status).toBe('failed');
|
|
117
|
+
});
|
|
118
|
+
});
|
|
@@ -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
|
};
|
|
@@ -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,
|
|
36
|
-
BarChart3: 150, BellRing: 260, Blocks: 110, Bot: 220, Box: 260,
|
|
37
|
-
Brain: 350, BrainCircuit: 300, Briefcase: 310, Camera: 60, CaseSensitive: 110,
|
|
38
|
-
ChevronLeft: 250, ChevronRight: 300, ChevronUp: 250, ChevronsUpDown: 80, Circle: 50,
|
|
39
|
-
CircleDashed: 120, CircleDot: 240, ClipboardCopy: 280, ClipboardList: 290, ClipboardPaste: 200,
|
|
40
|
-
CloudDownload: 300, Code: 200, Code2: 260, Coins: 210, Columns: 280,
|
|
41
|
-
Command: 100, Component: 200, Copy: 320, CopyPlus: 40, CornerDownLeft: 10,
|
|
42
|
-
Database: 280, Dice5: 50, Diff: 300, DollarSign: 220, Download: 210,
|
|
43
|
-
Edit2: 210, Ellipsis: 100, ExternalLink: 60, Eye: 20, EyeOff: 350,
|
|
44
|
-
FileCode: 260, FileCog: 340, FileDiff: 280, FileEdit: 270, FileImage: 40,
|
|
45
|
-
FilePlus2: 350, FileSearch: 310, FileText: 80, Files: 320, Flag: 350,
|
|
46
|
-
Folder: 290, FolderGit: 190, FolderGit2: 190, FolderInput: 310, FolderOpen: 330,
|
|
47
|
-
FolderSearch: 10, FolderTree: 10, Gamepad2: 300, GitBranch: 30, GitCommitVertical: 240,
|
|
48
|
-
GitFork: 30, GitMerge: 90, GitPullRequest: 10, Globe: 340, GraduationCap: 190,
|
|
49
|
-
Hammer: 310, Hand: 200, HardDrive: 0, Hash: 330, Heading: 250,
|
|
50
|
-
History: 110, Home: 20, Image: 140, Key: 240, KeyRound: 240,
|
|
51
|
-
Laptop: 170, Layers: 30, LayoutTemplate: 170, Leaf: 50, Library: 160,
|
|
52
|
-
List: 170, ListChecks: 320, ListFilter: 230, ListOrdered: 220, ListTodo: 210,
|
|
53
|
-
Loader2: 40, Lock: 220, LockKeyhole: 270, LockOpen: 180, LogIn: 140,
|
|
54
|
-
Maximize: 310, Maximize2: 270, Menu: 100, MessageSquare: 150, MessageSquareOff: 40,
|
|
55
|
-
MessagesSquare: 220, Mic: 160, MicOff: 170, Minimize: 290, Minimize2: 130,
|
|
56
|
-
Monitor: 250, Moon: 80, MoreHorizontal: 160, MousePointerClick: 70, MoveVertical: 300,
|
|
57
|
-
Package: 270, PackageOpen: 230, Paintbrush: 250, Palette: 320, PanelLeft: 280,
|
|
58
|
-
PanelRight: 330, PanelRightClose: 350, Paperclip: 310, Pause: 10, Pencil: 0,
|
|
59
|
-
Pin: 0, PinOff: 50, Pipette: 120, Play: 310, Plug: 50,
|
|
60
|
-
Power: 340, Puzzle: 50, Quote: 110, Radio: 320, Ratio: 160,
|
|
61
|
-
Regex: 280, Replace: 190, ReplaceAll: 140, Rocket: 210, RotateCcw: 330,
|
|
62
|
-
Rows: 160, Rows3: 250, Save: 40, SaveAll: 190, Scissors: 260,
|
|
63
|
-
Send: 110, Server: 300, ServerCog: 50, Settings: 240, Settings2: 20,
|
|
64
|
-
Shrink: 160, Sliders: 290, SlidersHorizontal: 50, Smartphone: 20, Space: 290,
|
|
65
|
-
Square: 60, SquareFunction: 220, SquarePen: 10, Star: 170, StickyNote: 100,
|
|
66
|
-
Sun: 90, Tablet: 290, Tag: 310, Target: 200, Terminal: 210,
|
|
67
|
-
Ticket: 170, TriangleAlert: 210, Type: 170, Undo2: 310, Upload: 0,
|
|
68
|
-
User: 140, Variable: 330, Volume2: 270, VolumeX: 50, Wand2: 270,
|
|
69
|
-
Waypoints: 30, WholeWord: 240, WrapText: 340, Wrench: 0,
|
|
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
|
/**
|
|
@@ -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};
|