@agentshouse/mdruntime 0.1.0-c2af3ddcc243b → 0.1.0-c2e433921a4d5
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/README.md +14 -13
- package/dist/acceptance.js +1 -1
- package/dist/adapter.d.ts +55 -9
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +0 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +0 -5
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +345 -0
- package/dist/change.d.ts +4 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +3 -0
- package/dist/chat-types.d.ts +0 -2
- package/dist/chat-types.d.ts.map +1 -1
- package/dist/chat-types.js +0 -2
- package/dist/client.d.ts +5 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -7
- package/dist/collection.d.ts +4 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +7 -0
- package/dist/column.d.ts +5 -0
- package/dist/column.d.ts.map +1 -0
- package/dist/column.js +9 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +2 -3
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +6 -4
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +16 -6
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +15 -6
- package/dist/conversation-row.d.ts +8 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +20 -7
- package/dist/conversation.d.ts +9 -5
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +155 -123
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +4 -2
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +2 -1
- package/dist/host.d.ts +1 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +14 -8
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/install.d.ts +8 -2
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +40 -33
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +15 -10
- package/dist/listing.d.ts +7 -3
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +26 -13
- package/dist/live.d.ts +5 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +71 -30
- package/dist/loaded.d.ts +5 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +40 -0
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +2 -2
- package/dist/lost.js +1 -1
- package/dist/media.d.ts +5 -0
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +65 -14
- package/dist/memory.d.ts +3 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +17 -8
- package/dist/messages.d.ts +3 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +5 -3
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +3 -3
- package/dist/observation.d.ts +27 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +173 -69
- package/dist/outcome.d.ts +4 -0
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +8 -2
- package/dist/overlay.d.ts +1 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +3 -5
- package/dist/preparation.d.ts +27 -6
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +131 -44
- package/dist/presence.d.ts +8 -2
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +24 -13
- package/dist/queries.d.ts +1 -1
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +43 -17
- package/dist/questions.d.ts +1 -0
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +1 -0
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +51 -21
- package/dist/reach.d.ts +2 -3
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +20 -7
- package/dist/react.d.ts +3 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +8 -2
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +3 -5
- package/dist/reads.d.ts +1 -1
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +2 -2
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +2 -2
- package/dist/room-draft.d.ts +28 -3
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +230 -12
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +5 -2
- package/dist/room-list.d.ts +10 -0
- package/dist/room-list.d.ts.map +1 -0
- package/dist/room-list.js +45 -0
- package/dist/rows.d.ts +2 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +6 -6
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +17 -86
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +23 -7
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -2
- package/dist/shown.d.ts +1 -1
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +51 -37
- package/dist/source.d.ts +5 -0
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +13 -2
- package/dist/store/installs.d.ts +2 -2
- package/dist/store/installs.d.ts.map +1 -1
- package/dist/store/installs.js +10 -4
- package/dist/store/readiness.d.ts +5 -4
- package/dist/store/readiness.d.ts.map +1 -1
- package/dist/store/readiness.js +28 -12
- package/dist/store/records.d.ts +10 -1
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +46 -19
- package/dist/store/rooms-shown.d.ts +8 -0
- package/dist/store/rooms-shown.d.ts.map +1 -0
- package/dist/store/rooms-shown.js +13 -0
- package/dist/store.d.ts +12 -8
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +8 -4
- package/dist/stored.d.ts +23 -13
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +73 -22
- package/dist/surface.d.ts +4 -2
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +7 -2
- package/dist/sync.d.ts +1 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +8 -7
- package/dist/tables.d.ts +10 -49
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +60 -322
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +1 -2
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +3 -9
- package/dist/wire.d.ts +2 -8
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +2 -2
- package/package.json +2 -2
package/dist/observation.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { QueryCoverage, QueryDocument, QueryGroup, QueryResult } from './query.js';
|
|
1
|
+
import type { PendingRoom, QueryCoverage, QueryDocument, QueryGroup, QueryResult } from './query.js';
|
|
2
|
+
import type { ReadinessShown, RoomCoverage } from './readiness.js';
|
|
2
3
|
export type Observation<T> = {
|
|
3
4
|
current(): T;
|
|
4
5
|
subscribe(listener: (value: T) => void): () => void;
|
|
@@ -9,15 +10,24 @@ export type KeyedResult = {
|
|
|
9
10
|
result: QueryResult;
|
|
10
11
|
keys: readonly RowKey[];
|
|
11
12
|
};
|
|
12
|
-
export type
|
|
13
|
-
changed: readonly (readonly [
|
|
14
|
-
removed: readonly
|
|
15
|
-
order: readonly
|
|
13
|
+
export type KeyedChange<K, T> = {
|
|
14
|
+
readonly changed: readonly (readonly [K, T])[];
|
|
15
|
+
readonly removed: readonly K[];
|
|
16
|
+
readonly order: readonly K[] | null;
|
|
17
|
+
};
|
|
18
|
+
export type QueryChange = KeyedChange<RowKey, QueryDocument | QueryGroup> & {
|
|
16
19
|
coverage?: QueryCoverage;
|
|
17
20
|
next?: string | null;
|
|
18
21
|
total?: number;
|
|
19
22
|
};
|
|
20
|
-
export type
|
|
23
|
+
export type ReadinessChange = {
|
|
24
|
+
readonly shown: ReadinessShown;
|
|
25
|
+
readonly rooms: KeyedChange<string, RoomCoverage>;
|
|
26
|
+
};
|
|
27
|
+
export type PendingChange = {
|
|
28
|
+
readonly pending: KeyedChange<string, PendingRoom>;
|
|
29
|
+
};
|
|
30
|
+
export type QueryMessage = KeyedResult | QueryChange | PendingChange;
|
|
21
31
|
export type Observed = {
|
|
22
32
|
observation: Observation<unknown>;
|
|
23
33
|
receive(message: unknown): void;
|
|
@@ -25,15 +35,20 @@ export type Observed = {
|
|
|
25
35
|
};
|
|
26
36
|
export declare function rowsOf(result: QueryResult): readonly (QueryDocument | QueryGroup)[];
|
|
27
37
|
export declare function whole(message: QueryMessage): message is KeyedResult;
|
|
28
|
-
export declare function
|
|
29
|
-
export declare function
|
|
30
|
-
export declare function
|
|
38
|
+
export declare function pendingChange(message: QueryMessage): message is PendingChange;
|
|
39
|
+
export declare function unchanged(change: KeyedChange<unknown, unknown>): boolean;
|
|
40
|
+
export declare function keyedChange<K, H, T>(held: ReadonlyMap<K, H>, keys: readonly K[], rows: readonly T[], same: (was: H, now: T) => boolean): KeyedChange<K, T>;
|
|
41
|
+
export declare function keyedAt<K, H, T>(held: ReadonlyMap<K, H>, at: ReadonlyMap<K, T | null>, same: (was: H, now: T) => boolean): KeyedChange<K, T> | null;
|
|
42
|
+
export declare function keyedInto<K, T>(held: Map<K, T>, change: KeyedChange<K, T>): void;
|
|
43
|
+
export declare function samePending(was: PendingRoom, now: PendingRoom): boolean;
|
|
44
|
+
export declare function replaces(topic: string, message: unknown): boolean;
|
|
45
|
+
export declare function observed(first: unknown, stop: () => void, topic: string): Observed;
|
|
46
|
+
export declare function opened(watch: (deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void, topic: string): Promise<Observation<unknown>>;
|
|
31
47
|
export declare function observing<Topic extends string>(watch: (topic: Topic, input: readonly unknown[], deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void): (topic: Topic, ...input: unknown[]) => Promise<Observation<unknown>>;
|
|
32
48
|
export type Digest = {
|
|
33
|
-
readonly pending: string
|
|
49
|
+
readonly pending: Map<string, PendingRoom>;
|
|
34
50
|
} | {
|
|
35
|
-
readonly
|
|
36
|
-
readonly rows: ReadonlyMap<RowKey, number>;
|
|
51
|
+
readonly rows: Map<RowKey, number>;
|
|
37
52
|
readonly coverage: string;
|
|
38
53
|
readonly next: string | undefined;
|
|
39
54
|
readonly total: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAa,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9E,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,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAErC,MAAM,MAAM,WAAW,GAAG;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAE3E,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/C,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC;CACrC,CAA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,EAAE,CACL,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,SAAS,OAAO,EAAE,EACzB,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,EACnC,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,KAC3B,MAAM,IAAI,WAEA,KAAK,YAAY,OAAO,EAAE,KAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAa1E;AAED,MAAM,MAAM,MAAM,GACd;IAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;CAAE,GAC9C;IACE,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAAC;AAEN,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa3C;AAMD,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,WAAW,GAAG,MAAM,CAU9D;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,MAAM,CAkB3E;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,YAAY,GAAG,IAAI,CAsBjF"}
|
package/dist/observation.js
CHANGED
|
@@ -6,49 +6,165 @@ export function rowsOf(result) {
|
|
|
6
6
|
export function whole(message) {
|
|
7
7
|
return 'result' in message;
|
|
8
8
|
}
|
|
9
|
-
export function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
const kept =
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
export function pendingChange(message) {
|
|
10
|
+
return 'pending' in message;
|
|
11
|
+
}
|
|
12
|
+
export function unchanged(change) {
|
|
13
|
+
return change.changed.length === 0 && change.removed.length === 0 && change.order === null;
|
|
14
|
+
}
|
|
15
|
+
export function keyedChange(held, keys, rows, same) {
|
|
16
|
+
const present = new Set(keys);
|
|
17
|
+
const changed = keys.flatMap((key, at) => {
|
|
18
|
+
const was = held.get(key);
|
|
19
|
+
return was !== undefined && same(was, rows[at]) ? [] : [[key, rows[at]]];
|
|
20
|
+
});
|
|
21
|
+
const removed = [];
|
|
22
|
+
const kept = [];
|
|
23
|
+
for (const key of held.keys())
|
|
24
|
+
(present.has(key) ? kept : removed).push(key);
|
|
25
|
+
const moved = kept.length !== keys.length || kept.some((key, at) => keys[at] !== key);
|
|
26
|
+
return { changed, removed, order: moved ? keys : null };
|
|
27
|
+
}
|
|
28
|
+
export function keyedAt(held, at, same) {
|
|
29
|
+
const changed = [];
|
|
30
|
+
const removed = [];
|
|
31
|
+
for (const [key, now] of at) {
|
|
32
|
+
const was = held.get(key);
|
|
33
|
+
if (was === undefined) {
|
|
34
|
+
if (now !== null)
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
else if (now === null)
|
|
38
|
+
removed.push(key);
|
|
39
|
+
else if (!same(was, now))
|
|
40
|
+
changed.push([key, now]);
|
|
41
|
+
}
|
|
42
|
+
return { changed, removed, order: null };
|
|
43
|
+
}
|
|
44
|
+
export function keyedInto(held, change) {
|
|
45
|
+
for (const key of change.removed)
|
|
46
|
+
held.delete(key);
|
|
47
|
+
for (const [key, row] of change.changed)
|
|
48
|
+
held.set(key, row);
|
|
49
|
+
if (change.order === null)
|
|
50
|
+
return;
|
|
51
|
+
const placed = change.order.map((key) => [key, held.get(key)]);
|
|
52
|
+
held.clear();
|
|
53
|
+
for (const [key, row] of placed)
|
|
54
|
+
held.set(key, row);
|
|
55
|
+
}
|
|
56
|
+
export function samePending(was, now) {
|
|
57
|
+
return was.awaits === now.awaits;
|
|
58
|
+
}
|
|
59
|
+
function keyedRows(keys, rows) {
|
|
60
|
+
const held = new Map(keys.map((key, at) => [key, rows[at]]));
|
|
61
|
+
let shown = rows;
|
|
62
|
+
return {
|
|
63
|
+
rows: () => shown,
|
|
64
|
+
apply(change) {
|
|
65
|
+
if (unchanged(change))
|
|
66
|
+
return shown;
|
|
67
|
+
keyedInto(held, change);
|
|
68
|
+
shown = [...held.values()];
|
|
69
|
+
return shown;
|
|
70
|
+
},
|
|
29
71
|
};
|
|
72
|
+
}
|
|
73
|
+
function located(rooms) {
|
|
74
|
+
return keyedRows(rooms.map(({ locator }) => locator), rooms);
|
|
75
|
+
}
|
|
76
|
+
function keyedRooms(first) {
|
|
77
|
+
let held = located(first);
|
|
30
78
|
return {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
79
|
+
value: first,
|
|
80
|
+
next(message) {
|
|
81
|
+
if (!Array.isArray(message))
|
|
82
|
+
return held.apply(message);
|
|
83
|
+
held = located(message);
|
|
84
|
+
return held.rows();
|
|
85
|
+
},
|
|
35
86
|
};
|
|
36
87
|
}
|
|
88
|
+
function covered(readiness) {
|
|
89
|
+
return keyedRows(readiness.coverage.rooms.map(({ room }) => room), readiness.coverage.rooms);
|
|
90
|
+
}
|
|
91
|
+
function keyedReadiness(first) {
|
|
92
|
+
let held = covered(first);
|
|
93
|
+
return {
|
|
94
|
+
value: first,
|
|
95
|
+
next(message) {
|
|
96
|
+
if (!('shown' in message)) {
|
|
97
|
+
held = covered(message);
|
|
98
|
+
return message;
|
|
99
|
+
}
|
|
100
|
+
const { shown, rooms } = message;
|
|
101
|
+
return { ...shown, coverage: { ...shown.coverage, rooms: held.apply(rooms) } };
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function awaiting(pending) {
|
|
106
|
+
return keyedRows(pending.map(({ room }) => room), pending);
|
|
107
|
+
}
|
|
37
108
|
function keyedResult(first) {
|
|
38
|
-
let
|
|
109
|
+
let result = first.result;
|
|
110
|
+
let rows = keyedRows([], []);
|
|
111
|
+
let pending = awaiting([]);
|
|
112
|
+
const take = ({ result: next, keys }) => {
|
|
113
|
+
result = next;
|
|
114
|
+
if ('pending' in next)
|
|
115
|
+
pending = awaiting(next.pending);
|
|
116
|
+
else
|
|
117
|
+
rows = keyedRows(keys, rowsOf(next));
|
|
118
|
+
return result;
|
|
119
|
+
};
|
|
120
|
+
take(first);
|
|
39
121
|
return {
|
|
40
122
|
value: first.result,
|
|
41
123
|
next(message) {
|
|
42
|
-
|
|
43
|
-
|
|
124
|
+
const asked = message;
|
|
125
|
+
if (whole(asked))
|
|
126
|
+
return take(asked);
|
|
127
|
+
if (pendingChange(asked)) {
|
|
128
|
+
if ('pending' in result)
|
|
129
|
+
result = { pending: pending.apply(asked.pending) };
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
if ('pending' in result)
|
|
133
|
+
return result;
|
|
134
|
+
const kept = rows.apply(asked);
|
|
135
|
+
const coverage = asked.coverage ?? result.coverage;
|
|
136
|
+
const next = asked.next === undefined ? result.next : (asked.next ?? undefined);
|
|
137
|
+
const total = asked.total ?? result.total;
|
|
138
|
+
const window = {
|
|
139
|
+
...(next === undefined ? {} : { next }),
|
|
140
|
+
...(total === undefined ? {} : { total }),
|
|
141
|
+
};
|
|
142
|
+
result =
|
|
143
|
+
'groups' in result
|
|
144
|
+
? { groups: kept, coverage, ...window }
|
|
145
|
+
: { documents: kept, coverage, ...window };
|
|
146
|
+
return result;
|
|
44
147
|
},
|
|
45
148
|
};
|
|
46
149
|
}
|
|
150
|
+
const FOLDS = {
|
|
151
|
+
query: (first) => keyedResult(first),
|
|
152
|
+
rooms: (first) => keyedRooms(first),
|
|
153
|
+
readiness: (first) => keyedReadiness(first),
|
|
154
|
+
};
|
|
155
|
+
const WHOLE = {
|
|
156
|
+
query: (message) => whole(message),
|
|
157
|
+
rooms: (message) => Array.isArray(message),
|
|
158
|
+
readiness: (message) => !('shown' in message),
|
|
159
|
+
};
|
|
160
|
+
export function replaces(topic, message) {
|
|
161
|
+
return WHOLE[topic]?.(message) ?? true;
|
|
162
|
+
}
|
|
47
163
|
function replaced(first) {
|
|
48
164
|
return { value: first, next: (message) => message };
|
|
49
165
|
}
|
|
50
|
-
export function observed(first, stop,
|
|
51
|
-
const reducer =
|
|
166
|
+
export function observed(first, stop, topic) {
|
|
167
|
+
const reducer = (FOLDS[topic] ?? replaced)(first);
|
|
52
168
|
let value = reducer.value;
|
|
53
169
|
let open = true;
|
|
54
170
|
const listeners = new Set();
|
|
@@ -86,7 +202,7 @@ export function observed(first, stop, keyed) {
|
|
|
86
202
|
end,
|
|
87
203
|
};
|
|
88
204
|
}
|
|
89
|
-
export function opened(watch,
|
|
205
|
+
export function opened(watch, topic) {
|
|
90
206
|
return new Promise((resolve, reject) => {
|
|
91
207
|
let handle;
|
|
92
208
|
let stop = () => { };
|
|
@@ -95,7 +211,7 @@ export function opened(watch, keyed) {
|
|
|
95
211
|
handle.receive(message);
|
|
96
212
|
return;
|
|
97
213
|
}
|
|
98
|
-
handle = observed(message, () => stop(),
|
|
214
|
+
handle = observed(message, () => stop(), topic);
|
|
99
215
|
resolve(handle.observation);
|
|
100
216
|
}, (error) => {
|
|
101
217
|
if (handle !== undefined)
|
|
@@ -108,7 +224,7 @@ export function opened(watch, keyed) {
|
|
|
108
224
|
export function observing(watch) {
|
|
109
225
|
return (topic, ...input) => opened((deliver, fail) => watch(topic, input, (message) => {
|
|
110
226
|
deliver(structuredClone(message));
|
|
111
|
-
}, fail), topic
|
|
227
|
+
}, fail), topic);
|
|
112
228
|
}
|
|
113
229
|
export function hashed(text) {
|
|
114
230
|
let first = 0xdeadbeef;
|
|
@@ -129,10 +245,9 @@ function rowDigest(row) {
|
|
|
129
245
|
}
|
|
130
246
|
export function digestOf({ result, keys }) {
|
|
131
247
|
if ('pending' in result)
|
|
132
|
-
return { pending:
|
|
248
|
+
return { pending: new Map(result.pending.map((room) => [room.room, room])) };
|
|
133
249
|
const rows = rowsOf(result);
|
|
134
250
|
return {
|
|
135
|
-
keys,
|
|
136
251
|
rows: new Map(keys.map((key, index) => [key, rowDigest(rows[index])])),
|
|
137
252
|
coverage: JSON.stringify(result.coverage),
|
|
138
253
|
next: result.next,
|
|
@@ -140,16 +255,22 @@ export function digestOf({ result, keys }) {
|
|
|
140
255
|
};
|
|
141
256
|
}
|
|
142
257
|
export function digestApplied(digest, message) {
|
|
143
|
-
if (whole(message)
|
|
144
|
-
return
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
258
|
+
if (whole(message))
|
|
259
|
+
return digestOf(message);
|
|
260
|
+
if (pendingChange(message)) {
|
|
261
|
+
if ('pending' in digest)
|
|
262
|
+
keyedInto(digest.pending, message.pending);
|
|
263
|
+
return digest;
|
|
264
|
+
}
|
|
265
|
+
if ('pending' in digest)
|
|
266
|
+
return digest;
|
|
267
|
+
keyedInto(digest.rows, {
|
|
268
|
+
changed: message.changed.map(([key, row]) => [key, rowDigest(row)]),
|
|
269
|
+
removed: message.removed,
|
|
270
|
+
order: message.order,
|
|
271
|
+
});
|
|
150
272
|
return {
|
|
151
|
-
|
|
152
|
-
rows,
|
|
273
|
+
rows: digest.rows,
|
|
153
274
|
coverage: message.coverage === undefined ? digest.coverage : JSON.stringify(message.coverage),
|
|
154
275
|
next: message.next === undefined ? digest.next : (message.next ?? undefined),
|
|
155
276
|
total: message.total ?? digest.total,
|
|
@@ -157,35 +278,18 @@ export function digestApplied(digest, message) {
|
|
|
157
278
|
}
|
|
158
279
|
export function changeOf(previous, next) {
|
|
159
280
|
const after = next.result;
|
|
160
|
-
if ('pending' in previous
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
: next;
|
|
281
|
+
if ('pending' in previous && 'pending' in after) {
|
|
282
|
+
const pending = keyedChange(previous.pending, after.pending.map(({ room }) => room), after.pending, samePending);
|
|
283
|
+
return unchanged(pending) ? null : { pending };
|
|
164
284
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
const row = later[index];
|
|
170
|
-
if (previous.rows.get(key) !== rowDigest(row))
|
|
171
|
-
changed.push([key, row]);
|
|
172
|
-
});
|
|
173
|
-
const removed = previous.keys.filter((key) => !present.has(key));
|
|
174
|
-
const kept = previous.keys.filter((key) => present.has(key));
|
|
175
|
-
const moved = kept.length !== next.keys.length || kept.some((key, index) => next.keys[index] !== key);
|
|
176
|
-
const coverage = JSON.stringify(after.coverage);
|
|
177
|
-
const covered = previous.coverage !== coverage;
|
|
285
|
+
if ('pending' in previous || 'pending' in after)
|
|
286
|
+
return next;
|
|
287
|
+
const rows = keyedChange(previous.rows, next.keys, rowsOf(after), (was, row) => was === rowDigest(row));
|
|
288
|
+
const covered = previous.coverage !== JSON.stringify(after.coverage);
|
|
178
289
|
const framing = reframed(previous, after);
|
|
179
|
-
if (
|
|
290
|
+
if (unchanged(rows) && !covered && framing === null)
|
|
180
291
|
return null;
|
|
181
|
-
}
|
|
182
|
-
return {
|
|
183
|
-
changed,
|
|
184
|
-
removed,
|
|
185
|
-
order: moved ? next.keys : null,
|
|
186
|
-
...(covered ? { coverage: after.coverage } : {}),
|
|
187
|
-
...framing,
|
|
188
|
-
};
|
|
292
|
+
return { ...rows, ...(covered ? { coverage: after.coverage } : {}), ...framing };
|
|
189
293
|
}
|
|
190
294
|
function reframed(before, after) {
|
|
191
295
|
const next = before.next === after.next ? {} : { next: after.next ?? null };
|
package/dist/outcome.d.ts
CHANGED
|
@@ -57,6 +57,10 @@ export declare const UNREADABLE: Refused<'unreadable'>;
|
|
|
57
57
|
export declare const LOCKED_UNREADABLE: Refused<'unreadable'>;
|
|
58
58
|
export declare const ABSENT_TARGET: Refused<'absent'>;
|
|
59
59
|
export declare function absentBinary(path: string): Refused<'absent'>;
|
|
60
|
+
export declare function declaredType(blob: Blob): string;
|
|
61
|
+
export declare function blobOf(binary: Extract<BinaryAnswer, {
|
|
62
|
+
kind: 'binary';
|
|
63
|
+
}>): Promise<Blob>;
|
|
60
64
|
export declare function binaryAnswer(result: KeptResult): HeldBinaryAnswer;
|
|
61
65
|
export declare function binaryLinkAnswer(result: BinaryLinkResult, held?: string): BinaryLinkAnswer;
|
|
62
66
|
export declare function attachAnswer(result: AttachResult): AttachAnswer;
|
package/dist/outcome.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1D,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,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE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E,OAAO,EAChB,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,MAAM,EAAE,YAAY,GACnB,UAAU,CAUZ"}
|
package/dist/outcome.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MEDIA_TYPES } from '@agentshouse/mdmodel';
|
|
1
2
|
import { refusalError } from './failure.js';
|
|
2
3
|
export const UNREADABLE = {
|
|
3
4
|
kind: 'unreadable',
|
|
@@ -20,17 +21,22 @@ export const ABSENT_TARGET = {
|
|
|
20
21
|
export function absentBinary(path) {
|
|
21
22
|
return { kind: 'absent', code: 'binary-file-absent', fields: { path }, retryable: false };
|
|
22
23
|
}
|
|
24
|
+
export function declaredType(blob) {
|
|
25
|
+
return blob.type === '' ? MEDIA_TYPES.octetStream : blob.type;
|
|
26
|
+
}
|
|
27
|
+
export function blobOf(binary) {
|
|
28
|
+
return new Response(binary.stream, { headers: { 'content-type': binary.mediaType } }).blob();
|
|
29
|
+
}
|
|
23
30
|
export function binaryAnswer(result) {
|
|
24
31
|
return result.kind === 'binary' || result.kind === 'rejected' ? result : failure(result);
|
|
25
32
|
}
|
|
26
|
-
const OCTET_STREAM = 'application/octet-stream';
|
|
27
33
|
export function binaryLinkAnswer(result, held) {
|
|
28
34
|
if (result.kind === 'link') {
|
|
29
35
|
return {
|
|
30
36
|
kind: 'link',
|
|
31
37
|
url: result.url,
|
|
32
38
|
name: result.name,
|
|
33
|
-
mediaType: result.mediaType ?? held ??
|
|
39
|
+
mediaType: result.mediaType ?? held ?? MEDIA_TYPES.octetStream,
|
|
34
40
|
};
|
|
35
41
|
}
|
|
36
42
|
return result.kind === 'rejected' ? result : failure(result);
|
package/dist/overlay.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ApplyResult } from '@agentshouse/mdmodel';
|
|
2
2
|
import type { BinaryFile, HeadChange } from './adapter.js';
|
|
3
3
|
import { type Composition } from './collection.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type ChangeBatch } from './change.js';
|
|
5
5
|
export type Heads = {
|
|
6
6
|
revisions: Readonly<Record<string, string>>;
|
|
7
7
|
fileIds: Readonly<Record<string, string>>;
|
package/dist/overlay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,WAAW,EAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,WAAW,EAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAGL,KAAK,WAAW,EAGjB,MAAM,aAAa,CAAC;AAIrB,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,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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,EAAE,MAAM,CAAC,CAAC,EAC1C,WAAW,EAAE,WAAW,GACvB,MAAM,CAIR;AA8ID,wBAAiB,UAAU,CACzB,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,WAAW,EAAE,WAAW,EACxB,SAAS,CAAC,EAAE,MAAM,IAAI,GACrB,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAsChC"}
|
package/dist/overlay.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { apply, create,
|
|
1
|
+
import { apply, create, documentValue, parse, serialize, TYPE_FIELD, } from '@agentshouse/mdmodel';
|
|
2
2
|
import { definitionsAt } from './collection.js';
|
|
3
|
+
import { isPart, } from './change.js';
|
|
3
4
|
import { drafted, entriesIn, settling } from './shared.js';
|
|
4
5
|
import { ROW_WEIGHT } from './turn.js';
|
|
5
6
|
export function* acceptedBinaries(files) {
|
|
@@ -25,9 +26,6 @@ export function sameChange(left, right) {
|
|
|
25
26
|
left.author?.id === right.author?.id &&
|
|
26
27
|
left.author?.name === right.author?.name);
|
|
27
28
|
}
|
|
28
|
-
function isPart(change) {
|
|
29
|
-
return change.kind === 'field' || change.kind === 'section' || change.kind === 'preamble';
|
|
30
|
-
}
|
|
31
29
|
function at(path, name) {
|
|
32
30
|
return `${path} ${name}`;
|
|
33
31
|
}
|
|
@@ -58,7 +56,7 @@ export function composed(path, fields, sections, composition) {
|
|
|
58
56
|
const type = typeof declared === 'string' && declared !== '' ? declared : undefined;
|
|
59
57
|
const definition = definitionsAt(composition, path)(type);
|
|
60
58
|
return apply(create(type, definition), [
|
|
61
|
-
...Object.entries(fields).flatMap(([name, value]) => (name !== TYPE_FIELD || type === undefined) &&
|
|
59
|
+
...Object.entries(fields).flatMap(([name, value]) => (name !== TYPE_FIELD || type === undefined) && documentValue(value)
|
|
62
60
|
? [{ kind: 'field', name, value, prior: undefined }]
|
|
63
61
|
: []),
|
|
64
62
|
...Object.entries(sections).map(([name, value]) => ({
|
package/dist/preparation.d.ts
CHANGED
|
@@ -1,20 +1,41 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type InstallShare } from './install.js';
|
|
2
|
+
import { type ReadinessChange } from './observation.js';
|
|
2
3
|
import { type PortReach } from './reach.js';
|
|
3
|
-
import { type CodeAvailability, type ConnectionAvailability, type Readiness } from './readiness.js';
|
|
4
|
+
import { type CodeAvailability, type ConnectionAvailability, type Readiness, type RoomCoverage } from './readiness.js';
|
|
4
5
|
import type { Runtime } from './runtime.js';
|
|
5
6
|
export type ReadinessPort = {
|
|
6
7
|
readonly target: string;
|
|
7
8
|
readonly code: CodeAvailability;
|
|
8
9
|
};
|
|
10
|
+
export type ReadinessMessage = Readiness | ReadinessChange;
|
|
9
11
|
export type ReadinessWatch = {
|
|
10
12
|
readonly port: ReadinessPort;
|
|
11
13
|
readonly reach: PortReach | null;
|
|
12
|
-
readonly deliver: (readiness:
|
|
14
|
+
readonly deliver: (readiness: ReadinessMessage) => void;
|
|
15
|
+
};
|
|
16
|
+
type Share = InstallShare & {
|
|
17
|
+
readonly coverage: RoomCoverage;
|
|
18
|
+
};
|
|
19
|
+
type Totals = {
|
|
20
|
+
installing: number;
|
|
21
|
+
downloading: number;
|
|
22
|
+
acquiring: number;
|
|
23
|
+
unsettled: number;
|
|
24
|
+
done: number;
|
|
25
|
+
total: number;
|
|
26
|
+
};
|
|
27
|
+
export type ReadinessShowing = {
|
|
28
|
+
readonly listing: number;
|
|
29
|
+
readonly roomsListed: boolean;
|
|
30
|
+
readonly named: ReadonlySet<string> | null;
|
|
31
|
+
readonly rooms: Map<string, Share>;
|
|
32
|
+
readonly totals: Totals;
|
|
33
|
+
shown: string;
|
|
13
34
|
};
|
|
14
35
|
export declare function prepare(runtime: Runtime, locators?: readonly string[]): void;
|
|
15
|
-
export declare function roomsOfReach(reach: PlanReach): ReadonlySet<string>;
|
|
16
36
|
export declare function connectionNow(runtime: Runtime): Promise<ConnectionAvailability>;
|
|
17
|
-
export declare function deliverOwedReadiness(runtime: Runtime, owed: readonly ReadinessWatch[]): Promise<void>;
|
|
18
|
-
export declare function watchReadiness({ store }: Runtime, port: ReadinessPort, reach: PortReach | null, deliver: (readiness:
|
|
37
|
+
export declare function deliverOwedReadiness(runtime: Runtime, owed: readonly ReadinessWatch[], touched: ReadonlySet<string> | null): Promise<void>;
|
|
38
|
+
export declare function watchReadiness({ store }: Runtime, port: ReadinessPort, reach: PortReach | null, deliver: (readiness: ReadinessMessage) => void): () => void;
|
|
19
39
|
export declare function filled(runtime: Runtime): void;
|
|
40
|
+
export {};
|
|
20
41
|
//# sourceMappingURL=preparation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preparation.d.ts","sourceRoot":"","sources":["../src/preparation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"preparation.d.ts","sourceRoot":"","sources":["../src/preparation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAE3B,KAAK,SAAS,EAEd,KAAK,YAAY,EAElB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAK5C,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,eAAe,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG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