@astrosheep/keiyaku 4.6.27 → 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 (285) hide show
  1. package/README.md +76 -35
  2. package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
  3. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +39 -4
  4. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +4 -7
  5. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
  6. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +39 -15
  7. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +42 -22
  8. package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
  9. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +39 -4
  10. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +4 -7
  11. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
  12. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +39 -15
  13. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +42 -22
  14. package/build/plugins/opencode/package.json +1 -1
  15. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +39 -4
  16. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +4 -7
  17. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
  18. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +39 -15
  19. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +42 -22
  20. package/build/plugins/pi/README.md +7 -12
  21. package/build/plugins/pi/akuma-tools.ts +3 -18
  22. package/build/skills/keiyaku-akuma/SKILL.md +39 -4
  23. package/build/skills/keiyaku-akuma/references/automation.md +4 -7
  24. package/build/skills/keiyaku-babysit/SKILL.md +1 -1
  25. package/build/skills/keiyaku-bind/SKILL.md +39 -15
  26. package/build/skills/keiyaku-workflow/SKILL.md +42 -22
  27. package/build/src/akuma/akuma-call.d.ts +15 -18
  28. package/build/src/akuma/akuma-call.js +55 -112
  29. package/build/src/akuma/akuma-errors.d.ts +0 -5
  30. package/build/src/akuma/akuma-errors.js +0 -9
  31. package/build/src/akuma/akuma-instance.d.ts +0 -2
  32. package/build/src/akuma/akuma-instance.js +18 -14
  33. package/build/src/akuma/akuma-observe.js +0 -1
  34. package/build/src/akuma/akuma-owner.js +0 -1
  35. package/build/src/akuma/akuma.d.ts +10 -26
  36. package/build/src/akuma/akuma.js +0 -2
  37. package/build/src/akuma/archetype.d.ts +0 -2
  38. package/build/src/akuma/archetype.js +3 -9
  39. package/build/src/akuma/body-launch.d.ts +12 -4
  40. package/build/src/akuma/body.d.ts +2 -5
  41. package/build/src/akuma/body.js +5 -49
  42. package/build/src/akuma/call-initial-tell.d.ts +39 -147
  43. package/build/src/akuma/call-initial-tell.js +0 -48
  44. package/build/src/akuma/caller.d.ts +0 -4
  45. package/build/src/akuma/custody.js +1 -57
  46. package/build/src/akuma/heart/facts.d.ts +0 -39
  47. package/build/src/akuma/heart/facts.js +0 -1
  48. package/build/src/akuma/heart/index.d.ts +1 -2
  49. package/build/src/akuma/heart/index.js +0 -1
  50. package/build/src/akuma/heart/schema.js +0 -26
  51. package/build/src/akuma/heart/soul.d.ts +2 -2
  52. package/build/src/akuma/heart/soul.js +2 -4
  53. package/build/src/akuma/identity.d.ts +0 -1
  54. package/build/src/akuma/identity.js +0 -2
  55. package/build/src/akuma/in-process-body.d.ts +1 -1
  56. package/build/src/akuma/index.d.ts +0 -2
  57. package/build/src/akuma/index.js +0 -1
  58. package/build/src/akuma/projection.d.ts +23 -23
  59. package/build/src/akuma/provider.d.ts +0 -5
  60. package/build/src/akuma/provider.js +0 -1
  61. package/build/src/akuma/providers/acp/core.js +1 -1
  62. package/build/src/akuma/providers/claude/index.js +1 -2
  63. package/build/src/akuma/providers/codex-app-server/index.js +1 -1
  64. package/build/src/akuma/providers/execution-environment.d.ts +1 -3
  65. package/build/src/akuma/providers/execution-environment.js +1 -7
  66. package/build/src/akuma/providers/opencode-sdk/index.js +0 -1
  67. package/build/src/akuma/providers/opencode-sdk/session.d.ts +0 -1
  68. package/build/src/akuma/providers/opencode-sdk/session.js +4 -4
  69. package/build/src/akuma/providers/paseo/index.js +2 -9
  70. package/build/src/akuma/providers/pi/index.js +8 -14
  71. package/build/src/akuma/publication.d.ts +24 -59
  72. package/build/src/akuma/publication.js +29 -64
  73. package/build/src/akuma/selection-observation.d.ts +47 -2036
  74. package/build/src/akuma/selection-observation.js +1 -59
  75. package/build/src/akuma/turn-drive.d.ts +0 -8
  76. package/build/src/akuma/turn-drive.js +19 -103
  77. package/build/src/akuma-body.js +3 -6
  78. package/build/src/body-host.d.ts +8 -2
  79. package/build/src/body-host.js +30 -4
  80. package/build/src/cli/commands/akuma-grammar.d.ts +0 -2
  81. package/build/src/cli/commands/akuma-grammar.js +10 -33
  82. package/build/src/cli/commands/akuma.js +31 -49
  83. package/build/src/cli/commands/contract-grammar.d.ts +7 -1
  84. package/build/src/cli/commands/contract-grammar.js +15 -0
  85. package/build/src/cli/commands/contract-help.d.ts +13 -1
  86. package/build/src/cli/commands/contract-help.js +47 -16
  87. package/build/src/cli/commands/contract.js +27 -26
  88. package/build/src/cli/commands/debt.js +3 -3
  89. package/build/src/cli/commands/whoami.d.ts +0 -2
  90. package/build/src/cli/commands/whoami.js +0 -5
  91. package/build/src/cli/coordinates.js +15 -0
  92. package/build/src/cli/delivery-identity.d.ts +3 -0
  93. package/build/src/cli/delivery-identity.js +23 -0
  94. package/build/src/cli/parse.js +1 -0
  95. package/build/src/cli/render/akuma-activity.d.ts +0 -1
  96. package/build/src/cli/render/akuma-activity.js +1 -4
  97. package/build/src/cli/render/catalog.js +7 -1
  98. package/build/src/cli/render/contract-history.js +16 -38
  99. package/build/src/cli/render/contract-observation.d.ts +23 -10
  100. package/build/src/cli/render/contract-observation.js +9 -6
  101. package/build/src/cli/render/contract-wait.d.ts +2 -0
  102. package/build/src/cli/render/contract-wait.js +18 -0
  103. package/build/src/cli/render/contract.d.ts +2 -2
  104. package/build/src/cli/render/contract.js +57 -39
  105. package/build/src/cli/render/delivery-preview.js +13 -26
  106. package/build/src/cli/render/execution-progress.js +9 -9
  107. package/build/src/cli/render/kanshi.js +4 -11
  108. package/build/src/cli/render/receipt.d.ts +18 -0
  109. package/build/src/cli/render/receipt.js +34 -10
  110. package/build/src/cli/render/reconcile.js +3 -0
  111. package/build/src/cli/render/refusal.js +28 -6
  112. package/build/src/cli/render/whoami.js +1 -4
  113. package/build/src/cli/runtime.d.ts +0 -2
  114. package/build/src/cli/runtime.js +3 -7
  115. package/build/src/cli/selectors.d.ts +1 -2
  116. package/build/src/cli/selectors.js +2 -5
  117. package/build/src/contract-guidance.js +4 -2
  118. package/build/src/contract-worktree.d.ts +3 -3
  119. package/build/src/core/facts/codec.js +38 -5
  120. package/build/src/core/facts/fold.js +1 -0
  121. package/build/src/core/facts/gate.d.ts +10 -4
  122. package/build/src/core/facts/gate.js +56 -39
  123. package/build/src/core/facts/observation.d.ts +7 -1
  124. package/build/src/core/facts/observation.js +15 -0
  125. package/build/src/core/facts/offer.d.ts +2 -2
  126. package/build/src/core/facts/types.d.ts +17 -1
  127. package/build/src/core/facts/types.js +6 -0
  128. package/build/src/core/verbs/amend.js +8 -0
  129. package/build/src/core/verbs/bind.d.ts +3 -1
  130. package/build/src/core/verbs/bind.js +9 -1
  131. package/build/src/core/verbs/deliver.d.ts +2 -1
  132. package/build/src/core/verbs/deliver.js +4 -1
  133. package/build/src/core/verbs/placement.d.ts +2 -1
  134. package/build/src/core/verbs/placement.js +7 -4
  135. package/build/src/core/verbs/reintegrate.d.ts +2 -1
  136. package/build/src/core/verbs/reintegrate.js +4 -1
  137. package/build/src/debt/board.d.ts +10 -10
  138. package/build/src/debt/created-observation.d.ts +3 -3
  139. package/build/src/debt/document.d.ts +1 -1
  140. package/build/src/debt/index.d.ts +2 -24
  141. package/build/src/debt/index.js +11 -71
  142. package/build/src/debt/operation-types.d.ts +44 -3
  143. package/build/src/git/admission.js +18 -6
  144. package/build/src/git/integration.d.ts +4 -4
  145. package/build/src/git/integration.js +7 -1
  146. package/build/src/git/observe.d.ts +6 -4
  147. package/build/src/git/observe.js +18 -17
  148. package/build/src/git/reconcile.d.ts +20 -8
  149. package/build/src/git/reconcile.js +94 -45
  150. package/build/src/git/repository.d.ts +3 -1
  151. package/build/src/git/repository.js +26 -4
  152. package/build/src/git/scratch.d.ts +1 -1
  153. package/build/src/git/scratch.js +19 -18
  154. package/build/src/git/target-placement.d.ts +33 -7
  155. package/build/src/git/target-placement.js +67 -18
  156. package/build/src/git/target.d.ts +32 -0
  157. package/build/src/git/target.js +84 -0
  158. package/build/src/git/terminal-reconcile.d.ts +1 -1
  159. package/build/src/git/terminal-reconcile.js +34 -6
  160. package/build/src/index.d.ts +9 -7
  161. package/build/src/index.js +1 -1
  162. package/build/src/library/address.d.ts +1 -20
  163. package/build/src/library/address.js +3 -24
  164. package/build/src/library/akuma-creation.d.ts +2 -5
  165. package/build/src/library/akuma-creation.js +60 -44
  166. package/build/src/library/akumas.d.ts +3 -9
  167. package/build/src/library/akumas.js +12 -25
  168. package/build/src/library/bind.d.ts +21 -9
  169. package/build/src/library/bind.js +5 -1
  170. package/build/src/library/continuation.d.ts +130 -155
  171. package/build/src/library/continuation.js +1 -4
  172. package/build/src/library/contract-composition.d.ts +4 -9
  173. package/build/src/library/contract-composition.js +8 -12
  174. package/build/src/library/contract-creation.d.ts +1 -3
  175. package/build/src/library/contract-creation.js +2 -3
  176. package/build/src/library/contract-execution.d.ts +3 -5
  177. package/build/src/library/contract-execution.js +55 -96
  178. package/build/src/library/contract-outcomes.d.ts +2 -1
  179. package/build/src/library/contract-types.d.ts +5 -0
  180. package/build/src/library/contract-wait.d.ts +35 -0
  181. package/build/src/library/contract-wait.js +141 -0
  182. package/build/src/library/delivery.d.ts +13 -525
  183. package/build/src/library/delivery.js +1 -12
  184. package/build/src/library/input.js +2 -1
  185. package/build/src/library/invocation.d.ts +5 -1
  186. package/build/src/library/invocation.js +9 -2
  187. package/build/src/library/keiyaku.d.ts +7 -6
  188. package/build/src/library/keiyaku.js +12 -7
  189. package/build/src/library/outcome.d.ts +461 -12586
  190. package/build/src/library/outcome.js +15 -234
  191. package/build/src/library/reconcile.d.ts +12 -0
  192. package/build/src/library/reconcile.js +1 -0
  193. package/build/src/library/refusal.d.ts +251 -34
  194. package/build/src/library/refusal.js +10 -5
  195. package/build/src/library/selection.d.ts +9 -35
  196. package/build/src/library/selection.js +59 -129
  197. package/build/src/plugin/akuma-signals.d.ts +2 -2
  198. package/build/src/plugin/akuma-signals.js +2 -2
  199. package/build/src/plugin/public.d.ts +0 -7
  200. package/build/src/plugin/runtime.d.ts +2 -2
  201. package/build/src/plugin/runtime.js +4 -3
  202. package/build/src/protocol/attempt.js +7 -3
  203. package/build/src/protocol/bind.d.ts +18 -4
  204. package/build/src/protocol/bind.js +102 -35
  205. package/build/src/protocol/completion.d.ts +18 -331
  206. package/build/src/protocol/completion.js +17 -130
  207. package/build/src/protocol/deliver.d.ts +3 -3
  208. package/build/src/protocol/deliver.js +64 -74
  209. package/build/src/protocol/delivery-preview.d.ts +85 -28
  210. package/build/src/protocol/delivery-preview.js +34 -22
  211. package/build/src/protocol/execution-observation.d.ts +12 -9
  212. package/build/src/protocol/execution-observation.js +0 -1
  213. package/build/src/protocol/intent.d.ts +20 -50
  214. package/build/src/protocol/intent.js +37 -44
  215. package/build/src/protocol/operations.d.ts +299 -19
  216. package/build/src/protocol/operations.js +68 -27
  217. package/build/src/protocol/outcome.d.ts +1 -1
  218. package/build/src/protocol/placement.d.ts +2 -2
  219. package/build/src/protocol/placement.js +4 -3
  220. package/build/src/protocol/progress.d.ts +35 -2
  221. package/build/src/protocol/progress.js +12 -1
  222. package/build/src/protocol/read/observation.js +15 -4
  223. package/build/src/protocol/read/status.d.ts +9 -14
  224. package/build/src/protocol/read/status.js +15 -22
  225. package/build/src/protocol/reintegrate.d.ts +4 -3
  226. package/build/src/protocol/reintegrate.js +21 -5
  227. package/build/src/protocol/review.d.ts +9 -15
  228. package/build/src/protocol/review.js +2 -6
  229. package/build/src/protocol/run.d.ts +1 -1
  230. package/build/src/protocol/verify.d.ts +51 -0
  231. package/build/src/protocol/verify.js +128 -0
  232. package/build/src/verification/declaration.d.ts +5 -1
  233. package/build/src/verification/declaration.js +19 -2
  234. package/build/src/verification/execution.d.ts +5 -2
  235. package/build/src/verification/execution.js +48 -53
  236. package/build/src/verification/observation.d.ts +10 -6
  237. package/build/src/verification/observation.js +5 -2
  238. package/package.json +3 -3
  239. package/plugins/paseo/plugin/index.server.ts +3 -0
  240. package/plugins/paseo/plugin/server/attach.ts +42 -0
  241. package/plugins/paseo/plugin/server/mirror-identity.ts +51 -0
  242. package/plugins/paseo/plugin/server/model.ts +26 -0
  243. package/plugins/paseo/plugin/server/provider.ts +4 -6
  244. package/plugins/paseo/plugin/server/reopen.ts +4 -39
  245. package/plugins/pi/README.md +7 -12
  246. package/plugins/pi/akuma-tools.ts +3 -18
  247. package/skills/keiyaku-akuma/SKILL.md +39 -4
  248. package/skills/keiyaku-akuma/references/automation.md +4 -7
  249. package/skills/keiyaku-babysit/SKILL.md +1 -1
  250. package/skills/keiyaku-bind/SKILL.md +39 -15
  251. package/skills/keiyaku-workflow/SKILL.md +42 -22
  252. package/build/src/akuma/allowed.d.ts +0 -23
  253. package/build/src/akuma/allowed.js +0 -63
  254. package/build/src/akuma/call-request.d.ts +0 -308
  255. package/build/src/akuma/call-request.js +0 -175
  256. package/build/src/akuma/heart/request-authority.d.ts +0 -16
  257. package/build/src/akuma/heart/request-authority.js +0 -140
  258. package/build/src/akuma/heart/request-rows.d.ts +0 -18
  259. package/build/src/akuma/heart/request-rows.js +0 -107
  260. package/build/src/akuma/request-lifecycle.d.ts +0 -42
  261. package/build/src/akuma/request-lifecycle.js +0 -197
  262. package/build/src/akuma/request-observation.d.ts +0 -45
  263. package/build/src/akuma/request-observation.js +0 -162
  264. package/build/src/akuma/request-rendezvous.d.ts +0 -32
  265. package/build/src/akuma/request-rendezvous.js +0 -189
  266. package/build/src/akuma/request-serve.d.ts +0 -16
  267. package/build/src/akuma/request-serve.js +0 -188
  268. package/build/src/akuma/request-wire.d.ts +0 -143
  269. package/build/src/akuma/request-wire.js +0 -146
  270. package/build/src/akuma/requests.d.ts +0 -20
  271. package/build/src/akuma/requests.js +0 -72
  272. package/build/src/akuma/selection-owner-port.d.ts +0 -14
  273. package/build/src/akuma/selection-owner-port.js +0 -54
  274. package/build/src/akuma/selection-request.d.ts +0 -305
  275. package/build/src/akuma/selection-request.js +0 -307
  276. package/build/src/body-requests.d.ts +0 -13
  277. package/build/src/body-requests.js +0 -131
  278. package/build/src/cli/square-identity.d.ts +0 -10
  279. package/build/src/cli/square-identity.js +0 -130
  280. package/build/src/debt/mutation-result.d.ts +0 -981
  281. package/build/src/debt/mutation-result.js +0 -109
  282. package/build/src/debt/mutation.d.ts +0 -424
  283. package/build/src/debt/mutation.js +0 -223
  284. package/build/src/library/contract-operations.d.ts +0 -382
  285. package/build/src/library/contract-operations.js +0 -300
