kaizen-agent 1.86.0 → 1.87.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/README.md +1 -1
- package/cli/annotate-proxy.ts +6 -3
- package/cli/build-web.ts +46 -16
- package/cli/dev.ts +67 -0
- package/cli/docs.ts +1 -1
- package/cli/notes.ts +9 -3
- package/cli/ports.ts +121 -0
- package/cli/settings.ts +16 -17
- package/cli/state.ts +15 -29
- package/cli/task-service.ts +44 -14
- package/cli/tasks.ts +1 -1
- package/cli/term-image.ts +18 -0
- package/cli/ui-audit.allow.json +0 -1
- package/cli/ui-audit.ts +12 -12
- package/cli/web.ts +182 -58
- package/package.json +21 -4
- package/skills/kaizen/spec.md +10 -3
- package/tsconfig.json +16 -0
- package/web/README.md +105 -0
- package/web/{annotate.js → annotate/annotate.ts} +51 -50
- package/web/boot/boot.ts +7 -0
- package/web/components/annotate/annotate-bar.tsx +78 -0
- package/web/components/annotate/annotate-panel.tsx +20 -0
- package/web/components/annotate/annotate-settings.tsx +60 -0
- package/web/components/annotate/index.ts +1 -0
- package/web/components/annotate/notes-list.tsx +75 -0
- package/web/components/board/board-card.tsx +177 -0
- package/web/components/board/board-column.tsx +212 -0
- package/web/components/board/board-mode-switch.tsx +21 -0
- package/web/components/board/board-popups.tsx +45 -0
- package/web/components/board/card-footer.tsx +58 -0
- package/web/components/board/card-form.tsx +168 -0
- package/web/components/board/card-kids.tsx +53 -0
- package/web/components/board/clear-menu.tsx +36 -0
- package/web/components/board/filter-box.tsx +42 -0
- package/web/components/board/index.ts +6 -0
- package/web/components/board/run-form.tsx +129 -0
- package/web/components/board/severity-menu.tsx +44 -0
- package/web/components/board/status-strip.tsx +75 -0
- package/web/components/board/task-form.tsx +140 -0
- package/web/components/board/ws-card.tsx +38 -0
- package/web/components/context/context-panel.tsx +244 -0
- package/web/components/context/index.ts +1 -0
- package/web/components/decision/decision-bar.tsx +422 -0
- package/web/components/decision/index.ts +1 -0
- package/web/components/decision/inline-form.tsx +47 -0
- package/web/components/decision/plan-answers-form.tsx +78 -0
- package/web/components/decision/revise-form.tsx +65 -0
- package/web/components/decision/task-reply-form.tsx +48 -0
- package/web/components/footer/foot-bar.tsx +67 -0
- package/web/components/footer/index.ts +1 -0
- package/web/components/git/git-ask.tsx +88 -0
- package/web/components/git/git-commits.tsx +53 -0
- package/web/components/git/git-confirm.tsx +78 -0
- package/web/components/git/git-counts.tsx +10 -0
- package/web/components/git/git-files.tsx +113 -0
- package/web/components/git/git-head.tsx +70 -0
- package/web/components/git/git-icon.tsx +25 -0
- package/web/components/git/git-message.tsx +44 -0
- package/web/components/git/git-split.tsx +64 -0
- package/web/components/git/git-tab.tsx +55 -0
- package/web/components/git/index.ts +1 -0
- package/web/components/home/chat-list.tsx +57 -0
- package/web/components/home/home-composer.tsx +169 -0
- package/web/components/home/home-message.tsx +120 -0
- package/web/components/home/home-window.tsx +253 -0
- package/web/components/home/home-ws-add.tsx +47 -0
- package/web/components/home/index.ts +6 -0
- package/web/components/home/onboarding-dialog.tsx +371 -0
- package/web/components/icebox/board-chip.tsx +27 -0
- package/web/components/icebox/board-menu.tsx +41 -0
- package/web/components/icebox/bulk-bar.tsx +41 -0
- package/web/components/icebox/capture-box.tsx +155 -0
- package/web/components/icebox/choice-menu.tsx +39 -0
- package/web/components/icebox/collection-dialog.tsx +60 -0
- package/web/components/icebox/favicon.tsx +39 -0
- package/web/components/icebox/index.ts +10 -0
- package/web/components/icebox/kind-label.tsx +22 -0
- package/web/components/icebox/kind-menu.tsx +20 -0
- package/web/components/icebox/promote-form.tsx +93 -0
- package/web/components/icebox/reply-box.tsx +88 -0
- package/web/components/icebox/request-actions.tsx +141 -0
- package/web/components/icebox/request-badges.tsx +13 -0
- package/web/components/icebox/request-card.tsx +99 -0
- package/web/components/icebox/request-detail.tsx +43 -0
- package/web/components/icebox/request-images.tsx +33 -0
- package/web/components/icebox/request-phone-row.tsx +181 -0
- package/web/components/icebox/request-row.tsx +120 -0
- package/web/components/icebox/service-chip.tsx +58 -0
- package/web/components/icebox/snooze-menu.tsx +83 -0
- package/web/components/icebox/source-card.tsx +225 -0
- package/web/components/icebox/source-drawer.tsx +112 -0
- package/web/components/icebox/source-form.tsx +147 -0
- package/web/components/icebox/swipe-deck.tsx +242 -0
- package/web/components/layout/index.ts +1 -0
- package/web/components/layout/page-frame.tsx +44 -0
- package/web/components/markdown/index.ts +1 -0
- package/web/components/markdown/markdown.tsx +156 -0
- package/web/components/notebook/editor-pane.tsx +23 -0
- package/web/components/notebook/index.ts +5 -0
- package/web/components/notebook/note-body.tsx +172 -0
- package/web/components/notebook/note-tree.tsx +99 -0
- package/web/components/notebook/notes-head.tsx +37 -0
- package/web/components/notebook/notes-side.tsx +46 -0
- package/web/components/notes/index.ts +1 -0
- package/web/components/notes/note-composer.tsx +90 -0
- package/web/components/notes/notes-chat.tsx +58 -0
- package/web/components/panes/browser-pane.tsx +281 -0
- package/web/components/panes/index.ts +3 -0
- package/web/components/panes/preview-pane.tsx +91 -0
- package/web/components/panes/terminal-pane.tsx +52 -0
- package/web/components/phone/haptic.tsx +29 -0
- package/web/components/phone/index.ts +6 -0
- package/web/components/phone/phone-card.tsx +118 -0
- package/web/components/phone/phone-home.tsx +304 -0
- package/web/components/phone/phone-sheets.tsx +103 -0
- package/web/components/phone/qr-code.tsx +6 -0
- package/web/components/phone/usage-chips.tsx +85 -0
- package/web/components/phone/whatsapp-card.tsx +85 -0
- package/web/components/project/add-project-dialog.tsx +435 -0
- package/web/components/project/index.ts +3 -0
- package/web/components/project/project-bar.tsx +101 -0
- package/web/components/project/ws-menu.tsx +21 -0
- package/web/components/rail/agent-chips.tsx +110 -0
- package/web/components/rail/index.ts +4 -0
- package/web/components/rail/rail-filter.tsx +118 -0
- package/web/components/rail/rail-list.tsx +259 -0
- package/web/components/rail/source-marks.tsx +21 -0
- package/web/components/resources/index.ts +1 -0
- package/web/components/resources/resources-popup.tsx +490 -0
- package/web/components/run/doc-body.tsx +123 -0
- package/web/components/run/file-viewer.tsx +53 -0
- package/web/components/run/fix-form.tsx +88 -0
- package/web/components/run/index.ts +16 -0
- package/web/components/run/inline-md.tsx +30 -0
- package/web/components/run/key-hint.tsx +29 -0
- package/web/components/run/pane-gutter.tsx +52 -0
- package/web/components/run/pane-header.tsx +35 -0
- package/web/components/run/pane.tsx +140 -0
- package/web/components/run/panel-grip.tsx +49 -0
- package/web/components/run/panel-head.tsx +56 -0
- package/web/components/run/panel-tabs.tsx +35 -0
- package/web/components/run/phase-steps.tsx +37 -0
- package/web/components/run/project-notes.tsx +49 -0
- package/web/components/run/run-add-menu.tsx +80 -0
- package/web/components/run/run-bar.tsx +40 -0
- package/web/components/run/run-empty.tsx +10 -0
- package/web/components/run/run-footer.tsx +53 -0
- package/web/components/run/run-history.tsx +24 -0
- package/web/components/run/run-panes.tsx +78 -0
- package/web/components/run/run-picker.tsx +51 -0
- package/web/components/run/run-progress.tsx +30 -0
- package/web/components/run/run-tabs.tsx +147 -0
- package/web/components/run/run-wait.tsx +18 -0
- package/web/components/search/index.ts +1 -0
- package/web/components/search/search-palette.tsx +159 -0
- package/web/components/settings/account-rows.tsx +128 -0
- package/web/components/settings/agent-rows.tsx +249 -0
- package/web/components/settings/automation-rows.tsx +211 -0
- package/web/components/settings/browser-row.tsx +111 -0
- package/web/components/settings/cleanup-row.tsx +32 -0
- package/web/components/settings/commit-input.tsx +39 -0
- package/web/components/settings/index.ts +4 -0
- package/web/components/settings/integration-row.tsx +158 -0
- package/web/components/settings/mic-row.tsx +48 -0
- package/web/components/settings/orchestration-flow.tsx +87 -0
- package/web/components/settings/setting-row.tsx +131 -0
- package/web/components/settings/settings-item.tsx +78 -0
- package/web/components/settings/settings-loading.tsx +41 -0
- package/web/components/settings/settings-nav.tsx +119 -0
- package/web/components/settings/settings-scope.tsx +66 -0
- package/web/components/settings/settings-section.tsx +33 -0
- package/web/components/settings/skill-card.tsx +131 -0
- package/web/components/settings/stepper.tsx +74 -0
- package/web/components/settings/update-bar.tsx +167 -0
- package/web/components/shared/action-menu.tsx +76 -0
- package/web/components/shared/ask-host.tsx +18 -0
- package/web/components/shared/attach-button.tsx +23 -0
- package/web/components/shared/chip.tsx +19 -0
- package/web/components/shared/client-mark.tsx +15 -0
- package/web/components/shared/confirm-dialog.tsx +35 -0
- package/web/components/shared/empty-state.tsx +29 -0
- package/web/components/shared/field.tsx +77 -0
- package/web/components/shared/filter-popover.tsx +29 -0
- package/web/components/shared/form-frame.tsx +19 -0
- package/web/components/shared/icon-button.tsx +50 -0
- package/web/components/shared/index.ts +18 -0
- package/web/components/shared/mic-button.tsx +75 -0
- package/web/components/shared/pager.tsx +49 -0
- package/web/components/shared/picker.tsx +108 -0
- package/web/components/shared/project-mark.tsx +38 -0
- package/web/components/shared/segmented.tsx +43 -0
- package/web/components/shared/state-dot.tsx +4 -0
- package/web/components/shared/status-mark.tsx +26 -0
- package/web/components/shell/index.ts +3 -0
- package/web/components/shell/rail.tsx +259 -0
- package/web/components/shell/sprite.tsx +124 -0
- package/web/components/shell/wordmark.tsx +13 -0
- package/web/components/task/artifact-view.tsx +148 -0
- package/web/components/task/chat-bubble.tsx +43 -0
- package/web/components/task/filter-menu.tsx +38 -0
- package/web/components/task/index.ts +7 -0
- package/web/components/task/result-checks.tsx +34 -0
- package/web/components/task/result-view.tsx +103 -0
- package/web/components/task/status-badge.tsx +24 -0
- package/web/components/task/task-row.tsx +34 -0
- package/web/components/task/typing-dots.tsx +16 -0
- package/web/components/terminal/index.ts +3 -0
- package/web/components/terminal/terminal-bar.tsx +91 -0
- package/web/components/terminal/terminal-grid.tsx +149 -0
- package/web/components/terminal/terminal-modes.tsx +23 -0
- package/web/components/terminal/terminal-tile.tsx +139 -0
- package/web/dist/annotate.js +24 -0
- package/web/dist/board.css +718 -0
- package/web/dist/board.js +115 -0
- package/web/dist/boot.js +2 -0
- package/web/dist/notebook.css +319 -0
- package/web/dist/notebook.js +89 -0
- package/web/dist/popup.css +41 -0
- package/web/dist/popup.js +13 -0
- package/web/{term.js → dist/term.js} +48 -48
- package/web/dist/ui.css +3 -0
- package/web/dist/video.js +108 -0
- package/web/html/board.html +17 -0
- package/web/html/notes.html +14 -0
- package/web/html/popup.html +13 -0
- package/web/{video.html → html/video.html} +14 -15
- package/web/lib/annotate/index.ts +2 -0
- package/web/lib/annotate/notes.ts +105 -0
- package/web/lib/annotate/page.ts +121 -0
- package/web/lib/annotate/rules.ts +37 -0
- package/web/lib/annotate/session.ts +336 -0
- package/web/lib/board/board-actions.ts +119 -0
- package/web/lib/board/board-open.ts +12 -0
- package/web/lib/board/board-store.ts +159 -0
- package/web/lib/board/filter-box.ts +7 -0
- package/web/lib/board/index.ts +10 -0
- package/web/lib/board/nav.ts +29 -0
- package/web/lib/board/on-state.ts +90 -0
- package/web/lib/board/popups.ts +22 -0
- package/web/lib/board/snapshot.ts +105 -0
- package/web/lib/board/strip.ts +43 -0
- package/web/{board → lib/board}/ws-board.ts +1 -1
- package/web/lib/context/context-rules.ts +27 -0
- package/web/lib/context/context-store.ts +95 -0
- package/web/lib/context/feed.ts +28 -0
- package/web/lib/context/index.ts +3 -0
- package/web/lib/core/api.ts +86 -0
- package/web/lib/core/ask.ts +24 -0
- package/web/lib/core/board.ts +290 -0
- package/web/lib/core/brief.ts +31 -0
- package/web/lib/core/format.ts +8 -0
- package/web/lib/core/host.ts +107 -0
- package/web/lib/core/index.ts +16 -0
- package/web/{board → lib/core}/labels.ts +6 -5
- package/web/lib/core/layers.ts +7 -0
- package/web/lib/core/leave.ts +7 -0
- package/web/lib/core/motion.ts +10 -0
- package/web/{board/toast.ts → lib/core/notices.ts} +2 -20
- package/web/lib/core/notifier.ts +15 -0
- package/web/lib/core/store.ts +39 -0
- package/web/lib/core/term-handle.ts +8 -0
- package/web/lib/core/toast.ts +29 -0
- package/web/lib/core/utils.ts +15 -0
- package/web/lib/decision/index.ts +1 -0
- package/web/lib/decision/plan-questions.ts +39 -0
- package/web/lib/dictation/chunks.ts +93 -0
- package/web/lib/dictation/dictation-store.ts +22 -0
- package/web/lib/dictation/engine.ts +265 -0
- package/web/lib/dictation/index.ts +5 -0
- package/web/lib/dictation/mic.ts +42 -0
- package/web/lib/dictation/terminal-dictation.ts +50 -0
- package/web/lib/footer/footer-rules.ts +13 -0
- package/web/lib/footer/footer-store.ts +42 -0
- package/web/lib/footer/index.ts +2 -0
- package/web/lib/git/git-actions.ts +110 -0
- package/web/lib/git/git-panel.ts +43 -0
- package/web/lib/git/git-store.ts +47 -0
- package/web/lib/git/git.ts +170 -0
- package/web/lib/git/index.ts +4 -0
- package/web/lib/home/home-engine.ts +16 -0
- package/web/lib/home/home-events.ts +9 -0
- package/web/lib/home/home-store.ts +247 -0
- package/web/lib/home/home-window.ts +193 -0
- package/web/lib/home/home.ts +85 -0
- package/web/lib/home/index.ts +7 -0
- package/web/lib/home/onboarding.ts +199 -0
- package/web/lib/home/use-float-drag.ts +62 -0
- package/web/lib/icebox/icebox-actions.ts +518 -0
- package/web/lib/icebox/icebox-store.ts +112 -0
- package/web/lib/icebox/icebox-view.ts +48 -0
- package/web/lib/icebox/icebox.ts +273 -0
- package/web/lib/icebox/index.ts +8 -0
- package/web/lib/icebox/use-card-drag.ts +82 -0
- package/web/lib/icebox/use-ice-keys.ts +75 -0
- package/web/lib/icebox/use-icebox.ts +41 -0
- package/web/lib/icebox/use-row-swipe.ts +107 -0
- package/web/lib/markdown/index.ts +1 -0
- package/web/lib/markdown/markdown.ts +136 -0
- package/web/lib/notebook/autosave.ts +131 -0
- package/web/lib/notebook/deal.ts +58 -0
- package/web/lib/notebook/engine-complete.ts +128 -0
- package/web/lib/notebook/engine-preview.ts +287 -0
- package/web/lib/notebook/engine-types.ts +26 -0
- package/web/lib/notebook/engine-widgets.ts +218 -0
- package/web/lib/notebook/engine.ts +74 -0
- package/web/lib/notebook/index.ts +9 -0
- package/web/lib/notebook/kit-loader.ts +16 -0
- package/web/lib/notebook/kit.ts +12 -0
- package/web/{notes-lib.ts → lib/notebook/text.ts} +11 -10
- package/web/lib/notebook/vault-actions.ts +239 -0
- package/web/lib/notebook/vault-rules.ts +74 -0
- package/web/lib/notebook/vault-session.ts +73 -0
- package/web/lib/notebook/vault-store.ts +63 -0
- package/web/lib/notes/index.ts +4 -0
- package/web/lib/notes/md-html.ts +115 -0
- package/web/lib/notes/notes-actions.ts +32 -0
- package/web/lib/notes/notes-store.ts +22 -0
- package/web/lib/notes/notes.ts +58 -0
- package/web/{board → lib/notes}/rich.ts +1 -2
- package/web/lib/phone/index.ts +7 -0
- package/web/lib/phone/phone-actions.ts +77 -0
- package/web/lib/phone/phone-home.ts +102 -0
- package/web/lib/phone/phone-setup.ts +59 -0
- package/web/lib/phone/phone-sheet.ts +25 -0
- package/web/lib/phone/phone-store.ts +32 -0
- package/web/lib/phone/sheet-swipe.ts +55 -0
- package/web/lib/phone/use-phone-setup.ts +89 -0
- package/web/lib/project/add-project.ts +37 -0
- package/web/lib/project/branch.ts +14 -0
- package/web/lib/project/index.ts +5 -0
- package/web/lib/project/project-bar.ts +76 -0
- package/web/lib/project/project-pick.ts +36 -0
- package/web/lib/project/ws-menu.ts +8 -0
- package/web/lib/rail/agents.ts +63 -0
- package/web/lib/rail/card-links.ts +20 -0
- package/web/lib/rail/index.ts +7 -0
- package/web/lib/rail/rail-actions.ts +74 -0
- package/web/lib/rail/rail-boot.ts +99 -0
- package/web/lib/rail/rail-store.ts +85 -0
- package/web/lib/rail/rules.ts +241 -0
- package/web/lib/rail/source-marks.ts +17 -0
- package/web/lib/rail/use-rank-drag.ts +108 -0
- package/web/lib/resources/index.ts +3 -0
- package/web/lib/resources/resources-actions.ts +59 -0
- package/web/lib/resources/resources-store.ts +48 -0
- package/web/lib/resources/rules.ts +56 -0
- package/web/lib/router/index.ts +3 -0
- package/web/lib/router/route-rules.ts +96 -0
- package/web/lib/router/route-store.ts +115 -0
- package/web/lib/router/use-route-classes.ts +15 -0
- package/web/lib/run/browser.ts +53 -0
- package/web/lib/run/card-terminal.ts +32 -0
- package/web/lib/run/doc.ts +42 -0
- package/web/lib/run/grip.ts +8 -0
- package/web/lib/run/index.ts +19 -0
- package/web/lib/run/kept.ts +58 -0
- package/web/lib/run/layout-store.ts +156 -0
- package/web/lib/run/layout.ts +195 -0
- package/web/lib/run/panel-actions.ts +104 -0
- package/web/lib/run/panel-derive.ts +148 -0
- package/web/lib/run/panel-store.ts +125 -0
- package/web/lib/run/preview.ts +105 -0
- package/web/lib/run/run-actions.ts +118 -0
- package/web/lib/run/run-view-store.ts +134 -0
- package/web/lib/run/term-loader.ts +19 -0
- package/web/lib/run/use-panel-run.ts +125 -0
- package/web/lib/run/use-run-lifecycle.ts +70 -0
- package/web/lib/run/viewer.ts +12 -0
- package/web/lib/run/workspace.ts +281 -0
- package/web/lib/run/ws-actions.ts +293 -0
- package/web/lib/run/ws-derive.ts +50 -0
- package/web/lib/run/ws-draw.ts +102 -0
- package/web/lib/run/ws-store.ts +21 -0
- package/web/lib/run/ws-tabs.ts +125 -0
- package/web/lib/search/index.ts +3 -0
- package/web/lib/search/search-match.ts +48 -0
- package/web/lib/search/search-rows.ts +228 -0
- package/web/lib/search/search.ts +30 -0
- package/web/lib/search/use-search-rows.ts +22 -0
- package/web/lib/server/attention.ts +29 -0
- package/web/lib/server/index.ts +6 -0
- package/web/lib/server/poll-rules.ts +57 -0
- package/web/lib/server/poller.ts +210 -0
- package/web/lib/server/server-store.ts +39 -0
- package/web/lib/server/types.ts +31 -0
- package/web/lib/server/use-server.ts +19 -0
- package/web/lib/settings/agent-favicons.ts +14 -0
- package/web/lib/settings/index.ts +7 -0
- package/web/lib/settings/panel-settings.ts +29 -0
- package/web/lib/settings/settings-actions.ts +357 -0
- package/web/lib/settings/settings-store.ts +114 -0
- package/web/lib/settings/settings.ts +413 -0
- package/web/lib/settings/skill-icons.ts +24 -0
- package/web/lib/settings/update.ts +70 -0
- package/web/lib/shared/data-urls.ts +32 -0
- package/web/lib/shared/index.ts +4 -0
- package/web/lib/shared/use-draft.ts +38 -0
- package/web/lib/shared/use-narrow.ts +11 -0
- package/web/lib/shared/use-pager.ts +24 -0
- package/web/lib/shell/appearance.ts +97 -0
- package/web/lib/shell/help-store.ts +4 -0
- package/web/lib/shell/index.ts +4 -0
- package/web/lib/shell/shell-store.ts +23 -0
- package/web/lib/shell/stored-look.ts +47 -0
- package/web/lib/task/index.ts +7 -0
- package/web/lib/task/task-results.ts +92 -0
- package/web/lib/task/tasks.ts +132 -0
- package/web/lib/task/use-live-frame.ts +85 -0
- package/web/lib/task/use-saved-text.ts +25 -0
- package/web/lib/task/use-task.ts +161 -0
- package/web/lib/task/use-tasks.ts +50 -0
- package/web/{board → lib/task}/zoom.ts +25 -12
- package/web/lib/terminal/hidden-badge.ts +15 -0
- package/web/lib/terminal/index.ts +8 -0
- package/web/lib/terminal/layout.ts +138 -0
- package/web/{term-font.ts → lib/terminal/term-font.ts} +3 -2
- package/web/lib/terminal/terminal-store.ts +65 -0
- package/web/lib/terminal/terms-feed.ts +37 -0
- package/web/lib/terminal/use-arranged.ts +15 -0
- package/web/lib/terminal/use-terminal-keys.ts +37 -0
- package/web/lib/url/index.ts +1 -0
- package/web/lib/url/safe-url.ts +9 -0
- package/web/notebook/notebook.ts +27 -0
- package/web/notebook/notes-lib.ts +3 -0
- package/web/pages/board/App.tsx +76 -0
- package/web/pages/board/header.tsx +83 -0
- package/web/pages/board/help.tsx +59 -0
- package/web/pages/board/host-bridge.ts +94 -0
- package/web/pages/board/host.tsx +19 -0
- package/web/pages/board/keys.ts +112 -0
- package/web/pages/board/live.ts +39 -0
- package/web/pages/board/main.ts +32 -0
- package/web/pages/board/pages.tsx +86 -0
- package/web/pages/board/panel.tsx +157 -0
- package/web/pages/board/portal.tsx +39 -0
- package/web/pages/board/use-boot.ts +13 -0
- package/web/pages/board/views.ts +63 -0
- package/web/pages/board-page.tsx +62 -0
- package/web/pages/home-page.tsx +127 -0
- package/web/pages/icebox-page.tsx +440 -0
- package/web/pages/notebook/App.tsx +35 -0
- package/web/pages/notebook-page.tsx +50 -0
- package/web/pages/popup/App.tsx +207 -0
- package/web/pages/settings-page.tsx +111 -0
- package/web/pages/task-page.tsx +383 -0
- package/web/pages/tasks-page.tsx +151 -0
- package/web/pages/terminal-page.tsx +15 -0
- package/web/popup/popup.ts +7 -0
- package/web/{term.ts → term/term.ts} +48 -20
- package/web/ui/alert-dialog.tsx +39 -0
- package/web/ui/badge.tsx +20 -0
- package/web/ui/button.tsx +37 -0
- package/web/ui/checkbox.tsx +20 -0
- package/web/ui/command.tsx +41 -0
- package/web/ui/dialog.tsx +28 -0
- package/web/ui/dropdown-menu.tsx +54 -0
- package/web/ui/icon.tsx +17 -0
- package/web/ui/index.ts +21 -0
- package/web/ui/input.tsx +9 -0
- package/web/ui/label.tsx +7 -0
- package/web/ui/legacy/board.css +715 -0
- package/web/{notes.html → ui/legacy/notes.css} +23 -157
- package/web/ui/legacy/popup.css +40 -0
- package/web/ui/popover.tsx +28 -0
- package/web/ui/select.tsx +61 -0
- package/web/ui/sheet.tsx +43 -0
- package/web/ui/skeleton.tsx +6 -0
- package/web/ui/sonner.tsx +25 -0
- package/web/ui/spinner.tsx +12 -0
- package/web/ui/switch.tsx +18 -0
- package/web/ui/tabs.tsx +18 -0
- package/web/ui/textarea.tsx +14 -0
- package/web/ui/theme.css +125 -0
- package/web/ui/toggle.tsx +8 -0
- package/web/ui/tooltip.tsx +26 -0
- package/web/{video.ts → video/video.ts} +5 -5
- package/web/board/add-project.ts +0 -147
- package/web/board/agent-favicons.ts +0 -9
- package/web/board/agent-term.ts +0 -51
- package/web/board/annotate-lib.ts +0 -19
- package/web/board/annotate.ts +0 -221
- package/web/board/api.ts +0 -180
- package/web/board/approvals.ts +0 -109
- package/web/board/badge.ts +0 -115
- package/web/board/cards.ts +0 -1080
- package/web/board/chat.ts +0 -128
- package/web/board/context.ts +0 -248
- package/web/board/dictation.ts +0 -343
- package/web/board/dom.ts +0 -132
- package/web/board/drafts.ts +0 -21
- package/web/board/fixes.ts +0 -89
- package/web/board/git.ts +0 -416
- package/web/board/home-ws.ts +0 -266
- package/web/board/home.ts +0 -421
- package/web/board/icebox.ts +0 -1788
- package/web/board/keys.ts +0 -121
- package/web/board/live.ts +0 -87
- package/web/board/main.ts +0 -94
- package/web/board/markdown.ts +0 -210
- package/web/board/onboarding.ts +0 -227
- package/web/board/panel.ts +0 -437
- package/web/board/phone-setup.ts +0 -79
- package/web/board/phone.ts +0 -219
- package/web/board/projects.ts +0 -277
- package/web/board/resources.ts +0 -170
- package/web/board/run-pick.ts +0 -41
- package/web/board/run-view.ts +0 -1316
- package/web/board/search-match.ts +0 -20
- package/web/board/search.ts +0 -330
- package/web/board/settings-accounts.ts +0 -76
- package/web/board/settings-agents.ts +0 -102
- package/web/board/settings-automations.ts +0 -71
- package/web/board/settings-cleanup.ts +0 -42
- package/web/board/settings-orchestration.ts +0 -32
- package/web/board/settings-pages.ts +0 -62
- package/web/board/settings-skills.ts +0 -103
- package/web/board/settings-voice.ts +0 -28
- package/web/board/settings.ts +0 -490
- package/web/board/store.ts +0 -47
- package/web/board/task-page.ts +0 -628
- package/web/board/task-results.ts +0 -234
- package/web/board/tasks.ts +0 -242
- package/web/board/terms.ts +0 -390
- package/web/board/update.ts +0 -171
- package/web/board/viewer.ts +0 -47
- package/web/board/views.ts +0 -164
- package/web/board/whatsapp-setup.ts +0 -149
- package/web/board/workspace.ts +0 -650
- package/web/board/ws-board-ui.ts +0 -95
- package/web/board/ws-tabs.ts +0 -227
- package/web/board.html +0 -1563
- package/web/board.js +0 -505
- package/web/notebook.js +0 -519
- package/web/notebook.ts +0 -1254
- package/web/popup.html +0 -141
- package/web/video.js +0 -575
- /package/web/{term.css → dist/term.css} +0 -0
- /package/web/{board/term-sessions.ts → lib/terminal/sessions.ts} +0 -0
- /package/web/{board/terminal-viewport.ts → lib/terminal/viewport.ts} +0 -0
- /package/web/{term-paste.ts → term/term-paste.ts} +0 -0
package/web/board/cards.ts
DELETED
|
@@ -1,1080 +0,0 @@
|
|
|
1
|
-
import { store } from "./store.ts";
|
|
2
|
-
import { where } from "./agent-term.ts";
|
|
3
|
-
import { load, post } from "./api.ts";
|
|
4
|
-
import { mic, stopDictation } from "./dictation.ts";
|
|
5
|
-
import { $, dataUrls, html, ico, modal, raw, toggleSwitch } from "./dom.ts";
|
|
6
|
-
import { draft, undraft } from "./drafts.ts";
|
|
7
|
-
import { COLS, ICON, MARKS, NAMES, WORD, age, d, need } from "./labels.ts";
|
|
8
|
-
import { brief } from "./markdown.ts";
|
|
9
|
-
import { open, openAt, toggleArchive } from "./panel.ts";
|
|
10
|
-
import { isPhone } from "./phone.ts";
|
|
11
|
-
import { taskCombo, list, newDir, plogo, setNewDir, short, showList, showable } from "./projects.ts";
|
|
12
|
-
import { askNotify, toast } from "./toast.ts";
|
|
13
|
-
import { answer, decided, resumable, resume } from "./approvals.ts";
|
|
14
|
-
import { termsBadge } from "./terms.ts";
|
|
15
|
-
import { boardBadge, waitingCount } from "./badge.ts";
|
|
16
|
-
import { openWorkspace } from "./run-view.ts";
|
|
17
|
-
import { boardMode, drawWsBoard, initWsBoard, syncMode } from "./ws-board-ui.ts";
|
|
18
|
-
|
|
19
|
-
let filter = null;
|
|
20
|
-
let query = ""; // the header filter box, matched against a card's title and request
|
|
21
|
-
// A column shows this many cards, then a "more" line; Done is where it matters.
|
|
22
|
-
const FOLD = 6;
|
|
23
|
-
const unfolded = new Set();
|
|
24
|
-
// Per column: "old" puts the oldest first; anything else is newest first.
|
|
25
|
-
let order = (() => {
|
|
26
|
-
try {
|
|
27
|
-
return JSON.parse(localStorage.getItem("kz-order")) || {};
|
|
28
|
-
} catch (e) {
|
|
29
|
-
return {};
|
|
30
|
-
}
|
|
31
|
-
})();
|
|
32
|
-
let archive = false; // showing the archive instead of the board
|
|
33
|
-
// The Tasks column shows tasks or the runs' open backlog, never both; kept per browser.
|
|
34
|
-
let tasksTab = (() => {
|
|
35
|
-
try {
|
|
36
|
-
return localStorage.getItem("kz-ideas-tab") === "backlog" ? "backlog" : "ideas";
|
|
37
|
-
} catch (e) {
|
|
38
|
-
return "ideas";
|
|
39
|
-
}
|
|
40
|
-
})();
|
|
41
|
-
// On the Backlog tab: one severity, or null for every one.
|
|
42
|
-
let sev = null;
|
|
43
|
-
const SEVS = [
|
|
44
|
-
["high", "High+", (s) => s === "critical" || s === "high"],
|
|
45
|
-
["medium", "Medium", (s) => s === "medium"],
|
|
46
|
-
["low", "Low", (s) => s === "low"],
|
|
47
|
-
["none", "No severity", (s) => !s],
|
|
48
|
-
];
|
|
49
|
-
// Open backlog items as cards for the Tasks column. A card's key names its line by
|
|
50
|
-
// source and number, which is what Start and Reject send back.
|
|
51
|
-
const backlogList = () =>
|
|
52
|
-
(store.S.backlog || []).map((b) => ({
|
|
53
|
-
...b,
|
|
54
|
-
kind: "backlog",
|
|
55
|
-
status: b.starting ? "starting" : "idea",
|
|
56
|
-
title: b.text,
|
|
57
|
-
column: 0,
|
|
58
|
-
archived: false,
|
|
59
|
-
_k: "backlog:" + b.state + ":" + b.source + "#" + b.n,
|
|
60
|
-
}));
|
|
61
|
-
// A backlog card opens its source run on the Backlog tab, the item marked.
|
|
62
|
-
const show = (c) => {
|
|
63
|
-
if (c.kind !== "backlog") return open(c);
|
|
64
|
-
const r = store.S.cards.find((x) => x.kind === "run" && x.id === c.source && x.state === c.state);
|
|
65
|
-
if (!r) return toast(c.source === "orphan" ? "Kept from a run that was pruned" : "That run was not found");
|
|
66
|
-
openAt(r, "backlog", c.n);
|
|
67
|
-
};
|
|
68
|
-
// Clear on Done: menu, then cherry-pick mode.
|
|
69
|
-
let picking = false;
|
|
70
|
-
const picked = new Set();
|
|
71
|
-
|
|
72
|
-
// Two tasks may carry the same text; load() numbers the repeats so a key names one card.
|
|
73
|
-
export const key = (c) =>
|
|
74
|
-
c._k || (c.kind === "idea" ? "idea:" + c.state + ":" + c.text : "run:" + c.state + ":" + c.id);
|
|
75
|
-
|
|
76
|
-
// Cards filed by a run sit inside it while it is on the board and not done; once the
|
|
77
|
-
// parent is done, archived or gone, they are back in their own columns.
|
|
78
|
-
const kidsOf = (p) => (p.kind === "run" ? store.S.cards.filter((c) => c.parent === p.id && c.state === p.state) : []);
|
|
79
|
-
const nested = (c) =>
|
|
80
|
-
!!c.parent &&
|
|
81
|
-
store.S.cards.some((p) => p.kind === "run" && p.id === c.parent && p.state === c.state && !p.archived && p.column !== 4);
|
|
82
|
-
const kidsOpen = new Set();
|
|
83
|
-
|
|
84
|
-
// What opening a waiting run does, in words: the card's button and its menu say the same.
|
|
85
|
-
// One already answered from this page says so until the agent moves the run on.
|
|
86
|
-
const actionOf = (c) =>
|
|
87
|
-
decided.has(answer(c))
|
|
88
|
-
? "Sent to agent"
|
|
89
|
-
: c.status !== "waiting"
|
|
90
|
-
? "Open"
|
|
91
|
-
: c.healed
|
|
92
|
-
? "Approve"
|
|
93
|
-
: { explore: "Review exploration", "approvals.plan": "Review plan", findings: "See findings", "approvals.review": "Review work" }[c.awaiting] || "Open";
|
|
94
|
-
|
|
95
|
-
function card(c) {
|
|
96
|
-
const k = key(c),
|
|
97
|
-
el = document.createElement("div");
|
|
98
|
-
el.className =
|
|
99
|
-
"card" +
|
|
100
|
-
(k === store.openKey ? " open" : "") +
|
|
101
|
-
(k === store.menuKey ? " menu" : "") +
|
|
102
|
-
(store.flash.has(k) ? " flash" : "") +
|
|
103
|
-
(c.archived ? " archived" : "");
|
|
104
|
-
el.tabIndex = 0;
|
|
105
|
-
el.dataset.k = k;
|
|
106
|
-
el.setAttribute("role", "button");
|
|
107
|
-
const st = ICON[c.status] || "idea",
|
|
108
|
-
idt = c.kind === "run" ? c.text.replace(/-/g, " ") : "";
|
|
109
|
-
// The status icon carries the state; what a waiting run needs is its tooltip.
|
|
110
|
-
const sttl = c.status === "waiting" ? need(c.awaiting) || "needs you" : c.status || "idea";
|
|
111
|
-
// Footer: words on the left (project, what it needs), icon-only marks on the right.
|
|
112
|
-
const chips = [],
|
|
113
|
-
marks = [],
|
|
114
|
-
mk = (id, t, cls = "") =>
|
|
115
|
-
html`<span class="mk${cls}" role="img" title="${t}" aria-label="${t}"><svg><use href="#${id}"/></svg></span>`;
|
|
116
|
-
if (store.all) {
|
|
117
|
-
const n = c.where.split("/").filter(Boolean).pop() || c.where;
|
|
118
|
-
chips.push(html`<span class="chip proj" title="${c.where}">${n}</span>`);
|
|
119
|
-
}
|
|
120
|
-
for (const t of c.tags || []) {
|
|
121
|
-
if (MARKS[t])
|
|
122
|
-
marks.push(
|
|
123
|
-
mk(
|
|
124
|
-
"c-" + t,
|
|
125
|
-
t === "full" ? "Full run: separate reviewer" : t === "lite" ? "Lite run: one session" : NAMES[t] || t,
|
|
126
|
-
t === "full" || t === "lite" ? " accent" : "",
|
|
127
|
-
),
|
|
128
|
-
);
|
|
129
|
-
else if (t === "yolo")
|
|
130
|
-
marks.push(html`<span class="mk warn" title="Started in Yolo: the agent runs commands without asking">yolo</span>`);
|
|
131
|
-
else chips.push(html`<span class="chip">${NAMES[t] || t}</span>`);
|
|
132
|
-
}
|
|
133
|
-
// Orchestration: only a run that has workers carries them, so any other card is unchanged.
|
|
134
|
-
const wk: { id: string; status: string; bypass: boolean }[] = c.workers || [];
|
|
135
|
-
if (wk.length) chips.push(html`<span class="chip" title="${wk.map((x) => `${x.id} ${x.status}${x.bypass ? " (bypass)" : ""}`).join(", ")}">${wk.length} workers</span>`);
|
|
136
|
-
if (c.land) marks.push(html`<span class="mk bad" title="${c.land.why}">! ${c.land.kind === "conflict" ? "Conflict" : "Land failed"}</span>`);
|
|
137
|
-
if (c.signal === "blocked") marks.push(mk("i-ask", `Waiting on you: ${c.blocked?.question ?? ""}`, " warn ask"));
|
|
138
|
-
else if (c.signal === "stale") marks.push(html`<span class="mk warn" title="The agent has gone quiet: no report and no terminal activity">stale</span>`);
|
|
139
|
-
else if (c.signal === "unverified") marks.push(html`<span class="mk warn" title="The agent ended without finishing this stage properly">unverified</span>`);
|
|
140
|
-
if (c.pty && c.pty.alive && c.pty.asking)
|
|
141
|
-
marks.push(mk("i-ask", "The agent is asking you something: open it, terminal button at the top", " warn ask"));
|
|
142
|
-
else if (c.pty && c.pty.alive)
|
|
143
|
-
marks.push(mk("i-term", "The agent is running in this run's workspace: open it", " run"));
|
|
144
|
-
// A gathered task's notes open with the stamp promote() writes (ingest() wrote it before
|
|
145
|
-
// the icebox); its chip names the source.
|
|
146
|
-
const g = c.notes && /^\[[^\]]*\] (?:Gathered from|Promoted from the icebox:) (.+?)\. Outside text/.exec(c.notes);
|
|
147
|
-
// A card filed by a run names that run; the parent itself shows nothing.
|
|
148
|
-
if (c.parent)
|
|
149
|
-
chips.push(html`<span class="chip link" title="Filed by ${c.parent}">${c.parent.replace(/^\d{4}-\d\d-\d\d-/, "").replace(/-/g, " ")}</span>`);
|
|
150
|
-
if (c.kind === "backlog") {
|
|
151
|
-
if (c.severity)
|
|
152
|
-
chips.push(html`<span class="chip${c.severity === "critical" || c.severity === "high" ? " warn" : ""}"><i></i>${c.severity}</span>`);
|
|
153
|
-
chips.push(
|
|
154
|
-
c.source === "orphan"
|
|
155
|
-
? html`<span class="chip" title="Kept from a pruned run">orphaned</span>`
|
|
156
|
-
: html`<span class="chip link" title="Left by ${c.source}${c.at ? " · " + c.at : ""}">${c.source.replace(/^\d{4}-\d\d-\d\d-/, "").replace(/-/g, " ")}</span>`,
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
if (c.branch) chips.push(html`<span class="chip" title="Built on its own branch, ${c.branch}">branch</span>`);
|
|
160
|
-
if (g) chips.push(html`<span class="chip" title="From ${g[1]}">gathered</span>`);
|
|
161
|
-
else if (c.notes) chips.push(html`<span class="chip">notes</span>`);
|
|
162
|
-
// Information only: the panel's button is where it is committed and pushed.
|
|
163
|
-
if (c.git)
|
|
164
|
-
marks.push(
|
|
165
|
-
mk(
|
|
166
|
-
"c-git",
|
|
167
|
-
c.git === "pushed" ? "Committed & pushed" : "Not committed & pushed yet",
|
|
168
|
-
c.git === "pushed" ? " ok" : " warn",
|
|
169
|
-
),
|
|
170
|
-
);
|
|
171
|
-
if (c.open) marks.push(mk("i-bug", `${c.open} open finding${c.open === 1 ? "" : "s"} to fix`, " warn"));
|
|
172
|
-
const pick = picking && !archive && c.column === 4;
|
|
173
|
-
// Done cards are one line on the board; the panel still shows everything.
|
|
174
|
-
if (c.column === 4 && !archive) el.classList.add("compact");
|
|
175
|
-
// The one thing a card asks of you, on its face: what a waiting run needs, or resuming a stalled one.
|
|
176
|
-
const act =
|
|
177
|
-
c.kind === "run" && !archive && !pick
|
|
178
|
-
? c.status === "waiting"
|
|
179
|
-
? html`<button class="btn sm${decided.has(answer(c)) ? "" : " pri"} act" data-a="open">${actionOf(c)}</button>`
|
|
180
|
-
: c.status === "stalled" && resumable(c)
|
|
181
|
-
? html`<button class="btn sm act" data-a="resume">Resume</button>`
|
|
182
|
-
: ""
|
|
183
|
-
: "";
|
|
184
|
-
el.innerHTML =
|
|
185
|
-
(pick ? html`<input type="checkbox" class="pick" ${raw(picked.has(k) ? "checked" : "")} aria-label="Select">` : "") +
|
|
186
|
-
html`<div class="c-id"><span class="st d-${st}" role="img" title="${sttl}" aria-label="${sttl}"><svg><use href="#s-${st}"/></svg></span><span class="idt"${c.kind === "run" && c.title ? html` title="${c.title}"` : ""}>${idt}</span><span class="age">${c.kind === "run" ? age(c.moved || store.S.now, store.S.now) : ""}</span><button class="ib sm more" data-a="menu" title="Actions" aria-label="Actions" aria-haspopup="menu" aria-expanded="${String(k === store.menuKey)}">${ico("more")}</button></div>
|
|
187
|
-
${c.signal === "blocked" ? html`<div class="c-block">${c.blocked?.question ?? ""}</div>` : c.phase && c.status === "running" ? html`<div class="c-phase">${c.phase}</div>` : ""}<div class="c-title"${c.kind === "idea" && brief(c.text).parts.length ? html` title="${c.text}"` : ""}>${c.kind === "idea" ? brief(c.text).head : c.title || c.id}</div>${wk.length ? html`<div class="c-phase">${wk.map((x) => `${x.id} ${x.status}${x.bypass ? " · bypass" : ""}`).join(" · ")}${c.workersMerge ? ` · merge ${c.workersMerge}` : ""}</div>` : ""}
|
|
188
|
-
${act}
|
|
189
|
-
${chips.length || marks.length ? html`<div class="c-foot"><span class="c-chips">${chips}</span><span class="c-marks">${marks}</span></div>` : ""}`;
|
|
190
|
-
const kids = kidsOf(c);
|
|
191
|
-
if (kids.length) {
|
|
192
|
-
const on = kidsOpen.has(k),
|
|
193
|
-
nDone = kids.filter((x) => x.status === "done").length,
|
|
194
|
-
wait = kids.some((x) => x.status === "waiting");
|
|
195
|
-
const box = document.createElement("div");
|
|
196
|
-
box.className = "kids";
|
|
197
|
-
box.innerHTML =
|
|
198
|
-
html`<button class="kids-t" aria-expanded="${String(on)}">${on ? "▾" : "▸"} ${kids.length} ${kids.length === 1 ? "child" : "children"}${nDone ? ` · ${nDone} done` : ""}${wait ? html`<span class="kids-w" title="A child is waiting on you"></span>` : ""}</button>` +
|
|
199
|
-
(on
|
|
200
|
-
? html`<ul>${kids
|
|
201
|
-
.map((x, i) => {
|
|
202
|
-
const s = ICON[x.status] || "idea";
|
|
203
|
-
return html`<li data-i="${i}" tabindex="0" role="button" title="Open"><span class="st d-${s}"><svg><use href="#s-${s}"/></svg></span><span class="kids-s">${WORD[x.status] || x.status}</span><span class="kids-n" title="${x.title || x.text || x.id}">${x.kind === "idea" ? brief(x.text).head : (x.text || x.id || "").replace(/-/g, " ")}</span></li>`;
|
|
204
|
-
})}</ul>`
|
|
205
|
-
: "");
|
|
206
|
-
box.querySelector(".kids-t").onclick = (e) => {
|
|
207
|
-
e.stopPropagation();
|
|
208
|
-
on ? kidsOpen.delete(k) : kidsOpen.add(k);
|
|
209
|
-
render();
|
|
210
|
-
};
|
|
211
|
-
box.querySelectorAll("li").forEach((li) => {
|
|
212
|
-
const go = (e) => {
|
|
213
|
-
e.stopPropagation();
|
|
214
|
-
open(kids[+li.dataset.i]);
|
|
215
|
-
};
|
|
216
|
-
li.onclick = go;
|
|
217
|
-
li.onkeydown = (e) => (e.key === "Enter" || e.key === " ") && (e.preventDefault(), go(e));
|
|
218
|
-
});
|
|
219
|
-
el.appendChild(box);
|
|
220
|
-
}
|
|
221
|
-
if (k === store.menuKey) {
|
|
222
|
-
const items = [];
|
|
223
|
-
if (archive) {
|
|
224
|
-
items.push(["restore", "Restore", ico("restore")]);
|
|
225
|
-
items.push(["open", "Open", ico("open")]);
|
|
226
|
-
if (c.kind === "idea") items.push(null, ["delete", "Delete", ico("trash"), "danger"]);
|
|
227
|
-
} else if (c.kind === "backlog") {
|
|
228
|
-
items.push(
|
|
229
|
-
["run", c.status === "starting" ? "Run again" : "Run", ico("play")],
|
|
230
|
-
["open", "Open its run", ico("open")],
|
|
231
|
-
null,
|
|
232
|
-
["reject", "Reject", ico("x"), "danger"],
|
|
233
|
-
);
|
|
234
|
-
} else if (c.kind === "idea" && c.status === "idea") {
|
|
235
|
-
items.push(
|
|
236
|
-
["run", "Run", ico("play")],
|
|
237
|
-
["edit", "Edit", ico("pen")],
|
|
238
|
-
...(store.S.projects.some((p) => p.dir !== c.state) ? [["move", "Move to project", ico("ext")]] : []),
|
|
239
|
-
["archive", "Archive", ico("archive")],
|
|
240
|
-
null,
|
|
241
|
-
["reject", "Reject", ico("x")],
|
|
242
|
-
["delete", "Delete", ico("trash"), "danger"],
|
|
243
|
-
);
|
|
244
|
-
} else if (c.kind === "idea") {
|
|
245
|
-
items.push(
|
|
246
|
-
["open", "Open", ico("open")],
|
|
247
|
-
["run", "Run again", ico("play")],
|
|
248
|
-
["archive", "Archive", ico("archive")],
|
|
249
|
-
null,
|
|
250
|
-
["delete", "Remove", ico("trash"), "danger"],
|
|
251
|
-
);
|
|
252
|
-
} else {
|
|
253
|
-
items.push(["open", actionOf(c), ico("open")]);
|
|
254
|
-
items.push(["archive", "Archive", ico("archive")]);
|
|
255
|
-
if (c.column === 1 && c.status !== "abandoned") items.push(["toidea", "Back to task", ico("restore")]);
|
|
256
|
-
}
|
|
257
|
-
el.innerHTML += html`<div class="menu-pop" role="menu">${items.map((i) => (i ? html`<button role="menuitem" data-a="${i[0]}" class="${i[3] || ""}">${i[2]}${i[1]}</button>` : raw("<hr>")))}</div>`;
|
|
258
|
-
}
|
|
259
|
-
el.querySelectorAll("[data-a]").forEach(
|
|
260
|
-
(bt) =>
|
|
261
|
-
(bt.onclick = async (e) => {
|
|
262
|
-
e.stopPropagation();
|
|
263
|
-
const a = bt.dataset.a;
|
|
264
|
-
const was = store.menuKey;
|
|
265
|
-
store.menuKey = null;
|
|
266
|
-
if (a === "menu") {
|
|
267
|
-
store.menuKey = was === k ? null : k;
|
|
268
|
-
render();
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
if (a === "open") {
|
|
272
|
-
show(c);
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
if (a === "resume") {
|
|
276
|
-
resume(c, bt);
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
if (a === "archive" || a === "restore") {
|
|
280
|
-
toggleArchive(c, a === "archive");
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
if (a === "toidea") {
|
|
284
|
-
const r = await post("/to-task", { dir: c.state, id: c.id });
|
|
285
|
-
if (r.ok) toast("Back in Tasks");
|
|
286
|
-
load();
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
store.mode = a;
|
|
290
|
-
store.modeKey = k;
|
|
291
|
-
render();
|
|
292
|
-
}),
|
|
293
|
-
);
|
|
294
|
-
if (pick) {
|
|
295
|
-
el.classList.toggle("picked", picked.has(k));
|
|
296
|
-
el.onclick = () => {
|
|
297
|
-
picked.has(k) ? picked.delete(k) : picked.add(k);
|
|
298
|
-
render();
|
|
299
|
-
};
|
|
300
|
-
return el;
|
|
301
|
-
}
|
|
302
|
-
el.onclick = () => {
|
|
303
|
-
if (store.menuKey) {
|
|
304
|
-
store.menuKey = null;
|
|
305
|
-
render();
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
show(c);
|
|
309
|
-
};
|
|
310
|
-
el.onkeydown = (e) => {
|
|
311
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
312
|
-
e.preventDefault();
|
|
313
|
-
show(c);
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
return el;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// Edit, Abandon or Reject over the page it was asked from: a workspace never leaves for the Board.
|
|
320
|
-
export function formPopup(c, mode) {
|
|
321
|
-
const dl = modal(""),
|
|
322
|
-
f = dl.querySelector("form");
|
|
323
|
-
f.onsubmit = (e) => e.preventDefault();
|
|
324
|
-
dl.classList.toggle("sheet", isPhone());
|
|
325
|
-
dl.addEventListener("close", () => stopDictation(false));
|
|
326
|
-
const [m, k] = [store.mode, store.modeKey];
|
|
327
|
-
store.mode = mode;
|
|
328
|
-
store.modeKey = key(c);
|
|
329
|
-
const li = inlineForm(c);
|
|
330
|
-
[store.mode, store.modeKey] = [m, k]; // the form is built; the Board draws none of its own
|
|
331
|
-
li.className = "";
|
|
332
|
-
li.style.display = "block";
|
|
333
|
-
li.querySelectorAll<HTMLButtonElement>("button:not([type])").forEach((b) => (b.type = "button"));
|
|
334
|
-
f.append(li);
|
|
335
|
-
li.querySelector<HTMLElement>("input,textarea")?.focus();
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function inlineForm(c) {
|
|
339
|
-
const li = document.createElement("li");
|
|
340
|
-
const done = () => li.closest("dialog")?.close();
|
|
341
|
-
li.className = "inl";
|
|
342
|
-
const dir = c.state;
|
|
343
|
-
if (store.mode === "edit") {
|
|
344
|
-
if (editFiles.k !== key(c)) editFiles = { k: key(c), files: [] };
|
|
345
|
-
const files = editFiles.files;
|
|
346
|
-
li.innerHTML = html`<input value="${c.text}"><textarea placeholder="Anything the planner should know">${c.notes || ""}</textarea><div class="row"><div class="att" id="editatt"></div><button type="button" class="ib" id="editpick" aria-label="Attach files" title="Attach files">${ico("clip")}</button></div><input type="file" id="editfile" multiple hidden><div class="q dim" id="clong" hidden>The first line is over 72 characters; logs will cut it short.</div><div class="row"><button class="btn ghost" data-a="c">Cancel</button><button class="btn pri" data-a="s">Save</button></div>`;
|
|
347
|
-
const shown = () => (li.querySelector("#editatt").textContent = files.map((f) => f.name).join(" · "));
|
|
348
|
-
const add = (f) => { files.push(f); shown(); };
|
|
349
|
-
shown();
|
|
350
|
-
li.querySelector("#editpick").onclick = () => li.querySelector("#editfile").click();
|
|
351
|
-
li.querySelector("#editfile").onchange = (e) => {
|
|
352
|
-
[...e.target.files].forEach(add);
|
|
353
|
-
e.target.value = "";
|
|
354
|
-
};
|
|
355
|
-
for (const el of [li.querySelector("input"), li.querySelector("textarea")])
|
|
356
|
-
el.onpaste = (e) => {
|
|
357
|
-
for (const it of e.clipboardData.items)
|
|
358
|
-
if (it.kind === "file") {
|
|
359
|
-
const f = it.getAsFile();
|
|
360
|
-
add(new File([f], f.name === "image.png" ? `paste-${Date.now()}.png` : f.name, { type: f.type }));
|
|
361
|
-
e.preventDefault();
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
li.querySelector("[data-a=s]").onclick = async () => {
|
|
365
|
-
const next = li.querySelector("input").value.trim(),
|
|
366
|
-
notes = li.querySelector("textarea").value.trim();
|
|
367
|
-
if (!next) return;
|
|
368
|
-
if (next !== c.text || notes !== (c.notes || "")) {
|
|
369
|
-
const r = await post("/inbox", { op: "edit", dir, text: c.text, next, notes });
|
|
370
|
-
if (!r.ok) return;
|
|
371
|
-
}
|
|
372
|
-
if (files.length) {
|
|
373
|
-
const r = await post("/note", { dir, for: next, text: "", files: await dataUrls(files) });
|
|
374
|
-
if (!r.ok) toast("Task saved, files not attached");
|
|
375
|
-
}
|
|
376
|
-
editFiles = { k: "", files: [] };
|
|
377
|
-
store.mode = null;
|
|
378
|
-
done();
|
|
379
|
-
load();
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
if (store.mode === "reject") {
|
|
383
|
-
const task = c.kind !== "run";
|
|
384
|
-
li.innerHTML = html`<div class="q">${c.kind === "backlog" ? "Not doing this backlog item?" : task ? "Reject this task?" : "Abandon this run?"} The reason is recorded.</div><input placeholder="Why not?"><div class="row"><button class="btn ghost" data-a="c">Keep it</button><button class="btn warn" data-a="s">${task ? "Reject" : "Abandon"}</button></div>`;
|
|
385
|
-
li.querySelector("[data-a=s]").onclick = async () => {
|
|
386
|
-
const why = li.querySelector("input").value.trim();
|
|
387
|
-
if (!why) {
|
|
388
|
-
toast("A reason is required");
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
store.mode = null;
|
|
392
|
-
done();
|
|
393
|
-
const r =
|
|
394
|
-
c.kind === "backlog"
|
|
395
|
-
? await post("/backlog", { op: "reject", dir, source: c.source, n: c.n, reason: why })
|
|
396
|
-
: task
|
|
397
|
-
? await post("/inbox", { op: "reject", dir, text: c.text, reason: why })
|
|
398
|
-
: await post("/abort", { dir, id: c.id, why });
|
|
399
|
-
if (r.ok) toast(task ? "Rejected" : "Abandoned, reason recorded");
|
|
400
|
-
load();
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
if (store.mode === "delete") {
|
|
404
|
-
li.innerHTML = html`<div class="q">Delete "${c.text}"?</div><div class="q dim">Not recorded anywhere.</div><div class="row"><button class="btn ghost" data-a="c">Keep it</button><button class="btn danger" data-a="s">Delete</button></div>`;
|
|
405
|
-
li.querySelector("[data-a=s]").onclick = async () => {
|
|
406
|
-
store.mode = null;
|
|
407
|
-
const r = await post("/inbox", { op: "delete", dir, text: c.text });
|
|
408
|
-
if (r.ok) toast("Deleted");
|
|
409
|
-
load();
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
if (store.mode === "move") {
|
|
413
|
-
const ps = store.S.projects.filter((p) => p.dir !== dir);
|
|
414
|
-
li.innerHTML = html`<div class="q">Move "${c.text}" to</div><select class="sel" aria-label="Project">${ps.map((p) => html`<option value="${p.dir}" title="${p.label}">${short(p.label)}</option>`)}</select><div class="row"><button class="btn ghost" data-a="c">Cancel</button><button class="btn pri" data-a="s">Move</button></div>`;
|
|
415
|
-
li.querySelector("[data-a=s]").onclick = async () => {
|
|
416
|
-
const sel = li.querySelector("select"),
|
|
417
|
-
to = sel.value,
|
|
418
|
-
name = sel.selectedOptions[0]?.textContent;
|
|
419
|
-
store.mode = null;
|
|
420
|
-
const r = await post("/inbox", { op: "move", dir, to, text: c.text });
|
|
421
|
-
if (r.ok) toast(`Moved to ${name}`);
|
|
422
|
-
load();
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
if (store.mode === "run") {
|
|
426
|
-
li.innerHTML = runHtml(c);
|
|
427
|
-
li.querySelector("[data-a=s]").onclick = () => startRun(c, "full");
|
|
428
|
-
li.querySelector("[data-a=l]").onclick = () => startRun(c, "lite");
|
|
429
|
-
runForm(li, c);
|
|
430
|
-
}
|
|
431
|
-
li.querySelector("[data-a=c]").onclick = () => {
|
|
432
|
-
if (store.mode === "edit") editFiles = { k: "", files: [] };
|
|
433
|
-
store.mode = null;
|
|
434
|
-
done();
|
|
435
|
-
render();
|
|
436
|
-
};
|
|
437
|
-
// Edit and reject take dictation; the run prompt has no field.
|
|
438
|
-
li.querySelectorAll("input:not([type=file]),textarea").forEach((f, i) => draft(f, "f:" + store.mode + ":" + store.modeKey + ":" + i));
|
|
439
|
-
if (store.mode !== "run") {
|
|
440
|
-
const m = mic([...li.querySelectorAll("input:not([type=file]),textarea")]);
|
|
441
|
-
if (m) li.querySelector(".row").prepend(m);
|
|
442
|
-
}
|
|
443
|
-
const inp = li.querySelector("input");
|
|
444
|
-
if (inp) {
|
|
445
|
-
inp.onkeydown = (e) => {
|
|
446
|
-
if (e.key === "Enter") li.querySelector("[data-a=s]").click();
|
|
447
|
-
if (e.key === "Escape") {
|
|
448
|
-
store.mode = null;
|
|
449
|
-
render();
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
setTimeout(() => inp.focus());
|
|
453
|
-
}
|
|
454
|
-
return li;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
const runHtml = (c) =>
|
|
458
|
-
html`<div class="q">Run "${c.text}"</div><div class="q dim">Opens your agent with this request in a terminal.</div><div class="q dim">Full plans, builds, and checks with a separate reviewer. Lite does it in one session.</div><div id="run-pick" style="display:grid;gap:6px"><div id="run-agent" class="agents" role="radiogroup" aria-label="Agent"></div></div><label class="yolo"><input type="checkbox" id="run-explore"> Explore first</label><div class="run-actions"><label class="yolo" id="run-yolo" title="Yolo: the agent runs every command and edit without asking" hidden>${toggleSwitch(false)}Yolo</label><div class="row"><button type="button" class="btn ghost" data-a="c">Cancel</button><button type="button" class="btn" data-a="l">Lite</button><button type="button" class="btn pri" data-a="s">Full run</button></div></div>`;
|
|
459
|
-
// The run form as a popup over any page: Start in the new-task form and on Tasks.
|
|
460
|
-
export function runPopup(c, onStart?: (p: { kind: string; agent?: string; account?: string; yolo: boolean; explore?: boolean }) => void) {
|
|
461
|
-
const dl = modal(runHtml(c)),
|
|
462
|
-
f = dl.querySelector("form");
|
|
463
|
-
dl.classList.toggle("sheet", isPhone());
|
|
464
|
-
const go = (kind) => {
|
|
465
|
-
if (onStart) {
|
|
466
|
-
const p = runPick && runPick.k === key(c) ? runPick : null;
|
|
467
|
-
onStart({ kind, agent: p?.agent, account: p?.account, yolo: !!(p?.yolo && !$("run-yolo")?.hidden), explore: p?.exploreOverride });
|
|
468
|
-
runPick = null;
|
|
469
|
-
return dl.close();
|
|
470
|
-
}
|
|
471
|
-
// startRun reads the Yolo switch, so the dialog closes after it has.
|
|
472
|
-
void startRun(c, kind);
|
|
473
|
-
dl.close();
|
|
474
|
-
};
|
|
475
|
-
f.querySelector<HTMLElement>("[data-a=s]").onclick = () => go("full");
|
|
476
|
-
f.querySelector<HTMLElement>("[data-a=l]").onclick = () => go("lite");
|
|
477
|
-
f.querySelector<HTMLElement>("[data-a=c]").onclick = () => dl.close();
|
|
478
|
-
runForm(f, c);
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
let editFiles = { k: "", files: [] };
|
|
482
|
-
// The agent and Basic/Yolo picked in the open Run form. Kept here, not in the form:
|
|
483
|
-
// the board is rebuilt on every server change, and the choice must outlive that.
|
|
484
|
-
// Yolo never outlives the form: render() drops it once the form is closed.
|
|
485
|
-
let runPick = null;
|
|
486
|
-
// The tool a launch opened, and why when it is not the one asked for.
|
|
487
|
-
export const via = (a) => a.name + (a.note ? ". " + a.note : "");
|
|
488
|
-
async function runForm(li, c) {
|
|
489
|
-
const k = key(c),
|
|
490
|
-
box = li.querySelector("#run-agent");
|
|
491
|
-
const d = await fetch("/agents?dir=" + encodeURIComponent(c.state))
|
|
492
|
-
.then((r) => r.json())
|
|
493
|
-
.catch(() => null);
|
|
494
|
-
if (!d || !d.agents || !d.agents.length) {
|
|
495
|
-
li.querySelector("#run-pick").hidden = true;
|
|
496
|
-
return;
|
|
497
|
-
}
|
|
498
|
-
// Antigravity and Gemini CLI are both Google's agent on Gemini; offer one of them.
|
|
499
|
-
if (d.agents.some((a) => a.cmd === "agy")) d.agents = d.agents.filter((a) => a.cmd !== "gemini");
|
|
500
|
-
if (!runPick || runPick.k !== k)
|
|
501
|
-
runPick = { k, explore: d.explore === true, agent: d.agents.some((a) => a.cmd === d.default) ? d.default : d.agents[0].cmd };
|
|
502
|
-
box.innerHTML = d.agents
|
|
503
|
-
.map(
|
|
504
|
-
(a) =>
|
|
505
|
-
html`<button type="button" class="agent" role="radio" aria-checked="${String(a.cmd === runPick.agent)}" data-cmd="${a.cmd}"><svg><use href="#c-${a.cmd}"/></svg>${a.name}</button>`,
|
|
506
|
-
)
|
|
507
|
-
.join("");
|
|
508
|
-
// The picked tool's accounts, when it has any: its default first chosen, the normal login beside it.
|
|
509
|
-
const showAccounts = () => {
|
|
510
|
-
li.querySelector("#run-acct")?.remove();
|
|
511
|
-
const a = d.agents.find((x) => x.cmd === runPick.agent);
|
|
512
|
-
runPick.account = undefined;
|
|
513
|
-
if (!a?.accounts?.length) return;
|
|
514
|
-
const sel = document.createElement("select");
|
|
515
|
-
sel.id = "run-acct";
|
|
516
|
-
sel.className = "sel";
|
|
517
|
-
sel.setAttribute("aria-label", "Account");
|
|
518
|
-
sel.innerHTML = html`<option value="">Normal login</option>${a.accounts.map((x) => html`<option value="${x.id}">${x.name}</option>`)}`.s;
|
|
519
|
-
sel.value = a.defaultAccount ?? "";
|
|
520
|
-
runPick.account = sel.value;
|
|
521
|
-
sel.onchange = () => (runPick.account = sel.value);
|
|
522
|
-
box.after(sel);
|
|
523
|
-
};
|
|
524
|
-
showAccounts();
|
|
525
|
-
const ex = li.querySelector("#run-explore");
|
|
526
|
-
ex.checked = runPick.explore;
|
|
527
|
-
ex.onchange = () => {
|
|
528
|
-
runPick.explore = ex.checked;
|
|
529
|
-
runPick.exploreOverride = ex.checked;
|
|
530
|
-
};
|
|
531
|
-
const yb = li.querySelector("#run-yolo");
|
|
532
|
-
// Yolo only where the picked tool has a skip-permissions mode; Basic otherwise.
|
|
533
|
-
const sw = yb.querySelector(".chk");
|
|
534
|
-
const showYolo = () => {
|
|
535
|
-
const can = !!d.agents.find((a) => a.cmd === runPick.agent)?.yolo,
|
|
536
|
-
on = !!runPick.yolo;
|
|
537
|
-
yb.hidden = !can;
|
|
538
|
-
sw.classList.toggle("on", on);
|
|
539
|
-
sw.setAttribute("aria-checked", on);
|
|
540
|
-
};
|
|
541
|
-
box.querySelectorAll(".agent").forEach(
|
|
542
|
-
(b) =>
|
|
543
|
-
(b.onclick = () => {
|
|
544
|
-
runPick.agent = b.dataset.cmd;
|
|
545
|
-
box.querySelectorAll(".agent").forEach((x) => x.setAttribute("aria-checked", x === b));
|
|
546
|
-
showYolo();
|
|
547
|
-
}),
|
|
548
|
-
);
|
|
549
|
-
sw.onclick = () => {
|
|
550
|
-
runPick.yolo = !runPick.yolo;
|
|
551
|
-
showYolo();
|
|
552
|
-
};
|
|
553
|
-
showYolo();
|
|
554
|
-
box.onkeydown = sw.onkeydown = (e) => {
|
|
555
|
-
if (e.key === "Escape") {
|
|
556
|
-
store.mode = null;
|
|
557
|
-
render();
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
async function startRun(c, kind) {
|
|
563
|
-
store.mode = null;
|
|
564
|
-
askNotify();
|
|
565
|
-
const p = runPick && runPick.k === key(c) ? runPick : null;
|
|
566
|
-
runPick = null;
|
|
567
|
-
const yolo = !!(p && p.yolo && !$("run-yolo")?.hidden);
|
|
568
|
-
const backlog = c.kind === "backlog" ? { source: c.source, n: c.n } : undefined;
|
|
569
|
-
const r = await post("/run", { dir: c.state, text: c.text, backlog, kind, agent: p ? p.agent : undefined, account: p?.account, explore: p?.exploreOverride, yolo });
|
|
570
|
-
if (r.ok) {
|
|
571
|
-
toast((kind === "full" ? "Full" : kind === "lite" ? "Lite" : "Started") + (yolo ? " yolo" : "") + " run " + where(r) + ": " + via(r.agent));
|
|
572
|
-
// A backlog card has no terminal of its own; the run's card gets it once the run exists.
|
|
573
|
-
if (r.pty && !backlog) (store.wantTerm = key(c)), (store.wantPty = { key: r.pty, at: Date.now() });
|
|
574
|
-
// A task's run opens in its workspace; the view follows it once the run card exists.
|
|
575
|
-
if (!backlog) openWorkspace(c);
|
|
576
|
-
}
|
|
577
|
-
load();
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
const HINT = { 0: "Add a task to start a run", 1: "Tasks you run are planned here", 2: "Approved plans are built here", 3: "Finished builds are checked here" };
|
|
581
|
-
|
|
582
|
-
// Files picked in the new-task form. Held here, not in the form, because the board
|
|
583
|
-
// redraws the inline form on every change and a redraw would drop them.
|
|
584
|
-
let newFiles = [];
|
|
585
|
-
// The new-task form, wired into f: inline at the top of Tasks, or in a modal.
|
|
586
|
-
// Opened from another page (Tasks, a workspace, the side menu): always the project picker,
|
|
587
|
-
// preset to that page's project or empty so one is chosen. The Board keeps its own rule.
|
|
588
|
-
let formPick: { dir: string | null } | null = null;
|
|
589
|
-
function taskForm(f, shut) {
|
|
590
|
-
// A phone has no project picker in its header: the form is the only place to choose.
|
|
591
|
-
const picking = store.all || !!formPick || isPhone();
|
|
592
|
-
const close = () => {
|
|
593
|
-
newFiles = [];
|
|
594
|
-
shut();
|
|
595
|
-
};
|
|
596
|
-
f.innerHTML = html`<div class="nt-head"><h2>New task</h2>${picking ? html`<div class="combo" id="ndc"><button type="button" class="sel" id="newdir" aria-label="Project for this task" aria-haspopup="listbox" aria-expanded="false"></button><div class="menu-pop" hidden><input class="sel" aria-label="Search projects" placeholder="Search projects…" spellcheck="false" autocomplete="off"><div id="nds" role="listbox"></div></div></div>` : ""}</div><input id="newidea" placeholder="What do you want to build?"><label for="newnotes">Anything the planner should know <span class="dim">(optional)</span></label><textarea id="newnotes" placeholder="Context, constraints, examples, and what a good result looks like"></textarea><div class="att" id="newatt"></div><input type="file" id="newfile" multiple hidden><div class="row"><button type="button" class="ib" id="newpick" aria-label="Attach files" title="Attach files">${ico("clip")}</button><button type="button" class="btn ghost" id="nc">Cancel</button><div class="split"><button type="button" class="btn pri" id="ns">Add</button><button type="button" class="btn pri" id="nm" aria-label="More ways to add" aria-haspopup="menu" aria-expanded="false">${ico("chev")}</button><div class="menu-pop" role="menu" hidden><button type="button" role="menuitem" id="nr" title="Add the task and run it now">${ico("play")}Start run</button></div></div></div>`;
|
|
597
|
-
const inp = f.querySelector("#newidea"),
|
|
598
|
-
files = newFiles;
|
|
599
|
-
draft(inp, "f:new:0");
|
|
600
|
-
draft(f.querySelector("textarea"), "f:new:1");
|
|
601
|
-
// run: add the task, then launch it at once with the project's runner and agent.
|
|
602
|
-
const save = async (run) => {
|
|
603
|
-
const text = inp.value.trim();
|
|
604
|
-
if (!text) return;
|
|
605
|
-
const notes = f.querySelector("textarea").value.trim();
|
|
606
|
-
const dir = picking ? newDir : null;
|
|
607
|
-
if (picking && !dir) {
|
|
608
|
-
toast("Choose a project for this task");
|
|
609
|
-
f.querySelector<HTMLElement>("#newdir")?.click();
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
close();
|
|
613
|
-
const r = await post("/inbox", dir ? { op: "add", dir, text, notes } : { op: "add", text, notes });
|
|
614
|
-
if (r.ok) {
|
|
615
|
-
toast("Task added");
|
|
616
|
-
// The task exists first: a failed upload leaves it as plain text.
|
|
617
|
-
if (files.length) {
|
|
618
|
-
const enc = await dataUrls(files);
|
|
619
|
-
const n = await post("/note", { dir, for: text, text: "", files: enc });
|
|
620
|
-
if (!n.ok) toast("Task added, files not attached");
|
|
621
|
-
}
|
|
622
|
-
if (run) {
|
|
623
|
-
await load();
|
|
624
|
-
const c = store.S.cards.find((x) => x.kind === "idea" && x.text === text && (!dir || x.state === dir));
|
|
625
|
-
if (c) return runPopup(c);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
load();
|
|
629
|
-
};
|
|
630
|
-
const shown = () => (f.querySelector("#newatt").textContent = files.map((y) => y.name).join(" · "));
|
|
631
|
-
const add = (x) => {
|
|
632
|
-
files.push(x);
|
|
633
|
-
shown();
|
|
634
|
-
};
|
|
635
|
-
shown();
|
|
636
|
-
f.querySelector("#newpick").onclick = () => f.querySelector("#newfile").click();
|
|
637
|
-
f.querySelector("#newfile").onchange = (e) => {
|
|
638
|
-
[...e.target.files].forEach(add);
|
|
639
|
-
e.target.value = "";
|
|
640
|
-
};
|
|
641
|
-
for (const el of [inp, f.querySelector("textarea")])
|
|
642
|
-
el.onpaste = (e) => {
|
|
643
|
-
for (const it of e.clipboardData.items)
|
|
644
|
-
if (it.kind === "file") {
|
|
645
|
-
const x = it.getAsFile();
|
|
646
|
-
add(new File([x], x.name === "image.png" ? `paste-${Date.now()}.png` : x.name, { type: x.type }));
|
|
647
|
-
e.preventDefault();
|
|
648
|
-
}
|
|
649
|
-
};
|
|
650
|
-
if (picking) {
|
|
651
|
-
if (formPick) setNewDir(formPick.dir);
|
|
652
|
-
// From another page a choice is always required: a preset project the picker does not offer is not swapped for another.
|
|
653
|
-
taskCombo(f, !!formPick);
|
|
654
|
-
}
|
|
655
|
-
f.querySelector("#ns").onclick = () => save(false);
|
|
656
|
-
f.querySelector("#nr").onclick = () => save(true);
|
|
657
|
-
{
|
|
658
|
-
const mb = f.querySelector("#nm"),
|
|
659
|
-
menu = f.querySelector(".split .menu-pop");
|
|
660
|
-
// Focus moves into the menu only when it was opened from the keyboard.
|
|
661
|
-
const show = (on, kbd) => {
|
|
662
|
-
menu.hidden = !on;
|
|
663
|
-
mb.setAttribute("aria-expanded", String(on));
|
|
664
|
-
if (on && kbd) setTimeout(() => menu.querySelector("button").focus());
|
|
665
|
-
};
|
|
666
|
-
mb.onclick = (e) => {
|
|
667
|
-
e.stopPropagation();
|
|
668
|
-
show(menu.hidden, e.detail === 0);
|
|
669
|
-
};
|
|
670
|
-
menu.onkeydown = (e) => {
|
|
671
|
-
if (e.key === "Escape") {
|
|
672
|
-
e.preventDefault();
|
|
673
|
-
e.stopPropagation();
|
|
674
|
-
show(false);
|
|
675
|
-
mb.focus();
|
|
676
|
-
}
|
|
677
|
-
};
|
|
678
|
-
f.addEventListener("click", (e) => {
|
|
679
|
-
if (!menu.hidden && !e.target.closest(".split")) show(false);
|
|
680
|
-
});
|
|
681
|
-
const sp = f.querySelector(".split");
|
|
682
|
-
sp.addEventListener("focusout", (e) => {
|
|
683
|
-
if (!sp.contains(e.relatedTarget)) show(false);
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
f.querySelector("#nc").onclick = close;
|
|
687
|
-
{
|
|
688
|
-
const m = mic([inp, f.querySelector("textarea")]);
|
|
689
|
-
if (m) f.querySelector(".row").prepend(m);
|
|
690
|
-
}
|
|
691
|
-
inp.onkeydown = (e) => {
|
|
692
|
-
if (e.key === "Enter") {
|
|
693
|
-
e.preventDefault();
|
|
694
|
-
save(false);
|
|
695
|
-
}
|
|
696
|
-
if (e.key === "Escape") {
|
|
697
|
-
e.preventDefault();
|
|
698
|
-
close();
|
|
699
|
-
}
|
|
700
|
-
};
|
|
701
|
-
setTimeout(() => inp.focus());
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
// New task from the top bar, the empty board or n: the same form, in a modal.
|
|
705
|
-
export function newTask(from?: { dir: string | null }) {
|
|
706
|
-
const taskDir = from && "dir" in from ? from.dir : !store.all ? store.S.dir : null;
|
|
707
|
-
if (!dispatchEvent(new CustomEvent("kz-new-task", { cancelable: true, detail: { dir: taskDir } }))) return;
|
|
708
|
-
// The header button passes its click event: only an explicit { dir } is another page's call.
|
|
709
|
-
formPick = from && "dir" in from ? from : null;
|
|
710
|
-
if (store.mode === "new") {
|
|
711
|
-
store.mode = null;
|
|
712
|
-
render();
|
|
713
|
-
}
|
|
714
|
-
newFiles = [];
|
|
715
|
-
const dl = modal("");
|
|
716
|
-
const f = dl.querySelector("form");
|
|
717
|
-
f.onsubmit = (e) => e.preventDefault();
|
|
718
|
-
dl.addEventListener("close", () => stopDictation(false));
|
|
719
|
-
taskForm(f, () => dl.close());
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
export function render() {
|
|
723
|
-
// A closed form leaves no draft behind; an open one is reopened after a reload.
|
|
724
|
-
// A form whose card is gone (restored after a reload, or deleted elsewhere) has nowhere to show.
|
|
725
|
-
if (store.mode && store.mode !== "new" && ![...store.S.cards, ...backlogList()].some((c) => key(c) === store.modeKey))
|
|
726
|
-
store.mode = null;
|
|
727
|
-
if (store.mode !== "run" && runPick) runPick.yolo = false;
|
|
728
|
-
if (store.mode !== "edit") editFiles = { k: "", files: [] };
|
|
729
|
-
if (!store.mode) undraft("f:");
|
|
730
|
-
// Reassigned, not emptied: a form still open (the modal) keeps its own array.
|
|
731
|
-
if (store.mode !== "new") newFiles = [];
|
|
732
|
-
try {
|
|
733
|
-
sessionStorage.setItem(
|
|
734
|
-
"kz-form",
|
|
735
|
-
JSON.stringify(["new", "edit", "reject"].includes(store.mode) ? [store.mode, store.modeKey] : null),
|
|
736
|
-
);
|
|
737
|
-
} catch (e) {}
|
|
738
|
-
// The board is rebuilt below; the card that had focus gets it back.
|
|
739
|
-
const fk = focusedKey();
|
|
740
|
-
// All projects: only the ones ticked in the filter, or every one when none is.
|
|
741
|
-
const only = store.all && store.shown.size && showable().some((p) => store.shown.has(p.dir));
|
|
742
|
-
syncMode();
|
|
743
|
-
const cs = store.S.cards.filter((c) => c.archived === archive && (!only || store.shown.has(c.state))),
|
|
744
|
-
b = $("board");
|
|
745
|
-
b.innerHTML = "";
|
|
746
|
-
b.removeAttribute("aria-busy");
|
|
747
|
-
const nArch = store.S.cards.filter((c) => c.archived).length;
|
|
748
|
-
const n = (s) => cs.filter((c) => c.status === s).length;
|
|
749
|
-
const strip = [];
|
|
750
|
-
// One chip per status on the board: its mark, its count, and a click filters to it. Running always shows.
|
|
751
|
-
for (const st of ["waiting", "running", "stalled", "starting", "idea", "done", "abandoned"]) {
|
|
752
|
-
const k = n(st);
|
|
753
|
-
if (!k && st !== "running") continue;
|
|
754
|
-
const mark =
|
|
755
|
-
st === "running"
|
|
756
|
-
? `<span class="d-run"><span class="pulse"></span></span>`
|
|
757
|
-
: `<span class="st d-${ICON[st]}"><svg><use href="#s-${ICON[st]}"/></svg></span>`;
|
|
758
|
-
strip.push(
|
|
759
|
-
`<button class="${st === "waiting" ? "attn " : ""}${filter === st ? "on" : ""}" data-f="${st}" title="Show only ${WORD[st]}">${mark}${k} ${WORD[st]}${st === "idea" && k !== 1 ? "s" : ""}</button>`,
|
|
760
|
-
);
|
|
761
|
-
}
|
|
762
|
-
strip.push(
|
|
763
|
-
`<button class="${archive ? "on" : ""}" data-f="__archive" title="${cs.filter((c) => c.kind === "idea").length} tasks · ${cs.filter((c) => c.kind === "run").length} runs on the board">${archive ? "Back to board" : "Archive " + nArch}</button>`,
|
|
764
|
-
);
|
|
765
|
-
$("strip").innerHTML = strip.join("");
|
|
766
|
-
// The phone's status button: amber dot while a run waits, accent while a filter or the archive is on.
|
|
767
|
-
$("fbtn").hidden = false;
|
|
768
|
-
$("fbtn").classList.toggle("on", !!filter || archive);
|
|
769
|
-
$("fbtn").classList.toggle("wait", !filter && !archive && n("waiting") > 0);
|
|
770
|
-
$("strip")
|
|
771
|
-
.querySelectorAll("button")
|
|
772
|
-
.forEach(
|
|
773
|
-
(c) =>
|
|
774
|
-
(c.onclick = () => {
|
|
775
|
-
if (c.dataset.f === "__archive") {
|
|
776
|
-
archive = !archive;
|
|
777
|
-
filter = null;
|
|
778
|
-
render();
|
|
779
|
-
return;
|
|
780
|
-
}
|
|
781
|
-
filter = filter === c.dataset.f ? null : c.dataset.f;
|
|
782
|
-
render();
|
|
783
|
-
}),
|
|
784
|
-
);
|
|
785
|
-
// [label, folder, from the projects folder]: the button names the current one, the open list is redrawn.
|
|
786
|
-
store.PL = [
|
|
787
|
-
["All projects", "all"],
|
|
788
|
-
...store.S.projects.map((p) => [p.label, p.dir]),
|
|
789
|
-
...store.S.fresh.map((p) => [p.label, p.dir, 1]),
|
|
790
|
-
["New project…", "__new"],
|
|
791
|
-
["Find projects on this PC…", "__find"],
|
|
792
|
-
["Clone from GitHub…", "__clone"],
|
|
793
|
-
];
|
|
794
|
-
const cur = store.all || !store.S.dir ? "All projects" : (store.PL.find((p) => p[1] === store.S.dir) || ["All projects"])[0];
|
|
795
|
-
$("proj").innerHTML =
|
|
796
|
-
store.all || !store.S.dir
|
|
797
|
-
? html`<span class="plogo" aria-hidden="true">${ico("board")}</span><span>${cur}</span>`
|
|
798
|
-
: html`${plogo(store.S.dir, cur)}<span>${short(cur)}</span>`;
|
|
799
|
-
$("proj").title = cur;
|
|
800
|
-
if (!$("projpop").hidden) list();
|
|
801
|
-
$("showc").hidden = !store.all;
|
|
802
|
-
const sp = showable(),
|
|
803
|
-
ns = sp.filter((p) => store.shown.has(p.dir)).length;
|
|
804
|
-
$("show").textContent = ns ? `Showing ${ns} of ${sp.length}` : "Showing all";
|
|
805
|
-
if (!$("showpop").hidden) showList();
|
|
806
|
-
// Workspaces mode: the same page, a different body.
|
|
807
|
-
const wsm = boardMode() === "ws";
|
|
808
|
-
if (wsm) drawWsBoard((dir) => (!only || store.shown.has(dir)) && (store.all || !store.S.dir || dir === store.S.dir));
|
|
809
|
-
if (!wsm && !cs.length && store.mode !== "new") {
|
|
810
|
-
b.innerHTML = archive
|
|
811
|
-
? '<div class="empty"><div class="mascot"></div><b>Nothing archived</b></div>'
|
|
812
|
-
: '<div class="empty"><div class="mascot"></div><b>Nothing here yet</b><p>Add a task and kaizen will plan it, build it, and check the result.</p><button class="btn pri" id="newempty">New task</button></div>';
|
|
813
|
-
if (!archive)
|
|
814
|
-
$("newempty").onclick = newTask;
|
|
815
|
-
}
|
|
816
|
-
(wsm ? [] : COLS).forEach((name, ci) => {
|
|
817
|
-
const s = document.createElement("section");
|
|
818
|
-
const q = query.trim().toLowerCase();
|
|
819
|
-
const bl = ci === 0 && !archive && tasksTab === "backlog";
|
|
820
|
-
const all = bl ? backlogList().filter((c) => !only || store.shown.has(c.state)) : cs;
|
|
821
|
-
const list = all.filter(
|
|
822
|
-
(c) =>
|
|
823
|
-
c.column === ci &&
|
|
824
|
-
(!bl || !sev || SEVS.find((x) => x[0] === sev)[2](c.severity)) &&
|
|
825
|
-
(!filter || c.status === filter) &&
|
|
826
|
-
(archive || !nested(c)) &&
|
|
827
|
-
(!q || `${c.title || ""} ${c.text || ""} ${c.id || ""}`.toLowerCase().includes(q)),
|
|
828
|
-
);
|
|
829
|
-
// Runs age by their last move, tasks by when they were added, across every project;
|
|
830
|
-
// a task from before the stamp falls back to its inbox position.
|
|
831
|
-
if (ci < 4 && !bl) {
|
|
832
|
-
const at = (c) => (c.kind === "run" ? c.moved || 0 : c.added || 0),
|
|
833
|
-
old = order[ci] === "old",
|
|
834
|
-
pos = (c) => store.S.cards.indexOf(c);
|
|
835
|
-
// Runs waiting on you go first, then the column's own order.
|
|
836
|
-
const w = (c) => (c.status === "waiting" ? 1 : 0);
|
|
837
|
-
list.sort((a, b) => w(b) - w(a) || (old ? at(a) - at(b) || pos(a) - pos(b) : at(b) - at(a) || pos(b) - pos(a)));
|
|
838
|
-
}
|
|
839
|
-
const clearable = ci === 4 && !archive && list.length;
|
|
840
|
-
const olderThan = (days) => list.filter((c) => store.S.now - (c.moved || store.S.now) > days * d);
|
|
841
|
-
// The Tasks column is titled by its two tabs, icons without counts: tasks, or the
|
|
842
|
-
// runs' leftovers. On Backlog a filter icon narrows it to one severity.
|
|
843
|
-
const tabbed = ci === 0 && !archive,
|
|
844
|
-
nb = tabbed ? backlogList().filter((c) => !only || store.shown.has(c.state)) : [];
|
|
845
|
-
const title = tabbed
|
|
846
|
-
? `<span class="itabs" role="tablist" aria-label="To do column">${[
|
|
847
|
-
["ideas", "To do", `<svg><use href="#s-idea"/></svg>`],
|
|
848
|
-
["backlog", "Backlog: what finished runs left undone", ico("clock")],
|
|
849
|
-
]
|
|
850
|
-
.map(
|
|
851
|
-
([v, l, svg]) =>
|
|
852
|
-
`<button role="tab" aria-selected="${String(tasksTab === v)}" data-t="${v}" title="${l}" aria-label="${l}">${svg}${tasksTab === v ? `<b>${l.split(":")[0]}</b>` : ""}</button>`,
|
|
853
|
-
)
|
|
854
|
-
.join("")}</span>`
|
|
855
|
-
: `${name}<i>${list.length || ""}</i>`;
|
|
856
|
-
const sevBtn = bl
|
|
857
|
-
? `<button class="ib sm sevf${sev ? " on" : ""}" data-sv="1" title="${sev ? "Severity: " + SEVS.find((x) => x[0] === sev)[1] : "Filter by severity"}" aria-label="Filter by severity" aria-haspopup="menu" aria-expanded="${String(store.sevMenu)}">${ico("filter")}</button>` +
|
|
858
|
-
(store.sevMenu
|
|
859
|
-
? `<div class="menu-pop sev-pop" role="menu"><button role="menuitemradio" aria-checked="${String(!sev)}" data-s="">All severities <i>${nb.length}</i></button><hr>${SEVS.map(
|
|
860
|
-
([v, l, f]) =>
|
|
861
|
-
`<button role="menuitemradio" aria-checked="${String(sev === v)}" data-s="${v}">${l} <i>${nb.filter((c) => f(c.severity)).length}</i></button>`,
|
|
862
|
-
).join("")}</div>`
|
|
863
|
-
: "")
|
|
864
|
-
: "";
|
|
865
|
-
let head = `<h2>${title}${ci < 4 && !bl && list.length > 1 ? `<button class="btn sm ghost ord" title="Sort order">${order[ci] === "old" ? "Oldest" : "Newest"}</button>` : ""}${sevBtn}${tabbed ? `<button class="ib sm newi" title="New task" aria-label="New task">${ico("plus")}</button>` : ""}`;
|
|
866
|
-
if (clearable && picking)
|
|
867
|
-
head += `<span class="pickbar"><button class="btn sm ghost" data-p="cancel">Cancel</button><button class="btn sm pri" data-p="go" ${picked.size ? "" : "disabled"}>Archive ${picked.size || ""}</button></span>`;
|
|
868
|
-
else if (clearable) head += `<button class="btn sm ghost clear" title="Archive finished runs">Clear ▾</button>`;
|
|
869
|
-
if (clearable && store.clearMenu)
|
|
870
|
-
head += `<div class="menu-pop clear-pop"><button data-c="7">Older than a week <i>${olderThan(7).length}</i></button><button data-c="3">Older than 3 days <i>${olderThan(3).length}</i></button><button data-c="0">Everything <i>${list.length}</i></button><hr><button data-c="pick">Pick which…</button></div>`;
|
|
871
|
-
s.innerHTML = head + `</h2>`;
|
|
872
|
-
if (tabbed) {
|
|
873
|
-
s.querySelectorAll("[data-t]").forEach(
|
|
874
|
-
(bt) =>
|
|
875
|
-
(bt.onclick = () => {
|
|
876
|
-
tasksTab = bt.dataset.t;
|
|
877
|
-
store.sevMenu = false;
|
|
878
|
-
try {
|
|
879
|
-
localStorage.setItem("kz-ideas-tab", tasksTab);
|
|
880
|
-
} catch (e) {}
|
|
881
|
-
render();
|
|
882
|
-
}),
|
|
883
|
-
);
|
|
884
|
-
const sv = s.querySelector("[data-sv]");
|
|
885
|
-
if (sv)
|
|
886
|
-
sv.onclick = (e) => {
|
|
887
|
-
e.stopPropagation();
|
|
888
|
-
store.sevMenu = !store.sevMenu;
|
|
889
|
-
render();
|
|
890
|
-
};
|
|
891
|
-
s.querySelectorAll("[data-s]").forEach(
|
|
892
|
-
(bt) =>
|
|
893
|
-
(bt.onclick = (e) => {
|
|
894
|
-
e.stopPropagation();
|
|
895
|
-
sev = bt.dataset.s || null;
|
|
896
|
-
store.sevMenu = false;
|
|
897
|
-
render();
|
|
898
|
-
}),
|
|
899
|
-
);
|
|
900
|
-
}
|
|
901
|
-
{
|
|
902
|
-
const o = s.querySelector(".ord");
|
|
903
|
-
if (o)
|
|
904
|
-
o.onclick = (e) => {
|
|
905
|
-
e.stopPropagation();
|
|
906
|
-
order[ci] = order[ci] === "old" ? "new" : "old";
|
|
907
|
-
try {
|
|
908
|
-
localStorage.setItem("kz-order", JSON.stringify(order));
|
|
909
|
-
} catch (e) {}
|
|
910
|
-
render();
|
|
911
|
-
};
|
|
912
|
-
}
|
|
913
|
-
if (tabbed)
|
|
914
|
-
s.querySelector(".newi").onclick = () => {
|
|
915
|
-
store.mode = "new";
|
|
916
|
-
tasksTab = "ideas";
|
|
917
|
-
render();
|
|
918
|
-
};
|
|
919
|
-
if (clearable) {
|
|
920
|
-
const cl = s.querySelector(".clear");
|
|
921
|
-
if (cl)
|
|
922
|
-
cl.onclick = (e) => {
|
|
923
|
-
e.stopPropagation();
|
|
924
|
-
store.clearMenu = !store.clearMenu;
|
|
925
|
-
render();
|
|
926
|
-
};
|
|
927
|
-
s.querySelectorAll("[data-c]").forEach(
|
|
928
|
-
(bt) =>
|
|
929
|
-
(bt.onclick = async (e) => {
|
|
930
|
-
e.stopPropagation();
|
|
931
|
-
store.clearMenu = false;
|
|
932
|
-
const v = bt.dataset.c;
|
|
933
|
-
if (v === "pick") {
|
|
934
|
-
picking = true;
|
|
935
|
-
picked.clear();
|
|
936
|
-
render();
|
|
937
|
-
return;
|
|
938
|
-
}
|
|
939
|
-
const set = olderThan(+v);
|
|
940
|
-
if (!set.length) {
|
|
941
|
-
toast("Nothing that old");
|
|
942
|
-
render();
|
|
943
|
-
return;
|
|
944
|
-
}
|
|
945
|
-
for (const c of set) await post("/archive", { dir: c.state, id: c.id });
|
|
946
|
-
toast("Archived " + set.length);
|
|
947
|
-
load();
|
|
948
|
-
}),
|
|
949
|
-
);
|
|
950
|
-
s.querySelectorAll("[data-p]").forEach(
|
|
951
|
-
(bt) =>
|
|
952
|
-
(bt.onclick = async (e) => {
|
|
953
|
-
e.stopPropagation();
|
|
954
|
-
if (bt.dataset.p === "cancel") {
|
|
955
|
-
picking = false;
|
|
956
|
-
picked.clear();
|
|
957
|
-
render();
|
|
958
|
-
return;
|
|
959
|
-
}
|
|
960
|
-
const set = list.filter((c) => picked.has(key(c)));
|
|
961
|
-
picking = false;
|
|
962
|
-
picked.clear();
|
|
963
|
-
for (const c of set) await post("/archive", { dir: c.state, id: c.id });
|
|
964
|
-
toast("Archived " + set.length);
|
|
965
|
-
load();
|
|
966
|
-
}),
|
|
967
|
-
);
|
|
968
|
-
}
|
|
969
|
-
const ul = document.createElement("ul");
|
|
970
|
-
if (ci === 0 && store.mode === "new") {
|
|
971
|
-
const f = document.createElement("li");
|
|
972
|
-
f.className = "inl";
|
|
973
|
-
ul.appendChild(f);
|
|
974
|
-
taskForm(f, () => {
|
|
975
|
-
store.mode = null;
|
|
976
|
-
render();
|
|
977
|
-
});
|
|
978
|
-
}
|
|
979
|
-
const shown = unfolded.has(ci) || list.length <= FOLD + 1 ? list : list.slice(0, FOLD);
|
|
980
|
-
shown.forEach((c) => {
|
|
981
|
-
if (store.modeKey === key(c) && store.mode && store.mode !== "new") {
|
|
982
|
-
ul.appendChild(inlineForm(c));
|
|
983
|
-
return;
|
|
984
|
-
}
|
|
985
|
-
const li = document.createElement("li");
|
|
986
|
-
li.appendChild(card(c));
|
|
987
|
-
ul.appendChild(li);
|
|
988
|
-
});
|
|
989
|
-
if (shown.length < list.length) {
|
|
990
|
-
const li = document.createElement("li");
|
|
991
|
-
li.innerHTML = `<button class="more-btn">Show ${list.length - shown.length} more</button>`;
|
|
992
|
-
li.firstChild.onclick = () => {
|
|
993
|
-
unfolded.add(ci);
|
|
994
|
-
render();
|
|
995
|
-
};
|
|
996
|
-
ul.appendChild(li);
|
|
997
|
-
} else if (unfolded.has(ci) && list.length > FOLD + 1) {
|
|
998
|
-
const li = document.createElement("li");
|
|
999
|
-
li.innerHTML = `<button class="more-btn">Show less</button>`;
|
|
1000
|
-
li.firstChild.onclick = () => {
|
|
1001
|
-
unfolded.delete(ci);
|
|
1002
|
-
render();
|
|
1003
|
-
};
|
|
1004
|
-
ul.appendChild(li);
|
|
1005
|
-
}
|
|
1006
|
-
// An empty middle column says what lands in it, so it does not look broken.
|
|
1007
|
-
if (!list.length && !ul.children.length && ci <= 3 && !bl && cs.length && !filter && !q && !archive)
|
|
1008
|
-
ul.innerHTML = `<li class="hint">${HINT[ci]}</li>`;
|
|
1009
|
-
if (bl && !list.length && !filter && !q)
|
|
1010
|
-
ul.innerHTML = `<li class="hint">${sev ? "Nothing at this severity" : "What finished runs left undone shows here"}</li>`;
|
|
1011
|
-
s.appendChild(ul);
|
|
1012
|
-
b.appendChild(s);
|
|
1013
|
-
});
|
|
1014
|
-
// The tab says how many runs wait on you, or agents wait on input, so a background tab still tells you.
|
|
1015
|
-
const nw = waitingCount(store.S.cards);
|
|
1016
|
-
document.title = nw ? `(${nw}) kaizen` : "kaizen";
|
|
1017
|
-
if (store.all) boardBadge(store.S.cards, [...store.S.projects, ...(store.S.rail ?? [])], store.S.agents);
|
|
1018
|
-
termsBadge();
|
|
1019
|
-
stopDictation(false); // forms were just rebuilt; a listener whose field is gone would write into nothing
|
|
1020
|
-
if (fk && document.activeElement === document.body) cardEl(fk)?.focus({ preventScroll: true });
|
|
1021
|
-
}
|
|
1022
|
-
// The header filter box lives outside #board, so a redraw keeps what is typed; draft() keeps it over a reload.
|
|
1023
|
-
export function filterBox() {
|
|
1024
|
-
const el = $("bq");
|
|
1025
|
-
draft(el, "bq");
|
|
1026
|
-
query = el.value;
|
|
1027
|
-
el.addEventListener("input", () => {
|
|
1028
|
-
query = el.value;
|
|
1029
|
-
render();
|
|
1030
|
-
});
|
|
1031
|
-
initWsBoard(render);
|
|
1032
|
-
el.addEventListener("keydown", (e) => {
|
|
1033
|
-
if (e.key === "Escape") {
|
|
1034
|
-
e.stopPropagation();
|
|
1035
|
-
el.value = "";
|
|
1036
|
-
el.dispatchEvent(new Event("input"));
|
|
1037
|
-
el.blur();
|
|
1038
|
-
}
|
|
1039
|
-
});
|
|
1040
|
-
}
|
|
1041
|
-
// Phones: the footer's status strip opens as a sheet under the filter button; a press outside closes it.
|
|
1042
|
-
export function statusSheet() {
|
|
1043
|
-
const b = $("fbtn"),
|
|
1044
|
-
f = document.querySelector(".ftr");
|
|
1045
|
-
const set = (on) => {
|
|
1046
|
-
f.classList.toggle("on", on);
|
|
1047
|
-
b.setAttribute("aria-expanded", on);
|
|
1048
|
-
if (on) f.style.top = b.getBoundingClientRect().bottom + 6 + "px";
|
|
1049
|
-
};
|
|
1050
|
-
b.onclick = () => set(!f.classList.contains("on"));
|
|
1051
|
-
document.addEventListener("pointerdown", (e) => {
|
|
1052
|
-
if (f.classList.contains("on") && !f.contains(e.target) && !b.contains(e.target)) set(false);
|
|
1053
|
-
});
|
|
1054
|
-
document.addEventListener("keydown", (e) => e.key === "Escape" && f.classList.contains("on") && set(false));
|
|
1055
|
-
}
|
|
1056
|
-
export const focusedKey = () => document.activeElement?.closest?.("#board .card")?.dataset.k;
|
|
1057
|
-
export const cardEl = (k) => k && $("board").querySelector('.card[data-k="' + CSS.escape(k) + '"]');
|
|
1058
|
-
// Arrows and hjkl, as on the terminal board: up/down within a column, left/right to the
|
|
1059
|
-
// nearest column with cards, at the same row or its last card.
|
|
1060
|
-
export function nav(dx, dy) {
|
|
1061
|
-
const cols = [...$("board").querySelectorAll("section")]
|
|
1062
|
-
.map((s) => [...s.querySelectorAll(".card")])
|
|
1063
|
-
.filter((l) => l.length);
|
|
1064
|
-
if (!cols.length) return;
|
|
1065
|
-
const cur = document.activeElement.closest(".card");
|
|
1066
|
-
let ci = cols.findIndex((l) => l.includes(cur)),
|
|
1067
|
-
ri = 0;
|
|
1068
|
-
if (ci < 0) ci = 0;
|
|
1069
|
-
else {
|
|
1070
|
-
ri = cols[ci].indexOf(cur);
|
|
1071
|
-
if (dy) ri = Math.max(0, Math.min(cols[ci].length - 1, ri + dy));
|
|
1072
|
-
else {
|
|
1073
|
-
ci = Math.max(0, Math.min(cols.length - 1, ci + dx));
|
|
1074
|
-
ri = Math.min(ri, cols[ci].length - 1);
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
const t = cols[ci][ri];
|
|
1078
|
-
t.focus({ preventScroll: true });
|
|
1079
|
-
t.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
1080
|
-
}
|