@agentshouse/mdruntime-adapter 0.1.0-cc2458c857b25 → 0.1.0-cc3d05e27ae63

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
@@ -1,13 +1,13 @@
1
1
  # Instructions for the App Creator's agent
2
2
 
3
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.
4
+ App Repository, change it, build, and push. They are documentation, not enforcement.
6
5
 
7
6
  ## The MD Runtime API
8
7
 
9
8
  App code reaches the MD Runtime through the remote client. The surfaces are
10
- Rooms, Query, Search, Observe, Types, Room Draft, Save, History, Call, Reached, Log,
9
+ Rooms, Query, Search, Observe, Types, Room Draft, Save, History, the binary file
10
+ reads, Call, Reached, Log,
11
11
  the reported persistence answer, reauthorization, conversation, the chat draft,
12
12
  and Presentation State. Sync Status, the Service Mode, the storage-loss
13
13
  statement, the deployment facts and the signed-in member are observations only.
@@ -45,15 +45,32 @@ and none of them is stored or searchable.
45
45
  sending it is a Provider Action that needs the Provider reachable and is never
46
46
  queued.
47
47
 
48
- Each Room in Rooms lists its `attachments`, the files the Provider holds for it
49
- that its Documents link by the Provider's reference, ordered by `reference`,
50
- each with `name`, `byteLength`, `mediaType` and the Provider's own entry as
51
- `entry`. They are as the Provider last declared them and hold no bytes;
52
- open one through the Provider Action that serves it.
48
+ A binary file at a Path of a Room is a binary Path entry. Query lists it by
49
+ `path` with its `binaryFile` record and never its bytes: `{ state: 'accepted',
50
+ revision, path, fileRef, byteLength, mediaType, sha256 }`, or, from a Save until
51
+ the Provider accepts it, `{ state: 'pending', localId, path, byteLength,
52
+ mediaType, sha256 }` with no revision. Write one with a Room Draft whose only part
53
+ is `file: { blob }`, a `Blob` whose `type` is its media type; Save keeps the bytes
54
+ in its Pending Change, works offline, and the record turns accepted with the
55
+ Provider's revision once the Pending Change is accepted. Move or remove an
56
+ accepted one as a Document. Move or remove a pending one the same way, before or
57
+ after Save: the Room Draft or its queued Pending Change carries the bytes to the
58
+ new Path or drops them, and once that Pending Change has gone to the Provider
59
+ Save refuses it as `unknown-revision` until it is accepted. Read the bytes with
60
+ `binaryFile.read(room, path)`: a pending record answers its saved bytes, and
61
+ every read of an accepted one asks the Provider again and keeps nothing. Pass a
62
+ History revision as `binaryFile.read(room, path, revision)` to open that
63
+ revision, a removed file's last one included. Text, a Record attachment or a conversation
64
+ message may name a file directly by its `fileRef`; read that file with
65
+ `binaryFile.readReference({ fileRef, referrer })`, where the referrer is the
66
+ `referrer` the Provider gave beside the reference, or `{ room, path }` of the
67
+ document whose text names it. Both answer `{ kind: 'binary', blob }` or a
68
+ refusal or failure. History of a binary Path lists each revision's
69
+ `binaryFile` metadata without bytes.
53
70
 
54
71
  Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never
55
72
  touch the network.
56
- History and Call go to the Provider through the Adapter. Call takes the Action names
73
+ History, the binary file reads and Call go to the Provider through the Adapter. Call takes the Action names
57
74
  the Adapter declares; any other name answers `undeclared` without reaching the
58
75
  Provider. A Call result whose
59
76
  effect the Provider places in a Room carries `at`, that Room and Room Version;
@@ -124,8 +141,9 @@ data:
124
141
  list of pointers and `sections` `'all'` or a list of names. Selected pointers
125
142
  return the frontmatter holding only them, nested as written. A backlink names
126
143
  the referring Path, MD Type and the pointer it came from as `field`. Room and Path always return; a Markdown
127
- Document also returns its MD Type. A non-Markdown Document or binary link
128
- target returns only Room and Path. An unselected part is absent. Select only
144
+ Document also returns its MD Type. A non-Markdown Document returns only Room
145
+ and Path, and a binary Path entry Room, Path and its `binaryFile` record,
146
+ whatever is selected. An unselected part is absent. Select only
129
147
  what a screen shows: a list that selects the Markdown hears every edit of it.
