pi-subagents 0.80.0 → 0.82.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.
Files changed (184) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/bundle/agents.js +18 -0
  3. package/bundle/background-work.js +16 -0
  4. package/bundle/capability-ceiling.js +22 -0
  5. package/bundle/child-tool-plan.js +11 -0
  6. package/bundle/chunk-43SCHIMD.js +57 -0
  7. package/bundle/chunk-4QFZZV3O.js +57 -0
  8. package/bundle/chunk-4SDU2BZX.js +1190 -0
  9. package/bundle/chunk-52UBALJL.js +753 -0
  10. package/bundle/chunk-5LFLVSTM.js +260 -0
  11. package/bundle/chunk-5TYMSZX3.js +235 -0
  12. package/bundle/chunk-62OCY2S4.js +14 -0
  13. package/bundle/chunk-7F6RKT6W.js +132 -0
  14. package/bundle/chunk-7IVSUMQQ.js +1337 -0
  15. package/bundle/chunk-7J4ZXMY7.js +18 -0
  16. package/bundle/chunk-7PCKZHR5.js +1234 -0
  17. package/bundle/chunk-7YMXOYEU.js +1373 -0
  18. package/bundle/chunk-B5EKXDHE.js +16870 -0
  19. package/bundle/chunk-CIZQXJ5Q.js +8619 -0
  20. package/bundle/chunk-CTPAE36Y.js +94 -0
  21. package/bundle/chunk-D4EHT5SJ.js +14 -0
  22. package/bundle/chunk-GC4DSPMH.js +946 -0
  23. package/bundle/chunk-GJECHSAR.js +179 -0
  24. package/bundle/chunk-M2CTFYT3.js +4164 -0
  25. package/bundle/chunk-MHZ4G23A.js +1296 -0
  26. package/bundle/chunk-N2BN7BF5.js +159 -0
  27. package/bundle/chunk-NF7IEKBH.js +490 -0
  28. package/bundle/chunk-NGGAFDL6.js +742 -0
  29. package/bundle/chunk-NIXWDZZV.js +9 -0
  30. package/bundle/chunk-NRQ75MGH.js +8327 -0
  31. package/bundle/chunk-OYF6AFDY.js +458 -0
  32. package/bundle/chunk-PLCCBLPY.js +526 -0
  33. package/bundle/chunk-RMQFMMAT.js +416 -0
  34. package/bundle/chunk-SIJ4S3EN.js +276 -0
  35. package/bundle/chunk-UKG4V45O.js +228 -0
  36. package/bundle/chunk-VH5OAWVG.js +4096 -0
  37. package/bundle/chunk-W2SZ22EM.js +5462 -0
  38. package/bundle/chunk-WVD4UEL4.js +9367 -0
  39. package/bundle/chunk-XSWOTIA3.js +175 -0
  40. package/bundle/chunk-YFCK7H2S.js +129 -0
  41. package/bundle/chunk-YKEWIB4M.js +380 -0
  42. package/bundle/chunk-YYREO77V.js +137 -0
  43. package/bundle/chunk-Z7KVHQHL.js +173 -0
  44. package/bundle/chunk-ZLINIYTP.js +8613 -0
  45. package/bundle/chunk-ZQGSDHL6.js +128 -0
  46. package/bundle/control-channel.js +11 -0
  47. package/bundle/delegation.js +14 -0
  48. package/bundle/external-job-provider.js +20 -0
  49. package/bundle/external-runs.js +21 -0
  50. package/bundle/index.js +30 -0
  51. package/bundle/inspectors.js +8 -0
  52. package/bundle/intercom-bridge.js +11 -0
  53. package/bundle/preflight.js +425 -0
  54. package/bundle/project-panes.js +28 -0
  55. package/bundle/required-child-extensions.js +6 -0
  56. package/bundle/shared-types.js +8 -0
  57. package/bundle/workflow-resources.js +7 -0
  58. package/docs/agents.md +31 -0
  59. package/docs/configuration.md +9 -1
  60. package/docs/extension-api.md +27 -0
  61. package/docs/observability.md +6 -2
  62. package/docs/tool-reference.md +3 -1
  63. package/docs/workflows.md +16 -0
  64. package/package.json +19 -19
  65. package/skills/pi-subagents/references/execution-controls.md +5 -4
  66. package/src/agents/agent-management.js +3 -3
  67. package/src/agents/agent-memory.js +3 -1
  68. package/src/agents/agents.js +6 -6
  69. package/src/agents/frontmatter.d.ts +4 -0
  70. package/src/agents/frontmatter.js +24 -3
  71. package/src/agents/skills.js +2 -1
  72. package/src/api/delegation.d.ts +20 -0
  73. package/src/extension/config.js +3 -0
  74. package/src/extension/herdr-pi-bridge.js +17 -10
  75. package/src/extension/index.js +109 -9
  76. package/src/extension/schemas.js +3 -3
  77. package/src/intercom/native-supervisor-channel.js +20 -0
  78. package/src/missions/lifecycle.js +7 -1
  79. package/src/runs/background/active-async-capacity.d.ts +1 -0
  80. package/src/runs/background/active-async-capacity.js +9 -3
  81. package/src/runs/background/async-execution.js +20 -10
  82. package/src/runs/background/async-job-tracker.d.ts +6 -1
  83. package/src/runs/background/async-job-tracker.js +9 -4
  84. package/src/runs/background/async-status.d.ts +2 -0
  85. package/src/runs/background/async-status.js +21 -2
  86. package/src/runs/background/await-async-run.js +3 -7
  87. package/src/runs/background/boot-id.d.ts +12 -0
  88. package/src/runs/background/boot-id.js +47 -0
  89. package/src/runs/background/interrupted-elsewhere.d.ts +22 -0
  90. package/src/runs/background/interrupted-elsewhere.js +68 -0
  91. package/src/runs/background/notify.d.ts +2 -0
  92. package/src/runs/background/notify.js +13 -0
  93. package/src/runs/background/result-delivery-ownership.d.ts +6 -0
  94. package/src/runs/background/result-delivery-ownership.js +19 -1
  95. package/src/runs/background/result-watcher.d.ts +3 -1
  96. package/src/runs/background/result-watcher.js +24 -8
  97. package/src/runs/background/run-child-session.d.ts +1 -6
  98. package/src/runs/background/run-child-session.js +19 -1
  99. package/src/runs/background/run-status.js +2 -1
  100. package/src/runs/background/stale-run-reconciler.d.ts +25 -0
  101. package/src/runs/background/stale-run-reconciler.js +54 -13
  102. package/src/runs/background/subagent-runner-bootstrap.js +3 -0
  103. package/src/runs/background/subagent-runner.d.ts +4 -0
  104. package/src/runs/background/subagent-runner.js +13 -5
  105. package/src/runs/background/subagent-wait.d.ts +1 -1
  106. package/src/runs/background/subagent-wait.js +6 -1
  107. package/src/runs/background/terminal-run-index.d.ts +1 -0
  108. package/src/runs/background/terminal-run-index.js +4 -2
  109. package/src/runs/foreground/async-stop-action.js +3 -1
  110. package/src/runs/foreground/execution.js +45 -5
  111. package/src/runs/foreground/foreground-history.d.ts +16 -2
  112. package/src/runs/foreground/foreground-history.js +133 -31
  113. package/src/runs/foreground/subagent-executor.d.ts +11 -0
  114. package/src/runs/foreground/subagent-executor.js +277 -74
  115. package/src/runs/shared/child-launch.d.ts +2 -2
  116. package/src/runs/shared/child-session.d.ts +3 -2
  117. package/src/runs/shared/child-session.js +51 -8
  118. package/src/runs/shared/child-tool-plan.d.ts +7 -0
  119. package/src/runs/shared/child-tool-plan.js +21 -6
  120. package/src/runs/shared/herdr-connection.d.ts +17 -8
  121. package/src/runs/shared/herdr-connection.js +19 -7
  122. package/src/runs/shared/herdr-external-adapters.d.ts +3 -2
  123. package/src/runs/shared/herdr-external-adapters.js +1 -1
  124. package/src/runs/shared/herdr-machine.d.ts +12 -2
  125. package/src/runs/shared/herdr-machine.js +55 -9
  126. package/src/runs/shared/herdr-pane-host.d.ts +88 -0
  127. package/src/runs/shared/herdr-pane-host.js +155 -0
  128. package/src/runs/shared/herdr-placed-run.d.ts +27 -150
  129. package/src/runs/shared/herdr-placed-run.js +48 -395
  130. package/src/runs/shared/local-machine-access.d.ts +5 -0
  131. package/src/runs/shared/local-machine-access.js +28 -0
  132. package/src/runs/shared/orca-progress-tabs.d.ts +0 -1
  133. package/src/runs/shared/orca-progress-tabs.js +1 -24
  134. package/src/runs/shared/parallel-utils.d.ts +1 -1
  135. package/src/runs/shared/placed-run-owner.d.ts +49 -0
  136. package/src/runs/shared/placed-run-owner.js +93 -0
  137. package/src/runs/shared/placement-host.d.ts +99 -0
  138. package/src/runs/shared/placement-host.js +157 -0
  139. package/src/runs/shared/rex-machine.d.ts +25 -0
  140. package/src/runs/shared/rex-machine.js +83 -0
  141. package/src/runs/shared/rex-pane-host.d.ts +62 -0
  142. package/src/runs/shared/rex-pane-host.js +327 -0
  143. package/src/runs/shared/structured-output.d.ts +1 -0
  144. package/src/runs/shared/structured-output.js +1 -0
  145. package/src/shared/accessible-dir.js +4 -1
  146. package/src/shared/completion-owner.d.ts +5 -0
  147. package/src/shared/completion-owner.js +5 -0
  148. package/src/shared/provider-diagnostics.d.ts +9 -0
  149. package/src/shared/provider-diagnostics.js +75 -0
  150. package/src/shared/session-identity.d.ts +2 -0
  151. package/src/shared/session-identity.js +26 -0
  152. package/src/shared/types.d.ts +48 -6
  153. package/src/slash/delegation-adapters.d.ts +3 -1
  154. package/src/slash/delegation-adapters.js +7 -0
  155. package/src/slash/prompt-template-bridge.js +3 -1
  156. package/src/slash/subagents-admin.d.ts +1 -0
  157. package/src/slash/subagents-admin.js +1 -1
  158. package/src/tui/fleet-layout.d.ts +20 -0
  159. package/src/tui/fleet-layout.js +17 -0
  160. package/src/tui/fleet-viewport.d.ts +12 -0
  161. package/src/tui/fleet-viewport.js +35 -0
  162. package/src/tui/fleet.d.ts +6 -6
  163. package/src/tui/fleet.js +93 -66
  164. package/src/tui/render.d.ts +6 -0
  165. package/src/tui/render.js +3 -3
  166. package/src/tui/subagent-messages.js +1 -0
  167. package/src/workflows/scripted-workflow.d.ts +1 -1
  168. package/src/workflows/structured-workflow-scripts.d.ts +1 -0
  169. package/src/workflows/structured-workflow-scripts.js +5 -4
  170. package/src/workflows/workflow-auto-resume.d.ts +32 -0
  171. package/src/workflows/workflow-auto-resume.js +102 -0
  172. package/src/workflows/workflow-launch-record.d.ts +27 -0
  173. package/src/workflows/workflow-launch-record.js +48 -0
  174. package/src/workflows/workflow-resources.js +2 -2
  175. package/src/workflows/workflow-resume-claim.d.ts +82 -0
  176. package/src/workflows/workflow-resume-claim.js +210 -0
  177. package/src/workflows/workflow-resume.d.ts +56 -0
  178. package/src/workflows/workflow-resume.js +106 -0
  179. package/src/workflows/workflow-reuse.d.ts +15 -9
  180. package/src/workflows/workflow-reuse.js +77 -14
  181. package/src/workflows/workflow-revival.d.ts +2 -0
  182. package/src/workflows/workflow-revival.js +2 -1
  183. package/src/workflows/workflow-stop-cause.d.ts +6 -0
  184. package/src/workflows/workflow-stop-cause.js +8 -0
