@ibgib/core-gib 0.1.54 → 0.1.55

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 (189) hide show
  1. package/CHANGELOG.md +10 -3
  2. package/README.md +12 -15
  3. package/dist/keystone/aggregate-details.respec.d.mts +2 -0
  4. package/dist/keystone/aggregate-details.respec.d.mts.map +1 -0
  5. package/dist/keystone/aggregate-details.respec.mjs +118 -0
  6. package/dist/keystone/aggregate-details.respec.mjs.map +1 -0
  7. package/dist/keystone/keystone-constants.d.mts +5 -0
  8. package/dist/keystone/keystone-constants.d.mts.map +1 -1
  9. package/dist/keystone/keystone-constants.mjs +6 -1
  10. package/dist/keystone/keystone-constants.mjs.map +1 -1
  11. package/dist/keystone/keystone-helpers.d.mts +7 -1
  12. package/dist/keystone/keystone-helpers.d.mts.map +1 -1
  13. package/dist/keystone/keystone-helpers.mjs +5 -2
  14. package/dist/keystone/keystone-helpers.mjs.map +1 -1
  15. package/dist/keystone/keystone-service-v1.d.mts +51 -0
  16. package/dist/keystone/keystone-service-v1.d.mts.map +1 -1
  17. package/dist/keystone/keystone-service-v1.mjs +176 -9
  18. package/dist/keystone/keystone-service-v1.mjs.map +1 -1
  19. package/dist/keystone/keystone-service-v1.respec.mjs +40 -98
  20. package/dist/keystone/keystone-service-v1.respec.mjs.map +1 -1
  21. package/dist/keystone/keystone-types.d.mts +5 -0
  22. package/dist/keystone/keystone-types.d.mts.map +1 -1
  23. package/dist/sync/graft-info/graft-info-helpers.respec.mjs +8 -8
  24. package/dist/sync/graft-info/graft-info-helpers.respec.mjs.map +1 -1
  25. package/dist/sync/sync-conflict-adv-multitimelines.respec.mjs +26 -30
  26. package/dist/sync/sync-conflict-adv-multitimelines.respec.mjs.map +1 -1
  27. package/dist/sync/sync-conflict-basic-divergence.respec.mjs +7 -8
  28. package/dist/sync/sync-conflict-basic-divergence.respec.mjs.map +1 -1
  29. package/dist/sync/sync-conflict-basic-multitimelines.respec.mjs +10 -11
  30. package/dist/sync/sync-conflict-basic-multitimelines.respec.mjs.map +1 -1
  31. package/dist/sync/sync-conflict-text-merge.respec.mjs +30 -33
  32. package/dist/sync/sync-conflict-text-merge.respec.mjs.map +1 -1
  33. package/dist/sync/sync-constants.d.mts +1 -56
  34. package/dist/sync/sync-constants.d.mts.map +1 -1
  35. package/dist/sync/sync-constants.mjs +2 -59
  36. package/dist/sync/sync-constants.mjs.map +1 -1
  37. package/dist/sync/sync-helpers.d.mts +0 -1
  38. package/dist/sync/sync-helpers.d.mts.map +1 -1
  39. package/dist/sync/sync-helpers.mjs +1 -6
  40. package/dist/sync/sync-helpers.mjs.map +1 -1
  41. package/dist/sync/sync-innerspace-constants.respec.mjs +5 -9
  42. package/dist/sync/sync-innerspace-constants.respec.mjs.map +1 -1
  43. package/dist/sync/sync-innerspace-deep-updates.respec.mjs +6 -7
  44. package/dist/sync/sync-innerspace-deep-updates.respec.mjs.map +1 -1
  45. package/dist/sync/sync-innerspace-dest-ahead-withid.respec.mjs +22 -22
  46. package/dist/sync/sync-innerspace-dest-ahead-withid.respec.mjs.map +1 -1
  47. package/dist/sync/sync-innerspace-dest-ahead.respec.mjs +8 -9
  48. package/dist/sync/sync-innerspace-dest-ahead.respec.mjs.map +1 -1
  49. package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs +6 -7
  50. package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs.map +1 -1
  51. package/dist/sync/sync-innerspace-partial-update.respec.mjs +7 -8
  52. package/dist/sync/sync-innerspace-partial-update.respec.mjs.map +1 -1
  53. package/dist/sync/sync-innerspace.respec.mjs +8 -11
  54. package/dist/sync/sync-innerspace.respec.mjs.map +1 -1
  55. package/dist/sync/sync-peer/sync-peer-http-receiver/sync-http-node-adapter.mjs +10 -5
  56. package/dist/sync/sync-peer/sync-peer-http-receiver/sync-http-node-adapter.mjs.map +1 -1
  57. package/dist/sync/sync-peer/sync-peer-http-receiver/sync-peer-http-receiver-types.d.mts +3 -1
  58. package/dist/sync/sync-peer/sync-peer-http-receiver/sync-peer-http-receiver-types.d.mts.map +1 -1
  59. package/dist/sync/sync-peer/sync-peer-http-receiver/sync-peer-http-receiver-v1.d.mts +4 -2
  60. package/dist/sync/sync-peer/sync-peer-http-receiver/sync-peer-http-receiver-v1.d.mts.map +1 -1
  61. package/dist/sync/sync-peer/sync-peer-http-receiver/sync-peer-http-receiver-v1.mjs +37 -6
  62. package/dist/sync/sync-peer/sync-peer-http-receiver/sync-peer-http-receiver-v1.mjs.map +1 -1
  63. package/dist/sync/sync-peer/sync-peer-http-sender/sync-peer-http-sender-types.d.mts +3 -1
  64. package/dist/sync/sync-peer/sync-peer-http-sender/sync-peer-http-sender-types.d.mts.map +1 -1
  65. package/dist/sync/sync-peer/sync-peer-http-sender/sync-peer-http-sender-v1.d.mts +4 -2
  66. package/dist/sync/sync-peer/sync-peer-http-sender/sync-peer-http-sender-v1.d.mts.map +1 -1
  67. package/dist/sync/sync-peer/sync-peer-http-sender/sync-peer-http-sender-v1.mjs +37 -0
  68. package/dist/sync/sync-peer/sync-peer-http-sender/sync-peer-http-sender-v1.mjs.map +1 -1
  69. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.d.mts +7 -1
  70. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.d.mts.map +1 -1
  71. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.d.mts +10 -2
  72. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.d.mts.map +1 -1
  73. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs +50 -38
  74. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs.map +1 -1
  75. package/dist/sync/sync-peer/sync-peer-types.d.mts +21 -5
  76. package/dist/sync/sync-peer/sync-peer-types.d.mts.map +1 -1
  77. package/dist/sync/sync-peer/sync-peer-v1.d.mts +30 -5
  78. package/dist/sync/sync-peer/sync-peer-v1.d.mts.map +1 -1
  79. package/dist/sync/sync-peer/sync-peer-v1.mjs +41 -25
  80. package/dist/sync/sync-peer/sync-peer-v1.mjs.map +1 -1
  81. package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts +2 -11
  82. package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts.map +1 -1
  83. package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs +7 -51
  84. package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs.map +1 -1
  85. package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts +1 -47
  86. package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts.map +1 -1
  87. package/dist/sync/sync-saga-coordinator.d.mts +6 -58
  88. package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
  89. package/dist/sync/sync-saga-coordinator.mjs +23 -425
  90. package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
  91. package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts +2 -2
  92. package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts.map +1 -1
  93. package/dist/sync/sync-types.d.mts +2 -19
  94. package/dist/sync/sync-types.d.mts.map +1 -1
  95. package/dist/sync/sync-types.mjs.map +1 -1
  96. package/dist/test/mock-space.mjs +1 -1
  97. package/dist/test/mock-space.mjs.map +1 -1
  98. package/dist/test-helpers.d.mts +0 -6
  99. package/dist/test-helpers.d.mts.map +1 -1
  100. package/dist/test-helpers.mjs +2 -25
  101. package/dist/test-helpers.mjs.map +1 -1
  102. package/package.json +7 -31
  103. package/src/keystone/aggregate-details.respec.mts +137 -0
  104. package/src/keystone/docs/architecture.md +16 -0
  105. package/src/keystone/keystone-constants.mts +6 -1
  106. package/src/keystone/keystone-helpers.mts +9 -1
  107. package/src/keystone/keystone-service-v1.mts +216 -8
  108. package/src/keystone/keystone-service-v1.respec.mts +39 -103
  109. package/src/keystone/keystone-types.mts +6 -0
  110. package/src/sync/README.md +18 -0
  111. package/src/sync/docs/architecture.md +21 -0
  112. package/src/sync/graft-info/graft-info-helpers.respec.mts +7 -7
  113. package/src/sync/sync-conflict-adv-multitimelines.respec.mts +25 -29
  114. package/src/sync/sync-conflict-basic-divergence.respec.mts +6 -7
  115. package/src/sync/sync-conflict-basic-multitimelines.respec.mts +9 -10
  116. package/src/sync/sync-conflict-text-merge.respec.mts +29 -32
  117. package/src/sync/sync-constants.mts +2 -62
  118. package/src/sync/sync-helpers.mts +1 -8
  119. package/src/sync/sync-id-testlog.txt +421 -0
  120. package/src/sync/sync-innerspace-constants.respec.mts +4 -8
  121. package/src/sync/sync-innerspace-deep-updates.respec.mts +5 -6
  122. package/src/sync/sync-innerspace-dest-ahead-withid.respec.mts +23 -25
  123. package/src/sync/sync-innerspace-dest-ahead.respec.mts +7 -8
  124. package/src/sync/sync-innerspace-multiple-timelines.respec.mts +5 -6
  125. package/src/sync/sync-innerspace-partial-update.respec.mts +6 -7
  126. package/src/sync/sync-innerspace.respec.mts +7 -10
  127. package/src/sync/sync-peer/sync-peer-http-receiver/sync-http-node-adapter.mts +5 -5
  128. package/src/sync/sync-peer/sync-peer-http-receiver/sync-peer-http-receiver-types.mts +5 -1
  129. package/src/sync/sync-peer/sync-peer-http-receiver/sync-peer-http-receiver-v1.mts +30 -9
  130. package/src/sync/sync-peer/sync-peer-http-sender/sync-peer-http-sender-types.mts +3 -1
  131. package/src/sync/sync-peer/sync-peer-http-sender/sync-peer-http-sender-v1.mts +29 -2
  132. package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.mts +7 -1
  133. package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mts +51 -38
  134. package/src/sync/sync-peer/sync-peer-types.mts +23 -6
  135. package/src/sync/sync-peer/sync-peer-v1.mts +68 -28
  136. package/src/sync/sync-saga-context/sync-saga-context-helpers.mts +6 -66
  137. package/src/sync/sync-saga-context/sync-saga-context-types.mts +1 -48
  138. package/src/sync/sync-saga-coordinator.mts +12 -552
  139. package/src/sync/sync-saga-message/sync-saga-message-types.mts +2 -3
  140. package/src/sync/sync-types.mts +2 -22
  141. package/src/sync/unused-identity-backup.mts.md +311 -0
  142. package/src/test/mock-space.mts +1 -1
  143. package/src/test-helpers.mts +1 -26
  144. package/test_output.log +0 -0
  145. package/test_output_utf8.txt +398 -0
  146. package/.vscode/core-gib-snippets.code-snippets +0 -293
  147. package/.vscode/launch.json +0 -40
  148. package/.vscode/settings.json +0 -58
  149. package/.vscode/tasks.json +0 -37
  150. package/dist/sync/sync-peer/sync-peer-http.respec.d.mts +0 -2
  151. package/dist/sync/sync-peer/sync-peer-http.respec.d.mts.map +0 -1
  152. package/dist/sync/sync-peer/sync-peer-http.respec.mjs +0 -340
  153. package/dist/sync/sync-peer/sync-peer-http.respec.mjs.map +0 -1
  154. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-helper.d.mts +0 -42
  155. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-helper.d.mts.map +0 -1
  156. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-helper.mjs +0 -312
  157. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-helper.mjs.map +0 -1
  158. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-types.d.mts +0 -84
  159. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-types.d.mts.map +0 -1
  160. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-types.mjs +0 -65
  161. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-types.mjs.map +0 -1
  162. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-v1.d.mts +0 -73
  163. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-v1.d.mts.map +0 -1
  164. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-v1.mjs +0 -667
  165. package/dist/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-v1.mjs.map +0 -1
  166. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_createAndInit.node-filesystem-space-v1.respec.d.mts +0 -2
  167. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_createAndInit.node-filesystem-space-v1.respec.d.mts.map +0 -1
  168. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_createAndInit.node-filesystem-space-v1.respec.mjs +0 -67
  169. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_createAndInit.node-filesystem-space-v1.respec.mjs.map +0 -1
  170. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_persistTransformResult.node-filesystem-space-v1.respec.d.mts +0 -2
  171. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_persistTransformResult.node-filesystem-space-v1.respec.d.mts.map +0 -1
  172. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_persistTransformResult.node-filesystem-space-v1.respec.mjs +0 -67
  173. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_persistTransformResult.node-filesystem-space-v1.respec.mjs.map +0 -1
  174. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_putGetDelete.node-filesystem-space-v1.respec.d.mts +0 -2
  175. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_putGetDelete.node-filesystem-space-v1.respec.d.mts.map +0 -1
  176. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_putGetDelete.node-filesystem-space-v1.respec.mjs +0 -68
  177. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_putGetDelete.node-filesystem-space-v1.respec.mjs.map +0 -1
  178. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_registerNewIbGib_GetLatest.node-filesystem-space-v1.respec.d.mts +0 -2
  179. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_registerNewIbGib_GetLatest.node-filesystem-space-v1.respec.d.mts.map +0 -1
  180. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_registerNewIbGib_GetLatest.node-filesystem-space-v1.respec.mjs +0 -69
  181. package/dist/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_registerNewIbGib_GetLatest.node-filesystem-space-v1.respec.mjs.map +0 -1
  182. package/src/sync/sync-peer/sync-peer-http.respec.mts +0 -396
  183. package/src/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-helper.mts +0 -298
  184. package/src/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-types.mts +0 -150
  185. package/src/witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-v1.mts +0 -666
  186. package/src/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_createAndInit.node-filesystem-space-v1.respec.mts +0 -87
  187. package/src/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_persistTransformResult.node-filesystem-space-v1.respec.mts +0 -88
  188. package/src/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_putGetDelete.node-filesystem-space-v1.respec.mts +0 -88
  189. package/src/witness/space/filesystem-space/node-filesystem-space/respec/testSpace_registerNewIbGib_GetLatest.node-filesystem-space-v1.respec.mts +0 -90
