@polderlabs/bizar 3.23.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -16
- package/bizar-dash/.bizar/activity.log +3 -0
- package/bizar-dash/.bizar/graph/.graphify_analysis.json +1540 -0
- package/bizar-dash/.bizar/graph/.graphify_labels.json +1 -0
- package/bizar-dash/.bizar/graph/GRAPH_REPORT.md +404 -0
- package/bizar-dash/.bizar/graph/cache/ast/v0.8.46/0661b816358db84dfdb7f10443db8a61152fd20b3fee950caf8fbf32920a1790.json +1 -0
- package/bizar-dash/.bizar/graph/cache/ast/v0.8.46/16da06d774142a6e5d74829ad982531286a6193ef798de8f593db029e123ec32.json +1 -0
- package/bizar-dash/.bizar/graph/cache/ast/v0.8.46/27e5697c01254c69c64c5a33896669073b40afb5ba88375102ae77fa5404136d.json +1 -0
- package/bizar-dash/.bizar/graph/cache/ast/v0.8.46/532997898027254aa4c0932243dc71d2f55888181232b65974961934997dc85b.json +1 -0
- package/bizar-dash/.bizar/graph/cache/ast/v0.8.46/84e3451a64c7f99f0cd6a88b0748d7426780486f53ab4935b7476b28c08f8293.json +1 -0
- package/bizar-dash/.bizar/graph/cache/ast/v0.8.46/88e5ea5f3e78fa69353fe9e6a8d1a05391d54605e25600cb125531eb5a6432ff.json +1 -0
- package/bizar-dash/.bizar/graph/cache/stat-index.json +1 -0
- package/bizar-dash/.bizar/graph/graph.html +307 -0
- package/bizar-dash/.bizar/graph/graph.json +40267 -0
- package/bizar-dash/.bizar/graph/manifest.json +762 -0
- package/bizar-dash/.graphifyignore +40 -0
- package/bizar-dash/.obsidian/README.md +14 -0
- package/bizar-dash/.obsidian/daily/2026-06-25.md +9 -0
- package/bizar-dash/.obsidian/vault.json +7 -0
- package/bizar-dash/.od-skills/web-prototype-e1429c1737/SKILL.md +103 -0
- package/bizar-dash/.od-skills/web-prototype-e1429c1737/assets/template.html +338 -0
- package/bizar-dash/.od-skills/web-prototype-e1429c1737/example.html +81 -0
- package/bizar-dash/.od-skills/web-prototype-e1429c1737/open-design.json +172 -0
- package/bizar-dash/.od-skills/web-prototype-e1429c1737/references/checklist.md +44 -0
- package/bizar-dash/.od-skills/web-prototype-e1429c1737/references/layouts.md +247 -0
- package/bizar-dash/CHANGELOG.md +474 -0
- package/bizar-dash/DESIGN.md +136 -0
- package/bizar-dash/dist/assets/main-B3RgW6FS.js +331 -0
- package/bizar-dash/dist/assets/main-B3RgW6FS.js.map +1 -0
- package/bizar-dash/dist/assets/main-DlJ8wgLR.css +1 -0
- package/bizar-dash/dist/assets/mobile-CsZQAswA.css +1 -0
- package/bizar-dash/dist/assets/mobile-DbxIw8BG.js +2 -0
- package/bizar-dash/dist/assets/mobile-DbxIw8BG.js.map +1 -0
- package/bizar-dash/dist/assets/mobile-Dvq2d53Y.js +354 -0
- package/bizar-dash/dist/assets/mobile-Dvq2d53Y.js.map +1 -0
- package/bizar-dash/dist/index.html +40 -0
- package/bizar-dash/dist/mobile.html +22 -0
- package/bizar-dash/plans/debug-plan/comments.json +1 -0
- package/bizar-dash/plans/debug-plan/meta.json +10 -0
- package/bizar-dash/plans/debug-plan/plan.json +174 -0
- package/bizar-dash/scripts/smoke-bg-retry.mjs +246 -0
- package/bizar-dash/src/cli/dashboard-ports.mjs +488 -0
- package/bizar-dash/src/cli.mjs +522 -0
- package/bizar-dash/src/server/activity-log.mjs +174 -0
- package/bizar-dash/src/server/agents-store.mjs +465 -0
- package/bizar-dash/src/server/api.mjs +138 -0
- package/bizar-dash/src/server/artifact-template.html +810 -0
- package/bizar-dash/src/server/artifacts-store.mjs +733 -0
- package/bizar-dash/src/server/auth.mjs +381 -0
- package/bizar-dash/src/server/background-store.mjs +447 -0
- package/bizar-dash/src/server/bg-poller.mjs +305 -0
- package/bizar-dash/src/server/bg-retry.mjs +574 -0
- package/bizar-dash/src/server/browser.mjs +40 -0
- package/bizar-dash/src/server/diagnostics-store.mjs +148 -0
- package/bizar-dash/src/server/dialog-poller.mjs +105 -0
- package/bizar-dash/src/server/dialog-store.mjs +177 -0
- package/bizar-dash/src/server/glyphs/mdx-compiler.mjs +583 -0
- package/bizar-dash/src/server/lib/path-safe.mjs +283 -0
- package/bizar-dash/src/server/memory-git.mjs +329 -0
- package/bizar-dash/src/server/memory-lightrag.mjs +767 -0
- package/bizar-dash/src/server/memory-schema.mjs +145 -0
- package/bizar-dash/src/server/memory-secrets.mjs +84 -0
- package/bizar-dash/src/server/memory-store.mjs +471 -0
- package/bizar-dash/src/server/mod-security.mjs +398 -0
- package/bizar-dash/src/server/mods-loader.mjs +1067 -0
- package/bizar-dash/src/server/notifications-store.mjs +243 -0
- package/bizar-dash/src/server/obsidian-store.mjs +318 -0
- package/bizar-dash/src/server/opencode-runner.mjs +279 -0
- package/bizar-dash/src/server/pair-store.mjs +138 -0
- package/bizar-dash/src/server/projects-store.mjs +364 -0
- package/bizar-dash/src/server/providers-store.mjs +789 -0
- package/bizar-dash/src/server/routes/_shared.mjs +415 -0
- package/bizar-dash/src/server/routes/activity.mjs +110 -0
- package/bizar-dash/src/server/routes/agents.mjs +134 -0
- package/bizar-dash/src/server/routes/artifacts.mjs +279 -0
- package/bizar-dash/src/server/routes/auth.mjs +69 -0
- package/bizar-dash/src/server/routes/background.mjs +165 -0
- package/bizar-dash/src/server/routes/chat.mjs +485 -0
- package/bizar-dash/src/server/routes/config.mjs +129 -0
- package/bizar-dash/src/server/routes/diagnostics.mjs +50 -0
- package/bizar-dash/src/server/routes/dialogs.mjs +86 -0
- package/bizar-dash/src/server/routes/fs.mjs +429 -0
- package/bizar-dash/src/server/routes/history.mjs +78 -0
- package/bizar-dash/src/server/routes/memory.mjs +658 -0
- package/bizar-dash/src/server/routes/misc.mjs +89 -0
- package/bizar-dash/src/server/routes/mods.mjs +359 -0
- package/bizar-dash/src/server/routes/notifications.mjs +54 -0
- package/bizar-dash/src/server/routes/obsidian.mjs +239 -0
- package/bizar-dash/src/server/routes/opencode-sessions.mjs +55 -0
- package/bizar-dash/src/server/routes/overview.mjs +91 -0
- package/bizar-dash/src/server/routes/pair.mjs +67 -0
- package/bizar-dash/src/server/routes/projects.mjs +175 -0
- package/bizar-dash/src/server/routes/providers.mjs +47 -0
- package/bizar-dash/src/server/routes/schedules.mjs +104 -0
- package/bizar-dash/src/server/routes/settings.mjs +51 -0
- package/bizar-dash/src/server/routes/skills.mjs +76 -0
- package/bizar-dash/src/server/routes/tasks.mjs +468 -0
- package/bizar-dash/src/server/routes/themes.mjs +51 -0
- package/bizar-dash/src/server/routes-v2/auth.mjs +59 -0
- package/bizar-dash/src/server/routes-v2/events.mjs +107 -0
- package/bizar-dash/src/server/routes-v2/health.mjs +21 -0
- package/bizar-dash/src/server/routes-v2/index.mjs +90 -0
- package/bizar-dash/src/server/routes-v2/sessions.mjs +111 -0
- package/bizar-dash/src/server/schedules-runner.mjs +369 -0
- package/bizar-dash/src/server/schedules-store.mjs +268 -0
- package/bizar-dash/src/server/search-store.mjs +220 -0
- package/bizar-dash/src/server/serve-info.mjs +684 -0
- package/bizar-dash/src/server/server.mjs +796 -0
- package/bizar-dash/src/server/settings-store.mjs +45 -0
- package/bizar-dash/src/server/skills-store.mjs +300 -0
- package/bizar-dash/src/server/state.mjs +437 -0
- package/bizar-dash/src/server/tailscale-store.mjs +113 -0
- package/bizar-dash/src/server/task-delegator.mjs +824 -0
- package/bizar-dash/src/server/tasks-store.mjs +508 -0
- package/bizar-dash/src/server/tui.mjs +923 -0
- package/bizar-dash/src/server/update-store.mjs +168 -0
- package/bizar-dash/src/server/v2-auth-file.mjs +99 -0
- package/bizar-dash/src/server/v2-event-bus.mjs +128 -0
- package/bizar-dash/src/server/watcher.mjs +81 -0
- package/bizar-dash/src/server/yaml.mjs +238 -0
- package/bizar-dash/src/web/App.tsx +718 -0
- package/bizar-dash/src/web/MobileApp.tsx +408 -0
- package/bizar-dash/src/web/components/ArtifactCreateDialog.tsx +95 -0
- package/bizar-dash/src/web/components/ArtifactListDialog.tsx +55 -0
- package/bizar-dash/src/web/components/ArtifactViewer.tsx +143 -0
- package/bizar-dash/src/web/components/AuditDialog.tsx +79 -0
- package/bizar-dash/src/web/components/BgStatusBadge.tsx +32 -0
- package/bizar-dash/src/web/components/Button.tsx +56 -0
- package/bizar-dash/src/web/components/CanvasContextMenu.tsx +68 -0
- package/bizar-dash/src/web/components/Card.tsx +40 -0
- package/bizar-dash/src/web/components/CollapsibleSection.tsx +72 -0
- package/bizar-dash/src/web/components/CommandDialog.tsx +66 -0
- package/bizar-dash/src/web/components/EmptyState.tsx +30 -0
- package/bizar-dash/src/web/components/FileBrowser.tsx +633 -0
- package/bizar-dash/src/web/components/HelpDialog.tsx +55 -0
- package/bizar-dash/src/web/components/KillConfirmDialog.tsx +88 -0
- package/bizar-dash/src/web/components/Modal.tsx +215 -0
- package/bizar-dash/src/web/components/Notifications.tsx +241 -0
- package/bizar-dash/src/web/components/SearchModal.tsx +224 -0
- package/bizar-dash/src/web/components/Sidebar.tsx +66 -0
- package/bizar-dash/src/web/components/Spinner.tsx +19 -0
- package/bizar-dash/src/web/components/StatusBadge.tsx +25 -0
- package/bizar-dash/src/web/components/Tag.tsx +28 -0
- package/bizar-dash/src/web/components/Toast.tsx +150 -0
- package/bizar-dash/src/web/components/Topbar.tsx +368 -0
- package/bizar-dash/src/web/components/VisualPlanDialog.tsx +58 -0
- package/bizar-dash/src/web/components/chat/AgentChip.tsx +68 -0
- package/bizar-dash/src/web/components/chat/ChatBubble.tsx +60 -0
- package/bizar-dash/src/web/components/chat/ChatThread.tsx +88 -0
- package/bizar-dash/src/web/components/chat/ChatTopBar.tsx +50 -0
- package/bizar-dash/src/web/components/chat/Composer.tsx +164 -0
- package/bizar-dash/src/web/components/chat/ConfirmModal.tsx +54 -0
- package/bizar-dash/src/web/components/chat/EmptyState.tsx +21 -0
- package/bizar-dash/src/web/components/chat/FirstRunGreeting.tsx +18 -0
- package/bizar-dash/src/web/components/chat/FloatingComposer.tsx +32 -0
- package/bizar-dash/src/web/components/chat/InfoPanel.tsx +119 -0
- package/bizar-dash/src/web/components/chat/LoadingSkeleton.tsx +19 -0
- package/bizar-dash/src/web/components/chat/MessageBubble.tsx +60 -0
- package/bizar-dash/src/web/components/chat/SessionList.tsx +153 -0
- package/bizar-dash/src/web/components/chat/StreamingIndicator.tsx +9 -0
- package/bizar-dash/src/web/components/chat/SuggestionCards.tsx +55 -0
- package/bizar-dash/src/web/components/chat/WelcomeScreen.tsx +36 -0
- package/bizar-dash/src/web/components/chat/index.ts +20 -0
- package/bizar-dash/src/web/components/chat/useAutoGrowTextarea.ts +18 -0
- package/bizar-dash/src/web/components/chat/useChat.ts +219 -0
- package/bizar-dash/src/web/components/chat/useSlashCommands.ts +47 -0
- package/bizar-dash/src/web/index.html +37 -0
- package/bizar-dash/src/web/lib/api.ts +193 -0
- package/bizar-dash/src/web/lib/markdown.tsx +59 -0
- package/bizar-dash/src/web/lib/types.ts +668 -0
- package/bizar-dash/src/web/lib/utils.ts +114 -0
- package/bizar-dash/src/web/lib/ws.ts +176 -0
- package/bizar-dash/src/web/main.tsx +34 -0
- package/bizar-dash/src/web/mobile/MobileApp.tsx +278 -0
- package/bizar-dash/src/web/mobile/MobileBottomNav.tsx +38 -0
- package/bizar-dash/src/web/mobile/MobileTopbar.tsx +115 -0
- package/bizar-dash/src/web/mobile/components/MobileBottomSheet.tsx +182 -0
- package/bizar-dash/src/web/mobile/components/MobileListItem.tsx +64 -0
- package/bizar-dash/src/web/mobile/components/MobileModal.tsx +123 -0
- package/bizar-dash/src/web/mobile/views/MobileActivity.tsx +273 -0
- package/bizar-dash/src/web/mobile/views/MobileAgents.tsx +374 -0
- package/bizar-dash/src/web/mobile/views/MobileArtifactCanvas.tsx +439 -0
- package/bizar-dash/src/web/mobile/views/MobileArtifacts.tsx +143 -0
- package/bizar-dash/src/web/mobile/views/MobileChat.tsx +180 -0
- package/bizar-dash/src/web/mobile/views/MobileConfig.tsx +175 -0
- package/bizar-dash/src/web/mobile/views/MobileHistory.tsx +191 -0
- package/bizar-dash/src/web/mobile/views/MobileMods.tsx +149 -0
- package/bizar-dash/src/web/mobile/views/MobileMore.tsx +121 -0
- package/bizar-dash/src/web/mobile/views/MobileNotifications.tsx +137 -0
- package/bizar-dash/src/web/mobile/views/MobilePlans.tsx +26 -0
- package/bizar-dash/src/web/mobile/views/MobileSchedules.tsx +685 -0
- package/bizar-dash/src/web/mobile/views/MobileSearchModal.tsx +172 -0
- package/bizar-dash/src/web/mobile/views/MobileSettings.tsx +388 -0
- package/bizar-dash/src/web/mobile/views/MobileSkills.tsx +153 -0
- package/bizar-dash/src/web/mobile/views/MobileTasks.tsx +564 -0
- package/bizar-dash/src/web/mobile.html +20 -0
- package/bizar-dash/src/web/mobile.tsx +13 -0
- package/bizar-dash/src/web/styles/chat.css +198 -0
- package/bizar-dash/src/web/styles/glyphs.css +960 -0
- package/bizar-dash/src/web/styles/main.css +8855 -0
- package/bizar-dash/src/web/styles/mobile-chat.css +5 -0
- package/bizar-dash/src/web/styles/mobile.css +1960 -0
- package/bizar-dash/src/web/views/Activity.tsx +1203 -0
- package/bizar-dash/src/web/views/Agents.tsx +701 -0
- package/bizar-dash/src/web/views/Artifacts.tsx +1480 -0
- package/bizar-dash/src/web/views/BackgroundAgents.tsx +450 -0
- package/bizar-dash/src/web/views/Chat.tsx +190 -0
- package/bizar-dash/src/web/views/Config.tsx +2063 -0
- package/bizar-dash/src/web/views/History.tsx +335 -0
- package/bizar-dash/src/web/views/ModView.tsx +207 -0
- package/bizar-dash/src/web/views/Mods.tsx +693 -0
- package/bizar-dash/src/web/views/Overview.tsx +812 -0
- package/bizar-dash/src/web/views/Providers.tsx +302 -0
- package/bizar-dash/src/web/views/Schedules.tsx +802 -0
- package/bizar-dash/src/web/views/Settings.tsx +1787 -0
- package/bizar-dash/src/web/views/Skills.tsx +431 -0
- package/bizar-dash/src/web/views/Tasks.tsx +1523 -0
- package/bizar-dash/src/web/views/glyphs/GlyphRenderer.tsx +613 -0
- package/bizar-dash/src/web/views/glyphs/components.tsx +1098 -0
- package/bizar-dash/templates/mod/FORMAT.md +76 -0
- package/bizar-dash/templates/mod/hello-mod/README.md +19 -0
- package/bizar-dash/templates/mod/hello-mod/agents/greeter.md +8 -0
- package/bizar-dash/templates/mod/hello-mod/commands/hello.md +6 -0
- package/bizar-dash/templates/mod/hello-mod/mod.json +20 -0
- package/bizar-dash/templates/mod/hello-mod/routes/ping.mjs +9 -0
- package/bizar-dash/templates/mod/hello-mod/views/HelloView.tsx +10 -0
- package/bizar-dash/tests/dashboard-ports.test.mjs +138 -0
- package/bizar-dash/tests/graphify-mod-spawn.node.test.mjs +90 -0
- package/bizar-dash/tests/memory-cli.test.mjs +542 -0
- package/bizar-dash/tests/memory-config.test.mjs +422 -0
- package/bizar-dash/tests/memory-git.test.mjs +246 -0
- package/bizar-dash/tests/memory-lightrag.test.mjs +153 -0
- package/bizar-dash/tests/memory-protocol-drift.test.mjs +45 -0
- package/bizar-dash/tests/memory-schema.test.mjs +198 -0
- package/bizar-dash/tests/memory-secrets.test.mjs +121 -0
- package/bizar-dash/tests/memory-store.test.mjs +390 -0
- package/bizar-dash/tests/memory-sync.test.mjs +141 -0
- package/bizar-dash/tests/mod-instructions.node.test.mjs +188 -0
- package/bizar-dash/tests/mod-security.test.mjs +273 -0
- package/bizar-dash/tests/mod-upgrade.node.test.mjs +357 -0
- package/bizar-dash/tests/no-agent-browser.node.test.mjs +98 -0
- package/bizar-dash/tests/obsidian-back-compat.test.mjs +199 -0
- package/bizar-dash/tests/opencode-runner.test.mjs +172 -0
- package/bizar-dash/tests/path-safe.test.mjs +108 -0
- package/bizar-dash/tests/providers-store-backup-keys.node.test.mjs +333 -0
- package/bizar-dash/tests/smoke-v2.mjs +212 -0
- package/bizar-dash/tests/strip-thinking.test.mjs +175 -0
- package/bizar-dash/tests/submit-feedback.test.mjs +353 -0
- package/bizar-dash/tests/tmux-wrap.test.mjs +145 -0
- package/bizar-dash/tests/yaml.test.mjs +128 -0
- package/bizar-dash/tsconfig.json +23 -0
- package/bizar-dash/vite.config.ts +27 -0
- package/cli/atomic.mjs +73 -0
- package/cli/banner.mjs +1 -1
- package/cli/bin.mjs +44 -47
- package/cli/bootstrap.mjs +1 -1
- package/cli/copy.mjs +25 -16
- package/cli/dev-link.mjs +17 -1
- package/cli/doctor.mjs +4 -4
- package/cli/doctor.test.mjs +2 -2
- package/cli/init.mjs +135 -1
- package/cli/install.mjs +31 -39
- package/cli/memory-constants.mjs +59 -0
- package/cli/memory.mjs +1436 -0
- package/cli/service.mjs +5 -6
- package/cli/utils.mjs +6 -3
- package/config/AGENTS.md +7 -7
- package/config/agents/_shared/AGENT_BASELINE.md +59 -61
- package/config/opencode.json +13 -38
- package/config/skills/memory-protocol/SKILL.md +105 -0
- package/config/skills/obsidian/SKILL.md +270 -65
- package/install.sh +59 -19
- package/package.json +49 -14
- package/packages/sdk/LICENSE +21 -0
- package/packages/sdk/README.md +80 -0
- package/packages/sdk/src/client.ts +183 -0
- package/packages/sdk/src/errors.ts +120 -0
- package/packages/sdk/src/events.ts +153 -0
- package/packages/sdk/src/index.ts +63 -0
- package/packages/sdk/src/types.ts +176 -0
- package/packages/sdk/src/version.ts +4 -0
- package/packages/sdk/tests/client.test.ts +217 -0
- package/packages/sdk/tests/errors.test.ts +108 -0
- package/packages/sdk/tests/events.test.ts +139 -0
- package/packages/sdk/tests/fixtures/fetch-mock.ts +152 -0
- package/packages/sdk/tests/fixtures/sse-mock.ts +30 -0
- package/packages/sdk/tsconfig.json +25 -0
- package/packages/sdk/vitest.config.ts +9 -0
- package/plugins/bizar/LICENSE +21 -0
- package/plugins/bizar/README.md +448 -0
- package/plugins/bizar/dist/index.js +29901 -0
- package/plugins/bizar/index.ts +1491 -0
- package/plugins/bizar/scripts/check-forbidden-imports.sh +33 -0
- package/plugins/bizar/src/background-state.ts +551 -0
- package/plugins/bizar/src/background.ts +1250 -0
- package/plugins/bizar/src/commands-impl.ts +464 -0
- package/plugins/bizar/src/commands.ts +1168 -0
- package/plugins/bizar/src/dashboard-client.ts +233 -0
- package/plugins/bizar/src/event-stream.ts +606 -0
- package/plugins/bizar/src/fingerprint.ts +120 -0
- package/plugins/bizar/src/handoff.ts +79 -0
- package/plugins/bizar/src/http-client.ts +467 -0
- package/plugins/bizar/src/key-rotation.ts +218 -0
- package/plugins/bizar/src/logger.ts +144 -0
- package/plugins/bizar/src/loop.ts +176 -0
- package/plugins/bizar/src/opencode-runner.ts +390 -0
- package/plugins/bizar/src/options.ts +421 -0
- package/plugins/bizar/src/plan-fs.ts +323 -0
- package/plugins/bizar/src/reasoning-clean.ts +454 -0
- package/plugins/bizar/src/report.ts +178 -0
- package/plugins/bizar/src/research-prompt.ts +35 -0
- package/plugins/bizar/src/serve-info.ts +228 -0
- package/plugins/bizar/src/serve.ts +496 -0
- package/plugins/bizar/src/settings.ts +349 -0
- package/plugins/bizar/src/state.ts +298 -0
- package/plugins/bizar/src/tools/bg-collect.ts +104 -0
- package/plugins/bizar/src/tools/bg-get-comments.ts +239 -0
- package/plugins/bizar/src/tools/bg-kill.ts +87 -0
- package/plugins/bizar/src/tools/bg-spawn.ts +401 -0
- package/plugins/bizar/src/tools/bg-status.ts +99 -0
- package/plugins/bizar/src/tools/open-kb.ts +191 -0
- package/plugins/bizar/src/tools/plan-action.ts +767 -0
- package/plugins/bizar/src/tools/read-glyph-feedback.ts +170 -0
- package/plugins/bizar/src/tools/wait-for-feedback.ts +402 -0
- package/plugins/bizar/tests/attach-handler-bug.test.ts +169 -0
- package/plugins/bizar/tests/background-state.test.ts +277 -0
- package/plugins/bizar/tests/background.test.ts +402 -0
- package/plugins/bizar/tests/block.test.ts +195 -0
- package/plugins/bizar/tests/canonical-key-order.test.ts +75 -0
- package/plugins/bizar/tests/commands-impl.test.ts +442 -0
- package/plugins/bizar/tests/commands.test.ts +584 -0
- package/plugins/bizar/tests/config.test.ts +122 -0
- package/plugins/bizar/tests/dashboard-client.test.ts +159 -0
- package/plugins/bizar/tests/dispose.test.ts +336 -0
- package/plugins/bizar/tests/event-stream.test.ts +409 -0
- package/plugins/bizar/tests/event.test.ts +262 -0
- package/plugins/bizar/tests/fingerprint.test.ts +162 -0
- package/plugins/bizar/tests/http-client.test.ts +404 -0
- package/plugins/bizar/tests/init-helpers.test.ts +203 -0
- package/plugins/bizar/tests/integration/slash-command.test.ts +348 -0
- package/plugins/bizar/tests/integration/tool-routing.test.ts +314 -0
- package/plugins/bizar/tests/key-rotation.test.ts +396 -0
- package/plugins/bizar/tests/loop.test.ts +397 -0
- package/plugins/bizar/tests/options.test.ts +276 -0
- package/plugins/bizar/tests/reasoning-clean.test.ts +422 -0
- package/plugins/bizar/tests/serve.test.ts +339 -0
- package/plugins/bizar/tests/settings.test.ts +351 -0
- package/plugins/bizar/tests/stall-think.test.ts +750 -0
- package/plugins/bizar/tests/state.test.ts +276 -0
- package/plugins/bizar/tests/tools/bg-collect.test.ts +337 -0
- package/plugins/bizar/tests/tools/bg-get-comments.test.ts +485 -0
- package/plugins/bizar/tests/tools/bg-kill.test.ts +235 -0
- package/plugins/bizar/tests/tools/bg-spawn-delegation.test.ts +147 -0
- package/plugins/bizar/tests/tools/bg-spawn.test.ts +311 -0
- package/plugins/bizar/tests/tools/bg-status.test.ts +217 -0
- package/plugins/bizar/tests/tools/opencode-runner.test.ts +115 -0
- package/plugins/bizar/tests/tools/plan-action.test.ts +599 -0
- package/plugins/bizar/tests/tools/read-glyph-feedback.test.ts +253 -0
- package/plugins/bizar/tests/tools/wait-for-feedback.test.ts +390 -0
- package/plugins/bizar/tests/update-deadlock.test.ts +145 -0
- package/plugins/bizar/tsconfig.json +29 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// src/lib/utils.ts — tiny shared helpers.
|
|
2
|
+
|
|
3
|
+
export function cn(...parts: (string | false | null | undefined)[]): string {
|
|
4
|
+
return parts.filter(Boolean).join(' ');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/** Compact relative time. */
|
|
8
|
+
export function formatRelative(ts: number | string | Date | undefined | null): string {
|
|
9
|
+
if (!ts && ts !== 0) return '';
|
|
10
|
+
const t = typeof ts === 'number' ? ts : new Date(ts).getTime();
|
|
11
|
+
if (Number.isNaN(t)) return '';
|
|
12
|
+
const diff = Date.now() - t;
|
|
13
|
+
if (diff < 0) return 'just now';
|
|
14
|
+
if (diff < 60_000) return 'just now';
|
|
15
|
+
if (diff < 3_600_000) return `${Math.floor(diff / 60_000)}m ago`;
|
|
16
|
+
if (diff < 86_400_000) return `${Math.floor(diff / 3_600_000)}h ago`;
|
|
17
|
+
if (diff < 7 * 86_400_000) return `${Math.floor(diff / 86_400_000)}d ago`;
|
|
18
|
+
return new Date(t).toLocaleDateString();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Full localized timestamp. */
|
|
22
|
+
export function formatTime(ts: number | string | Date | undefined | null): string {
|
|
23
|
+
if (!ts) return '';
|
|
24
|
+
const d = typeof ts === 'number' ? new Date(ts) : new Date(ts);
|
|
25
|
+
if (Number.isNaN(d.getTime())) return '';
|
|
26
|
+
return d.toLocaleString();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Trailing-suffix truncation. */
|
|
30
|
+
export function truncate(s: string | undefined | null, max = 160): string {
|
|
31
|
+
if (!s) return '';
|
|
32
|
+
return s.length > max ? s.slice(0, max) + '…' : s;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Debounce. */
|
|
36
|
+
export function debounce<T extends (...args: never[]) => void>(
|
|
37
|
+
fn: T,
|
|
38
|
+
ms = 200,
|
|
39
|
+
): (...args: Parameters<T>) => void {
|
|
40
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
41
|
+
return (...args: Parameters<T>) => {
|
|
42
|
+
if (timer) clearTimeout(timer);
|
|
43
|
+
timer = setTimeout(() => fn(...args), ms);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Color helpers (status badges). */
|
|
48
|
+
export const priorityColors: Record<string, string> = {
|
|
49
|
+
low: 'var(--text-dim)',
|
|
50
|
+
normal: 'var(--info)',
|
|
51
|
+
high: 'var(--error)',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const statusBadgeKind = (
|
|
55
|
+
status: string,
|
|
56
|
+
): 'success' | 'warning' | 'error' | 'info' | 'accent' | '' => {
|
|
57
|
+
switch (status) {
|
|
58
|
+
case 'approved':
|
|
59
|
+
case 'done':
|
|
60
|
+
return 'success';
|
|
61
|
+
case 'draft':
|
|
62
|
+
case 'queued':
|
|
63
|
+
return '';
|
|
64
|
+
case 'in-progress':
|
|
65
|
+
case 'doing':
|
|
66
|
+
return 'info';
|
|
67
|
+
case 'rejected':
|
|
68
|
+
return 'error';
|
|
69
|
+
default:
|
|
70
|
+
return 'accent';
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** Cheap hash for change-detection on text (e.g. raw JSON). */
|
|
75
|
+
export function hashText(s: string): string {
|
|
76
|
+
let h = 5381;
|
|
77
|
+
for (let i = 0; i < s.length; i++) h = ((h << 5) + h) ^ s.charCodeAt(i);
|
|
78
|
+
return (h >>> 0).toString(36);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* v3.7.1 — Auto-generate a task title from a prompt body when the user
|
|
83
|
+
* didn't provide one. Strips markdown headers, takes the first non-empty
|
|
84
|
+
* line, truncates to ~60 chars at a word boundary. Falls back to a
|
|
85
|
+
* timestamped placeholder if there's nothing to summarize.
|
|
86
|
+
*/
|
|
87
|
+
export function autoTitleFromContent(
|
|
88
|
+
body: string | undefined | null,
|
|
89
|
+
fallback = true,
|
|
90
|
+
): string {
|
|
91
|
+
const raw = (body || '').replace(/\r\n?/g, '\n').trim();
|
|
92
|
+
if (!raw) {
|
|
93
|
+
if (!fallback) return '';
|
|
94
|
+
const now = new Date();
|
|
95
|
+
const pad = (n: number) => String(n).padStart(2, '0');
|
|
96
|
+
return `Untitled task — ${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}`;
|
|
97
|
+
}
|
|
98
|
+
// Take first non-empty line; strip leading markdown heading hashes + quotes.
|
|
99
|
+
const firstLine = raw
|
|
100
|
+
.split('\n')
|
|
101
|
+
.map((l) => l.replace(/^[\s>#*\-]+/, '').trim())
|
|
102
|
+
.find((l) => l.length > 0) || '';
|
|
103
|
+
if (!firstLine) {
|
|
104
|
+
if (!fallback) return '';
|
|
105
|
+
const now = new Date();
|
|
106
|
+
const pad = (n: number) => String(n).padStart(2, '0');
|
|
107
|
+
return `Untitled task — ${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}`;
|
|
108
|
+
}
|
|
109
|
+
if (firstLine.length <= 60) return firstLine;
|
|
110
|
+
// Truncate at last word boundary within 60 chars.
|
|
111
|
+
const cut = firstLine.slice(0, 60);
|
|
112
|
+
const lastSpace = cut.lastIndexOf(' ');
|
|
113
|
+
return (lastSpace > 20 ? cut.slice(0, lastSpace) : cut).trimEnd() + '…';
|
|
114
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// src/lib/ws.ts — WebSocket with auto-reconnect + status + handlers.
|
|
2
|
+
//
|
|
3
|
+
// v3.6.0 — Bearer-token authentication. Browsers cannot set the
|
|
4
|
+
// Authorization header on the native WebSocket constructor, so we
|
|
5
|
+
// append the token as a `?token=<token>` query parameter on the
|
|
6
|
+
// connection URL. The server (auth.mjs) accepts both forms.
|
|
7
|
+
import type { WsMessage, WsStatus } from './types';
|
|
8
|
+
import { TOKEN_KEY } from './api';
|
|
9
|
+
|
|
10
|
+
type Handler = (msg: WsMessage) => void;
|
|
11
|
+
type StatusHandler = (status: WsStatus) => void;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Build the WS URL with the auth token query param appended.
|
|
15
|
+
* Returns just the bare /ws URL if no token is set (the server
|
|
16
|
+
* will 401 and the connection will fail fast — the UI surfaces
|
|
17
|
+
* "auth required" in that case).
|
|
18
|
+
*/
|
|
19
|
+
function buildWsUrl(): string {
|
|
20
|
+
if (typeof location === 'undefined') return 'ws://localhost/ws';
|
|
21
|
+
const base = `${location.protocol === 'https:' ? 'wss' : 'ws'}://${location.host}/ws`;
|
|
22
|
+
let tok = '';
|
|
23
|
+
try {
|
|
24
|
+
tok = localStorage.getItem(TOKEN_KEY) || '';
|
|
25
|
+
} catch {
|
|
26
|
+
/* localStorage unavailable */
|
|
27
|
+
}
|
|
28
|
+
if (!tok) return base;
|
|
29
|
+
return `${base}?token=${encodeURIComponent(tok)}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class Ws {
|
|
33
|
+
private readonly urlOverride?: string;
|
|
34
|
+
private handlers = new Set<Handler>();
|
|
35
|
+
private statusHandlers = new Set<StatusHandler>();
|
|
36
|
+
private ws: WebSocket | null = null;
|
|
37
|
+
private reconnectDelay = 1000;
|
|
38
|
+
private readonly maxReconnectDelay = 15000;
|
|
39
|
+
private reconnectTimer: ReturnType<typeof setTimeout> | null = null;
|
|
40
|
+
private _status: WsStatus = 'connecting';
|
|
41
|
+
private pingTimer: ReturnType<typeof setInterval> | null = null;
|
|
42
|
+
private closed = false;
|
|
43
|
+
|
|
44
|
+
constructor(url?: string) {
|
|
45
|
+
this.urlOverride = url;
|
|
46
|
+
this.connect();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
on(handler: Handler): () => void {
|
|
50
|
+
this.handlers.add(handler);
|
|
51
|
+
return () => {
|
|
52
|
+
this.handlers.delete(handler);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onStatus(handler: StatusHandler): () => void {
|
|
57
|
+
this.statusHandlers.add(handler);
|
|
58
|
+
// Fire current status immediately
|
|
59
|
+
handler(this._status);
|
|
60
|
+
return () => {
|
|
61
|
+
this.statusHandlers.delete(handler);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get status(): WsStatus {
|
|
66
|
+
return this._status;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
send(msg: unknown): boolean {
|
|
70
|
+
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
71
|
+
this.ws.send(JSON.stringify(msg));
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
close(): void {
|
|
78
|
+
this.closed = true;
|
|
79
|
+
if (this.reconnectTimer) clearTimeout(this.reconnectTimer);
|
|
80
|
+
this.reconnectTimer = null;
|
|
81
|
+
if (this.pingTimer) clearInterval(this.pingTimer);
|
|
82
|
+
this.pingTimer = null;
|
|
83
|
+
try {
|
|
84
|
+
this.ws?.close();
|
|
85
|
+
} catch {
|
|
86
|
+
/* ignore */
|
|
87
|
+
}
|
|
88
|
+
this.ws = null;
|
|
89
|
+
this.setStatus('disconnected');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private connect(): void {
|
|
93
|
+
if (this.closed) return;
|
|
94
|
+
if (this.reconnectTimer) {
|
|
95
|
+
clearTimeout(this.reconnectTimer);
|
|
96
|
+
this.reconnectTimer = null;
|
|
97
|
+
}
|
|
98
|
+
this.setStatus('connecting');
|
|
99
|
+
const url = this.urlOverride ?? buildWsUrl();
|
|
100
|
+
let socket: WebSocket;
|
|
101
|
+
try {
|
|
102
|
+
// Re-resolve the URL on every (re)connect — the token may have
|
|
103
|
+
// changed since the last attempt (e.g. after Regenerate).
|
|
104
|
+
socket = new WebSocket(url);
|
|
105
|
+
this.ws = socket;
|
|
106
|
+
} catch (err) {
|
|
107
|
+
console.warn('[ws] construct failed:', err);
|
|
108
|
+
this.scheduleReconnect();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
socket.addEventListener('open', () => {
|
|
112
|
+
if (this.ws !== socket || this.closed) return;
|
|
113
|
+
this.reconnectDelay = 1000;
|
|
114
|
+
this.setStatus('connected');
|
|
115
|
+
// Keep-alive ping every 30s
|
|
116
|
+
if (this.pingTimer) clearInterval(this.pingTimer);
|
|
117
|
+
this.pingTimer = setInterval(() => {
|
|
118
|
+
if (this._status === 'connected') this.send({ type: 'ping' });
|
|
119
|
+
}, 30_000);
|
|
120
|
+
});
|
|
121
|
+
socket.addEventListener('close', () => {
|
|
122
|
+
if (this.ws !== socket) return;
|
|
123
|
+
this.ws = null;
|
|
124
|
+
this.setStatus('disconnected');
|
|
125
|
+
if (this.pingTimer) {
|
|
126
|
+
clearInterval(this.pingTimer);
|
|
127
|
+
this.pingTimer = null;
|
|
128
|
+
}
|
|
129
|
+
if (!this.closed) this.scheduleReconnect();
|
|
130
|
+
});
|
|
131
|
+
socket.addEventListener('error', () => {
|
|
132
|
+
if (this.ws !== socket) return;
|
|
133
|
+
// 'close' will follow — keep this for logs
|
|
134
|
+
console.warn('[ws] error');
|
|
135
|
+
});
|
|
136
|
+
socket.addEventListener('message', (e) => {
|
|
137
|
+
let msg: WsMessage;
|
|
138
|
+
try {
|
|
139
|
+
msg = JSON.parse(e.data);
|
|
140
|
+
} catch {
|
|
141
|
+
console.warn('[ws] bad message');
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
for (const h of this.handlers) {
|
|
145
|
+
try {
|
|
146
|
+
h(msg);
|
|
147
|
+
} catch (err) {
|
|
148
|
+
console.error('[ws] handler error:', err);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private scheduleReconnect(): void {
|
|
155
|
+
if (this.closed || this.reconnectTimer) return;
|
|
156
|
+
this.reconnectTimer = setTimeout(() => {
|
|
157
|
+
this.reconnectTimer = null;
|
|
158
|
+
this.connect();
|
|
159
|
+
}, this.reconnectDelay);
|
|
160
|
+
this.reconnectDelay = Math.min(
|
|
161
|
+
this.reconnectDelay * 1.6,
|
|
162
|
+
this.maxReconnectDelay,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private setStatus(s: WsStatus): void {
|
|
167
|
+
this._status = s;
|
|
168
|
+
for (const h of this.statusHandlers) {
|
|
169
|
+
try {
|
|
170
|
+
h(s);
|
|
171
|
+
} catch (err) {
|
|
172
|
+
console.error('[ws] status handler error:', err);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/main.tsx — viewport-based entry: mobile or desktop
|
|
2
|
+
import { StrictMode, useEffect, useState } from 'react';
|
|
3
|
+
import { createRoot } from 'react-dom/client';
|
|
4
|
+
import { App } from './App';
|
|
5
|
+
import { MobileApp } from './MobileApp';
|
|
6
|
+
// Import mobile CSS so the MobileApp renders with styles when served
|
|
7
|
+
// from index.html (e.g. when the auto-redirect to /m is bypassed).
|
|
8
|
+
import './styles/main.css';
|
|
9
|
+
import './styles/mobile.css';
|
|
10
|
+
import './styles/glyphs.css';
|
|
11
|
+
|
|
12
|
+
function Root() {
|
|
13
|
+
const [isMobile, setIsMobile] = useState(() => {
|
|
14
|
+
if (typeof window === 'undefined') return false;
|
|
15
|
+
return window.matchMedia('(max-width: 767px)').matches;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const mql = window.matchMedia('(max-width: 767px)');
|
|
20
|
+
const handler = (e: MediaQueryListEvent) => setIsMobile(e.matches);
|
|
21
|
+
mql.addEventListener('change', handler);
|
|
22
|
+
return () => mql.removeEventListener('change', handler);
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
return isMobile ? <MobileApp /> : <App />;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const root = document.getElementById('root');
|
|
29
|
+
if (!root) throw new Error('Root element #root not found');
|
|
30
|
+
createRoot(root).render(
|
|
31
|
+
<StrictMode>
|
|
32
|
+
<Root />
|
|
33
|
+
</StrictMode>,
|
|
34
|
+
);
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
// src/mobile/MobileApp.tsx — mobile root with state-based routing + stack navigation.
|
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { Activity, MessageSquare, CheckSquare, Settings, Grid } from 'lucide-react';
|
|
4
|
+
import { api } from '../lib/api';
|
|
5
|
+
import type { Snapshot, Settings as SettingsType } from '../lib/types';
|
|
6
|
+
import { MobileTopbar } from './MobileTopbar';
|
|
7
|
+
import { MobileBottomNav, type MobileTab } from './MobileBottomNav';
|
|
8
|
+
import { MobileSearchModal } from './views/MobileSearchModal';
|
|
9
|
+
import { MobileNotifications } from './views/MobileNotifications';
|
|
10
|
+
import { MobileActivity } from './views/MobileActivity';
|
|
11
|
+
import { MobileChat } from './views/MobileChat';
|
|
12
|
+
import { MobileTasks } from './views/MobileTasks';
|
|
13
|
+
import { MobileSettings } from './views/MobileSettings';
|
|
14
|
+
import { MobileMore } from './views/MobileMore';
|
|
15
|
+
import { MobilePlans } from './views/MobilePlans';
|
|
16
|
+
import { MobileAgents } from './views/MobileAgents';
|
|
17
|
+
import { MobileSkills } from './views/MobileSkills';
|
|
18
|
+
import { MobileMods } from './views/MobileMods';
|
|
19
|
+
import { MobileSchedules } from './views/MobileSchedules';
|
|
20
|
+
import { MobileHistory } from './views/MobileHistory';
|
|
21
|
+
import { MobileConfig } from './views/MobileConfig';
|
|
22
|
+
|
|
23
|
+
export type MobileView =
|
|
24
|
+
| { id: 'activity' }
|
|
25
|
+
| { id: 'chat' }
|
|
26
|
+
| { id: 'tasks' }
|
|
27
|
+
| { id: 'settings' }
|
|
28
|
+
| { id: 'more' }
|
|
29
|
+
| { id: 'plans' }
|
|
30
|
+
| { id: 'agents' }
|
|
31
|
+
| { id: 'skills' }
|
|
32
|
+
| { id: 'mods' }
|
|
33
|
+
| { id: 'schedules' }
|
|
34
|
+
| { id: 'history' }
|
|
35
|
+
| { id: 'config' }
|
|
36
|
+
| { id: 'plan-detail'; slug: string }
|
|
37
|
+
| { id: 'agent-detail'; name: string }
|
|
38
|
+
| { id: 'task-detail'; taskId: string };
|
|
39
|
+
|
|
40
|
+
const TABS: MobileTab[] = [
|
|
41
|
+
{ id: 'activity', label: 'Activity', icon: Activity },
|
|
42
|
+
{ id: 'chat', label: 'Chat', icon: MessageSquare },
|
|
43
|
+
{ id: 'tasks', label: 'Tasks', icon: CheckSquare },
|
|
44
|
+
{ id: 'settings', label: 'Settings', icon: Settings },
|
|
45
|
+
{ id: 'more', label: 'More', icon: Grid },
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export function MobileApp() {
|
|
49
|
+
const [snapshot, setSnapshot] = useState<Snapshot | null>(null);
|
|
50
|
+
const [settings, setSettings] = useState<SettingsType | null>(null);
|
|
51
|
+
const [activeTab, setActiveTab] = useState('activity');
|
|
52
|
+
const [stack, setStack] = useState<MobileView[]>([]);
|
|
53
|
+
const [searchOpen, setSearchOpen] = useState(false);
|
|
54
|
+
const [loading, setLoading] = useState(true);
|
|
55
|
+
// v3.6.2 — Pipeline: pending taskId to open in chat when switching tabs.
|
|
56
|
+
const [pendingChatTaskId, setPendingChatTaskId] = useState<string | null>(null);
|
|
57
|
+
|
|
58
|
+
const refreshSnapshot = useCallback(async () => {
|
|
59
|
+
try {
|
|
60
|
+
const data = await api.get<Snapshot>('/snapshot');
|
|
61
|
+
setSnapshot(data);
|
|
62
|
+
if (data.settings) setSettings(data.settings.data);
|
|
63
|
+
} catch {
|
|
64
|
+
// best-effort
|
|
65
|
+
}
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
refreshSnapshot().finally(() => setLoading(false));
|
|
70
|
+
// Poll every 10s
|
|
71
|
+
const t = setInterval(refreshSnapshot, 10000);
|
|
72
|
+
return () => clearInterval(t);
|
|
73
|
+
}, [refreshSnapshot]);
|
|
74
|
+
|
|
75
|
+
// WebSocket for live updates
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
78
|
+
const ws = new WebSocket(`${proto}//${window.location.host}/ws`);
|
|
79
|
+
ws.onmessage = (e) => {
|
|
80
|
+
try {
|
|
81
|
+
const msg = JSON.parse(e.data as string);
|
|
82
|
+
if (msg.type === 'refresh' || msg.type === 'snapshot') {
|
|
83
|
+
refreshSnapshot();
|
|
84
|
+
}
|
|
85
|
+
} catch {
|
|
86
|
+
// ignore
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
ws.onerror = () => ws.close();
|
|
90
|
+
return () => ws.close();
|
|
91
|
+
}, [refreshSnapshot]);
|
|
92
|
+
|
|
93
|
+
const push = (view: MobileView) => setStack((s) => [...s, view]);
|
|
94
|
+
const pop = () => setStack((s) => s.slice(0, -1));
|
|
95
|
+
const goToTab = (id: string) => {
|
|
96
|
+
setStack([]);
|
|
97
|
+
setActiveTab(id);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const handleNavigate = (type: string, id: string) => {
|
|
101
|
+
switch (type) {
|
|
102
|
+
case 'task': push({ id: 'task-detail', taskId: id }); break;
|
|
103
|
+
case 'plan': push({ id: 'plan-detail', slug: id }); break;
|
|
104
|
+
case 'agent': push({ id: 'agent-detail', name: id }); break;
|
|
105
|
+
default: break;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// v3.6.2 — Switch to chat tab and signal a task session to load.
|
|
110
|
+
const onOpenChat = (taskId: string) => {
|
|
111
|
+
setPendingChatTaskId(taskId);
|
|
112
|
+
goToTab('chat');
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const currentView = stack.length > 0 ? stack[stack.length - 1] : { id: activeTab };
|
|
116
|
+
|
|
117
|
+
const renderView = () => {
|
|
118
|
+
// If we have a stack view, render it; otherwise render the tab
|
|
119
|
+
if (stack.length > 0) {
|
|
120
|
+
switch (stack[stack.length - 1].id) {
|
|
121
|
+
case 'plans': return (
|
|
122
|
+
<MobilePlans
|
|
123
|
+
snapshot={snapshot!}
|
|
124
|
+
onBack={pop}
|
|
125
|
+
onOpenPlan={(slug) => push({ id: 'plan-detail', slug })}
|
|
126
|
+
/>
|
|
127
|
+
);
|
|
128
|
+
case 'agents': return (
|
|
129
|
+
<MobileAgents
|
|
130
|
+
snapshot={snapshot!}
|
|
131
|
+
onBack={pop}
|
|
132
|
+
onOpenAgent={(name) => push({ id: 'agent-detail', name })}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
case 'skills': return (
|
|
136
|
+
<MobileSkills snapshot={snapshot!} onBack={pop} />
|
|
137
|
+
);
|
|
138
|
+
case 'mods': return (
|
|
139
|
+
<MobileMods snapshot={snapshot!} onBack={pop} />
|
|
140
|
+
);
|
|
141
|
+
case 'schedules': return (
|
|
142
|
+
<MobileSchedules snapshot={snapshot!} onBack={pop} />
|
|
143
|
+
);
|
|
144
|
+
case 'history': return (
|
|
145
|
+
<MobileHistory onBack={pop} />
|
|
146
|
+
);
|
|
147
|
+
case 'config': return (
|
|
148
|
+
<MobileConfig onBack={pop} />
|
|
149
|
+
);
|
|
150
|
+
case 'plan-detail': return (
|
|
151
|
+
<PlanDetailView
|
|
152
|
+
slug={(stack[stack.length - 1] as { id: 'plan-detail'; slug: string }).slug}
|
|
153
|
+
snapshot={snapshot!}
|
|
154
|
+
onBack={pop}
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
157
|
+
case 'agent-detail': return (
|
|
158
|
+
<AgentDetailView
|
|
159
|
+
name={(stack[stack.length - 1] as { id: 'agent-detail'; name: string }).name}
|
|
160
|
+
snapshot={snapshot!}
|
|
161
|
+
onBack={pop}
|
|
162
|
+
onRefresh={refreshSnapshot}
|
|
163
|
+
/>
|
|
164
|
+
);
|
|
165
|
+
case 'task-detail': return (
|
|
166
|
+
<TaskDetailView
|
|
167
|
+
taskId={(stack[stack.length - 1] as { id: 'task-detail'; taskId: string }).taskId}
|
|
168
|
+
snapshot={snapshot!}
|
|
169
|
+
onBack={pop}
|
|
170
|
+
onRefresh={refreshSnapshot}
|
|
171
|
+
/>
|
|
172
|
+
);
|
|
173
|
+
default:
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
switch (activeTab) {
|
|
179
|
+
case 'activity': return <MobileActivity snapshot={snapshot!} onRefresh={refreshSnapshot} />;
|
|
180
|
+
case 'chat': return <MobileChat snapshot={snapshot!} settings={settings!} initialTaskId={pendingChatTaskId} onClearTaskId={() => setPendingChatTaskId(null)} />;
|
|
181
|
+
case 'tasks': return <MobileTasks snapshot={snapshot!} onRefresh={refreshSnapshot} onOpenChat={onOpenChat} />;
|
|
182
|
+
case 'settings': return <MobileSettings settings={settings!} snapshot={snapshot} onRefresh={refreshSnapshot} />;
|
|
183
|
+
case 'more': return (
|
|
184
|
+
<MobileMore
|
|
185
|
+
snapshot={snapshot!}
|
|
186
|
+
onNavigate={(id) => {
|
|
187
|
+
if (['plans', 'agents', 'skills', 'mods', 'schedules', 'history', 'config'].includes(id)) {
|
|
188
|
+
push({ id: id as MobileView['id'] } as MobileView);
|
|
189
|
+
}
|
|
190
|
+
}}
|
|
191
|
+
/>
|
|
192
|
+
);
|
|
193
|
+
default: return null;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
if (loading || !snapshot) {
|
|
198
|
+
return (
|
|
199
|
+
<div className="mobile-loading">
|
|
200
|
+
<p>Loading…</p>
|
|
201
|
+
</div>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<div className="mobile-app">
|
|
207
|
+
<MobileTopbar
|
|
208
|
+
activeTab={currentView.id}
|
|
209
|
+
snapshot={snapshot}
|
|
210
|
+
onSearch={() => setSearchOpen(true)}
|
|
211
|
+
onNavigate={handleNavigate}
|
|
212
|
+
/>
|
|
213
|
+
|
|
214
|
+
<main className="mobile-content">
|
|
215
|
+
{renderView()}
|
|
216
|
+
</main>
|
|
217
|
+
|
|
218
|
+
{/* Bottom nav only on main tabs */}
|
|
219
|
+
{stack.length === 0 && (
|
|
220
|
+
<MobileBottomNav
|
|
221
|
+
tabs={TABS}
|
|
222
|
+
activeTab={activeTab}
|
|
223
|
+
onChange={(id) => goToTab(id)}
|
|
224
|
+
/>
|
|
225
|
+
)}
|
|
226
|
+
|
|
227
|
+
{/* Back button when on stack */}
|
|
228
|
+
{stack.length > 0 && (
|
|
229
|
+
<button
|
|
230
|
+
type="button"
|
|
231
|
+
className="mobile-back-btn"
|
|
232
|
+
onClick={pop}
|
|
233
|
+
aria-label="Go back"
|
|
234
|
+
>
|
|
235
|
+
← Back
|
|
236
|
+
</button>
|
|
237
|
+
)}
|
|
238
|
+
|
|
239
|
+
<MobileSearchModal
|
|
240
|
+
open={searchOpen}
|
|
241
|
+
onClose={() => setSearchOpen(false)}
|
|
242
|
+
onNavigate={handleNavigate}
|
|
243
|
+
/>
|
|
244
|
+
</div>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// ── Inline detail views ─────────────────────────────────────────────────────
|
|
249
|
+
|
|
250
|
+
function PlanDetailView({ slug, snapshot, onBack }: { slug: string; snapshot: Snapshot; onBack: () => void }) {
|
|
251
|
+
const { MobilePlanCanvas } = require('./views/MobilePlanCanvas');
|
|
252
|
+
return <MobilePlanCanvas slug={slug} onBack={onBack} />;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function AgentDetailView({ name, snapshot, onBack, onRefresh }: { name: string; snapshot: Snapshot; onBack: () => void; onRefresh: () => void }) {
|
|
256
|
+
const { MobileAgents } = require('./views/MobileAgents');
|
|
257
|
+
return (
|
|
258
|
+
<MobileAgents
|
|
259
|
+
snapshot={snapshot}
|
|
260
|
+
onBack={onBack}
|
|
261
|
+
onOpenAgent={() => {}}
|
|
262
|
+
selectedAgent={name}
|
|
263
|
+
onRefresh={onRefresh}
|
|
264
|
+
/>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function TaskDetailView({ taskId, snapshot, onBack, onRefresh }: { taskId: string; snapshot: Snapshot; onBack: () => void; onRefresh: () => void }) {
|
|
269
|
+
const { MobileTasks } = require('./views/MobileTasks');
|
|
270
|
+
return (
|
|
271
|
+
<MobileTasks
|
|
272
|
+
snapshot={snapshot}
|
|
273
|
+
onRefresh={onRefresh}
|
|
274
|
+
selectedTaskId={taskId}
|
|
275
|
+
onCloseDetail={onBack}
|
|
276
|
+
/>
|
|
277
|
+
);
|
|
278
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/mobile/MobileBottomNav.tsx — bottom tab bar for mobile.
|
|
2
|
+
import type { LucideIcon } from 'lucide-react';
|
|
3
|
+
import { cn } from '../lib/utils';
|
|
4
|
+
|
|
5
|
+
export type MobileTab = {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
icon: LucideIcon;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type Props = {
|
|
12
|
+
tabs: MobileTab[];
|
|
13
|
+
activeTab: string;
|
|
14
|
+
onChange: (id: string) => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function MobileBottomNav({ tabs, activeTab, onChange }: Props) {
|
|
18
|
+
return (
|
|
19
|
+
<nav className="mobile-bottom-nav" role="navigation" aria-label="Mobile navigation">
|
|
20
|
+
{tabs.map((t) => {
|
|
21
|
+
const Icon = t.icon;
|
|
22
|
+
return (
|
|
23
|
+
<button
|
|
24
|
+
key={t.id}
|
|
25
|
+
type="button"
|
|
26
|
+
className={cn('mobile-nav-btn', activeTab === t.id && 'mobile-nav-btn-active')}
|
|
27
|
+
onClick={() => onChange(t.id)}
|
|
28
|
+
aria-label={t.label}
|
|
29
|
+
aria-current={activeTab === t.id ? 'page' : undefined}
|
|
30
|
+
>
|
|
31
|
+
<Icon size={22} />
|
|
32
|
+
<span className="mobile-nav-label">{t.label}</span>
|
|
33
|
+
</button>
|
|
34
|
+
);
|
|
35
|
+
})}
|
|
36
|
+
</nav>
|
|
37
|
+
);
|
|
38
|
+
}
|