@agentshouse/mdruntime-adapter 0.1.0-c5b15f4efd6f3 → 0.1.0-c617f778a54ad

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
@@ -211,6 +225,19 @@ It imports only types from `@agentshouse/mdruntime/client`, does not call
211
225
  the host entry, or the Adapter package. Hosts and tests use those entries; the
212
226
  served App does not.
213
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. `saveRoomDrafts(client, room,
237
+ roomDrafts)` is that save outside a component. A react-admin or Refine App
238
+ reads and writes its Rooms through the data providers of
239
+ `@agentshouse/mdruntime-families`.
240
+
214
241
  ## What an agent must never do
215
242
 
216
243
  An agent must never read the authorization, load code from a Room, call the
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);
@@ -2,7 +2,6 @@ import type { Capability, DiscoveredRoom, Discovery, ProviderLimit, Retention }
2
2
  import { type LogPosition } from './version.js';
3
3
  export declare const PROVIDER_ACTIONS = "provider-actions";
4
4
  export declare const DISCOVER_PREFIXES: readonly string[];
5
- export declare const PRIVATE_HANDLE = "private";
6
5
  export type HouseBounds = {
7
6
  max_authored_file_bytes: number;
8
7
  max_batch_operations: number;
@@ -62,11 +61,10 @@ export type HouseSiteDiscovery = {
62
61
  export declare function parseDiscovery(body: unknown): HouseDiscoveryDocument | null;
63
62
  export declare function parseSiteDiscovery(body: unknown): HouseSiteDiscovery | null;
64
63
  export declare function siteTracked(document: HouseSiteDiscovery): TrackedAuthority[];
65
- export declare function locatorOf(authority: HouseAuthority): string;
66
64
  export declare function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[];
67
65
  export declare function providerLimits(bounds: HouseBounds): readonly ProviderLimit[];
68
66
  export declare function declaredRetention(bounds: HouseBounds): Retention;
69
- export declare function capabilities(actions: readonly string[]): readonly Capability[];
67
+ export declare function capabilities(document: HouseDiscoveryDocument): readonly Capability[];
70
68
  export declare function siteCapabilities(): readonly Capability[];
71
69
  export declare function discoveredRoom(authority: HouseAuthority): DiscoveredRoom;
72
70
  export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
@@ -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,gBAAgB,qBAAqB,CAAC;AAEnD,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,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1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'./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
3
  export const PROVIDER_ACTIONS = 'provider-actions';
5
4
  export const DISCOVER_PREFIXES = ['/'];
6
- export const PRIVATE_HANDLE = 'private';
7
5
  const BOUND_KEYS = [
8
6
  'max_authored_file_bytes',
9
7
  'max_batch_operations',
@@ -171,9 +169,6 @@ export function siteTracked(document) {
171
169
  logEpoch: authority.logEpoch,
172
170
  }));
173
171
  }
