@inflatable-cookie/longhorn 0.5.0 → 0.7.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 (167) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -7
  3. package/src/agent-control/generated/protocol.ts +228 -0
  4. package/src/agent-control/index.ts +1 -5
  5. package/src/agent-control/inject.ts +4 -1
  6. package/src/agent-control/selection.ts +42 -25
  7. package/src/agent-control/shim.ts +428 -198
  8. package/src/bridge/direct.ts +1 -1
  9. package/src/bridge/generated/fields.ts +4 -3
  10. package/src/bridge/generated/protocol.ts +62 -7
  11. package/src/bridge/generated/variant-fields.ts +1 -1
  12. package/src/bridge/job.ts +49 -12
  13. package/src/bridge/loopback.ts +7 -25
  14. package/src/bridge/operation.ts +13 -43
  15. package/src/bridge/router.ts +10 -23
  16. package/src/bridge/runtime/connection.ts +78 -109
  17. package/src/bridge/runtime/policy.ts +8 -28
  18. package/src/bridge/runtime/retry.ts +6 -18
  19. package/src/bridge/session.ts +4 -14
  20. package/src/bridge/stream/connection.ts +24 -55
  21. package/src/bridge/stream/source.ts +2 -6
  22. package/src/bridge/stream/tracker.ts +12 -12
  23. package/src/bridge/supervision.ts +104 -97
  24. package/src/bridge/validation/base.ts +21 -63
  25. package/src/bridge/validation/jobs.ts +11 -25
  26. package/src/bridge/validation/negotiation.ts +28 -43
  27. package/src/bridge/validation/operations.ts +29 -65
  28. package/src/bridge/validation/streams.ts +3 -10
  29. package/src/commands/client.ts +37 -28
  30. package/src/commands/controller.ts +119 -96
  31. package/src/commands/generated/fields.ts +7 -6
  32. package/src/commands/generated/protocol.ts +28 -1
  33. package/src/commands/generated/variant-fields.ts +1 -1
  34. package/src/commands/keyboard.ts +94 -100
  35. package/src/commands/physical-code.ts +11 -0
  36. package/src/commands/ports.ts +8 -13
  37. package/src/commands/projectors.ts +100 -75
  38. package/src/commands/validation.ts +434 -241
  39. package/src/config/client.ts +9 -22
  40. package/src/config/generated/base.ts +22 -6
  41. package/src/config/generated/fields.ts +4 -3
  42. package/src/config/generated/label-template.ts +1 -1
  43. package/src/config/generated/labels.ts +1 -1
  44. package/src/config/generated/protocol.ts +1 -1
  45. package/src/config/generated/restore.ts +35 -12
  46. package/src/config/generated/variant-fields.ts +1 -1
  47. package/src/config/names.ts +6 -12
  48. package/src/config/validation/commands.ts +11 -25
  49. package/src/config/validation/outcomes.ts +163 -70
  50. package/src/config/validation/primitives.ts +35 -80
  51. package/src/config/validation/projection.ts +100 -128
  52. package/src/core/connection.ts +187 -83
  53. package/src/core/controller-lifecycle.ts +144 -0
  54. package/src/core/generated/identifiers.ts +4 -0
  55. package/src/core/identifiers.ts +40 -0
  56. package/src/core/index.ts +10 -1
  57. package/src/core/json-value.ts +58 -0
  58. package/src/core/listeners.ts +35 -0
  59. package/src/core/record.ts +80 -0
  60. package/src/core/transport.ts +9 -11
  61. package/src/core/wire-copy.ts +7 -0
  62. package/src/history/client.ts +11 -13
  63. package/src/history/controller.ts +106 -108
  64. package/src/history/direct.ts +1 -3
  65. package/src/history/generated/fields.ts +4 -3
  66. package/src/history/generated/protocol.ts +8 -5
  67. package/src/history/generated/variant-fields.ts +1 -1
  68. package/src/history/ports.ts +7 -4
  69. package/src/history/serialized.ts +9 -13
  70. package/src/history/validation.ts +69 -75
  71. package/src/history-tree/client.ts +89 -11
  72. package/src/history-tree/controller.ts +380 -96
  73. package/src/history-tree/direct.ts +3 -1
  74. package/src/history-tree/generated/fields.ts +5 -3
  75. package/src/history-tree/generated/protocol.ts +43 -7
  76. package/src/history-tree/generated/variant-fields.ts +7 -1
  77. package/src/history-tree/ports.ts +12 -5
  78. package/src/history-tree/serialized.ts +39 -11
  79. package/src/history-tree/validation.ts +286 -78
  80. package/src/layout/generated/protocol.ts +4 -3
  81. package/src/layout/generated/variant-fields.ts +47 -0
  82. package/src/layout/index.ts +1 -1
  83. package/src/layout/ratio.ts +10 -9
  84. package/src/layout/validation.ts +98 -32
  85. package/src/layout/visibility.ts +1 -2
  86. package/src/licence/client.ts +48 -7
  87. package/src/licence/controller.ts +127 -70
  88. package/src/licence/direct.ts +3 -1
  89. package/src/licence/generated/fields.ts +4 -3
  90. package/src/licence/generated/key-conformance.json +28 -0
  91. package/src/licence/generated/protocol.ts +9 -5
  92. package/src/licence/generated/variant-fields.ts +1 -1
  93. package/src/licence/key.ts +42 -18
  94. package/src/licence/ports.ts +10 -3
  95. package/src/licence/serialized.ts +32 -9
  96. package/src/licence/validation.ts +134 -43
  97. package/src/native-content/client.ts +207 -234
  98. package/src/native-content/generated/fields.ts +6 -6
  99. package/src/native-content/generated/protocol.ts +16 -5
  100. package/src/native-content/generated/variant-fields.ts +1 -1
  101. package/src/native-content/ports.ts +11 -16
  102. package/src/native-content/serialized.ts +12 -19
  103. package/src/native-content/validation/base.ts +57 -80
  104. package/src/native-content/validation/messages.ts +24 -35
  105. package/src/native-content/validation/state.ts +31 -33
  106. package/src/notifications/client.ts +85 -51
  107. package/src/notifications/controller.ts +400 -145
  108. package/src/notifications/direct.ts +3 -1
  109. package/src/notifications/generated/fields.ts +4 -3
  110. package/src/notifications/generated/labels.ts +1 -1
  111. package/src/notifications/generated/protocol.ts +5 -1
  112. package/src/notifications/generated/variant-fields.ts +1 -1
  113. package/src/notifications/ports.ts +9 -4
  114. package/src/notifications/serialized.ts +11 -9
  115. package/src/notifications/tone.ts +1 -1
  116. package/src/notifications/validation.ts +165 -71
  117. package/src/operation/bridge.ts +187 -60
  118. package/src/operation/client.ts +48 -62
  119. package/src/operation/controller.ts +67 -97
  120. package/src/operation/direct.ts +1 -3
  121. package/src/operation/generated/fields.ts +4 -3
  122. package/src/operation/generated/labels.ts +1 -1
  123. package/src/operation/generated/protocol.ts +5 -1
  124. package/src/operation/generated/variant-fields.ts +1 -1
  125. package/src/operation/ports.ts +12 -10
  126. package/src/operation/serialized.ts +8 -9
  127. package/src/operation/validation.ts +189 -104
  128. package/src/settings/client.ts +11 -44
  129. package/src/settings/connection.ts +35 -53
  130. package/src/settings/generated/fields.ts +5 -4
  131. package/src/settings/generated/protocol.ts +14 -5
  132. package/src/settings/generated/variant-fields.ts +1 -1
  133. package/src/settings/names.ts +2 -4
  134. package/src/settings/registry.ts +23 -25
  135. package/src/settings/validation/authority.ts +21 -19
  136. package/src/settings/validation/command.ts +22 -41
  137. package/src/settings/validation/error.ts +2 -8
  138. package/src/settings/validation/primitives.ts +46 -97
  139. package/src/settings/validation/projection.ts +8 -24
  140. package/src/settings/validation/registry.ts +33 -79
  141. package/src/surface-transfer/client.ts +6 -18
  142. package/src/surface-transfer/generated/fields.ts +3 -3
  143. package/src/surface-transfer/generated/protocol.ts +3 -3
  144. package/src/surface-transfer/generated/variant-fields.ts +1 -1
  145. package/src/surface-transfer/validation.ts +91 -86
  146. package/src/surfaces/client.ts +33 -55
  147. package/src/surfaces/generated/fields.ts +3 -3
  148. package/src/surfaces/generated/protocol.ts +1 -1
  149. package/src/surfaces/generated/variant-fields.ts +1 -1
  150. package/src/surfaces/validation.ts +227 -99
  151. package/src/transfer/client.ts +26 -60
  152. package/src/transfer/connection.ts +29 -51
  153. package/src/transfer/generated/fields.ts +7 -6
  154. package/src/transfer/generated/protocol.ts +13 -5
  155. package/src/transfer/generated/variant-fields.ts +1 -1
  156. package/src/transfer/index.ts +8 -1
  157. package/src/transfer/payload.ts +20 -35
  158. package/src/transfer/validation.ts +169 -119
  159. package/src/update/client.ts +86 -9
  160. package/src/update/controller.ts +264 -116
  161. package/src/update/direct.ts +3 -1
  162. package/src/update/generated/fields.ts +5 -4
  163. package/src/update/generated/protocol.ts +25 -9
  164. package/src/update/generated/variant-fields.ts +4 -2
  165. package/src/update/ports.ts +14 -6
  166. package/src/update/serialized.ts +36 -10
  167. package/src/update/validation.ts +118 -48
