@astrosheep/keiyaku 4.6.3 → 4.6.6

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 (193) hide show
  1. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +47 -11
  2. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/references/automation.md +2 -2
  3. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-babysit/SKILL.md +1 -1
  4. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +8 -9
  5. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +37 -25
  6. package/build/src/akuma/akuma-observe.d.ts +18 -15
  7. package/build/src/akuma/akuma-observe.js +75 -16
  8. package/build/src/akuma/akuma-wait.d.ts +4 -3
  9. package/build/src/akuma/akuma-wait.js +75 -53
  10. package/build/src/akuma/akuma.d.ts +6 -4
  11. package/build/src/akuma/akuma.js +4 -0
  12. package/build/src/akuma/call-initial-tell.d.ts +2 -2
  13. package/build/src/akuma/call-initial-tell.js +1 -1
  14. package/build/src/akuma/call-request.d.ts +2 -2
  15. package/build/src/akuma/heart/index.d.ts +7 -2
  16. package/build/src/akuma/heart/index.js +50 -5
  17. package/build/src/akuma/heart/tells.d.ts +33 -2
  18. package/build/src/akuma/heart/tells.js +24 -18
  19. package/build/src/akuma/heart/timeline.d.ts +23 -1
  20. package/build/src/akuma/heart/timeline.js +28 -21
  21. package/build/src/akuma/projection.d.ts +10 -10
  22. package/build/src/akuma/providers/pi/index.js +72 -39
  23. package/build/src/akuma/selection-observation.d.ts +20 -20
  24. package/build/src/akuma-body.js +1 -0
  25. package/build/src/alias/index.d.ts +0 -1
  26. package/build/src/alias/index.js +0 -4
  27. package/build/src/body/amend.d.ts +0 -4
  28. package/build/src/body/amend.js +0 -3
  29. package/build/src/body/region.d.ts +0 -1
  30. package/build/src/body/region.js +0 -3
  31. package/build/src/body/verification.d.ts +0 -1
  32. package/build/src/cli/commands/akuma-grammar.js +23 -66
  33. package/build/src/cli/commands/akuma.js +17 -30
  34. package/build/src/cli/commands/contract-grammar.d.ts +14 -1
  35. package/build/src/cli/commands/contract-grammar.js +54 -21
  36. package/build/src/cli/commands/contract-help.d.ts +9 -8
  37. package/build/src/cli/commands/contract-help.js +14 -7
  38. package/build/src/cli/commands/contract.js +57 -117
  39. package/build/src/cli/commands/install.d.ts +5 -5
  40. package/build/src/cli/commands/install.js +1 -4
  41. package/build/src/cli/commands/task-grammar.js +10 -66
  42. package/build/src/cli/commands/task.d.ts +0 -1
  43. package/build/src/cli/commands/task.js +34 -53
  44. package/build/src/cli/coordinates.d.ts +1 -2
  45. package/build/src/cli/coordinates.js +1 -4
  46. package/build/src/cli/parse.d.ts +2 -3
  47. package/build/src/cli/parse.js +24 -66
  48. package/build/src/cli/render/akuma.d.ts +3 -16
  49. package/build/src/cli/render/akuma.js +1 -13
  50. package/build/src/cli/render/audit.js +1 -1
  51. package/build/src/cli/render/contract.js +34 -32
  52. package/build/src/cli/render/kanshi-akuma.d.ts +8 -2
  53. package/build/src/cli/render/kanshi-akuma.js +14 -7
  54. package/build/src/cli/render/kanshi.d.ts +3 -1
  55. package/build/src/cli/render/kanshi.js +44 -32
  56. package/build/src/cli/render/receipt.js +6 -1
  57. package/build/src/cli/render/task.d.ts +1 -1
  58. package/build/src/cli/render/task.js +3 -27
  59. package/build/src/cli/render/terminal.d.ts +6 -2
  60. package/build/src/cli/render/terminal.js +8 -2
  61. package/build/src/cli/runtime.js +3 -16
  62. package/build/src/cli/scan.d.ts +26 -0
  63. package/build/src/cli/scan.js +82 -0
  64. package/build/src/cli/streams.d.ts +5 -0
  65. package/build/src/cli/streams.js +11 -0
  66. package/build/src/contract-worktree.js +38 -21
  67. package/build/src/core/facts/codec.d.ts +1 -2
  68. package/build/src/core/facts/codec.js +5 -11
  69. package/build/src/core/facts/types.d.ts +16 -2
  70. package/build/src/core/facts/types.js +15 -0
  71. package/build/src/core/verbs/abandon.js +3 -9
  72. package/build/src/core/verbs/amend.js +2 -9
  73. package/build/src/core/verbs/arc.js +6 -13
  74. package/build/src/core/verbs/attestation.js +2 -9
  75. package/build/src/core/verbs/bind.js +2 -9
  76. package/build/src/core/verbs/deliver.js +2 -9
  77. package/build/src/core/verbs/placement.d.ts +1 -1
  78. package/build/src/core/verbs/placement.js +2 -9
  79. package/build/src/core/verbs/reintegrate.d.ts +1 -1
  80. package/build/src/core/verbs/reintegrate.js +2 -9
  81. package/build/src/dispatch/index.d.ts +2 -2
  82. package/build/src/dispatch/index.js +33 -11
  83. package/build/src/git/hooks.d.ts +2 -4
  84. package/build/src/git/hooks.js +0 -12
  85. package/build/src/git/integration.d.ts +5 -3
  86. package/build/src/git/integration.js +36 -25
  87. package/build/src/git/nuke.js +4 -4
  88. package/build/src/git/observe.d.ts +4 -4
  89. package/build/src/git/observe.js +5 -5
  90. package/build/src/git/process.d.ts +1 -4
  91. package/build/src/git/process.js +1 -11
  92. package/build/src/git/read-observation.js +1 -1
  93. package/build/src/git/reconcile.d.ts +1 -1
  94. package/build/src/git/reconcile.js +15 -13
  95. package/build/src/git/repository.d.ts +2 -6
  96. package/build/src/git/repository.js +18 -31
  97. package/build/src/git/scratch.d.ts +6 -6
  98. package/build/src/git/scratch.js +110 -46
  99. package/build/src/git/target-placement.d.ts +5 -5
  100. package/build/src/git/target-placement.js +18 -33
  101. package/build/src/git/tender.d.ts +6 -2
  102. package/build/src/git/tender.js +19 -12
  103. package/build/src/git/terminal-reconcile.js +24 -13
  104. package/build/src/git/terminal-seal.d.ts +2 -5
  105. package/build/src/git/terminal-seal.js +5 -3
  106. package/build/src/git/workspace.d.ts +17 -13
  107. package/build/src/git/workspace.js +58 -41
  108. package/build/src/kanshi/index.d.ts +2 -2
  109. package/build/src/kanshi/index.js +1 -1
  110. package/build/src/kanshi/read.d.ts +8 -1
  111. package/build/src/kanshi/read.js +72 -7
  112. package/build/src/kanshi/report.d.ts +12 -0
  113. package/build/src/library/akuma-creation.d.ts +4 -4
  114. package/build/src/library/bind.d.ts +1 -63
  115. package/build/src/library/bind.js +3 -9
  116. package/build/src/library/contract-creation.js +2 -30
  117. package/build/src/library/contract-execution.d.ts +0 -1
  118. package/build/src/library/contract-execution.js +9 -34
  119. package/build/src/library/contract-operations.d.ts +5 -1
  120. package/build/src/library/contract-operations.js +7 -3
  121. package/build/src/library/contract-types.d.ts +1 -1
  122. package/build/src/library/delivery.d.ts +91 -93
  123. package/build/src/library/delivery.js +2 -1
  124. package/build/src/library/input.d.ts +0 -2
  125. package/build/src/library/input.js +0 -4
  126. package/build/src/library/invocation.d.ts +0 -1
  127. package/build/src/library/invocation.js +3 -25
  128. package/build/src/library/outcome.d.ts +651 -602
  129. package/build/src/library/outcome.js +4 -4
  130. package/build/src/library/reconcile.d.ts +6 -0
  131. package/build/src/library/reconcile.js +31 -1
  132. package/build/src/library/repo.d.ts +0 -1
  133. package/build/src/library/selection.d.ts +1 -10
  134. package/build/src/library/selection.js +14 -15
  135. package/build/src/protocol/abandon.d.ts +1 -1
  136. package/build/src/protocol/abandon.js +3 -10
  137. package/build/src/protocol/amend.js +2 -5
  138. package/build/src/protocol/arc.d.ts +1 -1
  139. package/build/src/protocol/arc.js +2 -9
  140. package/build/src/protocol/attempt.d.ts +3 -20
  141. package/build/src/protocol/attempt.js +6 -5
  142. package/build/src/protocol/audit.d.ts +1 -0
  143. package/build/src/protocol/audit.js +10 -11
  144. package/build/src/protocol/completion.d.ts +129 -55
  145. package/build/src/protocol/completion.js +62 -73
  146. package/build/src/protocol/deliver.d.ts +7 -5
  147. package/build/src/protocol/deliver.js +74 -44
  148. package/build/src/protocol/execution-observation.d.ts +2 -4
  149. package/build/src/protocol/execution-observation.js +3 -7
  150. package/build/src/protocol/intent.d.ts +1 -1
  151. package/build/src/protocol/intent.js +1 -0
  152. package/build/src/protocol/operations.d.ts +24 -12
  153. package/build/src/protocol/operations.js +36 -15
  154. package/build/src/protocol/placement.d.ts +2 -1
  155. package/build/src/protocol/placement.js +21 -5
  156. package/build/src/protocol/progress.d.ts +1 -1
  157. package/build/src/protocol/read/status.js +58 -41
  158. package/build/src/protocol/reintegrate.d.ts +1 -1
  159. package/build/src/protocol/reintegrate.js +10 -19
  160. package/build/src/protocol/review.d.ts +3 -28
  161. package/build/src/protocol/review.js +10 -37
  162. package/build/src/protocol/run.d.ts +19 -7
  163. package/build/src/protocol/run.js +19 -9
  164. package/build/src/runtime/proc/windows-launch.exe +0 -0
  165. package/build/src/settlement/holder.d.ts +2 -4
  166. package/build/src/settlement/holder.js +3 -6
  167. package/build/src/task/board.d.ts +6 -0
  168. package/build/src/task/board.js +30 -1
  169. package/build/src/task/catalog.js +1 -4
  170. package/build/src/task/compose.d.ts +0 -1
  171. package/build/src/task/compose.js +0 -1
  172. package/build/src/task/context.d.ts +0 -1
  173. package/build/src/task/context.js +0 -3
  174. package/build/src/task/created-observation.d.ts +5 -1
  175. package/build/src/task/created-observation.js +12 -5
  176. package/build/src/task/index.d.ts +1 -1
  177. package/build/src/task/index.js +7 -6
  178. package/build/src/task/input.d.ts +0 -6
  179. package/build/src/task/input.js +2 -14
  180. package/build/src/task/mutation.d.ts +3 -4
  181. package/build/src/task/mutation.js +11 -39
  182. package/build/src/task/operations.d.ts +2 -7
  183. package/build/src/task/operations.js +37 -49
  184. package/build/src/task/query.d.ts +0 -1
  185. package/build/src/task/query.js +1 -4
  186. package/build/src/task/store.d.ts +0 -2
  187. package/build/src/task/store.js +27 -11
  188. package/build/src/verification/declaration.js +3 -2
  189. package/build/src/verification/execution.d.ts +3 -2
  190. package/build/src/verification/execution.js +10 -6
  191. package/build/src/workspace-place.d.ts +0 -1
  192. package/build/src/workspace-place.js +0 -11
  193. package/package.json +7 -3
