@agentshouse/mdruntime-adapter 0.1.0-cb0bbc4ccacd0 → 0.1.0-cb2e7eccd0ac9

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 (83) hide show
  1. package/README.md +2 -2
  2. package/dist/actions.d.ts +2 -1
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +20 -7
  5. package/dist/adapter.d.ts +0 -1
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +113 -113
  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 +37 -0
  12. package/dist/chunks.d.ts.map +1 -0
  13. package/dist/chunks.js +269 -0
  14. package/dist/digest.d.ts +0 -1
  15. package/dist/discovery.d.ts +1 -4
  16. package/dist/discovery.d.ts.map +1 -1
  17. package/dist/discovery.js +7 -8
  18. package/dist/history.d.ts +1 -7
  19. package/dist/history.d.ts.map +1 -1
  20. package/dist/history.js +22 -29
  21. package/dist/index.d.ts +3 -6
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +2 -4
  24. package/dist/map.d.ts +0 -1
  25. package/dist/model.d.ts +3 -8
  26. package/dist/model.d.ts.map +1 -1
  27. package/dist/model.js +3 -13
  28. package/dist/read.d.ts +9 -10
  29. package/dist/read.d.ts.map +1 -1
  30. package/dist/read.js +26 -145
  31. package/dist/refusal.d.ts +3 -2
  32. package/dist/refusal.d.ts.map +1 -1
  33. package/dist/refusal.js +17 -7
  34. package/dist/search.d.ts +0 -1
  35. package/dist/search.d.ts.map +1 -1
  36. package/dist/search.js +5 -5
  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 +42 -50
  46. package/dist/space-schema.d.ts +1 -2
  47. package/dist/space-schema.d.ts.map +1 -1
  48. package/dist/space-schema.js +2 -2
  49. package/dist/stream.d.ts +4 -4
  50. package/dist/stream.d.ts.map +1 -1
  51. package/dist/stream.js +119 -49
  52. package/dist/transport.d.ts +25 -24
  53. package/dist/transport.d.ts.map +1 -1
  54. package/dist/transport.js +13 -13
  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 +8 -6
  61. package/dist/version.d.ts +0 -1
  62. package/dist/write.d.ts +0 -2
  63. package/dist/write.d.ts.map +1 -1
  64. package/dist/write.js +19 -19
  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/house-model.d.ts +0 -641
  73. package/dist/house-model.d.ts.map +0 -1
  74. package/dist/house-model.js +0 -361
  75. package/dist/part.d.ts +0 -14
  76. package/dist/part.d.ts.map +0 -1
  77. package/dist/part.js +0 -90
  78. package/dist/room-stream.d.ts +0 -20
  79. package/dist/room-stream.d.ts.map +0 -1
  80. package/dist/room-stream.js +0 -57
  81. package/dist/room-types.d.ts +0 -7
  82. package/dist/room-types.d.ts.map +0 -1
  83. package/dist/room-types.js +0 -123
