@agentshouse/mdruntime-adapter 0.1.0-c26cd225263b7 → 0.1.0-c38756ee6ced5

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
@@ -13,10 +13,11 @@ and Presentation State. Sync Status, the Service Mode, the storage-loss
13
13
  statement and the deployment facts are observations only.
14
14
 
15
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.
16
+ answers within it: a Room outside it answers as one the replica does not hold,
17
+ Rooms lists only the Rooms reached whole, a Room reached for single Documents
18
+ shows only those Documents and the Types of the models that govern them, and
19
+ without conversations the conversation members, the chat draft and the
20
+ conversation observation hold none.
20
21
  A change of the reach reaches every open observation as its new value, a query
21
22
  keeping every unchanged Document the same object.
22
23
 
@@ -26,7 +27,11 @@ value whole and returns its unsubscribe, and `close()` ends the observation.
26
27
  Closing the port ends every handle and rejects every pending call and
27
28
  observation; a client that reconnects observes again.
28
29
 
29
- Each conversation a Provider card names is held complete in the browser.
30
+ Each conversation the Provider's conversation list names is held complete in the
31
+ browser. `conversation.list()` and `observe('conversations')` answer each with its
32
+ Agent's identity and name, its name, created and finished times, last outcome and live
33
+ `state`: `asking` while a question waits, `working` while a turn runs, else `idle`,
34
+ and `started`, when the running turn began, or `null`.
30
35
  Observe one with `observe('conversation', id, { limit })`: the view
31
36
  holds its latest `limit` messages, or all of them, oldest first, its chat
32
37
  draft, and what the Provider streams for it whether or not anything views it:
@@ -52,7 +57,10 @@ effect the Provider places in a Room carries `at`, that Room and Room Version;
52
57
  reached it, and the MD Runtime keeps refreshing that Room until it has;
53
58
  `reached(room, roomVersion, path)` answers whether the held confirmed copy of
54
59
  that document was written at a later Room Version. Each History revision
55
- names its author, `{ kind: 'user', id }` or `{ kind: 'site', id, name }`. Every
60
+ names its author, `{ kind: 'user', id }` or `{ kind: 'site', id, name }`.
61
+ History of a Path no current document holds answers the removed document's
62
+ revisions with `deleted: true`, newest first; that revision is what a link to
63
+ the Path opens. Every
56
64
  member of the
57
65
  client is asynchronous. Results are detached snapshots. Nothing in this
58
66
  surface returns the authorization, performs a request the App's code
@@ -74,22 +82,28 @@ data:
74
82
  - **Filter.** `rooms` names Room locators and defaults to every Room. `types`
75
83
  names MD Types, and `any` names untyped Markdown Documents. `pathPrefix` is a
76
84
  directory: `notes` keeps `notes/a.md` and not `notes2/a.md`.
77
- - **Fields.** `where` names frontmatter fields, ANDs them, and nests `$and` and
78
- `$or`. A bare value is equality; the operators are `$eq`, `$ne`, `$in`, `$nin`,
79
- `$gt`, `$gte`, `$lt`, `$lte`, `$all`, `$size` and `$exists`. Equality on a list
80
- asks whether it contains the value. Missing, null and empty differ:
85
+ - **Fields.** Every frontmatter value is named by JSON Pointer: `/status`,
86
+ `/shipping/city`, `~1` for a `/` and `~0` for a `~` in a key. A segment that
87
+ meets a list applies to every item and a number names one item. `where` names
88
+ pointers, ANDs them, and nests `$and` and `$or`; a pointer through a list holds
89
+ when any item satisfies it. A bare value is equality; the operators are `$eq`,
90
+ `$ne`, `$in`, `$nin`, `$gt`, `$gte`, `$lt`, `$lte`, `$all`, `$size` and
91
+ `$exists`. Equality on a list asks whether it contains the value. Missing, null and empty differ:
81
92
  `$exists: false` keeps a missing field, `null` an explicit null, `''` empty
82
93
  text and `$size: 0` an empty list. A date compares in calendar order and never
83
94
  with a date-time. A reference compares by the Room Path it resolves to.
84
- Untyped frontmatter is plain values. There is no text containment or regular
95
+ Untyped frontmatter, and a value under `oneOf` or a conditional, is plain
96
+ values. There is no text containment or regular
85
97
  expression.
86
98
  - **Relations.** `hop: { field, types, where, pathPrefix }` keeps Documents whose
87
- reference `field` points to a matching Document of the same Room.
88
- `backlinks: { field, types, where, pathPrefix }` keeps Documents that a
99
+ reference at pointer `field`, at any depth, points to a matching Document of the
100
+ same Room. `backlinks: { field, types, where, pathPrefix }` keeps Documents that a
89
101
  matching Document of the same Room references. Each keeps a Document once.
90
102
  - **Parts.** A Document query must `select`: `'all'`, or `fields`, `sections`,
91
- `preamble`, `markdown`, `backlinks` and `change`, where `fields` and `sections`
92
- are `'all'` or a list of names. Room and Path always return; a Markdown
103
+ `preamble`, `markdown`, `backlinks` and `change`, where `fields` is `'all'` or a
104
+ list of pointers and `sections` `'all'` or a list of names. Selected pointers
105
+ return the frontmatter holding only them, nested as written. A backlink names
106
+ the referring Path, MD Type and the pointer it came from as `field`. Room and Path always return; a Markdown
93
107
  Document also returns its MD Type. A non-Markdown Document or binary link
94
108
  target returns only Room and Path. An unselected part is absent. Select only
95
109
  what a screen shows: a list that selects the Markdown hears every edit of it.
