@agentshouse/mdruntime 0.1.0-cec6690d5712e → 0.1.0-cedb03eaa48b6
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.
- package/AGENTS.md +277 -271
- package/README.md +8 -8
- package/dist/adapter.d.ts +85 -20
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attempt.d.ts.map +1 -1
- package/dist/attempt.js +14 -1
- package/dist/binary.d.ts +23 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +8 -0
- package/dist/bootstrap.d.ts +3 -2
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +37 -14
- package/dist/change-set.d.ts +2 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +40 -13
- package/dist/change.d.ts +11 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +26 -1
- package/dist/chat/acts.d.ts +3 -4
- package/dist/chat/acts.d.ts.map +1 -1
- package/dist/chat/acts.js +10 -10
- package/dist/chat/earlier.d.ts +10 -0
- package/dist/chat/earlier.d.ts.map +1 -0
- package/dist/chat/earlier.js +54 -0
- package/dist/chat/kit.d.ts +2 -1
- package/dist/chat/kit.d.ts.map +1 -1
- package/dist/chat/kit.js +3 -3
- package/dist/chat/list.d.ts +8 -1
- package/dist/chat/list.d.ts.map +1 -1
- package/dist/chat/list.js +48 -8
- package/dist/chat/markdown.d.ts +2 -1
- package/dist/chat/markdown.d.ts.map +1 -1
- package/dist/chat/markdown.js +7 -6
- package/dist/chat/message.d.ts.map +1 -1
- package/dist/chat/message.js +2 -2
- package/dist/chat/messages.d.ts +1 -0
- package/dist/chat/messages.d.ts.map +1 -1
- package/dist/chat/messages.js +4 -0
- package/dist/chat/provider.d.ts +1 -1
- package/dist/chat/provider.d.ts.map +1 -1
- package/dist/chat/provider.js +62 -79
- package/dist/chat/question.d.ts +1 -1
- package/dist/chat/question.d.ts.map +1 -1
- package/dist/chat/question.js +7 -18
- package/dist/chat/ready.d.ts +1 -0
- package/dist/chat/ready.d.ts.map +1 -1
- package/dist/chat/ready.js +4 -4
- package/dist/chat/style.js +5 -5
- package/dist/client.d.ts +22 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +23 -6
- package/dist/collection.d.ts +17 -3
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +260 -19
- package/dist/connection.d.ts +39 -12
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1769 -385
- package/dist/conversation.d.ts +20 -7
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +474 -163
- package/dist/durability.d.ts +7 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +17 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +157 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/host.d.ts +15 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +98 -12
- package/dist/identity.d.ts +3 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +9 -0
- package/dist/index.d.ts +12 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/memory.d.ts +10 -4
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +64 -17
- package/dist/model.d.ts +4 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +10 -1
- package/dist/observation.d.ts +7 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +29 -12
- package/dist/outcome.d.ts +17 -1
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +10 -0
- package/dist/overlay.d.ts +15 -2
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +99 -62
- package/dist/query.d.ts +58 -4
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +36 -7
- package/dist/reach.d.ts +8 -3
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +53 -6
- package/dist/react.d.ts +8 -6
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -17
- package/dist/read-side.d.ts +16 -7
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +493 -102
- package/dist/readiness.d.ts +53 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +33 -0
- package/dist/reads.d.ts +11 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +98 -0
- package/dist/recovery.d.ts +25 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +197 -0
- package/dist/refresh.d.ts +4 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +27 -25
- package/dist/replica.d.ts +11 -4
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +106 -48
- package/dist/room-draft.d.ts +32 -3
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +121 -3
- package/dist/rows.d.ts +8 -13
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +12 -13
- package/dist/save.d.ts +29 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +358 -30
- package/dist/search.d.ts +49 -6
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +192 -47
- package/dist/seed.d.ts +16 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +75 -0
- package/dist/shared.d.ts +11 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +368 -0
- package/dist/status.d.ts +4 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/store.d.ts +68 -21
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +463 -206
- package/dist/turn.d.ts +7 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +51 -0
- package/dist/windows.d.ts +26 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +93 -0
- package/dist/wire.d.ts +152 -30
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +52 -29
- package/package.json +12 -8
- package/dist/attachment.d.ts +0 -3
- package/dist/attachment.d.ts.map +0 -1
- package/dist/attachment.js +0 -8
package/dist/memory.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { sameChange } from './overlay.js';
|
|
2
2
|
const FIXTURE_RETENTION = {
|
|
3
3
|
history: { kind: 'duration', seconds: 1 },
|
|
4
|
-
outcome:
|
|
4
|
+
outcome: 604_800,
|
|
5
5
|
refreshHorizon: 1,
|
|
6
6
|
};
|
|
7
7
|
function declaredRetention(value) {
|
|
@@ -55,6 +55,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
55
55
|
const scripted = new Map();
|
|
56
56
|
const unsealed = new Map();
|
|
57
57
|
const sealed = new Set();
|
|
58
|
+
const sentTurns = new Map();
|
|
58
59
|
const historyPageSize = options.historyPageSize;
|
|
59
60
|
let held = [];
|
|
60
61
|
let expiring = [];
|
|
@@ -114,25 +115,28 @@ export function createMemoryAdapter(options = {}) {
|
|
|
114
115
|
const size = pageSize ?? paths.length;
|
|
115
116
|
const taken = paths.slice(from, from + size);
|
|
116
117
|
const next = from + taken.length;
|
|
117
|
-
const targets = opening ? (room.
|
|
118
|
+
const targets = opening ? Object.keys(room.binaryFiles ?? {}) : [];
|
|
118
119
|
return {
|
|
119
120
|
kind: 'bootstrap',
|
|
120
121
|
roomVersion: room.roomVersion,
|
|
121
122
|
...(opening ? { models: modelsOf(room) } : {}),
|
|
122
123
|
documents: named(room.documents ?? {}, taken),
|
|
123
|
-
revisions: named(room.revisions ?? {}, taken),
|
|
124
|
+
revisions: named(room.revisions ?? {}, [...taken, ...targets]),
|
|
125
|
+
...(room.fileIds === undefined
|
|
126
|
+
? {}
|
|
127
|
+
: { fileIds: named(room.fileIds, [...taken, ...targets]) }),
|
|
124
128
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
125
|
-
|
|
126
|
-
...(opening && room.attachments !== undefined ? { attachments: room.attachments } : {}),
|
|
129
|
+
binaryFiles: named(room.binaryFiles ?? {}, targets),
|
|
127
130
|
...(next < paths.length ? { pageToken: taken.at(-1) } : {}),
|
|
128
131
|
};
|
|
129
132
|
}
|
|
130
133
|
function advancement(room, from, at) {
|
|
131
134
|
const current = room.documents ?? {};
|
|
132
135
|
const previous = from.documents ?? {};
|
|
133
|
-
const currentTargets = new Set(room.
|
|
134
|
-
const previousTargets = new Set(from.
|
|
136
|
+
const currentTargets = new Set(Object.keys(room.binaryFiles ?? {}));
|
|
137
|
+
const previousTargets = new Set(Object.keys(from.binaryFiles ?? {}));
|
|
135
138
|
const headMoved = (path) => room.revisions?.[path] !== from.revisions?.[path] ||
|
|
139
|
+
room.fileIds?.[path] !== from.fileIds?.[path] ||
|
|
136
140
|
!sameChange(room.changes?.[path], from.changes?.[path]);
|
|
137
141
|
const changed = Object.keys(current)
|
|
138
142
|
.filter((path) => current[path] !== previous[path] || headMoved(path))
|
|
@@ -147,24 +151,24 @@ export function createMemoryAdapter(options = {}) {
|
|
|
147
151
|
const targets = opening
|
|
148
152
|
? [...currentTargets].filter((target) => !previousTargets.has(target) || headMoved(target))
|
|
149
153
|
: [];
|
|
150
|
-
const attachments = room.attachments ?? [];
|
|
151
|
-
const declared = opening && JSON.stringify(attachments) !== JSON.stringify(from.attachments ?? []);
|
|
152
154
|
const models = opening ? changedModels(room, from) : undefined;
|
|
153
155
|
return {
|
|
154
156
|
kind: 'net-advancement',
|
|
155
157
|
roomVersion: room.roomVersion,
|
|
156
158
|
...(models === undefined ? {} : { models }),
|
|
157
159
|
documents: named(current, taken),
|
|
158
|
-
revisions: named(room.revisions ?? {}, taken),
|
|
160
|
+
revisions: named(room.revisions ?? {}, [...taken, ...targets]),
|
|
161
|
+
...(room.fileIds === undefined
|
|
162
|
+
? {}
|
|
163
|
+
: { fileIds: named(room.fileIds, [...taken, ...targets]) }),
|
|
159
164
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
160
|
-
|
|
165
|
+
binaryFiles: named(room.binaryFiles ?? {}, targets),
|
|
161
166
|
removals: opening
|
|
162
167
|
? [
|
|
163
168
|
...Object.keys(previous).filter((path) => !(path in current) && !currentTargets.has(path)),
|
|
164
169
|
...[...previousTargets].filter((target) => !currentTargets.has(target) && !(target in current)),
|
|
165
170
|
].sort()
|
|
166
171
|
: [],
|
|
167
|
-
...(declared ? { attachments } : {}),
|
|
168
172
|
...(pageToken === undefined ? {} : { pageToken }),
|
|
169
173
|
};
|
|
170
174
|
}
|
|
@@ -224,9 +228,15 @@ export function createMemoryAdapter(options = {}) {
|
|
|
224
228
|
if (outcome !== undefined)
|
|
225
229
|
return outcome;
|
|
226
230
|
if (name === 'conversation.send') {
|
|
231
|
+
const operation = typeof input.operation_id === 'string' ? input.operation_id : null;
|
|
232
|
+
const answered = operation === null ? undefined : sentTurns.get(operation);
|
|
233
|
+
if (answered !== undefined)
|
|
234
|
+
return { kind: 'action', result: { turn: answered } };
|
|
227
235
|
issued += 1;
|
|
228
236
|
const turn = `turn-${issued}`;
|
|
229
237
|
unsealed.set(turn, named);
|
|
238
|
+
if (operation !== null)
|
|
239
|
+
sentTurns.set(operation, turn);
|
|
230
240
|
return { kind: 'action', result: { turn } };
|
|
231
241
|
}
|
|
232
242
|
if (name === 'conversation.cancel') {
|
|
@@ -257,6 +267,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
257
267
|
};
|
|
258
268
|
}
|
|
259
269
|
return {
|
|
270
|
+
...(options.exhaustiveDiscovery === undefined ? {} : { exhaustiveDiscovery: true }),
|
|
260
271
|
setRooms(next) {
|
|
261
272
|
rooms = [...next];
|
|
262
273
|
retain(rooms);
|
|
@@ -269,9 +280,9 @@ export function createMemoryAdapter(options = {}) {
|
|
|
269
280
|
for (const observer of observers)
|
|
270
281
|
observer({ kind: 'opened' });
|
|
271
282
|
},
|
|
272
|
-
close(revoked = false) {
|
|
283
|
+
close({ revoked = false, lost = !revoked } = {}) {
|
|
273
284
|
for (const observer of observers)
|
|
274
|
-
observer({ kind: 'closed', revoked });
|
|
285
|
+
observer({ kind: 'closed', revoked, lost });
|
|
275
286
|
},
|
|
276
287
|
expire(locators) {
|
|
277
288
|
expiring = [...locators];
|
|
@@ -280,6 +291,13 @@ export function createMemoryAdapter(options = {}) {
|
|
|
280
291
|
for (const observer of observers)
|
|
281
292
|
observer({ kind: 'room-version', locator, roomVersion });
|
|
282
293
|
},
|
|
294
|
+
notifyAuthorityChanged(scope) {
|
|
295
|
+
for (const observer of observers) {
|
|
296
|
+
observer(scope === undefined
|
|
297
|
+
? { kind: 'authority-changed' }
|
|
298
|
+
: { kind: 'authority-changed', scope });
|
|
299
|
+
}
|
|
300
|
+
},
|
|
283
301
|
notifyConversation(event) {
|
|
284
302
|
if (event.kind === 'accepted-message') {
|
|
285
303
|
sealed.add(event.message.turn);
|
|
@@ -340,17 +358,19 @@ export function createMemoryAdapter(options = {}) {
|
|
|
340
358
|
},
|
|
341
359
|
reopen() {
|
|
342
360
|
queueMicrotask(() => {
|
|
343
|
-
for (const observer of observers)
|
|
344
|
-
observer({ kind: 'closed', revoked: false });
|
|
361
|
+
for (const observer of observers) {
|
|
362
|
+
observer({ kind: 'closed', revoked: false, lost: false });
|
|
363
|
+
}
|
|
345
364
|
});
|
|
346
365
|
},
|
|
366
|
+
published() { },
|
|
347
367
|
observe(notify) {
|
|
348
368
|
observers.add(notify);
|
|
349
369
|
queueMicrotask(() => {
|
|
350
370
|
if (!observers.has(notify))
|
|
351
371
|
return;
|
|
352
372
|
if (options.unopened === true) {
|
|
353
|
-
notify({ kind: 'closed', revoked: false });
|
|
373
|
+
notify({ kind: 'closed', revoked: false, lost: true });
|
|
354
374
|
return;
|
|
355
375
|
}
|
|
356
376
|
announceList();
|
|
@@ -447,6 +467,33 @@ export function createMemoryAdapter(options = {}) {
|
|
|
447
467
|
};
|
|
448
468
|
}, request);
|
|
449
469
|
},
|
|
470
|
+
async binary(_authorization, request) {
|
|
471
|
+
return resolveScript(scripts.binary, () => {
|
|
472
|
+
if (request.kind === 'reference') {
|
|
473
|
+
return { kind: 'rejected', code: 'unscripted-binary', fields: {}, retryable: false };
|
|
474
|
+
}
|
|
475
|
+
const room = rooms.find((entry) => entry.locator === request.locator);
|
|
476
|
+
if (room === undefined)
|
|
477
|
+
return { kind: 'room-not-readable', locator: request.locator };
|
|
478
|
+
const blob = room.blobs?.[request.path];
|
|
479
|
+
return blob === undefined
|
|
480
|
+
? { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false }
|
|
481
|
+
: { kind: 'binary', blob };
|
|
482
|
+
}, request);
|
|
483
|
+
},
|
|
484
|
+
async link(_authorization, request) {
|
|
485
|
+
return resolveScript(scripts.link, () => ({ kind: 'rejected', code: 'unscripted-link', fields: {}, retryable: false }), request);
|
|
486
|
+
},
|
|
487
|
+
referrerScope(referrer) {
|
|
488
|
+
if (typeof referrer !== 'object' || referrer === null)
|
|
489
|
+
return null;
|
|
490
|
+
const { room, path, message } = referrer;
|
|
491
|
+
if (typeof message === 'string')
|
|
492
|
+
return { kind: 'conversations' };
|
|
493
|
+
if (typeof room !== 'string')
|
|
494
|
+
return null;
|
|
495
|
+
return { kind: 'room', locator: room, ...(typeof path === 'string' ? { path } : {}) };
|
|
496
|
+
},
|
|
450
497
|
async action(_authorization, request) {
|
|
451
498
|
return resolveScript(scripts.action, () => {
|
|
452
499
|
if (request.name.startsWith('conversation.'))
|
package/dist/model.d.ts
CHANGED
|
@@ -29,12 +29,13 @@ export type ModelState = {
|
|
|
29
29
|
types: VerifiedModel['types'];
|
|
30
30
|
};
|
|
31
31
|
export type TypesResult = {
|
|
32
|
-
status: 'unavailable'
|
|
32
|
+
status: Open<'unavailable'>;
|
|
33
33
|
reason: ModelUnavailableReason;
|
|
34
|
+
types: null;
|
|
34
35
|
schema?: string | null;
|
|
35
36
|
revision?: string | null;
|
|
36
37
|
} | {
|
|
37
|
-
status: 'current' | 'cached'
|
|
38
|
+
status: Open<'current' | 'cached'>;
|
|
38
39
|
identity: string;
|
|
39
40
|
version: string;
|
|
40
41
|
verifiedWith: ModelIdentity;
|
|
@@ -52,5 +53,6 @@ export declare function definitionOf(state: ModelState, type: string | undefined
|
|
|
52
53
|
export declare function modelTypes(state: ModelState): TypesResult;
|
|
53
54
|
export declare function cached(state: ModelState): ModelState;
|
|
54
55
|
export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
|
|
56
|
+
export declare function sameTyping(left: ModelState, right: ModelState): boolean;
|
|
55
57
|
export declare function referenceField(facts: ValueFacts | undefined): boolean;
|
|
56
58
|
//# sourceMappingURL=model.d.ts.map
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAC/F,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,CAAC,CAAC;AACnG,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAChC,MAAM,MAAM,UAAU,GAClB;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CA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aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAE5E;AACD,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CASvE;AACD,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAErE"}
|
package/dist/model.js
CHANGED
|
@@ -6,7 +6,7 @@ export function definitionOf(state, type) {
|
|
|
6
6
|
}
|
|
7
7
|
export function modelTypes(state) {
|
|
8
8
|
return state.status === 'unavailable'
|
|
9
|
-
? { ...state }
|
|
9
|
+
? { ...state, types: null }
|
|
10
10
|
: {
|
|
11
11
|
status: state.status,
|
|
12
12
|
identity: state.snapshot.identity,
|
|
@@ -23,6 +23,15 @@ export function cached(state) {
|
|
|
23
23
|
export function sameModel(left, right) {
|
|
24
24
|
return left.identity === right.identity && left.version === right.version;
|
|
25
25
|
}
|
|
26
|
+
export function sameTyping(left, right) {
|
|
27
|
+
if (left === right)
|
|
28
|
+
return true;
|
|
29
|
+
if (left.status === 'unavailable' || right.status === 'unavailable') {
|
|
30
|
+
return left.status === right.status;
|
|
31
|
+
}
|
|
32
|
+
return (left.snapshot.schema === right.snapshot.schema &&
|
|
33
|
+
sameModel(left.verifiedWith, right.verifiedWith));
|
|
34
|
+
}
|
|
26
35
|
export function referenceField(facts) {
|
|
27
36
|
return facts?.reference !== undefined || facts?.items?.reference !== undefined;
|
|
28
37
|
}
|
package/dist/observation.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { QueryDocument, QueryGroup, QueryResult } from './query.js';
|
|
1
|
+
import type { QueryCoverage, QueryDocument, QueryGroup, QueryResult } from './query.js';
|
|
2
2
|
export type Observation<T> = {
|
|
3
3
|
current(): T;
|
|
4
4
|
subscribe(listener: (value: T) => void): () => void;
|
|
@@ -13,14 +13,19 @@ export type QueryChange = {
|
|
|
13
13
|
changed: readonly (readonly [RowKey, QueryDocument | QueryGroup])[];
|
|
14
14
|
removed: readonly RowKey[];
|
|
15
15
|
order: readonly RowKey[] | null;
|
|
16
|
+
coverage?: QueryCoverage;
|
|
17
|
+
next?: string | null;
|
|
18
|
+
total?: number;
|
|
16
19
|
};
|
|
20
|
+
export type QueryMessage = KeyedResult | QueryChange;
|
|
17
21
|
export type Observed = {
|
|
18
22
|
observation: Observation<unknown>;
|
|
19
23
|
receive(message: unknown): void;
|
|
20
24
|
end(): void;
|
|
21
25
|
};
|
|
22
26
|
export declare function rowsOf(result: QueryResult): readonly (QueryDocument | QueryGroup)[];
|
|
23
|
-
export declare function
|
|
27
|
+
export declare function whole(message: QueryMessage): message is KeyedResult;
|
|
28
|
+
export declare function applied(keyed: KeyedResult, message: QueryMessage): KeyedResult;
|
|
24
29
|
export declare function observed(first: unknown, stop: () => void, keyed: boolean): Observed;
|
|
25
30
|
export declare function opened(watch: (deliver: (message: unknown) => void) => () => void, keyed: boolean): Promise<Observation<unknown>>;
|
|
26
31
|
export declare function observing<Topic extends string>(watch: (topic: Topic, input: readonly unknown[], deliver: (message: unknown) => void) => () => void): (topic: Topic, ...input: unknown[]) => Promise<Observation<unknown>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAExF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,OAAO,IAAI,CAAC,CAAC;IACb,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACpD,KAAK,IAAI,IA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E,OAAO,KAAK,IAAI,KAAK,MAAM,IAAI,EAC1D,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAiB/B;AAED,wBAAgB,SAAS,CAAC,KAAK,SAAS,MAAM,EAC5C,KAAK,EAAE,CACL,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,SAAS,OAAO,EAAE,EACzB,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KAChC,MAAM,IAAI,WAEA,KAAK,YAAY,OAAO,EAAE,KAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAQ1E"}
|
package/dist/observation.js
CHANGED
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
export function rowsOf(result) {
|
|
2
|
-
|
|
2
|
+
if ('groups' in result)
|
|
3
|
+
return result.groups;
|
|
4
|
+
return 'documents' in result ? result.documents : [];
|
|
3
5
|
}
|
|
4
|
-
export function
|
|
5
|
-
|
|
6
|
+
export function whole(message) {
|
|
7
|
+
return 'result' in message;
|
|
8
|
+
}
|
|
9
|
+
export function applied(keyed, message) {
|
|
10
|
+
if (whole(message))
|
|
11
|
+
return message;
|
|
12
|
+
const result = keyed.result;
|
|
13
|
+
if ('pending' in result)
|
|
14
|
+
return keyed;
|
|
15
|
+
const rows = rowsOf(result);
|
|
6
16
|
const byKey = new Map(keyed.keys.map((key, index) => [key, rows[index]]));
|
|
7
|
-
for (const key of
|
|
17
|
+
for (const key of message.removed)
|
|
8
18
|
byKey.delete(key);
|
|
9
|
-
for (const [key, row] of
|
|
19
|
+
for (const [key, row] of message.changed)
|
|
10
20
|
byKey.set(key, row);
|
|
11
|
-
const keys =
|
|
12
|
-
const
|
|
21
|
+
const keys = message.order ?? keyed.keys.filter((key) => byKey.has(key));
|
|
22
|
+
const kept = keys.map((key) => byKey.get(key));
|
|
23
|
+
const coverage = message.coverage ?? result.coverage;
|
|
24
|
+
const next = message.next === undefined ? result.next : (message.next ?? undefined);
|
|
25
|
+
const total = message.total ?? result.total;
|
|
26
|
+
const window = {
|
|
27
|
+
...(next === undefined ? {} : { next }),
|
|
28
|
+
...(total === undefined ? {} : { total }),
|
|
29
|
+
};
|
|
13
30
|
return {
|
|
14
|
-
result: 'groups' in
|
|
15
|
-
? { groups:
|
|
16
|
-
: { documents:
|
|
31
|
+
result: 'groups' in result
|
|
32
|
+
? { groups: kept, coverage, ...window }
|
|
33
|
+
: { documents: kept, coverage, ...window },
|
|
17
34
|
keys,
|
|
18
35
|
};
|
|
19
36
|
}
|
|
@@ -27,11 +44,11 @@ function keyedResult(first) {
|
|
|
27
44
|
},
|
|
28
45
|
};
|
|
29
46
|
}
|
|
30
|
-
function
|
|
47
|
+
function replaced(first) {
|
|
31
48
|
return { value: first, next: (message) => message };
|
|
32
49
|
}
|
|
33
50
|
export function observed(first, stop, keyed) {
|
|
34
|
-
const reducer = keyed ? keyedResult(first) :
|
|
51
|
+
const reducer = keyed ? keyedResult(first) : replaced(first);
|
|
35
52
|
let value = reducer.value;
|
|
36
53
|
let open = true;
|
|
37
54
|
const listeners = new Set();
|
package/dist/outcome.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionResult, AdapterFailure, HistoryResult, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
1
|
+
import type { ActionResult, AdapterFailure, BinaryLinkResult, BinaryResult, HistoryResult, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
3
|
type Refused<Kind extends string> = ProviderRefusal & {
|
|
4
4
|
kind: Kind;
|
|
@@ -14,6 +14,22 @@ export type CallResult = {
|
|
|
14
14
|
export type HistoryAnswer = Exclude<HistoryResult, {
|
|
15
15
|
kind: Failure['kind'];
|
|
16
16
|
}> | Failure;
|
|
17
|
+
export type BinaryAnswer = {
|
|
18
|
+
kind: 'binary';
|
|
19
|
+
blob: Blob;
|
|
20
|
+
} | Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
21
|
+
export type BinaryLinkAnswer = {
|
|
22
|
+
kind: 'link';
|
|
23
|
+
url: string;
|
|
24
|
+
name: string;
|
|
25
|
+
} | Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
26
|
+
export declare function absentBinary(path: string): Refused<'absent'>;
|
|
27
|
+
export declare function binaryAnswer(result: BinaryResult): BinaryAnswer;
|
|
28
|
+
export declare function binaryLinkAnswer(result: BinaryLinkResult): BinaryLinkAnswer;
|
|
29
|
+
export type Offline = {
|
|
30
|
+
readonly kind: 'offline';
|
|
31
|
+
};
|
|
32
|
+
export declare const OFFLINE: Offline;
|
|
17
33
|
export declare const UNCERTAIN: Failure;
|
|
18
34
|
export declare function undeclared(name: string): CallResult;
|
|
19
35
|
export declare function failure(result: AdapterFailure): Failure;
|
package/dist/outcome.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACb,eAAe,EACf,aAAa,EACb,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,KAAK,OAAO,CAAC,IAAI,SAAS,MAAM,IAAI,eAAe,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAErE,MAAM,MAAM,OAAO,GACf,OAAO,CAAC,uBAAuB,CAAC,GAChC,OAAO,CAAC,uBAAuB,CAAC,GAChC,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,GACpD,aAAa,CAAC;AAElB,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,EAAE,CAAC,EAAE,aAAa,CAAA;CAAE,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G,gBAAgB,CAE3E;AAED,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEnD,eAAO,MAAM,OAAO,EAAE,OAA6B,CAAC;AAEpD,eAAO,MAAM,SAAS,EAAE,OAKvB,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAEnD;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAiBvD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAE7D;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAIlE;AAED,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,WAAW,CAAA;CAAE,GAC3C;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GAAG,CACvD,UAAU,GACV;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAC/D,CAAC"}
|
package/dist/outcome.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
export function absentBinary(path) {
|
|
2
|
+
return { kind: 'absent', code: 'binary-file-absent', fields: { path }, retryable: false };
|
|
3
|
+
}
|
|
4
|
+
export function binaryAnswer(result) {
|
|
5
|
+
return result.kind === 'binary' || result.kind === 'rejected' ? result : failure(result);
|
|
6
|
+
}
|
|
7
|
+
export function binaryLinkAnswer(result) {
|
|
8
|
+
return result.kind === 'link' || result.kind === 'rejected' ? result : failure(result);
|
|
9
|
+
}
|
|
10
|
+
export const OFFLINE = { kind: 'offline' };
|
|
1
11
|
export const UNCERTAIN = {
|
|
2
12
|
kind: 'transport-uncertainty',
|
|
3
13
|
code: 'transport-uncertainty',
|
package/dist/overlay.d.ts
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
import type { HeadChange } from './adapter.js';
|
|
1
|
+
import type { BinaryFile, HeadChange } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
3
|
export type Heads = {
|
|
4
4
|
revisions: Readonly<Record<string, string>>;
|
|
5
|
+
fileIds: Readonly<Record<string, string>>;
|
|
5
6
|
changes: Readonly<Record<string, HeadChange>>;
|
|
6
7
|
};
|
|
8
|
+
export type HeldBinary = ({
|
|
9
|
+
readonly state: 'accepted';
|
|
10
|
+
} & BinaryFile) | {
|
|
11
|
+
readonly state: 'pending';
|
|
12
|
+
readonly localId: string;
|
|
13
|
+
readonly byteLength: number;
|
|
14
|
+
readonly mediaType: string;
|
|
15
|
+
readonly sha256: string;
|
|
16
|
+
};
|
|
7
17
|
export type Layer = Heads & {
|
|
8
18
|
documents: Readonly<Record<string, string>>;
|
|
9
|
-
|
|
19
|
+
binaries: Readonly<Record<string, HeldBinary>>;
|
|
10
20
|
};
|
|
21
|
+
export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>): Record<string, HeldBinary>;
|
|
22
|
+
export declare function sameBinary(left: HeldBinary | undefined, right: HeldBinary | undefined): boolean;
|
|
11
23
|
export declare function sameChange(left: HeadChange | undefined, right: HeadChange | undefined): boolean;
|
|
12
24
|
export declare function overlay(base: Layer, queue: readonly ChangeBatch[], unapplied?: () => void): Layer;
|
|
13
25
|
export declare function sameLayerText(left: Layer, right: Layer): boolean;
|
|
26
|
+
export declare function changedPaths(left: Layer, right: Layer): ReadonlySet<string>;
|
|
14
27
|
export declare function overlayChanged(base: Layer, queue: readonly ChangeBatch[], previousBase: Layer, previousQueue: readonly ChangeBatch[], previousVisible: Layer): Layer;
|
|
15
28
|
//# sourceMappingURL=overlay.d.ts.map
|
package/dist/overlay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAU,WAAW,EAAgB,MAAM,aAAa,CAAC;AAGrE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAAG,UAAU,CAAC,GAC7C;IACE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEN,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG;IAC1B,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAA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