@agentshouse/mdruntime-adapter 0.1.0-ca3a44982cbe7 → 0.1.0-ca632988146a3

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 (68) hide show
  1. package/README.md +2 -2
  2. package/dist/actions.d.ts +15 -7
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +33 -146
  5. package/dist/adapter.d.ts +1 -0
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +296 -171
  8. package/dist/app-reference.d.ts +2 -0
  9. package/dist/app-reference.d.ts.map +1 -0
  10. package/dist/app-reference.js +2 -0
  11. package/dist/crockford.d.ts +4 -0
  12. package/dist/crockford.d.ts.map +1 -0
  13. package/dist/crockford.js +3 -0
  14. package/dist/discovery.d.ts +7 -10
  15. package/dist/discovery.d.ts.map +1 -1
  16. package/dist/discovery.js +39 -34
  17. package/dist/gather.d.ts +1 -2
  18. package/dist/gather.d.ts.map +1 -1
  19. package/dist/gather.js +5 -15
  20. package/dist/house-model.d.ts +2 -0
  21. package/dist/house-model.d.ts.map +1 -0
  22. package/dist/house-model.js +491 -0
  23. package/dist/index.d.ts +8 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +7 -1
  26. package/dist/model.d.ts +5 -2
  27. package/dist/model.d.ts.map +1 -1
  28. package/dist/model.js +10 -15
  29. package/dist/part.d.ts +14 -0
  30. package/dist/part.d.ts.map +1 -0
  31. package/dist/part.js +90 -0
  32. package/dist/read.d.ts +66 -18
  33. package/dist/read.d.ts.map +1 -1
  34. package/dist/read.js +318 -128
  35. package/dist/refusal.d.ts.map +1 -1
  36. package/dist/refusal.js +2 -1
  37. package/dist/room-stream.d.ts +19 -0
  38. package/dist/room-stream.d.ts.map +1 -0
  39. package/dist/room-stream.js +57 -0
  40. package/dist/room-types.d.ts +7 -0
  41. package/dist/room-types.d.ts.map +1 -0
  42. package/dist/room-types.js +126 -0
  43. package/dist/site.d.ts +1 -1
  44. package/dist/site.d.ts.map +1 -1
  45. package/dist/site.js +115 -84
  46. package/dist/stream.d.ts +5 -4
  47. package/dist/stream.d.ts.map +1 -1
  48. package/dist/stream.js +355 -45
  49. package/dist/transport.d.ts +66 -11
  50. package/dist/transport.d.ts.map +1 -1
  51. package/dist/transport.js +2 -1
  52. package/dist/upload.d.ts +12 -0
  53. package/dist/upload.d.ts.map +1 -0
  54. package/dist/upload.js +63 -0
  55. package/dist/version.d.ts +1 -0
  56. package/dist/version.d.ts.map +1 -1
  57. package/dist/version.js +1 -1
  58. package/dist/write.d.ts +16 -1
  59. package/dist/write.d.ts.map +1 -1
  60. package/dist/write.js +106 -57
  61. package/package.json +8 -5
  62. package/AGENTS.md +0 -299
  63. package/dist/handed.d.ts +0 -15
  64. package/dist/handed.d.ts.map +0 -1
  65. package/dist/handed.js +0 -38
  66. package/dist/referrer.d.ts +0 -7
  67. package/dist/referrer.d.ts.map +0 -1
  68. package/dist/referrer.js +0 -35
