@agentshouse/mdruntime-adapter 0.1.0-c9f1e531ad7c8 → 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 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, Slots, Query, Search, Observe, Types, Room Draft, Save, History, Call, Reached, Log,
11
- storage loss, the reported persistence answer, deployment facts, Sync Status, the Service Mode,
12
- reauthorization, conversation, the chat draft, and Presentation State.
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 growing text and plan of the running turn, the open questions, the process
25
- state, the CLI's commands and options, and the latest `workingNote`. These live
26
- only in memory: the turn's accepted message replaces its growing text and plan,
27
- a working note is never part of a message, and none of them is stored or
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, Slots, Query, Search, Observe, Types, Room Draft, Save, and Reached never
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 `deploymentFacts()` and observe replacements with
57
- `observe('deployment-facts')`. Interpret the opaque value using the
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 growing text are never found. There are no phrases,
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, its queue and their outcomes with it.
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 outcome record, and a change that no
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. `outcome` answers
159
- the saved Change Batch's outcome, and `null` while it is Pending. Transport
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
- `serviceMode()` and `observe('service-mode')` answer the Provider's Service
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 `createMdRuntime` or `serveMdRuntime`. Hosts
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
@@ -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;AA0ChC,OAAO,EASL,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,CAkZpF"}
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, HOUSE_SCHEMA, capabilities, discoveredRoom, locatorOf, mapDiscovery, parseDiscovery, providerSelection, trackedFrom, } from './discovery.js';
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, DOOR_SELECTION_MAX, PRIVATE_LOCATOR, } from './transport.js';
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,20 +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);
38
- return bootstrapOf(scope, entry);
44
+ return bootstrapOf(scope);
39
45
  }
