@agentshouse/mdruntime-adapter 0.1.0-alpha.9 → 0.1.0-c9f1e531ad7c8

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 (60) hide show
  1. package/AGENTS.md +157 -26
  2. package/README.md +32 -0
  3. package/dist/actions.d.ts +4 -12
  4. package/dist/actions.d.ts.map +1 -1
  5. package/dist/actions.js +239 -332
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +258 -193
  8. package/dist/digest.js +1 -5
  9. package/dist/discovery.d.ts +20 -18
  10. package/dist/discovery.d.ts.map +1 -1
  11. package/dist/discovery.js +182 -210
  12. package/dist/gather.d.ts +3 -0
  13. package/dist/gather.d.ts.map +1 -0
  14. package/dist/gather.js +40 -0
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +0 -2
  18. package/dist/links.d.ts +12 -0
  19. package/dist/links.d.ts.map +1 -0
  20. package/dist/links.js +66 -0
  21. package/dist/map.d.ts +2 -2
  22. package/dist/map.d.ts.map +1 -1
  23. package/dist/map.js +6 -7
  24. package/dist/model.d.ts +2 -2
  25. package/dist/model.d.ts.map +1 -1
  26. package/dist/model.js +21 -39
  27. package/dist/read.d.ts +29 -23
  28. package/dist/read.d.ts.map +1 -1
  29. package/dist/read.js +222 -195
  30. package/dist/refusal.d.ts.map +1 -1
  31. package/dist/refusal.js +30 -51
  32. package/dist/site.d.ts.map +1 -1
  33. package/dist/site.js +110 -124
  34. package/dist/stream.d.ts +11 -5
  35. package/dist/stream.d.ts.map +1 -1
  36. package/dist/stream.js +211 -213
  37. package/dist/transport.d.ts +46 -28
  38. package/dist/transport.d.ts.map +1 -1
  39. package/dist/transport.js +3 -3
  40. package/dist/version.d.ts +1 -0
  41. package/dist/version.d.ts.map +1 -1
  42. package/dist/version.js +23 -18
  43. package/dist/write.d.ts +3 -3
  44. package/dist/write.d.ts.map +1 -1
  45. package/dist/write.js +120 -203
  46. package/package.json +4 -12
  47. package/dist/actions.js.map +0 -1
  48. package/dist/adapter.js.map +0 -1
  49. package/dist/digest.js.map +0 -1
  50. package/dist/discovery.js.map +0 -1
  51. package/dist/index.js.map +0 -1
  52. package/dist/map.js.map +0 -1
  53. package/dist/model.js.map +0 -1
  54. package/dist/read.js.map +0 -1
  55. package/dist/refusal.js.map +0 -1
  56. package/dist/site.js.map +0 -1
  57. package/dist/stream.js.map +0 -1
  58. package/dist/transport.js.map +0 -1
  59. package/dist/version.js.map +0 -1
  60. package/dist/write.js.map +0 -1
package/dist/stream.js CHANGED
@@ -1,298 +1,296 @@
1
- import { actionOutcome, HISTORY_PAGE, readConversationHistory } from './actions.js';
2
- import { selects } from './read.js';
3
- import { PRIVATE_AUTHORITY } from './transport.js';
1
+ import { acceptedMessage } from './actions.js';
2
+ import { headChange, selects } from './read.js';
4
3
  import { roomVersion } from './version.js';
5
- const HELD_POSITIONS_MAX = 256;
4
+ const HELD_FRAMES_MAX = 256;
6
5
  function position(value) {
7
- if (!/^(?:0|[1-9][0-9]*)$/.test(value)) return null;
6
+ if (!/^(?:0|[1-9][0-9]*)$/.test(value))
7
+ return null;
8
8
  return BigInt(value);
9
9
  }
