hive-swarm 2.1.0 → 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.css +88 -34
- package/board.html +29 -5
- package/board.js +291 -29
- package/codex.mjs +30 -9
- package/core.mjs +118 -2
- package/engine.mjs +37 -19
- package/hive-graph.js +23 -11
- package/package.json +1 -1
- package/server.mjs +33 -11
- package/skills/swarm/SKILL.md +4 -4
package/core.mjs
CHANGED
|
@@ -8,6 +8,120 @@ const reads=new Set(['list_teams','board_status','board_history','read_board','l
|
|
|
8
8
|
const workerActions=new Set(['board_status','board_history','read_board','list_models','post_to_board','set_turn_outcome','add_member','retire_member','set_member_model','manage_channel']);
|
|
9
9
|
const coordinatorActions=new Set(['set_team_title','set_team_plan']);
|
|
10
10
|
|
|
11
|
+
const SEMVER_RE=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
12
|
+
const CLEAN_TAG_RE=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
13
|
+
const RELEASE_TAG_BASE='https://github.com/snowmiku601-cpu/hive-swarm/releases/tag/v';
|
|
14
|
+
|
|
15
|
+
export function parseSemver(value) {
|
|
16
|
+
if(typeof value!=='string'||value.length>64)return null;
|
|
17
|
+
const match=SEMVER_RE.exec(value.trim());
|
|
18
|
+
if(!match)return null;
|
|
19
|
+
const major=Number(match[1]),minor=Number(match[2]),patch=Number(match[3]);
|
|
20
|
+
if(!Number.isSafeInteger(major)||!Number.isSafeInteger(minor)||!Number.isSafeInteger(patch))return null;
|
|
21
|
+
const pre=match[4]?match[4].split('.'):[];
|
|
22
|
+
if(pre.some(part=>part===''))return null;
|
|
23
|
+
return {major,minor,patch,pre};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function compareSemver(a,b) {
|
|
27
|
+
for(const key of ['major','minor','patch']) {
|
|
28
|
+
if(a[key]!==b[key])return a[key]>b[key]?1:-1;
|
|
29
|
+
}
|
|
30
|
+
if(!a.pre.length&&!b.pre.length)return 0;
|
|
31
|
+
if(!a.pre.length)return 1;
|
|
32
|
+
if(!b.pre.length)return -1;
|
|
33
|
+
const len=Math.max(a.pre.length,b.pre.length);
|
|
34
|
+
for(let i=0;i<len;i++) {
|
|
35
|
+
if(i>=a.pre.length)return -1;
|
|
36
|
+
if(i>=b.pre.length)return 1;
|
|
37
|
+
const left=a.pre[i],right=b.pre[i];
|
|
38
|
+
if(left===right)continue;
|
|
39
|
+
const leftNum=/^\d+$/.test(left),rightNum=/^\d+$/.test(right);
|
|
40
|
+
if(leftNum&&rightNum)return Number(left)>Number(right)?1:-1;
|
|
41
|
+
if(leftNum!==rightNum)return leftNum?-1:1;
|
|
42
|
+
return left>right?1:-1;
|
|
43
|
+
}
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function isNewerVersion(current,candidate) {
|
|
48
|
+
const a=parseSemver(current),b=parseSemver(candidate);
|
|
49
|
+
if(!a||!b)return false;
|
|
50
|
+
return compareSemver(b,a)>0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function createUpdateChecker({
|
|
54
|
+
packageName,currentVersion,tags=['latest'],fetchImpl=globalThis.fetch,
|
|
55
|
+
ttlMs=6*60*60*1000,errorTtlMs=30*60*1000,timeoutMs=3500,enabled,now=Date.now,
|
|
56
|
+
}={}) {
|
|
57
|
+
const disabledByEnv=process.env.HIVE_SWARM_DISABLE_UPDATE_CHECK==='1'||process.env.HIVE_SWARM_DISABLE_UPDATE_CHECK==='true';
|
|
58
|
+
const inTestRunner=Boolean(process.env.NODE_TEST_CONTEXT)||process.argv.includes('--test');
|
|
59
|
+
const isEnabled=enabled??(!disabledByEnv&&!inTestRunner);
|
|
60
|
+
const current=typeof currentVersion==='string'&&parseSemver(currentVersion)?currentVersion.trim():'0.0.0';
|
|
61
|
+
let latest=null,checked=!isEnabled||typeof fetchImpl!=='function',expiresAt=0,inflight=null,activeController=null,disposed=false;
|
|
62
|
+
|
|
63
|
+
const result=()=> {
|
|
64
|
+
const available=Boolean(latest&&isNewerVersion(current,latest));
|
|
65
|
+
return {current,latest,available,url:available?RELEASE_TAG_BASE+latest:null,checked};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
async function check() {
|
|
69
|
+
if(disposed||!isEnabled||typeof fetchImpl!=='function') {checked=true;return result();}
|
|
70
|
+
if(now()<expiresAt&&checked)return result();
|
|
71
|
+
if(inflight)return inflight;
|
|
72
|
+
const controller=new AbortController();
|
|
73
|
+
activeController=controller;
|
|
74
|
+
const timer=setTimeout(()=>controller.abort(Error('Update check timed out.')),timeoutMs);
|
|
75
|
+
timer.unref?.();
|
|
76
|
+
inflight=(async()=>{
|
|
77
|
+
try {
|
|
78
|
+
const endpoint=`https://registry.npmjs.org/-/package/${encodeURIComponent(packageName)}/dist-tags`;
|
|
79
|
+
const response=await fetchImpl(endpoint,{
|
|
80
|
+
headers:{accept:'application/json','user-agent':`${packageName}/${current}`},
|
|
81
|
+
signal:controller.signal,
|
|
82
|
+
});
|
|
83
|
+
if(!response?.ok)throw Error(`HTTP ${response?.status??0}`);
|
|
84
|
+
const data=await response.json();
|
|
85
|
+
let best=null;
|
|
86
|
+
if(data&&typeof data==='object'&&!Array.isArray(data)) {
|
|
87
|
+
for(const tag of tags) {
|
|
88
|
+
const candidate=typeof data[tag]==='string'?data[tag].trim():'';
|
|
89
|
+
if(!candidate||candidate.length>40||!CLEAN_TAG_RE.test(candidate)||!parseSemver(candidate))continue;
|
|
90
|
+
if(!best||isNewerVersion(best,candidate))best=candidate;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
latest=best;
|
|
94
|
+
checked=true;
|
|
95
|
+
expiresAt=now()+ttlMs;
|
|
96
|
+
} catch {
|
|
97
|
+
checked=true;
|
|
98
|
+
expiresAt=now()+errorTtlMs;
|
|
99
|
+
} finally {
|
|
100
|
+
clearTimeout(timer);
|
|
101
|
+
if(activeController===controller)activeController=null;
|
|
102
|
+
inflight=null;
|
|
103
|
+
}
|
|
104
|
+
return result();
|
|
105
|
+
})();
|
|
106
|
+
return inflight;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function peek({start=false}={}) {
|
|
110
|
+
if(start&&!disposed&&isEnabled&&typeof fetchImpl==='function'&&(!checked||now()>=expiresAt)&&!inflight) {
|
|
111
|
+
void check();
|
|
112
|
+
}
|
|
113
|
+
return result();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function dispose() {
|
|
117
|
+
disposed=true;
|
|
118
|
+
try{activeController?.abort(Error('Update checker disposed.'));}catch{}
|
|
119
|
+
activeController=null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return {peek,check,dispose};
|
|
123
|
+
}
|
|
124
|
+
|
|
11
125
|
function signature(value) {
|
|
12
126
|
if(value===null||typeof value==='string'||typeof value==='boolean')return JSON.stringify(value);
|
|
13
127
|
if(typeof value==='number'&&Number.isFinite(value))return JSON.stringify(value);
|
|
@@ -60,6 +174,7 @@ export function presentTeam(team,{activity={},actor,host=team.host??'codex'}={})
|
|
|
60
174
|
...(executionMode?{executionMode}:{}),
|
|
61
175
|
...(member.subagentName?{subagentName:member.subagentName}:{}),
|
|
62
176
|
session:member.threadId?{host,id:member.threadId}:null,waitFor:member.waitFor,pendingWaitFor:pendingWaitFor(team,member),
|
|
177
|
+
...(member.inbox?.length?{inboxCount:member.inbox.length}:{}),
|
|
63
178
|
worktree:member.worktree,workspace:member.workspace,channels:member.channels,lastTurn:member.lastTurn,
|
|
64
179
|
retireAfterTurn:member.retireAfterTurn,recoveryRequired:member.recoveryRequired===true,
|
|
65
180
|
...(member.fallbackModel?{fallbackModel:member.fallbackModel,...(member.fallbackEffort!==undefined?{fallbackEffort:member.fallbackEffort}:{})}:{}),
|
|
@@ -151,13 +266,14 @@ export function createSwarmApplication({dataDirectory,runner,host='codex',worksp
|
|
|
151
266
|
const result=await board.waitForBoard(id,args,context.signal);
|
|
152
267
|
return {...result,status:view(result.status,actor?.member)};
|
|
153
268
|
}
|
|
154
|
-
case 'post_message':return view(board.post(id,args.text,args.channel));
|
|
155
|
-
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});
|
|
156
271
|
case 'set_turn_outcome':
|
|
157
272
|
if(!actor||args.turn!==actor.turn)throw Error('The outcome must match the active worker turn.');
|
|
158
273
|
return board.declareOutcome(id,actor.member,args);
|
|
159
274
|
case 'pause_team':return view(board.pause(id));
|
|
160
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}));
|
|
161
277
|
case 'resolve_recovery':return view(board.resolveRecovery(id,args.member,{action:args.action}));
|
|
162
278
|
case 'retire_member':return view(board.retireMember(id,args.member,{actor:actor?.member}));
|
|
163
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/hive-graph.js
CHANGED
|
@@ -118,7 +118,16 @@
|
|
|
118
118
|
return result[0].toUpperCase() + result.slice(1);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
function shouldMergeUserToCoordinator(members) {
|
|
122
|
+
const list = members ?? [];
|
|
123
|
+
const hasDedicatedCoordinator = list.some(m => (m.role === 'coordinator' || m.name === 'coordinator') && !m.external);
|
|
124
|
+
const hasExplicitUserMember = list.some(m => m.name === 'user');
|
|
125
|
+
return !hasDedicatedCoordinator && !hasExplicitUserMember;
|
|
126
|
+
}
|
|
127
|
+
|
|
121
128
|
function project(posts, members, cursor, { hideInactive = false, expandBroadcast = false } = {}) {
|
|
129
|
+
const mergeUser = shouldMergeUserToCoordinator(members);
|
|
130
|
+
const resolveActor = name => (mergeUser && name === 'user') ? 'coordinator' : name;
|
|
122
131
|
const names = new Map([['coordinator', { name: 'coordinator', role: 'coordinator', status: 'waiting' }]]);
|
|
123
132
|
for (const member of members) names.set(member.name, member);
|
|
124
133
|
const seen = new Set();
|
|
@@ -131,8 +140,8 @@
|
|
|
131
140
|
}
|
|
132
141
|
for (const event of posts) {
|
|
133
142
|
if (event.seq > cursor || !isPost(event)) continue;
|
|
134
|
-
const
|
|
135
|
-
const targets = [...new Set([...(event.targets ?? []), ...(event.coordinatorMention ? ['coordinator'] : [])])];
|
|
143
|
+
const author = resolveActor(event.author);
|
|
144
|
+
const targets = [...new Set([...(event.targets ?? []).map(resolveActor), ...(event.coordinatorMention ? ['coordinator'] : [])])];
|
|
136
145
|
addName(author);
|
|
137
146
|
const outgoing = counts.get(author) ?? { posts: 0, mentions: 0, broadcasts: 0, unmentioned: 0, lastSeq: 0 };
|
|
138
147
|
outgoing.posts++;
|
|
@@ -143,7 +152,7 @@
|
|
|
143
152
|
outgoing.broadcasts++;
|
|
144
153
|
broadcasts++;
|
|
145
154
|
}
|
|
146
|
-
if (!all && !
|
|
155
|
+
if (!all && !targets.some(to => to !== author)) outgoing.unmentioned++;
|
|
147
156
|
for (const to of new Set(targets)) {
|
|
148
157
|
if (to === author) continue;
|
|
149
158
|
addName(to);
|
|
@@ -630,6 +639,8 @@
|
|
|
630
639
|
}
|
|
631
640
|
|
|
632
641
|
function projectHive(posts, members, cursor) {
|
|
642
|
+
const mergeUser = shouldMergeUserToCoordinator(members);
|
|
643
|
+
const resolveActor = name => (mergeUser && name === 'user') ? 'coordinator' : name;
|
|
633
644
|
const effectiveCursor = (cursor === null || cursor === undefined) ? Infinity : Number(cursor);
|
|
634
645
|
const validPosts = (posts ?? []).filter(event => isPost(event) && Number.isFinite(event.seq))
|
|
635
646
|
.slice().sort((a, b) => a.seq - b.seq);
|
|
@@ -643,9 +654,10 @@
|
|
|
643
654
|
const briefSeqByMember = new Map();
|
|
644
655
|
const mentionSeqByMember = new Map();
|
|
645
656
|
for (const event of activePosts) {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
657
|
+
const author = resolveActor(event.author);
|
|
658
|
+
lastSeqByAuthor.set(author, event.seq);
|
|
659
|
+
lastPostByAuthor.set(author, event);
|
|
660
|
+
const targets = new Set([...(event.targets ?? []).map(resolveActor), ...(event.coordinatorMention ? ['coordinator'] : [])]);
|
|
649
661
|
for (const target of targets) {
|
|
650
662
|
if (event.kind === 'brief') briefSeqByMember.set(target, event.seq);
|
|
651
663
|
mentionSeqByMember.set(target, event.seq);
|
|
@@ -682,7 +694,7 @@
|
|
|
682
694
|
const mentionSeq = mentionSeqByMember.get(worker.name) ?? 0;
|
|
683
695
|
if (effectiveCursor <= 0) status = 'waiting';
|
|
684
696
|
else if (lastP && /\[done\]/i.test(String(lastP.text ?? ''))) status = 'done';
|
|
685
|
-
else if (lastPost?.author === worker.name) status = 'working';
|
|
697
|
+
else if (resolveActor(lastPost?.author) === worker.name) status = 'working';
|
|
686
698
|
else if (Math.max(briefSeq, mentionSeq) > (lastP?.seq ?? 0)) status = 'working';
|
|
687
699
|
else status = 'waiting';
|
|
688
700
|
}
|
|
@@ -723,7 +735,7 @@
|
|
|
723
735
|
|
|
724
736
|
const coordinator = {
|
|
725
737
|
name: 'coordinator',
|
|
726
|
-
status: atHead ? (coordSource.status ?? phase) : (lastPost?.author === 'coordinator' ? 'working' : phase),
|
|
738
|
+
status: atHead ? (coordSource.status ?? phase) : (resolveActor(lastPost?.author) === 'coordinator' ? 'working' : phase),
|
|
727
739
|
role: 'coordinator',
|
|
728
740
|
doneCount,
|
|
729
741
|
totalWorkers,
|
|
@@ -746,11 +758,11 @@
|
|
|
746
758
|
}
|
|
747
759
|
|
|
748
760
|
if (lastPost && (effectiveCursor === Infinity || lastPost.seq === effectiveCursor || !atHead)) {
|
|
749
|
-
const fromCell = clusterByMember.get(lastPost.author);
|
|
761
|
+
const fromCell = clusterByMember.get(resolveActor(lastPost.author));
|
|
750
762
|
if (fromCell) {
|
|
751
763
|
const allFlag = lastPost.broadcast ?? /(?:^|[^a-z0-9_])@all(?![a-z0-9_-])/i.test(lastPost.text ?? '');
|
|
752
764
|
const rawTargets = [
|
|
753
|
-
...(lastPost.targets ?? []),
|
|
765
|
+
...(lastPost.targets ?? []).map(resolveActor),
|
|
754
766
|
...(lastPost.coordinatorMention ? ['coordinator'] : []),
|
|
755
767
|
];
|
|
756
768
|
if (allFlag) {
|
|
@@ -1584,7 +1596,7 @@
|
|
|
1584
1596
|
}
|
|
1585
1597
|
|
|
1586
1598
|
globalThis.HiveGraph = Object.freeze({
|
|
1587
|
-
isPost, project, elapsedSpan, unmentionedNode, minimumHeight, layout,
|
|
1599
|
+
isPost, shouldMergeUserToCoordinator, project, elapsedSpan, unmentionedNode, minimumHeight, layout,
|
|
1588
1600
|
nodeBox, roundedRectSignedDistance, clipEdge, routeEdges, draw,
|
|
1589
1601
|
smartTaskLabel, mentionsMinimumHeight, layoutMentions,
|
|
1590
1602
|
projectHive, hiveMinimumHeight, layoutHive, renderGraphFrame,
|
package/package.json
CHANGED
package/server.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { join } from 'node:path';
|
|
|
7
7
|
import { createInterface } from 'node:readline';
|
|
8
8
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { createUpdateChecker } from './core.mjs';
|
|
10
11
|
import { TeamBoard, boardWaitTimeout, childEnvironment, configuredEffort, pendingWaitFor, readSafeScreenshot, stallIssues, teamPhase, visibleChannels } from './engine.mjs';
|
|
11
12
|
import { openWorktree, removeWorktree, worktreeSource } from './worktrees.mjs';
|
|
12
13
|
|
|
@@ -116,8 +117,8 @@ const tools = [
|
|
|
116
117
|
inputSchema: shape({...teamId, member:string, model:string, effort:{type:['string','null']}, resume:boolean}, ['teamId','member','model']),
|
|
117
118
|
},
|
|
118
119
|
{
|
|
119
|
-
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.',
|
|
120
|
-
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']),
|
|
121
122
|
},
|
|
122
123
|
{
|
|
123
124
|
name: 'pause_team', title: 'Pause a team', description: 'Pause dispatch of new turns. Members already working finish their current turn.',
|
|
@@ -127,6 +128,11 @@ const tools = [
|
|
|
127
128
|
name: 'resume_team', title: 'Resume a team', description: 'Resume queued turns. Increase the turn budget only when the user requests it.',
|
|
128
129
|
inputSchema: shape({...teamId, extraTurns: integer}, ['teamId']),
|
|
129
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
|
+
},
|
|
130
136
|
{
|
|
131
137
|
name: 'remove_worktree', title: 'Remove an owned worktree',
|
|
132
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.',
|
|
@@ -147,8 +153,8 @@ const peerTools = [
|
|
|
147
153
|
},
|
|
148
154
|
{
|
|
149
155
|
name: 'post_to_board', title: 'Message team members',
|
|
150
|
-
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.',
|
|
151
|
-
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']),
|
|
152
158
|
},
|
|
153
159
|
{
|
|
154
160
|
name: 'set_turn_outcome', title: 'Set outcome for this worker turn',
|
|
@@ -241,6 +247,7 @@ function present(team, origin, activity, actor) {
|
|
|
241
247
|
...(subagentName?{subagentName}:{}),
|
|
242
248
|
...(fallbackModel?{fallbackModel,...(fallbackEffort!==undefined?{fallbackEffort}:{})}:{}),
|
|
243
249
|
...(member.recoveryRequired?{recoveryRequired:true}:{}),
|
|
250
|
+
...(member.inbox?.length?{inboxCount:member.inbox.length}:{}),
|
|
244
251
|
pendingWaitFor:pendingWaitFor(team,member),
|
|
245
252
|
model:member.model ?? member.activeModel ?? model, effort:member.effort ?? member.activeEffort ?? configuredEffort(team, member)};
|
|
246
253
|
}),
|
|
@@ -317,12 +324,14 @@ async function readBody(req) {
|
|
|
317
324
|
return JSON.parse(Buffer.concat(chunks).toString('utf8') || '{}');
|
|
318
325
|
}
|
|
319
326
|
|
|
320
|
-
export async function service({dataDirectory = root, listenPort = port, runner} = {}) {
|
|
327
|
+
export async function service({dataDirectory = root, listenPort = port, runner, updateChecker} = {}) {
|
|
321
328
|
const key = Buffer.from('Bearer ' + localKey(dataDirectory));
|
|
322
329
|
const peerSecret = randomBytes(32);
|
|
323
330
|
const tokenFor = (id, name) => createHmac('sha256',peerSecret).update(JSON.stringify([id,name])).digest('hex');
|
|
324
331
|
const {CodexRunner} = await import('./codex.mjs');
|
|
325
332
|
runner ??= new CodexRunner();
|
|
333
|
+
const updates = updateChecker ?? createUpdateChecker({packageName:'hive-swarm',currentVersion:version,tags:['latest']});
|
|
334
|
+
updates.peek?.({start:true});
|
|
326
335
|
let board;
|
|
327
336
|
let origin, host;
|
|
328
337
|
async function changeModel(args,actor,res) {
|
|
@@ -347,7 +356,7 @@ export async function service({dataDirectory = root, listenPort = port, runner}
|
|
|
347
356
|
const isBoard = pathname.match(/^\/board\/([a-f0-9-]{36})$/);
|
|
348
357
|
const screenshot = pathname.match(/^\/board\/([a-f0-9-]{36})\/screenshot\/(\d+)\/(\d+)$/);
|
|
349
358
|
const transcript = pathname.match(/^\/board\/([a-f0-9-]{36})\/member\/([a-z][a-z0-9_-]{0,29})\/transcript$/);
|
|
350
|
-
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)$/);
|
|
351
360
|
if ((isBoard || pathname === '/swarm') && req.method === 'GET') {
|
|
352
361
|
if (isBoard) board.get(isBoard[1]);
|
|
353
362
|
res.writeHead(200, {
|
|
@@ -376,6 +385,12 @@ export async function service({dataDirectory = root, listenPort = port, runner}
|
|
|
376
385
|
if (req.headers['sec-fetch-site'] !== 'same-origin') return send(res, 403, {error:'Open Swarm to list its teams.'});
|
|
377
386
|
return send(res,200,recentTeams(board));
|
|
378
387
|
}
|
|
388
|
+
if (pathname === '/swarm/update' && req.method === 'GET') {
|
|
389
|
+
if (req.headers['sec-fetch-site'] !== 'same-origin') return send(res, 403, {error:'Open Swarm to check for updates.'});
|
|
390
|
+
const status = await updates.check();
|
|
391
|
+
if (!res.destroyed) return send(res, 200, status);
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
379
394
|
if (pathname==='/swarm/models'&&req.method==='GET') {
|
|
380
395
|
if (req.headers['sec-fetch-site']!=='same-origin') return send(res,403,{error:'Open Swarm to read available models.'});
|
|
381
396
|
return send(res,200,{models:modelOptions(await runner.listModels())});
|
|
@@ -416,8 +431,9 @@ export async function service({dataDirectory = root, listenPort = port, runner}
|
|
|
416
431
|
const type=req.headers['content-type']?.split(';',1)[0].trim().toLowerCase();
|
|
417
432
|
if (req.headers.origin!==origin||type!=='application/json') return send(res,403,{error:'Open this Swarm board to make changes.'});
|
|
418
433
|
const data = await readBody(req);
|
|
419
|
-
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})));
|
|
420
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})));
|
|
421
437
|
if (api[2] === 'resume') {
|
|
422
438
|
const {extraTurns} = data;
|
|
423
439
|
if (extraTurns !== undefined && (extraTurns !== 8 || teamPhase(board.get(api[1])) !== 'budget')) {
|
|
@@ -497,7 +513,7 @@ export async function service({dataDirectory = root, listenPort = port, runner}
|
|
|
497
513
|
}
|
|
498
514
|
if (name==='manage_channel') return send(res,200,board.manageChannel(args.teamId,args,actor));
|
|
499
515
|
if (actor && name === 'read_board') return send(res,200,board.readPosts(args.teamId,{...args,actor}));
|
|
500
|
-
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}));
|
|
501
517
|
if (actor && name === 'set_turn_outcome') return send(res,200,board.declareOutcome(args.teamId,actor,args));
|
|
502
518
|
let team;
|
|
503
519
|
switch (name) {
|
|
@@ -553,9 +569,13 @@ export async function service({dataDirectory = root, listenPort = port, runner}
|
|
|
553
569
|
team=await removeCheckout(args.teamId,args.member,args.force);
|
|
554
570
|
break;
|
|
555
571
|
}
|
|
556
|
-
case 'open_board':
|
|
572
|
+
case 'open_board': {
|
|
573
|
+
const currentUpdate = updates.peek?.({start:true});
|
|
574
|
+
const payload = view(board.get(args.teamId),actor);
|
|
575
|
+
return send(res, 200, currentUpdate?.available ? {...payload, update:currentUpdate} : payload);
|
|
576
|
+
}
|
|
557
577
|
case 'board_status': team = board.get(args.teamId); break;
|
|
558
|
-
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;
|
|
559
579
|
case 'set_team_title': team = board.setTeamTitle(args.teamId,args.title,actor); break;
|
|
560
580
|
case 'set_team_plan': {
|
|
561
581
|
const plan=Array.isArray(args)?args:{
|
|
@@ -566,6 +586,7 @@ export async function service({dataDirectory = root, listenPort = port, runner}
|
|
|
566
586
|
team = board.setTeamPlan(args.teamId,plan,actor);
|
|
567
587
|
break;
|
|
568
588
|
}
|
|
589
|
+
case 'cancel_turn': team = await board.cancelTurn(args.teamId,args.member,{clearInbox:args.clearInbox===true}); break;
|
|
569
590
|
case 'resolve_recovery': team = board.resolveRecovery(args.teamId,args.member,{action:args.action}); break;
|
|
570
591
|
case 'pause_team': team = board.pause(args.teamId); break;
|
|
571
592
|
case 'resume_team': team = board.resume(args.teamId, args.extraTurns); break;
|
|
@@ -603,6 +624,7 @@ export async function service({dataDirectory = root, listenPort = port, runner}
|
|
|
603
624
|
server.close(resolve);
|
|
604
625
|
server.closeAllConnections();
|
|
605
626
|
runner.close();
|
|
627
|
+
updates.dispose?.();
|
|
606
628
|
board.close();
|
|
607
629
|
});
|
|
608
630
|
}
|
|
@@ -659,7 +681,7 @@ async function toolCall(payload, peer, cancellation) {
|
|
|
659
681
|
const authorization = peer ? 'Bearer ' + peer.token : await (startup ??= ensureService().finally(()=>{startup=null;}));
|
|
660
682
|
const timeout = payload.name === 'wait_for_board' ? (boardWaitTimeout(payload.arguments?.timeoutSec)+10)*1000
|
|
661
683
|
: payload.name === 'remove_worktree' ? 135000
|
|
662
|
-
: ['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;
|
|
663
685
|
const deadline=AbortSignal.timeout(timeout);
|
|
664
686
|
const response = await fetch(origin + (peer ? '/peer' : '/tool'), {
|
|
665
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,8 +22,8 @@ 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.
|
|
26
|
-
- **Cite `#seq` and finish with `[done]`**: 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]` and never double-post their final report via `post_to_board` right before returning their turn-end report.
|
|
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
|
+
- **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.
|
|
29
29
|
- **Wait without polling**: In a Goal, call `wait_for_board` with the last seen `since` cursor rather than polling `board_status` or `board_history` in a loop. If `hasMore` is true, continue from the last returned post. Act on stopped or stalled phases before issuing the next wait: read `[stall]` and structured `attention` issues (unaddressed `#seq`, unanswered mention, dependency root blocker) from saved facts without starting a diagnostic model turn. Use `board_history` with a cursor to read earlier posts.
|
|
@@ -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.
|