@agentshouse/mdruntime-adapter 0.1.0-c240f8024d197 → 0.1.0-c249a3be0107c
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/README.md +2 -2
- package/dist/actions.d.ts +11 -1
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +196 -9
- package/dist/adapter.d.ts +0 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +136 -122
- package/dist/authored-path.d.ts +61 -0
- package/dist/authored-path.d.ts.map +1 -0
- package/dist/authored-path.js +166 -0
- package/dist/chunks.d.ts +2 -4
- package/dist/chunks.d.ts.map +1 -1
- package/dist/chunks.js +72 -38
- package/dist/digest.d.ts +0 -1
- package/dist/discovery.d.ts +26 -8
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +174 -26
- package/dist/history.d.ts +1 -7
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +21 -28
- package/dist/index.d.ts +8 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -8
- package/dist/map.d.ts +0 -1
- package/dist/model.d.ts +5 -6
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +18 -28
- package/dist/read.d.ts +11 -25
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +74 -47
- package/dist/refusal.d.ts +6 -2
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +28 -7
- 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 +4 -0
- package/dist/room-query.d.ts.map +1 -0
- package/dist/room-query.js +63 -0
- package/dist/search.d.ts +0 -1
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +4 -4
- package/dist/session-content/check.d.ts +17 -0
- package/dist/session-content/index.d.ts +6 -0
- package/dist/session-content/parts.d.ts +30 -0
- package/dist/session-content/state.d.ts +59 -0
- package/dist/session-content/turn.d.ts +137 -0
- package/dist/site.d.ts +0 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +61 -23
- package/dist/space-schema.d.ts +0 -1
- package/dist/space-schema.d.ts.map +1 -1
- package/dist/space-schema.js +1 -8
- package/dist/stream.d.ts +4 -5
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +150 -89
- package/dist/transport.d.ts +76 -25
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +47 -10
- package/dist/uncertain.d.ts +5 -0
- package/dist/uncertain.d.ts.map +1 -0
- package/dist/uncertain.js +11 -0
- package/dist/upload.d.ts +7 -2
- package/dist/upload.d.ts.map +1 -1
- package/dist/upload.js +49 -6
- package/dist/version.d.ts +0 -1
- package/dist/write.d.ts +3 -10
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +90 -110
- package/package.json +4 -3
- package/dist/app-reference.d.ts +0 -2
- package/dist/app-reference.d.ts.map +0 -1
- package/dist/app-reference.js +0 -2
- package/dist/crockford.d.ts +0 -4
- package/dist/crockford.d.ts.map +0 -1
- package/dist/crockford.js +0 -3
- package/dist/house-model.d.ts +0 -672
- package/dist/house-model.d.ts.map +0 -1
- package/dist/house-model.js +0 -377
- package/dist/room-types.d.ts +0 -7
- package/dist/room-types.d.ts.map +0 -1
- package/dist/room-types.js +0 -123
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type Check, type Checked } from './check.js';
|
|
2
|
+
export declare const TOKENS: Check<import("./check.js").Shaped<{
|
|
3
|
+
readonly input: Check<number>;
|
|
4
|
+
readonly output: Check<number>;
|
|
5
|
+
readonly cache_read: Check<number>;
|
|
6
|
+
readonly cache_write: Check<number>;
|
|
7
|
+
}>>;
|
|
8
|
+
export type Tokens = Checked<typeof TOKENS>;
|
|
9
|
+
declare const STATE: Check<import("./check.js").Shaped<{
|
|
10
|
+
readonly title: Check<string | null>;
|
|
11
|
+
readonly context: Check<import("./check.js").Shaped<{
|
|
12
|
+
readonly used: Check<number>;
|
|
13
|
+
readonly window: Check<number>;
|
|
14
|
+
readonly breakdown: Check<readonly import("./check.js").Shaped<{
|
|
15
|
+
readonly name: Check<string>;
|
|
16
|
+
readonly tokens: Check<number>;
|
|
17
|
+
}>[]>;
|
|
18
|
+
}> | null>;
|
|
19
|
+
readonly limits: Check<readonly import("./check.js").Shaped<{
|
|
20
|
+
readonly name: Check<string | null>;
|
|
21
|
+
readonly minutes: Check<number>;
|
|
22
|
+
readonly percent: Check<number>;
|
|
23
|
+
readonly resets: Check<string | null>;
|
|
24
|
+
}>[]>;
|
|
25
|
+
readonly cost: Check<import("./check.js").Shaped<{
|
|
26
|
+
readonly amount: Check<number>;
|
|
27
|
+
readonly currency: Check<string>;
|
|
28
|
+
}> | null>;
|
|
29
|
+
readonly tokens: Check<import("./check.js").Shaped<{
|
|
30
|
+
readonly input: Check<number>;
|
|
31
|
+
readonly output: Check<number>;
|
|
32
|
+
readonly cache_read: Check<number>;
|
|
33
|
+
readonly cache_write: Check<number>;
|
|
34
|
+
}> | null>;
|
|
35
|
+
readonly duration: Check<number | null>;
|
|
36
|
+
readonly files: Check<import("./check.js").Shaped<{
|
|
37
|
+
readonly count: Check<number>;
|
|
38
|
+
readonly added: Check<number>;
|
|
39
|
+
readonly removed: Check<number>;
|
|
40
|
+
}>>;
|
|
41
|
+
readonly branch: Check<string | null>;
|
|
42
|
+
readonly worktree: Check<string | null>;
|
|
43
|
+
readonly pull: Check<import("./check.js").Shaped<{
|
|
44
|
+
readonly number: Check<number>;
|
|
45
|
+
readonly url: Check<string>;
|
|
46
|
+
}> | null>;
|
|
47
|
+
readonly model: Check<string | null>;
|
|
48
|
+
readonly effort: Check<string | null>;
|
|
49
|
+
readonly mode: Check<string | null>;
|
|
50
|
+
readonly suggestion: Check<string | null>;
|
|
51
|
+
readonly running: Check<readonly import("./check.js").Shaped<{
|
|
52
|
+
readonly kind: Check<"monitor" | "schedule" | "shell" | "subagent" | "task">;
|
|
53
|
+
readonly count: Check<number>;
|
|
54
|
+
}>[]>;
|
|
55
|
+
}>>;
|
|
56
|
+
export type SessionState = Checked<typeof STATE>;
|
|
57
|
+
export declare const isState: Check<SessionState>;
|
|
58
|
+
export declare function standingState(state: SessionState, saved: string, ended: string | null): SessionState;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { type Check, type Checked } from './check.js';
|
|
2
|
+
import { type Part } from './parts.js';
|
|
3
|
+
declare const OPERATION: Check<import("./check.js").Shaped<{
|
|
4
|
+
readonly op: Check<"start">;
|
|
5
|
+
readonly index: Check<number>;
|
|
6
|
+
readonly part: Check<import("./check.js").Shaped<{
|
|
7
|
+
readonly type: Check<"text">;
|
|
8
|
+
readonly text: Check<string>;
|
|
9
|
+
}> | import("./check.js").Shaped<{
|
|
10
|
+
readonly commands: Check<number>;
|
|
11
|
+
readonly edited: Check<number>;
|
|
12
|
+
readonly other: Check<number>;
|
|
13
|
+
readonly added: Check<number>;
|
|
14
|
+
readonly removed: Check<number>;
|
|
15
|
+
readonly failed: Check<number>;
|
|
16
|
+
readonly type: Check<"counts">;
|
|
17
|
+
}> | import("./check.js").Shaped<{
|
|
18
|
+
readonly type: Check<"image">;
|
|
19
|
+
readonly file: Check<string>;
|
|
20
|
+
readonly name: Check<string>;
|
|
21
|
+
readonly media_type: Check<string>;
|
|
22
|
+
}> | import("./check.js").Shaped<{
|
|
23
|
+
readonly type: Check<"notice">;
|
|
24
|
+
readonly kind: Check<"compaction" | "error" | "info" | "mode" | "model" | "retry" | "warning">;
|
|
25
|
+
readonly text: Check<string>;
|
|
26
|
+
}>>;
|
|
27
|
+
}> | import("./check.js").Shaped<{
|
|
28
|
+
readonly op: Check<"append">;
|
|
29
|
+
readonly index: Check<number>;
|
|
30
|
+
readonly text: Check<string>;
|
|
31
|
+
}> | import("./check.js").Shaped<{
|
|
32
|
+
readonly op: Check<"set">;
|
|
33
|
+
readonly index: Check<number>;
|
|
34
|
+
readonly part: Check<import("./check.js").Shaped<{
|
|
35
|
+
readonly type: Check<"text">;
|
|
36
|
+
readonly text: Check<string>;
|
|
37
|
+
}> | import("./check.js").Shaped<{
|
|
38
|
+
readonly commands: Check<number>;
|
|
39
|
+
readonly edited: Check<number>;
|
|
40
|
+
readonly other: Check<number>;
|
|
41
|
+
readonly added: Check<number>;
|
|
42
|
+
readonly removed: Check<number>;
|
|
43
|
+
readonly failed: Check<number>;
|
|
44
|
+
readonly type: Check<"counts">;
|
|
45
|
+
}> | import("./check.js").Shaped<{
|
|
46
|
+
readonly type: Check<"image">;
|
|
47
|
+
readonly file: Check<string>;
|
|
48
|
+
readonly name: Check<string>;
|
|
49
|
+
readonly media_type: Check<string>;
|
|
50
|
+
}> | import("./check.js").Shaped<{
|
|
51
|
+
readonly type: Check<"notice">;
|
|
52
|
+
readonly kind: Check<"compaction" | "error" | "info" | "mode" | "model" | "retry" | "warning">;
|
|
53
|
+
readonly text: Check<string>;
|
|
54
|
+
}>>;
|
|
55
|
+
}>>;
|
|
56
|
+
export type Operation = Checked<typeof OPERATION>;
|
|
57
|
+
export declare const isOperation: Check<Operation>;
|
|
58
|
+
declare const TURN: Check<import("./check.js").Shaped<{
|
|
59
|
+
readonly parts: Check<readonly (import("./check.js").Shaped<{
|
|
60
|
+
readonly type: Check<"text">;
|
|
61
|
+
readonly text: Check<string>;
|
|
62
|
+
}> | import("./check.js").Shaped<{
|
|
63
|
+
readonly commands: Check<number>;
|
|
64
|
+
readonly edited: Check<number>;
|
|
65
|
+
readonly other: Check<number>;
|
|
66
|
+
readonly added: Check<number>;
|
|
67
|
+
readonly removed: Check<number>;
|
|
68
|
+
readonly failed: Check<number>;
|
|
69
|
+
readonly type: Check<"counts">;
|
|
70
|
+
}> | import("./check.js").Shaped<{
|
|
71
|
+
readonly type: Check<"image">;
|
|
72
|
+
readonly file: Check<string>;
|
|
73
|
+
readonly name: Check<string>;
|
|
74
|
+
readonly media_type: Check<string>;
|
|
75
|
+
}> | import("./check.js").Shaped<{
|
|
76
|
+
readonly type: Check<"notice">;
|
|
77
|
+
readonly kind: Check<"compaction" | "error" | "info" | "mode" | "model" | "retry" | "warning">;
|
|
78
|
+
readonly text: Check<string>;
|
|
79
|
+
}>)[]>;
|
|
80
|
+
readonly tokens: Check<import("./check.js").Shaped<{
|
|
81
|
+
readonly input: Check<number>;
|
|
82
|
+
readonly output: Check<number>;
|
|
83
|
+
readonly cache_read: Check<number>;
|
|
84
|
+
readonly cache_write: Check<number>;
|
|
85
|
+
}> | null>;
|
|
86
|
+
readonly state: Check<import("./check.js").Shaped<{
|
|
87
|
+
readonly title: Check<string | null>;
|
|
88
|
+
readonly context: Check<import("./check.js").Shaped<{
|
|
89
|
+
readonly used: Check<number>;
|
|
90
|
+
readonly window: Check<number>;
|
|
91
|
+
readonly breakdown: Check<readonly import("./check.js").Shaped<{
|
|
92
|
+
readonly name: Check<string>;
|
|
93
|
+
readonly tokens: Check<number>;
|
|
94
|
+
}>[]>;
|
|
95
|
+
}> | null>;
|
|
96
|
+
readonly limits: Check<readonly import("./check.js").Shaped<{
|
|
97
|
+
readonly name: Check<string | null>;
|
|
98
|
+
readonly minutes: Check<number>;
|
|
99
|
+
readonly percent: Check<number>;
|
|
100
|
+
readonly resets: Check<string | null>;
|
|
101
|
+
}>[]>;
|
|
102
|
+
readonly cost: Check<import("./check.js").Shaped<{
|
|
103
|
+
readonly amount: Check<number>;
|
|
104
|
+
readonly currency: Check<string>;
|
|
105
|
+
}> | null>;
|
|
106
|
+
readonly tokens: Check<import("./check.js").Shaped<{
|
|
107
|
+
readonly input: Check<number>;
|
|
108
|
+
readonly output: Check<number>;
|
|
109
|
+
readonly cache_read: Check<number>;
|
|
110
|
+
readonly cache_write: Check<number>;
|
|
111
|
+
}> | null>;
|
|
112
|
+
readonly duration: Check<number | null>;
|
|
113
|
+
readonly files: Check<import("./check.js").Shaped<{
|
|
114
|
+
readonly count: Check<number>;
|
|
115
|
+
readonly added: Check<number>;
|
|
116
|
+
readonly removed: Check<number>;
|
|
117
|
+
}>>;
|
|
118
|
+
readonly branch: Check<string | null>;
|
|
119
|
+
readonly worktree: Check<string | null>;
|
|
120
|
+
readonly pull: Check<import("./check.js").Shaped<{
|
|
121
|
+
readonly number: Check<number>;
|
|
122
|
+
readonly url: Check<string>;
|
|
123
|
+
}> | null>;
|
|
124
|
+
readonly model: Check<string | null>;
|
|
125
|
+
readonly effort: Check<string | null>;
|
|
126
|
+
readonly mode: Check<string | null>;
|
|
127
|
+
readonly suggestion: Check<string | null>;
|
|
128
|
+
readonly running: Check<readonly import("./check.js").Shaped<{
|
|
129
|
+
readonly kind: Check<"monitor" | "schedule" | "shell" | "subagent" | "task">;
|
|
130
|
+
readonly count: Check<number>;
|
|
131
|
+
}>[]>;
|
|
132
|
+
}>>;
|
|
133
|
+
}>>;
|
|
134
|
+
export type Turn = Checked<typeof TURN>;
|
|
135
|
+
export declare const isTurn: Check<Turn>;
|
|
136
|
+
export declare function applied(parts: readonly Part[], operation: Operation): readonly Part[] | null;
|
|
137
|
+
export {};
|
package/dist/site.d.ts
CHANGED
package/dist/site.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"
|
|
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
|
@@ -1,16 +1,31 @@
|
|
|
1
|
+
import { HOUSE_ROOM_TYPES, HOUSE_TYPED_PATHS } from '@agentshouse/mdmodel';
|
|
1
2
|
import { actionOutcome } from './actions.js';
|
|
2
3
|
import { chunkedHead, chunkPart, siteChunkList } from './chunks.js';
|
|
3
4
|
import { mapDiscovery, parseSiteDiscovery, siteCapabilities, siteTracked, } from './discovery.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES } from './room-types.js';
|
|
5
|
+
import { answeredFailure, discoveryFailure } from './refusal.js';
|
|
6
|
+
import { admittedPath } from './authored-path.js';
|
|
7
|
+
import { siteQuery } from './room-query.js';
|
|
8
8
|
import { houseNotifications } from './stream.js';
|
|
9
|
-
import { houseSiteRoute,
|
|
9
|
+
import { houseSiteRoute, SITE_DOOR_ACTS, SITE_DOOR_TOOL, SITE_FILES, } from './transport.js';
|
|
10
|
+
import { UNANSWERED, unusable } from './uncertain.js';
|
|
10
11
|
import { followsVersion, reachedVersion, roomVersion } from './version.js';
|
|
11
|
-
|
|
12
|
+
function siteDoorRequest(request) {
|
|
13
|
+
const { op, ...input } = (request.input ?? {});
|
|
14
|
+
if (request.name !== SITE_DOOR_TOOL || typeof op !== 'string')
|
|
15
|
+
return request;
|
|
16
|
+
const named = Object.entries(SITE_DOOR_ACTS).find(([, act]) => act.op === op);
|
|
17
|
+
return named === undefined ? request : { ...request, name: named[0], input };
|
|
18
|
+
}
|
|
12
19
|
function unfound() {
|
|
13
|
-
return { kind: 'rejected', code: '
|
|
20
|
+
return { kind: 'rejected', code: 'not_found', fields: {}, retryable: false };
|
|
21
|
+
}
|
|
22
|
+
function siteCopies(copies) {
|
|
23
|
+
if (copies === null || copies === undefined)
|
|
24
|
+
return [];
|
|
25
|
+
return copies.split(', ').map((offered) => {
|
|
26
|
+
const [url = '', width = ''] = offered.split(' ');
|
|
27
|
+
return { url, width: Number.parseInt(width, 10) };
|
|
28
|
+
});
|
|
14
29
|
}
|
|
15
30
|
function siteRoom(tracked) {
|
|
16
31
|
return {
|
|
@@ -20,18 +35,19 @@ function siteRoom(tracked) {
|
|
|
20
35
|
roomVersion: roomVersion(tracked),
|
|
21
36
|
operations: { write: [], erase: [] },
|
|
22
37
|
replica: { selection: tracked.locator, admission: 'admitted', offline: 'open' },
|
|
38
|
+
typedSelection: null,
|
|
23
39
|
providerOwnedPaths: [],
|
|
40
|
+
authoredPaths: ['**'],
|
|
24
41
|
};
|
|
25
42
|
}
|
|
26
43
|
export function createSiteAdapter(transport, snapshot = false) {
|
|
27
|
-
const spaces = spaceSchemas();
|
|
28
44
|
const notifications = houseNotifications(transport, 'site', {
|
|
29
45
|
opened: async () => {
|
|
30
46
|
const found = await discovered();
|
|
31
47
|
return found.kind === 'discovery' ? found : null;
|
|
32
48
|
},
|
|
33
49
|
changed: () => null,
|
|
34
|
-
}
|
|
50
|
+
});
|
|
35
51
|
const tracked = new Map();
|
|
36
52
|
const chunked = new Map();
|
|
37
53
|
function fileRoute(request) {
|
|
@@ -45,7 +61,7 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
45
61
|
const listed = siteChunkList(await transport.read(`${houseSiteRoute('chunks')}/${entry.authority}${past === undefined ? '' : `?expired=${past}`}`), entry.locator);
|
|
46
62
|
if ('kind' in listed)
|
|
47
63
|
return listed;
|
|
48
|
-
const head = await chunkedHead(listed, entry
|
|
64
|
+
const head = await chunkedHead(listed, entry);
|
|
49
65
|
if (head.kind === 'bootstrap')
|
|
50
66
|
chunked.set(entry.locator, listed);
|
|
51
67
|
return head;
|
|
@@ -54,10 +70,10 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
54
70
|
const room = chunked.get(entry.locator);
|
|
55
71
|
const address = room?.chunks.get(id);
|
|
56
72
|
if (room === undefined || address === undefined)
|
|
57
|
-
return
|
|
73
|
+
return UNANSWERED;
|
|
58
74
|
const read = await transport.download(address.url);
|
|
59
75
|
if (read.status !== 200)
|
|
60
|
-
return
|
|
76
|
+
return answeredFailure(read.status, null);
|
|
61
77
|
return chunkPart(read.body, room, id, arriving);
|
|
62
78
|
}
|
|
63
79
|
async function discovered() {
|
|
@@ -67,19 +83,26 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
67
83
|
return failed;
|
|
68
84
|
const document = parseSiteDiscovery(answer.body);
|
|
69
85
|
if (document === null)
|
|
70
|
-
return
|
|
86
|
+
return unusable();
|
|
71
87
|
const entries = siteTracked(document);
|
|
72
88
|
tracked.clear();
|
|
73
89
|
for (const entry of entries)
|
|
74
90
|
tracked.set(entry.locator, entry);
|
|
75
91
|
notifications.track(entries);
|
|
76
|
-
return
|
|
92
|
+
return {
|
|
93
|
+
...mapDiscovery(document, entries.map(siteRoom), siteCapabilities()),
|
|
94
|
+
queriesOnly: document.queriesOnly.map(({ roomRef, roomHandle }) => ({
|
|
95
|
+
locator: roomRef,
|
|
96
|
+
handle: roomHandle,
|
|
97
|
+
name: roomHandle,
|
|
98
|
+
})),
|
|
99
|
+
};
|
|
77
100
|
}
|
|
78
101
|
return {
|
|
79
102
|
localSaves: true,
|
|
80
103
|
roomTypes: HOUSE_ROOM_TYPES,
|
|
81
|
-
nameableRoomTypes: HOUSE_NAMEABLE_ROOM_TYPES,
|
|
82
104
|
typedPaths: HOUSE_TYPED_PATHS,
|
|
105
|
+
pathRule: admittedPath,
|
|
83
106
|
async authorize() {
|
|
84
107
|
return {};
|
|
85
108
|
},
|
|
@@ -99,7 +122,7 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
99
122
|
if (entry === undefined)
|
|
100
123
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
101
124
|
if (request.pageToken !== undefined)
|
|
102
|
-
return
|
|
125
|
+
return UNANSWERED;
|
|
103
126
|
return request.fromRoomVersion === roomVersion(entry)
|
|
104
127
|
? { kind: 'still-current' }
|
|
105
128
|
: { kind: 'beyond-horizon' };
|
|
@@ -115,6 +138,7 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
115
138
|
async history() {
|
|
116
139
|
return { kind: 'no-history' };
|
|
117
140
|
},
|
|
141
|
+
queryHouse: (_authorization, request) => siteQuery(transport, request),
|
|
118
142
|
async binary(_authorization, request) {
|
|
119
143
|
const route = fileRoute(request);
|
|
120
144
|
if (typeof route !== 'string')
|
|
@@ -122,11 +146,21 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
122
146
|
const read = await transport.download(route);
|
|
123
147
|
if (read.status === 404)
|
|
124
148
|
return unfound();
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
149
|
+
if (read.status !== 200)
|
|
150
|
+
return answeredFailure(read.status, null);
|
|
151
|
+
if (read.body === null)
|
|
152
|
+
return unusable();
|
|
153
|
+
return {
|
|
154
|
+
kind: 'binary',
|
|
155
|
+
body: read.body,
|
|
156
|
+
mediaType: read.mediaType,
|
|
157
|
+
url: route,
|
|
158
|
+
copies: siteCopies(read.copies),
|
|
159
|
+
};
|
|
128
160
|
},
|
|
129
161
|
async link(_authorization, request) {
|
|
162
|
+
if (request.kind === 'key')
|
|
163
|
+
return unfound();
|
|
130
164
|
const route = fileRoute(request);
|
|
131
165
|
if (typeof route !== 'string')
|
|
132
166
|
return route;
|
|
@@ -142,8 +176,12 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
142
176
|
follows(_locator, version, next) {
|
|
143
177
|
return followsVersion(version, next);
|
|
144
178
|
},
|
|
145
|
-
async action(_authorization,
|
|
146
|
-
|
|
179
|
+
async action(_authorization, asked) {
|
|
180
|
+
const request = siteDoorRequest(asked);
|
|
181
|
+
const route = Object.hasOwn(SITE_DOOR_ACTS, request.name)
|
|
182
|
+
? SITE_DOOR_ACTS[request.name].route
|
|
183
|
+
: null;
|
|
184
|
+
if (route === null) {
|
|
147
185
|
return {
|
|
148
186
|
kind: 'rejected',
|
|
149
187
|
code: 'action-unimplemented',
|
|
@@ -152,8 +190,8 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
152
190
|
};
|
|
153
191
|
}
|
|
154
192
|
if (!transport.online())
|
|
155
|
-
return
|
|
156
|
-
return actionOutcome(await transport.door(
|
|
193
|
+
return UNANSWERED;
|
|
194
|
+
return actionOutcome(await transport.door(route, request.input), request.name, request.input);
|
|
157
195
|
},
|
|
158
196
|
roomStream: snapshot
|
|
159
197
|
? undefined
|
package/dist/space-schema.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space-schema.d.ts","sourceRoot":"","sources":["../src/space-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"space-schema.d.ts","sourceRoot":"","sources":["../src/space-schema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC1D,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3D,CAAC;AAEF,wBAAgB,YAAY,IAAI,YAAY,CAO3C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
package/dist/space-schema.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
const HELD_TEXTS = 16;
|
|
2
1
|
export function spaceSchemas() {
|
|
3
2
|
const texts = new Map();
|
|
4
3
|
const key = (space, revision) => `${space} ${revision}`;
|
|
5
4
|
return {
|
|
6
5
|
held: (space, revision) => texts.get(key(space, revision)),
|
|
7
|
-
keep(space, revision, text)
|
|
8
|
-
const named = key(space, revision);
|
|
9
|
-
texts.delete(named);
|
|
10
|
-
texts.set(named, text);
|
|
11
|
-
if (texts.size > HELD_TEXTS)
|
|
12
|
-
texts.delete(texts.keys().next().value);
|
|
13
|
-
},
|
|
6
|
+
keep: (space, revision, text) => void texts.set(key(space, revision), text),
|
|
14
7
|
};
|
|
15
8
|
}
|
|
16
9
|
export function spaceIdentity(space) {
|
package/dist/stream.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
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
|
-
import type { SpaceSchemas } from './space-schema.js';
|
|
4
3
|
import { type HouseDoor, type HouseMode, type HouseStreamFrame } from './transport.js';
|
|
5
4
|
export type HouseOpeningFrame = Extract<HouseStreamFrame, {
|
|
6
5
|
type: 'opening';
|
|
@@ -11,7 +10,7 @@ export type HouseAuthorityChangedFrame = Extract<HouseStreamFrame, {
|
|
|
11
10
|
export type HouseDiscovering = {
|
|
12
11
|
opened(frame: HouseOpeningFrame | null): Promise<Discovery | null>;
|
|
13
12
|
changed(frame: HouseAuthorityChangedFrame): AuthorityChange | null;
|
|
14
|
-
expired?(
|
|
13
|
+
expired?(entries: readonly TrackedAuthority[]): void;
|
|
15
14
|
};
|
|
16
15
|
export type HouseNotifications = {
|
|
17
16
|
runtime: string;
|
|
@@ -19,7 +18,7 @@ export type HouseNotifications = {
|
|
|
19
18
|
send(rooms: readonly HeldRoom[]): void;
|
|
20
19
|
track(authorities: readonly TrackedAuthority[]): void;
|
|
21
20
|
conversations: ConversationStream;
|
|
21
|
+
runs: RunStream;
|
|
22
22
|
serviceMode: ServiceModeSignal;
|
|
23
23
|
};
|
|
24
|
-
export declare function houseNotifications(transport: HouseDoor, mode: HouseMode, discovering: HouseDiscovering
|
|
25
|
-
//# sourceMappingURL=stream.d.ts.map
|
|
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.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,eAAe,EAEpB,KAAK,SAAS,EACd,KAAK,kBAAkB,EAEvB,KAAK,QAAQ,EAIb,KAAK,eAAe,EAGpB,KAAK,SAAS,EAEd,KAAK,iBAAiB,EAEvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAYvD,OAAO,EACL,KAAK,SAAS,EAGd,KAAK,SAAS,EAGd,KAAK,gBAAgB,EAEtB,MAAM,gBAAgB,CAAC;AAaxB,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AAE/E,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAAC;AAElG,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IACnE,OAAO,CAAC,KAAK,EAAE,0BAA0B,GAAG,eAAe,GAAG,IAAI,CAAC;IACnE,OAAO,CAAC,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC9D,IAAI,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,IAAI,CAAC;IACvC,KAAK,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtD,aAAa,EAAE,kBAAkB,CAAC;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,iBAAiB,CAAC;CAChC,CAAC;AA8GF,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,SAAS,EACf,WAAW,EAAE,gBAAgB,GAC5B,kBAAkB,CAuapB"}
|