@agentshouse/mdruntime 0.1.0-alpha.2 → 0.1.0-alpha.21

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 (110) hide show
  1. package/AGENTS.md +87 -0
  2. package/dist/adapter.d.ts +145 -28
  3. package/dist/adapter.d.ts.map +1 -1
  4. package/dist/adapter.js +2 -1
  5. package/dist/adapter.js.map +1 -1
  6. package/dist/bootstrap.d.ts +11 -13
  7. package/dist/bootstrap.d.ts.map +1 -1
  8. package/dist/bootstrap.js +25 -24
  9. package/dist/bootstrap.js.map +1 -1
  10. package/dist/change-set.d.ts +33 -0
  11. package/dist/change-set.d.ts.map +1 -0
  12. package/dist/change-set.js +74 -0
  13. package/dist/change-set.js.map +1 -0
  14. package/dist/change.d.ts +70 -0
  15. package/dist/change.d.ts.map +1 -0
  16. package/dist/change.js +12 -0
  17. package/dist/change.js.map +1 -0
  18. package/dist/client.d.ts +66 -0
  19. package/dist/client.d.ts.map +1 -0
  20. package/dist/client.js +229 -0
  21. package/dist/client.js.map +1 -0
  22. package/dist/collection.d.ts +25 -3
  23. package/dist/collection.d.ts.map +1 -1
  24. package/dist/collection.js +97 -25
  25. package/dist/collection.js.map +1 -1
  26. package/dist/connection.d.ts +87 -5
  27. package/dist/connection.d.ts.map +1 -1
  28. package/dist/connection.js +1653 -70
  29. package/dist/connection.js.map +1 -1
  30. package/dist/conversation.d.ts +57 -0
  31. package/dist/conversation.d.ts.map +1 -0
  32. package/dist/conversation.js +404 -0
  33. package/dist/conversation.js.map +1 -0
  34. package/dist/durability.d.ts +9 -0
  35. package/dist/durability.d.ts.map +1 -0
  36. package/dist/durability.js +11 -0
  37. package/dist/durability.js.map +1 -0
  38. package/dist/file.d.ts +20 -0
  39. package/dist/file.d.ts.map +1 -0
  40. package/dist/file.js +149 -0
  41. package/dist/file.js.map +1 -0
  42. package/dist/host.d.ts +13 -0
  43. package/dist/host.d.ts.map +1 -0
  44. package/dist/host.js +229 -0
  45. package/dist/host.js.map +1 -0
  46. package/dist/identity.d.ts +2 -0
  47. package/dist/identity.d.ts.map +1 -0
  48. package/dist/identity.js +16 -0
  49. package/dist/identity.js.map +1 -0
  50. package/dist/index.d.ts +13 -2
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +1 -0
  53. package/dist/index.js.map +1 -1
  54. package/dist/log.d.ts +5 -0
  55. package/dist/log.d.ts.map +1 -0
  56. package/dist/log.js +15 -0
  57. package/dist/log.js.map +1 -0
  58. package/dist/memory.d.ts +17 -2
  59. package/dist/memory.d.ts.map +1 -1
  60. package/dist/memory.js +264 -21
  61. package/dist/memory.js.map +1 -1
  62. package/dist/model.d.ts +70 -0
  63. package/dist/model.d.ts.map +1 -0
  64. package/dist/model.js +28 -0
  65. package/dist/model.js.map +1 -0
  66. package/dist/outcome.d.ts +37 -0
  67. package/dist/outcome.d.ts.map +1 -0
  68. package/dist/outcome.js +23 -0
  69. package/dist/outcome.js.map +1 -0
  70. package/dist/overlay.d.ts +10 -0
  71. package/dist/overlay.d.ts.map +1 -0
  72. package/dist/overlay.js +245 -0
  73. package/dist/overlay.js.map +1 -0
  74. package/dist/paths.d.ts +6 -0
  75. package/dist/paths.d.ts.map +1 -0
  76. package/dist/paths.js +47 -0
  77. package/dist/paths.js.map +1 -0
  78. package/dist/query.d.ts +13 -0
  79. package/dist/query.d.ts.map +1 -0
  80. package/dist/query.js +18 -0
  81. package/dist/query.js.map +1 -0
  82. package/dist/refresh.d.ts +14 -0
  83. package/dist/refresh.d.ts.map +1 -0
  84. package/dist/refresh.js +65 -0
  85. package/dist/refresh.js.map +1 -0
  86. package/dist/replica.d.ts +33 -0
  87. package/dist/replica.d.ts.map +1 -0
  88. package/dist/replica.js +134 -0
  89. package/dist/replica.js.map +1 -0
  90. package/dist/save.d.ts +35 -0
  91. package/dist/save.d.ts.map +1 -0
  92. package/dist/save.js +561 -0
  93. package/dist/save.js.map +1 -0
  94. package/dist/status.d.ts +25 -0
  95. package/dist/status.d.ts.map +1 -0
  96. package/dist/status.js +32 -0
  97. package/dist/status.js.map +1 -0
  98. package/dist/store.d.ts +86 -4
  99. package/dist/store.d.ts.map +1 -1
  100. package/dist/store.js +394 -9
  101. package/dist/store.js.map +1 -1
  102. package/dist/transfer.d.ts +5 -0
  103. package/dist/transfer.d.ts.map +1 -0
  104. package/dist/transfer.js +5 -0
  105. package/dist/transfer.js.map +1 -0
  106. package/dist/wire.d.ts +63 -0
  107. package/dist/wire.d.ts.map +1 -0
  108. package/dist/wire.js +142 -0
  109. package/dist/wire.js.map +1 -0
  110. package/package.json +13 -4
