shadok-ai 0.19.65 → 0.19.67

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
@@ -273,6 +273,13 @@ Enter to skip; you can add it later from the web UI).
273
273
  child's own "Detach from…", or, on the parent, "Children reporting here…" to
274
274
  drop an agent whose reports you no longer want. An agent can do the same over
275
275
  the CLI with `pilotctl set-parent <id> <parent|none>`.
276
+ The agents column **draws the link as a tree**: the agents an agent launched
277
+ sit indented under it, and the ▾ count on its tab folds them away (folded, it
278
+ carries the mood of what it hides — a child waiting for an answer still
279
+ shows). Nothing is arranged by hand and nothing is stored: the tree follows
280
+ the link. It never overrides where you filed an agent, though — a child you
281
+ put in another folder or group stays there, and when a parent is closed its
282
+ children simply move up a level.
276
283
  - **Quota gauges + pace guard** — 5h and 7d subscription usage, with an
277
284
  optional block when you're burning faster than the window elapses (any
278
285
  message can force through).
package/dist/server.js CHANGED
@@ -9549,6 +9549,7 @@ group = null) {
9549
9549
  screenTimer: null,
9550
9550
  lastScreen: "",
9551
9551
  lastDialogKey: null,
9552
+ answering: 0,
9552
9553
  contextWindow,
9553
9554
  backend: backend.kind,
9554
9555
  // A reattached session must show its bar at once, not only after the next
@@ -9828,7 +9829,7 @@ async function attachPilot(s) {
9828
9829
  // screen change closes that hole for `key` and for any future path that
9829
9830
  // bypasses `finishTurn`. `publishDialog` dedups, so a dialog sitting
9830
9831
  // there while the footer clock ticks is announced exactly once.
9831
- if (settled && !s.busy) {
9832
+ if (settled && !s.busy && !s.answering) {
9832
9833
  const d = detectDialog(scr);
9833
9834
  if (d)
9834
9835
  publishDialog(s, d);
@@ -9841,7 +9842,7 @@ async function attachPilot(s) {
9841
9842
  // finishTurn, so watch for it here and signal the turn like any other.
9842
9843
  // SAY it when that fails: this is the one `finishTurn` call with nobody to
9843
9844
  // report to, and swallowing it is how a flag left up here stayed invisible.
9844
- if (settled && !s.busy && pilot.isWorking())
9845
+ if (settled && !s.busy && !s.answering && pilot.isWorking())
9845
9846
  finishTurn(s).catch((e) => console.error(`[sk-${s.id}] finishTurn (spontaneous resume) failed — ${e instanceof Error ? e.message : e}`));
9846
9847
  // Is `busy` still held by anyone? A flag that latches ON makes the agent
9847
9848
  // refuse every later prompt, for as long as the process lives, with
@@ -11462,9 +11463,17 @@ wss.on("connection", (ws, req) => {
11462
11463
  // running — either way there's nothing to select here.
11463
11464
  if (!detectDialog(session.pilot.screen()))
11464
11465
  return fail(session.busy ? "a response is already in progress" : "this dialog is no longer active");
11465
- await selectOption(session.pilot, msg.n);
11466
- await sleep(500);
11467
- await finishTurn(session);
11466
+ // Keep the screen watcher out until finishTurn has published whatever
11467
+ // comes next (see `Live.answering`).
11468
+ session.answering++;
11469
+ try {
11470
+ await selectOption(session.pilot, msg.n);
11471
+ await sleep(500);
11472
+ await finishTurn(session);
11473
+ }
11474
+ finally {
11475
+ session.answering--;
11476
+ }
11468
11477
  break;
11469
11478
  }
11470
11479
  case "toggle": {
@@ -11495,17 +11504,28 @@ wss.on("connection", (ws, req) => {
11495
11504
  const t = msg.text.trim();
11496
11505
  if (!t)
11497
11506
  return;
11498
- session.pilot.write(String(msg.n));
11499
- await sleep(700);
11500
- session.pilot.write(`\x1b[200~${t}\x1b[201~`);
11501
- await sleep(400);
11502
- session.pilot.press("enter");
11503
- await sleep(600);
11504
- const d = detectDialog(session.pilot.screen());
11505
- if (d)
11506
- broadcast(session, dialogMessage(session, d));
11507
- else
11508
- await finishTurn(session);
11507
+ session.answering++;
11508
+ try {
11509
+ session.pilot.write(String(msg.n));
11510
+ await sleep(700);
11511
+ session.pilot.write(`\x1b[200~${t}\x1b[201~`);
11512
+ await sleep(400);
11513
+ session.pilot.press("enter");
11514
+ await sleep(600);
11515
+ const d = detectDialog(session.pilot.screen());
11516
+ if (d) {
11517
+ // The next question of a form, or the same one again: either way a
11518
+ // fresh ask. Through publishDialog, so the key is recorded and the
11519
+ // watcher does not announce it a second time once we let go.
11520
+ session.lastDialogKey = null;
11521
+ publishDialog(session, d);
11522
+ }
11523
+ else
11524
+ await finishTurn(session);
11525
+ }
11526
+ finally {
11527
+ session.answering--;
11528
+ }
11509
11529
  break;
11510
11530
  }
11511
11531
  case "confirm": {
@@ -11524,22 +11544,28 @@ wss.on("connection", (ws, req) => {
11524
11544
  // — in the multi-question case that Enter answered the next question
11525
11545
  // with its default (silently, wrongly), corrupting the form. Wait for
11526
11546
  // whichever screen Tab produced, then decide.
11527
- session.pilot.press("tab");
11528
- await session.pilot
11529
- .waitFor((scr) => SUBMIT_PAGE.test(scr) || (detectDialog(scr)?.question ?? before.question) !== before.question, { timeoutMs: 5000 })
11530
- .catch(() => { }); // neither settled in time: fall through and inspect
11531
- await sleep(300);
11532
- const scr = session.pilot.screen();
11533
- const next = detectDialog(scr);
11534
- if (SUBMIT_PAGE.test(scr) || !next) {
11535
- // The recap/submit page (this was the last question), or the form is
11536
- // gone: let finishTurn drive it — it auto-confirms the recap.
11537
- await finishTurn(session);
11547
+ session.answering++;
11548
+ try {
11549
+ session.pilot.press("tab");
11550
+ await session.pilot
11551
+ .waitFor((scr) => SUBMIT_PAGE.test(scr) || (detectDialog(scr)?.question ?? before.question) !== before.question, { timeoutMs: 5000 })
11552
+ .catch(() => { }); // neither settled in time: fall through and inspect
11553
+ await sleep(300);
11554
+ const scr = session.pilot.screen();
11555
+ const next = detectDialog(scr);
11556
+ if (SUBMIT_PAGE.test(scr) || !next) {
11557
+ // The recap/submit page (this was the last question), or the form is
11558
+ // gone: let finishTurn drive it — it auto-confirms the recap.
11559
+ await finishTurn(session);
11560
+ }
11561
+ else {
11562
+ // Tab landed on a FURTHER question — hand it back to the user to
11563
+ // answer rather than auto-picking its default with Enter.
11564
+ publishDialog(session, next);
11565
+ }
11538
11566
  }
11539
- else {
11540
- // Tab landed on a FURTHER question — hand it back to the user to
11541
- // answer rather than auto-picking its default with Enter.
11542
- publishDialog(session, next);
11567
+ finally {
11568
+ session.answering--;
11543
11569
  }
11544
11570
  break;
11545
11571
  }