@@ -2,21 +2,20 @@ import { akumaCallerFromEnvironment } from "../akuma-caller.js";
2
2
  import { CliUsageError, isBlankInput } from "../usage.js";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { resolve } from "node:path";
5
- import { squareSeat } from "../square-identity.js";
6
- import { emitPluginSignal } from "../../plugin/akuma-signals.js";
5
+ import { deliveryOwner } from "../delivery-identity.js";
7
6
  import { canonicalBirthCwd } from "../../akuma/call-input.js";
8
7
  import { Schema } from "../../akuma/index.js";
9
- import { executionChannel } from "../../akuma/requests.js";
10
8
  import { settings } from "../../settings.js";
11
- import { AkumaWorldScopeError } from "../../index.js";
12
- import { akumasWithExecution } from "../../library/akumas.js";
9
+ import { Akumas, AkumaWorldScopeError, } from "../../index.js";
10
+ import { Keiyaku } from "../../index.js";
13
11
  import { World } from "../../world.js";
14
12
  import { contractFromInput } from "../selectors.js";
15
13
  import { ActivityDriver } from "../activity.js";
16
14
  import { displayContext, emit, resultContext, writeJson, writeStderr, writeStdout, } from "../streams.js";
17
15
  import { callObservationStream } from "../render/akuma-activity.js";
