@agentshouse/mdruntime 0.1.0-alpha.8 → 0.1.0-alpha.9
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/dist/adapter.d.ts +76 -21
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js.map +1 -1
- package/dist/bootstrap.d.ts +4 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +4 -2
- package/dist/bootstrap.js.map +1 -1
- package/dist/client.d.ts +63 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +227 -0
- package/dist/client.js.map +1 -0
- package/dist/collection.d.ts +14 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +60 -35
- package/dist/collection.js.map +1 -1
- package/dist/connection.d.ts +28 -7
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +603 -368
- package/dist/connection.js.map +1 -1
- package/dist/conversation.d.ts +57 -0
- package/dist/conversation.d.ts.map +1 -0
- package/dist/conversation.js +401 -0
- package/dist/conversation.js.map +1 -0
- package/dist/durability.d.ts +8 -3
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -59
- package/dist/durability.js.map +1 -1
- package/dist/file.d.ts +20 -0
- package/dist/file.d.ts.map +1 -0
- package/dist/file.js +149 -0
- package/dist/file.js.map +1 -0
- package/dist/host.d.ts +9 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +200 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/memory.d.ts +14 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +171 -11
- package/dist/memory.js.map +1 -1
- package/dist/outcome.d.ts +16 -9
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +10 -0
- package/dist/outcome.js.map +1 -1
- package/dist/query.d.ts +1 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js.map +1 -1
- package/dist/replica.d.ts +2 -1
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +16 -3
- package/dist/replica.js.map +1 -1
- package/dist/save.d.ts +3 -3
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +33 -14
- package/dist/save.js.map +1 -1
- package/dist/status.d.ts +11 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +5 -4
- package/dist/status.js.map +1 -1
- package/dist/store.d.ts +32 -3
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +64 -7
- package/dist/store.js.map +1 -1
- package/dist/wire.d.ts +63 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +139 -0
- package/dist/wire.js.map +1 -0
- package/package.json +10 -2
package/dist/adapter.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export type MdModelIdentity = {
|
|
|
7
7
|
identity: string;
|
|
8
8
|
version: string;
|
|
9
9
|
};
|
|
10
|
+
export type TypedSelection = {
|
|
11
|
+
roots: readonly string[];
|
|
12
|
+
attachedModel: ModelIdentity | null;
|
|
13
|
+
};
|
|
10
14
|
export type OperationScopes = {
|
|
11
15
|
read: readonly string[];
|
|
12
16
|
sync: readonly string[];
|
|
@@ -25,12 +29,43 @@ export type DiscoveredRoom = {
|
|
|
25
29
|
operations: OperationScopes;
|
|
26
30
|
replica: ReplicaAdmission;
|
|
27
31
|
attachedModel: ModelIdentity | null;
|
|
32
|
+
typedSelection?: TypedSelection;
|
|
28
33
|
providerOwnedPaths: readonly string[];
|
|
29
34
|
};
|
|
30
35
|
export type Capability = {
|
|
31
36
|
name: string;
|
|
32
37
|
limits?: readonly ProviderLimit[];
|
|
33
38
|
actions?: readonly ActionDeclaration[];
|
|
39
|
+
conversationCards?: ConversationCards;
|
|
40
|
+
};
|
|
41
|
+
export type ConversationCards = {
|
|
42
|
+
locator: string;
|
|
43
|
+
type: string;
|
|
44
|
+
identity: string;
|
|
45
|
+
agent: string;
|
|
46
|
+
};
|
|
47
|
+
export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
|
|
48
|
+
export type ConversationMessage = {
|
|
49
|
+
turn: string;
|
|
50
|
+
message: unknown;
|
|
51
|
+
};
|
|
52
|
+
export type ConversationEvent = {
|
|
53
|
+
kind: 'growing-text';
|
|
54
|
+
conversation: string;
|
|
55
|
+
turn: string;
|
|
56
|
+
text: string;
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'accepted-message';
|
|
59
|
+
conversation: string;
|
|
60
|
+
message: ConversationMessage;
|
|
61
|
+
} | {
|
|
62
|
+
kind: 'session-summary';
|
|
63
|
+
conversation: string;
|
|
64
|
+
summary: unknown;
|
|
65
|
+
};
|
|
66
|
+
export type ViewedConversations = {
|
|
67
|
+
view(conversations: readonly string[]): void;
|
|
68
|
+
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
34
69
|
};
|
|
35
70
|
export type ActionDeclaration = {
|
|
36
71
|
name: string;
|
|
@@ -60,7 +95,6 @@ export type Discovery = {
|
|
|
60
95
|
capabilities: readonly Capability[];
|
|
61
96
|
providerLimits: readonly ProviderLimit[];
|
|
62
97
|
retention: Retention;
|
|
63
|
-
origins: readonly string[];
|
|
64
98
|
};
|
|
65
99
|
export type TransportUncertainty = {
|
|
66
100
|
kind: 'transport-uncertainty';
|
|
@@ -72,17 +106,20 @@ export type RoomNotReadable = {
|
|
|
72
106
|
export type RevokedAuthorization = {
|
|
73
107
|
kind: 'revoked-authorization';
|
|
74
108
|
};
|
|
75
|
-
export type
|
|
109
|
+
export type ProviderRefusal = {
|
|
110
|
+
code: string;
|
|
111
|
+
fields: Readonly<Record<string, unknown>>;
|
|
112
|
+
};
|
|
113
|
+
export type ScopedRefusal = ProviderRefusal & {
|
|
76
114
|
kind: 'scoped-refusal';
|
|
77
115
|
locator: string;
|
|
78
116
|
scope: 'content' | 'sync' | 'model' | 'operation' | 'undisclosed';
|
|
79
|
-
text: string;
|
|
80
117
|
};
|
|
81
118
|
export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
|
|
82
|
-
export type
|
|
119
|
+
export type ContractUnavailable = ProviderRefusal & {
|
|
83
120
|
kind: 'contract-unavailable';
|
|
84
|
-
text: string;
|
|
85
121
|
};
|
|
122
|
+
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
86
123
|
export type PageToken = string;
|
|
87
124
|
export type BootstrapRequest = {
|
|
88
125
|
locator: string;
|
|
@@ -122,24 +159,26 @@ export type MutationRequest = {
|
|
|
122
159
|
locator: string;
|
|
123
160
|
changeBatch: ChangeBatch;
|
|
124
161
|
};
|
|
162
|
+
export type RetryableRefusal = ProviderRefusal & {
|
|
163
|
+
kind: 'retryable-refusal';
|
|
164
|
+
reset?: string;
|
|
165
|
+
};
|
|
125
166
|
export type MutationResult = {
|
|
126
167
|
kind: 'accepted';
|
|
127
168
|
roomVersion: string;
|
|
128
169
|
documents: Readonly<Record<string, string>>;
|
|
129
170
|
revisions: Readonly<Record<string, string>>;
|
|
130
171
|
removals: readonly string[];
|
|
131
|
-
author
|
|
132
|
-
time
|
|
133
|
-
} | {
|
|
172
|
+
author?: string;
|
|
173
|
+
time?: string;
|
|
174
|
+
} | (ProviderRefusal & {
|
|
134
175
|
kind: 'conflicted';
|
|
135
|
-
roomVersion
|
|
176
|
+
roomVersion?: string;
|
|
136
177
|
affected: Readonly<Record<string, string>>;
|
|
137
|
-
|
|
138
|
-
} | {
|
|
178
|
+
}) | (ProviderRefusal & {
|
|
139
179
|
kind: 'rejected';
|
|
140
180
|
affected: Readonly<Record<string, string>>;
|
|
141
|
-
|
|
142
|
-
} | {
|
|
181
|
+
}) | RetryableRefusal | {
|
|
143
182
|
kind: 'expired';
|
|
144
183
|
} | AdapterFailure;
|
|
145
184
|
export type HistoryRevision = {
|
|
@@ -170,16 +209,30 @@ export type ActionRequest = {
|
|
|
170
209
|
export type ActionResult = {
|
|
171
210
|
kind: 'action';
|
|
172
211
|
result: unknown;
|
|
173
|
-
} | {
|
|
212
|
+
} | (ProviderRefusal & {
|
|
174
213
|
kind: 'rejected';
|
|
175
|
-
|
|
176
|
-
|
|
214
|
+
}) | AdapterFailure;
|
|
215
|
+
export type ModelRequest = {
|
|
216
|
+
locator: string;
|
|
217
|
+
attached: 'collection';
|
|
218
|
+
collectionRoot: string;
|
|
219
|
+
model: ModelIdentity | null;
|
|
220
|
+
} | {
|
|
221
|
+
locator: string;
|
|
222
|
+
attached: 'typed-selection';
|
|
223
|
+
roots: readonly string[];
|
|
224
|
+
model: ModelIdentity | null;
|
|
225
|
+
};
|
|
226
|
+
export type RoomVersionNotification = {
|
|
227
|
+
locator: string;
|
|
228
|
+
roomVersion: string;
|
|
229
|
+
};
|
|
230
|
+
export type SelectedRooms = {
|
|
231
|
+
select(locators: readonly string[]): void;
|
|
232
|
+
observe(notify: (notification: RoomVersionNotification) => void): () => void;
|
|
233
|
+
};
|
|
177
234
|
export type Adapter = {
|
|
178
|
-
model(authorization: Authorization, request:
|
|
179
|
-
locator: string;
|
|
180
|
-
collectionRoot: string;
|
|
181
|
-
model: ModelIdentity | null;
|
|
182
|
-
}): Promise<ModelResult>;
|
|
235
|
+
model(authorization: Authorization, request: ModelRequest): Promise<ModelResult>;
|
|
183
236
|
authorize(): Promise<Authorization>;
|
|
184
237
|
discover(authorization: Authorization): Promise<DiscoverResult>;
|
|
185
238
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
@@ -187,5 +240,7 @@ export type Adapter = {
|
|
|
187
240
|
mutate(authorization: Authorization, request: MutationRequest): Promise<MutationResult>;
|
|
188
241
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
189
242
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
243
|
+
roomVersions?: SelectedRooms;
|
|
244
|
+
conversations?: ViewedConversations;
|
|
190
245
|
};
|
|
191
246
|
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AC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACxF,OAAO,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACvF,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACpF,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACrC,CAAC"}
|
package/dist/adapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/workspace/packages/mdruntime/src/adapter.ts"],"sourcesContent":["import type { ModelIdentity, ModelResult } from './model.js';\nimport type { ChangeBatch } from './change.js';\n\nexport type Authorization = object;\n\nexport const ROOM_CONTRACT_VERSION = 1;\n\nexport const VERSION_1_CAPABILITIES = [\n 'stable-file-ids',\n 'ranked-provider-search',\n 'room-version-notifications',\n 'room-history',\n 'provider-actions',\n] as const;\n\nexport type MdModelIdentity = {\n identity: string;\n version: string;\n};\n\nexport type OperationScopes = {\n read: readonly string[];\n sync: readonly string[];\n write: readonly string[];\n delete: readonly string[];\n};\nexport type ReplicaAdmission = { selection: string; admission: 'admitted' | 'unavailable' };\n\nexport type DiscoveredRoom = {\n collectionRoot: string;\n name: string;\n locator: string;\n roomVersion: string;\n operations: OperationScopes;\n replica: ReplicaAdmission;\n attachedModel: ModelIdentity | null;\n providerOwnedPaths: readonly string[];\n};\n\nexport type Capability = {\n name: string;\n limits?: readonly ProviderLimit[];\n actions?: readonly ActionDeclaration[];\n};\n\nexport type ActionDeclaration = {\n name: string;\n inputShape: unknown;\n resultKind: unknown;\n};\n\nexport type ProviderLimit = {\n name: string;\n value?: number | string;\n};\n\nexport type HistoryRetention =\n | { kind: 'duration'; seconds: number }\n | { kind: 'no-declared-time-bound' };\n\nexport type Retention = {\n history: HistoryRetention;\n outcome: number;\n refreshHorizon: number;\n};\n\nexport type Discovery = {\n kind: 'discovery';\n supportedVersions: readonly number[];\n mdModel: MdModelIdentity;\n rooms: readonly DiscoveredRoom[];\n capabilities: readonly Capability[];\n providerLimits: readonly ProviderLimit[];\n retention: Retention;\n
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/adapter.ts"],"sourcesContent":["import type { ModelIdentity, ModelResult } from './model.js';\nimport type { ChangeBatch } from './change.js';\n\nexport type Authorization = object;\n\nexport const ROOM_CONTRACT_VERSION = 1;\n\nexport const VERSION_1_CAPABILITIES = [\n 'stable-file-ids',\n 'ranked-provider-search',\n 'room-version-notifications',\n 'room-history',\n 'provider-actions',\n] as const;\n\nexport type MdModelIdentity = {\n identity: string;\n version: string;\n};\n\nexport type TypedSelection = {\n roots: readonly string[];\n attachedModel: ModelIdentity | null;\n};\n\nexport type OperationScopes = {\n read: readonly string[];\n sync: readonly string[];\n write: readonly string[];\n delete: readonly string[];\n};\nexport type ReplicaAdmission = { selection: string; admission: 'admitted' | 'unavailable' };\n\nexport type DiscoveredRoom = {\n collectionRoot: string;\n name: string;\n locator: string;\n roomVersion: string;\n operations: OperationScopes;\n replica: ReplicaAdmission;\n attachedModel: ModelIdentity | null;\n typedSelection?: TypedSelection;\n providerOwnedPaths: readonly string[];\n};\n\nexport type Capability = {\n name: string;\n limits?: readonly ProviderLimit[];\n actions?: readonly ActionDeclaration[];\n conversationCards?: ConversationCards;\n};\n\nexport type ConversationCards = {\n locator: string;\n type: string;\n identity: string;\n agent: string;\n};\n\nexport type ConversationAction =\n | 'conversation.create'\n | 'conversation.send'\n | 'conversation.answer'\n | 'conversation.interrupt'\n | 'conversation.kill'\n | 'conversation.cancel'\n | 'conversation.delete'\n | 'conversation.history';\n\nexport type ConversationMessage = {\n turn: string;\n message: unknown;\n};\n\nexport type ConversationEvent =\n | { kind: 'growing-text'; conversation: string; turn: string; text: string }\n | { kind: 'accepted-message'; conversation: string; message: ConversationMessage }\n | { kind: 'session-summary'; conversation: string; summary: unknown };\n\nexport type ViewedConversations = {\n view(conversations: readonly string[]): void;\n observe(notify: (event: ConversationEvent) => void): () => void;\n};\n\nexport type ActionDeclaration = {\n name: string;\n inputShape: unknown;\n resultKind: unknown;\n};\n\nexport type ProviderLimit = {\n name: string;\n value?: number | string;\n};\n\nexport type HistoryRetention =\n | { kind: 'duration'; seconds: number }\n | { kind: 'no-declared-time-bound' };\n\nexport type Retention = {\n history: HistoryRetention;\n outcome: number;\n refreshHorizon: number;\n};\n\nexport type Discovery = {\n kind: 'discovery';\n supportedVersions: readonly number[];\n mdModel: MdModelIdentity;\n rooms: readonly DiscoveredRoom[];\n capabilities: readonly Capability[];\n providerLimits: readonly ProviderLimit[];\n retention: Retention;\n};\n\nexport type TransportUncertainty = { kind: 'transport-uncertainty' };\nexport type RoomNotReadable = { kind: 'room-not-readable'; locator: string };\nexport type RevokedAuthorization = { kind: 'revoked-authorization' };\n\nexport type ProviderRefusal = {\n code: string;\n fields: Readonly<Record<string, unknown>>;\n};\n\nexport type ScopedRefusal = ProviderRefusal & {\n kind: 'scoped-refusal';\n locator: string;\n scope: 'content' | 'sync' | 'model' | 'operation' | 'undisclosed';\n};\nexport type AdapterFailure =\n | TransportUncertainty\n | RoomNotReadable\n | RevokedAuthorization\n | ScopedRefusal;\n\nexport type ContractUnavailable = ProviderRefusal & { kind: 'contract-unavailable' };\n\nexport type DiscoverResult =\n | Discovery\n | TransportUncertainty\n | RevokedAuthorization\n | ContractUnavailable;\n\nexport type PageToken = string;\n\nexport type BootstrapRequest = {\n locator: string;\n selection: string;\n pageToken?: PageToken;\n};\n\nexport type BootstrapPage = {\n kind: 'bootstrap';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n binaryTargets: readonly string[];\n pageToken?: PageToken;\n};\n\nexport type BootstrapResult = BootstrapPage | AdapterFailure;\n\nexport type RefreshRequest = {\n locator: string;\n selection: string;\n fromRoomVersion: string;\n pageToken?: PageToken;\n};\n\nexport type RefreshPage = {\n kind: 'net-advancement';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n binaryTargets: readonly string[];\n removals: readonly string[];\n pageToken?: PageToken;\n};\n\nexport type RefreshResult =\n | { kind: 'still-current' }\n | RefreshPage\n | { kind: 'beyond-horizon' }\n | AdapterFailure;\n\nexport type MutationRequest = {\n locator: string;\n changeBatch: ChangeBatch;\n};\n\nexport type RetryableRefusal = ProviderRefusal & {\n kind: 'retryable-refusal';\n reset?: string;\n};\n\nexport type MutationResult =\n | {\n kind: 'accepted';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n removals: readonly string[];\n author?: string;\n time?: string;\n }\n | (ProviderRefusal & {\n kind: 'conflicted';\n roomVersion?: string;\n affected: Readonly<Record<string, string>>;\n })\n | (ProviderRefusal & {\n kind: 'rejected';\n affected: Readonly<Record<string, string>>;\n })\n | RetryableRefusal\n | { kind: 'expired' }\n | AdapterFailure;\n\nexport type HistoryRevision = {\n revision: string;\n author: string;\n time: string;\n};\n\nexport type HistoryRequest = {\n locator: string;\n path: string;\n revision?: string;\n pageToken?: PageToken;\n};\n\nexport type HistoryResult =\n | {\n kind: 'history';\n revisions: readonly HistoryRevision[];\n pageToken?: PageToken;\n }\n | {\n kind: 'revision';\n content: string;\n }\n | { kind: 'no-history' }\n | AdapterFailure;\n\nexport type ActionRequest = {\n name: string;\n input: unknown;\n};\n\nexport type ActionResult =\n | { kind: 'action'; result: unknown }\n | (ProviderRefusal & { kind: 'rejected' })\n | AdapterFailure;\n\nexport type ModelRequest =\n | { locator: string; attached: 'collection'; collectionRoot: string; model: ModelIdentity | null }\n | {\n locator: string;\n attached: 'typed-selection';\n roots: readonly string[];\n model: ModelIdentity | null;\n };\n\nexport type RoomVersionNotification = {\n locator: string;\n roomVersion: string;\n};\n\nexport type SelectedRooms = {\n select(locators: readonly string[]): void;\n observe(notify: (notification: RoomVersionNotification) => void): () => void;\n};\n\nexport type Adapter = {\n model(authorization: Authorization, request: ModelRequest): Promise<ModelResult>;\n authorize(): Promise<Authorization>;\n discover(authorization: Authorization): Promise<DiscoverResult>;\n bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;\n refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;\n mutate(authorization: Authorization, request: MutationRequest): Promise<MutationResult>;\n history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;\n action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;\n roomVersions?: SelectedRooms;\n conversations?: ViewedConversations;\n};\n"],"names":["ROOM_CONTRACT_VERSION","VERSION_1_CAPABILITIES"],"mappings":"AAKA,OAAO,MAAMA,wBAAwB,EAAE;AAEvC,OAAO,MAAMC,yBAAyB;IACpC;IACA;IACA;IACA;IACA;CACD,CAAU"}
|
package/dist/bootstrap.d.ts
CHANGED
|
@@ -7,5 +7,8 @@ export type BootstrapOutcome = {
|
|
|
7
7
|
kind: 'staged';
|
|
8
8
|
confirmed: ConfirmedLayer;
|
|
9
9
|
} | Unconfirmed | AdapterFailure;
|
|
10
|
-
export declare function bootstrapRoom(adapter: Adapter, authorization: Authorization, room: DiscoveredRoom,
|
|
10
|
+
export declare function bootstrapRoom(adapter: Adapter, authorization: Authorization, room: DiscoveredRoom, models: {
|
|
11
|
+
collection: ModelState;
|
|
12
|
+
selection: ModelState;
|
|
13
|
+
}, binding: AttachedModelBinding | null): Promise<BootstrapOutcome>;
|
|
11
14
|
//# sourceMappingURL=bootstrap.d.ts.map
|
package/dist/bootstrap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA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rap.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readStaged } from './replica.js';
|
|
2
2
|
import { unconfirmed } from './transfer.js';
|
|
3
|
-
export async function bootstrapRoom(adapter, authorization, room,
|
|
3
|
+
export async function bootstrapRoom(adapter, authorization, room, models, binding) {
|
|
4
4
|
const first = await adapter.bootstrap(authorization, {
|
|
5
5
|
locator: room.locator,
|
|
6
6
|
selection: room.replica.selection
|
|
@@ -35,7 +35,9 @@ export async function bootstrapRoom(adapter, authorization, room, model, binding
|
|
|
35
35
|
operations: room.operations,
|
|
36
36
|
replica: room.replica,
|
|
37
37
|
attachedModel: room.attachedModel,
|
|
38
|
-
model,
|
|
38
|
+
model: models.collection,
|
|
39
|
+
typedSelection: room.typedSelection ?? null,
|
|
40
|
+
selectionModel: models.selection,
|
|
39
41
|
providerOwnedPaths: room.providerOwnedPaths,
|
|
40
42
|
roomVersion,
|
|
41
43
|
documents,
|
package/dist/bootstrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/workspace/packages/mdruntime/src/bootstrap.ts"],"sourcesContent":["import type { AttachedModelBinding } from './model.js';\nimport type { ModelState } from './model.js';\nimport type { Adapter, AdapterFailure, Authorization, DiscoveredRoom } from './adapter.js';\nimport { readStaged, type ConfirmedLayer } from './replica.js';\nimport { unconfirmed, type Unconfirmed } from './transfer.js';\n\nexport type BootstrapOutcome =\n | { kind: 'staged'; confirmed: ConfirmedLayer }\n | Unconfirmed\n | AdapterFailure;\n\nexport async function bootstrapRoom(\n adapter: Adapter,\n authorization: Authorization,\n room: DiscoveredRoom,\n
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/bootstrap.ts"],"sourcesContent":["import type { AttachedModelBinding } from './model.js';\nimport type { ModelState } from './model.js';\nimport type { Adapter, AdapterFailure, Authorization, DiscoveredRoom } from './adapter.js';\nimport { readStaged, type ConfirmedLayer } from './replica.js';\nimport { unconfirmed, type Unconfirmed } from './transfer.js';\n\nexport type BootstrapOutcome =\n | { kind: 'staged'; confirmed: ConfirmedLayer }\n | Unconfirmed\n | AdapterFailure;\n\nexport async function bootstrapRoom(\n adapter: Adapter,\n authorization: Authorization,\n room: DiscoveredRoom,\n models: { collection: ModelState; selection: ModelState },\n binding: AttachedModelBinding | null,\n): Promise<BootstrapOutcome> {\n const first = await adapter.bootstrap(authorization, {\n locator: room.locator,\n selection: room.replica.selection,\n });\n if (first.kind !== 'bootstrap') return first;\n const roomVersion = first.roomVersion;\n const documents: Record<string, string> = { ...first.documents };\n const revisions: Record<string, string> = { ...first.revisions };\n const binaryTargets = new Set(first.binaryTargets);\n let pageToken = first.pageToken;\n while (pageToken !== undefined) {\n const page = await adapter.bootstrap(authorization, {\n locator: room.locator,\n selection: room.replica.selection,\n pageToken,\n });\n if (page.kind !== 'bootstrap') return page;\n if (page.roomVersion !== roomVersion) return unconfirmed;\n Object.assign(documents, page.documents);\n Object.assign(revisions, page.revisions);\n for (const target of page.binaryTargets) binaryTargets.add(target);\n pageToken = page.pageToken;\n }\n const confirmed = readStaged(\n {\n locator: room.locator,\n collectionRoot: room.collectionRoot,\n name: room.name,\n operations: room.operations,\n replica: room.replica,\n attachedModel: room.attachedModel,\n model: models.collection,\n typedSelection: room.typedSelection ?? null,\n selectionModel: models.selection,\n providerOwnedPaths: room.providerOwnedPaths,\n roomVersion,\n documents,\n binaryTargets: [...binaryTargets].sort(),\n revisions,\n },\n binding,\n );\n return confirmed === null ? unconfirmed : { kind: 'staged', confirmed };\n}\n"],"names":["readStaged","unconfirmed","bootstrapRoom","adapter","authorization","room","models","binding","first","bootstrap","locator","selection","replica","kind","roomVersion","documents","revisions","binaryTargets","Set","pageToken","undefined","page","Object","assign","target","add","confirmed","collectionRoot","name","operations","attachedModel","model","collection","typedSelection","selectionModel","providerOwnedPaths","sort"],"mappings":"AAGA,SAASA,UAAU,QAA6B,eAAe;AAC/D,SAASC,WAAW,QAA0B,gBAAgB;AAO9D,OAAO,eAAeC,c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wB,oBAAoB9B,KAAK8B,kBAAkB;QAC3CrB;QACAC;QACAE,eAAe;eAAIA;SAAc,CAACmB,IAAI;QACtCpB;IACF,GACAT;IAEF,OAAOmB,cAAc,OAAOzB,cAAc;QAAEY,MAAM;QAAUa;IAAU;AACxE"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { QueryOptions, QueryResult } from '@agentshouse/query';
|
|
2
|
+
import type { Change } from './change.js';
|
|
3
|
+
import type { AppRoom, ConnectionRefusal, DraftEntry, HistoryQuery, RoomTypes, SaveResult } from './connection.js';
|
|
4
|
+
import type { HistoryResult } from './adapter.js';
|
|
5
|
+
import type { ConversationEntry, ConversationView, UnsentInstruction } from './conversation.js';
|
|
6
|
+
import type { CallResult, QueueEntry, SubmissionOutcome } from './outcome.js';
|
|
7
|
+
import type { SyncStatus } from './status.js';
|
|
8
|
+
import { type RuntimePort } from './wire.js';
|
|
9
|
+
export type MdRuntimeClient = {
|
|
10
|
+
rooms(): Promise<readonly AppRoom[]>;
|
|
11
|
+
query(options?: QueryOptions): Promise<QueryResult>;
|
|
12
|
+
types(locator: string): Promise<RoomTypes>;
|
|
13
|
+
syncStatus(): Promise<SyncStatus>;
|
|
14
|
+
draft: {
|
|
15
|
+
list(): Promise<readonly DraftEntry[]>;
|
|
16
|
+
read(locator: string, path: string): Promise<unknown>;
|
|
17
|
+
replace(locator: string, path: string, content: unknown): Promise<void>;
|
|
18
|
+
discard(locator: string, path: string): Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
save(locator: string, changes: readonly Change[], replacing?: string): Promise<SaveResult>;
|
|
21
|
+
outcome(identifier: string): Promise<SubmissionOutcome | null>;
|
|
22
|
+
queue: {
|
|
23
|
+
discard(locator: string, identifier: string): Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
presentation: {
|
|
26
|
+
read(): Promise<unknown>;
|
|
27
|
+
write(value: unknown): Promise<void>;
|
|
28
|
+
};
|
|
29
|
+
conversation: {
|
|
30
|
+
list(): Promise<readonly ConversationEntry[]>;
|
|
31
|
+
read(conversation: string): Promise<ConversationView>;
|
|
32
|
+
older(conversation: string): Promise<CallResult | null>;
|
|
33
|
+
compose(conversation: string, instruction: UnsentInstruction): Promise<void>;
|
|
34
|
+
discard(conversation: string): Promise<void>;
|
|
35
|
+
create(input: unknown): Promise<CallResult>;
|
|
36
|
+
send(conversation: string): Promise<CallResult>;
|
|
37
|
+
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
38
|
+
interrupt(conversation: string): Promise<CallResult>;
|
|
39
|
+
kill(conversation: string): Promise<CallResult>;
|
|
40
|
+
cancel(conversation: string, turn: string): Promise<CallResult>;
|
|
41
|
+
delete(conversation: string): Promise<CallResult>;
|
|
42
|
+
};
|
|
43
|
+
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryResult>;
|
|
44
|
+
call(name: string, input: unknown): Promise<CallResult>;
|
|
45
|
+
log(): Promise<string>;
|
|
46
|
+
storageLoss(): Promise<string | null>;
|
|
47
|
+
persistence(): Promise<boolean>;
|
|
48
|
+
observe: {
|
|
49
|
+
(topic: 'rooms', listener: (rooms: readonly AppRoom[]) => void): Promise<() => void>;
|
|
50
|
+
(topic: 'connection-refusal', listener: (refusal: ConnectionRefusal | null) => void): Promise<() => void>;
|
|
51
|
+
(topic: 'storage-loss', listener: (statement: string | null) => void): Promise<() => void>;
|
|
52
|
+
(topic: 'sync-status', listener: (status: SyncStatus) => void): Promise<() => void>;
|
|
53
|
+
(topic: 'query', query: QueryOptions, listener: (result: QueryResult) => void): Promise<() => void>;
|
|
54
|
+
(topic: 'queue', locator: string, listener: (entries: readonly QueueEntry[]) => void): Promise<() => void>;
|
|
55
|
+
(topic: 'drafts', listener: (drafts: readonly DraftEntry[]) => void): Promise<() => void>;
|
|
56
|
+
(topic: 'presentation', listener: (value: unknown) => void): Promise<() => void>;
|
|
57
|
+
(topic: 'conversation', conversation: string, listener: (view: ConversationView) => void): Promise<() => void>;
|
|
58
|
+
};
|
|
59
|
+
reauthorize(): Promise<void>;
|
|
60
|
+
};
|
|
61
|
+
export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
|
|
62
|
+
export type { RuntimePort } from './wire.js';
|
|
63
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAML,KAAK,WAAW,EAIjB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,IAAI,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC;IACrC,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACpD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3C,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC,KAAK,EAAE;QACL,IAAI,IAAI,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,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|
1
|
+
import { answer, AUTHORIZATION_ENDED, carried, envelope, PROTOCOL_MISMATCH } from './wire.js';
|
|
2
|
+
export function connectMdRuntime(port) {
|
|
3
|
+
let sequence = 0;
|
|
4
|
+
let refusal = null;
|
|
5
|
+
let ended = false;
|
|
6
|
+
const calls = new Map();
|
|
7
|
+
const acks = new Map();
|
|
8
|
+
const listeners = new Map();
|
|
9
|
+
const send = (message)=>{
|
|
10
|
+
port.postMessage(envelope(message));
|
|
11
|
+
};
|
|
12
|
+
function refuse(reported) {
|
|
13
|
+
refusal = reported;
|
|
14
|
+
for (const waiting of acks.values())waiting.settle();
|
|
15
|
+
acks.clear();
|
|
16
|
+
const failure = new Error(reported.reason);
|
|
17
|
+
for (const waiting of calls.values())waiting.fail(failure);
|
|
18
|
+
calls.clear();
|
|
19
|
+
for (const listener of listeners.values()){
|
|
20
|
+
if (listener.topic === 'connection-refusal') listener.notify(reported);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function end() {
|
|
24
|
+
ended = true;
|
|
25
|
+
const failure = new Error(AUTHORIZATION_ENDED);
|
|
26
|
+
for (const waiting of acks.values())waiting.fail(failure);
|
|
27
|
+
acks.clear();
|
|
28
|
+
for (const waiting of calls.values())waiting.fail(failure);
|
|
29
|
+
calls.clear();
|
|
30
|
+
listeners.clear();
|
|
31
|
+
}
|
|
32
|
+
port.addEventListener('message', (event)=>{
|
|
33
|
+
const wire = carried(event.data);
|
|
34
|
+
if (wire === null) return;
|
|
35
|
+
if (!wire.matching) {
|
|
36
|
+
refuse(PROTOCOL_MISMATCH);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const message = answer(wire.message);
|
|
40
|
+
if (message === null) return;
|
|
41
|
+
if (message.kind === 'refusal') {
|
|
42
|
+
refuse(message.refusal);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (message.kind === 'ended') {
|
|
46
|
+
end();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (message.kind === 'event') {
|
|
50
|
+
listeners.get(message.id)?.notify(message.value);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const subscribing = acks.get(message.id);
|
|
54
|
+
if (subscribing !== undefined) {
|
|
55
|
+
acks.delete(message.id);
|
|
56
|
+
if (message.kind === 'failure') {
|
|
57
|
+
listeners.delete(message.id);
|
|
58
|
+
subscribing.fail(new Error(message.message));
|
|
59
|
+
} else subscribing.settle();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const waiting = calls.get(message.id);
|
|
63
|
+
if (waiting === undefined) return;
|
|
64
|
+
calls.delete(message.id);
|
|
65
|
+
if (message.kind === 'failure') waiting.fail(new Error(message.message));
|
|
66
|
+
else waiting.settle(message.value);
|
|
67
|
+
});
|
|
68
|
+
port.start();
|
|
69
|
+
send({
|
|
70
|
+
kind: 'hello'
|
|
71
|
+
});
|
|
72
|
+
function ask(member, input) {
|
|
73
|
+
if (ended) return Promise.reject(new Error(AUTHORIZATION_ENDED));
|
|
74
|
+
if (refusal !== null) return Promise.reject(new Error(refusal.reason));
|
|
75
|
+
const id = sequence += 1;
|
|
76
|
+
return new Promise((settle, fail)=>{
|
|
77
|
+
calls.set(id, {
|
|
78
|
+
settle: settle,
|
|
79
|
+
fail
|
|
80
|
+
});
|
|
81
|
+
send({
|
|
82
|
+
kind: 'call',
|
|
83
|
+
id,
|
|
84
|
+
member,
|
|
85
|
+
input
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function watch(topic, input, notify) {
|
|
90
|
+
if (ended) return Promise.reject(new Error(AUTHORIZATION_ENDED));
|
|
91
|
+
const id = sequence += 1;
|
|
92
|
+
listeners.set(id, {
|
|
93
|
+
topic,
|
|
94
|
+
notify
|
|
95
|
+
});
|
|
96
|
+
const end = ()=>{
|
|
97
|
+
if (!listeners.delete(id)) return;
|
|
98
|
+
if (refusal === null) send({
|
|
99
|
+
kind: 'stop',
|
|
100
|
+
id
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
if (refusal !== null) {
|
|
104
|
+
if (topic === 'connection-refusal') notify(refusal);
|
|
105
|
+
return Promise.resolve(end);
|
|
106
|
+
}
|
|
107
|
+
return new Promise((settle, fail)=>{
|
|
108
|
+
acks.set(id, {
|
|
109
|
+
settle: ()=>settle(end),
|
|
110
|
+
fail
|
|
111
|
+
});
|
|
112
|
+
send({
|
|
113
|
+
kind: 'observe',
|
|
114
|
+
id,
|
|
115
|
+
topic,
|
|
116
|
+
input
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
rooms: ()=>ask('rooms', []),
|
|
122
|
+
query: (options)=>ask('query', [
|
|
123
|
+
options
|
|
124
|
+
]),
|
|
125
|
+
types: (locator)=>ask('types', [
|
|
126
|
+
locator
|
|
127
|
+
]),
|
|
128
|
+
syncStatus: ()=>ask('syncStatus', []),
|
|
129
|
+
draft: {
|
|
130
|
+
list: ()=>ask('draft.list', []),
|
|
131
|
+
read: (locator, path)=>ask('draft.read', [
|
|
132
|
+
locator,
|
|
133
|
+
path
|
|
134
|
+
]),
|
|
135
|
+
replace: (locator, path, content)=>ask('draft.replace', [
|
|
136
|
+
locator,
|
|
137
|
+
path,
|
|
138
|
+
content
|
|
139
|
+
]),
|
|
140
|
+
discard: (locator, path)=>ask('draft.discard', [
|
|
141
|
+
locator,
|
|
142
|
+
path
|
|
143
|
+
])
|
|
144
|
+
},
|
|
145
|
+
save: (locator, changes, replacing)=>ask('save', [
|
|
146
|
+
locator,
|
|
147
|
+
changes,
|
|
148
|
+
replacing
|
|
149
|
+
]),
|
|
150
|
+
outcome: (identifier)=>ask('outcome', [
|
|
151
|
+
identifier
|
|
152
|
+
]),
|
|
153
|
+
queue: {
|
|
154
|
+
discard: (locator, identifier)=>ask('queue.discard', [
|
|
155
|
+
locator,
|
|
156
|
+
identifier
|
|
157
|
+
])
|
|
158
|
+
},
|
|
159
|
+
presentation: {
|
|
160
|
+
read: ()=>ask('presentation.read', []),
|
|
161
|
+
write: (value)=>ask('presentation.write', [
|
|
162
|
+
value
|
|
163
|
+
])
|
|
164
|
+
},
|
|
165
|
+
conversation: {
|
|
166
|
+
list: ()=>ask('conversation.list', []),
|
|
167
|
+
read: (conversation)=>ask('conversation.read', [
|
|
168
|
+
conversation
|
|
169
|
+
]),
|
|
170
|
+
older: (conversation)=>ask('conversation.older', [
|
|
171
|
+
conversation
|
|
172
|
+
]),
|
|
173
|
+
compose: (conversation, instruction)=>ask('conversation.compose', [
|
|
174
|
+
conversation,
|
|
175
|
+
instruction
|
|
176
|
+
]),
|
|
177
|
+
discard: (conversation)=>ask('conversation.discard', [
|
|
178
|
+
conversation
|
|
179
|
+
]),
|
|
180
|
+
create: (input)=>ask('conversation.create', [
|
|
181
|
+
input
|
|
182
|
+
]),
|
|
183
|
+
send: (conversation)=>ask('conversation.send', [
|
|
184
|
+
conversation
|
|
185
|
+
]),
|
|
186
|
+
answer: (conversation, answer)=>ask('conversation.answer', [
|
|
187
|
+
conversation,
|
|
188
|
+
answer
|
|
189
|
+
]),
|
|
190
|
+
interrupt: (conversation)=>ask('conversation.interrupt', [
|
|
191
|
+
conversation
|
|
192
|
+
]),
|
|
193
|
+
kill: (conversation)=>ask('conversation.kill', [
|
|
194
|
+
conversation
|
|
195
|
+
]),
|
|
196
|
+
cancel: (conversation, turn)=>ask('conversation.cancel', [
|
|
197
|
+
conversation,
|
|
198
|
+
turn
|
|
199
|
+
]),
|
|
200
|
+
delete: (conversation)=>ask('conversation.delete', [
|
|
201
|
+
conversation
|
|
202
|
+
])
|
|
203
|
+
},
|
|
204
|
+
history: (locator, path, query)=>ask('history', [
|
|
205
|
+
locator,
|
|
206
|
+
path,
|
|
207
|
+
query
|
|
208
|
+
]),
|
|
209
|
+
call: (name, input)=>ask('call', [
|
|
210
|
+
name,
|
|
211
|
+
input
|
|
212
|
+
]),
|
|
213
|
+
log: ()=>ask('log', []),
|
|
214
|
+
storageLoss: ()=>ask('storageLoss', []),
|
|
215
|
+
persistence: ()=>ask('persistence', []),
|
|
216
|
+
observe (topic, second, third) {
|
|
217
|
+
const positional = topic === 'query' || topic === 'queue' || topic === 'conversation';
|
|
218
|
+
const notify = positional ? third : second;
|
|
219
|
+
return watch(topic, positional ? [
|
|
220
|
+
second
|
|
221
|
+
] : [], notify);
|
|
222
|
+
},
|
|
223
|
+
reauthorize: ()=>ask('reauthorize', [])
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/client.ts"],"sourcesContent":["import type { QueryOptions, QueryResult } from '@agentshouse/query';\nimport type { Change } from './change.js';\nimport type {\n AppRoom,\n ConnectionRefusal,\n DraftEntry,\n HistoryQuery,\n RoomTypes,\n SaveResult,\n} from './connection.js';\nimport type { HistoryResult } from './adapter.js';\nimport type { ConversationEntry, ConversationView, UnsentInstruction } from './conversation.js';\nimport type { CallResult, QueueEntry, SubmissionOutcome } from './outcome.js';\nimport type { SyncStatus } from './status.js';\nimport {\n answer,\n AUTHORIZATION_ENDED,\n carried,\n envelope,\n PROTOCOL_MISMATCH,\n type RuntimePort,\n type WireMember,\n type WireRequest,\n type WireTopic,\n} from './wire.js';\n\nexport type MdRuntimeClient = {\n rooms(): Promise<readonly AppRoom[]>;\n query(options?: QueryOptions): Promise<QueryResult>;\n types(locator: string): Promise<RoomTypes>;\n syncStatus(): Promise<SyncStatus>;\n draft: {\n list(): Promise<readonly DraftEntry[]>;\n read(locator: string, path: string): Promise<unknown>;\n replace(locator: string, path: string, content: unknown): Promise<void>;\n discard(locator: string, path: string): Promise<void>;\n };\n save(locator: string, changes: readonly Change[], replacing?: string): Promise<SaveResult>;\n outcome(identifier: string): Promise<SubmissionOutcome | null>;\n queue: { discard(locator: string, identifier: string): Promise<void> };\n presentation: {\n read(): Promise<unknown>;\n write(value: unknown): Promise<void>;\n };\n conversation: {\n list(): Promise<readonly ConversationEntry[]>;\n read(conversation: string): Promise<ConversationView>;\n older(conversation: string): Promise<CallResult | null>;\n compose(conversation: string, instruction: UnsentInstruction): Promise<void>;\n discard(conversation: string): Promise<void>;\n create(input: unknown): Promise<CallResult>;\n send(conversation: string): Promise<CallResult>;\n answer(conversation: string, answer: unknown): Promise<CallResult>;\n interrupt(conversation: string): Promise<CallResult>;\n kill(conversation: string): Promise<CallResult>;\n cancel(conversation: string, turn: string): Promise<CallResult>;\n delete(conversation: string): Promise<CallResult>;\n };\n history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryResult>;\n call(name: string, input: unknown): Promise<CallResult>;\n log(): Promise<string>;\n storageLoss(): Promise<string | null>;\n persistence(): Promise<boolean>;\n observe: {\n (topic: 'rooms', listener: (rooms: readonly AppRoom[]) => void): Promise<() => void>;\n (\n topic: 'connection-refusal',\n listener: (refusal: ConnectionRefusal | null) => void,\n ): Promise<() => void>;\n (topic: 'storage-loss', listener: (statement: string | null) => void): Promise<() => void>;\n (topic: 'sync-status', listener: (status: SyncStatus) => void): Promise<() => void>;\n (\n topic: 'query',\n query: QueryOptions,\n listener: (result: QueryResult) => void,\n ): Promise<() => void>;\n (\n topic: 'queue',\n locator: string,\n listener: (entries: readonly QueueEntry[]) => void,\n ): Promise<() => void>;\n (topic: 'drafts', listener: (drafts: readonly DraftEntry[]) => void): Promise<() => void>;\n (topic: 'presentation', listener: (value: unknown) => void): Promise<() => void>;\n (\n topic: 'conversation',\n conversation: string,\n listener: (view: ConversationView) => void,\n ): Promise<() => void>;\n };\n reauthorize(): Promise<void>;\n};\n\nexport function connectMdRuntime(port: RuntimePort): MdRuntimeClient {\n let sequence = 0;\n let refusal: ConnectionRefusal | null = null;\n let ended = false;\n const calls = new Map<\n number,\n { settle: (value: unknown) => void; fail: (error: Error) => void }\n >();\n const acks = new Map<number, { settle: () => void; fail: (error: Error) => void }>();\n const listeners = new Map<number, { topic: WireTopic; notify: (value: unknown) => void }>();\n\n const send = (message: WireRequest) => {\n port.postMessage(envelope(message));\n };\n\n function refuse(reported: ConnectionRefusal) {\n refusal = reported;\n for (const waiting of acks.values()) waiting.settle();\n acks.clear();\n const failure = new Error(reported.reason);\n for (const waiting of calls.values()) waiting.fail(failure);\n calls.clear();\n for (const listener of listeners.values()) {\n if (listener.topic === 'connection-refusal') listener.notify(reported);\n }\n }\n\n function end() {\n ended = true;\n const failure = new Error(AUTHORIZATION_ENDED);\n for (const waiting of acks.values()) waiting.fail(failure);\n acks.clear();\n for (const waiting of calls.values()) waiting.fail(failure);\n calls.clear();\n listeners.clear();\n }\n\n port.addEventListener('message', (event) => {\n const wire = carried(event.data);\n if (wire === null) return;\n if (!wire.matching) {\n refuse(PROTOCOL_MISMATCH);\n return;\n }\n const message = answer(wire.message);\n if (message === null) return;\n if (message.kind === 'refusal') {\n refuse(message.refusal);\n return;\n }\n if (message.kind === 'ended') {\n end();\n return;\n }\n if (message.kind === 'event') {\n listeners.get(message.id)?.notify(message.value);\n return;\n }\n const subscribing = acks.get(message.id);\n if (subscribing !== undefined) {\n acks.delete(message.id);\n if (message.kind === 'failure') {\n listeners.delete(message.id);\n subscribing.fail(new Error(message.message));\n } else subscribing.settle();\n return;\n }\n const waiting = calls.get(message.id);\n if (waiting === undefined) return;\n calls.delete(message.id);\n if (message.kind === 'failure') waiting.fail(new Error(message.message));\n else waiting.settle(message.value);\n });\n port.start();\n send({ kind: 'hello' });\n\n function ask<T>(member: WireMember, input: readonly unknown[]): Promise<T> {\n if (ended) return Promise.reject(new Error(AUTHORIZATION_ENDED));\n if (refusal !== null) return Promise.reject(new Error(refusal.reason));\n const id = (sequence += 1);\n return new Promise<T>((settle, fail) => {\n calls.set(id, { settle: settle as (value: unknown) => void, fail });\n send({ kind: 'call', id, member, input });\n });\n }\n\n function watch(\n topic: WireTopic,\n input: readonly unknown[],\n notify: (value: unknown) => void,\n ): Promise<() => void> {\n if (ended) return Promise.reject(new Error(AUTHORIZATION_ENDED));\n const id = (sequence += 1);\n listeners.set(id, { topic, notify });\n const end = () => {\n if (!listeners.delete(id)) return;\n if (refusal === null) send({ kind: 'stop', id });\n };\n if (refusal !== null) {\n if (topic === 'connection-refusal') notify(refusal);\n return Promise.resolve(end);\n }\n return new Promise<() => void>((settle, fail) => {\n acks.set(id, { settle: () => settle(end), fail });\n send({ kind: 'observe', id, topic, input });\n });\n }\n\n return {\n rooms: () => ask<readonly AppRoom[]>('rooms', []),\n query: (options?: QueryOptions) => ask<QueryResult>('query', [options]),\n types: (locator: string) => ask<RoomTypes>('types', [locator]),\n syncStatus: () => ask<SyncStatus>('syncStatus', []),\n draft: {\n list: () => ask<readonly DraftEntry[]>('draft.list', []),\n read: (locator: string, path: string) => ask<unknown>('draft.read', [locator, path]),\n replace: (locator: string, path: string, content: unknown) =>\n ask<void>('draft.replace', [locator, path, content]),\n discard: (locator: string, path: string) => ask<void>('draft.discard', [locator, path]),\n },\n save: (locator: string, changes: readonly Change[], replacing?: string) =>\n ask<SaveResult>('save', [locator, changes, replacing]),\n outcome: (identifier: string) => ask<SubmissionOutcome | null>('outcome', [identifier]),\n queue: {\n discard: (locator: string, identifier: string) =>\n ask<void>('queue.discard', [locator, identifier]),\n },\n presentation: {\n read: () => ask<unknown>('presentation.read', []),\n write: (value: unknown) => ask<void>('presentation.write', [value]),\n },\n conversation: {\n list: () => ask<readonly ConversationEntry[]>('conversation.list', []),\n read: (conversation: string) => ask<ConversationView>('conversation.read', [conversation]),\n older: (conversation: string) => ask<CallResult | null>('conversation.older', [conversation]),\n compose: (conversation: string, instruction: UnsentInstruction) =>\n ask<void>('conversation.compose', [conversation, instruction]),\n discard: (conversation: string) => ask<void>('conversation.discard', [conversation]),\n create: (input: unknown) => ask<CallResult>('conversation.create', [input]),\n send: (conversation: string) => ask<CallResult>('conversation.send', [conversation]),\n answer: (conversation: string, answer: unknown) =>\n ask<CallResult>('conversation.answer', [conversation, answer]),\n interrupt: (conversation: string) =>\n ask<CallResult>('conversation.interrupt', [conversation]),\n kill: (conversation: string) => ask<CallResult>('conversation.kill', [conversation]),\n cancel: (conversation: string, turn: string) =>\n ask<CallResult>('conversation.cancel', [conversation, turn]),\n delete: (conversation: string) => ask<CallResult>('conversation.delete', [conversation]),\n },\n history: (locator: string, path: string, query?: HistoryQuery) =>\n ask<HistoryResult>('history', [locator, path, query]),\n call: (name: string, input: unknown) => ask<CallResult>('call', [name, input]),\n log: () => ask<string>('log', []),\n storageLoss: () => ask<string | null>('storageLoss', []),\n persistence: () => ask<boolean>('persistence', []),\n observe(\n topic: WireTopic,\n second: QueryOptions | string | ((value: never) => void),\n third?: (value: never) => void,\n ) {\n const positional = topic === 'query' || topic === 'queue' || topic === 'conversation';\n const notify = (positional ? third : second) as (value: unknown) => void;\n return watch(topic, positional ? [second] : [], notify);\n },\n reauthorize: () => ask<void>('reauthorize', []),\n };\n}\n\nexport type { RuntimePort } from './wire.js';\n"],"names":["answer","AUTHORIZATION_ENDED","carried","envelope","PROTOCOL_MISMATCH","connectMdRuntime","port","sequence","refusal","ended","calls","Map","acks","listeners","send","message","postMessage","refuse","reported","waiting","values","settle","clear","failure","Error","reason","fail","listener","topic","notify","end","addEventListener","event","wire","data","matching","kind","get","id","value","subscribing","undefined","delete","start","ask","member","input","Promise","reject","set","watch","resolve","rooms","query","options","types","locator","syncStatus","draft","list","read","path","replace","content","discard","save","changes","replacing","outcome","identifier","queue","presentation","write","conversation","older","compose","instruction","create","interrupt","kill","cancel","turn","history","call","name","log","storageLoss","persistence","observe","second","third","positional","reauthorize"],"mappings":"AAcA,SACEA,MAAM,EACNC,mBAAmB,EACnBC,OAAO,EACPC,QAAQ,EACRC,iBAAiB,QAKZ,YAAY;AAoEnB,OAAO,SAASC,iBAAiBC,IAAiB;IAChD,IAAIC,WAAW;IACf,IAAIC,UAAoC;IACxC,IAAIC,QAAQ;IACZ,MAAMC,QAAQ,IAAIC;IAIlB,MAAMC,OAAO,IAAID;IACjB,MAAME,YAAY,IAAIF;IAEtB,MAAMG,O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