@@ -3,12 +3,12 @@
3
3
  */
4
4
 
5
5
  import { IbGibData_V1, IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
6
- import { SubjectWitness } from '../../common/pubsub/subject/subject-types.mjs';
7
6
 
7
+ import { SubjectWitness } from '../../common/pubsub/subject/subject-types.mjs';
8
8
  import { SyncSagaContextData_V1, SyncSagaContextIbGib_V1, SyncSagaContextRel8ns_V1 } from '../sync-saga-context/sync-saga-context-types.mjs';
9
9
  import { Witness_V1 } from '../../witness/witness-types.mjs';
10
10
  import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
11
- import { KeystoneService_V1 } from '../../keystone/keystone-service-v1.mjs';
11
+ import { MetaspaceService } from '../../witness/space/metaspace/metaspace-types.mjs';
12
12
 
13
13
  /**
14
14
  * Data for the SyncPeer witness.
@@ -31,10 +31,22 @@ export interface SyncPeerRel8ns_V1 extends IbGibRel8ns_V1 {
31
31
  */
32
32
  export interface SyncPeerIbGib_V1 extends IbGib_V1<SyncPeerData_V1, SyncPeerRel8ns_V1> { }
33
33
 
34
+
35
+ /**
36
+ * opts used in `connect(opts)`
37
+ */
38
+ export interface ConnectSyncPeerOpts {
39
+ sagaId: string;
40
+ }
41
+
34
42
  /**
35
43
  * base initialization opts
36
44
  */
37
45
  export interface InitializeSyncPeerOpts {
46
+ /**
47
+ * reference to the local metaspace
48
+ */
49
+ localMetaspace: MetaspaceService;
38
50
  /**
39
51
  * local durable space.
40
52
  *
@@ -50,10 +62,6 @@ export interface InitializeSyncPeerOpts {
50
62
  * received/created throughout the transaction until commit.
51
63
  */
52
64
  localTempSpace?: IbGibSpaceAny;
53
- /**
54
- * Shared keystone service for signing and validation.
55
- */
56
- keystoneSvc?: KeystoneService_V1;
57
65
  }
58
66
 
59
67
  /**
@@ -98,4 +106,13 @@ export interface SyncPeerWitness<TInitializeOpts extends InitializeSyncPeerOpts
98
106
  * The handling code (e.g. SyncSagaCoordinator) will subscribe to this.
99
107
  */
100
108
  payloadIbGibsDomainReceived$: SubjectWitness<IbGib_V1>;
109
+
110
+ /**
111
+ * Establishes the connection context.
112
+ *
113
+ * This handles concrete communication substrate (e.g., WebSocket upgrade)
114
+ *
115
+ * @param opts Connection options, including the sagaId for the upcoming sync saga.
116
+ */
117
+ connect(opts?: { sagaId?: string }): Promise<void>;
101
118
  }
