@polderlabs/bizar 6.2.4 → 6.3.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/.claude/CLAUDE.md +15 -0
- package/.claude/agents/_shared/AGENT_BASELINE.md +168 -0
- package/.claude/agents/_shared/CLAUDE_TOOLS.md +412 -0
- package/.claude/agents/_shared/SKILLS.md +109 -0
- package/.claude/agents/agent-browser.md +80 -0
- package/.claude/agents/baldr.md +49 -0
- package/.claude/agents/forseti.md +51 -0
- package/.claude/agents/frigg.md +42 -0
- package/.claude/agents/heimdall.md +33 -0
- package/.claude/agents/hermod.md +53 -0
- package/.claude/agents/mimir.md +49 -0
- package/.claude/agents/odin.md +287 -0
- package/.claude/agents/quick.md +34 -0
- package/.claude/agents/semble-search.md +50 -0
- package/.claude/agents/thor.md +53 -0
- package/.claude/agents/tyr.md +56 -0
- package/.claude/agents/vidarr.md +54 -0
- package/.claude/agents/vor.md +53 -0
- package/.claude/commands/audit.md +25 -0
- package/.claude/commands/bizar.md +22 -0
- package/.claude/commands/explain.md +17 -0
- package/.claude/commands/init.md +29 -0
- package/.claude/commands/learn.md +44 -0
- package/.claude/commands/plan.md +35 -0
- package/.claude/commands/plow-through.md +50 -0
- package/.claude/commands/pr-review.md +49 -0
- package/.claude/commands/setup-provider.md +96 -0
- package/.claude/commands/tailscale-serve.md +100 -0
- package/.claude/commands/team.md +132 -0
- package/.claude/commands/test.md +62 -0
- package/.claude/commands/validate.md +68 -0
- package/.claude/commands/visual-plan.md +24 -0
- package/.claude/hooks/README.md +92 -0
- package/.claude/hooks/posttooluse-editwrite.mjs +91 -0
- package/.claude/hooks/pretooluse-bash.mjs +81 -0
- package/.claude/hooks/pretooluse-editwrite.mjs +139 -0
- package/.claude/hooks/sessionend-recall.mjs +74 -0
- package/.claude/hooks/sessionstart-prime.mjs +80 -0
- package/.claude/hooks/userpromptsubmit-tag.mjs +80 -0
- package/.claude/settings.json +116 -0
- package/.claude/skills/9router/SKILL.md +80 -0
- package/.claude/skills/9router-chat/SKILL.md +73 -0
- package/.claude/skills/9router-embeddings/SKILL.md +69 -0
- package/.claude/skills/9router-image/SKILL.md +86 -0
- package/.claude/skills/9router-stt/SKILL.md +79 -0
- package/.claude/skills/9router-tts/SKILL.md +80 -0
- package/.claude/skills/9router-web-fetch/SKILL.md +99 -0
- package/.claude/skills/9router-web-search/SKILL.md +91 -0
- package/.claude/skills/bizar/README.md +9 -0
- package/.claude/skills/bizar/SKILL.md +450 -0
- package/.claude/skills/cpp-coding-standards/README.md +28 -0
- package/.claude/skills/cpp-coding-standards/SKILL.md +634 -0
- package/.claude/skills/cpp-coding-standards/references/concurrency.md +320 -0
- package/.claude/skills/cpp-coding-standards/references/error-handling.md +229 -0
- package/.claude/skills/cpp-coding-standards/references/memory-safety.md +216 -0
- package/.claude/skills/cpp-coding-standards/references/modern-idioms.md +282 -0
- package/.claude/skills/cpp-coding-standards/references/review-checklist.md +96 -0
- package/.claude/skills/cpp-testing/README.md +28 -0
- package/.claude/skills/cpp-testing/SKILL.md +304 -0
- package/.claude/skills/cpp-testing/references/coverage.md +370 -0
- package/.claude/skills/cpp-testing/references/framework-compare.md +175 -0
- package/.claude/skills/cpp-testing/references/host-test-for-embedded.md +499 -0
- package/.claude/skills/cpp-testing/references/mocking.md +364 -0
- package/.claude/skills/cpp-testing/references/tdd-workflow.md +308 -0
- package/.claude/skills/cubesandbox/SKILL.md +148 -0
- package/.claude/skills/embedded-esp-idf/README.md +41 -0
- package/.claude/skills/embedded-esp-idf/SKILL.md +439 -0
- package/.claude/skills/embedded-esp-idf/references/freertos-patterns.md +214 -0
- package/.claude/skills/embedded-esp-idf/references/host-tests.md +164 -0
- package/.claude/skills/embedded-esp-idf/references/idf-py-commands.md +157 -0
- package/.claude/skills/embedded-esp-idf/references/kconfig.md +159 -0
- package/.claude/skills/embedded-esp-idf/references/logging-discipline.md +118 -0
- package/.claude/skills/embedded-esp-idf/references/memory-and-iram.md +137 -0
- package/.claude/skills/embedded-esp-idf/references/nvs.md +121 -0
- package/.claude/skills/embedded-esp-idf/references/packed-structs.md +192 -0
- package/.claude/skills/embedded-esp-idf/scripts/idf_env.sh +47 -0
- package/.claude/skills/embedded-esp-idf/scripts/size_check.sh +77 -0
- package/.claude/skills/glyph/SKILL.md +163 -0
- package/.claude/skills/harness-engineering/SKILL.md +143 -0
- package/.claude/skills/lightrag/SKILL.md +81 -0
- package/.claude/skills/memory-protocol/SKILL.md +105 -0
- package/.claude/skills/obsidian/SKILL.md +306 -0
- package/.claude/skills/read-the-damn-docs/SKILL.md +113 -0
- package/.claude/skills/self-improvement/SKILL.md +64 -0
- package/README.md +87 -59
- package/bizar-dash/dist/assets/{EnvVarsSection-DXM8gRm_.js → EnvVarsSection-B58aiJiE.js} +1 -1
- package/bizar-dash/dist/assets/{EnvVarsSection-DXM8gRm_.js.map → EnvVarsSection-B58aiJiE.js.map} +1 -1
- package/bizar-dash/dist/assets/{MobileChat-BnKN_Ks_.js → MobileChat-BJrqwVDd.js} +1 -1
- package/bizar-dash/dist/assets/{MobileChat-BnKN_Ks_.js.map → MobileChat-BJrqwVDd.js.map} +1 -1
- package/bizar-dash/dist/assets/{MobileSettings-DjCPxC-Q.js → MobileSettings-CEQNJNLJ.js} +1 -1
- package/bizar-dash/dist/assets/{MobileSettings-DjCPxC-Q.js.map → MobileSettings-CEQNJNLJ.js.map} +1 -1
- package/bizar-dash/dist/assets/{main-DYiZqMrn.js → main-IvfQAOfy.js} +1 -1
- package/bizar-dash/dist/assets/{main-DYiZqMrn.js.map → main-IvfQAOfy.js.map} +1 -1
- package/bizar-dash/dist/assets/{markdown-C6mXtQxD.js → markdown-tOLaD6nm.js} +1 -1
- package/bizar-dash/dist/assets/{markdown-C6mXtQxD.js.map → markdown-tOLaD6nm.js.map} +1 -1
- package/bizar-dash/dist/assets/{mobile-CMHqtLV2.js → mobile-DYCHcUpq.js} +1 -1
- package/bizar-dash/dist/assets/{mobile-CMHqtLV2.js.map → mobile-DYCHcUpq.js.map} +1 -1
- package/bizar-dash/dist/assets/{mobile-layout-3jIhHX_p.js → mobile-layout-CBHjpwsb.js} +2 -2
- package/bizar-dash/dist/assets/{mobile-layout-3jIhHX_p.js.map → mobile-layout-CBHjpwsb.js.map} +1 -1
- package/bizar-dash/dist/assets/{useSlashCommands-DtITw8Xv.js → useSlashCommands-Bd7_FA6U.js} +2 -2
- package/bizar-dash/dist/assets/{useSlashCommands-DtITw8Xv.js.map → useSlashCommands-Bd7_FA6U.js.map} +1 -1
- package/bizar-dash/dist/assets/{vendor-CeHGtduv.js → vendor-C843201K.js} +12 -12
- package/bizar-dash/dist/assets/vendor-C843201K.js.map +1 -0
- package/bizar-dash/dist/index.html +6 -6
- package/bizar-dash/dist/mobile.html +2 -2
- package/bizar-dash/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/bizar-dash/src/server/api.mjs +4 -4
- package/bizar-dash/src/server/background-store.mjs +15 -16
- package/bizar-dash/src/server/bg-poller.mjs +25 -35
- package/bizar-dash/src/server/bg-retry.mjs +66 -194
- package/bizar-dash/src/server/claude-bg-spawner.mjs +390 -0
- package/bizar-dash/src/server/claude-info.mjs +412 -0
- package/bizar-dash/src/server/{cline-runner.mjs → claude-runner.mjs} +53 -48
- package/bizar-dash/src/server/claude-sdk.mjs +191 -0
- package/bizar-dash/src/server/providers-store.mjs +22 -49
- package/bizar-dash/src/server/routes/background.mjs +24 -20
- package/bizar-dash/src/server/routes/chat.mjs +223 -326
- package/bizar-dash/src/server/routes/claude-session-detail.mjs +329 -0
- package/bizar-dash/src/server/routes/claude-sessions.mjs +259 -0
- package/bizar-dash/src/server/routes/tasks.mjs +20 -28
- package/bizar-dash/src/server/task-delegator.mjs +76 -77
- package/bizar-dash/src/web/components/chat/useChat.ts +23 -27
- package/bizar-dash/src/web/views/Chat.tsx +8 -8
- package/cli/bin.mjs +31 -18
- package/cli/commands/claude-cmd.mjs +348 -0
- package/cli/commands/install.mjs +12 -11
- package/cli/commands/sandbox.mjs +220 -0
- package/cli/commands/validate.mjs +252 -288
- package/cli/dev-link.test.mjs +11 -11
- package/cli/doctor.mjs +131 -213
- package/cli/install.mjs +33 -37
- package/cli/install.test.mjs +9 -9
- package/cli/provision-claude.mjs +893 -0
- package/cli/provision.mjs +330 -226
- package/cli/provision.test.mjs +102 -0
- package/cli/utils.mjs +72 -58
- package/config/AGENTS.md +28 -28
- package/config/agents/_shared/AGENT_BASELINE.md +104 -684
- package/config/skills/bizar/SKILL.md +197 -0
- package/config/skills/cubesandbox/SKILL.md +148 -0
- package/config/skills/harness-engineering/SKILL.md +142 -0
- package/install.sh +66 -44
- package/package.json +19 -11
- package/packages/sdk/ARCHITECTURE.md +40 -36
- package/packages/sdk/package-lock.json +32 -0
- package/packages/sdk/package.json +15 -5
- package/{plugins/bizar → packages/sdk}/src/dangerous-patterns.ts +6 -28
- package/packages/sdk/src/fingerprint.ts +0 -0
- package/packages/sdk/src/index.ts +38 -73
- package/packages/sdk/src/mcp/bin.ts +51 -0
- package/packages/sdk/src/mcp/server.ts +498 -0
- package/{plugins/bizar/src/memory-vault.ts → packages/sdk/src/memory/index.ts} +18 -21
- package/packages/sdk/tests/sdk.test.mjs +148 -0
- package/packages/sdk/vitest.config.ts +1 -1
- package/scripts/bh-full-e2e.mjs +166 -363
- package/scripts/check-deps.mjs +28 -46
- package/scripts/mirror-claude-md.sh +78 -0
- package/scripts/test-in-container.sh +157 -0
- package/templates/clean-state-checklist.md +3 -3
- package/templates/sprint-contract.md +2 -2
- package/bizar-dash/.bizar/activity.log +0 -3
- package/bizar-dash/.omx/logs/omx-2026-07-07.jsonl +0 -1
- package/bizar-dash/.omx/state/session.json +0 -10
- package/bizar-dash/bizar-design/EXPLANATION.md +0 -307
- package/bizar-dash/bizar-design/INSTRUCTIONS.md +0 -149
- package/bizar-dash/bizar-design/canvas.html +0 -281
- package/bizar-dash/bizar-design/canvas.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/components.css +0 -1665
- package/bizar-dash/bizar-design/components.html +0 -557
- package/bizar-dash/bizar-design/components.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/desktop/agents.html +0 -74
- package/bizar-dash/bizar-design/desktop/agents.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/desktop/memory.html +0 -75
- package/bizar-dash/bizar-design/desktop/memory.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/desktop/metrics.html +0 -63
- package/bizar-dash/bizar-design/desktop/metrics.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/desktop/overview.html +0 -95
- package/bizar-dash/bizar-design/desktop/overview.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/desktop/settings.html +0 -70
- package/bizar-dash/bizar-design/desktop/settings.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/icons.svg +0 -44
- package/bizar-dash/bizar-design/index.html +0 -192
- package/bizar-dash/bizar-design/index.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/mobile/agents.html +0 -29
- package/bizar-dash/bizar-design/mobile/agents.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/mobile/memory.html +0 -28
- package/bizar-dash/bizar-design/mobile/memory.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/mobile/metrics.html +0 -29
- package/bizar-dash/bizar-design/mobile/metrics.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/mobile/overview.html +0 -33
- package/bizar-dash/bizar-design/mobile/overview.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/mobile/settings.html +0 -28
- package/bizar-dash/bizar-design/mobile/settings.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/prototype.js +0 -114
- package/bizar-dash/bizar-design/tokens.css +0 -106
- package/bizar-dash/dist/assets/vendor-CeHGtduv.js.map +0 -1
- package/bizar-dash/node_modules/.package-lock.json +0 -6
- package/bizar-dash/package-lock.json +0 -6
- package/bizar-dash/src/server/cline-sdk.mjs +0 -132
- package/bizar-dash/src/server/routes/cline-session-detail.mjs +0 -559
- package/bizar-dash/src/server/routes/cline-sessions.mjs +0 -291
- package/cli/commands/cline-cmd.mjs +0 -289
- package/cli/commands/validate.test.mjs +0 -344
- package/cli/doctor.test.mjs +0 -350
- package/config/cline.json.template +0 -342
- package/packages/sdk/src/client.ts +0 -188
- package/packages/sdk/src/cline-events.ts +0 -134
- package/packages/sdk/src/cline-types.ts +0 -66
- package/packages/sdk/src/cline.ts +0 -339
- package/packages/sdk/src/errors.ts +0 -129
- package/packages/sdk/src/events.ts +0 -153
- package/packages/sdk/src/types.ts +0 -176
- package/packages/sdk/tests/client.test.ts +0 -217
- package/packages/sdk/tests/errors.test.ts +0 -108
- package/packages/sdk/tests/events.test.ts +0 -139
- package/packages/sdk/tests/fixtures/fetch-mock.ts +0 -152
- package/packages/sdk/tests/fixtures/sse-mock.ts +0 -30
- package/plugins/bizar/ARCHITECTURE.md +0 -142
- package/plugins/bizar/CONSTRAINTS.md +0 -67
- package/plugins/bizar/LICENSE +0 -21
- package/plugins/bizar/README.md +0 -448
- package/plugins/bizar/index.ts +0 -872
- package/plugins/bizar/package.json +0 -39
- package/plugins/bizar/scripts/check-forbidden-imports.sh +0 -33
- package/plugins/bizar/src/background-state.ts +0 -641
- package/plugins/bizar/src/background.ts +0 -1806
- package/plugins/bizar/src/cline-runner.ts +0 -203
- package/plugins/bizar/src/clineruntime.ts +0 -227
- package/plugins/bizar/src/commands-impl.ts +0 -151
- package/plugins/bizar/src/commands.ts +0 -1799
- package/plugins/bizar/src/compaction.d.mts +0 -48
- package/plugins/bizar/src/compaction.mjs +0 -192
- package/plugins/bizar/src/dashboard-client.ts +0 -233
- package/plugins/bizar/src/event-stream.ts +0 -606
- package/plugins/bizar/src/fingerprint.ts +0 -120
- package/plugins/bizar/src/handoff.ts +0 -79
- package/plugins/bizar/src/hooks/memory-flush-on-compact.ts +0 -123
- package/plugins/bizar/src/hooks/memory-inject.ts +0 -247
- package/plugins/bizar/src/hooks/memory-write-on-end.ts +0 -188
- package/plugins/bizar/src/hooks/skill-curator.ts +0 -180
- package/plugins/bizar/src/http-client.ts +0 -467
- package/plugins/bizar/src/key-rotation.ts +0 -218
- package/plugins/bizar/src/logger.ts +0 -144
- package/plugins/bizar/src/loop-engineering.ts +0 -241
- package/plugins/bizar/src/loop.ts +0 -176
- package/plugins/bizar/src/mistake-recovery.ts +0 -98
- package/plugins/bizar/src/odin.ts +0 -227
- package/plugins/bizar/src/options.ts +0 -470
- package/plugins/bizar/src/plan-fs.ts +0 -323
- package/plugins/bizar/src/reasoning-clean.ts +0 -454
- package/plugins/bizar/src/report.ts +0 -178
- package/plugins/bizar/src/research-prompt.ts +0 -35
- package/plugins/bizar/src/serve-info.ts +0 -228
- package/plugins/bizar/src/serve.ts +0 -496
- package/plugins/bizar/src/settings.ts +0 -349
- package/plugins/bizar/src/state.ts +0 -298
- package/plugins/bizar/src/tool-discipline.ts +0 -105
- package/plugins/bizar/src/tools/agent-browser.ts +0 -315
- package/plugins/bizar/src/tools/bg-collect.ts +0 -131
- package/plugins/bizar/src/tools/bg-get-comments.ts +0 -266
- package/plugins/bizar/src/tools/bg-kill.ts +0 -116
- package/plugins/bizar/src/tools/bg-pause.ts +0 -99
- package/plugins/bizar/src/tools/bg-report-progress.ts +0 -115
- package/plugins/bizar/src/tools/bg-resume.ts +0 -94
- package/plugins/bizar/src/tools/bg-send-message.ts +0 -223
- package/plugins/bizar/src/tools/bg-spawn.ts +0 -502
- package/plugins/bizar/src/tools/bg-status.ts +0 -130
- package/plugins/bizar/src/tools/graph-query.ts +0 -278
- package/plugins/bizar/src/tools/loop-engineering.ts +0 -193
- package/plugins/bizar/src/tools/memory-list.ts +0 -43
- package/plugins/bizar/src/tools/memory-read.ts +0 -69
- package/plugins/bizar/src/tools/memory-search.ts +0 -47
- package/plugins/bizar/src/tools/memory-write.ts +0 -54
- package/plugins/bizar/src/tools/open-kb.ts +0 -198
- package/plugins/bizar/src/tools/plan-action.ts +0 -785
- package/plugins/bizar/src/tools/read-glyph-feedback.ts +0 -191
- package/plugins/bizar/src/tools/team-spawn.ts +0 -73
- package/plugins/bizar/src/tools/team-status.ts +0 -76
- package/plugins/bizar/src/tools/wait-for-feedback.ts +0 -415
- package/plugins/bizar/src/trajectory.ts +0 -104
- package/plugins/bizar/tests/README.md +0 -99
- package/plugins/bizar/tests/attach-handler-bug.test.ts +0 -169
- package/plugins/bizar/tests/background-state.test.ts +0 -277
- package/plugins/bizar/tests/background.test.ts +0 -402
- package/plugins/bizar/tests/block.test.ts +0 -195
- package/plugins/bizar/tests/canonical-key-order.test.ts +0 -75
- package/plugins/bizar/tests/clineruntime-config.test.ts +0 -283
- package/plugins/bizar/tests/commands-impl.test.ts +0 -316
- package/plugins/bizar/tests/commands.test.ts +0 -584
- package/plugins/bizar/tests/compaction.test.ts +0 -264
- package/plugins/bizar/tests/config.test.ts +0 -128
- package/plugins/bizar/tests/dashboard-client.test.ts +0 -159
- package/plugins/bizar/tests/dispose.test.ts +0 -336
- package/plugins/bizar/tests/event-stream.test.ts +0 -409
- package/plugins/bizar/tests/event.test.ts +0 -262
- package/plugins/bizar/tests/fingerprint.test.ts +0 -162
- package/plugins/bizar/tests/http-client.test.ts +0 -404
- package/plugins/bizar/tests/init-helpers.test.ts +0 -203
- package/plugins/bizar/tests/integration/slash-command.test.ts +0 -349
- package/plugins/bizar/tests/integration/tool-routing.test.ts +0 -98
- package/plugins/bizar/tests/key-rotation.test.ts +0 -396
- package/plugins/bizar/tests/loop-engineering.test.ts +0 -168
- package/plugins/bizar/tests/loop.test.ts +0 -397
- package/plugins/bizar/tests/memory-write-on-end.test.ts +0 -92
- package/plugins/bizar/tests/mistake-recovery.test.ts +0 -116
- package/plugins/bizar/tests/odin.test.ts +0 -125
- package/plugins/bizar/tests/options.test.ts +0 -329
- package/plugins/bizar/tests/reasoning-clean.test.ts +0 -422
- package/plugins/bizar/tests/safety.test.ts +0 -256
- package/plugins/bizar/tests/serve.test.ts +0 -339
- package/plugins/bizar/tests/settings.test.ts +0 -351
- package/plugins/bizar/tests/stall-think.test.ts +0 -750
- package/plugins/bizar/tests/state.test.ts +0 -276
- package/plugins/bizar/tests/tool-discipline.test.ts +0 -77
- package/plugins/bizar/tests/tools/agent-browser.test.ts +0 -98
- package/plugins/bizar/tests/tools/bg-collect.test.ts +0 -337
- package/plugins/bizar/tests/tools/bg-get-comments.test.ts +0 -485
- package/plugins/bizar/tests/tools/bg-kill.test.ts +0 -235
- package/plugins/bizar/tests/tools/bg-pause.test.ts +0 -61
- package/plugins/bizar/tests/tools/bg-report-progress.test.ts +0 -79
- package/plugins/bizar/tests/tools/bg-resume.test.ts +0 -40
- package/plugins/bizar/tests/tools/bg-send-message.test.ts +0 -116
- package/plugins/bizar/tests/tools/bg-spawn-delegation.test.ts +0 -147
- package/plugins/bizar/tests/tools/bg-spawn-http.test.ts +0 -233
- package/plugins/bizar/tests/tools/bg-spawn.test.ts +0 -311
- package/plugins/bizar/tests/tools/bg-status.test.ts +0 -217
- package/plugins/bizar/tests/tools/cline-runner.test.ts +0 -115
- package/plugins/bizar/tests/tools/plan-action.test.ts +0 -599
- package/plugins/bizar/tests/tools/read-glyph-feedback.test.ts +0 -253
- package/plugins/bizar/tests/tools/wait-for-feedback.test.ts +0 -390
- package/plugins/bizar/tests/update-deadlock.test.ts +0 -151
- package/plugins/bizar/tsconfig.json +0 -29
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bg-get-comments.ts
|
|
3
|
-
*
|
|
4
|
-
* `bizar_get_plan_comments` tool — read-only access to the comments on a
|
|
5
|
-
* Bizar Plan canvas.
|
|
6
|
-
*
|
|
7
|
-
* Background agents (Thor, Tyr, Mimir, etc.) call this to pick up user
|
|
8
|
-
* feedback pinned to specific elements they are working on. The tool
|
|
9
|
-
* reads `plans/<slug>/plan.json` from disk and returns the comments
|
|
10
|
-
* array, optionally filtered to a specific element.
|
|
11
|
-
*
|
|
12
|
-
* The schema on disk is the v2 canvas shape:
|
|
13
|
-
*
|
|
14
|
-
* {
|
|
15
|
-
* schemaVersion: 2,
|
|
16
|
-
* title: "...",
|
|
17
|
-
* elements: [...],
|
|
18
|
-
* connections: [...],
|
|
19
|
-
* comments: [
|
|
20
|
-
* {
|
|
21
|
-
* id: "c_xxx",
|
|
22
|
-
* x: 100, y: 200,
|
|
23
|
-
* elementId: "el_yyy" | null,
|
|
24
|
-
* author: "DrB0rk",
|
|
25
|
-
* text: "Make this button bigger",
|
|
26
|
-
* created: "2026-06-18T...",
|
|
27
|
-
* thread: [
|
|
28
|
-
* { id: "r_xxx", author: "ai", text: "Done", created: "..." }
|
|
29
|
-
* ]
|
|
30
|
-
* }
|
|
31
|
-
* ],
|
|
32
|
-
* viewport: { x, y, zoom }
|
|
33
|
-
* }
|
|
34
|
-
*
|
|
35
|
-
* If the file does not exist, has an older shape, or the elementId filter
|
|
36
|
-
* yields zero results, the tool returns an empty array — never an error.
|
|
37
|
-
* This matches the principle that a missing plan is not the agent's
|
|
38
|
-
* problem; it just means "no feedback on file".
|
|
39
|
-
*
|
|
40
|
-
* Returns (on success):
|
|
41
|
-
* `Array<{ id, x, y, elementId, author, text, created, thread: [...] }>`
|
|
42
|
-
*
|
|
43
|
-
* Returns (on error):
|
|
44
|
-
* `{ error: string, planSlug: string }`
|
|
45
|
-
*
|
|
46
|
-
* Read-only — available to ALL agents (Vör, Frigg, Mimir, Odin, Thor,
|
|
47
|
-
* Tyr, Heimdall, etc.). The function is pure: no side effects, no
|
|
48
|
-
* network calls, no process spawning.
|
|
49
|
-
*
|
|
50
|
-
* The "worktree" passed in via deps is the directory the plugin was
|
|
51
|
-
* loaded for; `plans/` lives at the root of the project.
|
|
52
|
-
*
|
|
53
|
-
* Cline SDK port (Phase 2):
|
|
54
|
-
* - Uses `createTool` from `@cline/sdk` directly.
|
|
55
|
-
* - Adds `name: BIZAR_GET_PLAN_COMMENTS_TOOL_NAME`.
|
|
56
|
-
* - `inputSchema` is `z.object(...)` over the same fields as before.
|
|
57
|
-
* - Returns structured `{ ok, comments, planSlug }` / `{ ok: false, error, planSlug }`
|
|
58
|
-
* instead of `{ output: JSON.stringify(...) }`.
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
import { createTool, type AgentTool } from "@cline/sdk";
|
|
62
|
-
import { z } from "zod";
|
|
63
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
64
|
-
import { join } from "node:path";
|
|
65
|
-
|
|
66
|
-
import type { Logger } from "../logger.js";
|
|
67
|
-
|
|
68
|
-
export const BIZAR_GET_PLAN_COMMENTS_TOOL_NAME = "bizar_get_plan_comments";
|
|
69
|
-
|
|
70
|
-
export interface BgGetCommentsDeps {
|
|
71
|
-
/** The project's working directory (e.g. /home/user/proj). `plans/` is here. */
|
|
72
|
-
worktree: string;
|
|
73
|
-
logger: Logger;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export type BizarGetPlanCommentsInput = z.infer<typeof bizarGetPlanCommentsSchema>;
|
|
77
|
-
export type BizarGetPlanCommentsOutput =
|
|
78
|
-
| { ok: true; comments: PlanComment[]; planSlug: string }
|
|
79
|
-
| { ok: false; error: string; planSlug: string };
|
|
80
|
-
|
|
81
|
-
const bizarGetPlanCommentsSchema = z.object({
|
|
82
|
-
planSlug: z
|
|
83
|
-
.string()
|
|
84
|
-
.min(1)
|
|
85
|
-
.max(64)
|
|
86
|
-
.describe(
|
|
87
|
-
"The plan's slug (lowercase, hyphens, e.g. 'my-feature'). " +
|
|
88
|
-
"Matches the directory under plans/<slug>/.",
|
|
89
|
-
),
|
|
90
|
-
elementId: z
|
|
91
|
-
.string()
|
|
92
|
-
.optional()
|
|
93
|
-
.describe(
|
|
94
|
-
"Optional element id (e.g. 'el_abc123'). If provided, only " +
|
|
95
|
-
"comments pinned to that element are returned. Omit to " +
|
|
96
|
-
"get all comments on the plan. Pass an empty string, " +
|
|
97
|
-
"'nil', or 'null' to get comments pinned to the canvas " +
|
|
98
|
-
"(no element).",
|
|
99
|
-
),
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// --- On-disk shapes ---------------------------------------------------------
|
|
103
|
-
|
|
104
|
-
/** A single thread reply on a canvas comment. */
|
|
105
|
-
interface PlanCommentReply {
|
|
106
|
-
id?: string;
|
|
107
|
-
author?: string;
|
|
108
|
-
text?: string;
|
|
109
|
-
created?: string;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/** A single canvas comment as stored in plan.json. */
|
|
113
|
-
interface PlanComment {
|
|
114
|
-
id: string;
|
|
115
|
-
x?: number;
|
|
116
|
-
y?: number;
|
|
117
|
-
elementId?: string | null;
|
|
118
|
-
author?: string;
|
|
119
|
-
text?: string;
|
|
120
|
-
created?: string;
|
|
121
|
-
thread?: PlanCommentReply[];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/** The minimum subset of plan.json the tool reads. */
|
|
125
|
-
interface PlanCanvasFile {
|
|
126
|
-
schemaVersion?: number;
|
|
127
|
-
title?: string;
|
|
128
|
-
elements?: Array<{ id?: string; title?: string }>;
|
|
129
|
-
connections?: unknown[];
|
|
130
|
-
comments?: PlanComment[];
|
|
131
|
-
viewport?: unknown;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// --- Validation helpers -----------------------------------------------------
|
|
135
|
-
|
|
136
|
-
/** Same slug rule used by `cli/plan.mjs`. Lowercase, hyphens, 1–64 chars. */
|
|
137
|
-
const SLUG_REGEX = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
138
|
-
|
|
139
|
-
function isValidSlug(s: string): boolean {
|
|
140
|
-
return SLUG_REGEX.test(s);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// --- Core read function (extracted for testability) --------------------------
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Read the plan.json from disk, parse it, and return the filtered comments.
|
|
147
|
-
*
|
|
148
|
-
* Exported (named) so the test file can drive the same code path the
|
|
149
|
-
* real tool uses, without needing a tool framework.
|
|
150
|
-
*
|
|
151
|
-
* Errors are swallowed and returned as a result — a missing plan should
|
|
152
|
-
* never break an agent session. The only fatal error is "invalid slug",
|
|
153
|
-
* which is a programming error rather than a runtime condition.
|
|
154
|
-
*/
|
|
155
|
-
export function readPlanComments(
|
|
156
|
-
worktree: string,
|
|
157
|
-
planSlug: string,
|
|
158
|
-
elementId: string | undefined,
|
|
159
|
-
): { ok: true; comments: PlanComment[]; planSlug: string } | { ok: false; error: string; planSlug: string } {
|
|
160
|
-
if (!isValidSlug(planSlug)) {
|
|
161
|
-
return { ok: false, error: `Invalid planSlug: "${planSlug}". Must match ^[a-z0-9][a-z0-9-]{0,63}$.`, planSlug };
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const planPath = join(worktree, "plans", planSlug, "plan.json");
|
|
165
|
-
if (!existsSync(planPath)) {
|
|
166
|
-
// No plan.json — this is a v1 plan, or the plan was never created.
|
|
167
|
-
// We return an empty array; the agent should treat it as "no feedback".
|
|
168
|
-
return { ok: true, comments: [], planSlug };
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
let parsed: PlanCanvasFile;
|
|
172
|
-
try {
|
|
173
|
-
const raw = readFileSync(planPath, "utf-8");
|
|
174
|
-
parsed = JSON.parse(raw) as PlanCanvasFile;
|
|
175
|
-
} catch (err: unknown) {
|
|
176
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
177
|
-
return { ok: false, error: `Failed to read plan.json: ${msg}`, planSlug };
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Guard against the JSON being null or a non-object (e.g. "null" or "[]"
|
|
181
|
-
// at the top level). The v2 schema requires an object; anything else is
|
|
182
|
-
// a programmer error rather than a runtime condition.
|
|
183
|
-
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
184
|
-
return {
|
|
185
|
-
ok: false,
|
|
186
|
-
error: `plan.json is not a v2 canvas object (got ${Array.isArray(parsed) ? "array" : typeof parsed})`,
|
|
187
|
-
planSlug,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const all = Array.isArray(parsed.comments) ? parsed.comments : [];
|
|
192
|
-
|
|
193
|
-
// Filter by elementId if requested. Note: we keep elementId === null
|
|
194
|
-
// (canvas-pinned, no element) separate from elementId === undefined
|
|
195
|
-
// (malformed comment). The latter is filtered out as "not a comment".
|
|
196
|
-
let filtered: PlanComment[];
|
|
197
|
-
if (elementId === undefined) {
|
|
198
|
-
filtered = all.filter((c) => c && typeof c === "object" && typeof c.id === "string");
|
|
199
|
-
} else if (elementId === "nil" || elementId === "null") {
|
|
200
|
-
// explicit "canvas-pinned only"
|
|
201
|
-
filtered = all.filter(
|
|
202
|
-
(c) => c && typeof c === "object" && typeof c.id === "string" && c.elementId == null,
|
|
203
|
-
);
|
|
204
|
-
} else if (elementId === "") {
|
|
205
|
-
// empty string means "all comments" (used by the v2 viewer's
|
|
206
|
-
// "show me everything" GET with ?elementId=)
|
|
207
|
-
filtered = all.filter((c) => c && typeof c === "object" && typeof c.id === "string");
|
|
208
|
-
} else {
|
|
209
|
-
filtered = all.filter(
|
|
210
|
-
(c) => c && typeof c === "object" && typeof c.id === "string" && c.elementId === elementId,
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// Sort by created time (oldest first) so the agent sees a chronological
|
|
215
|
-
// thread. Missing/empty timestamps are pushed to the end.
|
|
216
|
-
filtered.sort((a, b) => {
|
|
217
|
-
const at = String(a.created || "");
|
|
218
|
-
const bt = String(b.created || "");
|
|
219
|
-
if (at === bt) return 0;
|
|
220
|
-
if (at === "") return 1;
|
|
221
|
-
if (bt === "") return -1;
|
|
222
|
-
return at.localeCompare(bt);
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
return { ok: true, comments: filtered, planSlug };
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// --- Tool factory -----------------------------------------------------------
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Build the `bizar_get_plan_comments` tool. The plugin wires the result
|
|
232
|
-
* into `api.registerTool()` from `AgentExtensionApi`. The `deps`
|
|
233
|
-
* closure carries the worktree and logger.
|
|
234
|
-
*/
|
|
235
|
-
export function createBgGetCommentsTool(
|
|
236
|
-
deps: BgGetCommentsDeps,
|
|
237
|
-
): AgentTool<BizarGetPlanCommentsInput, BizarGetPlanCommentsOutput> {
|
|
238
|
-
return createTool({
|
|
239
|
-
name: BIZAR_GET_PLAN_COMMENTS_TOOL_NAME,
|
|
240
|
-
description:
|
|
241
|
-
"Read the comments pinned to elements on a Bizar Plan canvas. " +
|
|
242
|
-
"Use this to pick up user feedback while implementing changes. " +
|
|
243
|
-
"Read-only; available to all agents. " +
|
|
244
|
-
"Returns an array of comment objects with id, x, y, elementId, " +
|
|
245
|
-
"author, text, created, and a thread of replies.",
|
|
246
|
-
inputSchema: bizarGetPlanCommentsSchema.shape,
|
|
247
|
-
execute: async (input) => {
|
|
248
|
-
const result = readPlanComments(deps.worktree, input.planSlug, input.elementId);
|
|
249
|
-
if (!result.ok) {
|
|
250
|
-
deps.logger.warn(
|
|
251
|
-
`bizar: get_plan_comments(${input.planSlug}) failed: ${result.error}`,
|
|
252
|
-
);
|
|
253
|
-
return {
|
|
254
|
-
ok: false as const,
|
|
255
|
-
error: result.error,
|
|
256
|
-
planSlug: input.planSlug,
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
ok: true as const,
|
|
261
|
-
comments: result.comments,
|
|
262
|
-
planSlug: result.planSlug,
|
|
263
|
-
};
|
|
264
|
-
},
|
|
265
|
-
});
|
|
266
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bg-kill.ts
|
|
3
|
-
*
|
|
4
|
-
* `bizar_kill` tool (v0.4.2 spec §1.5, §7.1, HIGH-4, MEDIUM-40).
|
|
5
|
-
*
|
|
6
|
-
* Odin-only — only Odin may kill background instances.
|
|
7
|
-
*
|
|
8
|
-
* v5.5.x — Calls `cline.abort(sessionId)` on the in-process `ClineCore`
|
|
9
|
-
* (Phase 2/3 in-process refactor). The session record is preserved in
|
|
10
|
-
* Cline for history; the running loop is stopped.
|
|
11
|
-
*
|
|
12
|
-
* After abort, the next event for that session is the corresponding
|
|
13
|
-
* agent runtime event. The plugin's `afterTool` hook updates the
|
|
14
|
-
* instance status; `bizar_kill` itself also stamps `status: "killed"`
|
|
15
|
-
* synchronously so the caller gets immediate feedback.
|
|
16
|
-
*
|
|
17
|
-
* No-op on already-terminal instances (returns the current status).
|
|
18
|
-
*
|
|
19
|
-
* Cline SDK port (Phase 2):
|
|
20
|
-
* - Uses `createTool` from `@cline/sdk` directly.
|
|
21
|
-
* - Adds `name: BIZAR_KILL_TOOL_NAME`.
|
|
22
|
-
* - `inputSchema` is `z.object(...)` over the same fields as before.
|
|
23
|
-
* - Returns structured `{ ok, instanceId, status }` instead of
|
|
24
|
-
* `{ output: JSON.stringify(...) }`.
|
|
25
|
-
* - `ctx.agent` from OpenCode becomes `agentId`-derived role check
|
|
26
|
-
* via the runtime metadata; Cline does not surface `agent` on
|
|
27
|
-
* `AgentToolContext`, so the InstanceManager encodes the role on
|
|
28
|
-
* each instance and we check there.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
import { createTool, type AgentTool } from "@cline/sdk";
|
|
32
|
-
import { z } from "zod";
|
|
33
|
-
|
|
34
|
-
import type { InstanceManager } from "../background.js";
|
|
35
|
-
import type { Logger } from "../logger.js";
|
|
36
|
-
|
|
37
|
-
export const BIZAR_KILL_TOOL_NAME = "bizar_kill";
|
|
38
|
-
|
|
39
|
-
export interface BgKillDeps {
|
|
40
|
-
instanceManager: InstanceManager;
|
|
41
|
-
logger: Logger;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export type BizarKillInput = z.infer<typeof bizarKillSchema>;
|
|
45
|
-
export type BizarKillOutput =
|
|
46
|
-
| { ok: true; instanceId: string; status: string }
|
|
47
|
-
| { ok: false; error: string; instanceId?: string };
|
|
48
|
-
|
|
49
|
-
const bizarKillSchema = z.object({
|
|
50
|
-
instanceId: z
|
|
51
|
-
.string()
|
|
52
|
-
.min(1)
|
|
53
|
-
.describe("Instance id returned by bizar_spawn_background."),
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Build the `bizar_kill` tool. The plugin wires the result into
|
|
58
|
-
* `api.registerTool()` from `AgentExtensionApi`. The `deps` closure
|
|
59
|
-
* carries the InstanceManager.
|
|
60
|
-
*/
|
|
61
|
-
export function createBgKillTool(
|
|
62
|
-
deps: BgKillDeps,
|
|
63
|
-
): AgentTool<BizarKillInput, BizarKillOutput> {
|
|
64
|
-
return createTool({
|
|
65
|
-
name: BIZAR_KILL_TOOL_NAME,
|
|
66
|
-
description:
|
|
67
|
-
"Kill a running background instance. Only Odin may kill. " +
|
|
68
|
-
"No-op on already-terminal instances.",
|
|
69
|
-
inputSchema: bizarKillSchema.shape,
|
|
70
|
-
execute: async (input, context) => {
|
|
71
|
-
// Odin-only — derive the agent role from the runtime metadata
|
|
72
|
-
// (`parentAgent` is set on first chat.message of the session)
|
|
73
|
-
// and from the InstanceManager when possible. Cline's
|
|
74
|
-
// `AgentToolContext` does not expose `agent` directly, so we
|
|
75
|
-
// check the persisted state instead.
|
|
76
|
-
const parentAgent =
|
|
77
|
-
(context.metadata as { parentAgent?: string } | undefined)?.parentAgent ??
|
|
78
|
-
null;
|
|
79
|
-
if (parentAgent !== "odin") {
|
|
80
|
-
return {
|
|
81
|
-
ok: false as const,
|
|
82
|
-
error:
|
|
83
|
-
"Only Odin can kill background agents. Use bizar_status to inspect or ask Odin to kill.",
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
const inst = await deps.instanceManager.get(input.instanceId);
|
|
87
|
-
if (!inst) {
|
|
88
|
-
return {
|
|
89
|
-
ok: false as const,
|
|
90
|
-
error: "instance_not_found",
|
|
91
|
-
instanceId: input.instanceId,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
try {
|
|
95
|
-
await deps.instanceManager.kill(input.instanceId);
|
|
96
|
-
const after = await deps.instanceManager.get(input.instanceId);
|
|
97
|
-
return {
|
|
98
|
-
ok: true as const,
|
|
99
|
-
instanceId: input.instanceId,
|
|
100
|
-
status: after?.status ?? "killed",
|
|
101
|
-
};
|
|
102
|
-
} catch (err: unknown) {
|
|
103
|
-
deps.logger.warn(
|
|
104
|
-
`bizar: kill(${input.instanceId}) failed: ${
|
|
105
|
-
err instanceof Error ? err.message : String(err)
|
|
106
|
-
}`,
|
|
107
|
-
);
|
|
108
|
-
return {
|
|
109
|
-
ok: false as const,
|
|
110
|
-
error: `kill_failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
111
|
-
instanceId: input.instanceId,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* plugins/bizar/src/tools/bg-pause.ts
|
|
3
|
-
*
|
|
4
|
-
* v5.x — `bizar_pause` tool. Sends SIGSTOP to a running background
|
|
5
|
-
* agent's subprocess (POSIX only). The InstanceManager flips the
|
|
6
|
-
* in-memory status to `"paused"` and persists the change.
|
|
7
|
-
*
|
|
8
|
-
* The companion tool `bizar_resume` ({@link ./bg-resume.ts}) reverses
|
|
9
|
-
* the action via SIGCONT.
|
|
10
|
-
*
|
|
11
|
-
* Odin-only — same auth model as the rest of the bg tools.
|
|
12
|
-
*
|
|
13
|
-
* Cline SDK port (Phase 2):
|
|
14
|
-
* - Uses `createTool` from `@cline/sdk` directly.
|
|
15
|
-
* - Adds `name: BIZAR_PAUSE_TOOL_NAME`.
|
|
16
|
-
* - `inputSchema` is `z.object(...)` over the same fields as before.
|
|
17
|
-
* - Returns structured `{ ok, instanceId, status }` instead of
|
|
18
|
-
* `{ output: JSON.stringify(...) }`.
|
|
19
|
-
* - `ctx.agent` becomes `context.metadata.parentAgent` look-up.
|
|
20
|
-
*/
|
|
21
|
-
import { createTool, type AgentTool } from "@cline/sdk";
|
|
22
|
-
import { z } from "zod";
|
|
23
|
-
|
|
24
|
-
import type { InstanceManager } from "../background.js";
|
|
25
|
-
import type { Logger } from "../logger.js";
|
|
26
|
-
|
|
27
|
-
export const BIZAR_PAUSE_TOOL_NAME = "bizar_pause";
|
|
28
|
-
|
|
29
|
-
export interface BgPauseDeps {
|
|
30
|
-
instanceManager: InstanceManager;
|
|
31
|
-
logger: Logger;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type BizarPauseInput = z.infer<typeof bizarPauseSchema>;
|
|
35
|
-
export type BizarPauseOutput =
|
|
36
|
-
| { ok: true; instanceId: string; status: string }
|
|
37
|
-
| { ok: false; error: string; instanceId?: string };
|
|
38
|
-
|
|
39
|
-
const bizarPauseSchema = z.object({
|
|
40
|
-
instanceId: z
|
|
41
|
-
.string()
|
|
42
|
-
.min(1)
|
|
43
|
-
.describe("Instance id returned by bizar_spawn_background."),
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Build the `bizar_pause` tool. The plugin wires the result into
|
|
48
|
-
* `api.registerTool()` from `AgentExtensionApi`. The `deps` closure
|
|
49
|
-
* carries the InstanceManager.
|
|
50
|
-
*/
|
|
51
|
-
export function createBgPauseTool(
|
|
52
|
-
deps: BgPauseDeps,
|
|
53
|
-
): AgentTool<BizarPauseInput, BizarPauseOutput> {
|
|
54
|
-
return createTool({
|
|
55
|
-
name: BIZAR_PAUSE_TOOL_NAME,
|
|
56
|
-
description:
|
|
57
|
-
"Pause a running background agent by sending SIGSTOP to its subprocess. " +
|
|
58
|
-
"Only Odin may pause. No-op on already-paused instances. " +
|
|
59
|
-
"POSIX only — on Windows this returns an `unsupported_on_win32` error.",
|
|
60
|
-
inputSchema: bizarPauseSchema.shape,
|
|
61
|
-
execute: async (input, context) => {
|
|
62
|
-
const parentAgent =
|
|
63
|
-
(context.metadata as { parentAgent?: string } | undefined)?.parentAgent ?? null;
|
|
64
|
-
if (parentAgent !== "odin") {
|
|
65
|
-
return {
|
|
66
|
-
ok: false as const,
|
|
67
|
-
error:
|
|
68
|
-
"Only Odin can pause background agents. Use bizar_status to inspect or ask Odin to pause.",
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
try {
|
|
72
|
-
const result = await deps.instanceManager.pause(input.instanceId);
|
|
73
|
-
if (!result.ok) {
|
|
74
|
-
return {
|
|
75
|
-
ok: false as const,
|
|
76
|
-
error: result.error || "pause failed",
|
|
77
|
-
instanceId: input.instanceId,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
ok: true as const,
|
|
82
|
-
instanceId: input.instanceId,
|
|
83
|
-
status: "paused",
|
|
84
|
-
};
|
|
85
|
-
} catch (err: unknown) {
|
|
86
|
-
deps.logger.warn(
|
|
87
|
-
`bizar: pause(${input.instanceId}) threw: ${
|
|
88
|
-
err instanceof Error ? err.message : String(err)
|
|
89
|
-
}`,
|
|
90
|
-
);
|
|
91
|
-
return {
|
|
92
|
-
ok: false as const,
|
|
93
|
-
error: `pause threw: ${err instanceof Error ? err.message : String(err)}`,
|
|
94
|
-
instanceId: input.instanceId,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* plugins/bizar/src/tools/bg-report-progress.ts
|
|
3
|
-
*
|
|
4
|
-
* v5.x — `bizar_report_progress` tool. Lets a running background agent
|
|
5
|
-
* push a structured progress update (step/total/message) into the
|
|
6
|
-
* instance state. The dashboard reads `progress` and renders a
|
|
7
|
-
* progress bar; `progressMessage` shows the free-form status line.
|
|
8
|
-
*
|
|
9
|
-
* Available to ALL agents (the body of a bg agent calls it; not just
|
|
10
|
-
* Odin). The `bizar_*` prefix is reserved; the auth filter is "all",
|
|
11
|
-
* matching the "tools all agents can call" pattern of
|
|
12
|
-
* `bizar_status`.
|
|
13
|
-
*
|
|
14
|
-
* Cline SDK port (Phase 2):
|
|
15
|
-
* - Uses `createTool` from `@cline/sdk` directly.
|
|
16
|
-
* - Adds `name: BIZAR_REPORT_PROGRESS_TOOL_NAME`.
|
|
17
|
-
* - `inputSchema` is `z.object(...)` over the same fields as before.
|
|
18
|
-
* - Returns structured `{ ok, instanceId, progress }` instead of
|
|
19
|
-
* `{ output: JSON.stringify(...) }`.
|
|
20
|
-
*/
|
|
21
|
-
import { createTool, type AgentTool } from "@cline/sdk";
|
|
22
|
-
import { z } from "zod";
|
|
23
|
-
|
|
24
|
-
import type { InstanceManager } from "../background.js";
|
|
25
|
-
import type { Logger } from "../logger.js";
|
|
26
|
-
|
|
27
|
-
export const BIZAR_REPORT_PROGRESS_TOOL_NAME = "bizar_report_progress";
|
|
28
|
-
|
|
29
|
-
export interface BgReportProgressDeps {
|
|
30
|
-
instanceManager: InstanceManager;
|
|
31
|
-
logger: Logger;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type BizarReportProgressInput = z.infer<typeof bizarReportProgressSchema>;
|
|
35
|
-
export type BizarReportProgressOutput =
|
|
36
|
-
| { ok: true; instanceId: string; progress: number | undefined }
|
|
37
|
-
| { ok: false; error: string; instanceId: string };
|
|
38
|
-
|
|
39
|
-
const bizarReportProgressSchema = z.object({
|
|
40
|
-
instanceId: z
|
|
41
|
-
.string()
|
|
42
|
-
.min(1)
|
|
43
|
-
.describe("Instance id (the one returned by bizar_spawn_background)."),
|
|
44
|
-
step: z
|
|
45
|
-
.number()
|
|
46
|
-
.int()
|
|
47
|
-
.min(0)
|
|
48
|
-
.describe("Current step (>=0)."),
|
|
49
|
-
total: z
|
|
50
|
-
.number()
|
|
51
|
-
.int()
|
|
52
|
-
.positive()
|
|
53
|
-
.describe("Total step count (>0)."),
|
|
54
|
-
message: z
|
|
55
|
-
.string()
|
|
56
|
-
.optional()
|
|
57
|
-
.describe("Optional human-readable status."),
|
|
58
|
-
indeterminate: z
|
|
59
|
-
.boolean()
|
|
60
|
-
.optional()
|
|
61
|
-
.default(false)
|
|
62
|
-
.describe("Set true to show an indeterminate (unknown) progress."),
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Build the `bizar_report_progress` tool. The plugin wires the result
|
|
67
|
-
* into `api.registerTool()` from `AgentExtensionApi`. The `deps`
|
|
68
|
-
* closure carries the InstanceManager.
|
|
69
|
-
*/
|
|
70
|
-
export function createBgReportProgressTool(
|
|
71
|
-
deps: BgReportProgressDeps,
|
|
72
|
-
): AgentTool<BizarReportProgressInput, BizarReportProgressOutput> {
|
|
73
|
-
return createTool({
|
|
74
|
-
name: BIZAR_REPORT_PROGRESS_TOOL_NAME,
|
|
75
|
-
description:
|
|
76
|
-
"Report progress on the current background instance. " +
|
|
77
|
-
"Available to all agents. step/total are integers; message is a " +
|
|
78
|
-
"free-form status hint shown next to the progress bar.",
|
|
79
|
-
inputSchema: bizarReportProgressSchema.shape,
|
|
80
|
-
execute: async (input) => {
|
|
81
|
-
try {
|
|
82
|
-
const result = await deps.instanceManager.updateProgress(
|
|
83
|
-
input.instanceId,
|
|
84
|
-
input.step,
|
|
85
|
-
input.total,
|
|
86
|
-
input.message,
|
|
87
|
-
Boolean(input.indeterminate),
|
|
88
|
-
);
|
|
89
|
-
if (!result.ok) {
|
|
90
|
-
return {
|
|
91
|
-
ok: false as const,
|
|
92
|
-
error: result.error || "progress_failed",
|
|
93
|
-
instanceId: input.instanceId,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
ok: true as const,
|
|
98
|
-
instanceId: input.instanceId,
|
|
99
|
-
progress: result.progress,
|
|
100
|
-
};
|
|
101
|
-
} catch (err: unknown) {
|
|
102
|
-
deps.logger.warn(
|
|
103
|
-
`bizar: report-progress(${input.instanceId}) threw: ${
|
|
104
|
-
err instanceof Error ? err.message : String(err)
|
|
105
|
-
}`,
|
|
106
|
-
);
|
|
107
|
-
return {
|
|
108
|
-
ok: false as const,
|
|
109
|
-
error: `report-progress threw: ${err instanceof Error ? err.message : String(err)}`,
|
|
110
|
-
instanceId: input.instanceId,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* plugins/bizar/src/tools/bg-resume.ts
|
|
3
|
-
*
|
|
4
|
-
* v5.x — `bizar_resume` tool. Sends SIGCONT to a paused background
|
|
5
|
-
* agent's subprocess. Companion to {@link ./bg-pause.ts}.
|
|
6
|
-
*
|
|
7
|
-
* Odin-only.
|
|
8
|
-
*
|
|
9
|
-
* Cline SDK port (Phase 2):
|
|
10
|
-
* - Uses `createTool` from `@cline/sdk` directly.
|
|
11
|
-
* - Adds `name: BIZAR_RESUME_TOOL_NAME`.
|
|
12
|
-
* - `inputSchema` is `z.object(...)` over the same fields as before.
|
|
13
|
-
* - Returns structured `{ ok, instanceId, status }` instead of
|
|
14
|
-
* `{ output: JSON.stringify(...) }`.
|
|
15
|
-
* - `ctx.agent` becomes `context.metadata.parentAgent` look-up.
|
|
16
|
-
*/
|
|
17
|
-
import { createTool, type AgentTool } from "@cline/sdk";
|
|
18
|
-
import { z } from "zod";
|
|
19
|
-
|
|
20
|
-
import type { InstanceManager } from "../background.js";
|
|
21
|
-
import type { Logger } from "../logger.js";
|
|
22
|
-
|
|
23
|
-
export const BIZAR_RESUME_TOOL_NAME = "bizar_resume";
|
|
24
|
-
|
|
25
|
-
export interface BgResumeDeps {
|
|
26
|
-
instanceManager: InstanceManager;
|
|
27
|
-
logger: Logger;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type BizarResumeInput = z.infer<typeof bizarResumeSchema>;
|
|
31
|
-
export type BizarResumeOutput =
|
|
32
|
-
| { ok: true; instanceId: string; status: string }
|
|
33
|
-
| { ok: false; error: string; instanceId?: string };
|
|
34
|
-
|
|
35
|
-
const bizarResumeSchema = z.object({
|
|
36
|
-
instanceId: z
|
|
37
|
-
.string()
|
|
38
|
-
.min(1)
|
|
39
|
-
.describe("Instance id returned by bizar_spawn_background."),
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Build the `bizar_resume` tool. The plugin wires the result into
|
|
44
|
-
* `api.registerTool()` from `AgentExtensionApi`. The `deps` closure
|
|
45
|
-
* carries the InstanceManager.
|
|
46
|
-
*/
|
|
47
|
-
export function createBgResumeTool(
|
|
48
|
-
deps: BgResumeDeps,
|
|
49
|
-
): AgentTool<BizarResumeInput, BizarResumeOutput> {
|
|
50
|
-
return createTool({
|
|
51
|
-
name: BIZAR_RESUME_TOOL_NAME,
|
|
52
|
-
description:
|
|
53
|
-
"Resume a paused background agent by sending SIGCONT to its subprocess. " +
|
|
54
|
-
"Only Odin may resume. No-op on already-running instances. POSIX only.",
|
|
55
|
-
inputSchema: bizarResumeSchema.shape,
|
|
56
|
-
execute: async (input, context) => {
|
|
57
|
-
const parentAgent =
|
|
58
|
-
(context.metadata as { parentAgent?: string } | undefined)?.parentAgent ?? null;
|
|
59
|
-
if (parentAgent !== "odin") {
|
|
60
|
-
return {
|
|
61
|
-
ok: false as const,
|
|
62
|
-
error:
|
|
63
|
-
"Only Odin can resume background agents. Use bizar_status to inspect or ask Odin to resume.",
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
try {
|
|
67
|
-
const result = await deps.instanceManager.resume(input.instanceId);
|
|
68
|
-
if (!result.ok) {
|
|
69
|
-
return {
|
|
70
|
-
ok: false as const,
|
|
71
|
-
error: result.error || "resume failed",
|
|
72
|
-
instanceId: input.instanceId,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
ok: true as const,
|
|
77
|
-
instanceId: input.instanceId,
|
|
78
|
-
status: "running",
|
|
79
|
-
};
|
|
80
|
-
} catch (err: unknown) {
|
|
81
|
-
deps.logger.warn(
|
|
82
|
-
`bizar: resume(${input.instanceId}) threw: ${
|
|
83
|
-
err instanceof Error ? err.message : String(err)
|
|
84
|
-
}`,
|
|
85
|
-
);
|
|
86
|
-
return {
|
|
87
|
-
ok: false as const,
|
|
88
|
-
error: `resume threw: ${err instanceof Error ? err.message : String(err)}`,
|
|
89
|
-
instanceId: input.instanceId,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
}
|