pi-subagents 0.82.1 → 0.83.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/bundle/agents.js +5 -5
  3. package/bundle/background-work.js +1 -1
  4. package/bundle/capability-ceiling.js +1 -1
  5. package/bundle/child-tool-plan.js +4 -4
  6. package/bundle/{chunk-RMQFMMAT.js → chunk-2D52JFLF.js} +231 -10
  7. package/bundle/{chunk-52UBALJL.js → chunk-2DHZTCOL.js} +2 -2
  8. package/bundle/{chunk-43SCHIMD.js → chunk-2S4K53MV.js} +1 -1
  9. package/bundle/{chunk-IVAE5Z6Q.js → chunk-5YIITCPD.js} +31 -27
  10. package/bundle/{chunk-JYUKW2SY.js → chunk-AHIFYGR3.js} +13 -13
  11. package/bundle/{chunk-XSWOTIA3.js → chunk-C5P5CHYK.js} +1 -1
  12. package/bundle/{chunk-PDZWJCHD.js → chunk-C7JMPU5F.js} +10 -7
  13. package/bundle/{chunk-5TYMSZX3.js → chunk-D3JAFGMO.js} +2 -2
  14. package/bundle/{chunk-OYF6AFDY.js → chunk-F4ASL6OV.js} +2 -2
  15. package/bundle/{chunk-ZIV4J4HG.js → chunk-F5DBXJ2G.js} +51 -34
  16. package/bundle/{chunk-YKEWIB4M.js → chunk-G2Z6ZH26.js} +1 -1
  17. package/bundle/{chunk-G4GZD3OJ.js → chunk-IPGZMQXV.js} +11 -11
  18. package/bundle/{chunk-5LFLVSTM.js → chunk-JEZOSEWG.js} +2 -0
  19. package/bundle/{chunk-PLCCBLPY.js → chunk-LFDBD4PW.js} +2 -2
  20. package/bundle/{chunk-CIZQXJ5Q.js → chunk-LNRJCP2Y.js} +56 -20
  21. package/bundle/{chunk-UTT254JE.js → chunk-MABL3FUM.js} +8 -4
  22. package/bundle/{chunk-3JCDWF4V.js → chunk-NPIYWVOD.js} +12 -18
  23. package/bundle/{chunk-UCPP4GNU.js → chunk-QP5ZWNIS.js} +12 -5
  24. package/bundle/{chunk-Z7KVHQHL.js → chunk-QXASAHIA.js} +2 -2
  25. package/bundle/{chunk-46XKCPJR.js → chunk-RNIZLSEA.js} +2221 -3260
  26. package/bundle/{chunk-GJECHSAR.js → chunk-SSG7IEP5.js} +2 -2
  27. package/bundle/{chunk-VSUSLDNW.js → chunk-UFL7IYCW.js} +10 -8
  28. package/bundle/{chunk-QE4AGIMG.js → chunk-UUP372DR.js} +482 -705
  29. package/bundle/{chunk-6XJB7PIX.js → chunk-UYK5MZWE.js} +16 -12
  30. package/bundle/{chunk-4SDU2BZX.js → chunk-V2BZYLEP.js} +3 -3
  31. package/bundle/{chunk-FXUXCX2K.js → chunk-VLFZIN6D.js} +6 -6
  32. package/bundle/{chunk-N2BN7BF5.js → chunk-XA3DY6UG.js} +7 -5
  33. package/bundle/{chunk-PBK2I7WY.js → chunk-YXFJVCOL.js} +6 -6
  34. package/bundle/{chunk-4Y2ROR7L.js → chunk-ZVOAMTUQ.js} +5 -5
  35. package/bundle/control-channel.js +4 -4
  36. package/bundle/index.js +1 -1
  37. package/bundle/intercom-bridge.js +4 -4
  38. package/bundle/preflight.js +10 -10
  39. package/bundle/project-panes.js +5 -5
  40. package/bundle/shared-types.js +1 -1
  41. package/docs/configuration.md +13 -2
  42. package/docs/extension-api.md +21 -4
  43. package/docs/missions.md +2 -0
  44. package/docs/observability.md +1 -0
  45. package/docs/tool-reference.md +2 -2
  46. package/package.json +1 -1
  47. package/skills/pi-subagents/SKILL.md +6 -6
  48. package/src/agents/agent-management.d.ts +1 -1
  49. package/src/agents/agent-management.js +10 -16
  50. package/src/agents/agent-serializer.js +1 -2
  51. package/src/agents/agents.js +20 -5
  52. package/src/agents/frontmatter.js +22 -18
  53. package/src/api/background-work.d.ts +9 -6
  54. package/src/api/background-work.js +14 -7
  55. package/src/extension/index.js +6 -3
  56. package/src/extension/public-execution.d.ts +2 -2
  57. package/src/extension/public-execution.js +3 -3
  58. package/src/extension/reply-workflow-script.js +4 -5
  59. package/src/extension/rpc.js +3 -1
  60. package/src/extension/subagent-options.js +17 -4
  61. package/src/missions/actions.js +7 -2
  62. package/src/missions/lifecycle.d.ts +11 -0
  63. package/src/missions/lifecycle.js +37 -6
  64. package/src/missions/store.js +1 -0
  65. package/src/missions/types.d.ts +2 -0
  66. package/src/runs/background/async-execution.d.ts +1 -1
  67. package/src/runs/background/async-execution.js +7 -4
  68. package/src/runs/background/async-job-tracker.js +2 -1
  69. package/src/runs/background/async-resume.js +3 -2
  70. package/src/runs/background/auto-drain.js +2 -3
  71. package/src/runs/background/fleet-view.js +1 -1
  72. package/src/runs/background/retained-children.js +1 -1
  73. package/src/runs/background/run-child-session.js +22 -6
  74. package/src/runs/background/subagent-wait.d.ts +2 -1
  75. package/src/runs/background/subagent-wait.js +5 -2
  76. package/src/runs/foreground/execution.js +22 -6
  77. package/src/runs/foreground/subagent-executor.js +26 -56
  78. package/src/runs/shared/capability-ceiling.d.ts +2 -1
  79. package/src/runs/shared/capability-ceiling.js +3 -2
  80. package/src/runs/shared/child-launch.js +5 -2
  81. package/src/runs/shared/child-session.d.ts +6 -0
  82. package/src/runs/shared/child-session.js +20 -4
  83. package/src/runs/shared/herdr-machine.d.ts +2 -0
  84. package/src/runs/shared/herdr-machine.js +2 -0
  85. package/src/runs/shared/herdr-placed-run.js +11 -4
  86. package/src/runs/shared/parallel-handoff.d.ts +1 -1
  87. package/src/runs/shared/parallel-handoff.js +10 -6
  88. package/src/runs/shared/subagent-prompt-runtime.js +11 -17
  89. package/src/shared/disabled-features.d.ts +3 -1
  90. package/src/shared/disabled-features.js +11 -3
  91. package/src/shared/types.d.ts +4 -2
  92. package/src/shared/types.js +2 -0
  93. package/src/workflows/scripted-workflow.js +13 -1071
  94. package/workflow-script-worker.cjs +1068 -0