@@ -0,0 +1,128 @@
1
+ // package.json
2
+ var package_default = {
3
+ name: "pi-subagents",
4
+ version: "0.82.0",
5
+ private: true,
6
+ description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
7
+ author: "Nico Bailon",
8
+ license: "MIT",
9
+ type: "module",
10
+ exports: {
11
+ ".": "./index.ts",
12
+ "./background-work": "./src/api/background-work.ts",
13
+ "./external-job-provider": "./src/api/external-job-provider.ts",
14
+ "./external-runs": "./src/api/external-runs.ts",
15
+ "./agents": "./src/api/agents.ts",
16
+ "./inspectors": "./src/api/inspectors.ts",
17
+ "./delegation": "./src/api/delegation.ts",
18
+ "./capability-ceiling": "./src/api/capability-ceiling.ts",
19
+ "./workflow-resources": "./src/api/workflow-resources.ts",
20
+ "./required-child-extensions": "./src/api/required-child-extensions.ts",
21
+ "./preflight": "./src/api/preflight.ts",
22
+ "./control-channel": "./src/api/control-channel.ts",
23
+ "./intercom-bridge": "./src/api/intercom-bridge.ts",
24
+ "./child-tool-plan": "./src/api/child-tool-plan.ts",
25
+ "./shared-types": "./src/api/shared-types.ts",
26
+ "./project-panes": "./src/api/project-panes.ts"
27
+ },
28
+ repository: {
29
+ type: "git",
30
+ url: "git+https://github.com/nicobailon/pi-subagents.git"
31
+ },
32
+ homepage: "https://github.com/nicobailon/pi-subagents#readme",
33
+ bugs: {
34
+ url: "https://github.com/nicobailon/pi-subagents/issues"
35
+ },
36
+ keywords: [
37
+ "pi-package",
38
+ "pi",
39
+ "pi-coding-agent",
40
+ "extension",
41
+ "subagents",
42
+ "ai",
43
+ "agents",
44
+ "cli"
45
+ ],
46
+ bin: {
47
+ "pi-subagents": "install.mjs"
48
+ },
49
+ files: [
50
+ "index.ts",
51
+ "src/**/*.ts",
52
+ "*.mjs",
53
+ "agents/",
54
+ "skills/**/*",
55
+ "prompts/**/*",
56
+ "docs/**/*",
57
+ "README.md",
58
+ "CHANGELOG.md"
59
+ ],
60
+ scripts: {
61
+ "build:pkg": "node scripts/build-package.mjs",
62
+ "pack:pkg": "npm run build:pkg && npm pack ./dist-pkg",
63
+ typecheck: "tsc --noEmit",
64
+ test: "npm run test:unit",
65
+ "test:unit": "node --experimental-strip-types --import ./test/support/isolated-temp-root.mjs --test test/unit/*.test.ts",
66
+ "test:integration": "node --experimental-strip-types --import ./test/support/register-loader.mjs --test test/integration/*.test.ts",
67
+ "test:smoke:tool-activation": "node --experimental-strip-types --test test/smoke/tool-activation.test.ts",
68
+ "test:all": "npm run test:unit && npm run test:integration"
69
+ },
70
+ pi: {
71
+ extensions: [
72
+ "./index.ts"
73
+ ],
74
+ skills: [
75
+ "./skills"
76
+ ],
77
+ prompts: [
78
+ "./prompts"
79
+ ]
80
+ },
81
+ peerDependencies: {
82
+ "@earendil-works/pi-agent-core": "*",
83
+ "@earendil-works/pi-ai": ">=1.2.0",
84
+ "@earendil-works/pi-coding-agent": "*",
85
+ "@earendil-works/pi-tui": "*",
86
+ typebox: "*"
87
+ },
88
+ peerDependenciesMeta: {
89
+ "@earendil-works/pi-agent-core": {
90
+ optional: true
91
+ },
92
+ "@earendil-works/pi-ai": {
93
+ optional: true
94
+ },
95
+ "@earendil-works/pi-coding-agent": {
96
+ optional: true
97
+ },
98
+ "@earendil-works/pi-tui": {
99
+ optional: true
100
+ },
101
+ typebox: {
102
+ optional: true
103
+ }
104
+ },
105
+ dependencies: {
106
+ "@js-temporal/polyfill": "0.5.1",
107
+ acorn: "8.18.0",
108
+ jiti: "2.7.0",
109
+ undici: "8.12.3",
110
+ yaml: "2.8.3"
111
+ },
112
+ devDependencies: {
113
+ "@earendil-works/pi-agent-core": "1.2.0",
114
+ "@earendil-works/pi-ai": "1.2.0",
115
+ "@earendil-works/pi-tui": "1.2.0",
116
+ "@oxlint/plugins": "1.80.0",
117
+ "@types/node": "24.13.3",
118
+ esbuild: "0.28.2",
119
+ oxlint: "1.80.0",
120
+ typescript: "5.9.3",
121
+ "@earendil-works/pi-coding-agent": "1.2.0",
122
+ typebox: "1.3.27"
123
+ }
124
+ };
125
+
126
+ export {
127
+ package_default
128
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ requestAsyncStop
3
+ } from "./chunk-OYF6AFDY.js";
4
+ import "./chunk-NIXWDZZV.js";
5
+ import "./chunk-CIZQXJ5Q.js";
6
+ import "./chunk-5LFLVSTM.js";
7
+ import "./chunk-YFCK7H2S.js";
8
+ import "./chunk-Z7KVHQHL.js";
9
+ export {
10
+ requestAsyncStop
11
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ SUBAGENT_DELEGATION_CANCEL_EVENT,
3
+ SUBAGENT_DELEGATION_REQUEST_EVENT,
4
+ SUBAGENT_DELEGATION_RESPONSE_EVENT,
5
+ SUBAGENT_DELEGATION_STARTED_EVENT,
6
+ SUBAGENT_DELEGATION_UPDATE_EVENT
7
+ } from "./chunk-D4EHT5SJ.js";
8
+ export {
9
+ SUBAGENT_DELEGATION_CANCEL_EVENT,
10
+ SUBAGENT_DELEGATION_REQUEST_EVENT,
11
+ SUBAGENT_DELEGATION_RESPONSE_EVENT,
12
+ SUBAGENT_DELEGATION_STARTED_EVENT,
13
+ SUBAGENT_DELEGATION_UPDATE_EVENT
14
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ EXTERNAL_JOB_PROVIDER_PROTOCOL_VERSION,
3
+ EXTERNAL_JOB_PROVIDER_REGISTRY_KEY,
4
+ ExternalJobProviderError,
5
+ getExternalJobProvider,
6
+ listExternalJobProviders,
7
+ registerExternalJobProvider,
8
+ validateExternalJobHandle,
9
+ validateExternalJobResult
10
+ } from "./chunk-YYREO77V.js";
11
+ export {
12
+ EXTERNAL_JOB_PROVIDER_PROTOCOL_VERSION,
13
+ EXTERNAL_JOB_PROVIDER_REGISTRY_KEY,
14
+ ExternalJobProviderError,
15
+ getExternalJobProvider,
16
+ listExternalJobProviders,
17
+ registerExternalJobProvider,
18
+ validateExternalJobHandle,
19
+ validateExternalJobResult
20
+ };
@@ -0,0 +1,21 @@
1
+ import {
2
+ EXTERNAL_RUN_LIMITS,
3
+ EXTERNAL_RUN_REGISTRY_KEY,
4
+ EXTERNAL_RUN_REGISTRY_VERSION,
5
+ listExternalRuns,
6
+ registerExternalRun,
7
+ snapshotExternalRuns,
8
+ unregisterExternalRun,
9
+ updateExternalRun
10
+ } from "./chunk-UKG4V45O.js";
11
+ import "./chunk-YFCK7H2S.js";
12
+ export {
13
+ EXTERNAL_RUN_LIMITS,
14
+ EXTERNAL_RUN_REGISTRY_KEY,
15
+ EXTERNAL_RUN_REGISTRY_VERSION,
16
+ listExternalRuns,
17
+ registerExternalRun,
18
+ snapshotExternalRuns,
19
+ unregisterExternalRun,
20
+ updateExternalRun
21
+ };
@@ -0,0 +1,30 @@
1
+ import {
2
+ HERDR_PI_MODE_ENV
3
+ } from "./chunk-4QFZZV3O.js";
4
+
5
+ // src/shared/package-version.ts
6
+ import * as fs from "node:fs";
7
+ import * as path from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ var packagePath = path.resolve(path.dirname(fileURLToPath(new URL("../src/shared/package-version.js", import.meta.url).href)), "..", "..", "package.json");
10
+ function readInstalledPackageVersion() {
11
+ const parsed = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
12
+ if (typeof parsed.version !== "string" || !parsed.version.trim()) {
13
+ throw new Error(`Invalid package version in '${packagePath}'.`);
14
+ }
15
+ return parsed.version;
16
+ }
17
+ var loadedPackageVersion = readInstalledPackageVersion();
18
+
19
+ // index.ts
20
+ var registerExtension = process.env[HERDR_PI_MODE_ENV] === "1" ? (await import("./chunk-SIJ4S3EN.js")).default : process.env.PI_SUBAGENT_CHILD === "1" ? void 0 : (await import("./chunk-WVD4UEL4.js")).default;
21
+ function registerSubagentExtension(pi) {
22
+ const installedVersion = readInstalledPackageVersion();
23
+ if (installedVersion !== loadedPackageVersion) {
24
+ throw new Error(`pi-subagents ${installedVersion} is installed, but this Pi process still has ${loadedPackageVersion} loaded. Restart Pi to load the update; /reload cannot replace extension modules that Node has already loaded.`);
25
+ }
26
+ registerExtension?.(pi);
27
+ }
28
+ export {
29
+ registerSubagentExtension as default
30
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ INSPECTOR_REGISTER_EVENT,
3
+ registerInspector
4
+ } from "./chunk-62OCY2S4.js";
5
+ export {
6
+ INSPECTOR_REGISTER_EVENT,
7
+ registerInspector
8
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ resolveIntercomSessionTarget
3
+ } from "./chunk-XSWOTIA3.js";
4
+ import "./chunk-7F6RKT6W.js";
5
+ import "./chunk-CIZQXJ5Q.js";
6
+ import "./chunk-5LFLVSTM.js";
7
+ import "./chunk-YFCK7H2S.js";
8
+ import "./chunk-Z7KVHQHL.js";
9
+ export {
10
+ resolveIntercomSessionTarget
11
+ };
@@ -0,0 +1,425 @@
1
+ import {
2
+ buildEffectiveSystemPrompt,
3
+ canPreferForkFromSnapshot,
4
+ resolveSubagentLaunchContext
5
+ } from "./chunk-GJECHSAR.js";
6
+ import "./chunk-PLCCBLPY.js";
7
+ import {
8
+ loadConfig
9
+ } from "./chunk-NGGAFDL6.js";
10
+ import {
11
+ nestedResultsPath,
12
+ processTerminalCandidatePath,
13
+ processTerminalPath,
14
+ resultFilePath
15
+ } from "./chunk-NRQ75MGH.js";
16
+ import {
17
+ applyIntercomBridgeToAgent,
18
+ resolveIntercomBridge,
19
+ validateIntercomBridgeConfig
20
+ } from "./chunk-XSWOTIA3.js";
21
+ import {
22
+ AGENT_DEFINITION_PROJECTION_VERSION,
23
+ resolveLaunchBinding,
24
+ stableJsonDigest
25
+ } from "./chunk-7F6RKT6W.js";
26
+ import {
27
+ applyThinkingSuffix,
28
+ resolvePiLaunchToolPlan
29
+ } from "./chunk-4SDU2BZX.js";
30
+ import {
31
+ assertRequiredChildExtensionsAdmitted,
32
+ resolveRequiredChildExtensions
33
+ } from "./chunk-CTPAE36Y.js";
34
+ import {
35
+ getArtifactPaths,
36
+ getArtifactsDir
37
+ } from "./chunk-5TYMSZX3.js";
38
+ import {
39
+ assertClaudeCodeModelScope,
40
+ assertThinkingWithinCeiling,
41
+ discoverAgentSnapshot,
42
+ findBlockingAgentDiagnostic,
43
+ formatUnknownAgentError,
44
+ inheritsParentModel,
45
+ intersectThinkingCeilings,
46
+ isClaudeCodeAdapterId,
47
+ normalizeExtensionBindings,
48
+ normalizeSingleOutputOverride,
49
+ normalizeSkillInput,
50
+ projectScopeRequiresTrustMessage,
51
+ resolveAgentName,
52
+ resolveClaudeCodeOverride,
53
+ resolveEffectiveSubagentModel,
54
+ resolveEffectiveThinking,
55
+ resolveExecutionAgentScope,
56
+ resolveModelOrigin,
57
+ resolveModelScopesForAgent,
58
+ resolveModelSelection,
59
+ resolvePermissionRules,
60
+ resolveSingleOutputPath,
61
+ resolveSkillsWithFallback,
62
+ resolveStepBehavior,
63
+ unknownAgentDiagnosticContext
64
+ } from "./chunk-CIZQXJ5Q.js";
65
+ import {
66
+ DIRS,
67
+ SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
68
+ TEMP_ROOT_DIR
69
+ } from "./chunk-5LFLVSTM.js";
70
+ import "./chunk-YFCK7H2S.js";
71
+ import {
72
+ capabilityCeilingAgentRestrictionMessage,
73
+ intersectSubagentCapabilityCeilings
74
+ } from "./chunk-Z7KVHQHL.js";
75
+
76
+ // src/api/preflight.ts
77
+ import * as fs from "node:fs";
78
+ import * as path from "node:path";
79
+ import { fileURLToPath } from "node:url";
80
+ var SUBAGENT_LAUNCH_CONTRACT_VERSION = 3;
81
+ var PREFLIGHT_ORCHESTRATOR_TARGET = "preflight";
82
+ function claudeCodeFailureCode(message) {
83
+ if (message.includes("subagent model scope")) return "model_scope";
84
+ if (message.startsWith("Thinking level '")) return "thinking_ceiling";
85
+ return "unsupported_mode";
86
+ }
87
+ function packageVersion() {
88
+ const packagePath = path.resolve(path.dirname(fileURLToPath(new URL("../src/api/preflight.js", import.meta.url).href)), "..", "..", "package.json");
89
+ const parsed = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
90
+ if (typeof parsed.version !== "string" || !parsed.version.trim()) {
91
+ throw new Error(`Invalid package version in '${packagePath}'.`);
92
+ }
93
+ return parsed.version;
94
+ }
95
+ function digestContract(contract) {
96
+ return stableJsonDigest(contract);
97
+ }
98
+ function normalizeAvailableModels(models) {
99
+ return (models ?? []).map((model) => ({ ...model, fullId: model.fullId ?? `${model.provider}/${model.id}` }));
100
+ }
101
+ function resolveLaunchContractContext(input, agent) {
102
+ return resolveSubagentLaunchContext({
103
+ explicitContext: input.context,
104
+ agentDefaultContext: agent.defaultContext,
105
+ defaultSubagentContext: loadConfig().defaultSubagentContext,
106
+ canUseImplicitFork: canPreferForkFromSnapshot({
107
+ parentSessionFile: input.parentSessionFile,
108
+ leafId: input.parentLeafId
109
+ })
110
+ });
111
+ }
112
+ function taskWorkspaceScopeAuthorityDiagnostic(task) {
113
+ if (!task) return void 0;
114
+ const text = task.replace(/\s+/g, " ").trim();
115
+ if (!text) return void 0;
116
+ const createsWorkspacePackage = /\b(?:add|create|introduce|make|set up)\b.{0,80}\b(?:new\s+)?(?:workspace\s+)?package\b/i.test(text) || /\b(?:new\s+)?package\b.{0,80}\b(?:workspace|monorepo)\b/i.test(text);
117
+ if (!createsWorkspacePackage) return void 0;
118
+ const packageOnlyAuthority = /\b(?:only|solely)\b.{0,40}\b(?:edit|change|modify|touch|write(?:\s+to)?)\b.{0,80}\b(?:package(?:\s+directory)?|packages\/[\w.-]+)\b/i.test(text) || /\b(?:do not|don't|must not)\b.{0,40}\b(?:edit|change|modify|touch|write(?:\s+to)?)\b.{0,80}\b(?:root|workspace|lockfile|metadata)\b/i.test(text) || /\bwithout\b.{0,40}\b(?:root|workspace|lockfile|metadata)\b.{0,40}\b(?:edit|change|modification|write)s?\b/i.test(text);
119
+ if (!packageOnlyAuthority) return void 0;
120
+ return {
121
+ code: "workspace_scope_authority",
122
+ severity: "warning",
123
+ message: "Task asks for a workspace package change while limiting authority to package-scope edits. New workspace packages often need root workspace metadata or lockfile changes, so confirm that authority before launch."
124
+ };
125
+ }
126
+ function candidateList(inputAgent, selected, all) {
127
+ return [...all.builtin, ...all.package, ...all.user, ...all.project].filter((agent) => Boolean(resolveAgentName(inputAgent, [agent]).agent)).map((agent) => ({
128
+ name: agent.name,
129
+ ...agent.localName ? { localName: agent.localName } : {},
130
+ ...agent.packageName ? { packageName: agent.packageName } : {},
131
+ source: agent.source,
132
+ filePath: agent.filePath,
133
+ ...agent.disabled === true ? { disabled: true } : {},
134
+ selected: Boolean(selected && agent.filePath === selected.filePath && agent.name === selected.name)
135
+ }));
136
+ }
137
+ async function resolveSubagentLaunchContract(input) {
138
+ const diagnostics = [];
139
+ const authorityDiagnostic = taskWorkspaceScopeAuthorityDiagnostic(input.task);
140
+ if (authorityDiagnostic) diagnostics.push(authorityDiagnostic);
141
+ const effectiveCwd = path.resolve(input.cwd);
142
+ try {
143
+ if (!fs.statSync(effectiveCwd).isDirectory()) {
144
+ return { ok: false, code: "invalid_cwd", message: `cwd '${effectiveCwd}' is not a directory.`, diagnostics };
145
+ }
146
+ } catch (error) {
147
+ const detail = error instanceof Error ? ` ${error.message}` : "";
148
+ return { ok: false, code: "invalid_cwd", message: `cwd '${effectiveCwd}' is not a directory.${detail}`, diagnostics };
149
+ }
150
+ if (input.context !== void 0 && input.context !== "fresh" && input.context !== "fork") {
151
+ return { ok: false, code: "unsupported_mode", message: `Unsupported context '${String(input.context)}'; expected 'fresh' or 'fork'.`, diagnostics };
152
+ }
153
+ if (input.artifactDir !== void 0 && input.artifactDir !== "project" && input.artifactDir !== "session" && input.artifactDir !== "temp") {
154
+ return { ok: false, code: "invalid_artifact_dir", message: `Unsupported artifactDir '${String(input.artifactDir)}'; expected 'project', 'session', or 'temp'.`, diagnostics };
155
+ }
156
+ const bridgeOverride = input.intercomBridge === void 0 ? void 0 : validateIntercomBridgeConfig({ value: input.intercomBridge, label: "intercomBridge" });
157
+ if (bridgeOverride && !bridgeOverride.ok) {
158
+ return { ok: false, code: "invalid_intercom_bridge", message: bridgeOverride.error, diagnostics };
159
+ }
160
+ if (input.orchestratorTarget !== void 0 && (typeof input.orchestratorTarget !== "string" || !input.orchestratorTarget.trim())) {
161
+ return { ok: false, code: "invalid_intercom_bridge", message: "orchestratorTarget must be a non-empty string when provided.", diagnostics };
162
+ }
163
+ const scope = resolveExecutionAgentScope(input.agentScope);
164
+ if (input.projectTrusted === false && scope === "project") {
165
+ const message = projectScopeRequiresTrustMessage(effectiveCwd);
166
+ return { ok: false, code: "restricted_agent", message, diagnostics: [...diagnostics, { code: "restricted_agent", severity: "error", message }] };
167
+ }
168
+ const parentProvider = input.preferredProvider ?? input.parentModel?.provider;
169
+ const discovery = discoverAgentSnapshot(effectiveCwd, scope, parentProvider, { includeChains: false, projectTrusted: input.projectTrusted });
170
+ const discovered = discovery.effective;
171
+ const resolvedAgent = resolveAgentName(input.agent, discovered.agents);
172
+ const ambiguousCandidates = resolvedAgent.error ? discovered.agents.filter((agent2) => resolveAgentName(input.agent, [agent2]).agent) : resolvedAgent.agent;
173
+ const invalidAgent = findBlockingAgentDiagnostic(input.agent, ambiguousCandidates, discovered.agentDiagnostics);
174
+ if (invalidAgent) {
175
+ const message = `Agent '${input.agent}' has invalid configuration: ${invalidAgent.error}`;
176
+ return { ok: false, code: "missing_agent", message, diagnostics: [{ code: "missing_agent", severity: "error", message }] };
177
+ }
178
+ if (resolvedAgent.error) {
179
+ return { ok: false, code: "ambiguous_agent", message: resolvedAgent.error, diagnostics };
180
+ }
181
+ if (!resolvedAgent.agent) {
182
+ return { ok: false, code: "missing_agent", message: formatUnknownAgentError(input.agent, unknownAgentDiagnosticContext(discovered)), diagnostics };
183
+ }
184
+ const definitionAgent = resolvedAgent.agent;
185
+ let extensionBindings;
186
+ try {
187
+ extensionBindings = normalizeExtensionBindings(input.extensionBindings)?.value;
188
+ } catch (error) {
189
+ return { ok: false, code: "invalid_extension_bindings", message: error instanceof Error ? error.message : String(error), diagnostics };
190
+ }
191
+ if (extensionBindings !== void 0 && (definitionAgent.runner?.type === "external-cli" || definitionAgent.runner?.type === "external-job")) {
192
+ return { ok: false, code: "unsupported_mode", message: `extensionBindings is not supported for runner.type='${definitionAgent.runner.type}'.`, diagnostics };
193
+ }
194
+ const context = resolveLaunchContractContext(input, definitionAgent);
195
+ if (context === "fork") {
196
+ diagnostics.push({ code: "host_required", severity: "host-required", message: "Exact fork session branching requires Pi host session snapshots." });
197
+ }
198
+ const bridge = resolveIntercomBridge({
199
+ config: loadConfig().intercomBridge,
200
+ ...bridgeOverride ? { override: bridgeOverride.value } : {},
201
+ context,
202
+ orchestratorTarget: input.orchestratorTarget ?? PREFLIGHT_ORCHESTRATOR_TARGET
203
+ });
204
+ if (bridge.active && bridge.interpolatesOrchestratorTarget && input.orchestratorTarget === void 0) {
205
+ diagnostics.push({ code: "host_required", severity: "host-required", message: "The intercomBridge instruction file names the supervisor session; supply orchestratorTarget to bind the exact child prompt." });
206
+ }
207
+ const agent = applyIntercomBridgeToAgent(definitionAgent, bridge);
208
+ const effectiveCapabilityCeiling = intersectSubagentCapabilityCeilings(input.capabilityCeiling, input.inheritedCapabilityCeiling);
209
+ const restrictionMessage = capabilityCeilingAgentRestrictionMessage(agent.name, effectiveCapabilityCeiling);
210
+ if (restrictionMessage) return { ok: false, code: "restricted_agent", message: restrictionMessage, diagnostics };
211
+ const runId = input.runId ?? "preflight";
212
+ const skillInput = normalizeSkillInput(input.skill);
213
+ const outputOverride = normalizeSingleOutputOverride(input.output, agent.output);
214
+ const behavior = resolveStepBehavior(agent, {
215
+ ...outputOverride !== void 0 ? { output: outputOverride } : {},
216
+ ...input.outputMode !== void 0 ? { outputMode: input.outputMode } : {},
217
+ ...skillInput !== void 0 ? { skills: skillInput } : {},
218
+ ...input.model !== void 0 ? { model: input.model } : {},
219
+ ...input.outputSchema !== void 0 ? { outputSchema: input.outputSchema } : {}
220
+ });
221
+ const requestedSkills = behavior.skills === false ? [] : behavior.skills;
222
+ const resolvedSkills = resolveSkillsWithFallback(
223
+ requestedSkills,
224
+ effectiveCwd,
225
+ effectiveCwd,
226
+ agent.skillPath,
227
+ agent.filePath ? path.dirname(agent.filePath) : effectiveCwd
228
+ );
229
+ if (resolvedSkills.missing.includes("pi-subagents")) {
230
+ return { ok: false, code: "missing_skill", message: "The pi-subagents orchestration skill is not child-injectable.", diagnostics };
231
+ }
232
+ if (resolvedSkills.missing.length > 0) diagnostics.push({ code: "missing_skill", severity: "error", message: `Missing skills: ${resolvedSkills.missing.join(", ")}` });
233
+ const externalRunner = agent.runner?.type === "external-cli" || agent.runner?.type === "external-job";
234
+ try {
235
+ assertRequiredChildExtensionsAdmitted([resolveRequiredChildExtensions(input.parentSessionId)], { agent: agent.name, runnerType: agent.runner?.type });
236
+ } catch (error) {
237
+ const message = error instanceof Error ? error.message : String(error);
238
+ return { ok: false, code: "unsupported_mode", message, diagnostics };
239
+ }
240
+ if (externalRunner && behavior.outputSchema) {
241
+ return { ok: false, code: "unsupported_mode", message: `Agent '${agent.name}' uses runner.type='${agent.runner?.type}' and does not support: structured output.`, diagnostics };
242
+ }
243
+ const availableModels = normalizeAvailableModels(input.availableModels);
244
+ const preferredProvider = agent.modelProvider ?? input.preferredProvider ?? input.parentModel?.provider;
245
+ const modelScopes = resolveModelScopesForAgent(discovered.modelScope, agent.name, input.parentModel, input.scopedModelIds);
246
+ const modelOrigin = resolveModelOrigin({ explicitModel: input.model, agentModel: agent.model, parentModel: input.parentModel });
247
+ const primaryModel = externalRunner ? void 0 : resolveEffectiveSubagentModel(input.model, agent.model, input.parentModel, availableModels, preferredProvider, {
248
+ scope: modelScopes,
249
+ source: modelOrigin === "explicit" ? "explicit" : "inherited"
250
+ });
251
+ const effectiveThinkingConfig = input.thinking !== void 0 ? input.thinking : agent.thinking;
252
+ const thinkingCeiling = externalRunner ? void 0 : intersectThinkingCeilings(
253
+ discovered.maxThinking,
254
+ input.thinkingCeiling,
255
+ input.inheritedThinkingCeiling
256
+ );
257
+ const model = externalRunner ? void 0 : applyThinkingSuffix(resolveModelSelection(primaryModel, availableModels, preferredProvider, {
258
+ scope: modelScopes,
259
+ primaryModelFromParent: modelOrigin === "inherited" || inheritsParentModel(input.model, agent.model, input.parentModel),
260
+ origin: modelOrigin
261
+ }).model, effectiveThinkingConfig, input.thinking !== void 0);
262
+ if (!externalRunner) {
263
+ try {
264
+ assertThinkingWithinCeiling({ model, configThinking: effectiveThinkingConfig, ceiling: thinkingCeiling, agent: agent.name, runId });
265
+ } catch (error) {
266
+ const message = error instanceof Error ? error.message : String(error);
267
+ diagnostics.push({ code: "thinking_ceiling", severity: "error", message });
268
+ return { ok: false, code: "thinking_ceiling", message, diagnostics };
269
+ }
270
+ }
271
+ if (agent.runner?.type === "external-cli" && isClaudeCodeAdapterId(agent.runner.adapter)) {
272
+ try {
273
+ const override = resolveClaudeCodeOverride({
274
+ model: typeof input.model === "string" ? input.model : void 0,
275
+ agent,
276
+ thinking: typeof effectiveThinkingConfig === "string" ? effectiveThinkingConfig : void 0,
277
+ thinkingCeiling: intersectThinkingCeilings(discovered.maxThinking, input.thinkingCeiling, input.inheritedThinkingCeiling),
278
+ agentName: agent.name,
279
+ runId
280
+ });
281
+ assertClaudeCodeModelScope({ scopes: modelScopes, model: override?.model, agent: agent.name, runId });
282
+ } catch (error) {
283
+ const message = error instanceof Error ? error.message : String(error);
284
+ const code = claudeCodeFailureCode(message);
285
+ diagnostics.push({ code, severity: "error", message });
286
+ return { ok: false, code, message, diagnostics };
287
+ }
288
+ }
289
+ let toolPlan;
290
+ const permissionRules = resolvePermissionRules(loadConfig().permissions, agent.permissions);
291
+ const fast = input.fast ?? agent.fast;
292
+ const requiredExtensions = externalRunner ? [] : resolveRequiredChildExtensions(input.parentSessionId);
293
+ try {
294
+ toolPlan = resolvePiLaunchToolPlan({
295
+ tools: agent.tools,
296
+ excludeTools: agent.excludeTools,
297
+ allowNestedSubagents: agent.allowNestedSubagents,
298
+ extensions: agent.extensions,
299
+ subagentOnlyExtensions: agent.subagentOnlyExtensions,
300
+ requiredExtensions,
301
+ mcpDirectTools: agent.mcpDirectTools,
302
+ cwd: effectiveCwd,
303
+ requireReadTool: resolvedSkills.resolved.length > 0,
304
+ structuredOutput: Boolean(behavior.outputSchema),
305
+ fast,
306
+ model,
307
+ capabilityCeiling: effectiveCapabilityCeiling,
308
+ agentName: agent.name,
309
+ permissionRules,
310
+ runtimeSnapshotHost: input.runtimeSnapshotHost
311
+ });
312
+ } catch (error) {
313
+ const message = error instanceof Error ? error.message : String(error);
314
+ diagnostics.push({ code: "denied_required_tool", severity: "error", message });
315
+ return { ok: false, code: "denied_required_tool", message, diagnostics };
316
+ }
317
+ const artifactsEnabled = input.artifacts !== false;
318
+ const artifactsDir = artifactsEnabled ? getArtifactsDir(input.parentSessionFile ?? null, effectiveCwd, input.artifactDir) : void 0;
319
+ const artifactPaths = artifactsDir ? getArtifactPaths(artifactsDir, runId, agent.name, 0) : void 0;
320
+ const outputPath = resolveSingleOutputPath(behavior.output, effectiveCwd, effectiveCwd, artifactsDir ? path.join(artifactsDir, "outputs", runId) : void 0);
321
+ const sessionRoot = input.sessionDir ? path.join(path.resolve(input.sessionDir), runId) : input.sessionRoot ? path.join(path.resolve(input.sessionRoot), runId) : void 0;
322
+ const sessionDir = sessionRoot ? path.join(sessionRoot, "run-0") : void 0;
323
+ const lifecycleAsyncDir = input.nestedRootRunId ? path.join(TEMP_ROOT_DIR, "nested-subagent-runs", input.nestedRootRunId, runId) : path.join(DIRS.async, runId);
324
+ const lifecycleResultPath = input.nestedRootRunId ? nestedResultsPath(input.nestedRootRunId, runId) : resultFilePath(DIRS.results, runId);
325
+ if (!sessionDir) diagnostics.push({ code: "host_required", severity: "host-required", message: "No sessionRoot/sessionDir was supplied; exact child session paths require the Pi host session-root policy." });
326
+ if (!externalRunner && input.availableModels === void 0 && (input.model || agent.model || input.parentModel)) {
327
+ diagnostics.push({ code: "host_required", severity: "host-required", message: "No availableModels snapshot was supplied; model resolution may differ from the active Pi host registry." });
328
+ }
329
+ if (resolvedSkills.missing.length > 0) {
330
+ return { ok: false, code: "missing_skill", message: `Missing skills: ${resolvedSkills.missing.join(", ")}`, diagnostics };
331
+ }
332
+ const effectiveThinking = resolveEffectiveThinking(model, effectiveThinkingConfig);
333
+ const binding = resolveLaunchBinding({
334
+ agent,
335
+ task: input.task ?? "",
336
+ model,
337
+ ...fast !== void 0 ? { fast } : {},
338
+ ...effectiveThinking ? { thinking: effectiveThinking } : {},
339
+ systemPrompt: buildEffectiveSystemPrompt({ agent, resolvedSkills: resolvedSkills.resolved, cwd: effectiveCwd }),
340
+ skills: requestedSkills,
341
+ toolPlan,
342
+ ...outputPath ? { outputPath } : {},
343
+ outputMode: behavior.outputMode,
344
+ ...behavior.outputSchema ? { structuredOutputSchema: behavior.outputSchema } : {},
345
+ ...extensionBindings ? { extensionBindings } : {}
346
+ });
347
+ const candidates = candidateList(input.agent, agent, discovery.all);
348
+ const shadowedCandidates = candidates.filter((candidate) => !candidate.selected);
349
+ const contractBase = {
350
+ version: SUBAGENT_LAUNCH_CONTRACT_VERSION,
351
+ runId,
352
+ agent: {
353
+ name: agent.name,
354
+ ...agent.localName ? { localName: agent.localName } : {},
355
+ ...agent.packageName ? { packageName: agent.packageName } : {},
356
+ source: agent.source,
357
+ filePath: agent.filePath,
358
+ definitionProjectionVersion: AGENT_DEFINITION_PROJECTION_VERSION,
359
+ definitionDigest: binding.definitionDigest,
360
+ shadowedCandidates
361
+ },
362
+ context,
363
+ ...model ? { model } : {},
364
+ ...effectiveThinking ? { thinking: effectiveThinking } : {},
365
+ ...thinkingCeiling ? { thinkingCeiling } : {},
366
+ systemPromptMode: agent.systemPromptMode,
367
+ inheritProjectContext: agent.inheritProjectContext,
368
+ inheritGlobalContext: agent.inheritGlobalContext,
369
+ inheritSkills: agent.inheritSkills,
370
+ skills: {
371
+ requested: requestedSkills,
372
+ resolved: resolvedSkills.resolved.map((skill) => ({ name: skill.name, path: skill.path, source: skill.source })),
373
+ missing: resolvedSkills.missing
374
+ },
375
+ tools: {
376
+ requestedBuiltin: toolPlan.requestedBuiltinTools,
377
+ declaredBuiltin: toolPlan.declaredBuiltinTools,
378
+ ...toolPlan.excludeTools.length > 0 ? { excludeTools: toolPlan.excludeTools } : {},
379
+ effectiveAllowlist: toolPlan.effectiveToolAllowlist,
380
+ explicitAllowlist: toolPlan.explicitToolAllowlist,
381
+ requiredChildTools: toolPlan.requiredChildTools,
382
+ internalTools: toolPlan.internalTools,
383
+ mcp: toolPlan.effectiveMcpSelections,
384
+ effectiveMcpTools: toolPlan.effectiveMcpTools,
385
+ toolExtensionPaths: toolPlan.toolExtensionPaths,
386
+ runtimeExtensions: toolPlan.runtimeExtensions,
387
+ configuredExtensions: toolPlan.configuredExtensions,
388
+ requiredExtensionIds: toolPlan.requiredExtensions.map(({ id }) => id),
389
+ // Required paths are private launch authority; preflight exposes their safe IDs above.
390
+ extensionArgs: toolPlan.extensionArgs.filter((extensionPath) => !requiredExtensions.some(({ path: path2 }) => path2 === extensionPath)),
391
+ disableAmbientExtensions: toolPlan.disableAmbientExtensions,
392
+ fanoutAuthorized: toolPlan.fanoutAuthorized,
393
+ ...toolPlan.capabilityCeiling ? { capabilityCeiling: toolPlan.capabilityCeiling } : {},
394
+ ...toolPlan.capabilityAudit ? { capabilityAudit: toolPlan.capabilityAudit } : {}
395
+ },
396
+ intercomBridge: bridge.active && bridge.mode !== "off" ? { active: true, mode: bridge.mode } : { active: false, mode: bridge.mode },
397
+ roots: {
398
+ cwd: effectiveCwd,
399
+ ...sessionRoot ? { sessionRoot } : {},
400
+ ...sessionDir ? { sessionDir, sessionFile: path.join(sessionDir, "session.jsonl") } : {},
401
+ ...artifactsDir ? { artifactsDir } : {},
402
+ ...artifactPaths ? { artifactPaths } : {},
403
+ ...outputPath ? { outputPath } : {},
404
+ lifecycle: {
405
+ asyncDir: lifecycleAsyncDir,
406
+ resultPath: lifecycleResultPath,
407
+ statusPath: path.join(lifecycleAsyncDir, "status.json"),
408
+ eventsPath: path.join(lifecycleAsyncDir, "events.jsonl"),
409
+ processTerminalPath: processTerminalPath(lifecycleAsyncDir),
410
+ processTerminalCandidatePath: processTerminalCandidatePath(lifecycleAsyncDir)
411
+ }
412
+ },
413
+ protocol: {
414
+ lifecycleArtifactVersion: SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
415
+ packageVersion: packageVersion()
416
+ },
417
+ diagnostics,
418
+ launchContractDigest: binding.launchContractDigest
419
+ };
420
+ return { ok: true, contract: { ...contractBase, digest: digestContract(contractBase) } };
421
+ }
422
+ export {
423
+ SUBAGENT_LAUNCH_CONTRACT_VERSION,
424
+ resolveSubagentLaunchContract
425
+ };