@astrosheep/keiyaku 4.6.26 → 4.6.28

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 (301) hide show
  1. package/README.md +113 -35
  2. package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
  3. package/build/plugins/claude/skills/keiyaku/SKILL.md +14 -26
  4. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +64 -44
  5. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +13 -25
  6. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
  7. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +42 -29
  8. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +13 -8
  9. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +57 -61
  10. package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
  11. package/build/plugins/codex/skills/keiyaku/SKILL.md +14 -26
  12. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +64 -44
  13. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +13 -25
  14. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
  15. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +42 -29
  16. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +13 -8
  17. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +57 -61
  18. package/build/plugins/opencode/package.json +1 -1
  19. package/build/plugins/opencode/skills/keiyaku/SKILL.md +14 -26
  20. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +64 -44
  21. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +13 -25
  22. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
  23. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +42 -29
  24. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +13 -8
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +57 -61
  26. package/build/plugins/pi/README.md +7 -12
  27. package/build/plugins/pi/akuma-tools.ts +3 -18
  28. package/build/skills/keiyaku/SKILL.md +14 -26
  29. package/build/skills/keiyaku-akuma/SKILL.md +64 -44
  30. package/build/skills/keiyaku-akuma/references/automation.md +13 -25
  31. package/build/skills/keiyaku-babysit/SKILL.md +1 -1
  32. package/build/skills/keiyaku-bind/SKILL.md +42 -29
  33. package/build/skills/keiyaku-debt/SKILL.md +13 -8
  34. package/build/skills/keiyaku-workflow/SKILL.md +57 -61
  35. package/build/src/akuma/akuma-call.d.ts +15 -18
  36. package/build/src/akuma/akuma-call.js +55 -112
  37. package/build/src/akuma/akuma-errors.d.ts +0 -5
  38. package/build/src/akuma/akuma-errors.js +0 -9
  39. package/build/src/akuma/akuma-instance.d.ts +0 -2
  40. package/build/src/akuma/akuma-instance.js +18 -14
  41. package/build/src/akuma/akuma-observe.js +0 -1
  42. package/build/src/akuma/akuma-owner.js +0 -1
  43. package/build/src/akuma/akuma.d.ts +10 -26
  44. package/build/src/akuma/akuma.js +0 -2
  45. package/build/src/akuma/archetype.d.ts +0 -2
  46. package/build/src/akuma/archetype.js +3 -9
  47. package/build/src/akuma/body-launch.d.ts +12 -4
  48. package/build/src/akuma/body.d.ts +2 -5
  49. package/build/src/akuma/body.js +5 -49
  50. package/build/src/akuma/call-initial-tell.d.ts +39 -147
  51. package/build/src/akuma/call-initial-tell.js +0 -48
  52. package/build/src/akuma/caller.d.ts +0 -4
  53. package/build/src/akuma/custody.js +1 -57
  54. package/build/src/akuma/heart/facts.d.ts +0 -39
  55. package/build/src/akuma/heart/facts.js +0 -1
  56. package/build/src/akuma/heart/index.d.ts +1 -2
  57. package/build/src/akuma/heart/index.js +0 -1
  58. package/build/src/akuma/heart/schema.js +0 -26
  59. package/build/src/akuma/heart/soul.d.ts +2 -2
  60. package/build/src/akuma/heart/soul.js +2 -4
  61. package/build/src/akuma/identity.d.ts +0 -1
  62. package/build/src/akuma/identity.js +0 -2
  63. package/build/src/akuma/in-process-body.d.ts +1 -1
  64. package/build/src/akuma/index.d.ts +0 -2
  65. package/build/src/akuma/index.js +0 -1
  66. package/build/src/akuma/projection.d.ts +23 -23
  67. package/build/src/akuma/provider.d.ts +0 -5
  68. package/build/src/akuma/provider.js +0 -1
  69. package/build/src/akuma/providers/acp/core.js +1 -1
  70. package/build/src/akuma/providers/claude/index.js +1 -2
  71. package/build/src/akuma/providers/codex-app-server/events.d.ts +1 -1
  72. package/build/src/akuma/providers/codex-app-server/events.js +1 -3
  73. package/build/src/akuma/providers/codex-app-server/index.js +1 -1
  74. package/build/src/akuma/providers/execution-environment.d.ts +1 -3
  75. package/build/src/akuma/providers/execution-environment.js +1 -7
  76. package/build/src/akuma/providers/opencode-sdk/index.js +0 -1
  77. package/build/src/akuma/providers/opencode-sdk/session.d.ts +0 -1
  78. package/build/src/akuma/providers/opencode-sdk/session.js +4 -4
  79. package/build/src/akuma/providers/paseo/index.js +2 -9
  80. package/build/src/akuma/providers/pi/index.js +8 -14
  81. package/build/src/akuma/publication.d.ts +24 -59
  82. package/build/src/akuma/publication.js +29 -64
  83. package/build/src/akuma/selection-observation.d.ts +47 -2036
  84. package/build/src/akuma/selection-observation.js +1 -59
  85. package/build/src/akuma/turn-drive.d.ts +0 -8
  86. package/build/src/akuma/turn-drive.js +19 -103
  87. package/build/src/akuma-body.js +3 -6
  88. package/build/src/body-host.d.ts +8 -2
  89. package/build/src/body-host.js +30 -4
  90. package/build/src/cli/commands/akuma-grammar.d.ts +0 -2
  91. package/build/src/cli/commands/akuma-grammar.js +14 -37
  92. package/build/src/cli/commands/akuma.js +31 -49
  93. package/build/src/cli/commands/contract-grammar.d.ts +7 -1
  94. package/build/src/cli/commands/contract-grammar.js +15 -0
  95. package/build/src/cli/commands/contract-help.d.ts +13 -1
  96. package/build/src/cli/commands/contract-help.js +88 -81
  97. package/build/src/cli/commands/contract.js +27 -26
  98. package/build/src/cli/commands/debt-grammar.js +15 -15
  99. package/build/src/cli/commands/debt.js +3 -3
  100. package/build/src/cli/commands/install.d.ts +1 -1
  101. package/build/src/cli/commands/install.js +1 -2
  102. package/build/src/cli/commands/whoami.d.ts +0 -2
  103. package/build/src/cli/commands/whoami.js +0 -5
  104. package/build/src/cli/coordinates.js +15 -0
  105. package/build/src/cli/delivery-identity.d.ts +3 -0
  106. package/build/src/cli/delivery-identity.js +23 -0
  107. package/build/src/cli/parse.js +2 -1
  108. package/build/src/cli/render/akuma-activity.d.ts +0 -1
  109. package/build/src/cli/render/akuma-activity.js +1 -4
  110. package/build/src/cli/render/catalog.js +7 -1
  111. package/build/src/cli/render/contract-history.js +16 -38
  112. package/build/src/cli/render/contract-observation.d.ts +23 -10
  113. package/build/src/cli/render/contract-observation.js +9 -6
  114. package/build/src/cli/render/contract-wait.d.ts +2 -0
  115. package/build/src/cli/render/contract-wait.js +18 -0
  116. package/build/src/cli/render/contract.d.ts +2 -2
  117. package/build/src/cli/render/contract.js +57 -39
  118. package/build/src/cli/render/delivery-preview.js +13 -26
  119. package/build/src/cli/render/execution-progress.js +9 -9
  120. package/build/src/cli/render/kanshi.js +4 -11
  121. package/build/src/cli/render/receipt.d.ts +18 -0
  122. package/build/src/cli/render/receipt.js +34 -10
  123. package/build/src/cli/render/reconcile.js +3 -0
  124. package/build/src/cli/render/refusal.js +28 -6
  125. package/build/src/cli/render/whoami.js +1 -4
  126. package/build/src/cli/runtime.d.ts +0 -2
  127. package/build/src/cli/runtime.js +3 -7
  128. package/build/src/cli/selectors.d.ts +1 -2
  129. package/build/src/cli/selectors.js +2 -5
  130. package/build/src/contract-guidance.js +4 -2
  131. package/build/src/contract-worktree.d.ts +3 -3
  132. package/build/src/core/facts/codec.js +38 -5
  133. package/build/src/core/facts/fold.js +1 -0
  134. package/build/src/core/facts/gate.d.ts +10 -4
  135. package/build/src/core/facts/gate.js +56 -39
  136. package/build/src/core/facts/observation.d.ts +7 -1
  137. package/build/src/core/facts/observation.js +15 -0
  138. package/build/src/core/facts/offer.d.ts +2 -2
  139. package/build/src/core/facts/types.d.ts +17 -1
  140. package/build/src/core/facts/types.js +6 -0
  141. package/build/src/core/verbs/amend.js +8 -0
  142. package/build/src/core/verbs/bind.d.ts +3 -1
  143. package/build/src/core/verbs/bind.js +9 -1
  144. package/build/src/core/verbs/deliver.d.ts +2 -1
  145. package/build/src/core/verbs/deliver.js +4 -1
  146. package/build/src/core/verbs/placement.d.ts +2 -1
  147. package/build/src/core/verbs/placement.js +7 -4
  148. package/build/src/core/verbs/reintegrate.d.ts +2 -1
  149. package/build/src/core/verbs/reintegrate.js +4 -1
  150. package/build/src/debt/board.d.ts +10 -10
  151. package/build/src/debt/created-observation.d.ts +3 -3
  152. package/build/src/debt/document.d.ts +1 -1
  153. package/build/src/debt/index.d.ts +2 -24
  154. package/build/src/debt/index.js +11 -71
  155. package/build/src/debt/operation-types.d.ts +44 -3
  156. package/build/src/git/admission.js +18 -6
  157. package/build/src/git/integration.d.ts +4 -4
  158. package/build/src/git/integration.js +7 -1
  159. package/build/src/git/observe.d.ts +6 -4
  160. package/build/src/git/observe.js +18 -17
  161. package/build/src/git/reconcile.d.ts +20 -8
  162. package/build/src/git/reconcile.js +94 -45
  163. package/build/src/git/repository.d.ts +3 -1
  164. package/build/src/git/repository.js +26 -4
  165. package/build/src/git/scratch.d.ts +1 -1
  166. package/build/src/git/scratch.js +19 -18
  167. package/build/src/git/target-placement.d.ts +33 -7
  168. package/build/src/git/target-placement.js +67 -18
  169. package/build/src/git/target.d.ts +32 -0
  170. package/build/src/git/target.js +84 -0
  171. package/build/src/git/terminal-reconcile.d.ts +1 -1
  172. package/build/src/git/terminal-reconcile.js +34 -6
  173. package/build/src/index.d.ts +9 -7
  174. package/build/src/index.js +1 -1
  175. package/build/src/library/address.d.ts +1 -20
  176. package/build/src/library/address.js +3 -24
  177. package/build/src/library/akuma-creation.d.ts +2 -5
  178. package/build/src/library/akuma-creation.js +60 -44
  179. package/build/src/library/akumas.d.ts +3 -9
  180. package/build/src/library/akumas.js +12 -25
  181. package/build/src/library/bind.d.ts +21 -9
  182. package/build/src/library/bind.js +5 -1
  183. package/build/src/library/continuation.d.ts +130 -155
  184. package/build/src/library/continuation.js +1 -4
  185. package/build/src/library/contract-composition.d.ts +4 -9
  186. package/build/src/library/contract-composition.js +8 -12
  187. package/build/src/library/contract-creation.d.ts +1 -3
  188. package/build/src/library/contract-creation.js +2 -3
  189. package/build/src/library/contract-execution.d.ts +3 -5
  190. package/build/src/library/contract-execution.js +55 -96
  191. package/build/src/library/contract-outcomes.d.ts +2 -1
  192. package/build/src/library/contract-types.d.ts +5 -0
  193. package/build/src/library/contract-wait.d.ts +35 -0
  194. package/build/src/library/contract-wait.js +141 -0
  195. package/build/src/library/delivery.d.ts +13 -525
  196. package/build/src/library/delivery.js +1 -12
  197. package/build/src/library/input.js +2 -1
  198. package/build/src/library/invocation.d.ts +5 -1
  199. package/build/src/library/invocation.js +9 -2
  200. package/build/src/library/keiyaku.d.ts +7 -6
  201. package/build/src/library/keiyaku.js +12 -7
  202. package/build/src/library/outcome.d.ts +461 -12586
  203. package/build/src/library/outcome.js +15 -234
  204. package/build/src/library/reconcile.d.ts +12 -0
  205. package/build/src/library/reconcile.js +1 -0
  206. package/build/src/library/refusal.d.ts +251 -34
  207. package/build/src/library/refusal.js +10 -5
  208. package/build/src/library/selection.d.ts +9 -35
  209. package/build/src/library/selection.js +59 -129
  210. package/build/src/plugin/akuma-signals.d.ts +2 -2
  211. package/build/src/plugin/akuma-signals.js +2 -2
  212. package/build/src/plugin/public.d.ts +0 -7
  213. package/build/src/plugin/runtime.d.ts +2 -2
  214. package/build/src/plugin/runtime.js +4 -3
  215. package/build/src/protocol/attempt.js +7 -3
  216. package/build/src/protocol/bind.d.ts +18 -4
  217. package/build/src/protocol/bind.js +102 -35
  218. package/build/src/protocol/completion.d.ts +18 -331
  219. package/build/src/protocol/completion.js +17 -130
  220. package/build/src/protocol/deliver.d.ts +3 -3
  221. package/build/src/protocol/deliver.js +64 -74
  222. package/build/src/protocol/delivery-preview.d.ts +85 -28
  223. package/build/src/protocol/delivery-preview.js +34 -22
  224. package/build/src/protocol/execution-observation.d.ts +12 -9
  225. package/build/src/protocol/execution-observation.js +0 -1
  226. package/build/src/protocol/intent.d.ts +20 -50
  227. package/build/src/protocol/intent.js +37 -44
  228. package/build/src/protocol/operations.d.ts +299 -19
  229. package/build/src/protocol/operations.js +68 -27
  230. package/build/src/protocol/outcome.d.ts +1 -1
  231. package/build/src/protocol/placement.d.ts +2 -2
  232. package/build/src/protocol/placement.js +4 -3
  233. package/build/src/protocol/progress.d.ts +35 -2
  234. package/build/src/protocol/progress.js +12 -1
  235. package/build/src/protocol/read/observation.js +15 -4
  236. package/build/src/protocol/read/status.d.ts +9 -14
  237. package/build/src/protocol/read/status.js +15 -22
  238. package/build/src/protocol/reintegrate.d.ts +4 -3
  239. package/build/src/protocol/reintegrate.js +21 -5
  240. package/build/src/protocol/review.d.ts +9 -15
  241. package/build/src/protocol/review.js +2 -6
  242. package/build/src/protocol/run.d.ts +1 -1
  243. package/build/src/protocol/verify.d.ts +51 -0
  244. package/build/src/protocol/verify.js +128 -0
  245. package/build/src/runtime/proc/windows-launch.exe +0 -0
  246. package/build/src/verification/declaration.d.ts +5 -1
  247. package/build/src/verification/declaration.js +19 -2
  248. package/build/src/verification/execution.d.ts +5 -2
  249. package/build/src/verification/execution.js +48 -53
  250. package/build/src/verification/observation.d.ts +10 -6
  251. package/build/src/verification/observation.js +5 -2
  252. package/package.json +3 -3
  253. package/plugins/paseo/plugin/index.server.ts +3 -0
  254. package/plugins/paseo/plugin/server/attach.ts +42 -0
  255. package/plugins/paseo/plugin/server/mirror-identity.ts +51 -0
  256. package/plugins/paseo/plugin/server/model.ts +26 -0
  257. package/plugins/paseo/plugin/server/provider.ts +4 -6
  258. package/plugins/paseo/plugin/server/reopen.ts +4 -39
  259. package/plugins/pi/README.md +7 -12
  260. package/plugins/pi/akuma-tools.ts +3 -18
  261. package/skills/keiyaku/SKILL.md +14 -26
  262. package/skills/keiyaku-akuma/SKILL.md +64 -44
  263. package/skills/keiyaku-akuma/references/automation.md +13 -25
  264. package/skills/keiyaku-babysit/SKILL.md +1 -1
  265. package/skills/keiyaku-bind/SKILL.md +42 -29
  266. package/skills/keiyaku-debt/SKILL.md +13 -8
  267. package/skills/keiyaku-workflow/SKILL.md +57 -61
  268. package/build/src/akuma/allowed.d.ts +0 -23
  269. package/build/src/akuma/allowed.js +0 -63
  270. package/build/src/akuma/call-request.d.ts +0 -308
  271. package/build/src/akuma/call-request.js +0 -175
  272. package/build/src/akuma/heart/request-authority.d.ts +0 -16
  273. package/build/src/akuma/heart/request-authority.js +0 -140
  274. package/build/src/akuma/heart/request-rows.d.ts +0 -18
  275. package/build/src/akuma/heart/request-rows.js +0 -107
  276. package/build/src/akuma/request-lifecycle.d.ts +0 -42
  277. package/build/src/akuma/request-lifecycle.js +0 -197
  278. package/build/src/akuma/request-observation.d.ts +0 -45
  279. package/build/src/akuma/request-observation.js +0 -162
  280. package/build/src/akuma/request-rendezvous.d.ts +0 -32
  281. package/build/src/akuma/request-rendezvous.js +0 -189
  282. package/build/src/akuma/request-serve.d.ts +0 -16
  283. package/build/src/akuma/request-serve.js +0 -188
  284. package/build/src/akuma/request-wire.d.ts +0 -143
  285. package/build/src/akuma/request-wire.js +0 -146
  286. package/build/src/akuma/requests.d.ts +0 -20
  287. package/build/src/akuma/requests.js +0 -72
  288. package/build/src/akuma/selection-owner-port.d.ts +0 -14
  289. package/build/src/akuma/selection-owner-port.js +0 -54
  290. package/build/src/akuma/selection-request.d.ts +0 -305
  291. package/build/src/akuma/selection-request.js +0 -307
  292. package/build/src/body-requests.d.ts +0 -13
  293. package/build/src/body-requests.js +0 -131
  294. package/build/src/cli/square-identity.d.ts +0 -10
  295. package/build/src/cli/square-identity.js +0 -130
  296. package/build/src/debt/mutation-result.d.ts +0 -981
  297. package/build/src/debt/mutation-result.js +0 -109
  298. package/build/src/debt/mutation.d.ts +0 -424
  299. package/build/src/debt/mutation.js +0 -223
  300. package/build/src/library/contract-operations.d.ts +0 -382
  301. package/build/src/library/contract-operations.js +0 -300
