@astrosheep/keiyaku 4.6.33 → 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 (118) hide show
  1. package/README.md +10 -1
  2. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +5 -2
  3. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +2 -1
  4. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +5 -2
  5. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +2 -1
  6. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +5 -2
  7. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +2 -1
  8. package/build/plugins/pi/keiyaku.ts +1 -135
  9. package/build/skills/keiyaku-akuma/SKILL.md +5 -2
  10. package/build/skills/keiyaku-debt/SKILL.md +2 -1
  11. package/build/src/akuma/akuma-observe.d.ts +8 -0
  12. package/build/src/akuma/akuma-observe.js +8 -0
  13. package/build/src/akuma/akuma-owner.d.ts +1 -0
  14. package/build/src/akuma/akuma-owner.js +3 -5
  15. package/build/src/akuma/akuma-wait.d.ts +117 -2
  16. package/build/src/akuma/akuma-wait.js +53 -22
  17. package/build/src/akuma/akuma.d.ts +6 -1
  18. package/build/src/akuma/akuma.js +37 -18
  19. package/build/src/akuma/heart/facts.d.ts +1 -0
  20. package/build/src/akuma/heart/facts.js +14 -0
  21. package/build/src/akuma/heart/index.d.ts +6 -0
  22. package/build/src/akuma/heart/index.js +27 -9
  23. package/build/src/akuma/heart/rows.d.ts +1 -0
  24. package/build/src/akuma/heart/rows.js +4 -0
  25. package/build/src/akuma/lineage-cache.d.ts +7 -2
  26. package/build/src/akuma/lineage-cache.js +48 -24
  27. package/build/src/akuma/projection-read.js +4 -9
  28. package/build/src/akuma/selection-observation.d.ts +622 -0
  29. package/build/src/akuma/selection-observation.js +7 -3
  30. package/build/src/bounded-list.d.ts +8 -0
  31. package/build/src/bounded-list.js +10 -0
  32. package/build/src/cli/commands/akuma-grammar.d.ts +2 -3
  33. package/build/src/cli/commands/akuma-grammar.js +32 -39
  34. package/build/src/cli/commands/akuma.js +6 -3
  35. package/build/src/cli/commands/contract-grammar.js +32 -31
  36. package/build/src/cli/commands/contract-help.d.ts +3 -3
  37. package/build/src/cli/commands/contract-help.js +10 -8
  38. package/build/src/cli/commands/contract.d.ts +3 -3
  39. package/build/src/cli/commands/contract.js +11 -10
  40. package/build/src/cli/parse.d.ts +4 -10
  41. package/build/src/cli/parse.js +1 -1
  42. package/build/src/cli/render/akuma-activity.d.ts +9 -19
  43. package/build/src/cli/render/akuma-activity.js +83 -110
  44. package/build/src/cli/render/catalog.js +3 -2
  45. package/build/src/cli/render/contract-history.d.ts +1 -3
  46. package/build/src/cli/render/contract-history.js +68 -49
  47. package/build/src/cli/render/contract-wait.js +9 -1
  48. package/build/src/cli/render/kanshi-akuma.d.ts +4 -3
  49. package/build/src/cli/render/kanshi-akuma.js +26 -21
  50. package/build/src/cli/render/kanshi.js +34 -43
  51. package/build/src/cli/render/verbs.js +20 -17
  52. package/build/src/cli/runtime.js +9 -23
  53. package/build/src/debt/board.d.ts +2 -1
  54. package/build/src/debt/board.js +3 -3
  55. package/build/src/debt/catalog.js +2 -1
  56. package/build/src/debt/document.d.ts +1 -0
  57. package/build/src/debt/document.js +3 -0
  58. package/build/src/debt/index.d.ts +2 -1
  59. package/build/src/debt/index.js +3 -3
  60. package/build/src/debt/operations.d.ts +2 -1
  61. package/build/src/git/observe.d.ts +4 -3
  62. package/build/src/git/observe.js +8 -7
  63. package/build/src/history.d.ts +26 -0
  64. package/build/src/history.js +43 -0
  65. package/build/src/index.d.ts +4 -3
  66. package/build/src/kanshi/counts.d.ts +15 -1
  67. package/build/src/kanshi/counts.js +14 -3
  68. package/build/src/kanshi/index.d.ts +3 -3
  69. package/build/src/kanshi/index.js +2 -2
  70. package/build/src/kanshi/read.js +5 -2
  71. package/build/src/library/akumas.d.ts +5 -1
  72. package/build/src/library/akumas.js +11 -5
  73. package/build/src/library/contract-composition.js +10 -10
  74. package/build/src/library/contract-creation.js +2 -2
  75. package/build/src/library/contract-types.d.ts +215 -25
  76. package/build/src/library/contract-types.js +31 -13
  77. package/build/src/library/contract-wait.d.ts +205 -0
  78. package/build/src/library/contract-wait.js +15 -3
  79. package/build/src/library/input.d.ts +3 -3
  80. package/build/src/library/input.js +5 -5
  81. package/build/src/library/kei.js +134 -76
  82. package/build/src/library/keiyaku-attribution.d.ts +1 -1
  83. package/build/src/library/keiyaku-attribution.js +3 -1
  84. package/build/src/library/keiyaku-classify.js +5 -1
  85. package/build/src/library/keiyaku-debt.d.ts +8 -7
  86. package/build/src/library/keiyaku-identity.d.ts +4 -3
  87. package/build/src/library/keiyaku-identity.js +30 -7
  88. package/build/src/library/keiyaku-verbs.d.ts +515 -44
  89. package/build/src/library/keiyaku-verbs.js +84 -79
  90. package/build/src/library/keiyaku-wait.d.ts +570 -0
  91. package/build/src/library/keiyaku-wait.js +25 -8
  92. package/build/src/library/keiyaku.d.ts +3110 -31
  93. package/build/src/library/keiyaku.js +335 -407
  94. package/build/src/library/model-tools.d.ts +268 -70
  95. package/build/src/library/model-tools.js +110 -95
  96. package/build/src/library/selection.d.ts +6 -5
  97. package/build/src/library/selection.js +10 -3
  98. package/build/src/mcp/adapter.js +1 -1
  99. package/build/src/mcp/help.d.ts +1 -1
  100. package/build/src/mcp/help.js +4 -3
  101. package/build/src/pi/index.d.ts +2 -0
  102. package/build/src/pi/index.js +23 -7
  103. package/build/src/pi/status.d.ts +12 -0
  104. package/build/src/pi/status.js +140 -0
  105. package/build/src/protocol/operations.d.ts +2 -0
  106. package/build/src/protocol/operations.js +1 -1
  107. package/build/src/protocol/read/status.d.ts +12 -4
  108. package/build/src/protocol/read/status.js +19 -12
  109. package/build/src/runtime/proc/windows-launch.exe +0 -0
  110. package/package.json +1 -1
  111. package/plugins/paseo/plugin/index.server.ts +6 -2
  112. package/plugins/paseo/plugin/server/attach.ts +68 -48
  113. package/plugins/paseo/plugin/server/directory.ts +259 -0
  114. package/plugins/paseo/plugin/server/mirror-identity.ts +3 -32
  115. package/plugins/paseo/plugin/server/reopen.ts +52 -38
  116. package/plugins/pi/keiyaku.ts +1 -135
  117. package/skills/keiyaku-akuma/SKILL.md +5 -2
  118. package/skills/keiyaku-debt/SKILL.md +2 -1
