@agentshouse/mdruntime-adapter 0.1.0-alpha.1 → 0.1.0-alpha.2
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/AGENTS.md +78 -0
- package/dist/actions.d.ts +16 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +454 -0
- package/dist/actions.js.map +1 -0
- package/dist/adapter.d.ts +8 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +341 -0
- package/dist/adapter.js.map +1 -0
- package/dist/digest.d.ts +3 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +11 -0
- package/dist/digest.js.map +1 -0
- package/dist/discovery.d.ts +60 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +242 -0
- package/dist/discovery.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/map.d.ts +3 -0
- package/dist/map.d.ts.map +1 -0
- package/dist/map.js +15 -0
- package/dist/map.js.map +1 -0
- package/dist/read.d.ts +67 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +244 -0
- package/dist/read.js.map +1 -0
- package/dist/refusal.d.ts +8 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +65 -0
- package/dist/refusal.js.map +1 -0
- package/dist/stream.d.ts +10 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +239 -0
- package/dist/stream.js.map +1 -0
- package/dist/transport.d.ts +77 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +9 -0
- package/dist/transport.js.map +1 -0
- package/dist/write.d.ts +41 -0
- package/dist/write.d.ts.map +1 -0
- package/dist/write.js +377 -0
- package/dist/write.js.map +1 -0
- package/package.json +7 -2
package/dist/write.js
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { sha256Hex, textBytes } from './digest.js';
|
|
2
|
+
import { nativePath, roomLocalPath } from './map.js';
|
|
3
|
+
import { classifyDoor, doorRefusal, scopedRefusal } from './refusal.js';
|
|
4
|
+
export const INLINE_BODY_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
5
|
+
export const UPLOAD_LINE_BYTES = 37;
|
|
6
|
+
export const UPLOAD_BYTES_MAX = 32 * 1024 * 1024 - UPLOAD_LINE_BYTES;
|
|
7
|
+
function priorField(batch, path, name) {
|
|
8
|
+
return batch.preconditions.find((precondition)=>precondition.kind === 'field' && precondition.path === path && precondition.name === name);
|
|
9
|
+
}
|
|
10
|
+
function priorSection(batch, path, name) {
|
|
11
|
+
return batch.preconditions.find((precondition)=>precondition.kind === 'section' && precondition.path === path && precondition.name === name);
|
|
12
|
+
}
|
|
13
|
+
function priorPreamble(batch, path) {
|
|
14
|
+
return batch.preconditions.find((precondition)=>precondition.kind === 'preamble' && precondition.path === path);
|
|
15
|
+
}
|
|
16
|
+
function priorAbsence(batch, path) {
|
|
17
|
+
return batch.preconditions.find((precondition)=>precondition.kind === 'absent' && precondition.path === path);
|
|
18
|
+
}
|
|
19
|
+
function priorExistence(batch, path) {
|
|
20
|
+
const precondition = batch.preconditions.find((held)=>held.path === path && (held.kind === 'revision' || held.kind === 'present'));
|
|
21
|
+
if (precondition === undefined) return undefined;
|
|
22
|
+
return precondition.kind === 'revision' ? {
|
|
23
|
+
base: precondition.revision
|
|
24
|
+
} : {
|
|
25
|
+
kind: 'presence'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function typedCreate(change, path) {
|
|
29
|
+
const { type, ...fields } = change.fields;
|
|
30
|
+
if (typeof type !== 'string' || type.length === 0) return null;
|
|
31
|
+
return {
|
|
32
|
+
op: 'create_typed',
|
|
33
|
+
path,
|
|
34
|
+
type,
|
|
35
|
+
fields,
|
|
36
|
+
sections: change.sections
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function operationOf(batch, change, handle) {
|
|
40
|
+
const path = nativePath(change.path, handle);
|
|
41
|
+
if (change.kind === 'field') {
|
|
42
|
+
const prior = priorField(batch, change.path, change.name);
|
|
43
|
+
if (prior === undefined) return {
|
|
44
|
+
rule: 'precondition-missing'
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
operation: {
|
|
48
|
+
op: 'set_field',
|
|
49
|
+
path,
|
|
50
|
+
field: change.name,
|
|
51
|
+
value: change.value,
|
|
52
|
+
...prior.value === undefined ? {} : {
|
|
53
|
+
base: prior.value
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (change.kind === 'section') {
|
|
59
|
+
const prior = priorSection(batch, change.path, change.name);
|
|
60
|
+
if (prior === undefined) return {
|
|
61
|
+
rule: 'precondition-missing'
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
operation: {
|
|
65
|
+
op: 'replace_section',
|
|
66
|
+
path,
|
|
67
|
+
section: change.name,
|
|
68
|
+
base: prior.value,
|
|
69
|
+
content: change.value
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (change.kind === 'preamble') {
|
|
74
|
+
const prior = priorPreamble(batch, change.path);
|
|
75
|
+
if (prior === undefined) return {
|
|
76
|
+
rule: 'precondition-missing'
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
operation: {
|
|
80
|
+
op: 'replace_preamble',
|
|
81
|
+
path,
|
|
82
|
+
base: prior.value,
|
|
83
|
+
content: change.value
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (change.kind === 'create') {
|
|
88
|
+
if (priorAbsence(batch, change.path) === undefined) return {
|
|
89
|
+
rule: 'precondition-missing'
|
|
90
|
+
};
|
|
91
|
+
const created = typedCreate(change, path);
|
|
92
|
+
return created === null ? {
|
|
93
|
+
rule: 'type-missing'
|
|
94
|
+
} : {
|
|
95
|
+
operation: created
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const existence = priorExistence(batch, change.path);
|
|
99
|
+
if (existence === undefined) return {
|
|
100
|
+
rule: 'precondition-missing'
|
|
101
|
+
};
|
|
102
|
+
if (!('base' in existence)) return {
|
|
103
|
+
rule: 'presence-base-unrepresentable'
|
|
104
|
+
};
|
|
105
|
+
if (change.kind === 'replace') {
|
|
106
|
+
return {
|
|
107
|
+
operation: {
|
|
108
|
+
op: 'replace',
|
|
109
|
+
path,
|
|
110
|
+
base: existence.base,
|
|
111
|
+
content: change.content
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (change.kind === 'move') {
|
|
116
|
+
if (priorAbsence(batch, change.to) === undefined) return {
|
|
117
|
+
rule: 'precondition-missing'
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
operation: {
|
|
121
|
+
op: 'rename',
|
|
122
|
+
path,
|
|
123
|
+
to: nativePath(change.to, handle),
|
|
124
|
+
base: existence.base
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
operation: {
|
|
130
|
+
op: 'remove',
|
|
131
|
+
path,
|
|
132
|
+
base: existence.base
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export function houseChanges(batch, handle) {
|
|
137
|
+
const changes = [];
|
|
138
|
+
for (const change of batch.changes){
|
|
139
|
+
const mapped = operationOf(batch, change, handle);
|
|
140
|
+
if ('rule' in mapped) return {
|
|
141
|
+
kind: 'unmapped',
|
|
142
|
+
path: change.path,
|
|
143
|
+
rule: mapped.rule
|
|
144
|
+
};
|
|
145
|
+
changes.push(mapped.operation);
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
kind: 'changes',
|
|
149
|
+
changes
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export function batchPaths(changes) {
|
|
153
|
+
return [
|
|
154
|
+
...new Set(changes.flatMap((change)=>change.op === 'rename' ? [
|
|
155
|
+
String(change.path),
|
|
156
|
+
String(change.to)
|
|
157
|
+
] : [
|
|
158
|
+
String(change.path)
|
|
159
|
+
]))
|
|
160
|
+
].sort();
|
|
161
|
+
}
|
|
162
|
+
export function deltaBody(changes) {
|
|
163
|
+
return JSON.stringify({
|
|
164
|
+
changes
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
export function deltaBytes(delta) {
|
|
168
|
+
return textBytes(delta);
|
|
169
|
+
}
|
|
170
|
+
export function uploadable(bytes) {
|
|
171
|
+
return bytes > INLINE_BODY_LIMIT_BYTES && bytes <= UPLOAD_BYTES_MAX;
|
|
172
|
+
}
|
|
173
|
+
export function deltaDigest(delta) {
|
|
174
|
+
return sha256Hex(delta);
|
|
175
|
+
}
|
|
176
|
+
function material(value, handle) {
|
|
177
|
+
if (!Array.isArray(value)) return null;
|
|
178
|
+
const held = [];
|
|
179
|
+
for (const entry of value){
|
|
180
|
+
if (typeof entry !== 'object' || entry === null) return null;
|
|
181
|
+
const file = entry;
|
|
182
|
+
if (typeof file.path !== 'string') return null;
|
|
183
|
+
if (file.content !== null && typeof file.content !== 'string') return null;
|
|
184
|
+
if (file.revision !== null && file.revision !== undefined && typeof file.revision !== 'string') return null;
|
|
185
|
+
let path;
|
|
186
|
+
try {
|
|
187
|
+
path = roomLocalPath(file.path, handle);
|
|
188
|
+
} catch {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
held.push({
|
|
192
|
+
path,
|
|
193
|
+
content: file.content,
|
|
194
|
+
revision: typeof file.revision === 'string' ? file.revision : null
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return held;
|
|
198
|
+
}
|
|
199
|
+
function affectedOf(held) {
|
|
200
|
+
const affected = {};
|
|
201
|
+
for (const entry of held){
|
|
202
|
+
if (entry.content !== null) affected[entry.path] = entry.content;
|
|
203
|
+
}
|
|
204
|
+
return affected;
|
|
205
|
+
}
|
|
206
|
+
export function mutationOutcome(status, body, locator, handle) {
|
|
207
|
+
const refusal = doorRefusal(body);
|
|
208
|
+
if (refusal !== null && refusal.code === 'rate_limited') {
|
|
209
|
+
const reset = refusal.fields.retry_at;
|
|
210
|
+
return {
|
|
211
|
+
kind: 'retryable-refusal',
|
|
212
|
+
code: refusal.code,
|
|
213
|
+
fields: refusal.fields,
|
|
214
|
+
...typeof reset === 'string' ? {
|
|
215
|
+
reset
|
|
216
|
+
} : {}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
if (refusal !== null && refusal.code === 'operation_expired') return {
|
|
220
|
+
kind: 'expired'
|
|
221
|
+
};
|
|
222
|
+
if (refusal !== null && refusal.code === 'edit_conflict') {
|
|
223
|
+
const { current, ...fields } = refusal.fields;
|
|
224
|
+
const held = material(current, handle) ?? [];
|
|
225
|
+
return {
|
|
226
|
+
kind: 'conflicted',
|
|
227
|
+
affected: affectedOf(held),
|
|
228
|
+
code: refusal.code,
|
|
229
|
+
fields
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (refusal !== null && status === 404) {
|
|
233
|
+
return scopedRefusal(locator, 'undisclosed', refusal);
|
|
234
|
+
}
|
|
235
|
+
const classified = classifyDoor(status, body, locator);
|
|
236
|
+
if (classified !== null && classified.kind !== 'scoped-refusal') {
|
|
237
|
+
return classified.kind === 'beyond-horizon' ? {
|
|
238
|
+
kind: 'transport-uncertainty'
|
|
239
|
+
} : classified;
|
|
240
|
+
}
|
|
241
|
+
if (classified !== null && status === 403) return classified;
|
|
242
|
+
if (refusal !== null && status >= 400) {
|
|
243
|
+
return {
|
|
244
|
+
kind: 'rejected',
|
|
245
|
+
affected: {},
|
|
246
|
+
code: refusal.code,
|
|
247
|
+
fields: refusal.fields
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
if (status !== 200 || typeof body !== 'object' || body === null) {
|
|
251
|
+
return {
|
|
252
|
+
kind: 'transport-uncertainty'
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
const held = body;
|
|
256
|
+
if (typeof held.position !== 'string') return {
|
|
257
|
+
kind: 'transport-uncertainty'
|
|
258
|
+
};
|
|
259
|
+
const contents = material(held.contents, handle);
|
|
260
|
+
if (contents === null) return {
|
|
261
|
+
kind: 'transport-uncertainty'
|
|
262
|
+
};
|
|
263
|
+
const documents = {};
|
|
264
|
+
const revisions = {};
|
|
265
|
+
const removals = [];
|
|
266
|
+
for (const entry of contents){
|
|
267
|
+
if (entry.content === null || entry.revision === null) {
|
|
268
|
+
removals.push(entry.path);
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
documents[entry.path] = entry.content;
|
|
272
|
+
revisions[entry.path] = entry.revision;
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
kind: 'accepted',
|
|
276
|
+
roomVersion: held.position,
|
|
277
|
+
documents,
|
|
278
|
+
revisions,
|
|
279
|
+
removals: removals.sort()
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
export function rejectedMapping(mapping) {
|
|
283
|
+
return {
|
|
284
|
+
kind: 'rejected',
|
|
285
|
+
affected: {},
|
|
286
|
+
code: mapping.rule,
|
|
287
|
+
fields: {
|
|
288
|
+
path: mapping.path
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
export function revisionBody(input) {
|
|
293
|
+
return {
|
|
294
|
+
path: nativePath(input.path, input.handle),
|
|
295
|
+
...input.revision === undefined ? {} : {
|
|
296
|
+
revision: input.revision
|
|
297
|
+
},
|
|
298
|
+
...input.pageToken === undefined ? {} : {
|
|
299
|
+
before: Number(input.pageToken)
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
export function historyOutcome(status, body, locator, request) {
|
|
304
|
+
const classified = classifyDoor(status, body, locator);
|
|
305
|
+
if (classified !== null) {
|
|
306
|
+
return classified.kind === 'beyond-horizon' ? {
|
|
307
|
+
kind: 'transport-uncertainty'
|
|
308
|
+
} : classified;
|
|
309
|
+
}
|
|
310
|
+
if (status !== 200 || typeof body !== 'object' || body === null) {
|
|
311
|
+
return {
|
|
312
|
+
kind: 'transport-uncertainty'
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
const held = body;
|
|
316
|
+
if (!Array.isArray(held.revisions)) return {
|
|
317
|
+
kind: 'transport-uncertainty'
|
|
318
|
+
};
|
|
319
|
+
const entries = [];
|
|
320
|
+
for (const entry of held.revisions){
|
|
321
|
+
if (typeof entry !== 'object' || entry === null) return {
|
|
322
|
+
kind: 'transport-uncertainty'
|
|
323
|
+
};
|
|
324
|
+
entries.push(entry);
|
|
325
|
+
}
|
|
326
|
+
if (request.revision !== undefined) {
|
|
327
|
+
const named = entries[0];
|
|
328
|
+
if (named === undefined) return {
|
|
329
|
+
kind: 'no-history'
|
|
330
|
+
};
|
|
331
|
+
if (named.unavailable === true) {
|
|
332
|
+
return {
|
|
333
|
+
kind: 'scoped-refusal',
|
|
334
|
+
locator,
|
|
335
|
+
scope: 'content',
|
|
336
|
+
code: 'retained_history_unavailable',
|
|
337
|
+
fields: {
|
|
338
|
+
path: request.path,
|
|
339
|
+
revision: request.revision
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
if (typeof named.content !== 'string') return {
|
|
344
|
+
kind: 'transport-uncertainty'
|
|
345
|
+
};
|
|
346
|
+
return {
|
|
347
|
+
kind: 'revision',
|
|
348
|
+
content: named.content
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
if (entries.length === 0) return {
|
|
352
|
+
kind: 'no-history'
|
|
353
|
+
};
|
|
354
|
+
const revisions = [];
|
|
355
|
+
for (const entry of entries){
|
|
356
|
+
if (typeof entry.revision !== 'string' || typeof entry.author_user !== 'string' || typeof entry.created_at !== 'string') {
|
|
357
|
+
return {
|
|
358
|
+
kind: 'transport-uncertainty'
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
revisions.push({
|
|
362
|
+
revision: entry.revision,
|
|
363
|
+
author: entry.author_user,
|
|
364
|
+
time: entry.created_at
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
const next = held.next_before;
|
|
368
|
+
return {
|
|
369
|
+
kind: 'history',
|
|
370
|
+
revisions,
|
|
371
|
+
...typeof next === 'number' ? {
|
|
372
|
+
pageToken: String(next)
|
|
373
|
+
} : {}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime-adapter/src/write.ts"],"sourcesContent":["import type {\n Change,\n ChangeBatch,\n HistoryResult,\n HistoryRevision,\n MutationResult,\n Precondition,\n} from '@agentshouse/mdruntime';\nimport { sha256Hex, textBytes } from './digest.js';\nimport { nativePath, roomLocalPath } from './map.js';\nimport { classifyDoor, doorRefusal, scopedRefusal } from './refusal.js';\n\nexport const INLINE_BODY_LIMIT_BYTES = 4 * 1024 * 1024;\n\nexport const UPLOAD_LINE_BYTES = 37;\n\nexport const UPLOAD_BYTES_MAX = 32 * 1024 * 1024 - UPLOAD_LINE_BYTES;\n\nexport type HouseOperation = Readonly<Record<string, unknown>>;\n\nexport type ChangeMapping =\n | { kind: 'changes'; changes: readonly HouseOperation[] }\n | { kind: 'unmapped'; path: string; rule: string };\n\ntype Existence = { base: string } | { kind: 'presence' };\n\nfunction priorField(batch: ChangeBatch, path: string, name: string) {\n return batch.preconditions.find(\n (precondition): precondition is Extract<Precondition, { kind: 'field' }> =>\n precondition.kind === 'field' && precondition.path === path && precondition.name === name,\n );\n}\n\nfunction priorSection(batch: ChangeBatch, path: string, name: string) {\n return batch.preconditions.find(\n (precondition): precondition is Extract<Precondition, { kind: 'section' }> =>\n precondition.kind === 'section' && precondition.path === path && precondition.name === name,\n );\n}\n\nfunction priorPreamble(batch: ChangeBatch, path: string) {\n return batch.preconditions.find(\n (precondition): precondition is Extract<Precondition, { kind: 'preamble' }> =>\n precondition.kind === 'preamble' && precondition.path === path,\n );\n}\n\nfunction priorAbsence(batch: ChangeBatch, path: string) {\n return batch.preconditions.find(\n (precondition) => precondition.kind === 'absent' && precondition.path === path,\n );\n}\n\nfunction priorExistence(batch: ChangeBatch, path: string): Existence | undefined {\n const precondition = batch.preconditions.find(\n (held) => held.path === path && (held.kind === 'revision' || held.kind === 'present'),\n );\n if (precondition === undefined) return undefined;\n return precondition.kind === 'revision' ? { base: precondition.revision } : { kind: 'presence' };\n}\n\nfunction typedCreate(\n change: Extract<Change, { kind: 'create' }>,\n path: string,\n): HouseOperation | null {\n const { type, ...fields } = change.fields;\n if (typeof type !== 'string' || type.length === 0) return null;\n return { op: 'create_typed', path, type, fields, sections: change.sections };\n}\n\ntype MappedOperation = { operation: HouseOperation } | { rule: string };\n\nfunction operationOf(\n batch: ChangeBatch,\n change: Change,\n handle: string | undefined,\n): MappedOperation {\n const path = nativePath(change.path, handle);\n if (change.kind === 'field') {\n const prior = priorField(batch, change.path, change.name);\n if (prior === undefined) return { rule: 'precondition-missing' };\n return {\n operation: {\n op: 'set_field',\n path,\n field: change.name,\n value: change.value,\n ...(prior.value === undefined ? {} : { base: prior.value }),\n },\n };\n }\n if (change.kind === 'section') {\n const prior = priorSection(batch, change.path, change.name);\n if (prior === undefined) return { rule: 'precondition-missing' };\n return {\n operation: {\n op: 'replace_section',\n path,\n section: change.name,\n base: prior.value,\n content: change.value,\n },\n };\n }\n if (change.kind === 'preamble') {\n const prior = priorPreamble(batch, change.path);\n if (prior === undefined) return { rule: 'precondition-missing' };\n return {\n operation: { op: 'replace_preamble', path, base: prior.value, content: change.value },\n };\n }\n if (change.kind === 'create') {\n if (priorAbsence(batch, change.path) === undefined) return { rule: 'precondition-missing' };\n const created = typedCreate(change, path);\n return created === null ? { rule: 'type-missing' } : { operation: created };\n }\n const existence = priorExistence(batch, change.path);\n if (existence === undefined) return { rule: 'precondition-missing' };\n if (!('base' in existence)) return { rule: 'presence-base-unrepresentable' };\n if (change.kind === 'replace') {\n return { operation: { op: 'replace', path, base: existence.base, content: change.content } };\n }\n if (change.kind === 'move') {\n if (priorAbsence(batch, change.to) === undefined) return { rule: 'precondition-missing' };\n return {\n operation: { op: 'rename', path, to: nativePath(change.to, handle), base: existence.base },\n };\n }\n return { operation: { op: 'remove', path, base: existence.base } };\n}\n\nexport function houseChanges(batch: ChangeBatch, handle: string | undefined): ChangeMapping {\n const changes: HouseOperation[] = [];\n for (const change of batch.changes) {\n const mapped = operationOf(batch, change, handle);\n if ('rule' in mapped) return { kind: 'unmapped', path: change.path, rule: mapped.rule };\n changes.push(mapped.operation);\n }\n return { kind: 'changes', changes };\n}\n\nexport function batchPaths(changes: readonly HouseOperation[]): readonly string[] {\n return [\n ...new Set(\n changes.flatMap((change) =>\n change.op === 'rename' ? [String(change.path), String(change.to)] : [String(change.path)],\n ),\n ),\n ].sort();\n}\n\nexport function deltaBody(changes: readonly HouseOperation[]): string {\n return JSON.stringify({ changes });\n}\n\nexport function deltaBytes(delta: string): number {\n return textBytes(delta);\n}\n\nexport function uploadable(bytes: number): boolean {\n return bytes > INLINE_BODY_LIMIT_BYTES && bytes <= UPLOAD_BYTES_MAX;\n}\n\nexport function deltaDigest(delta: string): Promise<string> {\n return sha256Hex(delta);\n}\n\ntype Material = { path: string; content: string | null; revision: string | null };\n\nfunction material(value: unknown, handle: string | undefined): readonly Material[] | null {\n if (!Array.isArray(value)) return null;\n const held: Material[] = [];\n for (const entry of value) {\n if (typeof entry !== 'object' || entry === null) return null;\n const file = entry as Record<string, unknown>;\n if (typeof file.path !== 'string') return null;\n if (file.content !== null && typeof file.content !== 'string') return null;\n if (file.revision !== null && file.revision !== undefined && typeof file.revision !== 'string')\n return null;\n let path: string;\n try {\n path = roomLocalPath(file.path, handle);\n } catch {\n return null;\n }\n held.push({\n path,\n content: file.content,\n revision: typeof file.revision === 'string' ? file.revision : null,\n });\n }\n return held;\n}\n\nfunction affectedOf(held: readonly Material[]): Readonly<Record<string, string>> {\n const affected: Record<string, string> = {};\n for (const entry of held) {\n if (entry.content !== null) affected[entry.path] = entry.content;\n }\n return affected;\n}\n\nexport function mutationOutcome(\n status: number,\n body: unknown,\n locator: string,\n handle: string | undefined,\n): MutationResult {\n const refusal = doorRefusal(body);\n if (refusal !== null && refusal.code === 'rate_limited') {\n const reset = refusal.fields.retry_at;\n return {\n kind: 'retryable-refusal',\n code: refusal.code,\n fields: refusal.fields,\n ...(typeof reset === 'string' ? { reset } : {}),\n };\n }\n if (refusal !== null && refusal.code === 'operation_expired') return { kind: 'expired' };\n if (refusal !== null && refusal.code === 'edit_conflict') {\n const { current, ...fields } = refusal.fields;\n const held = material(current, handle) ?? [];\n return { kind: 'conflicted', affected: affectedOf(held), code: refusal.code, fields };\n }\n if (refusal !== null && status === 404) {\n return scopedRefusal(locator, 'undisclosed', refusal);\n }\n const classified = classifyDoor(status, body, locator);\n if (classified !== null && classified.kind !== 'scoped-refusal') {\n return classified.kind === 'beyond-horizon' ? { kind: 'transport-uncertainty' } : classified;\n }\n if (classified !== null && status === 403) return classified;\n if (refusal !== null && status >= 400) {\n return { kind: 'rejected', affected: {}, code: refusal.code, fields: refusal.fields };\n }\n if (status !== 200 || typeof body !== 'object' || body === null) {\n return { kind: 'transport-uncertainty' };\n }\n const held = body as Record<string, unknown>;\n if (typeof held.position !== 'string') return { kind: 'transport-uncertainty' };\n const contents = material(held.contents, handle);\n if (contents === null) return { kind: 'transport-uncertainty' };\n const documents: Record<string, string> = {};\n const revisions: Record<string, string> = {};\n const removals: string[] = [];\n for (const entry of contents) {\n if (entry.content === null || entry.revision === null) {\n removals.push(entry.path);\n continue;\n }\n documents[entry.path] = entry.content;\n revisions[entry.path] = entry.revision;\n }\n return {\n kind: 'accepted',\n roomVersion: held.position,\n documents,\n revisions,\n removals: removals.sort(),\n };\n}\n\nexport function rejectedMapping(mapping: Extract<ChangeMapping, { kind: 'unmapped' }>) {\n return {\n kind: 'rejected' as const,\n affected: {},\n code: mapping.rule,\n fields: { path: mapping.path },\n };\n}\n\nexport function revisionBody(input: {\n path: string;\n handle: string | undefined;\n revision?: string;\n pageToken?: string;\n}): Record<string, unknown> {\n return {\n path: nativePath(input.path, input.handle),\n ...(input.revision === undefined ? {} : { revision: input.revision }),\n ...(input.pageToken === undefined ? {} : { before: Number(input.pageToken) }),\n };\n}\n\nexport function historyOutcome(\n status: number,\n body: unknown,\n locator: string,\n request: { path: string; revision?: string },\n): HistoryResult {\n const classified = classifyDoor(status, body, locator);\n if (classified !== null) {\n return classified.kind === 'beyond-horizon' ? { kind: 'transport-uncertainty' } : classified;\n }\n if (status !== 200 || typeof body !== 'object' || body === null) {\n return { kind: 'transport-uncertainty' };\n }\n const held = body as Record<string, unknown>;\n if (!Array.isArray(held.revisions)) return { kind: 'transport-uncertainty' };\n const entries: Record<string, unknown>[] = [];\n for (const entry of held.revisions) {\n if (typeof entry !== 'object' || entry === null) return { kind: 'transport-uncertainty' };\n entries.push(entry as Record<string, unknown>);\n }\n if (request.revision !== undefined) {\n const named = entries[0];\n if (named === undefined) return { kind: 'no-history' };\n if (named.unavailable === true) {\n return {\n kind: 'scoped-refusal',\n locator,\n scope: 'content',\n code: 'retained_history_unavailable',\n fields: { path: request.path, revision: request.revision },\n };\n }\n if (typeof named.content !== 'string') return { kind: 'transport-uncertainty' };\n return { kind: 'revision', content: named.content };\n }\n if (entries.length === 0) return { kind: 'no-history' };\n const revisions: HistoryRevision[] = [];\n for (const entry of entries) {\n if (\n typeof entry.revision !== 'string' ||\n typeof entry.author_user !== 'string' ||\n typeof entry.created_at !== 'string'\n ) {\n return { kind: 'transport-uncertainty' };\n }\n revisions.push({\n revision: entry.revision,\n author: entry.author_user,\n time: entry.created_at,\n });\n }\n const next = held.next_before;\n return {\n kind: 'history',\n revisions,\n ...(typeof next === 'number' ? { pageToken: String(next) } : {}),\n };\n}\n"],"names":["sha256Hex","textBytes","nativePath","roomLocalPath","classifyDoor","doorRefusal","scopedRefusal","INLINE_BODY_LIMIT_BYTES","UPLOAD_LINE_BYTES","UPLOAD_BYTES_MAX","priorField","batch","path","name","preconditions","find","precondition","kind","priorSection","priorPreamble","priorAbsence","priorExistence","held","undefined","base","revision","typedCreate","change","type","fields","length","op","sections","operationOf","handle","prior","rule","operation","field","value","section","content","created","existence","to","houseChanges","changes","mapped","push","batchPaths","Set","flatMap","String","sort","deltaBody","JSON","stringify","deltaBytes","delta","uploadable","bytes","deltaDigest","material","Array","isArray","entry","file","affectedOf","affected","mutationOutcome","status","body","locator","refusal","code","reset","retry_at","current","classified","position","contents","documents","revisions","removals","roomVersion","rejectedMapping","mapping","revisionBody","input","pageToken","before","Number","historyOutcome","request","entries","named","unavailable","scope","author_user","created_at","author","time","next","next_before"],"mappings":"AAQA,SAASA,SAAS,EAAEC,SAAS,QAAQ,cAAc;AACnD,SAASC,UAAU,EAAEC,aAAa,QAAQ,WAAW;AACrD,SAASC,YAAY,EAAEC,WAAW,EAAEC,aAAa,QAAQ,eAAe;AAExE,OAAO,MAAMC,0BAA0B,IAAI,OAAO,KAAK;AAEvD,OAAO,MAAMC,oBAAoB,GAAG;AAEpC,OAAO,MAAMC,mBAAmB,KAAK,OAAO,OAAOD,kBAAkB;AAUrE,SAASE,WAAWC,KAAkB,EAAEC,IAAY,EAAEC,IAAY;IAChE,OAAOF,MAAMG,aAAa,CAACC,IAAI,CAC7B,CAACC,eACCA,aAAaC,IAAI,KAAK,WAAWD,aAAaJ,IAAI,KAAKA,QAAQI,aAAaH,IAAI,KAAKA;AAE3F;AAEA,SAASK,aAAaP,KAAkB,EAAEC,IAAY,EAAEC,IAAY;IAClE,OAAOF,MAAMG,aAAa,CAACC,IAAI,CAC7B,CAACC,eACCA,aAAaC,IAAI,KAAK,aAAaD,aAAaJ,IAAI,KAAKA,QAAQI,aAAaH,IAAI,KAAKA;AAE7F;AAEA,SAASM,cAAcR,KAAkB,EAAEC,IAAY;IACrD,OAAOD,MAAMG,aAAa,CAACC,IAAI,CAC7B,CAACC,eACCA,aAAaC,IAAI,KAAK,cAAcD,aAAaJ,IAAI,KAAKA;AAEhE;AAEA,SAASQ,aAAaT,KAAkB,EAAEC,IAAY;IACpD,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iF,WAAW;IAC7B,OAAO;QACLtF,MAAM;QACNiE;QACA,GAAI,OAAOoB,SAAS,WAAW;YAAEb,WAAWrC,OAAOkD;QAAM,IAAI,CAAC,CAAC;IACjE;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdruntime-adapter",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.2",
|
|
4
4
|
"description": "Agents House Adapter for the MD Runtime",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=24.
|
|
12
|
+
"node": ">=24.21.0"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
|
+
"AGENTS.md",
|
|
23
24
|
"LICENSE"
|
|
24
25
|
],
|
|
25
26
|
"repository": {
|
|
@@ -30,5 +31,9 @@
|
|
|
30
31
|
"homepage": "https://github.com/agentshouse/mdruntime#readme",
|
|
31
32
|
"bugs": {
|
|
32
33
|
"url": "https://github.com/agentshouse/mdruntime/issues"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@agentshouse/mdmodel": "0.1.0-alpha.7",
|
|
37
|
+
"@agentshouse/mdruntime": "0.1.0-alpha.11"
|
|
33
38
|
}
|
|
34
39
|
}
|