create-pmos 0.399.0 → 0.401.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 +30 -25
- 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 +3 -3
- package/workspace/briefing-premium-doc-edit-test.js +2 -8
- package/workspace/briefing-premium-sources-test.js +2 -0
- package/workspace/briefing-premium-test.js +6 -2
- package/workspace/briefing-premium-work-test.js +9 -4
- package/workspace/c3-capture-test.js +0 -17
- package/workspace/changelog.json +29 -0
- package/workspace/guide/briefing-premium.md +2 -2
- package/workspace/guide/home.md +24 -3
- 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/core-docs.js +2 -2
- 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 +8 -3
- package/workspace/premium-vw-cal-test.js +4 -1
- 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 +21 -6
- package/workspace/public/pm/cozy-today.css +4 -3
- 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 +65 -33
- package/workspace/public/pm/home-chat.js +34 -29
- package/workspace/public/pm/home-data.js +10 -2
- package/workspace/public/pm/home-dictate.js +7 -4
- package/workspace/public/pm/home-ini.js +13 -3
- package/workspace/public/pm/home-list.js +18 -10
- 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 +11 -8
- package/workspace/public/pm/home-work.js +13 -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/premium-vw-item.css +6 -0
- 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 +4 -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,1045 +0,0 @@
|
|
|
1
|
-
/* pm/c3-settings.js — the console3 Settings page (initiative console3-settings). Its markup is the approved console3 mockup's
|
|
2
|
-
* Settings page: a section list card and, per section, .card.sect groups of li.nrow setting rows. Every save shows a toast,
|
|
3
|
-
* with Undo when the old value can be put back. A feature PMOS does not have yet shows as a row with its control off and
|
|
4
|
-
* the reason (PM decision 9).
|
|
5
|
-
*
|
|
6
|
-
* mountSettings(host, ctx) ctx: { ws, workspaces, theme, themePref, setTheme(t), goTab(id), section?, root }
|
|
7
|
-
* SECTIONS · LABELS · rowsMatching(q) · gearIcon() pure parts, for the tests
|
|
8
|
-
*
|
|
9
|
-
* ONE HOME PER SETTING. A setting that already has a store is read and written through its own route, never copied here:
|
|
10
|
-
* workspaces GET /api/workspaces · POST /api/workspaces, /api/workspaces/rename, /api/workspaces/forget
|
|
11
|
-
* recording GET /api/notes/engine · POST /api/notes/switch (language, model, accuracy, keep_audio, clean_audio, wispr, jev, check)
|
|
12
|
-
* attendee names GET /api/people · POST /api/people/decide
|
|
13
|
-
* validate consent GET and POST /api/validate/repo Online GET and POST /api/online
|
|
14
|
-
* profiles GET /api/profiles · POST /api/profiles/prefer new sessions: dock.js sessionDefaults (this browser)
|
|
15
|
-
* TypeSafe key GET /api/typesafe (present or not; the key is never read)
|
|
16
|
-
* about you GET and POST /api/proactive/settings {name, about:{role, work, duties}} (the Welcome page writes the same)
|
|
17
|
-
* running sessions GET /api/sessions calendar import POST /api/sources/refresh {source:'calendar'}
|
|
18
|
-
* versions GET /api/kit/status · POST /api/kit/check, /api/kit/update, /api/kit/upgrade-app (then GET /api/sessions until the new version)
|
|
19
|
-
* data refresh GET /api/refresh?ws · POST /api/refresh/source, /rules, /run, /run-all · GET /api/refresh/log, /log.csv
|
|
20
|
-
* Every other setting is in the settings store: GET /api/settings and POST /api/settings (lib/settings-store.js).
|
|
21
|
-
* A board's own workflow is edited on the board; here are only the templates new boards start from.
|
|
22
|
-
* Nothing here asks for or shows a key or a password. */
|
|
23
|
-
import { el } from './dom.js';
|
|
24
|
-
import { button, SEL } from './primitives.js';
|
|
25
|
-
import { pmGet, pmPost } from './http.js';
|
|
26
|
-
import { c3ic } from './pm-work-view.js';
|
|
27
|
-
import { sessionDefaults, setSessionDefaults } from './dock.js';
|
|
28
|
-
import { flagPicker, flagsLine, flagsMissingValue } from './flag-picker.js';
|
|
29
|
-
import { toast } from './c3-toast.js';
|
|
30
|
-
import { dayPartOf } from './c3-daypart.js';
|
|
31
|
-
import { finderBlock } from './c3-report-store.js';
|
|
32
|
-
import { gearIcon, applyLook } from './c3-look.js';
|
|
33
|
-
|
|
34
|
-
export { gearIcon, applyLook };
|
|
35
|
-
|
|
36
|
-
const cx = (...c) => c.filter(Boolean).join(' ');
|
|
37
|
-
|
|
38
|
-
export const SECTIONS = Object.freeze([
|
|
39
|
-
['about', 'About you', 'user', 'Tell PMOS who you are, so your Briefing knows what matters to you. Every field is optional. The Welcome page asks for the same four.'],
|
|
40
|
-
['workspaces', 'Workspaces', 'repo', 'A workspace is one repository PMOS works in. Settings marked Workspace apply to the one picked at the top of this page.'],
|
|
41
|
-
['boards', 'Boards and workflows', 'cols', 'The templates and defaults new boards start from. A board\'s own workflow is edited on the board, in Initiatives.'],
|
|
42
|
-
['connectors', 'Connectors', 'org', 'PMOS keeps no passwords or keys for these. Your Claude session reaches each tool through the connectors of its profile.'],
|
|
43
|
-
['refresh', 'Data refresh', 'undo', 'What PMOS reads and writes on a schedule: pick what refreshes, when and how often, and see when each one last ran.'],
|
|
44
|
-
['recording', 'Recording', 'mic', 'How meetings are transcribed. This is the one place to check when a transcript looks wrong.'],
|
|
45
|
-
['time', 'Day and time', 'sun', 'The Briefing follows your clock. These settings say what your day looks like.'],
|
|
46
|
-
['sharing', 'Sharing', 'mail', 'Who reports go to, and how. Each report\'s schedule is set in Reports, under Set up.'],
|
|
47
|
-
['access', 'Access and devices', 'phone', 'Open PMOS from your phone or another computer.'],
|
|
48
|
-
['sessions', 'Claude sessions', 'term', 'The Claude Code sessions PMOS starts, and what they start with.'],
|
|
49
|
-
['privacy', 'Privacy and data', 'shield', 'Nothing leaves this computer unless a line below says so.'],
|
|
50
|
-
['appearance', 'Appearance', 'eye', 'How PMOS looks and where it opens.'],
|
|
51
|
-
['updates', 'Updates', 'cloud', 'The PMOS app, and the kit inside each workspace.'],
|
|
52
|
-
]);
|
|
53
|
-
|
|
54
|
-
/* Labels for the settings store's keys: [section group, label, help, { value: option label }]. */
|
|
55
|
-
export const LABELS = Object.freeze({
|
|
56
|
-
'ws.start': ['Start', 'Open on start', 'Which workspace PMOS opens when it starts.', { last: 'Last used', ask: 'Ask each time' }],
|
|
57
|
-
'ws.briefing': ['Start', 'Briefing covers', 'With several workspaces, the Briefing can show one or all of them. Each item still opens in its own workspace.', { one: 'This workspace', all: 'All workspaces' }],
|
|
58
|
-
'board.template': ['Defaults', 'Template for new boards', 'A new board copies this template. You can change its workflow on the board afterwards.', { product: 'Product', project: 'Project', simple: 'Simple' }],
|
|
59
|
-
'board.rules': ['Defaults', 'Order rules on boards', 'You move cards between stages. When a card skips a step, such as Build before a spec exists, the card shows a warning (decision D3).', { warn: 'Warn on the card', off: 'Off' }],
|
|
60
|
-
'conn.cal.window': ['Google Calendar', 'Import window', 'How far back and ahead your session imports events.', { '7-14': 'Past 7 days, next 14', '14-30': 'Past 14 days, next 30', '30-60': 'Past 30 days, next 60' }],
|
|
61
|
-
'conn.cal.private': ['Google Calendar', 'Private events', 'Events marked private in Google Calendar.', { busy: 'Show as busy', hide: 'Hide', title: 'Show titles' }],
|
|
62
|
-
'conn.wispr.wait': ['Wispr Flow', 'Wait before fetching', 'Wispr Flow needs a few minutes to finish its notes after a meeting.', { 2: '2 minutes', 5: '5 minutes', 10: '10 minutes' }],
|
|
63
|
-
'conn.sender': ['Sending', 'Sender for shared dashboards', 'Your session sends through this connector. Until you pick one, a scheduled share is a ready draft.', { none: 'None', slack: 'Slack', gmail: 'Gmail drafts' }],
|
|
64
|
-
'rec.sources': ['Live transcript', 'Listen to', 'The meeting is the sound from your call app. The mic is you.', { both: 'Mic and meeting', mic: 'Mic only', meeting: 'Meeting only' }],
|
|
65
|
-
'rec.guard': ['Live transcript', 'Re-run lines that come back in another language', 'A line that comes back mostly in another script is transcribed again in the meeting language. The original is kept (decision D8).'],
|
|
66
|
-
'rec.echo': ['Live transcript', 'Remove the meeting echo from the mic', 'When your speakers leak into the mic, the same words come in twice. Turn off to compare by ear.'],
|
|
67
|
-
'rec.settle': ['Live transcript', 'Correct lines a few seconds later', 'At each pause, the last 30 seconds are transcribed again with the stronger model and corrected in place.'],
|
|
68
|
-
'rec.vocab': ['Live transcript', 'Words to listen for', 'Names and terms that are often misheard, separated by commas.'],
|
|
69
|
-
'rec.final': ['After Stop', 'Transcribe the whole meeting again after Stop', 'Your notes are written from this final transcript.'],
|
|
70
|
-
'rec.retain': ['Audio', 'Delete kept audio after', 'The transcript and the notes stay.', { never: 'Never', 90: '90 days', 30: '30 days', 7: '7 days' }],
|
|
71
|
-
'time.zone': ['Where and when', 'Time zone', 'Empty means the time zone of this computer.'],
|
|
72
|
-
'time.weekStart': ['Where and when', 'Week starts on', '', { mon: 'Monday', sun: 'Sunday' }],
|
|
73
|
-
'time.workStart': ['Your day', 'Working hours start', 'Free time, prep at risk and the end of the day use your working hours.'],
|
|
74
|
-
'time.workEnd': ['Your day', 'Working hours end', ''],
|
|
75
|
-
'time.prep': ['Your day', 'Free time needed before a meeting with prep', 'With less than this, the meeting shows as prep at risk.', { 15: '15 min', 30: '30 min', 45: '45 min', 60: '1 hour' }],
|
|
76
|
-
'time.buffer': ['Your day', 'Buffer between meetings', 'Back-to-back meetings with less than this get a tidy-up suggestion on the Calendar.', { 0: 'None', 5: '5 min', 10: '10 min', 15: '15 min' }],
|
|
77
|
-
'time.tint': ['Ambience', 'Tint the top bar with the time of day', ''],
|
|
78
|
-
'time.strip': ['Ambience', 'Show the daylight strip', 'The sun or the moon on its arc, with sunrise or sunset.'],
|
|
79
|
-
'share.mode': ['Sending', 'Before a scheduled share goes out', 'Until a sender is chosen in Connectors, every scheduled share is a ready draft and a notification.', { draft: 'Make a draft for me to check', send: 'Send on schedule' }],
|
|
80
|
-
'sess.max': ['Housekeeping', 'Keep at most this many running', 'When a new session is needed, the longest idle background session closes first. A session you opened yourself is never closed for you.', { 2: '2', 3: '3', 4: '4', 6: '6', 8: '8' }],
|
|
81
|
-
'sess.idle': ['Housekeeping', 'Close a background session idle for', '', { 15: '15 min', 30: '30 min', 60: '1 hour', never: 'Never' }],
|
|
82
|
-
'sess.share': ['Housekeeping', 'Background jobs', 'Card refresh, imports and final notes can share one session per workspace. It starts faster and costs less.', { ws: 'One session per workspace', job: 'A new session per job' }],
|
|
83
|
-
'look.start': ['Look', 'Start page', 'The page /c3.html opens on.', { brief: 'Briefing', cal: 'Calendar', work: 'Work', init: 'Initiatives', rep: 'Reports' }],
|
|
84
|
-
'upd.check': ['When', 'Check for updates', 'A check asks the npm registry for the latest version and what each newer kit changed. Once a day, an open PMOS page asks by itself. It is the only request PMOS makes by itself.', { press: 'When I press Check', daily: 'Once a day' }],
|
|
85
|
-
'upd.apply': ['When', 'Install updates', 'An app update restarts PMOS. When idle waits until no recording or session runs.', { ask: 'Ask me', idle: 'When PMOS is idle' }],
|
|
86
|
-
'upd.kits': ['When', 'Workspace kits', 'Each workspace carries its own copy of the kit.', { all: 'Update all together', each: 'One at a time' }],
|
|
87
|
-
'upd.channel': ['When', 'Release channel', '', { stable: 'Stable', early: 'Early' }],
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
/* The settings that live in another store, with the words the page shows. The search reads these too. */
|
|
91
|
-
const EXT = Object.freeze({
|
|
92
|
-
'notes.model': ['recording', 'Live transcript', 'Whisper model', 'The bigger model makes fewer mistakes on names and accents.'],
|
|
93
|
-
'notes.accuracy': ['recording', 'Live transcript', 'Decoding', 'More accurate is slower on every line.'],
|
|
94
|
-
'notes.language': ['recording', 'Live transcript', 'Language spoken in meetings', 'Every line is written in this language. Detect guesses for each line, and can turn accented English into another language.'],
|
|
95
|
-
'notes.keep': ['recording', 'Audio', 'Keep the audio for replay', 'Kept on this computer, outside every repository. Never sent anywhere.'],
|
|
96
|
-
'notes.clean': ['recording', 'Audio', 'Clean up the replay sound', 'After Stop, the replay gets less rumble and hiss. The transcript does not change.'],
|
|
97
|
-
'notes.jev': ['recording', 'Jev', 'Label lines with Jev', 'Each line goes to TypeSafe for its label. Audio, names and private notes never do.'],
|
|
98
|
-
'notes.check': ['recording', 'Jev', 'Check notes against this workspace with Jev', 'Each captured line and one matching passage go to TypeSafe.'],
|
|
99
|
-
'notes.wispr': ['connectors', 'Wispr Flow', 'Fetch Wispr Flow notes after a meeting', 'Your session finds the same meeting in Wispr Flow and adds its notes to yours. Never for a private note.'],
|
|
100
|
-
'people.names': ['connectors', 'Google Calendar', 'Attendee names', 'Use the names of the people in your meetings for prep and People. The names stay on this computer.'],
|
|
101
|
-
'validate.consent': ['sessions', 'Workspace', 'Let Claude validate this workspace', 'Runs the checks against this workspace and records the result.'],
|
|
102
|
-
'sess.cli': ['sessions', 'New sessions', 'Start with', 'What a new session opens.'],
|
|
103
|
-
'sess.tier': ['sessions', 'New sessions', 'Model', 'Auto picks for each job: fast for a card refresh, deep for a PRD or final notes.'],
|
|
104
|
-
'sess.profile': ['sessions', 'New sessions', 'Default profile', 'The account and connectors a new Claude session starts with. Connectors use it too.'],
|
|
105
|
-
'online.on': ['access', 'Online', 'Online', 'Open PMOS from anywhere through a Cloudflare tunnel, signed in with Cloudflare Access.'],
|
|
106
|
-
'look.theme': ['appearance', 'Look', 'Theme', ''],
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
/* About you: [field, label, help, max length, placeholder, textarea]. Stored in the proactive settings, as the Welcome page stores them. */
|
|
110
|
-
export const ABOUT = Object.freeze([
|
|
111
|
-
['name', 'Your name', 'Shown in your Briefing greeting and in notes you write.', 40, 'For example: Dana', false],
|
|
112
|
-
['role', 'Your role', 'Helps PMOS judge which items are yours to decide.', 80, 'For example: Senior PM, Payments', false],
|
|
113
|
-
['work', 'What you do', 'One line. The Briefing uses it to rank what needs you first.', 200, 'In one line, for example: I run checkout and the payment methods', false],
|
|
114
|
-
['duties', 'Your job description', 'What you own, decide and deliver. Paste it from your job description if you like. It stays on this computer.', 1000, 'What you own, decide and deliver.', true],
|
|
115
|
-
]);
|
|
116
|
-
|
|
117
|
-
/** Every row whose label, help or group matches `q` (lower case), as [key, section]. */
|
|
118
|
-
export function rowsMatching(q) {
|
|
119
|
-
const s = String(q || '').trim().toLowerCase();
|
|
120
|
-
if (!s) return [];
|
|
121
|
-
const out = [];
|
|
122
|
-
for (const [k, [g, l, h]] of Object.entries(LABELS)) if ((g + ' ' + l + ' ' + h).toLowerCase().includes(s)) out.push([k, sectionOfStore(k)]);
|
|
123
|
-
for (const [k, [sec, g, l, h]] of Object.entries(EXT)) if ((g + ' ' + l + ' ' + h).toLowerCase().includes(s)) out.push([k, sec]);
|
|
124
|
-
for (const [f, l, h] of ABOUT) if (('your details ' + l + ' ' + h).toLowerCase().includes(s)) out.push(['you.' + f, 'about']);
|
|
125
|
-
return out;
|
|
126
|
-
}
|
|
127
|
-
const STORE_SECTION = { ws: 'workspaces', board: 'boards', conn: 'connectors', rec: 'recording', time: 'time', share: 'sharing', sess: 'sessions', look: 'appearance', upd: 'updates' };
|
|
128
|
-
function sectionOfStore(k) { return STORE_SECTION[k.split('.')[0]] || 'workspaces'; }
|
|
129
|
-
|
|
130
|
-
function ensureCss() {
|
|
131
|
-
if (typeof document === 'undefined' || document.querySelector('link[data-c3-settings]')) return;
|
|
132
|
-
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./c3-settings.css', import.meta.url).href; l.setAttribute('data-c3-settings', ''); document.head.appendChild(l);
|
|
133
|
-
}
|
|
134
|
-
/* Every control is a primitives.js button(); its children are the console3 icon and text, and its class carries the look (as c3-reports.js does). */
|
|
135
|
-
const bt = (attrs, ...kids) => {
|
|
136
|
-
const { onclick, disabled, class: cls, type, ...rest } = attrs || {};
|
|
137
|
-
const b = button({ label: '', variant: 'ghost', size: 'sm', onClick: onclick, disabled, attrs: { ...rest, class: cx('c3set-b', cls) } });
|
|
138
|
-
b.replaceChildren(...kids.flat().filter((k) => k != null && k !== false));
|
|
139
|
-
return b;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const ZONES = ['Asia/Jakarta', 'Asia/Makassar', 'Asia/Jayapura', 'Asia/Singapore', 'Asia/Kuala_Lumpur', 'Asia/Bangkok', 'Asia/Tokyo', 'Asia/Kolkata', 'Australia/Sydney', 'Europe/London', 'Europe/Berlin', 'America/New_York', 'America/Los_Angeles', 'UTC'];
|
|
143
|
-
/* Choices the mockup draws as a select even though they are short. */
|
|
144
|
-
const AS_SELECT = new Set(['conn.cal.window', 'conn.wispr.wait']);
|
|
145
|
-
const qs = (o) => Object.entries(o).filter(([, v]) => v != null && v !== '').map(([k, v]) => k + '=' + encodeURIComponent(v)).join('&');
|
|
146
|
-
|
|
147
|
-
export function mountSettings(host, ctx = {}) {
|
|
148
|
-
ensureCss();
|
|
149
|
-
const M = {
|
|
150
|
-
sec: SECTIONS.some((s) => s[0] === ctx.section) ? ctx.section : 'about', q: '', ws: ctx.ws || '', data: null, err: {},
|
|
151
|
-
engine: null, flagList: null, autoFlags: null, flagFilter: '', flagsOpen: { mine: false, auto: false }, people: null, consent: null, online: null, profiles: null, typesafe: null, kits: {}, kitBusy: null, app: { phase: null, error: '' }, about: null, running: null,
|
|
152
|
-
tplEdit: null, wsEdit: null, wsDrop: null, addPath: '',
|
|
153
|
-
rf: null, rfLog: null, rfSig: '', rfFilter: 'all', rfEdit: null, rfAsk: null, rfErr: {}, rfAllBusy: false, rfLoading: false, logSource: '', logResult: '',
|
|
154
|
-
};
|
|
155
|
-
const root = el('div', { class: 'brief c3set', 'data-c3set': '' });
|
|
156
|
-
const nav = el('ul', { class: 'list', role: 'list', 'data-c3set-nav': '' });
|
|
157
|
-
const segRow = el('div', { class: 'st-seg', 'data-c3set-seg': '' });
|
|
158
|
-
const body = el('div', { class: 'st-body', 'data-c3set-body': '' });
|
|
159
|
-
const search = el('input', { type: 'text', id: 'c3set-q', placeholder: 'Search settings', 'aria-label': 'Search settings', autocomplete: 'off', 'data-c3set-search': '',
|
|
160
|
-
oninput: () => { M.q = search.value.trim(); draw(); } });
|
|
161
|
-
const wsSel = el('select', { id: 'c3set-ws', 'aria-label': 'Workspace these settings apply to', 'data-c3set-ws': '', onchange: () => { M.ws = wsSel.value; loadWs(); } });
|
|
162
|
-
root.append(el('div', { class: 'calwrap' },
|
|
163
|
-
el('div', { class: 'st-hd' }, el('div', { class: 'dim st-lead' }, 'Each setting has one home here. The pages link to it.'),
|
|
164
|
-
el('div', { class: 'tools' }, search, el('label', { class: 'dim st-help', for: 'c3set-ws' }, 'Workspace'), wsSel)),
|
|
165
|
-
segRow,
|
|
166
|
-
el('div', { class: 'st-wrap' },
|
|
167
|
-
el('section', { class: 'card sect st-nav', 'aria-label': 'Settings sections' },
|
|
168
|
-
el('div', { class: 'sh2' }, el('h2', null, gearIcon('sm'), 'Settings ', el('span', { class: 'bdg g' }, String(SECTIONS.length)))), nav),
|
|
169
|
-
body)));
|
|
170
|
-
host.replaceChildren(root);
|
|
171
|
-
|
|
172
|
-
const wsName = (id) => { const w = (ctx.workspaces || []).find((x) => x.id === id); return w ? (w.label || w.name || w.id) : id || 'no workspace'; };
|
|
173
|
-
const S = (k) => (M.data ? M.data.settings.find((x) => x.key === k) : null);
|
|
174
|
-
const val = (k) => { const s = S(k); return s ? s.value : undefined; };
|
|
175
|
-
const override = (k) => (M.data ? M.data.overrides.find((o) => o.key === k) : null);
|
|
176
|
-
const labelOf = (k) => (LABELS[k] ? LABELS[k][1] : EXT[k] ? EXT[k][2] : k);
|
|
177
|
-
|
|
178
|
-
/* ── reads ── */
|
|
179
|
-
async function loadStore() {
|
|
180
|
-
const r = await pmGet('/api/settings?' + qs({ ws: M.ws }));
|
|
181
|
-
M.data = r && r.ok ? r : { settings: [], overrides: [], categories: ['Discover', 'Plan', 'Do', 'Learn'], error: (r && r.error) || 'The settings could not be read.' };
|
|
182
|
-
applyLook(ctx.root, M.data.settings); draw();
|
|
183
|
-
}
|
|
184
|
-
async function loadEngine() { const r = await pmGet('/api/notes/engine?' + qs({ ws: M.ws })); M.engine = r && r.ok ? r : { error: (r && r.error) || 'not read' }; draw(); }
|
|
185
|
-
async function loadWs() {
|
|
186
|
-
M.people = null; M.consent = null; M.rf = null; M.rfLog = null; M.rfEdit = null; M.rfAsk = null; draw();
|
|
187
|
-
await Promise.all([loadStore(), loadEngine(),
|
|
188
|
-
M.ws ? pmGet('/api/people?' + qs({ ws: M.ws })).then((r) => { M.people = r && r.ok !== false && r.settings ? { on: !!r.settings.calendar_names } : { error: (r && r.error) || 'not read' }; }) : null,
|
|
189
|
-
M.ws ? pmGet('/api/validate/repo?' + qs({ ws: M.ws })).then((r) => { M.consent = r && r.ok !== false ? { on: !!r.consent } : { error: (r && r.error) || 'not read' }; }) : null]);
|
|
190
|
-
draw();
|
|
191
|
-
}
|
|
192
|
-
function loadOnce() {
|
|
193
|
-
pmGet('/api/online').then((r) => { M.online = r && r.ok !== false ? r : { error: (r && r.error) || 'not read' }; draw(); });
|
|
194
|
-
pmGet('/api/profiles').then((r) => { M.profiles = r && r.ok !== false ? r : { error: (r && r.error) || 'not read', profiles: [] }; draw(); });
|
|
195
|
-
pmGet('/api/claude-flags').then((r) => { M.flagList = r || { ok: false, error: 'no answer', flags: [] }; draw(); });
|
|
196
|
-
pmGet('/api/auto-session-flags').then((r) => { M.autoFlags = r && r.ok !== false ? r : { error: (r && r.error) || 'not read', flags: [] }; draw(); });
|
|
197
|
-
pmGet('/api/typesafe').then((r) => { M.typesafe = r && r.ok ? r.key : null; draw(); });
|
|
198
|
-
pmGet('/api/proactive/settings').then((r) => { const s = r && r.ok && r.settings; M.about = s ? { name: s.name || '', role: (s.about || {}).role || '', work: (s.about || {}).work || '', duties: (s.about || {}).duties || '' } : { error: (r && r.error) || 'not read' }; draw(); });
|
|
199
|
-
pmGet('/api/sessions').then((r) => { M.running = r && Array.isArray(r.sessions) ? r.sessions : null; draw(); });
|
|
200
|
-
for (const w of ctx.workspaces || []) pmGet('/api/kit/status?' + qs({ ws: w.id })).then((r) => { M.kits[w.id] = r && r.ok ? r : { error: (r && r.error) || 'not read' }; draw(); });
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/* ── writes: each save says so in a toast, with Undo when the old value can be put back ── */
|
|
204
|
-
async function setStore(key, value, quiet) {
|
|
205
|
-
const s = S(key) || {}; const old = s.value;
|
|
206
|
-
const r = await pmPost('/api/settings', { key, value, ws: s.scope === 'ws' ? M.ws : undefined });
|
|
207
|
-
if (!r || !r.ok) { M.err[key] = (r && r.error) || 'Not saved.'; draw(); return false; }
|
|
208
|
-
delete M.err[key];
|
|
209
|
-
await loadStore();
|
|
210
|
-
if (!quiet) toast('Saved: ' + labelOf(key), old === undefined ? undefined : () => setStore(key, old, true));
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
|
-
async function resetStore(key) {
|
|
214
|
-
const s = S(key) || {}; const old = s.value;
|
|
215
|
-
const r = await pmPost('/api/settings', { key, reset: true, ws: s.scope === 'ws' ? M.ws : undefined });
|
|
216
|
-
if (r && r.ok) { await loadStore(); toast('Back to the default: ' + labelOf(key), () => setStore(key, old, true)); }
|
|
217
|
-
}
|
|
218
|
-
async function resetSection(id) {
|
|
219
|
-
const keys = M.data.settings.filter((s) => s.changed && sectionOfStore(s.key) === id);
|
|
220
|
-
const was = keys.map((s) => [s.key, s.value]);
|
|
221
|
-
for (const s of keys) await pmPost('/api/settings', { key: s.key, reset: true, ws: s.scope === 'ws' ? M.ws : undefined });
|
|
222
|
-
await loadStore();
|
|
223
|
-
toast('Section is back to its defaults', async () => { for (const [k, v] of was) await setStore(k, v, true); });
|
|
224
|
-
}
|
|
225
|
-
async function notesSwitch(patch, key, undoPatch) {
|
|
226
|
-
const r = await pmPost('/api/notes/switch', M.ws ? { ws: M.ws, ...patch } : patch);
|
|
227
|
-
if (!r || !r.ok) { M.err[key] = (r && r.error) || 'Not saved.'; draw(); return; }
|
|
228
|
-
delete M.err[key]; M.engine = r; draw();
|
|
229
|
-
toast('Saved: ' + labelOf(key), undoPatch ? () => notesSwitch(undoPatch, key) : undefined);
|
|
230
|
-
}
|
|
231
|
-
async function saveAbout(field, value) {
|
|
232
|
-
const a = M.about; const old = a[field];
|
|
233
|
-
const next = { ...a, [field]: value };
|
|
234
|
-
const r = await pmPost('/api/proactive/settings', { name: next.name.slice(0, 40), about: { role: next.role, work: next.work, duties: next.duties } });
|
|
235
|
-
if (!r || !r.ok) { M.err['you.' + field] = (r && r.error) || 'Not saved.'; draw(); return; }
|
|
236
|
-
delete M.err['you.' + field]; M.about = next; draw();
|
|
237
|
-
toast('Saved: ' + ABOUT.find((f) => f[0] === field)[1], () => saveAbout(field, old));
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/* ── building blocks (console3 markup: .card.sect > .sh2, ul.list > li.nrow, .seg, .tag, .chip2, .fold) ── */
|
|
241
|
-
const btn = (label, { variant = 'outline', ic, onclick, attrs, disabled } = {}) => {
|
|
242
|
-
const b = button({ label, variant, size: 'sm', onClick: onclick, disabled, attrs });
|
|
243
|
-
if (ic) b.querySelector(SEL.btnLabel).prepend(ic === 'gear' ? gearIcon('sm') : c3ic(ic, 'sm'));
|
|
244
|
-
return b;
|
|
245
|
-
};
|
|
246
|
-
const tag = (text, tone) => el('span', { class: cx('tag', tone) }, text);
|
|
247
|
-
const chip = (text, cls) => el('span', { class: cx('chip2', cls) }, text);
|
|
248
|
-
const scopeTag = (scope) => el('span', { class: 'tag', title: 'Where this setting applies' }, scope === 'ws' ? 'Workspace · ' + wsName(M.ws) : scope === 'board' ? 'Per board' : 'This computer');
|
|
249
|
-
const fold = (ic, text, tone, ...more) => el('div', { class: cx('fold', tone) }, ic ? c3ic(ic, 'sm') : null, el('span', null, text), ...more);
|
|
250
|
-
const sect = (title, kids, { ic, count, right, attrs } = {}) => el('section', { class: 'card sect', ...(attrs || {}) },
|
|
251
|
-
el('div', { class: 'sh2' }, el('h2', null, ic ? c3ic(ic, 'sm') : null, title, count != null ? el('span', { class: 'bdg g' }, String(count)) : null), right || null),
|
|
252
|
-
...kids.flat().filter(Boolean));
|
|
253
|
-
const list = (rows) => { const r = rows.flat().filter(Boolean); return r.length ? el('ul', { class: 'list', role: 'list' }, ...r) : null; };
|
|
254
|
-
const swBtn = (on, label, onClick, attrs) => bt({ type: 'button', class: 'sw', role: 'switch', 'aria-checked': String(!!on), 'aria-label': label, onclick: onClick, ...(attrs || {}) }, el('i', { class: 'sw-dot' }));
|
|
255
|
-
const seg = (label, opts, cur, onPick, disabled) => el('div', { class: 'seg', role: 'group', 'aria-label': label },
|
|
256
|
-
...opts.map(([v, l]) => bt({ type: 'button', 'aria-pressed': String(String(cur) === String(v)), disabled: !!disabled, 'data-v': String(v), onclick: () => onPick(v) }, l)));
|
|
257
|
-
const select = (id, label, opts, cur, onPick, disabled) => el('select', { id, 'aria-label': label, disabled: !!disabled, onchange: (e) => onPick(e.target.value) },
|
|
258
|
-
...opts.map(([v, l]) => el('option', { value: String(v), selected: String(cur) === String(v) }, l)));
|
|
259
|
-
const locked = (text) => el('span', { class: 'chip2' }, c3ic('lock', 'sm'), text);
|
|
260
|
-
const secLink = (id, label) => bt({ type: 'button', class: 'chip2 lk', onclick: () => goSec(id) }, label);
|
|
261
|
-
const tabLink = (tab, label) => bt({ type: 'button', class: 'chip2 lk', onclick: () => ctx.goTab && ctx.goTab(tab) }, label);
|
|
262
|
-
const help = (...kids) => el('div', { class: 'dim st-help' }, ...kids);
|
|
263
|
-
/** One setting row: label, scope tag and help on the left; the control and Reset on the right. */
|
|
264
|
-
function frame({ key, label, help: h, scope, control, changed, onReset, env, err, wide, note, lock, forId, ic }) {
|
|
265
|
-
return el('li', { class: cx('nrow st-row', wide && 'wide', ic && 'has-ki'), 'data-c3set-row': key },
|
|
266
|
-
ic ? el('span', { class: cx('ki', ic[1]) }, c3ic(ic[0])) : null,
|
|
267
|
-
el('div', { class: 'nb' },
|
|
268
|
-
forId ? el('label', { class: 'tt', for: forId }, label) : el('span', { class: 'tt' }, label),
|
|
269
|
-
scope || changed ? el('div', { class: 'chips' }, scope ? scopeTag(scope) : null, changed ? el('span', { class: 'st-dot', title: 'Changed from the default' }) : null) : null,
|
|
270
|
-
h ? help(...[].concat(h)) : null,
|
|
271
|
-
env ? el('div', { class: 'fold w', 'data-c3set-env': env.env }, c3ic('alert', 'sm'), el('span', null, el('b', { class: 'mono' }, env.env + '=' + env.value), ' is set where PMOS starts. ' + env.effect + ' Remove it from your shell profile, then restart PMOS.')) : null,
|
|
272
|
-
lock ? fold('lock', lock) : null,
|
|
273
|
-
note ? help(note) : null,
|
|
274
|
-
err ? el('div', { class: 'fold w', role: 'alert' }, c3ic('alert', 'sm'), el('span', null, err)) : null),
|
|
275
|
-
el('div', { class: 'acts' }, control, changed && onReset ? btn('Reset', { variant: 'ghost', onclick: onReset, attrs: { 'data-c3set-reset': key } }) : null));
|
|
276
|
-
}
|
|
277
|
-
/** A row for a key of the settings store. */
|
|
278
|
-
function storeRow(key, extra = {}) {
|
|
279
|
-
const s = S(key); const L = LABELS[key];
|
|
280
|
-
if (!s || !L) return null;
|
|
281
|
-
const [, label, h, opts] = L;
|
|
282
|
-
const id = 'c3set-' + key;
|
|
283
|
-
const ov = override(key); const dis = !!(extra.disabled || ov);
|
|
284
|
-
const optList = (s.options || []).map((v) => [v, (opts && opts[v]) || v]);
|
|
285
|
-
let control;
|
|
286
|
-
if (s.type === 'bool') control = swBtn(s.value, label, () => setStore(key, !s.value), { id, 'data-c3set-key': key, disabled: dis });
|
|
287
|
-
else if (s.type === 'choice' && !AS_SELECT.has(key) && optList.length <= 3 && optList.every(([, l]) => l.length < 24)) control = seg(label, optList, s.value, (v) => setStore(key, v), dis);
|
|
288
|
-
else if (s.type === 'choice') control = select(id, label, optList, s.value, (v) => setStore(key, v), dis);
|
|
289
|
-
else if (s.type === 'hour') { const hs = []; for (let h2 = s.min; h2 <= s.max; h2++) hs.push([h2, String(h2).padStart(2, '0') + ':00']); control = select(id, label, hs, s.value, (v) => setStore(key, Number(v)), dis); }
|
|
290
|
-
else if (s.type === 'zone') {
|
|
291
|
-
const here = (() => { try { return Intl.DateTimeFormat().resolvedOptions().timeZone; } catch { return ''; } })();
|
|
292
|
-
control = select(id, label, [['', 'This computer\'s' + (here ? ' (' + here + ')' : '')], ...ZONES.map((z) => [z, z.replace(/_/g, ' ')])], s.value, (v) => setStore(key, v), dis);
|
|
293
|
-
} else if (s.type === 'text') control = el('input', { type: 'text', id, value: s.value, maxlength: String(s.max || 400), 'aria-label': label, autocomplete: 'off', disabled: dis, onchange: (e) => setStore(key, e.target.value) });
|
|
294
|
-
return frame({ key, label, help: h, scope: s.scope, control, changed: s.changed, onReset: () => resetStore(key), env: ov, err: M.err[key], note: extra.note, lock: extra.lock,
|
|
295
|
-
forId: s.type === 'choice' && control.tagName !== 'SELECT' ? null : id, wide: s.type === 'text' && (s.max || 0) > 100 });
|
|
296
|
-
}
|
|
297
|
-
function extRow(key, control, extra = {}) {
|
|
298
|
-
const [, , label, h] = EXT[key];
|
|
299
|
-
return frame({ key, label, help: h, scope: extra.scope, control, env: override(key), err: M.err[key], note: extra.note, lock: extra.lock, forId: extra.forId });
|
|
300
|
-
}
|
|
301
|
-
const lockedRow = (key, label, h, text, scope) => frame({ key, label, help: h, scope, control: locked(text) });
|
|
302
|
-
/** A feature PMOS does not have yet (PM decision 9): the row shows, with its control off and the reason. */
|
|
303
|
-
const notYet = (key, label, h, why, scope, control) => frame({ key, label, help: h, scope, lock: why, control: control || btn('Not available yet', { variant: 'ghost', disabled: true }) });
|
|
304
|
-
const group = (title, rows, ic, opts) => { const l = list(rows); return l ? sect(title, [l], { ic, ...(opts || {}) }) : null; };
|
|
305
|
-
const groupOf = (sec, title, ic) => group(title, Object.keys(LABELS).filter((k) => sectionOfStore(k) === sec && LABELS[k][0] === title).map((k) => storeRow(k)), ic);
|
|
306
|
-
const goSec = (id) => { M.sec = id; M.q = ''; search.value = ''; draw(); };
|
|
307
|
-
|
|
308
|
-
/* ── sections ── */
|
|
309
|
-
function aboutSec() {
|
|
310
|
-
const a = M.about;
|
|
311
|
-
if (!a) return [fold(null, 'Reading what you told PMOS.')];
|
|
312
|
-
if (a.error) return [el('div', { class: 'fold w', role: 'alert' }, c3ic('alert', 'sm'), el('span', null, 'What you told PMOS could not be read: ' + a.error + '.'))];
|
|
313
|
-
const rows = ABOUT.map(([f, label, h, max, ph, area]) => {
|
|
314
|
-
const id = 'c3set-you-' + f;
|
|
315
|
-
const input = area
|
|
316
|
-
? el('textarea', { id, rows: '5', maxlength: String(max), placeholder: ph, 'aria-label': label, oninput: (e) => { count.textContent = e.target.value.length + ' of ' + max + ' characters'; }, onchange: (e) => saveAbout(f, e.target.value.trim()) }, a[f])
|
|
317
|
-
: el('input', { type: 'text', id, value: a[f], maxlength: String(max), placeholder: ph, 'aria-label': label, autocomplete: 'off', onchange: (e) => saveAbout(f, e.target.value.trim()) });
|
|
318
|
-
const count = area ? el('span', { class: 'dim mono st-count' }, a[f].length + ' of ' + max + ' characters') : null;
|
|
319
|
-
return frame({ key: 'you.' + f, label, help: h, scope: 'computer', control: area ? [input, count] : input, err: M.err['you.' + f], forId: id, wide: !!area });
|
|
320
|
-
});
|
|
321
|
-
return [group('Your details', rows, 'user'),
|
|
322
|
-
fold('spark', 'The Welcome page asks for these four on first run. Change them here any time.', null, btn('See Welcome', { variant: 'ghost', ic: 'next', onclick: () => { location.href = '/welcome'; } }))];
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function workspacesSec() {
|
|
326
|
-
const wss = ctx.workspaces || [];
|
|
327
|
-
const rows = wss.map((w) => {
|
|
328
|
-
const cur = w.id === M.ws;
|
|
329
|
-
const editing = M.wsEdit === w.id; const dropping = M.wsDrop === w.id;
|
|
330
|
-
const nameIn = editing ? el('input', { type: 'text', value: w.label || w.name || '', 'aria-label': 'New name for ' + (w.name || w.id), id: 'c3set-wsname', maxlength: '60' }) : null;
|
|
331
|
-
let nb; let acts;
|
|
332
|
-
if (editing) {
|
|
333
|
-
nb = [nameIn];
|
|
334
|
-
acts = [btn('Rename', { variant: 'primary', onclick: async () => { const old = w.label; const nm = nameIn.value.trim(); const r = await pmPost('/api/workspaces/rename', { id: w.id, name: nm }); if (r && r.ok !== false) { w.label = nm; M.wsEdit = null; fillWs(); toast('Renamed to ' + nm); } else M.err['ws:' + w.id] = (r && r.error) || 'Not renamed.'; draw(); void old; } }),
|
|
335
|
-
btn('Cancel', { variant: 'ghost', onclick: () => { M.wsEdit = null; draw(); } })];
|
|
336
|
-
} else if (dropping) {
|
|
337
|
-
nb = [el('span', { class: 'tt' }, w.label || w.name || w.id), fold('alert', 'Removing a workspace takes it off this list. Its folder, boards and notes stay where they are.', 'w')];
|
|
338
|
-
acts = [btn('Remove workspace', { variant: 'primary', attrs: { 'data-c3set-forget': w.id }, onclick: async () => { const r = await pmPost('/api/workspaces/forget', { id: w.id }); if (r && r.ok) { ctx.workspaces = ctx.workspaces.filter((x) => x.id !== w.id); M.wsDrop = null; if (M.ws === w.id) { M.ws = (ctx.workspaces[0] || {}).id || ''; loadWs(); } fillWs(); toast('Removed ' + (w.name || w.id)); } else M.err['ws:' + w.id] = (r && (r.error || r.reason)) || 'Not removed.'; draw(); } }),
|
|
339
|
-
btn('Keep it', { variant: 'ghost', onclick: () => { M.wsDrop = null; draw(); } })];
|
|
340
|
-
} else {
|
|
341
|
-
nb = [el('span', { class: 'tt' }, w.label || w.name || w.id),
|
|
342
|
-
el('div', { class: 'chips' }, cur ? tag('Current', 'acc') : null, w.home ? tag('PMOS itself') : null, w.root ? chip(w.root, 'mono') : null, w.branch ? chip('branch ' + w.branch) : null,
|
|
343
|
-
chip((w.sessions || 0) + ((w.sessions || 0) === 1 ? ' session' : ' sessions')))];
|
|
344
|
-
acts = [cur ? null : btn('Use', { onclick: () => { M.ws = w.id; fillWs(); loadWs(); toast('Settings now show ' + (w.label || w.name || w.id)); } }),
|
|
345
|
-
btn('Rename', { variant: 'ghost', onclick: () => { M.wsEdit = w.id; draw(); } }),
|
|
346
|
-
w.home || wss.length < 2 ? null : btn('Remove', { variant: 'ghost', onclick: () => { M.wsDrop = w.id; draw(); } })];
|
|
347
|
-
}
|
|
348
|
-
return el('li', { class: 'nrow', 'data-c3set-ws-row': w.id }, el('span', { class: cx('ki', cur && 'hot') }, c3ic('repo')),
|
|
349
|
-
el('div', { class: 'nb' }, ...nb, M.err['ws:' + w.id] ? fold('alert', M.err['ws:' + w.id], 'w') : null), el('div', { class: 'acts' }, ...acts.filter(Boolean)));
|
|
350
|
-
});
|
|
351
|
-
const pathIn = el('input', { type: 'text', id: 'c3set-addpath', placeholder: '/Users/you/code/my-product', 'aria-label': 'Folder of the workspace to add', value: M.addPath, autocomplete: 'off', oninput: (e) => { M.addPath = e.target.value; } });
|
|
352
|
-
const addRow = frame({ key: 'ws.add', label: 'Add a workspace', forId: 'c3set-addpath', help: 'Give the folder of a repository. PMOS reads what is there and changes nothing until you start work in it. The first-run steps are on the Welcome page.',
|
|
353
|
-
err: M.err.add, wide: true, control: [pathIn, btn('Add', { ic: 'plus', attrs: { 'data-c3set-add': '' }, onclick: async () => {
|
|
354
|
-
const rootPath = M.addPath.trim(); if (!rootPath) { pathIn.focus(); return; }
|
|
355
|
-
const r = await pmPost('/api/workspaces', { root: rootPath, focus: false });
|
|
356
|
-
if (r && r.ok) { (ctx.workspaces = ctx.workspaces || []).push(r.workspace); M.addPath = ''; delete M.err.add; toast('Added ' + (r.workspace.name || rootPath)); fillWs(); } else M.err.add = (r && r.error) || 'Not added.';
|
|
357
|
-
draw();
|
|
358
|
-
} })] });
|
|
359
|
-
return [sect('Your workspaces', [rows.length ? list(rows) : fold(null, 'No workspace is registered yet.'), list([addRow])], { ic: 'repo', count: wss.length,
|
|
360
|
-
right: btn('Add a workspace', { ic: 'plus', onclick: () => { const i = root.querySelector('#c3set-addpath'); if (i) i.focus(); } }) }),
|
|
361
|
-
groupOf('workspaces', 'Start', 'repo')];
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
function boardsSec() {
|
|
365
|
-
const s = S('board.templates'); const cats = (M.data && M.data.categories) || ['Discover', 'Plan', 'Do', 'Learn'];
|
|
366
|
-
const tpl = s ? s.value : {};
|
|
367
|
-
const draft = M.tplEdit;
|
|
368
|
-
const flow = (stages) => el('div', { class: 'st-flow' }, ...stages.flatMap((st, i) => [i ? c3ic('next', 'sm') : null, el('span', { class: 'chip2', title: st.cat + ' category' }, el('i', { class: 'st-cat-dot', 'data-cat': st.cat }), st.name)]).filter(Boolean));
|
|
369
|
-
const rows = Object.entries(tpl).map(([id, t]) => {
|
|
370
|
-
const editing = draft && draft.id === id;
|
|
371
|
-
const d = editing ? draft.t : t;
|
|
372
|
-
const editor = editing ? [el('ol', { class: 'st-stages' }, ...d.stages.map((st, i) => el('li', null,
|
|
373
|
-
el('input', { type: 'text', value: st.name, 'aria-label': 'Stage ' + (i + 1) + ' name', maxlength: '40', oninput: (e) => { st.name = e.target.value; } }),
|
|
374
|
-
el('select', { 'aria-label': 'Stage ' + (i + 1) + ' category', onchange: (e) => { st.cat = e.target.value; } }, ...cats.map((c) => el('option', { value: c, selected: c === st.cat }, c))),
|
|
375
|
-
bt({ type: 'button', class: 'ib sm', 'aria-label': 'Remove ' + st.name, disabled: d.stages.length < 2, onclick: () => { d.stages.splice(i, 1); draw(); } }, c3ic('x', 'sm'))))),
|
|
376
|
-
help('Each stage maps to Discover, Plan, Do or Learn, so the portfolio can compare boards with different workflows. Up to 12 stages. Boards that already use this template keep their own copy.'),
|
|
377
|
-
M.err['board.templates'] ? fold('alert', M.err['board.templates'], 'w') : null] : [];
|
|
378
|
-
const acts = editing
|
|
379
|
-
? [d.stages.length < 12 ? btn('Add stage', { ic: 'plus', onclick: () => { d.stages.push({ name: 'New stage', cat: 'Do' }); draw(); } }) : null,
|
|
380
|
-
btn('Save', { variant: 'primary', attrs: { 'data-c3set-tpl-save': id }, onclick: async () => { const next = JSON.parse(JSON.stringify(tpl)); next[id] = d; if (await setStore('board.templates', next)) M.tplEdit = null; draw(); } }),
|
|
381
|
-
btn('Cancel', { variant: 'ghost', onclick: () => { M.tplEdit = null; delete M.err['board.templates']; draw(); } })]
|
|
382
|
-
: [btn('Edit template', { attrs: { 'data-c3set-tpl-edit': id }, onclick: () => { M.tplEdit = { id, t: JSON.parse(JSON.stringify(t)) }; draw(); } })];
|
|
383
|
-
return el('li', { class: 'nrow', 'data-c3set-tpl': id }, el('span', { class: 'ki' }, c3ic('cols')),
|
|
384
|
-
el('div', { class: 'nb' }, el('span', { class: 'tt' }, editing ? 'Editing ' + d.name : t.name), el('div', { class: 'chips' }, val('board.template') === id ? tag('Default for new boards', 'acc') : null), flow(d.stages), ...editor),
|
|
385
|
-
el('div', { class: 'acts' }, ...acts.filter(Boolean)));
|
|
386
|
-
});
|
|
387
|
-
return [groupOf('boards', 'Defaults', 'cols'),
|
|
388
|
-
group('PMOS itself', [lockedRow('board.self', 'PMOS itself', 'The PMOS workspace keeps its derived ladder: the stage follows the artifacts and is never moved by hand.', 'Derived from the work')], 'cols'),
|
|
389
|
-
sect('Workflow templates', [list(rows), help('Change a template and only boards created afterwards use it. Each board keeps its own copy.')], { ic: 'cols', count: rows.length,
|
|
390
|
-
right: s && s.changed ? btn('Reset templates', { variant: 'ghost', onclick: () => resetStore('board.templates') }) : null }),
|
|
391
|
-
sect('Boards in ' + wsName(M.ws), [list([notYet('board.list', 'Each board and its workflow', 'A board\'s workflow belongs to the board. This list will be a shortcut to each one.', 'Boards with their own workflows come with the Initiatives update. Until then a workspace has one board.', 'ws',
|
|
392
|
-
btn('Open Initiatives', { variant: 'ghost', ic: 'next', onclick: () => ctx.goTab && ctx.goTab('init') }))])], { ic: 'cols' })];
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
function profileNow() {
|
|
396
|
-
const p = M.profiles; const id = sessionDefaults().profile || (p && p.prefs && p.prefs.claude) || null;
|
|
397
|
-
return { id, x: p && p.profiles ? p.profiles.find((y) => y.id === id) : null };
|
|
398
|
-
}
|
|
399
|
-
async function chooseProfile(id) {
|
|
400
|
-
const before = profileNow().id;
|
|
401
|
-
setSessionDefaults({ profile: id || null });
|
|
402
|
-
const r = await pmPost('/api/profiles/prefer', { agent: 'claude', profile: id || null });
|
|
403
|
-
if (r && r.ok) { if (M.profiles) M.profiles.prefs = r.prefs; delete M.err['sess.profile']; toast('Saved: default profile', () => chooseProfile(before)); } else M.err['sess.profile'] = (r && r.error) || 'Not saved.';
|
|
404
|
-
draw();
|
|
405
|
-
}
|
|
406
|
-
const profileSelect = (id) => {
|
|
407
|
-
const profs = (M.profiles && M.profiles.profiles) || [];
|
|
408
|
-
return select(id, 'Default profile', [['', 'None'], ...profs.map((x) => [x.id, x.label && x.label !== x.id ? x.label + ' (' + x.id + ')' : x.id])], profileNow().id || '', chooseProfile);
|
|
409
|
-
};
|
|
410
|
-
const refreshLink = (key, label, h) => frame({ key, label, help: h, control: secLink('refresh', 'Data refresh') });
|
|
411
|
-
function connectorsSec() {
|
|
412
|
-
const { id, x } = profileNow();
|
|
413
|
-
const mcp = x ? x.mcp : [];
|
|
414
|
-
const has = (re) => mcp.some((m) => re.test(m));
|
|
415
|
-
const reach = (on) => tag(on ? 'In the profile' : 'Not in the profile', on ? 'ok' : 'warn');
|
|
416
|
-
const via = (on, name) => (on ? 'Through profile ' + id + '.' : id ? 'Profile ' + id + ' has no ' + name + ' connector.' : 'No default profile is set.');
|
|
417
|
-
const people = M.people;
|
|
418
|
-
const w = M.engine && M.engine.whisper;
|
|
419
|
-
const sender = val('conn.sender');
|
|
420
|
-
const senderName = (LABELS['conn.sender'][3] || {})[sender] || sender;
|
|
421
|
-
const setSender = (v) => setStore('conn.sender', v);
|
|
422
|
-
return [
|
|
423
|
-
sect('Claude profile', [list([
|
|
424
|
-
frame({ key: 'conn.profile', label: 'Profile that reaches your tools', help: 'PMOS holds no passwords or keys. Your Claude session uses the connectors in this profile.', scope: 'computer', forId: 'c3set-conn-profile', control: profileSelect('c3set-conn-profile'), err: M.err['sess.profile'] }),
|
|
425
|
-
frame({ key: 'conn.list', label: 'Connectors in profile ' + (id || 'none'), control: null,
|
|
426
|
-
help: mcp.length ? null : id ? 'This profile lists no connectors.' : 'No default profile is set, so a session starts with Claude Code\'s own connectors.' })]),
|
|
427
|
-
mcp.length ? el('div', { class: 'chips st-pad' }, ...mcp.map((m) => tag(m))) : null,
|
|
428
|
-
help('Profiles are listed in ', secLink('sessions', 'Claude sessions'), '.')], { ic: 'user', attrs: { 'data-c3set-profile': '' } }),
|
|
429
|
-
sect('Google Calendar', [list([
|
|
430
|
-
notYet('conn.cal.list', 'Calendars to import', 'Pick which of your calendars the import reads.', 'Choosing calendars comes later. Today the import reads the calendars your session can see.', 'computer'),
|
|
431
|
-
storeRow('conn.cal.window'), refreshLink('conn.cal.refresh', 'Refresh schedule', 'When the calendar is read again is set in Data refresh.'), storeRow('conn.cal.private'),
|
|
432
|
-
M.ws ? extRow('people.names', people && !people.error ? swBtn(people.on, EXT['people.names'][2], async () => { const r = await pmPost('/api/people/decide', { ws: M.ws, act: 'setting', calendar_names: !people.on }); if (r && r.ok !== false) { people.on = !people.on; toast('Saved: attendee names'); } else M.err['people.names'] = (r && r.error) || 'Not saved.'; draw(); }) : el('span', { class: 'dim' }, people ? people.error : 'Reading'), { scope: 'ws' }) : null]),
|
|
433
|
-
el('div', { class: 'iacts' }, btn('Import now', { ic: 'undo', disabled: !M.ws || !has(/calendar/i), onclick: async () => { const r = await pmPost('/api/sources/refresh', { ws: M.ws, source: 'calendar' }); toast(r && r.ok ? 'Import started in your Claude session. Events appear in Calendar when it finishes.' : ((r && r.error) || 'The import did not start.')); } }),
|
|
434
|
-
el('span', { class: 'dim st-help' }, via(has(/calendar/i), 'calendar') + ' PMOS never edits your calendar.'))], { ic: 'cal', right: reach(has(/calendar/i)) }),
|
|
435
|
-
sect('Jira', [list([notYet('jira.map', 'Jira project for each board', 'A board backed by a Jira project mirrors its sprints and reads ticket status from it, with each Jira status mapped to a board stage.', 'Mapping boards and statuses comes with the Initiatives update.', 'board')]),
|
|
436
|
-
help(via(has(/atlassian|jira/i), 'Jira'))], { ic: 'org', right: reach(has(/atlassian|jira/i)) }),
|
|
437
|
-
group('Jira behaviour', [refreshLink('conn.jira.refresh', 'Refresh ticket status', 'When Jira is read again is set in Data refresh.'),
|
|
438
|
-
lockedRow('jira.push', 'Creating or updating tickets', 'PMOS drafts tickets from the PRD. Nothing reaches Jira until you select it (D88).', 'You approve every push', 'ws'),
|
|
439
|
-
lockedRow('jira.sprints', 'Sprints and burndown', 'A board backed by Jira shows its sprints. Native sprints are only for boards with no tracker (D5).', 'Mirrored from Jira, read-only', 'board')], 'org'),
|
|
440
|
-
sect('Wispr Flow', [list([w ? extRow('notes.wispr', swBtn(w.wispr !== false, EXT['notes.wispr'][2], () => notesSwitch({ wispr: w.wispr === false }, 'notes.wispr', { wispr: w.wispr !== false }), { disabled: !!override('notes.wispr') }), { scope: 'computer' }) : null, storeRow('conn.wispr.wait')]),
|
|
441
|
-
help(via(has(/wispr/i), 'Wispr Flow'))], { ic: 'mic', right: reach(has(/wispr/i)) }),
|
|
442
|
-
sect('Sender for shared dashboards', [el('div', { class: 'iacts', 'data-c3set-sender': '' },
|
|
443
|
-
...[['slack', 'Slack'], ['gmail', 'Gmail drafts']].map(([v, l]) => btn(sender === v ? l : 'Use ' + l, { variant: sender === v ? 'primary' : 'outline', ic: sender === v ? 'check' : null, attrs: { 'data-v': v }, onclick: () => setSender(v) })),
|
|
444
|
-
sender !== 'none' ? btn('Disconnect', { variant: 'ghost', onclick: () => setSender('none') }) : null),
|
|
445
|
-
help(sender === 'none' ? 'Not connected. Until you pick one, a scheduled share is a ready draft.' : 'Your session sends through ' + senderName + '. Sharing decides whether scheduled shares go out or wait as drafts.'),
|
|
446
|
-
M.err['conn.sender'] ? fold('alert', M.err['conn.sender'], 'w') : null], { ic: 'mail', right: tag(sender === 'none' ? 'Not connected' : senderName, sender === 'none' ? 'warn' : 'ok') }),
|
|
447
|
-
];
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
function recordingSec() {
|
|
451
|
-
const e = M.engine; const w = e && e.whisper; const j = e && e.jev;
|
|
452
|
-
if (!e) return [fold(null, 'Reading the recording setup.')];
|
|
453
|
-
if (e.error || !w) return [fold('alert', 'The recording setup could not be read: ' + (e.error || 'no answer') + '.', 'w')];
|
|
454
|
-
const langOv = override('notes.language');
|
|
455
|
-
const langName = (v) => ((w.languages || []).find((x) => x.value === v) || {}).label || v;
|
|
456
|
-
const engineName = w.live === 'qwen' ? 'Qwen3-ASR' : w.ready ? 'Whisper' : 'Not set up';
|
|
457
|
-
const summary = [w.live === 'qwen' || w.ready ? engineName + ' on this computer' : 'No local transcription yet', langOv ? langName(langOv.value) + ' (set by ' + langOv.env + ')' : w.language === 'auto' ? 'language detected for each line' : langName(w.language) + ', forced',
|
|
458
|
-
val('rec.echo') === false || override('rec.echo') ? 'echo removal off' : 'echo removal on', val('rec.final') === false || override('rec.final') ? 'no pass after Stop' : 'a final pass after Stop'];
|
|
459
|
-
const warn = !!(langOv || w.language === 'auto' || !w.ready);
|
|
460
|
-
const fin = w.final;
|
|
461
|
-
const flip = (k, on) => ({ [k]: on });
|
|
462
|
-
return [
|
|
463
|
-
sect('Recording now uses', [el('div', { class: 'st-now' }, summary.join(' · ')),
|
|
464
|
-
!w.ready ? fold('alert', 'Local transcription is not set up (' + (w.missing || []).join(' and ') + ' missing). Open a note and choose Set up in a terminal.', 'w')
|
|
465
|
-
: warn ? fold('alert', langOv ? 'An environment variable overrides the language you pick below.' : 'Detect can turn accented English into another language. Pick a language if transcripts come back wrong.', 'w') : null,
|
|
466
|
-
help('Wispr Flow notes after a meeting: ' + (w.wispr === false ? 'off' : 'on') + '. That setting is in ', secLink('connectors', 'Connectors'), '.')],
|
|
467
|
-
{ ic: 'mic', right: tag(warn ? (w.ready ? 'Check language' : 'Not set up') : 'Ready', warn ? 'warn' : 'ok'), attrs: { 'data-c3set-recnow': '' } }),
|
|
468
|
-
group('Live transcript', [storeRow('rec.sources'),
|
|
469
|
-
lockedRow('notes.engine', 'Live engine', 'Both run on this computer. PMOS uses Qwen3-ASR when it is set up, because it handles English, Indonesian and Chinese in one model.', w.live === 'qwen' ? 'Qwen3-ASR' : w.ready ? 'Whisper' : 'None set up', 'computer'),
|
|
470
|
-
w.models && w.live !== 'qwen' ? extRow('notes.model', select('c3set-notes-model', EXT['notes.model'][2], w.models.map((m) => [m.value, m.label]), w.model, (v) => notesSwitch({ model: v }, 'notes.model', { model: w.model })), { scope: 'computer', forId: 'c3set-notes-model' }) : null,
|
|
471
|
-
w.accuracies && w.live !== 'qwen' ? extRow('notes.accuracy', seg(EXT['notes.accuracy'][2], w.accuracies.map((a) => [a.value, a.value === 'fast' ? 'Faster' : 'More accurate']), w.accuracy, (v) => notesSwitch({ accuracy: v }, 'notes.accuracy', { accuracy: w.accuracy })), { scope: 'computer' }) : null,
|
|
472
|
-
w.languages ? extRow('notes.language', select('c3set-notes-language', EXT['notes.language'][2], w.languages.map((l) => [l.value, l.label]), w.language, (v) => notesSwitch({ language: v }, 'notes.language', { language: w.language }), !!langOv), { scope: 'computer', forId: 'c3set-notes-language' }) : null,
|
|
473
|
-
w.language !== 'auto' ? storeRow('rec.guard') : null, storeRow('rec.echo'), storeRow('rec.settle'), M.ws ? storeRow('rec.vocab') : null], 'mic'),
|
|
474
|
-
group('After Stop', [storeRow('rec.final'),
|
|
475
|
-
fin && val('rec.final') !== false ? lockedRow('notes.final', 'Final transcriber', 'Picked from what is set up on this computer.', fin.transcriber === 'qwen' ? 'Qwen3-ASR' : fin.transcriber === 'parakeet' ? 'Parakeet' : fin.transcriber === 'whisper' ? 'Whisper, beam search' : 'None', 'computer') : null,
|
|
476
|
-
fin && val('rec.final') !== false ? lockedRow('notes.speakers', 'Separate speakers', 'Labels who said what. It runs when the speaker model is set up on this computer.', fin.speakers ? 'On, the speaker model is set up' : 'Off, no speaker model', 'computer') : null], 'mic'),
|
|
477
|
-
group('Audio', [extRow('notes.keep', swBtn(w.keep_audio !== false, EXT['notes.keep'][2], () => notesSwitch(flip('keep_audio', w.keep_audio === false), 'notes.keep', flip('keep_audio', w.keep_audio !== false))), { scope: 'computer' }),
|
|
478
|
-
w.keep_audio !== false ? extRow('notes.clean', swBtn(w.clean_audio === true, EXT['notes.clean'][2], () => notesSwitch(flip('clean_audio', w.clean_audio !== true), 'notes.clean', flip('clean_audio', w.clean_audio === true))), { scope: 'computer' }) : null,
|
|
479
|
-
w.keep_audio !== false ? storeRow('rec.retain') : null], 'mic'),
|
|
480
|
-
M.ws && j ? group('Jev', [extRow('notes.jev', swBtn(!!j.jev, EXT['notes.jev'][2], () => notesSwitch({ jev: !j.jev }, 'notes.jev', { jev: !!j.jev })), { scope: 'ws', note: j.paused || null }),
|
|
481
|
-
extRow('notes.check', swBtn(!!j.check, EXT['notes.check'][2], () => notesSwitch({ check: !j.check }, 'notes.check', { check: !!j.check })), { scope: 'ws' })], 'mic') : null,
|
|
482
|
-
];
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
function timeSec() {
|
|
486
|
-
const now = new Date();
|
|
487
|
-
const part = dayPartOf(now);
|
|
488
|
-
const hh = (h) => String(h).padStart(2, '0') + ':00';
|
|
489
|
-
return [fold('clock', 'Now: ' + part[0].toUpperCase() + part.slice(1) + ' · ' + String(now.getHours()).padStart(2, '0') + ':' + String(now.getMinutes()).padStart(2, '0') + ' · working hours ' + hh(val('time.workStart') ?? 9) + ' to ' + hh(val('time.workEnd') ?? 18) + '. Parts of the day follow your clock; the Briefing never reshuffles while you read.', null),
|
|
490
|
-
group('Where and when', [storeRow('time.zone'),
|
|
491
|
-
notYet('time.place', 'Location for daylight', 'Sunrise and sunset are worked out on this computer from an approximate place. No network (D6).', 'Today the place comes from your time zone. Picking a place comes later.', 'computer'),
|
|
492
|
-
storeRow('time.weekStart')], 'sun'),
|
|
493
|
-
group('Your day', [storeRow('time.workStart'), storeRow('time.workEnd'),
|
|
494
|
-
lockedRow('time.parts', 'Parts of the day', 'Morning until 11:00, midday until 14:00, afternoon until 17:00, evening until 21:00, then night.', 'Follows your clock', 'computer'),
|
|
495
|
-
lockedRow('time.idle', 'When cards re-rank', 'A new part of the day never reshuffles cards while you read.', 'Only when idle or on reload', 'computer'),
|
|
496
|
-
storeRow('time.prep'), storeRow('time.buffer')], 'sun'),
|
|
497
|
-
group('Ambience', [storeRow('time.tint'), storeRow('time.strip'),
|
|
498
|
-
lockedRow('time.motion', 'Motion', 'Fades and slides when cards move. Reduce motion in your system settings to turn them off.', 'Same as system', 'computer'),
|
|
499
|
-
lockedRow('time.weather', 'Weather', 'Weather needs a network request, which PMOS does not make (D6).', 'Off', 'computer')], 'sun')];
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
function sharingSec() {
|
|
503
|
-
if (!M.ws) return [fold(null, 'Pick a workspace at the top to set who its dashboards go to.')];
|
|
504
|
-
const s = S('share.audiences'); const aud = s ? s.value : {};
|
|
505
|
-
const sender = val('conn.sender');
|
|
506
|
-
const senderName = (LABELS['conn.sender'][3] || {})[sender] || sender;
|
|
507
|
-
const save = (next, msg, prev) => setStore('share.audiences', next, true).then((ok) => { if (ok) toast(msg, () => setStore('share.audiences', prev, true)); });
|
|
508
|
-
const rows = Object.entries(aud).map(([name, people]) => {
|
|
509
|
-
const inp = el('input', { type: 'text', placeholder: 'Add a person', 'aria-label': 'Add a person to ' + name, maxlength: '60', autocomplete: 'off' });
|
|
510
|
-
const addP = () => { const v = inp.value.trim(); if (!v) return; const next = JSON.parse(JSON.stringify(aud)); next[name] = [...people, v]; save(next, 'Added ' + v + ' to ' + name, aud); };
|
|
511
|
-
inp.addEventListener('keydown', (e) => { if (e.key === 'Enter') addP(); });
|
|
512
|
-
return el('li', { class: 'nrow', 'data-c3set-aud': name }, el('span', { class: 'ki' }, c3ic('user')),
|
|
513
|
-
el('div', { class: 'nb' }, el('span', { class: 'tt' }, name), el('div', { class: 'chips' }, scopeTag('ws')),
|
|
514
|
-
help(name === 'Leadership' ? 'Short: one sentence per report, and what needs a decision.' : name === 'Team' ? 'Fuller: the numbers behind each sentence.' : ''),
|
|
515
|
-
el('div', { class: 'chips' }, ...(people.length ? people.map((p) => bt({ type: 'button', class: 'chip2 lk', 'aria-label': 'Remove ' + p + ' from ' + name, title: 'Remove ' + p + ' from ' + name, onclick: () => { const next = JSON.parse(JSON.stringify(aud)); next[name] = people.filter((x) => x !== p); save(next, 'Removed ' + p, aud); } }, p, c3ic('x', 'sm'))) : [el('span', { class: 'dim' }, 'Nobody yet')]))),
|
|
516
|
-
el('div', { class: 'acts' }, inp, btn('Add', { onclick: addP })));
|
|
517
|
-
});
|
|
518
|
-
return [sect('Sender', [help(sender === 'none' ? 'Nothing is sent until you pick a sender. ' : 'Shares can go out through ' + senderName + '. ', 'Change it in ', secLink('connectors', 'Connectors'), '.')],
|
|
519
|
-
{ ic: 'mail', right: tag(sender === 'none' ? 'Not connected' : senderName, sender === 'none' ? 'warn' : 'ok') }),
|
|
520
|
-
group('Sending', [storeRow('share.mode', { disabled: sender === 'none', lock: sender === 'none' ? 'Connect a sender in Connectors first. Until then every share is a draft.' : null })], 'mail'),
|
|
521
|
-
group('Detail level', [notYet('share.detail', 'Detail for each audience', 'Short is one sentence per report and what needs a decision. Full adds the numbers behind each sentence.', 'The Share sheet sets the detail for each send. A default per audience comes later.', 'ws')], 'mail'),
|
|
522
|
-
sect('Audiences', [list(rows), M.err['share.audiences'] ? fold('alert', M.err['share.audiences'], 'w') : null], { ic: 'user', count: rows.length }),
|
|
523
|
-
sect('Scheduled reports', [fold(null, 'Each report has its own schedule. See and change them in Reports, under Set up.', null, btn('Open Reports', { variant: 'ghost', ic: 'next', onclick: () => ctx.goTab && ctx.goTab('rep', 'reports') }))], { ic: 'clock', attrs: { 'data-c3set-sched-link': '' } })];
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
function accessSec() {
|
|
527
|
-
const o = M.online;
|
|
528
|
-
const later = [sect('Open on your phone', [list([notYet('access.pair', 'Phone access', 'Scan a one-time code with your phone to pair it.', 'Pairing with a code comes later. Today, switch Online on and sign in from the phone.', 'computer')])], { ic: 'phone' }),
|
|
529
|
-
sect('Signed-in devices', [list([notYet('access.devices', 'Devices', 'The computers and phones signed in to this PMOS, each with Sign out.', 'The device list comes later. Cloudflare Access lists sign-ins today.', 'computer')])], { ic: 'user' })];
|
|
530
|
-
if (!o) return [fold(null, 'Reading the Online switch.'), ...later];
|
|
531
|
-
if (o.error) return [fold('alert', 'The Online switch could not be read: ' + o.error + '.', 'w'), ...later];
|
|
532
|
-
if (o.envHost) return [group('Online', [frame({ key: 'online.on', label: 'Online', help: 'PMOS_PUBLIC_HOST=' + o.envHost + ' was set when PMOS started, so it is already online that way.', control: locked('On, from the environment') })], 'phone'), ...later];
|
|
533
|
-
const F = [['host', 'Public hostname', 'pmos.example.com'], ['tunnel', 'Tunnel name', 'pmos-mac'], ['team', 'Cloudflare team domain', 'myteam.cloudflareaccess.com'], ['audience', 'Access audience tag', '64 letters and digits'], ['email', 'Email allowed in', 'you@example.com']];
|
|
534
|
-
const inputs = {};
|
|
535
|
-
const fieldRows = F.map(([k, l, ph]) => { inputs[k] = el('input', { type: 'text', id: 'c3set-online-' + k, value: o[k] || '', placeholder: ph, disabled: !o.canChange, autocomplete: 'off' }); return frame({ key: 'online.' + k, label: l, forId: 'c3set-online-' + k, control: inputs[k] }); });
|
|
536
|
-
const post = async (patch, msg) => { const r = await pmPost('/api/online', patch); if (r && r.ok !== false) { M.online = r; delete M.err['online.on']; toast(msg || 'Saved: Online'); } else M.err['online.on'] = (r && r.error) || 'Not saved.'; draw(); };
|
|
537
|
-
const values = () => Object.fromEntries(F.map(([k]) => [k, inputs[k].value.trim()]));
|
|
538
|
-
const running = o.on && o.running && o.running.running;
|
|
539
|
-
return [group('Online', [extRow('online.on', swBtn(o.on, 'Online', () => post({ ...values(), on: !o.on }, o.on ? 'Online is off' : 'Online is on'), { disabled: !o.canChange }), { scope: 'computer',
|
|
540
|
-
note: !o.canChange ? 'Only the computer that runs PMOS can change this.' : !o.cloudflared ? 'cloudflared is not installed. Install it (Mac: brew install cloudflared; Windows: winget install Cloudflare.cloudflared), then switch Online on.' : null })], 'phone'),
|
|
541
|
-
running ? fold('check', 'Tunnel running · cloudflared found' + (o.lastRefusal ? '' : ' · no refused sign-in'), 'a') : null,
|
|
542
|
-
sect('Tunnel and sign-in', [list(fieldRows), o.canChange ? el('div', { class: 'iacts' }, btn('Save', { variant: 'primary', onclick: () => post(values()) })) : null,
|
|
543
|
-
o.lastRefusal ? help('Last refused sign-in: ' + o.lastRefusal.reason) : null], { ic: 'phone' }),
|
|
544
|
-
...later];
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
/* Launch flags. 'mine': what a session you start begins with (kept in this browser, as the other defaults are).
|
|
548
|
-
* 'auto': what a session PMOS starts for you begins with (a schedule, a day run); kept on this computer, because no
|
|
549
|
-
* browser is open to answer a permission question when one fires. */
|
|
550
|
-
function flagsRow(which) {
|
|
551
|
-
const auto = which === 'auto';
|
|
552
|
-
const chosen = auto ? ((M.autoFlags && M.autoFlags.flags) || []) : sessionDefaults().flags;
|
|
553
|
-
const open = M.flagsOpen[which];
|
|
554
|
-
const save = async (next) => {
|
|
555
|
-
if (auto) {
|
|
556
|
-
const r = await pmPost('/api/auto-session-flags', { flags: next });
|
|
557
|
-
if (r && r.ok !== false) { M.autoFlags = r; delete M.err['sess.flags.auto']; toast('Saved: flags for automatic sessions'); }
|
|
558
|
-
else M.err['sess.flags.auto'] = (r && r.error) || 'Not saved.';
|
|
559
|
-
} else { setSessionDefaults({ flags: next }); toast('Saved: launch flags'); }
|
|
560
|
-
draw();
|
|
561
|
-
};
|
|
562
|
-
const missing = M.flagList ? flagsMissingValue(M.flagList, chosen) : [];
|
|
563
|
-
const control = el('div', { class: 'c3set-flags', 'data-c3set-flags': which },
|
|
564
|
-
el('p', { class: 'dim mono' }, chosen.length ? 'claude ' + flagsLine(chosen) : 'No flags.'),
|
|
565
|
-
missing.length ? el('p', { class: 'dim', role: 'alert' }, missing[0] + ' needs a value before it can be saved.') : null,
|
|
566
|
-
flagPicker({ list: M.flagList, chosen, filter: M.flagFilter, compact: !open, onFilter: (q) => { M.flagFilter = q; draw(); },
|
|
567
|
-
onChange: (next) => { if (auto && flagsMissingValue(M.flagList, next).length) { M.autoFlags = { ...M.autoFlags, flags: next }; draw(); } else save(next); } }),
|
|
568
|
-
btn(open ? 'Hide the full list' : 'Show every flag', { variant: 'ghost', onclick: () => { M.flagsOpen[which] = !open; draw(); }, attrs: { 'data-c3set-flags-all': which } }));
|
|
569
|
-
return frame(auto
|
|
570
|
-
? { key: 'sess.flags.auto', label: 'Flags for automatic sessions', scope: 'computer', wide: true, control, err: M.err['sess.flags.auto'],
|
|
571
|
-
help: 'Sessions PMOS starts for you, such as a scheduled brief, cannot answer a permission question, so they wait. Set a permission mode here. Until you save a choice they start with --permission-mode=acceptEdits.',
|
|
572
|
-
note: M.autoFlags && M.autoFlags.saved === false ? 'Using the default. Change a flag to save your own.' : null }
|
|
573
|
-
: { key: 'sess.flags', label: 'Launch flags', scope: 'computer', wide: true, control,
|
|
574
|
-
help: 'Flags for the claude command when you start a session, such as a permission mode. You can change them for one session in the New session form.', note: 'Kept in this browser, as the dock keeps it.' });
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
function sessionsSec() {
|
|
578
|
-
const d = sessionDefaults(); const p = M.profiles;
|
|
579
|
-
const profs = (p && p.profiles) || [];
|
|
580
|
-
const setDef = (patch, key, undo) => { setSessionDefaults(patch); toast('Saved: ' + EXT[key][2], () => { setSessionDefaults(undo); draw(); }); draw(); };
|
|
581
|
-
const def = profileNow().id;
|
|
582
|
-
const profRows = profs.map((x) => el('li', { class: 'nrow', 'data-c3set-prof': x.id }, el('span', { class: cx('ki', def === x.id && 'hot') }, c3ic('user')),
|
|
583
|
-
el('div', { class: 'nb' }, el('span', { class: 'tt' }, (x.label || x.id) + ' ', el('span', { class: 'dim mono' }, x.id)),
|
|
584
|
-
el('div', { class: 'chips' }, def === x.id ? tag('Default', 'acc') : null, x.detected ? tag('Detected') : null, chip('Connectors: ' + (x.mcp && x.mcp.length ? x.mcp.join(', ') : 'none')))),
|
|
585
|
-
el('div', { class: 'acts' }, def === x.id ? null : btn('Make default', { variant: 'ghost', onclick: () => chooseProfile(x.id) }))));
|
|
586
|
-
const run = M.running || [];
|
|
587
|
-
const max = val('sess.max');
|
|
588
|
-
const runRows = run.map((s) => el('li', { class: 'nrow' }, el('span', { class: 'ki' }, c3ic('term')),
|
|
589
|
-
el('div', { class: 'nb' }, el('span', { class: 'tt' }, s.title || s.name || s.label || s.id),
|
|
590
|
-
el('div', { class: 'chips' }, s.ws ? chip(wsName(s.ws)) : null, s.profile ? chip('profile ' + s.profile) : null, s.state || s.status ? tag(String(s.state || s.status), /idle/i.test(String(s.state || s.status)) ? 'warn' : 'ok') : null))));
|
|
591
|
-
return [group('New sessions', [
|
|
592
|
-
extRow('sess.cli', seg('Start with', [['claude', 'Claude Code'], ['shell', 'A shell']], d.cli, (v) => setDef({ cli: v }, 'sess.cli', { cli: d.cli })), { scope: 'computer', note: 'Kept in this browser, as the dock keeps it.' }),
|
|
593
|
-
extRow('sess.tier', seg('Model', [['auto', 'Auto'], ['fast', 'Fast'], ['balanced', 'Balanced'], ['deep', 'Deep']], d.tier, (v) => setDef({ tier: v }, 'sess.tier', { tier: d.tier })), { scope: 'computer' }),
|
|
594
|
-
extRow('sess.profile', profileSelect('c3set-sess-profile'), { scope: 'computer', forId: 'c3set-sess-profile', note: profs.length ? null : p ? 'No profile was found. Make one in the classic app\'s Settings, Profiles (/classic.html).' : 'Reading profiles.' }),
|
|
595
|
-
flagsRow('mine'), flagsRow('auto')], 'term'),
|
|
596
|
-
ownLoginSec(profs, def),
|
|
597
|
-
profs.length ? sect('Profiles', [list(profRows), help('A new profile is made in the classic app\'s Settings, Profiles (/classic.html).')], { ic: 'user', count: profs.length }) : null,
|
|
598
|
-
groupOf('sessions', 'Housekeeping', 'term'),
|
|
599
|
-
sect('Running now' + (M.running ? ' · ' + run.length + (max ? ' of ' + max : '') : ''), [M.running ? (run.length ? list(runRows) : fold(null, 'No sessions running.')) : fold(null, 'Reading the sessions.'),
|
|
600
|
-
help('Close a session from the dock at the bottom of the page.')], { ic: 'term' }),
|
|
601
|
-
M.ws ? group('Workspace', [extRow('validate.consent', M.consent && !M.consent.error ? swBtn(M.consent.on, EXT['validate.consent'][2], async () => { const r = await pmPost('/api/validate/repo', { ws: M.ws, consent: !M.consent.on }); if (r && r.ok !== false) { M.consent.on = !!r.consent; toast('Saved: validate consent'); } else M.err['validate.consent'] = (r && r.error) || 'Not saved.'; draw(); }) : el('span', { class: 'dim' }, M.consent ? M.consent.error : 'Reading'), { scope: 'ws' })], 'term') : null];
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
/* PMOS's own Claude login (claude-own-login): a profile of its own, so a /login typed in a terminal never signs PMOS out. */
|
|
605
|
-
async function ownSignIn() {
|
|
606
|
-
delete M.err['sess.own'];
|
|
607
|
-
const made = await pmPost('/api/profiles/own', {});
|
|
608
|
-
if (!made || !made.ok) { M.err['sess.own'] = (made && made.error) || 'The profile was not made.'; draw(); return; }
|
|
609
|
-
const term = await import('./tab-term.js').catch(() => null);
|
|
610
|
-
const res = term ? await term.requestSpawn({ name: 'Sign in · PMOS Claude', agent: 'claude', profile: made.id, ws: M.ws, start: true, workType: 'general' }) : null;
|
|
611
|
-
pmGet('/api/profiles').then((r) => { M.profiles = r && r.ok !== false ? r : M.profiles; draw(); });
|
|
612
|
-
if (!res || !res.ok) { M.err['sess.own'] = (res && res.error) || 'The session did not start.'; draw(); return; }
|
|
613
|
-
const m = await import('./c3-session-term.js');
|
|
614
|
-
m.openSessionTerm({ id: res.id, name: 'Sign in · PMOS Claude' });
|
|
615
|
-
toast('Type /login in the terminal and sign in. Then press Use for PMOS.');
|
|
616
|
-
}
|
|
617
|
-
function ownLoginSec(profs, def) {
|
|
618
|
-
const own = profs.find((x) => x.id === 'pmos');
|
|
619
|
-
const using = !!own && def === 'pmos';
|
|
620
|
-
return sect('PMOS\'s own Claude login', [
|
|
621
|
-
help('A /login typed in a terminal replaces the account PMOS uses in the background. Give PMOS its own login and a terminal can never sign it out. Terminal sessions keep working as they do now: sign in or switch there whenever you like.'),
|
|
622
|
-
el('div', { class: 'iacts', 'data-c3set-own': '' },
|
|
623
|
-
using ? tag('In use', 'ok') : null,
|
|
624
|
-
btn(own ? 'Sign in again' : 'Set up', { variant: own && !using ? 'outline' : using ? 'ghost' : 'primary', attrs: { 'data-c3set-own-signin': '' }, disabled: !M.ws, onclick: ownSignIn }),
|
|
625
|
-
own && !using ? btn('Use for PMOS', { variant: 'primary', attrs: { 'data-c3set-own-use': '' }, onclick: () => chooseProfile('pmos') }) : null),
|
|
626
|
-
M.err['sess.own'] ? fold('alert', M.err['sess.own'], 'w') : null], { ic: 'user' });
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
function privacySec() {
|
|
630
|
-
const w = M.engine && M.engine.whisper; const j = M.engine && M.engine.jev; const o = M.online;
|
|
631
|
-
const jevOn = !!(j && (j.jev || j.check));
|
|
632
|
-
const L = [
|
|
633
|
-
['Nothing, by default', 'PMOS makes no network request of its own (D69 to D71).', 'Always', 'ok'],
|
|
634
|
-
['Update check', 'Asks the npm registry for the latest version.', val('upd.check') === 'daily' ? 'Once a day' : 'Only when you press Check', val('upd.check') === 'daily' ? 'warn' : ''],
|
|
635
|
-
['Online tunnel', 'Cloudflare carries your pages to your other devices (D89).', o && o.on ? 'On' : 'Off', o && o.on ? 'warn' : ''],
|
|
636
|
-
['Jev (TypeSafe)', 'Note lines and matching passages. Never audio, names or private notes (D79).', M.ws ? (jevOn ? 'On in ' : 'Off in ') + wsName(M.ws) : 'Pick a workspace', jevOn ? 'warn' : ''],
|
|
637
|
-
['Local model', 'Winnow or Laya on 127.0.0.1 answers Jev questions when there is no TypeSafe key or TypeSafe fails (D95).', M.typesafe && M.typesafe.local ? M.typesafe.local.name + ', stays here' : 'Off', 'ok'],
|
|
638
|
-
['Your connected tools', 'Calendar, Jira, Wispr Flow and the sender are reached by your Claude session, not by PMOS.', 'Through profile ' + (profileNow().id || 'none'), ''],
|
|
639
|
-
];
|
|
640
|
-
const leave = L.map(([t, h, s, tone]) => el('li', { class: 'nrow' }, el('span', { class: cx('ki', tone === 'ok' ? 'hot' : tone === 'warn' ? 't-warn' : '') }, c3ic(tone === 'ok' ? 'lock' : 'out')),
|
|
641
|
-
el('div', { class: 'nb' }, el('span', { class: 'tt' }, t), help(h)), el('div', { class: 'acts' }, tag(s, tone))));
|
|
642
|
-
return [sect('What leaves this computer', [list(leave)], { ic: 'shield', attrs: { 'data-c3set-leaves': '' } }),
|
|
643
|
-
sect('Keys and files', [list([
|
|
644
|
-
frame({ key: 'typesafe', label: 'TypeSafe key', help: 'Kept on this computer only. It is never shown, here or anywhere.', scope: 'computer', control: M.typesafe ? tag(M.typesafe.source === 'settings' || M.typesafe.source === 'environment' ? 'Saved' : 'None', M.typesafe.source === 'settings' || M.typesafe.source === 'environment' ? 'ok' : '') : tag('Reading') }),
|
|
645
|
-
localModelRow(),
|
|
646
|
-
frame({ key: 'state', label: 'Data folder', help: 'Notes, audio, settings and caches. Outside every repository, so no commit can carry them.', scope: 'computer', control: chip((M.data && M.data.state_dir) || '', 'mono st-wrap-text') }),
|
|
647
|
-
lockedRow('priv.cards', 'Send card text to Jev for icons', 'Card kinds and icons are chosen by code rules on this computer (D7).', 'Off', 'computer'),
|
|
648
|
-
notYet('priv.export', 'Export or reset every setting', 'Save every setting to a file, or put them all back to their defaults. Your workspaces, notes and audio stay.', 'Export and reset all come later. Reset one setting or one section with its Reset button.', 'computer')]),
|
|
649
|
-
el('div', { class: 'iacts' }, btn('Export settings', { ic: 'out', disabled: true }), btn('Reset all settings', { variant: 'ghost', disabled: true }), w && w.keep_audio !== false ? btn('Recording settings', { variant: 'ghost', ic: 'next', onclick: () => goSec('recording') }) : null)], { ic: 'lock' })];
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
/* D95 — a model on this computer answers Jev's questions when there is no TypeSafe key, or when TypeSafe fails.
|
|
653
|
-
* Winnow and Laya both speak Jev's interface; PMOS only calls 127.0.0.1 on the port shown. */
|
|
654
|
-
function localModelRow() {
|
|
655
|
-
const t = M.typesafe; const loc = t && t.local; const cur = loc ? loc.backend : 'off';
|
|
656
|
-
const pick = async (v) => {
|
|
657
|
-
const r = await pmPost('/api/typesafe/local', { backend: v });
|
|
658
|
-
if (r && r.ok !== false) { M.typesafe = r.key; delete M.err['typesafe.local']; M.localTest = null; toast(v === 'off' ? 'Saved: no local model' : 'Saved: local model'); }
|
|
659
|
-
else M.err['typesafe.local'] = (r && r.error) || 'Not saved.';
|
|
660
|
-
draw();
|
|
661
|
-
};
|
|
662
|
-
const test = async () => {
|
|
663
|
-
M.localTest = { busy: true }; draw();
|
|
664
|
-
const r = await pmPost('/api/typesafe/local/test', {});
|
|
665
|
-
M.localTest = r && r.ok ? { ok: true, text: 'Answered (' + (r.model || r.local) + ').' } : { ok: false, text: (r && r.error) || 'No answer.' };
|
|
666
|
-
draw();
|
|
667
|
-
};
|
|
668
|
-
const setup = async () => {
|
|
669
|
-
M.localTest = { busy: true }; draw();
|
|
670
|
-
const r = await pmPost('/api/typesafe/local/setup', {});
|
|
671
|
-
if (r && r.ok) {
|
|
672
|
-
M.typesafe = r.key; delete M.err['typesafe.local'];
|
|
673
|
-
M.localTest = { ok: !!r.started, text: r.started ? 'A terminal named Set up Laya opened with the commands typed in. Press Enter there, wait until Laya says it is running, then press Test.' : 'No terminal opened (' + (r.reason || 'unknown') + '). Run this in a terminal: ' + r.command };
|
|
674
|
-
// the server only starts the session; the page must open it, or nothing appears to happen
|
|
675
|
-
if (r.started && r.session) import('./c3-session-term.js').then((m) => m.openSessionTerm({ id: r.session, name: 'Set up Laya', view: 'term' })).catch(() => {});
|
|
676
|
-
} else { M.localTest = null; M.err['typesafe.local'] = (r && r.error) || 'Not started.'; }
|
|
677
|
-
draw();
|
|
678
|
-
};
|
|
679
|
-
const lt = M.localTest;
|
|
680
|
-
const note = !loc ? 'Off. With no TypeSafe key, Jev features stay off.'
|
|
681
|
-
: (t.source === 'local' ? 'No TypeSafe key, so ' + loc.name + ' answers every Jev question.' : 'TypeSafe answers first; ' + loc.name + ' answers when it fails.')
|
|
682
|
-
+ ' PMOS calls 127.0.0.1:' + loc.port + ' only. Nothing leaves this computer.' + (lt && !lt.busy ? ' ' + lt.text : '');
|
|
683
|
-
return frame({ key: 'typesafe.local', label: 'Local model if Jev is missing', help: 'Press Set up Laya to install and start Laya in a terminal, or start Winnow (winnow-inference, port 8091) yourself and pick it here.', scope: 'computer',
|
|
684
|
-
err: M.err['typesafe.local'], note,
|
|
685
|
-
control: t ? el('div', { class: 'iacts' }, seg('Local model', [['off', 'Off'], ['winnow', 'Winnow'], ['laya', 'Laya']], cur, pick),
|
|
686
|
-
btn('Set up Laya', { variant: 'ghost', disabled: !!(lt && lt.busy), onclick: setup, attrs: { 'data-c3set-laya-setup': '' } }),
|
|
687
|
-
loc ? btn(lt && lt.busy ? 'Working' : 'Test', { variant: 'ghost', disabled: !!(lt && lt.busy), onclick: test }) : null) : tag('Reading') });
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
function appearanceSec() {
|
|
691
|
-
const pref = ctx.themePref || ctx.theme;
|
|
692
|
-
return [group('Look', [extRow('look.theme', seg('Theme', [['system', 'Same as system'], ['light', 'Light'], ['dark', 'Dark']], pref, (v) => { const before = ctx.themePref || ctx.theme; if (ctx.setTheme) ctx.setTheme(v); ctx.themePref = v; ctx.theme = v; toast('Saved: theme', () => { if (ctx.setTheme) ctx.setTheme(before); ctx.themePref = before; ctx.theme = before; draw(); }); draw(); }), { scope: 'computer', note: 'Kept in this browser.' }),
|
|
693
|
-
storeRow('look.start'),
|
|
694
|
-
lockedRow('look.icons', 'Card icons', 'Chosen from the built-in icon set by the card kind (D7).', 'Chosen by code rules', 'computer')], 'eye')];
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
/* ── the app update (workspace-kit-update): the server stops, reinstalls and starts again, so the page waits for it ── */
|
|
698
|
-
const pause = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
699
|
-
async function updateApp(ws, from, to) {
|
|
700
|
-
M.app = { phase: 'busy', error: '', to }; draw();
|
|
701
|
-
const r = await pmPost('/api/kit/upgrade-app', { ws, version: to });
|
|
702
|
-
if (!r || r.ok === false) { M.app = { phase: null, error: (r && r.error) || 'The update did not start.' }; draw(); return; }
|
|
703
|
-
await waitForRestart(r.from || from, r.log || '');
|
|
704
|
-
}
|
|
705
|
-
/** Reload when the server is back on a new version; otherwise say what happened and name the log. */
|
|
706
|
-
async function waitForRestart(from, log) {
|
|
707
|
-
let sawDown = false;
|
|
708
|
-
const until = Date.now() + 5 * 60000;
|
|
709
|
-
while (Date.now() < until) {
|
|
710
|
-
await pause(2000);
|
|
711
|
-
const j = await pmGet('/api/sessions');
|
|
712
|
-
if (!j || j.ok === false || !j.version) { sawDown = true; continue; }
|
|
713
|
-
if (j.version !== from) { location.reload(); return; }
|
|
714
|
-
if (sawDown) { M.app = { phase: null, error: 'PMOS started again on ' + j.version + ', so the update did not finish. The update log is ' + log + '.' }; draw(); return; }
|
|
715
|
-
}
|
|
716
|
-
M.app = { phase: null, error: 'PMOS did not come back on this address. Type pmos in a terminal to open it. The update log is ' + log + '.' }; draw();
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
function updatesSec() {
|
|
720
|
-
const rows = (ctx.workspaces || []).map((w) => {
|
|
721
|
-
const k = M.kits[w.id];
|
|
722
|
-
const kit = k && k.kit; const behind = k && k.kitBehind;
|
|
723
|
-
return el('li', { class: 'nrow', 'data-c3set-kit': w.id }, el('span', { class: 'ki' }, c3ic('repo')),
|
|
724
|
-
el('div', { class: 'nb' }, el('span', { class: 'tt' }, w.label || w.name || w.id),
|
|
725
|
-
el('div', { class: 'chips' }, chip(!k ? 'Reading' : k.error ? k.error : kit && kit.present ? 'kit ' + (kit.version || 'vendored by hand') : 'no kit in this workspace', 'mono'),
|
|
726
|
-
k && k.latest ? (behind ? tag(k.latest + ' available', 'warn') : tag('Up to date', 'ok')) : null),
|
|
727
|
-
M.err['kit:' + w.id] ? fold('alert', M.err['kit:' + w.id], 'w') : null),
|
|
728
|
-
el('div', { class: 'acts' }, behind ? btn('Update', { variant: 'primary', disabled: !!M.kitBusy, attrs: { 'data-c3set-kit-update': w.id }, onclick: async () => { M.kitBusy = w.id; delete M.err['kit:' + w.id]; draw(); const r = await pmPost('/api/kit/update', { ws: w.id, version: k.latest }); M.kitBusy = null; if (r && r.ok) { M.kits[w.id] = { ...M.kits[w.id], ...r, kitBehind: false }; toast('Updated the kit in ' + (w.label || w.name || w.id)); } else M.err['kit:' + w.id] = (r && r.error) || 'Not updated.'; draw(); } }) : null));
|
|
729
|
-
});
|
|
730
|
-
const first = (ctx.workspaces || [])[0];
|
|
731
|
-
const st = first && M.kits[first.id];
|
|
732
|
-
const app = st && st.app; const appBehind = st && st.appBehind;
|
|
733
|
-
// A checkout updates with git, unless PMOS_UPDATE_SOURCE names a local package (server.js /api/kit/upgrade-app).
|
|
734
|
-
const gitOnly = !!(app && app.fromCheckout && !(st.source && st.source.kind === 'local'));
|
|
735
|
-
const U = M.app; const busy = U.phase === 'busy';
|
|
736
|
-
const appHelp = !appBehind ? 'Press Check now to ask the npm registry for the latest version.'
|
|
737
|
-
: gitOnly ? 'This workspace runs from a PMOS checkout. Update it with git pull.'
|
|
738
|
-
: 'The update stops PMOS, installs ' + st.latest + ' in place of ' + ((app && app.version) || '?') + ', and starts it again. Sessions keep running in tmux. This page reloads when the new version starts.';
|
|
739
|
-
const asking = appBehind && !gitOnly && U.phase === 'confirm';
|
|
740
|
-
const appRow = frame({ key: 'upd.app', label: 'PMOS app ' + ((app && app.version) || ''), help: appHelp, err: U.error || null,
|
|
741
|
-
note: asking ? el('span', { 'data-c3set-app-confirm': '' }, fold('alert', 'PMOS stops for about a minute while ' + st.latest + ' installs. Open terminals keep running.', 'w'))
|
|
742
|
-
: busy ? el('span', { 'data-c3set-app-busy': '', role: 'status', 'aria-live': 'polite' }, fold('cloud', 'Updating PMOS to ' + U.to + '. This page reloads when the new version starts.')) : null,
|
|
743
|
-
control: asking ? [btn('Cancel', { variant: 'ghost', attrs: { 'data-c3set-app-cancel': '' }, onclick: () => { M.app = { phase: null, error: '' }; draw(); } }),
|
|
744
|
-
btn('Restart and update', { variant: 'primary', attrs: { 'data-c3set-app-go': '' }, onclick: () => updateApp(first.id, (app && app.version) || '', st.latest) })]
|
|
745
|
-
: [st && st.latest ? tag(appBehind ? st.latest + ' available' : 'Up to date', appBehind ? 'acc' : 'ok') : null,
|
|
746
|
-
btn('Check now', { ic: 'undo', disabled: !first || busy, attrs: { 'data-c3set-check': '' }, onclick: async () => {
|
|
747
|
-
M.app = { phase: null, error: '' };
|
|
748
|
-
for (const w of ctx.workspaces || []) { const r = await pmPost('/api/kit/check', { ws: w.id }); M.kits[w.id] = r && r.ok ? r : { ...(M.kits[w.id] || {}), error: (r && r.error) || 'The check failed.' }; }
|
|
749
|
-
const s2 = first && M.kits[first.id]; toast(s2 && s2.appBehind ? 'PMOS ' + s2.latest + ' is available' : 'Checked. PMOS is up to date'); draw();
|
|
750
|
-
} }),
|
|
751
|
-
appBehind && !gitOnly && !busy ? btn('Update to ' + st.latest, { variant: 'primary', attrs: { 'data-c3set-app-update': '' }, onclick: () => { M.app = { phase: 'confirm', error: '' }; draw(); } }) : null] });
|
|
752
|
-
return [sect('PMOS app', [list([appRow])], { ic: 'cloud', attrs: { 'data-c3set-app': '' } }), sect('Kit in each workspace', [list(rows)], { ic: 'repo', count: rows.length }), groupOf('updates', 'When', 'cloud')];
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
/* ── Data refresh: every source PMOS reads or writes on a schedule (PRD data-refresh-settings R9).
|
|
756
|
-
GET /api/refresh?ws · POST /api/refresh/source, /rules, /run, /run-all · GET /api/refresh/log, /log.csv. One home: Connectors links here. ── */
|
|
757
|
-
const RF_GROUPS = [['tools', 'From your tools', 'org', 'Read through your Claude session. PMOS holds no keys for these.'], ['pmos', 'Written by PMOS', 'spark', 'Background runs that write cards, documents and proposals.'], ['change', 'Kept in step on every change', 'repo', 'No schedule: these follow your files as they change.']];
|
|
758
|
-
const RF_ST = { recent: ['Recent', 'ok'], old: ['Old', 'warn'], failed: ['Failed', 'warn'], running: ['Refreshing now', 'acc'], waiting: ['Waiting', 'acc'], off: ['Off', ''], never: ['Not yet', ''] };
|
|
759
|
-
const RF_KIND = { manual: 'When I press', every: 'Every few minutes', daily: 'Daily', weekdays: 'Working days', weekly: 'Weekly' };
|
|
760
|
-
const RF_DAYS = [['Mon', 'Monday'], ['Tue', 'Tuesday'], ['Wed', 'Wednesday'], ['Thu', 'Thursday'], ['Fri', 'Friday'], ['Sat', 'Saturday'], ['Sun', 'Sunday']];
|
|
761
|
-
const RF_EVERY = { 10: '10 min', 15: '15 min', 30: '30 min', 60: 'hour', 120: '2 hours', 240: '4 hours' };
|
|
762
|
-
const RF_HOURS = []; for (let h = 5; h <= 22; h++) for (const m of ['00', '30']) RF_HOURS.push(String(h).padStart(2, '0') + ':' + m);
|
|
763
|
-
const RF_DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; const RF_MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
764
|
-
const pad2 = (n) => String(n).padStart(2, '0');
|
|
765
|
-
/** Local time: HH:MM for today, "Mon 06:30" within a week, "Sun 11 Oct 06:30" beyond. */
|
|
766
|
-
function fmtAt(iso) {
|
|
767
|
-
const d = iso ? new Date(iso) : null; if (!d || isNaN(d)) return '';
|
|
768
|
-
const t = pad2(d.getHours()) + ':' + pad2(d.getMinutes()); const n = new Date();
|
|
769
|
-
if (d.toDateString() === n.toDateString()) return t;
|
|
770
|
-
if (Math.abs(d - n) < 6 * 864e5) return RF_DOW[d.getDay()] + ' ' + t;
|
|
771
|
-
return RF_DOW[d.getDay()] + ' ' + d.getDate() + ' ' + RF_MON[d.getMonth()] + ' ' + t;
|
|
772
|
-
}
|
|
773
|
-
const fmtTook = (ms) => { if (ms == null) return ''; const s = Math.max(1, Math.round(ms / 1000)); return s < 60 ? s + ' s' : Math.floor(s / 60) + ' min' + (s % 60 ? ' ' + (s % 60) + ' s' : ''); };
|
|
774
|
-
const rfRows = () => (M.rf && M.rf.rows) || [];
|
|
775
|
-
const rfRow = (id) => rfRows().find((x) => x.id === id);
|
|
776
|
-
const rfName = (id) => { const x = rfRow(id); return x ? x.label : id; };
|
|
777
|
-
const rfNames = (ids) => (ids || []).map(rfName).join(', ');
|
|
778
|
-
const needsLook = (r) => r.on && (r.state === 'failed' || r.state === 'old');
|
|
779
|
-
const sig = (s) => JSON.stringify(s);
|
|
780
|
-
|
|
781
|
-
async function loadRf(force) {
|
|
782
|
-
const [r, lg] = await Promise.all([pmGet('/api/refresh?' + qs({ ws: M.ws })), pmGet('/api/refresh/log?' + qs({ source: M.logSource, result: M.logResult, limit: 50 }))]);
|
|
783
|
-
const next = r && r.ok ? r : { error: (r && r.error) || 'The refresh schedule could not be read.' };
|
|
784
|
-
const log = lg && lg.ok ? { total: lg.total, runs: lg.runs || [] } : { error: (lg && lg.error) || 'The log could not be read.' };
|
|
785
|
-
const s = sig([next, log]); const same = s === M.rfSig; M.rfSig = s; M.rf = next; M.rfLog = log;
|
|
786
|
-
const a = document.activeElement;
|
|
787
|
-
const busy = !force && (M.rfEdit || M.rfAsk || (a && body.contains(a) && a.tagName === 'SELECT'));
|
|
788
|
-
if (force || (!same && !busy)) draw();
|
|
789
|
-
}
|
|
790
|
-
/* Poll while the section shows; stop when another section, a search or another page is on screen. */
|
|
791
|
-
let rfTimer = null;
|
|
792
|
-
function rfWatch() {
|
|
793
|
-
const on = M.sec === 'refresh' && !M.q;
|
|
794
|
-
if (rfTimer && (!on || !root.isConnected)) { clearInterval(rfTimer); rfTimer = null; }
|
|
795
|
-
if (on && !rfTimer) rfTimer = setInterval(() => { if (M.sec === 'refresh' && !M.q && root.isConnected && root.offsetParent) loadRf(false); }, 15000);
|
|
796
|
-
if (on && !M.rf && !M.rfLoading) { M.rfLoading = true; loadRf(true).finally(() => { M.rfLoading = false; }); }
|
|
797
|
-
}
|
|
798
|
-
const rfAfter = async () => { await loadRf(true); };
|
|
799
|
-
|
|
800
|
-
async function rfSetOn(r, on) {
|
|
801
|
-
M.rfAsk = null;
|
|
802
|
-
const res = await pmPost('/api/refresh/source', { id: r.id, on });
|
|
803
|
-
if (!res || !res.ok) { M.rfErr[r.id] = (res && res.error) || 'Not saved.'; draw(); return; }
|
|
804
|
-
delete M.rfErr[r.id]; await rfAfter();
|
|
805
|
-
toast((on ? 'Turned on: ' : 'Turned off: ') + r.label, async () => { await pmPost('/api/refresh/source', { id: r.id, on: !on }); await rfAfter(); });
|
|
806
|
-
}
|
|
807
|
-
async function rfSaveSchedule(r, sch, lead) {
|
|
808
|
-
const old = r.schedule;
|
|
809
|
-
const res = await pmPost('/api/refresh/source', { id: r.id, schedule: sch });
|
|
810
|
-
if (!res || !res.ok) { const msg = (res && res.error) || 'Not saved.'; if (M.rfEdit && M.rfEdit.id === r.id) M.rfEdit.err = msg; else M.rfErr[r.id] = msg; draw(); return false; }
|
|
811
|
-
M.rfEdit = null; delete M.rfErr[r.id]; await rfAfter();
|
|
812
|
-
const nr = rfRow(r.id);
|
|
813
|
-
toast(lead + ': ' + r.label + (nr ? ', ' + nr.schedule_text : ''), old ? async () => { await pmPost('/api/refresh/source', { id: r.id, schedule: old }); await rfAfter(); } : undefined);
|
|
814
|
-
return true;
|
|
815
|
-
}
|
|
816
|
-
async function rfRunNow(r, withInputs) {
|
|
817
|
-
const body = { id: r.id, ws: M.ws }; if (withInputs) body.with_inputs = true;
|
|
818
|
-
const res = await pmPost('/api/refresh/run', body);
|
|
819
|
-
if (!res || !res.ok) { toast((res && res.error) || r.label + ' did not start.'); await rfAfter(); return; }
|
|
820
|
-
await rfAfter();
|
|
821
|
-
toast(res.waiting && res.waiting.length ? r.label + ' starts when ' + rfNames(res.waiting) + ' has finished.' : 'Refreshing ' + r.label + '. You can leave this page.');
|
|
822
|
-
}
|
|
823
|
-
async function rfRunAll() {
|
|
824
|
-
M.rfAllBusy = true; draw();
|
|
825
|
-
const res = await pmPost('/api/refresh/run-all', { ws: M.ws });
|
|
826
|
-
M.rfAllBusy = false; await rfAfter();
|
|
827
|
-
if (!res || !res.ok) { toast((res && res.error) || 'Refresh all did not start.'); return; }
|
|
828
|
-
const bad = (res.failed || []).length;
|
|
829
|
-
toast('Refreshing ' + (res.started || []).length + ' sources.' + (bad ? ' ' + bad + ' did not start: ' + res.failed.map((f) => rfName(f.id) + ' (' + f.error + ')').join(', ') + '.' : ''));
|
|
830
|
-
}
|
|
831
|
-
async function rfSaveRule(key, value, label) {
|
|
832
|
-
const old = M.rf.rules[key];
|
|
833
|
-
const res = await pmPost('/api/refresh/rules', { [key]: value });
|
|
834
|
-
if (!res || !res.ok) { M.err['rf.' + key] = (res && res.error) || 'Not saved.'; draw(); return; }
|
|
835
|
-
delete M.err['rf.' + key]; if (res.rules) M.rf.rules = res.rules; await rfAfter();
|
|
836
|
-
toast('Saved: ' + label, async () => { await pmPost('/api/refresh/rules', { [key]: old }); await rfAfter(); });
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
/* the editor's draft is cleaned to the shape the API takes */
|
|
840
|
-
const cleanSchedule = (d) => d.kind === 'manual' ? { kind: 'manual' }
|
|
841
|
-
: d.kind === 'every' ? { kind: 'every', every: String(d.every), work: !!d.work }
|
|
842
|
-
: d.kind === 'weekly' ? { kind: 'weekly', day: d.day, times: [d.times[0]] } : { kind: d.kind, times: d.times.slice() };
|
|
843
|
-
function openEditor(r) {
|
|
844
|
-
const s = r.schedule || r.default || { kind: r.kinds[0] };
|
|
845
|
-
M.rfEdit = { id: r.id, err: '', d: { kind: s.kind, times: (s.times || []).slice(), day: s.day || 'Mon', every: String(s.every || (r.every || [])[0] || '60'), work: !!s.work } };
|
|
846
|
-
draw();
|
|
847
|
-
}
|
|
848
|
-
function setKind(r, k) {
|
|
849
|
-
const d = M.rfEdit.d; d.kind = k;
|
|
850
|
-
if (k === 'every' && !(r.every || []).includes(d.every)) d.every = (r.every || ['60'])[0];
|
|
851
|
-
if (['daily', 'weekdays', 'weekly'].includes(k) && !d.times.length) d.times = ['09:00'];
|
|
852
|
-
if (k === 'weekly') d.times = d.times.slice(0, 1);
|
|
853
|
-
M.rfEdit.err = ''; draw();
|
|
854
|
-
}
|
|
855
|
-
const timeOpts = (v) => (RF_HOURS.includes(v) ? RF_HOURS : [...RF_HOURS, v].sort()).map((h) => [h, h]);
|
|
856
|
-
|
|
857
|
-
/** One run of the log: when, which source, the result, how long and what it got. */
|
|
858
|
-
function runLine(run, withSource) {
|
|
859
|
-
const res = run.result; const bad = res === 'failed' || res === 'interrupted';
|
|
860
|
-
const tone = res === 'done' ? 'ok' : bad ? 'warn' : res === 'skipped' ? '' : 'acc';
|
|
861
|
-
const label = res === 'done' ? 'Done' : res === 'failed' ? 'Failed' : res === 'skipped' ? 'Skipped' : res === 'interrupted' ? 'Interrupted' : 'Running';
|
|
862
|
-
return el('li', { class: 'nrow', 'data-c3set-rfrun': run.run || '' },
|
|
863
|
-
el('span', { class: cx('ki', bad && 't-warn') }, c3ic(bad ? 'alert' : !res ? 'wait' : 'check', 'sm')),
|
|
864
|
-
el('div', { class: 'nb' }, el('span', { class: 'tt' }, (withSource ? rfName(run.source) + ' · ' : '') + fmtAt(run.start_at)),
|
|
865
|
-
el('div', { class: 'chips' }, tag(label, tone), run.took_ms != null ? chip('took ' + fmtTook(run.took_ms)) : null, run.trigger ? chip(run.trigger) : null, run.got ? chip(run.got) : null, run.note ? chip(run.note) : null),
|
|
866
|
-
run.error ? fold('alert', run.error, 'w') : null));
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
function rfEditor(r) {
|
|
870
|
-
const E = M.rfEdit; const d = E.d; const win = (M.rf && M.rf.window) || { start: '09:00', end: '18:00' };
|
|
871
|
-
const rows = [];
|
|
872
|
-
if (r.kinds.length > 1) rows.push(frame({ key: 'rf.kind', label: 'How often', control: seg('How often', r.kinds.map((k) => [k, RF_KIND[k] || k]), d.kind, (k) => setKind(r, k)) }));
|
|
873
|
-
if (d.kind === 'every') rows.push(frame({ key: 'rf.every', label: 'Every', forId: 'c3set-rf-every', control: select('c3set-rf-every', 'How often', (r.every || []).map((v) => [v, RF_EVERY[v] || v + ' min']), d.every, (v) => { d.every = v; draw(); }) }));
|
|
874
|
-
if (d.kind === 'daily' || d.kind === 'weekdays') {
|
|
875
|
-
rows.push(frame({ key: 'rf.times', label: 'At', help: d.kind === 'weekdays' ? 'Monday to Friday.' : '',
|
|
876
|
-
control: [...d.times.flatMap((t, i) => [select('c3set-rf-time-' + i, 'Time ' + (i + 1), timeOpts(t), t, (v) => { d.times[i] = v; d.times = [...new Set(d.times)].sort(); draw(); }),
|
|
877
|
-
d.times.length > 1 ? bt({ type: 'button', class: 'ib sm', 'aria-label': 'Remove ' + t, onclick: () => { d.times.splice(i, 1); draw(); } }, c3ic('x', 'sm')) : null]),
|
|
878
|
-
d.times.length < 4 ? btn('Add a time', { variant: 'ghost', ic: 'plus', attrs: { 'data-c3set-rf-addtime': '' }, onclick: () => { const last = d.times[d.times.length - 1]; const h = Math.min(22, +last.slice(0, 2) + 4); let t = pad2(h) + ':' + last.slice(3); for (const o of RF_HOURS) { if (!d.times.includes(t)) break; t = o; } if (!d.times.includes(t)) d.times = [...d.times, t].sort(); draw(); } }) : null] }));
|
|
879
|
-
}
|
|
880
|
-
if (d.kind === 'weekly') rows.push(frame({ key: 'rf.day', label: 'On', control: [select('c3set-rf-day', 'Day', RF_DAYS, d.day, (v) => { d.day = v; draw(); }), select('c3set-rf-time-0', 'Time', timeOpts(d.times[0]), d.times[0], (v) => { d.times = [v]; draw(); })] }));
|
|
881
|
-
if (d.kind === 'every') rows.push(frame({ key: 'rf.work', label: 'Only in working hours', help: [win.start + ' to ' + win.end + ', set in ', secLink('time', 'Day and time'), '. Outside them this waits for the next slot.'],
|
|
882
|
-
control: swBtn(d.work, 'Only in working hours', () => { d.work = !d.work; draw(); }) }));
|
|
883
|
-
const hist = (r.runs || []).slice(0, 5).map((x) => runLine(x, false));
|
|
884
|
-
const isDef = !r.default || sig(r.schedule) === sig(r.default);
|
|
885
|
-
return el('div', { class: 'rf-ed', 'data-c3set-rf-editor': r.id },
|
|
886
|
-
list(rows),
|
|
887
|
-
el('div', { class: 'mk-lbl dim st-help' }, 'Last runs'),
|
|
888
|
-
hist.length ? list(hist) : help('Nothing has run yet.'),
|
|
889
|
-
E.err ? el('div', { class: 'fold w', role: 'alert', 'data-c3set-rf-err': '' }, c3ic('alert', 'sm'), el('span', null, E.err)) : null,
|
|
890
|
-
el('div', { class: 'iacts' }, btn('Save', { variant: 'primary', attrs: { 'data-c3set-rf-save': r.id }, onclick: () => rfSaveSchedule(r, cleanSchedule(d), 'Saved') }),
|
|
891
|
-
btn('Cancel', { variant: 'ghost', onclick: () => { M.rfEdit = null; draw(); } }),
|
|
892
|
-
isDef ? null : btn('Back to default', { variant: 'ghost', ic: 'undo', attrs: { 'data-c3set-rf-default': r.id }, onclick: () => rfSaveSchedule(r, r.default, 'Back to the default') })));
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
function rfSourceRow(r) {
|
|
896
|
-
const [lab, tone] = RF_ST[r.state] || ['', ''];
|
|
897
|
-
const open = !!(M.rfEdit && M.rfEdit.id === r.id); const asking = M.rfAsk === r.id; const running = r.state === 'running';
|
|
898
|
-
const l = r.last;
|
|
899
|
-
const how = r.how === 'tool' ? 'Your Claude session reads it' + (profileNow().id ? ' through profile ' + profileNow().id : '') : r.how === 'bg' ? 'A background Claude run writes it' : 'Code on this computer, no model';
|
|
900
|
-
const lastRes = !l ? 'It has not run yet.' : running || !l.result ? 'It is running now.' : l.result === 'failed' ? 'Last result: failed.' : l.result === 'skipped' ? 'The last run was skipped' + (l.note ? ': ' + l.note : '') + '.'
|
|
901
|
-
: l.result === 'interrupted' ? 'The last run was interrupted.' : 'Last result: ' + (l.got || 'done') + (l.took_ms != null ? ', took ' + fmtTook(l.took_ms) : '') + '.';
|
|
902
|
-
const lastChip = running && l ? 'Started ' + fmtAt(l.start_at) : l ? 'Last refreshed ' + fmtAt(l.at || l.start_at) : 'Never refreshed';
|
|
903
|
-
const nextChip = r.state === 'waiting' ? 'Waiting for ' + rfNames(r.waiting_for) : r.on && r.next_at ? 'Next ' + fmtAt(r.next_at) : null;
|
|
904
|
-
const relation = [r.uses.length ? 'Uses: ' + rfNames(r.uses) + '.' : null, r.used_by.length ? 'Used by: ' + rfNames(r.used_by) + '.' : null].filter(Boolean).join(' ');
|
|
905
|
-
const ask = asking ? el('div', { class: 'fold w', role: 'alert', 'data-c3set-rf-ask': r.id }, c3ic('alert', 'sm'),
|
|
906
|
-
el('span', null, 'If you turn off ' + r.label + ': ' + r.impact + (r.used_by.length ? ' These use it: ' + rfNames(r.used_by) + '.' : ''))) : null;
|
|
907
|
-
const nb = [
|
|
908
|
-
el('span', { class: 'tt' }, el('span', { class: cx('ki', r.on && r.state === 'failed' && 't-warn') }, c3ic(r.ic, 'sm')), r.label),
|
|
909
|
-
el('div', { class: 'chips' }, tag(lab, tone), chip(lastChip), chip(r.schedule_text), nextChip ? chip(nextChip) : null),
|
|
910
|
-
help(r.what + ' ' + how + '. ' + lastRes),
|
|
911
|
-
relation ? help(relation) : null,
|
|
912
|
-
r.set_in ? help('Set in ' + r.set_in + '.') : null,
|
|
913
|
-
r.on && r.state === 'failed' ? fold('alert', (l && l.error) || 'The last run failed.', 'w', r.group === 'tools' ? btn('Open Connectors', { variant: 'ghost', ic: 'next', onclick: () => goSec('connectors') }) : null) : null,
|
|
914
|
-
r.on && r.state === 'old' && l && l.note ? fold('clock', l.note) : null,
|
|
915
|
-
r.built_on.length ? el('div', { class: 'fold', 'data-c3set-rf-builton': r.id }, c3ic('clock', 'sm'),
|
|
916
|
-
el('span', null, 'This builds on older data: ' + r.built_on.map((b) => b.label + (b.state && b.state !== 'recent' ? ' (' + (RF_ST[b.state] || [b.state])[0].toLowerCase() + ')' : '')).join(', ') + '.'),
|
|
917
|
-
btn('Refresh inputs first', { variant: 'ghost', ic: 'undo', disabled: !r.on || running, attrs: { 'data-c3set-rf-inputs': r.id }, onclick: () => rfRunNow(r, true) })) : null,
|
|
918
|
-
ask,
|
|
919
|
-
M.rfErr[r.id] ? el('div', { class: 'fold w', role: 'alert' }, c3ic('alert', 'sm'), el('span', null, M.rfErr[r.id])) : null,
|
|
920
|
-
open ? rfEditor(r) : null];
|
|
921
|
-
const acts = asking
|
|
922
|
-
? [btn('Turn off', { variant: 'primary', attrs: { 'data-c3set-rf-off-go': r.id }, onclick: () => rfSetOn(r, false) }), btn('Keep it on', { variant: 'ghost', onclick: () => { M.rfAsk = null; draw(); } })]
|
|
923
|
-
: [swBtn(r.on, (r.on ? 'Turn off ' : 'Turn on ') + r.label, () => { if (r.on) { M.rfAsk = r.id; draw(); } else rfSetOn(r, true); }, { 'data-c3set-rf-on': r.id }),
|
|
924
|
-
btn(running ? 'Refreshing' : 'Refresh now', { ic: 'undo', disabled: !r.on || running, attrs: { 'data-c3set-rf-now': r.id }, onclick: () => rfRunNow(r, false) }),
|
|
925
|
-
r.kinds.length ? btn(open ? 'Close' : 'Schedule', { variant: 'ghost', ic: open ? 'fold' : 'clock', attrs: { 'data-c3set-rf-open': r.id }, onclick: () => { if (open) M.rfEdit = null; else openEditor(r); draw(); } }) : null];
|
|
926
|
-
return el('li', { class: 'nrow st-row rf-row', 'data-c3set-rf': r.id }, el('div', { class: 'nb' }, ...nb.filter(Boolean)), el('div', { class: 'acts' }, ...acts.filter(Boolean)));
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
function rfRules() {
|
|
930
|
-
const R = M.rf.rules; const win = M.rf.window; const q = M.rf.quiet;
|
|
931
|
-
const rule = (key, label, h, control) => frame({ key: 'rf.' + key, label, help: h, scope: 'computer', control, err: M.err['rf.' + key] });
|
|
932
|
-
return sect('Rules for every refresh', [list([
|
|
933
|
-
rule('catchup', 'Catch up after PMOS was closed', 'When PMOS starts and a refresh was missed while it was closed, it runs once right away instead of waiting for the next slot.', swBtn(R.catchup, 'Catch up after PMOS was closed', () => rfSaveRule('catchup', !R.catchup, 'catch up'))),
|
|
934
|
-
rule('retry', 'When a refresh fails', 'Failures show on the source here and in the line under the page title.', select('c3set-rf-retry', 'When a refresh fails', [['15', 'Try again once after 15 min'], ['60', 'Try again once after an hour'], ['no', 'Wait for the next slot']], R.retry, (v) => rfSaveRule('retry', v, 'when a refresh fails'))),
|
|
935
|
-
rule('tell', 'Tell me about a failed refresh', 'A card on the Briefing names the source and what to do.', seg('Tell me about a failed refresh', [['brief', 'On the Briefing'], ['here', 'Only here']], R.tell, (v) => rfSaveRule('tell', v, 'tell me about a failed refresh'))),
|
|
936
|
-
rule('max', 'Background runs at once', 'Runs that use Claude wait in line beyond this number.', select('c3set-rf-max', 'Background runs at once', [['1', '1'], ['2', '2'], ['3', '3'], ['5', '5']], R.max, (v) => rfSaveRule('max', v, 'background runs at once'))),
|
|
937
|
-
rule('keep', 'Keep the log for', 'Older lines of the refresh log are deleted. The export holds every line that is kept.', select('c3set-rf-keep', 'Keep the log for', [['30', '30 days'], ['90', '90 days'], ['365', 'A year'], ['forever', 'Forever']], R.keep, (v) => rfSaveRule('keep', v, 'keep the log'))),
|
|
938
|
-
frame({ key: 'rf.quiet', label: 'Quiet hours', scope: 'computer', help: 'No scheduled refresh starts in quiet hours. A refresh you press still runs. Quiet hours are set in the proactive settings, not here.', control: chip(q ? q.start + ' to ' + q.end : 'None') }),
|
|
939
|
-
frame({ key: 'rf.window', label: 'Background working hours', scope: 'computer', help: ['Background runs that follow working hours use these. They are set in ', secLink('time', 'Day and time'), '.'], control: chip(win ? win.start + ' to ' + win.end : '') })])], { ic: 'clock', attrs: { 'data-c3set-rf-rules': '' } });
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
function rfLogCard() {
|
|
943
|
-
const L = M.rfLog || {};
|
|
944
|
-
const f = { source: M.logSource, result: M.logResult };
|
|
945
|
-
const href = '/api/refresh/log.csv' + (qs(f) ? '?' + qs(f) : '');
|
|
946
|
-
const setF = (k, v) => { if (k === 'source') M.logSource = v; else M.logResult = v; loadRf(true); };
|
|
947
|
-
const filters = el('div', { class: 'iacts' },
|
|
948
|
-
select('c3set-rf-log-source', 'Source', [['', 'All sources'], ...rfRows().map((x) => [x.id, x.label])], M.logSource, (v) => setF('source', v)),
|
|
949
|
-
select('c3set-rf-log-result', 'Result', [['', 'Any result'], ['done', 'Done'], ['failed', 'Failed'], ['skipped', 'Skipped'], ['interrupted', 'Interrupted']], M.logResult, (v) => setF('result', v)),
|
|
950
|
-
el('a', { class: 'chip2 lk', href, download: 'pmos-refresh-log.csv', 'data-c3set-rf-export': '' }, c3ic('out', 'sm'), 'Export'));
|
|
951
|
-
const runs = L.runs || [];
|
|
952
|
-
return sect('Refresh log', [filters, L.error ? fold('alert', L.error, 'w') : runs.length ? list(runs.map((x) => runLine(x, true))) : fold(null, M.logSource || M.logResult ? 'No run matches.' : 'Nothing has been refreshed yet.'),
|
|
953
|
-
L.total > runs.length ? help('Showing the newest ' + runs.length + ' of ' + L.total + '. Export has every line.') : null], { ic: 'clock', count: L.total != null ? L.total : null, attrs: { 'data-c3set-rf-log': '' } });
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
function refreshSec() {
|
|
957
|
-
const D = M.rf;
|
|
958
|
-
if (!D) return [fold(null, 'Reading the refresh schedule.')];
|
|
959
|
-
if (D.error) return [fold('alert', D.error, 'w')];
|
|
960
|
-
const rows = D.rows || [];
|
|
961
|
-
const on = rows.filter((r) => r.on); const bad = rows.filter(needsLook); const run = rows.filter((r) => r.state === 'running');
|
|
962
|
-
const next = on.filter((r) => r.next_at).sort((a, b) => new Date(a.next_at) - new Date(b.next_at))[0];
|
|
963
|
-
const sum = on.length + ' of ' + rows.length + ' on · ' + on.filter((r) => r.state === 'recent').length + ' recent' + (bad.length ? ' · ' + bad.length + ' need a look' : '') + (run.length ? ' · ' + run.length + ' refreshing now' : '');
|
|
964
|
-
const top = sect('Overview', [el('div', { class: 'st-now', 'data-c3set-rf-sum': '' }, sum),
|
|
965
|
-
help((next ? 'Next: ' + next.label + ' at ' + fmtAt(next.next_at) + '. ' : '') + 'PMOS refreshes only while it is running on this computer. The same states show in the line under the page title.'),
|
|
966
|
-
el('div', { class: 'iacts' }, seg('Show', [['all', 'All'], ['needs', 'Needs a look' + (bad.length ? ' (' + bad.length + ')' : '')], ['off', 'Off']], M.rfFilter, (v) => { M.rfFilter = v; draw(); }),
|
|
967
|
-
btn(M.rfAllBusy ? 'Starting' : 'Refresh all now', { ic: 'undo', disabled: M.rfAllBusy || !on.length, attrs: { 'data-c3set-rf-all': '' }, onclick: rfRunAll }))],
|
|
968
|
-
{ ic: 'undo', right: tag(bad.length ? bad.length + ' need a look' : 'All recent', bad.length ? 'warn' : 'ok') });
|
|
969
|
-
const pick = (r) => M.rfFilter === 'all' || (M.rfFilter === 'needs' && needsLook(r)) || (M.rfFilter === 'off' && !r.on);
|
|
970
|
-
const cards = RF_GROUPS.map(([g, t, ic, intro]) => {
|
|
971
|
-
const gr = rows.filter((r) => r.group === g && pick(r));
|
|
972
|
-
return gr.length ? sect(t, [help(intro), list(gr.map(rfSourceRow))], { ic, count: gr.length, attrs: { 'data-c3set-rf-card': g } }) : null;
|
|
973
|
-
});
|
|
974
|
-
return [top, ...(cards.some(Boolean) ? cards : [fold(null, M.rfFilter === 'off' ? 'Every source is on.' : 'Nothing needs a look. Every source refreshed on time.')]), rfRules(), rfLogCard()];
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
const BUILD = { about: aboutSec, workspaces: workspacesSec, boards: boardsSec, connectors: () => [...connectorsSec(), finderBlock(M.ws)], refresh: refreshSec, recording: recordingSec, time: timeSec, sharing: sharingSec, access: accessSec, sessions: sessionsSec, privacy: privacySec, appearance: appearanceSec, updates: updatesSec };
|
|
978
|
-
|
|
979
|
-
function searchView() {
|
|
980
|
-
const hits = rowsMatching(M.q);
|
|
981
|
-
const secs = SECTIONS.filter(([, t, , i]) => (t + ' ' + i).toLowerCase().includes(M.q.toLowerCase()));
|
|
982
|
-
if (!hits.length && !secs.length) return [el('div', { class: 'fold', 'data-c3set-none': '' }, 'No setting matches "' + M.q + '". Try a word like language, Jira or hours.')];
|
|
983
|
-
const by = new Map();
|
|
984
|
-
for (const [k, sec] of hits) { if (!by.has(sec)) by.set(sec, []); by.get(sec).push(k); }
|
|
985
|
-
return [secs.length ? el('div', { class: 'iacts' }, ...secs.map(([id, t, ic]) => btn(t, { ic, onclick: () => goSec(id) }))) : null,
|
|
986
|
-
...[...by.entries()].map(([sec, keys]) => {
|
|
987
|
-
const meta = SECTIONS.find((s) => s[0] === sec);
|
|
988
|
-
const other = (k) => { const a = k.startsWith('you.') ? ABOUT.find((f) => 'you.' + f[0] === k) : null; return a ? [a[1], a[2]] : [EXT[k][2], EXT[k][3]]; };
|
|
989
|
-
const rows = keys.map((k) => (LABELS[k] ? storeRow(k) : frame({ key: k, label: other(k)[0], help: other(k)[1], control: btn('Open in ' + meta[1], { variant: 'ghost', ic: 'next', onclick: () => goSec(sec) }) })));
|
|
990
|
-
return sect(meta[1], [list(rows)], { ic: meta[2], count: rows.filter(Boolean).length, right: btn('Open section', { variant: 'ghost', ic: 'next', onclick: () => goSec(sec) }) });
|
|
991
|
-
})];
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
function fillWs() {
|
|
995
|
-
wsSel.replaceChildren(...(ctx.workspaces || []).map((w) => el('option', { value: w.id, selected: w.id === M.ws }, w.label || w.name || w.id)));
|
|
996
|
-
if (!(ctx.workspaces || []).length) wsSel.append(el('option', { value: '' }, 'No workspace'));
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
/* The section list is built once and updated in place: rebuilding it under the pointer would lose the press that moved the focus. */
|
|
1000
|
-
const navBtns = SECTIONS.map(([id, t, ic]) => {
|
|
1001
|
-
const badge = el('span', { class: 'bdg', hidden: true });
|
|
1002
|
-
const b = bt({ type: 'button', class: 'nrow', 'aria-current': 'false', 'data-c3set-sec': id, onclick: () => goSec(id) },
|
|
1003
|
-
el('span', { class: 'ki' }, c3ic(ic)), el('span', { class: 'nb' }, el('span', { class: 'tt' }, t)), badge);
|
|
1004
|
-
return { id, b, badge };
|
|
1005
|
-
});
|
|
1006
|
-
nav.replaceChildren(...navBtns.map((x) => el('li', null, x.b)));
|
|
1007
|
-
const segBtns = SECTIONS.map(([id, t, ic]) => ({ id, b: bt({ type: 'button', 'aria-pressed': 'false', 'data-c3set-seg-sec': id, onclick: () => goSec(id) }, c3ic(ic, 'sm'), t) }));
|
|
1008
|
-
segRow.replaceChildren(el('div', { class: 'seg', role: 'group', 'aria-label': 'Settings sections' }, ...segBtns.map((x) => x.b)));
|
|
1009
|
-
function paintNav() {
|
|
1010
|
-
for (const x of navBtns) {
|
|
1011
|
-
const n = changedIn(x.id);
|
|
1012
|
-
x.b.setAttribute('aria-current', String(!M.q && M.sec === x.id));
|
|
1013
|
-
x.badge.hidden = !n; x.badge.textContent = n ? String(n) : ''; x.badge.title = n ? n + ' changed from the default' : '';
|
|
1014
|
-
}
|
|
1015
|
-
for (const x of segBtns) x.b.setAttribute('aria-pressed', String(!M.q && M.sec === x.id));
|
|
1016
|
-
}
|
|
1017
|
-
/* A press that takes the focus out of a field blurs it before its click lands: redraw after that click, not under it. */
|
|
1018
|
-
let pressing = false;
|
|
1019
|
-
document.addEventListener('pointerdown', () => { pressing = true; }, true);
|
|
1020
|
-
document.addEventListener('pointerup', () => { setTimeout(() => { pressing = false; }, 0); }, true);
|
|
1021
|
-
function drawAfterBlur() {
|
|
1022
|
-
const go = () => { if (draw.pending) { draw.pending = false; draw(); } };
|
|
1023
|
-
if (pressing) document.addEventListener('click', () => setTimeout(go, 0), { capture: true, once: true }); else go();
|
|
1024
|
-
}
|
|
1025
|
-
const changedIn = (id) => (M.data ? M.data.settings.filter((s) => s.changed && sectionOfStore(s.key) === id).length : 0);
|
|
1026
|
-
function draw() {
|
|
1027
|
-
// never rebuild under a field the PM is typing in
|
|
1028
|
-
const a = document.activeElement;
|
|
1029
|
-
if (a && body.contains(a) && ((a.tagName === 'INPUT' && a.type === 'text') || a.tagName === 'TEXTAREA')) { if (!draw.pending) { draw.pending = true; a.addEventListener('blur', drawAfterBlur, { once: true }); } return; }
|
|
1030
|
-
paintNav(); rfWatch();
|
|
1031
|
-
if (M.q) { body.replaceChildren(...searchView().filter(Boolean)); return; }
|
|
1032
|
-
const [id, title, ic, intro] = SECTIONS.find((s) => s[0] === M.sec);
|
|
1033
|
-
const needsStore = id !== 'about';
|
|
1034
|
-
const parts = M.data || !needsStore ? BUILD[id]() : [fold(null, 'Reading the settings.')];
|
|
1035
|
-
const n = changedIn(id);
|
|
1036
|
-
body.replaceChildren(el('div', { class: 'st-sec', 'data-c3set-section': id, 'aria-labelledby': 'c3set-h-' + id },
|
|
1037
|
-
el('div', { class: 'lh' }, el('span', { class: 'ki hot' }, c3ic(ic)), el('div', null, el('b', { id: 'c3set-h-' + id }, title), intro ? el('span', { class: 'dim' }, intro) : null),
|
|
1038
|
-
el('div', { class: 'acts' }, n ? btn('Reset section', { variant: 'ghost', onclick: () => resetSection(id), attrs: { 'data-c3set-reset-sec': id } }) : null)),
|
|
1039
|
-
M.data && M.data.error && needsStore ? fold('alert', M.data.error, 'w') : null,
|
|
1040
|
-
...parts.filter(Boolean)));
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
fillWs(); draw(); loadWs(); loadOnce();
|
|
1044
|
-
return { show: (sec) => { if (SECTIONS.some((s) => s[0] === sec)) goSec(sec); }, refresh: () => { loadWs(); pmGet('/api/sessions').then((r) => { M.running = r && Array.isArray(r.sessions) ? r.sessions : null; draw(); }); } };
|
|
1045
|
-
}
|