@agentshouse/mdruntime 0.1.0-alpha.4 → 0.1.0-alpha.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +191 -0
- package/README.md +44 -0
- package/dist/adapter.d.ts +174 -18
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +2 -1
- package/dist/adapter.js.map +1 -1
- package/dist/bootstrap.d.ts +7 -7
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +14 -9
- package/dist/bootstrap.js.map +1 -1
- package/dist/change-set.d.ts +33 -0
- package/dist/change-set.d.ts.map +1 -0
- package/dist/change-set.js +89 -0
- package/dist/change-set.js.map +1 -0
- package/dist/change.d.ts +10 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js.map +1 -1
- package/dist/client.d.ts +74 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +232 -0
- package/dist/client.js.map +1 -0
- package/dist/collection.d.ts +25 -12
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +113 -31
- package/dist/collection.js.map +1 -1
- package/dist/connection.d.ts +84 -27
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1685 -336
- package/dist/connection.js.map +1 -1
- package/dist/conversation.d.ts +79 -0
- package/dist/conversation.d.ts.map +1 -0
- package/dist/conversation.js +593 -0
- package/dist/conversation.js.map +1 -0
- package/dist/durability.d.ts +9 -0
- package/dist/durability.d.ts.map +1 -0
- package/dist/durability.js +11 -0
- package/dist/durability.js.map +1 -0
- package/dist/file.d.ts +20 -0
- package/dist/file.d.ts.map +1 -0
- package/dist/file.js +149 -0
- package/dist/file.js.map +1 -0
- package/dist/host.d.ts +14 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +211 -0
- package/dist/host.js.map +1 -0
- package/dist/identity.d.ts +3 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +23 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +15 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/memory.d.ts +17 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +201 -15
- package/dist/memory.js.map +1 -1
- package/dist/model.d.ts +55 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +36 -0
- package/dist/model.js.map +1 -0
- package/dist/observation.d.ts +25 -0
- package/dist/observation.d.ts.map +1 -0
- package/dist/observation.js +92 -0
- package/dist/observation.js.map +1 -0
- package/dist/outcome.d.ts +22 -18
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +1 -11
- package/dist/outcome.js.map +1 -1
- package/dist/overlay.d.ts +2 -0
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +107 -1
- package/dist/overlay.js.map +1 -1
- package/dist/paths.d.ts +0 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +0 -4
- package/dist/paths.js.map +1 -1
- package/dist/query.d.ts +209 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +467 -0
- package/dist/query.js.map +1 -0
- package/dist/read-side.d.ts +14 -0
- package/dist/read-side.d.ts.map +1 -0
- package/dist/read-side.js +451 -0
- package/dist/read-side.js.map +1 -0
- package/dist/refresh.d.ts +3 -3
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +10 -7
- package/dist/refresh.js.map +1 -1
- package/dist/replica.d.ts +23 -4
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +224 -13
- package/dist/replica.js.map +1 -1
- package/dist/room-draft.d.ts +124 -0
- package/dist/room-draft.d.ts.map +1 -0
- package/dist/room-draft.js +406 -0
- package/dist/room-draft.js.map +1 -0
- package/dist/rows.d.ts +39 -0
- package/dist/rows.d.ts.map +1 -0
- package/dist/rows.js +100 -0
- package/dist/rows.js.map +1 -0
- package/dist/save.d.ts +11 -2
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +116 -128
- package/dist/save.js.map +1 -1
- package/dist/search.d.ts +61 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +155 -0
- package/dist/search.js.map +1 -0
- package/dist/status.d.ts +9 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +5 -4
- package/dist/status.js.map +1 -1
- package/dist/store.d.ts +89 -18
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +445 -57
- package/dist/store.js.map +1 -1
- package/dist/transfer.d.ts +5 -0
- package/dist/transfer.d.ts.map +1 -1
- package/dist/transfer.js.map +1 -1
- package/dist/wire.d.ts +64 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +144 -0
- package/dist/wire.js.map +1 -0
- package/package.json +15 -13
package/dist/collection.d.ts
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
|
-
import { type Document } from '@agentshouse/mdmodel';
|
|
2
|
-
import type {
|
|
1
|
+
import { type Document, type Validation } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { ModelState } from './model.js';
|
|
3
3
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
|
+
import { type Refused, type Unconfirmed } from './transfer.js';
|
|
4
5
|
export declare const MD_MODEL: MdModelIdentity;
|
|
5
|
-
export declare const PRESENTED: Selector;
|
|
6
|
-
export type MdType = {
|
|
7
|
-
name: string;
|
|
8
|
-
path: string;
|
|
9
|
-
fields: Readonly<Record<string, unknown>>;
|
|
10
|
-
sections: Readonly<Record<string, unknown>>;
|
|
11
|
-
};
|
|
12
6
|
export type Collection = {
|
|
13
7
|
documents: Readonly<Record<string, Document>>;
|
|
14
|
-
|
|
8
|
+
composition: Composition;
|
|
9
|
+
};
|
|
10
|
+
export type Composition = {
|
|
11
|
+
collectionRoot: string;
|
|
12
|
+
model: ModelState;
|
|
13
|
+
selection: {
|
|
14
|
+
roots: readonly string[];
|
|
15
|
+
model: ModelState;
|
|
16
|
+
} | null;
|
|
17
|
+
};
|
|
18
|
+
export declare function governing(composition: Composition, path: string): ModelState;
|
|
19
|
+
type Previous = {
|
|
20
|
+
text: Readonly<Record<string, string>>;
|
|
21
|
+
collection: Collection;
|
|
15
22
|
};
|
|
16
|
-
export declare function parseCollection(text: Readonly<Record<string, string
|
|
17
|
-
export declare function readCollection(text: Readonly<Record<string, string>>,
|
|
23
|
+
export declare function parseCollection(text: Readonly<Record<string, string>>, composition: Composition, previous?: Previous): Collection;
|
|
24
|
+
export declare function readCollection(text: Readonly<Record<string, string>>, composition: Composition, previous?: Previous): {
|
|
25
|
+
kind: 'read';
|
|
26
|
+
collection: Collection;
|
|
27
|
+
} | Refused | Unconfirmed;
|
|
28
|
+
export declare function validRoot(root: unknown): root is string;
|
|
29
|
+
export declare function validateCollection(text: Readonly<Record<string, string>>, binaryTargets: readonly string[], composition: Composition): Validation;
|
|
30
|
+
export {};
|
|
18
31
|
//# sourceMappingURL=collection.d.ts.map
|
package/dist/collection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,QAAQ,EAEb,KAAK,UAAU,EAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAe,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5E,eAAO,MAAM,QAAQ,EAAE,eAAwE,CAAC;AAIhG,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC9C,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,WAAW,GA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import { beneath, normalize } from './paths.js';
|
|
3
|
+
import { unconfirmed } from './transfer.js';
|
|
4
4
|
export const MD_MODEL = {
|
|
5
5
|
identity: '@agentshouse/mdmodel',
|
|
6
6
|
version: VERSION
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
$regex: '\\.md$'
|
|
11
|
-
}
|
|
8
|
+
const NO_TYPES = {
|
|
9
|
+
types: {}
|
|
12
10
|
};
|
|
13
|
-
function
|
|
14
|
-
return
|
|
11
|
+
function selected(composition, path) {
|
|
12
|
+
return composition.selection !== null && composition.selection.roots.some((root)=>beneath(root, path));
|
|
15
13
|
}
|
|
16
|
-
function
|
|
17
|
-
return
|
|
14
|
+
export function governing(composition, path) {
|
|
15
|
+
return composition.selection !== null && selected(composition, path) ? composition.selection.model : composition.model;
|
|
18
16
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
17
|
+
function parsedAt(text, path, previous) {
|
|
18
|
+
const retained = previous?.collection.documents[path];
|
|
19
|
+
return retained !== undefined && previous?.text[path] === text[path] ? {
|
|
20
|
+
ok: true,
|
|
21
|
+
document: retained
|
|
22
|
+
} : parse(text[path], path);
|
|
26
23
|
}
|
|
27
|
-
export function parseCollection(text) {
|
|
24
|
+
export function parseCollection(text, composition, previous) {
|
|
28
25
|
const documents = {};
|
|
29
26
|
for (const path of Object.keys(text).sort()){
|
|
30
|
-
const parsed =
|
|
27
|
+
const parsed = parsedAt(text, path, previous);
|
|
31
28
|
if (parsed.ok) documents[path] = parsed.document;
|
|
32
29
|
}
|
|
33
|
-
const types = [];
|
|
34
|
-
for (const [path, document] of Object.entries(documents)){
|
|
35
|
-
if (!isMarkdown(path) || document.type !== DEFINITION) continue;
|
|
36
|
-
types.push(mdType(path, document));
|
|
37
|
-
}
|
|
38
30
|
return {
|
|
39
31
|
documents,
|
|
40
|
-
|
|
32
|
+
composition
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function readCollection(text, composition, previous) {
|
|
36
|
+
if (!validRoot(composition.collectionRoot)) return unconfirmed;
|
|
37
|
+
const documents = {};
|
|
38
|
+
for (const path of Object.keys(text).sort()){
|
|
39
|
+
const parsed = parsedAt(text, path, previous);
|
|
40
|
+
if (!parsed.ok) return {
|
|
41
|
+
kind: 'refused',
|
|
42
|
+
refusal: parsed.refusal
|
|
43
|
+
};
|
|
44
|
+
const { type } = parsed.document;
|
|
45
|
+
if (!member(path, composition.collectionRoot) && !selected(composition, path) && type !== undefined && type !== 'any') return {
|
|
46
|
+
kind: 'refused',
|
|
47
|
+
refusal: {
|
|
48
|
+
rule: 'outside-collection-type',
|
|
49
|
+
file: path,
|
|
50
|
+
version: VERSION
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
documents[path] = parsed.document;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
kind: 'read',
|
|
57
|
+
collection: {
|
|
58
|
+
documents,
|
|
59
|
+
composition
|
|
60
|
+
}
|
|
41
61
|
};
|
|
42
62
|
}
|
|
43
|
-
export function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
63
|
+
export function validRoot(root) {
|
|
64
|
+
return typeof root === 'string' && normalize(root) === root;
|
|
65
|
+
}
|
|
66
|
+
function member(path, root) {
|
|
67
|
+
return root === '' || path.startsWith(`${root}/`);
|
|
68
|
+
}
|
|
69
|
+
function validateAgainst(documents, binaryTargets, prefix, model) {
|
|
70
|
+
if (model.status === 'unavailable') {
|
|
71
|
+
const typed = Object.entries(documents).find(([, content])=>{
|
|
72
|
+
const parsed = parse(content);
|
|
73
|
+
return parsed.ok && parsed.document.type !== undefined && parsed.document.type !== 'any';
|
|
74
|
+
});
|
|
75
|
+
if (typed !== undefined) return {
|
|
76
|
+
verdict: 'refuse',
|
|
77
|
+
rule: 'model-unavailable',
|
|
78
|
+
file: `${prefix}${typed[0]}`,
|
|
79
|
+
version: VERSION
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const verdict = validate(documents, {
|
|
47
83
|
binaryTargets
|
|
48
|
-
}
|
|
49
|
-
|
|
84
|
+
}, model.status === 'unavailable' ? NO_TYPES : {
|
|
85
|
+
types: model.types
|
|
86
|
+
});
|
|
87
|
+
if (verdict.verdict === 'accept') return verdict;
|
|
88
|
+
return {
|
|
89
|
+
...verdict,
|
|
90
|
+
file: `${prefix}${verdict.file}`,
|
|
91
|
+
...verdict.referrers === undefined ? {} : {
|
|
92
|
+
referrers: verdict.referrers.map((path)=>`${prefix}${path}`)
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export function validateCollection(text, binaryTargets, composition) {
|
|
97
|
+
const prefix = composition.collectionRoot === '' ? '' : `${composition.collectionRoot}/`;
|
|
98
|
+
const collection = {};
|
|
99
|
+
const selection = {};
|
|
100
|
+
for (const [path, content] of Object.entries(text)){
|
|
101
|
+
if (member(path, composition.collectionRoot)) {
|
|
102
|
+
collection[path.slice(prefix.length)] = content;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (selected(composition, path)) {
|
|
106
|
+
selection[path] = content;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const parsed = parse(content, path);
|
|
110
|
+
if (!parsed.ok) return {
|
|
111
|
+
verdict: 'refuse',
|
|
112
|
+
...parsed.refusal
|
|
113
|
+
};
|
|
114
|
+
if (Object.hasOwn(parsed.document.fields, 'type') && parsed.document.fields.type !== 'any') {
|
|
115
|
+
return {
|
|
116
|
+
verdict: 'refuse',
|
|
117
|
+
rule: 'outside-collection-type',
|
|
118
|
+
file: path,
|
|
119
|
+
version: VERSION
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const verdicts = [
|
|
124
|
+
validateAgainst(collection, binaryTargets.filter((path)=>member(path, composition.collectionRoot)).map((path)=>path.slice(prefix.length)), prefix, composition.model)
|
|
125
|
+
];
|
|
126
|
+
if (composition.selection !== null) {
|
|
127
|
+
verdicts.push(validateAgainst(selection, binaryTargets.filter((path)=>selected(composition, path)), '', composition.selection.model));
|
|
128
|
+
}
|
|
129
|
+
const refusals = verdicts.filter((verdict)=>verdict.verdict === 'refuse');
|
|
130
|
+
if (refusals.length === 0) return verdicts[0];
|
|
131
|
+
return refusals.find((refusal)=>refusal.rule !== 'model-unavailable') ?? refusals[0];
|
|
50
132
|
}
|
|
51
133
|
|
|
52
134
|
//# sourceMappingURL=collection.js.map
|
package/dist/collection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/workspace/packages/mdruntime/src/collection.ts"],"sourcesContent":["import { parse, validate, VERSION, type Document } from '@agentshouse/mdmodel';\nimport type { Selector } from '@agentshouse/query';\nimport type { MdModelIdentity } from './adapter.js';\n\nconst MARKDOWN = '.md';\nconst DEFINITION = 'definition';\n\nexport const MD_MODEL: MdModelIdentity = { identity: '@agentshouse/mdmodel', version: VERSION };\n\nexport const PRESENTED: Selector = { path: { $regex: '\\\\.md$' } };\n\nexport type MdType = {\n name: string;\n path: string;\n fields: Readonly<Record<string, unknown>>;\n sections: Readonly<Record<string, unknown>>;\n};\n\nexport type Collection = {\n documents: Readonly<Record<string, Document>>;\n types: readonly MdType[];\n};\n\nfunction isMarkdown(path: string) {\n return path.endsWith(MARKDOWN);\n}\n\nfunction declaredIn(document: Document, part: 'fields' | 'sections') {\n return (document.fields[part] ?? {}) as Readonly<Record<string, unknown>>;\n}\n\nfunction mdType(path: string, document: Document): MdType {\n return {\n name: path.slice(path.lastIndexOf('/') + 1, -MARKDOWN.length),\n path,\n fields: declaredIn(document, 'fields'),\n sections: declaredIn(document, 'sections'),\n };\n}\n\nexport function parseCollection(text: Readonly<Record<string, string>>): Collection {\n const documents: Record<string, Document> = {};\n for (const path of Object.keys(text).sort()) {\n const parsed = parse(text[path], path);\n if (parsed.ok) documents[path] = parsed.document;\n }\n const types: MdType[] = [];\n for (const [path, document] of Object.entries(documents)) {\n if (!isMarkdown(path) || document.type !== DEFINITION) continue;\n types.push(mdType(path, document));\n }\n return { documents, types };\n}\n\nexport function readCollection(\n text: Readonly<Record<string, string>>,\n binaryTargets: readonly string[],\n): Collection | null {\n const collection = parseCollection(text);\n if (Object.keys(collection.documents).length !== Object.keys(text).length) return null;\n if (validate(text, { binaryTargets }).verdict === 'refuse') return null;\n return collection;\n}\n"],"names":["parse","validate","VERSION","MARKDOWN","DEFINITION","MD_MODEL","identity","version","PRESENTED","path","$regex","isMarkdown","endsWith","declaredIn","document","part","fields","mdType","name","slice","lastIndexOf","length","sections","parseCollection","text","documents","Object","keys","sort","parsed","ok","types","entries","type","push","readCollection","binaryTargets","collection","verdict"],"mappings":"AAAA,SAASA,KAAK,EAAEC,QAAQ,EAAEC,OAAO,QAAuB,uBAAuB;AAI/E,MAAMC,WAAW;AACjB,MAAMC,aAAa;AAEnB,OAAO,MAAMC,WAA4B;IAAEC,UAAU;IAAwBC,SAASL;AAAQ,EAAE;AAEhG,OAAO,MAAMM,YAAsB;IAAEC,MAAM;QAAEC,QAAQ;IAAS;AAAE,EAAE;AAclE,SAASC,WAAWF,IAAY;IAC9B,OAAOA,KAAKG,QAAQ,CAACT;AACvB;AAEA,SAASU,WAAWC,QAAkB,EAAEC,IAA2B;IACjE,OAAQD,SAASE,MAAM,CAACD,KAAK,IAAI,CAAC;AACpC;AAEA,SAASE,OAAOR,IAAY,EAAEK,QAAkB;IAC9C,OAAO;QACLI,MAAMT,KAAKU,KAAK,CAACV,KAAKW,WAAW,CAAC,OAAO,GAAG,CAACjB,SAASkB,MAAM;QAC5DZ;QACAO,QAAQH,WAAWC,UAAU;QAC7BQ,UAAUT,WAAWC,UAAU;IACjC;AACF;AAEA,OAAO,SAASS,gBAAgBC,IAAsC;IACpE,MAAMC,YAAsC,CAAC;IAC7C,KAAK,MAAMhB,QAAQiB,OAAOC,IAAI,CAACH,MAAMI,IAAI,GAAI;QAC3C,MAAMC,SAAS7B,MAAMwB,IAAI,CAACf,KAAK,EAAEA;QACjC,IAAIoB,OAAOC,EAAE,EAAEL,SAAS,CAAChB,KAAK,GAAGoB,OAAOf,QAAQ;IAClD;IACA,MAAMiB,QAAkB,EAAE;IAC1B,KAAK,MAAM,CAACtB,MAAMK,SAAS,IAAIY,OAAOM,OAAO,CAACP,WAAY;QACxD,IAAI,CAACd,WAAWF,SAASK,SAASmB,IAAI,KAAK7B,YAAY;QACvD2B,MAAMG,IAAI,CAACjB,OAAOR,MAAMK;IAC1B;IACA,OAAO;QAAEW;QAAWM;IAAM;AAC5B;AAEA,OAAO,SAASI,eACdX,IAAsC,EACtCY,aAAgC;IAEhC,MAAMC,aAAad,gBAAgBC;IACnC,IAAIE,OAAOC,IAAI,CAACU,WAAWZ,SAAS,EAAEJ,MAAM,KAAKK,OAAOC,IAAI,CAACH,MAAMH,MAAM,EAAE,OAAO;IAClF,IAAIpB,SAASuB,MAAM;QAAEY;IAAc,GAAGE,OAAO,KAAK,UAAU,OAAO;IACnE,OAAOD;AACT"}
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/collection.ts"],"sourcesContent":["import {\n parse,\n validate,\n VERSION,\n type Document,\n type ParseResult,\n type Validation,\n type VerifiedModel,\n} from '@agentshouse/mdmodel';\nimport { beneath, normalize } from './paths.js';\nimport type { ModelState } from './model.js';\nimport type { MdModelIdentity } from './adapter.js';\nimport { unconfirmed, type Refused, type Unconfirmed } from './transfer.js';\n\nexport const MD_MODEL: MdModelIdentity = { identity: '@agentshouse/mdmodel', version: VERSION };\n\nconst NO_TYPES: VerifiedModel = { types: {} };\n\nexport type Collection = {\n documents: Readonly<Record<string, Document>>;\n composition: Composition;\n};\n\nexport type Composition = {\n collectionRoot: string;\n model: ModelState;\n selection: { roots: readonly string[]; model: ModelState } | null;\n};\n\nfunction selected(composition: Composition, path: string): boolean {\n return (\n composition.selection !== null &&\n composition.selection.roots.some((root) => beneath(root, path))\n );\n}\n\nexport function governing(composition: Composition, path: string): ModelState {\n return composition.selection !== null && selected(composition, path)\n ? composition.selection.model\n : composition.model;\n}\n\ntype Previous = { text: Readonly<Record<string, string>>; collection: Collection };\n\nfunction parsedAt(\n text: Readonly<Record<string, string>>,\n path: string,\n previous: Previous | undefined,\n): ParseResult {\n const retained = previous?.collection.documents[path];\n return retained !== undefined && previous?.text[path] === text[path]\n ? { ok: true, document: retained }\n : parse(text[path], path);\n}\n\nexport function parseCollection(\n text: Readonly<Record<string, string>>,\n composition: Composition,\n previous?: Previous,\n): Collection {\n const documents: Record<string, Document> = {};\n for (const path of Object.keys(text).sort()) {\n const parsed = parsedAt(text, path, previous);\n if (parsed.ok) documents[path] = parsed.document;\n }\n return { documents, composition };\n}\n\nexport function readCollection(\n text: Readonly<Record<string, string>>,\n composition: Composition,\n previous?: Previous,\n): { kind: 'read'; collection: Collection } | Refused | Unconfirmed {\n if (!validRoot(composition.collectionRoot)) return unconfirmed;\n const documents: Record<string, Document> = {};\n for (const path of Object.keys(text).sort()) {\n const parsed = parsedAt(text, path, previous);\n if (!parsed.ok) return { kind: 'refused', refusal: parsed.refusal };\n const { type } = parsed.document;\n if (\n !member(path, composition.collectionRoot) &&\n !selected(composition, path) &&\n type !== undefined &&\n type !== 'any'\n )\n return {\n kind: 'refused',\n refusal: { rule: 'outside-collection-type', file: path, version: VERSION },\n };\n documents[path] = parsed.document;\n }\n return { kind: 'read', collection: { documents, composition } };\n}\n\nexport function validRoot(root: unknown): root is string {\n return typeof root === 'string' && normalize(root) === root;\n}\n\nfunction member(path: string, root: string): boolean {\n return root === '' || path.startsWith(`${root}/`);\n}\n\ntype Refusal = Extract<Validation, { verdict: 'refuse' }>;\n\nfunction validateAgainst(\n documents: Readonly<Record<string, string>>,\n binaryTargets: readonly string[],\n prefix: string,\n model: ModelState,\n): Validation {\n if (model.status === 'unavailable') {\n const typed = Object.entries(documents).find(([, content]) => {\n const parsed = parse(content);\n return parsed.ok && parsed.document.type !== undefined && parsed.document.type !== 'any';\n });\n if (typed !== undefined)\n return {\n verdict: 'refuse',\n rule: 'model-unavailable',\n file: `${prefix}${typed[0]}`,\n version: VERSION,\n };\n }\n const verdict = validate(\n documents,\n { binaryTargets },\n model.status === 'unavailable' ? NO_TYPES : { types: model.types },\n );\n if (verdict.verdict === 'accept') return verdict;\n return {\n ...verdict,\n file: `${prefix}${verdict.file}`,\n ...(verdict.referrers === undefined\n ? {}\n : { referrers: verdict.referrers.map((path) => `${prefix}${path}`) }),\n };\n}\n\nexport function validateCollection(\n text: Readonly<Record<string, string>>,\n binaryTargets: readonly string[],\n composition: Composition,\n): Validation {\n const prefix = composition.collectionRoot === '' ? '' : `${composition.collectionRoot}/`;\n const collection: Record<string, string> = {};\n const selection: Record<string, string> = {};\n for (const [path, content] of Object.entries(text)) {\n if (member(path, composition.collectionRoot)) {\n collection[path.slice(prefix.length)] = content;\n continue;\n }\n if (selected(composition, path)) {\n selection[path] = content;\n continue;\n }\n const parsed = parse(content, path);\n if (!parsed.ok) return { verdict: 'refuse', ...parsed.refusal };\n if (Object.hasOwn(parsed.document.fields, 'type') && parsed.document.fields.type !== 'any') {\n return { verdict: 'refuse', rule: 'outside-collection-type', file: path, version: VERSION };\n }\n }\n const verdicts = [\n validateAgainst(\n collection,\n binaryTargets\n .filter((path) => member(path, composition.collectionRoot))\n .map((path) => path.slice(prefix.length)),\n prefix,\n composition.model,\n ),\n ];\n if (composition.selection !== null) {\n verdicts.push(\n validateAgainst(\n selection,\n binaryTargets.filter((path) => selected(composition, path)),\n '',\n composition.selection.model,\n ),\n );\n }\n const refusals = verdicts.filter((verdict): verdict is Refusal => verdict.verdict === 'refuse');\n if (refusals.length === 0) return verdicts[0];\n return refusals.find((refusal) => refusal.rule !== 'model-unavailable') ?? refusals[0];\n}\n"],"names":["parse","validate","VERSION","beneath","normalize","unconfirmed","MD_MODEL","identity","version","NO_TYPES","types","selected","composition","path","selection","roots","some","root","governing","model","parsedAt","text","previous","retained","collection","documents","undefined","ok","document","parseCollection","Object","keys","sort","parsed","readCollection","validRoot","collectionRoot","kind","refusal","type","member","rule","file","startsWith","validateAgainst","binaryTargets","prefix","status","typed","entries","find","content","verdict","referrers","map","validateCollection","slice","length","hasOwn","fields","verdicts","filter","push","refusals"],"mappings":"AAAA,SACEA,KAAK,EACLC,QAAQ,EACRC,OAAO,QAKF,uBAAuB;AAC9B,SAASC,OAAO,EAAEC,SAAS,QAAQ,aAAa;AAGhD,SAASC,WAAW,QAAwC,gBAAgB;AAE5E,OAAO,MAAMC,WAA4B;IAAEC,UAAU;IAAwBC,SAASN;AAAQ,EAAE;AAEhG,MAAMO,WAA0B;IAAEC,OAAO,CAAC;AAAE;AAa5C,SAASC,SAASC,WAAwB,EAAEC,IAAY;IACtD,OACED,YAAYE,SAAS,KAAK,QAC1BF,YAAYE,SAAS,CAACC,KAAK,CAACC,IAAI,CAAC,CAACC,OAASd,QAAQc,MAAMJ;AAE7D;AAEA,OAAO,SAASK,UAAUN,WAAwB,EAAEC,IAAY;IAC9D,OAAOD,YAAYE,SAAS,KAAK,QAAQH,SAASC,aAAaC,QAC3DD,YAAYE,SAAS,CAACK,KAAK,GAC3BP,YAAYO,KAAK;AACvB;AAIA,SAASC,SACPC,IAAsC,EACtCR,IAAY,EACZS,QAA8B;IAE9B,MAAMC,WAAWD,UAAUE,WAAWC,SAAS,CAACZ,KAAK;IACrD,OAAOU,aAAaG,aAAaJ,UAAUD,IAAI,CAACR,KAAK,KAAKQ,IAAI,CAACR,KAAK,GAChE;QAAEc,IAAI;QAAMC,UAAUL;IAAS,IAC/BvB,MAAMqB,IAAI,CAACR,KAAK,EAAEA;AACxB;AAEA,OAAO,SAASgB,gBACdR,IAAsC,EACtCT,WAAwB,EACxBU,QAAmB;IAEnB,MAAMG,YAAsC,CAAC;IAC7C,KAAK,MAAMZ,QAAQiB,OAAOC,IAAI,CAACV,MAAMW,IAAI,GAAI;QAC3C,MAAMC,SAASb,SAASC,MAAMR,MAAMS;QACpC,IAAIW,OAAON,EAAE,EAAEF,SAAS,CAACZ,KA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yB,SAAS;YAAU,GAAGnB,OAAOK,OAAO;QAAC;QAC9D,IAAIR,OAAO4B,MAAM,CAACzB,OAAOL,QAAQ,CAAC+B,MAAM,EAAE,WAAW1B,OAAOL,QAAQ,CAAC+B,MAAM,CAACpB,IAAI,KAAK,OAAO;YAC1F,OAAO;gBAAEa,SAAS;gBAAUX,MAAM;gBAA2BC,MAAM7B;gBAAML,SAASN;YAAQ;QAC5F;IACF;IACA,MAAM0D,WAAW;QACfhB,gBACEpB,YACAqB,cACGgB,MAAM,CAAC,CAAChD,OAAS2B,OAAO3B,MAAMD,YAAYwB,cAAc,GACxDkB,GAAG,CAAC,CAACzC,OAASA,KAAK2C,KAAK,CAACV,OAAOW,MAAM,IACzCX,QACAlC,YAAYO,KAAK;KAEpB;IACD,IAAIP,YAAYE,SAAS,KAAK,MAAM;QAClC8C,SAASE,IAAI,CACXlB,gBACE9B,WACA+B,cAAcgB,MAAM,CAAC,CAAChD,OAASF,SAASC,aAAaC,QACrD,IACAD,YAAYE,SAAS,CAACK,KAAK;IAGjC;IACA,MAAM4C,WAAWH,SAASC,MAAM,CAAC,CAACT,UAAgCA,QAAQA,OAAO,KAAK;IACtF,IAAIW,SAASN,MAAM,KAAK,GAAG,OAAOG,QAAQ,CAAC,EAAE;IAC7C,OAAOG,SAASb,IAAI,CAAC,CAACZ,UAAYA,QAAQG,IAAI,KAAK,wBAAwBsB,QAAQ,CAAC,EAAE;AACxF"}
|
package/dist/connection.d.ts
CHANGED
|
@@ -1,25 +1,55 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
3
|
-
import type
|
|
4
|
-
import { type
|
|
5
|
-
import { type
|
|
1
|
+
import { type TypesResult } from './model.js';
|
|
2
|
+
import { type Observation } from './observation.js';
|
|
3
|
+
import { type DocumentQuery, type DocumentResult, type GroupQuery, type GroupResult } from './query.js';
|
|
4
|
+
import { type SearchRequest, type SearchResult } from './search.js';
|
|
5
|
+
import { type Adapter, type Authorization, type HistoryResult, type ProviderRefusal, type ServiceMode } from './adapter.js';
|
|
6
|
+
import { type ChatDraftSurface, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
|
|
7
|
+
import type { WrittenBy } from './change.js';
|
|
8
|
+
import type { CallResult, QueueEntry, SubmissionOutcome } from './outcome.js';
|
|
6
9
|
import { type SaveRefusal } from './save.js';
|
|
10
|
+
import { type RoomDraft, type RoomDraftWrite } from './room-draft.js';
|
|
7
11
|
import { type SyncStatus } from './status.js';
|
|
12
|
+
import { type RuntimeShell } from './durability.js';
|
|
13
|
+
export type AppTypedSelection = {
|
|
14
|
+
roots: readonly string[];
|
|
15
|
+
attachedModel: import('./model.js').ModelIdentity | null;
|
|
16
|
+
model: TypesResult;
|
|
17
|
+
};
|
|
8
18
|
export type AppRoom = {
|
|
19
|
+
collectionRoot: string;
|
|
9
20
|
name: string;
|
|
10
21
|
locator: string;
|
|
11
|
-
|
|
22
|
+
operations: import('./adapter.js').OperationScopes;
|
|
23
|
+
replica: import('./adapter.js').ReplicaAdmission;
|
|
24
|
+
attachedModel: import('./model.js').ModelIdentity | null;
|
|
25
|
+
model: TypesResult;
|
|
26
|
+
typedSelection: AppTypedSelection | null;
|
|
12
27
|
providerOwnedPaths: readonly string[];
|
|
13
28
|
roomVersion: string | null;
|
|
14
29
|
synchronizationAvailable: boolean;
|
|
30
|
+
refusal: ProviderRefusal | null;
|
|
31
|
+
};
|
|
32
|
+
export type AppSlotEntry = {
|
|
33
|
+
room: AppRoom;
|
|
34
|
+
segment: string | null;
|
|
35
|
+
};
|
|
36
|
+
export type AppSlot = {
|
|
37
|
+
slot: string;
|
|
38
|
+
entries: readonly AppSlotEntry[];
|
|
39
|
+
};
|
|
40
|
+
export type RoomTypes = {
|
|
41
|
+
collection: TypesResult;
|
|
42
|
+
typedSelection: TypesResult | null;
|
|
15
43
|
};
|
|
16
|
-
export type ConnectionRefusalReason = 'no-matching-version' | 'missing-required-guarantee' | 'md-model-version-mismatch' | 'revoked-authorization';
|
|
44
|
+
export type ConnectionRefusalReason = 'no-matching-version' | 'missing-required-guarantee' | 'md-model-version-mismatch' | 'revoked-authorization' | 'client-host-protocol-mismatch';
|
|
17
45
|
export type ConnectionRefusal = {
|
|
18
46
|
reason: ConnectionRefusalReason;
|
|
19
47
|
reauthorizationOffered: boolean;
|
|
48
|
+
refusal: ProviderRefusal | null;
|
|
20
49
|
};
|
|
21
50
|
export type MdRuntimeOptions = {
|
|
22
51
|
adapter: Adapter;
|
|
52
|
+
shell: RuntimeShell;
|
|
23
53
|
requiredGuarantees: readonly string[];
|
|
24
54
|
authorization?: Authorization;
|
|
25
55
|
discoveryIntervalMs?: number;
|
|
@@ -27,45 +57,72 @@ export type MdRuntimeOptions = {
|
|
|
27
57
|
};
|
|
28
58
|
export type SaveResult = {
|
|
29
59
|
outcome: 'saved';
|
|
30
|
-
|
|
60
|
+
identifier: string;
|
|
31
61
|
} | ({
|
|
32
62
|
outcome: 'refused';
|
|
33
63
|
} & SaveRefusal);
|
|
34
|
-
export type
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
discard(locator: string, path: string): Promise<void>;
|
|
64
|
+
export type SavedRoomDraft = {
|
|
65
|
+
readonly path: string;
|
|
66
|
+
readonly revision: string;
|
|
38
67
|
};
|
|
39
|
-
export type
|
|
40
|
-
|
|
68
|
+
export type RoomDraftSurface = {
|
|
69
|
+
list(): Promise<readonly RoomDraft[]>;
|
|
70
|
+
read(room: string, path: string): RoomDraft | null;
|
|
71
|
+
write(room: string, path: string, revision: string | null, parts: unknown): Promise<RoomDraftWrite>;
|
|
72
|
+
discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
|
|
73
|
+
};
|
|
74
|
+
export type PresentationSurface = {
|
|
75
|
+
read(app: string): Promise<unknown>;
|
|
76
|
+
write(app: string, value: unknown): Promise<void>;
|
|
41
77
|
};
|
|
42
78
|
export type HistoryQuery = {
|
|
43
79
|
revision?: string;
|
|
44
80
|
pageToken?: string;
|
|
45
81
|
};
|
|
46
|
-
export type CallResult = ActionResult | {
|
|
47
|
-
kind: 'undeclared';
|
|
48
|
-
};
|
|
49
82
|
export type MdRuntime = {
|
|
83
|
+
loaded(): Promise<void>;
|
|
50
84
|
rooms(): readonly AppRoom[];
|
|
51
|
-
|
|
52
|
-
|
|
85
|
+
slots(): readonly AppSlot[];
|
|
86
|
+
query: {
|
|
87
|
+
(query: DocumentQuery): Promise<DocumentResult>;
|
|
88
|
+
(query: GroupQuery): Promise<GroupResult>;
|
|
89
|
+
};
|
|
90
|
+
search(request: SearchRequest): Promise<SearchResult>;
|
|
91
|
+
types(locator: string): RoomTypes;
|
|
53
92
|
syncStatus(): SyncStatus;
|
|
54
|
-
|
|
55
|
-
|
|
93
|
+
serviceMode(): ServiceMode;
|
|
94
|
+
roomDraft: RoomDraftSurface;
|
|
95
|
+
conversation: ConversationSurface;
|
|
96
|
+
chatDraft: ChatDraftSurface;
|
|
97
|
+
presentation: PresentationSurface;
|
|
98
|
+
save(room: string, roomDrafts: readonly SavedRoomDraft[], writtenBy?: WrittenBy): Promise<SaveResult>;
|
|
56
99
|
outcome(identifier: string): SubmissionOutcome | null;
|
|
57
|
-
queue: QueueSurface;
|
|
58
100
|
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryResult>;
|
|
59
101
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
60
102
|
log(): string;
|
|
103
|
+
storageLoss(): string | null;
|
|
104
|
+
persistence(): boolean;
|
|
61
105
|
observe: {
|
|
62
|
-
(topic: 'rooms'
|
|
63
|
-
(topic: 'connection-refusal'
|
|
64
|
-
(topic: '
|
|
65
|
-
(topic: '
|
|
66
|
-
(topic: '
|
|
106
|
+
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
107
|
+
(topic: 'connection-refusal'): Promise<Observation<ConnectionRefusal | null>>;
|
|
108
|
+
(topic: 'storage-loss'): Promise<Observation<string | null>>;
|
|
109
|
+
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
110
|
+
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
111
|
+
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult>>;
|
|
112
|
+
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult>>;
|
|
113
|
+
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
114
|
+
(topic: 'room-drafts'): Promise<Observation<readonly RoomDraft[]>>;
|
|
115
|
+
(topic: 'presentation', app: string): Promise<Observation<unknown>>;
|
|
116
|
+
(topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
|
|
67
117
|
};
|
|
68
118
|
reauthorize(): Promise<void>;
|
|
69
119
|
};
|
|
120
|
+
export type RuntimeTopic = 'rooms' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation';
|
|
121
|
+
export type ComposedRuntime = {
|
|
122
|
+
md: MdRuntime;
|
|
123
|
+
stop(): Promise<void>;
|
|
124
|
+
watch(topic: RuntimeTopic, input: readonly unknown[], deliver: (message: unknown) => void): () => void;
|
|
125
|
+
};
|
|
70
126
|
export declare function createMdRuntime(options: MdRuntimeOptions): MdRuntime;
|
|
127
|
+
export declare function composeRuntime(options: MdRuntimeOptions): ComposedRuntime;
|
|
71
128
|
//# sourceMappingURL=connection.d.ts.map
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAEj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