@agentshouse/mdruntime 0.1.0-cc7bd7a53214e → 0.1.0-cc8c6d652ec3b

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 (185) hide show
  1. package/README.md +24 -11
  2. package/dist/adapter.d.ts +193 -53
  3. package/dist/adapter.d.ts.map +1 -1
  4. package/dist/adapter.js +1 -9
  5. package/dist/attached-model.d.ts +15 -0
  6. package/dist/attached-model.d.ts.map +1 -0
  7. package/dist/attached-model.js +81 -0
  8. package/dist/attempt.d.ts +16 -0
  9. package/dist/attempt.d.ts.map +1 -0
  10. package/dist/attempt.js +70 -0
  11. package/dist/binary.d.ts +18 -0
  12. package/dist/binary.d.ts.map +1 -0
  13. package/dist/binary.js +8 -0
  14. package/dist/bootstrap.d.ts +36 -6
  15. package/dist/bootstrap.d.ts.map +1 -1
  16. package/dist/bootstrap.js +202 -48
  17. package/dist/chain.d.ts +11 -0
  18. package/dist/chain.d.ts.map +1 -0
  19. package/dist/chain.js +64 -0
  20. package/dist/change-set.d.ts +9 -14
  21. package/dist/change-set.d.ts.map +1 -1
  22. package/dist/change-set.js +11 -56
  23. package/dist/change.d.ts +45 -0
  24. package/dist/change.d.ts.map +1 -1
  25. package/dist/change.js +34 -0
  26. package/dist/client.d.ts +38 -17
  27. package/dist/client.d.ts.map +1 -1
  28. package/dist/client.js +159 -30
  29. package/dist/collection.d.ts +12 -14
  30. package/dist/collection.d.ts.map +1 -1
  31. package/dist/collection.js +52 -56
  32. package/dist/compile.d.ts +16 -0
  33. package/dist/compile.d.ts.map +1 -0
  34. package/dist/compile.js +786 -0
  35. package/dist/connection.d.ts +64 -26
  36. package/dist/connection.d.ts.map +1 -1
  37. package/dist/connection.js +3961 -1063
  38. package/dist/conversation.d.ts +60 -20
  39. package/dist/conversation.d.ts.map +1 -1
  40. package/dist/conversation.js +834 -262
  41. package/dist/digest.d.ts +7 -0
  42. package/dist/digest.d.ts.map +1 -0
  43. package/dist/digest.js +113 -0
  44. package/dist/durability.d.ts +4 -1
  45. package/dist/durability.d.ts.map +1 -1
  46. package/dist/durability.js +5 -0
  47. package/dist/entry.d.ts +20 -0
  48. package/dist/entry.d.ts.map +1 -0
  49. package/dist/entry.js +151 -0
  50. package/dist/expectation.d.ts +21 -0
  51. package/dist/expectation.d.ts.map +1 -0
  52. package/dist/expectation.js +70 -0
  53. package/dist/failure.d.ts +13 -0
  54. package/dist/failure.d.ts.map +1 -0
  55. package/dist/failure.js +19 -0
  56. package/dist/fence.d.ts +6 -0
  57. package/dist/fence.d.ts.map +1 -0
  58. package/dist/fence.js +10 -0
  59. package/dist/file.d.ts +2 -19
  60. package/dist/file.d.ts.map +1 -1
  61. package/dist/file.js +7 -122
  62. package/dist/fulltext.d.ts +27 -0
  63. package/dist/fulltext.d.ts.map +1 -0
  64. package/dist/fulltext.js +370 -0
  65. package/dist/host.d.ts +13 -2
  66. package/dist/host.d.ts.map +1 -1
  67. package/dist/host.js +136 -34
  68. package/dist/identity.d.ts +4 -0
  69. package/dist/identity.d.ts.map +1 -1
  70. package/dist/identity.js +16 -1
  71. package/dist/index.d.ts +20 -9
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +9 -0
  74. package/dist/live.d.ts +22 -0
  75. package/dist/live.d.ts.map +1 -0
  76. package/dist/live.js +123 -0
  77. package/dist/media.d.ts +8 -0
  78. package/dist/media.d.ts.map +1 -0
  79. package/dist/media.js +218 -0
  80. package/dist/memory.d.ts +26 -9
  81. package/dist/memory.d.ts.map +1 -1
  82. package/dist/memory.js +298 -86
  83. package/dist/messages.d.ts +28 -0
  84. package/dist/messages.d.ts.map +1 -0
  85. package/dist/messages.js +90 -0
  86. package/dist/model.d.ts +22 -14
  87. package/dist/model.d.ts.map +1 -1
  88. package/dist/model.js +13 -4
  89. package/dist/name.d.ts +4 -0
  90. package/dist/name.d.ts.map +1 -0
  91. package/dist/name.js +122 -0
  92. package/dist/observation.d.ts +20 -2
  93. package/dist/observation.d.ts.map +1 -1
  94. package/dist/observation.js +113 -12
  95. package/dist/open.d.ts +2 -0
  96. package/dist/open.d.ts.map +1 -0
  97. package/dist/open.js +1 -0
  98. package/dist/opened.d.ts +22 -0
  99. package/dist/opened.d.ts.map +1 -0
  100. package/dist/opened.js +107 -0
  101. package/dist/outcome.d.ts +72 -5
  102. package/dist/outcome.d.ts.map +1 -1
  103. package/dist/outcome.js +81 -1
  104. package/dist/overlay.d.ts +15 -5
  105. package/dist/overlay.d.ts.map +1 -1
  106. package/dist/overlay.js +136 -180
  107. package/dist/paths.d.ts +1 -1
  108. package/dist/paths.d.ts.map +1 -1
  109. package/dist/paths.js +4 -16
  110. package/dist/query.d.ts +71 -5
  111. package/dist/query.d.ts.map +1 -1
  112. package/dist/query.js +122 -40
  113. package/dist/reach.d.ts +18 -4
  114. package/dist/reach.d.ts.map +1 -1
  115. package/dist/reach.js +243 -80
  116. package/dist/react.d.ts +43 -0
  117. package/dist/react.d.ts.map +1 -0
  118. package/dist/react.js +54 -0
  119. package/dist/readiness.d.ts +52 -0
  120. package/dist/readiness.d.ts.map +1 -0
  121. package/dist/readiness.js +27 -0
  122. package/dist/recovery.d.ts +26 -0
  123. package/dist/recovery.d.ts.map +1 -0
  124. package/dist/recovery.js +224 -0
  125. package/dist/refresh.d.ts +20 -7
  126. package/dist/refresh.d.ts.map +1 -1
  127. package/dist/refresh.js +127 -55
  128. package/dist/replica.d.ts +58 -33
  129. package/dist/replica.d.ts.map +1 -1
  130. package/dist/replica.js +320 -158
  131. package/dist/room-draft.d.ts +57 -10
  132. package/dist/room-draft.d.ts.map +1 -1
  133. package/dist/room-draft.js +222 -39
  134. package/dist/rows.d.ts +39 -34
  135. package/dist/rows.d.ts.map +1 -1
  136. package/dist/rows.js +195 -81
  137. package/dist/save.d.ts +74 -6
  138. package/dist/save.d.ts.map +1 -1
  139. package/dist/save.js +898 -181
  140. package/dist/search.d.ts +41 -29
  141. package/dist/search.d.ts.map +1 -1
  142. package/dist/search.js +37 -105
  143. package/dist/seed.d.ts +16 -0
  144. package/dist/seed.d.ts.map +1 -0
  145. package/dist/seed.js +75 -0
  146. package/dist/shared.d.ts +15 -0
  147. package/dist/shared.d.ts.map +1 -0
  148. package/dist/shared.js +421 -0
  149. package/dist/status.d.ts +7 -2
  150. package/dist/status.d.ts.map +1 -1
  151. package/dist/status.js +3 -9
  152. package/dist/store.d.ts +110 -59
  153. package/dist/store.d.ts.map +1 -1
  154. package/dist/store.js +324 -344
  155. package/dist/stored.d.ts +130 -0
  156. package/dist/stored.d.ts.map +1 -0
  157. package/dist/stored.js +560 -0
  158. package/dist/tables.d.ts +325 -0
  159. package/dist/tables.d.ts.map +1 -0
  160. package/dist/tables.js +578 -0
  161. package/dist/transfer.d.ts +0 -5
  162. package/dist/transfer.d.ts.map +1 -1
  163. package/dist/turn.d.ts +9 -0
  164. package/dist/turn.d.ts.map +1 -0
  165. package/dist/turn.js +75 -0
  166. package/dist/validation.d.ts +29 -0
  167. package/dist/validation.d.ts.map +1 -0
  168. package/dist/validation.js +101 -0
  169. package/dist/windows.d.ts +22 -0
  170. package/dist/windows.d.ts.map +1 -0
  171. package/dist/windows.js +89 -0
  172. package/dist/wire.d.ts +170 -45
  173. package/dist/wire.d.ts.map +1 -1
  174. package/dist/wire.js +69 -46
  175. package/dist/words.d.ts +19 -0
  176. package/dist/words.d.ts.map +1 -0
  177. package/dist/words.js +156 -0
  178. package/package.json +33 -10
  179. package/AGENTS.md +0 -215
  180. package/dist/attachment.d.ts +0 -3
  181. package/dist/attachment.d.ts.map +0 -1
  182. package/dist/attachment.js +0 -8
  183. package/dist/read-side.d.ts +0 -18
  184. package/dist/read-side.d.ts.map +0 -1
  185. package/dist/read-side.js +0 -377
