@agentshouse/mdruntime-adapter 0.1.0-alpha.9 → 0.1.0-c6ddfd288ac81
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.
- package/AGENTS.md +157 -26
- package/README.md +32 -0
- package/dist/actions.d.ts +4 -12
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +239 -332
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +256 -193
- package/dist/digest.js +1 -5
- package/dist/discovery.d.ts +20 -18
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +182 -210
- package/dist/gather.d.ts +3 -0
- package/dist/gather.d.ts.map +1 -0
- package/dist/gather.js +40 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/links.d.ts +11 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +51 -0
- package/dist/map.d.ts +2 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +6 -7
- package/dist/model.d.ts +2 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +21 -39
- package/dist/read.d.ts +29 -23
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +222 -195
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +30 -51
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +108 -124
- package/dist/stream.d.ts +9 -5
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +186 -203
- package/dist/transport.d.ts +45 -28
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +3 -3
- package/dist/version.d.ts +1 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +23 -18
- package/dist/write.d.ts +3 -3
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +120 -203
- package/package.json +4 -12
- package/dist/actions.js.map +0 -1
- package/dist/adapter.js.map +0 -1
- package/dist/digest.js.map +0 -1
- package/dist/discovery.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/map.js.map +0 -1
- package/dist/model.js.map +0 -1
- package/dist/read.js.map +0 -1
- package/dist/refusal.js.map +0 -1
- package/dist/site.js.map +0 -1
- package/dist/stream.js.map +0 -1
- package/dist/transport.js.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/write.js.map +0 -1
package/dist/stream.js
CHANGED
|
@@ -1,160 +1,149 @@
|
|
|
1
|
-
import {
|
|
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
4
|
const HELD_POSITIONS_MAX = 256;
|
|
6
5
|
function position(value) {
|
|
7
|
-
if (!/^(?:0|[1-9][0-9]*)$/.test(value))
|
|
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
|
|
14
|
+
const schemas = new Map();
|
|
20
15
|
const observers = new Set();
|
|
21
16
|
const conversationObservers = new Set();
|
|
22
|
-
const
|
|
23
|
-
let
|
|
24
|
-
|
|
17
|
+
const modeObservers = new Set();
|
|
18
|
+
let replicated = [];
|
|
19
|
+
const live = new Set();
|
|
20
|
+
const noted = new Set();
|
|
25
21
|
let listening = false;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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 (
|
|
51
|
-
|
|
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
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
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: '
|
|
52
|
+
kind: 'growing-text',
|
|
61
53
|
conversation,
|
|
62
|
-
|
|
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: '
|
|
58
|
+
kind: 'plan',
|
|
74
59
|
conversation,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
message: structuredClone(entry)
|
|
78
|
-
}
|
|
60
|
+
turn: frame.turn_id,
|
|
61
|
+
plan: structuredClone(frame.steps),
|
|
79
62
|
});
|
|
63
|
+
return;
|
|
80
64
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
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: '
|
|
117
|
-
conversation
|
|
118
|
-
|
|
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 === '
|
|
124
|
-
|
|
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 === '
|
|
95
|
+
if (frame.type === 'interactions') {
|
|
137
96
|
emitConversation({
|
|
138
|
-
kind: '
|
|
139
|
-
conversation
|
|
140
|
-
|
|
97
|
+
kind: 'questions',
|
|
98
|
+
conversation,
|
|
99
|
+
questions: structuredClone(frame.interactions),
|
|
141
100
|
});
|
|
142
101
|
return;
|
|
143
102
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
151
|
-
|
|
120
|
+
}
|
|
121
|
+
function interrupt(authority) {
|
|
122
|
+
const line = lines.get(authority);
|
|
123
|
+
if (line !== undefined)
|
|
124
|
+
lines.set(authority, { logEpoch: line.logEpoch, 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
|
|
155
|
-
|
|
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
148
|
if (at === null) {
|
|
160
149
|
interrupt(frame.authority);
|
|
@@ -164,135 +153,129 @@ export function houseNotifications(transport, mode) {
|
|
|
164
153
|
if (line?.logEpoch === frame.log_epoch) {
|
|
165
154
|
const last = line.frames.at(-1);
|
|
166
155
|
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
|
-
];
|
|
156
|
+
const next = continued
|
|
157
|
+
? [...line.frames, { position: at, entries: frame.entries }]
|
|
158
|
+
: [{ position: at, entries: frame.entries }];
|
|
179
159
|
lines.set(frame.authority, {
|
|
180
160
|
logEpoch: line.logEpoch,
|
|
181
|
-
frames: next.length > HELD_POSITIONS_MAX ? [] : next
|
|
161
|
+
frames: next.length > HELD_POSITIONS_MAX ? [] : next,
|
|
182
162
|
});
|
|
183
|
-
}
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
184
165
|
interrupt(frame.authority);
|
|
185
166
|
}
|
|
186
|
-
|
|
187
|
-
|
|
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
|
-
|
|
194
|
-
|
|
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
|
|
184
|
+
observe(notify) {
|
|
204
185
|
conversationObservers.add(notify);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
|
196
|
+
track(entries) {
|
|
215
197
|
locators.clear();
|
|
216
|
-
|
|
217
|
-
for (const entry of entries){
|
|
218
|
-
locators.set(entry.authority, [
|
|
219
|
-
|
|
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: [] });
|
|
228
204
|
}
|
|
229
205
|
}
|
|
230
|
-
for (const authority of lines.keys()){
|
|
231
|
-
if (!locators.has(authority))
|
|
206
|
+
for (const authority of lines.keys()) {
|
|
207
|
+
if (!locators.has(authority))
|
|
208
|
+
lines.delete(authority);
|
|
232
209
|
}
|
|
233
210
|
},
|
|
234
|
-
select
|
|
235
|
-
|
|
236
|
-
...named
|
|
237
|
-
];
|
|
238
|
-
subscribe();
|
|
239
|
-
},
|
|
240
|
-
observe (notify) {
|
|
211
|
+
select() { },
|
|
212
|
+
observe(notify) {
|
|
241
213
|
observers.add(notify);
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
stream.observe(receive);
|
|
245
|
-
}
|
|
246
|
-
return ()=>{
|
|
214
|
+
listen();
|
|
215
|
+
return () => {
|
|
247
216
|
observers.delete(notify);
|
|
248
217
|
};
|
|
249
218
|
},
|
|
250
|
-
advance
|
|
219
|
+
advance(tracked, from) {
|
|
251
220
|
const line = lines.get(tracked.authority);
|
|
252
221
|
const start = position(from.position);
|
|
253
|
-
if (line === undefined || start === null || line.logEpoch !== from.logEpoch)
|
|
254
|
-
|
|
255
|
-
|
|
222
|
+
if (line === undefined || start === null || line.logEpoch !== from.logEpoch)
|
|
223
|
+
return null;
|
|
224
|
+
const at = line.frames.findIndex((frame) => frame.position === start + 1n);
|
|
225
|
+
if (at === -1)
|
|
226
|
+
return null;
|
|
256
227
|
const pending = line.frames.slice(at);
|
|
257
228
|
const documents = {};
|
|
258
229
|
const revisions = {};
|
|
230
|
+
const changes = {};
|
|
259
231
|
const removals = [];
|
|
260
|
-
for (const frame of pending){
|
|
261
|
-
for (const entry of frame.entries){
|
|
262
|
-
if (!selects(tracked, entry.path))
|
|
232
|
+
for (const frame of pending) {
|
|
233
|
+
for (const entry of frame.entries) {
|
|
234
|
+
if (!selects(tracked, entry.path))
|
|
235
|
+
continue;
|
|
263
236
|
if (entry.kind === 'removed') {
|
|
264
237
|
delete documents[entry.path];
|
|
265
238
|
delete revisions[entry.path];
|
|
266
|
-
|
|
239
|
+
delete changes[entry.path];
|
|
240
|
+
if (!removals.includes(entry.path))
|
|
241
|
+
removals.push(entry.path);
|
|
267
242
|
continue;
|
|
268
243
|
}
|
|
269
|
-
if (entry.text === undefined)
|
|
270
|
-
|
|
244
|
+
if (entry.text === undefined)
|
|
245
|
+
return null;
|
|
246
|
+
if (mode === 'credential' && entry.revision === undefined)
|
|
247
|
+
return null;
|
|
248
|
+
const head = headChange(entry);
|
|
249
|
+
if (head === null)
|
|
250
|
+
return null;
|
|
271
251
|
documents[entry.path] = entry.text;
|
|
272
|
-
if (entry.revision !== undefined)
|
|
252
|
+
if (entry.revision !== undefined)
|
|
253
|
+
revisions[entry.path] = entry.revision;
|
|
254
|
+
if (head === undefined)
|
|
255
|
+
delete changes[entry.path];
|
|
256
|
+
else
|
|
257
|
+
changes[entry.path] = head;
|
|
273
258
|
const removed = removals.indexOf(entry.path);
|
|
274
|
-
if (removed !== -1)
|
|
259
|
+
if (removed !== -1)
|
|
260
|
+
removals.splice(removed, 1);
|
|
275
261
|
}
|
|
276
262
|
}
|
|
277
263
|
const last = pending.at(-1);
|
|
278
|
-
if (last === undefined)
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
frames: pending
|
|
282
|
-
});
|
|
264
|
+
if (last === undefined)
|
|
265
|
+
return null;
|
|
266
|
+
lines.set(tracked.authority, { logEpoch: line.logEpoch, frames: pending });
|
|
283
267
|
return {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
position: last.position.toString(),
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
268
|
+
page: {
|
|
269
|
+
kind: 'net-advancement',
|
|
270
|
+
roomVersion: roomVersion({ position: last.position.toString(), logEpoch: line.logEpoch }),
|
|
271
|
+
documents,
|
|
272
|
+
revisions,
|
|
273
|
+
changes,
|
|
274
|
+
binaryTargets: [],
|
|
275
|
+
removals: removals.sort(),
|
|
276
|
+
},
|
|
277
|
+
entries: pending.flatMap((frame) => frame.entries),
|
|
293
278
|
};
|
|
294
|
-
}
|
|
279
|
+
},
|
|
295
280
|
};
|
|
296
281
|
}
|
|
297
|
-
|
|
298
|
-
//# sourceMappingURL=stream.js.map
|
package/dist/transport.d.ts
CHANGED
|
@@ -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
|
|
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 = '
|
|
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;
|
|
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: '
|
|
65
|
+
type: 'interactions';
|
|
71
66
|
conversation_id: string;
|
|
72
|
-
|
|
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
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -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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AK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC/C,CAAC"}
|
package/dist/transport.js
CHANGED
|
@@ -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
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export const SITE_DOOR_SUBMIT = '/_house/door/submit';
|
|
11
|
+
export const PRIVATE_LOCATOR = 'private';
|
|
12
|
+
export const DOOR_SELECTION_MAX = 256;
|
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
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAEnD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM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