@astrosheep/keiyaku 4.6.32 → 4.6.34

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 (244) hide show
  1. package/README.md +18 -7
  2. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +18 -11
  3. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +8 -6
  4. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +2 -1
  5. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -1
  6. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +18 -11
  7. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +8 -6
  8. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +2 -1
  9. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -1
  10. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +18 -11
  11. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +8 -6
  12. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +2 -1
  13. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -1
  14. package/build/plugins/pi/README.md +55 -97
  15. package/build/plugins/pi/keiyaku.ts +1 -142
  16. package/build/skills/keiyaku-akuma/SKILL.md +18 -11
  17. package/build/skills/keiyaku-babysit/SKILL.md +8 -6
  18. package/build/skills/keiyaku-debt/SKILL.md +2 -1
  19. package/build/skills/keiyaku-workflow/SKILL.md +2 -1
  20. package/build/src/akuma/akuma-instance.d.ts +11 -0
  21. package/build/src/akuma/akuma-instance.js +1 -2
  22. package/build/src/akuma/akuma-observe.d.ts +8 -0
  23. package/build/src/akuma/akuma-observe.js +81 -14
  24. package/build/src/akuma/akuma-owner.d.ts +1 -0
  25. package/build/src/akuma/akuma-owner.js +3 -5
  26. package/build/src/akuma/akuma-selection-execution.d.ts +82 -7
  27. package/build/src/akuma/akuma-selection-execution.js +26 -27
  28. package/build/src/akuma/akuma-wait.d.ts +155 -1
  29. package/build/src/akuma/akuma-wait.js +94 -34
  30. package/build/src/akuma/akuma.d.ts +17 -1
  31. package/build/src/akuma/akuma.js +37 -18
  32. package/build/src/akuma/body.js +13 -18
  33. package/build/src/akuma/call-initial-tell.d.ts +0 -1
  34. package/build/src/akuma/call-initial-tell.js +0 -1
  35. package/build/src/akuma/heart/activity-schema.d.ts +16 -0
  36. package/build/src/akuma/heart/activity-schema.js +7 -0
  37. package/build/src/akuma/heart/facts.d.ts +1 -0
  38. package/build/src/akuma/heart/facts.js +14 -0
  39. package/build/src/akuma/heart/index.d.ts +7 -1
  40. package/build/src/akuma/heart/index.js +35 -9
  41. package/build/src/akuma/heart/rows.d.ts +1 -0
  42. package/build/src/akuma/heart/rows.js +4 -0
  43. package/build/src/akuma/heart/timeline.js +4 -4
  44. package/build/src/akuma/lineage-cache.d.ts +7 -2
  45. package/build/src/akuma/lineage-cache.js +48 -24
  46. package/build/src/akuma/projection-read.d.ts +4 -2
  47. package/build/src/akuma/projection-read.js +25 -23
  48. package/build/src/akuma/projection.d.ts +94 -2
  49. package/build/src/akuma/projection.js +47 -47
  50. package/build/src/akuma/provider.d.ts +2 -2
  51. package/build/src/akuma/provider.js +27 -20
  52. package/build/src/akuma/providers/acp/core.js +2 -5
  53. package/build/src/akuma/providers/opencode-sdk/events.d.ts +2 -1
  54. package/build/src/akuma/providers/opencode-sdk/events.js +31 -1
  55. package/build/src/akuma/publication.js +3 -2
  56. package/build/src/akuma/selection-observation.d.ts +645 -0
  57. package/build/src/akuma/selection-observation.js +22 -7
  58. package/build/src/akuma/status-projection.d.ts +14 -1
  59. package/build/src/akuma/status-projection.js +40 -2
  60. package/build/src/akuma/turn-drive.js +21 -15
  61. package/build/src/body/amend.js +5 -17
  62. package/build/src/body/decode.js +11 -1
  63. package/build/src/body/envelope.d.ts +5 -1
  64. package/build/src/body/envelope.js +4 -2
  65. package/build/src/body/render.js +4 -6
  66. package/build/src/bounded-list.d.ts +8 -0
  67. package/build/src/bounded-list.js +10 -0
  68. package/build/src/cli/commands/akuma-grammar.d.ts +5 -8
  69. package/build/src/cli/commands/akuma-grammar.js +52 -77
  70. package/build/src/cli/commands/akuma.d.ts +1 -2
  71. package/build/src/cli/commands/akuma.js +12 -61
  72. package/build/src/cli/commands/contract-grammar.d.ts +1 -0
  73. package/build/src/cli/commands/contract-grammar.js +39 -42
  74. package/build/src/cli/commands/contract-help.d.ts +6 -5
  75. package/build/src/cli/commands/contract-help.js +21 -13
  76. package/build/src/cli/commands/contract.d.ts +3 -3
  77. package/build/src/cli/commands/contract.js +13 -9
  78. package/build/src/cli/commands/debt-grammar.js +2 -4
  79. package/build/src/cli/parse.d.ts +4 -10
  80. package/build/src/cli/parse.js +2 -5
  81. package/build/src/cli/render/akuma-activity.d.ts +12 -34
  82. package/build/src/cli/render/akuma-activity.js +99 -180
  83. package/build/src/cli/render/akuma.d.ts +5 -11
  84. package/build/src/cli/render/akuma.js +22 -30
  85. package/build/src/cli/render/catalog.js +4 -6
  86. package/build/src/cli/render/contract-history.d.ts +1 -3
  87. package/build/src/cli/render/contract-history.js +70 -49
  88. package/build/src/cli/render/contract-observation.d.ts +2 -1
  89. package/build/src/cli/render/contract-observation.js +25 -1
  90. package/build/src/cli/render/contract-wait.d.ts +2 -2
  91. package/build/src/cli/render/contract-wait.js +21 -17
  92. package/build/src/cli/render/contract.js +12 -9
  93. package/build/src/cli/render/debt.js +1 -2
  94. package/build/src/cli/render/execution-progress.js +1 -3
  95. package/build/src/cli/render/kanshi-akuma.d.ts +4 -3
  96. package/build/src/cli/render/kanshi-akuma.js +27 -23
  97. package/build/src/cli/render/kanshi.js +45 -60
  98. package/build/src/cli/render/receipt.d.ts +1 -1
  99. package/build/src/cli/render/receipt.js +33 -28
  100. package/build/src/cli/render/reconcile.js +2 -5
  101. package/build/src/cli/render/refusal.js +3 -6
  102. package/build/src/cli/render/terminal.d.ts +2 -4
  103. package/build/src/cli/render/terminal.js +10 -17
  104. package/build/src/cli/render/verbs.d.ts +1 -0
  105. package/build/src/cli/render/verbs.js +39 -34
  106. package/build/src/cli/runtime.js +12 -32
  107. package/build/src/core/facts/codec.js +7 -2
  108. package/build/src/core/facts/eligibility.d.ts +4 -4
  109. package/build/src/core/facts/eligibility.js +11 -0
  110. package/build/src/core/facts/fold.js +9 -5
  111. package/build/src/core/facts/gate.d.ts +5 -1
  112. package/build/src/core/facts/gate.js +14 -10
  113. package/build/src/core/facts/types.d.ts +5 -1
  114. package/build/src/core/facts/types.js +7 -0
  115. package/build/src/core/subject.d.ts +4 -1
  116. package/build/src/core/subject.js +10 -2
  117. package/build/src/core/verbs/amend.d.ts +15 -4
  118. package/build/src/core/verbs/amend.js +19 -9
  119. package/build/src/debt/board.d.ts +2 -1
  120. package/build/src/debt/board.js +3 -3
  121. package/build/src/debt/catalog.js +2 -1
  122. package/build/src/debt/document.d.ts +1 -0
  123. package/build/src/debt/document.js +3 -0
  124. package/build/src/debt/index.d.ts +2 -2
  125. package/build/src/debt/index.js +9 -14
  126. package/build/src/debt/input.d.ts +2 -1
  127. package/build/src/debt/input.js +6 -4
  128. package/build/src/debt/operations.d.ts +2 -1
  129. package/build/src/dispatch/index.d.ts +0 -17
  130. package/build/src/dispatch/index.js +1 -10
  131. package/build/src/git/identity.js +16 -45
  132. package/build/src/git/nuke.js +13 -23
  133. package/build/src/git/observe.d.ts +7 -3
  134. package/build/src/git/observe.js +29 -26
  135. package/build/src/git/process.js +11 -18
  136. package/build/src/git/read-observation.d.ts +5 -4
  137. package/build/src/git/repository.d.ts +2 -0
  138. package/build/src/git/repository.js +13 -1
  139. package/build/src/git/scratch.js +2 -14
  140. package/build/src/git/terminal-reconcile.js +1 -13
  141. package/build/src/history.d.ts +26 -0
  142. package/build/src/history.js +43 -0
  143. package/build/src/index.d.ts +6 -3
  144. package/build/src/kanshi/counts.d.ts +15 -1
  145. package/build/src/kanshi/counts.js +14 -3
  146. package/build/src/kanshi/index.d.ts +3 -4
  147. package/build/src/kanshi/index.js +2 -3
  148. package/build/src/kanshi/read.d.ts +21 -0
  149. package/build/src/kanshi/read.js +7 -3
  150. package/build/src/kanshi/report.d.ts +94 -0
  151. package/build/src/library/address.d.ts +12 -5
  152. package/build/src/library/address.js +18 -32
  153. package/build/src/library/akuma-creation.d.ts +39 -0
  154. package/build/src/library/akuma-creation.js +3 -9
  155. package/build/src/library/akumas.d.ts +5 -1
  156. package/build/src/library/akumas.js +11 -5
  157. package/build/src/library/continuation.d.ts +10 -0
  158. package/build/src/library/contract-composition.js +10 -10
  159. package/build/src/library/contract-creation.js +12 -13
  160. package/build/src/library/contract-outcomes.d.ts +72 -1
  161. package/build/src/library/contract-outcomes.js +1 -0
  162. package/build/src/library/contract-types.d.ts +233 -25
  163. package/build/src/library/contract-types.js +32 -12
  164. package/build/src/library/contract-wait.d.ts +212 -0
  165. package/build/src/library/contract-wait.js +65 -49
  166. package/build/src/library/delivery.d.ts +25 -0
  167. package/build/src/library/input.d.ts +8 -26
  168. package/build/src/library/input.js +17 -12
  169. package/build/src/library/kei.js +167 -90
  170. package/build/src/library/keiyaku-attribution.d.ts +1 -1
  171. package/build/src/library/keiyaku-attribution.js +3 -1
  172. package/build/src/library/keiyaku-classify.js +8 -4
  173. package/build/src/library/keiyaku-debt.d.ts +8 -7
  174. package/build/src/library/keiyaku-debt.js +1 -2
  175. package/build/src/library/keiyaku-identity.d.ts +4 -3
  176. package/build/src/library/keiyaku-identity.js +35 -7
  177. package/build/src/library/keiyaku-verbs.d.ts +974 -1409
  178. package/build/src/library/keiyaku-verbs.js +154 -161
  179. package/build/src/library/keiyaku-wait.d.ts +753 -0
  180. package/build/src/library/keiyaku-wait.js +230 -0
  181. package/build/src/library/keiyaku.d.ts +3110 -29
  182. package/build/src/library/keiyaku.js +342 -438
  183. package/build/src/library/model-tools.d.ts +754 -0
  184. package/build/src/library/model-tools.js +362 -0
  185. package/build/src/library/outcome.js +5 -6
  186. package/build/src/library/refusal.d.ts +25 -1
  187. package/build/src/library/refusal.js +4 -5
  188. package/build/src/library/selection.d.ts +18 -5
  189. package/build/src/library/selection.js +11 -5
  190. package/build/src/mcp/adapter.d.ts +0 -6
  191. package/build/src/mcp/adapter.js +11 -160
  192. package/build/src/mcp/description.d.ts +2 -0
  193. package/build/src/mcp/description.js +2 -0
  194. package/build/src/mcp/help.d.ts +1 -1
  195. package/build/src/mcp/help.js +10 -7
  196. package/build/src/pi/index.d.ts +5 -0
  197. package/build/src/pi/index.js +99 -0
  198. package/build/src/pi/status.d.ts +12 -0
  199. package/build/src/pi/status.js +140 -0
  200. package/build/src/protocol/amend.d.ts +14 -3
  201. package/build/src/protocol/amend.js +113 -46
  202. package/build/src/protocol/bind.d.ts +1 -1
  203. package/build/src/protocol/bind.js +5 -16
  204. package/build/src/protocol/completion.d.ts +30 -0
  205. package/build/src/protocol/completion.js +8 -5
  206. package/build/src/protocol/deliver.js +7 -20
  207. package/build/src/protocol/delivery-preview.d.ts +5 -0
  208. package/build/src/protocol/execution-observation.d.ts +8 -0
  209. package/build/src/protocol/intent.d.ts +1 -0
  210. package/build/src/protocol/intent.js +4 -1
  211. package/build/src/protocol/operations.d.ts +56 -16
  212. package/build/src/protocol/operations.js +18 -32
  213. package/build/src/protocol/placement.js +7 -1
  214. package/build/src/protocol/progress.js +0 -6
  215. package/build/src/protocol/read/status.d.ts +52 -4
  216. package/build/src/protocol/read/status.js +26 -22
  217. package/build/src/protocol/reintegrate.js +2 -2
  218. package/build/src/protocol/result-leaves.d.ts +56 -8
  219. package/build/src/protocol/result-leaves.js +11 -2
  220. package/build/src/protocol/run.js +1 -4
  221. package/build/src/protocol/verify.d.ts +10 -0
  222. package/build/src/protocol/verify.js +1 -0
  223. package/build/src/runtime/proc/windows-launch.exe +0 -0
  224. package/build/src/settlement/settle.js +19 -68
  225. package/package.json +7 -3
  226. package/plugins/paseo/plugin/index.server.ts +6 -2
  227. package/plugins/paseo/plugin/server/attach.ts +68 -48
  228. package/plugins/paseo/plugin/server/directory.ts +259 -0
  229. package/plugins/paseo/plugin/server/mirror-identity.ts +3 -32
  230. package/plugins/paseo/plugin/server/reopen.ts +52 -38
  231. package/plugins/pi/README.md +55 -97
  232. package/plugins/pi/keiyaku.ts +1 -142
  233. package/skills/keiyaku-akuma/SKILL.md +18 -11
  234. package/skills/keiyaku-babysit/SKILL.md +8 -6
  235. package/skills/keiyaku-debt/SKILL.md +2 -1
  236. package/skills/keiyaku-workflow/SKILL.md +2 -1
  237. package/build/plugins/pi/akuma-tools.ts +0 -283
  238. package/build/src/body/keys.d.ts +0 -4
  239. package/build/src/body/keys.js +0 -11
  240. package/build/src/kanshi/roster.d.ts +0 -2
  241. package/build/src/kanshi/roster.js +0 -2
  242. package/build/src/mcp/output.d.ts +0 -385
  243. package/build/src/mcp/output.js +0 -193
  244. package/plugins/pi/akuma-tools.ts +0 -283
