hive-swarm 2.1.1 → 2.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.
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +3 -3
- package/board.js +6 -1
- package/codex.mjs +8 -7
- package/core.mjs +4 -2
- package/engine.mjs +37 -19
- package/package.json +1 -1
- package/server.mjs +17 -9
- package/skills/swarm/SKILL.md +3 -3
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Hive Swarm
|
|
2
2
|
|
|
3
|
-
Version **2.1.
|
|
3
|
+
Version **2.1.2**. Coordinate dependent agent tasks with a shared board, outcome threads, live activity, owned journals, and message-flow graphs.
|
|
4
4
|
|
|
5
5
|
The core and Codex runtime use Node.js ESM, built-in SQLite, and **zero third-party runtime dependencies**. Required Node range: `^22.19.0 || >=24.2.0`.
|
|
6
6
|
|
|
7
|
-
Hive Swarm **2.1.
|
|
7
|
+
Hive Swarm **2.1.2** pairs `hive-swarm@2.1.2` (core + Codex) with `dsh-hive-swarm@2.1.2` (experimental native DeepSeek Harness `0.2.2-rc.5` bundle). Both tarballs are verified against their source artifacts before publication.
|
|
8
8
|
|
|
9
9
|
## Codex lifecycle
|
|
10
10
|
|
|
@@ -19,6 +19,6 @@ npx hive-swarm@latest uninstall --host codex
|
|
|
19
19
|
|
|
20
20
|
`npm install` only installs package files; it does not register a plugin. The explicit CLI creates an immutable persistent marketplace copy and delegates host changes to supported Codex CLI commands. Local switching/rollback is qualified for CLI `0.169.1`; other versions retain the stage unless `--allow-unqualified-cli` is explicitly passed. Active owned turns block replacement. Uninstall preserves databases, journals, and verified release copies. Doctor does not execute Codex by default or call models.
|
|
21
21
|
|
|
22
|
-
DSH uses the separate `dsh-hive-swarm` bundle and its own profile manager. Install the matching experimental `0.2.2-rc.5` bundle with `dsh plugin --profile desktop add dsh-hive-swarm@2.1.
|
|
22
|
+
DSH uses the separate `dsh-hive-swarm` bundle and its own profile manager. Install the matching experimental `0.2.2-rc.5` bundle with `dsh plugin --profile desktop add dsh-hive-swarm@2.1.2` (or `@next`). Release `2.1.2` brings an Antigravity-style Overview (task summary accordion, `goalLine`, `taskLabel`, outcome `threads` progress bars, and `Screenshots` timeline), uncluttered **Board** & click-to-open **Members** rows, native-compact Turn 2+ wakeups (with `wake: false` silent posts & owner `cancel_turn`), structured DSH error reporting, Goal-mode `@lead` handling, Dual-Mode **Graph** (**`Hive`** honeycomb + Goal-consolidated **`Mentions`** ring + zero-dependency **Export GIF**), dashboard version & cached update alerts, hidden native DSH subagents (`executionMode: 'subagent'`), and attached Codex `0.171+` child threads (`executionMode: 'attached'`). Its Windows shell retains the Host's partial confinement limits. `--host dsh` prints guidance without editing a DSH profile.
|
|
23
23
|
|
|
24
24
|
[Full documentation and high-resolution screenshots](https://github.com/snowmiku601-cpu/hive-swarm#see-it-in-action) · [Source and issue tracker](https://github.com/snowmiku601-cpu/hive-swarm) · MIT license
|
package/board.js
CHANGED
|
@@ -1351,6 +1351,11 @@
|
|
|
1351
1351
|
dismiss.setAttribute('aria-label','Dismiss unconfirmed run for '+author(member.name));
|
|
1352
1352
|
actions.append(retry,dismiss);
|
|
1353
1353
|
}
|
|
1354
|
+
if (member.status==='working') {
|
|
1355
|
+
const cancel=trustedButton('Cancel turn',button=>memberAction(button,'cancel_turn',{member:member.name}),false,'link-button danger');
|
|
1356
|
+
cancel.setAttribute('aria-label','Cancel turn for '+author(member.name));
|
|
1357
|
+
actions.append(cancel);
|
|
1358
|
+
}
|
|
1354
1359
|
if (active) {
|
|
1355
1360
|
const retire=node('div','retire-choice');
|
|
1356
1361
|
const draw=()=>{
|
|
@@ -2082,7 +2087,7 @@
|
|
|
2082
2087
|
async function call(tool,values={}) {
|
|
2083
2088
|
if (!standalone) return unpack(await rpc('tools/call',{name:tool,arguments:{teamId,...values}}));
|
|
2084
2089
|
const routes={board_status:'status',board_history:'history',post_message:'post',
|
|
2085
|
-
pause_team:'pause',resume_team:'resume',set_member_model:'member-model',retire_member:'member-retire',
|
|
2090
|
+
pause_team:'pause',resume_team:'resume',cancel_turn:'cancel-turn',set_member_model:'member-model',retire_member:'member-retire',
|
|
2086
2091
|
remove_worktree:'worktree-remove',set_team_title:'title',resolve_recovery:'resolve-recovery'};
|
|
2087
2092
|
const reading=tool==='board_status'||tool==='board_history';
|
|
2088
2093
|
const query=tool==='board_history'?'?'+new URLSearchParams(values):'';
|
package/codex.mjs
CHANGED
|
@@ -167,7 +167,7 @@ function reportText(text) {
|
|
|
167
167
|
const value=text.trim();
|
|
168
168
|
const structured=/[{,]\s*"(?:state|message|notify|waitFor)"\s*:/.test(value);
|
|
169
169
|
const report=findOutcome(value)?.message ?? (structured ? extractReportMessage(value) : value);
|
|
170
|
-
if (!report || /You are member @[a-z0-9_-]+ in (?:Team Board|Hive Swarm)\b|Resume Hive Swarm turn \d+ as @[a-z0-9_-]
|
|
170
|
+
if (!report || /You are member @[a-z0-9_-]+ in (?:Team Board|Hive Swarm)\b|Resume Hive Swarm turn \d+ as @[a-z0-9_-]+|\[Hive turn \d+ · @[a-z0-9_-]+\]/i.test(report)) return '';
|
|
171
171
|
return report.trim().slice(0,6000);
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -586,12 +586,12 @@ export class CodexRunner {
|
|
|
586
586
|
async runTurn(id,{team,member,remember,declaredOutcome,onActivity,model,effort,cwd,inheriting,resuming=false}) {
|
|
587
587
|
const activeRoster = team.members.filter(m => m.name !== member.name && m.status !== 'retired');
|
|
588
588
|
const compactPeers = activeRoster.map(m => '@' + m.name).join(', ');
|
|
589
|
+
const rosterChanged = Boolean(compactPeers && member.lastPeers !== compactPeers);
|
|
589
590
|
const brief = (resuming ? [
|
|
590
|
-
'
|
|
591
|
-
(
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
'New board messages:\n' + formatInbox(member.inbox),
|
|
591
|
+
'[Hive turn ' + member.lastTurn + ' · @' + member.name + ']' +
|
|
592
|
+
(rosterChanged ? ' Active members: ' + compactPeers + '.' : '') +
|
|
593
|
+
' End with working-status JSON (or set_turn_outcome turn=' + member.lastTurn + ').',
|
|
594
|
+
formatInbox(member.inbox),
|
|
595
595
|
] : [
|
|
596
596
|
'You are member @' + member.name + ' in Hive Swarm. Other members: ' +
|
|
597
597
|
activeRoster.map(m => '@' + m.name + (m.group ? ' in @' + m.group : '') +
|
|
@@ -635,9 +635,10 @@ export class CodexRunner {
|
|
|
635
635
|
turn.id = accepted.turn.id;
|
|
636
636
|
for (const event of turn.earlyEvents) deliverTurnEvent(turn, event);
|
|
637
637
|
turn.earlyEvents.length = 0;
|
|
638
|
-
if (model || effort) remember({
|
|
638
|
+
if (model || effort || member.lastPeers !== compactPeers) remember?.({
|
|
639
639
|
...(model ? {activeModel: model} : {}),
|
|
640
640
|
...(effort ? {activeEffort: effort} : {}),
|
|
641
|
+
...(member.lastPeers !== compactPeers ? {lastPeers: compactPeers} : {}),
|
|
641
642
|
});
|
|
642
643
|
const result = await completed;
|
|
643
644
|
if (result.status !== 'completed') throw turnError(result);
|
package/core.mjs
CHANGED
|
@@ -174,6 +174,7 @@ export function presentTeam(team,{activity={},actor,host=team.host??'codex'}={})
|
|
|
174
174
|
...(executionMode?{executionMode}:{}),
|
|
175
175
|
...(member.subagentName?{subagentName:member.subagentName}:{}),
|
|
176
176
|
session:member.threadId?{host,id:member.threadId}:null,waitFor:member.waitFor,pendingWaitFor:pendingWaitFor(team,member),
|
|
177
|
+
...(member.inbox?.length?{inboxCount:member.inbox.length}:{}),
|
|
177
178
|
worktree:member.worktree,workspace:member.workspace,channels:member.channels,lastTurn:member.lastTurn,
|
|
178
179
|
retireAfterTurn:member.retireAfterTurn,recoveryRequired:member.recoveryRequired===true,
|
|
179
180
|
...(member.fallbackModel?{fallbackModel:member.fallbackModel,...(member.fallbackEffort!==undefined?{fallbackEffort:member.fallbackEffort}:{})}:{}),
|
|
@@ -265,13 +266,14 @@ export function createSwarmApplication({dataDirectory,runner,host='codex',worksp
|
|
|
265
266
|
const result=await board.waitForBoard(id,args,context.signal);
|
|
266
267
|
return {...result,status:view(result.status,actor?.member)};
|
|
267
268
|
}
|
|
268
|
-
case 'post_message':return view(board.post(id,args.text,args.channel));
|
|
269
|
-
case 'post_to_board':if(!actor)throw Error('An active worker identity is required.');return board.postFrom(id,actor.member,args.text,args.channel);
|
|
269
|
+
case 'post_message':return view(board.post(id,args.text,args.channel,{wake:args.wake!==false}));
|
|
270
|
+
case 'post_to_board':if(!actor)throw Error('An active worker identity is required.');return board.postFrom(id,actor.member,args.text,args.channel,{wake:args.wake!==false});
|
|
270
271
|
case 'set_turn_outcome':
|
|
271
272
|
if(!actor||args.turn!==actor.turn)throw Error('The outcome must match the active worker turn.');
|
|
272
273
|
return board.declareOutcome(id,actor.member,args);
|
|
273
274
|
case 'pause_team':return view(board.pause(id));
|
|
274
275
|
case 'resume_team':return view(board.resume(id,args.extraTurns));
|
|
276
|
+
case 'cancel_turn':return view(await board.cancelTurn(id,args.member,{clearInbox:args.clearInbox===true}));
|
|
275
277
|
case 'resolve_recovery':return view(board.resolveRecovery(id,args.member,{action:args.action}));
|
|
276
278
|
case 'retire_member':return view(board.retireMember(id,args.member,{actor:actor?.member}));
|
|
277
279
|
case 'set_team_title':return view(board.setTeamTitle(id,args.title,actor?.member));
|
package/engine.mjs
CHANGED
|
@@ -490,7 +490,7 @@ export function stallIssues(team) {
|
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
for (const event of events.filter(event=>event.seq>boundary&&isMessage(event)&&!event.targets?.length&&
|
|
493
|
-
!event.broadcast&&!event.coordinatorMention).slice(-6).reverse()) {
|
|
493
|
+
!event.broadcast&&!event.coordinatorMention&&!event.silent).slice(-6).reverse()) {
|
|
494
494
|
issues.push({kind:'unaddressed',member:event.author,seq:event.seq,
|
|
495
495
|
text:'Unaddressed post #'+event.seq+' by @'+event.author+'. No member was @mentioned.'});
|
|
496
496
|
}
|
|
@@ -895,7 +895,7 @@ export class TeamBoard {
|
|
|
895
895
|
if (member.status === 'working') {
|
|
896
896
|
throw Error('@' + name + ' is currently running. Wait for the active turn to finish before resolving recovery.');
|
|
897
897
|
}
|
|
898
|
-
member.inbox = [...(member.inFlight ?? []), ...member.inbox].slice(-24);
|
|
898
|
+
if (action === 'retry') member.inbox = [...(member.inFlight ?? []), ...member.inbox].slice(-24);
|
|
899
899
|
delete member.recoveryRequired;
|
|
900
900
|
delete member.pendingRun;
|
|
901
901
|
delete member.inFlight;
|
|
@@ -903,10 +903,13 @@ export class TeamBoard {
|
|
|
903
903
|
delete member.declaredOutcome;
|
|
904
904
|
delete member.inputRequired;
|
|
905
905
|
delete team.monitorPhase;
|
|
906
|
-
member.status = action === 'retry' ? 'queued' : 'failed';
|
|
907
|
-
|
|
906
|
+
member.status = action === 'retry' ? 'queued' : (member.completed ?? 0) > 0 ? 'done' : 'failed';
|
|
907
|
+
const note = action === 'retry'
|
|
908
908
|
? 'Resolved unconfirmed outcome for @' + name + ' and queued a fresh retry.'
|
|
909
|
-
:
|
|
909
|
+
: member.status === 'done'
|
|
910
|
+
? 'Dismissed unconfirmed outcome for @' + name + ' and restored completed state.'
|
|
911
|
+
: 'Dismissed unconfirmed outcome for @' + name + '. Mention @' + name + ' when ready to continue.';
|
|
912
|
+
this.record(team, 'system', note, [name]);
|
|
910
913
|
this.save(team);
|
|
911
914
|
this.schedule(id);
|
|
912
915
|
return team;
|
|
@@ -1101,9 +1104,14 @@ export class TeamBoard {
|
|
|
1101
1104
|
return event;
|
|
1102
1105
|
}
|
|
1103
1106
|
|
|
1104
|
-
deliver(team, author, body, names = [], channel = 'main') {
|
|
1107
|
+
deliver(team, author, body, names = [], channel = 'main', {wake = true} = {}) {
|
|
1105
1108
|
const addresses=addressesIn(body,names);
|
|
1106
1109
|
if (addresses.has('#main')) throw Error('Use @all for everyone instead of @#main.');
|
|
1110
|
+
if (wake === false) {
|
|
1111
|
+
const event = this.record(team, author, body, [], 'message', channel);
|
|
1112
|
+
event.silent = true;
|
|
1113
|
+
return event;
|
|
1114
|
+
}
|
|
1107
1115
|
const addressedChannels=new Set(team.channels.filter(entry=>!entry.archived&&addresses.has('#'+entry.name))
|
|
1108
1116
|
.map(entry=>entry.name));
|
|
1109
1117
|
const targets = team.members.filter(member => activeMember(member) && member.name !== author &&
|
|
@@ -1111,7 +1119,11 @@ export class TeamBoard {
|
|
|
1111
1119
|
member.channels.some(name=>addressedChannels.has(name))));
|
|
1112
1120
|
const event = this.record(team, author, body, targets.map(member => member.name), 'message',channel);
|
|
1113
1121
|
if (addresses.has('all')) event.broadcast = true;
|
|
1114
|
-
|
|
1122
|
+
const hasCoordinatorMember = team.members.some(member => activeMember(member) && member.name === 'coordinator');
|
|
1123
|
+
const hasLeadMember = team.members.some(member => activeMember(member) && member.name === 'lead');
|
|
1124
|
+
if (addresses.has('coordinator') || (!hasLeadMember && !hasCoordinatorMember && addresses.has('lead'))) {
|
|
1125
|
+
event.coordinatorMention=true;
|
|
1126
|
+
}
|
|
1115
1127
|
for (const target of targets) {
|
|
1116
1128
|
const addressed = addresses.has(target.name);
|
|
1117
1129
|
enqueue(target, event, addressed);
|
|
@@ -1128,18 +1140,18 @@ export class TeamBoard {
|
|
|
1128
1140
|
member.status = 'queued';
|
|
1129
1141
|
}
|
|
1130
1142
|
|
|
1131
|
-
post(id, body, channel) {
|
|
1143
|
+
post(id, body, channel, opts) {
|
|
1132
1144
|
const team = this.get(id);
|
|
1133
|
-
this.deliver(team, 'user', text(body, 'Message', 6000),[],postingChannel(team,null,channel));
|
|
1145
|
+
this.deliver(team, 'user', text(body, 'Message', 6000),[],postingChannel(team,null,channel),opts);
|
|
1134
1146
|
this.save(team);
|
|
1135
1147
|
this.schedule(id);
|
|
1136
1148
|
return team;
|
|
1137
1149
|
}
|
|
1138
1150
|
|
|
1139
|
-
postFrom(id, author, body, channel) {
|
|
1151
|
+
postFrom(id, author, body, channel, opts) {
|
|
1140
1152
|
const team = this.get(id);
|
|
1141
1153
|
const member=this.peerMember(team,author);
|
|
1142
|
-
const event = this.deliver(team, author, text(body, 'Message', 6000),[],postingChannel(team,member,channel));
|
|
1154
|
+
const event = this.deliver(team, author, text(body, 'Message', 6000),[],postingChannel(team,member,channel),opts);
|
|
1143
1155
|
this.save(team);
|
|
1144
1156
|
this.schedule(id);
|
|
1145
1157
|
return event;
|
|
@@ -1267,11 +1279,11 @@ export class TeamBoard {
|
|
|
1267
1279
|
entry.status==='working' && entry.lastTurn===request.lastTurn)?.declaredOutcome;
|
|
1268
1280
|
const controller = new AbortController();
|
|
1269
1281
|
const key = id + ':' + member.name;
|
|
1270
|
-
const run = {turn: request.lastTurn, controller};
|
|
1282
|
+
const run = {turn: request.lastTurn, controller, explicitCancel: false, clearInbox: false};
|
|
1271
1283
|
this.runningTurns.set(key, run);
|
|
1272
1284
|
const cancelled = () => ({state:'failed',message:'Worker turn cancelled. Mention @' + member.name + ' only after checking the owned session.'});
|
|
1273
1285
|
run.finished = Promise.resolve().then(() => this.runTurn({team, member: request, remember, declaredOutcome, onActivity, signal:controller.signal})).then(
|
|
1274
|
-
result => this.settle(id, member.name, completions, controller.signal.aborted ? cancelled() : result, {turn:request.lastTurn}),
|
|
1286
|
+
result => this.settle(id, member.name, completions, controller.signal.aborted ? cancelled() : result, {turn:request.lastTurn, explicitCancel:run.explicitCancel, clearInbox:run.clearInbox}),
|
|
1275
1287
|
error => {
|
|
1276
1288
|
const message = String(error?.message ?? error).slice(0, 6000);
|
|
1277
1289
|
const quota = error?.blockedBy === 'quota' ||
|
|
@@ -1279,7 +1291,7 @@ export class TeamBoard {
|
|
|
1279
1291
|
const recoveryRequired = error?.recoveryRequired === true;
|
|
1280
1292
|
this.settle(id, member.name, completions, controller.signal.aborted
|
|
1281
1293
|
? cancelled()
|
|
1282
|
-
: {state: quota ? 'quota' : 'failed', message, ...(recoveryRequired ? {recoveryRequired: true} : {})}, {turn:request.lastTurn});
|
|
1294
|
+
: {state: quota ? 'quota' : 'failed', message, ...(recoveryRequired ? {recoveryRequired: true} : {})}, {turn:request.lastTurn, explicitCancel:run.explicitCancel, clearInbox:run.clearInbox});
|
|
1283
1295
|
},
|
|
1284
1296
|
).finally(() => {if (this.runningTurns.get(key) === run) this.runningTurns.delete(key);});
|
|
1285
1297
|
this.schedule(id);
|
|
@@ -1319,12 +1331,15 @@ export class TeamBoard {
|
|
|
1319
1331
|
this.save(team);
|
|
1320
1332
|
}
|
|
1321
1333
|
|
|
1322
|
-
cancelTurn(id, name) {
|
|
1334
|
+
async cancelTurn(id, name, {clearInbox = false} = {}) {
|
|
1323
1335
|
const member = this.liveMember(this.get(id),name);
|
|
1324
1336
|
const run = this.runningTurns.get(id + ':' + name);
|
|
1325
1337
|
if (member.status !== 'working' || !run || run.turn !== member.lastTurn) throw Error('This worker turn is not running.');
|
|
1338
|
+
run.explicitCancel = true;
|
|
1339
|
+
run.clearInbox = clearInbox === true;
|
|
1326
1340
|
run.controller.abort(Error('Worker turn cancelled.'));
|
|
1327
|
-
|
|
1341
|
+
await run.finished;
|
|
1342
|
+
return this.get(id);
|
|
1328
1343
|
}
|
|
1329
1344
|
|
|
1330
1345
|
async cancelRunning() {
|
|
@@ -1351,7 +1366,7 @@ export class TeamBoard {
|
|
|
1351
1366
|
return {settled:this.settle(id,name,member.inFlightCompletions,result,{turn,requestId,recovery:true})};
|
|
1352
1367
|
}
|
|
1353
1368
|
|
|
1354
|
-
settle(id, name, completions, result, {turn,requestId,recovery = false} = {}) {
|
|
1369
|
+
settle(id, name, completions, result, {turn,requestId,recovery = false,explicitCancel = false,clearInbox = false} = {}) {
|
|
1355
1370
|
if (this.closed) return false;
|
|
1356
1371
|
const team = this.get(id);
|
|
1357
1372
|
const member = team.members.find(m => m.name === name);
|
|
@@ -1359,7 +1374,7 @@ export class TeamBoard {
|
|
|
1359
1374
|
const preserveRecovery = (result?.state === 'failed' || result?.state === 'quota') && result?.recoveryRequired === true;
|
|
1360
1375
|
if (!member || (turn != null && member.lastTurn !== turn) ||
|
|
1361
1376
|
(expectedTurn != null && member.lastSettledTurn === expectedTurn) ||
|
|
1362
|
-
(member.recoveryRequired && !recovery && !preserveRecovery)) return false;
|
|
1377
|
+
(member.recoveryRequired && !recovery && !preserveRecovery && !explicitCancel)) return false;
|
|
1363
1378
|
const live=this.activity.get(id);
|
|
1364
1379
|
live?.delete(name);
|
|
1365
1380
|
if (!live?.size) this.activity.delete(id);
|
|
@@ -1387,7 +1402,10 @@ export class TeamBoard {
|
|
|
1387
1402
|
this.schedule(id);
|
|
1388
1403
|
return true;
|
|
1389
1404
|
}
|
|
1390
|
-
if (failed)
|
|
1405
|
+
if (failed) {
|
|
1406
|
+
if (clearInbox) member.inbox = [];
|
|
1407
|
+
else member.inbox = [...(member.inFlight ?? []), ...member.inbox].slice(-24);
|
|
1408
|
+
}
|
|
1391
1409
|
if (result.state === 'done') member.completed = (member.completed ?? 0) + 1;
|
|
1392
1410
|
delete member.inFlight;
|
|
1393
1411
|
delete member.declaredOutcome;
|
package/package.json
CHANGED
package/server.mjs
CHANGED
|
@@ -117,8 +117,8 @@ const tools = [
|
|
|
117
117
|
inputSchema: shape({...teamId, member:string, model:string, effort:{type:['string','null']}, resume:boolean}, ['teamId','member','model']),
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
|
-
name: 'post_message', title: 'Post a team message', description: 'Post a message on the board. Use @name, @group or @all to address the members who need the message.',
|
|
121
|
-
inputSchema: shape({...teamId, text:string,channel:string}, ['teamId', 'text']),
|
|
120
|
+
name: 'post_message', title: 'Post a team message', description: 'Post a message on the board. Use @name, @group or @all to address the members who need the message, or wake: false for FYI/acceptance notes without waking members.',
|
|
121
|
+
inputSchema: shape({...teamId, text:string,channel:string,wake:boolean}, ['teamId', 'text']),
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
name: 'pause_team', title: 'Pause a team', description: 'Pause dispatch of new turns. Members already working finish their current turn.',
|
|
@@ -128,6 +128,11 @@ const tools = [
|
|
|
128
128
|
name: 'resume_team', title: 'Resume a team', description: 'Resume queued turns. Increase the turn budget only when the user requests it.',
|
|
129
129
|
inputSchema: shape({...teamId, extraTurns: integer}, ['teamId']),
|
|
130
130
|
},
|
|
131
|
+
{
|
|
132
|
+
name:'cancel_turn',title:'Cancel an active worker turn',
|
|
133
|
+
description:'Cancel a worker currently running a turn. Set clearInbox to also discard stale queued messages so it does not auto-resume.',
|
|
134
|
+
inputSchema:shape({...teamId,member:string,clearInbox:boolean},['teamId','member']),
|
|
135
|
+
},
|
|
131
136
|
{
|
|
132
137
|
name: 'remove_worktree', title: 'Remove an owned worktree',
|
|
133
138
|
description: 'Remove a retired member’s checkout or one from a completed team when the user asks. Force discards uncommitted changes and requires an explicit user request.',
|
|
@@ -148,8 +153,8 @@ const peerTools = [
|
|
|
148
153
|
},
|
|
149
154
|
{
|
|
150
155
|
name: 'post_to_board', title: 'Message team members',
|
|
151
|
-
description: 'Post as yourself while your turn is active. Use @name or @group to wake members who can act on your message. Reserve @all for messages everyone needs to act on.',
|
|
152
|
-
inputSchema: shape({text:string,channel:string}, ['text']),
|
|
156
|
+
description: 'Post as yourself while your turn is active. Use @name or @group to wake members who can act on your message, or wake: false for non-waking notes. Reserve @all for messages everyone needs to act on.',
|
|
157
|
+
inputSchema: shape({text:string,channel:string,wake:boolean}, ['text']),
|
|
153
158
|
},
|
|
154
159
|
{
|
|
155
160
|
name: 'set_turn_outcome', title: 'Set outcome for this worker turn',
|
|
@@ -242,6 +247,7 @@ function present(team, origin, activity, actor) {
|
|
|
242
247
|
...(subagentName?{subagentName}:{}),
|
|
243
248
|
...(fallbackModel?{fallbackModel,...(fallbackEffort!==undefined?{fallbackEffort}:{})}:{}),
|
|
244
249
|
...(member.recoveryRequired?{recoveryRequired:true}:{}),
|
|
250
|
+
...(member.inbox?.length?{inboxCount:member.inbox.length}:{}),
|
|
245
251
|
pendingWaitFor:pendingWaitFor(team,member),
|
|
246
252
|
model:member.model ?? member.activeModel ?? model, effort:member.effort ?? member.activeEffort ?? configuredEffort(team, member)};
|
|
247
253
|
}),
|
|
@@ -350,7 +356,7 @@ export async function service({dataDirectory = root, listenPort = port, runner,
|
|
|
350
356
|
const isBoard = pathname.match(/^\/board\/([a-f0-9-]{36})$/);
|
|
351
357
|
const screenshot = pathname.match(/^\/board\/([a-f0-9-]{36})\/screenshot\/(\d+)\/(\d+)$/);
|
|
352
358
|
const transcript = pathname.match(/^\/board\/([a-f0-9-]{36})\/member\/([a-z][a-z0-9_-]{0,29})\/transcript$/);
|
|
353
|
-
const api = pathname.match(/^\/board\/([a-f0-9-]{36})\/(status|history|post|pause|resume|events|member-model|member-retire|worktree-remove|title|resolve-recovery)$/);
|
|
359
|
+
const api = pathname.match(/^\/board\/([a-f0-9-]{36})\/(status|history|post|pause|resume|cancel-turn|events|member-model|member-retire|worktree-remove|title|resolve-recovery)$/);
|
|
354
360
|
if ((isBoard || pathname === '/swarm') && req.method === 'GET') {
|
|
355
361
|
if (isBoard) board.get(isBoard[1]);
|
|
356
362
|
res.writeHead(200, {
|
|
@@ -425,8 +431,9 @@ export async function service({dataDirectory = root, listenPort = port, runner,
|
|
|
425
431
|
const type=req.headers['content-type']?.split(';',1)[0].trim().toLowerCase();
|
|
426
432
|
if (req.headers.origin!==origin||type!=='application/json') return send(res,403,{error:'Open this Swarm board to make changes.'});
|
|
427
433
|
const data = await readBody(req);
|
|
428
|
-
if (api[2] === 'post') return send(res,200,view(board.post(api[1],data.text,data.channel)));
|
|
434
|
+
if (api[2] === 'post') return send(res,200,view(board.post(api[1],data.text,data.channel,{wake:data.wake!==false})));
|
|
429
435
|
if (api[2] === 'pause') return send(res, 200, view(board.pause(api[1])));
|
|
436
|
+
if (api[2] === 'cancel-turn') return send(res, 200, view(await board.cancelTurn(api[1], data.member, {clearInbox: data.clearInbox === true})));
|
|
430
437
|
if (api[2] === 'resume') {
|
|
431
438
|
const {extraTurns} = data;
|
|
432
439
|
if (extraTurns !== undefined && (extraTurns !== 8 || teamPhase(board.get(api[1])) !== 'budget')) {
|
|
@@ -506,7 +513,7 @@ export async function service({dataDirectory = root, listenPort = port, runner,
|
|
|
506
513
|
}
|
|
507
514
|
if (name==='manage_channel') return send(res,200,board.manageChannel(args.teamId,args,actor));
|
|
508
515
|
if (actor && name === 'read_board') return send(res,200,board.readPosts(args.teamId,{...args,actor}));
|
|
509
|
-
if (actor && name === 'post_to_board') return send(res,200,board.postFrom(args.teamId,actor,args.text,args.channel));
|
|
516
|
+
if (actor && name === 'post_to_board') return send(res,200,board.postFrom(args.teamId,actor,args.text,args.channel,{wake:args.wake!==false}));
|
|
510
517
|
if (actor && name === 'set_turn_outcome') return send(res,200,board.declareOutcome(args.teamId,actor,args));
|
|
511
518
|
let team;
|
|
512
519
|
switch (name) {
|
|
@@ -568,7 +575,7 @@ export async function service({dataDirectory = root, listenPort = port, runner,
|
|
|
568
575
|
return send(res, 200, currentUpdate?.available ? {...payload, update:currentUpdate} : payload);
|
|
569
576
|
}
|
|
570
577
|
case 'board_status': team = board.get(args.teamId); break;
|
|
571
|
-
case 'post_message': team = board.post(args.teamId,args.text,args.channel); break;
|
|
578
|
+
case 'post_message': team = board.post(args.teamId,args.text,args.channel,{wake:args.wake!==false}); break;
|
|
572
579
|
case 'set_team_title': team = board.setTeamTitle(args.teamId,args.title,actor); break;
|
|
573
580
|
case 'set_team_plan': {
|
|
574
581
|
const plan=Array.isArray(args)?args:{
|
|
@@ -579,6 +586,7 @@ export async function service({dataDirectory = root, listenPort = port, runner,
|
|
|
579
586
|
team = board.setTeamPlan(args.teamId,plan,actor);
|
|
580
587
|
break;
|
|
581
588
|
}
|
|
589
|
+
case 'cancel_turn': team = await board.cancelTurn(args.teamId,args.member,{clearInbox:args.clearInbox===true}); break;
|
|
582
590
|
case 'resolve_recovery': team = board.resolveRecovery(args.teamId,args.member,{action:args.action}); break;
|
|
583
591
|
case 'pause_team': team = board.pause(args.teamId); break;
|
|
584
592
|
case 'resume_team': team = board.resume(args.teamId, args.extraTurns); break;
|
|
@@ -673,7 +681,7 @@ async function toolCall(payload, peer, cancellation) {
|
|
|
673
681
|
const authorization = peer ? 'Bearer ' + peer.token : await (startup ??= ensureService().finally(()=>{startup=null;}));
|
|
674
682
|
const timeout = payload.name === 'wait_for_board' ? (boardWaitTimeout(payload.arguments?.timeoutSec)+10)*1000
|
|
675
683
|
: payload.name === 'remove_worktree' ? 135000
|
|
676
|
-
: ['start_team','list_models','add_member','set_member_model'].includes(payload.name) ? 50000 : 10000;
|
|
684
|
+
: ['start_team','list_models','add_member','set_member_model','cancel_turn'].includes(payload.name) ? 50000 : 10000;
|
|
677
685
|
const deadline=AbortSignal.timeout(timeout);
|
|
678
686
|
const response = await fetch(origin + (peer ? '/peer' : '/tool'), {
|
|
679
687
|
method: 'POST', headers: {authorization, 'Content-Type': 'application/json'},
|
package/skills/swarm/SKILL.md
CHANGED
|
@@ -9,7 +9,7 @@ With no task, or with `board` or a request to show the board, use `open_swarm_pa
|
|
|
9
9
|
|
|
10
10
|
## Do not do the technical work
|
|
11
11
|
|
|
12
|
-
As coordinator, delegate technical work — code edits, research, investigations, builds, tests, and review fixes — to workers. Your job is to size and split the work, read and judge reports, unblock dependencies, and communicate verified results to the user. Quick read-only lookups to answer the user are fine; never sit inside long inline edits while the swarm waits.
|
|
12
|
+
As coordinator, delegate technical work — code edits, research, investigations, builds, tests, and review fixes — to workers. Your job is to size and split the work, read and judge reports, unblock dependencies, and communicate verified results to the user. Quick read-only lookups to answer the user are fine; never sit inside long inline edits while the swarm waits, and never edit worker-owned files while a worker is `working` or has queued `inboxCount > 0` (check `board_status` first, and cancel or wait before touching those files).
|
|
13
13
|
|
|
14
14
|
## Start the team
|
|
15
15
|
|
|
@@ -22,7 +22,7 @@ As coordinator, delegate technical work — code edits, research, investigations
|
|
|
22
22
|
|
|
23
23
|
## Coordinate on the board
|
|
24
24
|
|
|
25
|
-
- **`@name` is a wakeup doorbell, never a CC**: Write teammate names without `@` when merely referencing them in prose. Use `@name` (or `@group`, `@#channel`) only for members who must take a turn next. Brief builders and verifiers for direct peer-to-peer handoffs (`@builder` <-> `@verifier`), reserving `@coordinator` for final delivery, blockers, or scope changes. Reserve `@all` for genuine team-wide rules or interface decisions, never for status. A post with no recipient does not wake an idle member.
|
|
25
|
+
- **`@name` is a wakeup doorbell, never a CC**: Write teammate names without `@` when merely referencing them in prose. Use `@name` (or `@group`, `@#channel`) only for members who must take a turn next. Pass `wake: false` on `post_message` for thank-you, acceptance, or FYI notes so you never trigger a spurious extra turn. Address the parent chat as `@coordinator` (never invent `@lead` unless a worker is named `lead`). Brief builders and verifiers for direct peer-to-peer handoffs (`@builder` <-> `@verifier`), reserving `@coordinator` for final delivery, blockers, or scope changes. Reserve `@all` for genuine team-wide rules or interface decisions, never for status. A post with no recipient does not wake an idle member.
|
|
26
26
|
- **Cite `#seq` and finish with `[done]`**: Keep board posts concise (decisions, file paths/evidence, `#seq`, `@next`). Refer to earlier board posts by sequence number (`#4`, `#12`) instead of copy-pasting or summarizing one worker's report into another worker's message (`@verifier check #4 and #6`). Ask workers to start finished reports with `[done]`, avoid re-calling `read_board`/`list_models` when new messages are already delivered in the wake prompt, and never double-post their final report via `post_to_board` right before returning their turn-end report.
|
|
27
27
|
- **Visual timeline (`Screenshot: <path> | <caption>`)**: For UI/visual tasks, instruct UI authors or verifiers to include `Screenshot: <path> | <caption>` lines (workspace-relative or inside the workspace/data directory, `.png`/`.jpg`/`.jpeg`/`.webp`, `<= 10 MiB`, caption `1–140` chars) in their board post or report so Overview displays a safe visual timeline. Skip screenshots for pure backend, API, or documentation tasks.
|
|
28
28
|
- **Channels — keep `main` quiet**: For multi-area or larger swarms, split workstreams with `manage_channel` (`create`, `subscribe`, `unsubscribe`, `archive`). Everyone sees `main` plus their subscribed channels, so keep area chatter inside its channel (`channel`, `@#channel`) and reserve `main` for cross-area asks, decisions, and final results. Archive channels when an area finishes.
|
|
@@ -32,4 +32,4 @@ As coordinator, delegate technical work — code edits, research, investigations
|
|
|
32
32
|
|
|
33
33
|
- **Roster updates**: Look up the team first. Use `add_member` (including `taskLabel`) to invite a worker, `replaces` to transfer an idle worker's unfinished dependencies, and `fork: "coordinator"` or `fork: "<teammate>"` to inherit warm history. Update `set_team_plan` only if the scope or roster changes. Read-only workers can invite only read-only helpers. Use `retire_member` (member or shard group) once nothing depends on it; retirement is permanent — never retire as a pause, because idle waiting workers cost nothing. Use `set_team_title` for a requested rename.
|
|
34
34
|
- **Switch model on quota without killing history**: Never retire and re-add a worker that hits quota (`status: "quota"`). Use `set_member_model` (`effort: null` for the model default, `resume: true` to wake an idle member) so the worker keeps its saved conversation history (a history-preserving fork handles provider changes automatically). Verify configured and executed routes (`Verified route:` / active model) via `list_models` and member Journals.
|
|
35
|
-
- **
|
|
35
|
+
- **Pause, cancel, recovery, and worktree cleanup**: `pause_team` pauses new dispatch without cancelling a running worker; use `cancel_turn` (pass `clearInbox: true` to drop stale queued posts) if a running worker must stop immediately. If a member has an unconfirmed run (`recoveryRequired`), inspect its Journal first and resolve explicitly with `resolve_recovery` (`action: "retry"` or `"dismiss"`). Use `remove_worktree` when the user asks to clean a checkout after its member retires or the team finishes (`force: true` only on explicit user request to discard uncommitted changes). The user can add eight turns from the board when the team reaches its turn limit.
|