@voltro/runtime 0.75.0 → 0.77.0

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.ts CHANGED
@@ -128,6 +128,7 @@ import { WorkflowControlRequest } from '@voltro/workflow';
128
128
  import { WorkflowControlResult as WorkflowControlResult_2 } from '@voltro/protocol';
129
129
  import { WorkflowParentClosePolicy } from '@voltro/protocol';
130
130
  import { WorkflowQueuedCancellationResult } from '@voltro/protocol';
131
+ import { WorkflowRetryObservation } from '@voltro/protocol';
131
132
  import { WorkflowRunHandle } from '@voltro/protocol';
132
133
  import { WorkflowRunSnapshot as WorkflowRunSnapshot_2 } from '@voltro/protocol';
133
134
  import { WorkflowStartResolution } from '@voltro/workflow';
@@ -1843,6 +1844,13 @@ export declare const bindSubscriptionUntyped: (descriptor: QueryDescriptor, disp
1843
1844
  readonly reconcile?: string;
1844
1845
  }) => Stream.Stream<SubscriptionEvent<ReadonlyArray<Row>>, never, never>;
1845
1846
 
1847
+ export declare const BOOT_REFUSAL_NAME = "VoltroBootRefusal";
1848
+
1849
+ /** An error the boot path raised on purpose. The launcher prints its message
1850
+ * once and exits 1 instead of degrading to a fallback path or printing a
1851
+ * stack. */
1852
+ export declare const bootRefusal: (message: string) => Error;
1853
+
1846
1854
  export declare interface BrandedScheduleDefinition extends ScheduleDefinition {
1847
1855
  readonly [SCHEDULE_BRAND]: true;
1848
1856
  }
@@ -2502,6 +2510,27 @@ export declare interface CoordinatedScheduleDeps {
2502
2510
  readonly disarmWhenIdle?: boolean;
2503
2511
  }
2504
2512
 
