@agentshouse/mdruntime-adapter 0.1.0-c658cd7165027 → 0.1.0-c65e490a04837

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 (86) hide show
  1. package/README.md +2 -2
  2. package/dist/actions.d.ts +4 -165
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +26 -231
  5. package/dist/adapter.d.ts +0 -1
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +157 -291
  8. package/dist/authored-path.d.ts +9 -0
  9. package/dist/authored-path.d.ts.map +1 -0
  10. package/dist/authored-path.js +34 -0
  11. package/dist/chunks.d.ts +36 -0
  12. package/dist/chunks.d.ts.map +1 -0
  13. package/dist/chunks.js +289 -0
  14. package/dist/digest.d.ts +0 -1
  15. package/dist/discovery.d.ts +19 -9
  16. package/dist/discovery.d.ts.map +1 -1
  17. package/dist/discovery.js +65 -32
  18. package/dist/history.d.ts +6 -0
  19. package/dist/history.d.ts.map +1 -0
  20. package/dist/history.js +85 -0
  21. package/dist/index.d.ts +7 -7
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +6 -5
  24. package/dist/map.d.ts +0 -1
  25. package/dist/model.d.ts +5 -9
  26. package/dist/model.d.ts.map +1 -1
  27. package/dist/model.js +28 -34
  28. package/dist/read.d.ts +19 -53
  29. package/dist/read.d.ts.map +1 -1
  30. package/dist/read.js +48 -316
  31. package/dist/refusal.d.ts +3 -5
  32. package/dist/refusal.d.ts.map +1 -1
  33. package/dist/refusal.js +17 -12
  34. package/dist/search.d.ts +4 -0
  35. package/dist/search.d.ts.map +1 -0
  36. package/dist/search.js +47 -0
  37. package/dist/session-content/bounds.d.ts +7 -0
  38. package/dist/session-content/check.d.ts +18 -0
  39. package/dist/session-content/index.d.ts +7 -0
  40. package/dist/session-content/parts.d.ts +103 -0
  41. package/dist/session-content/state.d.ts +61 -0
  42. package/dist/session-content/turn.d.ts +328 -0
  43. package/dist/site.d.ts +0 -1
  44. package/dist/site.d.ts.map +1 -1
  45. package/dist/site.js +78 -125
  46. package/dist/space-schema.d.ts +6 -0
  47. package/dist/space-schema.d.ts.map +1 -0
  48. package/dist/space-schema.js +11 -0
  49. package/dist/stream.d.ts +14 -12
  50. package/dist/stream.d.ts.map +1 -1
  51. package/dist/stream.js +235 -163
  52. package/dist/transport.d.ts +55 -32
  53. package/dist/transport.d.ts.map +1 -1
  54. package/dist/transport.js +54 -12
  55. package/dist/uncertain.d.ts +5 -0
  56. package/dist/uncertain.d.ts.map +1 -0
  57. package/dist/uncertain.js +11 -0
  58. package/dist/upload.d.ts +3 -2
  59. package/dist/upload.d.ts.map +1 -1
  60. package/dist/upload.js +10 -8
  61. package/dist/version.d.ts +0 -1
  62. package/dist/write.d.ts +2 -3
  63. package/dist/write.d.ts.map +1 -1
  64. package/dist/write.js +27 -42
  65. package/package.json +3 -2
  66. package/dist/app-reference.d.ts +0 -2
  67. package/dist/app-reference.d.ts.map +0 -1
  68. package/dist/app-reference.js +0 -2
  69. package/dist/crockford.d.ts +0 -4
  70. package/dist/crockford.d.ts.map +0 -1
  71. package/dist/crockford.js +0 -3
  72. package/dist/gather.d.ts +0 -3
  73. package/dist/gather.d.ts.map +0 -1
  74. package/dist/gather.js +0 -35
  75. package/dist/house-model.d.ts +0 -2938
  76. package/dist/house-model.d.ts.map +0 -1
  77. package/dist/house-model.js +0 -1614
  78. package/dist/part.d.ts +0 -14
  79. package/dist/part.d.ts.map +0 -1
  80. package/dist/part.js +0 -90
  81. package/dist/room-stream.d.ts +0 -19
  82. package/dist/room-stream.d.ts.map +0 -1
  83. package/dist/room-stream.js +0 -57
  84. package/dist/room-types.d.ts +0 -7
  85. package/dist/room-types.d.ts.map +0 -1
  86. package/dist/room-types.js +0 -126