package/dist/chunks.js ADDED
@@ -0,0 +1,269 @@
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 answerTexts() {
41
+ return spaceSchemas(Number.POSITIVE_INFINITY);
42
+ }
43
+ function modelsOf(models, mode, texts) {
44
+ if (!Array.isArray(models))
45
+ return null;
46
+ const files = [];
47
+ const contents = [];
48
+ for (const entry of models) {
49
+ const file = parseFile(entry, mode);
50
+ const content = file === null ? undefined : schemaText(entry, file, texts);
51
+ if (file === null || content === undefined)
52
+ return null;
53
+ files.push(file);
54
+ contents.push({ path: file.path, content });
55
+ }
56
+ return { files, contents };
57
+ }
58
+ export function partId(logEpoch, hash) {
59
+ return `${logEpoch}:${hash}`;
60
+ }
61
+ function chunkedRoom(room, mode, texts) {
62
+ const at = readPosition(room);
63
+ const names = mode === 'site' ? new Map() : namesOf(room.authors);
64
+ const models = modelsOf(room.models, mode, texts);
65
+ if (at === null || names === null || models === null || !Array.isArray(room.chunks))
66
+ return null;
67
+ const chunks = new Map();
68
+ const parts = [];
69
+ for (const chunk of room.chunks) {
70
+ const { hash, bytes, download } = chunk;
71
+ if (typeof hash !== 'string' || typeof bytes !== 'number' || typeof download !== 'string')
72
+ return null;
73
+ const id = partId(at.logEpoch, hash);
74
+ chunks.set(id, { url: download, bytes });
75
+ parts.push({ id, bytes });
76
+ }
77
+ return { anchor: room.room_ref, ...at, mode, chunks, parts, names, models };
78
+ }
79
+ function listedRoom(room, mode, texts) {
80
+ if (typeof room !== 'object' || room === null)
81
+ return null;
82
+ const held = room;
83
+ if (typeof held.room_ref !== 'string')
84
+ return null;
85
+ if (held.ready === false)
86
+ return { kind: 'not-ready' };
87
+ return held.ready === true ? chunkedRoom(held, mode, texts) : null;
88
+ }
89
+ export function siteChunkList(answer, locator) {
90
+ const failure = classifyDoor(answer.status, answer.body, locator);
91
+ if (failure !== null)
92
+ return failure;
93
+ return listedRoom(answer.body, 'site', answerTexts()) ?? unusable();
94
+ }
95
+ export async function chunkedHead(listed, entry, spaces) {
96
+ if (listed.anchor !== entry.authority)
97
+ return unusable();
98
+ const models = await manifestedModels({
99
+ anchor: listed.anchor,
100
+ position: listed.position,
101
+ logEpoch: listed.logEpoch,
102
+ models: listed.models,
103
+ }, entry, spaces);
104
+ return {
105
+ kind: 'bootstrap',
106
+ roomVersion: roomVersion(listed),
107
+ documents: {},
108
+ facts: {},
109
+ revisions: {},
110
+ changes: {},
111
+ binaryFiles: {},
112
+ parts: listed.parts,
113
+ ...(models === undefined ? {} : { models }),
114
+ };
115
+ }
116
+ export async function chunkPart(body, room, id, arriving) {
117
+ const address = room.chunks.get(id);
118
+ if (body === null || address === undefined)
119
+ return unusable();
120
+ let scope;
121
+ try {
122
+ scope = await chunkScope(body, room, arriving);
123
+ }
124
+ catch (error) {
125
+ return failedOn(error);
126
+ }
127
+ if (scope === null)
128
+ return unusable();
129
+ return { ...(await stepped(bootstrapping(scope))), bytes: address.bytes };
130
+ }
131
+ function listedRooms(answer) {
132
+ const rooms = answer.body?.rooms;
133
+ if (!Array.isArray(rooms))
134
+ return null;
135
+ const listed = new Map();
136
+ const texts = answerTexts();
137
+ for (const room of rooms) {
138
+ const held = listedRoom(room, 'credential', texts);
139
+ if (held === null)
140
+ return null;
141
+ listed.set(room.room_ref, held);
142
+ }
143
+ return listed;
144
+ }
145
+ export function chunkLister(transport, most) {
146
+ const asked = new Map();
147
+ function answered(entries, whole) {
148
+ const prefixes = whole ? ['/'] : entries.map((entry) => authorityRoot(entry.handle));
149
+ return transport.door(houseDoorRoute('room-chunks/list'), { prefixes }).then((answer) => {
150
+ const failure = classifyDoor(answer.status, answer.body, '');
151
+ if (failure !== null)
152
+ return failed(entries, failure);
153
+ const listed = listedRooms(answer);
154
+ return listed ?? failed(entries, unusable());
155
+ }, (error) => failed(entries, failedOn(error)));
156
+ }
157
+ function failed(entries, failure) {
158
+ return new Map(entries.map((entry) => [
159
+ entry.authority,
160
+ failure.kind === 'room-not-readable' || failure.kind === 'scoped-refusal'
161
+ ? { ...failure, locator: entry.locator }
162
+ : failure,
163
+ ]));
164
+ }
165
+ function settled(entry, lists) {
166
+ return lists.then((listed) => listed.get(entry.authority) ?? { kind: 'room-not-readable', locator: entry.locator });
167
+ }
168
+ function askAll(entries) {
169
+ if (entries.length === 0)
170
+ return;
171
+ const lists = answered(entries, entries.length > most());
172
+ for (const entry of entries) {
173
+ const listed = settled(entry, lists);
174
+ listed.catch(() => { });
175
+ asked.set(entry.authority, { entry, listed });
176
+ }
177
+ }
178
+ function list(entry) {
179
+ const held = asked.get(entry.authority);
180
+ asked.delete(entry.authority);
181
+ return held?.listed ?? settled(entry, answered([entry], false));
182
+ }
183
+ return {
184
+ askAll,
185
+ list,
186
+ renew(entry, installing) {
187
+ if (!asked.has(entry.authority)) {
188
+ const waiting = [...asked.values()].map((held) => held.entry);
189
+ const due = new Map([entry, ...installing, ...waiting].map((held) => [held.authority, held]));
190
+ askAll([...due.values()]);
191
+ }
192
+ return list(entry);
193
+ },
194
+ forget() {
195
+ asked.clear();
196
+ },
197
+ };
198
+ }
199
+ function folderLine(entry) {
200
+ return typeof entry.folder === 'string' && Object.keys(entry).length === 1 ? entry.folder : null;
201
+ }
202
+ function chunkEntry(line, room, read) {
203
+ let entry;
204
+ try {
205
+ entry = JSON.parse(line);
206
+ }
207
+ catch {
208
+ return false;
209
+ }
210
+ if (typeof entry !== 'object' || entry === null)
211
+ return false;
212
+ const folder = folderLine(entry);
213
+ if (folder !== null) {
214
+ read.folders.push(folder);
215
+ return true;
216
+ }
217
+ const author = entry.author;
218
+ let named = entry;
219
+ if (author !== undefined) {
220
+ const key = typeof author === 'object' && author !== null ? authorKey(author) : null;
221
+ const name = key === null ? undefined : room.names.get(key);
222
+ if (name === undefined)
223
+ return false;
224
+ named = { ...entry, author: { ...author, name } };
225
+ }
226
+ const file = parseFile(named, room.mode);
227
+ if (file === null)
228
+ return false;
229
+ read.files.push(file);
230
+ if (typeof entry.content === 'string')
231
+ read.contents.push({ path: file.path, content: entry.content });
232
+ return true;
233
+ }
234
+ export async function chunkScope(body, room, arriving) {
235
+ const read = {
236
+ files: [],
237
+ contents: [],
238
+ folders: [],
239
+ };
240
+ const reader = body.getReader();
241
+ const decoder = new TextDecoder();
242
+ const pace = paced();
243
+ const unfinished = [];
244
+ let bytes = 0;
245
+ for (let chunk = await reader.read(); chunk.done !== true; chunk = await reader.read()) {
246
+ bytes += chunk.value.length;
247
+ arriving?.(bytes);
248
+ const text = decoder.decode(chunk.value, { stream: true });
249
+ let start = 0;
250
+ for (let end = text.indexOf('\n'); end !== -1; end = text.indexOf('\n', start)) {
251
+ const piece = text.slice(start, end);
252
+ const line = unfinished.length === 0 ? piece : unfinished.splice(0).join('') + piece;
253
+ start = end + 1;
254
+ if (line.length > 0 && !chunkEntry(line, room, read)) {
255
+ await reader.cancel();
256
+ return null;
257
+ }
258
+ const due = pace(line.length + ROW_WEIGHT);
259
+ if (due instanceof Promise)
260
+ await due;
261
+ }
262
+ if (start < text.length)
263
+ unfinished.push(text.slice(start));
264
+ }
265
+ const rest = unfinished.join('') + decoder.decode();
266
+ if (rest.length > 0 && !chunkEntry(rest, room, read))
267
+ return null;
268
+ return { anchor: room.anchor, position: room.position, logEpoch: room.logEpoch, ...read };
269
+ }
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
@@ -7,12 +7,9 @@ export type HouseBounds = {
7
7
  max_batch_documents: number;
8
8
  max_path_length: number;
9
9
  max_path_depth: number;
10
- max_mount_files: number;
11
- max_mount_bytes: number;
12
10
  max_inline_body_bytes: number;
13
11
  max_upload_bytes: number;
14
12
  max_prefixes: number;
15
- max_held_files: number;
16
13
  change_retention_seconds: number;
17
14
  max_move_documents?: number;
18
15
  };