@@ -6,35 +6,35 @@ import {
6
6
  resolveWorkflowForegroundSteeringTarget,
7
7
  steerAsyncRun,
8
8
  steerWorkflowForegroundTarget
9
- } from "./chunk-PBK2I7WY.js";
9
+ } from "./chunk-YXFJVCOL.js";
10
10
  import {
11
11
  FLEET_STATUS_WIDGET_KEY,
12
12
  reportFleetWarning,
13
13
  runningTone,
14
14
  stepTaskSummary
15
- } from "./chunk-4Y2ROR7L.js";
15
+ } from "./chunk-ZVOAMTUQ.js";
16
16
  import {
17
17
  foregroundChildStateLabel,
18
18
  formatAsyncRunTranscript,
19
19
  stopAsyncRun
20
- } from "./chunk-FXUXCX2K.js";
20
+ } from "./chunk-VLFZIN6D.js";
21
21
  import {
22
22
  contextModeBadge,
23
23
  contextModeLabel,
24
24
  decodeUtf8Tail,
25
25
  listAsyncRuns
26
- } from "./chunk-6XJB7PIX.js";
27
- import "./chunk-46XKCPJR.js";
28
- import "./chunk-OYF6AFDY.js";
26
+ } from "./chunk-UYK5MZWE.js";
27
+ import "./chunk-RNIZLSEA.js";
28
+ import "./chunk-F4ASL6OV.js";
29
29
  import "./chunk-NIXWDZZV.js";
