@agentshouse/mdruntime-adapter 0.1.0-c6025c99835d4 → 0.1.0-c605ccff46163
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 +1 -1
- 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 +48 -54
- package/dist/authored-path.d.ts +54 -2
- package/dist/authored-path.d.ts.map +1 -1
- package/dist/authored-path.js +142 -10
- package/dist/chunks.js +1 -1
- package/dist/discovery.d.ts +7 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +37 -15
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/read.d.ts +6 -5
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +41 -13
- 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/session-content/check.d.ts +4 -2
- package/dist/session-content/index.d.ts +3 -4
- package/dist/session-content/parts.d.ts +14 -87
- package/dist/session-content/state.d.ts +21 -23
- package/dist/session-content/turn.d.ts +82 -258
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +40 -6
- package/dist/stream.d.ts +2 -1
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +72 -10
- package/dist/transport.d.ts +44 -11
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +44 -9
- package/dist/upload.d.ts +4 -0
- package/dist/upload.d.ts.map +1 -1
- package/dist/upload.js +41 -0
- package/dist/write.d.ts +3 -8
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +70 -88
- package/package.json +4 -4
- package/dist/session-content/bounds.d.ts +0 -7
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ host.attach(port, { app: 'my-app' });
|
|
|
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 `guide
|
|
28
|
+
of House's Guide, which House's `guide` tool opens.
|
|
29
29
|
|
|
30
30
|
## License
|
|
31
31
|
|
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,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AAC,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,CAodpF"}
|
package/dist/adapter.js
CHANGED
|
@@ -4,13 +4,15 @@ import { capabilities, discoveredRoom, mapDiscovery, parseAuthorityChange, parse
|
|
|
4
4
|
import { createSiteAdapter } from './site.js';
|
|
5
5
|
import { parseFileAddress, parseGrant } from './read.js';
|
|
6
6
|
import { chunkedHead, chunkLister, chunkPart } from './chunks.js';
|
|
7
|
-
import { finishedUpload, houseUpload } from './upload.js';
|
|
8
|
-
import { houseAction, HOUSE_LEADING_READS, HOUSE_UNKEPT_READS } from './actions.js';
|
|
7
|
+
import { finishedUpload, houseUpload, stagedBatch } from './upload.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
|
+
import { houseQuery } from './room-query.js';
|
|
9
10
|
import { houseSearch } from './search.js';
|
|
10
|
-
import { answeredFailure, classifyDoor,
|
|
11
|
+
import { answeredFailure, classifyDoor, keyedFailure } from './refusal.js';
|
|
11
12
|
import { UNANSWERED, unusable } from './uncertain.js';
|
|
12
13
|
import { houseNotifications, } from './stream.js';
|
|
13
14
|
import { houseDoorRoute, } from './transport.js';
|
|
15
|
+
import { renamedHandle } from './renamed.js';
|
|
14
16
|
import { batchPaths, deltaBody, deltaBytes, deltaDigest, historyOutcome, houseChanges, houseMove, mutationOutcome, operationHead, rejectedMapping, revisionBody, uploadable, } from './write.js';
|
|
15
17
|
import { admittedPath } from './authored-path.js';
|
|
16
18
|
import { followsVersion, reachedVersion, roomVersion } from './version.js';
|
|
@@ -18,10 +20,6 @@ const EXPIRED_ADDRESS = 403;
|
|
|
18
20
|
function lapsedGrant(outcome) {
|
|
19
21
|
return outcome.kind === 'rejected' && outcome.code === 'upload_unavailable';
|
|
20
22
|
}
|
|
21
|
-
function unstagedRefusal(answer) {
|
|
22
|
-
const refusal = doorRefusal(answer.body);
|
|
23
|
-
return refusal?.code === 'files_unstaged' ? refusal : null;
|
|
24
|
-
}
|
|
25
23
|
export function createAgentsHouseAdapter(options) {
|
|
26
24
|
if ('site' in options)
|
|
27
25
|
return createSiteAdapter(options.site, options.snapshot === true);
|
|
@@ -152,8 +150,9 @@ export function createAgentsHouseAdapter(options) {
|
|
|
152
150
|
if (handed !== undefined && handed.sha256 === sha256) {
|
|
153
151
|
return { body: { ...head, paths, upload: handed, runtime: notifications.runtime } };
|
|
154
152
|
}
|
|
155
|
-
const minted = await transport.door(houseDoorRoute('
|
|
153
|
+
const minted = await transport.door(houseDoorRoute('update'), {
|
|
156
154
|
...head,
|
|
155
|
+
op: 'stage',
|
|
157
156
|
paths,
|
|
158
157
|
bytes,
|
|
159
158
|
sha256,
|
|
@@ -180,24 +179,6 @@ export function createAgentsHouseAdapter(options) {
|
|
|
180
179
|
await keep(upload);
|
|
181
180
|
return { body: { ...head, paths, upload, runtime: notifications.runtime } };
|
|
182
181
|
}
|
|
183
|
-
async function staged(uploads, { changeBatch: batch, file }) {
|
|
184
|
-
if (!Array.isArray(uploads))
|
|
185
|
-
return unusable();
|
|
186
|
-
for (const named of uploads) {
|
|
187
|
-
const upload = houseUpload(named);
|
|
188
|
-
const change = batch.changes.find((held) => held.kind === 'binary' && held.sha256 === named.sha256);
|
|
189
|
-
if (upload === null || change === undefined)
|
|
190
|
-
return unusable();
|
|
191
|
-
const finished = await finishedUpload(transport, upload, await file(change.localId));
|
|
192
|
-
if ('unfinished' in finished)
|
|
193
|
-
return answeredFailure(finished.unfinished, null);
|
|
194
|
-
if (finished.status !== 200)
|
|
195
|
-
return answeredFailure(finished.status, finished.body);
|
|
196
|
-
if (finished.body?.staged !== true)
|
|
197
|
-
return unusable();
|
|
198
|
-
}
|
|
199
|
-
return null;
|
|
200
|
-
}
|
|
201
182
|
async function submit(request, head, changes, delta, bytes, entry, handed, keep, into) {
|
|
202
183
|
const inline = { ...head, changes, runtime: notifications.runtime };
|
|
203
184
|
const prepared = uploadable(inline, bytes, declared())
|
|
@@ -205,19 +186,12 @@ export function createAgentsHouseAdapter(options) {
|
|
|
205
186
|
: { body: inline };
|
|
206
187
|
if ('outcome' in prepared)
|
|
207
188
|
return prepared.outcome;
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
const settled = unstaged === null
|
|
216
|
-
? answer
|
|
217
|
-
: await transport.door(houseDoorRoute('files/batch'), prepared.body);
|
|
218
|
-
if (unstaged !== null && unstagedRefusal(settled) !== null) {
|
|
219
|
-
return answeredFailure(settled.status, settled.body);
|
|
220
|
-
}
|
|
189
|
+
const settled = await stagedBatch(transport, prepared.body, (sha256) => {
|
|
190
|
+
const change = request.changeBatch.changes.find((held) => held.kind === 'binary' && held.sha256 === sha256);
|
|
191
|
+
return change === undefined ? null : request.file(change.localId);
|
|
192
|
+
});
|
|
193
|
+
if ('kind' in settled)
|
|
194
|
+
return settled;
|
|
221
195
|
return stepped(mutationOutcome(settled.status, settled.body, entry.locator, entry.handle, into === undefined
|
|
222
196
|
? undefined
|
|
223
197
|
: {
|
|
@@ -225,6 +199,23 @@ export function createAgentsHouseAdapter(options) {
|
|
|
225
199
|
destination: { authority: into.authority, handle: into.handle },
|
|
226
200
|
}));
|
|
227
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
|
+
}
|
|
228
219
|
function refusedOn(answer, locator) {
|
|
229
220
|
if (locator === null)
|
|
230
221
|
return keyedFailure(answer.status, answer.body);
|
|
@@ -302,6 +293,8 @@ export function createAgentsHouseAdapter(options) {
|
|
|
302
293
|
body: read.body,
|
|
303
294
|
mediaType: address.mediaType,
|
|
304
295
|
sha256: address.sha256,
|
|
296
|
+
url: address.url,
|
|
297
|
+
copies: address.copies,
|
|
305
298
|
};
|
|
306
299
|
}
|
|
307
300
|
function pathAddress(request) {
|
|
@@ -320,6 +313,12 @@ export function createAgentsHouseAdapter(options) {
|
|
|
320
313
|
pathRule: admittedPath,
|
|
321
314
|
unkeptReads: HOUSE_UNKEPT_READS,
|
|
322
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),
|
|
323
322
|
async authorize() {
|
|
324
323
|
return options.authorize();
|
|
325
324
|
},
|
|
@@ -335,26 +334,17 @@ export function createAgentsHouseAdapter(options) {
|
|
|
335
334
|
const entry = authorityFor(request.locator);
|
|
336
335
|
if (entry === undefined)
|
|
337
336
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
338
|
-
const
|
|
339
|
-
const destination = batch.between?.destination.room;
|
|
337
|
+
const destination = request.changeBatch.between?.destination.room;
|
|
340
338
|
const into = destination === undefined ? undefined : authorityFor(destination);
|
|
341
339
|
if (destination !== undefined && into === undefined) {
|
|
342
340
|
return { kind: 'room-not-readable', locator: destination };
|
|
343
341
|
}
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
if (mapped.kind === 'unmapped')
|
|
348
|
-
return rejectedMapping(mapped);
|
|
349
|
-
const head = operationHead(batch, entry.authority);
|
|
350
|
-
const delta = deltaBody(mapped.changes);
|
|
351
|
-
const bytes = deltaBytes(delta);
|
|
352
|
-
const handed = request.upload;
|
|
353
|
-
const answer = (upload) => submit(request, head, mapped.changes, delta, bytes, entry, upload, keep, into);
|
|
354
|
-
const outcome = await answer(handed);
|
|
355
|
-
if (handed === undefined || !lapsedGrant(outcome))
|
|
342
|
+
const outcome = await mutated(request, keep, entry, into);
|
|
343
|
+
const renamed = renamedHandle(outcome);
|
|
344
|
+
if (renamed === null)
|
|
356
345
|
return outcome;
|
|
357
|
-
|
|
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));
|
|
358
348
|
},
|
|
359
349
|
async history(_authorization, request) {
|
|
360
350
|
const entry = authorityFor(request.locator);
|
|
@@ -403,11 +393,15 @@ export function createAgentsHouseAdapter(options) {
|
|
|
403
393
|
search(_authorization, request) {
|
|
404
394
|
return houseSearch(transport, [...tracked.values()], request);
|
|
405
395
|
},
|
|
396
|
+
queryHouse(_authorization, request) {
|
|
397
|
+
return houseQuery(transport, request);
|
|
398
|
+
},
|
|
406
399
|
roomStream: {
|
|
407
400
|
hold,
|
|
408
401
|
observe: notifications.observe,
|
|
409
402
|
},
|
|
410
403
|
conversations: notifications.conversations,
|
|
404
|
+
runs: notifications.runs,
|
|
411
405
|
serviceMode: notifications.serviceMode,
|
|
412
406
|
};
|
|
413
407
|
}
|
package/dist/authored-path.d.ts
CHANGED
|
@@ -2,8 +2,60 @@ export declare const GENERATED_PROVENANCE = "_provenance";
|
|
|
2
2
|
export declare const GENERATED_REVISIONS = "_revisions";
|
|
3
3
|
export declare const RESERVED_DERIVED = "_derived";
|
|
4
4
|
export declare const WHOLE_ESCAPED_NAMES: readonly string[];
|
|
5
|
-
export declare const AUTHORED_SEGMENT_MAX_CHARS = 255;
|
|
6
|
-
export declare const AUTHORED_SEGMENT: RegExp;
|
|
7
5
|
export declare const LOCAL_COPY_MANIFEST = ".house";
|
|
8
6
|
export declare const LOCAL_COPY_ROOT_NAMES: readonly string[];
|
|
7
|
+
export declare const AUTHORED_NAME_MAX_BYTES = 255;
|
|
8
|
+
export declare const AUTHORED_PATH_MAX_BYTES = 768;
|
|
9
|
+
export declare const AUTHORED_NAME_RULE: {
|
|
10
|
+
readonly refusedCharacters: '/\\:*?"<>|';
|
|
11
|
+
readonly controlCharacters: 'Cc';
|
|
12
|
+
readonly refusedEnds: ' .';
|
|
13
|
+
readonly refusedStart: '-';
|
|
14
|
+
readonly gitNames: readonly ['.git', 'git~1'];
|
|
15
|
+
readonly windowsNames: readonly ["CON", "PRN", "AUX", "NUL", ...string[]];
|
|
16
|
+
readonly generatedNames: readonly ["_provenance", "_revisions", "_derived"];
|
|
17
|
+
readonly nameMaxBytes: 255;
|
|
18
|
+
readonly pathMaxBytes: 768;
|
|
19
|
+
};
|
|
20
|
+
export type NameRefusal = {
|
|
21
|
+
readonly rule: 'unicode';
|
|
22
|
+
} | {
|
|
23
|
+
readonly rule: 'character';
|
|
24
|
+
readonly character: string;
|
|
25
|
+
} | {
|
|
26
|
+
readonly rule: 'empty';
|
|
27
|
+
} | {
|
|
28
|
+
readonly rule: 'dots';
|
|
29
|
+
} | {
|
|
30
|
+
readonly rule: 'end';
|
|
31
|
+
readonly character: string;
|
|
32
|
+
} | {
|
|
33
|
+
readonly rule: 'git';
|
|
34
|
+
} | {
|
|
35
|
+
readonly rule: 'windows';
|
|
36
|
+
readonly reserved: string;
|
|
37
|
+
} | {
|
|
38
|
+
readonly rule: 'name_bytes';
|
|
39
|
+
readonly bytes: number;
|
|
40
|
+
} | {
|
|
41
|
+
readonly rule: 'start';
|
|
42
|
+
} | {
|
|
43
|
+
readonly rule: 'generated';
|
|
44
|
+
} | {
|
|
45
|
+
readonly rule: 'nfc';
|
|
46
|
+
};
|
|
47
|
+
export type PathRefusal = (NameRefusal & {
|
|
48
|
+
readonly name: string;
|
|
49
|
+
}) | {
|
|
50
|
+
readonly rule: 'root';
|
|
51
|
+
readonly name: string;
|
|
52
|
+
} | {
|
|
53
|
+
readonly rule: 'path_bytes';
|
|
54
|
+
readonly bytes: number;
|
|
55
|
+
};
|
|
56
|
+
export declare function utf8Bytes(text: string): number;
|
|
57
|
+
export declare function nameRefusal(name: string): NameRefusal | null;
|
|
58
|
+
export declare function pathRefusal(path: string): PathRefusal | null;
|
|
9
59
|
export declare function admittedPath(path: string): boolean;
|
|
60
|
+
export declare function sameName(left: string, right: string): boolean;
|
|
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,
|
|
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;IA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