130
148
  - **Change.** `change` is `{ author, time }` of the Document's head revision as
131
149
  the Provider last delivered it: `author` is `{ kind: 'user' | 'site', id, name }`
@@ -244,45 +262,55 @@ the network. Data lives only in the App Creator's browser and with the Provider.
244
262
 
245
263
  ## App code takes the client its host hands it and never constructs a Runtime
246
264
 
247
- App code takes the client its host hands it: in House,
248
- `houseBridge().runtime` from `@agentshouse/app-bridge` resolves to the
249
- client House built into the page. It never constructs a Runtime or a client.
250
- It imports only types from `@agentshouse/mdruntime/client`, does not call
251
- `connectMdRuntime` or `serveMdRuntime`, and does not import the package main,
252
- the host entry, or the Adapter package. Hosts and tests use those entries; the
253
- served App does not.
265
+ App code takes the client its host hands it: in House, `houseBridge().runtime`
266
+ from `@agentshouse/app-bridge` resolves to the client House built into the page.
267
+ It never constructs a Runtime or a client. It imports only types from
268
+ `@agentshouse/mdruntime/client`, does not call `connectMdRuntime` or
269
+ `serveMdRuntime`, and does not import the package main, the host entry, or the
270
+ Adapter package. Hosts and tests use those entries; the served App does not.
254
271
 
255
272
  A React App may observe and save through `@agentshouse/mdruntime/react`, which
256
273
  names React as a peer dependency. `useObserve(client, topic, ...input)` takes
257
274
  the arguments of `observe` and returns `{ state: 'loading' }` until the topic's
258
275
  first value arrives, then `{ state: 'ready', value }`, re-rendering on each
259
- change; a `null` client observes nothing and stays loading. `useSave(client)` returns `busy`, the last `outcome` or `failure`, and
260
- `save(room, roomDrafts)`, which writes each Path's parts onto the Room Draft
261
- already there, keeping the bases its parts have, or onto a new one, and saves
262
- them together. A refused Save leaves the Room Drafts for the App to save again
263
- or discard; a failure is recorded and rejects. `saveRoomDrafts(client, room,
264
- roomDrafts)` is that save outside a component. A react-admin or Refine App
265
- reads and writes its Rooms through the data providers of
266
- `@agentshouse/mdruntime-families`.
276
+ change; a `null` client observes nothing and stays loading. `useSave(client)`
277
+ returns `busy`, the last `outcome` or `failure`, and `save(room, roomDrafts)`,
278
+ which writes each Path's parts onto the Room Draft already there, keeping the
279
+ bases its parts have, or onto a new one, and saves them together. A refused
280
+ Save leaves the Room Drafts for the App to save again or discard; a failure is
281
+ recorded and rejects. `saveRoomDrafts(client, room, roomDrafts)` is that save
282
+ outside a component. A react-admin or Refine App reads and writes its Rooms
283
+ through the data providers of `@agentshouse/mdruntime-families`.
267
284
 
268
285
  ## The Chat
269
286
 
