@walkeros/core 4.3.0 → 4.3.1

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/dist/index.d.mts CHANGED
@@ -224,6 +224,71 @@ interface Ingest {
224
224
  /** Create a fresh Ingest for a new pipeline invocation. */
225
225
  declare function createIngest(sourceId: string): Ingest;
226
226
 
227
+ /**
228
+ * Unified observation connect protocol: the public shapes and pure parsers a
229
+ * customer-side runtime uses to attach to an observation session. Everything a
230
+ * customer commits is public (`url`, `binding`); the per-session credential
231
+ * arrives out-of-band and is only parsed here, never verified: the observer
232
+ * is its verifier. No DOM, no Node, pure string/object functions.
233
+ */
234
+ /** Web arm connect config. Every value is public and safe to commit. */
235
+ interface ObserveWeb {
236
+ url: string;
237
+ binding: string;
238
+ /**
239
+ * FlowState scoping id stamped onto every posted record. Defaults to the
240
+ * collector's flow name; bakers (e.g. a preview artifact) set it so records
241
+ * carry the platform's flow id rather than the config's local name.
242
+ */
243
+ flowId?: string;
244
+ /**
245
+ * Observer verbosity once a credential attaches. Defaults to 'standard'.
246
+ * Also drives the collector-wide capture level supplier, so 'trace'
247
+ * enables destination call capture.
248
+ */
249
+ level?: 'off' | 'standard' | 'trace';
250
+ /** Deterministic sample fraction in [0, 1]. Defaults to 1. */
251
+ sample?: number;
252
+ }
253
+ /** Server arm connect config, assembled from the deployment's env trio. */
254
+ interface ObserveServer {
255
+ url: string;
256
+ sessionId: string;
257
+ token: string;
258
+ level?: 'off' | 'standard' | 'trace';
259
+ /** Deterministic sample fraction in [0, 1]. Defaults to 1. */
260
+ sample?: number;
261
+ }
262
+ type Observe = ObserveWeb | ObserveServer;
263
+ /** Claims carried by a parsed `obsw_` web credential. */
264
+ interface ObserveCredential {
265
+ /** Project binding. Must match the value baked into the host bundle. */
266
+ pb: string;
267
+ /** Session id the credential attaches to. */
268
+ ses: string;
269
+ /** Web ingest token. Opaque here; the observer verifies it. */
270
+ secret: string;
271
+ }
272
+ /**
273
+ * Parse a web observation credential of the exact shape
274
+ * `obsw_<pb>.<ses>.<secret>`: the `obsw_` prefix followed by exactly three
275
+ * non-empty dot-separated segments. Returns null (never throws) on every
276
+ * malformed shape: wrong prefix, wrong segment count, empty segment.
277
+ */
278
+ declare function parseObserveCredential(raw: string): ObserveCredential | null;
279
+ /**
280
+ * Read the server arm's connect config from an env record. Callers pass their
281
+ * own env (e.g. `process.env`); core never reads globals. Returns an
282
+ * `ObserveServer` only when the full trio (`WALKEROS_OBSERVER_URL`,
283
+ * `WALKEROS_DEPLOYMENT_ID`, `WALKEROS_INGEST_TOKEN`) is present, carrying
284
+ * `WALKEROS_OBSERVE_LEVEL` into `level`. An explicitly set level that names
285
+ * no known value (e.g. a typo'd `offf`) rejects the whole config: silently
286
+ * observing at the default `standard` against a probable opt-out intent is
287
+ * the one failure mode this parser must never produce. Otherwise undefined:
288
+ * an unconfigured deployment does zero observation work.
289
+ */
290
+ declare function observeFromEnv(env: Record<string, string | undefined>): ObserveServer | undefined;
291
+
227
292
  /**
228
293
  * FlowState is the canonical observation record emitted at each hop in a
229
294
  * walkerOS pipeline. Telemetry helpers populate one of these per (step,
@@ -264,6 +329,8 @@ interface FlowState {
264
329
  sourceId?: string;
265
330
  /** Per-poster monotonic record counter for gap detection. Stamped by the batched poster, not emitters. */
266
331
  seq?: number;
332
+ /** Release provenance of the runtime that produced this state, e.g. a deployment id. Stamped by the wiring layer, not emitters. */
333
+ release?: string;
267
334
  /**
268
335
  * Vendor calls recorded via wrapEnv on destination out records. Captured only
269
336
  * at trace level and only when the destination declares a `calls` list
@@ -404,6 +471,20 @@ interface InitConfig extends Partial<Config$6> {
404
471
  custom?: Properties;
405
472
  /** Hooks for pipeline observation and interception */
406
473
  hooks?: Functions;
474
+ /**
475
+ * Observation session connect config, wired by `startFlow` before the run
476
+ * command. The server form attaches a telemetry poster directly from its
477
+ * config trio; the web form attaches only when an `elbObserve` credential
478
+ * is present (URL param or storage slot) and its binding matches. Purely
479
+ * advisory: nothing on this path can affect event processing.
480
+ */
481
+ observe?: Observe;
482
+ /**
483
+ * Caller-supplied observers, added verbatim to `collector.observers` by
484
+ * `startFlow`. Escape hatch for custom emit targets; same advisory
485
+ * contract as every observer (thrown values are swallowed by emitStep).
486
+ */
487
+ observers?: ObserverFn[];
407
488
  }
