@agentshouse/mdruntime-adapter 0.1.0-cd0b0339c1003 → 0.1.0-cd1a679949dfc

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 (82) hide show
  1. package/README.md +2 -2
  2. package/dist/actions.d.ts +9 -1
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +189 -12
  5. package/dist/adapter.d.ts +0 -1
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +134 -122
  8. package/dist/authored-path.d.ts +61 -0
  9. package/dist/authored-path.d.ts.map +1 -0
  10. package/dist/authored-path.js +166 -0
  11. package/dist/chunks.d.ts +2 -4
  12. package/dist/chunks.d.ts.map +1 -1
  13. package/dist/chunks.js +72 -38
  14. package/dist/digest.d.ts +0 -1
  15. package/dist/discovery.d.ts +26 -8
  16. package/dist/discovery.d.ts.map +1 -1
  17. package/dist/discovery.js +174 -26
  18. package/dist/history.d.ts +1 -7
  19. package/dist/history.d.ts.map +1 -1
  20. package/dist/history.js +21 -28
  21. package/dist/index.d.ts +8 -10
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +7 -8
  24. package/dist/map.d.ts +0 -1
  25. package/dist/model.d.ts +5 -6
  26. package/dist/model.d.ts.map +1 -1
  27. package/dist/model.js +18 -28
  28. package/dist/read.d.ts +11 -25
  29. package/dist/read.d.ts.map +1 -1
  30. package/dist/read.js +74 -47
  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/renamed.d.ts +10 -0
  35. package/dist/renamed.d.ts.map +1 -0
  36. package/dist/renamed.js +20 -0
  37. package/dist/room-query.d.ts +4 -0
  38. package/dist/room-query.d.ts.map +1 -0
  39. package/dist/room-query.js +63 -0
  40. package/dist/search.d.ts +0 -1
  41. package/dist/search.d.ts.map +1 -1
  42. package/dist/search.js +4 -4
  43. package/dist/session-content/check.d.ts +17 -0
  44. package/dist/session-content/index.d.ts +6 -0
  45. package/dist/session-content/parts.d.ts +30 -0
  46. package/dist/session-content/state.d.ts +59 -0
  47. package/dist/session-content/turn.d.ts +137 -0
  48. package/dist/site.d.ts +0 -1
  49. package/dist/site.d.ts.map +1 -1
  50. package/dist/site.js +61 -23
  51. package/dist/space-schema.d.ts +0 -1
  52. package/dist/space-schema.d.ts.map +1 -1
  53. package/dist/space-schema.js +1 -8
  54. package/dist/stream.d.ts +4 -5
  55. package/dist/stream.d.ts.map +1 -1
  56. package/dist/stream.js +150 -89
  57. package/dist/transport.d.ts +76 -25
  58. package/dist/transport.d.ts.map +1 -1
  59. package/dist/transport.js +47 -10
  60. package/dist/uncertain.d.ts +5 -0
  61. package/dist/uncertain.d.ts.map +1 -0
  62. package/dist/uncertain.js +11 -0
  63. package/dist/upload.d.ts +7 -2
  64. package/dist/upload.d.ts.map +1 -1
  65. package/dist/upload.js +49 -6
  66. package/dist/version.d.ts +0 -1
  67. package/dist/write.d.ts +3 -10
  68. package/dist/write.d.ts.map +1 -1
  69. package/dist/write.js +90 -110
  70. package/package.json +4 -3
  71. package/dist/app-reference.d.ts +0 -2
  72. package/dist/app-reference.d.ts.map +0 -1
  73. package/dist/app-reference.js +0 -2
  74. package/dist/crockford.d.ts +0 -4
  75. package/dist/crockford.d.ts.map +0 -1
  76. package/dist/crockford.js +0 -3
  77. package/dist/house-model.d.ts +0 -682
  78. package/dist/house-model.d.ts.map +0 -1
  79. package/dist/house-model.js +0 -396
  80. package/dist/room-types.d.ts +0 -5
  81. package/dist/room-types.d.ts.map +0 -1
  82. package/dist/room-types.js +0 -120
