@agentshouse/mdruntime-adapter 0.1.0-cea44707d3919 → 0.1.0-cf6a7cf003c4b

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 CHANGED
@@ -51,7 +51,9 @@ open one through the Provider Action that serves it.
51
51
 
52
52
  Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never
53
53
  touch the network.
54
- History and Call go to the Provider through the Adapter. A Call result whose
54
+ History and Call go to the Provider through the Adapter. Call takes the Action names
55
+ the Adapter declares; any other name answers `undeclared` without reaching the
56
+ Provider. A Call result whose
55
57
  effect the Provider places in a Room carries `at`, that Room and Room Version;
56
58
  `reached(room, roomVersion)` answers whether the Room's confirmed state has
57
59
  reached it, and the MD Runtime keeps refreshing that Room until it has;
@@ -66,6 +68,13 @@ client is asynchronous. Results are detached snapshots. Nothing in this
66
68
  surface returns the authorization, performs a request the App's code
67
69
  composes, or exposes the browser store.
68
70
 
71
+ Every refusal and failure carries `code` and `retryable`: each Call and History answer
72
+ other than its result, a refused Save or Room Draft write, a returned Room Draft's
73
+ reason, a Room's refusal and the Connection Refusal, and every error a member rejects
74
+ with, beside its message. A Provider refusal carries the Provider's own `retryable`.
75
+ Every code and every value the API answers is open: handle one you do not know by its
76
+ `code` and `retryable`.
77
+
69
78
  Read the deployment facts with `observe('deployment-facts')`. Interpret the
70
79
  opaque value using the host's contract.
71
80
 
@@ -121,7 +130,7 @@ data:
121
130
  or `null` for a write the Provider made itself, and `time` is the Provider's
122
131
  ISO 8601 change time. It is `null` where the Provider delivered no time, as at
123
132
  a Site. An unsent edit or move keeps it, an unsent creation has none, and a
124
- saved write takes the Provider's own once it is Accepted and refreshed. A
133
+ saved write takes the Provider's own once it is Accepted. A
125
134
  Room's last change is its Document with the latest `time`.
126
135
  - **Order and groups.** `orderBy` sorts by `room`, `path`, `type` or `{ field }`
127
136
  with TanStack DB's own options, and ties end with Room, then Path. `groupBy` by
@@ -129,9 +138,9 @@ data:
129
138
  over every match and ordered by `count` or a key. A sort or group takes only a
130
139
  pointer that holds one value. `limit` bounds the Documents or the groups.
131
140
  - **Results and errors.** A result carries no Room Version: read freshness from
132
- Rooms and Sync Status. An invalid query fails with `invalid-query`,
133
- `unknown-type`, `unknown-field` or `wrong-kind`, naming where, and never
134
- answers an empty result in its place.
141
+ Rooms and Sync Status. An invalid query fails with the `code`
142
+ `invalid-query`, `unknown-type`, `unknown-field` or `wrong-kind`, naming where,
143
+ and never answers an empty result in its place.
135
144
 
136
145
  ## Local Search rules
137
146
 
@@ -169,9 +178,9 @@ the current Room Draft; read it and write again.
169
178
 
170
179
  Save takes one Room and the Room Drafts of it to save, each with its revision,
171
180
  validates locally, and on success appends one Change Batch to that Room's
172
- queue and removes those Room Drafts. It is refused as `stale`, as
181
+ queue and removes those Room Drafts. It is refused with the `code` `stale`,
173
182
  `changed-underneath` naming each part whose base no longer matches the visible
174
- state, or by a local validation rule, and then creates nothing and leaves every
183
+ state, or a local validation rule, and then creates nothing and leaves every
175
184
  Room Draft in place. A directory move or removal is a move or removal part on
176
185
  each Document and binary link target beneath it, saved together.
177
186
 
@@ -191,6 +200,13 @@ it names; the MD Runtime retries the same Change Batch identity and payload and
191
200
  never infers an outcome from transport uncertainty. The MD Runtime never
192
201
  combines, reorders, or rebases.
193
202
 
203
+ On a Site, every Save stays in the visitor's browser. Write grants and
204
+ revisions do not refuse it, and its Pending Change shows in every query and
205
+ across reloads until the browser's storage is cleared. It is never sent:
206
+ `observe('queue', room)` shows it `local`, and Sync Status never waits on it.
207
+ Once the Room changes so that it no longer applies, it leaves the queue and
208
+ returns no Room Draft.
209
+
194
210
  `observe('service-mode')` answers the Provider's Service
195
211
  Mode, `open` or `write-halted`. While writes are halted, Save still succeeds,
196
212
  its Change Batch waits unsent, and the queue is submitted in order once the
@@ -227,7 +243,7 @@ the network. Data lives only in the App Creator's browser and with the Provider.
227
243
  ## App code takes the client its host hands it and never constructs a Runtime
228
244
 
229
245
  App code takes the client its host hands it: in House,
230
- `connectHouseBridge().runtime` from `@agentshouse/app-bridge` resolves to the
246
+ `houseBridge().runtime` from `@agentshouse/app-bridge` resolves to the
231
247
  client House built into the page. It never constructs a Runtime or a client.
232
248
  It imports only types from `@agentshouse/mdruntime/client`, does not call
233
249
  `connectMdRuntime` or `serveMdRuntime`, and does not import the package main,
@@ -236,9 +252,9 @@ served App does not.
236
252
 
237
253
  A React App may observe and save through `@agentshouse/mdruntime/react`, which
238
254
  names React as a peer dependency. `useObserve(client, topic, ...input)` takes
239
- the arguments of `observe` and returns the topic's current value, `undefined`
240
- until it arrives, re-rendering on each change; a `null` client observes
241
- nothing. `useSave(client)` returns `busy`, the last `outcome` or `failure`, and
255
+ the arguments of `observe` and returns `{ state: 'loading' }` until the topic's
256
+ first value arrives, then `{ state: 'ready', value }`, re-rendering on each
257
+ change; a `null` client observes nothing and stays loading. `useSave(client)` returns `busy`, the last `outcome` or `failure`, and
242
258
  `save(room, roomDrafts)`, which writes each Path's parts onto the Room Draft
243
259
  already there, keeping the bases its parts have, or onto a new one, and saves
244
260
  them together. A refused Save leaves the Room Drafts for the App to save again
package/dist/actions.d.ts CHANGED
@@ -1,8 +1,46 @@
1
- import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationAgents } from '@agentshouse/mdruntime';
1
+ import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationAgents, type ConversationHistories, type ConversationHistoryRequest, type FileDeclaration } from '@agentshouse/mdruntime';
2
2
  import type { HouseDoorAnswer, HouseTransport } from './transport.js';