@@ -0,0 +1,34 @@
1
+ import { APP_PREFERENCES_HOME, APP_REFERENCE_PATTERN } from '@agentshouse/mdmodel';
2
+ export const GENERATED_PROVENANCE = '_provenance';
3
+ export const GENERATED_REVISIONS = '_revisions';
4
+ export const RESERVED_DERIVED = '_derived';
5
+ export const WHOLE_ESCAPED_NAMES = [
6
+ '.',
7
+ '..',
8
+ GENERATED_PROVENANCE,
9
+ GENERATED_REVISIONS,
10
+ RESERVED_DERIVED,
11
+ ];
12
+ export const AUTHORED_SEGMENT_MAX_CHARS = 255;
13
+ const REFUSED_SEGMENTS = [
14
+ ...WHOLE_ESCAPED_NAMES.map((name) => name.split('.').join('[.]')),
15
+ '[.][Gg][Ii][Tt][.]*',
16
+ ].join('|');
17
+ export const AUTHORED_SEGMENT = new RegExp(`^(?!(?:${REFUSED_SEGMENTS})(?:/|$))[A-Za-z0-9._][A-Za-z0-9._-]{0,${AUTHORED_SEGMENT_MAX_CHARS - 1}}$`);
18
+ export const LOCAL_COPY_MANIFEST = '.house';
19
+ export const LOCAL_COPY_ROOT_NAMES = [
20
+ '.gitignore',
21
+ '.ignore',
22
+ LOCAL_COPY_MANIFEST,
23
+ ];
24
+ function appPreferences(path) {
25
+ return (path.endsWith('.md') &&
26
+ APP_REFERENCE_PATTERN.test(path.slice(APP_PREFERENCES_HOME.length + 1, -3)));
27
+ }
28
+ export function admittedPath(path) {
29
+ const names = path.split('/');
30
+ const [root] = names;
31
+ return (!LOCAL_COPY_ROOT_NAMES.includes(root.toLowerCase()) &&
32
+ names.every((name) => AUTHORED_SEGMENT.test(name)) &&
33
+ (!path.startsWith(`${APP_PREFERENCES_HOME}/`) || appPreferences(path)));
34
+ }
@@ -0,0 +1,36 @@
1
+ import { type AdapterFailure, type BootstrapPart, type BootstrapResult } from '@agentshouse/mdruntime';
2
+ import type { TrackedAuthority } from './discovery.js';
3
+ import { type HouseModels, type HouseScope } from './read.js';
4
+ import { type HouseDoor, type HouseMode } from './transport.js';
5
+ import { type LogPosition } from './version.js';
6
+ export type ChunkAddress = {
7
+ readonly url: string;
8
+ readonly bytes: number;
9
+ };
10
+ export type ChunkedRoom = LogPosition & {
11
+ readonly anchor: string;
12
+ readonly mode: HouseMode;
13
+ readonly chunks: ReadonlyMap<string, ChunkAddress>;
14
+ readonly parts: readonly BootstrapPart[];
15
+ readonly names: ReadonlyMap<string, string>;
16
+ readonly models: HouseModels;
17
+ };
18
+ export type Listed = ChunkedRoom | {
19
+ readonly kind: 'not-ready';
20
+ } | AdapterFailure;
21
+ type Answered = {
22
+ readonly status: number;
23
+ readonly body: unknown;
24
+ };
25
+ export declare function partId(logEpoch: string, hash: string): string;
26
+ export declare function siteChunkList(answer: Answered, locator: string): Listed;
27
+ export declare function chunkedHead(listed: ChunkedRoom, entry: TrackedAuthority): Promise<BootstrapResult>;
28
+ export declare function chunkPart(body: ReadableStream<Uint8Array> | null, room: ChunkedRoom, id: string, arriving: ((bytes: number) => void) | undefined): Promise<BootstrapResult>;
29
+ export declare function chunkLister(transport: HouseDoor, most: () => number, tracked: (locator: string) => TrackedAuthority | undefined): {
30
+ askAll: (entries: readonly TrackedAuthority[]) => void;
31
+ list: (entry: TrackedAuthority) => Promise<Listed>;
32
+ renew(entry: TrackedAuthority, installing: readonly TrackedAuthority[]): Promise<Listed>;
33
+ forget(): void;
34
+ };
35
+ export declare function chunkScope(body: ReadableStream<Uint8Array>, room: ChunkedRoom, arriving: ((bytes: number) => void) | undefined): Promise<HouseScope | null>;
36
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAInB,OAAO,EAAkB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAA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AAC,GAAG,SAAS,GAC9C,OAAO,CAAC,eAAe,CAAC,CAW1B;AAiBD,wBAAgB,WAAW,CACzB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,MAAM,MAAM,EAClB,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,gBAAgB,GAAG,SAAS;sBA0CjC,SAAS,gBAAgB,EAAE;kBA0B/B,gBAAgB,KAAG,OAAO,CAAC,MAAM,CAAC;iBAcxC,gBAAgB,cAAc,SAAS,gBAAgB,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;;EAY3F;AAuCD,wBAAsB,UAAU,CAC9B,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,EAChC,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,GAC9C,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAgC5B"}
package/dist/chunks.js ADDED
@@ -0,0 +1,289 @@
1
+ import { paced, ROW_WEIGHT, stepped, } from '@agentshouse/mdruntime';
2
+ import { manifestedModels } from './model.js';
3
+ import { authorityRoot, bootstrapping, parseFile, } from './read.js';
4
+ import { classifyDoor } from './refusal.js';
5
+ import { failedOn, unusable } from './uncertain.js';
6
+ import { spaceSchemas } from './space-schema.js';
7
+ import { houseDoorRoute } from './transport.js';
8
+ import { readPosition, roomVersion } from './version.js';
9
+ function authorKey(author) {
10
+ for (const kind of ['user', 'site', 'inbox']) {
11
+ if (typeof author[kind] === 'string')
12
+ return `${kind}:${author[kind]}`;
13
+ }
14
+ const { app, release, function: named } = author;
15
+ return typeof app === 'string' && typeof release === 'string' && typeof named === 'string'
16
+ ? `app:${app}:${release}:${named}`
17
+ : null;
18
+ }
19
+ function namesOf(authors) {
20
+ if (!Array.isArray(authors))
21
+ return null;
22
+ const names = new Map();
23
+ for (const author of authors) {
24
+ const key = typeof author === 'object' && author !== null ? authorKey(author) : null;
25
+ if (key === null || typeof author.name !== 'string')
26
+ return null;
27
+ names.set(key, author.name);
28
+ }
29
+ return names;
30
+ }
31
+ function schemaText(entry, file, texts) {
32
+ const { space, revision } = file;
33
+ if (typeof entry.content === 'string') {
34
+ if (space !== undefined && revision !== undefined)
35
+ texts.keep(space, revision, entry.content);
36
+ return entry.content;
37
+ }
38
+ return space === undefined || revision === undefined ? undefined : texts.held(space, revision);
39
+ }
40
+ function modelsOf(models, mode, texts) {
41
+ if (!Array.isArray(models))
42
+ return null;
43
+ const files = [];
44
+ const contents = [];
45
+ for (const entry of models) {
46
+ const file = parseFile(entry, mode);
47
+ const content = file === null ? undefined : schemaText(entry, file, texts);
48
+ if (file === null || content === undefined)
49
+ return null;
50
+ files.push(file);
51
+ contents.push({ path: file.path, content });
52
+ }
53
+ return { files, contents };
54
+ }
55
+ export function partId(logEpoch, hash) {
56
+ return `${logEpoch}:${hash}`;
57
+ }
58
+ function chunkedRoom(room, mode, texts) {
59
+ const at = readPosition(room);
60
+ const names = mode === 'site' ? new Map() : namesOf(room.authors);
61
+ const models = modelsOf(room.models, mode, texts);
62
+ if (at === null || names === null || models === null || !Array.isArray(room.chunks))
63
+ return null;
64
+ const chunks = new Map();
65
+ const parts = [];
66
+ for (const chunk of room.chunks) {
67
+ const { hash, bytes, download } = chunk;
68
+ if (typeof hash !== 'string' || typeof bytes !== 'number' || typeof download !== 'string')
69
+ return null;
70
+ const id = partId(at.logEpoch, hash);
71
+ chunks.set(id, { url: download, bytes });
72
+ parts.push({ id, bytes });
73
+ }
74
+ return { anchor: room.room_ref, ...at, mode, chunks, parts, names, models };
75
+ }
76
+ function listedRoom(room, mode, texts) {
77
+ if (typeof room !== 'object' || room === null)
78
+ return null;
79
+ const held = room;
80
+ if (typeof held.room_ref !== 'string')
81
+ return null;
82
+ if (held.ready === false)
83
+ return { kind: 'not-ready' };
84
+ return held.ready === true ? chunkedRoom(held, mode, texts) : null;
85
+ }
86
+ export function siteChunkList(answer, locator) {
87
+ const failure = classifyDoor(answer.status, answer.body, locator);
88
+ if (failure !== null)
89
+ return failure;
90
+ return listedRoom(answer.body, 'site', spaceSchemas()) ?? unusable();
91
+ }
92
+ export async function chunkedHead(listed, entry) {
93
+ if (listed.anchor !== entry.authority)
94
+ return unusable();
95
+ const models = await manifestedModels({
96
+ anchor: listed.anchor,
97
+ position: listed.position,
98
+ logEpoch: listed.logEpoch,
99
+ models: listed.models,
100
+ }, entry);
101
+ return {
102
+ kind: 'bootstrap',
103
+ roomVersion: roomVersion(listed),
104
+ documents: {},
105
+ facts: {},
106
+ revisions: {},
107
+ changes: {},
108
+ binaryFiles: {},
109
+ parts: listed.parts,
110
+ ...(models === undefined ? {} : { models }),
111
+ };
112
+ }
113
+ export async function chunkPart(body, room, id, arriving) {
114
+ const address = room.chunks.get(id);
115
+ if (body === null || address === undefined)
116
+ return unusable();
117
+ let scope;
118
+ try {
119
+ scope = await chunkScope(body, room, arriving);
120
+ }
121
+ catch (error) {
122
+ return failedOn(error);
123
+ }
124
+ if (scope === null)
125
+ return unusable();
126
+ return { ...(await stepped(bootstrapping(scope))), bytes: address.bytes };
127
+ }
128
+ function listedRooms(answer) {
129
+ const rooms = answer.body?.rooms;
130
+ if (!Array.isArray(rooms))
131
+ return null;
132
+ const listed = new Map();
133
+ const texts = spaceSchemas();
134
+ for (const room of rooms) {
135
+ const held = listedRoom(room, 'credential', texts);
136
+ if (held === null)
137
+ return null;
138
+ listed.set(room.room_ref, held);
139
+ }
140
+ return listed;
141
+ }
142
+ export function chunkLister(transport, most, tracked) {
143
+ const asked = new Map();
144
+ const unlisted = new Set();
145
+ function answered(entries, whole) {
146
+ const prefixes = whole ? ['/'] : entries.map((entry) => authorityRoot(entry.handle));
147
+ return transport.door(houseDoorRoute('room-chunks/list'), { prefixes }).then((answer) => {
148
+ const failure = classifyDoor(answer.status, answer.body, '');
149
+ if (failure !== null)
150
+ return failed(entries, failure);
151
+ const listed = listedRooms(answer);
152
+ return listed ?? failed(entries, unusable());
153
+ }, (error) => failed(entries, failedOn(error)));
154
+ }
155
+ function failed(entries, failure) {
156
+ return new Map(entries.map((entry) => [
157
+ entry.authority,
158
+ failure.kind === 'room-not-readable' || failure.kind === 'scoped-refusal'
159
+ ? { ...failure, locator: entry.locator }
160
+ : failure,
161
+ ]));
162
+ }
163
+ function settled(entry, lists) {
164
+ return lists.then((listed) => listed.get(entry.authority) ?? { kind: 'room-not-readable', locator: entry.locator });
165
+ }
166
+ function askAll(entries) {
167
+ if (entries.length === 0)
168
+ return;
169
+ const lists = answered(entries, entries.length > most());
170
+ for (const entry of entries) {
171
+ const listed = settled(entry, lists);
172
+ listed.catch(() => { });
173
+ asked.set(entry.authority, { entry, listed });
174
+ }
175
+ }
176
+ function current(entry) {
177
+ return asked.get(entry.authority)?.entry.handle === entry.handle;
178
+ }
179
+ function askTogether(entries) {
180
+ askAll([...new Map(entries.map((one) => [one.authority, one])).values()]);
181
+ }
182
+ function waiting() {
183
+ return [...unlisted].flatMap((locator) => {
184
+ const entry = tracked(locator);
185
+ if (entry === undefined)
186
+ unlisted.delete(locator);
187
+ return entry ?? [];
188
+ });
189
+ }
190
+ function list(entry) {
191
+ if (!current(entry))
192
+ askTogether([...waiting().filter((one) => !current(one)), entry]);
193
+ const { listed } = asked.get(entry.authority);
194
+ asked.delete(entry.authority);
195
+ return listed.then((answer) => {
196
+ if ('kind' in answer)
197
+ unlisted.add(entry.locator);
198
+ else
199
+ unlisted.delete(entry.locator);
200
+ return answer;
201
+ });
202
+ }
203
+ return {
204
+ askAll,
205
+ list,
206
+ renew(entry, installing) {
207
+ if (!current(entry)) {
208
+ const listed = [...asked.values()].flatMap((held) => tracked(held.entry.locator) ?? []);
209
+ askTogether([...listed, ...waiting(), ...installing, entry]);
210
+ }
211
+ return list(entry);
212
+ },
213
+ forget() {
214
+ asked.clear();
215
+ unlisted.clear();
216
+ },
217
+ };
218
+ }
219
+ function folderLine(entry) {
220
+ return typeof entry.folder === 'string' && Object.keys(entry).length === 1 ? entry.folder : null;
221
+ }
222
+ function chunkEntry(line, room, read) {
223
+ let entry;
224
+ try {
225
+ entry = JSON.parse(line);
226
+ }
227
+ catch {
228
+ return false;
229
+ }
230
+ if (typeof entry !== 'object' || entry === null)
231
+ return false;
232
+ const folder = folderLine(entry);
233
+ if (folder !== null) {
234
+ read.folders.push(folder);
235
+ return true;
236
+ }
237
+ const author = entry.author;
238
+ let named = entry;
239
+ if (author !== undefined) {
240
+ const key = typeof author === 'object' && author !== null ? authorKey(author) : null;
241
+ const name = key === null ? undefined : room.names.get(key);
242
+ if (name === undefined)
243
+ return false;
244
+ named = { ...entry, author: { ...author, name } };
245
+ }
246
+ const file = parseFile(named, room.mode);
247
+ if (file === null)
248
+ return false;
249
+ read.files.push(file);
250
+ if (typeof entry.content === 'string')
251
+ read.contents.push({ path: file.path, content: entry.content });
252
+ return true;
253
+ }
254
+ export async function chunkScope(body, room, arriving) {
255
+ const read = {
256
+ files: [],
257
+ contents: [],
258
+ folders: [],
259
+ };
260
+ const reader = body.getReader();
261
+ const decoder = new TextDecoder();
262
+ const pace = paced();
263
+ const unfinished = [];
264
+ let bytes = 0;
265
+ for (let chunk = await reader.read(); chunk.done !== true; chunk = await reader.read()) {
266
+ bytes += chunk.value.length;
267
+ arriving?.(bytes);
268
+ const text = decoder.decode(chunk.value, { stream: true });
269
+ let start = 0;
270
+ for (let end = text.indexOf('\n'); end !== -1; end = text.indexOf('\n', start)) {
271
+ const piece = text.slice(start, end);
272
+ const line = unfinished.length === 0 ? piece : unfinished.splice(0).join('') + piece;
273
+ start = end + 1;
274
+ if (line.length > 0 && !chunkEntry(line, room, read)) {
275
+ await reader.cancel();
276
+ return null;
277
+ }
278
+ const due = pace(line.length + ROW_WEIGHT);
279
+ if (due instanceof Promise)
280
+ await due;
281
+ }
282
+ if (start < text.length)
283
+ unfinished.push(text.slice(start));
284
+ }
285
+ const rest = unfinished.join('') + decoder.decode();
286
+ if (rest.length > 0 && !chunkEntry(rest, room, read))
287
+ return null;
288
+ return { anchor: room.anchor, position: room.position, logEpoch: room.logEpoch, ...read };
289
+ }
package/dist/digest.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export declare function textBytes(value: string): number;
2
2
  export declare function sha256Hex(value: string): Promise<string>;