@@ -0,0 +1,81 @@
1
+ import { verify } from '@agentshouse/mdmodel';
2
+ import { MD_MODEL } from './collection.js';
3
+ import { NO_MODEL, sameModel } from './model.js';
4
+ export const NO_ROOM_TYPES = Object.freeze({ types: Object.freeze({}) });
5
+ export function roomTypesOf(schema, nameable = []) {
6
+ if (schema === undefined)
7
+ return NO_ROOM_TYPES;
8
+ const verified = verify(schema);
9
+ if (verified.verdict === 'refuse')
10
+ throw new Error(`the Adapter's Room types refuse ${verified.rule}`);
11
+ return Object.freeze({ ...verified.model, nameable });
12
+ }
13
+ const BUILT_IN = {
14
+ kind: 'model',
15
+ snapshot: { identity: 'built-in', version: '', schema: null, revision: null },
16
+ };
17
+ export function builtInModel(roomTypes) {
18
+ return attachedModel(BUILT_IN, NO_MODEL, roomTypes).state;
19
+ }
20
+ const VERIFIED_SCHEMAS = 64;
21
+ const verifications = new WeakMap();
22
+ function schemaVerification(schema, roomTypes) {
23
+ let held = verifications.get(roomTypes);
24
+ if (held === undefined) {
25
+ held = new Map();
26
+ verifications.set(roomTypes, held);
27
+ }
28
+ const known = held.get(schema);
29
+ if (known !== undefined)
30
+ return known;
31
+ const verification = verify(schema, roomTypes);
32
+ if (held.size >= VERIFIED_SCHEMAS)
33
+ held.delete(held.keys().next().value);
34
+ held.set(schema, verification);
35
+ return verification;
36
+ }
37
+ export function attachedModel(answer, previous, roomTypes) {
38
+ if (answer.kind === 'model-unavailable') {
39
+ return { state: { status: 'unavailable', reason: answer.reason }, refused: null };
40
+ }
41
+ if (previous.status !== 'unavailable' &&
42
+ sameModel(previous.snapshot, answer.snapshot) &&
43
+ previous.snapshot.schema !== answer.snapshot.schema) {
44
+ return {
45
+ state: {
46
+ status: 'unavailable',
47
+ reason: 'invalid',
48
+ schema: answer.snapshot.schema,
49
+ revision: answer.snapshot.revision,
50
+ },
51
+ refused: null,
52
+ };
53
+ }
54
+ const verified = answer.snapshot.schema === null
55
+ ? { verdict: 'accept', model: roomTypes }
56
+ : schemaVerification(answer.snapshot.schema, roomTypes);
57
+ if (verified.verdict === 'refuse') {
58
+ return {
59
+ state: {
60
+ status: 'unavailable',
61
+ reason: 'invalid',
62
+ schema: answer.snapshot.schema,
63
+ revision: answer.snapshot.revision,
64
+ },
65
+ refused: {
66
+ identity: answer.snapshot.identity,
67
+ rule: verified.rule,
68
+ ...(verified.location === undefined ? {} : { location: verified.location }),
69
+ },
70
+ };
71
+ }
72
+ return {
73
+ state: {
74
+ status: 'current',
75
+ snapshot: structuredClone(answer.snapshot),
76
+ verifiedWith: MD_MODEL,
77
+ types: verified.model.types,
78
+ },
79
+ refused: null,
80
+ };
81
+ }
@@ -0,0 +1,16 @@
1
+ export type Answered = 'accepted' | 'refused' | 'unanswered' | 'offline';
2
+ export type Identities = {
3
+ of(intent: string): string;
4
+ settle(answered: Answered): void;
5
+ };
6
+ export declare function identities(mint?: () => string): Identities;
7
+ export declare function intentOf(name: string, about: unknown): string;
8
+ export type Attempt = {
9
+ identity(intent: string): string;
10
+ settle(answered: Answered, drop: (act: number) => void): void;
11
+ };
12
+ export type Attempts = {
13
+ begin(act: number): Attempt;
14
+ };
15
+ export declare function attempts(mint?: () => string): Attempts;
16
+ //# sourceMappingURL=attempt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attempt.d.ts","sourceRoot":"","sources":["../src/attempt.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC;AAEzE,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,GAAE,MAAM,MAAoC,GAAG,UAAU,CAmBvF;AAID,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAa7D;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7B,CAAC;AAEF,wBAAgB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,MAAM,GAAG,QAAQ,CAyBtD"}
@@ -0,0 +1,70 @@
1
+ import { changeBatchIdentity } from './identity.js';
2
+ export function identities(mint = () => changeBatchIdentity()) {
3
+ const kept = new Map();
4
+ let used = new Map();
5
+ return {
6
+ of(intent) {
7
+ const one = used.get(intent) ?? kept.get(intent) ?? mint();
8
+ used.set(intent, one);
9
+ return one;
10
+ },
11
+ settle(answered) {
12
+ if (answered !== 'offline') {
13
+ for (const [intent, one] of used) {
14
+ if (answered === 'unanswered')
15
+ kept.set(intent, one);
16
+ else
17
+ kept.delete(intent);
18
+ }
19
+ }
20
+ used = new Map();
21
+ },
22
+ };
23
+ }
24
+ const blobs = new WeakMap();
25
+ export function intentOf(name, about) {
26
+ const carried = [];
27
+ const json = JSON.stringify(about, (_key, value) => {
28
+ if (!(value instanceof Blob))
29
+ return value;
30
+ let identity = blobs.get(value);
31
+ if (identity === undefined) {
32
+ identity = changeBatchIdentity();
33
+ blobs.set(value, identity);
34
+ }
35
+ carried.push(identity);
36
+ return null;
37
+ });
38
+ return `${name}\u0000${json}\u0000${carried.join(',')}`;
39
+ }
40
+ export function attempts(mint) {
41
+ const numbers = identities(mint);
42
+ const waiting = new Map();
43
+ return {
44
+ begin(act) {
45
+ const intents = [];
46
+ return {
47
+ identity(intent) {
48
+ intents.push(intent);
49
+ return numbers.of(intent);
50
+ },
51
+ settle(answered, drop) {
52
+ numbers.settle(answered);
53
+ if (answered === 'refused' || answered === 'offline')
54
+ drop(act);
55
+ if (answered === 'offline')
56
+ return;
57
+ for (const intent of intents) {
58
+ const earlier = waiting.get(intent);
59
+ if (earlier !== undefined && earlier !== act)
60
+ drop(earlier);
61
+ if (answered === 'unanswered')
62
+ waiting.set(intent, act);
63
+ else
64
+ waiting.delete(intent);
65
+ }
66
+ },
67
+ };
68
+ },
69
+ };
70
+ }
@@ -0,0 +1,18 @@
1
+ import type { HeldBinary } from './overlay.js';
2
+ export type BinaryFileRecord = {
3
+ readonly state: 'accepted';
4
+ readonly revision: string;
5
+ readonly path: string;
6
+ readonly byteLength: number;
7
+ readonly mediaType: string;
8
+ readonly sha256: string;
9
+ } | {
10
+ readonly state: 'pending';
11
+ readonly localId: string;
12
+ readonly path: string;
13
+ readonly byteLength: number;
14
+ readonly mediaType: string;
15
+ readonly sha256: string;
16
+ };
17
+ export declare function binaryRecord(path: string, held: HeldBinary, revision: string | undefined): BinaryFileRecord;
18
+ //# sourceMappingURL=binary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GACxB;IACE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,GACD;IACE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEN,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,gBAAgB,CAKlB"}
package/dist/binary.js ADDED
@@ -0,0 +1,8 @@
1
+ export function binaryRecord(path, held, revision) {
2
+ const facts = { byteLength: held.byteLength, mediaType: held.mediaType, sha256: held.sha256 };
3
+ if (held.state === 'pending')
4
+ return { state: 'pending', localId: held.localId, path, ...facts };
5
+ if (revision === undefined)
6
+ throw new Error(`the accepted binary file ${path} has no revision`);
7
+ return { state: 'accepted', revision, path, ...facts };
8
+ }
@@ -1,10 +1,40 @@
1
1
  import type { ModelState } from './model.js';