package/AGENTS.md ADDED
@@ -0,0 +1,87 @@
1
+ # Instructions for the App Creator's agent
2
+
3
+ These instructions address an agent in an environment with Git. Obtain the
4
+ App Repository, change it, build, and push. They are documentation, not
5
+ enforcement.
6
+
7
+ ## The MD Runtime API
8
+
9
+ App code reaches the MD Runtime through the remote client. The surfaces are
10
+ Rooms, Slots, Query, Observe, Types, Draft, Save, Queue, History, Call, Log,
11
+ storage loss, the reported persistence answer, deployment facts, Sync Status, reauthorization,
12
+ conversation, the unsent instruction, and Presentation State.
13
+
14
+ Slots answers each Slot the Provider declares, in its order, with its entries
15
+ in order, each a Room and its segment; a Room two Slots list is the same Room.
16
+
17
+ Rooms, Slots, Query, Observe, Types, Draft, and Save never touch the network.
18
+ History and Call go to the Provider through the Adapter. Every member of the
19
+ client is asynchronous. Results are detached snapshots. Nothing in this
20
+ surface returns the authorization, performs a request the App's code
21
+ composes, or exposes the browser store.
22
+
23
+ Read deployment facts with `deploymentFacts()` and observe replacements with
24
+ `observe('deployment-facts', listener)`. Interpret the opaque value using the
25
+ host's contract. [R038](https://github.com/agentshouse/mdruntime/blob/main/docs/requirements/ledger.md#r038--runtime-host-and-remote-client)
26
+ owns their boundary.
27
+
28
+ The in-memory Adapter at `@agentshouse/mdruntime/memory` is for tests and
29
+ ships in no bundle.
30
+
31
+ ## Draft, Save, and outcome rules
32
+
33
+ A Draft is durable: it survives reload and navigation. A Room that Discovery
34
+ stops listing takes its Drafts, its queue and their outcomes with it. Save takes structured
35
+ changes, validates locally, and on success appends one Change Batch to that
36
+ Room's queue. A local validation failure leaves the Draft and creates
37
+ nothing.
38
+
39
+ Outcomes follow the Provider's answer. Accepted advances the confirmed
40
+ layer. Conflicted and Rejected leave the head in place, carry the affected
41
+ current state and the Provider's structured refusal code and fields as
42
+ returned, and block that Room's queue. The App's code resolves a head by
43
+ discarding it or by saving a corrected Change Batch that replaces it in
44
+ place. Transport failure and Provider unavailability keep work Pending and
45
+ do not infer a rejection. A refusal the Provider marks retryable stays
46
+ Pending until the reset it names; the MD Runtime retries the same Change
47
+ Batch identity and payload and never infers an outcome from transport
48
+ uncertainty. The MD Runtime never combines, reorders, or rebases.
49
+
50
+ ## The neutrality rule
51
+
52
+ No module outside an Adapter package imports, names, or special-cases a
53
+ Provider. MD UI and every App reach data only through the client entry.
54
+
55
+ ## Content-safety rules
56
+
57
+ The Provider authorization belongs to the Runtime host and is never readable
58
+ by the App's code. The App's code reaches the network only at the external
59
+ origins its manifest declares, empty by default, and the Provider enforces
60
+ that set. Every request to the Provider itself goes through the MD Runtime.
61
+ Rendered Markdown never executes scripts, renders raw HTML only for the
62
+ details and summary elements, and loads images and other resources only from
63
+ origins the Provider's policy allows.
64
+
65
+ ## Launch promises MD UI keeps
66
+
67
+ MD UI uses semantic HTML, is fully operable from a keyboard with visible
68
+ focus and labelled controls, and lays out from a 360 pixel wide viewport to
69
+ a desktop. Its strings are English only, dates and numbers follow the
70
+ browser locale, and content is never translated. Light and dark themes come
71
+ from CSS custom properties with the browser's preference as the default and
72
+ an App's override respected. What an App Creator's agent adds carries none
73
+ of these promises by itself. Reading and querying never wait for the
74
+ network. Data lives only in the App Creator's browser and with the Provider.
75
+
76
+ ## App code imports only the client entry and never constructs a Runtime
77
+
78
+ App code imports only `@agentshouse/mdruntime/client` and calls
79
+ `connectMdRuntime` on the port the host hands it. It never constructs a
80
+ Runtime. It does not import the package main, the host entry, or the Adapter
81
+ package, and it does not call `createMdRuntime` or `serveMdRuntime`. Hosts
82
+ and tests use those entries; the served App does not.
83
+
84
+ ## What an agent must never do
85
+
86
+ An agent must never read the authorization, load code from a Room, call the
87
+ Provider directly, or rebase a refused Change Batch.
package/dist/adapter.d.ts CHANGED
@@ -1,21 +1,71 @@
1
+ import type { ModelIdentity, ModelResult } from './model.js';
2
+ import type { ChangeBatch } from './change.js';
1
3
  export type Authorization = object;
2
4
  export declare const ROOM_CONTRACT_VERSION = 1;
3
- export declare const VERSION_1_CAPABILITIES: readonly ['stable-file-ids', 'ranked-provider-search', 'room-version-notifications', 'room-history', 'provider-actions'];
5
+ export declare const VERSION_1_CAPABILITIES: readonly ['stable-file-ids', 'ranked-provider-search', 'room-version-notifications', 'room-history', 'provider-actions', 'move-reference-rewrites'];
4
6
  export type MdModelIdentity = {
5
7
  identity: string;
6
8
  version: string;
7
9
  };
10
+ export type TypedSelection = {
11
+ roots: readonly string[];
12
+ attachedModel: ModelIdentity | null;
13
+ };
14
+ export type OperationScopes = {
15
+ read: readonly string[];
16
+ sync: readonly string[];
17
+ write: readonly string[];
18
+ delete: readonly string[];
19
+ };
20
+ export type ReplicaAdmission = {
21
+ selection: string;
22
+ admission: 'admitted' | 'unavailable';
23
+ };
8
24
  export type DiscoveredRoom = {
25
+ collectionRoot: string;
9
26
  name: string;
10
27
  locator: string;
11
28
  roomVersion: string;
12
- writeGrants: readonly string[];
29
+ operations: OperationScopes;
30
+ replica: ReplicaAdmission;
31
+ attachedModel: ModelIdentity | null;
32
+ typedSelection?: TypedSelection;
13
33
  providerOwnedPaths: readonly string[];
14
34
  };
15
35
  export type Capability = {
16
36
  name: string;
17
37
  limits?: readonly ProviderLimit[];
18
38
  actions?: readonly ActionDeclaration[];
39
+ conversationCards?: ConversationCards;
40
+ };
41
+ export type ConversationCards = {
42
+ locator: string;
43
+ type: string;
44
+ identity: string;
45
+ agent: string;
46
+ };
47
+ export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
48
+ export type ConversationMessage = {
49
+ turn: string;
50
+ message: unknown;
51
+ };
52
+ export type ConversationEvent = {
53
+ kind: 'growing-text';
54
+ conversation: string;
55
+ turn: string;
56
+ text: string;
57
+ } | {
58
+ kind: 'accepted-message';
59
+ conversation: string;
60
+ message: ConversationMessage;
61
+ } | {
62
+ kind: 'session-summary';
63
+ conversation: string;
64
+ summary: unknown;
65
+ };
66
+ export type ViewedConversations = {
67
+ view(conversations: readonly string[]): void;
68
+ observe(notify: (event: ConversationEvent) => void): () => void;
19
69
  };
