@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,180 @@
|
|
|
1
|
+
// src/web/mobile/views/MobileChat.tsx — mobile-adapted chat using shared components.
|
|
2
|
+
// Composer state (agent, model, text, attachments) is local.
|
|
3
|
+
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { ChatTopBar } from '../../components/chat/ChatTopBar';
|
|
6
|
+
import { SessionList } from '../../components/chat/SessionList';
|
|
7
|
+
import { ChatThread } from '../../components/chat/ChatThread';
|
|
8
|
+
import { FloatingComposer } from '../../components/chat/FloatingComposer';
|
|
9
|
+
import { InfoPanel } from '../../components/chat/InfoPanel';
|
|
10
|
+
import { useChat } from '../../components/chat/useChat';
|
|
11
|
+
import { useSlashCommands } from '../../components/chat/useSlashCommands';
|
|
12
|
+
import { useToast } from '../../components/Toast';
|
|
13
|
+
import { useModal } from '../../components/Modal';
|
|
14
|
+
import { Button } from '../../components/Button';
|
|
15
|
+
import type { Snapshot, Settings } from '../../lib/types';
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
snapshot: Snapshot;
|
|
19
|
+
settings: Settings;
|
|
20
|
+
setActiveTab?: (id: string) => void;
|
|
21
|
+
initialTaskId?: string | null;
|
|
22
|
+
onClearTaskId?: () => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function MobileChat({ snapshot, settings, setActiveTab, initialTaskId, onClearTaskId }: Props) {
|
|
26
|
+
const toast = useToast();
|
|
27
|
+
const modal = useModal();
|
|
28
|
+
|
|
29
|
+
const chat = useChat(snapshot, settings, initialTaskId ?? '');
|
|
30
|
+
|
|
31
|
+
const [text, setText] = useState('');
|
|
32
|
+
const [agent, setAgent] = useState(settings.defaultAgent || 'odin');
|
|
33
|
+
const [model, setModel] = useState(settings.defaultModel || '');
|
|
34
|
+
const [attachments, setAttachments] = useState<string[]>([]);
|
|
35
|
+
const [creating, setCreating] = useState(false);
|
|
36
|
+
const [sessionsOpen, setSessionsOpen] = useState(false);
|
|
37
|
+
const [infoOpen, setInfoOpen] = useState(false);
|
|
38
|
+
|
|
39
|
+
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
40
|
+
|
|
41
|
+
const { allCommands, suggestions, setQuery } = useSlashCommands(snapshot);
|
|
42
|
+
|
|
43
|
+
useEffect(() => { setQuery(text); }, [text, setQuery]);
|
|
44
|
+
|
|
45
|
+
const onAttach = () => fileInputRef.current?.click();
|
|
46
|
+
|
|
47
|
+
const onFiles = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
48
|
+
const files = e.target.files;
|
|
49
|
+
if (!files) return;
|
|
50
|
+
const next: string[] = [];
|
|
51
|
+
for (let i = 0; i < files.length; i++) next.push(files[i].name);
|
|
52
|
+
setAttachments((cur) => {
|
|
53
|
+
const newNames = next.filter((n) => !cur.includes(n));
|
|
54
|
+
return [...cur, ...newNames];
|
|
55
|
+
});
|
|
56
|
+
if (fileInputRef.current) fileInputRef.current.value = '';
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleSend = () => {
|
|
60
|
+
const msg = text.trim();
|
|
61
|
+
if (!msg) return;
|
|
62
|
+
setText('');
|
|
63
|
+
setQuery('');
|
|
64
|
+
chat.onSend(msg, agent, model, attachments);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const handleCreateSession = async () => {
|
|
68
|
+
if (creating) return;
|
|
69
|
+
if (!snapshot.activeProject) {
|
|
70
|
+
toast.warning('Pick a project in Overview to scope chat sessions.', 4000);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
setCreating(true);
|
|
74
|
+
try {
|
|
75
|
+
const created = await fetch('/chat/sessions', { method: 'POST' }).then((r) => r.json());
|
|
76
|
+
chat.loadChat(created.id);
|
|
77
|
+
toast.success(`Session ${created.id} created.`);
|
|
78
|
+
} catch (err) {
|
|
79
|
+
toast.error(`Create failed: ${(err as Error).message}`);
|
|
80
|
+
} finally {
|
|
81
|
+
setCreating(false);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const handleDelete = (idx: number) => {
|
|
86
|
+
modal.open({
|
|
87
|
+
title: 'Delete message?',
|
|
88
|
+
children: <p style={{ margin: 0 }}>This action cannot be undone.</p>,
|
|
89
|
+
footer: (
|
|
90
|
+
<div style={{ display: 'flex', gap: 8, justifyContent: 'flex-end' }}>
|
|
91
|
+
<Button variant="secondary" size="sm" onClick={() => modal.close()}>Cancel</Button>
|
|
92
|
+
<Button
|
|
93
|
+
variant="danger"
|
|
94
|
+
size="sm"
|
|
95
|
+
onClick={() => {
|
|
96
|
+
modal.close();
|
|
97
|
+
chat.deleteMessage(idx);
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
Delete
|
|
101
|
+
</Button>
|
|
102
|
+
</div>
|
|
103
|
+
),
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<div className="chat-shell">
|
|
109
|
+
<ChatTopBar
|
|
110
|
+
activeProject={snapshot.activeProject}
|
|
111
|
+
sessionCount={chat.sessions.length}
|
|
112
|
+
sessionsOpen={sessionsOpen}
|
|
113
|
+
infoOpen={infoOpen}
|
|
114
|
+
onToggleSessions={() => setSessionsOpen((v) => !v)}
|
|
115
|
+
onToggleInfo={() => setInfoOpen((v) => !v)}
|
|
116
|
+
onOpenOverview={() => setActiveTab?.('overview')}
|
|
117
|
+
/>
|
|
118
|
+
<div className="chat-body">
|
|
119
|
+
<aside className={`chat-sessions ${!sessionsOpen ? 'chat-sessions-hidden' : ''}`}>
|
|
120
|
+
<SessionList
|
|
121
|
+
sessions={chat.sessions}
|
|
122
|
+
opencodeSessions={chat.opencodeSessions}
|
|
123
|
+
activeSessionId={chat.sessionId}
|
|
124
|
+
activeProject={snapshot.activeProject}
|
|
125
|
+
onCreateSession={handleCreateSession}
|
|
126
|
+
onSelectSession={chat.loadChat}
|
|
127
|
+
creating={creating}
|
|
128
|
+
/>
|
|
129
|
+
</aside>
|
|
130
|
+
|
|
131
|
+
<main className="chat-main">
|
|
132
|
+
<ChatThread
|
|
133
|
+
messages={chat.messages}
|
|
134
|
+
loading={chat.loading}
|
|
135
|
+
activeProject={snapshot.activeProject}
|
|
136
|
+
sessionId={chat.sessionId}
|
|
137
|
+
pinned={chat.pinned}
|
|
138
|
+
onPickSuggestion={(t) => setText(t)}
|
|
139
|
+
onCopy={(m) => chat.copyMessage(m as Parameters<typeof chat.copyMessage>[0])}
|
|
140
|
+
onDelete={handleDelete}
|
|
141
|
+
onTogglePin={chat.togglePin}
|
|
142
|
+
onRegenerate={chat.onRegenerate}
|
|
143
|
+
/>
|
|
144
|
+
<FloatingComposer
|
|
145
|
+
agent={agent}
|
|
146
|
+
setAgent={setAgent}
|
|
147
|
+
model={model}
|
|
148
|
+
setModel={setModel}
|
|
149
|
+
text={text}
|
|
150
|
+
setText={setText}
|
|
151
|
+
sending={chat.sending}
|
|
152
|
+
onSend={handleSend}
|
|
153
|
+
attachments={attachments}
|
|
154
|
+
setAttachments={setAttachments}
|
|
155
|
+
suggestions={suggestions}
|
|
156
|
+
onPickSuggestion={(cmd) => setText(`${cmd.split(' ')[0]} `)}
|
|
157
|
+
agents={snapshot.agents || []}
|
|
158
|
+
onAttach={onAttach}
|
|
159
|
+
sessionsOpen={sessionsOpen}
|
|
160
|
+
infoOpen={infoOpen}
|
|
161
|
+
/>
|
|
162
|
+
<input ref={fileInputRef} type="file" multiple style={{ display: 'none' }} onChange={onFiles} />
|
|
163
|
+
</main>
|
|
164
|
+
|
|
165
|
+
<aside className={`chat-info ${!infoOpen ? 'chat-info-hidden' : ''}`}>
|
|
166
|
+
<InfoPanel
|
|
167
|
+
sessionId={chat.sessionId}
|
|
168
|
+
messages={chat.messages}
|
|
169
|
+
pinned={chat.pinned}
|
|
170
|
+
agent={agent}
|
|
171
|
+
model={model}
|
|
172
|
+
agents={snapshot.agents || []}
|
|
173
|
+
mcps={snapshot.mcps || []}
|
|
174
|
+
allCommands={allCommands}
|
|
175
|
+
/>
|
|
176
|
+
</aside>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// src/mobile/views/MobileConfig.tsx — config key-value editor with type-aware inputs.
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Sliders, RefreshCw, RotateCcw, Save } from 'lucide-react';
|
|
4
|
+
import { api } from '../../lib/api';
|
|
5
|
+
|
|
6
|
+
type ConfigEntry = {
|
|
7
|
+
key: string;
|
|
8
|
+
value: unknown;
|
|
9
|
+
type: 'boolean' | 'number' | 'string' | 'object' | 'array' | 'unknown';
|
|
10
|
+
defaultValue?: unknown;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type Props = {
|
|
14
|
+
onBack: () => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function MobileConfig({ onBack }: Props) {
|
|
18
|
+
const [entries, setEntries] = useState<ConfigEntry[]>([]);
|
|
19
|
+
const [loading, setLoading] = useState(true);
|
|
20
|
+
const [editing, setEditing] = useState<Record<string, unknown>>({});
|
|
21
|
+
const [saving, setSaving] = useState(false);
|
|
22
|
+
|
|
23
|
+
const load = async () => {
|
|
24
|
+
try {
|
|
25
|
+
const data = await api.get<Record<string, unknown>>('/config');
|
|
26
|
+
const entries: ConfigEntry[] = Object.entries(data).map(([key, value]) => ({
|
|
27
|
+
key,
|
|
28
|
+
value,
|
|
29
|
+
type: detectType(value),
|
|
30
|
+
}));
|
|
31
|
+
setEntries(entries);
|
|
32
|
+
setEditing(Object.fromEntries(Object.entries(data).map(([k, v]) => [k, v])));
|
|
33
|
+
} catch {
|
|
34
|
+
// best-effort
|
|
35
|
+
} finally {
|
|
36
|
+
setLoading(false);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
useEffect(() => { load(); }, []);
|
|
41
|
+
|
|
42
|
+
const detectType = (v: unknown): ConfigEntry['type'] => {
|
|
43
|
+
if (typeof v === 'boolean') return 'boolean';
|
|
44
|
+
if (typeof v === 'number') return 'number';
|
|
45
|
+
if (typeof v === 'string') return 'string';
|
|
46
|
+
if (Array.isArray(v)) return 'array';
|
|
47
|
+
if (v && typeof v === 'object') return 'object';
|
|
48
|
+
return 'unknown';
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const handleChange = (key: string, value: unknown) => {
|
|
52
|
+
setEditing((cur) => ({ ...cur, [key]: value }));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const saveAll = async () => {
|
|
56
|
+
setSaving(true);
|
|
57
|
+
try {
|
|
58
|
+
await api.patch('/config', editing);
|
|
59
|
+
await load();
|
|
60
|
+
} catch {
|
|
61
|
+
// best-effort
|
|
62
|
+
} finally {
|
|
63
|
+
setSaving(false);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const resetRow = (key: string, defaultValue?: unknown) => {
|
|
68
|
+
setEditing((cur) => ({ ...cur, [key]: defaultValue }));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const renderInput = (entry: ConfigEntry) => {
|
|
72
|
+
const value = editing[entry.key];
|
|
73
|
+
switch (entry.type) {
|
|
74
|
+
case 'boolean':
|
|
75
|
+
return (
|
|
76
|
+
<label className="mobile-toggle">
|
|
77
|
+
<input
|
|
78
|
+
type="checkbox"
|
|
79
|
+
checked={Boolean(value)}
|
|
80
|
+
onChange={(e) => handleChange(entry.key, e.target.checked)}
|
|
81
|
+
/>
|
|
82
|
+
<span className="mobile-toggle-slider" />
|
|
83
|
+
</label>
|
|
84
|
+
);
|
|
85
|
+
case 'number':
|
|
86
|
+
return (
|
|
87
|
+
<input
|
|
88
|
+
className="mobile-input mobile-input-sm"
|
|
89
|
+
type="number"
|
|
90
|
+
inputMode="numeric"
|
|
91
|
+
value={String(value ?? '')}
|
|
92
|
+
onChange={(e) => handleChange(entry.key, Number(e.target.value))}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
case 'string':
|
|
96
|
+
return (
|
|
97
|
+
<input
|
|
98
|
+
className="mobile-input mobile-input-sm"
|
|
99
|
+
type="text"
|
|
100
|
+
value={String(value ?? '')}
|
|
101
|
+
onChange={(e) => handleChange(entry.key, e.target.value)}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
case 'object':
|
|
105
|
+
case 'array':
|
|
106
|
+
return (
|
|
107
|
+
<textarea
|
|
108
|
+
className="mobile-input mobile-input-sm"
|
|
109
|
+
rows={2}
|
|
110
|
+
value={JSON.stringify(value ?? null, null, 2)}
|
|
111
|
+
onChange={(e) => {
|
|
112
|
+
try {
|
|
113
|
+
handleChange(entry.key, JSON.parse(e.target.value));
|
|
114
|
+
} catch {
|
|
115
|
+
// invalid JSON
|
|
116
|
+
}
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
default:
|
|
121
|
+
return <span className="mobile-setting-value mono">{String(value ?? 'null')}</span>;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<div className="mobile-view">
|
|
127
|
+
<div className="mobile-tasks-toolbar">
|
|
128
|
+
<span style={{ fontSize: 14, color: 'var(--text-muted)', flex: 1 }}>{entries.length} config entries</span>
|
|
129
|
+
<button type="button" className="mobile-icon-btn" onClick={() => load()} aria-label="Refresh">
|
|
130
|
+
<RefreshCw size={16} />
|
|
131
|
+
</button>
|
|
132
|
+
<button
|
|
133
|
+
type="button"
|
|
134
|
+
className="mobile-btn"
|
|
135
|
+
disabled={saving}
|
|
136
|
+
onClick={() => saveAll()}
|
|
137
|
+
>
|
|
138
|
+
<Save size={14} /> {saving ? 'Saving…' : 'Save all'}
|
|
139
|
+
</button>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
{loading ? (
|
|
143
|
+
<div className="mobile-loading"><p>Loading…</p></div>
|
|
144
|
+
) : entries.length === 0 ? (
|
|
145
|
+
<div className="mobile-empty">
|
|
146
|
+
<Sliders size={40} />
|
|
147
|
+
<p>No config entries.</p>
|
|
148
|
+
</div>
|
|
149
|
+
) : (
|
|
150
|
+
<div className="mobile-config-list">
|
|
151
|
+
{entries.map((entry) => (
|
|
152
|
+
<div key={entry.key} className="mobile-config-row">
|
|
153
|
+
<div className="mobile-config-key">
|
|
154
|
+
<span className="mono">{entry.key}</span>
|
|
155
|
+
<span className="mobile-config-type">{entry.type}</span>
|
|
156
|
+
</div>
|
|
157
|
+
<div className="mobile-config-value">
|
|
158
|
+
{renderInput(entry)}
|
|
159
|
+
</div>
|
|
160
|
+
<button
|
|
161
|
+
type="button"
|
|
162
|
+
className="mobile-icon-btn"
|
|
163
|
+
onClick={() => resetRow(entry.key, entry.defaultValue)}
|
|
164
|
+
aria-label="Reset to default"
|
|
165
|
+
title="Reset"
|
|
166
|
+
>
|
|
167
|
+
<RotateCcw size={14} />
|
|
168
|
+
</button>
|
|
169
|
+
</div>
|
|
170
|
+
))}
|
|
171
|
+
</div>
|
|
172
|
+
)}
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// src/mobile/views/MobileHistory.tsx — session history list.
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { History, RefreshCw } from 'lucide-react';
|
|
4
|
+
import { api } from '../../lib/api';
|
|
5
|
+
import { MobileBottomSheet } from '../components/MobileBottomSheet';
|
|
6
|
+
|
|
7
|
+
type HistoryEntry = {
|
|
8
|
+
id: string;
|
|
9
|
+
ts: string;
|
|
10
|
+
duration?: number;
|
|
11
|
+
agent?: string;
|
|
12
|
+
taskCount?: number;
|
|
13
|
+
summary?: string;
|
|
14
|
+
output?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type HistoryEvent = {
|
|
18
|
+
ts: string;
|
|
19
|
+
kind: string;
|
|
20
|
+
text?: string;
|
|
21
|
+
projectId?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type ProjectHistory = {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
path: string;
|
|
28
|
+
status: string;
|
|
29
|
+
lastAccessed?: string | null;
|
|
30
|
+
tasks: { total: number; done: number; doing: number; blocked: number; queued: number };
|
|
31
|
+
plans: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type HistoryResponse = {
|
|
35
|
+
history?: HistoryEntry[];
|
|
36
|
+
events?: HistoryEvent[];
|
|
37
|
+
projects?: ProjectHistory[];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
type Props = {
|
|
41
|
+
onBack: () => void;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export function MobileHistory({ onBack }: Props) {
|
|
45
|
+
const [entries, setEntries] = useState<HistoryEntry[]>([]);
|
|
46
|
+
const [loading, setLoading] = useState(true);
|
|
47
|
+
const [detail, setDetail] = useState<HistoryEntry | null>(null);
|
|
48
|
+
const [query, setQuery] = useState('');
|
|
49
|
+
|
|
50
|
+
const load = async () => {
|
|
51
|
+
try {
|
|
52
|
+
const data = await api.get<HistoryResponse>('/history');
|
|
53
|
+
if (Array.isArray(data.history)) {
|
|
54
|
+
setEntries(data.history);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (Array.isArray(data.projects)) {
|
|
59
|
+
const latestEventByProject = new Map<string, HistoryEvent>();
|
|
60
|
+
for (const event of data.events || []) {
|
|
61
|
+
const pid = event.projectId;
|
|
62
|
+
if (!pid) continue;
|
|
63
|
+
const current = latestEventByProject.get(pid);
|
|
64
|
+
if (!current || new Date(event.ts).getTime() > new Date(current.ts).getTime()) {
|
|
65
|
+
latestEventByProject.set(pid, event);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
setEntries(
|
|
70
|
+
data.projects.map((project) => {
|
|
71
|
+
const latestEvent = latestEventByProject.get(project.id);
|
|
72
|
+
return {
|
|
73
|
+
id: project.id,
|
|
74
|
+
ts: project.lastAccessed || latestEvent?.ts || new Date(0).toISOString(),
|
|
75
|
+
agent: project.name,
|
|
76
|
+
taskCount: project.tasks.total,
|
|
77
|
+
summary: `${project.path} · ${project.tasks.done}/${project.tasks.total} done · ${project.plans} plan${project.plans === 1 ? '' : 's'}`,
|
|
78
|
+
output: latestEvent ? `${latestEvent.kind}${latestEvent.text ? ` — ${latestEvent.text}` : ''}` : 'No recent events.',
|
|
79
|
+
} satisfies HistoryEntry;
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
setEntries([]);
|
|
86
|
+
} catch {
|
|
87
|
+
// best-effort
|
|
88
|
+
} finally {
|
|
89
|
+
setLoading(false);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
useEffect(() => { load(); }, []);
|
|
94
|
+
|
|
95
|
+
const formatDuration = (ms?: number): string => {
|
|
96
|
+
if (!ms) return '—';
|
|
97
|
+
const s = Math.floor(ms / 1000);
|
|
98
|
+
if (s < 60) return `${s}s`;
|
|
99
|
+
const m = Math.floor(s / 60);
|
|
100
|
+
const r = s % 60;
|
|
101
|
+
return `${m}m ${r}s`;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const formatTime = (ts: string): string => {
|
|
105
|
+
const d = new Date(ts);
|
|
106
|
+
return d.toLocaleString();
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const filtered = query.trim()
|
|
110
|
+
? entries.filter((entry) => {
|
|
111
|
+
const q = query.toLowerCase();
|
|
112
|
+
return (entry.agent || 'session').toLowerCase().includes(q)
|
|
113
|
+
|| (entry.summary || '').toLowerCase().includes(q)
|
|
114
|
+
|| (entry.output || '').toLowerCase().includes(q);
|
|
115
|
+
})
|
|
116
|
+
: entries;
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<div className="mobile-view">
|
|
120
|
+
<div className="mobile-tasks-toolbar">
|
|
121
|
+
<input
|
|
122
|
+
className="mobile-search-input"
|
|
123
|
+
type="text"
|
|
124
|
+
placeholder="Search history…"
|
|
125
|
+
value={query}
|
|
126
|
+
onChange={(e) => setQuery(e.target.value)}
|
|
127
|
+
style={{ flex: 1 }}
|
|
128
|
+
/>
|
|
129
|
+
<button type="button" className="mobile-icon-btn" onClick={() => load()} aria-label="Refresh">
|
|
130
|
+
<RefreshCw size={16} />
|
|
131
|
+
</button>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
{loading ? (
|
|
135
|
+
<div className="mobile-loading"><p>Loading…</p></div>
|
|
136
|
+
) : filtered.length === 0 ? (
|
|
137
|
+
<div className="mobile-empty">
|
|
138
|
+
<History size={40} />
|
|
139
|
+
<p>{entries.length === 0 ? 'No history yet.' : 'No matching sessions.'}</p>
|
|
140
|
+
</div>
|
|
141
|
+
) : (
|
|
142
|
+
<div className="mobile-card-list">
|
|
143
|
+
{filtered.map((e) => (
|
|
144
|
+
<button
|
|
145
|
+
key={e.id}
|
|
146
|
+
type="button"
|
|
147
|
+
className="mobile-list-item mobile-list-item-interactive"
|
|
148
|
+
onClick={() => setDetail(e)}
|
|
149
|
+
>
|
|
150
|
+
<div className="mobile-list-icon"><History size={16} /></div>
|
|
151
|
+
<div className="mobile-list-content">
|
|
152
|
+
<span className="mobile-list-title">{e.agent || 'Session'}</span>
|
|
153
|
+
<span className="mobile-list-meta">
|
|
154
|
+
{formatTime(e.ts)}
|
|
155
|
+
{e.duration ? ` · ${formatDuration(e.duration)}` : ''}
|
|
156
|
+
{e.taskCount ? ` · ${e.taskCount} tasks` : ''}
|
|
157
|
+
</span>
|
|
158
|
+
</div>
|
|
159
|
+
</button>
|
|
160
|
+
))}
|
|
161
|
+
</div>
|
|
162
|
+
)}
|
|
163
|
+
|
|
164
|
+
{/* Detail sheet */}
|
|
165
|
+
{detail && (
|
|
166
|
+
<MobileBottomSheet open={true} onClose={() => setDetail(null)} title="Session Detail">
|
|
167
|
+
<div className="mobile-agent-detail-meta">
|
|
168
|
+
<div className="mobile-task-detail-row"><span>Agent</span><span>{detail.agent || '—'}</span></div>
|
|
169
|
+
<div className="mobile-task-detail-row"><span>Started</span><span>{formatTime(detail.ts)}</span></div>
|
|
170
|
+
<div className="mobile-task-detail-row"><span>Duration</span><span>{formatDuration(detail.duration)}</span></div>
|
|
171
|
+
<div className="mobile-task-detail-row"><span>Tasks</span><span>{detail.taskCount || 0}</span></div>
|
|
172
|
+
</div>
|
|
173
|
+
{detail.summary && (
|
|
174
|
+
<div style={{ marginTop: 12 }}>
|
|
175
|
+
<h4 style={{ fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 }}>Summary</h4>
|
|
176
|
+
<p style={{ fontSize: 13 }}>{detail.summary}</p>
|
|
177
|
+
</div>
|
|
178
|
+
)}
|
|
179
|
+
{detail.output && (
|
|
180
|
+
<div style={{ marginTop: 12 }}>
|
|
181
|
+
<h4 style={{ fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 }}>Output</h4>
|
|
182
|
+
<pre className="mono" style={{ fontSize: 11, whiteSpace: 'pre-wrap', wordBreak: 'break-all', background: 'var(--bg-elev-2)', padding: 8, borderRadius: 6 }}>
|
|
183
|
+
{detail.output.slice(0, 1000)}{detail.output.length > 1000 ? '…' : ''}
|
|
184
|
+
</pre>
|
|
185
|
+
</div>
|
|
186
|
+
)}
|
|
187
|
+
</MobileBottomSheet>
|
|
188
|
+
)}
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// src/mobile/views/MobileMods.tsx — mods list with detail sheet.
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Sliders, RefreshCw, Power } from 'lucide-react';
|
|
4
|
+
import { api } from '../../lib/api';
|
|
5
|
+
import type { Mod, Snapshot } from '../../lib/types';
|
|
6
|
+
import { MobileBottomSheet } from '../components/MobileBottomSheet';
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
snapshot: Snapshot;
|
|
10
|
+
onBack: () => void;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function MobileMods({ snapshot, onBack }: Props) {
|
|
14
|
+
const [mods, setMods] = useState<Mod[]>(snapshot.mods || []);
|
|
15
|
+
const [loading, setLoading] = useState(!snapshot.mods);
|
|
16
|
+
const [filter, setFilter] = useState('');
|
|
17
|
+
const [statusFilter, setStatusFilter] = useState<'all' | 'enabled' | 'disabled'>('all');
|
|
18
|
+
const [detailMod, setDetailMod] = useState<Mod | null>(null);
|
|
19
|
+
|
|
20
|
+
const reload = async () => {
|
|
21
|
+
try {
|
|
22
|
+
const data = await api.get<{ mods: Mod[] }>('/mods');
|
|
23
|
+
setMods(data.mods || []);
|
|
24
|
+
} catch {
|
|
25
|
+
// best-effort
|
|
26
|
+
} finally {
|
|
27
|
+
setLoading(false);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (snapshot.mods) {
|
|
33
|
+
setMods(snapshot.mods);
|
|
34
|
+
setLoading(false);
|
|
35
|
+
} else {
|
|
36
|
+
reload();
|
|
37
|
+
}
|
|
38
|
+
}, [snapshot.mods]);
|
|
39
|
+
|
|
40
|
+
const toggleMod = async (id: string, enabled: boolean) => {
|
|
41
|
+
try {
|
|
42
|
+
await api.patch(`/mods/${encodeURIComponent(id)}`, { enabled });
|
|
43
|
+
setMods((cur) => cur.map((m) => (m.id === id ? { ...m, enabled } : m)));
|
|
44
|
+
if (detailMod?.id === id) setDetailMod((m) => m ? { ...m, enabled } : m);
|
|
45
|
+
} catch {
|
|
46
|
+
// best-effort
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const filtered = mods.filter((m) => {
|
|
51
|
+
if (statusFilter === 'enabled' && !m.enabled) return false;
|
|
52
|
+
if (statusFilter === 'disabled' && m.enabled) return false;
|
|
53
|
+
if (filter) {
|
|
54
|
+
const q = filter.toLowerCase();
|
|
55
|
+
return m.name.toLowerCase().includes(q) || m.description.toLowerCase().includes(q);
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className="mobile-view">
|
|
62
|
+
<div className="mobile-tasks-toolbar">
|
|
63
|
+
<input
|
|
64
|
+
className="mobile-search-input"
|
|
65
|
+
type="text"
|
|
66
|
+
placeholder="Search mods…"
|
|
67
|
+
value={filter}
|
|
68
|
+
onChange={(e) => setFilter(e.target.value)}
|
|
69
|
+
style={{ flex: 1 }}
|
|
70
|
+
/>
|
|
71
|
+
<button type="button" className="mobile-icon-btn" onClick={() => reload()} aria-label="Refresh">
|
|
72
|
+
<RefreshCw size={16} />
|
|
73
|
+
</button>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div className="mobile-search-scopes">
|
|
77
|
+
{(['all', 'enabled', 'disabled'] as const).map((s) => (
|
|
78
|
+
<button key={s} type="button" className={`mobile-scope-chip ${statusFilter === s ? 'active' : ''}`}
|
|
79
|
+
onClick={() => setStatusFilter(s)}>
|
|
80
|
+
{s.charAt(0).toUpperCase() + s.slice(1)}
|
|
81
|
+
</button>
|
|
82
|
+
))}
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
{loading ? (
|
|
86
|
+
<div className="mobile-loading"><p>Loading…</p></div>
|
|
87
|
+
) : filtered.length === 0 ? (
|
|
88
|
+
<div className="mobile-empty">
|
|
89
|
+
<Sliders size={40} />
|
|
90
|
+
<p>No mods found.</p>
|
|
91
|
+
</div>
|
|
92
|
+
) : (
|
|
93
|
+
<div className="mobile-card-list">
|
|
94
|
+
{filtered.map((m) => (
|
|
95
|
+
<button
|
|
96
|
+
key={m.id}
|
|
97
|
+
type="button"
|
|
98
|
+
className="mobile-list-item mobile-list-item-interactive"
|
|
99
|
+
onClick={() => setDetailMod(m)}
|
|
100
|
+
>
|
|
101
|
+
<div className="mobile-list-icon"><Sliders size={16} /></div>
|
|
102
|
+
<div className="mobile-list-content">
|
|
103
|
+
<span className="mobile-list-title">{m.name}</span>
|
|
104
|
+
<span className="mobile-list-meta">v{m.version} · {m.author}</span>
|
|
105
|
+
</div>
|
|
106
|
+
<span className={`mobile-list-badge ${m.enabled ? 'badge-on' : 'badge-off'}`}>
|
|
107
|
+
{m.enabled ? 'on' : 'off'}
|
|
108
|
+
</span>
|
|
109
|
+
</button>
|
|
110
|
+
))}
|
|
111
|
+
</div>
|
|
112
|
+
)}
|
|
113
|
+
|
|
114
|
+
{detailMod && (
|
|
115
|
+
<MobileBottomSheet
|
|
116
|
+
open={true}
|
|
117
|
+
onClose={() => setDetailMod(null)}
|
|
118
|
+
title={detailMod.name}
|
|
119
|
+
actions={
|
|
120
|
+
<div className="mobile-task-detail-actions">
|
|
121
|
+
<button
|
|
122
|
+
type="button"
|
|
123
|
+
className="mobile-btn"
|
|
124
|
+
style={{ flex: 1 }}
|
|
125
|
+
onClick={() => { if (detailMod) toggleMod(detailMod.id, !detailMod.enabled); }}
|
|
126
|
+
>
|
|
127
|
+
<Power size={14} /> {detailMod.enabled ? 'Disable' : 'Enable'}
|
|
128
|
+
</button>
|
|
129
|
+
</div>
|
|
130
|
+
}
|
|
131
|
+
>
|
|
132
|
+
<div className="mobile-agent-detail">
|
|
133
|
+
<p className="mobile-agent-detail-desc">{detailMod.description || 'No description.'}</p>
|
|
134
|
+
<div className="mobile-agent-detail-meta">
|
|
135
|
+
<div className="mobile-task-detail-row"><span>Version</span><span className="mono">{detailMod.version}</span></div>
|
|
136
|
+
<div className="mobile-task-detail-row"><span>Author</span><span>{detailMod.author}</span></div>
|
|
137
|
+
<div className="mobile-task-detail-row"><span>Bizar</span><span className="mono">{detailMod.bizar}</span></div>
|
|
138
|
+
<div className="mobile-task-detail-row"><span>Type</span><span>{detailMod.type}</span></div>
|
|
139
|
+
<div className="mobile-task-detail-row"><span>Permissions</span><span>{detailMod.permissions.length}</span></div>
|
|
140
|
+
{detailMod.installedAt && (
|
|
141
|
+
<div className="mobile-task-detail-row"><span>Installed</span><span>{new Date(detailMod.installedAt).toLocaleDateString()}</span></div>
|
|
142
|
+
)}
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</MobileBottomSheet>
|
|
146
|
+
)}
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
}
|