@gjczone/pi-swarm 0.5.0 → 0.7.1
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/README.md +14 -21
- package/dist/index.d.ts +2 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -18
- package/dist/index.js.map +1 -1
- package/dist/shared/controller.d.ts +10 -1
- package/dist/shared/controller.d.ts.map +1 -1
- package/dist/shared/controller.js +48 -12
- package/dist/shared/controller.js.map +1 -1
- package/dist/shared/render.d.ts +1 -1
- package/dist/shared/render.js +1 -1
- package/dist/shared/spawner.js +54 -8
- package/dist/shared/spawner.js.map +1 -1
- package/dist/shared/types.d.ts +10 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/worktree.d.ts +2 -1
- package/dist/shared/worktree.d.ts.map +1 -1
- package/dist/shared/worktree.js +10 -4
- package/dist/shared/worktree.js.map +1 -1
- package/dist/state/recovery.d.ts.map +1 -1
- package/dist/state/recovery.js +25 -4
- package/dist/state/recovery.js.map +1 -1
- package/dist/swarm/command.d.ts +4 -5
- package/dist/swarm/command.d.ts.map +1 -1
- package/dist/swarm/command.js +26 -74
- package/dist/swarm/command.js.map +1 -1
- package/dist/swarm/mode.d.ts +1 -1
- package/dist/swarm/mode.js +2 -2
- package/dist/swarm/mode.js.map +1 -1
- package/dist/swarm/tool.d.ts +4 -4
- package/dist/swarm/tool.d.ts.map +1 -1
- package/dist/swarm/tool.js +112 -167
- package/dist/swarm/tool.js.map +1 -1
- package/dist/team/command.d.ts +2 -4
- package/dist/team/command.d.ts.map +1 -1
- package/dist/team/command.js +5 -13
- package/dist/team/command.js.map +1 -1
- package/dist/team/mailbox.d.ts +7 -2
- package/dist/team/mailbox.d.ts.map +1 -1
- package/dist/team/mailbox.js +121 -32
- package/dist/team/mailbox.js.map +1 -1
- package/dist/tui/progress.d.ts +35 -47
- package/dist/tui/progress.d.ts.map +1 -1
- package/dist/tui/progress.js +245 -489
- package/dist/tui/progress.js.map +1 -1
- package/dist/tui/swarm-markers.d.ts +1 -1
- package/dist/tui/swarm-markers.js +1 -1
- package/package.json +13 -2
- package/dist/team/supervisor.d.ts +0 -171
- package/dist/team/supervisor.d.ts.map +0 -1
- package/dist/team/supervisor.js +0 -685
- package/dist/team/supervisor.js.map +0 -1
- package/dist/team/task-graph.d.ts +0 -64
- package/dist/team/task-graph.d.ts.map +0 -1
- package/dist/team/task-graph.js +0 -216
- package/dist/team/task-graph.js.map +0 -1
- package/dist/team/tool.d.ts +0 -11
- package/dist/team/tool.d.ts.map +0 -1
- package/dist/team/tool.js +0 -491
- package/dist/team/tool.js.map +0 -1
- package/dist/tui/permission-prompt.d.ts +0 -26
- package/dist/tui/permission-prompt.d.ts.map +0 -1
- package/dist/tui/permission-prompt.js +0 -98
- package/dist/tui/permission-prompt.js.map +0 -1
- package/dist/tui/team-dashboard.d.ts +0 -81
- package/dist/tui/team-dashboard.d.ts.map +0 -1
- package/dist/tui/team-dashboard.js +0 -657
- package/dist/tui/team-dashboard.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/team/command.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/team/command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,YAAY,EAEb,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,YAAY,EAChB,IAAI,EAAE,gBAAgB,GACrB,IAAI,CAgCN"}
|
package/dist/team/command.js
CHANGED
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* team/command — /swarm-team slash command handler.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* The command delegates to the SwarmTeam tool internally.
|
|
4
|
+
* /swarm-team <goal> — directs the LLM to use the Swarm tool with mailbox enabled
|
|
5
|
+
* for collaborative multi-step workflows.
|
|
8
6
|
*/
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
// Registration
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
7
|
export function registerTeamCommand(pi, host) {
|
|
13
8
|
pi.registerCommand("swarm-team", {
|
|
14
|
-
description: "Launch a collaborative
|
|
9
|
+
description: "Launch a collaborative Swarm with mailbox. " +
|
|
15
10
|
"Usage: /swarm-team <goal>",
|
|
16
11
|
async handler(args, ctx) {
|
|
17
12
|
const prompt = args.trim();
|
|
18
13
|
if (prompt.length === 0) {
|
|
19
|
-
ctx.ui?.notify?.("
|
|
14
|
+
ctx.ui?.notify?.("/swarm-team <goal>", "info");
|
|
20
15
|
return;
|
|
21
16
|
}
|
|
22
17
|
if (!host.hasModel()) {
|
|
23
18
|
host.showError("No model configured. Please set a model first.");
|
|
24
19
|
return;
|
|
25
20
|
}
|
|
26
|
-
// Activate swarm mode if not already active
|
|
27
21
|
if (!host.swarmActive) {
|
|
28
22
|
host.setSwarmActive(true, "task");
|
|
29
23
|
}
|
|
30
|
-
// TUI marker
|
|
31
24
|
host.pi.sendMessage?.({
|
|
32
25
|
customType: "swarm:marker",
|
|
33
26
|
content: "active",
|
|
34
27
|
display: true,
|
|
35
28
|
});
|
|
36
|
-
|
|
37
|
-
host.sendNormalUserInput(`Use the SwarmTeam tool to accomplish this goal: ${prompt}`);
|
|
29
|
+
host.sendNormalUserInput(`Use the Swarm tool with mailbox: true to accomplish this goal: ${prompt}`);
|
|
38
30
|
},
|
|
39
31
|
});
|
|
40
32
|
}
|
package/dist/team/command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/team/command.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/team/command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,MAAM,UAAU,mBAAmB,CACjC,EAAgB,EAChB,IAAsB;IAEtB,EAAE,CAAC,eAAe,CAAC,YAAY,EAAE;QAC/B,WAAW,EACT,6CAA6C;YAC7C,2BAA2B;QAC7B,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,GAA4B;YACtD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAE3B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;gBAC/C,OAAO;YACT,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACrB,IAAI,CAAC,SAAS,CAAC,gDAAgD,CAAC,CAAC;gBACjE,OAAO;YACT,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACtB,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACpC,CAAC;YACD,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;gBACpB,UAAU,EAAE,cAAc;gBAC1B,OAAO,EAAE,QAAQ;gBACjB,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;YAEH,IAAI,CAAC,mBAAmB,CACtB,kEAAkE,MAAM,EAAE,CAC3E,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/dist/team/mailbox.d.ts
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Each team run has a shared mailbox directory under .pi/swarm/mailbox/
|
|
5
5
|
* where agents write messages (outbox) and read messages (inbox).
|
|
6
|
-
*
|
|
7
|
-
* Inspired by pi-crew's mailbox system.
|
|
8
6
|
*/
|
|
9
7
|
import type { MailboxMessage } from "../shared/types.js";
|
|
10
8
|
/**
|
|
@@ -24,6 +22,7 @@ export interface MailboxPaths {
|
|
|
24
22
|
readonly outbox: string;
|
|
25
23
|
readonly delivery: string;
|
|
26
24
|
readonly taskDir: string;
|
|
25
|
+
readonly inboxAcks: string;
|
|
27
26
|
}
|
|
28
27
|
export declare function resolveMailboxPaths(swarmRoot: string, runId: string): MailboxPaths;
|
|
29
28
|
export declare function resolveTaskMailboxPaths(paths: MailboxPaths, taskId: string): {
|
|
@@ -53,10 +52,16 @@ export declare function readTaskInbox(paths: MailboxPaths, taskId: string): Mail
|
|
|
53
52
|
export declare function countOutboxMessages(paths: MailboxPaths): number;
|
|
54
53
|
/**
|
|
55
54
|
* Acknowledge (delete) messages from the team inbox.
|
|
55
|
+
*
|
|
56
|
+
* Uses an append-only ack file to avoid the TOCTOU race between
|
|
57
|
+
* reading and rewriting inbox.jsonl. Acknowledged message IDs are
|
|
58
|
+
* appended to inboxAcks.jsonl and filtered at read time.
|
|
56
59
|
*/
|
|
57
60
|
export declare function ackMessages(paths: MailboxPaths, messageIds: string[]): void;
|
|
58
61
|
/**
|
|
59
62
|
* Acknowledge (delete) messages from a task-specific inbox.
|
|
63
|
+
*
|
|
64
|
+
* Uses the same append-only ack approach as ackMessages.
|
|
60
65
|
*/
|
|
61
66
|
export declare function ackTaskMessages(paths: MailboxPaths, taskId: string, messageIds: string[]): void;
|
|
62
67
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mailbox.d.ts","sourceRoot":"","sources":["../../src/team/mailbox.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mailbox.d.ts","sourceRoot":"","sources":["../../src/team/mailbox.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAyCzD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CA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mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,IAAI,CAIN"}
|
package/dist/team/mailbox.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Each team run has a shared mailbox directory under .pi/swarm/mailbox/
|
|
5
5
|
* where agents write messages (outbox) and read messages (inbox).
|
|
6
|
-
*
|
|
7
|
-
* Inspired by pi-crew's mailbox system.
|
|
8
6
|
*/
|
|
9
7
|
import * as fs from "node:fs";
|
|
10
8
|
import * as path from "node:path";
|
|
@@ -34,12 +32,14 @@ function ensureWithinMailbox(resolvedPath, mailboxRoot) {
|
|
|
34
32
|
}
|
|
35
33
|
export function resolveMailboxPaths(swarmRoot, runId) {
|
|
36
34
|
const root = path.join(swarmRoot, "state", "runs", runId, "mailbox");
|
|
35
|
+
const inbox = path.join(root, "inbox.jsonl");
|
|
37
36
|
return {
|
|
38
37
|
root,
|
|
39
|
-
inbox
|
|
38
|
+
inbox,
|
|
40
39
|
outbox: path.join(root, "outbox.jsonl"),
|
|
41
40
|
delivery: path.join(root, "delivery.json"),
|
|
42
41
|
taskDir: path.join(root, "tasks"),
|
|
42
|
+
inboxAcks: inbox + ".acks",
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
export function resolveTaskMailboxPaths(paths, taskId) {
|
|
@@ -79,25 +79,30 @@ export function sendMessage(paths, message) {
|
|
|
79
79
|
// Also append to team inbox for general reading
|
|
80
80
|
appendJsonLine(paths.inbox, message);
|
|
81
81
|
if (message.to === "broadcast") {
|
|
82
|
-
// Broadcast: deliver to all known
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
82
|
+
// Broadcast: deliver to all known task inboxes under the tasks directory.
|
|
83
|
+
// Discovers recipients dynamically so it works for both team mode
|
|
84
|
+
// (explorer, planner, ...) and swarm mode (agent-1, agent-2, ...).
|
|
85
|
+
try {
|
|
86
|
+
const entries = fs.readdirSync(paths.taskDir, { withFileTypes: true });
|
|
87
|
+
for (const entry of entries) {
|
|
88
|
+
if (!entry.isDirectory())
|
|
89
|
+
continue;
|
|
90
|
+
const taskId = entry.name;
|
|
91
|
+
if (!SAFE_RECIPIENT_PATTERN.test(taskId))
|
|
92
|
+
continue;
|
|
93
|
+
try {
|
|
94
|
+
const taskPaths = resolveTaskMailboxPaths(paths, taskId);
|
|
95
|
+
fs.mkdirSync(path.dirname(taskPaths.inbox), { recursive: true });
|
|
96
|
+
appendJsonLine(taskPaths.inbox, message);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Best effort delivery per task
|
|
100
|
+
}
|
|
99
101
|
}
|
|
100
102
|
}
|
|
103
|
+
catch {
|
|
104
|
+
// tasks directory might not exist yet — best effort
|
|
105
|
+
}
|
|
101
106
|
}
|
|
102
107
|
else {
|
|
103
108
|
// Direct message: deliver to specific role inbox
|
|
@@ -110,14 +115,25 @@ export function sendMessage(paths, message) {
|
|
|
110
115
|
* Read unacknowledged messages from the team inbox.
|
|
111
116
|
*/
|
|
112
117
|
export function readInbox(paths) {
|
|
113
|
-
|
|
118
|
+
const messages = readJsonLines(paths.inbox);
|
|
119
|
+
const ackedIds = readAckIds(paths.inboxAcks);
|
|
120
|
+
if (ackedIds.size === 0)
|
|
121
|
+
return messages;
|
|
122
|
+
return messages.filter((m) => !ackedIds.has(m.messageId));
|
|
123
|
+
}
|
|
124
|
+
function taskAckPath(taskInbox) {
|
|
125
|
+
return taskInbox + ".acks";
|
|
114
126
|
}
|
|
115
127
|
/**
|
|
116
128
|
* Read messages from a task-specific inbox.
|
|
117
129
|
*/
|
|
118
130
|
export function readTaskInbox(paths, taskId) {
|
|
119
131
|
const taskPaths = resolveTaskMailboxPaths(paths, taskId);
|
|
120
|
-
|
|
132
|
+
const messages = readJsonLines(taskPaths.inbox);
|
|
133
|
+
const ackedIds = readAckIds(taskAckPath(taskPaths.inbox));
|
|
134
|
+
if (ackedIds.size === 0)
|
|
135
|
+
return messages;
|
|
136
|
+
return messages.filter((m) => !ackedIds.has(m.messageId));
|
|
121
137
|
}
|
|
122
138
|
/**
|
|
123
139
|
* Count total messages in the team outbox.
|
|
@@ -138,22 +154,29 @@ export function countOutboxMessages(paths) {
|
|
|
138
154
|
}
|
|
139
155
|
/**
|
|
140
156
|
* Acknowledge (delete) messages from the team inbox.
|
|
157
|
+
*
|
|
158
|
+
* Uses an append-only ack file to avoid the TOCTOU race between
|
|
159
|
+
* reading and rewriting inbox.jsonl. Acknowledged message IDs are
|
|
160
|
+
* appended to inboxAcks.jsonl and filtered at read time.
|
|
141
161
|
*/
|
|
142
162
|
export function ackMessages(paths, messageIds) {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
163
|
+
for (const id of messageIds) {
|
|
164
|
+
appendJsonLine(paths.inboxAcks, { messageId: id });
|
|
165
|
+
}
|
|
166
|
+
compactAcks(paths.inboxAcks);
|
|
147
167
|
}
|
|
148
168
|
/**
|
|
149
169
|
* Acknowledge (delete) messages from a task-specific inbox.
|
|
170
|
+
*
|
|
171
|
+
* Uses the same append-only ack approach as ackMessages.
|
|
150
172
|
*/
|
|
151
173
|
export function ackTaskMessages(paths, taskId, messageIds) {
|
|
152
174
|
const taskPaths = resolveTaskMailboxPaths(paths, taskId);
|
|
153
|
-
const
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
175
|
+
const ackPath = taskAckPath(taskPaths.inbox);
|
|
176
|
+
for (const id of messageIds) {
|
|
177
|
+
appendJsonLine(ackPath, { messageId: id });
|
|
178
|
+
}
|
|
179
|
+
compactAcks(ackPath);
|
|
157
180
|
}
|
|
158
181
|
/**
|
|
159
182
|
* Get delivery state (which messages have been delivered/read).
|
|
@@ -184,24 +207,90 @@ function appendJsonLine(filePath, data) {
|
|
|
184
207
|
const line = JSON.stringify(data) + "\n";
|
|
185
208
|
fs.appendFileSync(filePath, line, "utf-8");
|
|
186
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Read acknowledged message IDs from an ack file (JSONL with {messageId: string} entries).
|
|
212
|
+
*/
|
|
213
|
+
function readAckIds(ackPath) {
|
|
214
|
+
try {
|
|
215
|
+
const raw = fs.readFileSync(ackPath, "utf-8");
|
|
216
|
+
if (!raw.trim())
|
|
217
|
+
return new Set();
|
|
218
|
+
const ids = new Set();
|
|
219
|
+
for (const line of raw.trim().split("\n")) {
|
|
220
|
+
const trimmed = line.trim();
|
|
221
|
+
if (!trimmed)
|
|
222
|
+
continue;
|
|
223
|
+
try {
|
|
224
|
+
const parsed = JSON.parse(trimmed);
|
|
225
|
+
if (parsed.messageId)
|
|
226
|
+
ids.add(parsed.messageId);
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
// Skip corrupted ack lines
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return ids;
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
return new Set();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Compact an ack file if the number of lines exceeds 10x the unique ID count
|
|
240
|
+
* (indicating significant duplication from repeated acknowledgment cycles).
|
|
241
|
+
*/
|
|
242
|
+
function compactAcks(ackPath) {
|
|
243
|
+
try {
|
|
244
|
+
const raw = fs.readFileSync(ackPath, "utf-8");
|
|
245
|
+
if (!raw.trim())
|
|
246
|
+
return;
|
|
247
|
+
const lines = raw
|
|
248
|
+
.trim()
|
|
249
|
+
.split("\n")
|
|
250
|
+
.filter((l) => l.trim());
|
|
251
|
+
if (lines.length < 100)
|
|
252
|
+
return; // Don't compact small files
|
|
253
|
+
const uniqueIds = readAckIds(ackPath);
|
|
254
|
+
if (uniqueIds.size === 0)
|
|
255
|
+
return;
|
|
256
|
+
// Compact if ratio exceeds 10x
|
|
257
|
+
if (lines.length > uniqueIds.size * 10) {
|
|
258
|
+
const content = Array.from(uniqueIds)
|
|
259
|
+
.map((id) => JSON.stringify({ messageId: id }))
|
|
260
|
+
.join("\n");
|
|
261
|
+
writeAtomic(ackPath, content + "\n");
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
catch {
|
|
265
|
+
// Best effort compaction
|
|
266
|
+
}
|
|
267
|
+
}
|
|
187
268
|
function readJsonLines(filePath) {
|
|
188
269
|
try {
|
|
189
270
|
const raw = fs.readFileSync(filePath, "utf-8");
|
|
190
271
|
if (!raw.trim())
|
|
191
272
|
return [];
|
|
192
|
-
|
|
273
|
+
const lines = raw
|
|
193
274
|
.trim()
|
|
194
275
|
.split("\n")
|
|
195
|
-
.filter((line) => line.trim())
|
|
276
|
+
.filter((line) => line.trim());
|
|
277
|
+
let corruptedCount = 0;
|
|
278
|
+
const messages = lines
|
|
196
279
|
.map((line) => {
|
|
197
280
|
try {
|
|
198
281
|
return JSON.parse(line);
|
|
199
282
|
}
|
|
200
283
|
catch {
|
|
284
|
+
corruptedCount++;
|
|
285
|
+
console.error(`[pi-swarm] Corrupted JSONL line in ${filePath}:`, line.slice(0, 200));
|
|
201
286
|
return null;
|
|
202
287
|
}
|
|
203
288
|
})
|
|
204
289
|
.filter((m) => m !== null);
|
|
290
|
+
if (corruptedCount > 0) {
|
|
291
|
+
console.error(`[pi-swarm] Skipped ${corruptedCount} corrupted line(s) in ${filePath}`);
|
|
292
|
+
}
|
|
293
|
+
return messages;
|
|
205
294
|
}
|
|
206
295
|
catch {
|
|
207
296
|
return [];
|
package/dist/team/mailbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mailbox.js","sourceRoot":"","sources":["../../src/team/mailbox.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mailbox.js","sourceRoot":"","sources":["../../src/team/mailbox.ts"],"names":[],"mappings":"AAAA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yBAAyB,QAAQ,EAAE,CACxE,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB,EAAE,QAA0B;IAClE,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClE,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/tui/progress.d.ts
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* tui/progress — AgentSwarm live progress panel.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Vertical panel layout with fixed-width tool-call-based braille progress
|
|
5
|
+
* bars and inline activity text. Each agent renders as a single line:
|
|
6
|
+
* 001 [braille bar] read: src/lib.rs lines 42-99
|
|
7
|
+
* Bar width is fixed (5 cells) so tool labels align across agents.
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* - Keyboard interaction: j/k scroll, Enter detail, ? help, tab panel switch
|
|
11
|
-
* - Panel switching: members list / event log
|
|
12
|
-
* - Detail overlay for individual members
|
|
13
|
-
* - Activity/tool tracking per member
|
|
14
|
-
* - ETA estimation
|
|
9
|
+
* Progress is driven by actual tool calls / activity events (progressTick),
|
|
10
|
+
* not wall-clock time. An agent that makes more progress fills faster.
|
|
15
11
|
*
|
|
16
|
-
*
|
|
12
|
+
* For 5+ agents, switches to a 2-column compact grid (3-cell bars).
|
|
17
13
|
*/
|
|
18
14
|
import type { Component } from "@earendil-works/pi-tui";
|
|
19
|
-
import type { BatchProgressSnapshot, SubagentUsage
|
|
15
|
+
import type { BatchProgressSnapshot, SubagentUsage } from "../shared/types.js";
|
|
20
16
|
export type MemberPhase = "pending" | "queued" | "prompting" | "working" | "completed" | "failed" | "cancelled" | "suspended";
|
|
21
17
|
export interface MemberStatus {
|
|
22
18
|
readonly index: number;
|
|
@@ -24,10 +20,11 @@ export interface MemberStatus {
|
|
|
24
20
|
item?: string;
|
|
25
21
|
result?: string;
|
|
26
22
|
error?: string;
|
|
27
|
-
phaseStartedAt?: number;
|
|
28
23
|
currentTool?: string;
|
|
29
24
|
activity?: string;
|
|
30
25
|
usage?: SubagentUsage;
|
|
26
|
+
progressTick?: number;
|
|
27
|
+
startedAt?: number;
|
|
31
28
|
}
|
|
32
29
|
export interface SwarmProgressState {
|
|
33
30
|
title?: string;
|
|
@@ -39,59 +36,50 @@ export interface SwarmProgressState {
|
|
|
39
36
|
members: MemberStatus[];
|
|
40
37
|
totalUsage: SubagentUsage;
|
|
41
38
|
startedAt: number;
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
mailbox?: boolean;
|
|
40
|
+
mailboxCount?: number;
|
|
44
41
|
}
|
|
45
42
|
export declare function snapshotToProgressState(snapshot: BatchProgressSnapshot, title?: string): SwarmProgressState;
|
|
46
43
|
export declare class AgentSwarmProgressComponent implements Component {
|
|
47
44
|
private state_;
|
|
48
|
-
private renderedWidth;
|
|
49
|
-
private cachedLines;
|
|
50
45
|
private onRequestRender;
|
|
51
|
-
private animationFrame;
|
|
52
|
-
private frameIndex;
|
|
53
46
|
private pollTimer;
|
|
54
47
|
private debounceTimer;
|
|
55
|
-
private pendingInvalidate;
|
|
56
|
-
private hasActiveMembers;
|
|
57
|
-
private scrollOffset;
|
|
58
|
-
private selectedIndex;
|
|
59
|
-
private activePanel;
|
|
60
|
-
private overlay;
|
|
61
48
|
constructor(onRequestRender?: () => void);
|
|
62
49
|
update(state: SwarmProgressState): void;
|
|
63
50
|
complete(): void;
|
|
64
51
|
dispose(): void;
|
|
65
52
|
invalidate(): void;
|
|
66
|
-
handleInput(
|
|
53
|
+
handleInput(_data: string): void;
|
|
67
54
|
render(width: number): string[];
|
|
68
|
-
private
|
|
69
|
-
private
|
|
70
|
-
private renderOverlay;
|
|
71
|
-
private renderHelpOverlay;
|
|
72
|
-
private renderDetailOverlay;
|
|
73
|
-
private scrollDown;
|
|
74
|
-
private scrollUp;
|
|
55
|
+
private renderHeader;
|
|
56
|
+
private renderStatusLine;
|
|
75
57
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* invalidation.
|
|
58
|
+
* Render all agents. Uses vertical panels for small counts
|
|
59
|
+
* and a compact 2-column grid for larger batches.
|
|
79
60
|
*/
|
|
80
|
-
private
|
|
81
|
-
|
|
82
|
-
* Start the fallback polling timer. Falls back to polling when no
|
|
83
|
-
* state changes trigger requests, ensuring the spinner animates.
|
|
84
|
-
*/
|
|
85
|
-
private startPolling;
|
|
86
|
-
private schedulePoll;
|
|
61
|
+
private renderAgentPanels;
|
|
62
|
+
private renderVerticalPanels;
|
|
87
63
|
/**
|
|
88
|
-
*
|
|
64
|
+
* Render one agent as a single line with fixed-width progress bar.
|
|
65
|
+
*
|
|
66
|
+
* Format: `001 [braille bar] read: src/lib.rs lines 42-99`
|
|
67
|
+
* Bar is always FIXED_BAR_CELLS (5) wide so tool labels align across agents.
|
|
68
|
+
*
|
|
69
|
+
* Progress is driven by progressTick (actual tool calls / activity events),
|
|
70
|
+
* not wall-clock time. Each tick fills one level of the braille bar.
|
|
89
71
|
*/
|
|
90
|
-
private
|
|
72
|
+
private renderAgentLine;
|
|
73
|
+
private renderCompactGrid;
|
|
91
74
|
/**
|
|
92
|
-
*
|
|
75
|
+
* Compact single-line grid cell.
|
|
76
|
+
* Format: `001 [▓▓] label`
|
|
93
77
|
*/
|
|
94
|
-
private
|
|
78
|
+
private renderGridCell;
|
|
79
|
+
private renderBrailleBar;
|
|
80
|
+
private renderCellLabel;
|
|
81
|
+
private requestRender;
|
|
82
|
+
private startPolling;
|
|
95
83
|
private stopTimers;
|
|
96
84
|
}
|
|
97
85
|
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/tui/progress.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/tui/progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EACV,qBAAqB,EAErB,aAAa,EACd,MAAM,oBAAoB,CAAC;AAmC5B,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,QAAQ,GACR,WAAW,GACX,SAAS,GACT,WAAW,GACX,QAAQ,GACR,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,WAAW,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,UAAU,EAAE,aAAa,CAAC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