3
- //# sourceMappingURL=digest.d.ts.map
@@ -1,26 +1,21 @@
1
1
  import type { Capability, DiscoveredRoom, Discovery, Member, ProviderLimit, Retention } from '@agentshouse/mdruntime';
2
2
  import { type LogPosition } from './version.js';
3
3
  export declare const PROVIDER_ACTIONS = "provider-actions";
4
- export declare const DISCOVER_PREFIXES: readonly string[];
5
4
  export type HouseBounds = {
6
5
  max_authored_file_bytes: number;
7
6
  max_batch_operations: number;
8
7
  max_batch_documents: number;
9
8
  max_path_length: number;
10
9
  max_path_depth: number;
11
- max_mount_files: number;
12
- max_mount_bytes: number;
13
10
  max_inline_body_bytes: number;
14
11
  max_upload_bytes: number;
15
12
  max_prefixes: number;
16
- max_held_files: number;
17
13
  change_retention_seconds: number;
18
- operation_retention_seconds: number;
19
14
  max_move_documents?: number;
20
15
  };
21
16
  export type HouseOperations = {
22
17
  write: readonly string[];
23
- delete: readonly string[];
18
+ erase: readonly string[];
24
19
  };
25
20
  export type HouseAccessLevel = 'search' | 'open' | 'keep';
