@ancientpantheon/khronoton-core 0.7.0 → 0.9.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 CHANGED
@@ -4,6 +4,41 @@ 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.9.0 — 2026-09-07
8
+
9
+ **MINOR — scheduled transactions are priced against the chain's LIVE gas floor at fire time, not a static value stored at creation time.**
10
+
11
+ A cronoton's `gasPrice` was a plain ANU number persisted once at creation time and read back verbatim on every tick — never re-derived. Post-fork, chainweb validates a signed transaction's price against the **rising** Yin Engine floor as of that transaction's own `creationTime`, so a long-lived cronoton silently drifts below the floor and its fire is rejected. This is unattended automation: nobody is watching a 3am tick.
12
+
13
+ This was **live, not theoretical** — at the time of this release the floor stood at **11,569 ANU** while the builder's stored default was **10,000**, leaving every default-priced cronoton ~15.7% underpriced.
14
+
15
+ - **New OPTIONAL `ChainRuntime.gasMeta(floorAnu)` seam.** Returns `{ creationTime, gasPrice }` from **one** clock read. Optional so the package stays chain-POLYGLOT and `@stoachain/*` stays an optional peer dependency — a chain with no rising floor omits it. It is *not* optional in effect for a StoaChain fire: the executor **hard throws** when it is absent rather than falling back to the stored price, because a silent fallback ships the original bug to anyone who does not notice they must upgrade their runtime adapter.
16
+ - **The stored price is now a FLOOR, not a final price.** `max(stored, liveFloor(creationTime))` — an operator can still raise it above the minimum, and it can never hold a transaction below one. **Existing rows self-heal with no database migration.**
17
+ - **`creationTime` is now stamped explicitly.** `setMeta` previously omitted it, letting the Pact builder auto-stamp its own at `createTransaction()` — a second, independent clock read the price no longer corresponded to. Both fields now come from the same call, closing a tick-boundary race.
18
+ - **The AUTO-gas rebuild re-derives gas meta fresh.** The calibrated rebuild+re-sign calls the seam again rather than reusing the pre-flight build's values, so the two builds cannot straddle a tick boundary and underprice the transaction that actually gets submitted. Pinned by a regression spec that fails if the call is hoisted out of `buildTransaction`.
19
+ - **Precision.** Transaction meta now uses `anuToStoaNumber` (exact padded-decimal conversion) instead of `anuToStoa` (float division), which upstream documents as unsafe for a value chainweb hashes and validates exactly. Fixed at the meta site and at `ui/tx-size.ts`'s fee meter, whose whole job is predicting the real signed transaction's size.
20
+ - **`validateConfig` accepts an optional live floor.** `CommitGateOptions.minGasPriceAnu` replaces a hardcoded `>= 10000` gate that happily accepted an already-underpriced price; the message names the floor actually applied. Omitting it validates against the genesis floor as before — it under-rejects rather than over-rejects, and the executor raises the price at fire time regardless.
21
+ - **`blockchain/stoachain.ts` is the only place that knows the Yin Engine exists**, wrapping `@stoachain/stoa-core/gas` rather than reimplementing the arithmetic — a formula already independently reimplemented four times across the ecosystem.
22
+
23
+ **Dependencies — a coordinated family bump, not a standalone repin.** `@stoachain/stoa-core@4.4.0` peer-pins `@stoachain/kadena-stoic-legacy@4.4.0` exactly, and only `@ouronet/ouronet-core@4.6.0` accepts stoa-core 4.4.0; the three must move together or `npm install` fails to resolve. Peer + dev ranges: stoa-core `^4.3.6 → ^4.4.0`, kadena-stoic-legacy `^4.3.6 → ^4.4.0`, ouronet-core `^4.3.6 → ^4.6.0`.
24
+
25
+ New public surface — `StoaGasMeta`, the optional `ChainRuntime.gasMeta`, and `CommitGateOptions.minGasPriceAnu` — is entirely additive. A consumer injecting its own `ChainRuntime` for a StoaChain fire must add `gasMeta` (the bundled `createStoachainRuntime` supplies it); a consumer wrapping the adapter by spread picks it up with no change.
26
+
27
+ **907 specs pass, plus 5 real-runtime integration specs against the installed `@stoachain/*@4.4.0`.**
28
+
29
+ ## 0.8.0 — 2026-08-03
30
+
31
+ **MINOR — the last two evented-server-resolver UI fixes: DETAIL "Schedule" reads "Evented", and a system cronoton is deletable behind a confirm-gated warning.**
32
+
33
+ Finalizes the Pythia automatic-link work. 0.7.0 made the store server-authoritative for evented resolvers; two UI gaps remained (verified live against Pythia v2.7.22–2.7.25).
34
+
35
+ - **Fix 1 — the cronoton DETAIL card's "Schedule" now reads "Evented" for a trigger-only/evented row.** It previously rendered the stored `schedule_config` ("Daily at 12:00 UTC") for a row that never fires on a clock — while Next Fire already showed "—" and the edit form already disabled the scheduler. Root cause: `Detail.tsx` computed `triggerOnly` from runtime-arg keys only, ignoring `external_fireable`. The list's trigger-only predicate is now extracted to a shared `isTriggerOnly(row)` (`external_fireable === 1 || runtime-arg keys present`) used by **both** the list next-fire cell and the detail Schedule cell, so they can never drift again.
36
+ - **Fix 2 — a system (server-resolver) cronoton is deletable with a warning, not hard-blocked.** `DELETE /[id]` previously refused any `server_resolver` row with `409 { protected: true }`. It now accepts a confirm-gated `?force=1` that permits the delete (the 409 still stands without force). Threaded end-to-end: `ConfirmOpts.force` → both reference adapters send `?force=1` → the widened `remove.run({ force })` action. In the bundled Builder, the Delete button is now **enabled** for an admin on a system cronoton (still admin-only) and, on click, shows a warning naming the resolver — *"This is the automaton's `<name>` template. Deleting it stops that capability until it's recreated. Delete anyway?"* — before the existing password confirm. The audit trail is preserved and a forced system delete records `forced: true`.
37
+
38
+ Behavior for ordinary scheduled cronotons is unchanged; a non-system delete and a `delete(id)`/`remove.run()` without force are byte-identical to 0.7.0, and a system delete without force still 409s. New public surface: `ConfirmOpts.force`, the widened `DeleteAction` run arg (`DeleteRunOpts`), the `deleteSystemConfirm` export, and the shared `isTriggerOnly`/`row-derive` module — all additive.
39
+
40
+ **893 specs pass.**
41
+
7
42
  ## 0.7.0 — 2026-08-03
