synapsexcoder 6.0.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/.opencode/opencode.jsonc +102 -0
- package/README.md +353 -0
- package/dist/agents/agent-config-manager.d.ts +58 -0
- package/dist/agents/agent-config-manager.d.ts.map +1 -0
- package/dist/agents/agent-config-manager.js +313 -0
- package/dist/agents/agent-config-manager.js.map +1 -0
- package/dist/agents/base-agents.d.ts +352 -0
- package/dist/agents/base-agents.d.ts.map +1 -0
- package/dist/agents/base-agents.js +3961 -0
- package/dist/agents/base-agents.js.map +1 -0
- package/dist/agents/gated-subagent.d.ts +126 -0
- package/dist/agents/gated-subagent.d.ts.map +1 -0
- package/dist/agents/gated-subagent.js +591 -0
- package/dist/agents/gated-subagent.js.map +1 -0
- package/dist/agents/gated-subagents.d.ts +130 -0
- package/dist/agents/gated-subagents.d.ts.map +1 -0
- package/dist/agents/gated-subagents.js +2014 -0
- package/dist/agents/gated-subagents.js.map +1 -0
- package/dist/agents/internal-gatekeeper.d.ts +167 -0
- package/dist/agents/internal-gatekeeper.d.ts.map +1 -0
- package/dist/agents/internal-gatekeeper.js +1130 -0
- package/dist/agents/internal-gatekeeper.js.map +1 -0
- package/dist/agents/verification-agent.d.ts +86 -0
- package/dist/agents/verification-agent.d.ts.map +1 -0
- package/dist/agents/verification-agent.js +211 -0
- package/dist/agents/verification-agent.js.map +1 -0
- package/dist/analytics/analytics-types.d.ts +113 -0
- package/dist/analytics/analytics-types.d.ts.map +1 -0
- package/dist/analytics/analytics-types.js +8 -0
- package/dist/analytics/analytics-types.js.map +1 -0
- package/dist/analytics/dashboard-generator.d.ts +35 -0
- package/dist/analytics/dashboard-generator.d.ts.map +1 -0
- package/dist/analytics/dashboard-generator.js +365 -0
- package/dist/analytics/dashboard-generator.js.map +1 -0
- package/dist/analytics/index.d.ts +12 -0
- package/dist/analytics/index.d.ts.map +1 -0
- package/dist/analytics/index.js +12 -0
- package/dist/analytics/index.js.map +1 -0
- package/dist/analytics/metrics-aggregator.d.ts +88 -0
- package/dist/analytics/metrics-aggregator.d.ts.map +1 -0
- package/dist/analytics/metrics-aggregator.js +280 -0
- package/dist/analytics/metrics-aggregator.js.map +1 -0
- package/dist/cli/index.d.ts +36 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +2677 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/normalize_patch.d.ts +3 -0
- package/dist/cli/normalize_patch.d.ts.map +1 -0
- package/dist/cli/normalize_patch.js +34 -0
- package/dist/cli/normalize_patch.js.map +1 -0
- package/dist/commands/command-processor.d.ts +58 -0
- package/dist/commands/command-processor.d.ts.map +1 -0
- package/dist/commands/command-processor.js +796 -0
- package/dist/commands/command-processor.js.map +1 -0
- package/dist/config/compliance-checker.d.ts +93 -0
- package/dist/config/compliance-checker.d.ts.map +1 -0
- package/dist/config/compliance-checker.js +424 -0
- package/dist/config/compliance-checker.js.map +1 -0
- package/dist/config/enterprise-config.d.ts +173 -0
- package/dist/config/enterprise-config.d.ts.map +1 -0
- package/dist/config/enterprise-config.js +190 -0
- package/dist/config/enterprise-config.js.map +1 -0
- package/dist/config/index.d.ts +13 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +11 -0
- package/dist/config/index.js.map +1 -0
- package/dist/context/context-system.d.ts +97 -0
- package/dist/context/context-system.d.ts.map +1 -0
- package/dist/context/context-system.js +880 -0
- package/dist/context/context-system.js.map +1 -0
- package/dist/context/store.d.ts +123 -0
- package/dist/context/store.d.ts.map +1 -0
- package/dist/context/store.js +281 -0
- package/dist/context/store.js.map +1 -0
- package/dist/dasp/dasp-controller.d.ts +83 -0
- package/dist/dasp/dasp-controller.d.ts.map +1 -0
- package/dist/dasp/dasp-controller.js +190 -0
- package/dist/dasp/dasp-controller.js.map +1 -0
- package/dist/dasp/feedback-adapter.d.ts +56 -0
- package/dist/dasp/feedback-adapter.d.ts.map +1 -0
- package/dist/dasp/feedback-adapter.js +158 -0
- package/dist/dasp/feedback-adapter.js.map +1 -0
- package/dist/dasp/index.d.ts +14 -0
- package/dist/dasp/index.d.ts.map +1 -0
- package/dist/dasp/index.js +10 -0
- package/dist/dasp/index.js.map +1 -0
- package/dist/dasp/prompt-templates.d.ts +38 -0
- package/dist/dasp/prompt-templates.d.ts.map +1 -0
- package/dist/dasp/prompt-templates.js +406 -0
- package/dist/dasp/prompt-templates.js.map +1 -0
- package/dist/dasp/vault-rag-provider.d.ts +51 -0
- package/dist/dasp/vault-rag-provider.d.ts.map +1 -0
- package/dist/dasp/vault-rag-provider.js +125 -0
- package/dist/dasp/vault-rag-provider.js.map +1 -0
- package/dist/distribution/cli-distribution.d.ts +68 -0
- package/dist/distribution/cli-distribution.d.ts.map +1 -0
- package/dist/distribution/cli-distribution.js +941 -0
- package/dist/distribution/cli-distribution.js.map +1 -0
- package/dist/docs/doc-generator.d.ts +78 -0
- package/dist/docs/doc-generator.d.ts.map +1 -0
- package/dist/docs/doc-generator.js +297 -0
- package/dist/docs/doc-generator.js.map +1 -0
- package/dist/docs/index.d.ts +13 -0
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +11 -0
- package/dist/docs/index.js.map +1 -0
- package/dist/docs/site-builder.d.ts +58 -0
- package/dist/docs/site-builder.d.ts.map +1 -0
- package/dist/docs/site-builder.js +229 -0
- package/dist/docs/site-builder.js.map +1 -0
- package/dist/ecosystem/adapters/claude-adapter.d.ts +29 -0
- package/dist/ecosystem/adapters/claude-adapter.d.ts.map +1 -0
- package/dist/ecosystem/adapters/claude-adapter.js +116 -0
- package/dist/ecosystem/adapters/claude-adapter.js.map +1 -0
- package/dist/ecosystem/adapters/cursor-adapter.d.ts +27 -0
- package/dist/ecosystem/adapters/cursor-adapter.d.ts.map +1 -0
- package/dist/ecosystem/adapters/cursor-adapter.js +93 -0
- package/dist/ecosystem/adapters/cursor-adapter.js.map +1 -0
- package/dist/ecosystem/adapters/v0-adapter.d.ts +30 -0
- package/dist/ecosystem/adapters/v0-adapter.d.ts.map +1 -0
- package/dist/ecosystem/adapters/v0-adapter.js +112 -0
- package/dist/ecosystem/adapters/v0-adapter.js.map +1 -0
- package/dist/ecosystem/ecosystem-router.d.ts +80 -0
- package/dist/ecosystem/ecosystem-router.d.ts.map +1 -0
- package/dist/ecosystem/ecosystem-router.js +241 -0
- package/dist/ecosystem/ecosystem-router.js.map +1 -0
- package/dist/ecosystem/ecosystem-types.d.ts +94 -0
- package/dist/ecosystem/ecosystem-types.d.ts.map +1 -0
- package/dist/ecosystem/ecosystem-types.js +27 -0
- package/dist/ecosystem/ecosystem-types.js.map +1 -0
- package/dist/ecosystem/index.d.ts +10 -0
- package/dist/ecosystem/index.d.ts.map +1 -0
- package/dist/ecosystem/index.js +9 -0
- package/dist/ecosystem/index.js.map +1 -0
- package/dist/integration/agentic-integration.d.ts +73 -0
- package/dist/integration/agentic-integration.d.ts.map +1 -0
- package/dist/integration/agentic-integration.js +253 -0
- package/dist/integration/agentic-integration.js.map +1 -0
- package/dist/integration/background-agents-integration.d.ts +54 -0
- package/dist/integration/background-agents-integration.d.ts.map +1 -0
- package/dist/integration/background-agents-integration.js +225 -0
- package/dist/integration/background-agents-integration.js.map +1 -0
- package/dist/integration/dcp-integration.d.ts +81 -0
- package/dist/integration/dcp-integration.d.ts.map +1 -0
- package/dist/integration/dcp-integration.js +189 -0
- package/dist/integration/dcp-integration.js.map +1 -0
- package/dist/integration/firecrawl-integration.d.ts +61 -0
- package/dist/integration/firecrawl-integration.d.ts.map +1 -0
- package/dist/integration/firecrawl-integration.js +246 -0
- package/dist/integration/firecrawl-integration.js.map +1 -0
- package/dist/integration/index.d.ts +40 -0
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/integration/index.js +43 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/integration-hub.d.ts +43 -0
- package/dist/integration/integration-hub.d.ts.map +1 -0
- package/dist/integration/integration-hub.js +507 -0
- package/dist/integration/integration-hub.js.map +1 -0
- package/dist/integration/integration-loader.d.ts +42 -0
- package/dist/integration/integration-loader.d.ts.map +1 -0
- package/dist/integration/integration-loader.js +240 -0
- package/dist/integration/integration-loader.js.map +1 -0
- package/dist/integration/md-table-formatter-integration.d.ts +41 -0
- package/dist/integration/md-table-formatter-integration.d.ts.map +1 -0
- package/dist/integration/md-table-formatter-integration.js +183 -0
- package/dist/integration/md-table-formatter-integration.js.map +1 -0
- package/dist/integration/native/agentic/agentic-engine.d.ts +52 -0
- package/dist/integration/native/agentic/agentic-engine.d.ts.map +1 -0
- package/dist/integration/native/agentic/agentic-engine.js +267 -0
- package/dist/integration/native/agentic/agentic-engine.js.map +1 -0
- package/dist/integration/native/background/background-engine.d.ts +62 -0
- package/dist/integration/native/background/background-engine.d.ts.map +1 -0
- package/dist/integration/native/background/background-engine.js +167 -0
- package/dist/integration/native/background/background-engine.js.map +1 -0
- package/dist/integration/native/dcp/dcp-engine.d.ts +55 -0
- package/dist/integration/native/dcp/dcp-engine.d.ts.map +1 -0
- package/dist/integration/native/dcp/dcp-engine.js +168 -0
- package/dist/integration/native/dcp/dcp-engine.js.map +1 -0
- package/dist/integration/native/firecrawl/firecrawl-engine.d.ts +66 -0
- package/dist/integration/native/firecrawl/firecrawl-engine.d.ts.map +1 -0
- package/dist/integration/native/firecrawl/firecrawl-engine.js +221 -0
- package/dist/integration/native/firecrawl/firecrawl-engine.js.map +1 -0
- package/dist/integration/native/formatter/formatter-engine.d.ts +47 -0
- package/dist/integration/native/formatter/formatter-engine.d.ts.map +1 -0
- package/dist/integration/native/formatter/formatter-engine.js +130 -0
- package/dist/integration/native/formatter/formatter-engine.js.map +1 -0
- package/dist/integration/native/index.d.ts +41 -0
- package/dist/integration/native/index.d.ts.map +1 -0
- package/dist/integration/native/index.js +80 -0
- package/dist/integration/native/index.js.map +1 -0
- package/dist/integration/native/orchestration/orchestration-engine.d.ts +62 -0
- package/dist/integration/native/orchestration/orchestration-engine.d.ts.map +1 -0
- package/dist/integration/native/orchestration/orchestration-engine.js +177 -0
- package/dist/integration/native/orchestration/orchestration-engine.js.map +1 -0
- package/dist/integration/native/pty/pty-engine.d.ts +45 -0
- package/dist/integration/native/pty/pty-engine.d.ts.map +1 -0
- package/dist/integration/native/pty/pty-engine.js +103 -0
- package/dist/integration/native/pty/pty-engine.js.map +1 -0
- package/dist/integration/native/shell-strategy.d.ts +60 -0
- package/dist/integration/native/shell-strategy.d.ts.map +1 -0
- package/dist/integration/native/shell-strategy.js +131 -0
- package/dist/integration/native/shell-strategy.js.map +1 -0
- package/dist/integration/native/skillful/skillful-engine.d.ts +53 -0
- package/dist/integration/native/skillful/skillful-engine.d.ts.map +1 -0
- package/dist/integration/native/skillful/skillful-engine.js +127 -0
- package/dist/integration/native/skillful/skillful-engine.js.map +1 -0
- package/dist/integration/native/subtask2/subtask2-engine.d.ts +50 -0
- package/dist/integration/native/subtask2/subtask2-engine.d.ts.map +1 -0
- package/dist/integration/native/subtask2/subtask2-engine.js +158 -0
- package/dist/integration/native/subtask2/subtask2-engine.js.map +1 -0
- package/dist/integration/native/supermemory/supermemory-engine.d.ts +63 -0
- package/dist/integration/native/supermemory/supermemory-engine.d.ts.map +1 -0
- package/dist/integration/native/supermemory/supermemory-engine.js +127 -0
- package/dist/integration/native/supermemory/supermemory-engine.js.map +1 -0
- package/dist/integration/native/workspace/workspace-engine.d.ts +75 -0
- package/dist/integration/native/workspace/workspace-engine.d.ts.map +1 -0
- package/dist/integration/native/workspace/workspace-engine.js +216 -0
- package/dist/integration/native/workspace/workspace-engine.js.map +1 -0
- package/dist/integration/oh-my-opencode-integration.d.ts +59 -0
- package/dist/integration/oh-my-opencode-integration.d.ts.map +1 -0
- package/dist/integration/oh-my-opencode-integration.js +180 -0
- package/dist/integration/oh-my-opencode-integration.js.map +1 -0
- package/dist/integration/openagents-control-integration.d.ts +81 -0
- package/dist/integration/openagents-control-integration.d.ts.map +1 -0
- package/dist/integration/openagents-control-integration.js +273 -0
- package/dist/integration/openagents-control-integration.js.map +1 -0
- package/dist/integration/pty-integration.d.ts +64 -0
- package/dist/integration/pty-integration.d.ts.map +1 -0
- package/dist/integration/pty-integration.js +180 -0
- package/dist/integration/pty-integration.js.map +1 -0
- package/dist/integration/shell-strategy-integration.d.ts +26 -0
- package/dist/integration/shell-strategy-integration.d.ts.map +1 -0
- package/dist/integration/shell-strategy-integration.js +110 -0
- package/dist/integration/shell-strategy-integration.js.map +1 -0
- package/dist/integration/skillful-integration.d.ts +74 -0
- package/dist/integration/skillful-integration.d.ts.map +1 -0
- package/dist/integration/skillful-integration.js +317 -0
- package/dist/integration/skillful-integration.js.map +1 -0
- package/dist/integration/subtask2-integration.d.ts +71 -0
- package/dist/integration/subtask2-integration.d.ts.map +1 -0
- package/dist/integration/subtask2-integration.js +240 -0
- package/dist/integration/subtask2-integration.js.map +1 -0
- package/dist/integration/supermemory-integration.d.ts +82 -0
- package/dist/integration/supermemory-integration.d.ts.map +1 -0
- package/dist/integration/supermemory-integration.js +252 -0
- package/dist/integration/supermemory-integration.js.map +1 -0
- package/dist/integration/types.d.ts +218 -0
- package/dist/integration/types.d.ts.map +1 -0
- package/dist/integration/types.js +5 -0
- package/dist/integration/types.js.map +1 -0
- package/dist/integration/workspace-integration.d.ts +46 -0
- package/dist/integration/workspace-integration.d.ts.map +1 -0
- package/dist/integration/workspace-integration.js +181 -0
- package/dist/integration/workspace-integration.js.map +1 -0
- package/dist/knowledge-vault/deepwiki-sync.d.ts +99 -0
- package/dist/knowledge-vault/deepwiki-sync.d.ts.map +1 -0
- package/dist/knowledge-vault/deepwiki-sync.js +381 -0
- package/dist/knowledge-vault/deepwiki-sync.js.map +1 -0
- package/dist/knowledge-vault/index.d.ts +11 -0
- package/dist/knowledge-vault/index.d.ts.map +1 -0
- package/dist/knowledge-vault/index.js +8 -0
- package/dist/knowledge-vault/index.js.map +1 -0
- package/dist/knowledge-vault/knowledge-vault.d.ts +38 -0
- package/dist/knowledge-vault/knowledge-vault.d.ts.map +1 -0
- package/dist/knowledge-vault/knowledge-vault.js +284 -0
- package/dist/knowledge-vault/knowledge-vault.js.map +1 -0
- package/dist/knowledge-vault/opencode-doc-ingest.d.ts +23 -0
- package/dist/knowledge-vault/opencode-doc-ingest.d.ts.map +1 -0
- package/dist/knowledge-vault/opencode-doc-ingest.js +48 -0
- package/dist/knowledge-vault/opencode-doc-ingest.js.map +1 -0
- package/dist/knowledge-vault/types.d.ts +61 -0
- package/dist/knowledge-vault/types.d.ts.map +1 -0
- package/dist/knowledge-vault/types.js +5 -0
- package/dist/knowledge-vault/types.js.map +1 -0
- package/dist/knowledge-vault/vault-config.d.ts +12 -0
- package/dist/knowledge-vault/vault-config.d.ts.map +1 -0
- package/dist/knowledge-vault/vault-config.js +24 -0
- package/dist/knowledge-vault/vault-config.js.map +1 -0
- package/dist/mcp/index.d.ts +28 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +29 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/mcp-manager.d.ts +181 -0
- package/dist/mcp/mcp-manager.d.ts.map +1 -0
- package/dist/mcp/mcp-manager.js +621 -0
- package/dist/mcp/mcp-manager.js.map +1 -0
- package/dist/mcp/mcp-types.d.ts +199 -0
- package/dist/mcp/mcp-types.d.ts.map +1 -0
- package/dist/mcp/mcp-types.js +152 -0
- package/dist/mcp/mcp-types.js.map +1 -0
- package/dist/mcp/servers/mcp-server-bridge.d.ts +64 -0
- package/dist/mcp/servers/mcp-server-bridge.d.ts.map +1 -0
- package/dist/mcp/servers/mcp-server-bridge.js +189 -0
- package/dist/mcp/servers/mcp-server-bridge.js.map +1 -0
- package/dist/messages/message-bus.d.ts +148 -0
- package/dist/messages/message-bus.d.ts.map +1 -0
- package/dist/messages/message-bus.js +432 -0
- package/dist/messages/message-bus.js.map +1 -0
- package/dist/modes/custom-mode-registry.d.ts +121 -0
- package/dist/modes/custom-mode-registry.d.ts.map +1 -0
- package/dist/modes/custom-mode-registry.js +306 -0
- package/dist/modes/custom-mode-registry.js.map +1 -0
- package/dist/modes/index.d.ts +10 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/mode-designer.d.ts +89 -0
- package/dist/modes/mode-designer.d.ts.map +1 -0
- package/dist/modes/mode-designer.js +485 -0
- package/dist/modes/mode-designer.js.map +1 -0
- package/dist/modes/mode-manager.d.ts +27 -0
- package/dist/modes/mode-manager.d.ts.map +1 -0
- package/dist/modes/mode-manager.js +68 -0
- package/dist/modes/mode-manager.js.map +1 -0
- package/dist/modes/synapse-modes.d.ts +26 -0
- package/dist/modes/synapse-modes.d.ts.map +1 -0
- package/dist/modes/synapse-modes.js +69 -0
- package/dist/modes/synapse-modes.js.map +1 -0
- package/dist/opencode/agent-delegate.d.ts +3 -0
- package/dist/opencode/agent-delegate.d.ts.map +1 -0
- package/dist/opencode/agent-delegate.js +3 -0
- package/dist/opencode/agent-delegate.js.map +1 -0
- package/dist/opencode/tool-bridge.d.ts +3 -0
- package/dist/opencode/tool-bridge.d.ts.map +1 -0
- package/dist/opencode/tool-bridge.js +3 -0
- package/dist/opencode/tool-bridge.js.map +1 -0
- package/dist/optimization/token-optimizer-v2.d.ts +18 -0
- package/dist/optimization/token-optimizer-v2.d.ts.map +1 -0
- package/dist/optimization/token-optimizer-v2.js +23 -0
- package/dist/optimization/token-optimizer-v2.js.map +1 -0
- package/dist/optimization/token-optimizer.d.ts +90 -0
- package/dist/optimization/token-optimizer.d.ts.map +1 -0
- package/dist/optimization/token-optimizer.js +399 -0
- package/dist/optimization/token-optimizer.js.map +1 -0
- package/dist/parallel/agent-farm.d.ts +123 -0
- package/dist/parallel/agent-farm.d.ts.map +1 -0
- package/dist/parallel/agent-farm.js +501 -0
- package/dist/parallel/agent-farm.js.map +1 -0
- package/dist/parallel/farm-scheduler.d.ts +115 -0
- package/dist/parallel/farm-scheduler.d.ts.map +1 -0
- package/dist/parallel/farm-scheduler.js +356 -0
- package/dist/parallel/farm-scheduler.js.map +1 -0
- package/dist/parallel/farm-types.d.ts +104 -0
- package/dist/parallel/farm-types.d.ts.map +1 -0
- package/dist/parallel/farm-types.js +9 -0
- package/dist/parallel/farm-types.js.map +1 -0
- package/dist/parallel/farm-worker.d.ts +62 -0
- package/dist/parallel/farm-worker.d.ts.map +1 -0
- package/dist/parallel/farm-worker.js +268 -0
- package/dist/parallel/farm-worker.js.map +1 -0
- package/dist/parallel/index.d.ts +14 -0
- package/dist/parallel/index.d.ts.map +1 -0
- package/dist/parallel/index.js +14 -0
- package/dist/parallel/index.js.map +1 -0
- package/dist/plugin/native-tools.d.ts +8 -0
- package/dist/plugin/native-tools.d.ts.map +1 -0
- package/dist/plugin/native-tools.js +147 -0
- package/dist/plugin/native-tools.js.map +1 -0
- package/dist/plugin/opencode-plugin.d.ts +32 -0
- package/dist/plugin/opencode-plugin.d.ts.map +1 -0
- package/dist/plugin/opencode-plugin.js +119 -0
- package/dist/plugin/opencode-plugin.js.map +1 -0
- package/dist/plugins/plugin-system.d.ts +108 -0
- package/dist/plugins/plugin-system.d.ts.map +1 -0
- package/dist/plugins/plugin-system.js +707 -0
- package/dist/plugins/plugin-system.js.map +1 -0
- package/dist/profiler/cpu-profiler.d.ts +53 -0
- package/dist/profiler/cpu-profiler.d.ts.map +1 -0
- package/dist/profiler/cpu-profiler.js +233 -0
- package/dist/profiler/cpu-profiler.js.map +1 -0
- package/dist/profiler/index.d.ts +36 -0
- package/dist/profiler/index.d.ts.map +1 -0
- package/dist/profiler/index.js +122 -0
- package/dist/profiler/index.js.map +1 -0
- package/dist/profiler/memory-profiler.d.ts +45 -0
- package/dist/profiler/memory-profiler.d.ts.map +1 -0
- package/dist/profiler/memory-profiler.js +211 -0
- package/dist/profiler/memory-profiler.js.map +1 -0
- package/dist/profiler/profiler-types.d.ts +234 -0
- package/dist/profiler/profiler-types.d.ts.map +1 -0
- package/dist/profiler/profiler-types.js +89 -0
- package/dist/profiler/profiler-types.js.map +1 -0
- package/dist/profiler/query-profiler.d.ts +48 -0
- package/dist/profiler/query-profiler.d.ts.map +1 -0
- package/dist/profiler/query-profiler.js +210 -0
- package/dist/profiler/query-profiler.js.map +1 -0
- package/dist/profiler/report-generator.d.ts +17 -0
- package/dist/profiler/report-generator.d.ts.map +1 -0
- package/dist/profiler/report-generator.js +329 -0
- package/dist/profiler/report-generator.js.map +1 -0
- package/dist/sdk/api.d.ts +85 -0
- package/dist/sdk/api.d.ts.map +1 -0
- package/dist/sdk/api.js +155 -0
- package/dist/sdk/api.js.map +1 -0
- package/dist/sdk/hooks.d.ts +58 -0
- package/dist/sdk/hooks.d.ts.map +1 -0
- package/dist/sdk/hooks.js +115 -0
- package/dist/sdk/hooks.js.map +1 -0
- package/dist/sdk/index.d.ts +17 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +14 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/plugin-base.d.ts +198 -0
- package/dist/sdk/plugin-base.d.ts.map +1 -0
- package/dist/sdk/plugin-base.js +227 -0
- package/dist/sdk/plugin-base.js.map +1 -0
- package/dist/security/audit-rules.d.ts +12 -0
- package/dist/security/audit-rules.d.ts.map +1 -0
- package/dist/security/audit-rules.js +214 -0
- package/dist/security/audit-rules.js.map +1 -0
- package/dist/security/index.d.ts +13 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +13 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/sarif-exporter.d.ts +36 -0
- package/dist/security/sarif-exporter.d.ts.map +1 -0
- package/dist/security/sarif-exporter.js +216 -0
- package/dist/security/sarif-exporter.js.map +1 -0
- package/dist/security/security-auditor.d.ts +30 -0
- package/dist/security/security-auditor.d.ts.map +1 -0
- package/dist/security/security-auditor.js +295 -0
- package/dist/security/security-auditor.js.map +1 -0
- package/dist/security/security-types.d.ts +132 -0
- package/dist/security/security-types.d.ts.map +1 -0
- package/dist/security/security-types.js +7 -0
- package/dist/security/security-types.js.map +1 -0
- package/dist/synapsexcoder/agent-delegate.d.ts +128 -0
- package/dist/synapsexcoder/agent-delegate.d.ts.map +1 -0
- package/dist/synapsexcoder/agent-delegate.js +837 -0
- package/dist/synapsexcoder/agent-delegate.js.map +1 -0
- package/dist/synapsexcoder/agent-mailbox.d.ts +26 -0
- package/dist/synapsexcoder/agent-mailbox.d.ts.map +1 -0
- package/dist/synapsexcoder/agent-mailbox.js +64 -0
- package/dist/synapsexcoder/agent-mailbox.js.map +1 -0
- package/dist/synapsexcoder/ast-grep/ast-grep-api.d.ts +62 -0
- package/dist/synapsexcoder/ast-grep/ast-grep-api.d.ts.map +1 -0
- package/dist/synapsexcoder/ast-grep/ast-grep-api.js +223 -0
- package/dist/synapsexcoder/ast-grep/ast-grep-api.js.map +1 -0
- package/dist/synapsexcoder/cited-search.d.ts +32 -0
- package/dist/synapsexcoder/cited-search.d.ts.map +1 -0
- package/dist/synapsexcoder/cited-search.js +141 -0
- package/dist/synapsexcoder/cited-search.js.map +1 -0
- package/dist/synapsexcoder/credential-store.d.ts +42 -0
- package/dist/synapsexcoder/credential-store.d.ts.map +1 -0
- package/dist/synapsexcoder/credential-store.js +165 -0
- package/dist/synapsexcoder/credential-store.js.map +1 -0
- package/dist/synapsexcoder/devcontainer-awareness.d.ts +35 -0
- package/dist/synapsexcoder/devcontainer-awareness.d.ts.map +1 -0
- package/dist/synapsexcoder/devcontainer-awareness.js +133 -0
- package/dist/synapsexcoder/devcontainer-awareness.js.map +1 -0
- package/dist/synapsexcoder/execution-loops/helix-loop.d.ts +31 -0
- package/dist/synapsexcoder/execution-loops/helix-loop.d.ts.map +1 -0
- package/dist/synapsexcoder/execution-loops/helix-loop.js +93 -0
- package/dist/synapsexcoder/execution-loops/helix-loop.js.map +1 -0
- package/dist/synapsexcoder/execution-loops/ralp-loop.d.ts +28 -0
- package/dist/synapsexcoder/execution-loops/ralp-loop.d.ts.map +1 -0
- package/dist/synapsexcoder/execution-loops/ralp-loop.js +77 -0
- package/dist/synapsexcoder/execution-loops/ralp-loop.js.map +1 -0
- package/dist/synapsexcoder/feature-names.d.ts +27 -0
- package/dist/synapsexcoder/feature-names.d.ts.map +1 -0
- package/dist/synapsexcoder/feature-names.js +40 -0
- package/dist/synapsexcoder/feature-names.js.map +1 -0
- package/dist/synapsexcoder/index.d.ts +39 -0
- package/dist/synapsexcoder/index.d.ts.map +1 -0
- package/dist/synapsexcoder/index.js +23 -0
- package/dist/synapsexcoder/index.js.map +1 -0
- package/dist/synapsexcoder/knowledge-provider.d.ts +44 -0
- package/dist/synapsexcoder/knowledge-provider.d.ts.map +1 -0
- package/dist/synapsexcoder/knowledge-provider.js +107 -0
- package/dist/synapsexcoder/knowledge-provider.js.map +1 -0
- package/dist/synapsexcoder/lsp/lsp-layer.d.ts +51 -0
- package/dist/synapsexcoder/lsp/lsp-layer.d.ts.map +1 -0
- package/dist/synapsexcoder/lsp/lsp-layer.js +302 -0
- package/dist/synapsexcoder/lsp/lsp-layer.js.map +1 -0
- package/dist/synapsexcoder/migration/opencode-config-migrator.d.ts +37 -0
- package/dist/synapsexcoder/migration/opencode-config-migrator.d.ts.map +1 -0
- package/dist/synapsexcoder/migration/opencode-config-migrator.js +100 -0
- package/dist/synapsexcoder/migration/opencode-config-migrator.js.map +1 -0
- package/dist/synapsexcoder/runtime-environment.d.ts +35 -0
- package/dist/synapsexcoder/runtime-environment.d.ts.map +1 -0
- package/dist/synapsexcoder/runtime-environment.js +108 -0
- package/dist/synapsexcoder/runtime-environment.js.map +1 -0
- package/dist/synapsexcoder/secret-guard.d.ts +18 -0
- package/dist/synapsexcoder/secret-guard.d.ts.map +1 -0
- package/dist/synapsexcoder/secret-guard.js +69 -0
- package/dist/synapsexcoder/secret-guard.js.map +1 -0
- package/dist/synapsexcoder/self-prompt-engine.d.ts +15 -0
- package/dist/synapsexcoder/self-prompt-engine.d.ts.map +1 -0
- package/dist/synapsexcoder/self-prompt-engine.js +11 -0
- package/dist/synapsexcoder/self-prompt-engine.js.map +1 -0
- package/dist/synapsexcoder/session-observability.d.ts +44 -0
- package/dist/synapsexcoder/session-observability.d.ts.map +1 -0
- package/dist/synapsexcoder/session-observability.js +115 -0
- package/dist/synapsexcoder/session-observability.js.map +1 -0
- package/dist/synapsexcoder/specialist-agents.d.ts +38 -0
- package/dist/synapsexcoder/specialist-agents.d.ts.map +1 -0
- package/dist/synapsexcoder/specialist-agents.js +192 -0
- package/dist/synapsexcoder/specialist-agents.js.map +1 -0
- package/dist/synapsexcoder/swarm/kanban-board.d.ts +34 -0
- package/dist/synapsexcoder/swarm/kanban-board.d.ts.map +1 -0
- package/dist/synapsexcoder/swarm/kanban-board.js +85 -0
- package/dist/synapsexcoder/swarm/kanban-board.js.map +1 -0
- package/dist/synapsexcoder/swarm/swarm-mailbox.d.ts +38 -0
- package/dist/synapsexcoder/swarm/swarm-mailbox.d.ts.map +1 -0
- package/dist/synapsexcoder/swarm/swarm-mailbox.js +93 -0
- package/dist/synapsexcoder/swarm/swarm-mailbox.js.map +1 -0
- package/dist/synapsexcoder/tool-bridge.d.ts +277 -0
- package/dist/synapsexcoder/tool-bridge.d.ts.map +1 -0
- package/dist/synapsexcoder/tool-bridge.js +1356 -0
- package/dist/synapsexcoder/tool-bridge.js.map +1 -0
- package/dist/synapsexcoder/tool-routing.d.ts +28 -0
- package/dist/synapsexcoder/tool-routing.d.ts.map +1 -0
- package/dist/synapsexcoder/tool-routing.js +79 -0
- package/dist/synapsexcoder/tool-routing.js.map +1 -0
- package/dist/synapsexcoder/type-injector.d.ts +26 -0
- package/dist/synapsexcoder/type-injector.d.ts.map +1 -0
- package/dist/synapsexcoder/type-injector.js +124 -0
- package/dist/synapsexcoder/type-injector.js.map +1 -0
- package/dist/synapsexcoder/utils/fuzzy-match.d.ts +25 -0
- package/dist/synapsexcoder/utils/fuzzy-match.d.ts.map +1 -0
- package/dist/synapsexcoder/utils/fuzzy-match.js +83 -0
- package/dist/synapsexcoder/utils/fuzzy-match.js.map +1 -0
- package/dist/synapsexcoder/vault-crawl.d.ts +29 -0
- package/dist/synapsexcoder/vault-crawl.d.ts.map +1 -0
- package/dist/synapsexcoder/vault-crawl.js +103 -0
- package/dist/synapsexcoder/vault-crawl.js.map +1 -0
- package/dist/synapsexcoder/verified-apply.d.ts +39 -0
- package/dist/synapsexcoder/verified-apply.d.ts.map +1 -0
- package/dist/synapsexcoder/verified-apply.js +81 -0
- package/dist/synapsexcoder/verified-apply.js.map +1 -0
- package/dist/synapsexcoder/verified-context-editing.d.ts +34 -0
- package/dist/synapsexcoder/verified-context-editing.d.ts.map +1 -0
- package/dist/synapsexcoder/verified-context-editing.js +80 -0
- package/dist/synapsexcoder/verified-context-editing.js.map +1 -0
- package/dist/synapsexcoder/worker-pool.d.ts +47 -0
- package/dist/synapsexcoder/worker-pool.d.ts.map +1 -0
- package/dist/synapsexcoder/worker-pool.js +120 -0
- package/dist/synapsexcoder/worker-pool.js.map +1 -0
- package/dist/synapsexcoder/workspace-intelligence.d.ts +35 -0
- package/dist/synapsexcoder/workspace-intelligence.d.ts.map +1 -0
- package/dist/synapsexcoder/workspace-intelligence.js +126 -0
- package/dist/synapsexcoder/workspace-intelligence.js.map +1 -0
- package/dist/synapsexcoder/worktree-manager.d.ts +31 -0
- package/dist/synapsexcoder/worktree-manager.d.ts.map +1 -0
- package/dist/synapsexcoder/worktree-manager.js +100 -0
- package/dist/synapsexcoder/worktree-manager.js.map +1 -0
- package/dist/team/index.d.ts +17 -0
- package/dist/team/index.d.ts.map +1 -0
- package/dist/team/index.js +13 -0
- package/dist/team/index.js.map +1 -0
- package/dist/team/team-audit.d.ts +120 -0
- package/dist/team/team-audit.d.ts.map +1 -0
- package/dist/team/team-audit.js +357 -0
- package/dist/team/team-audit.js.map +1 -0
- package/dist/team/team-collaboration.d.ts +150 -0
- package/dist/team/team-collaboration.d.ts.map +1 -0
- package/dist/team/team-collaboration.js +495 -0
- package/dist/team/team-collaboration.js.map +1 -0
- package/dist/team/team-rbac.d.ts +84 -0
- package/dist/team/team-rbac.d.ts.map +1 -0
- package/dist/team/team-rbac.js +259 -0
- package/dist/team/team-rbac.js.map +1 -0
- package/dist/team/team-session-manager.d.ts +100 -0
- package/dist/team/team-session-manager.d.ts.map +1 -0
- package/dist/team/team-session-manager.js +255 -0
- package/dist/team/team-session-manager.js.map +1 -0
- package/dist/thoughts/thoughts-manager.d.ts +52 -0
- package/dist/thoughts/thoughts-manager.d.ts.map +1 -0
- package/dist/thoughts/thoughts-manager.js +271 -0
- package/dist/thoughts/thoughts-manager.js.map +1 -0
- package/dist/tools/api-validator/index.d.ts +97 -0
- package/dist/tools/api-validator/index.d.ts.map +1 -0
- package/dist/tools/api-validator/index.js +312 -0
- package/dist/tools/api-validator/index.js.map +1 -0
- package/dist/tools/code-archaeology/index.d.ts +193 -0
- package/dist/tools/code-archaeology/index.d.ts.map +1 -0
- package/dist/tools/code-archaeology/index.js +468 -0
- package/dist/tools/code-archaeology/index.js.map +1 -0
- package/dist/tools/codebase-search/index.d.ts +126 -0
- package/dist/tools/codebase-search/index.d.ts.map +1 -0
- package/dist/tools/codebase-search/index.js +437 -0
- package/dist/tools/codebase-search/index.js.map +1 -0
- package/dist/tools/context/index.d.ts +162 -0
- package/dist/tools/context/index.d.ts.map +1 -0
- package/dist/tools/context/index.js +332 -0
- package/dist/tools/context/index.js.map +1 -0
- package/dist/tools/deepwiki/analyzer.d.ts +167 -0
- package/dist/tools/deepwiki/analyzer.d.ts.map +1 -0
- package/dist/tools/deepwiki/analyzer.js +925 -0
- package/dist/tools/deepwiki/analyzer.js.map +1 -0
- package/dist/tools/deepwiki/extractor.d.ts +151 -0
- package/dist/tools/deepwiki/extractor.d.ts.map +1 -0
- package/dist/tools/deepwiki/extractor.js +923 -0
- package/dist/tools/deepwiki/extractor.js.map +1 -0
- package/dist/tools/deepwiki/generator.d.ts +89 -0
- package/dist/tools/deepwiki/generator.d.ts.map +1 -0
- package/dist/tools/deepwiki/generator.js +638 -0
- package/dist/tools/deepwiki/generator.js.map +1 -0
- package/dist/tools/deepwiki/index.d.ts +96 -0
- package/dist/tools/deepwiki/index.d.ts.map +1 -0
- package/dist/tools/deepwiki/index.js +282 -0
- package/dist/tools/deepwiki/index.js.map +1 -0
- package/dist/tools/deepwiki/types.d.ts +370 -0
- package/dist/tools/deepwiki/types.d.ts.map +1 -0
- package/dist/tools/deepwiki/types.js +21 -0
- package/dist/tools/deepwiki/types.js.map +1 -0
- package/dist/tools/dependency-mapper/index.d.ts +212 -0
- package/dist/tools/dependency-mapper/index.d.ts.map +1 -0
- package/dist/tools/dependency-mapper/index.js +592 -0
- package/dist/tools/dependency-mapper/index.js.map +1 -0
- package/dist/tools/memory/index.d.ts +120 -0
- package/dist/tools/memory/index.d.ts.map +1 -0
- package/dist/tools/memory/index.js +275 -0
- package/dist/tools/memory/index.js.map +1 -0
- package/dist/tools/normalize_patch.d.ts +3 -0
- package/dist/tools/normalize_patch.d.ts.map +1 -0
- package/dist/tools/normalize_patch.js +22 -0
- package/dist/tools/normalize_patch.js.map +1 -0
- package/dist/tools/pattern-detector/index.d.ts +105 -0
- package/dist/tools/pattern-detector/index.d.ts.map +1 -0
- package/dist/tools/pattern-detector/index.js +526 -0
- package/dist/tools/pattern-detector/index.js.map +1 -0
- package/dist/tools/performance-profiler/index.d.ts +50 -0
- package/dist/tools/performance-profiler/index.d.ts.map +1 -0
- package/dist/tools/performance-profiler/index.js +164 -0
- package/dist/tools/performance-profiler/index.js.map +1 -0
- package/dist/tools/refactoring-engine/index.d.ts +63 -0
- package/dist/tools/refactoring-engine/index.d.ts.map +1 -0
- package/dist/tools/refactoring-engine/index.js +270 -0
- package/dist/tools/refactoring-engine/index.js.map +1 -0
- package/dist/tools/registry.d.ts +36 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +499 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/test-generator/index.d.ts +152 -0
- package/dist/tools/test-generator/index.d.ts.map +1 -0
- package/dist/tools/test-generator/index.js +448 -0
- package/dist/tools/test-generator/index.js.map +1 -0
- package/dist/types/index.d.ts +565 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/path-validator.d.ts +94 -0
- package/dist/utils/path-validator.d.ts.map +1 -0
- package/dist/utils/path-validator.js +192 -0
- package/dist/utils/path-validator.js.map +1 -0
- package/dist/utils/secure-exec.d.ts +92 -0
- package/dist/utils/secure-exec.d.ts.map +1 -0
- package/dist/utils/secure-exec.js +230 -0
- package/dist/utils/secure-exec.js.map +1 -0
- package/dist/verification/claim-parser.d.ts +37 -0
- package/dist/verification/claim-parser.d.ts.map +1 -0
- package/dist/verification/claim-parser.js +231 -0
- package/dist/verification/claim-parser.js.map +1 -0
- package/dist/verification/cross-reference-engine.d.ts +55 -0
- package/dist/verification/cross-reference-engine.d.ts.map +1 -0
- package/dist/verification/cross-reference-engine.js +149 -0
- package/dist/verification/cross-reference-engine.js.map +1 -0
- package/dist/verification/discrepancy-tracker.d.ts +73 -0
- package/dist/verification/discrepancy-tracker.d.ts.map +1 -0
- package/dist/verification/discrepancy-tracker.js +196 -0
- package/dist/verification/discrepancy-tracker.js.map +1 -0
- package/dist/verification/feature-reconciler.d.ts +90 -0
- package/dist/verification/feature-reconciler.d.ts.map +1 -0
- package/dist/verification/feature-reconciler.js +264 -0
- package/dist/verification/feature-reconciler.js.map +1 -0
- package/dist/verification/index.d.ts +16 -0
- package/dist/verification/index.d.ts.map +1 -0
- package/dist/verification/index.js +19 -0
- package/dist/verification/index.js.map +1 -0
- package/dist/verification/integration-verifier.d.ts +66 -0
- package/dist/verification/integration-verifier.d.ts.map +1 -0
- package/dist/verification/integration-verifier.js +210 -0
- package/dist/verification/integration-verifier.js.map +1 -0
- package/dist/verification/recursive-audit-loop.d.ts +56 -0
- package/dist/verification/recursive-audit-loop.d.ts.map +1 -0
- package/dist/verification/recursive-audit-loop.js +136 -0
- package/dist/verification/recursive-audit-loop.js.map +1 -0
- package/dist/verification/runtime-verifier.d.ts +37 -0
- package/dist/verification/runtime-verifier.d.ts.map +1 -0
- package/dist/verification/runtime-verifier.js +221 -0
- package/dist/verification/runtime-verifier.js.map +1 -0
- package/dist/verification/types.d.ts +88 -0
- package/dist/verification/types.d.ts.map +1 -0
- package/dist/verification/types.js +5 -0
- package/dist/verification/types.js.map +1 -0
- package/dist/verification/verification-engine.d.ts +48 -0
- package/dist/verification/verification-engine.d.ts.map +1 -0
- package/dist/verification/verification-engine.js +203 -0
- package/dist/verification/verification-engine.js.map +1 -0
- package/opencode-agents/synapse-analyzer.md +64 -0
- package/opencode-agents/synapse-debugger.md +43 -0
- package/opencode-agents/synapse-diff-validator.md +42 -0
- package/opencode-agents/synapse-gatekeeper.md +273 -0
- package/opencode-agents/synapse-master.md +167 -0
- package/opencode-agents/synapse-planner.md +55 -0
- package/opencode-agents/synapse-researcher.md +61 -0
- package/opencode-agents/synapse-reviewer.md +64 -0
- package/opencode-agents/synapse-rewriter.md +62 -0
- package/opencode-agents/synapse-strategist.md +50 -0
- package/opencode-agents/synapse-test-runner.md +43 -0
- package/opencode-agents/synapse-ui-designer.md +61 -0
- package/opencode-agents/synapse-verifier.md +544 -0
- package/package.json +108 -0
- package/src/plugin/opencode-plugin.ts +141 -0
|
@@ -0,0 +1,707 @@
|
|
|
1
|
+
/** Plugin System */
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync } from "fs";
|
|
4
|
+
import { join, resolve } from "path";
|
|
5
|
+
export class BasePlugin {
|
|
6
|
+
context;
|
|
7
|
+
constructor(context) {
|
|
8
|
+
this.context = context;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Internal helpers
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
/**
|
|
15
|
+
* Validate that a loaded module exports the mandatory plugin contract
|
|
16
|
+
* (`activate` and `deactivate` functions). Returns the cast module on
|
|
17
|
+
* success, throws a descriptive error otherwise.
|
|
18
|
+
*/
|
|
19
|
+
function assertPluginModule(mod, entryPath) {
|
|
20
|
+
if (mod === null || typeof mod !== "object") {
|
|
21
|
+
throw new Error(`Plugin entry point "${entryPath}" did not export an object.`);
|
|
22
|
+
}
|
|
23
|
+
const candidate = mod;
|
|
24
|
+
// Support both CommonJS default exports and ES module default re-exports
|
|
25
|
+
const target = candidate["default"] !== undefined &&
|
|
26
|
+
typeof candidate["default"] === "object" &&
|
|
27
|
+
candidate["default"] !== null
|
|
28
|
+
? candidate["default"]
|
|
29
|
+
: candidate;
|
|
30
|
+
if (typeof target["activate"] !== "function") {
|
|
31
|
+
throw new Error(`Plugin entry point "${entryPath}" is missing an exported "activate" function.`);
|
|
32
|
+
}
|
|
33
|
+
if (typeof target["deactivate"] !== "function") {
|
|
34
|
+
throw new Error(`Plugin entry point "${entryPath}" is missing an exported "deactivate" function.`);
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Synchronously load a plugin module from the given absolute path using
|
|
40
|
+
* `createRequire` (works in both CJS and ESM host contexts).
|
|
41
|
+
*/
|
|
42
|
+
function loadPluginModule(entryPath) {
|
|
43
|
+
// createRequire lets us use require() semantics from an ESM context.
|
|
44
|
+
const _require = createRequire(import.meta.url);
|
|
45
|
+
const raw = _require(entryPath);
|
|
46
|
+
return assertPluginModule(raw, entryPath);
|
|
47
|
+
}
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// PluginManager
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
export class PluginManager {
|
|
52
|
+
pluginsDir;
|
|
53
|
+
plugins = new Map();
|
|
54
|
+
constructor(projectRoot, _masterAgent) {
|
|
55
|
+
this.pluginsDir = join(projectRoot, "plugins");
|
|
56
|
+
if (!existsSync(this.pluginsDir))
|
|
57
|
+
mkdirSync(this.pluginsDir, { recursive: true });
|
|
58
|
+
this.loadPluginFiles();
|
|
59
|
+
}
|
|
60
|
+
loadPluginFiles() {
|
|
61
|
+
if (!existsSync(this.pluginsDir))
|
|
62
|
+
return;
|
|
63
|
+
for (const dirent of readdirSync(this.pluginsDir, {
|
|
64
|
+
withFileTypes: true,
|
|
65
|
+
}).filter((d) => d.isDirectory())) {
|
|
66
|
+
const pluginDir = join(this.pluginsDir, dirent.name);
|
|
67
|
+
const manifestPath = join(pluginDir, "manifest.json");
|
|
68
|
+
if (!existsSync(manifestPath))
|
|
69
|
+
continue;
|
|
70
|
+
let manifest;
|
|
71
|
+
try {
|
|
72
|
+
manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
73
|
+
}
|
|
74
|
+
catch (parseErr) {
|
|
75
|
+
// Malformed manifest — skip without polluting the registry.
|
|
76
|
+
console.warn(`[PluginManager] Skipping "${dirent.name}": invalid manifest.json — ${String(parseErr)}`);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
// Resolve the entry point relative to the plugin's own directory.
|
|
80
|
+
const resolvedEntryPoint = resolve(pluginDir, manifest.entryPoint);
|
|
81
|
+
let instance = null;
|
|
82
|
+
let state = "loaded";
|
|
83
|
+
let loadError;
|
|
84
|
+
if (!existsSync(resolvedEntryPoint)) {
|
|
85
|
+
state = "error";
|
|
86
|
+
loadError = `Entry point not found: "${resolvedEntryPoint}"`;
|
|
87
|
+
console.error(`[PluginManager] Failed to load plugin "${manifest.id}": ${loadError}`);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
try {
|
|
91
|
+
instance = loadPluginModule(resolvedEntryPoint);
|
|
92
|
+
console.info(`[PluginManager] Loaded plugin "${manifest.id}" v${manifest.version} from "${resolvedEntryPoint}"`);
|
|
93
|
+
}
|
|
94
|
+
catch (loadErr) {
|
|
95
|
+
state = "error";
|
|
96
|
+
loadError = String(loadErr);
|
|
97
|
+
console.error(`[PluginManager] Failed to load plugin "${manifest.id}": ${loadError}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
this.plugins.set(manifest.id, {
|
|
101
|
+
manifest,
|
|
102
|
+
instance,
|
|
103
|
+
enabled: state === "loaded",
|
|
104
|
+
loadedAt: Date.now(),
|
|
105
|
+
state,
|
|
106
|
+
...(loadError !== undefined ? { loadError } : {}),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
listPlugins() {
|
|
111
|
+
return [...this.plugins.values()];
|
|
112
|
+
}
|
|
113
|
+
getPlugin(pluginId) {
|
|
114
|
+
return this.plugins.get(pluginId);
|
|
115
|
+
}
|
|
116
|
+
enablePlugin(pluginId) {
|
|
117
|
+
const p = this.plugins.get(pluginId);
|
|
118
|
+
if (!p)
|
|
119
|
+
return false;
|
|
120
|
+
p.enabled = true;
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
disablePlugin(pluginId) {
|
|
124
|
+
const p = this.plugins.get(pluginId);
|
|
125
|
+
if (!p)
|
|
126
|
+
return false;
|
|
127
|
+
p.enabled = false;
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
getStats() {
|
|
131
|
+
const all = [...this.plugins.values()];
|
|
132
|
+
const byType = {};
|
|
133
|
+
for (const p of all)
|
|
134
|
+
byType[p.manifest.type] = (byType[p.manifest.type] || 0) + 1;
|
|
135
|
+
return {
|
|
136
|
+
total: all.length,
|
|
137
|
+
enabled: all.filter((p) => p.enabled).length,
|
|
138
|
+
disabled: all.filter((p) => !p.enabled).length,
|
|
139
|
+
errored: all.filter((p) => p.state === "error").length,
|
|
140
|
+
byType,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
// -------------------------------------------------------------------------
|
|
144
|
+
// Template & scaffold generation
|
|
145
|
+
// -------------------------------------------------------------------------
|
|
146
|
+
/**
|
|
147
|
+
* Return a complete, valid TypeScript plugin template for the given type.
|
|
148
|
+
*
|
|
149
|
+
* Every template:
|
|
150
|
+
* - Implements the `PluginModule` interface contract
|
|
151
|
+
* - Includes JSDoc on every method
|
|
152
|
+
* - Has realistic example logic for the type's primary hook
|
|
153
|
+
* - Ends with an `export default` statement
|
|
154
|
+
*/
|
|
155
|
+
createPluginTemplate(type) {
|
|
156
|
+
// Shared header used by every template.
|
|
157
|
+
const header = (hookComment) => `/**
|
|
158
|
+
* SynapseXcoder Plugin — type: "${type}"
|
|
159
|
+
*
|
|
160
|
+
* ${hookComment}
|
|
161
|
+
*
|
|
162
|
+
* Generated by SynapseXcoder PluginManager.
|
|
163
|
+
* Implement the hooks below to integrate with the pipeline.
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
import type { PluginContext } from "SynapseXcoder/plugins";
|
|
167
|
+
|
|
168
|
+
// Stored reference to the plugin context, set during activate().
|
|
169
|
+
let _context: PluginContext | null = null;
|
|
170
|
+
`;
|
|
171
|
+
switch (type) {
|
|
172
|
+
// ------------------------------------------------------------------
|
|
173
|
+
// agent — handles raw prompts and returns augmented/alternate responses
|
|
174
|
+
// ------------------------------------------------------------------
|
|
175
|
+
case "agent":
|
|
176
|
+
return (header("Agent plugins intercept prompts and return processed responses.") +
|
|
177
|
+
`
|
|
178
|
+
/** Called once when the plugin is enabled. Use this to set up resources. */
|
|
179
|
+
export function activate(context: PluginContext): void {
|
|
180
|
+
_context = context;
|
|
181
|
+
_context.logger(\`[${type}-plugin] activated\`);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Called once when the plugin is disabled or the host shuts down. */
|
|
185
|
+
export function deactivate(): void {
|
|
186
|
+
_context?.logger(\`[${type}-plugin] deactivated\`);
|
|
187
|
+
_context = null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Handle a prompt string.
|
|
192
|
+
*
|
|
193
|
+
* @param prompt - The raw user or pipeline prompt.
|
|
194
|
+
* @returns A modified or augmented prompt/response string.
|
|
195
|
+
*/
|
|
196
|
+
export function handlePrompt(prompt: string): string {
|
|
197
|
+
// Example: prefix every prompt with additional context.
|
|
198
|
+
const prefix = "[agent-plugin context] ";
|
|
199
|
+
const processed = \`\${prefix}\${prompt}\`;
|
|
200
|
+
_context?.logger(\`[${type}-plugin] handlePrompt called (${"\${prompt.length}"} chars)\`);
|
|
201
|
+
return processed;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export default { activate, deactivate, handlePrompt };
|
|
205
|
+
`);
|
|
206
|
+
// ------------------------------------------------------------------
|
|
207
|
+
// command — registers named CLI/chat commands into the pipeline
|
|
208
|
+
// ------------------------------------------------------------------
|
|
209
|
+
case "command":
|
|
210
|
+
return (header("Command plugins register named handlers into the pipeline.") +
|
|
211
|
+
`
|
|
212
|
+
/** Called once when the plugin is enabled. Registers all commands. */
|
|
213
|
+
export function activate(context: PluginContext): void {
|
|
214
|
+
_context = context;
|
|
215
|
+
_context.logger(\`[${type}-plugin] activated\`);
|
|
216
|
+
|
|
217
|
+
// Register each command this plugin provides.
|
|
218
|
+
_context.registerCommand?.("my-command", handleMyCommand);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** Called once when the plugin is disabled or the host shuts down. */
|
|
222
|
+
export function deactivate(): void {
|
|
223
|
+
_context?.logger(\`[${type}-plugin] deactivated\`);
|
|
224
|
+
_context = null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Example command handler.
|
|
229
|
+
*
|
|
230
|
+
* @param args - Positional arguments passed to the command.
|
|
231
|
+
* @returns The command result that will be surfaced to the caller.
|
|
232
|
+
*/
|
|
233
|
+
function handleMyCommand(...args: unknown[]): string {
|
|
234
|
+
_context?.logger(\`[${type}-plugin] my-command invoked with \${args.length} args\`);
|
|
235
|
+
return \`my-command executed with args: \${JSON.stringify(args)}\`;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Expose the commands map for direct introspection. */
|
|
239
|
+
export const commands: Record<string, (...args: unknown[]) => unknown> = {
|
|
240
|
+
"my-command": handleMyCommand,
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export default { activate, deactivate, commands };
|
|
244
|
+
`);
|
|
245
|
+
// ------------------------------------------------------------------
|
|
246
|
+
// tool — contributes named tools to the tool registry
|
|
247
|
+
// ------------------------------------------------------------------
|
|
248
|
+
case "tool":
|
|
249
|
+
return (header("Tool plugins expose named tools to the agent tool registry.") +
|
|
250
|
+
`
|
|
251
|
+
/** Example tool implementation. */
|
|
252
|
+
const myTool = {
|
|
253
|
+
/** Human-readable description used by the planner when selecting tools. */
|
|
254
|
+
description: "An example tool contributed by this plugin.",
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Execute the tool.
|
|
258
|
+
*
|
|
259
|
+
* @param input - Arbitrary input data for the tool.
|
|
260
|
+
* @returns The tool result.
|
|
261
|
+
*/
|
|
262
|
+
execute(input: unknown): unknown {
|
|
263
|
+
_context?.logger(\`[${type}-plugin] myTool.execute called\`);
|
|
264
|
+
// Plugin tool execution: passes input through with metadata
|
|
265
|
+
return { result: "ok", echo: input, executedAt: new Date().toISOString() };
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
/** Called once when the plugin is enabled. Registers all tools. */
|
|
270
|
+
export function activate(context: PluginContext): void {
|
|
271
|
+
_context = context;
|
|
272
|
+
_context.logger(\`[${type}-plugin] activated\`);
|
|
273
|
+
_context.registerTool?.("my-tool", myTool);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** Called once when the plugin is disabled or the host shuts down. */
|
|
277
|
+
export function deactivate(): void {
|
|
278
|
+
_context?.logger(\`[${type}-plugin] deactivated\`);
|
|
279
|
+
_context = null;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** Expose the tools map for direct introspection. */
|
|
283
|
+
export const tools: Record<string, unknown> = {
|
|
284
|
+
"my-tool": myTool,
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export default { activate, deactivate, tools };
|
|
288
|
+
`);
|
|
289
|
+
// ------------------------------------------------------------------
|
|
290
|
+
// context — injects additional context into the execution pipeline
|
|
291
|
+
// ------------------------------------------------------------------
|
|
292
|
+
case "context":
|
|
293
|
+
return (header("Context plugins inject supplemental context into the execution pipeline.") +
|
|
294
|
+
`
|
|
295
|
+
/** Called once when the plugin is enabled. */
|
|
296
|
+
export function activate(context: PluginContext): void {
|
|
297
|
+
_context = context;
|
|
298
|
+
_context.logger(\`[${type}-plugin] activated\`);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Called once when the plugin is disabled or the host shuts down. */
|
|
302
|
+
export function deactivate(): void {
|
|
303
|
+
_context?.logger(\`[${type}-plugin] deactivated\`);
|
|
304
|
+
_context = null;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Return additional context key/value pairs to inject into the pipeline.
|
|
309
|
+
*
|
|
310
|
+
* @returns A plain object whose keys will be merged into the execution context.
|
|
311
|
+
*/
|
|
312
|
+
export function getContext(): Record<string, unknown> {
|
|
313
|
+
_context?.logger(\`[${type}-plugin] getContext called\`);
|
|
314
|
+
return {
|
|
315
|
+
pluginProvidedAt: new Date().toISOString(),
|
|
316
|
+
environment: process.env["NODE_ENV"] ?? "development",
|
|
317
|
+
// Plugin context keys available for execution
|
|
318
|
+
pluginName: type,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export default { activate, deactivate, getContext };
|
|
323
|
+
`);
|
|
324
|
+
// ------------------------------------------------------------------
|
|
325
|
+
// knowledge — answers domain-specific knowledge queries
|
|
326
|
+
// ------------------------------------------------------------------
|
|
327
|
+
case "knowledge":
|
|
328
|
+
return (header("Knowledge plugins answer domain-specific queries from the pipeline.") +
|
|
329
|
+
`
|
|
330
|
+
// Simple in-memory knowledge base. Replace with a real data source.
|
|
331
|
+
const KB: Record<string, string> = {
|
|
332
|
+
"what is synapsexcoder": "SynapseXcoder is a multi-agent AI coding assistant.",
|
|
333
|
+
// Add more entries as needed.
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
/** Called once when the plugin is enabled. */
|
|
337
|
+
export function activate(context: PluginContext): void {
|
|
338
|
+
_context = context;
|
|
339
|
+
_context.logger(\`[${type}-plugin] activated (${"\${Object.keys(KB).length}"} KB entries)\`);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/** Called once when the plugin is disabled or the host shuts down. */
|
|
343
|
+
export function deactivate(): void {
|
|
344
|
+
_context?.logger(\`[${type}-plugin] deactivated\`);
|
|
345
|
+
_context = null;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Answer a knowledge query.
|
|
350
|
+
*
|
|
351
|
+
* @param query - A natural-language question or lookup key.
|
|
352
|
+
* @returns A string answer, or an empty string when no match is found.
|
|
353
|
+
*/
|
|
354
|
+
export function queryKnowledge(query: string): string {
|
|
355
|
+
_context?.logger(\`[${type}-plugin] queryKnowledge: "\${query}"\`);
|
|
356
|
+
const key = query.toLowerCase().trim();
|
|
357
|
+
return KB[key] ?? "";
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export default { activate, deactivate, queryKnowledge };
|
|
361
|
+
`);
|
|
362
|
+
// ------------------------------------------------------------------
|
|
363
|
+
// mixed — combines multiple hook types in a single plugin
|
|
364
|
+
// ------------------------------------------------------------------
|
|
365
|
+
case "mixed":
|
|
366
|
+
default:
|
|
367
|
+
return (header("Mixed plugins combine multiple hook types (agent, command, tool, context, knowledge) in a single module.") +
|
|
368
|
+
`
|
|
369
|
+
/** Called once when the plugin is enabled. Wire up every capability here. */
|
|
370
|
+
export function activate(context: PluginContext): void {
|
|
371
|
+
_context = context;
|
|
372
|
+
_context.logger(\`[${type}-plugin] activated\`);
|
|
373
|
+
|
|
374
|
+
// Register any commands this plugin provides.
|
|
375
|
+
_context.registerCommand?.("mixed-command", (...args: unknown[]) => {
|
|
376
|
+
_context?.logger(\`[${type}-plugin] mixed-command called\`);
|
|
377
|
+
return args;
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// Register any tools this plugin provides.
|
|
381
|
+
_context.registerTool?.("mixed-tool", {
|
|
382
|
+
description: "A multi-purpose tool from the mixed plugin.",
|
|
383
|
+
execute: (input: unknown) => ({ result: "ok", input }),
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/** Called once when the plugin is disabled or the host shuts down. */
|
|
388
|
+
export function deactivate(): void {
|
|
389
|
+
_context?.logger(\`[${type}-plugin] deactivated\`);
|
|
390
|
+
_context = null;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Optional: handle a prompt.
|
|
395
|
+
*
|
|
396
|
+
* @param prompt - The incoming prompt string.
|
|
397
|
+
* @returns The processed prompt.
|
|
398
|
+
*/
|
|
399
|
+
export function handlePrompt(prompt: string): string {
|
|
400
|
+
return prompt; // Pass-through by default; replace with real logic.
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Optional: supply additional context.
|
|
405
|
+
*
|
|
406
|
+
* @returns Key/value pairs merged into the execution context.
|
|
407
|
+
*/
|
|
408
|
+
export function getContext(): Record<string, unknown> {
|
|
409
|
+
return { mixedPluginActive: true };
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export default { activate, deactivate, handlePrompt, getContext };
|
|
413
|
+
`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Generate a complete plugin scaffold for a new plugin.
|
|
418
|
+
*
|
|
419
|
+
* Returns every file needed to publish and use the plugin:
|
|
420
|
+
* - `code` — the plugin's main TypeScript entry point
|
|
421
|
+
* - `packageJson` — a ready-to-publish `package.json` object
|
|
422
|
+
* - `readme` — a Markdown README
|
|
423
|
+
* - `testFile` — a Vitest test stub covering activate/deactivate
|
|
424
|
+
* - `tsConfig` — a minimal `tsconfig.json` for building the plugin
|
|
425
|
+
* - `manifest` — the `PluginManifest` object (also written to disk)
|
|
426
|
+
*/
|
|
427
|
+
createPluginScaffold(type, name) {
|
|
428
|
+
// Derive a safe npm-compatible package name and a PascalCase class name.
|
|
429
|
+
const safeName = name
|
|
430
|
+
.toLowerCase()
|
|
431
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
432
|
+
.replace(/^-+|-+$/g, "");
|
|
433
|
+
const pluginPackageName = `synapsexcoder-plugin-${safeName}`;
|
|
434
|
+
const manifest = {
|
|
435
|
+
id: `${safeName}-${Date.now()}`,
|
|
436
|
+
name,
|
|
437
|
+
version: "1.0.0",
|
|
438
|
+
description: `A SynapseXcoder ${type} plugin — ${name}`,
|
|
439
|
+
author: "Developer",
|
|
440
|
+
type,
|
|
441
|
+
entryPoint: "dist/index.js",
|
|
442
|
+
dependencies: [],
|
|
443
|
+
permissions: [],
|
|
444
|
+
config: {},
|
|
445
|
+
};
|
|
446
|
+
// ── code ────────────────────────────────────────────────────────────────
|
|
447
|
+
// Use createPluginTemplate as the base, then inject the plugin name.
|
|
448
|
+
const baseTemplate = this.createPluginTemplate(type);
|
|
449
|
+
const code = baseTemplate.replace(/SynapseXcoder Plugin — type: "([^"]+)"/, `SynapseXcoder Plugin — ${name} (type: "${type}")`);
|
|
450
|
+
// ── package.json ────────────────────────────────────────────────────────
|
|
451
|
+
const packageJson = {
|
|
452
|
+
name: pluginPackageName,
|
|
453
|
+
version: "1.0.0",
|
|
454
|
+
description: `A SynapseXcoder ${type} plugin — ${name}`,
|
|
455
|
+
type: "module",
|
|
456
|
+
main: "dist/index.js",
|
|
457
|
+
types: "dist/index.d.ts",
|
|
458
|
+
files: ["dist", "manifest.json"],
|
|
459
|
+
scripts: {
|
|
460
|
+
build: "tsc",
|
|
461
|
+
test: "vitest run",
|
|
462
|
+
prepublishOnly: "npm run build",
|
|
463
|
+
},
|
|
464
|
+
keywords: ["synapsexcoder-plugin", `synapsexcoder-${type}`, "synapsexcoder"],
|
|
465
|
+
license: "MIT",
|
|
466
|
+
peerDependencies: {
|
|
467
|
+
"SynapseXcoder": ">=1.0.0.0",
|
|
468
|
+
},
|
|
469
|
+
peerDependenciesMeta: {
|
|
470
|
+
"SynapseXcoder": { optional: false },
|
|
471
|
+
},
|
|
472
|
+
devDependencies: {
|
|
473
|
+
typescript: "^5.5.4",
|
|
474
|
+
vitest: "^4.1.2",
|
|
475
|
+
"SynapseXcoder": ">=1.0.0.0",
|
|
476
|
+
},
|
|
477
|
+
};
|
|
478
|
+
// ── README ───────────────────────────────────────────────────────────────
|
|
479
|
+
const readme = `# ${name}
|
|
480
|
+
|
|
481
|
+
> A SynapseXcoder **${type}** plugin.
|
|
482
|
+
|
|
483
|
+
## Description
|
|
484
|
+
|
|
485
|
+
${name} integrates with the SynapseXcoder pipeline as a \`${type}\` plugin, providing
|
|
486
|
+
${type === "agent" ? "custom prompt-handling logic" : ""}${type === "command" ? "named command handlers" : ""}${type === "tool" ? "named tools for the agent tool registry" : ""}${type === "context" ? "additional context injection" : ""}${type === "knowledge" ? "domain-specific knowledge querying" : ""}${type === "mixed" ? "a combination of hooks (prompt, command, tool, context)" : ""}.
|
|
487
|
+
|
|
488
|
+
## Installation
|
|
489
|
+
|
|
490
|
+
\`\`\`bash
|
|
491
|
+
npm install ${pluginPackageName}
|
|
492
|
+
\`\`\`
|
|
493
|
+
|
|
494
|
+
Then place a \`manifest.json\` (see below) inside your SynapseXcoder project's
|
|
495
|
+
\`plugins/${safeName}/\` directory and rebuild the project.
|
|
496
|
+
|
|
497
|
+
## manifest.json
|
|
498
|
+
|
|
499
|
+
\`\`\`json
|
|
500
|
+
{
|
|
501
|
+
"id": "${manifest.id}",
|
|
502
|
+
"name": "${name}",
|
|
503
|
+
"version": "1.0.0",
|
|
504
|
+
"description": "${manifest.description}",
|
|
505
|
+
"author": "Developer",
|
|
506
|
+
"type": "${type}",
|
|
507
|
+
"entryPoint": "dist/index.js",
|
|
508
|
+
"dependencies": [],
|
|
509
|
+
"permissions": [],
|
|
510
|
+
"config": {}
|
|
511
|
+
}
|
|
512
|
+
\`\`\`
|
|
513
|
+
|
|
514
|
+
## Configuration
|
|
515
|
+
|
|
516
|
+
Edit \`config\` in \`manifest.json\` to pass options to the plugin at load time.
|
|
517
|
+
They are available as \`context.config\` inside \`activate()\`.
|
|
518
|
+
|
|
519
|
+
## Development
|
|
520
|
+
|
|
521
|
+
\`\`\`bash
|
|
522
|
+
# Install dependencies
|
|
523
|
+
npm install
|
|
524
|
+
|
|
525
|
+
# Build
|
|
526
|
+
npm run build
|
|
527
|
+
|
|
528
|
+
# Run tests
|
|
529
|
+
npm test
|
|
530
|
+
\`\`\`
|
|
531
|
+
|
|
532
|
+
## Plugin Contract
|
|
533
|
+
|
|
534
|
+
| Export | Required | Description |
|
|
535
|
+
|---|---|---|
|
|
536
|
+
| \`activate(context)\` | ✅ | Called when the plugin is enabled |
|
|
537
|
+
| \`deactivate()\` | ✅ | Called when the plugin is disabled |
|
|
538
|
+
${type === "agent" || type === "mixed" ? "| `handlePrompt(prompt)` | optional | Process a prompt string |\n" : ""}${type === "command" || type === "mixed" ? "| `commands` | optional | Map of command name → handler |\n" : ""}${type === "tool" || type === "mixed" ? "| `tools` | optional | Map of tool name → implementation |\n" : ""}${type === "context" || type === "mixed" ? "| `getContext()` | optional | Returns key/value pairs injected as context |\n" : ""}${type === "knowledge" ? "| `queryKnowledge(query)` | optional | Answers a knowledge query |\n" : ""}
|
|
539
|
+
## License
|
|
540
|
+
|
|
541
|
+
MIT
|
|
542
|
+
`;
|
|
543
|
+
// ── test file ────────────────────────────────────────────────────────────
|
|
544
|
+
const testFile = `/**
|
|
545
|
+
* ${name} — Plugin Lifecycle Tests
|
|
546
|
+
*
|
|
547
|
+
* Covers the mandatory activate/deactivate contract and the primary
|
|
548
|
+
* type-specific hook for the "${type}" plugin type.
|
|
549
|
+
*/
|
|
550
|
+
|
|
551
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
552
|
+
import type { PluginContext } from "SynapseXcoder/plugins";
|
|
553
|
+
import plugin from "../src/index.js";
|
|
554
|
+
|
|
555
|
+
// ---------------------------------------------------------------------------
|
|
556
|
+
// Shared test context fixture
|
|
557
|
+
// ---------------------------------------------------------------------------
|
|
558
|
+
|
|
559
|
+
function makeContext(overrides: Partial<PluginContext> = {}): PluginContext {
|
|
560
|
+
return {
|
|
561
|
+
masterAgent: null,
|
|
562
|
+
config: {},
|
|
563
|
+
logger: vi.fn(),
|
|
564
|
+
registerCommand: vi.fn(),
|
|
565
|
+
registerAgent: vi.fn(),
|
|
566
|
+
registerTool: vi.fn(),
|
|
567
|
+
...overrides,
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// ---------------------------------------------------------------------------
|
|
572
|
+
// Lifecycle tests
|
|
573
|
+
// ---------------------------------------------------------------------------
|
|
574
|
+
|
|
575
|
+
describe("${name} plugin lifecycle", () => {
|
|
576
|
+
let ctx: PluginContext;
|
|
577
|
+
|
|
578
|
+
beforeEach(() => {
|
|
579
|
+
ctx = makeContext();
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
it("exports activate as a function", () => {
|
|
583
|
+
expect(typeof plugin.activate).toBe("function");
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
it("exports deactivate as a function", () => {
|
|
587
|
+
expect(typeof plugin.deactivate).toBe("function");
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
it("activate() runs without throwing", () => {
|
|
591
|
+
expect(() => plugin.activate(ctx)).not.toThrow();
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
it("activate() calls context.logger at least once", () => {
|
|
595
|
+
plugin.activate(ctx);
|
|
596
|
+
expect(ctx.logger).toHaveBeenCalled();
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
it("deactivate() runs without throwing after activate()", () => {
|
|
600
|
+
plugin.activate(ctx);
|
|
601
|
+
expect(() => plugin.deactivate()).not.toThrow();
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
it("deactivate() can be called safely without a prior activate()", () => {
|
|
605
|
+
// Should not throw even if called before activate.
|
|
606
|
+
expect(() => plugin.deactivate()).not.toThrow();
|
|
607
|
+
});
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
// ---------------------------------------------------------------------------
|
|
611
|
+
// Type-specific hook tests
|
|
612
|
+
// ---------------------------------------------------------------------------
|
|
613
|
+
${type === "agent" || type === "mixed"
|
|
614
|
+
? `
|
|
615
|
+
describe("${name} plugin — handlePrompt", () => {
|
|
616
|
+
it("handlePrompt returns a string", () => {
|
|
617
|
+
const ctx = makeContext();
|
|
618
|
+
const plug = plugin as { handlePrompt?: (p: string) => string };
|
|
619
|
+
if (typeof plug.handlePrompt !== "function") return; // optional hook
|
|
620
|
+
|
|
621
|
+
plug.activate?.(ctx);
|
|
622
|
+
const result = plug.handlePrompt("test prompt");
|
|
623
|
+
expect(typeof result).toBe("string");
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
`
|
|
627
|
+
: ""}${type === "command" || type === "mixed"
|
|
628
|
+
? `
|
|
629
|
+
describe("${name} plugin — commands", () => {
|
|
630
|
+
it("commands map is an object", () => {
|
|
631
|
+
const plug = plugin as { commands?: Record<string, unknown> };
|
|
632
|
+
if (!plug.commands) return; // optional
|
|
633
|
+
expect(typeof plug.commands).toBe("object");
|
|
634
|
+
});
|
|
635
|
+
});
|
|
636
|
+
`
|
|
637
|
+
: ""}${type === "tool" || type === "mixed"
|
|
638
|
+
? `
|
|
639
|
+
describe("${name} plugin — tools", () => {
|
|
640
|
+
it("tools map is an object", () => {
|
|
641
|
+
const plug = plugin as { tools?: Record<string, unknown> };
|
|
642
|
+
if (!plug.tools) return; // optional
|
|
643
|
+
expect(typeof plug.tools).toBe("object");
|
|
644
|
+
});
|
|
645
|
+
});
|
|
646
|
+
`
|
|
647
|
+
: ""}${type === "context" || type === "mixed"
|
|
648
|
+
? `
|
|
649
|
+
describe("${name} plugin — getContext", () => {
|
|
650
|
+
it("getContext returns a plain object", () => {
|
|
651
|
+
const ctx = makeContext();
|
|
652
|
+
const plug = plugin as { getContext?: () => Record<string, unknown> };
|
|
653
|
+
if (typeof plug.getContext !== "function") return; // optional
|
|
654
|
+
|
|
655
|
+
plug.activate?.(ctx);
|
|
656
|
+
const result = plug.getContext();
|
|
657
|
+
expect(result).toBeDefined();
|
|
658
|
+
expect(typeof result).toBe("object");
|
|
659
|
+
});
|
|
660
|
+
});
|
|
661
|
+
`
|
|
662
|
+
: ""}${type === "knowledge"
|
|
663
|
+
? `
|
|
664
|
+
describe("${name} plugin — queryKnowledge", () => {
|
|
665
|
+
it("queryKnowledge returns a string", () => {
|
|
666
|
+
const ctx = makeContext();
|
|
667
|
+
const plug = plugin as { queryKnowledge?: (q: string) => string };
|
|
668
|
+
if (typeof plug.queryKnowledge !== "function") return; // optional
|
|
669
|
+
|
|
670
|
+
plug.activate?.(ctx);
|
|
671
|
+
const result = plug.queryKnowledge("what is synapsexcoder");
|
|
672
|
+
expect(typeof result).toBe("string");
|
|
673
|
+
});
|
|
674
|
+
});
|
|
675
|
+
`
|
|
676
|
+
: ""}`;
|
|
677
|
+
// ── tsconfig.json ─────────────────────────────────────────────────────────
|
|
678
|
+
const tsConfig = {
|
|
679
|
+
compilerOptions: {
|
|
680
|
+
target: "ES2022",
|
|
681
|
+
module: "ESNext",
|
|
682
|
+
moduleResolution: "bundler",
|
|
683
|
+
lib: ["ES2022"],
|
|
684
|
+
outDir: "./dist",
|
|
685
|
+
rootDir: "./src",
|
|
686
|
+
declaration: true,
|
|
687
|
+
declarationMap: true,
|
|
688
|
+
sourceMap: true,
|
|
689
|
+
strict: true,
|
|
690
|
+
esModuleInterop: true,
|
|
691
|
+
skipLibCheck: true,
|
|
692
|
+
forceConsistentCasingInFileNames: true,
|
|
693
|
+
noUnusedLocals: true,
|
|
694
|
+
noUnusedParameters: true,
|
|
695
|
+
noImplicitReturns: true,
|
|
696
|
+
types: ["node"],
|
|
697
|
+
},
|
|
698
|
+
include: ["src/**/*"],
|
|
699
|
+
exclude: ["node_modules", "dist", "**/*.test.ts"],
|
|
700
|
+
};
|
|
701
|
+
return { manifest, code, packageJson, readme, testFile, tsConfig };
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
export function createPluginManager(projectRoot, masterAgent) {
|
|
705
|
+
return new PluginManager(projectRoot, masterAgent);
|
|
706
|
+
}
|
|
707
|
+
//# sourceMappingURL=plugin-system.js.map
|