kaizen-agent 1.86.0 → 1.87.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cli/annotate-proxy.ts +6 -3
- package/cli/build-web.ts +46 -16
- package/cli/dev.ts +67 -0
- package/cli/docs.ts +1 -1
- package/cli/notes.ts +9 -3
- package/cli/ports.ts +121 -0
- package/cli/settings.ts +16 -17
- package/cli/state.ts +15 -29
- package/cli/task-service.ts +79 -17
- package/cli/tasks.ts +2 -2
- package/cli/term-image.ts +18 -0
- package/cli/ui-audit.allow.json +0 -1
- package/cli/ui-audit.ts +12 -12
- package/cli/web.ts +188 -58
- package/package.json +21 -4
- package/skills/kaizen/spec.md +10 -3
- package/tsconfig.json +16 -0
- package/web/README.md +105 -0
- package/web/{annotate.js → annotate/annotate.ts} +51 -50
- package/web/boot/boot.ts +7 -0
- package/web/components/annotate/annotate-bar.tsx +78 -0
- package/web/components/annotate/annotate-panel.tsx +20 -0
- package/web/components/annotate/annotate-settings.tsx +60 -0
- package/web/components/annotate/index.ts +1 -0
- package/web/components/annotate/notes-list.tsx +75 -0
- package/web/components/board/board-card.tsx +177 -0
- package/web/components/board/board-column.tsx +212 -0
- package/web/components/board/board-mode-switch.tsx +21 -0
- package/web/components/board/board-popups.tsx +45 -0
- package/web/components/board/card-footer.tsx +58 -0
- package/web/components/board/card-form.tsx +168 -0
- package/web/components/board/card-kids.tsx +53 -0
- package/web/components/board/clear-menu.tsx +36 -0
- package/web/components/board/filter-box.tsx +42 -0
- package/web/components/board/index.ts +6 -0
- package/web/components/board/run-form.tsx +129 -0
- package/web/components/board/severity-menu.tsx +44 -0
- package/web/components/board/status-strip.tsx +75 -0
- package/web/components/board/task-form.tsx +140 -0
- package/web/components/board/ws-card.tsx +38 -0
- package/web/components/context/context-panel.tsx +244 -0
- package/web/components/context/index.ts +1 -0
- package/web/components/decision/decision-bar.tsx +422 -0
- package/web/components/decision/index.ts +1 -0
- package/web/components/decision/inline-form.tsx +47 -0
- package/web/components/decision/plan-answers-form.tsx +78 -0
- package/web/components/decision/revise-form.tsx +65 -0
- package/web/components/decision/task-reply-form.tsx +48 -0
- package/web/components/footer/foot-bar.tsx +67 -0
- package/web/components/footer/index.ts +1 -0
- package/web/components/git/git-ask.tsx +88 -0
- package/web/components/git/git-commits.tsx +53 -0
- package/web/components/git/git-confirm.tsx +78 -0
- package/web/components/git/git-counts.tsx +10 -0
- package/web/components/git/git-files.tsx +113 -0
- package/web/components/git/git-head.tsx +70 -0
- package/web/components/git/git-icon.tsx +25 -0
- package/web/components/git/git-message.tsx +44 -0
- package/web/components/git/git-split.tsx +64 -0
- package/web/components/git/git-tab.tsx +55 -0
- package/web/components/git/index.ts +1 -0
- package/web/components/home/chat-list.tsx +57 -0
- package/web/components/home/home-composer.tsx +169 -0
- package/web/components/home/home-message.tsx +120 -0
- package/web/components/home/home-window.tsx +253 -0
- package/web/components/home/home-ws-add.tsx +47 -0
- package/web/components/home/index.ts +6 -0
- package/web/components/home/onboarding-dialog.tsx +371 -0
- package/web/components/icebox/board-chip.tsx +27 -0
- package/web/components/icebox/board-menu.tsx +41 -0
- package/web/components/icebox/bulk-bar.tsx +41 -0
- package/web/components/icebox/capture-box.tsx +155 -0
- package/web/components/icebox/choice-menu.tsx +39 -0
- package/web/components/icebox/collection-dialog.tsx +60 -0
- package/web/components/icebox/favicon.tsx +39 -0
- package/web/components/icebox/index.ts +10 -0
- package/web/components/icebox/kind-label.tsx +22 -0
- package/web/components/icebox/kind-menu.tsx +20 -0
- package/web/components/icebox/promote-form.tsx +93 -0
- package/web/components/icebox/reply-box.tsx +88 -0
- package/web/components/icebox/request-actions.tsx +141 -0
- package/web/components/icebox/request-badges.tsx +13 -0
- package/web/components/icebox/request-card.tsx +99 -0
- package/web/components/icebox/request-detail.tsx +43 -0
- package/web/components/icebox/request-images.tsx +33 -0
- package/web/components/icebox/request-phone-row.tsx +181 -0
- package/web/components/icebox/request-row.tsx +120 -0
- package/web/components/icebox/service-chip.tsx +58 -0
- package/web/components/icebox/snooze-menu.tsx +83 -0
- package/web/components/icebox/source-card.tsx +225 -0
- package/web/components/icebox/source-drawer.tsx +112 -0
- package/web/components/icebox/source-form.tsx +147 -0
- package/web/components/icebox/swipe-deck.tsx +242 -0
- package/web/components/layout/index.ts +1 -0
- package/web/components/layout/page-frame.tsx +44 -0
- package/web/components/markdown/index.ts +1 -0
- package/web/components/markdown/markdown.tsx +156 -0
- package/web/components/notebook/editor-pane.tsx +23 -0
- package/web/components/notebook/index.ts +5 -0
- package/web/components/notebook/note-body.tsx +172 -0
- package/web/components/notebook/note-tree.tsx +99 -0
- package/web/components/notebook/notes-head.tsx +37 -0
- package/web/components/notebook/notes-side.tsx +46 -0
- package/web/components/notes/index.ts +1 -0
- package/web/components/notes/note-composer.tsx +90 -0
- package/web/components/notes/notes-chat.tsx +58 -0
- package/web/components/panes/browser-pane.tsx +281 -0
- package/web/components/panes/index.ts +3 -0
- package/web/components/panes/preview-pane.tsx +91 -0
- package/web/components/panes/terminal-pane.tsx +52 -0
- package/web/components/phone/haptic.tsx +29 -0
- package/web/components/phone/index.ts +6 -0
- package/web/components/phone/phone-card.tsx +118 -0
- package/web/components/phone/phone-home.tsx +304 -0
- package/web/components/phone/phone-sheets.tsx +103 -0
- package/web/components/phone/qr-code.tsx +6 -0
- package/web/components/phone/usage-chips.tsx +85 -0
- package/web/components/phone/whatsapp-card.tsx +85 -0
- package/web/components/project/add-project-dialog.tsx +435 -0
- package/web/components/project/index.ts +3 -0
- package/web/components/project/project-bar.tsx +101 -0
- package/web/components/project/ws-menu.tsx +21 -0
- package/web/components/rail/agent-chips.tsx +110 -0
- package/web/components/rail/index.ts +4 -0
- package/web/components/rail/rail-filter.tsx +118 -0
- package/web/components/rail/rail-list.tsx +259 -0
- package/web/components/rail/source-marks.tsx +21 -0
- package/web/components/resources/index.ts +1 -0
- package/web/components/resources/resources-popup.tsx +490 -0
- package/web/components/run/doc-body.tsx +123 -0
- package/web/components/run/file-viewer.tsx +53 -0
- package/web/components/run/fix-form.tsx +88 -0
- package/web/components/run/index.ts +16 -0
- package/web/components/run/inline-md.tsx +30 -0
- package/web/components/run/key-hint.tsx +29 -0
- package/web/components/run/pane-gutter.tsx +52 -0
- package/web/components/run/pane-header.tsx +35 -0
- package/web/components/run/pane.tsx +140 -0
- package/web/components/run/panel-grip.tsx +49 -0
- package/web/components/run/panel-head.tsx +56 -0
- package/web/components/run/panel-tabs.tsx +35 -0
- package/web/components/run/phase-steps.tsx +37 -0
- package/web/components/run/project-notes.tsx +49 -0
- package/web/components/run/run-add-menu.tsx +80 -0
- package/web/components/run/run-bar.tsx +40 -0
- package/web/components/run/run-empty.tsx +10 -0
- package/web/components/run/run-footer.tsx +53 -0
- package/web/components/run/run-history.tsx +24 -0
- package/web/components/run/run-panes.tsx +78 -0
- package/web/components/run/run-picker.tsx +51 -0
- package/web/components/run/run-progress.tsx +30 -0
- package/web/components/run/run-tabs.tsx +147 -0
- package/web/components/run/run-wait.tsx +18 -0
- package/web/components/search/index.ts +1 -0
- package/web/components/search/search-palette.tsx +159 -0
- package/web/components/settings/account-rows.tsx +128 -0
- package/web/components/settings/agent-rows.tsx +249 -0
- package/web/components/settings/automation-rows.tsx +211 -0
- package/web/components/settings/browser-row.tsx +111 -0
- package/web/components/settings/cleanup-row.tsx +32 -0
- package/web/components/settings/commit-input.tsx +39 -0
- package/web/components/settings/index.ts +4 -0
- package/web/components/settings/integration-row.tsx +158 -0
- package/web/components/settings/mic-row.tsx +48 -0
- package/web/components/settings/orchestration-flow.tsx +87 -0
- package/web/components/settings/setting-row.tsx +131 -0
- package/web/components/settings/settings-item.tsx +78 -0
- package/web/components/settings/settings-loading.tsx +41 -0
- package/web/components/settings/settings-nav.tsx +119 -0
- package/web/components/settings/settings-scope.tsx +66 -0
- package/web/components/settings/settings-section.tsx +33 -0
- package/web/components/settings/skill-card.tsx +131 -0
- package/web/components/settings/stepper.tsx +74 -0
- package/web/components/settings/update-bar.tsx +167 -0
- package/web/components/shared/action-menu.tsx +76 -0
- package/web/components/shared/ask-host.tsx +18 -0
- package/web/components/shared/attach-button.tsx +23 -0
- package/web/components/shared/chip.tsx +19 -0
- package/web/components/shared/client-mark.tsx +15 -0
- package/web/components/shared/confirm-dialog.tsx +35 -0
- package/web/components/shared/empty-state.tsx +29 -0
- package/web/components/shared/field.tsx +77 -0
- package/web/components/shared/filter-popover.tsx +29 -0
- package/web/components/shared/form-frame.tsx +19 -0
- package/web/components/shared/icon-button.tsx +50 -0
- package/web/components/shared/index.ts +18 -0
- package/web/components/shared/mic-button.tsx +75 -0
- package/web/components/shared/pager.tsx +49 -0
- package/web/components/shared/picker.tsx +108 -0
- package/web/components/shared/project-mark.tsx +38 -0
- package/web/components/shared/segmented.tsx +43 -0
- package/web/components/shared/state-dot.tsx +4 -0
- package/web/components/shared/status-mark.tsx +26 -0
- package/web/components/shell/index.ts +3 -0
- package/web/components/shell/rail.tsx +259 -0
- package/web/components/shell/sprite.tsx +124 -0
- package/web/components/shell/wordmark.tsx +13 -0
- package/web/components/task/artifact-view.tsx +148 -0
- package/web/components/task/chat-bubble.tsx +43 -0
- package/web/components/task/filter-menu.tsx +38 -0
- package/web/components/task/index.ts +7 -0
- package/web/components/task/result-checks.tsx +34 -0
- package/web/components/task/result-view.tsx +113 -0
- package/web/components/task/status-badge.tsx +24 -0
- package/web/components/task/task-row.tsx +34 -0
- package/web/components/task/typing-dots.tsx +16 -0
- package/web/components/terminal/index.ts +3 -0
- package/web/components/terminal/terminal-bar.tsx +91 -0
- package/web/components/terminal/terminal-grid.tsx +149 -0
- package/web/components/terminal/terminal-modes.tsx +23 -0
- package/web/components/terminal/terminal-tile.tsx +139 -0
- package/web/dist/annotate.js +24 -0
- package/web/dist/board.css +718 -0
- package/web/dist/board.js +115 -0
- package/web/dist/boot.js +2 -0
- package/web/dist/notebook.css +319 -0
- package/web/dist/notebook.js +89 -0
- package/web/dist/popup.css +41 -0
- package/web/dist/popup.js +13 -0
- package/web/{term.js → dist/term.js} +48 -48
- package/web/dist/ui.css +3 -0
- package/web/dist/video.js +108 -0
- package/web/html/board.html +17 -0
- package/web/html/notes.html +14 -0
- package/web/html/popup.html +13 -0
- package/web/{video.html → html/video.html} +14 -15
- package/web/lib/annotate/index.ts +2 -0
- package/web/lib/annotate/notes.ts +105 -0
- package/web/lib/annotate/page.ts +121 -0
- package/web/lib/annotate/rules.ts +37 -0
- package/web/lib/annotate/session.ts +336 -0
- package/web/lib/board/board-actions.ts +119 -0
- package/web/lib/board/board-open.ts +12 -0
- package/web/lib/board/board-store.ts +159 -0
- package/web/lib/board/filter-box.ts +7 -0
- package/web/lib/board/index.ts +10 -0
- package/web/lib/board/nav.ts +29 -0
- package/web/lib/board/on-state.ts +90 -0
- package/web/lib/board/popups.ts +22 -0
- package/web/lib/board/snapshot.ts +105 -0
- package/web/lib/board/strip.ts +43 -0
- package/web/{board → lib/board}/ws-board.ts +1 -1
- package/web/lib/context/context-rules.ts +27 -0
- package/web/lib/context/context-store.ts +95 -0
- package/web/lib/context/feed.ts +28 -0
- package/web/lib/context/index.ts +3 -0
- package/web/lib/core/api.ts +86 -0
- package/web/lib/core/ask.ts +24 -0
- package/web/lib/core/board.ts +290 -0
- package/web/lib/core/brief.ts +31 -0
- package/web/lib/core/format.ts +8 -0
- package/web/lib/core/host.ts +107 -0
- package/web/lib/core/index.ts +16 -0
- package/web/{board → lib/core}/labels.ts +6 -5
- package/web/lib/core/layers.ts +7 -0
- package/web/lib/core/leave.ts +7 -0
- package/web/lib/core/motion.ts +10 -0
- package/web/{board/toast.ts → lib/core/notices.ts} +2 -20
- package/web/lib/core/notifier.ts +15 -0
- package/web/lib/core/store.ts +39 -0
- package/web/lib/core/term-handle.ts +8 -0
- package/web/lib/core/toast.ts +29 -0
- package/web/lib/core/utils.ts +15 -0
- package/web/lib/decision/index.ts +1 -0
- package/web/lib/decision/plan-questions.ts +39 -0
- package/web/lib/dictation/chunks.ts +93 -0
- package/web/lib/dictation/dictation-store.ts +22 -0
- package/web/lib/dictation/engine.ts +265 -0
- package/web/lib/dictation/index.ts +5 -0
- package/web/lib/dictation/mic.ts +42 -0
- package/web/lib/dictation/terminal-dictation.ts +50 -0
- package/web/lib/footer/footer-rules.ts +13 -0
- package/web/lib/footer/footer-store.ts +42 -0
- package/web/lib/footer/index.ts +2 -0
- package/web/lib/git/git-actions.ts +110 -0
- package/web/lib/git/git-panel.ts +43 -0
- package/web/lib/git/git-store.ts +47 -0
- package/web/lib/git/git.ts +170 -0
- package/web/lib/git/index.ts +4 -0
- package/web/lib/home/home-engine.ts +16 -0
- package/web/lib/home/home-events.ts +9 -0
- package/web/lib/home/home-store.ts +247 -0
- package/web/lib/home/home-window.ts +193 -0
- package/web/lib/home/home.ts +85 -0
- package/web/lib/home/index.ts +7 -0
- package/web/lib/home/onboarding.ts +199 -0
- package/web/lib/home/use-float-drag.ts +62 -0
- package/web/lib/icebox/icebox-actions.ts +518 -0
- package/web/lib/icebox/icebox-store.ts +112 -0
- package/web/lib/icebox/icebox-view.ts +48 -0
- package/web/lib/icebox/icebox.ts +273 -0
- package/web/lib/icebox/index.ts +8 -0
- package/web/lib/icebox/use-card-drag.ts +82 -0
- package/web/lib/icebox/use-ice-keys.ts +75 -0
- package/web/lib/icebox/use-icebox.ts +41 -0
- package/web/lib/icebox/use-row-swipe.ts +107 -0
- package/web/lib/markdown/index.ts +1 -0
- package/web/lib/markdown/markdown.ts +136 -0
- package/web/lib/notebook/autosave.ts +131 -0
- package/web/lib/notebook/deal.ts +58 -0
- package/web/lib/notebook/engine-complete.ts +128 -0
- package/web/lib/notebook/engine-preview.ts +287 -0
- package/web/lib/notebook/engine-types.ts +26 -0
- package/web/lib/notebook/engine-widgets.ts +218 -0
- package/web/lib/notebook/engine.ts +74 -0
- package/web/lib/notebook/index.ts +9 -0
- package/web/lib/notebook/kit-loader.ts +16 -0
- package/web/lib/notebook/kit.ts +12 -0
- package/web/{notes-lib.ts → lib/notebook/text.ts} +11 -10
- package/web/lib/notebook/vault-actions.ts +239 -0
- package/web/lib/notebook/vault-rules.ts +74 -0
- package/web/lib/notebook/vault-session.ts +73 -0
- package/web/lib/notebook/vault-store.ts +63 -0
- package/web/lib/notes/index.ts +4 -0
- package/web/lib/notes/md-html.ts +115 -0
- package/web/lib/notes/notes-actions.ts +32 -0
- package/web/lib/notes/notes-store.ts +22 -0
- package/web/lib/notes/notes.ts +58 -0
- package/web/{board → lib/notes}/rich.ts +1 -2
- package/web/lib/phone/index.ts +7 -0
- package/web/lib/phone/phone-actions.ts +77 -0
- package/web/lib/phone/phone-home.ts +102 -0
- package/web/lib/phone/phone-setup.ts +59 -0
- package/web/lib/phone/phone-sheet.ts +25 -0
- package/web/lib/phone/phone-store.ts +32 -0
- package/web/lib/phone/sheet-swipe.ts +55 -0
- package/web/lib/phone/use-phone-setup.ts +89 -0
- package/web/lib/project/add-project.ts +37 -0
- package/web/lib/project/branch.ts +14 -0
- package/web/lib/project/index.ts +5 -0
- package/web/lib/project/project-bar.ts +76 -0
- package/web/lib/project/project-pick.ts +36 -0
- package/web/lib/project/ws-menu.ts +8 -0
- package/web/lib/rail/agents.ts +63 -0
- package/web/lib/rail/card-links.ts +20 -0
- package/web/lib/rail/index.ts +7 -0
- package/web/lib/rail/rail-actions.ts +74 -0
- package/web/lib/rail/rail-boot.ts +99 -0
- package/web/lib/rail/rail-store.ts +85 -0
- package/web/lib/rail/rules.ts +241 -0
- package/web/lib/rail/source-marks.ts +17 -0
- package/web/lib/rail/use-rank-drag.ts +108 -0
- package/web/lib/resources/index.ts +3 -0
- package/web/lib/resources/resources-actions.ts +59 -0
- package/web/lib/resources/resources-store.ts +48 -0
- package/web/lib/resources/rules.ts +56 -0
- package/web/lib/router/index.ts +3 -0
- package/web/lib/router/route-rules.ts +96 -0
- package/web/lib/router/route-store.ts +115 -0
- package/web/lib/router/use-route-classes.ts +15 -0
- package/web/lib/run/browser.ts +53 -0
- package/web/lib/run/card-terminal.ts +32 -0
- package/web/lib/run/doc.ts +42 -0
- package/web/lib/run/grip.ts +8 -0
- package/web/lib/run/index.ts +19 -0
- package/web/lib/run/kept.ts +58 -0
- package/web/lib/run/layout-store.ts +156 -0
- package/web/lib/run/layout.ts +195 -0
- package/web/lib/run/panel-actions.ts +104 -0
- package/web/lib/run/panel-derive.ts +148 -0
- package/web/lib/run/panel-store.ts +125 -0
- package/web/lib/run/preview.ts +105 -0
- package/web/lib/run/run-actions.ts +118 -0
- package/web/lib/run/run-view-store.ts +134 -0
- package/web/lib/run/term-loader.ts +19 -0
- package/web/lib/run/use-panel-run.ts +125 -0
- package/web/lib/run/use-run-lifecycle.ts +70 -0
- package/web/lib/run/viewer.ts +12 -0
- package/web/lib/run/workspace.ts +281 -0
- package/web/lib/run/ws-actions.ts +293 -0
- package/web/lib/run/ws-derive.ts +50 -0
- package/web/lib/run/ws-draw.ts +102 -0
- package/web/lib/run/ws-store.ts +21 -0
- package/web/lib/run/ws-tabs.ts +125 -0
- package/web/lib/search/index.ts +3 -0
- package/web/lib/search/search-match.ts +48 -0
- package/web/lib/search/search-rows.ts +228 -0
- package/web/lib/search/search.ts +30 -0
- package/web/lib/search/use-search-rows.ts +22 -0
- package/web/lib/server/attention.ts +29 -0
- package/web/lib/server/index.ts +6 -0
- package/web/lib/server/poll-rules.ts +57 -0
- package/web/lib/server/poller.ts +210 -0
- package/web/lib/server/server-store.ts +39 -0
- package/web/lib/server/types.ts +31 -0
- package/web/lib/server/use-server.ts +19 -0
- package/web/lib/settings/agent-favicons.ts +14 -0
- package/web/lib/settings/index.ts +7 -0
- package/web/lib/settings/panel-settings.ts +29 -0
- package/web/lib/settings/settings-actions.ts +357 -0
- package/web/lib/settings/settings-store.ts +114 -0
- package/web/lib/settings/settings.ts +413 -0
- package/web/lib/settings/skill-icons.ts +24 -0
- package/web/lib/settings/update.ts +70 -0
- package/web/lib/shared/data-urls.ts +32 -0
- package/web/lib/shared/index.ts +4 -0
- package/web/lib/shared/use-draft.ts +38 -0
- package/web/lib/shared/use-narrow.ts +11 -0
- package/web/lib/shared/use-pager.ts +24 -0
- package/web/lib/shell/appearance.ts +97 -0
- package/web/lib/shell/help-store.ts +4 -0
- package/web/lib/shell/index.ts +4 -0
- package/web/lib/shell/shell-store.ts +23 -0
- package/web/lib/shell/stored-look.ts +47 -0
- package/web/lib/task/index.ts +7 -0
- package/web/lib/task/task-results.ts +92 -0
- package/web/lib/task/tasks.ts +134 -0
- package/web/lib/task/use-live-frame.ts +85 -0
- package/web/lib/task/use-saved-text.ts +25 -0
- package/web/lib/task/use-task.ts +161 -0
- package/web/lib/task/use-tasks.ts +50 -0
- package/web/{board → lib/task}/zoom.ts +25 -12
- package/web/lib/terminal/hidden-badge.ts +15 -0
- package/web/lib/terminal/index.ts +8 -0
- package/web/lib/terminal/layout.ts +138 -0
- package/web/{term-font.ts → lib/terminal/term-font.ts} +3 -2
- package/web/lib/terminal/terminal-store.ts +65 -0
- package/web/lib/terminal/terms-feed.ts +37 -0
- package/web/lib/terminal/use-arranged.ts +15 -0
- package/web/lib/terminal/use-terminal-keys.ts +37 -0
- package/web/lib/url/index.ts +1 -0
- package/web/lib/url/safe-url.ts +9 -0
- package/web/notebook/notebook.ts +27 -0
- package/web/notebook/notes-lib.ts +3 -0
- package/web/pages/board/App.tsx +76 -0
- package/web/pages/board/header.tsx +83 -0
- package/web/pages/board/help.tsx +59 -0
- package/web/pages/board/host-bridge.ts +94 -0
- package/web/pages/board/host.tsx +19 -0
- package/web/pages/board/keys.ts +112 -0
- package/web/pages/board/live.ts +39 -0
- package/web/pages/board/main.ts +32 -0
- package/web/pages/board/pages.tsx +86 -0
- package/web/pages/board/panel.tsx +157 -0
- package/web/pages/board/portal.tsx +39 -0
- package/web/pages/board/use-boot.ts +13 -0
- package/web/pages/board/views.ts +63 -0
- package/web/pages/board-page.tsx +62 -0
- package/web/pages/home-page.tsx +127 -0
- package/web/pages/icebox-page.tsx +440 -0
- package/web/pages/notebook/App.tsx +35 -0
- package/web/pages/notebook-page.tsx +50 -0
- package/web/pages/popup/App.tsx +207 -0
- package/web/pages/settings-page.tsx +111 -0
- package/web/pages/task-page.tsx +397 -0
- package/web/pages/tasks-page.tsx +151 -0
- package/web/pages/terminal-page.tsx +15 -0
- package/web/popup/popup.ts +7 -0
- package/web/{term.ts → term/term.ts} +48 -20
- package/web/ui/alert-dialog.tsx +39 -0
- package/web/ui/badge.tsx +20 -0
- package/web/ui/button.tsx +37 -0
- package/web/ui/checkbox.tsx +20 -0
- package/web/ui/command.tsx +41 -0
- package/web/ui/dialog.tsx +28 -0
- package/web/ui/dropdown-menu.tsx +54 -0
- package/web/ui/icon.tsx +17 -0
- package/web/ui/index.ts +21 -0
- package/web/ui/input.tsx +9 -0
- package/web/ui/label.tsx +7 -0
- package/web/ui/legacy/board.css +715 -0
- package/web/{notes.html → ui/legacy/notes.css} +23 -157
- package/web/ui/legacy/popup.css +40 -0
- package/web/ui/popover.tsx +28 -0
- package/web/ui/select.tsx +61 -0
- package/web/ui/sheet.tsx +43 -0
- package/web/ui/skeleton.tsx +6 -0
- package/web/ui/sonner.tsx +25 -0
- package/web/ui/spinner.tsx +12 -0
- package/web/ui/switch.tsx +18 -0
- package/web/ui/tabs.tsx +18 -0
- package/web/ui/textarea.tsx +14 -0
- package/web/ui/theme.css +125 -0
- package/web/ui/toggle.tsx +8 -0
- package/web/ui/tooltip.tsx +26 -0
- package/web/{video.ts → video/video.ts} +5 -5
- package/web/board/add-project.ts +0 -147
- package/web/board/agent-favicons.ts +0 -9
- package/web/board/agent-term.ts +0 -51
- package/web/board/annotate-lib.ts +0 -19
- package/web/board/annotate.ts +0 -221
- package/web/board/api.ts +0 -180
- package/web/board/approvals.ts +0 -109
- package/web/board/badge.ts +0 -115
- package/web/board/cards.ts +0 -1080
- package/web/board/chat.ts +0 -128
- package/web/board/context.ts +0 -248
- package/web/board/dictation.ts +0 -343
- package/web/board/dom.ts +0 -132
- package/web/board/drafts.ts +0 -21
- package/web/board/fixes.ts +0 -89
- package/web/board/git.ts +0 -416
- package/web/board/home-ws.ts +0 -266
- package/web/board/home.ts +0 -421
- package/web/board/icebox.ts +0 -1788
- package/web/board/keys.ts +0 -121
- package/web/board/live.ts +0 -87
- package/web/board/main.ts +0 -94
- package/web/board/markdown.ts +0 -210
- package/web/board/onboarding.ts +0 -227
- package/web/board/panel.ts +0 -437
- package/web/board/phone-setup.ts +0 -79
- package/web/board/phone.ts +0 -219
- package/web/board/projects.ts +0 -277
- package/web/board/resources.ts +0 -170
- package/web/board/run-pick.ts +0 -41
- package/web/board/run-view.ts +0 -1316
- package/web/board/search-match.ts +0 -20
- package/web/board/search.ts +0 -330
- package/web/board/settings-accounts.ts +0 -76
- package/web/board/settings-agents.ts +0 -102
- package/web/board/settings-automations.ts +0 -71
- package/web/board/settings-cleanup.ts +0 -42
- package/web/board/settings-orchestration.ts +0 -32
- package/web/board/settings-pages.ts +0 -62
- package/web/board/settings-skills.ts +0 -103
- package/web/board/settings-voice.ts +0 -28
- package/web/board/settings.ts +0 -490
- package/web/board/store.ts +0 -47
- package/web/board/task-page.ts +0 -628
- package/web/board/task-results.ts +0 -234
- package/web/board/tasks.ts +0 -242
- package/web/board/terms.ts +0 -390
- package/web/board/update.ts +0 -171
- package/web/board/viewer.ts +0 -47
- package/web/board/views.ts +0 -164
- package/web/board/whatsapp-setup.ts +0 -149
- package/web/board/workspace.ts +0 -650
- package/web/board/ws-board-ui.ts +0 -95
- package/web/board/ws-tabs.ts +0 -227
- package/web/board.html +0 -1563
- package/web/board.js +0 -505
- package/web/notebook.js +0 -519
- package/web/notebook.ts +0 -1254
- package/web/popup.html +0 -141
- package/web/video.js +0 -575
- /package/web/{term.css → dist/term.css} +0 -0
- /package/web/{board/term-sessions.ts → lib/terminal/sessions.ts} +0 -0
- /package/web/{board/terminal-viewport.ts → lib/terminal/viewport.ts} +0 -0
- /package/web/{term-paste.ts → term/term-paste.ts} +0 -0
package/cli/web.ts
CHANGED
|
@@ -7,13 +7,13 @@ import { join, dirname, resolve, sep, basename } from "node:path";
|
|
|
7
7
|
import {
|
|
8
8
|
home, type Item, type Card, knownProjects, remember, reorderProjects, canonPath, locate, label, tilde, searchRoots, findProjects,
|
|
9
9
|
readInbox, writeInbox, replaceTask, moveTask, abandonRun, runToTask, launchRun, parseItem, agentChoices, onPath, projectOf, KNOWN_AGENTS, plainModel, short, setArchived, writeNotes,
|
|
10
|
-
appendNote, saveAttachment, pidOnPort, readText, cmdExe, sysExe, powershellExe, runGit, readCommit, commitPush, commitStaged, stageFiles, suggestMessage, notice,
|
|
10
|
+
appendNote, saveAttachment, pidOnPort, readText, cmdExe, sysExe, powershellExe, runGit, readCommit, commitPush, commitStaged, stageFiles, suggestMessage, notice, LOGO,
|
|
11
11
|
reviewFindings, pickFindings, backlogItem, startedBacklog, closeBacklog, markBacklogDone, fixPrompt, approvalPrompt, canApproveAwaiting, gateOf, recordAcceptance, healRuns, finishRun, nativePath, closeSessions, sweepSessions, issueUrl,
|
|
12
|
-
|
|
12
|
+
pruneRuns, pruneSessions, readSessions, ownerOf, runIndex, resumePrompt, runAgent, firstSession, webHosts,
|
|
13
13
|
} from "./state.ts";
|
|
14
14
|
import { ACCOUNT_EXTRA, ACCOUNT_VAR, accountDir, agyLogin, addAccount, loginStatus, readAccounts, renameAccount, removeAccount, resolveAccount, setDefaultAccount, type Login, type Tool } from "./accounts.ts";
|
|
15
15
|
import { readReport, signalOf } from "./report.ts";
|
|
16
|
-
import { MAX_IMAGE, saveImage } from "./term-image.ts";
|
|
16
|
+
import { MAX_FILE, MAX_IMAGE, saveFile, saveImage } from "./term-image.ts";
|
|
17
17
|
import { shellHistory } from "./term-history.ts";
|
|
18
18
|
import { bundledSkills, repairSkill, setSkill, skillsHeld, skillsOff, skillStatus } from "./skills.ts";
|
|
19
19
|
import * as rea from "./rea.ts";
|
|
@@ -22,6 +22,7 @@ import { agentLine, failStart, handoffModel, markRunning, readWorkers, requested
|
|
|
22
22
|
import { childDied, childQuiet, markWoken, move, requestOpen, readHandoff, refused, started, wakeAction, wakeLine, type Handoff } from "./handoff.ts";
|
|
23
23
|
import { processTable, storage, systemMemory, treeRss, type Root } from "./resources.ts";
|
|
24
24
|
import { attachPty, frames, writePty, submitPty, resizePty, exitPty, killPty, panePid, ptyState, ptyKeys, adoptLoginEnv, startPty, ptySupported, detachPty, ptyTail, ptyTmux, tmuxAlive, RESUMED } from "./pty.ts";
|
|
25
|
+
import { conflictPort, holders, inProjects, isKaizenProcess, listeners, stopPort } from "./ports.ts";
|
|
25
26
|
import { snapshot, snapWorker } from "./state-snap.ts";
|
|
26
27
|
import { claudeUsage, claudeUsageAt, codexUsage, codexUsageAt, phonePeers, type Usage } from "./usage.ts";
|
|
27
28
|
import { readSources, addSource, removeSource, moveSource, setCategory, setWriteback, setPaused, readIcebox, applySort, promote, dismiss, restore, capture, editItem, setKind, setTags, setBoard, saveBoard, removeBoard, snooze, unsnooze, readBoards, kindOf, isSnoozed, markDone, markReplied, gatherSource, freshImages, gatherAll, gatherDirs, due, socialUrl, socialOf } from "./sources.ts";
|
|
@@ -46,24 +47,31 @@ import * as taskService from "./task-service.ts";
|
|
|
46
47
|
import { artifactResponse as taskArtifactResponse } from "./task-results.ts";
|
|
47
48
|
import { gitUrl, destDir, winBad, cloneInto, branchesOf, ignoreKaizen } from "./add-project.ts";
|
|
48
49
|
|
|
49
|
-
const PAGE = join(dirname(import.meta.dir), "web", "board.html");
|
|
50
|
-
// The board's script: web/board
|
|
51
|
-
const BOARD_JS = join(dirname(import.meta.dir), "web", "board.js");
|
|
50
|
+
const PAGE = join(dirname(import.meta.dir), "web", "html", "board.html");
|
|
51
|
+
// The board's script: web/pages/board/main.ts with web/lib and web/components, bundled into one file by `bun run build:web`.
|
|
52
|
+
const BOARD_JS = join(dirname(import.meta.dir), "web", "dist", "board.js");
|
|
52
53
|
const SOUNDS_DIR = join(dirname(import.meta.dir), "web", "sounds");
|
|
53
|
-
// The notebook: its page, and the CodeMirror bundle `bun run build:web` commits
|
|
54
|
-
const NOTES_PAGE = join(dirname(import.meta.dir), "web", "notes.html");
|
|
54
|
+
// The notebook: its page, and the CodeMirror bundle `bun run build:web` commits to web/dist.
|
|
55
|
+
const NOTES_PAGE = join(dirname(import.meta.dir), "web", "html", "notes.html");
|
|
55
56
|
const ICO = join(dirname(import.meta.dir), "assets", "kaizen.ico");
|
|
56
|
-
const
|
|
57
|
+
const UI_CSS = join(dirname(import.meta.dir), "web", "dist", "ui.css");
|
|
58
|
+
const NOTES_JS = join(dirname(import.meta.dir), "web", "dist", "notebook.js");
|
|
57
59
|
// The in-card terminal (agent.launch: card): xterm.js, bundled the same way.
|
|
58
|
-
const TERM_JS = join(dirname(import.meta.dir), "web", "term.js");
|
|
59
|
-
const ANNOTATE_JS = join(dirname(import.meta.dir), "web", "annotate.js");
|
|
60
|
-
const TERM_CSS = join(dirname(import.meta.dir), "web", "term.css");
|
|
60
|
+
const TERM_JS = join(dirname(import.meta.dir), "web", "dist", "term.js");
|
|
61
|
+
const ANNOTATE_JS = join(dirname(import.meta.dir), "web", "dist", "annotate.js");
|
|
62
|
+
const TERM_CSS = join(dirname(import.meta.dir), "web", "dist", "term.css");
|
|
61
63
|
// The Video page (kaizen-video's library, editor and renders) and its bundle.
|
|
62
|
-
const VIDEO_PAGE = join(dirname(import.meta.dir), "web", "video.html");
|
|
63
|
-
const POPUP_PAGE = join(dirname(import.meta.dir), "web", "popup.html");
|
|
64
|
+
const VIDEO_PAGE = join(dirname(import.meta.dir), "web", "html", "video.html");
|
|
65
|
+
const POPUP_PAGE = join(dirname(import.meta.dir), "web", "html", "popup.html");
|
|
66
|
+
// Each page's one stylesheet (the kit's Tailwind and the page's own styles) and the chat popup's script.
|
|
67
|
+
const dist = (f: string) => join(dirname(import.meta.dir), "web", "dist", f);
|
|
68
|
+
const STYLES: Record<string, string> = { "/board.css": dist("board.css"), "/notebook.css": dist("notebook.css"), "/popup.css": dist("popup.css") };
|
|
69
|
+
const POPUP_JS = dist("popup.js");
|
|
70
|
+
// The blocking head script of the board and the Notebook: the stored theme is on <html> before the first paint.
|
|
71
|
+
const BOOT_JS = dist("boot.js");
|
|
64
72
|
// The chat the popup was on when its Back button was pressed, until Home takes it.
|
|
65
73
|
let popupChat: string | null = null;
|
|
66
|
-
const VIDEO_JS = join(dirname(import.meta.dir), "web", "video.js");
|
|
74
|
+
const VIDEO_JS = join(dirname(import.meta.dir), "web", "dist", "video.js");
|
|
67
75
|
const DEFAULT_PORT = 7420;
|
|
68
76
|
// Gathered posts a reply is going out to right now: one send per item at a time.
|
|
69
77
|
const replying = new Set<string>();
|
|
@@ -87,8 +95,15 @@ delete process.env.KAIZEN_DESKTOP_BUNDLED;
|
|
|
87
95
|
// page newer than its server sends ops the server does not know ("unknown op").
|
|
88
96
|
// So the pages are kept as they were at start, and read live (dev edits) only while
|
|
89
97
|
// the installed version is still the one this board runs.
|
|
90
|
-
const AT_START = new Map([PAGE, BOARD_JS, NOTES_PAGE, NOTES_JS, TERM_JS, TERM_CSS, VIDEO_PAGE, VIDEO_JS, ANNOTATE_JS].map((f) => [f, existsSync(f) ? readText(f) : null]));
|
|
91
|
-
|
|
98
|
+
const AT_START = new Map([PAGE, BOARD_JS, NOTES_PAGE, NOTES_JS, TERM_JS, TERM_CSS, VIDEO_PAGE, VIDEO_JS, ANNOTATE_JS, UI_CSS, POPUP_PAGE, POPUP_JS, BOOT_JS, ...Object.values(STYLES)].map((f) => [f, existsSync(f) ? readText(f) : null]));
|
|
99
|
+
// `bun run dev` (cli/dev.ts) sets KAIZEN_DEV: every page file is read from disk on each request, and pages get a small
|
|
100
|
+
// script that reloads them when the dev script has rebuilt the bundles (GET /__dev/stream, POST /__dev/reload).
|
|
101
|
+
const DEV = process.env.KAIZEN_DEV === "1";
|
|
102
|
+
const DEV_TAG = `<script>new EventSource("/__dev/stream").onmessage=(e)=>{if(e.data==="reload")location.reload()}</script>`;
|
|
103
|
+
const served = (f: string) => {
|
|
104
|
+
const body = DEV ? (existsSync(f) ? readText(f) : null) : installed() === VERSION && existsSync(f) ? readText(f) : AT_START.get(f) ?? null;
|
|
105
|
+
return DEV && body !== null && f.endsWith(".html") ? body.replace("</head>", DEV_TAG + "</head>") : body;
|
|
106
|
+
};
|
|
92
107
|
|
|
93
108
|
// A board answers at url and runs the installed version. A board from before the
|
|
94
109
|
// version header sends none, so it counts as stale too.
|
|
@@ -282,20 +297,50 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
282
297
|
: [cur]
|
|
283
298
|
).filter((d, i, arr) => arr.indexOf(d) === i && existsSync(d));
|
|
284
299
|
|
|
300
|
+
// A run's decision sent to its agent: the agent already open in this run's card takes it
|
|
301
|
+
// there, as it takes a fix: no second tab of the same conversation. With none, the run's
|
|
302
|
+
// conversation continues in one new window, and then the idle one ends. A failed launch
|
|
303
|
+
// leaves it open, since the decision went nowhere.
|
|
304
|
+
const sendDecision = (dir: string, id: string, awaiting: string, why?: string, answers?: string[]) => {
|
|
305
|
+
const text = approvalPrompt(id, awaiting, why, answers);
|
|
306
|
+
const live = liveAgent(dir, id);
|
|
307
|
+
const before = Date.now();
|
|
308
|
+
const r = live ? { ok: true as const, pty: live.key, agent: live.cmd, reused: true } : launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard);
|
|
309
|
+
if (live) submitPty(live.key, text);
|
|
310
|
+
else if (r.ok) closeSessions(dir, id, { before });
|
|
311
|
+
// The plan's approval starts the build; fixing open findings is the review stage again.
|
|
312
|
+
if (r.ok) markStage(dir, id, awaiting === "approvals.plan" ? "impl" : awaiting === "findings" ? "review" : "", r.pty);
|
|
313
|
+
// Approving the review as-is is the user's acceptance, on record before the
|
|
314
|
+
// agent marks the run done; a revise is not.
|
|
315
|
+
if (r.ok && why === undefined && (awaiting === "approvals.review" || awaiting === "findings")) recordAcceptance(dir, id, "board");
|
|
316
|
+
return { r, live };
|
|
317
|
+
};
|
|
318
|
+
// A task whose run was just approved picks the approval up as its Looks good.
|
|
319
|
+
const syncTask = (dir: string, taskId: string) => {
|
|
320
|
+
try { const found = tasks.resolveTask(dir, taskId); if (found) taskService.reconcile(found.state, found.task, taskHooks); } catch { /* the next read reconciles */ }
|
|
321
|
+
};
|
|
285
322
|
const taskHooks = {
|
|
323
|
+
approve: (dir: string, id: string, awaiting: string) => { const { r } = sendDecision(dir, id, awaiting); return r.ok ? null : (r.why || "The run's agent could not be reached"); },
|
|
286
324
|
launch: (dir: string, id: string, text: string, task: tasks.Task, pick?: any) => {
|
|
287
325
|
const live = liveAgent(dir, id);
|
|
288
326
|
if (live) { submitPty(live.key, text); return { ok: true, pty: live.key }; }
|
|
289
|
-
return launchRun({ severity: null, where: null, text, raw: text }, dir, id, { ...inCard
|
|
327
|
+
return launchRun({ severity: null, where: null, text, raw: text }, dir, id, { ...inCard, ...(pick ? { agent: KNOWN_AGENTS.some((a) => a.cmd === pick.agent) ? pick.agent : undefined, account: typeof pick.account === "string" ? pick.account : undefined, explore: typeof pick.explore === "boolean" ? pick.explore : undefined, yolo: pick.yolo === true } : {}), task: { id: task.id, requirePlanConfirmation: !task.initialConfirmed } });
|
|
290
328
|
},
|
|
291
329
|
alive: (key: string) => ptyState(key)?.alive === true,
|
|
330
|
+
idle: (key: string) => { const s = ptyState(key); return s ? Date.now() - (s.lastOut ?? s.born) : 0; },
|
|
331
|
+
asking: (key: string) => ptyState(key)?.asking === true,
|
|
332
|
+
// Claude Code and Codex menus take a digit, Esc backs out. ponytail: per-agent keys, a prompt worded otherwise still needs the terminal.
|
|
333
|
+
answer: (key: string, yes: boolean) => writePty(key, yes ? "1" : "\x1b"),
|
|
292
334
|
stop: (key: string) => killPty(key),
|
|
293
335
|
find: (dir: string, run: string) => liveAgent(dir, run)?.key,
|
|
294
336
|
};
|
|
295
337
|
const taskPump = setInterval(() => {
|
|
296
338
|
for (const dir of states(true)) for (const task of tasks.listTasks(dir)) {
|
|
297
339
|
// A stopping task is asked to stop again until its terminal is gone, not only when someone opens it.
|
|
298
|
-
|
|
340
|
+
// A ready task also picks up its run's acceptance given in the agent terminal (kaizen done --user-approved).
|
|
341
|
+
if ((task.status === "stopping" || task.status === "ready") && !task.archived) { try { if (taskService.reconcile(dir, task, taskHooks).revision !== task.revision) changed(); } catch { /* next pass */ } if (task.status === "stopping") continue; }
|
|
342
|
+
// A working task whose agent died is noticed and started again here, not only when someone opens it.
|
|
343
|
+
if (["working", "interrupted", "failed"].includes(task.status) && !task.archived) { try { const r = taskService.autoRecover(dir, taskService.reconcile(dir, task, taskHooks), taskHooks); if (r.revision !== task.revision) changed(); } catch { /* next pass */ } continue; }
|
|
299
344
|
if (!task.safe || task.queuePaused || task.pendingDecision || !task.inputs.some(i => i.state === "queued")) continue;
|
|
300
345
|
try { taskService.dispatchReady(dir, task.id, taskHooks); changed(); } catch { /* CAS conflict: next pass reads the new state */ }
|
|
301
346
|
}
|
|
@@ -361,6 +406,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
361
406
|
// Change notification: one SSE stream per open board, fed by fs.watch where it
|
|
362
407
|
// works and a slow poll where it does not.
|
|
363
408
|
const clients = new Set<ReadableStreamDefaultController>();
|
|
409
|
+
const devClients = new Set<ReadableStreamDefaultController>();
|
|
364
410
|
// Shells the board started (POST /shell), by /pty key; dead ones drop on the next /shells.
|
|
365
411
|
const shells = new Map<string, { key: string; dir: string; title: string; agent: string; run: string; ws?: string; pid?: number }>();
|
|
366
412
|
const SHELL_CAP = 8;
|
|
@@ -398,8 +444,8 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
398
444
|
for (const c of clients) { try { c.enqueue("data: changed\n\n"); } catch { clients.delete(c); } }
|
|
399
445
|
}, 200);
|
|
400
446
|
};
|
|
401
|
-
//
|
|
402
|
-
const inCard =
|
|
447
|
+
// What this board launches runs inside the board, shown on the card.
|
|
448
|
+
const inCard = { card: true, onChange: changed };
|
|
403
449
|
|
|
404
450
|
// The agent open in a run's card, the newest when there are several: what the user sees
|
|
405
451
|
// working. Everything sent to a run goes here before any new agent is started.
|
|
@@ -434,7 +480,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
434
480
|
const prev = readSessions(dir).filter((s) => ownerOf(dir, s, idx) === id && existsSync(tailOf(s.key))).pop();
|
|
435
481
|
let seed: string | undefined;
|
|
436
482
|
try { if (prev) seed = readText(tailOf(prev.key)) + RESUMED; } catch { /* shown without it */ }
|
|
437
|
-
const r = launchRun({ severity: null, where: null, text, raw: text }, dir, id, { ...inCard
|
|
483
|
+
const r = launchRun({ severity: null, where: null, text, raw: text }, dir, id, { ...inCard, seed });
|
|
438
484
|
if (r.ok) closeSessions(dir, id, { before });
|
|
439
485
|
if (r.ok && prev) rmSync(tailOf(prev.key), { force: true });
|
|
440
486
|
changed();
|
|
@@ -801,9 +847,8 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
801
847
|
|
|
802
848
|
if (req.method === "GET" && path === "/") {
|
|
803
849
|
const page = served(PAGE);
|
|
804
|
-
if (page === null) return new Response("web/board.html missing", { status: 500 });
|
|
805
|
-
|
|
806
|
-
return new Response(page.replace("/*notifier*/", () => notifier.toString()), {
|
|
850
|
+
if (page === null) return new Response("web/html/board.html missing", { status: 500 });
|
|
851
|
+
return new Response(page, {
|
|
807
852
|
headers: { "content-type": "text/html; charset=utf-8", "cache-control": "no-store", "x-kaizen-version": VERSION },
|
|
808
853
|
});
|
|
809
854
|
}
|
|
@@ -814,6 +859,19 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
814
859
|
return new Response(body, { headers: { "content-type": "application/javascript; charset=utf-8", "cache-control": "no-store" } });
|
|
815
860
|
}
|
|
816
861
|
|
|
862
|
+
// The React pages' Tailwind (web/ui/theme.css compiled by bun run build:web).
|
|
863
|
+
if (req.method === "GET" && path === "/ui.css") {
|
|
864
|
+
const body = served(UI_CSS);
|
|
865
|
+
if (body === null) return new Response(`${path} missing; run bun run build:web`, { status: 500 });
|
|
866
|
+
return new Response(body, { headers: { "content-type": "text/css; charset=utf-8", "cache-control": "no-store" } });
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
if (req.method === "GET" && STYLES[path]) {
|
|
870
|
+
const body = served(STYLES[path]);
|
|
871
|
+
if (body === null) return new Response(`${path} missing; run bun run build:web`, { status: 500 });
|
|
872
|
+
return new Response(body, { headers: { "content-type": "text/css; charset=utf-8", "cache-control": "no-store" } });
|
|
873
|
+
}
|
|
874
|
+
|
|
817
875
|
if (req.method === "GET" && path.startsWith("/sounds/")) {
|
|
818
876
|
const name = /^\/sounds\/([A-Za-z]+)\.mp3$/.exec(path)?.[1];
|
|
819
877
|
const file = name && join(SOUNDS_DIR, `${name}.mp3`);
|
|
@@ -828,11 +886,17 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
828
886
|
return new Response(body, { headers: { "content-type": type, "cache-control": "no-store" } });
|
|
829
887
|
}
|
|
830
888
|
|
|
889
|
+
if (req.method === "GET" && path === "/boot.js") {
|
|
890
|
+
const body = served(BOOT_JS);
|
|
891
|
+
if (body === null) return new Response(`${path} missing; run bun run build:web`, { status: 500 });
|
|
892
|
+
return new Response(body, { headers: { "content-type": "application/javascript; charset=utf-8", "cache-control": "no-store" } });
|
|
893
|
+
}
|
|
894
|
+
|
|
831
895
|
// `kaizen chat`: the small chat window over the desktop.
|
|
832
|
-
if (req.method === "GET" && path === "/popup") {
|
|
833
|
-
const body = served(POPUP_PAGE);
|
|
834
|
-
if (body === null) return new Response(
|
|
835
|
-
return new Response(body, { headers: { "content-type": "text/html; charset=utf-8", "cache-control": "no-store" } });
|
|
896
|
+
if (req.method === "GET" && (path === "/popup" || path === "/popup.js")) {
|
|
897
|
+
const body = served(path === "/popup" ? POPUP_PAGE : POPUP_JS);
|
|
898
|
+
if (body === null) return new Response(`${path} missing; run bun run build:web`, { status: 500 });
|
|
899
|
+
return new Response(body, { headers: { "content-type": path === "/popup" ? "text/html; charset=utf-8" : "application/javascript; charset=utf-8", "cache-control": "no-store" } });
|
|
836
900
|
}
|
|
837
901
|
|
|
838
902
|
// Handing the chat between Home and the popup (`kaizen chat`). /popup/open:
|
|
@@ -1012,6 +1076,16 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
1012
1076
|
const saved = saveImage(bytes);
|
|
1013
1077
|
return saved ? json({ path: saved }) : bad("not an image", 415);
|
|
1014
1078
|
}
|
|
1079
|
+
// The phone's Attach key: any file, saved on this computer under its own name, and its path typed into the terminal.
|
|
1080
|
+
if (req.method === "POST" && path === "/term-file") {
|
|
1081
|
+
if (!sameOrigin(req)) return bad("cross-origin request refused", 403);
|
|
1082
|
+
if (Number(req.headers.get("content-length") ?? 0) > MAX_FILE) return bad("file too large (25 MB at most)", 413);
|
|
1083
|
+
let name = "file";
|
|
1084
|
+
try { name = decodeURIComponent(req.headers.get("x-file-name") ?? "file"); } catch {}
|
|
1085
|
+
const bytes = new Uint8Array(await req.arrayBuffer());
|
|
1086
|
+
const saved = saveFile(bytes, name);
|
|
1087
|
+
return saved ? json({ path: saved }) : bad(bytes.length ? "file too large (25 MB at most)" : "empty file", bytes.length ? 413 : 400);
|
|
1088
|
+
}
|
|
1015
1089
|
if (req.method === "POST" && path === "/shell") {
|
|
1016
1090
|
const refused = strict(req);
|
|
1017
1091
|
if (refused) return refused;
|
|
@@ -1281,6 +1355,35 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
1281
1355
|
// Never the board itself: `kaizen web` started inside the workspace listens there too.
|
|
1282
1356
|
return json(devPorts(out, (pid) => { try { return readlinkSync(`/proc/${pid}/cwd`); } catch { return ""; } }, ws, [...KNOWN_AGENTS.map((a) => a.cmd), "cursor-agent"]).filter((p) => p !== port));
|
|
1283
1357
|
}
|
|
1358
|
+
// A dev server (POST /shell with dev) whose terminal says its port is taken: that port and who holds it, for the Run app
|
|
1359
|
+
// button's "Stop it and run the app" question. Read from the terminal's own output, so nothing is guessed.
|
|
1360
|
+
if (req.method === "GET" && path === "/shell/conflict") {
|
|
1361
|
+
if (!local(req)) return bad("cross-origin request refused", 403);
|
|
1362
|
+
const key = url.searchParams.get("key") ?? "";
|
|
1363
|
+
// The shell may already have left /shells (dead ones drop there); its output is kept a little longer.
|
|
1364
|
+
const p = /^sh-[\w-]+$/.test(key) ? conflictPort(ptyTail(key) ?? "") : null;
|
|
1365
|
+
return json(p ? { port: p, holders: await holders(p), board: p === port } : { port: null });
|
|
1366
|
+
}
|
|
1367
|
+
// The ports this user's processes listen on, inside the board's projects (the Resources popup's Ports). Not the board's own,
|
|
1368
|
+
// not the agents (Claude Code listens on a local port of its own). Linux only; elsewhere the list is empty.
|
|
1369
|
+
if (req.method === "GET" && path === "/ports") {
|
|
1370
|
+
if (!local(req)) return bad("cross-origin request refused", 403);
|
|
1371
|
+
const dirs = states(true).filter((d) => d !== join(home, ".kaizen")).map((d) => dirname(d));
|
|
1372
|
+
const agents = [...KNOWN_AGENTS.map((a) => a.cmd), "cursor-agent"];
|
|
1373
|
+
const list = inProjects(await listeners(), dirs).filter((l) => l.pid !== process.pid && l.port !== port && !agents.includes(l.name) && !isKaizenProcess(l.cmd));
|
|
1374
|
+
return json(list.map((l) => ({ port: l.port, pid: l.pid, name: l.name, cmd: l.cmd, cwd: l.cwd, project: label(join(l.project, ".kaizen")) })));
|
|
1375
|
+
}
|
|
1376
|
+
// Stops what listens on a port (the question above, answered yes): a process of this user, never the board itself.
|
|
1377
|
+
if (req.method === "POST" && path === "/port/stop") {
|
|
1378
|
+
const refused = strict(req);
|
|
1379
|
+
if (refused) return refused;
|
|
1380
|
+
let body: any;
|
|
1381
|
+
try { body = await req.json(); } catch { return bad("json body expected"); }
|
|
1382
|
+
const n = Number(body?.port);
|
|
1383
|
+
if (n === port) return bad("that is the board itself");
|
|
1384
|
+
const r = await stopPort(n, [process.pid]);
|
|
1385
|
+
return r.ok ? json(r) : bad(r.error ?? "could not stop it");
|
|
1386
|
+
}
|
|
1284
1387
|
// A phone on the tailnet cannot reach this computer's localhost. Serves that loopback port
|
|
1285
1388
|
// to the tailnet (`tailscale serve --https=<port>`, never funnel) and answers the address
|
|
1286
1389
|
// the phone opens instead. Loopback http only, one argv, never a shell string.
|
|
@@ -1349,7 +1452,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
1349
1452
|
// Not the board itself: a proxy to it would forward /pty with an Origin rewritten to the board's own.
|
|
1350
1453
|
if (u.port === (new URL(req.url).port || "80")) return bad("that is the board's own port", 400);
|
|
1351
1454
|
try {
|
|
1352
|
-
const px = openProxy(u);
|
|
1455
|
+
const px = openProxy(u, () => served(ANNOTATE_JS));
|
|
1353
1456
|
return json({ ok: true, origin: px.origin, token: px.token, url: px.origin + u.pathname + u.search + u.hash });
|
|
1354
1457
|
} catch (e) { return bad((e as Error).message, 500); }
|
|
1355
1458
|
}
|
|
@@ -1548,6 +1651,17 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
1548
1651
|
// Off this thread: it also relays every terminal, and a rebuild here froze their typing.
|
|
1549
1652
|
const { cards, extra, backlog } = await buildSnap(dirs, gitGen).catch(() => snapshot(dirs, gitGen));
|
|
1550
1653
|
const pty = ptyOf(cards), beat = heartbeatMinutes();
|
|
1654
|
+
// A task's decisions shown on its run too: the open question, and Looks good when it may be given.
|
|
1655
|
+
const taskByRun = new Map<string, { id: string; dir: string; revision: number; result: string | null; question?: { id: string; text: string; options: string[] }; accept: boolean }>();
|
|
1656
|
+
for (const d of new Set(cards.filter((c) => c.kind === "run").map((c) => c.state))) {
|
|
1657
|
+
try {
|
|
1658
|
+
for (const t of tasks.listTasks(d)) {
|
|
1659
|
+
if (t.archived || !t.activeRun) continue;
|
|
1660
|
+
const q = t.pendingDecision?.kind === "question" && t.pendingDecision.run === t.activeRun ? t.pendingDecision : null;
|
|
1661
|
+
taskByRun.set(d + "\0" + t.activeRun, { id: t.id, dir: d, revision: t.revision, result: t.currentResult, ...(q ? { question: { id: q.id, text: q.text, options: q.options ?? [] } } : {}), accept: t.status !== "accepted" && taskService.allowedActions(d, t, taskHooks).accept });
|
|
1662
|
+
}
|
|
1663
|
+
} catch { /* a task file mid-write: the next refresh has it */ }
|
|
1664
|
+
}
|
|
1551
1665
|
// The agents open now, for the sidebar cards: one list per tick, from the cards' sessions and the board's agent
|
|
1552
1666
|
// shells. ws is as the card or shell has it; the page resolves it to a listed workspace. Ended agents are left out.
|
|
1553
1667
|
const agents: any[] = [], seenKey = new Set<string>(), ptys = cards.map(pty);
|
|
@@ -1572,9 +1686,12 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
1572
1686
|
// Dirs with a card the picker leaves out (the global queue, a project outside the
|
|
1573
1687
|
// Projects folder): the rail still needs their workspaces so a waiting run shows.
|
|
1574
1688
|
rail: [...new Set(cards.map((c) => c.state))].filter((d) => !picker.includes(d)).map(entry),
|
|
1689
|
+
// Every known project, the Projects folder ignored: the Notes tab lists these (#86).
|
|
1690
|
+
known: states(true).map((d) => ({ dir: d, label: label(d) })),
|
|
1575
1691
|
fresh: unset.map((d) => ({ dir: join(d, ".kaizen"), label: tilde(d) })),
|
|
1576
1692
|
agents,
|
|
1577
1693
|
cards: cards.map((c, i) => {
|
|
1694
|
+
const task = c.kind === "run" && c.id ? taskByRun.get(c.state + "\0" + c.id) : undefined;
|
|
1578
1695
|
const rep = c.kind === "run" && c.id && c.status !== "done" && c.status !== "abandoned" ? readReport(c.state, c.id) : null;
|
|
1579
1696
|
const signal = signalOf(c, rep, ptys[i] as any, Date.now(), beat);
|
|
1580
1697
|
// Only a run that has workers.json carries `workers`: any other card is as it was.
|
|
@@ -1582,7 +1699,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
1582
1699
|
// No terminal left to wake: the card says so, and approval works here as for any run.
|
|
1583
1700
|
const hand = c.kind === "run" && c.id ? readHandoff(c.state, c.id) : null, parentPty = hand ? ptyState(hand.parent_terminal) : null;
|
|
1584
1701
|
const unwoken = wakeAction(hand, parentPty ? { ...parentPty, typedAt: parentPty.typedAt ?? 0 } : null, Date.now()), orphan = unwoken === "gone" || unwoken === "held";
|
|
1585
|
-
return { ...c, notice: notice(orphan ? { ...c, handoff: hand!.status } : c), ...extra[i], pty: ptys[i], signal, ...(ws ? { workers: ws.workers.map((x) => ({ id: x.id, title: x.title, status: workerStale(x, x.key ? ptyState(x.key) : null, Date.now(), beat) ? "stale" : x.status, bypass: x.bypass })), ...(ws.merge && ws.merge.status !== "merged" ? { workersMerge: ws.merge.status } : {}) } : {}), ...(rep?.phase ? { phase: rep.phase } : {}), ...(signal === "blocked" ? { blocked: rep!.blocked } : {}) };
|
|
1702
|
+
return { ...c, notice: notice(orphan ? { ...c, handoff: hand!.status } : c), ...extra[i], pty: ptys[i], signal, ...(ws ? { workers: ws.workers.map((x) => ({ id: x.id, title: x.title, status: workerStale(x, x.key ? ptyState(x.key) : null, Date.now(), beat) ? "stale" : x.status, bypass: x.bypass })), ...(ws.merge && ws.merge.status !== "merged" ? { workersMerge: ws.merge.status } : {}) } : {}), ...(rep?.phase ? { phase: rep.phase } : {}), ...(signal === "blocked" ? { blocked: rep!.blocked } : {}), ...(task ? { task } : {}) };
|
|
1586
1703
|
}),
|
|
1587
1704
|
backlog: backlog.map((b) => ({ ...b, starting: backlogLaunched.has(`${b.state}\0${b.source}#${b.n}`) || undefined })),
|
|
1588
1705
|
now: Date.now(),
|
|
@@ -2085,6 +2202,16 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
2085
2202
|
return new Response(null, { status: 302, headers: { location: u, "cache-control": "no-store", "referrer-policy": "no-referrer" } });
|
|
2086
2203
|
}
|
|
2087
2204
|
|
|
2205
|
+
if (DEV && path === "/__dev/stream" && req.method === "GET") {
|
|
2206
|
+
let c: ReadableStreamDefaultController;
|
|
2207
|
+
return new Response(new ReadableStream({ start(x) { c = x; devClients.add(x); x.enqueue("data: hello\n\n"); }, cancel() { devClients.delete(c); } }),
|
|
2208
|
+
{ headers: { "content-type": "text/event-stream", "cache-control": "no-store", "connection": "keep-alive" } });
|
|
2209
|
+
}
|
|
2210
|
+
if (DEV && path === "/__dev/reload" && req.method === "POST" && local(req)) {
|
|
2211
|
+
for (const c of devClients) { try { c.enqueue("data: reload\n\n"); } catch { devClients.delete(c); } }
|
|
2212
|
+
return json({ ok: true, clients: devClients.size });
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2088
2215
|
if (req.method === "GET" && path === "/events") {
|
|
2089
2216
|
let ctrl: ReadableStreamDefaultController;
|
|
2090
2217
|
const stream = new ReadableStream({
|
|
@@ -2138,7 +2265,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
2138
2265
|
agents: KNOWN_AGENTS.filter((a) => agentUsable(a.cmd)).map((a) => a.cmd),
|
|
2139
2266
|
// As POST /run starts a task, without one on the inbox.
|
|
2140
2267
|
run: async (d: string, runner: "lite" | "full", agent: string, text: string) => {
|
|
2141
|
-
const r = launchRun(parseItem(`${runner} ${text}`), d, undefined, { agent, ...inCard
|
|
2268
|
+
const r = launchRun(parseItem(`${runner} ${text}`), d, undefined, { agent, ...inCard });
|
|
2142
2269
|
changed();
|
|
2143
2270
|
return r.ok ? { agent: r.agent.cmd } : { error: r.why };
|
|
2144
2271
|
},
|
|
@@ -2496,7 +2623,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
2496
2623
|
const p = parseItem(line.text);
|
|
2497
2624
|
const it: Item = { ...p, text: kind ? `${kind} ${p.text}` : p.text };
|
|
2498
2625
|
it.notes = [source !== "orphan" ? `Parent: ${source}` : "", `Backlog: ${source}#${n}`, p.text !== line.text ? `Backlog item: ${line.text}` : ""].filter(Boolean).join("\n");
|
|
2499
|
-
const r = launchRun(it, dir, undefined, { agent, account: typeof body.account === "string" ? body.account : undefined, model: model || undefined, explore: typeof body.explore === "boolean" ? body.explore : undefined, yolo: body.yolo === true, ...inCard
|
|
2626
|
+
const r = launchRun(it, dir, undefined, { agent, account: typeof body.account === "string" ? body.account : undefined, model: model || undefined, explore: typeof body.explore === "boolean" ? body.explore : undefined, yolo: body.yolo === true, ...inCard });
|
|
2500
2627
|
if (r.ok) backlogLaunched.add(`${dir}\0${source}#${n}`);
|
|
2501
2628
|
changed();
|
|
2502
2629
|
return json(r.ok
|
|
@@ -2507,7 +2634,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
2507
2634
|
// A `started` task may be run again: the terminal the first launch opened
|
|
2508
2635
|
// can come up empty, and nothing else tells the board a run never began.
|
|
2509
2636
|
it.notes = readInbox(dir).find((l) => (l.status === "open" || l.status === "started") && l.text === text)?.notes;
|
|
2510
|
-
const r = launchRun(it, dir, undefined, { agent, account: typeof body.account === "string" ? body.account : undefined, model: model || undefined, explore: typeof body.explore === "boolean" ? body.explore : undefined, yolo: body.yolo === true, ...inCard
|
|
2637
|
+
const r = launchRun(it, dir, undefined, { agent, account: typeof body.account === "string" ? body.account : undefined, model: model || undefined, explore: typeof body.explore === "boolean" ? body.explore : undefined, yolo: body.yolo === true, ...inCard });
|
|
2511
2638
|
if (r.ok) replaceTask(dir, text, { status: "started", text });
|
|
2512
2639
|
if (r.ok && r.pty) {
|
|
2513
2640
|
for (const [k, v] of taskPty) if (!ptyState(v)) taskPty.delete(k); // sessions already dropped
|
|
@@ -2686,7 +2813,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
2686
2813
|
// The run's conversation picks the fix up, and once that window is open the
|
|
2687
2814
|
// waiting one ends. A failed launch leaves it: the decision has nowhere else.
|
|
2688
2815
|
const before = Date.now();
|
|
2689
|
-
const r = launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard
|
|
2816
|
+
const r = launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard);
|
|
2690
2817
|
if (r.ok) (closeSessions(dir, id, { before }), markStage(dir, id, "review", r.pty));
|
|
2691
2818
|
changed();
|
|
2692
2819
|
return json(r.ok
|
|
@@ -2706,7 +2833,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
2706
2833
|
const text = `run ${id}: the user chose Skip Explore for this run only. Stop exploration, preserve partial findings and unanswered questions in 00-explore.md, record that the user skipped it, run kaizen report unblock --run ${id}, set explore_status=skipped stage=plan awaiting=null with kaizen state, and prepare the plan. Do not change explore.enabled or skip the plan approval.`;
|
|
2707
2834
|
const live = liveAgent(dir, id), before = Date.now();
|
|
2708
2835
|
const r = live ? { ok: true as const, agent: live.agent, pty: live.key }
|
|
2709
|
-
: launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard
|
|
2836
|
+
: launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard);
|
|
2710
2837
|
if (live) submitPty(live.key, text);
|
|
2711
2838
|
else if (r.ok) closeSessions(dir, id, { before });
|
|
2712
2839
|
changed();
|
|
@@ -2729,31 +2856,37 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
2729
2856
|
const why = recordAcceptance(dir, id, "board");
|
|
2730
2857
|
if (why) return bad(why, 409);
|
|
2731
2858
|
finishRun(dir, id);
|
|
2859
|
+
if (run.task_id) syncTask(dir, String(run.task_id));
|
|
2732
2860
|
changed();
|
|
2733
2861
|
return json({ ok: true });
|
|
2734
2862
|
}
|
|
2735
|
-
|
|
2863
|
+
// A task's plan approval is the task's proposal confirmation: route it through the
|
|
2864
|
+
// task so the same version check and receipts apply. A revise is a change message.
|
|
2865
|
+
if (run.task_id && run.awaiting === "approvals.plan" && body.awaiting === "approvals.plan") {
|
|
2866
|
+
const found = tasks.resolveTask(dir, String(run.task_id));
|
|
2867
|
+
const d = found?.task.pendingDecision;
|
|
2868
|
+
if (!found || !d || d.kind !== "proposal" || d.run !== id) return bad("This task has no plan waiting. Refresh and try again.", 409);
|
|
2869
|
+
const why = body.why === undefined ? "" : String(body.why).trim();
|
|
2870
|
+
if (body.why !== undefined && !why) return bad("a revise needs a comment");
|
|
2871
|
+
const answers = Array.isArray(body.answers) ? body.answers.filter((a: unknown) => typeof a === "string" && a.trim()).slice(0, 20) : [];
|
|
2872
|
+
try {
|
|
2873
|
+
const op = why ? { op: "message", text: why } : { op: "confirm", decisionId: d.id };
|
|
2874
|
+
const done = taskService.taskAction(found.state, { ...op, id: found.task.id, revision: found.task.revision, operationId: `decide:${id}:${d.id}:${why ? "revise" : "confirm"}` }, taskHooks);
|
|
2875
|
+
// The plan's questions answered with the approval reach the agent as one message.
|
|
2876
|
+
if (!why && answers.length) taskService.taskAction(found.state, { op: "message", text: "Answers to the plan's questions:\n" + answers.join("\n"), id: found.task.id, revision: done.task.revision, operationId: `decide:${id}:${d.id}:answers` }, taskHooks);
|
|
2877
|
+
} catch (e) { return bad((e as Error).message, e instanceof tasks.TaskError ? e.status : 400); }
|
|
2878
|
+
changed();
|
|
2879
|
+
return json({ ok: true, task: true });
|
|
2880
|
+
}
|
|
2736
2881
|
if (!canApproveAwaiting(run.awaiting) || run.awaiting !== body.awaiting) return bad("this run is not waiting on that approval", 409);
|
|
2737
2882
|
if (run.awaiting === "findings" && body.why !== undefined) return bad("open findings can only be approved as-is or fixed individually", 409);
|
|
2738
2883
|
if (body.why !== undefined && !String(body.why).trim()) return bad("a revise needs a comment");
|
|
2739
2884
|
const answers = body.answers;
|
|
2740
2885
|
if (answers !== undefined && (run.awaiting !== "approvals.plan" || body.why !== undefined || !Array.isArray(answers)
|
|
2741
2886
|
|| !answers.length || answers.length > 20 || answers.some((a: unknown) => typeof a !== "string" || !a.trim()))) return bad("bad answers");
|
|
2742
|
-
const
|
|
2743
|
-
//
|
|
2744
|
-
|
|
2745
|
-
// continues in one new window, and then the idle one ends. A failed launch leaves
|
|
2746
|
-
// it open, since the decision went nowhere.
|
|
2747
|
-
const live = liveAgent(dir, id);
|
|
2748
|
-
const before = Date.now();
|
|
2749
|
-
const r = live ? { ok: true as const, pty: live.key, agent: live.cmd, reused: true } : launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard(dir));
|
|
2750
|
-
if (live) submitPty(live.key, text);
|
|
2751
|
-
else if (r.ok) closeSessions(dir, id, { before });
|
|
2752
|
-
// The plan's approval starts the build; fixing open findings is the review stage again.
|
|
2753
|
-
if (r.ok) markStage(dir, id, run.awaiting === "approvals.plan" ? "impl" : run.awaiting === "findings" ? "review" : "", r.pty);
|
|
2754
|
-
// Approving the review as-is is the user's acceptance, on record before the
|
|
2755
|
-
// agent marks the run done; a revise is not.
|
|
2756
|
-
if (r.ok && body.why === undefined && (run.awaiting === "approvals.review" || run.awaiting === "findings")) recordAcceptance(dir, id, "board");
|
|
2887
|
+
const { r, live } = sendDecision(dir, id, run.awaiting, body.why === undefined ? undefined : String(body.why), answers);
|
|
2888
|
+
// A task's run approved here is the task's Looks good too.
|
|
2889
|
+
if (r.ok && run.task_id) syncTask(dir, String(run.task_id));
|
|
2757
2890
|
changed();
|
|
2758
2891
|
return json(r.ok
|
|
2759
2892
|
? { ok: true, agent: r.agent, pty: r.pty, ...(live ? { reused: true } : {}) }
|
|
@@ -2773,6 +2906,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
2773
2906
|
const why = recordAcceptance(dir, id, "board");
|
|
2774
2907
|
if (why) return bad(why, 409);
|
|
2775
2908
|
finishRun(dir, id);
|
|
2909
|
+
if (st.task_id) syncTask(dir, String(st.task_id));
|
|
2776
2910
|
changed();
|
|
2777
2911
|
return json({ ok: true });
|
|
2778
2912
|
}
|
|
@@ -2838,7 +2972,6 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
2838
2972
|
done.add(`${dir}\0${id}`);
|
|
2839
2973
|
viaRun.add(key);
|
|
2840
2974
|
if (saved.crash && resumed && Date.now() - resumed < CRASH_AGAIN_MS) { console.log(` not resuming ${id}: the board died again right after resuming it`); continue; }
|
|
2841
|
-
if (launchMode(projectOf(dir)) !== "card") continue;
|
|
2842
2975
|
const r = resumeRun(dir, id);
|
|
2843
2976
|
if (saved.crash && "pty" in r && r.pty) autoResumed.set(r.pty, Date.now());
|
|
2844
2977
|
console.log(` ${"error" in r || !r.ok ? "could not resume" : "resumed"} ${id}${"error" in r ? ` (${r.error})` : !r.ok ? ` (${r.why})` : ""}`);
|
|
@@ -2995,11 +3128,8 @@ export function shellHosts(root: number, id: string): boolean {
|
|
|
2995
3128
|
}
|
|
2996
3129
|
|
|
2997
3130
|
export async function openApp(url: string, profile?: string) {
|
|
2998
|
-
// Kaizen Bot's window (a profile) is
|
|
2999
|
-
if (!profile)
|
|
3000
|
-
const { listSettings } = await import("./settings.ts");
|
|
3001
|
-
if (listSettings(join(import.meta.dir, "..")).rows.find((r) => r.key === "board.open")?.value !== "app") return openDefault(url);
|
|
3002
|
-
}
|
|
3131
|
+
// Kaizen Bot's window (a profile) is an app window; the board opens in a browser tab.
|
|
3132
|
+
if (!profile) return openDefault(url);
|
|
3003
3133
|
const args = [`--app=${url}`, ...(profile ? [`--user-data-dir=${profile}`] : [])];
|
|
3004
3134
|
const chromes = process.platform === "darwin"
|
|
3005
3135
|
? ["Google Chrome", "Chromium", "Microsoft Edge", "Brave Browser"]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kaizen-agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.87.1",
|
|
4
4
|
"description": "Staged workflow for AI agents — code, writing, research, operations: plan, human approval, build, independent review, bounded fix loop.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"agents",
|
|
14
14
|
"commands",
|
|
15
15
|
"web",
|
|
16
|
+
"tsconfig.json",
|
|
16
17
|
"assets/kaizen-logo.png",
|
|
17
18
|
"assets/kaizen.ico",
|
|
18
19
|
"README.md",
|
|
@@ -24,9 +25,10 @@
|
|
|
24
25
|
"install-links": "bun run cli/install.ts",
|
|
25
26
|
"check": "bun run cli/install.ts --check",
|
|
26
27
|
"build:web": "bun run cli/build-web.ts",
|
|
28
|
+
"dev": "bun cli/dev.ts",
|
|
27
29
|
"audit:ui": "bun run cli/ui-audit.ts",
|
|
28
|
-
"format": "prettier --write web
|
|
29
|
-
"format:check": "prettier --check web
|
|
30
|
+
"format": "prettier --write web/notebook web/term web/video web/ui web/components web/pages web/lib bot/web/app",
|
|
31
|
+
"format:check": "prettier --check web/notebook web/term web/video web/ui web/components web/pages web/lib bot/web/app",
|
|
30
32
|
"test": "bun test",
|
|
31
33
|
"prepublishOnly": "bun test",
|
|
32
34
|
"postpublish": "sh cli/release.sh",
|
|
@@ -57,12 +59,27 @@
|
|
|
57
59
|
"@codemirror/state": "6.7.6",
|
|
58
60
|
"@codemirror/view": "6.43.13",
|
|
59
61
|
"@lezer/highlight": "1.2.5",
|
|
62
|
+
"@tailwindcss/cli": "4.3.5",
|
|
63
|
+
"@types/bun": "1.4.4",
|
|
64
|
+
"@types/react": "19.3.0",
|
|
65
|
+
"@types/react-dom": "19.3.0",
|
|
60
66
|
"@xterm/addon-fit": "0.11.0",
|
|
61
67
|
"@xterm/addon-search": "0.16.0",
|
|
62
68
|
"@xterm/addon-unicode11": "0.9.0",
|
|
63
69
|
"@xterm/addon-web-links": "0.12.0",
|
|
64
70
|
"@xterm/addon-webgl": "0.19.0",
|
|
65
71
|
"@xterm/xterm": "6.0.0",
|
|
66
|
-
"
|
|
72
|
+
"class-variance-authority": "0.7.1",
|
|
73
|
+
"clsx": "2.1.1",
|
|
74
|
+
"cmdk": "1.1.1",
|
|
75
|
+
"prettier": "3.9.10",
|
|
76
|
+
"radix-ui": "1.8.1",
|
|
77
|
+
"react": "19.3.1",
|
|
78
|
+
"react-dom": "19.3.1",
|
|
79
|
+
"sonner": "2.0.8",
|
|
80
|
+
"tailwind-merge": "3.7.0",
|
|
81
|
+
"tailwindcss": "4.3.5",
|
|
82
|
+
"tw-animate-css": "1.4.0",
|
|
83
|
+
"zustand": "5.1.0"
|
|
67
84
|
}
|
|
68
85
|
}
|
package/skills/kaizen/spec.md
CHANGED
|
@@ -213,9 +213,12 @@ switch agents. Both full and lite runners honor the persisted task policy before
|
|
|
213
213
|
reading global auto/approval defaults.
|
|
214
214
|
|
|
215
215
|
Task intake/planning may ask questions and propose an outcome, but must not produce
|
|
216
|
-
until the current
|
|
217
|
-
it rejects build/review/done before that
|
|
218
|
-
task_id or task_confirmed by hand. The
|
|
216
|
+
until the current plan is explicitly approved. Use the sanctioned state command;
|
|
217
|
+
it rejects build/review/done before that approval. Do not overwrite task_policy,
|
|
218
|
+
task_id or task_confirmed by hand. The user may decide in any of three places: the task
|
|
219
|
+
page, the run panel, or by typing to you. The board records the first two; record a
|
|
220
|
+
decision typed to you with the `approved` or `answered` event below. The final yes on
|
|
221
|
+
the result is `kaizen done <run> --user-approved`; it also accepts the task.
|
|
219
222
|
|
|
220
223
|
Read context with `kaizen task show --task <uuid>`. Publish structured events with
|
|
221
224
|
`kaizen task event --task <uuid> --run <run-id> --operation <stable-event-id> --json '<event>'`.
|
|
@@ -227,6 +230,10 @@ input ids; acknowledge the launch before doing anything else:
|
|
|
227
230
|
- `{"type":"question","text":"...","options":["..."]}` requests material input.
|
|
228
231
|
- `{"type":"proposal","text":"outcome, constraints and checks","details":"full plan"}`
|
|
229
232
|
requests explicit confirmation of this run/iteration/result. Stop production here.
|
|
233
|
+
- `{"type":"approved"}` records that the user approved the current plan by typing to
|
|
234
|
+
you in the agent terminal. Send it only on a clear yes, then continue the build.
|
|
235
|
+
- `{"type":"answered","text":"..."}` records the user's answer to your open question (or
|
|
236
|
+
their plan changes) given in the agent terminal, so the task and run pages stop asking.
|
|
230
237
|
- `{"type":"work","text":"..."}` reports genuine production after confirmation.
|
|
231
238
|
- `{"type":"receipt","inputIds":["..."],"outcome":"applied"}` acknowledges only
|
|
232
239
|
dispatched input ids. Use `failed` and `error` for requests not applied.
|
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
|
+
}
|