@@ -14,7 +14,10 @@ import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
14
14
  import { SYNC_MSG_REL8N_NAME, SYNC_SAGA_PAYLOAD_ADDRS_DOMAIN } from '../sync-constants.mjs';
15
15
  import { SubjectWitness } from '../../common/pubsub/subject/subject-types.mjs';
16
16
  import { SyncSagaContextIbGib_V1 } from '../sync-saga-context/sync-saga-context-types.mjs';
17
- import { InitializeSyncPeerOpts, SyncPeerData_V1, SyncPeerRel8ns_V1, SyncPeerWitness } from './sync-peer-types.mjs';
17
+ import {
18
+ ConnectSyncPeerOpts, InitializeSyncPeerOpts, SyncPeerData_V1,
19
+ SyncPeerRel8ns_V1, SyncPeerWitness
20
+ } from './sync-peer-types.mjs';
18
21
  import { LightWitnessBase_V1 } from '../../witness/light-witness-base-v1.mjs';
19
22
  import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
20
23
  import { newupSubject } from '../../common/pubsub/subject/subject-helper.mjs';
@@ -33,13 +36,15 @@ const lcControlDomain = '[ControlDomain]';
33
36
  *
34
37
  * Takes a SyncSagaContext (Request) and returns a SyncSagaContext (Response).
