@gjczone/pi-swarm 0.1.2

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.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +124 -0
  3. package/dist/index.d.ts +13 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +99 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/shared/controller.d.ts +86 -0
  8. package/dist/shared/controller.d.ts.map +1 -0
  9. package/dist/shared/controller.js +662 -0
  10. package/dist/shared/controller.js.map +1 -0
  11. package/dist/shared/pi-invoke.d.ts +31 -0
  12. package/dist/shared/pi-invoke.d.ts.map +1 -0
  13. package/dist/shared/pi-invoke.js +54 -0
  14. package/dist/shared/pi-invoke.js.map +1 -0
  15. package/dist/shared/render.d.ts +44 -0
  16. package/dist/shared/render.d.ts.map +1 -0
  17. package/dist/shared/render.js +116 -0
  18. package/dist/shared/render.js.map +1 -0
  19. package/dist/shared/spawner.d.ts +26 -0
  20. package/dist/shared/spawner.d.ts.map +1 -0
  21. package/dist/shared/spawner.js +226 -0
  22. package/dist/shared/spawner.js.map +1 -0
  23. package/dist/shared/types.d.ts +182 -0
  24. package/dist/shared/types.d.ts.map +1 -0
  25. package/dist/shared/types.js +8 -0
  26. package/dist/shared/types.js.map +1 -0
  27. package/dist/state/persistence.d.ts +83 -0
  28. package/dist/state/persistence.d.ts.map +1 -0
  29. package/dist/state/persistence.js +215 -0
  30. package/dist/state/persistence.js.map +1 -0
  31. package/dist/state/recovery.d.ts +35 -0
  32. package/dist/state/recovery.d.ts.map +1 -0
  33. package/dist/state/recovery.js +149 -0
  34. package/dist/state/recovery.js.map +1 -0
  35. package/dist/swarm/command.d.ts +36 -0
  36. package/dist/swarm/command.d.ts.map +1 -0
  37. package/dist/swarm/command.js +113 -0
  38. package/dist/swarm/command.js.map +1 -0
  39. package/dist/swarm/mode.d.ts +58 -0
  40. package/dist/swarm/mode.d.ts.map +1 -0
  41. package/dist/swarm/mode.js +87 -0
  42. package/dist/swarm/mode.js.map +1 -0
  43. package/dist/swarm/tool.d.ts +11 -0
  44. package/dist/swarm/tool.d.ts.map +1 -0
  45. package/dist/swarm/tool.js +190 -0
  46. package/dist/swarm/tool.js.map +1 -0
  47. package/dist/team/command.d.ts +11 -0
  48. package/dist/team/command.d.ts.map +1 -0
  49. package/dist/team/command.js +32 -0
  50. package/dist/team/command.js.map +1 -0
  51. package/dist/team/mailbox.d.ts +61 -0
  52. package/dist/team/mailbox.d.ts.map +1 -0
  53. package/dist/team/mailbox.js +160 -0
  54. package/dist/team/mailbox.js.map +1 -0
  55. package/dist/team/supervisor.d.ts +77 -0
  56. package/dist/team/supervisor.d.ts.map +1 -0
  57. package/dist/team/supervisor.js +195 -0
  58. package/dist/team/supervisor.js.map +1 -0
  59. package/dist/team/task-graph.d.ts +61 -0
  60. package/dist/team/task-graph.d.ts.map +1 -0
  61. package/dist/team/task-graph.js +193 -0
  62. package/dist/team/task-graph.js.map +1 -0
  63. package/dist/team/tool.d.ts +11 -0
  64. package/dist/team/tool.d.ts.map +1 -0
  65. package/dist/team/tool.js +210 -0
  66. package/dist/team/tool.js.map +1 -0
  67. package/dist/tui/permission-prompt.d.ts +26 -0
  68. package/dist/tui/permission-prompt.d.ts.map +1 -0
  69. package/dist/tui/permission-prompt.js +94 -0
  70. package/dist/tui/permission-prompt.js.map +1 -0
  71. package/dist/tui/progress.d.ts +64 -0
  72. package/dist/tui/progress.d.ts.map +1 -0
  73. package/dist/tui/progress.js +260 -0
  74. package/dist/tui/progress.js.map +1 -0
  75. package/dist/tui/swarm-markers.d.ts +20 -0
  76. package/dist/tui/swarm-markers.d.ts.map +1 -0
  77. package/dist/tui/swarm-markers.js +61 -0
  78. package/dist/tui/swarm-markers.js.map +1 -0
  79. package/package.json +58 -0
