0xray 3.1.1 → 3.3.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/codex.codex +1 -1
- package/.opencode/commands/auto-format.md +3 -3
- package/.opencode/commands/auto-summary-capture.md +2 -2
- package/.opencode/commands/enforcer-daily-scan.md +3 -3
- package/.opencode/commands/framework-compliance-audit.md +4 -4
- package/.opencode/commands/interactive-validator.md +2 -2
- package/.opencode/commands/job-summary-logger.md +2 -2
- package/.opencode/commands/mode-switch.md +1 -1
- package/.opencode/commands/model-health-check.md +2 -2
- package/.opencode/commands/performance-analysis.md +2 -2
- package/.opencode/commands/pre-commit-introspection.md +3 -3
- package/.opencode/commands/security-scan.md +3 -3
- package/.opencode/commands/sisyphus-validation.md +3 -3
- package/.opencode/commands/summary-logger.md +2 -2
- package/AGENTS.md +3 -13
- package/README.md +3 -3
- package/dist/AGENTS.md +3 -13
- package/dist/CHANGELOG.md +55 -0
- package/dist/README.md +3 -3
- package/dist/analytics/consent-manager.js +0 -1
- package/dist/analytics/emerging-pattern-detector.js +0 -1
- package/dist/analytics/pattern-learning-engine.js +0 -1
- package/dist/analytics/pattern-performance-tracker.js +0 -1
- package/dist/analytics/predictive-analytics.js +0 -1
- package/dist/analytics/prompt-pattern-analyzer.js +0 -1
- package/dist/analytics/routing-performance-analyzer.js +0 -1
- package/dist/analytics/routing-refiner.js +0 -1
- package/dist/analytics/simple-pattern-analyzer.js +0 -1
- package/dist/cli/commands/archive-logs.js +0 -1
- package/dist/cli/commands/opencode-install.js +13 -0
- package/dist/cli/commands/plugin-commands.js +0 -1
- package/dist/cli/commands/status.js +11 -13
- package/dist/cli/index.js +2 -7
- package/dist/core/activity-logger.js +0 -1
- package/dist/core/adaptive-kernel.js +0 -1
- package/dist/core/boot-orchestrator.js +2 -12
- package/dist/core/bridge.mjs +0 -1
- package/dist/core/codex-formatter.js +0 -1
- package/dist/core/codex-injector.js +0 -1
- package/dist/core/config-loader.js +36 -28
- package/dist/core/context-loader.js +0 -1
- package/dist/core/context-validator.js +0 -1
- package/dist/core/features-config.js +40 -1
- package/dist/core/kernel-patterns.js +0 -1
- package/dist/core/model-router.js +23 -64
- package/dist/core/system-prompt-generator.js +0 -1
- package/dist/delegation/agent-delegator.js +0 -1
- package/dist/delegation/agent-expertise.js +0 -1
- package/dist/delegation/analytics/index.js +0 -1
- package/dist/delegation/analytics/learning-engine.js +0 -1
- package/dist/delegation/analytics/outcome-tracker.js +0 -1
- package/dist/delegation/analytics/routing-analytics.js +0 -1
- package/dist/delegation/ast-code-parser.js +0 -1
- package/dist/delegation/complexity-analyzer.js +0 -1
- package/dist/delegation/dependency-graph-builder.js +0 -1
- package/dist/delegation/index.js +0 -1
- package/dist/delegation/metrics-aggregator.js +0 -1
- package/dist/delegation/session-coordinator.js +0 -1
- package/dist/delegation/strategy-selector.js +0 -1
- package/dist/delegation/voting-coordinator.js +0 -1
- package/dist/delegation/voting-types.js +0 -1
- package/dist/delegation/weighted-voting-aggregator.js +0 -1
- package/dist/enforcement/core/index.js +0 -1
- package/dist/enforcement/core/rule-executor.js +0 -1
- package/dist/enforcement/core/rule-hierarchy.js +0 -1
- package/dist/enforcement/core/rule-registry.js +0 -1
- package/dist/enforcement/core/violation-fixer.js +0 -1
- package/dist/enforcement/index.js +0 -1
- package/dist/enforcement/loaders/agent-triage-loader.js +0 -1
- package/dist/enforcement/loaders/agents-md-validation-loader.js +0 -1
- package/dist/enforcement/loaders/base-loader.js +0 -1
- package/dist/enforcement/loaders/codex-loader.js +0 -1
- package/dist/enforcement/loaders/index.js +0 -1
- package/dist/enforcement/loaders/loader-orchestrator.js +0 -1
- package/dist/enforcement/loaders/processor-loader.js +0 -1
- package/dist/enforcement/types.js +0 -1
- package/dist/enforcement/validators/architecture-validators.js +0 -1
- package/dist/enforcement/validators/base-validator.js +0 -1
- package/dist/enforcement/validators/code-quality-validators.js +0 -1
- package/dist/enforcement/validators/index.js +0 -1
- package/dist/enforcement/validators/security-validators.js +0 -1
- package/dist/enforcement/validators/testing-validators.js +0 -1
- package/dist/enforcement/validators/validator-registry.js +0 -1
- package/dist/governance/codex-policy.service.js +0 -1
- package/dist/inference/inference-agent-invoker.js +67 -0
- package/dist/inference/inference-applier.js +178 -0
- package/dist/inference/inference-cycle.js +51 -827
- package/dist/inference/inference-proposal-generator.js +149 -0
- package/dist/infrastructure/iac-validator.js +465 -0
- package/dist/infrastructure/schemas/cloud-schemas.js +488 -0
- package/dist/integrations/base/ExampleIntegration.js +0 -1
- package/dist/integrations/base/Integration.js +0 -1
- package/dist/integrations/base/index.js +0 -1
- package/dist/integrations/base/registry.js +0 -1
- package/dist/integrations/base/types.js +0 -1
- package/dist/integrations/enforcement-gate.js +3 -3
- package/dist/integrations/governance/governance-client.js +0 -1
- package/dist/integrations/governance/index.js +11 -19
- package/dist/integrations/governance/types.js +0 -1
- package/dist/integrations/hermes-agent/__init__.py +4 -0
- package/dist/integrations/hermes-agent/bridge.mjs +37 -0
- package/dist/integrations/openclaw/api-server.js +0 -1
- package/dist/integrations/openclaw/client.js +0 -1
- package/dist/integrations/openclaw/config.js +0 -1
- package/dist/integrations/openclaw/hooks/xray-hooks.js +0 -1
- package/dist/integrations/openclaw/index.js +0 -1
- package/dist/integrations/openclaw/types.js +0 -1
- package/dist/integrations/plugins/index.js +0 -1
- package/dist/integrations/plugins/plugin-integration.js +0 -1
- package/dist/integrations/plugins/plugin-registry.js +0 -1
- package/dist/mcps/agent-resolver.js +0 -1
- package/dist/mcps/architect-tools.server.js +119 -185
- package/dist/mcps/auto-format.server.js +56 -74
- package/dist/mcps/boot-orchestrator.server.js +67 -85
- package/dist/mcps/config/config-loader.js +6 -0
- package/dist/mcps/config/plugin-server-registry.js +0 -1
- package/dist/mcps/enforcer-tools.server.js +207 -273
- package/dist/mcps/estimation.server.js +63 -107
- package/dist/mcps/framework-compliance-audit.server.js +52 -81
- package/dist/mcps/framework-help.server.js +71 -89
- package/dist/mcps/governance.server.js +97 -149
- package/dist/mcps/knowledge-skills/api-design.server.js +33 -65
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js +33 -65
- package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +123 -163
- package/dist/mcps/knowledge-skills/code-analyzer.server.js +210 -237
- package/dist/mcps/knowledge-skills/code-review.server.js +108 -142
- package/dist/mcps/knowledge-skills/content-creator.server.js +203 -225
- package/dist/mcps/knowledge-skills/database-design.server.js +116 -150
- package/dist/mcps/knowledge-skills/devops-deployment.server.js +123 -157
- package/dist/mcps/knowledge-skills/git-workflow.server.js +34 -67
- package/dist/mcps/knowledge-skills/growth-strategist.server.js +301 -323
- package/dist/mcps/knowledge-skills/log-monitor.server.js +139 -159
- package/dist/mcps/knowledge-skills/mobile-development.server.js +170 -200
- package/dist/mcps/knowledge-skills/multimodal-looker.server.js +122 -158
- package/dist/mcps/knowledge-skills/performance-optimization.server.js +88 -138
- package/dist/mcps/knowledge-skills/project-analysis.server.js +131 -218
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +115 -150
- package/dist/mcps/knowledge-skills/security-audit.server.js +16 -143
- package/dist/mcps/knowledge-skills/seo-consultant.server.js +20 -213
- package/dist/mcps/knowledge-skills/session-management.server.js +13 -90
- package/dist/mcps/knowledge-skills/skill-invocation.server.js +43 -421
- package/dist/mcps/knowledge-skills/strategist.server.js +10 -55
- package/dist/mcps/knowledge-skills/tech-writer.server.js +16 -191
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js +18 -191
- package/dist/mcps/knowledge-skills/testing-strategy.server.js +18 -156
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js +22 -296
- package/dist/mcps/lint.server.js +50 -91
- package/dist/mcps/model-health-check.server.js +32 -60
- package/dist/mcps/orchestrator/aside-context.js +207 -0
- package/dist/mcps/orchestrator/config/agent-capabilities.js +30 -11
- package/dist/mcps/orchestrator/config/memory-routing-bridge.js +70 -0
- package/dist/mcps/orchestrator/execution/execution-planner.js +25 -7
- package/dist/mcps/orchestrator/handlers/complexity-handler.js +5 -1
- package/dist/mcps/orchestrator/handlers/status-handler.js +8 -1
- package/dist/mcps/orchestrator/handlers/task-handler.js +59 -1
- package/dist/mcps/orchestrator/index.js +5 -0
- package/dist/mcps/orchestrator/server.js +63 -8
- package/dist/mcps/performance-analysis.server.js +56 -87
- package/dist/mcps/processor-pipeline.server.js +68 -99
- package/dist/mcps/researcher.server.js +80 -153
- package/dist/mcps/security-scan.server.js +56 -70
- package/dist/mcps/shared/knowledge-skill-base.js +11 -4
- package/dist/mcps/state-manager.server.js +124 -152
- package/dist/memory-routing/index.js +4 -0
- package/dist/memory-routing/null-provider.js +51 -0
- package/dist/memory-routing/provider-loader.js +91 -0
- package/dist/memory-routing/provider-registry.js +40 -0
- package/dist/memory-routing/types.js +7 -0
- package/dist/memory-routing/validate-config.js +32 -0
- package/dist/monitoring/nudge-watchdog.js +0 -1
- package/dist/nucleus/default-plugins.js +13 -19
- package/dist/nucleus/index.js +0 -1
- package/dist/nucleus/thin-dispatch.js +29 -1
- package/dist/orchestrator/agent-spawn-governor.js +0 -1
- package/dist/orchestrator/intelligent-commit-batcher.js +2 -10
- package/dist/orchestrator/multi-agent-orchestration-coordinator.js +0 -1
- package/dist/orchestrator/orchestrator.js +8 -18
- package/dist/orchestrator/self-direction-activation.js +0 -1
- package/dist/orchestrator/universal-registry-bridge.js +0 -1
- package/dist/performance/performance-budget-enforcer.js +0 -1
- package/dist/performance/performance-regression-tester.js +0 -1
- package/dist/plugin/plugin-codex-context.js +87 -0
- package/dist/plugin/plugin-helpers.js +155 -0
- package/dist/plugin/plugin-logger.js +46 -0
- package/dist/plugin/plugin-modules.js +144 -0
- package/dist/plugin/plugin-quality-gate.js +88 -0
- package/dist/plugin/plugin-types.js +1 -0
- package/dist/plugin/xray-codex-injection.js +338 -0
- package/dist/postprocessor/PostProcessor.js +3 -9
- package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +50 -0
- package/dist/postprocessor/config/ProcessorConfigLoader.js +16 -0
- package/dist/postprocessor/integration.js +194 -0
- package/dist/postprocessor/metamorphosis/SelfProposalEngine.js +472 -0
- package/dist/postprocessor/metamorphosis/index.js +1 -0
- package/dist/postprocessor/redeploy/RetryHandler.js +118 -0
- package/dist/postprocessor/services/RegressionAnalysisService.js +0 -1
- package/dist/postprocessor/triggers/APITrigger.js +0 -1
- package/dist/postprocessor/triggers/WebhookTrigger.js +0 -1
- package/dist/processors/implementations/agents-md-validation-processor.js +0 -1
- package/dist/processors/implementations/async-pattern-processor.js +0 -1
- package/dist/processors/implementations/console-log-guard-processor.js +0 -1
- package/dist/processors/implementations/coverage-analysis-processor.js +0 -1
- package/dist/processors/implementations/inference-improvement-processor.js +2 -9
- package/dist/processors/implementations/log-protection-processor.js +0 -1
- package/dist/processors/implementations/nudge-processor.js +0 -1
- package/dist/processors/implementations/performance-budget-processor.js +0 -1
- package/dist/processors/implementations/postprocessor-chain-validator.js +0 -1
- package/dist/processors/implementations/publish-preflight-processor.js +4 -12
- package/dist/processors/implementations/session-summary-processor.js +8 -16
- package/dist/processors/implementations/spawn-governance-processor.js +0 -1
- package/dist/processors/implementations/storytelling-trigger-processor.js +3 -28
- package/dist/processors/implementations/test-auto-creation-processor.js +0 -1
- package/dist/processors/implementations/typescript-compilation-processor.js +0 -1
- package/dist/processors/implementations/version-compliance-processor.js +0 -1
- package/dist/processors/processor-interfaces.js +0 -1
- package/dist/processors/processor-types.js +0 -1
- package/dist/scripts/integration.js +0 -1
- package/dist/security/comprehensive-security-audit.js +0 -1
- package/dist/security/security-agent-coordinator.js +0 -1
- package/dist/security/security-auditor.js +0 -1
- package/dist/security/security-hardener.js +0 -1
- package/dist/security/security-hardening-system.js +0 -1
- package/dist/security/security-headers.js +0 -1
- package/dist/security/security-orchestration-layer.js +0 -1
- package/dist/services/inference-tuner.js +0 -1
- package/dist/session/session-cleanup-manager.js +0 -1
- package/dist/session/session-monitor.js +0 -1
- package/dist/session/session-state-manager.js +0 -1
- package/dist/skills/xray-orchestrator/index.js +0 -1
- package/dist/utils/codex-parser.js +0 -1
- package/dist/utils/language-detector.js +0 -1
- package/dist/utils/shutdown-handler.js +0 -1
- package/dist/validation/agent-config-validator.js +280 -0
- package/dist/validation/orchestration-flow-validator.js +606 -0
- package/package.json +1 -1
- package/scripts/node/release.mjs +2 -2
- package/scripts/node/setup.cjs +28 -0
- package/scripts/node/universal-version-manager.js +1 -1
- package/src/mcps/agent-resolver.ts +0 -1
- package/src/mcps/architect-tools.server.ts +129 -211
- package/src/mcps/auto-format.server.ts +74 -103
- package/src/mcps/boot-orchestrator.server.ts +71 -96
- package/src/mcps/config/__tests__/config-loader.test.ts +6 -6
- package/src/mcps/config/config-loader.ts +7 -0
- package/src/mcps/config/plugin-server-registry.ts +0 -1
- package/src/mcps/enforcer-tools.server.ts +217 -294
- package/src/mcps/estimation.server.ts +62 -122
- package/src/mcps/framework-compliance-audit.server.ts +53 -95
- package/src/mcps/framework-help.server.ts +74 -96
- package/src/mcps/governance.server.ts +97 -162
- package/src/mcps/knowledge-skills/api-design.server.ts +33 -72
- package/src/mcps/knowledge-skills/architecture-patterns.server.ts +33 -72
- package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +148 -193
- package/src/mcps/knowledge-skills/code-analyzer.server.ts +222 -254
- package/src/mcps/knowledge-skills/code-review.server.ts +115 -157
- package/src/mcps/knowledge-skills/content-creator.server.ts +219 -246
- package/src/mcps/knowledge-skills/database-design.server.ts +119 -160
- package/src/mcps/knowledge-skills/devops-deployment.server.ts +126 -167
- package/src/mcps/knowledge-skills/git-workflow.server.ts +32 -77
- package/src/mcps/knowledge-skills/growth-strategist.server.ts +322 -360
- package/src/mcps/knowledge-skills/log-monitor.server.ts +68 -95
- package/src/mcps/knowledge-skills/mobile-development.server.ts +16 -56
- package/src/mcps/knowledge-skills/multimodal-looker.server.ts +13 -59
- package/src/mcps/knowledge-skills/performance-optimization.server.ts +13 -74
- package/src/mcps/knowledge-skills/project-analysis.server.ts +13 -120
- package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +13 -60
- package/src/mcps/knowledge-skills/security-audit.server.ts +19 -157
- package/src/mcps/knowledge-skills/seo-consultant.server.ts +23 -227
- package/src/mcps/knowledge-skills/session-management.server.ts +17 -106
- package/src/mcps/knowledge-skills/skill-invocation.server.ts +45 -446
- package/src/mcps/knowledge-skills/strategist.server.ts +13 -63
- package/src/mcps/knowledge-skills/tech-writer.server.ts +19 -204
- package/src/mcps/knowledge-skills/testing-best-practices.server.ts +21 -204
- package/src/mcps/knowledge-skills/testing-strategy.server.ts +21 -165
- package/src/mcps/knowledge-skills/ui-ux-design.server.ts +25 -342
- package/src/mcps/lint.server.ts +52 -105
- package/src/mcps/model-health-check.server.ts +34 -70
- package/src/mcps/orchestrator/aside-context.ts +245 -0
- package/src/mcps/orchestrator/config/agent-capabilities.ts +49 -14
- package/src/mcps/orchestrator/config/memory-routing-bridge.ts +80 -0
- package/src/mcps/orchestrator/execution/execution-planner.ts +36 -9
- package/src/mcps/orchestrator/handlers/complexity-handler.ts +9 -3
- package/src/mcps/orchestrator/handlers/status-handler.ts +11 -1
- package/src/mcps/orchestrator/handlers/task-handler.ts +78 -2
- package/src/mcps/orchestrator/index.ts +29 -0
- package/src/mcps/orchestrator/server.ts +79 -24
- package/src/mcps/orchestrator/types.ts +50 -0
- package/src/mcps/performance-analysis.server.ts +59 -102
- package/src/mcps/processor-pipeline.server.ts +70 -108
- package/src/mcps/researcher.server.ts +87 -175
- package/src/mcps/security-scan.server.ts +57 -76
- package/src/mcps/shared/knowledge-skill-base.ts +12 -4
- package/src/mcps/state-manager.server.ts +129 -169
- package/src/opencode/codex.codex +1 -1
- package/src/opencode/commands/auto-format.md +3 -3
- package/src/opencode/commands/auto-summary-capture.md +2 -2
- package/src/opencode/commands/enforcer-daily-scan.md +3 -3
- package/src/opencode/commands/framework-compliance-audit.md +4 -4
- package/src/opencode/commands/interactive-validator.md +2 -2
- package/src/opencode/commands/job-summary-logger.md +2 -2
- package/src/opencode/commands/mode-switch.md +1 -1
- package/src/opencode/commands/model-health-check.md +2 -2
- package/src/opencode/commands/performance-analysis.md +2 -2
- package/src/opencode/commands/pre-commit-introspection.md +3 -3
- package/src/opencode/commands/security-scan.md +3 -3
- package/src/opencode/commands/sisyphus-validation.md +3 -3
- package/src/opencode/commands/summary-logger.md +2 -2
- package/src/skills/xray-orchestrator/index.ts +0 -1
- package/dist/nucleus/orchestrator.js +0 -479
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AsideContext — bounded subcontext for depth, continuity, and layered exploration
|
|
3
|
+
*
|
|
4
|
+
* Enables the orchestrator to spawn sub-investigations that inherit session context,
|
|
5
|
+
* accumulate structured observations from v3 subsystems (governance, orchestration,
|
|
6
|
+
* complexity analysis), and feed results back into the governance loop.
|
|
7
|
+
*/
|
|
8
|
+
import { frameworkLogger } from "../../core/framework-logger.js";
|
|
9
|
+
let asideCounter = 0;
|
|
10
|
+
const activeAsides = new Map();
|
|
11
|
+
export function getActiveAsideCount() {
|
|
12
|
+
return activeAsides.size;
|
|
13
|
+
}
|
|
14
|
+
export function getActiveAsideIds() {
|
|
15
|
+
return Array.from(activeAsides.keys());
|
|
16
|
+
}
|
|
17
|
+
export function getAsideState(asideId) {
|
|
18
|
+
return activeAsides.get(asideId);
|
|
19
|
+
}
|
|
20
|
+
export function addObservations(asideId, observations) {
|
|
21
|
+
const aside = activeAsides.get(asideId);
|
|
22
|
+
if (!aside)
|
|
23
|
+
return false;
|
|
24
|
+
aside.observations.push(...observations);
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
export function extractGovernanceObservations(result) {
|
|
28
|
+
const obs = [];
|
|
29
|
+
obs.push({
|
|
30
|
+
key: "governanceCycleId",
|
|
31
|
+
value: result.cycleId,
|
|
32
|
+
source: "inference/inference-cycle.ts",
|
|
33
|
+
});
|
|
34
|
+
obs.push({
|
|
35
|
+
key: "governanceVoteCount",
|
|
36
|
+
value: String(result.votes.length),
|
|
37
|
+
source: "inference/inference-cycle.ts",
|
|
38
|
+
});
|
|
39
|
+
const approved = result.votes.filter((v) => v.decision === "approve").length;
|
|
40
|
+
const rejected = result.votes.filter((v) => v.decision === "reject").length;
|
|
41
|
+
obs.push({
|
|
42
|
+
key: "governanceApprovedCount",
|
|
43
|
+
value: String(approved),
|
|
44
|
+
source: "inference/inference-cycle.ts",
|
|
45
|
+
});
|
|
46
|
+
obs.push({
|
|
47
|
+
key: "governanceRejectedCount",
|
|
48
|
+
value: String(rejected),
|
|
49
|
+
source: "inference/inference-cycle.ts",
|
|
50
|
+
});
|
|
51
|
+
if (result.corpusSummary) {
|
|
52
|
+
obs.push({
|
|
53
|
+
key: "corpusSessionCount",
|
|
54
|
+
value: String(result.corpusSummary.sessions),
|
|
55
|
+
source: "inference/inference-cycle.ts",
|
|
56
|
+
});
|
|
57
|
+
obs.push({
|
|
58
|
+
key: "corpusPatternCount",
|
|
59
|
+
value: String(result.corpusSummary.recurringPatterns),
|
|
60
|
+
source: "inference/inference-cycle.ts",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return obs;
|
|
64
|
+
}
|
|
65
|
+
export function extractOrchestrationObservations(result) {
|
|
66
|
+
const obs = [];
|
|
67
|
+
obs.push({
|
|
68
|
+
key: "orchestrationSuccess",
|
|
69
|
+
value: String(result.success),
|
|
70
|
+
source: "mcps/orchestrator/types.ts",
|
|
71
|
+
});
|
|
72
|
+
obs.push({
|
|
73
|
+
key: "tasksCompleted",
|
|
74
|
+
value: String(result.completedTasks),
|
|
75
|
+
source: "mcps/orchestrator/types.ts",
|
|
76
|
+
});
|
|
77
|
+
obs.push({
|
|
78
|
+
key: "tasksFailed",
|
|
79
|
+
value: String(result.failedTasks),
|
|
80
|
+
source: "mcps/orchestrator/types.ts",
|
|
81
|
+
});
|
|
82
|
+
obs.push({
|
|
83
|
+
key: "orchestrationDuration",
|
|
84
|
+
value: `${result.duration}ms`,
|
|
85
|
+
source: "mcps/orchestrator/types.ts",
|
|
86
|
+
});
|
|
87
|
+
for (const b of result.bottlenecks) {
|
|
88
|
+
obs.push({
|
|
89
|
+
key: "bottleneck",
|
|
90
|
+
value: b.substring(0, 200),
|
|
91
|
+
source: "mcps/orchestrator/types.ts",
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
for (const r of result.recommendations) {
|
|
95
|
+
obs.push({
|
|
96
|
+
key: "recommendation",
|
|
97
|
+
value: r.substring(0, 200),
|
|
98
|
+
source: "mcps/orchestrator/types.ts",
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return obs;
|
|
102
|
+
}
|
|
103
|
+
export function extractComplexityObservations(analysis) {
|
|
104
|
+
const obs = [];
|
|
105
|
+
obs.push({
|
|
106
|
+
key: "complexityScore",
|
|
107
|
+
value: String(analysis.overallComplexity),
|
|
108
|
+
source: "mcps/orchestrator/execution/execution-planner.ts",
|
|
109
|
+
});
|
|
110
|
+
obs.push({
|
|
111
|
+
key: "recommendedStrategy",
|
|
112
|
+
value: analysis.recommendedStrategy,
|
|
113
|
+
source: "mcps/orchestrator/execution/execution-planner.ts",
|
|
114
|
+
});
|
|
115
|
+
obs.push({
|
|
116
|
+
key: "parallelPotential",
|
|
117
|
+
value: String(analysis.parallelPotential),
|
|
118
|
+
source: "mcps/orchestrator/execution/execution-planner.ts",
|
|
119
|
+
});
|
|
120
|
+
obs.push({
|
|
121
|
+
key: "estimatedDuration",
|
|
122
|
+
value: `${analysis.estimatedDuration}ms`,
|
|
123
|
+
source: "mcps/orchestrator/execution/execution-planner.ts",
|
|
124
|
+
});
|
|
125
|
+
for (const tc of analysis.taskComplexity) {
|
|
126
|
+
obs.push({
|
|
127
|
+
key: `taskComplexity`,
|
|
128
|
+
value: `${tc.complexity} (${tc.category})`,
|
|
129
|
+
source: "mcps/orchestrator/execution/execution-planner.ts",
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return obs;
|
|
133
|
+
}
|
|
134
|
+
export async function spawnAside(options) {
|
|
135
|
+
const asideId = options.parentAsideId
|
|
136
|
+
? `${options.parentAsideId}.aside-${++asideCounter}`
|
|
137
|
+
: `aside-${++asideCounter}-${Date.now()}`;
|
|
138
|
+
const startTime = Date.now();
|
|
139
|
+
const aside = {
|
|
140
|
+
asideId,
|
|
141
|
+
description: options.description,
|
|
142
|
+
startedAt: startTime,
|
|
143
|
+
observations: [],
|
|
144
|
+
...(options.inheritedContext !== undefined ? { inheritedContext: options.inheritedContext } : {}),
|
|
145
|
+
...(options.parentAsideId !== undefined ? { parentAsideId: options.parentAsideId } : {}),
|
|
146
|
+
...(options.sessionId !== undefined ? { sessionId: options.sessionId } : {}),
|
|
147
|
+
...(options.priorVerdictContext !== undefined ? { priorVerdictContext: options.priorVerdictContext } : {}),
|
|
148
|
+
};
|
|
149
|
+
activeAsides.set(asideId, aside);
|
|
150
|
+
frameworkLogger.log("aside-context", "aside-spawn", "info", {
|
|
151
|
+
asideId,
|
|
152
|
+
description: options.description,
|
|
153
|
+
sessionId: options.sessionId,
|
|
154
|
+
parentAsideId: options.parentAsideId,
|
|
155
|
+
activeAsideCount: activeAsides.size,
|
|
156
|
+
});
|
|
157
|
+
if (options.priorVerdictContext) {
|
|
158
|
+
const decision = options.priorVerdictContext["decision"];
|
|
159
|
+
if (decision) {
|
|
160
|
+
aside.observations.push({
|
|
161
|
+
key: "governanceDecision",
|
|
162
|
+
value: String(decision),
|
|
163
|
+
source: "priorVerdictContext",
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const duration = Date.now() - startTime;
|
|
168
|
+
const result = {
|
|
169
|
+
asideId,
|
|
170
|
+
description: options.description,
|
|
171
|
+
success: true,
|
|
172
|
+
duration,
|
|
173
|
+
observations: aside.observations,
|
|
174
|
+
...(options.priorVerdictContext !== undefined ? { priorVerdictContext: options.priorVerdictContext } : {}),
|
|
175
|
+
};
|
|
176
|
+
frameworkLogger.log("aside-context", "aside-complete", "info", {
|
|
177
|
+
asideId,
|
|
178
|
+
duration,
|
|
179
|
+
observationCount: aside.observations.length,
|
|
180
|
+
activeAsideCount: activeAsides.size,
|
|
181
|
+
});
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
export function closeAside(asideId) {
|
|
185
|
+
const aside = activeAsides.get(asideId);
|
|
186
|
+
if (!aside)
|
|
187
|
+
return false;
|
|
188
|
+
activeAsides.delete(asideId);
|
|
189
|
+
frameworkLogger.log("aside-context", "aside-closed", "info", {
|
|
190
|
+
asideId,
|
|
191
|
+
duration: Date.now() - aside.startedAt,
|
|
192
|
+
remainingActive: activeAsides.size,
|
|
193
|
+
});
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
export function closeAllAsides() {
|
|
197
|
+
const count = activeAsides.size;
|
|
198
|
+
activeAsides.clear();
|
|
199
|
+
frameworkLogger.log("aside-context", "aside-close-all", "info", {
|
|
200
|
+
closedCount: count,
|
|
201
|
+
});
|
|
202
|
+
return count;
|
|
203
|
+
}
|
|
204
|
+
export function resetAsideContext() {
|
|
205
|
+
activeAsides.clear();
|
|
206
|
+
asideCounter = 0;
|
|
207
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent Capabilities Configuration
|
|
3
3
|
*
|
|
4
|
-
* Centralized agent capability definitions for orchestration decisions
|
|
4
|
+
* Centralized agent capability definitions for orchestration decisions.
|
|
5
|
+
* Enriched at runtime by the active MemoryRoutingProvider (Repertoire, etc.).
|
|
5
6
|
*/
|
|
6
7
|
import { AGENT_REGISTRY } from "../../../agents/registry.js";
|
|
8
|
+
import { initializeMemoryRouting } from '../../../memory-routing/index.js';
|
|
9
|
+
import { getProvider, toMemoryCapabilityMap, fromMemoryCapabilityMap, } from './memory-routing-bridge.js';
|
|
7
10
|
const DEFAULT_AGENT_CAPABILITIES = Object.fromEntries(Object.entries(AGENT_REGISTRY).map(([name, entry]) => [
|
|
8
11
|
name,
|
|
9
12
|
{
|
|
@@ -12,17 +15,28 @@ const DEFAULT_AGENT_CAPABILITIES = Object.fromEntries(Object.entries(AGENT_REGIS
|
|
|
12
15
|
concurrentTasks: entry.concurrentTasks,
|
|
13
16
|
},
|
|
14
17
|
]));
|
|
18
|
+
initializeMemoryRouting();
|
|
15
19
|
/**
|
|
16
20
|
* Agent Capabilities Manager
|
|
17
21
|
* Manages agent capabilities for orchestration decisions
|
|
18
22
|
*/
|
|
19
23
|
export class AgentCapabilitiesManager {
|
|
20
24
|
capabilities = new Map();
|
|
25
|
+
enriched = false;
|
|
21
26
|
constructor() {
|
|
22
|
-
// Initialize with default capabilities
|
|
23
27
|
Object.entries(DEFAULT_AGENT_CAPABILITIES).forEach(([agent, config]) => {
|
|
24
28
|
this.capabilities.set(agent, config);
|
|
25
29
|
});
|
|
30
|
+
this.applyMemoryRoutingEnrichment();
|
|
31
|
+
}
|
|
32
|
+
applyMemoryRoutingEnrichment() {
|
|
33
|
+
const provider = getProvider();
|
|
34
|
+
if (provider.id === 'null')
|
|
35
|
+
return;
|
|
36
|
+
const memoryCaps = toMemoryCapabilityMap(this.capabilities);
|
|
37
|
+
const enriched = provider.enhanceAgentCapabilities(memoryCaps);
|
|
38
|
+
this.capabilities = fromMemoryCapabilityMap(enriched);
|
|
39
|
+
this.enriched = true;
|
|
26
40
|
}
|
|
27
41
|
/**
|
|
28
42
|
* Get capabilities for a specific agent
|
|
@@ -34,6 +48,8 @@ export class AgentCapabilitiesManager {
|
|
|
34
48
|
* Get all registered agent capabilities
|
|
35
49
|
*/
|
|
36
50
|
getAllCapabilities() {
|
|
51
|
+
if (!this.enriched)
|
|
52
|
+
this.applyMemoryRoutingEnrichment();
|
|
37
53
|
return new Map(this.capabilities);
|
|
38
54
|
}
|
|
39
55
|
/**
|
|
@@ -43,19 +59,20 @@ export class AgentCapabilitiesManager {
|
|
|
43
59
|
this.capabilities.set(agentType, capability);
|
|
44
60
|
}
|
|
45
61
|
/**
|
|
46
|
-
* Select the best agent for a task based on complexity and
|
|
62
|
+
* Select the best agent for a task based on complexity, capabilities, and memory routing.
|
|
47
63
|
*/
|
|
48
|
-
selectAgentForTask(requiredCapabilities, complexity) {
|
|
64
|
+
selectAgentForTask(requiredCapabilities, complexity, operationDescription = '') {
|
|
65
|
+
const provider = getProvider();
|
|
66
|
+
if (provider.id !== 'null' && operationDescription) {
|
|
67
|
+
const memoryCaps = toMemoryCapabilityMap(this.getAllCapabilities());
|
|
68
|
+
return provider.selectAgent(memoryCaps, requiredCapabilities, complexity, operationDescription);
|
|
69
|
+
}
|
|
49
70
|
let bestAgent = null;
|
|
50
71
|
let bestScore = -1;
|
|
51
72
|
for (const [agent, caps] of this.capabilities) {
|
|
52
|
-
|
|
53
|
-
if (complexity > caps.complexityThreshold) {
|
|
73
|
+
if (complexity > caps.complexityThreshold)
|
|
54
74
|
continue;
|
|
55
|
-
|
|
56
|
-
// Calculate capability match score
|
|
57
|
-
const matchCount = requiredCapabilities.filter(cap => caps.capabilities.includes(cap)).length;
|
|
58
|
-
// Prefer agents with more concurrent tasks available
|
|
75
|
+
const matchCount = requiredCapabilities.filter((cap) => caps.capabilities.includes(cap)).length;
|
|
59
76
|
const score = matchCount * 10 + caps.concurrentTasks;
|
|
60
77
|
if (score > bestScore) {
|
|
61
78
|
bestScore = score;
|
|
@@ -77,7 +94,6 @@ export class AgentCapabilitiesManager {
|
|
|
77
94
|
return available;
|
|
78
95
|
}
|
|
79
96
|
}
|
|
80
|
-
// Singleton instance
|
|
81
97
|
let capabilitiesManagerInstance = null;
|
|
82
98
|
export function getAgentCapabilitiesManager() {
|
|
83
99
|
if (!capabilitiesManagerInstance) {
|
|
@@ -85,3 +101,6 @@ export function getAgentCapabilitiesManager() {
|
|
|
85
101
|
}
|
|
86
102
|
return capabilitiesManagerInstance;
|
|
87
103
|
}
|
|
104
|
+
export function resetAgentCapabilitiesManager() {
|
|
105
|
+
capabilitiesManagerInstance = null;
|
|
106
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge between orchestrator types and the pluggable MemoryRoutingProvider.
|
|
3
|
+
*/
|
|
4
|
+
import { getMemoryRoutingProviderSync, } from '../../../memory-routing/index.js';
|
|
5
|
+
export function toMemoryCapability(caps) {
|
|
6
|
+
const result = {
|
|
7
|
+
capabilities: caps.capabilities,
|
|
8
|
+
complexityThreshold: caps.complexityThreshold,
|
|
9
|
+
concurrentTasks: caps.concurrentTasks,
|
|
10
|
+
};
|
|
11
|
+
if (caps.memorySignals)
|
|
12
|
+
result.memorySignals = caps.memorySignals;
|
|
13
|
+
if (caps.memoryTags)
|
|
14
|
+
result.memoryTags = caps.memoryTags;
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
export function fromMemoryCapability(caps) {
|
|
18
|
+
const result = {
|
|
19
|
+
capabilities: caps.capabilities,
|
|
20
|
+
complexityThreshold: caps.complexityThreshold,
|
|
21
|
+
concurrentTasks: caps.concurrentTasks,
|
|
22
|
+
};
|
|
23
|
+
if (caps.memorySignals)
|
|
24
|
+
result.memorySignals = caps.memorySignals;
|
|
25
|
+
if (caps.memoryTags)
|
|
26
|
+
result.memoryTags = caps.memoryTags;
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
export function toMemoryTask(task) {
|
|
30
|
+
const result = {
|
|
31
|
+
id: task.id,
|
|
32
|
+
description: task.description,
|
|
33
|
+
type: task.type,
|
|
34
|
+
};
|
|
35
|
+
if (task.priority)
|
|
36
|
+
result.priority = task.priority;
|
|
37
|
+
if (task.dependencies)
|
|
38
|
+
result.dependencies = task.dependencies;
|
|
39
|
+
if (task.estimatedComplexity !== undefined)
|
|
40
|
+
result.estimatedComplexity = task.estimatedComplexity;
|
|
41
|
+
if (task.metadata)
|
|
42
|
+
result.metadata = task.metadata;
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
export function fromMemoryTask(task) {
|
|
46
|
+
const result = {
|
|
47
|
+
id: task.id,
|
|
48
|
+
description: task.description,
|
|
49
|
+
type: task.type,
|
|
50
|
+
};
|
|
51
|
+
if (task.priority)
|
|
52
|
+
result.priority = task.priority;
|
|
53
|
+
if (task.dependencies)
|
|
54
|
+
result.dependencies = task.dependencies;
|
|
55
|
+
if (task.estimatedComplexity !== undefined)
|
|
56
|
+
result.estimatedComplexity = task.estimatedComplexity;
|
|
57
|
+
const metadata = task.metadata;
|
|
58
|
+
if (metadata)
|
|
59
|
+
result.metadata = metadata;
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
export function toMemoryCapabilityMap(caps) {
|
|
63
|
+
return new Map(Array.from(caps.entries()).map(([k, v]) => [k, toMemoryCapability(v)]));
|
|
64
|
+
}
|
|
65
|
+
export function fromMemoryCapabilityMap(caps) {
|
|
66
|
+
return new Map(Array.from(caps.entries()).map(([k, v]) => [k, fromMemoryCapability(v)]));
|
|
67
|
+
}
|
|
68
|
+
export function getProvider() {
|
|
69
|
+
return getMemoryRoutingProviderSync();
|
|
70
|
+
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Creates optimized execution plans for orchestration tasks
|
|
5
5
|
*/
|
|
6
6
|
import { getAgentCapabilitiesManager } from '../config/agent-capabilities.js';
|
|
7
|
+
import { getProvider, toMemoryTask, fromMemoryTask, } from '../config/memory-routing-bridge.js';
|
|
7
8
|
/**
|
|
8
9
|
* Execution Planner
|
|
9
10
|
* Plans and optimizes task execution strategies
|
|
@@ -48,26 +49,35 @@ export class ExecutionPlanner {
|
|
|
48
49
|
* Create an execution plan based on tasks and mode
|
|
49
50
|
*/
|
|
50
51
|
async createExecutionPlan(tasks, executionMode) {
|
|
52
|
+
const provider = getProvider();
|
|
53
|
+
const memoryTasks = provider.enrichTasks(tasks.map(toMemoryTask));
|
|
54
|
+
const enrichedTasks = memoryTasks.map(fromMemoryTask);
|
|
51
55
|
const agentAssignments = new Map();
|
|
52
56
|
switch (executionMode) {
|
|
53
57
|
case 'parallel':
|
|
54
|
-
this.createParallelPlan(
|
|
58
|
+
this.createParallelPlan(enrichedTasks, agentAssignments);
|
|
55
59
|
break;
|
|
56
60
|
case 'sequential':
|
|
57
|
-
this.createSequentialPlan(
|
|
61
|
+
this.createSequentialPlan(enrichedTasks, agentAssignments);
|
|
58
62
|
break;
|
|
59
63
|
case 'optimized':
|
|
60
64
|
default:
|
|
61
|
-
await this.createOptimizedPlan(
|
|
65
|
+
await this.createOptimizedPlan(enrichedTasks, agentAssignments);
|
|
62
66
|
break;
|
|
63
67
|
}
|
|
64
68
|
const estimatedDuration = this.estimateExecutionDuration(agentAssignments);
|
|
65
|
-
|
|
66
|
-
tasks,
|
|
69
|
+
const plan = {
|
|
70
|
+
tasks: enrichedTasks,
|
|
67
71
|
strategy: executionMode,
|
|
68
72
|
agentAssignments,
|
|
69
73
|
estimatedDuration,
|
|
70
74
|
};
|
|
75
|
+
if (provider.id !== 'null') {
|
|
76
|
+
plan.memoryContext = {
|
|
77
|
+
...provider.buildInheritedContext(memoryTasks),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return plan;
|
|
71
81
|
}
|
|
72
82
|
/**
|
|
73
83
|
* Create a parallel execution plan
|
|
@@ -150,7 +160,11 @@ export class ExecutionPlanner {
|
|
|
150
160
|
assignTasksToAgents(tasks, agentAssignments) {
|
|
151
161
|
for (const task of tasks) {
|
|
152
162
|
const complexity = task.estimatedComplexity || 30;
|
|
153
|
-
const
|
|
163
|
+
const requiredCaps = [
|
|
164
|
+
task.type,
|
|
165
|
+
...(task.metadata?.memorySignals ?? []),
|
|
166
|
+
];
|
|
167
|
+
const agent = this.capabilitiesManager.selectAgentForTask(requiredCaps, complexity, task.description) || 'orchestrator';
|
|
154
168
|
if (!agentAssignments.has(agent)) {
|
|
155
169
|
agentAssignments.set(agent, []);
|
|
156
170
|
}
|
|
@@ -188,7 +202,11 @@ export class ExecutionPlanner {
|
|
|
188
202
|
category: task.type,
|
|
189
203
|
});
|
|
190
204
|
// Assign to agent
|
|
191
|
-
const
|
|
205
|
+
const requiredCaps = [
|
|
206
|
+
task.type,
|
|
207
|
+
...(task.metadata?.memorySignals ?? []),
|
|
208
|
+
];
|
|
209
|
+
const agent = this.capabilitiesManager.selectAgentForTask(requiredCaps, complexity, task.description) || 'orchestrator';
|
|
192
210
|
if (!assignments.has(agent)) {
|
|
193
211
|
assignments.set(agent, []);
|
|
194
212
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { frameworkLogger } from '../../../core/framework-logger.js';
|
|
7
7
|
import { getExecutionPlanner } from '../execution/execution-planner.js';
|
|
8
|
+
import { addObservations, extractComplexityObservations } from '../aside-context.js';
|
|
8
9
|
/**
|
|
9
10
|
* Complexity Handler
|
|
10
11
|
* Processes analyze-complexity requests
|
|
@@ -14,12 +15,15 @@ export class ComplexityHandler {
|
|
|
14
15
|
/**
|
|
15
16
|
* Handle analyze-complexity request
|
|
16
17
|
*/
|
|
17
|
-
async handleAnalyzeComplexity(args) {
|
|
18
|
+
async handleAnalyzeComplexity(args, asideId) {
|
|
18
19
|
const { tasks = [] } = args;
|
|
19
20
|
await frameworkLogger.log('orchestrator.server', 'analyze-complexity-start', 'info', { taskCount: tasks.length });
|
|
20
21
|
try {
|
|
21
22
|
const analysis = await this.planner.analyzeTaskComplexity(tasks);
|
|
22
23
|
const recommendations = this.generateRecommendations(analysis);
|
|
24
|
+
if (asideId) {
|
|
25
|
+
addObservations(asideId, extractComplexityObservations(analysis));
|
|
26
|
+
}
|
|
23
27
|
return {
|
|
24
28
|
content: [
|
|
25
29
|
{
|
|
@@ -41,7 +41,14 @@ export class StatusHandler {
|
|
|
41
41
|
// Overall status
|
|
42
42
|
status = this.getOverallStatus(deps);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
let response = this.formatStatusResponse(status, detailed);
|
|
45
|
+
if (detailed && deps.asideCount !== undefined) {
|
|
46
|
+
response += `\n\n**Active Aside Contexts:**`;
|
|
47
|
+
response += `\n• Count: ${deps.asideCount}`;
|
|
48
|
+
if (deps.asideIds && deps.asideIds.length > 0) {
|
|
49
|
+
response += `\n• IDs: ${deps.asideIds.join(', ')}`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
45
52
|
return { content: [{ type: 'text', text: response }] };
|
|
46
53
|
}
|
|
47
54
|
catch (error) {
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import { frameworkLogger } from '../../../core/framework-logger.js';
|
|
7
7
|
import { getExecutionPlanner } from '../execution/execution-planner.js';
|
|
8
8
|
import { mcpClientManager } from '../../../mcps/mcp-client.js';
|
|
9
|
+
import { addObservations, extractOrchestrationObservations, spawnAside } from '../aside-context.js';
|
|
10
|
+
import { getProvider } from '../config/memory-routing-bridge.js';
|
|
9
11
|
/**
|
|
10
12
|
* Task Handler
|
|
11
13
|
* Processes orchestrate-task requests
|
|
@@ -37,8 +39,37 @@ export class TaskHandler {
|
|
|
37
39
|
}
|
|
38
40
|
// Analyze complexity and create execution plan
|
|
39
41
|
const executionPlan = await this.planner.createExecutionPlan(tasks, executionMode);
|
|
42
|
+
const memoryProvider = getProvider();
|
|
43
|
+
if (memoryProvider.id !== 'null' && executionPlan.memoryContext) {
|
|
44
|
+
await spawnAside({
|
|
45
|
+
description: `Orchestrate: ${description}`,
|
|
46
|
+
sessionId,
|
|
47
|
+
inheritedContext: {
|
|
48
|
+
memoryRouting: executionPlan.memoryContext,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}
|
|
40
52
|
// Execute orchestration (simulated for MCP server)
|
|
41
53
|
const results = await this.executePlan(executionPlan, sessionId, timeout);
|
|
54
|
+
// Feed per-task outcomes back to memory provider (not aggregate session stats)
|
|
55
|
+
if (memoryProvider.ingestFeedback) {
|
|
56
|
+
const outcomeByKey = new Map(results.taskOutcomes.map((o) => [`${o.agent}:${o.taskId}`, o]));
|
|
57
|
+
for (const [agent, assignedTasks] of executionPlan.agentAssignments) {
|
|
58
|
+
for (const task of assignedTasks) {
|
|
59
|
+
const outcome = outcomeByKey.get(`${agent}:${task.id}`);
|
|
60
|
+
memoryProvider.ingestFeedback({
|
|
61
|
+
timestamp: new Date().toISOString(),
|
|
62
|
+
sessionId,
|
|
63
|
+
taskId: task.id,
|
|
64
|
+
assignedAgent: agent,
|
|
65
|
+
memorySignals: task.metadata?.memorySignals ?? [],
|
|
66
|
+
complexity: task.estimatedComplexity ?? 30,
|
|
67
|
+
success: outcome?.success ?? false,
|
|
68
|
+
durationMs: outcome?.durationMs ?? 0,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
42
73
|
// Update result
|
|
43
74
|
orchestrationResult.success = results.success;
|
|
44
75
|
orchestrationResult.completedTasks = results.completedTasks;
|
|
@@ -49,6 +80,10 @@ export class TaskHandler {
|
|
|
49
80
|
if (results.agentOutputs) {
|
|
50
81
|
orchestrationResult.agentOutputs = results.agentOutputs;
|
|
51
82
|
}
|
|
83
|
+
// Push observations into aside context if active
|
|
84
|
+
if (deps.asideId) {
|
|
85
|
+
addObservations(deps.asideId, extractOrchestrationObservations(orchestrationResult));
|
|
86
|
+
}
|
|
52
87
|
// Store in history
|
|
53
88
|
deps.taskHistory.push({
|
|
54
89
|
sessionId,
|
|
@@ -77,6 +112,7 @@ export class TaskHandler {
|
|
|
77
112
|
let completedTasks = 0;
|
|
78
113
|
let failedTasks = 0;
|
|
79
114
|
const agentOutputs = {};
|
|
115
|
+
const taskOutcomes = [];
|
|
80
116
|
const skillServers = new Set([
|
|
81
117
|
'code-review', 'code-reviewer',
|
|
82
118
|
'security-audit', 'security-auditor',
|
|
@@ -91,6 +127,7 @@ export class TaskHandler {
|
|
|
91
127
|
agentUtilization[agent] = tasks.length;
|
|
92
128
|
if (skillServers.has(agent)) {
|
|
93
129
|
for (const task of tasks) {
|
|
130
|
+
const taskStart = Date.now();
|
|
94
131
|
try {
|
|
95
132
|
const toolName = this.mapAgentToTool(agent);
|
|
96
133
|
const result = await mcpClientManager.callServerTool(agent, toolName, {
|
|
@@ -101,10 +138,22 @@ export class TaskHandler {
|
|
|
101
138
|
const outputText = this.extractTextFromMcpResult(result);
|
|
102
139
|
agentOutputs[`${agent}:${task.id}`] = outputText;
|
|
103
140
|
completedTasks++;
|
|
141
|
+
taskOutcomes.push({
|
|
142
|
+
taskId: task.id,
|
|
143
|
+
agent,
|
|
144
|
+
success: true,
|
|
145
|
+
durationMs: Date.now() - taskStart,
|
|
146
|
+
});
|
|
104
147
|
}
|
|
105
148
|
catch (err) {
|
|
106
149
|
failedTasks++;
|
|
107
150
|
agentOutputs[`${agent}:${task.id}`] = `Error: ${err instanceof Error ? err.message : String(err)}`;
|
|
151
|
+
taskOutcomes.push({
|
|
152
|
+
taskId: task.id,
|
|
153
|
+
agent,
|
|
154
|
+
success: false,
|
|
155
|
+
durationMs: Date.now() - taskStart,
|
|
156
|
+
});
|
|
108
157
|
frameworkLogger.log('orchestrator.task-handler', 'task-execution-failed', 'warning', {
|
|
109
158
|
agent,
|
|
110
159
|
taskId: task.id,
|
|
@@ -115,7 +164,15 @@ export class TaskHandler {
|
|
|
115
164
|
}
|
|
116
165
|
else {
|
|
117
166
|
// For non-MCP agents we still count them as "assigned" (they will be handled by the caller or legacy path)
|
|
118
|
-
|
|
167
|
+
for (const task of tasks) {
|
|
168
|
+
completedTasks++;
|
|
169
|
+
taskOutcomes.push({
|
|
170
|
+
taskId: task.id,
|
|
171
|
+
agent,
|
|
172
|
+
success: true,
|
|
173
|
+
durationMs: 0,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
119
176
|
}
|
|
120
177
|
}
|
|
121
178
|
const recommendations = [];
|
|
@@ -136,6 +193,7 @@ export class TaskHandler {
|
|
|
136
193
|
bottlenecks,
|
|
137
194
|
recommendations,
|
|
138
195
|
agentOutputs,
|
|
196
|
+
taskOutcomes,
|
|
139
197
|
};
|
|
140
198
|
}
|
|
141
199
|
mapAgentToTool(agent) {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { OrchestratorServer, createOrchestratorServer } from './server.js';
|
|
2
|
+
export { TaskHandler } from './handlers/task-handler.js';
|
|
3
|
+
export { ComplexityHandler } from './handlers/complexity-handler.js';
|
|
4
|
+
export { StatusHandler } from './handlers/status-handler.js';
|
|
5
|
+
export { spawnAside, closeAside, closeAllAsides, addObservations, getActiveAsideCount, getActiveAsideIds, getAsideState, resetAsideContext, extractGovernanceObservations, extractOrchestrationObservations, extractComplexityObservations, } from './aside-context.js';
|