@agentshouse/mdruntime-adapter 0.1.0-c6ddfd288ac81 → 0.1.0-cc63dd043d0e2
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 +27 -22
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +32 -21
- package/dist/discovery.d.ts +11 -17
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +33 -74
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/links.d.ts +1 -0
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +17 -2
- package/dist/read.d.ts +3 -4
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +2 -20
- package/dist/refusal.d.ts +3 -1
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +2 -16
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +9 -7
- package/dist/stream.d.ts +3 -1
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +54 -65
- package/dist/transport.d.ts +5 -13
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +0 -1
- package/dist/write.d.ts +2 -4
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +9 -14
- package/package.json +3 -3
package/AGENTS.md
CHANGED
|
@@ -7,9 +7,18 @@ enforcement.
|
|
|
7
7
|
## The MD Runtime API
|
|
8
8
|
|
|
9
9
|
App code reaches the MD Runtime through the remote client. The surfaces are
|
|
10
|
-
Rooms,
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
Rooms, Query, Search, Observe, Types, Room Draft, Save, History, Call, Reached, Log,
|
|
11
|
+
the reported persistence answer, reauthorization, conversation, the chat draft,
|
|
12
|
+
and Presentation State. Sync Status, the Service Mode, the storage-loss
|
|
13
|
+
statement and the deployment facts are observations only.
|
|
14
|
+
|
|
15
|
+
The host attaches each port with its reach, and every member and observation
|
|
16
|
+
answers within it: a Room outside it answers as one the replica does not hold, a
|
|
17
|
+
Room reached for single Documents shows only those Documents, the Types of the
|
|
18
|
+
models that govern them and no attachments, and without conversations the
|
|
19
|
+
conversation members, the chat draft and the conversation observation hold none.
|
|
20
|
+
A change of the reach reaches every open observation as its new value, a query
|
|
21
|
+
keeping every unchanged Document the same object.
|
|
13
22
|
|
|
14
23
|
Every `observe` resolves, once its first value has arrived, to a handle:
|
|
15
24
|
`current()` is the latest complete value, `subscribe(listener)` hears each later
|
|
@@ -21,25 +30,21 @@ Each conversation a Provider card names is held complete in the browser.
|
|
|
21
30
|
Observe one with `observe('conversation', id, { limit })`: the view
|
|
22
31
|
holds its latest `limit` messages, or all of them, oldest first, its chat
|
|
23
32
|
draft, and what the Provider streams for it whether or not anything views it:
|
|
24
|
-
the
|
|
25
|
-
state, the CLI's commands and options
|
|
26
|
-
only in memory: the turn's
|
|
27
|
-
|
|
28
|
-
searchable.
|
|
33
|
+
the running `turn` with its message parts and its context in use and window, the
|
|
34
|
+
open questions, the process state, and the CLI's commands and options. These live
|
|
35
|
+
only in memory: the message accepted under the turn's id replaces the running turn,
|
|
36
|
+
and none of them is stored or searchable.
|
|
29
37
|
`chatDraft.write` and `chatDraft.discard` keep what the App Creator composes;
|
|
30
38
|
sending it is a Provider Action that needs the Provider reachable and is never
|
|
31
39
|
queued.
|
|
32
40
|
|
|
33
|
-
Slots answers each Slot the Provider declares, in its order, with its entries
|
|
34
|
-
in order, each a Room and its segment; a Room two Slots list is the same Room.
|
|
35
|
-
|
|
36
41
|
Each Room in Rooms lists its `attachments`, the files the Provider holds for it
|
|
37
42
|
that its Documents link by the Provider's reference, ordered by `reference`,
|
|
38
43
|
each with `name`, `byteLength`, `mediaType` and the Provider's own entry as
|
|
39
44
|
`entry`. They are as the Provider last declared them and hold no bytes;
|
|
40
45
|
open one through the Provider Action that serves it.
|
|
41
46
|
|
|
42
|
-
Rooms,
|
|
47
|
+
Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never
|
|
43
48
|
touch the network.
|
|
44
49
|
History and Call go to the Provider through the Adapter. A Call result whose
|
|
45
50
|
effect the Provider places in a Room carries `at`, that Room and Room Version;
|
|
@@ -53,9 +58,8 @@ client is asynchronous. Results are detached snapshots. Nothing in this
|
|
|
53
58
|
surface returns the authorization, performs a request the App's code
|
|
54
59
|
composes, or exposes the browser store.
|
|
55
60
|
|
|
56
|
-
Read deployment facts with `
|
|
57
|
-
|
|
58
|
-
host's contract.
|
|
61
|
+
Read the deployment facts with `observe('deployment-facts')`. Interpret the
|
|
62
|
+
opaque value using the host's contract.
|
|
59
63
|
|
|
60
64
|
The in-memory Adapter at `@agentshouse/mdruntime/memory` is for tests and
|
|
61
65
|
ships in no bundle.
|
|
@@ -114,7 +118,7 @@ search.
|
|
|
114
118
|
|
|
115
119
|
- **What is found.** A Document by its field values, its sections' headings and
|
|
116
120
|
text, its preamble and its Path; a message by its text. Frontmatter keys, Room
|
|
117
|
-
Drafts, chat drafts and
|
|
121
|
+
Drafts, chat drafts and a running turn's parts are never found. There are no phrases,
|
|
118
122
|
word forms, typo tolerance or prefix matching.
|
|
119
123
|
- **Narrowing.** `documents` is a Local Query filter: `rooms`, `types`, `where`,
|
|
120
124
|
`pathPrefix`, `hop` and `backlinks`. `conversations` names conversations. Both
|
|
@@ -130,7 +134,7 @@ search.
|
|
|
130
134
|
|
|
131
135
|
The MD Runtime owns one Room Draft per Room and Path, shared by every App and
|
|
132
136
|
tab. It is durable: it survives reload and navigation. A Room that Discovery
|
|
133
|
-
stops listing takes its Room Drafts
|
|
137
|
+
stops listing takes its Room Drafts and its queue with it.
|
|
134
138
|
Write a Room Draft with `roomDraft.write(room, path, revision, parts)`, naming
|
|
135
139
|
the revision you read, or `null` when there was none, and every part it should
|
|
136
140
|
now change: fields, sections and the preamble, or the whole Markdown, a
|
|
@@ -150,20 +154,21 @@ each Document and binary link target beneath it, saved together.
|
|
|
150
154
|
|
|
151
155
|
Outcomes follow the Provider's answer. An Accepted Change Batch stays in the
|
|
152
156
|
queue, drawn over the confirmed layer, until the confirmed layer reaches the
|
|
153
|
-
Room Version it was accepted at, and then leaves it. Conflicted and Rejected, an expired
|
|
157
|
+
Room Version it was accepted at, and then leaves it. Conflicted and Rejected, an expired operation, and a change that no
|
|
154
158
|
longer applies over the Room each leave the queue and return as Room Drafts on
|
|
155
159
|
the Documents they changed, marked with why: the Provider's structured refusal
|
|
156
160
|
code and fields as returned, not known to have applied, or withdrawn locally.
|
|
157
161
|
The rest of the queue keeps synchronizing, and Sync Status requires attention
|
|
158
|
-
until each returned Room Draft is saved again or discarded.
|
|
159
|
-
|
|
162
|
+
until each returned Room Draft is saved again or discarded. A Change Batch
|
|
163
|
+
keeps no outcome once it leaves the queue; `observe('queue', room)` shows each
|
|
164
|
+
Pending one, and a returned Room Draft says why it returned. Transport
|
|
160
165
|
failure and Provider unavailability keep work Pending and do not infer a
|
|
161
166
|
rejection. A refusal the Provider marks retryable stays Pending until the reset
|
|
162
167
|
it names; the MD Runtime retries the same Change Batch identity and payload and
|
|
163
168
|
never infers an outcome from transport uncertainty. The MD Runtime never
|
|
164
169
|
combines, reorders, or rebases.
|
|
165
170
|
|
|
166
|
-
`
|
|
171
|
+
`observe('service-mode')` answers the Provider's Service
|
|
167
172
|
Mode, `open` or `write-halted`. While writes are halted, Save still succeeds,
|
|
168
173
|
its Change Batch waits unsent, and the queue is submitted in order once the
|
|
169
174
|
Provider reopens writes. An Action is never held: a write the Provider refuses
|
|
@@ -201,7 +206,7 @@ the network. Data lives only in the App Creator's browser and with the Provider.
|
|
|
201
206
|
App code imports only `@agentshouse/mdruntime/client` and calls
|
|
202
207
|
`connectMdRuntime` on the port the host hands it. It never constructs a
|
|
203
208
|
Runtime. It does not import the package main, the host entry, or the Adapter
|
|
204
|
-
package, and it does not call `
|
|
209
|
+
package, and it does not call `serveMdRuntime`. Hosts
|
|
205
210
|
and tests use those entries; the served App does not.
|
|
206
211
|
|
|
207
212
|
## What an agent must never do
|
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,EAad,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,OAAO,EACP,aAAa,EAad,MAAM,wBAAwB,CAAC;AAyChC,OAAO,EAQL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAuBxB,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;AAiCjC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CA2ZpF"}
|
package/dist/adapter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DISCOVER_PREFIXES,
|
|
1
|
+
import { DISCOVER_PREFIXES, capabilities, discoveredRoom, locatorOf, mapDiscovery, parseDiscovery, trackedFrom, } from './discovery.js';
|
|
2
2
|
import { MODEL_ABSENT, failedModel, heldModel, modelKey, modelShelf, } from './model.js';
|
|
3
3
|
import { gathered, selections } from './gather.js';
|
|
4
4
|
import { createSiteAdapter } from './site.js';
|
|
@@ -7,7 +7,7 @@ import { enumeratedLinks, scopeLinks, streamedLinks } from './links.js';
|
|
|
7
7
|
import { houseAction } from './actions.js';
|
|
8
8
|
import { classifyDoor, 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, PRIVATE_LOCATOR, } from './transport.js';
|
|
11
11
|
import { batchPaths, deltaBody, deltaBytes, deltaDigest, historyOutcome, houseChanges, mutationOutcome, operationHead, rejectedMapping, revisionBody, uploadable, } from './write.js';
|
|
12
12
|
import { logPosition, presented, reachedVersion, roomVersion, } from './version.js';
|
|
13
13
|
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
@@ -29,18 +29,26 @@ export function createAgentsHouseAdapter(options) {
|
|
|
29
29
|
const tracked = new Map();
|
|
30
30
|
const handed = new Map();
|
|
31
31
|
const models = modelShelf();
|
|
32
|
+
let bounds;
|
|
33
|
+
function declared() {
|
|
34
|
+
if (bounds === undefined)
|
|
35
|
+
throw new Error('no Discovery declared the bounds');
|
|
36
|
+
return bounds;
|
|
37
|
+
}
|
|
32
38
|
function bootstrappedRoom(envelope, entry) {
|
|
33
39
|
const scope = envelope.scopes.find((candidate) => matchesScope(candidate, entry));
|
|
34
40
|
if (scope === undefined)
|
|
35
41
|
return { kind: 'room-not-readable', locator: entry.locator };
|
|
36
42
|
handed.set(entry.locator, scopeLinks(scope));
|
|
37
|
-
|
|
43
|
+
notifications.hold(entry.authority, scope);
|
|
44
|
+
return bootstrapOf(scope);
|
|
38
45
|
}
|
|
39
46
|
function enumeratedRoom(enumeration, ask) {
|
|
40
47
|
const view = viewOf(enumeration, ask.entry);
|
|
41
48
|
if (view === undefined)
|
|
42
49
|
return { kind: 'room-not-readable', locator: ask.entry.locator };
|
|
43
|
-
|
|
50
|
+
notifications.hold(ask.entry.authority, view);
|
|
51
|
+
const answer = refreshFrom(view, ask.fromRoomVersion);
|
|
44
52
|
if (answer.kind === 'net-advancement') {
|
|
45
53
|
handed.set(ask.entry.locator, enumeratedLinks(view, handed.get(ask.entry.locator)));
|
|
46
54
|
}
|
|
@@ -50,7 +58,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
50
58
|
const links = handed.get(entry.locator);
|
|
51
59
|
if (links?.roomVersion !== request.fromRoomVersion)
|
|
52
60
|
return null;
|
|
53
|
-
const advanced = notifications.advance(entry, from);
|
|
61
|
+
const advanced = notifications.advance(entry, from, (path, revision) => links.revisions.get(path) === revision);
|
|
54
62
|
if (advanced === null)
|
|
55
63
|
return null;
|
|
56
64
|
if (request.minPosition !== undefined &&
|
|
@@ -70,8 +78,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
70
78
|
}
|
|
71
79
|
async function acquireModels(entries) {
|
|
72
80
|
const acquired = new Map();
|
|
73
|
-
for (const part of selections(entries, (entry) => modelPrefixes(entry).length,
|
|
74
|
-
const privateEntry = part.find((entry) => entry.locator === PRIVATE_LOCATOR);
|
|
81
|
+
for (const part of selections(entries, (entry) => modelPrefixes(entry).length, declared().max_prefixes)) {
|
|
75
82
|
const answer = await transport.door(DOOR_BOOTSTRAP, {
|
|
76
83
|
prefixes: part.flatMap((entry) => modelPrefixes(entry)),
|
|
77
84
|
});
|
|
@@ -80,9 +87,9 @@ export function createAgentsHouseAdapter(options) {
|
|
|
80
87
|
const failure = modelFailure(classified, envelope);
|
|
81
88
|
for (const entry of part) {
|
|
82
89
|
acquired.set(modelKey(entry.locator, 'collection'), await held(envelope, entry, entry.schema, failure));
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
acquired.set(modelKey(
|
|
90
|
+
if (entry.houseModel === null)
|
|
91
|
+
continue;
|
|
92
|
+
acquired.set(modelKey(entry.locator, 'typed-selection'), await held(envelope, entry, entry.houseModel.root, failure));
|
|
86
93
|
}
|
|
87
94
|
}
|
|
88
95
|
return acquired;
|
|
@@ -91,11 +98,10 @@ export function createAgentsHouseAdapter(options) {
|
|
|
91
98
|
const locator = locatorOf(authority);
|
|
92
99
|
const key = modelKey(locator, 'collection');
|
|
93
100
|
const collection = models.retain(key, acquired.get(key));
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return discoveredRoom(authority, collection?.identity ?? null, providerSelection(selection?.identity ?? null));
|
|
101
|
+
const selection = authority.houseModel === null
|
|
102
|
+
? undefined
|
|
103
|
+
: models.retain(modelKey(locator, 'typed-selection'), acquired.get(modelKey(locator, 'typed-selection')));
|
|
104
|
+
return discoveredRoom(authority, collection?.identity ?? null, selection?.identity ?? null);
|
|
99
105
|
}
|
|
100
106
|
function authorityFor(locator) {
|
|
101
107
|
return tracked.get(locator);
|
|
@@ -135,7 +141,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
135
141
|
}
|
|
136
142
|
async function bootstrapped(entries) {
|
|
137
143
|
const answers = [];
|
|
138
|
-
for (const part of selections(entries, weight,
|
|
144
|
+
for (const part of selections(entries, weight, declared().max_prefixes)) {
|
|
139
145
|
const answer = await transport.door(DOOR_BOOTSTRAP, {
|
|
140
146
|
prefixes: part.flatMap((entry) => contentPrefixes(entry)),
|
|
141
147
|
});
|
|
@@ -164,7 +170,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
164
170
|
}
|
|
165
171
|
async function enumerated(asks) {
|
|
166
172
|
const answers = new Map();
|
|
167
|
-
const parts = layered(asks).flatMap((layer) => selections(layer, (ask) => weight(ask.entry),
|
|
173
|
+
const parts = layered(asks).flatMap((layer) => selections(layer, (ask) => weight(ask.entry), declared().max_prefixes));
|
|
168
174
|
for (const part of parts) {
|
|
169
175
|
let open = [...part];
|
|
170
176
|
while (open.length > 0) {
|
|
@@ -179,8 +185,11 @@ export function createAgentsHouseAdapter(options) {
|
|
|
179
185
|
if (refusal?.code === 'replica_behind') {
|
|
180
186
|
const named = open.filter((ask) => ask.entry.authority === refusal.fields.authority);
|
|
181
187
|
const behind = named.length === 0 ? open : named;
|
|
182
|
-
for (const ask of behind)
|
|
183
|
-
answers.set(ask,
|
|
188
|
+
for (const ask of behind) {
|
|
189
|
+
answers.set(ask, refusal.retryable
|
|
190
|
+
? { kind: 'retryable-refusal', code: refusal.code, fields: refusal.fields }
|
|
191
|
+
: (classifyDoor(answer.status, answer.body, ask.entry.locator) ?? UNCERTAIN_READ));
|
|
192
|
+
}
|
|
184
193
|
open = open.filter((ask) => !behind.includes(ask));
|
|
185
194
|
continue;
|
|
186
195
|
}
|
|
@@ -241,9 +250,10 @@ export function createAgentsHouseAdapter(options) {
|
|
|
241
250
|
return { body: { ...head, paths, upload } };
|
|
242
251
|
}
|
|
243
252
|
async function submit(head, changes, delta, bytes, entry, handed, keep) {
|
|
244
|
-
const
|
|
253
|
+
const inline = { ...head, changes };
|
|
254
|
+
const prepared = uploadable(inline, bytes, declared())
|
|
245
255
|
? await uploaded(head, changes, delta, bytes, entry, handed, keep)
|
|
246
|
-
: { body:
|
|
256
|
+
: { body: inline };
|
|
247
257
|
if ('outcome' in prepared)
|
|
248
258
|
return prepared.outcome;
|
|
249
259
|
const answer = await transport.door(DOOR_BATCH, prepared.body);
|
|
@@ -264,6 +274,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
264
274
|
const document = parseDiscovery(answer.body);
|
|
265
275
|
if (document === null)
|
|
266
276
|
return { kind: 'transport-uncertainty' };
|
|
277
|
+
bounds = document.bounds;
|
|
267
278
|
const entries = trackedFrom(document);
|
|
268
279
|
tracked.clear();
|
|
269
280
|
for (const entry of entries)
|
package/dist/discovery.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Capability, DiscoveredRoom, Discovery, ProviderLimit, Retention
|
|
1
|
+
import type { Capability, DiscoveredRoom, Discovery, ModelIdentity, ProviderLimit, Retention } from '@agentshouse/mdruntime';
|
|
2
2
|
import { type LogPosition } from './version.js';
|
|
3
3
|
export declare const ROOM_CONTRACT_VERSION = 1;
|
|
4
4
|
export declare const MD_MODEL_IDENTITY = "@agentshouse/mdmodel";
|
|
@@ -6,10 +6,6 @@ export declare const ROOM_VERSION_NOTIFICATIONS = "room-version-notifications";
|
|
|
6
6
|
export declare const PROVIDER_ACTIONS = "provider-actions";
|
|
7
7
|
export declare const MOVE_REFERENCE_REWRITES = "move-reference-rewrites";
|
|
8
8
|
export declare const DISCOVER_PREFIXES: readonly string[];
|
|
9
|
-
export declare const PROVIDER_SELECTION_ROOTS: readonly string[];
|
|
10
|
-
export declare const UNTYPED_FOLDERS: readonly string[];
|
|
11
|
-
export declare const RESERVED_NAMES: readonly string[];
|
|
12
|
-
export declare const HOUSE_SCHEMA = "house/schema.yaml";
|
|
13
9
|
export declare const PRIVATE_HANDLE = "private";
|
|
14
10
|
export type HouseBounds = {
|
|
15
11
|
max_authored_file_bytes: number;
|
|
@@ -19,6 +15,9 @@ export type HouseBounds = {
|
|
|
19
15
|
max_path_depth: number;
|
|
20
16
|
max_mount_files: number;
|
|
21
17
|
max_mount_bytes: number;
|
|
18
|
+
max_inline_body_bytes: number;
|
|
19
|
+
max_upload_bytes: number;
|
|
20
|
+
max_prefixes: number;
|
|
22
21
|
change_retention_seconds: number;
|
|
23
22
|
operation_retention_seconds: number;
|
|
24
23
|
};
|
|
@@ -28,11 +27,16 @@ export type HouseOperations = {
|
|
|
28
27
|
write: readonly string[];
|
|
29
28
|
delete: readonly string[];
|
|
30
29
|
};
|
|
30
|
+
export type HouseModel = {
|
|
31
|
+
root: string;
|
|
32
|
+
paths: readonly string[];
|
|
33
|
+
};
|
|
31
34
|
export type HouseAuthority = LogPosition & {
|
|
32
35
|
roomRef: string;
|
|
33
36
|
roomHandle: string;
|
|
34
37
|
name: string;
|
|
35
38
|
schema: string;
|
|
39
|
+
houseModel: HouseModel | null;
|
|
36
40
|
managedReplication: 'admitted' | 'unavailable';
|
|
37
41
|
protectedPaths: readonly string[];
|
|
38
42
|
operations: HouseOperations;
|
|
@@ -48,16 +52,9 @@ export type TrackedAuthority = LogPosition & {
|
|
|
48
52
|
authority: string;
|
|
49
53
|
handle: string;
|
|
50
54
|
schema: string;
|
|
55
|
+
houseModel: HouseModel | null;
|
|
51
56
|
schemas: readonly string[];
|
|
52
57
|
};
|
|
53
|
-
export type HouseSiteEntry = {
|
|
54
|
-
roomRef: string;
|
|
55
|
-
segment: string;
|
|
56
|
-
};
|
|
57
|
-
export type HouseSiteSlot = {
|
|
58
|
-
slot: string;
|
|
59
|
-
entries: readonly HouseSiteEntry[];
|
|
60
|
-
};
|
|
61
58
|
export type HouseSiteAuthority = LogPosition & {
|
|
62
59
|
roomRef: string;
|
|
63
60
|
roomHandle: string;
|
|
@@ -66,20 +63,17 @@ export type HouseSiteAuthority = LogPosition & {
|
|
|
66
63
|
export type HouseSiteDiscovery = {
|
|
67
64
|
bounds: HouseBounds;
|
|
68
65
|
mdModelVersion: string;
|
|
69
|
-
slots: readonly HouseSiteSlot[];
|
|
70
66
|
authorities: readonly HouseSiteAuthority[];
|
|
71
67
|
};
|
|
72
68
|
export declare function parseDiscovery(body: unknown): HouseDiscoveryDocument | null;
|
|
73
69
|
export declare function parseSiteDiscovery(body: unknown): HouseSiteDiscovery | null;
|
|
74
70
|
export declare function siteTracked(document: HouseSiteDiscovery): TrackedAuthority[];
|
|
75
|
-
export declare function siteSlots(document: HouseSiteDiscovery): Discovery['slots'];
|
|
76
71
|
export declare function locatorOf(authority: HouseAuthority): string;
|
|
77
72
|
export declare function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[];
|
|
78
73
|
export declare function providerLimits(bounds: HouseBounds): readonly ProviderLimit[];
|
|
79
74
|
export declare function declaredRetention(bounds: HouseBounds): Retention;
|
|
80
75
|
export declare function capabilities(actions: readonly string[]): readonly Capability[];
|
|
81
76
|
export declare function siteCapabilities(): readonly Capability[];
|
|
82
|
-
export declare function
|
|
83
|
-
export declare function discoveredRoom(authority: HouseAuthority, attachedModel: DiscoveredRoom['attachedModel'], typedSelection: TypedSelection | undefined): DiscoveredRoom;
|
|
77
|
+
export declare function discoveredRoom(authority: HouseAuthority, attachedModel: DiscoveredRoom['attachedModel'], selectionModel: ModelIdentity | null): DiscoveredRoom;
|
|
84
78
|
export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds' | 'mdModelVersion'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
|
|
85
79
|
//# sourceMappingURL=discovery.d.ts.map
|
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,
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"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"}
|
package/dist/discovery.js
CHANGED
|
@@ -7,28 +7,6 @@ export const ROOM_VERSION_NOTIFICATIONS = 'room-version-notifications';
|
|
|
7
7
|
export const PROVIDER_ACTIONS = 'provider-actions';
|
|
8
8
|
export const MOVE_REFERENCE_REWRITES = 'move-reference-rewrites';
|
|
9
9
|
export const DISCOVER_PREFIXES = ['/'];
|
|
10
|
-
export const PROVIDER_SELECTION_ROOTS = [
|
|
11
|
-
'agents',
|
|
12
|
-
'collaboration/routines',
|
|
13
|
-
'house',
|
|
14
|
-
'settings/apps',
|
|
15
|
-
'settings/panel.md',
|
|
16
|
-
];
|
|
17
|
-
export const UNTYPED_FOLDERS = ['capture'];
|
|
18
|
-
export const RESERVED_NAMES = [
|
|
19
|
-
'ROOM.md',
|
|
20
|
-
'capture',
|
|
21
|
-
'settings',
|
|
22
|
-
'collaboration',
|
|
23
|
-
'rooms',
|
|
24
|
-
'agents',
|
|
25
|
-
'house',
|
|
26
|
-
'work',
|
|
27
|
-
'entities',
|
|
28
|
-
'schema',
|
|
29
|
-
'commitments',
|
|
30
|
-
];
|
|
31
|
-
export const HOUSE_SCHEMA = 'house/schema.yaml';
|
|
32
10
|
export const PRIVATE_HANDLE = 'private';
|
|
33
11
|
const BOUND_KEYS = [
|
|
34
12
|
'max_authored_file_bytes',
|
|
@@ -38,6 +16,9 @@ const BOUND_KEYS = [
|
|
|
38
16
|
'max_path_depth',
|
|
39
17
|
'max_mount_files',
|
|
40
18
|
'max_mount_bytes',
|
|
19
|
+
'max_inline_body_bytes',
|
|
20
|
+
'max_upload_bytes',
|
|
21
|
+
'max_prefixes',
|
|
41
22
|
'change_retention_seconds',
|
|
42
23
|
'operation_retention_seconds',
|
|
43
24
|
];
|
|
@@ -60,6 +41,17 @@ function parseBounds(value) {
|
|
|
60
41
|
}
|
|
61
42
|
return bounds;
|
|
62
43
|
}
|
|
44
|
+
function parseHouseModel(value) {
|
|
45
|
+
if (value === undefined)
|
|
46
|
+
return null;
|
|
47
|
+
if (typeof value !== 'object' || value === null)
|
|
48
|
+
return undefined;
|
|
49
|
+
const held = value;
|
|
50
|
+
const paths = stringList(held.paths);
|
|
51
|
+
if (typeof held.root !== 'string' || held.root.length === 0 || paths === null)
|
|
52
|
+
return undefined;
|
|
53
|
+
return { root: held.root, paths };
|
|
54
|
+
}
|
|
63
55
|
function parseOperations(value) {
|
|
64
56
|
if (typeof value !== 'object' || value === null)
|
|
65
57
|
return null;
|
|
@@ -87,9 +79,10 @@ function parseAuthority(value) {
|
|
|
87
79
|
return null;
|
|
88
80
|
}
|
|
89
81
|
const at = readPosition(held);
|
|
82
|
+
const houseModel = parseHouseModel(held.house_model);
|
|
90
83
|
const protectedPaths = stringList(held.protected_paths);
|
|
91
84
|
const operations = parseOperations(held.operations);
|
|
92
|
-
if (at === null || protectedPaths === null || operations === null)
|
|
85
|
+
if (at === null || houseModel === undefined || protectedPaths === null || operations === null)
|
|
93
86
|
return null;
|
|
94
87
|
if (typeof held.room_ref !== 'string' || held.room_ref.length === 0)
|
|
95
88
|
return null;
|
|
@@ -100,6 +93,7 @@ function parseAuthority(value) {
|
|
|
100
93
|
roomHandle: held.room_handle,
|
|
101
94
|
name: held.name,
|
|
102
95
|
schema: held.model_root,
|
|
96
|
+
houseModel,
|
|
103
97
|
managedReplication: held.managed_replication,
|
|
104
98
|
protectedPaths,
|
|
105
99
|
operations,
|
|
@@ -131,33 +125,6 @@ export function parseDiscovery(body) {
|
|
|
131
125
|
}
|
|
132
126
|
return { bounds, mdModelVersion: held.md_model_version, authorities, actions };
|
|
133
127
|
}
|
|
134
|
-
function parseSiteEntry(value) {
|
|
135
|
-
if (typeof value !== 'object' || value === null)
|
|
136
|
-
return null;
|
|
137
|
-
const held = value;
|
|
138
|
-
if (typeof held.room_ref !== 'string' || held.room_ref.length === 0)
|
|
139
|
-
return null;
|
|
140
|
-
if (typeof held.segment !== 'string' || held.segment.length === 0)
|
|
141
|
-
return null;
|
|
142
|
-
return { roomRef: held.room_ref, segment: held.segment };
|
|
143
|
-
}
|
|
144
|
-
function parseSiteSlot(value) {
|
|
145
|
-
if (typeof value !== 'object' || value === null)
|
|
146
|
-
return null;
|
|
147
|
-
const held = value;
|
|
148
|
-
if (typeof held.slot !== 'string' || held.slot.length === 0)
|
|
149
|
-
return null;
|
|
150
|
-
if (!Array.isArray(held.entries))
|
|
151
|
-
return null;
|
|
152
|
-
const entries = [];
|
|
153
|
-
for (const entry of held.entries) {
|
|
154
|
-
const parsed = parseSiteEntry(entry);
|
|
155
|
-
if (parsed === null)
|
|
156
|
-
return null;
|
|
157
|
-
entries.push(parsed);
|
|
158
|
-
}
|
|
159
|
-
return { slot: held.slot, entries };
|
|
160
|
-
}
|
|
161
128
|
function parseSiteAuthority(value) {
|
|
162
129
|
if (typeof value !== 'object' || value === null)
|
|
163
130
|
return null;
|
|
@@ -189,15 +156,8 @@ export function parseSiteDiscovery(body) {
|
|
|
189
156
|
return null;
|
|
190
157
|
if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0)
|
|
191
158
|
return null;
|
|
192
|
-
if (!Array.isArray(held.
|
|
159
|
+
if (!Array.isArray(held.authorities))
|
|
193
160
|
return null;
|
|
194
|
-
const slots = [];
|
|
195
|
-
for (const entry of held.slots) {
|
|
196
|
-
const slot = parseSiteSlot(entry);
|
|
197
|
-
if (slot === null)
|
|
198
|
-
return null;
|
|
199
|
-
slots.push(slot);
|
|
200
|
-
}
|
|
201
161
|
const authorities = [];
|
|
202
162
|
for (const entry of held.authorities) {
|
|
203
163
|
const authority = parseSiteAuthority(entry);
|
|
@@ -205,7 +165,7 @@ export function parseSiteDiscovery(body) {
|
|
|
205
165
|
return null;
|
|
206
166
|
authorities.push(authority);
|
|
207
167
|
}
|
|
208
|
-
return { bounds, mdModelVersion: held.md_model_version,
|
|
168
|
+
return { bounds, mdModelVersion: held.md_model_version, authorities };
|
|
209
169
|
}
|
|
210
170
|
export function siteTracked(document) {
|
|
211
171
|
return document.authorities.map((authority) => ({
|
|
@@ -213,24 +173,19 @@ export function siteTracked(document) {
|
|
|
213
173
|
authority: authority.roomRef,
|
|
214
174
|
handle: authority.roomHandle,
|
|
215
175
|
schema: authority.schema,
|
|
176
|
+
houseModel: null,
|
|
216
177
|
schemas: [authority.schema],
|
|
217
178
|
position: authority.position,
|
|
218
179
|
logEpoch: authority.logEpoch,
|
|
219
180
|
}));
|
|
220
181
|
}
|
|
221
|
-
export function siteSlots(document) {
|
|
222
|
-
return document.slots.map(({ slot, entries }) => ({
|
|
223
|
-
slot,
|
|
224
|
-
entries: entries.map(({ roomRef, segment }) => ({ locator: roomRef, segment })),
|
|
225
|
-
}));
|
|
226
|
-
}
|
|
227
182
|
export function locatorOf(authority) {
|
|
228
183
|
return authority.roomHandle === PRIVATE_HANDLE ? PRIVATE_LOCATOR : authority.roomRef;
|
|
229
184
|
}
|
|
230
185
|
function schemasOf(authority) {
|
|
231
|
-
return authority.
|
|
232
|
-
? [authority.schema
|
|
233
|
-
: [authority.schema];
|
|
186
|
+
return authority.houseModel === null
|
|
187
|
+
? [authority.schema]
|
|
188
|
+
: [authority.schema, authority.houseModel.root];
|
|
234
189
|
}
|
|
235
190
|
export function trackedFrom(document) {
|
|
236
191
|
return document.authorities.map((authority) => ({
|
|
@@ -238,6 +193,7 @@ export function trackedFrom(document) {
|
|
|
238
193
|
authority: authority.roomRef,
|
|
239
194
|
handle: authority.roomHandle,
|
|
240
195
|
schema: authority.schema,
|
|
196
|
+
houseModel: authority.houseModel,
|
|
241
197
|
schemas: schemasOf(authority),
|
|
242
198
|
position: authority.position,
|
|
243
199
|
logEpoch: authority.logEpoch,
|
|
@@ -278,10 +234,7 @@ export function siteCapabilities() {
|
|
|
278
234
|
{ name: PROVIDER_ACTIONS, actions: [{ name: 'submit', inputShape: {}, resultKind: 'house' }] },
|
|
279
235
|
];
|
|
280
236
|
}
|
|
281
|
-
export function
|
|
282
|
-
return { roots: [...PROVIDER_SELECTION_ROOTS], attachedModel };
|
|
283
|
-
}
|
|
284
|
-
export function discoveredRoom(authority, attachedModel, typedSelection) {
|
|
237
|
+
export function discoveredRoom(authority, attachedModel, selectionModel) {
|
|
285
238
|
return {
|
|
286
239
|
name: authority.name,
|
|
287
240
|
locator: locatorOf(authority),
|
|
@@ -294,8 +247,14 @@ export function discoveredRoom(authority, attachedModel, typedSelection) {
|
|
|
294
247
|
},
|
|
295
248
|
replica: { selection: locatorOf(authority), admission: authority.managedReplication },
|
|
296
249
|
attachedModel,
|
|
297
|
-
...(
|
|
298
|
-
|
|
250
|
+
...(authority.houseModel === null
|
|
251
|
+
? {}
|
|
252
|
+
: {
|
|
253
|
+
typedSelection: {
|
|
254
|
+
roots: [...authority.houseModel.paths],
|
|
255
|
+
attachedModel: selectionModel,
|
|
256
|
+
},
|
|
257
|
+
}),
|
|
299
258
|
providerOwnedPaths: [...authority.protectedPaths, ...schemasOf(authority)],
|
|
300
259
|
};
|
|
301
260
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
|
-
export {
|
|
2
|
+
export { PRIVATE_LOCATOR } from './transport.js';
|
|
3
3
|
export type { HouseByteAct, HouseByteAnswer, HouseByteTransfer, HouseDoorAnswer, 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,
|
|
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,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,YAAY,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter } from './adapter.js';
|
|
2
|
-
export {
|
|
2
|
+
export { PRIVATE_LOCATOR } from './transport.js';
|
package/dist/links.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type RoomLinks = {
|
|
|
4
4
|
roomVersion: string;
|
|
5
5
|
handed: ReadonlySet<string>;
|
|
6
6
|
paths: ReadonlyMap<string, ReadonlySet<string>>;
|
|
7
|
+
revisions: ReadonlyMap<string, string>;
|
|
7
8
|
};
|
|
8
9
|
export declare function scopeLinks(scope: HouseScope): RoomLinks;
|
|
9
10
|
export declare function enumeratedLinks(view: HouseView, earlier: RoomLinks | undefined): RoomLinks;
|
package/dist/links.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAOvD,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAOvD,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAYF,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAWvD;AAOD,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAgB1F;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI,CAoB9F"}
|
package/dist/links.js
CHANGED
|
@@ -15,19 +15,34 @@ export function scopeLinks(scope) {
|
|
|
15
15
|
roomVersion: roomVersion(scope),
|
|
16
16
|
handed: handedOf(scope.attachments),
|
|
17
17
|
paths: new Map(scope.contents.map(({ path, content }) => [path, linkedBy(content)])),
|
|
18
|
+
revisions: new Map(scope.files.flatMap(({ path, revision }) => revision === undefined ? [] : [[path, revision]])),
|
|
18
19
|
};
|
|
19
20
|
}
|
|
21
|
+
function revised(revisions, path, revision) {
|
|
22
|
+
if (revision === undefined)
|
|
23
|
+
revisions.delete(path);
|
|
24
|
+
else
|
|
25
|
+
revisions.set(path, revision);
|
|
26
|
+
}
|
|
20
27
|
export function enumeratedLinks(view, earlier) {
|
|
21
28
|
const paths = new Map(earlier?.paths);
|
|
29
|
+
const revisions = new Map(earlier?.revisions);
|
|
22
30
|
for (const change of view.changes) {
|
|
23
31
|
paths.set(change.path, linkedBy('content' in change ? change.content : null));
|
|
32
|
+
revised(revisions, change.path, 'removed' in change
|
|
33
|
+
? undefined
|
|
34
|
+
: 'reference' in change
|
|
35
|
+
? change.reference.revision
|
|
36
|
+
: change.revision);
|
|
24
37
|
}
|
|
25
|
-
return { roomVersion: roomVersion(view), handed: handedOf(view.attachments), paths };
|
|
38
|
+
return { roomVersion: roomVersion(view), handed: handedOf(view.attachments), paths, revisions };
|
|
26
39
|
}
|
|
27
40
|
export function streamedLinks(held, advanced) {
|
|
28
41
|
const paths = new Map(held.paths);
|
|
42
|
+
const revisions = new Map(held.revisions);
|
|
29
43
|
const dropped = new Set();
|
|
30
44
|
for (const entry of advanced.entries) {
|
|
45
|
+
revised(revisions, entry.path, entry.kind === 'removed' ? undefined : entry.revision);
|
|
31
46
|
const text = entry.kind === 'removed' ? null : entry.text;
|
|
32
47
|
if (text === undefined)
|
|
33
48
|
return null;
|
|
@@ -47,5 +62,5 @@ export function streamedLinks(held, advanced) {
|
|
|
47
62
|
}
|
|
48
63
|
if (dropped.size > 0)
|
|
49
64
|
return null;
|
|
50
|
-
return { roomVersion: advanced.page.roomVersion, handed: held.handed, paths };
|
|
65
|
+
return { roomVersion: advanced.page.roomVersion, handed: held.handed, paths, revisions };
|
|
51
66
|
}
|