kaizen-agent 1.86.0 → 1.87.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +79 -17
- package/cli/tasks.ts +2 -2
- 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 +188 -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 +113 -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 +134 -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 +397 -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/dictation.ts
DELETED
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
import { openMic, savedMic } from "./settings-voice.ts";
|
|
2
|
-
import { ico } from "./dom.ts";
|
|
3
|
-
import { toast } from "./toast.ts";
|
|
4
|
-
|
|
5
|
-
// ---- dictation: Whisper in the page. Audio never leaves the browser; the model is
|
|
6
|
-
// fetched once from huggingface.co and cached. Library and model are pinned here.
|
|
7
|
-
const TFJS = "https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0",
|
|
8
|
-
ASR_MODELS = {
|
|
9
|
-
tiny: "onnx-community/whisper-tiny",
|
|
10
|
-
base: "onnx-community/whisper-base",
|
|
11
|
-
small: "onnx-community/whisper-small",
|
|
12
|
-
"large-v3-turbo": "onnx-community/whisper-large-v3-turbo",
|
|
13
|
-
};
|
|
14
|
-
// The model is a setting (dictation.model); the worker is rebuilt when it changes.
|
|
15
|
-
let asrModel = null;
|
|
16
|
-
// Inference lives in a module Worker so a slow chunk never freezes the board.
|
|
17
|
-
const WORKER_SRC = `import{pipeline}from"${TFJS}";let asr=null;
|
|
18
|
-
onmessage=async e=>{const m=e.data;try{
|
|
19
|
-
if(m.type==="load"){const prog=p=>{if(p.status==="progress")postMessage({type:"progress",file:p.file,pct:p.progress||0})};
|
|
20
|
-
// WebGPU first, with the encoder in fp16 only where the adapter has shader-f16; any GPU failure falls back to the CPU.
|
|
21
|
-
const gpu=m.webgpu?{device:"webgpu",dtype:{encoder_model:m.f16?"fp16":"fp32",decoder_model_merged:"q4"}}:null,cpu={device:"wasm",dtype:"q8"};
|
|
22
|
-
try{if(!gpu)throw 0;asr=await pipeline("automatic-speech-recognition",m.model,{...gpu,progress_callback:prog})}
|
|
23
|
-
catch(e){if(gpu)postMessage({type:"fallback",why:String(e&&e.message||e)});asr=await pipeline("automatic-speech-recognition",m.model,{...cpu,progress_callback:prog})}
|
|
24
|
-
postMessage({type:"ready"})}
|
|
25
|
-
if(m.type==="run"){const r=await asr(m.audio,{chunk_length_s:30,return_timestamps:false});postMessage({type:"text",sid:m.sid,seq:m.seq,text:(r.text||"").trim()})}
|
|
26
|
-
}catch(err){postMessage({type:"error",sid:m.sid,seq:m.seq,error:String(err&&err.message||err)})}}`;
|
|
27
|
-
// The worklet only forwards 128-frame blocks; chunking and silence detection stay on the main thread.
|
|
28
|
-
const WORKLET_SRC = `class T extends AudioWorkletProcessor{process(i){const c=i[0]&&i[0][0];if(c)this.port.postMessage(c.slice(0));return true}}registerProcessor("kz-tap",T)`;
|
|
29
|
-
const HAS_MIC = !!(
|
|
30
|
-
navigator.mediaDevices &&
|
|
31
|
-
navigator.mediaDevices.getUserMedia &&
|
|
32
|
-
window.AudioWorkletNode &&
|
|
33
|
-
window.WebAssembly &&
|
|
34
|
-
window.Worker
|
|
35
|
-
);
|
|
36
|
-
// `active` is the one session listening; `sessions` also holds stopped ones still waiting on a chunk.
|
|
37
|
-
let asrWorker = null,
|
|
38
|
-
asrReady = null,
|
|
39
|
-
asrProgress = () => {},
|
|
40
|
-
active = null,
|
|
41
|
-
starting = false;
|
|
42
|
-
const sessions = new Set();
|
|
43
|
-
// One worker for the page; loading is awaited by whoever pressed first, later presses join.
|
|
44
|
-
// Loads the model named in settings; a model changed since the last load replaces the worker.
|
|
45
|
-
async function loadAsr() {
|
|
46
|
-
let want = "small";
|
|
47
|
-
try {
|
|
48
|
-
const cfg = await fetch("/settings").then((r) => r.json());
|
|
49
|
-
want = (cfg.rows.find((r) => r.key === "dictation.model") || {}).value || want;
|
|
50
|
-
} catch (e) {}
|
|
51
|
-
if (!ASR_MODELS[want]) want = "small";
|
|
52
|
-
if (asrReady && asrModel !== want) {
|
|
53
|
-
try {
|
|
54
|
-
asrWorker.terminate();
|
|
55
|
-
} catch (e) {}
|
|
56
|
-
asrWorker = null;
|
|
57
|
-
asrReady = null;
|
|
58
|
-
sessions.clear();
|
|
59
|
-
active = null;
|
|
60
|
-
}
|
|
61
|
-
if (asrReady) return asrReady;
|
|
62
|
-
asrModel = want;
|
|
63
|
-
asrReady = new Promise(async (res, rej) => {
|
|
64
|
-
asrWorker = new Worker(URL.createObjectURL(new Blob([WORKER_SRC], { type: "text/javascript" })), {
|
|
65
|
-
type: "module",
|
|
66
|
-
});
|
|
67
|
-
const files = {};
|
|
68
|
-
asrWorker.onmessage = (e) => {
|
|
69
|
-
const m = e.data;
|
|
70
|
-
if (m.type === "progress") {
|
|
71
|
-
files[m.file] = m.pct;
|
|
72
|
-
const v = Object.values(files);
|
|
73
|
-
asrProgress(Math.round(v.reduce((a, b) => a + b, 0) / v.length));
|
|
74
|
-
} else if (m.type === "ready") res();
|
|
75
|
-
else if (m.type === "fallback") toast("GPU could not run the model, using the CPU: " + m.why);
|
|
76
|
-
else if (m.type === "error" && m.seq == null) rej(new Error(m.error));
|
|
77
|
-
for (const s of sessions) s.onmsg(m);
|
|
78
|
-
};
|
|
79
|
-
asrWorker.onerror = (e) => rej(new Error(e.message || "worker failed"));
|
|
80
|
-
// Ask the adapter what it can do: no adapter means the CPU path; no shader-f16 means an fp32 encoder.
|
|
81
|
-
let adapter = null;
|
|
82
|
-
try {
|
|
83
|
-
adapter = navigator.gpu && (await navigator.gpu.requestAdapter());
|
|
84
|
-
} catch (e) {}
|
|
85
|
-
if (!adapter) toast("No WebGPU: dictation will run on the CPU and be slower");
|
|
86
|
-
asrWorker.postMessage({
|
|
87
|
-
type: "load",
|
|
88
|
-
model: ASR_MODELS[asrModel],
|
|
89
|
-
webgpu: !!adapter,
|
|
90
|
-
f16: !!(adapter && adapter.features.has("shader-f16")),
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
asrReady.catch(() => {
|
|
94
|
-
asrReady = null;
|
|
95
|
-
try {
|
|
96
|
-
asrWorker.terminate();
|
|
97
|
-
} catch (e) {}
|
|
98
|
-
asrWorker = null;
|
|
99
|
-
});
|
|
100
|
-
return asrReady;
|
|
101
|
-
}
|
|
102
|
-
// After a re-render only a listener whose field is gone is stopped; closing the panel stops any.
|
|
103
|
-
export function stopDictation(all) {
|
|
104
|
-
if (active && (all || !active.field.isConnected)) active.stop();
|
|
105
|
-
}
|
|
106
|
-
// Ctrl+Alt+D in a focused terminal. xterm's hidden textarea takes pastes, not typed values, so
|
|
107
|
-
// a stand-in field hands each chunk to that one terminal; mic() runs as for any field.
|
|
108
|
-
let hot: HTMLElement | null = null;
|
|
109
|
-
function termField(box: HTMLTextAreaElement) {
|
|
110
|
-
let first = true;
|
|
111
|
-
return {
|
|
112
|
-
value: "", selectionStart: 0, selectionEnd: 0,
|
|
113
|
-
get isConnected() { return box.isConnected; },
|
|
114
|
-
addEventListener() {}, focus() {},
|
|
115
|
-
onStart() { toast("Listening. Ctrl+Alt+D to stop"); },
|
|
116
|
-
dispatchEvent() {
|
|
117
|
-
const data = new DataTransfer();
|
|
118
|
-
data.setData("text/plain", (first ? "" : " ") + this.value);
|
|
119
|
-
first = false;
|
|
120
|
-
this.value = "";
|
|
121
|
-
box.dispatchEvent(new ClipboardEvent("paste", { clipboardData: data, bubbles: true, cancelable: true }));
|
|
122
|
-
return true;
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
addEventListener("keydown", (e) => {
|
|
127
|
-
if (!e.ctrlKey || !e.altKey || e.key.toLowerCase() !== "d") return;
|
|
128
|
-
e.preventDefault();
|
|
129
|
-
e.stopPropagation();
|
|
130
|
-
// A session that ended another way (mic refused, terminal closed) leaves nothing to stop.
|
|
131
|
-
if (hot) {
|
|
132
|
-
if (starting) return;
|
|
133
|
-
const live = !!active;
|
|
134
|
-
if (live) hot.click();
|
|
135
|
-
hot.remove();
|
|
136
|
-
hot = null;
|
|
137
|
-
if (live) return;
|
|
138
|
-
}
|
|
139
|
-
const box = document.activeElement as HTMLTextAreaElement | null;
|
|
140
|
-
if (!box?.classList.contains("xterm-helper-textarea")) return toast("Click into a terminal first");
|
|
141
|
-
const b = mic([termField(box)]);
|
|
142
|
-
if (!b) return toast("Dictation isn't available in this browser");
|
|
143
|
-
b.hidden = true;
|
|
144
|
-
document.body.append(b);
|
|
145
|
-
hot = b;
|
|
146
|
-
b.click();
|
|
147
|
-
}, true);
|
|
148
|
-
|
|
149
|
-
// mic(fields): a button that dictates into the last-focused of `fields` at its caret.
|
|
150
|
-
export function mic(fields) {
|
|
151
|
-
if (!HAS_MIC) return null;
|
|
152
|
-
const b = document.createElement("button");
|
|
153
|
-
b.className = "ib sm mic";
|
|
154
|
-
b.title = "Dictate";
|
|
155
|
-
b.setAttribute("aria-label", "Dictate");
|
|
156
|
-
b.type = "button";
|
|
157
|
-
const idle = () => {
|
|
158
|
-
b.innerHTML = ico("mic");
|
|
159
|
-
b.classList.remove("on", "busy");
|
|
160
|
-
};
|
|
161
|
-
idle();
|
|
162
|
-
let target = fields[0];
|
|
163
|
-
fields.forEach((f) => f.addEventListener("focus", () => (target = f)));
|
|
164
|
-
b.onclick = async (e) => {
|
|
165
|
-
e.preventDefault();
|
|
166
|
-
e.stopPropagation();
|
|
167
|
-
if (active) {
|
|
168
|
-
const mine = active.btn === b;
|
|
169
|
-
active.stop();
|
|
170
|
-
if (mine) return;
|
|
171
|
-
}
|
|
172
|
-
// One press at a time: the model load and the permission prompt are both awaits a second press could slip through.
|
|
173
|
-
if (starting) return;
|
|
174
|
-
starting = true;
|
|
175
|
-
b.classList.add("busy");
|
|
176
|
-
asrProgress = (pct) => {
|
|
177
|
-
b.innerHTML = `<i>${pct}%</i>`;
|
|
178
|
-
};
|
|
179
|
-
try {
|
|
180
|
-
await loadAsr();
|
|
181
|
-
} catch (err) {
|
|
182
|
-
idle();
|
|
183
|
-
asrProgress = () => {};
|
|
184
|
-
starting = false;
|
|
185
|
-
toast("Dictation model could not load: " + err.message);
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
asrProgress = () => {};
|
|
189
|
-
b.innerHTML = ico("mic");
|
|
190
|
-
if (!b.isConnected) {
|
|
191
|
-
idle();
|
|
192
|
-
starting = false;
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
let stream;
|
|
196
|
-
try {
|
|
197
|
-
stream = await openMic((audio) => navigator.mediaDevices.getUserMedia({ audio }), savedMic(), toast);
|
|
198
|
-
} catch (err) {
|
|
199
|
-
idle();
|
|
200
|
-
starting = false;
|
|
201
|
-
toast("Microphone not available: " + (err.name === "NotAllowedError" ? "permission denied" : err.message));
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
if (active) active.stop();
|
|
205
|
-
const ctx = new AudioContext({ sampleRate: 16000 });
|
|
206
|
-
await ctx.audioWorklet.addModule(URL.createObjectURL(new Blob([WORKLET_SRC], { type: "text/javascript" })));
|
|
207
|
-
const src = ctx.createMediaStreamSource(stream),
|
|
208
|
-
tap = new AudioWorkletNode(ctx, "kz-tap");
|
|
209
|
-
src.connect(tap);
|
|
210
|
-
// Text lands where the caret is when each chunk arrives (or after the last insertion when the
|
|
211
|
-
// field is not focused), so typing while the mic is on is kept.
|
|
212
|
-
const f = target;
|
|
213
|
-
f.onStart?.();
|
|
214
|
-
let at = f.selectionStart ?? f.value.length;
|
|
215
|
-
const vu = document.createElement("span");
|
|
216
|
-
vu.className = "vu";
|
|
217
|
-
vu.setAttribute("aria-hidden", "true");
|
|
218
|
-
vu.innerHTML = [0.5, 0.9, 1.3, 0.8, 0.45].map((w) => `<i style="--w:${w}"></i>`).join("");
|
|
219
|
-
let buf = [],
|
|
220
|
-
len = 0,
|
|
221
|
-
voiced = 0,
|
|
222
|
-
quiet = 0,
|
|
223
|
-
seq = 0,
|
|
224
|
-
done = 0,
|
|
225
|
-
pending = new Map(),
|
|
226
|
-
stopping = false;
|
|
227
|
-
const SR = 16000,
|
|
228
|
-
MAX = 6 * SR,
|
|
229
|
-
SIL = 0.8 * SR,
|
|
230
|
-
MIN = 1 * SR;
|
|
231
|
-
const insert = (t) => {
|
|
232
|
-
if (!t || !f.isConnected) return;
|
|
233
|
-
const v = f.value;
|
|
234
|
-
if (document.activeElement === f) at = f.selectionStart;
|
|
235
|
-
at = Math.min(at, v.length);
|
|
236
|
-
const head = v.slice(0, at),
|
|
237
|
-
sep = head && !/\s$/.test(head) ? " " : "";
|
|
238
|
-
f.value = head + sep + t + v.slice(at);
|
|
239
|
-
at = head.length + sep.length + t.length;
|
|
240
|
-
f.selectionStart = f.selectionEnd = at;
|
|
241
|
-
f.dispatchEvent(new Event("input", { bubbles: true }));
|
|
242
|
-
};
|
|
243
|
-
const flush = () => {
|
|
244
|
-
if (!len || voiced < MIN) {
|
|
245
|
-
buf = [];
|
|
246
|
-
len = 0;
|
|
247
|
-
voiced = 0;
|
|
248
|
-
quiet = 0;
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
const a = new Float32Array(len);
|
|
252
|
-
let o = 0;
|
|
253
|
-
for (const c of buf) {
|
|
254
|
-
a.set(c, o);
|
|
255
|
-
o += c.length;
|
|
256
|
-
}
|
|
257
|
-
buf = [];
|
|
258
|
-
len = 0;
|
|
259
|
-
voiced = 0;
|
|
260
|
-
quiet = 0;
|
|
261
|
-
pending.set(seq, null);
|
|
262
|
-
asrWorker.postMessage({ type: "run", sid, seq, audio: a }, [a.buffer]);
|
|
263
|
-
seq++;
|
|
264
|
-
b.classList.add("busy");
|
|
265
|
-
};
|
|
266
|
-
const drain = () => {
|
|
267
|
-
while (pending.has(done) && pending.get(done) !== null) {
|
|
268
|
-
insert(pending.get(done));
|
|
269
|
-
pending.delete(done);
|
|
270
|
-
done++;
|
|
271
|
-
}
|
|
272
|
-
if (!pending.size) {
|
|
273
|
-
b.classList.remove("busy");
|
|
274
|
-
if (stopping) {
|
|
275
|
-
idle();
|
|
276
|
-
sessions.delete(sess);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
tap.port.onmessage = (e) => {
|
|
281
|
-
const c = e.data;
|
|
282
|
-
buf.push(c);
|
|
283
|
-
len += c.length;
|
|
284
|
-
let s = 0;
|
|
285
|
-
for (let i = 0; i < c.length; i++) s += c[i] * c[i];
|
|
286
|
-
const rms = Math.sqrt(s / c.length);
|
|
287
|
-
if (rms > 0.01) {
|
|
288
|
-
voiced += c.length;
|
|
289
|
-
quiet = 0;
|
|
290
|
-
} else quiet += c.length;
|
|
291
|
-
{
|
|
292
|
-
const l = Math.min(1, rms * 8).toFixed(2);
|
|
293
|
-
f.style.setProperty("--lvl", l);
|
|
294
|
-
vu.style.setProperty("--lvl", l);
|
|
295
|
-
}
|
|
296
|
-
if (len >= MAX || (voiced >= MIN && quiet >= SIL)) flush();
|
|
297
|
-
};
|
|
298
|
-
// Chunk seqs are per session, so a result is matched by session id too.
|
|
299
|
-
const sid = Math.random().toString(36).slice(2);
|
|
300
|
-
const sess = {
|
|
301
|
-
btn: b,
|
|
302
|
-
field: f,
|
|
303
|
-
onmsg: (m) => {
|
|
304
|
-
if (m.sid !== sid) return;
|
|
305
|
-
if (m.type === "text") {
|
|
306
|
-
pending.set(m.seq, m.text);
|
|
307
|
-
drain();
|
|
308
|
-
} else if (m.type === "error" && m.seq != null) {
|
|
309
|
-
pending.set(m.seq, "");
|
|
310
|
-
toast("Dictation failed: " + m.error);
|
|
311
|
-
drain();
|
|
312
|
-
}
|
|
313
|
-
},
|
|
314
|
-
stop: () => {
|
|
315
|
-
if (stopping) return;
|
|
316
|
-
stopping = true;
|
|
317
|
-
b.classList.remove("on");
|
|
318
|
-
f.classList.remove("dictating");
|
|
319
|
-
f.style.removeProperty("--lvl");
|
|
320
|
-
b.innerHTML = ico("mic");
|
|
321
|
-
try {
|
|
322
|
-
tap.port.onmessage = null;
|
|
323
|
-
src.disconnect();
|
|
324
|
-
tap.disconnect();
|
|
325
|
-
stream.getTracks().forEach((t) => t.stop());
|
|
326
|
-
ctx.close();
|
|
327
|
-
} catch (e) {}
|
|
328
|
-
active = null;
|
|
329
|
-
flush();
|
|
330
|
-
drain();
|
|
331
|
-
},
|
|
332
|
-
};
|
|
333
|
-
sessions.add(sess);
|
|
334
|
-
active = sess;
|
|
335
|
-
starting = false;
|
|
336
|
-
b.classList.remove("busy");
|
|
337
|
-
b.classList.add("on");
|
|
338
|
-
f.classList.add("dictating");
|
|
339
|
-
b.replaceChildren(vu);
|
|
340
|
-
f.focus();
|
|
341
|
-
};
|
|
342
|
-
return b;
|
|
343
|
-
}
|
package/web/board/dom.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// Small DOM helpers every part of the board uses.
|
|
2
|
-
export const $ = <T extends HTMLElement = any>(id: string) => document.getElementById(id) as T;
|
|
3
|
-
export const esc = (s) =>
|
|
4
|
-
String(s).replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
5
|
-
// Trusted markup. Everything `html` interpolates is escaped unless it is a Safe.
|
|
6
|
-
export class Safe {
|
|
7
|
-
constructor(readonly s: string) {}
|
|
8
|
-
toString() {
|
|
9
|
-
return this.s;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export const raw = (s) => new Safe(String(s));
|
|
13
|
-
const part = (v): string => (v instanceof Safe ? v.s : Array.isArray(v) ? v.map(part).join("") : v == null || v === false ? "" : esc(v));
|
|
14
|
-
// Escape-by-default template: html`<b>${title}</b>` cannot inject markup. Keep attributes double-quoted.
|
|
15
|
-
export const html = (strs: TemplateStringsArray, ...vals) => raw(strs.reduce((a, s, i) => a + part(vals[i - 1]) + s));
|
|
16
|
-
export const ico = (n) => raw(`<svg><use href="#i-${n}"/></svg>`);
|
|
17
|
-
// The board's one switch (.chk in board.html). A <button role="switch"> whose owner flips `.on`
|
|
18
|
-
// and aria-checked; with `box`, a checkbox whose `checked` is the state, for code that reads it.
|
|
19
|
-
// `sm` is the compact size; `attrs` are further attributes, escaped.
|
|
20
|
-
export const toggleSwitch = (on: boolean, o: { sm?: boolean; box?: boolean; attrs?: Record<string, string> } = {}) => {
|
|
21
|
-
const cls = "chk" + (o.sm ? " sm" : ""),
|
|
22
|
-
at = raw(Object.entries(o.attrs ?? {}).map(([k, v]) => ` ${k}="${esc(v)}"`).join(""));
|
|
23
|
-
return o.box
|
|
24
|
-
? html`<input type="checkbox" class="${cls}" role="switch"${at}${raw(on ? " checked" : "")}>`
|
|
25
|
-
: html`<button type="button" class="${cls}${on ? " on" : ""}" role="switch" aria-checked="${String(on)}"${at}></button>`;
|
|
26
|
-
};
|
|
27
|
-
// Placeholder rows for a panel whose body is still being fetched.
|
|
28
|
-
export const SKEL = raw(
|
|
29
|
-
'<div aria-busy="true" aria-label="Loading">' +
|
|
30
|
-
'<span class="skel" style="height:16px;width:35%;margin:20px 0 14px"></span>' +
|
|
31
|
-
'<span class="skel" style="height:44px;margin-bottom:10px"></span>'.repeat(4) +
|
|
32
|
-
"</div>",
|
|
33
|
-
);
|
|
34
|
-
// A phone photo is many MB and a few of them pass the server's cap; a big raster image
|
|
35
|
-
// goes up as a JPEG of at most 2560px a side. Anything that will not decode goes as is.
|
|
36
|
-
const MAX_IMG = 1_500_000;
|
|
37
|
-
async function shrink(x: File): Promise<File> {
|
|
38
|
-
if (x.size <= MAX_IMG || !/^image\/(jpeg|png|webp|bmp|heic|heif)$/.test(x.type)) return x;
|
|
39
|
-
try {
|
|
40
|
-
const bm = await createImageBitmap(x);
|
|
41
|
-
const k = Math.min(1, 2560 / Math.max(bm.width, bm.height));
|
|
42
|
-
const c = document.createElement("canvas");
|
|
43
|
-
c.width = Math.round(bm.width * k);
|
|
44
|
-
c.height = Math.round(bm.height * k);
|
|
45
|
-
c.getContext("2d").drawImage(bm, 0, 0, c.width, c.height);
|
|
46
|
-
const b = await new Promise<Blob | null>((r) => c.toBlob(r, "image/jpeg", 0.85));
|
|
47
|
-
return b && b.size < x.size ? new File([b], x.name.replace(/\.\w+$/, "") + ".jpg", { type: "image/jpeg" }) : x;
|
|
48
|
-
} catch {
|
|
49
|
-
return x;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// Files as {name, data-URL}, the shape /note and /icebox take.
|
|
53
|
-
export const dataUrls = (files: File[]) =>
|
|
54
|
-
Promise.all(
|
|
55
|
-
files.map(
|
|
56
|
-
async (f) => {
|
|
57
|
-
const x = await shrink(f);
|
|
58
|
-
return new Promise<{ name: string; data: string }>((res) => {
|
|
59
|
-
const rd = new FileReader();
|
|
60
|
-
rd.onload = () => res({ name: x.name, data: rd.result as string });
|
|
61
|
-
rd.readAsDataURL(x);
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
),
|
|
65
|
-
);
|
|
66
|
-
// A modal form: the native <dialog>, removed from the page once closed.
|
|
67
|
-
export function modal(body: string | Safe) {
|
|
68
|
-
const dl = document.createElement("dialog");
|
|
69
|
-
dl.className = "kz";
|
|
70
|
-
dl.innerHTML = `<form class="inl" method="dialog">${body}</form>`;
|
|
71
|
-
dl.onclose = () => dl.remove();
|
|
72
|
-
// A tap on the backdrop. Braces matter: an on* handler that returns false cancels the click,
|
|
73
|
-
// which stopped every submit button inside the form.
|
|
74
|
-
dl.onclick = (e) => {
|
|
75
|
-
if (e.target === dl) dl.close();
|
|
76
|
-
};
|
|
77
|
-
document.body.appendChild(dl);
|
|
78
|
-
dl.showModal();
|
|
79
|
-
return dl;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Motion: the Settings choice (data-motion on <html>), else the system's reduced-motion.
|
|
83
|
-
export const motion = () => {
|
|
84
|
-
const m = document.documentElement.dataset.motion;
|
|
85
|
-
return m ? m === "full" : !matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
86
|
-
};
|
|
87
|
-
// fn as a view transition where the browser has them and motion is on; resolves once the DOM is updated.
|
|
88
|
-
export const vt = (fn: () => void): Promise<void> =>
|
|
89
|
-
motion() && document.startViewTransition ? document.startViewTransition(fn).updateCallbackDone : (fn(), Promise.resolve());
|
|
90
|
-
|
|
91
|
-
// Paging for a long list: one state per list, its size remembered per browser.
|
|
92
|
-
const PAGE_SIZES = [5, 25, 50, 100];
|
|
93
|
-
export function pager(id: string) {
|
|
94
|
-
let size = 25;
|
|
95
|
-
try {
|
|
96
|
-
const n = Number(localStorage.getItem("kz-page:" + id));
|
|
97
|
-
if (PAGE_SIZES.includes(n)) size = n;
|
|
98
|
-
} catch {}
|
|
99
|
-
return { id, size, at: 0, total: 0 };
|
|
100
|
-
}
|
|
101
|
-
type Pager = ReturnType<typeof pager>;
|
|
102
|
-
// The page of items showing; a list that shrank pulls the page back into range.
|
|
103
|
-
export function pageOf<T>(p: Pager, items: T[]): T[] {
|
|
104
|
-
p.total = items.length;
|
|
105
|
-
p.at = Math.max(0, Math.min(p.at, Math.ceil(items.length / p.size) - 1));
|
|
106
|
-
return items.slice(p.at * p.size, (p.at + 1) * p.size);
|
|
107
|
-
}
|
|
108
|
-
export function pagerHtml(p: Pager) {
|
|
109
|
-
if (p.total <= PAGE_SIZES[0]) return "";
|
|
110
|
-
const from = p.at * p.size + 1,
|
|
111
|
-
to = Math.min(p.total, from + p.size - 1);
|
|
112
|
-
return html`<div class="kpager" id="pg-${p.id}"><label>Rows<select class="sel" aria-label="Rows per page">${PAGE_SIZES.map((n) => html`<option${n === p.size ? raw(" selected") : ""}>${n}</option>`)}</select></label><span>${from}–${to} of ${p.total}</span><button class="btn sm" type="button" data-to="-1"${p.at ? "" : raw(" disabled")}>Prev</button><button class="btn sm" type="button" data-to="1"${to < p.total ? "" : raw(" disabled")}>Next</button></div>`;
|
|
113
|
-
}
|
|
114
|
-
export function wirePager(p: Pager, redraw: () => void) {
|
|
115
|
-
const box = $("pg-" + p.id);
|
|
116
|
-
if (!box) return;
|
|
117
|
-
box.querySelector("select").onchange = (e) => {
|
|
118
|
-
p.size = +(e.target as HTMLSelectElement).value;
|
|
119
|
-
p.at = 0;
|
|
120
|
-
try {
|
|
121
|
-
localStorage.setItem("kz-page:" + p.id, String(p.size));
|
|
122
|
-
} catch {}
|
|
123
|
-
redraw();
|
|
124
|
-
};
|
|
125
|
-
box.querySelectorAll<HTMLElement>("[data-to]").forEach(
|
|
126
|
-
(b) =>
|
|
127
|
-
(b.onclick = () => {
|
|
128
|
-
p.at += +b.dataset.to!;
|
|
129
|
-
redraw();
|
|
130
|
-
}),
|
|
131
|
-
);
|
|
132
|
-
}
|
package/web/board/drafts.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Half-typed text outlives a redraw and a page reload. Per tab, so two tabs cannot
|
|
2
|
-
// overwrite each other; form drafts are under "f:", notes under "n:".
|
|
3
|
-
export const DK = "kz-d:";
|
|
4
|
-
export function draft(el, k) {
|
|
5
|
-
try {
|
|
6
|
-
const v = sessionStorage.getItem(DK + k);
|
|
7
|
-
if (v != null) el.value = v;
|
|
8
|
-
} catch (e) {}
|
|
9
|
-
el.addEventListener("input", () => {
|
|
10
|
-
try {
|
|
11
|
-
sessionStorage.setItem(DK + k, el.value);
|
|
12
|
-
} catch (e) {}
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
export function undraft(p) {
|
|
16
|
-
try {
|
|
17
|
-
Object.keys(sessionStorage).forEach((k) => {
|
|
18
|
-
if (k.startsWith(DK + p)) sessionStorage.removeItem(k);
|
|
19
|
-
});
|
|
20
|
-
} catch (e) {}
|
|
21
|
-
}
|
package/web/board/fixes.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { store } from "./store.ts";
|
|
2
|
-
import { where } from "./agent-term.ts";
|
|
3
|
-
import { post } from "./api.ts";
|
|
4
|
-
import { key, via } from "./cards.ts";
|
|
5
|
-
import { $, html, raw } from "./dom.ts";
|
|
6
|
-
import { md } from "./markdown.ts";
|
|
7
|
-
import { openRun } from "./panel.ts";
|
|
8
|
-
import { askNotify, toast } from "./toast.ts";
|
|
9
|
-
|
|
10
|
-
// Fix picked findings, under the review: open ones ticked, closed and sent ones ticked but
|
|
11
|
-
// locked. Unticked and sent findings live outside the form, which every refresh rebuilds,
|
|
12
|
-
// keyed "run:number"; sent ones also survive a reload of this tab. A finding is one line,
|
|
13
|
-
// so md() gives one paragraph; its wrapper is dropped to sit inline in the label.
|
|
14
|
-
export const SK = "kz-sent",
|
|
15
|
-
fixOff = new Set(),
|
|
16
|
-
fixSent = new Set(
|
|
17
|
-
(() => {
|
|
18
|
-
try {
|
|
19
|
-
return JSON.parse(sessionStorage.getItem(SK)) || [];
|
|
20
|
-
} catch (e) {
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
23
|
-
})(),
|
|
24
|
-
);
|
|
25
|
-
export function fixForm(c) {
|
|
26
|
-
const k = (n) => c.id + ":" + n,
|
|
27
|
-
sent = (f) => fixSent.has(k(f.n)),
|
|
28
|
-
fs = store.runDoc.findings || [],
|
|
29
|
-
open = fs.filter((f) => !f.done && !sent(f));
|
|
30
|
-
if (
|
|
31
|
-
c.archived ||
|
|
32
|
-
!fs.some((f) => !f.done) ||
|
|
33
|
-
!(c.status === "done" || c.awaiting === "findings" || c.awaiting === "approvals.review")
|
|
34
|
-
)
|
|
35
|
-
return;
|
|
36
|
-
const el = document.createElement("div");
|
|
37
|
-
el.className = "inl fix";
|
|
38
|
-
el.innerHTML = html`<div class="q">Fix findings</div><div class="q dim">Opens your agent in this project, told to fix the ticked findings and recheck them.</div>${c.status === "waiting" ? html`<div class="q dim">An agent is already open on this run; the fix is sent to it when it runs in its card, else another one opens.</div>` : ""}${
|
|
39
|
-
fs
|
|
40
|
-
.map((f) => {
|
|
41
|
-
const x = f.done ? " (closed)" : sent(f) ? " (sent)" : "";
|
|
42
|
-
return html`<label class="${f.done ? "off done" : x ? "off" : ""}"><input type="checkbox" data-n="${f.n}" ${x ? "checked disabled" : fixOff.has(k(f.n)) ? "" : "checked"}><span>${f.n}. ${raw(md(f.text).replace(/^<p>|<\/p>$/g, ""))}${x}</span></label>`;
|
|
43
|
-
})
|
|
44
|
-
}${open.length
|
|
45
|
-
? html`<div class="row"><button class="btn ghost" data-a="all"></button><button class="btn pri" data-a="s"></button></div>`
|
|
46
|
-
: ""}`;
|
|
47
|
-
if (!open.length) return $("pbody").appendChild(el);
|
|
48
|
-
const go = el.querySelector("[data-a=s]"),
|
|
49
|
-
allb = el.querySelector("[data-a=all]"),
|
|
50
|
-
picks = () => open.filter((f) => !fixOff.has(k(f.n))).map((f) => f.n);
|
|
51
|
-
const sync = () => {
|
|
52
|
-
const n = picks().length;
|
|
53
|
-
go.textContent = n === open.length ? "Fix all " + n : "Fix " + n + " selected";
|
|
54
|
-
go.disabled = !n;
|
|
55
|
-
allb.textContent = n === open.length ? "Select none" : "Select all";
|
|
56
|
-
el.querySelectorAll("input:not(:disabled)").forEach((i) => (i.checked = !fixOff.has(k(i.dataset.n))));
|
|
57
|
-
};
|
|
58
|
-
el.onchange = (e) => {
|
|
59
|
-
const n = k(e.target.dataset.n);
|
|
60
|
-
e.target.checked ? fixOff.delete(n) : fixOff.add(n);
|
|
61
|
-
sync();
|
|
62
|
-
};
|
|
63
|
-
allb.onclick = () => {
|
|
64
|
-
const none = picks().length === open.length;
|
|
65
|
-
open.forEach((f) => (none ? fixOff.add(k(f.n)) : fixOff.delete(k(f.n))));
|
|
66
|
-
sync();
|
|
67
|
-
};
|
|
68
|
-
go.onclick = async () => {
|
|
69
|
-
const nums = picks();
|
|
70
|
-
go.disabled = true;
|
|
71
|
-
askNotify();
|
|
72
|
-
const r = await post("/fix", { dir: c.state, id: c.id, nums });
|
|
73
|
-
// Sent findings lock as sent, so a second press cannot open a second agent on them.
|
|
74
|
-
if (r.ok) {
|
|
75
|
-
toast(
|
|
76
|
-
"Fixing " + nums.length + " finding" + (nums.length === 1 ? "" : "s") + ", " +
|
|
77
|
-
(r.reused ? "sent to the agent already open in its workspace" : where(r) + ": " + via(r.agent)),
|
|
78
|
-
);
|
|
79
|
-
if (r.pty) (store.wantTerm = key(c)), (store.wantPty = { key: r.pty, at: Date.now() });
|
|
80
|
-
nums.forEach((n) => fixSent.add(k(n)));
|
|
81
|
-
try {
|
|
82
|
-
sessionStorage.setItem(SK, JSON.stringify([...fixSent]));
|
|
83
|
-
} catch (e) {}
|
|
84
|
-
openRun(c, true);
|
|
85
|
-
} else sync();
|
|
86
|
-
};
|
|
87
|
-
sync();
|
|
88
|
-
$("pbody").appendChild(el);
|
|
89
|
-
}
|