@voltro/protocol 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
@@ -496,7 +496,7 @@ export declare interface AuthenticatedGuardSpec {
496
496
  * an auth resolver before reaching its handler. The application provides
497
497
  * the resolver via `Layer.succeed(AuthMiddleware, AuthMiddleware.of(fn))`,
498
498
  * where `fn` receives `{headers, payload, rpc, clientId}` and returns an
499
- * `Effect<Subject>` — typically by inspecting headers / Bearer token and
499
+ * `Effect<Subject, Unauthenticated>` — typically by inspecting headers / Bearer token and
500
500
  * looking the caller up.
501
501
  *
502
502
  * `provides: SubjectService` means the resolver's return value is placed
@@ -514,6 +514,7 @@ export declare class AuthMiddleware extends AuthMiddleware_base {
514
514
 
515
515
  declare const AuthMiddleware_base: RpcMiddleware.TagClass<AuthMiddleware, "@voltro/AuthMiddleware", {
516
516
  readonly provides: typeof SubjectService;
517
+ readonly failure: typeof Unauthenticated;
517
518
  }>;
518
519
 
519
520
  export declare type AuthRouteHandler = (req: AuthRouteRequest) => Promise<AuthRouteResponse>;
@@ -5414,11 +5415,21 @@ export declare type StoreError = TenantScopeViolation | TenantRowNotFound | Serv
5414
5415
 
5415
5416
  /**
5416
5417
  * Anything else the underlying `DataStore` raised during a write or
5417
- * query. `cause` is the stringified original error — sufficient for
5418
- * logs + UI, doesn't try to serialise complex error chains across the
5419
- * rpc boundary. The `_tag` discriminator stays cheap to pattern-match.
5418
+ * query. `cause` is a bounded description of the original error —
5419
+ * sufficient for logs + UI, doesn't try to serialise complex error chains
5420
+ * across the rpc boundary. The `_tag` discriminator stays cheap to
5421
+ * pattern-match.
5420
5422
  */
5421
5423
  export declare class StoreOperationFailed extends StoreOperationFailed_base {
5424
+ /**
5425
+ * A sentence built from the fields, for the same reason `ConstraintViolation`
5426
+ * has one: without it the generated message is a JSON rendering of the
5427
+ * fields — `{ "operation": "query", "table": "x", "cause": "…" }` — which is
5428
+ * what a test reporter, `Cause.pretty` and an undeclared-error envelope all
5429
+ * print. The sentence in `cause` is the half a reader needs, and it should
5430
+ * read as one.
5431
+ */
5432
+ get message(): string;
5422
5433
  }
5423
5434
 
5424
5435
  declare const StoreOperationFailed_base: Schema.TaggedErrorClass<StoreOperationFailed, "StoreOperationFailed", {
@@ -5429,10 +5440,21 @@ declare const StoreOperationFailed_base: Schema.TaggedErrorClass<StoreOperationF
5429
5440
  /** The table the op targeted. */
5430
5441
  table: typeof Schema.String;
5431
5442
  /**
5432
- * A BOUNDED description: the constraint kind and its constraint/column
5433
- * NAME, or the driver's code. Never the driver's sentence and never a
5434
- * stack — `wireSafeCause` builds it, and the reasoning is there. The full
5435
- * detail is logged server-side instead.
5443
+ * A BOUNDED description of what went wrong.
5444
+ *
5445
+ * One of two things, and which one is decided by who wrote the text:
5446
+ *
5447
+ * - A sentence the FRAMEWORK authored — "cannot eager-load on 'x': no
5448
+ * relations registered. Did you forget to declare `relations(x, …)`
5449
+ * or import the file that does?" — travels whole. Such a sentence
5450
+ * names code and schema and nothing else, and is checked by the
5451
+ * tests that produce it.
5452
+ * - Anything the DRIVER raised is reduced to its class and its code
5453
+ * (`SqlError (23505)`, `Error (ECONNREFUSED)`). Never the driver's
5454
+ * sentence and never a stack: on several dialects that sentence
5455
+ * contains the failing row, and a connection error's contains the
5456
+ * socket address. `wireSafeCause` in `@voltro/database` builds it,
5457
+ * and the reasoning is there. The full detail is logged server-side.
5436
5458
  */
5437
5459
  cause: typeof Schema.String;
5438
5460
  }>;
@@ -6720,8 +6742,14 @@ export declare interface VoltroTableNames {
6720
6742
  /** What a gateway's connection handler receives. Transport-agnostic on
6721
6743
  * purpose — the runtime adapts the platform socket to this. */
6722
6744
  export declare interface WebSocketGatewayConnection {
6723
- /** Send a text or binary frame. */
6745
+ /** Enqueue a bounded text or binary frame; overflow closes the connection. */
6724
6746
  readonly send: (data: string | Uint8Array) => void;
6747
+ /** Await the local transport write, NOT peer receipt. Rejects on close or
6748
+ * overflow. Await each send to propagate backpressure to the producer. */
6749
+ readonly sendAsync: (data: string | Uint8Array) => Promise<void>;
6750
+ /** Aborted on close, expiry, shutdown or setup failure, including while
6751
+ * onConnection is still awaiting an upstream connection. */
6752
+ readonly signal: AbortSignal;
6725
6753
  /** Close the connection (application close codes 4000-4999 are yours). */
6726
6754
  readonly close: (code?: number, reason?: string) => void;
6727
6755
  /** Register a message listener (binary-safe; text arrives as bytes). */
@@ -6749,12 +6777,23 @@ export declare interface WebSocketGatewayRoute {
6749
6777
  * protocol-level auth). A decision somebody wrote down, not a default.
6750
6778
  */
6751
6779
  readonly auth: 'subject' | 'public';
6780
+ /** Per-connection bounds. Inbound size is checked before app dispatch,
6781
+ * not before the platform assembles a WebSocket message. */
6782
+ readonly limits?: {
6783
+ /** Maximum inbound/outbound frame bytes; default 1 MiB. */
6784
+ readonly maxMessageBytes?: number;
6785
+ /** Active plus queued outbound bytes; default 4 MiB. */
6786
+ readonly maxPendingBytes?: number;
6787
+ /** Active plus queued outbound messages; default 64. */
6788
+ readonly maxPendingMessages?: number;
6789
+ };
6752
6790
  /**
6753
6791
  * Runs once per accepted connection. The returned function is the
6754
6792
  * connection's TEARDOWN — taken at construction (the `startOutboxRunner`
6755
6793
  * rule): it runs on client disconnect, on credential expiry, and on
6756
6794
  * server shutdown, so whatever the handler opened cannot outlive the
6757
- * socket.
6795
+ * socket. Message listeners are live during async setup. If setup finishes
6796
+ * after disconnect, its returned teardown still runs exactly once.
6758
6797
  */
6759
6798
  readonly onConnection: (connection: WebSocketGatewayConnection) => void | (() => void) | Promise<void | (() => void)>;
6760
6799
  }
@@ -7321,6 +7360,85 @@ export declare const workflowResumeDescriptor: ActionProcedureDescriptor<"__volt
7321
7360
  }>;
7322
7361
  }>>, typeof Schema.Never>;
7323
7362
 
7363
+ export declare type WorkflowRetryCommand = typeof WorkflowRetryCommandSchema.Type;
7364
+
7365
+ /** Transport input for one deliberate retry; ownership is resolved server-side.
7366
+ * The optional override is encoded with the complete workflow payload schema. */
7367
+ export declare const WorkflowRetryCommandSchema: Schema.Struct<{
7368
+ payloadOverride: Schema.optional<typeof Schema.Unknown>;
7369
+ runId: Schema.filter<typeof Schema.NonEmptyString>;
7370
+ requestId: Schema.filter<typeof Schema.NonEmptyString>;
7371
+ }>;
7372
+
7373
+ export declare type WorkflowRetryObservation = typeof WorkflowRetryObservationSchema.Type;
7374
+
7375
+ /** Observation of one durable retry intent. Engine acceptance is not workflow
7376
+ * completion. A prepared identity alone never proves that execution started. */
7377
+ export declare const WorkflowRetryObservationSchema: Schema.Union<[Schema.Struct<{
7378
+ kind: Schema.Literal<["queued"]>;
7379
+ nextAttemptAt: Schema.NullOr<typeof Schema.Number>;
7380
+ requestId: typeof Schema.NonEmptyString;
7381
+ originalRunId: typeof Schema.NonEmptyString;
7382
+ originalExecutionId: typeof Schema.NonEmptyString;
7383
+ workflowName: typeof Schema.NonEmptyString;
7384
+ }>, Schema.filter<Schema.Struct<{
7385
+ kind: Schema.Literal<["accepted"]>;
7386
+ executionId: typeof Schema.NonEmptyString;
7387
+ requestId: typeof Schema.NonEmptyString;
7388
+ originalRunId: typeof Schema.NonEmptyString;
7389
+ originalExecutionId: typeof Schema.NonEmptyString;
7390
+ workflowName: typeof Schema.NonEmptyString;
7391
+ }>>, Schema.filter<Schema.Struct<{
7392
+ kind: Schema.Literal<["unconfirmed"]>;
7393
+ automaticRetryStopped: typeof Schema.Boolean;
7394
+ nextAttemptAt: Schema.NullOr<typeof Schema.Number>;
7395
+ requestId: typeof Schema.NonEmptyString;
7396
+ originalRunId: typeof Schema.NonEmptyString;
7397
+ originalExecutionId: typeof Schema.NonEmptyString;
7398
+ workflowName: typeof Schema.NonEmptyString;
7399
+ }>>, Schema.Struct<{
7400
+ kind: Schema.Literal<["not-started"]>;
7401
+ outcome: Schema.Union<[Schema.Struct<{
7402
+ kind: Schema.Literal<["dropped"]>;
7403
+ at: typeof Schema.Number;
7404
+ retryAfterMs: typeof Schema.Number;
7405
+ }>, Schema.Struct<{
7406
+ kind: Schema.Literal<["skipped"]>;
7407
+ at: typeof Schema.Number;
7408
+ executionId: typeof Schema.String;
7409
+ runId: typeof Schema.String;
7410
+ }>, Schema.Struct<{
7411
+ kind: Schema.Literal<["superseded"]>;
7412
+ at: typeof Schema.Number;
7413
+ }>, Schema.Struct<{
7414
+ kind: Schema.Literal<["cancelled"]>;
7415
+ at: typeof Schema.Number;
7416
+ }>, Schema.Struct<{
7417
+ kind: Schema.Literal<["abandoned"]>;
7418
+ at: typeof Schema.Number;
7419
+ failureId: typeof Schema.NonEmptyString;
7420
+ }>]>;
7421
+ requestId: typeof Schema.NonEmptyString;
7422
+ originalRunId: typeof Schema.NonEmptyString;
7423
+ originalExecutionId: typeof Schema.NonEmptyString;
7424
+ workflowName: typeof Schema.NonEmptyString;
7425
+ }>, Schema.Struct<{
7426
+ kind: Schema.Literal<["rejected"]>;
7427
+ failureId: typeof Schema.NonEmptyString;
7428
+ requestId: typeof Schema.NonEmptyString;
7429
+ originalRunId: typeof Schema.NonEmptyString;
7430
+ originalExecutionId: typeof Schema.NonEmptyString;
7431
+ workflowName: typeof Schema.NonEmptyString;
7432
+ }>]>;
7433
+
7434
+ export declare type WorkflowRetryTarget = typeof WorkflowRetryTargetSchema.Type;
7435
+
7436
+ /** Persist the request ID before sending. Reuse this target after a lost reply. */
7437
+ export declare const WorkflowRetryTargetSchema: Schema.Struct<{
7438
+ runId: Schema.filter<typeof Schema.NonEmptyString>;
7439
+ requestId: Schema.filter<typeof Schema.NonEmptyString>;
7440
+ }>;
7441
+
7324
7442
  export declare type WorkflowRunEventRow = Schema.Schema.Type<typeof WorkflowRunEventRowSchema>;
7325
7443
 
7326
7444
  export declare const WorkflowRunEventRowSchema: Schema.Struct<{