8
43
 
9
44
  **MINOR — server-authoritative evented resolvers: scheduleless + external-fireable enforced in the store, `GET /resolvers`, one-resolver-one-cronoton.**
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.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
+
11
+ **`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.**
12
+
9
13
  **`0.7.0` on public npmjs** — **MINOR.** Released 2026-08-03. Makes event-driven resolvers **server-authoritative**: `SingleTxResolver`/`MultiTxResolver` gain an `evented?` flag, and the **store** forces an evented resolver's cronoton scheduleless (`next_fire_at = NULL`, excluded from the due-query) **and `external_fireable = 1`** even when a schedule is sent — the guarantee no longer depends on the consumer. Adds `GET /resolvers` (+ an OPTIONAL `resolvers()` adapter method and `useServerResolvers` hook) so the Builder learns which resolvers are evented; the list shows **"Evented"** as the next-fire for a trigger-only row; and the store enforces **one resolver ↔ one cronoton** (a second bind is rejected). Deliberately reverses 0.6.0's HMAC stance — an evented row is now HMAC-fireable — codifying Pythia's shipped behavior (see version history). **871 specs pass.**
10
14
 
11
15
  **`0.6.1` on public npmjs** — **PATCH.** Released 2026-08-02. Fixes a crash that white-screened the Khronoton admin list whenever it held ≥1 cronoton: `listCodexCronotons` returned a camelCase 9-field projection while `CronotonList` renders full snake_case rows, so `pact_code` was `undefined` and crashed `pactPreview`. The list now returns full `CodexCronotonRow`s (`SELECT *`, like `getCodexCronoton`) and `pactPreview` guards a missing `pact_code`. **850 specs pass.**
@@ -240,6 +244,10 @@ npm install @ancientpantheon/khronoton-core
240
244
 
241
245
  ## Version history
242
246
 
247
+ **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
+
249
+ **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.**
250
+
243
251
  **v0.7.0** — Server-authoritative evented resolvers. `SingleTxResolver`/`MultiTxResolver` gain an optional `evented?` flag; the **store** (`createCodexCronoton`/`editCodexCronoton`, via an acyclic `getServerResolver` lookup) forces an evented resolver's cronoton `next_fire_at = NULL` **and `external_fireable = 1`** even when a real schedule is committed, so the scheduleless guarantee lives in the package rather than each consumer's proxy (`fetchDueCodexCronotons` skips it; an evented→non-evented edit re-arms `next_fire_at` and clears `external_fireable`; a genuine non-evented external-fireable row is never clobbered). A new `GET /resolvers` handler + `listServerResolvers()` expose `{ name, kind, evented }`; the `KhronotonAdapter` read tier gains an **OPTIONAL** `resolvers()` method (both reference adapters implement it, but it is **not** in `REQUIRED_METHODS`, so older adapters still pass `assertAdapter`), consumed by the new `useServerResolvers` hook. The Builder makes `eventDrivenResolver` server-authoritative (registry `evented` OR the 0.6.0 `serverResolverOptions.eventDriven` fallback), commits `externalFireable: true` for an evented resolver (derived at commit time — never stuck when switching away), and the `CronotonList` next-fire cell reads **"Evented"** for a trigger-only row (`external_fireable === 1` or runtime-arg keys). The store also enforces **one resolver ↔ one cronoton** — a second `createCodexCronoton` reusing a bound `server_resolver` throws `CodexCronotonValidationError` naming the existing id (→ 400). **Deliberate reversal of 0.6.0's HMAC stance:** an evented row is now `external_fireable = 1` and thus HMAC-fireable — a conscious choice codifying Pythia's already-shipped production behavior (v2.7.19/2.7.20), giving one persisted signal the store, Builder, and list all read; manually firing an evented resolver just re-runs its idempotent resolve (no-ops when nothing is ready). The published 0.6.0 `eventDriven` surface is kept intact as an additive fallback; ordinary scheduled resolvers are unchanged. Released 2026-08-03. **871 specs pass.**
244
252
 
245
253
  **v0.6.1** — Fix a CronotonList white-screen crash on any non-empty list. `listCodexCronotons` returned a camelCase 9-field projection while the read handler declares `CodexCronotonRow[]` and `CronotonList` renders full snake_case fields — so `pact_code`/`schedule_mode`/`schedule_config_json`/`next_fire_at`/`last_fire_at`/`runtime_arg_keys`/`description`/`server_resolver` were all `undefined` and `pactPreview(row.pact_code).replace(...)` crashed. The list now returns full `CodexCronotonRow`s via `SELECT *` (matching the declared type and what the UI reads), and `pactPreview` guards a missing/non-string `pact_code` → `"(empty)"`. `CodexCronotonListItem` is now a deprecated alias of `CodexCronotonRow`. Released 2026-08-02. **850 specs pass.**
@@ -1,4 +1,4 @@
1
- import { C as ChainRuntime } from '../seams-DapFZ4sM.js';
1
+ import { C as ChainRuntime } from '../seams-CPj31tJJ.js';
2
2
 
3
3
  /**
4
4
  * `@ancientpantheon/khronoton-core/blockchain/stoachain` — the StoaChain edge.
@@ -13,6 +13,13 @@ import { C as ChainRuntime } from '../seams-DapFZ4sM.js';
13
13
  * subpath costs nothing (the SDK imports are lazy, inside the factory), so a
14
14
  * consumer who never talks StoaChain never installs them. Only calling
15
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.
16
23
  */
17
24
  /**
18
25
  * Consumer-facing knobs for {@link createStoachainRuntime}. Every field is
@@ -17,6 +17,11 @@ async function createStoachainRuntime(config) {
17
17
  universalSignTransaction: signing.universalSignTransaction,
18
18
  calculateAutoGasLimit: gas.calculateAutoGasLimit,
19
19
  anuToStoa: gas.anuToStoa,
20
+ gasMeta: (floorAnu) => {
21
+ const { creationTime } = gas.stoaGasMeta();
22
+ const anu = Math.max(floorAnu, gas.minGasPriceAnu(creationTime));
23
+ return { creationTime, gasPrice: gas.anuToStoaNumber(anu) };
24
+ },
20
25
  getPactUrl,
21
26
  networkId,
22
27
  namespace,
@@ -226,11 +226,22 @@ function buildTransaction(runtime, definition, signers, gasLimitOverride) {
226
226
  const builder = runtime.Pact.builder.execution(
227
227
  definition.pactCode
228
228
  );
229
+ if (!runtime.gasMeta) {
230
+ throw new Error(
231
+ "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
+ );
233
+ }
234
+ const { creationTime, gasPrice } = runtime.gasMeta(definition.config.gasPrice);
229
235
  builder.setMeta({
230
236
  senderAccount,
231
237
  chainId: definition.config.chainId,
232
238
  gasLimit: gasLimitOverride ?? definition.config.gasLimit,
233
- gasPrice: runtime.anuToStoa(definition.config.gasPrice),
239
+ gasPrice,
240
+ // Stamped EXPLICITLY, from the same call that produced gasPrice. Left
241
+ // unset, the Pact builder auto-stamps its own creationTime at
242
+ // createTransaction() — a second, independent clock read that the price
243
+ // above would then no longer correspond to.
244
+ creationTime,
234
245
  ttl: definition.config.ttl
235
246
  }).setNetworkId(runtime.networkId);
236
247
  for (const [key, value] of Object.entries(definition.payload)) {
@@ -1,4 +1,4 @@
1
- import { useKhronotonAdapter, useKhronotonConfig, runGated } from './chunk-WLZXX2SQ.js';
1
+ import { useKhronotonAdapter, useKhronotonConfig, runGated } from './chunk-5LYT7ZLA.js';
2
2
  import { useState, useRef, useEffect, useCallback } from 'react';
3
3
 
4
4
  function useCronotons(query) {
@@ -318,10 +318,13 @@ function useCronotonActions(id, options = {}) {
318
318
  onSuccess
319
319
  );
320
320
  const remove = useGatedAction(
321
- useCallback(() => {
322
- const target = requireId(id, "delete");
323
- return (opts) => adapter.delete(target, opts);
324
- }, [adapter, id]),
321
+ useCallback(
322
+ (runOpts) => {
323
+ const target = requireId(id, "delete");
324
+ return (opts) => adapter.delete(target, { ...opts, force: runOpts?.force });
325
+ },
326
+ [adapter, id]
327
+ ),
325
328
  onNeedConfirm,
326
329
  onSuccess
327
330
  );
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
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-u_nUX1Bg.js';
3
- import { b as DbDep, D as Database } from './seams-DapFZ4sM.js';
3
+ import { b as DbDep, D as Database } from './seams-CPj31tJJ.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>;
@@ -220,6 +220,8 @@ interface CommitBody {
220
220
  */
221
221
  interface ConfirmOpts {
222
222
  confirmed?: boolean;
223
+ /** Permits deleting a server-resolver/system row (sent as ?force=1 to DELETE). Ignored by non-delete methods. */
224
+ force?: boolean;
223
225
  }
224
226
  /** Optional filters for the cronoton list (all default in the read handler). */
225
227
  interface ListCronotonsQuery {
@@ -66,6 +66,9 @@ export declare function resumeCodexCronoton(ctx: HandlerContext, req: HandlerReq
66
66
  * DELETE /[id] — remove a codex cronoton. Confirm-gated. A row bound to a server
67
67
  * resolver is a SYSTEM cronoton: it is delete-locked (pause to disable instead),
68
68
  * so the handler loads the row first and refuses with 409 before the store's
69
- * unconditional delete would run (REQ-H05).
69
+ * unconditional delete would run (REQ-H05) — UNLESS an explicit `?force=1`
70
+ * (`"1"`/`"true"`) query param accompanies the request, which the operator sets
71
+ * only after accepting the system-delete warning; a forced delete is recorded in
72
+ * the audit trail as `forced: true`.
70
73
  */
71
74
  export declare function deleteCodexCronoton(ctx: HandlerContext, req: HandlerRequest): Promise<HandlerResponse>;
@@ -141,7 +141,10 @@ export async function resumeCodexCronoton(ctx, req) {
141
141
  * DELETE /[id] — remove a codex cronoton. Confirm-gated. A row bound to a server
142
142
  * resolver is a SYSTEM cronoton: it is delete-locked (pause to disable instead),
143
143
  * so the handler loads the row first and refuses with 409 before the store's
144
- * unconditional delete would run (REQ-H05).
144
+ * unconditional delete would run (REQ-H05) — UNLESS an explicit `?force=1`
145
+ * (`"1"`/`"true"`) query param accompanies the request, which the operator sets
146
+ * only after accepting the system-delete warning; a forced delete is recorded in
147
+ * the audit trail as `forced: true`.
145
148
  */
146
149
  export async function deleteCodexCronoton(ctx, req) {
147
150
  return withConfirm(ctx, req, async () => {
@@ -149,7 +152,8 @@ export async function deleteCodexCronoton(ctx, req) {
149
152
  const row = storeGet(id, { db: ctx.db });
150
153
  if (!row)
151
154
  throw new CodexCronotonValidationError("not found");
152
- if (row.server_resolver) {
155
+ const force = req.query?.force === "1" || req.query?.force === "true";
156
+ if (row.server_resolver && !force) {
153
157
  return json(409, {
154
158
  error: "System cronoton — cannot be deleted. Pause it to disable instead.",
155
159
  protected: true,
@@ -161,7 +165,7 @@ export async function deleteCodexCronoton(ctx, req) {
161
165
  result: "ok",
162
166
  targetKind: "codex_cronoton",
163
167
  targetId: id,
164
- detail: { serverResolver: row.server_resolver ?? null },
168
+ detail: { serverResolver: row.server_resolver ?? null, forced: row.server_resolver ? force : false },
165
169
  });
166
170
  return json(200, { ok: true });
167
171
  });
@@ -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--Qofoc6Z.js';
2
- export { U as UseKhronotonResult, u as useKhronoton } from '../context--Qofoc6Z.js';
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-Cv3H82B5.js';
2
+ export { U as UseKhronotonResult, u as useKhronoton } from '../context-Cv3H82B5.js';
3
3
  import { C as CodexCronotonRow, a as CodexCronotonFireRow, M as ManualBatchView } from '../types-u_nUX1Bg.js';
4
4
  import 'react';
5
- import '../seams-DapFZ4sM.js';
5
+ import '../seams-CPj31tJJ.js';
6
6
 
7
7
  /** The `useCronotons()` return shape — the list, its load state, and a refetch. */
8
8
  interface UseCronotonsView {
@@ -86,7 +86,11 @@ interface GatedAction<Args extends unknown[], T> {
86
86
  type CreateAction = GatedAction<[CommitBody], CommitView>;
87
87
  type EditAction = GatedAction<[EditPatch], EditView>;
88
88
  type ToggleAction = GatedAction<[], ToggleView>;
89
- type DeleteAction = GatedAction<[], DeleteView>;
89
+ /** Run-time options for `remove.run(...)` — `force` deletes a server-resolver/system row. */
90
+ interface DeleteRunOpts {
91
+ force?: boolean;
92
+ }
93
+ type DeleteAction = GatedAction<[DeleteRunOpts?], DeleteView>;
90
94
  /** The bundle `useCronotonActions` returns. */
91
95
  interface CronotonActions {
92
96
  create: CreateAction;
@@ -1,2 +1,2 @@
1
- export { useCancelBatch, useCronoton, useCronotonActions, useCronotonFires, useCronotons, useExecuteNow, useManualBatch, useRecoverFire, useServerResolvers, useSimulate, useStartBatch, useTrigger } from '../chunk-OGKXCOCK.js';
2
- export { useKhronoton } from '../chunk-WLZXX2SQ.js';
1
+ export { useCancelBatch, useCronoton, useCronotonActions, useCronotonFires, useCronotons, useExecuteNow, useManualBatch, useRecoverFire, useServerResolvers, useSimulate, useStartBatch, useTrigger } from '../chunk-5OB5NQ4S.js';
2
+ export { useKhronoton } from '../chunk-5LYT7ZLA.js';
@@ -1,7 +1,7 @@
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--Qofoc6Z.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--Qofoc6Z.js';
4
- import { D as Database, C as ChainRuntime, K as KeyResolver, R as ResolveFireMode, O as OnAudit, a as Config } from '../seams-DapFZ4sM.js';
2
+ import { H as HandlerRequest, i as HandlerResponse, K as KhronotonProviderProps, j as KhronotonAdapter, k as SignerSource } from '../context-Cv3H82B5.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-Cv3H82B5.js';
4
+ import { D as Database, C as ChainRuntime, K as KeyResolver, R as ResolveFireMode, O as OnAudit, a as Config } from '../seams-CPj31tJJ.js';
5
5
  export { a as CodexCronotonFireRow, C as CodexCronotonRow, M as ManualBatchView } from '../types-u_nUX1Bg.js';
6
6
 
7
7
  /**
@@ -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-WLZXX2SQ.js';
2
- export { DEFAULT_EXPLORER_BASE, DEFAULT_PAGE_SIZE, DEFAULT_POLL_CADENCE_MS, NeedsConfirmError, assertAdapter, emptySnapshot, runGated, useKhronoton } from '../chunk-WLZXX2SQ.js';
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-5LYT7ZLA.js';
2
+ export { DEFAULT_EXPLORER_BASE, DEFAULT_PAGE_SIZE, DEFAULT_POLL_CADENCE_MS, NeedsConfirmError, assertAdapter, emptySnapshot, runGated, useKhronoton } from '../chunk-5LYT7ZLA.js';
3
3
  import { useRef, useState, useEffect } from 'react';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
@@ -137,7 +137,9 @@ function createFetchAdapter(baseUrl, opts = {}) {
137
137
  return request("PATCH", `/${id}/resume`, { confirmed: confirm?.confirmed });
138
138
  },
139
139
  delete(id, confirm) {
140
- return request("DELETE", `/${id}`, { confirmed: confirm?.confirmed });
140
+ return request("DELETE", `/${id}${confirm?.force ? "?force=1" : ""}`, {
141
+ confirmed: confirm?.confirmed
142
+ });
141
143
  },
142
144
  // Execution tier (confirm-gated; simulate/executeNow/trigger are 200-on-ok:false)
143
145
  simulate(envelope, confirm) {
@@ -340,7 +342,8 @@ async function deleteCodexCronoton2(ctx, req) {
340
342
  const id = paramId(req);
341
343
  const row = getCodexCronoton(id, { db: ctx.db });
342
344
  if (!row) throw new CodexCronotonValidationError("not found");
343
- if (row.server_resolver) {
345
+ const force = req.query?.force === "1" || req.query?.force === "true";
346
+ if (row.server_resolver && !force) {
344
347
  return json(409, {
345
348
  error: "System cronoton \u2014 cannot be deleted. Pause it to disable instead.",
346
349
  protected: true
@@ -352,7 +355,7 @@ async function deleteCodexCronoton2(ctx, req) {
352
355
  result: "ok",
353
356
  targetKind: "codex_cronoton",
354
357
  targetId: id,
355
- detail: { serverResolver: row.server_resolver ?? null }
358
+ detail: { serverResolver: row.server_resolver ?? null, forced: row.server_resolver ? force : false }
356
359
  });
357
360
  return json(200, { ok: true });
358
361
  });
@@ -568,6 +571,7 @@ function throwingRuntime() {
568
571
  universalSignTransaction: notWired,
569
572
  calculateAutoGasLimit: notWired,
570
573
  anuToStoa: notWired,
574
+ gasMeta: notWired,
571
575
  getPactUrl: notWired,
572
576
  networkId: "memory",
573
577
  namespace: "memory-ns",
@@ -639,7 +643,11 @@ function createMemoryAdapter(opts) {
639
643
  return call(resumeCodexCronoton2, { params: { id }, confirmed: confirm?.confirmed });
640
644
  },
641
645
  delete(id, confirm) {
642
- return call(deleteCodexCronoton2, { params: { id }, confirmed: confirm?.confirmed });
646
+ return call(deleteCodexCronoton2, {
647
+ params: { id },
648
+ query: confirm?.force ? { force: "1" } : void 0,
649
+ confirmed: confirm?.confirmed
650
+ });
643
651
  },
644
652
  // Execution tier (confirm-gated; simulate/executeNow/trigger are 200-on-ok:false)
645
653
  simulate(envelope, confirm) {
@@ -102,6 +102,24 @@ interface ChainClient {
102
102
  }>;
103
103
  listen(desc: unknown): Promise<ListenResult>;
104
104
  }
105
+ /**
106
+ * The transaction gas meta produced by {@link ChainRuntime.gasMeta} — a
107
+ * `creationTime` (unix seconds) and the `gasPrice` (in the chain's own
108
+ * transaction units, NOT ANU) derived from that exact `creationTime`.
109
+ *
110
+ * Both fields come from ONE call, and both must be spread into the same
111
+ * `setMeta`. They are a matched pair: a chain whose minimum gas price rises
112
+ * over time validates a signed transaction's price against the transaction's
113
+ * OWN `creationTime`, so a price derived from a different clock read than the
114
+ * `creationTime` that ships with it can silently fall under the floor when the
115
+ * two reads straddle a tick boundary.
116
+ */
117
+ interface StoaGasMeta {
118
+ /** Unix seconds stamped into the transaction. */
119
+ creationTime: number;
120
+ /** Price for that creationTime, in chain transaction units (e.g. STOA). */
121
+ gasPrice: number;
122
+ }
105
123
  /**
106
124
  * The chain runtime seam — every `@stoachain/*` runtime value the executor
107
125
  * reaches for, inverted into one injectable object. Ported from the Hub's
@@ -110,6 +128,22 @@ interface ChainClient {
110
128
  * `STOA_AUTONOMIC_OURONETGASSTATION -> gasStationAccount`,
111
129
  * `KADENA_NAMESPACE -> namespace`. Deliberately excludes `pollRequestKeys`
112
130
  * (the executor confirms via `listen`, never polls).
131
+ *
132
+ * `gasMeta` is OPTIONAL so this package stays chain-POLYGLOT and
133
+ * `@stoachain/*` stays an optional peer dependency — a runtime for a chain with
134
+ * no rising gas floor simply omits it. It is NOT optional in effect for a
135
+ * StoaChain fire: the executor HARD THROWS when it is absent rather than
136
+ * falling back to the per-cronoton stored price. That fallback is precisely the
137
+ * bug this capability exists to kill — a stored price is captured once at
138
+ * cronoton-creation time and never re-derived, so it drifts below the live
139
+ * floor as the cronoton ages, and nobody is watching a 3am tick fire to notice
140
+ * the rejection. Failing loudly on an un-upgraded runtime adapter is the point.
141
+ *
142
+ * `floorAnu` is the caller's stored price in ANU, treated as a floor an
143
+ * operator may raise ABOVE the live minimum, never a cap that can hold a
144
+ * transaction below it. Implementations return
145
+ * `max(floorAnu, liveFloor(creationTime))`, converted to chain units.
146
+ * See `blockchain/stoachain.ts` for the StoaChain implementation.
113
147
  */