16
+ import { contractWaitText } from "../render/contract-wait.js";
18
17
  import { askRawAnswer, callRawAnswer, historyRawAnswer, historyText, tellText, waitText, } from "../render/akuma-activity.js";
19
- import { askOutcome, askProgressStream, callOutcome, callObservationHead, forkOutcome, historyOutcome, killOutcome, renderCallText, renderFailedCallObservation, renderForkText, renderKillText, tellOutcome, waitedTellProgress, } from "../render/akuma.js";
18
+ import { askOutcome, askProgressStream, callOutcome, callObservationHead, forkOutcome, historyOutcome, killOutcome, renderCallText, renderFailedCallObservation, renderForkText, renderKillText, tellOutcome, } from "../render/akuma.js";
20
19
  export { isParsedAkumaCommand, renderAkumaHelp } from "./akuma-grammar.js";
21
20
  // ---------------------------------------------------------------------------
22
21
  // Leaf dispatch: acquisition, one public SDK invocation, direct rendering
@@ -28,7 +27,7 @@ async function settingsAt(root, home) {
28
27
  });
29
28
  }
30
29
  function akumas(input) {
31
- return akumasWithExecution(input.path, input.execution, { reportDiagnostic: writeStderr });
30
+ return Akumas.of(input.path, { reportDiagnostic: writeStderr });
32
31
  }
