@narumitw/pi-subagents 2.1.4 → 3.0.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 (312) hide show
  1. package/README.md +187 -1228
  2. package/dist/child-communication-bridge.ts +136 -0
  3. package/dist/child-communication-bridge.ts.map +7 -0
  4. package/dist/chunks/chunk-UKTWUQRM.js +667 -0
  5. package/dist/chunks/chunk-UKTWUQRM.js.map +7 -0
  6. package/dist/index.ts +1448 -1614
  7. package/dist/index.ts.map +4 -4
  8. package/docs/design-principles.md +31 -0
  9. package/docs/ipc-transport-idea.md +103 -0
  10. package/docs/tools.md +109 -0
  11. package/package.json +11 -19
  12. package/src/broker-credentials.ts +71 -0
  13. package/src/child-communication-bridge.ts +153 -0
  14. package/src/child-communication-tools.ts +147 -0
  15. package/src/completion-renderer.ts +60 -0
  16. package/src/index.ts +1 -1
  17. package/src/message-broker.ts +628 -0
  18. package/src/model-output.ts +42 -0
  19. package/src/process.ts +688 -0
  20. package/src/runtime.ts +538 -0
  21. package/src/subagents.ts +33 -34
  22. package/src/tools.ts +416 -0
  23. package/src/types.ts +85 -0
  24. package/src/widget.ts +130 -0
  25. package/dist/chunks/auto-transport-FUUKFDIG.ts +0 -109
  26. package/dist/chunks/auto-transport-FUUKFDIG.ts.map +0 -7
  27. package/dist/chunks/capability-grant-PR72SWWS.ts +0 -19
  28. package/dist/chunks/capability-grant-PR72SWWS.ts.map +0 -7
  29. package/dist/chunks/child-peer-bridge.ts +0 -108
  30. package/dist/chunks/child-peer-bridge.ts.map +0 -7
  31. package/dist/chunks/chunk-2LMJU25E.ts +0 -1641
  32. package/dist/chunks/chunk-2LMJU25E.ts.map +0 -7
  33. package/dist/chunks/chunk-47SK2QYC.ts +0 -56
  34. package/dist/chunks/chunk-47SK2QYC.ts.map +0 -7
  35. package/dist/chunks/chunk-4AQSF7AS.ts +0 -29
  36. package/dist/chunks/chunk-4AQSF7AS.ts.map +0 -7
  37. package/dist/chunks/chunk-5DGRMKNV.ts +0 -126
  38. package/dist/chunks/chunk-5DGRMKNV.ts.map +0 -7
  39. package/dist/chunks/chunk-6H6TBBED.ts +0 -108
  40. package/dist/chunks/chunk-6H6TBBED.ts.map +0 -7
  41. package/dist/chunks/chunk-6KJ34M6S.ts +0 -159
  42. package/dist/chunks/chunk-6KJ34M6S.ts.map +0 -7
  43. package/dist/chunks/chunk-6NSJVPXX.ts +0 -480
  44. package/dist/chunks/chunk-6NSJVPXX.ts.map +0 -7
  45. package/dist/chunks/chunk-7AAJEUSL.ts +0 -238
  46. package/dist/chunks/chunk-7AAJEUSL.ts.map +0 -7
  47. package/dist/chunks/chunk-BFK2Z4ZF.ts +0 -189
  48. package/dist/chunks/chunk-BFK2Z4ZF.ts.map +0 -7
  49. package/dist/chunks/chunk-BOAXY55Y.ts +0 -153
  50. package/dist/chunks/chunk-BOAXY55Y.ts.map +0 -7
  51. package/dist/chunks/chunk-D4CR7T73.ts +0 -353
  52. package/dist/chunks/chunk-D4CR7T73.ts.map +0 -7
  53. package/dist/chunks/chunk-FEVPWRMU.ts +0 -300
  54. package/dist/chunks/chunk-FEVPWRMU.ts.map +0 -7
  55. package/dist/chunks/chunk-G6VZTCFH.ts +0 -70
  56. package/dist/chunks/chunk-G6VZTCFH.ts.map +0 -7
  57. package/dist/chunks/chunk-H3FP6DLR.ts +0 -160
  58. package/dist/chunks/chunk-H3FP6DLR.ts.map +0 -7
  59. package/dist/chunks/chunk-HA36LPCO.ts +0 -130
  60. package/dist/chunks/chunk-HA36LPCO.ts.map +0 -7
  61. package/dist/chunks/chunk-HOP5FXDT.ts +0 -27
  62. package/dist/chunks/chunk-HOP5FXDT.ts.map +0 -7
  63. package/dist/chunks/chunk-IGAMVWFN.ts +0 -139
  64. package/dist/chunks/chunk-IGAMVWFN.ts.map +0 -7
  65. package/dist/chunks/chunk-ILEQ27AL.ts +0 -45
  66. package/dist/chunks/chunk-ILEQ27AL.ts.map +0 -7
  67. package/dist/chunks/chunk-ITVWPNU4.ts +0 -819
  68. package/dist/chunks/chunk-ITVWPNU4.ts.map +0 -7
  69. package/dist/chunks/chunk-IWC32VPY.ts +0 -172
  70. package/dist/chunks/chunk-IWC32VPY.ts.map +0 -7
  71. package/dist/chunks/chunk-JSZIP73U.ts +0 -362
  72. package/dist/chunks/chunk-JSZIP73U.ts.map +0 -7
  73. package/dist/chunks/chunk-JU6LUNLP.ts +0 -380
  74. package/dist/chunks/chunk-JU6LUNLP.ts.map +0 -7
  75. package/dist/chunks/chunk-KMGKCEO4.ts +0 -38
  76. package/dist/chunks/chunk-KMGKCEO4.ts.map +0 -7
  77. package/dist/chunks/chunk-LASD73CM.ts +0 -339
  78. package/dist/chunks/chunk-LASD73CM.ts.map +0 -7
  79. package/dist/chunks/chunk-LEOYDZI3.ts +0 -22
  80. package/dist/chunks/chunk-LEOYDZI3.ts.map +0 -7
  81. package/dist/chunks/chunk-LL4LP2T7.ts +0 -737
  82. package/dist/chunks/chunk-LL4LP2T7.ts.map +0 -7
  83. package/dist/chunks/chunk-N2T5IN4X.ts +0 -18
  84. package/dist/chunks/chunk-N2T5IN4X.ts.map +0 -7
  85. package/dist/chunks/chunk-N7BLVXKK.ts +0 -73
  86. package/dist/chunks/chunk-N7BLVXKK.ts.map +0 -7
  87. package/dist/chunks/chunk-NLT67IZS.ts +0 -322
  88. package/dist/chunks/chunk-NLT67IZS.ts.map +0 -7
  89. package/dist/chunks/chunk-NTRPLF46.ts +0 -63
  90. package/dist/chunks/chunk-NTRPLF46.ts.map +0 -7
  91. package/dist/chunks/chunk-ONDTY4EL.ts +0 -91
  92. package/dist/chunks/chunk-ONDTY4EL.ts.map +0 -7
  93. package/dist/chunks/chunk-OVPHFGKO.ts +0 -1769
  94. package/dist/chunks/chunk-OVPHFGKO.ts.map +0 -7
  95. package/dist/chunks/chunk-P7OH4XMF.ts +0 -60
  96. package/dist/chunks/chunk-P7OH4XMF.ts.map +0 -7
  97. package/dist/chunks/chunk-PBZMBTNJ.ts +0 -422
  98. package/dist/chunks/chunk-PBZMBTNJ.ts.map +0 -7
  99. package/dist/chunks/chunk-PGLSFLYW.ts +0 -52
  100. package/dist/chunks/chunk-PGLSFLYW.ts.map +0 -7
  101. package/dist/chunks/chunk-RRR66UWR.ts +0 -28
  102. package/dist/chunks/chunk-RRR66UWR.ts.map +0 -7
  103. package/dist/chunks/chunk-RSUXZD6S.ts +0 -275
  104. package/dist/chunks/chunk-RSUXZD6S.ts.map +0 -7
  105. package/dist/chunks/chunk-RTCVYIZA.ts +0 -221
  106. package/dist/chunks/chunk-RTCVYIZA.ts.map +0 -7
  107. package/dist/chunks/chunk-RY2AEGMZ.ts +0 -34
  108. package/dist/chunks/chunk-RY2AEGMZ.ts.map +0 -7
  109. package/dist/chunks/chunk-SWGQLFSD.ts +0 -60
  110. package/dist/chunks/chunk-SWGQLFSD.ts.map +0 -7
  111. package/dist/chunks/chunk-TM2R67J3.ts +0 -52
  112. package/dist/chunks/chunk-TM2R67J3.ts.map +0 -7
  113. package/dist/chunks/chunk-TMZRHIIK.ts +0 -497
  114. package/dist/chunks/chunk-TMZRHIIK.ts.map +0 -7
  115. package/dist/chunks/chunk-TZ34IQ3M.ts +0 -59
  116. package/dist/chunks/chunk-TZ34IQ3M.ts.map +0 -7
  117. package/dist/chunks/chunk-UMBPMVJW.ts +0 -22
  118. package/dist/chunks/chunk-UMBPMVJW.ts.map +0 -7
  119. package/dist/chunks/chunk-VDG7LTYE.ts +0 -80
  120. package/dist/chunks/chunk-VDG7LTYE.ts.map +0 -7
  121. package/dist/chunks/chunk-X4NMONPE.ts +0 -73
  122. package/dist/chunks/chunk-X4NMONPE.ts.map +0 -7
  123. package/dist/chunks/chunk-YPJEN6NU.ts +0 -65
  124. package/dist/chunks/chunk-YPJEN6NU.ts.map +0 -7
  125. package/dist/chunks/chunk-YU53SHA7.ts +0 -328
  126. package/dist/chunks/chunk-YU53SHA7.ts.map +0 -7
  127. package/dist/chunks/completion-delivery-RSJU6BXL.ts +0 -17
  128. package/dist/chunks/completion-delivery-RSJU6BXL.ts.map +0 -7
  129. package/dist/chunks/config-status-FKGDECZ3.ts +0 -35
  130. package/dist/chunks/config-status-FKGDECZ3.ts.map +0 -7
  131. package/dist/chunks/config-ui-ABHYNGQ7.ts +0 -1212
  132. package/dist/chunks/config-ui-ABHYNGQ7.ts.map +0 -7
  133. package/dist/chunks/consult-LJU3IQY5.ts +0 -519
  134. package/dist/chunks/consult-LJU3IQY5.ts.map +0 -7
  135. package/dist/chunks/context-QDKLVQXE.ts +0 -11
  136. package/dist/chunks/context-QDKLVQXE.ts.map +0 -7
  137. package/dist/chunks/create-stateful-transport-JWC2EFYL.ts +0 -130
  138. package/dist/chunks/create-stateful-transport-JWC2EFYL.ts.map +0 -7
  139. package/dist/chunks/cwd-policy-NB6XZ5GF.ts +0 -17
  140. package/dist/chunks/cwd-policy-NB6XZ5GF.ts.map +0 -7
  141. package/dist/chunks/delegation-contract-LA56I5DT.ts +0 -24
  142. package/dist/chunks/delegation-contract-LA56I5DT.ts.map +0 -7
  143. package/dist/chunks/discovery-MIFB2U4Y.ts +0 -12
  144. package/dist/chunks/discovery-MIFB2U4Y.ts.map +0 -7
  145. package/dist/chunks/execution-Q2JZLKJA.ts +0 -4037
  146. package/dist/chunks/execution-Q2JZLKJA.ts.map +0 -7
  147. package/dist/chunks/in-process-transport-HJ6TZXC3.ts +0 -39
  148. package/dist/chunks/in-process-transport-HJ6TZXC3.ts.map +0 -7
  149. package/dist/chunks/inspect-UH2TKH6E.ts +0 -634
  150. package/dist/chunks/inspect-UH2TKH6E.ts.map +0 -7
  151. package/dist/chunks/peer-communication-KL36Z6CO.ts +0 -294
  152. package/dist/chunks/peer-communication-KL36Z6CO.ts.map +0 -7
  153. package/dist/chunks/persistence-UY3PY6E5.ts +0 -348
  154. package/dist/chunks/persistence-UY3PY6E5.ts.map +0 -7
  155. package/dist/chunks/registry-BT54L6CY.ts +0 -1445
  156. package/dist/chunks/registry-BT54L6CY.ts.map +0 -7
  157. package/dist/chunks/retained-semantic-state-GM75FZGE.ts +0 -81
  158. package/dist/chunks/retained-semantic-state-GM75FZGE.ts.map +0 -7
  159. package/dist/chunks/rpc-transport-7R7DVCEB.ts +0 -1222
  160. package/dist/chunks/rpc-transport-7R7DVCEB.ts.map +0 -7
  161. package/dist/chunks/runtime-policy-5YELCOVC.ts +0 -15
  162. package/dist/chunks/runtime-policy-5YELCOVC.ts.map +0 -7
  163. package/dist/chunks/semantic-snapshot-WPJ3UAFW.ts +0 -19
  164. package/dist/chunks/semantic-snapshot-WPJ3UAFW.ts.map +0 -7
  165. package/dist/chunks/spawn-idempotency-BNHOSMZW.ts +0 -13
  166. package/dist/chunks/spawn-idempotency-BNHOSMZW.ts.map +0 -7
  167. package/dist/chunks/stateful-lifecycle-JAR6K55H.ts +0 -15
  168. package/dist/chunks/stateful-lifecycle-JAR6K55H.ts.map +0 -7
  169. package/dist/chunks/subprocess-transport-VHZJRBTW.ts +0 -160
  170. package/dist/chunks/subprocess-transport-VHZJRBTW.ts.map +0 -7
  171. package/dist/chunks/usage-recording-store-CW3EH2SZ.ts +0 -164
  172. package/dist/chunks/usage-recording-store-CW3EH2SZ.ts.map +0 -7
  173. package/dist/chunks/workspace-WDKLN72J.ts +0 -11
  174. package/dist/chunks/workspace-WDKLN72J.ts.map +0 -7
  175. package/docs/async-runtime-protocol.md +0 -84
  176. package/docs/implementation-notes/pi-subagents-capability-matrix.md +0 -62
  177. package/docs/implementation-notes/pi-subagents-current-direction.md +0 -99
  178. package/docs/implementation-notes/pi-subagents-rpc-v1.md +0 -139
  179. package/docs/pi-subagents-diagrams.md +0 -183
  180. package/src/adaptive-scheduler.ts +0 -224
  181. package/src/admission-policy.ts +0 -78
  182. package/src/agent-projection.ts +0 -53
  183. package/src/agents/built-ins.ts +0 -71
  184. package/src/agents/catalog.ts +0 -241
  185. package/src/agents/discovery.ts +0 -265
  186. package/src/agents/types.ts +0 -100
  187. package/src/agents.ts +0 -51
  188. package/src/auto-transport.ts +0 -121
  189. package/src/blocking-status.ts +0 -63
  190. package/src/cached-module-loader.ts +0 -18
  191. package/src/capabilities.ts +0 -145
  192. package/src/capability-grant.ts +0 -115
  193. package/src/capability-router.ts +0 -107
  194. package/src/child-peer-bridge.ts +0 -124
  195. package/src/child-peer-tools.ts +0 -132
  196. package/src/completion-delivery.ts +0 -409
  197. package/src/completion-render.ts +0 -190
  198. package/src/completion-requirement.ts +0 -479
  199. package/src/completion-routing.ts +0 -24
  200. package/src/config-registration.ts +0 -114
  201. package/src/config-status.ts +0 -217
  202. package/src/config-ui.ts +0 -983
  203. package/src/consult-policy.ts +0 -15
  204. package/src/consult-registration.ts +0 -125
  205. package/src/consult-render.ts +0 -194
  206. package/src/consult-resources.ts +0 -51
  207. package/src/consult-tool.ts +0 -95
  208. package/src/consult.ts +0 -566
  209. package/src/context.ts +0 -126
  210. package/src/create-stateful-transport.ts +0 -157
  211. package/src/cwd-policy.ts +0 -183
  212. package/src/delegation-contract.ts +0 -463
  213. package/src/execution/budget.ts +0 -56
  214. package/src/execution/runtime-policy.ts +0 -19
  215. package/src/execution-plan.ts +0 -322
  216. package/src/execution-ui.ts +0 -259
  217. package/src/execution.ts +0 -1679
  218. package/src/in-process-transport.ts +0 -941
  219. package/src/inspect-registration.ts +0 -64
  220. package/src/inspect-render.ts +0 -334
  221. package/src/inspect-tool.ts +0 -45
  222. package/src/inspect.ts +0 -769
  223. package/src/integration-controller.ts +0 -98
  224. package/src/limits.ts +0 -75
  225. package/src/orchestration-metrics.ts +0 -116
  226. package/src/outcome.ts +0 -61
  227. package/src/panel-child-group.ts +0 -35
  228. package/src/panel-contract.ts +0 -343
  229. package/src/panel-evidence.ts +0 -59
  230. package/src/panel-execution.ts +0 -769
  231. package/src/panel-failure.ts +0 -56
  232. package/src/panel-planning.ts +0 -175
  233. package/src/panel-presets.ts +0 -3
  234. package/src/panel-prompts.ts +0 -132
  235. package/src/panel-reconciliation.ts +0 -57
  236. package/src/panel-render.ts +0 -103
  237. package/src/parallel-limit-ui.ts +0 -113
  238. package/src/params.ts +0 -278
  239. package/src/peer-communication.ts +0 -352
  240. package/src/peer-transport.ts +0 -49
  241. package/src/persistence.ts +0 -522
  242. package/src/pi-args.ts +0 -43
  243. package/src/pi-invocation.ts +0 -168
  244. package/src/process-control.ts +0 -43
  245. package/src/prompt-resources.ts +0 -38
  246. package/src/prompt-source-safety.ts +0 -48
  247. package/src/protocol.ts +0 -76
  248. package/src/registry-types.ts +0 -204
  249. package/src/registry.ts +0 -1698
  250. package/src/render-common.ts +0 -252
  251. package/src/render.ts +0 -704
  252. package/src/result-contract.ts +0 -431
  253. package/src/retained-semantic-state.ts +0 -100
  254. package/src/rpc-timeout-finalization.ts +0 -207
  255. package/src/rpc-transport-metadata.ts +0 -65
  256. package/src/rpc-transport.ts +0 -1035
  257. package/src/rpc-turn-capture.ts +0 -217
  258. package/src/runner-outcome.ts +0 -31
  259. package/src/runner-result.ts +0 -55
  260. package/src/runner-types.ts +0 -102
  261. package/src/runner-usage.ts +0 -48
  262. package/src/runner.ts +0 -866
  263. package/src/safe-text.ts +0 -67
  264. package/src/semantic-snapshot.ts +0 -214
  265. package/src/session-guidance-contract.ts +0 -399
  266. package/src/settings/inspection.ts +0 -302
  267. package/src/settings/schema.ts +0 -195
  268. package/src/settings-reader.ts +0 -215
  269. package/src/settings.ts +0 -452
  270. package/src/spawn-idempotency.ts +0 -68
  271. package/src/stateful-agent-view.ts +0 -85
  272. package/src/stateful-config.ts +0 -13
  273. package/src/stateful-guidance.ts +0 -29
  274. package/src/stateful-lifecycle.ts +0 -74
  275. package/src/stateful-limit-ui.ts +0 -249
  276. package/src/stateful-limits.ts +0 -96
  277. package/src/stateful-prompt.ts +0 -49
  278. package/src/stateful-registration.ts +0 -1320
  279. package/src/stateful-render.ts +0 -318
  280. package/src/stateful-safety.ts +0 -47
  281. package/src/stateful-tool-params.ts +0 -215
  282. package/src/stateful.ts +0 -12
  283. package/src/subagent-details.ts +0 -43
  284. package/src/subagents-extension.ts +0 -372
  285. package/src/subprocess-transport.ts +0 -145
  286. package/src/supervision.ts +0 -104
  287. package/src/task-path.ts +0 -65
  288. package/src/timeout-checkpoint.ts +0 -305
  289. package/src/timeout-finalization.ts +0 -75
  290. package/src/tool-schema-compatibility.ts +0 -73
  291. package/src/transport-types.ts +0 -74
  292. package/src/transport-ui.ts +0 -135
  293. package/src/transport.ts +0 -43
  294. package/src/turn-budget.ts +0 -109
  295. package/src/usage-format.ts +0 -42
  296. package/src/usage-recording-config.ts +0 -13
  297. package/src/usage-recording-store.ts +0 -183
  298. package/src/usage-recording.ts +0 -478
  299. package/src/verification-harness.ts +0 -516
  300. package/src/verification-policy.ts +0 -67
  301. package/src/verification-receipt.ts +0 -275
  302. package/src/verified-execution-benchmark.ts +0 -86
  303. package/src/verified-execution-contract.ts +0 -191
  304. package/src/verified-execution-schema.ts +0 -32
  305. package/src/work-item-ledger.ts +0 -1404
  306. package/src/work-item-persistence.ts +0 -254
  307. package/src/workflow-completion-controller.ts +0 -397
  308. package/src/workflow-planning.ts +0 -172
  309. package/src/workflow-tree-identity.ts +0 -289
  310. package/src/workflow-ui.ts +0 -69
  311. package/src/workflow-verification.ts +0 -296
  312. package/src/workspace.ts +0 -174
