@agentshouse/mdruntime-adapter 0.1.0-cc449e4611fbd → 0.1.0-cc5c81586317a
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 +6 -1
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +95 -9
- package/dist/adapter.d.ts +0 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +181 -185
- 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 +36 -0
- package/dist/chunks.d.ts.map +1 -0
- package/dist/chunks.js +281 -0
- package/dist/digest.d.ts +0 -1
- package/dist/discovery.d.ts +32 -7
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +203 -29
- package/dist/history.d.ts +1 -7
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +22 -29
- package/dist/index.d.ts +7 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/map.d.ts +0 -1
- package/dist/model.d.ts +6 -9
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +28 -26
- package/dist/read.d.ts +20 -28
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +106 -202
- 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 +5 -5
- 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 +82 -60
- package/dist/space-schema.d.ts +6 -0
- package/dist/space-schema.d.ts.map +1 -0
- package/dist/space-schema.js +11 -0
- package/dist/stream.d.ts +4 -4
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +150 -79
- package/dist/transport.d.ts +67 -32
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +52 -17
- 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 +1 -4
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +32 -39
- 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 -892
- package/dist/house-model.d.ts.map +0 -1
- package/dist/house-model.js +0 -482
- package/dist/part.d.ts +0 -14
- package/dist/part.d.ts.map +0 -1
- package/dist/part.js +0 -90
- package/dist/room-stream.d.ts +0 -20
- package/dist/room-stream.d.ts.map +0 -1
- package/dist/room-stream.js +0 -78
- package/dist/room-types.d.ts +0 -7
- package/dist/room-types.d.ts.map +0 -1
- package/dist/room-types.js +0 -125
package/README.md
CHANGED
|
@@ -20,12 +20,12 @@ import { createAgentsHouseAdapter } from '@agentshouse/mdruntime-adapter';
|
|
|
20
20
|
|
|
21
21
|
const adapter = createAgentsHouseAdapter({ transport, authorize });
|
|
22
22
|
const host = serveMdRuntime({ adapter, shell });
|
|
23
|
-
host.attach(port, 'my-app');
|
|
23
|
+
host.attach(port, { app: 'my-app' });
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
App code never imports this package; it reaches the Runtime only through the
|
|
27
27
|
client its host hands it. The rules an App's agent follows are the `apps/` pages
|
|
28
|
-
of House's Guide, which House's `
|
|
28
|
+
of House's Guide, which House's `guide` tool opens.
|
|
29
29
|
|
|
30
30
|
## License
|
|
31
31
|
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { ActionDeclaration, ActionRequest, ActionResult } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { HouseDoorAnswer, HouseTransport } from './transport.js';
|
|
3
3
|
export type HouseActDoor = Pick<HouseTransport, 'door'>;
|
|
4
|
+
export declare const HOUSE_UNKEPT_READS: readonly string[];
|
|
5
|
+
export declare const HOUSE_LEADING_READS: readonly string[];
|
|
6
|
+
export declare const HOUSE_RENAMED_UNTIL_2026_12_18: ReadonlyMap<string, string>;
|
|
7
|
+
export declare const HOUSE_REWRITTEN_UNTIL_2026_12_19: ReadonlyMap<string, (input: unknown) => unknown>;
|
|
8
|
+
export declare const HOUSE_RENAMED_UNTIL_2026_12_21: ReadonlyMap<string, string>;
|
|
9
|
+
export declare const HOUSE_REWRITTEN_UNTIL_2026_12_21: ReadonlyMap<string, (input: unknown) => unknown>;
|
|
4
10
|
export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
|
|
5
11
|
export declare function houseAction(transport: HouseActDoor, request: ActionRequest): Promise<ActionResult>;
|
|
6
12
|
export declare function actionOutcome(answer: HouseDoorAnswer, name: string, input: unknown): ActionResult;
|
|
7
|
-
//# sourceMappingURL=actions.d.ts.map
|
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,CAErE,CAAC;AAQH,eAAO,MAAM,gCAAgC,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CACvD,CAAC;AAExC,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAWrE,CAAC;AA4BH,eAAO,MAAM,gCAAgC,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAY1F,CAAC;AAUL,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,6 +1,85 @@
|
|
|
1
|
-
import { doorRefusal } from './refusal.js';
|
|
1
|
+
import { answeredFailure, doorRefusal, resetOf } from './refusal.js';
|
|
2
|
+
import { movedPaths, renamedHandle } from './renamed.js';
|
|
3
|
+
import { refusedFor } from './uncertain.js';
|
|
4
|
+
export const HOUSE_UNKEPT_READS = [
|
|
5
|
+
'account/security/read',
|
|
6
|
+
'billing/read',
|
|
7
|
+
'clients/last-use/list',
|
|
8
|
+
];
|
|
9
|
+
export const HOUSE_LEADING_READS = [
|
|
10
|
+
'app.list',
|
|
11
|
+
'apps/list',
|
|
12
|
+
'sites/list',
|
|
13
|
+
'rooms/members/list',
|
|
14
|
+
'sharing.members',
|
|
15
|
+
];
|
|
16
|
+
export const HOUSE_RENAMED_UNTIL_2026_12_18 = new Map([
|
|
17
|
+
['files/batch', 'update'],
|
|
18
|
+
]);
|
|
19
|
+
function withoutRoomRef(input) {
|
|
20
|
+
if (typeof input !== 'object' || input === null || !('room_ref' in input))
|
|
21
|
+
return input;
|
|
22
|
+
const { room_ref: _room, ...paths } = input;
|
|
23
|
+
return paths;
|
|
24
|
+
}
|
|
25
|
+
export const HOUSE_REWRITTEN_UNTIL_2026_12_19 = new Map([['update', withoutRoomRef]]);
|
|
26
|
+
export const HOUSE_RENAMED_UNTIL_2026_12_21 = new Map([
|
|
27
|
+
['apps/create', 'app_update'],
|
|
28
|
+
['apps/upload', 'app_update'],
|
|
29
|
+
['shares/accept', 'sharing_update'],
|
|
30
|
+
['shares/decline', 'sharing_update'],
|
|
31
|
+
['shares/join-requests/approve', 'sharing_update'],
|
|
32
|
+
['shares/join-requests/decline', 'sharing_update'],
|
|
33
|
+
['rooms/ownership/offer', 'sharing_update'],
|
|
34
|
+
['rooms/ownership/accept', 'sharing_update'],
|
|
35
|
+
['rooms/ownership/decline', 'sharing_update'],
|
|
36
|
+
['rooms/instructions/follow', 'sharing_update'],
|
|
37
|
+
]);
|
|
38
|
+
function held(input) {
|
|
39
|
+
return typeof input === 'object' && input !== null
|
|
40
|
+
? { ...input }
|
|
41
|
+
: {};
|
|
42
|
+
}
|
|
43
|
+
function created(input) {
|
|
44
|
+
return { op: 'create', ...held(input) };
|
|
45
|
+
}
|
|
46
|
+
function uploaded(input) {
|
|
47
|
+
const { app_ref: app, ...files } = held(input);
|
|
48
|
+
return { op: 'publish', app, ...files };
|
|
49
|
+
}
|
|
50
|
+
function decided(op) {
|
|
51
|
+
return (input) => ({ op, ...held(input) });
|
|
52
|
+
}
|
|
53
|
+
function roomNamed(op) {
|
|
54
|
+
return (input) => {
|
|
55
|
+
const { room_ref: room, ...named } = held(input);
|
|
56
|
+
return { op, room, ...named };
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export const HOUSE_REWRITTEN_UNTIL_2026_12_21 = new Map([
|
|
60
|
+
['apps/create', created],
|
|
61
|
+
['apps/upload', uploaded],
|
|
62
|
+
['shares/accept', decided('share_accept')],
|
|
63
|
+
['shares/decline', decided('share_decline')],
|
|
64
|
+
['shares/join-requests/approve', decided('join_request_approve')],
|
|
65
|
+
['shares/join-requests/decline', decided('join_request_decline')],
|
|
66
|
+
['rooms/ownership/offer', roomNamed('ownership_offer')],
|
|
67
|
+
['rooms/ownership/accept', decided('ownership_accept')],
|
|
68
|
+
['rooms/ownership/decline', decided('ownership_decline')],
|
|
69
|
+
['rooms/instructions/follow', roomNamed('instructions_follow')],
|
|
70
|
+
]);
|
|
71
|
+
const ROOM_SELECTORS = new Map([
|
|
72
|
+
['update', { room: 'changes.room', roomPaths: ['changes.path', 'changes.to', 'paths', 'mount'] }],
|
|
73
|
+
['sharing', { room: 'room' }],
|
|
74
|
+
['sharing_update', { room: 'room' }],
|
|
75
|
+
]);
|
|
2
76
|
export function declaredActions(routes) {
|
|
3
|
-
return routes.map((name) => ({
|
|
77
|
+
return routes.map((name) => ({
|
|
78
|
+
name,
|
|
79
|
+
inputShape: {},
|
|
80
|
+
resultKind: 'house',
|
|
81
|
+
...(ROOM_SELECTORS.get(name) ?? { room: 'room_ref' }),
|
|
82
|
+
}));
|
|
4
83
|
}
|
|
5
84
|
export function houseAction(transport, request) {
|
|
6
85
|
const route = routeOf(request.name);
|
|
@@ -32,17 +111,24 @@ export function actionOutcome(answer, name, input) {
|
|
|
32
111
|
if (answer.status === 401)
|
|
33
112
|
return { kind: 'revoked-authorization' };
|
|
34
113
|
const refusal = doorRefusal(answer.body);
|
|
35
|
-
if (refusal?.code === 'operation_contended' && numbered(input))
|
|
36
|
-
return
|
|
114
|
+
if (refusal?.code === 'operation_contended' && numbered(input))
|
|
115
|
+
return refusedFor(refusal);
|
|
116
|
+
if (refusal !== null) {
|
|
117
|
+
const reset = resetOf(refusal);
|
|
118
|
+
return { kind: 'rejected', ...refusal, ...(reset === undefined ? {} : { reset }) };
|
|
37
119
|
}
|
|
38
|
-
if (refusal !== null)
|
|
39
|
-
return { kind: 'rejected', ...refusal };
|
|
40
120
|
if (answer.status === 404)
|
|
41
121
|
return unimplemented(name);
|
|
42
|
-
if (answer.status === 0 || answer.status >= 400)
|
|
43
|
-
return
|
|
122
|
+
if (answer.status === 0 || answer.status >= 400) {
|
|
123
|
+
return answeredFailure(answer.status, answer.body);
|
|
124
|
+
}
|
|
44
125
|
return { kind: 'action', result: answer.body };
|
|
45
126
|
}
|
|
46
127
|
async function carry(transport, route, name, input) {
|
|
47
|
-
|
|
128
|
+
const answered = actionOutcome(await transport.door(route, input), name, input);
|
|
129
|
+
const renamed = renamedHandle(answered);
|
|
130
|
+
if (renamed === null)
|
|
131
|
+
return answered;
|
|
132
|
+
const moved = movedPaths(input, ROOM_SELECTORS.get(name)?.roomPaths ?? [], renamed);
|
|
133
|
+
return actionOutcome(await transport.door(route, moved), name, moved);
|
|
48
134
|
}
|
package/dist/adapter.d.ts
CHANGED
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,OAAO,EAIP,aAAa,EAkBd,MAAM,wBAAwB,CAAC;AAkChC,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAoBxB,MAAM,MAAM,yBAAyB,GACjC;IACE,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC,GACD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAcrD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CA8cpF"}
|