@onereach/step-state-machine-shared 1.0.0-framework.13 → 1.0.0-framework.15

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
@@ -24,6 +24,7 @@ under `tools/`, not in this state-machine composition package.
24
24
  | `@onereach/step-state-machine-shared/configuration` | Step data-in normalization and `DataInValidationError`. |
25
25
  | `@onereach/step-state-machine-shared/errors` | Shared error filter factory, framework mapping, and step error-code types. |
26
26
  | `@onereach/step-state-machine-shared/notifications` | Flow invalidation routing, best-effort publication diagnostics, and bounded serial refresh scheduling. |
27
+ | `@onereach/step-state-machine-shared/telemetry` | Per-invocation W3C parent extraction; no provider registration or exporter setup. |
27
28
  | `@onereach/step-state-machine-shared/testing` | Reusable configuration and error-filter test suites; requires Vitest, an optional peer used only by this entry point. |
28
29
 
29
30
  Implementation modules stay separated under `src/system`, `src/configuration`,
@@ -53,6 +54,62 @@ The relocation itself does not change the process cache key or configuration
53
54
  identity, TTL ownership, execution, or error mapping. The subsequently implemented
54
55
  notification behavior is described below and in the owning step guides.
55
56
 
57
+ ## OpenTelemetry input
58
+
59
+ Post-commit publication also emits API-only
60
+ `state_machine.notification.publications` (bounded outcome) and
61
+ `state_machine.notification.deliveries` (bounded channel/outcome) counters.
62
+ Deduplicated delivery successes, skips, and failures remain independent of the
63
+ committed mutation result; policy rejection counts only as a failed publication.
64
+ No IDs, routing payloads, raw errors, or listener-specific instruments are added.
65
+ Metrics work without a tracer provider; hosts own meter providers, readers,
66
+ views/exporters, and shutdown. See the
67
+ [metric reference](../../docs/architecture/telemetry.md#metrics-and-diagnostics).
68
+
69
+ The configuration entry point exports `OtelInput`, `normalizeOtelInput`, and
70
+ the plain `otelInputSchema` used by both steps' build-time definitions.
71
+ Step-specific field descriptions remain local; carrier structure is shared.
72
+ Both steps expose an optional `otel` field:
73
+
74
+ ```ts
75
+ type OtelInput =
76
+ | { traceparent?: never; tracestate?: never }
77
+ | { traceparent: string; tracestate?: string };
78
+ ```
79
+
80
+ Omitted input, `{}`, or a missing `traceparent` means no explicit parent.
81
+ `tracestate` alone is disallowed for typed callers and ignored by runtime
82
+ normalization. Malformed shapes normalize to `{}`; non-string tracestate is
83
+ dropped. Unknown tracing fields, including baggage, are stripped without reading
84
+ them. Valid strings are copied, not stored as live span/context objects.
85
+
86
+ `extractOtelParentContext(otel)` from `/telemetry` extracts a remote W3C parent
87
+ or returns `undefined` for absent/invalid data. Invalid wire data produces a
88
+ best-effort OpenTelemetry diagnostic containing no supplied values. Neither
89
+ extraction nor diagnostic failure rejects application work. The execution step
90
+ passes the result through execution options, never function arguments/context or
91
+ process configuration. Undefined leaves the service's active-context/root fallback
92
+ intact. No provider, exporter, or global propagator is installed.
93
+
94
+ Initialization extracts once and passes the same parent to service load and
95
+ conditional create as sibling lifecycle spans. Its input is not captured for
96
+ cached function calls, refreshes, or listener lifetimes. See the
97
+ [telemetry reference](../../docs/architecture/telemetry.md) for implemented spans
98
+ and the remaining scope.
99
+
100
+ The composed OneReach provider also emits `coordination.acquire`. Configure a host
101
+ async context manager to attach it to the active service operation; passing Data In
102
+ parent headers alone does not install context propagation. The span measures only
103
+ acquisition and ends before protected work. No per-instance IDs, keys, tokens, or
104
+ exception messages are captured.
105
+
106
+ Caller timeouts remain separate from `function.invoke` completion, confirmed
107
+ `worker.execute` exit, and `coordination.retained` ownership cleanup spans.
108
+ With host context management these correlate even when lifetimes outlast the
109
+ caller span. An open lifetime span is not usually exported until it ends; the
110
+ caller trace's timeout/retention events and existing process diagnostics remain
111
+ necessary to identify still-running work. Late results never enter persistence.
112
+
56
113
  ## Cached function convenience API
57
114
 
58
115
  The initialization step installs a frozen `process.cache.stateMachines` facade
@@ -110,6 +167,28 @@ failure records/logging do not replace committed results. Routing-policy callbac
110
167
  and publication setup are also contained after commit: failures return
111
168
  `{ channel: 'policy', message }` and best-effort warnings, without replaying execution.
112
169
  Transport failures retain `channel: 'local'` or `'remote'`.
170
+ Post-commit tracing emits `notifications.publish` around policy resolution and
171
+ delivery, with `notifications.local` per unique target and at most one
172
+ `notifications.remote`. Publication outcome/counts distinguish no targets,
173
+ optional inactive skips, successful SDK calls, transport failures, and policy
174
+ failures. These describe invalidation attempts, not durable receipt or refreshed
175
+ state. Failures affect only notification spans, never the completed mutation's
176
+ status, commit flag, result, or retry policy.
177
+
178
+ Execution and publication are sibling operations under the host's active request
179
+ span or a common explicit `parentContext`. Hosts configure context management for
180
+ asynchronous propagation; the helper forwards execution options unchanged and
181
+ does not observe service span identities. Without a common parent, execution and
182
+ publication may be independent roots, even if a context manager is installed.
183
+ Local/remote delivery nesting is explicit. Direct `publishStateChange` calls
184
+ inherit active context and preserve their existing policy-error rejection.
185
+ If reading the optional notification tracing parent throws after execution, the
186
+ helper falls back to active context and still resolves routing and delivers.
187
+ Tracing metadata failures are not reported as notification-policy failures.
188
+ No instance/template identity, target/topic, payload, or raw exception detail is added to spans.
189
+ Notification payloads and routing remain unchanged; listener-specific
190
+ instrumentation is excluded. See the [span/event reference](../../docs/architecture/telemetry.md).
191
+
113
192
  An optional final execution-options argument forwards per-call cancellation
114
193
  signals to the service without imposing initialization or agent-routing policy.
115
194
 
@@ -1,3 +1,4 @@
1
+ import { n as normalizeOtelInput, t as OtelInput } from "./otel-Bj0Y2NBb.mjs";
1
2
  //#region src/configuration/data-in.d.mts
2
3
  interface DataInIssue {
3
4
  path: string;
@@ -40,5 +41,37 @@ declare function copyRecord(value: unknown, path: string): unknown;
40
41
  */
41
42
  declare function parseStepDataIn<T>(value: unknown, fields: readonly string[], validate: CompiledValidator, normalize: (data: Record<string, unknown>) => void): T;
42
43
  //#endregion
43
- export { DataInIssue, DataInValidationError, copyRecord, normalizeString, parseStepDataIn, projectObject };
44
+ //#region src/configuration/otel-schema.d.mts
45
+ /**
46
+ * Shared structural authoring definition. Runtime normalization remains tolerant;
47
+ * W3C extraction, not this schema, decides whether a remote parent is valid.
48
+ */
49
+ declare const otelInputSchema: {
50
+ readonly anyOf: readonly [{
51
+ readonly type: "object";
52
+ readonly properties: {};
53
+ readonly additionalProperties: false;
54
+ }, {
55
+ readonly type: "object";
56
+ readonly properties: {
57
+ readonly traceparent: {
58
+ readonly type: "string";
59
+ readonly description: "W3C traceparent identifying the explicit remote parent.";
60
+ readonly examples: readonly ["00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"];
61
+ };
62
+ readonly tracestate: {
63
+ readonly type: "string";
64
+ readonly description: "Optional W3C vendor trace state for that parent.";
65
+ readonly examples: readonly ["vendor=value"];
66
+ };
67
+ };
68
+ readonly required: readonly ["traceparent"];
69
+ readonly additionalProperties: false;
70
+ }];
71
+ readonly examples: readonly [{}, {
72
+ readonly traceparent: "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01";
73
+ }];
74
+ };
75
+ //#endregion
76
+ export { DataInIssue, DataInValidationError, OtelInput, copyRecord, normalizeOtelInput, normalizeString, otelInputSchema, parseStepDataIn, projectObject };
44
77
  //# sourceMappingURL=configuration.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.d.mts","names":[],"sources":["../src/configuration/data-in.mts"],"mappings":";UAAiB;EACf;EACA;;cAGW,8BAA8B;WAChC,iBAAiB;EAEd,YAAA,iBAAiB;;UASrB;EACR;EACA;EACA;EACA,QAAQ;;UAGA;GACP;IAAmB;IAAgB,iBAAiB;;;;;;;iBAoBvC,cAAc,gBAAgB;;;;;iBAW9B,gBAAgB,gBAAgB,cAAc;;;;;iBAc9C,WAAW,gBAAgB;;;;;iBAa3B,gBAAgB,GAC9B,gBACA,2BACA,UAAU,mBACV,YAAY,MAAM,mCACjB"}
1
+ {"version":3,"file":"configuration.d.mts","names":[],"sources":["../src/configuration/data-in.mts","../src/configuration/otel-schema.mts"],"mappings":";;UAAiB;EACf;EACA;;cAGW,8BAA8B;WAChC,iBAAiB;EAEd,YAAA,iBAAiB;;UASrB;EACR;EACA;EACA;EACA,QAAQ;;UAGA;GACP;IAAmB;IAAgB,iBAAiB;;;;;;;iBAoBvC,cAAc,gBAAgB;;;;;iBAW9B,gBAAgB,gBAAgB,cAAc;;;;;iBAc9C,WAAW,gBAAgB;;;;;iBAa3B,gBAAgB,GAC9B,gBACA,2BACA,UAAU,mBACV,YAAY,MAAM,mCACjB;;;;;;;cCpFU"}
@@ -1 +1,2 @@
1
- import{a as e,i as t,n,r,t as i}from"./data-in-DT43edEv.mjs";export{i as DataInValidationError,n as copyRecord,r as normalizeString,t as parseStepDataIn,e as projectObject};
1
+ import{a as e,i as t,n,r,t as i}from"./data-in-DT43edEv.mjs";function a(e){try{if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=`traceparent`in e?e.traceparent:void 0;if(typeof t!=`string`||t===``)return{};let n=`tracestate`in e?e.tracestate:void 0,r={traceparent:t};return typeof n==`string`&&(r.tracestate=n),r}catch{return{}}}const o={anyOf:[{type:`object`,properties:{},additionalProperties:!1},{type:`object`,properties:{traceparent:{type:`string`,description:`W3C traceparent identifying the explicit remote parent.`,examples:[`00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01`]},tracestate:{type:`string`,description:`Optional W3C vendor trace state for that parent.`,examples:[`vendor=value`]}},required:[`traceparent`],additionalProperties:!1}],examples:[{},{traceparent:`00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01`}]};export{i as DataInValidationError,n as copyRecord,a as normalizeOtelInput,r as normalizeString,o as otelInputSchema,t as parseStepDataIn,e as projectObject};
2
+ //# sourceMappingURL=configuration.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.mjs","names":[],"sources":["../src/configuration/otel.mts","../src/configuration/otel-schema.mts"],"sourcesContent":["/**\n * Serializable parent propagation data, or an explicitly empty tracing input.\n * A tracestate without a traceparent is not meaningful.\n */\nexport type OtelInput = { traceparent?: never; tracestate?: never } | { traceparent: string; tracestate?: string };\n\n/**\n * Copy tracing fields without rejecting an otherwise valid step invocation.\n * Wire-format validity is checked during extraction, not configuration parsing.\n */\nexport function normalizeOtelInput(value: unknown): OtelInput {\n try {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return {};\n const traceparent: unknown = 'traceparent' in value ? value.traceparent : undefined;\n if (typeof traceparent !== 'string' || traceparent === '') return {};\n const tracestate: unknown = 'tracestate' in value ? value.tracestate : undefined;\n const result: OtelInput = { traceparent };\n if (typeof tracestate === 'string') result.tracestate = tracestate;\n return result;\n } catch {\n // Even an unreadable tracing field must not reject valid application work.\n return {};\n }\n}\n","/**\n * Shared structural authoring definition. Runtime normalization remains tolerant;\n * W3C extraction, not this schema, decides whether a remote parent is valid.\n */\nexport const otelInputSchema = {\n anyOf: [\n { type: 'object', properties: {}, additionalProperties: false },\n {\n type: 'object',\n properties: {\n traceparent: {\n type: 'string',\n description: 'W3C traceparent identifying the explicit remote parent.',\n examples: ['00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01'],\n },\n tracestate: {\n type: 'string',\n description: 'Optional W3C vendor trace state for that parent.',\n examples: ['vendor=value'],\n },\n },\n required: ['traceparent'],\n additionalProperties: false,\n },\n ],\n examples: [{}, { traceparent: '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01' }],\n} as const;\n"],"mappings":"6DAUA,SAAgB,EAAmB,EAA2B,CAC5D,GAAI,CACF,GAAsB,OAAO,GAAU,WAAnC,GAA+C,MAAM,QAAQ,CAAK,EAAG,MAAO,CAAC,EACjF,IAAM,EAAuB,gBAAiB,EAAQ,EAAM,YAAc,IAAA,GAC1E,GAAI,OAAO,GAAgB,UAAY,IAAgB,GAAI,MAAO,CAAC,EACnE,IAAM,EAAsB,eAAgB,EAAQ,EAAM,WAAa,IAAA,GACjE,EAAoB,CAAE,aAAY,EAExC,OADI,OAAO,GAAe,WAAU,EAAO,WAAa,GACjD,CACT,MAAQ,CAEN,MAAO,CAAC,CACV,CACF,CCnBA,MAAa,EAAkB,CAC7B,MAAO,CACL,CAAE,KAAM,SAAU,WAAY,CAAC,EAAG,qBAAsB,EAAM,EAC9D,CACE,KAAM,SACN,WAAY,CACV,YAAa,CACX,KAAM,SACN,YAAa,0DACb,SAAU,CAAC,yDAAyD,CACtE,EACA,WAAY,CACV,KAAM,SACN,YAAa,mDACb,SAAU,CAAC,cAAc,CAC3B,CACF,EACA,SAAU,CAAC,aAAa,EACxB,qBAAsB,EACxB,CACF,EACA,SAAU,CAAC,CAAC,EAAG,CAAE,YAAa,yDAA0D,CAAC,CAC3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.d.mts","names":[],"sources":["../src/notifications/index.ts"],"mappings":";;;;KAIY;UAEK;EACf;EACA;;UAGe;;;;EAIf,SAAS;EACT;;UAGe;EACf;EACA;EACA;;;;;EAKA;;cAGW;cACA;;;;iBAKG,4BAA4B;;;;;iBAQ5B,uBAAuB,UAAU;;;;;iBA6B3B,mBAAmB,UAAU,QACjD,QAAQ,QAAQ,IAChB,UAAU,qBACV,SAAS,gCACR,QAAQ;;;;;;;;;;iBAwCW,4BAA4B,gBAAgB,QAAQ,UAAU,mBAClF,QAAQ,QAAQ,UAChB;EACE,UACE,SAAS,oCACT,SAAS,UACT,UAAU,uCACP,QAAQ,uBAAuB;GAEtC,SAAS,oCACT,SAAS,UACT,gBAAe,uCAAuC,gCACtD,mBAAmB,qCAClB;EAAU,QAAQ,uBAAuB;EAAU,sBAAsB;;UAc3D;EACf,iBAAiB;;;;;;;cAQN;UACH;UACA;mBAES;EAEL,YAAA,UAAU,MAAM,gBAAgB;UAI9B;EAeP,QAAQ,SAAS,eAAe"}
1
+ {"version":3,"file":"notifications.d.mts","names":[],"sources":["../src/notifications/index.ts"],"mappings":";;;;KAOY;UAEK;EACf;EACA;;UAGe;;;;EAIf,SAAS;EACT;;UAGe;EACf;EACA;EACA;;;;;EAKA;;cAGW;cACA;;;;iBAKG,4BAA4B;;;;;iBAQ5B,uBAAuB,UAAU;;;;;iBA6B3B,mBAAmB,UAAU,QACjD,QAAQ,QAAQ,IAChB,UAAU,qBACV,SAAS,gCACR,QAAQ;;;;;;;;;;iBAsEW,4BAA4B,gBAAgB,QAAQ,UAAU,mBAClF,QAAQ,QAAQ,UAChB;EACE,UACE,SAAS,oCACT,SAAS,UACT,UAAU,uCACP,QAAQ,uBAAuB;GAEtC,SAAS,oCACT,SAAS,UACT,gBAAe,uCAAuC,gCACtD,mBAAmB,qCAClB;EAAU,QAAQ,uBAAuB;EAAU,sBAAsB;;UAwB3D;EACf,iBAAiB;;;;;;;cAQN;UACH;UACA;mBAES;EAEL,YAAA,UAAU,MAAM,gBAAgB;UAI9B;EAeP,QAAQ,SAAS,eAAe"}
@@ -1,2 +1,2 @@
1
- const e=`cng_lnr`,t=`st_cgd`;function n(t){return`sm_mgr_${e}_${t}`}function r(e){return`sm/${encodeURIComponent(e.templateId)}/${encodeURIComponent(e.instanceId)}`}function i(e,t,n,r){let i=`Notification failed`;try{let e=r instanceof Error?r.message:r;typeof e==`string`&&(i=e)}catch{}try{e.log.WARN?.(`State mutation committed, but notification failed`,{channel:n,identity:t,error:r})}catch{}return{channel:n,message:i}}async function a(e,a,o){let{localStepId:s,localStepIds:c,remote:l,skipInactiveLocalTargets:u}=o,d=new Set(c);s!==void 0&&d.add(s);let f=[],p=async(t,n)=>{try{let e=await n();if(e instanceof Error)throw e}catch(n){f.push(i(e,a,t,n))}};for(let r of d){let i=n(r);await p(`local`,()=>{let n=e.process.getThread(i);if(!n||n.ended){if(u)return;throw Error(`State change listener is not active`)}return e.process.enqueueAndRun({name:t,thread:i,params:a})})}return l&&await p(`remote`,()=>e.emitAsync({name:r(a),params:a})),f}async function o(e,t,n,r,o={},s){let c=await(s===void 0?t.execute(n,r):t.execute(n,r,s));if(c.kind===`query`)return{result:c,notificationFailures:[]};let l={instanceId:c.instance.instance.id,templateId:c.instance.instance.template.id};try{return{result:c,notificationFailures:await a(e,l,typeof o==`function`?o():o)}}catch(t){return{result:c,notificationFailures:[i(e,l,`policy`,t)]}}}var s=class{pending;running;refresh;constructor(e){this.refresh=e}async drain(){await Promise.resolve();try{for(;this.pending;){let e=this.pending;this.pending=void 0,await this.refresh(e)}}finally{this.running=void 0}}request(e){return this.pending={callbackSource:e??this.pending?.callbackSource},this.running??=this.drain(),this.running}};export{s as LatestStateRefresh,o as executeStateMachineFunction,t as localStateChangeEvent,a as publishStateChange,r as remoteStateChangeEvent,e as stateChangeListenerClassId,n as stateChangeListenerThreadId};
1
+ import{inContext as e,recordCounter as t,startSafeSpan as n}from"@onereach/state-machine-telemetry";async function r(r,i,a){let o=`delivered`,s=n(`@onereach/step-state-machine-shared`,r,i),c=s.context,l=s.setAttribute,u={context:c,outcome:e=>{o=e,l(`state_machine.notification.outcome`,e),e===`failed`?s.fail(r===`notifications.publish`?`notification_transport_failed`:`notification_delivery_failed`):e===`policy_failed`&&s.fail(`notification_policy_failed`)},counts:(e,t,n)=>{l(`state_machine.notification.delivered_count`,e),l(`state_machine.notification.skipped_count`,t),l(`state_machine.notification.failure_count`,n)},deliveryFailed:e=>s.addEvent(`notification.delivery_failed`,{"state_machine.notification.channel":e})};r===`notifications.publish`?u.counts(0,0,0):l(`state_machine.notification.channel`,r===`notifications.local`?`local`:`remote`);try{return await e(c,()=>a(u))}catch(e){throw r===`notifications.publish`?(u.outcome(`policy_failed`),l(`state_machine.notification.failure_count`,1),s.addEvent(`notification.policy_failed`)):u.outcome(`failed`),e}finally{r===`notifications.publish`?t(`@onereach/step-state-machine-shared`,`state_machine.notification.publications`,`{publication}`,1,{outcome:o},c):t(`@onereach/step-state-machine-shared`,`state_machine.notification.deliveries`,`{delivery}`,1,{channel:r===`notifications.local`?`local`:`remote`,outcome:o},c),s.end()}}const i=`cng_lnr`,a=`st_cgd`;function o(e){return`sm_mgr_${i}_${e}`}function s(e){return`sm/${encodeURIComponent(e.templateId)}/${encodeURIComponent(e.instanceId)}`}function c(e,t,n,r){let i=`Notification failed`;try{let e=r instanceof Error?r.message:r;typeof e==`string`&&(i=e)}catch{}try{e.log.WARN?.(`State mutation committed, but notification failed`,{channel:n,identity:t,error:r})}catch{}return{channel:n,message:i}}async function l(e,t,n){return r(`notifications.publish`,void 0,r=>u(e,t,n,r))}async function u(e,t,n,i){let{localStepId:l,localStepIds:u,remote:d,skipInactiveLocalTargets:f}=n,p=new Set(u);l!==void 0&&p.add(l);let m=[],h=0,g=0,_=async(n,a)=>{try{await r(n===`local`?`notifications.local`:`notifications.remote`,i.context,async e=>{let t=!1,n=await a(()=>{t=!0});if(n instanceof Error)throw n;let r=t?`skipped`:`delivered`;return e.outcome(r),r})===`skipped`?g++:h++}catch(r){m.push(c(e,t,n,r)),i.deliveryFailed(n)}};for(let n of p){let r=o(n);await _(`local`,n=>{let i=e.process.getThread(r);if(!i||i.ended){if(f)return n();throw Error(`State change listener is not active`)}return e.process.enqueueAndRun({name:a,thread:r,params:t})})}return d&&await _(`remote`,()=>e.emitAsync({name:s(t),params:t})),i.counts(h,g,m.length),i.outcome(m.length>0?`failed`:h>0?`delivered`:g>0?`skipped`:`no_targets`),m}async function d(e,t,n,i,a={},o){let s=await t.execute(n,i,o);if(s.kind===`query`)return{result:s,notificationFailures:[]};let l={instanceId:s.instance.instance.id,templateId:s.instance.instance.template.id},d;try{d=o?.parentContext}catch{}try{return{result:s,notificationFailures:await r(`notifications.publish`,d,t=>{let n=typeof a==`function`?a():a;return u(e,l,n,t)})}}catch(t){return{result:s,notificationFailures:[c(e,l,`policy`,t)]}}}var f=class{pending;running;refresh;constructor(e){this.refresh=e}async drain(){await Promise.resolve();try{for(;this.pending;){let e=this.pending;this.pending=void 0,await this.refresh(e)}}finally{this.running=void 0}}request(e){return this.pending={callbackSource:e??this.pending?.callbackSource},this.running??=this.drain(),this.running}};export{f as LatestStateRefresh,d as executeStateMachineFunction,a as localStateChangeEvent,l as publishStateChange,s as remoteStateChangeEvent,i as stateChangeListenerClassId,o as stateChangeListenerThreadId};
2
2
  //# sourceMappingURL=notifications.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.mjs","names":[],"sources":["../src/notifications/index.ts"],"sourcesContent":["import type { CONFIG, IThread } from '@onereach/flow-sdk/types/index.js';\nimport type { ExecuteStateMachineFunctionRequest } from '@onereach/state-machine-contracts';\nimport type { ExecuteStateMachineFunctionOptions, ManagedExecutionResult } from '@onereach/state-machine-service';\n\nexport type ChangeSource = 'local' | 'remote';\n\nexport interface StateChangeIdentity {\n instanceId: string;\n templateId: string;\n}\n\nexport interface NotificationFailure {\n /**\n * `policy` denotes a failure resolving notification routing after commit.\n */\n channel: ChangeSource | 'policy';\n message: string;\n}\n\nexport interface StateChangePublicationOptions {\n localStepId?: string;\n localStepIds?: readonly string[];\n remote?: boolean;\n /**\n * Skip absent or ended local listeners instead of reporting delivery failures.\n * Defaults to false for callers explicitly requesting delivery to a selected step.\n */\n skipInactiveLocalTargets?: boolean;\n}\n\nexport const stateChangeListenerClassId = 'cng_lnr';\nexport const localStateChangeEvent = 'st_cgd';\n\n/**\n * Keep SDK thread addressing private to the shared Flow notification boundary.\n */\nexport function stateChangeListenerThreadId(stepId: string): string {\n return `sm_mgr_${stateChangeListenerClassId}_${stepId}`;\n}\n\n/**\n * Encode identity segments independently so identifiers containing slashes cannot collide.\n * Account/topic authorization and scope remain owned by the Flow SDK.\n */\nexport function remoteStateChangeEvent(identity: StateChangeIdentity): `sm/${string}/${string}` {\n return `sm/${encodeURIComponent(identity.templateId)}/${encodeURIComponent(identity.instanceId)}`;\n}\n\nfunction reportNotificationFailure<T extends CONFIG>(\n thread: IThread<T>,\n identity: StateChangeIdentity,\n channel: NotificationFailure['channel'],\n error: unknown,\n): NotificationFailure {\n let message = 'Notification failed';\n try {\n const detail = error instanceof Error ? error.message : error;\n if (typeof detail === 'string') message = detail;\n } catch {\n // Even a thrown value with an unreadable message must remain best-effort.\n }\n try {\n thread.log.WARN?.('State mutation committed, but notification failed', { channel, identity, error });\n } catch {\n // Diagnostics must not replace a committed mutation result.\n }\n return { channel, message };\n}\n\n/**\n * Publish best-effort invalidation hints after persistence. Each channel is\n * attempted independently; failures are returned, never retried as mutations.\n */\nexport async function publishStateChange<T extends CONFIG>(\n thread: IThread<T>,\n identity: StateChangeIdentity,\n options: StateChangePublicationOptions,\n): Promise<NotificationFailure[]> {\n // Resolve all policy getters and recipients before any delivery can run.\n const { localStepId, localStepIds: recipients, remote, skipInactiveLocalTargets } = options;\n const localStepIds = new Set(recipients);\n if (localStepId !== undefined) localStepIds.add(localStepId);\n const failures: NotificationFailure[] = [];\n const attempt = async (channel: ChangeSource, publish: () => unknown): Promise<void> => {\n try {\n const result = await publish();\n if (result instanceof Error) throw result;\n } catch (error) {\n failures.push(reportNotificationFailure(thread, identity, channel, error));\n }\n };\n for (const stepId of localStepIds) {\n const listenerId = stateChangeListenerThreadId(stepId);\n await attempt('local', () => {\n const listener = thread.process.getThread(listenerId);\n if (!listener || listener.ended) {\n if (skipInactiveLocalTargets) return;\n throw new Error('State change listener is not active');\n }\n return thread.process.enqueueAndRun({ name: localStateChangeEvent, thread: listenerId, params: identity });\n });\n }\n if (remote) {\n await attempt('remote', () => thread.emitAsync({ name: remoteStateChangeEvent(identity), params: identity }));\n }\n return failures;\n}\n\n/**\n * Execute once through the service, then publish best-effort hints only for a\n * committed mutation. Execution errors propagate without publication or retries.\n *\n * @param notifications - Explicit publication policy, or a callback evaluated\n * after a mutation commits to resolve current notification recipients.\n * @returns The unchanged service result and any serializable publication failures,\n * including `channel: 'policy'` if routing resolution or publication setup throws.\n */\nexport async function executeStateMachineFunction<TConfig extends CONFIG, TContext, TOutput = unknown>(\n thread: IThread<TConfig>,\n service: {\n execute: (\n request: ExecuteStateMachineFunctionRequest,\n context: TContext,\n options?: ExecuteStateMachineFunctionOptions,\n ) => Promise<ManagedExecutionResult<TOutput>>;\n },\n request: ExecuteStateMachineFunctionRequest,\n context: TContext,\n notifications: StateChangePublicationOptions | (() => StateChangePublicationOptions) = {},\n executionOptions?: ExecuteStateMachineFunctionOptions,\n): Promise<{ result: ManagedExecutionResult<TOutput>; notificationFailures: NotificationFailure[] }> {\n const result = await (executionOptions === undefined\n ? service.execute(request, context)\n : service.execute(request, context, executionOptions));\n if (result.kind === 'query') return { result, notificationFailures: [] };\n const identity = { instanceId: result.instance.instance.id, templateId: result.instance.instance.template.id };\n try {\n const policy = typeof notifications === 'function' ? notifications() : notifications;\n return { result, notificationFailures: await publishStateChange(thread, identity, policy) };\n } catch (error) {\n return { result, notificationFailures: [reportNotificationFailure(thread, identity, 'policy', error)] };\n }\n}\n\nexport interface RefreshHint {\n callbackSource?: ChangeSource;\n}\n\n/**\n * Serialize refreshes with one pending invalidation, not a history of snapshots.\n * The most recent eligible hint selects a callback source; disabled sources\n * still invalidate state but cannot erase a pending eligible callback request.\n */\nexport class LatestStateRefresh {\n private pending?: RefreshHint;\n private running?: Promise<void>;\n\n private readonly refresh: (hint: RefreshHint) => Promise<void>;\n\n constructor(refresh: (hint: RefreshHint) => Promise<void>) {\n this.refresh = refresh;\n }\n\n private async drain(): Promise<void> {\n // Yield before starting so synchronous loader failures cannot leave a stale\n // rejected promise assigned after the finally block clears it.\n await Promise.resolve();\n try {\n while (this.pending) {\n const hint = this.pending;\n this.pending = undefined;\n await this.refresh(hint);\n }\n } finally {\n this.running = undefined;\n }\n }\n\n public request(source?: ChangeSource): Promise<void> {\n this.pending = { callbackSource: source ?? this.pending?.callbackSource };\n this.running ??= this.drain();\n return this.running;\n }\n}\n"],"mappings":"AA8BA,MAAa,EAA6B,UAC7B,EAAwB,SAKrC,SAAgB,EAA4B,EAAwB,CAClE,MAAO,UAAU,EAA2B,GAAG,GACjD,CAMA,SAAgB,EAAuB,EAAyD,CAC9F,MAAO,MAAM,mBAAmB,EAAS,UAAU,EAAE,GAAG,mBAAmB,EAAS,UAAU,GAChG,CAEA,SAAS,EACP,EACA,EACA,EACA,EACqB,CACrB,IAAI,EAAU,sBACd,GAAI,CACF,IAAM,EAAS,aAAiB,MAAQ,EAAM,QAAU,EACpD,OAAO,GAAW,WAAU,EAAU,EAC5C,MAAQ,CAER,CACA,GAAI,CACF,EAAO,I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AO,SAAS,SAAS,SAAS,EAAG,EAC7G,GAAI,CAEF,MAAO,CAAE,SAAQ,qBAAsB,MAAM,EAAmB,EAAQ,EADzD,OAAO,GAAkB,WAAa,EAAc,EAAI,CACiB,CAAE,CAC5F,OAAS,EAAO,CACd,MAAO,CAAE,SAAQ,qBAAsB,CAAC,EAA0B,EAAQ,EAAU,SAAU,CAAK,CAAC,CAAE,CACxG,CACF,CAWA,IAAa,EAAb,KAAgC,CAC9B,QACA,QAEA,QAEA,YAAY,EAA+C,CACzD,KAAK,QAAU,CACjB,CAEA,MAAc,OAAuB,CAGnC,MAAM,QAAQ,QAAQ,EACtB,GAAI,CACF,KAAO,KAAK,SAAS,CACnB,IAAM,EAAO,KAAK,QAClB,KAAK,QAAU,IAAA,GACf,MAAM,KAAK,QAAQ,CAAI,CACzB,CACF,QAAU,CACR,KAAK,QAAU,IAAA,EACjB,CACF,CAEA,QAAe,EAAsC,CAGnD,MAFA,MAAK,QAAU,CAAE,eAAgB,GAAU,KAAK,SAAS,cAAe,EACxE,KAAK,UAAY,KAAK,MAAM,EACrB,KAAK,OACd,CACF"}
1
+ {"version":3,"file":"notifications.mjs","names":[],"sources":["../src/notifications/telemetry.ts","../src/notifications/index.ts"],"sourcesContent":["import { recordCounter, inContext, startSafeSpan } from '@onereach/state-machine-telemetry';\nimport type { Context } from '@opentelemetry/api';\n\ntype NotificationSpanName = 'notifications.publish' | 'notifications.local' | 'notifications.remote';\ntype Outcome = 'delivered' | 'skipped' | 'no_targets' | 'failed' | 'policy_failed';\n\nexport interface NotificationSpan {\n context: Context;\n outcome(outcome: Outcome): void;\n counts(delivered: number, skipped: number, failures: number): void;\n deliveryFailed(channel: 'local' | 'remote'): void;\n}\n\n/**\n * Trace post-commit routing/delivery without changing its independent outcome.\n * Explicit parents also preserve publication/delivery nesting without host ALS.\n */\nexport async function withNotificationSpan<T>(\n name: NotificationSpanName,\n parent: Context | undefined,\n operation: (scope: NotificationSpan) => Promise<T>,\n): Promise<T> {\n let recordedOutcome: Outcome = 'delivered';\n const span = startSafeSpan('@onereach/step-state-machine-shared', name, parent);\n const childContext = span.context;\n const attribute = span.setAttribute;\n const scope = {\n context: childContext,\n outcome: (outcome: Outcome) => {\n recordedOutcome = outcome;\n attribute('state_machine.notification.outcome', outcome);\n if (outcome === 'failed')\n span.fail(name === 'notifications.publish' ? 'notification_transport_failed' : 'notification_delivery_failed');\n else if (outcome === 'policy_failed') span.fail('notification_policy_failed');\n },\n counts: (delivered: number, skipped: number, failures: number) => {\n attribute('state_machine.notification.delivered_count', delivered);\n attribute('state_machine.notification.skipped_count', skipped);\n attribute('state_machine.notification.failure_count', failures);\n },\n deliveryFailed: (channel: 'local' | 'remote') =>\n span.addEvent('notification.delivery_failed', { 'state_machine.notification.channel': channel }),\n };\n if (name === 'notifications.publish') scope.counts(0, 0, 0);\n else attribute('state_machine.notification.channel', name === 'notifications.local' ? 'local' : 'remote');\n try {\n return await inContext(childContext, () => operation(scope));\n } catch (error) {\n if (name === 'notifications.publish') {\n scope.outcome('policy_failed');\n attribute('state_machine.notification.failure_count', 1);\n span.addEvent('notification.policy_failed');\n } else scope.outcome('failed');\n throw error;\n } finally {\n // Count settled SDK delivery attempts, never inferred listener receipt.\n if (name === 'notifications.publish') {\n recordCounter(\n '@onereach/step-state-machine-shared',\n 'state_machine.notification.publications',\n '{publication}',\n 1,\n { outcome: recordedOutcome },\n childContext,\n );\n } else {\n recordCounter(\n '@onereach/step-state-machine-shared',\n 'state_machine.notification.deliveries',\n '{delivery}',\n 1,\n {\n channel: name === 'notifications.local' ? 'local' : 'remote',\n outcome: recordedOutcome,\n },\n childContext,\n );\n }\n span.end();\n }\n}\n","import type { CONFIG, IThread } from '@onereach/flow-sdk/types/index.js';\nimport type { ExecuteStateMachineFunctionRequest } from '@onereach/state-machine-contracts';\nimport type { ExecuteStateMachineFunctionOptions, ManagedExecutionResult } from '@onereach/state-machine-service';\n\nimport { withNotificationSpan } from './telemetry.ts';\nimport type { NotificationSpan } from './telemetry.ts';\n\nexport type ChangeSource = 'local' | 'remote';\n\nexport interface StateChangeIdentity {\n instanceId: string;\n templateId: string;\n}\n\nexport interface NotificationFailure {\n /**\n * `policy` denotes a failure resolving notification routing after commit.\n */\n channel: ChangeSource | 'policy';\n message: string;\n}\n\nexport interface StateChangePublicationOptions {\n localStepId?: string;\n localStepIds?: readonly string[];\n remote?: boolean;\n /**\n * Skip absent or ended local listeners instead of reporting delivery failures.\n * Defaults to false for callers explicitly requesting delivery to a selected step.\n */\n skipInactiveLocalTargets?: boolean;\n}\n\nexport const stateChangeListenerClassId = 'cng_lnr';\nexport const localStateChangeEvent = 'st_cgd';\n\n/**\n * Keep SDK thread addressing private to the shared Flow notification boundary.\n */\nexport function stateChangeListenerThreadId(stepId: string): string {\n return `sm_mgr_${stateChangeListenerClassId}_${stepId}`;\n}\n\n/**\n * Encode identity segments independently so identifiers containing slashes cannot collide.\n * Account/topic authorization and scope remain owned by the Flow SDK.\n */\nexport function remoteStateChangeEvent(identity: StateChangeIdentity): `sm/${string}/${string}` {\n return `sm/${encodeURIComponent(identity.templateId)}/${encodeURIComponent(identity.instanceId)}`;\n}\n\nfunction reportNotificationFailure<T extends CONFIG>(\n thread: IThread<T>,\n identity: StateChangeIdentity,\n channel: NotificationFailure['channel'],\n error: unknown,\n): NotificationFailure {\n let message = 'Notification failed';\n try {\n const detail = error instanceof Error ? error.message : error;\n if (typeof detail === 'string') message = detail;\n } catch {\n // Even a thrown value with an unreadable message must remain best-effort.\n }\n try {\n thread.log.WARN?.('State mutation committed, but notification failed', { channel, identity, error });\n } catch {\n // Diagnostics must not replace a committed mutation result.\n }\n return { channel, message };\n}\n\n/**\n * Publish best-effort invalidation hints after persistence. Each channel is\n * attempted independently; failures are returned, never retried as mutations.\n */\nexport async function publishStateChange<T extends CONFIG>(\n thread: IThread<T>,\n identity: StateChangeIdentity,\n options: StateChangePublicationOptions,\n): Promise<NotificationFailure[]> {\n return withNotificationSpan('notifications.publish', undefined, (span) =>\n publishStateChangeTraced(thread, identity, options, span),\n );\n}\n\nasync function publishStateChangeTraced<T extends CONFIG>(\n thread: IThread<T>,\n identity: StateChangeIdentity,\n options: StateChangePublicationOptions,\n span: NotificationSpan,\n): Promise<NotificationFailure[]> {\n // Resolve all policy getters and recipients before any delivery can run.\n const { localStepId, localStepIds: recipients, remote, skipInactiveLocalTargets } = options;\n const localStepIds = new Set(recipients);\n if (localStepId !== undefined) localStepIds.add(localStepId);\n const failures: NotificationFailure[] = [];\n let delivered = 0;\n let skipped = 0;\n const attempt = async (channel: ChangeSource, publish: (skip: () => void) => unknown): Promise<void> => {\n try {\n const outcome = await withNotificationSpan(\n channel === 'local' ? 'notifications.local' : 'notifications.remote',\n span.context,\n async (delivery) => {\n let isSkipped = false;\n const result = await publish(() => {\n isSkipped = true;\n });\n if (result instanceof Error) throw result;\n const outcome = isSkipped ? 'skipped' : 'delivered';\n delivery.outcome(outcome);\n return outcome;\n },\n );\n if (outcome === 'skipped') skipped++;\n else delivered++;\n } catch (error) {\n failures.push(reportNotificationFailure(thread, identity, channel, error));\n span.deliveryFailed(channel);\n }\n };\n for (const stepId of localStepIds) {\n const listenerId = stateChangeListenerThreadId(stepId);\n await attempt('local', (skip) => {\n const listener = thread.process.getThread(listenerId);\n if (!listener || listener.ended) {\n if (skipInactiveLocalTargets) return skip();\n throw new Error('State change listener is not active');\n }\n return thread.process.enqueueAndRun({ name: localStateChangeEvent, thread: listenerId, params: identity });\n });\n }\n if (remote) {\n await attempt('remote', () => thread.emitAsync({ name: remoteStateChangeEvent(identity), params: identity }));\n }\n span.counts(delivered, skipped, failures.length);\n span.outcome(failures.length > 0 ? 'failed' : delivered > 0 ? 'delivered' : skipped > 0 ? 'skipped' : 'no_targets');\n return failures;\n}\n\n/**\n * Execute once through the service, then publish best-effort hints only for a\n * committed mutation. Execution errors propagate without publication or retries.\n *\n * @param notifications - Explicit publication policy, or a callback evaluated\n * after a mutation commits to resolve current notification recipients.\n * @returns The unchanged service result and any serializable publication failures,\n * including `channel: 'policy'` if routing resolution or publication setup throws.\n */\nexport async function executeStateMachineFunction<TConfig extends CONFIG, TContext, TOutput = unknown>(\n thread: IThread<TConfig>,\n service: {\n execute: (\n request: ExecuteStateMachineFunctionRequest,\n context: TContext,\n options?: ExecuteStateMachineFunctionOptions,\n ) => Promise<ManagedExecutionResult<TOutput>>;\n },\n request: ExecuteStateMachineFunctionRequest,\n context: TContext,\n notifications: StateChangePublicationOptions | (() => StateChangePublicationOptions) = {},\n executionOptions?: ExecuteStateMachineFunctionOptions,\n): Promise<{ result: ManagedExecutionResult<TOutput>; notificationFailures: NotificationFailure[] }> {\n const result = await service.execute(request, context, executionOptions);\n if (result.kind === 'query') return { result, notificationFailures: [] };\n const identity = { instanceId: result.instance.instance.id, templateId: result.instance.instance.template.id };\n // Reading optional tracing metadata must not suppress post-commit delivery.\n let parentContext: ExecuteStateMachineFunctionOptions['parentContext'];\n try {\n parentContext = executionOptions?.parentContext;\n } catch {\n // Fall back to the host's active context without reporting a routing failure.\n }\n try {\n return {\n result,\n notificationFailures: await withNotificationSpan('notifications.publish', parentContext, (span) => {\n const policy = typeof notifications === 'function' ? notifications() : notifications;\n return publishStateChangeTraced(thread, identity, policy, span);\n }),\n };\n } catch (error) {\n return { result, notificationFailures: [reportNotificationFailure(thread, identity, 'policy', error)] };\n }\n}\n\nexport interface RefreshHint {\n callbackSource?: ChangeSource;\n}\n\n/**\n * Serialize refreshes with one pending invalidation, not a history of snapshots.\n * The most recent eligible hint selects a callback source; disabled sources\n * still invalidate state but cannot erase a pending eligible callback request.\n */\nexport class LatestStateRefresh {\n private pending?: RefreshHint;\n private running?: Promise<void>;\n\n private readonly refresh: (hint: RefreshHint) => Promise<void>;\n\n constructor(refresh: (hint: RefreshHint) => Promise<void>) {\n this.refresh = refresh;\n }\n\n private async drain(): Promise<void> {\n // Yield before starting so synchronous loader failures cannot leave a stale\n // rejected promise assigned after the finally block clears it.\n await Promise.resolve();\n try {\n while (this.pending) {\n const hint = this.pending;\n this.pending = undefined;\n await this.refresh(hint);\n }\n } finally {\n this.running = undefined;\n }\n }\n\n public request(source?: ChangeSource): Promise<void> {\n this.pending = { callbackSource: source ?? this.pending?.callbackSource };\n this.running ??= this.drain();\n return this.running;\n }\n}\n"],"mappings":"oGAiBA,eAAsB,EACpB,EACA,EACA,EACY,CACZ,IAAI,EAA2B,YACzB,EAAO,EAAc,sCAAuC,EAAM,CAAM,EACxE,EAAe,EAAK,QACpB,EAAY,EAAK,aACjB,EAAQ,CACZ,QAAS,EACT,QAAU,GAAqB,CAC7B,EAAkB,EAClB,EAAU,qCAAsC,CAAO,EACnD,IAAY,SACd,EAAK,KAAK,IAAS,wBAA0B,gCAAkC,8BAA8B,EACtG,IAAY,iBAAiB,EAAK,KAAK,4BAA4B,CAC9E,EACA,QAAS,EAAmB,EAAiB,IAAqB,CAChE,EAAU,6CAA8C,CAAS,EACjE,EAAU,2CAA4C,CAAO,EAC7D,EAAU,2CAA4C,CAAQ,CAChE,EACA,eAAiB,GACf,EAAK,SAAS,+BAAgC,CAAE,qCAAsC,CAAQ,CAAC,CACnG,EACI,IAAS,wBAAyB,EAAM,OAAO,EAAG,EAAG,CAAC,EACrD,EAAU,qCAAsC,IAAS,sBAAwB,QAAU,QAAQ,EACxG,GAAI,CACF,OAAO,MAAM,EAAU,MAAoB,EAAU,CAAK,CAAC,CAC7D,OAAS,EAAO,CAMd,MALI,IAAS,yBACX,EAAM,QAAQ,eAAe,EAC7B,EAAU,2CAA4C,CAAC,EACvD,EAAK,SAAS,4BAA4B,GACrC,EAAM,QAAQ,QAAQ,EACvB,CACR,QAAU,CAEJ,IAAS,wBACX,EACE,sCACA,0CACA,gBACA,EACA,CAAE,QAAS,CAAgB,EAC3B,CACF,EAEA,EACE,sCACA,wCACA,aACA,EACA,CACE,QAAS,IAAS,sBAAwB,QAAU,SACpD,QAAS,CACX,EACA,CACF,EAEF,EAAK,IAAI,CACX,CACF,CC/CA,MAAa,EAA6B,UAC7B,EAAwB,SAK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ACA,QAEA,QAEA,YAAY,EAA+C,CACzD,KAAK,QAAU,CACjB,CAEA,MAAc,OAAuB,CAGnC,MAAM,QAAQ,QAAQ,EACtB,GAAI,CACF,KAAO,KAAK,SAAS,CACnB,IAAM,EAAO,KAAK,QAClB,KAAK,QAAU,IAAA,GACf,MAAM,KAAK,QAAQ,CAAI,CACzB,CACF,QAAU,CACR,KAAK,QAAU,IAAA,EACjB,CACF,CAEA,QAAe,EAAsC,CAGnD,MAFA,MAAK,QAAU,CAAE,eAAgB,GAAU,KAAK,SAAS,cAAe,EACxE,KAAK,UAAY,KAAK,MAAM,EACrB,KAAK,OACd,CACF"}
@@ -0,0 +1,20 @@
1
+ //#region src/configuration/otel.d.mts
2
+ /**
3
+ * Serializable parent propagation data, or an explicitly empty tracing input.
4
+ * A tracestate without a traceparent is not meaningful.
5
+ */
6
+ type OtelInput = {
7
+ traceparent?: never;
8
+ tracestate?: never;
9
+ } | {
10
+ traceparent: string;
11
+ tracestate?: string;
12
+ };
13
+ /**
14
+ * Copy tracing fields without rejecting an otherwise valid step invocation.
15
+ * Wire-format validity is checked during extraction, not configuration parsing.
16
+ */
17
+ declare function normalizeOtelInput(value: unknown): OtelInput;
18
+ //#endregion
19
+ export { normalizeOtelInput as n, OtelInput as t };
20
+ //# sourceMappingURL=otel-Bj0Y2NBb.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otel-Bj0Y2NBb.d.mts","names":[],"sources":["../src/configuration/otel.mts"],"mappings":";;;;;KAIY;EAAc;EAAqB;;EAAyB;EAAqB;;;;;;iBAM7E,mBAAmB,iBAAiB"}
@@ -0,0 +1,11 @@
1
+ import { t as OtelInput } from "./otel-Bj0Y2NBb.mjs";
2
+ import { Context } from "@opentelemetry/api";
3
+ //#region src/telemetry/index.d.ts
4
+ /**
5
+ * Extract an explicit remote parent without capturing ambient invocation context.
6
+ * Undefined means the service should inherit its host's active context as usual.
7
+ */
8
+ declare function extractOtelParentContext(otel?: OtelInput): Context | undefined;
9
+ //#endregion
10
+ export { extractOtelParentContext };
11
+ //# sourceMappingURL=telemetry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.d.mts","names":[],"sources":["../src/telemetry/index.ts"],"mappings":";;;;;;;iBAUgB,yBAAyB,OAAO,YAAY"}
@@ -0,0 +1,2 @@
1
+ import{ROOT_CONTEXT as e,defaultTextMapGetter as t,diag as n,trace as r}from"@opentelemetry/api";import{W3CTraceContextPropagator as i}from"@opentelemetry/core";function a(a){try{if(!a?.traceparent)return;let n=new i().extract(e,a,t);if(r.getSpanContext(n))return n}catch{}try{n.warn(`Ignoring invalid state-machine otel parent context`)}catch{}}export{a as extractOtelParentContext};
2
+ //# sourceMappingURL=telemetry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.mjs","names":[],"sources":["../src/telemetry/index.ts"],"sourcesContent":["import { defaultTextMapGetter, diag, ROOT_CONTEXT, trace } from '@opentelemetry/api';\nimport type { Context } from '@opentelemetry/api';\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\n\nimport type { OtelInput } from '../configuration/otel.mts';\n\n/**\n * Extract an explicit remote parent without capturing ambient invocation context.\n * Undefined means the service should inherit its host's active context as usual.\n */\nexport function extractOtelParentContext(otel?: OtelInput): Context | undefined {\n try {\n if (!otel?.traceparent) return undefined;\n const extracted = new W3CTraceContextPropagator().extract(ROOT_CONTEXT, otel, defaultTextMapGetter);\n if (trace.getSpanContext(extracted)) return extracted;\n } catch {\n // Provider/propagator failures must not become application failures.\n }\n try {\n diag.warn('Ignoring invalid state-machine otel parent context');\n } catch {\n // Diagnostics are also best effort; never include the supplied header values.\n }\n return undefined;\n}\n"],"mappings":"iKAUA,SAAgB,EAAyB,EAAuC,CAC9E,GAAI,CACF,GAAI,CAAC,GAAM,YAAa,OACxB,IAAM,EAAY,IAAI,EAA0B,CAAC,CAAC,QAAQ,EAAc,EAAM,CAAoB,EAClG,GAAI,EAAM,eAAe,CAAS,EAAG,OAAO,CAC9C,MAAQ,CAER,CACA,GAAI,CACF,EAAK,KAAK,oDAAoD,CAChE,MAAQ,CAER,CAEF"}
@@ -8,6 +8,10 @@ interface Config {
8
8
  optionalBooleans: readonly string[];
9
9
  directory: URL;
10
10
  }
11
+ /**
12
+ * Verify the union-shaped otel field and non-fatal tracing normalization.
13
+ */
14
+ declare function otelDataInTests(config: Pick<Config, 'parse' | 'base' | 'directory'>): void;
11
15
  /**
12
16
  * Shared step-configuration guarantees; step-specific normalization has its own tests.
13
17
  */
@@ -24,5 +28,5 @@ type Filter = (error: unknown, options?: {
24
28
  */
25
29
  declare function errorFilterTests(filter: Filter): void;
26
30
  //#endregion
27
- export { dataInTests, errorFilterTests };
31
+ export { dataInTests, errorFilterTests, otelDataInTests };
28
32
  //# sourceMappingURL=testing.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.mts","names":[],"sources":["../src/testing/data-in.mts","../src/testing/error-filter.mts"],"mappings":";UAcU;EACR,QAAQ;EACR,SAAS,mBAAmB;EAC5B,MAAM;EACN;EACA;EACA;EACA,WAAW;;;;;iBAMG,YAAY,QAAQ;;;KCR/B,UACH,gBACA;EACE;EACA;EACA,gCAAgC,qBAAqB;MAEpD;;;;iBAKW,iBAAiB,QAAQ"}
1
+ {"version":3,"file":"testing.d.mts","names":[],"sources":["../src/testing/data-in.mts","../src/testing/error-filter.mts"],"mappings":";UAcU;EACR,QAAQ;EACR,SAAS,mBAAmB;EAC5B,MAAM;EACN;EACA;EACA;EACA,WAAW;;;;;iBAMG,gBAAgB,QAAQ,KAAK;;;;iBAkD7B,YAAY,QAAQ;;;KC1D/B,UACH,gBACA;EACE;EACA;EACA,gCAAgC,qBAAqB;MAEpD;;;;iBAKW,iBAAiB,QAAQ"}
package/dist/testing.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{_ as e,a as t,f as n,g as r,h as i,l as a,m as o,o as s,p as c,s as l,t as u}from"./system-CZS-gIFs.mjs";import{t as d}from"./data-in-DT43edEv.mjs";import{createRequire as f}from"node:module";import{execFile as p}from"node:child_process";import{cp as m,mkdir as h,mkdtemp as g,readFile as _,rm as v,writeFile as y}from"node:fs/promises";import b from"node:path";import{tmpdir as x}from"node:os";import{fileURLToPath as S}from"node:url";import{promisify as C}from"node:util";import{describe as w,expect as T,expectTypeOf as E,it as D}from"vitest";const O=C(p),k=f(import.meta.url);function A(e){let{parse:t,filter:n,base:r,identifiers:i,required:a,optionalBooleans:o,directory:s}=e,c=e=>t(e);w(`AOT step configuration`,()=>{D.each([null,void 0,[],0,!1,`config`])(`rejects invalid root shapes: %j`,e=>{T(()=>t(e)).toThrow(d)}),D.each(a)(`requires %s without applying defaults`,e=>{let n={...r};delete n[e];try{throw t(n),Error(`Expected validation failure`)}catch(t){T(t).toBeInstanceOf(d),T(t.issues).toEqual(T.arrayContaining([T.objectContaining({path:`/${e}`})]))}}),D.each(i)(`normalizes and validates %s without mutating input`,e=>{let n=Object.freeze({...r,[e]:` identifier `});T(c(n)[e]).toBe(`identifier`),T(n[e]).toBe(` identifier `),T(c({...r,[e]:`a`.repeat(64)})[e]).toHaveLength(64);for(let n of[null,1,!1,` `,`undefined`,` null `,`a`.repeat(65),`😀`.repeat(33)])T(()=>t({...r,[e]:n}),`${e}: ${String(n)}`).toThrow(d)}),D(`trims timeout text without interpreting or coercing it`,()=>{T(c({...r,timeoutDuration:` 5 seconds `}).timeoutDuration).toBe(`5 seconds`),T(c({...r,timeoutDuration:`not-a-duration`}).timeoutDuration).toBe(`not-a-duration`);for(let e of[``,` `,`null`,`undefined`,100,null])T(()=>t({...r,timeoutDuration:e})).toThrow(d)}),D.each([`processError`,`processTimeout`,...o])(`does not coerce %s`,e=>{T(c({...r,[e]:!1})[e]).toBe(!1),T(()=>t({...r,[e]:`false`})).toThrow(d),T(()=>t({...r,[e]:null})).toThrow(d)}),D(`strips unknown fields without invoking their getters`,()=>{let e={...r};Object.defineProperty(e,"extra",{enumerable:!0,get(){throw Error(`Unknown getter must not run`)}}),T(c(e)).not.toHaveProperty(`extra`);for(let e of o)T(c(r)).not.toHaveProperty(e)}),D(`strips legacy test settings like other unknown configuration without reading getters`,()=>{for(let e of[void 0,null,[],!1,0,{cache:null}])T(c({...r,_testSettings:e})).not.toHaveProperty(`_testSettings`);T(c(r)).not.toHaveProperty(`_testSettings`);let e={...r};Object.defineProperty(e,"_testSettings",{enumerable:!0,get(){throw Error(`Unknown test-settings getter must not run`)}}),T(c(e)).not.toHaveProperty(`_testSettings`)}),D(`classifies parser failures as validation errors with stable issue snapshots`,()=>{let e;try{t({...r,timeoutDuration:1})}catch(t){e=t}T(e).toBeInstanceOf(d);let i=structuredClone(e.issues);T(()=>t({})).toThrow(d),T(e.issues).toEqual(i);let a=n(e);T(a).toMatchObject({code:`VALIDATION`,cause:e,data:{issues:i}}),T(a.message).toContain(`/timeoutDuration`)}),D(`ships no schema-builder or engine imports in JavaScript or declarations`,async()=>{for(let e of[`index.mjs`,`index.d.mts`]){let t=await _(new URL(`dist/${e}`,s),`utf8`);T(t).not.toMatch(/\b(?:from|import)\s*['"](?:zod|@sinclair\/typebox|ajv)(?:\/[^'"]*)?['"]/u)}let e=JSON.parse(await _(new URL(`generated/data-in.json`,s),`utf8`));T(e).toMatchObject({$schema:`https://json-schema.org/draft/2020-12/schema`,type:`object`,additionalProperties:!1}),T(e.properties).not.toHaveProperty(`_testSettings`)}),D(`preserves field descriptions and examples and validates complete configuration examples`,async()=>{let e=JSON.parse(await _(new URL(`generated/data-in.json`,s),`utf8`)),n=await _(new URL(`generated/data-in.d.mts`,s),`utf8`),r=e=>{let t=Object.values(e.properties??{});for(let e of t)T(e.description).toEqual(T.any(String)),T(e.description?.trim().length).toBeGreaterThan(0),T(e.examples?.length).toBeGreaterThan(0),T(n).toContain(e.description),r(e);let i=e.anyOf??[];for(let e of i)r(e);e.items&&r(e.items)};r(e),T(e.description?.length).toBeGreaterThan(0),T(e.examples?.length).toBeGreaterThan(0);let{isValid:i}=await import(new URL(`generated/data-in.mjs`,s).href),a=e.examples??[];for(let e of a)T(i(e)).toBe(!0),T(()=>t(e)).not.toThrow()}),D(`runs and typechecks generated validation without engines or runtime code generation`,async()=>{let e=b.join(x(),`opencode`);await h(e,{recursive:!0});let t=await g(b.join(e,`step-aot-`));try{await m(new URL(`generated/data-in.mjs`,s),b.join(t,`data-in.mjs`)),await m(new URL(`generated/data-in.d.mts`,s),b.join(t,`data-in.d.mts`)),await y(b.join(t,`runtime.mjs`),`
1
+ import{_ as e,a as t,f as n,g as r,h as i,l as a,m as o,o as s,p as c,s as l,t as u}from"./system-CZS-gIFs.mjs";import{t as d}from"./data-in-DT43edEv.mjs";import{createRequire as f}from"node:module";import{execFile as p}from"node:child_process";import{cp as m,mkdir as h,mkdtemp as g,readFile as _,rm as v,writeFile as y}from"node:fs/promises";import b from"node:path";import{tmpdir as x}from"node:os";import{fileURLToPath as S}from"node:url";import{promisify as C}from"node:util";import{describe as w,expect as T,expectTypeOf as E,it as D}from"vitest";const O=C(p),k=f(import.meta.url);function A(e){let{parse:t,base:n,directory:r}=e,i=`00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01`,a=e=>t(e);w(`otel Data In`,()=>{D(`preserves optional empty or parent input without mutating caller data`,()=>{T(a(n)).not.toHaveProperty(`otel`);for(let e of[{},{traceparent:i},{traceparent:i,tracestate:`vendor=value`}]){Object.freeze(e);let t=a(Object.freeze({...n,otel:e}));T(t.otel).toEqual(e),T(t.otel).not.toBe(e)}}),D(`ignores malformed tracing fields without rejecting application configuration`,()=>{for(let e of[void 0,null,[],!1,`span`,{tracestate:`vendor=value`},{traceparent:void 0},{traceparent:12},{traceparent:``}])T(a({...n,otel:e}).otel).toEqual({});T(a({...n,otel:{traceparent:`invalid`}}).otel).toEqual({traceparent:`invalid`}),T(a({...n,otel:{traceparent:i,tracestate:!1,baggage:`secret`}}).otel).toEqual({traceparent:i})}),D(`authors a strict portable empty-or-parent union independently of normalization`,async()=>{let{isValid:e}=await import(new URL(`generated/data-in.mjs`,r).href);T(e({...n,otel:{}})).toBe(!0),T(e({...n,otel:{traceparent:i}})).toBe(!0),T(e({...n,otel:{traceparent:i,tracestate:`vendor=value`}})).toBe(!0),T(e({...n,otel:{tracestate:`vendor=value`}})).toBe(!1),T(e({...n,otel:{traceparent:123}})).toBe(!1),T(e({...n,otel:{traceparent:i,baggage:`secret`}})).toBe(!1)})})}function j(e){let{parse:t,filter:n,base:r,identifiers:i,required:a,optionalBooleans:o,directory:s}=e,c=e=>t(e);w(`AOT step configuration`,()=>{D.each([null,void 0,[],0,!1,`config`])(`rejects invalid root shapes: %j`,e=>{T(()=>t(e)).toThrow(d)}),D.each(a)(`requires %s without applying defaults`,e=>{let n={...r};delete n[e];try{throw t(n),Error(`Expected validation failure`)}catch(t){T(t).toBeInstanceOf(d),T(t.issues).toEqual(T.arrayContaining([T.objectContaining({path:`/${e}`})]))}}),D.each(i)(`normalizes and validates %s without mutating input`,e=>{let n=Object.freeze({...r,[e]:` identifier `});T(c(n)[e]).toBe(`identifier`),T(n[e]).toBe(` identifier `),T(c({...r,[e]:`a`.repeat(64)})[e]).toHaveLength(64);for(let n of[null,1,!1,` `,`undefined`,` null `,`a`.repeat(65),`😀`.repeat(33)])T(()=>t({...r,[e]:n}),`${e}: ${String(n)}`).toThrow(d)}),D(`trims timeout text without interpreting or coercing it`,()=>{T(c({...r,timeoutDuration:` 5 seconds `}).timeoutDuration).toBe(`5 seconds`),T(c({...r,timeoutDuration:`not-a-duration`}).timeoutDuration).toBe(`not-a-duration`);for(let e of[``,` `,`null`,`undefined`,100,null])T(()=>t({...r,timeoutDuration:e})).toThrow(d)}),D.each([`processError`,`processTimeout`,...o])(`does not coerce %s`,e=>{T(c({...r,[e]:!1})[e]).toBe(!1),T(()=>t({...r,[e]:`false`})).toThrow(d),T(()=>t({...r,[e]:null})).toThrow(d)}),D(`strips unknown fields without invoking their getters`,()=>{let e={...r};Object.defineProperty(e,"extra",{enumerable:!0,get(){throw Error(`Unknown getter must not run`)}}),T(c(e)).not.toHaveProperty(`extra`);for(let e of o)T(c(r)).not.toHaveProperty(e)}),D(`strips legacy test settings like other unknown configuration without reading getters`,()=>{for(let e of[void 0,null,[],!1,0,{cache:null}])T(c({...r,_testSettings:e})).not.toHaveProperty(`_testSettings`);T(c(r)).not.toHaveProperty(`_testSettings`);let e={...r};Object.defineProperty(e,"_testSettings",{enumerable:!0,get(){throw Error(`Unknown test-settings getter must not run`)}}),T(c(e)).not.toHaveProperty(`_testSettings`)}),D(`classifies parser failures as validation errors with stable issue snapshots`,()=>{let e;try{t({...r,timeoutDuration:1})}catch(t){e=t}T(e).toBeInstanceOf(d);let i=structuredClone(e.issues);T(()=>t({})).toThrow(d),T(e.issues).toEqual(i);let a=n(e);T(a).toMatchObject({code:`VALIDATION`,cause:e,data:{issues:i}}),T(a.message).toContain(`/timeoutDuration`)}),D(`ships no schema-builder or engine imports in JavaScript or declarations`,async()=>{for(let e of[`index.mjs`,`index.d.mts`]){let t=await _(new URL(`dist/${e}`,s),`utf8`);T(t).not.toMatch(/\b(?:from|import)\s*['"](?:zod|@sinclair\/typebox|ajv)(?:\/[^'"]*)?['"]/u)}let e=JSON.parse(await _(new URL(`generated/data-in.json`,s),`utf8`));T(e).toMatchObject({$schema:`https://json-schema.org/draft/2020-12/schema`,type:`object`,additionalProperties:!1}),T(e.properties).not.toHaveProperty(`_testSettings`)}),D(`preserves field descriptions and examples and validates complete configuration examples`,async()=>{let e=JSON.parse(await _(new URL(`generated/data-in.json`,s),`utf8`)),n=await _(new URL(`generated/data-in.d.mts`,s),`utf8`),r=e=>{let t=Object.values(e.properties??{});for(let e of t)T(e.description).toEqual(T.any(String)),T(e.description?.trim().length).toBeGreaterThan(0),T(e.examples?.length).toBeGreaterThan(0),T(n).toContain(e.description),r(e);let i=e.anyOf??[];for(let e of i)r(e);e.items&&r(e.items)};r(e),T(e.description?.length).toBeGreaterThan(0),T(e.examples?.length).toBeGreaterThan(0);let{isValid:i}=await import(new URL(`generated/data-in.mjs`,s).href),a=e.examples??[];for(let e of a)T(i(e)).toBe(!0),T(()=>t(e)).not.toThrow()}),D(`runs and typechecks generated validation without engines or runtime code generation`,async()=>{let e=b.join(x(),`opencode`);await h(e,{recursive:!0});let t=await g(b.join(e,`step-aot-`));try{await m(new URL(`generated/data-in.mjs`,s),b.join(t,`data-in.mjs`)),await m(new URL(`generated/data-in.d.mts`,s),b.join(t,`data-in.d.mts`)),await y(b.join(t,`runtime.mjs`),`
2
2
  import assert from 'node:assert/strict';
3
3
  import { isValid, validate } from './data-in.mjs';
4
4
  assert.equal(isValid(${JSON.stringify(r)}), true);
@@ -35,5 +35,5 @@ await assert.rejects(generateStepSchema({...schema, unsupportedKeyword: true}, d
35
35
  assert.equal(await readFile(file, 'utf8'), before);
36
36
  await generateStepSchema({...schema, properties: {name: {type: 'boolean'}}}, directory);
37
37
  assert.notEqual(await readFile(file, 'utf8'), before);
38
- `;await O(process.execPath,[`--input-type=module`,`--eval`,e],{cwd:S(s)})}finally{await v(t,{recursive:!0,force:!0})}})})}function j(f){w(`framework error filtering`,()=>{D(`restricts step error codes and fallback overrides to the shared string union`,()=>{E().toEqualTypeOf(),E().toEqualTypeOf(),E().toExtend(),E().not.toExtend()});let p=[[new c(`instance:missing`),`NOT_FOUND`,{resource:`instance:missing`}],[new l(`missing`),`NOT_FOUND`,{functionName:`missing`}],[new t(`slow`,100),`TIMEOUT`,{functionName:`slow`,timeoutMs:100}],[new o(`old`,`new`),`CONFLICT`,{expected:`old`,actual:`new`}],[new o(null,void 0),`CONFLICT`,{expected:null,actual:void 0}],[new o(void 0,`new`),`CONFLICT`,{expected:void 0,actual:`new`}],[new i(`old`,`new`),`CONFLICT`,{expected:`old`,actual:`new`}],[new n(`watch`),`UNSUPPORTED`,{capability:`watch`}],[new e(`none`),`UNSUPPORTED`,{concurrency:`none`}],[new r(`/state/value`,`unsupported value`),`VALIDATION`,{path:`/state/value`}],...[`cache`,`storageScope`].map(e=>[new a(e),`CONFIGURATION`,{option:e}])];D.each(p)(`classifies %s as %s with structured details`,(e,t,n)=>{let r=f(e,{unknownMessage:`Fallback`,unknownCode:`SERVER_ERROR`});T(r).toMatchObject({code:t,cause:e,data:n}),T(r.message).toContain(e.message),T(f(r)).toBe(r)}),D(`reports contract issues, including root paths`,()=>{let e=[{path:`/instance/id`,message:`must not be empty`},{path:``,message:`Invalid root`}],t=new u(e),n=f(t);T(n).toMatchObject({code:`VALIDATION`,cause:t,data:{issues:e}}),T(n.message).toContain(`/instance/id: must not be empty`),T(n.message).toContain(`/: Invalid root`)}),D.each([`input`,`output`,`state-before`,`state-after`,`initial-state`])(`reports %s validation with escaped pointers and unchanged issues`,e=>{let t=[{message:`Invalid root`},{path:[],message:`Invalid empty path`},{path:[`a/b`,`~key`,`0`,``],message:`Invalid value`},{path:[{key:`a/b`},0,Symbol(`key`)],message:`Invalid structured path`}],n=new s(e,t),r=f(n);T(r).toMatchObject({code:`VALIDATION`,cause:n,data:{target:e,issues:t}}),T(r.message).toContain(n.message),T(r.message).toContain(`/: Invalid root`),T(r.message).toContain(`/: Invalid empty path`),T(r.message).toContain(`/a~1b/~0key/0/: Invalid value`),T(r.message).toContain(`/a~1b/0/Symbol(key): Invalid structured path`)}),D(`handles empty validation issue arrays`,()=>{for(let e of[new u([]),new s(`input`,[])])T(f(e)).toMatchObject({code:`VALIDATION`,cause:e,message:T.stringContaining(e.message),data:{issues:[]}})}),D(`retains local configuration validation`,()=>{let e=new d([{path:`/stateId`,message:`Required`}]);T(f(e)).toMatchObject({code:`VALIDATION`,cause:e,message:T.stringContaining(e.message),data:{issues:e.issues}})}),D(`does not classify lookalike errors by name or message`,()=>{class e extends Error{name=`UnknownFunctionError`}let t=new e(`Unknown state-machine function: missing`);T(f(t)).toMatchObject({code:`UNKNOWN`,message:T.stringContaining(`Unknown error`),cause:t})}),D(`allows explicit preservation before framework classification`,()=>{let e=new c(`missing`);T(f(e,{preserveErrors:[Error]})).toBe(e)}),D(`retains unknown-error overrides and non-error payloads`,()=>{let e=Error(`Unexpected failure`);T(f(e,{unknownMessage:`Fallback`,unknownCode:`SERVER_ERROR`})).toMatchObject({code:`SERVER_ERROR`,message:T.stringContaining(`Fallback`),cause:e});for(let e of[null,void 0,42,{name:`NotFoundError`,resource:`missing`}])T(f(e)).toMatchObject({code:`UNKNOWN`,message:`Unknown error`,data:e});T(f(`Failure`)).toMatchObject({code:`UNKNOWN`,message:`Failure`})}),D(`retains legacy SDK timeout and server-response classification`,()=>{let e=Error(`Request timed out`);T(f(e)).toMatchObject({code:`TIMEOUT`,cause:e});let t=Object.assign(Error(`Request failed`),{response:{data:{error:{message:`Server failure`}}}});T(f(t)).toMatchObject({code:`SERVER_ERROR`,message:T.stringContaining(`Server failure`),cause:t})})})}export{A as dataInTests,j as errorFilterTests};
38
+ `;await O(process.execPath,[`--input-type=module`,`--eval`,e],{cwd:S(s)})}finally{await v(t,{recursive:!0,force:!0})}})})}function M(f){w(`framework error filtering`,()=>{D(`restricts step error codes and fallback overrides to the shared string union`,()=>{E().toEqualTypeOf(),E().toEqualTypeOf(),E().toExtend(),E().not.toExtend()});let p=[[new c(`instance:missing`),`NOT_FOUND`,{resource:`instance:missing`}],[new l(`missing`),`NOT_FOUND`,{functionName:`missing`}],[new t(`slow`,100),`TIMEOUT`,{functionName:`slow`,timeoutMs:100}],[new o(`old`,`new`),`CONFLICT`,{expected:`old`,actual:`new`}],[new o(null,void 0),`CONFLICT`,{expected:null,actual:void 0}],[new o(void 0,`new`),`CONFLICT`,{expected:void 0,actual:`new`}],[new i(`old`,`new`),`CONFLICT`,{expected:`old`,actual:`new`}],[new n(`watch`),`UNSUPPORTED`,{capability:`watch`}],[new e(`none`),`UNSUPPORTED`,{concurrency:`none`}],[new r(`/state/value`,`unsupported value`),`VALIDATION`,{path:`/state/value`}],...[`cache`,`storageScope`].map(e=>[new a(e),`CONFIGURATION`,{option:e}])];D.each(p)(`classifies %s as %s with structured details`,(e,t,n)=>{let r=f(e,{unknownMessage:`Fallback`,unknownCode:`SERVER_ERROR`});T(r).toMatchObject({code:t,cause:e,data:n}),T(r.message).toContain(e.message),T(f(r)).toBe(r)}),D(`reports contract issues, including root paths`,()=>{let e=[{path:`/instance/id`,message:`must not be empty`},{path:``,message:`Invalid root`}],t=new u(e),n=f(t);T(n).toMatchObject({code:`VALIDATION`,cause:t,data:{issues:e}}),T(n.message).toContain(`/instance/id: must not be empty`),T(n.message).toContain(`/: Invalid root`)}),D.each([`input`,`output`,`state-before`,`state-after`,`initial-state`])(`reports %s validation with escaped pointers and unchanged issues`,e=>{let t=[{message:`Invalid root`},{path:[],message:`Invalid empty path`},{path:[`a/b`,`~key`,`0`,``],message:`Invalid value`},{path:[{key:`a/b`},0,Symbol(`key`)],message:`Invalid structured path`}],n=new s(e,t),r=f(n);T(r).toMatchObject({code:`VALIDATION`,cause:n,data:{target:e,issues:t}}),T(r.message).toContain(n.message),T(r.message).toContain(`/: Invalid root`),T(r.message).toContain(`/: Invalid empty path`),T(r.message).toContain(`/a~1b/~0key/0/: Invalid value`),T(r.message).toContain(`/a~1b/0/Symbol(key): Invalid structured path`)}),D(`handles empty validation issue arrays`,()=>{for(let e of[new u([]),new s(`input`,[])])T(f(e)).toMatchObject({code:`VALIDATION`,cause:e,message:T.stringContaining(e.message),data:{issues:[]}})}),D(`retains local configuration validation`,()=>{let e=new d([{path:`/stateId`,message:`Required`}]);T(f(e)).toMatchObject({code:`VALIDATION`,cause:e,message:T.stringContaining(e.message),data:{issues:e.issues}})}),D(`does not classify lookalike errors by name or message`,()=>{class e extends Error{name=`UnknownFunctionError`}let t=new e(`Unknown state-machine function: missing`);T(f(t)).toMatchObject({code:`UNKNOWN`,message:T.stringContaining(`Unknown error`),cause:t})}),D(`allows explicit preservation before framework classification`,()=>{let e=new c(`missing`);T(f(e,{preserveErrors:[Error]})).toBe(e)}),D(`retains unknown-error overrides and non-error payloads`,()=>{let e=Error(`Unexpected failure`);T(f(e,{unknownMessage:`Fallback`,unknownCode:`SERVER_ERROR`})).toMatchObject({code:`SERVER_ERROR`,message:T.stringContaining(`Fallback`),cause:e});for(let e of[null,void 0,42,{name:`NotFoundError`,resource:`missing`}])T(f(e)).toMatchObject({code:`UNKNOWN`,message:`Unknown error`,data:e});T(f(`Failure`)).toMatchObject({code:`UNKNOWN`,message:`Failure`})}),D(`retains legacy SDK timeout and server-response classification`,()=>{let e=Error(`Request timed out`);T(f(e)).toMatchObject({code:`TIMEOUT`,cause:e});let t=Object.assign(Error(`Request failed`),{response:{data:{error:{message:`Server failure`}}}});T(f(t)).toMatchObject({code:`SERVER_ERROR`,message:T.stringContaining(`Server failure`),cause:t})})})}export{j as dataInTests,M as errorFilterTests,A as otelDataInTests};
39
39
  //# sourceMappingURL=testing.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing.mjs","names":[],"sources":["../src/testing/data-in.mts","../src/testing/error-filter.mts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport { cp, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { createRequire } from 'node:module';\nimport { tmpdir } from 'node:os';\nimport { fileURLToPath } from 'node:url';\nimport { promisify } from 'node:util';\nimport { describe, expect, it } from 'vitest';\n\nimport { DataInValidationError } from '../configuration/data-in.mts';\n\nconst execute = promisify(execFile);\nconst require = createRequire(import.meta.url);\n\ninterface Config {\n parse: (value: unknown) => unknown;\n filter: (error: unknown) => Error;\n base: Record<string, unknown>;\n identifiers: readonly string[];\n required: readonly string[];\n optionalBooleans: readonly string[];\n directory: URL;\n}\n\n/**\n * Shared step-configuration guarantees; step-specific normalization has its own tests.\n */\nexport function dataInTests(config: Config): void {\n const { parse, filter, base, identifiers, required, optionalBooleans, directory } = config;\n const parsed = (value: unknown) => parse(value) as Record<string, unknown>;\n\n describe('AOT step configuration', () => {\n it.each([null, undefined, [], 0, false, 'config'])('rejects invalid root shapes: %j', (value) => {\n expect(() => parse(value)).toThrow(DataInValidationError);\n });\n\n it.each(required)('requires %s without applying defaults', (field) => {\n const value = { ...base };\n delete value[field];\n try {\n parse(value);\n throw new Error('Expected validation failure');\n } catch (error) {\n expect(error).toBeInstanceOf(DataInValidationError);\n expect((error as DataInValidationError).issues).toEqual(\n expect.arrayContaining([expect.objectContaining({ path: `/${field}` })]),\n );\n }\n });\n\n it.each(identifiers)('normalizes and validates %s without mutating input', (field) => {\n const value = Object.freeze({ ...base, [field]: ' identifier ' });\n expect(parsed(value)[field]).toBe('identifier');\n expect(value[field]).toBe(' identifier ');\n expect(parsed({ ...base, [field]: 'a'.repeat(64) })[field]).toHaveLength(64);\n for (const invalid of [null, 1, false, ' ', 'undefined', ' null ', 'a'.repeat(65), '😀'.repeat(33)]) {\n expect(() => parse({ ...base, [field]: invalid }), `${field}: ${String(invalid)}`).toThrow(\n DataInValidationError,\n );\n }\n });\n\n it('trims timeout text without interpreting or coercing it', () => {\n expect(parsed({ ...base, timeoutDuration: ' 5 seconds ' }).timeoutDuration).toBe('5 seconds');\n expect(parsed({ ...base, timeoutDuration: 'not-a-duration' }).timeoutDuration).toBe('not-a-duration');\n for (const timeoutDuration of ['', ' ', 'null', 'undefined', 100, null])\n expect(() => parse({ ...base, timeoutDuration })).toThrow(DataInValidationError);\n });\n\n it.each(['processError', 'processTimeout', ...optionalBooleans])('does not coerce %s', (field) => {\n expect(parsed({ ...base, [field]: false })[field]).toBe(false);\n expect(() => parse({ ...base, [field]: 'false' })).toThrow(DataInValidationError);\n expect(() => parse({ ...base, [field]: null })).toThrow(DataInValidationError);\n });\n\n it('strips unknown fields without invoking their getters', () => {\n const value = { ...base };\n Object.defineProperty(value, 'extra', {\n enumerable: true,\n get() {\n throw new Error('Unknown getter must not run');\n },\n });\n expect(parsed(value)).not.toHaveProperty('extra');\n for (const field of optionalBooleans) expect(parsed(base)).not.toHaveProperty(field);\n });\n\n it('strips legacy test settings like other unknown configuration without reading getters', () => {\n for (const settings of [undefined, null, [], false, 0, { cache: null }]) {\n expect(parsed({ ...base, _testSettings: settings })).not.toHaveProperty('_testSettings');\n }\n expect(parsed(base)).not.toHaveProperty('_testSettings');\n const value = { ...base };\n Object.defineProperty(value, '_testSettings', {\n enumerable: true,\n get() {\n throw new Error('Unknown test-settings getter must not run');\n },\n });\n expect(parsed(value)).not.toHaveProperty('_testSettings');\n });\n\n it('classifies parser failures as validation errors with stable issue snapshots', () => {\n let first: unknown;\n try {\n parse({ ...base, timeoutDuration: 1 });\n } catch (error) {\n first = error;\n }\n expect(first).toBeInstanceOf(DataInValidationError);\n const issues = structuredClone((first as DataInValidationError).issues);\n expect(() => parse({})).toThrow(DataInValidationError);\n expect((first as DataInValidationError).issues).toEqual(issues);\n const filtered = filter(first);\n expect(filtered).toMatchObject({ code: 'VALIDATION', cause: first, data: { issues } });\n expect(filtered.message).toContain('/timeoutDuration');\n });\n\n it('ships no schema-builder or engine imports in JavaScript or declarations', async () => {\n for (const file of ['index.mjs', 'index.d.mts']) {\n const content = await readFile(new URL(`dist/${file}`, directory), 'utf8');\n expect(content).not.toMatch(/\\b(?:from|import)\\s*['\"](?:zod|@sinclair\\/typebox|ajv)(?:\\/[^'\"]*)?['\"]/u);\n }\n const schema = JSON.parse(await readFile(new URL('generated/data-in.json', directory), 'utf8'));\n expect(schema).toMatchObject({\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n type: 'object',\n additionalProperties: false,\n });\n expect(schema.properties).not.toHaveProperty('_testSettings');\n });\n\n it('preserves field descriptions and examples and validates complete configuration examples', async () => {\n interface Schema {\n description?: string;\n examples?: unknown[];\n properties?: Record<string, Schema>;\n anyOf?: Schema[];\n items?: Schema;\n }\n const schema = JSON.parse(await readFile(new URL('generated/data-in.json', directory), 'utf8')) as Schema;\n const declarations = await readFile(new URL('generated/data-in.d.mts', directory), 'utf8');\n const checkFields = (node: Schema): void => {\n const properties = Object.values(node.properties ?? {});\n for (const property of properties) {\n expect(property.description).toEqual(expect.any(String));\n expect(property.description?.trim().length).toBeGreaterThan(0);\n expect(property.examples?.length).toBeGreaterThan(0);\n expect(declarations).toContain(property.description);\n checkFields(property);\n }\n const branches = node.anyOf ?? [];\n for (const branch of branches) checkFields(branch);\n if (node.items) checkFields(node.items);\n };\n checkFields(schema);\n expect(schema.description?.length).toBeGreaterThan(0);\n expect(schema.examples?.length).toBeGreaterThan(0);\n const { isValid } = (await import(new URL('generated/data-in.mjs', directory).href)) as {\n isValid: (value: unknown) => boolean;\n };\n const examples = schema.examples ?? [];\n for (const example of examples) {\n expect(isValid(example)).toBe(true);\n expect(() => parse(example)).not.toThrow();\n }\n });\n\n it('runs and typechecks generated validation without engines or runtime code generation', async () => {\n const parent = path.join(tmpdir(), 'opencode');\n await mkdir(parent, { recursive: true });\n const temporary = await mkdtemp(path.join(parent, 'step-aot-'));\n try {\n await cp(new URL('generated/data-in.mjs', directory), path.join(temporary, 'data-in.mjs'));\n await cp(new URL('generated/data-in.d.mts', directory), path.join(temporary, 'data-in.d.mts'));\n await writeFile(\n path.join(temporary, 'runtime.mjs'),\n `\nimport assert from 'node:assert/strict';\nimport { isValid, validate } from './data-in.mjs';\nassert.equal(isValid(${JSON.stringify(base)}), true);\nassert.equal(validate({}).valid, false);\nassert.equal(isValid({...${JSON.stringify(base)}, timeoutDuration: 1}), false);\n`,\n );\n await execute(process.execPath, ['--disallow-code-generation-from-strings', 'runtime.mjs'], { cwd: temporary });\n await writeFile(\n path.join(temporary, 'consumer.mts'),\n `\nimport type { DataInConfig } from './data-in.mjs';\nimport { isValid } from './data-in.mjs';\nconst value: DataInConfig = ${JSON.stringify(base)};\ndeclare const raw: unknown;\nif (isValid(raw)) { const timeout: string = raw.timeoutDuration; void timeout; }\nvoid value;\n`,\n );\n await writeFile(\n path.join(temporary, 'tsconfig.json'),\n JSON.stringify({\n compilerOptions: {\n noEmit: true,\n strict: true,\n declaration: true,\n types: [],\n module: 'node16',\n target: 'es2022',\n },\n files: ['consumer.mts'],\n }),\n );\n await execute(process.execPath, [require.resolve('typescript/bin/tsc'), '--project', temporary]);\n } finally {\n await rm(temporary, { recursive: true, force: true });\n }\n });\n\n it('regenerates schemas and preserves previous artifacts when compilation fails', async () => {\n const temporary = new URL('.build/', directory);\n await mkdir(temporary, { recursive: true });\n const work = await mkdtemp(fileURLToPath(new URL('schema-test-', temporary)));\n try {\n const script = `\nimport assert from 'node:assert/strict';\nimport { pathToFileURL } from 'node:url';\nimport { readFile } from 'node:fs/promises';\nimport { generateArtifacts } from '@onereach/json-schema-aot';\nconst directory = pathToFileURL(${JSON.stringify(`${work}/`)});\n// Generate structural configuration artifacts; normalization and SDK values stay local.\nconst generateStepSchema = (authored, directory) => generateArtifacts(\n { DataInConfig: authored },\n {\n outputDirectory: new URL('generated/', directory),\n temporaryDirectory: new URL('.build/', directory),\n fileNames: { DataInConfig: 'data-in' },\n jsonDirectory: '.',\n },\n);\nconst schema = {type: 'object', properties: {name: {type: 'string', minLength: 1}}, required: ['name'], additionalProperties: false};\nawait generateStepSchema(schema, directory);\nconst file = new URL('generated/data-in.mjs', directory);\nconst before = await readFile(file, 'utf8');\nawait assert.rejects(generateStepSchema({...schema, unsupportedKeyword: true}, directory));\nassert.equal(await readFile(file, 'utf8'), before);\nawait generateStepSchema({...schema, properties: {name: {type: 'boolean'}}}, directory);\nassert.notEqual(await readFile(file, 'utf8'), before);\n`;\n await execute(process.execPath, ['--input-type=module', '--eval', script], {\n cwd: fileURLToPath(directory),\n });\n } finally {\n await rm(work, { recursive: true, force: true });\n }\n });\n });\n}\n","import {\n ContractValidationError,\n DriverCapabilityError,\n FunctionTimeoutError,\n NotFoundError,\n RevisionConflictError,\n SchemaValidationError,\n StateMachineConfigError,\n TemplateRevisionMismatchError,\n TemplateSnapshotError,\n UnknownFunctionError,\n UnsafeConcurrencyError,\n} from '../system/index.ts';\nimport { describe, expect, expectTypeOf, it } from 'vitest';\n\nimport { DataInValidationError } from '../configuration/data-in.mts';\nimport type { StepErrorCode } from '../errors/error-code.mts';\nimport type { ErrorFilterOptions, StepErrorDetails } from '../errors/error-filter.mts';\n\ntype Filter = (\n error: unknown,\n options?: {\n unknownMessage?: string;\n unknownCode?: 'SERVER_ERROR';\n preserveErrors?: readonly (new (message?: string) => Error)[];\n },\n) => Error;\n\n/**\n * Both Flow steps must expose the same framework diagnostics and fallback behavior.\n */\nexport function errorFilterTests(filter: Filter): void {\n describe('framework error filtering', () => {\n it('restricts step error codes and fallback overrides to the shared string union', () => {\n expectTypeOf<StepErrorDetails['code']>().toEqualTypeOf<StepErrorCode>();\n expectTypeOf<NonNullable<ErrorFilterOptions<[]>['unknownCode']>>().toEqualTypeOf<StepErrorCode>();\n expectTypeOf<'VALIDATION'>().toExtend<StepErrorCode>();\n expectTypeOf<'VALIDATON'>().not.toExtend<StepErrorCode>();\n });\n\n const cases = [\n [new NotFoundError('instance:missing'), 'NOT_FOUND', { resource: 'instance:missing' }],\n [new UnknownFunctionError('missing'), 'NOT_FOUND', { functionName: 'missing' }],\n [new FunctionTimeoutError('slow', 100), 'TIMEOUT', { functionName: 'slow', timeoutMs: 100 }],\n [new RevisionConflictError('old', 'new'), 'CONFLICT', { expected: 'old', actual: 'new' }],\n [new RevisionConflictError(null, undefined), 'CONFLICT', { expected: null, actual: undefined }],\n [new RevisionConflictError(undefined, 'new'), 'CONFLICT', { expected: undefined, actual: 'new' }],\n [new TemplateRevisionMismatchError('old', 'new'), 'CONFLICT', { expected: 'old', actual: 'new' }],\n [new DriverCapabilityError('watch'), 'UNSUPPORTED', { capability: 'watch' }],\n [new UnsafeConcurrencyError('none'), 'UNSUPPORTED', { concurrency: 'none' }],\n [new TemplateSnapshotError('/state/value', 'unsupported value'), 'VALIDATION', { path: '/state/value' }],\n ...(['cache', 'storageScope'] as const).map(\n (option) => [new StateMachineConfigError(option), 'CONFIGURATION', { option }] as const,\n ),\n ] as const;\n\n it.each(cases)('classifies %s as %s with structured details', (cause, code, data) => {\n const result = filter(cause, { unknownMessage: 'Fallback', unknownCode: 'SERVER_ERROR' });\n expect(result).toMatchObject({ code, cause, data });\n expect(result.message).toContain(cause.message);\n expect(filter(result)).toBe(result);\n });\n\n it('reports contract issues, including root paths', () => {\n const issues = [\n { path: '/instance/id', message: 'must not be empty' },\n { path: '', message: 'Invalid root' },\n ];\n const cause = new ContractValidationError(issues);\n const result = filter(cause);\n expect(result).toMatchObject({ code: 'VALIDATION', cause, data: { issues } });\n expect(result.message).toContain('/instance/id: must not be empty');\n expect(result.message).toContain('/: Invalid root');\n });\n\n it.each(['input', 'output', 'state-before', 'state-after', 'initial-state'] as const)(\n 'reports %s validation with escaped pointers and unchanged issues',\n (target) => {\n const issues = [\n { message: 'Invalid root' },\n { path: [], message: 'Invalid empty path' },\n { path: ['a/b', '~key', '0', ''], message: 'Invalid value' },\n { path: [{ key: 'a/b' }, 0, Symbol('key')], message: 'Invalid structured path' },\n ];\n const cause = new SchemaValidationError(target, issues);\n const result = filter(cause);\n expect(result).toMatchObject({ code: 'VALIDATION', cause, data: { target, issues } });\n expect(result.message).toContain(cause.message);\n expect(result.message).toContain('/: Invalid root');\n expect(result.message).toContain('/: Invalid empty path');\n expect(result.message).toContain('/a~1b/~0key/0/: Invalid value');\n expect(result.message).toContain('/a~1b/0/Symbol(key): Invalid structured path');\n },\n );\n\n it('handles empty validation issue arrays', () => {\n for (const cause of [new ContractValidationError([]), new SchemaValidationError('input', [])]) {\n expect(filter(cause)).toMatchObject({\n code: 'VALIDATION',\n cause,\n message: expect.stringContaining(cause.message),\n data: { issues: [] },\n });\n }\n });\n\n it('retains local configuration validation', () => {\n const cause = new DataInValidationError([{ path: '/stateId', message: 'Required' }]);\n expect(filter(cause)).toMatchObject({\n code: 'VALIDATION',\n cause,\n message: expect.stringContaining(cause.message),\n data: { issues: cause.issues },\n });\n });\n\n it('does not classify lookalike errors by name or message', () => {\n class LookalikeError extends Error {\n override name = 'UnknownFunctionError';\n }\n const cause = new LookalikeError('Unknown state-machine function: missing');\n expect(filter(cause)).toMatchObject({\n code: 'UNKNOWN',\n message: expect.stringContaining('Unknown error'),\n cause,\n });\n });\n\n it('allows explicit preservation before framework classification', () => {\n const cause = new NotFoundError('missing');\n expect(filter(cause, { preserveErrors: [Error] })).toBe(cause);\n });\n\n it('retains unknown-error overrides and non-error payloads', () => {\n const cause = new Error('Unexpected failure');\n expect(filter(cause, { unknownMessage: 'Fallback', unknownCode: 'SERVER_ERROR' })).toMatchObject({\n code: 'SERVER_ERROR',\n message: expect.stringContaining('Fallback'),\n cause,\n });\n for (const data of [null, undefined, 42, { name: 'NotFoundError', resource: 'missing' }]) {\n expect(filter(data)).toMatchObject({ code: 'UNKNOWN', message: 'Unknown error', data });\n }\n expect(filter('Failure')).toMatchObject({ code: 'UNKNOWN', message: 'Failure' });\n });\n\n it('retains legacy SDK timeout and server-response classification', () => {\n const timeout = new Error('Request timed out');\n expect(filter(timeout)).toMatchObject({ code: 'TIMEOUT', cause: timeout });\n const cause = Object.assign(new Error('Request failed'), {\n response: { data: { error: { message: 'Server failure' } } },\n });\n expect(filter(cause)).toMatchObject({\n code: 'SERVER_ERROR',\n message: expect.stringContaining('Server failure'),\n cause,\n });\n });\n });\n}\n"],"mappings":"yiBAWA,MAAM,EAAU,EAAU,CAAQ,EAC5B,EAAU,EAAc,YAAY,GAAG,EAe7C,SAAgB,EAAY,EAAsB,CAChD,GAAM,CAAE,QAAO,SAAQ,OAAM,cAAa,WAAU,mBAAkB,aAAc,EAC9E,EAAU,GAAmB,EAAM,CAAK,EAE9C,EAAS,6BAAgC,CACvC,EAAG,KAAK,CAAC,KAAM,IAAA,GAAW,CAAC,EAAG,EAAG,GAAO,QAAQ,CAAC,CAAC,CAAC,kCAAoC,GAAU,CAC/F,MAAa,EAAM,CAAK,CAAC,CAAC,CAAC,QAAQ,CAAqB,CAC1D,CAAC,EAED,EAAG,KAAK,CAAQ,CAAC,CAAC,wCAA0C,GAAU,CACpE,IAAM,EAAQ,CAAE,GAAG,CAAK,EACxB,OAAO,EAAM,GACb,GAAI,CAEF,MADA,EAAM,CAAK,EACD,MAAM,6BAA6B,CAC/C,OAAS,EAAO,CACd,EAAO,CAAK,CAAC,CAAC,eAAe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AE,KAAM,UAAW,QAAS,SAAU,CAAC,CACjF,CAAC,EAED,EAAG,oEAAuE,CACxE,IAAM,EAAc,MAAM,mBAAmB,EAC7C,EAAO,EAAO,CAAO,CAAC,CAAC,CAAC,cAAc,CAAE,KAAM,UAAW,MAAO,CAAQ,CAAC,EACzE,IAAM,EAAQ,OAAO,OAAW,MAAM,gBAAgB,EAAG,CACvD,SAAU,CAAE,KAAM,CAAE,MAAO,CAAE,QAAS,gBAAiB,CAAE,CAAE,CAC7D,CAAC,EACD,EAAO,EAAO,CAAK,CAAC,CAAC,CAAC,cAAc,CAClC,KAAM,eACN,QAAS,EAAO,iBAAiB,gBAAgB,EACjD,OACF,CAAC,CACH,CAAC,CACH,CAAC,CACH"}
1
+ {"version":3,"file":"testing.mjs","names":[],"sources":["../src/testing/data-in.mts","../src/testing/error-filter.mts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport { cp, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { createRequire } from 'node:module';\nimport { tmpdir } from 'node:os';\nimport { fileURLToPath } from 'node:url';\nimport { promisify } from 'node:util';\nimport { describe, expect, it } from 'vitest';\n\nimport { DataInValidationError } from '../configuration/data-in.mts';\n\nconst execute = promisify(execFile);\nconst require = createRequire(import.meta.url);\n\ninterface Config {\n parse: (value: unknown) => unknown;\n filter: (error: unknown) => Error;\n base: Record<string, unknown>;\n identifiers: readonly string[];\n required: readonly string[];\n optionalBooleans: readonly string[];\n directory: URL;\n}\n\n/**\n * Verify the union-shaped otel field and non-fatal tracing normalization.\n */\nexport function otelDataInTests(config: Pick<Config, 'parse' | 'base' | 'directory'>): void {\n const { parse, base, directory } = config;\n const traceparent = '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01';\n const parsed = (value: unknown) => parse(value) as { otel?: unknown };\n describe('otel Data In', () => {\n it('preserves optional empty or parent input without mutating caller data', () => {\n expect(parsed(base)).not.toHaveProperty('otel');\n for (const otel of [{}, { traceparent }, { traceparent, tracestate: 'vendor=value' }]) {\n Object.freeze(otel);\n const result = parsed(Object.freeze({ ...base, otel }));\n expect(result.otel).toEqual(otel);\n expect(result.otel).not.toBe(otel);\n }\n });\n\n it('ignores malformed tracing fields without rejecting application configuration', () => {\n for (const otel of [\n undefined,\n null,\n [],\n false,\n 'span',\n { tracestate: 'vendor=value' },\n { traceparent: undefined },\n { traceparent: 12 },\n { traceparent: '' },\n ]) {\n expect(parsed({ ...base, otel }).otel).toEqual({});\n }\n expect(parsed({ ...base, otel: { traceparent: 'invalid' } }).otel).toEqual({ traceparent: 'invalid' });\n expect(parsed({ ...base, otel: { traceparent, tracestate: false, baggage: 'secret' } }).otel).toEqual({\n traceparent,\n });\n });\n\n it('authors a strict portable empty-or-parent union independently of normalization', async () => {\n const { isValid } = await import(new URL('generated/data-in.mjs', directory).href);\n expect(isValid({ ...base, otel: {} })).toBe(true);\n expect(isValid({ ...base, otel: { traceparent } })).toBe(true);\n expect(isValid({ ...base, otel: { traceparent, tracestate: 'vendor=value' } })).toBe(true);\n expect(isValid({ ...base, otel: { tracestate: 'vendor=value' } })).toBe(false);\n expect(isValid({ ...base, otel: { traceparent: 123 } })).toBe(false);\n expect(isValid({ ...base, otel: { traceparent, baggage: 'secret' } })).toBe(false);\n });\n });\n}\n\n/**\n * Shared step-configuration guarantees; step-specific normalization has its own tests.\n */\nexport function dataInTests(config: Config): void {\n const { parse, filter, base, identifiers, required, optionalBooleans, directory } = config;\n const parsed = (value: unknown) => parse(value) as Record<string, unknown>;\n\n describe('AOT step configuration', () => {\n it.each([null, undefined, [], 0, false, 'config'])('rejects invalid root shapes: %j', (value) => {\n expect(() => parse(value)).toThrow(DataInValidationError);\n });\n\n it.each(required)('requires %s without applying defaults', (field) => {\n const value = { ...base };\n delete value[field];\n try {\n parse(value);\n throw new Error('Expected validation failure');\n } catch (error) {\n expect(error).toBeInstanceOf(DataInValidationError);\n expect((error as DataInValidationError).issues).toEqual(\n expect.arrayContaining([expect.objectContaining({ path: `/${field}` })]),\n );\n }\n });\n\n it.each(identifiers)('normalizes and validates %s without mutating input', (field) => {\n const value = Object.freeze({ ...base, [field]: ' identifier ' });\n expect(parsed(value)[field]).toBe('identifier');\n expect(value[field]).toBe(' identifier ');\n expect(parsed({ ...base, [field]: 'a'.repeat(64) })[field]).toHaveLength(64);\n for (const invalid of [null, 1, false, ' ', 'undefined', ' null ', 'a'.repeat(65), '😀'.repeat(33)]) {\n expect(() => parse({ ...base, [field]: invalid }), `${field}: ${String(invalid)}`).toThrow(\n DataInValidationError,\n );\n }\n });\n\n it('trims timeout text without interpreting or coercing it', () => {\n expect(parsed({ ...base, timeoutDuration: ' 5 seconds ' }).timeoutDuration).toBe('5 seconds');\n expect(parsed({ ...base, timeoutDuration: 'not-a-duration' }).timeoutDuration).toBe('not-a-duration');\n for (const timeoutDuration of ['', ' ', 'null', 'undefined', 100, null])\n expect(() => parse({ ...base, timeoutDuration })).toThrow(DataInValidationError);\n });\n\n it.each(['processError', 'processTimeout', ...optionalBooleans])('does not coerce %s', (field) => {\n expect(parsed({ ...base, [field]: false })[field]).toBe(false);\n expect(() => parse({ ...base, [field]: 'false' })).toThrow(DataInValidationError);\n expect(() => parse({ ...base, [field]: null })).toThrow(DataInValidationError);\n });\n\n it('strips unknown fields without invoking their getters', () => {\n const value = { ...base };\n Object.defineProperty(value, 'extra', {\n enumerable: true,\n get() {\n throw new Error('Unknown getter must not run');\n },\n });\n expect(parsed(value)).not.toHaveProperty('extra');\n for (const field of optionalBooleans) expect(parsed(base)).not.toHaveProperty(field);\n });\n\n it('strips legacy test settings like other unknown configuration without reading getters', () => {\n for (const settings of [undefined, null, [], false, 0, { cache: null }]) {\n expect(parsed({ ...base, _testSettings: settings })).not.toHaveProperty('_testSettings');\n }\n expect(parsed(base)).not.toHaveProperty('_testSettings');\n const value = { ...base };\n Object.defineProperty(value, '_testSettings', {\n enumerable: true,\n get() {\n throw new Error('Unknown test-settings getter must not run');\n },\n });\n expect(parsed(value)).not.toHaveProperty('_testSettings');\n });\n\n it('classifies parser failures as validation errors with stable issue snapshots', () => {\n let first: unknown;\n try {\n parse({ ...base, timeoutDuration: 1 });\n } catch (error) {\n first = error;\n }\n expect(first).toBeInstanceOf(DataInValidationError);\n const issues = structuredClone((first as DataInValidationError).issues);\n expect(() => parse({})).toThrow(DataInValidationError);\n expect((first as DataInValidationError).issues).toEqual(issues);\n const filtered = filter(first);\n expect(filtered).toMatchObject({ code: 'VALIDATION', cause: first, data: { issues } });\n expect(filtered.message).toContain('/timeoutDuration');\n });\n\n it('ships no schema-builder or engine imports in JavaScript or declarations', async () => {\n for (const file of ['index.mjs', 'index.d.mts']) {\n const content = await readFile(new URL(`dist/${file}`, directory), 'utf8');\n expect(content).not.toMatch(/\\b(?:from|import)\\s*['\"](?:zod|@sinclair\\/typebox|ajv)(?:\\/[^'\"]*)?['\"]/u);\n }\n const schema = JSON.parse(await readFile(new URL('generated/data-in.json', directory), 'utf8'));\n expect(schema).toMatchObject({\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n type: 'object',\n additionalProperties: false,\n });\n expect(schema.properties).not.toHaveProperty('_testSettings');\n });\n\n it('preserves field descriptions and examples and validates complete configuration examples', async () => {\n interface Schema {\n description?: string;\n examples?: unknown[];\n properties?: Record<string, Schema>;\n anyOf?: Schema[];\n items?: Schema;\n }\n const schema = JSON.parse(await readFile(new URL('generated/data-in.json', directory), 'utf8')) as Schema;\n const declarations = await readFile(new URL('generated/data-in.d.mts', directory), 'utf8');\n const checkFields = (node: Schema): void => {\n const properties = Object.values(node.properties ?? {});\n for (const property of properties) {\n expect(property.description).toEqual(expect.any(String));\n expect(property.description?.trim().length).toBeGreaterThan(0);\n expect(property.examples?.length).toBeGreaterThan(0);\n expect(declarations).toContain(property.description);\n checkFields(property);\n }\n const branches = node.anyOf ?? [];\n for (const branch of branches) checkFields(branch);\n if (node.items) checkFields(node.items);\n };\n checkFields(schema);\n expect(schema.description?.length).toBeGreaterThan(0);\n expect(schema.examples?.length).toBeGreaterThan(0);\n const { isValid } = (await import(new URL('generated/data-in.mjs', directory).href)) as {\n isValid: (value: unknown) => boolean;\n };\n const examples = schema.examples ?? [];\n for (const example of examples) {\n expect(isValid(example)).toBe(true);\n expect(() => parse(example)).not.toThrow();\n }\n });\n\n it('runs and typechecks generated validation without engines or runtime code generation', async () => {\n const parent = path.join(tmpdir(), 'opencode');\n await mkdir(parent, { recursive: true });\n const temporary = await mkdtemp(path.join(parent, 'step-aot-'));\n try {\n await cp(new URL('generated/data-in.mjs', directory), path.join(temporary, 'data-in.mjs'));\n await cp(new URL('generated/data-in.d.mts', directory), path.join(temporary, 'data-in.d.mts'));\n await writeFile(\n path.join(temporary, 'runtime.mjs'),\n `\nimport assert from 'node:assert/strict';\nimport { isValid, validate } from './data-in.mjs';\nassert.equal(isValid(${JSON.stringify(base)}), true);\nassert.equal(validate({}).valid, false);\nassert.equal(isValid({...${JSON.stringify(base)}, timeoutDuration: 1}), false);\n`,\n );\n await execute(process.execPath, ['--disallow-code-generation-from-strings', 'runtime.mjs'], { cwd: temporary });\n await writeFile(\n path.join(temporary, 'consumer.mts'),\n `\nimport type { DataInConfig } from './data-in.mjs';\nimport { isValid } from './data-in.mjs';\nconst value: DataInConfig = ${JSON.stringify(base)};\ndeclare const raw: unknown;\nif (isValid(raw)) { const timeout: string = raw.timeoutDuration; void timeout; }\nvoid value;\n`,\n );\n await writeFile(\n path.join(temporary, 'tsconfig.json'),\n JSON.stringify({\n compilerOptions: {\n noEmit: true,\n strict: true,\n declaration: true,\n types: [],\n module: 'node16',\n target: 'es2022',\n },\n files: ['consumer.mts'],\n }),\n );\n await execute(process.execPath, [require.resolve('typescript/bin/tsc'), '--project', temporary]);\n } finally {\n await rm(temporary, { recursive: true, force: true });\n }\n });\n\n it('regenerates schemas and preserves previous artifacts when compilation fails', async () => {\n const temporary = new URL('.build/', directory);\n await mkdir(temporary, { recursive: true });\n const work = await mkdtemp(fileURLToPath(new URL('schema-test-', temporary)));\n try {\n const script = `\nimport assert from 'node:assert/strict';\nimport { pathToFileURL } from 'node:url';\nimport { readFile } from 'node:fs/promises';\nimport { generateArtifacts } from '@onereach/json-schema-aot';\nconst directory = pathToFileURL(${JSON.stringify(`${work}/`)});\n// Generate structural configuration artifacts; normalization and SDK values stay local.\nconst generateStepSchema = (authored, directory) => generateArtifacts(\n { DataInConfig: authored },\n {\n outputDirectory: new URL('generated/', directory),\n temporaryDirectory: new URL('.build/', directory),\n fileNames: { DataInConfig: 'data-in' },\n jsonDirectory: '.',\n },\n);\nconst schema = {type: 'object', properties: {name: {type: 'string', minLength: 1}}, required: ['name'], additionalProperties: false};\nawait generateStepSchema(schema, directory);\nconst file = new URL('generated/data-in.mjs', directory);\nconst before = await readFile(file, 'utf8');\nawait assert.rejects(generateStepSchema({...schema, unsupportedKeyword: true}, directory));\nassert.equal(await readFile(file, 'utf8'), before);\nawait generateStepSchema({...schema, properties: {name: {type: 'boolean'}}}, directory);\nassert.notEqual(await readFile(file, 'utf8'), before);\n`;\n await execute(process.execPath, ['--input-type=module', '--eval', script], {\n cwd: fileURLToPath(directory),\n });\n } finally {\n await rm(work, { recursive: true, force: true });\n }\n });\n });\n}\n","import {\n ContractValidationError,\n DriverCapabilityError,\n FunctionTimeoutError,\n NotFoundError,\n RevisionConflictError,\n SchemaValidationError,\n StateMachineConfigError,\n TemplateRevisionMismatchError,\n TemplateSnapshotError,\n UnknownFunctionError,\n UnsafeConcurrencyError,\n} from '../system/index.ts';\nimport { describe, expect, expectTypeOf, it } from 'vitest';\n\nimport { DataInValidationError } from '../configuration/data-in.mts';\nimport type { StepErrorCode } from '../errors/error-code.mts';\nimport type { ErrorFilterOptions, StepErrorDetails } from '../errors/error-filter.mts';\n\ntype Filter = (\n error: unknown,\n options?: {\n unknownMessage?: string;\n unknownCode?: 'SERVER_ERROR';\n preserveErrors?: readonly (new (message?: string) => Error)[];\n },\n) => Error;\n\n/**\n * Both Flow steps must expose the same framework diagnostics and fallback behavior.\n */\nexport function errorFilterTests(filter: Filter): void {\n describe('framework error filtering', () => {\n it('restricts step error codes and fallback overrides to the shared string union', () => {\n expectTypeOf<StepErrorDetails['code']>().toEqualTypeOf<StepErrorCode>();\n expectTypeOf<NonNullable<ErrorFilterOptions<[]>['unknownCode']>>().toEqualTypeOf<StepErrorCode>();\n expectTypeOf<'VALIDATION'>().toExtend<StepErrorCode>();\n expectTypeOf<'VALIDATON'>().not.toExtend<StepErrorCode>();\n });\n\n const cases = [\n [new NotFoundError('instance:missing'), 'NOT_FOUND', { resource: 'instance:missing' }],\n [new UnknownFunctionError('missing'), 'NOT_FOUND', { functionName: 'missing' }],\n [new FunctionTimeoutError('slow', 100), 'TIMEOUT', { functionName: 'slow', timeoutMs: 100 }],\n [new RevisionConflictError('old', 'new'), 'CONFLICT', { expected: 'old', actual: 'new' }],\n [new RevisionConflictError(null, undefined), 'CONFLICT', { expected: null, actual: undefined }],\n [new RevisionConflictError(undefined, 'new'), 'CONFLICT', { expected: undefined, actual: 'new' }],\n [new TemplateRevisionMismatchError('old', 'new'), 'CONFLICT', { expected: 'old', actual: 'new' }],\n [new DriverCapabilityError('watch'), 'UNSUPPORTED', { capability: 'watch' }],\n [new UnsafeConcurrencyError('none'), 'UNSUPPORTED', { concurrency: 'none' }],\n [new TemplateSnapshotError('/state/value', 'unsupported value'), 'VALIDATION', { path: '/state/value' }],\n ...(['cache', 'storageScope'] as const).map(\n (option) => [new StateMachineConfigError(option), 'CONFIGURATION', { option }] as const,\n ),\n ] as const;\n\n it.each(cases)('classifies %s as %s with structured details', (cause, code, data) => {\n const result = filter(cause, { unknownMessage: 'Fallback', unknownCode: 'SERVER_ERROR' });\n expect(result).toMatchObject({ code, cause, data });\n expect(result.message).toContain(cause.message);\n expect(filter(result)).toBe(result);\n });\n\n it('reports contract issues, including root paths', () => {\n const issues = [\n { path: '/instance/id', message: 'must not be empty' },\n { path: '', message: 'Invalid root' },\n ];\n const cause = new ContractValidationError(issues);\n const result = filter(cause);\n expect(result).toMatchObject({ code: 'VALIDATION', cause, data: { issues } });\n expect(result.message).toContain('/instance/id: must not be empty');\n expect(result.message).toContain('/: Invalid root');\n });\n\n it.each(['input', 'output', 'state-before', 'state-after', 'initial-state'] as const)(\n 'reports %s validation with escaped pointers and unchanged issues',\n (target) => {\n const issues = [\n { message: 'Invalid root' },\n { path: [], message: 'Invalid empty path' },\n { path: ['a/b', '~key', '0', ''], message: 'Invalid value' },\n { path: [{ key: 'a/b' }, 0, Symbol('key')], message: 'Invalid structured path' },\n ];\n const cause = new SchemaValidationError(target, issues);\n const result = filter(cause);\n expect(result).toMatchObject({ code: 'VALIDATION', cause, data: { target, issues } });\n expect(result.message).toContain(cause.message);\n expect(result.message).toContain('/: Invalid root');\n expect(result.message).toContain('/: Invalid empty path');\n expect(result.message).toContain('/a~1b/~0key/0/: Invalid value');\n expect(result.message).toContain('/a~1b/0/Symbol(key): Invalid structured path');\n },\n );\n\n it('handles empty validation issue arrays', () => {\n for (const cause of [new ContractValidationError([]), new SchemaValidationError('input', [])]) {\n expect(filter(cause)).toMatchObject({\n code: 'VALIDATION',\n cause,\n message: expect.stringContaining(cause.message),\n data: { issues: [] },\n });\n }\n });\n\n it('retains local configuration validation', () => {\n const cause = new DataInValidationError([{ path: '/stateId', message: 'Required' }]);\n expect(filter(cause)).toMatchObject({\n code: 'VALIDATION',\n cause,\n message: expect.stringContaining(cause.message),\n data: { issues: cause.issues },\n });\n });\n\n it('does not classify lookalike errors by name or message', () => {\n class LookalikeError extends Error {\n override name = 'UnknownFunctionError';\n }\n const cause = new LookalikeError('Unknown state-machine function: missing');\n expect(filter(cause)).toMatchObject({\n code: 'UNKNOWN',\n message: expect.stringContaining('Unknown error'),\n cause,\n });\n });\n\n it('allows explicit preservation before framework classification', () => {\n const cause = new NotFoundError('missing');\n expect(filter(cause, { preserveErrors: [Error] })).toBe(cause);\n });\n\n it('retains unknown-error overrides and non-error payloads', () => {\n const cause = new Error('Unexpected failure');\n expect(filter(cause, { unknownMessage: 'Fallback', unknownCode: 'SERVER_ERROR' })).toMatchObject({\n code: 'SERVER_ERROR',\n message: expect.stringContaining('Fallback'),\n cause,\n });\n for (const data of [null, undefined, 42, { name: 'NotFoundError', resource: 'missing' }]) {\n expect(filter(data)).toMatchObject({ code: 'UNKNOWN', message: 'Unknown error', data });\n }\n expect(filter('Failure')).toMatchObject({ code: 'UNKNOWN', message: 'Failure' });\n });\n\n it('retains legacy SDK timeout and server-response classification', () => {\n const timeout = new Error('Request timed out');\n expect(filter(timeout)).toMatchObject({ code: 'TIMEOUT', cause: timeout });\n const cause = Object.assign(new Error('Request failed'), {\n response: { data: { error: { message: 'Server failure' } } },\n });\n expect(filter(cause)).toMatchObject({\n code: 'SERVER_ERROR',\n message: expect.stringContaining('Server failure'),\n cause,\n });\n });\n });\n}\n"],"mappings":"yiBAWA,MAAM,EAAU,EAAU,CAAQ,EAC5B,EAAU,EAAc,YAAY,GAAG,EAe7C,SAAgB,EAAgB,EAA4D,CAC1F,GAAM,CAAE,QAAO,OAAM,aAAc,EAC7B,EAAc,0DACd,EAAU,GAAmB,EAAM,CAAK,EAC9C,EAAS,mBAAsB,CAC7B,EAAG,4EAA+E,CAChF,EAAO,EAAO,CAAI,CAAC,CAAC,CAAC,IAAI,eAAe,MAAM,EAC9C,IAAK,IAAM,IAAQ,CAAC,CAAC,EAAG,CAAE,aAAY,EAAG,CAAE,cAAa,WAAY,cAAe,CAAC,EAAG,CACrF,OAAO,OAAO,CAAI,EAClB,IAAM,EAAS,EAAO,OAAO,OAAO,CAAE,GAAG,EAAM,MAAK,CAAC,CAAC,EACtD,EAAO,EAAO,IAAI,CAAC,CAAC,QAAQ,CAAI,EAChC,EAAO,EAAO,IAAI,CAAC,CAAC,IAAI,KAAK,CAAI,CACnC,CACF,CAAC,EAED,EAAG,mFAAsF,CACvF,IAAK,IAAM,IAAQ,CACjB,IAAA,GACA,KACA,CAAC,EACD,GACA,OACA,CAAE,WAAY,cAAe,EAC7B,CAAE,YAAa,IAAA,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K,CAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAK,CAC/D,CAAC,EAED,EAAG,6DAAgE,CACjE,IAAM,EAAY,MAAM,oBAAoB,EAC5C,EAAO,EAAO,EAAO,CAAE,eAAgB,WAAY,YAAa,cAAe,CAAC,CAAC,CAAC,CAAC,cAAc,CAC/F,KAAM,eACN,QAAS,EAAO,iBAAiB,UAAU,EAC3C,OACF,CAAC,EACD,IAAK,IAAM,IAAQ,CAAC,KAAM,IAAA,GAAW,GAAI,CAAE,KAAM,gBAAiB,SAAU,SAAU,CAAC,EACrF,EAAO,EAAO,CAAI,CAAC,CAAC,CAAC,cAAc,CAAE,KAAM,UAAW,QAAS,gBAAiB,MAAK,CAAC,EAExF,EAAO,EAAO,SAAS,CAAC,CAAC,CAAC,cAAc,CAAE,KAAM,UAAW,QAAS,SAAU,CAAC,CACjF,CAAC,EAED,EAAG,oEAAuE,CACxE,IAAM,EAAc,MAAM,mBAAmB,EAC7C,EAAO,EAAO,CAAO,CAAC,CAAC,CAAC,cAAc,CAAE,KAAM,UAAW,MAAO,CAAQ,CAAC,EACzE,IAAM,EAAQ,OAAO,OAAW,MAAM,gBAAgB,EAAG,CACvD,SAAU,CAAE,KAAM,CAAE,MAAO,CAAE,QAAS,gBAAiB,CAAE,CAAE,CAC7D,CAAC,EACD,EAAO,EAAO,CAAK,CAAC,CAAC,CAAC,cAAc,CAClC,KAAM,eACN,QAAS,EAAO,iBAAiB,gBAAgB,EACjD,OACF,CAAC,CACH,CAAC,CACH,CAAC,CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-state-machine-shared",
3
- "version": "1.0.0-framework.13",
3
+ "version": "1.0.0-framework.15",
4
4
  "description": "Shared OneReach state-machine step composition, configuration, and errors",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -22,7 +22,10 @@
22
22
  "@arethetypeswrong/core": "^0.18.5",
23
23
  "@onereach/flow-sdk": "v9.0.0-monosplit.5",
24
24
  "@onereach/flow-sdk-mocks": "v9.0.0-monosplit.5",
25
- "@onereach/state-machine-runtime-node-worker": "1.0.0-framework.2",
25
+ "@onereach/state-machine-runtime-node-worker": "1.0.0-framework.4",
26
+ "@opentelemetry/context-async-hooks": "^2.12.1",
27
+ "@opentelemetry/sdk-metrics": "^2.12.1",
28
+ "@opentelemetry/sdk-trace-base": "^2.12.1",
26
29
  "@types/node": "^24.13.3",
27
30
  "publint": "^0.3.24",
28
31
  "tsdown": "^0.22.14",
@@ -30,15 +33,18 @@
30
33
  "vitest": "^4.1.11"
31
34
  },
32
35
  "dependencies": {
33
- "@onereach/state-machine-contracts": "1.0.0-framework.12",
34
- "@onereach/state-machine-coordination": "1.0.0-framework.2",
35
- "@onereach/state-machine-coordination-onereach": "1.0.0-framework.2",
36
- "@onereach/state-machine-driver-or-flow-mf": "1.0.0-framework.12",
37
- "@onereach/state-machine-json-schema-ajv": "1.0.0-framework.12",
38
- "@onereach/state-machine-runtime": "1.0.0-framework.13",
39
- "@onereach/state-machine-service": "1.0.0-framework.13",
40
- "@onereach/state-machine-store": "1.0.0-framework.12",
41
- "@onereach/state-machine-validation": "1.0.0-framework.2"
36
+ "@onereach/state-machine-contracts": "1.0.0-framework.13",
37
+ "@onereach/state-machine-coordination": "1.0.0-framework.3",
38
+ "@onereach/state-machine-coordination-onereach": "1.0.0-framework.4",
39
+ "@onereach/state-machine-driver-or-flow-mf": "1.0.0-framework.14",
40
+ "@onereach/state-machine-json-schema-ajv": "1.0.0-framework.14",
41
+ "@onereach/state-machine-runtime": "1.0.0-framework.15",
42
+ "@onereach/state-machine-service": "1.0.0-framework.15",
43
+ "@onereach/state-machine-store": "1.0.0-framework.14",
44
+ "@onereach/state-machine-telemetry": "1.0.0-framework.2",
45
+ "@onereach/state-machine-validation": "1.0.0-framework.4",
46
+ "@opentelemetry/api": "~1.9.1",
47
+ "@opentelemetry/core": "^2.12.1"
42
48
  },
43
49
  "peerDependencies": {
44
50
  "vitest": "^4.1.11"
@@ -53,6 +59,7 @@
53
59
  "./configuration": "./dist/configuration.mjs",
54
60
  "./errors": "./dist/errors.mjs",
55
61
  "./notifications": "./dist/notifications.mjs",
62
+ "./telemetry": "./dist/telemetry.mjs",
56
63
  "./testing": "./dist/testing.mjs",
57
64
  "./package.json": "./package.json"
58
65
  },