@@ -1,59 +1 @@
1
- import { z } from "zod";
2
- import { EMPTY_CREATED_DEBT_OBSERVATION, createdDebtObservationSchema } from "../debt/created-observation.js";
3
- import { akumaStatusSchema } from "./akuma.js";
4
- import { tellResultSchema } from "./call-initial-tell.js";
5
- import { NO_DISPATCH_ASSOCIATION, dispatchAssociationSchema } from "./dispatch-association.js";
6
- import { akumaIdSchema } from "./identity.js";
7
- const killEvidenceSchema = z.enum([
8
- "killed",
9
- "already-killed",
10
- "already-stopped",
11
- "hung",
12
- "untidy",
13
- "unavailable",
14
- ]);
15
- const akumaObservationSchema = z
16
- .object({
17
- status: akumaStatusSchema,
18
- contract: dispatchAssociationSchema,
19
- createdDebts: createdDebtObservationSchema,
20
- })
21
- .strict();
22
- const akumaUnobservedSchema = z.object({ id: akumaIdSchema, diagnostic: z.string() }).strict();
23
- const akumaKillResultItemSchema = z.object({ id: akumaIdSchema, evidence: killEvidenceSchema }).strict();
24
- const akumaWaitResultSchema = z
25
- .object({
26
- mode: z.enum(["any", "all"]),
27
- reason: z.enum(["completed", "deadline"]),
28
- observations: z.array(akumaObservationSchema).readonly(),
29
- unobserved: z.array(akumaUnobservedSchema).readonly(),
30
- })
31
- .strict();
32
- const akumaKillResultSchema = z.object({ results: z.array(akumaKillResultItemSchema).readonly() }).strict();
33
- const akumaTellResultSchema = z.object({ akuma: akumaIdSchema, tell: tellResultSchema }).strict();
34
- const askObservationSchema = z.union([
35
- z.object({ reason: z.literal("answered"), answer: z.unknown() }).strict(),
36
- z.object({ reason: z.literal("failed"), diagnostic: z.string() }).strict(),
37
- z.object({ reason: z.literal("invalid-output"), diagnostic: z.string(), answer: z.string() }).strict(),
38
- z.object({ reason: z.literal("unanswered") }).strict(),
39
- z.object({ reason: z.literal("deadline") }).strict(),
40
- ]);
41
- const akumaAskResultSchema = z
42
- .object({
43
- akuma: akumaIdSchema,
44
- tell: tellResultSchema,
45
- observation: askObservationSchema,
46
- completedAt: z.string().datetime({ offset: true }).nullable().optional(),
47
- })
48
- .strict();
49
- /** Compose one native status into the canonical observation its crossing transports. */
50
- export function akumaObservationOf(status) {
51
- return { status, contract: NO_DISPATCH_ASSOCIATION, createdDebts: EMPTY_CREATED_DEBT_OBSERVATION };
52
- }
53
- export const selectionResultSchemas = {
54
- wait: akumaWaitResultSchema,
55
- tell: akumaTellResultSchema,
56
- ask: akumaAskResultSchema,
57
- kill: akumaKillResultSchema,
58
- killEvidence: killEvidenceSchema,
59
- };
1
+ export {};
@@ -1,13 +1,8 @@
1
1
  import { type ResumeCoordinate, type Soul, type TellFact } from "./heart/index.js";