26
21
  export type HouseAuthority = LogPosition & {
@@ -31,6 +26,7 @@ export type HouseAuthority = LogPosition & {
31
26
  typedSelection: readonly string[] | null;
32
27
  managedReplication: 'admitted' | 'unavailable';
33
28
  protectedPaths: readonly string[];
29
+ writtenHomes: readonly string[];
34
30
  level: HouseAccessLevel;
35
31
  operations: HouseOperations;
36
32
  };
@@ -40,6 +36,11 @@ export type HouseDiscoveryDocument = {
40
36
  authorities: readonly HouseAuthority[];
41
37
  actions: readonly string[];
42
38
  };
39
+ export type HouseAuthorityChange = {
40
+ member: Member;
41
+ authorities: readonly HouseAuthority[];
42
+ left: readonly string[];
43
+ };
43
44
  export type TrackedAuthority = LogPosition & {
44
45
  locator: string;
45
46
  authority: string;
@@ -56,14 +57,23 @@ export type HouseSiteDiscovery = {
56
57
  bounds: HouseBounds;
57
58
  authorities: readonly HouseSiteAuthority[];
58
59
  };
60
+ type RoomOwn = 'room_ref' | 'room_handle' | 'name' | 'position';
61
+ type Folded<A extends Record<RoomOwn, unknown>> = {
62
+ readonly shapes: readonly Omit<A, RoomOwn>[];
63
+ readonly rooms: readonly (Pick<A, RoomOwn> & {
64
+ readonly shape: number;
65
+ })[];
66
+ };
67
+ export declare function foldedAuthorities<A extends Record<RoomOwn, unknown>>(authorities: readonly A[]): Folded<A>;
59
68
  export declare function parseDiscovery(body: unknown): HouseDiscoveryDocument | null;
69
+ export declare function parseAuthorityChange(body: unknown): HouseAuthorityChange | null;
60
70
  export declare function parseSiteDiscovery(body: unknown): HouseSiteDiscovery | null;
61
71
  export declare function siteTracked(document: HouseSiteDiscovery): TrackedAuthority[];
62
- export declare function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[];
72
+ export declare function trackedFrom(document: Pick<HouseDiscoveryDocument, 'authorities'>): TrackedAuthority[];
63
73
  export declare function providerLimits(bounds: HouseBounds): readonly ProviderLimit[];
64
74
  export declare function declaredRetention(bounds: HouseBounds): Retention;
65
- export declare function capabilities(actions: HouseDiscoveryDocument['actions'], rooms: readonly Pick<TrackedAuthority, 'authority' | 'handle'>[]): readonly Capability[];
75
+ export declare function capabilities(actions: HouseDiscoveryDocument['actions']): readonly Capability[];
66
76
  export declare function siteCapabilities(): readonly Capability[];
67
77
  export declare function discoveredRoom(authority: HouseAuthority): DiscoveredRoom;
68
78
  export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
69
- //# sourceMappingURL=discovery.d.ts.map
79
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,MAAM,EACN,aAAa,EACb,SAAS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GAAG,SAAS,UAAU,EAAE,CAE9F;AAED,wBAAgB,gBAAgB,IAAI,SAAS,UAAU,EAAE,CAOxD;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAqBxE;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC,EAChD,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAC9B,SAAS,CAQX"}
package/dist/discovery.js CHANGED
@@ -1,24 +1,19 @@
1
- import { declaredActions, houseConversationAgents, SITE_SUBMIT } from './actions.js';
1
+ import { declaredActions } from './actions.js';
2
+ import { SITES_SUBMISSIONS_CREATE } from './transport.js';
2
3
  import { readPosition, roomVersion } from './version.js';
3
4
  export const PROVIDER_ACTIONS = 'provider-actions';
4
- export const DISCOVER_PREFIXES = ['/'];
5
- const PRIVATE_HANDLE = 'private';
6
5
  const BOUND_KEYS = [
7
6
  'max_authored_file_bytes',
8
7
  'max_batch_operations',
9
8
  'max_batch_documents',
10
9
  'max_path_length',
11
10
  'max_path_depth',
12
- 'max_mount_files',
13
- 'max_mount_bytes',
14
11
  'max_inline_body_bytes',
15
12
  'max_upload_bytes',
16
13
  'max_prefixes',
17
- 'max_held_files',
18
14
  'change_retention_seconds',
19
- 'operation_retention_seconds',
20
15
  ];
21
- const OPERATION_KEYS = ['write', 'delete'];
16
+ const OPERATION_KEYS = ['write', 'erase'];
22
17
  const ACCESS_LEVELS = ['search', 'open', 'keep'];
23
18
  function stringList(value) {
24
19
  if (!Array.isArray(value))
@@ -86,11 +81,13 @@ function parseAuthority(value) {
86
81
  const at = readPosition(held);
87
82
  const typedSelection = parseTypedSelection(held.typed_selection);
88
83
  const protectedPaths = stringList(held.protected_paths);
84
+ const writtenHomes = stringList(held.written_homes);
89
85
  const operations = parseOperations(held.operations);
90
86
  const level = ACCESS_LEVELS.find((one) => one === held.level);
91
87
  if (at === null ||
92
88
  typedSelection === undefined ||
93
89
  protectedPaths === null ||
90
+ writtenHomes === null ||
94
91
  level === undefined ||
95
92
  operations === null)
96
93
  return null;
@@ -106,11 +103,53 @@ function parseAuthority(value) {
106
103
  typedSelection,
107
104
  managedReplication: held.managed_replication,
108
105
  protectedPaths,
106
+ writtenHomes,
109
107
  level,
110
108
  operations,
111
109
  ...at,
112
110
  };
113
111
  }
112
+ function parseAuthorities(value) {
113
+ if (!Array.isArray(value))
114
+ return null;
115
+ const authorities = [];
116
+ for (const entry of value) {
117
+ const authority = parseAuthority(entry);
118
+ if (authority === null)
119
+ return null;
120
+ authorities.push(authority);
121
+ }
122
+ return authorities;
123
+ }
124
+ export function foldedAuthorities(authorities) {
125
+ const shapes = [];
126
+ const known = new Map();
127
+ const rooms = authorities.map(({ room_ref, room_handle, name, position, ...shape }) => {
128
+ const key = JSON.stringify(shape);
129
+ let held = known.get(key);
130
+ if (held === undefined) {
131
+ held = shapes.push(shape) - 1;
132
+ known.set(key, held);
133
+ }
134
+ return { room_ref, room_handle, name, position, shape: held };
135
+ });
136
+ return { shapes, rooms };
137
+ }
138
+ function unfolded(shapes, rooms) {
139
+ if (!Array.isArray(shapes) || !Array.isArray(rooms))
140
+ return null;
141
+ const authorities = [];
142
+ for (const room of rooms) {
143
+ if (typeof room !== 'object' || room === null)
144
+ return null;
145
+ const { shape, ...own } = room;
146
+ const held = typeof shape === 'number' ? shapes[shape] : undefined;
147
+ if (typeof held !== 'object' || held === null)
148
+ return null;
149
+ authorities.push({ ...held, ...own });
150
+ }
151
+ return authorities;
152
+ }
114
153
  export function parseDiscovery(body) {
115
154
  if (typeof body !== 'object' || body === null)
116
155
  return null;
@@ -126,16 +165,19 @@ export function parseDiscovery(body) {
126
165
  new Set(actions).size !== actions.length ||
127
166
  actions.some((name) => name.length === 0))
128
167
  return null;
129
- if (!Array.isArray(held.authorities))
168
+ const authorities = parseAuthorities(unfolded(held.shapes, held.rooms));
169
+ return authorities === null ? null : { member, bounds, authorities, actions };
170
+ }
171
+ export function parseAuthorityChange(body) {
172
+ if (typeof body !== 'object' || body === null)
130
173
  return null;
131
- const authorities = [];
132
- for (const entry of held.authorities) {
133
- const authority = parseAuthority(entry);
134
- if (authority === null)
135
- return null;
136
- authorities.push(authority);
137
- }
138
- return { member, bounds, authorities, actions };
174
+ const held = body;
175
+ const member = parseMember(held.member);
176
+ const authorities = parseAuthorities(held.authorities);
177
+ const left = stringList(held.left);
178
+ if (member === null || authorities === null || left === null)
179
+ return null;
180
+ return { member, authorities, left };
139
181
  }
140
182
  function parseSiteAuthority(value) {
141
183
  if (typeof value !== 'object' || value === null)
@@ -216,25 +258,17 @@ export function providerLimits(bounds) {
216
258
  export function declaredRetention(bounds) {
217
259
  return {
218
260
  history: { kind: 'no-declared-time-bound' },
219
- outcome: bounds.operation_retention_seconds,
220
261
  refreshHorizon: bounds.change_retention_seconds,
221
262
  };
222
263
  }
223
- export function capabilities(actions, rooms) {
224
- const own = rooms.find((room) => room.handle === PRIVATE_HANDLE);
225
- return [
226
- {
227
- name: PROVIDER_ACTIONS,
228
- actions: declaredActions(actions),
229
- ...(own === undefined ? {} : { conversationAgents: houseConversationAgents(own.authority) }),
230
- },
231
- ];
264
+ export function capabilities(actions) {
265
+ return [{ name: PROVIDER_ACTIONS, actions: declaredActions(actions) }];
232
266
  }
233
267
  export function siteCapabilities() {
234
268
  return [
235
269
  {
236
270
  name: PROVIDER_ACTIONS,
237
- actions: [{ name: SITE_SUBMIT, inputShape: {}, resultKind: 'house' }],
271
+ actions: [{ name: SITES_SUBMISSIONS_CREATE, inputShape: {}, resultKind: 'house' }],
238
272
  },
239
273
  ];
240
274
  }
@@ -247,17 +281,16 @@ export function discoveredRoom(authority) {
247
281
  roomVersion: roomVersion(authority),
248
282
  operations: {
249
283
  write: [...authority.operations.write],
250
- delete: [...authority.operations.delete],
284
+ erase: [...authority.operations.erase],
251
285
  },
252
286
  replica: {
253
287
  selection: locator,
254
288
  admission: authority.managedReplication,
255
289
  offline: authority.level === 'open' ? 'locked' : 'open',
256
290
  },
257
- ...(authority.typedSelection === null
258
- ? {}
259
- : { typedSelection: { roots: [...authority.typedSelection] } }),
291
+ typedSelection: authority.typedSelection === null ? null : { roots: [...authority.typedSelection] },
260
292
  providerOwnedPaths: [...authority.protectedPaths, authority.schema],
293
+ authoredPaths: [...authority.writtenHomes],
261
294
  };
262
295
  }
263
296
  export function mapDiscovery(document, rooms, declared) {
@@ -0,0 +1,6 @@
1
+ import type { AcceptedMessage, ActionResult, ConversationHistoryRequest } from '@agentshouse/mdruntime';
2
+ import { type HouseDoor } from './transport.js';
3
+ export declare const HISTORY_PAGE = 100;
4
+ export declare function changeCursor(change: number): string;
5
+ export declare function acceptedMessage(entry: unknown): AcceptedMessage | null;
6
+ export declare function houseHistory(transport: HouseDoor, request: ConversationHistoryRequest): Promise<ActionResult>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EAGZ,0BAA0B,EAC3B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhE,eAAO,MAAM,YAAY,MAAM,CAAC;AAqBhC,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAatE;AA6BD,wBAAsB,YAAY,CAChC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,YAAY,CAAC,CAqBvB"}