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

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 (61) hide show
  1. package/AGENTS.md +156 -27
  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 +271 -197
  8. package/dist/digest.js +1 -5
  9. package/dist/discovery.d.ts +22 -26
  10. package/dist/discovery.d.ts.map +1 -1
  11. package/dist/discovery.js +154 -223
  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 -2
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +0 -3
  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 +31 -26
  28. package/dist/read.d.ts.map +1 -1
  29. package/dist/read.js +208 -199
  30. package/dist/refusal.d.ts +3 -1
  31. package/dist/refusal.d.ts.map +1 -1
  32. package/dist/refusal.js +27 -62
  33. package/dist/site.d.ts.map +1 -1
  34. package/dist/site.js +110 -124
  35. package/dist/stream.d.ts +11 -5
  36. package/dist/stream.d.ts.map +1 -1
  37. package/dist/stream.js +209 -213
  38. package/dist/transport.d.ts +45 -28
  39. package/dist/transport.d.ts.map +1 -1
  40. package/dist/transport.js +2 -3
  41. package/dist/version.d.ts +1 -0
  42. package/dist/version.d.ts.map +1 -1
  43. package/dist/version.js +23 -18
  44. package/dist/write.d.ts +5 -7
  45. package/dist/write.d.ts.map +1 -1
  46. package/dist/write.js +127 -215
  47. package/package.json +4 -12
  48. package/dist/actions.js.map +0 -1
  49. package/dist/adapter.js.map +0 -1
  50. package/dist/digest.js.map +0 -1
  51. package/dist/discovery.js.map +0 -1
  52. package/dist/index.js.map +0 -1
  53. package/dist/map.js.map +0 -1
  54. package/dist/model.js.map +0 -1
  55. package/dist/read.js.map +0 -1
  56. package/dist/refusal.js.map +0 -1
  57. package/dist/site.js.map +0 -1
  58. package/dist/stream.js.map +0 -1
  59. package/dist/transport.js.map +0 -1
  60. package/dist/version.js.map +0 -1
  61. package/dist/write.js.map +0 -1
package/dist/stream.js CHANGED
@@ -1,298 +1,294 @@
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 } 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);
34
+ }
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 });
52
46
  }
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) {
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)
148
105
  return;
106
+ emitConversation({ kind: 'accepted-message', conversation, message });
107
+ if (frame.message.role === 'user')
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);
263
258
  if (entry.kind === 'removed') {
264
- delete documents[entry.path];
265
- delete revisions[entry.path];
266
- if (!removals.includes(entry.path)) removals.push(entry.path);
259
+ forget(entry.path);
260
+ removals.push(entry.path);
267
261
  continue;
268
262
  }
269
- if (entry.text === undefined) return null;
270
- if (mode === 'credential' && entry.revision === undefined) return null;
263
+ if (entry.text === undefined)
264
+ return null;
265
+ if (mode === 'credential' && entry.revision === undefined)
266
+ return null;
267
+ const head = headChange(entry);
268
+ if (head === null)
269
+ return null;
270
+ forget(entry.path);
271
271
  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);
272
+ if (entry.revision !== undefined)
273
+ revisions[entry.path] = entry.revision;
274
+ if (head !== undefined)
275
+ changes[entry.path] = head;
275
276
  }
276
277
  }
277
278
  const last = pending.at(-1);
278
- if (last === undefined) return null;
279
- lines.set(tracked.authority, {
280
- logEpoch: line.logEpoch,
281
- frames: pending
282
- });
279
+ lines.set(tracked.authority, { ...line, frames: pending, held: last.position });
283
280
  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()
281
+ page: {
282
+ kind: 'net-advancement',
283
+ roomVersion: roomVersion({ position: last.position.toString(), logEpoch: line.logEpoch }),
284
+ documents,
285
+ revisions,
286
+ changes,
287
+ binaryTargets: [],
288
+ removals: removals.sort(),
289
+ },
290
+ entries: applied,
293
291
  };
294
- }
292
+ },
295
293
  };