2
2
  import type { AkumaPaths } from "./identity.js";
3
3
  import { type ExecutionAssociationReader } from "./execution-instructions.js";
4
- import type { CallInitialTellAdmission } from "./call-initial-tell.js";
5
- import type { InitialTellAdmissionRequest } from "./call-request.js";
6
4
  import { type ProviderAdapter, type TurnResult } from "./provider.js";
7
- import { type AkumaCallRequestChildLaunch } from "./call-request.js";
8
- import { type ErasedRequestCommand } from "./request-wire.js";
9
5
  import { BodySupervisor } from "./body-supervisor.js";
10
- import type { LiveBodyLaunch } from "./body-launch.js";
11
6
  export declare function turnRecipe(paths: AkumaPaths, soul: Soul): Promise<Readonly<{
12
7
  cwd: string;
13
8
  options: Soul["options"];
@@ -31,10 +26,7 @@ export type DriveTurnInput = Readonly<{
31
26
  initiator?: string;
32
27
  schemaJson?: string;
33
28
  supervisor: BodySupervisor;
34
- runtimeSpawn(launch: AkumaCallRequestChildLaunch): Promise<LiveBodyLaunch | void>;
35
- admitInitialTell(input: InitialTellAdmissionRequest): Promise<CallInitialTellAdmission>;
36
29
  world: import("../world.js").WorldRoot;
37
- externalCommands: Readonly<Record<string, ErasedRequestCommand>>;
38
30
  executionAssociation?: ExecutionAssociationReader;
39
31
  turnStarted: Readonly<{
40
32
  emit(turnSequence: number): Promise<void>;
@@ -4,9 +4,6 @@ import { appendActivity, beginTurn, bindTellsToTurn, BodyControlledError, breakB
4
4
  import { keiyakuExecutionInstructions } from "./execution-instructions.js";
5
5
  import { withoutModel } from "./provider-recipe.js";
6
6
  import { encodeAgentEvent, } from "./provider.js";
7
- import { akumaCallRequestCommands } from "./call-request.js";
8
- import { BodyRequestPump } from "./request-serve.js";
9
- import { composeRequestCommands } from "./request-wire.js";
10
7
  import { CONTROL_RESPONSE_MS } from "./body-supervisor.js";
11
8
  function serializeEffects() {
12
9
  let tail = Promise.resolve();
@@ -46,21 +43,6 @@ export async function turnRecipe(paths, soul) {
46
43
  ...(session === undefined ? {} : { session }),
47
44
  };
48
45
  }
49
- async function failedTurnSetup(input, turnSequence, requests, cancelDrive, error) {
50
- try {
51
- await requests.close();
52
- }
53
- catch {
54
- /* Preserve the setup or pump failure. */
55
- }
56
- input.supervisor.signal.removeEventListener("abort", cancelDrive);
57
- if (input.supervisor.signal.aborted) {
58
- if (input.supervisor.reason === "heart-gone")
59
- throw error;
60
- return { kind: "stopped" };
61
- }
62
- return { kind: "failed", turnSequence, diagnostic: error instanceof Error ? error.message : String(error) };
63
- }
64
46
  async function writeProviderEvent(input, active, event, witness) {
65
47
  if (input.supervisor.signal.aborted)
66
48
  return;
@@ -100,7 +82,6 @@ function startProviderAttempt(input, setup) {
100
82
  bodySequence: input.bodySequence,
101
83
  turnSequence: setup.turnSequence,
102
84
  },
103
- requests: { dir: setup.requests.directory, entry: setup.requests.entry },
104
85
  ...(setup.runtimeInstructions === undefined ? {} : { runtimeInstructions: setup.runtimeInstructions }),
105
86
  ...(setup.schemaJson === undefined ? {} : { schemaJson: setup.schemaJson }),
106
87
  };
@@ -136,59 +117,30 @@ async function startTurnDrive(input) {
136
117
  await input.turnStarted.emit(turn.sequence);
137
118
  if (input.supervisor.signal.aborted)
138
119
  return { kind: "stopped" };
139
- const { world, paths, soul: parent, runtimeSpawn: spawn, externalCommands, admitInitialTell } = input;
140
- const commands = composeRequestCommands(akumaCallRequestCommands({ world, paths, parent, spawn, admitInitialTell }), externalCommands);
141
- const requests = await BodyRequestPump.open({
142
- paths: input.paths,
143
- allowed: input.soul.allowed,
144
- bodySequence: input.bodySequence,
145
- now: input.now,
146
- commands,
147
- signal: input.supervisor.signal,
148
- });
149
- return await establishTurnDrive(input, turn.sequence, requests, {
120
+ return await establishTurnDrive(input, turn.sequence, {
150
121
  ...recipe,
151
122
  boundTells,
152
123
  ...(schemaJson === undefined ? {} : { schemaJson }),
153
124
  ...(runtimeInstructions === undefined ? {} : { runtimeInstructions }),
154
125
  });
155
126
  }
156
- async function establishTurnDrive(input, turnSequence, requests, recipe) {
127
+ async function establishTurnDrive(input, turnSequence, recipe) {
157
128
  const { cwd, options, session, boundTells, schemaJson, runtimeInstructions } = recipe;
158
- const driveController = new AbortController();
159
- const cancelDrive = () => {
160
- if (!driveController.signal.aborted)
161
- driveController.abort(input.supervisor.signal.reason);
162
- };
163
- input.supervisor.signal.addEventListener("abort", cancelDrive, { once: true });
164
- if (input.supervisor.signal.aborted)
165
- cancelDrive();
166
- void requests.failure.catch((error) => {
167
- if (!driveController.signal.aborted)
168
- driveController.abort(error);
169
- });
170
129
  const attempt = startProviderAttempt(input, {
171
130
  recipe,
172
131
  tells: boundTells,
173
- requests,
174
- signal: driveController.signal,
132
+ signal: input.supervisor.signal,
175
133
  turnSequence,
176
134
  schemaJson,
177
135
  runtimeInstructions,
178
136
  });
179
137
  const custodyFailure = observeFailure(attempt.closed);
180
138
  try {
181
- const selected = await abortable(Promise.race([attempt.result, requests.failure, custodyFailure]), input.supervisor.signal);
139
+ const selected = await abortable(Promise.race([attempt.result, custodyFailure]), input.supervisor.signal);
182
140
  if (input.supervisor.signal.aborted) {
183
- try {
184
- const retirement = await retireProviderCustody(input, turnSequence, attempt);
185
- await requests.close();
186
- if (retirement.kind === "hung")
187
- return retirement;
188
- }
189
- finally {
190
- input.supervisor.signal.removeEventListener("abort", cancelDrive);
191
- }
141
+ const retirement = await retireProviderCustody(input, turnSequence, attempt);
142
+ if (retirement.kind === "hung")
143
+ return retirement;
192
144
  return { kind: "stopped" };
193
145
  }
194
146
  if (boundTells.length > 0)
@@ -199,30 +151,25 @@ async function establishTurnDrive(input, turnSequence, requests, recipe) {
199
151
  fence: selected.admission.fence,
200
152
  deliveredAt: input.now(),
201
153
  })));
202
- void selected.completion.then(() => requests.stopAdmission(), () => undefined);
203
154
  return {
204
155
  turnSequence,
205
156
  attempt,
206
157
  drive: selected,
207
- requests,
208
158
  cwd,
209
159
  options,
210
- releaseDriveSignal: () => input.supervisor.signal.removeEventListener("abort", cancelDrive),
211
160
  ...(session === undefined ? {} : { resume: session }),
212
161
  };
213
162
  }
214
163
  catch (error) {
215
164
  const retirement = await retireProviderCustody(input, turnSequence, attempt);
216
- if (retirement.kind === "hung") {
217
- try {
218
- await requests.close();
219
- }
220
- finally {
221
- input.supervisor.signal.removeEventListener("abort", cancelDrive);
222
- }
165
+ if (retirement.kind === "hung")
223
166
  return retirement;
167
+ if (input.supervisor.signal.aborted) {
168
+ if (input.supervisor.reason === "heart-gone")
169
+ throw error;
170
+ return { kind: "stopped" };
224
171
  }
225
- return await failedTurnSetup(input, turnSequence, requests, cancelDrive, error);
172
+ return { kind: "failed", turnSequence, diagnostic: error instanceof Error ? error.message : String(error) };
226
173
  }
227
174
  }
228
175
  async function retireProviderCustody(input, turnSequence, attempt) {
@@ -314,28 +261,9 @@ async function submitPendingLiveTells(writers, pending, attempted, tellLive) {
314
261
  }
315
262
  return "live";
316
263
  }
317
- async function stopActiveDrive(input, active) {
318
- try {
319
- const retirement = await retireProviderCustody(input, active.turnSequence, active.attempt);
320
- await active.requests.close();
321
- return retirement;
322
- }
323
- finally {
324
- active.releaseDriveSignal();
325
- }
326
- }
327
264
  function hasUnattemptedTell(liveTells, tellPump, pending, attempted) {
328
265
  return (liveTells && tellPump === null && pending.some((tell) => !attempted.has(tell.id) && tell.schemaJson === undefined));
329
266
  }
330
- async function settleCompletion(result, session, active) {
331
- try {
332
- await active.requests.close();
333
- return result.kind === "answered" ? { ...result, ...(session === undefined ? {} : { session }) } : result;
334
- }
335
- finally {
336
- active.releaseDriveSignal();
337
- }
338
- }
339
267
  /**
340
268
  * One bounded wake slot per live Turn source.
341
269
  *
@@ -400,7 +328,7 @@ function createTurnWakeups(observeHeart) {
400
328
  };
401
329
  }
402
330
  async function consumeTurnDrive(input, active) {
403
- const { turnSequence, drive, requests, resume } = active;
331
+ const { turnSequence, drive, resume } = active;
404
332
  let heart = input.supervisor.current();
405
333
  let turnSession = resume;
406
334
  const attempted = new Set(drainPendingTells(input.launchTells).map((tell) => tell.id));
@@ -463,7 +391,7 @@ async function consumeTurnDrive(input, active) {
463
391
  const ready = () => eventsEnded && result !== undefined && attemptClosed && tellPump === null;
464
392
  /** Retirement decides the ending: only a provider that could not retire replaces the requested one. */
465
393
  const stopAndReturn = async (outcome) => {
466
- const retirement = await stopActiveDrive(input, active);
394
+ const retirement = await retireProviderCustody(input, turnSequence, active.attempt);
467
395
  if (retirement.kind === "hung")
468
396
  return retirement;
469
397
  return input.supervisor.signal.aborted ? { kind: "stopped" } : outcome;
@@ -471,7 +399,6 @@ async function consumeTurnDrive(input, active) {
471
399
  wakeups.event(iterator.next());
472
400
  wakeups.heart(heart);
473
401
  wakeups.failure(receiptFailure);
474
- wakeups.failure(requests.failure);
475
402
  wakeups.completion(drive.completion);
476
403
  wakeups.closure(active.attempt.closed);
477
404
  try {
@@ -496,7 +423,9 @@ async function consumeTurnDrive(input, active) {
496
423
  }
497
424
  if (ready() && effectsDrained) {
498
425
  writesOpen = false;
499
- return await settleCompletion(result, turnSession, active);
426
+ return result.kind === "answered"
427
+ ? { ...result, ...(turnSession === undefined ? {} : { session: turnSession }) }
428
+ : result;
500
429
  }
501
430
  }
502
431
  }
@@ -507,13 +436,6 @@ async function consumeTurnDrive(input, active) {
507
436
  if (input.supervisor.signal.aborted)
508
437
  return await stopAndReturn({ kind: "stopped" });
509
438
  const retirement = await retireProviderCustody(input, turnSequence, active.attempt);
510
- try {
511
- await requests.close();
512
- }
513
- catch {
514
- /* Preserve the first pump failure. */
515
- }
516
- active.releaseDriveSignal();
517
439
  if (retirement.kind === "hung")
518
440
  return retirement;
519
441
  return { kind: "failed", diagnostic: error instanceof Error ? error.message : String(error) };
@@ -545,12 +467,6 @@ export async function driveTurn(input) {
545
467
  }
546
468
  catch (error) {
547
469
  if (await heartExists(input.paths)) {
548
- try {
549
- await active.requests.close();
550
- }
551
- finally {
552
- active.releaseDriveSignal();
553
- }
554
470
  return {
555
471
  kind: "failed",
556
472
  diagnostic: error instanceof Error ? error.message : String(error),
@@ -558,7 +474,7 @@ export async function driveTurn(input) {
558
474
  };
559
475
  }
560
476
  input.supervisor.cancel("heart-gone");
561
- const retirement = await stopActiveDrive(input, active);
477
+ const retirement = await retireProviderCustody(input, active.turnSequence, active.attempt);
562
478
  return retirement.kind === "hung" ? retirement : { kind: "stopped" };
563
479
  }
564
480
  }
@@ -3,20 +3,17 @@ import { fileURLToPath } from "node:url";
3
3
  import { driveAkumaBody } from "./akuma/body.js";
4
4
  import { bodyLaunchSchema } from "./akuma/body-launch.js";
5
5
  import { LEASH_HELD_EXIT, spawnAkumaBody } from "./akuma/detached-body.js";
6
- import { externalRequestCommandsFor, bodyProcessConfiguration } from "./body-requests.js";
6
+ import { bodyExecutionContext } from "./body-host.js";
7
7
  async function runBodyEntrypoint() {
8
8
  const encoded = process.argv[2];
9
9
  if (encoded === undefined)
10
10
  throw new TypeError("Akuma body launch payload is missing");
11
11
  const launch = bodyLaunchSchema.parse(JSON.parse(Buffer.from(encoded, "base64url").toString("utf8")));
12
12
  const spawn = spawnAkumaBody;
13
- const { world, commands, executionAssociation } = await externalRequestCommandsFor(launch, bodyProcessConfiguration(), spawn);
13
+ const context = await bodyExecutionContext(launch);
14
14
  if ((await driveAkumaBody(launch, undefined, {
15
- world,
16
- externalCommands: commands,
17
- executionAssociation,
15
+ ...context,
18
16
  spawn,
19
- requestSpawn: spawn,
20
17
  })) === "held")
21
18
  process.exitCode = LEASH_HELD_EXIT;
22
19
  }
@@ -1,4 +1,10 @@
1
- import type { BodyLauncher } from "./akuma/body-launch.js";
1
+ import type { BodyLaunch, BodyLauncher } from "./akuma/body-launch.js";
2
+ import type { ExecutionAssociationReader } from "./akuma/execution-instructions.js";
3
+ import { World } from "./world.js";
4
+ export declare function bodyExecutionContext(launch: BodyLaunch): Promise<Readonly<{
5
+ world: Awaited<ReturnType<typeof World.prove>>;
6
+ executionAssociation: ExecutionAssociationReader;
7
+ }>>;
2
8
  export type AkumaHostOptions = Readonly<{
3
9
  /** Detached by default. In-process Bodies share this Node runtime's lifetime. */
4
10
  hosting?: "detached" | "in-process";
@@ -20,7 +26,7 @@ export declare const AkumaHost: Readonly<{
20
26
  /** Create an in-process launch scope. Pass the scope itself as the public host option. */
21
27
  inProcess(options?: Pick<AkumaHostOptions, "reportDiagnostic">): AkumaHostScope;
22
28
  }>;
23
- /** Capture host capabilities once, independently of observation and request routing. */
29
+ /** Capture the invoking composition's host capabilities. */
24
30
  export declare function captureAkumaHost(host?: AkumaHostOptions): Readonly<{
25
31
  spawn: BodyLauncher;
26
32
  reportDiagnostic?: (message: string) => void;
@@ -1,14 +1,40 @@
1
1
  import { setMaxListeners } from "node:events";
2
2
  import { spawnAkumaBody } from "./akuma/detached-body.js";
3
3
  import { launchInProcessBody } from "./akuma/in-process-body.js";
4
- import { bodyProcessConfiguration, externalRequestCommandsFor } from "./body-requests.js";
4
+ import { worldRootForAkumaPaths } from "./akuma/identity.js";
5
+ import { readSoul } from "./akuma/heart/index.js";
6
+ import { readDispatch } from "./dispatch/index.js";
7
+ import { NoGitWorldError, repositoryAt } from "./git/repository.js";
8
+ import { World } from "./world.js";
9
+ export async function bodyExecutionContext(launch) {
10
+ const world = await World.prove(worldRootForAkumaPaths(launch.paths));
11
+ const akuma = launch.seed?.id ?? (await readSoul(launch.paths))?.id;
12
+ return {
13
+ world,
14
+ executionAssociation: async () => {
15
+ if (akuma !== undefined) {
16
+ try {
17
+ const dispatch = await readDispatch(await repositoryAt(world), akuma);
18
+ if (dispatch !== null)
19
+ return { contractId: dispatch.contractId };
20
+ }
21
+ catch (error) {
22
+ if (!(error instanceof NoGitWorldError)) {
23
+ console.error(`Keiyaku execution association unavailable for ${akuma}: ${error instanceof Error ? error.message : String(error)}`);
24
+ }
25
+ }
26
+ }
27
+ const contractId = launch.completion?.contractId;
28
+ return contractId === undefined ? undefined : { contractId };
29
+ },
30
+ };
31
+ }
5
32
  function inProcessLauncher(scopeSignal, enroll) {
6
33
  const spawn = (launch) => {
7
34
  scopeSignal?.throwIfAborted();
8
35
  const pending = launchInProcessBody(launch, async (signal) => {
9
36
  signal.throwIfAborted();
10
- const { world, commands, executionAssociation } = await externalRequestCommandsFor(launch, bodyProcessConfiguration(), spawnAkumaBody);
11
- return { world, externalCommands: commands, executionAssociation, spawn, requestSpawn: spawnAkumaBody };
37
+ return { ...(await bodyExecutionContext(launch)), spawn };
12
38
  }, undefined, scopeSignal);
13
39
  // Every launch, including automatic succession, enrols before yielding.
14
40
  enroll?.(pending);
@@ -62,7 +88,7 @@ export const AkumaHost = Object.freeze({
62
88
  return new ScopedAkumaHost(options);
63
89
  },
64
90
  });
65
- /** Capture host capabilities once, independently of observation and request routing. */
91
+ /** Capture the invoking composition's host capabilities. */
66
92
  export function captureAkumaHost(host) {
67
93
  if (host !== undefined && (typeof host !== "object" || host === null || Array.isArray(host)))
68
94
  throw new TypeError("Akuma host options must be an object");
@@ -1,6 +1,5 @@
1
1
  import { type CliUsageGuide } from "../usage.js";
2
2
  import { type AkumaAlias } from "../../identity/selector.js";
3
- import { type AllowedActions } from "../../akuma/allowed.js";
4
3
  type Output = Readonly<{
5
4
  output: "text" | "json";
6
5
  }>;
@@ -23,7 +22,6 @@ export type ParsedAkumaCommand = Output & ((Readonly<{
23
22
  alias?: AkumaAlias;
24
23
  mode: "wait" | "detach";
25
24
  timeoutMs?: number;
26
- allowed?: AllowedActions;
27
25
  writableDirectories?: readonly string[];
28
26
  bare?: boolean;
29
27
  schema?: string;
@@ -2,9 +2,7 @@ import { CliUsageError, commandGuide, usageLine } from "../usage.js";
2
2
  import { scanArgs } from "../scan.js";
3
3
  import { parseDuration as decodeDuration } from "../../duration.js";
4
4
  import { parseAkumaAlias, parseAkumaGlob } from "../../identity/selector.js";
5
- import { ALLOWED_ACTIONS, DEFAULT_ALLOWED_ACTIONS, decodeAllowedActions, } from "../../akuma/allowed.js";
6
5
  import { parsePublicHistoryId } from "../../akuma/identity.js";
7
- const EXTRA_ALLOWED_ACTIONS = ALLOWED_ACTIONS.filter((action) => !DEFAULT_ALLOWED_ACTIONS.includes(action));
8
6
  const SET_SELECTORS = '(<aku/...> | @alias | <kei/...> | "aku/<name-pattern>/<hex-pattern>")...';
9
7
  const SET_DETAILS = "Globs contain * and use lowercase hex digits or * in the suffix. --repo requires at least one Contract (kei/...) selector.";
10
8
  const SCHEMA_DETAILS = "--schema supplies a JSON Schema answer contract to the provider; on observation the CLI parses JSON but does not independently validate schema conformance.";
@@ -14,8 +12,8 @@ const AKUMA_COMMAND_SPECS = {
14
12
  stdin: true,
15
13
  flags: { json: "boolean" },
16
14
  usage: "report (<text> | -) [--json]",
17
- purpose: "Record progress in the invoking Akuma's Heart without ending work.",
18
- details: "Give one nonblank text argument, or - to read stdin. Requires explicit Akuma, World, Body and Turn execution declarations; no recipient or parent forwarding. Recorded means persisted, not received.",
15
+ purpose: "Report progress to your caller and keep working.",
16
+ details: "Give <text> as one argument, or - to read stdin. Works only from inside a running Akuma. It does not end your turn or replace your final answer.",
19
17
  },
20
18
  call: {
21
19
  arity: 1,
@@ -24,13 +22,12 @@ const AKUMA_COMMAND_SPECS = {
24
22
  contract: "value",
25
23
  alias: "value",
26
24
  wait: "value",
27
- allowed: "repeat",
28
25
  "add-dir": "repeat",
29
26
  bare: "boolean",
30
27
  json: "boolean",
31
28
  schema: "value",
32
29
  },
33
- usage: "call <akuma-name> [--contract <kei/...>] [--repo <path>] [--workdir <path>] [--alias <name>] [--allowed <product.action>]... [--add-dir <path>]... [--bare] [--schema <file>] [--wait <duration>] [<prompt> | -]",
30
+ usage: "call <akuma-name> [--contract <kei/...>] [--repo <path>] [--workdir <path>] [--alias <name>] [--add-dir <path>]... [--bare] [--schema <file>] [--wait <duration>] [<prompt> | -]",
34
31
  purpose: "Call an Akuma into the world.",
35
32
  details: [
36
33
  "Use keiyaku ls aku/ to find visible Akuma names; hidden definitions can still be called by name.",
@@ -41,15 +38,8 @@ const AKUMA_COMMAND_SPECS = {
41
38
  "By default, call returns after birth and optional first Tell admission; --wait also waits for its first answer, up to the given duration.",
42
39
  "--contract records an association, not the work or execution directory; include the Contract and worktree context in the prompt as needed. --repo requires --contract.",
43
40
  "--workdir selects where the Akuma works; relative paths resolve from the invocation directory selected by -C/--cwd, or the process cwd when omitted. Without --workdir, the invocation directory is used.",
44
- "--add-dir explicitly grants another existing writable directory to Codex native workspace-write tools; repeat for multiple roots. Relative paths resolve from the invocation directory. Other sandbox modes, permission profiles, and providers refuse nonempty grants instead of broadening policy. Existing network policy and writable roots are preserved. This is separate from --allowed product actions and never grants the repo or Home automatically.",
41
+ "--add-dir explicitly grants another existing writable directory to Codex native workspace-write tools; repeat for multiple roots. Relative paths resolve from the invocation directory. Other sandbox modes, permission profiles, and providers refuse nonempty grants instead of broadening policy. Existing network policy and writable roots are preserved; the repo and Home are never granted automatically.",
45
42
  "--alias <name> gives the new Akuma the selector @name instead of aku/<id>; an existing @name is reassigned to this Akuma.",
46
- `Default actions: ${DEFAULT_ALLOWED_ACTIONS.join(", ")}.`,
47
- ...(EXTRA_ALLOWED_ACTIONS.length === 0
48
- ? []
49
- : [`Also available with --allowed: ${EXTRA_ALLOWED_ACTIONS.join(", ")}.`]),
50
- "Repeated --allowed adds actions to the selected Akuma's allowed actions; it cannot remove inherited permissions.",
51
- "If no actions are configured, defaults apply; an explicitly empty list allows none.",
52
- "An Akuma started by another Akuma can use only actions its parent can use. Use keiyaku status <aku/...|@alias> --json to inspect status.allowed.",
53
43
  SCHEMA_DETAILS,
54
44
  "With --wait, completed activity streams on stderr and the final answer is written to stdout once.",
55
45
  ].join("\n"),
@@ -59,14 +49,13 @@ const AKUMA_COMMAND_SPECS = {
59
49
  stdin: false,
60
50
  flags: { any: "boolean", all: "boolean", timeout: "value", json: "boolean" },
61
51
  usage: `wait ${SET_SELECTORS} [--any | --all] [--timeout <duration>] [--repo <path>]`,
62
- purpose: "Wait for one or more Akumas to finish work.",
52
+ purpose: "Wait for Contract changes or terminal state, or Akumas to finish work.",
63
53
  details: [
64
- "The default mode is any; --all waits until every selected Akuma completes.",
54
+ "Select Contracts or Akumas, never both in one wait. Contract IDs wait for their next journal change or terminal state, not associated Akumas.",
55
+ "The default mode is any; --all waits for every selected member. Each Contract starts from its current journal head; already accepted or abandoned Contracts complete immediately.",
65
56
  SET_DETAILS,
66
- "An already completed member counts immediately, so repeating a selection can return at once.",
67
- "Text prints each selected Akuma's status snapshot, then one failure fact for any Akuma it could not read.",
68
- "An answer is part of that snapshot; wait writes no separate copy of it to stdout.",
69
- "With --json stdout carries the result document.",
57
+ "An already completed Akuma counts immediately; a deadline only bounds observation.",
58
+ "With --json stdout carries the native result document.",
70
59
  ].join("\n"),
71
60
  },
72
61
  tell: {
@@ -77,7 +66,7 @@ const AKUMA_COMMAND_SPECS = {
77
66
  purpose: "Tell an Akuma something without waiting for its answer.",
78
67
  details: [
79
68
  "Give <prompt> as one argument, or use - to read stdin.",
80
- "--interrupt durably admits the new Tell while asking the current Body to yield; admission remains even if completion cannot be proven.",
69
+ "--interrupt admits the Tell and asks current work to yield; the Tell remains admitted even if yielding cannot be confirmed.",
81
70
  "Use ask to block for the answer or supply a schema.",
82
71
  ].join("\n"),
83
72
  },
@@ -89,7 +78,7 @@ const AKUMA_COMMAND_SPECS = {
89
78
  purpose: "Ask an Akuma and block until it answers.",
90
79
  details: [
91
80
  "Give <prompt> as one argument, or use - to read stdin.",
92
- "--interrupt durably admits the new Tell while asking the current Body to yield; admission remains even if completion cannot be proven.",
81
+ "--interrupt admits the Tell and asks current work to yield; the Tell remains admitted even if yielding cannot be confirmed.",
93
82
  SCHEMA_DETAILS,
94
83
  "--wait bounds how long to block for the answer; the Tell stays admitted past the deadline.",
95
84
  "Completed activity streams on stderr and the final answer is written to stdout once.",
@@ -213,6 +202,9 @@ function validateSet(value, fail) {
213
202
  function parseWait(rawSelectors, flags, output, fail) {
214
203
  if (flags.any === true && flags.all === true)
215
204
  fail("wait --any and --all are mutually exclusive");
205
+ const contracts = rawSelectors.filter((selector) => selector.startsWith("kei/"));
206
+ if (contracts.length > 0 && contracts.length !== rawSelectors.length)
207
+ fail("wait cannot mix Contract and Akuma selectors");
216
208
  const completion = flags.any === true ? "any" : flags.all === true ? "all" : undefined;
217
209
  return {
218
210
  command: "wait",
@@ -316,19 +308,6 @@ function parseAsk(flags, subject, prompt, output, fail) {
316
308
  output,
317
309
  };
318
310
  }
319
- function parseAllowedFlag(raw, fail) {
320
- if (raw === undefined)
321
- return undefined;
322
- if (!Array.isArray(raw))
323
- fail("--allowed requires a value");
324
- const selected = raw;
325
- try {
326
- return decodeAllowedActions(selected, "--allowed");
327
- }
328
- catch (error) {
329
- fail(error instanceof Error ? error.message : "invalid --allowed action");
330
- }
331
- }
332
311
  function parseCall(flags, archetype, prompt, output, fail) {
333
312
  let alias;
334
313
  if (flags.alias !== undefined) {
@@ -342,7 +321,6 @@ function parseCall(flags, archetype, prompt, output, fail) {
342
321
  }
343
322
  const mode = flags.wait === undefined ? "detach" : "wait";
344
323
  const timeoutMs = flags.wait === undefined ? undefined : parseDuration(flags.wait, "--wait", fail);
345
- const allowed = parseAllowedFlag(flags.allowed, fail);
346
324
  const schema = flags.schema === undefined ? undefined : stringFlag(flags.schema, "call --schema requires a file", fail);
347
325
  if (prompt === undefined && schema !== undefined)
348
326
  fail("call --schema requires a prompt");
@@ -355,7 +333,6 @@ function parseCall(flags, archetype, prompt, output, fail) {
355
333
  ...(alias === undefined ? {} : { alias }),
356
334
  mode,
357
335
  ...(timeoutMs === undefined ? {} : { timeoutMs }),
358
- ...(allowed === undefined ? {} : { allowed }),
359
336
  ...(flags["add-dir"] === undefined ? {} : { writableDirectories: flags["add-dir"] }),
360
337
  ...(flags.bare === true ? { bare: true } : {}),
361
338
  ...(schema === undefined ? {} : { schema }),