@@ -29,6 +26,7 @@ export type HouseAuthority = LogPosition & {
29
26
  typedSelection: readonly string[] | null;
30
27
  managedReplication: 'admitted' | 'unavailable';
31
28
  protectedPaths: readonly string[];
29
+ writtenHomes: readonly string[];
32
30
  level: HouseAccessLevel;
33
31
  operations: HouseOperations;
34
32
  };
@@ -79,4 +77,3 @@ export declare function siteCapabilities(): readonly Capability[];
79
77
  export declare function discoveredRoom(authority: HouseAuthority): DiscoveredRoom;
80
78
  export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
81
79
  export {};
82
- //# sourceMappingURL=discovery.d.ts.map
@@ -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,EACV,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,eAAO,MAAM,gBAAgB,qBAAqB,C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oB,CAAC,IAAI,EAAE,OAAO,GAAG,oBAAoB,GAAG,IAAI,CAQ/E;AAmBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAa3E;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,gBAAgB,EAAE,CAU5E;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,aAAa,CAAC,GACpD,gBAAgB,EAAE,CAUpB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,aAAa,EAAE,CAa5E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAKhE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,sBAAsB,CAAC,SAAS,CAAC,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,5 +1,5 @@
1
1
  import { declaredActions } from './actions.js';