@@ -1,33 +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", {
29
33
  target: historyTarget.exactOptional(),
30
- targetIncarnation: z.strictObject({ id: z.string(), identity: z.string() }).readonly().exactOptional(),
34
+ targetIncarnation: historyIncarnation.exactOptional(),
31
35
  changedSections: z.array(z.string()).readonly().exactOptional(),
32
36
  gates: historyGates,
33
37
  after: historyAfter,
@@ -49,23 +53,24 @@ export const contractHistoryEventSchema = z.union([
49
53
  subject: z.string(),
50
54
  summary: z.string().exactOptional(),
51
55
  }),
52
- historyEvent("claimed", { deliveryId: entryUlidSchema }),
56
+ historyEvent("claimed", { deliveryId: canonicalDecimalSchema }),
53
57
  historyEvent("arc", { chapter: z.number().int().positive(), title: z.string(), body: z.string().exactOptional() }),
54
58
  historyEvent("abandoned", { note: z.string().exactOptional() }),
55
- z
56
- .strictObject({
57
- kind: z.literal("dispatch"),
58
- at: z.string(),
59
- akumaId: akumaIdSchema,
60
- })
61
- .readonly(),
62
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]);
63
65
  export const contractHistorySchema = z.union([
64
66
  z
65
67
  .strictObject({
66
68
  kind: z.literal("contract"),
67
69
  contractId: contractIdSchema,
68
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(),
69
74
  dispatches: z
70
75
  .strictObject({
71
76
  kind: z.literal("unavailable"),
@@ -76,8 +81,21 @@ export const contractHistorySchema = z.union([
76
81
  .exactOptional(),
77
82
  })
78
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(),
79
92
  z.strictObject({ kind: z.literal("contract-missing"), contractId: contractIdSchema }).readonly(),
80
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
+ ]);
81
99
  export const contractSelectorRefusalSchema = z.union([
82
100
  z.strictObject({ kind: z.literal("invalid-selector"), selector: z.string(), diagnostic: z.string() }).readonly(),
83
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";
@@ -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) {
@@ -90,6 +92,7 @@ function waitResult(members, reason) {
90
92
  ? { presence: "missing" }
91
93
  : {}),
92
94
  ...(member.terminal === null ? {} : { terminal: member.terminal }),
95
+ ...(member.summary === undefined ? {} : { summary: member.summary }),
93
96
  })),
94
97
  };
95
98
  }
@@ -115,14 +118,23 @@ export function createContractWaitObserver(scope, ids) {
115
118
  const record = observed.journals.get(id);
116
119
  if (record === undefined)
117
120
  throw new Error(`missing requested contract observation: ${id}`);
118
- return record.state;
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
+ };
119
129
  });
