@ancientpantheon/khronoton-core 0.6.0 → 0.6.1
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 +12 -0
- package/README.md +4 -0
- package/dist/{chunk-FBQTTDOZ.js → chunk-5SUNXUSH.js} +3 -18
- package/dist/{chunk-ZVMHHW53.js → chunk-J7P2NCO4.js} +1 -1
- package/dist/hooks/index.js +2 -2
- package/dist/provider/index.js +2 -2
- package/dist/server/store/cronoton.d.ts +2 -2
- package/dist/server/store/cronoton.js +12 -18
- package/dist/server/types.d.ts +10 -12
- package/dist/ui/index.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ 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.6.1 — 2026-08-02
|
|
8
|
+
|
|
9
|
+
**PATCH — fix a CronotonList crash (white-screen) on any non-empty list.**
|
|
10
|
+
|
|
11
|
+
Opening the Khronoton admin list with ≥1 cronoton threw `TypeError: Cannot read properties of undefined (reading 'replace')` and white-screened the page — hitting every consumer the moment they had a cronoton.
|
|
12
|
+
|
|
13
|
+
- **Root cause:** `listCodexCronotons` returned a hand-picked **camelCase 9-field projection**, but the read handler declares the response as `CodexCronotonRow[]` and `CronotonList` renders full **snake_case** row fields. Only `id`/`name`/`status` (identical in both casings) actually worked; `schedule_mode`, `schedule_config_json`, `next_fire_at`, `last_fire_at`, `runtime_arg_keys`, `description`, and `server_resolver` were all silently `undefined`, and `pact_code` additionally **crashed** the unguarded `pactPreview(row.pact_code).replace(...)`. Latent since 0.3.0; surfaced once consumers had cronotons and opened the list.
|
|
14
|
+
- **Fix:** `listCodexCronotons` now returns full snake_case rows via `SELECT *` (mirroring `getCodexCronoton`), matching the handler's declared type and exactly what the UI reads — so the whole list renders correctly (pact preview, schedule line, last-fire badge, trigger-only detection, description, server-resolver pill), not just the crash. Plus a defensive guard so `pactPreview` treats a missing/non-string `pact_code` as `"(empty)"` and can never white-screen the page.
|
|
15
|
+
- `CodexCronotonListItem` is now a deprecated alias of `CodexCronotonRow` (kept so any importer still resolves). Consumers reading the list response as `CodexCronotonRow[]` (the declared type) need no change.
|
|
16
|
+
|
|
17
|
+
**850 specs pass.**
|
|
18
|
+
|
|
7
19
|
## 0.6.0 — 2026-08-02
|
|
8
20
|
|
|
9
21
|
**MINOR — event-driven server resolvers (scheduler-off, host-fired).**
|
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.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.**
|
|
10
|
+
|
|
9
11
|
**`0.6.0` on public npmjs** — **MINOR.** Released 2026-08-02. Server resolvers can now declare themselves **event-driven** (`ServerResolverOption.eventDriven`): selecting one in the Builder commits the cronoton scheduler-off (`next_fire_at = NULL`, never auto-fired) and swaps the schedule editor for an event-driven notice — the host fires it in-process via the existing `executeNow` (not the HMAC endpoint). Ordinary scheduled resolvers are unchanged. **848 specs pass.**
|
|
10
12
|
|
|
11
13
|
**`0.5.0` on public npmjs** — **MINOR.** Released 2026-08-02. The Builder screen's Pact-code editor is now syntax-highlighted (via the package's `--khr-*` theme tokens, five new ones added), moved to a full-width top strip (~7 lines, internal scroll) with the header/tabs/tab content full-width below it, and gained a live tx-size/gas metering strip. `@uiw/react-codemirror` + the CodeMirror/Lezer packages it now depends on for highlighting are real optional `peerDependencies`. **832 specs pass.**
|
|
@@ -236,6 +238,8 @@ npm install @ancientpantheon/khronoton-core
|
|
|
236
238
|
|
|
237
239
|
## Version history
|
|
238
240
|
|
|
241
|
+
**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.**
|
|
242
|
+
|
|
239
243
|
**v0.6.0** — Event-driven server resolvers. `ServerResolverOption` gains an optional `eventDriven` flag; a cronoton on an event-driven resolver commits scheduler-off (`next_fire_at = NULL`, excluded from the tick due-query) and the Builder shows an "Event-driven (host-fired)" notice instead of a schedule editor. The host fires it via the existing `executeNow` primitive, in-process — event-driven is a dedicated commit-envelope flag, deliberately NOT `externalFireable`, so it never exposes the public HMAC trigger endpoint. `server_resolver` + event-driven is allowed; `server_resolver` + `runtime_arg_keys` stays forbidden. No new DB column (the `next_fire_at = NULL` state carries it; edit and pause/resume keep it NULL). Ordinary scheduled resolvers unchanged; a non-event-driven commit body is byte-identical to 0.5.0. Released 2026-08-02. **848 specs pass.**
|
|
240
244
|
|
|
241
245
|
**v0.5.0** — Builder screen upgrade: the Pact-code editor is syntax-highlighted (keywords, definitions, types, strings, numbers, booleans, comments, `@doc`/`@model` annotations, parens/atoms — colored via new `--khr-syntax-*`/`--khr-selection` tokens, not hardcoded), moved to a full-width top strip (~7 lines, internal scroll) with the header/tab bar/tab content full-width below it as the one standard layout, and gained a live tx-size/gas metering strip (local byte estimate against StoaChain's 2 MB ceiling; gas-used-vs-limit once Simulate runs). `@uiw/react-codemirror`, `@codemirror/state`, `@codemirror/view`, `@codemirror/language`, `@lezer/highlight` are now real optional `peerDependencies` instead of silently relied upon via hoisting. Released 2026-08-02. **832 specs pass.**
|
|
@@ -1107,28 +1107,13 @@ function listCodexCronotons(params, dep) {
|
|
|
1107
1107
|
const limit = Math.min(Math.max(params.limit ?? 50, 1), 200);
|
|
1108
1108
|
const offset = Math.max(params.offset ?? 0, 0);
|
|
1109
1109
|
const db = dep.db;
|
|
1110
|
-
|
|
1111
|
-
`SELECT
|
|
1112
|
-
created_at, modified_at, created_by
|
|
1113
|
-
FROM codex_cronotons WHERE status = ?
|
|
1110
|
+
return params.status ? db.prepare(
|
|
1111
|
+
`SELECT * FROM codex_cronotons WHERE status = ?
|
|
1114
1112
|
ORDER BY created_at DESC LIMIT ? OFFSET ?`
|
|
1115
1113
|
).all(params.status, limit, offset) : db.prepare(
|
|
1116
|
-
`SELECT
|
|
1117
|
-
created_at, modified_at, created_by
|
|
1118
|
-
FROM codex_cronotons
|
|
1114
|
+
`SELECT * FROM codex_cronotons
|
|
1119
1115
|
ORDER BY created_at DESC LIMIT ? OFFSET ?`
|
|
1120
1116
|
).all(limit, offset);
|
|
1121
|
-
return rows.map((r) => ({
|
|
1122
|
-
id: r.id,
|
|
1123
|
-
name: r.name,
|
|
1124
|
-
scheduleMode: r.schedule_mode,
|
|
1125
|
-
status: r.status,
|
|
1126
|
-
nextFireAt: r.next_fire_at,
|
|
1127
|
-
lastFireAt: r.last_fire_at,
|
|
1128
|
-
createdAt: r.created_at,
|
|
1129
|
-
modifiedAt: r.modified_at,
|
|
1130
|
-
createdBy: r.created_by
|
|
1131
|
-
}));
|
|
1132
1117
|
}
|
|
1133
1118
|
function editCodexCronoton(id, patch, opts) {
|
|
1134
1119
|
const db = opts.db;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useKhronotonAdapter, useKhronotonConfig, runGated } from './chunk-
|
|
1
|
+
import { useKhronotonAdapter, useKhronotonConfig, runGated } from './chunk-5SUNXUSH.js';
|
|
2
2
|
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
3
|
|
|
4
4
|
function useCronotons(query) {
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { useCancelBatch, useCronoton, useCronotonActions, useCronotonFires, useCronotons, useExecuteNow, useManualBatch, useRecoverFire, useSimulate, useStartBatch, useTrigger } from '../chunk-
|
|
2
|
-
export { useKhronoton } from '../chunk-
|
|
1
|
+
export { useCancelBatch, useCronoton, useCronotonActions, useCronotonFires, useCronotons, useExecuteNow, useManualBatch, useRecoverFire, useSimulate, useStartBatch, useTrigger } from '../chunk-J7P2NCO4.js';
|
|
2
|
+
export { useKhronoton } from '../chunk-5SUNXUSH.js';
|
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, 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, defaultSignerSource, fireByServerResolver, computeDefinitionFingerprint, recordFire, applyTerminalIntent } from '../chunk-5SUNXUSH.js';
|
|
2
|
+
export { DEFAULT_EXPLORER_BASE, DEFAULT_PAGE_SIZE, DEFAULT_POLL_CADENCE_MS, NeedsConfirmError, assertAdapter, emptySnapshot, runGated, useKhronoton } from '../chunk-5SUNXUSH.js';
|
|
3
3
|
import { useRef, useState, useEffect } from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ScheduleConfig, type ScheduleMode } from "../../schedule.js";
|
|
2
2
|
import type { DbDep } from "../seams.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { CodexCronotonRow, CodexTxConfig, CodexTxDefinition } from "../types.js";
|
|
4
4
|
export interface CommitCodexCronotonInput {
|
|
5
5
|
name: string;
|
|
6
6
|
description: string | null;
|
|
@@ -43,7 +43,7 @@ export declare function listCodexCronotons(params: {
|
|
|
43
43
|
limit?: number;
|
|
44
44
|
offset?: number;
|
|
45
45
|
status?: CodexCronotonRow["status"];
|
|
46
|
-
}, dep: DbDep):
|
|
46
|
+
}, dep: DbDep): CodexCronotonRow[];
|
|
47
47
|
export interface EditCodexCronotonPatch {
|
|
48
48
|
name?: string;
|
|
49
49
|
description?: string | null;
|
|
@@ -113,30 +113,24 @@ export function listCodexCronotons(params, dep) {
|
|
|
113
113
|
const limit = Math.min(Math.max(params.limit ?? 50, 1), 200);
|
|
114
114
|
const offset = Math.max(params.offset ?? 0, 0);
|
|
115
115
|
const db = dep.db;
|
|
116
|
-
|
|
116
|
+
// Return FULL snake_case rows (`SELECT *`, mirroring `getCodexCronoton`), NOT a
|
|
117
|
+
// hand-picked projection. The read handler types this as `CodexCronotonRow[]`
|
|
118
|
+
// and `CronotonList.tsx` renders full-row fields — `pact_code` (the preview),
|
|
119
|
+
// `schedule_config_json`/`schedule_mode` (the schedule line), `runtime_arg_keys`
|
|
120
|
+
// (trigger-only), `description`, `server_resolver`, `last_fire_at`. The old
|
|
121
|
+
// 9-field camelCase projection returned NONE of those under the names the UI
|
|
122
|
+
// reads, so the list silently rendered blank columns and crashed on the one
|
|
123
|
+
// unguarded string access (`pactPreview(row.pact_code)`). The ≤200-row admin
|
|
124
|
+
// list over-fetching four JSON columns is negligible and buys type-honesty.
|
|
125
|
+
return (params.status
|
|
117
126
|
? db
|
|
118
|
-
.prepare(`SELECT
|
|
119
|
-
created_at, modified_at, created_by
|
|
120
|
-
FROM codex_cronotons WHERE status = ?
|
|
127
|
+
.prepare(`SELECT * FROM codex_cronotons WHERE status = ?
|
|
121
128
|
ORDER BY created_at DESC LIMIT ? OFFSET ?`)
|
|
122
129
|
.all(params.status, limit, offset)
|
|
123
130
|
: db
|
|
124
|
-
.prepare(`SELECT
|
|
125
|
-
created_at, modified_at, created_by
|
|
126
|
-
FROM codex_cronotons
|
|
131
|
+
.prepare(`SELECT * FROM codex_cronotons
|
|
127
132
|
ORDER BY created_at DESC LIMIT ? OFFSET ?`)
|
|
128
133
|
.all(limit, offset));
|
|
129
|
-
return rows.map((r) => ({
|
|
130
|
-
id: r.id,
|
|
131
|
-
name: r.name,
|
|
132
|
-
scheduleMode: r.schedule_mode,
|
|
133
|
-
status: r.status,
|
|
134
|
-
nextFireAt: r.next_fire_at,
|
|
135
|
-
lastFireAt: r.last_fire_at,
|
|
136
|
-
createdAt: r.created_at,
|
|
137
|
-
modifiedAt: r.modified_at,
|
|
138
|
-
createdBy: r.created_by,
|
|
139
|
-
}));
|
|
140
134
|
}
|
|
141
135
|
/**
|
|
142
136
|
* Apply-at-next-fire edit. Recomputes next_fire_at when the schedule changes,
|
package/dist/server/types.d.ts
CHANGED
|
@@ -144,18 +144,16 @@ export interface CodexCronotonRow {
|
|
|
144
144
|
modified_at: string;
|
|
145
145
|
created_by: string;
|
|
146
146
|
}
|
|
147
|
-
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
createdBy: string;
|
|
158
|
-
}
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated `listCodexCronotons` now returns full {@link CodexCronotonRow}s
|
|
149
|
+
* (snake_case, `SELECT *`) so the list projection matches the read-handler's
|
|
150
|
+
* declared `CodexCronotonRow[]` response and the fields `CronotonList` actually
|
|
151
|
+
* renders (`pact_code`, `schedule_config_json`, `description`, `server_resolver`,
|
|
152
|
+
* …). This 9-field camelCase projection was the source of the CronotonList crash
|
|
153
|
+
* (0.6.0 and earlier); kept as an alias only so any external importer still
|
|
154
|
+
* resolves. Prefer {@link CodexCronotonRow}.
|
|
155
|
+
*/
|
|
156
|
+
export type CodexCronotonListItem = CodexCronotonRow;
|
|
159
157
|
/**
|
|
160
158
|
* Launch-state provenance of a fire — 'test' pre-lock, 'live' once the
|
|
161
159
|
* consumer's live state is locked.
|
package/dist/ui/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useCronotons, useCronoton, useCronotonActions, useExecuteNow, useSimulate, useManualBatch, useStartBatch, useCancelBatch, useTrigger, useCronotonFires, useRecoverFire } from '../chunk-
|
|
2
|
-
import { useKhronotonAdapter, useKhronotonConfig, parseRuntimeArgKeys, summariseSchedule, KhronotonStaticContext, useKhronoton, computeNextFire, InvalidScheduleConfigError } from '../chunk-
|
|
1
|
+
import { useCronotons, useCronoton, useCronotonActions, useExecuteNow, useSimulate, useManualBatch, useStartBatch, useCancelBatch, useTrigger, useCronotonFires, useRecoverFire } from '../chunk-J7P2NCO4.js';
|
|
2
|
+
import { useKhronotonAdapter, useKhronotonConfig, parseRuntimeArgKeys, summariseSchedule, KhronotonStaticContext, useKhronoton, computeNextFire, InvalidScheduleConfigError } from '../chunk-5SUNXUSH.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
|
|
|
@@ -469,7 +469,7 @@ var MONO = {
|
|
|
469
469
|
var EM_DASH = /* @__PURE__ */ jsx("span", { style: DIM, children: "\u2014" });
|
|
470
470
|
var PACT_PREVIEW_MAX = 60;
|
|
471
471
|
function pactPreview(pactCode) {
|
|
472
|
-
const collapsed = pactCode.replace(/\s+/g, " ").trim();
|
|
472
|
+
const collapsed = typeof pactCode === "string" ? pactCode.replace(/\s+/g, " ").trim() : "";
|
|
473
473
|
if (collapsed === "") return "(empty)";
|
|
474
474
|
return collapsed.length > PACT_PREVIEW_MAX ? `${collapsed.slice(0, PACT_PREVIEW_MAX)}\u2026` : collapsed;
|
|
475
475
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ancientpantheon/khronoton-core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
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",
|