pi-herdsman 0.48.0 → 0.49.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/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.49.0](https://github.com/boadij/pi-herdsman/compare/v0.48.0...v0.49.0) (2026-11-16)
4
+
5
+
6
+ ### Features
7
+
8
+ * **docker:** support standalone cross-platform setup ([#988](https://github.com/boadij/pi-herdsman/issues/988)) ([f051582](https://github.com/boadij/pi-herdsman/commit/f051582e2a25c8a989fe0cb959a4aee7985e499c))
9
+
10
+
11
+ ### Fixes
12
+
13
+ * **agent:** distinguish owner input from notifications ([#1004](https://github.com/boadij/pi-herdsman/issues/1004)) ([dacffc6](https://github.com/boadij/pi-herdsman/commit/dacffc628ef6839340c415191a67bd3bbe2c3210)), closes [#998](https://github.com/boadij/pi-herdsman/issues/998)
14
+ * **coordination:** clarify assignment and execution routing ([#1005](https://github.com/boadij/pi-herdsman/issues/1005)) ([51aa9fe](https://github.com/boadij/pi-herdsman/commit/51aa9fe4a99931731fdef06c061059b05d4152f4)), closes [#990](https://github.com/boadij/pi-herdsman/issues/990) [#997](https://github.com/boadij/pi-herdsman/issues/997)
15
+ * **coordination:** clarify identity, capabilities, and decision boundaries ([#996](https://github.com/boadij/pi-herdsman/issues/996)) ([7eecae3](https://github.com/boadij/pi-herdsman/commit/7eecae30fa6481e07200831e667ae2d55a35af3d))
16
+ * **lead:** preserve inherited tools across tree navigation ([#1010](https://github.com/boadij/pi-herdsman/issues/1010)) ([764a85e](https://github.com/boadij/pi-herdsman/commit/764a85e47c77d7a121d0f445776a92fbf248881a)), closes [#1006](https://github.com/boadij/pi-herdsman/issues/1006)
17
+
18
+
19
+ ### Performance
20
+
21
+ * **context:** keep Agent guidance decision-specific ([#1001](https://github.com/boadij/pi-herdsman/issues/1001)) ([2312f82](https://github.com/boadij/pi-herdsman/commit/2312f829f331f6466647e6983588c1d3dbc8d5f3)), closes [#993](https://github.com/boadij/pi-herdsman/issues/993)
22
+
23
+
24
+ ### Documentation
25
+
26
+ * correct stale contracts and simplify documentation ownership ([#1000](https://github.com/boadij/pi-herdsman/issues/1000)) ([fc53c00](https://github.com/boadij/pi-herdsman/commit/fc53c00b340d99a75fe4f25d9443294507f91eaa))
27
+ * run corrective validation before final formatting ([#994](https://github.com/boadij/pi-herdsman/issues/994)) ([c96a296](https://github.com/boadij/pi-herdsman/commit/c96a296345b7736dad301578c91354134f0fb94e))
28
+
29
+
30
+ ### Tests
31
+
32
+ * **runtime:** isolate inherited model restoration in tests ([#1003](https://github.com/boadij/pi-herdsman/issues/1003)) ([ce17148](https://github.com/boadij/pi-herdsman/commit/ce17148916ab60c887054766e6b60ae285494b4b))
33
+
34
+
35
+ ### Other Changes
36
+
37
+ * **deps:** update dependency oxlint to v1.94.0 ([#1009](https://github.com/boadij/pi-herdsman/issues/1009)) ([1f545cd](https://github.com/boadij/pi-herdsman/commit/1f545cd144211b0704fc44a691c8789b1ab89b9a))
38
+ * **deps:** update ghcr.io/jdx/mise docker tag to v2026.11.9 ([#1008](https://github.com/boadij/pi-herdsman/issues/1008)) ([bc706be](https://github.com/boadij/pi-herdsman/commit/bc706be7c76088091184eeb8812f8bf35ec8f624))
39
+
3
40
  ## [0.48.0](https://github.com/boadij/pi-herdsman/compare/v0.47.1...v0.48.0) (2026-11-15)
4
41
 
5
42
 
@@ -24,3 +24,10 @@ authority or capabilities; continue independently actionable work.
24
24
 
25
25
  Surface findings that may change continuing project requirements to the
26
26
  Manager for evaluation.
27
+
28
+ Treat review findings as evidence, not automatic implementation requests.
29
+ Verify their relevance and impact, then prefer the smallest sufficient fix.
30
+ After substantive changes, use focused regression checks. Preserve required
31
+ security and correctness verification; a clean review may end the cycle.
32
+ Repeat review when remaining risks or changes justify it; run broad validation
33
+ once the implementation is stable enough for meaningful results.
@@ -15,7 +15,17 @@ Mediate when peer communication is unavailable or a project-level decision
15
15
  requires Manager action. Keep coordination limited to the concrete need.
16
16
  Leave technical investigation, implementation, review, validation, and
17
17
  integration to that Lead and its Agents rather than doing or delegating
18
- the work yourself.
18
+ the work yourself. When directing technical work or recovery, specify the
19
+ required outcome and let the Lead use its effective tools and eligible Agents.
20
+ Do not require direct execution or prohibit delegation merely because the task
21
+ can be performed by a capable Agent. An explicit human restriction on
22
+ delegation takes precedence; if it makes the requested work impossible, the
23
+ Lead should report the blocker rather than bypass it.
24
+
25
+ Distinguish readiness for the user's requested deliverable from final
26
+ acceptance of remaining requirements. Do not add unrequested acceptance gates.
27
+ Report incomplete verification explicitly and preserve any actual prerequisite
28
+ to publication or integration.
19
29
 
20
30
  When local Manager merge permission is enabled, you may use `integrate_branch`
21
31
  only for an exact assigned branch after accepting its validated full source
package/dist/index.js CHANGED
@@ -18724,7 +18724,7 @@ function createAgentController(pi, options) {
18724
18724
  const unresolved = unresolvedDirectChildCount === 0 ? "all direct agent assignments are resolved" : `${unresolvedDirectChildCount} direct agent assignment${unresolvedDirectChildCount === 1 ? "" : "s"} remain${unresolvedDirectChildCount === 1 ? "s" : ""} unresolved`;
18725
18725
  const content = `Delegation status: ${active2}; ${pending}; ${unresolved}.`;
18726
18726
  return {
18727
- content: unresolvedDirectChildCount ? `${content} ${AGENT_EXECUTION_OWNERSHIP_GUIDANCE} ${AGENT_UNRESOLVED_GUIDANCE}` : content,
18727
+ content: unresolvedDirectChildCount ? `${content} ${AGENT_EXECUTION_OWNERSHIP_GUIDANCE} ${AGENT_UNRESOLVED_NAVIGATION_GUIDANCE}` : content,
18728
18728
  activeDirectChildCount,
18729
18729
  pendingDirectResultCount,
18730
18730
  unresolvedDirectChildCount
@@ -21075,7 +21075,7 @@ ${result.stderr ?? ""}`.trim(),
21075
21075
  pi.sendMessage(
21076
21076
  {
21077
21077
  customType: "pi-herdsman-delegation-guidance",
21078
- content: `${AGENT_EXECUTION_OWNERSHIP_GUIDANCE} ${AGENT_UNRESOLVED_GUIDANCE}`,
21078
+ content: `${AGENT_EXECUTION_OWNERSHIP_GUIDANCE} ${AGENT_UNRESOLVED_NAVIGATION_GUIDANCE}`,
21079
21079
  display: false
21080
21080
  },
21081
21081
  { triggerTurn: true, deliverAs: "steer" }
@@ -21165,7 +21165,7 @@ ${result.stderr ?? ""}`.trim(),
21165
21165
  name: "delegate_agent",
21166
21166
  label: "delegate agent",
21167
21167
  exposure: "direct",
21168
- description: "Start one fresh bounded assignment. Choose the most focused eligible Agent definition capable of completing the full task. Use a general-purpose definition when broader capabilities are needed or no focused definition fits.",
21168
+ description: "Start one fresh bounded assignment. Choose the most focused eligible Agent definition capable of completing the full task using its effective tools. The Agent roster describes potential child capabilities, not your own callable tools. Parent and child tool permissions are independent; delegation does not grant either session the other's tools. Prefer the most focused definition; use a general-purpose definition when broader capabilities are needed or no focused definition fits.",
21169
21169
  parameters: agentDelegateParameters,
21170
21170
  promptSnippet: void 0,
21171
21171
  promptGuidelines: [FILE_HANDOFF_GUIDANCE],
@@ -22440,7 +22440,7 @@ function collectSessionUsage(ctx, ownedChildren, openOwnedSession, leadRoots = [
22440
22440
  breakdown
22441
22441
  };
22442
22442
  }
22443
- var delegationLockPath, claimDelegationLock, waitForDelegationLock, SHARED_AGENT_INSTRUCTIONS, INTEGRATION_SESSION_RETRY_MS, INTEGRATION_SESSION_RETRIES, HEALTH_STALE_AFTER_MS, HEALTH_STALE_SCAN_MS, HEALTH_STALE_DIAGNOSTIC_TIMEOUT_MS, HEALTH_STALE_DIAGNOSTIC_LINES, HEALTH_ATTENTION_REPEAT_MIN_MS, HEALTH_ATTENTION_FIRST_REPEAT_MS, AGENT_LABEL_PATTERN, validAgentLabel, modelToken, messageLimits, AGENT_DEFINITION_ENTRY, AGENT_EXECUTION_OWNERSHIP_GUIDANCE, AGENT_UNRESOLVED_GUIDANCE, AGENT_DELEGATION_GUIDANCE, AGENT_HANDOFF_GUIDANCE, LEAD_SCOPE_DESCRIPTION, DELEGATING_AGENT_SCOPE_DESCRIPTION, STOP_CLOSURE_ENTRY, ACCEPTED_ASSIGNMENT_ENTRY, RESULT_REF_ENTRY, TRANSCRIPT_MAX_BYTES, TRANSCRIPT_TOOL_RESULT_MAX_BYTES, TRANSCRIPT_TOOL_RESULT_OMISSION;
22443
+ var delegationLockPath, claimDelegationLock, waitForDelegationLock, SHARED_AGENT_INSTRUCTIONS, INTEGRATION_SESSION_RETRY_MS, INTEGRATION_SESSION_RETRIES, HEALTH_STALE_AFTER_MS, HEALTH_STALE_SCAN_MS, HEALTH_STALE_DIAGNOSTIC_TIMEOUT_MS, HEALTH_STALE_DIAGNOSTIC_LINES, HEALTH_ATTENTION_REPEAT_MIN_MS, HEALTH_ATTENTION_FIRST_REPEAT_MS, AGENT_LABEL_PATTERN, validAgentLabel, modelToken, messageLimits, AGENT_DEFINITION_ENTRY, AGENT_EXECUTION_OWNERSHIP_GUIDANCE, AGENT_UNRESOLVED_NAVIGATION_GUIDANCE, AGENT_UNRESOLVED_GUIDANCE, AGENT_DELEGATION_GUIDANCE, AGENT_HANDOFF_GUIDANCE, LEAD_SCOPE_DESCRIPTION, DELEGATING_AGENT_SCOPE_DESCRIPTION, STOP_CLOSURE_ENTRY, ACCEPTED_ASSIGNMENT_ENTRY, RESULT_REF_ENTRY, TRANSCRIPT_MAX_BYTES, TRANSCRIPT_TOOL_RESULT_MAX_BYTES, TRANSCRIPT_TOOL_RESULT_OMISSION;
22444
22444
  var init_agent_controller = __esm({
22445
22445
  "extension/agent-controller.ts"() {
22446
22446
  "use strict";
@@ -22507,7 +22507,7 @@ rejected. Retained assignment evidence may instead be presented by an authorized
22507
22507
  semantic reference and retrieved with \`read_evidence\`. Reuse adequate existing
22508
22508
  evidence instead of repeating completed
22509
22509
  work.
22510
- Do not overlap writers in a worktree or file-ownership boundary. For dependent
22510
+ Do not overlap writers in a worktree or file-ownership boundary. When assessing competing execution, compare observed session and process identity with your verified direct owner before treating a process as an independent writer. A matching session ID alone does not prove exclusive execution or authorize overlapping writes. For dependent
22511
22511
  work, pass reusable direct-agent result refs through \`files\`. Preserve
22512
22512
  canonical result:<request-id> refs already supplied as file evidence exactly
22513
22513
  when forwarding them.
@@ -22524,10 +22524,18 @@ the normal final handoff, or for an explicitly requested meaningful
22524
22524
  checkpoint. Do not send routine progress, duplicate an imminent final result,
22525
22525
  or notify merely to show activity.
22526
22526
 
22527
- Use await_owner only for a required owner decision that prevents further
22528
- correct progress. Complete independently safe work first. Do not ask for
22529
- decisions already settled by the assignment, existing evidence, or your
22530
- delegated authority. After an accepted await_owner call, end your turn;
22527
+ Use await_owner only when required input from your direct
22528
+ owner prevents further correct progress: an unresolved decision,
22529
+ authorization, or specific information the owner must supply.
22530
+ Complete independently safe work first. Do not ask for progress,
22531
+ repeat an already pending request, or reopen a settled decision
22532
+ without materially new evidence.
22533
+
22534
+ If a required owner-provided readiness signal will only become
22535
+ available later, one pending await_owner request may preserve the
22536
+ assignment until that signal arrives. Do not require an
22537
+ immediate acknowledgment or repeatedly ask when it will arrive.
22538
+ After an accepted await_owner call, end your turn;
22531
22539
  Herdsman retains the blocked assignment until the owner replies. Explicit attachments must be supported UTF-8
22532
22540
  text fully embedded within the applicable per-file and complete-message
22533
22541
  budgets. Call await_owner alone as the final tool call of the turn. Wait for the
@@ -22563,7 +22571,8 @@ blockers, remaining work, and reusable paths or artifacts.`;
22563
22571
  };
22564
22572
  AGENT_DEFINITION_ENTRY = "pi-herdsman-agent-definition";
22565
22573
  AGENT_EXECUTION_OWNERSHIP_GUIDANCE = "Each unresolved unit of work has one executor. Using delegate_agent transfers that assignment's execution ownership to the Agent until it resolves. After delegation succeeds, stop executing, inspecting, or analyzing that delegated scope locally; do not assign overlapping work. Continue only concrete, necessary work clearly outside the delegated scope that you still own.";
22566
- AGENT_UNRESOLVED_GUIDANCE = "Use list_agents when fresh Agent state or ownership is materially needed for a control or recovery decision, or to refresh the definition roster; do not use it for progress polling. Follow current available_tools and revalidation: steer_agent queues a cooperative correction for Pi to deliver after the current assistant turn and its tool calls reach a steering boundary; it does not preempt the current operation. interrupt_agent cancels the current operation and replaces its direction. Use reply_agent only to answer that Agent's exact pending await_owner question. stop_agent abandons an eligible Agent generation and its unfinished assignment. inspect_agent provides bounded live terminal/process evidence; read_agent_transcript provides bounded persisted conversation/tool evidence. When Agent work is unresolved, handle required control, then continue only necessary work you still own or end the turn without concluding; results or attention resume the session automatically. Do not poll with status requests, sleep, or other waiting mechanisms. Stale health attention is diagnosis, not progress polling: use attached evidence first and, when absent or insufficient, perform at most one bounded diagnostic read before passive waiting. A repeated reminder for the same stale episode is additional recovery evidence: unchanged qualifying activity means the Agent has not crossed an execution boundary since the previous reminder. A steer queued during that unchanged episode cannot have taken effect yet. Do not repeat diagnostic reads solely because a reminder fired. Continue waiting only while existing evidence still positively supports a legitimate long-running operation; otherwise use interrupt_agent to stop the current operation and continue the same assignment. A proven lost Agent remains unresolved; physical disappearance is not completion. A physically unknown Agent remains fail-closed: do not control, close, replace, or infer completion of that generation. Unknown Agent identity does not by itself prove a currently active competing writer. For a concrete recovery decision, use available current evidence and at most one bounded diagnostic read when necessary; distinguish historical Agent identity from current execution and delegated scope. Continue necessary independent work that remains authorized and has no unresolved execution conflict. Do not take over the Agent's unresolved assignment. Do not take over or replace unresolved delegated work until the current generation is resolved or explicitly closed. If evidence is insufficient to exclude competing execution, preserve the affected scope and identify the specific missing evidence or external action. Do not repeat the same identity investigation without new evidence.";
22574
+ AGENT_UNRESOLVED_NAVIGATION_GUIDANCE = "When Agent work is unresolved, handle required control, then continue only necessary work you still own or end the turn without concluding; results or attention resume the session automatically. Do not poll with status requests, sleep, or other waiting mechanisms.";
22575
+ AGENT_UNRESOLVED_GUIDANCE = `Use list_agents when fresh Agent state or ownership is materially needed for a control or recovery decision, or to refresh the definition roster; do not use it for progress polling. Follow current available_tools and revalidation: steer_agent queues a cooperative correction for Pi to deliver after the current assistant turn and its tool calls reach a steering boundary; it does not preempt the current operation. interrupt_agent cancels the current operation and replaces its direction. Use reply_agent only to answer that Agent's exact pending await_owner question. stop_agent abandons an eligible Agent generation and its unfinished assignment. inspect_agent provides bounded live terminal/process evidence; read_agent_transcript provides bounded persisted conversation/tool evidence. ${AGENT_UNRESOLVED_NAVIGATION_GUIDANCE} Stale health attention is diagnosis, not progress polling: use attached evidence first and, when absent or insufficient, perform at most one bounded diagnostic read before passive waiting. A repeated reminder for the same stale episode is additional recovery evidence: unchanged qualifying activity means the Agent has not crossed an execution boundary since the previous reminder. A steer queued during that unchanged episode cannot have taken effect yet. Do not repeat diagnostic reads solely because a reminder fired. Continue waiting only while existing evidence still positively supports a legitimate long-running operation; otherwise use interrupt_agent to stop the current operation and continue the same assignment. A proven lost Agent remains unresolved; physical disappearance is not completion. A physically unknown Agent remains fail-closed: do not control, close, replace, or infer completion of that generation. Unknown Agent identity does not by itself prove a currently active competing writer. For a concrete recovery decision, use available current evidence and at most one bounded diagnostic read when necessary; distinguish historical Agent identity from current execution and delegated scope. Continue necessary independent work that remains authorized and has no unresolved execution conflict. Do not take over the Agent's unresolved assignment. Do not take over or replace unresolved delegated work until the current generation is resolved or explicitly closed. If evidence is insufficient to exclude competing execution, preserve the affected scope and identify the specific missing evidence or external action. Do not repeat the same identity investigation without new evidence.`;
22567
22576
  AGENT_DELEGATION_GUIDANCE = "Delegate bounded execution work when an Agent can reasonably own it and delegation is useful. Keep work local when it is trivial, inseparable from work you must own, otherwise unsuitable for an Agent, or delegation would add more coordination than value.";
22568
22577
  AGENT_HANDOFF_GUIDANCE = "When delegating a bounded task, prefer continue_agent if a known exact historical managed-Agent Pi session carries substantial context relevant to that task and remains eligible; otherwise use delegate_agent to start fresh from a definition. When a result ref is shown, prefer it to the exact session UUID or path. Retired sessions cannot be continued while context retirement is enabled. If further work is needed, delegate a fresh Agent with the prior handoff and relevant files. Each live Agent generation exists for one assignment; after its terminal result is delivered, Herdsman cleans up that generation. Agent labels identify the current live generation; exact Pi sessions identify historical context and continuation. For new or updated assignments, `task`/`message` and `files` carry assignment evidence. Accepted managed-Agent tasks are retained for descendants as context, not authority; ordinary attachments remain per handoff unless retained. Explicit Agent attachments must contain complete supported UTF-8 text within configured limits, or the handoff is rejected. Retained assignment evidence can instead be presented by an authorized semantic reference and retrieved with read_evidence. Do not attach or mention agent instruction files such as AGENTS.md, CLAUDE.md, GEMINI.md, or equivalents merely because they exist. Rely on normal project or runtime discovery when it supplies those instructions. Attach such a file only when the task itself requires inspecting, modifying, comparing, or transmitting it, the user explicitly requests it, or required instructions would not otherwise reach the target. Skills are separate; attach SKILL.md only when the task needs it and the selected definition does not already provide that skill.";
22569
22578
  LEAD_SCOPE_DESCRIPTION = `Own architecture, approved scope, acceptance of Agent outputs, integration, conflict resolution,
@@ -22573,6 +22582,7 @@ dependent work, to the recipient through \`files\`; omit unrelated evidence and
22573
22582
  required version, but explicitly forward changed versions. Summaries do not transfer
22574
22583
  evidence; a supervisor message does not transfer it to the child.
22575
22584
  Decompose only as far as useful.
22585
+ Reassess the remaining authorized objective after each handoff, including verification and requested delivery. If your effective tools cannot perform necessary work, consider an eligible Agent with suitable effective capabilities before reporting a blocker. Agent capability summaries do not prove installed tools, credentials, or external authorization. Verify outcomes from returned evidence; if no permitted execution route exists, report the specific limitation without claiming completion. Respect explicit restrictions on delegation.
22576
22586
  Reuse adequate existing evidence instead of duplicating work.
22577
22587
  Your herd is your internal team: you and your recursively owned Agents.
22578
22588
  Any review conducted within the herd is internal feedback, not user or supervisor
@@ -23705,15 +23715,15 @@ function registerManagedAgentAskOwnerTool(pi, execute) {
23705
23715
  name: "await_owner",
23706
23716
  label: "Ask owner",
23707
23717
  exposure: "model-only",
23708
- promptSnippet: "Ask this managed agent's direct owner for a required decision",
23718
+ promptSnippet: "Request essential input from this managed Agent's direct owner",
23709
23719
  promptGuidelines: [FILE_HANDOFF_GUIDANCE],
23710
- 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.",
23720
+ description: "Request a necessary owner decision, authorization, or specific input required to continue. A future readiness signal may remain pending until available. Do not use this for progress polling. Call alone as the final tool call of the turn; wait for the reply only after acceptance. Only one question may be outstanding.",
23711
23721
  executionMode: "sequential",
23712
23722
  parameters: Type2.Object(
23713
23723
  {
23714
23724
  question: Type2.String({
23715
23725
  minLength: 1,
23716
- description: "Non-empty decision question required to continue."
23726
+ description: "Non-empty request for required direct-owner input."
23717
23727
  }),
23718
23728
  files
23719
23729
  },
@@ -24648,9 +24658,11 @@ function registerManagedAgentRuntime(pi, options) {
24648
24658
  pi.on("before_agent_start", (event, ctx) => {
24649
24659
  const definition = process.env.PI_HERDSMAN_AGENT_DEFINITION;
24650
24660
  const label = process.env.PI_HERDSMAN_LABEL;
24661
+ const owner = execution.initialized ? execution.assignment : void 0;
24651
24662
  event.systemPromptOptions.sections.pi_herdsman_agent = [
24652
24663
  `identity: ${displayIdentity(definition, label)}`,
24653
- `direct_owner: ${process.env.PI_HERDSMAN_OWNER_DISPLAY}`
24664
+ `direct_owner: ${process.env.PI_HERDSMAN_OWNER_DISPLAY}`,
24665
+ ...owner ? [`direct_owner_session: ${owner.ownerSessionId}`] : []
24654
24666
  ].join("\n");
24655
24667
  if (delegationEnabled) {
24656
24668
  const roster = startupDefinitionRoster;
@@ -25859,7 +25871,7 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
25859
25871
  // package.json
25860
25872
  var package_default = {
25861
25873
  name: "pi-herdsman",
25862
- version: "0.48.0",
25874
+ version: "0.49.0",
25863
25875
  type: "module",
25864
25876
  description: "Asynchronous Pi subagents and agent fleet orchestration for parallel coding agents with nested delegation, background work, and supervision in herdr.",
25865
25877
  license: "Apache-2.0",
@@ -25950,7 +25962,7 @@ var package_default = {
25950
25962
  "@types/node": "22.20.5",
25951
25963
  "@types/proper-lockfile": "4.1.4",
25952
25964
  esbuild: "^0.28.2",
25953
- oxlint: "1.93.0",
25965
+ oxlint: "1.94.0",
25954
25966
  prettier: "3.10.1",
25955
25967
  typebox: "^1.3.7",
25956
25968
  typescript: "7.0.2"
@@ -37061,12 +37073,14 @@ function registerLeadRuntime(pi, options) {
37061
37073
  pi.setActiveTools(executionTools());
37062
37074
  return;
37063
37075
  }
37076
+ const restoredTools = pi.getActiveTools();
37077
+ const branch = ctx.sessionManager.getBranch();
37078
+ const sessionId = ctx.sessionManager.getSessionId();
37064
37079
  let saved;
37080
+ let branchRole;
37065
37081
  try {
37066
- saved = sessionLeadExecutionState(
37067
- ctx.sessionManager.getBranch(),
37068
- ctx.sessionManager.getSessionId()
37069
- );
37082
+ saved = sessionLeadExecutionState(branch, sessionId);
37083
+ branchRole = roleHost.sessionLeadRoleState(branch, sessionId);
37070
37084
  } catch (error2) {
37071
37085
  leadExecution = {
37072
37086
  mode: leadExecution?.mode ?? options.commandHost.readConfig().defaultLeadExecution,
@@ -37075,11 +37089,33 @@ function registerLeadRuntime(pi, options) {
37075
37089
  };
37076
37090
  throw error2;
37077
37091
  }
37078
- const baseline = saved ? [...saved.leadTools] : leadToolState.normalizeBaseTools(pi.getActiveTools());
37092
+ const baseline = saved ? [...saved.leadTools] : leadToolState.normalizeBaseTools(restoredTools);
37079
37093
  const mode = saved?.mode ?? options.commandHost.readConfig().defaultLeadExecution;
37080
37094
  leadToolState.setLeadTools(baseline);
37095
+ const currentExecution = () => leadExecution;
37081
37096
  leadExecution = { mode, valid: false, managed: !!leadExecution?.managed };
37082
37097
  await restoreLeadExecution(ctx);
37098
+ let checkpointIndex = -1;
37099
+ let toolChangeIndex = -1;
37100
+ for (const [index, entry] of branch.entries()) {
37101
+ if (entry.type === "custom" && entry.data?.sessionId === sessionId && (entry.customType === "pi-herdsman-lead-execution" || entry.customType === "pi-herdsman-role"))
37102
+ checkpointIndex = index;
37103
+ if (entry.type === "message" && entry.message.role === "system" && ((entry.message.toolsAdded?.length ?? 0) > 0 || (entry.message.toolsRemoved?.length ?? 0) > 0))
37104
+ toolChangeIndex = index;
37105
+ }
37106
+ const restoredExecution = currentExecution();
37107
+ if (saved && sessionKind?.kind === "ordinary" && (branchRole?.role ?? "lead") === "lead" && restoredExecution?.valid && !restoredExecution.managed && toolChangeIndex > checkpointIndex) {
37108
+ const policy = configuredToolPolicy(restoredExecution.definition, []);
37109
+ if (policy.mode === "inherit") {
37110
+ const excluded = (name) => policy.excluded.some((pattern) => matchesToolPattern(pattern, name));
37111
+ leadToolState.setLeadTools(
37112
+ leadToolState.normalizeBaseTools([
37113
+ ...restoredTools.filter((name) => !excluded(name)),
37114
+ ...baseline.filter(excluded)
37115
+ ])
37116
+ );
37117
+ }
37118
+ }
37083
37119
  pi.setActiveTools(executionTools());
37084
37120
  };
37085
37121
  const agentEvents = createLeadAgentEventRuntime({
@@ -42448,7 +42484,7 @@ var MANAGED_LEAD_GUIDANCE = `Managed Lead identity is permanent for this exact P
42448
42484
  For a verified managed project assignment, assignment required evidence is automatically inherited by newly accepted descendant Agent assignments; sibling Lead assignments do not automatically inherit it.
42449
42485
  A Lead's delegation task and ordinary files are recipient-specific; they do not create assignment requirements.
42450
42486
  When a previous Agent execution is unresolvable, retain its unresolved assignment and preserve its execution scope. Assess current competing execution separately from historical Agent identity. Continue independently authorized work when current evidence permits it. Escalate only a concrete blocker that cannot be resolved through existing controls.
42451
- Only the Manager can designate continuing requirements for an assignment.
42487
+ Only the Manager can designate continuing requirements for an assignment. When a proposed scope or continuing-requirement change needs Manager authorization, do not execute or delegate that change before the decision. Continue independently authorized work.
42452
42488
  An overlap with another assignment or unanswered coordination message does not itself block your assignment. Continue independently safe work. Defer only steps requiring a concrete prerequisite, an authoritative sequencing decision, or verified writer safety. Escalate a specific cross-assignment decision when needed; if no actionable work remains, report the blocker in your normal response and end the turn rather than polling.
42453
42489
  For assigned project work, include findings, proposed continuing
42454
42490
  requirements, validation, completion, and review readiness in your
@@ -42477,6 +42513,7 @@ If a concrete cross-assignment blocker requires a scope, priority, sequencing,
42477
42513
  or other project-level decision not settled by existing user instructions,
42478
42514
  report the evidence and affected work to the user for direction before
42479
42515
  redirecting Leads. Keep unaffected assignments progressing independently.
42516
+ For a new objective requiring independent project-assignment ownership, use delegate_work when authorized; do not route it through message_staff to an unrelated existing Lead. message_staff changes or coordinates work within an existing assignment; resume_work recovers a paused assignment. list_staff reports current assignments and direct reports, not a limit on creating another assignment. Keep work with an existing Lead when the user intends that ownership and the existing assignment authorizes it.
42480
42517
  For assigned project work, use message_staff when the assignment is active, including when its Lead's runtime state is idle or done. Use resume_work to recover a paused assignment with fresh instructions. Unknown or conflicted assignment state is not evidence that the Lead is stopped. A successfully queued instruction must not be resent merely because the Lead was already running; queue acceptance is not delivery confirmation.
42481
42518
  ${SUPERVISION_EVENT_GUIDANCE}`;
42482
42519
  var SUPERVISION_CONTEXT_TYPE = "pi-herdsman-supervision-context";
@@ -42940,7 +42977,12 @@ If needed, install the Pi integration once:
42940
42977
 
42941
42978
  ${ask.question}
42942
42979
 
42943
- Use reply_agent with agent="${ask.agentLabel}" to answer this question.`,
42980
+ Use reply_agent with agent="${ask.agentLabel}" to answer this question.
42981
+
42982
+ Reply only when you can provide the requested input or an
42983
+ actionable alternative. For an external condition that is not
42984
+ yet satisfied, leave the question pending rather than replying
42985
+ with a promise to provide the answer later.`,
42944
42986
  display: true,
42945
42987
  details: {
42946
42988
  askId: ask.askId,
@@ -42964,7 +43006,9 @@ Use reply_agent with agent="${ask.agentLabel}" to answer this question.`,
42964
43006
  customType: "pi-herdsman-agent-owner-message",
42965
43007
  content: `Agent ${ownerMessage.agentLabel} notification:
42966
43008
 
42967
- ${ownerMessage.text}`,
43009
+ ${ownerMessage.text}
43010
+
43011
+ This is a nonblocking notification, not a pending await_owner request. Do not use reply_agent to acknowledge it. Use eligible Agent control only when an actual correction is needed.`,
42968
43012
  display: true,
42969
43013
  details: {
42970
43014
  messageId: ownerMessage.messageId,