kaizen-agent 1.85.2 → 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/rea.ts +99 -11
- package/cli/settings.ts +16 -17
- package/cli/state.ts +15 -29
- package/cli/task-service.ts +114 -34
- package/cli/tasks.ts +8 -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 +197 -61
- package/package.json +21 -4
- package/skills/kaizen/spec.md +12 -4
- package/skills/optional/disk-cleanup/SKILL.md +60 -0
- package/skills/optional/disk-cleanup/skill.json +1 -0
- package/skills/optional/disk-cleanup/tui.py +90 -0
- 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/term-paste.ts +10 -0
- package/web/{term.ts → term/term.ts} +101 -27
- 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 -86
- 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 -615
- 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 -500
- package/web/notebook.js +0 -514
- package/web/notebook.ts +0 -1254
- package/web/popup.html +0 -141
- package/web/video.js +0 -570
- /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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: disk-cleanup
|
|
3
|
+
description: Audit disk usage on this PC and clean it up safely. Shows terminal box charts of what is fat (home dirs, Steam games, caches, rebuildable build output), then a verdict panel and a pick-what-to-delete question. Use when the user asks to tidy files and dirs, free disk space, find what is safe to delete, prune caches, or "what is eating my disk".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Disk cleanup
|
|
7
|
+
|
|
8
|
+
Audit first, delete only what the user picks. Never delete without an explicit pick.
|
|
9
|
+
|
|
10
|
+
## Rules learned the hard way
|
|
11
|
+
|
|
12
|
+
- **Verify before saying "safe".** Look inside (`ls`, `du`, `diff -rq`, read `project.json`) before calling anything cache or a copy. A dir named `.cache` can hold a venv, a backup, or project history.
|
|
13
|
+
- **Never total unlike things.** A sum of cache dirs is not "reclaimable". Report each group on its own and state what is regenerable and what is not.
|
|
14
|
+
- **Use real numbers.** Say what a number is (apparent vs on-disk). The disk is btrfs with zstd, so use `du -x` and `df -h /home`.
|
|
15
|
+
- Delete only on a pick. Prefer move-to-Archive for anything not obviously regenerable.
|
|
16
|
+
- Report outcomes faithfully: freed space comes from `df` before/after, not from the plan.
|
|
17
|
+
|
|
18
|
+
## Procedure
|
|
19
|
+
|
|
20
|
+
1. **Overview.** `df -h /home`, then `du -xsh ~/.[!.]* ~/* | sort -rh | head -25`. Expect `~/.local/share/Steam` to dominate; drill into it separately.
|
|
21
|
+
2. **Drill the fat ones** with `du -xh --max-depth=1 <dir> | sort -rh | head`:
|
|
22
|
+
- Steam: `steamapps/common`, `shadercache`, `compatdata`. Game name, size and last played come from `steamapps/appmanifest_*.acf` (`name`, `SizeOnDisk`, `LastPlayed`; missing or 0 = never played).
|
|
23
|
+
- Projects: rebuildable output = `node_modules`, `target`, `.next`, `dist` (`find Projects -name node_modules -type d -prune`).
|
|
24
|
+
- `~/.cache`, `~/.config` browser profiles, `~/.hermes`, `~/.local/share/mise/installs` (old tool versions).
|
|
25
|
+
3. **Round 1: show charts, then ask where to go.** Print the box charts as chat text (see Format), then `AskUserQuestion` with: explore outside Steam / explore Steam / continue to cleanup. Do the exploration the user picks, show new boxes, ask again.
|
|
26
|
+
4. **Round 2: verdict, then ask what to run.** Print the verdict panel as chat text, then `AskUserQuestion` (multiSelect, max 4 options; overflow items go via "Other") whose options are the verdict rows.
|
|
27
|
+
5. **Run only the picks.** Close Steam before touching `steamapps`. Re-run `df -h /home` and report freed space.
|
|
28
|
+
|
|
29
|
+
## Verdict tiers
|
|
30
|
+
|
|
31
|
+
| Tier | Meaning | Examples |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| ✓ SAFE NOW | regenerates, no work lost | Steam `shadercache`, `node_modules`/`target`/`.next`, `.zcompdump`, empty dirs, stale `.claude.json.tmp.*` |
|
|
34
|
+
| ✓ RE-DOWNLOAD | recoverable, costs time | never-played Steam games, model caches under `~/.cache/huggingface` |
|
|
35
|
+
| ? YOUR CALL | depends on use | idle games (2+ months), old `mise` versions, VMs, headless browser profiles |
|
|
36
|
+
| ✗ KEEP | never offer | `Projects` source, `Documents`, `.ssh`, `.gnupg`, `.kaizen`, `Games/roms` |
|
|
37
|
+
|
|
38
|
+
Watch for: `whisperx-venv` is a venv, not cache; `kaizen-video` needs it. Desktop shortcuts in `~` for a "never played" game mean the user may be about to play it.
|
|
39
|
+
|
|
40
|
+
## Format
|
|
41
|
+
|
|
42
|
+
Boxes are 38 wide, two per row. No scale text in the title: the title is bold, the top-right shows the box's used total and a 5-cell gauge. Sizes show as TB, GB, MB or KB (never bare `G`); a blank line separates the title from the rows. Row bars fill the width up to the right-aligned size column and scale to the box's biggest row (`▌` half, `▏` under one half-cell). Mark never-played games `✗`.
|
|
43
|
+
|
|
44
|
+
Gauge = box total ÷ the limit (the disk size for HOME and STEAM boxes; the biggest dir's parent for others). Each filled cell is an emoji square coloured by that ratio: 🟩 <50%, 🟨 <75%, 🟧 <90%, 🟥 ≥90%; empty cells are ⬜. Both are 2 cells wide, so `box` counts them double. Bold titles use Unicode bold letters (`𝗛𝗢𝗠𝗘`) because markdown bold does not work inside a code block. Never hand-draw boxes: import the shared component `tui.py` (same dir as this file) for every report that uses a box.
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import sys, os; sys.path.insert(0, os.path.expanduser("~/.claude/skills/disk-cleanup"))
|
|
48
|
+
from tui import box, panel, render, storage, GB, MB, KB
|
|
49
|
+
render(box("HOME", [("Steam", GB(1500)), ("Projects", GB(52))], GB(1552), GB(1900)), box("CACHE", [("huggingface", GB(12)), ("tmp", MB(300), "✗")], GB(12), GB(1900)))
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`box(title, [(name, bytes, flag?)], used, limit)` makes a bold-title box: sizes in bytes (`GB()`, `MB()`, `KB()` build them; shown as GB, MB, KB), bars fill the row up to the size column and scale to the box's biggest row, the top-right gauge is box total vs `limit`; `panel(title, [(line, note)], foot)` the verdict panel; `render` prints two per row. `storage([(label, bytes)], total, free)` returns the full-width DISK box: one bar split by pattern (█ ▓ ▒, then ░ other, blank free; chat text cannot colour per section), real disk size top-right, and a one-line legend underneath (short lowercase labels, sizes without a space, so it fits one line). Print it above every chart set, using disjoint sections (e.g. steam games, steam other, home rest) and the real `df` total and free. A box total must be the real `du` figure, not the sum of the rows shown.
|
|
53
|
+
|
|
54
|
+
Every box line must be 40 cells wide by `w()` (emoji = 2); check before printing.
|
|
55
|
+
|
|
56
|
+
Verdict panel: `panel()`, one numbered row per option (`[1] ✓ SAFE NOW <what> <size>` with a `└` note line), a `✗ KEEP` footer.
|
|
57
|
+
|
|
58
|
+
The user sees chat text and the question dialog, but a question dialog shows only its own text, so charts go in chat before the call, never inside the question.
|
|
59
|
+
|
|
60
|
+
**Bash output is collapsed in the user's terminal ("Ran 2 shell commands"), so a chart printed by `render` is invisible.** After running `tui.py`, copy its output verbatim into your own reply inside a ``` code block, before the `AskUserQuestion` call. Never ask "next step?" until the chart is in reply text. Same for the verdict panel.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"title": "Disk cleanup", "group": "optional", "status": "beta", "needs": ["python3"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Shared box/panel component for disk-cleanup reports.
|
|
2
|
+
Use: sys.path.insert(0, os.path.expanduser("~/.claude/skills/disk-cleanup")); from tui import *
|
|
3
|
+
Sizes are bytes everywhere. Helpers: GB(n), MB(n), KB(n) build bytes."""
|
|
4
|
+
W = 38 # box inner width
|
|
5
|
+
KB = lambda n: int(n * 1024)
|
|
6
|
+
MB = lambda n: int(n * 1024**2)
|
|
7
|
+
GB = lambda n: int(n * 1024**3)
|
|
8
|
+
|
|
9
|
+
def size(b):
|
|
10
|
+
"""Bytes -> '1.5 TB' / '1500 GB' / '52 MB' / '4 KB' / '0 B' (TB from 1024 GB)."""
|
|
11
|
+
for u, d in (("TB", 1024**4), ("GB", 1024**3), ("MB", 1024**2), ("KB", 1024)):
|
|
12
|
+
if b >= d:
|
|
13
|
+
v = b / d
|
|
14
|
+
return f"{v:.0f} {u}" if v >= 10 else f"{v:.1f} {u}"
|
|
15
|
+
return f"{b} B"
|
|
16
|
+
|
|
17
|
+
def bold(s):
|
|
18
|
+
return "".join(chr(0x1D5D4+ord(c)-65) if "A"<=c<="Z" else chr(0x1D5EE+ord(c)-97) if "a"<=c<="z" else chr(0x1D7EC+ord(c)-48) if c.isdigit() else c for c in s)
|
|
19
|
+
|
|
20
|
+
def w(s):
|
|
21
|
+
"""Display width: emoji squares = 2 cells."""
|
|
22
|
+
return sum(2 if ord(c) >= 0x1F000 or c == "⬜" else 1 for c in s)
|
|
23
|
+
|
|
24
|
+
def gauge(used, limit, n=5):
|
|
25
|
+
r = used / limit; f = min(n, round(r * n))
|
|
26
|
+
c = "🟩" if r < .5 else "🟨" if r < .75 else "🟧" if r < .9 else "🟥"
|
|
27
|
+
return c * f + "⬜" * (n - f)
|
|
28
|
+
|
|
29
|
+
def bar(b, top, bw):
|
|
30
|
+
h = round(b / top * bw * 2) # half-cells, scaled to the box's biggest row
|
|
31
|
+
return ("▏" if h == 0 else "█" * (h // 2) + ("▌" if h % 2 else "")).ljust(bw)
|
|
32
|
+
|
|
33
|
+
def box(title, rows, used, limit):
|
|
34
|
+
"""rows = [(name, bytes, flag)]; flag optional ('✗'). Bars scale to the box's biggest row; gauge shows box total vs limit."""
|
|
35
|
+
rows = [(r + ("",))[:3] for r in rows]
|
|
36
|
+
top = max(b for _, b, _ in rows)
|
|
37
|
+
lw = max(len(n) for n, _, _ in rows)
|
|
38
|
+
sw = max(len(size(b)) for _, b, _ in rows)
|
|
39
|
+
fw = max(len(f) for _, _, f in rows)
|
|
40
|
+
bw = W - 2 - lw - sw - 2 - (fw + 1 if fw else 0) # bar fills the gap
|
|
41
|
+
body = ["│ " + (f"{n:<{lw}} {bar(b, top, bw)} {size(b):>{sw}}" + (f" {f}" if fw else "")).ljust(W - 1) + "│"
|
|
42
|
+
for n, b, f in rows]
|
|
43
|
+
tag = f"{size(used)} {gauge(used, limit)}"
|
|
44
|
+
head = "┌─ " + bold(title) + " " + "─" * (W - len(title) - w(tag) - 5) + " " + tag + " ┐"
|
|
45
|
+
return [head, "│" + " " * W + "│"] + body + ["└" + "─" * W + "┘"]
|
|
46
|
+
|
|
47
|
+
def side_by_side(a, b):
|
|
48
|
+
n = max(len(a), len(b)); a += [" " * 40] * (n - len(a)); b += [" " * 40] * (n - len(b))
|
|
49
|
+
return [x + " " * (41 - w(x)) + y for x, y in zip(a, b)]
|
|
50
|
+
|
|
51
|
+
def panel(title, rows, foot, pw=62):
|
|
52
|
+
"""Verdict panel: rows = [(line, note)], double-line box."""
|
|
53
|
+
out = ["╔═ " + bold(title) + " " + "═" * (pw - len(title) - 3) + "╗"]
|
|
54
|
+
for i, (line, note) in enumerate(rows, 1):
|
|
55
|
+
out += ["║ " + f"[{i}] {line}".ljust(pw - 1) + "║", "║ " + f" └ {note}".ljust(pw - 1) + "║"]
|
|
56
|
+
return out + ["╠" + "═" * pw + "╣", "║ " + foot.ljust(pw - 1) + "║", "╚" + "═" * pw + "╝"]
|
|
57
|
+
|
|
58
|
+
FILL = "█▓▒" # block-element glyphs only (▤ ▚ fell back to another font and broke widths)
|
|
59
|
+
|
|
60
|
+
def storage(segments, total, free, title="DISK", width=79):
|
|
61
|
+
"""Full-width disk bar in one box (Apple-storage style). segments = [(label, bytes)], disjoint,
|
|
62
|
+
drawn in order with patterns █ ▤ ▚ ░; rest of used = other (░ if free), unused = FREE (blank).
|
|
63
|
+
Top-right of the box = real disk size. Returns lines, same width as two boxes side by side."""
|
|
64
|
+
other = max(0, total - free - sum(b for _, b in segments))
|
|
65
|
+
parts = [(l, b, FILL[i % 3]) for i, (l, b) in enumerate(segments)] + [("other", other, "░"), ("free", free, " ")]
|
|
66
|
+
n = width - 2
|
|
67
|
+
raw = [b / total * n for _, b, _ in parts]
|
|
68
|
+
cells = [int(r) for r in raw]
|
|
69
|
+
for i in sorted(range(len(parts)), key=lambda i: raw[i] - cells[i], reverse=True)[: n - sum(cells)]:
|
|
70
|
+
cells[i] += 1
|
|
71
|
+
for i, (_, b, _) in enumerate(parts): # never hide a non-empty part
|
|
72
|
+
if b and not cells[i]:
|
|
73
|
+
cells[cells.index(max(cells))] -= 1; cells[i] = 1
|
|
74
|
+
legend, cur = [], ""
|
|
75
|
+
for l, b, c in parts:
|
|
76
|
+
item = f"{c} {l.lower()} {size(b).replace(' ', '')}".strip()
|
|
77
|
+
if cur and len(cur) + 2 + len(item) > n:
|
|
78
|
+
legend.append(cur); cur = item
|
|
79
|
+
else:
|
|
80
|
+
cur = f"{cur} {item}" if cur else item
|
|
81
|
+
legend.append(cur)
|
|
82
|
+
tag = size(total)
|
|
83
|
+
head = "┌─ " + bold(title) + " " + "─" * (width - len(title) - len(tag) - 5) + " " + tag + " ┐"
|
|
84
|
+
row = lambda t: "│ " + t.ljust(n) + " │"
|
|
85
|
+
return [head, row(""), row("".join(c * k for (_, _, c), k in zip(parts, cells)))] + [row(x) for x in legend] + ["└" + "─" * width + "┘"]
|
|
86
|
+
|
|
87
|
+
def render(*boxes):
|
|
88
|
+
"""Print boxes two per row."""
|
|
89
|
+
for i in range(0, len(boxes), 2):
|
|
90
|
+
print("\n".join(side_by_side(boxes[i], boxes[i+1]) if i+1 < len(boxes) else boxes[i]))
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"allowImportingTsExtensions": true,
|
|
8
|
+
"paths": { "@web/*": ["./web/*"], "@lib/*": ["./web/lib/*"], "@components/*": ["./web/components/*"] },
|
|
9
|
+
"types": ["bun"],
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"strict": false,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"lib": ["ESNext", "DOM", "DOM.Iterable"]
|
|
14
|
+
},
|
|
15
|
+
"include": ["web", "test"]
|
|
16
|
+
}
|
package/web/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# web/ — the board's front end
|
|
2
|
+
|
|
3
|
+
The board is React (Tailwind + Radix through `ui/`) built into `dist/board.js`. Each page is one small `App`
|
|
4
|
+
(`pages/board/App.tsx`, `pages/notebook/App.tsx`, `pages/popup/App.tsx`) rendered into `<div id="root">`; there is no `board/` folder any more: the
|
|
5
|
+
engines that react to the server and the router live in the feature folders of `lib/`, the page's glue in `pages/board/`. `bun run build:web` bundles everything into `dist/`
|
|
6
|
+
and a test fails when the committed bundles are stale. `checks/structure.test.ts` enforces the rules below.
|
|
7
|
+
|
|
8
|
+
## What is in web/
|
|
9
|
+
|
|
10
|
+
Only folders and this file; `checks/structure.test.ts` (which checks the whole tree, so
|
|
11
|
+
it stays here; it also fails on any other file at this level).
|
|
12
|
+
|
|
13
|
+
| Path | Holds |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `html/` | `board.html`, `notes.html`, `popup.html`: shells of about 12 lines (the head, `<div id="root">`, the page's one stylesheet and one script; no inline CSS, markup or script, a test holds it). `video.html` is still a whole page. |
|
|
16
|
+
| `notebook/` | The Notes page's entry (`notebook.ts`: boots the shell, renders `pages/notebook/App.tsx`), `kit.ts` (registers the kit's stores as `window.kzKit` for code shared with Video), `kit-loader.ts` (hands that kit to shared code) and `notes-lib.ts` (re-exports `lib/notebook/text.ts` for `cli/`). |
|
|
17
|
+
| `popup/` | The chat popup's entry (`popup.ts`): renders `pages/popup/App.tsx` (`kaizen chat`), bundled to `dist/popup.js`. |
|
|
18
|
+
| `term/` | The in-card terminal's entry (`term.ts`, xterm.js) with its font and paste helpers and their tests. |
|
|
19
|
+
| `video/` | The Video page's entry (`video.ts`). |
|
|
20
|
+
| `annotate/` | `annotate.ts`: the annotator's page-side script (the part injected into the framed page: picker, overlay, note box, picture of the pick), bundled to `dist/annotate.js`. It imports only `lib/annotate/page.ts`. |
|
|
21
|
+
| `ui/`, `components/`, `pages/`, `lib/` | The board's layers, below. `ui/theme.css` is the Tailwind theme the kit is built from; `ui/legacy/` holds the page styles that were inline in the shells (`board.css`, `notes.css`, `popup.css`), moved unchanged and not yet rewritten as utilities. |
|
|
22
|
+
| `dist/` | Generated by `bun run build:web`, committed, never edited: `board.js`, `notebook.js`, `popup.js`, `term.js`, `video.js`, `annotate.js`, and the stylesheets `ui.css` (the kit; Video links it), `board.css` and `notebook.css` (the kit and the page's styles, one link per page), `popup.css`, `term.css`. |
|
|
23
|
+
| `sounds/` | The notification sounds the board plays. |
|
|
24
|
+
|
|
25
|
+
The server keeps serving the bundles at their old flat URLs (`/board.js`, `/ui.css`, `/notebook.js`,
|
|
26
|
+
`/term.js`, `/term.css`, `/video.js`, `/annotate.js`; the new `/board.css`, `/notebook.css`, `/popup.css` and `/popup.js` are in `AT_START` in `cli/web.ts`, which a test checks for every file in `html/` and `dist/`); only the files on disk moved, so a board that is
|
|
27
|
+
running during `kaizen upgrade` and old pages keep working. Entry sources are grouped by app because each
|
|
28
|
+
bundle's imports are the app's own helpers plus the layers below; `lib/` may import
|
|
29
|
+
a helper from an app folder (`notebook/notes-lib.ts`).
|
|
30
|
+
|
|
31
|
+
## Layers (imports only go downward)
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
pages/ -> components/<feature>/ -> ui/ -> lib/core/utils.ts
|
|
35
|
+
\-> lib/<feature>/ (lib imports only lib)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
| Folder | Holds |
|
|
39
|
+
|---|---|
|
|
40
|
+
| `pages/` | `board/`, `notebook/` and `popup/` each hold the page's `App.tsx` (providers, shell, the page picker, popups); the board's App is split into `header`, `pages`, `panel`, `portal`, `help` and `host`. Beside them one file per page: tasks, task, icebox, board, home, terminal, settings and notebook. Composes components; no logic of its own. The Board's App holds no state and is the page picker: the router (`lib/router`, no router library) holds the view the address names, `useRouteClasses` sets the `<body>` classes that show one page area, a page is drawn the first time its view opens (`Once`) and kept after, and the panel's body is one component (`pages/board/panel.tsx`) that shows what `lib/run/panel-store.ts` says and unmounts what it replaces. |
|
|
41
|
+
| `components/<feature>/` | Pieces a page draws. Popups, dialogs and menus come from `ui/`, never hand-built, no `innerHTML`. |
|
|
42
|
+
| `ui/` | Flat, one file per control (button, dialog, popover, select...). The only place that touches Radix or cmdk. |
|
|
43
|
+
| `lib/<feature>/` | Rules, stores (zustand), actions (requests) and hooks for one feature. No JSX. |
|
|
44
|
+
| `boot/` | `boot.ts`, built to `dist/boot.js` (1 KB): a blocking script in the head of the board and the Notebook that puts the stored theme, colour, motion and menu fold on `<html>` before the first paint (the one script besides the bundle; no inline script). |
|
|
45
|
+
| (no `board/`) | The old `board/` plumbing is gone and none is left as a named exception: the engines (`init…` functions that react to `lib/server` and `lib/router`) are in their feature folders (`lib/run`: the panel as `panel-store.ts`, `panel-actions.ts`, `panel-derive.ts` (pure) and the `usePanelRun` hook; `workspace.ts` (lifecycle) with `ws-derive.ts`, `ws-store.ts`, `ws-draw.ts`, `ws-actions.ts`, `kept.ts` and the `useRunLifecycle` hook, `card-terminal.ts`; `lib/board`: `snapshot.ts`, `on-state.ts`, `popups.ts`, `nav.ts`; and `lib/home`, `lib/terminal`, `lib/context`, `lib/git`, `lib/settings`, `lib/project`, `lib/search`, `lib/rail/rail-boot.ts`), and the page's glue in `pages/board/` (`main.ts`, `use-boot.ts` (the App's start-up effects), `views.ts`, `keys.ts`, `live.ts`, `host-bridge.ts`, which also answers `host.open`: what a page opens in place). The test `web/board is gone` fails on a new `web/board/` folder or an import of one; `BY_DESIGN` in `checks/structure.test.ts` names the only files left imperative on purpose (the terminal engine, the annotator's page script, CodeMirror, the note editor, dictation, the gestures), each with a signature the file must still show; every other `.ts` file in `lib/` and `pages/` is a module under the rules (no polling the server but `lib/server`, no page class but `lib/router`, no look-up of an element by id or selector but the named places, never a file that only forwards). |
|
|
46
|
+
|
|
47
|
+
## Feature folders
|
|
48
|
+
|
|
49
|
+
`components/<f>/` and `lib/<f>/` use the same name when both exist.
|
|
50
|
+
|
|
51
|
+
| Folder | What it is |
|
|
52
|
+
|---|---|
|
|
53
|
+
| `shared` | Pieces two or more features use: chip, icon button, field, picker, segmented, pager, project mark, empty state, confirm dialog and `AskHost`, mic/attach buttons, and the hooks `use-draft`, `use-narrow`, `use-pager`. |
|
|
54
|
+
| `core` (lib only) | Generic helpers and the base model: `api`, `host`, `utils`, `format`, `labels`, `toast`, `store` (the Tasks pages' state), `ask`, plus `board.ts` (the card/run model) and `brief`. |
|
|
55
|
+
| `task` | The Tasks list and one task: rows, status badge, chat bubbles, result view, artifact frame; `useTasks`, `useTask`, `useDock`. |
|
|
56
|
+
| `decision` | The decision bar a task or run waits on, and its forms (revise, reply, plan answers). |
|
|
57
|
+
| `icebox` | Icebox requests (row, card, phone row, swipe deck), capture box, sources (card, form, drawer), collections, board/kind/snooze menus. |
|
|
58
|
+
| `board` | The Kanban board: card, column, popups, the New task / run / card forms, the mode switch. |
|
|
59
|
+
| `run` | The run panel and run view: head, tabs, history, picker, footer, wait/empty states, file viewer, fix form; the centre's panes (`run-panes`, `pane`, `pane-gutter`) and panel grip; in `lib/run`: the pane layout rules (`layout`) and its saved store (`layout-store`), the Browser's history (`browser`), `run-actions`. |
|
|
60
|
+
| `panes` | What fills a pane of the run workspace: `TerminalPane` (xterm.js, mounted once; also the Home window's terminal, the Terminal page's and the in-card agent's in the run panel), `BrowserPane` (address bar, frame, annotator) and `PreviewPane` (the run's Preview: report, screenshots, or the agent's last `kaizen preview`; its rules are `lib/run/preview.ts`). |
|
|
61
|
+
| `terminal` | The Terminal page (`?view=terminal`): the tiles of every agent session and shell (header, state, Resume, maximise, hide, exit, drag to swap), the border handles, the hidden chips, a phone's tabs, and the header's layout switch. `lib/terminal`: the rules (`layout`: arrange, grid shape, handle places, drag math), the store (sessions from `lib/terminal/terms-feed.ts`, the saved `kz-terms` layout) and the Ctrl+Shift+M / Alt+1-9 keys; `sessions` (one tile per PTY) and `viewport` (the phone's keyboard fit, used by `term/term.ts`). Each terminal is a `TerminalPane`. |
|
|
62
|
+
| `footer` | The board's footer bar: Claude and Codex usage chips (the phone page's `UsageChips`, opening on hover or focus here), the refresh button, the resource button, the live terminal count and the phone chip; `lib/footer` holds what the chips read (store, the phone chip's words). The board's status strip (a chip per status, the Archive chip, the phone's status button and its popover) is in `board`, its rules in `lib/board/strip.ts`. |
|
|
63
|
+
| `server` | What the server says, as slices of one Zustand store: this page's `/state`, every project's cards and agents (`/state?all=1`), the tasks that need you, `/sources` and the live shells. `poller.ts` is the only reader (quiet gap, hidden-tab gap, identical replies skipped, the event stream, the all-projects read at most every 2 s); the board's engines hear of a new `/state` through `setEngine` and `onState`. Components read the slice they draw (`useRailData`, `useLiveTerminals`). Pure rules in `poll-rules.ts`, tested. |
|
|
64
|
+
| `router` | The Board's router as a store: the view the address names (`?view=`, `ws`/`icebox`/`ideas` aliases, the phone's rules), the lit menu item, title, drawn-once pages, the query and the run it names. `navigate` is the only way a view changes; `startRouter` takes the menu links and back/forward; `setRouterHooks` is where `pages/board/views.ts` starts what the docked panel, run workspace and Home still do. Rules in `route-rules.ts`, tested. |
|
|
65
|
+
| `shell` | The page's frame, shared by the Board and the Notebook: `Rail` (the side menu: logo, fold, search, pages, Projects list and filter, Settings with the update dot, theme switch), `Sprite` (the SVG icons every `<use href="#i-...">` points at) and `Wordmark`. `lib/shell`: the view and which pages have been seen (`shell-store`), the title and lit item rules, and the page's look (theme, colour, motion, fold, the desktop and iPhone-app fit) kept in `localStorage` and applied by `bootShell()` (`appearance`); Settings and onboarding call `setTheme`, `setColor`, `setMotion`, which replace the old `window.setTheme` globals. |
|
|
66
|
+
| `context` | The Project context pane (Files, Notes, Terminal sessions): a side pane or, narrow, a dialog that makes the page behind inert and keeps Tab inside. `lib/context`: the rows' words, the requests (`/project-tree`, `/project-text`, `/vault`) and the store. It keeps the board's own markup and CSS (kz-keep). Its open button (`ContextOpen`) is in the Board header, shown on the Board; the pane reads nothing while closed. |
|
|
67
|
+
| `git` | The run's Source control tab. |
|
|
68
|
+
| `layout` | Page templates. `PageFrame`: the shape of the Chat screen for a page that draws its own sidebar. Slots: `sidebar` (280 px, like the side menu), `title` and `actions` (the header bar, 52 px, in a rounded bordered card), children (the scrolling body, `bodyRef` for scroll-to-top), and `phone` (`sidebar` or `content`: which one shows at 640 px and below, where the card and header bar go). The card keeps the shell's 8 px gap above and beside it and ends flush on the footer. Use it for any page that is a sidebar beside one page of content (Settings, its loading skeleton); a page that lives in the shell's own card (Chat, the Board) already has this look from `.app` and the Header, and does not use it. |
|
|
69
|
+
| `settings` | Settings page rows, nav, sections, update bar; settings store and actions, update check (the microphone choice row is here, its rules are `dictation`). |
|
|
70
|
+
| `notes` | A card's Notes tab in the panel: the notes as messages, the box that adds one (over the note editor `lib/notes/rich.ts`, reached through `host.rich`), files picked and pasted; `lib/notes` holds the notes-file rules, the per-card files store and the send. |
|
|
71
|
+
| `notebook` | The Notes page (its own bundle, `notebook.js`): header with the project Picker, sidebar (search, tags, folder tree), the paper (name box, meta bar, backlinks, blank states) and `EditorPane`, the CodeMirror engine as one component. In `lib/notebook`: the text rules (`text`, also for `cli/`), search, tag, backlink and rename rules (`vault-rules`), the 600 ms save as a state machine (`autosave`), the store, actions and session (`vault-*`), the page-turn animation (`deal`) and the engine (`engine*`). Not `notes`, which is a card's Notes tab. |
|
|
72
|
+
| `dictation` (lib only) | Speech to text in the page: the Whisper worker and recording session (`engine`), the chunk, order and caret rules (`chunks`), each button's state (`dictation-store`), Ctrl+Alt+D into a terminal, and the microphone choice (`mic`). The button is `MicButton` in `shared`. |
|
|
73
|
+
| `phone` | Phone setup (QR, WhatsApp card), the phone-sized new-run sheets, and the phone's Home and Runs pages (agents, devices, runs, usage chips; `lib/phone`: their rules, the store, the taps' requests, the run sheet's swipe rules) with the tap tick. |
|
|
74
|
+
| `home` | Home: chat list, messages, composer, onboarding dialog; the home store; the floating Home window (its tabs, drag, minimized sidebar row and "+" menu; `lib/home/home-window.ts` holds its rules and requests, the terminal is `panes`' `TerminalPane`). |
|
|
75
|
+
| `annotate` | The Browser tab's annotator, board side: the dark toolbar, the notes list with its settings box (`components/annotate`, mounted by `BrowserPane` (in `panes`) as `AnnotatePanel`). In `lib/annotate`: the note model and request bodies (`notes`), the message and address rules (`rules`: only the frame, the proxy origin and the open's token are heard), the page-side rules the injected script shares (`page`: selection geometry, where the box opens, what a note holds, the plan for the picture), and the Zustand store with the keys and the conversation with the page (`session`, one per Browser tab). |
|
|
76
|
+
| `project` | Project picker, Add project dialog, workspace menu, branch rules. |
|
|
77
|
+
| `rail` | The side menu's Projects list (rows, folds, pins, project drag, agent chips, task links, worktree right-click menu), its filter and the Icebox item's source marks (`SourceMarks`); rules, store and requests in `lib/rail`. Rows keep the board's legacy classes. |
|
|
78
|
+
| `resources` | The footer resource popup: Memory, Storage, Terminals; store, requests and sizes in `lib/resources`. |
|
|
79
|
+
| `search` | The search palette and its matching. |
|
|
80
|
+
| `markdown`, `url` | The markdown renderer (component and parser) and `safeUrl`, kept apart so the notebook bundle takes only `safeUrl`. |
|
|
81
|
+
|
|
82
|
+
## Rules
|
|
83
|
+
|
|
84
|
+
- **Index.** Every feature folder has an `index.ts` exporting what other folders use. Import another
|
|
85
|
+
folder through it (`../../lib/task/index.ts`), never a file inside it. Inside a folder, import files
|
|
86
|
+
directly (that keeps barrels out of cycles). `import type` follows the same rule.
|
|
87
|
+
- **Size.** A folder over 25 files is split by feature.
|
|
88
|
+
- **Where to add a thing.** Used by one feature: that feature's folder. Used by two: `shared` (a
|
|
89
|
+
component) or `core` (a helper), and add it to the index. A new feature: a folder in `components/`
|
|
90
|
+
and `lib/` with an `index.ts`, and a row in the table above.
|
|
91
|
+
- **Names.** Kebab-case files (`task-row.tsx`, `use-task.ts`); the file's main export is its
|
|
92
|
+
PascalCase name; hooks start with `use-`; stores end `-store`, request functions `-actions`.
|
|
93
|
+
Tests live beside the code they test as `*.test.ts` (in the feature folder, , import the file they test directly, and are not counted in the 25-file limit; an `index.ts` never exports them. `checks/structure.test.ts` stays in `web/` because it checks the whole tree.
|
|
94
|
+
- **Nothing draws by hand.** No `innerHTML`, `insertAdjacentHTML`, `DOMParser`, `createContextualFragment`, hand-built dialog or `x.createElement(...)` on any document anywhere in `web/` except `video/` (its own page, no React) and the named files in `EXEMPT` (`checks/structure.test.ts`), each with its reason and the most uses it may keep (a new use fails until the count is raised on purpose): `term/term.ts` (xterm's own bundle: find box, paste, reconnect strip and the phone key bar, whose `pointerdown` + `preventDefault` keeps the soft keyboard open; turning it into React needs a controller API out of the engine and a real phone to check), `lib/notes/rich.ts` (the note editor's contenteditable engine), `annotate/annotate.ts` (injected into the framed page), the two CodeMirror widget files, `pages/tasks-page.tsx` (one span in the header), and Video's fallback toast (`lib/core/notices.ts`). A stale line fails the test.
|
|
95
|
+
- **Exceptions.** `ui/` takes `lib/core/utils.ts` directly. A few bridge files (`rail-boot`, `search-rows`, `ws-tabs`, `ws-board`, and the board's `main.ts` and `use-boot.ts`) import small lib files
|
|
96
|
+
directly because they run in the notebook and Video bundles or in DOM-less tests, where a
|
|
97
|
+
barrel would pull in the board's stores (list: `BRIDGE_DIRECT` in `checks/structure.test.ts`).
|
|
98
|
+
- **Core's type imports.** `lib/core/api.ts` and `store.ts` use `import type` from `lib/task` and
|
|
99
|
+
`lib/icebox` for data shapes; erased at build, so no runtime cycle.
|
|
100
|
+
|
|
101
|
+
## Imports
|
|
102
|
+
Across folders always use an alias (tsconfig `paths`, resolved by Bun), never `../../`:
|
|
103
|
+
`import { Button } from "@web/ui"`, `import { useGit } from "@lib/git"`, `import { ActionMenu } from "@components/shared"`.
|
|
104
|
+
A folder alias means its `index.ts`; a file alias keeps its extension (`@lib/core/labels.ts`, only the listed bridge files).
|
|
105
|
+
Inside one folder import siblings relatively (`./card-footer.tsx`). New ui files get one line in `web/ui/index.ts`.
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
// kaizen's annotator, the script the board's proxy adds to a framed page (cli/annotate-proxy.ts).
|
|
2
|
-
//
|
|
1
|
+
// kaizen's annotator, the script the board's proxy adds to a framed page (cli/annotate-proxy.ts). Bundled by
|
|
2
|
+
// `bun run build:web` into web/dist/annotate.js, one wrapped script with no dependencies and nothing else loaded
|
|
3
|
+
// (the rules that need no page are in web/lib/annotate/page.ts). It lets the user pick an element, text, several
|
|
3
4
|
// elements or an area, write a note and see numbered markers. It never changes the page except for
|
|
4
5
|
// its own overlay (and Pause). It talks to the board only by postMessage, signed with the per-open
|
|
5
6
|
// token in its own URL; the board keeps the notes and decides what to do with them.
|
|
7
|
+
import { AREA_MAX, CROP_BUDGET, CROP_CHARS, areaBigEnough, areaLabel, buildNote, composerPos, cropScales, cropWindow, goodClass, insideArea, markerPos, quote, rectOf, tipPos, tooBig, union } from "@lib/annotate/page.ts";
|
|
8
|
+
|
|
6
9
|
(() => {
|
|
7
10
|
// Framed by the board, or the desktop app's Browser tab (a <webview>, where the page has no parent
|
|
8
11
|
// and the app's preload sets __kzHost and relays the messages).
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
const W = window as any;
|
|
13
|
+
const hosted = window.parent !== window || W.__kzHost === true;
|
|
14
|
+
if (W.__kzAnnotate || !hosted) return;
|
|
15
|
+
W.__kzAnnotate = true;
|
|
16
|
+
const script = document.currentScript as HTMLScriptElement | null;
|
|
13
17
|
// The proxy's <script src="…?t=token">, or (desktop app, public site) the token the board set
|
|
14
18
|
// before running this script in the page.
|
|
15
|
-
let token = typeof
|
|
16
|
-
if (!token) try { token = new URL(script
|
|
19
|
+
let token = typeof W.__kzAnnToken === "string" ? W.__kzAnnToken : "";
|
|
20
|
+
if (!token) try { token = new URL(script!.src).searchParams.get("t") || ""; } catch {}
|
|
17
21
|
const parent = window.parent;
|
|
18
22
|
// `out` marks what the page says, so the webview's relay forwards it and not what the board sends.
|
|
19
23
|
const send = (m) => parent.postMessage({ kz: 1, t: token, out: 1, ...m }, "*");
|
|
@@ -50,7 +54,6 @@
|
|
|
50
54
|
// ---- naming an element: a selector that finds exactly it, a path, source and component ----
|
|
51
55
|
const esc = (s) => (window.CSS && CSS.escape ? CSS.escape(s) : s.replace(/[^\w-]/g, "\\$&"));
|
|
52
56
|
const uniq = (sel) => { try { return document.querySelectorAll(sel).length === 1; } catch { return false; } };
|
|
53
|
-
const goodClass = (c) => c.length < 24 && !/\d{3,}|^css-|^_|^sc-|^jsx-/.test(c);
|
|
54
57
|
function selectorFor(el) {
|
|
55
58
|
if (el.id && uniq("#" + esc(el.id))) return "#" + esc(el.id);
|
|
56
59
|
const t = el.getAttribute("data-testid");
|
|
@@ -112,7 +115,8 @@
|
|
|
112
115
|
const host = document.createElement("div");
|
|
113
116
|
host.style.cssText = "all:initial;position:fixed;inset:0;z-index:2147483647;pointer-events:none";
|
|
114
117
|
const root = host.attachShadow({ mode: "closed" });
|
|
115
|
-
|
|
118
|
+
const sheet = document.createElement("style");
|
|
119
|
+
sheet.textContent = `
|
|
116
120
|
*{box-sizing:border-box;font:12px/1.4 system-ui,sans-serif}
|
|
117
121
|
.b{position:fixed;pointer-events:none;border:2px solid var(--c);background:color-mix(in srgb,var(--c) 14%,transparent);border-radius:2px}
|
|
118
122
|
.b.mk{border-width:1.5px;border-style:dashed;background:color-mix(in srgb,var(--c) 6%,transparent)}.b.mk.on{border-style:solid;background:color-mix(in srgb,var(--c) 14%,transparent)}
|
|
@@ -134,15 +138,15 @@
|
|
|
134
138
|
.t{position:fixed;width:260px;background:#1c1c1e;color:#f2f2f7;border:1px solid #2c2c2e;border-radius:12px;padding:8px 12px;pointer-events:none;box-shadow:0 8px 28px #0008;white-space:pre-wrap;word-break:break-word}
|
|
135
139
|
.t small{display:block;color:#98989f;margin-top:4px}
|
|
136
140
|
.p{position:fixed;left:50%;bottom:18px;transform:translateX(-50%);background:#1c1c1e;color:#f2f2f7;border:1px solid #2c2c2e;border-radius:999px;padding:6px 8px 6px 16px;pointer-events:auto;display:flex;gap:8px;align-items:center}
|
|
137
|
-
|
|
138
|
-
const layer =
|
|
141
|
+
`;
|
|
142
|
+
const layer = document.createElement("div");
|
|
143
|
+
root.append(sheet, layer);
|
|
139
144
|
layer.style.setProperty("--c", cfg.color);
|
|
140
145
|
const mount = () => document.documentElement.append(host);
|
|
141
146
|
mount();
|
|
142
147
|
|
|
143
148
|
const el = (cls, css, text) => { const d = document.createElement("div"); d.className = cls; if (css) d.style.cssText = css; if (text) d.textContent = text; return d; };
|
|
144
149
|
const box = (r, cls = "b") => el(cls, `left:${r.left}px;top:${r.top}px;width:${r.width}px;height:${r.height}px`);
|
|
145
|
-
const union = (rs) => { const l = Math.min(...rs.map((r) => r.left)), t = Math.min(...rs.map((r) => r.top)), rr = Math.max(...rs.map((r) => r.right)), b = Math.max(...rs.map((r) => r.bottom)); return { left: l, top: t, right: rr, bottom: b, width: rr - l, height: b - t }; };
|
|
146
150
|
|
|
147
151
|
let hov = null, tip = null;
|
|
148
152
|
function paint() {
|
|
@@ -172,14 +176,16 @@
|
|
|
172
176
|
if (!r) return;
|
|
173
177
|
// What the note marks stays outlined (dashed; solid while its number is hovered), not only its number.
|
|
174
178
|
add(box(r, "b mk" + (m.kind === "multi" || m.kind === "area" ? " g" : "") + (tip === m ? " on" : "")));
|
|
175
|
-
const
|
|
179
|
+
const mp = markerPos(r, innerWidth);
|
|
180
|
+
const d = el("m dyn" + (m.kind === "multi" || m.kind === "area" ? " g" : ""), `left:${mp.left}px;top:${mp.top}px`, String(m.n));
|
|
176
181
|
d.onclick = (e) => { e.stopPropagation(); send({ type: "marker", n: m.n }); };
|
|
177
|
-
d.onmouseenter = () => { tip = m; paint(); };
|
|
178
|
-
d.onmouseleave = () => { tip = null; paint(); };
|
|
182
|
+
d.onmouseenter = () => { if (tip !== m) { tip = m; paint(); } };
|
|
183
|
+
d.onmouseleave = () => { if (tip === m) { tip = null; paint(); } };
|
|
179
184
|
add(d);
|
|
180
185
|
// the comment sits under its block, as in Agentation
|
|
181
186
|
if (tip === m && m.comment && !draft) {
|
|
182
|
-
const
|
|
187
|
+
const tp = tipPos(r, innerWidth, innerHeight);
|
|
188
|
+
const t = el("t", `left:${tp.left}px;top:${tp.top}px`);
|
|
183
189
|
t.append(String(m.comment).slice(0, 600));
|
|
184
190
|
const sm = document.createElement("small"); sm.textContent = `${m.intent || ""} · ${m.severity || ""}`; t.append(sm);
|
|
185
191
|
add(t);
|
|
@@ -187,7 +193,6 @@
|
|
|
187
193
|
});
|
|
188
194
|
}
|
|
189
195
|
}
|
|
190
|
-
const rectOf = (d) => { const l = Math.min(d.x0, d.x1), t = Math.min(d.y0, d.y1); return { left: l, top: t, width: Math.abs(d.x1 - d.x0), height: Math.abs(d.y1 - d.y0), right: l + Math.abs(d.x1 - d.x0), bottom: t + Math.abs(d.y1 - d.y0) }; };
|
|
191
196
|
|
|
192
197
|
// ---- the note box ----
|
|
193
198
|
let composer = null;
|
|
@@ -196,9 +201,9 @@
|
|
|
196
201
|
closeComposerUi();
|
|
197
202
|
const r = d.rect;
|
|
198
203
|
const c = el("c");
|
|
199
|
-
const
|
|
200
|
-
c.style.left =
|
|
201
|
-
c.style.top =
|
|
204
|
+
const at = composerPos(r, innerWidth, innerHeight);
|
|
205
|
+
c.style.left = at.left + "px";
|
|
206
|
+
c.style.top = at.top + "px";
|
|
202
207
|
const code = document.createElement("code"); code.textContent = d.label;
|
|
203
208
|
const ta = document.createElement("textarea"); ta.placeholder = d.kind === "text" ? "What should change about this text?" : "What should change?";
|
|
204
209
|
const row = el("r");
|
|
@@ -224,19 +229,18 @@
|
|
|
224
229
|
async function finish(comment, intent, severity) {
|
|
225
230
|
const d = draft, first = d.els[0];
|
|
226
231
|
closeComposerUi();
|
|
227
|
-
const note = {
|
|
228
|
-
kind: d.kind, comment, intent, severity,
|
|
229
|
-
selector: selectorFor(first), items: d.els.length > 1 ? d.els.map(selectorFor) : [],
|
|
230
|
-
path: pathOf(first), text: textOf(first).slice(0, 200), tag: describe(first), url: location.href,
|
|
231
|
-
box: `${Math.round(d.rect.left + scrollX)},${Math.round(d.rect.top + scrollY)} ${Math.round(d.rect.width)}x${Math.round(d.rect.height)}`,
|
|
232
|
-
pb: { x: d.rect.left + scrollX, y: d.rect.top + scrollY, w: d.rect.width, h: d.rect.height }, page: location.pathname,
|
|
233
|
-
attrs: attrsOf(first), styles: stylesOf(first),
|
|
234
|
-
nearby: [first.previousElementSibling, first.nextElementSibling].filter(Boolean).map((e) => textOf(e).slice(0, 80)).filter(Boolean).join(" | "),
|
|
235
|
-
selected: d.selected || "",
|
|
236
|
-
};
|
|
237
232
|
const s = sourceOf(first);
|
|
238
|
-
note
|
|
239
|
-
|
|
233
|
+
const note: any = buildNote(
|
|
234
|
+
{ kind: d.kind, rect: d.rect, count: d.els.length, selected: d.selected },
|
|
235
|
+
{
|
|
236
|
+
selector: selectorFor(first), items: d.els.length > 1 ? d.els.map(selectorFor) : [], path: pathOf(first), text: textOf(first), tag: describe(first), url: location.href, page: location.pathname,
|
|
237
|
+
attrs: attrsOf(first), styles: stylesOf(first),
|
|
238
|
+
nearby: [first.previousElementSibling, first.nextElementSibling].filter(Boolean).map((e) => textOf(e).slice(0, 80)).filter(Boolean).join(" | "),
|
|
239
|
+
source: s.source, components: cfg.components ? s.components : "",
|
|
240
|
+
},
|
|
241
|
+
{ comment, intent, severity },
|
|
242
|
+
{ x: scrollX, y: scrollY },
|
|
243
|
+
);
|
|
240
244
|
draft = null; multi = []; paint();
|
|
241
245
|
note.crop = await crop(d.els, d.rect);
|
|
242
246
|
send({ type: "note", note });
|
|
@@ -270,19 +274,16 @@
|
|
|
270
274
|
try {
|
|
271
275
|
let base = common(els);
|
|
272
276
|
let br = base.getBoundingClientRect();
|
|
273
|
-
if (br
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const w
|
|
277
|
+
if (tooBig(br)) { base = els[0]; br = base.getBoundingClientRect(); }
|
|
278
|
+
const win = cropWindow(br, want);
|
|
279
|
+
if (!win) return undefined;
|
|
280
|
+
const { w, h, sx, sy, sw, sh } = win;
|
|
281
|
+
const c = snap(base, { n: CROP_BUDGET });
|
|
277
282
|
c.style.cssText += `;margin:0;transform:none;position:static;width:${w}px;height:${h}px;box-sizing:border-box`;
|
|
278
283
|
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}"><foreignObject x="0" y="0" width="100%" height="100%">${new XMLSerializer().serializeToString(c)}</foreignObject></svg>`;
|
|
279
284
|
const img = new Image();
|
|
280
285
|
await new Promise((ok, no) => { img.onload = ok; img.onerror = () => no(new Error("render")); setTimeout(() => no(new Error("timeout")), 2500); img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svg); });
|
|
281
|
-
const
|
|
282
|
-
const sw = Math.min(w - sx, want.width), sh = Math.min(h - sy, want.height);
|
|
283
|
-
if (sw < 2 || sh < 2) return undefined;
|
|
284
|
-
for (let k = Math.min(2, window.devicePixelRatio || 1); k >= 0.5; k -= 0.5) {
|
|
285
|
-
const scale = Math.min(k, 1600 / Math.max(sw, sh));
|
|
286
|
+
for (const scale of cropScales(sw, sh, window.devicePixelRatio)) {
|
|
286
287
|
const cv = document.createElement("canvas");
|
|
287
288
|
cv.width = Math.round(sw * scale); cv.height = Math.round(sh * scale);
|
|
288
289
|
const g = cv.getContext("2d");
|
|
@@ -291,7 +292,7 @@
|
|
|
291
292
|
g.fillRect(0, 0, cv.width, cv.height);
|
|
292
293
|
g.drawImage(img, sx, sy, sw, sh, 0, 0, cv.width, cv.height);
|
|
293
294
|
const url = cv.toDataURL("image/png");
|
|
294
|
-
if (url.length <
|
|
295
|
+
if (url.length < CROP_CHARS) return url;
|
|
295
296
|
}
|
|
296
297
|
} catch {}
|
|
297
298
|
return undefined;
|
|
@@ -301,7 +302,7 @@
|
|
|
301
302
|
const inHost = (e) => e.composedPath && e.composedPath().includes(host);
|
|
302
303
|
const target = (x, y) => { const e = document.elementFromPoint(x, y); return e && e !== host && e !== document.documentElement ? e : null; };
|
|
303
304
|
const rectFor = (els) => union(els.map((e) => e.getBoundingClientRect()));
|
|
304
|
-
const quoted = (e) =>
|
|
305
|
+
const quoted = (e) => quote(textOf(e), describe(e));
|
|
305
306
|
const pickElement = (e) => openComposer({ kind: "element", els: [e], rect: rectFor([e]), label: quoted(e) });
|
|
306
307
|
function commitMulti() { if (!multi.length) return; const els = multi.slice(); openComposer({ kind: "multi", els, rect: rectFor(els), label: `${els.length} elements` }); }
|
|
307
308
|
function areaItems(r) {
|
|
@@ -309,9 +310,8 @@
|
|
|
309
310
|
for (const e of document.body.querySelectorAll("*")) {
|
|
310
311
|
if (SKIP.has(e.tagName) || e === host) continue;
|
|
311
312
|
const b = e.getBoundingClientRect();
|
|
312
|
-
if (b.
|
|
313
|
-
if (
|
|
314
|
-
if (out.length >= 20) break;
|
|
313
|
+
if (insideArea(b, r) && !out.some((o) => o.contains(e))) { for (let i = out.length - 1; i >= 0; i--) if (e.contains(out[i])) out.splice(i, 1); out.push(e); }
|
|
314
|
+
if (out.length >= AREA_MAX) break;
|
|
315
315
|
}
|
|
316
316
|
return out;
|
|
317
317
|
}
|
|
@@ -330,7 +330,7 @@
|
|
|
330
330
|
if (ev === "mousedown" && cfg.mode === "area" && e.button === 0) { e.preventDefault(); drag = { x0: e.clientX, y0: e.clientY, x1: e.clientX, y1: e.clientY }; stop(e); }
|
|
331
331
|
if (ev === "mouseup" && drag) {
|
|
332
332
|
const r = rectOf(drag); drag = null;
|
|
333
|
-
if (r
|
|
333
|
+
if (areaBigEnough(r)) { const els = areaItems(r); openComposer({ kind: "area", els: els.length ? els : [document.body], rect: r, label: areaLabel(r, els.length) }); } else paint();
|
|
334
334
|
}
|
|
335
335
|
if (ev === "mouseup" && cfg.mode === "text") {
|
|
336
336
|
setTimeout(() => {
|
|
@@ -363,7 +363,8 @@
|
|
|
363
363
|
}, true);
|
|
364
364
|
addEventListener("scroll", () => marks.length && paint(), true);
|
|
365
365
|
addEventListener("resize", () => paint());
|
|
366
|
-
|
|
366
|
+
// (not while a marker is hovered: paint() replaces the marker, and a click needs the same element from press to release)
|
|
367
|
+
setInterval(() => marks.length && !draft && !tip && paint(), 700);
|
|
367
368
|
|
|
368
369
|
// ---- the board speaks, the page listens (only the framing window, with the token) ----
|
|
369
370
|
addEventListener("message", (e) => {
|
|
@@ -377,7 +378,7 @@
|
|
|
377
378
|
if (cfg.mode !== "multi") multi = [];
|
|
378
379
|
document.documentElement.style.cursor = "";
|
|
379
380
|
paint();
|
|
380
|
-
} else if (d.type === "markers") { marks = Array.isArray(d.list) ? d.list : []; paint(); }
|
|
381
|
+
} else if (d.type === "markers") { marks = Array.isArray(d.list) ? d.list : []; if (tip) tip = marks.find((m) => m.n === tip.n) || null; paint(); }
|
|
381
382
|
else if (d.type === "commit") commitMulti();
|
|
382
383
|
else if (d.type === "copy" && typeof d.text === "string") {
|
|
383
384
|
(navigator.clipboard ? navigator.clipboard.writeText(d.text) : Promise.reject()).catch(() => {
|
package/web/boot/boot.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// A blocking script in the head of the board and the Notebook (served as /boot.js): the stored theme, colour, motion and menu
|
|
2
|
+
// fold are on <html> before the first paint, however long the bundle takes. Everything else starts with the bundle (bootShell).
|
|
3
|
+
import { applyStoredLook, fitStandalone } from "@lib/shell/stored-look.ts";
|
|
4
|
+
|
|
5
|
+
applyStoredLook();
|
|
6
|
+
fitStandalone();
|
|
7
|
+
document.documentElement.dataset.boot = "1";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { Annotator } from "@lib/annotate";
|
|
3
|
+
import { cn } from "@lib/core";
|
|
4
|
+
import { Icon } from "@web/ui";
|
|
5
|
+
|
|
6
|
+
const MODES: [string, string, string][] = [
|
|
7
|
+
["element", "a-pick", "Pick an element"],
|
|
8
|
+
["text", "a-text", "Select text"],
|
|
9
|
+
["multi", "a-multi", "Pick several elements"],
|
|
10
|
+
["area", "a-area", "Drag an area"],
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
// One icon button of the pill: a round 32 px target, lit when its tool is on, dimmed when it has nothing to act on.
|
|
14
|
+
function Tool({
|
|
15
|
+
icon,
|
|
16
|
+
title,
|
|
17
|
+
on,
|
|
18
|
+
off,
|
|
19
|
+
badge,
|
|
20
|
+
onClick,
|
|
21
|
+
}: {
|
|
22
|
+
icon: string;
|
|
23
|
+
title: string;
|
|
24
|
+
on?: boolean;
|
|
25
|
+
off?: boolean;
|
|
26
|
+
badge?: number;
|
|
27
|
+
onClick: () => void;
|
|
28
|
+
}) {
|
|
29
|
+
return (
|
|
30
|
+
<button
|
|
31
|
+
type="button"
|
|
32
|
+
title={title}
|
|
33
|
+
aria-label={title}
|
|
34
|
+
disabled={off}
|
|
35
|
+
onClick={onClick}
|
|
36
|
+
className={cn(
|
|
37
|
+
"relative m-0 grid size-8 cursor-pointer place-items-center rounded-full border-0 bg-transparent p-0 text-inherit hover:bg-[#2c2c2e] hover:text-white disabled:cursor-default disabled:opacity-35 disabled:hover:bg-transparent disabled:hover:text-inherit",
|
|
38
|
+
on && "bg-[#3a3a3c] text-white",
|
|
39
|
+
)}
|
|
40
|
+
>
|
|
41
|
+
<Icon name={icon} className="size-[17px]" />
|
|
42
|
+
{!!badge && (
|
|
43
|
+
<i className="absolute top-px right-0 h-[15px] min-w-[15px] rounded-lg bg-[#f59e0b] px-1 text-center text-[10px] leading-[15px] font-semibold text-[#1c1c1e] not-italic">
|
|
44
|
+
{badge}
|
|
45
|
+
</i>
|
|
46
|
+
)}
|
|
47
|
+
</button>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
const Sep = (): ReactNode => <span className="mx-1 h-[18px] w-px bg-[#3a3a3c]" />;
|
|
51
|
+
|
|
52
|
+
// Icon buttons in one dark pill, as in Agentation: modes, then pause, markers, copy, send, clear, notes, settings, close.
|
|
53
|
+
export function AnnotateBar({ ann, wide }: { ann: Annotator; wide: boolean }) {
|
|
54
|
+
const s = ann.use((x) => x),
|
|
55
|
+
none = !s.notes.length;
|
|
56
|
+
return (
|
|
57
|
+
<div
|
|
58
|
+
className={cn(
|
|
59
|
+
"absolute bottom-3.5 z-[6] flex max-w-[calc(100%-28px)] flex-wrap items-center justify-center gap-0.5 rounded-[26px] border border-[#3a3a3c] bg-[#1c1c1e] p-1.5 text-[#c7c7cc] shadow-[0_8px_28px_#0007]",
|
|
60
|
+
wide ? "right-[314px] max-sm:right-[254px]" : "right-3.5",
|
|
61
|
+
)}
|
|
62
|
+
>
|
|
63
|
+
{MODES.map(([id, icon, title]) => (
|
|
64
|
+
<Tool key={id} icon={icon} title={title} on={s.on && s.settings.mode === id} onClick={() => ann.mode(id)} />
|
|
65
|
+
))}
|
|
66
|
+
<Sep />
|
|
67
|
+
<Tool icon="a-pause" title="Freeze animations (P)" on={s.pause} onClick={ann.togglePause} />
|
|
68
|
+
<Tool icon="eye" title="Show or hide markers (H)" on={!s.hide} onClick={ann.toggleHide} />
|
|
69
|
+
<Tool icon="a-copy" title="Copy notes as markdown (C)" off={none} onClick={() => void ann.copy()} />
|
|
70
|
+
<Tool icon="send" title="Type the notes into this run's agent (S)" off={none} onClick={() => void ann.send()} />
|
|
71
|
+
<Tool icon="trash" title="Remove all notes (X)" off={none} onClick={ann.clear} />
|
|
72
|
+
<Sep />
|
|
73
|
+
<Tool icon="note" title="Notes list" on={s.list} badge={s.notes.length} onClick={ann.toggleList} />
|
|
74
|
+
<Tool icon="gear" title="Output detail, colour, behaviour" on={s.setOpen} onClick={ann.toggleSettings} />
|
|
75
|
+
<Tool icon="x" title="Close the annotator (the Annotate button brings it back)" onClick={ann.close} />
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
}
|