pi-herdsman 0.28.0 → 0.29.0
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/SKILL.md +6 -3
- package/dist/index.js +121 -56
- package/dist/index.js.map +3 -3
- package/docs/adr/0017-use-project-assignments-for-managed-lead-authority.md +5 -0
- package/docs/adr/0021-unify-direct-supervision-authority.md +56 -0
- package/docs/concepts/coordination.md +9 -9
- package/docs/development/validation.md +24 -13
- package/docs/guides/project-orchestration.md +3 -1
- package/docs/reference/commands.md +4 -3
- package/docs/reference/staff.md +10 -8
- package/docs/reference/status-widget.md +7 -5
- package/docs/reference/supervisor.md +4 -4
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -349,8 +349,11 @@ delegating parent that is merely waiting for its direct children.
|
|
|
349
349
|
Ordinary leads own their complete herd, including every agent beneath them. The
|
|
350
350
|
Chief supervises ordinary Leads only when they have no active project Manager
|
|
351
351
|
and never changes ownership. An active project Manager supervises eligible
|
|
352
|
-
ordinary Leads throughout its verified worktree group
|
|
353
|
-
|
|
352
|
+
ordinary Leads throughout its verified worktree group with the same direct-
|
|
353
|
+
report inspection, transcript access when persisted evidence is available, and
|
|
354
|
+
messaging capabilities as assigned Leads. Authorized messages use cooperative
|
|
355
|
+
steering; project execution remains assignment-bound. Avoid unnecessary
|
|
356
|
+
monitoring. Use
|
|
354
357
|
`message_supervisor` for material coordination with the direct supervisor.
|
|
355
358
|
Managed Leads contact their assigned Manager; ordinary Leads contact their
|
|
356
359
|
active project Manager or Chief when eligible, and Managers contact Chief. It is nonblocking and supports timely questions, clarifications,
|
|
@@ -381,7 +384,7 @@ reusable direct-agent result refs, and already-supplied canonical result refs
|
|
|
381
384
|
through `files`.
|
|
382
385
|
|
|
383
386
|
Chief uses `list_staff`, `inspect_staff`, `read_staff_transcript`, and
|
|
384
|
-
`message_staff`. Manager has those direct-report tools, peer tools, and
|
|
387
|
+
`message_staff`. Manager has those same direct-report tools, peer tools, and
|
|
385
388
|
`delegate_project`, `resume_project`, and `stop_lead`.
|
|
386
389
|
`inspect_staff` provides bounded live terminal/process evidence;
|
|
387
390
|
`read_staff_transcript` provides bounded persisted Pi conversation/tool evidence.
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
15
15
|
// package.json
|
|
16
16
|
var package_default = {
|
|
17
17
|
name: "pi-herdsman",
|
|
18
|
-
version: "0.
|
|
18
|
+
version: "0.29.0",
|
|
19
19
|
type: "module",
|
|
20
20
|
description: "Asynchronous Pi subagents and agent fleet orchestration for parallel coding agents with nested delegation, background work, and supervision in herdr.",
|
|
21
21
|
license: "Apache-2.0",
|
|
@@ -199,6 +199,15 @@ import { join } from "node:path";
|
|
|
199
199
|
var RESULT_PREFIX = "result:";
|
|
200
200
|
var RESULT_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
201
201
|
var SEMANTIC_RESULT_REF = /^result:([a-z][a-z0-9_-]{0,31})#([1-9][0-9]*)$/;
|
|
202
|
+
var INCIDENTAL_METADATA = /* @__PURE__ */ new Set([
|
|
203
|
+
".ds_store",
|
|
204
|
+
"desktop.ini",
|
|
205
|
+
"thumbs.db",
|
|
206
|
+
".directory"
|
|
207
|
+
]);
|
|
208
|
+
function isIncidentalMetadata(entry) {
|
|
209
|
+
return entry.isFile() && INCIDENTAL_METADATA.has(entry.name.toLowerCase());
|
|
210
|
+
}
|
|
202
211
|
function parseSemanticResultRef(input) {
|
|
203
212
|
const match = SEMANTIC_RESULT_REF.exec(input);
|
|
204
213
|
if (!match) return void 0;
|
|
@@ -372,6 +381,25 @@ function readProcessLockClaim(path, owner) {
|
|
|
372
381
|
throw new Error("invalid process lock claim");
|
|
373
382
|
return claim;
|
|
374
383
|
}
|
|
384
|
+
function ownerMissing(path) {
|
|
385
|
+
try {
|
|
386
|
+
fs.lstatSync(path);
|
|
387
|
+
return false;
|
|
388
|
+
} catch (error2) {
|
|
389
|
+
if (error2.code === "ENOENT") return true;
|
|
390
|
+
throw error2;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
function lockOwnerEntry(path) {
|
|
394
|
+
const entries = fs.readdirSync(path, { withFileTypes: true });
|
|
395
|
+
const owners = entries.filter((entry) => !isIncidentalMetadata(entry));
|
|
396
|
+
if (owners.length !== 1 || !owners[0].isFile())
|
|
397
|
+
throw new Error("Invalid process lock owner");
|
|
398
|
+
return {
|
|
399
|
+
owner: owners[0].name,
|
|
400
|
+
metadata: entries.filter(isIncidentalMetadata).map((entry) => entry.name)
|
|
401
|
+
};
|
|
402
|
+
}
|
|
375
403
|
function processExists(pid) {
|
|
376
404
|
try {
|
|
377
405
|
process.kill(pid, 0);
|
|
@@ -415,14 +443,12 @@ function readLiveProcessLock(path, name = "process lock") {
|
|
|
415
443
|
}
|
|
416
444
|
function readProcessLockStatus(path, name = "process lock") {
|
|
417
445
|
const verifyMessage = `Unable to verify ${name}`;
|
|
418
|
-
let
|
|
446
|
+
let owner;
|
|
419
447
|
try {
|
|
420
|
-
|
|
448
|
+
({ owner } = lockOwnerEntry(path));
|
|
421
449
|
} catch (error2) {
|
|
422
450
|
throw new Error(verifyMessage, { cause: error2 });
|
|
423
451
|
}
|
|
424
|
-
if (entries.length !== 1) throw new Error(verifyMessage);
|
|
425
|
-
const owner = entries[0];
|
|
426
452
|
try {
|
|
427
453
|
const claim = readProcessLockClaim(path, owner);
|
|
428
454
|
return { claim, live: processExists(claim.pid) };
|
|
@@ -444,9 +470,10 @@ function acquireProcessLock(path, options2 = {}) {
|
|
|
444
470
|
const payload = JSON.stringify(claim);
|
|
445
471
|
const ownerPath = join2(claimDir, owner);
|
|
446
472
|
try {
|
|
447
|
-
|
|
473
|
+
lockOwnerEntry(claimDir);
|
|
448
474
|
} catch (error2) {
|
|
449
|
-
if (error2.code !== "ENOENT")
|
|
475
|
+
if (error2.code !== "ENOENT")
|
|
476
|
+
throw new Error(verifyMessage, { cause: error2 });
|
|
450
477
|
}
|
|
451
478
|
try {
|
|
452
479
|
publishClaim(parent, claimDir, owner, payload);
|
|
@@ -454,17 +481,12 @@ function acquireProcessLock(path, options2 = {}) {
|
|
|
454
481
|
const code = error2.code;
|
|
455
482
|
if (code !== "EEXIST" && code !== "ENOTEMPTY" && code !== "EPERM")
|
|
456
483
|
throw error2;
|
|
457
|
-
let
|
|
484
|
+
let observedOwner;
|
|
458
485
|
try {
|
|
459
|
-
|
|
486
|
+
({ owner: observedOwner } = lockOwnerEntry(claimDir));
|
|
460
487
|
} catch {
|
|
461
488
|
throw new Error(verifyMessage);
|
|
462
489
|
}
|
|
463
|
-
if (entries.length === 0) {
|
|
464
|
-
throw new Error(verifyMessage);
|
|
465
|
-
}
|
|
466
|
-
if (entries.length !== 1) throw new Error(verifyMessage);
|
|
467
|
-
const observedOwner = entries[0];
|
|
468
490
|
let staleClaim;
|
|
469
491
|
try {
|
|
470
492
|
staleClaim = readProcessLockClaim(claimDir, observedOwner);
|
|
@@ -483,8 +505,8 @@ function acquireProcessLock(path, options2 = {}) {
|
|
|
483
505
|
`.${basename(claimDir)}.${randomUUID()}.stale`
|
|
484
506
|
);
|
|
485
507
|
try {
|
|
486
|
-
const
|
|
487
|
-
if (
|
|
508
|
+
const { owner: currentOwner } = lockOwnerEntry(claimDir);
|
|
509
|
+
if (currentOwner !== observedOwner)
|
|
488
510
|
throw new ProcessLockOccupiedError(occupiedMessage);
|
|
489
511
|
const currentClaim = readProcessLockClaim(claimDir, observedOwner);
|
|
490
512
|
if (currentClaim.pid !== staleClaim.pid || currentClaim.id !== staleClaim.id)
|
|
@@ -501,13 +523,14 @@ function acquireProcessLock(path, options2 = {}) {
|
|
|
501
523
|
throw new ProcessLockOccupiedError(occupiedMessage);
|
|
502
524
|
throw new Error(recoverMessage, { cause: removeError });
|
|
503
525
|
}
|
|
504
|
-
let
|
|
526
|
+
let quarantinedOwner;
|
|
527
|
+
let metadata;
|
|
505
528
|
try {
|
|
506
|
-
|
|
529
|
+
({ owner: quarantinedOwner, metadata } = lockOwnerEntry(quarantine));
|
|
507
530
|
} catch (error3) {
|
|
508
531
|
throw new Error(recoverMessage, { cause: error3 });
|
|
509
532
|
}
|
|
510
|
-
if (
|
|
533
|
+
if (quarantinedOwner !== observedOwner)
|
|
511
534
|
throw new ProcessLockOccupiedError(occupiedMessage);
|
|
512
535
|
try {
|
|
513
536
|
const quarantinedClaim = readProcessLockClaim(quarantine, observedOwner);
|
|
@@ -519,6 +542,7 @@ function acquireProcessLock(path, options2 = {}) {
|
|
|
519
542
|
}
|
|
520
543
|
options2.afterStaleOwnerRemoved?.();
|
|
521
544
|
try {
|
|
545
|
+
unlinkMetadata(quarantine, metadata);
|
|
522
546
|
fs.unlinkSync(join2(quarantine, observedOwner));
|
|
523
547
|
fs.rmdirSync(quarantine);
|
|
524
548
|
} catch (cleanupError) {
|
|
@@ -542,17 +566,42 @@ function claimProcessLock(path, options2 = {}) {
|
|
|
542
566
|
return acquireProcessLock(path, options2).release;
|
|
543
567
|
}
|
|
544
568
|
function releaseProcessLock(claimDir, ownerPath, claim, name) {
|
|
569
|
+
let owner;
|
|
570
|
+
let metadata;
|
|
571
|
+
try {
|
|
572
|
+
({ owner, metadata } = lockOwnerEntry(claimDir));
|
|
573
|
+
} catch (error2) {
|
|
574
|
+
if (error2.code === "ENOENT") return;
|
|
575
|
+
try {
|
|
576
|
+
if (ownerMissing(ownerPath)) return;
|
|
577
|
+
} catch (missing) {
|
|
578
|
+
throw new Error(`Unable to verify ${name} ownership`, { cause: missing });
|
|
579
|
+
}
|
|
580
|
+
throw new Error(`Unable to verify ${name} ownership`, { cause: error2 });
|
|
581
|
+
}
|
|
582
|
+
if (owner !== basename(ownerPath)) {
|
|
583
|
+
try {
|
|
584
|
+
if (ownerMissing(ownerPath)) return;
|
|
585
|
+
} catch (error2) {
|
|
586
|
+
throw new Error(`Unable to verify ${name} ownership`, { cause: error2 });
|
|
587
|
+
}
|
|
588
|
+
throw new Error(
|
|
589
|
+
`${name[0].toUpperCase()}${name.slice(1)} ownership changed`
|
|
590
|
+
);
|
|
591
|
+
}
|
|
545
592
|
let current;
|
|
546
593
|
try {
|
|
547
594
|
current = readProcessLockClaim(claimDir, basename(ownerPath));
|
|
548
595
|
} catch (error2) {
|
|
549
|
-
if (error2.code === "ENOENT")
|
|
596
|
+
if (error2.code === "ENOENT" && ownerMissing(ownerPath))
|
|
597
|
+
return;
|
|
550
598
|
throw new Error(`Unable to verify ${name} ownership`, { cause: error2 });
|
|
551
599
|
}
|
|
552
600
|
if (current.pid !== claim.pid || current.id !== claim.id)
|
|
553
601
|
throw new Error(
|
|
554
602
|
`${name[0].toUpperCase()}${name.slice(1)} ownership changed`
|
|
555
603
|
);
|
|
604
|
+
unlinkMetadata(claimDir, metadata);
|
|
556
605
|
fs.unlinkSync(ownerPath);
|
|
557
606
|
try {
|
|
558
607
|
fs.rmdirSync(claimDir);
|
|
@@ -561,6 +610,15 @@ function releaseProcessLock(claimDir, ownerPath, claim, name) {
|
|
|
561
610
|
if (code !== "ENOENT" && code !== "ENOTEMPTY") throw error2;
|
|
562
611
|
}
|
|
563
612
|
}
|
|
613
|
+
function unlinkMetadata(path, entries) {
|
|
614
|
+
for (const entry of entries) {
|
|
615
|
+
try {
|
|
616
|
+
fs.unlinkSync(join2(path, entry));
|
|
617
|
+
} catch (error2) {
|
|
618
|
+
if (error2.code !== "ENOENT") throw error2;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
564
622
|
|
|
565
623
|
// extension/mailbox.ts
|
|
566
624
|
var MANAGED_AGENT_BOOTSTRAP_LIMIT_BYTES = 64 * 1024;
|
|
@@ -6974,7 +7032,7 @@ import {
|
|
|
6974
7032
|
chmodSync as chmodSync7,
|
|
6975
7033
|
closeSync as closeSync8,
|
|
6976
7034
|
fsyncSync as fsyncSync4,
|
|
6977
|
-
lstatSync,
|
|
7035
|
+
lstatSync as lstatSync2,
|
|
6978
7036
|
readdirSync as readdirSync5,
|
|
6979
7037
|
rmSync,
|
|
6980
7038
|
mkdirSync as mkdirSync7,
|
|
@@ -8253,7 +8311,7 @@ function removeProjectAssignmentUnlocked(runtime, repoKey, branch) {
|
|
|
8253
8311
|
}
|
|
8254
8312
|
}
|
|
8255
8313
|
function assignmentDirectory(path) {
|
|
8256
|
-
const stat =
|
|
8314
|
+
const stat = lstatSync2(path);
|
|
8257
8315
|
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
8258
8316
|
throw new Error(`Invalid project assignment authority directory ${path}`);
|
|
8259
8317
|
}
|
|
@@ -8273,6 +8331,7 @@ function scanGlobalProjectAssignments() {
|
|
|
8273
8331
|
}
|
|
8274
8332
|
const bySession = /* @__PURE__ */ new Map();
|
|
8275
8333
|
for (const socket of sockets) {
|
|
8334
|
+
if (isIncidentalMetadata(socket)) continue;
|
|
8276
8335
|
if (!/^[a-f0-9]{64}$/.test(socket.name))
|
|
8277
8336
|
throw new Error(
|
|
8278
8337
|
`Unexpected project assignment socket entry ${socket.name}`
|
|
@@ -8294,6 +8353,7 @@ function scanGlobalProjectAssignments() {
|
|
|
8294
8353
|
}
|
|
8295
8354
|
assignmentDirectory(assignmentsRoot);
|
|
8296
8355
|
for (const repository of repositories) {
|
|
8356
|
+
if (isIncidentalMetadata(repository)) continue;
|
|
8297
8357
|
if (!/^[a-f0-9]{64}$/.test(repository.name))
|
|
8298
8358
|
throw new Error(
|
|
8299
8359
|
`Unexpected project assignment repository entry ${repository.name}`
|
|
@@ -8305,6 +8365,12 @@ function scanGlobalProjectAssignments() {
|
|
|
8305
8365
|
const directory = join8(assignmentsRoot, repository.name);
|
|
8306
8366
|
assignmentDirectory(directory);
|
|
8307
8367
|
for (const entry of readdirSync5(directory, { withFileTypes: true })) {
|
|
8368
|
+
if (isIncidentalMetadata(entry)) continue;
|
|
8369
|
+
if (/^[a-f0-9]{64}\.messages$/.test(entry.name)) {
|
|
8370
|
+
if (!entry.isDirectory() || entry.isSymbolicLink())
|
|
8371
|
+
throw new Error(`Invalid project message directory ${entry.name}`);
|
|
8372
|
+
continue;
|
|
8373
|
+
}
|
|
8308
8374
|
if (/^\..+\.[a-f0-9-]{36}\.tmp$/.test(entry.name)) {
|
|
8309
8375
|
if (!entry.isFile() || entry.isSymbolicLink())
|
|
8310
8376
|
throw new Error(
|
|
@@ -8585,13 +8651,9 @@ function projectWorkSnapshot(options2) {
|
|
|
8585
8651
|
issue = "project runtime identity is ambiguous";
|
|
8586
8652
|
} else {
|
|
8587
8653
|
const workspaceId = worktrees[0]?.open_workspace_id ?? void 0;
|
|
8588
|
-
const occupants = workspaceId ? options2.leads.filter((lead) => lead.workspaceId === workspaceId) : [];
|
|
8589
8654
|
if (exact.length === 1 && (!workspaceId || exact[0].workspaceId !== workspaceId)) {
|
|
8590
8655
|
status = "conflict";
|
|
8591
8656
|
issue = "assigned Lead is running outside its branch worktree";
|
|
8592
|
-
} else if (occupants.some((lead) => lead.lead !== assignment.id)) {
|
|
8593
|
-
status = "conflict";
|
|
8594
|
-
issue = "another Lead is active in this worktree";
|
|
8595
8657
|
} else if (exact.length === 1) {
|
|
8596
8658
|
status = "active";
|
|
8597
8659
|
runtimeState = exact[0].runtimeState;
|
|
@@ -13336,11 +13398,11 @@ ${result.stderr ?? ""}`.trim(),
|
|
|
13336
13398
|
description: "Allowed Agent definition."
|
|
13337
13399
|
} : Type.String({
|
|
13338
13400
|
description: "Agent definition for a fresh Agent.",
|
|
13339
|
-
|
|
13401
|
+
minLength: 1
|
|
13340
13402
|
}),
|
|
13341
13403
|
task: Type.String({
|
|
13342
13404
|
description: "Non-empty assignment.",
|
|
13343
|
-
|
|
13405
|
+
minLength: 1
|
|
13344
13406
|
}),
|
|
13345
13407
|
label: Type.Optional(
|
|
13346
13408
|
Type.String({
|
|
@@ -13356,11 +13418,11 @@ ${result.stderr ?? ""}`.trim(),
|
|
|
13356
13418
|
{
|
|
13357
13419
|
session: Type.String({
|
|
13358
13420
|
description: "Exact saved managed-Agent Pi session path or full UUID.",
|
|
13359
|
-
|
|
13421
|
+
minLength: 1
|
|
13360
13422
|
}),
|
|
13361
13423
|
task: Type.String({
|
|
13362
13424
|
description: "Non-empty assignment.",
|
|
13363
|
-
|
|
13425
|
+
minLength: 1
|
|
13364
13426
|
}),
|
|
13365
13427
|
files: FILES_SCHEMA
|
|
13366
13428
|
},
|
|
@@ -13369,7 +13431,7 @@ ${result.stderr ?? ""}`.trim(),
|
|
|
13369
13431
|
const agentMessageParameters = Type.Object(
|
|
13370
13432
|
{
|
|
13371
13433
|
agent: Type.String({ pattern: AGENT_LABEL_PATTERN.source }),
|
|
13372
|
-
message: Type.String({
|
|
13434
|
+
message: Type.String({ minLength: 1 }),
|
|
13373
13435
|
files: FILES_SCHEMA
|
|
13374
13436
|
},
|
|
13375
13437
|
{ additionalProperties: false }
|
|
@@ -19337,8 +19399,7 @@ function createLeadSupervisionRuntime(host) {
|
|
|
19337
19399
|
throw new Error("Multiple project assignments match a Lead session");
|
|
19338
19400
|
return snapshot2.leads.filter((lead) => scope.workspaceIds.includes(lead.workspaceId)).map((lead) => ({
|
|
19339
19401
|
...lead,
|
|
19340
|
-
relationship: sessions.has(lead.lead) ? "assigned" : "supervised"
|
|
19341
|
-
availableActions: sessions.has(lead.lead) ? lead.availableActions : ["message"]
|
|
19402
|
+
relationship: sessions.has(lead.lead) ? "assigned" : "supervised"
|
|
19342
19403
|
}));
|
|
19343
19404
|
}
|
|
19344
19405
|
if (host.activeRole() !== "chief")
|
|
@@ -19695,6 +19756,7 @@ function createLeadSupervisionRuntime(host) {
|
|
|
19695
19756
|
const supervisionGeneration = generation(ctx);
|
|
19696
19757
|
const sessionId = ctx.sessionManager.getSessionId();
|
|
19697
19758
|
let mode = "overview";
|
|
19759
|
+
let peekRequest = 0;
|
|
19698
19760
|
let peekLead;
|
|
19699
19761
|
let peekEvidence;
|
|
19700
19762
|
let list;
|
|
@@ -19886,6 +19948,7 @@ function createLeadSupervisionRuntime(host) {
|
|
|
19886
19948
|
return finish();
|
|
19887
19949
|
if (mode === "peek") {
|
|
19888
19950
|
if (host.tui.matchesKey(data, host.tui.Key.escape) || host.tui.matchesKey(data, host.tui.Key.space)) {
|
|
19951
|
+
peekRequest++;
|
|
19889
19952
|
mode = "overview";
|
|
19890
19953
|
showOverview();
|
|
19891
19954
|
tui.requestRender();
|
|
@@ -19901,6 +19964,7 @@ function createLeadSupervisionRuntime(host) {
|
|
|
19901
19964
|
const leadId = selected?.startsWith("lead:") ? selected.slice("lead:".length) : selected;
|
|
19902
19965
|
const lead = host.presentationReports(snapshot).find((item) => item.lead === leadId);
|
|
19903
19966
|
if (!lead) return;
|
|
19967
|
+
const request = ++peekRequest;
|
|
19904
19968
|
peekLead = lead;
|
|
19905
19969
|
peekEvidence = {
|
|
19906
19970
|
agents: (lead.agents ?? []).map(
|
|
@@ -19910,8 +19974,6 @@ function createLeadSupervisionRuntime(host) {
|
|
|
19910
19974
|
mode = "peek";
|
|
19911
19975
|
showPeek();
|
|
19912
19976
|
tui.requestRender();
|
|
19913
|
-
if (host.activeRole() === "manager" && lead.relationship === "supervised")
|
|
19914
|
-
return;
|
|
19915
19977
|
void host.inspectHerdrAgent(
|
|
19916
19978
|
host.pi,
|
|
19917
19979
|
ctx,
|
|
@@ -19921,12 +19983,20 @@ function createLeadSupervisionRuntime(host) {
|
|
|
19921
19983
|
piSessionId: lead.lead
|
|
19922
19984
|
},
|
|
19923
19985
|
ctx.signal,
|
|
19924
|
-
(agent) =>
|
|
19925
|
-
host.
|
|
19926
|
-
|
|
19927
|
-
|
|
19986
|
+
async (agent) => {
|
|
19987
|
+
if (!isCurrentOverview() || !host.isPiAgent(agent) || agent?.pane_id !== lead.paneId || agent?.tab_id !== lead.tabId || host.herdrSessionId(agent) !== lead.lead || host.readLeadCoordinationState(
|
|
19988
|
+
host.supervisionRuntime(),
|
|
19989
|
+
lead.lead
|
|
19990
|
+
)?.piSessionId !== lead.lead || !lead.availableActions.includes("inspect"))
|
|
19991
|
+
return false;
|
|
19992
|
+
const current = (await directReports(ctx)).find(
|
|
19993
|
+
(candidate) => candidate.lead === lead.lead && candidate.instanceId === lead.instanceId && candidate.workspaceId === lead.workspaceId && candidate.paneId === lead.paneId && candidate.tabId === lead.tabId && candidate.availableActions.includes("inspect")
|
|
19994
|
+
);
|
|
19995
|
+
return isCurrentOverview() && !!current;
|
|
19996
|
+
}
|
|
19928
19997
|
).then((inspection) => {
|
|
19929
|
-
if (!isCurrentOverview())
|
|
19998
|
+
if (!isCurrentOverview() || mode !== "peek" || request !== peekRequest)
|
|
19999
|
+
return;
|
|
19930
20000
|
peekEvidence = {
|
|
19931
20001
|
recentOutput: inspection.recentOutput,
|
|
19932
20002
|
process: inspection.process,
|
|
@@ -21194,6 +21264,10 @@ function createLeadProjectRuntime(host) {
|
|
|
21194
21264
|
id: randomUUID10(),
|
|
21195
21265
|
branch: params.branch ?? `herdsman/work-${randomUUID10().slice(0, 8)}`
|
|
21196
21266
|
} : params;
|
|
21267
|
+
if (!operation.branch.trim())
|
|
21268
|
+
throw new Error("Project branch must not be empty");
|
|
21269
|
+
if (operation.action === "delegate" && operation.base !== void 0 && !operation.base.trim())
|
|
21270
|
+
throw new Error("Base ref must not be empty");
|
|
21197
21271
|
return withProjectWorkLock(
|
|
21198
21272
|
`${repoKey}\0${operation.branch}`,
|
|
21199
21273
|
() => activateProjectLeadLocked(operation, ctx, signal)
|
|
@@ -23277,15 +23351,6 @@ function createLeadInboxRuntime(host) {
|
|
|
23277
23351
|
return void 0;
|
|
23278
23352
|
}
|
|
23279
23353
|
if (!authorized) return "followUp";
|
|
23280
|
-
const workspaceId = host.workspaceId();
|
|
23281
|
-
if (!workspaceId) return void 0;
|
|
23282
|
-
const relation = await host.resolveEffectiveSupervisor(
|
|
23283
|
-
ctx,
|
|
23284
|
-
ctx.sessionManager.getSessionId(),
|
|
23285
|
-
workspaceId
|
|
23286
|
-
);
|
|
23287
|
-
const assigned = relation.kind === "assigned";
|
|
23288
|
-
if (!assigned) return ctx.isIdle() ? "followUp" : void 0;
|
|
23289
23354
|
return "steer";
|
|
23290
23355
|
}
|
|
23291
23356
|
const supervisorDownlink = role2 === "lead" && record.kind === "chief_message" || role2 === "manager" && record.kind === "chief_message";
|
|
@@ -25213,7 +25278,7 @@ ${LEAD_SUPERVISOR_PEER_GUIDANCE}
|
|
|
25213
25278
|
For assigned project work, automatic result handoffs contain summary text but no file attachments. When the Manager needs an actual artifact for review, decision-making, or onward delegation, explicitly transfer the relevant evidence through message_supervisor.files.
|
|
25214
25279
|
${FILE_HANDOFF_GUIDANCE}`;
|
|
25215
25280
|
var MANAGER_ROLE_CONTRACT = `## Manager role
|
|
25216
|
-
You are the verified Manager for this Pi session. Supervise
|
|
25281
|
+
You are the verified Manager for this Pi session. Supervise eligible Leads in your verified project worktree group. Manage project execution only through exact current project assignments; supervision alone grants no Agent ownership or project lifecycle authority. Configuration changes operating guidance and ordinary tool availability, never authority. Project execution belongs to assigned Leads and their Agent trees. Coordination messages and reports are nonterminal and do not establish completion. Use remove_worktree only for an explicitly requested checkout-removal action; never infer removal from completion, review, or inactivity. The user must confirm interactively.`;
|
|
25217
25282
|
var SUPERVISION_CONTEXT_TYPE = "pi-herdsman-supervision-context";
|
|
25218
25283
|
var SUPERVISOR_STATE_TYPE = "pi-herdsman-supervisor-state";
|
|
25219
25284
|
var STALE_AFTER_MS = 10 * 6e4;
|
|
@@ -25618,7 +25683,7 @@ Use reply_agent with agent="${ask.agentLabel}" to answer this question.`,
|
|
|
25618
25683
|
pattern: PI_SESSION_ID_PATTERN,
|
|
25619
25684
|
description: "Exact full Pi session ID from the fresh supervision snapshot or list_staff."
|
|
25620
25685
|
}),
|
|
25621
|
-
message: Type3.String({
|
|
25686
|
+
message: Type3.String({ minLength: 1 }),
|
|
25622
25687
|
files: FILES_SCHEMA
|
|
25623
25688
|
},
|
|
25624
25689
|
{ additionalProperties: false }
|
|
@@ -25629,7 +25694,7 @@ Use reply_agent with agent="${ask.agentLabel}" to answer this question.`,
|
|
|
25629
25694
|
pattern: PI_SESSION_ID_PATTERN,
|
|
25630
25695
|
description: "Exact full Pi session ID returned by list_peers; never use a display label."
|
|
25631
25696
|
}),
|
|
25632
|
-
message: Type3.String({
|
|
25697
|
+
message: Type3.String({ minLength: 1 }),
|
|
25633
25698
|
files: FILES_SCHEMA
|
|
25634
25699
|
},
|
|
25635
25700
|
{ additionalProperties: false }
|
|
@@ -25641,18 +25706,18 @@ Use reply_agent with agent="${ask.agentLabel}" to answer this question.`,
|
|
|
25641
25706
|
const staffDelegateParameters = Type3.Object(
|
|
25642
25707
|
{
|
|
25643
25708
|
task: Type3.String({
|
|
25644
|
-
|
|
25709
|
+
minLength: 1,
|
|
25645
25710
|
description: "Non-empty task for new project work."
|
|
25646
25711
|
}),
|
|
25647
25712
|
branch: Type3.Optional(
|
|
25648
25713
|
Type3.String({
|
|
25649
|
-
|
|
25714
|
+
minLength: 1,
|
|
25650
25715
|
description: "Optional Git branch for the new project work; Herdsman generates one when omitted."
|
|
25651
25716
|
})
|
|
25652
25717
|
),
|
|
25653
25718
|
base: Type3.Optional(
|
|
25654
25719
|
Type3.String({
|
|
25655
|
-
|
|
25720
|
+
minLength: 1,
|
|
25656
25721
|
description: "Base ref used only when Herdsman creates a new worktree."
|
|
25657
25722
|
})
|
|
25658
25723
|
),
|
|
@@ -25663,7 +25728,7 @@ Use reply_agent with agent="${ask.agentLabel}" to answer this question.`,
|
|
|
25663
25728
|
const staffBranchParameters = Type3.Object(
|
|
25664
25729
|
{
|
|
25665
25730
|
branch: Type3.String({
|
|
25666
|
-
|
|
25731
|
+
minLength: 1,
|
|
25667
25732
|
description: "Exact project branch."
|
|
25668
25733
|
})
|
|
25669
25734
|
},
|