@inflatable-cookie/longhorn 0.1.0

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 (178) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -0
  3. package/package.json +205 -0
  4. package/src/agent-control/index.ts +20 -0
  5. package/src/agent-control/inject.ts +4 -0
  6. package/src/agent-control/shim.ts +722 -0
  7. package/src/bridge/direct.ts +22 -0
  8. package/src/bridge/generated/fields.ts +32 -0
  9. package/src/bridge/generated/protocol.ts +218 -0
  10. package/src/bridge/generated/variant-fields.ts +10 -0
  11. package/src/bridge/index.ts +15 -0
  12. package/src/bridge/job.ts +51 -0
  13. package/src/bridge/loopback.ts +84 -0
  14. package/src/bridge/operation.ts +166 -0
  15. package/src/bridge/router.ts +71 -0
  16. package/src/bridge/runtime/connection.ts +318 -0
  17. package/src/bridge/runtime/policy.ts +89 -0
  18. package/src/bridge/runtime/retry.ts +60 -0
  19. package/src/bridge/runtime.ts +3 -0
  20. package/src/bridge/session.ts +67 -0
  21. package/src/bridge/stream/connection.ts +146 -0
  22. package/src/bridge/stream/source.ts +61 -0
  23. package/src/bridge/stream/tracker.ts +109 -0
  24. package/src/bridge/stream.ts +6 -0
  25. package/src/bridge/supervision.ts +204 -0
  26. package/src/bridge/validation/base.ts +164 -0
  27. package/src/bridge/validation/jobs.ts +105 -0
  28. package/src/bridge/validation/negotiation.ts +242 -0
  29. package/src/bridge/validation/operations.ts +213 -0
  30. package/src/bridge/validation/streams.ts +47 -0
  31. package/src/bridge/validation.ts +5 -0
  32. package/src/commands/client.ts +124 -0
  33. package/src/commands/controller.ts +411 -0
  34. package/src/commands/generated/fields.ts +43 -0
  35. package/src/commands/generated/protocol.ts +876 -0
  36. package/src/commands/generated/variant-fields.ts +88 -0
  37. package/src/commands/index.ts +13 -0
  38. package/src/commands/keyboard.ts +361 -0
  39. package/src/commands/ports.ts +82 -0
  40. package/src/commands/projectors.ts +306 -0
  41. package/src/commands/validation.ts +444 -0
  42. package/src/config/client.ts +215 -0
  43. package/src/config/generated/base.ts +714 -0
  44. package/src/config/generated/fields.ts +54 -0
  45. package/src/config/generated/label-template.ts +14 -0
  46. package/src/config/generated/labels.ts +30 -0
  47. package/src/config/generated/protocol.ts +3 -0
  48. package/src/config/generated/restore.ts +658 -0
  49. package/src/config/generated/variant-fields.ts +129 -0
  50. package/src/config/index.ts +12 -0
  51. package/src/config/names.ts +19 -0
  52. package/src/config/validation/commands.ts +155 -0
  53. package/src/config/validation/outcomes.ts +243 -0
  54. package/src/config/validation/primitives.ts +174 -0
  55. package/src/config/validation/projection.ts +351 -0
  56. package/src/config/validation.ts +7 -0
  57. package/src/core/connection.ts +252 -0
  58. package/src/core/index.ts +2 -0
  59. package/src/core/transport.ts +24 -0
  60. package/src/history/client.ts +65 -0
  61. package/src/history/controller.ts +385 -0
  62. package/src/history/direct.ts +21 -0
  63. package/src/history/generated/fields.ts +18 -0
  64. package/src/history/generated/protocol.ts +389 -0
  65. package/src/history/generated/variant-fields.ts +27 -0
  66. package/src/history/index.ts +13 -0
  67. package/src/history/ports.ts +31 -0
  68. package/src/history/serialized.ts +38 -0
  69. package/src/history/validation.ts +334 -0
  70. package/src/history-tree/client.ts +16 -0
  71. package/src/history-tree/controller.ts +199 -0
  72. package/src/history-tree/direct.ts +3 -0
  73. package/src/history-tree/generated/fields.ts +26 -0
  74. package/src/history-tree/generated/protocol.ts +711 -0
  75. package/src/history-tree/generated/variant-fields.ts +39 -0
  76. package/src/history-tree/index.ts +13 -0
  77. package/src/history-tree/ports.ts +43 -0
  78. package/src/history-tree/serialized.ts +15 -0
  79. package/src/history-tree/validation.ts +269 -0
  80. package/src/layout/generated/protocol.ts +289 -0
  81. package/src/layout/index.ts +4 -0
  82. package/src/layout/ratio.ts +22 -0
  83. package/src/layout/validation.ts +110 -0
  84. package/src/layout/visibility.ts +30 -0
  85. package/src/licence/client.ts +32 -0
  86. package/src/licence/controller.ts +301 -0
  87. package/src/licence/direct.ts +3 -0
  88. package/src/licence/generated/fields.ts +17 -0
  89. package/src/licence/generated/key-conformance.json +42 -0
  90. package/src/licence/generated/protocol.ts +249 -0
  91. package/src/licence/generated/variant-fields.ts +34 -0
  92. package/src/licence/index.ts +14 -0
  93. package/src/licence/key.ts +125 -0
  94. package/src/licence/ports.ts +39 -0
  95. package/src/licence/serialized.ts +13 -0
  96. package/src/licence/validation.ts +226 -0
  97. package/src/native-content/client.ts +474 -0
  98. package/src/native-content/direct.ts +16 -0
  99. package/src/native-content/generated/fields.ts +32 -0
  100. package/src/native-content/generated/protocol.ts +498 -0
  101. package/src/native-content/generated/variant-fields.ts +77 -0
  102. package/src/native-content/index.ts +12 -0
  103. package/src/native-content/ports.ts +46 -0
  104. package/src/native-content/serialized.ts +50 -0
  105. package/src/native-content/validation/base.ts +194 -0
  106. package/src/native-content/validation/messages.ts +192 -0
  107. package/src/native-content/validation/state.ts +404 -0
  108. package/src/native-content/validation.ts +7 -0
  109. package/src/notifications/client.ts +106 -0
  110. package/src/notifications/controller.ts +240 -0
  111. package/src/notifications/direct.ts +12 -0
  112. package/src/notifications/generated/fields.ts +19 -0
  113. package/src/notifications/generated/labels.ts +20 -0
  114. package/src/notifications/generated/protocol.ts +522 -0
  115. package/src/notifications/generated/variant-fields.ts +37 -0
  116. package/src/notifications/index.ts +16 -0
  117. package/src/notifications/ports.ts +22 -0
  118. package/src/notifications/serialized.ts +27 -0
  119. package/src/notifications/toast.ts +41 -0
  120. package/src/notifications/tone.ts +27 -0
  121. package/src/notifications/validation.ts +246 -0
  122. package/src/operation/bridge.ts +168 -0
  123. package/src/operation/client.ts +167 -0
  124. package/src/operation/controller.ts +321 -0
  125. package/src/operation/direct.ts +15 -0
  126. package/src/operation/generated/fields.ts +20 -0
  127. package/src/operation/generated/labels.ts +15 -0
  128. package/src/operation/generated/protocol.ts +762 -0
  129. package/src/operation/generated/variant-fields.ts +60 -0
  130. package/src/operation/index.ts +14 -0
  131. package/src/operation/ports.ts +29 -0
  132. package/src/operation/serialized.ts +39 -0
  133. package/src/operation/validation.ts +479 -0
  134. package/src/settings/client.ts +142 -0
  135. package/src/settings/connection.ts +246 -0
  136. package/src/settings/generated/fields.ts +34 -0
  137. package/src/settings/generated/protocol.ts +668 -0
  138. package/src/settings/generated/variant-fields.ts +26 -0
  139. package/src/settings/index.ts +12 -0
  140. package/src/settings/names.ts +8 -0
  141. package/src/settings/registry.ts +141 -0
  142. package/src/settings/validation/authority.ts +66 -0
  143. package/src/settings/validation/command.ts +165 -0
  144. package/src/settings/validation/error.ts +33 -0
  145. package/src/settings/validation/primitives.ts +203 -0
  146. package/src/settings/validation/projection.ts +50 -0
  147. package/src/settings/validation/registry.ts +170 -0
  148. package/src/settings/validation.ts +4 -0
  149. package/src/surface-transfer/client.ts +54 -0
  150. package/src/surface-transfer/generated/fields.ts +12 -0
  151. package/src/surface-transfer/generated/protocol.ts +61 -0
  152. package/src/surface-transfer/generated/variant-fields.ts +30 -0
  153. package/src/surface-transfer/index.ts +9 -0
  154. package/src/surface-transfer/validation.ts +209 -0
  155. package/src/surfaces/client.ts +140 -0
  156. package/src/surfaces/generated/fields.ts +19 -0
  157. package/src/surfaces/generated/protocol.ts +217 -0
  158. package/src/surfaces/generated/variant-fields.ts +42 -0
  159. package/src/surfaces/index.ts +9 -0
  160. package/src/surfaces/validation.ts +199 -0
  161. package/src/transfer/client.ts +133 -0
  162. package/src/transfer/connection.ts +87 -0
  163. package/src/transfer/generated/fields.ts +23 -0
  164. package/src/transfer/generated/protocol.ts +171 -0
  165. package/src/transfer/generated/variant-fields.ts +45 -0
  166. package/src/transfer/index.ts +11 -0
  167. package/src/transfer/payload.ts +71 -0
  168. package/src/transfer/validation.ts +282 -0
  169. package/src/update/client.ts +29 -0
  170. package/src/update/controller.ts +255 -0
  171. package/src/update/direct.ts +3 -0
  172. package/src/update/generated/fields.ts +14 -0
  173. package/src/update/generated/protocol.ts +238 -0
  174. package/src/update/generated/variant-fields.ts +44 -0
  175. package/src/update/index.ts +14 -0
  176. package/src/update/ports.ts +36 -0
  177. package/src/update/serialized.ts +12 -0
  178. package/src/update/validation.ts +191 -0
