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

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 +155 -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 +190 -218
  38. package/dist/transport.d.ts +41 -32
  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,270 @@
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;
5
+ function turnOperation(frame) {
6
+ const { type: _type, conversation_id: _conversation, turn_id: _turn, ...operation } = frame;
7
+ return structuredClone(operation);
8
+ }
6
9
  function position(value) {
7
- if (!/^(?:0|[1-9][0-9]*)$/.test(value)) return null;
10
+ if (!/^(?:0|[1-9][0-9]*)$/.test(value))
11
+ return null;
8
12
  return BigInt(value);
9
13
  }
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
14
  export function houseNotifications(transport, mode) {
16
15
  const stream = transport.stream;
17
16
  const lines = new Map();
18
17
  const locators = new Map();
19
- const authorities = new Map();
18
+ const schemas = new Map();
20
19
  const observers = new Set();
21
20
  const conversationObservers = new Set();
22
- const subscribedConversations = new Set();
23
- let selected = [];
24
- let viewed = [];
21
+ const modeObservers = new Set();
22
+ let replicated = [];
23
+ const live = new Set();
25
24
  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);
25
+ let catching = false;
26
+ function listen() {
27
+ if (listening)
28
+ return;
29
+ listening = true;
30
+ stream.observe(receive);
48
31
  }
49
32
  function emitConversation(event) {
50
- if (!viewed.includes(event.conversation)) return;
51
- for (const observer of conversationObservers)observer(event);
33
+ if (event.kind !== 'gap' && event.kind !== 'accepted-message')
34
+ live.add(event.conversation);
35
+ for (const observer of conversationObservers)
36
+ observer(event);
52
37
  }
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) {
59
- emitConversation({
60
- kind: 'session-summary',
61
- conversation,
62
- summary: structuredClone('session' in summary.result ? summary.result.session : null)
63
- });
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;
38
+ function reopened() {
39
+ const gapped = new Set([...replicated, ...live]);
40
+ live.clear();
41
+ for (const conversation of gapped)
42
+ emitConversation({ kind: 'gap', conversation });
43
+ }
44
+ function converse(frame) {
45
+ const conversation = frame.conversation_id;
46
+ if (frame.type === 'turn') {
72
47
  emitConversation({
73
- kind: 'accepted-message',
48
+ kind: 'turn',
74
49
  conversation,
75
- message: {
76
- turn,
77
- message: structuredClone(entry)
78
- }
79
- });
80
- }
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
50
+ turn: frame.turn_id,
51
+ operation: turnOperation(frame),
88
52
  });
53
+ return;
89
54
  }
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);
55
+ if (frame.type === 'process') {
56
+ emitConversation({ kind: 'process', conversation, running: frame.running });
57
+ if (frame.running)
58
+ return;
59
+ emitConversation({ kind: 'commands', conversation, commands: [] });
60
+ emitConversation({ kind: 'options', conversation, options: [] });
101
61
  return;
102
62
  }
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') {
63
+ if (frame.type === 'commands') {
115
64
  emitConversation({
116
- kind: 'growing-text',
117
- conversation: frame.conversation_id,
118
- turn: frame.turn_id,
119
- text: frame.text
65
+ kind: 'commands',
66
+ conversation,
67
+ commands: structuredClone(frame.commands),
120
68
  });
121
69
  return;
122
70
  }
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
- });
71
+ if (frame.type === 'options') {
72
+ emitConversation({ kind: 'options', conversation, options: structuredClone(frame.options) });
134
73
  return;
135
74
  }
136
- if (frame.type === 'session') {
75
+ if (frame.type === 'interactions') {
137
76
  emitConversation({
138
- kind: 'session-summary',
139
- conversation: frame.conversation_id,
140
- summary: structuredClone(frame.summary)
77
+ kind: 'questions',
78
+ conversation,
79
+ questions: structuredClone(frame.interactions),
141
80
  });
142
81
  return;
143
82
  }
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);
83
+ const message = acceptedMessage(frame.message);
84
+ if (message === null)
148
85
  return;
