@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,701 @@
|
|
|
1
|
+
// src/views/Agents.tsx — v3.1.0 agents with tags, categories, real-time status.
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Bot,
|
|
5
|
+
Plus,
|
|
6
|
+
RefreshCw,
|
|
7
|
+
Pencil,
|
|
8
|
+
Trash2,
|
|
9
|
+
Play,
|
|
10
|
+
Save,
|
|
11
|
+
X,
|
|
12
|
+
RotateCw,
|
|
13
|
+
Activity,
|
|
14
|
+
Tag as TagIcon,
|
|
15
|
+
Folder,
|
|
16
|
+
CheckCircle2,
|
|
17
|
+
Clock,
|
|
18
|
+
AlertTriangle,
|
|
19
|
+
Circle,
|
|
20
|
+
ChevronDown,
|
|
21
|
+
ChevronRight,
|
|
22
|
+
} from 'lucide-react';
|
|
23
|
+
import { Button } from '../components/Button';
|
|
24
|
+
import { Card, CardTitle } from '../components/Card';
|
|
25
|
+
import { EmptyState } from '../components/EmptyState';
|
|
26
|
+
import { Spinner } from '../components/Spinner';
|
|
27
|
+
import { StatusBadge } from '../components/StatusBadge';
|
|
28
|
+
import { useModal } from '../components/Modal';
|
|
29
|
+
import { useToast } from '../components/Toast';
|
|
30
|
+
import { api } from '../lib/api';
|
|
31
|
+
import { cn, formatRelative, truncate } from '../lib/utils';
|
|
32
|
+
import type { Agent, Settings, Snapshot } from '../lib/types';
|
|
33
|
+
|
|
34
|
+
type Props = {
|
|
35
|
+
snapshot: Snapshot;
|
|
36
|
+
settings: Settings;
|
|
37
|
+
activeTab: string;
|
|
38
|
+
setActiveTab: (id: string) => void;
|
|
39
|
+
refreshSnapshot: () => Promise<void>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const TOOL_OPTIONS = ['bash', 'read', 'edit', 'write', 'webfetch', 'websearch', 'task', 'glob', 'grep'];
|
|
43
|
+
const MODELS = [
|
|
44
|
+
'anthropic/claude-3-5-sonnet',
|
|
45
|
+
'anthropic/claude-3-5-haiku',
|
|
46
|
+
'openai/gpt-4o',
|
|
47
|
+
'openai/gpt-4o-mini',
|
|
48
|
+
'openrouter/minimax/minimax-m3',
|
|
49
|
+
'openrouter/minimax/minimax-m2.7',
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const CATEGORIES = [
|
|
53
|
+
{ id: 'reasoning', label: 'Reasoning', color: 'var(--accent)' },
|
|
54
|
+
{ id: 'code', label: 'Code', color: 'var(--info)' },
|
|
55
|
+
{ id: 'design', label: 'Design', color: 'var(--success)' },
|
|
56
|
+
{ id: 'planning', label: 'Planning', color: 'var(--warning)' },
|
|
57
|
+
{ id: 'gitops', label: 'GitOps', color: 'var(--error)' },
|
|
58
|
+
{ id: 'analysis', label: 'Analysis', color: 'var(--text-dim)' },
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
function categoryColor(cat: string | undefined): string {
|
|
62
|
+
return CATEGORIES.find((c) => c.id === cat)?.color || 'var(--text-dim)';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function StatusDot({ status, isStuck }: { status?: string; isStuck?: boolean }) {
|
|
66
|
+
const color =
|
|
67
|
+
isStuck ? 'var(--error)'
|
|
68
|
+
: status === 'working' ? 'var(--info)'
|
|
69
|
+
: status === 'error' ? 'var(--error)'
|
|
70
|
+
: 'var(--text-dim)';
|
|
71
|
+
return <span className="agent-status-dot" style={{ background: color }} />;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function StatusPill({ agent }: { agent: Agent }) {
|
|
75
|
+
if (agent.isStuck) {
|
|
76
|
+
return <StatusBadge kind="error" dot>stuck</StatusBadge>;
|
|
77
|
+
}
|
|
78
|
+
const status = agent.status || 'idle';
|
|
79
|
+
if (status === 'working') return <StatusBadge kind="info" dot>working</StatusBadge>;
|
|
80
|
+
if (status === 'error') return <StatusBadge kind="error" dot>error</StatusBadge>;
|
|
81
|
+
return <StatusBadge kind="neutral" dot>idle</StatusBadge>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function Agents({ snapshot, refreshSnapshot }: Props) {
|
|
85
|
+
const toast = useToast();
|
|
86
|
+
const modal = useModal();
|
|
87
|
+
const [agents, setAgents] = useState<Agent[]>(snapshot.agents || []);
|
|
88
|
+
const [loading, setLoading] = useState(!snapshot.agents);
|
|
89
|
+
const [categoryFilter, setCategoryFilter] = useState<string>('');
|
|
90
|
+
const [search, setSearch] = useState('');
|
|
91
|
+
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
setAgents(snapshot.agents || []);
|
|
94
|
+
setLoading(!snapshot.agents);
|
|
95
|
+
}, [snapshot.agents]);
|
|
96
|
+
|
|
97
|
+
const reload = async () => {
|
|
98
|
+
try {
|
|
99
|
+
const d = await api.get<{ agents: Agent[] }>('/agents');
|
|
100
|
+
setAgents(d.agents || []);
|
|
101
|
+
} catch (err) {
|
|
102
|
+
toast.error(`Agents load failed: ${(err as Error).message}`);
|
|
103
|
+
} finally {
|
|
104
|
+
setLoading(false);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const sorted = useMemo(() => {
|
|
109
|
+
let out = [...agents];
|
|
110
|
+
if (categoryFilter) {
|
|
111
|
+
out = out.filter((a) => categoryFilter === '__none__' ? !(a.category || '') : (a.category || '') === categoryFilter);
|
|
112
|
+
}
|
|
113
|
+
if (search) {
|
|
114
|
+
const q = search.toLowerCase();
|
|
115
|
+
out = out.filter(
|
|
116
|
+
(a) =>
|
|
117
|
+
a.name.toLowerCase().includes(q) ||
|
|
118
|
+
(a.description || '').toLowerCase().includes(q) ||
|
|
119
|
+
(a.tags || []).some((t) => t.toLowerCase().includes(q)),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
return out.sort((a, b) => a.name.localeCompare(b.name));
|
|
123
|
+
}, [agents, categoryFilter, search]);
|
|
124
|
+
|
|
125
|
+
const allTags = useMemo(() => {
|
|
126
|
+
const set = new Set<string>();
|
|
127
|
+
for (const a of agents) for (const t of a.tags || []) set.add(t);
|
|
128
|
+
return Array.from(set).sort();
|
|
129
|
+
}, [agents]);
|
|
130
|
+
|
|
131
|
+
const onCreate = () => {
|
|
132
|
+
let nameEl: HTMLInputElement | null = null;
|
|
133
|
+
let descEl: HTMLInputElement | null = null;
|
|
134
|
+
let modelEl: HTMLSelectElement | null = null;
|
|
135
|
+
let modeEl: HTMLSelectElement | null = null;
|
|
136
|
+
let colorEl: HTMLInputElement | null = null;
|
|
137
|
+
let promptEl: HTMLTextAreaElement | null = null;
|
|
138
|
+
let toolsContainer: HTMLDivElement | null = null;
|
|
139
|
+
let tagsEl: HTMLInputElement | null = null;
|
|
140
|
+
let categoryEl: HTMLSelectElement | null = null;
|
|
141
|
+
|
|
142
|
+
modal.open({
|
|
143
|
+
title: 'New agent',
|
|
144
|
+
width: 640,
|
|
145
|
+
children: (
|
|
146
|
+
<div className="agent-form">
|
|
147
|
+
<label className="field-label">Name (a-z, 0-9, dashes)</label>
|
|
148
|
+
<input
|
|
149
|
+
ref={(el) => (nameEl = el)}
|
|
150
|
+
className="input"
|
|
151
|
+
type="text"
|
|
152
|
+
placeholder="my-agent"
|
|
153
|
+
autoFocus
|
|
154
|
+
/>
|
|
155
|
+
<label className="field-label">Description</label>
|
|
156
|
+
<input
|
|
157
|
+
ref={(el) => { descEl = el; }}
|
|
158
|
+
className="input"
|
|
159
|
+
type="text"
|
|
160
|
+
placeholder="What does this agent do?"
|
|
161
|
+
/>
|
|
162
|
+
<div className="task-form-row">
|
|
163
|
+
<div className="task-form-field">
|
|
164
|
+
<label className="field-label">Model</label>
|
|
165
|
+
<select ref={(el) => (modelEl = el)} className="select" defaultValue="">
|
|
166
|
+
<option value="">(provider default)</option>
|
|
167
|
+
{MODELS.map((m) => (
|
|
168
|
+
<option key={m} value={m}>{m}</option>
|
|
169
|
+
))}
|
|
170
|
+
</select>
|
|
171
|
+
</div>
|
|
172
|
+
<div className="task-form-field">
|
|
173
|
+
<label className="field-label">Mode</label>
|
|
174
|
+
<select ref={(el) => (modeEl = el)} className="select" defaultValue="subagent">
|
|
175
|
+
<option value="primary">primary</option>
|
|
176
|
+
<option value="subagent">subagent</option>
|
|
177
|
+
<option value="all">all</option>
|
|
178
|
+
</select>
|
|
179
|
+
</div>
|
|
180
|
+
<div className="task-form-field" style={{ flex: '0 0 80px' }}>
|
|
181
|
+
<label className="field-label">Color</label>
|
|
182
|
+
<input ref={(el) => (colorEl = el)} className="input" type="color" defaultValue="#8b5cf6" />
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
<div className="task-form-row">
|
|
186
|
+
<div className="task-form-field" style={{ flex: 1 }}>
|
|
187
|
+
<label className="field-label">Category</label>
|
|
188
|
+
<select ref={(el) => (categoryEl = el)} className="select" defaultValue="">
|
|
189
|
+
<option value="">(none)</option>
|
|
190
|
+
{CATEGORIES.map((c) => (
|
|
191
|
+
<option key={c.id} value={c.id}>{c.label}</option>
|
|
192
|
+
))}
|
|
193
|
+
</select>
|
|
194
|
+
</div>
|
|
195
|
+
<div className="task-form-field" style={{ flex: 2 }}>
|
|
196
|
+
<label className="field-label">Tags (comma-separated)</label>
|
|
197
|
+
<input ref={(el) => (tagsEl = el)} className="input" type="text" placeholder="reasoning, code, planning" />
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
<label className="field-label">Tools</label>
|
|
201
|
+
<div ref={(el) => (toolsContainer = el)} className="agent-tools">
|
|
202
|
+
{TOOL_OPTIONS.map((t) => (
|
|
203
|
+
<label key={t} className="checkbox-row">
|
|
204
|
+
<input type="checkbox" value={t} />
|
|
205
|
+
<span>{t}</span>
|
|
206
|
+
</label>
|
|
207
|
+
))}
|
|
208
|
+
</div>
|
|
209
|
+
<label className="field-label">System prompt</label>
|
|
210
|
+
<textarea
|
|
211
|
+
ref={(el) => (promptEl = el)}
|
|
212
|
+
className="textarea"
|
|
213
|
+
rows={6}
|
|
214
|
+
placeholder="You are a..."
|
|
215
|
+
/>
|
|
216
|
+
</div>
|
|
217
|
+
),
|
|
218
|
+
footer: (
|
|
219
|
+
<div className="modal-footer-actions">
|
|
220
|
+
<Button variant="ghost" onClick={() => modal.close()}>Cancel</Button>
|
|
221
|
+
<Button
|
|
222
|
+
variant="primary"
|
|
223
|
+
onClick={async () => {
|
|
224
|
+
const name = (nameEl?.value || '').trim();
|
|
225
|
+
if (!/^[a-z0-9][a-z0-9-]{0,63}$/i.test(name)) {
|
|
226
|
+
toast.warning('Invalid name (a-z, 0-9, dashes).');
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const tools: string[] = [];
|
|
230
|
+
if (toolsContainer) {
|
|
231
|
+
toolsContainer.querySelectorAll<HTMLInputElement>('input[type="checkbox"]:checked').forEach((cb) => {
|
|
232
|
+
tools.push(cb.value);
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
const tags = (tagsEl?.value || '').split(',').map((t) => t.trim()).filter(Boolean);
|
|
236
|
+
try {
|
|
237
|
+
const created = await api.post<Agent>('/agents', {
|
|
238
|
+
name,
|
|
239
|
+
description: (descEl?.value || '').trim(),
|
|
240
|
+
model: modelEl?.value || '',
|
|
241
|
+
mode: modeEl?.value || 'subagent',
|
|
242
|
+
color: colorEl?.value || '',
|
|
243
|
+
tools,
|
|
244
|
+
tags,
|
|
245
|
+
category: categoryEl?.value || '',
|
|
246
|
+
prompt: promptEl?.value || '',
|
|
247
|
+
});
|
|
248
|
+
setAgents((cur) => [...cur, created]);
|
|
249
|
+
toast.success('Agent created.');
|
|
250
|
+
modal.close();
|
|
251
|
+
await refreshSnapshot();
|
|
252
|
+
} catch (err) {
|
|
253
|
+
toast.error(`Create failed: ${(err as Error).message}`);
|
|
254
|
+
}
|
|
255
|
+
}}
|
|
256
|
+
>
|
|
257
|
+
<Save size={12} /> Create
|
|
258
|
+
</Button>
|
|
259
|
+
</div>
|
|
260
|
+
),
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
const onEdit = async (a: Agent) => {
|
|
265
|
+
let descEl: HTMLInputElement | null = null;
|
|
266
|
+
let modelEl: HTMLSelectElement | null = null;
|
|
267
|
+
let modeEl: HTMLSelectElement | null = null;
|
|
268
|
+
let colorEl: HTMLInputElement | null = null;
|
|
269
|
+
let promptEl: HTMLTextAreaElement | null = null;
|
|
270
|
+
let toolsContainer: HTMLDivElement | null = null;
|
|
271
|
+
let tagsEl: HTMLInputElement | null = null;
|
|
272
|
+
let categoryEl: HTMLSelectElement | null = null;
|
|
273
|
+
try {
|
|
274
|
+
const full = await api.get<Agent>(`/agents/${encodeURIComponent(a.name)}`);
|
|
275
|
+
modal.open({
|
|
276
|
+
title: `Edit ${a.name}`,
|
|
277
|
+
width: 640,
|
|
278
|
+
children: (
|
|
279
|
+
<div className="agent-form">
|
|
280
|
+
<div className="muted">
|
|
281
|
+
File: <code>{full.path}</code>
|
|
282
|
+
</div>
|
|
283
|
+
<label className="field-label">Description</label>
|
|
284
|
+
<input
|
|
285
|
+
ref={(el) => { descEl = el; }}
|
|
286
|
+
className="input"
|
|
287
|
+
type="text"
|
|
288
|
+
defaultValue={full.description}
|
|
289
|
+
/>
|
|
290
|
+
<div className="task-form-row">
|
|
291
|
+
<div className="task-form-field">
|
|
292
|
+
<label className="field-label">Model</label>
|
|
293
|
+
<select ref={(el) => (modelEl = el)} className="select" defaultValue={full.model}>
|
|
294
|
+
<option value="">(provider default)</option>
|
|
295
|
+
{MODELS.map((m) => (
|
|
296
|
+
<option key={m} value={m}>{m}</option>
|
|
297
|
+
))}
|
|
298
|
+
</select>
|
|
299
|
+
</div>
|
|
300
|
+
<div className="task-form-field">
|
|
301
|
+
<label className="field-label">Mode</label>
|
|
302
|
+
<select ref={(el) => (modeEl = el)} className="select" defaultValue={full.mode || 'subagent'}>
|
|
303
|
+
<option value="primary">primary</option>
|
|
304
|
+
<option value="subagent">subagent</option>
|
|
305
|
+
<option value="all">all</option>
|
|
306
|
+
</select>
|
|
307
|
+
</div>
|
|
308
|
+
<div className="task-form-field" style={{ flex: '0 0 80px' }}>
|
|
309
|
+
<label className="field-label">Color</label>
|
|
310
|
+
<input ref={(el) => (colorEl = el)} className="input" type="color" defaultValue={full.color || '#8b5cf6'} />
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
<div className="task-form-row">
|
|
314
|
+
<div className="task-form-field" style={{ flex: 1 }}>
|
|
315
|
+
<label className="field-label">Category</label>
|
|
316
|
+
<select ref={(el) => (categoryEl = el)} className="select" defaultValue={full.category || ''}>
|
|
317
|
+
<option value="">(none)</option>
|
|
318
|
+
{CATEGORIES.map((c) => (
|
|
319
|
+
<option key={c.id} value={c.id}>{c.label}</option>
|
|
320
|
+
))}
|
|
321
|
+
</select>
|
|
322
|
+
</div>
|
|
323
|
+
<div className="task-form-field" style={{ flex: 2 }}>
|
|
324
|
+
<label className="field-label">Tags (comma-separated)</label>
|
|
325
|
+
<input
|
|
326
|
+
ref={(el) => (tagsEl = el)}
|
|
327
|
+
className="input"
|
|
328
|
+
type="text"
|
|
329
|
+
defaultValue={(full.tags || []).join(', ')}
|
|
330
|
+
/>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
<label className="field-label">Tools</label>
|
|
334
|
+
<div ref={(el) => (toolsContainer = el)} className="agent-tools">
|
|
335
|
+
{TOOL_OPTIONS.map((t) => (
|
|
336
|
+
<label key={t} className="checkbox-row">
|
|
337
|
+
<input type="checkbox" value={t} defaultChecked={full.tools?.includes(t)} />
|
|
338
|
+
<span>{t}</span>
|
|
339
|
+
</label>
|
|
340
|
+
))}
|
|
341
|
+
</div>
|
|
342
|
+
<label className="field-label">System prompt</label>
|
|
343
|
+
<textarea
|
|
344
|
+
ref={(el) => (promptEl = el)}
|
|
345
|
+
className="textarea"
|
|
346
|
+
rows={8}
|
|
347
|
+
defaultValue={full.prompt || ''}
|
|
348
|
+
/>
|
|
349
|
+
</div>
|
|
350
|
+
),
|
|
351
|
+
footer: (
|
|
352
|
+
<div className="modal-footer-actions">
|
|
353
|
+
<Button variant="ghost" onClick={() => modal.close()}>Cancel</Button>
|
|
354
|
+
<Button
|
|
355
|
+
variant="primary"
|
|
356
|
+
onClick={async () => {
|
|
357
|
+
const tools: string[] = [];
|
|
358
|
+
if (toolsContainer) {
|
|
359
|
+
toolsContainer.querySelectorAll<HTMLInputElement>('input[type="checkbox"]:checked').forEach((cb) => {
|
|
360
|
+
tools.push(cb.value);
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
const tags = (tagsEl?.value || '').split(',').map((t) => t.trim()).filter(Boolean);
|
|
364
|
+
try {
|
|
365
|
+
const updated = await api.put<Agent>(
|
|
366
|
+
`/agents/${encodeURIComponent(a.name)}`,
|
|
367
|
+
{
|
|
368
|
+
description: (descEl?.value || '').trim(),
|
|
369
|
+
model: modelEl?.value || '',
|
|
370
|
+
mode: modeEl?.value || 'subagent',
|
|
371
|
+
color: colorEl?.value || '',
|
|
372
|
+
tools,
|
|
373
|
+
tags,
|
|
374
|
+
category: categoryEl?.value || '',
|
|
375
|
+
prompt: promptEl?.value || '',
|
|
376
|
+
},
|
|
377
|
+
);
|
|
378
|
+
setAgents((cur) => cur.map((x) => (x.name === a.name ? updated : x)));
|
|
379
|
+
toast.success('Agent saved.');
|
|
380
|
+
modal.close();
|
|
381
|
+
await refreshSnapshot();
|
|
382
|
+
} catch (err) {
|
|
383
|
+
toast.error(`Save failed: ${(err as Error).message}`);
|
|
384
|
+
}
|
|
385
|
+
}}
|
|
386
|
+
>
|
|
387
|
+
<Save size={12} /> Save
|
|
388
|
+
</Button>
|
|
389
|
+
</div>
|
|
390
|
+
),
|
|
391
|
+
});
|
|
392
|
+
} catch (err) {
|
|
393
|
+
toast.error(`Load failed: ${(err as Error).message}`);
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
const onDelete = async (a: Agent) => {
|
|
398
|
+
if (!confirm(`Delete agent "${a.name}"? This removes ${a.path}.`)) return;
|
|
399
|
+
try {
|
|
400
|
+
await api.del(`/agents/${encodeURIComponent(a.name)}`);
|
|
401
|
+
setAgents((cur) => cur.filter((x) => x.name !== a.name));
|
|
402
|
+
toast.success('Agent deleted.');
|
|
403
|
+
} catch (err) {
|
|
404
|
+
toast.error(`Delete failed: ${(err as Error).message}`);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
const onInvoke = async (a: Agent) => {
|
|
409
|
+
let promptEl: HTMLTextAreaElement | null = null;
|
|
410
|
+
modal.open({
|
|
411
|
+
title: `Invoke ${a.name}`,
|
|
412
|
+
children: (
|
|
413
|
+
<div className="invoke-form">
|
|
414
|
+
<p className="muted invoke-form-meta mono">{a.model || '—'} · {a.path}</p>
|
|
415
|
+
<p className="invoke-form-desc">{a.description}</p>
|
|
416
|
+
<label className="field-label" htmlFor="invoke-prompt">Prompt</label>
|
|
417
|
+
<textarea
|
|
418
|
+
ref={(el) => (promptEl = el)}
|
|
419
|
+
id="invoke-prompt"
|
|
420
|
+
className="textarea"
|
|
421
|
+
rows={5}
|
|
422
|
+
placeholder="What should this agent do?"
|
|
423
|
+
autoFocus
|
|
424
|
+
/>
|
|
425
|
+
</div>
|
|
426
|
+
),
|
|
427
|
+
footer: (
|
|
428
|
+
<div className="modal-footer-actions">
|
|
429
|
+
<Button variant="ghost" onClick={() => modal.close()}>Cancel</Button>
|
|
430
|
+
<Button
|
|
431
|
+
variant="primary"
|
|
432
|
+
onClick={async () => {
|
|
433
|
+
const prompt = (promptEl?.value || '').trim();
|
|
434
|
+
if (!prompt) {
|
|
435
|
+
toast.warning('Prompt is required.');
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
try {
|
|
439
|
+
await api.post(`/agents/${encodeURIComponent(a.name)}/invoke`, { prompt });
|
|
440
|
+
toast.success(`Invoked ${a.name}.`);
|
|
441
|
+
modal.close();
|
|
442
|
+
} catch (err) {
|
|
443
|
+
toast.error(`Invoke failed: ${(err as Error).message}`);
|
|
444
|
+
}
|
|
445
|
+
}}
|
|
446
|
+
>
|
|
447
|
+
<Play size={14} /> Invoke
|
|
448
|
+
</Button>
|
|
449
|
+
</div>
|
|
450
|
+
),
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
const onRestart = async (a: Agent) => {
|
|
455
|
+
try {
|
|
456
|
+
const updated = await api.post<Agent>(`/agents/${encodeURIComponent(a.name)}/restart`);
|
|
457
|
+
setAgents((cur) => cur.map((x) => (x.name === a.name ? updated : x)));
|
|
458
|
+
toast.success(`${a.name} restarted.`);
|
|
459
|
+
} catch (err) {
|
|
460
|
+
toast.error(`Restart failed: ${(err as Error).message}`);
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
const onSetStatus = async (a: Agent, status: 'idle' | 'working' | 'error') => {
|
|
465
|
+
try {
|
|
466
|
+
const updated = await api.post<Agent>(`/agents/${encodeURIComponent(a.name)}/status`, { status });
|
|
467
|
+
setAgents((cur) => cur.map((x) => (x.name === a.name ? updated : x)));
|
|
468
|
+
} catch (err) {
|
|
469
|
+
toast.error(`Status update failed: ${(err as Error).message}`);
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
return (
|
|
474
|
+
<div className="view view-agents">
|
|
475
|
+
<header className="view-header">
|
|
476
|
+
<div className="view-header-text">
|
|
477
|
+
<h2 className="view-title">
|
|
478
|
+
<Bot size={18} /> Agents ({sorted.length})
|
|
479
|
+
</h2>
|
|
480
|
+
<p className="view-subtitle">
|
|
481
|
+
The Norse pantheon — click <kbd>Edit</kbd> to modify or <kbd>Invoke</kbd> to dispatch.
|
|
482
|
+
</p>
|
|
483
|
+
</div>
|
|
484
|
+
<div className="view-actions">
|
|
485
|
+
<div className="search-input">
|
|
486
|
+
<input
|
|
487
|
+
className="input"
|
|
488
|
+
type="text"
|
|
489
|
+
placeholder="Search…"
|
|
490
|
+
value={search}
|
|
491
|
+
onChange={(e) => setSearch(e.target.value)}
|
|
492
|
+
/>
|
|
493
|
+
</div>
|
|
494
|
+
<select
|
|
495
|
+
className="select select-sm"
|
|
496
|
+
value={categoryFilter}
|
|
497
|
+
onChange={(e) => setCategoryFilter(e.target.value)}
|
|
498
|
+
>
|
|
499
|
+
<option value="">All categories</option>
|
|
500
|
+
{CATEGORIES.map((c) => (
|
|
501
|
+
<option key={c.id} value={c.id}>{c.label}</option>
|
|
502
|
+
))}
|
|
503
|
+
<option value="__none__">(no category)</option>
|
|
504
|
+
</select>
|
|
505
|
+
<Button variant="secondary" size="sm" onClick={reload}>
|
|
506
|
+
<RefreshCw size={14} /> Refresh
|
|
507
|
+
</Button>
|
|
508
|
+
<Button variant="primary" size="sm" onClick={onCreate}>
|
|
509
|
+
<Plus size={14} /> New agent
|
|
510
|
+
</Button>
|
|
511
|
+
</div>
|
|
512
|
+
</header>
|
|
513
|
+
|
|
514
|
+
{allTags.length > 0 && (
|
|
515
|
+
<div className="agent-tags-row">
|
|
516
|
+
<TagIcon size={12} />
|
|
517
|
+
{allTags.map((t) => (
|
|
518
|
+
<span key={t} className="tag">{t}</span>
|
|
519
|
+
))}
|
|
520
|
+
</div>
|
|
521
|
+
)}
|
|
522
|
+
|
|
523
|
+
{loading ? (
|
|
524
|
+
<div className="view-loading"><Spinner size="lg" /></div>
|
|
525
|
+
) : sorted.length === 0 ? (
|
|
526
|
+
<EmptyState
|
|
527
|
+
icon={<Bot size={32} />}
|
|
528
|
+
title="No agents found"
|
|
529
|
+
message="Run bizar in the terminal to install Bizar."
|
|
530
|
+
/>
|
|
531
|
+
) : (
|
|
532
|
+
<div className="agent-grid">
|
|
533
|
+
{sorted.map((a) => (
|
|
534
|
+
<AgentCard
|
|
535
|
+
key={a.name}
|
|
536
|
+
agent={a}
|
|
537
|
+
onInvoke={() => onInvoke(a)}
|
|
538
|
+
onEdit={() => onEdit(a)}
|
|
539
|
+
onDelete={() => onDelete(a)}
|
|
540
|
+
onRestart={() => onRestart(a)}
|
|
541
|
+
onSetStatus={(s) => onSetStatus(a, s)}
|
|
542
|
+
/>
|
|
543
|
+
))}
|
|
544
|
+
</div>
|
|
545
|
+
)}
|
|
546
|
+
</div>
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function AgentCard({
|
|
551
|
+
agent,
|
|
552
|
+
onInvoke,
|
|
553
|
+
onEdit,
|
|
554
|
+
onDelete,
|
|
555
|
+
onRestart,
|
|
556
|
+
onSetStatus,
|
|
557
|
+
}: {
|
|
558
|
+
agent: Agent;
|
|
559
|
+
onInvoke: () => void;
|
|
560
|
+
onEdit: () => void;
|
|
561
|
+
onDelete: () => void;
|
|
562
|
+
onRestart: () => void;
|
|
563
|
+
onSetStatus: (s: 'idle' | 'working' | 'error') => void;
|
|
564
|
+
}) {
|
|
565
|
+
const [expanded, setExpanded] = useState(false);
|
|
566
|
+
const catColor = categoryColor(agent.category);
|
|
567
|
+
const isWorking = (agent.status === 'working' || !!agent.currentTaskId) && !agent.isStuck;
|
|
568
|
+
return (
|
|
569
|
+
<Card
|
|
570
|
+
variant="elevated"
|
|
571
|
+
interactive
|
|
572
|
+
className={cn(
|
|
573
|
+
'agent-card',
|
|
574
|
+
isWorking && 'is-working',
|
|
575
|
+
agent.isStuck && 'is-stuck',
|
|
576
|
+
)}
|
|
577
|
+
>
|
|
578
|
+
<div className="agent-card-head">
|
|
579
|
+
<div className="agent-card-name">
|
|
580
|
+
<StatusDot status={agent.status} isStuck={agent.isStuck} />
|
|
581
|
+
{agent.name}
|
|
582
|
+
</div>
|
|
583
|
+
<div className="agent-card-badges">
|
|
584
|
+
{agent.category && (
|
|
585
|
+
<span
|
|
586
|
+
className="agent-card-category"
|
|
587
|
+
style={{ background: `color-mix(in srgb, ${catColor} 18%, transparent)`, color: catColor }}
|
|
588
|
+
>
|
|
589
|
+
{agent.category}
|
|
590
|
+
</span>
|
|
591
|
+
)}
|
|
592
|
+
<StatusPill agent={agent} />
|
|
593
|
+
</div>
|
|
594
|
+
</div>
|
|
595
|
+
<p className="agent-card-desc">{truncate(agent.description, 200)}</p>
|
|
596
|
+
<div className="agent-card-meta">
|
|
597
|
+
<span className="mono" title={agent.model || ''}>
|
|
598
|
+
{agent.model || '—'}
|
|
599
|
+
</span>
|
|
600
|
+
<span className="tabular-nums muted">{formatRelative(agent.mtime)}</span>
|
|
601
|
+
</div>
|
|
602
|
+
{agent.tags && agent.tags.length > 0 && (
|
|
603
|
+
<div className="agent-card-tags">
|
|
604
|
+
{agent.tags.map((t) => (
|
|
605
|
+
<span key={t} className="agent-card-tag">{t}</span>
|
|
606
|
+
))}
|
|
607
|
+
</div>
|
|
608
|
+
)}
|
|
609
|
+
{(isWorking || agent.lastTask) && (
|
|
610
|
+
<div className="agent-card-activity">
|
|
611
|
+
{agent.currentTaskId && (
|
|
612
|
+
<div className="agent-card-row">
|
|
613
|
+
<Activity size={12} />
|
|
614
|
+
<span className="muted">Working on</span>
|
|
615
|
+
<code className="mono">{agent.currentTaskId}</code>
|
|
616
|
+
</div>
|
|
617
|
+
)}
|
|
618
|
+
{agent.lastTask && !agent.currentTaskId && (
|
|
619
|
+
<div className="agent-card-row">
|
|
620
|
+
<CheckCircle2 size={12} />
|
|
621
|
+
<span className="muted">Last</span>
|
|
622
|
+
<code className="mono">{agent.lastTask.id}</code>
|
|
623
|
+
<span className="muted tabular-nums">{formatRelative(agent.lastTask.finishedAt)}</span>
|
|
624
|
+
</div>
|
|
625
|
+
)}
|
|
626
|
+
{agent.tasksTotal != null && agent.tasksTotal > 0 && (
|
|
627
|
+
<div className="agent-card-row">
|
|
628
|
+
<Circle size={12} />
|
|
629
|
+
<span className="muted">Success rate</span>
|
|
630
|
+
<span className="tabular-nums">{Math.round((agent.successRate || 0) * 100)}%</span>
|
|
631
|
+
<span className="muted tabular-nums">({agent.tasksSucceeded}/{agent.tasksTotal})</span>
|
|
632
|
+
</div>
|
|
633
|
+
)}
|
|
634
|
+
</div>
|
|
635
|
+
)}
|
|
636
|
+
{agent.lastError && (
|
|
637
|
+
<div className="agent-card-error">
|
|
638
|
+
<AlertTriangle size={12} />
|
|
639
|
+
<span className="muted">Last error: {agent.lastError.message}</span>
|
|
640
|
+
</div>
|
|
641
|
+
)}
|
|
642
|
+
<div className="agent-card-actions">
|
|
643
|
+
<Button variant="primary" size="sm" onClick={onInvoke}>
|
|
644
|
+
<Play size={12} /> Invoke
|
|
645
|
+
</Button>
|
|
646
|
+
<Button variant="secondary" size="sm" onClick={onEdit}>
|
|
647
|
+
<Pencil size={12} /> Edit
|
|
648
|
+
</Button>
|
|
649
|
+
{(agent.isStuck || agent.status === 'working' || agent.status === 'error') && (
|
|
650
|
+
<Button variant="ghost" size="sm" onClick={onRestart} title="Reset agent status">
|
|
651
|
+
<RotateCw size={12} /> Restart
|
|
652
|
+
</Button>
|
|
653
|
+
)}
|
|
654
|
+
<Button variant="ghost" size="sm" onClick={onDelete}>
|
|
655
|
+
<Trash2 size={12} />
|
|
656
|
+
</Button>
|
|
657
|
+
<button
|
|
658
|
+
type="button"
|
|
659
|
+
className="icon-btn"
|
|
660
|
+
aria-label={expanded ? 'Collapse' : 'Expand'}
|
|
661
|
+
onClick={() => setExpanded((v) => !v)}
|
|
662
|
+
style={{ marginLeft: 'auto' }}
|
|
663
|
+
>
|
|
664
|
+
{expanded ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
|
|
665
|
+
</button>
|
|
666
|
+
</div>
|
|
667
|
+
{expanded && (
|
|
668
|
+
<div className="agent-card-expanded">
|
|
669
|
+
<div className="agent-card-status-actions">
|
|
670
|
+
<span className="muted text-sm">Set status:</span>
|
|
671
|
+
<Button
|
|
672
|
+
variant={agent.status === 'idle' ? 'primary' : 'ghost'}
|
|
673
|
+
size="sm"
|
|
674
|
+
onClick={() => onSetStatus('idle')}
|
|
675
|
+
>
|
|
676
|
+
Idle
|
|
677
|
+
</Button>
|
|
678
|
+
<Button
|
|
679
|
+
variant={agent.status === 'working' ? 'primary' : 'ghost'}
|
|
680
|
+
size="sm"
|
|
681
|
+
onClick={() => onSetStatus('working')}
|
|
682
|
+
>
|
|
683
|
+
Working
|
|
684
|
+
</Button>
|
|
685
|
+
<Button
|
|
686
|
+
variant={agent.status === 'error' ? 'primary' : 'ghost'}
|
|
687
|
+
size="sm"
|
|
688
|
+
onClick={() => onSetStatus('error')}
|
|
689
|
+
>
|
|
690
|
+
Error
|
|
691
|
+
</Button>
|
|
692
|
+
</div>
|
|
693
|
+
<div className="agent-card-meta">
|
|
694
|
+
<Folder size={11} />
|
|
695
|
+
<code className="mono agent-card-path">{agent.path}</code>
|
|
696
|
+
</div>
|
|
697
|
+
</div>
|
|
698
|
+
)}
|
|
699
|
+
</Card>
|
|
700
|
+
);
|
|
701
|
+
}
|