@voltro/client 0.62.3 → 0.64.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/CHANGELOG.md +104 -0
- package/dist/index.d.ts +153 -25
- package/dist/index.js +1129 -850
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -39,6 +39,110 @@ _Changes staged for the next release accumulate here (rolled up from
|
|
|
39
39
|
|
|
40
40
|
---
|
|
41
41
|
|
|
42
|
+
## [0.64.0] — 2026-09-04
|
|
43
|
+
|
|
44
|
+
### ⚠ BREAKING
|
|
45
|
+
|
|
46
|
+
- **@voltro/ai, @voltro/cli** — `defineAgent` must now decide **who may talk to the agent** — `guards: [...]` or `openAccess: '<why>'` — and the decision applies to both synthesized routes (`<name>.send`, `<name>.messages`). An undecided agent refuses the boot under `security.defaultDeny` (kind `agent`, named with its file by `voltro doctor`). The routes used to carry a framework-written `openAccess` whose own wording admitted it served any session — anonymous included — so every agent was a free model-spend surface for anyone who could open the socket. Threads now have **owners**: the first `send` on a `threadId` opens the thread for the calling subject, and every later `send` / `messages` on it by another authenticated subject fails with the typed `AgentThreadAccessDenied` (in both routes' error unions). A thread opened anonymously has no owner and keeps its old reach. `_voltro_agent_threads` gains a nullable `subjectId` column, applied by the declarative differ on the next boot or `voltro db apply`; `runAgentTurn` and `loadAgentMessages` take the caller's `subjectId`.
|
|
47
|
+
|
|
48
|
+
**`voltro update` carries you across this** — codemod `0.64.0/02_agent-access-decision`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.64.0).
|
|
49
|
+
- **@voltro/plugin-atlassian** — `@voltro/plugin-atlassian`: `AtlassianCredentials` (and `connectionCredentials({ … })`) gain `confluenceBaseUrl`, and `ConfluenceService` is built on it — never on the Jira `baseUrl`, where `/rest/api/content` answers 404 on Data Center and on Cloud alike (Cloud serves Confluence under `/wiki`), so every Confluence call was reaching the wrong host. A credential without the field now fails every `ConfluenceService` method with a typed `ConfluenceError` (`code: 'not_configured'`). A **named** instance (`atlassianPlugin({ name })`) provides its services under per-name tags — `jiraServiceFor(name)` / `confluenceServiceFor(name)` — instead of the shared `JiraService` / `ConfluenceService`, which two named instances used to both provide with the last merged layer silently winning; the unnamed instance keeps the default tags. Migration: set `confluenceBaseUrl` where Confluence is used; reach a named site through `jiraServiceFor(name)`.
|
|
50
|
+
|
|
51
|
+
**`voltro update` carries you across this** — codemod `0.64.0/03_atlassian-confluence-root-and-named-instances`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.64.0).
|
|
52
|
+
- **@voltro/cli, @voltro/plugin-webhooks, @voltro/plugin-governance, @voltro/database** — The field cipher behind `.encrypted()` columns is registered by the framework, from `VOLTRO_FIELD_ENCRYPTION_KEY`, on both boot paths — `voltro dev` mints the key into `.env.local` like the inspect tokens, and `voltro serve` refuses to boot without it as soon as any `.encrypted()` column is declared, naming the columns. Until now the only registrar was `governancePlugin({ fieldEncryption })`, so a framework table could not encrypt a credential without making every app that installs its plugin also install governance — and `_voltro_webhook_targets.secret`, the key that signs every delivery, sat in plaintext for exactly that reason. It is `.encrypted().serverOnly()` now; rows written before still read, and `voltro db encrypt-column _voltro_webhook_targets.secret` converts them in place. `fieldEncryption: true` reads the same variable and changes nothing; `{ secretKey }` keeps its purpose (a key under another name) and still wins.
|
|
53
|
+
|
|
54
|
+
BREAKING for an app with `@voltro/plugin-webhooks` (or its own `.encrypted()` columns) and no cipher: production boot now requires the key.
|
|
55
|
+
|
|
56
|
+
**`voltro update` carries you across this** — codemod `0.64.0/05_field-encryption-key-framework-owned`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.64.0).
|
|
57
|
+
- **@voltro/protocol, @voltro/runtime, @voltro/testing, @voltro/plugin-auth-social, @voltro/plugin-sso-saml** — `PluginHttpRouteResult.headers` accepts an array per header: `set-cookie` arrays become separate `Set-Cookie` lines (a session and a CSRF cookie from one login), every other array joins with `, `. A record of single strings could not say it, so the second cookie overwrote the first.
|
|
58
|
+
|
|
59
|
+
`@voltro/plugin-auth-social` and `@voltro/plugin-sso-saml` — the two first-party routes that set two cookies from one login — answer with two lines now. sso-saml joined them with a comma, which a browser reads as ONE cookie, so the SLO companion never arrived; auth-social newline-joined them, an encoding no layer split.
|
|
60
|
+
|
|
61
|
+
BREAKING for tests: `@voltro/testing`'s route response `headers` values are `string | ReadonlyArray<string>` — a test that assigned one to a `string` narrows it (the codemod's note says how).
|
|
62
|
+
|
|
63
|
+
**`voltro update` carries you across this** — codemod `0.64.0/06_test-response-headers-arrays`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.64.0).
|
|
64
|
+
- **@voltro/protocol, @voltro/voltro, @voltro/workflow, @voltro/runtime, @voltro/cli, @voltro/plugin-audit, @voltro/plugin-rbac, @voltro/plugin-sentry, @voltro/plugin-ratelimit, @voltro/plugin-billing, @voltro/plugin-flags, @voltro/plugin-moderation** — A `workflow()` must now decide **who may start it** — `guards: [...]`, `openAccess: '<why>'`, or `internal: true` — and an app with an undecided workflow refuses to boot under `security.defaultDeny` (on by default), on `voltro dev`, `voltro serve` and `voltro doctor`. The start rpc a `*.workflow.tsx` becomes had no access decision at all: the definer had no `guards:` field, so nothing was enforced and every discovered workflow was startable by any socket, anonymous sessions included. Guards use the mutation vocabulary verbatim (a resource-scoped guard reads its id from the start payload); `internal: true` removes the start rpc from the client group and both boot paths, leaving server-side starts (`ctx.workflows.start`, schedules, event triggers) untouched. The start now runs inside a new **`interceptWorkflow`** plugin chain (`RpcKind` gained `'workflow'`, permission `'rpc:intercept:workflow'`): audit records starts, rate limiting counts them, billing's entitlement gate covers them, and rbac publishes role scopes so a role-derived guard can pass. The start lifter `workflowToRpc` moved from `@voltro/runtime` to `@voltro/protocol` (browser-safe) and is now the ONE lifter `voltro dev`, `voltro serve` and the generated client group all call — the start payload is `strictInput`-checked on every path and a guarded workflow advertises `ScopeError` / `Unauthenticated` in its wire error union, so a refused start decodes as a typed failure rather than an `ExitEncoded` defect. Migration: run `voltro doctor`, decide each listed workflow; an app plugin declaring `interceptAction` adds `interceptWorkflow` for the same coverage.
|
|
65
|
+
|
|
66
|
+
**`voltro update` carries you across this** — codemod `0.64.0/01_workflow-access-decision`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.64.0).
|
|
67
|
+
- **@voltro/protocol, @voltro/runtime, @voltro/voltro** — A workflow start whose idempotency key was already SPENT — a run under that key had finished — now returns `status: 'replayed'` on the handle (with the old run's id) and warns once per key, instead of `running` with the old run's id, which was indistinguishable from a fresh start. A schedule keyed per day ran once and reported every later firing as a start; the replay is now visible where it happens. `WorkflowRunHandle.status` gains the literal — an exhaustive switch over it needs the arm. The lookup is best-effort: a run store that cannot answer leaves the handle as before.
|
|
68
|
+
|
|
69
|
+
**`voltro update` carries you across this** — codemod `0.64.0/04_workflow-handle-replayed`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.64.0).
|
|
70
|
+
|
|
71
|
+
### Added
|
|
72
|
+
|
|
73
|
+
- **@voltro/cli** — `voltro agents-md` reports a nested `AGENTS.md` / `CLAUDE.md` pair whose contents differ (both sizes, both ways out: add the keep marker to the one you maintain and copy it, or `--force` to re-seed both). The seeder writes one content under both names and never overwrites without `--force`, so a pair diverges only by hand — and then every tool reading the other name gets guidance nobody wrote. Reported rather than symlinked: a symlink is not a file to `COPY`, to Windows, or to a tool that refuses to follow one. `EnsureResult.diverged` carries it.
|
|
74
|
+
- **@voltro/ai** — `aiStep` / `aiObjectStep` take `tools`, `maxSteps` and `toolContext`: the whole LLM↔tool loop runs as ONE durable step — one journal entry, one retry policy, one usage row summing every round-trip (`totalUsage`, not the last step's). `generateText` gained the same tool loop for a text answer. A durable tool loop had to leave the step for the inline `generateObjectWithTools` before, and lost the journal and the per-step spend on the way out.
|
|
75
|
+
- **@voltro/cli** — Without `auth.anonymousTenantRequired`, an anonymous request resolves to the tenant its own `x-tenant` header names (or the development fallback tenant) — a convenience for smoke flows that is, under `NODE_ENV=production`, a client-chosen tenant on every unauthenticated read of a non-`tenant()` table. Both boot paths now say so once at boot and name the field; the request path is unchanged.
|
|
76
|
+
- **@voltro/plugin-atlassian** — `atlassianPlugin({ confluenceCredentialsResolver })` resolves the caller's Confluence credentials separately from Jira's. On Cloud one token serves both products; on Data Center a Jira PAT is not a Confluence PAT, and a Confluence service built on the Jira resolver cannot authenticate at all. Absent, the Jira resolver serves Confluence as before.
|
|
77
|
+
- **@voltro/plugin-atlassian, @voltro/protocol, @voltro/cli** — `atlassianPlugin({ cache: true })` memoises reference-data reads (board configuration, project, field and status catalogues) into the FRAMEWORK's cache — the backend `CACHE_BACKEND` selects, in-process or Redis across replicas — handed over at bind time; `{ ttlMs }` tunes the per-namespace TTLs on it, and `{ store }` still memoises into a store of your own. The option used to need a hand-built store object and the docs named no way to obtain one. Behind it, `PluginBindContext` gains `cache` (get/set on the framework cache), which both boot paths hand to every plugin's `bindDataStore`.
|
|
78
|
+
- **@voltro/plugin-atlassian** — `@voltro/plugin-atlassian` exports `jql` — the JQL escaping helpers (`str`, `field`, `key`, `keyList`, `strList`) — and the `JiraIssueKey` schema, so a value interpolated into `searchIssues(...)` cannot close the literal it sits in or smuggle an `OR` into the query; keys are validated at the call site, before anything is sent.
|
|
79
|
+
- **@voltro/plugin-audit** — `auditPlugin({ metadata })` — a per-call resolver for the `metadata` column, which existed and which nothing ever set. It runs AFTER the call with the tag, input, subject and the outcome (`ok` with the value, or `error`), so an app can write the sentence a diff cannot contain ("Anna removed Bernd from the Frontend team"); it may be async, and a throw or `undefined` records no note and never fails or delays the call.
|
|
80
|
+
- **@voltro/database, @voltro/plugin-audit, @voltro/plugin-row-history** — `_voltro_audit_log` and `_voltro_row_history` gain `scopeKey` — the app's `resolveScope` value as a bounded, indexed text (`scopeKeyOf`: a string scope is its own key, anything else canonical JSON with sorted keys) beside the opaque json `scope`, plus `auditByScope(store, scope, { status?, limit? })` and `historyByScope(store, scope, tenantId, limit)` (+ Effect twin) that address rows through it on the `byAuditScope` / `byRowHistoryScope` indexes. The json column was documented as indexed and was not — json is not an access path on any dialect — so "everything that happened to team X" was a full scan, and the row-history reader dropped `scope` and `actor` on the floor; both are returned now. `scopeKeyOf` is exported from `@voltro/database`.
|
|
81
|
+
- **@voltro/protocol, @voltro/cli, @voltro/plugin-deactivation** — `auth.subjectGuards` in `app.config.ts` — post-authentication vetoes at the framework level, where EVERY subject passes: after a strategy matches and `resolveScopes` has applied, on the request path and on a durable workflow's execution. A guard receives the subject as it will run plus the same context `resolveScopes` gets, returns `{ ok: true }` or `{ ok: false, code, message }`; the first rejection fails the request closed with `Unauthenticated` carrying both. The auth plugin's `subjectGuards` run at login only, so an app whose subjects arrive through its own strategy chain (a JWKS IdP, an API-key table, a self-minted session) had no place to veto a deactivated account — `users.deactivate` locked no one out. Vetoes are cached with the scope decision (same key, same window, same `invalidate` handle); `applyScopeDecision` throws on a vetoed decision so a caller that forgets the branch fails closed. `@voltro/plugin-deactivation/guard` ships `deactivationSubjectGuard({ table })` for this seam.
|
|
82
|
+
- **@voltro/plugin-broadcast** — The broadcast bus reports three Effect metrics, exported with the framework's other counters: `voltro_broadcast_connected{provider}` (a gauge — `1` while this replica holds a live subscription, `0` while it does not), `voltro_broadcast_gaps_total` (gaps recovered from) and `voltro_broadcast_missed_total` (messages serial accounting proves were missed). A broker outage used to be a silent UI — local reactivity kept working, only the other replicas' changes stopped arriving — and the gauge dropping to 0 is the alarm that search was missing.
|
|
83
|
+
- **@voltro/plugin-broadcast** — The broadcast bus counts transport reconnects (`voltro_broadcast_reconnects_total{provider}`, beside `_connected`, `_gaps_total`, `_missed_total`), logs each one with its replica identity and last-received timestamp, and exposes `health()` on the handle — provider, channel, replica id, connected, last received / published, reconnects, gaps, missed — for a readiness probe or a support dump. With two replicas and CDC off the bus is part of correctness, and an outage that loses cross-replica updates without closing a socket had no number to point at.
|
|
84
|
+
- **@voltro/cli** — `voltro db plan --check` exits 1 when ANY operation is pending — the CI schema gate a bare `db plan` cannot be, since a preview that failed would make "show me the diff" and "the diff is empty" the same exit code. The verdict names the count ("3 pending operations"); `--json` still emits the plan. A blocked plan keeps exit 2.
|
|
85
|
+
- **@voltro/integration-http** — The per-host retry budget reports itself: `voltro_http_retries_total{host}` counts retries that went out, `voltro_http_retry_budget_exhausted_total{host}` the ones the budget refused. A retry storm and a budget that has closed the door on a host were both invisible from a span — there is one span per logical request, whatever it took to answer.
|
|
86
|
+
- **@voltro/i18n** — `LOCALE_COOKIE`, `THEME_COOKIE` and `TIMEZONE_COOKIE` are exported from `@voltro/i18n/server` as well as from the root. A server that sets or clears one of those cookies names it, and the root entry carried the browser hooks along for two strings.
|
|
87
|
+
- **@voltro/data-transfer** — Masking action `{ json: { fields, rest? } }` masks INSIDE a json value by key: an array masks each item, an object applies `fields[key]` to the keys it names and `rest` to every other one — `rest` defaults to `'redact'`, so a key the policy did not think about is never copied through. Nested `{ json }` descends; a `custom` transform inside sees the path as its `column`. A json column was one scalar to the export before: `null`, `[redacted]`, or a verbatim copy of every person in it.
|
|
88
|
+
- **@voltro/runtime** — `ctx.store.one(query, onMissing?)` and `select(table)….one(onMissing?)`: the factory receives the `{ table, found }` that `NoRowFound` carries and whatever it returns is thrown instead. A contract that already declares its own not-found error keeps declaring it, without a `maybeOne` + null branch at every read that only existed to translate the framework's error into the app's.
|
|
89
|
+
- **@voltro/protocol, @voltro/runtime, @voltro/cli, @voltro/plugin-audit** — Plugins gain `onHttpRoute` — a fire-and-forget observer of every plugin HTTP route call after it answers (method, path, status, duration; permission `'http:intercept'`, the other end of the pipeline `onHttpRequest` opens). A login, a logout or an avatar fetch served by a plugin's `httpRoutes` answered outside every rpc interceptor, so a trail that recorded every mutation had no row for the one call an incident review asks about first. `@voltro/plugin-audit` implements it: `http.<METHOD> <path>` with the status, no subject (a plugin route is not part of the rpc pipeline and nothing upstream authenticated its caller). Both boot paths compose the hooks through one builder and hand them to the server.
|
|
90
|
+
- **@voltro/database, @voltro/runtime, @voltro/cli** — `reference(target, { onSoftDelete: 'cascade' | 'setNull' })`. A soft delete is an `UPDATE … SET deletedAt`, so `ON DELETE` never fires for it and the children of a soft-deleted parent stayed exactly where they were. The runtime enforces this one on the store's post-commit change channel through the same engine `pluginRef` orphan rules use — after the parent's update commits, once per replica, chaining through children that emit their own change. `'cascade'` is refused at boot when the referencing table lacks `softDelete()` (the engine would hard-delete children a restore could never bring back); `'setNull'` needs a nullable column. Restoring the parent does not restore the children.
|
|
91
|
+
- **@voltro/database, @voltro/runtime** — `.forUpdate()` on both query builders — `database.t.where(…).forUpdate()` and `ctx.store.select('t').where(…).forUpdate()` — marks the descriptor `lock: 'update'` and the shared SELECT compiler emits the dialect's row lock: `FOR UPDATE` on postgres / mysql / mariadb, `WITH (UPDLOCK, ROWLOCK)` on mssql, nothing on sqlite (its writers are serialised already). The matched rows stay locked until the enclosing transaction commits, so a read-modify-write — an append into a json column, a counter, a merge — keeps every writer's change instead of the last one's. `.version()` refuses the stale writer; this makes the second writer wait. A set operation ignores it.
|
|
92
|
+
- **@voltro/database** — `selfReference(options?)` — a reference column pointing at the table it is declared in. `reference(() => teams)` inside `teams`' own declaration is a TypeScript cycle (TS7022), so `parentId` columns ended up as bare `text()` with no foreign key the schema knew about. The new column carries no target type; `table()` resolves its placeholder to the table being built, so the FK emitter, the eager loader and the subject graph see it as the reference it is.
|
|
93
|
+
- **@voltro/plugin-sentry** — `captureFailures: 'infrastructure'` — the preset between `false` (the default: no declared failure reaches Sentry) and `true` (every one does). A failure whose tag says infrastructure broke — `StoreOperationFailed`, `SqlError`, `ResultLengthMismatch`, `FieldDecryptionError`, `RequestError`, `ResponseError`, `CacheError`, `WorkflowAuthorityUnavailable` — is reported even though a handler declared it, because a declared database outage is still a database outage; every other declared failure stays out. Both halves take it (`initSentryBrowser({ captureFailures })` resolves the same predicate), and the boot line names the preset.
|
|
94
|
+
- **@voltro/database, @voltro/cli** — A `voltro dev` boot and `voltro db plan` / `db apply` warn about soft-drop snapshots (`<name>__dropped_<ts>`) older than the review window, naming each one and printing the exact `voltro db gc-snapshots --before <date>` to run — computed from the stamp in the name, so it costs no query beyond the introspection that already ran. A snapshot is a full copy of the dropped data, PII included, and reclaiming it was a step an operator had to remember while the soft-drop advice promised "~7d". The window is `database.softDropRetentionDays` in `app.config.ts` (default 7).
|
|
95
|
+
- **@voltro/runtime, @voltro/cli** — The api now says when a subscription's consumer stops acknowledging chunks. `@effect/rpc` waits for the client's `Ack` of each `Chunk` before writing the next one, so a hand-rolled socket client that only listens receives the initial snapshot and then nothing, however many writes land — while the producer, the matcher and the registry all report a healthy subscription, because they are. A delivery the transport has not accepted within `reactive.socket.stallWarnAfterMs` (default 5 s, env `VOLTRO_REACTIVE_STALL_WARN_AFTER_MS`) is logged at WARN naming the subscription and the missing `Ack`, and counted in `voltro_subscription_stalled_total{tag}`; against `voltro_subscription_deliveries_total{kind="delta"}` that separates "the server delivered" from "the socket handed it over". The stream buffer between the outbox and the socket is one event deep now (was 16), so updates coalesce onto the newest state sooner and the pump can see the stall at all. Computed subscriptions ride the same outbox: they used to hand every recomputed snapshot to the stream fire-and-forget, so a stalled consumer retained each one. All three binders share one `pumpOutbox`. The wire-protocol page documents the flow control and a raw-client checklist. Golden churn: `ReactiveSocketTunables` gains a required `stallWarnAfterMs` (constructed only by the CLI's resolver and tests), `SubscriptionOutbox` is generic in its payload, and `pumpOutbox` / `bindComputedUntyped` / `recordStalled` are new exports.
|
|
96
|
+
- **@voltro/testing** — `makeVoltroTestClient` drives `useConnectionStatus`: `setConnectionStatus(status, facts?)` sets the coordinator's presentation state (`connected` / `recovering` / `degraded`) and the facts beside it — failure count, failed subscriptions, pending replays, raw transport — and components re-render like on a real gap. `refreshes` counts what `useRefreshSubscriptions` asked for. A disconnect banner and a retry button had states no test could reach except by mocking the whole client module.
|
|
97
|
+
- **@voltro/testing** — `makeVoltroTestClient().emitRpcError({ source, tag, error, kind, outcome? })` puts an rpc error onto the api's error bus — `kind: 'transport'` with `outcome: 'unknown'` is the raw channel a socket cut produces, `kind: 'handler'` a typed failure the presentation layer shows. A banner that subscribes through `useOnRpcError` had no way to be handed either without mocking the whole client module.
|
|
98
|
+
|
|
99
|
+
### Changed
|
|
100
|
+
|
|
101
|
+
- **@voltro/cli, @voltro/ai** — The model-provider key is checked at BOOT: when `AI_PROVIDER` names a real provider and its key variable (`ANTHROPIC_API_KEY` / `OPENAI_API_KEY` / `AI_GATEWAY_API_KEY`) is unset or empty, `voltro serve` refuses to start and `voltro dev` warns. The provider SDK used to read the key at the first model call, so an unset or rotated key surfaced hours after a deploy that reported healthy, from inside the SDK. An app that supplies every key in code (`model: { apiKey }`) opts out with `ai: { requireProviderKey: false }` in `app.config.ts`. `@voltro/ai` exports `providerKeyEnvVar(provider)` — the one map the gate and the provider share.
|
|
102
|
+
- **@voltro/cli** — `voltro doctor`, corrected where its rules assumed the framework's own names:
|
|
103
|
+
|
|
104
|
+
- `subject-write-no-guard` reads the app's guard vocabulary (every exported guard, not a fixed list of the framework's names) and accepts an explicit null guard on `subject.id` or an alias of it — a fixed list reported every check an app writes under its own names as absent. - new `open-reason-unverified`: an `openAccess` reason that names a guard from the vocabulary is checked against the paired executor; a reason that convinced a reviewer and was false is the finding. - the authz scan reads an executor's local helper imports (two hops) as part of the executor, so a `database.<table>` read in `lib/` is attributed to the executor that calls it instead of to nobody. - new `input/uncapped-array`: `Schema.Array` in a mutation or action input with no `maxItems` — the body limit bounds bytes, not writes. - new `cron/bucket-on-wall-clock`: a cron that keys its period on `firedAt` / `Date.now()` / `new Date()` and never reads `scheduledAt`. - a sensitivity report: every text/json column carrying neither `.sensitive()` nor `.safe()`, named before a masked export refuses it; reviewed exceptions in `doctor.sensitivity.allow`. - `convention/missing-test` covers executors (`*.{query,mutation,action, stream}.server.ts`, `*.workflow.server.tsx`), with the test beside either half of the pair and a fix that points at `invoke` from `@voltro/testing`. - `hardcoded-framework-cookie` ignores comments; `ui/write-hook` follows a `.hook.ts` import one hop, so a UI component writing through its own hook is reported as the write it is.
|
|
105
|
+
- **@voltro/cli** — Three `voltro doctor` scans, each corrected where its premise was narrower than the code it read:
|
|
106
|
+
|
|
107
|
+
- the never-emitted-events scan resolves a DEFAULT-exported descriptor through its importers' names (`import updating from '…event'` → `ctx.events.publish(updating, …)`); every default-exported event read as never emitted before. - `n-plus-one` reports a read inside a loop or per-item callback outright, and otherwise counts only INDEPENDENT reads — a chain where each key comes from the previous row (registration → setup → access code) is an assembly `Effect.all` cannot run and is no longer called an N+1 you are writing. - `hand-serialized-date` runs on executors only — not on `lib/` helpers building predicate bounds, not on web components, where its fix is unfollowable — and skips a property the paired descriptor declares `Schema.String`: an ISO contract chosen on purpose is not a Date leaking out. - new `mutation/target-op-mismatch`: a mutation whose `target: { table, op }` promises one write verb while its executor performs another on that table — the descriptor drives the optimistic patch, the invalidation and the audit row, so the disagreement was silent and wrong three ways. - new `bulk-write-in-loop`: `insert` / `insertIgnore` / `upsert` inside a loop or per-item callback, where `insertMany` / `insertManyIgnore` / `upsertMany` is one statement per batch.
|
|
108
|
+
- **@voltro/cli** — `voltro doctor`'s `renderMode:'spa'` candidates carry a `reason` line each — what the page costs today (a server render and hydration of a leaf whose data arrives client-side anyway) and what `'spa'` changes (the layout shell stays server-rendered; only the leaf drops to the client) — so the decision can be made from the report rather than from re-reading every page.
|
|
109
|
+
- **@voltro/database, @voltro/runtime, @voltro/cli** — An `.encrypted()` value is bound to where it lives. AES-256-GCM now takes `table:column:rowId` — or `table:column` when the row's identity is not known at write time — as additional authenticated data, and the envelope records which (`enc:v2:r:` / `enc:v2:c:`). A ciphertext was a bearer value before: whoever could write the database could copy one subject's encrypted token into another subject's row and let the app, acting for the second, decrypt and use the first's credential — no key needed, the app is the deputy that holds it. Bound, the copied value fails authentication in its new home, in another row and in another column alike. Set-based `updateMany` writes that touch an encrypted column are expanded per row so each row gets its own binding; a projected read that omits `id` on such a table fetches it and strips it, so the binding can be verified. The connection vault binds its tokens and PKCE verifiers the same way, and workflow step payloads are column-bound. Rows written before (`enc:v1:`) still read; `voltro db encrypt-column` re-binds them in place, resumably, alongside the raw-encoding normalisation it already did.
|
|
110
|
+
- **@voltro/i18n** — `useFormatDate` and `useRelativeTime` accept `null` / `undefined` and render `options.fallback` (default `''`) for them and for a value that is not a date — a nullable column reaching a component as `null` used to render the Unix epoch (`new Date(null)`), so every unguarded call showed 1.1.1970 for an open row. `formatDateValue` is the pure half, exported. The golden churn is the two hooks' `value` parameter widening from `DateInput` to `MaybeDateInput` and `options` gaining `fallback` — every existing call still compiles.
|
|
111
|
+
- **@voltro/integration-http, @voltro/plugin-atlassian** — `@voltro/integration-http` retries transient failures for the idempotent methods only — `GET` / `PUT` / `DELETE` (`policy.retryMethods`); a `POST` is no longer retried by default, because a proxy answering 502 after the origin has committed the write turns a retry into a duplicate (a duplicated Jira `createIssue` is the case). Such a failure still surfaces `transient: true`, with "not retried: POST is not idempotent" in the message; a call the caller has made idempotent passes `retry: true` on `request` (`retry: false` disables retries for any call). Retries are also bounded per host by a retry budget (`policy.retryBudget`, default 20 % of the trailing 10 s window's requests plus a floor of 10, per process; `false` disables it): every first attempt still goes out, only the amplification is capped, which is why it is a budget rather than a circuit breaker. `retryBudgetSnapshot(host)` reads the ledger. The Atlassian docs also stop claiming a 401 carries `code: 'session_expired'` — it has been `'unauthorized'` since the rename. The golden churn is `RequestArgs.method` spelled through the new `HttpMethod` alias — the same four literals, no call-site effect.
|
|
112
|
+
- **@voltro/protocol, @voltro/runtime, @voltro/client** — A replay whose key is still being executed by the first call is the typed `MutationInFlight { traceId, retryAfterMs }` on every mutation's wire union — it was `Effect.die`, presented client-side as the handler having failed while the write was committing, for exactly the handler that dies mid-socket-cut: the long one. `useMutation` now waits the server's `retryAfterMs` inside the replay window and replays the same key once more; REST keeps answering 409.
|
|
113
|
+
- **@voltro/database, @voltro/runtime, @voltro/protocol, @voltro/cli, @voltro/testing, @voltro/sql-mysql, @voltro/sql-postgres, @voltro/sql-mssql, @voltro/sql-sqlite, @voltro/sql-turso** — A read-modify-write inside a mutation no longer loses the second writer's edit. "It runs in a transaction" protects it on no engine at the default isolation — a plain SELECT takes no row lock — and what the engine did about the stale write ranged from an opaque `Failed to execute statement` (MariaDB 11.6.2+, `ER_CHECKREAD`) to applying it in silence (MySQL, Postgres, SQL Server, SQLite). Five changes, one shape:
|
|
114
|
+
|
|
115
|
+
- **Inside a transaction, a read is an expectation.** A keyed `ctx.store.update` of a `.version()` row that the same transaction has read carries the version it read, without the caller sending one; a row that moved in between is a conflict the mutation runner replays (the handler re-reads, like a deadlock replay), and only after the bounded replays does the typed `VersionConflict` surface — now on every mutation's wire union, like `MutationInFlight`. A row the transaction never read stays last-write-wins; a caller's own expectation is still answered, never replayed. An insert that omits the version column starts the row at `INITIAL_VERSION` on every store. - **The transient-contention list lives once**, in `@voltro/database` (`transientContention.ts`), read by every dialect's `retryFilter` and by the mutation runner; MariaDB's `ER_CHECKREAD` (1020) is on it. The filters also expand a `FiberFailure` before looking for a code — a statement that failed inside the transactional view rejected with one, and the store's own replay never saw the deadlock it was written for. - **`ctx.store.raw` exists inside a mutation**, on the transaction's own connection (every SQL dialect's transactional view carries it), so a `SELECT … FOR UPDATE` spelled by hand locks for the rest of that transaction. The docs had promised it on every SQL store; the view a mutation receives had none. - **Set-based writes on a transaction are one statement.** The mysql/mariadb, mssql and sqlite transactional views decomposed `updateMany` / `deleteMany` into a SELECT of ids and keyed writes, so the predicate was evaluated by a snapshot read rather than by the write — the version compare-and-swap then matched a row another transaction had already moved. They now run the same predicate-carrying statement the pool path (and postgres) always did. - **The replay bound is the deployment's.** `mutations.replayAttempts` in `app.config.ts` (default 3, env `VOLTRO_MUTATION_REPLAY_ATTEMPTS`), one resolver on both boot paths and in `@voltro/testing`'s `invoke`. The runner resets its post-commit queue per run of the transaction body, inside the store's bracket — that bracket replays the body itself now, and a reset outside it would have queued the aborted body's `afterCommit` work twice. - **`voltro doctor` names the handlers** that read a row, rebuild it and write it back with a keyed `update` on a table without `.version()` (`mutation/read-modify-write-unversioned`), so the tables that need the column are a report. - The concurrency page carries the per-engine matrix, the three protections, what the read-as-expectation does not see, and when a row lock beats a replay.
|
|
116
|
+
- **@voltro/cli** — `voltro test <directory>` naming a tree that contains no tests now FAILS (exit 1, "No test files found") instead of passing — an explicit directory is the same statement of intent as an explicit filter, and a CI line pointing at the wrong tree was green forever. The bare `voltro test` (cwd as root, nothing named) still passes with nothing to run.
|
|
117
|
+
- **@voltro/workflow, @voltro/cli** — A queued workflow start that fails to drain is retried with backoff — one second, doubling, capped at five minutes, jittered — instead of on every tick, so one undrainable intent no longer produces a warning every two seconds on every pod. After `workflows.deadLetterAfterAttempts` failed attempts (default 50 — several hours under that backoff; `false` disables it) the intent is dead-lettered exactly like a permanently invalid payload: `onFailure` once, the row retained for `voltro workflows flow`, re-armable with `flow retry`. The backoff rides the intent's `dueAt`, the field the drain window already selects on.
|
|
118
|
+
|
|
119
|
+
### Fixed
|
|
120
|
+
|
|
121
|
+
- **@voltro/ai** — `runAssistant` — and with it every synthesized `<agent>.send` turn — records its terminal token usage into `_voltro_ai_usage` (`operation: 'agent.turn'`, attributed to the agent's name). A tool loop is a model call like any other, and the agent turn was the one path that spent without recording: `aiStep` records, the turn wrote nothing, so an app whose model sites are mostly tool loops could show zero spend. `recordUsage: false` keeps the ledger untouched for a caller that records elsewhere; `agent` names the row.
|
|
122
|
+
- **@voltro/client** — An optimistic patch whose server echo arrived **before** the mutation's own response is now retired at confirmation instead of five seconds later. The server emits a change at commit and answers the mutation only after the handler returns, so on a shared socket the echo is routinely queued ahead of the `Exit`, and a handler that keeps working after its write (an event publication, an audit row) widens the gap. The cache credited an echo only when it landed AFTER `confirmByMutation`; an earlier one left the patch unconfirmed, the confirmation then armed the resync window, and every such write ended in the `no superseding server event` warning plus a full re-fetch of a subscription that was already showing the truth. Each entry now counts base movements (every delta; a snapshot only when it changed the rows), each patch carries the count it went on at, and confirmation retires a patch whose base moved since — through the same door a later echo uses. A movement that preceded the patch, or a snapshot that repeated the base, still does not count.
|
|
123
|
+
- **@voltro/cli** — `voltro doctor`'s `page-without-test` hint named the retired `users/[id].page.tsx` convention; it now shows `users/[id]/page.tsx → users/[id]/page.test.tsx`.
|
|
124
|
+
- **@voltro/cli, @voltro/database** — `expires()` tables are registered with the retention sweep on both boot paths — on `expiresAt`, on every dialect, after a grace of `VOLTRO_EXPIRED_ROWS_TTL_HOURS` (default 24) — so an expired row is physically deleted as the docs said. Nothing registered them before: the mixin's header said the storage half was "postgres only" and the docs said "every dialect, eventually", and both described a registration that did not exist. Reads filtered immediately throughout; this is the storage half of that promise.
|
|
125
|
+
- **@voltro/i18n** — `assertCatalogParity` reads ICU ARGUMENTS by walking the braces instead of matching every `{` — the first word of a plural or select BRANCH (`{count, plural, one {extended by 1 day} …}`) was reported as a placeholder, so two catalogs that agreed on every variable failed parity on their prose. Arguments declared inside a branch (`{gender, select, female {{name} …}}`) still count; ICU quoting is honoured. `placeholdersOf` is exported.
|
|
126
|
+
- **@voltro/cli** — The start bundle (`.framework/dist-web/startBundle/`) and the api bundle (`.framework/dist-api/`) carry a `package.json` with `"type": "module"`. Both are ESM in `.js` files; under an app whose package.json is CommonJS-typed or untyped, Node reparsed the entry on every start and warned (`MODULE_TYPELESS_PACKAGE_JSON`). The artefact describes itself now; the app keeps its own module mode.
|
|
127
|
+
- **@voltro/cli** — `voltro serve` now unions plugin-declared error schemas (`errorSchemas` on a plugin) into every lifted rpc's wire error, as `voltro dev` always did and as the generated client group already expected. Before, a plugin interceptor failing with its declared error (a rate-limit `RateLimited`, an entitlement refusal) reached a dev client typed and crossed the production wire as an untyped defect. One derivation (`pluginExtraErrors`) feeds both boot paths now.
|
|
128
|
+
- **@voltro/runtime** — A `.version()` update is now a real compare-and-swap: the UPDATE carries the version it read as a predicate (`WHERE id = ? AND version = <read>`) and the affected-row count decides, on every dialect and at any isolation level. It used to compare the version in memory and then write by key, so two writers that read the same version both landed and the first change was silently lost — inside a transaction too, since a plain SELECT takes no row lock under READ COMMITTED. A write with no expectation that loses its swap is re-read and re-applied (bounded) and surfaces `VersionConflict` only when the row stays contended; a set-based update (`ctx.store.updateMany`, the fluent `.set()`) on a versioned table now advances every matched row's version by one instead of leaving it still.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## [0.63.0] — 2026-09-03
|
|
133
|
+
|
|
134
|
+
### ⚠ BREAKING
|
|
135
|
+
|
|
136
|
+
- **@voltro/client, @voltro/runtime, @voltro/cli, @voltro/web, @voltro/react-native** — Short transport gaps now have one bounded recovery contract. Raw diagnostics remain immediate, while `useConnectionStatus` exposes `recovering` during a configurable grace window and `useOnRpcError` emits exactly one visible transport failure only if the gap remains open. Same-subject runtime swaps keep subscription bases, revisions and optimistic patches; subject changes discard them. Interrupted mutations report `outcome: unknown` and replay once with the same key only after the deployed API proves that server idempotency is active. The codemod explains the new status member and the raw versus presentation error channels.
|
|
137
|
+
|
|
138
|
+
**`voltro update` carries you across this** — codemod `0.63.0/01_recovery-presentation`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.63.0).
|
|
139
|
+
|
|
140
|
+
### Fixed
|
|
141
|
+
|
|
142
|
+
- **@voltro/database, @voltro/sql-turso, @voltro/sql-sqlite, @voltro/sql-mssql** — Framework-table evolution now converges under real SQLite and both local Turso transports, and has a live MSSQL fixture. The new Turso runs also fixed internal table protection, boolean/number introspection normalization, and case-insensitive SQLite-family index-name comparison. The MSSQL fixture exposed and fixes a second convergence bug: unbounded text that MSSQL auto-bounds for an index is now rendered and compared with the same indexed-column rule, so a second plan no longer tries to widen an indexed `NVARCHAR(450)` to `NVARCHAR(MAX)`.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
42
146
|
## [0.62.3] — 2026-09-03
|
|
43
147
|
|
|
44
148
|
### Added
|
package/dist/index.d.ts
CHANGED
|
@@ -187,6 +187,8 @@ export declare interface ApiHandle {
|
|
|
187
187
|
* app-level listeners can react to typed errors globally (auto-logout
|
|
188
188
|
* on `Unauthenticated`, network-error toasts, etc.). */
|
|
189
189
|
readonly errorBus: RpcErrorBus;
|
|
190
|
+
/** Stable UI/raw transport recovery state for this logical api. */
|
|
191
|
+
readonly recovery?: RecoveryCoordinator;
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
/**
|
|
@@ -375,11 +377,12 @@ export declare interface BuildApiRuntimeOptions {
|
|
|
375
377
|
* Omit only when building a standalone, unsupervised runtime.
|
|
376
378
|
*/
|
|
377
379
|
readonly errorBus?: RpcErrorBus;
|
|
380
|
+
readonly recovery?: RecoveryCoordinator;
|
|
378
381
|
}
|
|
379
382
|
|
|
380
383
|
export declare type BuildClient = (api: MountedApi, generation: number, onSocketOpen: () => void, onSocketIssue: (kind: SocketIssueKind) => void,
|
|
381
384
|
/** Stable for this logical api across every transport generation. */
|
|
382
|
-
errorBus?: RpcErrorBus) => Promise<ResolvedClient>;
|
|
385
|
+
errorBus?: RpcErrorBus, recovery?: RecoveryCoordinator) => Promise<ResolvedClient>;
|
|
383
386
|
|
|
384
387
|
/** The transport-level pieces of one api's client stack. Combined with the
|
|
385
388
|
* api's descriptor map + inspect base URL, this is an `ApiHandle`. */
|
|
@@ -388,6 +391,7 @@ export declare interface BuiltApiRuntime {
|
|
|
388
391
|
readonly cache: SubscriptionCache;
|
|
389
392
|
readonly client: RpcClient.RpcClient<Rpc.Any, RpcClientError.RpcClientError>;
|
|
390
393
|
readonly errorBus: RpcErrorBus;
|
|
394
|
+
readonly recovery: RecoveryCoordinator;
|
|
391
395
|
}
|
|
392
396
|
|
|
393
397
|
declare interface CacheEntry {
|
|
@@ -398,6 +402,11 @@ declare interface CacheEntry {
|
|
|
398
402
|
* prior subscribe still work (stub entries get tag too). */
|
|
399
403
|
readonly tag: string | undefined;
|
|
400
404
|
state: EntryState<unknown>;
|
|
405
|
+
/** How many server events have MOVED this entry's base (every delta; a
|
|
406
|
+
* snapshot only when it changed the rows). Lives on the entry, not the
|
|
407
|
+
* state, so a re-issue that resets the state cannot make a preview look
|
|
408
|
+
* older or younger than it is. */
|
|
409
|
+
baseMoves: number;
|
|
401
410
|
/** Subscriber re-render callbacks. */
|
|
402
411
|
subscribers: Set<() => void>;
|
|
403
412
|
/** Fiber running the underlying stream. */
|
|
@@ -616,7 +625,7 @@ export declare interface ClientDiagnosticEvent {
|
|
|
616
625
|
readonly fields: Readonly<Record<string, ClientDiagnosticValue>>;
|
|
617
626
|
}
|
|
618
627
|
|
|
619
|
-
export declare type ClientDiagnosticKind = 'runtime.build-started' | 'runtime.resolved' | 'runtime.failed' | 'runtime.swapped' | 'runtime.disposed' | 'socket.created' | 'socket.raw-open' | 'socket.close' | 'socket.error' | 'socket.connect-timeout' | 'socket.retry-scheduled' | 'protocol.ready' | 'subscription.transport-failed' | 'subscription.reissue-started' | 'subscription.reissue-skipped' | 'subscription.first-delivery' | 'subscription.recovery-stuck' | 'subscription.health-cleared' | 'connection.status' | 'fault.transport-cut';
|
|
628
|
+
export declare type ClientDiagnosticKind = 'runtime.build-started' | 'runtime.resolved' | 'runtime.failed' | 'runtime.capabilities' | 'runtime.swapped' | 'runtime.disposed' | 'socket.created' | 'socket.raw-open' | 'socket.close' | 'socket.error' | 'socket.connect-timeout' | 'socket.retry-scheduled' | 'protocol.ready' | 'subscription.transport-failed' | 'subscription.reissue-started' | 'subscription.reissue-skipped' | 'subscription.first-delivery' | 'subscription.recovery-stuck' | 'subscription.health-cleared' | 'event.gap' | 'connection.status' | 'recovery.state' | 'fault.transport-cut';
|
|
620
629
|
|
|
621
630
|
export declare interface ClientDiagnosticsSnapshot {
|
|
622
631
|
readonly version: 1;
|
|
@@ -750,17 +759,18 @@ export declare const CONNECTIONS_LIST_TAG = "__voltro.connections.list";
|
|
|
750
759
|
|
|
751
760
|
export declare interface ConnectionState {
|
|
752
761
|
readonly status: ConnectionStatus;
|
|
762
|
+
/** Immediate protocol transport state; never grace-filtered. */
|
|
763
|
+
readonly rawTransport: RawTransportStatus;
|
|
753
764
|
/** `navigator.onLine` (true during SSR — nothing better is knowable there). */
|
|
754
765
|
readonly online: boolean;
|
|
755
|
-
/** Transport failures not yet cleared by recovery evidence. */
|
|
756
766
|
readonly failureCount: number;
|
|
757
|
-
/** When the most recent failure was observed. */
|
|
758
767
|
readonly lastFailureAt: number | undefined;
|
|
759
|
-
/** Subscription tags still waiting for their own post-reconnect delivery. */
|
|
760
768
|
readonly failedSubscriptions: ReadonlyArray<string>;
|
|
769
|
+
readonly pendingMutationReplays: number;
|
|
770
|
+
readonly mutationReplay: 'unknown' | 'enabled' | 'disabled';
|
|
761
771
|
}
|
|
762
772
|
|
|
763
|
-
export declare type ConnectionStatus = 'connected' | 'degraded' | 'offline';
|
|
773
|
+
export declare type ConnectionStatus = 'connected' | 'recovering' | 'degraded' | 'offline';
|
|
764
774
|
|
|
765
775
|
export declare interface ConnectOptions {
|
|
766
776
|
/** Where the callback should send the browser. Same-origin path; the server
|
|
@@ -1583,6 +1593,7 @@ export declare interface MountedApi {
|
|
|
1583
1593
|
readonly descriptors: ClientDescriptorMap;
|
|
1584
1594
|
readonly wsUrl: string;
|
|
1585
1595
|
readonly headers?: ResolvableHeaders | undefined;
|
|
1596
|
+
readonly recovery?: RecoveryOptions | undefined;
|
|
1586
1597
|
}
|
|
1587
1598
|
|
|
1588
1599
|
export declare interface MutateOptions<Input, Output> {
|
|
@@ -1646,6 +1657,13 @@ export declare interface MutationNotifier {
|
|
|
1646
1657
|
readonly error: (message: string) => void;
|
|
1647
1658
|
}
|
|
1648
1659
|
|
|
1660
|
+
export declare interface MutationReplayReservation {
|
|
1661
|
+
/** Re-check immediately before sending: identity, capability and transport may have changed while waiting. */
|
|
1662
|
+
readonly isValid: () => boolean;
|
|
1663
|
+
/** Release the bounded pending slot. Safe to call more than once. */
|
|
1664
|
+
readonly release: () => void;
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1649
1667
|
export declare interface MutationState<Input, Output> {
|
|
1650
1668
|
/** Run the mutation. With no options it rejects on failure (unchanged).
|
|
1651
1669
|
* With an error handler (`onError` / `notify.error`) the failure is handled
|
|
@@ -1675,8 +1693,10 @@ export declare const openAccessReason: (guards: ReadonlyArray<ManifestGuard> | u
|
|
|
1675
1693
|
|
|
1676
1694
|
export declare interface OptimisticContext {
|
|
1677
1695
|
/** Stage an optimistic patch keyed by `queryKey` (same convention as
|
|
1678
|
-
* useSubscription's: `[rpcTag, input]`).
|
|
1679
|
-
*
|
|
1696
|
+
* useSubscription's: `[rpcTag, input]`). A failure reverts the patch;
|
|
1697
|
+
* success keeps it confirmed until the authoritative subscription update.
|
|
1698
|
+
* A same-subject reconnect carries it to the replacement cache, while a
|
|
1699
|
+
* subject or tenant change discards it.
|
|
1680
1700
|
* Use when you know the EXACT input the subscription was opened with. */
|
|
1681
1701
|
readonly update: <T>(queryKey: ReadonlyArray<unknown>, reducer: (current: T) => T) => void;
|
|
1682
1702
|
/** Patch every cached entry whose rpc tag matches `rpcTag`, regardless
|
|
@@ -1696,6 +1716,11 @@ declare interface OptimisticPatch<T = unknown> {
|
|
|
1696
1716
|
readonly id: string;
|
|
1697
1717
|
readonly mutationId: string;
|
|
1698
1718
|
readonly reducer: (current: T) => T;
|
|
1719
|
+
/** The entry's `baseMoves` when this preview went on. A server event that
|
|
1720
|
+
* moved the base AFTER this point is the write's echo as far as the client
|
|
1721
|
+
* can tell — see `confirmByMutation` for why that has to be decided at
|
|
1722
|
+
* confirmation time and not only afterwards. */
|
|
1723
|
+
readonly baseMovesAtApply: number;
|
|
1699
1724
|
/** Set once the mutation SUCCEEDED. A confirmed patch stays applied (so the
|
|
1700
1725
|
* optimistic preview never blinks out) until a server snapshot/delta updates
|
|
1701
1726
|
* `base` to reflect the committed write — only THEN is it dropped. Without
|
|
@@ -1995,6 +2020,8 @@ export declare interface QueryFiltersState<Row> {
|
|
|
1995
2020
|
|
|
1996
2021
|
declare type QueryTag<P extends ProcedureTypeMap> = TagsOfKind<P, 'query'>;
|
|
1997
2022
|
|
|
2023
|
+
export declare type RawTransportStatus = 'connected' | 'disconnected';
|
|
2024
|
+
|
|
1998
2025
|
/**
|
|
1999
2026
|
* Did the server attempt this preload, and did it work?
|
|
2000
2027
|
*
|
|
@@ -2026,6 +2053,87 @@ export declare interface RecordState<R> {
|
|
|
2026
2053
|
readonly error: unknown | undefined;
|
|
2027
2054
|
}
|
|
2028
2055
|
|
|
2056
|
+
/**
|
|
2057
|
+
* State owned by one logical API, not by one socket or one React hook.
|
|
2058
|
+
*
|
|
2059
|
+
* Raw listeners (`RpcErrorBus.on`) still receive every failure immediately.
|
|
2060
|
+
* Presentation listeners receive non-transport failures immediately, but at
|
|
2061
|
+
* most one transport failure per outage and only after the grace window. A
|
|
2062
|
+
* fully healed gap therefore leaves no toast/banner flash while diagnostics
|
|
2063
|
+
* retain the complete sequence.
|
|
2064
|
+
*/
|
|
2065
|
+
export declare class RecoveryCoordinator {
|
|
2066
|
+
#private;
|
|
2067
|
+
constructor(apiName: string, options?: RecoveryOptions, scheduler?: Partial<RecoveryScheduler>);
|
|
2068
|
+
get options(): ResolvedRecoveryOptions;
|
|
2069
|
+
getSnapshot: () => RecoverySnapshot;
|
|
2070
|
+
subscribe: (listener: () => void) => (() => void);
|
|
2071
|
+
onVisibleError(listener: RpcErrorListener): () => void;
|
|
2072
|
+
/** Called from the socket seam before request fibers report their errors. */
|
|
2073
|
+
transportIssue(): void;
|
|
2074
|
+
/** Called only after the rpc protocol has cleared its previous transport error. */
|
|
2075
|
+
protocolReady(): void;
|
|
2076
|
+
observeError(error: RpcError): void;
|
|
2077
|
+
observeSuccess(success: RpcSuccess): void;
|
|
2078
|
+
reportExternalSuccess(): void;
|
|
2079
|
+
/** Discard every stale row/replay/health fact at the subject boundary. */
|
|
2080
|
+
resetForSubjectChange(minimumCapabilityGeneration?: number): void;
|
|
2081
|
+
setMutationReplaySupported(supported: boolean, generation?: number): void;
|
|
2082
|
+
/**
|
|
2083
|
+
* Wait for the capability probe when transport fails during initial boot.
|
|
2084
|
+
* Unknown is never permission: the wait is bounded by the replay window and
|
|
2085
|
+
* resolves false if the server never proves that idempotency is active.
|
|
2086
|
+
*/
|
|
2087
|
+
/** What is left of the replay window for a mutation that started at `startedAt`. */
|
|
2088
|
+
replayWindowRemaining(startedAt: number): number;
|
|
2089
|
+
waitForMutationReplaySupport(startedAt: number): Promise<boolean>;
|
|
2090
|
+
/**
|
|
2091
|
+
* Reserve one bounded waiting/replay slot; caller MUST release the returned
|
|
2092
|
+
* reservation. An unknown capability may reserve while its probe is in flight,
|
|
2093
|
+
* otherwise that short boot window would permit an unbounded waiter set.
|
|
2094
|
+
* Disabled is final for the current generation and refuses immediately.
|
|
2095
|
+
*/
|
|
2096
|
+
reserveMutationReplay(startedAt: number): MutationReplayReservation | undefined;
|
|
2097
|
+
waitForProtocolReady(startedAt: number): Promise<boolean>;
|
|
2098
|
+
dispose(): void;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
/** Stable fallback for hand-built ApiHandles that provide only an error bus. */
|
|
2102
|
+
export declare const recoveryCoordinatorFor: (errorBus: RpcErrorBus, apiName: string, options?: RecoveryOptions) => RecoveryCoordinator;
|
|
2103
|
+
|
|
2104
|
+
export declare interface RecoveryOptions {
|
|
2105
|
+
/** Hide a transport gap from the UI while recovery is still plausible. */
|
|
2106
|
+
readonly graceMs?: number;
|
|
2107
|
+
/** Maximum mutations allowed to wait for one safe replay at once. */
|
|
2108
|
+
readonly maxPendingMutations?: number;
|
|
2109
|
+
/** Maximum age of a mutation before an automatic replay is refused. */
|
|
2110
|
+
readonly replayWindowMs?: number;
|
|
2111
|
+
/**
|
|
2112
|
+
* Explicit HTTP endpoint for runtime capability discovery. Usually omitted:
|
|
2113
|
+
* the client derives a sibling of the WebSocket path. Set this only when an
|
|
2114
|
+
* edge routes the WebSocket and ordinary HTTP through unrelated paths.
|
|
2115
|
+
*/
|
|
2116
|
+
readonly capabilitiesUrl?: string;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
export declare type RecoveryPresentationStatus = 'connected' | 'recovering' | 'degraded';
|
|
2120
|
+
|
|
2121
|
+
declare interface RecoveryScheduler {
|
|
2122
|
+
readonly now: () => number;
|
|
2123
|
+
readonly setTimeout: (callback: () => void, ms: number) => unknown;
|
|
2124
|
+
readonly clearTimeout: (handle: unknown) => void;
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
export declare interface RecoverySnapshot {
|
|
2128
|
+
readonly rawTransport: RawTransportStatus;
|
|
2129
|
+
readonly status: RecoveryPresentationStatus;
|
|
2130
|
+
readonly failureCount: number;
|
|
2131
|
+
readonly lastFailureAt: number | undefined;
|
|
2132
|
+
readonly failedSubscriptions: ReadonlyArray<string>;
|
|
2133
|
+
readonly pendingMutationReplays: number;
|
|
2134
|
+
readonly mutationReplay: 'unknown' | 'enabled' | 'disabled';
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2029
2137
|
/**
|
|
2030
2138
|
* Make an api's client descriptors visible to a SERVER render.
|
|
2031
2139
|
*
|
|
@@ -2087,8 +2195,19 @@ export declare interface ResolvedClient {
|
|
|
2087
2195
|
readonly runtime: AnyRuntime;
|
|
2088
2196
|
readonly cache: SubscriptionCache;
|
|
2089
2197
|
readonly client: RpcClient.RpcClient<Rpc.Any, RpcClientError.RpcClientError>;
|
|
2198
|
+
readonly errorBus?: RpcErrorBus;
|
|
2199
|
+
readonly recovery?: RecoveryCoordinator;
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
export declare interface ResolvedRecoveryOptions {
|
|
2203
|
+
readonly graceMs: number;
|
|
2204
|
+
readonly maxPendingMutations: number;
|
|
2205
|
+
readonly replayWindowMs: number;
|
|
2206
|
+
readonly capabilitiesUrl: string | undefined;
|
|
2090
2207
|
}
|
|
2091
2208
|
|
|
2209
|
+
export declare const resolveRecoveryOptions: (options?: RecoveryOptions) => ResolvedRecoveryOptions;
|
|
2210
|
+
|
|
2092
2211
|
/** Resolve the storage for an area. Internal to the store layer. */
|
|
2093
2212
|
export declare const resolveStoreStorage: (area: StoreStorageArea) => StoreStorage | null;
|
|
2094
2213
|
|
|
@@ -2568,6 +2687,9 @@ export declare const richTextToPlainText: (value: unknown) => string;
|
|
|
2568
2687
|
* when the label field is absent. Exported for direct testing + reuse. */
|
|
2569
2688
|
export declare const rowsToOptions: (rows: ReadonlyArray<Record<string, unknown>>, labelField: string, valueField: string) => ReadonlyArray<FieldOption>;
|
|
2570
2689
|
|
|
2690
|
+
/** What the client can prove about a unary call's server-side result. */
|
|
2691
|
+
export declare type RpcCallOutcome = 'not-applicable' | 'not-started' | 'known' | 'unknown';
|
|
2692
|
+
|
|
2571
2693
|
export declare interface RpcError {
|
|
2572
2694
|
/** Source — `'mutation'` for transactional unary calls, `'action'` for
|
|
2573
2695
|
* non-transactional unary calls, `'subscription'` for streams. */
|
|
@@ -2581,6 +2703,9 @@ export declare interface RpcError {
|
|
|
2581
2703
|
* the rpc returned a declared failure; `client` is framework work that
|
|
2582
2704
|
* failed locally; `unknown` is deliberately unclassified. */
|
|
2583
2705
|
readonly kind: RpcErrorKind;
|
|
2706
|
+
/** A transport failure after a unary request started is `unknown`: the
|
|
2707
|
+
* server may have committed before the response disappeared. */
|
|
2708
|
+
readonly outcome?: RpcCallOutcome;
|
|
2584
2709
|
/** Trace id of the CLIENT call span. When the server accepted the request,
|
|
2585
2710
|
* @effect/rpc propagates this same id into its span. A transport failure may
|
|
2586
2711
|
* happen before that, so the id is not proof that server logs exist. Present
|
|
@@ -3132,6 +3257,13 @@ export declare const subscribeStoreHistory: (listener: Listener) => (() => void)
|
|
|
3132
3257
|
|
|
3133
3258
|
export declare class SubscriptionCache {
|
|
3134
3259
|
private readonly entries;
|
|
3260
|
+
/**
|
|
3261
|
+
* Same-subject runtime replacement. A mutation may settle against the cache
|
|
3262
|
+
* it started on after React has already switched to the replacement cache.
|
|
3263
|
+
* Keep this link one-way so staging and settlement follow the visible data
|
|
3264
|
+
* without retaining an old cache from the new runtime.
|
|
3265
|
+
*/
|
|
3266
|
+
private successor;
|
|
3135
3267
|
private readonly inactiveTtlMs;
|
|
3136
3268
|
private readonly onChangeHook;
|
|
3137
3269
|
private readonly errorBus;
|
|
@@ -3323,10 +3455,10 @@ export declare class SubscriptionCache {
|
|
|
3323
3455
|
* loading state it is already in.
|
|
3324
3456
|
* - `baseError` is dropped: the new transport gets to re-establish the
|
|
3325
3457
|
* truth, and a stale error banner over live data is worse than neither.
|
|
3326
|
-
* - Optimistic patches are
|
|
3327
|
-
*
|
|
3328
|
-
*
|
|
3329
|
-
*
|
|
3458
|
+
* - Optimistic patches are carried. A transport failure has an UNKNOWN
|
|
3459
|
+
* unary outcome, not a proven failure, and removing the preview before a
|
|
3460
|
+
* safe replay settles would flash stale data. The old cache links to this
|
|
3461
|
+
* one so later stage/confirm/revert operations reach the visible copy.
|
|
3330
3462
|
* - Seeded entries carry no fiber and no fetch, exactly like the stub
|
|
3331
3463
|
* entries a pre-mount optimistic patch creates. The first `subscribe()`
|
|
3332
3464
|
* promotes one: it saves the fetch and forks the stream, with the seeded
|
|
@@ -3664,6 +3796,8 @@ export declare interface SupervisorOptions {
|
|
|
3664
3796
|
* otherwise the supervisor creates one bus per api slot.
|
|
3665
3797
|
*/
|
|
3666
3798
|
readonly errorBusFor?: (apiName: string) => RpcErrorBus;
|
|
3799
|
+
/** Provider-scoped coordinator counterpart of {@link errorBusFor}. */
|
|
3800
|
+
readonly recoveryFor?: (apiName: string, options?: RecoveryOptions) => RecoveryCoordinator;
|
|
3667
3801
|
/**
|
|
3668
3802
|
* Called whenever the resolved-clients map changes (initial resolve,
|
|
3669
3803
|
* reconnect swap, api removed). The React layer mirrors this into
|
|
@@ -4031,21 +4165,11 @@ export declare const useConnection: (apiName: string, connectionId: string) => C
|
|
|
4031
4165
|
export declare const useConnections: (apiName: string) => ConnectedAccountsController;
|
|
4032
4166
|
|
|
4033
4167
|
/**
|
|
4034
|
-
*
|
|
4035
|
-
*
|
|
4036
|
-
*
|
|
4037
|
-
* const { status } = useConnectionStatus('app')
|
|
4038
|
-
* {status !== 'connected' && <OfflineBanner status={status} />}
|
|
4039
|
-
* ```
|
|
4040
|
-
*
|
|
4041
|
-
* `degraded` clears after a server round trip, except that every subscription
|
|
4042
|
-
* which failed with `kind: 'transport'` must deliver its own later snapshot.
|
|
4043
|
-
* An unrelated action cannot declare a dead screen healthy. Call
|
|
4044
|
-
* `reportSuccess()` when another signal proves reachability; it likewise does
|
|
4045
|
-
* not override outstanding subscription failures.
|
|
4168
|
+
* `recovering` is intentionally a normal, non-error UI state. Render a subtle
|
|
4169
|
+
* activity cue if useful; show a disconnect banner only for `degraded` or
|
|
4170
|
+
* `offline`. Read `rawTransport` for monitoring that must react immediately.
|
|
4046
4171
|
*/
|
|
4047
4172
|
export declare const useConnectionStatus: (apiName: string) => ConnectionState & {
|
|
4048
|
-
/** Clear the degraded state — call after a known-good round trip. */
|
|
4049
4173
|
readonly reportSuccess: () => void;
|
|
4050
4174
|
};
|
|
4051
4175
|
|
|
@@ -4278,6 +4402,10 @@ export declare const useFrameworkRuntimes: () => FrameworkRuntimes;
|
|
|
4278
4402
|
*/
|
|
4279
4403
|
export declare const useMutation: <Input = unknown, Output = unknown>(apiName: string, rpcTag: string) => MutationBuilder<Input, Output>;
|
|
4280
4404
|
|
|
4405
|
+
/** Immediate, unfiltered failures for diagnostics and monitoring. UI policy
|
|
4406
|
+
* should normally use {@link useOnRpcError}, which suppresses healed gaps. */
|
|
4407
|
+
export declare const useOnRawRpcError: (apiName: string, listener: RpcErrorListener) => void;
|
|
4408
|
+
|
|
4281
4409
|
export declare const useOnRpcError: (apiName: string, listener: RpcErrorListener) => void;
|
|
4282
4410
|
|
|
4283
4411
|
export declare const useOutbox: (options: UseOutboxOptions) => OutboxControls;
|