@agentshouse/mdruntime 0.1.0-cf281e8224a5d → 0.1.0-cf2e0e6e7cdce
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 +21 -19
- package/dist/acceptance.d.ts +0 -3
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +72 -158
- package/dist/act-lanes.d.ts +30 -0
- package/dist/act-lanes.d.ts.map +1 -0
- package/dist/act-lanes.js +225 -0
- package/dist/actions.d.ts +8 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +142 -72
- package/dist/adapter.d.ts +128 -62
- 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/binary.d.ts +4 -0
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +9 -2
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +6 -19
- package/dist/change-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -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 +17 -20
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +44 -60
- package/dist/collection.d.ts +26 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +28 -10
- 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 +2 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +17 -5
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +35 -26
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +28 -15
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +25 -14
- 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 +39 -15
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +341 -243
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts +3 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +47 -47
- package/dist/download.d.ts +6 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +42 -0
- package/dist/durability.d.ts +5 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +14 -0
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +45 -16
- package/dist/expectation.d.ts +25 -14
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +51 -20
- package/dist/failure.d.ts +3 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +8 -0
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +4 -2
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -2
- package/dist/host.d.ts +23 -4
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +84 -19
- package/dist/house-query.d.ts +15 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +43 -0
- package/dist/index.d.ts +20 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -7
- package/dist/install.d.ts +10 -6
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +92 -109
- package/dist/lifecycle.d.ts +2 -2
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +75 -53
- package/dist/listing.d.ts +29 -22
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +71 -79
- package/dist/live.d.ts +5 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +74 -31
- 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 +2 -4
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +12 -39
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +11 -23
- package/dist/media.d.ts +19 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +167 -33
- package/dist/memory.d.ts +9 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +93 -32
- package/dist/messages.d.ts +17 -6
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +34 -27
- package/dist/modal.d.ts +2 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +11 -0
- package/dist/model.d.ts +4 -3
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +6 -5
- package/dist/models.d.ts +4 -8
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +97 -139
- package/dist/observation.d.ts +29 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +206 -69
- package/dist/online.d.ts +7 -0
- package/dist/online.d.ts.map +1 -0
- package/dist/online.js +29 -0
- package/dist/opened.d.ts +1 -1
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +2 -2
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +22 -10
- package/dist/outcome.d.ts +24 -4
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +32 -2
- package/dist/overlay.d.ts +6 -2
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +37 -24
- package/dist/page-metadata.d.ts +8 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +19 -0
- package/dist/parts.d.ts +5 -59
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +32 -122
- package/dist/preparation.d.ts +33 -7
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +210 -92
- package/dist/presence.d.ts +58 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +231 -0
- package/dist/queries.d.ts +2 -2
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +85 -70
- package/dist/questions.d.ts +1 -5
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +3 -8
- package/dist/queue.d.ts +40 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +480 -0
- package/dist/reach.d.ts +15 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +177 -33
- package/dist/react.d.ts +11 -5
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +28 -5
- package/dist/readiness.d.ts +20 -4
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +17 -10
- package/dist/reads.d.ts +4 -2
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +11 -4
- package/dist/recovery.d.ts +4 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +31 -8
- package/dist/refresh.js +2 -2
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +5 -5
- package/dist/replica.d.ts +5 -11
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +14 -16
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +30 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +270 -63
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +8 -5
- 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 +9 -10
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -0
- package/dist/runtime.d.ts +11 -19
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +42 -90
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +326 -223
- package/dist/saves.d.ts +4 -40
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +164 -712
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +4 -4
- package/dist/shown.d.ts +9 -5
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +94 -60
- package/dist/socket/lanes.d.ts +12 -4
- package/dist/socket/lanes.d.ts.map +1 -1
- package/dist/socket/lanes.js +34 -8
- package/dist/socket/session.d.ts +4 -1
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket/session.js +3 -0
- package/dist/socket.d.ts +4 -6
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +4 -14
- package/dist/source.d.ts +5 -7
- 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 +21 -6
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +59 -22
- 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 +25 -15
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +50 -18
- package/dist/stored.d.ts +32 -14
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +187 -51
- package/dist/surface.d.ts +12 -6
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +66 -34
- package/dist/sync.d.ts +4 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +126 -101
- package/dist/tables.d.ts +16 -56
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +86 -327
- 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 +4 -10
- package/dist/wire.d.ts +66 -7
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +25 -9
- package/package.json +3 -2
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- package/dist/job.d.ts +0 -33
- package/dist/job.d.ts.map +0 -1
- package/dist/job.js +0 -54
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
- package/dist/socket/rooms.d.ts +0 -44
- package/dist/socket/rooms.d.ts.map +0 -1
- package/dist/socket/rooms.js +0 -90
- package/dist/store/fences.d.ts +0 -16
- package/dist/store/fences.d.ts.map +0 -1
- package/dist/store/fences.js +0 -26
package/dist/expectation.js
CHANGED
|
@@ -1,23 +1,40 @@
|
|
|
1
|
-
const
|
|
1
|
+
const NOWHERE = new Set();
|
|
2
|
+
const NOTHING = new Map();
|
|
3
|
+
export function expectation(descriptor, made) {
|
|
4
|
+
return {
|
|
5
|
+
key: made.key,
|
|
6
|
+
descriptor,
|
|
7
|
+
places: new Set(made.at.map((one) => descriptor.place(one))),
|
|
8
|
+
draw: (value) => made.draw(value),
|
|
9
|
+
shown: (value) => made.shown(value),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
2
12
|
export function expectedList(expected) {
|
|
3
13
|
if (expected === null)
|
|
4
14
|
return [];
|
|
5
15
|
return 'key' in expected ? [expected] : expected;
|
|
6
16
|
}
|
|
17
|
+
function asks(reader, one) {
|
|
18
|
+
return (reader.descriptor === one.descriptor && [...one.places].some((at) => reader.places.has(at)));
|
|
19
|
+
}
|
|
20
|
+
function shows(reader, one) {
|
|
21
|
+
return (reader.descriptor === one.descriptor &&
|
|
22
|
+
[...reader.held].some(([at, value]) => one.places.has(at) && one.shown(value)));
|
|
23
|
+
}
|
|
7
24
|
function superseded(entries, at) {
|
|
8
|
-
const key = entries[at]?.
|
|
9
|
-
return entries.slice(at + 1).some((later) => later.
|
|
25
|
+
const key = entries[at]?.one.key;
|
|
26
|
+
return entries.slice(at + 1).some((later) => later.one.key === key);
|
|
10
27
|
}
|
|
11
28
|
function unended(entries, ends) {
|
|
12
29
|
const ended = new Set();
|
|
13
30
|
const kept = [];
|
|
14
|
-
for (const
|
|
15
|
-
if (ended.has(one.
|
|
31
|
+
for (const entry of [...entries].reverse()) {
|
|
32
|
+
if (ended.has(entry.one.key))
|
|
16
33
|
continue;
|
|
17
|
-
if (ends(
|
|
18
|
-
ended.add(one.
|
|
34
|
+
if (ends(entry))
|
|
35
|
+
ended.add(entry.one.key);
|
|
19
36
|
else
|
|
20
|
-
kept.unshift(
|
|
37
|
+
kept.unshift(entry);
|
|
21
38
|
}
|
|
22
39
|
return kept;
|
|
23
40
|
}
|
|
@@ -38,14 +55,13 @@ export function expecting() {
|
|
|
38
55
|
const settle = (next) => {
|
|
39
56
|
for (const entry of next)
|
|
40
57
|
for (const [id, reader] of readers)
|
|
41
|
-
if (
|
|
58
|
+
if (asks(reader, entry.one) && shows(reader, entry.one))
|
|
42
59
|
entry.seen.add(id);
|
|
43
60
|
set(unended(next, (entry) => {
|
|
44
|
-
const asking = [...readers].filter(([, reader]) =>
|
|
61
|
+
const asking = [...readers].filter(([, reader]) => asks(reader, entry.one));
|
|
45
62
|
const seen = asking.filter(([id]) => entry.seen.has(id));
|
|
46
63
|
return (seen.length > 0 &&
|
|
47
|
-
(seen.length === asking.length ||
|
|
48
|
-
seen.some(([, reader]) => !reader.shown(entry.expectation))));
|
|
64
|
+
(seen.length === asking.length || seen.some(([, reader]) => !shows(reader, entry.one))));
|
|
49
65
|
}));
|
|
50
66
|
};
|
|
51
67
|
return {
|
|
@@ -66,19 +82,27 @@ export function expecting() {
|
|
|
66
82
|
return;
|
|
67
83
|
const keys = new Set(fresh.map((one) => one.key));
|
|
68
84
|
settle([
|
|
69
|
-
...entries.filter((
|
|
70
|
-
...fresh.map((
|
|
85
|
+
...entries.filter((entry) => entry.act !== act || !keys.has(entry.one.key)),
|
|
86
|
+
...fresh.map((one) => ({ act, one, seen: new Set() })),
|
|
71
87
|
]);
|
|
72
88
|
},
|
|
73
89
|
drop(act) {
|
|
74
|
-
set(entries.filter((
|
|
90
|
+
set(entries.filter((entry) => entry.act !== act));
|
|
75
91
|
},
|
|
76
|
-
reads(reader,
|
|
77
|
-
readers.set(reader, {
|
|
92
|
+
reads(reader, descriptor, places) {
|
|
93
|
+
readers.set(reader, {
|
|
94
|
+
descriptor,
|
|
95
|
+
places: new Set(places.map((one) => descriptor.place(one))),
|
|
96
|
+
held: readers.get(reader)?.held ?? NOTHING,
|
|
97
|
+
});
|
|
78
98
|
settle(entries);
|
|
79
99
|
},
|
|
80
|
-
heard(reader,
|
|
81
|
-
readers.set(reader, {
|
|
100
|
+
heard(reader, descriptor, held) {
|
|
101
|
+
readers.set(reader, {
|
|
102
|
+
descriptor,
|
|
103
|
+
places: readers.get(reader)?.places ?? NOWHERE,
|
|
104
|
+
held: new Map([...held].map(([place, value]) => [descriptor.place(place), value])),
|
|
105
|
+
});
|
|
82
106
|
settle(entries);
|
|
83
107
|
},
|
|
84
108
|
left(reader) {
|
|
@@ -87,6 +111,13 @@ export function expecting() {
|
|
|
87
111
|
entry.seen.delete(reader);
|
|
88
112
|
settle(entries);
|
|
89
113
|
},
|
|
90
|
-
|
|
114
|
+
draw(descriptor, place, held) {
|
|
115
|
+
const at = descriptor.place(place);
|
|
116
|
+
return entries.reduce((now, entry, index) => entry.one.descriptor === descriptor &&
|
|
117
|
+
entry.one.places.has(at) &&
|
|
118
|
+
!superseded(entries, index)
|
|
119
|
+
? entry.one.draw(now)
|
|
120
|
+
: now, held);
|
|
121
|
+
},
|
|
91
122
|
};
|
|
92
123
|
}
|
package/dist/failure.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProviderRefusal } from './adapter.js';
|
|
1
2
|
export type RuntimeError = Error & {
|
|
2
3
|
readonly code: string;
|
|
3
4
|
readonly retryable: boolean;
|
|
@@ -8,6 +9,8 @@ export type Described = {
|
|
|
8
9
|
retryable: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare function runtimeError(code: string, message?: string, retryable?: boolean): RuntimeError;
|
|
12
|
+
export declare function refusalError(refusal: ProviderRefusal): RuntimeError;
|
|
11
13
|
export declare function failed(error: unknown): RuntimeError;
|
|
14
|
+
export declare function uncaught(error: unknown): void;
|
|
12
15
|
export declare function described(error: unknown): Described;
|
|
13
16
|
//# sourceMappingURL=failure.d.ts.map
|
package/dist/failure.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"failure.d.ts","sourceRoot":"","sources":["../src/failure.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1F,MAAM,MAAM,SAAS,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAE9E,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAa,EACtB,SAAS,UAAQ,GAChB,YAAY,CAEd;AAYD,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAGnD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAGnD"}
|
|
1
|
+
{"version":3,"file":"failure.d.ts","sourceRoot":"","sources":["../src/failure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGpD,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1F,MAAM,MAAM,SAAS,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAE9E,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAa,EACtB,SAAS,UAAQ,GAChB,YAAY,CAEd;AAYD,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,YAAY,CAEnE;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAGnD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAGnD"}
|
package/dist/failure.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { refusedForSpace } from './durability.js';
|
|
1
2
|
export function runtimeError(code, message = code, retryable = false) {
|
|
2
3
|
return Object.assign(new Error(message), { code, retryable });
|
|
3
4
|
}
|
|
@@ -8,11 +9,18 @@ function coded(error) {
|
|
|
8
9
|
'retryable' in error &&
|
|
9
10
|
typeof error.retryable === 'boolean');
|
|
10
11
|
}
|
|
12
|
+
export function refusalError(refusal) {
|
|
13
|
+
return runtimeError(refusal.code, refusal.code, refusal.retryable);
|
|
14
|
+
}
|
|
11
15
|
export function failed(error) {
|
|
12
16
|
if (coded(error))
|
|
13
17
|
return error;
|
|
14
18
|
return runtimeError('runtime-failure', error instanceof Error ? error.message : String(error));
|
|
15
19
|
}
|
|
20
|
+
export function uncaught(error) {
|
|
21
|
+
if (!refusedForSpace(error))
|
|
22
|
+
reportError(error);
|
|
23
|
+
}
|
|
16
24
|
export function described(error) {
|
|
17
25
|
const { message, code, retryable } = failed(error);
|
|
18
26
|
return { message, code, retryable };
|
package/dist/figures.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file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,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAgDF,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAwIlE"}
|
package/dist/figures.js
CHANGED
|
@@ -72,8 +72,9 @@ export function createFigures(sources) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
async function tallied(rooms, since) {
|
|
75
|
+
const covered = new Set(rooms.map(({ locator }) => locator));
|
|
75
76
|
for (const locator of held.rooms.keys()) {
|
|
76
|
-
if (!
|
|
77
|
+
if (!covered.has(locator))
|
|
77
78
|
held.rooms.delete(locator);
|
|
78
79
|
}
|
|
79
80
|
const asked = rooms.filter(({ locator, key }) => held.staleRooms.has(locator) || held.rooms.get(locator)?.key !== key);
|
|
@@ -90,8 +91,9 @@ export function createFigures(sources) {
|
|
|
90
91
|
]);
|
|
91
92
|
if (kept !== held)
|
|
92
93
|
return false;
|
|
94
|
+
const byKey = new Map(asked.map((room) => [room.key, room]));
|
|
93
95
|
for (const tally of roomTallies) {
|
|
94
|
-
const room =
|
|
96
|
+
const room = byKey.get(tally.key);
|
|
95
97
|
if (room !== undefined)
|
|
96
98
|
held.rooms.set(room.locator, tally);
|
|
97
99
|
}
|
package/dist/file.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AttachRequest } from './adapter.js';
|
|
2
|
-
export declare function attachedFile(locator: string, file: File): Promise<AttachRequest>;
|
|
2
|
+
export declare function attachedFile(locator: string | null, file: File): Promise<AttachRequest>;
|
|
3
3
|
//# sourceMappingURL=file.d.ts.map
|
package/dist/file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,CAS7F"}
|
package/dist/file.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { sha256 } from './digest.js';
|
|
2
|
+
import { declaredType } from './outcome.js';
|
|
2
3
|
export async function attachedFile(locator, file) {
|
|
3
4
|
return {
|
|
4
|
-
locator,
|
|
5
|
+
...(locator === null ? {} : { locator }),
|
|
5
6
|
name: file.name,
|
|
6
|
-
mediaType: file
|
|
7
|
+
mediaType: declaredType(file),
|
|
7
8
|
byteLength: file.size,
|
|
8
9
|
sha256: await sha256(file),
|
|
9
10
|
blob: file,
|
package/dist/host.d.ts
CHANGED
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
import { type MdRuntimeOptions } from './connection.js';
|
|
2
2
|
import type { PortReach } from './reach.js';
|
|
3
|
-
import type { CodeAvailability, Persistence, Readiness } from './readiness.js';
|
|
3
|
+
import type { CodeAvailability, FirstTier, Persistence, Readiness } from './readiness.js';
|
|
4
4
|
import type { EntrySeed } from './seed.js';
|
|
5
|
+
import { type CallResult } from './outcome.js';
|
|
5
6
|
import { type RuntimePort } from './wire.js';
|
|
6
7
|
export type MdRuntimeHostOptions = MdRuntimeOptions & {
|
|
7
8
|
deploymentFacts?: unknown;
|
|
8
9
|
};
|
|
10
|
+
export type Admitted = {
|
|
11
|
+
readonly admitted: unknown;
|
|
12
|
+
} | {
|
|
13
|
+
readonly refused: CallResult;
|
|
14
|
+
};
|
|
15
|
+
export type ActionAdmission = (name: string, input: unknown) => Promise<Admitted>;
|
|
16
|
+
export type AttachOptions = {
|
|
17
|
+
readonly app: string;
|
|
18
|
+
readonly release?: string;
|
|
19
|
+
readonly reach?: PortReach;
|
|
20
|
+
readonly admission?: ActionAdmission;
|
|
21
|
+
readonly code?: CodeAvailability;
|
|
22
|
+
readonly first?: FirstTier;
|
|
23
|
+
};
|
|
9
24
|
export type AttachedPort = {
|
|
10
25
|
detach(): void;
|
|
11
26
|
narrow(reach: PortReach): void;
|
|
27
|
+
code(code: CodeAvailability): void;
|
|
12
28
|
readiness(deliver: (readiness: Readiness) => void): () => void;
|
|
13
29
|
answered(queries: readonly unknown[], done: () => void): void;
|
|
14
30
|
};
|
|
15
31
|
export type MdRuntimeHost = {
|
|
16
|
-
attach(port: RuntimePort,
|
|
32
|
+
attach(port: RuntimePort, options: AttachOptions): AttachedPort;
|
|
17
33
|
present(app: string, members: Readonly<Record<string, unknown>>): Promise<void>;
|
|
18
34
|
seed(entry: EntrySeed): void;
|
|
19
35
|
persisted(answer: Persistence): void;
|
|
@@ -22,8 +38,11 @@ export type MdRuntimeHost = {
|
|
|
22
38
|
};
|
|
23
39
|
export declare function serveMdRuntime(options: MdRuntimeHostOptions): MdRuntimeHost;
|
|
24
40
|
export { entrySeedOf, type EntrySeed } from './seed.js';
|
|
41
|
+
export type { QueriedRoom } from './adapter.js';
|
|
25
42
|
export type { PortReach, ReachedDocument } from './reach.js';
|
|
26
|
-
export type { CodeAvailability, Persistence, Space } from './readiness.js';
|
|
43
|
+
export type { CodeAvailability, FirstTier, Persistence, Space } from './readiness.js';
|
|
27
44
|
export { createRecovery, retryDelay, type Attempt, type Attempted, type AttemptOptions, type Recovery, type RecoveryOptions, } from './recovery.js';
|
|
28
|
-
export
|
|
45
|
+
export { replaces } from './observation.js';
|
|
46
|
+
export { undeclared } from './outcome.js';
|
|
47
|
+
export { wireAnswer, wireRequest, type RuntimePort, type WireAnswer, type WireRequest, } from './wire.js';
|
|
29
48
|
//# sourceMappingURL=host.d.ts.map
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources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,cAAc,EACd,UAAU,EACV,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,WAAW,CAAC"}
|
package/dist/host.js
CHANGED
|
@@ -2,9 +2,20 @@ import { queryKey } from '@agentshouse/mdmodel';
|
|
|
2
2
|
import { composeRuntime } from './connection.js';
|
|
3
3
|
import { untilAnswered } from './recovery.js';
|
|
4
4
|
import { described } from './failure.js';
|
|
5
|
+
import { observed } from './observation.js';
|
|
5
6
|
import { answeredResult } from './outcome.js';
|
|
6
|
-
import { AUTHORIZATION_ENDED,
|
|
7
|
+
import { AUTHORIZATION_ENDED, WIRE, wireRequest, } from './wire.js';
|
|
7
8
|
const NARROWED = new Set(['within', 'whole']);
|
|
9
|
+
const UNWAITED_MEMBERS = new Set(['call', 'queryHouse']);
|
|
10
|
+
const UNWAITED_TOPICS = new Set([
|
|
11
|
+
'deployment-facts',
|
|
12
|
+
'room-drafts',
|
|
13
|
+
'sync-status',
|
|
14
|
+
'connection-refusal',
|
|
15
|
+
'storage-loss',
|
|
16
|
+
'service-mode',
|
|
17
|
+
'authority-changes',
|
|
18
|
+
]);
|
|
8
19
|
function answered(md, app, writtenBy, member, input) {
|
|
9
20
|
switch (member) {
|
|
10
21
|
case 'rooms':
|
|
@@ -13,6 +24,8 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
13
24
|
return md.query(input[0]);
|
|
14
25
|
case 'search':
|
|
15
26
|
return md.search(input[0]);
|
|
27
|
+
case 'queryHouse':
|
|
28
|
+
return md.queryHouse(input[0]);
|
|
16
29
|
case 'types':
|
|
17
30
|
return md.types(input[0]);
|
|
18
31
|
case 'save':
|
|
@@ -35,14 +48,16 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
35
48
|
return md.binaryFile.part(input[0], input[1]);
|
|
36
49
|
case 'call':
|
|
37
50
|
return md.call(input[0], input[1]);
|
|
51
|
+
case 'answered':
|
|
52
|
+
return md.answered(input[0]);
|
|
38
53
|
case 'reached':
|
|
39
54
|
return md.reached(input[0], input[1], input[2]);
|
|
40
|
-
case 'log':
|
|
41
|
-
return md.log();
|
|
42
55
|
case 'cleanUp':
|
|
43
56
|
return md.cleanUp();
|
|
44
57
|
case 'unsent':
|
|
45
58
|
return md.unsent();
|
|
59
|
+
case 'sent':
|
|
60
|
+
return md.sent();
|
|
46
61
|
case 'reset':
|
|
47
62
|
return md.reset();
|
|
48
63
|
case 'readAgain':
|
|
@@ -76,17 +91,39 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
76
91
|
case 'conversation.send':
|
|
77
92
|
return md.conversation.send(input[0], input[1], input[2]);
|
|
78
93
|
case 'conversation.answer':
|
|
79
|
-
return md.conversation.answer(input[0], input[1]);
|
|
94
|
+
return md.conversation.answer(input[0], input[1], input[2]);
|
|
80
95
|
case 'conversation.interrupt':
|
|
81
|
-
return md.conversation.interrupt(input[0]);
|
|
96
|
+
return md.conversation.interrupt(input[0], input[1]);
|
|
82
97
|
case 'conversation.kill':
|
|
83
|
-
return md.conversation.kill(input[0]);
|
|
98
|
+
return md.conversation.kill(input[0], input[1]);
|
|
84
99
|
case 'conversation.delete':
|
|
85
|
-
return md.conversation.delete(input[0]);
|
|
100
|
+
return md.conversation.delete(input[0], input[1]);
|
|
101
|
+
case 'conversation.takeOut':
|
|
102
|
+
return md.conversation.takeOut(input[0], input[1], input[2]);
|
|
103
|
+
case 'conversation.decide':
|
|
104
|
+
return md.conversation.decide(input[0], input[1], input[2]);
|
|
105
|
+
case 'conversation.rename':
|
|
106
|
+
return md.conversation.rename(input[0], input[1], input[2]);
|
|
107
|
+
case 'conversation.option':
|
|
108
|
+
return md.conversation.option(input[0], input[1], input[2], input[3]);
|
|
109
|
+
case 'conversation.retry':
|
|
110
|
+
return md.conversation.retry(input[0], input[1], input[2]);
|
|
111
|
+
case 'conversation.pin':
|
|
112
|
+
return md.conversation.pin(input[0]);
|
|
113
|
+
case 'conversation.openTurn':
|
|
114
|
+
return md.conversation.openTurn(input[0], input[1]);
|
|
115
|
+
case 'conversation.dismissSuggestion':
|
|
116
|
+
return md.conversation.dismissSuggestion(input[0], input[1]);
|
|
117
|
+
case 'conversation.attach':
|
|
118
|
+
return md.conversation.attach(input[0]);
|
|
119
|
+
case 'conversation.attachment':
|
|
120
|
+
return md.conversation.attachment(input[0]);
|
|
86
121
|
case 'chatDraft.write':
|
|
87
122
|
return md.chatDraft.write(input[0], input[1], input[2]);
|
|
88
123
|
case 'chatDraft.prepend':
|
|
89
124
|
return md.chatDraft.prepend(input[0], input[1]);
|
|
125
|
+
case 'chatDraft.append':
|
|
126
|
+
return md.chatDraft.append(input[0], input[1]);
|
|
90
127
|
case 'chatDraft.discard':
|
|
91
128
|
return md.chatDraft.discard(input[0]);
|
|
92
129
|
}
|
|
@@ -102,7 +139,7 @@ function attempted(work) {
|
|
|
102
139
|
function answeredMessage(value) {
|
|
103
140
|
if (typeof value !== 'object' || value === null)
|
|
104
141
|
return false;
|
|
105
|
-
return
|
|
142
|
+
return 'result' in value ? answeredResult(value.result) : !('pending' in value);
|
|
106
143
|
}
|
|
107
144
|
export function serveMdRuntime(options) {
|
|
108
145
|
const deploymentFacts = structuredClone(options.deploymentFacts);
|
|
@@ -118,16 +155,17 @@ export function serveMdRuntime(options) {
|
|
|
118
155
|
const attachments = new Map();
|
|
119
156
|
let authorized = true;
|
|
120
157
|
let opening = null;
|
|
121
|
-
const opened = () => (opening ??= untilAnswered(() => md.loaded(), closing.signal));
|
|
158
|
+
const opened = () => (opening ??= untilAnswered(() => md.loaded(), closing.signal, () => true, options.recovery));
|
|
122
159
|
const watchFacts = (deliver) => {
|
|
123
160
|
deliver(structuredClone(deploymentFacts));
|
|
124
161
|
return () => { };
|
|
125
162
|
};
|
|
126
|
-
function attach(port,
|
|
163
|
+
function attach(port, options) {
|
|
127
164
|
if (!authorized)
|
|
128
165
|
throw new Error(AUTHORIZATION_ENDED);
|
|
166
|
+
const { app, release, reach, admission, code = 'stored', first = null } = options;
|
|
129
167
|
const writtenBy = release === undefined ? undefined : { app, release };
|
|
130
|
-
const view = runtime.within(reach ?? null, { target: app, code });
|
|
168
|
+
const view = runtime.within(reach ?? null, { target: app, code, first, inboxed: null });
|
|
131
169
|
const observations = new Map();
|
|
132
170
|
const followed = new Set();
|
|
133
171
|
const answeredKeys = new Set();
|
|
@@ -153,6 +191,7 @@ export function serveMdRuntime(options) {
|
|
|
153
191
|
observations.clear();
|
|
154
192
|
for (const end of [...followed])
|
|
155
193
|
end();
|
|
194
|
+
view.close();
|
|
156
195
|
attachments.delete(detach);
|
|
157
196
|
};
|
|
158
197
|
const observe = (id, topic, input) => {
|
|
@@ -190,6 +229,15 @@ export function serveMdRuntime(options) {
|
|
|
190
229
|
send({ kind: 'failure', id, ...described(error) });
|
|
191
230
|
}
|
|
192
231
|
};
|
|
232
|
+
const admitted = admission === undefined
|
|
233
|
+
? view.md
|
|
234
|
+
: {
|
|
235
|
+
...view.md,
|
|
236
|
+
async call(name, input) {
|
|
237
|
+
const decided = await admission(name, input);
|
|
238
|
+
return 'refused' in decided ? decided.refused : view.md.call(name, decided.admitted);
|
|
239
|
+
},
|
|
240
|
+
};
|
|
193
241
|
const serve = async (message) => {
|
|
194
242
|
if (message.kind === 'hello')
|
|
195
243
|
return;
|
|
@@ -199,10 +247,12 @@ export function serveMdRuntime(options) {
|
|
|
199
247
|
return;
|
|
200
248
|
}
|
|
201
249
|
try {
|
|
202
|
-
if (message.kind
|
|
250
|
+
if (message.kind === 'observe') {
|
|
251
|
+
if (!UNWAITED_TOPICS.has(message.topic))
|
|
252
|
+
await opened();
|
|
253
|
+
}
|
|
254
|
+
else if (!UNWAITED_MEMBERS.has(message.member))
|
|
203
255
|
await md.loaded();
|
|
204
|
-
else if (message.topic !== 'room-drafts')
|
|
205
|
-
await opened();
|
|
206
256
|
if (message.kind === 'observe') {
|
|
207
257
|
if (serving)
|
|
208
258
|
observe(message.id, message.topic, message.input);
|
|
@@ -215,13 +265,13 @@ export function serveMdRuntime(options) {
|
|
|
215
265
|
return;
|
|
216
266
|
}
|
|
217
267
|
const { id, member, input } = message;
|
|
218
|
-
const pending = attempted(() => answered(NARROWED.has(WIRE.members[member].reach) ?
|
|
268
|
+
const pending = attempted(() => answered(NARROWED.has(WIRE.members[member].reach) ? admitted : md, app, writtenBy, member, input));
|
|
219
269
|
return reply(id, member === 'query' ? input[0] : undefined, pending);
|
|
220
270
|
};
|
|
221
271
|
port.addEventListener('message', (event) => {
|
|
222
272
|
if (!serving)
|
|
223
273
|
return;
|
|
224
|
-
const message =
|
|
274
|
+
const message = wireRequest(event.data);
|
|
225
275
|
if (message === null)
|
|
226
276
|
return;
|
|
227
277
|
void serve(message);
|
|
@@ -235,6 +285,10 @@ export function serveMdRuntime(options) {
|
|
|
235
285
|
if (serving)
|
|
236
286
|
view.narrow(next);
|
|
237
287
|
},
|
|
288
|
+
code(next) {
|
|
289
|
+
if (serving)
|
|
290
|
+
view.code(next);
|
|
291
|
+
},
|
|
238
292
|
answered(queries, done) {
|
|
239
293
|
const keys = queries.map(queryKey);
|
|
240
294
|
if (keys.every((key) => answeredKeys.has(key)))
|
|
@@ -245,9 +299,17 @@ export function serveMdRuntime(options) {
|
|
|
245
299
|
readiness(deliver) {
|
|
246
300
|
if (!serving)
|
|
247
301
|
return () => { };
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
302
|
+
let shown = null;
|
|
303
|
+
const stop = view.watch('readiness', [], (message) => {
|
|
304
|
+
if (!serving)
|
|
305
|
+
return;
|
|
306
|
+
if (shown !== null) {
|
|
307
|
+
shown.receive(message);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
shown = observed(message, () => { }, 'readiness');
|
|
311
|
+
shown.observation.subscribe((value) => deliver(value));
|
|
312
|
+
deliver(shown.observation.current());
|
|
251
313
|
}, () => { });
|
|
252
314
|
const end = () => {
|
|
253
315
|
followed.delete(end);
|
|
@@ -287,3 +349,6 @@ export function serveMdRuntime(options) {
|
|
|
287
349
|
}
|
|
288
350
|
export { entrySeedOf } from './seed.js';
|
|
289
351
|
export { createRecovery, retryDelay, } from './recovery.js';
|
|
352
|
+
export { replaces } from './observation.js';
|
|
353
|
+
export { undeclared } from './outcome.js';
|
|
354
|
+
export { wireAnswer, wireRequest, } from './wire.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type DocumentQuery, type GroupQuery } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { HouseQueryGroups, HouseQueryRows, ProviderRefusal } from './adapter.js';
|
|
3
|
+
import { type Failure, type Offline } from './outcome.js';
|
|
4
|
+
import { type PortReach } from './reach.js';
|
|
5
|
+
import type { Runtime } from './runtime.js';
|
|
6
|
+
export type HouseQuery = (DocumentQuery | GroupQuery) & {
|
|
7
|
+
rooms: readonly [string];
|
|
8
|
+
};
|
|
9
|
+
export type HouseQueryResult = HouseQueryRows | HouseQueryGroups | Offline | (ProviderRefusal & {
|
|
10
|
+
kind: 'rejected';
|
|
11
|
+
}) | (ProviderRefusal & {
|
|
12
|
+
kind: 'undeclared';
|
|
13
|
+
}) | Failure;
|
|
14
|
+
export declare function queriedHouse(runtime: Runtime, input: unknown, reach: PortReach | null): Promise<HouseQueryResult>;
|
|
15
|
+
//# sourceMappingURL=house-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"house-query.d.ts","sourceRoot":"","sources":["../src/house-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,KAAK,EAEV,gBAAgB,EAChB,cAAc,EACd,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAA2C,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAEnG,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,MAAM,UAAU,GAAG,CAAC,aAAa,GAAG,UAAU,CAAC,GAAG;IAAE,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAErF,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,gBAAgB,GAChB,OAAO,GACP,CAAC,eAAe,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,GACxC,CAAC,eAAe,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,GAC1C,OAAO,CAAC;AAqBZ,wBAAsB,YAAY,CAChC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,SAAS,GAAG,IAAI,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAiB3B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { invalid, plain } from '@agentshouse/mdmodel';
|
|
2
|
+
import { listedOrHeld } from './listing.js';
|
|
3
|
+
import { failure, OFFLINE, UNCERTAIN, undeclared } from './outcome.js';
|
|
4
|
+
import { askedOnline, offline } from './online.js';
|
|
5
|
+
import { holds, queriedOnly } from './reach.js';
|
|
6
|
+
const HELD_ON_DEVICE = {
|
|
7
|
+
kind: 'rejected',
|
|
8
|
+
code: 'held-on-device',
|
|
9
|
+
fields: {},
|
|
10
|
+
retryable: false,
|
|
11
|
+
};
|
|
12
|
+
function houseQueryOf(input) {
|
|
13
|
+
if (!plain(input))
|
|
14
|
+
invalid('query', 'expects a query object');
|
|
15
|
+
const { rooms, ...query } = input;
|
|
16
|
+
if (!Array.isArray(rooms) || rooms.length !== 1 || typeof rooms[0] !== 'string')
|
|
17
|
+
invalid('rooms', 'names the one Room House answers');
|
|
18
|
+
return { room: rooms[0], query };
|
|
19
|
+
}
|
|
20
|
+
async function heldHere(runtime, reach, room) {
|
|
21
|
+
return holds(reach, room) && listedOrHeld(runtime, await runtime.store.rooms([room]), room);
|
|
22
|
+
}
|
|
23
|
+
export async function queriedHouse(runtime, input, reach) {
|
|
24
|
+
const { socket } = runtime;
|
|
25
|
+
const asked = houseQueryOf(input);
|
|
26
|
+
await socket.ready;
|
|
27
|
+
const query = socket.queryHouse();
|
|
28
|
+
if (query === undefined)
|
|
29
|
+
return undeclared('queryHouse');
|
|
30
|
+
if (!queriedOnly(reach, socket.session.now().queriesOnly, asked.room)) {
|
|
31
|
+
return (await heldHere(runtime, reach, asked.room))
|
|
32
|
+
? HELD_ON_DEVICE
|
|
33
|
+
: failure({ kind: 'room-not-readable', locator: asked.room });
|
|
34
|
+
}
|
|
35
|
+
if (await offline(runtime))
|
|
36
|
+
return OFFLINE;
|
|
37
|
+
const answer = await askedOnline(runtime, (authorization) => query(authorization, asked));
|
|
38
|
+
if (answer === null)
|
|
39
|
+
return UNCERTAIN;
|
|
40
|
+
return answer.kind === 'rows' || answer.kind === 'groups' || answer.kind === 'rejected'
|
|
41
|
+
? answer
|
|
42
|
+
: failure(answer);
|
|
43
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, AuthorityChange, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, SavedFacts, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, BootstrapPart, NotReady, HeldRoom, ListedAgent, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomChange, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, SearchAnswer, SearchAsk, ServiceMode, ServiceModeSignal, TransportUncertainty,
|
|
1
|
+
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, AuthorityChange, Authorization, BinaryCopy, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, SavedFacts, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, BootstrapPart, NotReady, HeldRoom, KeyedRequest, AgentEnvironment, ListedAgent, ListedConversation, ListedOwner, ListedSpaceRef, RoomList, RoomListEntry, SpaceListEntry, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomChange, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, HouseQueryAnswer, HouseQueryAsk, HouseQueryGroups, HouseQueryRows, SearchAnswer, SearchAsk, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnOperation, TypedPath, TypedSelection, } from './adapter.js';
|
|
2
2
|
export type { Change, ChangeBatch, Precondition, RoomMove, WrittenBy } from './change.js';
|
|
3
3
|
export { heldFacts } from './conversation-row.js';
|
|
4
4
|
export type { ConversationAsk, ConversationHeld, ConversationLast, ConversationStart, } from './conversation-row.js';
|
|
5
|
-
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
5
|
+
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationState, ConversationSurface, ConversationView, RequestDecision, RunningTurn, } from './conversation.js';
|
|
6
6
|
export type { MdRuntimeOptions } from './connection.js';
|
|
7
|
+
export { PAGE_METADATA_WORDS } from './page-metadata.js';
|
|
8
|
+
export { writeRule, type WriteRefusal } from './declaration.js';
|
|
7
9
|
export type { HistoryQuery } from './actions.js';
|
|
8
10
|
export type { AppRoom, AppTypedSelection } from './listing.js';
|
|
9
11
|
export type { ConnectionRefusal, ConnectionRefusalCode } from './socket.js';
|
|
@@ -13,28 +15,35 @@ export type { Observation } from './observation.js';
|
|
|
13
15
|
export type { DayFigures, Figures, FiguresResult, RoomFigures } from './figures.js';
|
|
14
16
|
export type { HeldApp, Holdings, RoomDocuments } from './holdings.js';
|
|
15
17
|
export type { PresentationSurface, RoomDraftSurface } from './room-drafts.js';
|
|
16
|
-
export type { AttachAnswer, BinaryAnswer, BinaryLinkAnswer, CallResult, DownloadAnswer, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
|
|
18
|
+
export type { AttachAnswer, BinaryAnswer, BinaryLinkAnswer, CallResult, ShownAnswer, ConversationAttachAnswer, DownloadAnswer, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
|
|
19
|
+
export { blobOf, declaredType } from './outcome.js';
|
|
17
20
|
export type { BinaryFileRecord } from './binary.js';
|
|
18
21
|
export type { RuntimeError } from './failure.js';
|
|
19
|
-
export
|
|
22
|
+
export { refusalError } from './failure.js';
|
|
23
|
+
export type { ChangedPart, FieldValue, Marks, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
|
|
20
24
|
export type { SaveRefusal } from './save.js';
|
|
21
25
|
export type { SearchFound, SearchHit, SearchRequest, SearchResult } from './search.js';
|
|
22
|
-
export {
|
|
26
|
+
export type { HouseQuery, HouseQueryResult } from './house-query.js';
|
|
27
|
+
export { keptFile, keptLines } from './chat-types.js';
|
|
23
28
|
export { FIGURES_DAY_MS } from './figures.js';
|
|
24
29
|
export { departure } from './change.js';
|
|
30
|
+
export { definitionsIn, selected } from './collection.js';
|
|
25
31
|
export { lineEnded, partsAfter, partsChanges } from './room-draft.js';
|
|
26
32
|
export { cutName, nameFrom, transliterated } from './name.js';
|
|
27
|
-
export { HISTORY_CONVERSATIONS,
|
|
33
|
+
export { HISTORY_CONVERSATIONS, newChat } from './conversation.js';
|
|
28
34
|
export { contextFigure } from './context.js';
|
|
29
|
-
export {
|
|
35
|
+
export { runningWords } from './running.js';
|
|
36
|
+
export { turnLine, WORKING } from './parts.js';
|
|
30
37
|
export { changeBatchIdentity } from './identity.js';
|
|
31
38
|
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
32
|
-
export { authoredAt } from './paths.js';
|
|
39
|
+
export { authoredAt, covered } from './paths.js';
|
|
33
40
|
export { untilAnswered } from './recovery.js';
|
|
34
|
-
export {
|
|
35
|
-
export {
|
|
36
|
-
export {
|
|
41
|
+
export { createRetries, STEPS, retrying, Unanswered, uncertainError, type RetriedFailure, type Retries, type Step, } from './retried.js';
|
|
42
|
+
export { patching } from './shared.js';
|
|
43
|
+
export { acting, type Acting, type ActingRules, type Ended, type Lane, type LaneShown, type Send, } from './act-lanes.js';
|
|
44
|
+
export { expectation, expecting, type Descriptor, type Expectation, type Expected, type Expecting, } from './expectation.js';
|
|
37
45
|
export type { AppCode, HeldCode, RuntimeShell, UnsentKind, UnsentWork } from './durability.js';
|
|
46
|
+
export { leftToSend } from './durability.js';
|
|
38
47
|
export type { CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Installation, InstallationAmount, InstallationStep, Persistence, Readiness, ReadinessStatus, RoomCoverage, RoomPreparation, Space, TargetCoverage, } from './readiness.js';
|
|
39
48
|
export type { ObservedRead } from './reads.js';
|
|
40
49
|
export type { AttentionEntry, SyncStatus } from './status.js';
|