30
- import "./chunk-XSWOTIA3.js";
30
+ import "./chunk-C5P5CHYK.js";
31
31
  import "./chunk-7F6RKT6W.js";
32
32
  import "./chunk-CTPAE36Y.js";
33
33
  import "./chunk-7J4ZXMY7.js";
34
34
  import {
35
35
  getArtifactPaths,
36
36
  getArtifactsDir
37
- } from "./chunk-5TYMSZX3.js";
37
+ } from "./chunk-D3JAFGMO.js";
38
38
  import {
39
39
  snapshotExternalRuns
40
40
  } from "./chunk-UKG4V45O.js";
@@ -46,12 +46,12 @@ import {
46
46
  formatTokens,
47
47
  readStatus,
48
48
  shortenPath
49
- } from "./chunk-CIZQXJ5Q.js";
49
+ } from "./chunk-LNRJCP2Y.js";
50
50
  import {
51
51
  DIRS
52
- } from "./chunk-5LFLVSTM.js";
52
+ } from "./chunk-JEZOSEWG.js";
53
53
  import "./chunk-YFCK7H2S.js";
54
- import "./chunk-Z7KVHQHL.js";
54
+ import "./chunk-QXASAHIA.js";
55
55
 
56
56
  // src/tui/fleet.ts
57
57
  import * as fs from "node:fs";
@@ -15,6 +15,7 @@ var SUBAGENT_CONTROL_EVENT = "subagent:control-event";
15
15
  var SUBAGENT_CONTROL_INTERCOM_EVENT = "subagent:control-intercom";
16
16
  var SUBAGENT_STEERING_NOTICE_EVENT = "subagent:steering-notice";
17
17
  var SUBAGENT_CHILD_STATUS_EVENT = "subagent:child-status";
18
+ var SUBAGENT_JOBS_CHANGED_EVENT = "subagent:jobs-changed";
18
19
  var SUBAGENT_RESULT_INTERCOM_EVENT = "subagent:result-intercom";
19
20
  var SUBAGENT_RESULT_INTERCOM_DELIVERY_EVENT = "subagent:result-intercom-delivery";
20
21
  var FLEET_KEYBINDING_ACTIONS = [
@@ -223,6 +224,7 @@ export {
223
224
  SUBAGENT_CONTROL_INTERCOM_EVENT,
224
225
  SUBAGENT_STEERING_NOTICE_EVENT,
225
226
  SUBAGENT_CHILD_STATUS_EVENT,
227
+ SUBAGENT_JOBS_CHANGED_EVENT,
226
228
  SUBAGENT_RESULT_INTERCOM_EVENT,
227
229
  SUBAGENT_RESULT_INTERCOM_DELIVERY_EVENT,
228
230
  FLEET_KEYBINDING_ACTIONS,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getProjectSubagentsDir
3
- } from "./chunk-5TYMSZX3.js";
3
+ } from "./chunk-D3JAFGMO.js";
4
4
  import {
5
5
  discoverAgents,
6
6
  formatUnknownAgentError,
7
7
  resolveAgentName,
8
8
  unknownAgentDiagnosticContext
9
- } from "./chunk-CIZQXJ5Q.js";
9
+ } from "./chunk-LNRJCP2Y.js";
10
10
 
11
11
  // src/agents/agent-refinements.ts
12
12
  import { createHash, randomUUID } from "node:crypto";
