diff --git a/.gitignore b/.gitignore index 4a065ca97..57b056ff8 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ strray-ai-*.tgz # StringRay runtime artifacts .strray/profiles/ .strray/inference/ +.strray/state/ .opencode/**/*.d.ts .opencode/**/*.d.ts.map .strray/**/*.d.ts diff --git a/.strray/state/state.json b/.strray/state/state.json new file mode 100644 index 000000000..4b6738afd --- /dev/null +++ b/.strray/state/state.json @@ -0,0 +1,17 @@ +{ + "votingHistory": [], + "metrics": { + "totalVotes": 0, + "successfulVotes": 0, + "failedVotes": 0, + "averageConfidence": 0, + "strategyUsage": { + "majority_vote": 0, + "consensus": 0, + "expert_priority": 0 + }, + "agentParticipation": {}, + "averageVoterTurnout": 0 + }, + "exportedAt": "2026-05-14T22:29:46.698Z" +} \ No newline at end of file diff --git a/docs/guards/Codify-Test-Coverage-Expansion-pattern.md b/docs/guards/Codify-Test-Coverage-Expansion-pattern.md new file mode 100644 index 000000000..27049c741 --- /dev/null +++ b/docs/guards/Codify-Test-Coverage-Expansion-pattern.md @@ -0,0 +1,10 @@ +# Guard: Codify Test Coverage Expansion pattern + +Test Coverage Expansion detected across 110 sessions (avg confidence: 95%). 7 new test files added. Test-first or test-alongside development — covering new code as it ships. + +## Evidence ++ src/__tests__/e2e/inference-e2e.test.ts ++ src/__tests__/integration/inference-pipeline.test.ts ++ src/__tests__/unit/inference/deploy-verifier.test.ts ++ src/__tests__/unit/inference/inference-accumulator.test.ts ++ src/__tests__/unit/inference/inference-cycle.test.ts \ No newline at end of file diff --git a/docs/reflections/deep/release-v1.22.46-to-head-2026-05-14.md b/docs/reflections/deep/release-v1.22.46-to-head-2026-05-14.md new file mode 100644 index 000000000..49a113345 --- /dev/null +++ b/docs/reflections/deep/release-v1.22.46-to-head-2026-05-14.md @@ -0,0 +1,288 @@ +# Release Reflection: 1.22.46 → HEAD + +**Generated:** 2026-05-14T18:07:23.817Z +**Cadence:** release (since tag v1.22.46) +**Commits examined:** 72 +**Span:** v1.22.46..HEAD + +## Scope + +- **72 commits** with **15622 file changes** +- **+641011 insertions / -302175 deletions** +- **0 files added, 0 modified, 0 deleted** + +## Commit Chronicle + +- **fix: replace console.log with frameworkLogger in governance-client; propagate SolarGovernanceVoteResult through inference cycle** (d1537bf) + 0 files: src/inference/inference-cycle.ts, src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts + +- **refactor: complete governance client refactor — callTool proxy, evaluateGovernance route, remove dead code** (770a131) + 3 files: docs/reflections/deep/release-v1.22.46-to-head-2026-05-13.md, src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts + +- **refactor: use confidenceAdjustment numeric threshold instead of solarActivityLevel string for recommendation logic** (470556a) + 3 files: src/integrations/governance/index.ts + +- **feat: wire govern_with_solar as the primary governance endpoint** (72263a1) + 1 files: src/integrations/governance/index.ts, src/integrations/governance/types.ts, src/opencode/strray/features.json + +- **Revert "remove solar enhancement overlay — endpoint already consumes NOAA GOES natively via dynamo___evaluate_governance"** (0f807e1) + 3 files: src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts, src/integrations/governance/types.ts, src/opencode/strray/features.json + +- **remove solar enhancement overlay — endpoint already consumes NOAA GOES natively via dynamo___evaluate_governance** (9c34ca7) + 4 files: src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts, src/integrations/governance/types.ts, src/opencode/strray/features.json + +- **fix: increase opencode spawn timeout from 60s to 300s to prevent premature timeouts during agent voting** (31f0fe6) + 4 files: src/inference/inference-cycle.ts + +- **fix: initialize external governance in inference:run CLI command for two-oscillator governance** (c187e04) + 1 files: src/cli/index.ts + +- **fix: two-oscillator governance — trust endpoint decision, remove local confidence override** (caa444f) + 1 files: init.sh, opencode.json, package.json, src/__tests__/pipeline/test-agent-registry-pipeline.mjs, src/inference/inference-cycle.ts +2 more + +- **docs(agents): correct agent counts — 42 YAML agents, 22 TS routing modules** (eeee498) + 7 files: AGENTS.md, README.md + +- **refactor(config): source-of-truth pipeline — src/opencode/ → .opencode/** (6c5909e) + 2 files: .gitignore, .opencode/activity-report.json, .opencode/agents/.gitkeep, .opencode/agents/enforcer.yml, .opencode/agents/orchestrator.yml +281 more + +- **feat: enable spawn gate monitoring mode + release reflection doc** (5746fa8) + 286 files: .opencode/activity-report.json, .opencode/logs/.strray-init.lock, .opencode/state, .strray/inference/prompts/01-researcher.md, .strray/state/state.json +2 more + +- **fix: singleton + state management to prevent recursive agent spawning** (2b2a018) + 7 files: src/cli/index.ts, src/inference/inference-cycle.ts, src/integrations/hermes-agent/bridge.mjs, src/integrations/openclaw/api-server.ts, src/mcps/orchestrator/server.ts + +- **feat: enable inference_governance + solar enhancement for monitoring** (b4d782f) + 5 files: .opencode/strray/features.json, .strray/features.json + +- **feat: wire govern_with_solar tool — real-time NOAA solar context into governance decisions** (4ba49d5) + 2 files: .opencode/strray/features.json, .strray/features.json, src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts, src/integrations/governance/types.ts + +- **fix: add centralized OpenCode spawn gate to prevent all recursive agent spawning** (b8ff0e7) + 5 files: .opencode/activity-report.json, .opencode/logs/.strray-init.lock, .opencode/state, .opencode/strray/features.json, .strray/config.json +597 more + +- **v1.22.59** (28183e3) + 602 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/codex.codex, .opencode/command/dependency-audit.md, .opencode/commands/pre-commit-introspection.sh +184 more + +- **fix: disable auto-spawning of opencode agents to prevent runaway processes** (2948703) + 189 files: .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/commands/pre-commit-introspection.sh, .opencode/logs/.strray-init.lock +541 more + +- **v1.22.58** (30a1674) + 546 files: .strray/config.json, .strray/integrations.json + +- **v1.22.58** (2361dad) + 2 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/codex.codex, .opencode/command/dependency-audit.md, .opencode/commands/pre-commit-introspection.sh +183 more + +- **v1.22.56** (1a428c0) + 188 files: node_modules/.package-lock.json, node_modules/strray-ai/.opencode/AGENTS-consumer.md, node_modules/strray-ai/.opencode/codex.codex, node_modules/strray-ai/.opencode/commands/model-health-check.md, node_modules/strray-ai/.opencode/commands/pre-commit-introspection.sh +13120 more + +- **chore: sync config files to v1.22.56, add inference_governance feature block** (1584fd1) + 13125 files: .opencode/logs/.strray-init.lock, .strray/config.json, .strray/features.json, .strray/integrations.json, package-lock.json +1 more + +- **v1.22.57** (170472e) + 6 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +194 more + +- **feat: integrate chrono-warp-drive governance MCP for inference checking** (a61cd6f) + 199 files: .opencode/strray/integrations.json, .opencode/strray/routing-mappings.json, src/inference/inference-cycle.ts, src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts +1 more + +- **Address: Bug: fix: increase timeout for processor auto-discovery tests to prevent flak... (112x)** (02d8fa9) + 6 files: .opencode/logs/.strray-init.lock, .opencode/state, .opencode/strray/features.json, .strray/inference/prompts/01-researcher.md, .strray/state/state.json +1 more + +- **chore: update strray-ai to v1.22.55, add vote scripts and reflection** (13280fd) + 6 files: .strray/config.json, .strray/inference/prompts/01-researcher.md, .strray/integrations.json, docs/reflections/deep/release-v1.22.46-to-head-2026-05-09.md, package-lock.json +7 more + +- **feat: add auto-rotation to activity logger at 5MB threshold** (ee6a4da) + 12 files: src/core/activity-logger.ts + +- **v1.22.55** (c343767) + 1 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +196 more + +- **feat: wire 3 orphaned features + add tests + remove empty api-gateway** (077b8dc) + 201 files: docs/dead-code-audit.md, docs/integration-surfaces.md, docs/target-architecture.md, src/__tests__/unit/commit-batcher-processor.test.ts, src/__tests__/unit/mcp-servers-integration.test.ts +5 more + +- **feat: wire apply phase via MCP routing + fix e2e tests (41/41 PASS)** (db8abef) + 10 files: .strray/inference/prompts/01-researcher.md, docs/reflections/apply-phase-real-code-changes-via-mcp-routing.md, scripts/test/test-opencode-e2e.mjs, src/inference/inference-cycle.ts, src/integrations/hermes-agent/bridge.mjs +3 more + +- **docs: add apply phase design — real code changes via MCP routing** (8eab050) + 8 files: docs/reflections/apply-phase-real-code-changes-via-mcp-routing.md + +- **revert: roll back apply phase marker system — needs real agent invocation via plugin/MCP routing** (10309b2) + 1 files: src/inference/inference-cycle.ts + +- **feat: wire apply phase for real code changes instead of markdown markers** (f190318) + 1 files: src/inference/inference-cycle.ts + +- **fix: remove unused imports and any type from processor-manager.interfaces.test.ts (processor-test-rules ESLint)** (529d3d2) + 1 files: src/processors/processor-manager.interfaces.test.ts + +- **fix: address all open bugs (#29-32, #34) and prevent noise PRs from inference cycle** (c32d711) + 1 files: src/__tests__/unit/security-encryption-fix.test.ts, src/enforcement/core/__tests__/violation-fixer.test.ts, src/enforcement/core/violation-fixer.ts, src/inference/inference-cycle.ts, src/processors/processor-manager.ts +2 more + +- **fix: remove enforcer references from integration test, add fetch-depth:0 for e2e git tests** (deb49f4) + 7 files: .github/workflows/ci.yml, src/__tests__/unit/integration.test.ts + +- **fix: triage and fix all GitHub workflow pipelines** (097b48c) + 2 files: .github/workflows/auto-report.yml, .github/workflows/processor-tests.yml, .github/workflows/publish.yml, .github/workflows/release.yml, .github/workflows/security-audit.yml +2 more + +- **fix: restore package.json, mcp-install.ts, workflows, and govern-reflection.mjs gutted by 84dae31b1** (7417fd6) + 7 files: .github/workflows/ci-cd-monitor.yml, .github/workflows/ci.yml, .github/workflows/enforce-agents-md.yml, .github/workflows/release.yml, .github/workflows/security.yml +6 more + +- **fix: add npm audit fix to main CI workflow** (84dae31) + 11 files: .github/workflows/ci.yml + +- **fix: run npm audit fix to resolve moderate vulnerabilities** (314cc06) + 1 files: .github/workflows/security.yml, package.json + +- **fix: remove duplicate case undefined in mcp-install.ts (lint error)** (9b713b9) + 2 files: src/cli/commands/mcp-install.ts + +- **chore: trigger ci-cd-monitor with force_fix=true** (b36970f) + 1 files: .github/force-monitor-trigger.txt + +- **ci: improve ci-cd-monitor.yml - better error handling + governance integration** (a095f17) + 1 files: .github/workflows/ci-cd-monitor.yml + +- **chore: trigger monitoring script** (0dddd30) + 1 files: .github/monitor-trigger.txt + +- **fix: make trace-context more robust + fix ESM issues in govern-reflection** (e665442) + 1 files: scripts/node/govern-reflection.mjs, src/core/trace-context.ts + +- **ci: improve all workflows - add caching, coverage, security hardening, and new governance test step** (05a8c08) + 2 files: .github/workflows/ci.yml, .github/workflows/enforce-agents-md.yml, .github/workflows/release.yml, .github/workflows/security.yml + +- **feat: add centralized TraceContext + integrate Reflection Governance with ValidatorRegistry** (1a79c88) + 4 files: scripts/node/govern-reflection.mjs, src/core/trace-context.ts + +- **feat: implement governance-approved stagger + trace propagation, add reflection governance pipeline** (27d6e29) + 2 files: docs/reflections/deep/lexicon-cross-correlation-journey-2026-05-06.md, scripts/node/govern-reflection.mjs, src/core/framework-logger.ts, src/inference/inference-cycle.ts, src/processors/processor-manager.ts + +- **v1.22.53** (6ddf31d) + 5 files: .opencode/activity-report.json, .strray/config.json, .strray/integrations.json, CHANGELOG.md, backups/version-manager-backup-2026-05-06T16-22-00-109Z/CHANGELOG.md +7 more + +- **chore: UVM sync v1.22.52 — all version references updated** (ce3b70e) + 12 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/codex.codex, .opencode/command/dependency-audit.md, .opencode/commands/pre-commit-introspection.sh +186 more + +- **chore: UVM sync to v1.22.51** (b53a5ac) + 191 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +184 more + +- **v1.22.51** (3d96823) + 189 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +186 more + +- **fix: agent registry cleanup — remove skill-only entries, delete deprecated agents** (1cafc3a) + 191 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +226 more + +- **fix: agent export naming + single-architect governance** (b5c6100) + 231 files: agents/testing-lead.yml, src/__tests__/agents/testing-lead.test.ts, src/__tests__/unit/inference/inference-cycle.test.ts, src/agents/content-creator.ts, src/agents/growth-strategist.ts +8 more + +- **fix: complete inference-cycle.ts — all fixes applied.** (cef1ecd) + 13 files: src/inference/inference-cycle.ts + +- **docs: deep reflection — inference apply phase journey (honest assessment)** (1a05086) + 1 files: docs/reflections/deep/inference-apply-phase-journey-2026-05-01.md + +- **fix: guard inference:run for StringRay internal use only** (beefefb) + 1 files: src/cli/index.ts + +- **feat: wire apply phase + researcher double-check for PRs** (7bfa4ca) + 1 files: src/cli/index.ts, src/inference/inference-cycle.ts + +- **fix: governance pipeline — force flag, skipDeployVerify default, deploy failure handling** (40ae8ae) + 2 files: src/cli/index.ts, src/inference/inference-cycle.ts + +- **feat: unify governance — wire WeightedVotingAggregator, expand agents, connect orchestrator** (fca44e6) + 2 files: .gitignore, .opencode/activity-report.json, .strray/inference/latest-workflow.json, .strray/inference/workflow-status.json, .strray/state/state.json +1321 more + +- **feat: unify governance — wire WeightedVotingAggregator, expand agents, connect orchestrator** (191536d) + 1326 files: dist/delegation/index.d.ts, dist/delegation/index.d.ts.map, dist/delegation/index.js, dist/delegation/index.js.map, dist/delegation/voting-coordinator.d.ts +15 more + +- **docs: governance unification saga — deep reflection on wiring four systems into one loop** (9cd5b8b) + 20 files: docs/reflections/deep/governance-unification-saga-2026-04-30.md + +- **feat: lower inference thresholds to trigger on real data, keep raw problem text** (c7c09a4) + 1 files: dist/inference/inference-accumulator.js, dist/inference/inference-accumulator.js.map, dist/inference/inference-cycle.d.ts.map, dist/inference/inference-cycle.js, dist/inference/inference-cycle.js.map +6 more + +- **feat: production-ready inference governance — CLI, real agents, DI, learning loop** (501eb8d) + 11 files: .opencode/activity-report.json, .strray/inference/latest-workflow.json, .strray/inference/workflow-status.json, .strray/state/state.json, AGENTS.md +82 more + +- **feat: inference layer — semantic patterns, session capture, accumulator, governance cycle, deploy verifier** (5963ce1) + 87 files: .strray/inference/latest-workflow.json, .strray/inference/workflow-status.json, dist/CHANGELOG.md, dist/inference/deploy-verifier.d.ts, dist/inference/deploy-verifier.d.ts.map +50 more + +- **fix: increase timeout for processor auto-discovery tests to prevent flaky failures** (baae755) + 55 files: src/__tests__/unit/processor-auto-discovery.test.ts + +- **fix: inference processor double-joining absolute path created bogus Users/ dir** (a795635) + 1 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +577 more + +- **chore: v1.22.48, add prepublishOnly to strip source maps and declarations** (112ef89) + 582 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +303 more + +- **chore: v1.22.47, add .npmignore to strip .d.ts and source maps from package** (e2f7225) + 308 files: .npmignore, .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex +248 more + +- **chore: remove 92 build artifacts (.d.ts, .d.ts.map) from .opencode git tracking, add to .gitignore** (22f9ddf) + 253 files: .gitignore, .opencode/activity-report.json, .opencode/core/activity-logger.d.ts.map, .opencode/core/adaptive-kernel.d.ts.map, .opencode/core/boot-orchestrator.d.ts.map +59 more + +- **docs: the engine that built the engine — deep reflection on the meta-system, consumer tweet, release reflection** (522c28b) + 64 files: AGENTS.md, docs/reflections/deep/release-v1.22.46-to-head-2026-04-29.md, docs/reflections/deep/the-engine-that-built-the-engine-saga-2026-04-29.md, tweets/v1.22.46.md + +- **chore: rebuild dist after path fix** (4453c41) + 4 files: .strray/codex.json, .strray/config.json, .strray/features.json, .strray/integrations.json, dist/AGENTS.md + +## Files Added + +*(none)* + +## Files Modified + +*(none)* + +## Patterns Observed + +- Bug fixes present — stability improvement +- Refactoring detected — architectural debt being addressed +- Version bumps/releases present — release cadence active + +## Key Decisions + +- Structural change: fix: replace console.log with frameworkLogger in governance-client; propagate SolarGovernanceVoteResult through inference cycle +- Structural change: refactor: complete governance client refactor — callTool proxy, evaluateGovernance route, remove dead code +- Structural change: refactor: use confidenceAdjustment numeric threshold instead of solarActivityLevel string for recommendation logic +- Removal: Revert "remove solar enhancement overlay — endpoint already consumes NOAA GOES natively via dynamo___evaluate_governance" +- Removal: remove solar enhancement overlay — endpoint already consumes NOAA GOES natively via dynamo___evaluate_governance +- Fix: fix: increase opencode spawn timeout from 60s to 300s to prevent premature timeouts during agent voting +- Fix: fix: initialize external governance in inference:run CLI command for two-oscillator governance +- Fix: fix: two-oscillator governance — trust endpoint decision, remove local confidence override +- Structural change: refactor(config): source-of-truth pipeline — src/opencode/ → .opencode/ +- Fix: fix: singleton + state management to prevent recursive agent spawning +- Fix: fix: add centralized OpenCode spawn gate to prevent all recursive agent spawning +- Fix: fix: disable auto-spawning of opencode agents to prevent runaway processes +- Fix: Address: Bug: fix: increase timeout for processor auto-discovery tests to prevent flak... (112x) +- Removal: feat: wire 3 orphaned features + add tests + remove empty api-gateway +- Fix: feat: wire apply phase via MCP routing + fix e2e tests (41/41 PASS) +- Fix: fix: remove unused imports and any type from processor-manager.interfaces.test.ts (processor-test-rules ESLint) +- Fix: fix: address all open bugs (#29-32, #34) and prevent noise PRs from inference cycle +- Fix: fix: remove enforcer references from integration test, add fetch-depth:0 for e2e git tests +- Fix: fix: triage and fix all GitHub workflow pipelines +- Fix: fix: restore package.json, mcp-install.ts, workflows, and govern-reflection.mjs gutted by 84dae31b1 +- Fix: fix: add npm audit fix to main CI workflow +- Fix: fix: run npm audit fix to resolve moderate vulnerabilities +- Fix: fix: remove duplicate case undefined in mcp-install.ts (lint error) +- Fix: chore: trigger ci-cd-monitor with force_fix=true +- Fix: fix: make trace-context more robust + fix ESM issues in govern-reflection +- Fix: fix: agent registry cleanup — remove skill-only entries, delete deprecated agents +- Fix: fix: agent export naming + single-architect governance +- Fix: fix: complete inference-cycle.ts — all fixes applied. +- Fix: fix: guard inference:run for StringRay internal use only +- Fix: fix: governance pipeline — force flag, skipDeployVerify default, deploy failure handling +- Fix: fix: increase timeout for processor auto-discovery tests to prevent flaky failures +- Fix: fix: inference processor double-joining absolute path created bogus Users/ dir +- Removal: chore: remove 92 build artifacts (.d.ts, .d.ts.map) from .opencode git tracking, add to .gitignore +- Fix: chore: rebuild dist after path fix + +## Inference Notes + +- Active development session: 72 commits across 0 areas + +--- +*Generated by StorytellingTriggerProcessor — release cadence — 2026-05-14T18:07:23.817Z* \ No newline at end of file diff --git a/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json b/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json index e69de29bb..088194ce2 100644 --- a/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +++ b/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json @@ -0,0 +1 @@ +{"version":"4.0.18","results":[[":src/enforcement/validators/__tests__/architecture-validators.test.ts",{"duration":39.38712499999997,"failed":false}],[":src/enforcement/validators/__tests__/testing-validators.test.ts",{"duration":33.59137499999997,"failed":false}],[":src/core/codex-formatter.test.ts",{"duration":142.95191699999998,"failed":false}],[":src/metrics/agent-metrics.test.ts",{"duration":56.41683400000005,"failed":false}],[":src/__tests__/unit/agent-delegator.test.ts",{"duration":1304.35525,"failed":false}],[":src/enforcement/loaders/__tests__/loaders.test.ts",{"duration":157.72533399999998,"failed":false}],[":src/__tests__/unit/processor-activation.test.ts",{"duration":293.19075,"failed":false}],[":src/__tests__/unit/context-loader.test.ts",{"duration":133.804167,"failed":false}],[":src/__tests__/unit/processors/processor-implementations.test.ts",{"duration":251.4357500000001,"failed":false}],[":src/enforcement/validators/__tests__/security-validators.test.ts",{"duration":50.014749999999935,"failed":false}],[":src/integrations/base/registry.test.ts",{"duration":163.82408299999997,"failed":false}],[":src/integrations/openclaw/hooks/strray-hooks.test.ts",{"duration":46.43724999999995,"failed":false}],[":src/mcps/config/__tests__/config-validator.test.ts",{"duration":162.6055,"failed":false}],[":src/integrations/plugins/plugin.test.ts",{"duration":430.134625,"failed":false}],[":src/__tests__/unit/spawn-governance-processor.test.ts",{"duration":51.516458,"failed":false}],[":src/enforcement/core/__tests__/rule-executor.test.ts",{"duration":207.33520899999996,"failed":false}],[":src/integrations/base/Integration.test.ts",{"duration":39.553707999999915,"failed":false}],[":src/__tests__/orchestrator/agent-spawn-governor.test.ts",{"duration":30.435917000000018,"failed":false}],[":src/enforcement/validators/__tests__/code-quality-validators.test.ts",{"duration":121.11491700000005,"failed":false}],[":src/enforcement/core/__tests__/rule-registry.test.ts",{"duration":80.46691600000003,"failed":false}],[":src/__tests__/unit/connection/mcp-connection.test.ts",{"duration":180.51191600000004,"failed":false}],[":src/__tests__/unit/self-direction-activation.test.ts",{"duration":15.010459000000026,"failed":false}],[":src/__tests__/unit/analyzer.test.ts",{"duration":54.152458000000024,"failed":false}],[":src/__tests__/unit/metrics-aggregator.test.ts",{"duration":31.359375,"failed":false}],[":src/__tests__/unit/security/security-hardener.test.ts",{"duration":49.760042,"failed":false}],[":src/__tests__/postprocessor/escalation/EscalationEngine.test.ts",{"duration":736.5991250000001,"failed":false}],[":src/integrations/openclaw/types.test.ts",{"duration":30.717208000000028,"failed":false}],[":src/__tests__/unit/rule-enforcer.test.ts",{"duration":799.402625,"failed":false}],[":src/__tests__/unit/connection/connection-pool.test.ts",{"duration":384.38358300000004,"failed":false}],[":src/security/comprehensive-security-audit.test.ts",{"duration":3.3008749999999907,"failed":false}],[":src/__tests__/unit/config-loader.test.ts",{"duration":50.86624999999998,"failed":false}],[":src/__tests__/e2e/integrations-e2e.test.ts",{"duration":90804.642625,"failed":true}],[":src/__tests__/unit/state-manager-persistence.test.ts",{"duration":1204.1315,"failed":false}],[":src/delegation/analytics/__tests__/outcome-tracker.test.ts",{"duration":212.760625,"failed":false}],[":src/__tests__/unit/session-monitor-health.test.ts",{"duration":281.49425,"failed":false}],[":src/__tests__/kernel-integration.test.ts",{"duration":94.524583,"failed":false}],[":src/__tests__/integration/e2e-orchestration-flow.test.ts",{"duration":542.455875,"failed":false}],[":src/delegation/analytics/__tests__/routing-analytics.test.ts",{"duration":81.94179099999997,"failed":false}],[":src/__tests__/integration/json-codex-integration.test.ts",{"duration":30.276875000000018,"failed":false}],[":src/__tests__/integration/commit-batching-enforcement-integration.test.ts",{"duration":241.70450000000005,"failed":false}],[":src/mcps/config/__tests__/config-loader.test.ts",{"duration":77.31187499999993,"failed":false}],[":src/__tests__/unit/typescript-compilation-processor.test.ts",{"duration":88.569167,"failed":false}],[":src/enforcement/core/__tests__/rule-hierarchy.test.ts",{"duration":143.46962499999995,"failed":false}],[":src/__tests__/unit/codex-parser.test.ts",{"duration":35.338459,"failed":false}],[":src/__tests__/unit/voting-coordinator.test.ts",{"duration":186.2727500000001,"failed":false}],[":src/__tests__/integration/framework-init.test.ts",{"duration":285.73825,"failed":false}],[":src/mcps/types/__tests__/types.test.ts",{"duration":22.318833000000012,"failed":false}],[":src/__tests__/agents/testing-lead.test.ts",{"duration":59.226125000000025,"failed":false}],[":src/__tests__/integration/processors.test.ts",{"duration":9025.875375000001,"failed":false}],[":src/__tests__/unit/orchestrator.test.ts",{"duration":1129.312709,"failed":false}],[":src/__tests__/agents/bug-triage-specialist.test.ts",{"duration":19.62025,"failed":false}],[":src/__tests__/agents/refactorer.test.ts",{"duration":14.0625,"failed":false}],[":src/__tests__/postprocessor/success/SuccessHandler.test.ts",{"duration":1399.700666,"failed":false}],[":src/core/features-config.test.ts",{"duration":9.465749999999986,"failed":false}],[":src/__tests__/unit/multimodal-looker.test.ts",{"duration":44.619958999999994,"failed":false}],[":src/__tests__/agents/security-auditor.test.ts",{"duration":62.64695800000004,"failed":false}],[":src/mcps/simulation/__tests__/simulation-engine.test.ts",{"duration":33.837917000000004,"failed":false}],[":src/__tests__/unit/connection/connection-manager.test.ts",{"duration":20.613584000000003,"failed":false}],[":src/__tests__/e2e/inference-e2e.test.ts",{"duration":43482.394333000004,"failed":true}],[":src/enforcement/core/__tests__/violation-fixer.test.ts",{"duration":28.160957999999994,"failed":false}],[":src/__tests__/unit/activity-logger.test.ts",{"duration":457.3868329999999,"failed":false}],[":src/__tests__/unit/security/security-headers.test.ts",{"duration":18.670833000000016,"failed":false}],[":src/__tests__/unit/codex-injector.test.ts",{"duration":29.320875,"failed":false}],[":src/__tests__/unit/async-pattern-processor.test.ts",{"duration":28.67829100000006,"failed":false}],[":src/__tests__/unit/inference/inference-cycle.test.ts",{"duration":2555.8139170000004,"failed":false}],[":src/mcps/config/__tests__/server-config-registry.test.ts",{"duration":169.965375,"failed":false}],[":src/__tests__/unit/performance-budget-processor.test.ts",{"duration":212.676,"failed":false}],[":src/__tests__/unit/analytics/consent-manager.test.ts",{"duration":56.96041700000001,"failed":false}],[":src/__tests__/integration/oh-my-opencode-integration.test.ts",{"duration":12.12991599999998,"failed":false}],[":src/__tests__/infrastructure/infrastructure.test.ts",{"duration":45.732624999999985,"failed":false}],[":src/__tests__/unit/complexity-analyzer-calibration.test.ts",{"duration":11.536375000000021,"failed":false}],[":src/processors/processor-manager.interfaces.test.ts",{"duration":35.782332999999994,"failed":false}],[":src/__tests__/unit/postprocessor-chain-validator.test.ts",{"duration":12.101624999999984,"failed":false}],[":src/mcps/tools/__tests__/tool-registry.test.ts",{"duration":12.429291000000006,"failed":false}],[":src/metrics/agent-metrics.integration.test.ts",{"duration":14.730917000000005,"failed":false}],[":src/orchestrator/enhanced-multi-agent-orchestrator.interfaces.test.ts",{"duration":16.786083000000005,"failed":false}],[":src/__tests__/integration/codex-enforcement.test.ts",{"duration":14.606332999999992,"failed":false}],[":src/__tests__/unit/console-log-guard-processor.test.ts",{"duration":12.03245800000002,"failed":false}],[":src/__tests__/agents/types.test.ts",{"duration":11.183958999999987,"failed":false}],[":src/__tests__/unit/security/security-auditor.test.ts",{"duration":24.76925,"failed":false}],[":src/__tests__/unit/auto-reflection-generation.test.ts",{"duration":691.033709,"failed":false}],[":src/__tests__/unit/pattern-analyzer.test.ts",{"duration":23.447208999999987,"failed":false}],[":src/__tests__/integration/inference-pipeline.test.ts",{"duration":120.022292,"failed":false}],[":src/__tests__/unit/mcp-servers-integration.test.ts",{"duration":11.059540999999996,"failed":false}],[":src/__tests__/unit/state-manager.test.ts",{"duration":301.92633400000005,"failed":false}],[":src/mcps/tools/__tests__/tool-cache.test.ts",{"duration":19.957416999999964,"failed":false}],[":src/__tests__/unit/processor-registry.test.ts",{"duration":4420.041125000001,"failed":false}],[":src/__tests__/unit/boot-orchestrator.test.ts",{"duration":1417.142667,"failed":false}],[":src/__tests__/integration/codex-enforcement-e2e.test.ts",{"duration":98.19554200000005,"failed":false}],[":src/orchestrator/orchestrator.interfaces.test.ts",{"duration":10.479541999999995,"failed":false}],[":src/mcps/tools/__tests__/tool-executor.test.ts",{"duration":13.767250000000018,"failed":false}],[":src/__tests__/unit/session-coordination-validator.test.ts",{"duration":9.395083,"failed":false}],[":src/__tests__/framework-enforcement-integration.test.ts",{"duration":271.4175,"failed":false}],[":src/__tests__/integration/script-execution.test.ts",{"duration":396.263583,"failed":false}],[":src/__tests__/unit/strategy-selector.test.ts",{"duration":7.363292000000001,"failed":false}],[":src/__tests__/unit/processor-auto-discovery.test.ts",{"duration":20846.415167000003,"failed":false}],[":src/__tests__/unit/benchmark.test.ts",{"duration":7.742625000000004,"failed":false}],[":src/__tests__/cli/publish-agent.test.ts",{"duration":12.069832999999988,"failed":false}],[":src/__tests__/unit/agent-registry.test.ts",{"duration":11.059750000000008,"failed":false}],[":src/__tests__/unit/analytics.test.ts",{"duration":4.625165999999979,"failed":false}],[":src/__tests__/unit/agent-registry-consistency.test.ts",{"duration":45.73400000000004,"failed":false}],[":src/__tests__/integration/agent-registry-integration.test.ts",{"duration":186.77554199999997,"failed":false}],[":src/delegation/analytics/__tests__/learning-engine.test.ts",{"duration":124.84091699999999,"failed":false}],[":src/__tests__/unit/session-health-monitoring.test.ts",{"duration":184.138958,"failed":false}],[":src/__tests__/unit/voting-types.test.ts",{"duration":9.874583999999999,"failed":false}],[":src/__tests__/unit/report-formatter.test.ts",{"duration":43.279584,"failed":false}],[":src/__tests__/integration/orchestration-e2e.test.ts",{"duration":7.291291000000001,"failed":false}],[":src/__tests__/unit/inference/inference-accumulator.test.ts",{"duration":107.83833300000003,"failed":false}],[":src/__tests__/agents/code-reviewer.test.ts",{"duration":23.214459000000033,"failed":false}],[":src/__tests__/cli/antigravity-status.test.ts",{"duration":8.95754199999999,"failed":false}],[":src/enforcement/loaders/__tests__/codex-validators.test.ts",{"duration":51.835707999999954,"failed":false}],[":src/mcps/tools/__tests__/tool-discovery.test.ts",{"duration":30.393584000000033,"failed":false}],[":src/__tests__/integration/server.test.ts",{"duration":44.05429200000003,"failed":false}],[":src/__tests__/framework-logger-persistence.test.ts",{"duration":16.138250000000028,"failed":false}],[":src/__tests__/integration/security/security-integration.test.ts",{"duration":14.524083999999988,"failed":false}],[":src/__tests__/integration/processor-manager-reuse.test.ts",{"duration":8.76570799999999,"failed":false}],[":src/__tests__/cli/credible-init.test.ts",{"duration":16.543915999999996,"failed":false}],[":src/__tests__/unit/connection/process-spawner.test.ts",{"duration":33.834749999999985,"failed":false}],[":src/__tests__/unit/session-migration-logic.test.ts",{"duration":128.00020800000004,"failed":false}],[":src/__tests__/unit/nudge-watchdog.test.ts",{"duration":17.240083,"failed":false}],[":src/__tests__/unit/inference/session-capture.test.ts",{"duration":32311.803333,"failed":false}],[":src/__tests__/unit/agent-expertise.test.ts",{"duration":8.835667,"failed":false}],[":src/mcps/knowledge-skills/testing-best-practices.server.test.ts",{"duration":59.28004199999987,"failed":false}],[":src/__tests__/agents/index.test.ts",{"duration":15.401625000000024,"failed":false}],[":src/__tests__/unit/commit-batcher-processor.test.ts",{"duration":9.948791,"failed":false}],[":src/__tests__/unit/session-migration-validator.test.ts",{"duration":8.458666999999991,"failed":false}],[":src/__tests__/unit/integration.test.ts",{"duration":1747.100583,"failed":false}],[":src/__tests__/integration/orchestrator/concurrent-execution.test.ts",{"duration":27.81087500000001,"failed":false}],[":src/__tests__/e2e/post-processor-pipeline-e2e.test.ts",{"duration":4433.516625,"failed":false}],[":src/mcps/knowledge-skills/code-analyzer.server.test.ts",{"duration":110.05033299999991,"failed":false}],[":src/__tests__/cli/status.test.ts",{"duration":9.294999999999987,"failed":false}],[":src/mcps/knowledge-skills/security-audit.server.test.ts",{"duration":38.368416000000025,"failed":false}],[":src/__tests__/unit/monitoring.test.ts",{"duration":6.6875,"failed":false}],[":src/__tests__/unit/security-encryption-fix.test.ts",{"duration":190.31437499999993,"failed":false}],[":src/__tests__/agents/architect.test.ts",{"duration":8.196082999999987,"failed":false}],[":src/__tests__/unit/default-agents.test.ts",{"duration":52.54208299999999,"failed":false}],[":src/__tests__/integration/orchestrator/dependency-handling.test.ts",{"duration":16.189750000000004,"failed":false}],[":src/mcps/knowledge-skills/testing-strategy.server.test.ts",{"duration":24.784042,"failed":false}],[":src/__tests__/unit/session-security-validator.test.ts",{"duration":11.015375000000006,"failed":false}],[":src/__tests__/integration/postprocessor-integration.test.ts",{"duration":48.026374999999916,"failed":false}],[":src/__tests__/integration/test-complexity-analysis.test.ts",{"duration":9.822874999999982,"failed":false}],[":src/__tests__/unit/inference/semantic-patterns.test.ts",{"duration":31966.50025,"failed":false}],[":src/__tests__/integration/orchestrator/basic-orchestrator.test.ts",{"duration":7.7357920000000036,"failed":false}],[":src/utils/language-detector.test.ts",{"duration":7.593334000000027,"failed":false}],[":src/integrations/openclaw/openclaw-integration.test.ts",{"duration":6.848834000000011,"failed":false}],[":src/__tests__/utils/test-helpers.test.ts",{"duration":6.281666000000001,"failed":false}],[":src/__tests__/unit/processor-registration.test.ts",{"duration":3.5867079999999874,"failed":false}],[":src/__tests__/unit/inference/deploy-verifier.test.ts",{"duration":6.232208000000014,"failed":false}],[":src/__tests__/unit/blocked-test.test.ts",{"duration":3.4157089999999926,"failed":false}],[":src/mcps/knowledge-skills/api-design.server.test.ts",{"duration":12.650917000000021,"failed":false}]]} \ No newline at end of file diff --git a/node_modules/strray-ai/dist/AGENTS.md b/node_modules/strray-ai/dist/AGENTS.md index 586e0b6e0..5b190517b 100644 --- a/node_modules/strray-ai/dist/AGENTS.md +++ b/node_modules/strray-ai/dist/AGENTS.md @@ -120,10 +120,14 @@ The storyteller is now a **skill** (not an agent) so it runs with full session c ## Available Agents +**42 OpenCode agents** defined by YAML configs in `src/opencode/agents/` (copied to `.opencode/agents/` during build). These are the agents OpenCode reads and routes to. + +**22 internal routing modules** in `src/agents/*.ts` — TypeScript implementations that handle delegation, spawning, and orchestration logic. These are framework internals, not OpenCode agents. + +### Primary Agents (7) + | Agent | Purpose | Invoke | |-------|---------|--------| -| `@enforcer` | Codex compliance & error prevention | `@enforcer analyze this code` | -| `@orchestrator` | Complex multi-step task coordination | `@orchestrator implement feature` | | `@architect` | System design & technical decisions | `@architect design API` | | `@security-auditor` | Vulnerability detection | `@security-auditor scan` | | `@code-reviewer` | Quality assessment | `@code-reviewer review PR` | @@ -132,6 +136,12 @@ The storyteller is now a **skill** (not an agent) so it runs with full session c | `@bug-triage-specialist` | Error investigation | `@bug-triage-specialist debug error` | | `@researcher` | Codebase exploration | `@researcher find implementation` | +### Subagent / Skill-Based Agents (35) + +The remaining 35 agents are specialized subagents mapped to specific skills. They are invoked automatically by the routing system based on keywords and complexity analysis. See `src/opencode/strray/routing-mappings.json` for the full keyword-to-agent mapping. + +> **Architecture Note**: Agents are defined by YAML configs (`src/opencode/agents/*.yml`), not by TypeScript files. The TypeScript files in `src/agents/` are internal routing implementations used by the delegation system. When you invoke `@architect`, OpenCode reads `.opencode/agents/architect.yml` — not `src/agents/architect.ts`. + ## Available Skills @@ -518,34 +528,35 @@ npx strray-ai report --ci --output json # In code comment or prompt @architect design a REST API for user management -@enforcer analyze this code for security issues +@code-reviewer review this pull request @testing-lead create tests for authentication module ``` **Chaining Agents**: ``` -@orchestrator implement feature:user-authentication - → Spawns @architect → @testing-lead → @code-reviewer +@architect design feature:user-authentication + → Spawns @testing-lead → @code-reviewer ``` ### Agent Selection Guide | Task Type | Primary Agent | Supporting Agents | |-----------|---------------|-------------------| -| New feature | @orchestrator | @architect, @testing-lead | -| Bug fix | @bug-triage-specialist | @enforcer, @code-reviewer | +| New feature | @architect | @testing-lead, @code-reviewer | +| Bug fix | @bug-triage-specialist | @code-reviewer | | Refactor | @refactorer | @architect, @testing-lead | -| Security audit | @security-auditor | @enforcer | -| Code review | @code-reviewer | @enforcer | +| Security audit | @security-auditor | @code-reviewer | +| Code review | @code-reviewer | @architect | | Research | @researcher | @architect | +``` ### Session Management **Start a Session**: ```bash # Sessions are automatic - invoke agent to start -@orchestrator implement login feature +@architect design login feature ``` **View Active Sessions**: diff --git a/node_modules/strray-ai/dist/README.md b/node_modules/strray-ai/dist/README.md index e7e094359..ea6f8bfbf 100644 --- a/node_modules/strray-ai/dist/README.md +++ b/node_modules/strray-ai/dist/README.md @@ -47,7 +47,7 @@ npm install strray-ai **What happens during install?** - Copies OpenCode configuration files to your project -- Configures 26 agents with proper capabilities +- Configures 42 agents with proper capabilities - Sets up Codex enforcement rules - Enables webhook triggers for CI/CD integration - Ready to use with Hermes immediately @@ -64,7 +64,7 @@ This installs only the MCP servers - no OpenCode dependency. ## ✨ Features -- **🤖 24 Specialized Agents** - Autonomous agents that read/write code, run commands, and enforce compliance +- **🤖 42 Specialized Agents** - Autonomous agents that read/write code, run commands, and enforce compliance - **📏 99.6% Error Prevention** - Universal Development Codex (60 terms) - **⚡ 44 Framework Skills** + 10 curated community sources (170+ additional skills available) - **🛡️ Enterprise Security** - Comprehensive validation and scanning @@ -86,16 +86,10 @@ This installs only the MCP servers - no OpenCode dependency. | `@testing-lead` | Testing strategy & coverage | Active | | `@bug-triage-specialist` | Error investigation | Active | | `@researcher` | Codebase exploration | Active | -| ~~`@enforcer`~~ | ~~Codex compliance & error prevention~~ | **DEPRECATED** | -| ~~`@orchestrator`~~ | ~~Complex multi-step task coordination~~ | **DEPRECATED** | - -> **Architecture Note (2026-04-17)**: `@enforcer` and `@orchestrator` are deprecated. -> - **Enforcement** is now handled by the **plugin-level preValidate processor** and **MCP servers** -> - **Orchestration** is now handled by **agent-delegator** based on **complexity analysis** > **Note:** 0xRay auto-configures all agents during installation. To customize agent settings, see the [Agent Configuration Guide](https://github.com/htafolla/stringray/blob/master/docs/AGENT_CONFIG.md). -[View all 26 agents →](https://github.com/htafolla/stringray/blob/master/AGENTS.md) +[View all 42 agents →](https://github.com/htafolla/stringray/blob/master/AGENTS.md) ## 📦 OpenClaw Integration @@ -285,7 +279,7 @@ npx strray-ai antigravity status # Show installed skills with licenses ``` .opencode/ -├── agents/ # 24 agent configurations +├── agents/ # 42 agent configurations (YAML configs) ├── skills/ # Framework skills ├── strray/ │ ├── codex.json # Codex rules @@ -385,7 +379,7 @@ stringray/ │ ├── validation/ # Agent config & estimation validators │ └── jobs/ # Background job management ├── .opencode/ # OpenCode configuration -│ ├── agents/ # Agent configs (26 agents) +│ ├── agents/ # Agent configs (42 agents) │ ├── strray/ # 0xRay config │ │ ├── codex.json # 60-term development codex │ │ ├── features.json # Feature flags @@ -401,17 +395,17 @@ stringray/ ## 💬 Usage ```bash -# Code quality enforcement -@enforcer analyze this code for issues - -# Complex task orchestration -@orchestrator implement user authentication system - # System design @architect design database schema for e-commerce # Security audit @security-auditor scan for vulnerabilities + +# Code review +@code-reviewer review authentication module + +# Testing +@testing-lead create tests for payment system ``` ## 🔌 Framework Integration diff --git a/node_modules/strray-ai/dist/cli/commands/publish-agent.js b/node_modules/strray-ai/dist/cli/commands/publish-agent.js index f82d0a35b..a65553846 100644 --- a/node_modules/strray-ai/dist/cli/commands/publish-agent.js +++ b/node_modules/strray-ai/dist/cli/commands/publish-agent.js @@ -41,6 +41,7 @@ function parseArgs() { } function getAgentConfig(agentName, cwd) { const configPaths = [ + join(cwd, "src", "opencode", "agents", `${agentName}.yml`), join(cwd, "agents", `${agentName}.yml`), join(cwd, ".opencode", "agents", `${agentName}.yml`), join(cwd, "agents", `${agentName}.yaml`), @@ -130,6 +131,7 @@ export async function publishAgentCommand() { console.error(`❌ Error: Agent '${options.agent}' not found`); console.log(""); console.log("Searched locations:"); + console.log(` • src/opencode/agents/${options.agent}.yml`); console.log(` • agents/${options.agent}.yml`); console.log(` • .opencode/agents/${options.agent}.yml`); console.log(""); diff --git a/node_modules/strray-ai/dist/cli/index.js b/node_modules/strray-ai/dist/cli/index.js index ef9da0413..3bf84f720 100755 --- a/node_modules/strray-ai/dist/cli/index.js +++ b/node_modules/strray-ai/dist/cli/index.js @@ -42,46 +42,42 @@ program .name("strray-ai") .description("0xRay: Bulletproof AI orchestration with systematic error prevention") .version(version); +function runSetup() { + const setupScript = join(packageRoot, "scripts", "node", "setup.cjs"); + validateScriptPath(setupScript, "setup script"); + execSync(`node "${setupScript}"`, { stdio: "inherit", cwd: process.cwd() }); +} program .command("install") .description("Install 0xRay framework in the current project") .action(async () => { console.log("🔧 0xRay CLI: Installing framework..."); try { - // Run the postinstaller script const postinstallScript = join(packageRoot, "scripts", "node", "postinstall.cjs"); - // SECURITY: Validate script path before execution validateScriptPath(postinstallScript, "postinstall script"); - execSync(`node "${postinstallScript}"`, { - stdio: "inherit", - cwd: process.cwd(), - }); - console.log("✅ 0xRay framework installed successfully!"); - console.log(""); - console.log("📋 Next steps:"); - console.log("1. Restart OpenCode to load the plugin"); - console.log('2. Run "opencode agent list" to see 0xRay agents'); - console.log('3. Try "@architect analyze this code" or "@security-auditor scan" to test the plugin'); + execSync(`node "${postinstallScript}"`, { stdio: "inherit", cwd: process.cwd() }); + console.log("✅ 0xRay framework installed!"); + console.log("💡 Run 'npx strray-ai setup' for full configuration (hooks, Hermes, symlinks)"); } catch (error) { console.error("❌ Installation failed:", error instanceof Error ? error.message : String(error)); process.exit(1); } }); +program + .command("setup") + .description("Full framework setup: hooks, Hermes integration, symlinks, MCP paths") + .action(runSetup); program .command("init") .description("Initialize 0xRay configuration in the current project") .action(async () => { console.log("🚀 0xRay CLI: Initializing configuration..."); try { - // Run the postinstaller script (same as install) const postinstallScript = join(packageRoot, "scripts", "node", "postinstall.cjs"); - // SECURITY: Validate script path before execution validateScriptPath(postinstallScript, "postinstall script"); - execSync(`node "${postinstallScript}"`, { - stdio: "inherit", - cwd: process.cwd(), - }); + execSync(`node "${postinstallScript}"`, { stdio: "inherit", cwd: process.cwd() }); + runSetup(); console.log("✅ 0xRay configuration initialized!"); } catch (error) { @@ -692,6 +688,7 @@ program const { shouldTriggerCycle } = await import('../inference/inference-accumulator.js'); const { accumulateCorpus } = await import('../inference/inference-accumulator.js'); const { featuresConfigLoader } = await import('../core/features-config.js'); + const { initializeGovernanceIntegration, shutdownGovernanceIntegration } = await import('../integrations/governance/index.js'); // Guard: inference:run is internal to StringRay development only const isStringRayRepo = (() => { try { @@ -757,7 +754,13 @@ program console.log(` Recurring problems: ${corpus.recurringProblems.length}`); console.log(` Recurring patterns: ${corpus.recurringPatterns.length}`); } - const cycle = new InferenceCycle(projectRoot, undefined, { skipDeployVerify: options.noVerify ?? true, skipApply: options.noApply ?? false, skipResearcherReview: options.noResearcherReview ?? false, force: options.force ?? false }); + // Initialize external governance integration for two-oscillator governance + const govConfig = features?.inference_governance; + if (govConfig?.enabled) { + await shutdownGovernanceIntegration(); + await initializeGovernanceIntegration(); + } + const cycle = InferenceCycle.getInstance(projectRoot, { skipDeployVerify: options.noVerify ?? true, skipApply: options.noApply ?? false, skipResearcherReview: options.noResearcherReview ?? false, force: options.force ?? false }); const result = await cycle.maybeRunCycle(); if (options.json) { console.log(JSON.stringify(result, null, 2)); diff --git a/node_modules/strray-ai/dist/integrations/hermes-agent/bridge.mjs b/node_modules/strray-ai/dist/integrations/hermes-agent/bridge.mjs index 89e07ac92..662932a05 100644 --- a/node_modules/strray-ai/dist/integrations/hermes-agent/bridge.mjs +++ b/node_modules/strray-ai/dist/integrations/hermes-agent/bridge.mjs @@ -705,7 +705,7 @@ async function handleGovern(input, projectRoot, logDir) { try { const { InferenceCycle } = await import("../../inference/inference-cycle.js"); - const cycle = new InferenceCycle(projectRoot, undefined, { skipApply: true }); + const cycle = InferenceCycle.getInstance(projectRoot, { skipApply: true }); const result = await cycle.governExternalProposals(proposals); return { cycleId: result.cycleId, @@ -726,7 +726,7 @@ async function handleApply(input, projectRoot, logDir) { try { const { InferenceCycle } = await import("../../inference/inference-cycle.js"); - const cycle = new InferenceCycle(projectRoot); + const cycle = InferenceCycle.getInstance(projectRoot); const result = await cycle.governExternalProposals(proposals); return { cycleId: result.cycleId, diff --git a/node_modules/strray-ai/dist/mcps/config/plugin-server-registry.js b/node_modules/strray-ai/dist/mcps/config/plugin-server-registry.js index 47f880bbc..f3c24617f 100644 --- a/node_modules/strray-ai/dist/mcps/config/plugin-server-registry.js +++ b/node_modules/strray-ai/dist/mcps/config/plugin-server-registry.js @@ -8,7 +8,7 @@ */ import { ServerConfigRegistry, defaultServerRegistry } from "./server-config-registry.js"; import { PluginType } from "../../integrations/plugins/plugin-integration.js"; -import { frameworkLogger } from "../../dist/core/framework-logger.js"; +import { frameworkLogger } from "../../core/framework-logger.js"; /** * ServerConfigRegistry with plugin support */ diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/api-design.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/api-design.server.js index 798a05416..a5d53616a 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/api-design.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/api-design.server.js @@ -7,7 +7,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; class StringRayApiDesignServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/architecture-patterns.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/architecture-patterns.server.js index b4546ef00..4f166aafa 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/architecture-patterns.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/architecture-patterns.server.js @@ -7,7 +7,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; class StringRayArchitecturePatternsServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/code-analyzer.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/code-analyzer.server.js index c9b2b81ef..8dbb4cc9f 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/code-analyzer.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/code-analyzer.server.js @@ -14,7 +14,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js" import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; import * as fs from "fs"; import * as path from "path"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; class CodeAnalyzerServer { server; tools = [ diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/code-review.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/code-review.server.js index 62ee8ee00..f7c03068a 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/code-review.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/code-review.server.js @@ -9,7 +9,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js" import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; import * as fs from "fs"; import * as path from "path"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; class StringRayCodeReviewServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/database-design.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/database-design.server.js index d92a6d94b..dcdba97c2 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/database-design.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/database-design.server.js @@ -9,7 +9,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js" import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; import * as fs from "fs"; import * as path from "path"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; class StringRayDatabaseDesignServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/devops-deployment.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/devops-deployment.server.js index 0272507a4..fa94660de 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/devops-deployment.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/devops-deployment.server.js @@ -6,7 +6,7 @@ */ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; class StringRayDevOpsDeploymentServer { server; diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/git-workflow.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/git-workflow.server.js index 44e60d7f8..3b0d83080 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/git-workflow.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/git-workflow.server.js @@ -7,7 +7,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; class StringRayGitWorkflowServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/performance-optimization.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/performance-optimization.server.js index 4f57257dd..470801878 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/performance-optimization.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/performance-optimization.server.js @@ -7,8 +7,8 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; -import { frameworkLogger, generateJobId } from "../../dist/core/framework-logger.js"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { frameworkLogger, generateJobId } from "../../core/framework-logger.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; import fs from "fs"; import path from "path"; class StringRayPerformanceOptimizationServer { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/project-analysis.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/project-analysis.server.js index defc4b7ae..6ff21fb1c 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/project-analysis.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/project-analysis.server.js @@ -9,7 +9,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js" import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; import * as fs from "fs"; import * as path from "path"; -import { frameworkLogger } from "../../dist/core/framework-logger.js"; +import { frameworkLogger } from "../../core/framework-logger.js"; class StringRayProjectAnalysisServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/refactoring-strategies.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/refactoring-strategies.server.js index d295d75f7..9e130a9b8 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/refactoring-strategies.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/refactoring-strategies.server.js @@ -6,7 +6,7 @@ */ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; class StringRayRefactoringStrategiesServer { server; diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/security-audit.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/security-audit.server.js index 6ffba8fff..1f9067040 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/security-audit.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/security-audit.server.js @@ -9,7 +9,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js" import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; import * as fs from "fs"; import * as path from "path"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; class StringRaySecurityAuditServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/seo-consultant.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/seo-consultant.server.js index 730aed4fe..f293f586e 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/seo-consultant.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/seo-consultant.server.js @@ -8,7 +8,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; class SEOSpecialistServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/session-management.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/session-management.server.js index 4adc6e88a..195ca29c9 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/session-management.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/session-management.server.js @@ -7,7 +7,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; -import { frameworkLogger } from "../../dist/core/framework-logger.js"; +import { frameworkLogger } from "../../core/framework-logger.js"; class SessionManagementServer { server; sessions = new Map(); diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/skill-invocation.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/skill-invocation.server.js index 104a8c8ea..e988bd5e0 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/skill-invocation.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/skill-invocation.server.js @@ -2,7 +2,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } from "@modelcontextprotocol/sdk/types.js"; import { mcpClientManager } from "../mcp-client.js"; -import { frameworkLogger } from "../../dist/core/framework-logger.js"; +import { frameworkLogger } from "../../core/framework-logger.js"; class SkillInvocationServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/strategist.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/strategist.server.js index 26a27fe5d..8634a0250 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/strategist.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/strategist.server.js @@ -7,7 +7,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; -import { frameworkLogger } from "../../dist/core/framework-logger.js"; +import { frameworkLogger } from "../../core/framework-logger.js"; class StrategistServer { server; tools = [ diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/tech-writer.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/tech-writer.server.js index 1b6b92157..8c80c2521 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/tech-writer.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/tech-writer.server.js @@ -9,7 +9,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js" import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; import * as fs from "fs"; import * as path from "path"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; class StringRayDocumentationGenerationServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/testing-best-practices.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/testing-best-practices.server.js index 3f9b3b236..129ba5771 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/testing-best-practices.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/testing-best-practices.server.js @@ -6,7 +6,7 @@ */ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; class StringRayTestingBestPracticesServer { server; diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/testing-strategy.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/testing-strategy.server.js index 268766c77..09614c46b 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/testing-strategy.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/testing-strategy.server.js @@ -9,9 +9,9 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js" import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; import * as fs from "fs"; import * as path from "path"; -import { frameworkLogger } from "../../dist/core/framework-logger.js"; -import { createGracefulShutdown } from "../../dist/utils/shutdown-handler.js"; -import { detectProjectLanguage, LANGUAGE_CONFIGS, } from "../../dist/utils/language-detector.js"; +import { frameworkLogger } from "../../core/framework-logger.js"; +import { createGracefulShutdown } from "../../utils/shutdown-handler.js"; +import { detectProjectLanguage, LANGUAGE_CONFIGS, } from "../../utils/language-detector.js"; class StringRayTestingStrategyServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/knowledge-skills/ui-ux-design.server.js b/node_modules/strray-ai/dist/mcps/knowledge-skills/ui-ux-design.server.js index 0305e5669..5af528f94 100644 --- a/node_modules/strray-ai/dist/mcps/knowledge-skills/ui-ux-design.server.js +++ b/node_modules/strray-ai/dist/mcps/knowledge-skills/ui-ux-design.server.js @@ -7,7 +7,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; -import { frameworkLogger } from "../../dist/core/framework-logger.js"; +import { frameworkLogger } from "../../core/framework-logger.js"; class StringRayUIUXDesignServer { server; constructor() { diff --git a/node_modules/strray-ai/dist/mcps/orchestrator/server.js b/node_modules/strray-ai/dist/mcps/orchestrator/server.js index d7d5d6793..fcb314015 100644 --- a/node_modules/strray-ai/dist/mcps/orchestrator/server.js +++ b/node_modules/strray-ai/dist/mcps/orchestrator/server.js @@ -231,7 +231,7 @@ export class OrchestratorServer { async handleGovernAndApply(args) { try { const { InferenceCycle } = await import('../../inference/inference-cycle.js'); - const cycle = new InferenceCycle(process.cwd(), undefined, { + const cycle = InferenceCycle.getInstance(process.cwd(), { skipApply: args.skipApply ?? false, }); const result = await cycle.governExternalProposals(args.proposals); diff --git a/node_modules/strray-ai/dist/orchestrator/enhanced-multi-agent-orchestrator.js b/node_modules/strray-ai/dist/orchestrator/enhanced-multi-agent-orchestrator.js index e11bd582e..4175a740e 100644 --- a/node_modules/strray-ai/dist/orchestrator/enhanced-multi-agent-orchestrator.js +++ b/node_modules/strray-ai/dist/orchestrator/enhanced-multi-agent-orchestrator.js @@ -8,6 +8,7 @@ import { ComplexityAnalyzer, } from "../delegation/complexity-analyzer.js"; import { createAgentDelegator, } from "../delegation/agent-delegator.js"; import { strRayConfigLoader } from "../core/config-loader.js"; import { agentSpawnGovernor } from "./agent-spawn-governor.js"; +import { spawnGate } from "../core/opencode-spawn-gate.js"; export class EnhancedMultiAgentOrchestrator { state; stateManager; @@ -49,6 +50,15 @@ export class EnhancedMultiAgentOrchestrator { async spawnAgent(request) { const jobId = `spawn-agent-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; let spawnTrackingId; + // 🚨 GATE: Check global spawn gate before any spawn attempt + try { + spawnGate.assertAllowed("enhanced-multi-agent-orchestrator"); + } + catch (gateError) { + const error = new Error(`SPAWN GATE BLOCKED: ${gateError instanceof Error ? gateError.message : String(gateError)}`); + await frameworkLogger.log("enhanced-multi-agent-orchestrator", "spawn-gate-blocked", "error", { message: error.message, agentType: request.agentType }); + throw error; + } // 🚨 SECURITY: Prevent subagents from spawning other subagents // This prevents infinite loops, resource exhaustion, and uncontrolled agent spawning if (this.isCurrentlyExecutingAsSubagent()) { diff --git a/node_modules/strray-ai/dist/orchestrator/multi-agent-orchestration-coordinator.js b/node_modules/strray-ai/dist/orchestrator/multi-agent-orchestration-coordinator.js index a82a99a49..74f61930f 100644 --- a/node_modules/strray-ai/dist/orchestrator/multi-agent-orchestration-coordinator.js +++ b/node_modules/strray-ai/dist/orchestrator/multi-agent-orchestration-coordinator.js @@ -8,7 +8,7 @@ * @since 2026-01-23 */ import { KernelOrchestrator } from "../core/orchestrator.js"; -import { EnhancedMultiAgentOrchestrator } from "./enhanced-multi-agent-orchestrator.js"; +import { enhancedMultiAgentOrchestrator } from "./enhanced-multi-agent-orchestrator.js"; import { createAgentDelegator } from "../delegation/agent-delegator.js"; import { StringRayStateManager } from "../state/state-manager.js"; import { frameworkLogger } from "../core/framework-logger.js"; @@ -24,7 +24,7 @@ export class MultiAgentOrchestrationCoordinator { constructor(stateManager) { this.stateManager = stateManager || new StringRayStateManager(); this.strRayOrchestrator = new KernelOrchestrator(); - this.enhancedOrchestrator = new EnhancedMultiAgentOrchestrator(); + this.enhancedOrchestrator = enhancedMultiAgentOrchestrator; this.agentDelegator = createAgentDelegator(this.stateManager, strRayConfigLoader); this.complexityAnalyzer = new ComplexityAnalyzer(); this.coordinationMetrics = { diff --git a/node_modules/strray-ai/dist/orchestrator/orchestrator.js b/node_modules/strray-ai/dist/orchestrator/orchestrator.js index 9ddb869d2..294736839 100644 --- a/node_modules/strray-ai/dist/orchestrator/orchestrator.js +++ b/node_modules/strray-ai/dist/orchestrator/orchestrator.js @@ -7,7 +7,7 @@ * @version 1.0.0 * @since 2026-01-07 */ -import { EnhancedMultiAgentOrchestrator } from "./enhanced-multi-agent-orchestrator.js"; +import { enhancedMultiAgentOrchestrator } from "./enhanced-multi-agent-orchestrator.js"; import { frameworkLogger } from "../core/framework-logger.js"; import { routingOutcomeTracker } from "../delegation/analytics/outcome-tracker.js"; import { patternPerformanceTracker } from "../analytics/pattern-performance-tracker.js"; @@ -15,7 +15,6 @@ import { VotingCoordinator } from "../delegation/voting-coordinator.js"; import { getAgentExpertiseLevel } from "../delegation/agent-expertise.js"; import { StringRayStateManager } from "../state/state-manager.js"; import fs from "fs"; -const enhancedMultiAgentOrchestrator = new EnhancedMultiAgentOrchestrator(); export class StringRayOrchestrator { config; activeTasks = new Map(); diff --git a/node_modules/strray-ai/dist/scripts/integration.js b/node_modules/strray-ai/dist/scripts/integration.js index a5a476cd6..660c7eedf 100755 --- a/node_modules/strray-ai/dist/scripts/integration.js +++ b/node_modules/strray-ai/dist/scripts/integration.js @@ -15,6 +15,7 @@ */ import { spawn } from "child_process"; import { resolveAgent } from "../mcps/agent-resolver.js"; +import { spawnGate } from "../core/opencode-spawn-gate.js"; /** * Main entry point for the integration script */ @@ -119,6 +120,8 @@ Execute this task using the available tools. Be thorough and provide detailed re * Spawn OpenCode CLI process */ function spawnOpenCode(agentName, prompt) { + // Gate: prevent spawning unless explicitly enabled + spawnGate.assertAllowed("integration-script"); let isFinished = false; return new Promise((resolve, reject) => { // Spawn opencode with stdin for prompt - more reliable @@ -133,6 +136,9 @@ function spawnOpenCode(agentName, prompt) { }, stdio: ["pipe", "pipe", "pipe"], }); + if (opencode.pid) { + spawnGate.trackProcess(opencode.pid, "integration-script", `agent=${agentName}`); + } } catch (error) { const msg = error instanceof Error && "code" in error && error.code === "ENOENT" @@ -183,6 +189,9 @@ function spawnOpenCode(agentName, prompt) { }; opencode.on("close", (code) => { cleanup(false); + if (opencode.pid) { + spawnGate.untrackProcess(opencode.pid); + } if (code !== 0) { reject(new Error(`OpenCode exited with code ${code}: ${stderr}`)); return; diff --git a/src/__tests__/unit/processor-auto-discovery.test.ts b/src/__tests__/unit/processor-auto-discovery.test.ts index 290cd25c3..8e66abf73 100644 --- a/src/__tests__/unit/processor-auto-discovery.test.ts +++ b/src/__tests__/unit/processor-auto-discovery.test.ts @@ -28,8 +28,8 @@ describe("Processor Auto-Discovery", () => { const discovered = await manager.discoverProcessors(tmpDir); - expect(discovered).toEqual([]); - }); +expect(discovered).toEqual([]); + }, 30000); it("should not overwrite hardcoded factories", async () => { const stateManager = new StringRayStateManager(); @@ -40,7 +40,7 @@ describe("Processor Auto-Discovery", () => { await manager.discoverProcessors(tmpDir); expect((manager as any).factories.size).toBe(factoriesBefore); - }); + }, 30000); it("should handle missing implementations directory gracefully", async () => { const stateManager = new StringRayStateManager(); diff --git a/src/inference/inference-cycle.ts b/src/inference/inference-cycle.ts index e663961f6..ead85f67a 100644 --- a/src/inference/inference-cycle.ts +++ b/src/inference/inference-cycle.ts @@ -6,7 +6,7 @@ import { DeployVerifier, DeployVerificationResult } from "./deploy-verifier.js"; import { VotingCoordinator } from "../delegation/voting-coordinator.js"; import { StringRayStateManager } from "../state/state-manager.js"; import { frameworkLogger } from "../core/framework-logger.js"; -import { getGovernanceIntegration, type GovernanceVoteResult } from "../integrations/governance/index.js"; +import { getGovernanceIntegration, type GovernanceVoteResult, type SolarGovernanceVoteResult } from "../integrations/governance/index.js"; import { getAgentSpawn } from "../core/features-config.js"; import { agentSpawnGovernor } from "../orchestrator/agent-spawn-governor.js"; import { spawnGate } from "../core/opencode-spawn-gate.js"; @@ -104,6 +104,7 @@ export class InferenceCycle { private opencodeAvailable: boolean | null = null; private agentInvoker: AgentInvoker | null; private options: InferenceCycleOptions; + private lastRawOpencodeOutput: string = ""; constructor(projectRoot?: string, agentInvoker?: AgentInvoker, options?: InferenceCycleOptions) { this.projectRoot = projectRoot || process.cwd(); @@ -655,35 +656,67 @@ Respond with EXACTLY one of: const sessionId = `inference-governance-${Date.now()}`; const results: InferenceCycleResult["votes"] = []; + const allGovernanceAgents = new Set(); + for (const agents of Object.values(GOVERNANCE_AGENTS)) { + for (const a of agents) allGovernanceAgents.add(a); + } + const todoPrompt = [ - `Vote on ${proposals.length} inference proposals. Output EXACTLY one PROPOSAL block per proposal.`, + `You are the architect agent governing ${proposals.length} inference proposals.`, + `You must vote on each proposal AND create tasks for the relevant governance sub-agents to vote as well.`, + ``, + `GOVERNANCE AGENTS BY PROPOSAL TYPE:`, + ...Object.entries(GOVERNANCE_AGENTS).map(([type, agents]) => ` ${type}: ${agents.join(", ")}`), + ``, + `For each proposal, create a task for each relevant sub-agent (based on its type) asking them to vote.`, + `Then cast your own architect vote.`, + ``, + `OUTPUT FORMAT (exact, no extra text, no markdown):`, + `One PROPOSAL block per agent per proposal. Each block starts with PROPOSAL: .`, ``, - `FORMAT (exact, no extra text, no markdown):`, `PROPOSAL: `, - ` AGENT: architect`, + ` AGENT: `, ` DECISION: approve|reject|abstain`, ` CONFIDENCE: 0.XX`, ` REASONING: `, ``, - `Example:`, + `Example for a [fix] type proposal with agents [architect, code-reviewer, refactorer, researcher]:`, `PROPOSAL: 1`, ` AGENT: architect`, ` DECISION: approve`, ` CONFIDENCE: 0.85`, - ` REASONING: Cleanup reduces maintenance burden`, + ` REASONING: Low-risk bug fix improves stability`, + `PROPOSAL: 1`, + ` AGENT: code-reviewer`, + ` DECISION: approve`, + ` CONFIDENCE: 0.80`, + ` REASONING: Code change is clean and well-scoped`, + `PROPOSAL: 1`, + ` AGENT: refactorer`, + ` DECISION: approve`, + ` CONFIDENCE: 0.75`, + ` REASONING: Minor refactoring reduces tech debt`, + `PROPOSAL: 1`, + ` AGENT: researcher`, + ` DECISION: approve`, + ` CONFIDENCE: 0.70`, + ` REASONING: Pattern confirmed across codebase`, ``, `PROPOSALS:`, ]; for (let i = 0; i < proposals.length; i++) { const p = proposals[i]!; - todoPrompt.push(`${i + 1}. [${p.type}] "${p.title}"`); + const agents = GOVERNANCE_AGENTS[p.type] ?? ["code-reviewer"]; + todoPrompt.push(`${i + 1}. [${p.type}] "${p.title}" — agents: architect, ${agents.join(", ")}`); } try { + this.lastRawOpencodeOutput = ""; const jsonOutput = await this.invokeAgentInternal("architect", todoPrompt.join("\n")); - const allVotes = this.parseSubagentVotes(jsonOutput, proposals); + const rawForParsing = this.lastRawOpencodeOutput || jsonOutput; + const allVotes = this.parseSubagentVotes(rawForParsing, proposals); for (const proposal of proposals) { const agents = GOVERNANCE_AGENTS[proposal.type] ?? ["code-reviewer"]; @@ -813,16 +846,27 @@ Respond with EXACTLY one of: ); const votes: InferenceCycleResult["votes"] = batchResult.results.map( - (result: GovernanceVoteResult) => ({ - proposalId: result.governanceResponse.proposalId, - decision: result.vote.toLowerCase() === "yes" ? "approve" : "reject", - confidence: result.governanceResponse.confidence, - details: [ + (result: GovernanceVoteResult) => { + const details = [ `Governance: ${result.governanceResponse.recommendation}`, `Isotope: ${result.governanceResponse.governanceIsotopeId}`, ...result.governanceResponse.reasons.slice(0, 2), - ], - }), + ]; + + const solarResult = result as SolarGovernanceVoteResult; + if (solarResult.solarModulation) { + details.push( + `Solar modulation: ${solarResult.solarModulation.activityLevel} (gain: ${solarResult.solarModulation.gainMultiplier}x)`, + ); + } + + return { + proposalId: result.governanceResponse.proposalId, + decision: result.vote.toLowerCase() === "yes" ? "approve" : "reject", + confidence: result.governanceResponse.confidence, + details, + }; + }, ); frameworkLogger.log("inference-cycle", "external-governance-complete", "info", { @@ -990,6 +1034,7 @@ Respond with EXACTLY one of: await agentSpawnGovernor.completeSpawn(trackingId, true).catch(() => {}); } frameworkLogger.log("inference-cycle", "opencode-spawn-success", "info", { agentName, trackingId }); + this.lastRawOpencodeOutput = stdout.trim(); const textResponse = this.extractTextFromNdjson(stdout.trim()); if (textResponse) { resolve(textResponse); diff --git a/src/integrations/governance/governance-client.ts b/src/integrations/governance/governance-client.ts index 3a93bf9d7..b934947d8 100644 --- a/src/integrations/governance/governance-client.ts +++ b/src/integrations/governance/governance-client.ts @@ -14,6 +14,7 @@ import type { SolarGovernanceCheckResponse, GovernanceClientConfig, GovernanceClientStats, + SolarFeaturesLike, } from './types.js'; import { GovernanceError, @@ -33,7 +34,7 @@ export class GovernanceClient { constructor(config: Partial = {}) { this.config = { baseUrl: 'https://mcp-production-80e2.up.railway.app', - timeoutMs: 10000, + timeoutMs: 30000, retryAttempts: 3, retryDelayMs: 1000, ...config, @@ -101,6 +102,19 @@ export class GovernanceClient { adjustedVoteWeight: result.adjustedVoteWeight as number, finalRecommendation: result.finalRecommendation as string, confidenceAdjustment: result.confidenceAdjustment as number, + ...(result.solarFeatures + ? { solarFeatures: result.solarFeatures as SolarFeaturesLike } + : {}), + ...(result.solarModulation + ? { + solarModulation: { + activity_level: (result.solarModulation as Record).activity_level as string, + gainMultiplier: (result.solarModulation as Record).gainMultiplier as number, + metaDelta: (result.solarModulation as Record).metaDelta as number, + confDelta: (result.solarModulation as Record).confDelta as number, + }, + } + : {}), }; if (!this.isValidSolarResponse(response)) { @@ -197,9 +211,11 @@ export class GovernanceClient { recommendation: result.recommendation as 'PASS' | 'NEEDS_REVISION' | 'REJECT', confidence: result.confidence as number, voteWeight: result.voteWeight as number, - reasons: Array.isArray(result.reasoning) - ? (result.reasoning as string[]) - : [result.reasoning as string], + reasons: Array.isArray(result.reasons) + ? (result.reasons as string[]) + : Array.isArray(result.reasoning) + ? (result.reasoning as string[]) + : [String(result.reasons ?? result.reasoning ?? '')], }; if (!this.isValidResponse(response)) { @@ -305,8 +321,7 @@ export class GovernanceClient { sc.solarActivityModifier <= 1 && typeof sc.recommendation === 'string' && typeof r.adjustedVoteWeight === 'number' && - r.adjustedVoteWeight >= 0.5 && - r.adjustedVoteWeight <= 1.5 && + r.adjustedVoteWeight >= 0 && typeof r.finalRecommendation === 'string' && typeof r.confidenceAdjustment === 'number' ); diff --git a/src/integrations/governance/index.ts b/src/integrations/governance/index.ts index 1c8f8fcb2..74e486f10 100644 --- a/src/integrations/governance/index.ts +++ b/src/integrations/governance/index.ts @@ -55,7 +55,7 @@ export class InferenceGovernanceIntegration extends BaseIntegration { await this.log('info', 'Initializing governance client...'); this.client = new GovernanceClient({ - baseUrl: this.configData.endpointUrl.replace(/\/governance$/, ''), + baseUrl: this.configData.endpointUrl, timeoutMs: this.configData.requestTimeoutMs, }); @@ -209,6 +209,14 @@ export class InferenceGovernanceIntegration extends BaseIntegration { ...baseResult, solarContext: solarResponse.solarContext, solarConfidenceAdjustment: solarResponse.confidenceAdjustment, + ...(solarResponse.solarModulation + ? { + solarModulation: { + gainMultiplier: solarResponse.solarModulation.gainMultiplier, + activityLevel: solarResponse.solarModulation.activity_level, + }, + } + : {}), }; frameworkLogger.log( @@ -220,6 +228,7 @@ export class InferenceGovernanceIntegration extends BaseIntegration { solarActivityLevel: solarResponse.solarContext.solarActivityLevel, adjustedVoteWeight: solarResponse.adjustedVoteWeight, confidenceAdjustment: solarResponse.confidenceAdjustment, + gainMultiplier: solarResponse.solarModulation?.gainMultiplier, passed: solarResult.passed, }, ); @@ -259,15 +268,14 @@ export class InferenceGovernanceIntegration extends BaseIntegration { frameworkLogger.log( 'inference-governance', 'check-proposal-error', - 'warning', + 'error', { proposalId: proposal.id, error: error instanceof Error ? error.message : String(error), }, ); - // Fallback to local decision - results.push(this.createFallbackVote(proposal)); + throw error; } } @@ -335,31 +343,6 @@ export class InferenceGovernanceIntegration extends BaseIntegration { }; } - /** - * Create fallback vote when governance is unavailable - */ - private createFallbackVote(proposal: InferenceProposal): GovernanceVoteResult { - return { - vote: proposal.confidence >= 0.7 ? 'YES' : 'ABSTAIN', - weight: 1.0, - reason: 'Fallback: governance endpoint unavailable', - governanceResponse: { - success: false, - proposalId: proposal.id, - governanceIsotopeId: 'fallback', - resonanceScore: 0, - isotopicRatio: 0, - vortexVolume: 0, - historicalCoherence: 0, - recommendation: 'NEEDS_REVISION', - confidence: proposal.confidence, - voteWeight: 1.0, - reasons: ['Governance endpoint unavailable, using local confidence'], - }, - passed: proposal.confidence >= 0.7, - }; - } - /** * Load configuration from features.json */ diff --git a/src/integrations/governance/types.ts b/src/integrations/governance/types.ts index 11652add1..0ca2d99e0 100644 --- a/src/integrations/governance/types.ts +++ b/src/integrations/governance/types.ts @@ -75,8 +75,8 @@ export interface GovernanceIntegrationConfig { */ export const DEFAULT_GOVERNANCE_CONFIG: GovernanceIntegrationConfig = { enabled: false, - endpointUrl: 'https://mcp-production-80e2.up.railway.app/governance', - requestTimeoutMs: 10000, + endpointUrl: 'https://mcp-production-80e2.up.railway.app', + requestTimeoutMs: 30000, minConfidenceThreshold: 0.5, decisionLogic: { passConfidenceMin: 0.9, @@ -94,6 +94,29 @@ export const DEFAULT_GOVERNANCE_CONFIG: GovernanceIntegrationConfig = { */ export type SolarActivityLevel = 'quiet' | 'moderate' | 'active' | 'storm'; +/** + * Minimal solar feature vector used by neural fusion modulation + * Derived from NOAA SWPC data (X-ray flux, Kp-index, etc.) + */ +export interface SolarFeaturesLike { + xrayUVLift: number; + magPerturbation: number; + activityLevel?: SolarActivityLevel; +} + +/** + * Solar modulation record — tracks what modulation was applied and why + */ +export interface SolarModulation { + solar_applied: boolean; + activity_level: string; + gainMultiplier: number; + metaShift: number; + confShift: number; + metaDelta: number; + confDelta: number; +} + /** * Solar context returned by govern_with_solar */ @@ -132,6 +155,15 @@ export interface SolarGovernanceCheckResponse { finalRecommendation: string; /** Confidence adjustment applied due to solar activity */ confidenceAdjustment: number; + /** Live solar feature vector from NOAA (if available) */ + solarFeatures?: SolarFeaturesLike; + /** Solar modulation details from neural fusion coupling (if available) */ + solarModulation?: { + activity_level: string; + gainMultiplier: number; + metaDelta: number; + confDelta: number; + }; } /** @@ -142,6 +174,11 @@ export interface SolarGovernanceVoteResult extends GovernanceVoteResult { solarContext: SolarContext; /** Confidence adjustment from solar activity */ solarConfidenceAdjustment: number; + /** Solar modulation: coupling gain and level, propagated from neural fusion */ + solarModulation?: { + gainMultiplier: number; + activityLevel: string; + }; } // ============================================================================