408
489
  interface SessionData extends Properties {
409
490
  isStart: boolean;
@@ -1751,6 +1832,19 @@ declare namespace Flow {
1751
1832
  level?: 'off' | 'standard' | 'trace';
1752
1833
  /** Deterministic sample fraction in [0, 1]. Defaults to 1. */
1753
1834
  sample?: number;
1835
+ /**
1836
+ * Observer base URL for the web connect form. Public, safe to commit.
1837
+ * When `url` and `binding` are both set on a web flow, the bundler bakes
1838
+ * exactly this pair into the generated startFlow config; the runtime
1839
+ * attaches only when an out-of-band `elbObserve` credential is present.
1840
+ * Secrets never live in flow config.
1841
+ */
1842
+ url?: string;
1843
+ /**
1844
+ * Public project binding a web observe credential must match. Paired
1845
+ * with `url`; public, safe to commit.
1846
+ */
1847
+ binding?: string;
1754
1848
  }
1755
1849
  /**
1756
1850
  * Reusable values referenced via `$var.name` (with optional deep paths).
@@ -4489,6 +4583,16 @@ interface SwapActivatorConfig {
4489
4583
  * stored activation clears.
4490
4584
  */
4491
4585
  declare const SESSION_STORAGE_KEY = "elbPreviewSession";
4586
+ /**
4587
+ * Storage slot for the observe ingest credential companion (`obsw_...`), a
4588
+ * plaintext bearer credential riding the activation URL. The web arm never
4589
+ * verifies it (the observer is its verifier): the activator only ferries it
4590
+ * from the activation URL into storage, where the observe wiring reads it to
4591
+ * attach to the observation session. Same lifecycle as the session companion:
4592
+ * set (or cleared) whenever a URL activation succeeds, cleared whenever the
4593
+ * stored activation clears.
4594
+ */
4595
+ declare const OBSERVE_STORAGE_KEY = "elbObserve";
4492
4596
  /**
4493
4597
  * Decide whether a preview bundle should boot in place of this bundle's own flow.
4494
4598
  *
@@ -4568,8 +4672,21 @@ type PosterFetch = (url: string, init: {
4568
4672
  headers: Record<string, string>;
4569
4673
  body: string;
4570
4674
  }) => Promise<PosterResponse>;
4675
+ /**
4676
+ * Versioned ingest wire format. Every POST body is one envelope; a batch
4677
+ * split into multiple chunks posts one complete envelope per chunk. The
4678
+ * version field lets the observer evolve its parse without sniffing shapes:
4679
+ * runtimes pinned to this poster keep emitting `v: 1` and the server keeps
4680
+ * accepting it.
4681
+ */
4682
+ interface IngestEnvelope {
4683
+ /** Wire format version. */
4684
+ v: 1;
4685
+ /** FlowState records in arrival order, each stamped with a seq. */
4686
+ records: FlowState[];
4687
+ }
4571
4688
  interface BatchedPosterOptions {
4572
- /** Absolute HTTP endpoint URL. POST with JSON array body. */
4689
+ /** Absolute HTTP endpoint URL. POST with a versioned envelope JSON body. */
4573
4690
  url: string;
4574
4691
  /** Bearer token sent in the `Authorization` header. */
4575
4692
  token: string;
@@ -4587,6 +4704,20 @@ interface BatchedPosterOptions {
4587
4704
  fetch?: PosterFetch;
4588
4705
  /** Called when the underlying POST rejects. Defaults to swallowing. */
4589
4706
  onError?: (err: unknown) => void;
4707
+ /**
4708
+ * Extra headers merged into every request (e.g. `X-Walkeros-Binding`).
4709
+ * The fixed `Content-Type` and `Authorization` headers win on collision,
4710
+ * matched case-insensitively (header names are case-insensitive on the
4711
+ * wire, so a lowercase `authorization` is dropped too).
4712
+ */
4713
+ headers?: Record<string, string>;
4714
+ /**
4715
+ * Called with the HTTP status of every response, before any non-2xx
4716
+ * error handling. Lets callers react to a 401/404 (stop posting,
4717
+ * self-heal) without parsing error strings. Not called when the fetch
4718
+ * rejects, since no response exists.
4719
+ */
4720
+ onStatus?: (status: number) => void;
4590
4721
  }
4591
4722
  /**
4592
4723
  * Build a batched emit callback. The returned function is synchronous, never
@@ -5040,4 +5171,4 @@ declare const REF_CODE_PREFIX = "$code:";
5040
5171
  */
5041
5172
  declare function scanFlowRefs(value: unknown, into?: Set<string>): Set<string>;
5042
5173
 
5043
- export { type ActivationGrant, type AssembleJourneysOptions, type BatchedPosterOptions, type BreakerState, CLOCK_SKEW_MS, cache as Cache, type CacheEnvelope, type CacheResult, type ClickIdEntry, collector as Collector, type CompiledCache, Const, context as Context, type Credential, type Debounced, destination as Destination, type DestroyContext, type DestroyFn, type DroppedCounters, ENV_MARKER_PREFIX, elb as Elb, type EmitFn, type ExampleSummary, FatalError, Flow, type FlowConfigResolver, type FlowState, type FlowStateBatch, type FlowStatePhase, type FlowStepType, type GetStore, hint as Hint, hooks as Hooks, type Ingest, type IngestMeta, type Journey, type JourneyAssembly, type JourneyBranch, type JourneyCorrelation, type JourneyEntry, type JourneyGap, type JourneyHop, type JourneyHopStatus, type JourneyPlatform, type JourneyStatus, type JourneyTopology, type JourneyTopologyNode, type JsonSchema, Level, lifecycle as Lifecycle, type LifecycleContext, logger as Logger, MAX_SESSION_MS, mapping as Mapping, type MarketingParameters, matcher as Matcher, type MockLogger, OBSERVE_ENV_KEY, type ObserverFn, on as On, type ParsedGrant, type ParsedTraceparent, type PosterFetch, type PosterResponse, type PreviewCrypto, type PreviewFailure, type PreviewKey, type PreviewSubtle, REF_CODE_PREFIX, REF_CONTRACT, REF_ENV, REF_FLOW, REF_SECRET, REF_STORE, REF_VAR_FULL, REF_VAR_INLINE, request as Request, type ResolveContractsOptions, type ResolveOptions, type RespondFn, type RespondOptions, SECRET_MARKER_PREFIX, SESSION_STORAGE_KEY, STEP_OPERATIVE_FIELDS, type ScheduleOptions, type SendDataValue, type SendHeaders, type SendResponse, type ServiceAccount, type SetupFn, simulation as Simulation, source as Source, type State, type StepEntryErrorCode, type StepEntryValidation, type StepKind, type StorageType, store as Store, StoreCodecError, type SwapActivatorConfig, type TelemetryLevel, type TelemetryOptions, type TelemetryOptionsSupplier, transformer as Transformer, trigger as Trigger, URL_WINDOW_MS, type ValidateEvents, type VerifyParams, type VerifyResult, walkeros as WalkerOS, type WalkerOSPackage, type WalkerOSPackageInfo, type WalkerOSPackageMeta, anonymizeIP, applyState, applyUpdate, assembleJourneys, assign, branch, browserSwapActivator, buildCacheContext, castToProperty, castValue, checkCache, clone, compileCache, compileMatcher, compileState, createBatchedPoster, createDestination, createEvent, createIngest, createLogger, createMockContext, createMockLogger, createRespond, createTelemetryObserver, debounce, deepMerge, defaultClickIds, deleteByPath, deserializeStoreValue, emitStep, fetchPackage, fetchPackageSchema, filterValues, flattenIncludeSections, formatOut, getBrowser, getBrowserVersion, getByPath, getDeviceType, getEvent, getFlowSettings, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getNextSteps, getOS, getOSVersion, getPlatform, getSpanId, getTraceId, getTraceUntil, isArguments, isArray, isBoolean, isCommand, isDefined, isElementOrDocument, isEnvObserve, isFunction, isNumber, isObject, isPathStepEntry, isPropertyType, isRouteArray, isRouteConfigEntry, isSameType, isSampled, isStoreValue, isString, mcpError, mcpResult, mergeContractSchemas, mergeMappingRule, mockEnv, packageNameToVariable, parseCallPath, parseGrant, parseTraceparent, parseUserAgent, processEventMapping, readCacheEnvelope, requestToData, requestToParameter, resolveContracts, resolveSetup, resolveTelemetryOptions, scanFlowRefs, serializeStoreValue, setByPath, setTraceUntil, stepId, storeCache, throttle, throwError, transformData, traverseEnv, trim, tryCatch, tryCatchAsync, useHooks, validateStepEntry, verifyActivation, walkPath, wrapCacheEnvelope, wrapCondition, wrapFn, wrapValidate };
5174
+ export { type ActivationGrant, type AssembleJourneysOptions, type BatchedPosterOptions, type BreakerState, CLOCK_SKEW_MS, cache as Cache, type CacheEnvelope, type CacheResult, type ClickIdEntry, collector as Collector, type CompiledCache, Const, context as Context, type Credential, type Debounced, destination as Destination, type DestroyContext, type DestroyFn, type DroppedCounters, ENV_MARKER_PREFIX, elb as Elb, type EmitFn, type ExampleSummary, FatalError, Flow, type FlowConfigResolver, type FlowState, type FlowStateBatch, type FlowStatePhase, type FlowStepType, type GetStore, hint as Hint, hooks as Hooks, type Ingest, type IngestEnvelope, type IngestMeta, type Journey, type JourneyAssembly, type JourneyBranch, type JourneyCorrelation, type JourneyEntry, type JourneyGap, type JourneyHop, type JourneyHopStatus, type JourneyPlatform, type JourneyStatus, type JourneyTopology, type JourneyTopologyNode, type JsonSchema, Level, lifecycle as Lifecycle, type LifecycleContext, logger as Logger, MAX_SESSION_MS, mapping as Mapping, type MarketingParameters, matcher as Matcher, type MockLogger, OBSERVE_ENV_KEY, OBSERVE_STORAGE_KEY, type Observe, type ObserveCredential, type ObserveServer, type ObserveWeb, type ObserverFn, on as On, type ParsedGrant, type ParsedTraceparent, type PosterFetch, type PosterResponse, type PreviewCrypto, type PreviewFailure, type PreviewKey, type PreviewSubtle, REF_CODE_PREFIX, REF_CONTRACT, REF_ENV, REF_FLOW, REF_SECRET, REF_STORE, REF_VAR_FULL, REF_VAR_INLINE, request as Request, type ResolveContractsOptions, type ResolveOptions, type RespondFn, type RespondOptions, SECRET_MARKER_PREFIX, SESSION_STORAGE_KEY, STEP_OPERATIVE_FIELDS, type ScheduleOptions, type SendDataValue, type SendHeaders, type SendResponse, type ServiceAccount, type SetupFn, simulation as Simulation, source as Source, type State, type StepEntryErrorCode, type StepEntryValidation, type StepKind, type StorageType, store as Store, StoreCodecError, type SwapActivatorConfig, type TelemetryLevel, type TelemetryOptions, type TelemetryOptionsSupplier, transformer as Transformer, trigger as Trigger, URL_WINDOW_MS, type ValidateEvents, type VerifyParams, type VerifyResult, walkeros as WalkerOS, type WalkerOSPackage, type WalkerOSPackageInfo, type WalkerOSPackageMeta, anonymizeIP, applyState, applyUpdate, assembleJourneys, assign, branch, browserSwapActivator, buildCacheContext, castToProperty, castValue, checkCache, clone, compileCache, compileMatcher, compileState, createBatchedPoster, createDestination, createEvent, createIngest, createLogger, createMockContext, createMockLogger, createRespond, createTelemetryObserver, debounce, deepMerge, defaultClickIds, deleteByPath, deserializeStoreValue, emitStep, fetchPackage, fetchPackageSchema, filterValues, flattenIncludeSections, formatOut, getBrowser, getBrowserVersion, getByPath, getDeviceType, getEvent, getFlowSettings, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getNextSteps, getOS, getOSVersion, getPlatform, getSpanId, getTraceId, getTraceUntil, isArguments, isArray, isBoolean, isCommand, isDefined, isElementOrDocument, isEnvObserve, isFunction, isNumber, isObject, isPathStepEntry, isPropertyType, isRouteArray, isRouteConfigEntry, isSameType, isSampled, isStoreValue, isString, mcpError, mcpResult, mergeContractSchemas, mergeMappingRule, mockEnv, observeFromEnv, packageNameToVariable, parseCallPath, parseGrant, parseObserveCredential, parseTraceparent, parseUserAgent, processEventMapping, readCacheEnvelope, requestToData, requestToParameter, resolveContracts, resolveSetup, resolveTelemetryOptions, scanFlowRefs, serializeStoreValue, setByPath, setTraceUntil, stepId, storeCache, throttle, throwError, transformData, traverseEnv, trim, tryCatch, tryCatchAsync, useHooks, validateStepEntry, verifyActivation, walkPath, wrapCacheEnvelope, wrapCondition, wrapFn, wrapValidate };
package/dist/index.d.ts CHANGED
@@ -224,6 +224,71 @@ interface Ingest {
224
224
  /** Create a fresh Ingest for a new pipeline invocation. */
225
225
  declare function createIngest(sourceId: string): Ingest;
226
226
 
227
+ /**
228
+ * Unified observation connect protocol: the public shapes and pure parsers a
229
+ * customer-side runtime uses to attach to an observation session. Everything a
230
+ * customer commits is public (`url`, `binding`); the per-session credential
231
+ * arrives out-of-band and is only parsed here, never verified: the observer
232
+ * is its verifier. No DOM, no Node, pure string/object functions.
233
+ */
234
+ /** Web arm connect config. Every value is public and safe to commit. */
235
+ interface ObserveWeb {
236
+ url: string;
237
+ binding: string;
238
+ /**
239
+ * FlowState scoping id stamped onto every posted record. Defaults to the
240
+ * collector's flow name; bakers (e.g. a preview artifact) set it so records
241
+ * carry the platform's flow id rather than the config's local name.
242
+ */
243
+ flowId?: string;
244
+ /**
245
+ * Observer verbosity once a credential attaches. Defaults to 'standard'.
246
+ * Also drives the collector-wide capture level supplier, so 'trace'
247
+ * enables destination call capture.
248
+ */
249
+ level?: 'off' | 'standard' | 'trace';
250
+ /** Deterministic sample fraction in [0, 1]. Defaults to 1. */
251
+ sample?: number;
252
+ }
253
+ /** Server arm connect config, assembled from the deployment's env trio. */
254
+ interface ObserveServer {
255
+ url: string;
256
+ sessionId: string;
257
+ token: string;
258
+ level?: 'off' | 'standard' | 'trace';
259
+ /** Deterministic sample fraction in [0, 1]. Defaults to 1. */
260
+ sample?: number;
261
+ }
262
+ type Observe = ObserveWeb | ObserveServer;
263
+ /** Claims carried by a parsed `obsw_` web credential. */
264
+ interface ObserveCredential {
265
+ /** Project binding. Must match the value baked into the host bundle. */
266
+ pb: string;
267
+ /** Session id the credential attaches to. */
268
+ ses: string;
269
+ /** Web ingest token. Opaque here; the observer verifies it. */
270
+ secret: string;
271
+ }
272
+ /**
273
+ * Parse a web observation credential of the exact shape
274
+ * `obsw_<pb>.<ses>.<secret>`: the `obsw_` prefix followed by exactly three
275
+ * non-empty dot-separated segments. Returns null (never throws) on every
276
+ * malformed shape: wrong prefix, wrong segment count, empty segment.
277
+ */
278
+ declare function parseObserveCredential(raw: string): ObserveCredential | null;
279
+ /**
280
+ * Read the server arm's connect config from an env record. Callers pass their
281
+ * own env (e.g. `process.env`); core never reads globals. Returns an
282
+ * `ObserveServer` only when the full trio (`WALKEROS_OBSERVER_URL`,
283
+ * `WALKEROS_DEPLOYMENT_ID`, `WALKEROS_INGEST_TOKEN`) is present, carrying
284
+ * `WALKEROS_OBSERVE_LEVEL` into `level`. An explicitly set level that names
285
+ * no known value (e.g. a typo'd `offf`) rejects the whole config: silently
286
+ * observing at the default `standard` against a probable opt-out intent is
287
+ * the one failure mode this parser must never produce. Otherwise undefined:
288
+ * an unconfigured deployment does zero observation work.
289
+ */
290
+ declare function observeFromEnv(env: Record<string, string | undefined>): ObserveServer | undefined;
291
+
227
292
  /**
228
293
  * FlowState is the canonical observation record emitted at each hop in a
229
294
  * walkerOS pipeline. Telemetry helpers populate one of these per (step,
@@ -264,6 +329,8 @@ interface FlowState {
264
329
  sourceId?: string;
265
330
  /** Per-poster monotonic record counter for gap detection. Stamped by the batched poster, not emitters. */
266
331
  seq?: number;
332
+ /** Release provenance of the runtime that produced this state, e.g. a deployment id. Stamped by the wiring layer, not emitters. */
333
+ release?: string;
267
334
  /**
268
335
  * Vendor calls recorded via wrapEnv on destination out records. Captured only
269
336
  * at trace level and only when the destination declares a `calls` list
@@ -404,6 +471,20 @@ interface InitConfig extends Partial<Config$6> {
404
471
  custom?: Properties;
405
472
  /** Hooks for pipeline observation and interception */
406
473
  hooks?: Functions;
474
+ /**
475
+ * Observation session connect config, wired by `startFlow` before the run
476
+ * command. The server form attaches a telemetry poster directly from its
477
+ * config trio; the web form attaches only when an `elbObserve` credential
478
+ * is present (URL param or storage slot) and its binding matches. Purely
479
+ * advisory: nothing on this path can affect event processing.
480
+ */
481
+ observe?: Observe;
482
+ /**
483
+ * Caller-supplied observers, added verbatim to `collector.observers` by
484
+ * `startFlow`. Escape hatch for custom emit targets; same advisory
485
+ * contract as every observer (thrown values are swallowed by emitStep).
486
+ */
487
+ observers?: ObserverFn[];
407
488
  }
408
489
  interface SessionData extends Properties {
409
490
  isStart: boolean;
@@ -1751,6 +1832,19 @@ declare namespace Flow {
1751
1832
  level?: 'off' | 'standard' | 'trace';
1752
1833
  /** Deterministic sample fraction in [0, 1]. Defaults to 1. */
1753
1834
  sample?: number;
1835
+ /**
1836
+ * Observer base URL for the web connect form. Public, safe to commit.
1837
+ * When `url` and `binding` are both set on a web flow, the bundler bakes
1838
+ * exactly this pair into the generated startFlow config; the runtime
1839
+ * attaches only when an out-of-band `elbObserve` credential is present.
1840
+ * Secrets never live in flow config.
1841
+ */
1842
+ url?: string;
1843
+ /**
1844
+ * Public project binding a web observe credential must match. Paired
1845
+ * with `url`; public, safe to commit.
1846
+ */
1847
+ binding?: string;
1754
1848
  }
1755
1849
  /**
1756
1850
  * Reusable values referenced via `$var.name` (with optional deep paths).
@@ -4489,6 +4583,16 @@ interface SwapActivatorConfig {
4489
4583
  * stored activation clears.
4490
4584
  */
4491
4585
  declare const SESSION_STORAGE_KEY = "elbPreviewSession";
4586
+ /**
4587
+ * Storage slot for the observe ingest credential companion (`obsw_...`), a
4588
+ * plaintext bearer credential riding the activation URL. The web arm never
4589
+ * verifies it (the observer is its verifier): the activator only ferries it
4590
+ * from the activation URL into storage, where the observe wiring reads it to
4591
+ * attach to the observation session. Same lifecycle as the session companion:
4592
+ * set (or cleared) whenever a URL activation succeeds, cleared whenever the
4593
+ * stored activation clears.
4594
+ */
4595
+ declare const OBSERVE_STORAGE_KEY = "elbObserve";
4492
4596
  /**
4493
4597
  * Decide whether a preview bundle should boot in place of this bundle's own flow.
4494
4598
  *
@@ -4568,8 +4672,21 @@ type PosterFetch = (url: string, init: {
4568
4672
  headers: Record<string, string>;
4569
4673
  body: string;
4570
4674
  }) => Promise<PosterResponse>;
4675
+ /**
4676
+ * Versioned ingest wire format. Every POST body is one envelope; a batch
4677
+ * split into multiple chunks posts one complete envelope per chunk. The
4678
+ * version field lets the observer evolve its parse without sniffing shapes:
4679
+ * runtimes pinned to this poster keep emitting `v: 1` and the server keeps
4680
+ * accepting it.
4681
+ */
4682
+ interface IngestEnvelope {
4683
+ /** Wire format version. */
4684
+ v: 1;
4685
+ /** FlowState records in arrival order, each stamped with a seq. */
4686
+ records: FlowState[];
4687
+ }
4571
4688
  interface BatchedPosterOptions {
4572
- /** Absolute HTTP endpoint URL. POST with JSON array body. */
4689
+ /** Absolute HTTP endpoint URL. POST with a versioned envelope JSON body. */
4573
4690
  url: string;
4574
4691
  /** Bearer token sent in the `Authorization` header. */
4575
4692
  token: string;
@@ -4587,6 +4704,20 @@ interface BatchedPosterOptions {
4587
4704
  fetch?: PosterFetch;
4588
4705
  /** Called when the underlying POST rejects. Defaults to swallowing. */
4589
4706
  onError?: (err: unknown) => void;
4707
+ /**
4708
+ * Extra headers merged into every request (e.g. `X-Walkeros-Binding`).
4709
+ * The fixed `Content-Type` and `Authorization` headers win on collision,
4710
+ * matched case-insensitively (header names are case-insensitive on the
4711
+ * wire, so a lowercase `authorization` is dropped too).
4712
+ */
4713
+ headers?: Record<string, string>;
4714
+ /**
4715
+ * Called with the HTTP status of every response, before any non-2xx
4716
+ * error handling. Lets callers react to a 401/404 (stop posting,
4717
+ * self-heal) without parsing error strings. Not called when the fetch
4718
+ * rejects, since no response exists.
4719
+ */
4720
+ onStatus?: (status: number) => void;
4590
4721
  }
4591
4722
  /**
4592
4723
  * Build a batched emit callback. The returned function is synchronous, never
@@ -5040,4 +5171,4 @@ declare const REF_CODE_PREFIX = "$code:";
5040
5171
  */
5041
5172
  declare function scanFlowRefs(value: unknown, into?: Set<string>): Set<string>;
5042
5173
 
5043
- export { type ActivationGrant, type AssembleJourneysOptions, type BatchedPosterOptions, type BreakerState, CLOCK_SKEW_MS, cache as Cache, type CacheEnvelope, type CacheResult, type ClickIdEntry, collector as Collector, type CompiledCache, Const, context as Context, type Credential, type Debounced, destination as Destination, type DestroyContext, type DestroyFn, type DroppedCounters, ENV_MARKER_PREFIX, elb as Elb, type EmitFn, type ExampleSummary, FatalError, Flow, type FlowConfigResolver, type FlowState, type FlowStateBatch, type FlowStatePhase, type FlowStepType, type GetStore, hint as Hint, hooks as Hooks, type Ingest, type IngestMeta, type Journey, type JourneyAssembly, type JourneyBranch, type JourneyCorrelation, type JourneyEntry, type JourneyGap, type JourneyHop, type JourneyHopStatus, type JourneyPlatform, type JourneyStatus, type JourneyTopology, type JourneyTopologyNode, type JsonSchema, Level, lifecycle as Lifecycle, type LifecycleContext, logger as Logger, MAX_SESSION_MS, mapping as Mapping, type MarketingParameters, matcher as Matcher, type MockLogger, OBSERVE_ENV_KEY, type ObserverFn, on as On, type ParsedGrant, type ParsedTraceparent, type PosterFetch, type PosterResponse, type PreviewCrypto, type PreviewFailure, type PreviewKey, type PreviewSubtle, REF_CODE_PREFIX, REF_CONTRACT, REF_ENV, REF_FLOW, REF_SECRET, REF_STORE, REF_VAR_FULL, REF_VAR_INLINE, request as Request, type ResolveContractsOptions, type ResolveOptions, type RespondFn, type RespondOptions, SECRET_MARKER_PREFIX, SESSION_STORAGE_KEY, STEP_OPERATIVE_FIELDS, type ScheduleOptions, type SendDataValue, type SendHeaders, type SendResponse, type ServiceAccount, type SetupFn, simulation as Simulation, source as Source, type State, type StepEntryErrorCode, type StepEntryValidation, type StepKind, type StorageType, store as Store, StoreCodecError, type SwapActivatorConfig, type TelemetryLevel, type TelemetryOptions, type TelemetryOptionsSupplier, transformer as Transformer, trigger as Trigger, URL_WINDOW_MS, type ValidateEvents, type VerifyParams, type VerifyResult, walkeros as WalkerOS, type WalkerOSPackage, type WalkerOSPackageInfo, type WalkerOSPackageMeta, anonymizeIP, applyState, applyUpdate, assembleJourneys, assign, branch, browserSwapActivator, buildCacheContext, castToProperty, castValue, checkCache, clone, compileCache, compileMatcher, compileState, createBatchedPoster, createDestination, createEvent, createIngest, createLogger, createMockContext, createMockLogger, createRespond, createTelemetryObserver, debounce, deepMerge, defaultClickIds, deleteByPath, deserializeStoreValue, emitStep, fetchPackage, fetchPackageSchema, filterValues, flattenIncludeSections, formatOut, getBrowser, getBrowserVersion, getByPath, getDeviceType, getEvent, getFlowSettings, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getNextSteps, getOS, getOSVersion, getPlatform, getSpanId, getTraceId, getTraceUntil, isArguments, isArray, isBoolean, isCommand, isDefined, isElementOrDocument, isEnvObserve, isFunction, isNumber, isObject, isPathStepEntry, isPropertyType, isRouteArray, isRouteConfigEntry, isSameType, isSampled, isStoreValue, isString, mcpError, mcpResult, mergeContractSchemas, mergeMappingRule, mockEnv, packageNameToVariable, parseCallPath, parseGrant, parseTraceparent, parseUserAgent, processEventMapping, readCacheEnvelope, requestToData, requestToParameter, resolveContracts, resolveSetup, resolveTelemetryOptions, scanFlowRefs, serializeStoreValue, setByPath, setTraceUntil, stepId, storeCache, throttle, throwError, transformData, traverseEnv, trim, tryCatch, tryCatchAsync, useHooks, validateStepEntry, verifyActivation, walkPath, wrapCacheEnvelope, wrapCondition, wrapFn, wrapValidate };
5174
+ export { type ActivationGrant, type AssembleJourneysOptions, type BatchedPosterOptions, type BreakerState, CLOCK_SKEW_MS, cache as Cache, type CacheEnvelope, type CacheResult, type ClickIdEntry, collector as Collector, type CompiledCache, Const, context as Context, type Credential, type Debounced, destination as Destination, type DestroyContext, type DestroyFn, type DroppedCounters, ENV_MARKER_PREFIX, elb as Elb, type EmitFn, type ExampleSummary, FatalError, Flow, type FlowConfigResolver, type FlowState, type FlowStateBatch, type FlowStatePhase, type FlowStepType, type GetStore, hint as Hint, hooks as Hooks, type Ingest, type IngestEnvelope, type IngestMeta, type Journey, type JourneyAssembly, type JourneyBranch, type JourneyCorrelation, type JourneyEntry, type JourneyGap, type JourneyHop, type JourneyHopStatus, type JourneyPlatform, type JourneyStatus, type JourneyTopology, type JourneyTopologyNode, type JsonSchema, Level, lifecycle as Lifecycle, type LifecycleContext, logger as Logger, MAX_SESSION_MS, mapping as Mapping, type MarketingParameters, matcher as Matcher, type MockLogger, OBSERVE_ENV_KEY, OBSERVE_STORAGE_KEY, type Observe, type ObserveCredential, type ObserveServer, type ObserveWeb, type ObserverFn, on as On, type ParsedGrant, type ParsedTraceparent, type PosterFetch, type PosterResponse, type PreviewCrypto, type PreviewFailure, type PreviewKey, type PreviewSubtle, REF_CODE_PREFIX, REF_CONTRACT, REF_ENV, REF_FLOW, REF_SECRET, REF_STORE, REF_VAR_FULL, REF_VAR_INLINE, request as Request, type ResolveContractsOptions, type ResolveOptions, type RespondFn, type RespondOptions, SECRET_MARKER_PREFIX, SESSION_STORAGE_KEY, STEP_OPERATIVE_FIELDS, type ScheduleOptions, type SendDataValue, type SendHeaders, type SendResponse, type ServiceAccount, type SetupFn, simulation as Simulation, source as Source, type State, type StepEntryErrorCode, type StepEntryValidation, type StepKind, type StorageType, store as Store, StoreCodecError, type SwapActivatorConfig, type TelemetryLevel, type TelemetryOptions, type TelemetryOptionsSupplier, transformer as Transformer, trigger as Trigger, URL_WINDOW_MS, type ValidateEvents, type VerifyParams, type VerifyResult, walkeros as WalkerOS, type WalkerOSPackage, type WalkerOSPackageInfo, type WalkerOSPackageMeta, anonymizeIP, applyState, applyUpdate, assembleJourneys, assign, branch, browserSwapActivator, buildCacheContext, castToProperty, castValue, checkCache, clone, compileCache, compileMatcher, compileState, createBatchedPoster, createDestination, createEvent, createIngest, createLogger, createMockContext, createMockLogger, createRespond, createTelemetryObserver, debounce, deepMerge, defaultClickIds, deleteByPath, deserializeStoreValue, emitStep, fetchPackage, fetchPackageSchema, filterValues, flattenIncludeSections, formatOut, getBrowser, getBrowserVersion, getByPath, getDeviceType, getEvent, getFlowSettings, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getNextSteps, getOS, getOSVersion, getPlatform, getSpanId, getTraceId, getTraceUntil, isArguments, isArray, isBoolean, isCommand, isDefined, isElementOrDocument, isEnvObserve, isFunction, isNumber, isObject, isPathStepEntry, isPropertyType, isRouteArray, isRouteConfigEntry, isSameType, isSampled, isStoreValue, isString, mcpError, mcpResult, mergeContractSchemas, mergeMappingRule, mockEnv, observeFromEnv, packageNameToVariable, parseCallPath, parseGrant, parseObserveCredential, parseTraceparent, parseUserAgent, processEventMapping, readCacheEnvelope, requestToData, requestToParameter, resolveContracts, resolveSetup, resolveTelemetryOptions, scanFlowRefs, serializeStoreValue, setByPath, setTraceUntil, stepId, storeCache, throttle, throwError, transformData, traverseEnv, trim, tryCatch, tryCatchAsync, useHooks, validateStepEntry, verifyActivation, walkPath, wrapCacheEnvelope, wrapCondition, wrapFn, wrapValidate };