@agentshouse/mdruntime 0.1.0-c967d1ca66fee → 0.1.0-ca14c49c06d90
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 +142 -112
- package/README.md +11 -1
- package/dist/adapter.d.ts +59 -13
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attempt.d.ts +16 -0
- package/dist/attempt.d.ts.map +1 -0
- package/dist/attempt.js +70 -0
- package/dist/binary.d.ts +23 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +8 -0
- package/dist/bootstrap.d.ts +2 -2
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +33 -14
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +8 -7
- package/dist/change.d.ts +11 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +26 -1
- package/dist/chat/acts.d.ts +33 -0
- package/dist/chat/acts.d.ts.map +1 -0
- package/dist/chat/acts.js +36 -0
- package/dist/chat/context.d.ts +3 -0
- package/dist/chat/context.d.ts.map +1 -0
- package/dist/chat/context.js +10 -0
- package/dist/chat/input.d.ts +9 -0
- package/dist/chat/input.d.ts.map +1 -0
- package/dist/chat/input.js +99 -0
- package/dist/chat/kit.d.ts +60 -0
- package/dist/chat/kit.d.ts.map +1 -0
- package/dist/chat/kit.js +123 -0
- package/dist/chat/lasting.d.ts +6 -0
- package/dist/chat/lasting.d.ts.map +1 -0
- package/dist/chat/lasting.js +19 -0
- package/dist/chat/list.d.ts +26 -0
- package/dist/chat/list.d.ts.map +1 -0
- package/dist/chat/list.js +62 -0
- package/dist/chat/markdown.d.ts +20 -0
- package/dist/chat/markdown.d.ts.map +1 -0
- package/dist/chat/markdown.js +188 -0
- package/dist/chat/message.d.ts +6 -0
- package/dist/chat/message.d.ts.map +1 -0
- package/dist/chat/message.js +192 -0
- package/dist/chat/messages.d.ts +21 -0
- package/dist/chat/messages.d.ts.map +1 -0
- package/dist/chat/messages.js +151 -0
- package/dist/chat/name.d.ts +6 -0
- package/dist/chat/name.d.ts.map +1 -0
- package/dist/chat/name.js +37 -0
- package/dist/chat/opened.d.ts +11 -0
- package/dist/chat/opened.d.ts.map +1 -0
- package/dist/chat/opened.js +17 -0
- package/dist/chat/overlay.d.ts +31 -0
- package/dist/chat/overlay.d.ts.map +1 -0
- package/dist/chat/overlay.js +97 -0
- package/dist/chat/parts.d.ts +57 -0
- package/dist/chat/parts.d.ts.map +1 -0
- package/dist/chat/parts.js +119 -0
- package/dist/chat/process.d.ts +20 -0
- package/dist/chat/process.d.ts.map +1 -0
- package/dist/chat/process.js +32 -0
- package/dist/chat/provider.d.ts +63 -0
- package/dist/chat/provider.d.ts.map +1 -0
- package/dist/chat/provider.js +620 -0
- package/dist/chat/question.d.ts +9 -0
- package/dist/chat/question.d.ts.map +1 -0
- package/dist/chat/question.js +80 -0
- package/dist/chat/questions.d.ts +31 -0
- package/dist/chat/questions.d.ts.map +1 -0
- package/dist/chat/questions.js +111 -0
- package/dist/chat/read.d.ts +5 -0
- package/dist/chat/read.d.ts.map +1 -0
- package/dist/chat/read.js +13 -0
- package/dist/chat/ready.d.ts +33 -0
- package/dist/chat/ready.d.ts.map +1 -0
- package/dist/chat/ready.js +91 -0
- package/dist/chat/style.d.ts +4 -0
- package/dist/chat/style.d.ts.map +1 -0
- package/dist/chat/style.js +302 -0
- package/dist/chat.d.ts +14 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +8 -0
- package/dist/client.d.ts +11 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +12 -2
- package/dist/connection.d.ts +13 -6
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +573 -193
- package/dist/conversation.d.ts +14 -4
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +188 -63
- package/dist/entry.d.ts +17 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +156 -0
- package/dist/expectation.d.ts +21 -0
- package/dist/expectation.d.ts.map +1 -0
- package/dist/expectation.js +70 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/host.d.ts +3 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +13 -6
- package/dist/identity.d.ts +2 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +6 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/memory.d.ts +4 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +40 -11
- package/dist/outcome.d.ts +11 -1
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +7 -0
- package/dist/overlay.d.ts +13 -2
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +64 -22
- package/dist/query.d.ts +2 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/reach.d.ts +2 -0
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +26 -4
- package/dist/react.d.ts +2 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +9 -2
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +12 -17
- package/dist/replica.d.ts +5 -2
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +33 -28
- package/dist/room-draft.d.ts +19 -2
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +119 -1
- package/dist/rows.d.ts +3 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +3 -1
- package/dist/save.d.ts +23 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +309 -18
- package/dist/store.d.ts +36 -18
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +291 -172
- package/dist/wire.d.ts +3 -0
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +3 -0
- package/package.json +26 -14
- package/dist/attachment.d.ts +0 -3
- package/dist/attachment.d.ts.map +0 -1
- package/dist/attachment.js +0 -8
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ExpectedOf<E extends {
|
|
2
|
+
readonly key: string;
|
|
3
|
+
}> = E | readonly E[] | null;
|
|
4
|
+
export type Expecting<E extends {
|
|
5
|
+
readonly key: string;
|
|
6
|
+
}> = {
|
|
7
|
+
subscribe(listener: () => void): () => void;
|
|
8
|
+
version(): number;
|
|
9
|
+
begin(): number;
|
|
10
|
+
expect(act: number, expected: ExpectedOf<E>, settled?: (one: E) => boolean): void;
|
|
11
|
+
drop(act: number): void;
|
|
12
|
+
heard(shown: (one: E) => boolean): void;
|
|
13
|
+
drawn(): readonly E[];
|
|
14
|
+
};
|
|
15
|
+
export declare function expectedList<E extends {
|
|
16
|
+
readonly key: string;
|
|
17
|
+
}>(expected: ExpectedOf<E>): readonly E[];
|
|
18
|
+
export declare function expecting<E extends {
|
|
19
|
+
readonly key: string;
|
|
20
|
+
}>(): Expecting<E>;
|
|
21
|
+
//# sourceMappingURL=expectation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expectation.d.ts","sourceRoot":"","sources":["../src/expectation.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,IAAI,CAAC,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC;AAErF,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,IAAI;IAC1D,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C,OAAO,IAAI,MAAM,CAAC;IAClB,KAAK,IAAI,MAAM,CAAC;IAChB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAC;IAClF,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAC;IACxC,KAAK,IAAI,SAAS,CAAC,EAAE,CAAC;CACvB,CAAC;AAIF,wBAAgB,YAAY,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAC7D,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,GACtB,SAAS,CAAC,EAAE,CAGd;AAwBD,wBAAgB,SAAS,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,KAAK,SAAS,CAAC,CAAC,CAAC,CA4C5E"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export function expectedList(expected) {
|
|
2
|
+
if (expected === null)
|
|
3
|
+
return [];
|
|
4
|
+
return 'key' in expected ? [expected] : expected;
|
|
5
|
+
}
|
|
6
|
+
function superseded(entries, at) {
|
|
7
|
+
const key = entries[at]?.expectation.key;
|
|
8
|
+
return entries.slice(at + 1).some((later) => later.expectation.key === key);
|
|
9
|
+
}
|
|
10
|
+
function unended(entries, ends) {
|
|
11
|
+
const ended = new Set();
|
|
12
|
+
const kept = [];
|
|
13
|
+
for (const one of [...entries].reverse()) {
|
|
14
|
+
if (ended.has(one.expectation.key))
|
|
15
|
+
continue;
|
|
16
|
+
if (ends(one.expectation))
|
|
17
|
+
ended.add(one.expectation.key);
|
|
18
|
+
else
|
|
19
|
+
kept.unshift(one);
|
|
20
|
+
}
|
|
21
|
+
return kept;
|
|
22
|
+
}
|
|
23
|
+
export function expecting() {
|
|
24
|
+
let entries = [];
|
|
25
|
+
let version = 0;
|
|
26
|
+
let acts = 0;
|
|
27
|
+
const listeners = new Set();
|
|
28
|
+
const set = (next) => {
|
|
29
|
+
if (next.length === entries.length && next.every((one, at) => one === entries[at]))
|
|
30
|
+
return;
|
|
31
|
+
entries = next;
|
|
32
|
+
version += 1;
|
|
33
|
+
for (const listener of listeners)
|
|
34
|
+
listener();
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
subscribe(listener) {
|
|
38
|
+
listeners.add(listener);
|
|
39
|
+
return () => {
|
|
40
|
+
listeners.delete(listener);
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
version: () => version,
|
|
44
|
+
begin() {
|
|
45
|
+
acts += 1;
|
|
46
|
+
return acts;
|
|
47
|
+
},
|
|
48
|
+
expect(act, expected, settled = () => false) {
|
|
49
|
+
const fresh = expectedList(expected);
|
|
50
|
+
if (fresh.length === 0)
|
|
51
|
+
return;
|
|
52
|
+
const keys = new Set(fresh.map((one) => one.key));
|
|
53
|
+
const kept = entries.filter((one) => one.act !== act || !keys.has(one.expectation.key));
|
|
54
|
+
const over = new Set(kept.map((one) => one.expectation.key));
|
|
55
|
+
set([
|
|
56
|
+
...kept,
|
|
57
|
+
...fresh
|
|
58
|
+
.filter((one) => over.has(one.key) || !settled(one))
|
|
59
|
+
.map((expectation) => ({ act, expectation })),
|
|
60
|
+
]);
|
|
61
|
+
},
|
|
62
|
+
drop(act) {
|
|
63
|
+
set(entries.filter((one) => one.act !== act));
|
|
64
|
+
},
|
|
65
|
+
heard(shown) {
|
|
66
|
+
set(unended(entries, shown));
|
|
67
|
+
},
|
|
68
|
+
drawn: () => entries.flatMap((one, at) => (superseded(entries, at) ? [] : [one.expectation])),
|
|
69
|
+
};
|
|
70
|
+
}
|
package/dist/fence.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fence.d.ts","sourceRoot":"","sources":["../src/fence.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAS,CAAC,CAAC,CAAE,SAAQ,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;;IAG9C,YAAY,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,EAG/C;IAEQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAE5C;CACF"}
|
package/dist/fence.js
ADDED
package/dist/host.d.ts
CHANGED
|
@@ -10,11 +10,12 @@ export type AttachedPort = {
|
|
|
10
10
|
};
|
|
11
11
|
export type MdRuntimeHost = {
|
|
12
12
|
attach(port: RuntimePort, app: string, release?: string, reach?: PortReach): AttachedPort;
|
|
13
|
-
endAuthorization(): Promise<void>;
|
|
13
|
+
endAuthorization(holder?: string): Promise<void>;
|
|
14
|
+
lose(locators: readonly string[]): Promise<void>;
|
|
14
15
|
stop(): Promise<void>;
|
|
15
16
|
};
|
|
16
17
|
export declare function serveMdRuntime(options: MdRuntimeHostOptions): MdRuntimeHost;
|
|
17
18
|
export type { PortReach, ReachedDocument } from './reach.js';
|
|
18
|
-
export { STORE_SCHEMA } from './store.js';
|
|
19
|
+
export { AUTHORED_SCHEMA, authoredBinding, authoredBy, authoredHolder, bindAuthored, STORE_SCHEMA, } from './store.js';
|
|
19
20
|
export type { RuntimePort } from './wire.js';
|
|
20
21
|
//# sourceMappingURL=host.d.ts.map
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C,OAAO,EAGL,KAAK,WAAW,EAOjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,IAAI,IAAI,CAAC;IACf,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IAC1F,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB,CAAC;AA0FF,wBAAgB,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAoH3E;AAED,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EACL,eAAe,EACf,eAAe,EACf,UAAU,EACV,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/host.js
CHANGED
|
@@ -17,6 +17,10 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
17
17
|
return md.save(input[0], input[1], writtenBy);
|
|
18
18
|
case 'history':
|
|
19
19
|
return md.history(input[0], input[1], input[2]);
|
|
20
|
+
case 'binaryFile.read':
|
|
21
|
+
return md.binaryFile.read(input[0], input[1], input[2]);
|
|
22
|
+
case 'binaryFile.readReference':
|
|
23
|
+
return md.binaryFile.readReference(input[0]);
|
|
20
24
|
case 'call':
|
|
21
25
|
return md.call(input[0], input[1]);
|
|
22
26
|
case 'reached':
|
|
@@ -46,7 +50,7 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
46
50
|
case 'conversation.create':
|
|
47
51
|
return md.conversation.create(input[0]);
|
|
48
52
|
case 'conversation.send':
|
|
49
|
-
return md.conversation.send(input[0]);
|
|
53
|
+
return md.conversation.send(input[0], input[1], input[2]);
|
|
50
54
|
case 'conversation.answer':
|
|
51
55
|
return md.conversation.answer(input[0], input[1]);
|
|
52
56
|
case 'conversation.interrupt':
|
|
@@ -58,7 +62,7 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
58
62
|
case 'conversation.delete':
|
|
59
63
|
return md.conversation.delete(input[0]);
|
|
60
64
|
case 'chatDraft.write':
|
|
61
|
-
return md.chatDraft.write(input[0], input[1]);
|
|
65
|
+
return md.chatDraft.write(input[0], input[1], input[2]);
|
|
62
66
|
case 'chatDraft.discard':
|
|
63
67
|
return md.chatDraft.discard(input[0]);
|
|
64
68
|
}
|
|
@@ -157,19 +161,22 @@ export function serveMdRuntime(options) {
|
|
|
157
161
|
}
|
|
158
162
|
return {
|
|
159
163
|
attach,
|
|
160
|
-
async endAuthorization() {
|
|
164
|
+
async endAuthorization(holder) {
|
|
161
165
|
authorized = false;
|
|
162
166
|
for (const [detach, send] of [...attachments]) {
|
|
163
167
|
send({ kind: 'ended' });
|
|
164
168
|
detach();
|
|
165
169
|
}
|
|
166
170
|
close();
|
|
167
|
-
await removeRuntimeStore()
|
|
168
|
-
|
|
171
|
+
if (!(await removeRuntimeStore(holder)))
|
|
172
|
+
await options.shell.dropGeneration();
|
|
173
|
+
},
|
|
174
|
+
lose(locators) {
|
|
175
|
+
return runtime.lose(locators);
|
|
169
176
|
},
|
|
170
177
|
stop() {
|
|
171
178
|
return runtime.stop();
|
|
172
179
|
},
|
|
173
180
|
};
|
|
174
181
|
}
|
|
175
|
-
export { STORE_SCHEMA } from './store.js';
|
|
182
|
+
export { AUTHORED_SCHEMA, authoredBinding, authoredBy, authoredHolder, bindAuthored, STORE_SCHEMA, } from './store.js';
|
package/dist/identity.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare function changeBatchIdentity(at?: number): string;
|
|
2
2
|
export declare function roomDraftRevision(): string;
|
|
3
|
+
export declare function chatDraftRevision(): string;
|
|
3
4
|
export declare function transferIdentity(): string;
|
|
5
|
+
export declare function binaryLocalId(): string;
|
|
4
6
|
//# sourceMappingURL=identity.d.ts.map
|
package/dist/identity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
package/dist/identity.js
CHANGED
|
@@ -18,6 +18,12 @@ function randomIdentity() {
|
|
|
18
18
|
export function roomDraftRevision() {
|
|
19
19
|
return randomIdentity();
|
|
20
20
|
}
|
|
21
|
+
export function chatDraftRevision() {
|
|
22
|
+
return randomIdentity();
|
|
23
|
+
}
|
|
21
24
|
export function transferIdentity() {
|
|
22
25
|
return randomIdentity();
|
|
23
26
|
}
|
|
27
|
+
export function binaryLocalId() {
|
|
28
|
+
return randomIdentity();
|
|
29
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldRoom, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization,
|
|
1
|
+
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BinaryFile, BinaryRequest, BinaryResult, ReferrerScope, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldContent, HeldRoom, KeptReceipt, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, StreamReceipts, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
|
|
2
2
|
export type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';
|
|
3
|
-
export type { ChatDraft, ChatDraftSurface, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
3
|
+
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
4
4
|
export type { ChatDraftFile, FileDeclaration } from './file.js';
|
|
5
|
-
export type { AppRoom, AppTypedSelection, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedRoomDraft, SaveResult, } from './connection.js';
|
|
5
|
+
export type { AppRoom, AppTypedSelection, BinaryFileSurface, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedRoomDraft, SaveResult, } from './connection.js';
|
|
6
6
|
export type { Observation } from './observation.js';
|
|
7
|
-
export type { CallResult, Failure, HistoryAnswer, QueueEntry, Submission } from './outcome.js';
|
|
7
|
+
export type { BinaryAnswer, CallResult, Failure, HistoryAnswer, Offline, QueueEntry, Submission, } from './outcome.js';
|
|
8
|
+
export type { BinaryFileRecord, BinaryReference } from './binary.js';
|
|
8
9
|
export type { RuntimeError } from './failure.js';
|
|
9
10
|
export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, } from './room-draft.js';
|
|
10
11
|
export type { SaveRefusal } from './save.js';
|
|
11
12
|
export type { DocumentHit, DocumentPart, MessageHit, SearchRequest, SearchResult, } from './search.js';
|
|
13
|
+
export { departure } from './change.js';
|
|
14
|
+
export { SESSION_STARTED } from './conversation.js';
|
|
12
15
|
export { changeBatchIdentity } from './identity.js';
|
|
16
|
+
export { attempts, identities, intentOf, type Answered, type Attempt, type Attempts, type Identities, } from './attempt.js';
|
|
17
|
+
export { expectedList, expecting, type ExpectedOf, type Expecting } from './expectation.js';
|
|
13
18
|
export type { RuntimeShell } from './durability.js';
|
|
14
19
|
export type { AttentionEntry, SyncStatus } from './status.js';
|
|
15
20
|
export type { Backlink, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, Predicate, QueryDocument, QueryGroup, QueryResult, Related, Select, Value, Where, } from './query.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAg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EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,UAAU,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5F,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
+
export { departure } from './change.js';
|
|
2
|
+
export { SESSION_STARTED } from './conversation.js';
|
|
1
3
|
export { changeBatchIdentity } from './identity.js';
|
|
4
|
+
export { attempts, identities, intentOf, } from './attempt.js';
|
|
5
|
+
export { expectedList, expecting } from './expectation.js';
|
package/dist/memory.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ModelResult } from './model.js';
|
|
2
|
-
import { type AcceptedMessage, type ActionResult, type Adapter, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type ListedConversation, type Member, type ProviderLimit, type Retention, type
|
|
2
|
+
import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode } from './adapter.js';
|
|
3
3
|
export type MemoryRoom = DiscoveredRoom & {
|
|
4
4
|
model?: ModelResult;
|
|
5
5
|
selectionModel?: ModelResult;
|
|
6
6
|
documents?: Readonly<Record<string, string>>;
|
|
7
7
|
revisions?: Readonly<Record<string, string>>;
|
|
8
8
|
changes?: Readonly<Record<string, HeadChange>>;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
binaryFiles?: Readonly<Record<string, BinaryFile>>;
|
|
10
|
+
blobs?: Readonly<Record<string, Blob>>;
|
|
11
11
|
};
|
|
12
12
|
export type MemoryConversation = {
|
|
13
13
|
conversation: string;
|
|
@@ -25,6 +25,7 @@ export type MemoryAdapterOptions = {
|
|
|
25
25
|
retention?: Retention;
|
|
26
26
|
member?: Member;
|
|
27
27
|
unopened?: boolean;
|
|
28
|
+
exhaustiveDiscovery?: true;
|
|
28
29
|
};
|
|
29
30
|
export type MemoryAdapter = Adapter & {
|
|
30
31
|
setRooms(rooms: readonly MemoryRoom[]): void;
|
package/dist/memory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,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ED
|
@@ -55,6 +55,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
55
55
|
const scripted = new Map();
|
|
56
56
|
const unsealed = new Map();
|
|
57
57
|
const sealed = new Set();
|
|
58
|
+
const sentTurns = new Map();
|
|
58
59
|
const historyPageSize = options.historyPageSize;
|
|
59
60
|
let held = [];
|
|
60
61
|
let expiring = [];
|
|
@@ -114,24 +115,23 @@ export function createMemoryAdapter(options = {}) {
|
|
|
114
115
|
const size = pageSize ?? paths.length;
|
|
115
116
|
const taken = paths.slice(from, from + size);
|
|
116
117
|
const next = from + taken.length;
|
|
117
|
-
const targets = opening ? (room.
|
|
118
|
+
const targets = opening ? Object.keys(room.binaryFiles ?? {}) : [];
|
|
118
119
|
return {
|
|
119
120
|
kind: 'bootstrap',
|
|
120
121
|
roomVersion: room.roomVersion,
|
|
121
122
|
...(opening ? { models: modelsOf(room) } : {}),
|
|
122
123
|
documents: named(room.documents ?? {}, taken),
|
|
123
|
-
revisions: named(room.revisions ?? {}, taken),
|
|
124
|
+
revisions: named(room.revisions ?? {}, [...taken, ...targets]),
|
|
124
125
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
125
|
-
|
|
126
|
-
...(opening && room.attachments !== undefined ? { attachments: room.attachments } : {}),
|
|
126
|
+
binaryFiles: named(room.binaryFiles ?? {}, targets),
|
|
127
127
|
...(next < paths.length ? { pageToken: taken.at(-1) } : {}),
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
function advancement(room, from, at) {
|
|
131
131
|
const current = room.documents ?? {};
|
|
132
132
|
const previous = from.documents ?? {};
|
|
133
|
-
const currentTargets = new Set(room.
|
|
134
|
-
const previousTargets = new Set(from.
|
|
133
|
+
const currentTargets = new Set(Object.keys(room.binaryFiles ?? {}));
|
|
134
|
+
const previousTargets = new Set(Object.keys(from.binaryFiles ?? {}));
|
|
135
135
|
const headMoved = (path) => room.revisions?.[path] !== from.revisions?.[path] ||
|
|
136
136
|
!sameChange(room.changes?.[path], from.changes?.[path]);
|
|
137
137
|
const changed = Object.keys(current)
|
|
@@ -147,24 +147,21 @@ export function createMemoryAdapter(options = {}) {
|
|
|
147
147
|
const targets = opening
|
|
148
148
|
? [...currentTargets].filter((target) => !previousTargets.has(target) || headMoved(target))
|
|
149
149
|
: [];
|
|
150
|
-
const attachments = room.attachments ?? [];
|
|
151
|
-
const declared = opening && JSON.stringify(attachments) !== JSON.stringify(from.attachments ?? []);
|
|
152
150
|
const models = opening ? changedModels(room, from) : undefined;
|
|
153
151
|
return {
|
|
154
152
|
kind: 'net-advancement',
|
|
155
153
|
roomVersion: room.roomVersion,
|
|
156
154
|
...(models === undefined ? {} : { models }),
|
|
157
155
|
documents: named(current, taken),
|
|
158
|
-
revisions: named(room.revisions ?? {}, taken),
|
|
156
|
+
revisions: named(room.revisions ?? {}, [...taken, ...targets]),
|
|
159
157
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
160
|
-
|
|
158
|
+
binaryFiles: named(room.binaryFiles ?? {}, targets),
|
|
161
159
|
removals: opening
|
|
162
160
|
? [
|
|
163
161
|
...Object.keys(previous).filter((path) => !(path in current) && !currentTargets.has(path)),
|
|
164
162
|
...[...previousTargets].filter((target) => !currentTargets.has(target) && !(target in current)),
|
|
165
163
|
].sort()
|
|
166
164
|
: [],
|
|
167
|
-
...(declared ? { attachments } : {}),
|
|
168
165
|
...(pageToken === undefined ? {} : { pageToken }),
|
|
169
166
|
};
|
|
170
167
|
}
|
|
@@ -224,9 +221,15 @@ export function createMemoryAdapter(options = {}) {
|
|
|
224
221
|
if (outcome !== undefined)
|
|
225
222
|
return outcome;
|
|
226
223
|
if (name === 'conversation.send') {
|
|
224
|
+
const operation = typeof input.operation_id === 'string' ? input.operation_id : null;
|
|
225
|
+
const answered = operation === null ? undefined : sentTurns.get(operation);
|
|
226
|
+
if (answered !== undefined)
|
|
227
|
+
return { kind: 'action', result: { turn: answered } };
|
|
227
228
|
issued += 1;
|
|
228
229
|
const turn = `turn-${issued}`;
|
|
229
230
|
unsealed.set(turn, named);
|
|
231
|
+
if (operation !== null)
|
|
232
|
+
sentTurns.set(operation, turn);
|
|
230
233
|
return { kind: 'action', result: { turn } };
|
|
231
234
|
}
|
|
232
235
|
if (name === 'conversation.cancel') {
|
|
@@ -257,6 +260,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
257
260
|
};
|
|
258
261
|
}
|
|
259
262
|
return {
|
|
263
|
+
...(options.exhaustiveDiscovery === undefined ? {} : { exhaustiveDiscovery: true }),
|
|
260
264
|
setRooms(next) {
|
|
261
265
|
rooms = [...next];
|
|
262
266
|
retain(rooms);
|
|
@@ -344,6 +348,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
344
348
|
observer({ kind: 'closed', revoked: false });
|
|
345
349
|
});
|
|
346
350
|
},
|
|
351
|
+
published() { },
|
|
347
352
|
observe(notify) {
|
|
348
353
|
observers.add(notify);
|
|
349
354
|
queueMicrotask(() => {
|
|
@@ -447,6 +452,30 @@ export function createMemoryAdapter(options = {}) {
|
|
|
447
452
|
};
|
|
448
453
|
}, request);
|
|
449
454
|
},
|
|
455
|
+
async binary(_authorization, request) {
|
|
456
|
+
return resolveScript(scripts.binary, () => {
|
|
457
|
+
if (request.kind === 'reference') {
|
|
458
|
+
return { kind: 'rejected', code: 'unscripted-binary', fields: {}, retryable: false };
|
|
459
|
+
}
|
|
460
|
+
const room = rooms.find((entry) => entry.locator === request.locator);
|
|
461
|
+
if (room === undefined)
|
|
462
|
+
return { kind: 'room-not-readable', locator: request.locator };
|
|
463
|
+
const blob = room.blobs?.[request.path];
|
|
464
|
+
return blob === undefined
|
|
465
|
+
? { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false }
|
|
466
|
+
: { kind: 'binary', blob };
|
|
467
|
+
}, request);
|
|
468
|
+
},
|
|
469
|
+
referrerScope(referrer) {
|
|
470
|
+
if (typeof referrer !== 'object' || referrer === null)
|
|
471
|
+
return null;
|
|
472
|
+
const { room, path, message } = referrer;
|
|
473
|
+
if (typeof message === 'string')
|
|
474
|
+
return { kind: 'conversations' };
|
|
475
|
+
if (typeof room !== 'string')
|
|
476
|
+
return null;
|
|
477
|
+
return { kind: 'room', locator: room, ...(typeof path === 'string' ? { path } : {}) };
|
|
478
|
+
},
|
|
450
479
|
async action(_authorization, request) {
|
|
451
480
|
return resolveScript(scripts.action, () => {
|
|
452
481
|
if (request.name.startsWith('conversation.'))
|
package/dist/outcome.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionResult, AdapterFailure, HistoryResult, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
1
|
+
import type { ActionResult, AdapterFailure, BinaryResult, HistoryResult, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
3
|
type Refused<Kind extends string> = ProviderRefusal & {
|
|
4
4
|
kind: Kind;
|
|
@@ -14,6 +14,16 @@ export type CallResult = {
|
|
|
14
14
|
export type HistoryAnswer = Exclude<HistoryResult, {
|
|
15
15
|
kind: Failure['kind'];
|
|
16
16
|
}> | Failure;
|
|
17
|
+
export type BinaryAnswer = {
|
|
18
|
+
kind: 'binary';
|
|
19
|
+
blob: Blob;
|
|
20
|
+
} | Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
21
|
+
export declare function absentBinary(path: string): BinaryAnswer;
|
|
22
|
+
export declare function binaryAnswer(result: BinaryResult): BinaryAnswer;
|
|
23
|
+
export type Offline = {
|
|
24
|
+
readonly kind: 'offline';
|
|
25
|
+
};
|
|
26
|
+
export declare const OFFLINE: Offline;
|
|
17
27
|
export declare const UNCERTAIN: Failure;
|
|
18
28
|
export declare function undeclared(name: string): CallResult;
|
|
19
29
|
export declare function failure(result: AdapterFailure): Failure;
|
package/dist/outcome.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mapp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|
|
|
1
|
+
export function absentBinary(path) {
|
|
2
|
+
return { kind: 'absent', code: 'binary-file-absent', fields: { path }, retryable: false };
|
|
3
|
+
}
|
|
4
|
+
export function binaryAnswer(result) {
|
|
5
|
+
return result.kind === 'binary' || result.kind === 'rejected' ? result : failure(result);
|
|
6
|
+
}
|
|
7
|
+
export const OFFLINE = { kind: 'offline' };
|
|
1
8
|
export const UNCERTAIN = {
|
|
2
9
|
kind: 'transport-uncertainty',
|
|
3
10
|
code: 'transport-uncertainty',
|
package/dist/overlay.d.ts
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import type { HeadChange } from './adapter.js';
|
|
1
|
+
import type { BinaryFile, HeadChange } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
3
|
export type Heads = {
|
|
4
4
|
revisions: Readonly<Record<string, string>>;
|
|
5
5
|
changes: Readonly<Record<string, HeadChange>>;
|
|
6
6
|
};
|
|
7
|
+
export type HeldBinary = ({
|
|
8
|
+
readonly state: 'accepted';
|
|
9
|
+
} & BinaryFile) | {
|
|
10
|
+
readonly state: 'pending';
|
|
11
|
+
readonly localId: string;
|
|
12
|
+
readonly byteLength: number;
|
|
13
|
+
readonly mediaType: string;
|
|
14
|
+
readonly sha256: string;
|
|
15
|
+
};
|
|
7
16
|
export type Layer = Heads & {
|
|
8
17
|
documents: Readonly<Record<string, string>>;
|
|
9
|
-
|
|
18
|
+
binaries: Readonly<Record<string, HeldBinary>>;
|
|
10
19
|
};
|
|
20
|
+
export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>): Record<string, HeldBinary>;
|
|
21
|
+
export declare function sameBinary(left: HeldBinary | undefined, right: HeldBinary | undefined): boolean;
|
|
11
22
|
export declare function sameChange(left: HeadChange | undefined, right: HeadChange | undefined): boolean;
|
|
12
23
|
export declare function overlay(base: Layer, queue: readonly ChangeBatch[], unapplied?: () => void): Layer;
|
|
13
24
|
export declare function sameLayerText(left: Layer, right: Layer): boolean;
|
package/dist/overlay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAU,WAAW,EAAgB,MAAM,aAAa,CAAC;AAErE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAAG,UAAU,CAAC,GAC7C;IACE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEN,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG;IAC1B,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CAChD,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAA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