@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
@@ -7,12 +7,30 @@ import { captureTender, dirtyTenderRefusal, materializeTenderSnapshot, prepareDe
7
7
  import { checkoutDetachedSnapshot, recordConflictHandoff, retireConflictHandoff, workspaceMergeStatePresent, worktreePath, conflictRecovery, } from "../git/workspace.js";
8
8
  import { observeContractsForAdmissionAt } from "../git/observe.js";
9
9
  import { externalPreparation, privateStateSeatAttempt, protocolSeatClose, runBoundedAttempts, sameWorktreeWitness, STALE_PRIVATE_STATE_PREPARATION, } from "./run.js";
10
- import { contractState } from "../core/facts/observation.js";
10
+ import { contractState, documentIsCurrent, targetContractRefusal } from "../core/facts/observation.js";
11
+ import { dependencyKeys } from "../core/subject.js";
12
+ import { targetName } from "../core/facts/types.js";
13
+ import { resolveContractTarget } from "../git/target.js";
14
+ import { acquireTargetPlacementFence } from "../git/target-placement.js";
11
15
  import { decideDeliver } from "../core/verbs/deliver.js";
12
- import { currentVerifiedAttestation } from "./intent.js";
13
16
  import { admitDecidedOffer, mintAttempts } from "./attempt.js";
14
17
  import { appointmentFor, readPlaceRegister } from "../workspace-place.js";
15
- import { recordedIntegrationSnapshots, timestamp } from "./operations.js";
18
+ import { timestamp } from "./operations.js";
19
+ /** Known prospective and delivered integrations, newest first, without giving Git producer vocabulary. */
20
+ export function deliveryIntegrationSnapshots(journal) {
21
+ return journal
22
+ .flatMap((entry) => {
23
+ if (entry.kind === "deliver")
24
+ return [entry.data.integration.snapshot];
25
+ if (entry.kind === "reintegrated")
26
+ return [entry.data.snapshot];
27
+ if (entry.kind === "attestation" && entry.data.gate === "verified") {
28
+ return dependencyKeys(entry.data.subject).flatMap((key) => (key.kind === "snapshot" ? [key.value] : []));
29
+ }
30
+ return [];
31
+ })
32
+ .reverse();
33
+ }
16
34
  export const deliverLeadingSchema = z
17
35
  .object({
18
36
  kind: z.enum(["admitted-now", "already-admitted"]),
@@ -73,7 +91,8 @@ async function prepareDeliveryWithWorktree(repository, stage, input, captured) {
73
91
  if (integration.kind === "refused")
74
92
  return integration;
75
93
  const changeId = await worktreeChangeId(repository, { contractId, coordinates }, tender.data);
76
- const reusedIntegration = await reusableIntegrationSnapshot(repository, integration.data.tree, integration.data.predecessor, stage.recordedIntegrations ?? []);
94
+ // A targetless dirty integration is the captured tender, whose sole parent is the worktree head.
95
+ const reusedIntegration = await reusableIntegrationSnapshot(repository, integration.data.tree, coordinates.target === undefined && tender.data.dirty ? tender.data.head : integration.data.predecessor, stage.recordedIntegrations ?? []);
77
96
  const integrationSnapshot = reusedIntegration ??
78
97
  (coordinates.target === undefined
79
98
  ? tenderSnapshot
@@ -131,7 +150,7 @@ async function mechanicalDeliveryPreparation(input, state, derivation, journal,
131
150
  const prepared = await prepareDeliveryWithWorktree(input.scope, {
132
151
  contractId: state.id,
133
152
  coordinates: state.coordinates,
134
- recordedIntegrations: recordedIntegrationSnapshots(journal),
153
+ recordedIntegrations: deliveryIntegrationSnapshots(journal),
135
154
  }, deliveryPreparationInput(input, derivation), captured);
136
155
  if (prepared.kind === "refused") {
137
156
  return { kind: "refused", document: derivation.document, refusal: prepared.refusal };
@@ -153,16 +172,6 @@ function worktreeInput(repository, state, tender) {
153
172
  changeId,
154
173
  }));
155
174
  }
156
- function hasSupersedingVerification(state, journal) {
157
- if (state.delivery === null)
158
- return false;
159
- const current = currentVerifiedAttestation(state);
160
- if (current === undefined)
161
- return false;
162
- const deliveryIndex = journal.findIndex((entry) => entry.entry === state.delivery?.entry);
163
- const verificationIndex = journal.findIndex((entry) => entry.entry === current.entry);
164
- return deliveryIndex >= 0 && verificationIndex > deliveryIndex;
165
- }
166
175
  /**
167
176
  * Repeatable physical delivery work outside the publication seat: locate the appointed worktree from
168
177
  * one non-authoritative private-state read, capture its bytes, and materialize the prepared artifacts.
@@ -180,18 +189,9 @@ async function prepareDeliveryArtifacts(input, observation, state) {
180
189
  if (captured.kind === "refused")
181
190
  return { kind: "refused", refusal: captured.refusal };
182
191
  const worktree = await worktreeInput(input.scope, state, captured.data);
183
- if (reusesCurrentCandidate(input, state, derivation, worktree.changeId)) {
192
+ if (reusesCurrentCandidate(input, state, worktree.changeId)) {
184
193
  return { kind: "reuse", worktree };
185
194
  }
186
- if (state.terminal === null &&
187
- state.delivery !== null &&
188
- worktree.changeId === state.delivery.data.integration.changeId &&
189
- !hasSupersedingVerification(state, observation.journals.get(state.id)?.entries ?? [])) {
190
- return {
191
- kind: "continuation",
192
- worktree,
193
- };
194
- }
195
195
  const prepared = await mechanicalDeliveryPreparation(input, state, derivation, observation.journals.get(state.id)?.entries ?? [], captured.data);
196
196
  return prepared.kind === "prepared"
197
197
  ? {
@@ -241,22 +241,10 @@ async function assembleDeliveryAttempt(input, observation, external) {
241
241
  return { kind: "stale" };
242
242
  }
243
243
  if (artifacts.kind === "reuse") {
244
- return reusesCurrentCandidate(input, state, derivation, artifacts.worktree.changeId)
244
+ return reusesCurrentCandidate(input, state, artifacts.worktree.changeId)
245
245
  ? { kind: "assembled", state, derivation, reuse: true }
246
246
  : { kind: "stale" };
247
247
  }
248
- if (artifacts.kind === "continuation") {
249
- const delivery = state.delivery;
250
- if (delivery === null)
251
- return { kind: "stale" };
252
- return {
253
- kind: "assembled",
254
- state,
255
- derivation,
256
- preparation: { kind: "prepared", document: derivation.document, data: delivery.data },
257
- continuation: true,
258
- };
259
- }
260
248
  return {
261
249
  kind: "assembled",
262
250
  state,
@@ -274,7 +262,7 @@ async function completeDeferredDelivery(input, state, derivation, journal) {
274
262
  if (input.materializeConflict !== true || state.terminal !== null)
275
263
  return { kind: "assembled", state, derivation };
276
264
  const worktree = await recaptureDeliveryWorktree(input, state);
277
- if (worktree !== undefined && reusesCurrentCandidate(input, state, derivation, worktree.changeId)) {
265
+ if (worktree !== undefined && reusesCurrentCandidate(input, state, worktree.changeId)) {
278
266
  return { kind: "assembled", state, derivation, reuse: true };
279
267
  }
280
268
  const materialization = await materializationMergeStateRefusal(input);
@@ -299,13 +287,10 @@ async function completeDeferredDelivery(input, state, derivation, journal) {
299
287
  : prepared,
300
288
  };
301
289
  }
302
- function reusesCurrentCandidate(input, state, derivation, changeId) {
290
+ function reusesCurrentCandidate(input, state, changeId) {
303
291
  return (input.overwrite !== true &&
304
292
  state.terminal === null &&
305
293
  state.delivery !== null &&
306
- derivation.verification.kind === "prepared" &&
307
- derivation.verification.data !== null &&
308
- currentVerifiedAttestation(state) === undefined &&
309
294
  state.delivery.data.integration.changeId === changeId);
310
295
  }
311
296
  /** Accept a delivery whose current candidate is already admitted, without admitting it again. */
@@ -313,6 +298,9 @@ function currentCandidateDeliveryDecision(input, observation, assembled) {
313
298
  const state = assembled.state;
314
299
  if (state === null || assembled.derivation === undefined || assembled.reuse !== true)
315
300
  return undefined;
301
+ if (!documentIsCurrent(state, assembled.derivation.document)) {
302
+ return { kind: "refused", refusal: { kind: "document-moved", contractId: state.id } };
303
+ }
316
304
  const record = observation.journals.get(input.contractId);
317
305
  const delivery = record?.entries.findLast((entry) => entry.kind === "deliver");
318
306
  if (record === undefined || delivery === undefined)
@@ -329,34 +317,28 @@ function currentCandidateDeliveryDecision(input, observation, assembled) {
329
317
  },
330
318
  };
331
319
  }
332
- /** Continue the admitted integration this worktree already carries, without a new offer. */
333
- function continuationDeliveryDecision(input, observation, assembled) {
334
- const record = observation.journals.get(input.contractId);
335
- const state = record?.state ?? null;
336
- if (record === undefined || state === null || state.delivery === null || assembled.derivation === undefined) {
337
- return { kind: "redecide" };
338
- }
339
- const delivery = record.entries.findLast((entry) => entry.kind === "deliver");
340
- if (delivery === undefined)
341
- throw new Error("current delivery is missing its journal fact");
342
- input.progress?.recordAdmission({ kind: "accepted", facts: [], state, journal: record.entries });
343
- return {
344
- kind: "accepted",
345
- facts: [],
346
- state,
347
- journal: record.entries,
348
- value: {
349
- ...state.delivery.data,
350
- leading: { kind: "already-admitted", fact: delivery.entry },
351
- },
352
- };
320
+ async function validateDeliveryTarget(input, observation, assembled) {
321
+ const target = assembled.state?.coordinates.target;
322
+ const targetRefusal = targetContractRefusal(observation.decision, input.contractId, target);
323
+ if (targetRefusal !== undefined)
324
+ return { kind: "refused", refusal: targetRefusal };
325
+ if (target === undefined || typeof target === "string")
326
+ return undefined;
327
+ const resolved = await resolveContractTarget(input.scope, target.contractId, target);
328
+ if (resolved.kind === "refused")
329
+ return resolved;
330
+ if (assembled.preparation?.kind === "prepared" &&
331
+ resolved.head !== assembled.preparation.data.integration.predecessor)
332
+ return STALE_PRIVATE_STATE_PREPARATION;
333
+ return undefined;
353
334
  }
354
335
  async function decideAndAdmitDelivery(input, attempt, seat, observation, assembled) {
336
+ const targetCheck = await validateDeliveryTarget(input, observation, assembled);
337
+ if (targetCheck !== undefined)
338
+ return targetCheck;
355
339
  const current = currentCandidateDeliveryDecision(input, observation, assembled);
356
340
  if (current !== undefined)
357
341
  return current;
358
- if (assembled.continuation === true)
359
- return continuationDeliveryDecision(input, observation, assembled);
360
342
  const preparation = assembled.preparation ?? STALE_PRIVATE_STATE_PREPARATION;
361
343
  if (preparation.kind === "stale")
362
344
  return preparation;
@@ -398,7 +380,7 @@ async function decideAndAdmitDelivery(input, attempt, seat, observation, assembl
398
380
  kind: "candidate-content-changed",
399
381
  ...(assembled.state?.coordinates.target === undefined
400
382
  ? {}
401
- : { target: assembled.state.coordinates.target }),
383
+ : { target: targetName(assembled.state.coordinates.target) }),
402
384
  previousChange,
403
385
  currentChange,
404
386
  },
@@ -534,11 +516,19 @@ async function finishDeliverRefusal(input, refusal) {
534
516
  return await materializeDeliverConflict(input, refusal);
535
517
  }
536
518
  export async function admitDeliveryOperation(input) {
537
- const result = await runBoundedAttempts(mintAttempts({ entryCount: 1 }), (attempt) => deliverAttempt(input, attempt));
538
- if (result.kind === "refused")
539
- return await finishDeliverRefusal(input, result.refusal);
540
- if (result.kind !== "accepted")
541
- return { kind: "retry", reason: result };
542
- input.progress?.recordResidue(input.contractId, result);
543
- return result;
519
+ const incoming = input.materializeConflict
520
+ ? await acquireTargetPlacementFence(input.scope, input.contractId)
521
+ : undefined;
522
+ try {
523
+ const result = await runBoundedAttempts(mintAttempts({ entryCount: 1 }), (attempt) => deliverAttempt(input, attempt));
524
+ if (result.kind === "refused")
525
+ return await finishDeliverRefusal(input, result.refusal);
526
+ if (result.kind !== "accepted")
527
+ return { kind: "retry", reason: result };
528
+ input.progress?.recordResidue(input.contractId, result);
529
+ return result;
530
+ }
531
+ finally {
532
+ incoming?.close();
533
+ }
544
534
  }
@@ -5,6 +5,18 @@ export declare const deliveryPreviewReportSchema: z.ZodObject<{
5
5
  candidate: z.ZodUnion<readonly [z.ZodObject<{
6
6
  kind: z.ZodLiteral<"blocked">;
7
7
  refusal: z.ZodUnion<readonly [z.ZodObject<{
8
+ kind: z.ZodLiteral<"target-workspace-unavailable">;
9
+ contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
10
+ reason: z.ZodEnum<{
11
+ missing: "missing";
12
+ replaced: "replaced";
13
+ unappointed: "unappointed";
14
+ association: "association";
15
+ attached: "attached";
16
+ uncommitted: "uncommitted";
17
+ operation: "operation";
18
+ }>;
19
+ }, z.core.$strict>, z.ZodObject<{
8
20
  kind: z.ZodLiteral<"target-missing">;
9
21
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
10
22
  }, z.core.$strict>, z.ZodObject<{
@@ -30,23 +42,23 @@ export declare const deliveryPreviewReportSchema: z.ZodObject<{
30
42
  kind: z.ZodLiteral<"integration-failed">;
31
43
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
32
44
  reason: z.ZodEnum<{
45
+ conflict: "conflict";
33
46
  "not-based-on-target": "not-based-on-target";
34
47
  "unrelated-histories": "unrelated-histories";
35
- conflict: "conflict";
36
48
  }>;
37
49
  targetHead: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
38
50
  conflictPaths: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
39
51
  }, z.core.$strict>, z.ZodTransform<{
40
52
  kind: "integration-failed";
41
53
  contractId: import("../core/facts/types.js").ContractId;
42
- reason: "not-based-on-target" | "unrelated-histories" | "conflict";
54
+ reason: "conflict" | "not-based-on-target" | "unrelated-histories";
43
55
  targetHead: import("../core/facts/types.js").SnapshotId;
44
56
  } & {
45
57
  conflictPaths?: readonly string[];
46
58
  }, {
47
59
  kind: "integration-failed";
48
60
  contractId: import("../core/facts/types.js").ContractId;
49
- reason: "not-based-on-target" | "unrelated-histories" | "conflict";
61
+ reason: "conflict" | "not-based-on-target" | "unrelated-histories";
50
62
  targetHead: import("../core/facts/types.js").SnapshotId;
51
63
  conflictPaths?: readonly string[] | undefined;
52
64
  }>>, z.ZodObject<{
@@ -97,6 +109,33 @@ export declare const deliveryPreviewReportSchema: z.ZodObject<{
97
109
  requirements: z.ZodObject<{
98
110
  gates: z.ZodReadonly<z.ZodArray<z.ZodObject<{
99
111
  gate: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>;
112
+ requirements: z.ZodReadonly<z.ZodArray<z.ZodObject<{
113
+ requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
114
+ current: z.ZodUnion<readonly [z.ZodObject<{
115
+ kind: z.ZodLiteral<"missing">;
116
+ }, z.core.$strict>, z.ZodObject<{
117
+ kind: z.ZodLiteral<"attested">;
118
+ verdict: z.ZodEnum<{
119
+ satisfied: "satisfied";
120
+ unsatisfied: "unsatisfied";
121
+ }>;
122
+ at: z.ZodString;
123
+ summary: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strict>, z.ZodObject<{
125
+ kind: z.ZodLiteral<"stale">;
126
+ priorVerdict: z.ZodEnum<{
127
+ satisfied: "satisfied";
128
+ unsatisfied: "unsatisfied";
129
+ }>;
130
+ reason: z.ZodOptional<z.ZodObject<{
131
+ kind: z.ZodLiteral<"candidate-content-changed">;
132
+ target: z.ZodOptional<z.ZodString>;
133
+ previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
134
+ currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
135
+ }, z.core.$strict>>;
136
+ }, z.core.$strict>]>;
137
+ }, z.core.$strict>>>;
138
+ satisfied: z.ZodBoolean;
100
139
  current: z.ZodUnion<readonly [z.ZodObject<{
101
140
  kind: z.ZodLiteral<"missing">;
102
141
  }, z.core.$strict>, z.ZodObject<{
@@ -124,9 +163,9 @@ export declare const deliveryPreviewReportSchema: z.ZodObject<{
124
163
  unmetPrerequisites: z.ZodReadonly<z.ZodArray<z.ZodObject<{
125
164
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
126
165
  state: z.ZodEnum<{
166
+ active: "active";
127
167
  abandoned: "abandoned";
128
168
  missing: "missing";
129
- active: "active";
130
169
  }>;
131
170
  }, z.core.$strict>>>;
132
171
  }, z.core.$strict>;
@@ -136,15 +175,34 @@ export declare const deliveryPreviewReportSchema: z.ZodObject<{
136
175
  }, z.core.$strict>, z.ZodObject<{
137
176
  kind: z.ZodLiteral<"undeclared">;
138
177
  }, z.core.$strict>, z.ZodObject<{
139
- kind: z.ZodLiteral<"required">;
140
- }, z.core.$strict>, z.ZodObject<{
141
- entry: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
142
- verdict: z.ZodEnum<{
143
- satisfied: "satisfied";
144
- unsatisfied: "unsatisfied";
145
- }>;
146
- summary: z.ZodOptional<z.ZodString>;
147
- kind: z.ZodLiteral<"recorded">;
178
+ kind: z.ZodLiteral<"requirements">;
179
+ requirements: z.ZodReadonly<z.ZodArray<z.ZodObject<{
180
+ requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
181
+ current: z.ZodUnion<readonly [z.ZodObject<{
182
+ kind: z.ZodLiteral<"missing">;
183
+ }, z.core.$strict>, z.ZodObject<{
184
+ kind: z.ZodLiteral<"attested">;
185
+ verdict: z.ZodEnum<{
186
+ satisfied: "satisfied";
187
+ unsatisfied: "unsatisfied";
188
+ }>;
189
+ at: z.ZodString;
190
+ summary: z.ZodOptional<z.ZodString>;
191
+ }, z.core.$strict>, z.ZodObject<{
192
+ kind: z.ZodLiteral<"stale">;
193
+ priorVerdict: z.ZodEnum<{
194
+ satisfied: "satisfied";
195
+ unsatisfied: "unsatisfied";
196
+ }>;
197
+ reason: z.ZodOptional<z.ZodObject<{
198
+ kind: z.ZodLiteral<"candidate-content-changed">;
199
+ target: z.ZodOptional<z.ZodString>;
200
+ previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
201
+ currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
202
+ }, z.core.$strict>>;
203
+ }, z.core.$strict>]>;
204
+ index: z.ZodOptional<z.ZodNumber>;
205
+ }, z.core.$strict>>>;
148
206
  }, z.core.$strict>]>;
149
207
  target: z.ZodUnion<readonly [z.ZodObject<{
150
208
  kind: z.ZodLiteral<"not-observed">;
@@ -167,14 +225,26 @@ export declare const deliveryPreviewReportSchema: z.ZodObject<{
167
225
  observed: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>>;
168
226
  }, z.core.$strict>, z.ZodObject<{
169
227
  kind: z.ZodLiteral<"refused">;
170
- refusal: z.ZodObject<{
228
+ refusal: z.ZodUnion<readonly [z.ZodObject<{
171
229
  kind: z.ZodLiteral<"checkout-not-followable">;
172
230
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
173
231
  target: z.ZodString;
174
232
  path: z.ZodString;
175
233
  reason: z.ZodLiteral<"untracked">;
176
234
  paths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
177
- }, z.core.$strict>;
235
+ }, z.core.$strict>, z.ZodObject<{
236
+ kind: z.ZodLiteral<"target-workspace-unavailable">;
237
+ contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ContractId, string>>;
238
+ reason: z.ZodEnum<{
239
+ missing: "missing";
240
+ replaced: "replaced";
241
+ unappointed: "unappointed";
242
+ association: "association";
243
+ attached: "attached";
244
+ uncommitted: "uncommitted";
245
+ operation: "operation";
246
+ }>;
247
+ }, z.core.$strict>]>;
178
248
  }, z.core.$strict>, z.ZodObject<{
179
249
  kind: z.ZodLiteral<"failed">;
180
250
  diagnostic: z.ZodString;
@@ -201,19 +271,6 @@ export declare const deliveryPreviewReportSchema: z.ZodObject<{
201
271
  identical: "identical";
202
272
  differs: "differs";
203
273
  }>;
204
- verification: z.ZodUnion<readonly [z.ZodObject<{
205
- kind: z.ZodEnum<{
206
- undeclared: "undeclared";
207
- unrecorded: "unrecorded";
208
- }>;
209
- }, z.core.$strict>, z.ZodObject<{
210
- kind: z.ZodLiteral<"recorded">;
211
- verdict: z.ZodEnum<{
212
- satisfied: "satisfied";
213
- unsatisfied: "unsatisfied";
214
- }>;
215
- fact: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
216
- }, z.core.$strict>]>;
217
274
  }, z.core.$strict>>;
218
275
  }, z.core.$strict>;
219
276
  export type DeliveryPreviewReport = z.infer<typeof deliveryPreviewReportSchema>;
@@ -1,16 +1,16 @@
1
1
  import { z } from "zod";
2
- import { deliverDataSchema, deliveryPreparationRefusalSchema, changeIdSchema, verdictSchema, entryUlidSchema, contractIdSchema, gateReportSchema, recordedIntegrationSnapshots, } from "./operations.js";
2
+ import { deliverDataSchema, deliveryPreparationRefusalSchema, changeIdSchema, contractIdSchema, gateReportSchema, requirementReportSchema, } from "./operations.js";
3
3
  import { previewTargetAnswerSchema, adjudicatePreviewTarget } from "../git/target-placement.js";
4
- import { verificationReuseSchema, currentVerifiedAttestation } from "./intent.js";
4
+ import { verificationRequirement } from "../verification/declaration.js";
5
5
  import { deliveryDiffScopeSchema, readDeliveryDiff, readDeliveryScope } from "../git/integration.js";
6
6
  import { observeGitForAdmissionAt } from "../git/observe.js";
7
- import { activeContract, documentIsCurrent } from "../core/facts/observation.js";
7
+ import { activeContract, documentIsCurrent, targetContractRefusal } from "../core/facts/observation.js";
8
8
  import { gateReports } from "../core/facts/gate.js";
9
9
  import { unmetPrerequisites } from "../core/verbs/placement.js";
10
10
  import { observeTargetLag, contractTargetLagSchema, worktreeWorkspaceSchema } from "../git/workspace.js";
11
11
  import { readManagedWorktreeAppointment } from "../workspace-place.js";
12
12
  import { accepted } from "./outcome.js";
13
- import { prepareDelivery } from "./deliver.js";
13
+ import { deliveryIntegrationSnapshots, prepareDelivery } from "./deliver.js";
14
14
  export const deliveryPreviewReportSchema = z
15
15
  .object({
16
16
  candidate: z.union([
@@ -41,8 +41,18 @@ export const deliveryPreviewReportSchema = z
41
41
  verification: z.union([
42
42
  z.object({ kind: z.literal("not-run") }).strict(),
43
43
  z.object({ kind: z.literal("undeclared") }).strict(),
44
- z.object({ kind: z.literal("required") }).strict(),
45
- verificationReuseSchema.extend({ kind: z.literal("recorded") }).strict(),
44
+ z
45
+ .object({
46
+ kind: z.literal("requirements"),
47
+ requirements: z
48
+ .array(requirementReportSchema
49
+ .extend({
50
+ index: z.number().int().positive().optional(),
51
+ })
52
+ .strict())
53
+ .readonly(),
54
+ })
55
+ .strict(),
46
56
  ]),
47
57
  target: z.union([z.object({ kind: z.literal("not-observed") }).strict(), previewTargetAnswerSchema]),
48
58
  targetLag: contractTargetLagSchema.optional(),
@@ -50,35 +60,33 @@ export const deliveryPreviewReportSchema = z
50
60
  .object({
51
61
  changeId: changeIdSchema,
52
62
  relation: z.enum(["identical", "differs"]),
53
- verification: z.union([
54
- z.object({ kind: z.enum(["undeclared", "unrecorded"]) }).strict(),
55
- z.object({ kind: z.literal("recorded"), verdict: verdictSchema, fact: entryUlidSchema }).strict(),
56
- ]),
57
63
  })
58
64
  .strict()
59
65
  .optional(),
60
66
  })
61
67
  .strict();
62
- function deliveryRelation(state, candidate, declaration) {
68
+ function deliveryRelation(state, candidate) {
63
69
  const recorded = state.delivery?.data.integration.changeId;
64
70
  if (recorded === undefined)
65
71
  return undefined;
66
- const verification = declaration === null ? undefined : currentVerifiedAttestation(state);
67
72
  return {
68
73
  changeId: recorded,
69
74
  relation: recorded === candidate.integration.changeId ? "identical" : "differs",
70
- verification: declaration === null
71
- ? { kind: "undeclared" }
72
- : verification === undefined
73
- ? { kind: "unrecorded" }
74
- : { kind: "recorded", verdict: verification.verdict, fact: verification.entry },
75
75
  };
76
76
  }
77
77
  function verificationAnswer(prospective, declaration) {
78
- if (declaration === null)
78
+ if (declaration == null)
79
+ return { kind: "undeclared" };
80
+ const verified = gateReports(prospective).reports.find((report) => report.gate === "verified");
81
+ if (verified === undefined)
79
82
  return { kind: "undeclared" };
80
- const evidence = currentVerifiedAttestation(prospective);
81
- return evidence === undefined ? { kind: "required" } : { kind: "recorded", ...evidence };
83
+ return {
84
+ kind: "requirements",
85
+ requirements: verified.requirements.map((report) => {
86
+ const index = declaration.declarations.findIndex((item) => verificationRequirement(item) === report.requirement);
87
+ return { ...report, ...(index < 0 ? {} : { index: index + 1 }) };
88
+ }),
89
+ };
82
90
  }
83
91
  async function readyCandidate(repository, candidate, workspace, requirements, showDiff) {
84
92
  const { predecessor, snapshot } = candidate.integration;
@@ -111,12 +119,16 @@ function blockedPreview(refusal) {
111
119
  target: { kind: "not-observed" },
112
120
  };
113
121
  }
122
+ // eslint-disable-next-line complexity -- Preview retains its distinct lifecycle and physical observations.
114
123
  export async function previewDeliveryOperation(input) {
115
124
  input.signal?.throwIfAborted();
116
125
  const observed = await observeGitForAdmissionAt(input.scope, input.channel, [input.contractId]);
117
126
  const state = activeContract(observed.decision, input.contractId);
118
127
  if ("kind" in state)
119
128
  return { kind: "refused", refusal: state };
129
+ const targetRefusal = targetContractRefusal(observed.decision, state.id, state.coordinates.target);
130
+ if (targetRefusal !== undefined)
131
+ return { kind: "refused", refusal: targetRefusal };
120
132
  const derivation = input.deriveDocument(state);
121
133
  if (!documentIsCurrent(state, derivation.document)) {
122
134
  return { kind: "refused", refusal: { kind: "document-moved", contractId: input.contractId } };
@@ -132,7 +144,7 @@ export async function previewDeliveryOperation(input) {
132
144
  const prepared = await prepareDelivery(input.scope, {
133
145
  contractId: state.id,
134
146
  coordinates: state.coordinates,
135
- recordedIntegrations: recordedIntegrationSnapshots(observed.journals.get(state.id)?.entries ?? []),
147
+ recordedIntegrations: deliveryIntegrationSnapshots(observed.journals.get(state.id)?.entries ?? []),
136
148
  appointment,
137
149
  }, {
138
150
  title: derivation.title,
@@ -151,7 +163,7 @@ export async function previewDeliveryOperation(input) {
151
163
  }, input.showDiff === true);
152
164
  input.progress?.recordDeliveryPreview(state.id, { candidate });
153
165
  const verification = verificationAnswer(prospective, derivation.verification.data);
154
- const delivery = deliveryRelation(state, prepared.data, derivation.verification.data);
166
+ const delivery = deliveryRelation(state, prepared.data);
155
167
  input.progress?.recordDeliveryPreview(state.id, { verification, ...(delivery === undefined ? {} : { delivery }) });
156
168
  const target = await targetAnswer(input.scope, state, prepared.data);
157
169
  input.progress?.recordDeliveryPreview(state.id, { target });
@@ -27,6 +27,7 @@ export declare const observationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
27
27
  }>;
28
28
  segments: readonly import("../core/facts/types.js").DocumentSegmentKey[];
29
29
  gates: readonly import("../core/facts/types.js").Gate[];
30
+ requirements: Readonly<Record<string, readonly import("../core/facts/types.js").RequirementId[]>>;
30
31
  after: readonly import("../index.js").ContractId[];
31
32
  }>;
32
33
  }> | Readonly<{
@@ -69,6 +70,7 @@ export declare const observationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
69
70
  actor?: import("../index.js").ActorId;
70
71
  data: Readonly<{
71
72
  gate: import("../core/facts/types.js").Gate;
73
+ requirement: import("../core/facts/types.js").RequirementId;
72
74
  subject: import("../core/facts/types.js").DependencyKeySet;
73
75
  verdict: "satisfied" | "unsatisfied";
74
76
  summary?: string;
@@ -118,16 +120,18 @@ export declare const observationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
118
120
  outcome: z.ZodOptional<z.ZodString>;
119
121
  elapsedMs: z.ZodOptional<z.ZodNumber>;
120
122
  phase: z.ZodEnum<{
121
- cleanup: "cleanup";
122
123
  materialize: "materialize";
124
+ cleanup: "cleanup";
123
125
  setup: "setup";
124
126
  declaration: "declaration";
125
127
  }>;
126
128
  cwd: z.ZodOptional<z.ZodString>;
127
129
  name: z.ZodOptional<z.ZodString>;
128
130
  command: z.ZodOptional<z.ZodString>;
129
- index: z.ZodOptional<z.ZodNumber>;
130
- total: z.ZodOptional<z.ZodNumber>;
131
+ requirement: z.ZodString;
132
+ snapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
133
+ index: z.ZodNumber;
134
+ total: z.ZodNumber;
131
135
  kind: z.ZodLiteral<"phase">;
132
136
  }, z.core.$strict>, z.ZodObject<{
133
137
  stream: z.ZodEnum<{
@@ -136,16 +140,18 @@ export declare const observationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
136
140
  }>;
137
141
  text: z.ZodString;
138
142
  phase: z.ZodEnum<{
139
- cleanup: "cleanup";
140
143
  materialize: "materialize";
144
+ cleanup: "cleanup";
141
145
  setup: "setup";
142
146
  declaration: "declaration";
143
147
  }>;
144
148
  cwd: z.ZodOptional<z.ZodString>;
145
149
  name: z.ZodOptional<z.ZodString>;
146
150
  command: z.ZodOptional<z.ZodString>;
147
- index: z.ZodOptional<z.ZodNumber>;
148
- total: z.ZodOptional<z.ZodNumber>;
151
+ requirement: z.ZodString;
152
+ snapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
153
+ index: z.ZodNumber;
154
+ total: z.ZodNumber;
149
155
  kind: z.ZodLiteral<"output">;
150
156
  }, z.core.$strict>], "kind">;
151
157
  }, z.core.$strict>, z.ZodObject<{
@@ -160,9 +166,6 @@ export declare const observationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
160
166
  started: "started";
161
167
  finished: "finished";
162
168
  }>;
163
- }, z.core.$strict>, z.ZodObject<{
164
- kind: z.ZodLiteral<"progress-dropped">;
165
- count: z.ZodNumber;
166
169
  }, z.core.$strict>], "kind">;
167
170
  export type ExecutionObservation = z.infer<typeof observationSchema>;
168
171
  export type ExecutionObserver = (event: ExecutionObservation) => void | PromiseLike<void>;
@@ -26,7 +26,6 @@ export const observationSchema = z.discriminatedUnion("kind", [
26
26
  state: z.enum(["started", "finished"]),
27
27
  })
28
28
  .strict(),
29
- z.object({ kind: z.literal("progress-dropped"), count: z.number().int().positive() }).strict(),
30
29
  ]);
31
30
  /** Observation failure cannot change execution, admission, or process custody. */
32
31
  export function observeExecution(observer, event) {