@agentshouse/mdruntime-adapter 0.1.0-cc7fa1e066844 → 0.1.0-cf22c8563f9f4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/write.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { parseOriginals } from './read.js';
1
2
  import { sha256Hex, textBytes } from './digest.js';
2
3
  import { nativePath, roomLocalPath } from './map.js';
3
4
  import { classifyDoor, doorRefusal, scopedRefusal } from './refusal.js';
@@ -165,7 +166,7 @@ export function mutationOutcome(status, body, locator, handle) {
165
166
  if (refusal !== null && refusal.code === 'service_mode_write_halted') {
166
167
  return { kind: 'write-halted' };
167
168
  }
168
- if (refusal !== null && refusal.code === 'operation_expired')
169
+ if (refusal !== null && refusal.code === 'expired')
169
170
  return { kind: 'expired' };
170
171
  if (refusal !== null && refusal.code === 'edit_conflict') {
171
172
  const { current, ...fields } = refusal.fields;
@@ -182,9 +183,8 @@ export function mutationOutcome(status, body, locator, handle) {
182
183
  classified?.kind === 'transport-uncertainty') {
183
184
  return { kind: 'retryable-refusal', code: refusal.code, fields: refusal.fields, reset };
184
185
  }
185
- if (classified !== null && classified.kind !== 'scoped-refusal') {
186
- return classified.kind === 'beyond-horizon' ? { kind: 'expired' } : classified;
187
- }
186
+ if (classified !== null && classified.kind !== 'scoped-refusal')
187
+ return classified;
188
188
  if (classified !== null && status === 403)
189
189
  return classified;
190
190
  if (refusal !== null && status >= 400) {
@@ -200,6 +200,9 @@ export function mutationOutcome(status, body, locator, handle) {
200
200
  const contents = material(held.contents, handle);
201
201
  if (contents === null)
202
202
  return { kind: 'transport-uncertainty' };
203
+ const originals = parseOriginals(held.originals);
204
+ if (originals === null)
205
+ return { kind: 'transport-uncertainty' };
203
206
  const documents = {};
204
207
  const revisions = {};
205
208
  const removals = [];
@@ -217,6 +220,7 @@ export function mutationOutcome(status, body, locator, handle) {
217
220
  documents,
218
221
  revisions,
219
222
  removals: removals.sort(),
223
+ originals,
220
224
  };
221
225
  }
222
226
  export function rejectedMapping(mapping) {
@@ -248,9 +252,8 @@ function revisionAuthor(entry) {
248
252
  }
249
253
  export function historyOutcome(status, body, locator, request) {
250
254
  const classified = classifyDoor(status, body, locator);
251
- if (classified !== null) {
252
- return classified.kind === 'beyond-horizon' ? { kind: 'transport-uncertainty' } : classified;
253
- }
255
+ if (classified !== null)
256
+ return classified;
254
257
  if (status !== 200 || typeof body !== 'object' || body === null) {
255
258
  return { kind: 'transport-uncertainty' };
256
259
  }
@@ -297,5 +300,6 @@ export function historyOutcome(status, body, locator, request) {
297
300
  kind: 'history',
298
301
  revisions,
299
302
  ...(typeof next === 'number' ? { pageToken: String(next) } : {}),
303
+ ...(held.deleted === true ? { deleted: true } : {}),
300
304
  };
301
305
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime-adapter",
3
- "version": "0.1.0-cc7fa1e066844",
3
+ "version": "0.1.0-cf22c8563f9f4",
4
4
  "description": "Agents House Adapter for the MD Runtime",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  "LICENSE"
26
26
  ],
27
27
  "dependencies": {
28
- "@agentshouse/mdmodel": "0.1.0-c6b0c6dc1a195",
29
- "@agentshouse/mdruntime": "0.1.0-cf28918c2bf91"
28
+ "@agentshouse/mdmodel": "0.1.0-c3d58cb8652e6",
29
+ "@agentshouse/mdruntime": "0.1.0-cebcd51f70ed1"
30
30
  }
31
31
  }