@agentshouse/mdruntime-adapter 0.1.0-ce4626067e686 → 0.1.0-ce5ef9afd7e9a
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 +289 -246
- package/dist/actions.d.ts +68 -1
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +134 -110
- package/dist/adapter.d.ts +1 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +335 -98
- package/dist/discovery.d.ts +5 -3
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +34 -12
- package/dist/gather.d.ts +1 -1
- package/dist/gather.d.ts.map +1 -1
- package/dist/gather.js +4 -14
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/model.d.ts +0 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -3
- package/dist/part.d.ts +13 -0
- package/dist/part.d.ts.map +1 -0
- package/dist/part.js +80 -0
- package/dist/read.d.ts +70 -23
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +351 -136
- package/dist/referrer.d.ts +9 -0
- package/dist/referrer.d.ts.map +1 -0
- package/dist/referrer.js +41 -0
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +2 -1
- package/dist/room-types.d.ts +6 -0
- package/dist/room-types.d.ts.map +1 -0
- package/dist/room-types.js +66 -0
- package/dist/site.d.ts +1 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +170 -56
- package/dist/stream.d.ts +5 -4
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +355 -42
- package/dist/transport.d.ts +67 -8
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +4 -0
- package/dist/upload.d.ts +12 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +52 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/write.d.ts +13 -9
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +141 -40
- package/package.json +2 -3
- package/dist/links.d.ts +0 -20
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js +0 -104
package/dist/refusal.js
CHANGED
|
@@ -18,8 +18,9 @@ function doorFailure(status, body) {
|
|
|
18
18
|
const refusal = doorRefusal(body);
|
|
19
19
|
if (status === 401)
|
|
20
20
|
return { kind: 'revoked-authorization' };
|
|
21
|
-
if (refusal?.retryable === true)
|
|
21
|
+
if (refusal?.retryable === true || refusal?.code === 'update_required') {
|
|
22
22
|
return { kind: 'transport-uncertainty' };
|
|
23
|
+
}
|
|
23
24
|
if (status === 404 || refusal?.code === 'room_not_found')
|
|
24
25
|
return { kind: 'room-not-readable' };
|
|
25
26
|
if (status < 400)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const INBOX_CHANNEL_KINDS: readonly ['telegram-bot'];
|
|
2
|
+
export type InboxChannelKind = (typeof INBOX_CHANNEL_KINDS)[number];
|
|
3
|
+
export declare const INBOX_CHAT_TYPE = "inbox-chat";
|
|
4
|
+
export declare const INBOX_MESSAGE_TYPE = "inbox-message";
|
|
5
|
+
export declare const HOUSE_ROOM_TYPES: string;
|
|
6
|
+
//# sourceMappingURL=room-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"room-types.d.ts","sourceRoot":"","sources":["../src/room-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,YAAI,cAAc,CAAU,CAAC;AAE7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAalD,eAAO,MAAM,gBAAgB,QAsDjB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export const INBOX_CHANNEL_KINDS = ['telegram-bot'];
|
|
2
|
+
export const INBOX_CHAT_TYPE = 'inbox-chat';
|
|
3
|
+
export const INBOX_MESSAGE_TYPE = 'inbox-message';
|
|
4
|
+
const IDENTITY = "{ type: string, pattern: '^\\S+$' }";
|
|
5
|
+
const AGENT = [' agent: { type: string, format: uuid }', ' name: { type: string }'];
|
|
6
|
+
const ASSIGNEE = [
|
|
7
|
+
' type: object',
|
|
8
|
+
' properties:',
|
|
9
|
+
' user: { type: string, format: uuid }',
|
|
10
|
+
...AGENT,
|
|
11
|
+
];
|
|
12
|
+
export const HOUSE_ROOM_TYPES = [
|
|
13
|
+
`${INBOX_CHAT_TYPE}:`,
|
|
14
|
+
' properties:',
|
|
15
|
+
' inbox: { type: string, format: uuid }',
|
|
16
|
+
` channel: { enum: [${INBOX_CHANNEL_KINDS.join(', ')}] }`,
|
|
17
|
+
` chat: ${IDENTITY}`,
|
|
18
|
+
' customer:',
|
|
19
|
+
' type: object',
|
|
20
|
+
' properties:',
|
|
21
|
+
' name: { type: string }',
|
|
22
|
+
` username: ${IDENTITY}`,
|
|
23
|
+
` phone: ${IDENTITY}`,
|
|
24
|
+
' assignee:',
|
|
25
|
+
...ASSIGNEE,
|
|
26
|
+
' return_to:',
|
|
27
|
+
' type: object',
|
|
28
|
+
' properties:',
|
|
29
|
+
...AGENT,
|
|
30
|
+
' conversation: { type: string, format: uuid }',
|
|
31
|
+
' required: [inbox, channel, chat, customer]',
|
|
32
|
+
`${INBOX_MESSAGE_TYPE}:`,
|
|
33
|
+
' properties:',
|
|
34
|
+
' direction: { enum: [in, out] }',
|
|
35
|
+
' sender:',
|
|
36
|
+
' type: object',
|
|
37
|
+
' properties:',
|
|
38
|
+
' name: { type: string }',
|
|
39
|
+
` username: ${IDENTITY}`,
|
|
40
|
+
' sent_at: { type: string, format: date-time }',
|
|
41
|
+
` channel_message: ${IDENTITY}`,
|
|
42
|
+
' state: { enum: [sending, sent, failed] }',
|
|
43
|
+
' reason: { type: string }',
|
|
44
|
+
' reactions:',
|
|
45
|
+
' type: array',
|
|
46
|
+
' items:',
|
|
47
|
+
' type: object',
|
|
48
|
+
' properties:',
|
|
49
|
+
' reaction: { type: string, minLength: 1 }',
|
|
50
|
+
' sender:',
|
|
51
|
+
' type: object',
|
|
52
|
+
' properties:',
|
|
53
|
+
` id: ${IDENTITY}`,
|
|
54
|
+
' name: { type: string }',
|
|
55
|
+
` username: ${IDENTITY}`,
|
|
56
|
+
' count: { type: integer, minimum: 1 }',
|
|
57
|
+
' required: [reaction]',
|
|
58
|
+
` post: ${IDENTITY}`,
|
|
59
|
+
' assignee:',
|
|
60
|
+
...ASSIGNEE,
|
|
61
|
+
' sent_outside: { const: true }',
|
|
62
|
+
' required: [direction]',
|
|
63
|
+
' if: { properties: { direction: { const: in } } }',
|
|
64
|
+
' then: { required: [sent_at] }',
|
|
65
|
+
'',
|
|
66
|
+
].join('\n');
|
package/dist/site.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Adapter } from '@agentshouse/mdruntime';
|
|
2
2
|
import { type HouseSiteTransport } from './transport.js';
|
|
3
|
-
export declare function createSiteAdapter(transport: HouseSiteTransport): Adapter;
|
|
3
|
+
export declare function createSiteAdapter(transport: HouseSiteTransport, snapshot?: boolean): Adapter;
|
|
4
4
|
//# sourceMappingURL=site.d.ts.map
|
package/dist/site.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,
|
|
1
|
+
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAUR,MAAM,wBAAwB,CAAC;AA8BhC,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAuCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAoQ1F"}
|
package/dist/site.js
CHANGED
|
@@ -1,73 +1,127 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { stepped } from '@agentshouse/mdruntime';
|
|
2
|
+
import { actionOutcome, SITE_SUBMIT } from './actions.js';
|
|
2
3
|
import { mapDiscovery, parseSiteDiscovery, siteCapabilities, siteTracked, } from './discovery.js';
|
|
3
|
-
import {
|
|
4
|
-
import { advancedScope,
|
|
4
|
+
import { partModels, streamedModels, viewModels } from './model.js';
|
|
5
|
+
import { advancedScope, bootstrapping, emptyScope, housePart, parseEnumeration, parseSiteParted, refreshFrom, viewOf, wholeView, } from './read.js';
|
|
6
|
+
import { PART_ATTEMPTS, unverifiedPart } from './part.js';
|
|
5
7
|
import { classifyDoor, classifyRead, discoveryFailure } from './refusal.js';
|
|
8
|
+
import { HOUSE_ROOM_TYPES } from './room-types.js';
|
|
6
9
|
import { houseNotifications } from './stream.js';
|
|
7
|
-
import { SITE_DOOR_BOOTSTRAP, SITE_DOOR_DISCOVER, SITE_DOOR_ENUMERATE, SITE_DOOR_SUBMIT, } from './transport.js';
|
|
10
|
+
import { SITE_DOOR_BOOTSTRAP, SITE_DOOR_DISCOVER, SITE_DOOR_ENUMERATE, SITE_DOOR_SUBMIT, SITE_FILE_RECORD, SITE_FILES, } from './transport.js';
|
|
11
|
+
import { houseReferrer } from './referrer.js';
|
|
8
12
|
import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
|
|
9
13
|
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
14
|
+
function unfound() {
|
|
15
|
+
return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
|
|
16
|
+
}
|
|
10
17
|
function siteRoom(tracked) {
|
|
11
18
|
return {
|
|
12
19
|
name: tracked.handle,
|
|
13
20
|
locator: tracked.locator,
|
|
14
21
|
handle: tracked.handle,
|
|
15
22
|
roomVersion: roomVersion(tracked),
|
|
16
|
-
operations: {
|
|
17
|
-
replica: { selection: tracked.locator, admission: 'admitted' },
|
|
23
|
+
operations: { write: [], delete: [] },
|
|
24
|
+
replica: { selection: tracked.locator, admission: 'admitted', offline: 'open' },
|
|
18
25
|
providerOwnedPaths: [],
|
|
19
26
|
};
|
|
20
27
|
}
|
|
21
28
|
function settled(refused) {
|
|
22
29
|
return refused.kind === 'beyond-horizon' ? UNCERTAIN : refused;
|
|
23
30
|
}
|
|
24
|
-
export function createSiteAdapter(transport) {
|
|
31
|
+
export function createSiteAdapter(transport, snapshot = false) {
|
|
25
32
|
const notifications = houseNotifications(transport, 'site');
|
|
26
33
|
const tracked = new Map();
|
|
27
|
-
|
|
34
|
+
const expired = new Map();
|
|
35
|
+
function published(referrer) {
|
|
36
|
+
const named = houseReferrer(referrer, tracked);
|
|
37
|
+
return named === null || !tracked.has(named.locator) ? null : named;
|
|
38
|
+
}
|
|
39
|
+
function fileRoute(request) {
|
|
40
|
+
const named = published(request.kind === 'path' ? { room: request.locator, path: request.path } : request.referrer);
|
|
41
|
+
if (named === null) {
|
|
42
|
+
return { kind: 'rejected', code: 'referrer_unknown', fields: {}, retryable: false };
|
|
43
|
+
}
|
|
44
|
+
if (request.fileRef === undefined)
|
|
45
|
+
return unfound();
|
|
46
|
+
const { room_ref, path, record } = named.referrer;
|
|
47
|
+
return `${SITE_FILES}${room_ref}/${encodeURIComponent(request.fileRef)}/${path === undefined
|
|
48
|
+
? `${SITE_FILE_RECORD}/${encodeURIComponent(record)}`
|
|
49
|
+
: encodeURIComponent(path)}`;
|
|
50
|
+
}
|
|
51
|
+
async function enumerated(entry, from, page) {
|
|
28
52
|
const answer = await transport.door(SITE_DOOR_ENUMERATE, {
|
|
29
|
-
positions: [
|
|
53
|
+
positions: [
|
|
54
|
+
page === undefined
|
|
55
|
+
? presented(entry.authority, from)
|
|
56
|
+
: {
|
|
57
|
+
...presented(entry.authority, { position: page.after, logEpoch: from.logEpoch }),
|
|
58
|
+
page: { through: page.through, read: page.read },
|
|
59
|
+
},
|
|
60
|
+
],
|
|
30
61
|
});
|
|
31
62
|
const classified = classifyRead(answer.status, answer.body, entry.locator);
|
|
32
63
|
if (classified !== null)
|
|
33
64
|
return classified;
|
|
34
|
-
|
|
65
|
+
const found = parseEnumeration(answer.body, 'site');
|
|
66
|
+
if (found === null)
|
|
67
|
+
return UNCERTAIN;
|
|
68
|
+
return viewOf(found, entry) ?? { kind: 'room-not-readable', locator: entry.locator };
|
|
35
69
|
}
|
|
36
|
-
async function
|
|
37
|
-
const
|
|
70
|
+
async function enumeration(entry, from) {
|
|
71
|
+
const first = await enumerated(entry, from);
|
|
72
|
+
return 'kind' in first ? first : wholeView(first, (page) => enumerated(entry, from, page));
|
|
73
|
+
}
|
|
74
|
+
async function partedRoom(entry) {
|
|
75
|
+
const cut = expired.get(entry.locator);
|
|
76
|
+
const answer = await transport.read(`${SITE_DOOR_BOOTSTRAP}${entry.authority}${cut === undefined ? '' : `?expired=${cut}`}`);
|
|
38
77
|
const classified = classifyDoor(answer.status, answer.body, entry.locator);
|
|
39
78
|
if (classified !== null)
|
|
40
|
-
return
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
79
|
+
return classified;
|
|
80
|
+
const room = parseSiteParted(answer.body);
|
|
81
|
+
return room === null || room.anchor !== entry.authority ? UNCERTAIN : room;
|
|
82
|
+
}
|
|
83
|
+
async function fetchedPart(entry, room, listed) {
|
|
84
|
+
for (let attempt = 0; attempt < PART_ATTEMPTS; attempt += 1) {
|
|
85
|
+
const answer = await transport.read(`${SITE_DOOR_BOOTSTRAP}${entry.authority}?part=${encodeURIComponent(listed.part)}`);
|
|
86
|
+
const failure = classifyRead(answer.status, answer.body, entry.locator);
|
|
87
|
+
if (failure?.kind === 'beyond-horizon')
|
|
88
|
+
expired.set(entry.locator, room.position);
|
|
89
|
+
if (failure !== null)
|
|
90
|
+
return failure;
|
|
91
|
+
const scope = await housePart(room, answer.body, listed, 'site');
|
|
92
|
+
if (scope !== null)
|
|
93
|
+
return scope;
|
|
94
|
+
}
|
|
95
|
+
return unverifiedPart(entry.locator);
|
|
96
|
+
}
|
|
97
|
+
async function caughtUp(entry, continued) {
|
|
98
|
+
const listed = continued.room.parts[continued.next];
|
|
99
|
+
const scope = listed === undefined
|
|
100
|
+
? emptyScope(continued.room)
|
|
101
|
+
: await fetchedPart(entry, continued.room, listed);
|
|
102
|
+
if ('kind' in scope)
|
|
103
|
+
return scope;
|
|
104
|
+
if (continued.room.parts.length > 1 || roomVersion(scope) === roomVersion(entry))
|
|
105
|
+
return scope;
|
|
106
|
+
const view = await enumeration(entry, scope);
|
|
107
|
+
if ('kind' in view)
|
|
108
|
+
return settled(view);
|
|
109
|
+
return stepped(advancedScope(scope, view));
|
|
53
110
|
}
|
|
54
111
|
async function refreshed(entry, fromRoomVersion) {
|
|
55
112
|
const from = logPosition(fromRoomVersion);
|
|
56
113
|
if (from === null)
|
|
57
114
|
return { kind: 'beyond-horizon' };
|
|
58
|
-
const streamed = notifications.advance(entry, from);
|
|
115
|
+
const streamed = await stepped(notifications.advance(entry, from));
|
|
59
116
|
if (streamed !== null) {
|
|
60
117
|
const models = await streamedModels(streamed.schemas, entry, 'site');
|
|
61
118
|
return models === undefined ? streamed.page : { ...streamed.page, models };
|
|
62
119
|
}
|
|
63
|
-
const
|
|
64
|
-
if ('kind' in
|
|
65
|
-
return
|
|
66
|
-
const view = viewOf(found, entry);
|
|
67
|
-
if (view === undefined)
|
|
68
|
-
return { kind: 'room-not-readable', locator: entry.locator };
|
|
120
|
+
const view = await enumeration(entry, from);
|
|
121
|
+
if ('kind' in view)
|
|
122
|
+
return view;
|
|
69
123
|
notifications.reach(entry.authority, view);
|
|
70
|
-
const answer = refreshFrom(view, fromRoomVersion);
|
|
124
|
+
const answer = await refreshFrom(view, fromRoomVersion);
|
|
71
125
|
if (answer.kind !== 'net-advancement')
|
|
72
126
|
return answer;
|
|
73
127
|
const models = await viewModels(view, entry);
|
|
@@ -75,6 +129,8 @@ export function createSiteAdapter(transport) {
|
|
|
75
129
|
}
|
|
76
130
|
return {
|
|
77
131
|
localSaves: true,
|
|
132
|
+
exhaustiveDiscovery: true,
|
|
133
|
+
roomTypes: HOUSE_ROOM_TYPES,
|
|
78
134
|
async authorize() {
|
|
79
135
|
return {};
|
|
80
136
|
},
|
|
@@ -97,14 +153,32 @@ export function createSiteAdapter(transport) {
|
|
|
97
153
|
const entry = tracked.get(request.locator);
|
|
98
154
|
if (entry === undefined)
|
|
99
155
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
156
|
+
let continued;
|
|
157
|
+
if (request.pageToken === undefined) {
|
|
158
|
+
const room = await partedRoom(entry);
|
|
159
|
+
if ('kind' in room)
|
|
160
|
+
return room;
|
|
161
|
+
continued = { room, next: 0, seen: [] };
|
|
162
|
+
}
|
|
163
|
+
else
|
|
164
|
+
continued = JSON.parse(request.pageToken);
|
|
165
|
+
const scope = await caughtUp(entry, continued);
|
|
166
|
+
if ('kind' in scope)
|
|
167
|
+
return scope;
|
|
168
|
+
notifications.reach(entry.authority, scope);
|
|
169
|
+
const next = continued.next + 1;
|
|
170
|
+
const more = next < continued.room.parts.length;
|
|
171
|
+
const seen = [
|
|
172
|
+
...continued.seen,
|
|
173
|
+
...entry.schemas.filter((schema) => scope.files.some((file) => file.path === schema)),
|
|
174
|
+
];
|
|
175
|
+
const models = await partModels(scope, entry, new Set(seen), !more);
|
|
176
|
+
const { folders: _folders, ...page } = await stepped(bootstrapping(scope));
|
|
177
|
+
return {
|
|
178
|
+
...page,
|
|
179
|
+
...(models === undefined ? {} : { models }),
|
|
180
|
+
...(more ? { pageToken: JSON.stringify({ ...continued, next, seen }) } : {}),
|
|
181
|
+
};
|
|
108
182
|
},
|
|
109
183
|
async refresh(_authorization, request) {
|
|
110
184
|
const entry = tracked.get(request.locator);
|
|
@@ -112,6 +186,11 @@ export function createSiteAdapter(transport) {
|
|
|
112
186
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
113
187
|
if (request.pageToken !== undefined)
|
|
114
188
|
return UNCERTAIN;
|
|
189
|
+
if (snapshot) {
|
|
190
|
+
return request.fromRoomVersion === roomVersion(entry)
|
|
191
|
+
? { kind: 'still-current' }
|
|
192
|
+
: { kind: 'beyond-horizon' };
|
|
193
|
+
}
|
|
115
194
|
return refreshed(entry, request.fromRoomVersion);
|
|
116
195
|
},
|
|
117
196
|
async mutate() {
|
|
@@ -120,6 +199,34 @@ export function createSiteAdapter(transport) {
|
|
|
120
199
|
async history() {
|
|
121
200
|
return { kind: 'no-history' };
|
|
122
201
|
},
|
|
202
|
+
async binary(_authorization, request) {
|
|
203
|
+
const route = fileRoute(request);
|
|
204
|
+
if (typeof route !== 'string')
|
|
205
|
+
return route;
|
|
206
|
+
const read = await transport.download(route);
|
|
207
|
+
if (read.status === 404)
|
|
208
|
+
return unfound();
|
|
209
|
+
return read.status === 200 && read.body !== null
|
|
210
|
+
? { kind: 'binary', body: read.body, mediaType: read.mediaType }
|
|
211
|
+
: UNCERTAIN;
|
|
212
|
+
},
|
|
213
|
+
async link(_authorization, request) {
|
|
214
|
+
const route = fileRoute(request);
|
|
215
|
+
if (typeof route !== 'string')
|
|
216
|
+
return route;
|
|
217
|
+
return {
|
|
218
|
+
kind: 'link',
|
|
219
|
+
url: route,
|
|
220
|
+
name: request.path.slice(request.path.lastIndexOf('/') + 1),
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
referrerScope(referrer) {
|
|
224
|
+
const named = published(referrer);
|
|
225
|
+
if (named === null)
|
|
226
|
+
return null;
|
|
227
|
+
const { path } = named.referrer;
|
|
228
|
+
return { locator: named.locator, ...(path === undefined ? {} : { path }) };
|
|
229
|
+
},
|
|
123
230
|
reached(locator, version, target) {
|
|
124
231
|
return reachedVersion(version, target, tracked.get(locator)?.logEpoch);
|
|
125
232
|
},
|
|
@@ -127,7 +234,7 @@ export function createSiteAdapter(transport) {
|
|
|
127
234
|
return followsVersion(version, next);
|
|
128
235
|
},
|
|
129
236
|
async action(_authorization, request) {
|
|
130
|
-
if (request.name !==
|
|
237
|
+
if (request.name !== SITE_SUBMIT) {
|
|
131
238
|
return {
|
|
132
239
|
kind: 'rejected',
|
|
133
240
|
code: 'action-unimplemented',
|
|
@@ -137,22 +244,29 @@ export function createSiteAdapter(transport) {
|
|
|
137
244
|
}
|
|
138
245
|
if (!transport.online())
|
|
139
246
|
return UNCERTAIN;
|
|
140
|
-
return actionOutcome(await transport.door(SITE_DOOR_SUBMIT, request.input),
|
|
247
|
+
return actionOutcome(await transport.door(SITE_DOOR_SUBMIT, request.input), SITE_SUBMIT);
|
|
141
248
|
},
|
|
142
|
-
roomStream:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
249
|
+
roomStream: snapshot
|
|
250
|
+
? undefined
|
|
251
|
+
: {
|
|
252
|
+
hold(rooms) {
|
|
253
|
+
notifications.send(rooms.flatMap((room) => {
|
|
254
|
+
const entry = tracked.get(room.locator);
|
|
255
|
+
const at = logPosition(room.roomVersion);
|
|
256
|
+
if (entry === undefined || at === null)
|
|
257
|
+
return [];
|
|
258
|
+
notifications.reach(entry.authority, at);
|
|
259
|
+
return [presented(entry.authority, at)];
|
|
260
|
+
}));
|
|
261
|
+
},
|
|
262
|
+
reopen: notifications.reopen,
|
|
263
|
+
observe: notifications.observe,
|
|
264
|
+
published(locator, roomVersion) {
|
|
265
|
+
const at = logPosition(roomVersion);
|
|
266
|
+
if (at !== null)
|
|
267
|
+
notifications.published(locator, at);
|
|
268
|
+
},
|
|
152
269
|
},
|
|
153
|
-
reopen: notifications.reopen,
|
|
154
|
-
observe: notifications.observe,
|
|
155
|
-
},
|
|
156
270
|
serviceMode: notifications.serviceMode,
|
|
157
271
|
};
|
|
158
272
|
}
|
package/dist/stream.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ConversationStream, type RefreshPage, type RoomStreamEvent, type ServiceModeSignal, type StreamReceipts } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
3
|
import type { HouseDoor, HouseHeldRoom, HouseMode, HouseStreamEntry } from './transport.js';
|
|
4
4
|
import { type LogPosition } from './version.js';
|
|
5
5
|
export type HeldRevision = (path: string, revision: string) => boolean;
|
|
6
6
|
export type StreamedAdvancement = {
|
|
7
7
|
page: RefreshPage;
|
|
8
|
-
entries: readonly HouseStreamEntry[];
|
|
9
8
|
schemas: ReadonlyMap<string, HouseStreamEntry>;
|
|
10
9
|
};
|
|
11
10
|
export type HouseNotifications = {
|
|
12
11
|
runtime: string;
|
|
13
|
-
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
12
|
+
observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
|
|
14
13
|
send(rooms: readonly HouseHeldRoom[]): void;
|
|
14
|
+
published(locator: string, at: LogPosition): void;
|
|
15
15
|
reopen(): void;
|
|
16
16
|
track(authorities: readonly TrackedAuthority[]): void;
|
|
17
17
|
reach(authority: string, at: LogPosition): void;
|
|
18
|
-
|
|
18
|
+
edited(tracked: TrackedAuthority, from: LogPosition): readonly string[];
|
|
19
|
+
advance(tracked: TrackedAuthority, from: LogPosition, holds?: HeldRevision): Generator<number, StreamedAdvancement | null, void>;
|
|
19
20
|
conversations: ConversationStream;
|
|
20
21
|
serviceMode: ServiceModeSignal;
|
|
21
22
|
};
|
package/dist/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EAEvB,KAAK,WAAW,EAChB,KAAK,eAAe,EAEpB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAUvD,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EAEb,SAAS,EAET,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AA0C7D,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM,IAAI,CAAC;IACxF,IAAI,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAAC;IAC5C,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;IAClD,MAAM,IAAI,IAAI,CAAC;IACf,KAAK,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtD,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD,MAAM,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,MAAM,EAAE,CAAC;IACxE,OAAO,CACL,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,EACjB,KAAK,CAAC,EAAE,YAAY,GACnB,SAAS,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC;IACvD,aAAa,EAAE,kBAAkB,CAAC;IAClC,WAAW,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAmFF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,kBAAkB,CA8jB5F"}
|