35
38
  *
36
- * Implements the core "Sync Protocol Transport" logic:
39
+ * Implements the core "Sync Protocol Transport" logic. Once connected, does:
37
40
  * 1. Push Context & Dependencies (Sender -> Receiver)
38
41
  * 2. Send Request (RPC)
39
42
  * 3. Pull Response & Dependencies (Receiver -> Sender)
40
43
  */
41
- export abstract class SyncPeer_V1<TInitializeOpts extends InitializeSyncPeerOpts = InitializeSyncPeerOpts>
42
- extends LightWitnessBase_V1<SyncPeerData_V1, SyncPeerRel8ns_V1>
44
+ export abstract class SyncPeer_V1<
45
+ TConnectOpts extends ConnectSyncPeerOpts = ConnectSyncPeerOpts,
46
+ TInitializeOpts extends InitializeSyncPeerOpts = InitializeSyncPeerOpts
47
+ > extends LightWitnessBase_V1<SyncPeerData_V1, SyncPeerRel8ns_V1>
43
48
  implements SyncPeerWitness<TInitializeOpts> {
44
49
 
45
50
  protected lc: string = `[${SyncPeer_V1.name}]`;
@@ -61,6 +66,47 @@ export abstract class SyncPeer_V1<TInitializeOpts extends InitializeSyncPeerOpts
61
66
  this.payloadIbGibsDomainReceived$ = await newupSubject<IbGib_V1>();
62
67
  }