33
32
  async function schemaFromFile(path) {
34
33
  try {
@@ -50,34 +49,9 @@ async function promptBody(action, command, input) {
50
49
  throw new CliUsageError(`${action} requires a nonblank prompt`);
51
50
  return bytes;
52
51
  }
53
- /**
54
- * A generic integration initiator outranks any Square guess; otherwise the Square
55
- * edge selects. Identity selection is optional, so it never refuses the operation.
56
- */
57
- async function submittingInitiator(input) {
58
- const declared = input.environment.KEIYAKU_INITIATOR?.trim();
59
- if (declared !== undefined && declared !== "")
60
- return declared;
61
- try {
62
- return await squareSeat({ path: input.path, environment: input.environment }, { ...(input.signal === undefined ? {} : { signal: input.signal }) });
63
- }
64
- catch {
65
- return undefined;
66
- }
67
- }
68
- async function inputInitiator(input) {
69
- const initiator = await submittingInitiator(input);
70
- if (initiator === undefined)
71
- return {};
72
- // Identity preparation needs established plugin custody, not just a candidate.
73
- if (!(await World.established(input.path)))
74
- return { initiator };
75
- await emitPluginSignal({
76
- world: input.path,
77
- ...(input.settings === undefined ? {} : { settings: input.settings }),
78
- reportDiagnostic: (message) => writeStderr(message),
79
- }, { kind: "akuma.initiating", initiator });
80
- return { initiator };
52
+ function inputInitiator(input) {
53
+ const initiator = deliveryOwner(input.environment);
54
+ return initiator === undefined ? {} : { initiator };
81
55
  }
82
56
  function emitAnswer(body, exact) {
83
57
  if (exact)
@@ -89,10 +63,7 @@ function emitAnswer(body, exact) {
89
63
  async function runCall(command, input) {
90
64
  const body = command.prompt === undefined ? undefined : await promptBody("call", { prompt: command.prompt }, input);
91
65
  const schema = command.schema === undefined ? undefined : await schemaFromFile(command.schema);
92
- const declaredCaller = executionChannel(input.execution).kind === "body-request"
93
- ? undefined
94
- : await akumaCallerFromEnvironment(input.environment);
95
- // Establish the selected World before preparing the submitting Square route.
66
+ const declaredCaller = await akumaCallerFromEnvironment(input.environment);
96
67
  await World.at(input.path);
97
68
  const caller = akumas(input);
98
69
  const request = {
@@ -105,7 +76,6 @@ async function runCall(command, input) {
105
76
  ...(input.executionCwd === undefined ? {} : { cwd: input.executionCwd }),
106
77
  ...(input.contract === undefined ? {} : { contract: input.contract }),
107
78
  ...(command.alias === undefined ? {} : { alias: command.alias }),
108
- ...(command.allowed === undefined ? {} : { allowed: command.allowed }),
109
79
  ...(input.writableDirectories === undefined ? {} : { writableDirectories: input.writableDirectories }),
110
80
  ...(command.bare === undefined ? {} : { bare: command.bare }),
111
81
  ...(schema === undefined ? {} : { schema }),
@@ -192,10 +162,7 @@ async function runAsk(command, input) {
192
162
  const body = await promptBody("ask", command, input);
193
163
  const schema = command.schema === undefined ? undefined : await schemaFromFile(command.schema);
194
164
  const alias = inputAlias(command.akuma);
195
- const channel = executionChannel(input.execution);
196
- const progress = command.output === "text" && channel.kind === "local"
197
- ? askProgressStream(undefined, alias, resultContext())
198
- : undefined;
165
+ const progress = command.output === "text" ? askProgressStream(undefined, alias, resultContext()) : undefined;
199
166
  const driver = new ActivityDriver(process.stderr);
200
167
  try {
201
168
  const result = await akumas(input).ask({
@@ -222,8 +189,6 @@ async function runAsk(command, input) {
222
189
  });
223
190
  if (progress !== undefined)
224
191
  driver.conclude(progress.conclude(result).join("\n"));
225
- else if (command.output === "text" && channel.kind === "body-request")
226
- writeStderr(waitedTellProgress(result, alias, resultContext()));
227
192
  if (command.output === "json")
228
193
  writeJson(result);
229
194
  else
@@ -309,13 +274,12 @@ async function akumaInput(command, coordinates, workdir, runtime) {
309
274
  throw new TypeError("--add-dir requires a nonblank directory");
310
275
  return canonicalBirthCwd(resolve(coordinates.cwd, path));
311
276
  }));
312
- const execution = runtime.execution;
313
277
  const home = command.command === "call" ? runtime.home : undefined;
314
278
  const configuration = command.command === "call" ? await settingsAt(path, home) : undefined;
315
279
  if (command.command === "call" && command.contract !== undefined && coordinates.repo === undefined)
316
280
  throw new Error("call with Contract requires a resolved Repo");
317
281
  const contract = command.command === "call" && command.contract !== undefined
318
- ? contractFromInput(coordinates.repo, command.contract, execution).contract
282
+ ? contractFromInput(coordinates.repo, command.contract).contract
319
283
  : undefined;
320
284
  return {
321
285
  path,
@@ -327,12 +291,30 @@ async function akumaInput(command, coordinates, workdir, runtime) {
327
291
  ...(coordinates.repo === undefined ? {} : { repo: coordinates.repo }),
328
292
  environment: runtime.environment,
329
293
  readStdin: runtime.readStdin,
330
- execution,
331
294
  ...(runtime.signal === undefined ? {} : { signal: runtime.signal }),
332
295
  };
333
296
  }
334
297
  export async function runAkumaCommand(command, coordinates, workdir, runtime) {
335
298
  try {
299
+ if (command.command === "wait") {
300
+ const contracts = command.akuma.filter((selector) => selector.startsWith("kei/"));
301
+ if (contracts.length > 0) {
302
+ if (coordinates.repo === undefined)
303
+ throw new CliUsageError("Contract wait requires a repository");
304
+ const result = await Keiyaku.with().wait({
305
+ repo: coordinates.repo,
306
+ contracts,
307
+ ...(command.completion === undefined ? {} : { completion: command.completion }),
308
+ ...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
309
+ ...(runtime.signal === undefined ? {} : { signal: runtime.signal }),
310
+ });
311
+ if (command.output === "json")
312
+ writeJson(result);
313
+ else
314
+ writeStdout(contractWaitText(result));
315
+ return result.kind === "missing" ? "refused" : "accepted";
316
+ }
317
+ }
336
318
  const input = await akumaInput(command, coordinates, workdir, runtime);
337
319
  switch (command.command) {
338
320
  case "call":
@@ -59,6 +59,12 @@ export type ParsedDeliver = Output & Readonly<{
59
59
  materializeConflict: boolean;
60
60
  overwrite: boolean;
61
61
  }>;
62
+ export type ParsedVerify = Output & Readonly<{
63
+ command: "verify";
64
+ contract?: string;
65
+ index?: number;
66
+ includeDirty: boolean;
67
+ }>;
62
68
  export type ParsedReview = Output & Actor & Readonly<{
63
69
  command: "review";
64
70
  contract?: string;
@@ -129,7 +135,7 @@ export type ParsedContractParts = Readonly<{
129
135
  output: "text" | "json";
130
136
  actor?: string;
131
137
  }>;
132
- export type ParsedContractCommand = ParsedBind | ParsedAmend | ParsedDeliver | ParsedReview | ParsedArc | ParsedAbandon | ParsedShow | ParsedStatus | ParsedLs | ParsedReconcile | ParsedNuke | ParsedSettings | ParsedRegion;
138
+ export type ParsedContractCommand = ParsedBind | ParsedAmend | ParsedDeliver | ParsedVerify | ParsedReview | ParsedArc | ParsedAbandon | ParsedShow | ParsedStatus | ParsedLs | ParsedReconcile | ParsedNuke | ParsedSettings | ParsedRegion;
133
139
  export type StatusCategory = "akuma" | "contract";
134
140
  export declare function parseContractCommand(parts: ParsedContractParts): ParsedContractCommand;
135
141
  export {};
@@ -129,6 +129,19 @@ function parseDeliver(parts) {
129
129
  output: parts.output,
130
130
  };
131
131
  }
132
+ function parseVerify(parts) {
133
+ const contract = parts.positionals[0];
134
+ const index = optionalFlag(parts.flags, "index");
135
+ if (index !== undefined && (!/^[1-9][0-9]*$/u.test(index) || !Number.isSafeInteger(Number(index))))
136
+ refuse("verify", "--index requires a positive safe integer");
137
+ return {
138
+ command: "verify",
139
+ ...(contract === undefined ? {} : { contract }),
140
+ ...(index === undefined ? {} : { index: Number(index) }),
141
+ includeDirty: parts.flags["include-dirty"] === true,
142
+ output: parts.output,
143
+ };
144
+ }
132
145
  function parseReview(parts) {
133
146
  if (Number(parts.flags.satisfied === true) + Number(parts.flags.unsatisfied === true) !== 1) {
134
147
  refuse("review", "review requires exactly one verdict flag");
@@ -318,6 +331,8 @@ export function parseContractCommand(parts) {
318
331
  return parseAmend(parts);
319
332
  case "deliver":
320
333
  return parseDeliver(parts);
334
+ case "verify":
335
+ return parseVerify(parts);
321
336
  case "review":
322
337
  return parseReview(parts);
323
338
  case "arc": {
@@ -21,7 +21,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
21
21
  readonly "fork-of": "value";
22
22
  readonly json: "boolean";
23
23
  };
24
- readonly usage: "bind [--debt <debt/...>] [--target <ref> | --no-target] [--after <kei/...>]... [--gates <name,...>] [--actor <actor>] [--repo <path>] -\nbind --fork-of <kei/...> [--target <ref> | --no-target] [--actor <actor>] [--repo <path>]";
24
+ readonly usage: "bind [--debt <debt/...>] [--target <branch|kei/...> | --no-target] [--after <kei/...>]... [--gates <name,...>] [--actor <actor>] [--repo <path>] -\nbind --fork-of <kei/...> [--target <branch|kei/...> | --no-target] [--actor <actor>] [--repo <path>]";
25
25
  readonly purpose: "Create a Contract from stdin Markdown or copy an existing Contract as a starting point.";
26
26
  readonly details: string;
27
27
  };
@@ -55,6 +55,18 @@ export declare const CONTRACT_COMMAND_SPECS: {
55
55
  readonly purpose: "Submit work for a Contract and integrate it when its requirements are met.";
56
56
  readonly details: string;
57
57
  };
58
+ readonly verify: {
59
+ readonly positional: "optional";
60
+ readonly stdin: "none";
61
+ readonly flags: {
62
+ readonly index: "value";
63
+ readonly "include-dirty": "boolean";
64
+ readonly json: "boolean";
65
+ };
66
+ readonly usage: "verify [<contract>|@<contract>] [--index <n>] [--include-dirty] [--repo <path>]";
67
+ readonly purpose: "Execute independent Verification checks and record their evidence.";
68
+ readonly details: string;
69
+ };
58
70
  readonly review: {
59
71
  readonly positional: "optional";
60
72
  readonly stdin: "optional";
@@ -13,17 +13,19 @@ export const CONTRACT_COMMAND_SPECS = {
13
13
  "fork-of": "value",
14
14
  json: "boolean",
15
15
  },
16
- usage: "bind [--debt <debt/...>] [--target <ref> | --no-target] [--after <kei/...>]... [--gates <name,...>] [--actor <actor>] [--repo <path>] -\nbind --fork-of <kei/...> [--target <ref> | --no-target] [--actor <actor>] [--repo <path>]",
16
+ usage: "bind [--debt <debt/...>] [--target <branch|kei/...> | --no-target] [--after <kei/...>]... [--gates <name,...>] [--actor <actor>] [--repo <path>] -\nbind --fork-of <kei/...> [--target <branch|kei/...> | --no-target] [--actor <actor>] [--repo <path>]",
17
17
  purpose: "Create a Contract from stdin Markdown or copy an existing Contract as a starting point.",
18
18
  details: [
19
- "--target names one existing local branch literally; it is never created and never",
20
- "guessed. Omitting it binds to the current branch of the invocation worktree",
21
- "coordinate, or binds without a target on a detached committed HEAD. --no-target",
22
- "binds without a target on purpose, and is refused together with --target.",
23
- "A fork copies its source target when neither flag is given.",
19
+ "--target names an existing local branch or a complete active kei/... identity.",
20
+ "A Contract target lands into its appointed detached worktree, not its branch;",
21
+ "only its committed HEAD is used as the child's start. To name a branch beginning",
22
+ "kei/, use refs/heads/kei/.... Omitting --target selects the invocation worktree's",
23
+ "current branch, or no target on detached committed HEAD. --no-target explicitly",
24
+ "selects no target and cannot be combined with --target. A fork inherits its",
25
+ "source's exact target when neither flag is given, including its worktree identity.",
24
26
  "",
25
27
  "Gates are acceptance obligations checked at placement: reviewed awaits a",
26
- "satisfied review, verified awaits a passing Verification run.",
28
+ "satisfied review, verified awaits satisfied evidence for every Verification declaration.",
27
29
  "",
28
30
  "--gates <name,...> selects reviewed, verified, or named gate groups from Settings",
29
31
  "(keiyaku settings). A group expands into its gates; unknown names are rejected",
@@ -52,7 +54,7 @@ export const CONTRACT_COMMAND_SPECS = {
52
54
  "txt) are combined. A trailing '/' means 'path/**'. Whitespace in a pattern",
53
55
  "binds with a warning.",
54
56
  "",
55
- "Verification runs only with the verified gate; without it the section is inert text.",
57
+ "Only verify runs Verification; without the verified gate the section is inert text.",
56
58
  "Verification uses one or more closed bash, zsh, or pwsh fences. Its fence",
57
59
  "may add timeout=<integer><ms|s|m|h>; the section contains no other prose.",
58
60
  "Unknown ## sections are retained as extensions; reserved section names are refused.",
@@ -66,7 +68,7 @@ export const CONTRACT_COMMAND_SPECS = {
66
68
  purpose: "Change a Contract's document, prerequisites, or acceptance gates.",
67
69
  details: [
68
70
  "Gates are checked at integration: reviewed needs a satisfied review;",
69
- "verified needs passing Verification. --gates <name,...> replaces them with",
71
+ "verified needs satisfied evidence for every declaration. --gates <name,...> replaces them with",
70
72
  "reviewed, verified, or configured groups (see keiyaku settings).",
71
73
  'Omitting --gates keeps them; --gates "" clears them.',
72
74
  "",
@@ -95,12 +97,12 @@ export const CONTRACT_COMMAND_SPECS = {
95
97
  purpose: "Submit work for a Contract and integrate it when its requirements are met.",
96
98
  details: [
97
99
  "Delivery is judged against the whole Contract, not the current Arc. It uses",
98
- "HEAD. With the verified gate it runs Verification or reuses current satisfied",
99
- "evidence. If prerequisites and gates pass, it integrates and accepts now;",
100
- "otherwise the candidate waits. Delivery never counts as a review.",
100
+ "HEAD and consumes standing gate evidence. If prerequisites and every gate",
101
+ "requirement pass, it integrates and accepts now; otherwise the candidate waits.",
102
+ "Delivery never runs Verification or counts as a review.",
101
103
  "",
102
- "Repeating delivery with unchanged work resumes unfinished Verification or",
103
- "integration. Changed work replaces the candidate and invalidates earlier review.",
104
+ "Repeating delivery with unchanged work resumes unfinished integration.",
105
+ "Changed work replaces the candidate and invalidates earlier review.",
104
106
  "Identical content keeps review across rebase or target movement.",
105
107
  "",
106
108
  "Progress goes to stderr; stdout carries one final result. Ctrl-C requests a",
@@ -118,11 +120,39 @@ export const CONTRACT_COMMAND_SPECS = {
118
120
  " --show-diff Include the proposed diff; requires --dry-run.",
119
121
  " --materialize-conflict Write the observed conflict as an uncommitted merge.",
120
122
  " With --include-dirty, preserve current changes first.",
121
- " --overwrite Bypass reuse of a candidate with unfinished Verification.",
123
+ " --overwrite Bypass reuse of a pending candidate.",
122
124
  "",
123
125
  "--message, --materialize-conflict and --overwrite are refused with --dry-run.",
124
126
  ].join("\n"),
125
127
  },
128
+ verify: {
129
+ positional: "optional",
130
+ stdin: "none",
131
+ flags: { index: "value", "include-dirty": "boolean", json: "boolean" },
132
+ usage: "verify [<contract>|@<contract>] [--index <n>] [--include-dirty] [--repo <path>]",
133
+ purpose: "Execute independent Verification checks and record their evidence.",
134
+ details: [
135
+ "Requires an active Contract with the verified gate and Verification declarations.",
136
+ "Omitted selection uses the exact appointed worktree's Contract context.",
137
+ "--index selects one declaration by its current one-based position; it must be",
138
+ "a positive safe integer written with digits only, with no leading zero.",
139
+ "Omitting --index runs all declarations. An out-of-range index refuses before execution.",
140
+ "",
141
+ "Each selected declaration always executes in its own clean scratch, including",
142
+ "when satisfied evidence already exists. Setup and cleanup run independently;",
143
+ "checks cannot share scratch files. Normal failure or timeout records an",
144
+ "unsatisfied verdict and allows remaining checks to run. Operational stops",
145
+ "and cancellation retain earlier admitted evidence without inventing a verdict.",
146
+ "",
147
+ "--include-dirty captures all non-ignored worktree changes without changing",
148
+ "the real index or branch. Checks cover the exact prospective integration.",
149
+ "Verify admits no delivery. After execution it requests ordinary completion;",
150
+ "only an already-delivered candidate with all requirements met can integrate.",
151
+ "The receipt names each check's execution, verdict, admission or reuse, and stop.",
152
+ "Progress goes to stderr; stdout carries one final result. Ctrl-C requests",
153
+ "a stop and waits for the final receipt, preserving admitted evidence.",
154
+ ].join("\n"),
155
+ },
126
156
  review: {
127
157
  positional: "optional",
128
158
  stdin: "optional",
@@ -133,6 +163,7 @@ export const CONTRACT_COMMAND_SPECS = {
133
163
  "A review checks the whole Contract, not just one Arc. After delivery it checks the candidate; before delivery it checks the current Contract and worktree, but cannot integrate.",
134
164
  "--satisfied means every acceptance criterion is met. It records the verdict and requests integration; if the candidate, prerequisites, and gates are ready, this invocation integrates and accepts the Contract. Otherwise the Contract stays active.",
135
165
  "--unsatisfied records what is missing and does not request integration.",
166
+ "Review consumes standing gate evidence and never executes Verification.",
136
167
  "--summary gives the conclusion and evidence for --satisfied, or the specific blocker for --unsatisfied.",
137
168
  "Progress appears on stderr; stdout contains one final result.",
138
169
  ].join("\n"),
@@ -252,7 +283,7 @@ export function renderContractHelp(command) {
252
283
  "Akuma definitions are Markdown files, one per name:",
253
284
  " user ~/.keiyaku/akumas/<name>.md",
254
285
  " project <WorldRoot>/.keiyaku/akumas/<name>.md",
255
- "Project wins. Frontmatter: provider, base, model, effort, network, allowed,",
286
+ "Project wins. Frontmatter: provider, base, model, effort, network,",
256
287
  "systemPromptMode, description. The body is an optional system prompt.",
257
288
  "Provider setup: see README Configuration.",
258
289
  ].join("\n");
@@ -1,10 +1,8 @@
1
- import { executionChannel } from "../../akuma/requests.js";
2
1
  import { Akumas, Keiyaku, KeiyakuError, kanshiCategory, listArchetypeDefinitions, nuke } from "../../index.js";
3
2
  import { kanshi, selectRegion } from "../../kanshi/index.js";
4
3
  import { observeNamedAddress, resolveNamedAddress } from "../../library/address.js";
5
- import { composeContractLibrary, observeKeiyaku } from "../../library/contract-composition.js";
4
+ import { observeKeiyaku } from "../../library/contract-composition.js";
6
5
  import { validateArcMarkdown, validateContractMarkdown } from "../../library/input.js";
7
- import { createKeiyakuHandle } from "../../library/keiyaku.js";
8
6
  import { SettingsError, settings } from "../../settings.js";
9
7
  import { akumaCallerFromEnvironment } from "../akuma-caller.js";
10
8
  import { Debts } from "../../debt/index.js";
@@ -35,17 +33,6 @@ async function settingsAt(root, home) {
35
33
  ...(home === undefined ? {} : { home }),
36
34
  });
37
35
  }
38
- /**
39
- * The process edge loads one Settings value and hands it to the private composition.
40
- * A forwarded preview/deliver/review is served by its parent, which loads its own.
41
- */
42
- async function contractSettings(command, execution, world, home) {
43
- const forwarded = executionChannel(execution).kind === "body-request" &&
44
- (command.command === "deliver" || command.command === "review");
45
- if (forwarded)
46
- return undefined;
47
- return await settingsAt(world ?? undefined, home);
48
- }
49
36
  function draftWarning(error) {
50
37
  return { warning: `bind draft could not be preserved: ${error instanceof Error ? error.message : String(error)}` };
51
38
  }
@@ -201,6 +188,22 @@ async function runDeliver(command, runtime, seat) {
201
188
  }
202
189
  return await finishContractAnswer(answer, command.output, deliverRefusalProjection);
203
190
  }
191
+ async function runVerify(command, runtime, seat) {
192
+ const driver = command.output === "text" ? await runtime.progress() : undefined;
193
+ let answer;
194
+ try {
195
+ answer = await seat.contract.verify({
196
+ ...(command.index === undefined ? {} : { index: command.index }),
197
+ includeDirty: command.includeDirty,
198
+ ...(runtime.signal === undefined ? {} : { signal: runtime.signal }),
199
+ }, { ...(driver === undefined ? {} : { observe: driver.observe }) });
200
+ }
201
+ finally {
202
+ if (driver !== undefined)
203
+ await driver.finish().catch(() => undefined);
204
+ }
205
+ return await finishContractAnswer(answer, command.output, deliverRefusalProjection);
206
+ }
204
207
  async function runReview(command, runtime, seat) {
205
208
  const summary = command.summaryFromStdin === true ? await runtime.readStdin() : command.summary;
206
209
  if (command.summaryFromStdin === true && isBlankInput(summary ?? ""))
@@ -247,11 +250,11 @@ async function runAbandon(command, seat) {
247
250
  return await finishContractAnswer(answer, command.output);
248
251
  }
249
252
  async function runContractMutation(command, input) {
250
- const { execution, configuration, runtime } = input;
251
- const actor = executionChannel(execution).kind === "local" && ["deliver", "review"].includes(command.command)
253
+ const { configuration, runtime } = input;
254
+ const actor = ["deliver", "verify", "review"].includes(command.command)
252
255
  ? actorFromEdge(undefined, runtime.environment)
253
256
  : undefined;
254
- const library = composeContractLibrary(execution, createKeiyakuHandle, {
257
+ const library = Keiyaku.with({
255
258
  ...(configuration === undefined ? {} : { settings: configuration }),
256
259
  ...(actor === undefined ? {} : { actor }),
257
260
  });
@@ -263,6 +266,8 @@ async function runContractMutation(command, input) {
263
266
  return await runAmend(command, input, seat);
264
267
  case "deliver":
265
268
  return await runDeliver(command, input.runtime, seat);
269
+ case "verify":
270
+ return await runVerify(command, input.runtime, seat);
266
271
  case "review":
267
272
  return await runReview(command, input.runtime, seat);
268
273
  case "arc":
@@ -501,12 +506,10 @@ export async function runContractHistoryCommand(command, coordinates) {
501
506
  }
502
507
  return emit(command.output, history, () => renderContractHistory(history, { full: command.full }), "accepted");
503
508
  }
504
- async function runReconcile(command, coordinates, execution, home) {
509
+ async function runReconcile(command, coordinates, home) {
505
510
  const repo = requiredRepo(coordinates);
506
- const configuration = await contractSettings(command, execution, coordinates.world, home);
507
- const library = composeContractLibrary(execution, createKeiyakuHandle, {
508
- ...(configuration === undefined ? {} : { settings: configuration }),
509
- });
511
+ const configuration = await settingsAt(coordinates.world ?? undefined, home);
512
+ const library = Keiyaku.with({ settings: configuration });
510
513
  let report;
511
514
  if (command.contract === undefined) {
512
515
  report = await library.reconcile({ repo, retryHooks: command.retryHooks });
@@ -530,7 +533,6 @@ async function runReconcile(command, coordinates, execution, home) {
530
533
  return reconcileHasFailure(report) ? "failed" : "accepted";
531
534
  }
532
535
  export async function runContractCommand(command, coordinates, runtime) {
533
- const execution = runtime.execution;
534
536
  const home = runtime.home;
535
537
  switch (command.command) {
536
538
  case "settings":
@@ -546,13 +548,12 @@ export async function runContractCommand(command, coordinates, runtime) {
546
548
  case "region":
547
549
  return await runRegion(command, coordinates);
548
550
  case "reconcile":
549
- return await runReconcile(command, coordinates, execution, home);
551
+ return await runReconcile(command, coordinates, home);
550
552
  default: {
551
- const configuration = await contractSettings(command, execution, coordinates.world, home);
553
+ const configuration = await settingsAt(coordinates.world ?? undefined, home);
552
554
  return await runContractMutation(command, {
553
555
  coordinates,
554
556
  runtime,
555
- execution,
556
557
  ...(configuration === undefined ? {} : { configuration }),
557
558
  });
558
559
  }
@@ -1,6 +1,6 @@
1
1
  import { CliUsageError, isBlankInput } from "../usage.js";
2
2
  import { parseDebtNamespaceSelector } from "../../debt/catalog.js";
3
- import { debtsWithExecution, debtRowViewLimit, } from "../../debt/index.js";
3
+ import { Debts, debtRowViewLimit, } from "../../debt/index.js";
4
4
  import { installNamespaceContext, resolveDebtNamespaceContext } from "../../debt/context.js";
5
5
  import { displayContext, emit, writeJson } from "../streams.js";
6
6
  import { renderDoctor, renderDebtContext, renderDebtLifecycle, renderDebtList, renderDebtMutation, renderDebtShow, renderDebtTree, renderDebtUpdate, debtOutcome, } from "../render/debt.js";
@@ -309,7 +309,7 @@ async function runContext(command, context) {
309
309
  : { kind: "accepted", value: resolved };
310
310
  return emit(command.output, result, () => renderDebtContext(result, displayContext()), debtOutcome(result));
311
311
  }
312
- // eslint-disable-next-line complexity -- this is the single CLI edge ordering world, context, forwarding, and local execution.
312
+ // eslint-disable-next-line complexity -- this is the single CLI edge ordering world, context, and local execution.
313
313
  export async function runDebtCommand(command, coordinates, runtime) {
314
314
  validateDebtRowView(command);
315
315
  const stdinDiagnostic = debtStdinDiagnostic(command);
@@ -323,7 +323,7 @@ export async function runDebtCommand(command, coordinates, runtime) {
323
323
  return missingWorld(command);
324
324
  if (command.action === "context")
325
325
  return await runContext(command, coordinates.debtContext);
326
- const debts = debtsWithExecution(world, runtime.execution);
326
+ const debts = Debts.of(world);
327
327
  const consumesDefaultNamespace = (command.action === "add" && explicitNamespace === undefined) ||
328
328
  (((command.action === "ls" && explicitListNamespace(command) === undefined) ||
329
329
  command.action === "ready" ||
@@ -27,7 +27,6 @@ type Profile = Readonly<{
27
27
  workdir: string | null;
28
28
  birth: AkumaStatus["birth"];
29
29
  bornAt: string | null;
30
- allowed: AkumaStatus["allowed"];
31
30
  contracts: readonly ContractId[];
32
31
  }> | Readonly<{
33
32
  kind: "unavailable";
@@ -38,7 +37,6 @@ export type WhoamiFacts = Readonly<{
38
37
  self: Self;
39
38
  initiator: string | null;
40
39
  initiatorUnavailable?: string;
41
- requests: "local" | "parent";
42
40
  contract: Contract;
43
41
  profile?: Profile;
44
42
  }>;
@@ -1,4 +1,3 @@
1
- import { AKUMA_REQUESTS_ENTRY_ENV, AKUMA_REQUESTS_ENV } from "../../akuma/providers/execution-environment.js";
2
1
  import { AkumaOwner } from "../../akuma/akuma-owner.js";
3
2
  import { readHeart, readLatestTurnForBody } from "../../akuma/heart/index.js";
4
3
  import { parseAkuId, pathsForAkuId } from "../../akuma/identity.js";
@@ -98,7 +97,6 @@ async function callerProfile(caller, coordinates, environment, bornAt) {
98
97
  workdir: status.cwd ?? null,
99
98
  birth: status.birth,
100
99
  bornAt,
101
- allowed: status.allowed,
102
100
  contracts: dispatch.kind === "associated" ? [dispatch.contractId] : [],
103
101
  };
104
102
  }
@@ -115,9 +113,6 @@ export async function runWhoami(command, coordinates, environment) {
115
113
  self,
116
114
  initiator: turn?.initiator ?? null,
117
115
  ...(turn?.unavailable === undefined ? {} : { initiatorUnavailable: turn.unavailable }),
118
- requests: environment[AKUMA_REQUESTS_ENV] !== undefined || environment[AKUMA_REQUESTS_ENTRY_ENV] !== undefined
119
- ? "parent"
120
- : "local",
121
116
  contract,
122
117
  ...(self.kind === "akuma"
123
118
  ? { profile: await callerProfile(self, coordinates, environment, turn?.bornAt ?? null) }
@@ -57,6 +57,21 @@ export const cliCoordinateDiscovery = {
57
57
  },
58
58
  async resolve(input) {
59
59
  const cwd = await resolveInvocationCwd(input);
60
+ if (input.command.command === "wait" && input.command.akuma.every((selector) => selector.startsWith("kei/"))) {
61
+ const selectedRepo = await discoverRepoAt(input.repo === undefined ? cwd : resolve(cwd, input.repo), input.gitPath);
62
+ const repo = repoFor("required", selectedRepo);
63
+ return {
64
+ cwd,
65
+ cwdSource: input.cwd === undefined ? "process" : "input",
66
+ repo,
67
+ world: null,
68
+ candidateWorld: null,
69
+ debtContext: { directory: cwd, boundary: cwd, writeRoot: cwd, managed: false },
70
+ establishWorld: async () => {
71
+ throw new Error("Contract wait has no World");
72
+ },
73
+ };
74
+ }
60
75
  const invocationRepo = await discoverRepoAt(cwd, input.gitPath);
61
76
  const selectedRepo = input.repo === undefined ? invocationRepo : await discoverRepoAt(resolve(cwd, input.repo), input.gitPath);
62
77
  const worldRepo = invocationRepo.kind === "present" ? invocationRepo.repo : undefined;
@@ -0,0 +1,3 @@
1
+ import { type Owner } from "@astrosheep/square";
2
+ /** Select attribution at the submitting edge; no host or artifact lookup. */
3
+ export declare function deliveryOwner(environment: NodeJS.ProcessEnv): Owner | undefined;
@@ -0,0 +1,23 @@
1
+ import { harnessOwner } from "@astrosheep/square";
2
+ /** Select attribution at the submitting edge; no host or artifact lookup. */
3
+ export function deliveryOwner(environment) {
4
+ const explicit = environment.KEIYAKU_INITIATOR?.trim();
5
+ if (explicit)
6
+ return explicit;
7
+ if (environment.CLAUDE_CODE_CHILD_SESSION === "1")
8
+ return undefined;
9
+ const coordinates = [
10
+ ["CLAUDE_CODE_SESSION_ID", "claude-code"],
11
+ ["CODEX_THREAD_ID", "codex"],
12
+ ["OPENCODE_SESSION_ID", "opencode"],
13
+ ["PI_SESSION_ID", "pi"],
14
+ ].flatMap(([variable, channel]) => {
15
+ const session = environment[variable]?.trim();
16
+ return session ? [{ channel: channel, session }] : [];
17
+ });
18
+ if (coordinates.length > 1)
19
+ return undefined;
20
+ const paseo = environment.PASEO_AGENT_ID?.trim();
21
+ const coordinate = coordinates[0] ?? (paseo ? { channel: "paseo", session: paseo } : undefined);
22
+ return coordinate === undefined ? undefined : harnessOwner(coordinate);
23
+ }
@@ -99,6 +99,7 @@ export function commandRepoPolicy(command) {
99
99
  case "bind":
100
100
  case "amend":
101
101
  case "deliver":
102
+ case "verify":
102
103
  case "review":
103
104
  case "arc":
104
105
  case "abandon":
@@ -132,7 +132,6 @@ type SnapshotView = Readonly<{
132
132
  type SnapshotCoreOptions = Readonly<{
133
133
  alias?: string;
134
134
  facts?: readonly string[];
135
- showAllowed?: boolean;
136
135
  }>;
137
136
  export declare function snapshotText(view: SnapshotView, context: TextRenderContext, options?: SnapshotCoreOptions): string;
138
137
  export declare function killResultText(id: string, evidence: KillEvidence, alias?: string): string;
@@ -738,10 +738,7 @@ function renderDebtContextLines(created, columns) {
738
738
  function snapshotCore(view, context, options) {
739
739
  const activity = snapshotActivityLines(view.status.timeline, context);
740
740
  // Static coordinates belong above the content boundary; a dynamic diagnostic stays below it.
741
- const contextFacts = [
742
- ...(options.showAllowed === true ? [`allowed ${view.status.allowed.join(", ") || "none"}`] : []),
743
- ...(view.status.cwd === undefined ? [] : [safeText(view.status.cwd)]),
744
- ];
741
+ const contextFacts = [...(view.status.cwd === undefined ? [] : [safeText(view.status.cwd)])];
745
742
  const facts = [
746
743
  ...contractFacts(view.contract, context.columns - SUBORDINATE_INDENT.length),
747
744
  ...(options.facts ?? []),