forge-server 0.1.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/hooks/worktree-create.sh +64 -0
- package/.claude/hooks/worktree-remove.sh +57 -0
- package/.claude/settings.local.json +29 -0
- package/.forge/knowledge/conventions.yaml +1 -0
- package/.forge/knowledge/decisions.yaml +1 -0
- package/.forge/knowledge/gotchas.yaml +1 -0
- package/.forge/knowledge/patterns.yaml +1 -0
- package/.forge/manifest.yaml +6 -0
- package/CLAUDE.md +144 -0
- package/bin/setup-forge.sh +132 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +553 -0
- package/dist/cli.js.map +1 -0
- package/dist/context/codebase.d.ts +57 -0
- package/dist/context/codebase.d.ts.map +1 -0
- package/dist/context/codebase.js +301 -0
- package/dist/context/codebase.js.map +1 -0
- package/dist/context/injector.d.ts +147 -0
- package/dist/context/injector.d.ts.map +1 -0
- package/dist/context/injector.js +533 -0
- package/dist/context/injector.js.map +1 -0
- package/dist/context/memory.d.ts +32 -0
- package/dist/context/memory.d.ts.map +1 -0
- package/dist/context/memory.js +140 -0
- package/dist/context/memory.js.map +1 -0
- package/dist/context/session-index.d.ts +54 -0
- package/dist/context/session-index.d.ts.map +1 -0
- package/dist/context/session-index.js +265 -0
- package/dist/context/session-index.js.map +1 -0
- package/dist/context/session.d.ts +42 -0
- package/dist/context/session.d.ts.map +1 -0
- package/dist/context/session.js +121 -0
- package/dist/context/session.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/ingestion/chunker.d.ts +19 -0
- package/dist/ingestion/chunker.d.ts.map +1 -0
- package/dist/ingestion/chunker.js +189 -0
- package/dist/ingestion/chunker.js.map +1 -0
- package/dist/ingestion/embedder.d.ts +45 -0
- package/dist/ingestion/embedder.d.ts.map +1 -0
- package/dist/ingestion/embedder.js +152 -0
- package/dist/ingestion/embedder.js.map +1 -0
- package/dist/ingestion/git-analyzer.d.ts +77 -0
- package/dist/ingestion/git-analyzer.d.ts.map +1 -0
- package/dist/ingestion/git-analyzer.js +437 -0
- package/dist/ingestion/git-analyzer.js.map +1 -0
- package/dist/ingestion/indexer.d.ts +79 -0
- package/dist/ingestion/indexer.d.ts.map +1 -0
- package/dist/ingestion/indexer.js +766 -0
- package/dist/ingestion/indexer.js.map +1 -0
- package/dist/ingestion/markdown-chunker.d.ts +19 -0
- package/dist/ingestion/markdown-chunker.d.ts.map +1 -0
- package/dist/ingestion/markdown-chunker.js +243 -0
- package/dist/ingestion/markdown-chunker.js.map +1 -0
- package/dist/ingestion/markdown-knowledge.d.ts +21 -0
- package/dist/ingestion/markdown-knowledge.d.ts.map +1 -0
- package/dist/ingestion/markdown-knowledge.js +129 -0
- package/dist/ingestion/markdown-knowledge.js.map +1 -0
- package/dist/ingestion/parser.d.ts +20 -0
- package/dist/ingestion/parser.d.ts.map +1 -0
- package/dist/ingestion/parser.js +429 -0
- package/dist/ingestion/parser.js.map +1 -0
- package/dist/ingestion/watcher.d.ts +28 -0
- package/dist/ingestion/watcher.d.ts.map +1 -0
- package/dist/ingestion/watcher.js +147 -0
- package/dist/ingestion/watcher.js.map +1 -0
- package/dist/knowledge/hydrator.d.ts +37 -0
- package/dist/knowledge/hydrator.d.ts.map +1 -0
- package/dist/knowledge/hydrator.js +220 -0
- package/dist/knowledge/hydrator.js.map +1 -0
- package/dist/knowledge/registry.d.ts +129 -0
- package/dist/knowledge/registry.d.ts.map +1 -0
- package/dist/knowledge/registry.js +361 -0
- package/dist/knowledge/registry.js.map +1 -0
- package/dist/knowledge/search.d.ts +114 -0
- package/dist/knowledge/search.d.ts.map +1 -0
- package/dist/knowledge/search.js +428 -0
- package/dist/knowledge/search.js.map +1 -0
- package/dist/knowledge/store.d.ts +76 -0
- package/dist/knowledge/store.d.ts.map +1 -0
- package/dist/knowledge/store.js +230 -0
- package/dist/knowledge/store.js.map +1 -0
- package/dist/learning/confidence.d.ts +30 -0
- package/dist/learning/confidence.d.ts.map +1 -0
- package/dist/learning/confidence.js +165 -0
- package/dist/learning/confidence.js.map +1 -0
- package/dist/learning/patterns.d.ts +52 -0
- package/dist/learning/patterns.d.ts.map +1 -0
- package/dist/learning/patterns.js +290 -0
- package/dist/learning/patterns.js.map +1 -0
- package/dist/learning/trajectory.d.ts +55 -0
- package/dist/learning/trajectory.d.ts.map +1 -0
- package/dist/learning/trajectory.js +200 -0
- package/dist/learning/trajectory.js.map +1 -0
- package/dist/memory/memory-compat.d.ts +100 -0
- package/dist/memory/memory-compat.d.ts.map +1 -0
- package/dist/memory/memory-compat.js +146 -0
- package/dist/memory/memory-compat.js.map +1 -0
- package/dist/memory/observation-store.d.ts +57 -0
- package/dist/memory/observation-store.d.ts.map +1 -0
- package/dist/memory/observation-store.js +154 -0
- package/dist/memory/observation-store.js.map +1 -0
- package/dist/memory/session-tracker.d.ts +81 -0
- package/dist/memory/session-tracker.d.ts.map +1 -0
- package/dist/memory/session-tracker.js +262 -0
- package/dist/memory/session-tracker.js.map +1 -0
- package/dist/pipeline/engine.d.ts +179 -0
- package/dist/pipeline/engine.d.ts.map +1 -0
- package/dist/pipeline/engine.js +691 -0
- package/dist/pipeline/engine.js.map +1 -0
- package/dist/pipeline/events.d.ts +54 -0
- package/dist/pipeline/events.d.ts.map +1 -0
- package/dist/pipeline/events.js +157 -0
- package/dist/pipeline/events.js.map +1 -0
- package/dist/pipeline/parallel.d.ts +83 -0
- package/dist/pipeline/parallel.d.ts.map +1 -0
- package/dist/pipeline/parallel.js +277 -0
- package/dist/pipeline/parallel.js.map +1 -0
- package/dist/pipeline/state-machine.d.ts +65 -0
- package/dist/pipeline/state-machine.d.ts.map +1 -0
- package/dist/pipeline/state-machine.js +176 -0
- package/dist/pipeline/state-machine.js.map +1 -0
- package/dist/query/graph-queries.d.ts +84 -0
- package/dist/query/graph-queries.d.ts.map +1 -0
- package/dist/query/graph-queries.js +216 -0
- package/dist/query/graph-queries.js.map +1 -0
- package/dist/query/hybrid-search.d.ts +34 -0
- package/dist/query/hybrid-search.d.ts.map +1 -0
- package/dist/query/hybrid-search.js +263 -0
- package/dist/query/hybrid-search.js.map +1 -0
- package/dist/query/intent-detector.d.ts +35 -0
- package/dist/query/intent-detector.d.ts.map +1 -0
- package/dist/query/intent-detector.js +115 -0
- package/dist/query/intent-detector.js.map +1 -0
- package/dist/query/ranking.d.ts +57 -0
- package/dist/query/ranking.d.ts.map +1 -0
- package/dist/query/ranking.js +109 -0
- package/dist/query/ranking.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +291 -0
- package/dist/server.js.map +1 -0
- package/dist/storage/falkordb-store.d.ts +73 -0
- package/dist/storage/falkordb-store.d.ts.map +1 -0
- package/dist/storage/falkordb-store.js +346 -0
- package/dist/storage/falkordb-store.js.map +1 -0
- package/dist/storage/file-cache.d.ts +32 -0
- package/dist/storage/file-cache.d.ts.map +1 -0
- package/dist/storage/file-cache.js +115 -0
- package/dist/storage/file-cache.js.map +1 -0
- package/dist/storage/interfaces.d.ts +151 -0
- package/dist/storage/interfaces.d.ts.map +1 -0
- package/dist/storage/interfaces.js +7 -0
- package/dist/storage/interfaces.js.map +1 -0
- package/dist/storage/qdrant-store.d.ts +110 -0
- package/dist/storage/qdrant-store.d.ts.map +1 -0
- package/dist/storage/qdrant-store.js +467 -0
- package/dist/storage/qdrant-store.js.map +1 -0
- package/dist/storage/schema.d.ts +4 -0
- package/dist/storage/schema.d.ts.map +1 -0
- package/dist/storage/schema.js +136 -0
- package/dist/storage/schema.js.map +1 -0
- package/dist/storage/sqlite.d.ts +35 -0
- package/dist/storage/sqlite.d.ts.map +1 -0
- package/dist/storage/sqlite.js +132 -0
- package/dist/storage/sqlite.js.map +1 -0
- package/dist/tools/collaboration-tools.d.ts +111 -0
- package/dist/tools/collaboration-tools.d.ts.map +1 -0
- package/dist/tools/collaboration-tools.js +174 -0
- package/dist/tools/collaboration-tools.js.map +1 -0
- package/dist/tools/context-tools.d.ts +293 -0
- package/dist/tools/context-tools.d.ts.map +1 -0
- package/dist/tools/context-tools.js +437 -0
- package/dist/tools/context-tools.js.map +1 -0
- package/dist/tools/graph-tools.d.ts +129 -0
- package/dist/tools/graph-tools.d.ts.map +1 -0
- package/dist/tools/graph-tools.js +237 -0
- package/dist/tools/graph-tools.js.map +1 -0
- package/dist/tools/ingestion-tools.d.ts +96 -0
- package/dist/tools/ingestion-tools.d.ts.map +1 -0
- package/dist/tools/ingestion-tools.js +90 -0
- package/dist/tools/ingestion-tools.js.map +1 -0
- package/dist/tools/learning-tools.d.ts +168 -0
- package/dist/tools/learning-tools.d.ts.map +1 -0
- package/dist/tools/learning-tools.js +158 -0
- package/dist/tools/learning-tools.js.map +1 -0
- package/dist/tools/memory-tools.d.ts +183 -0
- package/dist/tools/memory-tools.d.ts.map +1 -0
- package/dist/tools/memory-tools.js +197 -0
- package/dist/tools/memory-tools.js.map +1 -0
- package/dist/tools/phase-tools.d.ts +954 -0
- package/dist/tools/phase-tools.d.ts.map +1 -0
- package/dist/tools/phase-tools.js +1215 -0
- package/dist/tools/phase-tools.js.map +1 -0
- package/dist/tools/pipeline-tools.d.ts +140 -0
- package/dist/tools/pipeline-tools.d.ts.map +1 -0
- package/dist/tools/pipeline-tools.js +162 -0
- package/dist/tools/pipeline-tools.js.map +1 -0
- package/dist/tools/registration-tools.d.ts +220 -0
- package/dist/tools/registration-tools.d.ts.map +1 -0
- package/dist/tools/registration-tools.js +391 -0
- package/dist/tools/registration-tools.js.map +1 -0
- package/dist/util/circuit-breaker.d.ts +75 -0
- package/dist/util/circuit-breaker.d.ts.map +1 -0
- package/dist/util/circuit-breaker.js +159 -0
- package/dist/util/circuit-breaker.js.map +1 -0
- package/dist/util/config.d.ts +23 -0
- package/dist/util/config.d.ts.map +1 -0
- package/dist/util/config.js +164 -0
- package/dist/util/config.js.map +1 -0
- package/dist/util/logger.d.ts +13 -0
- package/dist/util/logger.d.ts.map +1 -0
- package/dist/util/logger.js +45 -0
- package/dist/util/logger.js.map +1 -0
- package/dist/util/token-counter.d.ts +24 -0
- package/dist/util/token-counter.d.ts.map +1 -0
- package/dist/util/token-counter.js +48 -0
- package/dist/util/token-counter.js.map +1 -0
- package/dist/util/types.d.ts +525 -0
- package/dist/util/types.d.ts.map +1 -0
- package/dist/util/types.js +5 -0
- package/dist/util/types.js.map +1 -0
- package/docker-compose.yml +20 -0
- package/docs/plans/2026-02-27-swarm-coordination/architecture.md +203 -0
- package/docs/plans/2026-02-27-swarm-coordination/vision.md +57 -0
- package/docs/plans/completed/2026-02-26-forge-plugin-bundling/architecture.md +1 -0
- package/docs/plans/completed/2026-02-26-forge-plugin-bundling/vision.md +300 -0
- package/docs/plans/completed/2026-02-27-forge-swarm-learning/architecture.md +480 -0
- package/docs/plans/completed/2026-02-27-forge-swarm-learning/verification-checklist.md +462 -0
- package/docs/plans/completed/2026-02-27-git-history-atlassian/git-jira-plan.md +181 -0
- package/package.json +39 -0
- package/plugin/.claude-plugin/plugin.json +8 -0
- package/plugin/.mcp.json +15 -0
- package/plugin/README.md +134 -0
- package/plugin/agents/architect.md +367 -0
- package/plugin/agents/backend-specialist.md +263 -0
- package/plugin/agents/brainstormer.md +122 -0
- package/plugin/agents/data-specialist.md +266 -0
- package/plugin/agents/designer.md +408 -0
- package/plugin/agents/frontend-specialist.md +241 -0
- package/plugin/agents/inspector.md +406 -0
- package/plugin/agents/knowledge-keeper.md +443 -0
- package/plugin/agents/platform-engineer.md +326 -0
- package/plugin/agents/product-manager.md +268 -0
- package/plugin/agents/product-owner.md +438 -0
- package/plugin/agents/pulse-checker.md +73 -0
- package/plugin/agents/qa-strategist.md +500 -0
- package/plugin/agents/self-improver.md +310 -0
- package/plugin/agents/strategist.md +360 -0
- package/plugin/agents/supervisor.md +380 -0
- package/plugin/commands/brainstorm.md +25 -0
- package/plugin/commands/forge.md +88 -0
- package/plugin/docs/atlassian-integration.md +110 -0
- package/plugin/docs/workflow.md +126 -0
- package/plugin/skills/agent-development/.skillfish.json +10 -0
- package/plugin/skills/agent-development/SKILL.md +415 -0
- package/plugin/skills/agent-development/examples/agent-creation-prompt.md +238 -0
- package/plugin/skills/agent-development/examples/complete-agent-examples.md +427 -0
- package/plugin/skills/agent-development/references/agent-creation-system-prompt.md +207 -0
- package/plugin/skills/agent-development/references/system-prompt-design.md +411 -0
- package/plugin/skills/agent-development/references/triggering-examples.md +491 -0
- package/plugin/skills/agent-development/scripts/validate-agent.sh +217 -0
- package/plugin/skills/agent-handoff/SKILL.md +335 -0
- package/plugin/skills/anti-stub/SKILL.md +317 -0
- package/plugin/skills/brainstorm/SKILL.md +31 -0
- package/plugin/skills/debugging/SKILL.md +276 -0
- package/plugin/skills/fix/SKILL.md +62 -0
- package/plugin/skills/frontend-design/.skillfish.json +10 -0
- package/plugin/skills/frontend-design/SKILL.md +42 -0
- package/plugin/skills/gotchas/SKILL.md +61 -0
- package/plugin/skills/graph-orchestrator/SKILL.md +38 -0
- package/plugin/skills/history/SKILL.md +58 -0
- package/plugin/skills/impact/SKILL.md +59 -0
- package/plugin/skills/implementation-execution/SKILL.md +291 -0
- package/plugin/skills/index-repo/SKILL.md +55 -0
- package/plugin/skills/interviewing/SKILL.md +225 -0
- package/plugin/skills/knowledge-curation/SKILL.md +393 -0
- package/plugin/skills/learn/SKILL.md +69 -0
- package/plugin/skills/mcp-integration/.skillfish.json +10 -0
- package/plugin/skills/mcp-integration/SKILL.md +554 -0
- package/plugin/skills/mcp-integration/examples/http-server.json +20 -0
- package/plugin/skills/mcp-integration/examples/sse-server.json +19 -0
- package/plugin/skills/mcp-integration/examples/stdio-server.json +26 -0
- package/plugin/skills/mcp-integration/references/authentication.md +549 -0
- package/plugin/skills/mcp-integration/references/server-types.md +536 -0
- package/plugin/skills/mcp-integration/references/tool-usage.md +538 -0
- package/plugin/skills/nestjs/.skillfish.json +10 -0
- package/plugin/skills/nestjs/SKILL.md +669 -0
- package/plugin/skills/nestjs/drizzle-reference.md +1894 -0
- package/plugin/skills/nestjs/reference.md +1447 -0
- package/plugin/skills/nestjs/workflow-optimization.md +229 -0
- package/plugin/skills/parallel-dispatch/SKILL.md +308 -0
- package/plugin/skills/project-discovery/SKILL.md +304 -0
- package/plugin/skills/search/SKILL.md +56 -0
- package/plugin/skills/security-audit/SKILL.md +362 -0
- package/plugin/skills/skill-development/.skillfish.json +10 -0
- package/plugin/skills/skill-development/SKILL.md +637 -0
- package/plugin/skills/skill-development/references/skill-creator-original.md +209 -0
- package/plugin/skills/tdd/SKILL.md +273 -0
- package/plugin/skills/terminal-presentation/SKILL.md +395 -0
- package/plugin/skills/test-strategy/SKILL.md +365 -0
- package/plugin/skills/verification-protocol/SKILL.md +256 -0
- package/plugin/skills/visual-explainer/CHANGELOG.md +97 -0
- package/plugin/skills/visual-explainer/LICENSE +21 -0
- package/plugin/skills/visual-explainer/README.md +137 -0
- package/plugin/skills/visual-explainer/SKILL.md +352 -0
- package/plugin/skills/visual-explainer/banner.png +0 -0
- package/plugin/skills/visual-explainer/package.json +11 -0
- package/plugin/skills/visual-explainer/prompts/diff-review.md +68 -0
- package/plugin/skills/visual-explainer/prompts/fact-check.md +63 -0
- package/plugin/skills/visual-explainer/prompts/generate-slides.md +18 -0
- package/plugin/skills/visual-explainer/prompts/generate-web-diagram.md +10 -0
- package/plugin/skills/visual-explainer/prompts/plan-review.md +86 -0
- package/plugin/skills/visual-explainer/prompts/project-recap.md +61 -0
- package/plugin/skills/visual-explainer/references/css-patterns.md +1188 -0
- package/plugin/skills/visual-explainer/references/libraries.md +470 -0
- package/plugin/skills/visual-explainer/references/responsive-nav.md +212 -0
- package/plugin/skills/visual-explainer/references/slide-patterns.md +1403 -0
- package/plugin/skills/visual-explainer/templates/architecture.html +596 -0
- package/plugin/skills/visual-explainer/templates/data-table.html +540 -0
- package/plugin/skills/visual-explainer/templates/mermaid-flowchart.html +435 -0
- package/plugin/skills/visual-explainer/templates/slide-deck.html +913 -0
- package/src/cli.ts +655 -0
- package/src/context/.gitkeep +0 -0
- package/src/context/codebase.ts +393 -0
- package/src/context/injector.ts +797 -0
- package/src/context/memory.ts +187 -0
- package/src/context/session-index.ts +327 -0
- package/src/context/session.ts +152 -0
- package/src/index.ts +47 -0
- package/src/ingestion/.gitkeep +0 -0
- package/src/ingestion/chunker.ts +277 -0
- package/src/ingestion/embedder.ts +167 -0
- package/src/ingestion/git-analyzer.ts +545 -0
- package/src/ingestion/indexer.ts +984 -0
- package/src/ingestion/markdown-chunker.ts +337 -0
- package/src/ingestion/markdown-knowledge.ts +175 -0
- package/src/ingestion/parser.ts +475 -0
- package/src/ingestion/watcher.ts +182 -0
- package/src/knowledge/.gitkeep +0 -0
- package/src/knowledge/hydrator.ts +246 -0
- package/src/knowledge/registry.ts +463 -0
- package/src/knowledge/search.ts +565 -0
- package/src/knowledge/store.ts +262 -0
- package/src/learning/.gitkeep +0 -0
- package/src/learning/confidence.ts +193 -0
- package/src/learning/patterns.ts +360 -0
- package/src/learning/trajectory.ts +268 -0
- package/src/memory/.gitkeep +0 -0
- package/src/memory/memory-compat.ts +233 -0
- package/src/memory/observation-store.ts +224 -0
- package/src/memory/session-tracker.ts +332 -0
- package/src/pipeline/.gitkeep +0 -0
- package/src/pipeline/engine.ts +1139 -0
- package/src/pipeline/events.ts +253 -0
- package/src/pipeline/parallel.ts +394 -0
- package/src/pipeline/state-machine.ts +199 -0
- package/src/query/.gitkeep +0 -0
- package/src/query/graph-queries.ts +262 -0
- package/src/query/hybrid-search.ts +337 -0
- package/src/query/intent-detector.ts +131 -0
- package/src/query/ranking.ts +161 -0
- package/src/server.ts +352 -0
- package/src/storage/.gitkeep +0 -0
- package/src/storage/falkordb-store.ts +388 -0
- package/src/storage/file-cache.ts +141 -0
- package/src/storage/interfaces.ts +201 -0
- package/src/storage/qdrant-store.ts +557 -0
- package/src/storage/schema.ts +139 -0
- package/src/storage/sqlite.ts +168 -0
- package/src/tools/.gitkeep +0 -0
- package/src/tools/collaboration-tools.ts +208 -0
- package/src/tools/context-tools.ts +493 -0
- package/src/tools/graph-tools.ts +295 -0
- package/src/tools/ingestion-tools.ts +122 -0
- package/src/tools/learning-tools.ts +181 -0
- package/src/tools/memory-tools.ts +234 -0
- package/src/tools/phase-tools.ts +1452 -0
- package/src/tools/pipeline-tools.ts +188 -0
- package/src/tools/registration-tools.ts +450 -0
- package/src/util/.gitkeep +0 -0
- package/src/util/circuit-breaker.ts +193 -0
- package/src/util/config.ts +177 -0
- package/src/util/logger.ts +53 -0
- package/src/util/token-counter.ts +52 -0
- package/src/util/types.ts +710 -0
- package/tests/context/.gitkeep +0 -0
- package/tests/integration/.gitkeep +0 -0
- package/tests/knowledge/.gitkeep +0 -0
- package/tests/learning/.gitkeep +0 -0
- package/tests/pipeline/.gitkeep +0 -0
- package/tests/tools/.gitkeep +0 -0
- package/tsconfig.json +21 -0
- package/vitest.config.ts +10 -0
- package/vscode-extension/.vscodeignore +7 -0
- package/vscode-extension/README.md +43 -0
- package/vscode-extension/out/edge-collector.js +274 -0
- package/vscode-extension/out/edge-collector.js.map +1 -0
- package/vscode-extension/out/extension.js +264 -0
- package/vscode-extension/out/extension.js.map +1 -0
- package/vscode-extension/out/forge-client.js +318 -0
- package/vscode-extension/out/forge-client.js.map +1 -0
- package/vscode-extension/package-lock.json +59 -0
- package/vscode-extension/package.json +71 -0
- package/vscode-extension/src/edge-collector.ts +320 -0
- package/vscode-extension/src/extension.ts +269 -0
- package/vscode-extension/src/forge-client.ts +364 -0
- package/vscode-extension/tsconfig.json +19 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// SQL DDL for the dk-forge-server SQLite database.
|
|
2
|
+
// All knowledge/vector data lives in Qdrant — this file covers pipeline state only.
|
|
3
|
+
//
|
|
4
|
+
// Design notes:
|
|
5
|
+
// - Timestamps are INTEGER (Unix milliseconds) throughout — no TEXT dates.
|
|
6
|
+
// - JSON columns are TEXT in SQLite; callers parse/serialize them explicitly.
|
|
7
|
+
// - Foreign keys are declared; the PipelineDB class enables FK enforcement
|
|
8
|
+
// via PRAGMA foreign_keys=ON at connection time.
|
|
9
|
+
// - Every CREATE TABLE uses IF NOT EXISTS so initialize() is idempotent.
|
|
10
|
+
// - Every CREATE INDEX uses IF NOT EXISTS for the same reason.
|
|
11
|
+
export const SCHEMA_SQL = `
|
|
12
|
+
-- Repo registry
|
|
13
|
+
CREATE TABLE IF NOT EXISTS repos (
|
|
14
|
+
id TEXT PRIMARY KEY,
|
|
15
|
+
name TEXT NOT NULL,
|
|
16
|
+
path TEXT NOT NULL,
|
|
17
|
+
remote TEXT,
|
|
18
|
+
stack TEXT NOT NULL DEFAULT '[]',
|
|
19
|
+
sharing TEXT NOT NULL DEFAULT 'private',
|
|
20
|
+
org TEXT,
|
|
21
|
+
registered_at INTEGER NOT NULL,
|
|
22
|
+
last_seen_at INTEGER NOT NULL,
|
|
23
|
+
manifest_hash TEXT
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
-- Pipeline projects
|
|
27
|
+
CREATE TABLE IF NOT EXISTS projects (
|
|
28
|
+
id TEXT PRIMARY KEY,
|
|
29
|
+
repo_id TEXT NOT NULL REFERENCES repos(id),
|
|
30
|
+
name TEXT NOT NULL,
|
|
31
|
+
description TEXT,
|
|
32
|
+
current_phase TEXT NOT NULL DEFAULT 'idle',
|
|
33
|
+
tier TEXT NOT NULL DEFAULT 'full',
|
|
34
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
35
|
+
created_at INTEGER NOT NULL,
|
|
36
|
+
updated_at INTEGER NOT NULL,
|
|
37
|
+
metadata TEXT NOT NULL DEFAULT '{}'
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
-- Pipeline events (event sourcing log)
|
|
41
|
+
CREATE TABLE IF NOT EXISTS pipeline_events (
|
|
42
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
43
|
+
project_id TEXT NOT NULL REFERENCES projects(id),
|
|
44
|
+
event_type TEXT NOT NULL,
|
|
45
|
+
from_phase TEXT,
|
|
46
|
+
to_phase TEXT,
|
|
47
|
+
agent TEXT,
|
|
48
|
+
payload TEXT NOT NULL DEFAULT '{}',
|
|
49
|
+
created_at INTEGER NOT NULL
|
|
50
|
+
);
|
|
51
|
+
CREATE INDEX IF NOT EXISTS idx_events_project
|
|
52
|
+
ON pipeline_events(project_id, created_at);
|
|
53
|
+
|
|
54
|
+
-- Phase outputs
|
|
55
|
+
CREATE TABLE IF NOT EXISTS phase_outputs (
|
|
56
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
57
|
+
project_id TEXT NOT NULL REFERENCES projects(id),
|
|
58
|
+
phase TEXT NOT NULL,
|
|
59
|
+
output_type TEXT NOT NULL,
|
|
60
|
+
content TEXT NOT NULL,
|
|
61
|
+
file_path TEXT,
|
|
62
|
+
created_at INTEGER NOT NULL
|
|
63
|
+
);
|
|
64
|
+
CREATE INDEX IF NOT EXISTS idx_outputs_project_phase
|
|
65
|
+
ON phase_outputs(project_id, phase);
|
|
66
|
+
|
|
67
|
+
-- Trajectories
|
|
68
|
+
CREATE TABLE IF NOT EXISTS trajectories (
|
|
69
|
+
id TEXT PRIMARY KEY,
|
|
70
|
+
project_id TEXT NOT NULL REFERENCES projects(id),
|
|
71
|
+
phase TEXT NOT NULL,
|
|
72
|
+
agent TEXT NOT NULL,
|
|
73
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
74
|
+
started_at INTEGER NOT NULL,
|
|
75
|
+
completed_at INTEGER,
|
|
76
|
+
success INTEGER,
|
|
77
|
+
feedback TEXT
|
|
78
|
+
);
|
|
79
|
+
CREATE INDEX IF NOT EXISTS idx_trajectories_project
|
|
80
|
+
ON trajectories(project_id, phase);
|
|
81
|
+
|
|
82
|
+
-- Trajectory steps
|
|
83
|
+
CREATE TABLE IF NOT EXISTS trajectory_steps (
|
|
84
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
85
|
+
trajectory_id TEXT NOT NULL REFERENCES trajectories(id),
|
|
86
|
+
action TEXT NOT NULL,
|
|
87
|
+
result TEXT,
|
|
88
|
+
quality_score REAL,
|
|
89
|
+
metadata TEXT NOT NULL DEFAULT '{}',
|
|
90
|
+
created_at INTEGER NOT NULL
|
|
91
|
+
);
|
|
92
|
+
CREATE INDEX IF NOT EXISTS idx_steps_trajectory
|
|
93
|
+
ON trajectory_steps(trajectory_id, created_at);
|
|
94
|
+
|
|
95
|
+
-- Sessions
|
|
96
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
97
|
+
id TEXT NOT NULL,
|
|
98
|
+
project_id TEXT REFERENCES projects(id),
|
|
99
|
+
repo_id TEXT REFERENCES repos(id),
|
|
100
|
+
started_at INTEGER NOT NULL,
|
|
101
|
+
ended_at INTEGER,
|
|
102
|
+
state TEXT NOT NULL DEFAULT '{}',
|
|
103
|
+
observation_count INTEGER NOT NULL DEFAULT 0,
|
|
104
|
+
PRIMARY KEY (id)
|
|
105
|
+
);
|
|
106
|
+
CREATE INDEX IF NOT EXISTS idx_sessions_project
|
|
107
|
+
ON sessions(project_id);
|
|
108
|
+
|
|
109
|
+
-- Parallel work claims
|
|
110
|
+
CREATE TABLE IF NOT EXISTS claims (
|
|
111
|
+
id TEXT PRIMARY KEY,
|
|
112
|
+
project_id TEXT NOT NULL REFERENCES projects(id),
|
|
113
|
+
module_name TEXT NOT NULL,
|
|
114
|
+
agent TEXT NOT NULL,
|
|
115
|
+
branch TEXT,
|
|
116
|
+
status TEXT NOT NULL DEFAULT 'claimed',
|
|
117
|
+
claimed_at INTEGER NOT NULL,
|
|
118
|
+
completed_at INTEGER,
|
|
119
|
+
result TEXT
|
|
120
|
+
);
|
|
121
|
+
CREATE INDEX IF NOT EXISTS idx_claims_project
|
|
122
|
+
ON claims(project_id, status);
|
|
123
|
+
`;
|
|
124
|
+
// Individual table DDL strings — useful for tests that need to create a
|
|
125
|
+
// single table in isolation without executing the full schema.
|
|
126
|
+
export const TABLE_NAMES = [
|
|
127
|
+
'repos',
|
|
128
|
+
'projects',
|
|
129
|
+
'pipeline_events',
|
|
130
|
+
'phase_outputs',
|
|
131
|
+
'trajectories',
|
|
132
|
+
'trajectory_steps',
|
|
133
|
+
'sessions',
|
|
134
|
+
'claims',
|
|
135
|
+
];
|
|
136
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/storage/schema.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,oFAAoF;AACpF,EAAE;AACF,gBAAgB;AAChB,2EAA2E;AAC3E,8EAA8E;AAC9E,2EAA2E;AAC3E,mDAAmD;AACnD,yEAAyE;AACzE,+DAA+D;AAE/D,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgHzB,CAAC;AAEF,wEAAwE;AACxE,+DAA+D;AAC/D,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO;IACP,UAAU;IACV,iBAAiB;IACjB,eAAe;IACf,cAAc;IACd,kBAAkB;IAClB,UAAU;IACV,QAAQ;CACA,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Database from 'better-sqlite3';
|
|
2
|
+
export declare class PipelineDB {
|
|
3
|
+
private _db;
|
|
4
|
+
private readonly filePath;
|
|
5
|
+
constructor(filePath?: string);
|
|
6
|
+
/** Run schema DDL. Idempotent — uses CREATE TABLE IF NOT EXISTS throughout. */
|
|
7
|
+
initialize(): void;
|
|
8
|
+
/** Close the database connection. Safe to call multiple times. */
|
|
9
|
+
close(): void;
|
|
10
|
+
/** Raw better-sqlite3 Database instance. Throws if the connection is closed. */
|
|
11
|
+
get db(): Database.Database;
|
|
12
|
+
/**
|
|
13
|
+
* Execute a statement that does not return rows (INSERT, UPDATE, DELETE).
|
|
14
|
+
* Returns the RunResult with lastInsertRowid and changes.
|
|
15
|
+
*/
|
|
16
|
+
run(sql: string, params?: readonly unknown[] | Record<string, unknown>): Database.RunResult;
|
|
17
|
+
/**
|
|
18
|
+
* Return a single row or undefined if no row matches.
|
|
19
|
+
* The caller supplies the expected row shape via the generic parameter T.
|
|
20
|
+
*/
|
|
21
|
+
get<T = Record<string, unknown>>(sql: string, params?: readonly unknown[] | Record<string, unknown>): T | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Return all matching rows as an array.
|
|
24
|
+
* Returns an empty array when no rows match.
|
|
25
|
+
*/
|
|
26
|
+
all<T = Record<string, unknown>>(sql: string, params?: readonly unknown[] | Record<string, unknown>): T[];
|
|
27
|
+
private _open;
|
|
28
|
+
/**
|
|
29
|
+
* Runs SQLite's built-in integrity_check pragma.
|
|
30
|
+
* Returns true if the database passes, false if it is corrupt or the check
|
|
31
|
+
* itself throws (which happens when the file header is completely invalid).
|
|
32
|
+
*/
|
|
33
|
+
private _integrityCheck;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=sqlite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/storage/sqlite.ts"],"names":[],"mappings":"AAcA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAatC,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAkC;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,QAAQ,GAAE,MAAwB;IAS9C,+EAA+E;IAC/E,UAAU,IAAI,IAAI;IAiBlB,kEAAkE;IAClE,KAAK,IAAI,IAAI;IAOb,gFAAgF;IAChF,IAAI,EAAE,IAAI,QAAQ,CAAC,QAAQ,CAK1B;IAMD;;;OAGG;IACH,GAAG,CACD,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACxD,QAAQ,CAAC,SAAS;IAIrB;;;OAGG;IACH,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACxD,CAAC,GAAG,SAAS;IAIhB;;;OAGG;IACH,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACxD,CAAC,EAAE;IAQN,OAAO,CAAC,KAAK;IAsCb;;;;OAIG;IACH,OAAO,CAAC,eAAe;CASxB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// PipelineDB — thin wrapper around better-sqlite3 for the dk-forge-server.
|
|
2
|
+
//
|
|
3
|
+
// Responsibilities:
|
|
4
|
+
// - Opens (or creates) the SQLite file at a configurable path.
|
|
5
|
+
// - Enables WAL journal mode and foreign key enforcement on every connection.
|
|
6
|
+
// - Runs the schema DDL via initialize() — idempotent; safe to call on startup.
|
|
7
|
+
// - Provides run / get / all helpers so callers do not hold raw Statement refs.
|
|
8
|
+
// - Performs an integrity check on open; if the database is corrupt, renames
|
|
9
|
+
// the file to <name>.corrupt.<timestamp>.db and opens a fresh database.
|
|
10
|
+
//
|
|
11
|
+
// Threading: better-sqlite3 is synchronous. All operations are blocking.
|
|
12
|
+
// This is intentional — the MCP server is single-threaded Node.js; async
|
|
13
|
+
// SQLite wrappers add complexity without benefit for our access patterns.
|
|
14
|
+
import Database from 'better-sqlite3';
|
|
15
|
+
import { existsSync, mkdirSync, renameSync, } from 'node:fs';
|
|
16
|
+
import { dirname, join } from 'node:path';
|
|
17
|
+
import { homedir } from 'node:os';
|
|
18
|
+
import { SCHEMA_SQL } from './schema.js';
|
|
19
|
+
// Default location: ~/.forge/pipeline.db
|
|
20
|
+
const DEFAULT_DB_PATH = join(homedir(), '.forge', 'pipeline.db');
|
|
21
|
+
export class PipelineDB {
|
|
22
|
+
_db = null;
|
|
23
|
+
filePath;
|
|
24
|
+
constructor(filePath = DEFAULT_DB_PATH) {
|
|
25
|
+
this.filePath = filePath;
|
|
26
|
+
this._db = this._open();
|
|
27
|
+
}
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
// Lifecycle
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
/** Run schema DDL. Idempotent — uses CREATE TABLE IF NOT EXISTS throughout. */
|
|
32
|
+
initialize() {
|
|
33
|
+
const db = this.db;
|
|
34
|
+
// Execute all statements in the schema in a single transaction.
|
|
35
|
+
// We split on ';' and filter empty strings so we can handle multi-statement
|
|
36
|
+
// schema strings cleanly.
|
|
37
|
+
db.transaction(() => {
|
|
38
|
+
const statements = SCHEMA_SQL
|
|
39
|
+
.split(';')
|
|
40
|
+
.map((s) => s.trim())
|
|
41
|
+
.filter((s) => s.length > 0);
|
|
42
|
+
for (const sql of statements) {
|
|
43
|
+
db.prepare(sql).run();
|
|
44
|
+
}
|
|
45
|
+
})();
|
|
46
|
+
}
|
|
47
|
+
/** Close the database connection. Safe to call multiple times. */
|
|
48
|
+
close() {
|
|
49
|
+
if (this._db && this._db.open) {
|
|
50
|
+
this._db.close();
|
|
51
|
+
this._db = null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** Raw better-sqlite3 Database instance. Throws if the connection is closed. */
|
|
55
|
+
get db() {
|
|
56
|
+
if (!this._db || !this._db.open) {
|
|
57
|
+
throw new Error('PipelineDB: database connection is closed');
|
|
58
|
+
}
|
|
59
|
+
return this._db;
|
|
60
|
+
}
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// Query helpers
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
/**
|
|
65
|
+
* Execute a statement that does not return rows (INSERT, UPDATE, DELETE).
|
|
66
|
+
* Returns the RunResult with lastInsertRowid and changes.
|
|
67
|
+
*/
|
|
68
|
+
run(sql, params = []) {
|
|
69
|
+
return this.db.prepare(sql).run(params);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Return a single row or undefined if no row matches.
|
|
73
|
+
* The caller supplies the expected row shape via the generic parameter T.
|
|
74
|
+
*/
|
|
75
|
+
get(sql, params = []) {
|
|
76
|
+
return this.db.prepare(sql).get(params);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Return all matching rows as an array.
|
|
80
|
+
* Returns an empty array when no rows match.
|
|
81
|
+
*/
|
|
82
|
+
all(sql, params = []) {
|
|
83
|
+
return this.db.prepare(sql).all(params);
|
|
84
|
+
}
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
// Private helpers
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
_open() {
|
|
89
|
+
// Ensure the directory exists before attempting to open the file.
|
|
90
|
+
const dir = dirname(this.filePath);
|
|
91
|
+
if (!existsSync(dir)) {
|
|
92
|
+
mkdirSync(dir, { recursive: true });
|
|
93
|
+
}
|
|
94
|
+
const db = new Database(this.filePath);
|
|
95
|
+
// Enable WAL mode for better concurrent read performance.
|
|
96
|
+
db.pragma('journal_mode = WAL');
|
|
97
|
+
// Enforce foreign key constraints — SQLite disables them by default.
|
|
98
|
+
db.pragma('foreign_keys = ON');
|
|
99
|
+
// Integrity check. If the database is corrupt we rename it and open fresh
|
|
100
|
+
// so the server can still start rather than crashing on every boot.
|
|
101
|
+
if (!this._integrityCheck(db)) {
|
|
102
|
+
db.close();
|
|
103
|
+
const timestamp = Date.now();
|
|
104
|
+
const corruptPath = this.filePath.replace(/\.db$/, '') + `.corrupt.${timestamp}.db`;
|
|
105
|
+
renameSync(this.filePath, corruptPath);
|
|
106
|
+
console.error(`PipelineDB: integrity check failed. Corrupt database renamed to:\n ${corruptPath}\n` +
|
|
107
|
+
` A fresh database will be created at:\n ${this.filePath}`);
|
|
108
|
+
// Open a fresh database at the original path.
|
|
109
|
+
const fresh = new Database(this.filePath);
|
|
110
|
+
fresh.pragma('journal_mode = WAL');
|
|
111
|
+
fresh.pragma('foreign_keys = ON');
|
|
112
|
+
return fresh;
|
|
113
|
+
}
|
|
114
|
+
return db;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Runs SQLite's built-in integrity_check pragma.
|
|
118
|
+
* Returns true if the database passes, false if it is corrupt or the check
|
|
119
|
+
* itself throws (which happens when the file header is completely invalid).
|
|
120
|
+
*/
|
|
121
|
+
_integrityCheck(db) {
|
|
122
|
+
try {
|
|
123
|
+
const result = db.pragma('integrity_check');
|
|
124
|
+
// integrity_check returns one row with value "ok" when healthy.
|
|
125
|
+
return result.length === 1 && result[0]?.integrity_check === 'ok';
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=sqlite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite.js","sourceRoot":"","sources":["../../src/storage/sqlite.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,oBAAoB;AACpB,+DAA+D;AAC/D,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;AAC7E,0EAA0E;AAC1E,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAE1E,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,yCAAyC;AACzC,M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CAAC;YAC9B,EAAE,CAAC,KAAK,EAAE,CAAC;YAEX,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC7B,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,YAAY,SAAS,KAAK,CAAC;YACpF,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YACvC,OAAO,CAAC,KAAK,CACX,uEAAuE,WAAW,IAAI;gBACtF,6CAA6C,IAAI,CAAC,QAAQ,EAAE,CAC7D,CAAC;YAEF,8CAA8C;YAC9C,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC1C,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;YACnC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;;OAIG;IACK,eAAe,CAAC,EAAqB;QAC3C,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAuC,CAAC;YAClF,gEAAgE;YAChE,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;QACpE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { VectorStore, GraphStore } from '../storage/interfaces.js';
|
|
3
|
+
import type { PipelineDB } from '../storage/sqlite.js';
|
|
4
|
+
export declare const broadcastFindingSchema: z.ZodObject<{
|
|
5
|
+
project_id: z.ZodString;
|
|
6
|
+
content: z.ZodString;
|
|
7
|
+
severity: z.ZodDefault<z.ZodEnum<["info", "warning", "critical"]>>;
|
|
8
|
+
target_agents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
symbols: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
content: string;
|
|
12
|
+
project_id: string;
|
|
13
|
+
severity: "info" | "warning" | "critical";
|
|
14
|
+
symbols?: string[] | undefined;
|
|
15
|
+
target_agents?: string[] | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
content: string;
|
|
18
|
+
project_id: string;
|
|
19
|
+
symbols?: string[] | undefined;
|
|
20
|
+
severity?: "info" | "warning" | "critical" | undefined;
|
|
21
|
+
target_agents?: string[] | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const getBroadcastsSchema: z.ZodObject<{
|
|
24
|
+
project_id: z.ZodString;
|
|
25
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
severity: z.ZodOptional<z.ZodEnum<["info", "warning", "critical"]>>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
project_id: string;
|
|
29
|
+
severity?: "info" | "warning" | "critical" | undefined;
|
|
30
|
+
since?: number | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
project_id: string;
|
|
33
|
+
severity?: "info" | "warning" | "critical" | undefined;
|
|
34
|
+
since?: number | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
export declare function createCollaborationTools(vectorStore: VectorStore | null, graphStore: GraphStore | null, db: PipelineDB): {
|
|
37
|
+
broadcast_finding: {
|
|
38
|
+
schema: z.ZodObject<{
|
|
39
|
+
project_id: z.ZodString;
|
|
40
|
+
content: z.ZodString;
|
|
41
|
+
severity: z.ZodDefault<z.ZodEnum<["info", "warning", "critical"]>>;
|
|
42
|
+
target_agents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
43
|
+
symbols: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
content: string;
|
|
46
|
+
project_id: string;
|
|
47
|
+
severity: "info" | "warning" | "critical";
|
|
48
|
+
symbols?: string[] | undefined;
|
|
49
|
+
target_agents?: string[] | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
content: string;
|
|
52
|
+
project_id: string;
|
|
53
|
+
symbols?: string[] | undefined;
|
|
54
|
+
severity?: "info" | "warning" | "critical" | undefined;
|
|
55
|
+
target_agents?: string[] | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
description: string;
|
|
58
|
+
handler: (input: z.infer<typeof broadcastFindingSchema>) => Promise<{
|
|
59
|
+
broadcast: boolean;
|
|
60
|
+
observation_id: string | null;
|
|
61
|
+
severity: "info" | "warning" | "critical";
|
|
62
|
+
project_id: string;
|
|
63
|
+
error?: undefined;
|
|
64
|
+
message?: undefined;
|
|
65
|
+
} | {
|
|
66
|
+
error: string;
|
|
67
|
+
message: string;
|
|
68
|
+
broadcast: boolean;
|
|
69
|
+
observation_id?: undefined;
|
|
70
|
+
severity?: undefined;
|
|
71
|
+
project_id?: undefined;
|
|
72
|
+
}>;
|
|
73
|
+
};
|
|
74
|
+
get_broadcasts: {
|
|
75
|
+
schema: z.ZodObject<{
|
|
76
|
+
project_id: z.ZodString;
|
|
77
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
severity: z.ZodOptional<z.ZodEnum<["info", "warning", "critical"]>>;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
project_id: string;
|
|
81
|
+
severity?: "info" | "warning" | "critical" | undefined;
|
|
82
|
+
since?: number | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
project_id: string;
|
|
85
|
+
severity?: "info" | "warning" | "critical" | undefined;
|
|
86
|
+
since?: number | undefined;
|
|
87
|
+
}>;
|
|
88
|
+
description: string;
|
|
89
|
+
handler: (input: z.infer<typeof getBroadcastsSchema>) => Promise<{
|
|
90
|
+
project_id: string;
|
|
91
|
+
broadcasts: {
|
|
92
|
+
id: number;
|
|
93
|
+
content: string;
|
|
94
|
+
severity: string;
|
|
95
|
+
target_agents: string[];
|
|
96
|
+
observation_id: string | undefined;
|
|
97
|
+
created_at: number;
|
|
98
|
+
}[];
|
|
99
|
+
count: number;
|
|
100
|
+
error?: undefined;
|
|
101
|
+
message?: undefined;
|
|
102
|
+
} | {
|
|
103
|
+
error: string;
|
|
104
|
+
message: string;
|
|
105
|
+
broadcasts: never[];
|
|
106
|
+
count: number;
|
|
107
|
+
project_id?: undefined;
|
|
108
|
+
}>;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=collaboration-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collaboration-tools.d.ts","sourceRoot":"","sources":["../../src/tools/collaboration-tools.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AASvD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;EAMjC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AAMH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,WAAW,GAAG,IAAI,EAC/B,UAAU,EAAE,UAAU,GAAG,IAAI,EAC7B,EAAE,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;yBAMa,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAmFtC,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC;;;;;;;gCA+BR,MAAM,GAAG,SAAS;;;;;;;;;;;;;;EAgCzE"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// collaboration-tools.ts — Swarm Learning Phase 5
|
|
2
|
+
// MCP tool handlers for cross-agent collaboration.
|
|
3
|
+
// Tools: broadcast_finding, get_broadcasts
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { saveObservation } from '../memory/observation-store.js';
|
|
6
|
+
import { getCurrentSessionId } from '../memory/session-tracker.js';
|
|
7
|
+
import { logger } from '../util/logger.js';
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Input schemas
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
export const broadcastFindingSchema = z.object({
|
|
12
|
+
project_id: z.string().min(1, 'project_id is required'),
|
|
13
|
+
content: z.string().min(1, 'content is required'),
|
|
14
|
+
severity: z.enum(['info', 'warning', 'critical']).default('info'),
|
|
15
|
+
target_agents: z.array(z.string()).optional(),
|
|
16
|
+
symbols: z.array(z.string()).optional(),
|
|
17
|
+
});
|
|
18
|
+
export const getBroadcastsSchema = z.object({
|
|
19
|
+
project_id: z.string().min(1, 'project_id is required'),
|
|
20
|
+
since: z.number().optional(),
|
|
21
|
+
severity: z.enum(['info', 'warning', 'critical']).optional(),
|
|
22
|
+
});
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Tool factory
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
export function createCollaborationTools(vectorStore, graphStore, db) {
|
|
27
|
+
return {
|
|
28
|
+
'broadcast_finding': {
|
|
29
|
+
schema: broadcastFindingSchema,
|
|
30
|
+
description: 'Broadcast a finding to other agents working on the same project. MANDATORY during implementation — broadcast all interface changes, API contracts, schema changes, and blockers so sibling agents can react. Creates an observation and records in pipeline events.',
|
|
31
|
+
handler: async (input) => {
|
|
32
|
+
try {
|
|
33
|
+
let observationId = null;
|
|
34
|
+
// Save as observation if vector store is available
|
|
35
|
+
if (vectorStore) {
|
|
36
|
+
try {
|
|
37
|
+
const effectiveGraphStore = graphStore ?? createNoOpGraphStore();
|
|
38
|
+
const result = await saveObservation({
|
|
39
|
+
content: input.content,
|
|
40
|
+
symbols: input.symbols,
|
|
41
|
+
importance: input.severity === 'critical' ? 0.9 : input.severity === 'warning' ? 0.7 : 0.5,
|
|
42
|
+
tags: ['broadcast', 'agent_broadcast', input.project_id, input.severity],
|
|
43
|
+
category: 'agent_broadcast',
|
|
44
|
+
sessionId: getCurrentSessionId(),
|
|
45
|
+
type: 'working',
|
|
46
|
+
source: 'forge',
|
|
47
|
+
metadata: {
|
|
48
|
+
project_id: input.project_id,
|
|
49
|
+
severity: input.severity,
|
|
50
|
+
target_agents: input.target_agents,
|
|
51
|
+
},
|
|
52
|
+
}, vectorStore, effectiveGraphStore, graphStore
|
|
53
|
+
? { writeVector: true, writeGraphNode: true, defaultNamespace: 'default' }
|
|
54
|
+
: { writeVector: true, writeGraphNode: false, defaultNamespace: 'default' });
|
|
55
|
+
observationId = result.id;
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
logger.warn('broadcast_finding: observation save failed (non-fatal)', { error: String(err) });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Record in SQLite pipeline_events
|
|
62
|
+
try {
|
|
63
|
+
db.run(`INSERT INTO pipeline_events (project_id, event_type, from_phase, to_phase, agent, payload, created_at)
|
|
64
|
+
VALUES (?, ?, NULL, NULL, NULL, ?, ?)`, [
|
|
65
|
+
input.project_id,
|
|
66
|
+
'agent_broadcast',
|
|
67
|
+
JSON.stringify({
|
|
68
|
+
content: input.content,
|
|
69
|
+
severity: input.severity,
|
|
70
|
+
target_agents: input.target_agents,
|
|
71
|
+
observation_id: observationId,
|
|
72
|
+
}),
|
|
73
|
+
Date.now(),
|
|
74
|
+
]);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
logger.warn('broadcast_finding: event recording failed', { error: String(err) });
|
|
78
|
+
}
|
|
79
|
+
logger.debug('collaboration-tools.broadcast_finding: completed', {
|
|
80
|
+
projectId: input.project_id,
|
|
81
|
+
severity: input.severity,
|
|
82
|
+
observationId,
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
broadcast: true,
|
|
86
|
+
observation_id: observationId,
|
|
87
|
+
severity: input.severity,
|
|
88
|
+
project_id: input.project_id,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
logger.error('collaboration-tools.broadcast_finding: error', { error: String(err) });
|
|
93
|
+
return {
|
|
94
|
+
error: 'BROADCAST_FINDING_FAILED',
|
|
95
|
+
message: String(err),
|
|
96
|
+
broadcast: false,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
'get_broadcasts': {
|
|
102
|
+
schema: getBroadcastsSchema,
|
|
103
|
+
description: 'Get recent broadcasts for a project. ALWAYS CALL THIS at the start of implementation to see what sibling agents have discovered. Filter by severity or time range.',
|
|
104
|
+
handler: async (input) => {
|
|
105
|
+
try {
|
|
106
|
+
// Query from SQLite pipeline_events
|
|
107
|
+
let query = `SELECT * FROM pipeline_events WHERE project_id = ? AND event_type = 'agent_broadcast'`;
|
|
108
|
+
const params = [input.project_id];
|
|
109
|
+
if (input.since) {
|
|
110
|
+
query += ` AND created_at >= ?`;
|
|
111
|
+
params.push(input.since);
|
|
112
|
+
}
|
|
113
|
+
query += ` ORDER BY created_at DESC LIMIT 50`;
|
|
114
|
+
const rows = db.all(query, params);
|
|
115
|
+
let broadcasts = rows.map(row => {
|
|
116
|
+
let payload = {};
|
|
117
|
+
try {
|
|
118
|
+
payload = JSON.parse(row.payload);
|
|
119
|
+
}
|
|
120
|
+
catch { }
|
|
121
|
+
return {
|
|
122
|
+
id: row.id,
|
|
123
|
+
content: String(payload.content ?? ''),
|
|
124
|
+
severity: String(payload.severity ?? 'info'),
|
|
125
|
+
target_agents: payload.target_agents ?? [],
|
|
126
|
+
observation_id: payload.observation_id,
|
|
127
|
+
created_at: row.created_at,
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
// Filter by severity if specified
|
|
131
|
+
if (input.severity) {
|
|
132
|
+
broadcasts = broadcasts.filter(b => b.severity === input.severity);
|
|
133
|
+
}
|
|
134
|
+
logger.debug('collaboration-tools.get_broadcasts: completed', {
|
|
135
|
+
projectId: input.project_id,
|
|
136
|
+
count: broadcasts.length,
|
|
137
|
+
});
|
|
138
|
+
return {
|
|
139
|
+
project_id: input.project_id,
|
|
140
|
+
broadcasts,
|
|
141
|
+
count: broadcasts.length,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
logger.error('collaboration-tools.get_broadcasts: error', { error: String(err) });
|
|
146
|
+
return {
|
|
147
|
+
error: 'GET_BROADCASTS_FAILED',
|
|
148
|
+
message: String(err),
|
|
149
|
+
broadcasts: [],
|
|
150
|
+
count: 0,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
// No-op graph store
|
|
159
|
+
// ---------------------------------------------------------------------------
|
|
160
|
+
function createNoOpGraphStore() {
|
|
161
|
+
return {
|
|
162
|
+
connect: async () => { },
|
|
163
|
+
disconnect: async () => { },
|
|
164
|
+
isHealthy: async () => false,
|
|
165
|
+
query: async () => ({ nodes: [], edges: [], raw: [] }),
|
|
166
|
+
upsertNode: async () => { },
|
|
167
|
+
upsertEdge: async () => { },
|
|
168
|
+
deleteFile: async () => { },
|
|
169
|
+
deleteRepo: async () => { },
|
|
170
|
+
getCounts: async () => ({ totalNodes: 0, totalEdges: 0, byLabel: {} }),
|
|
171
|
+
ensureIndexes: async () => { },
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=collaboration-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collaboration-tools.js","sourceRoot":"","sources":["../../src/tools/collaboration-tools.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,mDAAmD;AACnD,2CAA2C;AAE3C,OAAO,EAAE,CAA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