@@ -1,7 +1,7 @@
1
- // @generated by `effigy generate:history-tree`; do not edit.
1
+ // @generated by `effigy generate:bindings`; do not edit.
2
2
  // Rust serde types are authoritative. Product payloads are intentionally absent.
3
3
 
4
- export const FORK_HISTORY_PROTOCOL_VERSION = 1 as const;
4
+ export const FORK_HISTORY_PROTOCOL_VERSION = 2 as const;
5
5
  export const MAXIMUM_FORK_HISTORY_PAGE_SIZE = 256 as const;
6
6
  export const FORK_HISTORY_ENTRY_POSITIONS = ["past","current","future"] as const;
7
7
  export const FORK_HISTORY_PATH_TARGETS = ["default","branch","continuation"] as const;
@@ -10,7 +10,9 @@ export const FORK_HISTORY_NAVIGATION_TARGETS = ["undo","redo","checkout","checko
10
10
  export const FORK_HISTORY_NAVIGATION_REJECTION_CODES = ["incompatibleProtocol","staleAuthority","foreignHistory","staleRevision","nothingToUndo","nothingToRedo","alreadyAtTarget","unknownTarget","unauthorized","applyFailed","rollbackFailed","invalidRequest"] as const;
11
11
  export const FORK_HISTORY_NAVIGATION_STATUSES = ["committed","rejected"] as const;
12
12
  export const FORK_HISTORY_CHANGED_KINDS = ["record","navigation","branchMetadata","retention","checkpoint","imported","reset"] as const;
13
- export const FORK_HISTORY_PRUNE_STATUSES = ["unchanged","pruned"] as const;
13
+ export const FORK_HISTORY_RETENTION_REJECTION_CODES = ["incompatibleProtocol","staleAuthority","foreignHistory","staleRevision","unknownEntry","currentNodeInSubtree","entryOnCurrentPath","pinnedBranchInSubtree","zeroLimit","limitTooLarge","unauthorized","invalidRequest"] as const;
14
+ export const FORK_HISTORY_DELETE_STATUSES = ["deleted","rejected"] as const;
15
+ export const FORK_HISTORY_PRUNE_STATUSES = ["rejected","unchanged","pruned"] as const;
14
16
 
15
17
  export type HistoryId = string;
16
18
 
@@ -143,13 +145,13 @@ position: ForkProjectionPosition,
143
145
  */
144
146
  continuationCount: number, };
