@agentshouse/mdruntime-adapter 0.1.0-cf6a7cf003c4b → 0.1.0-cfdb3a66f1a92
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 +75 -26
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +42 -4
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +102 -27
- package/dist/handed.d.ts +15 -0
- package/dist/handed.d.ts.map +1 -0
- package/dist/handed.js +38 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/read.d.ts +7 -6
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +61 -49
- package/dist/referrer.d.ts +7 -0
- package/dist/referrer.d.ts.map +1 -0
- package/dist/referrer.js +35 -0
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +32 -1
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +13 -6
- package/dist/transport.d.ts +14 -2
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +3 -0
- package/dist/write.d.ts +2 -9
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +54 -5
- package/package.json +3 -3
- package/dist/links.d.ts +0 -20
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js +0 -104
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,
|
|
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.
|
|
@@ -27,6 +27,8 @@ value whole and returns its unsubscribe, and `close()` ends the observation.
|
|
|
27
27
|
Closing the port ends every handle and rejects every pending call and
|
|
28
28
|
observation; a client that reconnects observes again.
|
|
29
29
|
|
|
30
|
+
`observe('agents')` answers every Agent a new conversation can go to, each
|
|
31
|
+
`{ identity, name }`, whether or not it has a conversation yet.
|
|
30
32
|
Each conversation the Provider's conversation list names is held complete in the
|
|
31
33
|
browser. `conversation.list()` and `observe('conversations')` answer each with its
|
|
32
34
|
Agent's identity and name, its name, created and finished times, last outcome and live
|
|
@@ -43,15 +45,32 @@ and none of them is stored or searchable.
|
|
|
43
45
|
sending it is a Provider Action that needs the Provider reachable and is never
|
|
44
46
|
queued.
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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.
|
|
51
70
|
|
|
52
71
|
Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never
|
|
53
72
|
touch the network.
|
|
54
|
-
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
|
|
55
74
|
the Adapter declares; any other name answers `undeclared` without reaching the
|
|
56
75
|
Provider. A Call result whose
|
|
57
76
|
effect the Provider places in a Room carries `at`, that Room and Room Version;
|
|
@@ -122,8 +141,9 @@ data:
|
|
|
122
141
|
list of pointers and `sections` `'all'` or a list of names. Selected pointers
|
|
123
142
|
return the frontmatter holding only them, nested as written. A backlink names
|
|
124
143
|
the referring Path, MD Type and the pointer it came from as `field`. Room and Path always return; a Markdown
|
|
125
|
-
Document also returns its MD Type. A non-Markdown Document
|
|
126
|
-
|
|
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
|
|
127
147
|
what a screen shows: a list that selects the Markdown hears every edit of it.
|
|
128
148
|
- **Change.** `change` is `{ author, time }` of the Document's head revision as
|
|
129
149
|
the Provider last delivered it: `author` is `{ kind: 'user' | 'site', id, name }`
|
|
@@ -242,26 +262,55 @@ the network. Data lives only in the App Creator's browser and with the Provider.
|
|
|
242
262
|
|
|
243
263
|
## App code takes the client its host hands it and never constructs a Runtime
|
|
244
264
|
|
|
245
|
-
App code takes the client its host hands it: in House,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
`
|
|
250
|
-
|
|
251
|
-
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.
|
|
252
271
|
|
|
253
272
|
A React App may observe and save through `@agentshouse/mdruntime/react`, which
|
|
254
273
|
names React as a peer dependency. `useObserve(client, topic, ...input)` takes
|
|
255
274
|
the arguments of `observe` and returns `{ state: 'loading' }` until the topic's
|
|
256
275
|
first value arrives, then `{ state: 'ready', value }`, re-rendering on each
|
|
257
|
-
change; a `null` client observes nothing and stays loading. `useSave(client)`
|
|
258
|
-
`
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
or discard; a failure is
|
|
262
|
-
roomDrafts)` is that save
|
|
263
|
-
reads and writes its Rooms
|
|
264
|
-
`@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`.
|
|
284
|
+
|
|
285
|
+
## The Chat
|
|
286
|
+
|
|
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.
|
|
265
314
|
|
|
266
315
|
## What an agent must never do
|
|
267
316
|
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -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,EAAE,OAAO,CAAA;SAAE,CAAC;KAClF,CAAC;IACF,QAAQ,CAAC,qBAAqB,EAAE,QAAQ,GAAG;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACzE,QAAQ,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;IACpD,QAAQ,CAAC,sBAAsB,EAAE,0BAA0B,CAAC;IAC5D,QAAQ,CAAC,wBAAwB,EAAE,mBAAmB,CAAC;IACvD,QAAQ,CAAC,mBAA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E,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
|
@@ -20,7 +20,7 @@ function carried(door, carry) {
|
|
|
20
20
|
const APP_ACTS = {
|
|
21
21
|
'access.read': mapped('rooms/access/read'),
|
|
22
22
|
'conversation.answer': mapped('conversations/interaction/answer', answerBody),
|
|
23
|
-
'conversation.create':
|
|
23
|
+
'conversation.create': carried('conversations/create', createAction),
|
|
24
24
|
'conversation.delete': mapped('conversations/delete', controlBody),
|
|
25
25
|
'conversation.history': carried('conversations/history', historyAction),
|
|
26
26
|
'conversation.interrupt': mapped('conversations/interrupt', controlBody),
|
|
@@ -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':
|
|
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'),
|
|
@@ -48,7 +48,7 @@ const APP_ACTS = {
|
|
|
48
48
|
export const HOUSE_APP_ACTS = Object.fromEntries(Object.entries(APP_ACTS).map(([name, act]) => [name, act.door]));
|
|
49
49
|
const APP_NAMES = new Map(Object.entries(APP_ACTS).map(([name, act]) => [act.door, name]));
|
|
50
50
|
export function houseConversationAgents(locator) {
|
|
51
|
-
return { locator, type: 'house-agent', identity: 'agent', name: 'name' };
|
|
51
|
+
return { locator, type: 'house-agent', identity: 'agent', name: 'name', retired: 'retired' };
|
|
52
52
|
}
|
|
53
53
|
export function declaredActions(routes) {
|
|
54
54
|
return routes.map((route) => ({
|
|
@@ -110,6 +110,14 @@ function answerBody(input) {
|
|
|
110
110
|
response: nested.response,
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
+
async function createAction(transport, route, input, name) {
|
|
114
|
+
const outcome = actionOutcome(await transport.door(route, createBody(input)), name);
|
|
115
|
+
if (outcome.kind !== 'action')
|
|
116
|
+
return outcome;
|
|
117
|
+
const held = record(outcome.result);
|
|
118
|
+
const conversation = text(held, 'conversation_id');
|
|
119
|
+
return conversation === undefined ? outcome : { ...outcome, result: { ...held, conversation } };
|
|
120
|
+
}
|
|
113
121
|
function withTurn(body) {
|
|
114
122
|
const held = record(body);
|
|
115
123
|
const turn = text(held, 'message_id');
|
|
@@ -129,6 +137,29 @@ export function actionOutcome(answer, name) {
|
|
|
129
137
|
return { kind: 'transport-uncertainty' };
|
|
130
138
|
return { kind: 'action', result: answer.body };
|
|
131
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
|
+
}
|
|
132
163
|
async function carry(transport, route, name, input) {
|
|
133
164
|
return actionOutcome(await transport.door(route, input), name);
|
|
134
165
|
}
|
|
@@ -265,12 +296,19 @@ export function acceptedMessage(entry) {
|
|
|
265
296
|
const cursor = historyCursor(entry);
|
|
266
297
|
if (cursor === null)
|
|
267
298
|
return null;
|
|
299
|
+
const message = structuredClone(record(entry));
|
|
300
|
+
const referrer = { message: cursor.message_id };
|
|
268
301
|
return {
|
|
269
302
|
identity: cursor.message_id,
|
|
270
303
|
turn: text(entry, 'turn_id') ?? cursor.message_id,
|
|
271
304
|
position: position(cursor),
|
|
272
305
|
text: text(entry, 'text') ?? '',
|
|
273
|
-
message:
|
|
306
|
+
message: Array.isArray(message.files)
|
|
307
|
+
? {
|
|
308
|
+
...message,
|
|
309
|
+
files: message.files.map((file) => ({ ...record(file), referrer })),
|
|
310
|
+
}
|
|
311
|
+
: message,
|
|
274
312
|
};
|
|
275
313
|
}
|
|
276
314
|
function historyPage(entry) {
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,OAAO,EACP,aAAa,
|
|
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 {
|
|
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,
|
|
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,
|
|
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
|
|
66
|
-
if (
|
|
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) =>
|
|
69
|
+
const advanced = notifications.advance(entry, from, (path, revision) => held.revisions.get(path) === revision);
|
|
69
70
|
if (advanced === null)
|
|
70
71
|
return null;
|
|
71
|
-
|
|
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,
|
|
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
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
},
|
package/dist/handed.d.ts
ADDED
|
@@ -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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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
|
|
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
|
-
|
|
50
|
-
|
|
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;
|
package/dist/read.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,
|
|
1
|
+
{"version":3,"file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