@agentshouse/mdruntime-adapter 0.1.0-c2631f0a4ed22 → 0.1.0-c26778ef7ace3
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/dist/actions.d.ts +2 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +29 -2
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +37 -55
- package/dist/authored-path.d.ts +1 -0
- package/dist/authored-path.d.ts.map +1 -1
- package/dist/authored-path.js +2 -0
- package/dist/chunks.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/read.d.ts +5 -5
- package/dist/read.js +6 -6
- package/dist/renamed.d.ts +10 -0
- package/dist/renamed.d.ts.map +1 -0
- package/dist/renamed.js +29 -0
- package/dist/room-query.d.ts.map +1 -1
- package/dist/room-query.js +19 -9
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +1 -0
- package/dist/transport.d.ts +2 -1
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +2 -3
- package/dist/upload.d.ts +4 -0
- package/dist/upload.d.ts.map +1 -1
- package/dist/upload.js +41 -0
- package/dist/write.d.ts +1 -2
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +11 -11
- package/package.json +4 -4
package/dist/actions.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type { HouseDoorAnswer, HouseTransport } from './transport.js';
|
|
|
3
3
|
export type HouseActDoor = Pick<HouseTransport, 'door'>;
|
|
4
4
|
export declare const HOUSE_UNKEPT_READS: readonly string[];
|
|
5
5
|
export declare const HOUSE_LEADING_READS: readonly string[];
|
|
6
|
+
export declare const HOUSE_RENAMED_UNTIL_2026_12_18: ReadonlyMap<string, string>;
|
|
7
|
+
export declare const HOUSE_REWRITTEN_UNTIL_2026_12_19: ReadonlyMap<string, (input: unknown) => unknown>;
|
|
6
8
|
export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
|
|
7
9
|
export declare function houseAction(transport: HouseActDoor, request: ActionRequest): Promise<ActionResult>;
|
|
8
10
|
export declare function actionOutcome(answer: HouseDoorAnswer, name: string, input: unknown): ActionResult;
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI7F,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAExD,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAI/C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAIhD,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAErE,CAAC;AAQH,eAAO,MAAM,gCAAgC,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CACvD,CAAC;AAMxC,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,iBAAiB,EAAE,CAUvF;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAIvB;AAwBD,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,CAajG"}
|
package/dist/actions.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { answeredFailure, doorRefusal, resetOf } from './refusal.js';
|
|
2
|
+
import { movedPaths, renamedHandle } from './renamed.js';
|
|
2
3
|
import { refusedFor } from './uncertain.js';
|
|
3
4
|
export const HOUSE_UNKEPT_READS = [
|
|
4
5
|
'account/security/read',
|
|
@@ -10,8 +11,29 @@ export const HOUSE_LEADING_READS = [
|
|
|
10
11
|
'sites/list',
|
|
11
12
|
'rooms/members/list',
|
|
12
13
|
];
|
|
14
|
+
export const HOUSE_RENAMED_UNTIL_2026_12_18 = new Map([
|
|
15
|
+
['files/batch', 'update'],
|
|
16
|
+
]);
|
|
17
|
+
function withoutRoomRef(input) {
|
|
18
|
+
if (typeof input !== 'object' || input === null || !('room_ref' in input))
|
|
19
|
+
return input;
|
|
20
|
+
const { room_ref: _room, ...paths } = input;
|
|
21
|
+
return paths;
|
|
22
|
+
}
|
|
23
|
+
export const HOUSE_REWRITTEN_UNTIL_2026_12_19 = new Map([['update', withoutRoomRef]]);
|
|
24
|
+
const ROOM_PATHS = new Map([
|
|
25
|
+
['update', ['changes.path', 'changes.to', 'paths', 'mount']],
|
|
26
|
+
]);
|
|
13
27
|
export function declaredActions(routes) {
|
|
14
|
-
return routes.map((name) =>
|
|
28
|
+
return routes.map((name) => {
|
|
29
|
+
const roomPaths = ROOM_PATHS.get(name);
|
|
30
|
+
return {
|
|
31
|
+
name,
|
|
32
|
+
inputShape: {},
|
|
33
|
+
resultKind: 'house',
|
|
34
|
+
...(roomPaths === undefined ? { room: 'room_ref' } : { roomPaths }),
|
|
35
|
+
};
|
|
36
|
+
});
|
|
15
37
|
}
|
|
16
38
|
export function houseAction(transport, request) {
|
|
17
39
|
const route = routeOf(request.name);
|
|
@@ -57,5 +79,10 @@ export function actionOutcome(answer, name, input) {
|
|
|
57
79
|
return { kind: 'action', result: answer.body };
|
|
58
80
|
}
|
|
59
81
|
async function carry(transport, route, name, input) {
|
|
60
|
-
|
|
82
|
+
const answered = actionOutcome(await transport.door(route, input), name, input);
|
|
83
|
+
const renamed = renamedHandle(answered);
|
|
84
|
+
if (renamed === null)
|
|
85
|
+
return answered;
|
|
86
|
+
const moved = movedPaths(input, renamed);
|
|
87
|
+
return actionOutcome(await transport.door(route, moved), name, moved);
|
|
61
88
|
}
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,OAAO,EAIP,aAAa,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,OAAO,EAIP,aAAa,EAkBd,MAAM,wBAAwB,CAAC;AAgChC,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAoBxB,MAAM,MAAM,yBAAyB,GACjC;IACE,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC,GACD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAcrD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAwcpF"}
|
package/dist/adapter.js
CHANGED
|
@@ -4,14 +4,15 @@ import { capabilities, discoveredRoom, mapDiscovery, parseAuthorityChange, parse
|
|
|
4
4
|
import { createSiteAdapter } from './site.js';
|
|
5
5
|
import { parseFileAddress, parseGrant } from './read.js';
|
|
6
6
|
import { chunkedHead, chunkLister, chunkPart } from './chunks.js';
|
|
7
|
-
import { finishedUpload, houseUpload } from './upload.js';
|
|
8
|
-
import { houseAction, HOUSE_LEADING_READS, HOUSE_UNKEPT_READS } from './actions.js';
|
|
7
|
+
import { finishedUpload, houseUpload, stagedBatch } from './upload.js';
|
|
8
|
+
import { houseAction, HOUSE_LEADING_READS, HOUSE_RENAMED_UNTIL_2026_12_18, HOUSE_REWRITTEN_UNTIL_2026_12_19, HOUSE_UNKEPT_READS, } from './actions.js';
|
|
9
9
|
import { houseQuery } from './room-query.js';
|
|
10
10
|
import { houseSearch } from './search.js';
|
|
11
|
-
import { answeredFailure, classifyDoor,
|
|
11
|
+
import { answeredFailure, classifyDoor, keyedFailure } from './refusal.js';
|
|
12
12
|
import { UNANSWERED, unusable } from './uncertain.js';
|
|
13
13
|
import { houseNotifications, } from './stream.js';
|
|
14
14
|
import { houseDoorRoute, } from './transport.js';
|
|
15
|
+
import { renamedHandle } from './renamed.js';
|
|
15
16
|
import { batchPaths, deltaBody, deltaBytes, deltaDigest, historyOutcome, houseChanges, houseMove, mutationOutcome, operationHead, rejectedMapping, revisionBody, uploadable, } from './write.js';
|
|
16
17
|
import { admittedPath } from './authored-path.js';
|
|
17
18
|
import { followsVersion, reachedVersion, roomVersion } from './version.js';
|
|
@@ -19,10 +20,6 @@ const EXPIRED_ADDRESS = 403;
|
|
|
19
20
|
function lapsedGrant(outcome) {
|
|
20
21
|
return outcome.kind === 'rejected' && outcome.code === 'upload_unavailable';
|
|
21
22
|
}
|
|
22
|
-
function unstagedRefusal(answer) {
|
|
23
|
-
const refusal = doorRefusal(answer.body);
|
|
24
|
-
return refusal?.code === 'files_unstaged' ? refusal : null;
|
|
25
|
-
}
|
|
26
23
|
export function createAgentsHouseAdapter(options) {
|
|
27
24
|
if ('site' in options)
|
|
28
25
|
return createSiteAdapter(options.site, options.snapshot === true);
|
|
@@ -153,8 +150,9 @@ export function createAgentsHouseAdapter(options) {
|
|
|
153
150
|
if (handed !== undefined && handed.sha256 === sha256) {
|
|
154
151
|
return { body: { ...head, paths, upload: handed, runtime: notifications.runtime } };
|
|
155
152
|
}
|
|
156
|
-
const minted = await transport.door(houseDoorRoute('
|
|
153
|
+
const minted = await transport.door(houseDoorRoute('update'), {
|
|
157
154
|
...head,
|
|
155
|
+
op: 'stage',
|
|
158
156
|
paths,
|
|
159
157
|
bytes,
|
|
160
158
|
sha256,
|
|
@@ -181,22 +179,6 @@ export function createAgentsHouseAdapter(options) {
|
|
|
181
179
|
await keep(upload);
|
|
182
180
|
return { body: { ...head, paths, upload, runtime: notifications.runtime } };
|
|
183
181
|
}
|
|
184
|
-
async function staged(uploads, { changeBatch: batch, file }) {
|
|
185
|
-
for (const named of uploads) {
|
|
186
|
-
const upload = houseUpload(named);
|
|
187
|
-
const change = batch.changes.find((held) => held.kind === 'binary' && held.sha256 === named.sha256);
|
|
188
|
-
if (upload === null || change === undefined)
|
|
189
|
-
return unusable();
|
|
190
|
-
const sent = await finishedUpload(transport, upload, await file(change.localId));
|
|
191
|
-
if ('unfinished' in sent)
|
|
192
|
-
return answeredFailure(sent.unfinished, null);
|
|
193
|
-
if (sent.status !== 200)
|
|
194
|
-
return answeredFailure(sent.status, sent.body);
|
|
195
|
-
if (sent.body?.staged !== true)
|
|
196
|
-
return unusable();
|
|
197
|
-
}
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
182
|
async function submit(request, head, changes, delta, bytes, entry, handed, keep, into) {
|
|
201
183
|
const inline = { ...head, changes, runtime: notifications.runtime };
|
|
202
184
|
const prepared = uploadable(inline, bytes, declared())
|
|
@@ -204,22 +186,12 @@ export function createAgentsHouseAdapter(options) {
|
|
|
204
186
|
: { body: inline };
|
|
205
187
|
if ('outcome' in prepared)
|
|
206
188
|
return prepared.outcome;
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const fresh = upload.filter((named) => !finished.has(named.id));
|
|
214
|
-
if (fresh.length === 0)
|
|
215
|
-
return answeredFailure(settled.status, settled.body);
|
|
216
|
-
const staging = await staged(fresh, request);
|
|
217
|
-
if (staging !== null)
|
|
218
|
-
return staging;
|
|
219
|
-
for (const named of fresh)
|
|
220
|
-
finished.add(named.id);
|
|
221
|
-
settled = await transport.door(houseDoorRoute('files/batch'), prepared.body);
|
|
222
|
-
}
|
|
189
|
+
const settled = await stagedBatch(transport, prepared.body, (sha256) => {
|
|
190
|
+
const change = request.changeBatch.changes.find((held) => held.kind === 'binary' && held.sha256 === sha256);
|
|
191
|
+
return change === undefined ? null : request.file(change.localId);
|
|
192
|
+
});
|
|
193
|
+
if ('kind' in settled)
|
|
194
|
+
return settled;
|
|
223
195
|
return stepped(mutationOutcome(settled.status, settled.body, entry.locator, entry.handle, into === undefined
|
|
224
196
|
? undefined
|
|
225
197
|
: {
|
|
@@ -227,6 +199,23 @@ export function createAgentsHouseAdapter(options) {
|
|
|
227
199
|
destination: { authority: into.authority, handle: into.handle },
|
|
228
200
|
}));
|
|
229
201
|
}
|
|
202
|
+
async function mutated(request, keep, entry, into) {
|
|
203
|
+
const batch = request.changeBatch;
|
|
204
|
+
const mapped = into === undefined
|
|
205
|
+
? houseChanges(batch, entry.handle)
|
|
206
|
+
: houseMove(batch, entry.handle, into.handle);
|
|
207
|
+
if (mapped.kind === 'unmapped')
|
|
208
|
+
return rejectedMapping(mapped);
|
|
209
|
+
const head = operationHead(batch);
|
|
210
|
+
const delta = deltaBody(mapped.changes);
|
|
211
|
+
const bytes = deltaBytes(delta);
|
|
212
|
+
const handed = request.upload;
|
|
213
|
+
const answer = (upload) => submit(request, head, mapped.changes, delta, bytes, entry, upload, keep, into);
|
|
214
|
+
const outcome = await answer(handed);
|
|
215
|
+
if (handed === undefined || !lapsedGrant(outcome))
|
|
216
|
+
return outcome;
|
|
217
|
+
return answer(undefined);
|
|
218
|
+
}
|
|
230
219
|
function refusedOn(answer, locator) {
|
|
231
220
|
if (locator === null)
|
|
232
221
|
return keyedFailure(answer.status, answer.body);
|
|
@@ -324,6 +313,8 @@ export function createAgentsHouseAdapter(options) {
|
|
|
324
313
|
pathRule: admittedPath,
|
|
325
314
|
unkeptReads: HOUSE_UNKEPT_READS,
|
|
326
315
|
leadingReads: HOUSE_LEADING_READS,
|
|
316
|
+
renamedActions: HOUSE_RENAMED_UNTIL_2026_12_18,
|
|
317
|
+
rewrittenInputs: HOUSE_REWRITTEN_UNTIL_2026_12_19,
|
|
327
318
|
async authorize() {
|
|
328
319
|
return options.authorize();
|
|
329
320
|
},
|
|
@@ -339,26 +330,17 @@ export function createAgentsHouseAdapter(options) {
|
|
|
339
330
|
const entry = authorityFor(request.locator);
|
|
340
331
|
if (entry === undefined)
|
|
341
332
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
342
|
-
const
|
|
343
|
-
const destination = batch.between?.destination.room;
|
|
333
|
+
const destination = request.changeBatch.between?.destination.room;
|
|
344
334
|
const into = destination === undefined ? undefined : authorityFor(destination);
|
|
345
335
|
if (destination !== undefined && into === undefined) {
|
|
346
336
|
return { kind: 'room-not-readable', locator: destination };
|
|
347
337
|
}
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if (mapped.kind === 'unmapped')
|
|
352
|
-
return rejectedMapping(mapped);
|
|
353
|
-
const head = operationHead(batch, entry.authority);
|
|
354
|
-
const delta = deltaBody(mapped.changes);
|
|
355
|
-
const bytes = deltaBytes(delta);
|
|
356
|
-
const handed = request.upload;
|
|
357
|
-
const answer = (upload) => submit(request, head, mapped.changes, delta, bytes, entry, upload, keep, into);
|
|
358
|
-
const outcome = await answer(handed);
|
|
359
|
-
if (handed === undefined || !lapsedGrant(outcome))
|
|
338
|
+
const outcome = await mutated(request, keep, entry, into);
|
|
339
|
+
const renamed = renamedHandle(outcome);
|
|
340
|
+
if (renamed === null)
|
|
360
341
|
return outcome;
|
|
361
|
-
|
|
342
|
+
const moved = (held) => held.handle === renamed.from ? { ...held, handle: renamed.to } : held;
|
|
343
|
+
return mutated(request, keep, moved(entry), into === undefined ? undefined : moved(into));
|
|
362
344
|
},
|
|
363
345
|
async history(_authorization, request) {
|
|
364
346
|
const entry = authorityFor(request.locator);
|
package/dist/authored-path.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare const GENERATED_REVISIONS = "_revisions";
|
|
|
3
3
|
export declare const RESERVED_DERIVED = "_derived";
|
|
4
4
|
export declare const WHOLE_ESCAPED_NAMES: readonly string[];
|
|
5
5
|
export declare const LOCAL_COPY_MANIFEST = ".house";
|
|
6
|
+
export declare const ROOM_FOLDER_FILES: readonly string[];
|
|
6
7
|
export declare const LOCAL_COPY_ROOT_NAMES: readonly string[];
|
|
7
8
|
export declare const AUTHORED_NAME_MAX_BYTES = 255;
|
|
8
9
|
export declare const AUTHORED_PATH_MAX_BYTES = 768;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authored-path.d.ts","sourceRoot":"","sources":["../src/authored-path.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAE3C,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAMhD,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"authored-path.d.ts","sourceRoot":"","sources":["../src/authored-path.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAE3C,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAMhD,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAA+B,CAAC;AAE/E,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAKlD,CAAC;AAEF,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAI3C,eAAO,MAAM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E,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAsB5D,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO9C;AAYD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAiB5D;AASD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAU5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKlD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7D;AAyBD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAK7F;AAWD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAI,EAAE,IAAI,SAAK,GAAG,MAAM,CAUrE"}
|
package/dist/authored-path.js
CHANGED
|
@@ -10,10 +10,12 @@ export const WHOLE_ESCAPED_NAMES = [
|
|
|
10
10
|
RESERVED_DERIVED,
|
|
11
11
|
];
|
|
12
12
|
export const LOCAL_COPY_MANIFEST = '.house';
|
|
13
|
+
export const ROOM_FOLDER_FILES = ['AGENTS.md', 'CLAUDE.md'];
|
|
13
14
|
export const LOCAL_COPY_ROOT_NAMES = [
|
|
14
15
|
'.gitignore',
|
|
15
16
|
'.ignore',
|
|
16
17
|
LOCAL_COPY_MANIFEST,
|
|
18
|
+
...ROOM_FOLDER_FILES,
|
|
17
19
|
];
|
|
18
20
|
export const AUTHORED_NAME_MAX_BYTES = 255;
|
|
19
21
|
export const AUTHORED_PATH_MAX_BYTES = 768;
|
package/dist/chunks.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
2
|
export { foldedAuthorities, ROOM_OWN } from './discovery.js';
|
|
3
|
-
export { finishedUpload, houseUpload, type HouseUpload } from './upload.js';
|
|
3
|
+
export { finishedUpload, houseUpload, stagedBatch, type HouseUpload } from './upload.js';
|
|
4
4
|
export { houseAction, type HouseActDoor } from './actions.js';
|
|
5
5
|
export { HISTORY_PAGE } from './history.js';
|
|
6
6
|
export { answeredFailure } from './refusal.js';
|
|
7
7
|
export { answering, documentEntry, kept, type Answered, type HouseManifestFile } from './read.js';
|
|
8
8
|
export { houseParts, type ChangeMapping } from './write.js';
|
|
9
|
-
export { admittedPath, AUTHORED_NAME_MAX_BYTES, AUTHORED_NAME_RULE, AUTHORED_PATH_MAX_BYTES, fittedName, GENERATED_PROVENANCE, GENERATED_REVISIONS, LOCAL_COPY_MANIFEST, LOCAL_COPY_ROOT_NAMES, nameRefusal, pathRefusal, RESERVED_DERIVED, sameName, utf8Bytes, WHOLE_ESCAPED_NAMES, type NameRefusal, type PathRefusal, } from './authored-path.js';
|
|
9
|
+
export { admittedPath, AUTHORED_NAME_MAX_BYTES, AUTHORED_NAME_RULE, AUTHORED_PATH_MAX_BYTES, fittedName, GENERATED_PROVENANCE, GENERATED_REVISIONS, LOCAL_COPY_MANIFEST, LOCAL_COPY_ROOT_NAMES, nameParts, nameRefusal, pathRefusal, RESERVED_DERIVED, ROOM_FOLDER_FILES, sameName, utf8Bytes, WHOLE_ESCAPED_NAMES, type NameRefusal, type PathRefusal, } from './authored-path.js';
|
|
10
10
|
export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, SITE_FRESH_QUERY, SITE_IMAGE_COPIES_HEADER, SITE_QUERY, SITE_QUERY_ROUTE_CHARACTERS, siteQueryAsked, siteQueryRoute, type HouseRuntimeAct, type HouseRuntimeFrame, } from './transport.js';
|
|
11
11
|
export type { HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
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,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,SAAS,EACT,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,UAAU,EACV,2BAA2B,EAC3B,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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter } from './adapter.js';
|
|
2
2
|
export { foldedAuthorities, ROOM_OWN } from './discovery.js';
|
|
3
|
-
export { finishedUpload, houseUpload } from './upload.js';
|
|
3
|
+
export { finishedUpload, houseUpload, stagedBatch } from './upload.js';
|
|
4
4
|
export { houseAction } from './actions.js';
|
|
5
5
|
export { HISTORY_PAGE } from './history.js';
|
|
6
6
|
export { answeredFailure } from './refusal.js';
|
|
7
7
|
export { answering, documentEntry, kept } from './read.js';
|
|
8
8
|
export { houseParts } from './write.js';
|
|
9
|
-
export { admittedPath, AUTHORED_NAME_MAX_BYTES, AUTHORED_NAME_RULE, AUTHORED_PATH_MAX_BYTES, fittedName, GENERATED_PROVENANCE, GENERATED_REVISIONS, LOCAL_COPY_MANIFEST, LOCAL_COPY_ROOT_NAMES, nameRefusal, pathRefusal, RESERVED_DERIVED, sameName, utf8Bytes, WHOLE_ESCAPED_NAMES, } from './authored-path.js';
|
|
9
|
+
export { admittedPath, AUTHORED_NAME_MAX_BYTES, AUTHORED_NAME_RULE, AUTHORED_PATH_MAX_BYTES, fittedName, GENERATED_PROVENANCE, GENERATED_REVISIONS, LOCAL_COPY_MANIFEST, LOCAL_COPY_ROOT_NAMES, nameParts, nameRefusal, pathRefusal, RESERVED_DERIVED, ROOM_FOLDER_FILES, sameName, utf8Bytes, WHOLE_ESCAPED_NAMES, } from './authored-path.js';
|
|
10
10
|
export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, SITE_FRESH_QUERY, SITE_IMAGE_COPIES_HEADER, SITE_QUERY, SITE_QUERY_ROUTE_CHARACTERS, siteQueryAsked, siteQueryRoute, } from './transport.js';
|
package/dist/read.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BinaryCopy, type
|
|
1
|
+
import { type BinaryCopy, type Attachment, type BootstrapPage, type SavedFacts } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { HouseMode } from './transport.js';
|
|
3
3
|
import { type LogPosition } from './version.js';
|
|
4
4
|
export type HeadChange = BootstrapPage['changes'][string];
|
|
@@ -9,7 +9,7 @@ export type Answered = {
|
|
|
9
9
|
readonly fileIds: Map<string, string>;
|
|
10
10
|
readonly created: Map<string, string>;
|
|
11
11
|
readonly changes: Map<string, HeadChange>;
|
|
12
|
-
readonly
|
|
12
|
+
readonly attachments: Map<string, Attachment>;
|
|
13
13
|
readonly removals: Set<string>;
|
|
14
14
|
readonly folders: Set<string>;
|
|
15
15
|
readonly folderRemovals: Set<string>;
|
|
@@ -25,7 +25,7 @@ export declare function answered(answer: Answered): Generator<number, {
|
|
|
25
25
|
fileIds?: Readonly<Record<string, string>>;
|
|
26
26
|
created?: Readonly<Record<string, string>>;
|
|
27
27
|
changes: Readonly<Record<string, HeadChange>>;
|
|
28
|
-
|
|
28
|
+
attachments: Readonly<Record<string, Attachment>>;
|
|
29
29
|
removals: readonly string[];
|
|
30
30
|
folders?: readonly string[];
|
|
31
31
|
folderRemovals?: readonly string[];
|
|
@@ -36,7 +36,7 @@ export type HouseManifestFile = {
|
|
|
36
36
|
version: string;
|
|
37
37
|
head?: HeadChange;
|
|
38
38
|
created?: string;
|
|
39
|
-
binary?:
|
|
39
|
+
binary?: Attachment;
|
|
40
40
|
facts?: SavedFacts;
|
|
41
41
|
space?: string;
|
|
42
42
|
content?: string;
|
|
@@ -70,7 +70,7 @@ export declare function headChange(held: {
|
|
|
70
70
|
readonly author?: unknown;
|
|
71
71
|
readonly changed_at?: unknown;
|
|
72
72
|
}): HeadChange | undefined | null;
|
|
73
|
-
export declare function
|
|
73
|
+
export declare function attachmentOf(held: Readonly<Record<string, unknown>>): Attachment | undefined | null;
|
|
74
74
|
export declare function documentEntry(value: unknown, mode: HouseMode): HouseManifestFile | null;
|
|
75
75
|
export declare function kept(answer: Answered, file: HouseManifestFile): void;
|
|
76
76
|
export declare function modelScope(room: HouseRoomHead): HouseScope;
|
package/dist/read.js
CHANGED
|
@@ -12,7 +12,7 @@ export function answering() {
|
|
|
12
12
|
fileIds: new Map(),
|
|
13
13
|
created: new Map(),
|
|
14
14
|
changes: new Map(),
|
|
15
|
-
|
|
15
|
+
attachments: new Map(),
|
|
16
16
|
removals: new Set(),
|
|
17
17
|
folders: new Set(),
|
|
18
18
|
folderRemovals: new Set(),
|
|
@@ -31,7 +31,7 @@ export function forgotten(answer, path) {
|
|
|
31
31
|
answer.fileIds.delete(path);
|
|
32
32
|
answer.created.delete(path);
|
|
33
33
|
answer.changes.delete(path);
|
|
34
|
-
answer.
|
|
34
|
+
answer.attachments.delete(path);
|
|
35
35
|
answer.removals.delete(path);
|
|
36
36
|
}
|
|
37
37
|
export function folded(answer, path, removed) {
|
|
@@ -61,7 +61,7 @@ export function* answered(answer) {
|
|
|
61
61
|
...(answer.fileIds.size === 0 ? {} : { fileIds: yield* patching({}, answer.fileIds) }),
|
|
62
62
|
...(answer.created.size === 0 ? {} : { created: yield* patching({}, answer.created) }),
|
|
63
63
|
changes: yield* patching({}, answer.changes),
|
|
64
|
-
|
|
64
|
+
attachments: yield* patching({}, answer.attachments),
|
|
65
65
|
removals,
|
|
66
66
|
...(answer.folders.size === 0 ? {} : { folders: yield* pathsOf(answer.folders) }),
|
|
67
67
|
...(answer.folderRemovals.size === 0
|
|
@@ -165,7 +165,7 @@ function imageSize(width, height) {
|
|
|
165
165
|
return { width: null, height: null };
|
|
166
166
|
return side(width) && side(height) ? { width, height } : null;
|
|
167
167
|
}
|
|
168
|
-
export function
|
|
168
|
+
export function attachmentOf(held) {
|
|
169
169
|
if (held.media_type === undefined)
|
|
170
170
|
return undefined;
|
|
171
171
|
const { bytes, media_type: mediaType, sha256 } = held;
|
|
@@ -195,7 +195,7 @@ export function documentEntry(value, mode) {
|
|
|
195
195
|
return null;
|
|
196
196
|
const head = headChange(file);
|
|
197
197
|
const created = createdOf(file);
|
|
198
|
-
const binary =
|
|
198
|
+
const binary = attachmentOf(file);
|
|
199
199
|
if (head === null || created === null || binary === null)
|
|
200
200
|
return null;
|
|
201
201
|
const content = file.content === undefined ? {} : { content: file.content };
|
|
@@ -232,7 +232,7 @@ export function kept(answer, file) {
|
|
|
232
232
|
if (file.created !== undefined)
|
|
233
233
|
answer.created.set(file.path, file.created);
|
|
234
234
|
if (file.binary !== undefined)
|
|
235
|
-
answer.
|
|
235
|
+
answer.attachments.set(file.path, file.binary);
|
|
236
236
|
else if (file.content !== undefined)
|
|
237
237
|
answer.documents.set(file.path, file.content);
|
|
238
238
|
if (file.binary === undefined && file.facts !== undefined)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface Renamed {
|
|
2
|
+
readonly from: string;
|
|
3
|
+
readonly to: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function renamedHandle(answer: {
|
|
6
|
+
readonly kind: string;
|
|
7
|
+
readonly code?: string;
|
|
8
|
+
readonly fields?: Readonly<Record<string, unknown>>;
|
|
9
|
+
}): Renamed | null;
|
|
10
|
+
export declare function movedPaths(value: unknown, renamed: Renamed): unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renamed.d.ts","sourceRoot":"","sources":["../src/renamed.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAMD,wBAAgB,aAAa,CAAC,MAAM,EAAE;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD,GAAG,OAAO,GAAG,IAAI,CAKjB;AAQD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CASpE"}
|
package/dist/renamed.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const ROOM_ROOT = /^\/rooms\/([^/]+)(?=\/|$)/u;
|
|
2
|
+
const PATH_FIELDS = new Set(['path', 'to', 'mount', 'paths']);
|
|
3
|
+
function roomOfPath(path) {
|
|
4
|
+
return typeof path === 'string' ? (ROOM_ROOT.exec(path)?.[1] ?? null) : null;
|
|
5
|
+
}
|
|
6
|
+
export function renamedHandle(answer) {
|
|
7
|
+
if (answer.kind !== 'rejected' || answer.code !== 'handle_changed')
|
|
8
|
+
return null;
|
|
9
|
+
const from = roomOfPath(answer.fields?.path);
|
|
10
|
+
const to = roomOfPath(answer.fields?.current_path);
|
|
11
|
+
return from === null || to === null || from === to ? null : { from, to };
|
|
12
|
+
}
|
|
13
|
+
function movedPath(value, renamed) {
|
|
14
|
+
if (Array.isArray(value))
|
|
15
|
+
return value.map((one) => movedPath(one, renamed));
|
|
16
|
+
if (typeof value !== 'string' || roomOfPath(value) !== renamed.from)
|
|
17
|
+
return value;
|
|
18
|
+
return `/rooms/${renamed.to}${value.slice(`/rooms/${renamed.from}`.length)}`;
|
|
19
|
+
}
|
|
20
|
+
export function movedPaths(value, renamed) {
|
|
21
|
+
if (Array.isArray(value))
|
|
22
|
+
return value.map((one) => movedPaths(one, renamed));
|
|
23
|
+
if (value === null || typeof value !== 'object')
|
|
24
|
+
return value;
|
|
25
|
+
return Object.fromEntries(Object.entries(value).map(([key, held]) => [
|
|
26
|
+
key,
|
|
27
|
+
PATH_FIELDS.has(key) ? movedPath(held, renamed) : movedPaths(held, renamed),
|
|
28
|
+
]));
|
|
29
|
+
}
|
package/dist/room-query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room-query.d.ts","sourceRoot":"","sources":["../src/room-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EAId,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"room-query.d.ts","sourceRoot":"","sources":["../src/room-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EAId,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAmBxB,wBAAsB,UAAU,CAC9B,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,EACvC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,gBAAgB,CAAC,CAK3B;AAED,wBAAsB,SAAS,CAC7B,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,EAC3C,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,gBAAgB,CAAC,CAQ3B"}
|
package/dist/room-query.js
CHANGED
|
@@ -6,26 +6,36 @@ const TOO_LONG_FOR_AN_ADDRESS = {
|
|
|
6
6
|
fields: {},
|
|
7
7
|
retryable: false,
|
|
8
8
|
};
|
|
9
|
+
function infoAsked(request) {
|
|
10
|
+
const root = `/rooms/${request.room}`;
|
|
11
|
+
if (!('query' in request)) {
|
|
12
|
+
const { path, after } = request;
|
|
13
|
+
return { path: `${root}/${path}`, ...(after === undefined ? {} : { cursor: after }) };
|
|
14
|
+
}
|
|
15
|
+
const { after, ...query } = request.query;
|
|
16
|
+
return { path: root, query, ...(after === undefined ? {} : { cursor: after }) };
|
|
17
|
+
}
|
|
9
18
|
export async function houseQuery(transport, request) {
|
|
10
|
-
return queriedPage(await transport.door(houseDoorRoute('
|
|
11
|
-
room_ref: request.room,
|
|
12
|
-
query: request.query,
|
|
13
|
-
}));
|
|
19
|
+
return queriedPage(await transport.door(houseDoorRoute('info'), infoAsked(request)), 'next_cursor');
|
|
14
20
|
}
|
|
15
21
|
export async function siteQuery(transport, request) {
|
|
16
|
-
const
|
|
22
|
+
const asked = 'query' in request
|
|
23
|
+
? request.query
|
|
24
|
+
: { path: request.path, ...(request.after === undefined ? {} : { after: request.after }) };
|
|
25
|
+
const route = siteQueryRoute(request.room, asked, request.fresh);
|
|
17
26
|
if (route.length > SITE_QUERY_ROUTE_CHARACTERS)
|
|
18
27
|
return TOO_LONG_FOR_AN_ADDRESS;
|
|
19
|
-
return queriedPage(await transport.read(route));
|
|
28
|
+
return queriedPage(await transport.read(route), 'next');
|
|
20
29
|
}
|
|
21
|
-
function queriedPage(answer) {
|
|
30
|
+
function queriedPage(answer, named) {
|
|
22
31
|
if (answer.status === 401)
|
|
23
32
|
return { kind: 'revoked-authorization' };
|
|
24
33
|
const refusal = doorRefusal(answer.body);
|
|
25
34
|
if (refusal !== null)
|
|
26
35
|
return { kind: 'rejected', ...refusal };
|
|
27
|
-
const
|
|
28
|
-
|
|
36
|
+
const body = (answer.body ?? {});
|
|
37
|
+
const { documents, groups, total, totalCapped, capped } = body;
|
|
38
|
+
const next = body[named];
|
|
29
39
|
if (answer.status !== 200 || !(Array.isArray(documents) || Array.isArray(groups))) {
|
|
30
40
|
return answeredFailure(answer.status, answer.body);
|
|
31
41
|
}
|
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,EAGL,KAAK,eAAe,EAEpB,KAAK,SAAS,EACd,KAAK,kBAAkB,EAEvB,KAAK,QAAQ,EAGb,KAAK,eAAe,EAEpB,KAAK,iBAAiB,EAEvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAYvD,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,SAAS,EAGd,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAaxB,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AAE/E,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAAC;AAElG,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IACnE,OAAO,CAAC,KAAK,EAAE,0BAA0B,GAAG,eAAe,GAAG,IAAI,CAAC;IACnE,OAAO,CAAC,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC9D,IAAI,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,IAAI,CAAC;IACvC,KAAK,CAAC,WAAW,EAAE,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IACvC,KAAK,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtD,aAAa,EAAE,kBAAkB,CAAC;IAClC,WAAW,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAyFF,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,SAAS,EACf,WAAW,EAAE,gBAAgB,GAC5B,kBAAkB,CA6XpB"}
|
package/dist/stream.js
CHANGED
package/dist/transport.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ConversationEvent, ListedAgent, SavedFacts } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { Operation, SessionState } from './session-content/index.js';
|
|
3
3
|
export declare const HOUSE_RUNTIME_READS: {
|
|
4
|
-
readonly acts: readonly ['account/push/set', 'account/time-zone/set', 'apps/features/set', 'apps/source/download', 'apps/source/top/read', 'conversations/history/list', 'files/attach', 'files/
|
|
4
|
+
readonly acts: readonly ['account/push/set', 'account/time-zone/set', 'apps/features/set', 'apps/source/download', 'apps/source/top/read', 'conversations/history/list', 'files/attach', 'files/finish', 'files/read', 'files/revisions/list', 'info', 'room-chunks/list', 'rooms/discover', 'rooms/search', 'sites/screenshot/read', 'update'];
|
|
5
5
|
readonly frames: readonly ['agent', 'app-message', 'app-rooms', 'authority_changed', 'carried', 'caught_up', 'commands', 'conversation', 'conversation_deleted', 'conversations', 'deliveries', 'deployment', 'held', 'interactions', 'message', 'opening', 'options', 'part', 'process', 'received', 'report', 'signal', 'site', 'starting', 'state', 'tab-icon', 'turn'];
|
|
6
6
|
};
|
|
7
7
|
export type HouseRuntimeAct = (typeof HOUSE_RUNTIME_READS.acts)[number];
|
|
@@ -79,6 +79,7 @@ export type HouseListedConversation = {
|
|
|
79
79
|
newest: number | null;
|
|
80
80
|
process_ended_at: string | null;
|
|
81
81
|
subject: string | null;
|
|
82
|
+
room_ref: string | null;
|
|
82
83
|
};
|
|
83
84
|
type Listed<Frame extends {
|
|
84
85
|
readonly type: HouseRuntimeFrame;
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5E,eAAO,MAAM,mBAAmB;aAC9B,IAAI,YACF,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5E,eAAO,MAAM,mBAAmB;aAC9B,IAAI,YACF,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,cAAc,EACd,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,MAAM,EACN,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,QAAQ;aAEV,MAAM,YACJ,OAAO,EACP,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,cAAc,EACd,SAAS,EACT,SAAS,EACT,SAAS,EACT,MAAM,EACN,SAAS,EACT,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,UAAU,EACV,OAAO,EACP,UAAU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AAI,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzF,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG;IAC3C,MAAM,IAAI,OAAO,CAAC;IAClB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpD,CAAC"}
|
package/dist/transport.js
CHANGED
|
@@ -8,16 +8,15 @@ export const HOUSE_RUNTIME_READS = {
|
|
|
8
8
|
'apps/source/top/read',
|
|
9
9
|
'conversations/history/list',
|
|
10
10
|
'files/attach',
|
|
11
|
-
'files/batch',
|
|
12
|
-
'files/batch-upload',
|
|
13
11
|
'files/finish',
|
|
14
12
|
'files/read',
|
|
15
13
|
'files/revisions/list',
|
|
14
|
+
'info',
|
|
16
15
|
'room-chunks/list',
|
|
17
16
|
'rooms/discover',
|
|
18
|
-
'rooms/query',
|
|
19
17
|
'rooms/search',
|
|
20
18
|
'sites/screenshot/read',
|
|
19
|
+
'update',
|
|
21
20
|
],
|
|
22
21
|
frames: [
|
|
23
22
|
'agent',
|
package/dist/upload.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TransportUncertainty } from '@agentshouse/mdruntime';
|
|
1
2
|
import { type HouseDoorAnswer, type HouseTransport } from './transport.js';
|
|
2
3
|
export type HouseUpload = {
|
|
3
4
|
readonly id: string;
|
|
@@ -11,3 +12,6 @@ export declare function houseUpload(value: unknown): HouseUpload | null;
|
|
|
11
12
|
export declare function finishedUpload(transport: HouseTransport, first: HouseUpload, blob: Blob): Promise<HouseDoorAnswer | {
|
|
12
13
|
readonly unfinished: number;
|
|
13
14
|
}>;
|
|
15
|
+
type StagedFile = (sha256: unknown) => Promise<Blob> | null;
|
|
16
|
+
export declare function stagedBatch(transport: HouseTransport, body: Readonly<Record<string, unknown>>, file: StagedFile): Promise<HouseDoorAnswer | TransportUncertainty>;
|
|
17
|
+
export {};
|
package/dist/upload.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../src/upload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../src/upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGpF,OAAO,EAAkB,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG3F,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC5E,CAAC;AAeF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAQ9D;AA+BD,wBAAsB,cAAc,CAClC,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,eAAe,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAgB5D;AAED,KAAK,UAAU,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAsB5D,wBAAsB,WAAW,CAC/B,SAAS,EAAE,cAAc,EACzB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACvC,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,eAAe,GAAG,oBAAoB,CAAC,CAoBjD"}
|
package/dist/upload.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { sha256 } from '@agentshouse/mdruntime/digest';
|
|
2
|
+
import { answeredFailure, doorRefusal } from './refusal.js';
|
|
2
3
|
import { houseDoorRoute } from './transport.js';
|
|
4
|
+
import { unusable } from './uncertain.js';
|
|
3
5
|
const FINISHING_ROUNDS = 24;
|
|
4
6
|
function record(value) {
|
|
5
7
|
return value !== null && typeof value === 'object' ? value : {};
|
|
@@ -63,3 +65,42 @@ export async function finishedUpload(transport, first, blob) {
|
|
|
63
65
|
}
|
|
64
66
|
return { unfinished: 200 };
|
|
65
67
|
}
|
|
68
|
+
function unstagedRefusal(answer) {
|
|
69
|
+
const refusal = doorRefusal(answer.body);
|
|
70
|
+
return refusal?.code === 'files_unstaged' ? refusal : null;
|
|
71
|
+
}
|
|
72
|
+
async function staged(transport, named, file) {
|
|
73
|
+
const upload = houseUpload(named);
|
|
74
|
+
if (upload === null)
|
|
75
|
+
return unusable();
|
|
76
|
+
const blob = file(record(named).sha256);
|
|
77
|
+
if (blob === null)
|
|
78
|
+
return unusable();
|
|
79
|
+
const sent = await finishedUpload(transport, upload, await blob);
|
|
80
|
+
if ('unfinished' in sent)
|
|
81
|
+
return answeredFailure(sent.unfinished, null);
|
|
82
|
+
if (sent.status !== 200)
|
|
83
|
+
return answeredFailure(sent.status, sent.body);
|
|
84
|
+
return record(sent.body).staged === true ? null : unusable();
|
|
85
|
+
}
|
|
86
|
+
export async function stagedBatch(transport, body, file) {
|
|
87
|
+
let answer = await transport.door(houseDoorRoute('update'), body);
|
|
88
|
+
const finished = new Set();
|
|
89
|
+
for (let unstaged = unstagedRefusal(answer); unstaged !== null; unstaged = unstagedRefusal(answer)) {
|
|
90
|
+
const named = unstaged.fields.upload;
|
|
91
|
+
if (!Array.isArray(named))
|
|
92
|
+
return unusable();
|
|
93
|
+
const fresh = named.filter((upload) => !finished.has(record(upload).id));
|
|
94
|
+
if (fresh.length === 0)
|
|
95
|
+
return answeredFailure(answer.status, answer.body);
|
|
96
|
+
for (const upload of fresh) {
|
|
97
|
+
const staging = await staged(transport, upload, file);
|
|
98
|
+
if (staging !== null)
|
|
99
|
+
return staging;
|
|
100
|
+
}
|
|
101
|
+
for (const upload of fresh)
|
|
102
|
+
finished.add(record(upload).id);
|
|
103
|
+
answer = await transport.door(houseDoorRoute('update'), body);
|
|
104
|
+
}
|
|
105
|
+
return answer;
|
|
106
|
+
}
|
package/dist/write.d.ts
CHANGED
|
@@ -17,11 +17,10 @@ export declare function houseParts(saved: readonly {
|
|
|
17
17
|
export declare function houseMove(batch: ChangeBatch, source: string, destination: string): ChangeMapping;
|
|
18
18
|
export type OperationHead = {
|
|
19
19
|
readonly operation_id: string;
|
|
20
|
-
readonly room_ref: string;
|
|
21
20
|
readonly app_ref?: string;
|
|
22
21
|
readonly release?: string;
|
|
23
22
|
};
|
|
24
|
-
export declare function operationHead(batch: ChangeBatch
|
|
23
|
+
export declare function operationHead(batch: ChangeBatch): OperationHead;
|
|
25
24
|
export declare function batchPaths(changes: readonly HouseOperation[]): readonly string[];
|
|
26
25
|
export declare function deltaBody(changes: readonly HouseOperation[]): string;
|
|
27
26
|
export declare function deltaBytes(delta: string): number;
|
package/dist/write.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAElB,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQlD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAA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QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACzE,QAAQ,CAAC,WAAW,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/E,CAAC;AAkCF,wBAAiB,eAAe,CAC9B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,eAAe,GACrB,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,CAAC,CAoDzC;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;IAEjF,IAAI,EAAE,UAAU;IAChB,QAAQ;IACR,IAAI;IACJ,MAAM;QAAI,IAAI;;IACd,SAAS;EAEZ;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM1B;AA6BD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7B,aAAa,CA8Cf"}
|
package/dist/write.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { departure, partsChanges, ROW_WEIGHT, } from '@agentshouse/mdruntime';
|
|
2
|
-
import { answered, answering,
|
|
2
|
+
import { answered, answering, attachmentOf, headChange, revised } from './read.js';
|
|
3
3
|
import { sha256Hex, textBytes } from './digest.js';
|
|
4
4
|
import { nativePath, roomLocalPath } from './map.js';
|
|
5
5
|
import { answeredFailure, classifyDoor, doorRefusal, resetOf, scopedRefusal } from './refusal.js';
|
|
@@ -142,9 +142,9 @@ export function houseMove(batch, source, destination) {
|
|
|
142
142
|
}
|
|
143
143
|
return { kind: 'changes', changes };
|
|
144
144
|
}
|
|
145
|
-
export function operationHead(batch
|
|
145
|
+
export function operationHead(batch) {
|
|
146
146
|
const writer = batch.writtenBy;
|
|
147
|
-
const head = { operation_id: batch.id
|
|
147
|
+
const head = { operation_id: batch.id };
|
|
148
148
|
return writer === undefined ? head : { ...head, app_ref: writer.app, release: writer.release };
|
|
149
149
|
}
|
|
150
150
|
export function batchPaths(changes) {
|
|
@@ -182,7 +182,7 @@ function* material(value, handle, within = () => true) {
|
|
|
182
182
|
return null;
|
|
183
183
|
if (file.revision !== null && file.revision !== undefined && typeof file.revision !== 'string')
|
|
184
184
|
return null;
|
|
185
|
-
const binary =
|
|
185
|
+
const binary = attachmentOf(file);
|
|
186
186
|
if (binary === null)
|
|
187
187
|
return null;
|
|
188
188
|
const head = headChange(file);
|
|
@@ -225,14 +225,14 @@ function* acceptedOf(at, contents) {
|
|
|
225
225
|
if (entry.content !== null)
|
|
226
226
|
answer.documents.set(entry.path, entry.content);
|
|
227
227
|
if (entry.binary !== undefined)
|
|
228
|
-
answer.
|
|
228
|
+
answer.attachments.set(entry.path, entry.binary);
|
|
229
229
|
revised(answer, entry.path, entry.revision);
|
|
230
230
|
if (entry.head !== undefined)
|
|
231
231
|
answer.changes.set(entry.path, entry.head);
|
|
232
232
|
}
|
|
233
|
-
const unbinaried = answer.
|
|
234
|
-
const {
|
|
235
|
-
return { roomVersion: roomVersion(at), ...room, ...(unbinaried ? {} : {
|
|
233
|
+
const unbinaried = answer.attachments.size === 0;
|
|
234
|
+
const { attachments, facts: _facts, ...room } = yield* answered(answer);
|
|
235
|
+
return { roomVersion: roomVersion(at), ...room, ...(unbinaried ? {} : { attachments }) };
|
|
236
236
|
}
|
|
237
237
|
function* movedOutcome(held, move) {
|
|
238
238
|
const authorities = Array.isArray(held.authorities) ? held.authorities : [];
|
|
@@ -391,14 +391,14 @@ export function historyOutcome(status, body, locator, request) {
|
|
|
391
391
|
typeof entry.created_at !== 'string') {
|
|
392
392
|
return unusable();
|
|
393
393
|
}
|
|
394
|
-
const
|
|
395
|
-
if (
|
|
394
|
+
const attachment = attachmentOf(entry);
|
|
395
|
+
if (attachment === null)
|
|
396
396
|
return unusable();
|
|
397
397
|
revisions.push({
|
|
398
398
|
revision: entry.revision,
|
|
399
399
|
author,
|
|
400
400
|
time: entry.created_at,
|
|
401
|
-
...(
|
|
401
|
+
...(attachment === undefined ? {} : { attachment }),
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
404
|
const next = held.next_before;
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdruntime-adapter",
|
|
3
|
-
"version": "0.1.0-c2631f0a4ed22",
|
|
4
3
|
"description": "Agents House Adapter for the MD Runtime",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"type": "module",
|
|
@@ -24,12 +23,13 @@
|
|
|
24
23
|
"LICENSE"
|
|
25
24
|
],
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"@agentshouse/mdmodel": "0.1.0-
|
|
28
|
-
"@agentshouse/mdruntime": "0.1.0-
|
|
26
|
+
"@agentshouse/mdmodel": "0.1.0-c8dc381490458",
|
|
27
|
+
"@agentshouse/mdruntime": "0.1.0-c5cbd3b86063f"
|
|
29
28
|
},
|
|
30
29
|
"repository": {
|
|
31
30
|
"type": "git",
|
|
32
31
|
"url": "git+https://github.com/agentshouse/core.git",
|
|
33
32
|
"directory": "mdruntime/packages/mdruntime-adapter"
|
|
34
|
-
}
|
|
33
|
+
},
|
|
34
|
+
"version": "0.1.0-c26778ef7ace3"
|
|
35
35
|
}
|