63
68
 
69
+ /**
70
+ * Establishes the connection context.
71
+ *
72
+ * This method provides boilerplate error handling and logging,
73
+ * delegating the actual connection logic to `connectImpl`.
74
+ */
75
+ public async connect(opts: TConnectOpts): Promise<void> {
76
+ const lc = `${this.lc}[${this.connect.name}]`;
77
+ try {
78
+ if (logalot) { console.log(`${lc} starting... (I: ad89d8137351662fb8a30114a1fa4826)`); }
79
+
80
+ await this.preConnectCheck(opts);
81
+ await this.connectImpl(opts);
82
+ } catch (error) {
83
+ console.error(`${lc} ${extractErrorMsg(error)}`);
84
+ throw error;
85
+ } finally {
86
+ if (logalot) { console.log(`${lc} complete.`); }
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Concrete pre-connect check. Should throw if connect conditions are not
92
+ * met.
93
+ *
94
+ * Use this to check what {@link opts} are, as well as any other state per
95
+ * concrete sync peer.
96
+ *
97
+ * @see {@link connect}
98
+ * @see {@link connectImpl}
99
+ */
100
+ protected abstract preConnectCheck(opts: TConnectOpts): Promise<void>;
101
+
102
+ /**
103
+ * Concrete implementation for establishing the connection context.
104
+ *
105
+ * This MUST be implemented by subclasses to handle transport-specific
106
+ * negotiation (e.g., WebSocket upgrade)
107
+ */
108
+ protected abstract connectImpl(opts: TConnectOpts): Promise<void>;
109
+
64
110
  /**
65
111
  * base implementation just sets the opts property.
66
112
  *
@@ -132,30 +178,25 @@ export abstract class SyncPeer_V1<TInitializeOpts extends InitializeSyncPeerOpts
132
178
  if (logalot) { console.log(`${lc} starting... (I: add238055cd84a222c5b8c89913af526)`); }
133
179
 
134
180
  if (!this.opts) { throw new Error(`(UNEXPECTED) opts falsy in authenticateValidateAuthorize (E: b7e5a8ad99d84e1ba8d8f7facd288826)`); }
135
- const { keystoneSvc, localSpace } = this.opts;
136
-
137
- if (keystoneSvc) {
138
- // first authenticate, because invalid identity is a non-starter
139
- const authenticationErrors = await authenticateContext({
140
- context,
141
- space: localSpace,
142
- keystoneSvc
143
- });
144
- if (authenticationErrors.length > 0) {
145
- throw new Error(`invalid context authentication. authenticationErrors: ${authenticationErrors} (E: da89da5ee1269aeb78952d475d607526)`);
146
- }
147
- } else {
148
- if (logalot) { console.warn(`${lc} No keystoneSvc provided. Skipping context authentication. (W: d34b8ad92d84a1ba8d8f7facd288826)`); }
181
+ const { localSpace } = this.opts;
182
+
183
+ // first authenticate, because invalid authn is a non-starter
184
+ const authenticationErrors = await authenticateContext({
185
+ context,
186
+ space: localSpace,
187
+ });
188
+ if (authenticationErrors.length > 0) {
189
+ throw new Error(`invalid context authentication. authenticationErrors: ${authenticationErrors} (E: da89da5ee1269aeb78952d475d607526)`);
149
190
  }
150
- // next, we have a valid keystone, which should point to the
191
+ // next, we have a valid authn, which should point to the
151
192
  // context. But is that context and the saga data it contains valid?
152
- // Does the keystone actually point to this context?
193
+ // Does the authentication actually point to this context?
153
194
  const validationErrors = await validateContextAndSagaFrame({ context, });
154
195
  if (validationErrors.length > 0) {
155
196
  throw new Error(`invalid context received. validationErrors: ${validationErrors} (E: 8b34c875c968af29bc433138e57a7826)`);
156
197
  }
157
- // we have a valid keystone that points to a valid context, but what
158
- // exactly does the keystone authorize?
198
+ // we have a valid authentication that points to a valid context,
199
+ // but what exactly is authorized ?
159
200
  const authorizationErrors = await authorizeContext({ context, fullSagaHistory });
160
201
  if (authorizationErrors.length > 0) {
161
202
  throw new Error(`invalid context authorization. authorizationErrors: ${authorizationErrors} (E: 8ddc284a758cf10ba829334c1babb826)`);
@@ -206,7 +247,7 @@ export abstract class SyncPeer_V1<TInitializeOpts extends InitializeSyncPeerOpts
206
247
  // issues
207
248
  // The following is a sketch where some of these may be blurred
208
249
 
209
- // persist the context, sagaframe, identity(s) ONLY in the receiver's durable space
250
+ // persist the context, sagaframe, authentication details ONLY in the receiver's durable space
210
251
  // if sending domain ibgibs...
211
252
  // verify the domain ibgibs intrinsically.
212
253
  // persist the domain ibgibs in the receiver's temp space (push all addrs?)
@@ -214,8 +255,7 @@ export abstract class SyncPeer_V1<TInitializeOpts extends InitializeSyncPeerOpts
214
255
  // process the context with the receiver's coordinator to get a new response context
215
256
  // analyze the response context
216
257
  // validate context intrinsically
217
- // validate return identity if present
218
- // persist the response context's dependency graph (context, saga frame and msg(s), identities)
258
+ // persist the response context's dependency graph (context, saga frame and msg(s))
219
259
  // if response has payload domain ibgibs,
220
260
  // spin off...
221
261
  // pull domain ibgibs to local temp space
@@ -246,7 +286,7 @@ export abstract class SyncPeer_V1<TInitializeOpts extends InitializeSyncPeerOpts
246
286
  if (response) {
247
287
  // at this point, all outgoing payload domain ibgibs have been sent.
248
288
  // we have received the response context, wherein the sync saga
249
- // frame/msg stone(s) and any keystones should be evolved. Depending
289
+ // frame/msg stone(s) should be evolved. Depending
250
290
  // on the concrete implementation, if there are domain ibgibs to
251
291
  // receive, they may still be transferring. These will be published
252
292
  // to this.payloadIbGibsDomainReceived$
@@ -282,11 +322,11 @@ export abstract class SyncPeer_V1<TInitializeOpts extends InitializeSyncPeerOpts
282
322
  * This is responsible for:
283
323
  *
284
324
  * * physical sending outgoing {@link context}, the sync saga frame and msg
285
- * stone(s), and identities...
325
+ * stone(s)...
286
326
  * * AND sending OUTGOING domain ibgibs
287
327
  * {@link SyncSagaContextIbGib_V1.payloadIbGibsDomain}
288
328
  * * getting back the other end's resultant context ibgib, sync saga frame
289
- * and msg stone(s), and identities in their entirety...
329
+ * and msg stone(s) in their entirety...
290
330
  * * AND stream/receiving the RESPONSE payload domain ibgibs, publishing
291
331
  * these to this.payloadIbGibsDomainReceived$.
292
332
  * * BUT this should return as soon as the resultant context ibgib comes
@@ -20,9 +20,6 @@ import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
20
20
  import { getFromSpace, putInSpace, registerNewIbGib } from '../../witness/space/space-helper.mjs';
21
21
  import { SyncIbGib_V1, SyncSagaFrameDependencyGraph } from '../sync-types.mjs';
22
22
  import { validateSyncSagaFrame } from '../sync-helpers.mjs';
23
- import { validateKeystoneGraph, validateKeystoneTransition } from '../../keystone/keystone-helpers.mjs';
24
- import { KeystoneService_V1 } from '../../keystone/keystone-service-v1.mjs';
25
- import { KeystoneIbGib_V1 } from '../../keystone/keystone-types.mjs';
26
23
  import { isIbGibWithAtom } from '../../common/other/ibgib-helper.mjs';
27
24
 
28
25
  const logalot = GLOBAL_LOG_A_LOT;
@@ -115,13 +112,12 @@ export function isSyncSagaContextIbGib(x: any): x is SyncSagaContextIbGib_V1 {
115
112
  }
116
113
  }
117
114
 
118
-
119
115
  /**
120
116
  * Validates ONLY the {@link context} ibgib itself and saga frame/msg stone(s)
121
117
  * ({@link SyncSagaContextIbGib_V1.sagaFrame}).
122
118
  *
123
119
  * Does NOT...
124
- * * validate keystones (authn or authz)
120
+ * * validate authn or authz
125
121
  * * validate domain payload ibgibs...
126
122
  * * intrinsically
127
123
  * * in relation to this context (addrs match up)
@@ -154,11 +150,10 @@ export async function validateContextAndSagaFrame({
154
150
  errors.push(`context.sagaFrame is falsy. (E: b4edd88f4963f493789f83b29ba2df26)`);
155
151
  }
156
152
 
157
- // if this is already invalid, we could have intrinsic validation errors, which are a non-starter.
153
+ // if this is already invalid, we could have intrinsic validation
154
+ // errors, which are a non-starter.
158
155
  if (errors.length > 0) { return errors; /* <<<< returns early */ }
159
156
 
160
- // validate the entire context graph intrinsically, including saga frame, stones, identity(s) (if applicable but not authentication, that will be done in a separate step)
161
-
162
157
  // ~~ensure the non-dto properties on the context object (i.e. props
163
158
  // that are not ib, gib, data, or rel8ns) match the data in the
164
159
  // context object~~ NO. THIS WILL BE IN A SEPARATE FUNCTION.
@@ -176,7 +171,6 @@ export async function validateContextAndSagaFrame({
176
171
  }
177
172
  }
178
173
 
179
-
180
174
  /**
181
175
  * validates {@link SyncSagaContextIbGib_V1.payloadIbGibsDomain} intrinsically,
182
176
  * and ensures that these payloadIbGibs also match the expected addrs in
@@ -198,67 +192,13 @@ export async function validateContextDomainPayloadIbGibs({ context }: { context:
198
192
  }
199
193
  }
200
194
 
201
- /**
202
- * move to sync-peer-helpers.mts as a pure function?
203
- */
204
195
  export async function authenticateContext({
205
- context,
206
- space,
207
- keystoneSvc,
208
- }: {
209
- context: SyncSagaContextIbGib_V1,
210
- space: IbGibSpaceAny,
211
- keystoneSvc?: KeystoneService_V1,
212
196
  }): Promise<string[]> {
213
197
  const lc = `[${authenticateContext.name}]`;
214
198
  try {
215
- if (logalot) { console.log(`${lc} starting... (I: 2677a482dfa873dcd1aa04a3031ff826)`); }
216
-
217
- const errors: string[] = [];
218
- if (!keystoneSvc) {
219
- if (logalot) { console.warn(`${lc} No keystoneSvc provided. Skipping context authentication. (W: d34b8ad93d84a1ba8d8f7facd288826)`); }
220
- return errors;
221
- }
222
-
223
- // Bill Architecture: We only sign at the context level.
224
- // If the context refers to a session keystone, we must have a signedSessionKeystone
225
- // as well to verify the most recent turn.
226
- const { sessionKeystone: prevKeystoneAddrs } = context.rel8ns || {};
227
- const { signedSessionKeystone: currKeystone } = context;
228
-
229
- if (prevKeystoneAddrs && prevKeystoneAddrs.length > 0) {
230
- if (!currKeystone) {
231
- errors.push(`context.rel8ns.sessionKeystone present but context.signedSessionKeystone falsy. (E: b6e5a8ad93d84260a8d8e7facd288826)`);
232
- return errors;
233
- }
234
-
235
- // Retrieve the previous keystone frame from space
236
- const prevKeystoneAddr = prevKeystoneAddrs[0];
237
- const getPrevRes = await getFromSpace({ addr: prevKeystoneAddr, space });
238
- if (!getPrevRes.success || !getPrevRes.ibGibs || getPrevRes.ibGibs.length === 0) {
239
- errors.push(`couldn't find previous session keystone (${prevKeystoneAddr}) in space (${space.ib}). (E: 7c34b8ad94d84a9ba8cbe7facd288826)`);
240
- return errors;
241
- }
242
- const prevKeystone = getPrevRes.ibGibs[0] as KeystoneIbGib_V1;
243
-
244
- // 1. Validate the transition (API replay of evolution + intrinsic validation)
245
- const transitionErrors = await keystoneSvc.validate({
246
- currentIbGib: currKeystone,
247
- prevIbGib: prevKeystone,
248
- });
249
- if (transitionErrors.length > 0) {
250
- errors.push(`Invalid session keystone transition: ${transitionErrors.join(', ')} (E: d34b8ad95d84b90a8d8ef7facd288826)`);
251
- }
252
-
253
- // 2. Verify that the signature in current keystone actually targets this context
254
- const contextAddr = getIbGibAddr({ ibGib: context });
255
- const proofTargetsThisContext = currKeystone.data?.proofs.some(p => p.claim.target === contextAddr);
256
- if (!proofTargetsThisContext) {
257
- errors.push(`Session keystone signature does not target the current context ibgib (${contextAddr}). (E: f3e5a8ad96d84c1ba8d8f7facd288826)`);
258
- }
259
- }
260
-
261
- return errors;
199
+ if (logalot) { console.log(`${lc} starting... (I: 3c34e8f1d6ef965f98725c88459ea926)`); }
200
+ console.warn(`${lc}[NAG] not thrown. not implemented right now after removing all identity-related code. (W: e5fad31cfb49eef198a189a82dbcf726)`)
201
+ return [];
262
202
  } catch (error) {
263
203
  console.error(`${lc} ${extractErrorMsg(error)}`);
264
204
  throw error;
@@ -8,7 +8,6 @@ import { IbGibData_V1, IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/ty
8
8
  import { SYNC_SAGA_PAYLOAD_ADDRS_DOMAIN } from '../sync-constants.mjs';
9
9
  import { SyncIbGib_V1 } from '../sync-types.mjs';
10
10
  import { SYNC_SAGA_CONTEXT_ATOM } from './sync-saga-context-constants.mjs';
11
- import { KeystoneIbGib_V1 } from '../../keystone/keystone-types.mjs';
12
11
 
13
12
  export interface SyncSagaContextIb_V1 {
14
13
  atom: typeof SYNC_SAGA_CONTEXT_ATOM;
@@ -39,7 +38,7 @@ export interface SyncSagaContextData_V1 extends IbGibData_V1 {
39
38
 
40
39
  /**
41
40
  * Relationships for the Sync Saga Context.
42
- * Contains the "Tip" saga frame and all necessary dependency stones/identities/claims.
41
+ * Contains the "Tip" saga frame and all necessary dependency stones.
43
42
  */
44
43
  export interface SyncSagaContextRel8ns_V1 extends IbGibRel8ns_V1 {
45
44
  /**
@@ -49,24 +48,6 @@ export interface SyncSagaContextRel8ns_V1 extends IbGibRel8ns_V1 {
49
48
  */
50
49
  sagaFrame: IbGibAddr[];
51
50
 
52
- /**
53
- * The Ephemeral Session Keystone Identity used for this saga. Required for
54
- * validating the saga frame and this context.
55
- *
56
- * WARNING!!!: THIS DOES NOT POINT TO THE CURRENT SESSION KEYSTONE IN
57
- * {@link SyncSagaContextIbGib_V1.signedSessionKeystone}. This points to the
58
- * PREVIOUS FRAME (immediate past) of that frame. That session keystone
59
- * signs with THIS context's frame as its target, so it is logically
60
- * impossible because the hash would be different.
61
- *
62
- * ## notes
63
- *
64
- * ATOW (02/18/2026), this is a single address that will have a primary pool
65
- * for the sender and a delegated pool for the receiver.
66
- *
67
- * @see {@link SyncSagaContextIbGib_V1.signedSessionKeystone}
68
- */
69
- sessionKeystone?: IbGibAddr[];
70
51
  }
71
52
 
72
53
  /**
@@ -89,32 +70,4 @@ export interface SyncSagaContextIbGib_V1 extends IbGib_V1<SyncSagaContextData_V1
89
70
  */
90
71
  sagaFrame: SyncIbGib_V1;
91
72
 
92
- /**
93
- * If session keystone is in play, then this will be populated with that
94
- * keystone. This session keystone will point to the this context ibgib,
95
- * BUT, this context ibgib will point to the **PREVIOUS** frame of the
96
- * keystone.
97
- *
98
- * So in order to verify this context ibgib, we must verify the keystone
99
- * points to this context ibgib AND that this context ibgib points to the
100
- * previous frame of the keystone.
101
- */
102
- signedSessionKeystone?: KeystoneIbGib_V1;
103
-
104
- /**
105
- * If identity is used in the sync transaction, this should be provided. It
106
- * will drive both primary identity keystone evolution (to create session
107
- * keystone), as well as signing the session keystone itself.
108
- *
109
- * when a peer transmits the context ibgib, this does not need to be
110
- * transmitted. Note, however, that if sync is occuring between two remote
111
- * peers and the peer design is not a proxy-based one, then the receiver
112
- * should assign this with their own provider function.
113
- *
114
- * @returns the identity secret when needed to sign/evolve keystone
115
- *
116
- * NOTE: Not 100% sure where I'm putting this so this may end up being
117
- * unused and should thus be removed. Right now, I think this will work.
118
- */
119
- fnIdentitySecret?: () => Promise<string>;
120
73
  }