@agentshouse/mdruntime-adapter 0.1.0-cf151c882c69c → 0.1.0-cf1e9b409cb0c
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 -4
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +21 -30
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +5 -7
- 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 +2 -2
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +3 -3
- package/dist/renamed.d.ts +1 -1
- package/dist/renamed.d.ts.map +1 -1
- package/dist/renamed.js +3 -12
- package/dist/session-content/check.d.ts +4 -1
- package/dist/session-content/index.d.ts +1 -1
- package/dist/session-content/parts.d.ts +5 -5
- package/dist/session-content/state.d.ts +16 -21
- package/dist/session-content/turn.d.ts +53 -43
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +3 -3
- package/dist/stream.d.ts +2 -1
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +69 -3
- package/dist/transport.d.ts +30 -7
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +7 -9
- package/dist/write.d.ts +2 -6
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +59 -77
- package/package.json +3 -3
package/dist/actions.d.ts
CHANGED
|
@@ -3,10 +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
|
|
7
|
-
export declare const
|
|
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
|
+
export declare const HOUSE_RENAMED_UNTIL_2026_12_27: ReadonlyMap<string, string>;
|
|
7
|
+
export declare const HOUSE_REWRITTEN_UNTIL_2026_12_27: ReadonlyMap<string, (input: unknown) => unknown>;
|
|
10
8
|
export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
|
|
11
9
|
export declare function houseAction(transport: HouseActDoor, request: ActionRequest): Promise<ActionResult>;
|
|
12
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;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,
|
|
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,EAMhD,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAGrE,CAAC;AAQH,eAAO,MAAM,gCAAgC,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAI1F,CAAC;AAcL,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
|
@@ -2,48 +2,39 @@ import { answeredFailure, doorRefusal, resetOf } from './refusal.js';
|
|
|
2
2
|
import { movedPaths, renamedHandle } from './renamed.js';
|
|
3
3
|
import { refusedFor } from './uncertain.js';
|
|
4
4
|
export const HOUSE_UNKEPT_READS = [
|
|
5
|
-
'account
|
|
6
|
-
'billing
|
|
7
|
-
'clients
|
|
5
|
+
'account.read security',
|
|
6
|
+
'account.billing',
|
|
7
|
+
'account.clients',
|
|
8
8
|
];
|
|
9
9
|
export const HOUSE_LEADING_READS = [
|
|
10
10
|
'app.list',
|
|
11
11
|
'apps/list',
|
|
12
12
|
'sites/list',
|
|
13
13
|
'rooms/members/list',
|
|
14
|
+
'sharing.members',
|
|
14
15
|
];
|
|
15
|
-
export const
|
|
16
|
-
['
|
|
16
|
+
export const HOUSE_RENAMED_UNTIL_2026_12_27 = new Map([
|
|
17
|
+
['sharing_update.join_request_approve', 'sharing_update.ask_to_join_approve'],
|
|
18
|
+
['sharing_update.join_request_decline', 'sharing_update.ask_to_join_decline'],
|
|
17
19
|
]);
|
|
18
|
-
function
|
|
19
|
-
if (typeof input !== 'object' || input === null || !('
|
|
20
|
+
function askToJoinInput(input) {
|
|
21
|
+
if (typeof input !== 'object' || input === null || !('join_request' in input))
|
|
20
22
|
return input;
|
|
21
|
-
const {
|
|
22
|
-
return
|
|
23
|
+
const { join_request: asked, ...rest } = input;
|
|
24
|
+
return { ...rest, ask_to_join: asked };
|
|
23
25
|
}
|
|
24
|
-
export const
|
|
25
|
-
|
|
26
|
-
['
|
|
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],
|
|
26
|
+
export const HOUSE_REWRITTEN_UNTIL_2026_12_27 = new Map([
|
|
27
|
+
['sharing_update.join_request_approve', askToJoinInput],
|
|
28
|
+
['sharing_update.join_request_decline', askToJoinInput],
|
|
44
29
|
]);
|
|
45
30
|
const ROOM_SELECTORS = new Map([
|
|
46
31
|
['update', { room: 'changes.room', roomPaths: ['changes.path', 'changes.to', 'paths', 'mount'] }],
|
|
32
|
+
['sharing', { room: 'room' }],
|
|
33
|
+
['sharing_update', { room: 'room' }],
|
|
34
|
+
['inbox_update', { room: 'room', roomPaths: ['path'] }],
|
|
35
|
+
['agent', { room: 'room' }],
|
|
36
|
+
['agent_update', { room: 'room' }],
|
|
37
|
+
['environment', { room: 'room' }],
|
|
47
38
|
]);
|
|
48
39
|
export function declaredActions(routes) {
|
|
49
40
|
return routes.map((name) => ({
|
|
@@ -101,6 +92,6 @@ async function carry(transport, route, name, input) {
|
|
|
101
92
|
const renamed = renamedHandle(answered);
|
|
102
93
|
if (renamed === null)
|
|
103
94
|
return answered;
|
|
104
|
-
const moved = movedPaths(input, renamed);
|
|
95
|
+
const moved = movedPaths(input, ROOM_SELECTORS.get(name)?.roomPaths ?? [], renamed);
|
|
105
96
|
return actionOutcome(await transport.door(route, moved), name, moved);
|
|
106
97
|
}
|
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,EAkBd,MAAM,wBAAwB,CAAC;
|
|
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,CA4cpF"}
|
package/dist/adapter.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createSiteAdapter } from './site.js';
|
|
|
5
5
|
import { parseFileAddress, parseGrant } from './read.js';
|
|
6
6
|
import { chunkedHead, chunkLister, chunkPart } from './chunks.js';
|
|
7
7
|
import { finishedUpload, houseUpload, stagedBatch } from './upload.js';
|
|
8
|
-
import { houseAction, HOUSE_LEADING_READS,
|
|
8
|
+
import { houseAction, HOUSE_LEADING_READS, HOUSE_RENAMED_UNTIL_2026_12_27, HOUSE_REWRITTEN_UNTIL_2026_12_27, HOUSE_UNKEPT_READS, } from './actions.js';
|
|
9
9
|
import { houseQuery } from './room-query.js';
|
|
10
10
|
import { houseSearch } from './search.js';
|
|
11
11
|
import { answeredFailure, classifyDoor, keyedFailure } from './refusal.js';
|
|
@@ -202,7 +202,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
202
202
|
async function mutated(request, keep, entry, into) {
|
|
203
203
|
const batch = request.changeBatch;
|
|
204
204
|
const mapped = into === undefined
|
|
205
|
-
? houseChanges(batch, entry.handle)
|
|
205
|
+
? houseChanges(batch, entry.handle, request.written)
|
|
206
206
|
: houseMove(batch, entry.handle, into.handle);
|
|
207
207
|
if (mapped.kind === 'unmapped')
|
|
208
208
|
return rejectedMapping(mapped);
|
|
@@ -313,11 +313,8 @@ export function createAgentsHouseAdapter(options) {
|
|
|
313
313
|
pathRule: admittedPath,
|
|
314
314
|
unkeptReads: HOUSE_UNKEPT_READS,
|
|
315
315
|
leadingReads: HOUSE_LEADING_READS,
|
|
316
|
-
renamedActions:
|
|
317
|
-
rewrittenInputs:
|
|
318
|
-
...HOUSE_REWRITTEN_UNTIL_2026_12_19,
|
|
319
|
-
...HOUSE_REWRITTEN_UNTIL_2026_12_21,
|
|
320
|
-
]),
|
|
316
|
+
renamedActions: HOUSE_RENAMED_UNTIL_2026_12_27,
|
|
317
|
+
rewrittenInputs: HOUSE_REWRITTEN_UNTIL_2026_12_27,
|
|
321
318
|
async authorize() {
|
|
322
319
|
return options.authorize();
|
|
323
320
|
},
|
|
@@ -400,6 +397,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
400
397
|
observe: notifications.observe,
|
|
401
398
|
},
|
|
402
399
|
conversations: notifications.conversations,
|
|
400
|
+
runs: notifications.runs,
|
|
403
401
|
serviceMode: notifications.serviceMode,
|
|
404
402
|
};
|
|
405
403
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ 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
|
-
export {
|
|
8
|
+
export { houseChanges, type ChangeMapping } from './write.js';
|
|
9
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';
|
|
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,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,e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,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
|
@@ -5,6 +5,6 @@ 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
|
-
export {
|
|
8
|
+
export { houseChanges } from './write.js';
|
|
9
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';
|
|
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
|
|
1
|
+
import { type AttachmentCopy, 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];
|
|
@@ -60,7 +60,7 @@ export type HouseFileAddress = {
|
|
|
60
60
|
name: string;
|
|
61
61
|
sha256: string;
|
|
62
62
|
mediaType: string;
|
|
63
|
-
copies: readonly
|
|
63
|
+
copies: readonly AttachmentCopy[];
|
|
64
64
|
};
|
|
65
65
|
export declare function authorityRoot(handle: string): string;
|
|
66
66
|
export declare function schemaPath(handle: string, schema: string): string;
|
package/dist/read.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,aAAa,EAElB,KAAK,UAAU,EAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAM1D,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;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IAAI,CAG9E"}
|
package/dist/read.js
CHANGED
|
@@ -176,7 +176,7 @@ export function attachmentOf(held) {
|
|
|
176
176
|
return null;
|
|
177
177
|
return { byteLength: bytes, mediaType, sha256, ...size };
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function withAttachment(binary) {
|
|
180
180
|
return binary === undefined ? {} : { binary };
|
|
181
181
|
}
|
|
182
182
|
function carriedFacts(held) {
|
|
@@ -207,7 +207,7 @@ export function documentEntry(value, mode) {
|
|
|
207
207
|
revision: binary?.sha256,
|
|
208
208
|
version: file.sha256,
|
|
209
209
|
...headed(head),
|
|
210
|
-
...
|
|
210
|
+
...withAttachment(binary),
|
|
211
211
|
...carriedFacts(file),
|
|
212
212
|
...content,
|
|
213
213
|
};
|
|
@@ -220,7 +220,7 @@ export function documentEntry(value, mode) {
|
|
|
220
220
|
version: file.revision,
|
|
221
221
|
...headed(head),
|
|
222
222
|
...createdHeld(created),
|
|
223
|
-
...
|
|
223
|
+
...withAttachment(binary),
|
|
224
224
|
...carriedFacts(file),
|
|
225
225
|
...carriedSpace(file),
|
|
226
226
|
...content,
|
package/dist/renamed.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export declare function renamedHandle(answer: {
|
|
|
7
7
|
readonly code?: string;
|
|
8
8
|
readonly fields?: Readonly<Record<string, unknown>>;
|
|
9
9
|
}): Renamed | null;
|
|
10
|
-
export declare function movedPaths(value: unknown, renamed: Renamed): unknown;
|
|
10
|
+
export declare function movedPaths(value: unknown, roomPaths: readonly string[], renamed: Renamed): unknown;
|
package/dist/renamed.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { selectorRewritten } from '@agentshouse/mdruntime';
|
|
1
2
|
const ROOM_ROOT = /^\/rooms\/([^/]+)(?=\/|$)/u;
|
|
2
|
-
const PATH_FIELDS = new Set(['path', 'to', 'mount', 'paths']);
|
|
3
3
|
function roomOfPath(path) {
|
|
4
4
|
return typeof path === 'string' ? (ROOM_ROOT.exec(path)?.[1] ?? null) : null;
|
|
5
5
|
}
|
|
@@ -11,19 +11,10 @@ export function renamedHandle(answer) {
|
|
|
11
11
|
return from === null || to === null || from === to ? null : { from, to };
|
|
12
12
|
}
|
|
13
13
|
function movedPath(value, renamed) {
|
|
14
|
-
if (Array.isArray(value))
|
|
15
|
-
return value.map((one) => movedPath(one, renamed));
|
|
16
14
|
if (typeof value !== 'string' || roomOfPath(value) !== renamed.from)
|
|
17
15
|
return value;
|
|
18
16
|
return `/rooms/${renamed.to}${value.slice(`/rooms/${renamed.from}`.length)}`;
|
|
19
17
|
}
|
|
20
|
-
export function movedPaths(value, renamed) {
|
|
21
|
-
|
|
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
|
-
]));
|
|
18
|
+
export function movedPaths(value, roomPaths, renamed) {
|
|
19
|
+
return roomPaths.reduce((moved, selector) => selectorRewritten(moved, selector, (one) => movedPath(one, renamed)), value);
|
|
29
20
|
}
|
|
@@ -12,6 +12,9 @@ export declare function oneOf<const V extends readonly string[]>(...values: V):
|
|
|
12
12
|
export declare function where<T>(check: Check<T>, holds: (value: T) => boolean): Check<T>;
|
|
13
13
|
export declare function nullable<T>(check: Check<T>): Check<T | null>;
|
|
14
14
|
export declare function list<T>(check: Check<T>): Check<readonly T[]>;
|
|
15
|
-
export
|
|
15
|
+
export type Optional<O extends Shape> = {
|
|
16
|
+
readonly [K in keyof O]?: Checked<O[K]>;
|
|
17
|
+
};
|
|
18
|
+
export declare function exact<const S extends Shape, const O extends Shape = Record<never, never>>(shape: S, optional?: O): Check<Shaped<S> & Optional<O>>;
|
|
16
19
|
export declare function anyOf<const C extends readonly Check<unknown>[]>(...checks: C): Check<Checked<C[number]>>;
|
|
17
20
|
export {};
|
|
@@ -3,4 +3,4 @@ export type { Counts, Part, PartOf } from './parts.js';
|
|
|
3
3
|
export { isState, standingState } from './state.js';
|
|
4
4
|
export type { SessionState, Tokens } from './state.js';
|
|
5
5
|
export { applied, isOperation, isTurn } from './turn.js';
|
|
6
|
-
export type { Operation, Turn } from './turn.js';
|
|
6
|
+
export type { ModelTokens, Operation, Turn } from './turn.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Check, type Checked } from './check.js';
|
|
2
|
-
declare const PART: Check<import("./check.js").Shaped<{
|
|
2
|
+
declare const PART: Check<(import("./check.js").Shaped<{
|
|
3
3
|
readonly type: Check<"text">;
|
|
4
4
|
readonly text: Check<string>;
|
|
5
|
-
}> | import("./check.js").Shaped<{
|
|
5
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
6
6
|
readonly commands: Check<number>;
|
|
7
7
|
readonly edited: Check<number>;
|
|
8
8
|
readonly other: Check<number>;
|
|
@@ -10,16 +10,16 @@ declare const PART: Check<import("./check.js").Shaped<{
|
|
|
10
10
|
readonly removed: Check<number>;
|
|
11
11
|
readonly failed: Check<number>;
|
|
12
12
|
readonly type: Check<"counts">;
|
|
13
|
-
}> | import("./check.js").Shaped<{
|
|
13
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
14
14
|
readonly type: Check<"image">;
|
|
15
15
|
readonly file: Check<string>;
|
|
16
16
|
readonly name: Check<string>;
|
|
17
17
|
readonly media_type: Check<string>;
|
|
18
|
-
}> | import("./check.js").Shaped<{
|
|
18
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
19
19
|
readonly type: Check<"notice">;
|
|
20
20
|
readonly kind: Check<"compaction" | "error" | "info" | "mode" | "model" | "retry" | "warning">;
|
|
21
21
|
readonly text: Check<string>;
|
|
22
|
-
}
|
|
22
|
+
}> & import("./check.js").Optional<Record<never, never>>)>;
|
|
23
23
|
export type Part = Checked<typeof PART>;
|
|
24
24
|
export type PartOf<T extends Part['type']> = Extract<Part, {
|
|
25
25
|
readonly type: T;
|
|
@@ -1,58 +1,53 @@
|
|
|
1
1
|
import { type Check, type Checked } from './check.js';
|
|
2
|
-
|
|
2
|
+
declare const TOKENS: Check<import("./check.js").Shaped<{
|
|
3
3
|
readonly input: Check<number>;
|
|
4
4
|
readonly output: Check<number>;
|
|
5
5
|
readonly cache_read: Check<number>;
|
|
6
6
|
readonly cache_write: Check<number>;
|
|
7
|
-
}
|
|
7
|
+
}> & import("./check.js").Optional<Record<never, never>>>;
|
|
8
8
|
export type Tokens = Checked<typeof TOKENS>;
|
|
9
9
|
declare const STATE: Check<import("./check.js").Shaped<{
|
|
10
|
-
readonly
|
|
11
|
-
readonly context: Check<import("./check.js").Shaped<{
|
|
10
|
+
readonly context: Check<(import("./check.js").Shaped<{
|
|
12
11
|
readonly used: Check<number>;
|
|
13
12
|
readonly window: Check<number>;
|
|
14
|
-
readonly breakdown: Check<readonly import("./check.js").Shaped<{
|
|
13
|
+
readonly breakdown: Check<readonly (import("./check.js").Shaped<{
|
|
15
14
|
readonly name: Check<string>;
|
|
16
15
|
readonly tokens: Check<number>;
|
|
17
|
-
}>[]>;
|
|
18
|
-
}> | null>;
|
|
19
|
-
readonly limits: Check<readonly import("./check.js").Shaped<{
|
|
16
|
+
}> & import("./check.js").Optional<Record<never, never>>)[]>;
|
|
17
|
+
}> & import("./check.js").Optional<Record<never, never>>) | null>;
|
|
18
|
+
readonly limits: Check<readonly (import("./check.js").Shaped<{
|
|
20
19
|
readonly name: Check<string | null>;
|
|
21
20
|
readonly minutes: Check<number>;
|
|
22
21
|
readonly percent: Check<number>;
|
|
23
22
|
readonly resets: Check<string | null>;
|
|
24
|
-
}>[]>;
|
|
25
|
-
readonly
|
|
26
|
-
readonly amount: Check<number>;
|
|
27
|
-
readonly currency: Check<string>;
|
|
28
|
-
}> | null>;
|
|
29
|
-
readonly tokens: Check<import("./check.js").Shaped<{
|
|
23
|
+
}> & import("./check.js").Optional<Record<never, never>>)[]>;
|
|
24
|
+
readonly tokens: Check<(import("./check.js").Shaped<{
|
|
30
25
|
readonly input: Check<number>;
|
|
31
26
|
readonly output: Check<number>;
|
|
32
27
|
readonly cache_read: Check<number>;
|
|
33
28
|
readonly cache_write: Check<number>;
|
|
34
|
-
}> | null>;
|
|
29
|
+
}> & import("./check.js").Optional<Record<never, never>>) | null>;
|
|
35
30
|
readonly duration: Check<number | null>;
|
|
36
31
|
readonly files: Check<import("./check.js").Shaped<{
|
|
37
32
|
readonly count: Check<number>;
|
|
38
33
|
readonly added: Check<number>;
|
|
39
34
|
readonly removed: Check<number>;
|
|
40
|
-
}
|
|
35
|
+
}> & import("./check.js").Optional<Record<never, never>>>;
|
|
41
36
|
readonly branch: Check<string | null>;
|
|
42
37
|
readonly worktree: Check<string | null>;
|
|
43
|
-
readonly pull: Check<import("./check.js").Shaped<{
|
|
38
|
+
readonly pull: Check<(import("./check.js").Shaped<{
|
|
44
39
|
readonly number: Check<number>;
|
|
45
40
|
readonly url: Check<string>;
|
|
46
|
-
}> | null>;
|
|
41
|
+
}> & import("./check.js").Optional<Record<never, never>>) | null>;
|
|
47
42
|
readonly model: Check<string | null>;
|
|
48
43
|
readonly effort: Check<string | null>;
|
|
49
44
|
readonly mode: Check<string | null>;
|
|
50
45
|
readonly suggestion: Check<string | null>;
|
|
51
|
-
readonly running: Check<readonly import("./check.js").Shaped<{
|
|
46
|
+
readonly running: Check<readonly (import("./check.js").Shaped<{
|
|
52
47
|
readonly kind: Check<"monitor" | "schedule" | "shell" | "subagent" | "task">;
|
|
53
48
|
readonly count: Check<number>;
|
|
54
|
-
}>[]>;
|
|
55
|
-
}
|
|
49
|
+
}> & import("./check.js").Optional<Record<never, never>>)[]>;
|
|
50
|
+
}> & import("./check.js").Optional<Record<never, never>>>;
|
|
56
51
|
export type SessionState = Checked<typeof STATE>;
|
|
57
52
|
export declare const isState: Check<SessionState>;
|
|
58
53
|
export declare function standingState(state: SessionState, saved: string, ended: string | null): SessionState;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type Check, type Checked } from './check.js';
|
|
2
2
|
import { type Part } from './parts.js';
|
|
3
|
-
declare const OPERATION: Check<import("./check.js").Shaped<{
|
|
3
|
+
declare const OPERATION: Check<(import("./check.js").Shaped<{
|
|
4
4
|
readonly op: Check<"start">;
|
|
5
5
|
readonly index: Check<number>;
|
|
6
|
-
readonly part: Check<import("./check.js").Shaped<{
|
|
6
|
+
readonly part: Check<(import("./check.js").Shaped<{
|
|
7
7
|
readonly type: Check<"text">;
|
|
8
8
|
readonly text: Check<string>;
|
|
9
|
-
}> | import("./check.js").Shaped<{
|
|
9
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
10
10
|
readonly commands: Check<number>;
|
|
11
11
|
readonly edited: Check<number>;
|
|
12
12
|
readonly other: Check<number>;
|
|
@@ -14,27 +14,27 @@ declare const OPERATION: Check<import("./check.js").Shaped<{
|
|
|
14
14
|
readonly removed: Check<number>;
|
|
15
15
|
readonly failed: Check<number>;
|
|
16
16
|
readonly type: Check<"counts">;
|
|
17
|
-
}> | import("./check.js").Shaped<{
|
|
17
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
18
18
|
readonly type: Check<"image">;
|
|
19
19
|
readonly file: Check<string>;
|
|
20
20
|
readonly name: Check<string>;
|
|
21
21
|
readonly media_type: Check<string>;
|
|
22
|
-
}> | import("./check.js").Shaped<{
|
|
22
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
23
23
|
readonly type: Check<"notice">;
|
|
24
24
|
readonly kind: Check<"compaction" | "error" | "info" | "mode" | "model" | "retry" | "warning">;
|
|
25
25
|
readonly text: Check<string>;
|
|
26
|
-
}
|
|
27
|
-
}> | import("./check.js").Shaped<{
|
|
26
|
+
}> & import("./check.js").Optional<Record<never, never>>)>;
|
|
27
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
28
28
|
readonly op: Check<"append">;
|
|
29
29
|
readonly index: Check<number>;
|
|
30
30
|
readonly text: Check<string>;
|
|
31
|
-
}> | import("./check.js").Shaped<{
|
|
31
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
32
32
|
readonly op: Check<"set">;
|
|
33
33
|
readonly index: Check<number>;
|
|
34
|
-
readonly part: Check<import("./check.js").Shaped<{
|
|
34
|
+
readonly part: Check<(import("./check.js").Shaped<{
|
|
35
35
|
readonly type: Check<"text">;
|
|
36
36
|
readonly text: Check<string>;
|
|
37
|
-
}> | import("./check.js").Shaped<{
|
|
37
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
38
38
|
readonly commands: Check<number>;
|
|
39
39
|
readonly edited: Check<number>;
|
|
40
40
|
readonly other: Check<number>;
|
|
@@ -42,24 +42,35 @@ declare const OPERATION: Check<import("./check.js").Shaped<{
|
|
|
42
42
|
readonly removed: Check<number>;
|
|
43
43
|
readonly failed: Check<number>;
|
|
44
44
|
readonly type: Check<"counts">;
|
|
45
|
-
}> | import("./check.js").Shaped<{
|
|
45
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
46
46
|
readonly type: Check<"image">;
|
|
47
47
|
readonly file: Check<string>;
|
|
48
48
|
readonly name: Check<string>;
|
|
49
49
|
readonly media_type: Check<string>;
|
|
50
|
-
}> | import("./check.js").Shaped<{
|
|
50
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
51
51
|
readonly type: Check<"notice">;
|
|
52
52
|
readonly kind: Check<"compaction" | "error" | "info" | "mode" | "model" | "retry" | "warning">;
|
|
53
53
|
readonly text: Check<string>;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
54
|
+
}> & import("./check.js").Optional<Record<never, never>>)>;
|
|
55
|
+
}> & import("./check.js").Optional<Record<never, never>>)>;
|
|
56
56
|
export type Operation = Checked<typeof OPERATION>;
|
|
57
57
|
export declare const isOperation: Check<Operation>;
|
|
58
|
+
declare const MODEL_TOKENS: Check<import("./check.js").Shaped<{
|
|
59
|
+
readonly model: Check<string | null>;
|
|
60
|
+
}> & import("./check.js").Optional<{
|
|
61
|
+
readonly input: Check<number>;
|
|
62
|
+
readonly cache_write: Check<number>;
|
|
63
|
+
readonly cache_write_5m: Check<number>;
|
|
64
|
+
readonly cache_write_1h: Check<number>;
|
|
65
|
+
readonly cache_read: Check<number>;
|
|
66
|
+
readonly output: Check<number>;
|
|
67
|
+
}>>;
|
|
68
|
+
export type ModelTokens = Checked<typeof MODEL_TOKENS>;
|
|
58
69
|
declare const TURN: Check<import("./check.js").Shaped<{
|
|
59
|
-
readonly parts: Check<readonly (import("./check.js").Shaped<{
|
|
70
|
+
readonly parts: Check<readonly ((import("./check.js").Shaped<{
|
|
60
71
|
readonly type: Check<"text">;
|
|
61
72
|
readonly text: Check<string>;
|
|
62
|
-
}> | import("./check.js").Shaped<{
|
|
73
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
63
74
|
readonly commands: Check<number>;
|
|
64
75
|
readonly edited: Check<number>;
|
|
65
76
|
readonly other: Check<number>;
|
|
@@ -67,70 +78,69 @@ declare const TURN: Check<import("./check.js").Shaped<{
|
|
|
67
78
|
readonly removed: Check<number>;
|
|
68
79
|
readonly failed: Check<number>;
|
|
69
80
|
readonly type: Check<"counts">;
|
|
70
|
-
}> | import("./check.js").Shaped<{
|
|
81
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
71
82
|
readonly type: Check<"image">;
|
|
72
83
|
readonly file: Check<string>;
|
|
73
84
|
readonly name: Check<string>;
|
|
74
85
|
readonly media_type: Check<string>;
|
|
75
|
-
}> | import("./check.js").Shaped<{
|
|
86
|
+
}> & import("./check.js").Optional<Record<never, never>>) | (import("./check.js").Shaped<{
|
|
76
87
|
readonly type: Check<"notice">;
|
|
77
88
|
readonly kind: Check<"compaction" | "error" | "info" | "mode" | "model" | "retry" | "warning">;
|
|
78
89
|
readonly text: Check<string>;
|
|
79
|
-
}>)[]>;
|
|
80
|
-
readonly tokens: Check<import("./check.js").Shaped<{
|
|
90
|
+
}> & import("./check.js").Optional<Record<never, never>>))[]>;
|
|
91
|
+
readonly tokens: Check<readonly (import("./check.js").Shaped<{
|
|
92
|
+
readonly model: Check<string | null>;
|
|
93
|
+
}> & import("./check.js").Optional<{
|
|
81
94
|
readonly input: Check<number>;
|
|
82
|
-
readonly output: Check<number>;
|
|
83
|
-
readonly cache_read: Check<number>;
|
|
84
95
|
readonly cache_write: Check<number>;
|
|
85
|
-
|
|
96
|
+
readonly cache_write_5m: Check<number>;
|
|
97
|
+
readonly cache_write_1h: Check<number>;
|
|
98
|
+
readonly cache_read: Check<number>;
|
|
99
|
+
readonly output: Check<number>;
|
|
100
|
+
}>)[]>;
|
|
86
101
|
readonly state: Check<import("./check.js").Shaped<{
|
|
87
|
-
readonly
|
|
88
|
-
readonly context: Check<import("./check.js").Shaped<{
|
|
102
|
+
readonly context: Check<(import("./check.js").Shaped<{
|
|
89
103
|
readonly used: Check<number>;
|
|
90
104
|
readonly window: Check<number>;
|
|
91
|
-
readonly breakdown: Check<readonly import("./check.js").Shaped<{
|
|
105
|
+
readonly breakdown: Check<readonly (import("./check.js").Shaped<{
|
|
92
106
|
readonly name: Check<string>;
|
|
93
107
|
readonly tokens: Check<number>;
|
|
94
|
-
}>[]>;
|
|
95
|
-
}> | null>;
|
|
96
|
-
readonly limits: Check<readonly import("./check.js").Shaped<{
|
|
108
|
+
}> & import("./check.js").Optional<Record<never, never>>)[]>;
|
|
109
|
+
}> & import("./check.js").Optional<Record<never, never>>) | null>;
|
|
110
|
+
readonly limits: Check<readonly (import("./check.js").Shaped<{
|
|
97
111
|
readonly name: Check<string | null>;
|
|
98
112
|
readonly minutes: Check<number>;
|
|
99
113
|
readonly percent: Check<number>;
|
|
100
114
|
readonly resets: Check<string | null>;
|
|
101
|
-
}>[]>;
|
|
102
|
-
readonly
|
|
103
|
-
readonly amount: Check<number>;
|
|
104
|
-
readonly currency: Check<string>;
|
|
105
|
-
}> | null>;
|
|
106
|
-
readonly tokens: Check<import("./check.js").Shaped<{
|
|
115
|
+
}> & import("./check.js").Optional<Record<never, never>>)[]>;
|
|
116
|
+
readonly tokens: Check<(import("./check.js").Shaped<{
|
|
107
117
|
readonly input: Check<number>;
|
|
108
118
|
readonly output: Check<number>;
|
|
109
119
|
readonly cache_read: Check<number>;
|
|
110
120
|
readonly cache_write: Check<number>;
|
|
111
|
-
}> | null>;
|
|
121
|
+
}> & import("./check.js").Optional<Record<never, never>>) | null>;
|
|
112
122
|
readonly duration: Check<number | null>;
|
|
113
123
|
readonly files: Check<import("./check.js").Shaped<{
|
|
114
124
|
readonly count: Check<number>;
|
|
115
125
|
readonly added: Check<number>;
|
|
116
126
|
readonly removed: Check<number>;
|
|
117
|
-
}
|
|
127
|
+
}> & import("./check.js").Optional<Record<never, never>>>;
|
|
118
128
|
readonly branch: Check<string | null>;
|
|
119
129
|
readonly worktree: Check<string | null>;
|
|
120
|
-
readonly pull: Check<import("./check.js").Shaped<{
|
|
130
|
+
readonly pull: Check<(import("./check.js").Shaped<{
|
|
121
131
|
readonly number: Check<number>;
|
|
122
132
|
readonly url: Check<string>;
|
|
123
|
-
}> | null>;
|
|
133
|
+
}> & import("./check.js").Optional<Record<never, never>>) | null>;
|
|
124
134
|
readonly model: Check<string | null>;
|
|
125
135
|
readonly effort: Check<string | null>;
|
|
126
136
|
readonly mode: Check<string | null>;
|
|
127
137
|
readonly suggestion: Check<string | null>;
|
|
128
|
-
readonly running: Check<readonly import("./check.js").Shaped<{
|
|
138
|
+
readonly running: Check<readonly (import("./check.js").Shaped<{
|
|
129
139
|
readonly kind: Check<"monitor" | "schedule" | "shell" | "subagent" | "task">;
|
|
130
140
|
readonly count: Check<number>;
|
|
131
|
-
}>[]>;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
141
|
+
}> & import("./check.js").Optional<Record<never, never>>)[]>;
|
|
142
|
+
}> & import("./check.js").Optional<Record<never, never>>>;
|
|
143
|
+
}> & import("./check.js").Optional<Record<never, never>>>;
|
|
134
144
|
export type Turn = Checked<typeof TURN>;
|
|
135
145
|
export declare const isTurn: Check<Turn>;
|
|
136
146
|
export declare function applied(parts: readonly Part[], operation: Operation): readonly Part[] | null;
|
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,EAEV,OAAO,EASR,MAAM,wBAAwB,CAAC;AAchC,OAAO,
|
|
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,14 +6,14 @@ 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,
|
|
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
12
|
function siteDoorRequest(request) {
|
|
13
13
|
const { op, ...input } = (request.input ?? {});
|
|
14
14
|
if (request.name !== SITE_DOOR_TOOL || typeof op !== 'string')
|
|
15
15
|
return request;
|
|
16
|
-
const named = Object.entries(SITE_DOOR_ACTS).find(([,
|
|
16
|
+
const named = Object.entries(SITE_DOOR_ACTS).find(([, act]) => act.op === op);
|
|
17
17
|
return named === undefined ? request : { ...request, name: named[0], input };
|
|
18
18
|
}
|
|
19
19
|
function unfound() {
|
|
@@ -179,7 +179,7 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
179
179
|
async action(_authorization, asked) {
|
|
180
180
|
const request = siteDoorRequest(asked);
|
|
181
181
|
const route = Object.hasOwn(SITE_DOOR_ACTS, request.name)
|
|
182
|
-
? SITE_DOOR_ACTS[request.name]
|
|
182
|
+
? SITE_DOOR_ACTS[request.name].route
|
|
183
183
|
: null;
|
|
184
184
|
if (route === null) {
|
|
185
185
|
return {
|
package/dist/stream.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AuthorityChange, type Discovery, type ConversationStream, type HeldRoom, type RoomStreamEvent, type ServiceModeSignal } from '@agentshouse/mdruntime';
|
|
1
|
+
import { type AuthorityChange, type Discovery, type ConversationStream, type HeldRoom, type RoomStreamEvent, type RunStream, type ServiceModeSignal } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
3
|
import { type HouseDoor, type HouseMode, type HouseStreamFrame } from './transport.js';
|
|
4
4
|
export type HouseOpeningFrame = Extract<HouseStreamFrame, {
|
|
@@ -18,6 +18,7 @@ export type HouseNotifications = {
|
|
|
18
18
|
send(rooms: readonly HeldRoom[]): void;
|
|
19
19
|
track(authorities: readonly TrackedAuthority[]): void;
|
|
20
20
|
conversations: ConversationStream;
|
|
21
|
+
runs: RunStream;
|
|
21
22
|
serviceMode: ServiceModeSignal;
|
|
22
23
|
};
|
|
23
24
|
export declare function houseNotifications(transport: HouseDoor, mode: HouseMode, discovering: HouseDiscovering): HouseNotifications;
|
package/dist/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream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iB,CAAC;CAChC,CAAC;AAiHF,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,SAAS,EACf,WAAW,EAAE,gBAAgB,GAC5B,kBAAkB,CA2apB"}
|
package/dist/stream.js
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
|
+
import { parse } from '@agentshouse/mdmodel';
|
|
1
2
|
import { ROW_WEIGHT, stepped, } from '@agentshouse/mdruntime';
|
|
2
3
|
import { acceptedMessage, changeCursor, houseHistory } from './history.js';
|
|
3
4
|
import { spaceSchemaTexts, streamedModels } from './model.js';
|
|
4
5
|
import { spaceSchemas } from './space-schema.js';
|
|
5
6
|
import { answered, answering, documentEntry, folded, forgotten, kept, } from './read.js';
|
|
6
7
|
import { DECIMAL, logPosition, presented, roomVersion } from './version.js';
|
|
8
|
+
const CURRENT_RUN_STATES = new Set(['awaiting_approval', 'started']);
|
|
9
|
+
const NO_RUN_MARKS = { rooms: {}, sent: null };
|
|
10
|
+
function heardRun(request) {
|
|
11
|
+
const read = parse(`---\n${request.document}---\n`);
|
|
12
|
+
if (!read.ok)
|
|
13
|
+
throw new Error(`the stream carried request ${request.name} as no document`);
|
|
14
|
+
const fields = read.document.fields;
|
|
15
|
+
return {
|
|
16
|
+
room: request.room_ref,
|
|
17
|
+
name: request.name,
|
|
18
|
+
document: request.document,
|
|
19
|
+
current: CURRENT_RUN_STATES.has(fields.state),
|
|
20
|
+
starter: typeof fields.requester === 'string' ? fields.requester : null,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
7
23
|
function turnOperation(frame) {
|
|
8
24
|
return 'at' in frame ? { op: 'begin', at: frame.at } : structuredClone(frame.operation);
|
|
9
25
|
}
|
|
@@ -19,9 +35,13 @@ function listedAgent(agent) {
|
|
|
19
35
|
cli: agent.cli,
|
|
20
36
|
model: agent.model,
|
|
21
37
|
effort: agent.effort,
|
|
38
|
+
model_fixed: agent.model_fixed,
|
|
22
39
|
mode: agent.mode,
|
|
23
40
|
base_instructions: agent.base_instructions,
|
|
41
|
+
compaction_threshold: agent.compaction_threshold,
|
|
42
|
+
compaction_words: agent.compaction_words,
|
|
24
43
|
in_telegram: agent.in_telegram,
|
|
44
|
+
telegram_messages: agent.telegram_messages,
|
|
25
45
|
created: agent.created,
|
|
26
46
|
retired_at: agent.retired_at,
|
|
27
47
|
};
|
|
@@ -36,6 +56,7 @@ function listedConversation(listed) {
|
|
|
36
56
|
waiting: listed.waiting,
|
|
37
57
|
newest: listed.newest === null ? null : changeCursor(listed.newest),
|
|
38
58
|
processEnded: listed.process_ended_at,
|
|
59
|
+
activity: listed.activity,
|
|
39
60
|
subject: listed.subject,
|
|
40
61
|
room: listed.room_ref,
|
|
41
62
|
model: listed.model,
|
|
@@ -91,9 +112,11 @@ export function houseNotifications(transport, mode, discovering) {
|
|
|
91
112
|
const observers = new Set();
|
|
92
113
|
const replaying = new Map();
|
|
93
114
|
const conversationObservers = new Set();
|
|
115
|
+
const runObservers = new Set();
|
|
94
116
|
const modeObservers = new Set();
|
|
95
117
|
let replicated = [];
|
|
96
118
|
let listedCursor = null;
|
|
119
|
+
let runMarks = NO_RUN_MARKS;
|
|
97
120
|
const unanswered = [];
|
|
98
121
|
const heldAtZero = new Set();
|
|
99
122
|
const live = new Set();
|
|
@@ -109,6 +132,10 @@ export function houseNotifications(transport, mode, discovering) {
|
|
|
109
132
|
held.push(event);
|
|
110
133
|
}
|
|
111
134
|
}
|
|
135
|
+
function emitRun(event) {
|
|
136
|
+
for (const observer of runObservers)
|
|
137
|
+
observer(event);
|
|
138
|
+
}
|
|
112
139
|
function emitConversation(event) {
|
|
113
140
|
if (event.kind === 'turn' ||
|
|
114
141
|
event.kind === 'questions' ||
|
|
@@ -269,6 +296,30 @@ export function houseNotifications(transport, mode, discovering) {
|
|
|
269
296
|
emit({ kind: 'reported' });
|
|
270
297
|
return;
|
|
271
298
|
}
|
|
299
|
+
if (frame.type === 'request') {
|
|
300
|
+
const room = frame.request.room_ref;
|
|
301
|
+
emitRun({
|
|
302
|
+
kind: 'run',
|
|
303
|
+
run: heardRun(frame.request),
|
|
304
|
+
listing: tracking.has(room) ? room : null,
|
|
305
|
+
});
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
if (frame.type === 'request_removed') {
|
|
309
|
+
emitRun({ kind: 'removed', room: frame.room_ref, name: frame.request });
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (frame.type === 'requests') {
|
|
313
|
+
emitRun({
|
|
314
|
+
kind: 'runs',
|
|
315
|
+
listing: frame.room_ref,
|
|
316
|
+
runs: frame.requests.map(heardRun),
|
|
317
|
+
whole: frame.whole,
|
|
318
|
+
more: frame.more,
|
|
319
|
+
mark: frame.cursor,
|
|
320
|
+
});
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
272
323
|
if (frame.type === 'authority_changed') {
|
|
273
324
|
const change = discovering.changed(frame);
|
|
274
325
|
if (change !== null)
|
|
@@ -371,6 +422,17 @@ export function houseNotifications(transport, mode, discovering) {
|
|
|
371
422
|
},
|
|
372
423
|
...(mode === 'credential' ? { history: (request) => houseHistory(transport, request) } : {}),
|
|
373
424
|
},
|
|
425
|
+
runs: {
|
|
426
|
+
hold(marks) {
|
|
427
|
+
runMarks = marks;
|
|
428
|
+
},
|
|
429
|
+
observe(notify) {
|
|
430
|
+
runObservers.add(notify);
|
|
431
|
+
return () => {
|
|
432
|
+
runObservers.delete(notify);
|
|
433
|
+
};
|
|
434
|
+
},
|
|
435
|
+
},
|
|
374
436
|
observe(notify) {
|
|
375
437
|
observers.add(notify);
|
|
376
438
|
if (opening !== null) {
|
|
@@ -413,10 +475,14 @@ export function houseNotifications(transport, mode, discovering) {
|
|
|
413
475
|
heldAtZero.delete(entry.authority);
|
|
414
476
|
const site = mode === 'site';
|
|
415
477
|
unanswered.push(site ? unheld.map((entry) => entry.locator) : []);
|
|
478
|
+
const marked = (held) => {
|
|
479
|
+
const mark = runMarks.rooms[held.authority];
|
|
480
|
+
return mark === undefined ? held : { ...held, requests: mark };
|
|
481
|
+
};
|
|
416
482
|
socket.hold([
|
|
417
|
-
...named.map(({ entry, at }) => presented(entry.authority, at)),
|
|
418
|
-
...(site ? [] : unheld).map((entry) => presented(entry.authority, { position: '0', logEpoch: entry.logEpoch })),
|
|
419
|
-
], runtime, listedCursor);
|
|
483
|
+
...named.map(({ entry, at }) => marked(presented(entry.authority, at))),
|
|
484
|
+
...(site ? [] : unheld).map((entry) => marked(presented(entry.authority, { position: '0', logEpoch: entry.logEpoch }))),
|
|
485
|
+
], runtime, listedCursor, runMarks.sent ?? undefined);
|
|
420
486
|
if (site)
|
|
421
487
|
return;
|
|
422
488
|
const made = unheld.filter((entry) => entry.position === '0');
|
package/dist/transport.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ConversationEvent, ListedAgent, SavedFacts } from '@agentshouse/mdruntime';
|
|
1
|
+
import type { ConversationActivity, 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 ['
|
|
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'];
|
|
4
|
+
readonly acts: readonly ['account_update.set', 'app.screenshot', 'app.source', 'app_update.feature_set', 'conversations/history/list', 'files/attach', 'files/finish', 'files/read', 'files/revisions/list', 'info', 'room-chunks/list', 'rooms/discover', 'rooms/search', 'update'];
|
|
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', 'request', 'request_removed', 'requests', 'signal', 'site', 'starting', 'state', 'tab-icon', 'turn'];
|
|
6
6
|
};
|
|
7
7
|
export type HouseRuntimeAct = (typeof HOUSE_RUNTIME_READS.acts)[number];
|
|
8
8
|
export type HouseRuntimeFrame = (typeof HOUSE_RUNTIME_READS.frames)[number];
|
|
@@ -17,9 +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>>;
|
|
21
25
|
export declare const SITE_DOOR_TOOL = "app_update";
|
|
22
|
-
export declare const SITE_DOOR_OPS: Readonly<Record<string, string>>;
|
|
23
26
|
export type HouseMode = 'credential' | 'site';
|
|
24
27
|
export type HouseDoorAnswer = {
|
|
25
28
|
status: number;
|
|
@@ -63,11 +66,15 @@ export type HouseStreamEntry = {
|
|
|
63
66
|
changed_at?: string;
|
|
64
67
|
created_at?: string;
|
|
65
68
|
content?: string;
|
|
66
|
-
provenance?: string;
|
|
67
69
|
facts?: SavedFacts;
|
|
68
70
|
move?: 'arrival' | 'leaving';
|
|
69
71
|
space?: string;
|
|
70
72
|
};
|
|
73
|
+
export type HouseStreamedRequest = {
|
|
74
|
+
room_ref: string;
|
|
75
|
+
name: string;
|
|
76
|
+
document: string;
|
|
77
|
+
};
|
|
71
78
|
type LiveFact<K extends ConversationEvent['kind']> = Extract<ConversationEvent, {
|
|
72
79
|
kind: K;
|
|
73
80
|
}>;
|
|
@@ -80,6 +87,7 @@ export type HouseListedConversation = {
|
|
|
80
87
|
waiting: boolean;
|
|
81
88
|
newest: number | null;
|
|
82
89
|
process_ended_at: string | null;
|
|
90
|
+
activity: ConversationActivity | null;
|
|
83
91
|
subject: string | null;
|
|
84
92
|
room_ref: string | null;
|
|
85
93
|
model: string | null;
|
|
@@ -187,14 +195,29 @@ export type HouseStreamFrame = Listed<{
|
|
|
187
195
|
service_mode: string;
|
|
188
196
|
} | {
|
|
189
197
|
type: 'report';
|
|
198
|
+
} | {
|
|
199
|
+
type: 'request';
|
|
200
|
+
request: HouseStreamedRequest;
|
|
201
|
+
} | {
|
|
202
|
+
type: 'request_removed';
|
|
203
|
+
room_ref: string;
|
|
204
|
+
request: string;
|
|
205
|
+
} | {
|
|
206
|
+
type: 'requests';
|
|
207
|
+
room_ref: string | null;
|
|
208
|
+
requests: readonly HouseStreamedRequest[];
|
|
209
|
+
whole: boolean;
|
|
210
|
+
more: boolean;
|
|
211
|
+
cursor: string;
|
|
190
212
|
}>;
|
|
191
213
|
export type HouseHeldRoom = {
|
|
192
214
|
authority: string;
|
|
193
215
|
position: string;
|
|
194
216
|
log_epoch: string;
|
|
217
|
+
requests?: string;
|
|
195
218
|
};
|
|
196
219
|
export type HouseOpening = {
|
|
197
|
-
hold(rooms: readonly HouseHeldRoom[], runtime: string, conversations: string | null): void;
|
|
220
|
+
hold(rooms: readonly HouseHeldRoom[], runtime: string, conversations: string | null, sent?: string): void;
|
|
198
221
|
received(authority: string, carry: string, index: number): void;
|
|
199
222
|
close(failure?: unknown): void;
|
|
200
223
|
};
|
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,
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,UAAU,EACX,MAAM,wBAAwB,CAAC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O,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7D,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IACvC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC/D,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,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
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { plain, queryKey } from '@agentshouse/mdmodel';
|
|
2
2
|
export const HOUSE_RUNTIME_READS = {
|
|
3
3
|
acts: [
|
|
4
|
-
'
|
|
5
|
-
'account/time-zone/set',
|
|
4
|
+
'account_update.set',
|
|
6
5
|
'app.screenshot',
|
|
7
6
|
'app.source',
|
|
8
|
-
'
|
|
7
|
+
'app_update.feature_set',
|
|
9
8
|
'conversations/history/list',
|
|
10
9
|
'files/attach',
|
|
11
10
|
'files/finish',
|
|
@@ -39,6 +38,9 @@ export const HOUSE_RUNTIME_READS = {
|
|
|
39
38
|
'process',
|
|
40
39
|
'received',
|
|
41
40
|
'report',
|
|
41
|
+
'request',
|
|
42
|
+
'request_removed',
|
|
43
|
+
'requests',
|
|
42
44
|
'signal',
|
|
43
45
|
'site',
|
|
44
46
|
'starting',
|
|
@@ -84,13 +86,9 @@ export const SITE_DOOR_SUBMIT = '/_house/door/submit';
|
|
|
84
86
|
export const SITES_FUNCTIONS_CALL = 'sites/functions/call';
|
|
85
87
|
export const SITE_DOOR_FUNCTION = '/_house/door/function';
|
|
86
88
|
export const SITE_DOOR_ACTS = {
|
|
87
|
-
[SITES_SUBMISSIONS_CREATE]: SITE_DOOR_SUBMIT,
|
|
88
|
-
[SITES_FUNCTIONS_CALL]: SITE_DOOR_FUNCTION,
|
|
89
|
+
[SITES_SUBMISSIONS_CREATE]: { op: 'submission_create', route: SITE_DOOR_SUBMIT },
|
|
90
|
+
[SITES_FUNCTIONS_CALL]: { op: 'function_call', route: SITE_DOOR_FUNCTION },
|
|
89
91
|
};
|
|
90
92
|
export const SITE_DOOR_TOOL = 'app_update';
|
|
91
|
-
export const SITE_DOOR_OPS = {
|
|
92
|
-
submission_create: SITE_DOOR_SUBMIT,
|
|
93
|
-
function_call: SITE_DOOR_FUNCTION,
|
|
94
|
-
};
|
|
95
93
|
export const SITE_FILES = '/_house/files/';
|
|
96
94
|
export const SITE_IMAGE_COPIES_HEADER = 'X-House-Image-Copies';
|
package/dist/write.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChangeBatch, type HistoryResult, type MutationResult } from '@agentshouse/mdruntime';
|
|
1
|
+
import { type ChangeBatch, type HistoryResult, type MutationResult, type Written } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { HouseBounds } from './discovery.js';
|
|
3
3
|
export type HouseOperation = Readonly<Record<string, unknown>>;
|
|
4
4
|
export type ChangeMapping = {
|
|
@@ -9,11 +9,7 @@ export type ChangeMapping = {
|
|
|
9
9
|
path: string;
|
|
10
10
|
rule: string;
|
|
11
11
|
};
|
|
12
|
-
export declare function houseChanges(batch: ChangeBatch, handle: string): ChangeMapping;
|
|
13
|
-
export declare function houseParts(saved: readonly {
|
|
14
|
-
readonly path: string;
|
|
15
|
-
readonly parts: unknown;
|
|
16
|
-
}[], handle: string): ChangeMapping;
|
|
12
|
+
export declare function houseChanges(batch: ChangeBatch, handle: string, written: Written): ChangeMapping;
|
|
17
13
|
export declare function houseMove(batch: ChangeBatch, source: string, destination: string): ChangeMapping;
|
|
18
14
|
export type OperationHead = {
|
|
19
15
|
readonly operation_id: string;
|
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,
|
|
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,EACnB,KAAK,OAAO,EACb,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;AAyFrD,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,aAAa,CA8BhG;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,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AAe,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,18 +1,14 @@
|
|
|
1
|
-
import { departure,
|
|
1
|
+
import { departure, isPart, ROW_WEIGHT, } from '@agentshouse/mdruntime';
|
|
2
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';
|
|
6
6
|
import { readPosition, roomVersion } from './version.js';
|
|
7
7
|
import { unusable } from './uncertain.js';
|
|
8
|
-
function
|
|
9
|
-
return batch.preconditions.find((
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return batch.preconditions.find((precondition) => precondition.kind === 'section' && precondition.path === path && precondition.name === name);
|
|
13
|
-
}
|
|
14
|
-
function priorPreamble(batch, path) {
|
|
15
|
-
return batch.preconditions.find((precondition) => precondition.kind === 'preamble' && precondition.path === path);
|
|
8
|
+
function priorPart(batch, change) {
|
|
9
|
+
return batch.preconditions.find((held) => held.kind === change.kind &&
|
|
10
|
+
held.path === change.path &&
|
|
11
|
+
(change.kind === 'preamble' || ('name' in held && held.name === change.name)));
|
|
16
12
|
}
|
|
17
13
|
function priorAbsence(batch, path) {
|
|
18
14
|
return batch.preconditions.find((precondition) => precondition.kind === 'absent' && precondition.path === path);
|
|
@@ -23,60 +19,30 @@ function priorExistence(batch, path) {
|
|
|
23
19
|
return undefined;
|
|
24
20
|
return precondition.kind === 'revision' ? { base: precondition.revision } : { kind: 'presence' };
|
|
25
21
|
}
|
|
26
|
-
function
|
|
27
|
-
if (
|
|
28
|
-
return {
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
function textOf(batch, change, path, document) {
|
|
23
|
+
if (isPart(change) && priorPart(batch, change) === undefined)
|
|
24
|
+
return { rule: 'precondition-missing' };
|
|
25
|
+
if (change.kind === 'create' && priorAbsence(batch, change.path) === undefined)
|
|
26
|
+
return { rule: 'precondition-missing' };
|
|
27
|
+
if (change.kind === 'replace' && priorExistence(batch, change.path) === undefined)
|
|
28
|
+
return { rule: 'precondition-missing' };
|
|
29
|
+
if (document === null || document === undefined)
|
|
31
30
|
return null;
|
|
32
|
-
|
|
31
|
+
if (document.stale)
|
|
32
|
+
return { rule: 'precondition-stale' };
|
|
33
|
+
if (document.created)
|
|
34
|
+
return { operation: { op: 'write', path, content: document.content } };
|
|
35
|
+
if (document.base === null)
|
|
36
|
+
return { rule: 'presence-base-unrepresentable' };
|
|
37
|
+
return { operation: { op: 'write', path, base: document.base, content: document.content } };
|
|
33
38
|
}
|
|
34
|
-
function operationOf(batch,
|
|
39
|
+
function operationOf(batch, index, handle, written) {
|
|
40
|
+
const change = batch.changes[index];
|
|
35
41
|
const path = nativePath(change.path, handle);
|
|
36
|
-
if (change.kind === '
|
|
37
|
-
|
|
38
|
-
if (prior === undefined)
|
|
39
|
-
return { rule: 'precondition-missing' };
|
|
40
|
-
return {
|
|
41
|
-
operation: {
|
|
42
|
-
op: 'set_field',
|
|
43
|
-
path,
|
|
44
|
-
field: change.name,
|
|
45
|
-
value: change.value,
|
|
46
|
-
...(prior.value === undefined ? {} : { base: prior.value }),
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (change.kind === 'section') {
|
|
51
|
-
const prior = priorSection(batch, change.path, change.name);
|
|
52
|
-
if (prior === undefined)
|
|
53
|
-
return { rule: 'precondition-missing' };
|
|
54
|
-
return {
|
|
55
|
-
operation: {
|
|
56
|
-
op: 'replace_section',
|
|
57
|
-
path,
|
|
58
|
-
section: change.name,
|
|
59
|
-
base: prior.value,
|
|
60
|
-
content: change.value,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
if (change.kind === 'preamble') {
|
|
65
|
-
const prior = priorPreamble(batch, change.path);
|
|
66
|
-
if (prior === undefined)
|
|
67
|
-
return { rule: 'precondition-missing' };
|
|
68
|
-
return {
|
|
69
|
-
operation: { op: 'replace_preamble', path, base: prior.value, content: change.value },
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
if (change.kind === 'create') {
|
|
73
|
-
if (priorAbsence(batch, change.path) === undefined)
|
|
74
|
-
return { rule: 'precondition-missing' };
|
|
75
|
-
const operation = created(change, path);
|
|
76
|
-
return operation === null ? { rule: 'type-missing' } : { operation };
|
|
77
|
-
}
|
|
42
|
+
if (isPart(change) || change.kind === 'create' || change.kind === 'replace')
|
|
43
|
+
return textOf(batch, change, path, written[index]);
|
|
78
44
|
if (change.kind === 'binary') {
|
|
79
|
-
const
|
|
45
|
+
const uploaded = {
|
|
80
46
|
op: 'upload',
|
|
81
47
|
path,
|
|
82
48
|
local_id: change.localId,
|
|
@@ -84,45 +50,61 @@ function operationOf(batch, change, handle) {
|
|
|
84
50
|
sha256: change.sha256,
|
|
85
51
|
media_type: change.mediaType,
|
|
86
52
|
};
|
|
87
|
-
const from = departure(batch.changes,
|
|
53
|
+
const from = departure(batch.changes, index);
|
|
88
54
|
if (from === change.path && priorAbsence(batch, change.path) !== undefined)
|
|
89
|
-
return { operation:
|
|
55
|
+
return { operation: uploaded };
|
|
90
56
|
const replaced = priorExistence(batch, from);
|
|
91
57
|
if (replaced === undefined)
|
|
92
58
|
return { rule: 'precondition-missing' };
|
|
93
59
|
if (!('base' in replaced))
|
|
94
60
|
return { rule: 'presence-base-unrepresentable' };
|
|
95
|
-
return { operation: { ...
|
|
61
|
+
return { operation: { ...uploaded, base: replaced.base } };
|
|
96
62
|
}
|
|
97
63
|
const existence = priorExistence(batch, change.path);
|
|
98
64
|
if (existence === undefined)
|
|
99
65
|
return { rule: 'precondition-missing' };
|
|
100
66
|
if (!('base' in existence))
|
|
101
67
|
return { rule: 'presence-base-unrepresentable' };
|
|
102
|
-
if (change.kind === 'replace') {
|
|
103
|
-
return { operation: { op: 'replace', path, base: existence.base, content: change.content } };
|
|
104
|
-
}
|
|
105
68
|
if (change.kind === 'move') {
|
|
106
69
|
if (priorAbsence(batch, change.to) === undefined)
|
|
107
70
|
return { rule: 'precondition-missing' };
|
|
108
71
|
return {
|
|
109
|
-
operation: { op: '
|
|
72
|
+
operation: { op: 'move', path, to: nativePath(change.to, handle), base: existence.base },
|
|
110
73
|
};
|
|
111
74
|
}
|
|
112
|
-
return { operation: { op: '
|
|
75
|
+
return { operation: { op: 'delete', path, base: existence.base } };
|
|
113
76
|
}
|
|
114
|
-
export function houseChanges(batch, handle) {
|
|
77
|
+
export function houseChanges(batch, handle, written) {
|
|
115
78
|
const changes = [];
|
|
116
|
-
|
|
117
|
-
|
|
79
|
+
const moves = new Map();
|
|
80
|
+
const before = new Map();
|
|
81
|
+
for (const [index, change] of batch.changes.entries()) {
|
|
82
|
+
const mapped = operationOf(batch, index, handle, written);
|
|
83
|
+
if (mapped === null)
|
|
84
|
+
continue;
|
|
118
85
|
if ('rule' in mapped)
|
|
119
86
|
return { kind: 'unmapped', path: change.path, rule: mapped.rule };
|
|
120
|
-
|
|
87
|
+
const { operation } = mapped;
|
|
88
|
+
const from = departure(batch.changes, index);
|
|
89
|
+
if (change.kind === 'move' && !moves.has(from))
|
|
90
|
+
moves.set(from, changes.length);
|
|
91
|
+
const moved = moves.get(from);
|
|
92
|
+
if (change.kind !== 'move' &&
|
|
93
|
+
moved !== undefined &&
|
|
94
|
+
operation.op === 'write' &&
|
|
95
|
+
'base' in operation) {
|
|
96
|
+
before.set(moved, { ...operation, path: nativePath(from, handle) });
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
changes.push(operation);
|
|
121
100
|
}
|
|
122
|
-
return {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
101
|
+
return {
|
|
102
|
+
kind: 'changes',
|
|
103
|
+
changes: changes.flatMap((operation, at) => {
|
|
104
|
+
const written = before.get(at);
|
|
105
|
+
return written === undefined ? [operation] : [written, operation];
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
126
108
|
}
|
|
127
109
|
export function houseMove(batch, source, destination) {
|
|
128
110
|
const changes = [];
|
|
@@ -134,7 +116,7 @@ export function houseMove(batch, source, destination) {
|
|
|
134
116
|
return { kind: 'unmapped', path, rule: 'presence-base-unrepresentable' };
|
|
135
117
|
}
|
|
136
118
|
changes.push({
|
|
137
|
-
op: '
|
|
119
|
+
op: 'move',
|
|
138
120
|
path: nativePath(path, source),
|
|
139
121
|
to: nativePath(to, destination),
|
|
140
122
|
base: existence.base,
|
|
@@ -149,7 +131,7 @@ export function operationHead(batch) {
|
|
|
149
131
|
}
|
|
150
132
|
export function batchPaths(changes) {
|
|
151
133
|
return [
|
|
152
|
-
...new Set(changes.flatMap((change) => change.op === '
|
|
134
|
+
...new Set(changes.flatMap((change) => change.op === 'move' ? [String(change.path), String(change.to)] : [String(change.path)])),
|
|
153
135
|
];
|
|
154
136
|
}
|
|
155
137
|
export function deltaBody(changes) {
|
package/package.json
CHANGED
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"LICENSE"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@agentshouse/mdmodel": "0.1.0-
|
|
27
|
-
"@agentshouse/mdruntime": "0.1.0-
|
|
26
|
+
"@agentshouse/mdmodel": "0.1.0-c794a1d495a31",
|
|
27
|
+
"@agentshouse/mdruntime": "0.1.0-c1996d5af6e1f"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
31
|
"url": "git+https://github.com/agentshouse/core.git",
|
|
32
32
|
"directory": "mdruntime/packages/mdruntime-adapter"
|
|
33
33
|
},
|
|
34
|
-
"version": "0.1.0-
|
|
34
|
+
"version": "0.1.0-cf1e9b409cb0c"
|
|
35
35
|
}
|