114
148
  interface ChainRuntime {
115
149
  Pact: {
@@ -122,6 +156,7 @@ interface ChainRuntime {
122
156
  universalSignTransaction(tx: IUnsignedCommand, keypairs: UniversalKeypair[]): Promise<unknown>;
123
157
  calculateAutoGasLimit(gas: number): number;
124
158
  anuToStoa(anu: number): number;
159
+ gasMeta?(floorAnu: number): StoaGasMeta;
125
160
  getPactUrl(chainId: string): string;
126
161
  networkId: string;
127
162
  namespace: string;
@@ -26,7 +26,13 @@ export { LISTEN_TIMEOUT_MS } from "./seams.js";
26
26
  /**
27
27
  * Build a Pact transaction from the definition:
28
28
  * `Pact.builder.execution().setMeta().setNetworkId()` + an `addData` loop over
29
- * the payload + pure-vs-scoped `addSigner`. Throws if no signers.
29
+ * the payload + pure-vs-scoped `addSigner`. Throws if no signers, and throws if
30
+ * the injected runtime cannot supply gas meta (see {@link ChainRuntime.gasMeta}).
31
+ *
32
+ * The per-cronoton `config.gasPrice` is a FLOOR, not a final price: it is passed
33
+ * to the runtime's `gasMeta`, which raises it to the chain's live minimum when
34
+ * the stored value has gone stale. This is what lets a cronoton stored years ago
35
+ * at the genesis default still fire today with no database migration.
30
36
  */
31
37
  function buildTransaction(runtime, definition, signers, gasLimitOverride) {
32
38
  if (signers.length === 0) {
@@ -34,12 +40,30 @@ function buildTransaction(runtime, definition, signers, gasLimitOverride) {
34
40
  }
35
41
  const senderAccount = deriveSenderAccount(definition.gasPayer, runtime.gasStationAccount);
36
42
  const builder = runtime.Pact.builder.execution(definition.pactCode);
43
+ // Gas meta is derived HERE, once per build, and never hoisted out or cached
44
+ // by a caller: the AUTO-gas path calls this function a SECOND time to rebuild
45
+ // and re-sign at the calibrated limit, and that rebuild must re-derive both
46
+ // fields fresh. Reusing the pre-flight build's values would let creationTime
47
+ // and gasPrice drift apart across a tick boundary — underpricing the very
48
+ // transaction that gets submitted.
49
+ if (!runtime.gasMeta) {
50
+ throw new Error("ChainRuntime.gasMeta is required to price a transaction: without it the " +
51
+ "per-cronoton stored gasPrice would be used verbatim, which drifts below " +
52
+ "the chain's rising minimum as a cronoton ages and gets the fire rejected. " +
53
+ "Upgrade the injected runtime adapter (see blockchain/stoachain.ts).");
54
+ }
55
+ const { creationTime, gasPrice } = runtime.gasMeta(definition.config.gasPrice);
37
56
  builder
38
57
  .setMeta({
39
58
  senderAccount,
40
59
  chainId: definition.config.chainId,
41
60
  gasLimit: gasLimitOverride ?? definition.config.gasLimit,
42
- gasPrice: runtime.anuToStoa(definition.config.gasPrice),
61
+ gasPrice,
62
+ // Stamped EXPLICITLY, from the same call that produced gasPrice. Left
63
+ // unset, the Pact builder auto-stamps its own creationTime at
64
+ // createTransaction() — a second, independent clock read that the price
65
+ // above would then no longer correspond to.
66
+ creationTime,
43
67
  ttl: definition.config.ttl,
44
68
  })
45
69
  .setNetworkId(runtime.networkId);
@@ -102,6 +102,24 @@ export interface ChainClient {
102
102
  }>;
103
103
  listen(desc: unknown): Promise<ListenResult>;
104
104
  }
105
+ /**
106
+ * The transaction gas meta produced by {@link ChainRuntime.gasMeta} — a
107
+ * `creationTime` (unix seconds) and the `gasPrice` (in the chain's own
108
+ * transaction units, NOT ANU) derived from that exact `creationTime`.
109
+ *
110
+ * Both fields come from ONE call, and both must be spread into the same
111
+ * `setMeta`. They are a matched pair: a chain whose minimum gas price rises
112
+ * over time validates a signed transaction's price against the transaction's
113
+ * OWN `creationTime`, so a price derived from a different clock read than the
114
+ * `creationTime` that ships with it can silently fall under the floor when the
115
+ * two reads straddle a tick boundary.
116
+ */
117
+ export interface StoaGasMeta {
118
+ /** Unix seconds stamped into the transaction. */
119
+ creationTime: number;
120
+ /** Price for that creationTime, in chain transaction units (e.g. STOA). */
121
+ gasPrice: number;
122
+ }
105
123
  /**
106
124
  * The chain runtime seam — every `@stoachain/*` runtime value the executor
107
125
  * reaches for, inverted into one injectable object. Ported from the Hub's
@@ -110,6 +128,22 @@ export interface ChainClient {
110
128
  * `STOA_AUTONOMIC_OURONETGASSTATION -> gasStationAccount`,
111
129
  * `KADENA_NAMESPACE -> namespace`. Deliberately excludes `pollRequestKeys`
112
130
  * (the executor confirms via `listen`, never polls).
131
+ *
132
+ * `gasMeta` is OPTIONAL so this package stays chain-POLYGLOT and
133
+ * `@stoachain/*` stays an optional peer dependency — a runtime for a chain with
134
+ * no rising gas floor simply omits it. It is NOT optional in effect for a
135
+ * StoaChain fire: the executor HARD THROWS when it is absent rather than
136
+ * falling back to the per-cronoton stored price. That fallback is precisely the
137
+ * bug this capability exists to kill — a stored price is captured once at
138
+ * cronoton-creation time and never re-derived, so it drifts below the live
139
+ * floor as the cronoton ages, and nobody is watching a 3am tick fire to notice
140
+ * the rejection. Failing loudly on an un-upgraded runtime adapter is the point.
141
+ *
142
+ * `floorAnu` is the caller's stored price in ANU, treated as a floor an
143
+ * operator may raise ABOVE the live minimum, never a cap that can hold a
144
+ * transaction below it. Implementations return
145
+ * `max(floorAnu, liveFloor(creationTime))`, converted to chain units.
146
+ * See `blockchain/stoachain.ts` for the StoaChain implementation.
113
147
  */
114
148
  export interface ChainRuntime {
115
149
  Pact: {
@@ -122,6 +156,7 @@ export interface ChainRuntime {
122
156
  universalSignTransaction(tx: IUnsignedCommand, keypairs: UniversalKeypair[]): Promise<unknown>;
123
157
  calculateAutoGasLimit(gas: number): number;
124
158
  anuToStoa(anu: number): number;
159
+ gasMeta?(floorAnu: number): StoaGasMeta;
125
160
  getPactUrl(chainId: string): string;
126
161
  networkId: string;
127
162
  namespace: string;
package/dist/ui/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useCronotons, useCronoton, useCronotonActions, useExecuteNow, useSimulate, useServerResolvers, useManualBatch, useStartBatch, useCancelBatch, useTrigger, useCronotonFires, useRecoverFire } from '../chunk-OGKXCOCK.js';
2
- import { useKhronotonAdapter, useKhronotonConfig, parseRuntimeArgKeys, summariseSchedule, KhronotonStaticContext, useKhronoton, computeNextFire, InvalidScheduleConfigError } from '../chunk-WLZXX2SQ.js';
1
+ import { useCronotons, useCronoton, useCronotonActions, useExecuteNow, useSimulate, useServerResolvers, useManualBatch, useStartBatch, useCancelBatch, useTrigger, useCronotonFires, useRecoverFire } from '../chunk-5OB5NQ4S.js';
2
+ import { useKhronotonAdapter, useKhronotonConfig, parseRuntimeArgKeys, summariseSchedule, KhronotonStaticContext, useKhronoton, computeNextFire, InvalidScheduleConfigError } from '../chunk-5LYT7ZLA.js';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { lazy, forwardRef, createElement, useState, useEffect, useCallback, Suspense, useContext } from 'react';
5
5
 
@@ -312,7 +312,7 @@ function Badge({ children, style, ...rest }) {
312
312
 
313
313
  // src/ui/access.ts
314
314
  var ADMIN_ONLY_TITLE = "Ancient admins only";
315
- var SYSTEM_CRONOTON_DELETE_TITLE = "System cronoton \u2014 cannot be deleted. Pause it to disable instead.";
315
+ var SYSTEM_CRONOTON_DELETE_TITLE = "System cronoton \u2014 deleting removes the automaton's template; you'll be warned first.";
316
316
  var TERMINAL_PAUSE_RESUME_TITLE = "Terminal cronotons cannot be paused or resumed";
317
317
  var TERMINAL_EXECUTE_TITLE = "Terminal cronotons cannot be executed";
318
318
  var BATCH_ACTIVE_TITLE = "A batch is running \u2014 wait for it to finish or cancel it";
@@ -326,13 +326,13 @@ function canMutate(access) {
326
326
  var ENABLED = { disabled: false, title: void 0 };
327
327
  var WORKING = { disabled: true, title: void 0 };
328
328
  function deleteDisabled(access, row, opts = {}) {
329
- if (row.server_resolver) {
330
- return { disabled: true, title: SYSTEM_CRONOTON_DELETE_TITLE };
331
- }
332
329
  if (!canMutate(access)) {
333
330
  return { disabled: true, title: ADMIN_ONLY_TITLE };
334
331
  }
335
332
  if (opts.working) return WORKING;
333
+ if (row.server_resolver) {
334
+ return { disabled: false, title: SYSTEM_CRONOTON_DELETE_TITLE };
335
+ }
336
336
  return ENABLED;
337
337
  }
338
338
  function pauseResumeDisabled(access, row, opts) {
@@ -373,6 +373,9 @@ function newCronotonTier(access) {
373
373
  function deleteConfirm(name) {
374
374
  return `Delete codex cronoton "${name}"? Fire history is removed too.`;
375
375
  }
376
+ function deleteSystemConfirm(name, serverResolver) {
377
+ return `This is the automaton's "${serverResolver}" template. Deleting it stops that capability until it's recreated. Delete "${name}" anyway?`;
378
+ }
376
379
  function deletePasswordConfirm(name) {
377
380
  return `Confirm to delete codex cronoton "${name}".`;
378
381
  }
@@ -459,6 +462,11 @@ function RelativeTime({ iso, className }) {
459
462
  }, [iso, withinMinute]);
460
463
  return /* @__PURE__ */ jsx("time", { dateTime: iso, title: iso, className, style: { color: "var(--khr-text-dim)" }, children: formatRelative(iso, nowMs) });
461
464
  }
465
+
466
+ // src/ui/row-derive.ts
467
+ function isTriggerOnly(row) {
468
+ return row.external_fireable === 1 || parseRuntimeArgKeys(row.runtime_arg_keys).length > 0;
469
+ }
462
470
  var DEFAULT_LIST_ROBOTS = "noindex,nofollow";
463
471
  var DIM = { color: "var(--khr-text-dim)" };
464
472
  var MONO = {
@@ -473,17 +481,6 @@ function pactPreview(pactCode) {
473
481
  if (collapsed === "") return "(empty)";
474
482
  return collapsed.length > PACT_PREVIEW_MAX ? `${collapsed.slice(0, PACT_PREVIEW_MAX)}\u2026` : collapsed;
475
483
  }
476
- function isTriggerOnly(row) {
477
- if (row.external_fireable === 1) return true;
478
- const raw = row.runtime_arg_keys;
479
- if (!raw) return false;
480
- try {
481
- const keys = JSON.parse(raw);
482
- return Array.isArray(keys) && keys.length > 0;
483
- } catch {
484
- return false;
485
- }
486
- }
487
484
  function scheduleLine(row) {
488
485
  try {
489
486
  const config = JSON.parse(row.schedule_config_json);
@@ -514,9 +511,14 @@ function CronotonListRowView({
514
511
  const pr = pauseResumeDisabled(access, row, { working });
515
512
  const ex = executeDisabled(access, row, { working, batchActive: false });
516
513
  const handleDelete = () => {
514
+ const systemResolver = row.server_resolver;
515
+ const firstPrompt = systemResolver ? deleteSystemConfirm(row.name, systemResolver) : deleteConfirm(row.name);
517
516
  void withConfirm(
518
- deleteConfirm(row.name),
519
- () => withConfirm(deletePasswordConfirm(row.name), () => actions.remove.run())
517
+ firstPrompt,
518
+ () => withConfirm(
519
+ deletePasswordConfirm(row.name),
520
+ () => actions.remove.run(systemResolver ? { force: true } : void 0)
521
+ )
520
522
  );
521
523
  };
522
524
  const handleToggle = () => {
@@ -1234,7 +1236,7 @@ function Loaded({
1234
1236
  const name = row.name;
1235
1237
  const terminal = TERMINAL_STATUSES2.has(row.status);
1236
1238
  const runtimeArgKeys = parseRuntimeArgKeys(row.runtime_arg_keys);
1237
- const triggerOnly = runtimeArgKeys.length > 0;
1239
+ const triggerOnly = isTriggerOnly(row);
1238
1240
  const working = actions.pause.pending || actions.resume.pending || actions.remove.pending || execute.pending;
1239
1241
  const isPaused = row.status === "paused";
1240
1242
  const toggle = isPaused ? actions.resume : actions.pause;
@@ -1244,11 +1246,15 @@ function Loaded({
1244
1246
  const pr = pauseResumeDisabled(access, row, { working });
1245
1247
  const ex = executeDisabled(access, row, { working, batchActive });
1246
1248
  const handleDelete = () => {
1249
+ const systemResolver = row.server_resolver;
1250
+ const firstPrompt = systemResolver ? deleteSystemConfirm(name, systemResolver) : deleteConfirm(name);
1247
1251
  void withConfirm(
1248
- deleteConfirm(name),
1249
- () => withConfirm(deletePasswordConfirm(name), () => actions.remove.run(), {
1250
- onSuccess: onNavigateToList
1251
- }),
1252
+ firstPrompt,
1253
+ () => withConfirm(
1254
+ deletePasswordConfirm(name),
1255
+ () => actions.remove.run(systemResolver ? { force: true } : void 0),
1256
+ { onSuccess: onNavigateToList }
1257
+ ),
1252
1258
  { alert: () => {
1253
1259
  } }
1254
1260
  );
@@ -1304,7 +1310,7 @@ function Loaded({
1304
1310
  }
1305
1311
  ) : null,
1306
1312
  /* @__PURE__ */ jsx(Card, { style: { marginTop: "18px", padding: "16px" }, children: /* @__PURE__ */ jsxs("div", { style: GRID_STYLE, children: [
1307
- /* @__PURE__ */ jsx(MetaCell, { label: "Schedule", children: triggerOnly ? "Trigger-only \u2014 no schedule" : scheduleLine2(row) }),
1313
+ /* @__PURE__ */ jsx(MetaCell, { label: "Schedule", children: triggerOnly ? "Evented" : scheduleLine2(row) }),
1308
1314
  /* @__PURE__ */ jsx(MetaCell, { label: "Status", children: /* @__PURE__ */ jsx(CronotonStatusBadge, { status: row.status }) }),
1309
1315
  /* @__PURE__ */ jsx(MetaCell, { label: "Next fire", children: /* @__PURE__ */ jsx(InstantCell, { iso: row.next_fire_at }) }),
1310
1316
  /* @__PURE__ */ jsx(MetaCell, { label: "Last fire", children: /* @__PURE__ */ jsx(InstantCell, { iso: row.last_fire_at }) }),
@@ -1341,7 +1347,7 @@ function Loaded({
1341
1347
  var MSG = {
1342
1348
  name: "Name is required.",
1343
1349
  ttl: "TTL must be between 60 and 86400 seconds.",
1344
- gasPrice: "Gas price must be at least 10000 ANU (the protocol floor).",
1350
+ gasPrice: (floorAnu) => `Gas price must be at least ${floorAnu} ANU (the protocol floor).`,
1345
1351
  gasLimit: "Gas limit must be greater than zero.",
1346
1352
  autoGas: "AUTO gas requires a successful Simulate to calibrate, or switch to manual.",
1347
1353
  signers: "At least one signer is required.",
@@ -1356,7 +1362,10 @@ function makeEmptyBuilderState() {
1356
1362
  pactCode: "",
1357
1363
  config: {
1358
1364
  chainId: "0",
1359
- gasPriceAnu: 1e4,
1365
+ // The GENESIS floor, and deliberately a FLOOR rather than a final price:
1366
+ // the executor raises it to the chain's live minimum at fire time, so a
1367
+ // cronoton created at this default does not underprice as it ages.
1368
+ gasPriceAnu: GENESIS_MIN_GAS_ANU,
1360
1369
  gasLimit: 1500,
1361
1370
  autoGasLimit: false,
1362
1371
  ttl: 600
@@ -1481,6 +1490,7 @@ function builderToCommit(state, opts) {
1481
1490
  if (runtimeArgKeys.length > 0) body.envelope.runtimeArgKeys = runtimeArgKeys;
1482
1491
  return body;
1483
1492
  }
1493
+ var GENESIS_MIN_GAS_ANU = 1e4;
1484
1494
  function validateName(state) {
1485
1495
  return state.name.trim().length === 0 ? [MSG.name] : [];
1486
1496
  }
@@ -1488,7 +1498,8 @@ function validateConfig(state, opts = {}) {
1488
1498
  const errors = [];
1489
1499
  const c = state.config;
1490
1500
  if (c.ttl < 60 || c.ttl > 86400) errors.push(MSG.ttl);
1491
- if (c.gasPriceAnu < 1e4) errors.push(MSG.gasPrice);
1501
+ const minGasAnu = opts.minGasPriceAnu ?? GENESIS_MIN_GAS_ANU;
1502
+ if (c.gasPriceAnu < minGasAnu) errors.push(MSG.gasPrice(minGasAnu));
1492
1503
  if (c.gasLimit <= 0) errors.push(MSG.gasLimit);
1493
1504
  const autoGasWaived = Boolean(state.serverResolver) || isTriggerOnly2(state);
1494
1505
  if (c.autoGasLimit && !opts.simulateCalibrated && !autoGasWaived) errors.push(MSG.autoGas);
@@ -3471,13 +3482,17 @@ async function estimateTxSize(state) {
3471
3482
  let bytes;
3472
3483
  try {
3473
3484
  const { Pact } = await import('@stoachain/kadena-stoic-legacy/client');
3474
- const { anuToStoa } = await import('@stoachain/stoa-core/gas');
3485
+ const { anuToStoaNumber } = await import('@stoachain/stoa-core/gas');
3475
3486
  const { KADENA_NETWORK } = await import('@stoachain/stoa-core/constants');
3476
3487
  const builder = Pact.builder.execution(pactCode || "").setMeta({
3477
3488
  senderAccount: state.gasPayer.type === "codex" ? state.gasPayer.address ?? "" : "c:gas-station",
3478
3489
  chainId: config.chainId,
3479
3490
  gasLimit: config.gasLimit,
3480
- gasPrice: anuToStoa(config.gasPrice),
3491
+ // `anuToStoaNumber`, not `anuToStoa`: this meter exists to predict the
3492
+ // SIZE of the real signed transaction, so it must serialize gasPrice
3493
+ // exactly the way the executor does. Plain float division can render a
3494
+ // different number of characters than the value that actually ships.
3495
+ gasPrice: anuToStoaNumber(config.gasPrice),
3481
3496
  ttl: config.ttl
3482
3497
  }).setNetworkId(KADENA_NETWORK);
3483
3498
  for (const [k, v] of Object.entries(payload ?? {})) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancientpantheon/khronoton-core",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Headless framework-agnostic scheduler engine: pure schedule math plus an injectable tick engine. No database, no job queue, no framework — hosts inject storage and firing via hooks.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -78,9 +78,9 @@
78
78
  "@codemirror/state": "^6.5.2",
79
79
  "@codemirror/view": "^6.36.4",
80
80
  "@lezer/highlight": "^1.2.3",
81
- "@ouronet/ouronet-core": "^4.3.6",
82
- "@stoachain/kadena-stoic-legacy": "^4.3.6",
83
- "@stoachain/stoa-core": "^4.3.6",
81
+ "@ouronet/ouronet-core": "^4.6.0",
82
+ "@stoachain/kadena-stoic-legacy": "^4.4.0",
83
+ "@stoachain/stoa-core": "^4.4.0",
84
84
  "@uiw/react-codemirror": "^4.23.10",
85
85
  "react": "^18 || ^19",
86
86
  "react-dom": "^18 || ^19"
@@ -125,9 +125,9 @@
125
125
  "@codemirror/state": "^6.5.2",
126
126
  "@codemirror/view": "^6.36.4",
127
127
  "@lezer/highlight": "^1.2.3",
128
- "@ouronet/ouronet-core": "^4.3.6",
129
- "@stoachain/kadena-stoic-legacy": "^4.3.6",
130
- "@stoachain/stoa-core": "^4.3.6",
128
+ "@ouronet/ouronet-core": "^4.6.0",
129
+ "@stoachain/kadena-stoic-legacy": "^4.4.0",
130
+ "@stoachain/stoa-core": "^4.4.0",
131
131
  "@testing-library/dom": "^10.4.1",
132
132
  "@testing-library/react": "^16.3.2",
133
133
  "@types/better-sqlite3": "^7.6.13",