2
- import type { Adapter, AdapterFailure, Authorization, DiscoveredRoom } from './adapter.js';
3
- import { type Staged } from './replica.js';
2
+ import type { Adapter, AdapterFailure, Authorization, DiscoveredRoom, HeldContent, RetryableRefusal, RoomModels } from './adapter.js';
3
+ import type { Composition } from './collection.js';
4
+ import type { InstallationStep } from './readiness.js';
5
+ import { type Refreshing } from './refresh.js';
6
+ import type { ReplicaRecord } from './replica.js';
7
+ import type { StagedPage, TransferRecord } from './store.js';
4
8
  import { type Unconfirmed } from './transfer.js';
5
- export type BootstrapOutcome = Staged | Unconfirmed | AdapterFailure;
6
- export declare function bootstrapRoom(adapter: Adapter, authorization: Authorization, room: DiscoveredRoom, models: {
9
+ export type Bootstrapped = {
10
+ kind: 'staged';
11
+ record: ReplicaRecord;
12
+ refreshed: boolean;
13
+ };
14
+ export type BootstrapOutcome = Bootstrapped | Unconfirmed | RetryableRefusal | AdapterFailure;
15
+ export type HeldModels = {
7
16
  collection: ModelState;
8
- selection: ModelState;
9
- }, continuing: () => boolean): Promise<BootstrapOutcome>;
17
+ };
18
+ export type Remodel = (models: RoomModels | undefined, held: HeldModels) => HeldModels;
19
+ export type Reads = Pick<Adapter, 'bootstrap' | 'refresh' | 'reached'>;
20
+ export type Arriving = {
21
+ at(bytes: number): void;
22
+ end(): void;
23
+ };
24
+ export type Staging = {
25
+ held(locator: string): TransferRecord | null;
26
+ turn(locator: string, step: InstallationStep): Promise<() => void>;
27
+ unqueued(): Promise<void>;
28
+ queued(text: number): () => void;
29
+ arriving(locator: string): Arriving;
30
+ readonly streamed: boolean;
31
+ stage(record: TransferRecord, page: StagedPage, composition: Composition): Promise<TransferRecord | null>;
32
+ derive(locator: string, key: number, composition: Composition): Promise<boolean>;
33
+ refreshing(locator: string, key: number, composition: Composition): Promise<Refreshing>;
34
+ abandon(locator: string): Promise<void>;
35
+ setAside(locator: string): Promise<void>;
36
+ release(key: number): Promise<void>;
37
+ content(key: number): HeldContent;
38
+ };
39
+ export declare function bootstrapRoom(adapter: Reads, authorization: Authorization, room: DiscoveredRoom, held: HeldModels, builtIn: ModelState, remodel: Remodel, continuing: () => boolean, staging: Staging, reuse: HeldContent | null): Promise<BootstrapOutcome>;
10
40
  //# sourceMappingURL=bootstrap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,cAAc,EAGf,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,GAAG,cAAc,CAAC;AAErE,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAAE,EACzD,UAAU,EAAE,MAAM,OAAO,GACxB,OAAO,CAAC,gBAAgB,CAAC,CA+C3B"}
