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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import type { RailData } from "./types.ts";
|
|
3
|
+
import { useServer } from "./server-store.ts";
|
|
4
|
+
import { liveTerminals } from "./attention.ts";
|
|
5
|
+
|
|
6
|
+
// What the side menu's Projects list and the phone's Home and Runs pages draw: every project's cards, projects and agents,
|
|
7
|
+
// and the tasks that need you.
|
|
8
|
+
const empty: RailData = { cards: [], projects: [], agents: [], tasks: null };
|
|
9
|
+
export const useRailData = (): RailData => {
|
|
10
|
+
const every = useServer((s) => s.every),
|
|
11
|
+
tasks = useServer((s) => s.tasks);
|
|
12
|
+
return useMemo(() => (every ? { ...every, tasks } : { ...empty, tasks }), [every, tasks]);
|
|
13
|
+
};
|
|
14
|
+
export const railDataNow = (): RailData => {
|
|
15
|
+
const { every, tasks } = useServer.getState();
|
|
16
|
+
return every ? { ...every, tasks } : { ...empty, tasks };
|
|
17
|
+
};
|
|
18
|
+
// The footer's live terminals: the agent sessions on every project plus the shells.
|
|
19
|
+
export const useLiveTerminals = () => useServer((s) => liveTerminals(s.every?.cards ?? [], s.shells));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Each agent's site favicon (Google's favicon service, 64 px), inline so the page needs no network.
|
|
2
|
+
export const AGENT_FAVICONS: Record<string, string> = {
|
|
3
|
+
claude:
|
|
4
|
+
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAG1BMVEXZdlbabEjacU/aZ0H+9/X67ejil4Hruavy0som81XtAAAD70lEQVRYhe1W2ZIbIQzUwQD//8XR0RKMvZWqVN5SYe0xYNRqtWSxRP/HPzvkL83nmjeE/CEer/GMzb2ce/4WQT4+aT4+Dh2D+71HcdsDIwlQFHTbYsnn6QhL2rMI5V+MJylInFSbjinH+Is6AavXvANgcUI7ADzwnDgpbfa14SeTAiep4VMgj7EVjA+CrRxfDj9eT/G2lwOof6/bpmPlwTBqj60NcwTOSUFDUs+puRVdA+Ke4NNt8+G1V5KZAxRiOkyOsk89RcCAkJGEivyRe7DcmV2osMY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ZlVwmC4QExeQQrDnxlTWvokkUE1AYCJbZSKmBk+VKqSZ2cgG1R6MTBpsLsmkOCMSLgG4Ls17ntOTIt700QgUwT4GzaGlp7LpQ8iVuZJGgLrKu0b8z5eJVUKAl7TkUbE+henEy/V5QUL4aZANMXUiQJYEwAgdiC0WgqY2fpQAlLEAgiyPZhP6wPfVIHBmX0PIgJeq7wHmebLySf4MKmPxoMsYUmehVL2SNITaWgS45+MwUEQyRm3am4b0+nhnRDEjvbI9CfXwGeRi9r/mlvOZuwjMc8cTZofd9t6LbCw8VF5ROYG8AW4g3B6vzQu5oLK4VHYAdwIgTTUDgv8hl752zDYQQDyCRxxlfUH9NM2VgpoSQkQb8sMd5tMlybKxwmw6zajI7MZzeEEZKAdmTneoPFeJy59ydXrYG/VJAm6ZyH6IxWlufXC7MxILen0WhBenV7Crfno6dwPt1tBC8vadB1BzeqbPCuw2CWijTUGk6C29D1fXlE+Olx2WZT56m5hrA2MsG1SQGHpk4ewcn1rADv3rn7TwuewCPGc257felucBE3QNqE6vrCXru5vXNX94zGK9rv/3hoU7Vrn0/++iBH2Zbdx+g/e8f+AUjCHMA9oP1SAAAAAElFTkSuQmCC",
|
|
8
|
+
opencode:
|
|
9
|
+
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAG1BMVEUTEBD///9aWFgAAABHREQGAABeXFxLSUkvLCzJjnlJAAAAVUlEQVRYhe3WMQrAMAhAUduaJvc/cWYLxUgIJfb/UfBNDooQ5exycvcPJ08AyAU8DygOjM0B1gLFFAfqbaphQE+TAgAAfAU0NbUw8BbAL4DpR5No0zpjhghz2AXH2AAAAABJRU5ErkJggg==",
|
|
10
|
+
gemini:
|
|
11
|
+
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABp1BMVEVHcEwks4M2ltktu2/sxyHkVmPkbFyGymJeieuhzlE7if00kO3qXVo7ifxKkez0uhzzqh4St3FLwWsxhv9Fhvj3vBj2R0gxhv8zh//KyTsrvWf6RUMUuWj0VkjxqCTwXU7zXEbsT1f4vRfb0THC1UOtcqnuZE3CaZH1nCCb1FnxSlAxhv+a01klrpoxhv85oc/wgjL4RkWDgdT2SEn6Q0FtyWW91UUxhv8yhv8yh/82h/43ivo+iPw5jfY6kPBHifg8nNNSifI8lOnsUVc8oMf2vhhLr5wUuWeTfMBqhuRJqqo7mNzyS053x2pDpblpw3KEgc1VtY/4RkXWYHZhvns0pLszqKutdKU7luPdW2y10EbCao7MZYOieLHYyi9fuYQetnbqkTLooitgk93nfka4bpmS0Fzysxx3hNlTnsxEunsqr5LTuDJLwG6Ku2aovU9kpLA/tIsxrJ29wT/Tf2q2hY+aiLBMl+GMlq1xmsLRcXjRjVuUrXPlvSW/eY6CjMfPnEvK0TrIrENxjdewqV6skouzm3GQn5R2uHZ2rotqqpoAshpHcEw3yyA9AAAAjXRSTlMA/hL+/v7+/v7+vlT91P0v/S1JLUaB3N7yEtwqgRJMvVNB3dpVSdTa2sV9fdPaha+w8rCFhbCv/////////////////////////////////////////////////////////////////////////////////////////////////////////////////wC9sE0CAAADIElEQVRYhc2V+1vSUBjHj1GghTM1byipaaV2v8LGRUVj3hCdSmVFJmaCoCKi4B0UsP7q3nO24eaVnT1PT9/fP5993/dsZwj972lu1skLgj7DW0F4o0tQLwj1enirIIyNWXUIekAw0KND8AoKDNyi59sJ/7mdWlBP+KnH1AWAx4KvD6kLiPwXygptMv/zI12FU/7bEA3fquAnXmvn2xT80MTSPa28Vc0PD9/QKDCbzVNKvrxcG//oLN/fX6mFbzUbjdvbKr6/97aG5xsxv7+P9y/xvZCSDRfzTqeztCmsxoWFjY2N/WRyc3PiYAnWJ/NOrrGEs2hbIHwS8wcHRxJPcJw71/Evgd/Z2UnmcoQ/KvKcGPvVi7j/AwJ8PpdLpVLAh9S8HefyElVdmD88PMznc4VUKp0OhcoZBW8XY2uovfjpXfM4wB/n84UC4UMM0+sivJ3jWLtssFWe+zSsdXdJ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8aQLA3EAE2/eoeEL3JpcLFQDIppHRCAiUm0JRLhSYWsN89G+Pff+PIpMICum37Yf3Zu/tN8M+upKarmhSA656LnHtA9HWKME3VJO50kqC7R8gpjaOp4ipmg8+kInJhMcB8uJCHZlNh8gDc8+GM2UOBIYDN0bEpGCBEoXPi/4CAYucEo4qLAsCnWYE3gFs1yjIA7pywaOLoCGCPi5igOCiSJwBwKvDM0RmAtUznuFuQo7MAKcQ+FfgjTgPcwmGTCltCdAXgSxoRKB3lNYBDRFG4El4FoBhgBvkIgOfl+01AKOEDQCjhfQBl6wbuAkb5CLCW8DbAIPkIkHy7AVia4BDAIQAek04HANRkpqoHRCV07fExNAvIjrYAGOTPPZ3yLB2utJ6E2AH8PbaELzY6o9mN91TbOAA14iuWtpeUHe9bgRGrqwD4Xff7iWEFxl7i4EXfLYClhPmL2mukjMiq5zUVHGPfBHZqZgQ9tQBA5q1CifsmkNlLPsi8A6HJ8SB98KDQLEjdaRD22NpgwEGnXyWxbQWZTYUV23Vu92sE/yD3nz847j55akX+69H1/Nn3/OH5/On7/PHt7Nbz/w/BUDv4oMpttwAAAABJRU5ErkJggg==",
|
|
14
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { stopDictation } from "@lib/dictation";
|
|
2
|
+
import { getRoute } from "@lib/router";
|
|
3
|
+
import { getPanel, setPanel, termStop } from "@lib/run";
|
|
4
|
+
import { getSettings, loadSettings, pageId, setSettings } from "./index.ts";
|
|
5
|
+
|
|
6
|
+
// Settings fills the docked panel; the page itself is React (web/pages/settings-page.tsx), fed by lib/settings/settings-store.ts.
|
|
7
|
+
// Here is only what the panel needs: the other views' tabs, terminal and footer put away, and the page asked to load.
|
|
8
|
+
// Coming from another page or a card, the body goes at once (the page draws its skeleton), not when the fetch answers.
|
|
9
|
+
export async function openSettings() {
|
|
10
|
+
if (getRoute().view !== "settings") return;
|
|
11
|
+
const gen = getSettings().pageGen + 1;
|
|
12
|
+
setSettings({ pageGen: gen });
|
|
13
|
+
stopDictation(true);
|
|
14
|
+
const fresh = !getPanel().open || getPanel().title !== "Settings";
|
|
15
|
+
termStop();
|
|
16
|
+
setPanel({ openKey: null, card: null, runDoc: null });
|
|
17
|
+
// The header's tab strip and sub line are React hosts the panel keeps: emptied through the panel store, never cleared as DOM.
|
|
18
|
+
setPanel({ open: true, title: "Settings", titleTip: "", head: null, tabs: [], footer: null, body: "settings" });
|
|
19
|
+
// Coming from another page the page starts on All projects with a skeleton; the page and search the person left it on are kept.
|
|
20
|
+
if (fresh)
|
|
21
|
+
setSettings({
|
|
22
|
+
typed: {}, // a key or secret typed and not saved is not kept when the page is left
|
|
23
|
+
scope: "all",
|
|
24
|
+
q: getSettings().startQ,
|
|
25
|
+
back: getSettings().startBack,
|
|
26
|
+
page: getSettings().page ?? pageId(new URLSearchParams(location.search).get("page") ?? ""),
|
|
27
|
+
});
|
|
28
|
+
void loadSettings(fresh, () => gen !== getSettings().pageGen);
|
|
29
|
+
}
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
// Every request Settings makes, with the same routes and payloads the old page sent. A save toasts the server's words
|
|
2
|
+
// and reads the page again, so what shows is what the server kept.
|
|
3
|
+
import { ask, post, host, toast } from "@lib/core";
|
|
4
|
+
import { setColor, setMotion, setTheme } from "@lib/shell";
|
|
5
|
+
import { getSettings, loadSettings, setSettings } from "./settings-store.ts";
|
|
6
|
+
|
|
7
|
+
const reload = () => loadSettings();
|
|
8
|
+
|
|
9
|
+
// ---- the config rows (/settings)
|
|
10
|
+
export async function saveSetting(key: string, value: string) {
|
|
11
|
+
const cfg = getSettings().data?.cfg;
|
|
12
|
+
setSettings((s) => ({ local: { ...s.local, [key]: value } }));
|
|
13
|
+
const j = await post("/settings", { key, value, scope: cfg?.scope });
|
|
14
|
+
toast(j.ok ? "Saved" : j.error || "Could not save");
|
|
15
|
+
await reload();
|
|
16
|
+
}
|
|
17
|
+
export async function resetSetting(key: string) {
|
|
18
|
+
const j = await post("/settings", { key, scope: getSettings().data?.cfg?.scope, reset: true });
|
|
19
|
+
toast(j.ok ? "Reset to All projects" : j.error || "Could not reset");
|
|
20
|
+
await reload();
|
|
21
|
+
}
|
|
22
|
+
// The system's own folder dialog, opened by the board: a page cannot read a real path.
|
|
23
|
+
export async function pickFolder(key: string) {
|
|
24
|
+
const j = await post("/pick-folder", {});
|
|
25
|
+
if (j.path) {
|
|
26
|
+
await saveSetting(key, j.path);
|
|
27
|
+
host.reload();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// ---- Agents (/agent-prefs; only the default is a config row)
|
|
32
|
+
export async function setDefaultAgent(cmd: string) {
|
|
33
|
+
const j = await post("/settings", {
|
|
34
|
+
key: "agent.default",
|
|
35
|
+
value: cmd,
|
|
36
|
+
scope: getSettings().data?.cfg?.scope ?? null,
|
|
37
|
+
});
|
|
38
|
+
toast(j.ok ? "Saved" : j.error || "Could not save");
|
|
39
|
+
await reload();
|
|
40
|
+
}
|
|
41
|
+
export async function saveAgentPrefs(patch: Record<string, unknown>) {
|
|
42
|
+
const j = await post("/agent-prefs", patch);
|
|
43
|
+
toast(j.error ? j.error : "Saved");
|
|
44
|
+
await reload();
|
|
45
|
+
}
|
|
46
|
+
// Bypass asks first; a no leaves the select where the server has it.
|
|
47
|
+
export async function setPermissions(value: string, agent?: string, name?: string) {
|
|
48
|
+
if (value === "bypass") {
|
|
49
|
+
const yes = await ask({
|
|
50
|
+
title: "Turn on bypass?",
|
|
51
|
+
description: agent
|
|
52
|
+
? "This agent will run commands without asking."
|
|
53
|
+
: "Agents will run commands without asking, in every project.",
|
|
54
|
+
confirmLabel: "Turn on bypass",
|
|
55
|
+
danger: true,
|
|
56
|
+
});
|
|
57
|
+
if (!yes) return reload();
|
|
58
|
+
}
|
|
59
|
+
return saveAgentPrefs(agent ? { agent, agentPermissions: value } : { permissions: value });
|
|
60
|
+
}
|
|
61
|
+
export const toggleAgentOpen = (cmd: string) =>
|
|
62
|
+
setSettings((s) => ({
|
|
63
|
+
openAgents: s.openAgents.includes(cmd) ? s.openAgents.filter((c) => c !== cmd) : [...s.openAgents, cmd],
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
// ---- AI Accounts (/accounts)
|
|
67
|
+
export async function accountSend(body: Record<string, unknown>) {
|
|
68
|
+
const j = await post("/accounts", body);
|
|
69
|
+
toast(j.error ? j.error : "Saved");
|
|
70
|
+
await reload();
|
|
71
|
+
}
|
|
72
|
+
export async function accountSignIn(id: string, tool: string) {
|
|
73
|
+
const dir = host.currentDir();
|
|
74
|
+
if (!dir) return toast("Open a project first, or run the line shown here in a terminal");
|
|
75
|
+
const j = await post("/shell", { dir, agent: tool, account: id, login: true });
|
|
76
|
+
if (j.error || !j.key) return toast(j.error || "Could not open a terminal. Run the line shown here");
|
|
77
|
+
const opened = host.open.term({ dir, ws: j.ws, key: j.key });
|
|
78
|
+
toast(opened ? "Sign in, then close the terminal" : "Terminal started. Open it from the side menu");
|
|
79
|
+
}
|
|
80
|
+
export async function accountAdd(tool: string) {
|
|
81
|
+
const j = await post("/accounts", { op: "add", tool });
|
|
82
|
+
if (j.error || !j.added) return toast(j.error || "Could not add the account");
|
|
83
|
+
await accountSignIn(j.added, tool);
|
|
84
|
+
await reload();
|
|
85
|
+
}
|
|
86
|
+
export async function accountRemove(id: string, name: string) {
|
|
87
|
+
const yes = await ask({
|
|
88
|
+
title: `Remove ${name}?`,
|
|
89
|
+
description: "Runs started on it won't start until you pick another.",
|
|
90
|
+
confirmLabel: "Remove",
|
|
91
|
+
danger: true,
|
|
92
|
+
});
|
|
93
|
+
if (!yes) return;
|
|
94
|
+
const deleteFolder = await ask({
|
|
95
|
+
title: "Also delete its folder?",
|
|
96
|
+
description: "Its login and conversations are in it. Cancel keeps them.",
|
|
97
|
+
confirmLabel: "Delete folder",
|
|
98
|
+
danger: true,
|
|
99
|
+
});
|
|
100
|
+
return accountSend({ op: "remove", id, deleteFolder });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ---- Skills (/skills, /rea)
|
|
104
|
+
const WARN: Record<string, string> = {
|
|
105
|
+
"kaizen-computer":
|
|
106
|
+
"They see the window text of the apps they open and can click, set values and type in them, as you. A password manager is blocked by its name only, so one inside a browser or under another name is not. Any other open app is in reach.",
|
|
107
|
+
"lemo-opuscar":
|
|
108
|
+
"The first time an agent uses it, it downloads the Lemo-Opuscar style library from github.com/lemomo-ai/lemo-opuscar (MIT) into ~/lemo-opuscar and installs its Node and Python packages there. It needs git, Node, Python and ffmpeg, and it runs that project's code on your computer.",
|
|
109
|
+
};
|
|
110
|
+
const WARN_TITLE: Record<string, string> = {
|
|
111
|
+
"kaizen-computer": "Let agents read and operate the apps on your desktop?",
|
|
112
|
+
"lemo-opuscar": "Add film styles from Lemo-Opuscar?",
|
|
113
|
+
};
|
|
114
|
+
const token = () => getSettings().data?.skills?.token ?? "";
|
|
115
|
+
export async function setSkill(id: string, on: boolean, offByDefault: boolean) {
|
|
116
|
+
if (id === "rea") return reaSwitch(on, false);
|
|
117
|
+
// An off-by-default skill gives agents a power the user never had to grant: say so, then ask.
|
|
118
|
+
const warn = on && offByDefault;
|
|
119
|
+
if (
|
|
120
|
+
warn &&
|
|
121
|
+
!(await ask({
|
|
122
|
+
title: WARN_TITLE[id] ?? "Turn this skill on?",
|
|
123
|
+
description: WARN[id],
|
|
124
|
+
confirmLabel: "Turn on",
|
|
125
|
+
}))
|
|
126
|
+
)
|
|
127
|
+
return;
|
|
128
|
+
const j = await post("/skills", { id, on, ...(warn ? { confirm: true, token: token() } : {}) });
|
|
129
|
+
toast(j.error ? j.error : "Saved. Applies to new sessions");
|
|
130
|
+
await reload();
|
|
131
|
+
}
|
|
132
|
+
// A core skill one agent is missing: relink it; a real folder in the way is replaced only after asking.
|
|
133
|
+
export async function repairSkill(id: string, own: boolean) {
|
|
134
|
+
if (
|
|
135
|
+
own &&
|
|
136
|
+
!(await ask({
|
|
137
|
+
title: "Replace your own copy?",
|
|
138
|
+
description:
|
|
139
|
+
"For at least one agent, a folder or link of the same name is in the way. It is deleted and kaizen's skill is linked in its place. Go ahead?",
|
|
140
|
+
confirmLabel: "Replace",
|
|
141
|
+
danger: true,
|
|
142
|
+
}))
|
|
143
|
+
)
|
|
144
|
+
return;
|
|
145
|
+
const j = await post("/skills", { id, repair: true, ...(own ? { replace: true, token: token() } : {}) });
|
|
146
|
+
toast(j.error ? j.error : "Repaired. Applies to new sessions");
|
|
147
|
+
await reload();
|
|
148
|
+
}
|
|
149
|
+
// REA: the board runs REA's dry run first and shows what would change; only a yes to that exact plan is applied. Off
|
|
150
|
+
// runs REA's own uninstall, whoever set REA up.
|
|
151
|
+
export async function reaSwitch(on: boolean, update: boolean) {
|
|
152
|
+
if (!on) {
|
|
153
|
+
const yes = await ask({
|
|
154
|
+
title: "Turn REA off?",
|
|
155
|
+
description:
|
|
156
|
+
"This runs REA's own uninstall: it removes REA's MCP registration and skill from every agent, also a REA you set up yourself outside kaizen. Ghidra, Java and REA's data stay.",
|
|
157
|
+
confirmLabel: "Turn off",
|
|
158
|
+
danger: true,
|
|
159
|
+
});
|
|
160
|
+
if (!yes) return;
|
|
161
|
+
toast("Removing REA…");
|
|
162
|
+
const j = await post("/rea", { step: "off" });
|
|
163
|
+
if (!j.error)
|
|
164
|
+
toast(j.hint ? `REA removed. Claude still has one: run ${j.hint}` : "REA removed. Restart your agents");
|
|
165
|
+
return reload();
|
|
166
|
+
}
|
|
167
|
+
toast(update ? "Checking the newest REA…" : "Asking REA what it would change… (first time downloads REA)");
|
|
168
|
+
const plan = await post("/rea", { step: "plan", update });
|
|
169
|
+
if (plan.error) return reload();
|
|
170
|
+
const files = plan.files?.length ? plan.files.map((f: string) => " " + f).join("\n") : " (REA did not list files)";
|
|
171
|
+
const yes = await ask({
|
|
172
|
+
title: `${update ? "Update" : "Set up"} REA ${plan.version} for: ${plan.clients.join(", ")}`,
|
|
173
|
+
description: `REA's setup will change:\n${files}\n\nIt backs each file up first. Agents can then run REA's reverse-engineering tools on files you point them at. Go ahead?`,
|
|
174
|
+
confirmLabel: update ? "Update" : "Set up",
|
|
175
|
+
});
|
|
176
|
+
if (!yes) return;
|
|
177
|
+
toast(update ? "Updating REA…" : "Setting up REA…");
|
|
178
|
+
const j = await post("/rea", { step: "apply", confirm: true, token: plan.token });
|
|
179
|
+
if (!j.error) toast(`REA ${j.version} is set up. Restart your agents to load its tools`);
|
|
180
|
+
return reload();
|
|
181
|
+
}
|
|
182
|
+
export async function reaNode(state: string, command: string) {
|
|
183
|
+
const what = state === "missing" ? "Install" : "Update";
|
|
184
|
+
const yes = await ask({
|
|
185
|
+
title: `${what} Node.js?`,
|
|
186
|
+
description: `REA needs it. kaizen will run:\n ${command}\n\nThis installs Node.js for the whole computer, so other apps that use Node.js get it too. Your system may ask for permission. Go ahead?`,
|
|
187
|
+
confirmLabel: what,
|
|
188
|
+
});
|
|
189
|
+
if (!yes) return;
|
|
190
|
+
setSettings({ busy: "rea-node" });
|
|
191
|
+
toast(`${what === "Install" ? "Installing" : "Updating"} Node.js… this can take a few minutes`);
|
|
192
|
+
const j = await post("/rea", { step: "node", confirm: true, token: token() });
|
|
193
|
+
if (!j.error) toast("Node.js is ready. Restart any agents that are open so REA's tools load");
|
|
194
|
+
setSettings({ busy: "" });
|
|
195
|
+
await reload();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ---- Automations (/automations)
|
|
199
|
+
export async function automationOp(op: string, id = "") {
|
|
200
|
+
const { draft, editing, data } = getSettings();
|
|
201
|
+
const d = data?.automations;
|
|
202
|
+
if (op === "edit") {
|
|
203
|
+
const r = d.rules.find((x: any) => x.id === id);
|
|
204
|
+
setSettings({
|
|
205
|
+
editing: id,
|
|
206
|
+
draft: {
|
|
207
|
+
...draft,
|
|
208
|
+
name: r.name,
|
|
209
|
+
text: r.text,
|
|
210
|
+
kind: r.kind,
|
|
211
|
+
cron: r.cron,
|
|
212
|
+
agent: r.agent ?? "",
|
|
213
|
+
precheck: r.precheck ?? "",
|
|
214
|
+
precheck_timeout: String(r.precheck_timeout),
|
|
215
|
+
grace_minutes: String(r.grace_minutes),
|
|
216
|
+
time: "09:00",
|
|
217
|
+
day: "mon",
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (op === "cancel") return setSettings({ editing: "" });
|
|
223
|
+
if (
|
|
224
|
+
op === "delete" &&
|
|
225
|
+
!(await ask({
|
|
226
|
+
title: "Delete this automation and its history?",
|
|
227
|
+
confirmLabel: "Delete",
|
|
228
|
+
danger: true,
|
|
229
|
+
}))
|
|
230
|
+
)
|
|
231
|
+
return;
|
|
232
|
+
const j = await post(
|
|
233
|
+
"/automations",
|
|
234
|
+
op === "save" ? { op: editing ? "update" : "create", id: editing, ...draft } : { op, id },
|
|
235
|
+
);
|
|
236
|
+
if (j.error) return toast(j.error);
|
|
237
|
+
if (op === "save") {
|
|
238
|
+
const next = { ...draft };
|
|
239
|
+
for (const k of ["name", "text", "cron", "agent", "precheck"]) delete next[k];
|
|
240
|
+
setSettings({ editing: "", draft: next });
|
|
241
|
+
toast("Saved");
|
|
242
|
+
} else if (op === "run")
|
|
243
|
+
toast(j.ok ? "Started" : (j.status ?? "not started").replace(/_/g, " ") + (j.why ? ": " + j.why : ""));
|
|
244
|
+
await reload();
|
|
245
|
+
}
|
|
246
|
+
export const setDraft = (k: string, v: string) => setSettings((s) => ({ draft: { ...s.draft, [k]: v } }));
|
|
247
|
+
|
|
248
|
+
// ---- Storage (/cleanup)
|
|
249
|
+
export async function cleanup(what: "records" | "runs") {
|
|
250
|
+
const d = getSettings().data?.cleanup;
|
|
251
|
+
if (!d) return;
|
|
252
|
+
const where = d.project ? ` in ${d.project}` : "";
|
|
253
|
+
const total = d.records.abandoned + d.records.unowned + d.records.gone;
|
|
254
|
+
const yes = await ask(
|
|
255
|
+
what === "records"
|
|
256
|
+
? { title: `Delete ${total} launch records${where}?`, confirmLabel: "Delete", danger: true }
|
|
257
|
+
: {
|
|
258
|
+
title: `Permanently delete ${d.runs} finished runs${where}?`,
|
|
259
|
+
description: "Their plans, reviews and reports go, and this cannot be undone.",
|
|
260
|
+
confirmLabel: "Delete",
|
|
261
|
+
danger: true,
|
|
262
|
+
},
|
|
263
|
+
);
|
|
264
|
+
if (!yes) return;
|
|
265
|
+
const j = await post("/cleanup", { what });
|
|
266
|
+
toast(j.error ?? `Removed ${j.removed}`);
|
|
267
|
+
await reload();
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// ---- Google and Firecrawl
|
|
271
|
+
export async function saveGoogleClient(id: string, secret: string) {
|
|
272
|
+
const j = await post("/google", { op: "client", id, secret });
|
|
273
|
+
toast(j.ok ? "Saved" : j.error || "Enter both the client id and the secret");
|
|
274
|
+
setSettings((s) => ({ typed: { ...s.typed, "gg-id": "", "gg-secret": "" } }));
|
|
275
|
+
await reload();
|
|
276
|
+
}
|
|
277
|
+
export async function googleConnect(connected: boolean) {
|
|
278
|
+
if (connected) {
|
|
279
|
+
await post("/google", { op: "disconnect" });
|
|
280
|
+
return reload();
|
|
281
|
+
}
|
|
282
|
+
const w = window.open("", "_blank");
|
|
283
|
+
const j = await post("/google", { op: "connect" });
|
|
284
|
+
if (j.ok && w) w.location = j.url;
|
|
285
|
+
else {
|
|
286
|
+
w?.close();
|
|
287
|
+
toast(j.error || "Could not start Google sign-in");
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
export async function saveResearchKey(key: string) {
|
|
291
|
+
if (!key.trim()) return toast("Paste your Firecrawl API key first");
|
|
292
|
+
const j = await post("/research-key", { op: "save", key: key.trim() });
|
|
293
|
+
if (j.set) toast("Saved. kaizen search now uses Firecrawl");
|
|
294
|
+
setSettings((s) => ({ typed: { ...s.typed, "fc-key": "" } }));
|
|
295
|
+
await reload();
|
|
296
|
+
}
|
|
297
|
+
export async function testResearchKey() {
|
|
298
|
+
setSettings({ busy: "fc-test" });
|
|
299
|
+
const j = await post("/research-key", { op: "test" });
|
|
300
|
+
setSettings({ busy: "" });
|
|
301
|
+
if (j.tested) toast("Firecrawl answered. The key works");
|
|
302
|
+
else if (j.error) toast(j.error);
|
|
303
|
+
}
|
|
304
|
+
export async function removeResearchKey() {
|
|
305
|
+
const yes = await ask({
|
|
306
|
+
title: "Remove the saved Firecrawl key?",
|
|
307
|
+
description: "Agents fall back to their own web tools.",
|
|
308
|
+
confirmLabel: "Remove",
|
|
309
|
+
danger: true,
|
|
310
|
+
});
|
|
311
|
+
if (!yes) return;
|
|
312
|
+
await post("/research-key", { op: "remove" });
|
|
313
|
+
await reload();
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// ---- this browser's own choices: nothing to read back, so the control answers at once
|
|
317
|
+
const keep = (k: string, v: string) => {
|
|
318
|
+
try {
|
|
319
|
+
localStorage.setItem(k, v);
|
|
320
|
+
} catch {}
|
|
321
|
+
};
|
|
322
|
+
export function setBrowserPref(kind: "theme" | "color" | "motion", v: string) {
|
|
323
|
+
setSettings((s) => ({ prefs: { ...s.prefs, [kind]: v } }));
|
|
324
|
+
({ theme: setTheme, color: setColor, motion: setMotion })[kind](v);
|
|
325
|
+
}
|
|
326
|
+
export function setFont(n: number) {
|
|
327
|
+
host.font.set(n);
|
|
328
|
+
setSettings((s) => ({ prefs: { ...s.prefs, font: n } }));
|
|
329
|
+
}
|
|
330
|
+
export function setNotify(on: boolean) {
|
|
331
|
+
keep("kz-notify", on ? "on" : "off");
|
|
332
|
+
if (on) host.notify();
|
|
333
|
+
setSettings((s) => ({ prefs: { ...s.prefs, notify: on } }));
|
|
334
|
+
// The browser's answer to the question changes the help line.
|
|
335
|
+
setTimeout(() => void loadSettings(), 300);
|
|
336
|
+
}
|
|
337
|
+
export function setHaptic(on: boolean) {
|
|
338
|
+
keep("kz-haptic", on ? "on" : "off");
|
|
339
|
+
setSettings((s) => ({ prefs: { ...s.prefs, haptic: on } }));
|
|
340
|
+
}
|
|
341
|
+
export function setSound(v: string) {
|
|
342
|
+
keep("kz-sound", v);
|
|
343
|
+
host.notices.play(v);
|
|
344
|
+
setSettings((s) => ({ prefs: { ...s.prefs, sound: v } }));
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// ---- the page itself
|
|
348
|
+
// The page goes in the address, without a history step per page: Back to app leaves in one.
|
|
349
|
+
export function pickPage(id: string) {
|
|
350
|
+
setSettings({ page: id });
|
|
351
|
+
history.replaceState(null, "", "?view=settings" + (id ? "&page=" + id : ""));
|
|
352
|
+
}
|
|
353
|
+
export function pickScope(scope: string) {
|
|
354
|
+
if (scope === getSettings().scope) return;
|
|
355
|
+
setSettings({ scope });
|
|
356
|
+
void loadSettings();
|
|
357
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Settings' state (Zustand): what the eight routes answered, the scope, the page and the search, the browser's own
|
|
2
|
+
// choices, and the small things a redraw must not lose (open agent rows, the automation form, a value on its way to
|
|
3
|
+
// the server). The board's engine only opens the page (lib/settings/panel-settings.ts); everything else is here.
|
|
4
|
+
import { create } from "zustand";
|
|
5
|
+
import { host } from "@lib/core";
|
|
6
|
+
import type { Data } from "./settings.ts";
|
|
7
|
+
|
|
8
|
+
export type Prefs = {
|
|
9
|
+
theme: string;
|
|
10
|
+
color: string;
|
|
11
|
+
motion: string;
|
|
12
|
+
font: number;
|
|
13
|
+
notify: boolean;
|
|
14
|
+
haptic: boolean;
|
|
15
|
+
sound: string;
|
|
16
|
+
};
|
|
17
|
+
export type SettingsState = {
|
|
18
|
+
data: Data | null; // null: loading, so the page draws its skeleton
|
|
19
|
+
scope: string; // "all" or a project's state dir; opening always starts on All projects
|
|
20
|
+
page: string | null; // the page picked; null is the list on a phone, the first page on a desktop
|
|
21
|
+
q: string; // the search box, which survives a save
|
|
22
|
+
back: boolean; // opened from another page: Back to app goes back, not Home
|
|
23
|
+
prefs: Prefs;
|
|
24
|
+
local: Record<string, string>; // a setting's value the moment it is picked, until the server's answer is read
|
|
25
|
+
openAgents: string[]; // agent rows left open
|
|
26
|
+
draft: Record<string, string>; // the new-automation form
|
|
27
|
+
editing: string; // the automation being edited
|
|
28
|
+
busy: string; // the id of a button whose request is on its way
|
|
29
|
+
typed: Record<string, string>; // what is typed in a key or secret box and not sent yet, by field id
|
|
30
|
+
// What opening the page hands it (the menu starts empty, a link may name a search and whether Back returns), and the count of
|
|
31
|
+
// views since: a fill started under one view does not land after another began.
|
|
32
|
+
startQ: string;
|
|
33
|
+
startBack: boolean;
|
|
34
|
+
pageGen: number;
|
|
35
|
+
};
|
|
36
|
+
const AUTO_DRAFT = { kind: "daily", time: "09:00", day: "mon", grace_minutes: "720", precheck_timeout: "60" };
|
|
37
|
+
export const readPrefs = (): Prefs => {
|
|
38
|
+
const r = document.documentElement.dataset;
|
|
39
|
+
let haptic = true;
|
|
40
|
+
try {
|
|
41
|
+
haptic = localStorage.getItem("kz-haptic") !== "off";
|
|
42
|
+
} catch {}
|
|
43
|
+
return {
|
|
44
|
+
theme: r.theme || "system",
|
|
45
|
+
color: r.color || "monochrome",
|
|
46
|
+
motion: r.motion || "system",
|
|
47
|
+
font: host.font.read(),
|
|
48
|
+
notify: host.notices.on(),
|
|
49
|
+
haptic,
|
|
50
|
+
sound: host.notices.sound(),
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export const useSettings = create<SettingsState>()(() => ({
|
|
54
|
+
data: null,
|
|
55
|
+
scope: "all",
|
|
56
|
+
page: null,
|
|
57
|
+
q: "",
|
|
58
|
+
back: false,
|
|
59
|
+
prefs: readPrefs(),
|
|
60
|
+
local: {},
|
|
61
|
+
openAgents: [],
|
|
62
|
+
draft: { ...AUTO_DRAFT },
|
|
63
|
+
editing: "",
|
|
64
|
+
busy: "",
|
|
65
|
+
typed: {},
|
|
66
|
+
startQ: "",
|
|
67
|
+
startBack: false,
|
|
68
|
+
pageGen: 0,
|
|
69
|
+
}));
|
|
70
|
+
export const setTyped = (k: string, v: string) => setSettings((s) => ({ typed: { ...s.typed, [k]: v } }));
|
|
71
|
+
export const getSettings = useSettings.getState;
|
|
72
|
+
export const setSettings = useSettings.setState;
|
|
73
|
+
export const resetAutoDraft = () => setSettings({ draft: { ...AUTO_DRAFT }, editing: "" });
|
|
74
|
+
|
|
75
|
+
// A slow answer must not paint over a newer one, or one page under another's title.
|
|
76
|
+
let gen = 0;
|
|
77
|
+
export const settingsGen = () => gen;
|
|
78
|
+
export const bumpSettingsGen = () => ++gen;
|
|
79
|
+
const get = (url: string, init?: RequestInit) =>
|
|
80
|
+
fetch(url, init)
|
|
81
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
82
|
+
.catch(() => null);
|
|
83
|
+
// Everything the page shows, asked for at once. With `skeleton`, the body goes now, not when the fetch answers.
|
|
84
|
+
export async function loadSettings(skeleton = false, stale?: () => boolean): Promise<void> {
|
|
85
|
+
const mine = ++gen;
|
|
86
|
+
if (skeleton) setSettings({ data: null });
|
|
87
|
+
const { scope } = getSettings();
|
|
88
|
+
const h = { headers: host.dirHeader() };
|
|
89
|
+
const [cfg, google, research, agents, accounts, skills, automations, cleanup] = await Promise.all([
|
|
90
|
+
get("/settings?scope=" + encodeURIComponent(scope)),
|
|
91
|
+
get("/google"),
|
|
92
|
+
get("/research-key"),
|
|
93
|
+
get("/agent-prefs"),
|
|
94
|
+
get("/accounts"),
|
|
95
|
+
get("/skills"),
|
|
96
|
+
get("/automations", h),
|
|
97
|
+
get("/cleanup", h),
|
|
98
|
+
]);
|
|
99
|
+
// A project the board no longer knows: fall back to All projects.
|
|
100
|
+
if (!cfg && scope !== "all") {
|
|
101
|
+
if (mine !== gen || stale?.()) return;
|
|
102
|
+
setSettings({ scope: "all" });
|
|
103
|
+
return loadSettings(false, stale);
|
|
104
|
+
}
|
|
105
|
+
if (mine !== gen || stale?.()) return;
|
|
106
|
+
setSettings({
|
|
107
|
+
data: { cfg, google: google ?? {}, research, agents, accounts, skills, automations, cleanup },
|
|
108
|
+
prefs: readPrefs(),
|
|
109
|
+
local: {},
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// The search box of the page, for the `/` key (the page registers it while it shows).
|
|
114
|
+
export const searchBox: { el: HTMLInputElement | null } = { el: null };
|