@@ -0,0 +1,126 @@
1
+ import { APP_REFERENCE_PATTERN } from './app-reference.js';
2
+ import { HOUSE_MODEL_TYPES } from './house-model.js';
3
+ export const INBOX_CHANNEL_KINDS = [
4
+ 'telegram-bot',
5
+ 'telegram-business',
6
+ 'whatsapp',
7
+ 'messenger',
8
+ 'instagram',
9
+ 'viber',
10
+ 'tiktok',
11
+ ];
12
+ export const INBOX_CHAT_TYPE = 'inbox-chat';
13
+ export const INBOX_MESSAGE_TYPE = 'inbox-message';
14
+ export const HOUSE_NAMEABLE_ROOM_TYPES = [INBOX_CHAT_TYPE, INBOX_MESSAGE_TYPE];
15
+ const WAYFINDING_MAP_TYPE = 'wayfinding-map';
16
+ const WAYFINDING_TICKET_TYPE = 'wayfinding-ticket';
17
+ const WAYFINDING_MAP_SECTIONS = [
18
+ 'Destination',
19
+ 'Notes',
20
+ 'Decisions so far',
21
+ 'Not yet specified',
22
+ 'Out of scope',
23
+ ];
24
+ const IDENTITY = "{ type: string, pattern: '^\\S+$' }";
25
+ const AGENT = [' agent: { type: string, format: uuid }', ' name: { type: string }'];
26
+ const ASSIGNEE = [
27
+ ' type: object',
28
+ ' properties:',
29
+ ' user: { type: string, format: uuid }',
30
+ ...AGENT,
31
+ ];
32
+ export const HOUSE_ROOM_TYPES = [
33
+ `${INBOX_CHAT_TYPE}:`,
34
+ ' properties:',
35
+ ' inbox: { type: string, format: uuid }',
36
+ ` channel: { enum: [${INBOX_CHANNEL_KINDS.join(', ')}] }`,
37
+ ` chat: ${IDENTITY}`,
38
+ ' customer:',
39
+ ' type: object',
40
+ ' properties:',
41
+ ' name: { type: string }',
42
+ ` username: ${IDENTITY}`,
43
+ ` phone: ${IDENTITY}`,
44
+ ' assignee:',
45
+ ...ASSIGNEE,
46
+ ' return_to:',
47
+ ' type: object',
48
+ ' properties:',
49
+ ...AGENT,
50
+ ' conversation: { type: string, format: uuid }',
51
+ ' required: [inbox, channel, chat, customer]',
52
+ `${INBOX_MESSAGE_TYPE}:`,
53
+ ' properties:',
54
+ ' direction: { enum: [in, out] }',
55
+ ' sender:',
56
+ ' type: object',
57
+ ' properties:',
58
+ ' name: { type: string }',
59
+ ` username: ${IDENTITY}`,
60
+ ' sent_at: { type: string, format: date-time }',
61
+ ` channel_message: ${IDENTITY}`,
62
+ ' state: { enum: [sending, sent, failed] }',
63
+ ' reason: { type: string }',
64
+ ' labelled: { const: true }',
65
+ ' reactions:',
66
+ ' type: array',
67
+ ' items:',
68
+ ' type: object',
69
+ ' properties:',
70
+ ' reaction: { type: string, minLength: 1 }',
71
+ ' sender:',
72
+ ' type: object',
73
+ ' properties:',
74
+ ` id: ${IDENTITY}`,
75
+ ' name: { type: string }',
76
+ ` username: ${IDENTITY}`,
77
+ ' count: { type: integer, minimum: 1 }',
78
+ ' required: [reaction]',
79
+ ` post: ${IDENTITY}`,
80
+ ' assignee:',
81
+ ...ASSIGNEE,
82
+ ' sent_outside: { const: true }',
83
+ ' template:',
84
+ ' type: object',
85
+ ' properties:',
86
+ ' name: { type: string, minLength: 1 }',
87
+ ' language: { type: string, minLength: 1 }',
88
+ ' required: [name, language]',
89
+ ' values:',
90
+ ' type: object',
91
+ ' additionalProperties: { type: string }',
92
+ ' withheld: { const: true }',
93
+ ' required: [direction]',
94
+ ' if: { properties: { direction: { const: in } } }',
95
+ ' then: { required: [sent_at] }',
96
+ `${WAYFINDING_MAP_TYPE}:`,
97
+ ' properties:',
98
+ ' title: { type: string }',
99
+ ' required: [title]',
100
+ ' sections:',
101
+ ...WAYFINDING_MAP_SECTIONS.map((name) => ` ${name}: { kind: text, required: true }`),
102
+ `${WAYFINDING_TICKET_TYPE}:`,
103
+ ' properties:',
104
+ ' title: { type: string }',
105
+ ' kind: { enum: [research, prototype, grilling, task] }',
106
+ ' status: { enum: [open, in-progress, done, out-of-scope] }',
107
+ ` map: { type: string, reference: ${WAYFINDING_MAP_TYPE} }`,
108
+ ` blocked_by: { type: array, items: { type: string, reference: ${WAYFINDING_TICKET_TYPE} } }`,
109
+ ' assignee:',
110
+ ...ASSIGNEE,
111
+ ' conversation: { type: string, format: uuid }',
112
+ ` app: { type: string, pattern: '${APP_REFERENCE_PATTERN.source}' }`,
113
+ ' required: [title, kind, status, map, blocked_by]',
114
+ ' sections:',
115
+ ' Question: { kind: text }',
116
+ ' Answer: { kind: text }',
117
+ ' allOf:',
118
+ ' - if: { properties: { status: { enum: [in-progress, done, out-of-scope] } }, required: [status] }',
119
+ ' then: { required: [assignee] }',
120
+ ' else: { properties: { assignee: false } }',
121
+ ' - if: { properties: { assignee: { required: [agent] } }, required: [assignee] }',
122
+ ' else: { properties: { conversation: false } }',
123
+ ' - if: { properties: { status: { enum: [done, out-of-scope] } }, required: [status] }',
124
+ ' then: { sections: { Answer: { kind: text, required: true } } }',
125
+ HOUSE_MODEL_TYPES,
126
+ ].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
@@ -1 +1 @@
1
- {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAOR,MAAM,wBAAwB,CAAC;AAsBhC,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAiCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CA8KxE"}
1
+ {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAUR,MAAM,wBAAwB,CAAC;AAwBhC,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAgCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAqN1F"}
package/dist/site.js CHANGED
@@ -1,78 +1,101 @@
1
+ import { stepped } from '@agentshouse/mdruntime';
1
2
  import { actionOutcome, SITE_SUBMIT } from './actions.js';
2
3
  import { mapDiscovery, parseSiteDiscovery, siteCapabilities, siteTracked, } from './discovery.js';
3
- import { scopeModels, streamedModels, viewModels } from './model.js';
4
- import { advancedScope, bootstrapOf, parseEnumeration, parseSiteBootstrap, refreshFrom, viewOf, } from './read.js';
4
+ import { streamedModels, viewModels } from './model.js';
5
+ import { bootstrapping, parseEnumeration, refreshFrom, viewOf, wholeView, } from './read.js';
6
+ import { roomStreams } from './room-stream.js';
5
7
  import { classifyDoor, classifyRead, discoveryFailure } from './refusal.js';
8
+ import { HOUSE_NAMEABLE_ROOM_TYPES, 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, SITE_FILE_RECORD, SITE_FILES, } from './transport.js';
8
- import { houseReferrer } from './referrer.js';
10
+ import { SITE_DOOR_BOOTSTRAP, SITE_DOOR_DISCOVER, SITE_DOOR_ENUMERATE, SITE_DOOR_SUBMIT, SITE_FILES, } from './transport.js';
9
11
  import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
10
12
  const UNCERTAIN = { kind: 'transport-uncertainty' };
13
+ function unfound() {
14
+ return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
15
+ }
11
16
  function siteRoom(tracked) {
12
17
  return {
13
18
  name: tracked.handle,
14
19
  locator: tracked.locator,
15
20
  handle: tracked.handle,
16
21
  roomVersion: roomVersion(tracked),
17
- operations: { read: [''], sync: [''], write: [], delete: [] },
18
- replica: { selection: tracked.locator, admission: 'admitted' },
22
+ operations: { write: [], delete: [] },
23
+ replica: { selection: tracked.locator, admission: 'admitted', offline: 'open' },
19
24
  providerOwnedPaths: [],
20
25
  };
21
26
  }
22
- function settled(refused) {
23
- return refused.kind === 'beyond-horizon' ? UNCERTAIN : refused;
24
- }
25
- export function createSiteAdapter(transport) {
27
+ export function createSiteAdapter(transport, snapshot = false) {
26
28
  const notifications = houseNotifications(transport, 'site');
27
29
  const tracked = new Map();
28
- function published(referrer) {
29
- const named = houseReferrer(referrer, tracked);
30
- return named === null || !tracked.has(named.locator) ? null : named;
30
+ const read = new Map();
31
+ const rooms = roomStreams('site');
32
+ function fileRoute(request) {
33
+ const entry = tracked.get(request.locator);
34
+ if (entry === undefined)
35
+ return { kind: 'room-not-readable', locator: request.locator };
36
+ return `${SITE_FILES}${entry.authority}/${encodeURIComponent(request.revision)}/${encodeURIComponent(request.path)}`;
31
37
  }
32
- async function enumeration(entry, from) {
38
+ async function enumerated(entry, from, page) {
33
39
  const answer = await transport.door(SITE_DOOR_ENUMERATE, {
34
- positions: [presented(entry.authority, from)],
40
+ positions: [
41
+ page === undefined
42
+ ? presented(entry.authority, from)
43
+ : {
44
+ ...presented(entry.authority, { position: page.after, logEpoch: from.logEpoch }),
45
+ page: { through: page.through, read: page.read },
46
+ },
47
+ ],
35
48
  });
36
49
  const classified = classifyRead(answer.status, answer.body, entry.locator);
37
50
  if (classified !== null)
38
51
  return classified;
39
- return parseEnumeration(answer.body, 'site') ?? UNCERTAIN;
52
+ const found = parseEnumeration(answer.body, 'site');
53
+ if (found === null)
54
+ return UNCERTAIN;
55
+ return viewOf(found, entry) ?? { kind: 'room-not-readable', locator: entry.locator };
40
56
  }
41
- async function caughtUp(entry) {
42
- const answer = await transport.read(`${SITE_DOOR_BOOTSTRAP}${entry.authority}`);
43
- const classified = classifyDoor(answer.status, answer.body, entry.locator);
44
- if (classified !== null)
45
- return { failure: classified };
46
- const scope = parseSiteBootstrap(answer.body);
47
- if (scope === null)
48
- return { failure: UNCERTAIN };
49
- if (roomVersion(scope) === roomVersion(entry))
50
- return { scope };
51
- const found = await enumeration(entry, scope);
52
- if ('kind' in found)
53
- return { failure: settled(found) };
54
- const view = viewOf(found, entry);
55
- if (view === undefined)
56
- return { failure: { kind: 'room-not-readable', locator: entry.locator } };
57
- return { scope: advancedScope(scope, view) };
57
+ async function enumeration(entry, from) {
58
+ const first = await enumerated(entry, from);
59
+ return 'kind' in first ? first : wholeView(first, (page) => enumerated(entry, from, page));
60
+ }
61
+ async function openedRoom(entry, arriving, signal) {
62
+ const cut = read.get(entry.locator);
63
+ const answered = await transport.streamed(`${SITE_DOOR_BOOTSTRAP}${entry.authority}${cut === undefined ? '' : `?expired=${cut}`}`, signal ?? new AbortController().signal);
64
+ if (answered.room === null)
65
+ return classifyDoor(answered.status, answered.body, entry.locator) ?? UNCERTAIN;
66
+ const head = await rooms.head(entry, answered.room, arriving, signal);
67
+ const at = head.kind === 'bootstrap' ? logPosition(head.roomVersion) : null;
68
+ if (at !== null)
69
+ read.set(entry.locator, at.position);
70
+ return head;
71
+ }
72
+ async function streamedPage(entry, token) {
73
+ const part = await rooms.part(entry, token);
74
+ if ('kind' in part)
75
+ return part;
76
+ notifications.reach(entry.authority, part.scope);
77
+ const { folders: _folders, ...page } = await stepped(bootstrapping(part.scope));
78
+ return {
79
+ ...page,
80
+ ...(part.models === undefined ? {} : { models: part.models }),
81
+ ...(part.pageToken === undefined ? {} : { pageToken: part.pageToken }),
82
+ bytes: part.bytes,
83
+ };
58
84
  }
59
85
  async function refreshed(entry, fromRoomVersion) {
60
86
  const from = logPosition(fromRoomVersion);
61
87
  if (from === null)
62
88
  return { kind: 'beyond-horizon' };
63
- const streamed = notifications.advance(entry, from);
89
+ const streamed = await stepped(notifications.advance(entry, from));
64
90
  if (streamed !== null) {
65
91
  const models = await streamedModels(streamed.schemas, entry, 'site');
66
92
  return models === undefined ? streamed.page : { ...streamed.page, models };
67
93
  }
68
- const found = await enumeration(entry, from);
69
- if ('kind' in found)
70
- return found;
71
- const view = viewOf(found, entry);
72
- if (view === undefined)
73
- return { kind: 'room-not-readable', locator: entry.locator };
94
+ const view = await enumeration(entry, from);
95
+ if ('kind' in view)
96
+ return view;
74
97
  notifications.reach(entry.authority, view);
75
- const answer = refreshFrom(view, fromRoomVersion);
98
+ const answer = await refreshFrom(view, fromRoomVersion);
76
99
  if (answer.kind !== 'net-advancement')
77
100
  return answer;
78
101
  const models = await viewModels(view, entry);
@@ -80,6 +103,9 @@ export function createSiteAdapter(transport) {
80
103
  }
81
104
  return {
82
105
  localSaves: true,
106
+ exhaustiveDiscovery: true,
107
+ roomTypes: HOUSE_ROOM_TYPES,
108
+ nameableRoomTypes: HOUSE_NAMEABLE_ROOM_TYPES,
83
109
  async authorize() {
84
110
  return {};
85
111
  },
@@ -102,14 +128,9 @@ export function createSiteAdapter(transport) {
102
128
  const entry = tracked.get(request.locator);
103
129
  if (entry === undefined)
104
130
  return { kind: 'room-not-readable', locator: request.locator };
105
- if (request.pageToken !== undefined)
106
- return UNCERTAIN;
107
- const held = await caughtUp(entry);
108
- if ('failure' in held)
109
- return held.failure;
110
- notifications.reach(entry.authority, held.scope);
111
- const models = await scopeModels(held.scope, entry);
112
- return { ...bootstrapOf(held.scope), ...(models === undefined ? {} : { models }) };
131
+ return request.pageToken === undefined
132
+ ? openedRoom(entry, request.arriving, request.signal)
133
+ : streamedPage(entry, request.pageToken);
113
134
  },
114
135
  async refresh(_authorization, request) {
115
136
  const entry = tracked.get(request.locator);
@@ -117,39 +138,42 @@ export function createSiteAdapter(transport) {
117
138
  return { kind: 'room-not-readable', locator: request.locator };
118
139
  if (request.pageToken !== undefined)
119
140
  return UNCERTAIN;
141
+ if (snapshot) {
142
+ return request.fromRoomVersion === roomVersion(entry)
143
+ ? { kind: 'still-current' }
144
+ : { kind: 'beyond-horizon' };
145
+ }
120
146
  return refreshed(entry, request.fromRoomVersion);
121
147
  },
122
148
  async mutate() {
123
149
  return { kind: 'rejected', affected: {}, code: 'write-grant', fields: {}, retryable: false };
124
150
  },
151
+ async attach() {
152
+ return { kind: 'rejected', code: 'write-grant', fields: {}, retryable: false };
153
+ },
125
154
  async history() {
126
155
  return { kind: 'no-history' };
127
156
  },
128
157
  async binary(_authorization, request) {
129
- const named = published(request.kind === 'path' ? { room: request.locator, path: request.path } : request.referrer);
130
- if (named === null) {
131
- return { kind: 'rejected', code: 'referrer_unknown', fields: {}, retryable: false };
132
- }
133
- if (request.fileRef === undefined) {
134
- return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
135
- }
136
- const { room_ref, path, record } = named.referrer;
137
- const read = await transport.download(`${SITE_FILES}${room_ref}/${encodeURIComponent(request.fileRef)}/${path === undefined
138
- ? `${SITE_FILE_RECORD}/${encodeURIComponent(record)}`
139
- : encodeURIComponent(path)}`);
140
- if (read.status === 404) {
141
- return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
142
- }
143
- return read.status === 200 && read.blob !== null
144
- ? { kind: 'binary', blob: read.blob }
158
+ const route = fileRoute(request);
159
+ if (typeof route !== 'string')
160
+ return route;
161
+ const read = await transport.download(route);
162
+ if (read.status === 404)
163
+ return unfound();
164
+ return read.status === 200 && read.body !== null
165
+ ? { kind: 'binary', body: read.body, mediaType: read.mediaType }
145
166
  : UNCERTAIN;
146
167
  },
147
- referrerScope(referrer) {
148
- const named = published(referrer);
149
- if (named === null)
150
- return null;
151
- const { path } = named.referrer;
152
- return { kind: 'room', locator: named.locator, ...(path === undefined ? {} : { path }) };
168
+ async link(_authorization, request) {
169
+ const route = fileRoute(request);
170
+ if (typeof route !== 'string')
171
+ return route;
172
+ return {
173
+ kind: 'link',
174
+ url: route,
175
+ name: request.path.slice(request.path.lastIndexOf('/') + 1),
176
+ };
153
177
  },
154
178
  reached(locator, version, target) {
155
179
  return reachedVersion(version, target, tracked.get(locator)?.logEpoch);
@@ -170,20 +194,27 @@ export function createSiteAdapter(transport) {
170
194
  return UNCERTAIN;
171
195
  return actionOutcome(await transport.door(SITE_DOOR_SUBMIT, request.input), SITE_SUBMIT);
172
196
  },
173
- roomStream: {
174
- hold(rooms) {
175
- notifications.send(rooms.flatMap((room) => {
176
- const entry = tracked.get(room.locator);
177
- const at = logPosition(room.roomVersion);
178
- if (entry === undefined || at === null)
179
- return [];
180
- notifications.reach(entry.authority, at);
181
- return [presented(entry.authority, at)];
182
- }));
197
+ roomStream: snapshot
198
+ ? undefined
199
+ : {
200
+ hold(rooms) {
201
+ notifications.send(rooms.flatMap((room) => {
202
+ const entry = tracked.get(room.locator);
203
+ const at = logPosition(room.roomVersion);
204
+ if (entry === undefined || at === null)
205
+ return [];
206
+ notifications.reach(entry.authority, at);
207
+ return [presented(entry.authority, at)];
208
+ }));
209
+ },
210
+ reopen: notifications.reopen,
211
+ observe: notifications.observe,
212
+ published(locator, roomVersion) {
213
+ const at = logPosition(roomVersion);
214
+ if (at !== null)
215
+ notifications.published(locator, at);
216
+ },
183
217
  },
184
- reopen: notifications.reopen,
185
- observe: notifications.observe,
186
- },
187
218
  serviceMode: notifications.serviceMode,
188
219
  };
189
220
  }
package/dist/stream.d.ts CHANGED
@@ -1,21 +1,22 @@
1
- import type { ConversationStream, RefreshPage, RoomStreamEvent, ServiceModeSignal } from '@agentshouse/mdruntime';
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
- advance(tracked: TrackedAuthority, from: LogPosition, holds?: HeldRevision): StreamedAdvancement | null;
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
  };
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,kBAAkB,EAElB,WAAW,EACX,eAAe,EAEf,iBAAiB,EAElB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EAEb,SAAS,EAET,gBAAgB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