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,97 @@
|
|
|
1
|
+
// The page's look and the side menu's fold, kept per browser in localStorage and applied to <html> before the page draws (the
|
|
2
|
+
// stored values by /boot.js, stored-look.ts; the rest here):
|
|
3
|
+
// theme (light, dark, or unset for the system's), colour (blue or monochrome), motion (full, reduce, or the system's), the
|
|
4
|
+
// desktop app's classes, and the iPhone app's fit. The board and the Notebook call bootShell() first; Settings and
|
|
5
|
+
// onboarding call setTheme / setColor / setMotion. CSS keys off data-theme, data-color, data-motion, data-rail and data-hide.
|
|
6
|
+
import { termNow } from "@lib/core";
|
|
7
|
+
import { setShell, setSetupRow, getShell } from "./shell-store.ts";
|
|
8
|
+
import { applyFold, applyStoredLook, fitStandalone, PHONE, WIDE } from "./stored-look.ts";
|
|
9
|
+
|
|
10
|
+
type Desktop = { titleBar?: (dark: boolean) => void };
|
|
11
|
+
const root = () => document.documentElement;
|
|
12
|
+
const stored = (k: string) => {
|
|
13
|
+
try {
|
|
14
|
+
return localStorage.getItem(k);
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const keep = (k: string, v: string | null) => {
|
|
20
|
+
try {
|
|
21
|
+
v === null ? localStorage.removeItem(k) : localStorage.setItem(k, v);
|
|
22
|
+
} catch {}
|
|
23
|
+
};
|
|
24
|
+
const desk = () => (window as unknown as { kaizenDesktop?: Desktop }).kaizenDesktop;
|
|
25
|
+
const system = () => matchMedia("(prefers-color-scheme: dark)").matches;
|
|
26
|
+
const dark = () => (root().dataset.theme ? root().dataset.theme === "dark" : system());
|
|
27
|
+
// The theme toggle shows what is on screen; the desktop app's window buttons follow it.
|
|
28
|
+
const paint = () => {
|
|
29
|
+
setShell({ dark: dark() });
|
|
30
|
+
desk()?.titleBar?.(dark());
|
|
31
|
+
};
|
|
32
|
+
// A look changed: Settings redraws its Theme row (`look`) and every terminal repaints (term.js).
|
|
33
|
+
const changed = () => {
|
|
34
|
+
setShell((s) => ({ look: s.look + 1 }));
|
|
35
|
+
termNow()?.retheme();
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function setTheme(t: string) {
|
|
39
|
+
if (t === "system") delete root().dataset.theme;
|
|
40
|
+
else root().dataset.theme = t;
|
|
41
|
+
keep("kz-theme", t === "system" ? null : t);
|
|
42
|
+
paint();
|
|
43
|
+
changed();
|
|
44
|
+
}
|
|
45
|
+
export function setColor(c: string) {
|
|
46
|
+
if (c === "blue") root().dataset.color = c;
|
|
47
|
+
else delete root().dataset.color;
|
|
48
|
+
keep("kz-color", c === "blue" ? c : null);
|
|
49
|
+
changed();
|
|
50
|
+
}
|
|
51
|
+
export function setMotion(m: string) {
|
|
52
|
+
if (m === "system") delete root().dataset.motion;
|
|
53
|
+
else root().dataset.motion = m;
|
|
54
|
+
keep("kz-motion", m === "system" ? null : m);
|
|
55
|
+
}
|
|
56
|
+
export const toggleTheme = () => setTheme(getShell().dark ? "light" : "dark");
|
|
57
|
+
|
|
58
|
+
// The fold: see stored-look.ts; here it follows the width and the toggle.
|
|
59
|
+
let fold: string | null = null;
|
|
60
|
+
const wide = () => matchMedia(WIDE),
|
|
61
|
+
phone = () => matchMedia(PHONE);
|
|
62
|
+
const applyRail = () => setShell({ min: applyFold(root(), fold) });
|
|
63
|
+
export function toggleRail() {
|
|
64
|
+
fold = root().dataset.rail === "min" ? "full" : "min";
|
|
65
|
+
keep("kz-rail", fold);
|
|
66
|
+
applyRail();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let booted = false;
|
|
70
|
+
export function bootShell() {
|
|
71
|
+
if (booted) return;
|
|
72
|
+
booted = true;
|
|
73
|
+
// /boot.js (in the page head) has done these before the first paint; they are repeated for a page without it.
|
|
74
|
+
applyStoredLook();
|
|
75
|
+
if (!root().dataset.boot) fitStandalone();
|
|
76
|
+
fold = stored("kz-rail");
|
|
77
|
+
wide().addEventListener("change", applyRail);
|
|
78
|
+
phone().addEventListener("change", applyRail);
|
|
79
|
+
applyRail();
|
|
80
|
+
// Settings changed in another window or tab apply here at once, not on the next reload.
|
|
81
|
+
addEventListener("storage", (e) => {
|
|
82
|
+
const k = ({ "kz-theme": "theme", "kz-color": "color", "kz-motion": "motion" } as Record<string, string>)[
|
|
83
|
+
e.key ?? ""
|
|
84
|
+
];
|
|
85
|
+
if (!k) return;
|
|
86
|
+
if (e.newValue) root().dataset[k] = e.newValue;
|
|
87
|
+
else delete root().dataset[k];
|
|
88
|
+
changed();
|
|
89
|
+
});
|
|
90
|
+
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", paint);
|
|
91
|
+
paint();
|
|
92
|
+
// Setup: while first-run onboarding is skipped or unfinished, a row in the side menu continues it.
|
|
93
|
+
fetch("/onboarding")
|
|
94
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
95
|
+
.then(setSetupRow)
|
|
96
|
+
.catch(() => {});
|
|
97
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// The shortcut list (pages/board/help.tsx): shown by ? and the side menu's keyboard button, hidden by a click or Escape.
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
export const useHelp = create<{ on: boolean }>()(() => ({ on: false }));
|
|
4
|
+
export const setHelp = (on: boolean) => useHelp.setState({ on });
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// The page shell as state (Zustand): the theme and the side menu's folded state, and the Setup row. Which view shows is the
|
|
2
|
+
// router's (lib/router); the shell and the pages read it and never touch the page's elements.
|
|
3
|
+
import { create } from "zustand";
|
|
4
|
+
export type Setup = { resume: boolean; step: number; total: number };
|
|
5
|
+
export const useShell = create<{
|
|
6
|
+
dark: boolean;
|
|
7
|
+
min: boolean; // the side menu shows icons only
|
|
8
|
+
setup: Setup | null;
|
|
9
|
+
openSetup: (() => void) | null; // the Setup row's click, once onboarding is loaded (the board's); the link goes to the board before
|
|
10
|
+
look: number; // bumped when the theme or colour changes (what shows the choice redraws)
|
|
11
|
+
}>()(() => ({
|
|
12
|
+
dark: false,
|
|
13
|
+
min: false,
|
|
14
|
+
setup: null,
|
|
15
|
+
openSetup: null,
|
|
16
|
+
look: 0,
|
|
17
|
+
}));
|
|
18
|
+
export const getShell = useShell.getState;
|
|
19
|
+
export const setShell = useShell.setState;
|
|
20
|
+
|
|
21
|
+
// The Setup row follows what onboarding has saved: shown while setup is skipped or unfinished.
|
|
22
|
+
export const setSetupRow = (o: Partial<Setup> | null) =>
|
|
23
|
+
setShell({ setup: o && o.resume ? { resume: true, step: o.step ?? 0, total: o.total ?? 4 } : null });
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// What the page looks like before it draws, from what this browser kept: theme (light, dark, or unset for the system's),
|
|
2
|
+
// colour, motion, the side menu's fold, the desktop app's classes and the iPhone app's fit. No imports: it is the whole of
|
|
3
|
+
// web/boot/boot.ts (a tiny blocking script in the page head, so the first paint is already the person's theme) and the first
|
|
4
|
+
// thing bootShell() does again when the bundle starts.
|
|
5
|
+
type Desktop = { platform?: string };
|
|
6
|
+
const get = (k: string) => {
|
|
7
|
+
try {
|
|
8
|
+
return localStorage.getItem(k);
|
|
9
|
+
} catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
// The fold: the person's choice (kz-rail) wins; with none the width decides; a phone always gets icons.
|
|
14
|
+
export const WIDE = "(max-width:1100px)";
|
|
15
|
+
export const PHONE = "(max-width:640px)";
|
|
16
|
+
export const folded = (fold: string | null, wide: boolean, phone: boolean) => phone || (fold ? fold === "min" : wide);
|
|
17
|
+
// Sets data-rail and data-hide for `fold` ("min", "full" or null: none chosen); true when the menu shows icons only.
|
|
18
|
+
export function applyFold(root: HTMLElement, fold: string | null) {
|
|
19
|
+
const phone = matchMedia(PHONE).matches,
|
|
20
|
+
min = folded(fold, matchMedia(WIDE).matches, phone);
|
|
21
|
+
root.dataset.rail = min ? "min" : "full";
|
|
22
|
+
root.dataset.hide = !phone && fold === "min" ? "1" : "0";
|
|
23
|
+
return min;
|
|
24
|
+
}
|
|
25
|
+
export function applyStoredLook(root: HTMLElement = document.documentElement) {
|
|
26
|
+
applyFold(root, get("kz-rail"));
|
|
27
|
+
// The desktop app: its own rules (html.desk, html.mac).
|
|
28
|
+
const d = (window as unknown as { kaizenDesktop?: Desktop }).kaizenDesktop;
|
|
29
|
+
if (d) {
|
|
30
|
+
root.classList.add("desk");
|
|
31
|
+
if (d.platform === "darwin") root.classList.add("mac");
|
|
32
|
+
}
|
|
33
|
+
if (get("kz-color") === "blue") root.dataset.color = "blue";
|
|
34
|
+
const t = get("kz-theme");
|
|
35
|
+
if (t) root.dataset.theme = t;
|
|
36
|
+
const m = get("kz-motion");
|
|
37
|
+
if (m) root.dataset.motion = m;
|
|
38
|
+
}
|
|
39
|
+
// Installed on iOS the page fits the window and does not zoom.
|
|
40
|
+
export function fitStandalone() {
|
|
41
|
+
const nav = navigator as unknown as { standalone?: boolean };
|
|
42
|
+
if (!matchMedia("(display-mode:standalone)").matches && !nav.standalone) return;
|
|
43
|
+
const vp = document.querySelector<HTMLMetaElement>("meta[name=viewport]");
|
|
44
|
+
if (vp) vp.content += ",maximum-scale=1,user-scalable=no";
|
|
45
|
+
addEventListener("gesturestart", (e) => e.preventDefault());
|
|
46
|
+
if (nav.standalone) addEventListener("resize", () => scrollTo(0, 0));
|
|
47
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Typed task outputs. Only server-issued artifact routes are embedded; live URLs are
|
|
2
|
+
// separate, mutable references and active HTML/SVG files remain downloads.
|
|
3
|
+
export type TaskArtifact = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
kind: string;
|
|
7
|
+
mediaType?: string;
|
|
8
|
+
preview?: string | boolean;
|
|
9
|
+
url?: string;
|
|
10
|
+
size?: number;
|
|
11
|
+
missing?: boolean;
|
|
12
|
+
source?: string;
|
|
13
|
+
};
|
|
14
|
+
export type TaskResult = {
|
|
15
|
+
id: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
summary?: string;
|
|
18
|
+
createdAt?: number | string;
|
|
19
|
+
artifacts: TaskArtifact[];
|
|
20
|
+
checks?: (string | { label?: string; outcome?: string; evidence?: string })[];
|
|
21
|
+
limitations?: string[];
|
|
22
|
+
liveUrl?: string;
|
|
23
|
+
storedSize?: number;
|
|
24
|
+
size?: number;
|
|
25
|
+
};
|
|
26
|
+
export const webUrl = (value: unknown) => {
|
|
27
|
+
try {
|
|
28
|
+
const u = new URL(String(value));
|
|
29
|
+
return ["http:", "https:"].includes(u.protocol) && !u.username && !u.password ? u.href : null;
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export const storedUrl = (value: unknown) =>
|
|
35
|
+
typeof value === "string" && /^\/task-artifact(?:\?|\/)/.test(value) && !value.includes("\\") && !/[\r\n]/.test(value)
|
|
36
|
+
? value
|
|
37
|
+
: null;
|
|
38
|
+
export const sizeLabel = (n?: number) =>
|
|
39
|
+
n == null
|
|
40
|
+
? ""
|
|
41
|
+
: n < 1024
|
|
42
|
+
? `${n} B`
|
|
43
|
+
: n < 1024 * 1024
|
|
44
|
+
? `${(n / 1024).toFixed(1)} KB`
|
|
45
|
+
: `${(n / (1024 * 1024)).toFixed(1)} MB`;
|
|
46
|
+
export const isImage = (a: TaskArtifact) =>
|
|
47
|
+
/^image\//.test(a.mediaType ?? "") || a.kind === "image" || a.kind === "screenshot";
|
|
48
|
+
export const isLive = (a: TaskArtifact) =>
|
|
49
|
+
a.kind === "website" || a.kind === "app" || a.kind === "link" || a.kind === "live";
|
|
50
|
+
// HTML, scripts, XML and SVG can run code: they are offered as downloads, never embedded.
|
|
51
|
+
export const isActive = (a: TaskArtifact) =>
|
|
52
|
+
/^(?:text\/(?:html|javascript|xml)|application\/(?:javascript|xml|xhtml\+xml)|image\/svg\+xml)(?:;|$)/i.test(
|
|
53
|
+
a.mediaType ?? "",
|
|
54
|
+
) || /\.(html?|svg|m?js|xml)$/i.test(a.name);
|
|
55
|
+
|
|
56
|
+
export type ArtifactMode =
|
|
57
|
+
| "missing" // no stored file or address, or the saved file is gone
|
|
58
|
+
| "live" // a mutable web address, shown in a sandboxed frame
|
|
59
|
+
| "image"
|
|
60
|
+
| "video"
|
|
61
|
+
| "audio"
|
|
62
|
+
| "pdf"
|
|
63
|
+
| "text" // embedded from a server-issued route
|
|
64
|
+
| "download" // active content: Download only
|
|
65
|
+
| "unavailable"; // a format with no viewer
|
|
66
|
+
// Which viewer an artifact gets. `selected` is false for a file that is only listed, not opened.
|
|
67
|
+
export function artifactMode(a: TaskArtifact, selected: boolean): { mode: ArtifactMode | "none"; href: string | null } {
|
|
68
|
+
const live = isLive(a),
|
|
69
|
+
href = live ? webUrl(a.url) : storedUrl(a.url);
|
|
70
|
+
if (a.missing || !href) return { mode: "missing", href };
|
|
71
|
+
if (!selected) return { mode: "none", href };
|
|
72
|
+
if (live) return { mode: "live", href };
|
|
73
|
+
if (isActive(a)) return { mode: "download", href };
|
|
74
|
+
if (a.preview === false || a.preview === "download" || a.preview === "none") return { mode: "unavailable", href };
|
|
75
|
+
const t = a.mediaType ?? "";
|
|
76
|
+
if (/^image\//.test(t) || a.kind === "image" || a.kind === "screenshot") return { mode: "image", href };
|
|
77
|
+
if (/^video\//.test(t) || a.kind === "video") return { mode: "video", href };
|
|
78
|
+
if (/^audio\//.test(t) || a.kind === "audio") return { mode: "audio", href };
|
|
79
|
+
if (t === "application/pdf" || a.kind === "pdf") return { mode: "pdf", href };
|
|
80
|
+
if (/^text\//.test(t) || ["text", "markdown", "document"].includes(a.kind)) return { mode: "text", href };
|
|
81
|
+
return { mode: "unavailable", href };
|
|
82
|
+
}
|
|
83
|
+
export const savedLine = (r?: TaskResult) =>
|
|
84
|
+
r?.createdAt
|
|
85
|
+
? `Saved ${new Date(r.createdAt).toLocaleString()}${(r.storedSize ?? r.size) != null ? " · " + sizeLabel(r.storedSize ?? r.size) + " preserved" : ""}`
|
|
86
|
+
: "";
|
|
87
|
+
export const checkLine = (c: NonNullable<TaskResult["checks"]>[number]) =>
|
|
88
|
+
typeof c === "string" ? c : [c.label, c.outcome, c.evidence].filter(Boolean).join(" — ");
|
|
89
|
+
// Legacy results carry no title of their own: no heading is drawn for them.
|
|
90
|
+
export const isLegacyResult = (r: TaskResult) => !r.title || r.title === "Existing result";
|
|
91
|
+
// A saved text file is fetched with its viewer; over 1 MB is cut short.
|
|
92
|
+
export const TEXT_LIMIT = 1_000_000;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Task data shapes and the rules about them that have no screen: which tasks a filter shows, when Looks good
|
|
2
|
+
// is allowed, what a task's route and status line are. The pages and the tests share these.
|
|
3
|
+
import type { TaskResult } from "./task-results.ts";
|
|
4
|
+
|
|
5
|
+
export type TaskAttention = { category: "needs-you" | "in-progress" | "completed"; reason: string; action: string };
|
|
6
|
+
export type TaskDecision = {
|
|
7
|
+
id: string;
|
|
8
|
+
kind: "question" | "proposal" | "project" | string;
|
|
9
|
+
text: string;
|
|
10
|
+
summary?: string;
|
|
11
|
+
details?: string;
|
|
12
|
+
options?: string[];
|
|
13
|
+
};
|
|
14
|
+
export type TaskMessage = { id: string; role: string; text: string; type?: string; at?: number | string };
|
|
15
|
+
export type TaskView = {
|
|
16
|
+
id: string;
|
|
17
|
+
dir: string;
|
|
18
|
+
title: string;
|
|
19
|
+
goal: string;
|
|
20
|
+
revision: number;
|
|
21
|
+
updatedAt?: number | string;
|
|
22
|
+
status?: string;
|
|
23
|
+
attention: TaskAttention;
|
|
24
|
+
decision?: TaskDecision | null;
|
|
25
|
+
pendingDecision?: unknown;
|
|
26
|
+
messages?: TaskMessage[];
|
|
27
|
+
inputs?: { id: string; text: string; state: string; at?: number | string }[];
|
|
28
|
+
activeRun?: string | null;
|
|
29
|
+
runs?: (string | { id: string })[];
|
|
30
|
+
acceptedResultId?: string | null;
|
|
31
|
+
currentResultId?: string | null;
|
|
32
|
+
files?: { name: string; url?: string }[];
|
|
33
|
+
legacy?: { kind: string; id?: string; text?: string; state?: string };
|
|
34
|
+
error?: string;
|
|
35
|
+
projectName?: string;
|
|
36
|
+
queuePaused?: boolean;
|
|
37
|
+
agentAlive?: boolean;
|
|
38
|
+
// What the server allows now; the page draws this list and decides nothing itself.
|
|
39
|
+
actions?: {
|
|
40
|
+
accept: boolean;
|
|
41
|
+
acceptWhy?: string;
|
|
42
|
+
stop: boolean;
|
|
43
|
+
resume: boolean;
|
|
44
|
+
abandon: boolean;
|
|
45
|
+
archive: boolean;
|
|
46
|
+
delete: boolean;
|
|
47
|
+
start: boolean;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export type TaskPageData = {
|
|
51
|
+
task: TaskView;
|
|
52
|
+
results?: TaskResult[];
|
|
53
|
+
projects?: { dir: string; name?: string; label?: string }[];
|
|
54
|
+
defaults?: { agent?: string; workflow?: string; permissions?: string };
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const TASK_FILTERS = [
|
|
58
|
+
["all", "All"],
|
|
59
|
+
["needs-you", "Needs you"],
|
|
60
|
+
["in-progress", "In progress"],
|
|
61
|
+
["completed", "Completed"],
|
|
62
|
+
] as const;
|
|
63
|
+
export function filteredTasks(tasks: TaskView[], filter = "all", query = "", dir = "") {
|
|
64
|
+
const q = query.trim().toLocaleLowerCase();
|
|
65
|
+
const rank = { "needs-you": 0, "in-progress": 1, completed: 2 };
|
|
66
|
+
return tasks
|
|
67
|
+
.filter(
|
|
68
|
+
(t) =>
|
|
69
|
+
(!dir || t.dir === dir) &&
|
|
70
|
+
(filter === "all" || t.attention.category === filter) &&
|
|
71
|
+
(!q ||
|
|
72
|
+
[t.title, t.goal, t.projectName, t.attention.reason, t.attention.action]
|
|
73
|
+
.filter(Boolean)
|
|
74
|
+
.join(" ")
|
|
75
|
+
.toLocaleLowerCase()
|
|
76
|
+
.includes(q)),
|
|
77
|
+
)
|
|
78
|
+
.sort(
|
|
79
|
+
(a, b) =>
|
|
80
|
+
rank[a.attention.category] - rank[b.attention.category] ||
|
|
81
|
+
Number(new Date(b.updatedAt ?? 0)) - Number(new Date(a.updatedAt ?? 0)) ||
|
|
82
|
+
a.id.localeCompare(b.id),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
export const queuedInputs = (t: TaskView) =>
|
|
86
|
+
(t.inputs ?? []).filter((i) => ["received", "queued", "dispatched"].includes(i.state));
|
|
87
|
+
export function canAcceptTask(t: TaskView, result?: TaskResult) {
|
|
88
|
+
return (
|
|
89
|
+
!!result &&
|
|
90
|
+
t.actions?.accept !== false &&
|
|
91
|
+
!t.queuePaused &&
|
|
92
|
+
result.id === t.currentResultId &&
|
|
93
|
+
!t.decision &&
|
|
94
|
+
!t.activeRun &&
|
|
95
|
+
!queuedInputs(t).length &&
|
|
96
|
+
t.attention.category !== "completed"
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
export const taskHref = (t: Pick<TaskView, "id" | "dir">) =>
|
|
100
|
+
`?view=task&task=${encodeURIComponent(t.id)}&dir=${encodeURIComponent(t.dir || "")}`;
|
|
101
|
+
export const taskStatus = (t: TaskView) => t.attention?.reason || t.status || "Saved";
|
|
102
|
+
// The last path part of a project dir, without its .kaizen folder.
|
|
103
|
+
export const dirName = (dir: string) =>
|
|
104
|
+
dir
|
|
105
|
+
.replace(/[\\/]\.kaizen$/, "")
|
|
106
|
+
.split(/[\\/]/)
|
|
107
|
+
.pop() || "";
|
|
108
|
+
export const projectLabel = (t: TaskView, projects: TaskPageData["projects"] = []) =>
|
|
109
|
+
t.projectName ||
|
|
110
|
+
projects.find((p) => p.dir === t.dir)?.name ||
|
|
111
|
+
projects.find((p) => p.dir === t.dir)?.label ||
|
|
112
|
+
(t.dir ? dirName(t.dir) : "Choose a project");
|
|
113
|
+
// What the conversation shows: no boundary markers, no internal continuation prompt, only the newest result message.
|
|
114
|
+
export function visibleMessages(messages: TaskView["messages"] = []) {
|
|
115
|
+
if (!messages?.length) return [];
|
|
116
|
+
const clean = messages.filter((m) => {
|
|
117
|
+
if (m.type === "boundary") return false;
|
|
118
|
+
if (m.role === "user" && m.text.includes("Continue production under the frozen task policy")) return false;
|
|
119
|
+
return true;
|
|
120
|
+
});
|
|
121
|
+
const last = clean.reduce((at, m, i) => (m.type === "result" ? i : at), -1);
|
|
122
|
+
return clean.filter((m, i) => !(m.type === "result" && i !== last));
|
|
123
|
+
}
|
|
124
|
+
// Newest-created last; the page opens on the current result unless someone picked another.
|
|
125
|
+
export const sortedResults = (results: TaskResult[] = []) =>
|
|
126
|
+
[...results].sort((a, b) => Number(new Date(a.createdAt ?? 0)) - Number(new Date(b.createdAt ?? 0)));
|
|
127
|
+
// Archive is always offered; Abandon only for a live run; Delete only before any run exists.
|
|
128
|
+
export const closeActions = (t: TaskView) =>
|
|
129
|
+
t.actions ?? { abandon: !!t.activeRun, delete: !t.activeRun && !(t.runs ?? []).length };
|
|
130
|
+
export const runIdsOf = (t: TaskView) => [
|
|
131
|
+
...new Set([...(t.runs ?? []).map((r) => (typeof r === "string" ? r : r.id)), ...(t.activeRun ? [t.activeRun] : [])]),
|
|
132
|
+
];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { expose, frameable } from "@lib/core";
|
|
3
|
+
import { webUrl } from "./task-results.ts";
|
|
4
|
+
|
|
5
|
+
// A live preview's life: ask whether the site allows a frame, and for an address on this computer shown on
|
|
6
|
+
// another device ask the server to expose it. The workspace already checks frame headers and exposes local
|
|
7
|
+
// development ports; task previews use the same services, with an opaque sandbox.
|
|
8
|
+
type Live = { src: string; hidden: boolean; note: string; link: string; linkLabel?: string };
|
|
9
|
+
const local = /^(localhost|127\.0\.0\.1|\[::1\])$/;
|
|
10
|
+
export function useLiveFrame(href: string) {
|
|
11
|
+
const [s, set] = useState<Live>({
|
|
12
|
+
src: "",
|
|
13
|
+
hidden: true,
|
|
14
|
+
note: "Checking preview availability… You can also use Open link.",
|
|
15
|
+
link: href,
|
|
16
|
+
});
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
let live = true;
|
|
19
|
+
const to = (p: Partial<Live>) => live && set((v) => ({ ...v, ...p }));
|
|
20
|
+
(async () => {
|
|
21
|
+
const original = webUrl(href);
|
|
22
|
+
if (!original) return to({ hidden: true, note: "The preview address is unavailable." });
|
|
23
|
+
let url = original,
|
|
24
|
+
note = "Checking preview availability… You can also use Open link.";
|
|
25
|
+
try {
|
|
26
|
+
const check = await frameable(original);
|
|
27
|
+
if (!live) return;
|
|
28
|
+
if (check.frameable === false)
|
|
29
|
+
return to({
|
|
30
|
+
hidden: true,
|
|
31
|
+
note: "This site refuses to appear inside kaizen. Use Open link to view it in another tab.",
|
|
32
|
+
});
|
|
33
|
+
} catch {
|
|
34
|
+
note = "Preview availability could not be checked. Use Open link if it does not appear.";
|
|
35
|
+
}
|
|
36
|
+
let link = href;
|
|
37
|
+
if (local.test(new URL(original).hostname) && !local.test(location.hostname)) {
|
|
38
|
+
to({ hidden: true, note: "Opening this computer’s preview for this device…" });
|
|
39
|
+
try {
|
|
40
|
+
const exposed = await expose(original);
|
|
41
|
+
if (!live) return;
|
|
42
|
+
const ok = exposed.ok && webUrl(exposed.url);
|
|
43
|
+
if (!ok)
|
|
44
|
+
return to({
|
|
45
|
+
hidden: true,
|
|
46
|
+
linkLabel: "Open on computer",
|
|
47
|
+
note: "This preview is on the computer running kaizen and could not be opened for this device. Open the task on that computer.",
|
|
48
|
+
});
|
|
49
|
+
url = ok;
|
|
50
|
+
link = ok;
|
|
51
|
+
note = exposed.hint || "Live preview. This address can change during later work.";
|
|
52
|
+
} catch {
|
|
53
|
+
return to({
|
|
54
|
+
hidden: true,
|
|
55
|
+
linkLabel: "Open on computer",
|
|
56
|
+
note: "The preview could not be opened for this device. Open the task on the computer running kaizen.",
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
to({ src: url, hidden: false, note, link });
|
|
61
|
+
})();
|
|
62
|
+
return () => {
|
|
63
|
+
live = false;
|
|
64
|
+
};
|
|
65
|
+
}, [href]);
|
|
66
|
+
return {
|
|
67
|
+
...s,
|
|
68
|
+
// Once the frame has loaded, a still-pending note says what to do if it looks empty.
|
|
69
|
+
loaded: () =>
|
|
70
|
+
set((v) =>
|
|
71
|
+
v.note.startsWith("Checking")
|
|
72
|
+
? {
|
|
73
|
+
...v,
|
|
74
|
+
note: "Live preview. If it does not appear, use Open link. Some apps require their own browser tab.",
|
|
75
|
+
}
|
|
76
|
+
: v,
|
|
77
|
+
),
|
|
78
|
+
failed: () =>
|
|
79
|
+
set((v) => ({
|
|
80
|
+
...v,
|
|
81
|
+
hidden: true,
|
|
82
|
+
note: "The live preview could not be opened. Use Open link or ask for a saved screenshot.",
|
|
83
|
+
})),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { getText } from "@lib/core";
|
|
3
|
+
import { TEXT_LIMIT } from "./task-results.ts";
|
|
4
|
+
|
|
5
|
+
// A saved text output, fetched when its viewer opens; over 1 MB is cut short.
|
|
6
|
+
export function useSavedText(url: string) {
|
|
7
|
+
const [text, setText] = useState("Loading saved text…");
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
let live = true;
|
|
10
|
+
setText("Loading saved text…");
|
|
11
|
+
getText(url)
|
|
12
|
+
.then(
|
|
13
|
+
(v) =>
|
|
14
|
+
live &&
|
|
15
|
+
setText(
|
|
16
|
+
v.length > TEXT_LIMIT ? v.slice(0, TEXT_LIMIT) + "\nPreview shortened. Download for the whole file." : v,
|
|
17
|
+
),
|
|
18
|
+
)
|
|
19
|
+
.catch(() => live && setText("The saved file could not be read. Try Download or refresh the task."));
|
|
20
|
+
return () => {
|
|
21
|
+
live = false;
|
|
22
|
+
};
|
|
23
|
+
}, [url]);
|
|
24
|
+
return text;
|
|
25
|
+
}
|