@@ -1,31 +1,37 @@
1
1
  /** @architectureCompositionRoot */
2
2
  import { z } from "zod";
3
3
  import { contractIdSchema, snapshotIdSchema } from "../git/identity.js";
4
- import { entryUlidSchema, gateSchema, requirementIdSchema, verdictSchema } from "../protocol/result-leaves.js";
4
+ import { gateSchema, requirementIdSchema, verdictSchema } from "../protocol/result-leaves.js";
5
+ import { canonicalDecimalSchema, historyPageSchemas } from "../history.js";
5
6
  import { akumaIdSchema } from "../akuma/identity.js";
7
+ /** A journal row's public address is its one-based append position, never its private entry identity. */
6
8
  const historyCommon = {
7
- id: entryUlidSchema,
9
+ id: canonicalDecimalSchema,
8
10
  at: z.string(),
9
11
  };
10
12
  const historyTarget = z.union([
11
13
  z.string(),
12
14
  z.strictObject({ kind: z.literal("contract"), contractId: contractIdSchema }).readonly(),
13
15
  ]);
16
+ const historyIncarnation = z.strictObject({ id: z.string(), identity: z.string() }).readonly();
14
17
  const historyGates = z.array(gateSchema).readonly().exactOptional();
15
18
  const historyAfter = z.array(contractIdSchema).readonly().exactOptional();