@@ -2,7 +2,7 @@ import {
2
2
  CHAIN_RUNS_DIR,
3
3
  RUNNER_LAUNCHER_NAME_PATTERN,
4
4
  RUNNER_LAUNCHER_NAME_RULE
5
- } from "./chunk-5LFLVSTM.js";
5
+ } from "./chunk-JEZOSEWG.js";
6
6
  import {
7
7
  previewDisplayText,
8
8
  sanitizeDisplayText,
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-YFCK7H2S.js";
11
11
  import {
12
12
  normalizeCapabilityCeilingAllowedAgents
13
- } from "./chunk-Z7KVHQHL.js";
13
+ } from "./chunk-QXASAHIA.js";
14
14
 
15
15
  // src/shared/file-system-retry.ts
16
16
  var WAIT_BUFFER = typeof SharedArrayBuffer !== "undefined" ? new SharedArrayBuffer(4) : void 0;
@@ -338,16 +338,12 @@ function parseFrontmatter(content) {
338
338
  const indent = line.search(/\S|$/);
339
339
  const trimmed = line.trim();
340
340
  if (trimmed.startsWith("#") && !currentFolded && !currentLiteral) continue;
341
- if (currentKey !== null && currentBlockLines !== null && (indent > (currentIndent ?? 0) || (currentFolded || currentLiteral) && trimmed === "")) {
341
+ if (currentKey !== null && currentBlockLines !== null && (indent > (currentIndent ?? 0) || trimmed === "")) {
342
342
  currentBlockLines.push(line);
343
343
  continue;
344
344
  }
345
345
  if (currentKey !== null && currentBlockLines !== null) {
346
- const rawBlock = currentBlockLines.join("\n");
347
- const leadingSpaces = rawBlock.match(/^[ \t]+(?=\S)/m);
348
- const prefix = leadingSpaces?.[0] ?? "";
349
- const stripped = prefix ? rawBlock.replace(new RegExp(`^${escapeRegex(prefix)}`, "gm"), "").replace(/^\n/, "") : rawBlock;
350
- frontmatter[currentKey] = currentFolded ? foldBlock(stripped) : stripped;
346
+ frontmatter[currentKey] = flushBlockLines(currentBlockLines, currentFolded, currentLiteral);
351
347
  currentKey = null;
352
348
  currentBlockLines = null;
353
349
  currentIndent = null;
@@ -378,14 +374,22 @@ function parseFrontmatter(content) {
378
374
  }
379
375
  }
380
376
  if (currentKey !== null && currentBlockLines !== null) {
381
- const rawBlock = currentBlockLines.join("\n");
382
- const leadingSpaces = rawBlock.match(/^[ \t]+(?=\S)/m);
383
- const prefix = leadingSpaces?.[0] ?? "";
384
- const stripped = prefix ? rawBlock.replace(new RegExp(`^${escapeRegex(prefix)}`, "gm"), "").replace(/^\n/, "") : rawBlock;
385
- frontmatter[currentKey] = currentFolded ? foldBlock(stripped) : stripped;
377
+ frontmatter[currentKey] = flushBlockLines(currentBlockLines, currentFolded, currentLiteral);
386
378
  }
387
379
  return { frontmatter, body };
388
380
  }
381
+ function flushBlockLines(blockLines, folded, literal) {
382
+ let lines = blockLines;
383
+ if (!folded && !literal) {
384
+ const end = lines.indexOf("", lines.findLastIndex((line) => line.trim() !== "") + 1);
385
+ lines = lines.slice(lines.findIndex((line) => line !== ""), end < 0 ? lines.length : end);
386
+ }
387
+ const rawBlock = lines.join("\n");
388
+ const leadingSpaces = rawBlock.match(/^[ \t]+(?=\S)/m);
389
+ const prefix = leadingSpaces?.[0] ?? "";
390
+ const stripped = prefix ? rawBlock.replace(new RegExp(`^${escapeRegex(prefix)}`, "gm"), "").replace(/^\n/, "") : rawBlock;
391
+ return folded ? foldBlock(stripped) : stripped;
392
+ }
389
393
 
390
394
  // src/shared/utils.ts
391
395
  import * as fs14 from "node:fs";
@@ -1203,9 +1207,7 @@ function serializeAgent(config, options = {}) {
1203
1207
  }
1204
1208
  if (config.model || preserve("model")) lines.push(`model: ${config.model ?? ""}`);
1205
1209
  if (config.fast === true || preserve("fast")) lines.push(`fast: ${config.fast === void 0 ? "" : config.fast ? "true" : "false"}`);
1206
- if (config.thinking && (config.thinking !== "off" || preserve("thinking")) || !config.thinking && preserve("thinking")) {
1207
- lines.push(`thinking: ${config.thinking ?? ""}`);
1208
- }
1210
+ if (config.thinking || preserve("thinking")) lines.push(`thinking: ${config.thinking ?? ""}`);
1209
1211
  if (!preservingExistingFrontmatter || preserve("systemPromptMode")) lines.push(`systemPromptMode: ${config.systemPromptMode}`);
1210
1212
  if (!preservingExistingFrontmatter || preserve("inheritProjectContext")) lines.push(`inheritProjectContext: ${config.inheritProjectContext ? "true" : "false"}`);
1211
1213
  if (config.inheritGlobalContext || preserve("inheritGlobalContext")) lines.push(`inheritGlobalContext: ${config.inheritGlobalContext ? "true" : "false"}`);
@@ -4232,6 +4234,35 @@ function defaultInheritProjectContext(name) {
4232
4234
  function defaultInheritSkills() {
4233
4235
  return false;
4234
4236
  }
4237
+ var BUILTIN_OVERRIDE_FIELDS = {
4238
+ description: true,
4239
+ advertise: true,
4240
+ machine: true,
4241
+ output: true,
4242
+ outputMode: true,
4243
+ defaultReads: true,
4244
+ model: true,
4245
+ defaultProvider: true,
4246
+ fast: true,
4247
+ thinking: true,
4248
+ systemPromptMode: true,
4249
+ inheritProjectContext: true,
4250
+ inheritGlobalContext: true,
4251
+ inheritSkills: true,
4252
+ defaultContext: true,
4253
+ acceptanceRole: true,
4254
+ disabled: true,
4255
+ systemPrompt: true,
4256
+ skills: true,
4257
+ tools: true,
4258
+ excludeTools: true,
4259
+ allowNestedSubagents: true,
4260
+ allowedAgents: true,
4261
+ extensions: true,
4262
+ subagentOnlyExtensions: true,
4263
+ mutationTools: true,
4264
+ toolBudget: true
4265
+ };
4235
4266
  var EMPTY_SUBAGENT_SETTINGS = { overrides: {}, providerOverrides: {} };
4236
4267
  var agentFrontmatterFields = /* @__PURE__ */ new WeakMap();
4237
4268
  var AGENT_SOURCE_PRIORITY = {
@@ -4830,6 +4861,11 @@ function parseBuiltinOverrideEntry(name, value, filePath) {
4830
4861
  if (Object.hasOwn(input, "launcher")) {
4831
4862
  throw new Error(`Builtin override '${name}' in '${filePath}' sets 'launcher', which settings overrides do not support; set 'launcher' in a user agent file instead.`);
4832
4863
  }
4864
+ for (const key of Object.keys(input)) {
4865
+ if (Object.hasOwn(BUILTIN_OVERRIDE_FIELDS, key)) continue;
4866
+ const suggestion = closestMatch(key, Object.keys(BUILTIN_OVERRIDE_FIELDS));
4867
+ throw new Error(`Builtin override '${name}' in '${filePath}' has unknown field '${key}'.${suggestion ? ` Did you mean '${suggestion}'?` : ""}`);
4868
+ }
4833
4869
  const override = {};
4834
4870
  if ("description" in input) {
4835
4871
  if (typeof input.description === "string" && input.description.trim()) {
@@ -4862,8 +4898,9 @@ function parseBuiltinOverrideEntry(name, value, filePath) {
4862
4898
  else throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'fast'; expected a boolean.`);
4863
4899
  }
4864
4900
  if ("thinking" in input) {
4865
- if (typeof input.thinking === "string" || input.thinking === false) override.thinking = input.thinking;
4866
- else throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'thinking'; expected a string or false.`);
4901
+ const level = THINKING_LEVELS.find((candidate) => candidate === input.thinking);
4902
+ if (level !== void 0 || input.thinking === false) override.thinking = level ?? false;
4903
+ else throw new Error(`Builtin override '${name}' in '${filePath}' has invalid 'thinking'; expected one of ${THINKING_LEVELS.join(", ")}, or false.`);
4867
4904
  }
4868
4905
  if ("systemPromptMode" in input) {
4869
4906
  if (input.systemPromptMode === "append" || input.systemPromptMode === "replace") {
@@ -6110,8 +6147,7 @@ function buildAgentDiscoverySources(cwd, preferredModelProvider, globalNpmRoot,
6110
6147
  const watchPaths = /* @__PURE__ */ new Set([
6111
6148
  userSettingsPath,
6112
6149
  ...projectSettingsPath ? [projectSettingsPath] : [],
6113
- ...projectDiscoveryWatchPaths(effectiveCwd),
6114
- ...findProjectRootCandidates(effectiveCwd).map((root) => path11.join(getProjectConfigDir(root), "settings.json")),
6150
+ ...projectTrusted ? [...projectDiscoveryWatchPaths(effectiveCwd), ...findProjectRootCandidates(effectiveCwd).map((root) => path11.join(getProjectConfigDir(root), "settings.json"))] : [],
6115
6151
  ...userScanDirs.watchPaths,
6116
6152
  ...projectScanDirs.watchPaths,
6117
6153
  ...packageSubagentPaths.watchPaths
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "pi-subagents",
4
- version: "0.82.1",
4
+ version: "0.83.1",
5
5
  private: true,
6
6
  description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
7
7
  author: "Nico Bailon",
@@ -50,6 +50,7 @@ var package_default = {
50
50
  "index.ts",
51
51
  "src/**/*.ts",
52
52
  "*.mjs",
53
+ "workflow-script-worker.cjs",
53
54
  "agents/",
54
55
  "skills/**/*",
55
56
  "prompts/**/*",
@@ -112,14 +113,17 @@ var package_default = {
112
113
  devDependencies: {
113
114
  "@earendil-works/pi-agent-core": "1.2.0",
114
115
  "@earendil-works/pi-ai": "1.2.0",
116
+ "@earendil-works/pi-coding-agent": "1.2.0",
115
117
  "@earendil-works/pi-tui": "1.2.0",
116
118
  "@oxlint/plugins": "1.80.0",
117
119
  "@types/node": "24.13.3",
118
120
  esbuild: "0.28.2",
119
121
  oxlint: "1.80.0",
120
- typescript: "5.9.3",
121
- "@earendil-works/pi-coding-agent": "1.2.0",
122
- typebox: "1.3.27"
122
+ typebox: "1.3.27",
123
+ typescript: "5.9.3"
124
+ },
125
+ overrides: {
126
+ undici: "$undici"
123
127
  }
124
128
  };
125
129
 
@@ -15,15 +15,15 @@ import {
15
15
  resolveCurrentSessionId,
16
16
  resolveWatchdogReviewModel,
17
17
  startWatchdogDiffBaselineCapture
18
- } from "./chunk-VSUSLDNW.js";
18
+ } from "./chunk-UFL7IYCW.js";
19
19
  import {
20
20
  MODEL_ONLY_TOOL,
21
21
  agentStreamOptions,
22
22
  opencodeSessionHeaders
23
- } from "./chunk-6XJB7PIX.js";
23
+ } from "./chunk-UYK5MZWE.js";
24
24
  import {
25
25
  inheritedNestedRouteOf
26
- } from "./chunk-46XKCPJR.js";
26
+ } from "./chunk-RNIZLSEA.js";
27
27
  import {
28
28
  CHILD_WATCHDOG_STATUS_EVENT,
29
29
  MISSING_STRUCTURED_ACCEPTANCE_REPORT_ERROR,
@@ -39,10 +39,10 @@ import {
39
39
  toolBudgetSoftNudge,
40
40
  validateAcceptanceReport,
41
41
  validateStructuredOutputValue
42
- } from "./chunk-CIZQXJ5Q.js";
42
+ } from "./chunk-LNRJCP2Y.js";
43
43
  import {
44
44
  INTERCOM_SESSION_IDENTITY_EVENT
45
- } from "./chunk-5LFLVSTM.js";
45
+ } from "./chunk-JEZOSEWG.js";
46
46
 
47
47
  // src/runs/shared/subagent-prompt-runtime.ts
48
48
  import { createHash } from "node:crypto";
@@ -851,6 +851,7 @@ function registerSubagentPromptRuntime(pi, config, drainObservation) {
851
851
  onRuntimeEvent("session_start", (_event, ctx) => {
852
852
  const sessionManager = ctx?.sessionManager;
853
853
  waitState.currentSessionId = sessionManager ? resolveCurrentSessionId(sessionManager) : null;
854
+ waitState.supervisorOwnerSessionId = sessionManager?.getSessionId() || null;
854
855
  registerNativeSupervisorClientOnce();
855
856
  });
856
857
  onRuntimeEvent("agent_start", () => {
@@ -892,25 +893,18 @@ function registerSubagentPromptRuntime(pi, config, drainObservation) {
892
893
  if (config.forkCacheKey) onRuntimeEvent("before_provider_headers", (event, ctx) => {
893
894
  applyForkSessionAffinity(event?.headers, ctx?.model, config.parentSessionId, readInherited(ctx)?.model);
894
895
  });
895
- if (config.forkCacheKey) onRuntimeEvent("context_with_system", (event, ctx) => {
896
+ onRuntimeEvent("context_with_system", (event, ctx) => {
896
897
  if (!event || typeof event !== "object" || !("messages" in event) || !Array.isArray(event.messages)) return void 0;
897
- const fork = readInherited(ctx);
898
- if (!fork) return void 0;
899
- const messages = projectForkRequest(event.messages, fork.system, fork.forkedAt, { boundary });
900
- return messages === event.messages ? void 0 : { messages };
901
- });
902
- onRuntimeEvent("context", (event, ctx) => {
903
- if (!event || typeof event !== "object" || !("messages" in event) || !Array.isArray(event.messages)) return void 0;
904
- const forkedAt = config.forkCacheKey ? Date.parse(ctx?.sessionManager?.getHeader()?.timestamp ?? "") : Number.NaN;
905
- const messages = stripParentOnlySubagentMessages(event.messages, {
898
+ const fork = config.forkCacheKey ? readInherited(ctx) : void 0;
899
+ const stripped = stripParentOnlySubagentMessages(event.messages, {
906
900
  sanitizeToolIds: !COMPOSITE_TOOL_ID_APIS.has(ctx?.model?.api ?? ""),
907
901
  // Providers that reuse the Codex Responses wire under their own api id (e.g. cliproxyapi-codex-responses) split call_id|item_id the same way.
908
902
  preserveBoundedCompositeToolIds: ctx?.model?.api?.endsWith("-codex-responses") === true,
909
903
  preserveFanoutToolHistory: config.fanoutChild,
910
- ...Number.isFinite(forkedAt) ? { inheritedBefore: forkedAt } : {}
904
+ ...fork ? { inheritedBefore: fork.forkedAt } : {}
911
905
  });
912
- if (messages === event.messages) return void 0;
913
- return { messages };
906
+ const messages = fork ? projectForkRequest(stripped, fork.system, fork.forkedAt, { boundary }) : stripped;
907
+ return messages === event.messages ? void 0 : { messages };
914
908
  });
915
909
  const routingName = config.intercomSessionName;
916
910
  let intercomIdClaimed = false;
@@ -11,19 +11,19 @@ import {
11
11
  validateAuthorityPolicy,
12
12
  validateMissionStoreConfig,
13
13
  validateModelResponseAliases
14
- } from "./chunk-46XKCPJR.js";
14
+ } from "./chunk-RNIZLSEA.js";
15
15
  import {
16
16
  getAgentDir,
17
17
  readStatus,
18
18
  validatePermissionConfig,
19
19
  writePrivateAtomicJson
20
- } from "./chunk-CIZQXJ5Q.js";
20
+ } from "./chunk-LNRJCP2Y.js";
21
21
  import {
22
22
  FLEET_KEYBINDING_ACTIONS,
23
23
  RUNNER_LAUNCHER_NAME_PATTERN,
24
24
  RUNNER_LAUNCHER_NAME_RULE,
25
25
  TEMP_ROOT_DIR
26
- } from "./chunk-5LFLVSTM.js";
26
+ } from "./chunk-JEZOSEWG.js";
27
27
 
28
28
  // src/shared/disabled-features.ts
29
29
  var SUBAGENT_FEATURES = {
@@ -104,16 +104,22 @@ function disabledFeatureUseError(request, surface, label = "subagent") {
104
104
  }
105
105
  return void 0;
106
106
  }
107
+ var WORKFLOW_SCRIPTS_REPLACEMENT = "Instead of workflow scripts, use the top-level tasks or chain fields.";
107
108
  function disabledFeatureNotice(surface) {
108
109
  if (surface.features.size === 0) return void 0;
109
110
  const lines = [...surface.features].map((feature) => {
110
111
  const { actions, params, disabledBy } = featureSurface(feature);
111
112
  const parts = [`options ${params.join(", ")}`, ...actions.length > 0 ? [`actions ${actions.join(", ")}`] : []];
112
- return `- ${disabledBy}: ${parts.join("; ")}`;
113
+ return `- ${disabledBy}: ${parts.join("; ")}${feature === "workflow-scripts" ? `. ${WORKFLOW_SCRIPTS_REPLACEMENT}` : ""}`;
113
114
  });
114
- return `Disabled by config in this session. The reference below still lists these, but calls that use them are rejected:
115
+ return `Disabled by config in this session. The guide below may still describe these, but calls that use them are rejected:
115
116
  ${lines.join("\n")}`;
116
117
  }
118
+ function disabledFeatureSectionNotice(surface) {
119
+ if (surface.features.size === 0) return void 0;
120
+ const replacement = surface.features.has("workflow-scripts") ? ` ${WORKFLOW_SCRIPTS_REPLACEMENT}` : "";
121
+ return `Some options and actions are disabled by config in this session; guide topic tool-reference lists them.${replacement}`;
122
+ }
117
123
 
118
124
  // src/runs/background/active-async-capacity.ts
119
125
  import { createHash, randomUUID } from "node:crypto";
@@ -729,6 +735,7 @@ export {
729
735
  resolveDisabledFeatureSurface,
730
736
  disabledFeatureUseError,
731
737
  disabledFeatureNotice,
738
+ disabledFeatureSectionNotice,
732
739
  ActiveAsyncCapacityError,
733
740
  resolveMaxActiveAsyncRunsPerSession,
734
741
  resolveAbandonedSlotReleaseAfterMs,
@@ -118,8 +118,8 @@ function resolveSubagentCapabilityCeiling(sessionId, inherited) {
118
118
  }
119
119
  return intersectSubagentCapabilityCeilings(inherited, ...active);
120
120
  }
121
- function resolveCurrentSubagentCapabilityCeiling(sessionId) {
122
- return resolveSubagentCapabilityCeiling(sessionId, void 0);
121
+ function resolveCurrentSubagentCapabilityCeiling(piSessionId) {
122
+ return resolveSubagentCapabilityCeiling(piSessionId, void 0);
123
123
  }
124
124
  function isAgentAllowedByCapabilityCeiling(agentName, ceiling) {
125
125
  return ceiling?.allowedAgents === void 0 || ceiling.allowedAgents.includes(agentName);