20
70
  export type ActionDeclaration = {
21
71
  name: string;
@@ -26,8 +76,14 @@ export type ProviderLimit = {
26
76
  name: string;
27
77
  value?: number | string;
28
78
  };
79
+ export type HistoryRetention = {
80
+ kind: 'duration';
81
+ seconds: number;
82
+ } | {
83
+ kind: 'no-declared-time-bound';
84
+ };
29
85
  export type Retention = {
30
- history: number;
86
+ history: HistoryRetention;
31
87
  outcome: number;
32
88
  refreshHorizon: number;
33
89
  };
@@ -36,10 +92,16 @@ export type Discovery = {
36
92
  supportedVersions: readonly number[];
37
93
  mdModel: MdModelIdentity;
38
94
  rooms: readonly DiscoveredRoom[];
95
+ slots?: readonly {
96
+ slot: string;
97
+ entries: readonly {
98
+ locator: string;
99
+ segment: string | null;
100
+ }[];
101
+ }[];
39
102
  capabilities: readonly Capability[];
40
103
  providerLimits: readonly ProviderLimit[];
41
104
  retention: Retention;
42
- origins: readonly string[];
43
105
  };
44
106
  export type TransportUncertainty = {
45
107
  kind: 'transport-uncertainty';
@@ -51,67 +113,101 @@ export type RoomNotReadable = {
51
113
  export type RevokedAuthorization = {
52
114
  kind: 'revoked-authorization';
53
115
  };
54
- export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization;
55
- export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization;
116
+ export type ProviderRefusal = {
117
+ code: string;
118
+ fields: Readonly<Record<string, unknown>>;
119
+ };
120
+ export type ScopedRefusal = ProviderRefusal & {
121
+ kind: 'scoped-refusal';
122
+ locator: string;
123
+ scope: 'content' | 'sync' | 'model' | 'operation' | 'undisclosed';
124
+ };
125
+ export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
126
+ export type ContractUnavailable = ProviderRefusal & {
127
+ kind: 'contract-unavailable';
128
+ };
129
+ export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
56
130
  export type PageToken = string;
57
131
  export type BootstrapRequest = {
58
132
  locator: string;
133
+ selection: string;
59
134
  pageToken?: PageToken;
60
135
  };
61
136
  export type BootstrapPage = {
62
137
  kind: 'bootstrap';
63
138
  roomVersion: string;
64
139
  documents: Readonly<Record<string, string>>;
140
+ revisions: Readonly<Record<string, string>>;
65
141
  binaryTargets: readonly string[];
66
142
  pageToken?: PageToken;
67
143
  };
68
144
  export type BootstrapResult = BootstrapPage | AdapterFailure;
69
145
  export type RefreshRequest = {
70
146
  locator: string;
147
+ selection: string;
71
148
  fromRoomVersion: string;
72
149
  pageToken?: PageToken;
73
150
  };
74
- export type RefreshResult = {
75
- kind: 'still-current';
76
- } | {
151
+ export type RefreshPage = {
77
152
  kind: 'net-advancement';
78
153
  roomVersion: string;
154
+ documents: Readonly<Record<string, string>>;
155
+ revisions: Readonly<Record<string, string>>;
156
+ binaryTargets: readonly string[];
157
+ removals: readonly string[];
79
158
  pageToken?: PageToken;
80
- } | {
159
+ };
160
+ export type RefreshResult = {
161
+ kind: 'still-current';
162
+ } | RefreshPage | {
81
163
  kind: 'beyond-horizon';
82
164
  } | AdapterFailure;
83
165
  export type MutationRequest = {
84
166
  locator: string;
85
- changeBatch: {
86
- id: string;
87
- baseRoomVersion: string;
88
- changes: readonly unknown[];
89
- preconditions: readonly unknown[];
90
- };
167
+ changeBatch: ChangeBatch;
168
+ };
169
+ export type RetryableRefusal = ProviderRefusal & {
170
+ kind: 'retryable-refusal';
171
+ reset?: string;
91
172
  };
92
173
  export type MutationResult = {
93
174
  kind: 'accepted';
94
175
  roomVersion: string;
95
- } | {
176
+ documents: Readonly<Record<string, string>>;
177
+ revisions: Readonly<Record<string, string>>;
178
+ removals: readonly string[];
179
+ author?: string;
180
+ time?: string;
181
+ } | (ProviderRefusal & {
96
182
  kind: 'conflicted';
97
- roomVersion: string;
98
- text: string;
99
- } | {
183
+ roomVersion?: string;
184
+ affected: Readonly<Record<string, string>>;
185
+ }) | (ProviderRefusal & {
100
186
  kind: 'rejected';
101
- text: string;
187
+ affected: Readonly<Record<string, string>>;
188
+ }) | RetryableRefusal | {
189
+ kind: 'expired';
102
190
  } | AdapterFailure;
191
+ export type HistoryRevision = {
192
+ revision: string;
193
+ author: string;
194
+ time: string;
195
+ };
103
196
  export type HistoryRequest = {
104
197
  locator: string;
105
198
  path: string;
199
+ revision?: string;
106
200
  pageToken?: PageToken;
107
201
  };
108
202
  export type HistoryResult = {
109
203
  kind: 'history';
110
- revisions: readonly {
111
- author: string;
112
- time: string;
113
- }[];
204
+ revisions: readonly HistoryRevision[];
114
205
  pageToken?: PageToken;
206
+ } | {
207
+ kind: 'revision';
208
+ content: string;
209
+ } | {
210
+ kind: 'no-history';
115
211
  } | AdapterFailure;
116
212
  export type ActionRequest = {
117
213
  name: string;
@@ -120,11 +216,30 @@ export type ActionRequest = {
120
216
  export type ActionResult = {
121
217
  kind: 'action';
122
218
  result: unknown;
123
- } | {
219
+ } | (ProviderRefusal & {
124
220
  kind: 'rejected';
125
- text: string;
126
- } | AdapterFailure;
221
+ }) | AdapterFailure;
222
+ export type ModelRequest = {
223
+ locator: string;
224
+ attached: 'collection';
225
+ collectionRoot: string;
226
+ model: ModelIdentity | null;
227
+ } | {
228
+ locator: string;
229
+ attached: 'typed-selection';
230
+ roots: readonly string[];
231
+ model: ModelIdentity | null;
232
+ };
233
+ export type RoomVersionNotification = {
234
+ locator: string;
235
+ roomVersion: string;
236
+ };
237
+ export type SelectedRooms = {
238
+ select(locators: readonly string[]): void;
239
+ observe(notify: (notification: RoomVersionNotification) => void): () => void;
240
+ };
127
241
  export type Adapter = {
242
+ model(authorization: Authorization, request: ModelRequest): Promise<ModelResult>;
128
243
  authorize(): Promise<Authorization>;
129
244
  discover(authorization: Authorization): Promise<DiscoverResult>;
130
245
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
@@ -132,5 +247,7 @@ export type Adapter = {
132
247
  mutate(authorization: Authorization, request: MutationRequest): Promise<MutationResult>;
133
248
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
134
249
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
250
+ roomVersions?: SelectedRooms;
251
+ conversations?: ViewedConversations;
135
252
  };
136
253
  //# sourceMappingURL=adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,eAAO,MAAM,sBAAsB,YACjC,iBAAiB,EACjB,wBAAwB,EACxB,4BAA4B,EAC5B,cAAc,EACd,kBAAkB,CACV,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IA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AAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAChE,SAAS,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7F,OAAO,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACvF,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACxF,OAAO,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACvF,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACpF,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACrC,CAAC"}
package/dist/adapter.js CHANGED
@@ -4,7 +4,8 @@ export const VERSION_1_CAPABILITIES = [
4
4
  'ranked-provider-search',
5
5
  'room-version-notifications',
6
6
  'room-history',
7
- 'provider-actions'
7
+ 'provider-actions',
8
+ 'move-reference-rewrites'
8
9
  ];
9
10
 
10
11
  //# sourceMappingURL=adapter.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/workspace/packages/mdruntime/src/adapter.ts"],"sourcesContent":["export type Authorization = object;\n\nexport const ROOM_CONTRACT_VERSION = 1;\n\nexport const VERSION_1_CAPABILITIES = [\n 'stable-file-ids',\n 'ranked-provider-search',\n 'room-version-notifications',\n 'room-history',\n 'provider-actions',\n] as const;\n\nexport type MdModelIdentity = {\n identity: string;\n version: string;\n};\n\nexport type DiscoveredRoom = {\n name: string;\n locator: string;\n roomVersion: string;\n writeGrants: readonly string[];\n providerOwnedPaths: readonly string[];\n};\n\nexport type Capability = {\n name: string;\n limits?: readonly ProviderLimit[];\n actions?: readonly ActionDeclaration[];\n};\n\nexport type ActionDeclaration = {\n name: string;\n inputShape: unknown;\n resultKind: unknown;\n};\n\nexport type ProviderLimit = {\n name: string;\n value?: number | string;\n};\n\nexport type Retention = {\n history: number;\n outcome: number;\n refreshHorizon: number;\n};\n\nexport type Discovery = {\n kind: 'discovery';\n supportedVersions: readonly number[];\n mdModel: MdModelIdentity;\n rooms: readonly DiscoveredRoom[];\n capabilities: readonly Capability[];\n providerLimits: readonly ProviderLimit[];\n retention: Retention;\n origins: readonly string[];\n};\n\nexport type TransportUncertainty = { kind: 'transport-uncertainty' };\nexport type RoomNotReadable = { kind: 'room-not-readable'; locator: string };\nexport type RevokedAuthorization = { kind: 'revoked-authorization' };\n\nexport type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization;\n\nexport type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization;\n\nexport type PageToken = string;\n\nexport type BootstrapRequest = {\n locator: string;\n pageToken?: PageToken;\n};\n\nexport type BootstrapPage = {\n kind: 'bootstrap';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n binaryTargets: readonly string[];\n pageToken?: PageToken;\n};\n\nexport type BootstrapResult = BootstrapPage | AdapterFailure;\n\nexport type RefreshRequest = {\n locator: string;\n fromRoomVersion: string;\n pageToken?: PageToken;\n};\n\nexport type RefreshResult =\n | { kind: 'still-current' }\n | { kind: 'net-advancement'; roomVersion: string; pageToken?: PageToken }\n | { kind: 'beyond-horizon' }\n | AdapterFailure;\n\nexport type MutationRequest = {\n locator: string;\n changeBatch: {\n id: string;\n baseRoomVersion: string;\n changes: readonly unknown[];\n preconditions: readonly unknown[];\n };\n};\n\nexport type MutationResult =\n | { kind: 'accepted'; roomVersion: string }\n | { kind: 'conflicted'; roomVersion: string; text: string }\n | { kind: 'rejected'; text: string }\n | AdapterFailure;\n\nexport type HistoryRequest = {\n locator: string;\n path: string;\n pageToken?: PageToken;\n};\n\nexport type HistoryResult =\n | {\n kind: 'history';\n revisions: readonly { author: string; time: string }[];\n pageToken?: PageToken;\n }\n | AdapterFailure;\n\nexport type ActionRequest = {\n name: string;\n input: unknown;\n};\n\nexport type ActionResult =\n | { kind: 'action'; result: unknown }\n | { kind: 'rejected'; text: string }\n | AdapterFailure;\n\nexport type Adapter = {\n authorize(): Promise<Authorization>;\n discover(authorization: Authorization): Promise<DiscoverResult>;\n bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;\n refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;\n mutate(authorization: Authorization, request: MutationRequest): Promise<MutationResult>;\n history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;\n action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;\n};\n"],"names":["ROOM_CONTRACT_VERSION","VERSION_1_CAPABILITIES"],"mappings":"AAEA,OAAO,MAAMA,wBAAwB,EAAE;AAEvC,OAAO,MAAMC,yBAAyB;IACpC;IACA;IACA;IACA;IACA;CACD,CAAU"}
1
+ {"version":3,"sources":["/workspace/packages/mdruntime/src/adapter.ts"],"sourcesContent":["import type { ModelIdentity, ModelResult } from './model.js';\nimport type { ChangeBatch } from './change.js';\n\nexport type Authorization = object;\n\nexport const ROOM_CONTRACT_VERSION = 1;\n\nexport const VERSION_1_CAPABILITIES = [\n 'stable-file-ids',\n 'ranked-provider-search',\n 'room-version-notifications',\n 'room-history',\n 'provider-actions',\n 'move-reference-rewrites',\n] as const;\n\nexport type MdModelIdentity = {\n identity: string;\n version: string;\n};\n\nexport type TypedSelection = {\n roots: readonly string[];\n attachedModel: ModelIdentity | null;\n};\n\nexport type OperationScopes = {\n read: readonly string[];\n sync: readonly string[];\n write: readonly string[];\n delete: readonly string[];\n};\nexport type ReplicaAdmission = { selection: string; admission: 'admitted' | 'unavailable' };\n\nexport type DiscoveredRoom = {\n collectionRoot: string;\n name: string;\n locator: string;\n roomVersion: string;\n operations: OperationScopes;\n replica: ReplicaAdmission;\n attachedModel: ModelIdentity | null;\n typedSelection?: TypedSelection;\n providerOwnedPaths: readonly string[];\n};\n\nexport type Capability = {\n name: string;\n limits?: readonly ProviderLimit[];\n actions?: readonly ActionDeclaration[];\n conversationCards?: ConversationCards;\n};\n\nexport type ConversationCards = {\n locator: string;\n type: string;\n identity: string;\n agent: string;\n};\n\nexport type ConversationAction =\n | 'conversation.create'\n | 'conversation.send'\n | 'conversation.answer'\n | 'conversation.interrupt'\n | 'conversation.kill'\n | 'conversation.cancel'\n | 'conversation.delete'\n | 'conversation.history';\n\nexport type ConversationMessage = {\n turn: string;\n message: unknown;\n};\n\nexport type ConversationEvent =\n | { kind: 'growing-text'; conversation: string; turn: string; text: string }\n | { kind: 'accepted-message'; conversation: string; message: ConversationMessage }\n | { kind: 'session-summary'; conversation: string; summary: unknown };\n\nexport type ViewedConversations = {\n view(conversations: readonly string[]): void;\n observe(notify: (event: ConversationEvent) => void): () => void;\n};\n\nexport type ActionDeclaration = {\n name: string;\n inputShape: unknown;\n resultKind: unknown;\n};\n\nexport type ProviderLimit = {\n name: string;\n value?: number | string;\n};\n\nexport type HistoryRetention =\n | { kind: 'duration'; seconds: number }\n | { kind: 'no-declared-time-bound' };\n\nexport type Retention = {\n history: HistoryRetention;\n outcome: number;\n refreshHorizon: number;\n};\n\nexport type Discovery = {\n kind: 'discovery';\n supportedVersions: readonly number[];\n mdModel: MdModelIdentity;\n rooms: readonly DiscoveredRoom[];\n slots?: readonly {\n slot: string;\n entries: readonly { locator: string; segment: string | null }[];\n }[];\n capabilities: readonly Capability[];\n providerLimits: readonly ProviderLimit[];\n retention: Retention;\n};\n\nexport type TransportUncertainty = { kind: 'transport-uncertainty' };\nexport type RoomNotReadable = { kind: 'room-not-readable'; locator: string };\nexport type RevokedAuthorization = { kind: 'revoked-authorization' };\n\nexport type ProviderRefusal = {\n code: string;\n fields: Readonly<Record<string, unknown>>;\n};\n\nexport type ScopedRefusal = ProviderRefusal & {\n kind: 'scoped-refusal';\n locator: string;\n scope: 'content' | 'sync' | 'model' | 'operation' | 'undisclosed';\n};\nexport type AdapterFailure =\n | TransportUncertainty\n | RoomNotReadable\n | RevokedAuthorization\n | ScopedRefusal;\n\nexport type ContractUnavailable = ProviderRefusal & { kind: 'contract-unavailable' };\n\nexport type DiscoverResult =\n | Discovery\n | TransportUncertainty\n | RevokedAuthorization\n | ContractUnavailable;\n\nexport type PageToken = string;\n\nexport type BootstrapRequest = {\n locator: string;\n selection: string;\n pageToken?: PageToken;\n};\n\nexport type BootstrapPage = {\n kind: 'bootstrap';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n binaryTargets: readonly string[];\n pageToken?: PageToken;\n};\n\nexport type BootstrapResult = BootstrapPage | AdapterFailure;\n\nexport type RefreshRequest = {\n locator: string;\n selection: string;\n fromRoomVersion: string;\n pageToken?: PageToken;\n};\n\nexport type RefreshPage = {\n kind: 'net-advancement';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n binaryTargets: readonly string[];\n removals: readonly string[];\n pageToken?: PageToken;\n};\n\nexport type RefreshResult =\n | { kind: 'still-current' }\n | RefreshPage\n | { kind: 'beyond-horizon' }\n | AdapterFailure;\n\nexport type MutationRequest = {\n locator: string;\n changeBatch: ChangeBatch;\n};\n\nexport type RetryableRefusal = ProviderRefusal & {\n kind: 'retryable-refusal';\n reset?: string;\n};\n\nexport type MutationResult =\n | {\n kind: 'accepted';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n removals: readonly string[];\n author?: string;\n time?: string;\n }\n | (ProviderRefusal & {\n kind: 'conflicted';\n roomVersion?: string;\n affected: Readonly<Record<string, string>>;\n })\n | (ProviderRefusal & {\n kind: 'rejected';\n affected: Readonly<Record<string, string>>;\n })\n | RetryableRefusal\n | { kind: 'expired' }\n | AdapterFailure;\n\nexport type HistoryRevision = {\n revision: string;\n author: string;\n time: string;\n};\n\nexport type HistoryRequest = {\n locator: string;\n path: string;\n revision?: string;\n pageToken?: PageToken;\n};\n\nexport type HistoryResult =\n | {\n kind: 'history';\n revisions: readonly HistoryRevision[];\n pageToken?: PageToken;\n }\n | {\n kind: 'revision';\n content: string;\n }\n | { kind: 'no-history' }\n | AdapterFailure;\n\nexport type ActionRequest = {\n name: string;\n input: unknown;\n};\n\nexport type ActionResult =\n | { kind: 'action'; result: unknown }\n | (ProviderRefusal & { kind: 'rejected' })\n | AdapterFailure;\n\nexport type ModelRequest =\n | { locator: string; attached: 'collection'; collectionRoot: string; model: ModelIdentity | null }\n | {\n locator: string;\n attached: 'typed-selection';\n roots: readonly string[];\n model: ModelIdentity | null;\n };\n\nexport type RoomVersionNotification = {\n locator: string;\n roomVersion: string;\n};\n\nexport type SelectedRooms = {\n select(locators: readonly string[]): void;\n observe(notify: (notification: RoomVersionNotification) => void): () => void;\n};\n\nexport type Adapter = {\n model(authorization: Authorization, request: ModelRequest): Promise<ModelResult>;\n authorize(): Promise<Authorization>;\n discover(authorization: Authorization): Promise<DiscoverResult>;\n bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;\n refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;\n mutate(authorization: Authorization, request: MutationRequest): Promise<MutationResult>;\n history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;\n action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;\n roomVersions?: SelectedRooms;\n conversations?: ViewedConversations;\n};\n"],"names":["ROOM_CONTRACT_VERSION","VERSION_1_CAPABILITIES"],"mappings":"AAKA,OAAO,MAAMA,wBAAwB,EAAE;AAEvC,OAAO,MAAMC,yBAAyB;IACpC;IACA;IACA;IACA;IACA;IACA;CACD,CAAU"}
@@ -1,16 +1,14 @@
1
- import type { Adapter, Authorization, DiscoveredRoom, RevokedAuthorization, RoomNotReadable } from './adapter.js';
2
- import { type Collection } from './collection.js';
3
- import type { ReplicaRecord } from './store.js';
4
- export type StagedReplica = {
5
- record: ReplicaRecord;
6
- collection: Collection;
7
- };
1
+ import type { AttachedModelBinding } from './model.js';
2
+ import type { ModelState } from './model.js';
3
+ import type { Adapter, AdapterFailure, Authorization, DiscoveredRoom } from './adapter.js';
4
+ import { type ConfirmedLayer } from './replica.js';
5
+ import { type Unconfirmed } from './transfer.js';
8
6
  export type BootstrapOutcome = {
9
7
  kind: 'staged';
10
- replica: StagedReplica;
11
- } | {
12
- kind: 'unconfirmed';
13
- } | RoomNotReadable | RevokedAuthorization;
14
- export declare function adoptReplica(record: ReplicaRecord): StagedReplica | null;
15
- export declare function bootstrapRoom(adapter: Adapter, authorization: Authorization, room: DiscoveredRoom): Promise<BootstrapOutcome>;
8
+ confirmed: ConfirmedLayer;
9
+ } | Unconfirmed | AdapterFailure;
10
+ export declare function bootstrapRoom(adapter: Adapter, authorization: Authorization, room: DiscoveredRoom, models: {
11
+ collection: ModelState;
12
+ selection: ModelState;
13
+ }, binding: AttachedModelBinding | null): Promise<BootstrapOutcome>;
16
14
  //# sourceMappingURL=bootstrap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAEP,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,GACvB,eAAe,GACf,oBAAoB,CAAC;AAQzB,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,GAAG,IAAI,CAGxE;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAyB3B"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,cAAc,CAAA;CAAE,GAC7C,WAAW,GACX,cAAc,CAAC;AAEnB,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,OAAO,EAAE,oBAAoB,GAAG,IAAI,GACnC,OAAO,CAAC,gBAAgB,CAAC,CA4C3B"}
package/dist/bootstrap.js CHANGED
@@ -1,53 +1,54 @@
1
- import { readCollection } from './collection.js';
2
- const unconfirmed = {
3
- kind: 'unconfirmed'
4
- };
5
- function received(failure) {
6
- return failure.kind === 'transport-uncertainty' ? unconfirmed : failure;
7
- }
8
- export function adoptReplica(record) {
9
- const collection = readCollection(record.documents, record.binaryTargets);
10
- return collection === null ? null : {
11
- record,
12
- collection
13
- };
14
- }
15
- export async function bootstrapRoom(adapter, authorization, room) {
1
+ import { readStaged } from './replica.js';
2
+ import { unconfirmed } from './transfer.js';
3
+ export async function bootstrapRoom(adapter, authorization, room, models, binding) {
16
4
  const first = await adapter.bootstrap(authorization, {
17
- locator: room.locator
5
+ locator: room.locator,
6
+ selection: room.replica.selection
18
7
  });
19
- if (first.kind !== 'bootstrap') return received(first);
8
+ if (first.kind !== 'bootstrap') return first;
20
9
  const roomVersion = first.roomVersion;
21
10
  const documents = {
22
11
  ...first.documents
23
12
  };
13
+ const revisions = {
14
+ ...first.revisions
15
+ };
24
16
  const binaryTargets = new Set(first.binaryTargets);
25
17
  let pageToken = first.pageToken;
26
18
  while(pageToken !== undefined){
27
19
  const page = await adapter.bootstrap(authorization, {
28
20
  locator: room.locator,
21
+ selection: room.replica.selection,
29
22
  pageToken
30
23
  });
31
- if (page.kind !== 'bootstrap') return received(page);
24
+ if (page.kind !== 'bootstrap') return page;
32
25
  if (page.roomVersion !== roomVersion) return unconfirmed;
33
26
  Object.assign(documents, page.documents);
27
+ Object.assign(revisions, page.revisions);
34
28
  for (const target of page.binaryTargets)binaryTargets.add(target);
35
29
  pageToken = page.pageToken;
36
30
  }
37
- const replica = adoptReplica({
31
+ const confirmed = readStaged({
38
32
  locator: room.locator,
33
+ collectionRoot: room.collectionRoot,
39
34
  name: room.name,
40
- writeGrants: room.writeGrants,
35
+ operations: room.operations,
36
+ replica: room.replica,
37
+ attachedModel: room.attachedModel,
38
+ model: models.collection,
39
+ typedSelection: room.typedSelection ?? null,
40
+ selectionModel: models.selection,
41
41
  providerOwnedPaths: room.providerOwnedPaths,
42
42
  roomVersion,
43
43
  documents,
44
44
  binaryTargets: [
45
45
  ...binaryTargets
46
- ].sort()
47
- });
48
- return replica === null ? unconfirmed : {
46
+ ].sort(),
47
+ revisions
48
+ }, binding);
49
+ return confirmed === null ? unconfirmed : {
49
50
  kind: 'staged',
50
- replica
51
+ confirmed
51
52
  };
52
53
  }
53
54
 
@@ -1 +1 @@
1
- {"version":3,"sources":["/workspace/packages/mdruntime/src/bootstrap.ts"],"sourcesContent":["import type {\n Adapter,\n AdapterFailure,\n Authorization,\n DiscoveredRoom,\n RevokedAuthorization,\n RoomNotReadable,\n} from './adapter.js';\nimport { readCollection, type Collection } from './collection.js';\nimport type { ReplicaRecord } from './store.js';\n\nexport type StagedReplica = {\n record: ReplicaRecord;\n collection: Collection;\n};\n\nexport type BootstrapOutcome =\n | { kind: 'staged'; replica: StagedReplica }\n | { kind: 'unconfirmed' }\n | RoomNotReadable\n | RevokedAuthorization;\n\nconst unconfirmed = { kind: 'unconfirmed' } as const;\n\nfunction received(failure: AdapterFailure): BootstrapOutcome {\n return failure.kind === 'transport-uncertainty' ? unconfirmed : failure;\n}\n\nexport function adoptReplica(record: ReplicaRecord): StagedReplica | null {\n const collection = readCollection(record.documents, record.binaryTargets);\n return collection === null ? null : { record, collection };\n}\n\nexport async function bootstrapRoom(\n adapter: Adapter,\n authorization: Authorization,\n room: DiscoveredRoom,\n): Promise<BootstrapOutcome> {\n const first = await adapter.bootstrap(authorization, { locator: room.locator });\n if (first.kind !== 'bootstrap') return received(first);\n const roomVersion = first.roomVersion;\n const documents: Record<string, string> = { ...first.documents };\n const binaryTargets = new Set(first.binaryTargets);\n let pageToken = first.pageToken;\n while (pageToken !== undefined) {\n const page = await adapter.bootstrap(authorization, { locator: room.locator, pageToken });\n if (page.kind !== 'bootstrap') return received(page);\n if (page.roomVersion !== roomVersion) return unconfirmed;\n Object.assign(documents, page.documents);\n for (const target of page.binaryTargets) binaryTargets.add(target);\n pageToken = page.pageToken;\n }\n const replica = adoptReplica({\n locator: room.locator,\n name: room.name,\n writeGrants: room.writeGrants,\n providerOwnedPaths: room.providerOwnedPaths,\n roomVersion,\n documents,\n binaryTargets: [...binaryTargets].sort(),\n });\n return replica === null ? unconfirmed : { kind: 'staged', replica };\n}\n"],"names":["readCollection","unconfirmed","kind","received","failure","adoptReplica","record","collection","documents","binaryTargets","bootstrapRoom","adapter","authorization","room","first","bootstrap","locator","roomVersion","Set","pageToken","undefined","page","Object","assign","target","add","replica","name","writeGrants","providerOwnedPaths","sort"],"mappings":"AAQA,SAASA,cAAc,QAAyB,kBAAkB;AAclE,MAAMC,cAAc;IAAEC,MAAM;AAAc;AAE1C,SAASC,SAASC,OAAuB;IACvC,OAAOA,QAAQF,IAAI,KAAK,0BAA0BD,cAAcG;AAClE;AAEA,OAAO,SAASC,aAAaC,MAAqB;IAChD,MAAMC,aAAaP,eAAeM,OAAOE,SAAS,EAAEF,OAAOG,aAAa;IACxE,OAAOF,eAAe,OAAO,OAAO;QAAED;QAAQC;IAAW;AAC3D;AAEA,OAAO,eAAeG,cACpBC,OAAgB,EAChBC,aAA4B,EAC5BC,IAAoB;IAEpB,MAAMC,QAAQ,MAAMH,QAAQI,SAAS,CAACH,eAAe;QAAEI,SAASH,KAAKG,OAAO;IAAC;IAC7E,IAAIF,MAAMZ,IAAI,KAAK,aAAa,OAAOC,SAASW;IAChD,MAAMG,cAAcH,MAAMG,WAAW;IACrC,MAAMT,YAAoC;QAAE,GAAGM,MAAMN,SAAS;IAAC;IAC/D,MAAMC,gBAAgB,IAAIS,IAAIJ,MAAML,aAAa;IACjD,IAAIU,YAAYL,MAAMK,SAAS;IAC/B,MAAOA,cAAcC,UAAW;QAC9B,MAAMC,OAAO,MAAMV,QAAQI,SAAS,CAACH,eAAe;YAAEI,SAASH,KAAKG,OAAO;YAAEG;QAAU;QACvF,IAAIE,KAAKnB,IAAI,KAAK,aAAa,OAAOC,SAASkB;QAC/C,IAAIA,KAAKJ,WAAW,KAAKA,aAAa,OAAOhB;QAC7CqB,OAAOC,MAAM,CAACf,WAAWa,KAAKb,SAAS;QACvC,KAAK,MAAMgB,UAAUH,KAAKZ,aAAa,CAAEA,cAAcgB,GAAG,CAACD;QAC3DL,YAAYE,KAAKF,SAAS;IAC5B;IACA,MAAMO,UAAUrB,aAAa;QAC3BW,SAASH,KAAKG,OAAO;QACrBW,MAAMd,KAAKc,IAAI;QACfC,aAAaf,KAAKe,WAAW;QAC7BC,oBAAoBhB,KAAKgB,kBAAkB;QAC3CZ;QACAT;QACAC,eAAe;eAAIA;SAAc,CAACqB,IAAI;IACxC;IACA,OAAOJ,YAAY,OAAOzB,cAAc;QAAEC,MAAM;QAAUwB;IAAQ;AACpE"}
1
+ {"version":3,"sources":["/workspace/packages/mdruntime/src/bootstrap.ts"],"sourcesContent":["import type { AttachedModelBinding } from './model.js';\nimport type { ModelState } from './model.js';\nimport type { Adapter, AdapterFailure, Authorization, DiscoveredRoom } from './adapter.js';\nimport { readStaged, type ConfirmedLayer } from './replica.js';\nimport { unconfirmed, type Unconfirmed } from './transfer.js';\n\nexport type BootstrapOutcome =\n | { kind: 'staged'; confirmed: ConfirmedLayer }\n | Unconfirmed\n | AdapterFailure;\n\nexport async function bootstrapRoom(\n adapter: Adapter,\n authorization: Authorization,\n room: DiscoveredRoom,\n models: { collection: ModelState; selection: ModelState },\n binding: AttachedModelBinding | null,\n): Promise<BootstrapOutcome> {\n const first = await adapter.bootstrap(authorization, {\n locator: room.locator,\n selection: room.replica.selection,\n });\n if (first.kind !== 'bootstrap') return first;\n const roomVersion = first.roomVersion;\n const documents: Record<string, string> = { ...first.documents };\n const revisions: Record<string, string> = { ...first.revisions };\n const binaryTargets = new Set(first.binaryTargets);\n let pageToken = first.pageToken;\n while (pageToken !== undefined) {\n const page = await adapter.bootstrap(authorization, {\n locator: room.locator,\n selection: room.replica.selection,\n pageToken,\n });\n if (page.kind !== 'bootstrap') return page;\n if (page.roomVersion !== roomVersion) return unconfirmed;\n Object.assign(documents, page.documents);\n Object.assign(revisions, page.revisions);\n for (const target of page.binaryTargets) binaryTargets.add(target);\n pageToken = page.pageToken;\n }\n const confirmed = readStaged(\n {\n locator: room.locator,\n collectionRoot: room.collectionRoot,\n name: room.name,\n operations: room.operations,\n replica: room.replica,\n attachedModel: room.attachedModel,\n model: models.collection,\n typedSelection: room.typedSelection ?? null,\n selectionModel: models.selection,\n providerOwnedPaths: room.providerOwnedPaths,\n roomVersion,\n documents,\n binaryTargets: [...binaryTargets].sort(),\n revisions,\n },\n binding,\n );\n return confirmed === null ? unconfirmed : { kind: 'staged', confirmed };\n}\n"],"names":["readStaged","unconfirmed","bootstrapRoom","adapter","authorization","room","models","binding","first","bootstrap","locator","selection","replica","kind","roomVersion","documents","revisions","binaryTargets","Set","pageToken","undefined","page","Object","assign","target","add","confirmed","collectionRoot","name","operations","attachedModel","model","collection","typedSelection","selectionModel","providerOwnedPaths","sort"],"mappings":"AAGA,SAASA,UAAU,QAA6B,eAAe;AAC/D,SAASC,WAAW,QAA0B,gBAAgB;AAO9D,OAAO,eAAeC,cACpBC,OAAgB,EAChBC,aAA4B,EAC5BC,IAAoB,EACpBC,MAAyD,EACzDC,OAAoC;IAEpC,MAAMC,QAAQ,MAAML,QAAQM,SAAS,CAACL,eAAe;QACnDM,SAASL,KAAKK,OAAO;QACrBC,WAAWN,KAAKO,OAAO,CAACD,SAAS;IACnC;IACA,IAAIH,MAAMK,IAAI,KAAK,aAAa,OAAOL;IACvC,MAAMM,cAAcN,MAAMM,WAAW;IACrC,MAAMC,YAAoC;QAAE,GAAGP,MAAMO,SAAS;IAAC;IAC/D,MAAMC,YAAoC;QAAE,GAAGR,MAAMQ,SAAS;IAAC;IAC/D,MAAMC,gBAAgB,IAAIC,IAAIV,MAAMS,aAAa;IACjD,IAAIE,YAAYX,MAAMW,SAAS;IAC/B,MAAOA,cAAcC,UAAW;QAC9B,MAAMC,OAAO,MAAMlB,QAAQM,SAAS,CAACL,eAAe;YAClDM,SAASL,KAAKK,OAAO;YACrBC,WAAWN,KAAKO,OAAO,CAACD,SAAS;YACjCQ;QACF;QACA,IAAIE,KAAKR,IAAI,KAAK,aAAa,OAAOQ;QACtC,IAAIA,KAAKP,WAAW,KAAKA,aAAa,OAAOb;QAC7CqB,OAAOC,MAAM,CAACR,WAAWM,KAAKN,SAAS;QACvCO,OAAOC,MAAM,CAACP,WAAWK,KAAKL,SAAS;QACvC,KAAK,MAAMQ,UAAUH,KAAKJ,aAAa,CAAEA,cAAcQ,GAAG,CAACD;QAC3DL,YAAYE,KAAKF,SAAS;IAC5B;IACA,MAAMO,YAAY1B,WAChB;QACEU,SAASL,KAAKK,OAAO;QACrBiB,gBAAgBtB,KAAKsB,cAAc;QACnCC,MAAMvB,KAAKuB,IAAI;QACfC,YAAYxB,KAAKwB,UAAU;QAC3BjB,SAASP,KAAKO,OAAO;QACrBkB,eAAezB,KAAKyB,aAAa;QACjCC,OAAOzB,OAAO0B,UAAU;QACxBC,gBAAgB5B,KAAK4B,cAAc,IAAI;QACvCC,gBAAgB5B,OAAOK,SAAS;QAChCwB,oBAAoB9B,KAAK8B,kBAAkB;QAC3CrB;QACAC;QACAE,eAAe;eAAIA;SAAc,CAACmB,IAAI;QACtCpB;IACF,GACAT;IAEF,OAAOmB,cAAc,OAAOzB,cAAc;QAAEY,MAAM;QAAUa;IAAU;AACxE"}
@@ -0,0 +1,33 @@
1
+ import type { Document } from '@agentshouse/mdmodel';
2
+ import type { Replica } from './replica.js';
3
+ export type VisibleDocument = {
4
+ content: string;
5
+ revision: string | null;
6
+ document: Document;
7
+ };
8
+ export type DocumentChange = {
9
+ locator: string;
10
+ path: string;
11
+ before: VisibleDocument | null;
12
+ after: VisibleDocument | null;
13
+ };
14
+ export type ChangeSet = {
15
+ documents: readonly DocumentChange[];
16
+ drafts: readonly {
17
+ locator: string;
18
+ path: string;
19
+ }[];
20
+ rooms: readonly string[];
21
+ queues: readonly string[];
22
+ presentations: readonly string[];
23
+ query: boolean;
24
+ };
25
+ export declare function changeSet(locator: string, before: Replica | null, after: Replica | null, changed?: {
26
+ drafts?: readonly string[];
27
+ room?: boolean;
28
+ queue?: boolean;
29
+ presentation?: string;
30
+ query?: boolean;
31
+ }): ChangeSet;
32
+ export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
33
+ //# sourceMappingURL=change-set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"change-set.d.ts","sourceR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