@agentshouse/mdruntime-adapter 0.1.0-c3d7e0a9f26df → 0.1.0-c3e06d0475d0b

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.
Files changed (85) hide show
  1. package/README.md +2 -2
  2. package/dist/actions.d.ts +4 -2
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +29 -9
  5. package/dist/adapter.d.ts +0 -1
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +160 -164
  8. package/dist/authored-path.d.ts +65 -0
  9. package/dist/authored-path.d.ts.map +1 -0
  10. package/dist/authored-path.js +164 -0
  11. package/dist/chunks.d.ts +36 -0
  12. package/dist/chunks.d.ts.map +1 -0
  13. package/dist/chunks.js +281 -0
  14. package/dist/digest.d.ts +0 -1
  15. package/dist/discovery.d.ts +32 -7
  16. package/dist/discovery.d.ts.map +1 -1
  17. package/dist/discovery.js +203 -29
  18. package/dist/history.d.ts +1 -7
  19. package/dist/history.d.ts.map +1 -1
  20. package/dist/history.js +24 -30
  21. package/dist/index.d.ts +7 -8
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +6 -6
  24. package/dist/map.d.ts +0 -1
  25. package/dist/model.d.ts +6 -9
  26. package/dist/model.d.ts.map +1 -1
  27. package/dist/model.js +28 -26
  28. package/dist/read.d.ts +20 -24
  29. package/dist/read.d.ts.map +1 -1
  30. package/dist/read.js +103 -173
  31. package/dist/refusal.d.ts +6 -2
  32. package/dist/refusal.d.ts.map +1 -1
  33. package/dist/refusal.js +28 -7
  34. package/dist/room-query.d.ts +4 -0
  35. package/dist/room-query.d.ts.map +1 -0
  36. package/dist/room-query.js +51 -0
  37. package/dist/search.d.ts +4 -0
  38. package/dist/search.d.ts.map +1 -0
  39. package/dist/search.js +47 -0
  40. package/dist/session-content/check.d.ts +17 -0
  41. package/dist/session-content/index.d.ts +6 -0
  42. package/dist/session-content/parts.d.ts +30 -0
  43. package/dist/session-content/state.d.ts +59 -0
  44. package/dist/session-content/turn.d.ts +137 -0
  45. package/dist/site.d.ts +0 -1
  46. package/dist/site.d.ts.map +1 -1
  47. package/dist/site.js +73 -51
  48. package/dist/space-schema.d.ts +6 -0
  49. package/dist/space-schema.d.ts.map +1 -0
  50. package/dist/space-schema.js +11 -0
  51. package/dist/stream.d.ts +4 -4
  52. package/dist/stream.d.ts.map +1 -1
  53. package/dist/stream.js +160 -78
  54. package/dist/transport.d.ts +64 -32
  55. package/dist/transport.d.ts.map +1 -1
  56. package/dist/transport.js +50 -13
  57. package/dist/uncertain.d.ts +5 -0
  58. package/dist/uncertain.d.ts.map +1 -0
  59. package/dist/uncertain.js +11 -0
  60. package/dist/upload.d.ts +7 -2
  61. package/dist/upload.d.ts.map +1 -1
  62. package/dist/upload.js +49 -6
  63. package/dist/version.d.ts +0 -1
  64. package/dist/write.d.ts +2 -3
  65. package/dist/write.d.ts.map +1 -1
  66. package/dist/write.js +37 -54
  67. package/package.json +3 -2
  68. package/dist/app-reference.d.ts +0 -2
  69. package/dist/app-reference.d.ts.map +0 -1
  70. package/dist/app-reference.js +0 -2
  71. package/dist/crockford.d.ts +0 -4
  72. package/dist/crockford.d.ts.map +0 -1
  73. package/dist/crockford.js +0 -3
  74. package/dist/house-model.d.ts +0 -2915
  75. package/dist/house-model.d.ts.map +0 -1
  76. package/dist/house-model.js +0 -1603
  77. package/dist/part.d.ts +0 -14
  78. package/dist/part.d.ts.map +0 -1
  79. package/dist/part.js +0 -90
  80. package/dist/room-stream.d.ts +0 -19
  81. package/dist/room-stream.d.ts.map +0 -1
  82. package/dist/room-stream.js +0 -57
  83. package/dist/room-types.d.ts +0 -7
  84. package/dist/room-types.d.ts.map +0 -1
  85. package/dist/room-types.js +0 -126
