diff options
Diffstat (limited to 'modules/core/module-orchestrator.js')
| -rw-r--r-- | modules/core/module-orchestrator.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/core/module-orchestrator.js b/modules/core/module-orchestrator.js index 4fab599..de88424 100644 --- a/modules/core/module-orchestrator.js +++ b/modules/core/module-orchestrator.js @@ -75,6 +75,22 @@ class OrchestratorModule { agent = Object.values(this._agents).find(a => a.status === 'idle'); } if (!agent) return this.terminal.print('❌ No available agents', 'error'); + + // A2A Contract handshake — validate task against agent's contract + const registry = this.terminal.moduleManager.modules['AgentRegistryModule']; + let contractValid = true; + if (registry) { + const result = registry.validateTask(agent.role, task); + if (!result.valid) { + this.terminal.print(`⚠️ A2A validation: ${result.reason}`, 'warning'); + this.terminal.print(` Contract for '${agent.role}' requires: ${(registry.getContract(agent.role) || {}).input_schema || 'free-form'}`, 'warning'); + // Offer to proceed anyway (permissive) — user can create a proper contract + contractValid = false; + } else if (result.reason === 'matched') { + this.terminal.print(`✅ A2A contract matched for role '${agent.role}'`, 'success'); + } + } + // Create a lease const leaseModule = this.terminal.moduleManager.modules['LeaseModule']; const lease = leaseModule ? leaseModule.createLease(['lease-create', agent.id, '60', task]) : null; |