package/dist/stream.js CHANGED
@@ -1,38 +1,63 @@
1
+ import { parse } from '@agentshouse/mdmodel';
1
2
  import { ROW_WEIGHT, stepped, } from '@agentshouse/mdruntime';
2
- import { acceptedMessage, cursorPosition, houseHistory } from './history.js';
3
- import { keptSpaceSchemas, streamedModels } from './model.js';
4
- import { answered, answering, binaryFileOf, createdOf, folded, forgotten, headChange, revised, } from './read.js';
5
- import { houseDoorRoute, } from './transport.js';
3
+ import { acceptedMessage, changeCursor, houseHistory } from './history.js';
4
+ import { spaceSchemaTexts, streamedModels } from './model.js';
5
+ import { spaceSchemas } from './space-schema.js';
6
+ import { answered, answering, documentEntry, folded, forgotten, kept, } from './read.js';
6
7
  import { DECIMAL, logPosition, presented, roomVersion } from './version.js';
8
+ const CURRENT_RUN_STATES = new Set(['awaiting_approval', 'started']);
9
+ const NO_RUN_MARKS = { rooms: {}, sent: null };
10
+ function heardRun(request) {
11
+ const read = parse(`---\n${request.document}---\n`);
12
+ if (!read.ok)
13
+ throw new Error(`the stream carried request ${request.name} as no document`);
14
+ const fields = read.document.fields;
15
+ return {
16
+ room: request.room_ref,
17
+ name: request.name,
18
+ document: request.document,
19
+ current: CURRENT_RUN_STATES.has(fields.state),
20
+ starter: typeof fields.requester === 'string' ? fields.requester : null,
21
+ };
22
+ }
7
23
  function turnOperation(frame) {
8
- const { type: _type, conversation_id: _conversation, turn_id: _turn, ...operation } = frame;
9
- return structuredClone(operation);
24
+ return 'at' in frame ? { op: 'begin', at: frame.at } : structuredClone(frame.operation);
10
25
  }
11
- async function houseAgents(transport) {
12
- const answer = await transport.door(houseDoorRoute('agents/list'), {});
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
- });
26
+ function listedAgent(agent) {
27
+ return {
28
+ id: agent.id,
29
+ name: agent.name,
30
+ revision: agent.revision,
31
+ environment: agent.environment,
32
+ environment_name: agent.environment_name,
33
+ environment_connected: agent.environment_connected,
34
+ launch_directory: agent.launch_directory,
35
+ cli: agent.cli,
36
+ model: agent.model,
37
+ effort: agent.effort,
38
+ model_fixed: agent.model_fixed,
39
+ mode: agent.mode,
40
+ base_instructions: agent.base_instructions,
41
+ in_telegram: agent.in_telegram,
42
+ telegram_messages: agent.telegram_messages,
43
+ created: agent.created,
44
+ retired_at: agent.retired_at,
45
+ };
22
46
  }
23
47
  function listedConversation(listed) {
24
48
  return {
25
49
  conversation: listed.conversation_id,
26
50
  agent: listed.agent_id,
27
- agentName: listed.agent_name,
28
- agentRetired: listed.agent_retired,
29
51
  name: listed.name,
30
52
  created: listed.created_at,
31
- finished: listed.finished_at,
32
53
  outcome: listed.outcome,
33
54
  waiting: listed.waiting,
34
- newest: listed.newest === null ? null : cursorPosition(listed.newest),
55
+ newest: listed.newest === null ? null : changeCursor(listed.newest),
35
56
  processEnded: listed.process_ended_at,
57
+ subject: listed.subject,
58
+ room: listed.room_ref,
59
+ model: listed.model,
60
+ effort: listed.effort,
36
61
  };
37
62
  }
