shadok-ai 0.19.26 → 0.19.28

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 ⏰;
@@ -343,13 +345,14 @@ Enter to skip; you can add it later from the web UI).
343
345
  conversation is a real agent that stays resident, and they all draw on **your**
344
346
  Claude subscription, so there is no cap and no queue by design. Go back to
345
347
  **Board group** and every such conversation is closed at once.
346
- - **Link to a message** — every message (yours and the agent's) has a 🔗 link
347
- button beside copy. It copies a URL like `…/#agent=<session>&msg=<id>`;
348
- whoever opens it — someone who already has access to this cockpit, after the
349
- usual sign-in — lands on that agent, scrolled to that message, highlighted.
350
- The link lives in the URL's `#` part, so it never reaches the server or a
351
- proxy log. A message older than the history shown (the last 100 turns), or an
352
- agent that was closed, says so instead of opening somewhere else.
348
+ - **Link to a message** — every message (yours and the agent's, and a **room**'s
349
+ too) has a 🔗 link button beside copy. It copies a URL like
350
+ `…/#agent=<session>&msg=<id>` for an agent, `…/#room=<room>&msg=<id>` for a
351
+ room; whoever opens it — someone who already has access to this cockpit, after
352
+ the usual sign-in — lands on that conversation, scrolled to that message,
353
+ highlighted. The link lives in the URL's `#` part, so it never reaches the
354
+ server or a proxy log. A message older than the history shown, or a
355
+ conversation that was closed, says so instead of opening somewhere else.
353
356
  - **Run the command an agent asks you to** — when an agent writes `! cmd` for
354
357
  you to run (typically because it cannot), a ▶ run button sits right on that
355
358
  command's code block, beside its copy button — so it runs where it was
@@ -1419,7 +1422,7 @@ HTTP endpoints (same auth): `/usage`, `/live`, `/sessions`, `/recover`,
1419
1422
  `/channels/glance` (GET — each visible row's last-message time and context %,
1420
1423
  read from the transcript's tail so the list fills before the agents resume),
1421
1424
  `/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
1425
+ 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
1426
  cockpit's name, per launch directory: click the header brand to rename it, so
1424
1427
  several cockpits stay apart in the tab bar; an empty PUT reverts to the default),
1425
1428
  `/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