@agentshouse/mdruntime-adapter 0.1.0-c3ba77716413c → 0.1.0-c3e6f15e1d944
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 +30 -8
- package/dist/actions.d.ts +1 -1
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +3 -7
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +75 -48
- package/dist/discovery.d.ts +3 -4
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +21 -12
- package/dist/gather.d.ts +1 -0
- package/dist/gather.d.ts.map +1 -1
- package/dist/gather.js +11 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/model.d.ts +1 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +23 -6
- package/dist/read.d.ts +6 -0
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +16 -3
- package/dist/refusal.d.ts +1 -1
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +26 -12
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +6 -4
- package/dist/stream.d.ts +1 -0
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +5 -0
- package/dist/transport.d.ts +2 -2
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +0 -1
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +10 -1
- package/package.json +3 -3
package/AGENTS.md
CHANGED
|
@@ -10,7 +10,7 @@ App code reaches the MD Runtime through the remote client. The surfaces are
|
|
|
10
10
|
Rooms, Query, Search, Observe, Types, Room Draft, Save, History, 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
|
-
statement
|
|
13
|
+
statement, the deployment facts and the signed-in member are observations only.
|
|
14
14
|
|
|
15
15
|
The host attaches each port with its reach, and every member and observation
|
|
16
16
|
answers within it: a Room outside it answers as one the replica does not hold,
|
|
@@ -57,7 +57,10 @@ effect the Provider places in a Room carries `at`, that Room and Room Version;
|
|
|
57
57
|
reached it, and the MD Runtime keeps refreshing that Room until it has;
|
|
58
58
|
`reached(room, roomVersion, path)` answers whether the held confirmed copy of
|
|
59
59
|
that document was written at a later Room Version. Each History revision
|
|
60
|
-
names its author, `{ kind: 'user', id }` or `{ kind: 'site', id, name }`.
|
|
60
|
+
names its author, `{ kind: 'user', id }` or `{ kind: 'site', id, name }`.
|
|
61
|
+
History of a Path no current document holds answers the removed document's
|
|
62
|
+
revisions with `deleted: true`, newest first; that revision is what a link to
|
|
63
|
+
the Path opens. Every
|
|
61
64
|
member of the
|
|
62
65
|
client is asynchronous. Results are detached snapshots. Nothing in this
|
|
63
66
|
surface returns the authorization, performs a request the App's code
|
|
@@ -66,6 +69,15 @@ composes, or exposes the browser store.
|
|
|
66
69
|
Read the deployment facts with `observe('deployment-facts')`. Interpret the
|
|
67
70
|
opaque value using the host's contract.
|
|
68
71
|
|
|
72
|
+
`observe('member')` answers who uses the App: the User the Provider signed in,
|
|
73
|
+
`{ kind: 'user', id, name }` in the shape of a change's `author`, so a Document
|
|
74
|
+
whose `change.author.id` equals its `id` is that User's own. It is `null` until
|
|
75
|
+
the Provider first names one, and where it names none, such as a Site. The
|
|
76
|
+
MD Runtime keeps it with the Local Replicas, so it answers offline once known,
|
|
77
|
+
and every port hears the next member the Provider names; signing out answers
|
|
78
|
+
`null`, then ends the observation with the authorization. It is the only way App code learns who
|
|
79
|
+
uses it.
|
|
80
|
+
|
|
69
81
|
The in-memory Adapter at `@agentshouse/mdruntime/memory` is for tests and
|
|
70
82
|
ships in no bundle.
|
|
71
83
|
|
|
@@ -109,7 +121,7 @@ data:
|
|
|
109
121
|
or `null` for a write the Provider made itself, and `time` is the Provider's
|
|
110
122
|
ISO 8601 change time. It is `null` where the Provider delivered no time, as at
|
|
111
123
|
a Site. An unsent edit or move keeps it, an unsent creation has none, and a
|
|
112
|
-
saved write takes the Provider's own once it is Accepted
|
|
124
|
+
saved write takes the Provider's own once it is Accepted. A
|
|
113
125
|
Room's last change is its Document with the latest `time`.
|
|
114
126
|
- **Order and groups.** `orderBy` sorts by `room`, `path`, `type` or `{ field }`
|
|
115
127
|
with TanStack DB's own options, and ties end with Room, then Path. `groupBy` by
|
|
@@ -179,6 +191,13 @@ it names; the MD Runtime retries the same Change Batch identity and payload and
|
|
|
179
191
|
never infers an outcome from transport uncertainty. The MD Runtime never
|
|
180
192
|
combines, reorders, or rebases.
|
|
181
193
|
|
|
194
|
+
On a Site, every Save stays in the visitor's browser. Write grants and
|
|
195
|
+
revisions do not refuse it, and its Pending Change shows in every query and
|
|
196
|
+
across reloads until the browser's storage is cleared. It is never sent:
|
|
197
|
+
`observe('queue', room)` shows it `local`, and Sync Status never waits on it.
|
|
198
|
+
Once the Room changes so that it no longer applies, it leaves the queue and
|
|
199
|
+
returns no Room Draft.
|
|
200
|
+
|
|
182
201
|
`observe('service-mode')` answers the Provider's Service
|
|
183
202
|
Mode, `open` or `write-halted`. While writes are halted, Save still succeeds,
|
|
184
203
|
its Change Batch waits unsent, and the queue is submitted in order once the
|
|
@@ -215,7 +234,7 @@ the network. Data lives only in the App Creator's browser and with the Provider.
|
|
|
215
234
|
## App code takes the client its host hands it and never constructs a Runtime
|
|
216
235
|
|
|
217
236
|
App code takes the client its host hands it: in House,
|
|
218
|
-
`
|
|
237
|
+
`houseBridge().runtime` from `@agentshouse/app-bridge` resolves to the
|
|
219
238
|
client House built into the page. It never constructs a Runtime or a client.
|
|
220
239
|
It imports only types from `@agentshouse/mdruntime/client`, does not call
|
|
221
240
|
`connectMdRuntime` or `serveMdRuntime`, and does not import the package main,
|
|
@@ -224,13 +243,16 @@ served App does not.
|
|
|
224
243
|
|
|
225
244
|
A React App may observe and save through `@agentshouse/mdruntime/react`, which
|
|
226
245
|
names React as a peer dependency. `useObserve(client, topic, ...input)` takes
|
|
227
|
-
the arguments of `observe` and returns the topic's
|
|
228
|
-
|
|
229
|
-
nothing. `useSave(client)` returns `busy`, the last `outcome` or `failure`, and
|
|
246
|
+
the arguments of `observe` and returns `{ state: 'loading' }` until the topic's
|
|
247
|
+
first value arrives, then `{ state: 'ready', value }`, re-rendering on each
|
|
248
|
+
change; a `null` client observes nothing and stays loading. `useSave(client)` returns `busy`, the last `outcome` or `failure`, and
|
|
230
249
|
`save(room, roomDrafts)`, which writes each Path's parts onto the Room Draft
|
|
231
250
|
already there, keeping the bases its parts have, or onto a new one, and saves
|
|
232
251
|
them together. A refused Save leaves the Room Drafts for the App to save again
|
|
233
|
-
or discard; a failure is recorded and rejects.
|
|
252
|
+
or discard; a failure is recorded and rejects. `saveRoomDrafts(client, room,
|
|
253
|
+
roomDrafts)` is that save outside a component. A react-admin or Refine App
|
|
254
|
+
reads and writes its Rooms through the data providers of
|
|
255
|
+
`@agentshouse/mdruntime-families`.
|
|
234
256
|
|
|
235
257
|
## What an agent must never do
|
|
236
258
|
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationAgents } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { HouseDoorAnswer, HouseTransport } from './transport.js';
|
|
3
|
-
export declare
|
|
3
|
+
export declare function houseConversationAgents(locator: string): ConversationAgents;
|
|
4
4
|
export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
|
|
5
5
|
export declare function houseAction(transport: HouseTransport, request: ActionRequest): Promise<ActionResult>;
|
|
6
6
|
export declare function actionOutcome(answer: HouseDoorAnswer, name: string): ActionResult;
|
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,EAGxB,MAAM,wBAAwB,CAAC;
|
|
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,CAAC,CAQvB;AA4DD,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAWjF;AAuLD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAUtE"}
|
package/dist/actions.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { changeBatchIdentity, } from '@agentshouse/mdruntime';
|
|
2
2
|
import { doorRefusal } from './refusal.js';
|
|
3
|
-
import { PRIVATE_LOCATOR } from './transport.js';
|
|
4
3
|
const HISTORY_PAGE = 100;
|
|
5
4
|
const HISTORY_CONVERSATIONS = 64;
|
|
6
5
|
const OCTET_STREAM = 'application/octet-stream';
|
|
@@ -13,12 +12,9 @@ const CONVERSATION_ROUTES = new Map([
|
|
|
13
12
|
['conversation.delete', '/door/conversations/delete'],
|
|
14
13
|
['conversation.history', '/door/conversations/history'],
|
|
15
14
|
]);
|
|
16
|
-
export
|
|
17
|
-
locator:
|
|
18
|
-
|
|
19
|
-
identity: 'agent',
|
|
20
|
-
name: 'name',
|
|
21
|
-
};
|
|
15
|
+
export function houseConversationAgents(locator) {
|
|
16
|
+
return { locator, type: 'house-agent', identity: 'agent', name: 'name' };
|
|
17
|
+
}
|
|
22
18
|
export function declaredActions(routes) {
|
|
23
19
|
const mapped = new Map([...CONVERSATION_ROUTES].map(([name, route]) => [route.slice('/door/'.length), name]));
|
|
24
20
|
return routes.map((route) => ({
|
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,EAWd,MAAM,wBAAwB,CAAC;
|
|
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,CAyYpF"}
|
package/dist/adapter.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { DISCOVER_PREFIXES, capabilities, discoveredRoom, mapDiscovery, parseDiscovery, trackedFrom, } from './discovery.js';
|
|
2
|
-
import {
|
|
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';
|
|
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,
|
|
10
|
+
import { DOOR_BATCH, DOOR_BATCH_UPLOAD, DOOR_BOOTSTRAP, DOOR_DISCOVER, DOOR_ENUMERATE, DOOR_REVISIONS, } from './transport.js';
|
|
11
11
|
import { batchPaths, deltaBody, deltaBytes, deltaDigest, historyOutcome, houseChanges, mutationOutcome, operationHead, rejectedMapping, revisionBody, uploadable, } from './write.js';
|
|
12
12
|
import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
|
|
13
13
|
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
@@ -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
|
-
|
|
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
|
|
38
|
-
|
|
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);
|
|
@@ -104,48 +116,59 @@ export function createAgentsHouseAdapter(options) {
|
|
|
104
116
|
const { authority, position, log_epoch: logEpoch } = body;
|
|
105
117
|
if (typeof position !== 'string' || typeof logEpoch !== 'string')
|
|
106
118
|
return result;
|
|
107
|
-
const locator = authority ===
|
|
108
|
-
? PRIVATE_LOCATOR
|
|
109
|
-
: [...tracked.values()].find((entry) => entry.authority === authority)?.locator;
|
|
119
|
+
const locator = [...tracked.values()].find((entry) => entry.authority === authority)?.locator;
|
|
110
120
|
if (locator === undefined)
|
|
111
121
|
return result;
|
|
112
122
|
return { ...result, at: { locator, roomVersion: roomVersion({ position, logEpoch }) } };
|
|
113
123
|
}
|
|
114
|
-
async function bundled(body) {
|
|
115
|
-
const grant = parseGrant(body);
|
|
116
|
-
if (grant === null)
|
|
117
|
-
return body;
|
|
118
|
-
if (grant.method !== 'GET')
|
|
119
|
-
return null;
|
|
120
|
-
const answer = await transport.transfer({
|
|
121
|
-
act: 'local_copy_bundle',
|
|
122
|
-
method: 'GET',
|
|
123
|
-
url: grant.url,
|
|
124
|
-
answer: 'json',
|
|
125
|
-
});
|
|
126
|
-
return answer.status === 200 ? answer.body : null;
|
|
127
|
-
}
|
|
128
124
|
function weight(entry) {
|
|
129
125
|
return contentPrefixes(entry).length;
|
|
130
126
|
}
|
|
131
|
-
async function bootstrapped(entries) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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));
|
|
144
153
|
}
|
|
145
|
-
answers.push(failure);
|
|
146
154
|
}
|
|
155
|
+
open = unreached;
|
|
147
156
|
}
|
|
148
|
-
|
|
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);
|
|
149
172
|
}
|
|
150
173
|
function layered(asks) {
|
|
151
174
|
const depths = new Map();
|
|
@@ -192,7 +215,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
192
215
|
}
|
|
193
216
|
return asks.map((ask) => answers.get(ask) ?? UNCERTAIN_READ);
|
|
194
217
|
}
|
|
195
|
-
const bootstrapTogether =
|
|
218
|
+
const bootstrapTogether = gatheredEach(bootstrapped);
|
|
196
219
|
const enumerateTogether = gathered(enumerated);
|
|
197
220
|
async function uploaded(head, changes, delta, bytes, entry, handed, keep) {
|
|
198
221
|
const paths = batchPaths(changes);
|
|
@@ -239,9 +262,9 @@ export function createAgentsHouseAdapter(options) {
|
|
|
239
262
|
},
|
|
240
263
|
async discover(_authorization) {
|
|
241
264
|
const answer = await transport.door(DOOR_DISCOVER, { prefixes: [...DISCOVER_PREFIXES] });
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
244
|
-
return
|
|
265
|
+
const failed = discoveryFailure(answer.status, answer.body);
|
|
266
|
+
if (failed !== null)
|
|
267
|
+
return failed;
|
|
245
268
|
const document = parseDiscovery(answer.body);
|
|
246
269
|
if (document === null)
|
|
247
270
|
return { kind: 'transport-uncertainty' };
|
|
@@ -254,14 +277,18 @@ export function createAgentsHouseAdapter(options) {
|
|
|
254
277
|
if (!tracked.has(locator))
|
|
255
278
|
handed.delete(locator);
|
|
256
279
|
notifications.track(entries);
|
|
257
|
-
return
|
|
280
|
+
return {
|
|
281
|
+
...mapDiscovery(document, document.authorities.map((authority) => discoveredRoom(authority)), capabilities(document)),
|
|
282
|
+
member: document.member,
|
|
283
|
+
};
|
|
258
284
|
},
|
|
259
285
|
async bootstrap(_authorization, request) {
|
|
260
286
|
const entry = authorityFor(request.locator);
|
|
261
287
|
if (entry === undefined)
|
|
262
288
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
263
|
-
if (request.pageToken !== undefined)
|
|
264
|
-
return
|
|
289
|
+
if (request.pageToken !== undefined) {
|
|
290
|
+
return continuedBootstrap(entry, JSON.parse(request.pageToken));
|
|
291
|
+
}
|
|
265
292
|
return bootstrapTogether(entry);
|
|
266
293
|
},
|
|
267
294
|
async refresh(_authorization, request) {
|
|
@@ -318,7 +345,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
318
345
|
async action(_authorization, request) {
|
|
319
346
|
return withAt(await houseAction(transport, request));
|
|
320
347
|
},
|
|
321
|
-
roomStream: { hold: held, observe: notifications.observe },
|
|
348
|
+
roomStream: { hold: held, reopen: notifications.reopen, observe: notifications.observe },
|
|
322
349
|
conversations: notifications.conversations,
|
|
323
350
|
serviceMode: notifications.serviceMode,
|
|
324
351
|
};
|
package/dist/discovery.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { Capability, DiscoveredRoom, Discovery, ProviderLimit, Retention } from '@agentshouse/mdruntime';
|
|
1
|
+
import type { Capability, DiscoveredRoom, Discovery, Member, ProviderLimit, Retention } from '@agentshouse/mdruntime';
|
|
2
2
|
import { type LogPosition } from './version.js';
|
|
3
3
|
export declare const PROVIDER_ACTIONS = "provider-actions";
|
|
4
4
|
export declare const DISCOVER_PREFIXES: readonly string[];
|
|
5
|
-
export declare const PRIVATE_HANDLE = "private";
|
|
6
5
|
export type HouseBounds = {
|
|
7
6
|
max_authored_file_bytes: number;
|
|
8
7
|
max_batch_operations: number;
|
|
@@ -38,6 +37,7 @@ export type HouseAuthority = LogPosition & {
|
|
|
38
37
|
operations: HouseOperations;
|
|
39
38
|
};
|
|
40
39
|
export type HouseDiscoveryDocument = {
|
|
40
|
+
member: Member;
|
|
41
41
|
bounds: HouseBounds;
|
|
42
42
|
authorities: readonly HouseAuthority[];
|
|
43
43
|
actions: readonly string[];
|
|
@@ -62,11 +62,10 @@ export type HouseSiteDiscovery = {
|
|
|
62
62
|
export declare function parseDiscovery(body: unknown): HouseDiscoveryDocument | null;
|
|
63
63
|
export declare function parseSiteDiscovery(body: unknown): HouseSiteDiscovery | null;
|
|
64
64
|
export declare function siteTracked(document: HouseSiteDiscovery): TrackedAuthority[];
|
|
65
|
-
export declare function locatorOf(authority: HouseAuthority): string;
|
|
66
65
|
export declare function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[];
|
|
67
66
|
export declare function providerLimits(bounds: HouseBounds): readonly ProviderLimit[];
|
|
68
67
|
export declare function declaredRetention(bounds: HouseBounds): Retention;
|
|
69
|
-
export declare function capabilities(
|
|
68
|
+
export declare function capabilities(document: HouseDiscoveryDocument): readonly Capability[];
|
|
70
69
|
export declare function siteCapabilities(): readonly Capability[];
|
|
71
70
|
export declare function discoveredRoom(authority: HouseAuthority): DiscoveredRoom;
|
|
72
71
|
export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
|
package/dist/discovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,SAAS,EACV,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,M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hE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,sBAAsB,GAAG,SAAS,UAAU,EAAE,CAWpF;AAED,wBAAgB,gBAAgB,IAAI,SAAS,UAAU,EAAE,CAIxD;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAmBxE;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC,EAChD,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAC9B,SAAS,CAQX"}
|
package/dist/discovery.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { declaredActions,
|
|
2
|
-
import { PRIVATE_LOCATOR } from './transport.js';
|
|
1
|
+
import { declaredActions, houseConversationAgents } from './actions.js';
|
|
3
2
|
import { readPosition, roomVersion } from './version.js';
|
|
4
3
|
export const PROVIDER_ACTIONS = 'provider-actions';
|
|
5
4
|
export const DISCOVER_PREFIXES = ['/'];
|
|
6
|
-
export const PRIVATE_HANDLE = 'private';
|
|
7
5
|
const BOUND_KEYS = [
|
|
8
6
|
'max_authored_file_bytes',
|
|
9
7
|
'max_batch_operations',
|
|
@@ -48,6 +46,14 @@ function parseHouseModel(value) {
|
|
|
48
46
|
return undefined;
|
|
49
47
|
return { root: held.root, paths };
|
|
50
48
|
}
|
|
49
|
+
function parseMember(value) {
|
|
50
|
+
if (typeof value !== 'object' || value === null)
|
|
51
|
+
return null;
|
|
52
|
+
const { user, name } = value;
|
|
53
|
+
if (typeof user !== 'string' || typeof name !== 'string')
|
|
54
|
+
return null;
|
|
55
|
+
return { kind: 'user', id: user, name };
|
|
56
|
+
}
|
|
51
57
|
function parseOperations(value) {
|
|
52
58
|
if (typeof value !== 'object' || value === null)
|
|
53
59
|
return null;
|
|
@@ -100,6 +106,9 @@ export function parseDiscovery(body) {
|
|
|
100
106
|
if (typeof body !== 'object' || body === null)
|
|
101
107
|
return null;
|
|
102
108
|
const held = body;
|
|
109
|
+
const member = parseMember(held.member);
|
|
110
|
+
if (member === null)
|
|
111
|
+
return null;
|
|
103
112
|
const bounds = parseBounds(held.bounds);
|
|
104
113
|
if (bounds === null)
|
|
105
114
|
return null;
|
|
@@ -117,7 +126,7 @@ export function parseDiscovery(body) {
|
|
|
117
126
|
return null;
|
|
118
127
|
authorities.push(authority);
|
|
119
128
|
}
|
|
120
|
-
return { bounds, authorities, actions };
|
|
129
|
+
return { member, bounds, authorities, actions };
|
|
121
130
|
}
|
|
122
131
|
function parseSiteAuthority(value) {
|
|
123
132
|
if (typeof value !== 'object' || value === null)
|
|
@@ -171,9 +180,6 @@ export function siteTracked(document) {
|
|
|
171
180
|
logEpoch: authority.logEpoch,
|
|
172
181
|
}));
|
|
173
182
|
}
|
|
174
|
-
export function locatorOf(authority) {
|
|
175
|
-
return authority.roomHandle === PRIVATE_HANDLE ? PRIVATE_LOCATOR : authority.roomRef;
|
|
176
|
-
}
|
|
177
183
|
function schemasOf(authority) {
|
|
178
184
|
return authority.houseModel === null
|
|
179
185
|
? [authority.schema]
|
|
@@ -181,7 +187,7 @@ function schemasOf(authority) {
|
|
|
181
187
|
}
|
|
182
188
|
export function trackedFrom(document) {
|
|
183
189
|
return document.authorities.map((authority) => ({
|
|
184
|
-
locator:
|
|
190
|
+
locator: authority.roomRef,
|
|
185
191
|
authority: authority.roomRef,
|
|
186
192
|
handle: authority.roomHandle,
|
|
187
193
|
schema: authority.schema,
|
|
@@ -209,12 +215,15 @@ export function declaredRetention(bounds) {
|
|
|
209
215
|
refreshHorizon: bounds.change_retention_seconds,
|
|
210
216
|
};
|
|
211
217
|
}
|
|
212
|
-
export function capabilities(
|
|
218
|
+
export function capabilities(document) {
|
|
219
|
+
const house = document.authorities.find((authority) => authority.houseModel !== null);
|
|
213
220
|
return [
|
|
214
221
|
{
|
|
215
222
|
name: PROVIDER_ACTIONS,
|
|
216
|
-
actions: declaredActions(actions),
|
|
217
|
-
|
|
223
|
+
actions: declaredActions(document.actions),
|
|
224
|
+
...(house === undefined
|
|
225
|
+
? {}
|
|
226
|
+
: { conversationAgents: houseConversationAgents(house.roomRef) }),
|
|
218
227
|
},
|
|
219
228
|
];
|
|
220
229
|
}
|
|
@@ -224,7 +233,7 @@ export function siteCapabilities() {
|
|
|
224
233
|
];
|
|
225
234
|
}
|
|
226
235
|
export function discoveredRoom(authority) {
|
|
227
|
-
const locator =
|
|
236
|
+
const locator = authority.roomRef;
|
|
228
237
|
return {
|
|
229
238
|
name: authority.name,
|
|
230
239
|
locator,
|
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
|
package/dist/gather.d.ts.map
CHANGED
|
@@ -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,
|
|
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
|
|
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)
|
|
7
|
-
taken
|
|
8
|
-
|
|
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,4 +1,3 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
|
-
export { PRIVATE_LOCATOR } from './transport.js';
|
|
3
2
|
export type { HouseByteAct, HouseByteAnswer, HouseByteTransfer, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
4
3
|
//# 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,
|
|
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"}
|
package/dist/index.js
CHANGED
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>;
|
package/dist/model.d.ts.map
CHANGED
|
@@ -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;
|
|
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
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { sha256Hex } from './digest.js';
|
|
2
2
|
import { schemaOf, schemaPath } from './read.js';
|
|
3
3
|
const MODEL_ABSENT = { kind: 'model-unavailable', reason: 'not-readable' };
|
|
4
|
-
const ABSENT_SCHEMA = { schema: null, version: null };
|
|
4
|
+
const ABSENT_SCHEMA = { schema: null, version: null, revision: null };
|
|
5
5
|
async function heldModel(read, identity) {
|
|
6
6
|
if (read === null)
|
|
7
7
|
return MODEL_ABSENT;
|
|
8
8
|
const version = await sha256Hex(JSON.stringify(read.version));
|
|
9
|
-
return {
|
|
9
|
+
return {
|
|
10
|
+
kind: 'model',
|
|
11
|
+
snapshot: { identity, version, schema: read.schema, revision: read.revision },
|
|
12
|
+
};
|
|
10
13
|
}
|
|
11
14
|
async function modelsOf(tracked, read) {
|
|
12
15
|
const models = {};
|
|
@@ -23,8 +26,15 @@ async function modelsOf(tracked, read) {
|
|
|
23
26
|
}
|
|
24
27
|
return models.collection === undefined && models.selection === undefined ? undefined : models;
|
|
25
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
|
+
}
|
|
26
36
|
export function scopeModels(scope, tracked) {
|
|
27
|
-
return
|
|
37
|
+
return partModels(scope, tracked, new Set(), true);
|
|
28
38
|
}
|
|
29
39
|
export function viewModels(view, tracked) {
|
|
30
40
|
return modelsOf(tracked, (schema) => {
|
|
@@ -33,8 +43,13 @@ export function viewModels(view, tracked) {
|
|
|
33
43
|
return undefined;
|
|
34
44
|
if ('removed' in change)
|
|
35
45
|
return ABSENT_SCHEMA;
|
|
36
|
-
if ('content' in change)
|
|
37
|
-
return {
|
|
46
|
+
if ('content' in change) {
|
|
47
|
+
return {
|
|
48
|
+
schema: change.content,
|
|
49
|
+
version: change.version,
|
|
50
|
+
revision: change.revision ?? null,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
38
53
|
return null;
|
|
39
54
|
});
|
|
40
55
|
}
|
|
@@ -48,6 +63,8 @@ export function streamedModels(schemas, tracked, mode) {
|
|
|
48
63
|
if (entry.text === undefined)
|
|
49
64
|
return null;
|
|
50
65
|
const version = mode === 'site' ? entry.sha256 : entry.revision;
|
|
51
|
-
return version === undefined
|
|
66
|
+
return version === undefined
|
|
67
|
+
? null
|
|
68
|
+
: { schema: entry.text, version, revision: mode === 'site' ? null : version };
|
|
52
69
|
});
|
|
53
70
|
}
|
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';
|
|
@@ -71,6 +76,7 @@ export declare function bootstrapOf(scope: HouseScope): BootstrapPage;
|
|
|
71
76
|
export type HouseSchema = {
|
|
72
77
|
schema: string | null;
|
|
73
78
|
version: string | null;
|
|
79
|
+
revision: string | null;
|
|
74
80
|
};
|
|
75
81
|
export declare function schemaOf(scope: HouseScope, schema: string): HouseSchema | null;
|
|
76
82
|
export declare function viewOf(enumeration: HouseEnumeration, tracked: TrackedAuthority): HouseView | undefined;
|
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,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;AAEF,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACpC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src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AAC,KAAK,EAAE,OAAO,GAAG,SAAS,cAAc,EAAE,GAAG,IAAI,CAS/E;AA0DD,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,aAAa,GAAG,IAAI,CAYjE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAEnE;AAoCD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,gBAAgB,GAAG,IAAI,CAyBxF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,GAAG,UAAU,CA2B5E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAElF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,CAsB5D;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAO9E;AAED,wBAAgB,MAAM,CACpB,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,SAAS,GAAG,SAAS,CAEvB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,aAAa,CA+BnF"}
|
package/dist/read.js
CHANGED
|
@@ -137,6 +137,14 @@ function parseScope(value, mode) {
|
|
|
137
137
|
return null;
|
|
138
138
|
return { anchor: manifest.anchor, ...at, files, contents, attachments };
|
|
139
139
|
}
|
|
140
|
+
function parseCursor(value) {
|
|
141
|
+
if (typeof value !== 'object' || value === null)
|
|
142
|
+
return null;
|
|
143
|
+
const { room, path } = value;
|
|
144
|
+
if (typeof room !== 'string' || (path !== null && typeof path !== 'string'))
|
|
145
|
+
return null;
|
|
146
|
+
return { room, path };
|
|
147
|
+
}
|
|
140
148
|
export function parseEnvelope(body) {
|
|
141
149
|
if (typeof body !== 'object' || body === null)
|
|
142
150
|
return null;
|
|
@@ -149,7 +157,10 @@ export function parseEnvelope(body) {
|
|
|
149
157
|
return null;
|
|
150
158
|
scopes.push(scope);
|
|
151
159
|
}
|
|
152
|
-
|
|
160
|
+
if (!('next' in body) || body.next === undefined)
|
|
161
|
+
return { scopes };
|
|
162
|
+
const next = parseCursor(body.next);
|
|
163
|
+
return next === null ? null : { scopes, next };
|
|
153
164
|
}
|
|
154
165
|
export function parseSiteBootstrap(body) {
|
|
155
166
|
return parseScope(body, 'site');
|
|
@@ -288,9 +299,11 @@ export function bootstrapOf(scope) {
|
|
|
288
299
|
export function schemaOf(scope, schema) {
|
|
289
300
|
const file = scope.files.find((entry) => entry.path === schema);
|
|
290
301
|
if (file === undefined)
|
|
291
|
-
return { schema: null, version: null };
|
|
302
|
+
return { schema: null, version: null, revision: null };
|
|
292
303
|
const content = scope.contents.find((entry) => entry.path === schema);
|
|
293
|
-
return content === undefined
|
|
304
|
+
return content === undefined
|
|
305
|
+
? null
|
|
306
|
+
: { schema: content.content, version: file.version, revision: file.revision ?? null };
|
|
294
307
|
}
|
|
295
308
|
export function viewOf(enumeration, tracked) {
|
|
296
309
|
return enumeration.authorities.find((entry) => entry.authority === tracked.authority);
|
package/dist/refusal.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export declare function classifyDoor(status: number, body: unknown, locator: str
|
|
|
8
8
|
export declare function classifyRead(status: number, body: unknown, locator: string): AdapterFailure | {
|
|
9
9
|
kind: 'beyond-horizon';
|
|
10
10
|
} | null;
|
|
11
|
-
export declare function discoveryFailure(
|
|
11
|
+
export declare function discoveryFailure(status: number, body: unknown): DiscoverResult | null;
|
|
12
12
|
//# sourceMappingURL=refusal.d.ts.map
|
package/dist/refusal.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/refusal.js
CHANGED
|
@@ -12,7 +12,7 @@ export function doorRefusal(body) {
|
|
|
12
12
|
export function scopedRefusal(locator, scope, refusal) {
|
|
13
13
|
return { kind: 'scoped-refusal', locator, scope, code: refusal.code, fields: refusal.fields };
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
function doorFailure(status, body) {
|
|
16
16
|
if (status === 0)
|
|
17
17
|
return { kind: 'transport-uncertainty' };
|
|
18
18
|
const refusal = doorRefusal(body);
|
|
@@ -20,27 +20,41 @@ export function classifyDoor(status, body, locator) {
|
|
|
20
20
|
return { kind: 'revoked-authorization' };
|
|
21
21
|
if (refusal?.retryable === true)
|
|
22
22
|
return { kind: 'transport-uncertainty' };
|
|
23
|
-
if (status === 404 || refusal?.code === 'room_not_found')
|
|
24
|
-
return { kind: 'room-not-readable'
|
|
25
|
-
}
|
|
23
|
+
if (status === 404 || refusal?.code === 'room_not_found')
|
|
24
|
+
return { kind: 'room-not-readable' };
|
|
26
25
|
if (status < 400)
|
|
27
26
|
return null;
|
|
28
27
|
if (refusal === null)
|
|
29
28
|
return { kind: 'transport-uncertainty' };
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
return { kind: 'refused', scope: status === 403 ? 'operation' : 'undisclosed', refusal };
|
|
30
|
+
}
|
|
31
|
+
export function classifyDoor(status, body, locator) {
|
|
32
|
+
const failure = doorFailure(status, body);
|
|
33
|
+
if (failure === null)
|
|
34
|
+
return null;
|
|
35
|
+
if (failure.kind === 'room-not-readable')
|
|
36
|
+
return { kind: 'room-not-readable', locator };
|
|
37
|
+
if (failure.kind === 'refused')
|
|
38
|
+
return scopedRefusal(locator, failure.scope, failure.refusal);
|
|
39
|
+
return failure;
|
|
33
40
|
}
|
|
34
41
|
export function classifyRead(status, body, locator) {
|
|
35
42
|
if (doorRefusal(body)?.code === 'expired')
|
|
36
43
|
return { kind: 'beyond-horizon' };
|
|
37
44
|
return classifyDoor(status, body, locator);
|
|
38
45
|
}
|
|
39
|
-
export function discoveryFailure(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
export function discoveryFailure(status, body) {
|
|
47
|
+
const failure = doorFailure(status, body);
|
|
48
|
+
if (failure === null)
|
|
49
|
+
return null;
|
|
50
|
+
if (failure.kind === 'revoked-authorization')
|
|
51
|
+
return failure;
|
|
52
|
+
if (failure.kind === 'refused') {
|
|
53
|
+
return {
|
|
54
|
+
kind: 'contract-unavailable',
|
|
55
|
+
code: failure.refusal.code,
|
|
56
|
+
fields: failure.refusal.fields,
|
|
57
|
+
};
|
|
44
58
|
}
|
|
45
59
|
return { kind: 'transport-uncertainty' };
|
|
46
60
|
}
|
package/dist/site.d.ts.map
CHANGED
|
@@ -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,
|
|
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,CAmIxE"}
|
package/dist/site.js
CHANGED
|
@@ -4,7 +4,7 @@ import { scopeModels, streamedModels, viewModels } from './model.js';
|
|
|
4
4
|
import { advancedScope, bootstrapOf, parseEnumeration, parseSiteBootstrap, refreshFrom, viewOf, } from './read.js';
|
|
5
5
|
import { classifyDoor, classifyRead, discoveryFailure } from './refusal.js';
|
|
6
6
|
import { houseNotifications } from './stream.js';
|
|
7
|
-
import {
|
|
7
|
+
import { SITE_DOOR_BOOTSTRAP, SITE_DOOR_DISCOVER, SITE_DOOR_ENUMERATE, SITE_DOOR_SUBMIT, } from './transport.js';
|
|
8
8
|
import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
|
|
9
9
|
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
10
10
|
function siteRoom(tracked) {
|
|
@@ -74,14 +74,15 @@ 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
|
},
|
|
80
81
|
async discover() {
|
|
81
82
|
const answer = await transport.read(SITE_DOOR_DISCOVER);
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
84
|
-
return
|
|
83
|
+
const failed = discoveryFailure(answer.status, answer.body);
|
|
84
|
+
if (failed !== null)
|
|
85
|
+
return failed;
|
|
85
86
|
const document = parseSiteDiscovery(answer.body);
|
|
86
87
|
if (document === null)
|
|
87
88
|
return UNCERTAIN;
|
|
@@ -144,6 +145,7 @@ export function createSiteAdapter(transport) {
|
|
|
144
145
|
return [presented(entry.authority, at)];
|
|
145
146
|
}));
|
|
146
147
|
},
|
|
148
|
+
reopen: notifications.reopen,
|
|
147
149
|
observe: notifications.observe,
|
|
148
150
|
},
|
|
149
151
|
serviceMode: notifications.serviceMode,
|
package/dist/stream.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export type HouseNotifications = {
|
|
|
12
12
|
runtime: string;
|
|
13
13
|
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
14
14
|
send(rooms: readonly HouseHeldRoom[]): void;
|
|
15
|
+
reopen(): void;
|
|
15
16
|
track(authorities: readonly TrackedAuthority[]): void;
|
|
16
17
|
reach(authority: string, at: LogPosition): void;
|
|
17
18
|
advance(tracked: TrackedAuthority, from: LogPosition, holds?: HeldRevision): StreamedAdvancement | null;
|
package/dist/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAElB,WAAW,EACX,eAAe,EAEf,iBAAiB,EAElB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EAEb,SAAS,EAET,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAgB7D,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC9D,IAAI,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtD,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD,OAAO,CACL,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,EACjB,KAAK,CAAC,EAAE,YAAY,GACnB,mBAAmB,GAA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I,CAAC;IAChD,OAAO,CACL,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,EACjB,KAAK,CAAC,EAAE,YAAY,GACnB,mBAAmB,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,kBAAkB,CAAC;IAClC,WAAW,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAuBF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,kBAAkB,CAyS5F"}
|
package/dist/stream.js
CHANGED
|
@@ -222,6 +222,11 @@ export function houseNotifications(transport, mode) {
|
|
|
222
222
|
opening = null;
|
|
223
223
|
current?.hold(rooms, runtime);
|
|
224
224
|
},
|
|
225
|
+
reopen() {
|
|
226
|
+
const current = opening;
|
|
227
|
+
opening = null;
|
|
228
|
+
current?.close();
|
|
229
|
+
},
|
|
225
230
|
track(entries) {
|
|
226
231
|
locators.clear();
|
|
227
232
|
for (const entry of entries) {
|
package/dist/transport.d.ts
CHANGED
|
@@ -9,13 +9,12 @@ export declare const SITE_DOOR_DISCOVER = "/_house/door/discover";
|
|
|
9
9
|
export declare const SITE_DOOR_BOOTSTRAP = "/_house/door/bootstrap/";
|
|
10
10
|
export declare const SITE_DOOR_ENUMERATE = "/_house/door/enumerate";
|
|
11
11
|
export declare const SITE_DOOR_SUBMIT = "/_house/door/submit";
|
|
12
|
-
export declare const PRIVATE_LOCATOR = "private";
|
|
13
12
|
export type HouseMode = 'credential' | 'site';
|
|
14
13
|
export type HouseDoorAnswer = {
|
|
15
14
|
status: number;
|
|
16
15
|
body: unknown;
|
|
17
16
|
};
|
|
18
|
-
export type HouseByteAct = '
|
|
17
|
+
export type HouseByteAct = 'authored_batch_upload' | 'conversation_original_upload' | 'original_upload' | 'original_download';
|
|
19
18
|
export type HouseByteBody = string | ArrayBuffer | Uint8Array;
|
|
20
19
|
export type HouseByteAnswer = 'json' | 'bytes';
|
|
21
20
|
export type HouseByteTransfer = {
|
|
@@ -106,6 +105,7 @@ export type HouseHeldRoom = {
|
|
|
106
105
|
};
|
|
107
106
|
export type HouseOpening = {
|
|
108
107
|
hold(rooms: readonly HouseHeldRoom[], runtime: string): void;
|
|
108
|
+
close(): void;
|
|
109
109
|
};
|
|
110
110
|
export type HouseStream = {
|
|
111
111
|
observe(receive: (frame: HouseStreamFrame) => void): () => void;
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -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,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AAEtD,
|
|
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,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,kB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C;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/transport.js
CHANGED
|
@@ -8,4 +8,3 @@ export const SITE_DOOR_DISCOVER = '/_house/door/discover';
|
|
|
8
8
|
export const SITE_DOOR_BOOTSTRAP = '/_house/door/bootstrap/';
|
|
9
9
|
export const SITE_DOOR_ENUMERATE = '/_house/door/enumerate';
|
|
10
10
|
export const SITE_DOOR_SUBMIT = '/_house/door/submit';
|
|
11
|
-
export const PRIVATE_LOCATOR = 'private';
|
package/dist/write.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEX,aAAa,EAEb,cAAc,EAEd,cAAc,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOlD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE/D,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAuGrD,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW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MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,gBAAgB,CA4DlB;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;;EAEjB;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,CAgDf"}
|
package/dist/write.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseOriginals } from './read.js';
|
|
1
|
+
import { headChange, parseOriginals } 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;
|
|
@@ -205,6 +209,7 @@ export function mutationOutcome(status, body, locator, handle) {
|
|
|
205
209
|
return { kind: 'transport-uncertainty' };
|
|
206
210
|
const documents = {};
|
|
207
211
|
const revisions = {};
|
|
212
|
+
const changes = {};
|
|
208
213
|
const removals = [];
|
|
209
214
|
for (const entry of contents) {
|
|
210
215
|
if (entry.content === null || entry.revision === null) {
|
|
@@ -213,12 +218,15 @@ export function mutationOutcome(status, body, locator, handle) {
|
|
|
213
218
|
}
|
|
214
219
|
documents[entry.path] = entry.content;
|
|
215
220
|
revisions[entry.path] = entry.revision;
|
|
221
|
+
if (entry.head !== undefined)
|
|
222
|
+
changes[entry.path] = entry.head;
|
|
216
223
|
}
|
|
217
224
|
return {
|
|
218
225
|
kind: 'accepted',
|
|
219
226
|
roomVersion: roomVersion(at),
|
|
220
227
|
documents,
|
|
221
228
|
revisions,
|
|
229
|
+
changes,
|
|
222
230
|
removals: removals.sort(),
|
|
223
231
|
originals,
|
|
224
232
|
};
|
|
@@ -300,5 +308,6 @@ export function historyOutcome(status, body, locator, request) {
|
|
|
300
308
|
kind: 'history',
|
|
301
309
|
revisions,
|
|
302
310
|
...(typeof next === 'number' ? { pageToken: String(next) } : {}),
|
|
311
|
+
...(held.deleted === true ? { deleted: true } : {}),
|
|
303
312
|
};
|
|
304
313
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdruntime-adapter",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-c3e6f15e1d944",
|
|
4
4
|
"description": "Agents House Adapter for the MD Runtime",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"LICENSE"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@agentshouse/mdmodel": "0.1.0-
|
|
29
|
-
"@agentshouse/mdruntime": "0.1.0-
|
|
28
|
+
"@agentshouse/mdmodel": "0.1.0-c64dbada0730d",
|
|
29
|
+
"@agentshouse/mdruntime": "0.1.0-c664116195e6f"
|
|
30
30
|
}
|
|
31
31
|
}
|