create-pmos 0.399.0 → 0.400.0
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/package.json +18 -13
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +2 -2
- package/workspace/briefing-premium-board-test.js +2 -2
- package/workspace/briefing-premium-doc-edit-test.js +2 -8
- package/workspace/briefing-premium-test.js +3 -2
- package/workspace/briefing-premium-work-test.js +9 -4
- package/workspace/c3-capture-test.js +0 -17
- package/workspace/changelog.json +17 -0
- package/workspace/guide/briefing-premium.md +2 -2
- package/workspace/guide/home.md +20 -2
- package/workspace/guide/layout.md +2 -2
- package/workspace/guide/notes.md +2 -2
- package/workspace/guide/phone-companion.md +1 -1
- package/workspace/lib/route-modules.js +1 -9
- package/workspace/lib/routes-phone-day.js +18 -9
- package/workspace/lib/routes-slash.js +95 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -2
- package/workspace/premium-chat-goal-view-test.js +1 -1
- package/workspace/premium-chat-term-test.js +0 -10
- package/workspace/premium-menu-rows-test.js +1 -1
- package/workspace/premium-phone-card-test.js +2 -2
- package/workspace/premium-vw-doc-test.js +1 -8
- package/workspace/premium-work-depth-test.js +2 -3
- package/workspace/public/capture.html +23 -0
- package/workspace/public/pm/c3-base.js +47 -0
- package/workspace/public/pm/c3-capture.js +1 -1
- package/workspace/public/pm/c3-ini-ui.js +1 -1
- package/workspace/public/pm/c3-sheet.js +1 -1
- package/workspace/public/pm/c3-toast.js +1 -1
- package/workspace/public/pm/console3.css +3 -0
- package/workspace/public/pm/cozy-home.css +20 -5
- package/workspace/public/pm/cozy-today.css +5 -2
- package/workspace/public/pm/cozy-viewer.js +4 -2
- package/workspace/public/pm/cozy.css +9 -0
- package/workspace/public/pm/goal-chat.js +5 -1
- package/workspace/public/pm/home-app.js +47 -26
- package/workspace/public/pm/home-chat.js +10 -4
- package/workspace/public/pm/home-data.js +3 -1
- package/workspace/public/pm/home-dictate.js +7 -4
- package/workspace/public/pm/home-ini.js +12 -2
- package/workspace/public/pm/home-list.js +20 -7
- package/workspace/public/pm/home-more.js +2 -2
- package/workspace/public/pm/home-phone-card.js +9 -4
- package/workspace/public/pm/home-review.js +2 -3
- package/workspace/public/pm/home-today.js +10 -6
- package/workspace/public/pm/home-work.js +15 -8
- package/workspace/public/pm/note-dock.js +1 -2
- package/workspace/public/pm/notes-links.js +1 -2
- package/workspace/public/pm/notes-task.js +3 -4
- package/workspace/public/pm/premium-board.js +1 -1
- package/workspace/public/pm/premium-initiative-head.js +3 -3
- package/workspace/public/pm/premium-vw-doc.css +20 -2
- package/workspace/public/pm/premium-vw-doc.js +22 -7
- package/workspace/public/pm/view-notes.js +2 -2
- package/workspace/replaced-tests.json +435 -0
- package/workspace/run-tests.js +323 -28
- package/workspace/server.js +15 -10
- package/workspace/test-files.json +3 -140
- package/workspace/test-lists/base.json +1 -2
- package/workspace/test-lists/c3-desktop-light-load.json +1 -2
- package/workspace/test-lists/c3-initiative-boards.json +1 -2
- package/workspace/test-lists/c3-meeting-focus.json +2 -12
- package/workspace/test-lists/c3-work-agent.json +1 -2
- package/workspace/test-lists/calendar-tidy-up.json +1 -2
- package/workspace/test-lists/console3-reports.json +1 -2
- package/workspace/test-lists/docs-three-way-sync.json +1 -2
- package/workspace/test-lists/extension-capture.json +5 -0
- package/workspace/test-lists/jira-wbs.json +1 -2
- package/workspace/test-lists/legacy-cleanup-a.json +9 -0
- package/workspace/test-lists/meeting-material.json +1 -2
- package/workspace/test-lists/meeting-notes.json +2 -36
- package/workspace/test-lists/meeting-replay.json +1 -2
- package/workspace/test-lists/mm-capture.json +2 -12
- package/workspace/test-lists/my-work.json +2 -10
- package/workspace/test-lists/onboarding-firstrun.json +2 -12
- package/workspace/test-lists/people-directory.json +1 -2
- package/workspace/test-lists/run2-a.json +1 -2
- package/workspace/test-lists/run2-d.json +2 -19
- package/workspace/test-lists/run3-b.json +1 -2
- package/workspace/test-lists/run3-c.json +2 -12
- package/workspace/test-lists/run4-b.json +1 -2
- package/workspace/test-lists/run4-d.json +1 -5
- package/workspace/test-lists/run5-c.json +1 -11
- package/workspace/test-lists/run6.json +1 -5
- package/workspace/test-lists/workspace-launch-flags.json +2 -12
- package/workspace/test-lists/workspace-profile-detection.json +2 -10
- package/workspace/test-timings.json +242 -123
- package/workspace/c3-briefing-test.js +0 -136
- package/workspace/c3-core-docs-test.js +0 -170
- package/workspace/c3-driver-fixture.js +0 -64
- package/workspace/c3-driver-test.js +0 -169
- package/workspace/c3-foundation-test.js +0 -163
- package/workspace/c3-ib-items-test.js +0 -114
- package/workspace/c3-ib-more-test.js +0 -146
- package/workspace/c3-ib-triage-backlog-test.js +0 -128
- package/workspace/c3-ini-harness.js +0 -66
- package/workspace/c3-ini-life-test.js +0 -167
- package/workspace/c3-initiatives-test.js +0 -186
- package/workspace/c3-light-load-test.js +0 -112
- package/workspace/c3-one-home-test.js +0 -149
- package/workspace/c3-phone-test.js +0 -289
- package/workspace/c3-quiet-test.js +0 -157
- package/workspace/c3-report-design-real-test.js +0 -264
- package/workspace/c3-report-design-test.js +0 -442
- package/workspace/c3-report-setup-test.js +0 -192
- package/workspace/c3-report-structure-real-test.js +0 -248
- package/workspace/c3-report-structure-test.js +0 -397
- package/workspace/c3-reports-test.js +0 -288
- package/workspace/c3-scan-test.js +0 -517
- package/workspace/c3-sessions-panel-test.js +0 -365
- package/workspace/c3-settings-test.js +0 -204
- package/workspace/c3-updates-test.js +0 -131
- package/workspace/c3-work-test.js +0 -260
- package/workspace/cut-stub.js +0 -40
- package/workspace/first-paint-audit.js +0 -160
- package/workspace/lib/c3-full-console.js +0 -15
- package/workspace/lib/engine/derived/trust.js +0 -3
- package/workspace/lib/engine/plan-forecast.js +0 -342
- package/workspace/lib/engine/report-families.js +0 -175
- package/workspace/lib/engine/truth-table.js +0 -57
- package/workspace/lib/routes-c3-init.js +0 -54
- package/workspace/lib/routes-c3-life.js +0 -120
- package/workspace/lib/routes-c3-timeline.js +0 -192
- package/workspace/lib/routes-forecast.js +0 -86
- package/workspace/lib/routes-releases.js +0 -130
- package/workspace/lib/routes-report-facts.js +0 -85
- package/workspace/lib/routes-report-families.js +0 -33
- package/workspace/lib/routes-signals.js +0 -51
- package/workspace/lib/routes-timeline.js +0 -197
- package/workspace/public/c3.html +0 -35
- package/workspace/public/index.html +0 -156
- package/workspace/public/pm/app.js +0 -831
- package/workspace/public/pm/bd-board.js +0 -159
- package/workspace/public/pm/bd-drag.js +0 -59
- package/workspace/public/pm/bd-model.js +0 -152
- package/workspace/public/pm/bd-timeline.js +0 -233
- package/workspace/public/pm/bd-tree.js +0 -244
- package/workspace/public/pm/board-copy.js +0 -59
- package/workspace/public/pm/board-read.js +0 -38
- package/workspace/public/pm/branches-sheet.js +0 -56
- package/workspace/public/pm/breakdown-api.js +0 -58
- package/workspace/public/pm/breakdown-copy.js +0 -138
- package/workspace/public/pm/briefing-deck.js +0 -441
- package/workspace/public/pm/briefing-model.js +0 -251
- package/workspace/public/pm/c3-ambient.js +0 -100
- package/workspace/public/pm/c3-audience-link.js +0 -21
- package/workspace/public/pm/c3-audience.js +0 -46
- package/workspace/public/pm/c3-boot.js +0 -13
- package/workspace/public/pm/c3-breakdown.js +0 -240
- package/workspace/public/pm/c3-brief-data.js +0 -11
- package/workspace/public/pm/c3-brief-mentions.js +0 -137
- package/workspace/public/pm/c3-brief-needs.js +0 -288
- package/workspace/public/pm/c3-brief-pulse.js +0 -112
- package/workspace/public/pm/c3-brief-summary.js +0 -139
- package/workspace/public/pm/c3-brief-today.js +0 -79
- package/workspace/public/pm/c3-brief.js +0 -279
- package/workspace/public/pm/c3-cal-strategy.js +0 -529
- package/workspace/public/pm/c3-calendar.js +0 -965
- package/workspace/public/pm/c3-calpop.js +0 -111
- package/workspace/public/pm/c3-case.js +0 -196
- package/workspace/public/pm/c3-core-docs.css +0 -18
- package/workspace/public/pm/c3-core-docs.js +0 -236
- package/workspace/public/pm/c3-daypart.js +0 -176
- package/workspace/public/pm/c3-demo-boards.js +0 -764
- package/workspace/public/pm/c3-demo-brief-ix.js +0 -350
- package/workspace/public/pm/c3-demo-brief-page.js +0 -70
- package/workspace/public/pm/c3-demo-cal-ix.js +0 -74
- package/workspace/public/pm/c3-demo-cal2.js +0 -66
- package/workspace/public/pm/c3-demo-cal3.js +0 -173
- package/workspace/public/pm/c3-demo-cal4.js +0 -169
- package/workspace/public/pm/c3-demo-cal5.js +0 -52
- package/workspace/public/pm/c3-demo-coredocs.js +0 -221
- package/workspace/public/pm/c3-demo-data.js +0 -552
- package/workspace/public/pm/c3-demo-focus.js +0 -181
- package/workspace/public/pm/c3-demo-init.js +0 -430
- package/workspace/public/pm/c3-demo-life.js +0 -77
- package/workspace/public/pm/c3-demo-material.js +0 -58
- package/workspace/public/pm/c3-demo-misc2.js +0 -34
- package/workspace/public/pm/c3-demo-phone.js +0 -48
- package/workspace/public/pm/c3-demo-plan2.js +0 -30
- package/workspace/public/pm/c3-demo-rd.js +0 -432
- package/workspace/public/pm/c3-demo-rep-ix.js +0 -126
- package/workspace/public/pm/c3-demo-rep2.js +0 -130
- package/workspace/public/pm/c3-demo-rep3.js +0 -138
- package/workspace/public/pm/c3-demo-rs.js +0 -287
- package/workspace/public/pm/c3-demo-term.js +0 -153
- package/workspace/public/pm/c3-demo-time.js +0 -49
- package/workspace/public/pm/c3-demo-work-ix.js +0 -32
- package/workspace/public/pm/c3-demo.js +0 -131
- package/workspace/public/pm/c3-design-studio.js +0 -369
- package/workspace/public/pm/c3-doc-formats.js +0 -153
- package/workspace/public/pm/c3-doc-sheet.js +0 -1230
- package/workspace/public/pm/c3-dock.js +0 -206
- package/workspace/public/pm/c3-docs.js +0 -291
- package/workspace/public/pm/c3-driver-work.js +0 -110
- package/workspace/public/pm/c3-driver.css +0 -18
- package/workspace/public/pm/c3-driver.js +0 -298
- package/workspace/public/pm/c3-focus.css +0 -304
- package/workspace/public/pm/c3-focus.js +0 -983
- package/workspace/public/pm/c3-ib-docs.js +0 -92
- package/workspace/public/pm/c3-ib-initiatives.js +0 -201
- package/workspace/public/pm/c3-ib-items.js +0 -210
- package/workspace/public/pm/c3-ib-releases.js +0 -48
- package/workspace/public/pm/c3-ib-sprints.js +0 -201
- package/workspace/public/pm/c3-ib-triage.js +0 -177
- package/workspace/public/pm/c3-ii-tabs.js +0 -252
- package/workspace/public/pm/c3-ini-life.css +0 -34
- package/workspace/public/pm/c3-ini-life.js +0 -379
- package/workspace/public/pm/c3-ini-records.js +0 -197
- package/workspace/public/pm/c3-ini-timeline.js +0 -278
- package/workspace/public/pm/c3-ini-work.js +0 -139
- package/workspace/public/pm/c3-init-extras.js +0 -170
- package/workspace/public/pm/c3-initiatives.js +0 -852
- package/workspace/public/pm/c3-lifecycle-panels.js +0 -479
- package/workspace/public/pm/c3-look.js +0 -27
- package/workspace/public/pm/c3-material.css +0 -22
- package/workspace/public/pm/c3-material.js +0 -321
- package/workspace/public/pm/c3-md.js +0 -3
- package/workspace/public/pm/c3-misc-panels.js +0 -89
- package/workspace/public/pm/c3-new-session.js +0 -110
- package/workspace/public/pm/c3-notes.js +0 -751
- package/workspace/public/pm/c3-phone-boot.js +0 -47
- package/workspace/public/pm/c3-phone-detail.js +0 -97
- package/workspace/public/pm/c3-phone-model.js +0 -3
- package/workspace/public/pm/c3-phone.css +0 -66
- package/workspace/public/pm/c3-phone.js +0 -444
- package/workspace/public/pm/c3-plan-panels.js +0 -163
- package/workspace/public/pm/c3-plan.js +0 -193
- package/workspace/public/pm/c3-quiet.css +0 -113
- package/workspace/public/pm/c3-quiet.js +0 -177
- package/workspace/public/pm/c3-replay.css +0 -133
- package/workspace/public/pm/c3-replay.js +0 -429
- package/workspace/public/pm/c3-report-deck.css +0 -163
- package/workspace/public/pm/c3-report-deck.js +0 -598
- package/workspace/public/pm/c3-report-frame.css +0 -20
- package/workspace/public/pm/c3-report-print.css +0 -20
- package/workspace/public/pm/c3-report-setup.css +0 -67
- package/workspace/public/pm/c3-report-setup.js +0 -298
- package/workspace/public/pm/c3-report-store.js +0 -244
- package/workspace/public/pm/c3-report-structure.css +0 -44
- package/workspace/public/pm/c3-report-structure.js +0 -473
- package/workspace/public/pm/c3-reports.css +0 -68
- package/workspace/public/pm/c3-reports.js +0 -377
- package/workspace/public/pm/c3-roadmap.js +0 -249
- package/workspace/public/pm/c3-scan-api.js +0 -167
- package/workspace/public/pm/c3-scan-next.js +0 -248
- package/workspace/public/pm/c3-scan-setup.js +0 -313
- package/workspace/public/pm/c3-scan-words.js +0 -41
- package/workspace/public/pm/c3-scan.css +0 -74
- package/workspace/public/pm/c3-scan.js +0 -93
- package/workspace/public/pm/c3-session-chat.js +0 -103
- package/workspace/public/pm/c3-session-conv.js +0 -165
- package/workspace/public/pm/c3-session-term.js +0 -216
- package/workspace/public/pm/c3-settings.css +0 -85
- package/workspace/public/pm/c3-settings.js +0 -1045
- package/workspace/public/pm/c3-shell.js +0 -628
- package/workspace/public/pm/c3-signals.js +0 -196
- package/workspace/public/pm/c3-strategy-panels.js +0 -45
- package/workspace/public/pm/c3-swipe.js +0 -230
- package/workspace/public/pm/c3-terminal-data.js +0 -48
- package/workspace/public/pm/c3-terminal-edge.js +0 -91
- package/workspace/public/pm/c3-terminal-icons.js +0 -40
- package/workspace/public/pm/c3-terminal-results.js +0 -141
- package/workspace/public/pm/c3-terminal.js +0 -52
- package/workspace/public/pm/c3-tickets.js +0 -163
- package/workspace/public/pm/c3-timeline.js +0 -201
- package/workspace/public/pm/calendar-views.js +0 -1049
- package/workspace/public/pm/console3-lift.md +0 -220
- package/workspace/public/pm/cozy-home.js +0 -172
- package/workspace/public/pm/cozy-initiative.css +0 -138
- package/workspace/public/pm/cycle-review.js +0 -125
- package/workspace/public/pm/data.js +0 -1577
- package/workspace/public/pm/dest-board.js +0 -444
- package/workspace/public/pm/dest-docs.js +0 -530
- package/workspace/public/pm/dest-initiatives.js +0 -162
- package/workspace/public/pm/dest-mywork.js +0 -307
- package/workspace/public/pm/dest-notes.js +0 -537
- package/workspace/public/pm/dest-people.js +0 -449
- package/workspace/public/pm/dest-reports.js +0 -383
- package/workspace/public/pm/dest-settings.js +0 -601
- package/workspace/public/pm/dest-today.js +0 -267
- package/workspace/public/pm/display-word.js +0 -56
- package/workspace/public/pm/doc-editor.js +0 -473
- package/workspace/public/pm/doc-graph.js +0 -272
- package/workspace/public/pm/doc-health-panel.js +0 -110
- package/workspace/public/pm/doc-rail.js +0 -167
- package/workspace/public/pm/doc-remote.js +0 -180
- package/workspace/public/pm/dock-sessions.js +0 -472
- package/workspace/public/pm/dock.js +0 -216
- package/workspace/public/pm/fixture.js +0 -821
- package/workspace/public/pm/flag-picker.js +0 -104
- package/workspace/public/pm/frame-copy.js +0 -278
- package/workspace/public/pm/freshness-line.js +0 -149
- package/workspace/public/pm/handoff-box.js +0 -82
- package/workspace/public/pm/initiative-list.js +0 -235
- package/workspace/public/pm/initiative-sheet.js +0 -331
- package/workspace/public/pm/initiatives-api.js +0 -95
- package/workspace/public/pm/initiatives-copy.js +0 -287
- package/workspace/public/pm/initiatives-timeline-copy.js +0 -59
- package/workspace/public/pm/initiatives-timeline.js +0 -410
- package/workspace/public/pm/initiatives-ui.js +0 -291
- package/workspace/public/pm/item-sheet.js +0 -268
- package/workspace/public/pm/keep-card.js +0 -204
- package/workspace/public/pm/lifecycle-lens-model.js +0 -246
- package/workspace/public/pm/lifecycle-lens.js +0 -276
- package/workspace/public/pm/lifecycle.js +0 -111
- package/workspace/public/pm/mobile.css +0 -366
- package/workspace/public/pm/mobile.js +0 -581
- package/workspace/public/pm/modes-live.js +0 -453
- package/workspace/public/pm/modes.js +0 -147
- package/workspace/public/pm/my-work-card.js +0 -51
- package/workspace/public/pm/my-work-data.js +0 -36
- package/workspace/public/pm/new-initiative-sheet.js +0 -169
- package/workspace/public/pm/next-step-ui.js +0 -190
- package/workspace/public/pm/outbox-panel.js +0 -125
- package/workspace/public/pm/palette-copy.js +0 -55
- package/workspace/public/pm/palette.js +0 -343
- package/workspace/public/pm/panel-breakdown.js +0 -702
- package/workspace/public/pm/panel-cockpit.js +0 -425
- package/workspace/public/pm/panel-detail.js +0 -1513
- package/workspace/public/pm/panel-initiatives.js +0 -929
- package/workspace/public/pm/panel-newsess.js +0 -709
- package/workspace/public/pm/panel-repos.js +0 -741
- package/workspace/public/pm/panel-tabs.js +0 -1506
- package/workspace/public/pm/panel-trees.js +0 -204
- package/workspace/public/pm/people-link.js +0 -106
- package/workspace/public/pm/phone-deck.js +0 -167
- package/workspace/public/pm/pm-work-view.js +0 -1533
- package/workspace/public/pm/portfolio-report.js +0 -61
- package/workspace/public/pm/premium-acts.js +0 -280
- package/workspace/public/pm/premium-brief.js +0 -111
- package/workspace/public/pm/premium-chat.js +0 -22
- package/workspace/public/pm/premium-doc-sheet.js +0 -312
- package/workspace/public/pm/premium-initiative.js +0 -324
- package/workspace/public/pm/premium-insights.css +0 -228
- package/workspace/public/pm/premium-metric-tiles.js +0 -68
- package/workspace/public/pm/premium-report-brief.js +0 -132
- package/workspace/public/pm/premium-vw-rec.js +0 -67
- package/workspace/public/pm/premium-wide.css +0 -30
- package/workspace/public/pm/print.css +0 -44
- package/workspace/public/pm/provider-cards.js +0 -136
- package/workspace/public/pm/registry.js +0 -203
- package/workspace/public/pm/release-card.js +0 -110
- package/workspace/public/pm/releases-view.js +0 -248
- package/workspace/public/pm/report-families-view.js +0 -505
- package/workspace/public/pm/report-slides.js +0 -438
- package/workspace/public/pm/report-tab.js +0 -33
- package/workspace/public/pm/report-view.js +0 -337
- package/workspace/public/pm/reports-copy.js +0 -134
- package/workspace/public/pm/roadmap.js +0 -294
- package/workspace/public/pm/run-card.js +0 -260
- package/workspace/public/pm/sessions-panel.js +0 -219
- package/workspace/public/pm/sheet-jira.js +0 -353
- package/workspace/public/pm/shell-bell.js +0 -163
- package/workspace/public/pm/shell-model.js +0 -83
- package/workspace/public/pm/shell-phone.js +0 -124
- package/workspace/public/pm/shell-readaloud.js +0 -53
- package/workspace/public/pm/shell-recording.js +0 -274
- package/workspace/public/pm/shell-ticker.js +0 -90
- package/workspace/public/pm/sig-watch.js +0 -41
- package/workspace/public/pm/slide-confirm.js +0 -163
- package/workspace/public/pm/slides-copy.js +0 -52
- package/workspace/public/pm/status-banner.js +0 -95
- package/workspace/public/pm/tab-doc.js +0 -859
- package/workspace/public/pm/tab-gone.js +0 -21
- package/workspace/public/pm/tab-term.js +0 -1210
- package/workspace/public/pm/tab-web.js +0 -90
- package/workspace/public/pm/timeline-copy.js +0 -48
- package/workspace/public/pm/timeline-forecast-view.js +0 -164
- package/workspace/public/pm/today-agenda.js +0 -331
- package/workspace/public/pm/today-cards.js +0 -244
- package/workspace/public/pm/today-copy.js +0 -506
- package/workspace/public/pm/today-day.js +0 -1371
- package/workspace/public/pm/today-goals.js +0 -297
- package/workspace/public/pm/today-jobs.js +0 -84
- package/workspace/public/pm/today-mentions.js +0 -50
- package/workspace/public/pm/topbar.js +0 -202
- package/workspace/public/pm/triage-card.js +0 -60
- package/workspace/public/pm/undo-hold.js +0 -103
- package/workspace/public/pm/view-addrepo.js +0 -208
- package/workspace/public/pm/view-files.js +0 -197
- package/workspace/public/pm/view-livenotes.js +0 -399
- package/workspace/public/pm/view-today.js +0 -13
- package/workspace/public/pm/view-validate.js +0 -171
- package/workspace/public/pm/welcome.js +0 -391
- package/workspace/public/pm/work-place.js +0 -68
- package/workspace/public/pm/xlsx-read.js +0 -117
- package/workspace/public/welcome.html +0 -22
- package/workspace/test-lists/browser-suites-green.json +0 -5
- package/workspace/test-lists/c3-core-docs.json +0 -9
- package/workspace/test-lists/c3-doc-sheet-rich.json +0 -6
- package/workspace/test-lists/c3-doc-sheet-size.json +0 -6
- package/workspace/test-lists/c3-doc-sheet-v2.json +0 -6
- package/workspace/test-lists/c3-ib-items.json +0 -9
- package/workspace/test-lists/c3-ib-more.json +0 -9
- package/workspace/test-lists/c3-ib-triage-backlog.json +0 -9
- package/workspace/test-lists/c3-ini-life.json +0 -9
- package/workspace/test-lists/c3-meeting-board.json +0 -5
- package/workspace/test-lists/c3-meeting-card.json +0 -5
- package/workspace/test-lists/c3-notes-place.json +0 -5
- package/workspace/test-lists/c3-notes-series.json +0 -5
- package/workspace/test-lists/calendar-time-page.json +0 -5
- package/workspace/test-lists/calpop.json +0 -4
- package/workspace/test-lists/console3-briefing.json +0 -9
- package/workspace/test-lists/console3-foundation.json +0 -9
- package/workspace/test-lists/console3-work-page.json +0 -9
- package/workspace/test-lists/premium-brief-parity.json +0 -9
- package/workspace/test-lists/report-design-studio-ui.json +0 -5
- package/workspace/test-lists/report-structure-ui.json +0 -11
- package/workspace/test-lists/report-workspace-ui.json +0 -5
- package/workspace/test-lists/run3-a.json +0 -5
- package/workspace/test-lists/run3-d.json +0 -6
- package/workspace/test-lists/run4-c.json +0 -13
- package/workspace/test-lists/today-goals-jobs-ui.json +0 -5
- package/workspace/test-lists/today-mentions-cards.json +0 -5
- package/workspace/test-lists/workspace-tabs-declutter.json +0 -13
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
/* pm/roadmap.js — the Roadmap: Now · Next · Later, ranked (pm-os-absorb Run 2, slice 2D; PRD R20 A, R15, R26, R27).
|
|
2
|
-
*
|
|
3
|
-
* Specimen A: Initiatives opens here. Three ranked columns, each a list of cards. Next and Later carry order only, never a
|
|
4
|
-
* date; a Now card shows its title, stage, "n of m", its health reason when it is not on track, and the check-by date. The
|
|
5
|
-
* header reads "Now · 5 KR · 3 health" and counts against the advisory cap.
|
|
6
|
-
*
|
|
7
|
-
* Ways to move a card, all through one write (POST /api/placements, a `placed` line with `after`):
|
|
8
|
-
* - drag the grip: to rank within a column, or into another (Sortable, bd-drag.js: a 150 ms hold on a touch screen);
|
|
9
|
-
* - Alt+ArrowUp / Alt+ArrowDown on the card;
|
|
10
|
-
* - the ⋯ menu, which is the phone's path: To top, Up, Down, Move to Now, Move to Next, Move to Later, Set check-by. The
|
|
11
|
-
* button shows where a touch screen is (any-pointer: coarse); on a desk the same menu opens from a right click or the menu
|
|
12
|
-
* key, so a card carries one control there, and first paint stays inside the budget.
|
|
13
|
-
* Only the PM's press moves a card into Now (R25): the page just posts, and the server's guard answers. A refusal shows in a
|
|
14
|
-
* toast and the card goes back where it was.
|
|
15
|
-
*
|
|
16
|
-
* The data is one GET (roadmap.json). Roadmap watches that GET's `sig` with sig-watch.js, so a placement written from the
|
|
17
|
-
* CLI or another tab shows within seconds, and never while a drag is live (the answer waits until the drop).
|
|
18
|
-
*
|
|
19
|
-
* mountRoadmap(host, env) → { dispose(), reload() }
|
|
20
|
-
* env = { repo, ws, openInitiative(repo, slug), onData?(answer) }
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import { el, withAnchor } from './dom.js';
|
|
24
|
-
import { card, iconButton, dragHandle, button, menu, empty, toast, SEL } from './primitives.js';
|
|
25
|
-
import { watchSig } from './sig-watch.js';
|
|
26
|
-
import { loadSortable, baseOptions, dragSet } from './bd-drag.js';
|
|
27
|
-
import { COPY, shortDate } from './initiatives-copy.js';
|
|
28
|
-
import { getRoadmap, sigKey, place, placed, leaveNow } from './initiatives-api.js';
|
|
29
|
-
import { healthSignal, say, checkBySheet, onContextMenu } from './initiatives-ui.js';
|
|
30
|
-
import { openDoc } from './panel-initiatives.js';
|
|
31
|
-
|
|
32
|
-
const HORIZONS = ['now', 'next', 'later'];
|
|
33
|
-
|
|
34
|
-
export function mountRoadmap(host, env) {
|
|
35
|
-
const root = el('div', { class: 'in-roadmap', 'data-in-view': 'roadmap' });
|
|
36
|
-
host.replaceChildren(root);
|
|
37
|
-
const drags = dragSet();
|
|
38
|
-
let data = null;
|
|
39
|
-
let error = null;
|
|
40
|
-
let showDormant = false;
|
|
41
|
-
let showUnrecorded = false;
|
|
42
|
-
let dragging = false;
|
|
43
|
-
let deferred = null;
|
|
44
|
-
let focusId = null;
|
|
45
|
-
let disposed = false;
|
|
46
|
-
let stop = null;
|
|
47
|
-
let latest = null; // the answer the sig watcher read last, drawn when its sig changed
|
|
48
|
-
|
|
49
|
-
const ids = (h) => ((data && data.horizons && data.horizons[h]) || []).map((r) => r.id);
|
|
50
|
-
const rowOf = (id) => {
|
|
51
|
-
for (const h of HORIZONS) { const r = ((data && data.horizons[h]) || []).find((x) => x.id === id); if (r) return r; }
|
|
52
|
-
return ((data && data.dormant) || []).find((x) => x.id === id) || null;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/* ── writes ───────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
56
|
-
|
|
57
|
-
/** The model after a move, so the card is where the PM put it before the server answers. */
|
|
58
|
-
function applyLocal(id, horizon, after, extra) {
|
|
59
|
-
const row = rowOf(id);
|
|
60
|
-
if (!row || !data) return;
|
|
61
|
-
for (const h of HORIZONS) data.horizons[h] = data.horizons[h].filter((x) => x.id !== id);
|
|
62
|
-
data.dormant = (data.dormant || []).filter((x) => x.id !== id);
|
|
63
|
-
row.horizon = horizon; row.dormant = false;
|
|
64
|
-
if (horizon === 'now') row.confirmed = true;
|
|
65
|
-
if (extra && 'check_by' in extra) row.check_by = extra.check_by;
|
|
66
|
-
const list = data.horizons[horizon];
|
|
67
|
-
const k = after ? list.findIndex((x) => x.id === after) : -1;
|
|
68
|
-
if (!after) list.unshift(row); else if (k === -1) list.push(row); else list.splice(k + 1, 0, row);
|
|
69
|
-
for (const h of HORIZONS) data.horizons[h].forEach((x, i) => { x.rank = i; });
|
|
70
|
-
const now = data.horizons.now;
|
|
71
|
-
data.header = {
|
|
72
|
-
now: { ...data.header.now, count: now.length, kr: now.filter((x) => x.anchor_kind === 'kr').length, health: now.filter((x) => x.anchor_kind === 'health').length },
|
|
73
|
-
next: { count: data.horizons.next.length },
|
|
74
|
-
later: { count: data.horizons.later.length, dormant: data.dormant.length },
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async function move(id, horizon, after, extra, okText) {
|
|
79
|
-
extra = extra || leaveNow(rowOf(id), horizon); // a card that leaves Now takes its check-by off the ledger too
|
|
80
|
-
applyLocal(id, horizon, after, extra);
|
|
81
|
-
render();
|
|
82
|
-
const out = await place(env.ws, [placed(id, horizon, after, extra)]);
|
|
83
|
-
if (say(out, okText)) { if (out.sig && data) data.sig = out.sig; }
|
|
84
|
-
await reload();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const afterOfRank = (h, id) => {
|
|
88
|
-
const list = ids(h);
|
|
89
|
-
const i = list.indexOf(id);
|
|
90
|
-
return { list, i };
|
|
91
|
-
};
|
|
92
|
-
const toTop = (id) => { const r = rowOf(id); if (r) move(id, r.horizon, null, null, COPY.moved.top(r.title)); };
|
|
93
|
-
function up(id) {
|
|
94
|
-
const r = rowOf(id); if (!r || r.dormant) return;
|
|
95
|
-
const { list, i } = afterOfRank(r.horizon, id);
|
|
96
|
-
if (i <= 0) return;
|
|
97
|
-
move(id, r.horizon, i >= 2 ? list[i - 2] : null);
|
|
98
|
-
}
|
|
99
|
-
function down(id) {
|
|
100
|
-
const r = rowOf(id); if (!r || r.dormant) return;
|
|
101
|
-
const { list, i } = afterOfRank(r.horizon, id);
|
|
102
|
-
if (i < 0 || i >= list.length - 1) return;
|
|
103
|
-
move(id, r.horizon, list[i + 1]);
|
|
104
|
-
}
|
|
105
|
-
const toHorizon = (id, h) => { const r = rowOf(id); if (r) move(id, h, null, null, COPY.moved[h](r.title)); };
|
|
106
|
-
function setCheckBy(id) {
|
|
107
|
-
const r = rowOf(id); if (!r) return;
|
|
108
|
-
const { list, i } = afterOfRank(r.horizon, id);
|
|
109
|
-
const after = i > 0 ? list[i - 1] : null;
|
|
110
|
-
checkBySheet({
|
|
111
|
-
title: COPY.menu.setCheckBy, value: r.check_by,
|
|
112
|
-
onSave: async (date) => {
|
|
113
|
-
const out = await place(env.ws, [placed(id, r.horizon, after, { check_by: date })]);
|
|
114
|
-
if (out && out.ok) { toast({ text: COPY.moved.checkBy(r.title, date ? shortDate(date) : ''), timeout: 4000 }); reload(); }
|
|
115
|
-
return out;
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function openMenu(anchor, id) {
|
|
121
|
-
const r = rowOf(id); if (!r) return;
|
|
122
|
-
const list = ids(r.horizon);
|
|
123
|
-
const i = list.indexOf(id);
|
|
124
|
-
const items = [{ label: COPY.menu.open, onSelect: () => env.openInitiative(env.repo, id) }];
|
|
125
|
-
const order = [];
|
|
126
|
-
if (!r.dormant && i > 0) order.push({ label: COPY.menu.toTop, onSelect: () => toTop(id) }, { label: COPY.menu.up, onSelect: () => up(id) });
|
|
127
|
-
if (!r.dormant && i >= 0 && i < list.length - 1) order.push({ label: COPY.menu.down, onSelect: () => down(id) });
|
|
128
|
-
if (order.length) items.push({ sep: true }, ...order);
|
|
129
|
-
items.push({ sep: true });
|
|
130
|
-
for (const h of HORIZONS) if (r.horizon !== h || r.dormant) items.push({ label: COPY.menu['move' + h[0].toUpperCase() + h.slice(1)], onSelect: () => toHorizon(id, h) });
|
|
131
|
-
if (r.horizon === 'now') items.push({ sep: true }, { label: COPY.menu.setCheckBy, onSelect: () => setCheckBy(id) });
|
|
132
|
-
menu({ anchor, items, ariaLabel: COPY.aria.more(r.title) });
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/* ── drawing ──────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
136
|
-
|
|
137
|
-
function cardOf(r, { grip }) {
|
|
138
|
-
const meta = [r.display && r.display.word, r.progress && r.progress.label];
|
|
139
|
-
if (r.horizon === 'now' && !r.confirmed) meta.push(COPY.unconfirmed);
|
|
140
|
-
if (r.horizon === 'now' && r.check_by) meta.push(COPY.checkBy(shortDate(r.check_by)));
|
|
141
|
-
const hs = healthSignal(r.health);
|
|
142
|
-
const more = iconButton({
|
|
143
|
-
icon: 'ellipsis', size: 'sm', ariaLabel: COPY.aria.more(r.title), expanded: false,
|
|
144
|
-
onClick: (e) => { e.stopPropagation(); openMenu(e.currentTarget, r.id); },
|
|
145
|
-
attrs: { class: 'in-more', 'aria-haspopup': 'menu', 'data-in-more': r.id },
|
|
146
|
-
});
|
|
147
|
-
return card({
|
|
148
|
-
title: r.title, meta, signals: hs ? [hs] : [], lead: grip ? [el('span', { class: 'in-grip' }, dragHandle({ label: COPY.aria.reorder(r.title) }))] : [], trail: [more],
|
|
149
|
-
onOpen: () => env.openInitiative(env.repo, r.id), openLabel: COPY.aria.open(r.title),
|
|
150
|
-
attrs: { class: 'in-card', 'data-in-card': r.id, 'data-horizon': r.horizon, 'data-health': r.health ? r.health.level : 'unknown' },
|
|
151
|
-
openAttrs: { 'data-in-open': r.id },
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// A unit with documents and no record (routes-initiatives.js unrecordedOf). It opens its PRD, or its first document; it
|
|
156
|
-
// has no menu and no grip, because only a record can be placed.
|
|
157
|
-
function unrecordedCard(u) {
|
|
158
|
-
const doc = u.artifacts.find((a) => a.role === 'PRD') || u.artifacts[0];
|
|
159
|
-
const roles = [...new Set(u.artifacts.map((a) => a.role).filter(Boolean))];
|
|
160
|
-
return card({
|
|
161
|
-
title: u.title, meta: [COPY.noRecord, ...(roles.length ? [roles.join(' · ')] : [])],
|
|
162
|
-
onOpen: () => openDoc(null, doc.path, doc.role || 'DOC'), openLabel: COPY.aria.open(u.title),
|
|
163
|
-
muted: true, attrs: { class: 'in-card', 'data-in-unrecorded-card': u.id }, openAttrs: { 'data-in-unrecorded-open': u.id },
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function column(h) {
|
|
168
|
-
const rows = data.horizons[h] || [];
|
|
169
|
-
const list = el('div', { class: 'in-list', 'data-in-list': h, role: 'list', 'aria-label': COPY.aria.column(COPY.horizons[h]) }, rows.map((r) => cardOf(r, { grip: true })));
|
|
170
|
-
const kids = [
|
|
171
|
-
el('div', { class: 'in-col__head' }, el('span', { class: 'in-col__name' }, COPY.horizons[h]), el('span', { class: 'in-col__count', 'data-in-count': h }, String(rows.length))),
|
|
172
|
-
];
|
|
173
|
-
if (!rows.length) kids.push(el('p', { class: 'in-col__empty' }, COPY.emptyColumn[h]));
|
|
174
|
-
kids.push(list);
|
|
175
|
-
if (h === 'later' && data.dormant && data.dormant.length) {
|
|
176
|
-
kids.push(button({
|
|
177
|
-
label: showDormant ? COPY.hideDormant(data.dormant.length) : COPY.dormant(data.dormant.length), variant: 'ghost', size: 'sm',
|
|
178
|
-
icon: showDormant ? 'chevron-down' : 'chevron-right', attrs: { 'data-in-dormant-toggle': '', 'aria-expanded': showDormant ? 'true' : 'false' },
|
|
179
|
-
onClick: () => { showDormant = !showDormant; render(); },
|
|
180
|
-
}));
|
|
181
|
-
if (showDormant) kids.push(el('div', { class: 'in-list in-list--dormant', 'data-in-dormant': '' }, data.dormant.map((r) => cardOf(r, { grip: false }))));
|
|
182
|
-
}
|
|
183
|
-
if (h === 'later' && data.unrecorded && data.unrecorded.length) {
|
|
184
|
-
const n = data.unrecorded.length;
|
|
185
|
-
kids.push(button({
|
|
186
|
-
label: showUnrecorded ? COPY.hideUnrecorded(n) : COPY.unrecorded(n), variant: 'ghost', size: 'sm',
|
|
187
|
-
icon: showUnrecorded ? 'chevron-down' : 'chevron-right', attrs: { 'data-in-unrecorded-toggle': '', 'aria-expanded': showUnrecorded ? 'true' : 'false' },
|
|
188
|
-
onClick: () => { showUnrecorded = !showUnrecorded; render(); },
|
|
189
|
-
}));
|
|
190
|
-
if (showUnrecorded) kids.push(el('div', { class: 'in-list in-list--dormant', 'data-in-unrecorded': '' }, data.unrecorded.map(unrecordedCard)));
|
|
191
|
-
}
|
|
192
|
-
return el('section', { class: 'in-col', 'data-in-col': h, 'aria-label': COPY.horizons[h] }, kids);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function headLine() {
|
|
196
|
-
const n = data.header.now;
|
|
197
|
-
const over = n.cap && n.count > n.cap;
|
|
198
|
-
return el('div', { class: 'in-nowline' + (over ? ' in-nowline--over' : ''), 'data-in-nowline': '', title: over ? COPY.overCap(n.count, n.cap) : null }, COPY.nowLine(n));
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function render() {
|
|
202
|
-
if (disposed) return;
|
|
203
|
-
const active = document.activeElement && document.activeElement.getAttribute ? document.activeElement.getAttribute('data-in-open') : null;
|
|
204
|
-
const refocus = focusId || active;
|
|
205
|
-
focusId = null;
|
|
206
|
-
drags.destroy();
|
|
207
|
-
if (!data) {
|
|
208
|
-
root.replaceChildren(error ? el('p', { class: 'in-note in-note--error', role: 'alert' }, COPY.readFailed(error)) : empty({ text: COPY.reading }));
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
const kids = [headLine(), el('p', { class: 'in-note in-hint', 'data-in-hint': '' }, COPY.menuHintCard)];
|
|
212
|
-
if (data.flags && data.flags.length) kids.push(el('p', { class: 'in-note', 'data-in-flags': '' }, COPY.flags(data.flags.length)));
|
|
213
|
-
kids.push(el('div', { class: 'in-cols', 'data-in-cols': '' }, HORIZONS.map(column)));
|
|
214
|
-
withAnchor(root.closest('.fr-dest'), root, 'data-in-card', () => root.replaceChildren(...kids));
|
|
215
|
-
if (refocus) { const t = root.querySelector('[data-in-open="' + CSS.escape(refocus) + '"]'); if (t) t.focus({ preventScroll: true }); }
|
|
216
|
-
bindDrag();
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function bindDrag() {
|
|
220
|
-
loadSortable().then((S) => {
|
|
221
|
-
if (!S || disposed) return;
|
|
222
|
-
drags.destroy();
|
|
223
|
-
for (const list of root.querySelectorAll('.in-list[data-in-list]')) {
|
|
224
|
-
drags.add(new S(list, baseOptions({
|
|
225
|
-
group: 'in-roadmap', handle: SEL.drag, draggable: '.in-card',
|
|
226
|
-
onStart: () => { dragging = true; },
|
|
227
|
-
onEnd: (evt) => {
|
|
228
|
-
dragging = false;
|
|
229
|
-
const id = evt.item && evt.item.getAttribute('data-in-card');
|
|
230
|
-
const to = evt.to && evt.to.getAttribute('data-in-list');
|
|
231
|
-
if (!id || !to) { render(); return; }
|
|
232
|
-
const others = ids(to).filter((x) => x !== id);
|
|
233
|
-
const k = Math.max(0, Math.min(evt.newIndex, others.length));
|
|
234
|
-
const after = k > 0 ? others[k - 1] : null;
|
|
235
|
-
const r = rowOf(id);
|
|
236
|
-
if (r && r.horizon === to && ids(to).indexOf(id) === k) { render(); return; }
|
|
237
|
-
move(id, to, after);
|
|
238
|
-
if (deferred) { const d = deferred; deferred = null; adopt(d); }
|
|
239
|
-
},
|
|
240
|
-
})));
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/* The card menu is the phone's path (the ⋯ button shows where a touch screen is). On a desk it opens from the context menu:
|
|
246
|
-
* a right click, or the menu key on a focused card. */
|
|
247
|
-
onContextMenu(root, (t) => {
|
|
248
|
-
const node = t && t.closest ? t.closest('[data-in-card]') : null;
|
|
249
|
-
const open = node && node.querySelector('[data-in-open]');
|
|
250
|
-
return open ? { anchor: open, id: node.getAttribute('data-in-card') } : null;
|
|
251
|
-
}, openMenu);
|
|
252
|
-
|
|
253
|
-
/* ── keyboard: Alt+ArrowUp / Alt+ArrowDown on a card reorder it ──────────────────────────────────────────────── */
|
|
254
|
-
root.addEventListener('keydown', (e) => {
|
|
255
|
-
if (!e.altKey || e.ctrlKey || e.metaKey || (e.key !== 'ArrowUp' && e.key !== 'ArrowDown')) return;
|
|
256
|
-
const open = e.target && e.target.closest ? e.target.closest('[data-in-open]') : null;
|
|
257
|
-
if (!open) return;
|
|
258
|
-
e.preventDefault(); e.stopPropagation();
|
|
259
|
-
const id = open.getAttribute('data-in-open');
|
|
260
|
-
focusId = id;
|
|
261
|
-
if (e.key === 'ArrowUp') up(id); else down(id);
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
/* ── reading ──────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
265
|
-
|
|
266
|
-
function adopt(answer) {
|
|
267
|
-
if (disposed) return;
|
|
268
|
-
if (dragging) { deferred = answer; return; }
|
|
269
|
-
data = answer; error = null;
|
|
270
|
-
if (env.onData) env.onData(answer);
|
|
271
|
-
render();
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
let reads = 0; // only the newest read is drawn: an older answer that comes back late is dropped
|
|
275
|
-
async function reload() {
|
|
276
|
-
const mine = ++reads;
|
|
277
|
-
const a = await getRoadmap(env.ws);
|
|
278
|
-
if (disposed || mine !== reads) return;
|
|
279
|
-
if (a && a.ok) adopt(a);
|
|
280
|
-
else if (!data) { error = (a && a.error) || 'the server did not answer'; render(); }
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
render();
|
|
284
|
-
reload().then(() => {
|
|
285
|
-
if (disposed) return;
|
|
286
|
-
stop = watchSig(async () => { const a = await getRoadmap(env.ws); if (a && a.ok) { latest = a; return sigKey(a); } return null; },
|
|
287
|
-
() => { if (latest) adopt(latest); }, { everyMs: 10000 });
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
return {
|
|
291
|
-
reload,
|
|
292
|
-
dispose() { disposed = true; if (stop) stop(); drags.destroy(); },
|
|
293
|
-
};
|
|
294
|
-
}
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
/* pm/run-card.js — one run as a card, on agent-surfaces.html's card anatomy, from scripts/card-state.js cardFor() output.
|
|
2
|
-
* mountRunCard(host, ctx) ctx = { id, name, card, observed?, origin?, src, refresh(), openSession(), fileBody?(path), glossary?, accepted? }
|
|
3
|
-
* disposeRunCard(host)
|
|
4
|
-
* The card, top to bottom: the tag and where it came from; the headline; the work as a thin strip (the CLI's own tool calls when the card carries
|
|
5
|
-
* them: `observed`, otherwise the agent's reported steps, labelled as that); a permission card ("Wants to run"), the agent's question with its
|
|
6
|
-
* options as chips, or a failure box; or the result (hero and labelled claims, by type: c3-terminal-results.js); then the next moves the contract
|
|
7
|
-
* gives (Accept, Revise, Reject, Define, the agent's suggestions, Say) and a mic.
|
|
8
|
-
* Gestures (c3-swipe.js, card-state.swipeAction): swipe right = the card's primary move (Accept, on a finished result), swipe left = the reply tray
|
|
9
|
-
* (the agent's suggested chips and a free line). A swipe sends nothing outward. Keys: ArrowRight, ArrowLeft on the focused card.
|
|
10
|
-
* Presses: Accept is POST /api/runs/answer {behavior:'accept'}; Revise and Reject are POST /api/runs/correction (the correction signal); a permission
|
|
11
|
-
* is POST /api/runs/answer {allow|deny}; the agent's question is {answer, message: an offered option}. Every one is the PM's press. A suggestion,
|
|
12
|
-
* a revision, the free line and Retry are typed into the session (ctx.src.send); a source that cannot send says why (ctx.src.canPrompt, ctx.src.why).
|
|
13
|
-
* Per-run UI state (the open tray, the Revise chips, the flipped face) lives in `UI`, outside the render, so a poll never closes it. */
|
|
14
|
-
import { el } from './dom.js';
|
|
15
|
-
import { button } from './primitives.js';
|
|
16
|
-
import { ic } from './c3-terminal-icons.js';
|
|
17
|
-
import { ensureC3Css } from './pm-work-view.js';
|
|
18
|
-
import { attachSwipe } from './c3-swipe.js';
|
|
19
|
-
import { toast } from './c3-toast.js';
|
|
20
|
-
import { resultNodes, claimsList } from './c3-terminal-results.js';
|
|
21
|
-
|
|
22
|
-
const live = new WeakMap();
|
|
23
|
-
const UI = new Map();
|
|
24
|
-
export const uiFor = (id) => { if (!UI.has(id)) UI.set(id, {}); return UI.get(id); };
|
|
25
|
-
const MOVE_ICON = { accept: 'check', revise: 'edit', reject: 'x', define: 'book', say: 'reply', suggest: 'spark' };
|
|
26
|
-
const TAGS = { asking: ['Needs your answer', 'var(--warning)'], permission: ['Needs your permission', 'var(--warning)'], attention: ['Needs the terminal', 'var(--warning)'], working: ['Working', 'var(--acc)'], queued: ['Starting', 'var(--acc)'],
|
|
27
|
-
not_started: ['Not started', 'var(--warning)'], paused: ['Paused', 'var(--warning)'], quiet: ['Quiet', 'var(--warning)'], degraded: ['Plain text only', 'var(--warning)'], failed: ['Failed', 'var(--destructive)'], done: ['Result', 'var(--success)'] };
|
|
28
|
-
const RESULT_TAG = { Critical: 'var(--destructive)', 'Just in': 'var(--acc)', 'Small win': 'var(--success)', 'Big win': 'var(--success)', Opportunity: 'var(--purple)' };
|
|
29
|
-
const MIN_QUIET = '2 minutes';
|
|
30
|
-
|
|
31
|
-
const pressErr = (r, what) => toast({ text: what + ' not recorded: ' + ((r && r.error) || 'the server did not answer'), tone: 'error' });
|
|
32
|
-
const dim = (t) => el('span', { class: 'dim mono', style: 'font-size:var(--fs-2)' }, t);
|
|
33
|
-
|
|
34
|
-
function stripNode(card, observed) {
|
|
35
|
-
const obs = (observed || []).slice();
|
|
36
|
-
const steps = card.steps || [];
|
|
37
|
-
const last = obs.length ? (obs[obs.length - 1].tool + ' ' + obs[obs.length - 1].what) : steps[steps.length - 1];
|
|
38
|
-
const working = card.state === 'working' || card.state === 'queued';
|
|
39
|
-
const kids = [];
|
|
40
|
-
if (working) kids.push(el('div', { class: 'line', role: 'status' }, el('span', { class: 'c3spin' }, ic('run', 'sm')), el('span', { class: 't' }, last || card.title)));
|
|
41
|
-
if (obs.length) {
|
|
42
|
-
kids.push(el('div', { class: 'c3t-obs', 'aria-label': 'Tool calls the CLI made' }, obs.slice(-4).map((o) => el('span', { class: 'chip2', title: o.tool + ' ' + o.what }, el('b', null, o.tool), ' ' + o.what))));
|
|
43
|
-
kids.push(dim('observed: ' + obs.length + ' tool call' + (obs.length === 1 ? '' : 's') + ' the CLI made' + (steps.length ? ' · the agent reported ' + steps.length + ' step' + (steps.length === 1 ? '' : 's') : '')));
|
|
44
|
-
} else if (steps.length) {
|
|
45
|
-
kids.push(el('div', { class: 'c3t-obs' }, steps.slice(-3).map((s) => el('span', { class: 'chip2' }, s))), dim('reported by the agent, not checked'));
|
|
46
|
-
}
|
|
47
|
-
if (working && steps.length) kids.push(el('div', { class: 'prog', 'aria-hidden': 'true' }, steps.map(() => el('i', { class: 'd' })), el('i')));
|
|
48
|
-
return kids.length ? el('div', { class: 'c3t-run' }, kids) : null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* ── the held requests ── */
|
|
52
|
-
function permissionBox(ctx, p) {
|
|
53
|
-
const { src, id } = ctx;
|
|
54
|
-
const send = async (behavior, message) => { const r = await src.answer({ run: id, request: p.request, behavior, message: message || '' }); if (r && r.ok) { toast(behavior === 'allow' ? 'Allowed once. The CLI continues.' : 'Denied. Nothing left the repo.'); ctx.refresh(); } else pressErr(r, 'The answer'); };
|
|
55
|
-
return el('div', { class: 'ask', 'data-run-permission': p.request },
|
|
56
|
-
el('b', { class: 'chips2' }, ic('alert', 'sm'), 'Wants to run'),
|
|
57
|
-
el('div', { class: 'raw' }, '$ ' + (p.command || '')),
|
|
58
|
-
dim([p.why, 'in ' + (p.cwd || 'the session folder')].filter(Boolean).join(' · ')),
|
|
59
|
-
dim('The CLI is holding this call until you press.'),
|
|
60
|
-
el('div', { class: 'c3t-tray' }, el('button', { type: 'button', class: 'pill rec', 'data-perm': 'allow', onclick: () => send('allow') }, 'Allow once'),
|
|
61
|
-
p.remember ? el('button', { type: 'button', class: 'pill', 'data-perm': 'always', onclick: () => send('allow', 'always ' + p.remember) }, 'Allow pushes to ' + String(p.remember).split('/').pop()) : null,
|
|
62
|
-
el('button', { type: 'button', class: 'pill', 'data-perm': 'deny', onclick: () => send('deny', 'the PM denied this') }, 'Deny')));
|
|
63
|
-
}
|
|
64
|
-
function questionBox(ctx, card) {
|
|
65
|
-
const { src, id } = ctx;
|
|
66
|
-
const send = async (label) => { const r = await src.answer({ run: id, request: card.asked || card.ask.id, behavior: 'answer', message: label }); if (r && r.ok) { toast('Answered. The agent continues with your choice.'); ctx.refresh(); } else pressErr(r, 'The answer'); };
|
|
67
|
-
return el('div', { class: 'ask', 'data-run-question': card.ask.id }, el('b', null, card.ask.q), el('div', { class: 'c3t-tray' }, (card.ask.options || []).map((o) => el('button', { type: 'button', class: 'pill' + (o.rec ? ' rec' : ''), onclick: () => send(o.label) }, o.label))));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/* ── failure boxes: what failed, in words, and the way on ── */
|
|
71
|
-
function failBox(ctx, card, ui) {
|
|
72
|
-
const code = card.failure && card.failure.code;
|
|
73
|
-
const rejected = (card.problems || []).find((p) => /^result rejected/.test(p));
|
|
74
|
-
let title, why, warn = false; let retry = false; let asAgain = false;
|
|
75
|
-
if (card.state === 'quiet') { title = 'No output for ' + MIN_QUIET; why = 'It may be stuck. You can open the session.'; retry = true; warn = true; }
|
|
76
|
-
else if (card.state === 'not_started') { title = 'The session has not started'; why = 'No sign of life yet. The CLI may be waiting for you to trust the folder.'; warn = true; retry = true; }
|
|
77
|
-
else if (card.state === 'attention') { title = 'This session needs something only the terminal can show'; why = (card.attention && card.attention.message) || 'Open the session to continue.'; warn = true; }
|
|
78
|
-
else if (card.state === 'degraded') { title = 'The agent replied in plain text'; why = 'It did not use the format, so nothing here is checked: no labels, no sources. It cannot back a message.'; warn = true; asAgain = true; }
|
|
79
|
-
else if (card.state === 'failed') {
|
|
80
|
-
if (rejected) { title = 'The reply could not be read'; why = rejected.replace(/^result rejected: /, 'Result rejected: ') + '. Nothing on the card changed.'; }
|
|
81
|
-
else if (code === 'blocked') { title = 'Blocked'; why = card.failure.why; }
|
|
82
|
-
else if (code === 'api_error') { title = 'The turn failed on an API error'; why = 'Nothing on the card changed. Retrying usually works.'; retry = true; }
|
|
83
|
-
else if (code === 'format') { title = 'Recorded in a newer format'; why = card.failure.why; }
|
|
84
|
-
else if (code === 'background') { title = 'The background run did not finish its work'; why = card.failure.why; retry = false; }
|
|
85
|
-
else if (code === 'crashed') { title = 'The session ended with an error'; why = 'It exited with a non-zero code. Nothing on the card changed.'; retry = true; }
|
|
86
|
-
else { title = 'The session ended without a usable result'; why = 'Nothing on the card changed.'; retry = true; }
|
|
87
|
-
} else return null;
|
|
88
|
-
const can = ctx.src.canPrompt;
|
|
89
|
-
const nodes = [el('b', { class: 'chips2' }, ic(warn ? 'alert' : 'x', 'sm'), title), dim(why)];
|
|
90
|
-
if (card.state === 'degraded' && card.fallbackText) nodes.push(el('div', { class: 'draft' }, card.fallbackText));
|
|
91
|
-
if (ui.raw && (card.problems || []).length) nodes.push(el('div', { class: 'raw' }, (card.problems || []).map((p) => el('div', null, '> ' + p))));
|
|
92
|
-
nodes.push(el('div', { class: 'c3t-tray' },
|
|
93
|
-
(retry || asAgain) ? button({ label: asAgain ? 'Ask again in the format' : card.state === 'not_started' ? 'Try again' : 'Retry', disabled: !can || card.state === 'not_started', onClick: async () => { const r = await ctx.src.send(ctx.id, { verb: 'retry' }); if (r && r.ok) ctx.refresh(); },
|
|
94
|
-
attrs: { class: 'pill rec', 'data-retry': '', title: !can ? ctx.src.why : card.state === 'not_started' ? NOSTART : 'Types "Please try that again." into the session' } }) : null,
|
|
95
|
-
openBtn(ctx),
|
|
96
|
-
(card.problems || []).length ? el('button', { type: 'button', class: 'pill', 'aria-pressed': String(!!ui.raw), onclick: () => { ui.raw = !ui.raw; ctx.redraw(); } }, ui.raw ? 'Hide' : 'What it said') : null,
|
|
97
|
-
el('button', { type: 'button', class: 'ib', 'aria-label': 'Dismiss', title: 'Dismiss this notice', onclick: () => { ui.hidden = card.state + ':' + (code || ''); ctx.redraw(); } }, ic('x', 'sm'))));
|
|
98
|
-
return el('div', { class: 'fail' + (warn ? ' w' : ''), 'data-run-fail': card.state, role: 'group' }, nodes);
|
|
99
|
-
}
|
|
100
|
-
function pausedBox(ctx, card) {
|
|
101
|
-
const at = (card.pause && card.pause.resume_at) || null;
|
|
102
|
-
return el('div', { class: 'ask', 'data-run-paused': '' }, el('b', { class: 'chips2' }, ic('run', 'sm'), 'Paused: usage limit'), dim(at ? 'Resumes by itself at about ' + at + '. Everything done so far is kept.' : 'The run is paused, not failed. Everything done so far is kept.'),
|
|
103
|
-
el('div', { class: 'prog', 'aria-hidden': 'true' }, el('i', { class: 'd' }), el('i', { class: 'd' }), el('i'), el('i')), el('div', { class: 'c3t-tray' }, openBtn(ctx)));
|
|
104
|
-
}
|
|
105
|
-
// a session that has not started may be at the CLI's trust-the-folder question, where a typed Enter would answer it
|
|
106
|
-
const NOSTART = 'Open the session to see what it waits for: typing into it now could answer a question you have not read.';
|
|
107
|
-
function flipBtn(ui, ctx) {
|
|
108
|
-
const b = button({ variant: 'ghost', onClick: () => { ui.flip = true; ctx.redraw(); }, attrs: { class: 'ib', 'aria-label': 'Flip to the case file', title: 'Case file' } });
|
|
109
|
-
b.replaceChildren(ic('flip', 'sm'));
|
|
110
|
-
return b;
|
|
111
|
-
}
|
|
112
|
-
export function openBtn(ctx) {
|
|
113
|
-
const b = button({ label: 'Open the session', onClick: () => ctx.openSession && ctx.openSession(ctx.id), attrs: { class: 'pill c3t-open', 'data-open-session': '', title: 'Open the session: its real terminal, on this page' } });
|
|
114
|
-
b.prepend(ic('term', 'sm'));
|
|
115
|
-
return b;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/* ── the next moves, the sub-chips, the tray, the voice line ── */
|
|
119
|
-
function movesNode(ctx, card, ui) {
|
|
120
|
-
const can = ctx.src.canPrompt;
|
|
121
|
-
const doMove = async (m) => {
|
|
122
|
-
if (m.verb === 'accept') {
|
|
123
|
-
const r = await ctx.src.answer({ run: ctx.id, request: 'result', behavior: 'accept' });
|
|
124
|
-
if (r && r.ok) { ui.accepted = true; ui.sub = null; toast('Recorded as your acceptance.'); ctx.refresh(); ctx.redraw(); } else pressErr(r, 'The acceptance');
|
|
125
|
-
} else if (m.verb === 'revise' || m.verb === 'reject' || m.verb === 'define') { ui.sub = ui.sub === m.verb ? null : m.verb; ui.def = null; ctx.redraw(); }
|
|
126
|
-
else if (m.verb === 'say') { ui.tray = !ui.tray; ctx.redraw(); }
|
|
127
|
-
else if (m.verb === 'suggest') { const r = await ctx.src.send(ctx.id, { verb: 'suggest', label: m.label, prompt: m.prompt }); if (r && r.ok) { toast('Asked: ' + m.label); ctx.refresh(); } }
|
|
128
|
-
};
|
|
129
|
-
const bar = el('div', { class: 'c3t-tray c3mv', 'data-run-moves': '' }, (card.nextMoves || []).map((m) => {
|
|
130
|
-
const off = (m.verb === 'suggest') && !can;
|
|
131
|
-
return el('button', { type: 'button', class: 'pill' + (ui.sub === m.verb || (m.verb === 'say' && ui.tray) ? ' on' : ''), 'data-move': m.verb, 'aria-pressed': ['revise', 'reject', 'define', 'say'].includes(m.verb) ? String(ui.sub === m.verb || (m.verb === 'say' && !!ui.tray)) : null,
|
|
132
|
-
disabled: off, title: m.by === 'agent' ? (off ? ctx.src.why + ' It would send: ' + m.prompt : 'The agent suggests this and will be told: ' + m.prompt) : null, onclick: () => doMove(m) }, ic(MOVE_ICON[m.verb] || 'spark', 'sm'), m.label);
|
|
133
|
-
}),
|
|
134
|
-
el('button', { type: 'button', class: 'pill', 'data-move': 'mic', 'aria-label': 'Speak', disabled: !(can || ctx.src.voice), title: ctx.src.voice ? 'Speak (transcribed on this machine; nothing leaves it)' : ctx.src.why, onclick: () => voiceStart(ctx) }, ic('mic', 'sm')),
|
|
135
|
-
el('span', { style: 'flex:1' }),
|
|
136
|
-
el('button', { type: 'button', class: 'ib', 'data-flip': '', 'aria-label': 'Flip to the case file', title: 'Case file', onclick: () => { ui.flip = true; ctx.redraw(); } }, ic('flip', 'sm')));
|
|
137
|
-
const sub = [];
|
|
138
|
-
if (ui.sub === 'revise') sub.push(el('div', { class: 'c3t-tray', 'data-run-revise': '' }, dim('How?'), (card.revise || []).map((t) => el('button', { type: 'button', class: 'pill', onclick: () => correct(ctx, 'revise', t) }, t))));
|
|
139
|
-
if (ui.sub === 'reject') sub.push(el('div', { class: 'c3t-tray', 'data-run-reject': '' }, dim('Why?'), (card.reject || []).map((t) => el('button', { type: 'button', class: 'pill', onclick: () => correct(ctx, 'reject', t) }, t))));
|
|
140
|
-
if (ui.sub === 'define') {
|
|
141
|
-
const g = ctx.glossary || {}; const keys = Object.keys(g);
|
|
142
|
-
sub.push(keys.length ? el('div', { class: 'c3t-tray' }, keys.map((k) => el('button', { type: 'button', class: 'pill' + (ui.defK === k ? ' on' : ''), onclick: () => { ui.defK = k; ui.def = g[k]; ctx.redraw(); } }, k))) : dim('No glossary term is defined for this run.'));
|
|
143
|
-
if (ui.def) sub.push(dim(ui.def));
|
|
144
|
-
}
|
|
145
|
-
return [bar, ...sub];
|
|
146
|
-
}
|
|
147
|
-
async function correct(ctx, kind, reason) {
|
|
148
|
-
const ui = uiFor(ctx.id);
|
|
149
|
-
const r = await ctx.src.correct({ run: ctx.id, kind, reason });
|
|
150
|
-
if (!(r && r.ok)) { pressErr(r, 'The correction'); return; }
|
|
151
|
-
ui.sub = null;
|
|
152
|
-
if (kind === 'reject') { ui.rejected = reason; toast('Rejected: ' + reason + '. Counted as a correction.'); }
|
|
153
|
-
else if (ctx.src.canPrompt) { await ctx.src.send(ctx.id, { verb: 'revise', arg: reason }); toast('Revised. Counted as a correction.'); }
|
|
154
|
-
else toast('Counted as a correction. The revision itself cannot be sent from this page: open the session.');
|
|
155
|
-
ctx.refresh(); ctx.redraw();
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function trayNode(ctx, card, ui) {
|
|
159
|
-
const can = ctx.src.canPrompt;
|
|
160
|
-
const chips = (card.nextMoves || []).filter((m) => m.verb === 'suggest');
|
|
161
|
-
const send = async (text) => { const r = await ctx.src.send(ctx.id, { verb: 'free', text }); if (r && r.ok) { (ui.say = ui.say || []).push({ q: text, a: r.say }); ui.tray = false; ctx.refresh(); ctx.redraw(); } };
|
|
162
|
-
const input = el('input', { type: 'text', 'aria-label': 'Reply to the agent', placeholder: can ? 'Reply…' : 'Reply (not available here)', readonly: !can, disabled: !can, title: can ? '' : ctx.src.why, 'data-run-free': '' });
|
|
163
|
-
input.addEventListener('keydown', (e) => { if (e.key === 'Enter' && input.value.trim()) send(input.value.trim()); });
|
|
164
|
-
return el('div', { class: 'c3t-tray', 'data-run-tray': '' },
|
|
165
|
-
chips.map((m) => el('button', { type: 'button', class: 'pill', disabled: !can, title: can ? m.prompt : ctx.src.why + ' It would send: ' + m.prompt, onclick: async () => { const r = await ctx.src.send(ctx.id, { verb: 'suggest', label: m.label, prompt: m.prompt }); if (r && r.ok) { ui.tray = false; ctx.refresh(); ctx.redraw(); } } }, m.label)),
|
|
166
|
-
input,
|
|
167
|
-
el('button', { type: 'button', class: 'ib', 'aria-label': 'Speak', disabled: !ctx.src.voice, title: ctx.src.voice ? 'Speak (transcribed on this machine)' : ctx.src.why, onclick: () => voiceStart(ctx) }, ic('mic', 'sm')),
|
|
168
|
-
el('button', { type: 'button', class: 'ib', 'aria-label': 'Close reply', onclick: () => { ui.tray = false; ctx.redraw(); } }, ic('x', 'sm')),
|
|
169
|
-
can ? null : el('div', { class: 'dim mono', style: 'flex-basis:100%;font-size:var(--fs-1)' }, ctx.src.why));
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function voiceStart(ctx) {
|
|
173
|
-
const ui = uiFor(ctx.id); if (ui.voice || !ctx.src.voice) return;
|
|
174
|
-
ui.tray = false; ui.voice = { phase: 'listen' }; ctx.redraw();
|
|
175
|
-
ui.vt = setTimeout(() => {
|
|
176
|
-
if (!ui.voice) return;
|
|
177
|
-
const v = ctx.src.voice(); ui.voice = { phase: 'heard', ...v, left: v.autosend_ms ? Math.round(v.autosend_ms / 1000) : 0 }; ctx.redraw();
|
|
178
|
-
if (ui.voice.left) ui.vi = setInterval(() => { if (!ui.voice || ui.voice.phase !== 'heard') { clearInterval(ui.vi); return; } ui.voice.left -= 1; if (ui.voice.left <= 0) voiceSend(ctx); else ctx.redraw(); }, 1000);
|
|
179
|
-
}, 1300);
|
|
180
|
-
}
|
|
181
|
-
async function voiceSend(ctx, text) {
|
|
182
|
-
const ui = uiFor(ctx.id); const v = ui.voice; if (!v) return;
|
|
183
|
-
clearInterval(ui.vi); const t = text || v.text; ui.voice = null;
|
|
184
|
-
const r = await ctx.src.send(ctx.id, { verb: 'free', text: t });
|
|
185
|
-
if (r && r.ok) (ui.say = ui.say || []).push({ q: t, a: r.say });
|
|
186
|
-
ctx.refresh(); ctx.redraw();
|
|
187
|
-
}
|
|
188
|
-
function voiceNode(ctx, ui) {
|
|
189
|
-
const v = ui.voice;
|
|
190
|
-
const stop = () => { clearInterval(ui.vi); clearTimeout(ui.vt); ui.voice = null; ctx.redraw(); };
|
|
191
|
-
if (v.phase === 'listen') return el('div', { class: 'ask', role: 'status' }, el('b', { class: 'chips2' }, el('span', { class: 'dotp' }), 'Listening'), dim('Transcribed on this machine. Nothing leaves it.'), el('div', { class: 'c3t-tray' }, el('button', { type: 'button', class: 'pill', onclick: stop }, 'Cancel')));
|
|
192
|
-
if (v.phase === 'edit') { const i = el('input', { type: 'text', value: v.text, 'aria-label': 'Edit the words' }); return el('div', { class: 'ask' }, dim('Edit the words, then send'), el('div', { class: 'c3t-tray' }, i, el('button', { type: 'button', class: 'pill rec', onclick: () => voiceSend(ctx, i.value) }, 'Send'), el('button', { type: 'button', class: 'pill', onclick: stop }, 'Cancel'))); }
|
|
193
|
-
return el('div', { class: 'ask', role: 'status' }, dim('Heard · ' + Math.round(v.confidence * 100) + '% sure' + (v.warn ? ' · check the words' : '')), el('b', null, '“' + v.text + '”'),
|
|
194
|
-
el('div', { class: 'c3t-tray' }, el('button', { type: 'button', class: 'pill rec', onclick: () => voiceSend(ctx) }, v.left ? 'Send in ' + v.left : 'Send'), el('button', { type: 'button', class: 'pill', onclick: () => { clearInterval(ui.vi); v.phase = 'edit'; ctx.redraw(); } }, 'Edit'), el('button', { type: 'button', class: 'pill', onclick: stop }, 'Cancel')));
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function backNode(ctx, card, ui) {
|
|
198
|
-
const n = (card.claims || []).length;
|
|
199
|
-
const log = (ctx.observed || []).map((o) => o.tool + ' ' + o.what).join(' › ');
|
|
200
|
-
const row = (k, v) => [el('dt', null, k), el('dd', null, v)];
|
|
201
|
-
return [el('div', { class: 'top' }, el('span', { class: 'tg', style: '--tc:var(--acc)' }, ctx.card.state), dim('case file')), el('h3', null, ctx.name || ctx.id),
|
|
202
|
-
el('dl', { class: 'c3t-back' }, ...row('Origin', ctx.origin || 'your swipe'), ...row('Session', ctx.id + ' · a real CLI in a PTY, not shown'), ...row('State', card.state), ...row('Evidence', n + ' labelled claim' + (n === 1 ? '' : 's')), ...row('Log', log || (card.steps || []).join(' › ') || 'nothing run yet')),
|
|
203
|
-
el('div', { class: 'c3t-tray' }, openBtn(ctx), el('span', { style: 'flex:1' }), el('button', { type: 'button', class: 'ib', 'aria-label': 'Back to the card', onclick: () => { ui.flip = false; ctx.redraw(); } }, ic('flip', 'sm')))];
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function draw(host, ctx) {
|
|
207
|
-
const card = ctx.card || {}; const ui = uiFor(ctx.id);
|
|
208
|
-
ctx.redraw = () => draw(host, ctx);
|
|
209
|
-
const old = live.get(host); if (old) old.off();
|
|
210
|
-
const done = card.state === 'done' && card.result;
|
|
211
|
-
const perms = (card.permissions || []).slice(); if (!perms.length && card.permission) perms.push({ request: card.permission.id, tool: card.permission.tool, command: card.permission.command, cwd: card.permission.cwd, why: card.permission.why });
|
|
212
|
-
const tag = done ? [(card.result.tag) || (ui.accepted ? 'Accepted' : 'Result'), RESULT_TAG[card.result.tag] || 'var(--success)'] : perms.length ? TAGS.permission : (TAGS[card.state] || ['Run', 'var(--acc)']);
|
|
213
|
-
const kids = [el('div', { class: 'top' }, el('span', { class: 'tg', style: '--tc:' + tag[1] }, tag[0]), dim(ctx.origin || ''))];
|
|
214
|
-
let swipeRight = false;
|
|
215
|
-
if (ui.flip) { kids.length = 0; kids.push(...backNode(ctx, card, ui)); }
|
|
216
|
-
else {
|
|
217
|
-
kids.push(el('h3', null, done && card.result.headline ? card.result.headline : (ctx.name || card.title)));
|
|
218
|
-
const strip = stripNode(card, ctx.observed); if (strip) kids.push(strip);
|
|
219
|
-
// every box but the question and the permission carries Open the session; a card with none of them gets its own below
|
|
220
|
-
let opened = false;
|
|
221
|
-
if (perms.length) perms.forEach((p) => kids.push(permissionBox(ctx, p)));
|
|
222
|
-
else if (card.state === 'asking' && card.ask) kids.push(questionBox(ctx, card));
|
|
223
|
-
else if (card.state === 'paused') { kids.push(pausedBox(ctx, card)); opened = true; }
|
|
224
|
-
else if (ui.hidden !== card.state + ':' + ((card.failure && card.failure.code) || '')) { const f = failBox(ctx, card, ui); if (f) { kids.push(f); opened = true; } }
|
|
225
|
-
if (card.state === 'permission' && !perms.length) kids.push(dim('Waiting for your permission. Open the session to see it.'));
|
|
226
|
-
if (done) {
|
|
227
|
-
kids.push(...resultNodes(card.result, { ui, redraw: ctx.redraw, fileBody: ctx.fileBody }).filter(Boolean));
|
|
228
|
-
(ui.say || []).forEach((s) => kids.push(el('div', { class: 'sayb' }, el('div', { class: 'm me' }, s.q), el('div', { class: 'm bot' }, s.a && s.a.basis ? el('span', { class: 'lab l-est' }, s.a.basis) : null, s.a ? s.a.text : ''))));
|
|
229
|
-
if (ui.rejected) kids.push(el('div', { class: 'chips2' }, el('span', { class: 'chip2' }, 'Rejected: ' + ui.rejected + ' · counted as a correction')));
|
|
230
|
-
else if (ui.accepted || ctx.accepted) kids.push(el('div', { class: 'chips2' }, el('span', { class: 'chip2 ok' }, 'Accepted by you'), el('button', { type: 'button', class: 'ib', 'aria-label': 'Flip to the case file', onclick: () => { ui.flip = true; ctx.redraw(); } }, ic('flip', 'sm'))));
|
|
231
|
-
else if (!ctx.readonly) { kids.push(...movesNode(ctx, card, ui)); swipeRight = (card.nextMoves || []).some((m) => m.verb === 'accept'); }
|
|
232
|
-
}
|
|
233
|
-
if (ui.voice) kids.push(voiceNode(ctx, ui));
|
|
234
|
-
else if (ui.tray) kids.push(trayNode(ctx, card, ui));
|
|
235
|
-
if (!done && !ui.tray && !ui.voice && !perms.length && card.state !== 'asking' && !['working', 'queued'].includes(card.state)) { /* a failure box carries its own moves */ }
|
|
236
|
-
// a starting or working run shows Open the session on its face: a read-only card (a job PMOS started) has no case file to flip to
|
|
237
|
-
if (!done && (!ctx.readonly || (!opened && ctx.openSession && !ctx.ended))) kids.push(el('div', { class: 'c3t-tray' }, !opened && ctx.openSession && !ctx.ended ? openBtn(ctx) : null, el('span', { class: 'c3t-grow' }),
|
|
238
|
-
ctx.readonly ? null : flipBtn(ui, ctx)));
|
|
239
|
-
}
|
|
240
|
-
const art = el('article', { class: 'c3t-card' + (['working', 'queued'].includes(card.state) ? ' busy' : '') + (ui.flash ? ' flash' : ''), 'data-run-card': card.state || '', 'data-run-id': ctx.id, 'aria-label': ctx.name || ctx.id }, ...kids);
|
|
241
|
-
host.replaceChildren(el('div', { class: 'c3 c3e' }, art));
|
|
242
|
-
const off = attachSwipe(art, {
|
|
243
|
-
onRight: swipeRight && !ctx.readonly ? () => { const m = (card.nextMoves || []).find((x) => x.verb === 'accept'); if (m) ctx.src.answer({ run: ctx.id, request: 'result', behavior: 'accept' }).then((r) => { if (r && r.ok) { ui.accepted = true; toast('Recorded as your acceptance.'); ctx.refresh(); ctx.redraw(); } else pressErr(r, 'The acceptance'); }); } : null,
|
|
244
|
-
onLeft: ui.flip || ctx.readonly ? null : () => { ui.tray = true; ui.sub = null; ctx.redraw(); },
|
|
245
|
-
labelRight: 'accept', labelLeft: 'reply', iconRight: 'check', iconLeft: 'reply' });
|
|
246
|
-
live.set(host, { off });
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export function mountRunCard(host, ctx = {}) {
|
|
250
|
-
ensureC3Css();
|
|
251
|
-
const c = { ...ctx };
|
|
252
|
-
if (!c.src) c.src = { canPrompt: false, why: 'No prompt route.', answer: async () => ({ ok: false, error: 'no source' }), correct: async () => ({ ok: false, error: 'no source' }), send: async () => ({ ok: false }) };
|
|
253
|
-
if (!c.src.send) c.src = { ...c.src, send: async () => ({ ok: false, error: c.src.why }) };
|
|
254
|
-
c.refresh = c.refresh || (() => {}); c.id = c.id || 'run';
|
|
255
|
-
draw(host, c);
|
|
256
|
-
}
|
|
257
|
-
export function disposeRunCard(host) {
|
|
258
|
-
const o = live.get(host); if (o) o.off();
|
|
259
|
-
live.delete(host); host.replaceChildren();
|
|
260
|
-
}
|