145
147
 
146
- export type ForkPathFloorProjection = { "kind": "origin" } | { "kind": "anchor",
148
+ export type ForkPathFloorProjection = { "kind": "origin", } | { "kind": "anchor",
147
149
  /**
148
150
  * The fork point.
149
151
  */
150
152
  entryId: HistoryEntryId, };
151
153
 
152
- export type ForkPathTargetProjection = { "kind": "default" } | { "kind": "branch",
154
+ export type ForkPathTargetProjection = { "kind": "default", } | { "kind": "branch",
153
155
  /**
154
156
  * Explicit first-class branch selection.
155
157
  */
@@ -470,6 +472,32 @@ expectedRevision: HistoryRevision,
470
472
  */
471
473
  entryId: HistoryEntryId, };
472
474
 
475
+ export type ForkRetentionRejectionCode = "incompatibleProtocol" | "staleAuthority" | "foreignHistory" | "staleRevision" | "unknownEntry" | "currentNodeInSubtree" | "entryOnCurrentPath" | "pinnedBranchInSubtree" | "zeroLimit" | "limitTooLarge" | "unauthorized" | "invalidRequest";
476
+
477
+ export type ForkRetentionRejectionProjection = {
478
+ /**
479
+ * Stable category.
480
+ */
481
+ code: ForkRetentionRejectionCode,
482
+ /**
483
+ * Renderer-safe diagnostic.
484
+ */
485
+ detail: string,
486
+ /**
487
+ * Whether the caller should refresh.
488
+ */
489
+ refreshRequired: boolean, };
490
+
491
+ export type ForkDeleteResult = { "status": "deleted",
492
+ /**
493
+ * Receipt for the committed deletion.
494
+ */
495
+ receipt: ForkRemovalReceiptProjection, } | { "status": "rejected",
496
+ /**
497
+ * Reason for refusal.
498
+ */
499
+ rejection: ForkRetentionRejectionProjection, };
500
+
473
501
  export type ForkRemovedEntryRecord = {
474
502
  /**
475
503
  * Stable identity of the removed entry.
@@ -564,13 +592,17 @@ maximumEntries: number,
564
592
  */
565
593
  maximumEncodedWeight: number, };
566
594
 
567
- export type ForkPruneResult = { "status": "unchanged" } | { "status": "pruned",
595
+ export type ForkPruneResult = { "status": "rejected",
596
+ /**
597
+ * Reason for refusal.
598
+ */
599
+ rejection: ForkRetentionRejectionProjection, } | { "status": "unchanged", } | { "status": "pruned",
568
600
  /**
569
601
  * What it removed, and what is left.
570
602
  */
571
603
  receipt: ForkRemovalReceiptProjection, };
572
604
 
573
- export type ForkNavigationTargetProjection = { "kind": "undo" } | { "kind": "redo" } | { "kind": "checkout",
605
+ export type ForkNavigationTargetProjection = { "kind": "undo", } | { "kind": "redo", } | { "kind": "checkout",
574
606
  /**
575
607
  * Stable target branch.
576
608
  */
@@ -709,3 +741,7 @@ committedRevision: HistoryRevision,
709
741
  * Coarse invalidation category.
710
742
  */
711
743
  kind: ForkChangedKind, };
744
+
745
+ export type ForkHistoryHostErrorCode = "authorityUnavailable" | "stateUnavailable" | "eventPublication";
746
+
747
+ export type ForkHistoryHostError = { "code": ForkHistoryHostErrorCode, "message": string, "retryable": boolean, };
@@ -1,4 +1,4 @@
1
- // @generated by `effigy generate:history-tree`; do not edit.
1
+ // @generated by `effigy generate:bindings`; do not edit.
2
2
  // Allowed field names per tagged-union variant, from the Rust enums.
3
3
  // Keyed by type, then by discriminant. The discriminant itself is in
4
4
  // each list, because `exact()` compares every key.
@@ -13,7 +13,12 @@ export const HISTORY_TREE_VARIANT_FIELDS: Record<string, Record<string, readonly
13
13
  "branch": ["kind", "branchId"],
14
14
  "continuation": ["kind", "fromEntryId"],
15
15
  },
16
+ "ForkDeleteResult": {
17
+ "deleted": ["status", "receipt"],
18
+ "rejected": ["status", "rejection"],
19
+ },
16
20
  "ForkPruneResult": {
21
+ "rejected": ["status", "rejection"],
17
22
  "unchanged": ["status"],
18
23
  "pruned": ["status", "receipt"],
19
24
  },
@@ -33,6 +38,7 @@ export const HISTORY_TREE_VARIANT_FIELDS: Record<string, Record<string, readonly
33
38
  export const HISTORY_TREE_VARIANT_FIELDS_DISCRIMINANTS: Record<string, string> = {
34
39
  "ForkPathFloorProjection": "kind",
35
40
  "ForkPathTargetProjection": "kind",
41
+ "ForkDeleteResult": "status",
36
42
  "ForkPruneResult": "status",
37
43
  "ForkNavigationTargetProjection": "kind",
38
44
  "ForkNavigationResult": "status",
@@ -1,3 +1,5 @@
1
+ import type { ConnectionFailureReporter } from "../core/connection.ts";
2
+ import type { Unlisten } from "../core/transport.ts";
1
3
  import type {
2
4
  ForkBranchPageCommand,
3
5
  ForkBranchPageSnapshot,
@@ -11,12 +13,12 @@ import type {
11
13
  ForkNavigationResult,
12
14
  ForkPathPageCommand,
13
15
  ForkPathPageSnapshot,
14
- ForkRemovalReceiptProjection,
16
+ ForkDeleteResult,
15
17
  ForkSnapshot,
16
18
  HistoryPlanId,
17
19
  } from "./generated/protocol.ts";
18
20
 
19
- export type ForkHistoryUnlisten = () => void | Promise<void>;
21
+ export type ForkHistoryUnlisten = Unlisten;
20
22
 
21
23
  export interface ForkHistoryPort {
22
24
  snapshot(): Promise<unknown>;
@@ -26,7 +28,9 @@ export interface ForkHistoryPort {
26
28
  deleteContinuation(command: ForkDeleteContinuationCommand): Promise<unknown>;
27
29
  prune(command: ForkPruneCommand): Promise<unknown>;
28
30
  navigate(command: ForkNavigationCommand): Promise<unknown>;
29
- listen?(listener: (event: unknown) => void): ForkHistoryUnlisten | Promise<ForkHistoryUnlisten>;
31
+ listen?:
32
+ | ((listener: (event: unknown) => void) => ForkHistoryUnlisten | Promise<ForkHistoryUnlisten>)
33
+ | undefined;
30
34
  nextPlanId(): HistoryPlanId;
31
35
  }
32
36
 
@@ -35,9 +39,12 @@ export interface CheckedForkHistoryPort {
35
39
  path(command: ForkPathPageCommand): Promise<ForkPathPageSnapshot>;
36
40
  branches(command: ForkBranchPageCommand): Promise<ForkBranchPageSnapshot>;
37
41
  continuations(command: ForkContinuationPageCommand): Promise<ForkContinuationPageSnapshot>;
38
- deleteContinuation(command: ForkDeleteContinuationCommand): Promise<ForkRemovalReceiptProjection>;
42
+ deleteContinuation(command: ForkDeleteContinuationCommand): Promise<ForkDeleteResult>;
39
43
  prune(command: ForkPruneCommand): Promise<ForkPruneResult>;
40
44
  navigate(command: ForkNavigationCommand): Promise<ForkNavigationResult>;
41
- listen?(listener: (event: ForkChangedEvent) => void): Promise<ForkHistoryUnlisten>;
45
+ listen?(
46
+ listener: (event: ForkChangedEvent) => void,
47
+ onFailure?: ConnectionFailureReporter,
48
+ ): Promise<ForkHistoryUnlisten>;
42
49
  nextPlanId(): HistoryPlanId;
43
50
  }
@@ -1,15 +1,43 @@
1
- import type { ForkBranchPageCommand, ForkContinuationPageCommand, ForkDeleteContinuationCommand, ForkNavigationCommand, ForkPathPageCommand, ForkPruneCommand } from "./generated/protocol.ts";
1
+ import { wireCopy } from "../core/wire-copy.ts";
2
+ import type {
3
+ ForkBranchPageCommand,
4
+ ForkContinuationPageCommand,
5
+ ForkDeleteContinuationCommand,
6
+ ForkNavigationCommand,
7
+ ForkPathPageCommand,
8
+ ForkPruneCommand,
9
+ } from "./generated/protocol.ts";
2
10
  import type { ForkHistoryPort, ForkHistoryUnlisten } from "./ports.ts";
3
11
  export class SerializedForkHistoryPort implements ForkHistoryPort {
4
12
  constructor(readonly inner: ForkHistoryPort) {}
5
- async snapshot(): Promise<unknown> { return clone(await this.inner.snapshot()); }
6
- async path(command: ForkPathPageCommand): Promise<unknown> { return clone(await this.inner.path(clone(command))); }
7
- async branches(command: ForkBranchPageCommand): Promise<unknown> { return clone(await this.inner.branches(clone(command))); }
8
- async continuations(command: ForkContinuationPageCommand): Promise<unknown> { return clone(await this.inner.continuations(clone(command))); }
9
- async deleteContinuation(command: ForkDeleteContinuationCommand): Promise<unknown> { return clone(await this.inner.deleteContinuation(clone(command))); }
10
- async prune(command: ForkPruneCommand): Promise<unknown> { return clone(await this.inner.prune(clone(command))); }
11
- async navigate(command: ForkNavigationCommand): Promise<unknown> { return clone(await this.inner.navigate(clone(command))); }
12
- async listen(listener: (event: unknown) => void): Promise<ForkHistoryUnlisten> { if (this.inner.listen === undefined) return () => {}; return this.inner.listen((event) => listener(clone(event))); }
13
- nextPlanId(): string { return this.inner.nextPlanId(); }
13
+ async snapshot(): Promise<unknown> {
14
+ return wireCopy(await this.inner.snapshot());
15
+ }
16
+ async path(command: ForkPathPageCommand): Promise<unknown> {
17
+ return wireCopy(await this.inner.path(wireCopy(command)));
18
+ }
19
+ async branches(command: ForkBranchPageCommand): Promise<unknown> {
20
+ return wireCopy(await this.inner.branches(wireCopy(command)));
21
+ }
22
+ async continuations(command: ForkContinuationPageCommand): Promise<unknown> {
23
+ return wireCopy(await this.inner.continuations(wireCopy(command)));
24
+ }
25
+ async deleteContinuation(command: ForkDeleteContinuationCommand): Promise<unknown> {
26
+ return wireCopy(await this.inner.deleteContinuation(wireCopy(command)));
27
+ }
28
+ async prune(command: ForkPruneCommand): Promise<unknown> {
29
+ return wireCopy(await this.inner.prune(wireCopy(command)));
30
+ }
31
+ async navigate(command: ForkNavigationCommand): Promise<unknown> {
32
+ return wireCopy(await this.inner.navigate(wireCopy(command)));
33
+ }
34
+ async listen(listener: (event: unknown) => void): Promise<ForkHistoryUnlisten> {
35
+ if (this.inner.listen === undefined) {
36
+ return () => {};
37
+ }
38
+ return this.inner.listen((event) => listener(wireCopy(event)));
39
+ }
40
+ nextPlanId(): string {
41
+ return this.inner.nextPlanId();
42
+ }
14
43
  }
15
- function clone<T>(value: T): T { return JSON.parse(JSON.stringify(value)) as T; }