shadok-ai 0.19.26 → 0.19.27

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/README.md CHANGED
@@ -200,7 +200,9 @@ Enter to skip; you can add it later from the web UI).
200
200
  prompt and the agent runs. A watcher that is quiet most of the day costs
201
201
  nothing most of the day. The guard runs with the target agent's profile
202
202
  secrets, so an agent may put one only on itself (a person may guard any agent
203
- they can drive).
203
+ they can drive). Each schedule in the ⏰ popin has a **▶ Run now** button —
204
+ test a new one without waiting for its slot; its next run stays where it was —
205
+ and shows when it runs next and how its last run ended.
204
206
  - **Webhooks** — let an outside system (CI, a form, a monitoring tool, Zapier…)
205
207
  wake an agent with an HTTP call, the event-driven twin of a schedule. Create
206
208
  one in the agent's **⚡ Webhooks** popin (the ⚡ icon in its bar, beside ⏰;
@@ -1419,7 +1421,7 @@ HTTP endpoints (same auth): `/usage`, `/live`, `/sessions`, `/recover`,
1419
1421
  `/channels/glance` (GET — each visible row's last-message time and context %,
1420
1422
  read from the transcript's tail so the list fills before the agents resume),
1421
1423
  `/channel` (DELETE), `/groups`, `/groups/ssh` (GET — the SSH **public** key to
1422
- register per group, filtered like `/groups`), `/crons`, `/webhooks` (GET; POST create, PATCH/DELETE `/webhooks/:id`, POST `/webhooks/:id/rotate` — writes browser person only, the token is returned only by create/rotate; the call itself, `POST /hooks/:id`, sits before the password gate and authenticates with the webhook's own token), `/timezone`, `/title` (GET/PUT — the
1424
+ register per group, filtered like `/groups`), `/crons` (+ POST `/crons/:id/run` — fire a schedule now, its next slot unchanged), `/webhooks` (GET; POST create, PATCH/DELETE `/webhooks/:id`, POST `/webhooks/:id/rotate` — writes browser person only, the token is returned only by create/rotate; the call itself, `POST /hooks/:id`, sits before the password gate and authenticates with the webhook's own token), `/timezone`, `/title` (GET/PUT — the
1423
1425
  cockpit's name, per launch directory: click the header brand to rename it, so
1424
1426
  several cockpits stay apart in the tab bar; an empty PUT reverts to the default),
1425
1427
  `/theme` (GET/PUT — the cockpit's colour palette, per launch directory: an accent
package/dist/server.js CHANGED
@@ -3195,6 +3195,38 @@ app.delete("/crons", (req, res) => {
3195
3195
  removeCron(r.id);
3196
3196
  res.json({ ok: true, id: r.id });
3197
3197
  });
3198
+ // Run a schedule NOW, out of band — to test a new one without waiting for its
3199
+ // slot, or to get today's report again. Exactly a fire (guard first, then the
3200
+ // agent unless the guard stays silent), but it leaves the schedule alone: no
3201
+ // `nextRun` advance, no retry bookkeeping, a spent one-shot stays spent. Only
3202
+ // `lastRun`/`lastOutcome` move, so the list shows what the run did.
3203
+ // Same ACL as editing the cron (`mayActFor` on its agent); answered at once,
3204
+ // because the fire lasts as long as the agent's turn.
3205
+ app.post("/crons/:id/run", (req, res) => {
3206
+ const r = resolveCronId(loadCrons().filter((c) => mayActFor(req, c.sessionId)), String(req.params.id ?? ""));
3207
+ if (!r.ok)
3208
+ return res.status(r.error === "ambiguous" ? 409 : 404).json({ error: r.error === "ambiguous" ? "ambiguous id" : "no such cron" });
3209
+ const c = loadCrons().find((x) => x.id === r.id);
3210
+ // The same anti-double-fire rule as `cronTick`: one run of a cron at a time.
3211
+ if (cronsFiring.has(c.id))
3212
+ return res.status(409).json({ error: "this schedule is already running" });
3213
+ cronsFiring.add(c.id);
3214
+ console.log(`${cronTag(c)} run now (manual)`);
3215
+ const note = (outcome) => {
3216
+ const list = loadCrons();
3217
+ const x = list.find((y) => y.id === c.id);
3218
+ if (!x)
3219
+ return; // deleted while running
3220
+ x.lastRun = Date.now();
3221
+ x.lastOutcome = outcome;
3222
+ saveCrons(list);
3223
+ };
3224
+ void fireCron(c)
3225
+ .then((out) => note(out.outcome))
3226
+ .catch((e) => { console.log(`${cronTag(c)} manual run crashed: ${e?.message ?? e}`); note("error"); })
3227
+ .finally(() => cronsFiring.delete(c.id));
3228
+ res.status(202).json({ ok: true, id: c.id });
3229
+ });
3198
3230
  app.put("/channels", (req, res) => {
3199
3231
  // A stale tab whose server was stopped and replaced by another instance on the
3200
3232
  // same port must not write its old channels into THIS instance's file. The