16
19
  function historyEvent(kind, fields) {
17
20
  return z.strictObject({ ...historyCommon, kind: z.literal(kind), ...fields }).readonly();
18
21
  }
19
- export const contractHistoryEventSchema = z.union([
22
+ /** A page row keeps the semantic fact; an exact read adds that record's complete retained terms. */
23
+ export const contractJournalRowSchema = z.union([
20
24
  historyEvent("bind", {
21
25
  start: snapshotIdSchema,
22
26
  target: historyTarget.exactOptional(),
23
27
  gates: historyGates,
24
28
  after: historyAfter,
25
29
  document: z.string().exactOptional(),
26
- targetIncarnation: z.strictObject({ id: z.string(), identity: z.string() }).readonly().exactOptional(),
30
+ targetIncarnation: historyIncarnation.exactOptional(),
27
31
  }),
28
32
  historyEvent("amend", {
33
+ target: historyTarget.exactOptional(),
34
+ targetIncarnation: historyIncarnation.exactOptional(),
29
35
  changedSections: z.array(z.string()).readonly().exactOptional(),
30
36
  gates: historyGates,
31
37
  after: historyAfter,
@@ -47,23 +53,24 @@ export const contractHistoryEventSchema = z.union([
47
53
  subject: z.string(),
48
54
  summary: z.string().exactOptional(),
49
55
  }),
50
- historyEvent("claimed", { deliveryId: entryUlidSchema }),
56
+ historyEvent("claimed", { deliveryId: canonicalDecimalSchema }),
51
57
  historyEvent("arc", { chapter: z.number().int().positive(), title: z.string(), body: z.string().exactOptional() }),
52
58
  historyEvent("abandoned", { note: z.string().exactOptional() }),
53
- z
54
- .strictObject({
55
- kind: z.literal("dispatch"),
56
- at: z.string(),
57
- akumaId: akumaIdSchema,
58
- })
59
- .readonly(),
60
59
  ]);
60
+ /** One available Dispatch association, presented after the journal row it enriches. */
61
+ export const contractDispatchRowSchema = z
62
+ .strictObject({ kind: z.literal("dispatch"), at: z.string(), akumaId: akumaIdSchema })
63
+ .readonly();
64
+ export const contractHistoryEventSchema = z.union([contractJournalRowSchema, contractDispatchRowSchema]);
61
65
  export const contractHistorySchema = z.union([
62
66
  z
63
67
  .strictObject({
64
68
  kind: z.literal("contract"),
65
69
  contractId: contractIdSchema,
66
70
  events: z.array(contractHistoryEventSchema).readonly(),
71
+ omitted: z.number().int().positive().exactOptional(),
72
+ lowestRetainedSequence: z.number().int().positive().exactOptional(),
73
+ highestSequence: z.number().int().positive().exactOptional(),
67
74
  dispatches: z
68
75
  .strictObject({
69
76
  kind: z.literal("unavailable"),
@@ -74,8 +81,21 @@ export const contractHistorySchema = z.union([
74
81
  .exactOptional(),
75
82
  })
76
83
  .readonly(),
84
+ z
85
+ .strictObject({
86
+ kind: z.literal("contract-exact"),
87
+ contractId: contractIdSchema,
88
+ event: contractJournalRowSchema,
89
+ })
90
+ .readonly(),
91
+ z.strictObject({ kind: z.literal("contract-unknown-history"), contractId: contractIdSchema }).readonly(),
77
92
  z.strictObject({ kind: z.literal("contract-missing"), contractId: contractIdSchema }).readonly(),
78
93
  ]);
94
+ /** One exact address or one page window; the family's schema rejects contradictory intent. */
95
+ export const contractHistoryInputSchema = z.union([
96
+ z.strictObject({ item: canonicalDecimalSchema }),
97
+ ...historyPageSchemas,
98
+ ]);
79
99
  export const contractSelectorRefusalSchema = z.union([
80
100
  z.strictObject({ kind: z.literal("invalid-selector"), selector: z.string(), diagnostic: z.string() }).readonly(),
81
101
  z.strictObject({ kind: z.literal("redundant-short-selector"), selector: z.string() }).readonly(),
@@ -21,6 +21,47 @@ export declare const contractWaitMemberSchema: z.ZodReadonly<z.ZodObject<{
21
21
  claimed: "claimed";
22
22
  abandoned: "abandoned";
23
23
  }>>;
24
+ summary: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
25
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
26
+ title: z.ZodExactOptional<z.ZodString>;
27
+ phase: z.ZodEnum<{
28
+ claimed: "claimed";
29
+ abandoned: "abandoned";
30
+ bound: "bound";
31
+ }>;
32
+ phaseAt: z.ZodString;
33
+ delivered: z.ZodExactOptional<z.ZodLiteral<true>>;
34
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
35
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
36
+ verdict: z.ZodEnum<{
37
+ missing: "missing";
38
+ satisfied: "satisfied";
39
+ unsatisfied: "unsatisfied";
40
+ stale: "stale";
41
+ }>;
42
+ }, z.core.$strict>>>>>;
43
+ attention: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
44
+ kind: z.ZodLiteral<"workspace-unavailable">;
45
+ path: z.ZodString;
46
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
47
+ kind: z.ZodLiteral<"workspace-unappointed">;
48
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
49
+ kind: z.ZodLiteral<"workspace-failed">;
50
+ path: z.ZodString;
51
+ diagnostic: z.ZodString;
52
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
53
+ kind: z.ZodLiteral<"merge-in-progress">;
54
+ path: z.ZodString;
55
+ conflicts: z.ZodExactOptional<z.ZodNumber>;
56
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
57
+ kind: z.ZodLiteral<"target-behind">;
58
+ behind: z.ZodNumber;
59
+ subject: z.ZodExactOptional<z.ZodString>;
60
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
61
+ kind: z.ZodLiteral<"target-unknown">;
62
+ subject: z.ZodExactOptional<z.ZodString>;
63
+ }, z.core.$strict>>]>>>>;
64
+ }, z.core.$strict>>>;
24
65
  }, z.core.$strict>>;
25
66
  export declare const contractWaitResultSchema: z.ZodReadonly<z.ZodObject<{
26
67
  kind: z.ZodLiteral<"contract">;
@@ -41,6 +82,47 @@ export declare const contractWaitResultSchema: z.ZodReadonly<z.ZodObject<{
41
82
  claimed: "claimed";
42
83
  abandoned: "abandoned";
43
84
  }>>;
85
+ summary: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
86
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
87
+ title: z.ZodExactOptional<z.ZodString>;
88
+ phase: z.ZodEnum<{
89
+ claimed: "claimed";
90
+ abandoned: "abandoned";
91
+ bound: "bound";
92
+ }>;
93
+ phaseAt: z.ZodString;
94
+ delivered: z.ZodExactOptional<z.ZodLiteral<true>>;
95
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
96
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
97
+ verdict: z.ZodEnum<{
98
+ missing: "missing";
99
+ satisfied: "satisfied";
100
+ unsatisfied: "unsatisfied";
101
+ stale: "stale";
102
+ }>;
103
+ }, z.core.$strict>>>>>;
104
+ attention: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
105
+ kind: z.ZodLiteral<"workspace-unavailable">;
106
+ path: z.ZodString;
107
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
108
+ kind: z.ZodLiteral<"workspace-unappointed">;
109
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
110
+ kind: z.ZodLiteral<"workspace-failed">;
111
+ path: z.ZodString;
112
+ diagnostic: z.ZodString;
113
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
114
+ kind: z.ZodLiteral<"merge-in-progress">;
115
+ path: z.ZodString;
116
+ conflicts: z.ZodExactOptional<z.ZodNumber>;
117
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
118
+ kind: z.ZodLiteral<"target-behind">;
119
+ behind: z.ZodNumber;
120
+ subject: z.ZodExactOptional<z.ZodString>;
121
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
122
+ kind: z.ZodLiteral<"target-unknown">;
123
+ subject: z.ZodExactOptional<z.ZodString>;
124
+ }, z.core.$strict>>]>>>>;
125
+ }, z.core.$strict>>>;
44
126
  }, z.core.$strict>>>>;
45
127
  }, z.core.$strict>>;