@@ -0,0 +1,195 @@
1
+ /**
2
+ * team/supervisor — team supervisor agent.
3
+ *
4
+ * The supervisor decomposes a high-level goal into phases, assigns
5
+ * each phase to a role agent, monitors progress via the mailbox,
6
+ * and synthesizes the final result.
7
+ */
8
+ import { TaskGraph, DEFAULT_TEAM_PHASES, } from "./task-graph.js";
9
+ import { resolveMailboxPaths, ensureMailbox, } from "./mailbox.js";
10
+ // ---------------------------------------------------------------------------
11
+ // Supervisor
12
+ // ---------------------------------------------------------------------------
13
+ export class TeamSupervisor {
14
+ config;
15
+ state;
16
+ mailboxPaths;
17
+ constructor(config) {
18
+ this.config = config;
19
+ this.mailboxPaths = resolveMailboxPaths(config.crewRoot, config.runId);
20
+ const phases = config.phases ?? DEFAULT_TEAM_PHASES;
21
+ this.state = {
22
+ runId: config.runId,
23
+ goal: config.goal,
24
+ status: "running",
25
+ taskGraph: new TaskGraph([...phases]),
26
+ agentIds: new Map(),
27
+ startedAt: Date.now(),
28
+ };
29
+ ensureMailbox(this.mailboxPaths);
30
+ }
31
+ // -------------------------------------------------------------------
32
+ // Phase management
33
+ // -------------------------------------------------------------------
34
+ /**
35
+ * Get the next phase that is ready to execute (dependencies satisfied,
36
+ * not yet started or assigned).
37
+ */
38
+ getNextReadyPhase() {
39
+ for (const name of this.state.taskGraph.getPhaseNames()) {
40
+ const phase = this.state.taskGraph.getPhase(name);
41
+ if (!phase || phase.status !== "queued")
42
+ continue;
43
+ // Check dependencies
44
+ const deps = phase.phase.dependsOn ?? [];
45
+ const depsSatisfied = deps.every((dep) => {
46
+ const depState = this.state.taskGraph.getPhase(dep);
47
+ return depState?.status === "completed";
48
+ });
49
+ if (depsSatisfied) {
50
+ return phase;
51
+ }
52
+ }
53
+ return undefined;
54
+ }
55
+ /**
56
+ * Start the next ready phase and return the role + prompt for the agent.
57
+ */
58
+ startNextPhase() {
59
+ const phase = this.getNextReadyPhase();
60
+ if (!phase)
61
+ return null;
62
+ const result = this.state.taskGraph.startPhase(phase.phase.name);
63
+ if (!result.ok)
64
+ return null;
65
+ const prompt = this.buildPhasePrompt(phase);
66
+ return {
67
+ phase,
68
+ role: phase.phase.role,
69
+ prompt,
70
+ };
71
+ }
72
+ /**
73
+ * Mark a phase as completed with its result.
74
+ */
75
+ completePhase(name, result) {
76
+ this.state.taskGraph.completePhase(name, result);
77
+ // Propagate failures: skip phases that depend on a failed phase
78
+ // (Not needed for completed phases)
79
+ }
80
+ /**
81
+ * Mark a phase as failed.
82
+ */
83
+ failPhase(name, error) {
84
+ this.state.taskGraph.failPhase(name, error);
85
+ // Skip downstream phases that depend on this one
86
+ for (const otherName of this.state.taskGraph.getPhaseNames()) {
87
+ const other = this.state.taskGraph.getPhase(otherName);
88
+ if (!other || other.status !== "queued")
89
+ continue;
90
+ const deps = other.phase.dependsOn ?? [];
91
+ if (deps.includes(name)) {
92
+ this.state.taskGraph.skipPhase(otherName);
93
+ }
94
+ }
95
+ }
96
+ /**
97
+ * Assign an agent to a phase.
98
+ */
99
+ assignAgent(phaseName, agentId) {
100
+ this.state.agentIds.set(phaseName, agentId);
101
+ this.state.taskGraph.assignAgent(phaseName, agentId);
102
+ }
103
+ // -------------------------------------------------------------------
104
+ // Completion
105
+ // -------------------------------------------------------------------
106
+ /** Check if the entire run is complete. */
107
+ isComplete() {
108
+ return this.state.taskGraph.isComplete();
109
+ }
110
+ /** Finalize the run with an overall status. */
111
+ finalize() {
112
+ this.state.status = this.state.taskGraph.overallStatus();
113
+ this.state.completedAt = Date.now();
114
+ }
115
+ /**
116
+ * Synthesize the final team result from all completed phases.
117
+ */
118
+ synthesizeResult() {
119
+ const lines = [
120
+ "<agent_team_result>",
121
+ `<summary>${this.buildSummary()}</summary>`,
122
+ ];
123
+ for (const phase of this.state.taskGraph.getAllPhases()) {
124
+ const name = phase.phase.name;
125
+ const role = phase.phase.role;
126
+ const status = phase.status;
127
+ const result = phase.result ?? "";
128
+ const error = phase.error ?? "";
129
+ lines.push(`<phase name="${escapeXml(name)}" role="${escapeXml(role)}" outcome="${escapeXml(status)}">`);
130
+ if (status === "completed" && result) {
131
+ lines.push(escapeXml(result));
132
+ }
133
+ else if (status === "failed" && error) {
134
+ lines.push(`<error>${escapeXml(error)}</error>`);
135
+ }
136
+ lines.push(`</phase>`);
137
+ }
138
+ lines.push("</agent_team_result>");
139
+ return lines.join("\n");
140
+ }
141
+ // -------------------------------------------------------------------
142
+ // Helpers
143
+ // -------------------------------------------------------------------
144
+ buildPhasePrompt(phase) {
145
+ const goal = this.config.goal;
146
+ const role = phase.phase.role;
147
+ const name = phase.phase.name;
148
+ // Gather context from completed dependency phases
149
+ const deps = phase.phase.dependsOn ?? [];
150
+ let contextBlock = "";
151
+ if (deps.length > 0) {
152
+ const depResults = deps
153
+ .map((dep) => {
154
+ const depState = this.state.taskGraph.getPhase(dep);
155
+ if (!depState || !depState.result)
156
+ return null;
157
+ return `${dep} output:\n${depState.result}`;
158
+ })
159
+ .filter(Boolean)
160
+ .join("\n\n");
161
+ if (depResults) {
162
+ contextBlock = `\n\nContext from previous phases:\n${depResults}`;
163
+ }
164
+ }
165
+ return [
166
+ `You are the ${role} agent in a team working on: ${goal}`,
167
+ `Your current phase is: ${name}`,
168
+ contextBlock,
169
+ `Complete the ${name} phase and write your result.`,
170
+ `Output only the result — no conversation.`,
171
+ ]
172
+ .filter(Boolean)
173
+ .join("\n");
174
+ }
175
+ buildSummary() {
176
+ const all = this.state.taskGraph.getAllPhases();
177
+ const completed = all.filter((p) => p.status === "completed").length;
178
+ const failed = all.filter((p) => p.status === "failed").length;
179
+ const skipped = all.filter((p) => p.status === "skipped").length;
180
+ const total = all.length;
181
+ return (`Phases completed: ${completed}/${total}. ` +
182
+ `Succeeded: ${completed}, Failed: ${failed}, Skipped: ${skipped}.`);
183
+ }
184
+ }
185
+ // ---------------------------------------------------------------------------
186
+ // Helpers
187
+ // ---------------------------------------------------------------------------
188
+ function escapeXml(value) {
189
+ return value
190
+ .replaceAll("&", "&amp;")
191
+ .replaceAll('"', "&quot;")
192
+ .replaceAll("<", "&lt;")
193
+ .replaceAll(">", "&gt;");
194
+ }
195
+ //# sourceMappingURL=supervisor.js.map
@@ -0,0 +1 @@
1
+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,GAAG,GAAG,CAAC,MAAM,CACxB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAC9B,CAAC,MAAM,CAAC;QACT,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC;QAEzB,OAAO,CACL,qBAAqB,SAAS,IAAI,KAAK,IAAI;YAC3C,cAAc,SAAS,aAAa,MAAM,cAAc,OAAO,GAAG,CACnE,CAAC;IACJ,CAAC;CACF;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK;SACT,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC;SACzB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * team/task-graph — task dependency graph with phases.
3
+ *
4
+ * Models a team run as a directed acyclic graph of phases, where each
5
+ * phase has a role assignment and optional dependencies. The supervisor
6
+ * advances phases as agents complete their tasks.
7
+ */
8
+ import type { TeamPhase } from "../shared/types.js";
9
+ /** Default team workflow: explore → plan → implement → review → test. */
10
+ export declare const DEFAULT_TEAM_PHASES: readonly TeamPhase[];
11
+ export type PhaseStatus = "queued" | "running" | "completed" | "failed" | "skipped";
12
+ export interface PhaseState {
13
+ readonly phase: TeamPhase;
14
+ status: PhaseStatus;
15
+ agentId?: string;
16
+ result?: string;
17
+ error?: string;
18
+ startedAt?: number;
19
+ completedAt?: number;
20
+ }
21
+ export declare class TaskGraph {
22
+ private readonly phases;
23
+ private readonly order;
24
+ constructor(phases: readonly TeamPhase[]);
25
+ /** Get all phases in definition order. */
26
+ getPhaseNames(): string[];
27
+ /** Get the state of a phase. */
28
+ getPhase(name: string): PhaseState | undefined;
29
+ /** Get all phase states. */
30
+ getAllPhases(): PhaseState[];
31
+ /** Get the current phase (first non-completed, non-failed, non-skipped). */
32
+ getCurrentPhase(): PhaseState | undefined;
33
+ /** Check if all phases are terminal (completed, failed, or skipped). */
34
+ isComplete(): boolean;
35
+ /** Get the overall run status. */
36
+ overallStatus(): "running" | "completed" | "failed";
37
+ /**
38
+ * Start a phase. Fails if dependencies are not satisfied.
39
+ * Returns the phase state or an error.
40
+ */
41
+ startPhase(name: string): {
42
+ ok: true;
43
+ phase: PhaseState;
44
+ } | {
45
+ ok: false;
46
+ error: string;
47
+ };
48
+ /** Mark a phase as completed with a result. */
49
+ completePhase(name: string, result: string): void;
50
+ /** Mark a phase as failed with an error. */
51
+ failPhase(name: string, error: string): void;
52
+ /** Skip a phase (e.g., when a dependency failed). */
53
+ skipPhase(name: string): void;
54
+ /** Assign an agent ID to a phase. */
55
+ assignAgent(name: string, agentId: string): void;
56
+ /** Serialize to a plain object for persistence. */
57
+ toJSON(): Record<string, unknown>;
58
+ /** Deserialize from a plain object. */
59
+ static fromJSON(data: Record<string, unknown>, phaseDefs: readonly TeamPhase[]): TaskGraph;
60
+ }
61
+ //# sourceMappingURL=task-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-graph.d.ts","sourceRoot":"","sources":["../../src/team/task-graph.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAM/D,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,EAAE,SAAS,SAAS,EAMnD,CAAC;AAMF,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,SAAS,GACT,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM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AE,OAAO,CAAC,EAC7B,SAAS,EAAE,SAAS,SAAS,EAAE,GAC9B,SAAS;CAsBb"}
@@ -0,0 +1,193 @@
1
+ /**
2
+ * team/task-graph — task dependency graph with phases.
3
+ *
4
+ * Models a team run as a directed acyclic graph of phases, where each
5
+ * phase has a role assignment and optional dependencies. The supervisor
6
+ * advances phases as agents complete their tasks.
7
+ */
8
+ // ---------------------------------------------------------------------------
9
+ // Default phases
10
+ // ---------------------------------------------------------------------------
11
+ /** Default team workflow: explore → plan → implement → review → test. */
12
+ export const DEFAULT_TEAM_PHASES = [
13
+ { name: "explore", role: "explorer" },
14
+ { name: "plan", role: "planner", dependsOn: ["explore"] },
15
+ { name: "implement", role: "coder", dependsOn: ["plan"] },
16
+ { name: "review", role: "reviewer", dependsOn: ["implement"] },
17
+ { name: "test", role: "tester", dependsOn: ["review"] },
18
+ ];
19
+ // ---------------------------------------------------------------------------
20
+ // Task graph
21
+ // ---------------------------------------------------------------------------
22
+ export class TaskGraph {
23
+ phases;
24
+ order;
25
+ constructor(phases) {
26
+ this.phases = new Map();
27
+ this.order = [];
28
+ for (const phase of phases) {
29
+ const name = phase.name;
30
+ if (this.phases.has(name)) {
31
+ throw new Error(`Duplicate phase name: ${name}`);
32
+ }
33
+ this.phases.set(name, {
34
+ phase,
35
+ status: "queued",
36
+ });
37
+ this.order.push(name);
38
+ }
39
+ }
40
+ // -------------------------------------------------------------------
41
+ // Queries
42
+ // -------------------------------------------------------------------
43
+ /** Get all phases in definition order. */
44
+ getPhaseNames() {
45
+ return [...this.order];
46
+ }
47
+ /** Get the state of a phase. */
48
+ getPhase(name) {
49
+ return this.phases.get(name);
50
+ }
51
+ /** Get all phase states. */
52
+ getAllPhases() {
53
+ return this.order.map((name) => this.phases.get(name));
54
+ }
55
+ /** Get the current phase (first non-completed, non-failed, non-skipped). */
56
+ getCurrentPhase() {
57
+ for (const name of this.order) {
58
+ const state = this.phases.get(name);
59
+ if (state.status === "queued" ||
60
+ state.status === "running") {
61
+ return state;
62
+ }
63
+ }
64
+ return undefined;
65
+ }
66
+ /** Check if all phases are terminal (completed, failed, or skipped). */
67
+ isComplete() {
68
+ return this.order.every((name) => {
69
+ const state = this.phases.get(name);
70
+ return (state.status === "completed" ||
71
+ state.status === "failed" ||
72
+ state.status === "skipped");
73
+ });
74
+ }
75
+ /** Get the overall run status. */
76
+ overallStatus() {
77
+ if (!this.isComplete())
78
+ return "running";
79
+ const allCompleted = this.order.every((name) => {
80
+ const state = this.phases.get(name);
81
+ return (state.status === "completed" || state.status === "skipped");
82
+ });
83
+ return allCompleted ? "completed" : "failed";
84
+ }
85
+ // -------------------------------------------------------------------
86
+ // Mutations
87
+ // -------------------------------------------------------------------
88
+ /**
89
+ * Start a phase. Fails if dependencies are not satisfied.
90
+ * Returns the phase state or an error.
91
+ */
92
+ startPhase(name) {
93
+ const state = this.phases.get(name);
94
+ if (!state) {
95
+ return { ok: false, error: `Unknown phase: ${name}` };
96
+ }
97
+ if (state.status !== "queued") {
98
+ return {
99
+ ok: false,
100
+ error: `Phase ${name} is already ${state.status}`,
101
+ };
102
+ }
103
+ // Check dependencies
104
+ const deps = state.phase.dependsOn ?? [];
105
+ for (const dep of deps) {
106
+ const depState = this.phases.get(dep);
107
+ if (!depState || depState.status !== "completed") {
108
+ return {
109
+ ok: false,
110
+ error: `Dependency ${dep} is not completed (${depState?.status ?? "unknown"})`,
111
+ };
112
+ }
113
+ }
114
+ state.status = "running";
115
+ state.startedAt = Date.now();
116
+ return { ok: true, phase: state };
117
+ }
118
+ /** Mark a phase as completed with a result. */
119
+ completePhase(name, result) {
120
+ const state = this.phases.get(name);
121
+ if (!state)
122
+ return;
123
+ state.status = "completed";
124
+ state.result = result;
125
+ state.completedAt = Date.now();
126
+ }
127
+ /** Mark a phase as failed with an error. */
128
+ failPhase(name, error) {
129
+ const state = this.phases.get(name);
130
+ if (!state)
131
+ return;
132
+ state.status = "failed";
133
+ state.error = error;
134
+ state.completedAt = Date.now();
135
+ }
136
+ /** Skip a phase (e.g., when a dependency failed). */
137
+ skipPhase(name) {
138
+ const state = this.phases.get(name);
139
+ if (!state)
140
+ return;
141
+ state.status = "skipped";
142
+ state.completedAt = Date.now();
143
+ }
144
+ /** Assign an agent ID to a phase. */
145
+ assignAgent(name, agentId) {
146
+ const state = this.phases.get(name);
147
+ if (state) {
148
+ state.agentId = agentId;
149
+ }
150
+ }
151
+ // -------------------------------------------------------------------
152
+ // Serialization
153
+ // -------------------------------------------------------------------
154
+ /** Serialize to a plain object for persistence. */
155
+ toJSON() {
156
+ const phases = {};
157
+ for (const [name, state] of this.phases) {
158
+ phases[name] = {
159
+ name: state.phase.name,
160
+ role: state.phase.role,
161
+ status: state.status,
162
+ agentId: state.agentId,
163
+ result: state.result,
164
+ error: state.error,
165
+ startedAt: state.startedAt,
166
+ completedAt: state.completedAt,
167
+ };
168
+ }
169
+ return { phases };
170
+ }
171
+ /** Deserialize from a plain object. */
172
+ static fromJSON(data, phaseDefs) {
173
+ const graph = new TaskGraph(phaseDefs);
174
+ const phases = data.phases;
175
+ if (phases) {
176
+ for (const [name, stateData] of Object.entries(phases)) {
177
+ const state = graph.phases.get(name);
178
+ if (state && stateData) {
179
+ state.status =
180
+ stateData.status ?? "queued";
181
+ state.agentId = stateData.agentId;
182
+ state.result = stateData.result;
183
+ state.error = stateData.error;
184
+ state.startedAt = stateData.startedAt;
185
+ state.completedAt =
186
+ stateData.completedAt;
187
+ }
188
+ }
189
+ }
190
+ return graph;
191
+ }
192
+ }
193
+ //# sourceMappingURL=task-graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-graph.js","sourceRoot":"","sources":["../../src/team/task-graph.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,yEAAyE;AACzE,MAAM,CAAC,MAAM,mBAAmB,GAAyB;IACvD,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE;IACrC,EAAE,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GAAG,SAAS,CAAC,SAA+B,CAAC;oBAC5D,KAAK,CAAC,WAAW;wBACf,SAAS,CAAC,WAAiC,CAAC;gBAChD,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * team/tool — AgentTeam tool registration.
3
+ *
4
+ * Registers the `AgentTeam` tool that the LLM can call to orchestrate
5
+ * a team of role-based agents that collaborate via a shared mailbox.
6
+ *
7
+ * Inspired by pi-crew's team orchestration and CrewAI's hierarchical model.
8
+ */
9
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
10
+ export declare function registerAgentTeamTool(pi: ExtensionAPI): void;
11
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/team/tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AA+CpE,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,YAAY,GACf,IAAI,CA4PN"}