@@ -1,7 +1,7 @@
1
1
  /** @architectureCompositionRoot */
2
2
  import { z } from "zod";
3
3
  import { contractFileEffectSchema } from "../contract-worktree.js";
4
- import { decodeJournalEntry } from "../core/facts/codec.js";
4
+ import { validateEntry } from "../core/facts/codec.js";
5
5
  import { AuthorityCorruptionError } from "../core/facts/errors.js";
6
6
  import { contractHeadSchema } from "../git/identity.js";
7
7
  import { reconcileEffectSchema } from "../git/reconcile.js";
@@ -100,7 +100,7 @@ function phasePending(operation, value) {
100
100
  if (concluded === undefined)
101
101
  return [];
102
102
  const pending = [];
103
- if (concluded.verification !== undefined)
103
+ if (concluded.verification?.kind === "stopped")
104
104
  pending.push(surface("verification", true));
105
105
  if (concluded.placement !== undefined)
106
106
  pending.push(surface("placement", true));
@@ -306,7 +306,7 @@ const amendEvidenceSchema = z
306
306
  .strict()
307
307
  .refine((value) => value.overlaps === undefined || value.overlapFailure === undefined);
308
308
  const partialDeliverySchema = deliveryValueSchema.partial().superRefine((value, context) => {
309
- const fields = deliverDataSchema.keyof().options;
309
+ const fields = deliverDataSchema.omit({ note: true }).keyof().options;
310
310
  const present = fields.filter((field) => value[field] !== undefined);
311
311
  if (present.length !== 0 && present.length !== fields.length)
312
312
  context.addIssue({ code: "custom", message: "delivery identity must be complete when present" });
@@ -322,7 +322,7 @@ const partialValueSchemas = {
322
322
  };
323
323
  const journalEntrySchema = z.unknown().transform((value, context) => {
324
324
  try {
325
- return decodeJournalEntry(value);
325
+ return validateEntry(value);
326
326
  }
327
327
  catch {
328
328
  context.addIssue({ code: "custom", message: "invalid journal fact" });
@@ -8,6 +8,7 @@ import type { ReconcileResult } from "../git/reconcile.js";
8
8
  import { type RepositoryScope } from "../protocol/operations.js";
9
9
  import { type ProtocolProgress } from "../protocol/progress.js";
10
10
  import { type SettlementReport } from "../settlement/settle.js";
11
+ import type { InvocationAccumulator } from "./invocation.js";
11
12
  export type ReconcileReport = Readonly<{
12
13
  effects: readonly (ReconcileResult["effects"][number] | ContractFileEffect)[];
13
14
  lag: readonly (ReconcileResult["lag"][number] | ContractFileLag)[];
@@ -128,5 +129,10 @@ type ReconcileOptions = Readonly<{
128
129
  export declare function completeReconcile(input: ReconcileOptions & Readonly<{
129
130
  contractId: ContractId;
130
131
  }>): Promise<ReconcileCompletion>;
132
+ /**
133
+ * The one post-admission reconciliation walk: every affected Contract is observed afresh, and an
134
+ * operational stop is recorded rather than thrown.
135
+ */
136
+ export declare function reconcileAffectedContracts(accumulator: InvocationAccumulator, contractId: ContractId, scope: RepositoryScope, channel: GitDecodeChannel, hooks: WorktreeHooks): Promise<void>;
131
137
  export declare function completeRepoReconcile(input: ReconcileOptions): Promise<RepoReconcileReport>;
132
138
  export {};
@@ -4,7 +4,7 @@ import { contractFileLagSchema, projectContractWorktree, } from "../contract-wor
4
4
  import { gitReconcileLagSchema, reconcileObservationFailure } from "../git/reconcile.js";
5
5
  import { worktreePath } from "../git/workspace.js";
6
6
  import { stateOperation } from "../protocol/operations.js";
7
- import { isOperationalFailure } from "../protocol/progress.js";
7
+ import { isOperationalFailure, isOperationalStop, executionStop } from "../protocol/progress.js";
8
8
  import { reconcileAllOperation, reconcileOperation, worldContractStates } from "../protocol/reconcile.js";
9
9
  import { settle, settleAll } from "../settlement/settle.js";
10
10
  import { appointManagedWorktrees, placeRegisterPath, releaseManagedWorktrees, } from "../workspace-place.js";
@@ -205,6 +205,36 @@ export async function completeReconcile(input) {
205
205
  const terminal = await finishTerminalReconcile(input, retained, appointed);
206
206
  return assembleReconcile(retained.report, projection, settlement, terminal);
207
207
  }
208
+ /**
209
+ * The one post-admission reconciliation walk: every affected Contract is observed afresh, and an
210
+ * operational stop is recorded rather than thrown.
211
+ */
212
+ export async function reconcileAffectedContracts(accumulator, contractId, scope, channel, hooks) {
213
+ for (const contract of [...new Set([contractId, ...accumulator.snapshot().affected])]) {
214
+ try {
215
+ scope.signal?.throwIfAborted();
216
+ accumulator.observe({ kind: "stage", contractId: contract, stage: "reconciliation", state: "started" });
217
+ try {
218
+ await completeReconcile({
219
+ scope,
220
+ channel,
221
+ contractId: contract,
222
+ hooks,
223
+ retryHooks: false,
224
+ progress: accumulator,
225
+ });
226
+ }
227
+ finally {
228
+ accumulator.observe({ kind: "stage", contractId: contract, stage: "reconciliation", state: "finished" });
229
+ }
230
+ }
231
+ catch (error) {
232
+ if (!isOperationalStop(error, scope.signal))
233
+ throw error;
234
+ accumulator.recordStop(executionStop(contract, "reconciliation", error, scope.signal));
235
+ }
236
+ }
237
+ }
208
238
  function attachReleaseLag(contracts, released, lag) {
209
239
  const affected = new Set(released);
210
240
  return {
@@ -1,7 +1,6 @@
1
1
  import { type RepositoryScope } from "../protocol/operations.js";
2
2
  import { NoGitWorldError } from "../git/repository.js";
3
3
  export { NoGitWorldError };
4
- export type { RepoContractReconcileReport, RepoReconcileReport } from "./reconcile.js";
5
4
  export type RepoAtInput = Readonly<{
6
5
  path?: string;
7
6
  gitPath?: string;
@@ -56,10 +56,7 @@ export type AkumaAskInput<T = string> = AkumaAddressInput & Readonly<{
56
56
  signal?: AbortSignal;
57
57
  observe?: AskObserver;
58
58
  }>;
59
- export type { TellResult, TellWake } from "../akuma/body.js";
60
- export type { AkumaAskResult, AkumaKillResult, AkumaObservation, AkumaObservationStage, AkumaTellResult, AkumaUnobserved, AkumaWaitResult, } from "../akuma/selection-observation.js";
61
- export type { DispatchAssociation } from "../dispatch/association.js";
62
- export type { CreatedTaskObservation } from "../task/created-observation.js";
59
+ export type { AkumaAskResult, AkumaKillResult, AkumaObservation, AkumaObservationStage, AkumaTellResult, AkumaWaitResult, } from "../akuma/selection-observation.js";
63
60
  export type AkumaKillInput = AkumaSetAddressInput & Readonly<{
64
61
  signal?: AbortSignal;
65
62
  }>;
@@ -98,18 +95,12 @@ export type AkumaHistoryResult = Readonly<{
98
95
  export declare function statusAkuma(input: AkumaAddressInput & Readonly<{
99
96
  path: WorldRoot;
100
97
  }>): Promise<AkumaObservation>;
101
- export declare function waitAkuma(input: AkumaWaitInput & Readonly<{
102
- path: WorldRoot;
103
- }>, execution?: ExecutionContext): Promise<AkumaWaitResult>;
104
98
  export declare function waitAkumaOn(seam: SelectionSeam, input: AkumaWaitInput & Readonly<{
105
99
  path: WorldRoot;
106
100
  }>): Promise<AkumaWaitResult>;
107
101
  export declare function killAkumaOn(seam: SelectionSeam, input: AkumaKillInput & Readonly<{
108
102
  path: WorldRoot;
109
103
  }>): Promise<AkumaKillResult>;
110
- export declare function tellAkuma(input: AkumaTellInput & Readonly<{
111
- path: WorldRoot;
112
- }>, execution?: ExecutionContext): Promise<AkumaTellResult>;
113
104
  export declare function tellAkumaOn(seam: SelectionSeam, input: AkumaTellInput & Readonly<{
114
105
  path: WorldRoot;
115
106
  }>): Promise<AkumaTellResult>;
@@ -5,11 +5,11 @@ import { AkumaOwner } from "../akuma/akuma-owner.js";
5
5
  import { decodeAskObservation, executeAskAkuma, executeKillAkuma, executeTellAkuma, } from "../akuma/akuma-selection-execution.js";
6
6
  import { executeWaitAkuma, } from "../akuma/akuma-wait.js";
7
7
  import { parsePublicHistoryId } from "../akuma/identity.js";
8
- import { executionChannel, localExecutionContext } from "../akuma/requests.js";
8
+ import { executionChannel } from "../akuma/requests.js";
9
9
  import { schemaJsonText } from "../akuma/schema.js";
10
10
  import { requestForwardedSelectionAsk, requestForwardedSelectionKill, requestForwardedSelectionTell, requestForwardedSelectionWait, } from "../akuma/selection-request.js";
11
11
  import { readAliases } from "../alias/index.js";
12
- import { observeDispatchAssociation } from "../dispatch/index.js";
12
+ import { observeDispatchAssociations } from "../dispatch/index.js";
13
13
  import { observeContractAt } from "../git/observe.js";
14
14
  import { withGitDecodeChannel } from "../git/read-observation.js";
15
15
  import { observeCreatedTaskObservations } from "../task/created-observation.js";
@@ -99,8 +99,8 @@ function observationError(id, error) {
99
99
  return error;
100
100
  return new AkumaObservationError(id, observationDiagnostic(error));
101
101
  }
102
- async function dispatchAssociation(repo, id) {
103
- return await observeDispatchAssociation(repo === undefined ? undefined : scopeForRepo(repo), id);
102
+ async function dispatchAssociations(repo, ids) {
103
+ return await observeDispatchAssociations(repo === undefined ? undefined : scopeForRepo(repo), ids);
104
104
  }
105
105
  /**
106
106
  * Read-time placement discharge. Reported changes describe a candidate that a
@@ -141,9 +141,12 @@ async function createdTasksFor(path, statuses) {
141
141
  * One wait's identity-fact resolver: the alias bound to an Akuma in its world and
142
142
  * its Dispatch association. The alias index is read once, on the first observed
143
143
  * Akuma, and each Akuma's alias is the first binding the canonical order offers.
144
+ * Alias bindings and selected Dispatch associations are read once for this live
145
+ * stage. Final result composition owns a separate, fresh Dispatch observation.
144
146
  */
145
- function waitIdentityFacts(path, repo) {
147
+ function waitIdentityFacts(path, repo, selected) {
146
148
  let aliases;
149
+ let contracts;
147
150
  return async (id) => {
148
151
  if (aliases === undefined) {
149
152
  const bound = new Map();
@@ -153,8 +156,9 @@ function waitIdentityFacts(path, repo) {
153
156
  }
154
157
  aliases = bound;
155
158
  }
159
+ contracts ??= await dispatchAssociations(repo, selected);
156
160
  const alias = aliases.get(id);
157
- return { ...(alias === undefined ? {} : { alias }), contract: await dispatchAssociation(repo, id) };
161
+ return { ...(alias === undefined ? {} : { alias }), contract: contracts.get(id) };
158
162
  };
159
163
  }
160
164
  async function observeAkuma(status, path, repo) {
@@ -168,8 +172,9 @@ async function observeAkuma(status, path, repo) {
168
172
  async function composeAkumaAssociations(statuses, path, repo) {
169
173
  const created = await createdTasksFor(path, statuses);
170
174
  const discharged = placementDischarged(repo);
175
+ const contracts = await dispatchAssociations(repo, statuses.map((status) => status.id));
171
176
  return await Promise.all(statuses.map(async (status, index) => {
172
- const contract = await dispatchAssociation(repo, status.id);
177
+ const contract = contracts.get(status.id);
173
178
  return {
174
179
  status: await composeObservation(status, contract, discharged),
175
180
  contract,
@@ -265,7 +270,7 @@ async function localWait(addressed, input) {
265
270
  completion: input.completion,
266
271
  ...(input.timeoutMs === undefined ? {} : { timeoutMs: input.timeoutMs }),
267
272
  ...(input.signal === undefined ? {} : { signal: input.signal }),
268
- identity: waitIdentityFacts(addressed.path, input.repo),
273
+ identity: waitIdentityFacts(addressed.path, input.repo, addressed.orderedIds),
269
274
  selectionOrder: addressed.orderedIds,
270
275
  ...(input.observer?.selected === undefined ? {} : { onSelected: input.observer.selected }),
271
276
  ...(input.observer?.observe === undefined ? {} : { observe: input.observer.observe }),
@@ -277,9 +282,6 @@ async function localWait(addressed, input) {
277
282
  throw observationError(addressed.orderedIds[0], error);
278
283
  }
279
284
  }
280
- export async function waitAkuma(input, execution = localExecutionContext()) {
281
- return await waitAkumaOn(selectionSeam(execution), input);
282
- }
283
285
  function waitObserver(value) {
284
286
  if (value === undefined)
285
287
  return undefined;
@@ -330,9 +332,6 @@ export async function killAkumaOn(seam, input) {
330
332
  }
331
333
  return await seam.kill(await seam.addressSet(setAddress(values)), signal(values.signal));
332
334
  }
333
- export async function tellAkuma(input, execution = localExecutionContext()) {
334
- return await tellAkumaOn(selectionSeam(execution), input);
335
- }
336
335
  export async function tellAkumaOn(seam, input) {
337
336
  const values = requireInput(input, "Akumas.tell input");
338
337
  for (const key of Object.keys(values)) {
@@ -392,7 +391,7 @@ export async function historyAkuma(input) {
392
391
  const addressed = await addressAkuma(directAddress(values));
393
392
  try {
394
393
  const handle = new AkumaOwner(addressed.id, addressed.path);
395
- const contract = await dispatchAssociation(values.repo, addressed.id);
394
+ const contract = (await dispatchAssociations(values.repo, [addressed.id])).get(addressed.id);
396
395
  if (values.last === true) {
397
396
  const answer = await handle.lastAnswer();
398
397
  return answer.kind === "answer"
@@ -1,7 +1,7 @@
1
1
  import type { ActiveContractRefusal } from "../core/facts/observation.js";
2
2
  import type { GitTreeSelection } from "../git/read-observation.js";
3
3
  import type { CompanionDecorator } from "./run.js";
4
- import type { IntentOutcome, MutationOperationInput } from "./operations.js";
4
+ import { type IntentOutcome, type MutationOperationInput } from "./operations.js";
5
5
  export declare function abandonOperation(input: MutationOperationInput & Readonly<{
6
6
  note?: string;
7
7
  decorateOffer?: CompanionDecorator;
@@ -1,16 +1,9 @@
1
1
  import { decideAbandon } from "../core/verbs/abandon.js";
2
- import { admitIntent } from "./intent.js";
3
- import { complete } from "./outcome.js";
4
- import { timestamp } from "./operations.js";
2
+ import { admitVoidIntent } from "./operations.js";
5
3
  export async function abandonOperation(input) {
6
- return complete(await admitIntent(input.channel, input.scope, {
7
- contractId: input.contractId,
8
- ...(input.actor === undefined ? {} : { actor: input.actor }),
9
- at: timestamp(),
10
- ...(input.note === undefined ? {} : { note: input.note }),
11
- }, decideAbandon, {
4
+ return admitVoidIntent(input, { ...(input.note === undefined ? {} : { note: input.note }) }, decideAbandon, {
12
5
  ...(input.decorateOffer === undefined ? {} : { decorateOffer: input.decorateOffer }),
13
6
  ...(input.observationSelection === undefined ? {} : { observationSelection: input.observationSelection }),
14
7
  ...(input.progress === undefined ? {} : { progress: input.progress }),
15
- }), undefined);
8
+ });
16
9
  }
@@ -63,14 +63,11 @@ export async function amendOperation(input) {
63
63
  if (decision.kind === "refused")
64
64
  return decision;
65
65
  const admission = await admitDecidedOffer({
66
- channel: input.channel,
67
- repository: input.scope,
66
+ ...input,
68
67
  seat,
69
- decisionObservation: observation,
68
+ observation,
70
69
  attempt: attempts[index],
71
70
  offer: decision.offer,
72
- primaryContract: input.contractId,
73
- ...(input.progress === undefined ? {} : { progress: input.progress }),
74
71
  });
75
72
  if (admission.kind === "accepted") {
76
73
  if (amendment === undefined)
@@ -1,5 +1,5 @@
1
1
  import type { ActiveContractRefusal } from "../core/facts/observation.js";
2
- import type { IntentOutcome, MutationOperationInput } from "./operations.js";
2
+ import { type IntentOutcome, type MutationOperationInput } from "./operations.js";
3
3
  export declare function arcOperation(input: MutationOperationInput & Readonly<{
4
4
  chapter: Readonly<{
5
5
  title: string;
@@ -1,12 +1,5 @@
1
1
  import { decideArc } from "../core/verbs/arc.js";
2
- import { admitIntent } from "./intent.js";
3
- import { complete } from "./outcome.js";
4
- import { timestamp } from "./operations.js";
2
+ import { admitVoidIntent } from "./operations.js";
5
3
  export async function arcOperation(input) {
6
- return complete(await admitIntent(input.channel, input.scope, {
7
- contractId: input.contractId,
8
- ...(input.actor === undefined ? {} : { actor: input.actor }),
9
- at: timestamp(),
10
- data: input.chapter,
11
- }, decideArc), undefined);
4
+ return admitVoidIntent(input, { data: input.chapter }, decideArc);
12
5
  }
@@ -10,22 +10,9 @@ import type { AttemptContext } from "../core/decide.js";
10
10
  import type { Offer } from "../core/facts/offer.js";
11
11
  import { type ContractId, type ContractState, type EntryUlid, type JournalEntry } from "../core/facts/types.js";
12
12
  export declare const entryUlidSchema: z.ZodPipe<z.ZodString, z.ZodTransform<EntryUlid, string>>;
13
- export declare function mintEntryUlids(count: number): readonly EntryUlid[];
14
13
  export declare function mintAttempts(input: Readonly<{
15
14
  entryCount: number;
16
15
  }>): readonly AttemptContext[];
17
- export type UnknownAttemptClassification = Readonly<{
18
- kind: "accepted";
19
- }> | Readonly<{
20
- kind: "redecide";
21
- }> | Readonly<{
22
- kind: "collision";
23
- contractId: ContractId;
24
- planned: JournalEntry;
25
- observed: JournalEntry;
26
- plannedBytes: string;
27
- observedBytes: string;
28
- }>;
29
16
  export type AcceptedAdmission = Readonly<{
30
17
  kind: "accepted";
31
18
  facts: readonly JournalEntry[];
@@ -46,18 +33,14 @@ export type DecidedOfferResult<Refusal = never> = AcceptedAdmission | AttemptTer
46
33
  }>;
47
34
  /** Admit one decided offer without making another legal decision. */
48
35
  export declare function admitDecidedOffer<Refusal = never>(input: Readonly<{
36
+ scope: GitRepository;
49
37
  channel: GitDecodeChannel;
50
- repository: GitRepository;
38
+ contractId: ContractId;
51
39
  seat: PrivateStatePublicationSeat;
52
- decisionObservation: GitDecisionObservation;
40
+ observation: GitDecisionObservation;
53
41
  attempt: AttemptContext;
54
42
  offer: Offer;
55
- primaryContract: ContractId;
56
43
  assertions?: readonly GitRefAssertion[];
57
44
  validateAdmission?: (observation: GitDecisionObservation) => Refusal | undefined | Promise<Refusal | undefined>;
58
45
  progress?: ProtocolProgress;
59
46
  }>): Promise<DecidedOfferResult<Refusal>>;
60
- /** Classify an unknown atomic-publication outcome using only a captured Git observation. */
61
- export declare function classifyUnknownAttempt(observation: Readonly<{
62
- contracts: GitDecisionObservation["journals"];
63
- }>, offer: Offer): UnknownAttemptClassification;
@@ -34,7 +34,7 @@ function nextEntryUlid() {
34
34
  }
35
35
  return entryUlid(value);
36
36
  }
37
- export function mintEntryUlids(count) {
37
+ function mintEntryUlids(count) {
38
38
  return Array.from({ length: count }, nextEntryUlid);
39
39
  }
40
40
  export function mintAttempts(input) {
@@ -104,7 +104,8 @@ async function publicationPremiseMoved(repository, observation, offer, assertion
104
104
  }
105
105
  /** Admit one decided offer without making another legal decision. */
106
106
  export async function admitDecidedOffer(input) {
107
- const { repository, decisionObservation, attempt, offer, primaryContract } = input;
107
+ const { seat, observation: decisionObservation, attempt, offer, contractId: primaryContract } = input;
108
+ const repository = input.scope;
108
109
  const assertions = input.assertions ?? [];
109
110
  validateOffer(offer, attempt);
110
111
  const primary = primaryAppend(offer, primaryContract);
@@ -115,7 +116,7 @@ export async function admitDecidedOffer(input) {
115
116
  }
116
117
  const admission = await admit(repository, offer, decisionObservation.admission, assertions);
117
118
  if (admission.kind === "accepted") {
118
- confirmPrivateStatePublication(input.seat);
119
+ confirmPrivateStatePublication(seat);
119
120
  input.progress?.recordPublication(primaryContract, admission.heads[primary.contractId], offerEntries(offer));
120
121
  const accepted = {
121
122
  kind: "accepted",
@@ -135,7 +136,7 @@ export async function admitDecidedOffer(input) {
135
136
  const recovered = await withGitDecodeChannel(recoveryRepository, async (recoveryChannel) => observeContractsForAdmissionAt(recoveryRepository, recoveryChannel, offer.facts.map((append) => append.contractId)));
136
137
  const classification = classifyUnknownAttempt({ contracts: recovered.journals }, offer);
137
138
  if (classification.kind === "accepted") {
138
- const accepted = confirmRecoveredAcceptance(input.seat, { contracts: recovered.journals }, offer, primaryContract);
139
+ const accepted = confirmRecoveredAcceptance(seat, { contracts: recovered.journals }, offer, primaryContract);
139
140
  input.progress?.recordAdmission(accepted);
140
141
  return accepted;
141
142
  }
@@ -147,7 +148,7 @@ function confirmRecoveredAcceptance(seat, observation, offer, primaryContract) {
147
148
  return recovered;
148
149
  }
149
150
  /** Classify an unknown atomic-publication outcome using only a captured Git observation. */
150
- export function classifyUnknownAttempt(observation, offer) {
151
+ function classifyUnknownAttempt(observation, offer) {
151
152
  let exact = 0;
152
153
  let missing = 0;
153
154
  for (const append of offer.facts) {
@@ -75,6 +75,7 @@ export declare const auditReportSchema: z.ZodObject<{
75
75
  path: z.ZodString;
76
76
  }, z.core.$strict>;
77
77
  identity: z.ZodObject<{
78
+ note: z.ZodOptional<z.ZodString>;
78
79
  tenderSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
79
80
  integration: z.ZodObject<{
80
81
  predecessor: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
@@ -11,7 +11,7 @@ import { readManagedWorktreeAppointment } from "../workspace-place.js";
11
11
  import { currentVerifiedAttestation, verifyDelivery } from "./intent.js";
12
12
  import { accepted, admitted } from "./outcome.js";
13
13
  import { prepareDelivery } from "./deliver.js";
14
- import { timestamp, unpackVerificationOutcome } from "./operations.js";
14
+ import { recordedIntegrationSnapshots, timestamp, unpackVerificationOutcome } from "./operations.js";
15
15
  export const auditReportSchema = z
16
16
  .object({
17
17
  candidate: z.union([
@@ -63,15 +63,15 @@ async function auditWorkspace(repository, state) {
63
63
  return appointed;
64
64
  return { kind: "ready", answer: { kind: "worktree", path: appointed.path }, appointment: appointed };
65
65
  }
66
- function auditDeliveryRelation(state, candidate, verificationDeclared) {
66
+ function auditDeliveryRelation(state, candidate, declaration) {
67
67
  const recorded = state.delivery?.data.integration.changeId;
68
68
  if (recorded === undefined)
69
69
  return undefined;
70
- const verification = currentVerifiedAttestation(state);
70
+ const verification = declaration == null ? undefined : currentVerifiedAttestation(state);
71
71
  return {
72
72
  changeId: recorded,
73
73
  relation: recorded === candidate.integration.changeId ? "identical" : "differs",
74
- verification: !verificationDeclared
74
+ verification: declaration == null
75
75
  ? { kind: "undeclared" }
76
76
  : verification === undefined
77
77
  ? { kind: "unrecorded" }
@@ -95,15 +95,13 @@ async function auditCandidateVerification(input, state, snapshot, definition) {
95
95
  throw new Error("audit verification preparation unexpectedly produced no attempt");
96
96
  return unpackVerificationOutcome(verification);
97
97
  }
98
- function auditVerificationAnswer(verified, declared) {
99
- if (!declared)
98
+ function auditVerificationAnswer(verified, declaration) {
99
+ if (declaration === null)
100
100
  return { kind: "undeclared" };
101
101
  if (verified === undefined)
102
- return { kind: "not-run" };
102
+ throw new Error("declared audit Verification produced no attempt");
103
103
  if (verified.stop !== undefined)
104
104
  return { kind: "stopped", stop: verified.stop };
105
- if (verified.reuse !== undefined)
106
- return { kind: "reused", ...verified.reuse };
107
105
  if (verified.counts === undefined)
108
106
  throw new Error("terminal Verification is missing producer counts");
109
107
  return {
@@ -172,6 +170,7 @@ export async function auditOperation(input) {
172
170
  const prepared = await prepareDelivery(input.scope, {
173
171
  contractId: state.id,
174
172
  coordinates: state.coordinates,
173
+ recordedIntegrations: recordedIntegrationSnapshots(observed.journals.get(state.id)?.entries ?? []),
175
174
  ...(workspace.appointment === undefined ? {} : { appointment: workspace.appointment }),
176
175
  }, {
177
176
  title: derivation.title,
@@ -187,8 +186,8 @@ export async function auditOperation(input) {
187
186
  const verified = derivation.verification.data === null
188
187
  ? undefined
189
188
  : await auditCandidateVerification(input, state, prepared.data.integration.snapshot, derivation.verification.data);
190
- const verification = auditVerificationAnswer(verified, derivation.verification.data !== null);
191
- const delivery = auditDeliveryRelation(verified?.admission?.state ?? state, prepared.data, derivation.verification.data !== null);
189
+ const verification = auditVerificationAnswer(verified, derivation.verification.data);
190
+ const delivery = auditDeliveryRelation(verified?.admission?.state ?? state, prepared.data, derivation.verification.data);
192
191
  input.progress?.recordAudit(state.id, { verification, ...(delivery === undefined ? {} : { delivery }) });
193
192
  const target = await auditTargetAnswer(input.scope, state, prepared.data);
194
193
  input.progress?.recordAudit(state.id, { target });