@overkill-dev/resources 0.0.17 → 0.0.19

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.
@@ -0,0 +1,17 @@
1
+ const newlineByte = 10;
2
+ export function createJsonFrameCheck(limit, context) {
3
+ let pendingBytes = 0;
4
+ return function checkFrameBytes(chunk) {
5
+ if (!(chunk instanceof Uint8Array)) {
6
+ return new TypeError(`${context} messages require bytes.`);
7
+ }
8
+ for (const byte of chunk) {
9
+ pendingBytes = byte === newlineByte ? 0 : pendingBytes + 1;
10
+ if (pendingBytes > limit) {
11
+ return new Error(`${context} message exceeded its frame limit.`);
12
+ }
13
+ }
14
+ return chunk;
15
+ };
16
+ }
17
+ //# sourceMappingURL=json-frame-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-frame-check.js","sourceRoot":"","sources":["../../../source/json-frame-check.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,MAAM,UAAU,oBAAoB,CAAC,KAAa,EAAE,OAAe;IAC/D,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,OAAO,SAAS,eAAe,CAAC,KAAK;QACjC,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;YACjC,OAAO,IAAI,SAAS,CAAC,GAAG,OAAO,0BAA0B,CAAC,CAAC;QAC/D,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,YAAY,GAAG,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC;YAC3D,IAAI,YAAY,GAAG,KAAK,EAAE,CAAC;gBACvB,OAAO,IAAI,KAAK,CAAC,GAAG,OAAO,oCAAoC,CAAC,CAAC;YACrE,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,4 @@
1
+ type JsonFrameTransform = (chunk: unknown, encoding: string, complete: (error: Error | null, data: Uint8Array | undefined) => void) => void;
2
+ export declare function createJsonFrameLimiter(limit: number, context: string): JsonFrameTransform;
3
+ export {};
4
+ //# sourceMappingURL=json-frame-limiter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-frame-limiter.d.ts","sourceRoot":"","sources":["../../../source/json-frame-limiter.ts"],"names":[],"mappings":"AAEA,KAAK,kBAAkB,GAAG,CACtB,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,IAAI,EAAE,UAAU,GAAG,SAAS,KAAK,IAAI,KACpE,IAAI,CAAC;AAEV,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAUzF"}
@@ -0,0 +1,14 @@
1
+ import { createJsonFrameCheck } from "./json-frame-check.js";
2
+ export function createJsonFrameLimiter(limit, context) {
3
+ const check = createJsonFrameCheck(limit, context);
4
+ return function limitFrameBytes(chunk, _encoding, complete) {
5
+ const checked = check(chunk);
6
+ if (checked instanceof Error) {
7
+ complete(checked, undefined);
8
+ }
9
+ else {
10
+ complete(null, checked);
11
+ }
12
+ };
13
+ }
14
+ //# sourceMappingURL=json-frame-limiter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-frame-limiter.js","sourceRoot":"","sources":["../../../source/json-frame-limiter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAQ7D,MAAM,UAAU,sBAAsB,CAAC,KAAa,EAAE,OAAe;IACjE,MAAM,KAAK,GAAG,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,SAAS,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ;QACtD,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,OAAO,YAAY,KAAK,EAAE,CAAC;YAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACJ,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5B,CAAC;IACL,CAAC,CAAC;AACN,CAAC"}
package/package.json CHANGED
@@ -19,6 +19,10 @@
19
19
  "./attachment-context": {
20
20
  "import": "./packages/resources/attachment-context.entry-point.js",
21
21
  "types": "./packages/resources/attachment-context.entry-point.d.ts"
22
+ },
23
+ "./json-frame-limiter": {
24
+ "import": "./json-frame-limiter.js",
25
+ "types": "./json-frame-limiter.d.ts"
22
26
  }
23
27
  },
24
28
  "homepage": "https://github.com/enormora/overkill#readme",
