@agentshouse/mdruntime 0.1.0-alpha.1 → 0.1.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +78 -0
- package/dist/adapter.d.ts +142 -29
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js.map +1 -1
- package/dist/bootstrap.d.ts +14 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +55 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/change.d.ts +65 -0
- package/dist/change.d.ts.map +1 -0
- package/dist/change.js +12 -0
- package/dist/change.js.map +1 -0
- 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 +33 -0
- package/dist/collection.d.ts.map +1 -0
- package/dist/collection.js +115 -0
- package/dist/collection.js.map +1 -0
- package/dist/connection.d.ts +85 -7
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1573 -46
- 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 +404 -0
- package/dist/conversation.js.map +1 -0
- package/dist/durability.d.ts +9 -0
- package/dist/durability.d.ts.map +1 -0
- package/dist/durability.js +11 -0
- package/dist/durability.js.map +1 -0
- package/dist/file.d.ts +20 -0
- package/dist/file.d.ts.map +1 -0
- package/dist/file.js +149 -0
- package/dist/file.js.map +1 -0
- package/dist/host.d.ts +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/identity.d.ts +2 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +16 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/log.d.ts +5 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +15 -0
- package/dist/log.js.map +1 -0
- package/dist/memory.d.ts +24 -4
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +300 -37
- package/dist/memory.js.map +1 -1
- package/dist/model.d.ts +70 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +28 -0
- package/dist/model.js.map +1 -0
- package/dist/outcome.d.ts +37 -0
- package/dist/outcome.d.ts.map +1 -0
- package/dist/outcome.js +23 -0
- package/dist/outcome.js.map +1 -0
- package/dist/overlay.d.ts +8 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +139 -0
- package/dist/overlay.js.map +1 -0
- package/dist/paths.d.ts +6 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +47 -0
- package/dist/paths.js.map +1 -0
- package/dist/query.d.ts +13 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +18 -0
- package/dist/query.js.map +1 -0
- package/dist/refresh.d.ts +14 -0
- package/dist/refresh.d.ts.map +1 -0
- package/dist/refresh.js +65 -0
- package/dist/refresh.js.map +1 -0
- package/dist/replica.d.ts +23 -0
- package/dist/replica.d.ts.map +1 -0
- package/dist/replica.js +78 -0
- package/dist/replica.js.map +1 -0
- package/dist/save.d.ts +31 -0
- package/dist/save.d.ts.map +1 -0
- package/dist/save.js +537 -0
- package/dist/save.js.map +1 -0
- package/dist/status.d.ts +25 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +32 -0
- package/dist/status.js.map +1 -0
- package/dist/store.d.ts +76 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +191 -0
- package/dist/store.js.map +1 -0
- package/dist/transfer.d.ts +5 -0
- package/dist/transfer.d.ts.map +1 -0
- package/dist/transfer.js +5 -0
- package/dist/transfer.js.map +1 -0
- 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 +15 -2
package/AGENTS.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Instructions for the App Creator's agent
|
|
2
|
+
|
|
3
|
+
These instructions address an agent in an environment with Git. Obtain the
|
|
4
|
+
App Repository, change it, build, and push. They are documentation, not
|
|
5
|
+
enforcement.
|
|
6
|
+
|
|
7
|
+
## The MD Runtime API
|
|
8
|
+
|
|
9
|
+
App code reaches the MD Runtime through the remote client. The surfaces are
|
|
10
|
+
Rooms, Query, Observe, Types, Draft, Save, Queue, History, Call, Log,
|
|
11
|
+
storage loss, the reported persistence answer, Sync Status, reauthorization,
|
|
12
|
+
conversation, the unsent instruction, and Presentation State.
|
|
13
|
+
|
|
14
|
+
Rooms, Query, Observe, Types, Draft, and Save never touch the network.
|
|
15
|
+
History and Call go to the Provider through the Adapter. Every member of the
|
|
16
|
+
client is asynchronous. Results are detached snapshots. Nothing in this
|
|
17
|
+
surface returns the authorization, performs a request the App's code
|
|
18
|
+
composes, or exposes the browser store.
|
|
19
|
+
|
|
20
|
+
The in-memory Adapter at `@agentshouse/mdruntime/memory` is for tests and
|
|
21
|
+
ships in no bundle.
|
|
22
|
+
|
|
23
|
+
## Draft, Save, and outcome rules
|
|
24
|
+
|
|
25
|
+
A Draft is durable: it survives reload and navigation. Save takes structured
|
|
26
|
+
changes, validates locally, and on success appends one Change Batch to that
|
|
27
|
+
Room's queue. A local validation failure leaves the Draft and creates
|
|
28
|
+
nothing.
|
|
29
|
+
|
|
30
|
+
Outcomes follow the Provider's answer. Accepted advances the confirmed
|
|
31
|
+
layer. Conflicted and Rejected leave the head in place, carry the affected
|
|
32
|
+
current state and the Provider's structured refusal code and fields as
|
|
33
|
+
returned, and block that Room's queue. The App's code resolves a head by
|
|
34
|
+
discarding it or by saving a corrected Change Batch that replaces it in
|
|
35
|
+
place. Transport failure and Provider unavailability keep work Pending and
|
|
36
|
+
do not infer a rejection. A refusal the Provider marks retryable stays
|
|
37
|
+
Pending until the reset it names; the MD Runtime retries the same Change
|
|
38
|
+
Batch identity and payload and never infers an outcome from transport
|
|
39
|
+
uncertainty. The MD Runtime never combines, reorders, or rebases.
|
|
40
|
+
|
|
41
|
+
## The neutrality rule
|
|
42
|
+
|
|
43
|
+
No module outside an Adapter package imports, names, or special-cases a
|
|
44
|
+
Provider. MD UI and every App reach data only through the client entry.
|
|
45
|
+
|
|
46
|
+
## Content-safety rules
|
|
47
|
+
|
|
48
|
+
The Provider authorization belongs to the Runtime host and is never readable
|
|
49
|
+
by the App's code. The App's code reaches the network only at the external
|
|
50
|
+
origins its manifest declares, empty by default, and the Provider enforces
|
|
51
|
+
that set. Every request to the Provider itself goes through the MD Runtime.
|
|
52
|
+
Rendered Markdown never executes scripts, renders raw HTML only for the
|
|
53
|
+
details and summary elements, and loads images and other resources only from
|
|
54
|
+
origins the Provider's policy allows.
|
|
55
|
+
|
|
56
|
+
## Launch promises MD UI keeps
|
|
57
|
+
|
|
58
|
+
MD UI uses semantic HTML, is fully operable from a keyboard with visible
|
|
59
|
+
focus and labelled controls, and lays out from a 360 pixel wide viewport to
|
|
60
|
+
a desktop. Its strings are English only, dates and numbers follow the
|
|
61
|
+
browser locale, and content is never translated. Light and dark themes come
|
|
62
|
+
from CSS custom properties with the browser's preference as the default and
|
|
63
|
+
an App's override respected. What an App Creator's agent adds carries none
|
|
64
|
+
of these promises by itself. Reading and querying never wait for the
|
|
65
|
+
network. Data lives only in the App Creator's browser and with the Provider.
|
|
66
|
+
|
|
67
|
+
## App code imports only the client entry and never constructs a Runtime
|
|
68
|
+
|
|
69
|
+
App code imports only `@agentshouse/mdruntime/client` and calls
|
|
70
|
+
`connectMdRuntime` on the port the host hands it. It never constructs a
|
|
71
|
+
Runtime. It does not import the package main, the host entry, or the Adapter
|
|
72
|
+
package, and it does not call `createMdRuntime` or `serveMdRuntime`. Hosts
|
|
73
|
+
and tests use those entries; the served App does not.
|
|
74
|
+
|
|
75
|
+
## What an agent must never do
|
|
76
|
+
|
|
77
|
+
An agent must never read the authorization, load code from a Room, call the
|
|
78
|
+
Provider directly, or rebase a refused Change Batch.
|
package/dist/adapter.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ModelIdentity, ModelResult } from './model.js';
|
|
2
|
+
import type { ChangeBatch } from './change.js';
|
|
1
3
|
export type Authorization = object;
|
|
2
4
|
export declare const ROOM_CONTRACT_VERSION = 1;
|
|
3
5
|
export declare const VERSION_1_CAPABILITIES: readonly ['stable-file-ids', 'ranked-provider-search', 'room-version-notifications', 'room-history', 'provider-actions'];
|
|
@@ -5,17 +7,65 @@ export type MdModelIdentity = {
|
|
|
5
7
|
identity: string;
|
|
6
8
|
version: string;
|
|
7
9
|
};
|
|
10
|
+
export type TypedSelection = {
|
|
11
|
+
roots: readonly string[];
|
|
12
|
+
attachedModel: ModelIdentity | null;
|
|
13
|
+
};
|
|
14
|
+
export type OperationScopes = {
|
|
15
|
+
read: readonly string[];
|
|
16
|
+
sync: readonly string[];
|
|
17
|
+
write: readonly string[];
|
|
18
|
+
delete: readonly string[];
|
|
19
|
+
};
|
|
20
|
+
export type ReplicaAdmission = {
|
|
21
|
+
selection: string;
|
|
22
|
+
admission: 'admitted' | 'unavailable';
|
|
23
|
+
};
|
|
8
24
|
export type DiscoveredRoom = {
|
|
25
|
+
collectionRoot: string;
|
|
9
26
|
name: string;
|
|
10
27
|
locator: string;
|
|
11
28
|
roomVersion: string;
|
|
12
|
-
|
|
29
|
+
operations: OperationScopes;
|
|
30
|
+
replica: ReplicaAdmission;
|
|
31
|
+
attachedModel: ModelIdentity | null;
|
|
32
|
+
typedSelection?: TypedSelection;
|
|
13
33
|
providerOwnedPaths: readonly string[];
|
|
14
34
|
};
|
|
15
35
|
export type Capability = {
|
|
16
36
|
name: string;
|
|
17
37
|
limits?: readonly ProviderLimit[];
|
|
18
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;
|
|
19
69
|
};
|
|
20
70
|
export type ActionDeclaration = {
|
|
21
71
|
name: string;
|
|
@@ -26,8 +76,14 @@ export type ProviderLimit = {
|
|
|
26
76
|
name: string;
|
|
27
77
|
value?: number | string;
|
|
28
78
|
};
|
|
79
|
+
export type HistoryRetention = {
|
|
80
|
+
kind: 'duration';
|
|
81
|
+
seconds: number;
|
|
82
|
+
} | {
|
|
83
|
+
kind: 'no-declared-time-bound';
|
|
84
|
+
};
|
|
29
85
|
export type Retention = {
|
|
30
|
-
history:
|
|
86
|
+
history: HistoryRetention;
|
|
31
87
|
outcome: number;
|
|
32
88
|
refreshHorizon: number;
|
|
33
89
|
};
|
|
@@ -39,7 +95,6 @@ export type Discovery = {
|
|
|
39
95
|
capabilities: readonly Capability[];
|
|
40
96
|
providerLimits: readonly ProviderLimit[];
|
|
41
97
|
retention: Retention;
|
|
42
|
-
origins: readonly string[];
|
|
43
98
|
};
|
|
44
99
|
export type TransportUncertainty = {
|
|
45
100
|
kind: 'transport-uncertainty';
|
|
@@ -51,64 +106,101 @@ export type RoomNotReadable = {
|
|
|
51
106
|
export type RevokedAuthorization = {
|
|
52
107
|
kind: 'revoked-authorization';
|
|
53
108
|
};
|
|
54
|
-
export type
|
|
55
|
-
|
|
109
|
+
export type ProviderRefusal = {
|
|
110
|
+
code: string;
|
|
111
|
+
fields: Readonly<Record<string, unknown>>;
|
|
112
|
+
};
|
|
113
|
+
export type ScopedRefusal = ProviderRefusal & {
|
|
114
|
+
kind: 'scoped-refusal';
|
|
115
|
+
locator: string;
|
|
116
|
+
scope: 'content' | 'sync' | 'model' | 'operation' | 'undisclosed';
|
|
117
|
+
};
|
|
118
|
+
export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
|
|
119
|
+
export type ContractUnavailable = ProviderRefusal & {
|
|
120
|
+
kind: 'contract-unavailable';
|
|
121
|
+
};
|
|
122
|
+
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
56
123
|
export type PageToken = string;
|
|
57
124
|
export type BootstrapRequest = {
|
|
58
125
|
locator: string;
|
|
126
|
+
selection: string;
|
|
59
127
|
pageToken?: PageToken;
|
|
60
128
|
};
|
|
61
|
-
export type
|
|
129
|
+
export type BootstrapPage = {
|
|
62
130
|
kind: 'bootstrap';
|
|
63
131
|
roomVersion: string;
|
|
132
|
+
documents: Readonly<Record<string, string>>;
|
|
133
|
+
revisions: Readonly<Record<string, string>>;
|
|
134
|
+
binaryTargets: readonly string[];
|
|
64
135
|
pageToken?: PageToken;
|
|
65
|
-
}
|
|
136
|
+
};
|
|
137
|
+
export type BootstrapResult = BootstrapPage | AdapterFailure;
|
|
66
138
|
export type RefreshRequest = {
|
|
67
139
|
locator: string;
|
|
140
|
+
selection: string;
|
|
68
141
|
fromRoomVersion: string;
|
|
69
142
|
pageToken?: PageToken;
|
|
70
143
|
};
|
|
71
|
-
export type
|
|
72
|
-
kind: 'still-current';
|
|
73
|
-
} | {
|
|
144
|
+
export type RefreshPage = {
|
|
74
145
|
kind: 'net-advancement';
|
|
75
146
|
roomVersion: string;
|
|
147
|
+
documents: Readonly<Record<string, string>>;
|
|
148
|
+
revisions: Readonly<Record<string, string>>;
|
|
149
|
+
binaryTargets: readonly string[];
|
|
150
|
+
removals: readonly string[];
|
|
76
151
|
pageToken?: PageToken;
|
|
77
|
-
}
|
|
152
|
+
};
|
|
153
|
+
export type RefreshResult = {
|
|
154
|
+
kind: 'still-current';
|
|
155
|
+
} | RefreshPage | {
|
|
78
156
|
kind: 'beyond-horizon';
|
|
79
157
|
} | AdapterFailure;
|
|
80
158
|
export type MutationRequest = {
|
|
81
159
|
locator: string;
|
|
82
|
-
changeBatch:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
160
|
+
changeBatch: ChangeBatch;
|
|
161
|
+
};
|
|
162
|
+
export type RetryableRefusal = ProviderRefusal & {
|
|
163
|
+
kind: 'retryable-refusal';
|
|
164
|
+
reset?: string;
|
|
88
165
|
};
|
|
89
166
|
export type MutationResult = {
|
|
90
167
|
kind: 'accepted';
|
|
91
168
|
roomVersion: string;
|
|
92
|
-
|
|
169
|
+
documents: Readonly<Record<string, string>>;
|
|
170
|
+
revisions: Readonly<Record<string, string>>;
|
|
171
|
+
removals: readonly string[];
|
|
172
|
+
author?: string;
|
|
173
|
+
time?: string;
|
|
174
|
+
} | (ProviderRefusal & {
|
|
93
175
|
kind: 'conflicted';
|
|
94
|
-
roomVersion
|
|
95
|
-
|
|
96
|
-
} | {
|
|
176
|
+
roomVersion?: string;
|
|
177
|
+
affected: Readonly<Record<string, string>>;
|
|
178
|
+
}) | (ProviderRefusal & {
|
|
97
179
|
kind: 'rejected';
|
|
98
|
-
|
|
180
|
+
affected: Readonly<Record<string, string>>;
|
|
181
|
+
}) | RetryableRefusal | {
|
|
182
|
+
kind: 'expired';
|
|
99
183
|
} | AdapterFailure;
|
|
184
|
+
export type HistoryRevision = {
|
|
185
|
+
revision: string;
|
|
186
|
+
author: string;
|
|
187
|
+
time: string;
|
|
188
|
+
};
|
|
100
189
|
export type HistoryRequest = {
|
|
101
190
|
locator: string;
|
|
102
191
|
path: string;
|
|
192
|
+
revision?: string;
|
|
103
193
|
pageToken?: PageToken;
|
|
104
194
|
};
|
|
105
195
|
export type HistoryResult = {
|
|
106
196
|
kind: 'history';
|
|
107
|
-
revisions: readonly
|
|
108
|
-
author: string;
|
|
109
|
-
time: string;
|
|
110
|
-
}[];
|
|
197
|
+
revisions: readonly HistoryRevision[];
|
|
111
198
|
pageToken?: PageToken;
|
|
199
|
+
} | {
|
|
200
|
+
kind: 'revision';
|
|
201
|
+
content: string;
|
|
202
|
+
} | {
|
|
203
|
+
kind: 'no-history';
|
|
112
204
|
} | AdapterFailure;
|
|
113
205
|
export type ActionRequest = {
|
|
114
206
|
name: string;
|
|
@@ -117,11 +209,30 @@ export type ActionRequest = {
|
|
|
117
209
|
export type ActionResult = {
|
|
118
210
|
kind: 'action';
|
|
119
211
|
result: unknown;
|
|
120
|
-
} | {
|
|
212
|
+
} | (ProviderRefusal & {
|
|
121
213
|
kind: 'rejected';
|
|
122
|
-
|
|
123
|
-
|
|
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
|
+
};
|
|
124
234
|
export type Adapter = {
|
|
235
|
+
model(authorization: Authorization, request: ModelRequest): Promise<ModelResult>;
|
|
125
236
|
authorize(): Promise<Authorization>;
|
|
126
237
|
discover(authorization: Authorization): Promise<DiscoverResult>;
|
|
127
238
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
@@ -129,5 +240,7 @@ export type Adapter = {
|
|
|
129
240
|
mutate(authorization: Authorization, request: MutationRequest): Promise<MutationResult>;
|
|
130
241
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
131
242
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
243
|
+
roomVersions?: SelectedRooms;
|
|
244
|
+
conversations?: ViewedConversations;
|
|
132
245
|
};
|
|
133
246
|
//# sourceMappingURL=adapter.d.ts.map
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,eAAO,MAAM,sBAAsB,YACjC,iBAAiB,EACjB,wBAAwB,EACxB,4BAA4B,EAC5B,cAAc,EACd,kBAAkB,CACV,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7D,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C,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":["
|
|
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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AttachedModelBinding } from './model.js';
|
|
2
|
+
import type { ModelState } from './model.js';
|
|
3
|
+
import type { Adapter, AdapterFailure, Authorization, DiscoveredRoom } from './adapter.js';
|
|
4
|
+
import { type ConfirmedLayer } from './replica.js';
|
|
5
|
+
import { type Unconfirmed } from './transfer.js';
|
|
6
|
+
export type BootstrapOutcome = {
|
|
7
|
+
kind: 'staged';
|
|
8
|
+
confirmed: ConfirmedLayer;
|
|
9
|
+
} | Unconfirmed | AdapterFailure;
|
|
10
|
+
export declare function bootstrapRoom(adapter: Adapter, authorization: Authorization, room: DiscoveredRoom, models: {
|
|
11
|
+
collection: ModelState;
|
|
12
|
+
selection: ModelState;
|
|
13
|
+
}, binding: AttachedModelBinding | null): Promise<BootstrapOutcome>;
|
|
14
|
+
//# sourceMappingURL=bootstrap.d.ts.map
|
|
@@ -0,0 +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;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,cAAc,CAAA;CAAE,GAC7C,WAAW,GACX,cAAc,CAAC;AAEnB,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAAE,EACzD,OAAO,EAAE,oBAAoB,GAAG,IAAI,GACnC,OAAO,CAAC,gBAAgB,CAAC,CA4C3B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { readStaged } from './replica.js';
|
|
2
|
+
import { unconfirmed } from './transfer.js';
|
|
3
|
+
export async function bootstrapRoom(adapter, authorization, room, models, binding) {
|
|
4
|
+
const first = await adapter.bootstrap(authorization, {
|
|
5
|
+
locator: room.locator,
|
|
6
|
+
selection: room.replica.selection
|
|
7
|
+
});
|
|
8
|
+
if (first.kind !== 'bootstrap') return first;
|
|
9
|
+
const roomVersion = first.roomVersion;
|
|
10
|
+
const documents = {
|
|
11
|
+
...first.documents
|
|
12
|
+
};
|
|
13
|
+
const revisions = {
|
|
14
|
+
...first.revisions
|
|
15
|
+
};
|
|
16
|
+
const binaryTargets = new Set(first.binaryTargets);
|
|
17
|
+
let pageToken = first.pageToken;
|
|
18
|
+
while(pageToken !== undefined){
|
|
19
|
+
const page = await adapter.bootstrap(authorization, {
|
|
20
|
+
locator: room.locator,
|
|
21
|
+
selection: room.replica.selection,
|
|
22
|
+
pageToken
|
|
23
|
+
});
|
|
24
|
+
if (page.kind !== 'bootstrap') return page;
|
|
25
|
+
if (page.roomVersion !== roomVersion) return unconfirmed;
|
|
26
|
+
Object.assign(documents, page.documents);
|
|
27
|
+
Object.assign(revisions, page.revisions);
|
|
28
|
+
for (const target of page.binaryTargets)binaryTargets.add(target);
|
|
29
|
+
pageToken = page.pageToken;
|
|
30
|
+
}
|
|
31
|
+
const confirmed = readStaged({
|
|
32
|
+
locator: room.locator,
|
|
33
|
+
collectionRoot: room.collectionRoot,
|
|
34
|
+
name: room.name,
|
|
35
|
+
operations: room.operations,
|
|
36
|
+
replica: room.replica,
|
|
37
|
+
attachedModel: room.attachedModel,
|
|
38
|
+
model: models.collection,
|
|
39
|
+
typedSelection: room.typedSelection ?? null,
|
|
40
|
+
selectionModel: models.selection,
|
|
41
|
+
providerOwnedPaths: room.providerOwnedPaths,
|
|
42
|
+
roomVersion,
|
|
43
|
+
documents,
|
|
44
|
+
binaryTargets: [
|
|
45
|
+
...binaryTargets
|
|
46
|
+
].sort(),
|
|
47
|
+
revisions
|
|
48
|
+
}, binding);
|
|
49
|
+
return confirmed === null ? unconfirmed : {
|
|
50
|
+
kind: 'staged',
|
|
51
|
+
confirmed
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +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 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,cACpBC,OAAgB,EAChBC,aAA4B,EAC5BC,IAAoB,EACpBC,MAAyD,EACzDC,OAAoC;IAEpC,MAA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I;QACtCpB;IACF,GACAT;IAEF,OAAOmB,cAAc,OAAOzB,cAAc;QAAEY,MAAM;QAAUa;IAAU;AACxE"}
|
package/dist/change.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type Change = {
|
|
2
|
+
readonly kind: 'field';
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly value: unknown;
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: 'section';
|
|
8
|
+
readonly path: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly value: string;
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'preamble';
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly value: string;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'create';
|
|
17
|
+
readonly path: string;
|
|
18
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
19
|
+
readonly sections: Readonly<Record<string, string>>;
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'replace';
|
|
22
|
+
readonly path: string;
|
|
23
|
+
readonly content: string;
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: 'move';
|
|
26
|
+
readonly path: string;
|
|
27
|
+
readonly to: string;
|
|
28
|
+
} | {
|
|
29
|
+
readonly kind: 'remove';
|
|
30
|
+
readonly path: string;
|
|
31
|
+
};
|
|
32
|
+
export type Precondition = {
|
|
33
|
+
readonly kind: 'field';
|
|
34
|
+
readonly path: string;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly value: unknown;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: 'section';
|
|
39
|
+
readonly path: string;
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly value: string;
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: 'preamble';
|
|
44
|
+
readonly path: string;
|
|
45
|
+
readonly value: string;
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: 'revision';
|
|
48
|
+
readonly path: string;
|
|
49
|
+
readonly revision: string;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: 'present';
|
|
52
|
+
readonly path: string;
|
|
53
|
+
} | {
|
|
54
|
+
readonly kind: 'absent';
|
|
55
|
+
readonly path: string;
|
|
56
|
+
};
|
|
57
|
+
export type ChangeBatch = {
|
|
58
|
+
validation?: import('./model.js').ValidationReceipt;
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly baseRoomVersion: string;
|
|
61
|
+
readonly changes: readonly Change[];
|
|
62
|
+
readonly preconditions: readonly Precondition[];
|
|
63
|
+
};
|
|
64
|
+
export declare function immutable(batch: ChangeBatch): ChangeBatch;
|
|
65
|
+
//# sourceMappingURL=change.d.ts.map
|
|
@@ -0,0 +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,CA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,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,CAAC,EAAE,OAAO,YAAY,EAAE,iBAAiB,CAAC;IACpD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,CAAC;CACjD,CAAC;AAUF,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAEzD"}
|
package/dist/change.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function frozen(value) {
|
|
2
|
+
if (Array.isArray(value)) return Object.freeze(value.map((item)=>frozen(item)));
|
|
3
|
+
if (value === null || typeof value !== 'object') return value;
|
|
4
|
+
const copy = {};
|
|
5
|
+
for (const [name, item] of Object.entries(value))copy[name] = frozen(item);
|
|
6
|
+
return Object.freeze(copy);
|
|
7
|
+
}
|
|
8
|
+
export function immutable(batch) {
|
|
9
|
+
return frozen(batch);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=change.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/change.ts"],"sourcesContent":["export type Change =\n | {\n readonly kind: 'field';\n readonly path: string;\n readonly name: string;\n readonly value: unknown;\n }\n | {\n readonly kind: 'section';\n readonly path: string;\n readonly name: string;\n readonly value: string;\n }\n | { readonly kind: 'preamble'; readonly path: string; readonly value: string }\n | {\n readonly kind: 'create';\n readonly path: string;\n readonly fields: Readonly<Record<string, unknown>>;\n readonly sections: Readonly<Record<string, string>>;\n }\n | { readonly kind: 'replace'; readonly path: string; readonly content: string }\n | { readonly kind: 'move'; readonly path: string; readonly to: string }\n | { readonly kind: 'remove'; readonly path: string };\n\nexport type Precondition =\n | {\n readonly kind: 'field';\n readonly path: string;\n readonly name: string;\n readonly value: unknown;\n }\n | {\n readonly kind: 'section';\n readonly path: string;\n readonly name: string;\n readonly value: string;\n }\n | { readonly kind: 'preamble'; readonly path: string; readonly value: string }\n | { readonly kind: 'revision'; readonly path: string; readonly revision: string }\n | { readonly kind: 'present'; readonly path: string }\n | { readonly kind: 'absent'; readonly path: string };\n\nexport type ChangeBatch = {\n validation?: import('./model.js').ValidationReceipt;\n readonly id: string;\n readonly baseRoomVersion: string;\n readonly changes: readonly Change[];\n readonly preconditions: readonly Precondition[];\n};\n\nfunction frozen<T>(value: T): T {\n if (Array.isArray(value)) return Object.freeze(value.map((item) => frozen(item))) as T;\n if (value === null || typeof value !== 'object') return value;\n const copy: Record<string, unknown> = {};\n for (const [name, item] of Object.entries(value)) copy[name] = frozen(item);\n return Object.freeze(copy) as T;\n}\n\nexport function immutable(batch: ChangeBatch): ChangeBatch {\n return frozen(batch);\n}\n"],"names":["frozen","value","Array","isArray","Object","freeze","map","item","copy","name","entries","immutable","batch"],"mappings":"AAkDA,SAASA,OAAUC,KAAQ;IACzB,IAAIC,MAAMC,OAAO,CAACF,QAAQ,OAAOG,OAAOC,MAAM,CAACJ,MAAMK,GAAG,CAAC,CAACC,OAASP,OAAOO;IAC1E,IAAIN,UAAU,QAAQ,OAAOA,UAAU,UAAU,OAAOA;IACxD,MAAMO,OAAgC,CAAC;IACvC,KAAK,MAAM,CAACC,MAAMF,KAAK,IAAIH,OAAOM,OAAO,CAACT,OAAQO,IAAI,CAACC,KAAK,GAAGT,OAAOO;IACtE,OAAOH,OAAOC,MAAM,CAACG;AACvB;AAEA,OAAO,SAASG,UAAUC,KAAkB;IAC1C,OAAOZ,OAAOY;AAChB"}
|
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
|