From aafb0fbde5289a45f9f818a00141f80b149be283 Mon Sep 17 00:00:00 2001 From: Agando Date: Tue, 2 Jun 2026 18:00:37 +0200 Subject: auto: 2026-06-02_18:00 changes --- modules/core/module-aiassist.js | 74 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) (limited to 'modules/core/module-aiassist.js') diff --git a/modules/core/module-aiassist.js b/modules/core/module-aiassist.js index edc5225..eb41af9 100644 --- a/modules/core/module-aiassist.js +++ b/modules/core/module-aiassist.js @@ -384,6 +384,40 @@ RULES: description: 'Session aggregate stats', parameters: { type: 'object', properties: {}, required: [] } } + }, { + type: 'function', + function: { + name: 'list_agents', + description: 'List registered agent IDs, status, and capabilities', + parameters: { type: 'object', properties: {}, required: [] } + } + }, { + type: 'function', + function: { + name: 'delegate_task', + description: '(DESTRUCTIVE) Delegate a task to a worker agent. Auto-spawns if needed.', + parameters: { + type: 'object', + properties: { + task: { type: 'string', description: 'The task description to delegate' } + }, + required: ['task'] + } + } + }, { + type: 'function', + function: { + name: 'spawn_agent', + description: '(DESTRUCTIVE) Spawn a new worker agent with a role and capabilities', + parameters: { + type: 'object', + properties: { + role: { type: 'string', description: 'Agent role (e.g. researcher, writer)' }, + capabilities: { type: 'string', description: 'Comma-separated capabilities (optional)' } + }, + required: ['role'] + } + } }]; } getHelpInfo() { @@ -568,7 +602,14 @@ RULES: (entry.error ? ' ⚠️' : '') + ''; } - panel.innerHTML = '
🔧 Tool Log ' + this._toolCallLog.length + ' calls✕
' + html; + panel.innerHTML = '
' + + '🔧 Tool Log ' + this._toolCallLog.length + ' calls' + + '' + + '' + + '' + + '' + + '✕' + + '
' + html; } _isToolError(result) { if (!result || typeof result !== 'string') return null; @@ -1194,6 +1235,37 @@ RULES: for (const [, meta] of entries) totalTasks += meta.tasks || 0; return JSON.stringify({ totalSessions: entries.length, totalTasks, dates: entries.map(([d]) => d) }); } + case 'list_agents': { + const registry = this.terminal.moduleManager.modules['AgentRegistryModule']; + if (!registry) return JSON.stringify({ error: 'Agent registry not available' }); + const agents = this.terminal.fs.ls('/agents/'); + const results = []; + if (agents) { + agents.forEach(a => { + if (a.type === 'dir' && a.name !== 'configured') { + const data = this.terminal.fs.readFile(`/agents/${a.name}/status.json`); + if (data) results.push(JSON.parse(data)); + } + }); + } + return JSON.stringify({ agents: results, count: results.length }); + } + case 'delegate_task': { + const task = a.task || ''; + if (!task) return JSON.stringify({ error: 'No task provided' }); + const orch = this.terminal.moduleManager.modules['OrchestratorModule']; + if (!orch) return JSON.stringify({ error: 'Orchestrator not available' }); + orch.delegateTask(task); + return JSON.stringify({ message: `Task delegated: ${task.substring(0, 80)}` }); + } + case 'spawn_agent': { + const role = a.role || 'worker'; + const caps = a.capabilities ? a.capabilities.split(',').map(s => s.trim()) : ['list_files', 'read_file']; + const orch = this.terminal.moduleManager.modules['OrchestratorModule']; + if (!orch) return JSON.stringify({ error: 'Orchestrator not available' }); + const agent = orch.spawnAgent(role, caps); + return JSON.stringify({ message: `Agent spawned: ${agent.id}`, agent }); + } case 'load_skills': { const query = (a && a.query || '').toLowerCase(); const fs = this.terminal.fs; -- cgit v1.2.3