pi-herdsman 0.42.0 → 0.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/SKILL.md +7 -6
- package/dist/index.js +138 -68
- package/dist/index.js.map +3 -3
- package/docs/development/smoke-testing.md +6 -1
- package/docs/guides/handoffs.md +10 -5
- package/docs/reference/ask-owner.md +7 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,19 @@
|
|
|
18
18
|
Move existing role overrides from `agents/` to `pi-herdsman/roles/` in the
|
|
19
19
|
same scope. Reserved role names in `agents/` are rejected.
|
|
20
20
|
|
|
21
|
+
## [0.42.1](https://github.com/boadij/pi-herdsman/compare/v0.42.0...v0.42.1) (2026-11-08)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Fixes
|
|
25
|
+
|
|
26
|
+
* **agent:** retain ask_owner attachment errors in empty results ([#874](https://github.com/boadij/pi-herdsman/issues/874)) ([97ba8fc](https://github.com/boadij/pi-herdsman/commit/97ba8fc87fc30b3ccf9964e59526d6d3167ae9c3)), closes [#870](https://github.com/boadij/pi-herdsman/issues/870) [#871](https://github.com/boadij/pi-herdsman/issues/871)
|
|
27
|
+
* **agent:** show nested descendants in the root status tree promptly ([#877](https://github.com/boadij/pi-herdsman/issues/877)) ([0f32d7e](https://github.com/boadij/pi-herdsman/commit/0f32d7e6a77d519e089f836159b4d0ccbedcc06c))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Documentation
|
|
31
|
+
|
|
32
|
+
* guide agents to file evidence-grounded issues ([#875](https://github.com/boadij/pi-herdsman/issues/875)) ([2d9a90d](https://github.com/boadij/pi-herdsman/commit/2d9a90d982cb759a6ea0d806a20eb070a7d0a9c4))
|
|
33
|
+
|
|
21
34
|
## [0.42.0](https://github.com/boadij/pi-herdsman/compare/v0.41.0...v0.42.0) (2026-11-07)
|
|
22
35
|
|
|
23
36
|
|
package/SKILL.md
CHANGED
|
@@ -248,12 +248,13 @@ Do not silently broaden scope or make an unapproved scope, architecture,
|
|
|
248
248
|
security, protocol, repository-boundary, product, or operational decision.
|
|
249
249
|
|
|
250
250
|
Use ask_owner only when a decision from your exact direct owner is genuinely
|
|
251
|
-
required to continue correctly.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
251
|
+
required to continue correctly. Explicit attachments must be supported UTF-8
|
|
252
|
+
text fully embedded within the applicable per-file and complete-message
|
|
253
|
+
budgets. Call ask_owner alone as the final tool call of the turn. Wait for the
|
|
254
|
+
direct owner's reply only after the tool confirms the question was sent; if
|
|
255
|
+
rejected, address the error or report a non-empty blocker. Keep at most one
|
|
256
|
+
question outstanding. Do not guess the answer. The reply resumes the same
|
|
257
|
+
assignment.
|
|
257
258
|
|
|
258
259
|
Treat inactivity as advisory, not proof of a hang. Preserve exact identity and
|
|
259
260
|
cleanup evidence on failure. Do not blindly retry destructive cleanup or
|
package/dist/index.js
CHANGED
|
@@ -1075,6 +1075,39 @@ function observeMailbox(directory2, relevant, reconcile, onError) {
|
|
|
1075
1075
|
watcher = void 0;
|
|
1076
1076
|
};
|
|
1077
1077
|
}
|
|
1078
|
+
function observeNewAgentStates(onNew, onError) {
|
|
1079
|
+
let known = /* @__PURE__ */ new Set();
|
|
1080
|
+
const scan = () => {
|
|
1081
|
+
const present = /* @__PURE__ */ new Set();
|
|
1082
|
+
let names2 = [];
|
|
1083
|
+
try {
|
|
1084
|
+
names2 = readdirSync3(root);
|
|
1085
|
+
} catch (error2) {
|
|
1086
|
+
if (error2.code !== "ENOENT") throw error2;
|
|
1087
|
+
}
|
|
1088
|
+
for (const name of names2)
|
|
1089
|
+
if (MAILBOX_DIRECTORY.test(name) && existsSync(file(join3(root, name), "state.json")))
|
|
1090
|
+
present.add(name);
|
|
1091
|
+
return present;
|
|
1092
|
+
};
|
|
1093
|
+
try {
|
|
1094
|
+
known = scan();
|
|
1095
|
+
} catch (error2) {
|
|
1096
|
+
onError(error2);
|
|
1097
|
+
}
|
|
1098
|
+
return observeMailbox(
|
|
1099
|
+
root,
|
|
1100
|
+
(name) => MAILBOX_DIRECTORY.test(name),
|
|
1101
|
+
() => {
|
|
1102
|
+
const previous = known;
|
|
1103
|
+
known = scan();
|
|
1104
|
+
if ([...known].some((name) => !previous.has(name))) onNew();
|
|
1105
|
+
},
|
|
1106
|
+
(error2) => {
|
|
1107
|
+
if (error2?.code !== "ENOENT") onError(error2);
|
|
1108
|
+
}
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1078
1111
|
function agentMailboxPath(workspaceId, agentLabel) {
|
|
1079
1112
|
return join3(
|
|
1080
1113
|
root,
|
|
@@ -2047,6 +2080,7 @@ function prepareMessageInput(text, files, cwd, operation, heading, options = {})
|
|
|
2047
2080
|
${text}`, ...sections] : [...sections, `${heading}:
|
|
2048
2081
|
${text}`]).join("\n\n");
|
|
2049
2082
|
const fits = options.fits ?? ((value2, bindings) => (options.serializedBytes ? options.serializedBytes(value2, bindings) : Buffer.byteLength(value2, "utf8")) <= (options.mailboxLimitBytes ?? MAILBOX_PROTOCOL_LIMIT_BYTES));
|
|
2083
|
+
const capacityMessage = (file2) => file2.bytes > (options.inlineLimitBytes ?? MAILBOX_PROTOCOL_LIMIT_BYTES) ? `Attachment is ${file2.bytes} bytes; per-file inline limit is ${options.inlineLimitBytes ?? MAILBOX_PROTOCOL_LIMIT_BYTES} bytes: ${file2.input}` : `Attachment could not fit within the configured message limit: ${file2.input}`;
|
|
2050
2084
|
if (!fits(rendered(), resultBindings))
|
|
2051
2085
|
fail(
|
|
2052
2086
|
"invalid_request",
|
|
@@ -2087,7 +2121,7 @@ ${text}`]).join("\n\n");
|
|
|
2087
2121
|
if (options.requireInline)
|
|
2088
2122
|
fail(
|
|
2089
2123
|
"invalid_request",
|
|
2090
|
-
`Attachment
|
|
2124
|
+
`Attachment changed between validation and reading: ${file2.input}`,
|
|
2091
2125
|
operation
|
|
2092
2126
|
);
|
|
2093
2127
|
continue;
|
|
@@ -2110,12 +2144,9 @@ ${text}`
|
|
|
2110
2144
|
);
|
|
2111
2145
|
if (cannotInline && !verified) {
|
|
2112
2146
|
if (options.requireInline)
|
|
2113
|
-
fail(
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
operation,
|
|
2117
|
-
{ details: { capacity: true } }
|
|
2118
|
-
);
|
|
2147
|
+
fail("invalid_request", capacityMessage(file2), operation, {
|
|
2148
|
+
details: { capacity: true }
|
|
2149
|
+
});
|
|
2119
2150
|
continue;
|
|
2120
2151
|
}
|
|
2121
2152
|
bytes = Buffer.allocUnsafe(current.size);
|
|
@@ -2150,12 +2181,9 @@ ${text}`
|
|
|
2150
2181
|
);
|
|
2151
2182
|
if (cannotInline) {
|
|
2152
2183
|
if (options.requireInline)
|
|
2153
|
-
fail(
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
operation,
|
|
2157
|
-
{ details: { capacity: true } }
|
|
2158
|
-
);
|
|
2184
|
+
fail("invalid_request", capacityMessage(file2), operation, {
|
|
2185
|
+
details: { capacity: true }
|
|
2186
|
+
});
|
|
2159
2187
|
continue;
|
|
2160
2188
|
}
|
|
2161
2189
|
} catch (error2) {
|
|
@@ -2201,11 +2229,12 @@ ${text}`
|
|
|
2201
2229
|
transportSections[index] = renderMessageFile(file2, markers[index]);
|
|
2202
2230
|
attachmentTexts[index] = content;
|
|
2203
2231
|
if (!fits(rendered(), resultBindings)) {
|
|
2232
|
+
const actualBytes = options.fits ? void 0 : options.serializedBytes ? options.serializedBytes(rendered(), resultBindings) : Buffer.byteLength(rendered(), "utf8");
|
|
2204
2233
|
sections[index] = prior;
|
|
2205
2234
|
if (options.requireInline)
|
|
2206
2235
|
fail(
|
|
2207
2236
|
"invalid_request",
|
|
2208
|
-
`Attachment could not
|
|
2237
|
+
actualBytes === void 0 ? `Attachment could not fit within the configured message limit: ${file2.input}` : `Mailbox payload is ${actualBytes} bytes; configured limit is ${options.mailboxLimitBytes ?? MAILBOX_PROTOCOL_LIMIT_BYTES} bytes while embedding ${file2.input}`,
|
|
2209
2238
|
operation,
|
|
2210
2239
|
{ details: { capacity: true } }
|
|
2211
2240
|
);
|
|
@@ -13291,6 +13320,7 @@ function createAgentStatusRuntime() {
|
|
|
13291
13320
|
}
|
|
13292
13321
|
};
|
|
13293
13322
|
let statusTimer;
|
|
13323
|
+
let stopNewAgentWatch;
|
|
13294
13324
|
let statusContext;
|
|
13295
13325
|
let statusGeneration = 0;
|
|
13296
13326
|
let statusWidgetGeneration = 0;
|
|
@@ -13362,6 +13392,7 @@ function createAgentStatusRuntime() {
|
|
|
13362
13392
|
lastValidStatus = snapshot;
|
|
13363
13393
|
reconcilePendingStarts(snapshot);
|
|
13364
13394
|
publishStatus(snapshot);
|
|
13395
|
+
syncNewAgentWatch(ctx, generation);
|
|
13365
13396
|
} catch {
|
|
13366
13397
|
if (generation === statusGeneration && ctx === statusContext)
|
|
13367
13398
|
publishStatus(
|
|
@@ -13390,6 +13421,34 @@ function createAgentStatusRuntime() {
|
|
|
13390
13421
|
const clearTimer = () => {
|
|
13391
13422
|
if (statusTimer) clearInterval(statusTimer);
|
|
13392
13423
|
statusTimer = void 0;
|
|
13424
|
+
stopNewAgentWatch?.();
|
|
13425
|
+
stopNewAgentWatch = void 0;
|
|
13426
|
+
};
|
|
13427
|
+
const syncNewAgentWatch = (ctx, generation) => {
|
|
13428
|
+
if (!presentedStatus.agents.length || !statusTimer) {
|
|
13429
|
+
stopNewAgentWatch?.();
|
|
13430
|
+
stopNewAgentWatch = void 0;
|
|
13431
|
+
return;
|
|
13432
|
+
}
|
|
13433
|
+
if (stopNewAgentWatch) return;
|
|
13434
|
+
let lastError;
|
|
13435
|
+
stopNewAgentWatch = observeNewAgentStates(
|
|
13436
|
+
() => {
|
|
13437
|
+
lastError = void 0;
|
|
13438
|
+
void refresh(ctx, generation);
|
|
13439
|
+
},
|
|
13440
|
+
(error2) => {
|
|
13441
|
+
const message = String(error2).replace(/^Error: /u, "");
|
|
13442
|
+
if (message === lastError) return;
|
|
13443
|
+
lastError = message;
|
|
13444
|
+
if (generation === statusGeneration && ctx === statusContext)
|
|
13445
|
+
ctx.ui.notify(
|
|
13446
|
+
`Agent status cannot watch for new agents (${message}); the view refreshes every 10 seconds instead`,
|
|
13447
|
+
"warning"
|
|
13448
|
+
);
|
|
13449
|
+
}
|
|
13450
|
+
);
|
|
13451
|
+
void refresh(ctx, generation);
|
|
13393
13452
|
};
|
|
13394
13453
|
const removeWidget = () => {
|
|
13395
13454
|
if (statusWidget) {
|
|
@@ -13422,6 +13481,7 @@ function createAgentStatusRuntime() {
|
|
|
13422
13481
|
requestActive = true;
|
|
13423
13482
|
statusTimer = setInterval(() => void refresh(ctx, generation), 1e4);
|
|
13424
13483
|
statusTimer.unref?.();
|
|
13484
|
+
syncNewAgentWatch(ctx, generation);
|
|
13425
13485
|
statusPrimed = false;
|
|
13426
13486
|
publishStatus(presentedStatus);
|
|
13427
13487
|
if (!primed) void refresh(ctx, generation);
|
|
@@ -13475,6 +13535,7 @@ function createAgentStatusRuntime() {
|
|
|
13475
13535
|
requestActive = true;
|
|
13476
13536
|
statusTimer = setInterval(() => void refresh(ctx, generation), 1e4);
|
|
13477
13537
|
statusTimer.unref?.();
|
|
13538
|
+
syncNewAgentWatch(ctx, generation);
|
|
13478
13539
|
statusPrimed = false;
|
|
13479
13540
|
if (!primed) void refresh(ctx, generation);
|
|
13480
13541
|
},
|
|
@@ -20808,12 +20869,13 @@ Do not silently broaden scope or make an unapproved scope, architecture,
|
|
|
20808
20869
|
security, protocol, repository-boundary, product, or operational decision.
|
|
20809
20870
|
|
|
20810
20871
|
Use ask_owner only when a decision from your exact direct owner is genuinely
|
|
20811
|
-
required to continue correctly.
|
|
20812
|
-
|
|
20813
|
-
|
|
20814
|
-
|
|
20815
|
-
|
|
20816
|
-
|
|
20872
|
+
required to continue correctly. Explicit attachments must be supported UTF-8
|
|
20873
|
+
text fully embedded within the applicable per-file and complete-message
|
|
20874
|
+
budgets. Call ask_owner alone as the final tool call of the turn. Wait for the
|
|
20875
|
+
direct owner's reply only after the tool confirms the question was sent; if
|
|
20876
|
+
rejected, address the error or report a non-empty blocker. Keep at most one
|
|
20877
|
+
question outstanding. Do not guess the answer. The reply resumes the same
|
|
20878
|
+
assignment.
|
|
20817
20879
|
|
|
20818
20880
|
Treat inactivity as advisory, not proof of a hang. Preserve exact identity and
|
|
20819
20881
|
cleanup evidence on failure. Do not blindly retry destructive cleanup or
|
|
@@ -21873,7 +21935,7 @@ function registerManagedAgentAskOwnerTool(pi, execute) {
|
|
|
21873
21935
|
exposure: "model-only",
|
|
21874
21936
|
promptSnippet: "Ask this managed agent's direct owner for a required decision",
|
|
21875
21937
|
promptGuidelines: [FILE_HANDOFF_GUIDANCE],
|
|
21876
|
-
description: "Ask your direct owner for a decision that is required to continue. Call this alone as the final tool call of the turn
|
|
21938
|
+
description: "Ask your direct owner for a decision that is required to continue. Call this alone as the final tool call of the turn. Wait for the reply only after the tool confirms the question was sent; if rejected, address the error or report a non-empty blocker. Only one question may be outstanding.",
|
|
21877
21939
|
executionMode: "sequential",
|
|
21878
21940
|
parameters: Type2.Object(
|
|
21879
21941
|
{
|
|
@@ -22484,7 +22546,7 @@ function registerManagedAgentSettlementHandlers(pi, execution, options) {
|
|
|
22484
22546
|
} : {
|
|
22485
22547
|
error: {
|
|
22486
22548
|
code: aborted ? "aborted" : handoffSelectionError || outcome === "error" ? "execution_error" : "empty_result",
|
|
22487
|
-
message: aborted ? "Agent execution was cancelled" : handoffSelectionError ? "Selected handoff evidence could not be verified" : outcome === "error" ? "Agent model execution failed" : "Agent produced no assistant text"
|
|
22549
|
+
message: aborted ? "Agent execution was cancelled" : handoffSelectionError ? "Selected handoff evidence could not be verified" : outcome === "error" ? "Agent model execution failed" : observation?.requestId === state.activeRequestId && observation.askOwnerCapacityError ? `Agent produced no assistant text. Earlier in this execution, ask_owner rejected its attachments: ${observation.askOwnerCapacityError}. The question was not sent.` : "Agent produced no assistant text"
|
|
22488
22550
|
}
|
|
22489
22551
|
},
|
|
22490
22552
|
contextUsage: ctx.getContextUsage(),
|
|
@@ -22968,52 +23030,60 @@ This is the session-start definition snapshot. Use list_agents for live Agent st
|
|
|
22968
23030
|
};
|
|
22969
23031
|
}
|
|
22970
23032
|
);
|
|
22971
|
-
|
|
22972
|
-
|
|
22973
|
-
|
|
22974
|
-
|
|
22975
|
-
|
|
22976
|
-
|
|
22977
|
-
|
|
22978
|
-
|
|
22979
|
-
|
|
22980
|
-
|
|
22981
|
-
|
|
22982
|
-
|
|
22983
|
-
|
|
22984
|
-
|
|
22985
|
-
|
|
22986
|
-
|
|
22987
|
-
|
|
22988
|
-
|
|
22989
|
-
|
|
22990
|
-
|
|
22991
|
-
|
|
22992
|
-
requireInline: true,
|
|
22993
|
-
serializedBytes: (text, bindings) => askRecordBytes(state, askId, text, createdAt, bindings)
|
|
22994
|
-
}
|
|
22995
|
-
),
|
|
22996
|
-
checkMailboxSize: (bytes, limit) => {
|
|
22997
|
-
if (bytes > limit)
|
|
22998
|
-
fail(
|
|
22999
|
-
"invalid_request",
|
|
23000
|
-
`Mailbox payload is ${bytes} bytes; configured limit is ${limit} bytes`,
|
|
23001
|
-
"ask_owner"
|
|
23002
|
-
);
|
|
23003
|
-
},
|
|
23004
|
-
claimLock: (mailbox, state) => options.claimAssignmentLock(mailbox, "ask_owner", {
|
|
23005
|
-
label: state.agentLabel,
|
|
23006
|
-
paneId: state.paneId
|
|
23007
|
-
}),
|
|
23008
|
-
readState: readAgentState,
|
|
23009
|
-
writeState: writeAgentState,
|
|
23010
|
-
writeAsk,
|
|
23011
|
-
removeAsk,
|
|
23012
|
-
latest: (value2) => {
|
|
23013
|
-
execution.latest = value2;
|
|
23033
|
+
const executeAskOwner = createManagedAgentAskOwnerHandler({
|
|
23034
|
+
state: () => execution.assignment,
|
|
23035
|
+
setState: (state) => {
|
|
23036
|
+
execution.assignment = state;
|
|
23037
|
+
},
|
|
23038
|
+
sameIdentity: sameManagedAgentIdentity,
|
|
23039
|
+
eligible: requestState.eligibleToAsk,
|
|
23040
|
+
rejectionReason: requestState.askRejectionReason,
|
|
23041
|
+
isSoleToolCall: (ctx) => currentTurnIsSoleToolCall(ctx, "ask_owner"),
|
|
23042
|
+
messageLimits: options.messageLimits,
|
|
23043
|
+
prepare: async (ctx, question, files, state, askId, createdAt, limits) => prepareMessageInput(
|
|
23044
|
+
question,
|
|
23045
|
+
options.resolveMessageFiles(ctx, files, "ask_owner"),
|
|
23046
|
+
state.cwd,
|
|
23047
|
+
"ask_owner",
|
|
23048
|
+
"Question",
|
|
23049
|
+
{
|
|
23050
|
+
inlineLimitBytes: limits.inline.bytes,
|
|
23051
|
+
mailboxLimitBytes: limits.mailbox.bytes,
|
|
23052
|
+
requireInline: true,
|
|
23053
|
+
serializedBytes: (text, bindings) => askRecordBytes(state, askId, text, createdAt, bindings)
|
|
23014
23054
|
}
|
|
23015
|
-
|
|
23016
|
-
|
|
23055
|
+
),
|
|
23056
|
+
checkMailboxSize: (bytes, limit) => {
|
|
23057
|
+
if (bytes > limit)
|
|
23058
|
+
fail(
|
|
23059
|
+
"invalid_request",
|
|
23060
|
+
`Mailbox payload is ${bytes} bytes; configured limit is ${limit} bytes`,
|
|
23061
|
+
"ask_owner",
|
|
23062
|
+
{ details: { capacity: true } }
|
|
23063
|
+
);
|
|
23064
|
+
},
|
|
23065
|
+
claimLock: (mailbox, state) => options.claimAssignmentLock(mailbox, "ask_owner", {
|
|
23066
|
+
label: state.agentLabel,
|
|
23067
|
+
paneId: state.paneId
|
|
23068
|
+
}),
|
|
23069
|
+
readState: readAgentState,
|
|
23070
|
+
writeState: writeAgentState,
|
|
23071
|
+
writeAsk,
|
|
23072
|
+
removeAsk,
|
|
23073
|
+
latest: (value2) => {
|
|
23074
|
+
execution.latest = value2;
|
|
23075
|
+
}
|
|
23076
|
+
});
|
|
23077
|
+
registerManagedAgentAskOwnerTool(pi, async (...args) => {
|
|
23078
|
+
const observation = execution.observation;
|
|
23079
|
+
try {
|
|
23080
|
+
return await executeAskOwner(...args);
|
|
23081
|
+
} catch (error2) {
|
|
23082
|
+
if (error2 instanceof OperationError && error2.detail.operation === "ask_owner" && error2.detail.details?.capacity === true && observation?.requestId && observation === execution.observation && execution.assignment?.activeRequestId === observation.requestId && !execution.assignment.pendingAskId)
|
|
23083
|
+
observation.askOwnerCapacityError = error2.message.slice(0, 512);
|
|
23084
|
+
throw error2;
|
|
23085
|
+
}
|
|
23086
|
+
});
|
|
23017
23087
|
const prepareDelegatingRoster = async (ctx) => {
|
|
23018
23088
|
startupDefinitionRoster = void 0;
|
|
23019
23089
|
if (!delegationEnabled) return;
|
|
@@ -23787,7 +23857,7 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
|
23787
23857
|
// package.json
|
|
23788
23858
|
var package_default = {
|
|
23789
23859
|
name: "pi-herdsman",
|
|
23790
|
-
version: "0.42.
|
|
23860
|
+
version: "0.42.1",
|
|
23791
23861
|
type: "module",
|
|
23792
23862
|
description: "Asynchronous Pi subagents and agent fleet orchestration for parallel coding agents with nested delegation, background work, and supervision in herdr.",
|
|
23793
23863
|
license: "Apache-2.0",
|