@@ -103,8 +117,8 @@ data:
103
117
  - **Order and groups.** `orderBy` sorts by `room`, `path`, `type` or `{ field }`
104
118
  with TanStack DB's own options, and ties end with Room, then Path. `groupBy` by
105
119
  `room`, `type` or `{ field }` answers `{ groups: [{ key, count }] }`, counted
106
- over every match and ordered by `count` or a key. `limit` bounds the Documents
107
- or the groups.
120
+ over every match and ordered by `count` or a key. A sort or group takes only a
121
+ pointer that holds one value. `limit` bounds the Documents or the groups.
108
122
  - **Results and errors.** A result carries no Room Version: read freshness from
109
123
  Rooms and Sync Status. An invalid query fails with `invalid-query`,
110
124
  `unknown-type`, `unknown-field` or `wrong-kind`, naming where, and never
@@ -201,13 +215,25 @@ an App's override respected. What an App Creator's agent adds carries none
201
215
  of these promises by itself. Reading, querying and searching never wait for
202
216
  the network. Data lives only in the App Creator's browser and with the Provider.
203
217
 
204
- ## App code imports only the client entry and never constructs a Runtime
205
-
206
- App code imports only `@agentshouse/mdruntime/client` and calls
207
- `connectMdRuntime` on the port the host hands it. It never constructs a
208
- Runtime. It does not import the package main, the host entry, or the Adapter
209
- package, and it does not call `serveMdRuntime`. Hosts
210
- and tests use those entries; the served App does not.
218
+ ## App code takes the client its host hands it and never constructs a Runtime
219
+
220
+ App code takes the client its host hands it: in House,
221
+ `connectHouseBridge().runtime` from `@agentshouse/app-bridge` resolves to the
222
+ client House built into the page. It never constructs a Runtime or a client.
223
+ It imports only types from `@agentshouse/mdruntime/client`, does not call
224
+ `connectMdRuntime` or `serveMdRuntime`, and does not import the package main,
225
+ the host entry, or the Adapter package. Hosts and tests use those entries; the
226
+ served App does not.
227
+
228
+ A React App may observe and save through `@agentshouse/mdruntime/react`, which
229
+ names React as a peer dependency. `useObserve(client, topic, ...input)` takes
230
+ the arguments of `observe` and returns the topic's current value, `undefined`
231
+ until it arrives, re-rendering on each change; a `null` client observes
232
+ nothing. `useSave(client)` returns `busy`, the last `outcome` or `failure`, and
233
+ `save(room, roomDrafts)`, which writes each Path's parts onto the Room Draft
234
+ already there, keeping the bases its parts have, or onto a new one, and saves
235
+ them together. A refused Save leaves the Room Drafts for the App to save again
236
+ or discard; a failure is recorded and rejects.
211
237
 
212
238
  ## What an agent must never do
213
239
 
package/README.md CHANGED
@@ -19,12 +19,12 @@ import { serveMdRuntime } from '@agentshouse/mdruntime/host';
19
19
  import { createAgentsHouseAdapter } from '@agentshouse/mdruntime-adapter';
20
20
 
21
21
  const adapter = createAgentsHouseAdapter({ transport, authorize });
22
- const host = serveMdRuntime({ adapter, shell, requiredGuarantees: [] });
22
+ const host = serveMdRuntime({ adapter, shell });
23
23
  host.attach(port, 'my-app');
