@ancientpantheon/khronoton-core 0.9.0 → 0.11.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 +29 -0
- package/README.md +8 -0
- package/dist/blockchain/stoachain.d.ts +1 -22
- package/dist/blockchain/stoachain.js +44 -3
- package/dist/{chunk-5LYT7ZLA.js → chunk-GNQ2IVXA.js} +60 -10
- package/dist/{chunk-5OB5NQ4S.js → chunk-LX6T2BDL.js} +1 -1
- package/dist/{context-Cv3H82B5.d.ts → context-89YS4xT3.d.ts} +2 -2
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.js +2 -2
- package/dist/provider/index.d.ts +4 -4
- package/dist/provider/index.js +2 -2
- package/dist/{seams-CPj31tJJ.d.ts → seams-DUtxDw_U.d.ts} +29 -1
- package/dist/server/executor.d.ts +28 -8
- package/dist/server/executor.js +106 -20
- package/dist/server/seams.d.ts +29 -1
- package/dist/server/store/cronoton.js +6 -1
- package/dist/server/store/index.d.ts +1 -1
- package/dist/server/store/index.js +1 -1
- package/dist/server/store/mappers.d.ts +13 -0
- package/dist/server/store/mappers.js +20 -1
- package/dist/server/types.d.ts +15 -1
- package/dist/{types-u_nUX1Bg.d.ts → types-DnFB1Yz-.d.ts} +15 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +244 -54
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,35 @@ All notable changes to `@ancientpantheon/khronoton-core`.
|
|
|
4
4
|
|
|
5
5
|
The engine's pre-extraction history lives in the AncientHoldings hub, whose inline scheduler ("Cronoton") this package extracts and generalises.
|
|
6
6
|
|
|
7
|
+
## 0.11.0 — 2026-09-17
|
|
8
|
+
|
|
9
|
+
**MINOR — a discoverable edit-mode Save affordance, and auto self-calibrating gas as the default for every new cronoton.**
|
|
10
|
+
|
|
11
|
+
Two independent handoffs, built and shipped together. **(1) Editor Save.** Editing an existing cronoton had no discoverable Save — the only save action was the "Commit Codex Cronoton" button on the last (Execute) tab, silently disabled under AUTO gas until a Simulate ran, with no explanation visible from any other tab. Adds an always-visible edit-mode **`SaveBar`** — Simulate, Save changes, and a live status line — rendered above the Pact editor/tabs on every tab, gated on the edited row having actually loaded (`editReady`) so it can never fire a Simulate against a blank default state during the load window. The Execute tab's own Commit button is now edit-aware ("Save changes" / "Saving…"); create mode is unaffected. A new shared `useCommitGate(state, sim)` hook (called once in `Builder.tsx`, threaded as props) keeps `SaveBar` and `ExecuteTab` reading the identical commit body and gate — no risk of two independent `builderToCommit`/`canCommit` call sites drifting apart, and no duplicate computation on every keystroke. `SaveBar`'s Save AND Simulate buttons are both `canMutate(access)`-gated in their click handlers, not just their `disabled` attribute.
|
|
12
|
+
|
|
13
|
+
**(2) Auto self-calibrating gas.** Khronoton transactions defaulted to a fixed, manually-set gas limit, so fires over-reserved gas wildly (a real pool-payout fire measured 594 gas used against a 600,000 limit). `makeEmptyBuilderState()` now defaults `autoGasLimit` to `true`. `ChainClient` gains two new optional methods: `preflightRead` (the SDK's `local` with `{preflight:true, signatureVerification:false}` — accurate gas including the transaction-size charge that plain `dirtyRead` omits) and `getBlockGasLimit` (a live `/config` fetch, best-effort with the existing static fallback). AUTO-gas fires now calibrate from `preflightRead` instead of `dirtyRead`; a runtime missing it hard-throws on an AUTO-gas fire (mirroring the 0.9.0 `gasMeta` precedent) while a MANUAL-gas fire on the same runtime is completely unaffected. A new refuse-unmineable check returns a structured failure — never a silent cap or submit — when measured gas exceeds the resolved ceiling, for both AUTO and MANUAL fires. The ceiling itself is validated (`Number.isFinite && > 0`) before use, so a buggy adapter returning `NaN`/`0`/negative can never silently defeat the refuse check.
|
|
14
|
+
|
|
15
|
+
Reviewed via nectar (2 rounds, 5 lenses then a targeted 2-lens re-pass, adversarial validation throughout): 9 CONFIRMED findings fixed — two initially-HIGH findings (SaveBar's pre-load readiness gap; its unguarded Simulate click) were validated down to MEDIUM once the actual blast radius was traced (Save itself stayed correctly disabled; the server has its own independent auth gate); the rest were MEDIUM/LOW test-coverage, duplication, and stale-doc gaps. Zero REFUTED, zero STYLISTIC. Full history in `docs/work/khronoton-editor-save-and-auto-gas/review.md`.
|
|
16
|
+
|
|
17
|
+
**980 specs pass.**
|
|
18
|
+
|
|
19
|
+
## 0.10.0 — 2026-09-08
|
|
20
|
+
|
|
21
|
+
**MINOR — the Builder's absolute "Gas Price (ANU)" field is gone; a cronoton now always pays the live network floor plus an optional priority buffer.**
|
|
22
|
+
|
|
23
|
+
0.9.0 made the executor floor a *stored* absolute price against the live Yin Engine floor, so a fire could no longer underprice — but the Builder UI still framed gas price as something an operator *sets*, which is the wrong model for a recurring transaction: any absolute number typed today is guaranteed to go stale as the live floor keeps rising. This finishes the redesign: the UI shows a read-only, live-refreshing "Live Network Floor" display plus an editable "Priority Buffer (ANU above floor)" (default 0), and every fire prices as `liveFloor(creationTime) + buffer`, derived fresh at build time.
|
|
24
|
+
|
|
25
|
+
- **`CodexTxConfig.gasPriceBufferAnu`** (optional, additive) — ANU to pay above the live floor; absent (every pre-migration row) defaults to 0, so existing cronotons self-heal with no DB migration. `gasPrice` is kept, `@deprecated`, read-only, for parsing historical `config_json`.
|
|
26
|
+
- **`ChainRuntime.gasMeta(floorAnu, bufferAnu?)`** — the buffer is a new optional 2nd parameter, non-breaking. The adapter (`blockchain/stoachain.ts`) sums `floorAnu + bufferAnu` **in ANU**, inside the adapter, before the **one** `anuToStoaNumber` conversion — summing two independently-converted STOA floats instead produces a different serialized value in roughly 1 in 5 floor/buffer pairs, reintroducing exactly the precision bug 0.9.0 fixed. `buildTransaction` always calls `gasMeta(0, config.gasPriceBufferAnu ?? 0)` now — there is no more stored absolute value to raise to a floor.
|
|
27
|
+
- **A negative or non-finite buffer can never underprice a fire — enforced at three independent layers**, not just the UI: `ui/builder-state.ts`'s `validateConfig` blocks commit client-side; `server/store/cronoton.ts`'s `commitCodexCronoton`/`editCodexCronoton` reject a present-and-invalid `gasPriceBufferAnu` before any write (so a caller reaching the store directly, bypassing the Builder UI, can't persist a row that silently underprices every future fire); and `blockchain/stoachain.ts`'s `gasMeta` clamps a bad buffer to 0 as a third line of defense for any `CodexTxDefinition` built outside the store entirely.
|
|
28
|
+
- **New `useLiveGasFloor()` hook** (`ui/builder/live-gas-floor.ts`) polls the live floor every 30s plus a `visibilitychange`/`focus` refresh (browsers throttle `setInterval` in backgrounded tabs, and this screen is routinely left open for hours) — called once in `Builder.tsx`, threaded to `ConfigTab` and `ExecuteTab`.
|
|
29
|
+
- **Precision fix applied a second place**: `ui/tx-size.ts`'s size estimator now computes the same floor+buffer-summed-in-ANU-then-converted-once formula the executor uses, instead of the deprecated absolute `gasPrice`.
|
|
30
|
+
- **Not purely additive at the UI-type layer**: `BuilderConfig.gasPriceAnu` and `CommitGateOptions.minGasPriceAnu` are **removed**, not deprecated-in-place — both lose all meaning once there is no absolute price to floor-check, and keeping them would be actively misleading. `CodexTxConfig` itself stays additive.
|
|
31
|
+
|
|
32
|
+
Reviewed via nectar (3 rounds, 5 lenses each, adversarial validation): round 1 found and fixed a HIGH gap (a negative buffer could underprice below the live floor — server-side validation was entirely absent) plus 5 lower-severity gaps in the fix's own test coverage and a minor UI re-render inefficiency; round 2 re-verified round 1's fixes and found 3 more small issues (a misleading UI label for a transient invalid state, duplicated validation logic, a test-loop robustness nit) plus 2 STYLISTIC items the validator concluded were actually already-consistent with each file's own convention; round 3 caught one last barrel-export asymmetry. All CONFIRMED findings fixed; full history in `docs/work/gas-price-buffer/review.md`.
|
|
33
|
+
|
|
34
|
+
**938 specs pass**, plus 5 real-runtime integration specs against the installed `@stoachain/*@4.4.0`. Behavioral verification against the real compiled package + a real SQLite DB confirms: a pre-migration row self-heals to buffer 0; a negative buffer is rejected at commit AND edit time with the row genuinely left unwritten/unchanged, not just "throws".
|
|
35
|
+
|
|
7
36
|
## 0.9.0 — 2026-09-07
|
|
8
37
|
|
|
9
38
|
**MINOR — scheduled transactions are priced against the chain's LIVE gas floor at fire time, not a static value stored at creation time.**
|
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@ Khronoton is the "When do I act?" Constructor of the Pantheon architecture — t
|
|
|
6
6
|
|
|
7
7
|
## Status
|
|
8
8
|
|
|
9
|
+
**`0.11.0` on public npmjs** — **MINOR.** Released 2026-09-17. Two independent handoffs, shipped together. **Editor Save:** an always-visible edit-mode `SaveBar` (Simulate + Save changes + live status) now renders on every tab, gated on the edited row having actually loaded so it can never fire a Simulate against a blank default state; the Execute tab's own Commit button is edit-aware ("Save changes"); a new shared `useCommitGate(state, sim)` hook keeps both surfaces reading the identical commit body and gate, computed once. **Auto self-calibrating gas:** `autoGasLimit` now defaults to `true` for new cronotons; `ChainClient` gains optional `preflightRead` (accurate gas via the SDK's preflight mode, replacing `dirtyRead`'s execution-only measurement for AUTO fires) and `getBlockGasLimit` (a live block-ceiling fetch with a static fallback); a transaction whose measured gas exceeds the resolved ceiling is now refused with a structured error — never silently capped or submitted — for both AUTO and MANUAL fires, with the ceiling itself validated against `NaN`/non-finite/non-positive values before use. **980 specs pass.**
|
|
10
|
+
|
|
11
|
+
**`0.10.0` on public npmjs** — **MINOR.** Released 2026-09-08. The Builder's absolute "Gas Price (ANU)" field is gone: the UI now shows a read-only, live-refreshing "Live Network Floor" plus an editable "Priority Buffer (ANU above floor)" (default 0), and every fire prices as `liveFloor(creationTime) + buffer`. New optional `CodexTxConfig.gasPriceBufferAnu` (absent/pre-migration rows default to 0, self-healing with no DB migration); `gasPrice` stays, `@deprecated`, for reading historical rows. `ChainRuntime.gasMeta` gains an optional 2nd `bufferAnu` param (non-breaking) — the adapter sums floor+buffer **in ANU** before the one conversion, not two summed STOA floats. A negative/non-finite buffer can never underprice a fire — enforced at three layers: client `validateConfig`, the store's `commitCodexCronoton`/`editCodexCronoton` (reject before any write), and the seam's own defensive clamp. New `useLiveGasFloor()` hook polls every 30s plus visibilitychange/focus. `BuilderConfig.gasPriceAnu` and `CommitGateOptions.minGasPriceAnu` are **removed** (not deprecated-in-place) — both lost all meaning once there's no absolute price to floor-check. **938 specs pass** (+5 real-runtime integration specs).
|
|
12
|
+
|
|
9
13
|
**`0.9.0` on public npmjs** — **MINOR.** Released 2026-09-07. Scheduled transactions are now priced against the chain's **live** gas floor at fire time instead of a static value stored at creation time. A cronoton's `gasPrice` was persisted once at creation and read back verbatim on every tick, so as chainweb's post-fork Yin Engine floor rises, a long-lived cronoton silently drifts below it and its fire is rejected — with nobody watching a 3am tick. (Live, not theoretical: at release the floor was **11,569 ANU** against a stored default of **10,000**.) Adds an **optional** `ChainRuntime.gasMeta(floorAnu)` seam returning `{ creationTime, gasPrice }` from one clock read; the stored price becomes a **floor an operator can raise, never a cap**, so existing rows **self-heal with no migration**. `creationTime` is now stamped explicitly from the same call that produced the price (it was previously auto-stamped by the Pact builder from a second, independent clock read), and the AUTO-gas rebuild re-derives both fresh. Transaction meta uses the precision-safe `anuToStoaNumber` rather than float division. A StoaChain fire on a runtime lacking `gasMeta` **fails loudly** rather than silently reusing the stale price. Requires a coordinated bump of `@stoachain/stoa-core@^4.4.0`, `@stoachain/kadena-stoic-legacy@^4.4.0`, `@ouronet/ouronet-core@^4.6.0`. **907 specs pass** (+5 real-runtime integration specs).
|
|
10
14
|
|
|
11
15
|
**`0.8.0` on public npmjs** — **MINOR.** Released 2026-08-03. Finalizes the evented-resolver UI. **(1)** The cronoton **DETAIL** card's "Schedule" field now reads **"Evented"** for a trigger-only/evented row (it previously showed the stored schedule like "Daily at 12:00 UTC" while Next Fire already read "—"); the list and detail now share one `isTriggerOnly(row)` predicate (`external_fireable === 1 || runtime-arg keys`) so they can't drift. **(2)** A system (`server_resolver`) cronoton is now **deletable behind a confirm-gated warning** instead of a hard 409: `DELETE /[id]?force=1` permits the delete (the 409 still stands without force), threaded via `ConfirmOpts.force` + both reference adapters + the widened `remove.run({ force })`; the bundled Builder's Delete button is enabled for an admin on a system row and shows a warning naming the resolver before deleting, with the audit recording `forced: true`. Ordinary scheduled cronotons and non-forced deletes are unchanged. **893 specs pass.**
|
|
@@ -244,6 +248,10 @@ npm install @ancientpantheon/khronoton-core
|
|
|
244
248
|
|
|
245
249
|
## Version history
|
|
246
250
|
|
|
251
|
+
**v0.11.0** — Discoverable edit-mode Save + auto self-calibrating gas. Two independent handoffs built and shipped together. **Editor Save.** Editing an existing cronoton had no discoverable Save — the only action was the "Commit Codex Cronoton" button on the last (Execute) tab, silently disabled under AUTO gas until a Simulate ran, with the reason invisible from any other tab. Adds an always-visible edit-mode `SaveBar` (`ui/builder/SaveBar.tsx`) — Simulate, Save changes, and a live status line — rendered above the Pact editor/tabs on every tab, gated on `Builder.tsx`'s `editReady` (the edited row having actually finished loading) so it can never fire a Simulate against the blank default `makeEmptyBuilderState()` during the load window. The Execute tab's own Commit button is now edit-aware ("Save changes" / "Saving…"); create mode is byte-identical to before. A new shared `useCommitGate(state, sim)` hook (`ui/builder/use-commit-gate.ts`), extracted from `ExecuteTab.tsx`'s own prior inline logic, is called ONCE in `Builder.tsx` and threaded as `commit`/`gate` props to both `SaveBar` and `ExecuteTab` — no risk of two independent `builderToCommit`/`canCommit` call sites drifting apart, and no duplicate computation on every keystroke when both are mounted. Both of `SaveBar`'s buttons are `canMutate(access)`-gated in their CLICK HANDLERS, not just their `disabled` attribute (a directly-dispatched click event still reaches a React handler regardless of the DOM disabled state). **Auto self-calibrating gas.** Khronoton transactions defaulted to a fixed, manually-set gas limit, so fires over-reserved gas wildly — a real pool-payout fire measured 594 gas used against a 600,000 limit. `makeEmptyBuilderState()`'s `config.autoGasLimit` now defaults to `true`. `ChainClient` (`server/seams.ts`) gains two new optional methods: `preflightRead` — implemented in `blockchain/stoachain.ts` via the SDK's raw `local(tx, {preflight:true, signatureVerification:false})`, NOT its `.preflight` convenience alias (which also forces `signatureVerification:true`) — measures the TRUE gas including the transaction-size charge that plain `dirtyRead` omits; `getBlockGasLimit` does a best-effort `/config` fetch (mirroring OuronetUI's `gas-limits.ts`, ported without its browser-oriented module-level mutable-singleton cache — this package fetches fresh per fire instead, since a Node server core handling concurrent fires can't safely share that kind of global state) falling back to the existing static `AUTO_GAS_CEILING` on any failure. `executor.ts`'s `runSimulate`/`runFire` were reordered so the `ChainClient` is constructed BEFORE ceiling resolution (ceiling resolution needs it) — a real sequencing fix, not just an addition. AUTO-gas fires now calibrate from `preflightRead`; a runtime missing it hard-throws on an AUTO-gas fire only (mirroring the 0.9.0 `gasMeta` precedent — silent fallback would ship the exact over-reservation bug this exists to fix), while a MANUAL-gas fire on the same un-upgraded runtime is completely unaffected. A new refuse-unmineable check returns a structured `{ok:false, error}` — never a silent cap, never a submit — when measured gas exceeds the resolved ceiling, for BOTH AUTO and MANUAL fires. The ceiling itself (from either the live fetch or an explicit `Config.autoGasCeiling` override) is validated via a new `isSaneCeiling` check (`Number.isFinite && > 0`) before use — `NaN` in particular would otherwise silently defeat the refuse check entirely, since every `gasUsed > NaN` comparison is `false` in JS. Reviewed via nectar (2 rounds, 5 lenses then a targeted 2-lens re-pass, adversarial validation throughout): 9 CONFIRMED findings fixed, including two initially-HIGH findings (the `SaveBar` pre-load readiness gap; its originally-unguarded Simulate click) validated down to MEDIUM once the actual blast radius was traced against the code (Save itself stayed correctly disabled during the load window; the server independently re-authorizes via its own `withConfirm`/`auth.requireConfirm` gate regardless of what the UI allows). Full history in `docs/work/khronoton-editor-save-and-auto-gas/review.md`. Released 2026-09-17. **980 specs pass.**
|
|
252
|
+
|
|
253
|
+
**v0.10.0** — Locked live-floor gas + priority buffer. 0.9.0 made the executor floor a *stored* absolute price against the live Yin Engine floor so a fire could no longer underprice, but the Builder UI still framed gas price as something an operator *sets* — the wrong model for a recurring transaction, since any absolute number typed today is guaranteed to go stale as the live floor keeps rising every ~3h. This finishes the redesign: the UI shows a read-only, live-refreshing "Live Network Floor" display plus an editable "Priority Buffer (ANU above floor)" (default 0), and every fire prices as `liveFloor(creationTime) + buffer`, derived fresh at build time — never a cached/stored absolute value. **Schema.** `CodexTxConfig` gains optional `gasPriceBufferAnu`; `gasPrice` stays, `@deprecated`, read-only, so historical `config_json` still parses — absence (every pre-migration row) defaults to 0, self-healing with no DB migration. **Seam.** `ChainRuntime.gasMeta(floorAnu, bufferAnu?)` — the buffer is a new optional 2nd parameter (non-breaking: TypeScript accepts a shorter existing implementation as satisfying the widened optional signature). The adapter (`blockchain/stoachain.ts`) sums `floorAnu + bufferAnu` **in ANU**, inside the adapter, before the **one** `anuToStoaNumber` conversion at the end — summing two independently-converted STOA floats instead produces a different serialized value in roughly 1 in 5 floor/buffer pairs, reintroducing the exact precision bug 0.9.0 fixed. `buildTransaction` always calls `gasMeta(0, config.gasPriceBufferAnu ?? 0)` now — there is no more stored absolute value to raise to a floor, so the seam's first argument is always 0. **Defense in depth.** A negative or non-finite buffer can never underprice a fire, enforced at three independent layers: `ui/builder-state.ts`'s `validateConfig` blocks commit client-side; `server/store/cronoton.ts`'s `commitCodexCronoton`/`editCodexCronoton` reject a present-and-invalid `gasPriceBufferAnu` before any write, so a caller reaching the store directly (bypassing the Builder UI) can't persist a row that silently underprices every future fire; and `blockchain/stoachain.ts`'s `gasMeta` clamps a bad buffer to 0 as a third line of defense for any `CodexTxDefinition` built outside the store entirely. **Live display.** New `useLiveGasFloor()` hook (`ui/builder/live-gas-floor.ts`) polls the live floor every 30s plus a `visibilitychange`/`focus` refresh — browsers throttle `setInterval` in backgrounded tabs, and this Builder screen is routinely left open for hours — called once in `Builder.tsx`, threaded to `ConfigTab` and `ExecuteTab`. **Precision fix applied a second place.** `ui/tx-size.ts`'s size estimator now uses the same floor+buffer-summed-in-ANU-then-converted-once formula the executor uses, instead of the deprecated absolute `gasPrice`. **Breaking at the UI-type layer.** `BuilderConfig.gasPriceAnu` and `CommitGateOptions.minGasPriceAnu` are **removed**, not deprecated-in-place — both lose all meaning once there is no absolute price to floor-check against, and keeping them would be actively misleading; `CodexTxConfig` itself stays additive. Reviewed via nectar across 3 rounds (5 lenses each, adversarial validation): round 1 found and fixed a HIGH gap (server-side validation of the buffer was entirely absent) plus 5 lower-severity test-coverage/UI gaps; round 2 re-verified those fixes and caught 3 more small issues (a misleading UI label, duplicated validation logic, a test-loop robustness nit); round 3 caught one last barrel-export asymmetry — all fixed, full history in `docs/work/gas-price-buffer/review.md`. Released 2026-09-08. **938 specs pass** (+5 real-runtime integration specs).
|
|
254
|
+
|
|
247
255
|
**v0.9.0** — Live gas floor at fire time. `buildTransaction` priced every fire off `definition.config.gasPrice`, a plain ANU number persisted in `codex_cronotons` at creation time and read back verbatim on every tick (`server/tick.ts`, `server/store/mappers.ts`) — never re-derived. Post-fork, chainweb-node validates a signed transaction's price against the rising Yin Engine floor **as of that transaction's own `creationTime`**, so a cronoton created at the builder's 10,000 ANU default is already underpriced and drifts further as it ages; because this is unattended automation, the rejection surfaces at 3am with nobody watching. **The seam.** `ChainRuntime` gains an **optional** `gasMeta(floorAnu): { creationTime, gasPrice }`. Optional keeps the package chain-POLYGLOT and `@stoachain/*` an optional peer dependency — a chain without a rising floor omits it — but the executor **hard throws** when a StoaChain fire finds it missing, because a silent fallback to the stored value would ship the original bug to anyone who did not notice they must upgrade their adapter. In `fire` mode that throw is caught by the existing F-002 wrapper and returned as a structured `{ ok: false, error }`, so a one-time entry still records its spent attempt instead of re-firing forever. **Floor, not cap.** The implementation returns `max(storedAnu, minGasPriceAnu(creationTime))`, so an operator may still price above the minimum and existing stored rows self-heal with **no database migration**. **One clock read.** `setMeta` previously omitted `creationTime` entirely, letting the Pact builder auto-stamp its own at `createTransaction()` — an independent second read the price no longer corresponded to. Both fields now come from a single `stoaGasMeta()`-derived call, and the AUTO-gas calibrated rebuild+re-sign re-enters the seam rather than reusing the pre-flight values, so the two builds cannot straddle a 3-hour tick boundary and underprice the transaction that actually ships (pinned by a regression spec that fails if the call is hoisted out of `buildTransaction`). **Precision.** Transaction meta now converts via `anuToStoaNumber` (exact padded-decimal) instead of `anuToStoa` (float division), which upstream documents as unsafe for a value chainweb hashes and validates exactly; the same fix lands in `ui/tx-size.ts`'s fee meter, whose purpose is predicting the real signed transaction's byte size. **Builder gate.** `validateConfig` accepts `CommitGateOptions.minGasPriceAnu` in place of a hardcoded `>= 10000` check that accepted already-underpriced values, and names the applied floor in its message; omitting it falls back to the genesis floor, under-rejecting rather than over-rejecting since the executor raises the price at fire time regardless. **Boundary.** `blockchain/stoachain.ts` is the only module that knows the Yin Engine exists, wrapping `@stoachain/stoa-core/gas` rather than reimplementing a formula already independently reimplemented four times across the ecosystem; `/server` stays free of any `@stoachain/*` import. Requires a coordinated dependency bump — stoa-core 4.4.0 peer-pins kadena-stoic-legacy 4.4.0 exactly, and only ouronet-core 4.6.0 accepts stoa-core 4.4.0, so the three move together. All new surface (`StoaGasMeta`, `ChainRuntime.gasMeta`, `CommitGateOptions.minGasPriceAnu`) is additive. Released 2026-09-07. **907 specs pass** (+5 real-runtime integration specs).
|
|
248
256
|
|
|
249
257
|
**v0.8.0** — Finalizes the evented-resolver UI (the last two gaps after 0.7.0). **Fix 1 — DETAIL "Schedule" reads "Evented".** The read-only cronoton detail card rendered the stored `schedule_config` (e.g. "Daily at 12:00 UTC") for a trigger-only/evented row even though Next Fire already showed "—" and the edit form already disabled the scheduler; root cause was `Detail.tsx` deriving `triggerOnly` from runtime-arg keys only, ignoring `external_fireable`. The list's predicate is extracted to a shared `isTriggerOnly(row)` (`row.external_fireable === 1 || parseRuntimeArgKeys(row.runtime_arg_keys).length > 0`) in `ui/row-derive.ts`, used by both the list next-fire cell and the detail Schedule cell so they can't drift; the detail Schedule cell now reads **"Evented"** for a trigger-only row. **Fix 2 — confirm-gated system delete.** `DELETE /[id]` hard-refused any `server_resolver` ("system") cronoton with `409 { protected: true }`; it now accepts `?force=1` (still behind the admin confirm gate) to permit the delete, while the 409 stands without force. Threaded end-to-end: `ConfirmOpts.force` → `createFetchAdapter` sends `?force=1` / `createMemoryAdapter` passes `query: { force: "1" }` → the widened `DeleteAction`/`remove.run({ force })` action hook. In the bundled Builder, `deleteDisabled` now **enables** the Delete button for an admin on a system cronoton (non-admins still blocked), and both the detail and list `handleDelete` show a `deleteSystemConfirm` warning naming the resolver — *"This is the automaton's `<name>` template. Deleting it stops that capability until it's recreated. Delete anyway?"* — as the first prompt, keeping the existing in-gate password confirm. The delete audit is preserved and records `forced: true` for a forced system delete. Ordinary scheduled cronotons, non-system deletes, and `delete(id)`/`remove.run()` without force are byte-identical to 0.7.0; a system delete without force still 409s. All new surface (`ConfirmOpts.force`, `DeleteRunOpts`, `deleteSystemConfirm`, `row-derive`'s `isTriggerOnly`) is additive. Released 2026-08-03. **893 specs pass.**
|
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
import { C as ChainRuntime } from '../seams-
|
|
1
|
+
import { C as ChainRuntime } from '../seams-DUtxDw_U.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* `@ancientpantheon/khronoton-core/blockchain/stoachain` — the StoaChain edge.
|
|
5
|
-
*
|
|
6
|
-
* khronoton is chain-POLYGLOT, not chain-agnostic: the root `.` schedule engine
|
|
7
|
-
* and the `/server` tick/store engine orchestrate, and each `/blockchain/<chain>`
|
|
8
|
-
* subpath teaches them to speak one chain's language. This one wraps the
|
|
9
|
-
* `@stoachain/*` runtime into the core {@link ChainRuntime} seam so a StoaChain
|
|
10
|
-
* automaton injects one object instead of reaching for `@stoachain/*` directly.
|
|
11
|
-
*
|
|
12
|
-
* The `@stoachain/*` packages are OPTIONAL PEER DEPENDENCIES: importing this
|
|
13
|
-
* subpath costs nothing (the SDK imports are lazy, inside the factory), so a
|
|
14
|
-
* consumer who never talks StoaChain never installs them. Only calling
|
|
15
|
-
* `createStoachainRuntime()` pulls the SDK — and a StoaChain automaton has it.
|
|
16
|
-
*
|
|
17
|
-
* This adapter is also the ONLY place khronoton knows StoaChain's rising gas
|
|
18
|
-
* floor (the Yin Engine) exists. The `/server` executor asks for gas meta
|
|
19
|
-
* through the {@link ChainRuntime.gasMeta} seam and never imports the formula;
|
|
20
|
-
* `@stoachain/stoa-core/gas` owns the single canonical implementation, which is
|
|
21
|
-
* why this wraps it rather than reimplementing the arithmetic locally — that
|
|
22
|
-
* reimplementation has already happened four times across the ecosystem.
|
|
23
|
-
*/
|
|
24
3
|
/**
|
|
25
4
|
* Consumer-facing knobs for {@link createStoachainRuntime}. Every field is
|
|
26
5
|
* optional; an omitted field falls back to the corresponding `@stoachain/*`
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
// src/blockchain/stoachain.ts
|
|
2
|
+
var AUTO_GAS_CEILING_FALLBACK = 2e6;
|
|
3
|
+
function findBlockGasLimit(obj, depth = 0) {
|
|
4
|
+
if (depth > 8 || obj == null || typeof obj !== "object") return null;
|
|
5
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
6
|
+
if (typeof v === "number" && /block.?gas.?limit|gas.?limit.?of.?block/i.test(k) && v >= 5e4 && v <= 5e7) {
|
|
7
|
+
return Math.floor(v);
|
|
8
|
+
}
|
|
9
|
+
if (v && typeof v === "object") {
|
|
10
|
+
const found = findBlockGasLimit(v, depth + 1);
|
|
11
|
+
if (found) return found;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
2
16
|
async function createStoachainRuntime(config) {
|
|
3
17
|
const client = await import('@stoachain/kadena-stoic-legacy/client');
|
|
4
18
|
const signing = await import('@stoachain/stoa-core/signing');
|
|
@@ -12,14 +26,41 @@ async function createStoachainRuntime(config) {
|
|
|
12
26
|
const getPactUrl = nodeBaseUrl ? (chainId) => `${nodeBaseUrl}/chainweb/0.0/${networkId}/chain/${chainId}/pact` : constants.getPactUrl;
|
|
13
27
|
return {
|
|
14
28
|
Pact: client.Pact,
|
|
15
|
-
|
|
29
|
+
// The SDK client is no longer returned by identity: it's wrapped so the
|
|
30
|
+
// two new optional ChainClient capabilities (preflightRead,
|
|
31
|
+
// getBlockGasLimit) ride alongside the real dirtyRead/submit/listen,
|
|
32
|
+
// which stay byte-identical pass-throughs.
|
|
33
|
+
createClient: ((url) => {
|
|
34
|
+
const real = client.createClient(url);
|
|
35
|
+
return {
|
|
36
|
+
...real,
|
|
37
|
+
preflightRead: (tx) => real.local(tx, {
|
|
38
|
+
preflight: true,
|
|
39
|
+
signatureVerification: false
|
|
40
|
+
}),
|
|
41
|
+
getBlockGasLimit: async () => {
|
|
42
|
+
try {
|
|
43
|
+
const origin = url.replace(/\/chainweb\/.*$/, "");
|
|
44
|
+
const res = await fetch(`${origin}/config`, {
|
|
45
|
+
headers: { accept: "application/json" }
|
|
46
|
+
});
|
|
47
|
+
if (!res.ok) return AUTO_GAS_CEILING_FALLBACK;
|
|
48
|
+
const found = findBlockGasLimit(await res.json());
|
|
49
|
+
return found ?? AUTO_GAS_CEILING_FALLBACK;
|
|
50
|
+
} catch {
|
|
51
|
+
return AUTO_GAS_CEILING_FALLBACK;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}),
|
|
16
56
|
isSignedTransaction: client.isSignedTransaction,
|
|
17
57
|
universalSignTransaction: signing.universalSignTransaction,
|
|
18
58
|
calculateAutoGasLimit: gas.calculateAutoGasLimit,
|
|
19
59
|
anuToStoa: gas.anuToStoa,
|
|
20
|
-
gasMeta: (floorAnu) => {
|
|
60
|
+
gasMeta: (floorAnu, bufferAnu = 0) => {
|
|
21
61
|
const { creationTime } = gas.stoaGasMeta();
|
|
22
|
-
const
|
|
62
|
+
const safeBufferAnu = Number.isFinite(bufferAnu) && bufferAnu > 0 ? bufferAnu : 0;
|
|
63
|
+
const anu = Math.max(floorAnu, gas.minGasPriceAnu(creationTime)) + safeBufferAnu;
|
|
23
64
|
return { creationTime, gasPrice: gas.anuToStoaNumber(anu) };
|
|
24
65
|
},
|
|
25
66
|
getPactUrl,
|
|
@@ -213,6 +213,14 @@ function effectiveSigners(definition, kadenaNamespace) {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
// src/server/executor.ts
|
|
216
|
+
function isSaneCeiling(v) {
|
|
217
|
+
return typeof v === "number" && Number.isFinite(v) && v > 0;
|
|
218
|
+
}
|
|
219
|
+
async function resolveCeiling(ctx, client) {
|
|
220
|
+
if (isSaneCeiling(ctx.config?.autoGasCeiling)) return ctx.config.autoGasCeiling;
|
|
221
|
+
const live = await client.getBlockGasLimit?.();
|
|
222
|
+
return isSaneCeiling(live) ? live : AUTO_GAS_CEILING;
|
|
223
|
+
}
|
|
216
224
|
function buildTransaction(runtime, definition, signers, gasLimitOverride) {
|
|
217
225
|
if (signers.length === 0) {
|
|
218
226
|
throw new Error(
|
|
@@ -231,7 +239,10 @@ function buildTransaction(runtime, definition, signers, gasLimitOverride) {
|
|
|
231
239
|
"ChainRuntime.gasMeta is required to price a transaction: without it the per-cronoton stored gasPrice would be used verbatim, which drifts below the chain's rising minimum as a cronoton ages and gets the fire rejected. Upgrade the injected runtime adapter (see blockchain/stoachain.ts)."
|
|
232
240
|
);
|
|
233
241
|
}
|
|
234
|
-
const { creationTime, gasPrice } = runtime.gasMeta(
|
|
242
|
+
const { creationTime, gasPrice } = runtime.gasMeta(
|
|
243
|
+
0,
|
|
244
|
+
definition.config.gasPriceBufferAnu ?? 0
|
|
245
|
+
);
|
|
235
246
|
builder.setMeta({
|
|
236
247
|
senderAccount,
|
|
237
248
|
chainId: definition.config.chainId,
|
|
@@ -310,8 +321,9 @@ async function listenWithTimeout(listen, descriptor, timeoutMs) {
|
|
|
310
321
|
}
|
|
311
322
|
async function runSimulate(ctx, definition, signers) {
|
|
312
323
|
const { runtime, resolver } = ctx;
|
|
313
|
-
const ceiling = ctx.config?.autoGasCeiling ?? AUTO_GAS_CEILING;
|
|
314
324
|
const { autoGasLimit } = definition.config;
|
|
325
|
+
const client = runtime.createClient(runtime.getPactUrl(definition.config.chainId));
|
|
326
|
+
const ceiling = await resolveCeiling(ctx, client);
|
|
315
327
|
const tx = buildTransaction(
|
|
316
328
|
runtime,
|
|
317
329
|
definition,
|
|
@@ -319,10 +331,12 @@ async function runSimulate(ctx, definition, signers) {
|
|
|
319
331
|
autoGasLimit ? ceiling : void 0
|
|
320
332
|
);
|
|
321
333
|
const signed = await signTransaction(runtime, resolver, signers, tx);
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
334
|
+
if (autoGasLimit && !client.preflightRead) {
|
|
335
|
+
throw new Error(
|
|
336
|
+
"ChainRuntime.preflightRead is required to auto-size gas for an AUTO-gas transaction: without it the calibration would use dirtyRead's execution-only gas figure, which omits the transaction-size charge and reproduces the exact over-reservation bug this capability exists to fix. Upgrade the injected runtime adapter (see blockchain/stoachain.ts), or switch this cronoton to manual gas."
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
const simulation = autoGasLimit ? await client.preflightRead(signed) : await client.dirtyRead(signed);
|
|
326
340
|
if (simulation.result.status === "failure") {
|
|
327
341
|
return {
|
|
328
342
|
ok: false,
|
|
@@ -333,6 +347,16 @@ async function runSimulate(ctx, definition, signers) {
|
|
|
333
347
|
};
|
|
334
348
|
}
|
|
335
349
|
const gasUsed = simulation.gas || 0;
|
|
350
|
+
if (gasUsed > ceiling) {
|
|
351
|
+
return {
|
|
352
|
+
ok: false,
|
|
353
|
+
mode: "simulate",
|
|
354
|
+
gasUsed,
|
|
355
|
+
error: `Transaction needs ${gasUsed} gas, over the block limit of ${ceiling} \u2014 no gas setting can mine it. Reduce the transaction's size or complexity.`,
|
|
356
|
+
rawResult: simulation.result,
|
|
357
|
+
terminalIntent: null
|
|
358
|
+
};
|
|
359
|
+
}
|
|
336
360
|
const calibratedGasLimit = autoGasLimit && gasUsed > 0 ? runtime.calculateAutoGasLimit(gasUsed) : void 0;
|
|
337
361
|
return {
|
|
338
362
|
ok: true,
|
|
@@ -345,10 +369,10 @@ async function runSimulate(ctx, definition, signers) {
|
|
|
345
369
|
}
|
|
346
370
|
async function runFire(ctx, definition, signers) {
|
|
347
371
|
const { runtime, resolver } = ctx;
|
|
348
|
-
const ceiling = ctx.config?.autoGasCeiling ?? AUTO_GAS_CEILING;
|
|
349
372
|
const listenMs = ctx.config?.listenTimeoutMs ?? LISTEN_TIMEOUT_MS;
|
|
350
373
|
const { chainId, autoGasLimit } = definition.config;
|
|
351
374
|
const client = runtime.createClient(runtime.getPactUrl(chainId));
|
|
375
|
+
const ceiling = await resolveCeiling(ctx, client);
|
|
352
376
|
let tx = buildTransaction(
|
|
353
377
|
runtime,
|
|
354
378
|
definition,
|
|
@@ -356,7 +380,12 @@ async function runFire(ctx, definition, signers) {
|
|
|
356
380
|
autoGasLimit ? ceiling : void 0
|
|
357
381
|
);
|
|
358
382
|
let signed = await signTransaction(runtime, resolver, signers, tx);
|
|
359
|
-
|
|
383
|
+
if (autoGasLimit && !client.preflightRead) {
|
|
384
|
+
throw new Error(
|
|
385
|
+
"ChainRuntime.preflightRead is required to auto-size gas for an AUTO-gas transaction: without it the calibration would use dirtyRead's execution-only gas figure, which omits the transaction-size charge and reproduces the exact over-reservation bug this capability exists to fix. Upgrade the injected runtime adapter (see blockchain/stoachain.ts), or switch this cronoton to manual gas."
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
const preflight = autoGasLimit ? await client.preflightRead(signed) : await client.dirtyRead(signed);
|
|
360
389
|
if (preflight.result.status === "failure") {
|
|
361
390
|
return {
|
|
362
391
|
ok: false,
|
|
@@ -367,8 +396,19 @@ async function runFire(ctx, definition, signers) {
|
|
|
367
396
|
terminalIntent: computeTerminalIntent(definition.scheduleKind, "fire", false)
|
|
368
397
|
};
|
|
369
398
|
}
|
|
370
|
-
|
|
371
|
-
|
|
399
|
+
const gasUsed = preflight.gas || 0;
|
|
400
|
+
if (gasUsed > ceiling) {
|
|
401
|
+
return {
|
|
402
|
+
ok: false,
|
|
403
|
+
mode: "fire",
|
|
404
|
+
chainId,
|
|
405
|
+
error: `Transaction needs ${gasUsed} gas, over the block limit of ${ceiling} \u2014 no gas setting can mine it. Reduce the transaction's size or complexity.`,
|
|
406
|
+
rawResult: preflight.result,
|
|
407
|
+
terminalIntent: computeTerminalIntent(definition.scheduleKind, "fire", false)
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
if (autoGasLimit && gasUsed > 0) {
|
|
411
|
+
const calibrated = runtime.calculateAutoGasLimit(gasUsed);
|
|
372
412
|
tx = buildTransaction(runtime, definition, signers, calibrated);
|
|
373
413
|
signed = await signTransaction(runtime, resolver, signers, tx);
|
|
374
414
|
}
|
|
@@ -519,6 +559,14 @@ function assertAutoGasGate(config) {
|
|
|
519
559
|
throw new AutoGasGateError();
|
|
520
560
|
}
|
|
521
561
|
}
|
|
562
|
+
function assertGasPriceBufferAnu(config) {
|
|
563
|
+
if (config.gasPriceBufferAnu == null) return;
|
|
564
|
+
if (!Number.isFinite(config.gasPriceBufferAnu) || config.gasPriceBufferAnu < 0) {
|
|
565
|
+
throw new CodexCronotonValidationError(
|
|
566
|
+
"config.gasPriceBufferAnu must be a non-negative finite number"
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
522
570
|
function manualBatchView(row) {
|
|
523
571
|
return {
|
|
524
572
|
id: row.id,
|
|
@@ -1174,6 +1222,7 @@ function commitCodexCronoton(input, opts) {
|
|
|
1174
1222
|
if (!input.config || typeof input.config.chainId !== "string") {
|
|
1175
1223
|
throw new CodexCronotonValidationError("config.chainId must be a string");
|
|
1176
1224
|
}
|
|
1225
|
+
assertGasPriceBufferAnu(input.config);
|
|
1177
1226
|
if (!Array.isArray(input.signers)) {
|
|
1178
1227
|
throw new CodexCronotonValidationError("signers must be an array");
|
|
1179
1228
|
}
|
|
@@ -1289,6 +1338,7 @@ function editCodexCronoton(id, patch, opts) {
|
|
|
1289
1338
|
changedFields.push("pactCode");
|
|
1290
1339
|
}
|
|
1291
1340
|
if (patch.config) {
|
|
1341
|
+
assertGasPriceBufferAnu(patch.config);
|
|
1292
1342
|
assertAutoGasGate(patch.config);
|
|
1293
1343
|
nextConfigJson = JSON.stringify(patch.config);
|
|
1294
1344
|
changedFields.push("config");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useKhronotonAdapter, useKhronotonConfig, runGated } from './chunk-
|
|
1
|
+
import { useKhronotonAdapter, useKhronotonConfig, runGated } from './chunk-GNQ2IVXA.js';
|
|
2
2
|
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
3
|
|
|
4
4
|
function useCronotons(query) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { b as CodexTxConfig, c as CodexGasPayer, d as CodexSigner, S as ScheduleMode, e as ScheduleConfig, C as CodexCronotonRow, a as CodexCronotonFireRow, M as ManualBatchView } from './types-
|
|
3
|
-
import { b as DbDep, D as Database } from './seams-
|
|
2
|
+
import { b as CodexTxConfig, c as CodexGasPayer, d as CodexSigner, S as ScheduleMode, e as ScheduleConfig, C as CodexCronotonRow, a as CodexCronotonFireRow, M as ManualBatchView } from './types-DnFB1Yz-.js';
|
|
3
|
+
import { b as DbDep, D as Database } from './seams-DUtxDw_U.js';
|
|
4
4
|
|
|
5
5
|
/** A validated bag of runtime args — every value is a string (Pact `read-string`). */
|
|
6
6
|
type RuntimeArgs = Record<string, string>;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { L as ListCronotonsQuery, R as ResolversView, C as CommitBody, a as CommitView, E as EditPatch, b as EditView, T as ToggleView, D as DeleteView, c as CancelBatchView, d as ExecuteView, e as RecoverView, S as SimulateEnvelope, f as SimulateView, g as StartBatchView, h as RuntimeArgs } from '../context-
|
|
2
|
-
export { U as UseKhronotonResult, u as useKhronoton } from '../context-
|
|
3
|
-
import { C as CodexCronotonRow, a as CodexCronotonFireRow, M as ManualBatchView } from '../types-
|
|
1
|
+
import { L as ListCronotonsQuery, R as ResolversView, C as CommitBody, a as CommitView, E as EditPatch, b as EditView, T as ToggleView, D as DeleteView, c as CancelBatchView, d as ExecuteView, e as RecoverView, S as SimulateEnvelope, f as SimulateView, g as StartBatchView, h as RuntimeArgs } from '../context-89YS4xT3.js';
|
|
2
|
+
export { U as UseKhronotonResult, u as useKhronoton } from '../context-89YS4xT3.js';
|
|
3
|
+
import { C as CodexCronotonRow, a as CodexCronotonFireRow, M as ManualBatchView } from '../types-DnFB1Yz-.js';
|
|
4
4
|
import 'react';
|
|
5
|
-
import '../seams-
|
|
5
|
+
import '../seams-DUtxDw_U.js';
|
|
6
6
|
|
|
7
7
|
/** The `useCronotons()` return shape — the list, its load state, and a refetch. */
|
|
8
8
|
interface UseCronotonsView {
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { useCancelBatch, useCronoton, useCronotonActions, useCronotonFires, useCronotons, useExecuteNow, useManualBatch, useRecoverFire, useServerResolvers, useSimulate, useStartBatch, useTrigger } from '../chunk-
|
|
2
|
-
export { useKhronoton } from '../chunk-
|
|
1
|
+
export { useCancelBatch, useCronoton, useCronotonActions, useCronotonFires, useCronotons, useExecuteNow, useManualBatch, useRecoverFire, useServerResolvers, useSimulate, useStartBatch, useTrigger } from '../chunk-LX6T2BDL.js';
|
|
2
|
+
export { useKhronoton } from '../chunk-GNQ2IVXA.js';
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { H as HandlerRequest, i as HandlerResponse, K as KhronotonProviderProps, j as KhronotonAdapter, k as SignerSource } from '../context-
|
|
3
|
-
export { c as CancelBatchView, l as CodexSignerDescriptor, C as CommitBody, a as CommitView, m as ConfirmGate, n as ConfirmOpts, o as DEFAULT_EXPLORER_BASE, p as DEFAULT_PAGE_SIZE, q as DEFAULT_POLL_CADENCE_MS, D as DeleteView, E as EditPatch, b as EditView, d as ExecuteView, F as FiresQuery, r as FiresView, G as GetBatchView, s as GetCronotonView, t as KhronotonConfig, v as KhronotonSnapshot, L as ListCronotonsQuery, w as ListCronotonsView, e as RecoverView, x as RenderMultiTx, h as RuntimeArgs, y as ServerResolverOption, z as SignersView, S as SimulateEnvelope, f as SimulateView, g as StartBatchView, T as ToggleView, U as UseKhronotonResult, A as assertAdapter, B as emptySnapshot, u as useKhronoton } from '../context-
|
|
4
|
-
import { D as Database, C as ChainRuntime, K as KeyResolver, R as ResolveFireMode, O as OnAudit, a as Config } from '../seams-
|
|
5
|
-
export { a as CodexCronotonFireRow, C as CodexCronotonRow, M as ManualBatchView } from '../types-
|
|
2
|
+
import { H as HandlerRequest, i as HandlerResponse, K as KhronotonProviderProps, j as KhronotonAdapter, k as SignerSource } from '../context-89YS4xT3.js';
|
|
3
|
+
export { c as CancelBatchView, l as CodexSignerDescriptor, C as CommitBody, a as CommitView, m as ConfirmGate, n as ConfirmOpts, o as DEFAULT_EXPLORER_BASE, p as DEFAULT_PAGE_SIZE, q as DEFAULT_POLL_CADENCE_MS, D as DeleteView, E as EditPatch, b as EditView, d as ExecuteView, F as FiresQuery, r as FiresView, G as GetBatchView, s as GetCronotonView, t as KhronotonConfig, v as KhronotonSnapshot, L as ListCronotonsQuery, w as ListCronotonsView, e as RecoverView, x as RenderMultiTx, h as RuntimeArgs, y as ServerResolverOption, z as SignersView, S as SimulateEnvelope, f as SimulateView, g as StartBatchView, T as ToggleView, U as UseKhronotonResult, A as assertAdapter, B as emptySnapshot, u as useKhronoton } from '../context-89YS4xT3.js';
|
|
4
|
+
import { D as Database, C as ChainRuntime, K as KeyResolver, R as ResolveFireMode, O as OnAudit, a as Config } from '../seams-DUtxDw_U.js';
|
|
5
|
+
export { a as CodexCronotonFireRow, C as CodexCronotonRow, M as ManualBatchView } from '../types-DnFB1Yz-.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The per-request handler context + the injectable auth/confirm seam + the two
|
package/dist/provider/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { assertAdapter, resolveConfig, KhronotonStaticContext, KhronotonStatusContext, NeedsConfirmError, installSchema, defaultOpenAuth, withConfirm, err, recoverFire, json, createManualBatch, manualBatchView, getCodexCronoton, validateRuntimeArgs, rowRuntimeArgKeys, applyRuntimeArgs, rowToDefinition, getServerResolver, resolveServerVars, executeCodexTransaction, CodexCronotonValidationError, deleteCodexCronoton, resumeCodexCronoton, pauseCodexCronoton, editCodexCronoton, commitCodexCronoton, withRead, listFires, listCodexCronotons, getActiveManualBatchForCronoton, cancelManualBatch, listServerResolvers, defaultSignerSource, fireByServerResolver, computeDefinitionFingerprint, recordFire, applyTerminalIntent } from '../chunk-
|
|
2
|
-
export { DEFAULT_EXPLORER_BASE, DEFAULT_PAGE_SIZE, DEFAULT_POLL_CADENCE_MS, NeedsConfirmError, assertAdapter, emptySnapshot, runGated, useKhronoton } from '../chunk-
|
|
1
|
+
import { assertAdapter, resolveConfig, KhronotonStaticContext, KhronotonStatusContext, NeedsConfirmError, installSchema, defaultOpenAuth, withConfirm, err, recoverFire, json, createManualBatch, manualBatchView, getCodexCronoton, validateRuntimeArgs, rowRuntimeArgKeys, applyRuntimeArgs, rowToDefinition, getServerResolver, resolveServerVars, executeCodexTransaction, CodexCronotonValidationError, deleteCodexCronoton, resumeCodexCronoton, pauseCodexCronoton, editCodexCronoton, commitCodexCronoton, withRead, listFires, listCodexCronotons, getActiveManualBatchForCronoton, cancelManualBatch, listServerResolvers, defaultSignerSource, fireByServerResolver, computeDefinitionFingerprint, recordFire, applyTerminalIntent } from '../chunk-GNQ2IVXA.js';
|
|
2
|
+
export { DEFAULT_EXPLORER_BASE, DEFAULT_PAGE_SIZE, DEFAULT_POLL_CADENCE_MS, NeedsConfirmError, assertAdapter, emptySnapshot, runGated, useKhronoton } from '../chunk-GNQ2IVXA.js';
|
|
3
3
|
import { useRef, useState, useEffect } from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -97,6 +97,26 @@ interface ListenResult {
|
|
|
97
97
|
/** A network client bound to a single Pact endpoint URL. */
|
|
98
98
|
interface ChainClient {
|
|
99
99
|
dirtyRead(tx: unknown): Promise<DirtyReadResult>;
|
|
100
|
+
/**
|
|
101
|
+
* `local` with `{ preflight: true, signatureVerification: false }` — measures
|
|
102
|
+
* the TRUE gas a transaction will consume, including the transaction-size
|
|
103
|
+
* charge that a plain `dirtyRead` (execution gas only) omits. Optional so the
|
|
104
|
+
* package stays non-breaking for any custom `ChainClient`; the executor HARD
|
|
105
|
+
* THROWS when it's absent on an AUTO-gas fire — a silent fallback to the
|
|
106
|
+
* inaccurate `dirtyRead` measurement would ship the exact over-reservation bug
|
|
107
|
+
* this capability exists to fix (mirrors `ChainRuntime.gasMeta`'s precedent).
|
|
108
|
+
* A MANUAL-gas fire never needs this and is unaffected by its absence.
|
|
109
|
+
*/
|
|
110
|
+
preflightRead?(tx: unknown): Promise<DirtyReadResult>;
|
|
111
|
+
/**
|
|
112
|
+
* The live block gas limit, read from the node. Optional and BEST-EFFORT —
|
|
113
|
+
* unlike `preflightRead`, a stale/failed read here only degrades the
|
|
114
|
+
* simulate-at-ceiling sizing and the refuse-unmineable threshold, since the
|
|
115
|
+
* real chainweb node is still the authoritative validator of what actually
|
|
116
|
+
* fits; the executor falls back to `Config.autoGasCeiling`/`AUTO_GAS_CEILING`
|
|
117
|
+
* on any failure or absence, matching OuronetUI's own documented choice here.
|
|
118
|
+
*/
|
|
119
|
+
getBlockGasLimit?(): Promise<number>;
|
|
100
120
|
submit(tx: unknown): Promise<{
|
|
101
121
|
requestKey: string;
|
|
102
122
|
}>;
|
|
@@ -144,6 +164,14 @@ interface StoaGasMeta {
|
|
|
144
164
|
* transaction below it. Implementations return
|
|
145
165
|
* `max(floorAnu, liveFloor(creationTime))`, converted to chain units.
|
|
146
166
|
* See `blockchain/stoachain.ts` for the StoaChain implementation.
|
|
167
|
+
*
|
|
168
|
+
* `bufferAnu` (default 0) is added to `floorAnu` **in ANU**, before the
|
|
169
|
+
* implementation's one `anuToStoaNumber` conversion — summing two
|
|
170
|
+
* independently-converted STOA numbers instead produces a different
|
|
171
|
+
* serialized value in roughly 1 in 5 floor/buffer pairs (verified:
|
|
172
|
+
* `anuToStoaNumber(11569) + anuToStoaNumber(500)` !== `anuToStoaNumber(12069)`
|
|
173
|
+
* as JSON strings), which is exactly the class of bug `anuToStoaNumber`
|
|
174
|
+
* exists to prevent.
|
|
147
175
|
*/
|
|
148
176
|
interface ChainRuntime {
|
|
149
177
|
Pact: {
|
|
@@ -156,7 +184,7 @@ interface ChainRuntime {
|
|
|
156
184
|
universalSignTransaction(tx: IUnsignedCommand, keypairs: UniversalKeypair[]): Promise<unknown>;
|
|
157
185
|
calculateAutoGasLimit(gas: number): number;
|
|
158
186
|
anuToStoa(anu: number): number;
|
|
159
|
-
gasMeta?(floorAnu: number): StoaGasMeta;
|
|
187
|
+
gasMeta?(floorAnu: number, bufferAnu?: number): StoaGasMeta;
|
|
160
188
|
getPactUrl(chainId: string): string;
|
|
161
189
|
networkId: string;
|
|
162
190
|
namespace: string;
|
|
@@ -13,10 +13,26 @@
|
|
|
13
13
|
* - fire NEVER throws (F-002) — every failure returns a structured result;
|
|
14
14
|
* - the dirty-read pre-flight gate (F-001) — a failing pre-flight never submits;
|
|
15
15
|
* - AUTO-gas calibrate — build at the ceiling, rebuild + re-sign at the
|
|
16
|
-
*
|
|
16
|
+
* preflight-derived limit;
|
|
17
17
|
* - the 504/derived-request-key recovery (REQ-23) — the request key is derived
|
|
18
18
|
* from the signed command hash UP FRONT so a lost submit response or a listen
|
|
19
19
|
* timeout never discards a tx that may already be on-chain.
|
|
20
|
+
*
|
|
21
|
+
* Auto self-calibrating gas (khronoton-auto-gas) adds three more:
|
|
22
|
+
* - AUTO-gas calibration sources its measurement from `ChainClient.preflightRead`
|
|
23
|
+
* (the TRUE gas, including the transaction-size charge) instead of the plain
|
|
24
|
+
* `dirtyRead` (execution gas only) — the executor HARD THROWS when
|
|
25
|
+
* `autoGasLimit` is true and `preflightRead` is absent from the injected
|
|
26
|
+
* runtime, mirroring the `gasMeta` hard-throw precedent above. A MANUAL-gas
|
|
27
|
+
* fire never needs this and stays on `dirtyRead`, unaffected by its absence;
|
|
28
|
+
* - the simulate/fire ceiling is resolved live via `resolveCeiling`: an
|
|
29
|
+
* explicit `config.autoGasCeiling` override wins outright, else a
|
|
30
|
+
* best-effort `client.getBlockGasLimit()` read, else the static
|
|
31
|
+
* `AUTO_GAS_CEILING` fallback;
|
|
32
|
+
* - refuse-unmineable — a transaction whose measured gas exceeds the resolved
|
|
33
|
+
* ceiling is refused with a structured `{ ok: false, error }` (never a
|
|
34
|
+
* throw, matching F-002) BEFORE any calibration/rebuild or submit, for both
|
|
35
|
+
* AUTO and MANUAL fires.
|
|
20
36
|
*/
|
|
21
37
|
import type { ChainRuntime, KeyResolver, Config } from "./seams.js";
|
|
22
38
|
import type { CodexTxDefinition, FireResult, SimulateResult } from "./types.js";
|
|
@@ -35,19 +51,23 @@ export interface ExecutorCtx {
|
|
|
35
51
|
config?: Partial<Config>;
|
|
36
52
|
}
|
|
37
53
|
/**
|
|
38
|
-
* Execute a codex transaction in `simulate` (sign +
|
|
39
|
-
* `fire` (pre-flight
|
|
40
|
-
* {@link ExecutorCtx}.
|
|
54
|
+
* Execute a codex transaction in `simulate` (sign + pre-submit read, NO
|
|
55
|
+
* submit) or `fire` (pre-flight read → submit → listen) mode against the
|
|
56
|
+
* injected {@link ExecutorCtx}. That pre-submit/pre-flight read is
|
|
57
|
+
* `ChainClient.preflightRead` for an AUTO-gas transaction (accurate gas,
|
|
58
|
+
* including the transaction-size charge) and plain `ChainClient.dirtyRead`
|
|
59
|
+
* for a MANUAL-gas one (see the module doc above for why) — both modes
|
|
60
|
+
* inherit whichever the definition's `autoGasLimit` selects.
|
|
41
61
|
*
|
|
42
62
|
* `fire` mode NEVER throws on chain/sign/decrypt failure (F-002): every failure
|
|
43
|
-
* mode —
|
|
44
|
-
* and resolver/decrypt rejection — returns a structured
|
|
63
|
+
* mode — pre-flight-read failure, sign-incompletion, submit error, listen
|
|
64
|
+
* timeout, and resolver/decrypt rejection — returns a structured
|
|
45
65
|
* `{ ok: false, error, terminalIntent }`. A one-time entry whose fire threw
|
|
46
66
|
* would otherwise get no terminalIntent and re-fire on the next tick.
|
|
47
67
|
*
|
|
48
68
|
* `simulate` mode surfaces build errors (zero signers, gas-station with no
|
|
49
|
-
* signing key) as throws to the caller, but converts chain-side
|
|
50
|
-
* failures into structured results.
|
|
69
|
+
* signing key) as throws to the caller, but converts chain-side pre-submit-
|
|
70
|
+
* read failures into structured results.
|
|
51
71
|
*/
|
|
52
72
|
export declare function executeCodexTransaction(definition: CodexTxDefinition, mode: "simulate", ctx: ExecutorCtx): Promise<SimulateResult>;
|
|
53
73
|
export declare function executeCodexTransaction(definition: CodexTxDefinition, mode: "fire", ctx: ExecutorCtx): Promise<FireResult>;
|