@agentshouse/mdruntime-adapter 0.1.0-cd24cf2286fd6 → 0.1.0-cd29e13df3ef7
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 +9 -1
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +152 -9
- package/dist/adapter.d.ts +0 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +133 -122
- package/dist/authored-path.d.ts +61 -0
- package/dist/authored-path.d.ts.map +1 -0
- package/dist/authored-path.js +166 -0
- package/dist/chunks.d.ts +2 -4
- package/dist/chunks.d.ts.map +1 -1
- package/dist/chunks.js +72 -38
- package/dist/digest.d.ts +0 -1
- package/dist/discovery.d.ts +26 -8
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +174 -26
- package/dist/history.d.ts +1 -7
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +22 -29
- package/dist/index.d.ts +8 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -8
- package/dist/map.d.ts +0 -1
- package/dist/model.d.ts +5 -6
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +18 -28
- package/dist/read.d.ts +15 -23
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +90 -48
- 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 +61 -23
- package/dist/space-schema.d.ts +0 -1
- package/dist/space-schema.d.ts.map +1 -1
- package/dist/space-schema.js +1 -8
- package/dist/stream.d.ts +2 -4
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +89 -83
- package/dist/transport.d.ts +62 -25
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +51 -15
- package/dist/uncertain.d.ts +5 -0
- package/dist/uncertain.d.ts.map +1 -0
- package/dist/uncertain.js +11 -0
- package/dist/upload.d.ts +7 -2
- package/dist/upload.d.ts.map +1 -1
- package/dist/upload.js +49 -6
- package/dist/version.d.ts +0 -1
- package/dist/write.d.ts +3 -10
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +90 -110
- package/package.json +4 -3
- package/dist/app-reference.d.ts +0 -2
- package/dist/app-reference.d.ts.map +0 -1
- package/dist/app-reference.js +0 -2
- package/dist/crockford.d.ts +0 -4
- package/dist/crockford.d.ts.map +0 -1
- package/dist/crockford.js +0 -3
- package/dist/house-model.d.ts +0 -641
- package/dist/house-model.d.ts.map +0 -1
- package/dist/house-model.js +0 -361
- package/dist/room-types.d.ts +0 -7
- package/dist/room-types.d.ts.map +0 -1
- package/dist/room-types.js +0 -123
package/dist/adapter.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
+
import { HOUSE_ROOM_TYPES, HOUSE_TYPED_PATHS } from '@agentshouse/mdmodel';
|
|
1
2
|
import { stepped } from '@agentshouse/mdruntime';
|
|
2
3
|
import { capabilities, discoveredRoom, mapDiscovery, parseAuthorityChange, parseDiscovery, trackedFrom, } from './discovery.js';
|
|
3
4
|
import { createSiteAdapter } from './site.js';
|
|
4
5
|
import { parseFileAddress, parseGrant } from './read.js';
|
|
5
6
|
import { chunkedHead, chunkLister, chunkPart } from './chunks.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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_REWRITTEN_UNTIL_2026_12_19, HOUSE_REWRITTEN_UNTIL_2026_12_21, HOUSE_UNKEPT_READS, rewrittenInTurn, } from './actions.js';
|
|
9
|
+
import { houseQuery } from './room-query.js';
|
|
9
10
|
import { houseSearch } from './search.js';
|
|
10
|
-
import { classifyDoor,
|
|
11
|
+
import { answeredFailure, classifyDoor, keyedFailure } from './refusal.js';
|
|
12
|
+
import { UNANSWERED, unusable } from './uncertain.js';
|
|
11
13
|
import { houseNotifications, } from './stream.js';
|
|
12
14
|
import { houseDoorRoute, } from './transport.js';
|
|
15
|
+
import { renamedHandle } from './renamed.js';
|
|
13
16
|
import { batchPaths, deltaBody, deltaBytes, deltaDigest, historyOutcome, houseChanges, houseMove, mutationOutcome, operationHead, rejectedMapping, revisionBody, uploadable, } from './write.js';
|
|
14
|
-
import {
|
|
15
|
-
import { HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES } from './room-types.js';
|
|
17
|
+
import { admittedPath } from './authored-path.js';
|
|
16
18
|
import { followsVersion, reachedVersion, roomVersion } from './version.js';
|
|
17
|
-
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
18
|
-
const UNCERTAIN_READ = { kind: 'transport-uncertainty' };
|
|
19
|
-
const OCTET_STREAM = 'application/octet-stream';
|
|
20
19
|
const EXPIRED_ADDRESS = 403;
|
|
21
20
|
function lapsedGrant(outcome) {
|
|
22
21
|
return outcome.kind === 'rejected' && outcome.code === 'upload_unavailable';
|
|
@@ -25,14 +24,13 @@ export function createAgentsHouseAdapter(options) {
|
|
|
25
24
|
if ('site' in options)
|
|
26
25
|
return createSiteAdapter(options.site, options.snapshot === true);
|
|
27
26
|
const transport = options.transport;
|
|
28
|
-
const spaces = spaceSchemas();
|
|
29
27
|
const notifications = houseNotifications(transport, 'credential', {
|
|
30
28
|
opened: async (frame) => (frame === null ? null : opened(frame)),
|
|
31
29
|
changed,
|
|
32
|
-
expired: (
|
|
33
|
-
}
|
|
30
|
+
expired: (entries) => lister.askAll(entries),
|
|
31
|
+
});
|
|
34
32
|
const tracked = new Map();
|
|
35
|
-
const lister = chunkLister(transport, () => declared().max_prefixes);
|
|
33
|
+
const lister = chunkLister(transport, () => declared().max_prefixes, (locator) => tracked.get(locator));
|
|
36
34
|
const chunked = new Map();
|
|
37
35
|
const renewals = new WeakMap();
|
|
38
36
|
let bounds;
|
|
@@ -54,13 +52,16 @@ export function createAgentsHouseAdapter(options) {
|
|
|
54
52
|
return {
|
|
55
53
|
...mapDiscovery(document, document.authorities.map((authority) => discoveredRoom(authority)), capabilities(document.actions)),
|
|
56
54
|
member: document.member,
|
|
55
|
+
timeZone: document.timeZone,
|
|
56
|
+
roomList: document.roomList,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
function changed(frame) {
|
|
60
60
|
const change = parseAuthorityChange(frame);
|
|
61
61
|
if (change === null)
|
|
62
62
|
return null;
|
|
63
|
-
|
|
63
|
+
const unheld = [...change.left, ...change.listed];
|
|
64
|
+
for (const locator of unheld)
|
|
64
65
|
tracked.delete(locator);
|
|
65
66
|
for (const entry of trackedFrom(change))
|
|
66
67
|
tracked.set(entry.locator, entry);
|
|
@@ -68,15 +69,17 @@ export function createAgentsHouseAdapter(options) {
|
|
|
68
69
|
return {
|
|
69
70
|
kind: 'authority-changed',
|
|
70
71
|
rooms: change.authorities.map((authority) => discoveredRoom(authority)),
|
|
71
|
-
left:
|
|
72
|
+
left: unheld,
|
|
72
73
|
member: change.member,
|
|
74
|
+
timeZone: change.timeZone,
|
|
75
|
+
roomList: { ...change.roomList, left: change.left },
|
|
73
76
|
};
|
|
74
77
|
}
|
|
75
78
|
async function listedRoom(entry) {
|
|
76
79
|
const listed = await lister.list(entry);
|
|
77
80
|
if ('kind' in listed)
|
|
78
81
|
return listed;
|
|
79
|
-
const head = await chunkedHead(listed, entry
|
|
82
|
+
const head = await chunkedHead(listed, entry);
|
|
80
83
|
if (head.kind === 'bootstrap')
|
|
81
84
|
chunked.set(entry.locator, listed);
|
|
82
85
|
return head;
|
|
@@ -85,15 +88,18 @@ export function createAgentsHouseAdapter(options) {
|
|
|
85
88
|
const room = chunked.get(entry.locator);
|
|
86
89
|
const address = room?.chunks.get(id);
|
|
87
90
|
if (room === undefined || address === undefined)
|
|
88
|
-
return
|
|
91
|
+
return UNANSWERED;
|
|
89
92
|
const read = await transport.download(address.url);
|
|
90
93
|
if (read.status !== EXPIRED_ADDRESS)
|
|
91
94
|
return { room, read };
|
|
92
95
|
const renewed = await renewal(entry, room);
|
|
93
|
-
if ('kind' in renewed
|
|
94
|
-
return
|
|
96
|
+
if ('kind' in renewed)
|
|
97
|
+
return renewed;
|
|
98
|
+
const renewedAddress = renewed.chunks.get(id);
|
|
99
|
+
if (renewedAddress === undefined)
|
|
100
|
+
return unusable();
|
|
95
101
|
chunked.set(entry.locator, renewed);
|
|
96
|
-
return { room: renewed, read: await transport.download(
|
|
102
|
+
return { room: renewed, read: await transport.download(renewedAddress.url) };
|
|
97
103
|
}
|
|
98
104
|
function renewal(entry, stale) {
|
|
99
105
|
const held = renewals.get(stale);
|
|
@@ -115,8 +121,10 @@ export function createAgentsHouseAdapter(options) {
|
|
|
115
121
|
}
|
|
116
122
|
async function chunkPage(entry, id, arriving) {
|
|
117
123
|
const fetched = await chunkRead(entry, id);
|
|
118
|
-
if (
|
|
119
|
-
return
|
|
124
|
+
if ('kind' in fetched)
|
|
125
|
+
return fetched;
|
|
126
|
+
if (fetched.read.status !== 200)
|
|
127
|
+
return answeredFailure(fetched.read.status, null);
|
|
120
128
|
return chunkPart(fetched.read.body, fetched.room, id, arriving);
|
|
121
129
|
}
|
|
122
130
|
function authorityFor(locator) {
|
|
@@ -142,8 +150,9 @@ export function createAgentsHouseAdapter(options) {
|
|
|
142
150
|
if (handed !== undefined && handed.sha256 === sha256) {
|
|
143
151
|
return { body: { ...head, paths, upload: handed, runtime: notifications.runtime } };
|
|
144
152
|
}
|
|
145
|
-
const minted = await transport.door(houseDoorRoute('
|
|
153
|
+
const minted = await transport.door(houseDoorRoute('update'), {
|
|
146
154
|
...head,
|
|
155
|
+
op: 'stage',
|
|
147
156
|
paths,
|
|
148
157
|
bytes,
|
|
149
158
|
sha256,
|
|
@@ -155,39 +164,21 @@ export function createAgentsHouseAdapter(options) {
|
|
|
155
164
|
}
|
|
156
165
|
const grant = parseGrant(minted.body);
|
|
157
166
|
if (grant === null)
|
|
158
|
-
return { outcome:
|
|
167
|
+
return { outcome: unusable() };
|
|
159
168
|
const delivered = await transport.transfer({
|
|
160
|
-
act: 'authored_batch_upload',
|
|
161
169
|
url: grant.url,
|
|
162
170
|
body: `${grant.operation}\n${delta}`,
|
|
163
171
|
});
|
|
164
|
-
if (delivered.status !== 200)
|
|
165
|
-
return { outcome:
|
|
172
|
+
if (delivered.status !== 200) {
|
|
173
|
+
return { outcome: answeredFailure(delivered.status, delivered.body) };
|
|
174
|
+
}
|
|
166
175
|
const holding = parseGrant(delivered.body);
|
|
167
176
|
if (holding === null)
|
|
168
|
-
return { outcome:
|
|
177
|
+
return { outcome: unusable() };
|
|
169
178
|
const upload = { url: holding.url, operation: holding.operation, bytes, sha256 };
|
|
170
179
|
await keep(upload);
|
|
171
180
|
return { body: { ...head, paths, upload, runtime: notifications.runtime } };
|
|
172
181
|
}
|
|
173
|
-
async function staged(answer, { changeBatch: batch, file }) {
|
|
174
|
-
const refusal = doorRefusal(answer.body);
|
|
175
|
-
if (refusal?.code !== 'files_unstaged')
|
|
176
|
-
return null;
|
|
177
|
-
const uploads = refusal.fields.upload;
|
|
178
|
-
if (!Array.isArray(uploads))
|
|
179
|
-
return false;
|
|
180
|
-
for (const named of uploads) {
|
|
181
|
-
const upload = houseUpload(named);
|
|
182
|
-
const change = batch.changes.find((held) => held.kind === 'binary' && held.sha256 === named.sha256);
|
|
183
|
-
if (upload === null || change === undefined)
|
|
184
|
-
return false;
|
|
185
|
-
const finished = await finishedUpload(transport, upload, await file(change.localId));
|
|
186
|
-
if (finished?.body?.staged !== true)
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
182
|
async function submit(request, head, changes, delta, bytes, entry, handed, keep, into) {
|
|
192
183
|
const inline = { ...head, changes, runtime: notifications.runtime };
|
|
193
184
|
const prepared = uploadable(inline, bytes, declared())
|
|
@@ -195,13 +186,12 @@ export function createAgentsHouseAdapter(options) {
|
|
|
195
186
|
: { body: inline };
|
|
196
187
|
if ('outcome' in prepared)
|
|
197
188
|
return prepared.outcome;
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return UNCERTAIN;
|
|
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;
|
|
205
195
|
return stepped(mutationOutcome(settled.status, settled.body, entry.locator, entry.handle, into === undefined
|
|
206
196
|
? undefined
|
|
207
197
|
: {
|
|
@@ -209,28 +199,26 @@ export function createAgentsHouseAdapter(options) {
|
|
|
209
199
|
destination: { authority: into.authority, handle: into.handle },
|
|
210
200
|
}));
|
|
211
201
|
}
|
|
212
|
-
function
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const address = addressed(answer, locator);
|
|
229
|
-
return address.kind === 'address'
|
|
230
|
-
? { kind: 'link', url: address.url, name: address.name, mediaType: address.mediaType }
|
|
231
|
-
: address;
|
|
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);
|
|
232
218
|
}
|
|
233
|
-
function
|
|
219
|
+
function refusedOn(answer, locator) {
|
|
220
|
+
if (locator === null)
|
|
221
|
+
return keyedFailure(answer.status, answer.body);
|
|
234
222
|
const failure = classifyDoor(answer.status, answer.body, locator);
|
|
235
223
|
if (failure === null)
|
|
236
224
|
return null;
|
|
@@ -243,6 +231,48 @@ export function createAgentsHouseAdapter(options) {
|
|
|
243
231
|
}
|
|
244
232
|
: failure;
|
|
245
233
|
}
|
|
234
|
+
function addressed(answer, locator) {
|
|
235
|
+
const failure = refusedOn(answer, locator);
|
|
236
|
+
if (failure !== null)
|
|
237
|
+
return failure;
|
|
238
|
+
const address = parseFileAddress(answer.body);
|
|
239
|
+
return address === null ? unusable() : { kind: 'address', ...address };
|
|
240
|
+
}
|
|
241
|
+
function linked(answer, locator) {
|
|
242
|
+
const address = addressed(answer, locator);
|
|
243
|
+
return address.kind === 'address'
|
|
244
|
+
? { kind: 'link', url: address.url, name: address.name, mediaType: address.mediaType }
|
|
245
|
+
: address;
|
|
246
|
+
}
|
|
247
|
+
async function attached(request, into) {
|
|
248
|
+
const locator = into?.locator ?? null;
|
|
249
|
+
const declared = await transport.door(houseDoorRoute('files/attach'), {
|
|
250
|
+
...(into === null ? {} : { room_ref: into.authority }),
|
|
251
|
+
name: request.name,
|
|
252
|
+
bytes: request.byteLength,
|
|
253
|
+
sha256: request.sha256,
|
|
254
|
+
media_type: request.mediaType,
|
|
255
|
+
});
|
|
256
|
+
const refused = refusedOn(declared, locator);
|
|
257
|
+
if (refused !== null)
|
|
258
|
+
return refused;
|
|
259
|
+
const upload = houseUpload(declared.body?.upload);
|
|
260
|
+
if (upload === null)
|
|
261
|
+
return unusable();
|
|
262
|
+
const finished = await finishedUpload(transport, upload, request.blob);
|
|
263
|
+
if ('unfinished' in finished)
|
|
264
|
+
return answeredFailure(finished.unfinished, null);
|
|
265
|
+
const unfinished = refusedOn(finished, locator);
|
|
266
|
+
if (unfinished !== null)
|
|
267
|
+
return unfinished;
|
|
268
|
+
const { path, revision, link } = (finished.body ?? {});
|
|
269
|
+
if (into === null)
|
|
270
|
+
return typeof link === 'string' ? { kind: 'linked', link } : unusable();
|
|
271
|
+
const root = `/rooms/${into.handle}/`;
|
|
272
|
+
return typeof path === 'string' && path.startsWith(root) && typeof revision === 'string'
|
|
273
|
+
? { kind: 'attached', path: path.slice(root.length), revision }
|
|
274
|
+
: unusable();
|
|
275
|
+
}
|
|
246
276
|
async function downloaded(ask, locator) {
|
|
247
277
|
let address = addressed(await ask(), locator);
|
|
248
278
|
if (address.kind !== 'address')
|
|
@@ -254,20 +284,24 @@ export function createAgentsHouseAdapter(options) {
|
|
|
254
284
|
return address;
|
|
255
285
|
read = await transport.download(address.url);
|
|
256
286
|
}
|
|
257
|
-
if (read.status !== 200
|
|
258
|
-
return
|
|
287
|
+
if (read.status !== 200)
|
|
288
|
+
return answeredFailure(read.status, null);
|
|
289
|
+
if (read.body === null)
|
|
290
|
+
return unusable();
|
|
259
291
|
return {
|
|
260
292
|
kind: 'binary',
|
|
261
293
|
body: read.body,
|
|
262
294
|
mediaType: address.mediaType,
|
|
263
295
|
sha256: address.sha256,
|
|
296
|
+
url: address.url,
|
|
297
|
+
copies: address.copies,
|
|
264
298
|
};
|
|
265
299
|
}
|
|
266
300
|
function pathAddress(request) {
|
|
267
301
|
const entry = authorityFor(request.locator);
|
|
268
302
|
if (entry === undefined)
|
|
269
303
|
return null;
|
|
270
|
-
return () => transport.door(houseDoorRoute('files/
|
|
304
|
+
return () => transport.door(houseDoorRoute('files/read'), {
|
|
271
305
|
room_ref: entry.authority,
|
|
272
306
|
path: request.path,
|
|
273
307
|
revision: request.revision,
|
|
@@ -275,8 +309,12 @@ export function createAgentsHouseAdapter(options) {
|
|
|
275
309
|
}
|
|
276
310
|
return {
|
|
277
311
|
roomTypes: HOUSE_ROOM_TYPES,
|
|
278
|
-
nameableRoomTypes: HOUSE_NAMEABLE_ROOM_TYPES,
|
|
279
312
|
typedPaths: HOUSE_TYPED_PATHS,
|
|
313
|
+
pathRule: admittedPath,
|
|
314
|
+
unkeptReads: HOUSE_UNKEPT_READS,
|
|
315
|
+
leadingReads: HOUSE_LEADING_READS,
|
|
316
|
+
renamedActions: new Map([...HOUSE_RENAMED_UNTIL_2026_12_18, ...HOUSE_RENAMED_UNTIL_2026_12_21]),
|
|
317
|
+
rewrittenInputs: rewrittenInTurn(HOUSE_REWRITTEN_UNTIL_2026_12_19, HOUSE_REWRITTEN_UNTIL_2026_12_21),
|
|
280
318
|
async authorize() {
|
|
281
319
|
return options.authorize();
|
|
282
320
|
},
|
|
@@ -292,41 +330,29 @@ export function createAgentsHouseAdapter(options) {
|
|
|
292
330
|
const entry = authorityFor(request.locator);
|
|
293
331
|
if (entry === undefined)
|
|
294
332
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
295
|
-
const
|
|
296
|
-
const destination = batch.between?.destination.room;
|
|
333
|
+
const destination = request.changeBatch.between?.destination.room;
|
|
297
334
|
const into = destination === undefined ? undefined : authorityFor(destination);
|
|
298
335
|
if (destination !== undefined && into === undefined) {
|
|
299
336
|
return { kind: 'room-not-readable', locator: destination };
|
|
300
337
|
}
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if (mapped.kind === 'unmapped')
|
|
305
|
-
return rejectedMapping(mapped);
|
|
306
|
-
const head = operationHead(batch, entry.authority);
|
|
307
|
-
const delta = deltaBody(mapped.changes);
|
|
308
|
-
const bytes = deltaBytes(delta);
|
|
309
|
-
const handed = request.upload;
|
|
310
|
-
const answer = (upload) => submit(request, head, mapped.changes, delta, bytes, entry, upload, keep, into);
|
|
311
|
-
const outcome = await answer(handed);
|
|
312
|
-
if (handed === undefined || !lapsedGrant(outcome))
|
|
338
|
+
const outcome = await mutated(request, keep, entry, into);
|
|
339
|
+
const renamed = renamedHandle(outcome);
|
|
340
|
+
if (renamed === null)
|
|
313
341
|
return outcome;
|
|
314
|
-
|
|
342
|
+
const moved = (held) => held.handle === renamed.from ? { ...held, handle: renamed.to } : held;
|
|
343
|
+
return mutated(request, keep, moved(entry), into === undefined ? undefined : moved(into));
|
|
315
344
|
},
|
|
316
345
|
async history(_authorization, request) {
|
|
317
346
|
const entry = authorityFor(request.locator);
|
|
318
347
|
if (entry === undefined)
|
|
319
348
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
320
|
-
const answer = await transport.door(houseDoorRoute('revisions'), revisionBody({
|
|
349
|
+
const answer = await transport.door(houseDoorRoute('files/revisions/list'), revisionBody({
|
|
321
350
|
path: request.path,
|
|
322
351
|
handle: entry.handle,
|
|
323
352
|
...(request.revision === undefined ? {} : { revision: request.revision }),
|
|
324
353
|
...(request.pageToken === undefined ? {} : { pageToken: request.pageToken }),
|
|
325
354
|
}));
|
|
326
|
-
return historyOutcome(answer.status, answer.body, entry.locator,
|
|
327
|
-
path: request.path,
|
|
328
|
-
...(request.revision === undefined ? {} : { revision: request.revision }),
|
|
329
|
-
});
|
|
355
|
+
return historyOutcome(answer.status, answer.body, entry.locator, request);
|
|
330
356
|
},
|
|
331
357
|
async binary(_authorization, request) {
|
|
332
358
|
const ask = pathAddress(request);
|
|
@@ -335,39 +361,21 @@ export function createAgentsHouseAdapter(options) {
|
|
|
335
361
|
return downloaded(ask, request.locator);
|
|
336
362
|
},
|
|
337
363
|
async link(_authorization, request) {
|
|
364
|
+
if (request.kind === 'key') {
|
|
365
|
+
return linked(await transport.door(houseDoorRoute('files/read'), { link: request.link }), null);
|
|
366
|
+
}
|
|
338
367
|
const ask = pathAddress(request);
|
|
339
368
|
if (ask === null)
|
|
340
369
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
341
370
|
return linked(await ask(), request.locator);
|
|
342
371
|
},
|
|
343
372
|
async attach(_authorization, request) {
|
|
373
|
+
if (request.locator === undefined)
|
|
374
|
+
return attached(request, null);
|
|
344
375
|
const entry = authorityFor(request.locator);
|
|
345
376
|
if (entry === undefined)
|
|
346
377
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
347
|
-
|
|
348
|
-
room_ref: entry.authority,
|
|
349
|
-
name: request.name,
|
|
350
|
-
bytes: request.byteLength,
|
|
351
|
-
sha256: request.sha256,
|
|
352
|
-
media_type: request.mediaType.length > 0 ? request.mediaType : OCTET_STREAM,
|
|
353
|
-
});
|
|
354
|
-
const refused = refusedAttach(declared, request.locator);
|
|
355
|
-
if (refused !== null)
|
|
356
|
-
return refused;
|
|
357
|
-
const upload = houseUpload(declared.body?.upload);
|
|
358
|
-
if (upload === null)
|
|
359
|
-
return UNCERTAIN_READ;
|
|
360
|
-
const finished = await finishedUpload(transport, upload, request.blob);
|
|
361
|
-
if (finished === null)
|
|
362
|
-
return UNCERTAIN_READ;
|
|
363
|
-
const unfinished = refusedAttach(finished, request.locator);
|
|
364
|
-
if (unfinished !== null)
|
|
365
|
-
return unfinished;
|
|
366
|
-
const { path, revision } = (finished.body ?? {});
|
|
367
|
-
const root = `/rooms/${entry.handle}/`;
|
|
368
|
-
return typeof path === 'string' && path.startsWith(root) && typeof revision === 'string'
|
|
369
|
-
? { kind: 'attached', path: path.slice(root.length), revision }
|
|
370
|
-
: UNCERTAIN_READ;
|
|
378
|
+
return attached(request, entry);
|
|
371
379
|
},
|
|
372
380
|
reached(locator, version, target) {
|
|
373
381
|
return reachedVersion(version, target, authorityFor(locator)?.logEpoch);
|
|
@@ -381,6 +389,9 @@ export function createAgentsHouseAdapter(options) {
|
|
|
381
389
|
search(_authorization, request) {
|
|
382
390
|
return houseSearch(transport, [...tracked.values()], request);
|
|
383
391
|
},
|
|
392
|
+
queryHouse(_authorization, request) {
|
|
393
|
+
return houseQuery(transport, request);
|
|
394
|
+
},
|
|
384
395
|
roomStream: {
|
|
385
396
|
hold,
|
|
386
397
|
observe: notifications.observe,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare const GENERATED_PROVENANCE = "_provenance";
|
|
2
|
+
export declare const GENERATED_REVISIONS = "_revisions";
|
|
3
|
+
export declare const RESERVED_DERIVED = "_derived";
|
|
4
|
+
export declare const WHOLE_ESCAPED_NAMES: readonly string[];
|
|
5
|
+
export declare const LOCAL_COPY_MANIFEST = ".house";
|
|
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;
|
|
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;
|
|
@@ -0,0 +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;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,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAE7B,MAAM,MAAM,WAAW,GACnB,CAAC,WAAW,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GACzC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAsB5D,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO9C;AAYD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAiB5D;AASD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAU5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKlD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7D;AAyCD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAI,EAAE,IAAI,SAAK,GAAG,MAAM,CAUrE"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { APP_PREFERENCES_HOME, APP_REFERENCE_PATTERN, foldedName } from '@agentshouse/mdmodel';
|
|
2
|
+
export const GENERATED_PROVENANCE = '_provenance';
|
|
3
|
+
export const GENERATED_REVISIONS = '_revisions';
|
|
4
|
+
export const RESERVED_DERIVED = '_derived';
|
|
5
|
+
export const WHOLE_ESCAPED_NAMES = [
|
|
6
|
+
'.',
|
|
7
|
+
'..',
|
|
8
|
+
GENERATED_PROVENANCE,
|
|
9
|
+
GENERATED_REVISIONS,
|
|
10
|
+
RESERVED_DERIVED,
|
|
11
|
+
];
|
|
12
|
+
export const LOCAL_COPY_MANIFEST = '.house';
|
|
13
|
+
const ROOM_FOLDER_FILES = ['AGENTS.md', 'CLAUDE.md'];
|
|
14
|
+
export const LOCAL_COPY_ROOT_NAMES = [
|
|
15
|
+
'.gitignore',
|
|
16
|
+
'.ignore',
|
|
17
|
+
LOCAL_COPY_MANIFEST,
|
|
18
|
+
...ROOM_FOLDER_FILES,
|
|
19
|
+
];
|
|
20
|
+
export const AUTHORED_NAME_MAX_BYTES = 255;
|
|
21
|
+
export const AUTHORED_PATH_MAX_BYTES = 768;
|
|
22
|
+
const FITTED_STEM = 'file';
|
|
23
|
+
export const AUTHORED_NAME_RULE = {
|
|
24
|
+
refusedCharacters: '/\\:*?"<>|',
|
|
25
|
+
controlCharacters: 'Cc',
|
|
26
|
+
refusedEnds: ' .',
|
|
27
|
+
refusedStart: '-',
|
|
28
|
+
gitNames: ['.git', 'git~1'],
|
|
29
|
+
windowsNames: [
|
|
30
|
+
'CON',
|
|
31
|
+
'PRN',
|
|
32
|
+
'AUX',
|
|
33
|
+
'NUL',
|
|
34
|
+
...['1', '2', '3', '4', '5', '6', '7', '8', '9', '¹', '²', '³'].flatMap((digit) => [
|
|
35
|
+
`COM${digit}`,
|
|
36
|
+
`LPT${digit}`,
|
|
37
|
+
]),
|
|
38
|
+
],
|
|
39
|
+
generatedNames: [GENERATED_PROVENANCE, GENERATED_REVISIONS, RESERVED_DERIVED],
|
|
40
|
+
nameMaxBytes: AUTHORED_NAME_MAX_BYTES,
|
|
41
|
+
pathMaxBytes: AUTHORED_PATH_MAX_BYTES,
|
|
42
|
+
};
|
|
43
|
+
const LONE_SURROGATE = /\p{Cs}/u;
|
|
44
|
+
const LONE_SURROGATES = /\p{Cs}/gu;
|
|
45
|
+
const CONTROL = /\p{Cc}/u;
|
|
46
|
+
const MAC_IGNORED = /[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/gu;
|
|
47
|
+
const FOLDED_GIT_NAMES = new Set(AUTHORED_NAME_RULE.gitNames.map(foldedName));
|
|
48
|
+
const FOLDED_WINDOWS_NAMES = new Set(AUTHORED_NAME_RULE.windowsNames.map(foldedName));
|
|
49
|
+
const FOLDED_GENERATED_NAMES = new Set(AUTHORED_NAME_RULE.generatedNames.map(foldedName));
|
|
50
|
+
const FOLDED_ROOT_NAMES = new Set(LOCAL_COPY_ROOT_NAMES.map(foldedName));
|
|
51
|
+
export function utf8Bytes(text) {
|
|
52
|
+
let bytes = 0;
|
|
53
|
+
for (const point of text) {
|
|
54
|
+
const code = point.codePointAt(0);
|
|
55
|
+
bytes += code < 0x80 ? 1 : code < 0x800 ? 2 : code < 0x10000 ? 3 : 4;
|
|
56
|
+
}
|
|
57
|
+
return bytes;
|
|
58
|
+
}
|
|
59
|
+
function refusedCharacter(point) {
|
|
60
|
+
return AUTHORED_NAME_RULE.refusedCharacters.includes(point) || CONTROL.test(point);
|
|
61
|
+
}
|
|
62
|
+
function windowsName(name) {
|
|
63
|
+
const dot = name.indexOf('.');
|
|
64
|
+
const base = dot < 0 ? name : name.slice(0, dot);
|
|
65
|
+
return FOLDED_WINDOWS_NAMES.has(foldedName(base)) ? base : null;
|
|
66
|
+
}
|
|
67
|
+
export function nameRefusal(name) {
|
|
68
|
+
if (LONE_SURROGATE.test(name))
|
|
69
|
+
return { rule: 'unicode' };
|
|
70
|
+
for (const point of name)
|
|
71
|
+
if (refusedCharacter(point))
|
|
72
|
+
return { rule: 'character', character: point };
|
|
73
|
+
if (name === '')
|
|
74
|
+
return { rule: 'empty' };
|
|
75
|
+
if (name === '.' || name === '..')
|
|
76
|
+
return { rule: 'dots' };
|
|
77
|
+
const last = name.at(-1);
|
|
78
|
+
if (AUTHORED_NAME_RULE.refusedEnds.includes(last))
|
|
79
|
+
return { rule: 'end', character: last };
|
|
80
|
+
if (FOLDED_GIT_NAMES.has(foldedName(name.replace(MAC_IGNORED, ''))))
|
|
81
|
+
return { rule: 'git' };
|
|
82
|
+
const reserved = windowsName(name);
|
|
83
|
+
if (reserved !== null)
|
|
84
|
+
return { rule: 'windows', reserved };
|
|
85
|
+
const bytes = utf8Bytes(name);
|
|
86
|
+
if (bytes > AUTHORED_NAME_MAX_BYTES)
|
|
87
|
+
return { rule: 'name_bytes', bytes };
|
|
88
|
+
if (name.startsWith(AUTHORED_NAME_RULE.refusedStart))
|
|
89
|
+
return { rule: 'start' };
|
|
90
|
+
if (FOLDED_GENERATED_NAMES.has(foldedName(name)))
|
|
91
|
+
return { rule: 'generated' };
|
|
92
|
+
if (name.normalize('NFC') !== name)
|
|
93
|
+
return { rule: 'nfc' };
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
function appPreferences(path) {
|
|
97
|
+
return (path.endsWith('.md') &&
|
|
98
|
+
APP_REFERENCE_PATTERN.test(path.slice(APP_PREFERENCES_HOME.length + 1, -3)));
|
|
99
|
+
}
|
|
100
|
+
export function pathRefusal(path) {
|
|
101
|
+
const names = path.split('/');
|
|
102
|
+
const [root] = names;
|
|
103
|
+
if (FOLDED_ROOT_NAMES.has(foldedName(root)))
|
|
104
|
+
return { rule: 'root', name: root };
|
|
105
|
+
for (const name of names) {
|
|
106
|
+
const refused = nameRefusal(name);
|
|
107
|
+
if (refused !== null)
|
|
108
|
+
return { ...refused, name };
|
|
109
|
+
}
|
|
110
|
+
const bytes = utf8Bytes(path);
|
|
111
|
+
return bytes > AUTHORED_PATH_MAX_BYTES ? { rule: 'path_bytes', bytes } : null;
|
|
112
|
+
}
|
|
113
|
+
export function admittedPath(path) {
|
|
114
|
+
return (pathRefusal(path) === null &&
|
|
115
|
+
(!path.startsWith(`${APP_PREFERENCES_HOME}/`) || appPreferences(path)));
|
|
116
|
+
}
|
|
117
|
+
export function sameName(left, right) {
|
|
118
|
+
return foldedName(left) === foldedName(right);
|
|
119
|
+
}
|
|
120
|
+
function cutToBytes(text, bytes) {
|
|
121
|
+
let kept = '';
|
|
122
|
+
let used = 0;
|
|
123
|
+
for (const point of text) {
|
|
124
|
+
used += utf8Bytes(point);
|
|
125
|
+
if (used > bytes)
|
|
126
|
+
break;
|
|
127
|
+
kept += point;
|
|
128
|
+
}
|
|
129
|
+
return kept;
|
|
130
|
+
}
|
|
131
|
+
function trimmedEnd(text) {
|
|
132
|
+
let end = text.length;
|
|
133
|
+
while (end > 0 && AUTHORED_NAME_RULE.refusedEnds.includes(text[end - 1]))
|
|
134
|
+
end -= 1;
|
|
135
|
+
return text.slice(0, end);
|
|
136
|
+
}
|
|
137
|
+
function trimmedStart(text) {
|
|
138
|
+
let start = 0;
|
|
139
|
+
while (start < text.length && text[start] === AUTHORED_NAME_RULE.refusedStart)
|
|
140
|
+
start += 1;
|
|
141
|
+
return text.slice(start);
|
|
142
|
+
}
|
|
143
|
+
function nameParts(name) {
|
|
144
|
+
const dot = name.lastIndexOf('.');
|
|
145
|
+
return dot <= 0
|
|
146
|
+
? { stem: name, extension: '' }
|
|
147
|
+
: { stem: name.slice(0, dot), extension: name.slice(dot) };
|
|
148
|
+
}
|
|
149
|
+
function fitted(stem, extension, tail, count) {
|
|
150
|
+
const suffix = count > 1 ? `-${count}` : '';
|
|
151
|
+
const room = AUTHORED_NAME_MAX_BYTES - utf8Bytes(suffix);
|
|
152
|
+
const whole = utf8Bytes(`${extension}${tail}`) < room;
|
|
153
|
+
const kept = whole ? `${extension}${tail}` : tail;
|
|
154
|
+
const cut = cutToBytes(whole ? stem : `${stem}${extension}`, room - utf8Bytes(kept));
|
|
155
|
+
return `${suffix === '' && kept === '' ? trimmedEnd(cut) : cut}${suffix}${kept}`;
|
|
156
|
+
}
|
|
157
|
+
export function fittedName(name, count = 1, tail = '') {
|
|
158
|
+
let replaced = '';
|
|
159
|
+
for (const point of name.replace(LONE_SURROGATES, '\uFFFD').normalize('NFC'))
|
|
160
|
+
replaced += refusedCharacter(point) ? '-' : point;
|
|
161
|
+
const { stem: typed, extension } = nameParts(trimmedEnd(replaced));
|
|
162
|
+
const stem = trimmedStart(typed);
|
|
163
|
+
const named = stem !== '' && nameRefusal(fitted(stem, extension, tail, 1)) === null ? stem : FITTED_STEM;
|
|
164
|
+
const counted = fitted(named, extension, tail, count);
|
|
165
|
+
return nameRefusal(counted) === null ? counted : fitted(FITTED_STEM, extension, tail, count);
|
|
166
|
+
}
|