3
+ type Operated = {
4
+ readonly operation_id?: string;
5
+ };
6
+ type ConversationControl = Operated & {
7
+ readonly conversation: string;
8
+ };
9
+ type SentFile = FileDeclaration & {
10
+ readonly blob: Blob;
11
+ };
12
+ export type AppInputs = {
13
+ readonly 'conversation.answer': ConversationControl & {
14
+ readonly answer: {
15
+ readonly interaction_id: string;
16
+ readonly response: unknown;
17
+ };
18
+ };
19
+ readonly 'conversation.create': Operated & {
20
+ readonly agent_id: string;
21
+ };
22
+ readonly 'conversation.delete': ConversationControl;
23
+ readonly 'conversation.history': ConversationHistoryRequest;
24
+ readonly 'conversation.interrupt': ConversationControl;
25
+ readonly 'conversation.kill': ConversationControl;
26
+ readonly 'conversation.send': ConversationControl & {
27
+ readonly text?: string;
28
+ readonly files?: readonly SentFile[];
29
+ };
30
+ };
31
+ export type AppAnswers = {
32
+ readonly 'conversation.history': ConversationHistories;
33
+ };
34
+ export type AppAnswerAdditions = {
35
+ readonly 'conversation.send': {
36
+ readonly turn: string;
37
+ };
38
+ };
39
+ export declare const HOUSE_APP_ACTS: Readonly<Record<string, string>>;
3
40
  export declare function houseConversationAgents(locator: string): ConversationAgents;
4
41
  export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
5
42
  export declare function houseAction(transport: HouseTransport, request: ActionRequest): Promise<ActionResult>;
6
43
  export declare function actionOutcome(answer: HouseDoorAnswer, name: string): ActionResult;
7
44
  export declare function acceptedMessage(entry: unknown): AcceptedMessage | null;
45
+ export {};
8
46
  //# sourceMappingURL=actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EAGxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkBtE,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAE3E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,iBAAiB,EAAE,CASvF;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,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wBAAwB,EAAE,mBAAmB,CAAC;IACvD,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAClD,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,GAAG;QAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;KACtC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,sBAAsB,EAAE,qBAAqB,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,mBAAmB,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD,CAAC;AAkEF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE3D,CAAC;AAMF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAE3E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,iBAAiB,EAAE,CAMvF;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAQvB;AA2DD,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAOjF;AAqJD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAUtE"}
package/dist/actions.js CHANGED
@@ -3,44 +3,72 @@ import { doorRefusal } from './refusal.js';
3
3
  const HISTORY_PAGE = 100;
4
4
  const HISTORY_CONVERSATIONS = 64;
5
5
  const OCTET_STREAM = 'application/octet-stream';
6
- const CONVERSATION_ROUTES = new Map([
7
- ['conversation.create', '/door/conversations/create'],
8
- ['conversation.send', '/door/conversations/send'],
9
- ['conversation.answer', '/door/conversations/interaction/answer'],
10
- ['conversation.interrupt', '/door/conversations/interrupt'],
11
- ['conversation.kill', '/door/conversations/kill'],
12
- ['conversation.delete', '/door/conversations/delete'],
13
- ['conversation.history', '/door/conversations/history'],
14
- ]);
6
+ function mapped(door, input = (given) => given) {
7
+ return {
8
+ door,
9
+ async carry(transport, given, name) {
10
+ return actionOutcome(await transport.door(`/door/${door}`, input(given)), name);
11
+ },
12
+ };
13
+ }
14
+ function carried(door, carry) {
15
+ return {
16
+ door,
17
+ carry: (transport, input, name) => carry(transport, `/door/${door}`, input, name),
18
+ };
19
+ }
20
+ const APP_ACTS = {
21
+ 'access.read': mapped('rooms/access/read'),
22
+ 'conversation.answer': mapped('conversations/interaction/answer', answerBody),
23
+ 'conversation.create': mapped('conversations/create', createBody),
24
+ 'conversation.delete': mapped('conversations/delete', controlBody),
25
+ 'conversation.history': carried('conversations/history', historyAction),
26
+ 'conversation.interrupt': mapped('conversations/interrupt', controlBody),
27
+ 'conversation.kill': mapped('conversations/kill', controlBody),
28
+ 'conversation.markDone': mapped('conversations/done'),
29
+ 'conversation.rename': mapped('conversations/rename'),
30
+ 'conversation.send': carried('conversations/send', sendAction),
31
+ 'conversation.setOption': mapped('conversations/option'),
32
+ 'feature.list': mapped('apps/features/read'),
33
+ 'holder.list': mapped('apps/holders'),
34
+ 'holder.ring': mapped('apps/ring'),
35
+ 'member.list': mapped('rooms/members'),
36
+ 'message.send': mapped('apps/messages/send'),
37
+ 'processing.read': mapped('rooms/settings/processing/read'),
38
+ 'record.list': mapped('records/read'),
39
+ 'relay.read': mapped('apps/relay'),
40
+ 'routine.list': mapped('routines/access'),
41
+ 'routineAccess.list': mapped('routines/granted'),
42
+ 'routineAllowance.list': mapped('routines/allowance'),
43
+ 'routineRequest.list': mapped('routines/requests'),
44
+ 'storage.read': mapped('storage/inventory'),
45
+ 'trigger.list': mapped('triggers/read'),
46
+ 'triggerOccurrence.list': mapped('triggers/fired'),
47
+ };
48
+ export const HOUSE_APP_ACTS = Object.fromEntries(Object.entries(APP_ACTS).map(([name, act]) => [name, act.door]));
49
+ const APP_NAMES = new Map(Object.entries(APP_ACTS).map(([name, act]) => [act.door, name]));
15
50
  export function houseConversationAgents(locator) {
16
51
  return { locator, type: 'house-agent', identity: 'agent', name: 'name' };
17
52
  }
18
53
  export function declaredActions(routes) {
19
- const mapped = new Map([...CONVERSATION_ROUTES].map(([name, route]) => [route.slice('/door/'.length), name]));
20
54
  return routes.map((route) => ({
21
- name: mapped.get(route) ?? route,
55
+ name: APP_NAMES.get(route) ?? route,
22
56
  inputShape: {},
23
57
  resultKind: 'house',
24
58
  }));
25
59
  }