@@ -0,0 +1,385 @@
1
+ import { HistoryClient } from "./client.ts";
2
+ import {
3
+ HISTORY_PROTOCOL_VERSION,
4
+ type HistoryChangedEvent,
5
+ type HistoryEntryId,
6
+ type HistoryEntryRecord,
7
+ type HistoryNavigationRejectionProjection,
8
+ type HistoryNavigationResult,
9
+ type HistoryNavigationTargetProjection,
10
+ type HistoryPageSnapshot,
11
+ type HistorySnapshot,
12
+ } from "./generated/protocol.ts";
13
+ import { HISTORY_MAXIMUM_PROJECTION_PAGE_SIZE } from "./generated/protocol.ts";
14
+ import type { HistoryPort, HistoryUnlisten } from "./ports.ts";
15
+
16
+ export type HistoryControllerStatus =
17
+ | { readonly kind: "idle" }
18
+ | { readonly kind: "loading" }
19
+ | { readonly kind: "ready" }
20
+ | { readonly kind: "failed"; readonly error: unknown };
21
+
22
+ export interface HistoryControllerOptions {
23
+ readonly port: HistoryPort;
24
+ readonly pageSize?: number;
25
+ }
26
+
27
+ export class HistoryController {
28
+ readonly #client: HistoryClient;
29
+ readonly #observers = new Set<() => void>();
30
+ #status: HistoryControllerStatus = { kind: "idle" };
31
+ #snapshot: HistorySnapshot | undefined;
32
+ #pageSnapshot: HistoryPageSnapshot | undefined;
33
+ #rejection: HistoryNavigationRejectionProjection | undefined;
34
+ #filter = "";
35
+ #page = 1;
36
+ #pageSize: number;
37
+ #navigationPending = false;
38
+ #started = false;
39
+ #lifecycleRevision = 0;
40
+ #loadRevision = 0;
41
+ #navigationRevision = 0;
42
+ #unlisten: HistoryUnlisten[] = [];
43
+
44
+ constructor(options: HistoryControllerOptions) {
45
+ this.#client = new HistoryClient(options.port);
46
+ this.#pageSize = checkedPageSize(options.pageSize ?? 50);
47
+ }
48
+
49
+ get status(): HistoryControllerStatus {
50
+ return this.#status;
51
+ }
52
+
53
+ get snapshot(): HistorySnapshot | undefined {
54
+ return this.#snapshot;
55
+ }
56
+
57
+ get pageSnapshot(): HistoryPageSnapshot | undefined {
58
+ return this.#pageSnapshot;
59
+ }
60
+
61
+ get rejection() {
62
+ return this.#rejection;
63
+ }
64
+
65
+ get filter(): string {
66
+ return this.#filter;
67
+ }
68
+
69
+ get page(): number {
70
+ return this.#page;
71
+ }
72
+
73
+ get pageSize(): number {
74
+ return this.#pageSize;
75
+ }
76
+
77
+ get totalEntries(): number {
78
+ return this.#pageSnapshot?.totalEntries ?? 0;
79
+ }
80
+
81
+ get entries(): readonly HistoryEntryRecord[] {
82
+ const entries = this.#pageSnapshot?.entries ?? [];
83
+ const query = this.#filter.trim().toLocaleLowerCase();
84
+ if (query.length === 0) return entries;
85
+ return entries.filter(
86
+ (entry) =>
87
+ entry.label.toLocaleLowerCase().includes(query) ||
88
+ entry.kindId?.toLocaleLowerCase().includes(query) === true,
89
+ );
90
+ }
91
+
92
+ get navigationPending(): boolean {
93
+ return this.#navigationPending;
94
+ }
95
+
96
+ get canUndo(): boolean {
97
+ return (this.#snapshot?.summary.undoDepth ?? 0) > 0;
98
+ }
99
+
100
+ get canRedo(): boolean {
101
+ return (this.#snapshot?.summary.redoDepth ?? 0) > 0;
102
+ }
103
+
104
+ observe(observer: () => void): () => void {
105
+ this.#observers.add(observer);
106
+ return () => this.#observers.delete(observer);
107
+ }
108
+
109
+ async start(): Promise<void> {
110
+ if (this.#started) return;
111
+ this.#started = true;
112
+ const lifecycleRevision = ++this.#lifecycleRevision;
113
+ this.#setStatus({ kind: "loading" });
114
+ try {
115
+ const unlisten = await this.#client.listen((event) => {
116
+ this.#handleChanged(event);
117
+ });
118
+ if (!this.#isCurrentLifecycle(lifecycleRevision)) {
119
+ await unlisten();
120
+ return;
121
+ }
122
+ this.#unlisten.push(unlisten);
123
+ await this.refresh();
124
+ } catch (error) {
125
+ if (this.#isCurrentLifecycle(lifecycleRevision)) {
126
+ this.#setStatus({ kind: "failed", error });
127
+ }
128
+ }
129
+ }
130
+
131
+ async stop(): Promise<void> {
132
+ this.#started = false;
133
+ this.#lifecycleRevision += 1;
134
+ this.#loadRevision += 1;
135
+ this.#navigationRevision += 1;
136
+ const unlisten = this.#unlisten.splice(0);
137
+ await Promise.allSettled(unlisten.map((dispose) => dispose()));
138
+ this.#snapshot = undefined;
139
+ this.#pageSnapshot = undefined;
140
+ this.#rejection = undefined;
141
+ this.#filter = "";
142
+ this.#page = 1;
143
+ this.#navigationPending = false;
144
+ this.#setStatus({ kind: "idle" });
145
+ }
146
+
147
+ async refresh(): Promise<void> {
148
+ if (!this.#started) return;
149
+ const revision = ++this.#loadRevision;
150
+ try {
151
+ const state = await this.#readAuthoritativeState();
152
+ if (!this.#started || revision !== this.#loadRevision) return;
153
+ this.#install(state.snapshot, state.page);
154
+ this.#setStatus({ kind: "ready" });
155
+ } catch (error) {
156
+ if (this.#started && revision === this.#loadRevision) {
157
+ this.#setStatus({ kind: "failed", error });
158
+ }
159
+ }
160
+ }
161
+
162
+ setFilter(filter: string): void {
163
+ this.#filter = filter;
164
+ this.#notify();
165
+ }
166
+
167
+ async setPage(page: number): Promise<void> {
168
+ this.#page = checkedPage(page);
169
+ await this.refresh();
170
+ }
171
+
172
+ async setPageSize(pageSize: number): Promise<void> {
173
+ this.#pageSize = checkedPageSize(pageSize);
174
+ this.#page = 1;
175
+ await this.refresh();
176
+ }
177
+
178
+ undo(): Promise<HistoryNavigationResult> {
179
+ return this.#navigate({ kind: "undo" });
180
+ }
181
+
182
+ redo(): Promise<HistoryNavigationResult> {
183
+ return this.#navigate({ kind: "redo" });
184
+ }
185
+
186
+ checkout(entryId: HistoryEntryId): Promise<HistoryNavigationResult> {
187
+ return this.#navigate({ kind: "checkout", entryId });
188
+ }
189
+
190
+ /**
191
+ * Return to the position before the oldest retained entry, in one navigation.
192
+ *
193
+ * The state the operator started from is the only one no entry names, so
194
+ * `checkout` cannot reach it and doing so meant one undo per entry. Whether
195
+ * that position is the true origin or a retention baseline is on the page,
196
+ * not here: this only moves.
197
+ */
198
+ checkoutRoot(): Promise<HistoryNavigationResult> {
199
+ return this.#navigate({ kind: "checkoutRoot" });
200
+ }
201
+
202
+ async #navigate(
203
+ target: HistoryNavigationTargetProjection,
204
+ ): Promise<HistoryNavigationResult> {
205
+ const snapshot = this.#snapshot;
206
+ if (!this.#started || snapshot === undefined) {
207
+ throw new HistoryControllerUnavailableError();
208
+ }
209
+ const revision = ++this.#navigationRevision;
210
+ this.#navigationPending = true;
211
+ this.#rejection = undefined;
212
+ this.#notify();
213
+ try {
214
+ const result = await this.#client.navigate({
215
+ protocolVersion: HISTORY_PROTOCOL_VERSION,
216
+ authorityEpoch: snapshot.authorityEpoch,
217
+ historyId: snapshot.summary.historyId,
218
+ planId: this.#client.nextPlanId(),
219
+ expectedRevision: snapshot.summary.revision,
220
+ target,
221
+ });
222
+ if (
223
+ !this.#started ||
224
+ revision !== this.#navigationRevision
225
+ ) {
226
+ throw new HistoryLateResultError();
227
+ }
228
+ this.#rejection =
229
+ result.status === "rejected" ? result.rejection : undefined;
230
+ const page = await this.#readPageForSnapshot(result.snapshot);
231
+ if (
232
+ !this.#started ||
233
+ revision !== this.#navigationRevision
234
+ ) {
235
+ throw new HistoryLateResultError();
236
+ }
237
+ this.#install(result.snapshot, page);
238
+ this.#setStatus({ kind: "ready" });
239
+ return result;
240
+ } catch (error) {
241
+ if (
242
+ this.#started &&
243
+ revision === this.#navigationRevision &&
244
+ !(error instanceof HistoryLateResultError)
245
+ ) {
246
+ this.#setStatus({ kind: "failed", error });
247
+ }
248
+ throw error;
249
+ } finally {
250
+ if (revision === this.#navigationRevision) {
251
+ this.#navigationPending = false;
252
+ this.#notify();
253
+ }
254
+ }
255
+ }
256
+
257
+ async #readAuthoritativeState(): Promise<{
258
+ snapshot: HistorySnapshot;
259
+ page: HistoryPageSnapshot;
260
+ }> {
261
+ for (let attempt = 0; attempt < 2; attempt += 1) {
262
+ const snapshot = await this.#client.snapshot();
263
+ const page = await this.#readPageForSnapshot(snapshot);
264
+ if (sameAuthority(snapshot, page)) return { snapshot, page };
265
+ }
266
+ throw new HistoryProjectionGapError();
267
+ }
268
+
269
+ async #readPageForSnapshot(
270
+ snapshot: HistorySnapshot,
271
+ ): Promise<HistoryPageSnapshot> {
272
+ const maximumPage = Math.max(
273
+ 1,
274
+ Math.ceil(snapshot.summary.retainedEntryCount / this.#pageSize),
275
+ );
276
+ this.#page = Math.min(this.#page, maximumPage);
277
+ return this.#client.page({
278
+ protocolVersion: HISTORY_PROTOCOL_VERSION,
279
+ authorityEpoch: snapshot.authorityEpoch,
280
+ historyId: snapshot.summary.historyId,
281
+ expectedRevision: snapshot.summary.revision,
282
+ offset: (this.#page - 1) * this.#pageSize,
283
+ limit: this.#pageSize,
284
+ });
285
+ }
286
+
287
+ #install(snapshot: HistorySnapshot, page: HistoryPageSnapshot): void {
288
+ if (!sameAuthority(snapshot, page)) throw new HistoryProjectionGapError();
289
+ const current = this.#snapshot;
290
+ if (
291
+ current !== undefined &&
292
+ snapshot.authorityEpoch === current.authorityEpoch &&
293
+ snapshot.summary.historyId === current.summary.historyId &&
294
+ snapshot.summary.revision < current.summary.revision
295
+ ) {
296
+ return;
297
+ }
298
+ this.#snapshot = snapshot;
299
+ this.#pageSnapshot = page;
300
+ this.#notify();
301
+ }
302
+
303
+ #handleChanged(event: HistoryChangedEvent): void {
304
+ if (!this.#started) return;
305
+ const snapshot = this.#snapshot;
306
+ if (snapshot === undefined) {
307
+ void this.refresh();
308
+ return;
309
+ }
310
+ if (
311
+ event.authorityEpoch !== snapshot.authorityEpoch ||
312
+ event.historyId !== snapshot.summary.historyId
313
+ ) {
314
+ void this.refresh();
315
+ return;
316
+ }
317
+ if (event.committedRevision <= snapshot.summary.revision) return;
318
+ void this.refresh();
319
+ }
320
+
321
+ #isCurrentLifecycle(revision: number): boolean {
322
+ return this.#started && revision === this.#lifecycleRevision;
323
+ }
324
+
325
+ #setStatus(status: HistoryControllerStatus): void {
326
+ this.#status = status;
327
+ this.#notify();
328
+ }
329
+
330
+ #notify(): void {
331
+ for (const observer of this.#observers) observer();
332
+ }
333
+ }
334
+
335
+ export class HistoryControllerUnavailableError extends Error {
336
+ constructor() {
337
+ super("history controller has no live authoritative snapshot");
338
+ this.name = "HistoryControllerUnavailableError";
339
+ }
340
+ }
341
+
342
+ export class HistoryProjectionGapError extends Error {
343
+ constructor() {
344
+ super("history page does not match the authoritative snapshot");
345
+ this.name = "HistoryProjectionGapError";
346
+ }
347
+ }
348
+
349
+ export class HistoryLateResultError extends Error {
350
+ constructor() {
351
+ super("history result arrived after its controller lifetime");
352
+ this.name = "HistoryLateResultError";
353
+ }
354
+ }
355
+
356
+ function sameAuthority(
357
+ snapshot: HistorySnapshot,
358
+ page: HistoryPageSnapshot,
359
+ ): boolean {
360
+ return (
361
+ page.authorityEpoch === snapshot.authorityEpoch &&
362
+ page.historyId === snapshot.summary.historyId &&
363
+ page.revision === snapshot.summary.revision
364
+ );
365
+ }
366
+
367
+ function checkedPage(value: number): number {
368
+ if (!Number.isSafeInteger(value) || value < 1) {
369
+ throw new RangeError("history page must be a positive safe integer");
370
+ }
371
+ return value;
372
+ }
373
+
374
+ function checkedPageSize(value: number): number {
375
+ if (
376
+ !Number.isSafeInteger(value) ||
377
+ value < 1 ||
378
+ value > HISTORY_MAXIMUM_PROJECTION_PAGE_SIZE
379
+ ) {
380
+ throw new RangeError(
381
+ `history page size must be between 1 and ${HISTORY_MAXIMUM_PROJECTION_PAGE_SIZE}`,
382
+ );
383
+ }
384
+ return value;
385
+ }
@@ -0,0 +1,21 @@
1
+ import type { HistoryPort } from "./ports.ts";
2
+
3
+ export interface DirectHistoryHandlers {
4
+ readonly snapshot: HistoryPort["snapshot"];
5
+ readonly page: HistoryPort["page"];
6
+ readonly navigate: HistoryPort["navigate"];
7
+ readonly listen?: HistoryPort["listen"];
8
+ readonly nextPlanId: HistoryPort["nextPlanId"];
9
+ }
10
+
11
+ export function createDirectHistoryPort(
12
+ handlers: DirectHistoryHandlers,
13
+ ): HistoryPort {
14
+ return {
15
+ snapshot: handlers.snapshot,
16
+ page: handlers.page,
17
+ navigate: handlers.navigate,
18
+ listen: handlers.listen,
19
+ nextPlanId: handlers.nextPlanId,
20
+ };
21
+ }
@@ -0,0 +1,18 @@
1
+ // @generated by `effigy generate:history`; do not edit.
2
+ // Allowed field names per protocol type, from the Rust structs.
3
+ // A `record()` given one of these rejects unknown and missing keys —
4
+ // contract 010's Boundary Validation Target.
5
+
6
+ export const HISTORY_FIELDS: Record<string, readonly string[]> = {
7
+ "HistoryBaselineProjection": ["prunedEntryCount", "prunedEncodedWeight", "lastPrunedEntryId", "lastPrunedSequence"],
8
+ "HistorySummaryProjection": ["historyId", "revision", "mode", "undoDepth", "redoDepth", "currentEntryId", "nextUndoLabel", "nextRedoLabel", "retainedEntryCount", "retainedEncodedWeight", "retainedBaseline"],
9
+ "HistorySnapshot": ["protocolVersion", "authorityEpoch", "summary"],
10
+ "HistoryEntryRecord": ["entryId", "label", "kindId", "groupId", "recordedAt", "sequence", "committedRevision", "encodedWeight", "position"],
11
+ "HistoryPageCommand": ["protocolVersion", "authorityEpoch", "historyId", "expectedRevision", "offset", "limit"],
12
+ "HistoryPageSnapshot": ["protocolVersion", "authorityEpoch", "historyId", "revision", "offset", "totalEntries", "entries", "truncatedBefore", "truncatedAfter", "retainedBaseline", "floor"],
13
+ "HistoryNavigationCommand": ["protocolVersion", "authorityEpoch", "historyId", "planId", "expectedRevision", "target"],
14
+ "HistoryNavigationPositionProjection": ["appliedDepth", "futureDepth", "currentEntryId", "nextUndoLabel", "nextRedoEntryId", "nextRedoLabel"],
15
+ "HistoryNavigationReceiptProjection": ["historyId", "planId", "previousRevision", "committedRevision", "direction", "movedEntryIds", "sourcePosition", "authoritativePosition"],
16
+ "HistoryNavigationRejectionProjection": ["code", "detail", "refreshRequired"],
17
+ "HistoryChangedEvent": ["protocolVersion", "authorityEpoch", "historyId", "previousRevision", "committedRevision", "kind"],
18
+ };