@agentshouse/mdruntime-adapter 0.1.0-c32f37ad2c514 → 0.1.0-c341663d60099

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.
Files changed (66) hide show
  1. package/dist/actions.d.ts.map +1 -1
  2. package/dist/actions.js +8 -7
  3. package/dist/adapter.d.ts.map +1 -1
  4. package/dist/adapter.js +113 -89
  5. package/dist/authored-path.d.ts +0 -1
  6. package/dist/authored-path.d.ts.map +1 -1
  7. package/dist/authored-path.js +2 -3
  8. package/dist/chunks.d.ts +2 -3
  9. package/dist/chunks.d.ts.map +1 -1
  10. package/dist/chunks.js +71 -37
  11. package/dist/discovery.d.ts +18 -5
  12. package/dist/discovery.d.ts.map +1 -1
  13. package/dist/discovery.js +132 -6
  14. package/dist/history.d.ts.map +1 -1
  15. package/dist/history.js +3 -2
  16. package/dist/index.d.ts +4 -6
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +4 -6
  19. package/dist/model.d.ts +5 -5
  20. package/dist/model.d.ts.map +1 -1
  21. package/dist/model.js +17 -27
  22. package/dist/read.d.ts +5 -19
  23. package/dist/read.d.ts.map +1 -1
  24. package/dist/read.js +34 -35
  25. package/dist/refusal.d.ts +5 -1
  26. package/dist/refusal.d.ts.map +1 -1
  27. package/dist/refusal.js +23 -6
  28. package/dist/room-query.d.ts +3 -0
  29. package/dist/room-query.d.ts.map +1 -0
  30. package/dist/room-query.js +22 -0
  31. package/dist/search.d.ts.map +1 -1
  32. package/dist/search.js +4 -4
  33. package/dist/session-content/index.d.ts +1 -1
  34. package/dist/session-content/parts.d.ts +4 -3
  35. package/dist/session-content/turn.d.ts +3 -3
  36. package/dist/site.d.ts.map +1 -1
  37. package/dist/site.js +17 -17
  38. package/dist/space-schema.d.ts.map +1 -1
  39. package/dist/space-schema.js +1 -8
  40. package/dist/stream.d.ts +2 -3
  41. package/dist/stream.d.ts.map +1 -1
  42. package/dist/stream.js +71 -86
  43. package/dist/transport.d.ts +28 -7
  44. package/dist/transport.d.ts.map +1 -1
  45. package/dist/transport.js +5 -1
  46. package/dist/uncertain.d.ts +5 -0
  47. package/dist/uncertain.d.ts.map +1 -0
  48. package/dist/uncertain.js +11 -0
  49. package/dist/upload.d.ts +3 -1
  50. package/dist/upload.d.ts.map +1 -1
  51. package/dist/upload.js +8 -6
  52. package/dist/write.d.ts.map +1 -1
  53. package/dist/write.js +19 -19
  54. package/package.json +3 -2
  55. package/dist/app-reference.d.ts +0 -1
  56. package/dist/app-reference.d.ts.map +0 -1
  57. package/dist/app-reference.js +0 -2
  58. package/dist/crockford.d.ts +0 -3
  59. package/dist/crockford.d.ts.map +0 -1
  60. package/dist/crockford.js +0 -3
  61. package/dist/house-model.d.ts +0 -830
  62. package/dist/house-model.d.ts.map +0 -1
  63. package/dist/house-model.js +0 -465
  64. package/dist/room-types.d.ts +0 -4
  65. package/dist/room-types.d.ts.map +0 -1
  66. package/dist/room-types.js +0 -135
package/dist/write.js CHANGED
@@ -2,8 +2,9 @@ import { departure, partsChanges, ROW_WEIGHT, } from '@agentshouse/mdruntime';
2
2
  import { answered, answering, binaryFileOf, headChange, revised } from './read.js';
3
3
  import { sha256Hex, textBytes } from './digest.js';
4
4
  import { nativePath, roomLocalPath } from './map.js';
5
- import { classifyDoor, doorRefusal, resetOf, scopedRefusal } from './refusal.js';
5
+ import { answeredFailure, classifyDoor, doorRefusal, resetOf, scopedRefusal } from './refusal.js';
6
6
  import { readPosition, roomVersion } from './version.js';
7
+ import { unusable } from './uncertain.js';
7
8
  function priorField(batch, path, name) {
8
9
  return batch.preconditions.find((precondition) => precondition.kind === 'field' && precondition.path === path && precondition.name === name);
9
10
  }
@@ -28,7 +29,7 @@ function created(change, path) {
28
29
  const { type, ...fields } = change.fields;
29
30
  if (typeof type !== 'string' || type.length === 0)
30
31
  return null;
31
- return { op: 'create_typed', path, type, fields, sections: change.sections };
32
+ return { op: 'create_typed', path, type, fields };
32
33
  }