@@ -30,7 +34,7 @@
30
34
  "license": "MIT",
31
35
  "name": "@overkill-dev/resources",
32
36
  "peerDependencies": {
33
- "@overkill-dev/simulation": "0.0.6"
37
+ "@overkill-dev/simulation": "0.0.7"
34
38
  },
35
39
  "repository": {
36
40
  "type": "git",
@@ -57,5 +61,5 @@
57
61
  "./resources/runtime-matrix-definition.js"
58
62
  ],
59
63
  "type": "module",
60
- "version": "0.0.17"
64
+ "version": "0.0.19"
61
65
  }
@@ -1,5 +1,5 @@
1
1
  export { attachmentsForProducer, currentAttachmentLimits, resourceAttachments, preparedResourceAttachments, runWithAttachmentContext } from '../../attachments/attachment-context.ts';
2
2
  export type { AttachmentContext } from '../../attachments/attachment-context.ts';
3
3
  export { defaultAttachmentLimits } from '../../engine/runtime-attachment.ts';
4
- export { boundedJsonFrames } from '../../bounded-json-frames.ts';
4
+ export declare function boundedJsonFrames(limit: number, context: string): TransformStream<Uint8Array, Uint8Array>;
5
5
  //# sourceMappingURL=attachment-context.entry-point.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-context.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/resources/attachment-context.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EAC3B,MAAM,yCAAyC,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"attachment-context.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/resources/attachment-context.entry-point.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EAC3B,MAAM,yCAAyC,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,CAWzG"}
@@ -1,4 +1,16 @@
1
+ import { createJsonFrameCheck } from "../../json-frame-check.js";
1
2
  export { attachmentsForProducer, currentAttachmentLimits, resourceAttachments, preparedResourceAttachments, runWithAttachmentContext } from "../../attachments/attachment-context.js";
2
3
  export { defaultAttachmentLimits } from "../../engine/runtime-attachment.js";
3
- export { boundedJsonFrames } from "../../bounded-json-frames.js";
4
+ export function boundedJsonFrames(limit, context) {
5
+ const check = createJsonFrameCheck(limit, context);
6
+ return new TransformStream({
7
+ transform(chunk, controller) {
8
+ const checked = check(chunk);
9
+ if (checked instanceof Error) {
10
+ throw checked;
11
+ }
12
+ controller.enqueue(checked);
13
+ }
14
+ });
15
+ }
4
16
  //# sourceMappingURL=attachment-context.entry-point.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-context.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/resources/attachment-context.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EAC3B,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"attachment-context.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/resources/attachment-context.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EAC3B,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,OAAe;IAC5D,MAAM,KAAK,GAAG,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,IAAI,eAAe,CAAyB;QAC/C,SAAS,CAAC,KAAc,EAAE,UAAU;YAChC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,OAAO,YAAY,KAAK,EAAE,CAAC;gBAC3B,MAAM,OAAO,CAAC;YAClB,CAAC;YACD,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
package/readme.md CHANGED
@@ -288,3 +288,9 @@ Execution requirements describe placement pressure for the runner:
288
288
  or runtime makes work safe to duplicate as `idempotent` or
289
289
  `disposable-isolated`; the runner still decides whether the active execution
290
290
  envelope is strong enough to hedge.
291
+
292
+ Witness files use the engine-owned version-1 envelope.
293
+ `parseWitnessFile(value)` from `@overkill-dev/engine` validates parsed JSON and
294
+ returns a property or simulation witness, throwing `ZodError` for invalid
295
+ envelopes or unsupported envelope versions. It does not decode inputs or execute
296
+ replay. Producer-specific payload compatibility is validated separately.
@@ -16,24 +16,24 @@
16
16
  "component": {
17
17
  "type": "library",
18
18
  "name": "@overkill-dev/resources",
19
- "version": "0.0.17",
20
- "bom-ref": "pkg:npm/@overkill-dev/resources@0.0.17",
21
- "purl": "pkg:npm/@overkill-dev/resources@0.0.17"
19
+ "version": "0.0.19",
20
+ "bom-ref": "pkg:npm/@overkill-dev/resources@0.0.19",
21
+ "purl": "pkg:npm/@overkill-dev/resources@0.0.19"
22
22
  }
