@intentius/behold 0.29.36 → 0.29.38
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/AGENTS.md +7 -3
- package/dist/cli.js +60 -60
- package/package.json +2 -2
- package/web/app.js +13 -12
- package/web/run-playhead.js +3 -5
- package/web/run-playhead.test.js +9 -2
package/AGENTS.md
CHANGED
|
@@ -472,7 +472,8 @@ preview-locked, and one load runs at a time (409 otherwise).
|
|
|
472
472
|
`?ops=1` is the ops lens: the project's declared Ops as a phase track, read
|
|
473
473
|
from each emitted `dist/ops/<name>/op.json`, with the current run painted
|
|
474
474
|
over it (`meta.run`, `meta.gate`); `/api/ops/<name>/status` reads that Op's
|
|
475
|
-
|
|
475
|
+
newest run status and pending gate (`chant run status <name>`; chant
|
|
476
|
+
removed `--temporal`, #459). A
|
|
476
477
|
`ConvergeOp` also gets one card per rule from its `convergeTick` step's
|
|
477
478
|
`args.rules` (`attrs._step: "rule"`), carrying `when` (chant's JSON predicate,
|
|
478
479
|
rendered as the condition it states), `then`, and the `why` chant requires of
|
|
@@ -901,8 +902,11 @@ field and every one of these paths is a no-op.
|
|
|
901
902
|
|
|
902
903
|
Two gate cards exist and they are **different acts**:
|
|
903
904
|
|
|
904
|
-
- The **run gate** — `POST /api/ops/:name/signal/:gate` → `chant run
|
|
905
|
-
|
|
905
|
+
- The **run gate** — `POST /api/ops/:name/signal/:gate` → `chant run approve
|
|
906
|
+
<op> <gate>` (chant#2121 renamed `chant run signal`, #459). Records the
|
|
907
|
+
resolution; a runtime that parks a run is woken, and the local one reads it
|
|
908
|
+
when the Op runs again (behold runs `chant run <op> --progress-json`, which
|
|
909
|
+
exits 3 at a gate and shows as `gated`).
|
|
906
910
|
- The **converge gate** — `POST /api/operator/approve/:op/:gate` →
|
|
907
911
|
`chant approve <op> <gate>`. **Records a fact and unblocks nothing.** chant's
|
|
908
912
|
gate ledger says it outright: the local executor still refuses a gated op,
|
package/dist/cli.js
CHANGED
|
@@ -20980,6 +20980,9 @@ async function runCarveBridge(demo, select) {
|
|
|
20980
20980
|
};
|
|
20981
20981
|
}
|
|
20982
20982
|
|
|
20983
|
+
// src/server.ts
|
|
20984
|
+
init_ansi();
|
|
20985
|
+
|
|
20983
20986
|
// src/ops.ts
|
|
20984
20987
|
import { readdirSync as readdirSync14, readFileSync as readFileSync23, existsSync as existsSync21 } from "node:fs";
|
|
20985
20988
|
import { join as join31 } from "node:path";
|
|
@@ -21105,64 +21108,57 @@ function statusFields(stdout) {
|
|
|
21105
21108
|
return out;
|
|
21106
21109
|
}
|
|
21107
21110
|
function parseGateLine(line) {
|
|
21108
|
-
const m = /^(.*?)(?: — (.*?))? \(waiting since (.+)\)$/.exec(line.trim());
|
|
21111
|
+
const m = /^(.*?)(?: — (.*?))? \((?:pending|waiting) since (.+)\)$/.exec(line.trim());
|
|
21109
21112
|
if (!m) return null;
|
|
21110
21113
|
const signalName = m[1].trim();
|
|
21111
21114
|
if (!signalName) return null;
|
|
21112
21115
|
return { signalName, ...m[2] ? { description: m[2].trim() } : {}, since: m[3].trim() };
|
|
21113
21116
|
}
|
|
21114
21117
|
function readRunStatus(op, run3) {
|
|
21118
|
+
const err = strip2(run3.stderr).trim();
|
|
21119
|
+
const firstLine3 = (m) => m.split("\n")[0].replace(/^error:\s*/, "");
|
|
21115
21120
|
if (run3.code !== 0) {
|
|
21116
|
-
const message2 =
|
|
21117
|
-
if (/not available in local mode|@temporalio\/client is not installed/.test(message2)) {
|
|
21118
|
-
return {
|
|
21119
|
-
ok: false,
|
|
21120
|
-
refusal: {
|
|
21121
|
-
error: `No Temporal run state for "${op}" \u2014 ${message2.split("\n")[0].replace(/^error:\s*/, "")}`,
|
|
21122
|
-
code: "no-temporal",
|
|
21123
|
-
remedy: "Gate state and per-step run records come from a durable run. Configure a Temporal profile in chant.config.ts (and `npm install @temporalio/client`), then run the Op with --temporal."
|
|
21124
|
-
}
|
|
21125
|
-
};
|
|
21126
|
-
}
|
|
21127
|
-
if (/not found|NotFound/.test(message2)) {
|
|
21128
|
-
return {
|
|
21129
|
-
ok: false,
|
|
21130
|
-
refusal: {
|
|
21131
|
-
error: `No run of "${op}" to report \u2014 ${message2.split("\n")[0].replace(/^error:\s*/, "")}`,
|
|
21132
|
-
code: "no-run",
|
|
21133
|
-
remedy: "Start the Op (Run) and the playhead fills in as each step settles."
|
|
21134
|
-
}
|
|
21135
|
-
};
|
|
21136
|
-
}
|
|
21121
|
+
const message2 = err || strip2(run3.stdout).trim() || `chant run status exited ${run3.code}`;
|
|
21137
21122
|
return {
|
|
21138
21123
|
ok: false,
|
|
21139
21124
|
refusal: {
|
|
21140
|
-
error: `chant run status ${op} failed: ${message2
|
|
21125
|
+
error: `chant run status ${op} failed: ${firstLine3(message2)}`,
|
|
21141
21126
|
code: "run-status",
|
|
21142
|
-
remedy: "Run `chant run status " + op + "
|
|
21127
|
+
remedy: "Run `chant run status " + op + "` in the project to see the whole error."
|
|
21143
21128
|
}
|
|
21144
21129
|
};
|
|
21145
21130
|
}
|
|
21146
21131
|
const f = statusFields(run3.stdout);
|
|
21147
|
-
|
|
21132
|
+
if (!f.has("State")) {
|
|
21133
|
+
return {
|
|
21134
|
+
ok: false,
|
|
21135
|
+
refusal: {
|
|
21136
|
+
error: `No run of "${op}" to report \u2014 ${firstLine3(err) || "chant printed no run status"}`,
|
|
21137
|
+
code: "no-run",
|
|
21138
|
+
remedy: "Start the Op (Run) and the playhead fills in when it settles."
|
|
21139
|
+
}
|
|
21140
|
+
};
|
|
21141
|
+
}
|
|
21142
|
+
const steps = /^(\d+)\/(\d+)/.exec(f.get("Steps") ?? "");
|
|
21148
21143
|
const gateLine = f.get("Gate");
|
|
21149
21144
|
return {
|
|
21150
21145
|
ok: true,
|
|
21151
21146
|
read: {
|
|
21152
21147
|
op,
|
|
21153
|
-
...f.get("
|
|
21148
|
+
...f.get("Runtime") ? { runtime: f.get("Runtime") } : {},
|
|
21154
21149
|
...f.get("Run ID") ? { runId: f.get("Run ID") } : {},
|
|
21155
|
-
...f.get("
|
|
21150
|
+
...f.get("State") ? { status: f.get("State") } : {},
|
|
21156
21151
|
...f.get("Started") ? { startedAt: f.get("Started") } : {},
|
|
21157
|
-
...f.get("
|
|
21158
|
-
...
|
|
21159
|
-
|
|
21160
|
-
//
|
|
21161
|
-
//
|
|
21152
|
+
...f.get("Ended") ? { endedAt: f.get("Ended") } : {},
|
|
21153
|
+
...steps ? { steps: { settled: Number(steps[1]), total: Number(steps[2]) } } : {},
|
|
21154
|
+
...f.get("Error") ? { error: f.get("Error") } : {},
|
|
21155
|
+
// chant prints a Gate line only for a gated run; no line means no gate is
|
|
21156
|
+
// waiting on a human right now.
|
|
21162
21157
|
gate: gateLine ? parseGateLine(gateLine) : null
|
|
21163
21158
|
}
|
|
21164
21159
|
};
|
|
21165
21160
|
}
|
|
21161
|
+
var GATED_EXIT_CODE = 3;
|
|
21166
21162
|
var initialRunState = {
|
|
21167
21163
|
op: null,
|
|
21168
21164
|
mode: null,
|
|
@@ -21186,6 +21182,9 @@ function runGate(state, result) {
|
|
|
21186
21182
|
function runEnded(state, exitCode, at2) {
|
|
21187
21183
|
if (state.status !== "running") return state;
|
|
21188
21184
|
if (exitCode === 0) return { ...state, status: "ok", endedAt: at2 };
|
|
21185
|
+
if (exitCode === GATED_EXIT_CODE && !state.records.some((r) => r.status === "fail")) {
|
|
21186
|
+
return { ...state, status: "gated", endedAt: at2 };
|
|
21187
|
+
}
|
|
21189
21188
|
if (state.records.some((r) => r.status === "fail")) return { ...state, status: "failed", endedAt: at2 };
|
|
21190
21189
|
return {
|
|
21191
21190
|
...state,
|
|
@@ -21205,6 +21204,8 @@ function slotsFor(placed) {
|
|
|
21205
21204
|
if (nested.kind === "activity") out.push({ id: p.id, phase: p.phase, fn: nested.fn });
|
|
21206
21205
|
}
|
|
21207
21206
|
out.push({ id: p.id, phase: p.phase, fn: RECEIPT_WRITE_FN });
|
|
21207
|
+
} else if (p.step.kind === "gate") {
|
|
21208
|
+
out.push({ id: p.id, phase: p.phase, fn: `gate:${p.step.signalName}` });
|
|
21208
21209
|
}
|
|
21209
21210
|
}
|
|
21210
21211
|
return out;
|
|
@@ -21324,17 +21325,16 @@ function playheadNote(state, join57) {
|
|
|
21324
21325
|
}
|
|
21325
21326
|
const settled = join57 ? join57.byNode.size : state.records.length;
|
|
21326
21327
|
const bits = [];
|
|
21327
|
-
const head = state.status === "idle" ? `Run state for ${state.op}: no per-step records \u2014 this behold session didn't start the run, so only the gate query answers` : `Run: ${state.op} (
|
|
21328
|
+
const head = state.status === "idle" ? `Run state for ${state.op}: no per-step records \u2014 this behold session didn't start the run, so only the gate query answers` : `Run: ${state.op} (local executor) \u2014 ${settled} step${settled === 1 ? "" : "s"} settled`;
|
|
21328
21329
|
if (state.status === "running") {
|
|
21329
|
-
bits.push(
|
|
21330
|
-
state.mode === "local" ? "still running; the local executor reports every step at once when it ends, so the track fills in on completion" : "still running; only settled steps are painted"
|
|
21331
|
-
);
|
|
21330
|
+
bits.push("still running; only settled steps are painted");
|
|
21332
21331
|
}
|
|
21333
21332
|
if (state.status === "ok") bits.push("the run exited cleanly");
|
|
21334
21333
|
if (state.status === "failed") bits.push("a step failed");
|
|
21334
|
+
if (state.status === "gated") bits.push("the run stopped at a gate; nothing after it ran");
|
|
21335
21335
|
if (state.status === "lost") bits.push(`stream lost \u2014 ${state.lost ?? "the progress stream ended without a verdict"}`);
|
|
21336
21336
|
if (state.gate) {
|
|
21337
|
-
bits.push(`waiting on gate ${state.gate.signalName} since ${state.gate.since} \u2014 approve
|
|
21337
|
+
bits.push(`waiting on gate ${state.gate.signalName} since ${state.gate.since} \u2014 approve records the resolution (chant run approve) and the Op runs again; behold never approves on its own`);
|
|
21338
21338
|
} else if (state.gateNote) {
|
|
21339
21339
|
bits.push(`gate state unavailable \u2014 ${state.gateNote}`);
|
|
21340
21340
|
}
|
|
@@ -21765,7 +21765,7 @@ var OpRunner = class {
|
|
|
21765
21765
|
*/
|
|
21766
21766
|
noteGate(op, result) {
|
|
21767
21767
|
if (this.lastRunState.op !== null && this.lastRunState.op !== op) return this.lastRunState;
|
|
21768
|
-
const base = this.lastRunState.op === op ? this.lastRunState : { ...initialRunState, op, mode: "
|
|
21768
|
+
const base = this.lastRunState.op === op ? this.lastRunState : { ...initialRunState, op, mode: "local" };
|
|
21769
21769
|
const next = runGate(base, result);
|
|
21770
21770
|
const changed = JSON.stringify(next) !== JSON.stringify(this.lastRunState);
|
|
21771
21771
|
this.lastRunState = next;
|
|
@@ -21777,23 +21777,21 @@ var OpRunner = class {
|
|
|
21777
21777
|
* sync path). `cwd` is the Op's own project dir (#31 multi-estate); defaults to
|
|
21778
21778
|
* the primary. Returns true if it started, false if busy.
|
|
21779
21779
|
*
|
|
21780
|
-
*
|
|
21781
|
-
*
|
|
21782
|
-
*
|
|
21783
|
-
*
|
|
21780
|
+
* Every run is `chant run <name> --progress-json` on the project's resolved
|
|
21781
|
+
* runtime. chant removed `--temporal` with the temporal lexicon (chant#2131),
|
|
21782
|
+
* and a gated Op now runs locally too: it stops at its gate and exits 3,
|
|
21783
|
+
* which `runEnded` reads as `gated` (#459).
|
|
21784
21784
|
*
|
|
21785
|
-
*
|
|
21786
|
-
* chant#1676)
|
|
21787
|
-
*
|
|
21788
|
-
*
|
|
21789
|
-
*
|
|
21790
|
-
* path, so each parsed record is re-emitted to the `op` now-line
|
|
21791
|
-
* ({@link recordLine}) and the operator loses no narration.
|
|
21785
|
+
* `--progress-json` streams one NDJSON `StepRecord` per settled step on
|
|
21786
|
+
* stdout (#284 item 2, chant#1676), and chant's human summary goes to
|
|
21787
|
+
* stderr. Not `--json`: chant's `--json` now prints the run's ledger record
|
|
21788
|
+
* (`phases[].steps[]`), which carries no `StepRecord`s for the playhead.
|
|
21789
|
+
* Each parsed record is re-emitted to the `op` now-line ({@link recordLine}).
|
|
21792
21790
|
*/
|
|
21793
|
-
trigger(name, opEnv, cwd
|
|
21791
|
+
trigger(name, opEnv, cwd) {
|
|
21794
21792
|
if (this.current) return false;
|
|
21795
|
-
const mode =
|
|
21796
|
-
const args =
|
|
21793
|
+
const mode = "local";
|
|
21794
|
+
const args = ["run", name, "--progress-json"];
|
|
21797
21795
|
this.lastRunState = runStarted(name, mode, (/* @__PURE__ */ new Date()).toISOString());
|
|
21798
21796
|
this.emitRun();
|
|
21799
21797
|
return this.start(
|
|
@@ -25822,6 +25820,7 @@ function demoProblem(doc) {
|
|
|
25822
25820
|
if (!isRecord19(doc.next)) return "next is neither an object nor null";
|
|
25823
25821
|
if (!str15(doc.next.action)) return "next.action is not a string";
|
|
25824
25822
|
if (doc.next.at !== null && !(str15(doc.next.at) && UTC.test(doc.next.at))) return "next.at is neither a UTC time nor null";
|
|
25823
|
+
if (doc.next.from !== void 0 && !(str15(doc.next.from) && UTC.test(doc.next.from))) return "next.from is not a UTC time";
|
|
25825
25824
|
}
|
|
25826
25825
|
if (doc.pull !== null && !int2(doc.pull)) return "pull is neither an integer nor null";
|
|
25827
25826
|
if (doc.commit !== null && !str15(doc.commit)) return "commit is neither a string nor null";
|
|
@@ -25862,7 +25861,7 @@ function demoOf(d) {
|
|
|
25862
25861
|
step: d.step,
|
|
25863
25862
|
label: d.label,
|
|
25864
25863
|
started_at: d.started_at,
|
|
25865
|
-
next: d.next ? { action: d.next.action, at: d.next.at } : null,
|
|
25864
|
+
next: d.next ? { action: d.next.action, ...d.next.from ? { from: d.next.from } : {}, at: d.next.at } : null,
|
|
25866
25865
|
pull: d.pull,
|
|
25867
25866
|
commit: d.commit,
|
|
25868
25867
|
about: d.about ? { changes: d.about.changes, watch: d.about.watch, shows: d.about.shows } : null,
|
|
@@ -28783,7 +28782,7 @@ function createApp(cfg, broadcaster = new Broadcaster(), frames = new FrameBuffe
|
|
|
28783
28782
|
}
|
|
28784
28783
|
const designatedEnv = info.kind === "apply" ? executorDesignation(info.dir, info.env) : void 0;
|
|
28785
28784
|
if (designatedEnv && info.env) return c.json(forgeRefusal(info.env, designatedEnv, `running ${name}`), 409);
|
|
28786
|
-
if (!runner.trigger(name, info.env, info.dir
|
|
28785
|
+
if (!runner.trigger(name, info.env, info.dir)) {
|
|
28787
28786
|
return c.json({ error: `an Op is already running (${runner.running})` }, 409);
|
|
28788
28787
|
}
|
|
28789
28788
|
return c.json({ started: true, name });
|
|
@@ -28827,7 +28826,7 @@ function createApp(cfg, broadcaster = new Broadcaster(), frames = new FrameBuffe
|
|
|
28827
28826
|
app.get("/api/ops/:name/status", async (c) => {
|
|
28828
28827
|
const name = c.req.param("name");
|
|
28829
28828
|
const info = estateOps().find((o) => o.name === name);
|
|
28830
|
-
const run3 = await runChantRaw(["run", "status", name
|
|
28829
|
+
const run3 = await runChantRaw(["run", "status", name], info?.dir ?? cfg.projectDir);
|
|
28831
28830
|
const result = readRunStatus(name, run3);
|
|
28832
28831
|
const runState = runner.noteGate(name, result);
|
|
28833
28832
|
if (!result.ok) return c.json({ ...result.refusal, runState }, 422);
|
|
@@ -28930,10 +28929,11 @@ function createApp(cfg, broadcaster = new Broadcaster(), frames = new FrameBuffe
|
|
|
28930
28929
|
if (cfg.previewMode) return c.json({ error: "approving is disabled in preview mode", code: "preview" }, 403);
|
|
28931
28930
|
const { name, gate } = c.req.param();
|
|
28932
28931
|
const info = estateOps().find((o) => o.name === name);
|
|
28933
|
-
broadcaster.emit("op", `\u270E
|
|
28934
|
-
const { code, stderr } = await runChantRaw(["run", "
|
|
28935
|
-
if (code !== 0) return c.json({ error: stderr.trim() || `
|
|
28936
|
-
|
|
28932
|
+
broadcaster.emit("op", `\u270E approve ${name} ${gate}`);
|
|
28933
|
+
const { code, stderr, stdout } = await runChantRaw(["run", "approve", name, gate], info?.dir ?? cfg.projectDir);
|
|
28934
|
+
if (code !== 0) return c.json({ error: stripAnsi(stderr).trim() || stripAnsi(stdout).trim() || `approve exited ${code}` }, 500);
|
|
28935
|
+
const next = stripAnsi(stderr).trim().split("\n").filter(Boolean).at(-1) ?? null;
|
|
28936
|
+
return c.json({ approved: true, op: name, gate, next });
|
|
28937
28937
|
});
|
|
28938
28938
|
app.get("/api/workspace/gates", async (c) => {
|
|
28939
28939
|
const ws = servedWorkspace();
|
|
@@ -30395,7 +30395,7 @@ async function startServer(cfg) {
|
|
|
30395
30395
|
}
|
|
30396
30396
|
for (const { op, lexicons } of picks) {
|
|
30397
30397
|
const scope2 = lexicons.join("+");
|
|
30398
|
-
if (runner.trigger(op.name, op.env, op.dir
|
|
30398
|
+
if (runner.trigger(op.name, op.env, op.dir)) {
|
|
30399
30399
|
broadcaster.emit("op", `\u27F3 auto-sync (${autoSync})${memberTag(dir)} ${scope2} \u2192 ${op.name}`);
|
|
30400
30400
|
} else {
|
|
30401
30401
|
broadcaster.emit("op", `\u27F3 auto-sync (${autoSync})${memberTag(dir)} ${scope2} \u2192 ${op.name} waiting \u2014 ${runner.running} is running`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/behold",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.38",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "behold — a live control plane on chant. See your whole estate (every substrate in one graph), coloured by drift; act through delegated, gated Ops.",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@intentius/chant-k8s-client": "^0.124.24",
|
|
47
47
|
"@intentius/pinhole": "^0.5.0",
|
|
48
48
|
"ajv": "^8.20.0",
|
|
49
|
-
"hono": "^4.
|
|
49
|
+
"hono": "^4.13.13"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@intentius/chant-lexicon-terraform": "^0.124.0",
|
package/web/app.js
CHANGED
|
@@ -8008,13 +8008,9 @@ loadSubstrates();
|
|
|
8008
8008
|
// Poll readiness so pills update as things come up on their own (Docker
|
|
8009
8009
|
// starting, a bring-up provisioning) without needing a `changed` event.
|
|
8010
8010
|
setInterval(loadSubstrates, 5000);
|
|
8011
|
-
// #284 item 2:
|
|
8012
|
-
//
|
|
8013
|
-
//
|
|
8014
|
-
// running, so an idle behold shells nothing.
|
|
8015
|
-
setInterval(() => {
|
|
8016
|
-
if (runState && runState.status === "running" && runState.mode === "temporal") pollRunStatus();
|
|
8017
|
-
}, 5000);
|
|
8011
|
+
// #284 item 2, #459: every run is local now, and a gated one exits at its gate
|
|
8012
|
+
// (status `gated`), so there is nothing to poll while one runs. The `run`
|
|
8013
|
+
// event below asks for the gate once the run stops there.
|
|
8018
8014
|
// #234 join 3: the operating loop ticks on its own schedule (chant's operator
|
|
8019
8015
|
// defaults to a 60s round, a CronJob to whatever it declares), so the strip goes
|
|
8020
8016
|
// stale without anyone clicking. Same discipline as the gate tick above rather
|
|
@@ -8145,11 +8141,15 @@ events.addEventListener("apply", (e) => {
|
|
|
8145
8141
|
// re-pull the graph only when the ops lens is what's on screen, since that's
|
|
8146
8142
|
// the view the run state paints over.
|
|
8147
8143
|
events.addEventListener("run", (e) => {
|
|
8144
|
+
let wasGated = false;
|
|
8148
8145
|
try {
|
|
8146
|
+
wasGated = !!runState && runState.status === "gated";
|
|
8149
8147
|
runState = JSON.parse(e.data);
|
|
8150
8148
|
} catch {
|
|
8151
8149
|
return;
|
|
8152
8150
|
}
|
|
8151
|
+
// #459: a run that just stopped at its gate: ask which gate, once.
|
|
8152
|
+
if (runState && runState.status === "gated" && !runState.gate && !wasGated) pollRunStatus();
|
|
8153
8153
|
renderDial();
|
|
8154
8154
|
if (view.ops) load({ quiet: true });
|
|
8155
8155
|
});
|
|
@@ -8190,9 +8190,8 @@ function pollRunStatus() {
|
|
|
8190
8190
|
if (staticMode || publicMode || runStatusInFlight) return; // #569: a public serve refuses the op tools
|
|
8191
8191
|
const name = runStatusTarget();
|
|
8192
8192
|
if (!name) return;
|
|
8193
|
-
//
|
|
8194
|
-
|
|
8195
|
-
if (runState && runState.mode === "local") return;
|
|
8193
|
+
// A run still in flight has no settled status to read yet (#459).
|
|
8194
|
+
if (runState && runState.status === "running") return;
|
|
8196
8195
|
runStatusInFlight = true;
|
|
8197
8196
|
apiFetch(`/api/ops/${encodeURIComponent(name)}/status`)
|
|
8198
8197
|
.then((r) => r.json())
|
|
@@ -8326,7 +8325,9 @@ function signal(name, gate) {
|
|
|
8326
8325
|
showToast(`✗ approve ${gate}: ${j.error}`, false);
|
|
8327
8326
|
nowline("✗ " + j.error);
|
|
8328
8327
|
} else {
|
|
8329
|
-
|
|
8328
|
+
// #459: the local runtime reads the approval when the Op runs again;
|
|
8329
|
+
// chant's own line says so, and comes back as `next`.
|
|
8330
|
+
showToast(`✓ approved ${gate}${j.next ? ` — ${j.next}` : ""}`, true);
|
|
8330
8331
|
}
|
|
8331
8332
|
// #284 item 2: re-ask gateState either way. On success the gate should be
|
|
8332
8333
|
// gone (the pending card must not linger as if a human were still owed);
|
|
@@ -8541,7 +8542,7 @@ async function initActions() {
|
|
|
8541
8542
|
bar.appendChild(deploy);
|
|
8542
8543
|
if (opsApply.gate) {
|
|
8543
8544
|
const approve = button(`Approve ${opsApply.gate}`, "approve", () => signal(opsApply.name, opsApply.gate));
|
|
8544
|
-
approve.title = `chant run
|
|
8545
|
+
approve.title = `chant run approve ${opsApply.name} ${opsApply.gate} — records the gate's resolution; the Op runs on from it.`;
|
|
8545
8546
|
bar.appendChild(approve);
|
|
8546
8547
|
}
|
|
8547
8548
|
} else if (opsInitialEnv || view.env) {
|
package/web/run-playhead.js
CHANGED
|
@@ -74,15 +74,13 @@ export function runVerdict(run) {
|
|
|
74
74
|
}
|
|
75
75
|
if (run.status === "running") {
|
|
76
76
|
return {
|
|
77
|
-
text:
|
|
78
|
-
run.mode === "local"
|
|
79
|
-
? `${run.op}: running on the local executor — steps arrive together when it ends`
|
|
80
|
-
: `${run.op}: running — ${settled}`,
|
|
77
|
+
text: `${run.op}: running — ${settled}`,
|
|
81
78
|
tone: "running",
|
|
82
79
|
};
|
|
83
80
|
}
|
|
84
81
|
if (run.status === "ok") return { text: `${run.op}: exited cleanly — ${settled}`, tone: "ok" };
|
|
85
82
|
if (run.status === "failed") return { text: `${run.op}: a step failed — ${settled}`, tone: "failed" };
|
|
83
|
+
if (run.status === "gated") return { text: `${run.op}: stopped at a gate — ${settled}; approve it, then run the Op again`, tone: "running" };
|
|
86
84
|
return { text: `${run.op}: stream lost — frozen at ${settled}`, tone: "lost" };
|
|
87
85
|
}
|
|
88
86
|
|
|
@@ -196,7 +194,7 @@ export function renderGateCard(gate, actions = {}) {
|
|
|
196
194
|
return box;
|
|
197
195
|
}
|
|
198
196
|
const approve = el("button", "approve", actions.approver ? `Approve ${gate.signalName} as ${actions.approver}` : `Approve ${gate.signalName}`);
|
|
199
|
-
approve.title = `${gate.approve.method} ${gate.approve.path} — the same delegated
|
|
197
|
+
approve.title = `${gate.approve.method} ${gate.approve.path} — the same delegated write as chant run approve ${gate.op} ${gate.signalName}. behold never approves on its own.`;
|
|
200
198
|
approve.addEventListener("click", () => actions.approve?.(gate.op, gate.signalName));
|
|
201
199
|
box.appendChild(approve);
|
|
202
200
|
return box;
|
package/web/run-playhead.test.js
CHANGED
|
@@ -63,8 +63,15 @@ describe("runVerdict", () => {
|
|
|
63
63
|
expect(runVerdict({ ...withRecords(2), status: "failed" }).text).toContain("a step failed");
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
it("
|
|
67
|
-
expect(runVerdict({ ...
|
|
66
|
+
it("counts settled steps while a local run streams them (#459: --progress-json)", () => {
|
|
67
|
+
expect(runVerdict({ ...withRecords(1), mode: "local" }).text).toContain("running — 1 step settled");
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("says a gated run stopped at its gate and runs again after approval (#459)", () => {
|
|
71
|
+
const v = runVerdict({ ...withRecords(1), status: "gated" });
|
|
72
|
+
expect(v.text).toContain("stopped at a gate");
|
|
73
|
+
expect(v.text).toContain("run the Op again");
|
|
74
|
+
expect(v.text).not.toMatch(/lost|failed/);
|
|
68
75
|
});
|
|
69
76
|
|
|
70
77
|
it("doesn't claim to have watched a run it didn't start", () => {
|