@primusclaw/personal-agent 0.10.2 → 0.10.3

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/dist/index.js CHANGED
@@ -7153,6 +7153,7 @@ var StatusMessage = class {
7153
7153
  policy;
7154
7154
  lead;
7155
7155
  group;
7156
+ editSeconds;
7156
7157
  /** undefined: the progress message (no stream here, or the chat refused it). */
7157
7158
  stream;
7158
7159
  /** The stream itself, kept after a refusal: it is still closed when it can be. */
@@ -7192,6 +7193,7 @@ var StatusMessage = class {
7192
7193
  this.stream = options.streamReplyTo ? new StreamHandle(surface, options.streamReplyTo, options.clock) : void 0;
7193
7194
  this.live = this.stream;
7194
7195
  this.group = options.group ?? false;
7196
+ this.editSeconds = Math.max(options.editSeconds ?? LIVE_MIN_INTERVAL, LIVE_MIN_INTERVAL);
7195
7197
  }
7196
7198
  begin() {
7197
7199
  this.begunAt = nowSeconds(this.clock);
@@ -7373,7 +7375,7 @@ ${line2}` : line2));
7373
7375
  }
7374
7376
  const messageId = await this.messageId(signal);
7375
7377
  while (messageId && !this.closed) {
7376
- const wait = Math.max(this.lastAt, this.begunAt) + LIVE_MIN_INTERVAL - nowSeconds(this.clock);
7378
+ const wait = Math.max(this.lastAt, this.begunAt) + this.editSeconds - nowSeconds(this.clock);
7377
7379
  if (wait > 0) {
7378
7380
  await sleepSeconds(this.clock, wait, signal);
7379
7381
  continue;
@@ -19049,6 +19051,8 @@ var remoteText = defineCatalog({
19049
19051
  liveHeader: (p) => `Working on it (${p.label})...`,
19050
19052
  aStep: "a step",
19051
19053
  stepFailed: (p) => `\u26A0\uFE0F ${p.title} failed, continuing`,
19054
+ /** The steps of the turn so far, by tool (`Bash ×3, Read ×2`). */
19055
+ stepsSoFar: (p) => `Working: ${p.tools}`,
19052
19056
  anAction: "an action",
19053
19057
  approvalNeeded: (p) => `Approval needed: ${p.tool}`,
19054
19058
  agentOnHost: (p) => `${p.agent} on ${p.host}`,
@@ -19229,6 +19233,7 @@ It installs the connector, pairs the machine with you and keeps it running. I wi
19229
19233
  liveHeader: (p) => `\u6B63\u5728\u5904\u7406\uFF08${p.label}\uFF09\u2026`,
19230
19234
  aStep: "\u4E00\u4E2A\u6B65\u9AA4",
19231
19235
  stepFailed: (p) => `\u26A0\uFE0F ${p.title} \u5931\u8D25\u4E86\uFF0C\u7EE7\u7EED\u6267\u884C`,
19236
+ stepsSoFar: (p) => `\u6B63\u5728\uFF1A${p.tools}`,
19232
19237
  anAction: "\u4E00\u4E2A\u64CD\u4F5C",
19233
19238
  approvalNeeded: (p) => `\u9700\u8981\u6279\u51C6\uFF1A${p.tool}`,
19234
19239
  agentOnHost: (p) => `${p.host} \u4E0A\u7684 ${p.agent}`,
@@ -26710,6 +26715,9 @@ var NOTHING2 = Object.freeze({
26710
26715
  readOnly: null,
26711
26716
  recovered: null,
26712
26717
  queued: null,
26718
+ queuedFor: null,
26719
+ queuedSeq: null,
26720
+ queuedHeld: false,
26713
26721
  typed: null,
26714
26722
  terminal: null,
26715
26723
  terminalMode: null,
@@ -26806,11 +26814,30 @@ function typed(payload) {
26806
26814
  const text8 = pyStrip(textOf5(payload));
26807
26815
  return text8 && !NOT_TYPED.test(text8) ? remoteStep({ typed: text8 }) : NOTHING2;
26808
26816
  }
26817
+ var TOOL_NAME = /^[A-Za-z][\w.-]{0,63}$/u;
26818
+ function toolNameOf(u) {
26819
+ const meta = record5(record5(u["_meta"])["claudeCode"]);
26820
+ const named2 = str6(meta["toolName"]);
26821
+ if (TOOL_NAME.test(named2)) return named2;
26822
+ const head = str6(u["title"]).split(": ", 1)[0] ?? "";
26823
+ return head !== str6(u["title"]) && TOOL_NAME.test(head) ? head : "";
26824
+ }
26809
26825
  function tool(payload, kind) {
26810
26826
  const u = update(payload);
26811
26827
  const id = str6(u["toolCallId"]) || str6(u["tool_call_id"]) || str6(u["id"]);
26812
26828
  const status = str6(u["status"]) || (kind === "tool_call" ? "pending" : "");
26813
- return remoteStep({ tool: { id, title: str6(u["title"]), status } });
26829
+ const name = toolNameOf(u);
26830
+ return remoteStep({ tool: { id, title: str6(u["title"]), status, ...name ? { name } : {} } });
26831
+ }
26832
+ function terminalQueued(payload) {
26833
+ const seq = seqOf(payload["cmd_seq"]);
26834
+ const forId = neutral2(str6(payload["cmd_id"]), 80) || (seq !== null ? String(seq) : "");
26835
+ return remoteStep({
26836
+ queued: str6(payload["reason"]) || "terminal_working",
26837
+ queuedFor: forId || null,
26838
+ queuedSeq: seq,
26839
+ queuedHeld: payload["held"] === "terminal"
26840
+ });
26814
26841
  }
26815
26842
  function turnEnd(payload, _kind, errors) {
26816
26843
  let reason = str6(payload["stopReason"]) || "end_turn";
@@ -26903,7 +26930,7 @@ var READERS = {
26903
26930
  session_error: failed2,
26904
26931
  turn_error: failed2,
26905
26932
  // (the session types into a terminal on the machine, which is busy: the message waits)
26906
- terminal_input_queued: (payload) => remoteStep({ queued: str6(payload["reason"]) || "terminal_working" })
26933
+ terminal_input_queued: terminalQueued
26907
26934
  };
26908
26935
  function decode(event, errors) {
26909
26936
  const payload = record5(event.data["data"]);
@@ -27271,6 +27298,7 @@ __export(remote_view_exports, {
27271
27298
  RUNNING_MARK: () => RUNNING_MARK2,
27272
27299
  RemoteLiveView: () => RemoteLiveView,
27273
27300
  SENT_SHOWN_CHARS: () => SENT_SHOWN_CHARS,
27301
+ STEPS_LINE_TOOLS: () => STEPS_LINE_TOOLS,
27274
27302
  TAIL_CHARS: () => TAIL_CHARS,
27275
27303
  TAIL_LINES: () => TAIL_LINES,
27276
27304
  TERMINAL_CARD_BYTES: () => TERMINAL_CARD_BYTES,
@@ -27669,6 +27697,8 @@ function hiddenView(connector, now, lang = "en") {
27669
27697
  var LIVE_MAX_CHARS2 = 2500;
27670
27698
  var LIVE_KEEP_BLOCKS2 = 40;
27671
27699
  var RUNNING_MARK2 = "\u23F3";
27700
+ var STEPS_LINE_TOOLS = 4;
27701
+ var COUNTED_KEEP = 2e3;
27672
27702
  var STYLE_CHARS = /[*_`~]/g;
27673
27703
  function boundedBody(paragraphs, budget) {
27674
27704
  let body = "";
@@ -27710,6 +27740,10 @@ var RemoteLiveView = class {
27710
27740
  active = /* @__PURE__ */ new Map();
27711
27741
  /** The next text starts a new block (a tool ran since the last one). */
27712
27742
  split = true;
27743
+ /** Tool name -> steps of the turn that ran it, in the order the tools first ran. */
27744
+ perTool = /* @__PURE__ */ new Map();
27745
+ /** The step ids already counted. */
27746
+ counted = /* @__PURE__ */ new Set();
27713
27747
  /** Why the message waits, while it waits for a terminal on the machine (`terminal_input_queued`, said in the chat's language by
27714
27748
  * the runner): the floating status says it, not only "Thinking…", until anything of the turn shows. */
27715
27749
  waiting = "";
@@ -27720,8 +27754,10 @@ var RemoteLiveView = class {
27720
27754
  if (step.queued !== null) this.waiting = step.note ?? "";
27721
27755
  else if (showsTheTurn(step)) this.waiting = "";
27722
27756
  if (step.chunk) this.addText(step.chunk.kind, step.chunk.text);
27723
- else if (step.tool) this.trackTool(step.tool.id, step.tool.title, step.tool.status);
27724
- else if (step.plan) this.setPlan(step.plan);
27757
+ else if (step.tool) {
27758
+ this.count(step.tool.id, step.tool.name ?? "");
27759
+ this.trackTool(step.tool.id, step.tool.title, step.tool.status);
27760
+ } else if (step.plan) this.setPlan(step.plan);
27725
27761
  else if (step.note) {
27726
27762
  this.blocks.push({ kind: "note", text: step.note });
27727
27763
  this.split = true;
@@ -27739,10 +27775,33 @@ var RemoteLiveView = class {
27739
27775
  const last = this.blocks.at(-1);
27740
27776
  if (last?.kind === "failed")
27741
27777
  lines.push(remoteText.in(this.lang).stepFailed({ title: neutral2(last.text, TOOL_TITLE_MAX) }));
27778
+ const steps = this.stepsLine();
27779
+ if (steps) lines.push(steps);
27742
27780
  const running = this.runningLine();
27743
27781
  if (running) lines.push(running);
27744
27782
  return lines.map(inertAnswer);
27745
27783
  }
27784
+ /** `Working: Bash ×3, Read ×2`: the turn's steps so far, by tool (the most used first); null before the first named one. */
27785
+ stepsLine() {
27786
+ if (this.perTool.size === 0) return null;
27787
+ const ranked = [...this.perTool.entries()].sort((a, b3) => b3[1] - a[1]);
27788
+ const shown3 = ranked.slice(0, STEPS_LINE_TOOLS).map(([name, n]) => `${name} \xD7${String(n)}`);
27789
+ const others = ranked.slice(STEPS_LINE_TOOLS).reduce((sum, [, n]) => sum + n, 0);
27790
+ if (others > 0) shown3.push(`+${String(others)}`);
27791
+ return remoteText.in(this.lang).stepsSoFar({ tools: shown3.join(", ") });
27792
+ }
27793
+ /** A step seen for the first time is counted under its tool's name (one the event does not name is not counted). */
27794
+ count(id, name) {
27795
+ if (!name || id && this.counted.has(id)) return;
27796
+ if (id) {
27797
+ this.counted.add(id);
27798
+ for (const oldest of this.counted) {
27799
+ if (this.counted.size <= COUNTED_KEEP) break;
27800
+ this.counted.delete(oldest);
27801
+ }
27802
+ }
27803
+ this.perTool.set(name, (this.perTool.get(name) ?? 0) + 1);
27804
+ }
27746
27805
  /** The header and the newest part of the turn that fits. */
27747
27806
  render() {
27748
27807
  const body = boundedBody(this.paragraphs(), LIVE_MAX_CHARS2);
@@ -27799,6 +27858,8 @@ var RemoteLiveView = class {
27799
27858
  }
27800
27859
  paragraphs() {
27801
27860
  const out = this.blocks.map((b3) => this.paragraph(b3)).filter((p) => p);
27861
+ const steps = this.stepsLine();
27862
+ if (steps) out.push(steps);
27802
27863
  const running = this.runningLine();
27803
27864
  if (running) out.push(running);
27804
27865
  return out.map(inertAnswer);
@@ -28444,6 +28505,14 @@ var remoteAgentText = defineCatalog({
28444
28505
  queueFull: (p) => `${String(p.n)} messages already wait behind the running one, so this one was not sent. Send it once the agent has answered, or /stop to stop it and drop the queue.`,
28445
28506
  queueDropped: (p) => p.n === 1 ? " The message queued behind it was dropped too." : ` The ${String(p.n)} messages queued behind it were dropped too.`,
28446
28507
  queuedRefused: (p) => `A message you queued was not run on the machine: ${p.reason}`,
28508
+ /** The message waits for the turn the terminal is running (`terminal_input_queued`, `terminal_working`), said once per message. */
28509
+ terminalBusy: "The session is busy: your message is queued and goes in when the current turn ends.",
28510
+ /** ... and it is in Claude Code's own queue there (`held: "terminal"`): only the terminal can take it back. */
28511
+ terminalBusyHeld: " To withdraw it, press \u2191 in that terminal: the queued message goes back into its input box.",
28512
+ /** ... and it still waits on the connector: /stop takes it back. */
28513
+ terminalBusyWaiting: " To withdraw it, send /stop.",
28514
+ /** A message said to wait that the terminal's own queue has taken since: where it is now, and how to take it back from there. */
28515
+ terminalBusyNowHeld: "Your queued message is now in the terminal's own queue. To withdraw it, press \u2191 in that terminal.",
28447
28516
  stopFirst: "A task is still running. Send /stop first.",
28448
28517
  notAttached: "You are not attached to a remote session. Start one with `/agent new AGENT PATH`, or `/agent attach N`.",
28449
28518
  approvalInactive: "That approval request is no longer active.",
@@ -28566,6 +28635,10 @@ var remoteAgentText = defineCatalog({
28566
28635
  queueFull: (p) => `\u6B63\u5728\u8FD0\u884C\u7684\u8FD9\u6761\u540E\u9762\u5DF2\u7ECF\u6392\u4E86 ${String(p.n)} \u6761\u6D88\u606F\uFF0C\u8FD9\u6761\u6CA1\u6709\u53D1\u51FA\u53BB\u3002\u7B49 agent \u56DE\u7B54\u540E\u518D\u53D1\uFF0C\u6216\u8005\u53D1 /stop \u505C\u4E0B\u5E76\u6E05\u7A7A\u6392\u961F\u3002`,
28567
28636
  queueDropped: (p) => p.n === 1 ? "\u6392\u5728\u540E\u9762\u7684\u90A3\u6761\u6D88\u606F\u4E5F\u4E00\u8D77\u64A4\u56DE\u4E86\u3002" : `\u6392\u5728\u540E\u9762\u7684 ${String(p.n)} \u6761\u6D88\u606F\u4E5F\u4E00\u8D77\u64A4\u56DE\u4E86\u3002`,
28568
28637
  queuedRefused: (p) => `\u4F60\u6392\u961F\u7684\u4E00\u6761\u6D88\u606F\u6CA1\u6709\u5728\u673A\u5668\u4E0A\u8FD0\u884C\uFF1A${p.reason}`,
28638
+ terminalBusy: "\u4F1A\u8BDD\u6B63\u5FD9\uFF0C\u5DF2\u6392\u961F\uFF0C\u5F53\u524D\u56DE\u5408\u7ED3\u675F\u540E\u53D1\u9001\u3002",
28639
+ terminalBusyHeld: "\u8981\u64A4\u56DE\uFF1A\u5728\u90A3\u53F0\u673A\u5668\u7684\u7EC8\u7AEF\u91CC\u6309 \u2191\uFF0C\u6392\u961F\u7684\u6D88\u606F\u4F1A\u56DE\u5230\u8F93\u5165\u6846\u3002",
28640
+ terminalBusyWaiting: "\u8981\u64A4\u56DE\uFF1A\u53D1 /stop\u3002",
28641
+ terminalBusyNowHeld: "\u6392\u961F\u7684\u6D88\u606F\u5DF2\u8FDB\u5165\u7EC8\u7AEF\u81EA\u5DF1\u7684\u961F\u5217\u3002\u8981\u64A4\u56DE\uFF1A\u5728\u90A3\u53F0\u673A\u5668\u7684\u7EC8\u7AEF\u91CC\u6309 \u2191\u3002",
28569
28642
  stopFirst: "\u8FD8\u6709\u4EFB\u52A1\u5728\u8FD0\u884C\u3002\u5148\u53D1 /stop\u3002",
28570
28643
  notAttached: "\u4F60\u8FD8\u6CA1\u6709\u63A5\u5165\u8FDC\u7A0B\u4F1A\u8BDD\u3002\u7528 `/agent new AGENT PATH` \u5F00\u4E00\u4E2A\uFF0C\u6216\u8005\u53D1 `/agent attach N`\u3002",
28571
28644
  approvalInactive: "\u8FD9\u4E2A\u5BA1\u6279\u8BF7\u6C42\u5DF2\u7ECF\u5931\u6548\u4E86\u3002",
@@ -33079,6 +33152,7 @@ function offlineRefusal(error) {
33079
33152
  }
33080
33153
 
33081
33154
  // packages/core/src/remote/turns/chat-turn.ts
33155
+ var REMOTE_EDIT_SECONDS = 3;
33082
33156
  var RemoteStatusPolicy = class {
33083
33157
  constructor(live, cutError, signer) {
33084
33158
  this.live = live;
@@ -33203,7 +33277,8 @@ var ChatTurn = class {
33203
33277
  log: options.log,
33204
33278
  lang: options.lang,
33205
33279
  policy,
33206
- streamReplyTo: options.replyTo
33280
+ streamReplyTo: options.replyTo,
33281
+ editSeconds: REMOTE_EDIT_SECONDS
33207
33282
  });
33208
33283
  }
33209
33284
  surface;
@@ -33278,6 +33353,8 @@ var REMOTE_TURN_DEADLINE_SECONDS = 4 * 3600;
33278
33353
  var RECONNECT_BACKOFF_SECONDS = 1;
33279
33354
  var CURSOR_EVERY2 = 25;
33280
33355
  var STREAM_ATTEMPTS2 = 4;
33356
+ var BUSY_REASONS = /* @__PURE__ */ new Set(["terminal_working", "terminal_waiting"]);
33357
+ var BUSY_TOLD_KEPT = 20;
33281
33358
  var LostConnection = class extends Error {
33282
33359
  name = "LostConnection";
33283
33360
  };
@@ -33298,6 +33375,8 @@ var TurnRunner = class {
33298
33375
  ended;
33299
33376
  show;
33300
33377
  displayFor;
33378
+ /** Per chat: what it was told of each message (Claw's number) waiting for a busy terminal (`tellBusy`), oldest first. */
33379
+ toldBusy = /* @__PURE__ */ new Map();
33301
33380
  /** Watch the turn that is open on the chat's session. */
33302
33381
  start(request) {
33303
33382
  const turn = newTurn();
@@ -33461,6 +33540,7 @@ var TurnRunner = class {
33461
33540
  }
33462
33541
  const shown3 = step.queued !== null ? { ...step, note: queuedLine(step.queued, this.state.lang(chatKey)) } : step;
33463
33542
  display.progress(shown3);
33543
+ if (step.queued !== null && BUSY_REASONS.has(step.queued)) await this.tellBusy(request, step);
33464
33544
  if (saysModes(step)) this.ctx.remoteState.setRemoteModes(chatKey, sid, step);
33465
33545
  if (step.permission !== null) await this.show(chatKey, sid, step.permission, to);
33466
33546
  if (step.resolved !== null) this.ctx.permissions.closeRemotePermission(sid, actionIdOf(step.resolved), "decided");
@@ -33468,6 +33548,33 @@ var TurnRunner = class {
33468
33548
  await this.sayRecovered(chatKey, to, step.recovered.interrupted, step.recovered.continuing);
33469
33549
  }
33470
33550
  }
33551
+ /**
33552
+ * This turn's message waits for the turn the terminal is running: the person is told at once, in the chat, once per message, and
33553
+ * how to take it back (in the terminal when its own queue holds it; else /stop). A message queued behind a turn of this chat was
33554
+ * told so when it was sent (`queuedBehind`): not again here.
33555
+ */
33556
+ async tellBusy(request, step) {
33557
+ const { chatKey, to } = request;
33558
+ const mine = request.cmdSeq?.();
33559
+ if (step.queuedSeq === null || mine === void 0 || step.queuedSeq !== mine) return;
33560
+ const told = this.toldBusy.get(chatKey) ?? /* @__PURE__ */ new Map();
33561
+ const before = told.get(mine);
33562
+ const now = step.queuedHeld ? "held" : "waiting";
33563
+ if (before === "held" || before === now) return;
33564
+ told.set(mine, now);
33565
+ for (const oldest of told.keys()) {
33566
+ if (told.size <= BUSY_TOLD_KEPT) break;
33567
+ told.delete(oldest);
33568
+ }
33569
+ this.toldBusy.set(chatKey, told);
33570
+ const words3 = remoteAgentText.in(this.state.lang(chatKey));
33571
+ const text8 = before === "waiting" ? words3.terminalBusyNowHeld : words3.terminalBusy + (step.queuedHeld ? words3.terminalBusyHeld : words3.terminalBusyWaiting);
33572
+ try {
33573
+ await to.send(textMessage(text8));
33574
+ } catch (error) {
33575
+ this.ctx.logger.warn("that the message waits for a busy terminal could not be told", { error: errorName(error) });
33576
+ }
33577
+ }
33471
33578
  /**
33472
33579
  * A message waiting behind this turn was refused on the machine before it ran: it waits no more, and the person is told. One whose
33473
33580
  * send has not answered yet has no number to match: the refusal is kept for that send (`Prompts.queueBehind`).
@@ -19,6 +19,14 @@ export declare const remoteAgentText: import("./catalog.js").Catalog<{
19
19
  queuedRefused: (p: {
20
20
  reason: string;
21
21
  }) => string;
22
+ /** The message waits for the turn the terminal is running (`terminal_input_queued`, `terminal_working`), said once per message. */
23
+ terminalBusy: string;
24
+ /** ... and it is in Claude Code's own queue there (`held: "terminal"`): only the terminal can take it back. */
25
+ terminalBusyHeld: string;
26
+ /** ... and it still waits on the connector: /stop takes it back. */
27
+ terminalBusyWaiting: string;
28
+ /** A message said to wait that the terminal's own queue has taken since: where it is now, and how to take it back from there. */
29
+ terminalBusyNowHeld: string;
22
30
  stopFirst: string;
23
31
  notAttached: string;
24
32
  approvalInactive: string;
@@ -7,6 +7,10 @@ export declare const remoteText: import("./catalog.js").Catalog<{
7
7
  stepFailed: (p: {
8
8
  title: string;
9
9
  }) => string;
10
+ /** The steps of the turn so far, by tool (`Bash ×3, Read ×2`). */
11
+ stepsSoFar: (p: {
12
+ tools: string;
13
+ }) => string;
10
14
  anAction: string;
11
15
  approvalNeeded: (p: {
12
16
  tool: string;
@@ -4,6 +4,8 @@ export interface ToolUpdate {
4
4
  readonly id: string;
5
5
  readonly title: string;
6
6
  readonly status: string;
7
+ /** The tool's name (`Bash`, `Read`), "" when the event does not say (the steps are counted by it). */
8
+ readonly name?: string;
7
9
  }
8
10
  /** What the runner does after one event. Every field but the flags is null when the event does not say it. */
9
11
  export interface RemoteStep {
@@ -51,6 +53,12 @@ export interface RemoteStep {
51
53
  } | null;
52
54
  /** A message for a terminal's conversation waits for that terminal (the connector's reason). */
53
55
  readonly queued: string | null;
56
+ /** Which message waits (its `cmd_id`, else Claw's number of it), null when the connector did not say. */
57
+ readonly queuedFor: string | null;
58
+ /** Claw's number of the message that waits, null when the connector did not say. */
59
+ readonly queuedSeq: number | null;
60
+ /** It waits in the terminal's own queue (`held: "terminal"`): only the terminal can take it back. */
61
+ readonly queuedHeld: boolean;
54
62
  /** What the person typed at the terminal of a conversation shared with the chat. */
55
63
  readonly typed: string | null;
56
64
  /** What is sent is typed into a terminal on the machine (`input: "terminal"`). */
@@ -6,6 +6,11 @@ import { type LiveViewLike, type StatusPolicy, type StreamFinish, type StreamFin
6
6
  import type { TurnSurface } from "../../turn/ports.js";
7
7
  import type { FinishWith, TurnDisplay } from "./display.js";
8
8
  import type { Signer } from "./signer.js";
9
+ /**
10
+ * A remote turn's progress message (where there is no stream) is edited at most this often: a coding agent's turn runs for minutes,
11
+ * and an edit every few seconds keeps it current without coming near the chat's limits on edits.
12
+ */
13
+ export declare const REMOTE_EDIT_SECONDS = 3;
9
14
  /** What the bubble shows of a remote turn, and how its stream ends. */
10
15
  export declare class RemoteStatusPolicy implements StatusPolicy<RemoteStep> {
11
16
  private readonly live;
@@ -14,6 +14,10 @@ export declare const RECONNECT_BACKOFF_SECONDS = 1;
14
14
  export declare const CURSOR_EVERY = 25;
15
15
  /** A stream that keeps dropping is given up after this many tries in a row. */
16
16
  export declare const STREAM_ATTEMPTS = 4;
17
+ /** Why a message waits that is the terminal's running turn (`terminal_input_queued`): the person is told so once per message. */
18
+ export declare const BUSY_REASONS: ReadonlySet<string>;
19
+ /** The messages a chat was told wait for a busy terminal, remembered per chat (the newest) so each is told once. */
20
+ export declare const BUSY_TOLD_KEPT = 20;
17
21
  /** How the turn is shown: in the chat, or in the session card (`window-turn.ts`). */
18
22
  export type DisplayFor = (request: TurnRequest, signer: Signer | null) => TurnDisplay;
19
23
  /** What a turn needs besides the chat: the person's credential, how to show it, and who carries what it asks. */
@@ -36,6 +40,8 @@ export declare class TurnRunner {
36
40
  private readonly ended;
37
41
  private readonly show;
38
42
  private readonly displayFor;
43
+ /** Per chat: what it was told of each message (Claw's number) waiting for a busy terminal (`tellBusy`), oldest first. */
44
+ private readonly toldBusy;
39
45
  constructor(ctx: RemoteContext, state: ChatState, board: StatusBoard, follow: FollowControl, ended: EndedWords, show: (chatKey: string, sid: string, request: Readonly<Record<string, unknown>>, to: Conversation) => Promise<void>, displayFor: DisplayFor);
40
46
  /** Watch the turn that is open on the chat's session. */
41
47
  start(request: TurnRequest): void;
@@ -61,6 +67,12 @@ export declare class TurnRunner {
61
67
  /** One stream, read until it ends or the turn does. */
62
68
  private readStream;
63
69
  private apply;
70
+ /**
71
+ * This turn's message waits for the turn the terminal is running: the person is told at once, in the chat, once per message, and
72
+ * how to take it back (in the terminal when its own queue holds it; else /stop). A message queued behind a turn of this chat was
73
+ * told so when it was sent (`queuedBehind`): not again here.
74
+ */
75
+ private tellBusy;
64
76
  /**
65
77
  * A message waiting behind this turn was refused on the machine before it ran: it waits no more, and the person is told. One whose
66
78
  * send has not answered yet has no number to match: the refusal is kept for that send (`Prompts.queueBehind`).
@@ -12,6 +12,8 @@ export declare const LIVE_MAX_CHARS = 2500;
12
12
  export declare const LIVE_KEEP_BLOCKS = 40;
13
13
  /** The mark of the one line of the step that is running now. */
14
14
  export declare const RUNNING_MARK = "\u23F3";
15
+ /** The steps-so-far line names at most this many tools (the most used first); the others are counted as "+N". */
16
+ export declare const STEPS_LINE_TOOLS = 4;
15
17
  /** The newest paragraphs that fit `budget` characters, "..." when older ones were left out, and an unclosed code fence closed. */
16
18
  export declare function boundedBody(paragraphs: readonly string[], budget: number): string;
17
19
  export declare class RemoteLiveView {
@@ -23,6 +25,10 @@ export declare class RemoteLiveView {
23
25
  private readonly active;
24
26
  /** The next text starts a new block (a tool ran since the last one). */
25
27
  private split;
28
+ /** Tool name -> steps of the turn that ran it, in the order the tools first ran. */
29
+ private readonly perTool;
30
+ /** The step ids already counted. */
31
+ private readonly counted;
26
32
  /** Why the message waits, while it waits for a terminal on the machine (`terminal_input_queued`, said in the chat's language by
27
33
  * the runner): the floating status says it, not only "Thinking…", until anything of the turn shows. */
28
34
  private waiting;
@@ -33,6 +39,10 @@ export declare class RemoteLiveView {
33
39
  * its plan stands, a step that failed last, and the step running now. Its words are streamed into the answer's bubble, not
34
40
  * into the status. */
35
41
  statusLines(): string[];
42
+ /** `Working: Bash ×3, Read ×2`: the turn's steps so far, by tool (the most used first); null before the first named one. */
43
+ stepsLine(): string | null;
44
+ /** A step seen for the first time is counted under its tool's name (one the event does not name is not counted). */
45
+ private count;
36
46
  /** The header and the newest part of the turn that fits. */
37
47
  render(): string;
38
48
  private addText;
@@ -38,6 +38,8 @@ export interface StatusOptions<S> {
38
38
  readonly streamReplyTo?: string | undefined;
39
39
  /** Every member sees the floating status: it carries no words of the agent's. */
40
40
  readonly group?: boolean;
41
+ /** The progress message (no stream) is edited at most this often, in seconds (default LIVE_MIN_INTERVAL). */
42
+ readonly editSeconds?: number;
41
43
  }
42
44
  export declare class StatusMessage<S> {
43
45
  private readonly surface;
@@ -47,6 +49,7 @@ export declare class StatusMessage<S> {
47
49
  private readonly policy;
48
50
  private readonly lead;
49
51
  private readonly group;
52
+ private readonly editSeconds;
50
53
  /** undefined: the progress message (no stream here, or the chat refused it). */
51
54
  private stream;
52
55
  /** The stream itself, kept after a refusal: it is still closed when it can be. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primusclaw/personal-agent",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "The personal agent's channel-neutral core: domain logic, ports and plugin interfaces.",
5
5
  "license": "MIT",
6
6
  "repository": {