23
23
  },
24
24
  "components": [
25
25
  {
26
26
  "type": "library",
27
27
  "name": "@overkill-dev/simulation",
28
- "version": "0.0.6",
29
- "bom-ref": "pkg:npm/@overkill-dev/simulation@0.0.6",
28
+ "version": "0.0.7",
29
+ "bom-ref": "pkg:npm/@overkill-dev/simulation@0.0.7",
30
30
  "scope": "optional",
31
31
  "licenses": [
32
32
  {
33
33
  "expression": "MIT"
34
34
  }
35
35
  ],
36
- "purl": "pkg:npm/@overkill-dev/simulation@0.0.6"
36
+ "purl": "pkg:npm/@overkill-dev/simulation@0.0.7"
37
37
  },
38
38
  {
39
39
  "type": "library",
@@ -64,15 +64,15 @@
64
64
  ],
65
65
  "dependencies": [
66
66
  {
67
- "ref": "pkg:npm/@overkill-dev/resources@0.0.17",
67
+ "ref": "pkg:npm/@overkill-dev/resources@0.0.19",
68
68
  "dependsOn": [
69
- "pkg:npm/@overkill-dev/simulation@0.0.6",
69
+ "pkg:npm/@overkill-dev/simulation@0.0.7",
70
70
  "pkg:npm/type-fest@5.10.0",
71
71
  "pkg:npm/zod@4.6.7"
72
72
  ]
73
73
  },
74
74
  {
75
- "ref": "pkg:npm/@overkill-dev/simulation@0.0.6"
75
+ "ref": "pkg:npm/@overkill-dev/simulation@0.0.7"
76
76
  },
77
77
  {
78
78
  "ref": "pkg:npm/type-fest@5.10.0"
@@ -1,2 +0,0 @@
1
- export declare function boundedJsonFrames(limit: number, context: string): TransformStream<Uint8Array, Uint8Array>;
2
- //# sourceMappingURL=bounded-json-frames.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bounded-json-frames.d.ts","sourceRoot":"","sources":["../../../source/bounded-json-frames.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,CAgBzG"}
@@ -1,19 +0,0 @@
1
- const newlineByte = 10;
2
- export function boundedJsonFrames(limit, context) {
3
- let pendingBytes = 0;
4
- return new TransformStream({
5
- transform(chunk, controller) {
6
- if (!(chunk instanceof Uint8Array)) {
7
- throw new TypeError(`${context} messages require bytes.`);
8
- }
9
- for (const byte of chunk) {
10
- pendingBytes = byte === newlineByte ? 0 : pendingBytes + 1;
11
- if (pendingBytes > limit) {
12
- throw new Error(`${context} message exceeded its frame limit.`);
13
- }
14
- }
15
- controller.enqueue(chunk);
16
- }
17
- });
18
- }
19
- //# sourceMappingURL=bounded-json-frames.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bounded-json-frames.js","sourceRoot":"","sources":["../../../source/bounded-json-frames.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,OAAe;IAC5D,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,OAAO,IAAI,eAAe,CAAyB;QAC/C,SAAS,CAAC,KAAc,EAAE,UAAU;YAChC,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;gBACjC,MAAM,IAAI,SAAS,CAAC,GAAG,OAAO,0BAA0B,CAAC,CAAC;YAC9D,CAAC;YACD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACvB,YAAY,GAAG,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC;gBAC3D,IAAI,YAAY,GAAG,KAAK,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,oCAAoC,CAAC,CAAC;gBACpE,CAAC;YACL,CAAC;YACD,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}