174
- export function locatorOf(authority) {
175
- return authority.roomHandle === PRIVATE_HANDLE ? PRIVATE_LOCATOR : authority.roomRef;
176
- }
177
172
  function schemasOf(authority) {
178
173
  return authority.houseModel === null
179
174
  ? [authority.schema]
@@ -181,7 +176,7 @@ function schemasOf(authority) {
181
176
  }
182
177
  export function trackedFrom(document) {
183
178
  return document.authorities.map((authority) => ({
184
- locator: locatorOf(authority),
179
+ locator: authority.roomRef,
185
180
  authority: authority.roomRef,
186
181
  handle: authority.roomHandle,
187
182
  schema: authority.schema,
@@ -209,12 +204,15 @@ export function declaredRetention(bounds) {
209
204
  refreshHorizon: bounds.change_retention_seconds,
210
205
  };
211
206
  }
212
- export function capabilities(actions) {
207
+ export function capabilities(document) {
208
+ const house = document.authorities.find((authority) => authority.houseModel !== null);
213
209
  return [
214
210
  {
215
211
  name: PROVIDER_ACTIONS,
216
- actions: declaredActions(actions),
217
- conversationCards: HOUSE_CONVERSATION_CARDS,
212
+ actions: declaredActions(document.actions),
213
+ ...(house === undefined
214
+ ? {}
215
+ : { conversationAgents: houseConversationAgents(house.roomRef) }),
218
216
  },
219
217
  ];
220
218
  }
@@ -224,10 +222,11 @@ export function siteCapabilities() {
224
222
  ];
225
223
  }
226
224
  export function discoveredRoom(authority) {
227
- const locator = locatorOf(authority);
225
+ const locator = authority.roomRef;
228
226
  return {
229
227
  name: authority.name,
230
228
  locator,
229
+ handle: authority.roomHandle,
231
230
  roomVersion: roomVersion(authority),
232
231
  operations: {
233
232
  read: [...authority.operations.read],
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';
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,U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cAAc,CAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAWjC"}
package/dist/model.js CHANGED
@@ -1,12 +1,15 @@
1
1
  import { sha256Hex } from './digest.js';
2
2
  import { schemaOf, schemaPath } from './read.js';
3
3
  const MODEL_ABSENT = { kind: 'model-unavailable', reason: 'not-readable' };
4
- const ABSENT_SCHEMA = { schema: null, version: null };
4
+ const ABSENT_SCHEMA = { schema: null, version: null, revision: null };
5
5
  async function heldModel(read, identity) {
6
6
  if (read === null)
7
7
  return MODEL_ABSENT;
8
8
  const version = await sha256Hex(JSON.stringify(read.version));
9
- return { kind: 'model', snapshot: { identity, version, schema: read.schema } };
9
+ return {
10
+ kind: 'model',
11
+ snapshot: { identity, version, schema: read.schema, revision: read.revision },
12
+ };
10
13
  }
11
14
  async function modelsOf(tracked, read) {
12
15
  const models = {};
@@ -33,8 +36,13 @@ export function viewModels(view, tracked) {
33
36
  return undefined;
34
37
  if ('removed' in change)
35
38
  return ABSENT_SCHEMA;
36
- if ('content' in change)
37
- return { schema: change.content, version: change.version };
39
+ if ('content' in change) {
40
+ return {
41
+ schema: change.content,
42
+ version: change.version,
43
+ revision: change.revision ?? null,
44
+ };
45
+ }
38
46
  return null;
39
47
  });
40
48
  }
@@ -48,6 +56,8 @@ export function streamedModels(schemas, tracked, mode) {
48
56
  if (entry.text === undefined)
49
57
  return null;
50
58
  const version = mode === 'site' ? entry.sha256 : entry.revision;
51
- return version === undefined ? null : { schema: entry.text, version };
59
+ return version === undefined
60
+ ? null
61
+ : { schema: entry.text, version, revision: mode === 'site' ? null : version };
52
62
  });
53
63
  }
package/dist/read.d.ts CHANGED
@@ -71,6 +71,7 @@ export declare function bootstrapOf(scope: HouseScope): BootstrapPage;
71
71
  export type HouseSchema = {
72
72
  schema: string | null;
73
73
  version: string | null;
74
+ revision: string | null;
74
75
  };
75
76
  export declare function schemaOf(scope: HouseScope, schema: string): HouseSchema | null;
76
77
  export declare function viewOf(enumeration: HouseEnumeration, tracked: TrackedAuthority): HouseView | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACb,cAAc,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACpC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC9B;IA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AyBxF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,GAAG,UAAU,CA2B5E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAElF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,CAsB5D;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAO9E;AAED,wBAAgB,MAAM,CACpB,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,SAAS,GAAG,SAAS,CAEvB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,aAAa,CA+BnF"}
package/dist/read.js CHANGED
@@ -288,9 +288,11 @@ export function bootstrapOf(scope) {
288
288
  export function schemaOf(scope, schema) {
289
289
  const file = scope.files.find((entry) => entry.path === schema);
290
290
  if (file === undefined)
291
- return { schema: null, version: null };
291
+ return { schema: null, version: null, revision: null };
292
292
  const content = scope.contents.find((entry) => entry.path === schema);
293
- return content === undefined ? null : { schema: content.content, version: file.version };
293
+ return content === undefined
294
+ ? null
295
+ : { schema: content.content, version: file.version, revision: file.revision ?? null };
294
296
  }
295
297
  export function viewOf(enumeration, tracked) {
296
298
  return enumeration.authorities.find((entry) => entry.authority === tracked.authority);
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,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"}
1
+ {"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAEnE,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAO7D;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,GACnB,aAAa,CAEf;AAmBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG,IAAI,CAMvB;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,CAGpD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAYrF"}
package/dist/refusal.js CHANGED
@@ -12,7 +12,7 @@ export function doorRefusal(body) {
12
12
  export function scopedRefusal(locator, scope, refusal) {
13
13
  return { kind: 'scoped-refusal', locator, scope, code: refusal.code, fields: refusal.fields };
14
14
  }
15
- 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,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a,EAEb,SAAS,EAET,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAgB7D,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC9D,IAAI,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtD,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD,OAAO,CACL,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,EACjB,KAAK,CAAC,EAAE,YAAY,GACnB,mBAAmB,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,MAA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AAS,aAAa,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAChE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5D,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7D,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IACvC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG;IAC3C,MAAM,IAAI,OAAO,CAAC;IAClB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC/C,CAAC"}
package/dist/transport.js CHANGED
@@ -8,4 +8,3 @@ export const SITE_DOOR_DISCOVER = '/_house/door/discover';
8
8
  export const SITE_DOOR_BOOTSTRAP = '/_house/door/bootstrap/';
9
9
  export const SITE_DOOR_ENUMERATE = '/_house/door/enumerate';
10
10
  export const SITE_DOOR_SUBMIT = '/_house/door/submit';
11
- export const PRIVATE_LOCATOR = 'private';
@@ -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,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,CAAA;CAAE,CAAC,GAC7C,CAAC,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,GAAG;IAAE,SAAS,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,CAAC,CAAC;AAE/F,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,gBAAgB,CAyDlB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;IAEjF,IAAI,EAAE,UAAU;IAChB,QAAQ;IACR,IAAI;IACJ,MAAM;QAAI,IAAI;;EAEjB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM1B;AAeD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,aAAa,CAgDf"}
package/dist/write.js CHANGED
@@ -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-c5b15f4efd6f3",
3
+ "version": "0.1.0-c617f778a54ad",
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-c30ed2b8e04d5"
28
+ "@agentshouse/mdmodel": "0.1.0-c3d58cb8652e6",
29
+ "@agentshouse/mdruntime": "0.1.0-c0e5d05c64ed4"
30
30
  }
31
31
  }