@primusclaw/personal-agent 0.10.1 → 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;
@@ -13831,11 +13833,7 @@ var GroupRemote = class {
13831
13833
  return true;
13832
13834
  }
13833
13835
  if (!choice && parseCommand(words3.text) !== null) return false;
13834
- let quote = words3.quote;
13835
- if (remote.windowMode(bound.id) === "card") {
13836
- if (!remote.quotesWindow(bound.id, message)) return false;
13837
- quote = "";
13838
- }
13836
+ const quote = remote.quotesWindow(bound.id, message) ? "" : words3.quote;
13839
13837
  const prompt = this.ctx.deps.messageText.withQuote(words3.sent, quote);
13840
13838
  const files = await this.text.attachments(message, chat, true);
13841
13839
  if (!prompt) return files.length > 0;
@@ -14711,7 +14709,9 @@ var GroupRouter = class {
14711
14709
  return;
14712
14710
  }
14713
14711
  const handler = this.ctx.deps.handlers.clicks.find((h) => h.verbs.includes(action.verb));
14714
- if (handler?.inGroup !== void 0) await handler.inGroup(this.ctx.clickRoute(action, chat));
14712
+ if (handler?.inGroup === void 0) return;
14713
+ const groupCredential = () => this.ctx.credentials.credential(chat, false);
14714
+ await handler.inGroup({ ...this.ctx.clickRoute(action, chat), groupCredential });
14715
14715
  }