120
130
  }));
121
131
  signal?.throwIfAborted();
122
132
  members = members.map((member, index) => {
123
- const state = states[index] ?? null;
133
+ const { state, summary } = states[index];
134
+ const { summary: _previous, ...prior } = member;
124
135
  return {
125
- ...member,
136
+ ...prior,
137
+ ...(summary === undefined ? {} : { summary }),
126
138
  baseline: initialized ? member.baseline : (state?.head ?? null),
127
139
  changed: member.changed || (initialized && state !== null && state.head !== member.baseline),
128
140
  present: state !== null,
@@ -6,7 +6,7 @@ import type { DocumentDerivation } from "../protocol/operations.js";
6
6
  /** Every amendment field is optional; naming none requests an unchanged, fact-free amendment. */
7
7
  export declare const amendInputSchema: z.ZodObject<{
8
8
  target: z.ZodExactOptional<z.ZodString>;
9
- markdown: z.ZodExactOptional<z.ZodString>;
9
+ edits: z.ZodExactOptional<z.ZodString>;
10
10
  after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
11
11
  gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
12
12
  }, z.core.$strict>;
@@ -23,5 +23,5 @@ export declare function normalizedList<T>(values: unknown, label: string, brand:
23
23
  export declare function contractTerms(document: DecodedContractDocument, gates: readonly Gate[], after: readonly ContractId[]): ContractTerms;
24
24
  export declare function documentDerivation(document: DecodedContractDocument): DocumentDerivation;
25
25
  /** Early CLI acquisition uses the same Library caller boundary, never document-owner capabilities. */
26
- export declare function validateContractMarkdown(markdown: string): void;
27
- export declare function validateArcMarkdown(markdown: string): void;
26
+ export declare function validateContractMarkdown(terms: string): void;
27
+ export declare function validateArcMarkdown(body: string): void;
@@ -12,7 +12,7 @@ export const amendInputSchema = z.strictObject({
12
12
  .string()
13
13
  .refine((value) => value.trim() !== "", "target must be nonblank")
14
14
  .exactOptional(),
15
- markdown: z.string().exactOptional(),
15
+ edits: z.string().exactOptional(),
16
16
  after: z.array(z.string()).readonly().exactOptional(),
17
17
  gates: z.array(z.string()).readonly().exactOptional(),
18
18
  });
@@ -109,9 +109,9 @@ export function documentDerivation(document) {
109
109
  };
110
110
  }
111
111
  /** Early CLI acquisition uses the same Library caller boundary, never document-owner capabilities. */
112
- export function validateContractMarkdown(markdown) {
113
- decodeContractDocument(requireMarkdown(markdown), { requireTimeout: true });
112
+ export function validateContractMarkdown(terms) {
113
+ decodeContractDocument(requireMarkdown(terms, "terms"), { requireTimeout: true });
114
114
  }
115
- export function validateArcMarkdown(markdown) {
116
- decodeArcDocument(requireMarkdown(markdown));
115
+ export function validateArcMarkdown(body) {
116
+ decodeArcDocument(requireMarkdown(body, "body"));
117
117
  }