33
34
  function operationOf(batch, change, handle) {
34
35
  const path = nativePath(change.path, handle);
@@ -244,12 +245,12 @@ function* movedOutcome(held, move) {
244
245
  const left = at(move.source.authority);
245
246
  const arrived = at(move.destination.authority);
246
247
  if (left === null || arrived === null)
247
- return { kind: 'transport-uncertainty' };
248
+ return unusable();
248
249
  const under = (handle) => (path) => path.startsWith(`/rooms/${handle}/`);
249
250
  const leaving = yield* material(held.contents, move.source.handle, under(move.source.handle));
250
251
  const arriving = yield* material(held.contents, move.destination.handle, under(move.destination.handle));
251
252
  if (leaving === null || arriving === null)
252
- return { kind: 'transport-uncertainty' };
253
+ return unusable();
253
254
  return {
254
255
  kind: 'accepted',
255
256
  ...(yield* acceptedOf(left, leaving)),
@@ -300,18 +301,19 @@ export function* mutationOutcome(status, body, locator, handle, move) {
300
301
  retryable: refusal.retryable,
301
302
  };
302
303
  }
303
- if (status !== 200 || typeof body !== 'object' || body === null) {
304
- return { kind: 'transport-uncertainty' };
305
- }
304
+ if (status !== 200)
305
+ return answeredFailure(status, body);
306
+ if (typeof body !== 'object' || body === null)
307
+ return unusable();
306
308
  const held = body;
307
309
  if (move !== undefined)
308
310
  return yield* movedOutcome(held, move);
309
311
  const at = readPosition(held);
310
312
  if (at === null)
311
- return { kind: 'transport-uncertainty' };
313
+ return unusable();
312
314
  const contents = yield* material(held.contents, handle);
313
315
  if (contents === null)
314
- return { kind: 'transport-uncertainty' };
316
+ return unusable();
315
317
  return { kind: 'accepted', ...(yield* acceptedOf(at, contents)) };
316
318
  }
317
319
  export function rejectedMapping(mapping) {
@@ -360,25 +362,23 @@ export function historyOutcome(status, body, locator, request) {
360
362
  if (classified !== null)
361
363
  return classified;
362
364
  if (status !== 200 || typeof body !== 'object' || body === null) {
363
- return { kind: 'transport-uncertainty' };
365
+ return unusable();
364
366
  }
365
367
  const held = body;
366
368
  if (!Array.isArray(held.revisions))
367
- return { kind: 'transport-uncertainty' };
369
+ return unusable();
368
370
  const entries = [];
369
371
  for (const entry of held.revisions) {
370
372
  if (typeof entry !== 'object' || entry === null)
371
- return { kind: 'transport-uncertainty' };
373
+ return unusable();
372
374
  entries.push(entry);
373
375
  }
374
- if (request.revision !== undefined) {
375
- const named = entries[0];
376
+ const named = entries[0];
377
+ if (request.revision !== undefined && typeof named?.media_type !== 'string') {
376
378
  if (named === undefined)
377
379
  return { kind: 'no-history' };
378
- if (typeof named.media_type === 'string')
379
- return { kind: 'no-history' };
380
380
  if (typeof named.content !== 'string')
381
- return { kind: 'transport-uncertainty' };
381
+ return unusable();
382
382
  return { kind: 'revision', content: named.content };
383
383
  }
384
384
  if (entries.length === 0)
@@ -389,11 +389,11 @@ export function historyOutcome(status, body, locator, request) {
389
389
  if (typeof entry.revision !== 'string' ||
390
390
  author === null ||
391
391
  typeof entry.created_at !== 'string') {
392
- return { kind: 'transport-uncertainty' };
392
+ return unusable();
393
393
  }
394
394
  const binaryFile = binaryFileOf(entry);
395
395
  if (binaryFile === null)
396
- return { kind: 'transport-uncertainty' };
396
+ return unusable();
397
397
  revisions.push({
398
398
  revision: entry.revision,
399
399
  author,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime-adapter",
3
- "version": "0.1.0-c32f37ad2c514",
3
+ "version": "0.1.0-c341663d60099",
4
4
  "description": "Agents House Adapter for the MD Runtime",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,7 +24,8 @@
24
24
  "LICENSE"
25
25
  ],
26
26
  "dependencies": {
27
- "@agentshouse/mdruntime": "0.1.0-c4c5934c45f21"
27
+ "@agentshouse/mdmodel": "0.1.0-cb39915954ec5",
28
+ "@agentshouse/mdruntime": "0.1.0-c61e6fe81fd4d"
28
29
  },
29
30
  "repository": {
30
31
  "type": "git",
@@ -1 +0,0 @@
1
- export declare const APP_REFERENCE_PATTERN: RegExp;
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-reference.d.ts","sourceRoot":"","sources":["../src/app-reference.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB,QAEjC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { CROCKFORD_CHARACTER } from './crockford.js';
2
- export const APP_REFERENCE_PATTERN = new RegExp(`^a_(${CROCKFORD_CHARACTER}+)\\.(${CROCKFORD_CHARACTER})$`);
@@ -1,3 +0,0 @@
1
- export declare const CROCKFORD_ALPHABET = "0123456789abcdefghjkmnpqrstvwxyz";
2
- export declare const CROCKFORD_CHARACTER = "[0123456789abcdefghjkmnpqrstvwxyz]";
3
- export declare const CROCKFORD_LEADING_CHARACTER: string;
@@ -1 +0,0 @@
1
- {"version":3,"file":"crockford.d.ts","sourceRoot":"","sources":["../src/crockford.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,qCAAqC,CAAC;AAErE,eAAO,MAAM,mBAAmB,uCAA4B,CAAC;AAE7D,eAAO,MAAM,2BAA2B,QAAqC,CAAC"}
package/dist/crockford.js DELETED
@@ -1,3 +0,0 @@
1
- export const CROCKFORD_ALPHABET = '0123456789abcdefghjkmnpqrstvwxyz';
2
- export const CROCKFORD_CHARACTER = `[${CROCKFORD_ALPHABET}]`;
3
- export const CROCKFORD_LEADING_CHARACTER = `[${CROCKFORD_ALPHABET.slice(1)}]`;