package/dist/stream.js CHANGED
@@ -1,37 +1,42 @@
1
1
  import { ROW_WEIGHT, stepped, } from '@agentshouse/mdruntime';
2
- import { acceptedMessage, cursorPosition, houseHistory } from './history.js';
3
- import { streamedModels } from './model.js';
4
- import { answered, answering, binaryFileOf, folded, forgotten, headChange, revised, } from './read.js';
5
- import { houseDoorRoute, } from './transport.js';
6
- import { DECIMAL, roomVersion } from './version.js';
2
+ import { acceptedMessage, changeCursor, houseHistory } from './history.js';
3
+ import { spaceSchemaTexts, streamedModels } from './model.js';
4
+ import { spaceSchemas } from './space-schema.js';
5
+ import { answered, answering, documentEntry, folded, forgotten, kept, } from './read.js';
6
+ import { DECIMAL, logPosition, presented, roomVersion } from './version.js';
7
7
  function turnOperation(frame) {
8
- const { type: _type, conversation_id: _conversation, turn_id: _turn, ...operation } = frame;
9
- return structuredClone(operation);
8
+ return 'at' in frame ? { op: 'begin', at: frame.at } : structuredClone(frame.operation);
10
9
  }
11
- async function houseAgents(transport) {
12
- const answer = await transport.door(houseDoorRoute('agents/read'), {});
13
- const agents = answer.status === 200 ? answer.body?.agents : null;
14
- if (!Array.isArray(agents))
15
- return null;
16
- return agents.flatMap((one) => {
17
- const { id, name, retired_at: retired } = (one ?? {});
18
- return typeof id === 'string' && typeof name === 'string'
19
- ? [{ agent: id, name, retired: retired !== null && retired !== undefined }]
20
- : [];
21
- });
10
+ function listedAgent(agent) {
11
+ return {
12
+ id: agent.id,
13
+ name: agent.name,
14
+ revision: agent.revision,
15
+ environment: agent.environment,
16
+ environment_name: agent.environment_name,
17
+ environment_connected: agent.environment_connected,
18
+ launch_directory: agent.launch_directory,
19
+ cli: agent.cli,
20
+ model: agent.model,
21
+ effort: agent.effort,
22
+ mode: agent.mode,
23
+ base_instructions: agent.base_instructions,
24
+ in_telegram: agent.in_telegram,
25
+ created: agent.created,
26
+ retired_at: agent.retired_at,
27
+ };
22
28
  }
23
29
  function listedConversation(listed) {
24
30
  return {
25
31
  conversation: listed.conversation_id,
26
32
  agent: listed.agent_id,
27
- agentName: listed.agent_name,
28
- agentRetired: listed.agent_retired,
29
33
  name: listed.name,
30
34
  created: listed.created_at,
31
- finished: listed.finished_at,
32
35
  outcome: listed.outcome,
33
36
  waiting: listed.waiting,
34
- newest: listed.newest === null ? null : cursorPosition(listed.newest),
37
+ newest: listed.newest === null ? null : changeCursor(listed.newest),
38
+ processEnded: listed.process_ended_at,
39
+ subject: listed.subject,
35
40
  };
36
41
  }
37
42
  function position(value) {
@@ -39,57 +44,67 @@ function position(value) {
39
44
  return null;
40
45
  return BigInt(value);
41
46
  }
42
- function* changed(tracked, entries, version, schemas) {
47
+ function* changed(tracked, entries, version, mode, schemas) {
43
48
  const answer = answering();
44
49
  for (const entry of entries) {
45
- yield ROW_WEIGHT + (entry.text?.length ?? 0);
50
+ yield ROW_WEIGHT + (entry.content?.length ?? 0);
46
51
  if (entry.kind === 'folder') {
47
52
  folded(answer, entry.path, entry.removed === true);
48
53
  continue;
49
54
  }
50
- if (entry.path === tracked.schema)
51
- schemas.set(entry.path, entry);
52
- forgotten(answer, entry.path);
53
55
  if (entry.kind === 'removed') {
56
+ if (entry.path === tracked.schema)
57
+ schemas.set(entry.path, null);
58
+ forgotten(answer, entry.path);
54
59
  answer.removals.add(entry.path);
55
60
  continue;
56
61
  }
57
- const binary = binaryFileOf(entry);
58
- if (binary === undefined)
59
- answer.documents.set(entry.path, entry.text ?? '');
60
- else if (binary !== null)
61
- answer.binaryFiles.set(entry.path, binary);
62
- const revision = entry.revision ?? binary?.sha256;
63
- if (revision !== undefined)
64
- revised(answer, entry.path, revision);
65
- const head = headChange(entry);
66
- if (head)
67
- answer.changes.set(entry.path, head);
62
+ const file = documentEntry(entry, mode);
63
+ if (file === null)
64
+ throw new Error(`the stream carried ${entry.path} as no file`);
65
+ if (entry.path === tracked.schema)
66
+ schemas.set(entry.path, file);
67
+ forgotten(answer, file.path);
68
+ if (file.space === undefined)
69
+ kept(answer, file);
70
+ else
71
+ answer.removals.add(file.path);
68
72
  }
69
73
  return { kind: 'net-advancement', roomVersion: version, ...(yield* answered(answer)) };
70
74
  }
71
- async function changePage(tracked, entries, version, mode) {
75
+ async function changePage(tracked, entries, version, mode, whole) {
72
76
  const schemas = new Map();
73
- const page = await stepped(changed(tracked, entries, version, schemas));
74
- const models = await streamedModels(schemas, tracked, mode);
77
+ const page = await stepped(changed(tracked, entries, version, mode, schemas));
78
+ const models = await streamedModels(schemas, tracked, whole);
75
79
  return models === undefined ? page : { ...page, models };
76
80
  }
77
81
  export function houseNotifications(transport, mode, discovering) {
78
82
  const stream = transport.stream;
79
83
  const staged = new Map();
84
+ let spaces = spaceSchemas();
80
85
  let socket = null;
81
86
  const tracking = new Map();
87
+ const located = new Map();
82
88
  const observers = new Set();
89
+ const replaying = new Map();
83
90
  const conversationObservers = new Set();
84
91
  const modeObservers = new Set();
85
92
  let replicated = [];
93
+ let listedCursor = null;
94
+ const unanswered = [];
95
+ const heldAtZero = new Set();
86
96
  const live = new Set();
87
97
  let opening = null;
88
98
  let announced = null;
89
99
  const runtime = crypto.randomUUID();
90
100
  function emit(event) {
91
- for (const observer of observers)
92
- observer(event);
101
+ for (const observer of observers) {
102
+ const held = replaying.get(observer);
103
+ if (held === undefined)
104
+ observer(event);
105
+ else
106
+ held.push(event);
107
+ }
93
108
  }
94
109
  function emitConversation(event) {
95
110
  if (event.kind === 'turn' ||
@@ -98,8 +113,7 @@ export function houseNotifications(transport, mode, discovering) {
98
113
  event.kind === 'commands' ||
99
114
  event.kind === 'options' ||
100
115
  event.kind === 'starting' ||
101
- event.kind === 'subagents' ||
102
- event.kind === 'link' ||
116
+ event.kind === 'state' ||
103
117
  event.kind === 'deliveries') {
104
118
  live.add(event.conversation);
105
119
  }
@@ -111,6 +125,9 @@ export function houseNotifications(transport, mode, discovering) {
111
125
  announced = null;
112
126
  socket = next;
113
127
  staged.clear();
128
+ spaces = spaceSchemas();
129
+ unanswered.length = 0;
130
+ heldAtZero.clear();
114
131
  const gapped = new Set([...replicated, ...live]);
115
132
  live.clear();
116
133
  for (const conversation of gapped)
@@ -129,9 +146,9 @@ export function houseNotifications(transport, mode, discovering) {
129
146
  }
130
147
  announced = { kind: 'discovered', discovery };
131
148
  emit(announced);
132
- }, () => {
149
+ }, (failure) => {
133
150
  if (socket === via)
134
- via.close();
151
+ via.close(failure);
135
152
  });
136
153
  }
137
154
  function converse(frame) {
@@ -151,7 +168,7 @@ export function houseNotifications(transport, mode, discovering) {
151
168
  return;
152
169
  emitConversation({ kind: 'commands', conversation, commands: [] });
153
170
  emitConversation({ kind: 'options', conversation, options: [] });
154
- emitConversation({ kind: 'subagents', conversation, subagents: [] });
171
+ emitConversation({ kind: 'state', conversation, state: null });
155
172
  return;
156
173
  }
157
174
  if (frame.type === 'commands') {
@@ -170,20 +187,17 @@ export function houseNotifications(transport, mode, discovering) {
170
187
  emitConversation({ kind: 'starting', conversation, step: frame.step });
171
188
  return;
172
189
  }
173
- if (frame.type === 'subagents') {
174
- emitConversation({
175
- kind: 'subagents',
176
- conversation,
177
- subagents: structuredClone(frame.subagents),
178
- });
179
- return;
180
- }
181
- if (frame.type === 'link') {
182
- emitConversation({ kind: 'link', conversation, connected: frame.connected });
190
+ if (frame.type === 'state') {
191
+ emitConversation({ kind: 'state', conversation, state: structuredClone(frame.state) });
183
192
  return;
184
193
  }
185
194
  if (frame.type === 'deliveries') {
186
- emitConversation({ kind: 'deliveries', conversation, unknown: [...frame.unknown] });
195
+ emitConversation({
196
+ kind: 'deliveries',
197
+ conversation,
198
+ waiting: [...frame.waiting],
199
+ unknown: [...frame.unknown],
200
+ });
187
201
  return;
188
202
  }
189
203
  if (frame.type === 'interactions') {
@@ -200,6 +214,7 @@ export function houseNotifications(transport, mode, discovering) {
200
214
  emitConversation({ kind: 'accepted-message', conversation, message });
201
215
  }
202
216
  function stage(frame, via) {
217
+ const entries = spaceSchemaTexts(frame.entries, spaces);
203
218
  const held = staged.get(frame.carry);
204
219
  if (frame.index !== (held?.parts ?? 0)) {
205
220
  staged.delete(frame.carry);
@@ -212,7 +227,7 @@ export function houseNotifications(transport, mode, discovering) {
212
227
  }
213
228
  }
214
229
  const next = held ?? { authority: frame.authority, parts: 0, entries: [] };
215
- next.entries.push(...frame.entries);
230
+ next.entries.push(...entries);
216
231
  next.parts += 1;
217
232
  staged.set(frame.carry, next);
218
233
  via?.received(frame.authority, frame.carry, frame.index);
@@ -239,12 +254,18 @@ export function houseNotifications(transport, mode, discovering) {
239
254
  return;
240
255
  }
241
256
  if (frame.type === 'caught_up') {
257
+ const expired = frame.expired.flatMap((authority) => tracking.get(authority) ?? []);
258
+ discovering.expired?.(expired);
242
259
  emit({
243
260
  kind: 'caught-up',
244
- expired: frame.expired.flatMap((authority) => (tracking.get(authority) ?? []).map((tracked) => tracked.locator)),
261
+ expired: [...expired.map(({ locator }) => locator), ...(unanswered.shift() ?? [])],
245
262
  });
246
263
  return;
247
264
  }
265
+ if (frame.type === 'report') {
266
+ emit({ kind: 'reported' });
267
+ return;
268
+ }
248
269
  if (frame.type === 'authority_changed') {
249
270
  const change = discovering.changed(frame);
250
271
  if (change !== null)
@@ -252,13 +273,24 @@ export function houseNotifications(transport, mode, discovering) {
252
273
  return;
253
274
  }
254
275
  if (frame.type === 'conversations') {
255
- emitConversation({ kind: 'list', entries: frame.conversations.map(listedConversation) });
276
+ emitConversation({
277
+ kind: 'list',
278
+ agents: frame.agents.map(listedAgent),
279
+ entries: frame.conversations.map(listedConversation),
280
+ whole: frame.whole,
281
+ more: frame.more,
282
+ cursor: frame.cursor,
283
+ });
256
284
  return;
257
285
  }
258
286
  if (frame.type === 'conversation') {
259
287
  emitConversation({ kind: 'listed', entry: listedConversation(frame.conversation) });
260
288
  return;
261
289
  }
290
+ if (frame.type === 'agent') {
291
+ emitConversation({ kind: 'agent', agent: listedAgent(frame.agent) });
292
+ return;
293
+ }
262
294
  if (frame.type === 'conversation_deleted') {
263
295
  emitConversation({ kind: 'unlisted', conversation: frame.conversation_id });
264
296
  return;
@@ -268,8 +300,7 @@ export function houseNotifications(transport, mode, discovering) {
268
300
  frame.type === 'commands' ||
269
301
  frame.type === 'options' ||
270
302
  frame.type === 'starting' ||
271
- frame.type === 'subagents' ||
272
- frame.type === 'link' ||
303
+ frame.type === 'state' ||
273
304
  frame.type === 'deliveries' ||
274
305
  frame.type === 'interactions' ||
275
306
  frame.type === 'message') {
@@ -286,7 +317,9 @@ export function houseNotifications(transport, mode, discovering) {
286
317
  const after = position(frame.after);
287
318
  if (at === null || after === null || after >= at)
288
319
  return;
289
- const from = roomVersion({ position: frame.after, logEpoch: frame.log_epoch });
320
+ const from = after === 0n && !heldAtZero.has(frame.authority)
321
+ ? null
322
+ : roomVersion({ position: frame.after, logEpoch: frame.log_epoch });
290
323
  const version = roomVersion({ position: frame.position, logEpoch: frame.log_epoch });
291
324
  for (const tracked of tracking.get(frame.authority) ?? []) {
292
325
  emit({
@@ -294,18 +327,21 @@ export function houseNotifications(transport, mode, discovering) {
294
327
  locator: tracked.locator,
295
328
  from,
296
329
  roomVersion: version,
297
- read: () => changePage(tracked, entries, version, mode),
330
+ read: () => changePage(tracked, entries, version, mode, from === null),
298
331
  });
299
332
  }
300
333
  }
301
334
  stream.observe((frame) => handle(frame, socket));
302
335
  stream.opened(reopened);
303
- stream.closed(({ revoked, lost }) => {
336
+ stream.closed(({ revoked, lost, authorityChanged }) => {
304
337
  opening = null;
305
338
  announced = null;
306
339
  socket = null;
307
340
  staged.clear();
308
- emit({ kind: 'closed', revoked, lost });
341
+ spaces = spaceSchemas();
342
+ unanswered.length = 0;
343
+ heldAtZero.clear();
344
+ emit({ kind: 'closed', revoked, lost, authorityChanged });
309
345
  });
310
346
  return {
311
347
  runtime,
@@ -321,26 +357,28 @@ export function houseNotifications(transport, mode, discovering) {
321
357
  replicate(next) {
322
358
  replicated = [...next];
323
359
  },
360
+ hold(cursor) {
361
+ listedCursor = cursor;
362
+ },
324
363
  observe(notify) {
325
364
  conversationObservers.add(notify);
326
365
  return () => {
327
366
  conversationObservers.delete(notify);
328
367
  };
329
368
  },
330
- ...(mode === 'credential'
331
- ? {
332
- agents: () => houseAgents(transport),
333
- history: (request) => houseHistory(transport, request),
334
- }
335
- : {}),
369
+ ...(mode === 'credential' ? { history: (request) => houseHistory(transport, request) } : {}),
336
370
  },
337
371
  observe(notify) {
338
372
  observers.add(notify);
339
- const replayed = opening === null ? [] : [{ kind: 'opened' }, announced];
340
- if (replayed.length > 0) {
373
+ if (opening !== null) {
374
+ const replayed = [{ kind: 'opened' }];
375
+ if (announced !== null)
376
+ replayed.push(announced);
377
+ replaying.set(notify, replayed);
341
378
  queueMicrotask(() => {
379
+ replaying.delete(notify);
342
380
  for (const event of replayed)
343
- if (event !== null && observers.has(notify))
381
+ if (observers.has(notify))
344
382
  notify(event);
345
383
  });
346
384
  }
@@ -351,13 +389,57 @@ export function houseNotifications(transport, mode, discovering) {
351
389
  send(rooms) {
352
390
  opening = null;
353
391
  announced = null;
354
- socket?.hold(rooms, runtime);
392
+ if (socket === null)
393
+ return;
394
+ const named = rooms.flatMap((room) => {
395
+ const entry = located.get(room.locator);
396
+ const at = room.roomVersion === null ? null : logPosition(room.roomVersion);
397
+ return entry === undefined || at === null ? [] : [{ entry, at }];
398
+ });
399
+ const unheld = rooms.flatMap((room) => {
400
+ const entry = located.get(room.locator);
401
+ return entry === undefined || room.roomVersion !== null ? [] : [entry];
402
+ });
403
+ for (const { entry, at } of named) {
404
+ if (at.position === '0')
405
+ heldAtZero.add(entry.authority);
406
+ else
407
+ heldAtZero.delete(entry.authority);
408
+ }
409
+ for (const entry of unheld)
410
+ heldAtZero.delete(entry.authority);
411
+ const site = mode === 'site';
412
+ unanswered.push(site ? unheld.map((entry) => entry.locator) : []);
413
+ socket.hold([
414
+ ...named.map(({ entry, at }) => presented(entry.authority, at)),
415
+ ...(site ? [] : unheld).map((entry) => presented(entry.authority, { position: '0', logEpoch: entry.logEpoch })),
416
+ ], runtime, listedCursor);
417
+ if (site)
418
+ return;
419
+ const made = unheld.filter((entry) => entry.position === '0');
420
+ queueMicrotask(() => {
421
+ for (const entry of made) {
422
+ const version = roomVersion(entry);
423
+ emit({
424
+ kind: 'room-change',
425
+ locator: entry.locator,
426
+ from: null,
427
+ roomVersion: version,
428
+ read: () => changePage(entry, [], version, mode, true),
429
+ });
430
+ }
431
+ });
355
432
  },
356
433
  track(entries) {
357
434
  tracking.clear();
435
+ located.clear();
358
436
  for (const entry of entries) {
359
437
  tracking.set(entry.authority, [...(tracking.get(entry.authority) ?? []), entry]);
360
438
  }
439
+ for (const held of tracking.values()) {
440
+ for (const entry of held)
441
+ located.set(entry.locator, entry);
442
+ }
361
443
  for (const [carry, held] of staged) {
362
444
  if (!tracking.has(held.authority))
363
445
  staged.delete(carry);
@@ -1,28 +1,37 @@
1
- import type { ConversationEvent, TurnOperation } from '@agentshouse/mdruntime';
1
+ import type { ConversationEvent, ListedAgent, SavedFacts } from '@agentshouse/mdruntime';
2
+ import type { Operation, SessionState } from './session-content/index.js';
2
3
  export declare const HOUSE_RUNTIME_READS: {
3
- readonly acts: readonly ['account/push', 'agents/read', 'apps/features/set', 'apps/source/download', 'apps/source/top', 'batch', 'batch-upload', 'bootstrap', 'conversations/history', 'discover', 'files/attach', 'files/finish', 'files/get', 'revisions', 'sites/screenshot/read'];
4
- readonly frames: readonly ['app-message', 'authority_changed', 'carried', 'caught_up', 'commands', 'conversation', 'conversation_deleted', 'conversations', 'deliveries', 'deployment', 'held', 'interactions', 'link', 'message', 'opening', 'options', 'part', 'process', 'received', 'signal', 'site', 'starting', 'subagents', 'tab-icon', 'turn'];
4
+ readonly acts: readonly ['account/push/set', 'account/time-zone/set', 'apps/features/set', 'apps/source/download', 'apps/source/top/read', 'conversations/history/list', 'files/attach', 'files/finish', 'files/read', 'files/revisions/list', 'info', 'room-chunks/list', 'rooms/discover', 'rooms/search', 'sites/screenshot/read', 'update'];
5
+ readonly frames: readonly ['agent', 'app-message', 'app-rooms', 'authority_changed', 'carried', 'caught_up', 'commands', 'conversation', 'conversation_deleted', 'conversations', 'deliveries', 'deployment', 'held', 'interactions', 'message', 'opening', 'options', 'part', 'process', 'received', 'report', 'signal', 'site', 'starting', 'state', 'tab-icon', 'turn'];
5
6
  };
6
7
  export type HouseRuntimeAct = (typeof HOUSE_RUNTIME_READS.acts)[number];
7
8
  export type HouseRuntimeFrame = (typeof HOUSE_RUNTIME_READS.frames)[number];
8
9
  export declare function houseDoorRoute(act: HouseRuntimeAct): string;
9
- export declare function houseSiteRoute(act: Extract<HouseRuntimeAct, 'bootstrap' | 'discover'>): string;
10
- export declare const SITE_SUBMISSION = "site/submission";
10
+ export declare function houseSiteRoute(act: 'chunks' | 'discover' | 'query'): string;
11
+ export declare const SITE_QUERY = "query";
12
+ export declare const SITE_FRESH_QUERY = "fresh";
13
+ export declare const SITE_QUERY_ROUTE_CHARACTERS = 12000;
14
+ export declare function siteQueryRoute(room: string, query: Readonly<Record<string, unknown>>, fresh?: boolean): string;
15
+ export declare function siteQueryAsked(address: string): Readonly<Record<string, unknown>> | null;
16
+ export declare const SITES_SUBMISSIONS_CREATE = "sites/submissions/create";
11
17
  export declare const SITE_DOOR_SUBMIT = "/_house/door/submit";
18
+ export declare const SITES_FUNCTIONS_CALL = "sites/functions/call";
19
+ export declare const SITE_DOOR_FUNCTION = "/_house/door/function";
20
+ export declare const SITE_DOOR_ACTS: Readonly<Record<string, string>>;
12
21
  export type HouseMode = 'credential' | 'site';
13
22
  export type HouseDoorAnswer = {
14
23
  status: number;
15
24
  body: unknown;
16
25
  };
17
26
  export declare const SITE_FILES = "/_house/files/";
18
- export type HouseByteAct = 'authored_batch_upload';
27
+ export declare const SITE_IMAGE_COPIES_HEADER = "X-House-Image-Copies";
19
28
  export type HouseBytesAnswer = {
20
29
  status: number;
21
30
  body: ReadableStream<Uint8Array> | null;
22
31
  mediaType: string;
32
+ copies?: string | null;
23
33
  };
24
34
  export type HouseByteTransfer = {
25
- act: HouseByteAct;
26
35
  url: string;
27
36
  body: string;
28
37
  };
@@ -32,7 +41,6 @@ export type HouseStreamEntry = {
32
41
  removed?: true;
33
42
  revision?: string;
34
43
  sha256?: string;
35
- text?: string;
36
44
  bytes?: number;
37
45
  media_type?: string;
38
46
  author?: {
@@ -41,8 +49,22 @@ export type HouseStreamEntry = {
41
49
  } | {
42
50
  site: string;
43
51
  name: string;
52
+ } | {
53
+ inbox: string;
54
+ name: string;
55
+ } | {
56
+ app: string;
57
+ function: string;
58
+ release: string;
59
+ name: string;
44
60
  };
61
+ changed_at?: string;
45
62
  created_at?: string;
63
+ content?: string;
64
+ provenance?: string;
65
+ facts?: SavedFacts;
66
+ move?: 'arrival' | 'leaving';
67
+ space?: string;
46
68
  };
47
69
  type LiveFact<K extends ConversationEvent['kind']> = Extract<ConversationEvent, {
48
70
  kind: K;
@@ -50,17 +72,13 @@ type LiveFact<K extends ConversationEvent['kind']> = Extract<ConversationEvent,
50
72
  export type HouseListedConversation = {
51
73
  conversation_id: string;
52
74
  agent_id: string;
53
- agent_name: string;
54
- agent_retired: boolean;
55
75
  name: string;
56
76
  created_at: string;
57
- finished_at: string | null;
58
77
  outcome: string | null;
59
78
  waiting: boolean;
60
- newest: {
61
- accepted_at: string;
62
- message_id: string;
63
- } | null;
79
+ newest: number | null;
80
+ process_ended_at: string | null;
81
+ subject: string | null;
64
82
  };
65
83
  type Listed<Frame extends {
66
84
  readonly type: HouseRuntimeFrame;
@@ -82,22 +100,35 @@ export type HouseStreamFrame = Listed<{
82
100
  } | {
83
101
  type: 'opening';
84
102
  member: unknown;
103
+ time_zone: unknown;
85
104
  bounds: unknown;
86
105
  actions: readonly unknown[];
87
- authorities: readonly unknown[];
106
+ shapes: readonly unknown[];
107
+ rooms: readonly unknown[];
108
+ listed: readonly unknown[];
109
+ spaces: readonly unknown[];
88
110
  } | {
89
111
  type: 'caught_up';
90
112
  expired: readonly string[];
91
113
  } | {
92
114
  type: 'authority_changed';
93
115
  member: unknown;
116
+ time_zone: unknown;
94
117
  authorities: readonly unknown[];
118
+ listed: readonly unknown[];
119
+ spaces: readonly unknown[];
95
120
  left: readonly string[];
96
- } | ({
121
+ } | {
122
+ type: 'turn';
123
+ conversation_id: string;
124
+ turn_id: string;
125
+ at: string;
126
+ } | {
97
127
  type: 'turn';
98
128
  conversation_id: string;
99
129
  turn_id: string;
100
- } & TurnOperation) | {
130
+ operation: Operation;
131
+ } | {
101
132
  type: 'message';
102
133
  conversation_id: string;
103
134
  message: unknown;
@@ -108,6 +139,7 @@ export type HouseStreamFrame = Listed<{
108
139
  } | {
109
140
  type: 'deliveries';
110
141
  conversation_id: string;
142
+ waiting: readonly string[];
111
143
  unknown: readonly string[];
112
144
  } | {
113
145
  type: 'process';
@@ -126,25 +158,30 @@ export type HouseStreamFrame = Listed<{
126
158
  conversation_id: string;
127
159
  step: string | null;
128
160
  } | {
129
- type: 'subagents';
130
- conversation_id: string;
131
- subagents: LiveFact<'subagents'>['subagents'];
132
- } | {
133
- type: 'link';
161
+ type: 'state';
134
162
  conversation_id: string;
135
- connected: boolean;
163
+ state: SessionState;
136
164
  } | {
137
165
  type: 'conversations';
166
+ agents: readonly ListedAgent[];
138
167
  conversations: readonly HouseListedConversation[];
168
+ whole: boolean;
169
+ more: boolean;
170
+ cursor: string | null;
139
171
  } | {
140
172
  type: 'conversation';
141
173
  conversation: HouseListedConversation;
174
+ } | {
175
+ type: 'agent';
176
+ agent: ListedAgent;
142
177
  } | {
143
178
  type: 'conversation_deleted';
144
179
  conversation_id: string;
145
180
  } | {
146
181
  type: 'signal';
147
182
  service_mode: string;
183
+ } | {
184
+ type: 'report';
148
185
  }>;
149
186
  export type HouseHeldRoom = {
150
187
  authority: string;
@@ -152,28 +189,25 @@ export type HouseHeldRoom = {
152
189
  log_epoch: string;
153
190
  };
154
191
  export type HouseOpening = {
155
- hold(rooms: readonly HouseHeldRoom[], runtime: string): void;
192
+ hold(rooms: readonly HouseHeldRoom[], runtime: string, conversations: string | null): void;
156
193
  received(authority: string, carry: string, index: number): void;
157
- close(): void;
194
+ close(failure?: unknown): void;
158
195
  };
159
196
  export type HouseClosing = {
160
197
  revoked: boolean;
161
198
  lost: boolean;
199
+ authorityChanged: boolean;
162
200
  };
163
201
  export type HouseStream = {
164
202
  observe(receive: (frame: HouseStreamFrame) => void): () => void;
165
203
  opened(notify: (opening: HouseOpening) => void): () => void;
166
204
  closed(notify: (closing: HouseClosing) => void): () => void;
167
205
  };
168
- export type HouseStreamed = HouseDoorAnswer & {
169
- room: ReadableStream<Uint8Array> | null;
170
- };
171
206
  export type HouseDoor = {
172
207
  door(route: string, body: unknown): Promise<HouseDoorAnswer>;
173
208
  stream: HouseStream;
174
209
  };
175
210
  export type HouseTransport = HouseDoor & {
176
- streamed(route: string, body: unknown, signal: AbortSignal): Promise<HouseStreamed>;
177
211
  transfer(request: HouseByteTransfer): Promise<HouseDoorAnswer>;
178
212
  put(url: string, body: Blob, headers: Readonly<Record<string, string>>): Promise<number>;
179
213
  download(url: string): Promise<HouseBytesAnswer>;
@@ -181,8 +215,6 @@ export type HouseTransport = HouseDoor & {
181
215
  export type HouseSiteTransport = HouseDoor & {
182
216
  online(): boolean;
183
217
  read(route: string): Promise<HouseDoorAnswer>;
184
- streamed(route: string, signal: AbortSignal): Promise<HouseStreamed>;
185
218
  download(route: string): Promise<HouseBytesAnswer>;
186
219
  };
187
220
  export {};
188
- //# sourceMappingURL=transport.d.ts.map