270
- `@agentshouse/mdruntime/chat` holds the Chat: one data layer over the
271
- conversations, the same for every App. React and `@assistant-ui/react` are
272
- required peers of this entry, so every App that uses it adds React as a
273
- dependency, also an App not written in React. Wrap your own assistant-ui
274
- primitives in `<ChatProvider client={runtime} conversation={id} agent={agent}>`:
275
- `conversation` is the one it opens, `null` for a new chat, `agent` the Agent a
276
- new chat goes to, and `onOpen` hears each conversation it opens. Thread, Messages,
277
- Composer, its attachments and the thread list run on it: sending with files, a
278
- message sent mid-turn waiting in the queue, Stop, rename, Done as archive and
279
- delete. `useChat()` gives the rest: `send`, through the same queue, the
280
- conversations, the Agents, the open
281
- questions to `answer`, the CLI's `options` to `choose` and `commands`, the queue
282
- to `edit` or `unqueue`, `kill`, and each act's outcome. A sent message shows at
283
- once until House keeps it, and the unsent text stays in the chat draft, the same
284
- in every composer over that conversation. A secret
285
- question is never answered here. Never replace its messages, sending or store.
287
+ `@agentshouse/mdruntime/chat` holds the Chat, one data layer for every App.
288
+ Its required peers are React, React DOM and `@assistant-ui/react`: add React as
289
+ a dependency, also in an App not written in React.
290
+
291
+ Place the ready chat with `<Chat client={runtime} conversation={id}
292
+ agent={agent} width="1/3" showChats />`: `conversation` opens one, `null` for a
293
+ new chat, `agent` is the Agent a new chat goes to, `onOpen` hears each one it
294
+ opens, and `width` is `full` (the place you give it), or `3/4`, `1/2` or `1/3`
295
+ of the window docked at its right edge, whole on a narrow window. `showChats`
296
+ adds its conversation list; or draw your own inside a `ChatProvider` around a
297
+ `<Chat />` with no `client`. It carries its own styles; theme it with CSS custom
298
+ properties on it or an ancestor: `--chat-background`, `--chat-surface`,
299
+ `--chat-text`, `--chat-text-muted`, `--chat-accent`, `--chat-line`,
300
+ `--chat-attention`, `--chat-danger`, `--chat-font`, `--chat-font-mono`,
301
+ `--chat-font-size`, `--chat-radius` and `--chat-density` (a factor for spacing);
302
+ an unset one keeps House's light or dark look. `mountChat(element, { client })`
303
+ places it outside React and returns `update(props)` and `unmount()`.
304
+
305
+ Mix `ChatMessageList` (`components` takes your `UserMessage` and
306
+ `AssistantMessage`), `ChatInput` and `ChatQuestionCard` with your own design
307
+ inside a `ChatProvider`, or compose assistant-ui's primitives there; `useChat()`
308
+ gives `send`, the conversations, the Agents, questions to `answer`, `options`
309
+ to `choose`, `commands`, the queue to `edit` or `unqueue`, `stop`, `kill` and
310
+ outcomes; never replace its messages, sending or store. A secret question is
311
+ never answered here; typed answers live in Presentation State's `typed` key:
312
+ keep it, and change Presentation State only inside `inTurn(client, work)` from
313
+ `@agentshouse/mdruntime/client`. `Markdown` draws Markdown safely.
286
314
 
287
315
  ## What an agent must never do
288
316
 