46
128
  export declare const contractWaitNormalResultSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
@@ -48,6 +130,47 @@ export declare const contractWaitNormalResultSchema: z.ZodUnion<readonly [z.ZodR
48
130
  reason: z.ZodLiteral<"changed">;
49
131
  contracts: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
50
132
  id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
133
+ summary: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
134
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
135
+ title: z.ZodExactOptional<z.ZodString>;
136
+ phase: z.ZodEnum<{
137
+ claimed: "claimed";
138
+ abandoned: "abandoned";
139
+ bound: "bound";
140
+ }>;
141
+ phaseAt: z.ZodString;
142
+ delivered: z.ZodExactOptional<z.ZodLiteral<true>>;
143
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
144
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
145
+ verdict: z.ZodEnum<{
146
+ missing: "missing";
147
+ satisfied: "satisfied";
148
+ unsatisfied: "unsatisfied";
149
+ stale: "stale";
150
+ }>;
151
+ }, z.core.$strict>>>>>;
152
+ attention: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
153
+ kind: z.ZodLiteral<"workspace-unavailable">;
154
+ path: z.ZodString;
155
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
156
+ kind: z.ZodLiteral<"workspace-unappointed">;
157
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
158
+ kind: z.ZodLiteral<"workspace-failed">;
159
+ path: z.ZodString;
160
+ diagnostic: z.ZodString;
161
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
162
+ kind: z.ZodLiteral<"merge-in-progress">;
163
+ path: z.ZodString;
164
+ conflicts: z.ZodExactOptional<z.ZodNumber>;
165
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
166
+ kind: z.ZodLiteral<"target-behind">;
167
+ behind: z.ZodNumber;
168
+ subject: z.ZodExactOptional<z.ZodString>;
169
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
170
+ kind: z.ZodLiteral<"target-unknown">;
171
+ subject: z.ZodExactOptional<z.ZodString>;
172
+ }, z.core.$strict>>]>>>>;
173
+ }, z.core.$strict>>>;
51
174
  terminal: z.ZodExactOptional<z.ZodEnum<{
52
175
  claimed: "claimed";
53
176
  abandoned: "abandoned";
@@ -59,6 +182,47 @@ export declare const contractWaitNormalResultSchema: z.ZodUnion<readonly [z.ZodR
59
182
  reason: z.ZodLiteral<"terminal">;
60
183
  contracts: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
61
184
  id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
185
+ summary: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
186
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
187
+ title: z.ZodExactOptional<z.ZodString>;
188
+ phase: z.ZodEnum<{
189
+ claimed: "claimed";
190
+ abandoned: "abandoned";
191
+ bound: "bound";
192
+ }>;
193
+ phaseAt: z.ZodString;
194
+ delivered: z.ZodExactOptional<z.ZodLiteral<true>>;
195
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
196
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
197
+ verdict: z.ZodEnum<{
198
+ missing: "missing";
199
+ satisfied: "satisfied";
200
+ unsatisfied: "unsatisfied";
201
+ stale: "stale";
202
+ }>;
203
+ }, z.core.$strict>>>>>;
204
+ attention: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
205
+ kind: z.ZodLiteral<"workspace-unavailable">;
206
+ path: z.ZodString;
207
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
208
+ kind: z.ZodLiteral<"workspace-unappointed">;
209
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
210
+ kind: z.ZodLiteral<"workspace-failed">;
211
+ path: z.ZodString;
212
+ diagnostic: z.ZodString;
213
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
214
+ kind: z.ZodLiteral<"merge-in-progress">;
215
+ path: z.ZodString;
216
+ conflicts: z.ZodExactOptional<z.ZodNumber>;
217
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
218
+ kind: z.ZodLiteral<"target-behind">;
219
+ behind: z.ZodNumber;
220
+ subject: z.ZodExactOptional<z.ZodString>;
221
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
222
+ kind: z.ZodLiteral<"target-unknown">;
223
+ subject: z.ZodExactOptional<z.ZodString>;
224
+ }, z.core.$strict>>]>>>>;
225
+ }, z.core.$strict>>>;
62
226
  terminal: z.ZodExactOptional<z.ZodEnum<{
63
227
  claimed: "claimed";
64
228
  abandoned: "abandoned";
@@ -69,6 +233,47 @@ export declare const contractWaitNormalResultSchema: z.ZodUnion<readonly [z.ZodR
69
233
  reason: z.ZodLiteral<"deadline">;
70
234
  contracts: z.ZodUnion<readonly [z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
71
235
  id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
236
+ summary: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
237
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
238
+ title: z.ZodExactOptional<z.ZodString>;
239
+ phase: z.ZodEnum<{
240
+ claimed: "claimed";
241
+ abandoned: "abandoned";
242
+ bound: "bound";
243
+ }>;
244
+ phaseAt: z.ZodString;
245
+ delivered: z.ZodExactOptional<z.ZodLiteral<true>>;
246
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
247
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
248
+ verdict: z.ZodEnum<{
249
+ missing: "missing";
250
+ satisfied: "satisfied";
251
+ unsatisfied: "unsatisfied";
252
+ stale: "stale";
253
+ }>;
254
+ }, z.core.$strict>>>>>;
255
+ attention: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
256
+ kind: z.ZodLiteral<"workspace-unavailable">;
257
+ path: z.ZodString;
258
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
259
+ kind: z.ZodLiteral<"workspace-unappointed">;
260
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
261
+ kind: z.ZodLiteral<"workspace-failed">;
262
+ path: z.ZodString;
263
+ diagnostic: z.ZodString;
264
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
265
+ kind: z.ZodLiteral<"merge-in-progress">;
266
+ path: z.ZodString;
267
+ conflicts: z.ZodExactOptional<z.ZodNumber>;
268
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
269
+ kind: z.ZodLiteral<"target-behind">;
270
+ behind: z.ZodNumber;
271
+ subject: z.ZodExactOptional<z.ZodString>;
272
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
273
+ kind: z.ZodLiteral<"target-unknown">;
274
+ subject: z.ZodExactOptional<z.ZodString>;
275
+ }, z.core.$strict>>]>>>>;
276
+ }, z.core.$strict>>>;
72
277
  terminal: z.ZodExactOptional<z.ZodEnum<{
73
278
  claimed: "claimed";
74
279
  abandoned: "abandoned";
@@ -90,4 +295,11 @@ export type ValidatedWait = Readonly<{
90
295
  }>;
91
296
  export declare function validateContractWait(scope: RepositoryScope, input: unknown): ValidatedWait;
92
297
  export declare function validateContractWaitHandle(scope: RepositoryScope, id: ContractId, input?: ContractWaitOptions): ValidatedWait;
298
+ /** One invocation's journal baselines and witnessed progress, shared with mixed observation. */
299
+ export declare function createContractWaitObserver(scope: RepositoryScope, ids: readonly ContractId[]): {
300
+ members: () => readonly ContractWaitMember[];
301
+ reason: (completion: "any" | "all") => "deadline" | "missing" | "terminal" | "changed" | undefined;
302
+ satisfied: () => ContractId[];
303
+ observe(signal?: AbortSignal): Promise<void>;
304
+ };
93
305
  export declare function waitContractLocal(input: ValidatedWait): Promise<ContractWaitResult>;
@@ -6,6 +6,7 @@ import { observeContractsForAdmissionAt } from "../git/observe.js";
6
6
  import { withGitDecodeChannel } from "../git/read-observation.js";
7
7
  import { callerContractId, optionalSignal, requireInput } from "./input.js";
8
8
  import { readContractValue } from "./outcome.js";
9
+ import { contractSummarySchema, summaryFor } from "../protocol/read/status.js";
9
10
  const waitDurationDiagnostic = "timeoutMs must be a nonnegative finite integer millisecond duration";
10
11
  export const contractWaitDurationSchema = z
11
12
  .number({ error: waitDurationDiagnostic })
@@ -18,6 +19,7 @@ export const contractWaitMemberSchema = z
18
19
  changed: z.literal(true).exactOptional(),
19
20
  presence: z.enum(["missing", "unknown"]).exactOptional(),
20
21
  terminal: z.enum(["claimed", "abandoned"]).exactOptional(),
22
+ summary: contractSummarySchema.exactOptional(),
21
23
  })
