@agentshouse/mdruntime 0.1.0-c2c52158b7381 → 0.1.0-c2ef9303a058d
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 +11 -9
- package/dist/adapter.d.ts +107 -70
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +5 -11
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +36 -47
- package/dist/binary.d.ts +0 -5
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +1 -1
- package/dist/bootstrap.d.ts +26 -11
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +177 -130
- package/dist/chain.d.ts +12 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +64 -0
- package/dist/change-set.d.ts +6 -16
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +11 -90
- package/dist/client.d.ts +16 -12
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +57 -8
- package/dist/collection.d.ts +10 -21
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +39 -372
- package/dist/compile.d.ts +11 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +586 -0
- package/dist/connection.d.ts +16 -14
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +2331 -1524
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/{chat/context.js → context.js} +1 -4
- package/dist/conversation.d.ts +18 -15
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +271 -174
- package/dist/durability.d.ts +6 -4
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +5 -3
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +32 -29
- package/dist/file.d.ts +2 -11
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +6 -4
- package/dist/host.d.ts +3 -7
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +55 -38
- package/dist/identity.d.ts +0 -2
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -6
- package/dist/index.d.ts +15 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/job.d.ts +14 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +28 -0
- package/dist/live.d.ts +23 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +127 -0
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +13 -6
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +221 -101
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +89 -0
- package/dist/model.d.ts +8 -8
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -13
- package/dist/observation.d.ts +15 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +91 -2
- package/dist/outcome.d.ts +13 -6
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +16 -5
- package/dist/overlay.d.ts +0 -3
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +2 -152
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/query.d.ts +10 -206
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -494
- package/dist/reach.d.ts +14 -9
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +99 -107
- package/dist/react.d.ts +3 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +14 -17
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +2 -8
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +26 -0
- package/dist/refresh.d.ts +18 -15
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +139 -77
- package/dist/replica.d.ts +58 -38
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +291 -217
- package/dist/room-draft.d.ts +22 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +131 -51
- package/dist/rows.d.ts +31 -31
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +59 -123
- package/dist/save.d.ts +11 -10
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +72 -64
- package/dist/search.d.ts +12 -95
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +10 -317
- package/dist/shared.d.ts +0 -4
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +1 -41
- package/dist/status.d.ts +4 -3
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -1
- package/dist/store.d.ts +77 -97
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +142 -547
- package/dist/stored.d.ts +129 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +524 -0
- package/dist/tables.d.ts +255 -170
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +204 -23
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/turn.d.ts +1 -1
- package/dist/turn.d.ts.map +1 -1
- package/dist/turn.js +28 -20
- package/dist/validation.d.ts +29 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +104 -0
- package/dist/windows.d.ts +1 -11
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -70
- package/dist/wire.d.ts +14 -9
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +5 -3
- package/package.json +14 -19
- package/AGENTS.md +0 -308
- package/dist/chat/acts.d.ts +0 -33
- package/dist/chat/acts.d.ts.map +0 -1
- package/dist/chat/acts.js +0 -36
- package/dist/chat/context.d.ts +0 -3
- package/dist/chat/context.d.ts.map +0 -1
- package/dist/chat/earlier.d.ts +0 -10
- package/dist/chat/earlier.d.ts.map +0 -1
- package/dist/chat/earlier.js +0 -54
- package/dist/chat/house.d.ts +0 -25
- package/dist/chat/house.d.ts.map +0 -1
- package/dist/chat/house.js +0 -38
- package/dist/chat/input.d.ts +0 -11
- package/dist/chat/input.d.ts.map +0 -1
- package/dist/chat/input.js +0 -92
- package/dist/chat/kit.d.ts +0 -61
- package/dist/chat/kit.d.ts.map +0 -1
- package/dist/chat/kit.js +0 -123
- package/dist/chat/lasting.d.ts +0 -6
- package/dist/chat/lasting.d.ts.map +0 -1
- package/dist/chat/lasting.js +0 -19
- package/dist/chat/list.d.ts +0 -28
- package/dist/chat/list.d.ts.map +0 -1
- package/dist/chat/list.js +0 -103
- package/dist/chat/markdown.d.ts +0 -21
- package/dist/chat/markdown.d.ts.map +0 -1
- package/dist/chat/markdown.js +0 -246
- package/dist/chat/message.d.ts +0 -7
- package/dist/chat/message.d.ts.map +0 -1
- package/dist/chat/message.js +0 -237
- package/dist/chat/messages.d.ts +0 -29
- package/dist/chat/messages.d.ts.map +0 -1
- package/dist/chat/messages.js +0 -190
- package/dist/chat/name.d.ts +0 -7
- package/dist/chat/name.d.ts.map +0 -1
- package/dist/chat/name.js +0 -37
- package/dist/chat/opened.d.ts +0 -12
- package/dist/chat/opened.d.ts.map +0 -1
- package/dist/chat/opened.js +0 -19
- package/dist/chat/overlay.d.ts +0 -32
- package/dist/chat/overlay.d.ts.map +0 -1
- package/dist/chat/overlay.js +0 -103
- package/dist/chat/parts.d.ts +0 -58
- package/dist/chat/parts.d.ts.map +0 -1
- package/dist/chat/parts.js +0 -120
- package/dist/chat/pieces.d.ts +0 -62
- package/dist/chat/pieces.d.ts.map +0 -1
- package/dist/chat/pieces.js +0 -1110
- package/dist/chat/process.d.ts +0 -20
- package/dist/chat/process.d.ts.map +0 -1
- package/dist/chat/process.js +0 -32
- package/dist/chat/provider.d.ts +0 -68
- package/dist/chat/provider.d.ts.map +0 -1
- package/dist/chat/provider.js +0 -619
- package/dist/chat/question.d.ts +0 -9
- package/dist/chat/question.d.ts.map +0 -1
- package/dist/chat/question.js +0 -69
- package/dist/chat/questions.d.ts +0 -31
- package/dist/chat/questions.d.ts.map +0 -1
- package/dist/chat/questions.js +0 -111
- package/dist/chat/read.d.ts +0 -5
- package/dist/chat/read.d.ts.map +0 -1
- package/dist/chat/read.js +0 -13
- package/dist/chat/ready.d.ts +0 -37
- package/dist/chat/ready.d.ts.map +0 -1
- package/dist/chat/ready.js +0 -93
- package/dist/chat/room-file.d.ts +0 -8
- package/dist/chat/room-file.d.ts.map +0 -1
- package/dist/chat/room-file.js +0 -72
- package/dist/chat/steady.d.ts +0 -3
- package/dist/chat/steady.d.ts.map +0 -1
- package/dist/chat/steady.js +0 -26
- package/dist/chat/style.d.ts +0 -4
- package/dist/chat/style.d.ts.map +0 -1
- package/dist/chat/style.js +0 -306
- package/dist/chat.d.ts +0 -15
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js +0 -8
- package/dist/read-side.d.ts +0 -27
- package/dist/read-side.d.ts.map +0 -1
- package/dist/read-side.js +0 -1179
- package/dist/reads.d.ts +0 -11
- package/dist/reads.d.ts.map +0 -1
- package/dist/reads.js +0 -98
package/dist/change-set.js
CHANGED
|
@@ -1,106 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { changedPaths, sameBinary, sameChange } from './overlay.js';
|
|
4
|
-
import { beneath } from './paths.js';
|
|
5
|
-
import { compositionOf, sameMembership } from './replica.js';
|
|
6
|
-
import { markdownPath, rowsOf } from './rows.js';
|
|
7
|
-
import { keysIn } from './shared.js';
|
|
8
|
-
import { finished, ROW_WEIGHT } from './turn.js';
|
|
9
|
-
function rowsAt(locator, replica, path) {
|
|
10
|
-
if (replica === null)
|
|
11
|
-
return [];
|
|
12
|
-
const visible = replica.visible;
|
|
13
|
-
const document = markdownPath(path) ? passingFrontmatter(visible.collection, path) : null;
|
|
14
|
-
const held = visible.documents[path] !== undefined && document !== undefined;
|
|
15
|
-
const binary = visible.binaries[path];
|
|
16
|
-
if (!held && binary === undefined)
|
|
17
|
-
return [];
|
|
18
|
-
return rowsOf(locator, path, document ?? null, compositionOf(replica.confirmed.record), visible.changes[path] ?? null, visible.fileIds[path] ?? null, binary === undefined ? null : binaryRecord(path, binary, visible.revisions[path]));
|
|
19
|
-
}
|
|
20
|
-
function modelShape(model) {
|
|
21
|
-
return model.status === 'unavailable' ? 'unavailable' : JSON.stringify(model.types);
|
|
22
|
-
}
|
|
23
|
-
export function changeSet(locator, before, after, changed = {}) {
|
|
24
|
-
return finished(changing(locator, before, after, changed));
|
|
25
|
-
}
|
|
26
|
-
export function* changing(locator, before, after, changed = {}) {
|
|
27
|
-
const documents = [];
|
|
28
|
-
const oldRoom = before?.confirmed.record;
|
|
29
|
-
const newRoom = after?.confirmed.record;
|
|
30
|
-
const collectionChanged = oldRoom !== undefined &&
|
|
31
|
-
newRoom !== undefined &&
|
|
32
|
-
modelShape(oldRoom.model) !== modelShape(newRoom.model);
|
|
33
|
-
const selectionChanged = oldRoom !== undefined &&
|
|
34
|
-
newRoom !== undefined &&
|
|
35
|
-
modelShape(oldRoom.selectionModel) !== modelShape(newRoom.selectionModel);
|
|
36
|
-
const reclassified = oldRoom !== undefined && newRoom !== undefined && !sameMembership(oldRoom, newRoom);
|
|
37
|
-
const paths = before === null || after === null || collectionChanged || selectionChanged || reclassified
|
|
38
|
-
? yield* keysIn(...[before, after].flatMap((replica) => replica === null ? [] : [replica.visible.documents, replica.visible.binaries]))
|
|
39
|
-
: yield* changedPaths(before.visible, after.visible);
|
|
40
|
-
for (const path of paths) {
|
|
41
|
-
yield ROW_WEIGHT;
|
|
42
|
-
if (after?.visible.documents[path] === undefined &&
|
|
43
|
-
after?.visible.binaries[path] === undefined &&
|
|
44
|
-
before?.visible.documents[path] === undefined &&
|
|
45
|
-
before?.visible.binaries[path] === undefined)
|
|
46
|
-
continue;
|
|
47
|
-
const selected = newRoom?.typedSelection?.roots.some((root) => beneath(root, path)) ?? false;
|
|
48
|
-
const retyped = selected ? selectionChanged : collectionChanged;
|
|
49
|
-
if (before?.visible.documents[path] === after?.visible.documents[path] &&
|
|
50
|
-
sameBinary(before?.visible.binaries[path], after?.visible.binaries[path]) &&
|
|
51
|
-
before?.visible.revisions[path] === after?.visible.revisions[path] &&
|
|
52
|
-
before?.visible.fileIds[path] === after?.visible.fileIds[path] &&
|
|
53
|
-
sameChange(before?.visible.changes[path], after?.visible.changes[path]) &&
|
|
54
|
-
!retyped &&
|
|
55
|
-
!reclassified)
|
|
56
|
-
continue;
|
|
57
|
-
documents.push({
|
|
58
|
-
locator,
|
|
59
|
-
path,
|
|
60
|
-
get before() {
|
|
61
|
-
return rowsAt(locator, before, path);
|
|
62
|
-
},
|
|
63
|
-
get after() {
|
|
64
|
-
return rowsAt(locator, after, path);
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
}
|
|
1
|
+
export function changeSet(locator, changed = {}) {
|
|
2
|
+
const documents = changed.documents;
|
|
68
3
|
return {
|
|
69
|
-
documents
|
|
4
|
+
documents: documents === undefined
|
|
5
|
+
? []
|
|
6
|
+
: documents === null
|
|
7
|
+
? [{ locator, path: null }]
|
|
8
|
+
: documents.map((path) => ({ locator, path })),
|
|
70
9
|
drafts: (changed.drafts ?? []).map((path) => ({ locator, path })),
|
|
71
10
|
rooms: changed.room ? [locator] : [],
|
|
72
11
|
queues: changed.queue ? [locator] : [],
|
|
73
12
|
presentations: changed.presentation === undefined ? [] : [changed.presentation],
|
|
74
|
-
messages: [],
|
|
75
|
-
conversations: [],
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
export function entering(locator, replica, paths) {
|
|
79
|
-
return {
|
|
80
|
-
documents: paths.map((path) => ({
|
|
81
|
-
locator,
|
|
82
|
-
path,
|
|
83
|
-
before: [],
|
|
84
|
-
get after() {
|
|
85
|
-
return rowsAt(locator, replica, path);
|
|
86
|
-
},
|
|
87
|
-
})),
|
|
88
|
-
drafts: [],
|
|
89
|
-
rooms: [],
|
|
90
|
-
queues: [],
|
|
91
|
-
presentations: [],
|
|
92
|
-
messages: [],
|
|
93
13
|
conversations: [],
|
|
94
14
|
};
|
|
95
15
|
}
|
|
96
|
-
export function conversationChangeSet(
|
|
16
|
+
export function conversationChangeSet(conversations) {
|
|
97
17
|
return {
|
|
98
18
|
documents: [],
|
|
99
19
|
drafts: [],
|
|
100
20
|
rooms: [],
|
|
101
21
|
queues: [],
|
|
102
22
|
presentations: [],
|
|
103
|
-
messages,
|
|
104
23
|
conversations: [...new Set(conversations)],
|
|
105
24
|
};
|
|
106
25
|
}
|
|
@@ -111,7 +30,9 @@ export function mergeChangeSets(sets) {
|
|
|
111
30
|
rooms: [...new Set(sets.flatMap((set) => set.rooms))],
|
|
112
31
|
queues: [...new Set(sets.flatMap((set) => set.queues))],
|
|
113
32
|
presentations: [...new Set(sets.flatMap((set) => set.presentations))],
|
|
114
|
-
messages: sets.flatMap((set) => set.messages),
|
|
115
33
|
conversations: [...new Set(sets.flatMap((set) => set.conversations))],
|
|
116
34
|
};
|
|
117
35
|
}
|
|
36
|
+
export function touches(set, locator, path) {
|
|
37
|
+
return set.documents.some((change) => change.locator === locator && (change.path === null || change.path === path));
|
|
38
|
+
}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
|
|
1
2
|
import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
|
|
2
3
|
import type { Member, ServiceMode } from './adapter.js';
|
|
3
|
-
import type {
|
|
4
|
+
import type { UnsentWork } from './durability.js';
|
|
5
|
+
import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationView } from './conversation.js';
|
|
4
6
|
import { type Observation } from './observation.js';
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type { BinaryAnswer, BinaryLinkAnswer, CallResult, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
|
|
8
|
-
import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
|
|
7
|
+
import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
|
|
8
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
9
9
|
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
10
10
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
11
11
|
import type { Readiness } from './readiness.js';
|
|
@@ -22,7 +22,7 @@ export type MdRuntimeClient = {
|
|
|
22
22
|
roomDraft: {
|
|
23
23
|
list(): Promise<readonly RoomDraft[]>;
|
|
24
24
|
read(room: string, path: string): Promise<RoomDraft | null>;
|
|
25
|
-
write(room: string, path: string, revision: string | null, parts: RoomDraftParts): Promise<RoomDraftWrite>;
|
|
25
|
+
write(room: string, path: string, revision: string | null, parts: RoomDraftParts, next?: string): Promise<RoomDraftWrite>;
|
|
26
26
|
discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
|
|
27
27
|
};
|
|
28
28
|
save(room: string, roomDrafts: readonly SavedRoomDraft[]): Promise<SaveResult>;
|
|
@@ -34,14 +34,12 @@ export type MdRuntimeClient = {
|
|
|
34
34
|
};
|
|
35
35
|
conversation: {
|
|
36
36
|
list(): Promise<readonly ConversationEntry[]>;
|
|
37
|
-
read(conversation: string, options?:
|
|
37
|
+
read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
|
|
38
38
|
create(input: unknown): Promise<CallResult>;
|
|
39
39
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
40
|
-
|
|
41
|
-
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
40
|
+
answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
|
|
42
41
|
interrupt(conversation: string): Promise<CallResult>;
|
|
43
42
|
kill(conversation: string): Promise<CallResult>;
|
|
44
|
-
cancel(conversation: string, turn: string): Promise<CallResult>;
|
|
45
43
|
delete(conversation: string): Promise<CallResult>;
|
|
46
44
|
};
|
|
47
45
|
chatDraft: {
|
|
@@ -53,8 +51,8 @@ export type MdRuntimeClient = {
|
|
|
53
51
|
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
54
52
|
binaryFile: {
|
|
55
53
|
read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
attach(room: string, file: File): Promise<AttachAnswer>;
|
|
55
|
+
download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
|
|
58
56
|
};
|
|
59
57
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
60
58
|
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
@@ -62,6 +60,8 @@ export type MdRuntimeClient = {
|
|
|
62
60
|
persistence(): Promise<boolean>;
|
|
63
61
|
retry(): Promise<void>;
|
|
64
62
|
cleanUp(): Promise<number>;
|
|
63
|
+
unsent(): Promise<readonly UnsentWork[]>;
|
|
64
|
+
reset(): Promise<void>;
|
|
65
65
|
observe: {
|
|
66
66
|
(topic: 'deployment-facts'): Promise<Observation<unknown>>;
|
|
67
67
|
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
@@ -71,6 +71,7 @@ export type MdRuntimeClient = {
|
|
|
71
71
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
72
72
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
73
73
|
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
74
|
+
(topic: 'authority-changes'): Promise<Observation<number>>;
|
|
74
75
|
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
75
76
|
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
76
77
|
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
@@ -85,6 +86,9 @@ export type MdRuntimeClient = {
|
|
|
85
86
|
};
|
|
86
87
|
export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
|
|
87
88
|
export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
|
|
89
|
+
export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
|
|
90
|
+
export { roomDraftRevision } from './identity.js';
|
|
91
|
+
export { defineRoomMedia, ROOM_MEDIA } from './media.js';
|
|
88
92
|
export type { Observation } from './observation.js';
|
|
89
93
|
export type { Open } from './open.js';
|
|
90
94
|
export { unanswered, type RuntimePort, type WireMember } from './wire.js';
|
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,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;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,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,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EA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AAe,CAuSnE;AAID,wBAAgB,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUxF;AAED,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,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,8 +1,25 @@
|
|
|
1
|
+
import { shownBy } from './media.js';
|
|
1
2
|
import { observed } from './observation.js';
|
|
2
3
|
import { runtimeError } from './failure.js';
|
|
3
4
|
import { answer, AUTHORIZATION_ENDED, PORT_CLOSED, } from './wire.js';
|
|
4
5
|
// 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
6
|
const SETTLED_FRAMES = 2;
|
|
7
|
+
// A browser reads a download's address only after the click that hands it returns, so a copy's address is released a minute later.
|
|
8
|
+
const HANDED_COPY_MS = 60_000;
|
|
9
|
+
const PAGE = /\.html?$/iu;
|
|
10
|
+
const STARTED = { kind: 'started' };
|
|
11
|
+
const BLOCKED = {
|
|
12
|
+
kind: 'blocked',
|
|
13
|
+
code: 'popup-blocked',
|
|
14
|
+
fields: {},
|
|
15
|
+
retryable: true,
|
|
16
|
+
};
|
|
17
|
+
function handed(url, name) {
|
|
18
|
+
const anchor = document.createElement('a');
|
|
19
|
+
anchor.href = url;
|
|
20
|
+
anchor.download = name;
|
|
21
|
+
anchor.click();
|
|
22
|
+
}
|
|
6
23
|
function refused(refusal) {
|
|
7
24
|
return runtimeError(refusal.code, refusal.code, refusal.retryable);
|
|
8
25
|
}
|
|
@@ -156,6 +173,34 @@ export function connectMdRuntime(port) {
|
|
|
156
173
|
}, { highWaterMark: 0 });
|
|
157
174
|
return { kind: 'binary', stream, byteLength, mediaType };
|
|
158
175
|
}
|
|
176
|
+
async function download(room, path, revision) {
|
|
177
|
+
const tab = PAGE.test(path) ? globalThis.open('', '_blank') : null;
|
|
178
|
+
const linked = await ask('binaryFile.link', [room, path, revision]);
|
|
179
|
+
if (linked.kind === 'link' && PAGE.test(linked.name)) {
|
|
180
|
+
const away = tab ?? globalThis.open('', '_blank');
|
|
181
|
+
if (away === null)
|
|
182
|
+
return BLOCKED;
|
|
183
|
+
away.location.replace(linked.url);
|
|
184
|
+
return STARTED;
|
|
185
|
+
}
|
|
186
|
+
tab?.close();
|
|
187
|
+
if (linked.kind === 'link') {
|
|
188
|
+
handed(linked.url, linked.name);
|
|
189
|
+
return STARTED;
|
|
190
|
+
}
|
|
191
|
+
if (linked.kind !== 'absent')
|
|
192
|
+
return linked;
|
|
193
|
+
const read = streamed(await ask('binaryFile.read', [room, path, revision]));
|
|
194
|
+
if (read.kind !== 'binary')
|
|
195
|
+
return read;
|
|
196
|
+
const copy = await new Response(read.stream, {
|
|
197
|
+
headers: { 'content-type': read.mediaType },
|
|
198
|
+
}).blob();
|
|
199
|
+
const url = URL.createObjectURL(copy);
|
|
200
|
+
handed(url, path.slice(path.lastIndexOf('/') + 1));
|
|
201
|
+
setTimeout(() => URL.revokeObjectURL(url), HANDED_COPY_MS);
|
|
202
|
+
return STARTED;
|
|
203
|
+
}
|
|
159
204
|
function settled() {
|
|
160
205
|
if (settling !== null)
|
|
161
206
|
return settling;
|
|
@@ -185,7 +230,8 @@ export function connectMdRuntime(port) {
|
|
|
185
230
|
});
|
|
186
231
|
return settling;
|
|
187
232
|
}
|
|
188
|
-
|
|
233
|
+
const show = (room, path, revision) => ask('binaryFile.show', [room, path, revision]).then((shown) => streamed(shown));
|
|
234
|
+
return shownBy(show, {
|
|
189
235
|
rooms: () => ask('rooms', []),
|
|
190
236
|
query: ((query) => ask('query', [query])),
|
|
191
237
|
search: (request) => ask('search', [request]),
|
|
@@ -193,7 +239,7 @@ export function connectMdRuntime(port) {
|
|
|
193
239
|
roomDraft: {
|
|
194
240
|
list: () => ask('roomDraft.list', []),
|
|
195
241
|
read: (room, path) => ask('roomDraft.read', [room, path]),
|
|
196
|
-
write: (room, path, revision, parts) => ask('roomDraft.write', [room, path, revision, parts]),
|
|
242
|
+
write: (room, path, revision, parts, next) => ask('roomDraft.write', next === undefined ? [room, path, revision, parts] : [room, path, revision, parts, next]),
|
|
197
243
|
discard: (room, path, revision) => ask('roomDraft.discard', [room, path, revision]),
|
|
198
244
|
},
|
|
199
245
|
save: (room, roomDrafts) => ask('save', [room, roomDrafts]),
|
|
@@ -208,11 +254,9 @@ export function connectMdRuntime(port) {
|
|
|
208
254
|
read: (conversation, options) => ask('conversation.read', [conversation, options]),
|
|
209
255
|
create: (input) => ask('conversation.create', [input]),
|
|
210
256
|
send: (conversation, operation, draft) => ask('conversation.send', [conversation, operation, draft]),
|
|
211
|
-
attach: (room, file) => ask('conversation.attach', [room, file]),
|
|
212
257
|
answer: (conversation, answer) => ask('conversation.answer', [conversation, answer]),
|
|
213
258
|
interrupt: (conversation) => ask('conversation.interrupt', [conversation]),
|
|
214
259
|
kill: (conversation) => ask('conversation.kill', [conversation]),
|
|
215
|
-
cancel: (conversation, turn) => ask('conversation.cancel', [conversation, turn]),
|
|
216
260
|
delete: (conversation) => ask('conversation.delete', [conversation]),
|
|
217
261
|
},
|
|
218
262
|
chatDraft: {
|
|
@@ -223,9 +267,9 @@ export function connectMdRuntime(port) {
|
|
|
223
267
|
history: (locator, path, query) => ask('history', [locator, path, query]),
|
|
224
268
|
resolve: (room, path, destination) => ask('resolve', [room, path, destination]),
|
|
225
269
|
binaryFile: {
|
|
226
|
-
read: (room, path, revision) => ask('binaryFile.read', [room, path, revision]).then(streamed),
|
|
227
|
-
|
|
228
|
-
|
|
270
|
+
read: (room, path, revision) => ask('binaryFile.read', [room, path, revision]).then((read) => streamed(read)),
|
|
271
|
+
attach: (room, file) => ask('binaryFile.attach', [room, file]),
|
|
272
|
+
download,
|
|
229
273
|
},
|
|
230
274
|
call: (name, input) => ask('call', [name, input]),
|
|
231
275
|
reached: (locator, roomVersion, path) => ask('reached', [locator, roomVersion, path]),
|
|
@@ -233,10 +277,12 @@ export function connectMdRuntime(port) {
|
|
|
233
277
|
persistence: () => ask('persistence', []),
|
|
234
278
|
retry: () => ask('retry', []),
|
|
235
279
|
cleanUp: () => ask('cleanUp', []),
|
|
280
|
+
unsent: () => ask('unsent', []),
|
|
281
|
+
reset: () => ask('reset', []),
|
|
236
282
|
observe: ((topic, ...input) => watch(topic, input)),
|
|
237
283
|
reauthorize: () => ask('reauthorize', []),
|
|
238
284
|
settled,
|
|
239
|
-
};
|
|
285
|
+
});
|
|
240
286
|
}
|
|
241
287
|
const turns = new WeakMap();
|
|
242
288
|
export function inTurn(client, work) {
|
|
@@ -244,4 +290,7 @@ export function inTurn(client, work) {
|
|
|
244
290
|
turns.set(client, turn.then(() => undefined, () => undefined));
|
|
245
291
|
return turn;
|
|
246
292
|
}
|
|
293
|
+
export { chainedWindows } from './chain.js';
|
|
294
|
+
export { roomDraftRevision } from './identity.js';
|
|
295
|
+
export { defineRoomMedia, ROOM_MEDIA } from './media.js';
|
|
247
296
|
export { unanswered } from './wire.js';
|
package/dist/collection.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { type Document, type
|
|
2
|
-
import {
|
|
1
|
+
import { type Document, type TypedPath } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { ModelState } from './model.js';
|
|
3
3
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
|
-
import { type Paths } from './shared.js';
|
|
5
|
-
import type { Refused } from './transfer.js';
|
|
6
|
-
import { type Later } from './turn.js';
|
|
7
4
|
export declare const MD_MODEL: MdModelIdentity;
|
|
8
5
|
export type Collection = {
|
|
9
6
|
text: Readonly<Record<string, string>>;
|
|
@@ -16,25 +13,17 @@ export type Composition = {
|
|
|
16
13
|
roots: readonly string[];
|
|
17
14
|
model: ModelState;
|
|
18
15
|
} | null;
|
|
16
|
+
typedPaths: readonly TypedPath[];
|
|
19
17
|
};
|
|
18
|
+
export type Composed = {
|
|
19
|
+
readonly composition: Composition;
|
|
20
|
+
readonly fingerprint: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function composedOf(composition: Composition): Composed;
|
|
23
|
+
export declare function selected(composition: Composition, path: string): boolean;
|
|
20
24
|
export declare function governing(composition: Composition, path: string): ModelState;
|
|
21
|
-
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition
|
|
22
|
-
export declare function collecting(text: Readonly<Record<string, string>>, composition: Composition, previous?: Collection): Generator<number, Collection, void>;
|
|
23
|
-
export declare function passingFrontmatter(collection: Collection, path: string): Frontmatter | undefined;
|
|
25
|
+
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
|
|
24
26
|
export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
|
|
25
|
-
export declare function unreadable(text: Readonly<Record<string, string>>, previous?: Readonly<Record<string, string>>): Generator<number, Refused | null, void>;
|
|
26
27
|
export declare function validRoot(root: unknown): root is string;
|
|
27
|
-
export declare function validateCollection(text: Readonly<Record<string, string>>, binaryTargets: readonly string[], composition: Composition): Generator<number, Validation, void>;
|
|
28
|
-
type Held = {
|
|
29
|
-
text: Paths<string>;
|
|
30
|
-
binaries: Paths<unknown>;
|
|
31
|
-
};
|
|
32
|
-
export declare function indexReferrers(held: Held, composition: Composition): Later<void>;
|
|
33
|
-
export declare function referencesIndexed(held: Held, composition: Composition): boolean;
|
|
34
|
-
export declare function referring(held: Held, composition: Composition, targets: Iterable<string>): Generator<number, ReadonlySet<string> | null, void>;
|
|
35
28
|
export declare function available(composition: Composition): boolean;
|
|
36
|
-
export declare function changedCleanly(next: Held, previous: Held & {
|
|
37
|
-
composition: Composition;
|
|
38
|
-
}, composition: Composition): Generator<number, boolean, void>;
|
|
39
|
-
export {};
|
|
40
29
|
//# 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,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAErF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,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;IAClE,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAc3F,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAA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