@agentshouse/mdruntime-adapter 0.1.0-c82b9ec2b727a → 0.1.0-c82da698a651e

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 (79) hide show
  1. package/README.md +2 -2
  2. package/dist/actions.d.ts +6 -60
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +26 -295
  5. package/dist/adapter.d.ts +0 -1
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +199 -387
  8. package/dist/app-reference.d.ts +0 -1
  9. package/dist/authored-path.d.ts +10 -0
  10. package/dist/authored-path.d.ts.map +1 -0
  11. package/dist/authored-path.js +35 -0
  12. package/dist/chunks.d.ts +37 -0
  13. package/dist/chunks.d.ts.map +1 -0
  14. package/dist/chunks.js +254 -0
  15. package/dist/crockford.d.ts +0 -1
  16. package/dist/digest.d.ts +0 -1
  17. package/dist/discovery.d.ts +21 -11
  18. package/dist/discovery.d.ts.map +1 -1
  19. package/dist/discovery.js +70 -38
  20. package/dist/history.d.ts +6 -0
  21. package/dist/history.d.ts.map +1 -0
  22. package/dist/history.js +85 -0
  23. package/dist/house-model.d.ts +826 -2
  24. package/dist/house-model.d.ts.map +1 -1
  25. package/dist/house-model.js +464 -415
  26. package/dist/index.d.ts +10 -5
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +9 -3
  29. package/dist/map.d.ts +0 -1
  30. package/dist/model.d.ts +5 -9
  31. package/dist/model.d.ts.map +1 -1
  32. package/dist/model.js +29 -34
  33. package/dist/read.d.ts +21 -60
  34. package/dist/read.d.ts.map +1 -1
  35. package/dist/read.js +50 -330
  36. package/dist/refusal.d.ts +3 -5
  37. package/dist/refusal.d.ts.map +1 -1
  38. package/dist/refusal.js +17 -12
  39. package/dist/room-types.d.ts +1 -4
  40. package/dist/room-types.d.ts.map +1 -1
  41. package/dist/room-types.js +69 -57
  42. package/dist/search.d.ts +4 -0
  43. package/dist/search.d.ts.map +1 -0
  44. package/dist/search.js +47 -0
  45. package/dist/session-content/bounds.d.ts +7 -0
  46. package/dist/session-content/check.d.ts +18 -0
  47. package/dist/session-content/index.d.ts +7 -0
  48. package/dist/session-content/parts.d.ts +102 -0
  49. package/dist/session-content/state.d.ts +61 -0
  50. package/dist/session-content/turn.d.ts +328 -0
  51. package/dist/site.d.ts +0 -1
  52. package/dist/site.d.ts.map +1 -1
  53. package/dist/site.js +85 -172
  54. package/dist/space-schema.d.ts +6 -0
  55. package/dist/space-schema.d.ts.map +1 -0
  56. package/dist/space-schema.js +18 -0
  57. package/dist/stream.d.ts +16 -16
  58. package/dist/stream.d.ts.map +1 -1
  59. package/dist/stream.js +258 -426
  60. package/dist/transport.d.ts +55 -42
  61. package/dist/transport.d.ts.map +1 -1
  62. package/dist/transport.js +54 -11
  63. package/dist/uncertain.d.ts +5 -0
  64. package/dist/uncertain.d.ts.map +1 -0
  65. package/dist/uncertain.js +11 -0
  66. package/dist/upload.d.ts +3 -2
  67. package/dist/upload.d.ts.map +1 -1
  68. package/dist/upload.js +10 -8
  69. package/dist/version.d.ts +0 -1
  70. package/dist/write.d.ts +6 -3
  71. package/dist/write.d.ts.map +1 -1
  72. package/dist/write.js +37 -44
  73. package/package.json +2 -2
  74. package/dist/gather.d.ts +0 -4
  75. package/dist/gather.d.ts.map +0 -1
  76. package/dist/gather.js +0 -35
  77. package/dist/part.d.ts +0 -15
  78. package/dist/part.d.ts.map +0 -1
  79. package/dist/part.js +0 -82
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime-adapter",
3
- "version": "0.1.0-c82b9ec2b727a",
3
+ "version": "0.1.0-c82da698a651e",
4
4
  "description": "Agents House Adapter for the MD Runtime",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  "LICENSE"
25
25
  ],
26
26
  "dependencies": {
27
- "@agentshouse/mdruntime": "0.1.0-ca6edc1abd618"
27
+ "@agentshouse/mdruntime": "0.1.0-c90a12b59fe09"
28
28
  },
