pi-harness-runtime 1.1.0 → 1.1.2
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/.pi/plugins/herdr-clipboard/herdr-plugin.toml +22 -0
- package/.pi/plugins/herdr-clipboard/start-bridge.sh +29 -0
- package/.pi/plugins/herdr-clipboard/tmux-watch.sh +39 -0
- package/CHANGELOG.md +175 -13
- package/README.md +87 -1
- package/config.toml.example +35 -0
- package/harness/autonomous-review.ts +5 -2
- package/harness/e2e/chatgpt-quota-scraper.ts +478 -0
- package/harness/e2e/glm-quota-scraper.ts +449 -0
- package/harness/herdr-agents.ts +6 -2
- package/harness/loop-code-agent.ts +4 -1
- package/harness/loop-review-agent.ts +5 -6
- package/harness/notification-events.ts +2 -2
- package/harness/task-graph.d.ts +51 -0
- package/index.ts +147 -2
- package/package.json +17 -16
- package/packages/a2a-adapter/dist/index.d.ts +1 -0
- package/packages/a2a-adapter/dist/index.d.ts.map +1 -1
- package/packages/a2a-adapter/dist/index.js +1 -0
- package/packages/a2a-adapter/dist/index.js.map +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/a2a-adapter/src/discovery.ts +106 -0
- package/packages/a2a-adapter/src/index.ts +8 -0
- package/packages/architecture-generator/package.json +21 -0
- package/packages/architecture-generator/src/adr.ts +51 -0
- package/packages/architecture-generator/src/index.ts +9 -0
- package/packages/architecture-generator/src/mermaid.ts +76 -0
- package/packages/architecture-generator/src/types.ts +30 -0
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +2 -2
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard/src/copy-sync.ts +52 -3
- package/packages/clipboard/src/index.ts +1 -0
- package/packages/clipboard/src/paste-bridge.ts +86 -0
- package/packages/clipboard-plugin/package.json +17 -0
- package/packages/clipboard-plugin/src/index.ts +74 -0
- package/packages/clipboard-plugin/src/types.ts +30 -0
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +2 -2
- package/packages/config-capture/package.json +23 -0
- package/packages/config-capture/src/index.ts +357 -0
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-bus/src/herdr-bus.ts +4 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/package.json +17 -0
- package/packages/file-copy-helper/src/extension.debug.ts +226 -0
- package/packages/file-copy-helper/src/extension.ts +226 -0
- package/packages/file-copy-helper/src/index.ts +1 -0
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/knowledge-graph/package.json +24 -0
- package/packages/knowledge-graph/src/graph-extractor.ts +338 -0
- package/packages/knowledge-graph/src/index.ts +27 -0
- package/packages/knowledge-graph/src/mcp-client.ts +237 -0
- package/packages/knowledge-graph/src/provenance-linker.ts +101 -0
- package/packages/knowledge-graph/src/types.ts +86 -0
- package/packages/knowledge-retrieval/package.json +25 -0
- package/packages/knowledge-retrieval/src/index.ts +18 -0
- package/packages/knowledge-retrieval/src/mcp-client.ts +212 -0
- package/packages/knowledge-retrieval/src/types.ts +112 -0
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +21 -0
- package/packages/milestone-manager/src/engine.ts +105 -0
- package/packages/milestone-manager/src/index.ts +6 -0
- package/packages/milestone-manager/src/types.ts +28 -0
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/notification/src/adapters/line-adapter.ts +119 -0
- package/packages/notification/src/index.ts +1 -0
- package/packages/notification/src/notification-center.ts +6 -0
- package/packages/notification/src/types.ts +7 -2
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/package.json +12 -0
- package/packages/okf-indexer/src/cli.ts +25 -0
- package/packages/okf-indexer/src/indexer.ts +186 -0
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +24 -0
- package/packages/project-bootstrap/src/bootstrap.ts +166 -0
- package/packages/project-bootstrap/src/frappe.ts +97 -0
- package/packages/project-bootstrap/src/index.ts +27 -0
- package/packages/project-bootstrap/src/minimal.ts +45 -0
- package/packages/project-bootstrap/src/types.ts +66 -0
- package/packages/project-bootstrap/src/typescript.ts +114 -0
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/dist/src/types.js +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/providers/src/adapters.ts +1 -1
- package/packages/providers/src/deepagents-adapter.ts +2 -2
- package/packages/quota-manager/package.json +1 -1
- package/packages/quota-manager/src/quota-manager.ts +1 -4
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/runtime/src/runtime-api.ts +16 -16
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/dist/manager.d.ts.map +1 -1
- package/packages/session/dist/manager.js +3 -1
- package/packages/session/dist/manager.js.map +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session/src/manager.ts +4 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/tencentdb-memory/package.json +23 -0
- package/packages/tencentdb-memory/src/client.ts +130 -0
- package/packages/tencentdb-memory/src/index.ts +32 -0
- package/packages/tencentdb-memory/src/loader.ts +150 -0
- package/packages/tencentdb-memory/src/mcp-tools.ts +213 -0
- package/packages/tencentdb-memory/src/types.ts +101 -0
- package/packages/tencentdb-sync/package.json +26 -0
- package/packages/tencentdb-sync/src/cli.ts +363 -0
- package/packages/tencentdb-sync/src/client.ts +268 -0
- package/packages/tencentdb-sync/src/config.ts +139 -0
- package/packages/tencentdb-sync/src/index.ts +15 -0
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/todo-bd-sync/src/detector.ts +25 -4
- package/packages/todo-bd-sync/src/extension.ts +8 -86
- package/packages/todo-bd-sync/src/task-analyzer.ts +314 -0
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/types/src/agent-worker-types.d.ts +206 -0
- package/packages/types/src/ai-providers.d.ts +36 -0
- package/packages/types/src/runtime-types.d.ts +6 -0
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/worktree/src/worktree.ts +1 -4
- package/packages/write-review/package.json +22 -0
- package/packages/write-review/src/blackboard.ts +249 -0
- package/packages/write-review/src/gate.ts +169 -0
- package/packages/write-review/src/index.ts +65 -0
- package/packages/write-review/src/injection.ts +190 -0
- package/packages/write-review/src/review.ts +206 -0
- package/packages/write-review/src/trigger.ts +133 -0
- package/packages/write-review/src/types.ts +90 -0
- package/prompts/agents/reviewer.md +57 -0
- package/prompts/agents/writer.md +42 -0
- package/prompts/slash-commands.md +40 -0
- package/prompts/tencentdb-connect.md +35 -0
- package/prompts/tencentdb-setup.md +101 -0
- package/prompts/tencentdb.md +88 -0
- package/prompts/write-review.md +50 -0
- package/scripts/check-version-sync.ts +80 -0
- package/scripts/convert-skills-to-okf.ts +168 -0
- package/scripts/copy-plugins.js +56 -0
- package/scripts/gist-auth.ts +64 -0
- package/scripts/gist-poll.sh +127 -0
- package/scripts/release/actions-monitor.ts +357 -0
- package/scripts/release/adapters/base.ts +95 -0
- package/scripts/release/adapters/detector.ts +181 -0
- package/scripts/release/adapters/node-workspace.ts +230 -0
- package/scripts/release/adapters/python.ts +236 -0
- package/scripts/release/adapters/rust.ts +129 -0
- package/scripts/release/adapters/tauri.ts +298 -0
- package/scripts/release/orchestrator.ts +278 -0
- package/scripts/release-all.ts +211 -0
- package/scripts/scan-secrets.sh +68 -0
- package/scripts/skills-sync.ts +487 -0
- package/packages/a2a-adapter/tsconfig.json +0 -5
- package/packages/auth/dist/minimax-browser-auth.d.ts +0 -89
- package/packages/auth/dist/minimax-browser-auth.d.ts.map +0 -1
- package/packages/auth/dist/minimax-browser-auth.js +0 -890
- package/packages/auth/dist/minimax-browser-auth.js.map +0 -1
- package/packages/auth/dist/run-minimax-auth.d.ts +0 -19
- package/packages/auth/dist/run-minimax-auth.d.ts.map +0 -1
- package/packages/auth/dist/run-minimax-auth.js +0 -112
- package/packages/auth/dist/run-minimax-auth.js.map +0 -1
- package/packages/auth/tsconfig.json +0 -9
- package/packages/autonomous-refactor/tsconfig.json +0 -5
- package/packages/autonomous-runtime/test/inbox.test.mjs +0 -266
- package/packages/autonomous-runtime/tsconfig.json +0 -22
- package/packages/autonomous-runtime/tsconfig.tsbuildinfo +0 -1
- package/packages/cache-strategy/tsconfig.json +0 -5
- package/packages/capability-registry/src/types.d.ts.map +0 -1
- package/packages/capability-registry/src/types.js +0 -10
- package/packages/capability-registry/src/types.js.map +0 -1
- package/packages/capability-registry/tsconfig.json +0 -22
- package/packages/checkpoint/tsconfig.json +0 -33
- package/packages/checkpoint/tsconfig.tsbuildinfo +0 -1
- package/packages/cli-plugin-sdk/tsconfig.json +0 -11
- package/packages/clipboard/dist/src/clipboard.d.ts +0 -11
- package/packages/clipboard/dist/src/clipboard.d.ts.map +0 -1
- package/packages/clipboard/dist/src/clipboard.js +0 -51
- package/packages/clipboard/dist/src/clipboard.js.map +0 -1
- package/packages/clipboard/dist/src/copy-sync.d.ts +0 -27
- package/packages/clipboard/dist/src/copy-sync.d.ts.map +0 -1
- package/packages/clipboard/dist/src/copy-sync.js +0 -170
- package/packages/clipboard/dist/src/copy-sync.js.map +0 -1
- package/packages/clipboard/dist/src/gist-relay.d.ts +0 -48
- package/packages/clipboard/dist/src/gist-relay.d.ts.map +0 -1
- package/packages/clipboard/dist/src/gist-relay.js +0 -186
- package/packages/clipboard/dist/src/gist-relay.js.map +0 -1
- package/packages/clipboard/dist/src/github-login.d.ts +0 -16
- package/packages/clipboard/dist/src/github-login.d.ts.map +0 -1
- package/packages/clipboard/dist/src/github-login.js +0 -69
- package/packages/clipboard/dist/src/github-login.js.map +0 -1
- package/packages/clipboard/dist/src/index.d.ts +0 -4
- package/packages/clipboard/dist/src/index.d.ts.map +0 -1
- package/packages/clipboard/dist/src/index.js +0 -3
- package/packages/clipboard/dist/src/index.js.map +0 -1
- package/packages/clipboard/dist/src/types.d.ts +0 -13
- package/packages/clipboard/dist/src/types.d.ts.map +0 -1
- package/packages/clipboard/dist/src/types.js +0 -5
- package/packages/clipboard/dist/src/types.js.map +0 -1
- package/packages/clipboard/test/mojibake.test.mjs +0 -143
- package/packages/clipboard/tsconfig.json +0 -10
- package/packages/code-generation/tsconfig.json +0 -33
- package/packages/code-generation/tsconfig.tsbuildinfo +0 -1
- package/packages/code-review/tsconfig.json +0 -33
- package/packages/code-review/tsconfig.tsbuildinfo +0 -1
- package/packages/codex-adapter/tsconfig.json +0 -5
- package/packages/context-compiler/tsconfig.json +0 -17
- package/packages/context-discovery/dist/src/discover.d.ts +0 -3
- package/packages/context-discovery/dist/src/discover.d.ts.map +0 -1
- package/packages/context-discovery/dist/src/discover.js +0 -42
- package/packages/context-discovery/dist/src/discover.js.map +0 -1
- package/packages/context-discovery/dist/src/discovery.d.ts +0 -28
- package/packages/context-discovery/dist/src/discovery.d.ts.map +0 -1
- package/packages/context-discovery/dist/src/discovery.js +0 -21
- package/packages/context-discovery/dist/src/discovery.js.map +0 -1
- package/packages/context-discovery/dist/src/index.d.ts +0 -3
- package/packages/context-discovery/dist/src/index.d.ts.map +0 -1
- package/packages/context-discovery/dist/src/index.js +0 -2
- package/packages/context-discovery/dist/src/index.js.map +0 -1
- package/packages/context-discovery/dist/src/types.d.ts +0 -16
- package/packages/context-discovery/dist/src/types.d.ts.map +0 -1
- package/packages/context-discovery/dist/src/types.js +0 -2
- package/packages/context-discovery/dist/src/types.js.map +0 -1
- package/packages/context-discovery/tsconfig.json +0 -10
- package/packages/context-manager/tsconfig.json +0 -6
- package/packages/cookie-sanitizer/tsconfig.json +0 -8
- package/packages/cost-optimizer/tsconfig.json +0 -22
- package/packages/dependency-analyzer/dist/src/analyzer.d.ts +0 -17
- package/packages/dependency-analyzer/dist/src/analyzer.d.ts.map +0 -1
- package/packages/dependency-analyzer/dist/src/analyzer.js +0 -119
- package/packages/dependency-analyzer/dist/src/analyzer.js.map +0 -1
- package/packages/dependency-analyzer/dist/src/imports.d.ts +0 -12
- package/packages/dependency-analyzer/dist/src/imports.d.ts.map +0 -1
- package/packages/dependency-analyzer/dist/src/imports.js +0 -73
- package/packages/dependency-analyzer/dist/src/imports.js.map +0 -1
- package/packages/dependency-analyzer/dist/src/index.d.ts +0 -4
- package/packages/dependency-analyzer/dist/src/index.d.ts.map +0 -1
- package/packages/dependency-analyzer/dist/src/index.js +0 -3
- package/packages/dependency-analyzer/dist/src/index.js.map +0 -1
- package/packages/dependency-analyzer/dist/src/types.d.ts +0 -28
- package/packages/dependency-analyzer/dist/src/types.d.ts.map +0 -1
- package/packages/dependency-analyzer/dist/src/types.js +0 -5
- package/packages/dependency-analyzer/dist/src/types.js.map +0 -1
- package/packages/dependency-analyzer/test/analyzer.test.js +0 -37
- package/packages/dependency-analyzer/tsconfig.json +0 -10
- package/packages/django-plugin/tsconfig.json +0 -12
- package/packages/doc-generator/tsconfig.json +0 -6
- package/packages/evaluation-engine/tsconfig.json +0 -8
- package/packages/evaluation-runner/tsconfig.json +0 -5
- package/packages/event-bus/dist/src/bus.d.ts +0 -15
- package/packages/event-bus/dist/src/bus.d.ts.map +0 -1
- package/packages/event-bus/dist/src/bus.js +0 -98
- package/packages/event-bus/dist/src/bus.js.map +0 -1
- package/packages/event-bus/dist/src/herdr-bus.d.ts +0 -121
- package/packages/event-bus/dist/src/herdr-bus.d.ts.map +0 -1
- package/packages/event-bus/dist/src/herdr-bus.js +0 -322
- package/packages/event-bus/dist/src/herdr-bus.js.map +0 -1
- package/packages/event-bus/dist/src/index.d.ts +0 -6
- package/packages/event-bus/dist/src/index.d.ts.map +0 -1
- package/packages/event-bus/dist/src/index.js +0 -4
- package/packages/event-bus/dist/src/index.js.map +0 -1
- package/packages/event-bus/dist/src/types.d.ts +0 -27
- package/packages/event-bus/dist/src/types.d.ts.map +0 -1
- package/packages/event-bus/dist/src/types.js +0 -10
- package/packages/event-bus/dist/src/types.js.map +0 -1
- package/packages/event-bus/tsconfig.json +0 -10
- package/packages/event-store/dist/src/index.d.ts +0 -3
- package/packages/event-store/dist/src/index.d.ts.map +0 -1
- package/packages/event-store/dist/src/index.js +0 -2
- package/packages/event-store/dist/src/index.js.map +0 -1
- package/packages/event-store/dist/src/store.d.ts +0 -15
- package/packages/event-store/dist/src/store.d.ts.map +0 -1
- package/packages/event-store/dist/src/store.js +0 -139
- package/packages/event-store/dist/src/store.js.map +0 -1
- package/packages/event-store/dist/src/types.d.ts +0 -48
- package/packages/event-store/dist/src/types.d.ts.map +0 -1
- package/packages/event-store/dist/src/types.js +0 -5
- package/packages/event-store/dist/src/types.js.map +0 -1
- package/packages/event-store/src/types.d.ts.map +0 -1
- package/packages/event-store/src/types.js +0 -5
- package/packages/event-store/src/types.js.map +0 -1
- package/packages/event-store/tsconfig.json +0 -10
- package/packages/experience-replay/tsconfig.json +0 -8
- package/packages/feedback-collector/tsconfig.json +0 -5
- package/packages/framework-detector/tsconfig.json +0 -33
- package/packages/framework-detector/tsconfig.tsbuildinfo +0 -1
- package/packages/framework-plugin-sdk/tsconfig.json +0 -33
- package/packages/framework-plugin-sdk/tsconfig.tsbuildinfo +0 -1
- package/packages/frappe-plugin/tsconfig.json +0 -12
- package/packages/generic-web-plugin/tsconfig.json +0 -12
- package/packages/health-monitor/tsconfig.json +0 -5
- package/packages/intent-analyzer/dist/src/analyzer.d.ts +0 -13
- package/packages/intent-analyzer/dist/src/analyzer.d.ts.map +0 -1
- package/packages/intent-analyzer/dist/src/analyzer.js +0 -239
- package/packages/intent-analyzer/dist/src/analyzer.js.map +0 -1
- package/packages/intent-analyzer/dist/src/index.d.ts +0 -3
- package/packages/intent-analyzer/dist/src/index.d.ts.map +0 -1
- package/packages/intent-analyzer/dist/src/index.js +0 -2
- package/packages/intent-analyzer/dist/src/index.js.map +0 -1
- package/packages/intent-analyzer/dist/src/types.d.ts +0 -26
- package/packages/intent-analyzer/dist/src/types.d.ts.map +0 -1
- package/packages/intent-analyzer/dist/src/types.js +0 -7
- package/packages/intent-analyzer/dist/src/types.js.map +0 -1
- package/packages/intent-analyzer/tsconfig.json +0 -10
- package/packages/laravel-plugin/tsconfig.json +0 -12
- package/packages/learning-engine/tsconfig.json +0 -8
- package/packages/mcp-adapter/tsconfig.json +0 -8
- package/packages/memory-engine/tsconfig.json +0 -8
- package/packages/model-registry/src/types.d.ts.map +0 -1
- package/packages/model-registry/src/types.js +0 -5
- package/packages/model-registry/src/types.js.map +0 -1
- package/packages/model-registry/tsconfig.json +0 -22
- package/packages/nextjs-plugin/tsconfig.json +0 -12
- package/packages/notification/dist/adapters/email-adapter.d.ts +0 -17
- package/packages/notification/dist/adapters/email-adapter.d.ts.map +0 -1
- package/packages/notification/dist/adapters/email-adapter.js +0 -89
- package/packages/notification/dist/adapters/email-adapter.js.map +0 -1
- package/packages/notification/dist/adapters/ntfy-adapter.d.ts +0 -17
- package/packages/notification/dist/adapters/ntfy-adapter.d.ts.map +0 -1
- package/packages/notification/dist/adapters/ntfy-adapter.js +0 -84
- package/packages/notification/dist/adapters/ntfy-adapter.js.map +0 -1
- package/packages/notification/dist/adapters/telegram-adapter.d.ts +0 -17
- package/packages/notification/dist/adapters/telegram-adapter.d.ts.map +0 -1
- package/packages/notification/dist/adapters/telegram-adapter.js +0 -88
- package/packages/notification/dist/adapters/telegram-adapter.js.map +0 -1
- package/packages/notification/dist/adapters/webhook-adapter.d.ts +0 -15
- package/packages/notification/dist/adapters/webhook-adapter.d.ts.map +0 -1
- package/packages/notification/dist/adapters/webhook-adapter.js +0 -64
- package/packages/notification/dist/adapters/webhook-adapter.js.map +0 -1
- package/packages/notification/dist/base-adapter.d.ts +0 -36
- package/packages/notification/dist/base-adapter.d.ts.map +0 -1
- package/packages/notification/dist/base-adapter.js +0 -39
- package/packages/notification/dist/base-adapter.js.map +0 -1
- package/packages/notification/dist/index.d.ts +0 -9
- package/packages/notification/dist/index.d.ts.map +0 -1
- package/packages/notification/dist/index.js +0 -9
- package/packages/notification/dist/index.js.map +0 -1
- package/packages/notification/dist/notification-center.d.ts +0 -46
- package/packages/notification/dist/notification-center.d.ts.map +0 -1
- package/packages/notification/dist/notification-center.js +0 -228
- package/packages/notification/dist/notification-center.js.map +0 -1
- package/packages/notification/dist/types.d.ts +0 -65
- package/packages/notification/dist/types.d.ts.map +0 -1
- package/packages/notification/dist/types.js +0 -7
- package/packages/notification/dist/types.js.map +0 -1
- package/packages/notification/tsconfig.json +0 -8
- package/packages/observability/tsconfig.json +0 -33
- package/packages/observability/tsconfig.tsbuildinfo +0 -1
- package/packages/performance-optimizer/tsconfig.json +0 -8
- package/packages/privilege-broker/config/privileges.yaml.example +0 -172
- package/packages/privilege-broker/tsconfig.json +0 -22
- package/packages/privilege-broker/tsconfig.tsbuildinfo +0 -1
- package/packages/project-analyzer/tsconfig.json +0 -33
- package/packages/project-analyzer/tsconfig.tsbuildinfo +0 -1
- package/packages/projection-engine/dist/src/engine.d.ts +0 -61
- package/packages/projection-engine/dist/src/engine.d.ts.map +0 -1
- package/packages/projection-engine/dist/src/engine.js +0 -87
- package/packages/projection-engine/dist/src/engine.js.map +0 -1
- package/packages/projection-engine/dist/src/index.d.ts +0 -2
- package/packages/projection-engine/dist/src/index.d.ts.map +0 -1
- package/packages/projection-engine/dist/src/index.js +0 -2
- package/packages/projection-engine/dist/src/index.js.map +0 -1
- package/packages/projection-engine/dist/src/project.d.ts +0 -3
- package/packages/projection-engine/dist/src/project.d.ts.map +0 -1
- package/packages/projection-engine/dist/src/project.js +0 -24
- package/packages/projection-engine/dist/src/project.js.map +0 -1
- package/packages/projection-engine/dist/src/types.d.ts +0 -55
- package/packages/projection-engine/dist/src/types.d.ts.map +0 -1
- package/packages/projection-engine/dist/src/types.js +0 -5
- package/packages/projection-engine/dist/src/types.js.map +0 -1
- package/packages/projection-engine/src/types.d.ts.map +0 -1
- package/packages/projection-engine/src/types.js +0 -5
- package/packages/projection-engine/src/types.js.map +0 -1
- package/packages/projection-engine/tsconfig.json +0 -10
- package/packages/prompt-compiler/tsconfig.json +0 -19
- package/packages/prompt-versioning/tsconfig.json +0 -5
- package/packages/provider-adapter-sdk/dist/tsconfig.tsbuildinfo +0 -1
- package/packages/provider-adapter-sdk/tsconfig.json +0 -34
- package/packages/provider-adapter-sdk/tsconfig.tsbuildinfo +0 -1
- package/packages/provider-router/tsconfig.json +0 -20
- package/packages/provider-selector/tsconfig.json +0 -6
- package/packages/providers/dist/adapters.d.ts +0 -133
- package/packages/providers/dist/adapters.d.ts.map +0 -1
- package/packages/providers/dist/adapters.js +0 -236
- package/packages/providers/dist/adapters.js.map +0 -1
- package/packages/providers/dist/deepagents-adapter.d.ts +0 -78
- package/packages/providers/dist/deepagents-adapter.d.ts.map +0 -1
- package/packages/providers/dist/deepagents-adapter.js +0 -323
- package/packages/providers/dist/deepagents-adapter.js.map +0 -1
- package/packages/providers/dist/glm-usage.d.ts +0 -102
- package/packages/providers/dist/glm-usage.d.ts.map +0 -1
- package/packages/providers/dist/glm-usage.js +0 -197
- package/packages/providers/dist/glm-usage.js.map +0 -1
- package/packages/providers/dist/index.d.ts +0 -11
- package/packages/providers/dist/index.d.ts.map +0 -1
- package/packages/providers/dist/index.js +0 -11
- package/packages/providers/dist/index.js.map +0 -1
- package/packages/providers/dist/openai-usage.d.ts +0 -103
- package/packages/providers/dist/openai-usage.d.ts.map +0 -1
- package/packages/providers/dist/openai-usage.js +0 -208
- package/packages/providers/dist/openai-usage.js.map +0 -1
- package/packages/providers/dist/provider-id.d.ts +0 -46
- package/packages/providers/dist/provider-id.d.ts.map +0 -1
- package/packages/providers/dist/provider-id.js +0 -113
- package/packages/providers/dist/provider-id.js.map +0 -1
- package/packages/providers/tsconfig.json +0 -8
- package/packages/quota-manager/dist/examples/tui-usage-integration.d.ts +0 -35
- package/packages/quota-manager/dist/examples/tui-usage-integration.d.ts.map +0 -1
- package/packages/quota-manager/dist/examples/tui-usage-integration.js +0 -73
- package/packages/quota-manager/dist/examples/tui-usage-integration.js.map +0 -1
- package/packages/quota-manager/dist/index.d.ts +0 -8
- package/packages/quota-manager/dist/index.d.ts.map +0 -1
- package/packages/quota-manager/dist/index.js +0 -8
- package/packages/quota-manager/dist/index.js.map +0 -1
- package/packages/quota-manager/dist/quota-manager.d.ts +0 -70
- package/packages/quota-manager/dist/quota-manager.d.ts.map +0 -1
- package/packages/quota-manager/dist/quota-manager.js +0 -260
- package/packages/quota-manager/dist/quota-manager.js.map +0 -1
- package/packages/quota-manager/dist/tui-usage-monitor.d.ts +0 -96
- package/packages/quota-manager/dist/tui-usage-monitor.d.ts.map +0 -1
- package/packages/quota-manager/dist/tui-usage-monitor.js +0 -268
- package/packages/quota-manager/dist/tui-usage-monitor.js.map +0 -1
- package/packages/quota-manager/tsconfig.json +0 -8
- package/packages/rate-limiter/tsconfig.json +0 -5
- package/packages/react-vite-plugin/tsconfig.json +0 -12
- package/packages/release-manager/tsconfig.json +0 -5
- package/packages/requirement-compiler/tsconfig.json +0 -22
- package/packages/runtime/dist/command-executor.d.ts +0 -129
- package/packages/runtime/dist/command-executor.d.ts.map +0 -1
- package/packages/runtime/dist/command-executor.js +0 -383
- package/packages/runtime/dist/command-executor.js.map +0 -1
- package/packages/runtime/dist/index.d.ts +0 -11
- package/packages/runtime/dist/index.d.ts.map +0 -1
- package/packages/runtime/dist/index.js +0 -11
- package/packages/runtime/dist/index.js.map +0 -1
- package/packages/runtime/dist/local-runtime-agent.d.ts +0 -111
- package/packages/runtime/dist/local-runtime-agent.d.ts.map +0 -1
- package/packages/runtime/dist/local-runtime-agent.js +0 -356
- package/packages/runtime/dist/local-runtime-agent.js.map +0 -1
- package/packages/runtime/dist/policy-engine.d.ts +0 -203
- package/packages/runtime/dist/policy-engine.d.ts.map +0 -1
- package/packages/runtime/dist/policy-engine.js +0 -592
- package/packages/runtime/dist/policy-engine.js.map +0 -1
- package/packages/runtime/dist/runtime-api.d.ts +0 -137
- package/packages/runtime/dist/runtime-api.d.ts.map +0 -1
- package/packages/runtime/dist/runtime-api.js +0 -454
- package/packages/runtime/dist/runtime-api.js.map +0 -1
- package/packages/runtime/dist/workspace-manager.d.ts +0 -162
- package/packages/runtime/dist/workspace-manager.d.ts.map +0 -1
- package/packages/runtime/dist/workspace-manager.js +0 -451
- package/packages/runtime/dist/workspace-manager.js.map +0 -1
- package/packages/runtime/tsconfig.json +0 -8
- package/packages/scheduler-adapter/tsconfig.json +0 -22
- package/packages/scheduler-adapter/tsconfig.tsbuildinfo +0 -1
- package/packages/session/tsconfig.json +0 -33
- package/packages/session/tsconfig.tsbuildinfo +0 -1
- package/packages/session-api/dist/src/api.d.ts +0 -83
- package/packages/session-api/dist/src/api.d.ts.map +0 -1
- package/packages/session-api/dist/src/api.js +0 -49
- package/packages/session-api/dist/src/api.js.map +0 -1
- package/packages/session-api/dist/src/index.d.ts +0 -2
- package/packages/session-api/dist/src/index.d.ts.map +0 -1
- package/packages/session-api/dist/src/index.js +0 -2
- package/packages/session-api/dist/src/index.js.map +0 -1
- package/packages/session-api/dist/src/types.d.ts +0 -22
- package/packages/session-api/dist/src/types.d.ts.map +0 -1
- package/packages/session-api/dist/src/types.js +0 -5
- package/packages/session-api/dist/src/types.js.map +0 -1
- package/packages/session-api/tsconfig.json +0 -10
- package/packages/session-export/dist/src/exporter.d.ts +0 -28
- package/packages/session-export/dist/src/exporter.d.ts.map +0 -1
- package/packages/session-export/dist/src/exporter.js +0 -42
- package/packages/session-export/dist/src/exporter.js.map +0 -1
- package/packages/session-export/dist/src/index.d.ts +0 -2
- package/packages/session-export/dist/src/index.d.ts.map +0 -1
- package/packages/session-export/dist/src/index.js +0 -2
- package/packages/session-export/dist/src/index.js.map +0 -1
- package/packages/session-export/dist/src/types.d.ts +0 -20
- package/packages/session-export/dist/src/types.d.ts.map +0 -1
- package/packages/session-export/dist/src/types.js +0 -5
- package/packages/session-export/dist/src/types.js.map +0 -1
- package/packages/session-export/tsconfig.json +0 -10
- package/packages/skill-registry/tsconfig.json +0 -22
- package/packages/sprint-planner/tsconfig.json +0 -5
- package/packages/subscription-engine/dist/src/engine.d.ts +0 -13
- package/packages/subscription-engine/dist/src/engine.d.ts.map +0 -1
- package/packages/subscription-engine/dist/src/engine.js +0 -40
- package/packages/subscription-engine/dist/src/engine.js.map +0 -1
- package/packages/subscription-engine/dist/src/index.d.ts +0 -2
- package/packages/subscription-engine/dist/src/index.d.ts.map +0 -1
- package/packages/subscription-engine/dist/src/index.js +0 -2
- package/packages/subscription-engine/dist/src/index.js.map +0 -1
- package/packages/subscription-engine/dist/src/subscriptions.d.ts +0 -19
- package/packages/subscription-engine/dist/src/subscriptions.d.ts.map +0 -1
- package/packages/subscription-engine/dist/src/subscriptions.js +0 -39
- package/packages/subscription-engine/dist/src/subscriptions.js.map +0 -1
- package/packages/subscription-engine/dist/src/types.d.ts +0 -24
- package/packages/subscription-engine/dist/src/types.d.ts.map +0 -1
- package/packages/subscription-engine/dist/src/types.js +0 -5
- package/packages/subscription-engine/dist/src/types.js.map +0 -1
- package/packages/subscription-engine/tsconfig.json +0 -10
- package/packages/task-compiler/tsconfig.json +0 -24
- package/packages/test-data-generator/tsconfig.json +0 -33
- package/packages/test-data-generator/tsconfig.tsbuildinfo +0 -1
- package/packages/test-generator/tsconfig.json +0 -6
- package/packages/token-optimizer/tsconfig.json +0 -6
- package/packages/tui/tsconfig.json +0 -8
- package/packages/types/src/runtime-types.d.ts.map +0 -1
- package/packages/types/src/runtime-types.js +0 -2
- package/packages/types/src/runtime-types.js.map +0 -1
- package/packages/types/tsconfig.json +0 -21
- package/packages/types/tsconfig.tsbuildinfo +0 -1
- package/packages/workflow-events/dist/src/events.d.ts +0 -38
- package/packages/workflow-events/dist/src/events.d.ts.map +0 -1
- package/packages/workflow-events/dist/src/events.js +0 -55
- package/packages/workflow-events/dist/src/events.js.map +0 -1
- package/packages/workflow-events/dist/src/index.d.ts +0 -2
- package/packages/workflow-events/dist/src/index.d.ts.map +0 -1
- package/packages/workflow-events/dist/src/index.js +0 -2
- package/packages/workflow-events/dist/src/index.js.map +0 -1
- package/packages/workflow-events/dist/src/pipeline.d.ts +0 -21
- package/packages/workflow-events/dist/src/pipeline.d.ts.map +0 -1
- package/packages/workflow-events/dist/src/pipeline.js +0 -36
- package/packages/workflow-events/dist/src/pipeline.js.map +0 -1
- package/packages/workflow-events/dist/src/types.d.ts +0 -110
- package/packages/workflow-events/dist/src/types.d.ts.map +0 -1
- package/packages/workflow-events/dist/src/types.js +0 -5
- package/packages/workflow-events/dist/src/types.js.map +0 -1
- package/packages/workflow-events/src/types.d.ts.map +0 -1
- package/packages/workflow-events/src/types.js +0 -5
- package/packages/workflow-events/src/types.js.map +0 -1
- package/packages/workflow-events/tsconfig.json +0 -10
- package/packages/workspace-scanner/dist/src/detect.d.ts +0 -3
- package/packages/workspace-scanner/dist/src/detect.d.ts.map +0 -1
- package/packages/workspace-scanner/dist/src/detect.js +0 -60
- package/packages/workspace-scanner/dist/src/detect.js.map +0 -1
- package/packages/workspace-scanner/dist/src/git.d.ts +0 -7
- package/packages/workspace-scanner/dist/src/git.d.ts.map +0 -1
- package/packages/workspace-scanner/dist/src/git.js +0 -75
- package/packages/workspace-scanner/dist/src/git.js.map +0 -1
- package/packages/workspace-scanner/dist/src/index.d.ts +0 -5
- package/packages/workspace-scanner/dist/src/index.d.ts.map +0 -1
- package/packages/workspace-scanner/dist/src/index.js +0 -4
- package/packages/workspace-scanner/dist/src/index.js.map +0 -1
- package/packages/workspace-scanner/dist/src/scanner.d.ts +0 -11
- package/packages/workspace-scanner/dist/src/scanner.d.ts.map +0 -1
- package/packages/workspace-scanner/dist/src/scanner.js +0 -59
- package/packages/workspace-scanner/dist/src/scanner.js.map +0 -1
- package/packages/workspace-scanner/dist/src/types.d.ts +0 -35
- package/packages/workspace-scanner/dist/src/types.d.ts.map +0 -1
- package/packages/workspace-scanner/dist/src/types.js +0 -5
- package/packages/workspace-scanner/dist/src/types.js.map +0 -1
- package/packages/workspace-scanner/test/scanner.test.js +0 -31
- package/packages/workspace-scanner/tsconfig.json +0 -10
- package/packages/worktree/dist/index.d.ts +0 -7
- package/packages/worktree/dist/index.d.ts.map +0 -1
- package/packages/worktree/dist/index.js +0 -7
- package/packages/worktree/dist/index.js.map +0 -1
- package/packages/worktree/dist/worktree.d.ts +0 -88
- package/packages/worktree/dist/worktree.d.ts.map +0 -1
- package/packages/worktree/dist/worktree.js +0 -242
- package/packages/worktree/dist/worktree.js.map +0 -1
- package/packages/worktree/tsconfig.json +0 -8
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write-Review Blackboard
|
|
3
|
+
*
|
|
4
|
+
* File-based coordination between writer and reviewer agents.
|
|
5
|
+
* Location: {project}/.write-review/status.json
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
9
|
+
import { join } from "path";
|
|
10
|
+
import type { WriteReviewStatus, ReviewPhase, Verdict } from "./types.js";
|
|
11
|
+
|
|
12
|
+
const DEFAULT_DIR = ".write-review";
|
|
13
|
+
const STATUS_FILE = "status.json";
|
|
14
|
+
|
|
15
|
+
export class WriteReviewBlackboard {
|
|
16
|
+
private readonly projectPath: string;
|
|
17
|
+
private readonly dir: string;
|
|
18
|
+
private status: WriteReviewStatus | null = null;
|
|
19
|
+
|
|
20
|
+
constructor(projectPath: string, dir: string = DEFAULT_DIR) {
|
|
21
|
+
this.projectPath = projectPath;
|
|
22
|
+
this.dir = join(projectPath, dir);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Initialize a new write-review session
|
|
27
|
+
*/
|
|
28
|
+
init(): void {
|
|
29
|
+
mkdirSync(this.dir, { recursive: true });
|
|
30
|
+
this.status = {
|
|
31
|
+
projectPath: this.projectPath,
|
|
32
|
+
phase: "idle",
|
|
33
|
+
writerDone: false,
|
|
34
|
+
iteration: 0,
|
|
35
|
+
createdAt: new Date().toISOString(),
|
|
36
|
+
updatedAt: new Date().toISOString(),
|
|
37
|
+
};
|
|
38
|
+
this.save();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Load status from disk
|
|
43
|
+
*/
|
|
44
|
+
load(): WriteReviewStatus | null {
|
|
45
|
+
const path = join(this.dir, STATUS_FILE);
|
|
46
|
+
if (!existsSync(path)) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
this.status = JSON.parse(readFileSync(path, "utf-8"));
|
|
51
|
+
return this.status;
|
|
52
|
+
} catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Save status to disk
|
|
59
|
+
*/
|
|
60
|
+
save(): void {
|
|
61
|
+
if (!this.status) return;
|
|
62
|
+
this.status.updatedAt = new Date().toISOString();
|
|
63
|
+
mkdirSync(this.dir, { recursive: true });
|
|
64
|
+
const path = join(this.dir, STATUS_FILE);
|
|
65
|
+
writeFileSync(path, JSON.stringify(this.status, null, 2));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get current status
|
|
70
|
+
*/
|
|
71
|
+
getStatus(): WriteReviewStatus | null {
|
|
72
|
+
return this.status;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Start a new write session
|
|
77
|
+
*/
|
|
78
|
+
startWriting(): void {
|
|
79
|
+
if (!this.status) this.init();
|
|
80
|
+
this.status!.phase = "writing";
|
|
81
|
+
this.status!.writerDone = false;
|
|
82
|
+
this.status!.iteration++;
|
|
83
|
+
this.save();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Mark writer as done
|
|
88
|
+
*/
|
|
89
|
+
writerDone(message?: string): void {
|
|
90
|
+
if (!this.status) return;
|
|
91
|
+
this.status.writerDone = true;
|
|
92
|
+
this.status.writerMessage = message;
|
|
93
|
+
this.status.phase = "pending_review";
|
|
94
|
+
this.save();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Start reviewing
|
|
99
|
+
*/
|
|
100
|
+
startReview(): void {
|
|
101
|
+
if (!this.status) return;
|
|
102
|
+
this.status.phase = "reviewing";
|
|
103
|
+
this.status.reviewerStarted = new Date().toISOString();
|
|
104
|
+
this.save();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Record verdict
|
|
109
|
+
*/
|
|
110
|
+
setVerdict(verdict: Verdict, message?: string): void {
|
|
111
|
+
if (!this.status) return;
|
|
112
|
+
this.status.verdict = verdict;
|
|
113
|
+
this.status.verdictMessage = message;
|
|
114
|
+
|
|
115
|
+
switch (verdict) {
|
|
116
|
+
case "approved":
|
|
117
|
+
this.status.phase = "approved";
|
|
118
|
+
this.status.approvedAt = new Date().toISOString();
|
|
119
|
+
break;
|
|
120
|
+
case "blocked":
|
|
121
|
+
this.status.phase = "blocked";
|
|
122
|
+
this.status.blockedAt = new Date().toISOString();
|
|
123
|
+
break;
|
|
124
|
+
case "changes_requested":
|
|
125
|
+
this.status.phase = "changes_requested";
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
this.save();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Record code files written
|
|
133
|
+
*/
|
|
134
|
+
setCodeFiles(files: string[]): void {
|
|
135
|
+
if (!this.status) return;
|
|
136
|
+
this.status.codeFiles = files;
|
|
137
|
+
this.save();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Record requested changes
|
|
142
|
+
*/
|
|
143
|
+
setChangesRequested(changes: string[]): void {
|
|
144
|
+
if (!this.status) return;
|
|
145
|
+
this.status.changesRequested = changes;
|
|
146
|
+
this.save();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Get current phase
|
|
151
|
+
*/
|
|
152
|
+
getPhase(): ReviewPhase {
|
|
153
|
+
return this.status?.phase ?? "idle";
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Get iteration number
|
|
158
|
+
*/
|
|
159
|
+
getIteration(): number {
|
|
160
|
+
return this.status?.iteration ?? 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Check if build is allowed
|
|
165
|
+
*/
|
|
166
|
+
canBuild(): boolean {
|
|
167
|
+
return this.status?.phase === "approved";
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Get blackboard directory path
|
|
172
|
+
*/
|
|
173
|
+
getPath(): string {
|
|
174
|
+
return this.dir;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Reset to idle
|
|
179
|
+
*/
|
|
180
|
+
reset(): void {
|
|
181
|
+
if (!this.status) return;
|
|
182
|
+
this.status.phase = "idle";
|
|
183
|
+
this.status.writerDone = false;
|
|
184
|
+
this.status.verdict = undefined;
|
|
185
|
+
this.status.verdictMessage = undefined;
|
|
186
|
+
this.status.reviewerStarted = undefined;
|
|
187
|
+
this.status.approvedAt = undefined;
|
|
188
|
+
this.status.blockedAt = undefined;
|
|
189
|
+
this.status.codeFiles = undefined;
|
|
190
|
+
this.status.changesRequested = undefined;
|
|
191
|
+
this.save();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Check if a review session exists for this project
|
|
196
|
+
*/
|
|
197
|
+
exists(): boolean {
|
|
198
|
+
const path = join(this.dir, STATUS_FILE);
|
|
199
|
+
return existsSync(path);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Export status as markdown for display
|
|
204
|
+
*/
|
|
205
|
+
toMarkdown(): string {
|
|
206
|
+
if (!this.status) return "No active write-review session.";
|
|
207
|
+
|
|
208
|
+
const { phase, iteration, verdict, verdictMessage, codeFiles } =
|
|
209
|
+
this.status;
|
|
210
|
+
const lines = [
|
|
211
|
+
`## Write-Review Status`,
|
|
212
|
+
``,
|
|
213
|
+
`| Field | Value |`,
|
|
214
|
+
`|-------|-------|`,
|
|
215
|
+
`| Phase | ${phase} |`,
|
|
216
|
+
`| Iteration | ${iteration} |`,
|
|
217
|
+
`| Verdict | ${verdict ?? "pending"} |`,
|
|
218
|
+
];
|
|
219
|
+
|
|
220
|
+
if (verdictMessage) {
|
|
221
|
+
lines.push(`| Message | ${verdictMessage} |`);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (codeFiles && codeFiles.length > 0) {
|
|
225
|
+
lines.push(``, `### Code Files`);
|
|
226
|
+
for (const file of codeFiles) {
|
|
227
|
+
lines.push(`- ${file}`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return lines.join("\n");
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Create or get blackboard for project
|
|
237
|
+
*/
|
|
238
|
+
export function createBlackboard(
|
|
239
|
+
projectPath: string,
|
|
240
|
+
dir?: string,
|
|
241
|
+
): WriteReviewBlackboard {
|
|
242
|
+
const bb = new WriteReviewBlackboard(projectPath, dir);
|
|
243
|
+
if (!bb.exists()) {
|
|
244
|
+
bb.init();
|
|
245
|
+
} else {
|
|
246
|
+
bb.load();
|
|
247
|
+
}
|
|
248
|
+
return bb;
|
|
249
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No-Build Gate
|
|
3
|
+
*
|
|
4
|
+
* Blocks build commands until review is approved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { WriteReviewBlackboard } from "./blackboard.js";
|
|
8
|
+
import type { WriteReviewStatus } from "./types.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Commands that trigger build gate
|
|
12
|
+
*/
|
|
13
|
+
const BUILD_COMMANDS = [
|
|
14
|
+
"bench build",
|
|
15
|
+
"npm run build",
|
|
16
|
+
"yarn build",
|
|
17
|
+
"pnpm build",
|
|
18
|
+
"bun run build",
|
|
19
|
+
"npm run dev",
|
|
20
|
+
"yarn dev",
|
|
21
|
+
"pnpm dev",
|
|
22
|
+
"./build",
|
|
23
|
+
"make build",
|
|
24
|
+
"gradle build",
|
|
25
|
+
"mvn package",
|
|
26
|
+
"dotnet build",
|
|
27
|
+
"cargo build",
|
|
28
|
+
"go build",
|
|
29
|
+
"python manage.py migrate",
|
|
30
|
+
"bench migrate",
|
|
31
|
+
"bench --site",
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Check if a command is a build command
|
|
36
|
+
*/
|
|
37
|
+
export function isBuildCommand(command: string): boolean {
|
|
38
|
+
const lower = command.toLowerCase().trim();
|
|
39
|
+
return BUILD_COMMANDS.some((cmd) => lower.includes(cmd.toLowerCase()));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Gate result
|
|
44
|
+
*/
|
|
45
|
+
export interface GateResult {
|
|
46
|
+
allowed: boolean;
|
|
47
|
+
reason?: string;
|
|
48
|
+
currentPhase?: string;
|
|
49
|
+
message?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Check if build is allowed
|
|
54
|
+
*/
|
|
55
|
+
export function checkBuildGate(
|
|
56
|
+
command: string,
|
|
57
|
+
blackboard: WriteReviewBlackboard,
|
|
58
|
+
): GateResult {
|
|
59
|
+
if (!isBuildCommand(command)) {
|
|
60
|
+
return { allowed: true };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const status = blackboard.load();
|
|
64
|
+
if (!status) {
|
|
65
|
+
// No review session - allow build
|
|
66
|
+
return { allowed: true };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (status.phase === "approved") {
|
|
70
|
+
return {
|
|
71
|
+
allowed: true,
|
|
72
|
+
currentPhase: status.phase,
|
|
73
|
+
message: "Build allowed - review approved.",
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
allowed: false,
|
|
79
|
+
reason: "REVIEW_NOT_APPROVED",
|
|
80
|
+
currentPhase: status.phase,
|
|
81
|
+
message: `Build blocked. Current review phase: ${status.phase}. Wait for "APPROVED" verdict.`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Format gate rejection message
|
|
87
|
+
*/
|
|
88
|
+
export function formatGateRejection(result: GateResult): string {
|
|
89
|
+
if (result.allowed) {
|
|
90
|
+
return "";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const lines = [
|
|
94
|
+
"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━",
|
|
95
|
+
"⚠️ BUILD BLOCKED",
|
|
96
|
+
"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━",
|
|
97
|
+
"",
|
|
98
|
+
`Current Phase: ${result.currentPhase}`,
|
|
99
|
+
"",
|
|
100
|
+
"The code is under review. Build is only allowed after APPROVED verdict.",
|
|
101
|
+
"",
|
|
102
|
+
"To check status:",
|
|
103
|
+
` cat {project}/.write-review/status.json`,
|
|
104
|
+
"",
|
|
105
|
+
"To wait for approval, do nothing. The reviewer will post the verdict.",
|
|
106
|
+
"",
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
if (result.currentPhase === "changes_requested") {
|
|
110
|
+
lines.push(
|
|
111
|
+
"Reviewer requested changes. Writer agent should update the code.",
|
|
112
|
+
);
|
|
113
|
+
} else if (result.currentPhase === "reviewing") {
|
|
114
|
+
lines.push("Review is in progress. Please wait...");
|
|
115
|
+
} else if (result.currentPhase === "pending_review") {
|
|
116
|
+
lines.push("Review not started yet. Waiting for reviewer...");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return lines.join("\n");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get phase emoji
|
|
124
|
+
*/
|
|
125
|
+
export function getPhaseEmoji(phase: string): string {
|
|
126
|
+
const emojis: Record<string, string> = {
|
|
127
|
+
idle: "💤",
|
|
128
|
+
writing: "✍️",
|
|
129
|
+
pending_review: "⏳",
|
|
130
|
+
reviewing: "🔍",
|
|
131
|
+
approved: "✅",
|
|
132
|
+
blocked: "🚫",
|
|
133
|
+
changes_requested: "🔄",
|
|
134
|
+
};
|
|
135
|
+
return emojis[phase] ?? "❓";
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Format status for display
|
|
140
|
+
*/
|
|
141
|
+
export function formatStatusDisplay(status: WriteReviewStatus): string {
|
|
142
|
+
const emoji = getPhaseEmoji(status.phase);
|
|
143
|
+
const lines = [
|
|
144
|
+
`${emoji} Write-Review Status`,
|
|
145
|
+
"",
|
|
146
|
+
`Phase: ${status.phase}`,
|
|
147
|
+
`Iteration: ${status.iteration}`,
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
if (status.verdict) {
|
|
151
|
+
lines.push(`Verdict: ${status.verdict}`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (status.verdictMessage) {
|
|
155
|
+
lines.push("");
|
|
156
|
+
lines.push("Message:");
|
|
157
|
+
lines.push(status.verdictMessage);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (status.codeFiles && status.codeFiles.length > 0) {
|
|
161
|
+
lines.push("");
|
|
162
|
+
lines.push("Code Files:");
|
|
163
|
+
for (const file of status.codeFiles) {
|
|
164
|
+
lines.push(` - ${file}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return lines.join("\n");
|
|
169
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* write-review - Two-agent code writing with review loop
|
|
3
|
+
*
|
|
4
|
+
* Integrates with pi-harness-runtime via:
|
|
5
|
+
* - Smart trigger detection (prompt files in wiki/)
|
|
6
|
+
* - System prompt injection for writer agent
|
|
7
|
+
* - Subagent integration for reviewer agent
|
|
8
|
+
*
|
|
9
|
+
* Directory structure: {project}/.write-review/
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { rmSync, readdirSync, statSync, existsSync } from "node:fs";
|
|
13
|
+
import { join, resolve } from "node:path";
|
|
14
|
+
|
|
15
|
+
const MAX_AGE_DAYS = 3;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Auto-cleanup old review history files older than MAX_AGE_DAYS
|
|
19
|
+
*/
|
|
20
|
+
export function cleanupOldReviews(projectPath: string): number {
|
|
21
|
+
// Resolve path to prevent traversal attacks
|
|
22
|
+
const basePath = resolve(projectPath);
|
|
23
|
+
const reviewDir = join(basePath, ".write-review");
|
|
24
|
+
|
|
25
|
+
// Ensure reviewDir is within basePath (traversal guard)
|
|
26
|
+
if (!reviewDir.startsWith(basePath + '/')) {
|
|
27
|
+
return 0; // Invalid path, skip
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!existsSync(reviewDir)) {
|
|
31
|
+
return 0; // Directory doesn't exist
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let deleted = 0;
|
|
35
|
+
const files = readdirSync(reviewDir);
|
|
36
|
+
const cutoff = Date.now() - MAX_AGE_DAYS * 24 * 60 * 60 * 1000;
|
|
37
|
+
|
|
38
|
+
for (const file of files) {
|
|
39
|
+
if (file === "status.json") continue; // Keep status file
|
|
40
|
+
// Sanitize filename to prevent path traversal
|
|
41
|
+
const sanitized = file.replace(/[^a-zA-Z0-9_.-]/g, '_');
|
|
42
|
+
if (sanitized !== file) continue; // Skip suspicious filenames
|
|
43
|
+
|
|
44
|
+
const filePath = join(reviewDir, sanitized);
|
|
45
|
+
try {
|
|
46
|
+
const stats = statSync(filePath);
|
|
47
|
+
if (stats.mtimeMs < cutoff) {
|
|
48
|
+
rmSync(filePath, { force: true });
|
|
49
|
+
deleted++;
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
// Ignore files that can't be read
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return deleted;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Re-export all public APIs
|
|
60
|
+
export * from "./types.js";
|
|
61
|
+
export * from "./blackboard.js";
|
|
62
|
+
export * from "./trigger.js";
|
|
63
|
+
export * from "./injection.js";
|
|
64
|
+
export * from "./gate.js";
|
|
65
|
+
export * from "./review.js";
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System Prompt Injection
|
|
3
|
+
*
|
|
4
|
+
* Adds write-review hints to the agent's system prompt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
import { dirname, join } from "node:path";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Find the project root (directory containing .git)
|
|
12
|
+
*/
|
|
13
|
+
function findProjectRoot(startPath: string): string {
|
|
14
|
+
let dir = startPath;
|
|
15
|
+
// Limit traversal to prevent infinite loops
|
|
16
|
+
for (let i = 0; i < 20; i++) {
|
|
17
|
+
if (existsSync(join(dir, ".git"))) {
|
|
18
|
+
return dir;
|
|
19
|
+
}
|
|
20
|
+
const parent = dirname(dir);
|
|
21
|
+
if (parent === dir) break; // Reached filesystem root
|
|
22
|
+
dir = parent;
|
|
23
|
+
}
|
|
24
|
+
return startPath; // Fallback to start path
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Write-review hint for system prompt
|
|
29
|
+
*/
|
|
30
|
+
export const WRITE_REVIEW_HINT = `
|
|
31
|
+
|
|
32
|
+
## Write-Review Loop
|
|
33
|
+
|
|
34
|
+
When reading a prompt from {project}/wiki/*:
|
|
35
|
+
|
|
36
|
+
1. You are the **WRITER** agent (Minimax). Read the wiki prompt and write code.
|
|
37
|
+
2. After writing code, write "## WRITER_DONE" to signal completion.
|
|
38
|
+
3. Do NOT build or commit until you receive "APPROVED" verdict.
|
|
39
|
+
4. If you receive "CHANGES_REQUESTED", update the code accordingly.
|
|
40
|
+
5. Acknowledge each verdict in your response.
|
|
41
|
+
|
|
42
|
+
### Blackboard Path
|
|
43
|
+
{p}/.write-review/status.json
|
|
44
|
+
|
|
45
|
+
### Verdict Types
|
|
46
|
+
- **APPROVED**: Code is ready. You may build/commit.
|
|
47
|
+
- **CHANGES_REQUESTED**: Reviewer found issues. Update code.
|
|
48
|
+
- **BLOCKED**: Critical issues. Human intervention needed.
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Helper agent hint (for worker agent)
|
|
53
|
+
*/
|
|
54
|
+
export const HELPER_HINT = `
|
|
55
|
+
|
|
56
|
+
## Helper Agent Task
|
|
57
|
+
|
|
58
|
+
The writer agent is busy or needs assistance. Your task:
|
|
59
|
+
|
|
60
|
+
1. Note any pending tasks to the Todos list using the todo tool.
|
|
61
|
+
2. Review the changes requested and prepare notes for the writer.
|
|
62
|
+
3. Do NOT write code directly - that's the writer's job.
|
|
63
|
+
4. Write a summary of pending tasks to the blackboard.
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Review reminder hint
|
|
68
|
+
*/
|
|
69
|
+
export const REVIEW_REMINDER_HINT = `
|
|
70
|
+
|
|
71
|
+
## Review Reminder
|
|
72
|
+
|
|
73
|
+
Before committing or building, ALWAYS check the write-review status:
|
|
74
|
+
|
|
75
|
+
\`\`\`bash
|
|
76
|
+
cat {project}/.write-review/status.json
|
|
77
|
+
\`\`\`
|
|
78
|
+
|
|
79
|
+
Only build/commit if the status shows "approved" or "phase": "approved".
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Format hint with project path
|
|
84
|
+
*/
|
|
85
|
+
export function formatWriteReviewHint(projectPath: string): string {
|
|
86
|
+
return WRITE_REVIEW_HINT.replace("{project}", projectPath).replace(
|
|
87
|
+
"{p}",
|
|
88
|
+
projectPath,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Format review reminder with project path
|
|
94
|
+
*/
|
|
95
|
+
export function formatReviewReminder(projectPath: string): string {
|
|
96
|
+
return REVIEW_REMINDER_HINT.replace("{project}", projectPath);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Get all hints to inject
|
|
101
|
+
*/
|
|
102
|
+
export function getWriteReviewHints(projectPath: string): {
|
|
103
|
+
writeHint: string;
|
|
104
|
+
reminderHint: string;
|
|
105
|
+
} {
|
|
106
|
+
return {
|
|
107
|
+
writeHint: formatWriteReviewHint(projectPath),
|
|
108
|
+
reminderHint: formatReviewReminder(projectPath),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Register write-review extension with pi
|
|
114
|
+
*/
|
|
115
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
116
|
+
import { createBlackboard } from "./blackboard.js";
|
|
117
|
+
|
|
118
|
+
export function injectWriterInstructions(
|
|
119
|
+
pi: ExtensionAPI,
|
|
120
|
+
config?: { debug?: boolean },
|
|
121
|
+
): void {
|
|
122
|
+
let currentProject: string | null = null;
|
|
123
|
+
let blackboard: ReturnType<typeof createBlackboard> | null = null;
|
|
124
|
+
let hintsInjected = false;
|
|
125
|
+
|
|
126
|
+
// System prompt injection
|
|
127
|
+
pi.on("before_agent_start", async (event) => {
|
|
128
|
+
const cwd = findProjectRoot(process.cwd?.() ?? "/");
|
|
129
|
+
if (cwd !== currentProject) {
|
|
130
|
+
currentProject = cwd;
|
|
131
|
+
blackboard = createBlackboard(cwd);
|
|
132
|
+
hintsInjected = false;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (!hintsInjected && blackboard) {
|
|
136
|
+
const status = blackboard.load();
|
|
137
|
+
if (status && status.phase !== "idle") {
|
|
138
|
+
event.systemPrompt += formatWriteReviewHint(cwd);
|
|
139
|
+
if (status.phase !== "approved") {
|
|
140
|
+
event.systemPrompt += formatReviewReminder(cwd);
|
|
141
|
+
}
|
|
142
|
+
hintsInjected = true;
|
|
143
|
+
if (config?.debug) {
|
|
144
|
+
console.log(
|
|
145
|
+
`[write-review] Hints injected for ${cwd}, phase: ${status.phase}`,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// Build gate
|
|
153
|
+
pi.on("tool_execution_end", async (event) => {
|
|
154
|
+
const toolName = (event as { tool?: { name?: string } }).tool?.name ?? "";
|
|
155
|
+
if (toolName !== "bash") return;
|
|
156
|
+
|
|
157
|
+
const result = event as { result?: { content?: string } };
|
|
158
|
+
const content = result.result?.content ?? "";
|
|
159
|
+
|
|
160
|
+
// Check for build commands
|
|
161
|
+
const buildCommands = [
|
|
162
|
+
"bench build",
|
|
163
|
+
"npm run build",
|
|
164
|
+
"yarn build",
|
|
165
|
+
"pnpm build",
|
|
166
|
+
"bun run build",
|
|
167
|
+
"make build",
|
|
168
|
+
"gradle build",
|
|
169
|
+
"dotnet build",
|
|
170
|
+
"cargo build",
|
|
171
|
+
];
|
|
172
|
+
const isBuild = buildCommands.some((cmd) => content.includes(cmd));
|
|
173
|
+
|
|
174
|
+
if (isBuild && blackboard) {
|
|
175
|
+
const status = blackboard.load();
|
|
176
|
+
if (status && status.phase !== "approved") {
|
|
177
|
+
result.result!.content =
|
|
178
|
+
content +
|
|
179
|
+
"\n\n" +
|
|
180
|
+
"⚠️ BUILD BLOCKED - Review not approved yet.\n" +
|
|
181
|
+
`Current phase: ${status.phase}\n` +
|
|
182
|
+
"Wait for APPROVED verdict before building.";
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
if (config?.debug) {
|
|
188
|
+
console.log("[write-review] Extension registered");
|
|
189
|
+
}
|
|
190
|
+
}
|