@agentshouse/mdruntime-adapter 0.1.0-c9a7eb70810a7 → 0.1.0-c9b6485a8bc8c
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 +9 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +179 -5
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +31 -16
- 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/site.d.ts.map +1 -1
- package/dist/site.js +11 -3
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +21 -0
- package/dist/transport.d.ts +26 -4
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +9 -8
- 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,15 @@ import type { HouseDoorAnswer, HouseTransport } from './transport.js';
|
|
|
3
3
|
export type HouseActDoor = Pick<HouseTransport, 'door'>;
|
|
4
4
|
export declare const HOUSE_UNKEPT_READS: readonly string[];
|
|
5
5
|
export declare const HOUSE_LEADING_READS: readonly string[];
|
|
6
|
+
export declare const HOUSE_RENAMED_UNTIL_2026_12_18: ReadonlyMap<string, string>;
|
|
7
|
+
type Rewrites = ReadonlyMap<string, (input: unknown) => unknown>;
|
|
8
|
+
export declare const HOUSE_REWRITTEN_UNTIL_2026_12_19: Rewrites;
|
|
9
|
+
export declare const HOUSE_RENAMED_UNTIL_2026_12_21: ReadonlyMap<string, string>;
|
|
10
|
+
export declare const HOUSE_REWRITTEN_UNTIL_2026_12_21: Rewrites;
|
|
11
|
+
export declare const HOUSE_RENAMED_UNTIL_2026_12_22: ReadonlyMap<string, string>;
|
|
12
|
+
export declare const HOUSE_REWRITTEN_UNTIL_2026_12_22: Rewrites;
|
|
13
|
+
export declare function rewrittenInTurn(...rewrites: readonly Rewrites[]): Rewrites;
|
|
6
14
|
export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
|
|
7
15
|
export declare function houseAction(transport: HouseActDoor, request: ActionRequest): Promise<ActionResult>;
|
|
8
16
|
export declare function actionOutcome(answer: HouseDoorAnswer, name: string, input: unknown): ActionResult;
|
|
17
|
+
export {};
|
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;AAgCH,KAAK,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC;AAEjE,eAAO,MAAM,gCAAgC,EAAE,QAAgD,CAAC;AAEhG,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAkBrE,CAAC;AAsDH,eAAO,MAAM,gCAAgC,EAAE,QAmB7C,CAAC;AAEH,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAYrE,CAAC;AAEH,eAAO,MAAM,gCAAgC,EAAE,QAe7C,CAAC;AAEH,wBAAgB,eAAe,CAAC,GAAG,QAAQ,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ,CAQ1E;AAcD,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,186 @@
|
|
|
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_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
|
+
const CURRENT_OPS = new Map([
|
|
26
|
+
['create', 'write'],
|
|
27
|
+
['replace', 'write'],
|
|
28
|
+
['patch', 'edit'],
|
|
29
|
+
['rename', 'move'],
|
|
30
|
+
['remove', 'delete'],
|
|
31
|
+
['create_folder', 'mkdir'],
|
|
32
|
+
['remove_folder', 'delete'],
|
|
33
|
+
]);
|
|
34
|
+
function withCurrentOps(input) {
|
|
35
|
+
if (typeof input !== 'object' || input === null || !('changes' in input))
|
|
36
|
+
return input;
|
|
37
|
+
const { changes } = input;
|
|
38
|
+
if (!Array.isArray(changes))
|
|
39
|
+
return input;
|
|
40
|
+
return {
|
|
41
|
+
...input,
|
|
42
|
+
changes: changes.map((change) => {
|
|
43
|
+
if (typeof change !== 'object' || change === null || !('op' in change))
|
|
44
|
+
return change;
|
|
45
|
+
const op = CURRENT_OPS.get(change.op);
|
|
46
|
+
return op === undefined ? change : { ...change, op };
|
|
47
|
+
}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export const HOUSE_REWRITTEN_UNTIL_2026_12_19 = new Map([['update', withoutRoomRef]]);
|
|
51
|
+
export const HOUSE_RENAMED_UNTIL_2026_12_21 = new Map([
|
|
52
|
+
['apps/create', 'app_update'],
|
|
53
|
+
['apps/upload', 'app_update'],
|
|
54
|
+
['shares/accept', 'sharing_update'],
|
|
55
|
+
['shares/decline', 'sharing_update'],
|
|
56
|
+
['shares/join-requests/approve', 'sharing_update'],
|
|
57
|
+
['shares/join-requests/decline', 'sharing_update'],
|
|
58
|
+
['rooms/ownership/offer', 'sharing_update'],
|
|
59
|
+
['rooms/ownership/accept', 'sharing_update'],
|
|
60
|
+
['rooms/ownership/decline', 'sharing_update'],
|
|
61
|
+
['rooms/instructions/follow', 'sharing_update'],
|
|
62
|
+
['agents/standing-answer/set', 'agent_update'],
|
|
63
|
+
['agents/ask-afk/set', 'agent_update'],
|
|
64
|
+
['environments/sign-in', 'environment_update'],
|
|
65
|
+
['environments/rooms/set', 'environment_update'],
|
|
66
|
+
['environments/login-code/create', 'environment_update'],
|
|
67
|
+
['environments/login-code/create-reusable', 'environment_update'],
|
|
68
|
+
['environments/login-code/cancel', 'environment_update'],
|
|
69
|
+
]);
|
|
70
|
+
function held(input) {
|
|
71
|
+
return typeof input === 'object' && input !== null
|
|
72
|
+
? { ...input }
|
|
73
|
+
: {};
|
|
74
|
+
}
|
|
75
|
+
function created(input) {
|
|
76
|
+
return { op: 'create', ...held(input) };
|
|
77
|
+
}
|
|
78
|
+
function uploaded(input) {
|
|
79
|
+
const { app_ref: app, ...files } = held(input);
|
|
80
|
+
return { op: 'publish', app, ...files };
|
|
81
|
+
}
|
|
82
|
+
function decided(op) {
|
|
83
|
+
return (input) => ({ op, ...held(input) });
|
|
84
|
+
}
|
|
85
|
+
function reusable(input) {
|
|
86
|
+
return { op: 'login_code_create', reusable: true, ...held(input) };
|
|
87
|
+
}
|
|
88
|
+
function zoned(input) {
|
|
89
|
+
const { browser, ...named } = held(input);
|
|
90
|
+
return { op: 'set', ...named, ...(browser === undefined ? {} : { if_unset: browser }) };
|
|
91
|
+
}
|
|
92
|
+
function exported(input) {
|
|
93
|
+
const { room_refs: rooms, ...named } = held(input);
|
|
94
|
+
return { op: 'export', ...named, ...(rooms === undefined ? {} : { rooms }) };
|
|
95
|
+
}
|
|
96
|
+
function roomNamed(op) {
|
|
97
|
+
return (input) => {
|
|
98
|
+
const { room_ref: room, ...named } = held(input);
|
|
99
|
+
return { op, room, ...named };
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function appNamed(op) {
|
|
103
|
+
return (input) => {
|
|
104
|
+
const { app_ref: app, ...named } = held(input);
|
|
105
|
+
return { op, app, ...named };
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function askedAway(input) {
|
|
109
|
+
const { room_ref: room, afk, ...named } = held(input);
|
|
110
|
+
return { op: 'set', ...named, room, ask_afk: afk };
|
|
111
|
+
}
|
|
112
|
+
export const HOUSE_REWRITTEN_UNTIL_2026_12_21 = new Map([
|
|
113
|
+
['apps/create', created],
|
|
114
|
+
['apps/upload', uploaded],
|
|
115
|
+
['shares/accept', decided('share_accept')],
|
|
116
|
+
['shares/decline', decided('share_decline')],
|
|
117
|
+
['shares/join-requests/approve', decided('join_request_approve')],
|
|
118
|
+
['shares/join-requests/decline', decided('join_request_decline')],
|
|
119
|
+
['rooms/ownership/offer', roomNamed('ownership_offer')],
|
|
120
|
+
['rooms/ownership/accept', decided('ownership_accept')],
|
|
121
|
+
['rooms/ownership/decline', decided('ownership_decline')],
|
|
122
|
+
['rooms/instructions/follow', roomNamed('instructions_follow')],
|
|
123
|
+
['agents/standing-answer/set', roomNamed('standing_answer_set')],
|
|
124
|
+
['agents/ask-afk/set', askedAway],
|
|
125
|
+
['environments/sign-in', decided('sign_in')],
|
|
126
|
+
['environments/rooms/set', decided('set')],
|
|
127
|
+
['environments/login-code/create', decided('login_code_create')],
|
|
128
|
+
['environments/login-code/create-reusable', reusable],
|
|
129
|
+
['environments/login-code/cancel', decided('login_code_cancel')],
|
|
130
|
+
['update', withCurrentOps],
|
|
131
|
+
]);
|
|
132
|
+
export const HOUSE_RENAMED_UNTIL_2026_12_22 = new Map([
|
|
133
|
+
['account/security/browsers/revoke', 'account_update'],
|
|
134
|
+
['account/security/browsers/revoke-others', 'account_update'],
|
|
135
|
+
['account/time-zone/set', 'account_update'],
|
|
136
|
+
['account/who-can-add-me/set', 'account_update'],
|
|
137
|
+
['clients/revoke', 'account_update'],
|
|
138
|
+
['clients/rooms/set', 'account_update'],
|
|
139
|
+
['storage/archive', 'account_update'],
|
|
140
|
+
['billing/subscribe', 'account_update'],
|
|
141
|
+
['billing/top-up', 'account_update'],
|
|
142
|
+
['billing/manage', 'account_update'],
|
|
143
|
+
['apps/features/set', 'app_update'],
|
|
144
|
+
]);
|
|
145
|
+
export const HOUSE_REWRITTEN_UNTIL_2026_12_22 = new Map([
|
|
146
|
+
['account/security/browsers/revoke', decided('browser_revoke')],
|
|
147
|
+
[
|
|
148
|
+
'account/security/browsers/revoke-others',
|
|
149
|
+
(input) => ({ op: 'browser_revoke', ...held(input), others: true }),
|
|
150
|
+
],
|
|
151
|
+
['account/time-zone/set', zoned],
|
|
152
|
+
['account/who-can-add-me/set', decided('set')],
|
|
153
|
+
['clients/revoke', decided('client_revoke')],
|
|
154
|
+
['clients/rooms/set', decided('client_rooms_set')],
|
|
155
|
+
['storage/archive', exported],
|
|
156
|
+
['billing/subscribe', decided('subscribe')],
|
|
157
|
+
['billing/top-up', decided('top_up')],
|
|
158
|
+
['billing/manage', decided('billing_manage')],
|
|
159
|
+
['apps/features/set', appNamed('feature_set')],
|
|
160
|
+
]);
|
|
161
|
+
export function rewrittenInTurn(...rewrites) {
|
|
162
|
+
const names = new Set(rewrites.flatMap((each) => [...each.keys()]));
|
|
163
|
+
return new Map([...names].map((name) => [
|
|
164
|
+
name,
|
|
165
|
+
(input) => rewrites.reduce((held, each) => each.get(name)?.(held) ?? held, input),
|
|
166
|
+
]));
|
|
167
|
+
}
|
|
168
|
+
const ROOM_SELECTORS = new Map([
|
|
169
|
+
['update', { room: 'changes.room', roomPaths: ['changes.path', 'changes.to', 'paths', 'mount'] }],
|
|
170
|
+
['sharing', { room: 'room' }],
|
|
171
|
+
['sharing_update', { room: 'room' }],
|
|
172
|
+
['inbox_update', { room: 'room', roomPaths: ['path'] }],
|
|
173
|
+
['agent', { room: 'room' }],
|
|
174
|
+
['agent_update', { room: 'room' }],
|
|
175
|
+
['environment', { room: 'room' }],
|
|
176
|
+
]);
|
|
13
177
|
export function declaredActions(routes) {
|
|
14
|
-
return routes.map((name) => ({
|
|
178
|
+
return routes.map((name) => ({
|
|
179
|
+
name,
|
|
180
|
+
inputShape: {},
|
|
181
|
+
resultKind: 'house',
|
|
182
|
+
...(ROOM_SELECTORS.get(name) ?? { room: 'room_ref' }),
|
|
183
|
+
}));
|
|
15
184
|
}
|
|
16
185
|
export function houseAction(transport, request) {
|
|
17
186
|
const route = routeOf(request.name);
|
|
@@ -57,5 +226,10 @@ export function actionOutcome(answer, name, input) {
|
|
|
57
226
|
return { kind: 'action', result: answer.body };
|
|
58
227
|
}
|
|
59
228
|
async function carry(transport, route, name, input) {
|
|
60
|
-
|
|
229
|
+
const answered = actionOutcome(await transport.door(route, input), name, input);
|
|
230
|
+
const renamed = renamedHandle(answered);
|
|
231
|
+
if (renamed === null)
|
|
232
|
+
return answered;
|
|
233
|
+
const moved = movedPaths(input, ROOM_SELECTORS.get(name)?.roomPaths ?? [], renamed);
|
|
234
|
+
return actionOutcome(await transport.door(route, moved), name, moved);
|
|
61
235
|
}
|
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;AAqChC,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,CAmdpF"}
|
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_18, HOUSE_RENAMED_UNTIL_2026_12_21, HOUSE_RENAMED_UNTIL_2026_12_22, HOUSE_REWRITTEN_UNTIL_2026_12_19, HOUSE_REWRITTEN_UNTIL_2026_12_21, HOUSE_REWRITTEN_UNTIL_2026_12_22, HOUSE_UNKEPT_READS, rewrittenInTurn, } 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';
|
|
@@ -198,6 +199,23 @@ export function createAgentsHouseAdapter(options) {
|
|
|
198
199
|
destination: { authority: into.authority, handle: into.handle },
|
|
199
200
|
}));
|
|
200
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
|
+
}
|
|
201
219
|
function refusedOn(answer, locator) {
|
|
202
220
|
if (locator === null)
|
|
203
221
|
return keyedFailure(answer.status, answer.body);
|
|
@@ -295,6 +313,12 @@ export function createAgentsHouseAdapter(options) {
|
|
|
295
313
|
pathRule: admittedPath,
|
|
296
314
|
unkeptReads: HOUSE_UNKEPT_READS,
|
|
297
315
|
leadingReads: HOUSE_LEADING_READS,
|
|
316
|
+
renamedActions: new Map([
|
|
317
|
+
...HOUSE_RENAMED_UNTIL_2026_12_18,
|
|
318
|
+
...HOUSE_RENAMED_UNTIL_2026_12_21,
|
|
319
|
+
...HOUSE_RENAMED_UNTIL_2026_12_22,
|
|
320
|
+
]),
|
|
321
|
+
rewrittenInputs: rewrittenInTurn(HOUSE_REWRITTEN_UNTIL_2026_12_19, HOUSE_REWRITTEN_UNTIL_2026_12_21, HOUSE_REWRITTEN_UNTIL_2026_12_22),
|
|
298
322
|
async authorize() {
|
|
299
323
|
return options.authorize();
|
|
300
324
|
},
|
|
@@ -310,26 +334,17 @@ export function createAgentsHouseAdapter(options) {
|
|
|
310
334
|
const entry = authorityFor(request.locator);
|
|
311
335
|
if (entry === undefined)
|
|
312
336
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
313
|
-
const
|
|
314
|
-
const destination = batch.between?.destination.room;
|
|
337
|
+
const destination = request.changeBatch.between?.destination.room;
|
|
315
338
|
const into = destination === undefined ? undefined : authorityFor(destination);
|
|
316
339
|
if (destination !== undefined && into === undefined) {
|
|
317
340
|
return { kind: 'room-not-readable', locator: destination };
|
|
318
341
|
}
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if (mapped.kind === 'unmapped')
|
|
323
|
-
return rejectedMapping(mapped);
|
|
324
|
-
const head = operationHead(batch, entry.authority);
|
|
325
|
-
const delta = deltaBody(mapped.changes);
|
|
326
|
-
const bytes = deltaBytes(delta);
|
|
327
|
-
const handed = request.upload;
|
|
328
|
-
const answer = (upload) => submit(request, head, mapped.changes, delta, bytes, entry, upload, keep, into);
|
|
329
|
-
const outcome = await answer(handed);
|
|
330
|
-
if (handed === undefined || !lapsedGrant(outcome))
|
|
342
|
+
const outcome = await mutated(request, keep, entry, into);
|
|
343
|
+
const renamed = renamedHandle(outcome);
|
|
344
|
+
if (renamed === null)
|
|
331
345
|
return outcome;
|
|
332
|
-
|
|
346
|
+
const moved = (held) => held.handle === renamed.from ? { ...held, handle: renamed.to } : held;
|
|
347
|
+
return mutated(request, keep, moved(entry), into === undefined ? undefined : moved(into));
|
|
333
348
|
},
|
|
334
349
|
async history(_authorization, request) {
|
|
335
350
|
const entry = authorityFor(request.locator);
|
package/dist/authored-path.d.ts
CHANGED
|
@@ -58,8 +58,4 @@ export declare function nameRefusal(name: string): NameRefusal | null;
|
|
|
58
58
|
export declare function pathRefusal(path: string): PathRefusal | null;
|
|
59
59
|
export declare function admittedPath(path: string): boolean;
|
|
60
60
|
export declare function sameName(left: string, right: string): boolean;
|
|
61
|
-
export declare function nameParts(name: string): {
|
|
62
|
-
readonly stem: string;
|
|
63
|
-
readonly extension: string;
|
|
64
|
-
};
|
|
65
61
|
export declare function fittedName(name: string, count?: number, tail?: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authored-path.d.ts","sourceRoot":"","sources":["../src/authored-path.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAE3C,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAMhD,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"authored-path.d.ts","sourceRoot":"","sources":["../src/authored-path.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAE3C,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAMhD,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAI5C,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAKlD,CAAC;AAEF,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAI3C,eAAO,MAAM,kBAAkB;aAC7B,iBAAiB,EAAE,YAAY;aAC/B,iBAAiB,EAAE,IAAI;aACvB,WAAW,EAAE,IAAI;aACjB,YAAY,EAAE,GAAG;aACjB,QAAQ,YAAG,MAAM,EAAE,OAAO;aAC1B,YAAY;aAUZ,cAAc;aACd,YAAY;aACZ,YAAY;CACJ,CAAC;AAEX,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM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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;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T,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,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,MA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AG,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');
|
package/dist/site.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,OAAO,EASR,MAAM,wBAAwB,CAAC;AAchC,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAuCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CA2K1F"}
|
package/dist/site.js
CHANGED
|
@@ -6,9 +6,16 @@ import { answeredFailure, discoveryFailure } from './refusal.js';
|
|
|
6
6
|
import { admittedPath } from './authored-path.js';
|
|
7
7
|
import { siteQuery } from './room-query.js';
|
|
8
8
|
import { houseNotifications } from './stream.js';
|
|
9
|
-
import { houseSiteRoute, SITE_DOOR_ACTS, SITE_FILES, } from './transport.js';
|
|
9
|
+
import { houseSiteRoute, SITE_DOOR_ACTS, SITE_DOOR_TOOL, SITE_FILES, } from './transport.js';
|
|
10
10
|
import { UNANSWERED, unusable } from './uncertain.js';
|
|
11
11
|
import { followsVersion, reachedVersion, roomVersion } from './version.js';
|
|
12
|
+
function siteDoorRequest(request) {
|
|
13
|
+
const { op, ...input } = (request.input ?? {});
|
|
14
|
+
if (request.name !== SITE_DOOR_TOOL || typeof op !== 'string')
|
|
15
|
+
return request;
|
|
16
|
+
const named = Object.entries(SITE_DOOR_ACTS).find(([, act]) => act.op === op);
|
|
17
|
+
return named === undefined ? request : { ...request, name: named[0], input };
|
|
18
|
+
}
|
|
12
19
|
function unfound() {
|
|
13
20
|
return { kind: 'rejected', code: 'not_found', fields: {}, retryable: false };
|
|
14
21
|
}
|
|
@@ -169,9 +176,10 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
169
176
|
follows(_locator, version, next) {
|
|
170
177
|
return followsVersion(version, next);
|
|
171
178
|
},
|
|
172
|
-
async action(_authorization,
|
|
179
|
+
async action(_authorization, asked) {
|
|
180
|
+
const request = siteDoorRequest(asked);
|
|
173
181
|
const route = Object.hasOwn(SITE_DOOR_ACTS, request.name)
|
|
174
|
-
? SITE_DOOR_ACTS[request.name]
|
|
182
|
+
? SITE_DOOR_ACTS[request.name].route
|
|
175
183
|
: null;
|
|
176
184
|
if (route === null) {
|
|
177
185
|
return {
|
package/dist/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],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AE,SAAS,EACpB,IAAI,EAAE,SAAS,EACf,WAAW,EAAE,gBAAgB,GAC5B,kBAAkB,CAuYpB"}
|
package/dist/stream.js
CHANGED
|
@@ -4,6 +4,12 @@ import { spaceSchemaTexts, streamedModels } from './model.js';
|
|
|
4
4
|
import { spaceSchemas } from './space-schema.js';
|
|
5
5
|
import { answered, answering, documentEntry, folded, forgotten, kept, } from './read.js';
|
|
6
6
|
import { DECIMAL, logPosition, presented, roomVersion } from './version.js';
|
|
7
|
+
function requestReads(room) {
|
|
8
|
+
return [
|
|
9
|
+
{ name: 'agent.requests', input: { room } },
|
|
10
|
+
{ name: 'agent-functions/requests/list', input: { room_ref: room } },
|
|
11
|
+
];
|
|
12
|
+
}
|
|
7
13
|
function turnOperation(frame) {
|
|
8
14
|
return 'at' in frame ? { op: 'begin', at: frame.at } : structuredClone(frame.operation);
|
|
9
15
|
}
|
|
@@ -19,9 +25,11 @@ function listedAgent(agent) {
|
|
|
19
25
|
cli: agent.cli,
|
|
20
26
|
model: agent.model,
|
|
21
27
|
effort: agent.effort,
|
|
28
|
+
model_fixed: agent.model_fixed,
|
|
22
29
|
mode: agent.mode,
|
|
23
30
|
base_instructions: agent.base_instructions,
|
|
24
31
|
in_telegram: agent.in_telegram,
|
|
32
|
+
telegram_messages: agent.telegram_messages,
|
|
25
33
|
created: agent.created,
|
|
26
34
|
retired_at: agent.retired_at,
|
|
27
35
|
};
|
|
@@ -37,6 +45,9 @@ function listedConversation(listed) {
|
|
|
37
45
|
newest: listed.newest === null ? null : changeCursor(listed.newest),
|
|
38
46
|
processEnded: listed.process_ended_at,
|
|
39
47
|
subject: listed.subject,
|
|
48
|
+
room: listed.room_ref,
|
|
49
|
+
model: listed.model,
|
|
50
|
+
effort: listed.effort,
|
|
40
51
|
};
|
|
41
52
|
}
|
|
42
53
|
function position(value) {
|
|
@@ -266,6 +277,16 @@ export function houseNotifications(transport, mode, discovering) {
|
|
|
266
277
|
emit({ kind: 'reported' });
|
|
267
278
|
return;
|
|
268
279
|
}
|
|
280
|
+
if (frame.type === 'request' || frame.type === 'requests') {
|
|
281
|
+
const rooms = new Set(frame.type === 'request'
|
|
282
|
+
? [frame.request.room_ref]
|
|
283
|
+
: frame.requests.map((request) => request.room_ref));
|
|
284
|
+
if (frame.type === 'requests' && frame.room_ref !== null)
|
|
285
|
+
rooms.add(frame.room_ref);
|
|
286
|
+
for (const room of rooms)
|
|
287
|
+
emit({ kind: 'read-changed', reads: requestReads(room) });
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
269
290
|
if (frame.type === 'authority_changed') {
|
|
270
291
|
const change = discovering.changed(frame);
|
|
271
292
|
if (change !== null)
|
package/dist/transport.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ConversationEvent, ListedAgent, SavedFacts } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { Operation, SessionState } from './session-content/index.js';
|
|
3
3
|
export declare const HOUSE_RUNTIME_READS: {
|
|
4
|
-
readonly acts: readonly ['
|
|
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', '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,7 +17,12 @@ export declare const SITES_SUBMISSIONS_CREATE = "sites/submissions/create";
|
|
|
17
17
|
export declare const SITE_DOOR_SUBMIT = "/_house/door/submit";
|
|
18
18
|
export declare const SITES_FUNCTIONS_CALL = "sites/functions/call";
|
|
19
19
|
export declare const SITE_DOOR_FUNCTION = "/_house/door/function";
|
|
20
|
-
|
|
20
|
+
interface SiteDoorAct {
|
|
21
|
+
readonly op: string;
|
|
22
|
+
readonly route: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const SITE_DOOR_ACTS: Readonly<Record<string, SiteDoorAct>>;
|
|
25
|
+
export declare const SITE_DOOR_TOOL = "app_update";
|
|
21
26
|
export type HouseMode = 'credential' | 'site';
|
|
22
27
|
export type HouseDoorAnswer = {
|
|
23
28
|
status: number;
|
|
@@ -61,11 +66,15 @@ export type HouseStreamEntry = {
|
|
|
61
66
|
changed_at?: string;
|
|
62
67
|
created_at?: string;
|
|
63
68
|
content?: string;
|
|
64
|
-
provenance?: string;
|
|
65
69
|
facts?: SavedFacts;
|
|
66
70
|
move?: 'arrival' | 'leaving';
|
|
67
71
|
space?: string;
|
|
68
72
|
};
|
|
73
|
+
export type HouseStreamedRequest = {
|
|
74
|
+
room_ref: string;
|
|
75
|
+
name: string;
|
|
76
|
+
document: string;
|
|
77
|
+
};
|
|
69
78
|
type LiveFact<K extends ConversationEvent['kind']> = Extract<ConversationEvent, {
|
|
70
79
|
kind: K;
|
|
71
80
|
}>;
|
|
@@ -79,6 +88,9 @@ export type HouseListedConversation = {
|
|
|
79
88
|
newest: number | null;
|
|
80
89
|
process_ended_at: string | null;
|
|
81
90
|
subject: string | null;
|
|
91
|
+
room_ref: string | null;
|
|
92
|
+
model: string | null;
|
|
93
|
+
effort: string | null;
|
|
82
94
|
};
|
|
83
95
|
type Listed<Frame extends {
|
|
84
96
|
readonly type: HouseRuntimeFrame;
|
|
@@ -182,6 +194,16 @@ export type HouseStreamFrame = Listed<{
|
|
|
182
194
|
service_mode: string;
|
|
183
195
|
} | {
|
|
184
196
|
type: 'report';
|
|
197
|
+
} | {
|
|
198
|
+
type: 'request';
|
|
199
|
+
request: HouseStreamedRequest;
|
|
200
|
+
} | {
|
|
201
|
+
type: 'requests';
|
|
202
|
+
room_ref: string | null;
|
|
203
|
+
requests: readonly HouseStreamedRequest[];
|
|
204
|
+
whole: boolean;
|
|
205
|
+
more: boolean;
|
|
206
|
+
cursor: string;
|
|
185
207
|
}>;
|
|
186
208
|
export type HouseHeldRoom = {
|
|
187
209
|
authority: string;
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5E,eAAO,MAAM,mBAAmB;aAC9B,IAAI,YACF,
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5E,eAAO,MAAM,mBAAmB;aAC9B,IAAI,YACF,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,4BAA4B,EAC5B,cAAc,EACd,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,MAAM,EACN,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,QAAQ;aAEV,MAAM,YACJ,OAAO,EACP,aAA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,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
|
-
'
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'apps/source/top/read',
|
|
4
|
+
'account_update.set',
|
|
5
|
+
'app.screenshot',
|
|
6
|
+
'app.source',
|
|
7
|
+
'app_update.feature_set',
|
|
9
8
|
'conversations/history/list',
|
|
10
9
|
'files/attach',
|
|
11
10
|
'files/finish',
|
|
@@ -15,7 +14,6 @@ export const HOUSE_RUNTIME_READS = {
|
|
|
15
14
|
'room-chunks/list',
|
|
16
15
|
'rooms/discover',
|
|
17
16
|
'rooms/search',
|
|
18
|
-
'sites/screenshot/read',
|
|
19
17
|
'update',
|
|
20
18
|
],
|
|
21
19
|
frames: [
|
|
@@ -40,6 +38,8 @@ export const HOUSE_RUNTIME_READS = {
|
|
|
40
38
|
'process',
|
|
41
39
|
'received',
|
|
42
40
|
'report',
|
|
41
|
+
'request',
|
|
42
|
+
'requests',
|
|
43
43
|
'signal',
|
|
44
44
|
'site',
|
|
45
45
|
'starting',
|
|
@@ -85,8 +85,9 @@ export const SITE_DOOR_SUBMIT = '/_house/door/submit';
|
|
|
85
85
|
export const SITES_FUNCTIONS_CALL = 'sites/functions/call';
|
|
86
86
|
export const SITE_DOOR_FUNCTION = '/_house/door/function';
|
|
87
87
|
export const SITE_DOOR_ACTS = {
|
|
88
|
-
[SITES_SUBMISSIONS_CREATE]: SITE_DOOR_SUBMIT,
|
|
89
|
-
[SITES_FUNCTIONS_CALL]: SITE_DOOR_FUNCTION,
|
|
88
|
+
[SITES_SUBMISSIONS_CREATE]: { op: 'submission_create', route: SITE_DOOR_SUBMIT },
|
|
89
|
+
[SITES_FUNCTIONS_CALL]: { op: 'function_call', route: SITE_DOOR_FUNCTION },
|
|
90
90
|
};
|
|
91
|
+
export const SITE_DOOR_TOOL = 'app_update';
|
|
91
92
|
export const SITE_FILES = '/_house/files/';
|
|
92
93
|
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,19 +9,14 @@ 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;
|
|
20
|
-
readonly room_ref: string;
|
|
21
16
|
readonly app_ref?: string;
|
|
22
17
|
readonly release?: string;
|
|
23
18
|
};
|
|
24
|
-
export declare function operationHead(batch: ChangeBatch
|
|
19
|
+
export declare function operationHead(batch: ChangeBatch): OperationHead;
|
|
25
20
|
export declare function batchPaths(changes: readonly HouseOperation[]): readonly string[];
|
|
26
21
|
export declare function deltaBody(changes: readonly HouseOperation[]): string;
|
|
27
22
|
export declare function deltaBytes(delta: string): number;
|
package/dist/write.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAElB,KAAK,cAAc,
|
|
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,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW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AEZ;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,
|
|
@@ -142,14 +124,14 @@ export function houseMove(batch, source, destination) {
|
|
|
142
124
|
}
|
|
143
125
|
return { kind: 'changes', changes };
|
|
144
126
|
}
|
|
145
|
-
export function operationHead(batch
|
|
127
|
+
export function operationHead(batch) {
|
|
146
128
|
const writer = batch.writtenBy;
|
|
147
|
-
const head = { operation_id: batch.id
|
|
129
|
+
const head = { operation_id: batch.id };
|
|
148
130
|
return writer === undefined ? head : { ...head, app_ref: writer.app, release: writer.release };
|
|
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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdruntime-adapter",
|
|
3
|
-
"version": "0.1.0-c9a7eb70810a7",
|
|
4
3
|
"description": "Agents House Adapter for the MD Runtime",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"type": "module",
|
|
@@ -24,12 +23,13 @@
|
|
|
24
23
|
"LICENSE"
|
|
25
24
|
],
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"@agentshouse/mdmodel": "0.1.0-
|
|
28
|
-
"@agentshouse/mdruntime": "0.1.0-
|
|
26
|
+
"@agentshouse/mdmodel": "0.1.0-c8b10c50814bd",
|
|
27
|
+
"@agentshouse/mdruntime": "0.1.0-c293e2b8adb51"
|
|
29
28
|
},
|
|
30
29
|
"repository": {
|
|
31
30
|
"type": "git",
|
|
32
31
|
"url": "git+https://github.com/agentshouse/core.git",
|
|
33
32
|
"directory": "mdruntime/packages/mdruntime-adapter"
|
|
34
|
-
}
|
|
33
|
+
},
|
|
34
|
+
"version": "0.1.0-c9b6485a8bc8c"
|
|
35
35
|
}
|