86
+ emitConversation({ kind: 'accepted-message', conversation, message });
87
+ }
88
+ function announce(authority, at, modelChanged) {
89
+ const version = roomVersion(at);
90
+ for (const locator of locators.get(authority) ?? []) {
91
+ for (const observer of observers) {
92
+ observer(modelChanged
93
+ ? { locator, roomVersion: version, modelChanged: true }
94
+ : { locator, roomVersion: version });
95
+ }
149
96
  }
150
- if (frame.type === 'subscribed') {
151
- resubscribed(frame.authority, frame.position, frame.log_epoch);
97
+ }
98
+ function interrupt(authority) {
99
+ const line = lines.get(authority);
100
+ if (line !== undefined)
101
+ lines.set(authority, { ...line, frames: [] });
102
+ }
103
+ function receive(frame) {
104
+ if (frame.type === 'signal') {
105
+ const mode = frame.service_mode;
106
+ if (mode !== 'open' && mode !== 'write-halted')
107
+ return;
108
+ for (const observer of modeObservers)
109
+ observer(mode);
152
110
  return;
153
111
  }
154
- if (frame.type !== 'entries') {
155
- interrupt(frame.authority);
112
+ if (frame.type === 'turn' ||
113
+ frame.type === 'process' ||
114
+ frame.type === 'commands' ||
115
+ frame.type === 'options' ||
116
+ frame.type === 'interactions' ||
117
+ frame.type === 'message') {
118
+ converse(frame);
156
119
  return;
157
120
  }
121
+ if (frame.type !== 'entries')
122
+ return;
158
123
  const at = position(frame.position);
159
- if (at === null) {
124
+ const after = position(frame.after);
125
+ if (at === null || after === null || after >= at) {
160
126
  interrupt(frame.authority);
161
127
  return;
162
128
  }
163
129
  const line = lines.get(frame.authority);
164
130
  if (line?.logEpoch === frame.log_epoch) {
131
+ if (line.held !== null && at <= line.held)
132
+ return;
165
133
  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 {
134
+ if (last !== undefined && at <= last.position)
135
+ return;
136
+ const held = { after, position: at, entries: frame.entries };
137
+ const next = last !== undefined && after <= last.position ? [...line.frames, held] : [held];
138
+ lines.set(frame.authority, { ...line, frames: next.length > HELD_FRAMES_MAX ? [] : next });
139
+ }
140
+ else {
184
141
  interrupt(frame.authority);
185
142
  }
186
- announce(frame.authority, {
187
- position: frame.position,
188
- logEpoch: frame.log_epoch
189
- });
143
+ const addresses = schemas.get(frame.authority) ?? [];
144
+ announce(frame.authority, { position: frame.position, logEpoch: frame.log_epoch }, frame.entries.some((entry) => addresses.includes(entry.path)));
190
145
  }
191
146
  return {
147
+ serviceMode: {
148
+ observe(notify) {
149
+ modeObservers.add(notify);
150
+ listen();
151
+ return () => {
152
+ modeObservers.delete(notify);
153
+ };
154
+ },
155
+ },
192
156
  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();
157
+ replicate(next) {
158
+ replicated = [...next];
202
159
  },
203
- observe (notify) {
160
+ observe(notify) {
204
161
  conversationObservers.add(notify);
205
- if (!listening) {
206
- listening = true;
207
- stream.observe(receive);
162
+ listen();
163
+ if (!catching) {
164
+ catching = true;
165
+ stream.opened(reopened);
208
166
  }
209
- return ()=>{
167
+ return () => {
210
168
  conversationObservers.delete(notify);
211
169
  };
212
- }
170
+ },
213
171
  },
214
- track (entries) {
172
+ track(entries) {
215
173
  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);
174
+ schemas.clear();
175
+ for (const entry of entries) {
176
+ locators.set(entry.authority, [...(locators.get(entry.authority) ?? []), entry.locator]);
177
+ schemas.set(entry.authority, entry.schemas);
223
178
  if (lines.get(entry.authority)?.logEpoch !== entry.logEpoch) {
224
- lines.set(entry.authority, {
225
- logEpoch: entry.logEpoch,
226
- frames: []
227
- });
179
+ lines.set(entry.authority, { logEpoch: entry.logEpoch, frames: [], held: null });
228
180
  }
229
181
  }
230
- for (const authority of lines.keys()){
231
- if (!locators.has(authority)) lines.delete(authority);
182
+ for (const authority of lines.keys()) {
183
+ if (!locators.has(authority))
184
+ lines.delete(authority);
232
185
  }
233
186
  },
234
- select (named) {
235
- selected = [
236
- ...named
237
- ];
238
- subscribe();
239
- },
240
- observe (notify) {
187
+ select() { },
188
+ observe(notify) {
241
189
  observers.add(notify);
242
- if (!listening) {
243
- listening = true;
244
- stream.observe(receive);
245
- }
246
- return ()=>{
190
+ listen();
191
+ return () => {
247
192
  observers.delete(notify);
248
193
  };
249
194
  },
250
- advance (tracked, from) {
195
+ hold(authority, at) {
196
+ const line = lines.get(authority);
197
+ const held = position(at.position);
198
+ if (line === undefined || held === null || line.logEpoch !== at.logEpoch)
199
+ return;
200
+ lines.set(authority, { ...line, held });
201
+ },
202
+ advance(tracked, from, holds) {
251
203
  const line = lines.get(tracked.authority);
252
204
  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);
205
+ if (line === undefined || start === null || line.logEpoch !== from.logEpoch)
206
+ return null;
207
+ const pending = line.frames.filter((frame) => frame.position > start);
208
+ const first = pending[0];
209
+ if (first === undefined || first.after > start)
210
+ return null;
257
211
  const documents = {};
258
212
  const revisions = {};
213
+ const changes = {};
259
214
  const removals = [];
260
- for (const frame of pending){
261
- for (const entry of frame.entries){
262
- if (!selects(tracked, entry.path)) continue;
215
+ const applied = [];
216
+ const forget = (path) => {
217
+ delete documents[path];
218
+ delete revisions[path];
219
+ delete changes[path];
220
+ const removed = removals.indexOf(path);
221
+ if (removed !== -1)
222
+ removals.splice(removed, 1);
223
+ };
224
+ for (const frame of pending) {
225
+ for (const entry of frame.entries) {
226
+ if (entry.kind === 'edited' &&
227
+ entry.text === undefined &&
228
+ entry.revision !== undefined &&
229
+ holds?.(entry.path, entry.revision) === true) {
230
+ forget(entry.path);
231
+ continue;
232
+ }
233
+ applied.push(entry);
263
234
  if (entry.kind === 'removed') {
264
- delete documents[entry.path];
265
- delete revisions[entry.path];
266
- if (!removals.includes(entry.path)) removals.push(entry.path);
235
+ forget(entry.path);
236
+ removals.push(entry.path);
267
237
  continue;
268
238
  }
269
- if (entry.text === undefined) return null;
270
- if (mode === 'credential' && entry.revision === undefined) return null;
239
+ if (entry.text === undefined)
240
+ return null;
241
+ if (mode === 'credential' && entry.revision === undefined)
242
+ return null;
243
+ const head = headChange(entry);
244
+ if (head === null)
245
+ return null;
246
+ forget(entry.path);
271
247
  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);
248
+ if (entry.revision !== undefined)
249
+ revisions[entry.path] = entry.revision;
250
+ if (head !== undefined)
251
+ changes[entry.path] = head;
275
252
  }
276
253
  }
277
254
  const last = pending.at(-1);
278
- if (last === undefined) return null;
279
- lines.set(tracked.authority, {
280
- logEpoch: line.logEpoch,
281
- frames: pending
282
- });
255
+ lines.set(tracked.authority, { ...line, frames: pending, held: last.position });
283
256
  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()
257
+ page: {
258
+ kind: 'net-advancement',
259
+ roomVersion: roomVersion({ position: last.position.toString(), logEpoch: line.logEpoch }),
260
+ documents,
261
+ revisions,
262
+ changes,
263
+ binaryTargets: [],
264
+ removals: removals.sort(),
265
+ },
266
+ entries: applied,
293
267
  };
294
- }
268
+ },
295
269
  };
296
270
  }
297
-
298
- //# sourceMappingURL=stream.js.map
@@ -1,3 +1,4 @@
1
+ import type { ConversationEvent, TurnOperation } 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,79 @@ 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
- } | {
60
- type: 'draft';
53
+ } | ({
54
+ type: 'turn';
61
55
  conversation_id: string;
62
- session_id: string;
63
56
  turn_id: string;
64
- text: string;
65
- } | {
57
+ } & TurnOperation) | {
66
58
  type: 'message';
67
59
  conversation_id: string;
68
60
  message: unknown;
69
61
  } | {
70
- type: 'session';
62
+ type: 'interactions';
71
63
  conversation_id: string;
72
- summary: unknown;
64
+ interactions: readonly unknown[];
65
+ } | {
66
+ type: 'process';
67
+ conversation_id: string;
68
+ running: boolean;
69
+ } | {
70
+ type: 'commands';
71
+ conversation_id: string;
72
+ commands: LiveFact<'commands'>['commands'];
73
+ } | {
74
+ type: 'options';
75
+ conversation_id: string;
76
+ options: LiveFact<'options'>['options'];
77
+ } | {
78
+ type: 'signal';
79
+ service_mode: string;
73
80
  };
74
81
  export type HouseStream = {
75
- subscribe(authorities: readonly HouseStreamAuthority[]): void;
76
82
  observe(receive: (frame: HouseStreamFrame) => void): () => void;
83
+ opened(notify: () => void): () => void;
77
84
  };
78
85
  export type HouseDoor = {
79
86
  door(route: string, body: unknown): Promise<HouseDoorAnswer>;
@@ -83,6 +90,8 @@ export type HouseTransport = HouseDoor & {
83
90
  transfer(request: HouseByteTransfer): Promise<HouseDoorAnswer>;
84
91
  };
85
92
  export type HouseSiteTransport = HouseDoor & {
93
+ online(): boolean;
86
94
  read(route: string): Promise<HouseDoorAnswer>;
87
95
  };
96
+ export {};
88
97
  //# 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,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,qBAAqB,GACrB,uBAAuB,GACvB,8BAA8B,CAAC;AAEnC,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,YAAY,CAAC;IAClB,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,M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AAM,IAAI,GAAG,MAAM,IAAI,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7D,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IACvC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG;IAC3C,MAAM,IAAI,OAAO,CAAC;IAClB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC/C,CAAC"}
package/dist/transport.js CHANGED
@@ -7,6 +7,5 @@ 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';
package/dist/version.d.ts CHANGED
@@ -11,4 +11,5 @@ export declare function roomVersion(at: LogPosition): string;
11
11
  export declare function logPosition(version: string): LogPosition | null;
12
12
  export declare function readPosition(held: Readonly<Record<string, unknown>>): LogPosition | null;
13
13
  export declare function presented(authority: string, at: LogPosition): PresentedPosition;
14
+ export declare function reachedVersion(roomVersion: string, target: string, currentEpoch: string | undefined): boolean;
14
15
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ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