@agentshouse/mdruntime-adapter 0.1.0-c2631f0a4ed22 → 0.1.0-c26b02f4792bb
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 +4 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +47 -2
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +40 -55
- package/dist/authored-path.d.ts +0 -4
- package/dist/authored-path.d.ts.map +1 -1
- package/dist/authored-path.js +3 -1
- package/dist/chunks.js +1 -1
- package/dist/discovery.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- 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 +20 -0
- package/dist/room-query.d.ts.map +1 -1
- package/dist/room-query.js +24 -9
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +11 -3
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +3 -0
- package/dist/transport.d.ts +10 -2
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +7 -8
- 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,10 @@ 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>;
|
|
8
|
+
export declare const HOUSE_RENAMED_UNTIL_2026_12_21: ReadonlyMap<string, string>;
|
|
9
|
+
export declare const HOUSE_REWRITTEN_UNTIL_2026_12_21: ReadonlyMap<string, (input: unknown) => unknown>;
|
|
6
10
|
export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
|
|
7
11
|
export declare function houseAction(transport: HouseActDoor, request: ActionRequest): Promise<ActionResult>;
|
|
8
12
|
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,EAKhD,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;AAExC,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAGrE,CAAC;AAiBH,eAAO,MAAM,gCAAgC,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAI1F,CAAC;AAQL,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,iBAAiB,EAAE,CAOvF;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',
|
|
@@ -6,12 +7,51 @@ export const HOUSE_UNKEPT_READS = [
|
|
|
6
7
|
'clients/last-use/list',
|
|
7
8
|
];
|
|
8
9
|
export const HOUSE_LEADING_READS = [
|
|
10
|
+
'app.list',
|
|
9
11
|
'apps/list',
|
|
10
12
|
'sites/list',
|
|
11
13
|
'rooms/members/list',
|
|
12
14
|
];
|
|
15
|
+
export const HOUSE_RENAMED_UNTIL_2026_12_18 = new Map([
|
|
16
|
+
['files/batch', 'update'],
|
|
17
|
+
]);
|
|
18
|
+
function withoutRoomRef(input) {
|
|
19
|
+
if (typeof input !== 'object' || input === null || !('room_ref' in input))
|
|
20
|
+
return input;
|
|
21
|
+
const { room_ref: _room, ...paths } = input;
|
|
22
|
+
return paths;
|
|
23
|
+
}
|
|
24
|
+
export const HOUSE_REWRITTEN_UNTIL_2026_12_19 = new Map([['update', withoutRoomRef]]);
|
|
25
|
+
export const HOUSE_RENAMED_UNTIL_2026_12_21 = new Map([
|
|
26
|
+
['apps/create', 'app_update'],
|
|
27
|
+
['apps/upload', 'app_update'],
|
|
28
|
+
]);
|
|
29
|
+
function held(input) {
|
|
30
|
+
return typeof input === 'object' && input !== null
|
|
31
|
+
? { ...input }
|
|
32
|
+
: {};
|
|
33
|
+
}
|
|
34
|
+
function created(input) {
|
|
35
|
+
return { op: 'create', ...held(input) };
|
|
36
|
+
}
|
|
37
|
+
function uploaded(input) {
|
|
38
|
+
const { app_ref: app, ...files } = held(input);
|
|
39
|
+
return { op: 'publish', app, ...files };
|
|
40
|
+
}
|
|
41
|
+
export const HOUSE_REWRITTEN_UNTIL_2026_12_21 = new Map([
|
|
42
|
+
['apps/create', created],
|
|
43
|
+
['apps/upload', uploaded],
|
|
44
|
+
]);
|
|
45
|
+
const ROOM_SELECTORS = new Map([
|
|
46
|
+
['update', { room: 'changes.room', roomPaths: ['changes.path', 'changes.to', 'paths', 'mount'] }],
|
|
47
|
+
]);
|
|
13
48
|
export function declaredActions(routes) {
|
|
14
|
-
return routes.map((name) => ({
|
|
49
|
+
return routes.map((name) => ({
|
|
50
|
+
name,
|
|
51
|
+
inputShape: {},
|
|
52
|
+
resultKind: 'house',
|
|
53
|
+
...(ROOM_SELECTORS.get(name) ?? { room: 'room_ref' }),
|
|
54
|
+
}));
|
|
15
55
|
}
|
|
16
56
|
export function houseAction(transport, request) {
|
|
17
57
|
const route = routeOf(request.name);
|
|
@@ -57,5 +97,10 @@ export function actionOutcome(answer, name, input) {
|
|
|
57
97
|
return { kind: 'action', result: answer.body };
|
|
58
98
|
}
|
|
59
99
|
async function carry(transport, route, name, input) {
|
|
60
|
-
|
|
100
|
+
const answered = actionOutcome(await transport.door(route, input), name, input);
|
|
101
|
+
const renamed = renamedHandle(answered);
|
|
102
|
+
if (renamed === null)
|
|
103
|
+
return answered;
|
|
104
|
+
const moved = movedPaths(input, ROOM_SELECTORS.get(name)?.roomPaths ?? [], renamed);
|
|
105
|
+
return actionOutcome(await transport.door(route, moved), name, moved);
|
|
61
106
|
}
|
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;AAkChC,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,CA2cpF"}
|
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_RENAMED_UNTIL_2026_12_21, HOUSE_REWRITTEN_UNTIL_2026_12_19, HOUSE_REWRITTEN_UNTIL_2026_12_21, 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,11 @@ export function createAgentsHouseAdapter(options) {
|
|
|
324
313
|
pathRule: admittedPath,
|
|
325
314
|
unkeptReads: HOUSE_UNKEPT_READS,
|
|
326
315
|
leadingReads: HOUSE_LEADING_READS,
|
|
316
|
+
renamedActions: new Map([...HOUSE_RENAMED_UNTIL_2026_12_18, ...HOUSE_RENAMED_UNTIL_2026_12_21]),
|
|
317
|
+
rewrittenInputs: new Map([
|
|
318
|
+
...HOUSE_REWRITTEN_UNTIL_2026_12_19,
|
|
319
|
+
...HOUSE_REWRITTEN_UNTIL_2026_12_21,
|
|
320
|
+
]),
|
|
327
321
|
async authorize() {
|
|
328
322
|
return options.authorize();
|
|
329
323
|
},
|
|
@@ -339,26 +333,17 @@ export function createAgentsHouseAdapter(options) {
|
|
|
339
333
|
const entry = authorityFor(request.locator);
|
|
340
334
|
if (entry === undefined)
|
|
341
335
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
342
|
-
const
|
|
343
|
-
const destination = batch.between?.destination.room;
|
|
336
|
+
const destination = request.changeBatch.between?.destination.room;
|
|
344
337
|
const into = destination === undefined ? undefined : authorityFor(destination);
|
|
345
338
|
if (destination !== undefined && into === undefined) {
|
|
346
339
|
return { kind: 'room-not-readable', locator: destination };
|
|
347
340
|
}
|
|
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))
|
|
341
|
+
const outcome = await mutated(request, keep, entry, into);
|
|
342
|
+
const renamed = renamedHandle(outcome);
|
|
343
|
+
if (renamed === null)
|
|
360
344
|
return outcome;
|
|
361
|
-
|
|
345
|
+
const moved = (held) => held.handle === renamed.from ? { ...held, handle: renamed.to } : held;
|
|
346
|
+
return mutated(request, keep, moved(entry), into === undefined ? undefined : moved(into));
|
|
362
347
|
},
|
|
363
348
|
async history(_authorization, request) {
|
|
364
349
|
const entry = authorityFor(request.locator);
|
package/dist/authored-path.d.ts
CHANGED
|
@@ -58,8 +58,4 @@ export declare function nameRefusal(name: string): NameRefusal | null;
|
|
|
58
58
|
export declare function pathRefusal(path: string): PathRefusal | null;
|
|
59
59
|
export declare function admittedPath(path: string): boolean;
|
|
60
60
|
export declare function sameName(left: string, right: string): boolean;
|
|
61
|
-
export declare function nameParts(name: string): {
|
|
62
|
-
readonly stem: string;
|
|
63
|
-
readonly extension: string;
|
|
64
|
-
};
|
|
65
61
|
export declare function fittedName(name: string, count?: number, tail?: string): string;
|
|
@@ -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;
|
|
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;AAI5C,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAKlD,CAAC;AAEF,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAI3C,eAAO,MAAM,kBAAkB;aAC7B,iBAAiB,EAAE,YAAY;aAC/B,iBAAiB,EAAE,IAAI;aACvB,WAAW,EAAE,IAAI;aACjB,YAAY,EAAE,GAAG;aACjB,QAAQ,YAAG,MAAM,EAAE,OAAO;aAC1B,YAAY;aAUZ,cAAc;aACd,YAAY;aACZ,YAA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C,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;AAyCD,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
|
+
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;
|
|
@@ -138,7 +140,7 @@ function trimmedStart(text) {
|
|
|
138
140
|
start += 1;
|
|
139
141
|
return text.slice(start);
|
|
140
142
|
}
|
|
141
|
-
|
|
143
|
+
function nameParts(name) {
|
|
142
144
|
const dot = name.lastIndexOf('.');
|
|
143
145
|
return dot <= 0
|
|
144
146
|
? { stem: name, extension: '' }
|
package/dist/chunks.js
CHANGED
package/dist/discovery.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { declaredActions } from './actions.js';
|
|
2
|
-
import { SITE_DOOR_ACTS } from './transport.js';
|
|
2
|
+
import { SITE_DOOR_ACTS, SITE_DOOR_TOOL } from './transport.js';
|
|
3
3
|
import { readPosition, roomVersion } from './version.js';
|
|
4
4
|
export const PROVIDER_ACTIONS = 'provider-actions';
|
|
5
5
|
const BOUND_KEYS = [
|
|
@@ -412,7 +412,7 @@ export function siteCapabilities() {
|
|
|
412
412
|
return [
|
|
413
413
|
{
|
|
414
414
|
name: PROVIDER_ACTIONS,
|
|
415
|
-
actions: Object.keys(SITE_DOOR_ACTS).map((name) => ({
|
|
415
|
+
actions: [...Object.keys(SITE_DOOR_ACTS), SITE_DOOR_TOOL].map((name) => ({
|
|
416
416
|
name,
|
|
417
417
|
inputShape: {},
|
|
418
418
|
resultKind: 'house',
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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';
|
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,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
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';
|
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, roomPaths: readonly string[], 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;AAOD,wBAAgB,UAAU,CACxB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,OAAO,EAAE,OAAO,GACf,OAAO,CAKT"}
|
package/dist/renamed.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { selectorRewritten } from '@agentshouse/mdruntime';
|
|
2
|
+
const ROOM_ROOT = /^\/rooms\/([^/]+)(?=\/|$)/u;
|
|
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 (typeof value !== 'string' || roomOfPath(value) !== renamed.from)
|
|
15
|
+
return value;
|
|
16
|
+
return `/rooms/${renamed.to}${value.slice(`/rooms/${renamed.from}`.length)}`;
|
|
17
|
+
}
|
|
18
|
+
export function movedPaths(value, roomPaths, renamed) {
|
|
19
|
+
return roomPaths.reduce((moved, selector) => selectorRewritten(moved, selector, (one) => movedPath(one, renamed)), value);
|
|
20
|
+
}
|
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;AAwBxB,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,41 @@ 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
|
+
const follows = request.follows === undefined ? {} : { follows: request.follows };
|
|
12
|
+
if (!('query' in request)) {
|
|
13
|
+
const { path, after } = request;
|
|
14
|
+
return {
|
|
15
|
+
path: `${root}/${path}`,
|
|
16
|
+
...(after === undefined ? {} : { cursor: after }),
|
|
17
|
+
...follows,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const { after, ...query } = request.query;
|
|
21
|
+
return { path: root, query, ...(after === undefined ? {} : { cursor: after }), ...follows };
|
|
22
|
+
}
|
|
9
23
|
export async function houseQuery(transport, request) {
|
|
10
|
-
return queriedPage(await transport.door(houseDoorRoute('
|
|
11
|
-
room_ref: request.room,
|
|
12
|
-
query: request.query,
|
|
13
|
-
}));
|
|
24
|
+
return queriedPage(await transport.door(houseDoorRoute('info'), infoAsked(request)), 'next_cursor');
|
|
14
25
|
}
|
|
15
26
|
export async function siteQuery(transport, request) {
|
|
16
|
-
const
|
|
27
|
+
const asked = 'query' in request
|
|
28
|
+
? request.query
|
|
29
|
+
: { path: request.path, ...(request.after === undefined ? {} : { after: request.after }) };
|
|
30
|
+
const route = siteQueryRoute(request.room, asked, request.fresh);
|
|
17
31
|
if (route.length > SITE_QUERY_ROUTE_CHARACTERS)
|
|
18
32
|
return TOO_LONG_FOR_AN_ADDRESS;
|
|
19
|
-
return queriedPage(await transport.read(route));
|
|
33
|
+
return queriedPage(await transport.read(route), 'next');
|
|
20
34
|
}
|
|
21
|
-
function queriedPage(answer) {
|
|
35
|
+
function queriedPage(answer, named) {
|
|
22
36
|
if (answer.status === 401)
|
|
23
37
|
return { kind: 'revoked-authorization' };
|
|
24
38
|
const refusal = doorRefusal(answer.body);
|
|
25
39
|
if (refusal !== null)
|
|
26
40
|
return { kind: 'rejected', ...refusal };
|
|
27
|
-
const
|
|
28
|
-
|
|
41
|
+
const body = (answer.body ?? {});
|
|
42
|
+
const { documents, groups, total, totalCapped, capped } = body;
|
|
43
|
+
const next = body[named];
|
|
29
44
|
if (answer.status !== 200 || !(Array.isArray(documents) || Array.isArray(groups))) {
|
|
30
45
|
return answeredFailure(answer.status, answer.body);
|
|
31
46
|
}
|
package/dist/site.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,OAAO,EASR,MAAM,wBAAwB,CAAC;AAchC,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAuCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CA2K1F"}
|
package/dist/site.js
CHANGED
|
@@ -6,9 +6,16 @@ import { answeredFailure, discoveryFailure } from './refusal.js';
|
|
|
6
6
|
import { admittedPath } from './authored-path.js';
|
|
7
7
|
import { siteQuery } from './room-query.js';
|
|
8
8
|
import { houseNotifications } from './stream.js';
|
|
9
|
-
import { houseSiteRoute, SITE_DOOR_ACTS, SITE_FILES, } from './transport.js';
|
|
9
|
+
import { houseSiteRoute, SITE_DOOR_ACTS, SITE_DOOR_TOOL, SITE_FILES, } from './transport.js';
|
|
10
10
|
import { UNANSWERED, unusable } from './uncertain.js';
|
|
11
11
|
import { followsVersion, reachedVersion, roomVersion } from './version.js';
|
|
12
|
+
function siteDoorRequest(request) {
|
|
13
|
+
const { op, ...input } = (request.input ?? {});
|
|
14
|
+
if (request.name !== SITE_DOOR_TOOL || typeof op !== 'string')
|
|
15
|
+
return request;
|
|
16
|
+
const named = Object.entries(SITE_DOOR_ACTS).find(([, act]) => act.op === op);
|
|
17
|
+
return named === undefined ? request : { ...request, name: named[0], input };
|
|
18
|
+
}
|
|
12
19
|
function unfound() {
|
|
13
20
|
return { kind: 'rejected', code: 'not_found', fields: {}, retryable: false };
|
|
14
21
|
}
|
|
@@ -169,9 +176,10 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
169
176
|
follows(_locator, version, next) {
|
|
170
177
|
return followsVersion(version, next);
|
|
171
178
|
},
|
|
172
|
-
async action(_authorization,
|
|
179
|
+
async action(_authorization, asked) {
|
|
180
|
+
const request = siteDoorRequest(asked);
|
|
173
181
|
const route = Object.hasOwn(SITE_DOOR_ACTS, request.name)
|
|
174
|
-
? SITE_DOOR_ACTS[request.name]
|
|
182
|
+
? SITE_DOOR_ACTS[request.name].route
|
|
175
183
|
: null;
|
|
176
184
|
if (route === null) {
|
|
177
185
|
return {
|
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,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AAM,IAAI,CAAC;IAC9D,IAAI,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,IAAI,CAAC;IACvC,KAAK,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtD,aAAa,EAAE,kBAAkB,CAAC;IAClC,WAAW,EAAE,iBAAiB,CAAC;CAChC,CAAC;AA2FF,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,SAAS,EACf,WAAW,EAAE,gBAAgB,GAC5B,kBAAkB,CA6XpB"}
|
package/dist/stream.js
CHANGED
|
@@ -37,6 +37,9 @@ function listedConversation(listed) {
|
|
|
37
37
|
newest: listed.newest === null ? null : changeCursor(listed.newest),
|
|
38
38
|
processEnded: listed.process_ended_at,
|
|
39
39
|
subject: listed.subject,
|
|
40
|
+
room: listed.room_ref,
|
|
41
|
+
model: listed.model,
|
|
42
|
+
effort: listed.effort,
|
|
40
43
|
};
|
|
41
44
|
}
|
|
42
45
|
function position(value) {
|
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', '
|
|
4
|
+
readonly acts: readonly ['account/push/set', 'account/time-zone/set', 'app.screenshot', 'app.source', 'apps/features/set', 'conversations/history/list', 'files/attach', 'files/finish', 'files/read', 'files/revisions/list', 'info', 'room-chunks/list', 'rooms/discover', 'rooms/search', '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];
|
|
@@ -17,7 +17,12 @@ export declare const SITES_SUBMISSIONS_CREATE = "sites/submissions/create";
|
|
|
17
17
|
export declare const SITE_DOOR_SUBMIT = "/_house/door/submit";
|
|
18
18
|
export declare const SITES_FUNCTIONS_CALL = "sites/functions/call";
|
|
19
19
|
export declare const SITE_DOOR_FUNCTION = "/_house/door/function";
|
|
20
|
-
|
|
20
|
+
interface SiteDoorAct {
|
|
21
|
+
readonly op: string;
|
|
22
|
+
readonly route: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const SITE_DOOR_ACTS: Readonly<Record<string, SiteDoorAct>>;
|
|
25
|
+
export declare const SITE_DOOR_TOOL = "app_update";
|
|
21
26
|
export type HouseMode = 'credential' | 'site';
|
|
22
27
|
export type HouseDoorAnswer = {
|
|
23
28
|
status: number;
|
|
@@ -79,6 +84,9 @@ export type HouseListedConversation = {
|
|
|
79
84
|
newest: number | null;
|
|
80
85
|
process_ended_at: string | null;
|
|
81
86
|
subject: string | null;
|
|
87
|
+
room_ref: string | null;
|
|
88
|
+
model: string | null;
|
|
89
|
+
effort: string | null;
|
|
82
90
|
};
|
|
83
91
|
type Listed<Frame extends {
|
|
84
92
|
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,
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../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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
|
@@ -3,21 +3,19 @@ export const HOUSE_RUNTIME_READS = {
|
|
|
3
3
|
acts: [
|
|
4
4
|
'account/push/set',
|
|
5
5
|
'account/time-zone/set',
|
|
6
|
+
'app.screenshot',
|
|
7
|
+
'app.source',
|
|
6
8
|
'apps/features/set',
|
|
7
|
-
'apps/source/download',
|
|
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
|
+
'update',
|
|
21
19
|
],
|
|
22
20
|
frames: [
|
|
23
21
|
'agent',
|
|
@@ -86,8 +84,9 @@ export const SITE_DOOR_SUBMIT = '/_house/door/submit';
|
|
|
86
84
|
export const SITES_FUNCTIONS_CALL = 'sites/functions/call';
|
|
87
85
|
export const SITE_DOOR_FUNCTION = '/_house/door/function';
|
|
88
86
|
export const SITE_DOOR_ACTS = {
|
|
89
|
-
[SITES_SUBMISSIONS_CREATE]: SITE_DOOR_SUBMIT,
|
|
90
|
-
[SITES_FUNCTIONS_CALL]: SITE_DOOR_FUNCTION,
|
|
87
|
+
[SITES_SUBMISSIONS_CREATE]: { op: 'submission_create', route: SITE_DOOR_SUBMIT },
|
|
88
|
+
[SITES_FUNCTIONS_CALL]: { op: 'function_call', route: SITE_DOOR_FUNCTION },
|
|
91
89
|
};
|
|
90
|
+
export const SITE_DOOR_TOOL = 'app_update';
|
|
92
91
|
export const SITE_FILES = '/_house/files/';
|
|
93
92
|
export const SITE_IMAGE_COPIES_HEADER = 'X-House-Image-Copies';
|
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,OAAO,CAAC,CAAC,CAAC;AAE/D,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAwHrD,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAQ9E;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,EAAE,EACpE,MAAM,EAAE,MAAM,GACb,aAAa,CAEf;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,aAAa,CAgBhG;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mapp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,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-cffab849d904b",
|
|
27
|
+
"@agentshouse/mdruntime": "0.1.0-ca3e1879aff32"
|
|
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-c26b02f4792bb"
|
|
35
35
|
}
|