@@ -1,362 +0,0 @@
1
- // @generated by scripts/build-runtime.mjs; do not edit.
2
- // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
- import {
4
- DEFAULT_MAX_CONTEXT_BYTES,
5
- MAX_SUBAGENT_TIMEOUT_MS,
6
- redactPrivateText,
7
- truncateUtf8
8
- } from "./chunk-H3FP6DLR.ts";
9
-
10
- // src/delegation-contract.ts
11
- import { StringEnum } from "@earendil-works/pi-ai";
12
- import { Type } from "typebox";
13
- var DELEGATION_CONTRACT_VERSION = "pi-subagents:delegation:v2";
14
- var DELEGATION_CONTRACT_LEVELS = ["minimal", "full"];
15
- var DELEGATION_ENFORCEMENT_MODES = ["audit", "enforce"];
16
- var AUTHORITY_REQUIREMENTS = ["unspecified", "denied", "required"];
17
- var DELEGATION_SIDE_EFFECT_POLICIES = ["read-only", "idempotent", "mutating"];
18
- var MAX_IDENTIFIER_BYTES = 256;
19
- var MAX_TEXT_BYTES = 16 * 1024;
20
- var MAX_ITEM_BYTES = 4 * 1024;
21
- var MAX_ITEMS = 50;
22
- var MAX_TURNS_OR_TOOLS = 1e6;
23
- var BoundedString = Type.String({ maxLength: MAX_TEXT_BYTES });
24
- var BoundedItem = Type.String({ maxLength: MAX_ITEM_BYTES });
25
- var BoundedItems = Type.Array(BoundedItem, { maxItems: MAX_ITEMS });
26
- var DependencySchema = Type.Object(
27
- {
28
- taskId: Type.String({ minLength: 1, maxLength: MAX_IDENTIFIER_BYTES }),
29
- artifactId: Type.Optional(Type.String({ minLength: 1, maxLength: MAX_IDENTIFIER_BYTES })),
30
- version: Type.Optional(Type.String({ minLength: 1, maxLength: MAX_IDENTIFIER_BYTES }))
31
- },
32
- { additionalProperties: false }
33
- );
34
- var DelegationContractSchema = Type.Object(
35
- {
36
- version: Type.Literal(DELEGATION_CONTRACT_VERSION),
37
- level: StringEnum(DELEGATION_CONTRACT_LEVELS),
38
- taskId: Type.String({ minLength: 1, maxLength: MAX_IDENTIFIER_BYTES }),
39
- objective: BoundedString,
40
- nonGoals: Type.Optional(BoundedItems),
41
- dependencies: Type.Optional(Type.Array(DependencySchema, { maxItems: MAX_ITEMS })),
42
- requiredInputs: Type.Optional(BoundedItems),
43
- requestedAuthority: Type.Optional(
44
- Type.Object(
45
- {
46
- capabilities: Type.Optional(
47
- Type.Array(BoundedItem, {
48
- maxItems: MAX_ITEMS,
49
- description: "Capabilities requested from the selected agent manifest."
50
- })
51
- ),
52
- tools: Type.Optional(
53
- Type.Array(BoundedItem, {
54
- maxItems: MAX_ITEMS,
55
- description: "Tools that enforcement may narrow to the selected agent's available set."
56
- })
57
- ),
58
- readPaths: Type.Optional(
59
- Type.Array(BoundedItem, {
60
- maxItems: MAX_ITEMS,
61
- description: 'Audit metadata only; enforcement "enforce" rejects non-empty readPaths because path scope is unsupported.'
62
- })
63
- ),
64
- writePaths: Type.Optional(
65
- Type.Array(BoundedItem, {
66
- maxItems: MAX_ITEMS,
67
- description: 'Audit metadata only; enforcement "enforce" rejects non-empty writePaths because path scope is unsupported.'
68
- })
69
- ),
70
- network: Type.Optional(
71
- StringEnum(AUTHORITY_REQUIREMENTS, {
72
- description: 'Audit metadata only; enforcement "enforce" rejects denied or required network guarantees as unsupported.'
73
- })
74
- ),
75
- secrets: Type.Optional(
76
- StringEnum(AUTHORITY_REQUIREMENTS, {
77
- description: 'Audit metadata only; enforcement "enforce" rejects denied or required secret guarantees as unsupported.'
78
- })
79
- )
80
- },
81
- {
82
- additionalProperties: false,
83
- description: "Only capabilities and tools have executor enforcement; readPaths, writePaths, network, and secrets are unsupported guarantees."
84
- }
85
- )
86
- ),
87
- acceptanceCriteria: Type.Optional(BoundedItems),
88
- requiredEvidence: Type.Optional(BoundedItems),
89
- budget: Type.Optional(
90
- Type.Object(
91
- {
92
- timeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: MAX_SUBAGENT_TIMEOUT_MS })),
93
- maxTurns: Type.Optional(Type.Integer({ minimum: 1, maximum: MAX_TURNS_OR_TOOLS })),
94
- maxToolCalls: Type.Optional(Type.Integer({ minimum: 1, maximum: MAX_TURNS_OR_TOOLS }))
95
- },
96
- { additionalProperties: false }
97
- )
98
- ),
99
- admission: Type.Optional(
100
- Type.Object(
101
- {
102
- contextPressure: StringEnum(["low", "medium", "high"]),
103
- independentWorkItems: Type.Integer({ minimum: 1, maximum: 2 }),
104
- coupling: StringEnum(["dense", "sparse"]),
105
- verificationRequired: Type.Boolean(),
106
- verificationAvailable: Type.Boolean(),
107
- budgetAllowsChildren: Type.Boolean(),
108
- requirementsComplete: Type.Boolean()
109
- },
110
- { additionalProperties: false }
111
- )
112
- ),
113
- sideEffectPolicy: Type.Optional(StringEnum(DELEGATION_SIDE_EFFECT_POLICIES)),
114
- enforcement: Type.Optional(
115
- StringEnum(DELEGATION_ENFORCEMENT_MODES, {
116
- description: "Defaults to audit; enforce rejects unsupported requestedAuthority guarantees before child launch."
117
- })
118
- )
119
- },
120
- {
121
- additionalProperties: false,
122
- description: "Advanced delegation contract. For ordinary delegation omit this object; use it only for explicit acceptance, authority, evidence, or admission semantics."
123
- }
124
- );
125
- function normalizeDelegationContract(value) {
126
- if (!isPlainObject(value)) return void 0;
127
- if (!hasOnlyKeys(value, [
128
- "version",
129
- "level",
130
- "taskId",
131
- "objective",
132
- "nonGoals",
133
- "dependencies",
134
- "requiredInputs",
135
- "requestedAuthority",
136
- "acceptanceCriteria",
137
- "requiredEvidence",
138
- "budget",
139
- "admission",
140
- "sideEffectPolicy",
141
- "enforcement"
142
- ])) {
143
- return void 0;
144
- }
145
- if (value.version !== DELEGATION_CONTRACT_VERSION || typeof value.level !== "string" || !DELEGATION_CONTRACT_LEVELS.includes(
146
- value.level
147
- ) || typeof value.taskId !== "string" || !value.taskId.trim() || typeof value.objective !== "string") {
148
- return void 0;
149
- }
150
- const taskId = bounded(value.taskId, MAX_IDENTIFIER_BYTES);
151
- const objective = bounded(value.objective, MAX_TEXT_BYTES);
152
- if (!taskId || !objective) return void 0;
153
- const nonGoals = normalizeStrings(value.nonGoals);
154
- const requiredInputs = normalizeStrings(value.requiredInputs);
155
- const acceptanceCriteria = normalizeStrings(value.acceptanceCriteria);
156
- const requiredEvidence = normalizeStrings(value.requiredEvidence);
157
- if (!nonGoals || !requiredInputs || !acceptanceCriteria || !requiredEvidence) return void 0;
158
- const dependencies = normalizeDependencies(value.dependencies);
159
- if (!dependencies) return void 0;
160
- const authority = normalizeAuthority(value.requestedAuthority);
161
- if (authority === false) return void 0;
162
- const budget = normalizeBudget(value.budget);
163
- if (budget === false) return void 0;
164
- const admission = normalizeAdmission(value.admission);
165
- if (admission === false) return void 0;
166
- const sideEffectPolicy = value.sideEffectPolicy ?? "mutating";
167
- if (typeof sideEffectPolicy !== "string" || !DELEGATION_SIDE_EFFECT_POLICIES.includes(
168
- sideEffectPolicy
169
- )) {
170
- return void 0;
171
- }
172
- const enforcement = value.enforcement ?? "audit";
173
- if (typeof enforcement !== "string" || !DELEGATION_ENFORCEMENT_MODES.includes(
174
- enforcement
175
- )) {
176
- return void 0;
177
- }
178
- return {
179
- version: DELEGATION_CONTRACT_VERSION,
180
- level: value.level,
181
- taskId,
182
- objective,
183
- nonGoals,
184
- dependencies,
185
- requiredInputs,
186
- ...authority === void 0 ? {} : { requestedAuthority: authority },
187
- acceptanceCriteria,
188
- requiredEvidence,
189
- ...budget === void 0 ? {} : { budget },
190
- ...admission === void 0 ? {} : { admission },
191
- sideEffectPolicy,
192
- enforcement
193
- };
194
- }
195
- function appendDelegationContract(prompt, value, maxBytes = DEFAULT_MAX_CONTEXT_BYTES) {
196
- const contract = normalizeDelegationContract(value);
197
- if (!contract) return { text: prompt, truncated: false };
198
- const suffix = [
199
- "",
200
- "Delegation contract:",
201
- JSON.stringify(contract),
202
- "The requested authority is advisory until an executor-owned ExecutionPlan confirms which controls are enforceable and effective.",
203
- "Acknowledge missing inputs, authority, capabilities, or verification instead of guessing."
204
- ].join("\n");
205
- const suffixBytes = Buffer.byteLength(suffix, "utf8");
206
- const boundedPrompt = truncateUtf8(
207
- redactPrivateText(prompt),
208
- Math.max(0, maxBytes - suffixBytes)
209
- );
210
- const text = truncateUtf8(`${boundedPrompt.text}${suffix}`, maxBytes);
211
- return {
212
- text: text.text,
213
- contract,
214
- truncated: boundedPrompt.truncated || text.truncated
215
- };
216
- }
217
- function normalizeAdmission(value) {
218
- if (value === void 0) return void 0;
219
- if (!isPlainObject(value)) return false;
220
- if (!hasOnlyKeys(value, [
221
- "contextPressure",
222
- "independentWorkItems",
223
- "coupling",
224
- "verificationRequired",
225
- "verificationAvailable",
226
- "budgetAllowsChildren",
227
- "requirementsComplete"
228
- ]) || !["low", "medium", "high"].includes(String(value.contextPressure)) || !Number.isSafeInteger(value.independentWorkItems) || Number(value.independentWorkItems) < 1 || Number(value.independentWorkItems) > 2 || !["dense", "sparse"].includes(String(value.coupling)) || typeof value.verificationRequired !== "boolean" || typeof value.verificationAvailable !== "boolean" || typeof value.budgetAllowsChildren !== "boolean" || typeof value.requirementsComplete !== "boolean") {
229
- return false;
230
- }
231
- return {
232
- contextPressure: value.contextPressure,
233
- independentWorkItems: Number(value.independentWorkItems),
234
- coupling: value.coupling,
235
- verificationRequired: value.verificationRequired,
236
- verificationAvailable: value.verificationAvailable,
237
- budgetAllowsChildren: value.budgetAllowsChildren,
238
- requirementsComplete: value.requirementsComplete
239
- };
240
- }
241
- function normalizeDependencies(value) {
242
- if (value === void 0) return [];
243
- if (!Array.isArray(value) || value.length > MAX_ITEMS) return void 0;
244
- const result = [];
245
- const seen = /* @__PURE__ */ new Set();
246
- for (const item of value) {
247
- if (!isPlainObject(item) || !hasOnlyKeys(item, ["taskId", "artifactId", "version"]) || typeof item.taskId !== "string") {
248
- return void 0;
249
- }
250
- const taskId = bounded(item.taskId, MAX_IDENTIFIER_BYTES);
251
- if (!taskId || seen.has(taskId)) return void 0;
252
- seen.add(taskId);
253
- const artifactId = optionalString(item.artifactId, MAX_IDENTIFIER_BYTES);
254
- const version = optionalString(item.version, MAX_IDENTIFIER_BYTES);
255
- if (artifactId === false || version === false) return void 0;
256
- result.push({
257
- taskId,
258
- ...artifactId === void 0 ? {} : { artifactId },
259
- ...version === void 0 ? {} : { version }
260
- });
261
- }
262
- return result;
263
- }
264
- function normalizeAuthority(value) {
265
- if (value === void 0) return void 0;
266
- if (!isPlainObject(value)) return false;
267
- if (!hasOnlyKeys(value, ["capabilities", "tools", "readPaths", "writePaths", "network", "secrets"])) {
268
- return false;
269
- }
270
- const capabilities = normalizeOptionalStrings(value.capabilities);
271
- const tools = normalizeOptionalStrings(value.tools);
272
- const readPaths = normalizeOptionalStrings(value.readPaths);
273
- const writePaths = normalizeOptionalStrings(value.writePaths);
274
- if (capabilities === false || tools === false || readPaths === false || writePaths === false) {
275
- return false;
276
- }
277
- const network = normalizeAuthorityRequirement(value.network);
278
- const secrets = normalizeAuthorityRequirement(value.secrets);
279
- if (network === false || secrets === false) return false;
280
- return {
281
- ...capabilities === void 0 ? {} : { capabilities },
282
- ...tools === void 0 ? {} : { tools },
283
- ...readPaths === void 0 ? {} : { readPaths },
284
- ...writePaths === void 0 ? {} : { writePaths },
285
- ...network === void 0 ? {} : { network },
286
- ...secrets === void 0 ? {} : { secrets }
287
- };
288
- }
289
- function normalizeBudget(value) {
290
- if (value === void 0) return void 0;
291
- if (!isPlainObject(value) || !hasOnlyKeys(value, ["timeoutMs", "maxTurns", "maxToolCalls"])) {
292
- return false;
293
- }
294
- const timeoutMs = optionalInteger(value.timeoutMs, MAX_SUBAGENT_TIMEOUT_MS);
295
- const maxTurns = optionalInteger(value.maxTurns, MAX_TURNS_OR_TOOLS);
296
- const maxToolCalls = optionalInteger(value.maxToolCalls, MAX_TURNS_OR_TOOLS);
297
- if (timeoutMs === false || maxTurns === false || maxToolCalls === false) return false;
298
- return {
299
- ...timeoutMs === void 0 ? {} : { timeoutMs },
300
- ...maxTurns === void 0 ? {} : { maxTurns },
301
- ...maxToolCalls === void 0 ? {} : { maxToolCalls }
302
- };
303
- }
304
- function normalizeStrings(value) {
305
- if (value === void 0) return [];
306
- const normalized = normalizeOptionalStrings(value);
307
- return normalized === false ? void 0 : normalized;
308
- }
309
- function normalizeOptionalStrings(value) {
310
- if (value === void 0) return void 0;
311
- if (!Array.isArray(value) || value.length > MAX_ITEMS) return false;
312
- const result = [];
313
- const seen = /* @__PURE__ */ new Set();
314
- for (const item of value) {
315
- if (typeof item !== "string") return false;
316
- const normalized = bounded(item, MAX_ITEM_BYTES);
317
- if (!normalized || seen.has(normalized)) continue;
318
- seen.add(normalized);
319
- result.push(normalized);
320
- }
321
- return result;
322
- }
323
- function normalizeAuthorityRequirement(value) {
324
- if (value === void 0) return void 0;
325
- if (typeof value !== "string" || !AUTHORITY_REQUIREMENTS.includes(value)) {
326
- return false;
327
- }
328
- return value;
329
- }
330
- function optionalString(value, maxBytes) {
331
- if (value === void 0) return void 0;
332
- if (typeof value !== "string") return false;
333
- const normalized = bounded(value, maxBytes);
334
- return normalized || false;
335
- }
336
- function optionalInteger(value, max) {
337
- if (value === void 0) return void 0;
338
- if (!Number.isSafeInteger(value) || value < 1 || value > max)
339
- return false;
340
- return value;
341
- }
342
- function bounded(value, maxBytes) {
343
- return truncateUtf8(redactPrivateText(value), maxBytes).text.trim();
344
- }
345
- function hasOnlyKeys(value, allowed) {
346
- return Object.keys(value).every((key) => allowed.includes(key));
347
- }
348
- function isPlainObject(value) {
349
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
350
- }
351
-
352
- export {
353
- DELEGATION_CONTRACT_VERSION,
354
- DELEGATION_CONTRACT_LEVELS,
355
- DELEGATION_ENFORCEMENT_MODES,
356
- AUTHORITY_REQUIREMENTS,
357
- DELEGATION_SIDE_EFFECT_POLICIES,
358
- DelegationContractSchema,
359
- normalizeDelegationContract,
360
- appendDelegationContract
361
- };
362
- //# sourceMappingURL=chunk-JSZIP73U.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/delegation-contract.ts"],
4
- "sourcesContent": ["import { StringEnum } from \"@earendil-works/pi-ai\";\nimport { Type } from \"typebox\";\nimport { redactPrivateText } from \"./context.js\";\nimport { DEFAULT_MAX_CONTEXT_BYTES, MAX_SUBAGENT_TIMEOUT_MS, truncateUtf8 } from \"./limits.js\";\n\nexport const DELEGATION_CONTRACT_VERSION = \"pi-subagents:delegation:v2\" as const;\nexport const DELEGATION_CONTRACT_LEVELS = [\"minimal\", \"full\"] as const;\nexport const DELEGATION_ENFORCEMENT_MODES = [\"audit\", \"enforce\"] as const;\nexport const AUTHORITY_REQUIREMENTS = [\"unspecified\", \"denied\", \"required\"] as const;\nexport const DELEGATION_SIDE_EFFECT_POLICIES = [\"read-only\", \"idempotent\", \"mutating\"] as const;\n\nconst MAX_IDENTIFIER_BYTES = 256;\nconst MAX_TEXT_BYTES = 16 * 1024;\nconst MAX_ITEM_BYTES = 4 * 1024;\nconst MAX_ITEMS = 50;\nconst MAX_TURNS_OR_TOOLS = 1_000_000;\n\nconst BoundedString = Type.String({ maxLength: MAX_TEXT_BYTES });\nconst BoundedItem = Type.String({ maxLength: MAX_ITEM_BYTES });\nconst BoundedItems = Type.Array(BoundedItem, { maxItems: MAX_ITEMS });\nconst DependencySchema = Type.Object(\n\t{\n\t\ttaskId: Type.String({ minLength: 1, maxLength: MAX_IDENTIFIER_BYTES }),\n\t\tartifactId: Type.Optional(Type.String({ minLength: 1, maxLength: MAX_IDENTIFIER_BYTES })),\n\t\tversion: Type.Optional(Type.String({ minLength: 1, maxLength: MAX_IDENTIFIER_BYTES })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const DelegationContractSchema = Type.Object(\n\t{\n\t\tversion: Type.Literal(DELEGATION_CONTRACT_VERSION),\n\t\tlevel: StringEnum(DELEGATION_CONTRACT_LEVELS),\n\t\ttaskId: Type.String({ minLength: 1, maxLength: MAX_IDENTIFIER_BYTES }),\n\t\tobjective: BoundedString,\n\t\tnonGoals: Type.Optional(BoundedItems),\n\t\tdependencies: Type.Optional(Type.Array(DependencySchema, { maxItems: MAX_ITEMS })),\n\t\trequiredInputs: Type.Optional(BoundedItems),\n\t\trequestedAuthority: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tcapabilities: Type.Optional(\n\t\t\t\t\t\tType.Array(BoundedItem, {\n\t\t\t\t\t\t\tmaxItems: MAX_ITEMS,\n\t\t\t\t\t\t\tdescription: \"Capabilities requested from the selected agent manifest.\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\ttools: Type.Optional(\n\t\t\t\t\t\tType.Array(BoundedItem, {\n\t\t\t\t\t\t\tmaxItems: MAX_ITEMS,\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\"Tools that enforcement may narrow to the selected agent's available set.\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\treadPaths: Type.Optional(\n\t\t\t\t\t\tType.Array(BoundedItem, {\n\t\t\t\t\t\t\tmaxItems: MAX_ITEMS,\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t'Audit metadata only; enforcement \"enforce\" rejects non-empty readPaths because path scope is unsupported.',\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\twritePaths: Type.Optional(\n\t\t\t\t\t\tType.Array(BoundedItem, {\n\t\t\t\t\t\t\tmaxItems: MAX_ITEMS,\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t'Audit metadata only; enforcement \"enforce\" rejects non-empty writePaths because path scope is unsupported.',\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tnetwork: Type.Optional(\n\t\t\t\t\t\tStringEnum(AUTHORITY_REQUIREMENTS, {\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t'Audit metadata only; enforcement \"enforce\" rejects denied or required network guarantees as unsupported.',\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tsecrets: Type.Optional(\n\t\t\t\t\t\tStringEnum(AUTHORITY_REQUIREMENTS, {\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t'Audit metadata only; enforcement \"enforce\" rejects denied or required secret guarantees as unsupported.',\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Only capabilities and tools have executor enforcement; readPaths, writePaths, network, and secrets are unsupported guarantees.\",\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t\tacceptanceCriteria: Type.Optional(BoundedItems),\n\t\trequiredEvidence: Type.Optional(BoundedItems),\n\t\tbudget: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\ttimeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: MAX_SUBAGENT_TIMEOUT_MS })),\n\t\t\t\t\tmaxTurns: Type.Optional(Type.Integer({ minimum: 1, maximum: MAX_TURNS_OR_TOOLS })),\n\t\t\t\t\tmaxToolCalls: Type.Optional(Type.Integer({ minimum: 1, maximum: MAX_TURNS_OR_TOOLS })),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: false },\n\t\t\t),\n\t\t),\n\t\tadmission: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tcontextPressure: StringEnum([\"low\", \"medium\", \"high\"] as const),\n\t\t\t\t\tindependentWorkItems: Type.Integer({ minimum: 1, maximum: 2 }),\n\t\t\t\t\tcoupling: StringEnum([\"dense\", \"sparse\"] as const),\n\t\t\t\t\tverificationRequired: Type.Boolean(),\n\t\t\t\t\tverificationAvailable: Type.Boolean(),\n\t\t\t\t\tbudgetAllowsChildren: Type.Boolean(),\n\t\t\t\t\trequirementsComplete: Type.Boolean(),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: false },\n\t\t\t),\n\t\t),\n\t\tsideEffectPolicy: Type.Optional(StringEnum(DELEGATION_SIDE_EFFECT_POLICIES)),\n\t\tenforcement: Type.Optional(\n\t\t\tStringEnum(DELEGATION_ENFORCEMENT_MODES, {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Defaults to audit; enforce rejects unsupported requestedAuthority guarantees before child launch.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tadditionalProperties: false,\n\t\tdescription:\n\t\t\t\"Advanced delegation contract. For ordinary delegation omit this object; use it only for explicit acceptance, authority, evidence, or admission semantics.\",\n\t},\n);\n\nexport interface DelegationDependency {\n\ttaskId: string;\n\tartifactId?: string;\n\tversion?: string;\n}\n\nexport interface DelegationAuthorityRequest {\n\tcapabilities?: string[];\n\ttools?: string[];\n\treadPaths?: string[];\n\twritePaths?: string[];\n\tnetwork?: (typeof AUTHORITY_REQUIREMENTS)[number];\n\tsecrets?: (typeof AUTHORITY_REQUIREMENTS)[number];\n}\n\nexport interface DelegationBudgetRequest {\n\ttimeoutMs?: number;\n\tmaxTurns?: number;\n\tmaxToolCalls?: number;\n}\n\nexport interface DelegationAdmissionRequest {\n\tcontextPressure: \"low\" | \"medium\" | \"high\";\n\tindependentWorkItems: number;\n\tcoupling: \"dense\" | \"sparse\";\n\tverificationRequired: boolean;\n\tverificationAvailable: boolean;\n\tbudgetAllowsChildren: boolean;\n\trequirementsComplete: boolean;\n}\n\nexport interface DelegationContract {\n\tversion: typeof DELEGATION_CONTRACT_VERSION;\n\tlevel: (typeof DELEGATION_CONTRACT_LEVELS)[number];\n\ttaskId: string;\n\tobjective: string;\n\tnonGoals: string[];\n\tdependencies: DelegationDependency[];\n\trequiredInputs: string[];\n\trequestedAuthority?: DelegationAuthorityRequest;\n\tacceptanceCriteria: string[];\n\trequiredEvidence: string[];\n\tbudget?: DelegationBudgetRequest;\n\tadmission?: DelegationAdmissionRequest;\n\tsideEffectPolicy: (typeof DELEGATION_SIDE_EFFECT_POLICIES)[number];\n\tenforcement: (typeof DELEGATION_ENFORCEMENT_MODES)[number];\n}\n\nexport interface AppendedDelegationContract {\n\ttext: string;\n\tcontract?: DelegationContract;\n\ttruncated: boolean;\n}\n\nexport function normalizeDelegationContract(value: unknown): DelegationContract | undefined {\n\tif (!isPlainObject(value)) return undefined;\n\tif (\n\t\t!hasOnlyKeys(value, [\n\t\t\t\"version\",\n\t\t\t\"level\",\n\t\t\t\"taskId\",\n\t\t\t\"objective\",\n\t\t\t\"nonGoals\",\n\t\t\t\"dependencies\",\n\t\t\t\"requiredInputs\",\n\t\t\t\"requestedAuthority\",\n\t\t\t\"acceptanceCriteria\",\n\t\t\t\"requiredEvidence\",\n\t\t\t\"budget\",\n\t\t\t\"admission\",\n\t\t\t\"sideEffectPolicy\",\n\t\t\t\"enforcement\",\n\t\t])\n\t) {\n\t\treturn undefined;\n\t}\n\tif (\n\t\tvalue.version !== DELEGATION_CONTRACT_VERSION ||\n\t\ttypeof value.level !== \"string\" ||\n\t\t!DELEGATION_CONTRACT_LEVELS.includes(\n\t\t\tvalue.level as (typeof DELEGATION_CONTRACT_LEVELS)[number],\n\t\t) ||\n\t\ttypeof value.taskId !== \"string\" ||\n\t\t!value.taskId.trim() ||\n\t\ttypeof value.objective !== \"string\"\n\t) {\n\t\treturn undefined;\n\t}\n\tconst taskId = bounded(value.taskId, MAX_IDENTIFIER_BYTES);\n\tconst objective = bounded(value.objective, MAX_TEXT_BYTES);\n\tif (!taskId || !objective) return undefined;\n\tconst nonGoals = normalizeStrings(value.nonGoals);\n\tconst requiredInputs = normalizeStrings(value.requiredInputs);\n\tconst acceptanceCriteria = normalizeStrings(value.acceptanceCriteria);\n\tconst requiredEvidence = normalizeStrings(value.requiredEvidence);\n\tif (!nonGoals || !requiredInputs || !acceptanceCriteria || !requiredEvidence) return undefined;\n\tconst dependencies = normalizeDependencies(value.dependencies);\n\tif (!dependencies) return undefined;\n\tconst authority = normalizeAuthority(value.requestedAuthority);\n\tif (authority === false) return undefined;\n\tconst budget = normalizeBudget(value.budget);\n\tif (budget === false) return undefined;\n\tconst admission = normalizeAdmission(value.admission);\n\tif (admission === false) return undefined;\n\tconst sideEffectPolicy = value.sideEffectPolicy ?? \"mutating\";\n\tif (\n\t\ttypeof sideEffectPolicy !== \"string\" ||\n\t\t!DELEGATION_SIDE_EFFECT_POLICIES.includes(\n\t\t\tsideEffectPolicy as (typeof DELEGATION_SIDE_EFFECT_POLICIES)[number],\n\t\t)\n\t) {\n\t\treturn undefined;\n\t}\n\tconst enforcement = value.enforcement ?? \"audit\";\n\tif (\n\t\ttypeof enforcement !== \"string\" ||\n\t\t!DELEGATION_ENFORCEMENT_MODES.includes(\n\t\t\tenforcement as (typeof DELEGATION_ENFORCEMENT_MODES)[number],\n\t\t)\n\t) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tversion: DELEGATION_CONTRACT_VERSION,\n\t\tlevel: value.level as DelegationContract[\"level\"],\n\t\ttaskId,\n\t\tobjective,\n\t\tnonGoals,\n\t\tdependencies,\n\t\trequiredInputs,\n\t\t...(authority === undefined ? {} : { requestedAuthority: authority }),\n\t\tacceptanceCriteria,\n\t\trequiredEvidence,\n\t\t...(budget === undefined ? {} : { budget }),\n\t\t...(admission === undefined ? {} : { admission }),\n\t\tsideEffectPolicy: sideEffectPolicy as DelegationContract[\"sideEffectPolicy\"],\n\t\tenforcement: enforcement as DelegationContract[\"enforcement\"],\n\t};\n}\n\nexport function appendDelegationContract(\n\tprompt: string,\n\tvalue: unknown,\n\tmaxBytes = DEFAULT_MAX_CONTEXT_BYTES,\n): AppendedDelegationContract {\n\tconst contract = normalizeDelegationContract(value);\n\tif (!contract) return { text: prompt, truncated: false };\n\tconst suffix = [\n\t\t\"\",\n\t\t\"Delegation contract:\",\n\t\tJSON.stringify(contract),\n\t\t\"The requested authority is advisory until an executor-owned ExecutionPlan confirms which controls are enforceable and effective.\",\n\t\t\"Acknowledge missing inputs, authority, capabilities, or verification instead of guessing.\",\n\t].join(\"\\n\");\n\tconst suffixBytes = Buffer.byteLength(suffix, \"utf8\");\n\tconst boundedPrompt = truncateUtf8(\n\t\tredactPrivateText(prompt),\n\t\tMath.max(0, maxBytes - suffixBytes),\n\t);\n\tconst text = truncateUtf8(`${boundedPrompt.text}${suffix}`, maxBytes);\n\treturn {\n\t\ttext: text.text,\n\t\tcontract,\n\t\ttruncated: boundedPrompt.truncated || text.truncated,\n\t};\n}\n\nfunction normalizeAdmission(value: unknown): DelegationAdmissionRequest | undefined | false {\n\tif (value === undefined) return undefined;\n\tif (!isPlainObject(value)) return false;\n\tif (\n\t\t!hasOnlyKeys(value, [\n\t\t\t\"contextPressure\",\n\t\t\t\"independentWorkItems\",\n\t\t\t\"coupling\",\n\t\t\t\"verificationRequired\",\n\t\t\t\"verificationAvailable\",\n\t\t\t\"budgetAllowsChildren\",\n\t\t\t\"requirementsComplete\",\n\t\t]) ||\n\t\t![\"low\", \"medium\", \"high\"].includes(String(value.contextPressure)) ||\n\t\t!Number.isSafeInteger(value.independentWorkItems) ||\n\t\tNumber(value.independentWorkItems) < 1 ||\n\t\tNumber(value.independentWorkItems) > 2 ||\n\t\t![\"dense\", \"sparse\"].includes(String(value.coupling)) ||\n\t\ttypeof value.verificationRequired !== \"boolean\" ||\n\t\ttypeof value.verificationAvailable !== \"boolean\" ||\n\t\ttypeof value.budgetAllowsChildren !== \"boolean\" ||\n\t\ttypeof value.requirementsComplete !== \"boolean\"\n\t) {\n\t\treturn false;\n\t}\n\treturn {\n\t\tcontextPressure: value.contextPressure as DelegationAdmissionRequest[\"contextPressure\"],\n\t\tindependentWorkItems: Number(value.independentWorkItems),\n\t\tcoupling: value.coupling as DelegationAdmissionRequest[\"coupling\"],\n\t\tverificationRequired: value.verificationRequired,\n\t\tverificationAvailable: value.verificationAvailable,\n\t\tbudgetAllowsChildren: value.budgetAllowsChildren,\n\t\trequirementsComplete: value.requirementsComplete,\n\t};\n}\n\nfunction normalizeDependencies(value: unknown): DelegationDependency[] | undefined {\n\tif (value === undefined) return [];\n\tif (!Array.isArray(value) || value.length > MAX_ITEMS) return undefined;\n\tconst result: DelegationDependency[] = [];\n\tconst seen = new Set<string>();\n\tfor (const item of value) {\n\t\tif (\n\t\t\t!isPlainObject(item) ||\n\t\t\t!hasOnlyKeys(item, [\"taskId\", \"artifactId\", \"version\"]) ||\n\t\t\ttypeof item.taskId !== \"string\"\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst taskId = bounded(item.taskId, MAX_IDENTIFIER_BYTES);\n\t\tif (!taskId || seen.has(taskId)) return undefined;\n\t\tseen.add(taskId);\n\t\tconst artifactId = optionalString(item.artifactId, MAX_IDENTIFIER_BYTES);\n\t\tconst version = optionalString(item.version, MAX_IDENTIFIER_BYTES);\n\t\tif (artifactId === false || version === false) return undefined;\n\t\tresult.push({\n\t\t\ttaskId,\n\t\t\t...(artifactId === undefined ? {} : { artifactId }),\n\t\t\t...(version === undefined ? {} : { version }),\n\t\t});\n\t}\n\treturn result;\n}\n\nfunction normalizeAuthority(value: unknown): DelegationAuthorityRequest | undefined | false {\n\tif (value === undefined) return undefined;\n\tif (!isPlainObject(value)) return false;\n\tif (\n\t\t!hasOnlyKeys(value, [\"capabilities\", \"tools\", \"readPaths\", \"writePaths\", \"network\", \"secrets\"])\n\t) {\n\t\treturn false;\n\t}\n\tconst capabilities = normalizeOptionalStrings(value.capabilities);\n\tconst tools = normalizeOptionalStrings(value.tools);\n\tconst readPaths = normalizeOptionalStrings(value.readPaths);\n\tconst writePaths = normalizeOptionalStrings(value.writePaths);\n\tif (capabilities === false || tools === false || readPaths === false || writePaths === false) {\n\t\treturn false;\n\t}\n\tconst network = normalizeAuthorityRequirement(value.network);\n\tconst secrets = normalizeAuthorityRequirement(value.secrets);\n\tif (network === false || secrets === false) return false;\n\treturn {\n\t\t...(capabilities === undefined ? {} : { capabilities }),\n\t\t...(tools === undefined ? {} : { tools }),\n\t\t...(readPaths === undefined ? {} : { readPaths }),\n\t\t...(writePaths === undefined ? {} : { writePaths }),\n\t\t...(network === undefined ? {} : { network }),\n\t\t...(secrets === undefined ? {} : { secrets }),\n\t};\n}\n\nfunction normalizeBudget(value: unknown): DelegationBudgetRequest | undefined | false {\n\tif (value === undefined) return undefined;\n\tif (!isPlainObject(value) || !hasOnlyKeys(value, [\"timeoutMs\", \"maxTurns\", \"maxToolCalls\"])) {\n\t\treturn false;\n\t}\n\tconst timeoutMs = optionalInteger(value.timeoutMs, MAX_SUBAGENT_TIMEOUT_MS);\n\tconst maxTurns = optionalInteger(value.maxTurns, MAX_TURNS_OR_TOOLS);\n\tconst maxToolCalls = optionalInteger(value.maxToolCalls, MAX_TURNS_OR_TOOLS);\n\tif (timeoutMs === false || maxTurns === false || maxToolCalls === false) return false;\n\treturn {\n\t\t...(timeoutMs === undefined ? {} : { timeoutMs }),\n\t\t...(maxTurns === undefined ? {} : { maxTurns }),\n\t\t...(maxToolCalls === undefined ? {} : { maxToolCalls }),\n\t};\n}\n\nfunction normalizeStrings(value: unknown): string[] | undefined {\n\tif (value === undefined) return [];\n\tconst normalized = normalizeOptionalStrings(value);\n\treturn normalized === false ? undefined : normalized;\n}\n\nfunction normalizeOptionalStrings(value: unknown): string[] | undefined | false {\n\tif (value === undefined) return undefined;\n\tif (!Array.isArray(value) || value.length > MAX_ITEMS) return false;\n\tconst result: string[] = [];\n\tconst seen = new Set<string>();\n\tfor (const item of value) {\n\t\tif (typeof item !== \"string\") return false;\n\t\tconst normalized = bounded(item, MAX_ITEM_BYTES);\n\t\tif (!normalized || seen.has(normalized)) continue;\n\t\tseen.add(normalized);\n\t\tresult.push(normalized);\n\t}\n\treturn result;\n}\n\nfunction normalizeAuthorityRequirement(\n\tvalue: unknown,\n): (typeof AUTHORITY_REQUIREMENTS)[number] | undefined | false {\n\tif (value === undefined) return undefined;\n\tif (\n\t\ttypeof value !== \"string\" ||\n\t\t!AUTHORITY_REQUIREMENTS.includes(value as (typeof AUTHORITY_REQUIREMENTS)[number])\n\t) {\n\t\treturn false;\n\t}\n\treturn value as (typeof AUTHORITY_REQUIREMENTS)[number];\n}\n\nfunction optionalString(value: unknown, maxBytes: number): string | undefined | false {\n\tif (value === undefined) return undefined;\n\tif (typeof value !== \"string\") return false;\n\tconst normalized = bounded(value, maxBytes);\n\treturn normalized || false;\n}\n\nfunction optionalInteger(value: unknown, max: number): number | undefined | false {\n\tif (value === undefined) return undefined;\n\tif (!Number.isSafeInteger(value) || (value as number) < 1 || (value as number) > max)\n\t\treturn false;\n\treturn value as number;\n}\n\nfunction bounded(value: string, maxBytes: number): string {\n\treturn truncateUtf8(redactPrivateText(value), maxBytes).text.trim();\n}\n\nfunction hasOnlyKeys(value: Record<string, unknown>, allowed: readonly string[]): boolean {\n\treturn Object.keys(value).every((key) => allowed.includes(key));\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n\treturn Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n"],
5
- "mappings": ";;;;;;;;;;AAAA,SAAS,kBAAk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