38
63
  function position(value) {
@@ -40,61 +65,55 @@ function position(value) {
40
65
  return null;
41
66
  return BigInt(value);
42
67
  }
43
- function* changed(tracked, entries, version, schemas) {
68
+ function* changed(tracked, entries, version, mode, schemas) {
44
69
  const answer = answering();
45
70
  for (const entry of entries) {
46
- yield ROW_WEIGHT + (entry.text?.length ?? 0);
71
+ yield ROW_WEIGHT + (entry.content?.length ?? 0);
47
72
  if (entry.kind === 'folder') {
48
73
  folded(answer, entry.path, entry.removed === true);
49
74
  continue;
50
75
  }
51
- if (entry.path === tracked.schema)
52
- schemas.set(entry.path, entry);
53
- forgotten(answer, entry.path);
54
- if (entry.space !== undefined) {
55
- answer.removals.add(entry.path);
56
- continue;
57
- }
58
76
  if (entry.kind === 'removed') {
77
+ if (entry.path === tracked.schema)
78
+ schemas.set(entry.path, null);
79
+ forgotten(answer, entry.path);
59
80
  answer.removals.add(entry.path);
60
81
  continue;
61
82
  }
62
- const binary = binaryFileOf(entry);
63
- if (binary === undefined)
64
- answer.documents.set(entry.path, entry.text ?? '');
65
- else if (binary !== null)
66
- answer.binaryFiles.set(entry.path, binary);
67
- if (binary === undefined && entry.facts !== undefined)
68
- answer.facts.set(entry.path, entry.facts);
69
- const revision = entry.revision ?? binary?.sha256;
70
- if (revision !== undefined)
71
- revised(answer, entry.path, revision);
72
- const head = headChange(entry);
73
- if (head)
74
- answer.changes.set(entry.path, head);
75
- const created = createdOf(entry);
76
- if (created)
77
- answer.created.set(entry.path, created);
83
+ const file = documentEntry(entry, mode);
84
+ if (file === null)
85
+ throw new Error(`the stream carried ${entry.path} as no file`);
86
+ if (entry.path === tracked.schema)
87
+ schemas.set(entry.path, file);
88
+ forgotten(answer, file.path);
89
+ if (file.space === undefined)
90
+ kept(answer, file);
91
+ else
92
+ answer.removals.add(file.path);
78
93
  }
79
94
  return { kind: 'net-advancement', roomVersion: version, ...(yield* answered(answer)) };
80
95
  }
81
- async function changePage(tracked, entries, version, mode, spaces, whole) {
96
+ async function changePage(tracked, entries, version, mode, whole) {
82
97
  const schemas = new Map();
83
- const page = await stepped(changed(tracked, entries, version, schemas));
84
- const models = await streamedModels(schemas, tracked, mode, spaces, whole);
98
+ const page = await stepped(changed(tracked, entries, version, mode, schemas));
99
+ const models = await streamedModels(schemas, tracked, whole);
85
100
  return models === undefined ? page : { ...page, models };
86
101
  }
87
- export function houseNotifications(transport, mode, discovering, spaces) {
102
+ export function houseNotifications(transport, mode, discovering) {
88
103
  const stream = transport.stream;
89
104
  const staged = new Map();
105
+ let spaces = spaceSchemas();
90
106
  let socket = null;
91
107
  const tracking = new Map();
108
+ const located = new Map();
92
109
  const observers = new Set();
93
110
  const replaying = new Map();
94
111
  const conversationObservers = new Set();
112
+ const runObservers = new Set();
95
113
  const modeObservers = new Set();
96
114
  let replicated = [];
97
115
  let listedCursor = null;
116
+ let runMarks = NO_RUN_MARKS;
98
117
  const unanswered = [];
99
118
  const heldAtZero = new Set();
100
119
  const live = new Set();
@@ -110,6 +129,10 @@ export function houseNotifications(transport, mode, discovering, spaces) {
110
129
  held.push(event);
111
130
  }
112
131
  }
132
+ function emitRun(event) {
133
+ for (const observer of runObservers)
134
+ observer(event);
135
+ }
113
136
  function emitConversation(event) {
114
137
  if (event.kind === 'turn' ||
115
138
  event.kind === 'questions' ||
@@ -117,8 +140,7 @@ export function houseNotifications(transport, mode, discovering, spaces) {
117
140
  event.kind === 'commands' ||
118
141
  event.kind === 'options' ||
119
142
  event.kind === 'starting' ||
120
- event.kind === 'subagents' ||
121
- event.kind === 'link' ||
143
+ event.kind === 'state' ||
122
144
  event.kind === 'deliveries') {
123
145
  live.add(event.conversation);
124
146
  }
@@ -130,6 +152,7 @@ export function houseNotifications(transport, mode, discovering, spaces) {
130
152
  announced = null;
131
153
  socket = next;
132
154
  staged.clear();
155
+ spaces = spaceSchemas();
133
156
  unanswered.length = 0;
134
157
  heldAtZero.clear();
135
158
  const gapped = new Set([...replicated, ...live]);
@@ -150,9 +173,9 @@ export function houseNotifications(transport, mode, discovering, spaces) {
150
173
  }
151
174
  announced = { kind: 'discovered', discovery };
152
175
  emit(announced);
153
- }, () => {
176
+ }, (failure) => {
154
177
  if (socket === via)
155
- via.close();
178
+ via.close(failure);
156
179
  });
157
180
  }
158
181
  function converse(frame) {
@@ -172,7 +195,7 @@ export function houseNotifications(transport, mode, discovering, spaces) {
172
195
  return;
173
196
  emitConversation({ kind: 'commands', conversation, commands: [] });
174
197
  emitConversation({ kind: 'options', conversation, options: [] });
175
- emitConversation({ kind: 'subagents', conversation, subagents: [] });
198
+ emitConversation({ kind: 'state', conversation, state: null });
176
199
  return;
177
200
  }
178
201
  if (frame.type === 'commands') {
@@ -191,20 +214,17 @@ export function houseNotifications(transport, mode, discovering, spaces) {
191
214
  emitConversation({ kind: 'starting', conversation, step: frame.step });
192
215
  return;
193
216
  }
194
- if (frame.type === 'subagents') {
195
- emitConversation({
196
- kind: 'subagents',
197
- conversation,
198
- subagents: structuredClone(frame.subagents),
199
- });
200
- return;
201
- }
202
- if (frame.type === 'link') {
203
- emitConversation({ kind: 'link', conversation, connected: frame.connected });
217
+ if (frame.type === 'state') {
218
+ emitConversation({ kind: 'state', conversation, state: structuredClone(frame.state) });
204
219
  return;
205
220
  }
206
221
  if (frame.type === 'deliveries') {
207
- emitConversation({ kind: 'deliveries', conversation, unknown: [...frame.unknown] });
222
+ emitConversation({
223
+ kind: 'deliveries',
224
+ conversation,
225
+ waiting: [...frame.waiting],
226
+ unknown: [...frame.unknown],
227
+ });
208
228
  return;
209
229
  }
210
230
  if (frame.type === 'interactions') {
@@ -221,6 +241,7 @@ export function houseNotifications(transport, mode, discovering, spaces) {
221
241
  emitConversation({ kind: 'accepted-message', conversation, message });
222
242
  }
223
243
  function stage(frame, via) {
244
+ const entries = spaceSchemaTexts(frame.entries, spaces);
224
245
  const held = staged.get(frame.carry);
225
246
  if (frame.index !== (held?.parts ?? 0)) {
226
247
  staged.delete(frame.carry);
@@ -233,8 +254,7 @@ export function houseNotifications(transport, mode, discovering, spaces) {
233
254
  }
234
255
  }
235
256
  const next = held ?? { authority: frame.authority, parts: 0, entries: [] };
236
- keptSpaceSchemas(frame.entries, spaces);
237
- next.entries.push(...frame.entries);
257
+ next.entries.push(...entries);
238
258
  next.parts += 1;
239
259
  staged.set(frame.carry, next);
240
260
  via?.received(frame.authority, frame.carry, frame.index);
@@ -261,13 +281,35 @@ export function houseNotifications(transport, mode, discovering, spaces) {
261
281
  return;
262
282
  }
263
283
  if (frame.type === 'caught_up') {
264
- discovering.expired?.(frame.expired);
284
+ const expired = frame.expired.flatMap((authority) => tracking.get(authority) ?? []);
285
+ discovering.expired?.(expired);
265
286
  emit({
266
287
  kind: 'caught-up',
267
- expired: [
268
- ...frame.expired.flatMap((authority) => (tracking.get(authority) ?? []).map((tracked) => tracked.locator)),
269
- ...(unanswered.shift() ?? []),
270
- ],
288
+ expired: [...expired.map(({ locator }) => locator), ...(unanswered.shift() ?? [])],
289
+ });
290
+ return;
291
+ }
292
+ if (frame.type === 'report') {
293
+ emit({ kind: 'reported' });
294
+ return;
295
+ }
296
+ if (frame.type === 'request') {
297
+ const room = frame.request.room_ref;
298
+ emitRun({
299
+ kind: 'run',
300
+ run: heardRun(frame.request),
301
+ listing: tracking.has(room) ? room : null,
302
+ });
303
+ return;
304
+ }
305
+ if (frame.type === 'requests') {
306
+ emitRun({
307
+ kind: 'runs',
308
+ listing: frame.room_ref,
309
+ runs: frame.requests.map(heardRun),
310
+ whole: frame.whole,
311
+ more: frame.more,
312
+ mark: frame.cursor,
271
313
  });
272
314
  return;
273
315
  }
@@ -280,6 +322,7 @@ export function houseNotifications(transport, mode, discovering, spaces) {
280
322
  if (frame.type === 'conversations') {
281
323
  emitConversation({
282
324
  kind: 'list',
325
+ agents: frame.agents.map(listedAgent),
283
326
  entries: frame.conversations.map(listedConversation),
284
327
  whole: frame.whole,
285
328
  more: frame.more,
@@ -291,6 +334,10 @@ export function houseNotifications(transport, mode, discovering, spaces) {
291
334
  emitConversation({ kind: 'listed', entry: listedConversation(frame.conversation) });
292
335
  return;
293
336
  }
337
+ if (frame.type === 'agent') {
338
+ emitConversation({ kind: 'agent', agent: listedAgent(frame.agent) });
339
+ return;
340
+ }
294
341
  if (frame.type === 'conversation_deleted') {
295
342
  emitConversation({ kind: 'unlisted', conversation: frame.conversation_id });
296
343
  return;
@@ -300,8 +347,7 @@ export function houseNotifications(transport, mode, discovering, spaces) {
300
347
  frame.type === 'commands' ||
301
348
  frame.type === 'options' ||
302
349
  frame.type === 'starting' ||
303
- frame.type === 'subagents' ||
304
- frame.type === 'link' ||
350
+ frame.type === 'state' ||
305
351
  frame.type === 'deliveries' ||
306
352
  frame.type === 'interactions' ||
307
353
  frame.type === 'message') {
@@ -328,7 +374,7 @@ export function houseNotifications(transport, mode, discovering, spaces) {
328
374
  locator: tracked.locator,
329
375
  from,
330
376
  roomVersion: version,
331
- read: () => changePage(tracked, entries, version, mode, spaces, from === null),
377
+ read: () => changePage(tracked, entries, version, mode, from === null),
332
378
  });
333
379
  }
334
380
  }
@@ -339,6 +385,7 @@ export function houseNotifications(transport, mode, discovering, spaces) {
339
385
  announced = null;
340
386
  socket = null;
341
387
  staged.clear();
388
+ spaces = spaceSchemas();
342
389
  unanswered.length = 0;
343
390
  heldAtZero.clear();
344
391
  emit({ kind: 'closed', revoked, lost, authorityChanged });
@@ -366,12 +413,18 @@ export function houseNotifications(transport, mode, discovering, spaces) {
366
413
  conversationObservers.delete(notify);
367
414
  };
368
415
  },
369
- ...(mode === 'credential'
370
- ? {
371
- agents: () => houseAgents(transport),
372
- history: (request) => houseHistory(transport, request),
373
- }
374
- : {}),
416
+ ...(mode === 'credential' ? { history: (request) => houseHistory(transport, request) } : {}),
417
+ },
418
+ runs: {
419
+ hold(marks) {
420
+ runMarks = marks;
421
+ },
422
+ observe(notify) {
423
+ runObservers.add(notify);
424
+ return () => {
425
+ runObservers.delete(notify);
426
+ };
427
+ },
375
428
  },
376
429
  observe(notify) {
377
430
  observers.add(notify);
@@ -396,14 +449,13 @@ export function houseNotifications(transport, mode, discovering, spaces) {
396
449
  announced = null;
397
450
  if (socket === null)
398
451
  return;
399
- const entries = new Map([...tracking.values()].flat().map((tracked) => [tracked.locator, tracked]));
400
452
  const named = rooms.flatMap((room) => {
401
- const entry = entries.get(room.locator);
453
+ const entry = located.get(room.locator);
402
454
  const at = room.roomVersion === null ? null : logPosition(room.roomVersion);
403
455
  return entry === undefined || at === null ? [] : [{ entry, at }];
404
456
  });
405
457
  const unheld = rooms.flatMap((room) => {
406
- const entry = entries.get(room.locator);
458
+ const entry = located.get(room.locator);
407
459
  return entry === undefined || room.roomVersion !== null ? [] : [entry];
408
460
  });
409
461
  for (const { entry, at } of named) {
@@ -416,10 +468,14 @@ export function houseNotifications(transport, mode, discovering, spaces) {
416
468
  heldAtZero.delete(entry.authority);
417
469
  const site = mode === 'site';
418
470
  unanswered.push(site ? unheld.map((entry) => entry.locator) : []);
471
+ const marked = (held) => {
472
+ const mark = runMarks.rooms[held.authority];
473
+ return mark === undefined ? held : { ...held, requests: mark };
474
+ };
419
475
  socket.hold([
420
- ...named.map(({ entry, at }) => presented(entry.authority, at)),
421
- ...(site ? [] : unheld).map((entry) => presented(entry.authority, { position: '0', logEpoch: entry.logEpoch })),
422
- ], runtime, listedCursor);
476
+ ...named.map(({ entry, at }) => marked(presented(entry.authority, at))),
477
+ ...(site ? [] : unheld).map((entry) => marked(presented(entry.authority, { position: '0', logEpoch: entry.logEpoch }))),
478
+ ], runtime, listedCursor, runMarks.sent ?? undefined);
423
479
  if (site)
424
480
  return;
425
481
  const made = unheld.filter((entry) => entry.position === '0');
@@ -431,16 +487,21 @@ export function houseNotifications(transport, mode, discovering, spaces) {
431
487
  locator: entry.locator,
432
488
  from: null,
433
489
  roomVersion: version,
434
- read: () => changePage(entry, [], version, mode, spaces, true),
490
+ read: () => changePage(entry, [], version, mode, true),
435
491
  });
436
492
  }
437
493
  });
438
494
  },
439
495
  track(entries) {
440
496
  tracking.clear();
497
+ located.clear();
441
498
  for (const entry of entries) {
442
499
  tracking.set(entry.authority, [...(tracking.get(entry.authority) ?? []), entry]);
443
500
  }
501
+ for (const held of tracking.values()) {
502
+ for (const entry of held)
503
+ located.set(entry.locator, entry);
504
+ }
444
505
  for (const [carry, held] of staged) {
445
506
  if (!tracking.has(held.authority))
446
507
  staged.delete(carry);
@@ -1,28 +1,42 @@
1
- import type { ConversationEvent, SavedFacts, 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/set', 'agents/list', 'apps/features/set', 'apps/source/download', 'apps/source/top/read', 'conversations/history/list', 'files/attach', 'files/batch', 'files/batch-upload', 'files/finish', 'files/read', 'files/revisions/list', 'room-chunks/list', 'rooms/discover', 'rooms/search', '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_update.set', 'app.screenshot', 'app.source', 'app_update.feature_set', 'conversations/history/list', 'files/attach', 'files/finish', 'files/read', 'files/revisions/list', 'info', 'room-chunks/list', 'rooms/discover', 'rooms/search', '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', 'request', 'requests', '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: 'chunks' | 'discover'): string;
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;
10
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
+ interface SiteDoorAct {
21
+ readonly op: string;
22
+ readonly route: string;
23
+ }
24
+ export declare const SITE_DOOR_ACTS: Readonly<Record<string, SiteDoorAct>>;
25
+ export declare const SITE_DOOR_TOOL = "app_update";
12
26
  export type HouseMode = 'credential' | 'site';
13
27
  export type HouseDoorAnswer = {
14
28
  status: number;
15
29
  body: unknown;
16
30
  };
17
31
  export declare const SITE_FILES = "/_house/files/";
18
- export type HouseByteAct = 'authored_batch_upload';
32
+ export declare const SITE_IMAGE_COPIES_HEADER = "X-House-Image-Copies";
19
33
  export type HouseBytesAnswer = {
20
34
  status: number;
21
35
  body: ReadableStream<Uint8Array> | null;
22
36
  mediaType: string;
37
+ copies?: string | null;
23
38
  };
24
39
  export type HouseByteTransfer = {
25
- act: HouseByteAct;
26
40
  url: string;
27
41
  body: string;
28
42
  };
@@ -32,7 +46,6 @@ export type HouseStreamEntry = {
32
46
  removed?: true;
33
47
  revision?: string;
34
48
  sha256?: string;
35
- text?: string;
36
49
  bytes?: number;
37
50
  media_type?: string;
38
51
  author?: {
@@ -41,30 +54,43 @@ export type HouseStreamEntry = {
41
54
  } | {
42
55
  site: string;
43
56
  name: string;
57
+ } | {
58
+ inbox: string;
59
+ name: string;
60
+ } | {
61
+ app: string;
62
+ function: string;
63
+ release: string;
64
+ name: string;
44
65
  };
45
66
  changed_at?: string;
46
67
  created_at?: string;
68
+ content?: string;
47
69
  facts?: SavedFacts;
70
+ move?: 'arrival' | 'leaving';
48
71
  space?: string;
49
72
  };
73
+ export type HouseStreamedRequest = {
74
+ room_ref: string;
75
+ name: string;
76
+ document: string;
77
+ };
50
78
  type LiveFact<K extends ConversationEvent['kind']> = Extract<ConversationEvent, {
51
79
  kind: K;
52
80
  }>;
53
81
  export type HouseListedConversation = {
54
82
  conversation_id: string;
55
83
  agent_id: string;
56
- agent_name: string;
57
- agent_retired: boolean;
58
84
  name: string;
59
85
  created_at: string;
60
- finished_at: string | null;
61
86
  outcome: string | null;
62
87
  waiting: boolean;
63
- newest: {
64
- accepted_at: string;
65
- message_id: string;
66
- } | null;
88
+ newest: number | null;
67
89
  process_ended_at: string | null;
90
+ subject: string | null;
91
+ room_ref: string | null;
92
+ model: string | null;
93
+ effort: string | null;
68
94
  };
69
95
  type Listed<Frame extends {
70
96
  readonly type: HouseRuntimeFrame;
@@ -86,23 +112,35 @@ export type HouseStreamFrame = Listed<{
86
112
  } | {
87
113
  type: 'opening';
88
114
  member: unknown;
115
+ time_zone: unknown;
89
116
  bounds: unknown;
90
117
  actions: readonly unknown[];
91
118
  shapes: readonly unknown[];
92
119
  rooms: readonly unknown[];
120
+ listed: readonly unknown[];
121
+ spaces: readonly unknown[];
93
122
  } | {
94
123
  type: 'caught_up';
95
124
  expired: readonly string[];
96
125
  } | {
97
126
  type: 'authority_changed';
98
127
  member: unknown;
128
+ time_zone: unknown;
99
129
  authorities: readonly unknown[];
130
+ listed: readonly unknown[];
131
+ spaces: readonly unknown[];
100
132
  left: readonly string[];
101
- } | ({
133
+ } | {
134
+ type: 'turn';
135
+ conversation_id: string;
136
+ turn_id: string;
137
+ at: string;
138
+ } | {
102
139
  type: 'turn';
103
140
  conversation_id: string;
104
141
  turn_id: string;
105
- } & TurnOperation) | {
142
+ operation: Operation;
143
+ } | {
106
144
  type: 'message';
107
145
  conversation_id: string;
108
146
  message: unknown;
@@ -113,6 +151,7 @@ export type HouseStreamFrame = Listed<{
113
151
  } | {
114
152
  type: 'deliveries';
115
153
  conversation_id: string;
154
+ waiting: readonly string[];
116
155
  unknown: readonly string[];
117
156
  } | {
118
157
  type: 'process';
@@ -131,15 +170,12 @@ export type HouseStreamFrame = Listed<{
131
170
  conversation_id: string;
132
171
  step: string | null;
133
172
  } | {
134
- type: 'subagents';
173
+ type: 'state';
135
174
  conversation_id: string;
136
- subagents: LiveFact<'subagents'>['subagents'];
137
- } | {
138
- type: 'link';
139
- conversation_id: string;
140
- connected: boolean;
175
+ state: SessionState;
141
176
  } | {
142
177
  type: 'conversations';
178
+ agents: readonly ListedAgent[];
143
179
  conversations: readonly HouseListedConversation[];
144
180
  whole: boolean;
145
181
  more: boolean;
@@ -147,22 +183,38 @@ export type HouseStreamFrame = Listed<{
147
183
  } | {
148
184
  type: 'conversation';
149
185
  conversation: HouseListedConversation;
186
+ } | {
187
+ type: 'agent';
188
+ agent: ListedAgent;
150
189
  } | {
151
190
  type: 'conversation_deleted';
152
191
  conversation_id: string;
153
192
  } | {
154
193
  type: 'signal';
155
194
  service_mode: string;
195
+ } | {
196
+ type: 'report';
197
+ } | {
198
+ type: 'request';
199
+ request: HouseStreamedRequest;
200
+ } | {
201
+ type: 'requests';
202
+ room_ref: string | null;
203
+ requests: readonly HouseStreamedRequest[];
204
+ whole: boolean;
205
+ more: boolean;
206
+ cursor: string;
156
207
  }>;
157
208
  export type HouseHeldRoom = {
158
209
  authority: string;
159
210
  position: string;
160
211
  log_epoch: string;
212
+ requests?: string;
161
213
  };
162
214
  export type HouseOpening = {
163
- hold(rooms: readonly HouseHeldRoom[], runtime: string, conversations: string | null): void;
215
+ hold(rooms: readonly HouseHeldRoom[], runtime: string, conversations: string | null, sent?: string): void;
164
216
  received(authority: string, carry: string, index: number): void;
165
- close(): void;
217
+ close(failure?: unknown): void;
166
218
  };
167
219
  export type HouseClosing = {
168
220
  revoked: boolean;
@@ -189,4 +241,3 @@ export type HouseSiteTransport = HouseDoor & {
189
241
  download(route: string): Promise<HouseBytesAnswer>;
190
242
  };
191
243
  export {};
192
- //# sourceMappingURL=transport.d.ts.map