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,941 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Distribution System
|
|
3
|
+
*
|
|
4
|
+
* Enables packaging and distributing SynapseXcoder agents and commands as CLI tools,
|
|
5
|
+
* inspired by agentic's distribution system.
|
|
6
|
+
*/
|
|
7
|
+
import { writeFileSync, readFileSync, existsSync, mkdirSync, readdirSync, } from "fs";
|
|
8
|
+
import { join, basename } from "path";
|
|
9
|
+
import { execSync, spawnSync } from "child_process";
|
|
10
|
+
import { v4 as uuidv4 } from "uuid";
|
|
11
|
+
import { AgentConfigManager } from "../agents/agent-config-manager.js";
|
|
12
|
+
import { PluginManager } from "../plugins/plugin-system.js";
|
|
13
|
+
export class CLIDistributionSystem {
|
|
14
|
+
distDir;
|
|
15
|
+
packagesDir;
|
|
16
|
+
registry = new Map();
|
|
17
|
+
manifest;
|
|
18
|
+
agentConfigManager;
|
|
19
|
+
pluginManager;
|
|
20
|
+
constructor(projectRoot) {
|
|
21
|
+
this.distDir = join(projectRoot, "dist");
|
|
22
|
+
this.packagesDir = join(this.distDir, "packages");
|
|
23
|
+
// Ensure directories exist
|
|
24
|
+
[this.distDir, this.packagesDir].forEach((dir) => {
|
|
25
|
+
if (!existsSync(dir)) {
|
|
26
|
+
mkdirSync(dir, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
// Initialise sub-system managers
|
|
30
|
+
this.agentConfigManager = new AgentConfigManager(projectRoot);
|
|
31
|
+
this.pluginManager = new PluginManager(projectRoot, null);
|
|
32
|
+
this.manifest = this.loadManifest();
|
|
33
|
+
this.loadPackages();
|
|
34
|
+
}
|
|
35
|
+
// ========================================================================
|
|
36
|
+
// Package Creation and Management
|
|
37
|
+
// ========================================================================
|
|
38
|
+
createPackage(sourceType, sourceId, options = {}) {
|
|
39
|
+
const packageId = uuidv4();
|
|
40
|
+
let entryPoint = "";
|
|
41
|
+
let config = {};
|
|
42
|
+
let scripts = {};
|
|
43
|
+
// Extract package information based on source type
|
|
44
|
+
switch (sourceType) {
|
|
45
|
+
case "agent":
|
|
46
|
+
const agentDef = this.getAgentDefinition(sourceId);
|
|
47
|
+
if (!agentDef)
|
|
48
|
+
throw new Error(`Agent definition not found: ${sourceId}`);
|
|
49
|
+
entryPoint = `agents/${agentDef.name.toLowerCase().replace(/[^a-z0-9]+/g, "-")}.js`;
|
|
50
|
+
config = {
|
|
51
|
+
type: agentDef.type,
|
|
52
|
+
model: agentDef.config.model,
|
|
53
|
+
temperature: agentDef.config.temperature,
|
|
54
|
+
prompts: agentDef.prompts,
|
|
55
|
+
behaviors: agentDef.behaviors,
|
|
56
|
+
};
|
|
57
|
+
scripts = {
|
|
58
|
+
run: `synapsexcoder run-agent ${agentDef.id}`,
|
|
59
|
+
install: `npm install -g ${options.name || agentDef.name}`,
|
|
60
|
+
};
|
|
61
|
+
break;
|
|
62
|
+
case "command":
|
|
63
|
+
entryPoint = `commands/${sourceId}.js`;
|
|
64
|
+
scripts = {
|
|
65
|
+
run: `synapsexcoder ${sourceId}`,
|
|
66
|
+
install: `npm install -g ${options.name || sourceId}`,
|
|
67
|
+
};
|
|
68
|
+
break;
|
|
69
|
+
case "plugin":
|
|
70
|
+
const plugin = this.getPlugin(sourceId);
|
|
71
|
+
if (!plugin)
|
|
72
|
+
throw new Error(`Plugin not found: ${sourceId}`);
|
|
73
|
+
entryPoint = `plugins/${plugin.manifest.name}.js`;
|
|
74
|
+
config = plugin.manifest.config || {};
|
|
75
|
+
scripts = {
|
|
76
|
+
install: `npm install -g ${options.name || plugin.manifest.name}`,
|
|
77
|
+
};
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
const pkg = {
|
|
81
|
+
id: packageId,
|
|
82
|
+
name: options.name || `${sourceType}-${sourceId}`,
|
|
83
|
+
version: options.version || "1.0.0",
|
|
84
|
+
description: options.description || `CLI package for ${sourceType} ${sourceId}`,
|
|
85
|
+
author: options.author || "SynapseXcoder",
|
|
86
|
+
type: sourceType,
|
|
87
|
+
entryPoint,
|
|
88
|
+
dependencies: [],
|
|
89
|
+
config,
|
|
90
|
+
scripts,
|
|
91
|
+
createdAt: Date.now(),
|
|
92
|
+
};
|
|
93
|
+
this.registry.set(packageId, pkg);
|
|
94
|
+
this.savePackage(pkg);
|
|
95
|
+
this.updateManifest();
|
|
96
|
+
return packageId;
|
|
97
|
+
}
|
|
98
|
+
getAgentDefinition(id) {
|
|
99
|
+
return this.agentConfigManager.getAgentDefinition(id);
|
|
100
|
+
}
|
|
101
|
+
getPlugin(id) {
|
|
102
|
+
return this.pluginManager.getPlugin(id);
|
|
103
|
+
}
|
|
104
|
+
// ========================================================================
|
|
105
|
+
// Package Building and Distribution
|
|
106
|
+
// ========================================================================
|
|
107
|
+
async buildPackage(packageId, targetPlatform = "npm") {
|
|
108
|
+
const pkg = this.registry.get(packageId);
|
|
109
|
+
if (!pkg)
|
|
110
|
+
throw new Error(`Package not found: ${packageId}`);
|
|
111
|
+
const buildDir = join(this.packagesDir, pkg.name);
|
|
112
|
+
switch (targetPlatform) {
|
|
113
|
+
case "npm":
|
|
114
|
+
return this.buildNPMPackage(pkg, buildDir);
|
|
115
|
+
case "standalone":
|
|
116
|
+
return this.buildStandalonePackage(pkg, buildDir);
|
|
117
|
+
case "docker":
|
|
118
|
+
return this.buildDockerPackage(pkg, buildDir);
|
|
119
|
+
default:
|
|
120
|
+
throw new Error(`Unsupported platform: ${targetPlatform}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
buildNPMPackage(pkg, buildDir) {
|
|
124
|
+
// Create package.json
|
|
125
|
+
const packageJson = {
|
|
126
|
+
name: pkg.name,
|
|
127
|
+
version: pkg.version,
|
|
128
|
+
description: pkg.description,
|
|
129
|
+
author: pkg.author,
|
|
130
|
+
main: pkg.entryPoint,
|
|
131
|
+
bin: {
|
|
132
|
+
[pkg.name]: pkg.entryPoint,
|
|
133
|
+
},
|
|
134
|
+
scripts: pkg.scripts,
|
|
135
|
+
dependencies: pkg.dependencies.reduce((acc, dep) => {
|
|
136
|
+
acc[dep] = "*";
|
|
137
|
+
return acc;
|
|
138
|
+
}, {}),
|
|
139
|
+
keywords: ["synapsexcoder", pkg.type],
|
|
140
|
+
};
|
|
141
|
+
// Create entry point script
|
|
142
|
+
const entryScript = this.generateEntryScript(pkg);
|
|
143
|
+
// Write files
|
|
144
|
+
mkdirSync(buildDir, { recursive: true });
|
|
145
|
+
writeFileSync(join(buildDir, "package.json"), JSON.stringify(packageJson, null, 2));
|
|
146
|
+
writeFileSync(join(buildDir, pkg.entryPoint), entryScript, { mode: 0o755 });
|
|
147
|
+
// Create README
|
|
148
|
+
const readme = this.generateReadme(pkg);
|
|
149
|
+
writeFileSync(join(buildDir, "README.md"), readme);
|
|
150
|
+
return buildDir;
|
|
151
|
+
}
|
|
152
|
+
buildStandalonePackage(pkg, buildDir) {
|
|
153
|
+
// Derive the agent/plugin class name from the package config type field
|
|
154
|
+
const agentTypeMap = {
|
|
155
|
+
master: "MasterAgent",
|
|
156
|
+
planner: "PlannerAgent",
|
|
157
|
+
analyzer: "AnalyzerAgent",
|
|
158
|
+
reviewer: "ReviewerAgent",
|
|
159
|
+
rewriter: "RewriterAgent",
|
|
160
|
+
ui_designer: "UIDesignerAgent",
|
|
161
|
+
researcher: "ResearcherAgent",
|
|
162
|
+
gatekeeper: "GatekeeperAgent",
|
|
163
|
+
};
|
|
164
|
+
const agentClass = agentTypeMap[pkg.config?.type] || "MasterAgent";
|
|
165
|
+
const packageJson = {
|
|
166
|
+
name: pkg.name,
|
|
167
|
+
version: pkg.version,
|
|
168
|
+
description: pkg.description,
|
|
169
|
+
author: pkg.author,
|
|
170
|
+
main: `${pkg.name}.js`,
|
|
171
|
+
bin: { [pkg.name]: `${pkg.name}.js` },
|
|
172
|
+
dependencies: {
|
|
173
|
+
commander: "^11.0.0",
|
|
174
|
+
...pkg.dependencies.reduce((acc, dep) => {
|
|
175
|
+
acc[dep] = "*";
|
|
176
|
+
return acc;
|
|
177
|
+
}, {}),
|
|
178
|
+
},
|
|
179
|
+
keywords: ["synapsexcoder", pkg.type],
|
|
180
|
+
};
|
|
181
|
+
let script;
|
|
182
|
+
switch (pkg.type) {
|
|
183
|
+
case "agent":
|
|
184
|
+
script = `#!/usr/bin/env node
|
|
185
|
+
'use strict';
|
|
186
|
+
/**
|
|
187
|
+
* Standalone CLI — ${pkg.name} v${pkg.version}
|
|
188
|
+
* Generated by SynapseXcoder CLI Distribution System
|
|
189
|
+
* Type: agent (${pkg.config?.type || "unknown"})
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
const { ${agentClass} } = require('./runtime/agents/base-agents.js');
|
|
193
|
+
const { MessageBus } = require('./runtime/messages/message-bus.js');
|
|
194
|
+
const { OpenCodeToolBridge } = require('./runtime/opencode/tool-bridge.js');
|
|
195
|
+
|
|
196
|
+
const PACKAGE_CONFIG = ${JSON.stringify(pkg.config, null, 2)};
|
|
197
|
+
const PACKAGE_META = { name: '${pkg.name}', version: '${pkg.version}', description: '${pkg.description}' };
|
|
198
|
+
|
|
199
|
+
async function main() {
|
|
200
|
+
const args = process.argv.slice(2);
|
|
201
|
+
|
|
202
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
203
|
+
console.log('Usage: ${pkg.name} [options] "<task>"');
|
|
204
|
+
console.log('');
|
|
205
|
+
console.log('Options:');
|
|
206
|
+
console.log(' --help, -h Show this help message');
|
|
207
|
+
console.log(' --version, -v Show version information');
|
|
208
|
+
console.log(' --info Show package information');
|
|
209
|
+
console.log('');
|
|
210
|
+
console.log('Example:');
|
|
211
|
+
console.log(' ${pkg.name} "Analyze the provided code for bugs"');
|
|
212
|
+
process.exit(0);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
216
|
+
console.log(PACKAGE_META.version);
|
|
217
|
+
process.exit(0);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (args.includes('--info')) {
|
|
221
|
+
console.log('Package:', PACKAGE_META.name);
|
|
222
|
+
console.log('Version:', PACKAGE_META.version);
|
|
223
|
+
console.log('Description:', PACKAGE_META.description);
|
|
224
|
+
console.log('Type:', '${pkg.type}');
|
|
225
|
+
console.log('Agent:', '${agentClass}');
|
|
226
|
+
process.exit(0);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const task = args.filter(a => !a.startsWith('--')).join(' ');
|
|
230
|
+
|
|
231
|
+
if (!task) {
|
|
232
|
+
console.error('Error: No task provided. Usage: ${pkg.name} "<task>"');
|
|
233
|
+
process.exit(1);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
try {
|
|
237
|
+
const messageBus = new MessageBus();
|
|
238
|
+
const toolBridge = new OpenCodeToolBridge({ mode: 'embedded' });
|
|
239
|
+
|
|
240
|
+
const agentConfig = {
|
|
241
|
+
type: PACKAGE_CONFIG.type || '${pkg.config?.type || "planner"}',
|
|
242
|
+
mode: 'primary',
|
|
243
|
+
model: PACKAGE_CONFIG.model || process.env.DUCKYCODER_MODEL || 'github-copilot/claude-sonnet-4.5',
|
|
244
|
+
temperature: PACKAGE_CONFIG.temperature ?? 0.7,
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const agent = new ${agentClass}(messageBus, toolBridge, agentConfig);
|
|
248
|
+
|
|
249
|
+
console.log('\\u{1F680} Running ${pkg.name} v${pkg.version}...');
|
|
250
|
+
console.log('Task:', task);
|
|
251
|
+
console.log('');
|
|
252
|
+
|
|
253
|
+
const result = await agent.performTask({
|
|
254
|
+
id: require('crypto').randomUUID(),
|
|
255
|
+
type: agentConfig.type,
|
|
256
|
+
prompt: task,
|
|
257
|
+
context: {
|
|
258
|
+
files: [],
|
|
259
|
+
constraints: [],
|
|
260
|
+
mode: 'full_pipeline',
|
|
261
|
+
metadata: { source: '${pkg.name}', packageConfig: PACKAGE_CONFIG },
|
|
262
|
+
},
|
|
263
|
+
successCriteria: 'Task completed successfully',
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
if (result.success) {
|
|
267
|
+
console.log('\\u2705 Task completed successfully');
|
|
268
|
+
if (result.output) {
|
|
269
|
+
console.log('\\nOutput:\\n', typeof result.output === 'string' ? result.output : JSON.stringify(result.output, null, 2));
|
|
270
|
+
}
|
|
271
|
+
process.exit(0);
|
|
272
|
+
} else {
|
|
273
|
+
console.error('\\u274C Task failed:', result.error || 'Unknown error');
|
|
274
|
+
process.exit(1);
|
|
275
|
+
}
|
|
276
|
+
} catch (error) {
|
|
277
|
+
console.error('\\u274C Fatal error:', error.message);
|
|
278
|
+
if (process.env.DEBUG) console.error(error.stack);
|
|
279
|
+
process.exit(1);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (require.main === module) {
|
|
284
|
+
main();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
module.exports = { config: PACKAGE_CONFIG };
|
|
288
|
+
`;
|
|
289
|
+
break;
|
|
290
|
+
case "command":
|
|
291
|
+
script = `#!/usr/bin/env node
|
|
292
|
+
'use strict';
|
|
293
|
+
/**
|
|
294
|
+
* Standalone CLI — ${pkg.name} v${pkg.version}
|
|
295
|
+
* Generated by SynapseXcoder CLI Distribution System
|
|
296
|
+
* Type: command (${pkg.entryPoint})
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
const { CommandProcessor } = require('./runtime/commands/command-processor.js');
|
|
300
|
+
const { MasterAgent } = require('./runtime/agents/base-agents.js');
|
|
301
|
+
const { MessageBus } = require('./runtime/messages/message-bus.js');
|
|
302
|
+
const { OpenCodeToolBridge } = require('./runtime/opencode/tool-bridge.js');
|
|
303
|
+
|
|
304
|
+
const COMMAND_ID = '${pkg.entryPoint.replace(/^commands\//, "").replace(/\.js$/, "")}';
|
|
305
|
+
const PACKAGE_META = { name: '${pkg.name}', version: '${pkg.version}', description: '${pkg.description}' };
|
|
306
|
+
|
|
307
|
+
async function main() {
|
|
308
|
+
const args = process.argv.slice(2);
|
|
309
|
+
|
|
310
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
311
|
+
console.log('Usage: ${pkg.name} [command-args...]');
|
|
312
|
+
console.log('');
|
|
313
|
+
console.log('Options:');
|
|
314
|
+
console.log(' --help, -h Show this help message');
|
|
315
|
+
console.log(' --version, -v Show version information');
|
|
316
|
+
console.log(' --info Show package information');
|
|
317
|
+
process.exit(0);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
321
|
+
console.log(PACKAGE_META.version);
|
|
322
|
+
process.exit(0);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (args.includes('--info')) {
|
|
326
|
+
console.log('Package:', PACKAGE_META.name);
|
|
327
|
+
console.log('Version:', PACKAGE_META.version);
|
|
328
|
+
console.log('Description:', PACKAGE_META.description);
|
|
329
|
+
console.log('Type:', '${pkg.type}');
|
|
330
|
+
console.log('Command:', COMMAND_ID);
|
|
331
|
+
process.exit(0);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const commandArgs = args.filter(a => !a.startsWith('--'));
|
|
335
|
+
|
|
336
|
+
try {
|
|
337
|
+
const messageBus = new MessageBus();
|
|
338
|
+
const toolBridge = new OpenCodeToolBridge({ mode: 'embedded' });
|
|
339
|
+
const masterAgent = new MasterAgent(messageBus, toolBridge, {
|
|
340
|
+
type: 'master',
|
|
341
|
+
mode: 'primary',
|
|
342
|
+
model: process.env.DUCKYCODER_MODEL || 'github-copilot/claude-sonnet-4.5',
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
const processor = new CommandProcessor(masterAgent);
|
|
346
|
+
|
|
347
|
+
console.log('\\u26A1 Executing command: ' + COMMAND_ID);
|
|
348
|
+
|
|
349
|
+
const result = await processor.process('/' + COMMAND_ID + ' ' + commandArgs.join(' '));
|
|
350
|
+
|
|
351
|
+
if (result.success) {
|
|
352
|
+
if (result.output) console.log(result.output);
|
|
353
|
+
process.exit(0);
|
|
354
|
+
} else {
|
|
355
|
+
console.error('\\u274C Command failed:', result.output || 'Unknown error');
|
|
356
|
+
process.exit(1);
|
|
357
|
+
}
|
|
358
|
+
} catch (error) {
|
|
359
|
+
console.error('\\u274C Fatal error:', error.message);
|
|
360
|
+
if (process.env.DEBUG) console.error(error.stack);
|
|
361
|
+
process.exit(1);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (require.main === module) {
|
|
366
|
+
main();
|
|
367
|
+
}
|
|
368
|
+
`;
|
|
369
|
+
break;
|
|
370
|
+
case "plugin":
|
|
371
|
+
default:
|
|
372
|
+
script = `#!/usr/bin/env node
|
|
373
|
+
'use strict';
|
|
374
|
+
/**
|
|
375
|
+
* Standalone CLI — ${pkg.name} v${pkg.version}
|
|
376
|
+
* Generated by SynapseXcoder CLI Distribution System
|
|
377
|
+
* Type: plugin
|
|
378
|
+
*/
|
|
379
|
+
|
|
380
|
+
const { PluginManager } = require('./runtime/plugins/plugin-system.js');
|
|
381
|
+
const path = require('path');
|
|
382
|
+
|
|
383
|
+
const PLUGIN_ID = '${pkg.config?.id || pkg.name}';
|
|
384
|
+
const PACKAGE_META = { name: '${pkg.name}', version: '${pkg.version}', description: '${pkg.description}' };
|
|
385
|
+
|
|
386
|
+
async function main() {
|
|
387
|
+
const args = process.argv.slice(2);
|
|
388
|
+
|
|
389
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
390
|
+
console.log('Usage: ${pkg.name} [options]');
|
|
391
|
+
console.log('');
|
|
392
|
+
console.log('Options:');
|
|
393
|
+
console.log(' --help, -h Show this help message');
|
|
394
|
+
console.log(' --version, -v Show version information');
|
|
395
|
+
console.log(' --info Show package information');
|
|
396
|
+
process.exit(0);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
400
|
+
console.log(PACKAGE_META.version);
|
|
401
|
+
process.exit(0);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (args.includes('--info')) {
|
|
405
|
+
console.log('Package:', PACKAGE_META.name);
|
|
406
|
+
console.log('Version:', PACKAGE_META.version);
|
|
407
|
+
console.log('Description:', PACKAGE_META.description);
|
|
408
|
+
console.log('Type:', '${pkg.type}');
|
|
409
|
+
console.log('Plugin ID:', PLUGIN_ID);
|
|
410
|
+
process.exit(0);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
try {
|
|
414
|
+
const projectRoot = process.env.DUCKYCODER_ROOT || process.cwd();
|
|
415
|
+
const pluginManager = new PluginManager(projectRoot, null);
|
|
416
|
+
|
|
417
|
+
const plugin = pluginManager.getPlugin(PLUGIN_ID);
|
|
418
|
+
if (!plugin) {
|
|
419
|
+
console.error('\\u274C Plugin not found:', PLUGIN_ID);
|
|
420
|
+
console.error('Ensure the plugin is installed in:', path.join(projectRoot, 'plugins'));
|
|
421
|
+
process.exit(1);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (!plugin.enabled) {
|
|
425
|
+
console.log('\\u26A0\\uFE0F Plugin is disabled. Enabling...');
|
|
426
|
+
pluginManager.enablePlugin(PLUGIN_ID);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
console.log('\\u{1F50C} Activating plugin:', plugin.manifest.name, 'v' + plugin.manifest.version);
|
|
430
|
+
|
|
431
|
+
// Load and initialise the plugin entry point
|
|
432
|
+
const entryPath = path.join(projectRoot, 'plugins', plugin.manifest.name, plugin.manifest.entryPoint);
|
|
433
|
+
const PluginClass = require(entryPath);
|
|
434
|
+
const instance = PluginClass.default ? new PluginClass.default({
|
|
435
|
+
masterAgent: null,
|
|
436
|
+
config: plugin.manifest.config || {},
|
|
437
|
+
logger: (msg) => console.log('[plugin]', msg),
|
|
438
|
+
}) : null;
|
|
439
|
+
|
|
440
|
+
if (instance && typeof instance.initialize === 'function') {
|
|
441
|
+
await instance.initialize();
|
|
442
|
+
console.log('\\u2705 Plugin activated successfully');
|
|
443
|
+
} else {
|
|
444
|
+
console.log('\\u2705 Plugin loaded (no initialize lifecycle)');
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
process.exit(0);
|
|
448
|
+
} catch (error) {
|
|
449
|
+
console.error('\\u274C Fatal error:', error.message);
|
|
450
|
+
if (process.env.DEBUG) console.error(error.stack);
|
|
451
|
+
process.exit(1);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (require.main === module) {
|
|
456
|
+
main();
|
|
457
|
+
}
|
|
458
|
+
`;
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
mkdirSync(buildDir, { recursive: true });
|
|
462
|
+
writeFileSync(join(buildDir, `${pkg.name}.js`), script, { mode: 0o755 });
|
|
463
|
+
writeFileSync(join(buildDir, "package.json"), JSON.stringify(packageJson, null, 2));
|
|
464
|
+
return buildDir;
|
|
465
|
+
}
|
|
466
|
+
buildDockerPackage(pkg, buildDir) {
|
|
467
|
+
const dockerfile = `FROM node:18-alpine
|
|
468
|
+
|
|
469
|
+
WORKDIR /app
|
|
470
|
+
|
|
471
|
+
# Copy package files
|
|
472
|
+
COPY package*.json ./
|
|
473
|
+
RUN npm ci --only=production
|
|
474
|
+
|
|
475
|
+
# Copy application code
|
|
476
|
+
COPY . .
|
|
477
|
+
|
|
478
|
+
# Make executable
|
|
479
|
+
RUN chmod +x ${pkg.entryPoint}
|
|
480
|
+
|
|
481
|
+
# Set environment variables
|
|
482
|
+
ENV NODE_ENV=production
|
|
483
|
+
ENV DOCKYCODE_PACKAGE=${pkg.id}
|
|
484
|
+
|
|
485
|
+
# Expose port if needed
|
|
486
|
+
# EXPOSE 3000
|
|
487
|
+
|
|
488
|
+
CMD ["node", "${pkg.entryPoint}"]
|
|
489
|
+
`;
|
|
490
|
+
const dockerignore = `node_modules
|
|
491
|
+
npm-debug.log
|
|
492
|
+
.git
|
|
493
|
+
.gitignore
|
|
494
|
+
README.md
|
|
495
|
+
.env
|
|
496
|
+
.nyc_output
|
|
497
|
+
coverage
|
|
498
|
+
.cache
|
|
499
|
+
`;
|
|
500
|
+
mkdirSync(buildDir, { recursive: true });
|
|
501
|
+
writeFileSync(join(buildDir, "Dockerfile"), dockerfile);
|
|
502
|
+
writeFileSync(join(buildDir, ".dockerignore"), dockerignore);
|
|
503
|
+
// Also create the npm package for the container
|
|
504
|
+
this.buildNPMPackage(pkg, buildDir);
|
|
505
|
+
return buildDir;
|
|
506
|
+
}
|
|
507
|
+
generateEntryScript(pkg) {
|
|
508
|
+
const agentTypeMap = {
|
|
509
|
+
master: "MasterAgent",
|
|
510
|
+
planner: "PlannerAgent",
|
|
511
|
+
analyzer: "AnalyzerAgent",
|
|
512
|
+
reviewer: "ReviewerAgent",
|
|
513
|
+
rewriter: "RewriterAgent",
|
|
514
|
+
ui_designer: "UIDesignerAgent",
|
|
515
|
+
researcher: "ResearcherAgent",
|
|
516
|
+
gatekeeper: "GatekeeperAgent",
|
|
517
|
+
};
|
|
518
|
+
const agentClass = agentTypeMap[pkg.config?.type] || "MasterAgent";
|
|
519
|
+
const agentRunBlock = `
|
|
520
|
+
case 'agent': {
|
|
521
|
+
const { ${agentClass} } = require('./runtime/agents/base-agents.js');
|
|
522
|
+
const { MessageBus } = require('./runtime/messages/message-bus.js');
|
|
523
|
+
const { OpenCodeToolBridge } = require('./runtime/opencode/tool-bridge.js');
|
|
524
|
+
|
|
525
|
+
const messageBus = new MessageBus();
|
|
526
|
+
const toolBridge = new OpenCodeToolBridge({ mode: 'embedded' });
|
|
527
|
+
const agentConfig = {
|
|
528
|
+
type: config.type || '${pkg.config?.type || "planner"}',
|
|
529
|
+
mode: 'primary',
|
|
530
|
+
model: config.model || process.env.DUCKYCODER_MODEL || 'github-copilot/claude-sonnet-4.5',
|
|
531
|
+
temperature: config.temperature ?? 0.7,
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
const agent = new ${agentClass}(messageBus, toolBridge, agentConfig);
|
|
535
|
+
const task = options.args.join(' ');
|
|
536
|
+
|
|
537
|
+
if (!task) {
|
|
538
|
+
console.error('\\u274C No task provided. Usage: run "<task>"');
|
|
539
|
+
process.exit(1);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
console.log('\\u{1F916} Executing AI agent (${agentClass})...');
|
|
543
|
+
console.log('Task:', task);
|
|
544
|
+
|
|
545
|
+
const result = await agent.performTask({
|
|
546
|
+
id: require('crypto').randomUUID(),
|
|
547
|
+
type: agentConfig.type,
|
|
548
|
+
prompt: task,
|
|
549
|
+
context: {
|
|
550
|
+
files: [],
|
|
551
|
+
constraints: [],
|
|
552
|
+
mode: 'full_pipeline',
|
|
553
|
+
metadata: { source: '${pkg.name}', packageConfig: config },
|
|
554
|
+
},
|
|
555
|
+
successCriteria: 'Task completed successfully',
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
if (!result.success) {
|
|
559
|
+
console.error('\\u274C Agent failed:', result.error || 'Unknown error');
|
|
560
|
+
process.exit(1);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (result.output) {
|
|
564
|
+
console.log('\\nOutput:');
|
|
565
|
+
console.log(typeof result.output === 'string' ? result.output : JSON.stringify(result.output, null, 2));
|
|
566
|
+
}
|
|
567
|
+
break;
|
|
568
|
+
}`;
|
|
569
|
+
const commandRunBlock = `
|
|
570
|
+
case 'command': {
|
|
571
|
+
const { CommandProcessor } = require('./runtime/commands/command-processor.js');
|
|
572
|
+
const { MasterAgent } = require('./runtime/agents/base-agents.js');
|
|
573
|
+
const { MessageBus } = require('./runtime/messages/message-bus.js');
|
|
574
|
+
const { OpenCodeToolBridge } = require('./runtime/opencode/tool-bridge.js');
|
|
575
|
+
|
|
576
|
+
const messageBus = new MessageBus();
|
|
577
|
+
const toolBridge = new OpenCodeToolBridge({ mode: 'embedded' });
|
|
578
|
+
const masterAgent = new MasterAgent(messageBus, toolBridge, {
|
|
579
|
+
type: 'master',
|
|
580
|
+
mode: 'primary',
|
|
581
|
+
model: process.env.DUCKYCODER_MODEL || 'github-copilot/claude-sonnet-4.5',
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
const processor = new CommandProcessor(masterAgent);
|
|
585
|
+
const commandId = '${pkg.entryPoint.replace(/^commands\//, "").replace(/\.js$/, "")}';
|
|
586
|
+
const commandArgs = options.args;
|
|
587
|
+
|
|
588
|
+
console.log('\\u26A1 Executing command: ' + commandId);
|
|
589
|
+
|
|
590
|
+
const result = await processor.process('/' + commandId + ' ' + commandArgs.join(' '));
|
|
591
|
+
|
|
592
|
+
if (!result.success) {
|
|
593
|
+
console.error('\\u274C Command failed:', result.output || 'Unknown error');
|
|
594
|
+
process.exit(1);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
if (result.output) console.log(result.output);
|
|
598
|
+
break;
|
|
599
|
+
}`;
|
|
600
|
+
const pluginRunBlock = `
|
|
601
|
+
case 'plugin': {
|
|
602
|
+
const { PluginManager } = require('./runtime/plugins/plugin-system.js');
|
|
603
|
+
const path = require('path');
|
|
604
|
+
|
|
605
|
+
const pluginId = config.id || '${pkg.name}';
|
|
606
|
+
const projectRoot = process.env.DUCKYCODER_ROOT || process.cwd();
|
|
607
|
+
const pluginManager = new PluginManager(projectRoot, null);
|
|
608
|
+
const plugin = pluginManager.getPlugin(pluginId);
|
|
609
|
+
|
|
610
|
+
if (!plugin) {
|
|
611
|
+
console.error('\\u274C Plugin not found:', pluginId);
|
|
612
|
+
process.exit(1);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (!plugin.enabled) {
|
|
616
|
+
pluginManager.enablePlugin(pluginId);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
console.log('\\u{1F50C} Activating plugin:', plugin.manifest.name);
|
|
620
|
+
|
|
621
|
+
const entryPath = path.join(projectRoot, 'plugins', plugin.manifest.name, plugin.manifest.entryPoint);
|
|
622
|
+
const PluginClass = require(entryPath);
|
|
623
|
+
const instance = PluginClass.default ? new PluginClass.default({
|
|
624
|
+
masterAgent: null,
|
|
625
|
+
config: plugin.manifest.config || {},
|
|
626
|
+
logger: (msg) => console.log('[plugin]', msg),
|
|
627
|
+
}) : null;
|
|
628
|
+
|
|
629
|
+
if (instance && typeof instance.initialize === 'function') {
|
|
630
|
+
await instance.initialize();
|
|
631
|
+
}
|
|
632
|
+
console.log('\\u2705 Plugin activated successfully');
|
|
633
|
+
break;
|
|
634
|
+
}`;
|
|
635
|
+
return `#!/usr/bin/env node
|
|
636
|
+
'use strict';
|
|
637
|
+
/**
|
|
638
|
+
* ${pkg.name} v${pkg.version}
|
|
639
|
+
* ${pkg.description}
|
|
640
|
+
* Generated by SynapseXcoder CLI Distribution System
|
|
641
|
+
*/
|
|
642
|
+
|
|
643
|
+
const { Command } = require('commander');
|
|
644
|
+
const program = new Command();
|
|
645
|
+
|
|
646
|
+
const config = ${JSON.stringify(pkg.config, null, 2)};
|
|
647
|
+
|
|
648
|
+
program
|
|
649
|
+
.name('${pkg.name}')
|
|
650
|
+
.description('${pkg.description}')
|
|
651
|
+
.version('${pkg.version}');
|
|
652
|
+
|
|
653
|
+
program
|
|
654
|
+
.command('run [args...]')
|
|
655
|
+
.description('Execute the ${pkg.type}')
|
|
656
|
+
.action(async (args) => {
|
|
657
|
+
console.log('\\u{1F680} Running ${pkg.name} v${pkg.version}...');
|
|
658
|
+
const options = { args: args || [] };
|
|
659
|
+
|
|
660
|
+
try {
|
|
661
|
+
switch ('${pkg.type}') {${agentRunBlock}${commandRunBlock}${pluginRunBlock}
|
|
662
|
+
default:
|
|
663
|
+
console.error('\\u274C Unknown package type: ${pkg.type}');
|
|
664
|
+
process.exit(1);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
console.log('\\u2705 Execution completed successfully');
|
|
668
|
+
} catch (error) {
|
|
669
|
+
console.error('\\u274C Error:', error.message);
|
|
670
|
+
if (process.env.DEBUG) console.error(error.stack);
|
|
671
|
+
process.exit(1);
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
program
|
|
676
|
+
.command('info')
|
|
677
|
+
.description('Show package information')
|
|
678
|
+
.action(() => {
|
|
679
|
+
console.log('\\u{1F4E6} Package Information:');
|
|
680
|
+
console.log(' Name: ', '${pkg.name}');
|
|
681
|
+
console.log(' Version: ', '${pkg.version}');
|
|
682
|
+
console.log(' Type: ', '${pkg.type}');
|
|
683
|
+
console.log(' Author: ', '${pkg.author}');
|
|
684
|
+
console.log(' Description:', '${pkg.description}');
|
|
685
|
+
if (Object.keys(config).length > 0) {
|
|
686
|
+
console.log(' Config: ', JSON.stringify(config, null, 4));
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
program.parse();
|
|
691
|
+
`;
|
|
692
|
+
}
|
|
693
|
+
generateReadme(pkg) {
|
|
694
|
+
return `# ${pkg.name}
|
|
695
|
+
|
|
696
|
+
${pkg.description}
|
|
697
|
+
|
|
698
|
+
## Installation
|
|
699
|
+
|
|
700
|
+
\`\`\`bash
|
|
701
|
+
npm install -g ${pkg.name}
|
|
702
|
+
\`\`\`
|
|
703
|
+
|
|
704
|
+
## Usage
|
|
705
|
+
|
|
706
|
+
\`\`\`bash
|
|
707
|
+
${pkg.name} run
|
|
708
|
+
\`\`\`
|
|
709
|
+
|
|
710
|
+
## Commands
|
|
711
|
+
|
|
712
|
+
- \`run\` - Execute the ${pkg.type}
|
|
713
|
+
- \`info\` - Show package information
|
|
714
|
+
|
|
715
|
+
## Configuration
|
|
716
|
+
|
|
717
|
+
${JSON.stringify(pkg.config, null, 2)}
|
|
718
|
+
|
|
719
|
+
## Author
|
|
720
|
+
|
|
721
|
+
${pkg.author}
|
|
722
|
+
|
|
723
|
+
## License
|
|
724
|
+
|
|
725
|
+
MIT
|
|
726
|
+
`;
|
|
727
|
+
}
|
|
728
|
+
// ========================================================================
|
|
729
|
+
// Package Publishing and Distribution
|
|
730
|
+
// ========================================================================
|
|
731
|
+
async publishPackage(packageId, registry = "npm") {
|
|
732
|
+
const pkg = this.registry.get(packageId);
|
|
733
|
+
if (!pkg)
|
|
734
|
+
throw new Error(`Package not found: ${packageId}`);
|
|
735
|
+
const buildDir = join(this.packagesDir, pkg.name);
|
|
736
|
+
try {
|
|
737
|
+
switch (registry) {
|
|
738
|
+
case "npm":
|
|
739
|
+
await this.publishToNPM(buildDir);
|
|
740
|
+
break;
|
|
741
|
+
case "github":
|
|
742
|
+
await this.publishToGitHub(buildDir);
|
|
743
|
+
break;
|
|
744
|
+
default:
|
|
745
|
+
throw new Error(`Unsupported registry: ${registry}`);
|
|
746
|
+
}
|
|
747
|
+
pkg.publishedAt = Date.now();
|
|
748
|
+
this.savePackage(pkg);
|
|
749
|
+
this.updateManifest();
|
|
750
|
+
return true;
|
|
751
|
+
}
|
|
752
|
+
catch (error) {
|
|
753
|
+
console.error(`Failed to publish package ${packageId}:`, error);
|
|
754
|
+
return false;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
async publishToNPM(buildDir) {
|
|
758
|
+
// Change to build directory and publish
|
|
759
|
+
const originalDir = process.cwd();
|
|
760
|
+
try {
|
|
761
|
+
process.chdir(buildDir);
|
|
762
|
+
execSync("npm publish", { stdio: "inherit" });
|
|
763
|
+
}
|
|
764
|
+
finally {
|
|
765
|
+
process.chdir(originalDir);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
async publishToGitHub(buildDir) {
|
|
769
|
+
const repoName = basename(buildDir);
|
|
770
|
+
// ── Step 1: verify git is available ──────────────────────────────────────
|
|
771
|
+
const gitCheck = spawnSync("git", ["--version"], { encoding: "utf-8" });
|
|
772
|
+
if (gitCheck.status !== 0) {
|
|
773
|
+
throw new Error("git is not available on PATH. Install git and retry.");
|
|
774
|
+
}
|
|
775
|
+
const run = (cmd, args, cwd) => {
|
|
776
|
+
const r = spawnSync(cmd, args, { encoding: "utf-8", cwd });
|
|
777
|
+
return {
|
|
778
|
+
ok: r.status === 0,
|
|
779
|
+
out: (r.stdout || "").trim(),
|
|
780
|
+
err: (r.stderr || "").trim(),
|
|
781
|
+
};
|
|
782
|
+
};
|
|
783
|
+
// ── Step 2: initialise git repo in package directory ─────────────────────
|
|
784
|
+
console.log(`[github] Initialising git repository in ${buildDir}...`);
|
|
785
|
+
const initResult = run("git", ["init"], buildDir);
|
|
786
|
+
if (!initResult.ok) {
|
|
787
|
+
throw new Error(`git init failed: ${initResult.err}`);
|
|
788
|
+
}
|
|
789
|
+
const addResult = run("git", ["add", "."], buildDir);
|
|
790
|
+
if (!addResult.ok) {
|
|
791
|
+
throw new Error(`git add failed: ${addResult.err}`);
|
|
792
|
+
}
|
|
793
|
+
// Configure a minimal identity if none is set (avoids commit failure in CI)
|
|
794
|
+
run("git", ["config", "--local", "user.email", "synapsexcoder@localhost"], buildDir);
|
|
795
|
+
run("git", ["config", "--local", "user.name", "SynapseXcoder Distribution"], buildDir);
|
|
796
|
+
const commitResult = run("git", ["commit", "-m", "Initial release"], buildDir);
|
|
797
|
+
if (!commitResult.ok) {
|
|
798
|
+
throw new Error(`git commit failed: ${commitResult.err}`);
|
|
799
|
+
}
|
|
800
|
+
console.log(`[github] Committed package files.`);
|
|
801
|
+
// ── Step 3: check for GitHub CLI ─────────────────────────────────────────
|
|
802
|
+
const ghCheck = spawnSync("gh", ["--version"], { encoding: "utf-8" });
|
|
803
|
+
if (ghCheck.status !== 0) {
|
|
804
|
+
// gh not available — print manual instructions
|
|
805
|
+
console.warn(`[github] GitHub CLI (gh) is not available. Install it from https://cli.github.com/ for automatic publishing.`);
|
|
806
|
+
console.log(`\n[github] To publish manually, run these commands:`);
|
|
807
|
+
console.log(` cd "${buildDir}"`);
|
|
808
|
+
console.log(` gh repo create ${repoName} --public --source=. --push`);
|
|
809
|
+
console.log(` # Or with git remote directly:`);
|
|
810
|
+
console.log(` git remote add origin https://github.com/<YOUR_USERNAME>/${repoName}.git`);
|
|
811
|
+
console.log(` git push -u origin main`);
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
// ── Step 4: create remote repo and push via gh ───────────────────────────
|
|
815
|
+
console.log(`[github] Creating remote repository: ${repoName}...`);
|
|
816
|
+
const createResult = run("gh", [
|
|
817
|
+
"repo",
|
|
818
|
+
"create",
|
|
819
|
+
repoName,
|
|
820
|
+
"--public",
|
|
821
|
+
"--source=.",
|
|
822
|
+
"--push",
|
|
823
|
+
"--description",
|
|
824
|
+
`SynapseXcoder CLI package: ${repoName}`,
|
|
825
|
+
], buildDir);
|
|
826
|
+
if (!createResult.ok) {
|
|
827
|
+
throw new Error(`gh repo create failed: ${createResult.err || createResult.out}`);
|
|
828
|
+
}
|
|
829
|
+
console.log(`[github] Successfully published ${repoName} to GitHub.`);
|
|
830
|
+
if (createResult.out) {
|
|
831
|
+
console.log(`[github] ${createResult.out}`);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
// ========================================================================
|
|
835
|
+
// Package Discovery and Installation
|
|
836
|
+
// ========================================================================
|
|
837
|
+
async searchPackages(query) {
|
|
838
|
+
// In real implementation, would search remote registries
|
|
839
|
+
const packages = Array.from(this.registry.values());
|
|
840
|
+
return packages.filter((pkg) => pkg.name.toLowerCase().includes(query.toLowerCase()) ||
|
|
841
|
+
pkg.description.toLowerCase().includes(query.toLowerCase()));
|
|
842
|
+
}
|
|
843
|
+
async installPackage(packageName, version) {
|
|
844
|
+
try {
|
|
845
|
+
const installCmd = version
|
|
846
|
+
? `npm install -g ${packageName}@${version}`
|
|
847
|
+
: `npm install -g ${packageName}`;
|
|
848
|
+
execSync(installCmd, { stdio: "inherit" });
|
|
849
|
+
return true;
|
|
850
|
+
}
|
|
851
|
+
catch (error) {
|
|
852
|
+
console.error(`Failed to install package ${packageName}:`, error);
|
|
853
|
+
return false;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
// ========================================================================
|
|
857
|
+
// Package Management
|
|
858
|
+
// ========================================================================
|
|
859
|
+
listPackages() {
|
|
860
|
+
return Array.from(this.registry.values());
|
|
861
|
+
}
|
|
862
|
+
getPackage(packageId) {
|
|
863
|
+
return this.registry.get(packageId);
|
|
864
|
+
}
|
|
865
|
+
deletePackage(packageId) {
|
|
866
|
+
const pkg = this.registry.get(packageId);
|
|
867
|
+
if (!pkg)
|
|
868
|
+
return false;
|
|
869
|
+
this.registry.delete(packageId);
|
|
870
|
+
this.updateManifest();
|
|
871
|
+
return true;
|
|
872
|
+
}
|
|
873
|
+
// ========================================================================
|
|
874
|
+
// Persistence
|
|
875
|
+
// ========================================================================
|
|
876
|
+
loadManifest() {
|
|
877
|
+
const manifestPath = join(this.distDir, "manifest.json");
|
|
878
|
+
if (existsSync(manifestPath)) {
|
|
879
|
+
try {
|
|
880
|
+
const content = readFileSync(manifestPath, "utf-8");
|
|
881
|
+
return JSON.parse(content);
|
|
882
|
+
}
|
|
883
|
+
catch (error) {
|
|
884
|
+
console.warn("Failed to load distribution manifest:", error);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
return {
|
|
888
|
+
packages: [],
|
|
889
|
+
registry: "npm",
|
|
890
|
+
lastUpdated: Date.now(),
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
updateManifest() {
|
|
894
|
+
this.manifest.packages = Array.from(this.registry.values());
|
|
895
|
+
this.manifest.lastUpdated = Date.now();
|
|
896
|
+
const manifestPath = join(this.distDir, "manifest.json");
|
|
897
|
+
writeFileSync(manifestPath, JSON.stringify(this.manifest, null, 2));
|
|
898
|
+
}
|
|
899
|
+
savePackage(pkg) {
|
|
900
|
+
const packagePath = join(this.packagesDir, `${pkg.id}.json`);
|
|
901
|
+
writeFileSync(packagePath, JSON.stringify(pkg, null, 2));
|
|
902
|
+
}
|
|
903
|
+
loadPackages() {
|
|
904
|
+
const packageFiles = readdirSync(this.packagesDir).filter((f) => f.endsWith(".json") && f !== "manifest.json");
|
|
905
|
+
for (const file of packageFiles) {
|
|
906
|
+
try {
|
|
907
|
+
const filePath = join(this.packagesDir, file);
|
|
908
|
+
const content = readFileSync(filePath, "utf-8");
|
|
909
|
+
const pkg = JSON.parse(content);
|
|
910
|
+
this.registry.set(pkg.id, pkg);
|
|
911
|
+
}
|
|
912
|
+
catch (error) {
|
|
913
|
+
console.warn(`Failed to load package from ${file}:`, error);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
// ========================================================================
|
|
918
|
+
// Analytics and Reporting
|
|
919
|
+
// ========================================================================
|
|
920
|
+
getDistributionStats() {
|
|
921
|
+
const packages = Array.from(this.registry.values());
|
|
922
|
+
const weekAgo = Date.now() - 7 * 24 * 60 * 60 * 1000;
|
|
923
|
+
const packageTypes = {};
|
|
924
|
+
packages.forEach((pkg) => {
|
|
925
|
+
packageTypes[pkg.type] = (packageTypes[pkg.type] || 0) + 1;
|
|
926
|
+
});
|
|
927
|
+
return {
|
|
928
|
+
totalPackages: packages.length,
|
|
929
|
+
publishedPackages: packages.filter((p) => p.publishedAt).length,
|
|
930
|
+
packageTypes,
|
|
931
|
+
recentActivity: packages.filter((p) => p.createdAt >= weekAgo).length,
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
// ========================================================================
|
|
936
|
+
// Factory Function
|
|
937
|
+
// ========================================================================
|
|
938
|
+
export function createCLIDistributionSystem(projectRoot) {
|
|
939
|
+
return new CLIDistributionSystem(projectRoot);
|
|
940
|
+
}
|
|
941
|
+
//# sourceMappingURL=cli-distribution.js.map
|