@agentshouse/mdruntime-adapter 0.1.0-c6a7d34af3c17 → 0.1.0-c6a8aa495a22c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.ts +2 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +41 -5
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +30 -17
- 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/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 +2 -2
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +3 -3
- 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 +19 -7
- 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 +11 -3
- package/dist/stream.d.ts +2 -1
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +72 -3
- package/dist/transport.d.ts +34 -6
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +11 -10
- package/dist/upload.js +2 -2
- package/dist/write.d.ts +3 -8
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +61 -79
- package/package.json +4 -4
package/dist/actions.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type { HouseDoorAnswer, HouseTransport } from './transport.js';
|
|
|
3
3
|
export type HouseActDoor = Pick<HouseTransport, 'door'>;
|
|
4
4
|
export declare const HOUSE_UNKEPT_READS: readonly string[];
|
|
5
5
|
export declare const HOUSE_LEADING_READS: readonly string[];
|
|
6
|
+
export declare const HOUSE_RENAMED_UNTIL_2026_12_27: ReadonlyMap<string, string>;
|
|
7
|
+
export declare const HOUSE_REWRITTEN_UNTIL_2026_12_27: ReadonlyMap<string, (input: unknown) => unknown>;
|
|
6
8
|
export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
|
|
7
9
|
export declare function houseAction(transport: HouseActDoor, request: ActionRequest): Promise<ActionResult>;
|
|
8
10
|
export declare function actionOutcome(answer: HouseDoorAnswer, name: string, input: unknown): ActionResult;
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI7F,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAExD,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAI/C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,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
|
@@ -1,17 +1,48 @@
|
|
|
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
|
-
'account
|
|
5
|
-
'billing
|
|
6
|
-
'clients
|
|
5
|
+
'account.read security',
|
|
6
|
+
'account.billing',
|
|
7
|
+
'account.clients',
|
|
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',
|
|
14
|
+
'sharing.members',
|
|
12
15
|
];
|
|
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'],
|
|
19
|
+
]);
|
|
20
|
+
function askToJoinInput(input) {
|
|
21
|
+
if (typeof input !== 'object' || input === null || !('join_request' in input))
|
|
22
|
+
return input;
|
|
23
|
+
const { join_request: asked, ...rest } = input;
|
|
24
|
+
return { ...rest, ask_to_join: asked };
|
|
25
|
+
}
|
|
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],
|
|
29
|
+
]);
|
|
30
|
+
const ROOM_SELECTORS = new Map([
|
|
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' }],
|
|
38
|
+
]);
|
|
13
39
|
export function declaredActions(routes) {
|
|
14
|
-
return routes.map((name) => ({
|
|
40
|
+
return routes.map((name) => ({
|
|
41
|
+
name,
|
|
42
|
+
inputShape: {},
|
|
43
|
+
resultKind: 'house',
|
|
44
|
+
...(ROOM_SELECTORS.get(name) ?? { room: 'room_ref' }),
|
|
45
|
+
}));
|
|
15
46
|
}
|
|
16
47
|
export function houseAction(transport, request) {
|
|
17
48
|
const route = routeOf(request.name);
|
|
@@ -57,5 +88,10 @@ export function actionOutcome(answer, name, input) {
|
|
|
57
88
|
return { kind: 'action', result: answer.body };
|
|
58
89
|
}
|
|
59
90
|
async function carry(transport, route, name, input) {
|
|
60
|
-
|
|
91
|
+
const answered = actionOutcome(await transport.door(route, input), name, input);
|
|
92
|
+
const renamed = renamedHandle(answered);
|
|
93
|
+
if (renamed === null)
|
|
94
|
+
return answered;
|
|
95
|
+
const moved = movedPaths(input, ROOM_SELECTORS.get(name)?.roomPaths ?? [], renamed);
|
|
96
|
+
return actionOutcome(await transport.door(route, moved), name, moved);
|
|
61
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,13 +5,14 @@ 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, HOUSE_UNKEPT_READS } from './actions.js';
|
|
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';
|
|
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';
|
|
@@ -149,8 +150,9 @@ export function createAgentsHouseAdapter(options) {
|
|
|
149
150
|
if (handed !== undefined && handed.sha256 === sha256) {
|
|
150
151
|
return { body: { ...head, paths, upload: handed, runtime: notifications.runtime } };
|
|
151
152
|
}
|
|
152
|
-
const minted = await transport.door(houseDoorRoute('
|
|
153
|
+
const minted = await transport.door(houseDoorRoute('update'), {
|
|
153
154
|
...head,
|
|
155
|
+
op: 'stage',
|
|
154
156
|
paths,
|
|
155
157
|
bytes,
|
|
156
158
|
sha256,
|
|
@@ -197,6 +199,23 @@ export function createAgentsHouseAdapter(options) {
|
|
|
197
199
|
destination: { authority: into.authority, handle: into.handle },
|
|
198
200
|
}));
|
|
199
201
|
}
|
|
202
|
+
async function mutated(request, keep, entry, into) {
|
|
203
|
+
const batch = request.changeBatch;
|
|
204
|
+
const mapped = into === undefined
|
|
205
|
+
? houseChanges(batch, entry.handle, request.written)
|
|
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
|
+
}
|
|
200
219
|
function refusedOn(answer, locator) {
|
|
201
220
|
if (locator === null)
|
|
202
221
|
return keyedFailure(answer.status, answer.body);
|
|
@@ -294,6 +313,8 @@ export function createAgentsHouseAdapter(options) {
|
|
|
294
313
|
pathRule: admittedPath,
|
|
295
314
|
unkeptReads: HOUSE_UNKEPT_READS,
|
|
296
315
|
leadingReads: HOUSE_LEADING_READS,
|
|
316
|
+
renamedActions: HOUSE_RENAMED_UNTIL_2026_12_27,
|
|
317
|
+
rewrittenInputs: HOUSE_REWRITTEN_UNTIL_2026_12_27,
|
|
297
318
|
async authorize() {
|
|
298
319
|
return options.authorize();
|
|
299
320
|
},
|
|
@@ -309,26 +330,17 @@ export function createAgentsHouseAdapter(options) {
|
|
|
309
330
|
const entry = authorityFor(request.locator);
|
|
310
331
|
if (entry === undefined)
|
|
311
332
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
312
|
-
const
|
|
313
|
-
const destination = batch.between?.destination.room;
|
|
333
|
+
const destination = request.changeBatch.between?.destination.room;
|
|
314
334
|
const into = destination === undefined ? undefined : authorityFor(destination);
|
|
315
335
|
if (destination !== undefined && into === undefined) {
|
|
316
336
|
return { kind: 'room-not-readable', locator: destination };
|
|
317
337
|
}
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (mapped.kind === 'unmapped')
|
|
322
|
-
return rejectedMapping(mapped);
|
|
323
|
-
const head = operationHead(batch, entry.authority);
|
|
324
|
-
const delta = deltaBody(mapped.changes);
|
|
325
|
-
const bytes = deltaBytes(delta);
|
|
326
|
-
const handed = request.upload;
|
|
327
|
-
const answer = (upload) => submit(request, head, mapped.changes, delta, bytes, entry, upload, keep, into);
|
|
328
|
-
const outcome = await answer(handed);
|
|
329
|
-
if (handed === undefined || !lapsedGrant(outcome))
|
|
338
|
+
const outcome = await mutated(request, keep, entry, into);
|
|
339
|
+
const renamed = renamedHandle(outcome);
|
|
340
|
+
if (renamed === null)
|
|
330
341
|
return outcome;
|
|
331
|
-
|
|
342
|
+
const moved = (held) => held.handle === renamed.from ? { ...held, handle: renamed.to } : held;
|
|
343
|
+
return mutated(request, keep, moved(entry), into === undefined ? undefined : moved(into));
|
|
332
344
|
},
|
|
333
345
|
async history(_authorization, request) {
|
|
334
346
|
const entry = authorityFor(request.locator);
|
|
@@ -385,6 +397,7 @@ export function createAgentsHouseAdapter(options) {
|
|
|
385
397
|
observe: notifications.observe,
|
|
386
398
|
},
|
|
387
399
|
conversations: notifications.conversations,
|
|
400
|
+
runs: notifications.runs,
|
|
388
401
|
serviceMode: notifications.serviceMode,
|
|
389
402
|
};
|
|
390
403
|
}
|
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;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AAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAsB5D,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO9C;AAYD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAiB5D;AASD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAU5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKlD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7D;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/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
|
@@ -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,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAClG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,UAAU,EACV,2BAA2B,EAC3B,cAAc,EACd,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -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,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,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,iBAAiB,GAAG,IAAI,CAkCvF;AAED,wBAAgB,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAQpE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,aAAa,GAAG,UAAU,CAO1D;AAED,wBAAiB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,CASxF;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,WAAW,GAAG,IAAI,CAStE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,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,
|
|
@@ -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,16 +6,28 @@ const TOO_LONG_FOR_AN_ADDRESS = {
|
|
|
6
6
|
fields: {},
|
|
7
7
|
retryable: false,
|
|
8
8
|
};
|
|
9
|
-
|
|
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
|
+
}
|
|
10
20
|
const { after, ...query } = request.query;
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}), 'next_cursor');
|
|
21
|
+
return { path: root, query, ...(after === undefined ? {} : { cursor: after }), ...follows };
|
|
22
|
+
}
|
|
23
|
+
export async function houseQuery(transport, request) {
|
|
24
|
+
return queriedPage(await transport.door(houseDoorRoute('info'), infoAsked(request)), 'next_cursor');
|
|
16
25
|
}
|
|
17
26
|
export async function siteQuery(transport, request) {
|
|
18
|
-
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);
|
|
19
31
|
if (route.length > SITE_QUERY_ROUTE_CHARACTERS)
|
|
20
32
|
return TOO_LONG_FOR_AN_ADDRESS;
|
|
21
33
|
return queriedPage(await transport.read(route), 'next');
|
|
@@ -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;
|