@@ -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,EACvB,KAAK,qBAAqB,EAE1B,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQtE,KAAK,QAAQ,GAAG;IAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,KAAK,mBAAmB,GAAG,QAAQ,GAAG;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,KAAK,QAAQ,GAAG,eAAe,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,qBAAqB,EAAE,mBAAmB,GAAG;QACpD,QAAQ,CAAC,MAAM,EAAE;YAAE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,QAAQ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C,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;AAwED,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAOjF;AAkLD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAiBtE"}
package/dist/actions.js CHANGED
@@ -35,7 +35,7 @@ const APP_ACTS = {
35
35
  'member.list': mapped('rooms/members'),
36
36
  'message.send': mapped('apps/messages/send'),
37
37
  'processing.read': mapped('rooms/settings/processing/read'),
38
- 'record.list': mapped('records/read'),
38
+ 'record.list': carried('records/read', recordsAction),
39
39
  'relay.read': mapped('apps/relay'),
40
40
  'routine.list': mapped('routines/access'),
41
41
  'routineAccess.list': mapped('routines/granted'),
@@ -137,6 +137,29 @@ export function actionOutcome(answer, name) {
137
137
  return { kind: 'transport-uncertainty' };
138
138
  return { kind: 'action', result: answer.body };
139
139
  }
140
+ function referredRecord(view, roomRef) {
141
+ const held = record(view);
142
+ if (roomRef === undefined || typeof held.record !== 'string' || !Array.isArray(held.attachments))
143
+ return view;
144
+ const referrer = { room_ref: roomRef, record: held.record };
145
+ return {
146
+ ...held,
147
+ attachments: held.attachments.map((attachment) => ({ ...record(attachment), referrer })),
148
+ };
149
+ }
150
+ async function recordsAction(transport, route, input, name) {
151
+ const outcome = actionOutcome(await transport.door(route, input), name);
152
+ if (outcome.kind !== 'action')
153
+ return outcome;
154
+ const roomRef = text(input, 'room_ref');
155
+ const read = record(outcome.result);
156
+ return {
157
+ ...outcome,
158
+ result: Array.isArray(read.records)
159
+ ? { ...read, records: read.records.map((view) => referredRecord(view, roomRef)) }
160
+ : referredRecord(outcome.result, roomRef),
161
+ };
162
+ }
140
163
  async function carry(transport, route, name, input) {
141
164
  return actionOutcome(await transport.door(route, input), name);
142
165
  }
@@ -273,12 +296,19 @@ export function acceptedMessage(entry) {
273
296
  const cursor = historyCursor(entry);
274
297
  if (cursor === null)
275
298
  return null;
299
+ const message = structuredClone(record(entry));
300
+ const referrer = { message: cursor.message_id };
276
301
  return {
277
302
  identity: cursor.message_id,
278
303
  turn: text(entry, 'turn_id') ?? cursor.message_id,
279
304
  position: position(cursor),
280
305
  text: text(entry, 'text') ?? '',
281
- message: structuredClone(entry),
306
+ message: Array.isArray(message.files)
307
+ ? {
308
+ ...message,
309
+ files: message.files.map((file) => ({ ...record(file), referrer })),
310
+ }
311
+ : message,
282
312
  };
283
313
  }
284
314
  function historyPage(entry) {
@@ -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;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"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,OAAO,EACP,aAAa,EAgBd,MAAM,wBAAwB,CAAC;AAuChC,OAAO,EASL,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,CA8cpF"}
package/dist/adapter.js CHANGED
@@ -3,12 +3,13 @@ import { partModels, streamedModels, viewModels } from './model.js';
3
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
- import { acceptedLinks, enumeratedLinks, heldLinks, scopeLinks, streamedLinks, } from './links.js';
6
+ import { acceptedHanded, enumeratedHanded, heldHanded, scopeHanded, streamedHanded, } from './handed.js';
7
7
  import { houseAction } from './actions.js';
8
8
  import { classifyDoor, classifyRead, discoveryFailure, doorRefusal } from './refusal.js';
9
9
  import { houseNotifications } from './stream.js';
10
- import { DOOR_BATCH, DOOR_BATCH_UPLOAD, DOOR_BOOTSTRAP, DOOR_DISCOVER, DOOR_ENUMERATE, DOOR_REVISIONS, } from './transport.js';
10
+ import { DOOR_BATCH, DOOR_BATCH_UPLOAD, DOOR_BOOTSTRAP, DOOR_DISCOVER, DOOR_ENUMERATE, DOOR_FILES_GET, DOOR_REVISIONS, } from './transport.js';
11
11
  import { batchPaths, deltaBody, deltaBytes, deltaDigest, historyOutcome, houseChanges, mutationOutcome, operationHead, rejectedMapping, revisionBody, uploadable, } from './write.js';
12
+ import { houseReferrer } from './referrer.js';
12
13
  import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
13
14
  const UNCERTAIN = { kind: 'transport-uncertainty' };
14
15
  const UNCERTAIN_READ = { kind: 'transport-uncertainty' };
@@ -33,7 +34,7 @@ export function createAgentsHouseAdapter(options) {
33
34
  return { kind: 'room-not-readable', locator: entry.locator };
34
35
  const next = envelope.next?.room === entry.authority ? envelope.next.path : null;
35
36
  if (continued === null && next === null)
36
- handed.set(entry.locator, scopeLinks(scope));
37
+ handed.set(entry.locator, scopeHanded(scope));
37
38
  else
38
39
  handed.delete(entry.locator);
39
40
  notifications.reach(entry.authority, scope);
@@ -57,21 +58,18 @@ export function createAgentsHouseAdapter(options) {
57
58
  const answer = refreshFrom(view, ask.fromRoomVersion);
58
59
  if (answer.kind !== 'net-advancement')
59
60
  return answer;
60
- handed.set(ask.entry.locator, enumeratedLinks(view, handed.get(ask.entry.locator)));
61
+ handed.set(ask.entry.locator, enumeratedHanded(view, handed.get(ask.entry.locator)));
61
62
  const models = await viewModels(view, ask.entry);
62
63
  return models === undefined ? answer : { ...answer, models };
63
64
  }
64
65
  async function streamed(entry, request, from) {
65
- const links = handed.get(entry.locator);
66
- if (links?.roomVersion !== request.fromRoomVersion)
66
+ const held = handed.get(entry.locator);
67
+ if (held?.roomVersion !== request.fromRoomVersion)
67
68
  return null;
68
- const advanced = notifications.advance(entry, from, (path, revision) => links.revisions.get(path) === revision);
69
+ const advanced = notifications.advance(entry, from, (path, revision) => held.revisions.get(path) === revision);
69
70
  if (advanced === null)
70
71
  return null;
71
- const relinked = streamedLinks(links, advanced);
72
- if (relinked === null)
73
- return null;
74
- handed.set(entry.locator, relinked);
72
+ handed.set(entry.locator, streamedHanded(held, advanced));
75
73
  const models = await streamedModels(advanced.schemas, entry, 'credential');
76
74
  return models === undefined ? advanced.page : { ...advanced.page, models };
77
75
  }
@@ -81,7 +79,7 @@ export function createAgentsHouseAdapter(options) {
81
79
  const at = logPosition(room.roomVersion);
82
80
  if (entry === undefined || at === null)
83
81
  return [];
84
- handed.set(room.locator, heldLinks(room));
82
+ handed.set(room.locator, heldHanded(room));
85
83
  notifications.reach(entry.authority, at);
86
84
  return [presented(entry.authority, at)];
87
85
  });
@@ -90,19 +88,15 @@ export function createAgentsHouseAdapter(options) {
90
88
  function adopted(entry, outcome) {
91
89
  if (outcome.kind !== 'accepted')
92
90
  return outcome;
93
- const { originals, ...accepted } = outcome;
94
- const links = handed.get(entry.locator);
95
- if (links === undefined)
96
- return accepted;
97
- const follows = followsVersion(links.roomVersion, accepted.roomVersion);
98
- const relinked = acceptedLinks(links, accepted, follows ? accepted.roomVersion : links.roomVersion, originals);
99
- handed.set(entry.locator, relinked.links);
100
- const at = logPosition(accepted.roomVersion);
91
+ const held = handed.get(entry.locator);
92
+ if (held === undefined)
93
+ return outcome;
94
+ const follows = followsVersion(held.roomVersion, outcome.roomVersion);
95
+ handed.set(entry.locator, acceptedHanded(held, outcome, follows ? outcome.roomVersion : held.roomVersion));
96
+ const at = logPosition(outcome.roomVersion);
101
97
  if (follows && at !== null)
102
98
  notifications.reach(entry.authority, at);
103
- return relinked.attachments === undefined
104
- ? accepted
105
- : { ...accepted, attachments: relinked.attachments };
99
+ return outcome;
106
100
  }
107
101
  function authorityFor(locator) {
108
102
  return tracked.get(locator);
@@ -244,7 +238,30 @@ export function createAgentsHouseAdapter(options) {
244
238
  await keep(upload);
245
239
  return { body: { ...head, paths, upload, runtime: notifications.runtime } };
246
240
  }
247
- async function submit(head, changes, delta, bytes, entry, handed, keep) {
241
+ async function staged(answer, batch) {
242
+ const refusal = doorRefusal(answer.body);
243
+ if (refusal?.code !== 'files_unstaged')
244
+ return null;
245
+ const grants = refusal.fields.upload;
246
+ if (!Array.isArray(grants))
247
+ return false;
248
+ for (const grant of grants) {
249
+ const { url, operation, sha256 } = grant;
250
+ const change = batch.changes.find((held) => held.kind === 'binary' && held.sha256 === sha256);
251
+ if (typeof url !== 'string' || typeof operation !== 'string' || change === undefined)
252
+ return false;
253
+ const delivered = await transport.transfer({
254
+ act: 'binary_stage',
255
+ url,
256
+ body: change.blob,
257
+ operation,
258
+ });
259
+ if (delivered.status !== 200)
260
+ return false;
261
+ }
262
+ return true;
263
+ }
264
+ async function submit(batch, head, changes, delta, bytes, entry, handed, keep) {
248
265
  const inline = { ...head, changes, runtime: notifications.runtime };
249
266
  const prepared = uploadable(inline, bytes, declared())
250
267
  ? await uploaded(head, changes, delta, bytes, entry, handed, keep)
@@ -252,7 +269,33 @@ export function createAgentsHouseAdapter(options) {
252
269
  if ('outcome' in prepared)
253
270
  return prepared.outcome;
254
271
  const answer = await transport.door(DOOR_BATCH, prepared.body);
255
- return mutationOutcome(answer.status, answer.body, entry.locator, entry.handle);
272
+ const stagedFiles = await staged(answer, batch);
273
+ if (stagedFiles === false)
274
+ return UNCERTAIN;
275
+ const settled = stagedFiles === null ? answer : await transport.door(DOOR_BATCH, prepared.body);
276
+ if (stagedFiles === true && (await staged(settled, batch)) !== null)
277
+ return UNCERTAIN;
278
+ return mutationOutcome(settled.status, settled.body, entry.locator, entry.handle);
279
+ }
280
+ async function downloaded(answer, locator) {
281
+ const failure = classifyDoor(answer.status, answer.body, locator);
282
+ if (failure !== null) {
283
+ return failure.kind === 'scoped-refusal'
284
+ ? {
285
+ kind: 'rejected',
286
+ code: failure.code,
287
+ fields: failure.fields,
288
+ retryable: failure.retryable,
289
+ }
290
+ : failure;
291
+ }
292
+ const grant = parseGrant(answer.body);
293
+ if (grant === null || grant.method !== 'GET')
294
+ return UNCERTAIN_READ;
295
+ const read = await transport.download(grant.url);
296
+ if (read.status !== 200 || read.blob === null)
297
+ return UNCERTAIN_READ;
298
+ return { kind: 'binary', blob: read.blob };
256
299
  }
257
300
  return {
258
301
  async authorize() {
@@ -314,10 +357,11 @@ export function createAgentsHouseAdapter(options) {
314
357
  const delta = deltaBody(mapped.changes);
315
358
  const bytes = deltaBytes(delta);
316
359
  const handed = request.upload;
317
- const outcome = await submit(head, mapped.changes, delta, bytes, entry, handed, keep);
360
+ const batch = request.changeBatch;
361
+ const outcome = await submit(batch, head, mapped.changes, delta, bytes, entry, handed, keep);
318
362
  if (handed === undefined || !lapsedGrant(outcome))
319
363
  return adopted(entry, outcome);
320
- return adopted(entry, await submit(head, mapped.changes, delta, bytes, entry, undefined, keep));
364
+ return adopted(entry, await submit(batch, head, mapped.changes, delta, bytes, entry, undefined, keep));
321
365
  },
322
366
  async history(_authorization, request) {
323
367
  const entry = authorityFor(request.locator);
@@ -334,6 +378,37 @@ export function createAgentsHouseAdapter(options) {
334
378
  ...(request.revision === undefined ? {} : { revision: request.revision }),
335
379
  });
336
380
  },
381
+ async binary(_authorization, request) {
382
+ if (request.kind === 'path') {
383
+ const entry = authorityFor(request.locator);
384
+ if (entry === undefined)
385
+ return { kind: 'room-not-readable', locator: request.locator };
386
+ const answer = await transport.door(DOOR_FILES_GET, {
387
+ room_ref: entry.authority,
388
+ path: request.path,
389
+ revision: request.revision,
390
+ });
391
+ return downloaded(answer, request.locator);
392
+ }
393
+ const referrer = houseReferrer(request.referrer, tracked);
394
+ if (referrer === null) {
395
+ return { kind: 'rejected', code: 'referrer_unknown', fields: {}, retryable: false };
396
+ }
397
+ const answer = await transport.door(DOOR_FILES_GET, {
398
+ file: request.fileRef,
399
+ referrer: referrer.referrer,
400
+ });
401
+ return downloaded(answer, referrer.locator);
402
+ },
403
+ referrerScope(referrer) {
404
+ const held = houseReferrer(referrer, tracked);
405
+ if (held === null)
406
+ return null;
407
+ if (held.locator === '')
408
+ return { kind: 'conversations' };
409
+ const { path } = held.referrer;
410
+ return { kind: 'room', locator: held.locator, ...(path === undefined ? {} : { path }) };
411
+ },
337
412
  reached(locator, version, target) {
338
413
  return reachedVersion(version, target, authorityFor(locator)?.logEpoch);
339
414
  },
@@ -0,0 +1,15 @@
1
+ import type { HeldRoom, MutationResult } from '@agentshouse/mdruntime';
2
+ import type { HouseScope, HouseView } from './read.js';
3
+ import type { StreamedAdvancement } from './stream.js';
4
+ export type HandedRoom = {
5
+ roomVersion: string;
6
+ revisions: ReadonlyMap<string, string>;
7
+ };
8
+ export declare function scopeHanded(scope: HouseScope): HandedRoom;
9
+ export declare function heldHanded(held: HeldRoom): HandedRoom;
10
+ export declare function acceptedHanded(held: HandedRoom, accepted: Extract<MutationResult, {
11
+ kind: 'accepted';
12
+ }>, roomVersion: string): HandedRoom;
13
+ export declare function enumeratedHanded(view: HouseView, earlier: HandedRoom | undefined): HandedRoom;
14
+ export declare function streamedHanded(held: HandedRoom, advanced: StreamedAdvancement): HandedRoom;
15
+ //# sourceMappingURL=handed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handed.d.ts","sourceRoot":"","sources":["../src/handed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CASzD;AAOD,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAErD;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EACvD,WAAW,EAAE,MAAM,GAClB,UAAU,CAKZ;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAM7F;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,GAAG,UAAU,CAM1F"}
package/dist/handed.js ADDED
@@ -0,0 +1,38 @@
1
+ import { roomVersion } from './version.js';
2
+ export function scopeHanded(scope) {
3
+ return {
4
+ roomVersion: roomVersion(scope),
5
+ revisions: new Map(scope.files.flatMap(({ path, revision }) => revision === undefined ? [] : [[path, revision]])),
6
+ };
7
+ }
8
+ function revised(revisions, path, revision) {
9
+ if (revision === undefined)
10
+ revisions.delete(path);
11
+ else
12
+ revisions.set(path, revision);
13
+ }
14
+ export function heldHanded(held) {
15
+ return { roomVersion: held.roomVersion, revisions: new Map(Object.entries(held.revisions)) };
16
+ }
17
+ export function acceptedHanded(held, accepted, roomVersion) {
18
+ const revisions = new Map(held.revisions);
19
+ for (const [path, revision] of Object.entries(accepted.revisions))
20
+ revisions.set(path, revision);
21
+ for (const path of accepted.removals)
22
+ revisions.delete(path);
23
+ return { roomVersion, revisions };
24
+ }
25
+ export function enumeratedHanded(view, earlier) {
26
+ const revisions = new Map(earlier?.revisions);
27
+ for (const change of view.changes) {
28
+ revised(revisions, change.path, 'removed' in change ? undefined : change.revision);
29
+ }
30
+ return { roomVersion: roomVersion(view), revisions };
31
+ }
32
+ export function streamedHanded(held, advanced) {
33
+ const revisions = new Map(held.revisions);
34
+ for (const entry of advanced.entries) {
35
+ revised(revisions, entry.path, entry.kind === 'removed' ? undefined : entry.revision);
36
+ }
37
+ return { roomVersion: advanced.page.roomVersion, revisions };
38
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
2
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
+ export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
4
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,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"}
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,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
package/dist/read.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { BootstrapPage, RefreshResult, RoomAttachment } from '@agentshouse/mdruntime';
1
+ import type { BinaryFile, BootstrapPage, RefreshResult } from '@agentshouse/mdruntime';
2
2
  import type { TrackedAuthority } from './discovery.js';
3
3
  import type { HouseMode } from './transport.js';
4
4
  import { type LogPosition } from './version.js';
@@ -8,6 +8,7 @@ export type HouseManifestFile = {
8
8
  revision: string | undefined;
9
9
  version: string;
10
10
  head?: HeadChange;
11
+ binary?: BinaryFile;
11
12
  };
12
13
  export type HouseContent = {
13
14
  path: string;
@@ -17,7 +18,6 @@ export type HouseScope = LogPosition & {
17
18
  anchor: string;
18
19
  files: readonly HouseManifestFile[];
19
20
  contents: readonly HouseContent[];
20
- attachments?: readonly RoomAttachment[];
21
21
  };
22
22
  export type HouseCursor = {
23
23
  room: string;
@@ -46,14 +46,14 @@ export type HouseChange = {
46
46
  head?: HeadChange;
47
47
  } | {
48
48
  path: string;
49
- reference: {
50
- revision: string;
51
- };
49
+ binary: BinaryFile;
50
+ revision: string | undefined;
51
+ version: string;
52
+ head?: HeadChange;
52
53
  };
53
54
  export type HouseView = LogPosition & {
54
55
  authority: string;
55
56
  changes: readonly HouseChange[];
56
- attachments?: readonly RoomAttachment[];
57
57
  };
58
58
  export type HouseEnumeration = {
59
59
  authorities: readonly HouseView[];
@@ -66,6 +66,7 @@ export declare function headChange(held: {
66
66
  readonly author?: unknown;
67
67
  readonly created_at?: unknown;
68
68
  }): HeadChange | undefined | null;
69
+ export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
69
70
  export declare function parseEnvelope(body: unknown): HouseEnvelope | null;
70
71
  export declare function parseSiteBootstrap(body: unknown): HouseScope | null;
71
72
  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,CAA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