29
29
  "repository": {
30
30
  "type": "git",
package/dist/gather.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export declare function gatheredEach<A, R>(send: (asks: readonly A[], answer: (ask: number, result: R) => void) => Promise<void>): (ask: A) => Promise<R>;
2
- export declare function gathered<A, R>(send: (asks: readonly A[]) => Promise<readonly R[]>): (ask: A) => Promise<R>;
3
- export declare function selections<T>(items: readonly T[], limit: number): readonly (readonly T[])[];
4
- //# sourceMappingURL=gather.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gather.d.ts","sourceRoot":"","sources":["../src/gather.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAC/B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GACpF,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAwBxB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClD,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAMxB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAO3F"}
package/dist/gather.js DELETED
@@ -1,35 +0,0 @@
1
- export function gatheredEach(send) {
2
- let held = [];
3
- function flush() {
4
- const taken = held;
5
- held = [];
6
- send(taken.map((entry) => entry.ask), (ask, result) => {
7
- taken[ask]?.resolve(result);
8
- }).catch((reason) => {
9
- for (const entry of taken)
10
- entry.reject(reason);
11
- });
12
- }
13
- return (ask) => new Promise((resolve, reject) => {
14
- if (held.length === 0) {
15
- // Asks made in one task wait a single event-loop turn so they leave as one batch.
16
- setTimeout(flush, 0);
17
- }
18
- held.push({ ask, resolve, reject });
19
- });
20
- }
21
- export function gathered(send) {
22
- return gatheredEach(async (asks, answer) => {
23
- (await send(asks)).forEach((result, ask) => {
24
- answer(ask, result);
25
- });
26
- });
27
- }
28
- export function selections(items, limit) {
29
- const size = Math.max(1, limit);
30
- const parts = [];
31
- for (let start = 0; start < items.length; start += size) {
32
- parts.push(items.slice(start, start + size));
33
- }
34
- return parts;
35
- }
package/dist/part.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import type { ScopedRefusal } from '@agentshouse/mdruntime';
2
- export declare const PART_ATTEMPTS = 3;
3
- export declare const PART_UNVERIFIED = "part_unverified";
4
- export type HousePart = {
5
- part: string;
6
- bytes: number;
7
- sha256: string;
8
- };
9
- export declare function parsePart(value: unknown): HousePart | null;
10
- export declare function partArrival(listed: HousePart, arriving: ((bytes: number) => void) | undefined): ((answered: number) => void) | undefined;
11
- export declare function partFrame(body: unknown): Uint8Array<ArrayBuffer> | null;
12
- export declare function checkedPayload(frame: Uint8Array<ArrayBuffer>, listed: HousePart): Promise<Uint8Array<ArrayBuffer> | null>;
13
- export declare function gunzipped(payload: Uint8Array<ArrayBuffer>): ReadableStream<string>;
14
- export declare function unverifiedPart(locator: string): ScopedRefusal;
15
- //# sourceMappingURL=part.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"part.d.ts","sourceRoot":"","sources":["../src/part.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAO1D;AAoBD,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,GAC9C,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAG1C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAIvE;AAED,wBAAsB,cAAc,CAClC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,EAC9B,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAazC;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAKlF;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAS7D"}
package/dist/part.js DELETED
@@ -1,82 +0,0 @@
1
- const PART_MAGIC = 0x48505431;
2
- const PART_HEAD_BYTES = 8;
3
- const PART_DIGEST_BYTES = 32;
4
- const PART_SHA256 = /^[0-9a-f]{64}$/u;
5
- export const PART_ATTEMPTS = 3;
6
- export const PART_UNVERIFIED = 'part_unverified';
7
- export function parsePart(value) {
8
- if (typeof value !== 'object' || value === null)
9
- return null;
10
- const { part, bytes, sha256 } = value;
11
- if (typeof part !== 'string' || part.length === 0)
12
- return null;
13
- if (typeof bytes !== 'number' || !Number.isSafeInteger(bytes) || bytes <= 0)
14
- return null;
15
- if (typeof sha256 !== 'string' || !PART_SHA256.test(sha256))
16
- return null;
17
- return { part, bytes, sha256 };
18
- }
19
- function decoded(text) {
20
- let binary;
21
- try {
22
- binary = atob(text);
23
- }
24
- catch {
25
- return null;
26
- }
27
- const bytes = new Uint8Array(binary.length);
28
- for (let at = 0; at < binary.length; at += 1)
29
- bytes[at] = binary.charCodeAt(at);
30
- return bytes;
31
- }
32
- function hex(bytes) {
33
- let text = '';
34
- for (const byte of bytes)
35
- text += byte.toString(16).padStart(2, '0');
36
- return text;
37
- }
38
- export function partArrival(listed, arriving) {
39
- if (arriving === undefined)
40
- return undefined;
41
- return (answered) => arriving(Math.min(listed.bytes, Math.floor((answered * 3) / 4)));
42
- }
43
- export function partFrame(body) {
44
- if (typeof body !== 'object' || body === null)
45
- return null;
46
- const { part } = body;
47
- return typeof part === 'string' ? decoded(part) : null;
48
- }
49
- export async function checkedPayload(frame, listed) {
50
- if (frame.length !== listed.bytes)
51
- return null;
52
- if (frame.length < PART_HEAD_BYTES + PART_DIGEST_BYTES)
53
- return null;
54
- const view = new DataView(frame.buffer, frame.byteOffset, frame.byteLength);
55
- if (view.getUint32(0) !== PART_MAGIC)
56
- return null;
57
- const length = view.getUint32(4);
58
- if (PART_HEAD_BYTES + length + PART_DIGEST_BYTES !== frame.length)
59
- return null;
60
- const payload = frame.subarray(PART_HEAD_BYTES, PART_HEAD_BYTES + length);
61
- const digest = hex(new Uint8Array(await crypto.subtle.digest('SHA-256', payload)));
62
- if (digest !== listed.sha256 || hex(frame.subarray(PART_HEAD_BYTES + length)) !== digest) {
63
- return null;
64
- }
65
- return payload;
66
- }
67
- export function gunzipped(payload) {
68
- return new Blob([payload])
69
- .stream()
70
- .pipeThrough(new DecompressionStream('gzip'))
71
- .pipeThrough(new TextDecoderStream());
72
- }
73
- export function unverifiedPart(locator) {
74
- return {
75
- kind: 'scoped-refusal',
76
- locator,
77
- scope: 'undisclosed',
78
- code: PART_UNVERIFIED,
79
- fields: {},
80
- retryable: true,
81
- };
82
- }