14716
14716
  words(message) {
14717
14717
  const text8 = this.text.textOf(message, true);
@@ -19051,6 +19051,8 @@ var remoteText = defineCatalog({
19051
19051
  liveHeader: (p) => `Working on it (${p.label})...`,
19052
19052
  aStep: "a step",
19053
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}`,
19054
19056
  anAction: "an action",
19055
19057
  approvalNeeded: (p) => `Approval needed: ${p.tool}`,
19056
19058
  agentOnHost: (p) => `${p.agent} on ${p.host}`,
@@ -19231,6 +19233,7 @@ It installs the connector, pairs the machine with you and keeps it running. I wi
19231
19233
  liveHeader: (p) => `\u6B63\u5728\u5904\u7406\uFF08${p.label}\uFF09\u2026`,
19232
19234
  aStep: "\u4E00\u4E2A\u6B65\u9AA4",
19233
19235
  stepFailed: (p) => `\u26A0\uFE0F ${p.title} \u5931\u8D25\u4E86\uFF0C\u7EE7\u7EED\u6267\u884C`,
19236
+ stepsSoFar: (p) => `\u6B63\u5728\uFF1A${p.tools}`,
19234
19237
  anAction: "\u4E00\u4E2A\u64CD\u4F5C",
19235
19238
  approvalNeeded: (p) => `\u9700\u8981\u6279\u51C6\uFF1A${p.tool}`,
19236
19239
  agentOnHost: (p) => `${p.host} \u4E0A\u7684 ${p.agent}`,
@@ -26712,6 +26715,9 @@ var NOTHING2 = Object.freeze({
26712
26715
  readOnly: null,
26713
26716
  recovered: null,
26714
26717
  queued: null,
26718
+ queuedFor: null,
26719
+ queuedSeq: null,
26720
+ queuedHeld: false,
26715
26721
  typed: null,
26716
26722
  terminal: null,
26717
26723
  terminalMode: null,
@@ -26808,11 +26814,30 @@ function typed(payload) {
26808
26814
  const text8 = pyStrip(textOf5(payload));
26809
26815
  return text8 && !NOT_TYPED.test(text8) ? remoteStep({ typed: text8 }) : NOTHING2;
26810
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
+ }
26811
26825
  function tool(payload, kind) {
26812
26826
  const u = update(payload);
26813
26827
  const id = str6(u["toolCallId"]) || str6(u["tool_call_id"]) || str6(u["id"]);
26814
26828
  const status = str6(u["status"]) || (kind === "tool_call" ? "pending" : "");
26815
- 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
+ });
26816
26841
  }
26817
26842
  function turnEnd(payload, _kind, errors) {
26818
26843
  let reason = str6(payload["stopReason"]) || "end_turn";
@@ -26905,7 +26930,7 @@ var READERS = {
26905
26930
  session_error: failed2,
26906
26931
  turn_error: failed2,
26907
26932
  // (the session types into a terminal on the machine, which is busy: the message waits)
26908
- terminal_input_queued: (payload) => remoteStep({ queued: str6(payload["reason"]) || "terminal_working" })
26933
+ terminal_input_queued: terminalQueued
26909
26934
  };
26910
26935
  function decode(event, errors) {
26911
26936
  const payload = record5(event.data["data"]);
@@ -27273,6 +27298,7 @@ __export(remote_view_exports, {
27273
27298
  RUNNING_MARK: () => RUNNING_MARK2,
27274
27299
  RemoteLiveView: () => RemoteLiveView,
27275
27300
  SENT_SHOWN_CHARS: () => SENT_SHOWN_CHARS,
27301
+ STEPS_LINE_TOOLS: () => STEPS_LINE_TOOLS,
27276
27302
  TAIL_CHARS: () => TAIL_CHARS,
27277
27303
  TAIL_LINES: () => TAIL_LINES,
27278
27304
  TERMINAL_CARD_BYTES: () => TERMINAL_CARD_BYTES,
@@ -27671,6 +27697,8 @@ function hiddenView(connector, now, lang = "en") {
27671
27697
  var LIVE_MAX_CHARS2 = 2500;
27672
27698
  var LIVE_KEEP_BLOCKS2 = 40;
27673
27699
  var RUNNING_MARK2 = "\u23F3";
27700
+ var STEPS_LINE_TOOLS = 4;
27701
+ var COUNTED_KEEP = 2e3;
27674
27702
  var STYLE_CHARS = /[*_`~]/g;
27675
27703
  function boundedBody(paragraphs, budget) {
27676
27704
  let body = "";
@@ -27712,6 +27740,10 @@ var RemoteLiveView = class {
27712
27740
  active = /* @__PURE__ */ new Map();
27713
27741
  /** The next text starts a new block (a tool ran since the last one). */
27714
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();
27715
27747
  /** Why the message waits, while it waits for a terminal on the machine (`terminal_input_queued`, said in the chat's language by
27716
27748
  * the runner): the floating status says it, not only "Thinking…", until anything of the turn shows. */
27717
27749
  waiting = "";
@@ -27722,8 +27754,10 @@ var RemoteLiveView = class {
27722
27754
  if (step.queued !== null) this.waiting = step.note ?? "";
27723
27755
  else if (showsTheTurn(step)) this.waiting = "";
27724
27756
  if (step.chunk) this.addText(step.chunk.kind, step.chunk.text);
27725
- else if (step.tool) this.trackTool(step.tool.id, step.tool.title, step.tool.status);
27726
- 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);
27727
27761
  else if (step.note) {
27728
27762
  this.blocks.push({ kind: "note", text: step.note });
27729
27763
  this.split = true;
@@ -27741,10 +27775,33 @@ var RemoteLiveView = class {
27741
27775
  const last = this.blocks.at(-1);
27742
27776
  if (last?.kind === "failed")
27743
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);
27744
27780
  const running = this.runningLine();
27745
27781
  if (running) lines.push(running);
27746
27782
  return lines.map(inertAnswer);
27747
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
+ }
27748
27805
  /** The header and the newest part of the turn that fits. */
27749
27806
  render() {
27750
27807
  const body = boundedBody(this.paragraphs(), LIVE_MAX_CHARS2);
@@ -27801,6 +27858,8 @@ var RemoteLiveView = class {
27801
27858
  }
27802
27859
  paragraphs() {
27803
27860
  const out = this.blocks.map((b3) => this.paragraph(b3)).filter((p) => p);
27861
+ const steps = this.stepsLine();
27862
+ if (steps) out.push(steps);
27804
27863
  const running = this.runningLine();
27805
27864
  if (running) out.push(running);
27806
27865
  return out.map(inertAnswer);
@@ -28059,6 +28118,7 @@ var remoteWindowText = defineCatalog({
28059
28118
  sentFromCard: "You sent from the card: ",
28060
28119
  chatBoxCard: (p) => `What you type in the chat box goes to ${p.bot}; to write to this session use the box on this card, or reply quoting this card. To send the chat box to the session instead: /agent mode chat`,
28061
28120
  chatBoxChat: (p) => `What you type goes to this session; messages that start with @${p.bot}, ${p.bot}'s / commands and requests sent on your behalf stay with ${p.bot}. To keep the chat box for ${p.bot}: /agent mode card`,
28121
+ chatBoxGroup: (p) => `In this group, what you say to @${p.bot} goes to this session (other members still talk to ${p.bot}); the box on this card goes there too. To talk to ${p.bot} again, press Back to assistant or say "@${p.bot} back to the assistant".`,
28062
28122
  thisChatToo: " (this chat too, from now on)",
28063
28123
  modeSetCard: (p) => `Done: while a chat is attached, the chat box stays with ${p.bot} and the session card's box goes to the session${p.now}.`,
28064
28124
  modeSetChat: (p) => `Done: while a chat is attached, what you type goes to the session${p.now}. Messages that start with @${p.bot} still come to me.`
@@ -28069,6 +28129,7 @@ var remoteWindowText = defineCatalog({
28069
28129
  sentFromCard: "\u4F60\u4ECE\u5361\u7247\u53D1\u7684\uFF1A",
28070
28130
  chatBoxCard: (p) => `\u5728\u804A\u5929\u6846\u91CC\u6253\u5B57\u662F\u8DDF ${p.bot} \u8BF4\uFF1B\u53D1\u7ED9\u8FD9\u4E2A\u4F1A\u8BDD\u8BF7\u7528\u5361\u7247\u4E0A\u7684\u8F93\u5165\u6846\uFF0C\u6216\u5F15\u7528\u56DE\u590D\u8FD9\u5F20\u5361\u7247\u3002\u60F3\u8BA9\u804A\u5929\u6846\u76F4\u63A5\u53D1\u7ED9\u4F1A\u8BDD\uFF1A/agent mode chat`,
28071
28131
  chatBoxChat: (p) => `\u804A\u5929\u6846\u91CC\u6253\u7684\u5B57\u90FD\u53D1\u7ED9\u8FD9\u4E2A\u4F1A\u8BDD\uFF1B\u4EE5 @${p.bot} \u5F00\u5934\u7684\u6D88\u606F\u3001${p.bot} \u7684 / \u547D\u4EE4\u548C\u534F\u8C03\u8005\u4EE3\u53D1\u7684\u8BF7\u6C42\u4ECD\u7531 ${p.bot} \u5904\u7406\u3002\u60F3\u8BA9\u804A\u5929\u6846\u7559\u7ED9 ${p.bot}\uFF1A/agent mode card`,
28132
+ chatBoxGroup: (p) => `\u5728\u8FD9\u4E2A\u7FA4\u91CC\u4F60 @${p.bot} \u8BF4\u7684\u8BDD\u90FD\u53D1\u7ED9\u8FD9\u4E2A\u4F1A\u8BDD\uFF08\u5176\u4ED6\u4EBA @${p.bot} \u4ECD\u662F\u8DDF ${p.bot} \u8BF4\uFF09\uFF0C\u5361\u7247\u4E0A\u7684\u8F93\u5165\u6846\u4E5F\u53D1\u7ED9\u5B83\u3002\u60F3\u56DE\u5230 ${p.bot}\uFF1A\u70B9\u300C\u56DE\u5230\u52A9\u7406\u300D\uFF0C\u6216\u8BF4\u300C@${p.bot} \u56DE\u5230\u52A9\u7406\u300D\u3002`,
28072
28133
  thisChatToo: "\uFF08\u8FD9\u4E2A\u804A\u5929\u73B0\u5728\u5C31\u6309\u8FD9\u4E2A\u6765\uFF09",
28073
28134
  modeSetCard: (p) => `\u597D\u7684\uFF1A\u63A5\u5165\u4F1A\u8BDD\u540E\uFF0C\u804A\u5929\u6846\u7559\u7ED9 ${p.bot}\uFF0C\u53D1\u7ED9\u4F1A\u8BDD\u7528\u4F1A\u8BDD\u5361\u7247\u4E0A\u7684\u8F93\u5165\u6846${p.now}\u3002`,
28074
28135
  modeSetChat: (p) => `\u597D\u7684\uFF1A\u63A5\u5165\u4F1A\u8BDD\u540E\uFF0C\u804A\u5929\u6846\u91CC\u6253\u7684\u5B57\u90FD\u53D1\u7ED9\u4F1A\u8BDD${p.now}\u3002\u4EE5 @${p.bot} \u5F00\u5934\u7684\u4ECD\u7136\u7ED9\u6211\u3002`
@@ -28120,6 +28181,7 @@ function sentLabel(source, lang) {
28120
28181
  }
28121
28182
  function chatBoxLine(window, lang, bot) {
28122
28183
  const words3 = remoteWindowText.in(lang);
28184
+ if (window === "group") return words3.chatBoxGroup({ bot });
28123
28185
  return window === "card" ? words3.chatBoxCard({ bot }) : words3.chatBoxChat({ bot });
28124
28186
  }
28125
28187
  function modeSetLine(window, lang, attached, bot) {
@@ -28327,12 +28389,12 @@ function actionsOf(input) {
28327
28389
  const words3 = remoteWindowCardText.in(input.lang);
28328
28390
  const session = { session_id: input.sessionId };
28329
28391
  const back = remoteButton(words3.back, "detach", null, session);
28330
- const switchTo = remoteButton(words3.switch, "switch", null, session);
28392
+ const switchTo = input.group ? [] : [remoteButton(words3.switch, "switch", null, session)];
28331
28393
  if (input.phase === "watching") {
28332
28394
  return [
28333
28395
  back,
28334
- switchTo,
28335
- ...input.takeover ? [remoteButton(words3.takeOver, "takeover", null, input.takeover)] : []
28396
+ ...switchTo,
28397
+ ...input.takeover && !input.group ? [remoteButton(words3.takeOver, "takeover", null, input.takeover)] : []
28336
28398
  ];
28337
28399
  }
28338
28400
  const send = takesInput(input.phase) ? [remoteButton(words3.send, "send", "positive", session)] : [];
@@ -28340,7 +28402,7 @@ function actionsOf(input) {
28340
28402
  ...send,
28341
28403
  remoteButton(input.terminal ? words3.stopTerminal : words3.stop, "stop", null, session),
28342
28404
  back,
28343
- switchTo
28405
+ ...switchTo
28344
28406
  ];
28345
28407
  }
28346
28408
  function windowView(input) {
@@ -28361,7 +28423,7 @@ function windowView(input) {
28361
28423
  note: input.view.note ? lit(input.view.note, 300) : null,
28362
28424
  ...approvalsOf(input),
28363
28425
  ...boxOf(input),
28364
- chatBox: chatBoxLine("card", input.lang, input.bot),
28426
+ chatBox: chatBoxLine(input.group ? "group" : "card", input.lang, input.bot),
28365
28427
  updated: words3.updated({ stamp: utcClock(input.at) }),
28366
28428
  actions: actionsOf(input),
28367
28429
  takesInput: takesInput(input.phase)
@@ -28443,6 +28505,14 @@ var remoteAgentText = defineCatalog({
28443
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.`,
28444
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.`,
28445
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.",
28446
28516
  stopFirst: "A task is still running. Send /stop first.",
28447
28517
  notAttached: "You are not attached to a remote session. Start one with `/agent new AGENT PATH`, or `/agent attach N`.",
28448
28518
  approvalInactive: "That approval request is no longer active.",
@@ -28546,6 +28616,8 @@ var remoteAgentText = defineCatalog({
28546
28616
  whichMachineNone: "Which machine? Use `/agent off NAME`. You have no machine connected.",
28547
28617
  notAttachedCard: "You are not attached to a remote session.",
28548
28618
  otherSessionCard: "That card is for another session. This chat is attached to a different one: use its buttons.",
28619
+ groupNotYours: "Only the person who switched this group to the session can use its card.",
28620
+ groupCardOnly: (p) => `In a group, the session card acts only on its session. To switch to another one, say "@${p.bot} switch to the claude session on MACHINE"; the lists of sessions and machines are in a 1:1 chat with me.`,
28549
28621
  pairHead: "To connect a new machine:",
28550
28622
  pairAbove: " the command is in the message above; run it on that machine.",
28551
28623
  emptySend: "Write in the box first, then press Send.",
@@ -28563,6 +28635,10 @@ var remoteAgentText = defineCatalog({
28563
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`,
28564
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`,
28565
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",
28566
28642
  stopFirst: "\u8FD8\u6709\u4EFB\u52A1\u5728\u8FD0\u884C\u3002\u5148\u53D1 /stop\u3002",
28567
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",
28568
28644
  approvalInactive: "\u8FD9\u4E2A\u5BA1\u6279\u8BF7\u6C42\u5DF2\u7ECF\u5931\u6548\u4E86\u3002",
@@ -28671,6 +28747,8 @@ var remoteAgentText = defineCatalog({
28671
28747
  whichMachineNone: "Which machine? Use `/agent off NAME`. You have no machine connected.",
28672
28748
  notAttachedCard: "\u4F60\u8FD8\u6CA1\u6709\u63A5\u5165\u8FDC\u7A0B\u4F1A\u8BDD\u3002",
28673
28749
  otherSessionCard: "\u8FD9\u5F20\u5361\u7247\u5C5E\u4E8E\u53E6\u4E00\u4E2A\u4F1A\u8BDD\u3002\u8FD9\u4E2A\u804A\u5929\u63A5\u5165\u7684\u662F\u522B\u7684\u4F1A\u8BDD\uFF1A\u7528\u90A3\u4E2A\u4F1A\u8BDD\u7684\u6309\u94AE\u3002",
28750
+ groupNotYours: "\u53EA\u6709\u628A\u8FD9\u4E2A\u7FA4\u5207\u5230\u8FD9\u4E2A\u4F1A\u8BDD\u7684\u4EBA\u80FD\u7528\u8FD9\u5F20\u5361\u3002",
28751
+ groupCardOnly: (p) => `\u7FA4\u91CC\u7684\u4F1A\u8BDD\u5361\u53EA\u7BA1\u8FD9\u4E00\u4E2A\u4F1A\u8BDD\u3002\u8981\u6362\u4F1A\u8BDD\uFF0C\u5728\u7FA4\u91CC\u8BF4\u300C@${p.bot} \u5207\u5230 \u673A\u5668\u540D \u4E0A\u7684 claude \u4F1A\u8BDD\u300D\uFF1B\u4F1A\u8BDD\u548C\u673A\u5668\u7684\u5217\u8868\u5728\u548C\u6211\u7684 1:1 \u804A\u5929\u91CC\u3002`,
28674
28752
  pairHead: "\u8FDE\u63A5\u65B0\u673A\u5668\uFF1A",
28675
28753
  pairAbove: "\u547D\u4EE4\u5728\u4E0A\u9762\u7684\u6D88\u606F\u91CC\uFF0C\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C\u5B83\u3002",
28676
28754
  emptySend: "\u5148\u5728\u8F93\u5165\u6846\u91CC\u5199\u597D\uFF0C\u518D\u6309\u53D1\u9001\u3002",
@@ -31889,8 +31967,16 @@ var SessionClicks = class {
31889
31967
  end(click, card, fallback, announce = true) {
31890
31968
  return click.settle(card, { ...fallback ? { fallback } : {}, announce });
31891
31969
  }
31892
- /** End a tap with the card it came from again (the sessions card, or the agents card), `lead` on top. */
31970
+ /**
31971
+ * End a tap with the card it came from again (the sessions card, or the agents card), `lead` on top. In a group the lists are
31972
+ * never shown (they are the presser's own sessions and machines): the tap ends with its line alone.
31973
+ */
31893
31974
  async home(click, lead) {
31975
+ if (isGroupKey(click.chatKey)) {
31976
+ const bot = this.p.ctx.settings.botName;
31977
+ await this.end(click, lead || remoteAgentText.in(this.lang(click)).groupCardOnly({ bot }));
31978
+ return;
31979
+ }
31894
31980
  let view7;
31895
31981
  try {
31896
31982
  if (click.data["view"] === "sessions")
@@ -31952,7 +32038,8 @@ var SessionClicks = class {
31952
32038
  async back(click, lead) {
31953
32039
  const state = this.p.state.attached(click.chatKey);
31954
32040
  const op = textOf6(click.data["op"]);
31955
- if (state !== null && ["detach", "mode", "set_mode", "row", "stop"].includes(op) && state.sessionId === click.data["session_id"]) {
32041
+ if (state !== null && (["detach", "mode", "set_mode", "row", "stop"].includes(op) || isGroupKey(click.chatKey)) && // (a group: never the list)
32042
+ state.sessionId === click.data["session_id"]) {
31956
32043
  await this.end(click, (await this.p.ops.rowCard(click.chatKey, click.key, state, lead)).message, lead);
31957
32044
  return;
31958
32045
  }
@@ -33065,6 +33152,7 @@ function offlineRefusal(error) {
33065
33152
  }
33066
33153
 
33067
33154
  // packages/core/src/remote/turns/chat-turn.ts
33155
+ var REMOTE_EDIT_SECONDS = 3;
33068
33156
  var RemoteStatusPolicy = class {
33069
33157
  constructor(live, cutError, signer) {
33070
33158
  this.live = live;
@@ -33189,7 +33277,8 @@ var ChatTurn = class {
33189
33277
  log: options.log,
33190
33278
  lang: options.lang,
33191
33279
  policy,
33192
- streamReplyTo: options.replyTo
33280
+ streamReplyTo: options.replyTo,
33281
+ editSeconds: REMOTE_EDIT_SECONDS
33193
33282
  });
33194
33283
  }
33195
33284
  surface;
@@ -33264,6 +33353,8 @@ var REMOTE_TURN_DEADLINE_SECONDS = 4 * 3600;
33264
33353
  var RECONNECT_BACKOFF_SECONDS = 1;
33265
33354
  var CURSOR_EVERY2 = 25;
33266
33355
  var STREAM_ATTEMPTS2 = 4;
33356
+ var BUSY_REASONS = /* @__PURE__ */ new Set(["terminal_working", "terminal_waiting"]);
33357
+ var BUSY_TOLD_KEPT = 20;
33267
33358
  var LostConnection = class extends Error {
33268
33359
  name = "LostConnection";
33269
33360
  };
@@ -33284,6 +33375,8 @@ var TurnRunner = class {
33284
33375
  ended;
33285
33376
  show;
33286
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();
33287
33380
  /** Watch the turn that is open on the chat's session. */
33288
33381
  start(request) {
33289
33382
  const turn = newTurn();
@@ -33447,6 +33540,7 @@ var TurnRunner = class {
33447
33540
  }
33448
33541
  const shown3 = step.queued !== null ? { ...step, note: queuedLine(step.queued, this.state.lang(chatKey)) } : step;
33449
33542
  display.progress(shown3);
33543
+ if (step.queued !== null && BUSY_REASONS.has(step.queued)) await this.tellBusy(request, step);
33450
33544
  if (saysModes(step)) this.ctx.remoteState.setRemoteModes(chatKey, sid, step);
33451
33545
  if (step.permission !== null) await this.show(chatKey, sid, step.permission, to);
33452
33546
  if (step.resolved !== null) this.ctx.permissions.closeRemotePermission(sid, actionIdOf(step.resolved), "decided");
@@ -33454,6 +33548,33 @@ var TurnRunner = class {
33454
33548
  await this.sayRecovered(chatKey, to, step.recovered.interrupted, step.recovered.continuing);
33455
33549
  }
33456
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
+ }
33457
33578
  /**
33458
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
33459
33580
  * send has not answered yet has no number to match: the refusal is kept for that send (`Prompts.queueBehind`).
@@ -33587,6 +33708,7 @@ var WindowTurn = class {
33587
33708
  var HANDED_OVER_MAX = 3500;
33588
33709
 
33589
33710
  // packages/core/src/remote/remote-agents.ts
33711
+ var GROUP_OPS = /* @__PURE__ */ new Set(["send", "stop", "detach", "mode", "set_mode", "row", "full", "attach"]);
33590
33712
  var CHAT_CONTEXT_WATCH_SECONDS = 2;
33591
33713
  var RemoteAgents = class {
33592
33714
  chats = new ChatRegistry();
@@ -33819,9 +33941,71 @@ var RemoteAgents = class {
33819
33941
  get clickHandler() {
33820
33942
  return {
33821
33943
  verbs: ["remote", "remote_decision", "remote_off"],
33822
- withCredential: (click, credential2) => this.onClick(click, credential2)
33944
+ withCredential: (click, credential2) => this.onClick(click, credential2),
33945
+ inGroup: (click) => this.onGroupClick(click)
33823
33946
  };
33824
33947
  }
33948
+ /**
33949
+ * A tap on a group's session card (the binding of the presser in that group, keyed as its messages are). Only the binder's own
33950
+ * card answers, and only for what acts on the bound session; the lists of sessions and machines stay in a 1:1 chat. A press
33951
+ * on someone else's card leaves it as it was and says whose it is. False: not a button a group answers (the router's note).
33952
+ */
33953
+ async onGroupClick(route) {
33954
+ if (!this.enabled || route.action.data["primusclaw"] !== "remote") return false;
33955
+ const chatKey = groupChatKey(route.sender.id, route.scope);
33956
+ const data = route.action.data;
33957
+ const op = typeof data["op"] === "string" ? data["op"] : "";
33958
+ if (await this.groupRefused(route, chatKey, op)) return true;
33959
+ const credential2 = route.groupCredential === void 0 ? void 0 : await route.groupCredential();
33960
+ if (!credential2) {
33961
+ await route.settle(routingText.in(this.state.lang(chatKey)).notConnected);
33962
+ return true;
33963
+ }
33964
+ await this.tap({
33965
+ chatKey,
33966
+ key: credential2,
33967
+ provider: void 0,
33968
+ to: route.conversation,
33969
+ tapped: route.action.cardMessageId,
33970
+ data,
33971
+ id: route.action.id,
33972
+ settle: (card, options) => route.settle(card, options)
33973
+ });
33974
+ return true;
33975
+ }
33976
+ /** A group tap that is not the binder's own, or not one a group's card may make: answered here (true), before any key is read. */
33977
+ async groupRefused(route, chatKey, op) {
33978
+ const data = route.action.data;
33979
+ const tapped = route.action.cardMessageId;
33980
+ const words3 = remoteAgentText.in(this.state.lang(chatKey));
33981
+ const state = this.state.attached(chatKey);
33982
+ const own3 = op === "attach" ? tapped !== "" && this.ctx.remoteState.getRemote(chatKey)?.statusCard === tapped : state !== null && state.sessionId === data["session_id"] && data["view"] !== "agents";
33983
+ if (!own3) {
33984
+ const owner = this.ownerOf(route.scope, tapped, chatKey);
33985
+ if (owner !== null) {
33986
+ const card = this.board.statusOf(owner.chatKey, owner.state, this.state.phase(owner.chatKey));
33987
+ await route.settle(card.message, { fallback: words3.groupNotYours });
33988
+ } else await route.settle(state === null ? words3.notAttachedCard : words3.otherSessionCard);
33989
+ return true;
33990
+ }
33991
+ if (GROUP_OPS.has(op)) return false;
33992
+ const line2 = words3.groupCardOnly({ bot: this.ctx.settings.botName });
33993
+ if (state === null) await route.settle(line2);
33994
+ else await route.settle(this.board.statusOf(chatKey, state, this.state.phase(chatKey)).message, { fallback: line2 });
33995
+ return true;
33996
+ }
33997
+ /** The binding in group `scope` whose card `tapped` is, when it is not `presser`'s (null: nobody's now). */
33998
+ ownerOf(scope, tapped, presser) {
33999
+ if (!tapped) return null;
34000
+ for (const chatKey of this.ctx.remoteState.remoteAttachedUsers()) {
34001
+ if (chatKey === presser || chatKey !== groupChatKey(personOf2(chatKey), scope)) continue;
34002
+ const stored2 = this.ctx.remoteState.getRemote(chatKey);
34003
+ const state = this.state.attached(chatKey);
34004
+ if (stored2 === null || state === null) continue;
34005
+ if (stored2.statusCard === tapped || stored2.windowCards.includes(tapped)) return { chatKey, state };
34006
+ }
34007
+ return null;
34008
+ }
33825
34009
  async onClick(route, credential2) {
33826
34010
  const kind = route.action.data["primusclaw"];
33827
34011
  const click = {
@@ -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;
@@ -198,6 +206,10 @@ export declare const remoteAgentText: import("./catalog.js").Catalog<{
198
206
  whichMachineNone: string;
199
207
  notAttachedCard: string;
200
208
  otherSessionCard: string;
209
+ groupNotYours: string;
210
+ groupCardOnly: (p: {
211
+ bot: string;
212
+ }) => string;
201
213
  pairHead: string;
202
214
  pairAbove: string;
203
215
  emptySend: string;
@@ -9,6 +9,9 @@ export declare const remoteWindowText: import("./catalog.js").Catalog<{
9
9
  chatBoxChat: (p: {
10
10
  bot: string;
11
11
  }) => string;
12
+ chatBoxGroup: (p: {
13
+ bot: string;
14
+ }) => string;
12
15
  thisChatToo: string;
13
16
  modeSetCard: (p: {
14
17
  bot: 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;
@@ -46,6 +46,11 @@ export interface ClickRoute extends RouteBase {
46
46
  * edit once the outcome was said.
47
47
  */
48
48
  settle(card: OutMessage | string, options?: SettleOptions): Promise<boolean>;
49
+ /**
50
+ * In a group chat: the presser's credential, read as their @-messages in that group read it (undefined: none, or not just
51
+ * now). Read only when needed; never asks the person to connect. Absent in a 1:1 chat (`withCredential` is given it).
52
+ */
53
+ readonly groupCredential?: () => Promise<string | undefined>;
49
54
  }
50
55
  /** A message read before the router's own reading of it. */
51
56
  export interface MessageInterceptor {
@@ -26,7 +26,10 @@ export declare class SessionClicks {
26
26
  constructor(p: CommandParts, commands: AgentCommands, prompts: Prompts);
27
27
  lang(click: Click): Lang;
28
28
  end(click: Click, card: OutMessage | string, fallback?: string, announce?: boolean): Promise<boolean>;
29
- /** End a tap with the card it came from again (the sessions card, or the agents card), `lead` on top. */
29
+ /**
30
+ * End a tap with the card it came from again (the sessions card, or the agents card), `lead` on top. In a group the lists are
31
+ * never shown (they are the presser's own sessions and machines): the tap ends with its line alone.
32
+ */
30
33
  home(click: Click, lead: string): Promise<void>;
31
34
  /**
32
35
  * A tap on the agents card (or the sessions card) that leaves the chat where it is ends with that card again, sent as a NEW
@@ -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"`). */
@@ -75,6 +75,16 @@ export declare class RemoteAgents implements RemoteChat {
75
75
  cancelAll(): void;
76
76
  /** The click handler of the remote-agent cards: the agents and sessions cards, the status card, approvals, disconnect. */
77
77
  get clickHandler(): ClickHandler;
78
+ /**
79
+ * A tap on a group's session card (the binding of the presser in that group, keyed as its messages are). Only the binder's own
80
+ * card answers, and only for what acts on the bound session; the lists of sessions and machines stay in a 1:1 chat. A press
81
+ * on someone else's card leaves it as it was and says whose it is. False: not a button a group answers (the router's note).
82
+ */
83
+ private onGroupClick;
84
+ /** A group tap that is not the binder's own, or not one a group's card may make: answered here (true), before any key is read. */
85
+ private groupRefused;
86
+ /** The binding in group `scope` whose card `tapped` is, when it is not `presser`'s (null: nobody's now). */
87
+ private ownerOf;
78
88
  private onClick;
79
89
  /** A click on an option of a permission card (on the session card, the window stays the card). */
80
90
  private decide;
@@ -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;
@@ -10,7 +10,8 @@ export interface GroupWords {
10
10
  /**
11
11
  * A group chat bound to one of the sender's agent sessions (one group, one session at a time; the Python
12
12
  * `Agent._group_remote`). "切到 X 上的 claude" (`/agent attach REF`) binds the group for the sender, "回到助理"
13
- * (`/agent detach`) unbinds it; while bound, the sender's @-messages go to that session and "停掉它" stops its turn. The
13
+ * (`/agent detach`) unbinds it; while bound, the sender's @-messages go to that session (whether the session card is the
14
+ * window or not) and "停掉它" stops its turn. The
14
15
  * binding is the sender's own: another member's message is never read by it. False: not a message about the binding.
15
16
  */
16
17
  export declare class GroupRemote {
@@ -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.1",
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": {