dsh-hive-runner 1.0.20 → 1.0.21
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/CHANGELOG.md +24 -0
- package/SPEC.md +4 -1
- package/docs/DESIGN.md +5 -1
- package/index.js +2 -0
- package/lib/limits.js +17 -0
- package/lib/supervisor.js +58 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,26 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
Version 0.6.0 is the first public snapshot; 0.1.0-0.5.0 were local development
|
|
8
8
|
iterations of the plugin before this repository was published.
|
|
9
9
|
|
|
10
|
+
## [1.0.21] - 2026-12-05
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Concurrency limits are discoverable for roles that only appear on the board: each
|
|
15
|
+
repo status now exposes `taskRoles` and every `roles[role]` carries `source` =
|
|
16
|
+
`limits.json` | `config` | `default`. An undefined role such as `worker` can set its
|
|
17
|
+
cap in `.hive/limits.json` (e.g. `{"worker": 20}`) and the panel can see both the
|
|
18
|
+
effective limit and its source; without a file entry it falls back to
|
|
19
|
+
`defaultRoleConcurrency` with `source: "default"`.
|
|
20
|
+
- Creating a card (`hive_tasks add`, and intervention-created cards) calls
|
|
21
|
+
`hiveSupervisor.wake(repo)`, so an idle repository with 120 s backoff is re-checked
|
|
22
|
+
immediately instead of waiting for the next idle window; `wakeRequested` is honored
|
|
23
|
+
when a drain finishes.
|
|
24
|
+
|
|
25
|
+
### Tests
|
|
26
|
+
|
|
27
|
+
- limits file role source, board-only task role in status, `worker=20` live up to 20,
|
|
28
|
+
default fallback/source, and wake-on-new-card dispatch; 288 tests pass.
|
|
29
|
+
|
|
10
30
|
## [1.0.20] - 2026-12-05
|
|
11
31
|
|
|
12
32
|
### Fixed
|
|
@@ -27,6 +47,10 @@ iterations of the plugin before this repository was published.
|
|
|
27
47
|
attribution `worker:coder`, supervisor-created service card and service event
|
|
28
48
|
`actor: supervisor`; 281 tests pass.
|
|
29
49
|
|
|
50
|
+
### Published
|
|
51
|
+
|
|
52
|
+
- npm: `dsh-hive-runner@1.0.20` on 2026-12-05.
|
|
53
|
+
|
|
30
54
|
## [1.0.19] - 2026-12-05
|
|
31
55
|
|
|
32
56
|
### Fixed
|
package/SPEC.md
CHANGED
|
@@ -124,7 +124,10 @@ wrong method -> `405` (`hive/method-not-allowed`).
|
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
- `roles[role].limit` — effective live-agent cap (persisted file > repo config >
|
|
127
|
-
global role config > `defaultRoleConcurrency`).
|
|
127
|
+
global role config > `defaultRoleConcurrency`), with `roles[role].source` =
|
|
128
|
+
`limits.json` | `config` | `default`.
|
|
129
|
+
- `taskRoles` — roles actually present on the board, including roles absent from
|
|
130
|
+
`roles.yaml`/config; they appear in `roles` with their effective limit and source.
|
|
128
131
|
- `roles[role].live` — agents running right now; a finished agent frees its slot
|
|
129
132
|
immediately.
|
|
130
133
|
- `roles[role].queued` — fetched tasks waiting for a slot; they do not count as live.
|
package/docs/DESIGN.md
CHANGED
|
@@ -113,7 +113,11 @@ Response:
|
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
- `roles[role].limit` — effective live-agent cap (persisted file > config >
|
|
116
|
-
`defaultRoleConcurrency`).
|
|
116
|
+
`defaultRoleConcurrency`), with `roles[role].source` = `limits.json` | `config` |
|
|
117
|
+
`default`.
|
|
118
|
+
- `taskRoles` — roles present on the board even when `roles.yaml`/config omit them;
|
|
119
|
+
they are merged into `roles` with their limit/source so the panel can discover and set
|
|
120
|
+
them.
|
|
117
121
|
- `roles[role].live` — task agents running **now**; a completed agent frees
|
|
118
122
|
its slot immediately.
|
|
119
123
|
- `roles[role].queued` — fetched tasks waiting for a slot (they do not count
|
package/index.js
CHANGED
|
@@ -655,6 +655,7 @@ export function apply(ctx, config = {}) {
|
|
|
655
655
|
reviewOf: args.reviewOf,
|
|
656
656
|
draft: args.draft,
|
|
657
657
|
}, options);
|
|
658
|
+
supervisor.wake(repo);
|
|
658
659
|
return jsonText({ ok: true, card });
|
|
659
660
|
}
|
|
660
661
|
if (action === 'edit') {
|
|
@@ -1171,6 +1172,7 @@ export function apply(ctx, config = {}) {
|
|
|
1171
1172
|
sessionId: args.sessionId,
|
|
1172
1173
|
actor,
|
|
1173
1174
|
});
|
|
1175
|
+
if (newCards.length > 0) supervisor.wake(repo);
|
|
1174
1176
|
const events = readEvents(repo, { limit: 500 });
|
|
1175
1177
|
const count = interventionCounts(events).get(cardId) ?? 1;
|
|
1176
1178
|
let escalated = false;
|
package/lib/limits.js
CHANGED
|
@@ -127,6 +127,23 @@ export class RepoLimits {
|
|
|
127
127
|
return this.refresh(repo).limits;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Where the effective limit came from: persisted limits.json, config, or default.
|
|
132
|
+
* @param {string} repo
|
|
133
|
+
* @param {string} role
|
|
134
|
+
* @returns {'limits.json' | 'config' | 'default'}
|
|
135
|
+
*/
|
|
136
|
+
sourceFor(repo, role) {
|
|
137
|
+
const entry = this.#entry(repo);
|
|
138
|
+
if (!entry.loaded) this.refresh(repo);
|
|
139
|
+
const current = this.#entry(repo);
|
|
140
|
+
if (Object.hasOwn(current.limits, role)) return 'limits.json';
|
|
141
|
+
const overrides = this.config.repoRoleConcurrency?.[repo];
|
|
142
|
+
if (overrides !== undefined && Object.hasOwn(overrides, role)) return 'config';
|
|
143
|
+
if (Object.hasOwn(this.config.roleConcurrency ?? {}, role)) return 'config';
|
|
144
|
+
return 'default';
|
|
145
|
+
}
|
|
146
|
+
|
|
130
147
|
/** Current reload error, if any. */
|
|
131
148
|
errorFor(repo) {
|
|
132
149
|
return this.#entry(repo).error;
|
package/lib/supervisor.js
CHANGED
|
@@ -233,6 +233,15 @@ export class HiveSupervisor {
|
|
|
233
233
|
entry.backlog = emptyBacklog();
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
/** Remember roles present in board/ready snapshots for status discovery. */
|
|
237
|
+
#rememberTaskRoles(entry, tasks) {
|
|
238
|
+
if (!(entry.taskRoles instanceof Set)) entry.taskRoles = new Set();
|
|
239
|
+
for (const task of Array.isArray(tasks) ? tasks : []) {
|
|
240
|
+
const role = typeof task?.role === 'string' ? task.role.trim() : '';
|
|
241
|
+
if (role !== '') entry.taskRoles.add(role);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
236
245
|
/**
|
|
237
246
|
* Register a runtime repository (idempotent, absolute, initialized only).
|
|
238
247
|
* The panel queen activation calls this when a Session opens an initialized
|
|
@@ -284,6 +293,9 @@ export class HiveSupervisor {
|
|
|
284
293
|
queue: [],
|
|
285
294
|
backlog: emptyBacklog(),
|
|
286
295
|
roles: this.#seedRoles(key),
|
|
296
|
+
// Roles actually present on the board, even if roles.yaml/config omit them.
|
|
297
|
+
taskRoles: new Set(),
|
|
298
|
+
wakeRequested: false,
|
|
287
299
|
limitsError: this.limits.errorFor(key),
|
|
288
300
|
environmentError: null,
|
|
289
301
|
mode: null,
|
|
@@ -557,6 +569,7 @@ export class HiveSupervisor {
|
|
|
557
569
|
}
|
|
558
570
|
try {
|
|
559
571
|
const tasks = await this.listAll(repo, { signal });
|
|
572
|
+
this.#rememberTaskRoles(entry, tasks);
|
|
560
573
|
const gate = gatePhase(tasks);
|
|
561
574
|
entry.gate = gate;
|
|
562
575
|
this.#emitGateChange(repo, previous, gate);
|
|
@@ -652,6 +665,26 @@ export class HiveSupervisor {
|
|
|
652
665
|
return outcomes;
|
|
653
666
|
}
|
|
654
667
|
|
|
668
|
+
/**
|
|
669
|
+
* A tool just changed the board: make this repository due immediately and
|
|
670
|
+
* start a tick when it is not already draining.
|
|
671
|
+
* @param {string} repo
|
|
672
|
+
* @returns {boolean} whether the repository is supervised
|
|
673
|
+
*/
|
|
674
|
+
wake(repo) {
|
|
675
|
+
let key;
|
|
676
|
+
try {
|
|
677
|
+
key = normalizeRepoKey(repo);
|
|
678
|
+
} catch {
|
|
679
|
+
return false;
|
|
680
|
+
}
|
|
681
|
+
const entry = this.repos.get(key);
|
|
682
|
+
if (entry === undefined) return false;
|
|
683
|
+
entry.nextAttemptAt = this.now();
|
|
684
|
+
entry.wakeRequested = true;
|
|
685
|
+
if (!entry.inFlight) void this.tick().catch((error) => this.#log('warn', 'tick after wake failed', messageOf(error)));
|
|
686
|
+
return true;
|
|
687
|
+
}
|
|
655
688
|
/** Serializable supervisor + per-repository status. */
|
|
656
689
|
status() {
|
|
657
690
|
const queens = this.queens();
|
|
@@ -808,6 +841,7 @@ export class HiveSupervisor {
|
|
|
808
841
|
}
|
|
809
842
|
|
|
810
843
|
const cards = await this.listReady(entry.repo, { signal });
|
|
844
|
+
this.#rememberTaskRoles(entry, cards);
|
|
811
845
|
entry.lastCheckAt = this.now();
|
|
812
846
|
if (entry.paused) return { repo: entry.repo, state: entry.state };
|
|
813
847
|
// Gate ordering: base work first, then gate:group, then gate:overall.
|
|
@@ -823,6 +857,7 @@ export class HiveSupervisor {
|
|
|
823
857
|
continue;
|
|
824
858
|
}
|
|
825
859
|
entry.queue.push({ role: card.role, card, claimed: false });
|
|
860
|
+
if (typeof card.role === 'string' && card.role !== '') entry.taskRoles.add(card.role);
|
|
826
861
|
queuedIds.add(card.id);
|
|
827
862
|
}
|
|
828
863
|
entry.frozenSkipped = frozenSkipped;
|
|
@@ -833,7 +868,8 @@ export class HiveSupervisor {
|
|
|
833
868
|
entry.state = STATES.BACKOFF;
|
|
834
869
|
entry.lastError = null;
|
|
835
870
|
this.#resetLiveCounts(entry);
|
|
836
|
-
entry.nextAttemptAt = this.now() + this.idleBackoffMs;
|
|
871
|
+
entry.nextAttemptAt = entry.wakeRequested ? this.now() : this.now() + this.idleBackoffMs;
|
|
872
|
+
entry.wakeRequested = false;
|
|
837
873
|
return { repo: entry.repo, state: entry.state, cards: 0 };
|
|
838
874
|
}
|
|
839
875
|
|
|
@@ -876,7 +912,8 @@ export class HiveSupervisor {
|
|
|
876
912
|
entry.environmentError = null;
|
|
877
913
|
if (!entry.paused) {
|
|
878
914
|
entry.state = STATES.IDLE;
|
|
879
|
-
entry.nextAttemptAt = this.now() + this.intervalMs;
|
|
915
|
+
entry.nextAttemptAt = entry.wakeRequested ? this.now() : this.now() + this.intervalMs;
|
|
916
|
+
entry.wakeRequested = false;
|
|
880
917
|
}
|
|
881
918
|
return { repo: entry.repo, state: entry.state, cards: outcome.results.length, results: outcome.results };
|
|
882
919
|
} catch (error) {
|
|
@@ -941,6 +978,21 @@ export class HiveSupervisor {
|
|
|
941
978
|
return entry;
|
|
942
979
|
}
|
|
943
980
|
|
|
981
|
+
/** Status roles including board-only roles and each effective limit's source. */
|
|
982
|
+
#roleSnapshot(entry) {
|
|
983
|
+
const roles = copyRoles(entry.roles);
|
|
984
|
+
for (const role of entry.taskRoles instanceof Set ? entry.taskRoles : []) {
|
|
985
|
+
if (roles[role] === undefined) {
|
|
986
|
+
roles[role] = { limit: this.limits.limitFor(entry.repo, role), live: 0, queued: 0 };
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
for (const role of Object.keys(roles)) {
|
|
990
|
+
roles[role].source = typeof this.limits?.sourceFor === 'function'
|
|
991
|
+
? this.limits.sourceFor(entry.repo, role)
|
|
992
|
+
: 'default';
|
|
993
|
+
}
|
|
994
|
+
return roles;
|
|
995
|
+
}
|
|
944
996
|
#snapshot(entry) {
|
|
945
997
|
const repoQueen = this.queenFor(entry.repo);
|
|
946
998
|
return {
|
|
@@ -964,7 +1016,10 @@ export class HiveSupervisor {
|
|
|
964
1016
|
orphanRecovered: Number.isInteger(entry.orphanRecovered) ? entry.orphanRecovered : 0,
|
|
965
1017
|
orphanRecoveryAt: iso(entry.orphanRecoveryAt),
|
|
966
1018
|
backlog: { ...entry.backlog },
|
|
967
|
-
roles:
|
|
1019
|
+
roles: this.#roleSnapshot(entry),
|
|
1020
|
+
// Roles actually present on the task board (also discoverable when config
|
|
1021
|
+
// and roles.yaml do not mention them).
|
|
1022
|
+
taskRoles: [...(entry.taskRoles instanceof Set ? entry.taskRoles : [])].sort(),
|
|
968
1023
|
// Live workers currently running in this repository: sessionId/start time
|
|
969
1024
|
// let the panel jump to the conversation or diagnose a stuck card.
|
|
970
1025
|
workers: this.#workers(entry.repo),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-hive-runner",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
4
4
|
"description": "DSH host plugin for Hive: a resident supervisor that runs one DSH subagent per ready task card, with per-role worker limits, pause/resume and Hive tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|