296
294
  }
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,87 @@ 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";
11
13
  export type HouseMode = 'credential' | 'site';
12
14
  export type HouseDoorAnswer = {
13
15
  status: number;
14
16
  body: unknown;
15
17
  };
16
- export type HouseByteAct = 'working_copy_bundle' | 'authored_batch_upload' | 'conversation_original_upload';
18
+ export type HouseByteAct = 'local_copy_bundle' | 'authored_batch_upload' | 'conversation_original_upload' | 'original_upload' | 'original_download';
17
19
  export type HouseByteBody = string | ArrayBuffer | Uint8Array;
20
+ export type HouseByteAnswer = 'json' | 'bytes';
18
21
  export type HouseByteTransfer = {
19
22
  act: HouseByteAct;
20
23
  method: 'GET' | 'POST';
21
24
  url: string;
25
+ answer: HouseByteAnswer;
22
26
  body?: HouseByteBody;
23
27
  operation?: string;
24
28
  };
25
- export type HouseStreamAuthority = {
26
- kind: 'room';
27
- room: string;
28
- } | {
29
- kind: 'private';
30
- } | {
31
- kind: 'conversation';
32
- conversation: string;
33
- };
34
29
  export type HouseStreamEntry = {
35
30
  path: string;
36
31
  kind: 'edited' | 'removed';
37
32
  revision?: string;
38
33
  text?: string;
34
+ author?: {
35
+ user: string;
36
+ name: string;
37
+ } | {
38
+ site: string;
39
+ name: string;
40
+ };
41
+ created_at?: string;
39
42
  };
43
+ type LiveFact<K extends ConversationEvent['kind']> = Extract<ConversationEvent, {
44
+ kind: K;
45
+ }>;
40
46
  export type HouseStreamFrame = {
41
47
  type: 'entries';
42
48
  authority: string;
49
+ after: string;
43
50
  position: string;
44
51
  log_epoch: string;
45
52
  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
53
  } | {
60
54
  type: 'draft';
61
55
  conversation_id: string;
62
- session_id: string;
63
56
  turn_id: string;
64
57
  text: string;
58
+ blocks: readonly unknown[];
59
+ steps: LiveFact<'plan'>['plan'];
65
60
  } | {
66
61
  type: 'message';
67
62
  conversation_id: string;
68
63
  message: unknown;
69
64
  } | {
70
- type: 'session';
65
+ type: 'interactions';
71
66
  conversation_id: string;
72
- summary: unknown;
67
+ interactions: readonly unknown[];
68
+ } | {
69
+ type: 'working-note';
70
+ conversation_id: string;
71
+ note_id: string;
72
+ text: string;
73
+ } | {
74
+ type: 'process';
75
+ conversation_id: string;
76
+ running: boolean;
77
+ } | {
78
+ type: 'commands';
79
+ conversation_id: string;
80
+ commands: LiveFact<'commands'>['commands'];
81
+ } | {
82
+ type: 'options';
83
+ conversation_id: string;
84
+ options: LiveFact<'options'>['options'];
85
+ } | {
86
+ type: 'signal';
87
+ service_mode: string;
73
88
  };
74
89
  export type HouseStream = {
75
- subscribe(authorities: readonly HouseStreamAuthority[]): void;
76
90
  observe(receive: (frame: HouseStreamFrame) => void): () => void;
91
+ opened(notify: () => void): () => void;
77
92
  };
78
93
  export type HouseDoor = {
79
94
  door(route: string, body: unknown): Promise<HouseDoorAnswer>;
@@ -83,6 +98,8 @@ export type HouseTransport = HouseDoor & {
83
98
  transfer(request: HouseByteTransfer): Promise<HouseDoorAnswer>;
84
99
  };
85
100
  export type HouseSiteTransport = HouseDoor & {
101
+ online(): boolean;
86
102
  read(route: string): Promise<HouseDoorAnswer>;
87
103
  };
104
+ export {};
88
105
  //# 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,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAA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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';