24
24
  ```
25
25
 
26
- App code never imports this package; it reaches the Runtime only through
27
- `@agentshouse/mdruntime/client`. The rules an App's agent follows are in the
26
+ App code never imports this package; it reaches the Runtime only through the
27
+ client its host hands it. The rules an App's agent follows are in the
28
28
  package's `AGENTS.md`.
29
29
 
30
30
  ## License
package/dist/actions.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationCards } from '@agentshouse/mdruntime';
1
+ import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationAgents } from '@agentshouse/mdruntime';
2
2
  import type { HouseDoorAnswer, HouseTransport } from './transport.js';
3
- export declare const HOUSE_CONVERSATION_CARDS: ConversationCards;
3
+ export declare function houseConversationAgents(locator: string): ConversationAgents;
4
4
  export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
5
5
  export declare function houseAction(transport: HouseTransport, request: ActionRequest): Promise<ActionResult>;
6
6
  export declare function actionOutcome(answer: HouseDoorAnswer, name: string): ActionResult;
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAGvB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkBtE,eAAO,MAAM,wBAAwB,EAAE,iBAKtC,CAAC;AAEF,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,iBAAiB,EAAE,CASvF;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAQvB;AA4DD,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAWjF;AAuLD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAUtE"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EAGxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkBtE,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAE3E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,iBAAiB,EAAE,CASvF;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAQvB;AA4DD,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAWjF;AAuLD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAUtE"}
package/dist/actions.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { changeBatchIdentity, } from '@agentshouse/mdruntime';
2
2
  import { doorRefusal } from './refusal.js';
3
- import { PRIVATE_LOCATOR } from './transport.js';
4
3
  const HISTORY_PAGE = 100;
5
4
  const HISTORY_CONVERSATIONS = 64;
6
5
  const OCTET_STREAM = 'application/octet-stream';
@@ -13,12 +12,9 @@ const CONVERSATION_ROUTES = new Map([
13
12
  ['conversation.delete', '/door/conversations/delete'],
14
13
  ['conversation.history', '/door/conversations/history'],
15
14
  ]);
16
- export const HOUSE_CONVERSATION_CARDS = {
17
- locator: PRIVATE_LOCATOR,
18
- type: 'house-conversation',
19
- identity: 'conversation',
20
- agent: 'agent',
21
- };
15
+ export function houseConversationAgents(locator) {
16
+ return { locator, type: 'house-agent', identity: 'agent', name: 'name' };
17
+ }
22
18
  export function declaredActions(routes) {
23
19
  const mapped = new Map([...CONVERSATION_ROUTES].map(([name, route]) => [route.slice('/door/'.length), name]));
24
20
  return routes.map((route) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,OAAO,EACP,aAAa,EAWd,MAAM,wBAAwB,CAAC;AAqChC,OAAO,EAQL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,MAAM,yBAAyB,GACjC;IACE,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC,GACD;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAsBjC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CA0WpF"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,OAAO,EACP,aAAa,EAWd,MAAM,wBAAwB,CAAC;AAqChC,OAAO,EAOL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,MAAM,yBAAyB,GACjC;IACE,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC,GACD;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAsBjC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAuWpF"}
package/dist/adapter.js CHANGED
@@ -5,9 +5,9 @@ import { createSiteAdapter } from './site.js';
5
5
  import { bootstrapOf, contentPrefixes, matchesScope, parseEnumeration, parseEnvelope, parseGrant, refreshFrom, viewOf, } from './read.js';
6
6
  import { acceptedLinks, enumeratedLinks, heldLinks, scopeLinks, streamedLinks, } from './links.js';
7
7
  import { houseAction } from './actions.js';
8
- import { classifyDoor, discoveryFailure, doorRefusal } from './refusal.js';
8
+ import { classifyDoor, classifyRead, discoveryFailure, doorRefusal } from './refusal.js';
9
9
  import { houseNotifications } from './stream.js';
10
- import { DOOR_BATCH, DOOR_BATCH_UPLOAD, DOOR_BOOTSTRAP, DOOR_DISCOVER, DOOR_ENUMERATE, DOOR_REVISIONS, PRIVATE_LOCATOR, } from './transport.js';
10
+ import { DOOR_BATCH, DOOR_BATCH_UPLOAD, DOOR_BOOTSTRAP, DOOR_DISCOVER, DOOR_ENUMERATE, DOOR_REVISIONS, } from './transport.js';
11
11
  import { batchPaths, deltaBody, deltaBytes, deltaDigest, historyOutcome, houseChanges, mutationOutcome, operationHead, rejectedMapping, revisionBody, uploadable, } from './write.js';
12
12
  import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
13
13
  const UNCERTAIN = { kind: 'transport-uncertainty' };
@@ -104,9 +104,7 @@ export function createAgentsHouseAdapter(options) {
104
104
  const { authority, position, log_epoch: logEpoch } = body;
105
105
  if (typeof position !== 'string' || typeof logEpoch !== 'string')
106
106
  return result;
107
- const locator = authority === undefined
108
- ? PRIVATE_LOCATOR
109
- : [...tracked.values()].find((entry) => entry.authority === authority)?.locator;
107
+ const locator = [...tracked.values()].find((entry) => entry.authority === authority)?.locator;
110
108
  if (locator === undefined)
111
109
  return result;
112
110
  return { ...result, at: { locator, roomVersion: roomVersion({ position, logEpoch }) } };
@@ -142,7 +140,7 @@ export function createAgentsHouseAdapter(options) {
142
140
  answers.push(envelope === null ? UNCERTAIN_READ : await bootstrappedRoom(envelope, entry));
143
141
  continue;
144
142
  }
145
- answers.push(failure.kind === 'beyond-horizon' ? UNCERTAIN_READ : failure);
143
+ answers.push(failure);
146
144
  }
147
145
  }
148
146
  return answers;
@@ -167,7 +165,7 @@ export function createAgentsHouseAdapter(options) {
167
165
  prefixes: open.flatMap((ask) => contentPrefixes(ask.entry)),
168
166
  positions: open.map((ask) => presented(ask.entry.authority, ask.from)),
169
167
  });
170
- const classified = open.map((ask) => classifyDoor(answer.status, answer.body, ask.entry.locator));
168
+ const classified = open.map((ask) => classifyRead(answer.status, answer.body, ask.entry.locator));
171
169
  if (classified[0]?.kind === 'beyond-horizon') {
172
170
  const named = doorRefusal(answer.body)?.fields.authority;
173
171
  const expired = open.filter((ask) => ask.entry.authority === named);
@@ -198,7 +196,7 @@ export function createAgentsHouseAdapter(options) {
198
196
  const paths = batchPaths(changes);
199
197
  const sha256 = await deltaDigest(delta);
200
198
  if (handed !== undefined && handed.sha256 === sha256) {
201
- return { body: { ...head, paths, upload: handed } };
199
+ return { body: { ...head, paths, upload: handed, runtime: notifications.runtime } };
202
200
  }
203
201
  const minted = await transport.door(DOOR_BATCH_UPLOAD, { ...head, paths, bytes, sha256 });
204
202
  if (minted.status !== 200) {
@@ -221,10 +219,10 @@ export function createAgentsHouseAdapter(options) {
221
219
  return { outcome: UNCERTAIN };
222
220
  const upload = { url: holding.url, operation: holding.operation, bytes, sha256 };
223
221
  await keep(upload);
224
- return { body: { ...head, paths, upload } };
222
+ return { body: { ...head, paths, upload, runtime: notifications.runtime } };
225
223
  }
226
224
  async function submit(head, changes, delta, bytes, entry, handed, keep) {
227
- const inline = { ...head, changes };
225
+ const inline = { ...head, changes, runtime: notifications.runtime };
228
226
  const prepared = uploadable(inline, bytes, declared())
229
227
  ? await uploaded(head, changes, delta, bytes, entry, handed, keep)
230
228
  : { body: inline };
@@ -239,9 +237,9 @@ export function createAgentsHouseAdapter(options) {
239
237
  },
240
238
  async discover(_authorization) {
241
239
  const answer = await transport.door(DOOR_DISCOVER, { prefixes: [...DISCOVER_PREFIXES] });
242
- const classified = classifyDoor(answer.status, answer.body, PRIVATE_LOCATOR);
243
- if (classified !== null)
244
- return discoveryFailure(classified);
240
+ const failed = discoveryFailure(answer.status, answer.body);
241
+ if (failed !== null)
242
+ return failed;
245
243
  const document = parseDiscovery(answer.body);
246
244
  if (document === null)
247
245
  return { kind: 'transport-uncertainty' };
@@ -254,7 +252,7 @@ export function createAgentsHouseAdapter(options) {
254
252
  if (!tracked.has(locator))
255
253
  handed.delete(locator);
256
254
  notifications.track(entries);
257
- return mapDiscovery(document, document.authorities.map((authority) => discoveredRoom(authority)), capabilities(document.actions));
255
+ return mapDiscovery(document, document.authorities.map((authority) => discoveredRoom(authority)), capabilities(document));
258
256
  },
259
257
  async bootstrap(_authorization, request) {
260
258
  const entry = authorityFor(request.locator);
@@ -1,12 +1,7 @@
1
1
  import type { Capability, DiscoveredRoom, Discovery, ProviderLimit, Retention } from '@agentshouse/mdruntime';
2
2
  import { type LogPosition } from './version.js';
3
- export declare const ROOM_CONTRACT_VERSION = 1;
4
- export declare const MD_MODEL_IDENTITY = "@agentshouse/mdmodel";
5
- export declare const ROOM_VERSION_NOTIFICATIONS = "room-version-notifications";
6
3
  export declare const PROVIDER_ACTIONS = "provider-actions";
7
- export declare const MOVE_REFERENCE_REWRITES = "move-reference-rewrites";
8
4
  export declare const DISCOVER_PREFIXES: readonly string[];
9
- export declare const PRIVATE_HANDLE = "private";
10
5
  export type HouseBounds = {
11
6
  max_authored_file_bytes: number;
12
7
  max_batch_operations: number;
@@ -43,7 +38,6 @@ export type HouseAuthority = LogPosition & {
43
38
  };
44
39
  export type HouseDiscoveryDocument = {
45
40
  bounds: HouseBounds;
46
- mdModelVersion: string;
47
41
  authorities: readonly HouseAuthority[];
48
42
  actions: readonly string[];
49
43
  };
@@ -62,18 +56,16 @@ export type HouseSiteAuthority = LogPosition & {
62
56
  };
63
57
  export type HouseSiteDiscovery = {
64
58
  bounds: HouseBounds;
65
- mdModelVersion: string;
66
59
  authorities: readonly HouseSiteAuthority[];
67
60
  };
68
61
  export declare function parseDiscovery(body: unknown): HouseDiscoveryDocument | null;
69
62
  export declare function parseSiteDiscovery(body: unknown): HouseSiteDiscovery | null;
70
63
  export declare function siteTracked(document: HouseSiteDiscovery): TrackedAuthority[];
71
- export declare function locatorOf(authority: HouseAuthority): string;
72
64
  export declare function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[];
73
65
  export declare function providerLimits(bounds: HouseBounds): readonly ProviderLimit[];
74
66
  export declare function declaredRetention(bounds: HouseBounds): Retention;
75
- export declare function capabilities(actions: readonly string[]): readonly Capability[];
67
+ export declare function capabilities(document: HouseDiscoveryDocument): readonly Capability[];
76
68
  export declare function siteCapabilities(): readonly Capability[];
77
69
  export declare function discoveredRoom(authority: HouseAuthority): DiscoveredRoom;
78
- export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds' | 'mdModelVersion'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
70
+ export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
79
71
  //# 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,EACV,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,cAAc,YAAY,CAAC;AAExC,MAAM,MAAM,WAAW,GAAG;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB,EAAE,MAAM,CAAC;IACjC,2BAA2B,EAAE,MAAM,CAAC;CACrC,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GAAG,SAAS,UAAU,EAAE,CAWpF;AAED,wBAAgB,gBAAgB,IAAI,SAAS,UAAU,EAAE,CAIxD;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAmBxE;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC,EAChD,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAC9B,SAAS,CAQX"}
package/dist/discovery.js CHANGED
@@ -1,13 +1,7 @@
1
- import { declaredActions, HOUSE_CONVERSATION_CARDS } from './actions.js';
2
- import { PRIVATE_LOCATOR } from './transport.js';
1
+ import { declaredActions, houseConversationAgents } from './actions.js';
3
2
  import { readPosition, roomVersion } from './version.js';
4
- export const ROOM_CONTRACT_VERSION = 1;
5
- export const MD_MODEL_IDENTITY = '@agentshouse/mdmodel';
6
- export const ROOM_VERSION_NOTIFICATIONS = 'room-version-notifications';
7
3
  export const PROVIDER_ACTIONS = 'provider-actions';
8
- export const MOVE_REFERENCE_REWRITES = 'move-reference-rewrites';
9
4
  export const DISCOVER_PREFIXES = ['/'];
10
- export const PRIVATE_HANDLE = 'private';
11
5
  const BOUND_KEYS = [
12
6
  'max_authored_file_bytes',
13
7
  'max_batch_operations',
@@ -107,8 +101,6 @@ export function parseDiscovery(body) {
107
101
  const bounds = parseBounds(held.bounds);
108
102
  if (bounds === null)
109
103
  return null;
110
- if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0)
111
- return null;
112
104
  const actions = stringList(held.actions);
113
105
  if (actions === null ||
114
106
  new Set(actions).size !== actions.length ||
@@ -123,7 +115,7 @@ export function parseDiscovery(body) {
123
115
  return null;
124
116
  authorities.push(authority);
125
117
  }
126
- return { bounds, mdModelVersion: held.md_model_version, authorities, actions };
118
+ return { bounds, authorities, actions };
127
119
  }
128
120
  function parseSiteAuthority(value) {
129
121
  if (typeof value !== 'object' || value === null)
@@ -154,8 +146,6 @@ export function parseSiteDiscovery(body) {
154
146
  const bounds = parseBounds(held.bounds);
155
147
  if (bounds === null)
156
148
  return null;
157
- if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0)
158
- return null;
159
149
  if (!Array.isArray(held.authorities))
160
150
  return null;
161
151
  const authorities = [];
@@ -165,7 +155,7 @@ export function parseSiteDiscovery(body) {
165
155
  return null;
166
156
  authorities.push(authority);
167
157
  }
168
- return { bounds, mdModelVersion: held.md_model_version, authorities };
158
+ return { bounds, authorities };
169
159
  }
170
160
  export function siteTracked(document) {
171
161
  return document.authorities.map((authority) => ({
@@ -179,9 +169,6 @@ export function siteTracked(document) {
179
169
  logEpoch: authority.logEpoch,
180
170
  }));
181
171
  }
182
- export function locatorOf(authority) {
183
- return authority.roomHandle === PRIVATE_HANDLE ? PRIVATE_LOCATOR : authority.roomRef;
184
- }
185
172
  function schemasOf(authority) {
186
173
  return authority.houseModel === null
187
174
  ? [authority.schema]
@@ -189,7 +176,7 @@ function schemasOf(authority) {
189
176
  }
190
177
  export function trackedFrom(document) {
191
178
  return document.authorities.map((authority) => ({
192
- locator: locatorOf(authority),
179
+ locator: authority.roomRef,
193
180
  authority: authority.roomRef,
194
181
  handle: authority.roomHandle,
195
182
  schema: authority.schema,
@@ -217,28 +204,29 @@ export function declaredRetention(bounds) {
217
204
  refreshHorizon: bounds.change_retention_seconds,
218
205
  };
219
206
  }
220
- export function capabilities(actions) {
207
+ export function capabilities(document) {
208
+ const house = document.authorities.find((authority) => authority.houseModel !== null);
221
209
  return [
222
- { name: ROOM_VERSION_NOTIFICATIONS },
223
210
  {
224
211
  name: PROVIDER_ACTIONS,
225
- actions: declaredActions(actions),
226
- conversationCards: HOUSE_CONVERSATION_CARDS,
212
+ actions: declaredActions(document.actions),
213
+ ...(house === undefined
214
+ ? {}
215
+ : { conversationAgents: houseConversationAgents(house.roomRef) }),
227
216
  },
228
- { name: MOVE_REFERENCE_REWRITES },
229
217
  ];
230
218
  }
231
219
  export function siteCapabilities() {
232
220
  return [
233
- { name: ROOM_VERSION_NOTIFICATIONS },
234
221
  { name: PROVIDER_ACTIONS, actions: [{ name: 'submit', inputShape: {}, resultKind: 'house' }] },
235
222
  ];
236
223
  }
237
224
  export function discoveredRoom(authority) {
238
- const locator = locatorOf(authority);
225
+ const locator = authority.roomRef;
239
226
  return {
240
227
  name: authority.name,
241
228
  locator,
229
+ handle: authority.roomHandle,
242
230
  roomVersion: roomVersion(authority),
243
231
  operations: {
244
232
  read: [...authority.operations.read],
@@ -256,8 +244,6 @@ export function discoveredRoom(authority) {
256
244
  export function mapDiscovery(document, rooms, declared) {
257
245
  return {
258
246
  kind: 'discovery',
259
- supportedVersions: [ROOM_CONTRACT_VERSION],
260
- mdModel: { identity: MD_MODEL_IDENTITY, version: document.mdModelVersion },
261
247
  rooms,
262
248
  capabilities: declared,
263
249
  providerLimits: providerLimits(document.bounds),
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
2
- export { PRIVATE_LOCATOR } from './transport.js';
3
2
  export type { HouseByteAct, HouseByteAnswer, HouseByteTransfer, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -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,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,YAAY,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,YAAY,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
1
  export { createAgentsHouseAdapter } from './adapter.js';
2
- export { PRIVATE_LOCATOR } from './transport.js';
package/dist/refusal.d.ts CHANGED
@@ -4,10 +4,9 @@ export type DoorRefusal = ProviderRefusal & {
4
4
  };
5
5
  export declare function doorRefusal(body: unknown): DoorRefusal | null;
6
6
  export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: DoorRefusal): ScopedRefusal;
7
- export declare function classifyDoor(status: number, body: unknown, locator: string): AdapterFailure | {
7
+ export declare function classifyDoor(status: number, body: unknown, locator: string): AdapterFailure | null;
8
+ export declare function classifyRead(status: number, body: unknown, locator: string): AdapterFailure | {
8
9
  kind: 'beyond-horizon';
9
10
  } | null;
10
- export declare function discoveryFailure(classified: AdapterFailure | {
11
- kind: 'beyond-horizon';
12
- }): DiscoverResult;
11
+ export declare function discoveryFailure(status: number, body: unknown): DiscoverResult | null;
13
12
  //# sourceMappingURL=refusal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAEnE,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,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AO,GAAG,cAAc,GAAG,IAAI,CAYrF"}
package/dist/refusal.js CHANGED
@@ -12,7 +12,7 @@ export function doorRefusal(body) {
12
12
  export function scopedRefusal(locator, scope, refusal) {
13
13
  return { kind: 'scoped-refusal', locator, scope, code: refusal.code, fields: refusal.fields };
14
14
  }
15
- export function classifyDoor(status, body, locator) {
15
+ function doorFailure(status, body) {
16
16
  if (status === 0)
17
17
  return { kind: 'transport-uncertainty' };
18
18
  const refusal = doorRefusal(body);
@@ -20,24 +20,41 @@ export function classifyDoor(status, body, locator) {
20
20
  return { kind: 'revoked-authorization' };
21
21
  if (refusal?.retryable === true)
22
22
  return { kind: 'transport-uncertainty' };
23
- if (refusal !== null && refusal.code === 'position_expired')
24
- return { kind: 'beyond-horizon' };
25
- if (status === 404 || refusal?.code === 'room_not_found') {
26
- return { kind: 'room-not-readable', locator };
27
- }
23
+ if (status === 404 || refusal?.code === 'room_not_found')
24
+ return { kind: 'room-not-readable' };
28
25
  if (status < 400)
29
26
  return null;
30
27
  if (refusal === null)
31
28
  return { kind: 'transport-uncertainty' };
32
- if (status === 403)
33
- return scopedRefusal(locator, 'operation', refusal);
34
- return scopedRefusal(locator, 'undisclosed', refusal);
29
+ return { kind: 'refused', scope: status === 403 ? 'operation' : 'undisclosed', refusal };
35
30
  }
36
- export function discoveryFailure(classified) {
37
- if (classified.kind === 'revoked-authorization')
38
- return classified;
39
- if (classified.kind === 'scoped-refusal') {
40
- return { kind: 'contract-unavailable', code: classified.code, fields: classified.fields };
31
+ export function classifyDoor(status, body, locator) {
32
+ const failure = doorFailure(status, body);
33
+ if (failure === null)
34
+ return null;
35
+ if (failure.kind === 'room-not-readable')
36
+ return { kind: 'room-not-readable', locator };
37
+ if (failure.kind === 'refused')
38
+ return scopedRefusal(locator, failure.scope, failure.refusal);
39
+ return failure;
40
+ }
41
+ export function classifyRead(status, body, locator) {
42
+ if (doorRefusal(body)?.code === 'expired')
43
+ return { kind: 'beyond-horizon' };
44
+ return classifyDoor(status, body, locator);
45
+ }
46
+ export function discoveryFailure(status, body) {
47
+ const failure = doorFailure(status, body);
48
+ if (failure === null)
49
+ return null;
50
+ if (failure.kind === 'revoked-authorization')
51
+ return failure;
52
+ if (failure.kind === 'refused') {
53
+ return {
54
+ kind: 'contract-unavailable',
55
+ code: failure.refusal.code,
56
+ fields: failure.refusal.fields,
57
+ };
41
58
  }
42
59
  return { kind: 'transport-uncertainty' };
43
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,wBAAwB,CAAC;AAsBhC,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AA+BxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAiIxE"}
1
+ {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,wBAAwB,CAAC;AAsBhC,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAgCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAiIxE"}
package/dist/site.js CHANGED
@@ -2,15 +2,16 @@ import { actionOutcome } from './actions.js';
2
2
  import { mapDiscovery, parseSiteDiscovery, siteCapabilities, siteTracked, } from './discovery.js';
3
3
  import { scopeModels, streamedModels, viewModels } from './model.js';
4
4
  import { advancedScope, bootstrapOf, parseEnumeration, parseSiteBootstrap, refreshFrom, viewOf, } from './read.js';
5
- import { classifyDoor, discoveryFailure } from './refusal.js';
5
+ import { classifyDoor, classifyRead, discoveryFailure } from './refusal.js';
6
6
  import { houseNotifications } from './stream.js';
7
- import { PRIVATE_LOCATOR, SITE_DOOR_BOOTSTRAP, SITE_DOOR_DISCOVER, SITE_DOOR_ENUMERATE, SITE_DOOR_SUBMIT, } from './transport.js';
7
+ import { SITE_DOOR_BOOTSTRAP, SITE_DOOR_DISCOVER, SITE_DOOR_ENUMERATE, SITE_DOOR_SUBMIT, } from './transport.js';
8
8
  import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
9
9
  const UNCERTAIN = { kind: 'transport-uncertainty' };
10
10
  function siteRoom(tracked) {
11
11
  return {
12
12
  name: tracked.handle,
13
13
  locator: tracked.locator,
14
+ handle: tracked.handle,
14
15
  roomVersion: roomVersion(tracked),
15
16
  operations: { read: [''], sync: [''], write: [], delete: [] },
16
17
  replica: { selection: tracked.locator, admission: 'admitted' },
@@ -27,7 +28,7 @@ export function createSiteAdapter(transport) {
27
28
  const answer = await transport.door(SITE_DOOR_ENUMERATE, {
28
29
  positions: [presented(entry.authority, from)],
29
30
  });
30
- const classified = classifyDoor(answer.status, answer.body, entry.locator);
31
+ const classified = classifyRead(answer.status, answer.body, entry.locator);
31
32
  if (classified !== null)
32
33
  return classified;
33
34
  return parseEnumeration(answer.body, 'site') ?? UNCERTAIN;
@@ -36,7 +37,7 @@ export function createSiteAdapter(transport) {
36
37
  const answer = await transport.read(`${SITE_DOOR_BOOTSTRAP}${entry.authority}`);
37
38
  const classified = classifyDoor(answer.status, answer.body, entry.locator);
38
39
  if (classified !== null)
39
- return { failure: settled(classified) };
40
+ return { failure: classified };
40
41
  const scope = parseSiteBootstrap(answer.body);
41
42
  if (scope === null)
42
43
  return { failure: UNCERTAIN };
@@ -78,9 +79,9 @@ export function createSiteAdapter(transport) {
78
79
  },
79
80
  async discover() {
80
81
  const answer = await transport.read(SITE_DOOR_DISCOVER);
81
- const classified = classifyDoor(answer.status, answer.body, PRIVATE_LOCATOR);
82
- if (classified !== null)
83
- return discoveryFailure(classified);
82
+ const failed = discoveryFailure(answer.status, answer.body);
83
+ if (failed !== null)
84
+ return failed;
84
85
  const document = parseSiteDiscovery(answer.body);
85
86
  if (document === null)
86
87
  return UNCERTAIN;
package/dist/stream.d.ts CHANGED
@@ -9,6 +9,7 @@ export type StreamedAdvancement = {
9
9
  schemas: ReadonlyMap<string, HouseStreamEntry>;
10
10
  };
11
11
  export type HouseNotifications = {
12
+ runtime: string;
12
13
  observe(notify: (event: RoomStreamEvent) => void): () => void;
13
14
  send(rooms: readonly HouseHeldRoom[]): void;
14
15
  track(authorities: readonly TrackedAuthority[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,WAAW,EACX,eAAe,EAEf,iBAAiB,EAElB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,SAAS,EAET,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAgB7D,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC9D,IAAI,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtD,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD,OAAO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C;IACtD,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD,OAAO,CACL,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,EACjB,KAAK,CAAC,EAAE,YAAY,GACnB,mBAAmB,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,kBAAkB,CAAC;IAClC,WAAW,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAuBF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,kBAAkB,CAoS5F"}
package/dist/stream.js CHANGED
@@ -6,6 +6,16 @@ function turnOperation(frame) {
6
6
  const { type: _type, conversation_id: _conversation, turn_id: _turn, ...operation } = frame;
7
7
  return structuredClone(operation);
8
8
  }
9
+ function listedConversation(listed) {
10
+ return {
11
+ conversation: listed.conversation_id,
12
+ agent: listed.agent_id,
13
+ name: listed.name,
14
+ created: listed.created_at,
15
+ finished: listed.finished_at,
16
+ outcome: listed.outcome,
17
+ };
18
+ }
9
19
  function position(value) {
10
20
  if (!/^(?:0|[1-9][0-9]*)$/.test(value))
11
21
  return null;
@@ -21,13 +31,19 @@ export function houseNotifications(transport, mode) {
21
31
  let replicated = [];
22
32
  const live = new Set();
23
33
  let opening = null;
34
+ const runtime = crypto.randomUUID();
24
35
  function emit(event) {
25
36
  for (const observer of observers)
26
37
  observer(event);
27
38
  }
28
39
  function emitConversation(event) {
29
- if (event.kind !== 'gap' && event.kind !== 'accepted-message')
40
+ if (event.kind === 'turn' ||
41
+ event.kind === 'questions' ||
42
+ event.kind === 'process' ||
43
+ event.kind === 'commands' ||
44
+ event.kind === 'options') {
30
45
  live.add(event.conversation);
46
+ }
31
47
  for (const observer of conversationObservers)
32
48
  observer(event);
33
49
  }
@@ -110,6 +126,18 @@ export function houseNotifications(transport, mode) {
110
126
  });
111
127
  return;
112
128
  }
129
+ if (frame.type === 'conversations') {
130
+ emitConversation({ kind: 'list', entries: frame.conversations.map(listedConversation) });
131
+ return;
132
+ }
133
+ if (frame.type === 'conversation') {
134
+ emitConversation({ kind: 'listed', entry: listedConversation(frame.conversation) });
135
+ return;
136
+ }
137
+ if (frame.type === 'conversation_deleted') {
138
+ emitConversation({ kind: 'unlisted', conversation: frame.conversation_id });
139
+ return;
140
+ }
113
141
  if (frame.type === 'turn' ||
114
142
  frame.type === 'process' ||
115
143
  frame.type === 'commands' ||
@@ -150,6 +178,7 @@ export function houseNotifications(transport, mode) {
150
178
  emit({ kind: 'closed', revoked });
151
179
  });
152
180
  return {
181
+ runtime,
153
182
  serviceMode: {
154
183
  observe(notify) {
155
184
  modeObservers.add(notify);
@@ -191,7 +220,7 @@ export function houseNotifications(transport, mode) {
191
220
  }
192
221
  const current = opening;
193
222
  opening = null;
194
- current?.hold(rooms);
223
+ current?.hold(rooms, runtime);
195
224
  },
196
225
  track(entries) {
197
226
  locators.clear();
@@ -9,7 +9,6 @@ export declare const SITE_DOOR_DISCOVER = "/_house/door/discover";
9
9
  export declare const SITE_DOOR_BOOTSTRAP = "/_house/door/bootstrap/";
10
10
  export declare const SITE_DOOR_ENUMERATE = "/_house/door/enumerate";
11
11
  export declare const SITE_DOOR_SUBMIT = "/_house/door/submit";
12
- export declare const PRIVATE_LOCATOR = "private";
13
12
  export type HouseMode = 'credential' | 'site';
14
13
  export type HouseDoorAnswer = {
15
14
  status: number;
@@ -44,6 +43,14 @@ export type HouseStreamEntry = {
44
43
  type LiveFact<K extends ConversationEvent['kind']> = Extract<ConversationEvent, {
45
44
  kind: K;
46
45
  }>;
46
+ export type HouseListedConversation = {
47
+ conversation_id: string;
48
+ agent_id: string;
49
+ name: string;
50
+ created_at: string;
51
+ finished_at: string | null;
52
+ outcome: string | null;
53
+ };
47
54
  export type HouseStreamFrame = {
48
55
  type: 'entries';
49
56
  authority: string;
@@ -78,6 +85,15 @@ export type HouseStreamFrame = {
78
85
  type: 'options';
79
86
  conversation_id: string;
80
87
  options: LiveFact<'options'>['options'];
88
+ } | {
89
+ type: 'conversations';
90
+ conversations: readonly HouseListedConversation[];
91
+ } | {
92
+ type: 'conversation';
93
+ conversation: HouseListedConversation;
94
+ } | {
95
+ type: 'conversation_deleted';
96
+ conversation_id: string;
81
97
  } | {
82
98
  type: 'signal';
83
99
  service_mode: string;
@@ -88,7 +104,7 @@ export type HouseHeldRoom = {
88
104
  log_epoch: string;
89
105
  };
90
106
  export type HouseOpening = {
91
- hold(rooms: readonly HouseHeldRoom[]): void;
107
+ hold(rooms: readonly HouseHeldRoom[], runtime: string): void;
92
108
  };
93
109
  export type HouseStream = {
94
110
  observe(receive: (frame: HouseStreamFrame) => void): () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE/E,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,UAAU,gBAAgB,CAAC;AAExC,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AAEtD,eAAO,MAAM,eAAe,YAAY,CAAC;AAEzC,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,8B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,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG;IAC3C,MAAM,IAAI,OAAO,CAAC;IAClB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC/C,CAAC"}
package/dist/transport.js CHANGED
@@ -8,4 +8,3 @@ export const SITE_DOOR_DISCOVER = '/_house/door/discover';
8
8
  export const SITE_DOOR_BOOTSTRAP = '/_house/door/bootstrap/';
9
9
  export const SITE_DOOR_ENUMERATE = '/_house/door/enumerate';
10
10
  export const SITE_DOOR_SUBMIT = '/_house/door/submit';
11
- export const PRIVATE_LOCATOR = 'private';
@@ -1 +1 @@
1
- {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEX,aAAa,EAEb,cAAc,EAEd,cAAc,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOlD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE/D,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAuGrD,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAQ9E;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,wBA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AAM,EAAE,OAAO,CAAC,CAM1B;AAeD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,aAAa,CAgDf"}
package/dist/write.js CHANGED
@@ -166,7 +166,7 @@ export function mutationOutcome(status, body, locator, handle) {
166
166
  if (refusal !== null && refusal.code === 'service_mode_write_halted') {
167
167
  return { kind: 'write-halted' };
168
168
  }
169
- if (refusal !== null && refusal.code === 'operation_expired')
169
+ if (refusal !== null && refusal.code === 'expired')
170
170
  return { kind: 'expired' };
171
171
  if (refusal !== null && refusal.code === 'edit_conflict') {
172
172
  const { current, ...fields } = refusal.fields;
@@ -183,9 +183,8 @@ export function mutationOutcome(status, body, locator, handle) {
183
183
  classified?.kind === 'transport-uncertainty') {
184
184
  return { kind: 'retryable-refusal', code: refusal.code, fields: refusal.fields, reset };
185
185
  }
186
- if (classified !== null && classified.kind !== 'scoped-refusal') {
187
- return classified.kind === 'beyond-horizon' ? { kind: 'expired' } : classified;
188
- }
186
+ if (classified !== null && classified.kind !== 'scoped-refusal')
187
+ return classified;
189
188
  if (classified !== null && status === 403)
190
189
  return classified;
191
190
  if (refusal !== null && status >= 400) {
@@ -253,9 +252,8 @@ function revisionAuthor(entry) {
253
252
  }
254
253
  export function historyOutcome(status, body, locator, request) {
255
254
  const classified = classifyDoor(status, body, locator);
256
- if (classified !== null) {
257
- return classified.kind === 'beyond-horizon' ? { kind: 'transport-uncertainty' } : classified;
258
- }
255
+ if (classified !== null)
256
+ return classified;
259
257
  if (status !== 200 || typeof body !== 'object' || body === null) {
260
258
  return { kind: 'transport-uncertainty' };
261
259
  }
@@ -302,5 +300,6 @@ export function historyOutcome(status, body, locator, request) {
302
300
  kind: 'history',
303
301
  revisions,
304
302
  ...(typeof next === 'number' ? { pageToken: String(next) } : {}),
303
+ ...(held.deleted === true ? { deleted: true } : {}),
305
304
  };
306
305
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime-adapter",
3
- "version": "0.1.0-c26cd225263b7",
3
+ "version": "0.1.0-c38756ee6ced5",
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-c6b0c6dc1a195",
29
- "@agentshouse/mdruntime": "0.1.0-ca7c26c6bc27e"
28
+ "@agentshouse/mdmodel": "0.1.0-c0bdbbc92d020",
29
+ "@agentshouse/mdruntime": "0.1.0-c6e4c19c13638"
30
30
  }
31
31
  }