aurix-ai 2.4.0 → 2.5.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/dist/agent/MemoryEngine.d.ts +6 -0
- package/dist/agent/MemoryEngine.d.ts.map +1 -1
- package/dist/agent/MemoryEngine.js +25 -0
- package/dist/agent/MemoryEngine.js.map +1 -1
- package/dist/cli/App.d.ts.map +1 -1
- package/dist/cli/App.js +44 -19
- package/dist/cli/App.js.map +1 -1
- package/dist/cli/CommandPalette.d.ts +10 -0
- package/dist/cli/CommandPalette.d.ts.map +1 -0
- package/dist/cli/CommandPalette.js +95 -0
- package/dist/cli/CommandPalette.js.map +1 -0
- package/dist/cli/InputBox.d.ts.map +1 -1
- package/dist/cli/InputBox.js +49 -2
- package/dist/cli/InputBox.js.map +1 -1
- package/dist/cli/SessionBrowser.d.ts +15 -0
- package/dist/cli/SessionBrowser.d.ts.map +1 -0
- package/dist/cli/SessionBrowser.js +56 -0
- package/dist/cli/SessionBrowser.js.map +1 -0
- package/dist/cli/fileList.d.ts +4 -0
- package/dist/cli/fileList.d.ts.map +1 -0
- package/dist/cli/fileList.js +79 -0
- package/dist/cli/fileList.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/Browser.d.ts.map +1 -1
- package/dist/tools/Browser.js +21 -0
- package/dist/tools/Browser.js.map +1 -1
- package/dist/tools/SpawnAgent.d.ts +4 -0
- package/dist/tools/SpawnAgent.d.ts.map +1 -0
- package/dist/tools/SpawnAgent.js +97 -0
- package/dist/tools/SpawnAgent.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Orchestrator: lets the main agent fan out work to parallel sub-agents.
|
|
2
|
+
// Each sub-agent is a fresh AgentLoop with the same tools MINUS spawn_agent
|
|
3
|
+
// (prevents infinite recursion), run with a concurrency cap to respect rate
|
|
4
|
+
// limits. No langchain — pure native AgentLoop + provider.
|
|
5
|
+
const MAX_CONCURRENCY = 3;
|
|
6
|
+
const MAX_AGENTS = 12;
|
|
7
|
+
const SUBAGENT_MAX_ITERATIONS = 40;
|
|
8
|
+
// Build a registry for sub-agents: clone parent tools, drop spawn_agent.
|
|
9
|
+
function buildSubRegistry(parent, RegistryClass) {
|
|
10
|
+
const sub = new RegistryClass();
|
|
11
|
+
for (const t of parent.list()) {
|
|
12
|
+
if (t.name === 'spawn_agent')
|
|
13
|
+
continue;
|
|
14
|
+
sub.register(t);
|
|
15
|
+
}
|
|
16
|
+
return sub;
|
|
17
|
+
}
|
|
18
|
+
// Run async jobs with a bounded concurrency. Preserves input order in results.
|
|
19
|
+
async function runBounded(items, limit, fn) {
|
|
20
|
+
const results = new Array(items.length);
|
|
21
|
+
let next = 0;
|
|
22
|
+
const workers = new Array(Math.min(limit, items.length)).fill(0).map(async () => {
|
|
23
|
+
while (true) {
|
|
24
|
+
const i = next++;
|
|
25
|
+
if (i >= items.length)
|
|
26
|
+
return;
|
|
27
|
+
results[i] = await fn(items[i], i);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
await Promise.all(workers);
|
|
31
|
+
return results;
|
|
32
|
+
}
|
|
33
|
+
// Drain a sub-agent's run() generator and collect its final text output.
|
|
34
|
+
async function collectAgentResult(agent, prompt) {
|
|
35
|
+
let lastText = '';
|
|
36
|
+
const chunks = [];
|
|
37
|
+
try {
|
|
38
|
+
for await (const evt of agent.run(prompt)) {
|
|
39
|
+
if (evt.type === 'text' && evt.data) {
|
|
40
|
+
lastText = evt.data;
|
|
41
|
+
chunks.push(evt.data);
|
|
42
|
+
}
|
|
43
|
+
else if (evt.type === 'error') {
|
|
44
|
+
return `[sub-agent error] ${evt.data}`;
|
|
45
|
+
}
|
|
46
|
+
else if (evt.type === 'done') {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
return `[sub-agent crashed] ${e?.message || String(e)}`;
|
|
53
|
+
}
|
|
54
|
+
// prefer the final assistant message; fall back to the joined stream
|
|
55
|
+
return lastText || chunks.join('\n') || '(sub-agent produced no output)';
|
|
56
|
+
}
|
|
57
|
+
export function createSpawnAgentTool(config, registry) {
|
|
58
|
+
return {
|
|
59
|
+
name: 'spawn_agent',
|
|
60
|
+
description: `Run one or more autonomous sub-agents in parallel to handle independent subtasks, then collect their results. Use this to decompose a large task (research many files, check many candidates, run independent investigations) and cover them concurrently. Each sub-agent has the same tools as you EXCEPT it cannot spawn further agents. Up to ${MAX_AGENTS} sub-agents; at most ${MAX_CONCURRENCY} run at once. Each "task" string is a complete, self-contained instruction for one sub-agent — be specific about what to do and what to report back.`,
|
|
61
|
+
parameters: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
properties: {
|
|
64
|
+
tasks: {
|
|
65
|
+
type: 'array',
|
|
66
|
+
items: { type: 'string' },
|
|
67
|
+
description: 'List of self-contained task prompts, one per sub-agent. Each runs independently and in parallel.',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
required: ['tasks'],
|
|
71
|
+
},
|
|
72
|
+
async execute(args) {
|
|
73
|
+
const rawTasks = args.tasks;
|
|
74
|
+
if (!Array.isArray(rawTasks) || rawTasks.length === 0) {
|
|
75
|
+
return 'Error: spawn_agent requires a non-empty "tasks" array of prompt strings.';
|
|
76
|
+
}
|
|
77
|
+
const tasks = rawTasks.map(t => String(t)).filter(t => t.trim().length > 0).slice(0, MAX_AGENTS);
|
|
78
|
+
if (tasks.length === 0)
|
|
79
|
+
return 'Error: all tasks were empty.';
|
|
80
|
+
// Lazy imports to avoid a circular dependency (AgentLoop imports tools).
|
|
81
|
+
const { AgentLoop } = await import('../agent/AgentLoop.js');
|
|
82
|
+
const { ToolRegistry } = await import('./Registry.js');
|
|
83
|
+
const subRegistry = buildSubRegistry(registry, ToolRegistry);
|
|
84
|
+
const results = await runBounded(tasks, MAX_CONCURRENCY, async (prompt) => {
|
|
85
|
+
const sub = new AgentLoop(config, subRegistry);
|
|
86
|
+
if (typeof sub.setMaxIterations === 'function')
|
|
87
|
+
sub.setMaxIterations(SUBAGENT_MAX_ITERATIONS);
|
|
88
|
+
return collectAgentResult(sub, prompt);
|
|
89
|
+
});
|
|
90
|
+
const out = results
|
|
91
|
+
.map((r, i) => `## Sub-agent ${i + 1}\nTask: ${tasks[i].slice(0, 120)}\n\n${r}`)
|
|
92
|
+
.join('\n\n---\n\n');
|
|
93
|
+
return `Spawned ${tasks.length} sub-agent(s) (max ${MAX_CONCURRENCY} concurrent). Results:\n\n${out}`;
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=SpawnAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpawnAgent.js","sourceRoot":"","sources":["../../src/tools/SpawnAgent.ts"],"names":[],"mappings":"AAGA,yEAAyE;AACzE,4EAA4E;AAC5E,4EAA4E;AAC5E,2DAA2D;AAE3D,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,yEAAyE;AACzE,SAAS,gBAAgB,CAAC,MAAoB,EAAE,aAAkB;IAChE,MAAM,GAAG,GAAG,IAAI,aAAa,EAAkB,CAAC;IAChD,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QAC9B,IAAI,CAAC,CAAC,IAAI,KAAK,aAAa;YAAE,SAAS;QACvC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,+EAA+E;AAC/E,KAAK,UAAU,UAAU,CAAO,KAAU,EAAE,KAAa,EAAE,EAA0C;IACnG,MAAM,OAAO,GAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,I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