@agentshouse/mdruntime 0.1.0-cc7bd7a53214e → 0.1.0-ccd098ff75bbf
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 +24 -11
- package/dist/adapter.d.ts +172 -49
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +1 -9
- package/dist/attached-model.d.ts +15 -0
- package/dist/attached-model.d.ts.map +1 -0
- package/dist/attached-model.js +64 -0
- 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 +18 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +8 -0
- package/dist/bootstrap.d.ts +39 -7
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +187 -45
- package/dist/chain.d.ts +11 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +64 -0
- package/dist/change-set.d.ts +9 -14
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +11 -56
- package/dist/change.d.ts +45 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +34 -0
- package/dist/client.d.ts +37 -15
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +110 -27
- package/dist/collection.d.ts +9 -13
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +46 -56
- package/dist/compile.d.ts +16 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +740 -0
- package/dist/connection.d.ts +62 -25
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +3831 -958
- package/dist/conversation.d.ts +56 -16
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +739 -242
- package/dist/digest.d.ts +7 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +113 -0
- package/dist/durability.d.ts +5 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +19 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +151 -0
- package/dist/expectation.d.ts +21 -0
- package/dist/expectation.d.ts.map +1 -0
- package/dist/expectation.js +70 -0
- package/dist/failure.d.ts +13 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/failure.js +19 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/file.d.ts +2 -10
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -120
- package/dist/fulltext.d.ts +27 -0
- package/dist/fulltext.d.ts.map +1 -0
- package/dist/fulltext.js +368 -0
- package/dist/host.d.ts +15 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +134 -31
- package/dist/identity.d.ts +4 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +16 -1
- package/dist/index.d.ts +20 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/live.d.ts +22 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +123 -0
- package/dist/memory.d.ts +22 -8
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +167 -47
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +90 -0
- package/dist/model.d.ts +17 -14
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +16 -4
- package/dist/name.d.ts +4 -0
- package/dist/name.d.ts.map +1 -0
- package/dist/name.js +122 -0
- package/dist/observation.d.ts +19 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +113 -12
- package/dist/open.d.ts +2 -0
- package/dist/open.d.ts.map +1 -0
- package/dist/open.js +1 -0
- package/dist/opened.d.ts +22 -0
- package/dist/opened.d.ts.map +1 -0
- package/dist/opened.js +107 -0
- package/dist/outcome.d.ts +62 -3
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +67 -1
- package/dist/overlay.d.ts +15 -5
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +136 -180
- package/dist/paths.d.ts +0 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +0 -16
- package/dist/query.d.ts +65 -5
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +122 -40
- package/dist/reach.d.ts +11 -4
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +211 -75
- package/dist/react.d.ts +43 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +54 -0
- package/dist/readiness.d.ts +64 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +33 -0
- package/dist/reads.d.ts +11 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +100 -0
- package/dist/recovery.d.ts +25 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +198 -0
- package/dist/refresh.d.ts +19 -7
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +125 -53
- package/dist/replica.d.ts +59 -33
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +321 -156
- package/dist/room-draft.d.ts +41 -9
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +186 -37
- package/dist/rows.d.ts +37 -34
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +187 -82
- package/dist/save.d.ts +72 -6
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +889 -178
- package/dist/search.d.ts +41 -29
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +37 -105
- package/dist/seed.d.ts +16 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +75 -0
- package/dist/shared.d.ts +16 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +431 -0
- package/dist/status.d.ts +6 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +0 -8
- package/dist/store.d.ts +123 -58
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +359 -344
- package/dist/stored.d.ts +145 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +557 -0
- package/dist/tables.d.ts +354 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +624 -0
- package/dist/turn.d.ts +9 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +75 -0
- package/dist/validation.d.ts +30 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +162 -0
- package/dist/windows.d.ts +22 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +89 -0
- package/dist/wire.d.ts +170 -45
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +69 -46
- package/dist/words.d.ts +19 -0
- package/dist/words.d.ts.map +1 -0
- package/dist/words.js +150 -0
- package/package.json +33 -10
- package/AGENTS.md +0 -215
- package/dist/attachment.d.ts +0 -3
- package/dist/attachment.d.ts.map +0 -1
- package/dist/attachment.js +0 -8
- package/dist/read-side.d.ts +0 -18
- package/dist/read-side.d.ts.map +0 -1
- package/dist/read-side.js +0 -377
package/dist/change.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BinaryFile, HeadChange } from './adapter.js';
|
|
1
2
|
export type Change = {
|
|
2
3
|
readonly kind: 'field';
|
|
3
4
|
readonly path: string;
|
|
@@ -25,6 +26,13 @@ export type Change = {
|
|
|
25
26
|
readonly kind: 'replace';
|
|
26
27
|
readonly path: string;
|
|
27
28
|
readonly content: string;
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: 'binary';
|
|
31
|
+
readonly path: string;
|
|
32
|
+
readonly localId: string;
|
|
33
|
+
readonly byteLength: number;
|
|
34
|
+
readonly mediaType: string;
|
|
35
|
+
readonly sha256: string;
|
|
28
36
|
} | {
|
|
29
37
|
readonly kind: 'move';
|
|
30
38
|
readonly path: string;
|
|
@@ -32,6 +40,32 @@ export type Change = {
|
|
|
32
40
|
} | {
|
|
33
41
|
readonly kind: 'remove';
|
|
34
42
|
readonly path: string;
|
|
43
|
+
} | (Arriving & {
|
|
44
|
+
readonly content: string;
|
|
45
|
+
}) | (Arriving & {
|
|
46
|
+
readonly binary: BinaryFile;
|
|
47
|
+
});
|
|
48
|
+
type Arriving = {
|
|
49
|
+
readonly kind: 'arrival';
|
|
50
|
+
readonly path: string;
|
|
51
|
+
readonly revision?: string;
|
|
52
|
+
readonly fileId?: string;
|
|
53
|
+
readonly change?: HeadChange;
|
|
54
|
+
};
|
|
55
|
+
export type RoomMove = {
|
|
56
|
+
readonly source: {
|
|
57
|
+
readonly room: string;
|
|
58
|
+
readonly baseRoomVersion: string;
|
|
59
|
+
};
|
|
60
|
+
readonly destination: {
|
|
61
|
+
readonly room: string;
|
|
62
|
+
readonly baseRoomVersion: string;
|
|
63
|
+
readonly handle: string;
|
|
64
|
+
};
|
|
65
|
+
readonly moves: readonly {
|
|
66
|
+
readonly path: string;
|
|
67
|
+
readonly to: string;
|
|
68
|
+
}[];
|
|
35
69
|
};
|
|
36
70
|
export type Precondition = {
|
|
37
71
|
readonly kind: 'field';
|
|
@@ -51,6 +85,10 @@ export type Precondition = {
|
|
|
51
85
|
readonly kind: 'revision';
|
|
52
86
|
readonly path: string;
|
|
53
87
|
readonly revision: string;
|
|
88
|
+
} | {
|
|
89
|
+
readonly kind: 'content';
|
|
90
|
+
readonly path: string;
|
|
91
|
+
readonly content: string;
|
|
54
92
|
} | {
|
|
55
93
|
readonly kind: 'present';
|
|
56
94
|
readonly path: string;
|
|
@@ -69,6 +107,13 @@ export type ChangeBatch = {
|
|
|
69
107
|
readonly changes: readonly Change[];
|
|
70
108
|
readonly preconditions: readonly Precondition[];
|
|
71
109
|
readonly writtenBy?: WrittenBy;
|
|
110
|
+
readonly between?: RoomMove;
|
|
72
111
|
};
|
|
73
112
|
export declare function immutable(batch: ChangeBatch): ChangeBatch;
|
|
113
|
+
export declare function partnerOf(batch: ChangeBatch, locator: string): string | null;
|
|
114
|
+
export declare function leaving(batch: ChangeBatch, locator: string): boolean;
|
|
115
|
+
export declare function landing(changes: readonly Change[], index: number, path: string): string | null;
|
|
116
|
+
export declare function departure(changes: readonly Change[], index: number): string;
|
|
117
|
+
export declare function queuedFile(batch: ChangeBatch, path: string, localId: string): number;
|
|
118
|
+
export {};
|
|
74
119
|
//# sourceMappingURL=change.d.ts.map
|
package/dist/change.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change.d.ts","sourceRoot":"","sources":["../src/change.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GACd;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC5E;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC5E;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAA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M,GAAG,MAAM,GAAG,IAAI,CAQ9F;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAM3E;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOpF"}
|
package/dist/change.js
CHANGED
|
@@ -11,3 +11,37 @@ function frozen(value) {
|
|
|
11
11
|
export function immutable(batch) {
|
|
12
12
|
return frozen(batch);
|
|
13
13
|
}
|
|
14
|
+
export function partnerOf(batch, locator) {
|
|
15
|
+
const between = batch.between;
|
|
16
|
+
if (between === undefined)
|
|
17
|
+
return null;
|
|
18
|
+
return between.source.room === locator ? between.destination.room : between.source.room;
|
|
19
|
+
}
|
|
20
|
+
export function leaving(batch, locator) {
|
|
21
|
+
return batch.between?.source.room === locator;
|
|
22
|
+
}
|
|
23
|
+
export function landing(changes, index, path) {
|
|
24
|
+
let at = path;
|
|
25
|
+
for (const change of changes.slice(index + 1)) {
|
|
26
|
+
if (change.path !== at)
|
|
27
|
+
continue;
|
|
28
|
+
if (change.kind === 'remove')
|
|
29
|
+
return null;
|
|
30
|
+
if (change.kind === 'move')
|
|
31
|
+
at = change.to;
|
|
32
|
+
}
|
|
33
|
+
return at;
|
|
34
|
+
}
|
|
35
|
+
export function departure(changes, index) {
|
|
36
|
+
let at = changes[index].path;
|
|
37
|
+
for (const change of changes.slice(0, index).reverse()) {
|
|
38
|
+
if (change.kind === 'move' && change.to === at)
|
|
39
|
+
at = change.path;
|
|
40
|
+
}
|
|
41
|
+
return at;
|
|
42
|
+
}
|
|
43
|
+
export function queuedFile(batch, path, localId) {
|
|
44
|
+
return batch.changes.findIndex((change, index) => change.kind === 'binary' &&
|
|
45
|
+
change.localId === localId &&
|
|
46
|
+
landing(batch.changes, index, change.path) === path);
|
|
47
|
+
}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import type { AppRoom, ConnectionRefusal, HistoryQuery,
|
|
2
|
-
import type {
|
|
3
|
-
import type { ChatDraft, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
|
|
1
|
+
import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
|
|
2
|
+
import type { Member, ServiceMode } from './adapter.js';
|
|
3
|
+
import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
|
|
4
4
|
import { type Observation } from './observation.js';
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
5
|
+
import type { ChosenFile } from './file.js';
|
|
6
|
+
import type { BinaryAnswer, BinaryLinkAnswer, CallResult, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
|
|
7
|
+
import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
|
|
7
8
|
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
8
9
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
10
|
+
import type { Readiness } from './readiness.js';
|
|
9
11
|
import type { SyncStatus } from './status.js';
|
|
10
12
|
import { type RuntimePort } from './wire.js';
|
|
11
13
|
export type MdRuntimeClient = {
|
|
12
14
|
rooms(): Promise<readonly AppRoom[]>;
|
|
13
15
|
query: {
|
|
14
|
-
(query: DocumentQuery): Promise<DocumentResult>;
|
|
15
|
-
(query: GroupQuery): Promise<GroupResult>;
|
|
16
|
+
(query: DocumentQuery): Promise<DocumentResult | PendingResult>;
|
|
17
|
+
(query: GroupQuery): Promise<GroupResult | PendingResult>;
|
|
16
18
|
};
|
|
17
19
|
search(request: SearchRequest): Promise<SearchResult>;
|
|
18
|
-
types(locator: string): Promise<
|
|
20
|
+
types(locator: string): Promise<RoomSchemas>;
|
|
19
21
|
roomDraft: {
|
|
20
22
|
list(): Promise<readonly RoomDraft[]>;
|
|
21
23
|
read(room: string, path: string): Promise<RoomDraft | null>;
|
|
22
|
-
write(room: string, path: string, revision: string | null, parts: RoomDraftParts): Promise<RoomDraftWrite>;
|
|
24
|
+
write(room: string, path: string, revision: string | null, parts: RoomDraftParts, next?: string): Promise<RoomDraftWrite>;
|
|
23
25
|
discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
|
|
24
26
|
};
|
|
25
27
|
save(room: string, roomDrafts: readonly SavedRoomDraft[]): Promise<SaveResult>;
|
|
28
|
+
saveParts(room: string, parts: readonly SavedParts[]): Promise<SaveResult>;
|
|
26
29
|
presentation: {
|
|
27
30
|
read(): Promise<unknown>;
|
|
28
31
|
write(value: unknown): Promise<void>;
|
|
32
|
+
edit(members: Readonly<Record<string, unknown>>): Promise<void>;
|
|
29
33
|
};
|
|
30
34
|
conversation: {
|
|
31
35
|
list(): Promise<readonly ConversationEntry[]>;
|
|
32
36
|
read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
|
|
33
37
|
create(input: unknown): Promise<CallResult>;
|
|
34
|
-
send(conversation: string): Promise<CallResult>;
|
|
38
|
+
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
39
|
+
attach(room: string, file: ChosenFile): Promise<CallResult | Offline>;
|
|
35
40
|
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
36
41
|
interrupt(conversation: string): Promise<CallResult>;
|
|
37
42
|
kill(conversation: string): Promise<CallResult>;
|
|
@@ -39,31 +44,48 @@ export type MdRuntimeClient = {
|
|
|
39
44
|
delete(conversation: string): Promise<CallResult>;
|
|
40
45
|
};
|
|
41
46
|
chatDraft: {
|
|
42
|
-
write(conversation: string, draft: ChatDraft): Promise<void>;
|
|
47
|
+
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
48
|
+
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
43
49
|
discard(conversation: string): Promise<void>;
|
|
44
50
|
};
|
|
45
|
-
history(locator: string, path: string, query?: HistoryQuery): Promise<
|
|
51
|
+
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
52
|
+
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
53
|
+
binaryFile: {
|
|
54
|
+
read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
|
|
55
|
+
link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
|
|
56
|
+
};
|
|
46
57
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
47
58
|
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
48
59
|
log(): Promise<string>;
|
|
49
60
|
persistence(): Promise<boolean>;
|
|
61
|
+
retry(): Promise<void>;
|
|
62
|
+
cleanUp(): Promise<number>;
|
|
50
63
|
observe: {
|
|
51
64
|
(topic: 'deployment-facts'): Promise<Observation<unknown>>;
|
|
52
65
|
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
66
|
+
(topic: 'readiness'): Promise<Observation<Readiness>>;
|
|
53
67
|
(topic: 'connection-refusal'): Promise<Observation<ConnectionRefusal | null>>;
|
|
54
68
|
(topic: 'storage-loss'): Promise<Observation<string | null>>;
|
|
55
69
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
56
70
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
57
|
-
(topic: '
|
|
58
|
-
(topic: 'query', query:
|
|
71
|
+
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
72
|
+
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
73
|
+
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
59
74
|
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
60
75
|
(topic: 'room-drafts'): Promise<Observation<readonly RoomDraft[]>>;
|
|
61
76
|
(topic: 'presentation'): Promise<Observation<unknown>>;
|
|
62
77
|
(topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
|
|
78
|
+
(topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
|
|
79
|
+
(topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
|
|
63
80
|
};
|
|
64
81
|
reauthorize(): Promise<void>;
|
|
82
|
+
settled(): Promise<void>;
|
|
65
83
|
};
|
|
66
84
|
export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
|
|
85
|
+
export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
|
|
86
|
+
export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
|
|
87
|
+
export { roomDraftRevision } from './identity.js';
|
|
67
88
|
export type { Observation } from './observation.js';
|
|
68
|
-
export type {
|
|
89
|
+
export type { Open } from './open.js';
|
|
90
|
+
export { unanswered, type RuntimePort, type WireMember } from './wire.js';
|
|
69
91
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAY,KAAK,WAAW,EAAiB,MAAM,kBAAkB,CAAC;AAE7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,K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W,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { observed } from './observation.js';
|
|
2
|
-
import {
|
|
2
|
+
import { runtimeError } from './failure.js';
|
|
3
|
+
import { answer, AUTHORIZATION_ENDED, PORT_CLOSED, } from './wire.js';
|
|
4
|
+
// React renders an arrived value in a later task and opens what that render observes as it commits, so this many frames opening nothing mean the page drew what it observes.
|
|
5
|
+
const SETTLED_FRAMES = 2;
|
|
6
|
+
function refused(refusal) {
|
|
7
|
+
return runtimeError(refusal.code, refusal.code, refusal.retryable);
|
|
8
|
+
}
|
|
3
9
|
export function connectMdRuntime(port) {
|
|
4
10
|
let sequence = 0;
|
|
5
11
|
let refusal = null;
|
|
@@ -7,8 +13,10 @@ export function connectMdRuntime(port) {
|
|
|
7
13
|
const calls = new Map();
|
|
8
14
|
const opening = new Map();
|
|
9
15
|
const observations = new Map();
|
|
16
|
+
let drawing = null;
|
|
17
|
+
let settling = null;
|
|
10
18
|
const send = (message) => {
|
|
11
|
-
port.postMessage(
|
|
19
|
+
port.postMessage(message);
|
|
12
20
|
};
|
|
13
21
|
function begin(id, topic, first) {
|
|
14
22
|
const handle = observed(first, () => {
|
|
@@ -25,7 +33,7 @@ export function connectMdRuntime(port) {
|
|
|
25
33
|
if (topic === 'connection-refusal')
|
|
26
34
|
handle.receive(reported);
|
|
27
35
|
}
|
|
28
|
-
const failure =
|
|
36
|
+
const failure = refused(reported);
|
|
29
37
|
for (const [id, waiting] of opening) {
|
|
30
38
|
if (waiting.topic === 'connection-refusal')
|
|
31
39
|
waiting.settle(begin(id, waiting.topic, reported));
|
|
@@ -36,12 +44,12 @@ export function connectMdRuntime(port) {
|
|
|
36
44
|
for (const waiting of calls.values())
|
|
37
45
|
waiting.fail(failure);
|
|
38
46
|
calls.clear();
|
|
47
|
+
drawing?.();
|
|
39
48
|
}
|
|
40
|
-
function end(
|
|
49
|
+
function end(failure) {
|
|
41
50
|
if (ended !== null)
|
|
42
51
|
return;
|
|
43
|
-
ended =
|
|
44
|
-
const failure = new Error(reason);
|
|
52
|
+
ended = failure;
|
|
45
53
|
for (const waiting of opening.values())
|
|
46
54
|
waiting.fail(failure);
|
|
47
55
|
opening.clear();
|
|
@@ -51,16 +59,10 @@ export function connectMdRuntime(port) {
|
|
|
51
59
|
for (const { handle } of observations.values())
|
|
52
60
|
handle.end();
|
|
53
61
|
observations.clear();
|
|
62
|
+
drawing?.();
|
|
54
63
|
}
|
|
55
64
|
port.addEventListener('message', (event) => {
|
|
56
|
-
const
|
|
57
|
-
if (wire === null)
|
|
58
|
-
return;
|
|
59
|
-
if (!wire.matching) {
|
|
60
|
-
refuse(PROTOCOL_MISMATCH);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const message = answer(wire.message);
|
|
65
|
+
const message = answer(event.data);
|
|
64
66
|
if (message === null)
|
|
65
67
|
return;
|
|
66
68
|
if (message.kind === 'refusal') {
|
|
@@ -68,7 +70,11 @@ export function connectMdRuntime(port) {
|
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
72
|
if (message.kind === 'ended') {
|
|
71
|
-
|
|
73
|
+
for (const { topic, handle } of observations.values()) {
|
|
74
|
+
if (topic === 'member')
|
|
75
|
+
handle.receive(null);
|
|
76
|
+
}
|
|
77
|
+
end(runtimeError('authorization-ended', AUTHORIZATION_ENDED));
|
|
72
78
|
return;
|
|
73
79
|
}
|
|
74
80
|
if (message.kind === 'event') {
|
|
@@ -78,31 +84,34 @@ export function connectMdRuntime(port) {
|
|
|
78
84
|
const waiting = opening.get(message.id);
|
|
79
85
|
if (waiting !== undefined) {
|
|
80
86
|
opening.delete(message.id);
|
|
81
|
-
if (message.kind === 'failure')
|
|
82
|
-
waiting.fail(
|
|
87
|
+
if (message.kind === 'failure') {
|
|
88
|
+
waiting.fail(runtimeError(message.code, message.message, message.retryable));
|
|
89
|
+
}
|
|
83
90
|
else
|
|
84
91
|
waiting.settle(begin(message.id, waiting.topic, message.value));
|
|
92
|
+
drawing?.();
|
|
85
93
|
return;
|
|
86
94
|
}
|
|
87
95
|
const called = calls.get(message.id);
|
|
88
96
|
if (called === undefined)
|
|
89
97
|
return;
|
|
90
98
|
calls.delete(message.id);
|
|
91
|
-
if (message.kind === 'failure')
|
|
92
|
-
called.fail(
|
|
99
|
+
if (message.kind === 'failure') {
|
|
100
|
+
called.fail(runtimeError(message.code, message.message, message.retryable));
|
|
101
|
+
}
|
|
93
102
|
else
|
|
94
103
|
called.settle(message.value);
|
|
95
104
|
});
|
|
96
105
|
port.addEventListener('close', () => {
|
|
97
|
-
end(PORT_CLOSED);
|
|
106
|
+
end(runtimeError('port-closed', PORT_CLOSED));
|
|
98
107
|
});
|
|
99
108
|
port.start();
|
|
100
109
|
send({ kind: 'hello' });
|
|
101
110
|
function ask(member, input) {
|
|
102
111
|
if (ended !== null)
|
|
103
|
-
return Promise.reject(
|
|
112
|
+
return Promise.reject(ended);
|
|
104
113
|
if (refusal !== null)
|
|
105
|
-
return Promise.reject(
|
|
114
|
+
return Promise.reject(refused(refusal));
|
|
106
115
|
const id = (sequence += 1);
|
|
107
116
|
return new Promise((settle, fail) => {
|
|
108
117
|
calls.set(id, { settle: settle, fail });
|
|
@@ -111,18 +120,71 @@ export function connectMdRuntime(port) {
|
|
|
111
120
|
}
|
|
112
121
|
function watch(topic, input) {
|
|
113
122
|
if (ended !== null)
|
|
114
|
-
return Promise.reject(
|
|
123
|
+
return Promise.reject(ended);
|
|
115
124
|
const id = (sequence += 1);
|
|
116
125
|
if (refusal !== null) {
|
|
117
126
|
return topic === 'connection-refusal'
|
|
118
127
|
? Promise.resolve(begin(id, topic, refusal))
|
|
119
|
-
: Promise.reject(
|
|
128
|
+
: Promise.reject(refused(refusal));
|
|
120
129
|
}
|
|
121
130
|
return new Promise((settle, fail) => {
|
|
122
131
|
opening.set(id, { topic, settle, fail });
|
|
123
132
|
send({ kind: 'observe', id, topic, input });
|
|
133
|
+
drawing?.();
|
|
124
134
|
});
|
|
125
135
|
}
|
|
136
|
+
function streamed(answer) {
|
|
137
|
+
if (answer.kind !== 'binary')
|
|
138
|
+
return answer;
|
|
139
|
+
const { file, byteLength, mediaType } = answer;
|
|
140
|
+
let part = 0;
|
|
141
|
+
let received = 0;
|
|
142
|
+
const stream = new ReadableStream({
|
|
143
|
+
async pull(controller) {
|
|
144
|
+
const bytes = await ask('binaryFile.part', [file, part]);
|
|
145
|
+
if (bytes === null) {
|
|
146
|
+
if (received === byteLength)
|
|
147
|
+
controller.close();
|
|
148
|
+
else
|
|
149
|
+
controller.error(runtimeError('binary-file-absent', 'The file ended early'));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
part += 1;
|
|
153
|
+
received += bytes.byteLength;
|
|
154
|
+
controller.enqueue(bytes);
|
|
155
|
+
},
|
|
156
|
+
}, { highWaterMark: 0 });
|
|
157
|
+
return { kind: 'binary', stream, byteLength, mediaType };
|
|
158
|
+
}
|
|
159
|
+
function settled() {
|
|
160
|
+
if (settling !== null)
|
|
161
|
+
return settling;
|
|
162
|
+
settling = new Promise((resolve) => {
|
|
163
|
+
let moved = 0;
|
|
164
|
+
const check = () => {
|
|
165
|
+
moved += 1;
|
|
166
|
+
if (opening.size > 0)
|
|
167
|
+
return;
|
|
168
|
+
const at = moved;
|
|
169
|
+
const waited = (frames) => {
|
|
170
|
+
requestAnimationFrame(() => {
|
|
171
|
+
if (frames < SETTLED_FRAMES) {
|
|
172
|
+
waited(frames + 1);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (moved !== at || opening.size > 0)
|
|
176
|
+
return;
|
|
177
|
+
drawing = null;
|
|
178
|
+
resolve();
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
waited(1);
|
|
182
|
+
};
|
|
183
|
+
drawing = check;
|
|
184
|
+
check();
|
|
185
|
+
});
|
|
186
|
+
return settling;
|
|
187
|
+
}
|
|
126
188
|
return {
|
|
127
189
|
rooms: () => ask('rooms', []),
|
|
128
190
|
query: ((query) => ask('query', [query])),
|
|
@@ -131,19 +193,22 @@ export function connectMdRuntime(port) {
|
|
|
131
193
|
roomDraft: {
|
|
132
194
|
list: () => ask('roomDraft.list', []),
|
|
133
195
|
read: (room, path) => ask('roomDraft.read', [room, path]),
|
|
134
|
-
write: (room, path, revision, parts) => ask('roomDraft.write', [room, path, revision, parts]),
|
|
196
|
+
write: (room, path, revision, parts, next) => ask('roomDraft.write', next === undefined ? [room, path, revision, parts] : [room, path, revision, parts, next]),
|
|
135
197
|
discard: (room, path, revision) => ask('roomDraft.discard', [room, path, revision]),
|
|
136
198
|
},
|
|
137
199
|
save: (room, roomDrafts) => ask('save', [room, roomDrafts]),
|
|
200
|
+
saveParts: (room, parts) => ask('saveParts', [room, parts]),
|
|
138
201
|
presentation: {
|
|
139
202
|
read: () => ask('presentation.read', []),
|
|
140
203
|
write: (value) => ask('presentation.write', [value]),
|
|
204
|
+
edit: (members) => ask('presentation.edit', [members]),
|
|
141
205
|
},
|
|
142
206
|
conversation: {
|
|
143
207
|
list: () => ask('conversation.list', []),
|
|
144
208
|
read: (conversation, options) => ask('conversation.read', [conversation, options]),
|
|
145
209
|
create: (input) => ask('conversation.create', [input]),
|
|
146
|
-
send: (conversation) => ask('conversation.send', [conversation]),
|
|
210
|
+
send: (conversation, operation, draft) => ask('conversation.send', [conversation, operation, draft]),
|
|
211
|
+
attach: (room, file) => ask('conversation.attach', [room, file]),
|
|
147
212
|
answer: (conversation, answer) => ask('conversation.answer', [conversation, answer]),
|
|
148
213
|
interrupt: (conversation) => ask('conversation.interrupt', [conversation]),
|
|
149
214
|
kill: (conversation) => ask('conversation.kill', [conversation]),
|
|
@@ -151,15 +216,33 @@ export function connectMdRuntime(port) {
|
|
|
151
216
|
delete: (conversation) => ask('conversation.delete', [conversation]),
|
|
152
217
|
},
|
|
153
218
|
chatDraft: {
|
|
154
|
-
write: (conversation, draft) => ask('chatDraft.write', [conversation, draft]),
|
|
219
|
+
write: (conversation, draft, revision) => ask('chatDraft.write', [conversation, draft, revision]),
|
|
220
|
+
prepend: (conversation, draft) => ask('chatDraft.prepend', [conversation, draft]),
|
|
155
221
|
discard: (conversation) => ask('chatDraft.discard', [conversation]),
|
|
156
222
|
},
|
|
157
223
|
history: (locator, path, query) => ask('history', [locator, path, query]),
|
|
224
|
+
resolve: (room, path, destination) => ask('resolve', [room, path, destination]),
|
|
225
|
+
binaryFile: {
|
|
226
|
+
read: (room, path, revision) => ask('binaryFile.read', [room, path, revision]).then(streamed),
|
|
227
|
+
link: (room, path, revision) => ask('binaryFile.link', [room, path, revision]),
|
|
228
|
+
},
|
|
158
229
|
call: (name, input) => ask('call', [name, input]),
|
|
159
230
|
reached: (locator, roomVersion, path) => ask('reached', [locator, roomVersion, path]),
|
|
160
231
|
log: () => ask('log', []),
|
|
161
232
|
persistence: () => ask('persistence', []),
|
|
233
|
+
retry: () => ask('retry', []),
|
|
234
|
+
cleanUp: () => ask('cleanUp', []),
|
|
162
235
|
observe: ((topic, ...input) => watch(topic, input)),
|
|
163
236
|
reauthorize: () => ask('reauthorize', []),
|
|
237
|
+
settled,
|
|
164
238
|
};
|
|
165
239
|
}
|
|
240
|
+
const turns = new WeakMap();
|
|
241
|
+
export function inTurn(client, work) {
|
|
242
|
+
const turn = (turns.get(client) ?? Promise.resolve()).then(work);
|
|
243
|
+
turns.set(client, turn.then(() => undefined, () => undefined));
|
|
244
|
+
return turn;
|
|
245
|
+
}
|
|
246
|
+
export { chainedWindows } from './chain.js';
|
|
247
|
+
export { roomDraftRevision } from './identity.js';
|
|
248
|
+
export { unanswered } from './wire.js';
|
package/dist/collection.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { type Document
|
|
1
|
+
import { type Document } from '@agentshouse/mdmodel';
|
|
2
2
|
import type { ModelState } from './model.js';
|
|
3
3
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
|
+
import { type Paths } from './shared.js';
|
|
4
5
|
import type { Refused } from './transfer.js';
|
|
5
6
|
export declare const MD_MODEL: MdModelIdentity;
|
|
6
7
|
export type Collection = {
|
|
7
|
-
|
|
8
|
+
text: Readonly<Record<string, string>>;
|
|
8
9
|
composition: Composition;
|
|
10
|
+
document(path: string): Document | undefined;
|
|
9
11
|
};
|
|
10
12
|
export type Composition = {
|
|
11
13
|
model: ModelState;
|
|
@@ -14,17 +16,11 @@ export type Composition = {
|
|
|
14
16
|
model: ModelState;
|
|
15
17
|
} | null;
|
|
16
18
|
};
|
|
19
|
+
export declare function selected(composition: Composition, path: string): boolean;
|
|
17
20
|
export declare function governing(composition: Composition, path: string): ModelState;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
export declare function parseCollection(text: Readonly<Record<string, string>>, composition: Composition, previous?: Previous): Collection;
|
|
23
|
-
export declare function readCollection(text: Readonly<Record<string, string>>, composition: Composition, previous?: Previous): {
|
|
24
|
-
kind: 'read';
|
|
25
|
-
collection: Collection;
|
|
26
|
-
} | Refused;
|
|
21
|
+
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
|
|
22
|
+
export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
|
|
23
|
+
export declare function unreadable(text: Paths<string>, paths?: Iterable<string> | null): Generator<number, Refused | null, void>;
|
|
27
24
|
export declare function validRoot(root: unknown): root is string;
|
|
28
|
-
export declare function
|
|
29
|
-
export {};
|
|
25
|
+
export declare function available(composition: Composition): boolean;
|
|
30
26
|
//# 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,EAAkB,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAsB,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,eAAO,MAAM,QAAQ,EAAE,eAAwE,CAAC;AAEhG,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE;QAAE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,GAAG,IAAI,CAAC;CACnE,CAAC;AAEF,wBAAgB,QAAQ,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAKxE;AAED,wBAAgB,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAI5E;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACtC,WAAW,EAAE,WAAW,GACvB,UAAU,CAcZ;AAED,wBAAiB,WAAW,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