26
60
  export function houseAction(transport, request) {
27
- if (request.name === 'conversation.send')
28
- return sendAction(transport, request.input);
29
- if (request.name === 'conversation.history')
30
- return historyAction(transport, request.input);
31
- if (request.name === 'attachments/upload')
32
- return attachAction(transport, request.input);
33
- if (request.name === 'attachments/get')
34
- return openAction(transport, request.input);
61
+ if (Object.hasOwn(APP_ACTS, request.name)) {
62
+ return APP_ACTS[request.name].carry(transport, request.input, request.name);
63
+ }
64
+ if (APP_NAMES.has(request.name))
65
+ return Promise.resolve(unimplemented(request.name));
35
66
  const route = routeOf(request.name);
36
67
  if (route === null)
37
68
  return Promise.resolve(malformed());
38
69
  return carry(transport, route, request.name, request.input);
39
70
  }
40
71
  function routeOf(name) {
41
- const mapped = CONVERSATION_ROUTES.get(name);
42
- if (mapped !== undefined)
43
- return mapped;
44
72
  const parts = name.split('/');
45
73
  if (parts.some((part) => part === '.' || part === '..'))
46
74
  return null;
@@ -62,51 +90,47 @@ function operationId(input) {
62
90
  return text(input, 'operation_id') ?? changeBatchIdentity();
63
91
  }
64
92
  function malformed() {
65
- return { kind: 'rejected', code: 'invalid_request', fields: {} };
93
+ return { kind: 'rejected', code: 'invalid_request', fields: {}, retryable: false };
66
94
  }
67
- function bodyOf(name, input) {
68
- if (name === 'conversation.create') {
69
- return { agent_id: text(input, 'agent_id'), operation_id: operationId(input) };
70
- }
71
- if (name === 'conversation.interrupt' ||
72
- name === 'conversation.kill' ||
73
- name === 'conversation.delete') {
74
- return { conversation_id: text(input, 'conversation'), operation_id: operationId(input) };
75
- }
76
- if (name === 'conversation.answer') {
77
- const nested = record(record(input).answer);
78
- return {
79
- conversation_id: text(input, 'conversation'),
80
- operation_id: operationId(input),
81
- interaction_id: text(nested, 'interaction_id'),
82
- response: nested.response,
83
- };
84
- }
85
- return input;
95
+ function unimplemented(name) {
96
+ return { kind: 'rejected', code: 'action-unimplemented', fields: { name }, retryable: false };
97
+ }
98
+ function createBody(input) {
99
+ return { agent_id: text(input, 'agent_id'), operation_id: operationId(input) };
100
+ }
101
+ function controlBody(input) {
102
+ return { conversation_id: text(input, 'conversation'), operation_id: operationId(input) };
103
+ }
104
+ function answerBody(input) {
105
+ const nested = record(record(input).answer);
106
+ return {
107
+ conversation_id: text(input, 'conversation'),
108
+ operation_id: operationId(input),
109
+ interaction_id: text(nested, 'interaction_id'),
110
+ response: nested.response,
111
+ };
86
112
  }
87
113
  function withTurn(body) {
88
114
  const held = record(body);
89
115
  const turn = text(held, 'message_id');
90
- return turn === undefined ? body : { ...held, turn };
116
+ return turn === undefined
117
+ ? body
118
+ : { ...held, turn };
91
119
  }
92
120
  export function actionOutcome(answer, name) {
93
121
  if (answer.status === 401)
94
122
  return { kind: 'revoked-authorization' };
95
123
  const refusal = doorRefusal(answer.body);
96
- if (refusal !== null) {
97
- return { kind: 'rejected', code: refusal.code, fields: refusal.fields };
98
- }
124
+ if (refusal !== null)
125
+ return { kind: 'rejected', ...refusal };
99
126
  if (answer.status === 404)
100
- return { kind: 'rejected', code: 'action-unimplemented', fields: { name } };
127
+ return unimplemented(name);
101
128
  if (answer.status === 0 || answer.status >= 400)
102
129
  return { kind: 'transport-uncertainty' };
103
- if (name === 'conversation.send')
104
- return { kind: 'action', result: withTurn(answer.body) };
105
130
  return { kind: 'action', result: answer.body };
106
131
  }
107
132
  async function carry(transport, route, name, input) {
108
- const answer = await transport.door(route, bodyOf(name, input));
109
- return actionOutcome(answer, name);
133
+ return actionOutcome(await transport.door(route, input), name);
110
134
  }
111
135
  function sendFile(entry) {
112
136
  const file = record(entry);
@@ -176,12 +200,12 @@ function uploadGrant(entry) {
176
200
  return null;
177
201
  return { method: 'POST', operation: upload.operation, url: upload.url };
178
202
  }
179
- async function uploadOriginals(transport, input, result) {
180
- const originals = record(result).originals;
181
- if (!Array.isArray(originals) || originals.length === 0)
203
+ async function uploadFiles(transport, input, result, name) {
204
+ const sent = record(result).files;
205
+ if (!Array.isArray(sent) || sent.length === 0)
182
206
  return null;
183
207
  const files = Array.isArray(record(input).files) ? record(input).files : [];
184
- for (const [index, entry] of originals.entries()) {
208
+ for (const [index, entry] of sent.entries()) {
185
209
  const grant = uploadGrant(entry);
186
210
  if (grant === 'absent')
187
211
  continue;
@@ -189,81 +213,35 @@ async function uploadOriginals(transport, input, result) {
189
213
  return malformed();
190
214
  const bytes = index < files.length ? await fileBytes(files[index]) : null;
191
215
  if (bytes === null) {
192
- return { kind: 'rejected', code: 'conversation_original_descriptor_required', fields: {} };
216
+ return {
217
+ kind: 'rejected',
218
+ code: 'conversation_file_descriptor_required',
219
+ fields: {},
220
+ retryable: false,
221
+ };
193
222
  }
194
223
  const failed = delivered(await transport.transfer({
195
- act: 'conversation_original_upload',
196
- method: 'POST',
224
+ act: 'conversation_file_upload',
197
225
  url: grant.url,
198
- answer: 'json',
199
226
  body: bytes,
200
227
  operation: grant.operation,
201
- }), 'conversation.send');
228
+ }), name);
202
229
  if (failed !== null)
203
230
  return failed;
204
231
  }
205
232
  return null;
206
233
  }
207
- async function attachAction(transport, input) {
208
- const { blob, ...descriptor } = record(input);
209
- const bytes = await fileBytes({ blob });
210
- if (bytes === null)
211
- return malformed();
212
- const answer = await transport.door('/door/attachments/upload', descriptor);
213
- const outcome = actionOutcome(answer, 'attachments/upload');
214
- if (outcome.kind !== 'action')
215
- return outcome;
216
- const grant = uploadGrant(outcome.result);
217
- if (grant === 'absent')
218
- return outcome;
219
- if (grant === null)
220
- return malformed();
221
- const stored = await transport.transfer({
222
- act: 'original_upload',
223
- method: 'POST',
224
- url: grant.url,
225
- answer: 'json',
226
- body: bytes,
227
- operation: grant.operation,
228
- });
229
- return delivered(stored, 'attachments/upload') ?? { kind: 'action', result: stored.body };
230
- }
231
- async function openAction(transport, input) {
232
- const answer = await transport.door('/door/attachments/get', input);
233
- const outcome = actionOutcome(answer, 'attachments/get');
234
- if (outcome.kind !== 'action')
235
- return outcome;
236
- const { download, ...opened } = record(outcome.result);
237
- if (download === undefined)
238
- return outcome;
239
- const grant = record(download);
240
- if (grant.method !== 'GET' || typeof grant.url !== 'string')
241
- return malformed();
242
- const read = await transport.transfer({
243
- act: 'original_download',
244
- method: 'GET',
245
- url: grant.url,
246
- answer: 'bytes',
247
- });
248
- const failed = delivered(read, 'attachments/get');
249
- if (failed !== null)
250
- return failed;
251
- if (!(read.body instanceof Blob))
252
- return { kind: 'transport-uncertainty' };
253
- return { kind: 'action', result: { ...opened, blob: read.body } };
254
- }
255
- async function sendAction(transport, input) {
234
+ async function sendAction(transport, route, input, name) {
256
235
  const body = sendBody(input);
257
236
  if (body === null)
258
237
  return malformed();
259
- const answer = await transport.door('/door/conversations/send', body);
260
- const outcome = actionOutcome(answer, 'conversation.send');
238
+ const outcome = actionOutcome(await transport.door(route, body), name);
261
239
  if (outcome.kind !== 'action')
262
240
  return outcome;
263
- const uploaded = await uploadOriginals(transport, input, outcome.result);
241
+ const uploaded = await uploadFiles(transport, input, outcome.result, name);
264
242
  if (uploaded !== null)
265
243
  return uploaded;
266
- return outcome;
244
+ return { ...outcome, result: withTurn(outcome.result) };
267
245
  }
268
246
  function historyCursor(value) {
269
247
  const acceptedAt = text(value, 'accepted_at');
@@ -329,17 +307,17 @@ function historyAsks(input) {
329
307
  }
330
308
  return asks;
331
309
  }
332
- async function historyAction(transport, input) {
310
+ async function historyAction(transport, route, input, name) {
333
311
  const asks = historyAsks(input);
334
312
  if (asks === null)
335
313
  return malformed();
336
314
  const histories = [];
337
315
  for (let at = 0; at < asks.length; at += HISTORY_CONVERSATIONS) {
338
- const answer = await transport.door('/door/conversations/history', {
316
+ const answer = await transport.door(route, {
339
317
  conversations: asks.slice(at, at + HISTORY_CONVERSATIONS),
340
318
  limit: HISTORY_PAGE,
341
319
  });
342
- const outcome = actionOutcome(answer, 'conversation.history');
320
+ const outcome = actionOutcome(answer, name);
343
321
  if (outcome.kind !== 'action')
344
322
  return outcome;
345
323
  const answered = record(outcome.result).histories;
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,OAAO,EACP,aAAa,EAWd,MAAM,wBAAwB,CAAC;AAqChC,OAAO,EAOL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,MAAM,yBAAyB,GACjC;IACE,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC,GACD;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAsBjC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CA0WpF"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,OAAO,EACP,aAAa,EAWd,MAAM,wBAAwB,CAAC;AAuChC,OAAO,EAOL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,MAAM,yBAAyB,GACjC;IACE,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC,GACD;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAwBjC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAuYpF"}
package/dist/adapter.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DISCOVER_PREFIXES, capabilities, discoveredRoom, mapDiscovery, parseDiscovery, trackedFrom, } from './discovery.js';
2
- import { scopeModels, streamedModels, viewModels } from './model.js';
3
- import { gathered, selections } from './gather.js';
2
+ import { partModels, streamedModels, viewModels } from './model.js';
3
+ import { gathered, gatheredEach, selections } from './gather.js';
4
4
  import { createSiteAdapter } from './site.js';
5
5
  import { bootstrapOf, contentPrefixes, matchesScope, parseEnumeration, parseEnvelope, parseGrant, refreshFrom, viewOf, } from './read.js';
6
6
  import { acceptedLinks, enumeratedLinks, heldLinks, scopeLinks, streamedLinks, } from './links.js';
@@ -28,14 +28,26 @@ export function createAgentsHouseAdapter(options) {
28
28
  throw new Error('no Discovery declared the bounds');
29
29
  return bounds;
30
30
  }
31
- async function bootstrappedRoom(envelope, entry) {
32
- const scope = envelope.scopes.find((candidate) => matchesScope(candidate, entry));
31
+ async function bootstrappedRoom(envelope, scope, entry, continued) {
33
32
  if (scope === undefined)
34
33
  return { kind: 'room-not-readable', locator: entry.locator };
35
- handed.set(entry.locator, scopeLinks(scope));
34
+ const next = envelope.next?.room === entry.authority ? envelope.next.path : null;
35
+ if (continued === null && next === null)
36
+ handed.set(entry.locator, scopeLinks(scope));
37
+ else
38
+ handed.delete(entry.locator);
36
39
  notifications.reach(entry.authority, scope);
37
- const models = await scopeModels(scope, entry);
38
- return { ...bootstrapOf(scope), ...(models === undefined ? {} : { models }) };
40
+ const seen = [
41
+ ...(continued?.seen ?? []),
42
+ ...entry.schemas.filter((schema) => scope.files.some((file) => file.path === schema)),
43
+ ];
44
+ const models = await partModels(scope, entry, new Set(seen), next === null);
45
+ const continuation = next === null ? null : { after: next, seen };
46
+ return {
47
+ ...bootstrapOf(scope),
48
+ ...(models === undefined ? {} : { models }),
49
+ ...(continuation === null ? {} : { pageToken: JSON.stringify(continuation) }),
50
+ };
39
51
  }
40
52
  async function enumeratedRoom(enumeration, ask) {
41
53
  const view = viewOf(enumeration, ask.entry);
@@ -109,41 +121,54 @@ export function createAgentsHouseAdapter(options) {
109
121
  return result;
110
122
  return { ...result, at: { locator, roomVersion: roomVersion({ position, logEpoch }) } };
111
123
  }
112
- async function bundled(body) {
113
- const grant = parseGrant(body);
114
- if (grant === null)
115
- return body;
116
- if (grant.method !== 'GET')
117
- return null;
118
- const answer = await transport.transfer({
119
- act: 'local_copy_bundle',
120
- method: 'GET',
121
- url: grant.url,
122
- answer: 'json',
123
- });
124
- return answer.status === 200 ? answer.body : null;
125
- }
126
124
  function weight(entry) {
127
125
  return contentPrefixes(entry).length;
128
126
  }
129
- async function bootstrapped(entries) {
130
- const answers = [];
131
- for (const part of selections(entries, weight, declared().max_prefixes)) {
132
- const answer = await transport.door(DOOR_BOOTSTRAP, {
133
- prefixes: part.flatMap((entry) => contentPrefixes(entry)),
134
- });
135
- const classified = part.map((entry) => classifyDoor(answer.status, answer.body, entry.locator));
136
- const envelope = classified[0] === null ? parseEnvelope(await bundled(answer.body)) : null;
137
- for (const [index, entry] of part.entries()) {
138
- const failure = classified[index];
139
- if (failure === null || failure === undefined) {
140
- answers.push(envelope === null ? UNCERTAIN_READ : await bootstrappedRoom(envelope, entry));
141
- continue;
127
+ async function bootstrapped(entries, answer) {
128
+ let open = entries.map((entry, ask) => ({ entry, ask }));
129
+ while (open.length > 0) {
130
+ const unreached = [];
131
+ for (const part of selections(open, ({ entry }) => weight(entry), declared().max_prefixes)) {
132
+ const answered = await transport.door(DOOR_BOOTSTRAP, {
133
+ prefixes: part.flatMap(({ entry }) => contentPrefixes(entry)),
134
+ });
135
+ const classified = part.map(({ entry }) => classifyDoor(answered.status, answered.body, entry.locator));
136
+ const envelope = classified[0] === null ? parseEnvelope(answered.body) : null;
137
+ for (const [index, asked] of part.entries()) {
138
+ const failure = classified[index];
139
+ if (failure !== null && failure !== undefined) {
140
+ answer(asked.ask, failure);
141
+ continue;
142
+ }
143
+ if (envelope === null) {
144
+ answer(asked.ask, UNCERTAIN_READ);
145
+ continue;
146
+ }
147
+ const scope = envelope.scopes.find((candidate) => matchesScope(candidate, asked.entry));
148
+ if (scope === undefined && envelope.next !== undefined) {
149
+ unreached.push(asked);
150
+ continue;
151
+ }
152
+ answer(asked.ask, await bootstrappedRoom(envelope, scope, asked.entry, null));
142
153
  }
143
- answers.push(failure);
144
154
  }
155
+ open = unreached;
145
156
  }
146
- return answers;
157
+ }
158
+ async function continuedBootstrap(entry, continued) {
159
+ const after = { room: entry.authority, path: continued.after };
160
+ const answered = await transport.door(DOOR_BOOTSTRAP, {
161
+ prefixes: contentPrefixes(entry),
162
+ after,
163
+ });
164
+ const failure = classifyDoor(answered.status, answered.body, entry.locator);
165
+ if (failure !== null)
166
+ return failure;
167
+ const envelope = parseEnvelope(answered.body);
168
+ if (envelope === null)
169
+ return UNCERTAIN_READ;
170
+ const scope = envelope.scopes.find((candidate) => matchesScope(candidate, entry));
171
+ return bootstrappedRoom(envelope, scope, entry, continued);
147
172
  }
148
173
  function layered(asks) {
149
174
  const depths = new Map();
@@ -190,7 +215,7 @@ export function createAgentsHouseAdapter(options) {
190
215
  }
191
216
  return asks.map((ask) => answers.get(ask) ?? UNCERTAIN_READ);
192
217
  }
193
- const bootstrapTogether = gathered(bootstrapped);
218
+ const bootstrapTogether = gatheredEach(bootstrapped);
194
219
  const enumerateTogether = gathered(enumerated);
195
220
  async function uploaded(head, changes, delta, bytes, entry, handed, keep) {
196
221
  const paths = batchPaths(changes);
@@ -207,9 +232,7 @@ export function createAgentsHouseAdapter(options) {
207
232
  return { outcome: UNCERTAIN };
208
233
  const delivered = await transport.transfer({
209
234
  act: 'authored_batch_upload',
210
- method: 'POST',
211
235
  url: grant.url,
212
- answer: 'json',
213
236
  body: `${grant.operation}\n${delta}`,
214
237
  });
215
238
  if (delivered.status !== 200)
@@ -261,8 +284,9 @@ export function createAgentsHouseAdapter(options) {
261
284
  const entry = authorityFor(request.locator);
262
285
  if (entry === undefined)
263
286
  return { kind: 'room-not-readable', locator: request.locator };
264
- if (request.pageToken !== undefined)
265
- return { kind: 'transport-uncertainty' };
287
+ if (request.pageToken !== undefined) {
288
+ return continuedBootstrap(entry, JSON.parse(request.pageToken));
289
+ }
266
290
  return bootstrapTogether(entry);
267
291
  },
268
292
  async refresh(_authorization, request) {
package/dist/gather.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare function gatheredEach<A, R>(send: (asks: readonly A[], answer: (ask: number, result: R) => void) => Promise<void>): (ask: A) => Promise<R>;
1
2
  export declare function gathered<A, R>(send: (asks: readonly A[]) => Promise<readonly R[]>): (ask: A) => Promise<R>;
2
3
  export declare function selections<T>(items: readonly T[], weight: (item: T) => number, limit: number): readonly (readonly T[])[];
3
4
  //# sourceMappingURL=gather.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gather.d.ts","sourceRoot":"","sources":["../src/gather.ts"],"names":[],"mappings":"AAMA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClD,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CA0BxB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC3B,KAAK,EAAE,MAAM,GACZ,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAgB3B"}
1
+ {"version":3,"file":"gather.d.ts","sourceRoot":"","sources":["../src/gather.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAC/B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GACpF,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAwBxB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClD,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAMxB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC3B,KAAK,EAAE,MAAM,GACZ,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAgB3B"}
package/dist/gather.js CHANGED
@@ -1,13 +1,11 @@
1
- export function gathered(send) {
1
+ export function gatheredEach(send) {
2
2
  let held = [];
3
3
  function flush() {
4
4
  const taken = held;
5
5
  held = [];
6
- send(taken.map((entry) => entry.ask)).then((answers) => {
7
- taken.forEach((entry, index) => {
8
- entry.resolve(answers[index]);
9
- });
10
- }, (reason) => {
6
+ send(taken.map((entry) => entry.ask), (ask, result) => {
7
+ taken[ask]?.resolve(result);
8
+ }).catch((reason) => {
11
9
  for (const entry of taken)
12
10
  entry.reject(reason);
13
11
  });
@@ -20,6 +18,13 @@ export function gathered(send) {
20
18
  held.push({ ask, resolve, reject });
21
19
  });
22
20
  }
21
+ export function gathered(send) {
22
+ return gatheredEach(async (asks, answer) => {
23
+ (await send(asks)).forEach((result, ask) => {
24
+ answer(ask, result);
25
+ });
26
+ });
27
+ }
23
28
  export function selections(items, weight, limit) {
24
29
  const parts = [];
25
30
  let part = [];
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
2
- export type { HouseByteAct, HouseByteAnswer, HouseByteTransfer, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
2
+ export { HOUSE_APP_ACTS } from './actions.js';
3
+ export type { HouseByteAct, HouseByteTransfer, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,YAAY,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export { createAgentsHouseAdapter } from './adapter.js';
2
+ export { HOUSE_APP_ACTS } from './actions.js';
package/dist/model.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { RoomModels } from '@agentshouse/mdruntime';
2
2
  import type { TrackedAuthority } from './discovery.js';
3
3
  import { type HouseScope, type HouseView } from './read.js';
4
4
  import type { HouseMode, HouseStreamEntry } from './transport.js';
5
+ export declare function partModels(scope: HouseScope, tracked: TrackedAuthority, seen: ReadonlySet<string>, final: boolean): Promise<RoomModels | undefined>;
5
6
  export declare function scopeModels(scope: HouseScope, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
6
7
  export declare function viewModels(view: HouseView, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
7
8
  export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode): Promise<RoomModels | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAA0C,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAoClE,wBAAgB,WAAW,CACzB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAEjC;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAcjC;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAWjC"}
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAA0C,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAoClE,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAKjC;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAEjC;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAcjC;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAWjC"}
package/dist/model.js CHANGED
@@ -26,8 +26,15 @@ async function modelsOf(tracked, read) {
26
26
  }
27
27
  return models.collection === undefined && models.selection === undefined ? undefined : models;
28
28
  }
29
+ export function partModels(scope, tracked, seen, final) {
30
+ return modelsOf(tracked, (schema) => {
31
+ if (scope.files.some((file) => file.path === schema))
32
+ return schemaOf(scope, schema);
33
+ return final && !seen.has(schema) ? ABSENT_SCHEMA : undefined;
34
+ });
35
+ }
29
36
  export function scopeModels(scope, tracked) {
30
- return modelsOf(tracked, (schema) => schemaOf(scope, schema));
37
+ return partModels(scope, tracked, new Set(), true);
31
38
  }
32
39
  export function viewModels(view, tracked) {
33
40
  return modelsOf(tracked, (schema) => {
package/dist/read.d.ts CHANGED
@@ -19,8 +19,13 @@ export type HouseScope = LogPosition & {
19
19
  contents: readonly HouseContent[];
20
20
  attachments?: readonly RoomAttachment[];
21
21
  };
22
+ export type HouseCursor = {
23
+ room: string;
24
+ path: string | null;
25
+ };
22
26
  export type HouseEnvelope = {
23
27
  scopes: readonly HouseScope[];
28
+ next?: HouseCursor;
24
29
  };
25
30
  export type HouseGrant = {
26
31
  method: 'GET';
@@ -61,7 +66,6 @@ export declare function headChange(held: {
61
66
  readonly author?: unknown;
62
67
  readonly created_at?: unknown;
63
68
  }): HeadChange | undefined | null;
64
- export declare function parseOriginals(value: unknown): readonly RoomAttachment[] | null;
65
69
  export declare function parseEnvelope(body: unknown): HouseEnvelope | null;
66
70
  export declare function parseSiteBootstrap(body: unknown): HouseScope | null;
67
71
  export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACb,cAAc,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA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/read.js CHANGED
@@ -51,30 +51,6 @@ export function headChange(held) {
51
51
  function headed(head) {
52
52
  return head === undefined ? {} : { head };
53
53
  }
54
- function parseOriginal(value) {
55
- if (typeof value !== 'object' || value === null)
56
- return null;
57
- const { attachment, name, bytes, media_type: mediaType } = value;
58
- if (typeof attachment !== 'string' || typeof name !== 'string')
59
- return null;
60
- if (typeof bytes !== 'number' || !Number.isSafeInteger(bytes) || bytes < 0)
61
- return null;
62
- if (mediaType !== null && typeof mediaType !== 'string')
63
- return null;
64
- return { reference: attachment, name, byteLength: bytes, mediaType, entry: value };
65
- }
66
- export function parseOriginals(value) {
67
- if (!Array.isArray(value))
68
- return null;
69
- const attachments = [];
70
- for (const entry of value) {
71
- const attachment = parseOriginal(entry);
72
- if (attachment === null)
73
- return null;
74
- attachments.push(attachment);
75
- }
76
- return attachments;
77
- }
78
54
  function declared(attachments) {
79
55
  return attachments === undefined ? {} : { attachments };
80
56
  }
@@ -132,10 +108,15 @@ function parseScope(value, mode) {
132
108
  }
133
109
  if (mode === 'site')
134
110
  return { anchor: manifest.anchor, ...at, files, contents };
135
- const attachments = parseOriginals(held.originals);
136
- if (attachments === null)
111
+ return { anchor: manifest.anchor, ...at, files, contents, attachments: [] };
112
+ }
113
+ function parseCursor(value) {
114
+ if (typeof value !== 'object' || value === null)
115
+ return null;
116
+ const { room, path } = value;
117
+ if (typeof room !== 'string' || (path !== null && typeof path !== 'string'))
137
118
  return null;
138
- return { anchor: manifest.anchor, ...at, files, contents, attachments };
119
+ return { room, path };
139
120
  }
140
121
  export function parseEnvelope(body) {
141
122
  if (typeof body !== 'object' || body === null)
@@ -149,7 +130,10 @@ export function parseEnvelope(body) {
149
130
  return null;
150
131
  scopes.push(scope);
151
132
  }
152
- return { scopes };
133
+ if (!('next' in body) || body.next === undefined)
134
+ return { scopes };
135
+ const next = parseCursor(body.next);
136
+ return next === null ? null : { scopes, next };
153
137
  }
154
138
  export function parseSiteBootstrap(body) {
155
139
  return parseScope(body, 'site');
@@ -219,10 +203,7 @@ export function parseEnumeration(body, mode) {
219
203
  authorities.push({ authority: held.authority, ...at, changes });
220
204
  continue;
221
205
  }
222
- const attachments = parseOriginals(held.originals);
223
- if (attachments === null)
224
- return null;
225
- authorities.push({ authority: held.authority, ...at, changes, attachments });
206
+ authorities.push({ authority: held.authority, ...at, changes, attachments: [] });
226
207
  }
227
208
  return { authorities };
228
209
  }
package/dist/refusal.d.ts CHANGED
@@ -1,9 +1,6 @@
1
1
  import type { AdapterFailure, DiscoverResult, ProviderRefusal, ScopedRefusal } from '@agentshouse/mdruntime';
2
- export type DoorRefusal = ProviderRefusal & {
3
- retryable: boolean;
4
- };
5
- export declare function doorRefusal(body: unknown): DoorRefusal | null;
6
- export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: DoorRefusal): ScopedRefusal;
2
+ export declare function doorRefusal(body: unknown): ProviderRefusal | null;
3
+ export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: ProviderRefusal): ScopedRefusal;
7
4
  export declare function classifyDoor(status: number, body: unknown, locator: string): AdapterFailure | null;
8
5
  export declare function classifyRead(status: number, body: unknown, locator: string): AdapterFailure | {
9
6
  kind: 'beyond-horizon';
@@ -1 +1 @@
1
- {"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAEnE,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAO7D;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,GACnB,aAAa,CAEf;AAmBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG,IAAI,CAMvB;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,CAGpD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAYrF"}
1
+ {"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAOjE;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAC7B,OAAO,EAAE,eAAe,GACvB,aAAa,CAEf;AAmBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG,IAAI,CAMvB;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,CAGpD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAQrF"}
package/dist/refusal.js CHANGED
@@ -6,11 +6,11 @@ export function doorRefusal(body) {
6
6
  const error = body.error;
7
7
  if (typeof error.code !== 'string')
8
8
  return null;
9
- const { code, ...fields } = error;
10
- return { code, fields, retryable: error.retryable === true };
9
+ const { code, retryable, ...fields } = error;
10
+ return { code, fields, retryable: retryable === true };
11
11
  }
12
12
  export function scopedRefusal(locator, scope, refusal) {
13
- return { kind: 'scoped-refusal', locator, scope, code: refusal.code, fields: refusal.fields };
13
+ return { kind: 'scoped-refusal', locator, scope, ...refusal };
14
14
  }
15
15
  function doorFailure(status, body) {
16
16
  if (status === 0)
@@ -50,11 +50,7 @@ export function discoveryFailure(status, body) {
50
50
  if (failure.kind === 'revoked-authorization')
51
51
  return failure;
52
52
  if (failure.kind === 'refused') {
53
- return {
54
- kind: 'contract-unavailable',
55
- code: failure.refusal.code,
56
- fields: failure.refusal.fields,
57
- };
53
+ return { kind: 'contract-unavailable', ...failure.refusal };
58
54
  }
59
55
  return { kind: 'transport-uncertainty' };
60
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,wBAAwB,CAAC;AAsBhC,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAgCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAkIxE"}
1
+ {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,wBAAwB,CAAC;AAsBhC,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAgCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAwIxE"}
package/dist/site.js CHANGED
@@ -74,6 +74,7 @@ export function createSiteAdapter(transport) {
74
74
  return models === undefined ? answer : { ...answer, models };
75
75
  }
76
76
  return {
77
+ localSaves: true,
77
78
  async authorize() {
78
79
  return {};
79
80
  },
@@ -114,7 +115,7 @@ export function createSiteAdapter(transport) {
114
115
  return refreshed(entry, request.fromRoomVersion);
115
116
  },
116
117
  async mutate() {
117
- return { kind: 'rejected', affected: {}, code: 'write-grant', fields: {} };
118
+ return { kind: 'rejected', affected: {}, code: 'write-grant', fields: {}, retryable: false };
118
119
  },
119
120
  async history() {
120
121
  return { kind: 'no-history' };
@@ -127,7 +128,12 @@ export function createSiteAdapter(transport) {
127
128
  },
128
129
  async action(_authorization, request) {
129
130
  if (request.name !== 'submit') {
130
- return { kind: 'rejected', code: 'action-unimplemented', fields: { name: request.name } };
131
+ return {
132
+ kind: 'rejected',
133
+ code: 'action-unimplemented',
134
+ fields: { name: request.name },
135
+ retryable: false,
136
+ };
131
137
  }
132
138
  if (!transport.online())
133
139
  return UNCERTAIN;
@@ -14,15 +14,12 @@ export type HouseDoorAnswer = {
14
14
  status: number;
15
15
  body: unknown;
16
16
  };
17
- export type HouseByteAct = 'local_copy_bundle' | 'authored_batch_upload' | 'conversation_original_upload' | 'original_upload' | 'original_download';
17
+ export type HouseByteAct = 'authored_batch_upload' | 'conversation_file_upload';
18
18
  export type HouseByteBody = string | ArrayBuffer | Uint8Array;
19
- export type HouseByteAnswer = 'json' | 'bytes';
20
19
  export type HouseByteTransfer = {
21
20
  act: HouseByteAct;
22
- method: 'GET' | 'POST';
23
21
  url: string;
24
- answer: HouseByteAnswer;
25
- body?: HouseByteBody;
22
+ body: HouseByteBody;
26
23
  operation?: string;
27
24
  };
28
25
  export type HouseStreamEntry = {
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE/E,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,UAAU,gBAAgB,CAAC;AAExC,eAA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,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7D,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAChE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5D,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7D,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IACvC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG;IAC3C,MAAM,IAAI,OAAO,CAAC;IAClB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC/C,CAAC"}
package/dist/write.d.ts CHANGED
@@ -38,6 +38,7 @@ export declare function rejectedMapping(mapping: Extract<ChangeMapping, {
38
38
  fields: {
39
39
  path: string;
40
40
  };
41
+ retryable: boolean;
41
42
  };
42
43
  export declare function revisionBody(input: {
43
44
  path: string;
@@ -1 +1 @@
1
- {"version":3,"file":"write.d.ts","source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C,MAAM,CAAC,CAE1D;AA6CD,MAAM,MAAM,gBAAgB,GACxB,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,GAC7C,CAAC,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,GAAG;IAAE,SAAS,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,CAAC,CAAC;AAE/F,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,gBAAgB,CA4ElB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;IAEjF,IAAI,EAAE,UAAU;IAChB,QAAQ;IACR,IAAI;IACJ,MAAM;QAAI,IAAI;;IACd,SAAS;EAEZ;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM1B;AAeD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,aAAa,CAiDf"}
package/dist/write.js CHANGED
@@ -1,4 +1,4 @@
1
- import { parseOriginals } from './read.js';
1
+ import { headChange } from './read.js';
2
2
  import { sha256Hex, textBytes } from './digest.js';
3
3
  import { nativePath, roomLocalPath } from './map.js';
4
4
  import { classifyDoor, doorRefusal, scopedRefusal } from './refusal.js';
@@ -138,6 +138,9 @@ function material(value, handle) {
138
138
  return null;
139
139
  if (file.revision !== null && file.revision !== undefined && typeof file.revision !== 'string')
140
140
  return null;
141
+ const head = headChange(file);
142
+ if (head === null)
143
+ return null;
141
144
  let path;
142
145
  try {
143
146
  path = roomLocalPath(file.path, handle);
@@ -149,6 +152,7 @@ function material(value, handle) {
149
152
  path,
150
153
  content: file.content,
151
154
  revision: typeof file.revision === 'string' ? file.revision : null,
155
+ ...(head === undefined ? {} : { head }),
152
156
  });
153
157
  }
154
158
  return held;
@@ -171,7 +175,13 @@ export function mutationOutcome(status, body, locator, handle) {
171
175
  if (refusal !== null && refusal.code === 'edit_conflict') {
172
176
  const { current, ...fields } = refusal.fields;
173
177
  const held = material(current, handle) ?? [];
174
- return { kind: 'conflicted', affected: affectedOf(held), code: refusal.code, fields };
178
+ return {
179
+ kind: 'conflicted',
180
+ affected: affectedOf(held),
181
+ code: refusal.code,
182
+ fields,
183
+ retryable: refusal.retryable,
184
+ };
175
185
  }
176
186
  if (refusal !== null && status === 404) {
177
187
  return scopedRefusal(locator, 'undisclosed', refusal);
@@ -181,14 +191,26 @@ export function mutationOutcome(status, body, locator, handle) {
181
191
  if (refusal?.retryable === true &&
182
192
  typeof reset === 'string' &&
183
193
  classified?.kind === 'transport-uncertainty') {
184
- return { kind: 'retryable-refusal', code: refusal.code, fields: refusal.fields, reset };
194
+ return {
195
+ kind: 'retryable-refusal',
196
+ code: refusal.code,
197
+ fields: refusal.fields,
198
+ retryable: true,
199
+ reset,
200
+ };
185
201
  }
186
202
  if (classified !== null && classified.kind !== 'scoped-refusal')
187
203
  return classified;
188
204
  if (classified !== null && status === 403)
189
205
  return classified;
190
206
  if (refusal !== null && status >= 400) {
191
- return { kind: 'rejected', affected: {}, code: refusal.code, fields: refusal.fields };
207
+ return {
208
+ kind: 'rejected',
209
+ affected: {},
210
+ code: refusal.code,
211
+ fields: refusal.fields,
212
+ retryable: refusal.retryable,
213
+ };
192
214
  }
193
215
  if (status !== 200 || typeof body !== 'object' || body === null) {
194
216
  return { kind: 'transport-uncertainty' };
@@ -200,11 +222,9 @@ export function mutationOutcome(status, body, locator, handle) {
200
222
  const contents = material(held.contents, handle);
201
223
  if (contents === null)
202
224
  return { kind: 'transport-uncertainty' };
203
- const originals = parseOriginals(held.originals);
204
- if (originals === null)
205
- return { kind: 'transport-uncertainty' };
206
225
  const documents = {};
207
226
  const revisions = {};
227
+ const changes = {};
208
228
  const removals = [];
209
229
  for (const entry of contents) {
210
230
  if (entry.content === null || entry.revision === null) {
@@ -213,14 +233,17 @@ export function mutationOutcome(status, body, locator, handle) {
213
233
  }
214
234
  documents[entry.path] = entry.content;
215
235
  revisions[entry.path] = entry.revision;
236
+ if (entry.head !== undefined)
237
+ changes[entry.path] = entry.head;
216
238
  }
217
239
  return {
218
240
  kind: 'accepted',
219
241
  roomVersion: roomVersion(at),
220
242
  documents,
221
243
  revisions,
244
+ changes,
222
245
  removals: removals.sort(),
223
- originals,
246
+ originals: [],
224
247
  };
225
248
  }
226
249
  export function rejectedMapping(mapping) {
@@ -229,6 +252,7 @@ export function rejectedMapping(mapping) {
229
252
  affected: {},
230
253
  code: mapping.rule,
231
254
  fields: { path: mapping.path },
255
+ retryable: false,
232
256
  };
233
257
  }
234
258
  export function revisionBody(input) {
@@ -277,6 +301,7 @@ export function historyOutcome(status, body, locator, request) {
277
301
  scope: 'content',
278
302
  code: 'retained_history_unavailable',
279
303
  fields: { path: request.path, revision: request.revision },
304
+ retryable: false,
280
305
  };
281
306
  }
282
307
  if (typeof named.content !== 'string')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime-adapter",
3
- "version": "0.1.0-cea44707d3919",
3
+ "version": "0.1.0-cf6a7cf003c4b",
4
4
  "description": "Agents House Adapter for the MD Runtime",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  "exports": {
15
15
  ".": {
16
16
  "types": "./dist/index.d.ts",
17
- "import": "./dist/index.js"
17
+ "default": "./dist/index.js"
18
18
  },
19
19
  "./package.json": "./package.json"
20
20
  },
@@ -25,7 +25,7 @@
25
25
  "LICENSE"
26
26
  ],
27
27
  "dependencies": {
28
- "@agentshouse/mdmodel": "0.1.0-c0d316445d94f",
29
- "@agentshouse/mdruntime": "0.1.0-c7f1d9323e816"
28
+ "@agentshouse/mdmodel": "0.1.0-c4d2418e88679",
29
+ "@agentshouse/mdruntime": "0.1.0-c967d1ca66fee"
30
30
  }
31
31
  }