1
+ {"version":3,"file":"bootstrap.d.ts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,EACzB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,WAAW,GAAG,IAAI,GACxB,OAAO,CAAC,gBAAgB,CAAC,CAe3B"}
package/dist/bootstrap.js CHANGED
@@ -1,56 +1,210 @@
1
- import { declaredAttachments } from './attachment.js';
2
- import { readStaged } from './replica.js';
1
+ import { transferIdentity } from './identity.js';
2
+ import { advancement, pageEntries } from './refresh.js';
3
+ import { entriesIn } from './shared.js';
3
4
  import { unconfirmed } from './transfer.js';
4
- export async function bootstrapRoom(adapter, authorization, room, models, continuing) {
5
- const first = await adapter.bootstrap(authorization, {
6
- locator: room.locator,
7
- selection: room.replica.selection,
8
- });
9
- if (first.kind !== 'bootstrap')
5
+ const NOTHING_PRIOR = () => Promise.resolve(new Map());
6
+ function textOf(page) {
7
+ let text = 0;
8
+ for (const [, content] of entriesIn(page.documents))
9
+ text += content.length;
10
+ return text;
11
+ }
12
+ async function pageOf(page) {
13
+ return {
14
+ entries: await pageEntries(page, [], page.roomVersion, NOTHING_PRIOR),
15
+ folders: page.folders ?? [],
16
+ };
17
+ }
18
+ function heldTogether(first, second) {
19
+ if (first === null)
20
+ return second;
21
+ return {
22
+ async files(after, limit) {
23
+ const [left, right] = await Promise.all([
24
+ first.files(after, limit),
25
+ second.files(after, limit),
26
+ ]);
27
+ const merged = new Map([...left, ...right].map((file) => [file.path, file]));
28
+ return [...merged.values()]
29
+ .sort((one, other) => (one.path < other.path ? -1 : one.path > other.path ? 1 : 0))
30
+ .slice(0, limit);
31
+ },
32
+ async contents(paths) {
33
+ const [left, right] = await Promise.all([first.contents(paths), second.contents(paths)]);
34
+ return new Map([...left, ...right]);
35
+ },
36
+ };
37
+ }
38
+ const NO_CONTENT = {
39
+ files: () => Promise.resolve([]),
40
+ contents: () => Promise.resolve(new Map()),
41
+ };
42
+ export async function bootstrapRoom(adapter, authorization, room, held, builtIn, remodel, continuing, staging, reuse) {
43
+ if (staging.held(room.locator) !== null)
44
+ await staging.abandon(room.locator);
45
+ const begun = (pool) => started(adapter, authorization, room, held, builtIn, remodel, continuing, staging, pool);
46
+ const first = await begun(reuse);
47
+ if (first.kind !== 'expired')
10
48
  return first;
11
- const roomVersion = first.roomVersion;
12
- const documents = { ...first.documents };
13
- const revisions = { ...first.revisions };
14
- const changes = { ...first.changes };
15
- const binaryTargets = new Set(first.binaryTargets);
16
- const attachments = [first.attachments ?? []];
17
- let pageToken = first.pageToken;
18
- while (pageToken !== undefined) {
19
- if (!continuing())
20
- return unconfirmed;
21
- const page = await adapter.bootstrap(authorization, {
22
- locator: room.locator,
23
- selection: room.replica.selection,
24
- pageToken,
25
- });
26
- if (page.kind !== 'bootstrap')
27
- return page;
28
- if (page.roomVersion !== roomVersion)
29
- return unconfirmed;
30
- Object.assign(documents, page.documents);
31
- Object.assign(revisions, page.revisions);
32
- Object.assign(changes, page.changes);
33
- for (const target of page.binaryTargets)
34
- binaryTargets.add(target);
35
- attachments.push(page.attachments ?? []);
36
- pageToken = page.pageToken;
37
- }
38
- return readStaged({
39
- locator: room.locator,
49
+ await staging.setAside(room.locator);
50
+ try {
51
+ const replacement = await begun(heldTogether(reuse, first.held));
52
+ if (replacement.kind !== 'expired')
53
+ return replacement;
54
+ await staging.abandon(room.locator);
55
+ return unconfirmed;
56
+ }
57
+ finally {
58
+ if (first.key !== null)
59
+ await staging.release(first.key);
60
+ }
61
+ }
62
+ function dropped(ahead) {
63
+ void ahead?.fetched.then(({ next, written }) => {
64
+ written();
65
+ dropped(next);
66
+ }, () => { });
67
+ }
68
+ function compositionFor(room, models, builtIn) {
69
+ return {
70
+ model: models.collection,
71
+ selection: room.typedSelection === undefined
72
+ ? null
73
+ : { roots: room.typedSelection.roots, model: builtIn },
74
+ };
75
+ }
76
+ async function started(adapter, authorization, room, held, builtIn, remodel, continuing, staging, pool) {
77
+ let outcome;
78
+ try {
79
+ outcome = await bundle(adapter, authorization, room, held, builtIn, remodel, continuing, staging, pool);
80
+ }
81
+ catch (error) {
82
+ await staging.abandon(room.locator).catch(() => { });
83
+ throw error;
84
+ }
85
+ if (outcome.kind !== 'staged' && outcome.kind !== 'expired') {
86
+ await staging.abandon(room.locator);
87
+ }
88
+ return outcome;
89
+ }
90
+ async function bundle(adapter, authorization, room, held, builtIn, remodel, continuing, staging, pool) {
91
+ const locator = room.locator;
92
+ const selection = room.replica.selection;
93
+ const ending = new AbortController();
94
+ const arriving = staging.arriving(locator);
95
+ const downloaded = await staging.turn(locator, 'downloading');
96
+ const asking = (token) => adapter.bootstrap(authorization, {
97
+ locator,
98
+ selection,
99
+ signal: ending.signal,
100
+ ...(token === null
101
+ ? { arriving: (bytes) => arriving.at(bytes) }
102
+ : { pageToken: token }),
103
+ ...(pool === null ? {} : { held: pool }),
104
+ });
105
+ const fetching = (token) => {
106
+ const fetched = (async () => {
107
+ await staging.unqueued();
108
+ const page = continuing() ? await asking(token) : unconfirmed;
109
+ if (page.kind !== 'bootstrap')
110
+ return { page, next: null, written: () => { } };
111
+ const written = staging.queued(textOf(page));
112
+ const later = page.pageToken;
113
+ if (later === undefined) {
114
+ downloaded();
115
+ arriving.end();
116
+ }
117
+ return { page, written, next: later === undefined || !continuing() ? null : fetching(later) };
118
+ })();
119
+ fetched.catch(() => { });
120
+ return { fetched };
121
+ };
122
+ let transfer = null;
123
+ let ahead = fetching(null);
124
+ try {
125
+ while (ahead !== null) {
126
+ if (!continuing())
127
+ return unconfirmed;
128
+ const fetched = await ahead.fetched;
129
+ ahead = fetched.next;
130
+ try {
131
+ if (!continuing())
132
+ return unconfirmed;
133
+ const page = fetched.page;
134
+ if (page.kind === 'beyond-horizon') {
135
+ const key = transfer?.key ?? null;
136
+ return { kind: 'expired', held: key === null ? NO_CONTENT : staging.content(key), key };
137
+ }
138
+ if (page.kind !== 'bootstrap')
139
+ return page;
140
+ const models = remodel(page.models, transfer?.models ?? held);
141
+ const staged = await staging.stage({
142
+ locator,
143
+ transfer: transfer?.transfer ?? transferIdentity(),
144
+ selection,
145
+ from: transfer !== null && adapter.reached(locator, page.roomVersion, transfer.from)
146
+ ? transfer.from
147
+ : page.roomVersion,
148
+ last: transfer !== null && !adapter.reached(locator, page.roomVersion, transfer.last)
149
+ ? transfer.last
150
+ : page.roomVersion,
151
+ done: { bytes: (transfer?.done.bytes ?? 0) + (page.bytes ?? 0) },
152
+ models,
153
+ key: transfer?.key ?? null,
154
+ }, await pageOf(page), compositionFor(room, models, builtIn));
155
+ if (staged === null)
156
+ return unconfirmed;
157
+ transfer = staged;
158
+ }
159
+ finally {
160
+ fetched.written();
161
+ }
162
+ }
163
+ }
164
+ finally {
165
+ ending.abort();
166
+ downloaded();
167
+ arriving.end();
168
+ dropped(ahead);
169
+ }
170
+ if (transfer === null)
171
+ return unconfirmed;
172
+ const installed = transfer;
173
+ const composition = compositionFor(room, installed.models, builtIn);
174
+ if (!(await staging.derive(locator, installed.key, composition)))
175
+ return unconfirmed;
176
+ await staging.turn(locator, 'replaying');
177
+ if (!continuing())
178
+ return unconfirmed;
179
+ const record = {
180
+ locator,
40
181
  name: room.name,
182
+ handle: room.handle,
41
183
  operations: room.operations,
42
184
  replica: room.replica,
43
- attachedModel: room.attachedModel,
44
- model: models.collection,
185
+ model: installed.models.collection,
45
186
  typedSelection: room.typedSelection ?? null,
46
- selectionModel: models.selection,
47
187
  providerOwnedPaths: room.providerOwnedPaths,
48
- roomVersion,
49
- documents,
50
- binaryTargets: [...binaryTargets].sort(),
51
- revisions,
52
- changes,
53
- written: Object.fromEntries(Object.keys(documents).map((path) => [path, roomVersion])),
54
- attachments: declaredAttachments(attachments),
55
- });
188
+ roomVersion: installed.from,
189
+ transfer: installed.transfer,
190
+ inventory: installed.done,
191
+ key: installed.key,
192
+ };
193
+ const last = installed.last;
194
+ const refresh = adapter.refresh;
195
+ const reconciled = last === installed.from &&
196
+ (staging.streamed || adapter.reached(locator, last, room.roomVersion))
197
+ ? { kind: 'still-current' }
198
+ : refresh === undefined
199
+ ? unconfirmed
200
+ : await advancement(refresh, authorization, record, remodel, continuing, await staging.refreshing(locator, record.key, composition));
201
+ if (reconciled.kind === 'advanced') {
202
+ return { kind: 'staged', record: reconciled.record, refreshed: true };
203
+ }
204
+ if (reconciled.kind === 'still-current')
205
+ return { kind: 'staged', record, refreshed: false };
206
+ if (reconciled.kind === 'beyond-horizon') {
207
+ return { kind: 'expired', held: staging.content(record.key), key: record.key };
208
+ }
209
+ return reconciled;
56
210
  }
@@ -0,0 +1,11 @@
1
+ import type { MdRuntimeClient } from './client.js';
2
+ import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
3
+ type Rows = DocumentResult | GroupResult;
4
+ export type WindowAnswer = Rows | PendingResult;
5
+ export type WindowChain = {
6
+ want(count: number): void;
7
+ close(): void;
8
+ };
9
+ export declare function chainedWindows(runtime: MdRuntimeClient, query: DocumentQuery | GroupQuery, count: number, publish: (answers: readonly (WindowAnswer | null)[], settled: boolean) => void): WindowChain;
10
+ export {};
11
+ //# sourceMappingURL=chain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,UAAU,EACV,WAAW,EACX,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,KAAK,IAAI,GAAG,cAAc,GAAG,WAAW,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,aAAa,CAAC;AAEhD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAaF,wBAAgB,cAAc,CAC5B,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,aAAa,GAAG,UAAU,EACjC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GAC7E,WAAW,CAkEb"}
package/dist/chain.js ADDED
@@ -0,0 +1,64 @@
1
+ function answered(answer) {
2
+ return answer !== null && !('pending' in answer);
3
+ }
4
+ export function chainedWindows(runtime, query, count, publish) {
5
+ let links = [];
6
+ let wanted = count;
7
+ let closed = false;
8
+ const observe = runtime.observe;
9
+ const open = (after, shown) => {
10
+ const link = { after, observation: null, value: shown, fresh: false };
11
+ void observe('query', after === undefined ? query : { ...query, after }).then((observation) => {
12
+ if (closed || !links.includes(link)) {
13
+ observation.close();
14
+ return;
15
+ }
16
+ link.observation = observation;
17
+ const take = (value) => {
18
+ link.value = value;
19
+ link.fresh = true;
20
+ settle();
21
+ };
22
+ observation.subscribe(take);
23
+ take(observation.current());
24
+ }, () => { });
25
+ return link;
26
+ };
27
+ const settle = () => {
28
+ if (closed)
29
+ return;
30
+ const next = [];
31
+ for (let at = 0; at < wanted; at += 1) {
32
+ const before = next[at - 1];
33
+ if (before !== undefined && !before.fresh) {
34
+ next.push(...links.slice(at, wanted));
35
+ break;
36
+ }
37
+ if (before !== undefined && (!answered(before.value) || before.value.next === undefined)) {
38
+ break;
39
+ }
40
+ const after = before === undefined ? undefined : before.value.next;
41
+ const held = links[at];
42
+ next.push(held !== undefined && held.after === after ? held : open(after, held?.value ?? null));
43
+ }
44
+ for (const link of links)
45
+ if (!next.includes(link))
46
+ link.observation?.close();
47
+ links = next;
48
+ publish(links.map((link) => link.value), links.every((link) => link.fresh));
49
+ };
50
+ settle();
51
+ return {
52
+ want(count) {
53
+ if (count === wanted)
54
+ return;
55
+ wanted = count;
56
+ settle();
57
+ },
58
+ close() {
59
+ closed = true;
60
+ for (const link of links)
61
+ link.observation?.close();
62
+ },
63
+ };
64
+ }
@@ -1,14 +1,6 @@
1
- import { type Replica } from './replica.js';
2
- import { type Row } from './rows.js';
3
1
  export type DocumentChange = {
4
- locator: string;
5
- path: string;
6
- before: readonly Row[];
7
- after: readonly Row[];
8
- };
9
- export type MessageChange = {
10
- conversation: string;
11
- identity: string;
2
+ readonly locator: string;
3
+ readonly path: string | null;
12
4
  };
13
5
  export type ChangeSet = {
14
6
  documents: readonly DocumentChange[];
@@ -19,15 +11,18 @@ export type ChangeSet = {
19
11
  rooms: readonly string[];
20
12
  queues: readonly string[];
21
13
  presentations: readonly string[];
22
- messages: readonly MessageChange[];
23
14
  conversations: readonly string[];
24
15
  };
25
- export declare function changeSet(locator: string, before: Replica | null, after: Replica | null, changed?: {
16
+ type Changed = {
17
+ documents?: readonly string[] | null;
26
18
  drafts?: readonly string[];
27
19
  room?: boolean;
28
20
  queue?: boolean;
29
21
  presentation?: string;
30
- }): ChangeSet;
31
- export declare function conversationChangeSet(messages: readonly MessageChange[], conversations: readonly string[]): ChangeSet;
22
+ };
23
+ export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
24
+ export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
32
25
  export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
26
+ export declare function touches(set: ChangeSet, locator: string, path: string): boolean;
27
+ export {};
33
28
  //# sourceMappingURL=change-set.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"change-set.d.ts","sourceRoot":"","sources":["../src/change-set.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiC,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAU,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,EAAE,CAAC;IACvB,KAAK,EAAE,SAAS,GAAG,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,MAAM,MAAM,SAAS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