22
24
  .readonly();
23
25
  function waitResultSchema(reason, contracts) {
@@ -67,10 +69,12 @@ function validateContractWaitValues(values, scope) {
67
69
  ...(signal === undefined ? {} : { signal }),
68
70
  };
69
71
  }
72
+ function satisfied(member) {
73
+ return member.present === true && (member.changed || member.terminal !== null);
74
+ }
70
75
  function readiness(members, completion) {
71
76
  if (members.some((member) => member.present === false))
72
77
  return "missing";
73
- const satisfied = (member) => member.present === true && (member.changed || member.terminal !== null);
74
78
  if (completion === "any" ? members.some(satisfied) : members.every(satisfied))
75
79
  return members.some((member) => member.changed) ? "changed" : "terminal";
76
80
  return undefined;
@@ -88,9 +92,59 @@ function waitResult(members, reason) {
88
92
  ? { presence: "missing" }
89
93
  : {}),
90
94
  ...(member.terminal === null ? {} : { terminal: member.terminal }),
95
+ ...(member.summary === undefined ? {} : { summary: member.summary }),
91
96
  })),
92
97
  };
93
98
  }
99
+ /** One invocation's journal baselines and witnessed progress, shared with mixed observation. */
100
+ export function createContractWaitObserver(scope, ids) {
101
+ let initialized = false;
102
+ let members = ids.map((id) => ({
103
+ id,
104
+ baseline: null,
105
+ changed: false,
106
+ present: null,
107
+ terminal: null,
108
+ }));
109
+ return {
110
+ members: () => waitResult(members, "deadline").contracts,
111
+ reason: (completion) => readiness(members, completion),
112
+ satisfied: () => members.filter(satisfied).map((member) => member.id),
113
+ async observe(signal) {
114
+ const reading = { ...scope, ...(signal === undefined ? {} : { signal }) };
115
+ const states = await readContractValue(() => withGitDecodeChannel(reading, async (channel) => {
116
+ const observed = await observeContractsForAdmissionAt(reading, channel, ids);
117
+ return ids.map((id) => {
118
+ const record = observed.journals.get(id);
119
+ if (record === undefined)
120
+ throw new Error(`missing requested contract observation: ${id}`);
121
+ return {
122
+ state: record.state,
123
+ ...(record.state === null
124
+ ? {}
125
+ : {
126
+ summary: summaryFor({ state: record.state, bindAt: record.entries[0].at }),
127
+ }),
128
+ };
129
+ });
130
+ }));
131
+ signal?.throwIfAborted();
132
+ members = members.map((member, index) => {
133
+ const { state, summary } = states[index];
134
+ const { summary: _previous, ...prior } = member;
135
+ return {
136
+ ...prior,
137
+ ...(summary === undefined ? {} : { summary }),
138
+ baseline: initialized ? member.baseline : (state?.head ?? null),
139
+ changed: member.changed || (initialized && state !== null && state.head !== member.baseline),
140
+ present: state !== null,
141
+ terminal: state?.terminal?.kind ?? null,
142
+ };
143
+ });
144
+ initialized = true;
145
+ },
146
+ };
147
+ }
94
148
  export async function waitContractLocal(input) {
95
149
  const { ids, completion, timeoutMs, signal } = input;
96
150
  signal?.throwIfAborted();
@@ -108,57 +162,19 @@ export async function waitContractLocal(input) {
108
162
  if (timeoutMs !== undefined && timeoutMs > 0)
109
163
  scheduleDeadline();
110
164
  const readSignal = signal === undefined ? deadlineController.signal : AbortSignal.any([signal, deadlineController.signal]);
111
- const scope = { ...input.scope, signal: readSignal };
112
- const read = async () => await readContractValue(() => withGitDecodeChannel(scope, async (channel) => {
113
- const observed = await observeContractsForAdmissionAt(scope, channel, ids);
114
- return ids.map((id) => {
115
- const record = observed.journals.get(id);
116
- if (record === undefined)
117
- throw new Error(`missing requested contract observation: ${id}`);
118
- return record.state;
119
- });
120
- }));
121
- let members = ids.map((id) => ({
122
- id,
123
- baseline: null,
124
- changed: false,
125
- present: null,
126
- terminal: null,
127
- }));
128
- const result = (reason) => waitResult(members, reason);
165
+ const observer = createContractWaitObserver(input.scope, ids);
166
+ const result = (reason) => ({
167
+ kind: "contract",
168
+ reason,
169
+ contracts: observer.members(),
170
+ });
129
171
  try {
130
- const initial = await read();
131
- signal?.throwIfAborted();
132
- members = members.map((member, index) => {
133
- const state = initial[index] ?? null;
134
- return {
135
- ...member,
136
- baseline: state?.head ?? null,
137
- present: state !== null,
138
- terminal: state?.terminal?.kind ?? null,
139
- };
140
- });
141
- const initialResult = readiness(members, completion);
142
- if (initialResult !== undefined)
143
- return result(initialResult);
144
- if (performance.now() >= deadline)
145
- return result("deadline");
146
172
  for (;;) {
147
- const states = await read();
173
+ await observer.observe(readSignal);
148
174
  signal?.throwIfAborted();
149
- members = members.map((member, index) => {
150
- const state = states[index] ?? null;
151
- const head = state?.head ?? null;
152
- return {
153
- ...member,
154
- present: state !== null,
155
- terminal: state?.terminal?.kind ?? null,
156
- changed: member.changed || (state !== null && head !== member.baseline),
157
- };
158
- });
159
- const observedResult = readiness(members, completion);
160
- if (observedResult !== undefined)
161
- return result(observedResult);
175
+ const reason = observer.reason(completion);
176
+ if (reason !== undefined)
177
+ return result(reason);
162
178
  const remaining = deadline - performance.now();
163
179
  if (remaining <= 0)
164
180
  return result("deadline");
@@ -28,6 +28,11 @@ export declare const deliverPlacementSchema: z.ZodUnion<readonly [z.ZodReadonly<
28
28
  requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
29
29
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
30
30
  state: z.ZodLiteral<"stale">;
31
+ reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
32
+ kind: z.ZodLiteral<"snapshot-changed">;
33
+ previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
34
+ currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
35
+ }, z.core.$strict>>>;
31
36
  previousContentId: z.ZodExactOptional<z.ZodString>;
32
37
  currentContentId: z.ZodExactOptional<z.ZodString>;
33
38
  gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
@@ -143,6 +148,11 @@ export declare const deliveredValueSchema: z.ZodReadonly<z.ZodObject<{
143
148
  requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
144
149
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
145
150
  state: z.ZodLiteral<"stale">;
151
+ reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
152
+ kind: z.ZodLiteral<"snapshot-changed">;
153
+ previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
154
+ currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
155
+ }, z.core.$strict>>>;
146
156
  previousContentId: z.ZodExactOptional<z.ZodString>;
147
157
  currentContentId: z.ZodExactOptional<z.ZodString>;
148
158
  gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
@@ -252,6 +262,11 @@ export declare const deliveredValueSchema: z.ZodReadonly<z.ZodObject<{
252
262
  requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
253
263
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
254
264
  state: z.ZodLiteral<"stale">;
265
+ reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
266
+ kind: z.ZodLiteral<"snapshot-changed">;
267
+ previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
268
+ currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
269
+ }, z.core.$strict>>>;
255
270
  previousContentId: z.ZodExactOptional<z.ZodString>;
256
271
  currentContentId: z.ZodExactOptional<z.ZodString>;
257
272
  gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
@@ -370,6 +385,11 @@ export declare const deliverySchema: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
370
385
  requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
371
386
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
372
387
  state: z.ZodLiteral<"stale">;
388
+ reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
389
+ kind: z.ZodLiteral<"snapshot-changed">;
390
+ previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
391
+ currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
392
+ }, z.core.$strict>>>;
373
393
  previousContentId: z.ZodExactOptional<z.ZodString>;
374
394
  currentContentId: z.ZodExactOptional<z.ZodString>;
375
395
  gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
@@ -479,6 +499,11 @@ export declare const deliverySchema: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
479
499
  requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
480
500
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
481
501
  state: z.ZodLiteral<"stale">;
502
+ reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
503
+ kind: z.ZodLiteral<"snapshot-changed">;
504
+ previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
505
+ currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").SnapshotId, string>>;
506
+ }, z.core.$strict>>>;
482
507
  previousContentId: z.ZodExactOptional<z.ZodString>;
483
508
  currentContentId: z.ZodExactOptional<z.ZodString>;
484
509
  gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
@@ -3,37 +3,19 @@ import type { DecodedContractDocument } from "../body/types.js";
3
3
  import { type ContractId, type ContractTerms, type Gate } from "../core/facts/types.js";
4
4
  import { type DebtId } from "../debt/identity.js";
5
5
  import type { DocumentDerivation } from "../protocol/operations.js";
6
- export declare const amendInputSchemas: readonly [z.ZodObject<{
7
- markdown: z.ZodNonOptional<z.ZodExactOptional<z.ZodString>>;
6
+ /** Every amendment field is optional; naming none requests an unchanged, fact-free amendment. */
7
+ export declare const amendInputSchema: z.ZodObject<{
8
+ target: z.ZodExactOptional<z.ZodString>;
9
+ edits: z.ZodExactOptional<z.ZodString>;
8
10
  after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
9
11
  gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
10
- }, z.core.$strict>, z.ZodObject<{
11
- markdown: z.ZodExactOptional<z.ZodString>;
12
- after: z.ZodNonOptional<z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>>;
13
- gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
14
- }, z.core.$strict>, z.ZodObject<{
15
- markdown: z.ZodExactOptional<z.ZodString>;
16
- after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
17
- gates: z.ZodNonOptional<z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>>;
18
- }, z.core.$strict>];
19
- export declare const amendInputSchema: z.ZodUnion<readonly [z.ZodObject<{
20
- markdown: z.ZodNonOptional<z.ZodExactOptional<z.ZodString>>;
21
- after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
22
- gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
23
- }, z.core.$strict>, z.ZodObject<{
24
- markdown: z.ZodExactOptional<z.ZodString>;
25
- after: z.ZodNonOptional<z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>>;
26
- gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
27
- }, z.core.$strict>, z.ZodObject<{
28
- markdown: z.ZodExactOptional<z.ZodString>;
29
- after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
30
- gates: z.ZodNonOptional<z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>>;
31
- }, z.core.$strict>]>;
12
+ }, z.core.$strict>;
32
13
  export declare function requireMarkdown(value: unknown, label?: string): string;
33
14
  /** Core contract parsing stays foundational; the caller boundary declares the category once. */
34
15
  export declare function callerContractId(value: string): ContractId;
35
16
  export declare function requireInput(value: unknown, label: string, allowed?: readonly string[]): Record<string, unknown>;
36
17
  export declare function debtOption(value: unknown): DebtId | undefined;
18
+ export declare function nonblank(value: unknown, label: string): string;
37
19
  export declare function optionalNonblank(value: unknown, label: string): string | undefined;
38
20
  export declare function optionalBoolean(value: unknown, label: string): boolean | undefined;
39
21
  export declare function optionalSignal(value: unknown): AbortSignal | undefined;
@@ -41,5 +23,5 @@ export declare function normalizedList<T>(values: unknown, label: string, brand:
41
23
  export declare function contractTerms(document: DecodedContractDocument, gates: readonly Gate[], after: readonly ContractId[]): ContractTerms;
42
24
  export declare function documentDerivation(document: DecodedContractDocument): DocumentDerivation;
43
25
  /** Early CLI acquisition uses the same Library caller boundary, never document-owner capabilities. */
44
- export declare function validateContractMarkdown(markdown: string): void;
45
- export declare function validateArcMarkdown(markdown: string): void;
26
+ export declare function validateContractMarkdown(terms: string): void;
27
+ export declare function validateArcMarkdown(body: string): void;