@intentproof/sdk 0.1.2 → 0.1.4

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/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## **Logs narrate; IntentProof gives you proof.**
2
2
 
3
+ [![CI](https://github.com/IntentProof/intentproof-sdk-node/actions/workflows/ci.yml/badge.svg)](https://github.com/IntentProof/intentproof-sdk-node/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/@intentproof/sdk)](https://www.npmjs.com/package/@intentproof/sdk)
5
+ <a href="https://github.com/IntentProof/intentproof-sdk-node/raw/main/conformance-certificate.json" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/conformance_certificate-view-0366d6" alt="Conformance Certificate" /></a>
6
+
3
7
  **IntentProof** is **auditable execution records** for actions that must be defensible—**intent** tied to what actually ran.
4
8
 
5
9
  **Wrap** the calls that matter; each invocation emits one **verifiable** **`ExecutionEvent`**, structured so intent and outcome can be **reconciled** with reality—not only observed.
@@ -43,10 +47,7 @@ Ordinary telemetry shows that *something ran*. It rarely ships an **auditable st
43
47
 
44
48
  **Package:** `@intentproof/sdk`.
45
49
 
46
- - [npm `@intentproof/sdk`](https://www.npmjs.com/package/@intentproof/sdk)
47
- - [GitHub Releases — IntentProof Node SDK](https://github.com/IntentProof/intentproof-sdk-node/releases)
48
-
49
- Pin the **version** you want from npm or from GitHub Releases. Replace **`x.y.z`** below with that version.
50
+ Replace **`x.y.z`** with the package version you intend to pin.
50
51
 
51
52
  ```bash
52
53
  npm install @intentproof/sdk@x.y.z
@@ -339,7 +340,7 @@ try {
339
340
 
340
341
  ### 3 — Proof delivery over HTTP (same **`ExecutionEvent`** shape)
341
342
 
342
- **`HttpExporter`** POSTs the same **`ExecutionEvent`** your verifiers see in memory—here alongside **`MemoryExporter`** so tests can assert the wire without a real collector. The request omits ambient credentials; the body is **`{ "intentproof": "1", "event": … }`** (see exporter implementation). For authenticated collectors, pass **`headers`** (e.g. **`Authorization`**, API keys) — see [Security](#security).
343
+ **`HttpExporter`** POSTs the same **`ExecutionEvent`** your verifiers see in memory—here alongside **`MemoryExporter`** so tests can assert the wire without a real collector. The request omits ambient credentials; the body is **`{ "intentproof": "1", "event": … }`** (see exporter implementation). For authenticated collectors, pass **`headers`** (e.g. **`Authorization`**, API keys) — see the Security section above.
343
344
 
344
345
  ```ts
345
346
  const runProbe = client.wrap({ intent: "HTTP test", action: "test.http" }, () => 42);
@@ -360,7 +361,7 @@ runProbe();
360
361
 
361
362
  ## Security
362
363
 
363
- For **vulnerability reporting**, use this repository’s [**Security**](https://github.com/IntentProof/intentproof-sdk-node/security) tab (private advisories).
364
+ For **vulnerability reporting**, use this repository’s Security tab (private advisories).
364
365
 
365
366
  Every **`ExecutionEvent`** you emit is data you may ship off-process. Treat them like audit-grade execution records: they can include PII, secrets, stack traces, and business identifiers depending on your **`snapshot`** / **`capture*`** hooks.
366
367
 
@@ -377,9 +378,14 @@ Custom **`body`** serializers: if **`body(event)`** throws, **`HttpExporter`** n
377
378
 
378
379
  ## Canonical specification (`intentproof-spec`)
379
380
 
380
- Schemas, golden oracles, and the **Vitest conformance oracle** live in the **[IntentProof specification repository (`intentproof-spec`)](https://github.com/intentproof/intentproof-spec)**.
381
+ **Shared pins and terminology** (`INTENTPROOF_SPEC_ROOT`, **`intentproofSpecCommit`**, script names) are documented in the **`intentproof-spec`** repository (`CONTRIBUTING.md`, Terminology).
382
+
383
+ **`intentproof-spec`** holds normative schemas, golden **`execution_event_cases.jsonl`**, and the canonical **`spec-conformance.sh`** toolchain (Vitest/Jest-style harness code used by the spec lives there too).
381
384
 
382
- - **CI:** every push/PR runs `scripts/run-conformance.sh` from that repo (see `.github/workflows/ci.yml`).
385
+ - **Version pin:** **`intentproofSpecVersion`** and **`intentproofSpecCommit`** in the root **`package.json`** and **`packages/sdk/package.json`** match **`spec.json`** and the spec **`HEAD`** checkout; **`scripts/check-sdk-spec-pin.sh`** enforces this before conformance.
386
+
387
+ - **CI:** every push/PR checks out this SDK plus **`intentproof-spec`** and runs **`scripts/spec-conformance.sh`** (pin check + full oracle; see `.github/workflows/ci.yml`). The **`sdk`** job sets **`INTENTPROOF_SPEC_ROOT`** so **`packages/sdk`** Vitest imports the spec **`sdk_test_harness`**—golden **`execution_event_cases.jsonl`** plus **`MemoryExporter`** **`validateExecutionEvent`** smoke (`spec_conformance.integration.test.ts`).
388
+ - **Repo-root certificates:** each run uploads **`conformance-report.json`** and **`conformance-certificate.json`** as workflow artifacts; after a green default-branch push, the conformance GitHub App commits the same files at the repo root when they differ from **`main`**.
383
389
  - **Local:** clone `intentproof-spec` **next to** this repository (`../intentproof-spec`), then:
384
390
 
385
391
  ```bash
@@ -388,11 +394,21 @@ Schemas, golden oracles, and the **Vitest conformance oracle** live in the **[In
388
394
 
389
395
  Or set `INTENTPROOF_SPEC_ROOT` to your spec checkout and run `bash scripts/spec-conformance.sh`.
390
396
 
397
+ - **Generated fingerprint metadata:** schema codegen writes **`packages/sdk/src/generated/spec_fingerprint.json`** (spec version, generator version, per-schema SHA-256, aggregate hash). Validate/update generated artifacts with:
398
+
399
+ ```bash
400
+ bash scripts/verify-generated-types.sh
401
+ ```
402
+
403
+ - **No handwritten model types:** **`scripts/check-no-handwritten-model-types.sh`** delegates to the shared **`intentproof-spec`** checker. It is wired into **`npm run ci`**, CI, and release, and fails if schema model/type declarations appear outside **`packages/sdk/src/generated`** or if the bridge aliases in **`packages/sdk/src/types.ts`** stop mapping to generated types.
404
+
391
405
  ---
392
406
 
393
407
  ## Project development
394
408
 
395
- Layout: **npm workspace** (`package.json` **`workspaces`**, publishable package [`packages/sdk`](packages/sdk)). Requires **Node.js** 22 or newer (see `.nvmrc` and workspace **`engines`**). Release history: [`CHANGELOG.md`](CHANGELOG.md).
409
+ Contributing and shared **`intentproof-spec`** terminology: see **`CONTRIBUTING.md`**.
410
+
411
+ Layout: **npm workspace** (`package.json` **`workspaces`**, publishable package **`packages/sdk`**). Requires **Node.js** 22 or newer (see `.nvmrc` and workspace **`engines`**). Release history: **`CHANGELOG.md`**.
396
412
 
397
413
  ```bash
398
414
  npm ci
@@ -401,4 +417,4 @@ npm run ci
401
417
 
402
418
  ## License
403
419
 
404
- Apache-2.0 (see `LICENSE` at the repository root and in the published npm package when released).
420
+ Apache-2.0 (see **`LICENSE`** at the repository root).
package/dist/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
@@ -26,13 +36,17 @@ __export(index_exports, {
26
36
  MemoryExporter: () => MemoryExporter,
27
37
  VERSION: () => VERSION,
28
38
  assertCorrelationId: () => assertCorrelationId,
39
+ assertValidExecutionEventWire: () => assertValidExecutionEventWire,
29
40
  assertWrapOptionsShape: () => assertWrapOptionsShape,
30
41
  client: () => client,
31
42
  createIntentProofClient: () => createIntentProofClient,
32
43
  getCorrelationId: () => getCorrelationId,
33
44
  getIntentProofClient: () => getIntentProofClient,
34
45
  runWithCorrelationId: () => runWithCorrelationId,
35
- snapshot: () => snapshot
46
+ snapshot: () => snapshot,
47
+ validateExecutionEvent: () => validateExecutionEvent,
48
+ validateIntentProofConfig: () => validateIntentProofConfig,
49
+ validateWrapOptions: () => validateWrapOptions
36
50
  });
37
51
  module.exports = __toCommonJS(index_exports);
38
52
 
@@ -164,8 +178,376 @@ function snapshot(value, options = {}) {
164
178
  }
165
179
  }
166
180
 
181
+ // src/validators.ts
182
+ var import__ = require("ajv/dist/2020.js");
183
+ var AjvFormats = __toESM(require("ajv-formats"), 1);
184
+
185
+ // src/generated/embed/execution-event.v1.ts
186
+ var execution_event_v1_default = {
187
+ $comment: "Normative IntentProof source tree: https://github.com/IntentProof/intentproof-spec/tree/main/schema \u2014 $id is a logical URI; see README.",
188
+ $defs: {
189
+ ExecutionError: {
190
+ additionalProperties: false,
191
+ properties: {
192
+ cause: {
193
+ $ref: "#/$defs/ExecutionError",
194
+ description: "Optional chained cause; MUST conform to ExecutionError when present."
195
+ },
196
+ code: { description: "Optional stable machine-readable code.", type: "string" },
197
+ message: {
198
+ description: "Human-readable error message (may be empty string if the runtime provides none).",
199
+ type: "string"
200
+ },
201
+ name: {
202
+ description: "Exception or error type name (e.g. Error, TypeError).",
203
+ minLength: 1,
204
+ type: "string"
205
+ },
206
+ stack: {
207
+ description: "Optional stringified stack trace; null when stacks are suppressed.",
208
+ type: ["string", "null"]
209
+ }
210
+ },
211
+ required: ["name", "message"],
212
+ type: "object"
213
+ },
214
+ JsonValue: {
215
+ anyOf: [
216
+ { type: "null" },
217
+ { type: "boolean" },
218
+ { type: "number" },
219
+ { type: "string" },
220
+ { items: { $ref: "#/$defs/JsonValue" }, type: "array" },
221
+ { additionalProperties: { $ref: "#/$defs/JsonValue" }, type: "object" }
222
+ ],
223
+ description: "Any JSON-serializable value per semantics/serialization_rules.md."
224
+ }
225
+ },
226
+ $id: "https://intentproof.dev/schema/execution_event.v1.schema.json",
227
+ $schema: "https://json-schema.org/draft/2020-12/schema",
228
+ additionalProperties: false,
229
+ allOf: [
230
+ {
231
+ if: { properties: { status: { const: "ok" } }, required: ["status"] },
232
+ then: { not: { required: ["error"] }, required: ["output"] }
233
+ },
234
+ {
235
+ if: { properties: { status: { const: "error" } }, required: ["status"] },
236
+ then: { required: ["error"] }
237
+ }
238
+ ],
239
+ properties: {
240
+ action: {
241
+ description: "Stable identifier for the concrete operation. Many systems use hierarchical dotted names (e.g. vendor.resource.operation); REST paths, RPC names, or other conventions are allowed. The schema does not constrain the format.",
242
+ minLength: 1,
243
+ type: "string"
244
+ },
245
+ attributes: {
246
+ additionalProperties: { type: ["string", "number", "boolean", "null"] },
247
+ description: "Flat primitive key/value metadata attached to the event.",
248
+ propertyNames: { pattern: "^[A-Za-z0-9_.:-]{1,256}$" },
249
+ type: "object"
250
+ },
251
+ completedAt: {
252
+ description: "RFC 3339 / ISO 8601 instant when execution completed.",
253
+ format: "date-time",
254
+ type: "string"
255
+ },
256
+ correlationId: {
257
+ description: "Optional cross-cutting identifier for distributed tracing. MUST be trimmed and non-empty when present.",
258
+ minLength: 1,
259
+ type: "string"
260
+ },
261
+ durationMs: {
262
+ description: "Wall-clock duration in milliseconds between startedAt and completedAt.",
263
+ minimum: 0,
264
+ type: "number"
265
+ },
266
+ error: {
267
+ $ref: "#/$defs/ExecutionError",
268
+ description: "Structured error when status is error."
269
+ },
270
+ id: {
271
+ description: "Stable unique identifier for this execution record.",
272
+ minLength: 1,
273
+ type: "string"
274
+ },
275
+ inputs: {
276
+ additionalProperties: true,
277
+ description: "Captured call inputs. Values MUST be JSON-serializable (see semantics/serialization_rules.md).",
278
+ type: "object"
279
+ },
280
+ intent: {
281
+ description: "Natural-language description of what the user or caller was trying to achieve (often a full sentence or question). No fixed grammar; SHOULD stay human-readable in logs and UIs.",
282
+ minLength: 1,
283
+ type: "string"
284
+ },
285
+ output: {
286
+ $ref: "#/$defs/JsonValue",
287
+ description: "Captured return value when status is ok, or optional captured value when captureError allows output on failure."
288
+ },
289
+ startedAt: {
290
+ description: "RFC 3339 / ISO 8601 instant when execution started.",
291
+ format: "date-time",
292
+ type: "string"
293
+ },
294
+ status: {
295
+ description: "Terminal execution status.",
296
+ enum: ["ok", "error"],
297
+ type: "string"
298
+ }
299
+ },
300
+ required: [
301
+ "id",
302
+ "intent",
303
+ "action",
304
+ "status",
305
+ "inputs",
306
+ "startedAt",
307
+ "completedAt",
308
+ "durationMs"
309
+ ],
310
+ title: "IntentProof ExecutionEvent v1",
311
+ type: "object"
312
+ };
313
+
314
+ // src/generated/embed/intentproof-config.v1.ts
315
+ var intentproof_config_v1_default = {
316
+ $comment: "Normative IntentProof source tree: https://github.com/IntentProof/intentproof-spec/tree/main/schema \u2014 $id is a logical URI; see README.",
317
+ $defs: {
318
+ WrapOptionsV1: {
319
+ $comment: "Normative IntentProof source tree: https://github.com/IntentProof/intentproof-spec/tree/main/schema \u2014 $id is a logical URI; see README.",
320
+ $id: "https://intentproof.dev/schema/wrap_options.v1.schema.json",
321
+ $schema: "https://json-schema.org/draft/2020-12/schema",
322
+ additionalProperties: false,
323
+ properties: {
324
+ action: {
325
+ description: "Default operation identifier (often dotted like vendor.service.method); SDKs MAY derive from the callable when omitted.",
326
+ minLength: 1,
327
+ type: "string"
328
+ },
329
+ attributes: {
330
+ additionalProperties: { type: ["string", "number", "boolean", "null"] },
331
+ description: "Static attributes merged into each emitted ExecutionEvent.attributes.",
332
+ type: "object"
333
+ },
334
+ captureError: {
335
+ default: true,
336
+ description: "When true, failures MUST populate error; when false with captureOutput semantics, see semantics/wrap_behavior.md.",
337
+ type: "boolean"
338
+ },
339
+ captureInputs: {
340
+ default: true,
341
+ description: "When false, inputs MUST be serialized as an empty object {}.",
342
+ type: "boolean"
343
+ },
344
+ captureOutput: {
345
+ default: true,
346
+ description: "When false and status is ok, output MUST be null.",
347
+ type: "boolean"
348
+ },
349
+ captureStack: {
350
+ default: true,
351
+ description: "When false, error.stack MUST be null on emitted events.",
352
+ type: "boolean"
353
+ },
354
+ exporterTimeoutMs: {
355
+ description: "Maximum time an exporter hook may block the wrap boundary; 0 means SDK default.",
356
+ minimum: 0,
357
+ type: "number"
358
+ },
359
+ intent: {
360
+ description: "Default natural-language intent for wrapped executions when the call site does not override it.",
361
+ minLength: 1,
362
+ type: "string"
363
+ },
364
+ propagateCorrelation: {
365
+ default: true,
366
+ description: "When true, nested wraps inherit the active correlationId.",
367
+ type: "boolean"
368
+ }
369
+ },
370
+ title: "IntentProof WrapOptions v1",
371
+ type: "object"
372
+ }
373
+ },
374
+ $id: "https://intentproof.dev/schema/intentproof_config.v1.schema.json",
375
+ $schema: "https://json-schema.org/draft/2020-12/schema",
376
+ additionalProperties: false,
377
+ properties: {
378
+ correlation: {
379
+ additionalProperties: false,
380
+ properties: {
381
+ generateOnMissing: {
382
+ default: true,
383
+ description: "When true, SDK generates a UUID when no correlation is active.",
384
+ type: "boolean"
385
+ },
386
+ headerName: {
387
+ default: "x-intentproof-correlation-id",
388
+ description: "HTTP header used for inbound correlation extraction when applicable.",
389
+ type: "string"
390
+ }
391
+ },
392
+ type: "object"
393
+ },
394
+ defaultWrapOptions: { $ref: "#/$defs/WrapOptionsV1" },
395
+ exporters: {
396
+ description: "Ordered list of exporter identifiers or inline hooks (SDK-defined encoding).",
397
+ items: {
398
+ additionalProperties: true,
399
+ properties: {
400
+ endpoint: {
401
+ description: "Required for http exporters when used.",
402
+ format: "uri",
403
+ type: "string"
404
+ },
405
+ failOpen: {
406
+ default: true,
407
+ description: "When true, exporter failures MUST NOT change user-visible outcomes.",
408
+ type: "boolean"
409
+ },
410
+ headers: {
411
+ additionalProperties: { type: "string" },
412
+ description: "Optional HTTP headers for http exporters.",
413
+ type: "object"
414
+ },
415
+ type: {
416
+ description: "Exporter kind; custom MUST include implementation-specific fields.",
417
+ enum: ["console", "http", "otel", "custom"],
418
+ type: "string"
419
+ }
420
+ },
421
+ required: ["type"],
422
+ type: "object"
423
+ },
424
+ type: "array"
425
+ },
426
+ serialization: {
427
+ additionalProperties: false,
428
+ properties: {
429
+ maxDepth: {
430
+ default: 32,
431
+ description: "Maximum object graph depth for input/output capture.",
432
+ minimum: 1,
433
+ type: "integer"
434
+ },
435
+ maxStringLength: {
436
+ default: 65536,
437
+ description: "Maximum serialized string length for any single field.",
438
+ minimum: 1,
439
+ type: "integer"
440
+ },
441
+ redactKeys: {
442
+ description: "Case-insensitive key names to replace with [REDACTED] in captured objects.",
443
+ items: { type: "string" },
444
+ type: "array"
445
+ }
446
+ },
447
+ type: "object"
448
+ },
449
+ version: {
450
+ const: 1,
451
+ description: "Config document version; MUST be 1 for this schema.",
452
+ type: "integer"
453
+ }
454
+ },
455
+ title: "IntentProof Runtime Config v1",
456
+ type: "object"
457
+ };
458
+
459
+ // src/generated/embed/wrap-options.v1.ts
460
+ var wrap_options_v1_default = {
461
+ $comment: "Normative IntentProof source tree: https://github.com/IntentProof/intentproof-spec/tree/main/schema \u2014 $id is a logical URI; see README.",
462
+ $id: "https://intentproof.dev/schema/wrap_options.v1.schema.json",
463
+ $schema: "https://json-schema.org/draft/2020-12/schema",
464
+ additionalProperties: false,
465
+ properties: {
466
+ action: {
467
+ description: "Default operation identifier (often dotted like vendor.service.method); SDKs MAY derive from the callable when omitted.",
468
+ minLength: 1,
469
+ type: "string"
470
+ },
471
+ attributes: {
472
+ additionalProperties: { type: ["string", "number", "boolean", "null"] },
473
+ description: "Static attributes merged into each emitted ExecutionEvent.attributes.",
474
+ type: "object"
475
+ },
476
+ captureError: {
477
+ default: true,
478
+ description: "When true, failures MUST populate error; when false with captureOutput semantics, see semantics/wrap_behavior.md.",
479
+ type: "boolean"
480
+ },
481
+ captureInputs: {
482
+ default: true,
483
+ description: "When false, inputs MUST be serialized as an empty object {}.",
484
+ type: "boolean"
485
+ },
486
+ captureOutput: {
487
+ default: true,
488
+ description: "When false and status is ok, output MUST be null.",
489
+ type: "boolean"
490
+ },
491
+ captureStack: {
492
+ default: true,
493
+ description: "When false, error.stack MUST be null on emitted events.",
494
+ type: "boolean"
495
+ },
496
+ exporterTimeoutMs: {
497
+ description: "Maximum time an exporter hook may block the wrap boundary; 0 means SDK default.",
498
+ minimum: 0,
499
+ type: "number"
500
+ },
501
+ intent: {
502
+ description: "Default natural-language intent for wrapped executions when the call site does not override it.",
503
+ minLength: 1,
504
+ type: "string"
505
+ },
506
+ propagateCorrelation: {
507
+ default: true,
508
+ description: "When true, nested wraps inherit the active correlationId.",
509
+ type: "boolean"
510
+ }
511
+ },
512
+ title: "IntentProof WrapOptions v1",
513
+ type: "object"
514
+ };
515
+
516
+ // src/validators.ts
517
+ var ajv = new import__.Ajv2020({
518
+ allErrors: true,
519
+ strict: false
520
+ });
521
+ var addFormats = AjvFormats.default;
522
+ addFormats(ajv);
523
+ var validateExecutionEvent = ajv.compile(
524
+ execution_event_v1_default
525
+ );
526
+ var validateWrapOptions = ajv.compile(
527
+ wrap_options_v1_default
528
+ );
529
+ var validateIntentProofConfig = ajv.compile(
530
+ intentproof_config_v1_default
531
+ );
532
+ function errorsText(v) {
533
+ return ajv.errorsText(v.errors, { separator: "; " });
534
+ }
535
+ function assertValidExecutionEventWire(data) {
536
+ if (!validateExecutionEvent(data)) {
537
+ throw new TypeError(
538
+ `ExecutionEvent wire JSON failed schema validation: ${errorsText(validateExecutionEvent)}`
539
+ );
540
+ }
541
+ }
542
+
167
543
  // src/client.ts
168
544
  var correlationStore = new import_async_hooks.AsyncLocalStorage();
545
+ function normalizeInputsForExecutionEvent(inputs) {
546
+ if (inputs !== null && typeof inputs === "object" && !Array.isArray(inputs)) {
547
+ return inputs;
548
+ }
549
+ return { args: inputs };
550
+ }
169
551
  function assertCorrelationId(id) {
170
552
  if (typeof id !== "string") {
171
553
  throw new TypeError(
@@ -191,7 +573,8 @@ function runWithCorrelationId(correlationId, fn) {
191
573
  return correlationStore.run(correlationId, fn);
192
574
  }
193
575
  function defaultOnExporterError(error, _event) {
194
- console.error("[intentproof] exporter error", error);
576
+ const message = error instanceof Error ? error.message : String(error);
577
+ console.error("[intentproof] exporter error", message);
195
578
  }
196
579
  function toErrorSnapshot(e, includeStack) {
197
580
  if (e instanceof Error) {
@@ -390,9 +773,12 @@ var IntentProofClient = class {
390
773
  correlationId,
391
774
  intent: options.intent,
392
775
  action: options.action,
393
- inputs,
776
+ inputs: normalizeInputsForExecutionEvent(inputs),
394
777
  startedAt: startedAt.toISOString(),
395
- attributes: mergeAttrs(self.defaultAttributes, options.attributes)
778
+ attributes: mergeAttrs(
779
+ self.defaultAttributes,
780
+ options.attributes
781
+ )
396
782
  };
397
783
  try {
398
784
  const out = fn.apply(this, args);
@@ -500,6 +886,7 @@ var IntentProofClient = class {
500
886
  this.dispatch(event);
501
887
  }
502
888
  dispatch(event) {
889
+ assertValidExecutionEventWire(JSON.parse(JSON.stringify(event)));
503
890
  for (const ex of this.exporters) {
504
891
  try {
505
892
  const r = ex.export(event);
@@ -757,7 +1144,7 @@ var BoundedQueueExporter = class {
757
1144
  };
758
1145
 
759
1146
  // src/index.ts
760
- var VERSION = "0.1.2";
1147
+ var VERSION = "0.1.4";
761
1148
  var client = getIntentProofClient();
762
1149
  function createIntentProofClient(config) {
763
1150
  return new IntentProofClient(config);
@@ -770,12 +1157,16 @@ function createIntentProofClient(config) {
770
1157
  MemoryExporter,
771
1158
  VERSION,
772
1159
  assertCorrelationId,
1160
+ assertValidExecutionEventWire,
773
1161
  assertWrapOptionsShape,
774
1162
  client,
775
1163
  createIntentProofClient,
776
1164
  getCorrelationId,
777
1165
  getIntentProofClient,
778
1166
  runWithCorrelationId,
779
- snapshot
1167
+ snapshot,
1168
+ validateExecutionEvent,
1169
+ validateIntentProofConfig,
1170
+ validateWrapOptions
780
1171
  });
781
1172
  //# sourceMappingURL=index.cjs.map