2
- import { SITE_SUBMISSION } from './transport.js';
2
+ import { SITES_SUBMISSIONS_CREATE } from './transport.js';
3
3
  import { readPosition, roomVersion } from './version.js';
4
4
  export const PROVIDER_ACTIONS = 'provider-actions';
5
5
  const BOUND_KEYS = [
@@ -8,12 +8,9 @@ const BOUND_KEYS = [
8
8
  'max_batch_documents',
9
9
  'max_path_length',
10
10
  'max_path_depth',
11
- 'max_mount_files',
12
- 'max_mount_bytes',
13
11
  'max_inline_body_bytes',
14
12
  'max_upload_bytes',
15
13
  'max_prefixes',
16
- 'max_held_files',
17
14
  'change_retention_seconds',
18
15
  ];
19
16
  const OPERATION_KEYS = ['write', 'erase'];
@@ -84,11 +81,13 @@ function parseAuthority(value) {
84
81
  const at = readPosition(held);
85
82
  const typedSelection = parseTypedSelection(held.typed_selection);
86
83
  const protectedPaths = stringList(held.protected_paths);
84
+ const writtenHomes = stringList(held.written_homes);
87
85
  const operations = parseOperations(held.operations);
88
86
  const level = ACCESS_LEVELS.find((one) => one === held.level);
89
87
  if (at === null ||
90
88
  typedSelection === undefined ||
91
89
  protectedPaths === null ||
90
+ writtenHomes === null ||
92
91
  level === undefined ||
93
92
  operations === null)
94
93
  return null;
@@ -104,6 +103,7 @@ function parseAuthority(value) {
104
103
  typedSelection,
105
104
  managedReplication: held.managed_replication,
106
105
  protectedPaths,
106
+ writtenHomes,
107
107
  level,
108
108
  operations,
109
109
  ...at,
@@ -268,7 +268,7 @@ export function siteCapabilities() {
268
268
  return [
269
269
  {
270
270
  name: PROVIDER_ACTIONS,
271
- actions: [{ name: SITE_SUBMISSION, inputShape: {}, resultKind: 'house' }],
271
+ actions: [{ name: SITES_SUBMISSIONS_CREATE, inputShape: {}, resultKind: 'house' }],
272
272
  },
273
273
  ];
274
274
  }
@@ -288,10 +288,9 @@ export function discoveredRoom(authority) {
288
288
  admission: authority.managedReplication,
289
289
  offline: authority.level === 'open' ? 'locked' : 'open',
290
290
  },
291
- ...(authority.typedSelection === null
292
- ? {}
293
- : { typedSelection: { roots: [...authority.typedSelection] } }),
291
+ typedSelection: authority.typedSelection === null ? null : { roots: [...authority.typedSelection] },
294
292
  providerOwnedPaths: [...authority.protectedPaths, authority.schema],
293
+ authoredPaths: [...authority.writtenHomes],
295
294
  };
296
295
  }
297
296
  export function mapDiscovery(document, rooms, declared) {
package/dist/history.d.ts CHANGED
@@ -1,12 +1,6 @@
1
1
  import type { AcceptedMessage, ActionResult, ConversationHistoryRequest } from '@agentshouse/mdruntime';
2
2
  import { type HouseDoor } from './transport.js';
3
3
  export declare const HISTORY_PAGE = 100;
4
- type HistoryCursor = {
5
- accepted_at: string;
6
- message_id: string;
7
- };
8
- export declare function cursorPosition(cursor: HistoryCursor): string;
4
+ export declare function changeCursor(change: number): string;
9
5
  export declare function acceptedMessage(entry: unknown): AcceptedMessage | null;
10
6
  export declare function houseHistory(transport: HouseDoor, request: ConversationHistoryRequest): Promise<ActionResult>;
11
- export {};
12
- //# sourceMappingURL=history.d.ts.map
@@ -1 +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;AAEhE,eAAO,MAAM,YAAY,MAAM,CAAC;AAIhC,KAAK,aAAa,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAkBjE,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAE5D;AAUD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAUtE;AA8BD,wBAAsB,YAAY,CAChC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,YAAY,CAAC,CAqBvB"}
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"}
package/dist/history.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import { actionOutcome } from './actions.js';
2
2
  import { houseDoorRoute } from './transport.js';
3
+ import { unusable } from './uncertain.js';
3
4
  export const HISTORY_PAGE = 100;
4
- const HISTORY = 'conversations/history';
5
+ const HISTORY = 'conversations/history/list';
6
+ const CHANGE_DIGITS = 16;
7
+ const CHANGE = new RegExp(`^[0-9]{${CHANGE_DIGITS}}$`);
5
8
  function record(value) {
6
9
  return typeof value === 'object' && value !== null ? value : {};
7
10
  }
@@ -9,32 +12,23 @@ function text(value, name) {
9
12
  const held = record(value)[name];
10
13
  return typeof held === 'string' ? held : undefined;
11
14
  }
12
- function historyCursor(value) {
13
- const acceptedAt = text(value, 'accepted_at');
14
- const messageId = text(value, 'message_id');
15
- if (acceptedAt === undefined || messageId === undefined)
16
- return null;
17
- return { accepted_at: acceptedAt, message_id: messageId };
18
- }
19
- export function cursorPosition(cursor) {
20
- return JSON.stringify({ accepted_at: cursor.accepted_at, message_id: cursor.message_id });
15
+ function changeOf(value) {
16
+ return Number.isSafeInteger(value) && value > 0 ? value : null;
21
17
  }
22
- function positionCursor(value) {
23
- try {
24
- return historyCursor(JSON.parse(value));
25
- }
26
- catch {
27
- return null;
28
- }
18
+ export function changeCursor(change) {
19
+ return String(change).padStart(CHANGE_DIGITS, '0');
29
20
  }
30
21
  export function acceptedMessage(entry) {
31
- const cursor = historyCursor(entry);
32
- if (cursor === null)
22
+ const identity = text(entry, 'message_id');
23
+ const acceptedAt = text(entry, 'accepted_at');
24
+ const change = changeOf(record(entry).change);
25
+ if (identity === undefined || acceptedAt === undefined || change === null)
33
26
  return null;
34
27
  return {
35
- identity: cursor.message_id,
36
- turn: text(entry, 'turn_id') ?? cursor.message_id,
37
- position: cursorPosition(cursor),
28
+ identity,
29
+ turn: text(entry, 'turn_id') ?? identity,
30
+ position: JSON.stringify({ accepted_at: acceptedAt, message_id: identity }),
31
+ change: changeCursor(change),
38
32
  text: text(entry, 'text') ?? '',
39
33
  message: structuredClone(record(entry)),
40
34
  };
@@ -51,20 +45,19 @@ function historyPage(entry) {
51
45
  return null;
52
46
  messages.push(message);
53
47
  }
54
- const next = held.next === null || held.next === undefined ? undefined : historyCursor(held.next);
48
+ const next = held.next === null || held.next === undefined ? undefined : changeOf(held.next);
55
49
  if (next === null)
56
50
  return null;
57
- return { conversation, messages, ...(next === undefined ? {} : { next: cursorPosition(next) }) };
51
+ return { conversation, messages, ...(next === undefined ? {} : { next: changeCursor(next) }) };
58
52
  }
59
53
  function historyAsks(request) {
60
54
  const asks = [];
61
55
  for (const { conversation, after } of request.conversations) {
62
- const cursor = after === undefined ? undefined : positionCursor(after);
63
- if (cursor === null)
56
+ if (after !== undefined && !CHANGE.test(after))
64
57
  return null;
65
58
  asks.push({
66
59
  conversation_id: conversation,
67
- ...(cursor === undefined ? {} : { after: cursor }),
60
+ ...(after === undefined ? {} : { after: Number(after) }),
68
61
  });
69
62
  }
70
63
  return asks;
@@ -79,12 +72,12 @@ export async function houseHistory(transport, request) {
79
72
  return outcome;
80
73
  const answered = record(outcome.result).histories;
81
74
  if (!Array.isArray(answered))
82
- return { kind: 'transport-uncertainty' };
75
+ return unusable();
83
76
  const histories = [];
84
77
  for (const entry of answered) {
85
78
  const page = historyPage(entry);
86
79
  if (page === null)
87
- return { kind: 'transport-uncertainty' };
80
+ return unusable();
88
81
  histories.push(page);
89
82
  }
90
83
  const result = { histories };
package/dist/index.d.ts CHANGED
@@ -3,11 +3,8 @@ export { foldedAuthorities } from './discovery.js';
3
3
  export { finishedUpload, houseUpload, type HouseUpload } from './upload.js';
4
4
  export { houseAction, type HouseActDoor } from './actions.js';
5
5
  export { HISTORY_PAGE } from './history.js';
6
+ export { answeredFailure } from './refusal.js';
6
7
  export { houseParts, type ChangeMapping } from './write.js';
7
- export { APP_REFERENCE_PATTERN } from './app-reference.js';
8
- export { HOUSE_MODEL_DECLARATION, HOUSE_MODEL_TYPES, HOUSE_TYPED_PATHS, type HouseDocumentFields, type HouseModelType, } from './house-model.js';
9
- export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './crockford.js';
10
- export { CHAT_MESSAGE_TYPE, CHAT_TYPE, HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, type InboxChannelKind, } from './room-types.js';
8
+ export { admittedPath, AUTHORED_SEGMENT, AUTHORED_SEGMENT_MAX_CHARS, GENERATED_PROVENANCE, GENERATED_REVISIONS, LOCAL_COPY_MANIFEST, LOCAL_COPY_ROOT_NAMES, RESERVED_DERIVED, WHOLE_ESCAPED_NAMES, } from './authored-path.js';
11
9
  export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, type HouseRuntimeAct, type HouseRuntimeFrame, } from './transport.js';
12
- export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamed, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
13
- //# sourceMappingURL=index.d.ts.map
10
+ export type { HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK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AM,cAAc,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -3,9 +3,7 @@ export { foldedAuthorities } from './discovery.js';
3
3
  export { finishedUpload, houseUpload } from './upload.js';
4
4
  export { houseAction } from './actions.js';
5
5
  export { HISTORY_PAGE } from './history.js';
6
+ export { answeredFailure } from './refusal.js';
6
7
  export { houseParts } from './write.js';
7
- export { APP_REFERENCE_PATTERN } from './app-reference.js';
8
- export { HOUSE_MODEL_DECLARATION, HOUSE_MODEL_TYPES, HOUSE_TYPED_PATHS, } from './house-model.js';
9
- export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './crockford.js';
10
- export { CHAT_MESSAGE_TYPE, CHAT_TYPE, HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, } from './room-types.js';
8
+ export { admittedPath, AUTHORED_SEGMENT, AUTHORED_SEGMENT_MAX_CHARS, GENERATED_PROVENANCE, GENERATED_REVISIONS, LOCAL_COPY_MANIFEST, LOCAL_COPY_ROOT_NAMES, RESERVED_DERIVED, WHOLE_ESCAPED_NAMES, } from './authored-path.js';
11
9
  export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, } from './transport.js';
package/dist/map.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export declare function roomLocalPath(path: string, handle: string): string;
2
2
  export declare function nativePath(path: string, handle: string): string;
3
- //# sourceMappingURL=map.d.ts.map
package/dist/model.d.ts CHANGED
@@ -1,13 +1,8 @@
1
1
  import type { RoomModels } from '@agentshouse/mdruntime';
2
2
  import type { TrackedAuthority } from './discovery.js';
3
- import { type HouseRoomHead, type HouseScope } from './read.js';
3
+ import { type HouseRoomHead } from './read.js';
4
4
  import { type SpaceSchemas } from './space-schema.js';
5
5
  import type { HouseMode, HouseStreamEntry } from './transport.js';
6
- export declare function partModels(scope: HouseScope, tracked: TrackedAuthority, seen: ReadonlySet<string>, final: boolean): Promise<RoomModels | undefined>;
7
- export declare function manifestedModels(room: HouseRoomHead, tracked: TrackedAuthority, spaces: SpaceSchemas): Promise<{
8
- readonly models: RoomModels | undefined;
9
- readonly seen: string[];
10
- }>;
6
+ export declare function manifestedModels(room: HouseRoomHead, tracked: TrackedAuthority, spaces: SpaceSchemas): Promise<RoomModels | undefined>;
11
7
  export declare function keptSpaceSchemas(entries: readonly HouseStreamEntry[], spaces: SpaceSchemas): void;
12
- export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode, spaces: SpaceSchemas): Promise<RoomModels | undefined>;
13
- //# sourceMappingURL=model.d.ts.map
8
+ export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode, spaces: SpaceSchemas, whole: boolean): Promise<RoomModels | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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,KAAK,aAAa,EAGnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA+BlE,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAMjC;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAKjG;AAQD,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAajC"}
package/dist/model.js CHANGED
@@ -23,22 +23,12 @@ async function modelsOf(tracked, read) {
23
23
  return undefined;
24
24
  return { collection: await heldModel(collection, schemaPath(tracked.handle, tracked.schema)) };
25
25
  }
26
- export function partModels(scope, tracked, seen, final) {
27
- return modelsOf(tracked, (schema) => {
28
- if (scope.files.some((file) => file.path === schema))
29
- return schemaOf(scope, schema);
30
- return final && !seen.has(schema) ? ABSENT_SCHEMA : undefined;
31
- });
32
- }
33
26
  export async function manifestedModels(room, tracked, spaces) {
34
27
  const scope = modelScope(room);
35
28
  const held = schemaOf(scope, tracked.schema);
36
29
  if (held?.space !== undefined && held.schema !== null && held.revision !== null)
37
30
  spaces.keep(held.space, held.revision, held.schema);
38
- return {
39
- models: await partModels(scope, tracked, new Set(), true),
40
- seen: scope.files.some((file) => file.path === tracked.schema) ? [tracked.schema] : [],
41
- };
31
+ return modelsOf(tracked, () => held);
42
32
  }
43
33
  export function keptSpaceSchemas(entries, spaces) {
44
34
  for (const entry of entries) {
@@ -51,11 +41,11 @@ function streamedText(entry, spaces) {
51
41
  return entry.text;
52
42
  return spaces.held(entry.space, entry.revision);
53
43
  }
54
- export function streamedModels(schemas, tracked, mode, spaces) {
44
+ export function streamedModels(schemas, tracked, mode, spaces, whole) {
55
45
  return modelsOf(tracked, (schema) => {
56
46
  const entry = schemas.get(schema);
57
47
  if (entry === undefined)
58
- return undefined;
48
+ return whole ? ABSENT_SCHEMA : undefined;
59
49
  const space = entry.space === undefined ? {} : { space: entry.space };
60
50
  if (entry.kind === 'removed')
61
51
  return { ...ABSENT_SCHEMA, ...space };