10
- function messageTurn(message) {
11
- if (typeof message !== 'object' || message === null) return null;
12
- const turn = message.message_id;
13
- return typeof turn === 'string' ? turn : null;
14
- }
15
10
  export function houseNotifications(transport, mode) {
16
11
  const stream = transport.stream;
17
12
  const lines = new Map();
18
13
  const locators = new Map();
19
- const authorities = new Map();
14
+ const schemas = new Map();
20
15
  const observers = new Set();
21
16
  const conversationObservers = new Set();
22
- const subscribedConversations = new Set();
23
- let selected = [];
24
- let viewed = [];
17
+ const modeObservers = new Set();
18
+ let replicated = [];
19
+ const live = new Set();
20
+ const noted = new Set();
25
21
  let listening = false;
26
- function subscribe() {
27
- const named = [];
28
- const rooms = new Set();
29
- for (const locator of selected){
30
- const authority = authorities.get(locator);
31
- if (authority === undefined || authority === PRIVATE_AUTHORITY) continue;
32
- rooms.add(authority);
33
- }
34
- for (const room of rooms)named.push({
35
- kind: 'room',
36
- room
37
- });
38
- if (authorities.has(PRIVATE_AUTHORITY)) named.push({
39
- kind: 'private'
40
- });
41
- for (const conversation of viewed){
42
- named.push({
43
- kind: 'conversation',
44
- conversation
45
- });
46
- }
47
- stream.subscribe(named);
22
+ let catching = false;
23
+ function listen() {
24
+ if (listening)
25
+ return;
26
+ listening = true;
27
+ stream.observe(receive);
48
28
  }
49
29
  function emitConversation(event) {
50
- if (!viewed.includes(event.conversation)) return;
51
- for (const observer of conversationObservers)observer(event);
30
+ if (event.kind !== 'gap' && event.kind !== 'accepted-message')
31
+ live.add(event.conversation);
32
+ for (const observer of conversationObservers)
33
+ observer(event);
52
34
  }
53
- async function catchUp(conversation, history) {
54
- const viewedAnswer = await transport.door('/door/conversations/view', {
55
- conversation_id: conversation
56
- });
57
- const summary = actionOutcome(viewedAnswer, 'conversations/view');
58
- if (summary.kind === 'action' && typeof summary.result === 'object' && summary.result !== null) {
35
+ function unnote(conversation) {
36
+ if (!noted.delete(conversation))
37
+ return;
38
+ emitConversation({ kind: 'working-note', conversation, note: null });
39
+ }
40
+ function reopened() {
41
+ const gapped = new Set([...replicated, ...live]);
42
+ live.clear();
43
+ noted.clear();
44
+ for (const conversation of gapped)
45
+ emitConversation({ kind: 'gap', conversation });
46
+ }
47
+ function converse(frame) {
48
+ const conversation = frame.conversation_id;
49
+ if (frame.type === 'draft') {
50
+ unnote(conversation);
59
51
  emitConversation({
60
- kind: 'session-summary',
52
+ kind: 'growing-text',
61
53
  conversation,
62
- summary: structuredClone('session' in summary.result ? summary.result.session : null)
54
+ turn: frame.turn_id,
55
+ text: frame.text,
63
56
  });
64
- }
65
- if (!history) return;
66
- const heldHistory = await readConversationHistory(transport, conversation);
67
- if ('outcome' in heldHistory) return;
68
- const newest = heldHistory.messages.slice(-HISTORY_PAGE);
69
- for (const entry of newest){
70
- const turn = messageTurn(entry);
71
- if (turn === null) return;
72
57
  emitConversation({
73
- kind: 'accepted-message',
58
+ kind: 'plan',
74
59
  conversation,
75
- message: {
76
- turn,
77
- message: structuredClone(entry)
78
- }
60
+ turn: frame.turn_id,
61
+ plan: structuredClone(frame.steps),
79
62
  });
63
+ return;
80
64
  }
81
- }
82
- function announce(authority, at) {
83
- const version = roomVersion(at);
84
- for (const locator of locators.get(authority) ?? []){
85
- for (const observer of observers)observer({
86
- locator,
87
- roomVersion: version
65
+ if (frame.type === 'working-note') {
66
+ noted.add(conversation);
67
+ emitConversation({
68
+ kind: 'working-note',
69
+ conversation,
70
+ note: { noteId: frame.note_id, text: frame.text },
88
71
  });
72
+ return;
89
73
  }
90
- }
91
- function interrupt(authority) {
92
- const line = lines.get(authority);
93
- if (line !== undefined) lines.set(authority, {
94
- logEpoch: line.logEpoch,
95
- frames: []
96
- });
97
- }
98
- function resubscribed(authority, position, logEpoch) {
99
- if (position === undefined || logEpoch === undefined) {
100
- interrupt(authority);
74
+ if (frame.type === 'process') {
75
+ emitConversation({ kind: 'process', conversation, running: frame.running });
76
+ if (frame.running)
77
+ return;
78
+ emitConversation({ kind: 'commands', conversation, commands: [] });
79
+ emitConversation({ kind: 'options', conversation, options: [] });
80
+ unnote(conversation);
101
81
  return;
102
82
  }
103
- const held = lines.get(authority)?.logEpoch;
104
- lines.set(authority, {
105
- logEpoch,
106
- frames: []
107
- });
108
- if (held !== logEpoch) announce(authority, {
109
- position,
110
- logEpoch
111
- });
112
- }
113
- function receive(frame) {
114
- if (frame.type === 'draft') {
83
+ if (frame.type === 'commands') {
115
84
  emitConversation({
116
- kind: 'growing-text',
117
- conversation: frame.conversation_id,
118
- turn: frame.turn_id,
119
- text: frame.text
85
+ kind: 'commands',
86
+ conversation,
87
+ commands: structuredClone(frame.commands),
120
88
  });
121
89
  return;
122
90
  }
123
- if (frame.type === 'message') {
124
- const turn = messageTurn(frame.message);
125
- if (turn === null) return;
126
- emitConversation({
127
- kind: 'accepted-message',
128
- conversation: frame.conversation_id,
129
- message: {
130
- turn,
131
- message: structuredClone(frame.message)
132
- }
133
- });
91
+ if (frame.type === 'options') {
92
+ emitConversation({ kind: 'options', conversation, options: structuredClone(frame.options) });
134
93
  return;
135
94
  }
136
- if (frame.type === 'session') {
95
+ if (frame.type === 'interactions') {
137
96
  emitConversation({
138
- kind: 'session-summary',
139
- conversation: frame.conversation_id,
140
- summary: structuredClone(frame.summary)
97
+ kind: 'questions',
98
+ conversation,
99
+ questions: structuredClone(frame.interactions),
141
100
  });
142
101
  return;
143
102
  }
144
- if (frame.type === 'subscribed' && viewed.includes(frame.authority)) {
145
- const reconnect = subscribedConversations.has(frame.authority);
146
- subscribedConversations.add(frame.authority);
147
- void catchUp(frame.authority, reconnect);
103
+ const message = acceptedMessage(frame.message);
104
+ if (message === null)
105
+ return;
106
+ emitConversation({ kind: 'accepted-message', conversation, message });
107
+ if (frame.message.role === 'user')
148
108
  return;
109
+ unnote(conversation);
110
+ }
111
+ function announce(authority, at, modelChanged) {
112
+ const version = roomVersion(at);
113
+ for (const locator of locators.get(authority) ?? []) {
114
+ for (const observer of observers) {
115
+ observer(modelChanged
116
+ ? { locator, roomVersion: version, modelChanged: true }
117
+ : { locator, roomVersion: version });
118
+ }
149
119
  }
150
- if (frame.type === 'subscribed') {
151
- resubscribed(frame.authority, frame.position, frame.log_epoch);
120
+ }
121
+ function interrupt(authority) {
122
+ const line = lines.get(authority);
123
+ if (line !== undefined)
124
+ lines.set(authority, { ...line, frames: [] });
125
+ }
126
+ function receive(frame) {
127
+ if (frame.type === 'signal') {
128
+ const mode = frame.service_mode;
129
+ if (mode !== 'open' && mode !== 'write-halted')
130
+ return;
131
+ for (const observer of modeObservers)
132
+ observer(mode);
152
133
  return;
153
134
  }
154
- if (frame.type !== 'entries') {
155
- interrupt(frame.authority);
135
+ if (frame.type === 'draft' ||
136
+ frame.type === 'working-note' ||
137
+ frame.type === 'process' ||
138
+ frame.type === 'commands' ||
139
+ frame.type === 'options' ||
140
+ frame.type === 'interactions' ||
141
+ frame.type === 'message') {
142
+ converse(frame);
156
143
  return;
157
144
  }
145
+ if (frame.type !== 'entries')
146
+ return;
158
147
  const at = position(frame.position);
159
- if (at === null) {
148
+ const after = position(frame.after);
149
+ if (at === null || after === null || after >= at) {
160
150
  interrupt(frame.authority);
161
151
  return;
162
152
  }
163
153
  const line = lines.get(frame.authority);
164
154
  if (line?.logEpoch === frame.log_epoch) {
155
+ if (line.held !== null && at <= line.held)
156
+ return;
165
157
  const last = line.frames.at(-1);
166
- const continued = last !== undefined && last.position + 1n === at;
167
- const next = continued ? [
168
- ...line.frames,
169
- {
170
- position: at,
171
- entries: frame.entries
172
- }
173
- ] : [
174
- {
175
- position: at,
176
- entries: frame.entries
177
- }
178
- ];
179
- lines.set(frame.authority, {
180
- logEpoch: line.logEpoch,
181
- frames: next.length > HELD_POSITIONS_MAX ? [] : next
182
- });
183
- } else {
158
+ if (last !== undefined && at <= last.position)
159
+ return;
160
+ const held = { after, position: at, entries: frame.entries };
161
+ const next = last !== undefined && after <= last.position ? [...line.frames, held] : [held];
162
+ lines.set(frame.authority, { ...line, frames: next.length > HELD_FRAMES_MAX ? [] : next });
163
+ }
164
+ else {
184
165
  interrupt(frame.authority);
185
166
  }
186
- announce(frame.authority, {
187
- position: frame.position,
188
- logEpoch: frame.log_epoch
189
- });
167
+ const addresses = schemas.get(frame.authority) ?? [];
168
+ announce(frame.authority, { position: frame.position, logEpoch: frame.log_epoch }, frame.entries.some((entry) => addresses.includes(entry.path)));
190
169
  }
191
170
  return {
171
+ serviceMode: {
172
+ observe(notify) {
173
+ modeObservers.add(notify);
174
+ listen();
175
+ return () => {
176
+ modeObservers.delete(notify);
177
+ };
178
+ },
179
+ },
192
180
  conversations: {
193
- view (next) {
194
- const open = new Set(next);
195
- for (const conversation of subscribedConversations){
196
- if (!open.has(conversation)) subscribedConversations.delete(conversation);
197
- }
198
- viewed = [
199
- ...next
200
- ];
201
- subscribe();
181
+ replicate(next) {
182
+ replicated = [...next];
202
183
  },
203
- observe (notify) {
184
+ observe(notify) {
204
185
  conversationObservers.add(notify);
205
- if (!listening) {
206
- listening = true;
207
- stream.observe(receive);
186
+ listen();
187
+ if (!catching) {
188
+ catching = true;
189
+ stream.opened(reopened);
208
190
  }
209
- return ()=>{
191
+ return () => {
210
192
  conversationObservers.delete(notify);
211
193
  };
212
- }
194
+ },
213
195
  },
214
- track (entries) {
196
+ track(entries) {
215
197
  locators.clear();
216
- authorities.clear();
217
- for (const entry of entries){
218
- locators.set(entry.authority, [
219
- ...locators.get(entry.authority) ?? [],
220
- entry.locator
221
- ]);
222
- authorities.set(entry.locator, entry.authority);
198
+ schemas.clear();
199
+ for (const entry of entries) {
200
+ locators.set(entry.authority, [...(locators.get(entry.authority) ?? []), entry.locator]);
201
+ schemas.set(entry.authority, entry.schemas);
223
202
  if (lines.get(entry.authority)?.logEpoch !== entry.logEpoch) {
224
- lines.set(entry.authority, {
225
- logEpoch: entry.logEpoch,
226
- frames: []
227
- });
203
+ lines.set(entry.authority, { logEpoch: entry.logEpoch, frames: [], held: null });
228
204
  }
229
205
  }
230
- for (const authority of lines.keys()){
231
- if (!locators.has(authority)) lines.delete(authority);
206
+ for (const authority of lines.keys()) {
207
+ if (!locators.has(authority))
208
+ lines.delete(authority);
232
209
  }
233
210
  },
234
- select (named) {
235
- selected = [
236
- ...named
237
- ];
238
- subscribe();
239
- },
240
- observe (notify) {
211
+ select() { },
212
+ observe(notify) {
241
213
  observers.add(notify);
242
- if (!listening) {
243
- listening = true;
244
- stream.observe(receive);
245
- }
246
- return ()=>{
214
+ listen();
215
+ return () => {
247
216
  observers.delete(notify);
248
217
  };
249
218
  },
250
- advance (tracked, from) {
219
+ hold(authority, at) {
220
+ const line = lines.get(authority);
221
+ const held = position(at.position);
222
+ if (line === undefined || held === null || line.logEpoch !== at.logEpoch)
223
+ return;
224
+ lines.set(authority, { ...line, held });
225
+ },
226
+ advance(tracked, from, holds) {
251
227
  const line = lines.get(tracked.authority);
252
228
  const start = position(from.position);
253
- if (line === undefined || start === null || line.logEpoch !== from.logEpoch) return null;
254
- const at = line.frames.findIndex((frame)=>frame.position === start + 1n);
255
- if (at === -1) return null;
256
- const pending = line.frames.slice(at);
229
+ if (line === undefined || start === null || line.logEpoch !== from.logEpoch)
230
+ return null;
231
+ const pending = line.frames.filter((frame) => frame.position > start);
232
+ const first = pending[0];
233
+ if (first === undefined || first.after > start)
234
+ return null;
257
235
  const documents = {};
258
236
  const revisions = {};
237
+ const changes = {};
259
238
  const removals = [];
260
- for (const frame of pending){
261
- for (const entry of frame.entries){
262
- if (!selects(tracked, entry.path)) continue;
239
+ const applied = [];
240
+ const forget = (path) => {
241
+ delete documents[path];
242
+ delete revisions[path];
243
+ delete changes[path];
244
+ const removed = removals.indexOf(path);
245
+ if (removed !== -1)
246
+ removals.splice(removed, 1);
247
+ };
248
+ for (const frame of pending) {
249
+ for (const entry of frame.entries) {
250
+ if (entry.kind === 'edited' &&
251
+ entry.text === undefined &&
252
+ entry.revision !== undefined &&
253
+ holds?.(entry.path, entry.revision) === true) {
254
+ forget(entry.path);
255
+ continue;
256
+ }
257
+ applied.push(entry);
258
+ if (!selects(tracked, entry.path))
259
+ continue;
263
260
  if (entry.kind === 'removed') {
264
- delete documents[entry.path];
265
- delete revisions[entry.path];
266
- if (!removals.includes(entry.path)) removals.push(entry.path);
261
+ forget(entry.path);
262
+ removals.push(entry.path);
267
263
  continue;
268
264
  }
269
- if (entry.text === undefined) return null;
270
- if (mode === 'credential' && entry.revision === undefined) return null;
265
+ if (entry.text === undefined)
266
+ return null;
267
+ if (mode === 'credential' && entry.revision === undefined)
268
+ return null;
269
+ const head = headChange(entry);
270
+ if (head === null)
271
+ return null;
272
+ forget(entry.path);
271
273
  documents[entry.path] = entry.text;
272
- if (entry.revision !== undefined) revisions[entry.path] = entry.revision;
273
- const removed = removals.indexOf(entry.path);
274
- if (removed !== -1) removals.splice(removed, 1);
274
+ if (entry.revision !== undefined)
275
+ revisions[entry.path] = entry.revision;
276
+ if (head !== undefined)
277
+ changes[entry.path] = head;
275
278
  }
276
279
  }
277
280
  const last = pending.at(-1);
278
- if (last === undefined) return null;
279
- lines.set(tracked.authority, {
280
- logEpoch: line.logEpoch,
281
- frames: pending
282
- });
281
+ lines.set(tracked.authority, { ...line, frames: pending, held: last.position });
283
282
  return {
284
- kind: 'net-advancement',
285
- roomVersion: roomVersion({
286
- position: last.position.toString(),
287
- logEpoch: line.logEpoch
288
- }),
289
- documents,
290
- revisions,
291
- binaryTargets: [],
292
- removals: removals.sort()
283
+ page: {
284
+ kind: 'net-advancement',
285
+ roomVersion: roomVersion({ position: last.position.toString(), logEpoch: line.logEpoch }),
286
+ documents,
287
+ revisions,
288
+ changes,
289
+ binaryTargets: [],
290
+ removals: removals.sort(),
291
+ },
292
+ entries: applied,
293
293
  };
294
- }
294
+ },
295
295
  };
296
296
  }
297
-
298
- //# sourceMappingURL=stream.js.map
@@ -1,3 +1,4 @@
1
+ import type { ConversationEvent } from '@agentshouse/mdruntime';
1
2
  export declare const DOOR_DISCOVER = "/door/discover";
2
3
  export declare const DOOR_BOOTSTRAP = "/door/bootstrap";
3
4
  export declare const DOOR_ENUMERATE = "/door/enumerate";
@@ -7,73 +8,88 @@ export declare const DOOR_REVISIONS = "/door/revisions";
7
8
  export declare const SITE_DOOR_DISCOVER = "/_house/door/discover";
8
9
  export declare const SITE_DOOR_BOOTSTRAP = "/_house/door/bootstrap/";
9
10
  export declare const SITE_DOOR_ENUMERATE = "/_house/door/enumerate";
10
- export declare const PRIVATE_AUTHORITY = "private";
11
+ export declare const SITE_DOOR_SUBMIT = "/_house/door/submit";
12
+ export declare const PRIVATE_LOCATOR = "private";
13
+ export declare const DOOR_SELECTION_MAX = 256;
11
14
  export type HouseMode = 'credential' | 'site';
12
15
  export type HouseDoorAnswer = {
13
16
  status: number;
14
17
  body: unknown;
15
18
  };
16
- export type HouseByteAct = 'working_copy_bundle' | 'authored_batch_upload' | 'conversation_original_upload';
19
+ export type HouseByteAct = 'local_copy_bundle' | 'authored_batch_upload' | 'conversation_original_upload' | 'original_upload' | 'original_download';
17
20
  export type HouseByteBody = string | ArrayBuffer | Uint8Array;
21
+ export type HouseByteAnswer = 'json' | 'bytes';
18
22
  export type HouseByteTransfer = {
19
23
  act: HouseByteAct;
20
24
  method: 'GET' | 'POST';
21
25
  url: string;
26
+ answer: HouseByteAnswer;
22
27
  body?: HouseByteBody;
23
28
  operation?: string;
24
29
  };
25
- export type HouseStreamAuthority = {
26
- kind: 'room';
27
- room: string;
28
- } | {
29
- kind: 'private';
30
- } | {
31
- kind: 'conversation';
32
- conversation: string;
33
- };
34
30
  export type HouseStreamEntry = {
35
31
  path: string;
36
32
  kind: 'edited' | 'removed';
37
33
  revision?: string;
38
34
  text?: string;
35
+ author?: {
36
+ user: string;
37
+ name: string;
38
+ } | {
39
+ site: string;
40
+ name: string;
41
+ };
42
+ created_at?: string;
39
43
  };
44
+ type LiveFact<K extends ConversationEvent['kind']> = Extract<ConversationEvent, {
45
+ kind: K;
46
+ }>;
40
47
  export type HouseStreamFrame = {
41
48
  type: 'entries';
42
49
  authority: string;
50
+ after: string;
43
51
  position: string;
44
52
  log_epoch: string;
45
53
  entries: readonly HouseStreamEntry[];
46
- } | {
47
- type: 'subscribed';
48
- authority: string;
49
- position?: string;
50
- log_epoch?: string;
51
- } | {
52
- type: 'refused';
53
- authority: string;
54
- code: string;
55
- } | {
56
- type: 'unsubscribed';
57
- authority: string;
58
- code?: string;
59
54
  } | {
60
55
  type: 'draft';
61
56
  conversation_id: string;
62
- session_id: string;
63
57
  turn_id: string;
64
58
  text: string;
59
+ blocks: readonly unknown[];
60
+ steps: LiveFact<'plan'>['plan'];
65
61
  } | {
66
62
  type: 'message';
67
63
  conversation_id: string;
68
64
  message: unknown;
69
65
  } | {
70
- type: 'session';
66
+ type: 'interactions';
71
67
  conversation_id: string;
72
- summary: unknown;
68
+ interactions: readonly unknown[];
69
+ } | {
70
+ type: 'working-note';
71
+ conversation_id: string;
72
+ note_id: string;
73
+ text: string;
74
+ } | {
75
+ type: 'process';
76
+ conversation_id: string;
77
+ running: boolean;
78
+ } | {
79
+ type: 'commands';
80
+ conversation_id: string;
81
+ commands: LiveFact<'commands'>['commands'];
82
+ } | {
83
+ type: 'options';
84
+ conversation_id: string;
85
+ options: LiveFact<'options'>['options'];
86
+ } | {
87
+ type: 'signal';
88
+ service_mode: string;
73
89
  };
74
90
  export type HouseStream = {
75
- subscribe(authorities: readonly HouseStreamAuthority[]): void;
76
91
  observe(receive: (frame: HouseStreamFrame) => void): () => void;
92
+ opened(notify: () => void): () => void;
77
93
  };
78
94
  export type HouseDoor = {
79
95
  door(route: string, body: unknown): Promise<HouseDoorAnswer>;
@@ -83,6 +99,8 @@ export type HouseTransport = HouseDoor & {
83
99
  transfer(request: HouseByteTransfer): Promise<HouseDoorAnswer>;
84
100
  };
85
101
  export type HouseSiteTransport = HouseDoor & {
102
+ online(): boolean;
86
103
  read(route: string): Promise<HouseDoorAnswer>;
87
104
  };
105
+ export {};
88
106
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,UAAU,gBAAgB,CAAC;AAExC,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM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7,6 +7,6 @@ export const DOOR_REVISIONS = '/door/revisions';
7
7
  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
- export const PRIVATE_AUTHORITY = 'private';
11
-
12
- //# sourceMappingURL=transport.js.map
10
+ export const SITE_DOOR_SUBMIT = '/_house/door/submit';
11
+ export const PRIVATE_LOCATOR = 'private';
12
+ export const DOOR_SELECTION_MAX = 256;