2513
+ export declare interface CoordinatedScheduleDiagnostics {
2514
+ readonly task: string;
2515
+ readonly state: 'armed' | 'running' | 'disarmed' | 'externalized' | 'stopped';
2516
+ readonly baseIntervalMs: number;
2517
+ readonly currentIntervalMs: number;
2518
+ readonly maxIdleIntervalMs: number;
2519
+ readonly nextTickAt: number | null;
2520
+ readonly disarmWhenIdle: boolean;
2521
+ readonly ticks: number;
2522
+ readonly claimWins: number;
2523
+ readonly claimLosses: number;
2524
+ readonly claimFailures: number;
2525
+ readonly taskFailures: number;
2526
+ readonly wakes: number;
2527
+ readonly coalescedWakes: number;
2528
+ readonly lastTickAt: number | null;
2529
+ readonly lastWakeAt: number | null;
2530
+ readonly lastDecision: 'starting' | 'idle-backoff' | 'idle-disarmed' | 'active' | 'claim-lost' | 'claim-failed' | 'task-failed' | 'wake';
2531
+ readonly lastOutcome: CoordinatedTickOutcome | null;
2532
+ }
2533
+
2505
2534
  export declare interface CoordinatedScheduleHandle {
2506
2535
  /** Stop the periodic task. Idempotent. */
2507
2536
  readonly stop: () => void;
@@ -3480,6 +3509,8 @@ export declare const deliveredRowCount: (value: unknown) => number;
3480
3509
  */
3481
3510
  export declare const deriveKey: (passphrase: string) => Buffer;
3482
3511
 
3512
+ export declare const describeOtelReasons: (why: OtelNeededBecause) => ReadonlyArray<string>;
3513
+
3483
3514
  /**
3484
3515
  * Detach a live subscription for possible resume. The sink is redirected to
3485
3516
  * ring-recording only; after the window the subscription is truly
@@ -4715,6 +4746,8 @@ export declare interface ExpectationState {
4715
4746
  readonly name: string;
4716
4747
  readonly table: string;
4717
4748
  readonly invariant: ExpectationInvariant['kind'];
4749
+ /** Full declarative condition used by the evaluator. */
4750
+ readonly rule: ExpectationInvariant;
4718
4751
  readonly severity: ExpectationSeverity;
4719
4752
  readonly status: ExpectationStatus;
4720
4753
  /** The measured metric: freshness → age in ms; nullRate / valueBounds(rate) →
@@ -5651,6 +5684,10 @@ export declare const insertManyRowsEffect: <T extends AnyWritableTable>(store: E
5651
5684
  */
5652
5685
  export declare const insertRowEffect: <T extends AnyWritableTable>(store: EffectInsertStore, table: T, row: InferInsertRow<T>) => Effect.Effect<InferRow<T>, StoreError>;
5653
5686
 
5687
+ /** Process-local counters, not fleet totals. Unknown/custom handles return null.
5688
+ * Reading never ticks, claims, queries storage, or exposes task payloads/errors. */
5689
+ export declare const inspectCoordinatedSchedule: (handle: Pick<CoordinatedScheduleHandle, "stop" | "wake">) => CoordinatedScheduleDiagnostics | null;
5690
+
5654
5691
  export { InspectedStep }
5655
5692
 
5656
5693
  export { InspectedWorkflow }
@@ -5663,6 +5700,9 @@ export { InspectedWorkflow }
5663
5700
  * dep on the cli's manifest shape.
5664
5701
  */
5665
5702
  export declare interface InspectRoute {
5703
+ /** Exact binary paths are dispatched before UTF-8 body decoding. Each
5704
+ * handler owns authentication and bounded consumption of its byte stream. */
5705
+ readonly binary?: Readonly<Record<string, (url: string, headers: Readonly<Record<string, string>>, method: string, body: ReadableStream<Uint8Array>, signal: AbortSignal) => Promise<Awaited<ReturnType<InspectRoute['handle']>>>>>;
5666
5706
  /** Synchronous handler taking the full request URL (e.g.
5667
5707
  * `/_voltro/inspect/app`) and returning the response triple.
5668
5708
  * Returns `null` only for non-inspect paths, which can't happen
@@ -5817,6 +5857,8 @@ export declare const ipToBytes: (ip: string) => Uint8Array | undefined;
5817
5857
 
5818
5858
  export declare const isAggregateDefinition: (value: unknown) => value is AggregateDefinition;
5819
5859
 
5860
+ export declare const isBootRefusal: (error: unknown) => boolean;
5861
+
5820
5862
  export declare const isCompressibleContentType: (contentType: string | undefined) => boolean;
5821
5863
 
5822
5864
  export declare const isCostBudgetDefinition: (value: unknown) => value is CostBudgetDefinition;
@@ -7408,7 +7450,50 @@ export declare type OriginGuardMode = 'off' | 'same-origin';
7408
7450
  * that relabels every failure is how a diagnosis gets buried — the same reason
7409
7451
  * the serve bundle marks its deliberate refusals instead of swallowing throws.
7410
7452
  */
7411
- export declare const otelImportFailure: (cause: unknown) => Error;
7453
+ export declare const otelImportFailure: (cause: unknown, reasons?: ReadonlyArray<string>) => Error;
7454
+
7455
+ /**
7456
+ * `@effect/opentelemetry` is an OPTIONAL peer, so this import can legitimately
7457
+ * fail — and the failure has to be readable.
7458
+ *
7459
+ * Why it is optional: it is reached only from here, only when tracing is on,
7460
+ * and it declares SEVEN non-optional OpenTelemetry peers of its own, two of
7461
+ * which we do not supply (`@opentelemetry/sdk-logs`, and
7462
+ * `@opentelemetry/sdk-trace-web`, which is the BROWSER tracer and has no
7463
+ * business in a server dependency). Carrying it as a hard dependency printed 24
7464
+ * lines of unmet-peer warnings on every `pnpm install` of every consumer,
7465
+ * describing a condition that broke nothing.
7466
+ *
7467
+ * A deployment's argument for why that is worth fixing is the one that decided
7468
+ * it: *"a check that is loud on every upgrade teaches people to skip the
7469
+ * output, and the next warning in that block is the one that matters. We read
7470
+ * past this one for four releases."*
7471
+ *
7472
+ * The trade is that an app which turns tracing ON without installing it now
7473
+ * gets an error instead of a warning — so this message has to name the exact
7474
+ * install, not surface a bare `ERR_MODULE_NOT_FOUND` for a package the app
7475
+ * never wrote down.
7476
+ */
7477
+ /**
7478
+ * Why the OpenTelemetry SDK is about to be loaded — one line per cause, each
7479
+ * with the switch that removes it. Computed by `buildTracingLayer` from the
7480
+ * same predicates that decide whether the SDK is needed at all, so the message
7481
+ * cannot claim a cause the layer did not act on.
7482
+ *
7483
+ * The first shipped message said "tracing is enabled … turn it off:
7484
+ * FRAMEWORK_TRACING=off". Measured with the package hidden: `voltro dev` with
7485
+ * NO tracing variable set refuses on that line, because dev arms its trace ring
7486
+ * unconditionally — and `FRAMEWORK_TRACING=off` does nothing to the ring. The
7487
+ * reader was told the wrong knob for the only cause that applied.
7488
+ */
7489
+ export declare interface OtelNeededBecause {
7490
+ readonly mode: TracingMode;
7491
+ readonly metricsMode: MetricsMode;
7492
+ readonly traceSink: boolean;
7493
+ readonly traceSinkOrigin?: string | undefined;
7494
+ readonly pluginSpanProcessors: number;
7495
+ readonly pluginMetricReaders: number;
7496
+ }
7412
7497
 
7413
7498
  /**
7414
7499
  * Retention, part 1 of 2 — the PER-ENTRY cap.
@@ -11859,6 +11944,12 @@ export declare interface TracingOptions {
11859
11944
  * tracer layer instead of `Layer.empty` — so dashboards work without
11860
11945
  * forcing console/otlp export. */
11861
11946
  readonly traceSink?: SpanProcessor;
11947
+ /** What armed `traceSink`, and how to disarm it — in the caller's words,
11948
+ * because the runtime cannot know whether the sink is `voltro dev`'s
11949
+ * always-on ring or `voltro serve`'s opt-in one, and a refusal that names
11950
+ * the wrong switch sends the reader to change a variable that does nothing.
11951
+ * Printed only when the OpenTelemetry SDK turns out to be missing. */
11952
+ readonly traceSinkOrigin?: string;
11862
11953
  /** Override the metrics-export env resolution. */
11863
11954
  readonly metricsMode?: MetricsMode;
11864
11955
  /** Export interval in ms for the periodic metric reader. Defaults to
@@ -12712,11 +12803,13 @@ export declare interface WorkflowFacadeOptions {
12712
12803
  * facade builder, which owns the `_voltro_workflow_runs` store query;
12713
12804
  * the runtime stays storage-agnostic (same shape as `signal`/`update`). */
12714
12805
  readonly listRuns?: (filter: WorkflowRunListFilter | undefined) => Promise<ReadonlyArray<WorkflowRunSummary>>;
12806
+ /** Read a persisted retry observation without dispatching work. */
12807
+ readonly readRetry?: (runId: string, requestId: string) => Promise<WorkflowRetryObservation>;
12715
12808
  /** Backs {@link WorkflowsAppContext.retry}. Supplied by the CLI's facade
12716
12809
  * builder, which owns the runs store + workflow registry resolution.
12717
12810
  * Inspect HTTP + the `voltro workflows retry` CLI delegate to the same
12718
12811
  * implementation. */
12719
- readonly retry?: (runId: string, options: WorkflowRetryOptions | undefined) => Promise<WorkflowRetryResult>;
12812
+ readonly retry?: (runId: string, options: WorkflowRetryOptions) => Promise<WorkflowRetryResult>;
12720
12813
  /** Backs {@link WorkflowsAppContext.redrive}. Supplied by the CLI's facade
12721
12814
  * builder, which owns the runs/steps store query + the cluster journal
12722
12815
  * adapter. Inspect HTTP + `voltro workflows redrive` delegate to the same
@@ -12902,17 +12995,16 @@ export declare interface WorkflowRedriveResult {
12902
12995
 
12903
12996
  /** Options for {@link WorkflowsAppContext.retry}. */
12904
12997
  export declare interface WorkflowRetryOptions {
12998
+ /** Persist once per deliberate retry and reuse after a lost response. */
12999
+ readonly requestId: string;
12905
13000
  /** Re-run the workflow against this payload instead of the original
12906
13001
  * run's recorded payload. Lets a handler replay a failed run against
12907
13002
  * a corrected input without reading the stored payload first. */
12908
13003
  readonly payloadOverride?: unknown;
12909
13004
  }
12910
13005
 
12911
- /** Result of {@link WorkflowsAppContext.retry} — the engine-assigned
12912
- * execution id of the freshly started run. */
12913
- export declare interface WorkflowRetryResult {
12914
- readonly executionId: string;
12915
- }
13006
+ /** Durable retry observation; engine acceptance is not execution completion. */
13007
+ export declare type WorkflowRetryResult = WorkflowRetryObservation;
12916
13008
 
12917
13009
  /**
12918
13010
  * May `caller` read — or control — a row owned by `rowSubject`? The ONE
@@ -13085,7 +13177,9 @@ export declare interface WorkflowsAppContext {
13085
13177
  * primary key, not the engine execution id). Resolves the original
13086
13178
  * workflow by tag and re-executes it; pass `payloadOverride` to replay
13087
13179
  * against a corrected input. */
13088
- retry(runId: string, options?: WorkflowRetryOptions): Promise<WorkflowRetryResult>;
13180
+ retry(runId: string, options: WorkflowRetryOptions): Promise<WorkflowRetryResult>;
13181
+ /** Observe a durable retry intent without submitting another attempt. */
13182
+ readRetry(runId: string, requestId: string): Promise<WorkflowRetryObservation>;
13089
13183
  /** Re-drive a terminally-`failed` run from the step it died on, reusing
13090
13184
  * its durable journal — the counterpart to {@link retry} (fresh execution,
13091
13185
  * empty journal) and to {@link resume} (which only re-drives a *suspended*