40
46
  function enumeratedRoom(enumeration, ask) {
41
47
  const view = viewOf(enumeration, ask.entry);
42
48
  if (view === undefined)
43
49
  return { kind: 'room-not-readable', locator: ask.entry.locator };
44
50
  notifications.hold(ask.entry.authority, view);
45
- const answer = refreshFrom(view, ask.entry, ask.fromRoomVersion);
51
+ const answer = refreshFrom(view, ask.fromRoomVersion);
46
52
  if (answer.kind === 'net-advancement') {
47
53
  handed.set(ask.entry.locator, enumeratedLinks(view, handed.get(ask.entry.locator)));
48
54
  }
@@ -72,8 +78,7 @@ export function createAgentsHouseAdapter(options) {
72
78
  }
73
79
  async function acquireModels(entries) {
74
80
  const acquired = new Map();
75
- for (const part of selections(entries, (entry) => modelPrefixes(entry).length, DOOR_SELECTION_MAX)) {
76
- const privateEntry = part.find((entry) => entry.locator === PRIVATE_LOCATOR);
81
+ for (const part of selections(entries, (entry) => modelPrefixes(entry).length, declared().max_prefixes)) {
77
82
  const answer = await transport.door(DOOR_BOOTSTRAP, {
78
83
  prefixes: part.flatMap((entry) => modelPrefixes(entry)),
79
84
  });
@@ -82,9 +87,9 @@ export function createAgentsHouseAdapter(options) {
82
87
  const failure = modelFailure(classified, envelope);
83
88
  for (const entry of part) {
84
89
  acquired.set(modelKey(entry.locator, 'collection'), await held(envelope, entry, entry.schema, failure));
85
- }
86
- if (privateEntry !== undefined) {
87
- acquired.set(modelKey(privateEntry.locator, 'typed-selection'), await held(envelope, privateEntry, HOUSE_SCHEMA, failure));
90
+ if (entry.houseModel === null)
91
+ continue;
92
+ acquired.set(modelKey(entry.locator, 'typed-selection'), await held(envelope, entry, entry.houseModel.root, failure));
88
93
  }
89
94
  }
90
95
  return acquired;
@@ -93,11 +98,10 @@ export function createAgentsHouseAdapter(options) {
93
98
  const locator = locatorOf(authority);
94
99
  const key = modelKey(locator, 'collection');
95
100
  const collection = models.retain(key, acquired.get(key));
96
- if (locator !== PRIVATE_LOCATOR) {
97
- return discoveredRoom(authority, collection?.identity ?? null, undefined);
98
- }
99
- const selection = models.retain(modelKey(locator, 'typed-selection'), acquired.get(modelKey(locator, 'typed-selection')));
100
- 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);
101
105
  }
102
106
  function authorityFor(locator) {
103
107
  return tracked.get(locator);
@@ -137,7 +141,7 @@ export function createAgentsHouseAdapter(options) {
137
141
  }
138
142
  async function bootstrapped(entries) {
139
143
  const answers = [];
140
- for (const part of selections(entries, weight, DOOR_SELECTION_MAX)) {
144
+ for (const part of selections(entries, weight, declared().max_prefixes)) {
141
145
  const answer = await transport.door(DOOR_BOOTSTRAP, {
142
146
  prefixes: part.flatMap((entry) => contentPrefixes(entry)),
143
147
  });
@@ -166,7 +170,7 @@ export function createAgentsHouseAdapter(options) {
166
170
  }
167
171
  async function enumerated(asks) {
168
172
  const answers = new Map();
169
- const parts = layered(asks).flatMap((layer) => selections(layer, (ask) => weight(ask.entry), DOOR_SELECTION_MAX));
173
+ const parts = layered(asks).flatMap((layer) => selections(layer, (ask) => weight(ask.entry), declared().max_prefixes));
170
174
  for (const part of parts) {
171
175
  let open = [...part];
172
176
  while (open.length > 0) {
@@ -181,8 +185,11 @@ export function createAgentsHouseAdapter(options) {
181
185
  if (refusal?.code === 'replica_behind') {
182
186
  const named = open.filter((ask) => ask.entry.authority === refusal.fields.authority);
183
187
  const behind = named.length === 0 ? open : named;
184
- for (const ask of behind)
185
- answers.set(ask, { kind: 'retryable-refusal', ...refusal });
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
+ }
186
193
  open = open.filter((ask) => !behind.includes(ask));
187
194
  continue;
188
195
  }
@@ -243,9 +250,10 @@ export function createAgentsHouseAdapter(options) {
243
250
  return { body: { ...head, paths, upload } };
244
251
  }
245
252
  async function submit(head, changes, delta, bytes, entry, handed, keep) {
246
- const prepared = uploadable(bytes)
253
+ const inline = { ...head, changes };
254
+ const prepared = uploadable(inline, bytes, declared())
247
255
  ? await uploaded(head, changes, delta, bytes, entry, handed, keep)
248
- : { body: { ...head, changes } };
256
+ : { body: inline };
249
257
  if ('outcome' in prepared)
250
258
  return prepared.outcome;
251
259
  const answer = await transport.door(DOOR_BATCH, prepared.body);
@@ -266,6 +274,7 @@ export function createAgentsHouseAdapter(options) {
266
274
  const document = parseDiscovery(answer.body);
267
275
  if (document === null)
268
276
  return { kind: 'transport-uncertainty' };
277
+ bounds = document.bounds;
269
278
  const entries = trackedFrom(document);
270
279
  tracked.clear();
271
280
  for (const entry of entries)
@@ -1,4 +1,4 @@
1
- import type { Capability, DiscoveredRoom, Discovery, ProviderLimit, Retention, TypedSelection } from '@agentshouse/mdruntime';
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 providerSelection(attachedModel: TypedSelection['attachedModel']): TypedSelection;
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
@@ -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,EACT,cAAc,EACf,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,eAAO,MAAM,iBAAiB,yBAAyB,CAAC;AAExD,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AAEvE,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAEjE,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAU,CAAC;AAE1D,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAMrD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAAgB,CAAC;AAE9D,eAAO,MAAM,cAAc,EAAE,SAAS,M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AAC,EAC9C,cAAc,EAAE,aAAa,GAAG,IAAI,GACnC,cAAc,CAuBhB;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,GAAG,gBAAgB,CAAC,EACnE,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAC9B,SAAS,CAUX"}
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.slots) || !Array.isArray(held.authorities))
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, slots, authorities };
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.roomHandle === PRIVATE_HANDLE
232
- ? [authority.schema, HOUSE_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 providerSelection(attachedModel) {
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
- ...(typedSelection === undefined ? {} : { typedSelection }),
298
- untypedFolders: [...UNTYPED_FOLDERS],
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 { nativePath, roomLocalPath } from './map.js';
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
@@ -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,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACrD,YAAY,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,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 { nativePath, roomLocalPath } from './map.js';
2
+ export { PRIVATE_LOCATOR } from './transport.js';
package/dist/read.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { BootstrapPage, RefreshResult, RoomAttachment } from '@agentshouse/mdruntime';
2
- import { type TrackedAuthority } from './discovery.js';
2
+ import type { TrackedAuthority } from './discovery.js';
3
3
  import type { HouseMode } from './transport.js';
4
4
  import { type LogPosition } from './version.js';
5
5
  export type HeadChange = BootstrapPage['changes'][string];
@@ -66,8 +66,7 @@ export declare function parseSiteBootstrap(body: unknown): HouseScope | null;
66
66
  export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
67
67
  export declare function advancedScope(scope: HouseScope, view: HouseView): HouseScope;
68
68
  export declare function matchesScope(scope: HouseScope, tracked: TrackedAuthority): boolean;
69
- export declare function selects(tracked: TrackedAuthority, path: string): boolean;
70
- export declare function bootstrapOf(scope: HouseScope, tracked: TrackedAuthority): BootstrapPage;
69
+ export declare function bootstrapOf(scope: HouseScope): BootstrapPage;
71
70
  export type HouseSchema = {
72
71
  schema: string | null;
73
72
  version: string | null;
@@ -75,5 +74,5 @@ export type HouseSchema = {
75
74
  export declare function schemaFrom(envelope: HouseEnvelope, tracked: TrackedAuthority, schema: string): HouseSchema | null;
76
75
  export declare function schemaOf(scope: HouseScope, schema: string): HouseSchema | null;
77
76
  export declare function viewOf(enumeration: HouseEnumeration, tracked: TrackedAuthority): HouseView | undefined;
78
- export declare function refreshFrom(view: HouseView, tracked: TrackedAuthority, fromRoomVersion: string): RefreshResult;
77
+ export declare function refreshFrom(view: HouseView, fromRoomVersion: string): RefreshResult;
79
78
  //# sourceMappingURL=read.d.ts.map
@@ -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,EAKL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AACxB,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,Q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TYPED_FOLDERS, PROVIDER_SELECTION_ROOTS, RESERVED_NAMES, } from './discovery.js';
2
1
  import { readPosition, roomVersion } from './version.js';
3
2
  export function authorityRoot(handle) {
4
3
  return `/rooms/${handle}`;
@@ -256,28 +255,13 @@ export function advancedScope(scope, view) {
256
255
  export function matchesScope(scope, tracked) {
257
256
  return scope.anchor === tracked.authority;
258
257
  }
259
- const ROOM_HOMES = ['ROOM.md', 'collaboration', ...UNTYPED_FOLDERS];
260
- function homes(tracked) {
261
- return tracked.handle === PRIVATE_HANDLE
262
- ? [...ROOM_HOMES, ...PROVIDER_SELECTION_ROOTS]
263
- : ROOM_HOMES;
264
- }
265
- export function selects(tracked, path) {
266
- if (tracked.schemas.includes(path))
267
- return false;
268
- const first = path.split('/', 1)[0].toLowerCase();
269
- return (!RESERVED_NAMES.some((name) => name.toLowerCase() === first) ||
270
- homes(tracked).some((home) => path === home || path.startsWith(`${home}/`)));
271
- }
272
- export function bootstrapOf(scope, tracked) {
258
+ export function bootstrapOf(scope) {
273
259
  const contents = new Map(scope.contents.map((entry) => [entry.path, entry.content]));
274
260
  const documents = {};
275
261
  const revisions = {};
276
262
  const changes = {};
277
263
  const binaryTargets = [];
278
264
  for (const file of scope.files) {
279
- if (!selects(tracked, file.path))
280
- continue;
281
265
  if (file.revision !== undefined)
282
266
  revisions[file.path] = file.revision;
283
267
  if (file.head !== undefined)
@@ -314,7 +298,7 @@ export function schemaOf(scope, schema) {
314
298
  export function viewOf(enumeration, tracked) {
315
299
  return enumeration.authorities.find((entry) => entry.authority === tracked.authority);
316
300
  }
317
- export function refreshFrom(view, tracked, fromRoomVersion) {
301
+ export function refreshFrom(view, fromRoomVersion) {
318
302
  if (roomVersion(view) === fromRoomVersion)
319
303
  return { kind: 'still-current' };
320
304
  const documents = {};
@@ -323,8 +307,6 @@ export function refreshFrom(view, tracked, fromRoomVersion) {
323
307
  const binaryTargets = [];
324
308
  const removals = [];
325
309
  for (const change of view.changes) {
326
- if (!selects(tracked, change.path))
327
- continue;
328
310
  if ('removed' in change) {
329
311
  removals.push(change.path);
330
312
  continue;
package/dist/refusal.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { AdapterFailure, DiscoverResult, ProviderRefusal, ScopedRefusal } from '@agentshouse/mdruntime';
2
- export type DoorRefusal = ProviderRefusal;
2
+ export type DoorRefusal = ProviderRefusal & {
3
+ retryable: boolean;
4
+ };
3
5
  export declare function doorRefusal(body: unknown): DoorRefusal | null;
4
6
  export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: DoorRefusal): ScopedRefusal;
5
7
  export declare function classifyDoor(status: number, body: unknown, locator: string): AdapterFailure | {
@@ -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,CAAC;AAE1C,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;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,CAepD;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GACtD,cAAc,CAMhB"}
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;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,CAapD;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GACtD,cAAc,CAMhB"}
package/dist/refusal.js CHANGED
@@ -1,15 +1,3 @@
1
- const RETRYABLE_CODES = new Set([
2
- 'auth_unavailable',
3
- 'replica_behind',
4
- 'read_replica_unavailable',
5
- 'read_replica_lagging',
6
- 'read_pool_acquisition_timed_out',
7
- 'sync_unavailable',
8
- 'sync_failed',
9
- 'rate_limited',
10
- 'operation_contended',
11
- 'transaction_budget_exceeded',
12
- ]);
13
1
  export function doorRefusal(body) {
14
2
  if (typeof body !== 'object' || body === null)
15
3
  return null;
@@ -19,7 +7,7 @@ export function doorRefusal(body) {
19
7
  if (typeof error.code !== 'string')
20
8
  return null;
21
9
  const { code, ...fields } = error;
22
- return { code, fields };
10
+ return { code, fields, retryable: error.retryable === true };
23
11
  }
24
12
  export function scopedRefusal(locator, scope, refusal) {
25
13
  return { kind: 'scoped-refusal', locator, scope, code: refusal.code, fields: refusal.fields };
@@ -30,15 +18,13 @@ export function classifyDoor(status, body, locator) {
30
18
  const refusal = doorRefusal(body);
31
19
  if (status === 401)
32
20
  return { kind: 'revoked-authorization' };
33
- if (refusal !== null && RETRYABLE_CODES.has(refusal.code))
21
+ if (refusal?.retryable === true)
34
22
  return { kind: 'transport-uncertainty' };
35
23
  if (refusal !== null && refusal.code === 'position_expired')
36
24
  return { kind: 'beyond-horizon' };
37
25
  if (status === 404 || refusal?.code === 'room_not_found') {
38
26
  return { kind: 'room-not-readable', locator };
39
27
  }
40
- if (status >= 500)
41
- return { kind: 'transport-uncertainty' };
42
28
  if (status < 400)
43
29
  return null;
44
30
  if (refusal === null)
@@ -1 +1 @@
1
- {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAQR,MAAM,wBAAwB,CAAC;AAiChC,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAuCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAqKxE"}
1
+ {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAQR,MAAM,wBAAwB,CAAC;AA+BhC,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAsCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAuKxE"}
package/dist/site.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { actionOutcome } from './actions.js';
2
- import { UNTYPED_FOLDERS, mapDiscovery, parseSiteDiscovery, siteCapabilities, siteSlots, siteTracked, } from './discovery.js';
2
+ import { mapDiscovery, parseSiteDiscovery, siteCapabilities, siteTracked, } from './discovery.js';
3
3
  import { MODEL_ABSENT, failedModel, heldModel, modelKey, modelShelf, } from './model.js';
4
4
  import { advancedScope, bootstrapOf, parseEnumeration, parseSiteBootstrap, refreshFrom, schemaOf, schemaPath, viewOf, } from './read.js';
5
5
  import { classifyDoor, discoveryFailure, doorRefusal } from './refusal.js';
@@ -15,7 +15,6 @@ function siteRoom(tracked, attachedModel) {
15
15
  operations: { read: [''], sync: [''], write: [], delete: [] },
16
16
  replica: { selection: tracked.locator, admission: 'admitted' },
17
17
  attachedModel,
18
- untypedFolders: [...UNTYPED_FOLDERS],
19
18
  providerOwnedPaths: [],
20
19
  };
21
20
  }
@@ -35,8 +34,9 @@ export function createSiteAdapter(transport) {
35
34
  positions: [presented(entry.authority, from)],
36
35
  });
37
36
  const behind = doorRefusal(answer.body);
38
- if (behind?.code === 'replica_behind')
39
- return { kind: 'retryable-refusal', ...behind };
37
+ if (behind?.code === 'replica_behind' && behind.retryable) {
38
+ return { kind: 'retryable-refusal', code: behind.code, fields: behind.fields };
39
+ }
40
40
  const classified = classifyDoor(answer.status, answer.body, entry.locator);
41
41
  if (classified !== null)
42
42
  return classified;
@@ -74,7 +74,7 @@ export function createSiteAdapter(transport) {
74
74
  if (view === undefined)
75
75
  return { kind: 'room-not-readable', locator: entry.locator };
76
76
  notifications.hold(entry.authority, view);
77
- return refreshFrom(view, entry, fromRoomVersion);
77
+ return refreshFrom(view, fromRoomVersion);
78
78
  }
79
79
  async function acquire(entry, held) {
80
80
  if ('failure' in held)
@@ -126,7 +126,7 @@ export function createSiteAdapter(transport) {
126
126
  return siteRoom(entry, shelved?.identity ?? null);
127
127
  });
128
128
  models.keep(entries.map((entry) => entry.locator));
129
- return { ...mapDiscovery(document, rooms, siteCapabilities()), slots: siteSlots(document) };
129
+ return mapDiscovery(document, rooms, siteCapabilities());
130
130
  },
131
131
  async bootstrap(_authorization, request) {
132
132
  const entry = tracked.get(request.locator);
@@ -138,7 +138,7 @@ export function createSiteAdapter(transport) {
138
138
  if ('failure' in held)
139
139
  return held.failure;
140
140
  notifications.hold(entry.authority, held.scope);
141
- return bootstrapOf(held.scope, entry);
141
+ return bootstrapOf(held.scope);
142
142
  },
143
143
  async refresh(_authorization, request) {
144
144
  const entry = tracked.get(request.locator);
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","s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K,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAoB,MAAM,gBAAgB,CAAC;AAC/F,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;CACtC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtD,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/C,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;AAYF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,kBAAkB,CA2P5F"}
package/dist/stream.js CHANGED
@@ -1,7 +1,11 @@
1
1
  import { acceptedMessage } from './actions.js';
2
- import { headChange, selects } from './read.js';
2
+ import { headChange } from './read.js';
3
3
  import { roomVersion } from './version.js';
4
4
  const HELD_FRAMES_MAX = 256;
5
+ function turnOperation(frame) {
6
+ const { type: _type, conversation_id: _conversation, turn_id: _turn, ...operation } = frame;
7
+ return structuredClone(operation);
8
+ }
5
9
  function position(value) {
6
10
  if (!/^(?:0|[1-9][0-9]*)$/.test(value))
7
11
  return null;
@@ -17,7 +21,6 @@ export function houseNotifications(transport, mode) {
17
21
  const modeObservers = new Set();
18
22
  let replicated = [];
19
23
  const live = new Set();
20
- const noted = new Set();
21
24
  let listening = false;
22
25
  let catching = false;
23
26
  function listen() {
@@ -32,42 +35,20 @@ export function houseNotifications(transport, mode) {
32
35
  for (const observer of conversationObservers)
33
36
  observer(event);
34
37
  }
35
- function unnote(conversation) {
36
- if (!noted.delete(conversation))
37
- return;
38
- emitConversation({ kind: 'working-note', conversation, note: null });
39
- }
40
38
  function reopened() {
41
39
  const gapped = new Set([...replicated, ...live]);
42
40
  live.clear();
43
- noted.clear();
44
41
  for (const conversation of gapped)
45
42
  emitConversation({ kind: 'gap', conversation });
46
43
  }
47
44
  function converse(frame) {
48
45
  const conversation = frame.conversation_id;
49
- if (frame.type === 'draft') {
50
- unnote(conversation);
51
- emitConversation({
52
- kind: 'growing-text',
53
- conversation,
54
- turn: frame.turn_id,
55
- text: frame.text,
56
- });
46
+ if (frame.type === 'turn') {
57
47
  emitConversation({
58
- kind: 'plan',
48
+ kind: 'turn',
59
49
  conversation,
60
50
  turn: frame.turn_id,
61
- plan: structuredClone(frame.steps),
62
- });
63
- return;
64
- }
65
- if (frame.type === 'working-note') {
66
- noted.add(conversation);
67
- emitConversation({
68
- kind: 'working-note',
69
- conversation,
70
- note: { noteId: frame.note_id, text: frame.text },
51
+ operation: turnOperation(frame),
71
52
  });
72
53
  return;
73
54
  }
@@ -77,7 +58,6 @@ export function houseNotifications(transport, mode) {
77
58
  return;
78
59
  emitConversation({ kind: 'commands', conversation, commands: [] });
79
60
  emitConversation({ kind: 'options', conversation, options: [] });
80
- unnote(conversation);
81
61
  return;
82
62
  }
83
63
  if (frame.type === 'commands') {
@@ -104,9 +84,6 @@ export function houseNotifications(transport, mode) {
104
84
  if (message === null)
105
85
  return;
106
86
  emitConversation({ kind: 'accepted-message', conversation, message });
107
- if (frame.message.role === 'user')
108
- return;
109
- unnote(conversation);
110
87
  }
111
88
  function announce(authority, at, modelChanged) {
112
89
  const version = roomVersion(at);
@@ -132,8 +109,7 @@ export function houseNotifications(transport, mode) {
132
109
  observer(mode);
133
110
  return;
134
111
  }
135
- if (frame.type === 'draft' ||
136
- frame.type === 'working-note' ||
112
+ if (frame.type === 'turn' ||
137
113
  frame.type === 'process' ||
138
114
  frame.type === 'commands' ||
139
115
  frame.type === 'options' ||
@@ -255,8 +231,6 @@ export function houseNotifications(transport, mode) {
255
231
  continue;
256
232
  }
257
233
  applied.push(entry);
258
- if (!selects(tracked, entry.path))
259
- continue;
260
234
  if (entry.kind === 'removed') {
261
235
  forget(entry.path);
262
236
  removals.push(entry.path);
@@ -1,4 +1,4 @@
1
- import type { ConversationEvent } from '@agentshouse/mdruntime';
1
+ import type { ConversationEvent, TurnOperation } from '@agentshouse/mdruntime';
2
2
  export declare const DOOR_DISCOVER = "/door/discover";
3
3
  export declare const DOOR_BOOTSTRAP = "/door/bootstrap";
4
4
  export declare const DOOR_ENUMERATE = "/door/enumerate";
@@ -10,7 +10,6 @@ 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
12
  export declare const PRIVATE_LOCATOR = "private";
13
- export declare const DOOR_SELECTION_MAX = 256;
14
13
  export type HouseMode = 'credential' | 'site';
15
14
  export type HouseDoorAnswer = {
16
15
  status: number;
@@ -51,14 +50,11 @@ export type HouseStreamFrame = {
51
50
  position: string;
52
51
  log_epoch: string;
53
52
  entries: readonly HouseStreamEntry[];
54
- } | {
55
- type: 'draft';
53
+ } | ({
54
+ type: 'turn';
56
55
  conversation_id: string;
57
56
  turn_id: string;
58
- text: string;
59
- blocks: readonly unknown[];
60
- steps: LiveFact<'plan'>['plan'];
61
- } | {
57
+ } & TurnOperation) | {
62
58
  type: 'message';
63
59
  conversation_id: string;
64
60
  message: unknown;
@@ -66,11 +62,6 @@ export type HouseStreamFrame = {
66
62
  type: 'interactions';
67
63
  conversation_id: string;
68
64
  interactions: readonly unknown[];
69
- } | {
70
- type: 'working-note';
71
- conversation_id: string;
72
- note_id: string;
73
- text: string;
74
65
  } | {
75
66
  type: 'process';
76
67
  conversation_id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,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,eAAO,MAAM,eAAe,YAAY,CAAC;AAEzC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,mBAAmB,GACnB,uBAAuB,GACvB,8BAA8B,GAC9B,iBAAiB,GACjB,mBAAmB,CAAC;AAExB,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,CAAC;AAE9D,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,YAAY,CAAC;IAClB,MAAM,E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@@ 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
11
  export const PRIVATE_LOCATOR = 'private';
12
- export const DOOR_SELECTION_MAX = 256;
package/dist/write.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import type { ChangeBatch, HistoryResult, MutationResult } from '@agentshouse/mdruntime';
2
- export declare const INLINE_BODY_LIMIT_BYTES: number;
3
- export declare const UPLOAD_LINE_BYTES = 37;
4
- export declare const UPLOAD_BYTES_MAX: number;
2
+ import type { HouseBounds } from './discovery.js';
5
3
  export type HouseOperation = Readonly<Record<string, unknown>>;
6
4
  export type ChangeMapping = {
7
5
  kind: 'changes';
@@ -21,7 +19,7 @@ export declare function operationHead(batch: ChangeBatch): OperationHead;
21
19
  export declare function batchPaths(changes: readonly HouseOperation[]): readonly string[];
22
20
  export declare function deltaBody(changes: readonly HouseOperation[]): string;
23
21
  export declare function deltaBytes(delta: string): number;
24
- export declare function uploadable(bytes: number): boolean;
22
+ export declare function uploadable(inline: Readonly<Record<string, unknown>>, bytes: number, bounds: Pick<HouseBounds, 'max_inline_body_bytes' | 'max_upload_bytes'>): boolean;
25
23
  export declare function deltaDigest(delta: string): Promise<string>;
26
24
  export declare function mutationOutcome(status: number, body: unknown, locator: string, handle: string): MutationResult;
27
25
  export declare function rejectedMapping(mapping: Extract<ChangeMapping, {
@@ -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,EAEf,MAAM,wBAAwB,CAAC;AAMhC,eAAO,MAAM,uBAAuB,QAAkB,CAAC;AAEvD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,eAAO,MAAM,gBAAgB,QAAuC,CAAC;AAErE,MAAM,MAAM,cAAc,GAAG,QAAQ,C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AE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,aAAa,CAiDf"}
package/dist/write.js CHANGED
@@ -2,9 +2,6 @@ import { sha256Hex, textBytes } from './digest.js';
2
2
  import { nativePath, roomLocalPath } from './map.js';
3
3
  import { classifyDoor, doorRefusal, scopedRefusal } from './refusal.js';
4
4
  import { readPosition, roomVersion } from './version.js';
5
- export const INLINE_BODY_LIMIT_BYTES = 4 * 1024 * 1024;
6
- export const UPLOAD_LINE_BYTES = 37;
7
- export const UPLOAD_BYTES_MAX = 32 * 1024 * 1024 - UPLOAD_LINE_BYTES;
8
5
  function priorField(batch, path, name) {
9
6
  return batch.preconditions.find((precondition) => precondition.kind === 'field' && precondition.path === path && precondition.name === name);
10
7
  }
@@ -119,8 +116,9 @@ export function deltaBody(changes) {
119
116
  export function deltaBytes(delta) {
120
117
  return textBytes(delta);
121
118
  }
122
- export function uploadable(bytes) {
123
- return bytes > INLINE_BODY_LIMIT_BYTES && bytes <= UPLOAD_BYTES_MAX;
119
+ export function uploadable(inline, bytes, bounds) {
120
+ return (textBytes(JSON.stringify(inline)) > bounds.max_inline_body_bytes &&
121
+ bytes <= bounds.max_upload_bytes);
124
122
  }
125
123
  export function deltaDigest(delta) {
126
124
  return sha256Hex(delta);
@@ -167,15 +165,6 @@ export function mutationOutcome(status, body, locator, handle) {
167
165
  if (refusal !== null && refusal.code === 'service_mode_write_halted') {
168
166
  return { kind: 'write-halted' };
169
167
  }
170
- if (refusal !== null && refusal.code === 'rate_limited') {
171
- const reset = refusal.fields.retry_at;
172
- return {
173
- kind: 'retryable-refusal',
174
- code: refusal.code,
175
- fields: refusal.fields,
176
- ...(typeof reset === 'string' ? { reset } : {}),
177
- };
178
- }
179
168
  if (refusal !== null && refusal.code === 'operation_expired')
180
169
  return { kind: 'expired' };
181
170
  if (refusal !== null && refusal.code === 'edit_conflict') {
@@ -187,6 +176,12 @@ export function mutationOutcome(status, body, locator, handle) {
187
176
  return scopedRefusal(locator, 'undisclosed', refusal);
188
177
  }
189
178
  const classified = classifyDoor(status, body, locator);
179
+ const reset = refusal?.fields.retry_at;
180
+ if (refusal?.retryable === true &&
181
+ typeof reset === 'string' &&
182
+ classified?.kind === 'transport-uncertainty') {
183
+ return { kind: 'retryable-refusal', code: refusal.code, fields: refusal.fields, reset };
184
+ }
190
185
  if (classified !== null && classified.kind !== 'scoped-refusal') {
191
186
  return classified.kind === 'beyond-horizon' ? { kind: 'expired' } : classified;
192
187
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime-adapter",
3
- "version": "0.1.0-c9f1e531ad7c8",
3
+ "version": "0.1.0-cc63dd043d0e2",
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-c83456e1cebfb",
29
- "@agentshouse/mdruntime": "0.1.0-c436a939f2119"
28
+ "@agentshouse/mdmodel": "0.1.0-c6b0c6dc1a195",
29
+ "@agentshouse/mdruntime": "0.1.0-cc7bd7a53214e"
30
30
  }
31
31
  }