@nodetool-ai/agents 0.7.0-rc.11
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-executor.d.ts +62 -0
- package/dist/agent-executor.d.ts.map +1 -0
- package/dist/agent-executor.js +324 -0
- package/dist/agent-executor.js.map +1 -0
- package/dist/agent-step-executor.d.ts +28 -0
- package/dist/agent-step-executor.d.ts.map +1 -0
- package/dist/agent-step-executor.js +99 -0
- package/dist/agent-step-executor.js.map +1 -0
- package/dist/agent-workflow-runner.d.ts +31 -0
- package/dist/agent-workflow-runner.d.ts.map +1 -0
- package/dist/agent-workflow-runner.js +124 -0
- package/dist/agent-workflow-runner.js.map +1 -0
- package/dist/agent.d.ts +115 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +587 -0
- package/dist/agent.js.map +1 -0
- package/dist/base-agent.d.ts +42 -0
- package/dist/base-agent.d.ts.map +1 -0
- package/dist/base-agent.js +29 -0
- package/dist/base-agent.js.map +1 -0
- package/dist/constants.d.ts +8 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/graph-builder.d.ts +49 -0
- package/dist/graph-builder.d.ts.map +1 -0
- package/dist/graph-builder.js +206 -0
- package/dist/graph-builder.js.map +1 -0
- package/dist/graph-planner.d.ts +56 -0
- package/dist/graph-planner.d.ts.map +1 -0
- package/dist/graph-planner.js +311 -0
- package/dist/graph-planner.js.map +1 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -0
- package/dist/js-sandbox.d.ts +84 -0
- package/dist/js-sandbox.d.ts.map +1 -0
- package/dist/js-sandbox.js +654 -0
- package/dist/js-sandbox.js.map +1 -0
- package/dist/multi-mode-agent.d.ts +86 -0
- package/dist/multi-mode-agent.d.ts.map +1 -0
- package/dist/multi-mode-agent.js +476 -0
- package/dist/multi-mode-agent.js.map +1 -0
- package/dist/output-format.d.ts +10 -0
- package/dist/output-format.d.ts.map +1 -0
- package/dist/output-format.js +17 -0
- package/dist/output-format.js.map +1 -0
- package/dist/parallel-task-executor.d.ts +87 -0
- package/dist/parallel-task-executor.d.ts.map +1 -0
- package/dist/parallel-task-executor.js +332 -0
- package/dist/parallel-task-executor.js.map +1 -0
- package/dist/prompts/graph-planner-prompt.d.ts +48 -0
- package/dist/prompts/graph-planner-prompt.d.ts.map +1 -0
- package/dist/prompts/graph-planner-prompt.js +180 -0
- package/dist/prompts/graph-planner-prompt.js.map +1 -0
- package/dist/reject-agentic-provider.d.ts +21 -0
- package/dist/reject-agentic-provider.d.ts.map +1 -0
- package/dist/reject-agentic-provider.js +32 -0
- package/dist/reject-agentic-provider.js.map +1 -0
- package/dist/simple-agent.d.ts +29 -0
- package/dist/simple-agent.d.ts.map +1 -0
- package/dist/simple-agent.js +54 -0
- package/dist/simple-agent.js.map +1 -0
- package/dist/step-executor.d.ts +162 -0
- package/dist/step-executor.d.ts.map +1 -0
- package/dist/step-executor.js +1114 -0
- package/dist/step-executor.js.map +1 -0
- package/dist/sub-agent-planner.d.ts +33 -0
- package/dist/sub-agent-planner.d.ts.map +1 -0
- package/dist/sub-agent-planner.js +203 -0
- package/dist/sub-agent-planner.js.map +1 -0
- package/dist/task-executor.d.ts +89 -0
- package/dist/task-executor.d.ts.map +1 -0
- package/dist/task-executor.js +359 -0
- package/dist/task-executor.js.map +1 -0
- package/dist/task-planner.d.ts +44 -0
- package/dist/task-planner.d.ts.map +1 -0
- package/dist/task-planner.js +532 -0
- package/dist/task-planner.js.map +1 -0
- package/dist/team/db-task-board.d.ts +54 -0
- package/dist/team/db-task-board.d.ts.map +1 -0
- package/dist/team/db-task-board.js +361 -0
- package/dist/team/db-task-board.js.map +1 -0
- package/dist/team/edge-message-bus.d.ts +51 -0
- package/dist/team/edge-message-bus.d.ts.map +1 -0
- package/dist/team/edge-message-bus.js +169 -0
- package/dist/team/edge-message-bus.js.map +1 -0
- package/dist/team/edge-task-board.d.ts +77 -0
- package/dist/team/edge-task-board.d.ts.map +1 -0
- package/dist/team/edge-task-board.js +140 -0
- package/dist/team/edge-task-board.js.map +1 -0
- package/dist/team/index.d.ts +16 -0
- package/dist/team/index.d.ts.map +1 -0
- package/dist/team/index.js +17 -0
- package/dist/team/index.js.map +1 -0
- package/dist/team/message-bus.d.ts +58 -0
- package/dist/team/message-bus.d.ts.map +1 -0
- package/dist/team/message-bus.js +151 -0
- package/dist/team/message-bus.js.map +1 -0
- package/dist/team/task-board.d.ts +106 -0
- package/dist/team/task-board.d.ts.map +1 -0
- package/dist/team/task-board.js +370 -0
- package/dist/team/task-board.js.map +1 -0
- package/dist/team/team-executor.d.ts +72 -0
- package/dist/team/team-executor.d.ts.map +1 -0
- package/dist/team/team-executor.js +466 -0
- package/dist/team/team-executor.js.map +1 -0
- package/dist/team/team-tools.d.ts +252 -0
- package/dist/team/team-tools.d.ts.map +1 -0
- package/dist/team/team-tools.js +412 -0
- package/dist/team/team-tools.js.map +1 -0
- package/dist/team/types.d.ts +198 -0
- package/dist/team/types.d.ts.map +1 -0
- package/dist/team/types.js +8 -0
- package/dist/team/types.js.map +1 -0
- package/dist/tools/add-edge-tool.d.ts +18 -0
- package/dist/tools/add-edge-tool.d.ts.map +1 -0
- package/dist/tools/add-edge-tool.js +92 -0
- package/dist/tools/add-edge-tool.js.map +1 -0
- package/dist/tools/add-node-tool.d.ts +22 -0
- package/dist/tools/add-node-tool.d.ts.map +1 -0
- package/dist/tools/add-node-tool.js +128 -0
- package/dist/tools/add-node-tool.js.map +1 -0
- package/dist/tools/asset-tools.d.ts +58 -0
- package/dist/tools/asset-tools.d.ts.map +1 -0
- package/dist/tools/asset-tools.js +191 -0
- package/dist/tools/asset-tools.js.map +1 -0
- package/dist/tools/base-tool.d.ts +25 -0
- package/dist/tools/base-tool.d.ts.map +1 -0
- package/dist/tools/base-tool.js +24 -0
- package/dist/tools/base-tool.js.map +1 -0
- package/dist/tools/browser-tools.d.ts +32 -0
- package/dist/tools/browser-tools.d.ts.map +1 -0
- package/dist/tools/browser-tools.js +208 -0
- package/dist/tools/browser-tools.js.map +1 -0
- package/dist/tools/calculator-tool.d.ts +24 -0
- package/dist/tools/calculator-tool.d.ts.map +1 -0
- package/dist/tools/calculator-tool.js +64 -0
- package/dist/tools/calculator-tool.js.map +1 -0
- package/dist/tools/claude-code-tools.d.ts +96 -0
- package/dist/tools/claude-code-tools.d.ts.map +1 -0
- package/dist/tools/claude-code-tools.js +463 -0
- package/dist/tools/claude-code-tools.js.map +1 -0
- package/dist/tools/code-tools.d.ts +26 -0
- package/dist/tools/code-tools.d.ts.map +1 -0
- package/dist/tools/code-tools.js +82 -0
- package/dist/tools/code-tools.js.map +1 -0
- package/dist/tools/control-tool.d.ts +47 -0
- package/dist/tools/control-tool.d.ts.map +1 -0
- package/dist/tools/control-tool.js +101 -0
- package/dist/tools/control-tool.js.map +1 -0
- package/dist/tools/create-plan-tool.d.ts +29 -0
- package/dist/tools/create-plan-tool.d.ts.map +1 -0
- package/dist/tools/create-plan-tool.js +355 -0
- package/dist/tools/create-plan-tool.js.map +1 -0
- package/dist/tools/create-task-tool.d.ts +28 -0
- package/dist/tools/create-task-tool.d.ts.map +1 -0
- package/dist/tools/create-task-tool.js +254 -0
- package/dist/tools/create-task-tool.js.map +1 -0
- package/dist/tools/dataseo-tools.d.ts +38 -0
- package/dist/tools/dataseo-tools.d.ts.map +1 -0
- package/dist/tools/dataseo-tools.js +329 -0
- package/dist/tools/dataseo-tools.js.map +1 -0
- package/dist/tools/email-tools.d.ts +76 -0
- package/dist/tools/email-tools.d.ts.map +1 -0
- package/dist/tools/email-tools.js +259 -0
- package/dist/tools/email-tools.js.map +1 -0
- package/dist/tools/filesystem-tools.d.ts +77 -0
- package/dist/tools/filesystem-tools.d.ts.map +1 -0
- package/dist/tools/filesystem-tools.js +334 -0
- package/dist/tools/filesystem-tools.js.map +1 -0
- package/dist/tools/find-model-tool.d.ts +25 -0
- package/dist/tools/find-model-tool.d.ts.map +1 -0
- package/dist/tools/find-model-tool.js +236 -0
- package/dist/tools/find-model-tool.js.map +1 -0
- package/dist/tools/finish-graph-tool.d.ts +23 -0
- package/dist/tools/finish-graph-tool.d.ts.map +1 -0
- package/dist/tools/finish-graph-tool.js +46 -0
- package/dist/tools/finish-graph-tool.js.map +1 -0
- package/dist/tools/finish-step-tool.d.ts +16 -0
- package/dist/tools/finish-step-tool.d.ts.map +1 -0
- package/dist/tools/finish-step-tool.js +68 -0
- package/dist/tools/finish-step-tool.js.map +1 -0
- package/dist/tools/google-tools.d.ts +44 -0
- package/dist/tools/google-tools.d.ts.map +1 -0
- package/dist/tools/google-tools.js +176 -0
- package/dist/tools/google-tools.js.map +1 -0
- package/dist/tools/http-tools.d.ts +56 -0
- package/dist/tools/http-tools.d.ts.map +1 -0
- package/dist/tools/http-tools.js +180 -0
- package/dist/tools/http-tools.js.map +1 -0
- package/dist/tools/js-code-tool.d.ts +30 -0
- package/dist/tools/js-code-tool.d.ts.map +1 -0
- package/dist/tools/js-code-tool.js +98 -0
- package/dist/tools/js-code-tool.js.map +1 -0
- package/dist/tools/local-get-node-info-tool.d.ts +19 -0
- package/dist/tools/local-get-node-info-tool.d.ts.map +1 -0
- package/dist/tools/local-get-node-info-tool.js +75 -0
- package/dist/tools/local-get-node-info-tool.js.map +1 -0
- package/dist/tools/local-list-nodes-tool.d.ts +19 -0
- package/dist/tools/local-list-nodes-tool.d.ts.map +1 -0
- package/dist/tools/local-list-nodes-tool.js +69 -0
- package/dist/tools/local-list-nodes-tool.js.map +1 -0
- package/dist/tools/local-search-nodes-tool.d.ts +21 -0
- package/dist/tools/local-search-nodes-tool.d.ts.map +1 -0
- package/dist/tools/local-search-nodes-tool.js +111 -0
- package/dist/tools/local-search-nodes-tool.js.map +1 -0
- package/dist/tools/math-tools.d.ts +156 -0
- package/dist/tools/math-tools.d.ts.map +1 -0
- package/dist/tools/math-tools.js +422 -0
- package/dist/tools/math-tools.js.map +1 -0
- package/dist/tools/mcp-tools.d.ts +413 -0
- package/dist/tools/mcp-tools.d.ts.map +1 -0
- package/dist/tools/mcp-tools.js +618 -0
- package/dist/tools/mcp-tools.js.map +1 -0
- package/dist/tools/media-tools.d.ts +277 -0
- package/dist/tools/media-tools.d.ts.map +1 -0
- package/dist/tools/media-tools.js +682 -0
- package/dist/tools/media-tools.js.map +1 -0
- package/dist/tools/model-tools.d.ts +25 -0
- package/dist/tools/model-tools.d.ts.map +1 -0
- package/dist/tools/model-tools.js +48 -0
- package/dist/tools/model-tools.js.map +1 -0
- package/dist/tools/openai-tools.d.ts +73 -0
- package/dist/tools/openai-tools.d.ts.map +1 -0
- package/dist/tools/openai-tools.js +193 -0
- package/dist/tools/openai-tools.js.map +1 -0
- package/dist/tools/pdf-tools.d.ts +152 -0
- package/dist/tools/pdf-tools.d.ts.map +1 -0
- package/dist/tools/pdf-tools.js +339 -0
- package/dist/tools/pdf-tools.js.map +1 -0
- package/dist/tools/plan-builder-tools.d.ts +72 -0
- package/dist/tools/plan-builder-tools.d.ts.map +1 -0
- package/dist/tools/plan-builder-tools.js +438 -0
- package/dist/tools/plan-builder-tools.js.map +1 -0
- package/dist/tools/search-tools.d.ts +39 -0
- package/dist/tools/search-tools.d.ts.map +1 -0
- package/dist/tools/search-tools.js +218 -0
- package/dist/tools/search-tools.js.map +1 -0
- package/dist/tools/serp-providers/dataforseo-provider.d.ts +14 -0
- package/dist/tools/serp-providers/dataforseo-provider.d.ts.map +1 -0
- package/dist/tools/serp-providers/dataforseo-provider.js +114 -0
- package/dist/tools/serp-providers/dataforseo-provider.js.map +1 -0
- package/dist/tools/serp-providers/index.d.ts +35 -0
- package/dist/tools/serp-providers/index.d.ts.map +1 -0
- package/dist/tools/serp-providers/index.js +14 -0
- package/dist/tools/serp-providers/index.js.map +1 -0
- package/dist/tools/serp-providers/serpapi-provider.d.ts +18 -0
- package/dist/tools/serp-providers/serpapi-provider.d.ts.map +1 -0
- package/dist/tools/serp-providers/serpapi-provider.js +66 -0
- package/dist/tools/serp-providers/serpapi-provider.js.map +1 -0
- package/dist/tools/tool-registry.d.ts +9 -0
- package/dist/tools/tool-registry.d.ts.map +1 -0
- package/dist/tools/tool-registry.js +17 -0
- package/dist/tools/tool-registry.js.map +1 -0
- package/dist/tools/vector-tools.d.ts +224 -0
- package/dist/tools/vector-tools.d.ts.map +1 -0
- package/dist/tools/vector-tools.js +582 -0
- package/dist/tools/vector-tools.js.map +1 -0
- package/dist/tools/workspace-tools.d.ts +58 -0
- package/dist/tools/workspace-tools.d.ts.map +1 -0
- package/dist/tools/workspace-tools.js +152 -0
- package/dist/tools/workspace-tools.js.map +1 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/json-parser.d.ts +15 -0
- package/dist/utils/json-parser.d.ts.map +1 -0
- package/dist/utils/json-parser.js +78 -0
- package/dist/utils/json-parser.js.map +1 -0
- package/dist/utils/remove-base64-images.d.ts +12 -0
- package/dist/utils/remove-base64-images.d.ts.map +1 -0
- package/dist/utils/remove-base64-images.js +20 -0
- package/dist/utils/remove-base64-images.js.map +1 -0
- package/dist/utils/wrap-generators-parallel.d.ts +11 -0
- package/dist/utils/wrap-generators-parallel.d.ts.map +1 -0
- package/dist/utils/wrap-generators-parallel.js +38 -0
- package/dist/utils/wrap-generators-parallel.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TeamExecutor — Orchestrates a team of agents collaborating via
|
|
3
|
+
* a shared TaskBoard and MessageBus.
|
|
4
|
+
*
|
|
5
|
+
* Strategies:
|
|
6
|
+
* - coordinator: First agent decomposes the objective, others execute tasks.
|
|
7
|
+
* - autonomous: All agents see the objective and self-organize.
|
|
8
|
+
* - hybrid: Coordinator creates initial plan, agents can create subtasks.
|
|
9
|
+
*/
|
|
10
|
+
import { createLogger } from "@nodetool-ai/config";
|
|
11
|
+
import { getProvider } from "@nodetool-ai/runtime";
|
|
12
|
+
import { MessageBus } from "./message-bus.js";
|
|
13
|
+
import { TaskBoard } from "./task-board.js";
|
|
14
|
+
import { createTeamTools } from "./team-tools.js";
|
|
15
|
+
const log = createLogger("nodetool.agents.team-executor");
|
|
16
|
+
const DEFAULT_MAX_ITERATIONS = 50;
|
|
17
|
+
const DEFAULT_MAX_CONCURRENCY = 5;
|
|
18
|
+
const IDLE_CHECK_INTERVAL_MS = 500;
|
|
19
|
+
export class TeamExecutor {
|
|
20
|
+
config;
|
|
21
|
+
context;
|
|
22
|
+
board;
|
|
23
|
+
bus;
|
|
24
|
+
sharedTools;
|
|
25
|
+
agents = new Map();
|
|
26
|
+
events = [];
|
|
27
|
+
maxIterations;
|
|
28
|
+
maxConcurrency;
|
|
29
|
+
totalIterations = 0;
|
|
30
|
+
_result = null;
|
|
31
|
+
constructor(opts) {
|
|
32
|
+
this.config = opts.config;
|
|
33
|
+
this.context = opts.context;
|
|
34
|
+
this.board = opts.taskBoard ?? new TaskBoard();
|
|
35
|
+
this.bus = opts.messageBus ?? new MessageBus();
|
|
36
|
+
this.sharedTools = opts.sharedTools ?? [];
|
|
37
|
+
this.maxIterations = opts.config.maxIterations ?? DEFAULT_MAX_ITERATIONS;
|
|
38
|
+
this.maxConcurrency = opts.config.maxConcurrency ?? DEFAULT_MAX_CONCURRENCY;
|
|
39
|
+
}
|
|
40
|
+
get taskBoard() {
|
|
41
|
+
return this.board;
|
|
42
|
+
}
|
|
43
|
+
get messageBus() {
|
|
44
|
+
return this.bus;
|
|
45
|
+
}
|
|
46
|
+
getResult() {
|
|
47
|
+
return this._result;
|
|
48
|
+
}
|
|
49
|
+
getEvents() {
|
|
50
|
+
return [...this.events];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Main execution loop. Yields TeamEvents as the team works.
|
|
54
|
+
*/
|
|
55
|
+
async *execute() {
|
|
56
|
+
// Initialize agents
|
|
57
|
+
for (const identity of this.config.agents) {
|
|
58
|
+
const provider = await getProvider(identity.provider);
|
|
59
|
+
this.bus.register(identity.id);
|
|
60
|
+
const state = {
|
|
61
|
+
identity,
|
|
62
|
+
provider,
|
|
63
|
+
history: [],
|
|
64
|
+
iterations: 0,
|
|
65
|
+
idle: false,
|
|
66
|
+
finished: false
|
|
67
|
+
};
|
|
68
|
+
// Build system prompt with team context
|
|
69
|
+
state.history.push({
|
|
70
|
+
role: "system",
|
|
71
|
+
content: this.buildSystemPrompt(identity)
|
|
72
|
+
});
|
|
73
|
+
this.agents.set(identity.id, state);
|
|
74
|
+
const event = {
|
|
75
|
+
type: "agent_started",
|
|
76
|
+
agentId: identity.id,
|
|
77
|
+
timestamp: Date.now()
|
|
78
|
+
};
|
|
79
|
+
this.events.push(event);
|
|
80
|
+
yield event;
|
|
81
|
+
}
|
|
82
|
+
// Strategy-specific initialization
|
|
83
|
+
if (this.config.strategy === "coordinator" ||
|
|
84
|
+
this.config.strategy === "hybrid") {
|
|
85
|
+
yield* this.runCoordinatorPhase();
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
// Autonomous: create a single root task for the objective
|
|
89
|
+
const rootTask = this.board.create({
|
|
90
|
+
title: "Complete objective",
|
|
91
|
+
description: this.config.objective,
|
|
92
|
+
createdBy: "system",
|
|
93
|
+
priority: 0
|
|
94
|
+
});
|
|
95
|
+
const event = {
|
|
96
|
+
type: "task_created",
|
|
97
|
+
task: rootTask,
|
|
98
|
+
timestamp: Date.now()
|
|
99
|
+
};
|
|
100
|
+
this.events.push(event);
|
|
101
|
+
yield event;
|
|
102
|
+
}
|
|
103
|
+
// Main work loop — run agents concurrently
|
|
104
|
+
yield* this.runWorkLoop();
|
|
105
|
+
// Collect final result
|
|
106
|
+
const completedTasks = this.board
|
|
107
|
+
.getSnapshot()
|
|
108
|
+
.filter((t) => t.status === "done");
|
|
109
|
+
if (completedTasks.length === 1) {
|
|
110
|
+
this._result = completedTasks[0].result;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this._result = completedTasks.map((t) => ({
|
|
114
|
+
title: t.title,
|
|
115
|
+
result: t.result
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
const completeEvent = {
|
|
119
|
+
type: "team_complete",
|
|
120
|
+
result: this._result,
|
|
121
|
+
timestamp: Date.now()
|
|
122
|
+
};
|
|
123
|
+
this.events.push(completeEvent);
|
|
124
|
+
yield completeEvent;
|
|
125
|
+
}
|
|
126
|
+
// ─── Strategy Phases ───
|
|
127
|
+
/**
|
|
128
|
+
* Coordinator phase: first agent decomposes the objective into tasks.
|
|
129
|
+
*/
|
|
130
|
+
async *runCoordinatorPhase() {
|
|
131
|
+
const coordinator = this.agents.get(this.config.agents[0].id);
|
|
132
|
+
if (!coordinator)
|
|
133
|
+
return;
|
|
134
|
+
const decompositionPrompt = [
|
|
135
|
+
`**Team Objective:** ${this.config.objective}`,
|
|
136
|
+
"",
|
|
137
|
+
"You are the coordinator. Break this objective into concrete tasks for the team.",
|
|
138
|
+
"Use `create_task` for each task. Set `required_skills` to match team members' abilities.",
|
|
139
|
+
"Set priorities (0=highest) and dependencies between tasks where needed.",
|
|
140
|
+
"After creating all tasks, send a brief plan summary via `broadcast`."
|
|
141
|
+
].join("\n");
|
|
142
|
+
coordinator.history.push({ role: "user", content: decompositionPrompt });
|
|
143
|
+
yield* this.runAgentIteration(coordinator);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Main work loop: agents check for tasks, claim them, execute, complete.
|
|
147
|
+
*/
|
|
148
|
+
async *runWorkLoop() {
|
|
149
|
+
let consecutiveIdle = 0;
|
|
150
|
+
const MAX_IDLE = 3;
|
|
151
|
+
while (this.totalIterations < this.maxIterations) {
|
|
152
|
+
// Check if board is complete
|
|
153
|
+
this.board.resolveParents();
|
|
154
|
+
if (this.board.isComplete())
|
|
155
|
+
break;
|
|
156
|
+
// Deadlock detection
|
|
157
|
+
const deadlock = this.board.detectDeadlock();
|
|
158
|
+
if (deadlock) {
|
|
159
|
+
const event = {
|
|
160
|
+
type: "deadlock_detected",
|
|
161
|
+
blockingTasks: deadlock,
|
|
162
|
+
timestamp: Date.now()
|
|
163
|
+
};
|
|
164
|
+
this.events.push(event);
|
|
165
|
+
yield event;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
// Find agents that should work
|
|
169
|
+
const workableAgents = this.getWorkableAgents();
|
|
170
|
+
if (workableAgents.length === 0) {
|
|
171
|
+
consecutiveIdle++;
|
|
172
|
+
if (consecutiveIdle >= MAX_IDLE)
|
|
173
|
+
break;
|
|
174
|
+
// Wait for any in-progress tasks
|
|
175
|
+
await new Promise((r) => setTimeout(r, IDLE_CHECK_INTERVAL_MS));
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
consecutiveIdle = 0;
|
|
179
|
+
// Run agents (up to concurrency limit)
|
|
180
|
+
const batch = workableAgents.slice(0, this.maxConcurrency);
|
|
181
|
+
// Run sequentially for deterministic behavior (parallel option for later)
|
|
182
|
+
for (const agent of batch) {
|
|
183
|
+
yield* this.runAgentWorkCycle(agent);
|
|
184
|
+
if (this.totalIterations >= this.maxIterations)
|
|
185
|
+
break;
|
|
186
|
+
this.board.resolveParents();
|
|
187
|
+
if (this.board.isComplete())
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Single agent work cycle: check messages, check board, work on task.
|
|
194
|
+
*/
|
|
195
|
+
async *runAgentWorkCycle(agent) {
|
|
196
|
+
// Build context-aware prompt
|
|
197
|
+
const promptParts = [];
|
|
198
|
+
// Inject pending messages (receive atomically drains the inbox)
|
|
199
|
+
const messages = this.bus.receive(agent.identity.id);
|
|
200
|
+
if (messages.length > 0) {
|
|
201
|
+
promptParts.push("**New messages from teammates:**");
|
|
202
|
+
for (const m of messages) {
|
|
203
|
+
promptParts.push(`- [${m.from}] (${m.type}) ${m.subject}: ${m.body}`);
|
|
204
|
+
}
|
|
205
|
+
promptParts.push("");
|
|
206
|
+
}
|
|
207
|
+
// Inject board state
|
|
208
|
+
const available = this.board.getAvailable(agent.identity);
|
|
209
|
+
const boardSnapshot = this.board.getSnapshot();
|
|
210
|
+
const myTasks = boardSnapshot.filter((t) => t.claimedBy === agent.identity.id &&
|
|
211
|
+
(t.status === "claimed" || t.status === "working"));
|
|
212
|
+
if (myTasks.length > 0) {
|
|
213
|
+
promptParts.push("**Your current tasks:**");
|
|
214
|
+
for (const t of myTasks) {
|
|
215
|
+
promptParts.push(`- [${t.id}] ${t.title}: ${t.description}`);
|
|
216
|
+
}
|
|
217
|
+
promptParts.push("");
|
|
218
|
+
promptParts.push("Continue working on your current task(s). When done, call `complete_task` with the result.");
|
|
219
|
+
}
|
|
220
|
+
else if (available.length > 0) {
|
|
221
|
+
promptParts.push("**Tasks available to claim:**");
|
|
222
|
+
for (const t of available) {
|
|
223
|
+
promptParts.push(`- [${t.id}] (priority ${t.priority}) ${t.title}: ${t.description}`);
|
|
224
|
+
}
|
|
225
|
+
promptParts.push("");
|
|
226
|
+
promptParts.push("Claim a task that matches your skills using `claim_task`, then complete it.");
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
// Nothing to do
|
|
230
|
+
agent.idle = true;
|
|
231
|
+
const event = {
|
|
232
|
+
type: "agent_idle",
|
|
233
|
+
agentId: agent.identity.id,
|
|
234
|
+
timestamp: Date.now()
|
|
235
|
+
};
|
|
236
|
+
this.events.push(event);
|
|
237
|
+
yield event;
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
agent.history.push({ role: "user", content: promptParts.join("\n") });
|
|
241
|
+
yield* this.runAgentIteration(agent);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Run a single LLM iteration for an agent (may involve tool calls).
|
|
245
|
+
*/
|
|
246
|
+
async *runAgentIteration(agent) {
|
|
247
|
+
agent.idle = false;
|
|
248
|
+
this.totalIterations++;
|
|
249
|
+
agent.iterations++;
|
|
250
|
+
// Build tool list: team tools + shared tools + agent-specific tools
|
|
251
|
+
const teamTools = createTeamTools(agent.identity, this.config.agents, this.bus, this.board);
|
|
252
|
+
const allTools = [...teamTools, ...this.sharedTools];
|
|
253
|
+
const providerTools = allTools.map((t) => t.toProviderTool());
|
|
254
|
+
// Check if agentic provider (handles tool loop internally)
|
|
255
|
+
const isAgentic = agent.provider.provider ===
|
|
256
|
+
"claude_agent";
|
|
257
|
+
if (isAgentic) {
|
|
258
|
+
yield* this.runAgenticIteration(agent, allTools, providerTools);
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
yield* this.runStandardIteration(agent, allTools, providerTools);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Agentic provider: single call with onToolCall handles the full loop.
|
|
266
|
+
*/
|
|
267
|
+
async *runAgenticIteration(agent, allTools, providerTools) {
|
|
268
|
+
const onToolCall = async (name, args) => {
|
|
269
|
+
const tool = allTools.find((t) => t.name === name);
|
|
270
|
+
if (!tool)
|
|
271
|
+
return JSON.stringify({ error: `Unknown tool: ${name}` });
|
|
272
|
+
try {
|
|
273
|
+
const result = await tool.process(this.context, args);
|
|
274
|
+
return typeof result === "string"
|
|
275
|
+
? result
|
|
276
|
+
: JSON.stringify(result ?? null);
|
|
277
|
+
}
|
|
278
|
+
catch (e) {
|
|
279
|
+
return JSON.stringify({ error: String(e) });
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const response = await agent.provider.generateMessageTraced({
|
|
283
|
+
messages: agent.history,
|
|
284
|
+
model: agent.identity.model,
|
|
285
|
+
tools: providerTools,
|
|
286
|
+
onToolCall
|
|
287
|
+
});
|
|
288
|
+
if (response.content) {
|
|
289
|
+
const event = {
|
|
290
|
+
type: "chunk",
|
|
291
|
+
agentId: agent.identity.id,
|
|
292
|
+
content: String(response.content),
|
|
293
|
+
timestamp: Date.now()
|
|
294
|
+
};
|
|
295
|
+
this.events.push(event);
|
|
296
|
+
yield event;
|
|
297
|
+
}
|
|
298
|
+
agent.history.push({
|
|
299
|
+
role: "assistant",
|
|
300
|
+
content: response.content,
|
|
301
|
+
toolCalls: response.toolCalls ?? undefined
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Standard provider: request-response loop with explicit tool execution.
|
|
306
|
+
*/
|
|
307
|
+
async *runStandardIteration(agent, allTools, providerTools) {
|
|
308
|
+
const MAX_TOOL_ROUNDS = 5;
|
|
309
|
+
for (let round = 0; round < MAX_TOOL_ROUNDS; round++) {
|
|
310
|
+
const response = await agent.provider.generateMessageTraced({
|
|
311
|
+
messages: agent.history,
|
|
312
|
+
model: agent.identity.model,
|
|
313
|
+
tools: providerTools
|
|
314
|
+
});
|
|
315
|
+
if (response.content) {
|
|
316
|
+
const event = {
|
|
317
|
+
type: "chunk",
|
|
318
|
+
agentId: agent.identity.id,
|
|
319
|
+
content: String(response.content),
|
|
320
|
+
timestamp: Date.now()
|
|
321
|
+
};
|
|
322
|
+
this.events.push(event);
|
|
323
|
+
yield event;
|
|
324
|
+
}
|
|
325
|
+
agent.history.push({
|
|
326
|
+
role: "assistant",
|
|
327
|
+
content: response.content,
|
|
328
|
+
toolCalls: response.toolCalls ?? undefined
|
|
329
|
+
});
|
|
330
|
+
if (!response.toolCalls || response.toolCalls.length === 0)
|
|
331
|
+
break;
|
|
332
|
+
// Execute tool calls
|
|
333
|
+
for (const toolCall of response.toolCalls) {
|
|
334
|
+
const tool = allTools.find((t) => t.name === toolCall.name);
|
|
335
|
+
let result;
|
|
336
|
+
if (!tool) {
|
|
337
|
+
result = { error: `Unknown tool: ${toolCall.name}` };
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
try {
|
|
341
|
+
result = await tool.process(this.context, toolCall.args);
|
|
342
|
+
}
|
|
343
|
+
catch (e) {
|
|
344
|
+
result = { error: String(e) };
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
const serialized = typeof result === "string"
|
|
348
|
+
? result
|
|
349
|
+
: JSON.stringify(result ?? "Tool returned no output.");
|
|
350
|
+
agent.history.push({
|
|
351
|
+
role: "tool",
|
|
352
|
+
content: serialized,
|
|
353
|
+
toolCallId: toolCall.id
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
// ─── Helpers ───
|
|
359
|
+
getWorkableAgents() {
|
|
360
|
+
const result = [];
|
|
361
|
+
for (const agent of this.agents.values()) {
|
|
362
|
+
if (agent.finished)
|
|
363
|
+
continue;
|
|
364
|
+
// Has current tasks?
|
|
365
|
+
const boardSnapshot = this.board.getSnapshot();
|
|
366
|
+
const hasCurrent = boardSnapshot.some((t) => t.claimedBy === agent.identity.id &&
|
|
367
|
+
(t.status === "claimed" || t.status === "working"));
|
|
368
|
+
if (hasCurrent) {
|
|
369
|
+
result.push(agent);
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
// Has available tasks?
|
|
373
|
+
const available = this.board.getAvailable(agent.identity);
|
|
374
|
+
if (available.length > 0) {
|
|
375
|
+
result.push(agent);
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
// Has pending messages?
|
|
379
|
+
if (this.bus.pendingCount(agent.identity.id) > 0) {
|
|
380
|
+
result.push(agent);
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return result;
|
|
385
|
+
}
|
|
386
|
+
buildSystemPrompt(agent) {
|
|
387
|
+
const roster = this.config.agents
|
|
388
|
+
.map((a) => `- ${a.id} (${a.name}): ${a.role} | skills: ${a.skills.join(", ")}`)
|
|
389
|
+
.join("\n");
|
|
390
|
+
const strategyInstructions = this.getStrategyInstructions(agent, this.config.strategy);
|
|
391
|
+
return [
|
|
392
|
+
`# You are "${agent.name}" — ${agent.role}`,
|
|
393
|
+
"",
|
|
394
|
+
`## Your Identity`,
|
|
395
|
+
`- ID: ${agent.id}`,
|
|
396
|
+
`- Skills: ${agent.skills.join(", ")}`,
|
|
397
|
+
"",
|
|
398
|
+
`## Team Roster`,
|
|
399
|
+
roster,
|
|
400
|
+
"",
|
|
401
|
+
`## Team Objective`,
|
|
402
|
+
this.config.objective,
|
|
403
|
+
"",
|
|
404
|
+
`## How This Works`,
|
|
405
|
+
"You collaborate with your teammates via a shared task board and messages.",
|
|
406
|
+
"- Use `list_tasks` to see the board, `claim_task` to take work, `complete_task` when done.",
|
|
407
|
+
"- Use `send_message` to coordinate with specific teammates, or `broadcast` for the whole team.",
|
|
408
|
+
"- Use `create_task` to add new work items, `decompose_task` to break complex tasks apart.",
|
|
409
|
+
"",
|
|
410
|
+
strategyInstructions,
|
|
411
|
+
"",
|
|
412
|
+
"## Rules",
|
|
413
|
+
"- Only work on tasks you've claimed.",
|
|
414
|
+
"- Complete tasks promptly and mark them done.",
|
|
415
|
+
"- Communicate blockers early — send a message or fail the task.",
|
|
416
|
+
"- Be concise in messages. Focus on actionable information.",
|
|
417
|
+
"- Do not reveal chain-of-thought or internal deliberation in messages."
|
|
418
|
+
].join("\n");
|
|
419
|
+
}
|
|
420
|
+
getStrategyInstructions(agent, strategy) {
|
|
421
|
+
const isCoordinator = agent.id === this.config.agents[0]?.id;
|
|
422
|
+
switch (strategy) {
|
|
423
|
+
case "coordinator":
|
|
424
|
+
return isCoordinator
|
|
425
|
+
? [
|
|
426
|
+
"## Your Role: Coordinator",
|
|
427
|
+
"You lead this team. Your job is to:",
|
|
428
|
+
"1. Decompose the objective into concrete tasks on the board.",
|
|
429
|
+
"2. Set priorities and dependencies appropriately.",
|
|
430
|
+
"3. Monitor progress and create follow-up tasks as needed.",
|
|
431
|
+
"4. Do NOT do implementation work yourself — delegate to specialists.",
|
|
432
|
+
"5. Be concise in plans and messages; focus on actionable information."
|
|
433
|
+
].join("\n")
|
|
434
|
+
: [
|
|
435
|
+
"## Your Role: Specialist",
|
|
436
|
+
"The coordinator will create tasks on the board.",
|
|
437
|
+
"Claim tasks matching your skills and complete them.",
|
|
438
|
+
"Message the coordinator if you're blocked or need clarification.",
|
|
439
|
+
"Do not create tasks unless the coordinator asks you to."
|
|
440
|
+
].join("\n");
|
|
441
|
+
case "autonomous":
|
|
442
|
+
return [
|
|
443
|
+
"## Strategy: Autonomous",
|
|
444
|
+
"There is no assigned coordinator. Self-organize with your teammates.",
|
|
445
|
+
"Check the board for work, create tasks as needed, and communicate via messages.",
|
|
446
|
+
"Claim tasks that match your skills. If the board is empty, create tasks to advance the objective.",
|
|
447
|
+
"Be concise in messages; focus on actionable information."
|
|
448
|
+
].join("\n");
|
|
449
|
+
case "hybrid":
|
|
450
|
+
return isCoordinator
|
|
451
|
+
? [
|
|
452
|
+
"## Your Role: Lead (Hybrid)",
|
|
453
|
+
"Create the initial task plan, but team members can also create subtasks.",
|
|
454
|
+
"Focus on high-level coordination. Review completed work.",
|
|
455
|
+
"Be concise in plans and messages; focus on actionable information."
|
|
456
|
+
].join("\n")
|
|
457
|
+
: [
|
|
458
|
+
"## Your Role: Team Member (Hybrid)",
|
|
459
|
+
"The lead creates the initial plan, but you can create subtasks too.",
|
|
460
|
+
"Claim tasks, complete them, and create follow-up tasks as needed.",
|
|
461
|
+
"Be concise in messages; focus on actionable information."
|
|
462
|
+
].join("\n");
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
//# sourceMappingURL=team-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team-executor.js","sourceRoot":"","sources":["../../src/team/team-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAUlD,MAAM,GAAG,GAAG,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