@ancientpantheon/khronoton-core 0.7.0 → 0.8.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 +13 -0
- package/README.md +4 -0
- package/dist/{chunk-OGKXCOCK.js → chunk-NNR4MYI3.js} +7 -4
- package/dist/{context--Qofoc6Z.d.ts → context-C1K08cmR.d.ts} +2 -0
- package/dist/handlers/cronoton.d.ts +4 -1
- package/dist/handlers/cronoton.js +7 -3
- package/dist/hooks/index.d.ts +7 -3
- package/dist/hooks/index.js +1 -1
- package/dist/provider/index.d.ts +2 -2
- package/dist/provider/index.js +11 -4
- package/dist/ui/index.js +30 -24
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ 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.8.0 — 2026-08-03
|
|
8
|
+
|
|
9
|
+
**MINOR — the last two evented-server-resolver UI fixes: DETAIL "Schedule" reads "Evented", and a system cronoton is deletable behind a confirm-gated warning.**
|
|
10
|
+
|
|
11
|
+
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).
|
|
12
|
+
|
|
13
|
+
- **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.
|
|
14
|
+
- **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`.
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
**893 specs pass.**
|
|
19
|
+
|
|
7
20
|
## 0.7.0 — 2026-08-03
|
|
8
21
|
|
|
9
22
|
**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,8 @@ Khronoton is the "When do I act?" Constructor of the Pantheon architecture — t
|
|
|
6
6
|
|
|
7
7
|
## Status
|
|
8
8
|
|
|
9
|
+
**`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.**
|
|
10
|
+
|
|
9
11
|
**`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
12
|
|
|
11
13
|
**`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 +242,8 @@ npm install @ancientpantheon/khronoton-core
|
|
|
240
242
|
|
|
241
243
|
## Version history
|
|
242
244
|
|
|
245
|
+
**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.**
|
|
246
|
+
|
|
243
247
|
**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
248
|
|
|
245
249
|
**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.**
|
|
@@ -318,10 +318,13 @@ function useCronotonActions(id, options = {}) {
|
|
|
318
318
|
onSuccess
|
|
319
319
|
);
|
|
320
320
|
const remove = useGatedAction(
|
|
321
|
-
useCallback(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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
|
);
|
|
@@ -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
|
-
|
|
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
|
});
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
|
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-C1K08cmR.js';
|
|
2
|
+
export { U as UseKhronotonResult, u as useKhronoton } from '../context-C1K08cmR.js';
|
|
3
3
|
import { C as CodexCronotonRow, a as CodexCronotonFireRow, M as ManualBatchView } from '../types-u_nUX1Bg.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '../seams-DapFZ4sM.js';
|
|
@@ -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
|
-
|
|
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;
|
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-
|
|
1
|
+
export { useCancelBatch, useCronoton, useCronotonActions, useCronotonFires, useCronotons, useExecuteNow, useManualBatch, useRecoverFire, useServerResolvers, useSimulate, useStartBatch, useTrigger } from '../chunk-NNR4MYI3.js';
|
|
2
2
|
export { useKhronoton } from '../chunk-WLZXX2SQ.js';
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
2
|
+
import { H as HandlerRequest, i as HandlerResponse, K as KhronotonProviderProps, j as KhronotonAdapter, k as SignerSource } from '../context-C1K08cmR.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-C1K08cmR.js';
|
|
4
4
|
import { D as Database, C as ChainRuntime, K as KeyResolver, R as ResolveFireMode, O as OnAudit, a as Config } from '../seams-DapFZ4sM.js';
|
|
5
5
|
export { a as CodexCronotonFireRow, C as CodexCronotonRow, M as ManualBatchView } from '../types-u_nUX1Bg.js';
|
|
6
6
|
|
package/dist/provider/index.js
CHANGED
|
@@ -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}
|
|
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
|
-
|
|
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
|
});
|
|
@@ -639,7 +642,11 @@ function createMemoryAdapter(opts) {
|
|
|
639
642
|
return call(resumeCodexCronoton2, { params: { id }, confirmed: confirm?.confirmed });
|
|
640
643
|
},
|
|
641
644
|
delete(id, confirm) {
|
|
642
|
-
return call(deleteCodexCronoton2, {
|
|
645
|
+
return call(deleteCodexCronoton2, {
|
|
646
|
+
params: { id },
|
|
647
|
+
query: confirm?.force ? { force: "1" } : void 0,
|
|
648
|
+
confirmed: confirm?.confirmed
|
|
649
|
+
});
|
|
643
650
|
},
|
|
644
651
|
// Execution tier (confirm-gated; simulate/executeNow/trigger are 200-on-ok:false)
|
|
645
652
|
simulate(envelope, confirm) {
|
package/dist/ui/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCronotons, useCronoton, useCronotonActions, useExecuteNow, useSimulate, useServerResolvers, useManualBatch, useStartBatch, useCancelBatch, useTrigger, useCronotonFires, useRecoverFire } from '../chunk-
|
|
1
|
+
import { useCronotons, useCronoton, useCronotonActions, useExecuteNow, useSimulate, useServerResolvers, useManualBatch, useStartBatch, useCancelBatch, useTrigger, useCronotonFires, useRecoverFire } from '../chunk-NNR4MYI3.js';
|
|
2
2
|
import { useKhronotonAdapter, useKhronotonConfig, parseRuntimeArgKeys, summariseSchedule, KhronotonStaticContext, useKhronoton, computeNextFire, InvalidScheduleConfigError } from '../chunk-WLZXX2SQ.js';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { lazy, forwardRef, createElement, useState, useEffect, useCallback, Suspense, useContext } from 'react';
|
|
@@ -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
|
|
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
|
-
|
|
519
|
-
() => withConfirm(
|
|
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 =
|
|
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
|
-
|
|
1249
|
-
() => withConfirm(
|
|
1250
|
-
|
|
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 ? "
|
|
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 }) }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ancientpantheon/khronoton-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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",
|