@agentshouse/mdruntime 0.1.0-cefb421089d74 → 0.1.0-cefb45338245d
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 +1 -1
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +34 -5
- package/dist/adapter.d.ts +27 -8
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +2 -2
- package/dist/authored.d.ts.map +1 -1
- package/dist/authored.js +2 -0
- package/dist/binary.d.ts +2 -2
- package/dist/binary.js +1 -1
- package/dist/chain.d.ts +1 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +5 -2
- package/dist/change.d.ts +2 -2
- package/dist/chat-types.js +2 -2
- package/dist/client.d.ts +7 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +11 -10
- package/dist/collection.d.ts +1 -0
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +7 -1
- package/dist/compile.d.ts +2 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +70 -38
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +2 -0
- package/dist/conversation.d.ts +8 -2
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +5 -3
- package/dist/declaration.js +1 -1
- package/dist/entry.d.ts +10 -3
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +52 -24
- package/dist/host.d.ts +1 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +28 -17
- package/dist/house-query.d.ts +11 -2
- package/dist/house-query.d.ts.map +1 -1
- package/dist/house-query.js +65 -6
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/live.d.ts +14 -0
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +29 -12
- package/dist/loaded.d.ts +5 -3
- package/dist/loaded.d.ts.map +1 -1
- package/dist/loaded.js +12 -6
- package/dist/media.js +3 -3
- package/dist/memory.d.ts +2 -2
- package/dist/memory.js +5 -5
- package/dist/name.d.ts +0 -1
- package/dist/name.d.ts.map +1 -1
- package/dist/name.js +3 -7
- package/dist/outcome.js +1 -1
- package/dist/overlay.d.ts +3 -3
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +54 -11
- package/dist/query.d.ts +2 -2
- package/dist/reach.d.ts +1 -1
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +10 -10
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +2 -1
- package/dist/reference-forms.d.ts +4 -0
- package/dist/reference-forms.d.ts.map +1 -0
- package/dist/reference-forms.js +74 -0
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.js +4 -4
- package/dist/replica.js +2 -2
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +5 -2
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +6 -4
- package/dist/rows.d.ts +9 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +18 -4
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +6 -6
- package/dist/saves.d.ts +2 -2
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +14 -8
- package/dist/source.d.ts +2 -0
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +2 -0
- package/dist/store/records.d.ts +4 -2
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +8 -2
- package/dist/stored.d.ts +7 -0
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +33 -11
- package/dist/surface.d.ts +4 -4
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +5 -5
- package/dist/sync.js +1 -1
- package/dist/tables.d.ts +14 -2
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +10 -3
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +49 -3
- package/dist/wire.d.ts +6 -6
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +6 -6
- package/package.json +3 -3
package/dist/compile.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare function within(alias: string, path: string): Fragment;
|
|
|
13
13
|
export type QueryAnswer = QueryRows & {
|
|
14
14
|
readonly more?: string;
|
|
15
15
|
};
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function namedHandles(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], handles: readonly string[]): readonly string[];
|
|
17
|
+
export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null, follows?: readonly QueryRoom[]): QueryAnswer;
|
|
17
18
|
export {};
|
|
18
19
|
//# sourceMappingURL=compile.d.ts.map
|
package/dist/compile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,GAAG,EAQJ,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAAE,IAAI,EAAuC,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,GAAG,EAQJ,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAAE,IAAI,EAAuC,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvF,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAG1D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;CACpC,CAAC;AAEF,KAAK,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAI7B,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,MAAyD,CAAC;AAsBlG,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAE5D;AAsfD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAkajE,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,SAAS,MAAM,EAAE,CAenB;AAED,wBAAgB,WAAW,CACzB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,MAAM,GAAE,MAAM,GAAG,IAAW,EAC5B,OAAO,GAAE,SAAS,SAAS,EAAO,GACjC,WAAW,CAUb"}
|
package/dist/compile.js
CHANGED
|
@@ -2,19 +2,23 @@ import { ARRAY_INDEX, bodied, byCodePoint, compared, cursorOf, heldKind, parse,
|
|
|
2
2
|
import { binaryRecord } from './binary.js';
|
|
3
3
|
import { definitionsAt, UNTYPED } from './collection.js';
|
|
4
4
|
import { documentKey, pathOfKey, roomOfKey } from './rows.js';
|
|
5
|
+
import { ROOM_HANDLE } from './stored.js';
|
|
5
6
|
import { FROM_START, MAXIMUM_WINDOW } from './windows.js';
|
|
6
7
|
const { all, any, exists, fragment, grouped, joined, listed } = sql;
|
|
7
8
|
export const VISIBLE = (alias) => `${alias}.visible = 1 AND ${alias}.present = 1`;
|
|
8
9
|
function located(alias) {
|
|
9
10
|
return fragment(`(SELECT k.locator FROM replica_keys k WHERE k.key = ${alias}.key)`);
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
return fragment(`(${
|
|
13
|
-
|
|
14
|
-
`${
|
|
15
|
-
`${
|
|
12
|
+
function inside(path, directory) {
|
|
13
|
+
return fragment(`(${path} = ? OR (${path} >= ? AND ${path} < ?))`, [
|
|
14
|
+
directory,
|
|
15
|
+
`${directory}/`,
|
|
16
|
+
`${directory}0`,
|
|
16
17
|
]);
|
|
17
18
|
}
|
|
19
|
+
export function within(alias, path) {
|
|
20
|
+
return inside(`${alias}.path`, path);
|
|
21
|
+
}
|
|
18
22
|
function ancestors(area) {
|
|
19
23
|
const depth = area.path.split('/').length;
|
|
20
24
|
return area.open.flatMap((open) => {
|
|
@@ -22,18 +26,18 @@ function ancestors(area) {
|
|
|
22
26
|
return segments.slice(depth - 1, -1).map((_, at) => segments.slice(0, depth + at).join('/'));
|
|
23
27
|
});
|
|
24
28
|
}
|
|
25
|
-
function fenced(
|
|
29
|
+
function fenced(key, path, held, area, folders) {
|
|
26
30
|
const opened = any([
|
|
27
|
-
...area.open.map((open) =>
|
|
28
|
-
...(folders ? ancestors(area).map((
|
|
31
|
+
...area.open.map((open) => inside(path, open)),
|
|
32
|
+
...(folders ? ancestors(area).map((ancestor) => fragment(`${path} = ?`, [ancestor])) : []),
|
|
29
33
|
]);
|
|
30
34
|
return all([
|
|
31
|
-
fragment(`${
|
|
32
|
-
|
|
35
|
+
fragment(`${key} = ?`, [held]),
|
|
36
|
+
inside(path, area.path),
|
|
33
37
|
fragment(`NOT ${grouped(opened).sql}`, opened.bind),
|
|
34
38
|
]);
|
|
35
39
|
}
|
|
36
|
-
function reached(bound,
|
|
40
|
+
function reached(bound, key, path) {
|
|
37
41
|
const reach = bound.reach;
|
|
38
42
|
if (reach === null)
|
|
39
43
|
return fragment('1');
|
|
@@ -46,49 +50,65 @@ function reached(bound, alias) {
|
|
|
46
50
|
return key === undefined ? [] : [[key, pathOfKey(held)]];
|
|
47
51
|
});
|
|
48
52
|
const outside = any(reach.areas.flatMap((area) => {
|
|
49
|
-
const
|
|
50
|
-
return
|
|
53
|
+
const held = bound.keys.get(area.room);
|
|
54
|
+
return held === undefined ? [] : [fenced(key, path, held, area, false)];
|
|
51
55
|
}));
|
|
52
56
|
return all([
|
|
53
57
|
any([
|
|
54
|
-
...(rooms.length === 0 ? [] : [fragment(`${
|
|
58
|
+
...(rooms.length === 0 ? [] : [fragment(`${key} IN ${listed(rooms).sql}`, rooms)]),
|
|
55
59
|
...(documents.length === 0
|
|
56
60
|
? []
|
|
57
61
|
: [
|
|
58
|
-
fragment(`EXISTS (SELECT 1 FROM json_each(?) j WHERE j.value ->> 0 = ${
|
|
62
|
+
fragment(`EXISTS (SELECT 1 FROM json_each(?) j WHERE j.value ->> 0 = ${key} AND j.value ->> 1 = ${path})`, [JSON.stringify(documents)]),
|
|
59
63
|
]),
|
|
60
64
|
]),
|
|
61
65
|
...(reach.areas.length === 0 ? [] : [fragment(`NOT ${grouped(outside).sql}`, outside.bind)]),
|
|
62
66
|
]);
|
|
63
67
|
}
|
|
68
|
+
function handled(bound, link) {
|
|
69
|
+
return fragment(`FROM replica_rooms h WHERE ${ROOM_HANDLE('h')} = ${link}.handle AND h.key IN (SELECT value FROM json_each(?))`, [bound.follows]);
|
|
70
|
+
}
|
|
71
|
+
function followed(bound) {
|
|
72
|
+
return {
|
|
73
|
+
targets: (link, document) => {
|
|
74
|
+
const room = handled(bound, link);
|
|
75
|
+
return joined([
|
|
76
|
+
fragment(`replica_entries ${document} ON ${document}.key = CASE WHEN ${link}.handle IS NULL THEN d.key ELSE (SELECT h.key ${room.sql}) END AND ${document}.path = ${link}.target AND ${VISIBLE(document)} AND`, room.bind),
|
|
77
|
+
grouped(reached(bound, `${document}.key`, `${document}.path`)),
|
|
78
|
+
], ' ');
|
|
79
|
+
},
|
|
80
|
+
unfollowed: (link) => {
|
|
81
|
+
const own = reached(bound, 'd.key', `${link}.target`);
|
|
82
|
+
const room = handled(bound, link);
|
|
83
|
+
const other = reached(bound, 'h.key', `${link}.target`);
|
|
84
|
+
return fragment(`NOT ((${link}.handle IS NULL AND ${own.sql}) OR EXISTS (SELECT 1 ${room.sql} AND ${other.sql}))`, [...own.bind, ...room.bind, ...other.bind]);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
64
88
|
function related(bound, plan) {
|
|
65
89
|
const parts = [];
|
|
66
|
-
if (plan.hop !== null)
|
|
67
|
-
parts.push(
|
|
68
|
-
fragment(`SELECT 1 FROM replica_links l JOIN replica_entries m ON m.key = d.key AND m.path = l.target AND ${VISIBLE('m')} WHERE l.doc = d.id AND l.kind = 'field' AND`),
|
|
69
|
-
grouped(sql.placed('l', plan.hop.field, 'link')),
|
|
70
|
-
fragment('AND'),
|
|
71
|
-
grouped(all([sql.scoped('m', plan.hop), reached(bound, 'm')])),
|
|
72
|
-
], ' ')));
|
|
73
|
-
}
|
|
90
|
+
if (plan.hop !== null)
|
|
91
|
+
parts.push(sql.hopped('d', plan.hop, followed(bound)));
|
|
74
92
|
if (plan.backlinks !== null) {
|
|
75
93
|
const field = plan.backlinks.field;
|
|
76
94
|
parts.push(exists(joined([
|
|
77
|
-
fragment(`SELECT 1 FROM replica_links l JOIN replica_entries s ON s.id = l.doc AND ${VISIBLE('s')} WHERE l.key = d.key AND l.target = d.path AND l.kind = 'field' AND`),
|
|
95
|
+
fragment(`SELECT 1 FROM replica_links l JOIN replica_entries s ON s.id = l.doc AND ${VISIBLE('s')} WHERE l.key = d.key AND l.handle IS NULL AND l.target = d.path AND l.kind = 'field' AND`),
|
|
78
96
|
...(field === null ? [] : [grouped(sql.placed('l', field, 'link')), fragment('AND')]),
|
|
79
|
-
grouped(all([sql.scoped('s', plan.backlinks), reached(bound, 's')])),
|
|
97
|
+
grouped(all([sql.scoped('s', plan.backlinks), reached(bound, 's.key', 's.path')])),
|
|
80
98
|
], ' ')));
|
|
81
99
|
}
|
|
82
100
|
return parts;
|
|
83
101
|
}
|
|
84
|
-
function
|
|
102
|
+
function tested(bound, plan) {
|
|
85
103
|
const keys = bound.rooms.map(({ key }) => key);
|
|
86
|
-
return
|
|
104
|
+
return [
|
|
87
105
|
fragment(`d.key IN ${listed(keys).sql} AND ${VISIBLE('d')}`, keys),
|
|
88
|
-
reached(bound, 'd'),
|
|
106
|
+
reached(bound, 'd.key', 'd.path'),
|
|
89
107
|
sql.tests('d', plan),
|
|
90
|
-
|
|
91
|
-
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
function filtered(bound, plan) {
|
|
111
|
+
return all([...tested(bound, plan), ...related(bound, plan)]);
|
|
92
112
|
}
|
|
93
113
|
function orderingOf(options) {
|
|
94
114
|
const stringSort = options.stringSort ?? 'locale';
|
|
@@ -334,7 +354,7 @@ function documentOf(shape, queried, row, linked) {
|
|
|
334
354
|
...(binary === null
|
|
335
355
|
? {}
|
|
336
356
|
: {
|
|
337
|
-
|
|
357
|
+
attachment: binaryRecord(path, binary, revision ?? undefined),
|
|
338
358
|
}),
|
|
339
359
|
...(shape.markdown && content !== null ? { markdown: content } : {}),
|
|
340
360
|
...(shape.change ? { change: changeOf(row) } : {}),
|
|
@@ -388,10 +408,10 @@ function backlinksOf(connection, bound, rows) {
|
|
|
388
408
|
held.push(row.path);
|
|
389
409
|
byKey.set(key, held);
|
|
390
410
|
}
|
|
391
|
-
const reach = reached(bound, 's');
|
|
411
|
+
const reach = reached(bound, 's.key', 's.path');
|
|
392
412
|
for (const [key, targets] of byKey) {
|
|
393
413
|
const room = bound.rooms.find((one) => one.key === key).locator;
|
|
394
|
-
const found = connection.rows(`SELECT target, path, type, field FROM (SELECT l.target, s.path, s.type, l.field, ROW_NUMBER() OVER (PARTITION BY l.target ORDER BY s.path, l.field) AS rank FROM (SELECT DISTINCT doc, target, field FROM replica_links WHERE key = ? AND kind = 'field' AND target IN (SELECT value FROM json_each(?))) l JOIN replica_entries s ON s.id = l.doc AND ${VISIBLE('s')} WHERE ${reach.sql}) WHERE rank <= ? ORDER BY target, path, field`, [key, JSON.stringify(targets), ...reach.bind, MAXIMUM_WINDOW]);
|
|
414
|
+
const found = connection.rows(`SELECT target, path, type, field FROM (SELECT l.target, s.path, s.type, l.field, ROW_NUMBER() OVER (PARTITION BY l.target ORDER BY s.path, l.field) AS rank FROM (SELECT DISTINCT doc, target, field FROM replica_links WHERE key = ? AND kind = 'field' AND handle IS NULL AND target IN (SELECT value FROM json_each(?))) l JOIN replica_entries s ON s.id = l.doc AND ${VISIBLE('s')} WHERE ${reach.sql}) WHERE rank <= ? ORDER BY target, path, field`, [key, JSON.stringify(targets), ...reach.bind, MAXIMUM_WINDOW]);
|
|
395
415
|
for (const row of found) {
|
|
396
416
|
const at = documentKey(room, row.target);
|
|
397
417
|
const held = linked.get(at) ?? [];
|
|
@@ -506,7 +526,7 @@ function storedFolders(bound, plan, subfolder) {
|
|
|
506
526
|
const key = bound.keys.get(area.room);
|
|
507
527
|
if (key === undefined)
|
|
508
528
|
return [];
|
|
509
|
-
const fence = fenced('f', key, area, true);
|
|
529
|
+
const fence = fenced('f.key', 'f.path', key, area, true);
|
|
510
530
|
return [fragment(`NOT ${grouped(fence).sql}`, fence.bind)];
|
|
511
531
|
});
|
|
512
532
|
const under = prefix === ''
|
|
@@ -702,16 +722,28 @@ function groups(connection, bound, plan, shape) {
|
|
|
702
722
|
...(total === undefined ? {} : { total }),
|
|
703
723
|
};
|
|
704
724
|
}
|
|
705
|
-
function boundOf(connection, plan, rooms) {
|
|
725
|
+
function boundOf(connection, plan, rooms, follows) {
|
|
706
726
|
return {
|
|
707
727
|
rooms: [...rooms].sort((left, right) => left.locator < right.locator ? -1 : left.locator > right.locator ? 1 : 0),
|
|
708
|
-
keys: new Map(rooms.map(({ locator, key }) => [locator, key])),
|
|
728
|
+
keys: new Map([...rooms, ...follows].map(({ locator, key }) => [locator, key])),
|
|
729
|
+
follows: JSON.stringify(follows.map(({ key }) => key)),
|
|
709
730
|
reach: plan.reach,
|
|
710
731
|
collate: collating(connection),
|
|
711
732
|
};
|
|
712
733
|
}
|
|
713
|
-
export function
|
|
714
|
-
|
|
734
|
+
export function namedHandles(connection, plan, rooms, handles) {
|
|
735
|
+
if (plan.hop === null)
|
|
736
|
+
return [];
|
|
737
|
+
const statement = joined([
|
|
738
|
+
fragment("SELECT DISTINCT l.handle FROM replica_entries d JOIN replica_links l ON l.doc = d.id AND l.kind = 'field' AND l.handle IN (SELECT value FROM json_each(?)) AND ", [JSON.stringify(handles)]),
|
|
739
|
+
grouped(sql.placed('l', plan.hop.field, 'link')),
|
|
740
|
+
fragment(' WHERE '),
|
|
741
|
+
all(tested(boundOf(connection, plan, rooms, []), plan)),
|
|
742
|
+
], '');
|
|
743
|
+
return connection.rows(statement.sql, statement.bind).map((row) => row.handle);
|
|
744
|
+
}
|
|
745
|
+
export function answerQuery(connection, plan, rooms, budget = null, follows = []) {
|
|
746
|
+
const bound = boundOf(connection, plan, rooms, follows);
|
|
715
747
|
if (rooms.length === 0) {
|
|
716
748
|
return plan.shape.kind === 'groups'
|
|
717
749
|
? { groups: [], ...(plan.total ? { total: 0 } : {}) }
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAI/E,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAUrE,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAK9D,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAGrE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAIF,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAI/E,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAUrE,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAK9D,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAGrE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAIF,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAwGzE"}
|
package/dist/connection.js
CHANGED
|
@@ -74,6 +74,8 @@ export function composeRuntime(options) {
|
|
|
74
74
|
roomTypes,
|
|
75
75
|
builtIn,
|
|
76
76
|
typedPaths,
|
|
77
|
+
renamedActions: adapter.renamedActions ?? new Map(),
|
|
78
|
+
rewrittenInputs: adapter.rewrittenInputs ?? new Map(),
|
|
77
79
|
writeRule: (declaration) => writeRule(declaration, adapter.pathRule ?? (() => true), adapter.localSaves === true),
|
|
78
80
|
build: options.build ?? '',
|
|
79
81
|
conversations: createLiveConversations({
|
package/dist/conversation.d.ts
CHANGED
|
@@ -18,10 +18,12 @@ export type ConversationEntry = ConversationHeld & {
|
|
|
18
18
|
};
|
|
19
19
|
name: string;
|
|
20
20
|
created: string;
|
|
21
|
-
finished: string | null;
|
|
22
21
|
outcome: string | null;
|
|
23
22
|
waiting: boolean;
|
|
24
23
|
subject: string | null;
|
|
24
|
+
room: string | null;
|
|
25
|
+
model: string | null;
|
|
26
|
+
effort: string | null;
|
|
25
27
|
state: ConversationState;
|
|
26
28
|
started: string | null;
|
|
27
29
|
line: string | null;
|
|
@@ -90,7 +92,7 @@ export type ConversationSurface = {
|
|
|
90
92
|
takeOut(conversation: string, message: string, operation: string): Promise<CallResult>;
|
|
91
93
|
decide(request: ChatRequest, decision: RequestDecision, operation: string): Promise<CallResult>;
|
|
92
94
|
rename(conversation: string, name: string, operation: string): Promise<CallResult>;
|
|
93
|
-
|
|
95
|
+
set(conversation: string, settings: ConversationSettings, operation: string): Promise<CallResult>;
|
|
94
96
|
retry(conversation: string, message: string, operation: string): Promise<CallResult>;
|
|
95
97
|
pin(figures: readonly string[]): Promise<void>;
|
|
96
98
|
openTurn(conversation: string, turn: string): Promise<void>;
|
|
@@ -103,6 +105,10 @@ export type ConversationAnswer = {
|
|
|
103
105
|
interaction_id: string;
|
|
104
106
|
response: unknown;
|
|
105
107
|
};
|
|
108
|
+
export type ConversationSettings = {
|
|
109
|
+
readonly model?: string;
|
|
110
|
+
readonly effort?: string;
|
|
111
|
+
};
|
|
106
112
|
export type ChatDraftSurface = {
|
|
107
113
|
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
108
114
|
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../src/conversation.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK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,CAIZ;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,KAAK,IAAI,GACtD,MAAM,IAAI,CAIZ;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,KAAK,IAAI,GAChD,MAAM,IAAI,CAIZ;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAEnF;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAgCjG"}
|
package/dist/conversation.js
CHANGED
|
@@ -329,10 +329,12 @@ async function entries(alive) {
|
|
|
329
329
|
agent: { identity: agent.id, name: agent.name, retired: agent.retired_at !== null },
|
|
330
330
|
name: entry.name,
|
|
331
331
|
created: entry.created,
|
|
332
|
-
finished: entry.finished,
|
|
333
332
|
outcome: entry.outcome,
|
|
334
333
|
waiting: entry.waiting,
|
|
335
334
|
subject: entry.subject,
|
|
335
|
+
room: entry.room,
|
|
336
|
+
model: entry.model,
|
|
337
|
+
effort: entry.effort,
|
|
336
338
|
...rowOf(alive, entry.conversation),
|
|
337
339
|
...heldFacts(rows.get(entry.conversation), entry),
|
|
338
340
|
jobs: standing(alive.liveOf(entry.conversation), rows.get(entry.conversation)?.saved ?? null, entry.processEnded)?.running ?? [],
|
|
@@ -1034,8 +1036,8 @@ export function conversationSurface(alive, files) {
|
|
|
1034
1036
|
rename(conversation, name, operation) {
|
|
1035
1037
|
return invoke(alive, 'conversations/rename', conversation, operation, { name });
|
|
1036
1038
|
},
|
|
1037
|
-
|
|
1038
|
-
return invoke(alive, 'conversations/
|
|
1039
|
+
set(conversation, settings, operation) {
|
|
1040
|
+
return invoke(alive, 'conversations/set', conversation, operation, settings);
|
|
1039
1041
|
},
|
|
1040
1042
|
retry(conversation, message, operation) {
|
|
1041
1043
|
return invoke(alive, 'conversations/retry', conversation, operation, {
|
package/dist/declaration.js
CHANGED
|
@@ -8,7 +8,7 @@ export function sameDeclaration(left, right) {
|
|
|
8
8
|
}
|
|
9
9
|
export function writeRule({ operations, providerOwnedPaths, authoredPaths, }, pathRule, local) {
|
|
10
10
|
return (path, needs) => {
|
|
11
|
-
const normalized = normalize(path);
|
|
11
|
+
const normalized = normalize(path.normalize('NFC'));
|
|
12
12
|
if (normalized === null || normalized === '')
|
|
13
13
|
return { code: 'room-root', path };
|
|
14
14
|
if (covered(providerOwnedPaths, normalized) || !authoredAt(authoredPaths, normalized)) {
|
package/dist/entry.d.ts
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { type VerifiedModel } from '@agentshouse/mdmodel';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Attachment, HeadChange } from './adapter.js';
|
|
3
3
|
import { type QueryRows } from './query.js';
|
|
4
4
|
import { type ValuedEntry } from './stored.js';
|
|
5
5
|
import type { Connection } from './tables.js';
|
|
6
6
|
export { QueryError } from '@agentshouse/mdmodel';
|
|
7
7
|
export { documentKey, pathOfKey } from './rows.js';
|
|
8
8
|
export type { ValuedEntry } from './stored.js';
|
|
9
|
+
export type EntryArea = {
|
|
10
|
+
readonly path: string;
|
|
11
|
+
readonly open: readonly string[];
|
|
12
|
+
};
|
|
9
13
|
export type EntryRoom = {
|
|
10
14
|
locator: string;
|
|
15
|
+
handle?: string;
|
|
16
|
+
readable?: readonly string[];
|
|
17
|
+
areas?: readonly EntryArea[];
|
|
11
18
|
schema: string | null;
|
|
12
19
|
documents: Readonly<Record<string, string>>;
|
|
13
20
|
revisions?: Readonly<Record<string, string>>;
|
|
14
21
|
fileIds?: Readonly<Record<string, string>>;
|
|
15
22
|
created?: Readonly<Record<string, string>>;
|
|
16
23
|
changes?: Readonly<Record<string, HeadChange>>;
|
|
17
|
-
|
|
24
|
+
attachments?: Readonly<Record<string, Attachment>>;
|
|
18
25
|
};
|
|
19
26
|
export type EntryArguments = Readonly<Record<string, string>>;
|
|
20
27
|
export type EntryParameterKind = 'string' | 'integer' | 'number' | 'boolean';
|
|
@@ -29,6 +36,6 @@ export type CountedRoom = {
|
|
|
29
36
|
schema: string | null;
|
|
30
37
|
documents: readonly ValuedEntry[];
|
|
31
38
|
};
|
|
32
|
-
export declare function entryScope(rooms: readonly EntryRoom[], roomTypes: VerifiedModel, connection: Connection): EntryScope;
|
|
39
|
+
export declare function entryScope(rooms: readonly EntryRoom[], roomTypes: VerifiedModel, connection: Connection, followed?: readonly EntryRoom[]): EntryScope;
|
|
33
40
|
export declare function countScope(room: CountedRoom, roomTypes: VerifiedModel, connection: Connection): EntryScope;
|
|
34
41
|
//# sourceMappingURL=entry.d.ts.map
|
package/dist/entry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI3D,OAAO,
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI3D,OAAO,EAAyC,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAEnF,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,W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AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAMpE;AAyCD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAQ7D;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;CACzF,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,SAAS,WAAW,EAAE,CAAC;CACnC,CAAC;AA2IF,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,UAAU,EACtB,QAAQ,GAAE,SAAS,SAAS,EAAO,GAClC,UAAU,CAOZ;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,UAAU,GACrB,UAAU,CAaZ"}
|
package/dist/entry.js
CHANGED
|
@@ -2,7 +2,7 @@ import { invalid, plain, QueryError, } from '@agentshouse/mdmodel';
|
|
|
2
2
|
import { attachedModel } from './attached-model.js';
|
|
3
3
|
import { answerQuery } from './compile.js';
|
|
4
4
|
import { planWithin } from './query.js';
|
|
5
|
-
import { writtenFacts } from './rows.js';
|
|
5
|
+
import { documentKey, writtenFacts } from './rows.js';
|
|
6
6
|
import { entered, enteredValues, REPLICA_TABLES, } from './stored.js';
|
|
7
7
|
export { QueryError } from '@agentshouse/mdmodel';
|
|
8
8
|
export { documentKey, pathOfKey } from './rows.js';
|
|
@@ -101,8 +101,8 @@ function sampled(template, key) {
|
|
|
101
101
|
}
|
|
102
102
|
return template;
|
|
103
103
|
}
|
|
104
|
-
function entryPlan(query, facts) {
|
|
105
|
-
const plan = planWithin(query, facts);
|
|
104
|
+
function entryPlan(query, facts, reach = null) {
|
|
105
|
+
const plan = planWithin(query, facts, reach);
|
|
106
106
|
if (plan.fileIds !== null)
|
|
107
107
|
invalid('fileIds', 'an entry Room holds no file IDs');
|
|
108
108
|
return plan;
|
|
@@ -118,38 +118,63 @@ export function entryRefusal(template) {
|
|
|
118
118
|
throw error;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
function enteredRoom(room, roomTypes, connection) {
|
|
122
|
+
const model = attachedModel({
|
|
123
|
+
kind: 'model',
|
|
124
|
+
snapshot: { identity: room.locator, version: '', schema: room.schema, revision: null },
|
|
125
|
+
}, roomTypes);
|
|
126
|
+
const composition = { model, selection: null, typedPaths: [] };
|
|
127
|
+
const key = room.enter(composition);
|
|
128
|
+
if (room.handle !== undefined)
|
|
129
|
+
connection.run("INSERT INTO replica_rooms (locator, key, record) VALUES (?, ?, json_object('declaration', json_object('handle', ?)))", [room.locator, key, room.handle]);
|
|
130
|
+
return {
|
|
131
|
+
locator: room.locator,
|
|
132
|
+
key,
|
|
133
|
+
composition,
|
|
134
|
+
...(room.handle === undefined ? {} : { handle: room.handle }),
|
|
135
|
+
facts: {
|
|
131
136
|
locator: room.locator,
|
|
132
137
|
available: model.status !== 'unavailable',
|
|
133
138
|
types: model.status === 'unavailable' ? [] : Object.values(model.types),
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function reachOf(rooms, followed) {
|
|
143
|
+
if (followed.every(({ readable, areas }) => readable === undefined && areas === undefined))
|
|
144
|
+
return null;
|
|
145
|
+
return {
|
|
146
|
+
rooms: [...rooms, ...followed.filter(({ readable }) => readable === undefined)].map(({ locator }) => locator),
|
|
147
|
+
documents: followed.flatMap(({ locator, readable }) => (readable ?? []).map((path) => documentKey(locator, path))),
|
|
148
|
+
areas: followed.flatMap(({ locator, areas }) => (areas ?? []).map(({ path, open }) => ({ room: locator, path, open }))),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function scope(rooms, roomTypes, connection, followed = []) {
|
|
152
|
+
for (const table of REPLICA_TABLES)
|
|
153
|
+
connection.run(table);
|
|
154
|
+
const keys = rooms.map((room) => enteredRoom(room, roomTypes, connection));
|
|
155
|
+
const follows = [
|
|
156
|
+
...keys,
|
|
157
|
+
...followed.map((room) => enteredRoom(room, roomTypes, connection)),
|
|
158
|
+
].filter(({ handle }) => handle !== undefined);
|
|
159
|
+
const planned = { listed: true, rooms: keys.map(({ facts }) => facts) };
|
|
160
|
+
const reach = reachOf(rooms, followed);
|
|
139
161
|
return {
|
|
140
162
|
async results(queries) {
|
|
141
163
|
const results = {};
|
|
142
164
|
for (const [name, query] of Object.entries(queries)) {
|
|
143
|
-
const plan = entryPlan(query, planned);
|
|
144
|
-
results[name] = answerQuery(connection, plan, keys.filter(({ locator }) => plan.rooms === null || plan.rooms.includes(locator)));
|
|
165
|
+
const plan = entryPlan(query, planned, reach);
|
|
166
|
+
results[name] = answerQuery(connection, plan, keys.filter(({ locator }) => plan.rooms === null || plan.rooms.includes(locator)), null, follows);
|
|
145
167
|
}
|
|
146
168
|
return results;
|
|
147
169
|
},
|
|
148
170
|
};
|
|
149
171
|
}
|
|
150
|
-
|
|
151
|
-
return
|
|
172
|
+
function scopedRoom(room, connection) {
|
|
173
|
+
return {
|
|
152
174
|
locator: room.locator,
|
|
175
|
+
...(room.handle === undefined ? {} : { handle: room.handle }),
|
|
176
|
+
...(room.readable === undefined ? {} : { readable: room.readable }),
|
|
177
|
+
...(room.areas === undefined ? {} : { areas: room.areas }),
|
|
153
178
|
schema: room.schema,
|
|
154
179
|
enter(composition) {
|
|
155
180
|
const heads = (path) => ({
|
|
@@ -167,7 +192,7 @@ export function entryScope(rooms, roomTypes, connection) {
|
|
|
167
192
|
binary: null,
|
|
168
193
|
...heads(path),
|
|
169
194
|
})),
|
|
170
|
-
...Object.entries(room.
|
|
195
|
+
...Object.entries(room.attachments ?? {}).map(([path, binary]) => ({
|
|
171
196
|
path,
|
|
172
197
|
content: null,
|
|
173
198
|
facts: null,
|
|
@@ -177,7 +202,10 @@ export function entryScope(rooms, roomTypes, connection) {
|
|
|
177
202
|
];
|
|
178
203
|
return entered(connection, room.locator, composition, entries.sort((left, right) => (left.path < right.path ? -1 : 1)));
|
|
179
204
|
},
|
|
180
|
-
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
export function entryScope(rooms, roomTypes, connection, followed = []) {
|
|
208
|
+
return scope(rooms.map((room) => scopedRoom(room, connection)), roomTypes, connection, followed.map((room) => scopedRoom(room, connection)));
|
|
181
209
|
}
|
|
182
210
|
export function countScope(room, roomTypes, connection) {
|
|
183
211
|
return scope([
|
package/dist/host.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { type CallResult } from './outcome.js';
|
|
|
6
6
|
import { type RuntimePort } from './wire.js';
|
|
7
7
|
export type MdRuntimeHostOptions = MdRuntimeOptions & {
|
|
8
8
|
deploymentFacts?: unknown;
|
|
9
|
+
saveMessages?: Readonly<Record<string, string>>;
|
|
9
10
|
};
|
|
10
11
|
export type Admitted = {
|
|
11
12
|
readonly admitted: unknown;
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,gBAAgB,E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B,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
|
@@ -16,7 +16,7 @@ const UNWAITED_TOPICS = new Set([
|
|
|
16
16
|
'service-mode',
|
|
17
17
|
'authority-changes',
|
|
18
18
|
]);
|
|
19
|
-
function answered(md, app, writtenBy, member, input) {
|
|
19
|
+
function answered(md, app, writtenBy, member, input, said) {
|
|
20
20
|
switch (member) {
|
|
21
21
|
case 'rooms':
|
|
22
22
|
return md.rooms();
|
|
@@ -25,27 +25,31 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
25
25
|
case 'search':
|
|
26
26
|
return md.search(input[0]);
|
|
27
27
|
case 'queryHouse':
|
|
28
|
-
return md.queryHouse(input[0]);
|
|
28
|
+
return md.queryHouse(input[0], input[1]);
|
|
29
29
|
case 'types':
|
|
30
30
|
return md.types(input[0]);
|
|
31
31
|
case 'save':
|
|
32
|
-
return md
|
|
32
|
+
return md
|
|
33
|
+
.save(input[0], input[1], writtenBy)
|
|
34
|
+
.then(said);
|
|
33
35
|
case 'saveParts':
|
|
34
|
-
return md
|
|
36
|
+
return md
|
|
37
|
+
.saveParts(input[0], input[1], writtenBy)
|
|
38
|
+
.then(said);
|
|
35
39
|
case 'history':
|
|
36
40
|
return md.history(input[0], input[1], input[2]);
|
|
37
41
|
case 'resolve':
|
|
38
42
|
return md.resolve(input[0], input[1], input[2]);
|
|
39
|
-
case '
|
|
40
|
-
return md.
|
|
41
|
-
case '
|
|
42
|
-
return md.
|
|
43
|
-
case '
|
|
44
|
-
return md.
|
|
45
|
-
case '
|
|
46
|
-
return md.
|
|
47
|
-
case '
|
|
48
|
-
return md.
|
|
43
|
+
case 'attachment.read':
|
|
44
|
+
return md.attachment.read(input[0], input[1], input[2]);
|
|
45
|
+
case 'attachment.link':
|
|
46
|
+
return md.attachment.link(input[0], input[1], input[2]);
|
|
47
|
+
case 'attachment.show':
|
|
48
|
+
return md.attachment.show(input[0], input[1], input[2]);
|
|
49
|
+
case 'attachment.attach':
|
|
50
|
+
return md.attachment.attach(input[0], input[1]);
|
|
51
|
+
case 'attachment.part':
|
|
52
|
+
return md.attachment.part(input[0], input[1]);
|
|
49
53
|
case 'call':
|
|
50
54
|
return md.call(input[0], input[1]);
|
|
51
55
|
case 'answered':
|
|
@@ -104,8 +108,8 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
104
108
|
return md.conversation.decide(input[0], input[1], input[2]);
|
|
105
109
|
case 'conversation.rename':
|
|
106
110
|
return md.conversation.rename(input[0], input[1], input[2]);
|
|
107
|
-
case 'conversation.
|
|
108
|
-
return md.conversation.
|
|
111
|
+
case 'conversation.set':
|
|
112
|
+
return md.conversation.set(input[0], input[1], input[2]);
|
|
109
113
|
case 'conversation.retry':
|
|
110
114
|
return md.conversation.retry(input[0], input[1], input[2]);
|
|
111
115
|
case 'conversation.pin':
|
|
@@ -143,6 +147,13 @@ function answeredMessage(value) {
|
|
|
143
147
|
}
|
|
144
148
|
export function serveMdRuntime(options) {
|
|
145
149
|
const deploymentFacts = structuredClone(options.deploymentFacts);
|
|
150
|
+
const saveMessages = new Map(Object.entries(options.saveMessages ?? {}));
|
|
151
|
+
const said = (result) => {
|
|
152
|
+
if (result.outcome !== 'refused')
|
|
153
|
+
return result;
|
|
154
|
+
const message = saveMessages.get(result.code);
|
|
155
|
+
return message === undefined ? result : { ...result, message };
|
|
156
|
+
};
|
|
146
157
|
const closing = new AbortController();
|
|
147
158
|
const close = () => {
|
|
148
159
|
closing.abort();
|
|
@@ -265,7 +276,7 @@ export function serveMdRuntime(options) {
|
|
|
265
276
|
return;
|
|
266
277
|
}
|
|
267
278
|
const { id, member, input } = message;
|
|
268
|
-
const pending = attempted(() => answered(NARROWED.has(WIRE.members[member].reach) ? admitted : md, app, writtenBy, member, input));
|
|
279
|
+
const pending = attempted(() => answered(NARROWED.has(WIRE.members[member].reach) ? admitted : md, app, writtenBy, member, input, said));
|
|
269
280
|
return reply(id, member === 'query' ? input[0] : undefined, pending);
|
|
270
281
|
};
|
|
271
282
|
port.addEventListener('message', (event) => {
|