@primusclaw/personal-agent 0.10.2 → 0.10.4

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
@@ -3994,7 +3994,14 @@ var assistantActionText = defineCatalog({
3994
3994
  sent: (p) => `Sent to ${p.agent} on ${p.machine}${p.seq ? ` as #${p.seq}` : ""}. I will tell you when it is done or needs your approval.`,
3995
3995
  notSent: "OK, not sent.",
3996
3996
  sendExpired: "That card has expired; nothing was sent. Ask me again if you want it.",
3997
- notSentWhy: (p) => `It could not be sent (${p.why}).`
3997
+ notSentWhy: (p) => `It could not be sent (${p.why}).`,
3998
+ githubMerged: "Merged.",
3999
+ githubQueued: "Put in the merge queue; it merges once its checks pass.",
4000
+ githubApproved: "Approval posted.",
4001
+ githubNotMerged: "OK, not merged.",
4002
+ githubNotApproved: "OK, the approval was not posted.",
4003
+ githubStale: "The pull request got new commits since, so nothing was done. Ask me to review it again.",
4004
+ githubRetry: "PrimusClaw could not try it just now, and it still waits for you. Press it again in a moment."
3998
4005
  },
3999
4006
  zh: {
4000
4007
  ...buttons,
@@ -4016,7 +4023,14 @@ var assistantActionText = defineCatalog({
4016
4023
  sent: (p) => `\u5DF2\u53D1\u7ED9 ${p.machine} \u4E0A\u7684 ${p.agent}${p.seq ? `\uFF08#${p.seq}\uFF09` : ""}\u3002\u505A\u5B8C\u6216\u9700\u8981\u4F60\u6279\u51C6\u65F6\u6211\u4F1A\u544A\u8BC9\u4F60\u3002`,
4017
4024
  notSent: "\u597D\u7684\uFF0C\u6CA1\u6709\u53D1\u9001\u3002",
4018
4025
  sendExpired: "\u8FD9\u5F20\u5361\u5DF2\u8FC7\u671F\uFF0C\u4EC0\u4E48\u90FD\u6CA1\u53D1\u3002\u9700\u8981\u7684\u8BDD\u8BF7\u518D\u8DDF\u6211\u8BF4\u4E00\u6B21\u3002",
4019
- notSentWhy: (p) => `\u6CA1\u80FD\u53D1\u9001\uFF08${p.why}\uFF09\u3002`
4026
+ notSentWhy: (p) => `\u6CA1\u80FD\u53D1\u9001\uFF08${p.why}\uFF09\u3002`,
4027
+ githubMerged: "\u5DF2\u5408\u5165\u3002",
4028
+ githubQueued: "\u5DF2\u653E\u8FDB\u5408\u5E76\u961F\u5217\uFF0C\u68C0\u67E5\u901A\u8FC7\u540E\u5408\u5165\u3002",
4029
+ githubApproved: "\u6279\u51C6\u5DF2\u53D1\u51FA\u3002",
4030
+ githubNotMerged: "\u597D\u7684\uFF0C\u6CA1\u6709\u5408\u5165\u3002",
4031
+ githubNotApproved: "\u597D\u7684\uFF0C\u6CA1\u6709\u53D1\u51FA\u6279\u51C6\u3002",
4032
+ githubStale: "\u8FD9\u4E2A PR \u4E4B\u540E\u6709\u4E86\u65B0\u63D0\u4EA4\uFF0C\u6240\u4EE5\u4EC0\u4E48\u90FD\u6CA1\u505A\u3002\u9700\u8981\u7684\u8BDD\u8BA9\u6211\u518D\u5BA1\u4E00\u6B21\u3002",
4033
+ githubRetry: "PrimusClaw \u6682\u65F6\u6CA1\u80FD\u6267\u884C\uFF0C\u5B83\u8FD8\u5728\u7B49\u4F60\u786E\u8BA4\uFF0C\u8BF7\u8FC7\u4E00\u4F1A\u513F\u518D\u6309\u4E00\u6B21\u3002"
4020
4034
  }
4021
4035
  });
4022
4036
 
@@ -7153,6 +7167,7 @@ var StatusMessage = class {
7153
7167
  policy;
7154
7168
  lead;
7155
7169
  group;
7170
+ editSeconds;
7156
7171
  /** undefined: the progress message (no stream here, or the chat refused it). */
7157
7172
  stream;
7158
7173
  /** The stream itself, kept after a refusal: it is still closed when it can be. */
@@ -7182,6 +7197,8 @@ var StatusMessage = class {
7182
7197
  streamOver = false;
7183
7198
  /** The turn was cancelled (`close(true)`). */
7184
7199
  hard = false;
7200
+ /** The answer is on its way (`finish`): the progress message is the answer's to retire. */
7201
+ finishing = false;
7185
7202
  constructor(surface, options) {
7186
7203
  this.surface = surface;
7187
7204
  this.clock = options.clock;
@@ -7192,6 +7209,7 @@ var StatusMessage = class {
7192
7209
  this.stream = options.streamReplyTo ? new StreamHandle(surface, options.streamReplyTo, options.clock) : void 0;
7193
7210
  this.live = this.stream;
7194
7211
  this.group = options.group ?? false;
7212
+ this.editSeconds = Math.max(options.editSeconds ?? LIVE_MIN_INTERVAL, LIVE_MIN_INTERVAL);
7195
7213
  }
7196
7214
  begin() {
7197
7215
  this.begunAt = nowSeconds(this.clock);
@@ -7373,7 +7391,7 @@ ${line2}` : line2));
7373
7391
  }
7374
7392
  const messageId = await this.messageId(signal);
7375
7393
  while (messageId && !this.closed) {
7376
- const wait = Math.max(this.lastAt, this.begunAt) + LIVE_MIN_INTERVAL - nowSeconds(this.clock);
7394
+ const wait = Math.max(this.lastAt, this.begunAt) + this.editSeconds - nowSeconds(this.clock);
7377
7395
  if (wait > 0) {
7378
7396
  await sleepSeconds(this.clock, wait, signal);
7379
7397
  continue;
@@ -7434,32 +7452,48 @@ ${line2}` : line2));
7434
7452
  }
7435
7453
  /**
7436
7454
  * Stop sending progress. A sleeping flusher is cancelled; one that is mid-send finishes that one send, unless the turn
7437
- * itself was cancelled (`hard`). A stream still open when the turn is cancelled is closed with INTERRUPTED, in the
7438
- * background (the floating status must not spin until the chat's limit).
7455
+ * itself was cancelled (`hard`). When the turn is cancelled, what shows it is ended in the background: a stream still open
7456
+ * is closed with INTERRUPTED (the floating status must not spin until the chat's limit), and the progress message is
7457
+ * retired (no answer follows it, so it must not stay in the chat as stale progress).
7439
7458
  */
7440
7459
  close(hard = false) {
7441
7460
  this.closed = true;
7442
- this.hard = this.hard || hard;
7443
7461
  this.stopPreparingTimer();
7444
7462
  if (this.flusher && !this.flusher.done && (hard || !this.sending)) this.flusher.cancel();
7445
- if (hard) for (const task of [this.again, this.expiry, this.choice]) task?.cancel();
7446
- if (hard && this.live?.closable && !this.streamOver) {
7463
+ if (hard) this.cancelled();
7464
+ }
7465
+ /** The turn was cancelled: nothing more is repeated, and what shows it is ended (the first time only). */
7466
+ cancelled() {
7467
+ const first = !this.hard;
7468
+ this.hard = true;
7469
+ for (const task of [this.again, this.expiry, this.choice]) task?.cancel();
7470
+ if (this.live?.closable && !this.streamOver) {
7447
7471
  this.streamOver = true;
7448
7472
  const live = this.live;
7449
7473
  detach(() => this.interrupt(live));
7450
7474
  }
7475
+ if (first && this.posted && !this.finishing) detach(() => this.retireCancelled());
7451
7476
  }
7452
7477
  async interrupt(stream) {
7453
7478
  const closed = await stream.final(plainMessage(turnText.in(this.lang).interrupted));
7454
7479
  if (!closed.ok)
7455
7480
  this.log.warn("the stream of a cancelled turn could not be closed; the chat closes it at its limit");
7456
7481
  }
7482
+ /**
7483
+ * The turn was cancelled with its progress message on screen: no answer follows to replace it, so it is retired here
7484
+ * (deleted, or edited down to INTERRUPTED where the chat will not delete it). Never fails the turn.
7485
+ */
7486
+ async retireCancelled() {
7487
+ const messageId = await this.messageId();
7488
+ if (messageId) await this.retire(messageId, plainMessage(turnText.in(this.lang).interrupted));
7489
+ }
7457
7490
  /**
7458
7491
  * The turn is over: the user gets `parts`, in order. With a stream the first part is its final message (in the place
7459
7492
  * of the status) and the others follow; without one they are NEW messages, and the progress message is then retired.
7460
7493
  * The thumbs (`feedback`) and suggested replies go under the LAST part, and nowhere else.
7461
7494
  */
7462
7495
  async finish(parts2, options = {}) {
7496
+ this.finishing = true;
7463
7497
  await this.quiesce();
7464
7498
  const messages = answerMessages(parts2, options);
7465
7499
  if (this.stream && this.stream.open && !this.streamOver) {
@@ -7525,10 +7559,11 @@ ${line2}` : line2));
7525
7559
  if (wait > 0) await sleepSeconds(this.clock, wait);
7526
7560
  }
7527
7561
  /**
7528
- * The answer is posted below: delete the progress message. The chat may refuse, and a queue cannot delete; the message
7529
- * is then edited down to one line, so it does not sit above the answer as stale progress. Never fails the turn.
7562
+ * The answer is posted below, or none will come (the turn was cancelled): delete the progress message. The chat may
7563
+ * refuse, and a queue cannot delete; the message is then edited down to one line (`line`), so it does not sit in the
7564
+ * chat as stale progress. Never fails the turn.
7530
7565
  */
7531
- async retire(messageId) {
7566
+ async retire(messageId, line2 = plainMessage(turnEnglish.doneLine)) {
7532
7567
  await this.settle();
7533
7568
  let removed;
7534
7569
  try {
@@ -7539,9 +7574,8 @@ ${line2}` : line2));
7539
7574
  }
7540
7575
  if (removed) return;
7541
7576
  this.log.warn("the progress message was not deleted; leaving it as one line");
7542
- const done = plainMessage(turnEnglish.doneLine);
7543
- await this.update(messageId, done);
7544
- this.reassert(messageId, done);
7577
+ await this.update(messageId, line2);
7578
+ this.reassert(messageId, line2);
7545
7579
  }
7546
7580
  /** Live edits went out, so one may still arrive after `message` replaced the progress message: send it once more. */
7547
7581
  reassert(messageId, message) {
@@ -16567,9 +16601,35 @@ function skillSaveOutcome(status, out, lang) {
16567
16601
  if (status === "expired") return t4.expired;
16568
16602
  return s.refused({ why: or(result["message"], or(result["error"], status)) });
16569
16603
  }
16604
+ function isGithubWrite(kind) {
16605
+ return kind === "github_merge" || kind === "github_review";
16606
+ }
16607
+ function githubWriteOutcome(kind, out, lang) {
16608
+ const t4 = assistantActionText.in(lang);
16609
+ const merge = kind === "github_merge";
16610
+ switch (or(out["status"], "")) {
16611
+ case "merged":
16612
+ return t4.githubMerged;
16613
+ case "queued":
16614
+ return t4.githubQueued;
16615
+ case "submitted":
16616
+ return t4.githubApproved;
16617
+ case "denied":
16618
+ return merge ? t4.githubNotMerged : t4.githubNotApproved;
16619
+ case "stale":
16620
+ return t4.githubStale;
16621
+ case "expired":
16622
+ return t4.expired;
16623
+ case "retry":
16624
+ return t4.githubRetry;
16625
+ default:
16626
+ return t4.notDone({ why: or(out["reason"], or(out["status"], "?")) });
16627
+ }
16628
+ }
16570
16629
  function confirmOutcome(kind, out, lang) {
16571
16630
  const t4 = assistantActionText.in(lang);
16572
16631
  const status = or(out["status"], "");
16632
+ if (isGithubWrite(kind)) return githubWriteOutcome(kind, out, lang);
16573
16633
  const create2 = kind === "trigger_create";
16574
16634
  if (kind === "devenv_send") return devenvSendOutcome(status, out, lang);
16575
16635
  if (kind === "devenv_hide") return devenvHideOutcome(status, out, lang);
@@ -16710,6 +16770,11 @@ var AssistantActions = class {
16710
16770
  await this.notAnswered(click, card, error);
16711
16771
  return;
16712
16772
  }
16773
+ if (isGithubWrite(card.kind) && pyStr(out["status"]) === "retry") {
16774
+ store.assistantButtons.moveConfirmCard(card.cardId, "open");
16775
+ await this.again(click, card, confirmOutcome(card.kind, out, click.lang()));
16776
+ return;
16777
+ }
16713
16778
  store.assistantButtons.moveConfirmCard(card.cardId, "done");
16714
16779
  await finish(click, confirmOutcome(card.kind, out, click.lang()));
16715
16780
  }
@@ -17829,7 +17894,9 @@ var CONFIRM_KINDS = [
17829
17894
  "devenv_send",
17830
17895
  "github_comment",
17831
17896
  "devenv_hide",
17832
- "skill_save"
17897
+ "skill_save",
17898
+ "github_merge",
17899
+ "github_review"
17833
17900
  ];
17834
17901
  var ASSISTANT_SUGGESTED_REPLIES = {
17835
17902
  zh: [
@@ -19049,6 +19116,8 @@ var remoteText = defineCatalog({
19049
19116
  liveHeader: (p) => `Working on it (${p.label})...`,
19050
19117
  aStep: "a step",
19051
19118
  stepFailed: (p) => `\u26A0\uFE0F ${p.title} failed, continuing`,
19119
+ /** The steps of the turn so far, by tool (`Bash ×3, Read ×2`). */
19120
+ stepsSoFar: (p) => `Working: ${p.tools}`,
19052
19121
  anAction: "an action",
19053
19122
  approvalNeeded: (p) => `Approval needed: ${p.tool}`,
19054
19123
  agentOnHost: (p) => `${p.agent} on ${p.host}`,
@@ -19215,6 +19284,9 @@ ${p.quoted}`,
19215
19284
  unsolicitedOwn: (p) => `**${p.label}**, on its own:`,
19216
19285
  unattendedNote: "Unattended: runs without asking for approval",
19217
19286
  noAsk: (p) => `\u26A0\uFE0F This terminal is in ${p.name} mode: what you send from here runs at once, with no approval card.`,
19287
+ dialogAsks: (p) => `\u23F3 The terminal is waiting for your confirmation: ${p.what}`,
19288
+ dialogAsksBare: "\u23F3 The terminal is waiting for your confirmation",
19289
+ rowUnreadable: "\u2139\uFE0F Claude Code's session record for this terminal cannot be read, so the connector recognizes the session only by the name on its input box, and a confirmation on the screen hides it. Exit Claude Code there and reopen this conversation with `claude --resume`: then it is recognized reliably.",
19218
19290
  noTextOutput: "Done. There was no text output.",
19219
19291
  answerShortened: "\n\n... (shortened: ask the agent to continue, or read the rest on your machine)",
19220
19292
  pairBody: (p) => `On the machine you want to connect, open a terminal in the folder the agents may work in and run this one line (it works once, within ${p.minutes} minutes):
@@ -19229,6 +19301,7 @@ It installs the connector, pairs the machine with you and keeps it running. I wi
19229
19301
  liveHeader: (p) => `\u6B63\u5728\u5904\u7406\uFF08${p.label}\uFF09\u2026`,
19230
19302
  aStep: "\u4E00\u4E2A\u6B65\u9AA4",
19231
19303
  stepFailed: (p) => `\u26A0\uFE0F ${p.title} \u5931\u8D25\u4E86\uFF0C\u7EE7\u7EED\u6267\u884C`,
19304
+ stepsSoFar: (p) => `\u6B63\u5728\uFF1A${p.tools}`,
19232
19305
  anAction: "\u4E00\u4E2A\u64CD\u4F5C",
19233
19306
  approvalNeeded: (p) => `\u9700\u8981\u6279\u51C6\uFF1A${p.tool}`,
19234
19307
  agentOnHost: (p) => `${p.host} \u4E0A\u7684 ${p.agent}`,
@@ -19395,6 +19468,9 @@ ${p.quoted}`,
19395
19468
  unsolicitedOwn: (p) => `**${p.label}**\uFF0C\u81EA\u5DF1\u8BF4\u7684\uFF1A`,
19396
19469
  unattendedNote: "\u26A0\uFE0F \u65E0\u4EBA\u503C\u5B88\uFF1A\u6267\u884C\u524D\u4E0D\u4F1A\u8BF7\u6C42\u6279\u51C6",
19397
19470
  noAsk: (p) => `\u26A0\uFE0F \u8FD9\u4E2A\u7EC8\u7AEF\u662F ${p.name} \u6A21\u5F0F\uFF1A\u624B\u673A\u53D1\u7684\u6307\u4EE4\u4F1A\u76F4\u63A5\u6267\u884C\uFF0C\u4E0D\u4F1A\u518D\u5F39\u5BA1\u6279\u5361\u3002`,
19471
+ dialogAsks: (p) => `\u23F3 \u7EC8\u7AEF\u5728\u7B49\u4F60\u786E\u8BA4\uFF1A${p.what}`,
19472
+ dialogAsksBare: "\u23F3 \u7EC8\u7AEF\u5728\u7B49\u4F60\u786E\u8BA4",
19473
+ rowUnreadable: "\u2139\uFE0F \u8FD9\u4E2A\u7EC8\u7AEF\u91CC Claude Code \u7684\u4F1A\u8BDD\u767B\u8BB0\u8BFB\u4E0D\u51FA\u6765\uFF0C\u8FDE\u63A5\u5668\u53EA\u80FD\u9760\u8F93\u5165\u6846\u4E0A\u7684\u4F1A\u8BDD\u540D\u8BA4\u51FA\u5B83\uFF0C\u7EC8\u7AEF\u5F39\u51FA\u786E\u8BA4\u65F6\u5C31\u8BA4\u4E0D\u51FA\u4E86\u3002\u5728\u7EC8\u7AEF\u91CC\u9000\u51FA Claude Code\uFF0C\u518D\u7528 `claude --resume` \u91CD\u65B0\u6253\u5F00\u8FD9\u6BB5\u4F1A\u8BDD\uFF0C\u4E4B\u540E\u5C31\u80FD\u7A33\u5B9A\u8BC6\u522B\u3002",
19398
19474
  noTextOutput: "\u5B8C\u6210\u4E86\uFF0C\u6CA1\u6709\u6587\u5B57\u8F93\u51FA\u3002",
19399
19475
  answerShortened: "\n\n\u2026\u2026\uFF08\u5DF2\u622A\u65AD\uFF1A\u8BA9 agent \u63A5\u7740\u8BF4\uFF0C\u6216\u5728\u4F60\u7684\u673A\u5668\u4E0A\u770B\u5176\u4F59\u90E8\u5206\uFF09",
19400
19476
  pairBody: (p) => `\u5728\u8981\u8FDE\u63A5\u7684\u673A\u5668\u4E0A\u6253\u5F00\u7EC8\u7AEF\uFF0C\u8FDB\u5165 agent \u53EF\u4EE5\u5DE5\u4F5C\u7684\u76EE\u5F55\uFF0C\u8FD0\u884C\u4E0B\u9762\u8FD9\u4E00\u884C\uFF08${p.minutes} \u5206\u949F\u5185\u6709\u6548\uFF0C\u53EA\u80FD\u7528\u4E00\u6B21\uFF09\uFF1A
@@ -19438,7 +19514,7 @@ var remoteQueuedText = defineCatalog({
19438
19514
  en: {
19439
19515
  terminalWorking: "Queued",
19440
19516
  terminalWaiting: "Needs confirm",
19441
- terminalDialog: "Dialog open",
19517
+ terminalDialog: "Confirm there",
19442
19518
  terminalTyping: "Box in use",
19443
19519
  terminalScrolled: "Scrolled back",
19444
19520
  other: "Waiting"
@@ -19446,7 +19522,7 @@ var remoteQueuedText = defineCatalog({
19446
19522
  zh: {
19447
19523
  terminalWorking: "\u5DF2\u6392\u961F",
19448
19524
  terminalWaiting: "\u5F85\u786E\u8BA4",
19449
- terminalDialog: "\u7B49\u5F39\u7A97",
19525
+ terminalDialog: "\u7B49\u4F60\u786E\u8BA4",
19450
19526
  terminalTyping: "\u8F93\u5165\u6846\u5FD9",
19451
19527
  terminalScrolled: "\u56DE\u6EDA\u4E2D",
19452
19528
  other: "\u7B49\u7EC8\u7AEF"
@@ -21797,7 +21873,12 @@ function githubConfirmButtons(confirmationId, review, lang = "zh") {
21797
21873
  var TYPED_MODE_HINT = "\u6309\u94AE\u70B9\u4E0D\u4E86\u65F6\uFF0C\u76F4\u63A5\u56DE\u590D\u300C\u786E\u8BA4\u5168\u81EA\u52A8\u300D\u6216\u300C\u786E\u8BA4\u9AD8\u98CE\u9669\u518D\u95EE\u6211\u300D\u5373\u53EF\u3002 / If the buttons do not work, reply \u786E\u8BA4\u5168\u81EA\u52A8 or \u786E\u8BA4\u9AD8\u98CE\u9669\u518D\u95EE\u6211.";
21798
21874
  var REVIEW_MODES = {
21799
21875
  high_risk_confirm: ["\u9AD8\u98CE\u9669\u4EBA\u5DE5\u518D\u786E\u8BA4\u4E00\u6B21\uFF08\u9ED8\u8BA4\uFF09", "A person confirms high-risk changes (default)"],
21800
- fully_auto: ["\u5168\u81EA\u52A8\u5408\u5165\uFF0C\u65E0\u9700\u4EBA\u5DE5\u786E\u8BA4", "Fully automatic merge, nobody is asked to confirm"]
21876
+ // (not "nobody is asked": a repository that asks for a person still holds a merge under it, and since 2026-11-18 a review the person
21877
+ // asks for in the chat merges unasked too)
21878
+ fully_auto: [
21879
+ "\u5168\u81EA\u52A8\u5408\u5165\uFF08\u4ED3\u5E93\u81EA\u8EAB\u8981\u6C42\u7684\u68C0\u67E5\u4ECD\u7136\u751F\u6548\uFF09",
21880
+ "Fully automatic merge (the repository's own requirements still apply)"
21881
+ ]
21801
21882
  };
21802
21883
 
21803
21884
  // packages/core/src/review/review-turn.ts
@@ -26442,6 +26523,7 @@ __export(remote_exports, {
26442
26523
  SUBFOLDER_MAX: () => SUBFOLDER_MAX,
26443
26524
  TAKEOVER_STATES: () => TAKEOVER_STATES,
26444
26525
  TERMINAL_CLOSED: () => TERMINAL_CLOSED,
26526
+ TERMINAL_INPUT_UNCONFIRMED: () => TERMINAL_INPUT_UNCONFIRMED,
26445
26527
  THOUGHT_MAX: () => THOUGHT_MAX,
26446
26528
  TOOL_TITLE_MAX: () => TOOL_TITLE_MAX,
26447
26529
  TYPED_CHARS_MAX: () => TYPED_CHARS_MAX,
@@ -26493,12 +26575,14 @@ __export(remote_exports, {
26493
26575
  placeOf: () => placeOf,
26494
26576
  plain: () => plain3,
26495
26577
  queuedLine: () => queuedLine,
26578
+ queuedNote: () => queuedNote,
26496
26579
  readOnlyRefused: () => readOnlyRefused,
26497
26580
  recoveredLine: () => recoveredLine,
26498
26581
  remoteButton: () => remoteButton,
26499
26582
  remoteData: () => remoteData,
26500
26583
  remoteStep: () => remoteStep,
26501
26584
  resumableOf: () => resumableOf,
26585
+ rowUnreadableLine: () => rowUnreadableLine,
26502
26586
  sessionFacts: () => sessionFacts,
26503
26587
  sessionPageUrl: () => sessionPageUrl,
26504
26588
  sessionTitle: () => sessionTitle,
@@ -26514,6 +26598,7 @@ __export(remote_exports, {
26514
26598
  typesInto: () => typesInto,
26515
26599
  unattendedAllowed: () => unattendedAllowed,
26516
26600
  unsolicitedParts: () => unsolicitedParts,
26601
+ unwrapPasted: () => unwrapPasted,
26517
26602
  watchesLive: () => watchesLive,
26518
26603
  whereLine: () => whereLine,
26519
26604
  withdraws: () => withdraws
@@ -26689,6 +26774,7 @@ function hiddenOf(agent) {
26689
26774
 
26690
26775
  // packages/core/src/remote/events.ts
26691
26776
  import { z as z8 } from "zod";
26777
+ var DIALOG_MAX = 120;
26692
26778
  var NOTHING2 = Object.freeze({
26693
26779
  chunk: null,
26694
26780
  tool: null,
@@ -26710,6 +26796,12 @@ var NOTHING2 = Object.freeze({
26710
26796
  readOnly: null,
26711
26797
  recovered: null,
26712
26798
  queued: null,
26799
+ dialog: null,
26800
+ waitLine: null,
26801
+ rowUnreadable: false,
26802
+ queuedFor: null,
26803
+ queuedSeq: null,
26804
+ queuedHeld: false,
26713
26805
  typed: null,
26714
26806
  terminal: null,
26715
26807
  terminalMode: null,
@@ -26802,15 +26894,44 @@ function chunk(payload, kind) {
26802
26894
  if (!text8) return NOTHING2;
26803
26895
  return remoteStep({ chunk: { kind: kind === "agent_message_chunk" ? "message" : "thought", text: text8 } });
26804
26896
  }
26897
+ var PASTED_BLOCK = /\n*<pasted_content id="([^"\s<>]{1,64})">\n([\s\S]*?)\n<\/pasted_content id="\1">\n*/gu;
26898
+ function unwrapPasted(text8) {
26899
+ if (!text8.includes("<pasted_content ")) return text8;
26900
+ return text8.replace(PASTED_BLOCK, (whole4, _id, inner, at, all) => {
26901
+ const end = at + whole4.length;
26902
+ return `${at > 0 ? "\n" : ""}${inner}${end < all.length ? "\n" : ""}`;
26903
+ });
26904
+ }
26805
26905
  function typed(payload) {
26806
- const text8 = pyStrip(textOf5(payload));
26906
+ const text8 = pyStrip(unwrapPasted(textOf5(payload)));
26807
26907
  return text8 && !NOT_TYPED.test(text8) ? remoteStep({ typed: text8 }) : NOTHING2;
26808
26908
  }
26909
+ var TOOL_NAME = /^[A-Za-z][\w.-]{0,63}$/u;
26910
+ function toolNameOf(u) {
26911
+ const meta = record5(record5(u["_meta"])["claudeCode"]);
26912
+ const named2 = str6(meta["toolName"]);
26913
+ if (TOOL_NAME.test(named2)) return named2;
26914
+ const head = str6(u["title"]).split(": ", 1)[0] ?? "";
26915
+ return head !== str6(u["title"]) && TOOL_NAME.test(head) ? head : "";
26916
+ }
26809
26917
  function tool(payload, kind) {
26810
26918
  const u = update(payload);
26811
26919
  const id = str6(u["toolCallId"]) || str6(u["tool_call_id"]) || str6(u["id"]);
26812
26920
  const status = str6(u["status"]) || (kind === "tool_call" ? "pending" : "");
26813
- return remoteStep({ tool: { id, title: str6(u["title"]), status } });
26921
+ const name = toolNameOf(u);
26922
+ return remoteStep({ tool: { id, title: str6(u["title"]), status, ...name ? { name } : {} } });
26923
+ }
26924
+ function terminalQueued(payload) {
26925
+ const seq = seqOf(payload["cmd_seq"]);
26926
+ const forId = neutral2(str6(payload["cmd_id"]), 80) || (seq !== null ? String(seq) : "");
26927
+ return remoteStep({
26928
+ queued: str6(payload["reason"]) || "terminal_working",
26929
+ queuedFor: forId || null,
26930
+ queuedSeq: seq,
26931
+ queuedHeld: payload["held"] === "terminal",
26932
+ dialog: neutral2(str6(payload["dialog"]), DIALOG_MAX) || null,
26933
+ rowUnreadable: payload["registry_row_unreadable"] === true
26934
+ });
26814
26935
  }
26815
26936
  function turnEnd(payload, _kind, errors) {
26816
26937
  let reason = str6(payload["stopReason"]) || "end_turn";
@@ -26836,7 +26957,8 @@ function sessionStarted(payload) {
26836
26957
  readOnly: flag2(payload["read_only"]) ?? false,
26837
26958
  terminal: payload["input"] === "terminal",
26838
26959
  terminalMode: neutral2(str6(payload["terminal_mode"]), 40) || null,
26839
- acp: neutral2(str6(payload["acp_session_id"]), RESUME_REF_MAX) || null
26960
+ acp: neutral2(str6(payload["acp_session_id"]), RESUME_REF_MAX) || null,
26961
+ rowUnreadable: payload["registry_row_unreadable"] === true
26840
26962
  });
26841
26963
  }
26842
26964
  function modeUpdate(payload) {
@@ -26903,7 +27025,7 @@ var READERS = {
26903
27025
  session_error: failed2,
26904
27026
  turn_error: failed2,
26905
27027
  // (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" })
27028
+ terminal_input_queued: terminalQueued
26907
27029
  };
26908
27030
  function decode(event, errors) {
26909
27031
  const payload = record5(event.data["data"]);
@@ -26983,6 +27105,7 @@ var DELIVERY_UNCONFIRMED = "delivery_unconfirmed";
26983
27105
  var READ_ONLY_REASONS = ["read_only_live_session", "session_read_only"];
26984
27106
  var TERMINAL_CLOSED = "terminal_closed";
26985
27107
  var CONNECTOR_RESTARTED = "connector_restarted";
27108
+ var TERMINAL_INPUT_UNCONFIRMED = "terminal_input_unconfirmed";
26986
27109
  var NO_ASK_MODES = {
26987
27110
  bypassPermissions: "bypass permissions",
26988
27111
  auto: "auto",
@@ -27039,6 +27162,15 @@ function queuedLine(reason, lang) {
27039
27162
  const key = QUEUED_KEYS.get(reason);
27040
27163
  return `\u23F3 ${key ? words3[key] : words3.other}`;
27041
27164
  }
27165
+ function queuedNote(reason, dialog, lang) {
27166
+ if (reason !== "terminal_dialog") return queuedLine(reason, lang);
27167
+ const words3 = remoteText.in(lang);
27168
+ const what = dialog ? neutral2(masked2(dialog), 120) : "";
27169
+ return what ? words3.dialogAsks({ what }) : words3.dialogAsksBare;
27170
+ }
27171
+ function rowUnreadableLine(lang) {
27172
+ return remoteText.in(lang).rowUnreadable;
27173
+ }
27042
27174
  function readOnlyRefused(lang, takeover = false) {
27043
27175
  const words3 = remoteText.in(lang);
27044
27176
  return words3.readOnly + (takeover ? words3.readOnlyTakeoverTail : "");
@@ -27271,6 +27403,7 @@ __export(remote_view_exports, {
27271
27403
  RUNNING_MARK: () => RUNNING_MARK2,
27272
27404
  RemoteLiveView: () => RemoteLiveView,
27273
27405
  SENT_SHOWN_CHARS: () => SENT_SHOWN_CHARS,
27406
+ STEPS_LINE_TOOLS: () => STEPS_LINE_TOOLS,
27274
27407
  TAIL_CHARS: () => TAIL_CHARS,
27275
27408
  TAIL_LINES: () => TAIL_LINES,
27276
27409
  TERMINAL_CARD_BYTES: () => TERMINAL_CARD_BYTES,
@@ -27669,6 +27802,8 @@ function hiddenView(connector, now, lang = "en") {
27669
27802
  var LIVE_MAX_CHARS2 = 2500;
27670
27803
  var LIVE_KEEP_BLOCKS2 = 40;
27671
27804
  var RUNNING_MARK2 = "\u23F3";
27805
+ var STEPS_LINE_TOOLS = 4;
27806
+ var COUNTED_KEEP = 2e3;
27672
27807
  var STYLE_CHARS = /[*_`~]/g;
27673
27808
  function boundedBody(paragraphs, budget) {
27674
27809
  let body = "";
@@ -27710,6 +27845,10 @@ var RemoteLiveView = class {
27710
27845
  active = /* @__PURE__ */ new Map();
27711
27846
  /** The next text starts a new block (a tool ran since the last one). */
27712
27847
  split = true;
27848
+ /** Tool name -> steps of the turn that ran it, in the order the tools first ran. */
27849
+ perTool = /* @__PURE__ */ new Map();
27850
+ /** The step ids already counted. */
27851
+ counted = /* @__PURE__ */ new Set();
27713
27852
  /** Why the message waits, while it waits for a terminal on the machine (`terminal_input_queued`, said in the chat's language by
27714
27853
  * the runner): the floating status says it, not only "Thinking…", until anything of the turn shows. */
27715
27854
  waiting = "";
@@ -27717,11 +27856,13 @@ var RemoteLiveView = class {
27717
27856
  apply(step) {
27718
27857
  const before = this.render();
27719
27858
  const waited = this.waiting;
27720
- if (step.queued !== null) this.waiting = step.note ?? "";
27859
+ if (step.queued !== null) this.waiting = step.waitLine ?? step.note ?? "";
27721
27860
  else if (showsTheTurn(step)) this.waiting = "";
27722
27861
  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);
27862
+ else if (step.tool) {
27863
+ this.count(step.tool.id, step.tool.name ?? "");
27864
+ this.trackTool(step.tool.id, step.tool.title, step.tool.status);
27865
+ } else if (step.plan) this.setPlan(step.plan);
27725
27866
  else if (step.note) {
27726
27867
  this.blocks.push({ kind: "note", text: step.note });
27727
27868
  this.split = true;
@@ -27739,10 +27880,33 @@ var RemoteLiveView = class {
27739
27880
  const last = this.blocks.at(-1);
27740
27881
  if (last?.kind === "failed")
27741
27882
  lines.push(remoteText.in(this.lang).stepFailed({ title: neutral2(last.text, TOOL_TITLE_MAX) }));
27883
+ const steps = this.stepsLine();
27884
+ if (steps) lines.push(steps);
27742
27885
  const running = this.runningLine();
27743
27886
  if (running) lines.push(running);
27744
27887
  return lines.map(inertAnswer);
27745
27888
  }
27889
+ /** `Working: Bash ×3, Read ×2`: the turn's steps so far, by tool (the most used first); null before the first named one. */
27890
+ stepsLine() {
27891
+ if (this.perTool.size === 0) return null;
27892
+ const ranked = [...this.perTool.entries()].sort((a, b3) => b3[1] - a[1]);
27893
+ const shown3 = ranked.slice(0, STEPS_LINE_TOOLS).map(([name, n]) => `${name} \xD7${String(n)}`);
27894
+ const others = ranked.slice(STEPS_LINE_TOOLS).reduce((sum, [, n]) => sum + n, 0);
27895
+ if (others > 0) shown3.push(`+${String(others)}`);
27896
+ return remoteText.in(this.lang).stepsSoFar({ tools: shown3.join(", ") });
27897
+ }
27898
+ /** A step seen for the first time is counted under its tool's name (one the event does not name is not counted). */
27899
+ count(id, name) {
27900
+ if (!name || id && this.counted.has(id)) return;
27901
+ if (id) {
27902
+ this.counted.add(id);
27903
+ for (const oldest of this.counted) {
27904
+ if (this.counted.size <= COUNTED_KEEP) break;
27905
+ this.counted.delete(oldest);
27906
+ }
27907
+ }
27908
+ this.perTool.set(name, (this.perTool.get(name) ?? 0) + 1);
27909
+ }
27746
27910
  /** The header and the newest part of the turn that fits. */
27747
27911
  render() {
27748
27912
  const body = boundedBody(this.paragraphs(), LIVE_MAX_CHARS2);
@@ -27799,6 +27963,8 @@ var RemoteLiveView = class {
27799
27963
  }
27800
27964
  paragraphs() {
27801
27965
  const out = this.blocks.map((b3) => this.paragraph(b3)).filter((p) => p);
27966
+ const steps = this.stepsLine();
27967
+ if (steps) out.push(steps);
27802
27968
  const running = this.runningLine();
27803
27969
  if (running) out.push(running);
27804
27970
  return out.map(inertAnswer);
@@ -28444,6 +28610,14 @@ var remoteAgentText = defineCatalog({
28444
28610
  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
28611
  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
28612
  queuedRefused: (p) => `A message you queued was not run on the machine: ${p.reason}`,
28613
+ /** The message waits for the turn the terminal is running (`terminal_input_queued`, `terminal_working`), said once per message. */
28614
+ terminalBusy: "The session is busy: your message is queued and goes in when the current turn ends.",
28615
+ /** ... and it is in Claude Code's own queue there (`held: "terminal"`): only the terminal can take it back. */
28616
+ terminalBusyHeld: " To withdraw it, press \u2191 in that terminal: the queued message goes back into its input box.",
28617
+ /** ... and it still waits on the connector: /stop takes it back. */
28618
+ terminalBusyWaiting: " To withdraw it, send /stop.",
28619
+ /** 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. */
28620
+ terminalBusyNowHeld: "Your queued message is now in the terminal's own queue. To withdraw it, press \u2191 in that terminal.",
28447
28621
  stopFirst: "A task is still running. Send /stop first.",
28448
28622
  notAttached: "You are not attached to a remote session. Start one with `/agent new AGENT PATH`, or `/agent attach N`.",
28449
28623
  approvalInactive: "That approval request is no longer active.",
@@ -28566,6 +28740,10 @@ var remoteAgentText = defineCatalog({
28566
28740
  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
28741
  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
28742
  queuedRefused: (p) => `\u4F60\u6392\u961F\u7684\u4E00\u6761\u6D88\u606F\u6CA1\u6709\u5728\u673A\u5668\u4E0A\u8FD0\u884C\uFF1A${p.reason}`,
28743
+ terminalBusy: "\u4F1A\u8BDD\u6B63\u5FD9\uFF0C\u5DF2\u6392\u961F\uFF0C\u5F53\u524D\u56DE\u5408\u7ED3\u675F\u540E\u53D1\u9001\u3002",
28744
+ 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",
28745
+ terminalBusyWaiting: "\u8981\u64A4\u56DE\uFF1A\u53D1 /stop\u3002",
28746
+ 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
28747
  stopFirst: "\u8FD8\u6709\u4EFB\u52A1\u5728\u8FD0\u884C\u3002\u5148\u53D1 /stop\u3002",
28570
28748
  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
28749
  approvalInactive: "\u8FD9\u4E2A\u5BA1\u6279\u8BF7\u6C42\u5DF2\u7ECF\u5931\u6548\u4E86\u3002",
@@ -29133,6 +29311,8 @@ var ChatRegistry = class {
29133
29311
  readOnly = /* @__PURE__ */ new Map();
29134
29312
  readOnlyKnown = /* @__PURE__ */ new Map();
29135
29313
  terminalInput = /* @__PURE__ */ new Map();
29314
+ /** The session each chat was told its terminal's registry row cannot be read for (once per attach). */
29315
+ rowHinted = /* @__PURE__ */ new Map();
29136
29316
  tickets = /* @__PURE__ */ new Map();
29137
29317
  /** How many messages wait behind the chat's running turn. */
29138
29318
  queuedCount(chatKey) {
@@ -29226,6 +29406,12 @@ var ChatRegistry = class {
29226
29406
  if (terminal) this.terminalInput.set(chatKey, sessionId);
29227
29407
  else if (this.terminalInput.get(chatKey) === sessionId) this.terminalInput.delete(chatKey);
29228
29408
  }
29409
+ /** True the first time for a chat's session: the chat is to be told its terminal's registry row cannot be read. */
29410
+ firstRowHint(chatKey, sessionId) {
29411
+ if (!sessionId || this.rowHinted.get(chatKey) === sessionId) return false;
29412
+ this.rowHinted.set(chatKey, sessionId);
29413
+ return true;
29414
+ }
29229
29415
  /** What is sent to the chat's session is typed into a terminal on the machine. */
29230
29416
  typesIntoTerminal(chatKey, sessionId) {
29231
29417
  return sessionId !== null && this.terminalInput.get(chatKey) === sessionId;
@@ -29265,6 +29451,7 @@ var ChatRegistry = class {
29265
29451
  this.agentUnattended.delete(chatKey);
29266
29452
  this.readOnly.delete(chatKey);
29267
29453
  this.readOnlyKnown.delete(chatKey);
29454
+ this.rowHinted.delete(chatKey);
29268
29455
  this.queuedPrompts.delete(chatKey);
29269
29456
  this.refusals.delete(chatKey);
29270
29457
  }
@@ -30287,6 +30474,8 @@ var remoteLeads = {
30287
30474
  sessionEnded: ["\u4F1A\u8BDD\u5DF2\u7ED3\u675F", "The session ended"],
30288
30475
  couldNotStart: ["\u4F1A\u8BDD\u6CA1\u80FD\u542F\u52A8", "The session could not start"],
30289
30476
  turnIncomplete: ["\u8FD9\u4E00\u8F6E\u6CA1\u6709\u5B8C\u6210", "The turn did not complete"],
30477
+ /** (a message the terminal may have taken: never said as a turn that did not complete) */
30478
+ inputUnconfirmed: ["\u8FD8\u6CA1\u786E\u8BA4\u7EC8\u7AEF\u6536\u5230", "Not confirmed by the terminal yet"],
30290
30479
  modeNotSwitched: ["\u6A21\u5F0F\u6CA1\u6709\u5207\u6362", "The mode was not switched"],
30291
30480
  notSwitchedTo: (mode) => [`\u6CA1\u6709\u5207\u5230 \`${mode}\``, `The agent did not switch to \`${mode}\``]
30292
30481
  };
@@ -30346,7 +30535,8 @@ var connectorReasonText = defineCatalog({
30346
30535
  terminal_input_failed: "Typing the message into the terminal failed; it was not sent.",
30347
30536
  // (a connector after 0.1.22: the paste never showed in the box in the 20 seconds it waited)
30348
30537
  terminal_input_unseen: "The message was typed into the terminal, but the terminal did not show it for 20 seconds (Claude Code there is busy or not taking input), so nothing was sent. Send it again in a moment.",
30349
- terminal_input_unconfirmed: "The message was typed into the terminal, but its transcript does not show it; it may not have gone in. Check the terminal.",
30538
+ // (not a failure: the terminal may well have taken it; what the session does next still shows here)
30539
+ terminal_input_unconfirmed: "The message was typed into the terminal, but its transcript did not show it within 20 seconds, so it is not known whether the session took it. Whatever the session answers still shows here. Look at the terminal before you send it again, so it does not run twice.",
30350
30540
  terminal_input_unavailable: "After a restart the connector could not prove that terminal again, so the message was not typed in. Attach again.",
30351
30541
  empty_prompt: "The message was empty once its control characters were removed; nothing was typed.",
30352
30542
  // (a prompt to a session that only watches a terminal's conversation; also a turn_end error)
@@ -30419,7 +30609,7 @@ var connectorReasonText = defineCatalog({
30419
30609
  terminal_switched: "\u90A3\u4E2A\u7EC8\u7AEF\u5DF2\u7ECF\u6362\u5230\u53E6\u4E00\u6BB5\u5BF9\u8BDD\u4E86\uFF08\u5728\u7EC8\u7AEF\u91CC /resume \u6216 /clear \u8FC7\uFF09\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002",
30420
30610
  terminal_input_failed: "\u5F80\u7EC8\u7AEF\u91CC\u8F93\u5165\u8FD9\u6761\u6D88\u606F\u5931\u8D25\u4E86\uFF0C\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002",
30421
30611
  terminal_input_unseen: "\u8FD9\u6761\u6D88\u606F\u8F93\u8FDB\u7EC8\u7AEF\u540E\uFF0C\u7B49\u4E86 20 \u79D2\u7EC8\u7AEF\u90FD\u6CA1\u6709\u663E\u793A\u5B83\uFF08\u90A3\u8FB9\u7684 Claude Code \u6B63\u5FD9\u6216\u6CA1\u5728\u63A5\u6536\u8F93\u5165\uFF09\uFF0C\u6240\u4EE5\u6CA1\u6709\u53D1\u51FA\u53BB\u3002\u7A0D\u540E\u518D\u53D1\u4E00\u6B21\u3002",
30422
- terminal_input_unconfirmed: "\u6D88\u606F\u5DF2\u7ECF\u8F93\u5165\u7EC8\u7AEF\uFF0C\u4F46\u7EC8\u7AEF\u7684\u8BB0\u5F55\u91CC\u6CA1\u770B\u5230\u5B83\uFF0C\u53EF\u80FD\u6CA1\u53D1\u51FA\u53BB\u3002\u53BB\u7EC8\u7AEF\u91CC\u770B\u4E00\u773C\u3002",
30612
+ terminal_input_unconfirmed: "\u6D88\u606F\u5DF2\u7ECF\u8F93\u5165\u7EC8\u7AEF\uFF0C\u4F46 20 \u79D2\u5185\u7EC8\u7AEF\u7684\u5BF9\u8BDD\u8BB0\u5F55\u91CC\u8FD8\u6CA1\u770B\u5230\u5B83\uFF0C\u6682\u65F6\u4E0D\u80FD\u786E\u8BA4\u90A3\u8FB9\u5DF2\u7ECF\u6536\u5230\u3002\u90A3\u8FB9\u4E4B\u540E\u7684\u56DE\u590D\u4ECD\u4F1A\u53D1\u5230\u8FD9\u91CC\u3002\u8981\u91CD\u53D1\u7684\u8BDD\u5148\u770B\u4E00\u773C\u7EC8\u7AEF\uFF0C\u514D\u5F97\u540C\u4E00\u4EF6\u4E8B\u505A\u4E24\u904D\u3002",
30423
30613
  terminal_input_unavailable: "\u8FDE\u63A5\u5668\u91CD\u542F\u540E\u6CA1\u80FD\u518D\u786E\u8BA4\u90A3\u4E2A\u7EC8\u7AEF\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u91CD\u65B0 attach \u4E00\u6B21\u3002",
30424
30614
  empty_prompt: "\u8FD9\u6761\u6D88\u606F\u53BB\u6389\u63A7\u5236\u5B57\u7B26\u540E\u662F\u7A7A\u7684\uFF0C\u6CA1\u6709\u53D1\u8FDB\u7EC8\u7AEF\u3002",
30425
30615
  read_only_live_session: "\u8FD9\u6BB5\u5BF9\u8BDD\u6B63\u5F00\u5728\u90A3\u53F0\u673A\u5668\u7684\u7EC8\u7AEF\u91CC\uFF0C\u8FD9\u8FB9\u53EA\u80FD\u770B\u3001\u4E0D\u80FD\u8F93\u5165\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u5728\u7EC8\u7AEF\u91CC\u8F93\u5165\uFF0C\u6216\u5148\u63A5\u7BA1\u518D\u53D1\u3002",
@@ -30477,6 +30667,9 @@ var UPGRADE = both((lang) => connectorReasonHints.in(lang).upgrade({ command: UP
30477
30667
  var SANDBOX = both((lang) => connectorReasonHints.in(lang).sandbox);
30478
30668
  var STATUS2 = both((lang) => connectorReasonHints.in(lang).status);
30479
30669
  var OLD_CONNECTOR = /* @__PURE__ */ new Set(["mode_unavailable", "mode_not_enforced"]);
30670
+ var FIXED_LATER = {
30671
+ terminal_input_unconfirmed: [0, 1, 22]
30672
+ };
30480
30673
  var THEN_NEW = /* @__PURE__ */ new Set([
30481
30674
  "adapter_gone",
30482
30675
  "adapter_cannot_resume",
@@ -30519,6 +30712,13 @@ ${hints.sandbox}
30519
30712
  ` };
30520
30713
  return { sep: " ", hint: hints.status };
30521
30714
  }
30715
+ const fixedIn = own(FIXED_LATER, code3);
30716
+ if (fixedIn) {
30717
+ const parsed = parseVersion2(version);
30718
+ if (parsed !== null && older(parsed, fixedIn))
30719
+ return { sep: "\n\n", hint: hints.upgrade({ command: UPGRADE_COMMAND }) };
30720
+ return null;
30721
+ }
30522
30722
  if (THEN_NEW.has(code3)) return { sep: " ", hint: hints.newSession };
30523
30723
  if (THEN_RETRY.has(code3)) return { sep: " ", hint: hints.retry };
30524
30724
  return null;
@@ -30572,7 +30772,8 @@ var EndedWords = class {
30572
30772
  * sentence then offers the upgrade, which cannot hurt).
30573
30773
  */
30574
30774
  async connectorVersion(key, provider, connectorId, reason) {
30575
- if (!OLD_CONNECTOR.has((reason ?? "").trim()) || !connectorId) return null;
30775
+ const code3 = (reason ?? "").trim();
30776
+ if (!(OLD_CONNECTOR.has(code3) || Object.hasOwn(FIXED_LATER, code3)) || !connectorId) return null;
30576
30777
  try {
30577
30778
  const credential2 = await credentialOf(key, provider);
30578
30779
  if (!credential2) return null;
@@ -31445,6 +31646,8 @@ var Watches = class {
31445
31646
  const lang = this.state.lang(w.chatKey);
31446
31647
  const warning = step.terminal === true ? noAskLine(step.terminalMode, lang) : null;
31447
31648
  if (warning) await w.to.send(textMessage(warning));
31649
+ if (step.terminal === true && step.rowUnreadable && this.state.chats.firstRowHint(w.chatKey, w.sessionId))
31650
+ await w.to.send(textMessage(rowUnreadableLine(lang)));
31448
31651
  const switched = w.want ? await this.approvalNote(w, w.want, signal) : "";
31449
31652
  const state = this.state.attached(w.chatKey);
31450
31653
  if (state?.sessionId !== w.sessionId) return;
@@ -33079,6 +33282,7 @@ function offlineRefusal(error) {
33079
33282
  }
33080
33283
 
33081
33284
  // packages/core/src/remote/turns/chat-turn.ts
33285
+ var REMOTE_EDIT_SECONDS = 3;
33082
33286
  var RemoteStatusPolicy = class {
33083
33287
  constructor(live, cutError, signer) {
33084
33288
  this.live = live;
@@ -33203,7 +33407,8 @@ var ChatTurn = class {
33203
33407
  log: options.log,
33204
33408
  lang: options.lang,
33205
33409
  policy,
33206
- streamReplyTo: options.replyTo
33410
+ streamReplyTo: options.replyTo,
33411
+ editSeconds: REMOTE_EDIT_SECONDS
33207
33412
  });
33208
33413
  }
33209
33414
  surface;
@@ -33278,6 +33483,8 @@ var REMOTE_TURN_DEADLINE_SECONDS = 4 * 3600;
33278
33483
  var RECONNECT_BACKOFF_SECONDS = 1;
33279
33484
  var CURSOR_EVERY2 = 25;
33280
33485
  var STREAM_ATTEMPTS2 = 4;
33486
+ var BUSY_REASONS = /* @__PURE__ */ new Set(["terminal_working", "terminal_waiting"]);
33487
+ var BUSY_TOLD_KEPT = 20;
33281
33488
  var LostConnection = class extends Error {
33282
33489
  name = "LostConnection";
33283
33490
  };
@@ -33298,6 +33505,10 @@ var TurnRunner = class {
33298
33505
  ended;
33299
33506
  show;
33300
33507
  displayFor;
33508
+ /** The questions on the terminal each turn's display said in the chat (by their line). */
33509
+ questionsTold = /* @__PURE__ */ new WeakMap();
33510
+ /** Per chat: what it was told of each message (Claw's number) waiting for a busy terminal (`tellBusy`), oldest first. */
33511
+ toldBusy = /* @__PURE__ */ new Map();
33301
33512
  /** Watch the turn that is open on the chat's session. */
33302
33513
  start(request) {
33303
33514
  const turn = newTurn();
@@ -33382,7 +33593,14 @@ var TurnRunner = class {
33382
33593
  splitErrorTail: (text8) => this.ctx.errors.splitErrorTail(text8),
33383
33594
  withhold: (detail) => this.ctx.errors.withhold("remote_turn_failed", detail, { session: state.sessionId }),
33384
33595
  sessionEnded: (reason) => this.ended.sessionEnded(chatKey, request.key, request.provider, state.connectorId, reason),
33385
- turnIncomplete: (code3) => this.ended.said(chatKey, remoteLeads.turnIncomplete, request.key, request.provider, state.connectorId, code3),
33596
+ turnIncomplete: (code3) => this.ended.said(
33597
+ chatKey,
33598
+ code3 === TERMINAL_INPUT_UNCONFIRMED ? remoteLeads.inputUnconfirmed : remoteLeads.turnIncomplete,
33599
+ request.key,
33600
+ request.provider,
33601
+ state.connectorId,
33602
+ code3
33603
+ ),
33386
33604
  ...signer ? { sign: (parts2) => signer.later(parts2) } : {}
33387
33605
  }
33388
33606
  );
@@ -33459,8 +33677,9 @@ var TurnRunner = class {
33459
33677
  if (step.rejected?.type === "prompt" && step.rejected.cmdSeq !== null) {
33460
33678
  await this.queuedRefused(chatKey, to, step.rejected.cmdSeq, step.rejected.reason);
33461
33679
  }
33462
- const shown3 = step.queued !== null ? { ...step, note: queuedLine(step.queued, this.state.lang(chatKey)) } : step;
33463
- display.progress(shown3);
33680
+ if (step.queued !== null) await this.showWait(request, step, display);
33681
+ else display.progress(step);
33682
+ if (step.rowUnreadable) await this.sayRowUnreadable(chatKey, sid, to);
33464
33683
  if (saysModes(step)) this.ctx.remoteState.setRemoteModes(chatKey, sid, step);
33465
33684
  if (step.permission !== null) await this.show(chatKey, sid, step.permission, to);
33466
33685
  if (step.resolved !== null) this.ctx.permissions.closeRemotePermission(sid, actionIdOf(step.resolved), "decided");
@@ -33468,6 +33687,33 @@ var TurnRunner = class {
33468
33687
  await this.sayRecovered(chatKey, to, step.recovered.interrupted, step.recovered.continuing);
33469
33688
  }
33470
33689
  }
33690
+ /**
33691
+ * 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
33692
+ * 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
33693
+ * told so when it was sent (`queuedBehind`): not again here.
33694
+ */
33695
+ async tellBusy(request, step) {
33696
+ const { chatKey, to } = request;
33697
+ const mine = request.cmdSeq?.();
33698
+ if (step.queuedSeq === null || mine === void 0 || step.queuedSeq !== mine) return;
33699
+ const told = this.toldBusy.get(chatKey) ?? /* @__PURE__ */ new Map();
33700
+ const before = told.get(mine);
33701
+ const now = step.queuedHeld ? "held" : "waiting";
33702
+ if (before === "held" || before === now) return;
33703
+ told.set(mine, now);
33704
+ for (const oldest of told.keys()) {
33705
+ if (told.size <= BUSY_TOLD_KEPT) break;
33706
+ told.delete(oldest);
33707
+ }
33708
+ this.toldBusy.set(chatKey, told);
33709
+ const words3 = remoteAgentText.in(this.state.lang(chatKey));
33710
+ const text8 = before === "waiting" ? words3.terminalBusyNowHeld : words3.terminalBusy + (step.queuedHeld ? words3.terminalBusyHeld : words3.terminalBusyWaiting);
33711
+ try {
33712
+ await to.send(textMessage(text8));
33713
+ } catch (error) {
33714
+ this.ctx.logger.warn("that the message waits for a busy terminal could not be told", { error: errorName(error) });
33715
+ }
33716
+ }
33471
33717
  /**
33472
33718
  * 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
33719
  * send has not answered yet has no number to match: the refusal is kept for that send (`Prompts.queueBehind`).
@@ -33483,6 +33729,46 @@ var TurnRunner = class {
33483
33729
  this.ctx.logger.warn("that a queued message was refused could not be told", { error: errorName(error) });
33484
33730
  }
33485
33731
  }
33732
+ /**
33733
+ * Why the message still waits for the terminal, in the chat's language: the whole line in the turn's live view and on the session
33734
+ * card, a short one in the floating status; what a question on the terminal asks is also said in the chat when the display does
33735
+ * not show the whole line; that it waits for a busy terminal is said in the chat at once (`tellBusy`).
33736
+ */
33737
+ async showWait(request, step, display) {
33738
+ const { chatKey, to } = request;
33739
+ const lang = this.state.lang(chatKey);
33740
+ const reason = step.queued ?? "";
33741
+ const note = queuedNote(reason, step.dialog, lang);
33742
+ display.progress({ ...step, note, waitLine: queuedLine(reason, lang) });
33743
+ if (reason === "terminal_dialog" && !display.showsWaits) await this.sayQuestion(display, note, to);
33744
+ if (BUSY_REASONS.has(reason)) await this.tellBusy(request, step);
33745
+ }
33746
+ /**
33747
+ * What a question on the terminal asks, while the message waits for it: said in the chat once per question and turn (the stream's
33748
+ * floating status has room for a few characters only, and the person must answer it at the terminal before anything runs).
33749
+ */
33750
+ async sayQuestion(display, line2, to) {
33751
+ const told = this.questionsTold.get(display) ?? /* @__PURE__ */ new Set();
33752
+ if (told.has(line2)) return;
33753
+ told.add(line2);
33754
+ this.questionsTold.set(display, told);
33755
+ try {
33756
+ await to.send(textMessage(line2));
33757
+ } catch (error) {
33758
+ this.ctx.logger.warn("what the terminal's question asks could not be told", { error: errorName(error) });
33759
+ }
33760
+ }
33761
+ /** Once per attach: the terminal's registry row cannot be read, and a restart of it there makes it known again. */
33762
+ async sayRowUnreadable(chatKey, sid, to) {
33763
+ if (!this.state.chats.firstRowHint(chatKey, sid)) return;
33764
+ try {
33765
+ await to.send(textMessage(rowUnreadableLine(this.state.lang(chatKey))));
33766
+ } catch (error) {
33767
+ this.ctx.logger.warn("that the terminal's registry row cannot be read could not be told", {
33768
+ error: errorName(error)
33769
+ });
33770
+ }
33771
+ }
33486
33772
  async sayRecovered(chatKey, to, interrupted, continuing) {
33487
33773
  const state = this.ctx.remoteState.getRemote(chatKey);
33488
33774
  if (!state?.sessionId) return;
@@ -33530,6 +33816,8 @@ var WindowTurn = class {
33530
33816
  board;
33531
33817
  cutError;
33532
33818
  tail = "";
33819
+ /** (the card's state line says why a message waits, whole) */
33820
+ showsWaits = true;
33533
33821
  segments = [];
33534
33822
  newSegment = true;
33535
33823
  closed = false;
@@ -8,6 +8,13 @@ export declare function commentOutcome(out: Fields, lang: Lang): string | undefi
8
8
  export declare function devenvSendOutcome(status: string, out: Fields, lang: Lang): string;
9
9
  /** What came of Save or Discard on a drafted skill's card: saved (which version), discarded, or why not. */
10
10
  export declare function skillSaveOutcome(status: string, out: Fields, lang: Lang): string;
11
+ /** A merge or an approval a review holds (`github_merge`, `github_review`). */
12
+ export declare function isGithubWrite(kind: string): boolean;
13
+ /**
14
+ * What came of a press on a merge's or an approval's card: Claw's answer to the review's own decision
15
+ * (`POST /v1/github-review/confirmations/:id/decision`: `merged`, `queued`, `submitted`, `denied`, `stale`, `expired`, `refused`, `retry`).
16
+ */
17
+ export declare function githubWriteOutcome(kind: string, out: Fields, lang: Lang): string;
11
18
  /** What came of a press on a held write's card of `kind`, in one line: Claw's answer said plainly. */
12
19
  export declare function confirmOutcome(kind: string, out: Fields, lang: Lang): string;
13
20
  export {};
@@ -13,7 +13,7 @@ export declare const SUGGESTED_REPLY_MAX = 30;
13
13
  /** The suggested replies kept under a message when the channel's own limit is not given (`SurfaceCaps.suggestionsMax`). */
14
14
  export declare const SUGGESTIONS_MAX = 3;
15
15
  /** The writes Claw holds for the person that this worker draws as a card. */
16
- export declare const CONFIRM_KINDS: readonly ["trigger_create", "trigger_cancel", "devenv_send", "github_comment", "devenv_hide", "skill_save"];
16
+ export declare const CONFIRM_KINDS: readonly ["trigger_create", "trigger_cancel", "devenv_send", "github_comment", "devenv_hide", "skill_save", "github_merge", "github_review"];
17
17
  /** The default replies under what the assistant said: (what the button says, what it sends). */
18
18
  export declare const ASSISTANT_SUGGESTED_REPLIES: Readonly<Record<Lang, readonly SuggestedReply[]>>;
19
19
  type Event = Readonly<Record<string, unknown>>;
@@ -45,6 +45,13 @@ export declare const assistantActionText: import("./catalog.js").Catalog<{
45
45
  notSentWhy: (p: {
46
46
  why: string;
47
47
  }) => string;
48
+ githubMerged: string;
49
+ githubQueued: string;
50
+ githubApproved: string;
51
+ githubNotMerged: string;
52
+ githubNotApproved: string;
53
+ githubStale: string;
54
+ githubRetry: string;
48
55
  actionGone: string;
49
56
  actionUsed: string;
50
57
  confirmGone: string;
@@ -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,8 @@ export declare const remoteLeads: {
7
7
  readonly sessionEnded: readonly ["会话已结束", "The session ended"];
8
8
  readonly couldNotStart: readonly ["会话没能启动", "The session could not start"];
9
9
  readonly turnIncomplete: readonly ["这一轮没有完成", "The turn did not complete"];
10
+ /** (a message the terminal may have taken: never said as a turn that did not complete) */
11
+ readonly inputUnconfirmed: readonly ["还没确认终端收到", "Not confirmed by the terminal yet"];
10
12
  readonly modeNotSwitched: readonly ["模式没有切换", "The mode was not switched"];
11
13
  readonly notSwitchedTo: (mode: string) => Pair;
12
14
  };
@@ -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;
@@ -306,6 +310,11 @@ export declare const remoteText: import("./catalog.js").Catalog<{
306
310
  noAsk: (p: {
307
311
  name: string;
308
312
  }) => string;
313
+ dialogAsks: (p: {
314
+ what: string;
315
+ }) => string;
316
+ dialogAsksBare: string;
317
+ rowUnreadable: string;
309
318
  noTextOutput: string;
310
319
  answerShortened: string;
311
320
  pairBody: (p: {
@@ -18,6 +18,13 @@ export interface AssistantItemSnapshot {
18
18
  board_state: string;
19
19
  result_version: number;
20
20
  can_accept: boolean;
21
+ /**
22
+ * The result version Claw delivered without the user's Accept (`CLAW_ASSISTANT_AUTO_DELIVER`), while the item stands delivered:
23
+ * closed by that delivery, or open only to watch a pull request (`watching_pr`). Absent otherwise, and from an API without it.
24
+ */
25
+ delivered_version?: number;
26
+ /** The pull requests, as owner/repo#123, a delivered item stays open watching for comments and failed CI. Absent when none. */
27
+ watching_pr?: string[];
21
28
  }
22
29
  interface AssistantEventBase {
23
30
  /** The id of the stored message: the receiver's dedup key. */
@@ -65,9 +72,11 @@ export interface AssistantConfirmWrite {
65
72
  /**
66
73
  * `devenv_send`: an instruction for an agent on the person's own machine (`assistant/devenv-tools.ts`). `skill_save`: a personal skill
67
74
  * the assistant drafted on its own, saved only when the person lets it through (`assistant/skill-writes.ts`); its message carries
68
- * `skill_card` with what would be saved.
75
+ * `skill_card` with what would be saved. `github_merge` and `github_review`: a merge, or an approval, that a review the assistant
76
+ * started for the person's own account holds for them (`claw_github_confirmations`, `assistant/review-items.ts`); the same decision
77
+ * route answers it, and it is made exactly as `POST /v1/github-review/confirmations/{confirmation_id}/decision` makes it.
69
78
  */
70
- kind: "trigger_create" | "trigger_cancel" | "github_comment" | "devenv_send" | "devenv_hide" | "skill_save";
79
+ kind: "trigger_create" | "trigger_cancel" | "github_comment" | "devenv_send" | "devenv_hide" | "skill_save" | "github_merge" | "github_review";
71
80
  /** What the button that lets it through says, in the language of the text. */
72
81
  allow_label: string;
73
82
  expires_at: string;
@@ -68,6 +68,8 @@ export declare class ChatRegistry {
68
68
  private readonly readOnly;
69
69
  private readonly readOnlyKnown;
70
70
  private readonly terminalInput;
71
+ /** The session each chat was told its terminal's registry row cannot be read for (once per attach). */
72
+ private readonly rowHinted;
71
73
  private readonly tickets;
72
74
  /** How many messages wait behind the chat's running turn. */
73
75
  queuedCount(chatKey: string): number;
@@ -98,6 +100,8 @@ export declare class ChatRegistry {
98
100
  /** A new session says itself whether it only watches. */
99
101
  clearReadOnly(chatKey: string): void;
100
102
  markTerminal(chatKey: string, sessionId: string, terminal: boolean): void;
103
+ /** True the first time for a chat's session: the chat is to be told its terminal's registry row cannot be read. */
104
+ firstRowHint(chatKey: string, sessionId: string): boolean;
101
105
  /** What is sent to the chat's session is typed into a terminal on the machine. */
102
106
  typesIntoTerminal(chatKey: string, sessionId: string | null): boolean;
103
107
  /**
@@ -10,6 +10,12 @@ export declare const SANDBOX: Pair;
10
10
  export declare const STATUS: Pair;
11
11
  /** Codes an older connector hits on a root machine with `approval = "never"`: an upgrade fixes them (see `FIXED_IN`). */
12
12
  export declare const OLD_CONNECTOR: ReadonlySet<string>;
13
+ /**
14
+ * Codes a connector before a release hits far more often than one after it, with the release that fixed that: an older connector is
15
+ * told to upgrade after the code's own sentence. Before 0.1.22 a connector did not recognise a pasted message (Claude Code records a
16
+ * paste of several lines as a `<pasted_content>` block), so nearly every long message it typed into a terminal ended unconfirmed.
17
+ */
18
+ export declare const FIXED_LATER: Readonly<Record<string, readonly [number, number, number]>>;
13
19
  /** Every code that has a sentence of its own. */
14
20
  export declare function knownReasons(): string[];
15
21
  /** `0.1.4` (or `v0.1.4`, `0.1.5-rc.1`) as [major, minor, patch]; null for anything else. */
@@ -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,18 @@ 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
+ /** What the question on that terminal's screen asks, while the message waits for it (`terminal_dialog`): one short line. */
57
+ readonly dialog: string | null;
58
+ /** The short line of Teams' floating status for that wait (said by the runner; `note` is the whole line). */
59
+ readonly waitLine: string | null;
60
+ /** The connector cannot read Claude Code's registry row of the terminal's process (`registry_row_unreadable`). */
61
+ readonly rowUnreadable: boolean;
62
+ /** Which message waits (its `cmd_id`, else Claw's number of it), null when the connector did not say. */
63
+ readonly queuedFor: string | null;
64
+ /** Claw's number of the message that waits, null when the connector did not say. */
65
+ readonly queuedSeq: number | null;
66
+ /** It waits in the terminal's own queue (`held: "terminal"`): only the terminal can take it back. */
67
+ readonly queuedHeld: boolean;
54
68
  /** What the person typed at the terminal of a conversation shared with the chat. */
55
69
  readonly typed: string | null;
56
70
  /** What is sent is typed into a terminal on the machine (`input: "terminal"`). */
@@ -63,6 +77,8 @@ export interface RemoteStep {
63
77
  export declare const NOTHING: RemoteStep;
64
78
  /** A step that says only `fields`. */
65
79
  export declare function remoteStep(fields?: Partial<RemoteStep>): RemoteStep;
80
+ /** `text` with each pasted block as the text that was pasted, on lines of its own. */
81
+ export declare function unwrapPasted(text: string): string;
66
82
  /** One SSE frame of a remote session to what the runner does. What cannot be read is skipped (usage_update, history_complete
67
83
  * and every type this client does not know are nothing). */
68
84
  export declare function decode(event: SseEvent, errors: PublicErrors): RemoteStep;
@@ -10,6 +10,11 @@ export declare const READ_ONLY_REASONS: readonly string[];
10
10
  export declare const TERMINAL_CLOSED = "terminal_closed";
11
11
  /** The connector's own word for a turn it ended because it restarted. */
12
12
  export declare const CONNECTOR_RESTARTED = "connector_restarted";
13
+ /**
14
+ * A connector's end of a turn whose message went into a terminal that did not show it in its transcript in time: the terminal may
15
+ * well have taken it, so it is never said as a turn that failed, and what the session says next is still followed.
16
+ */
17
+ export declare const TERMINAL_INPUT_UNCONFIRMED = "terminal_input_unconfirmed";
13
18
  /** A terminal's permission modes in which Claude Code acts without asking, and what they are called. */
14
19
  export declare const NO_ASK_MODES: Readonly<Record<string, string>>;
15
20
  /** The warning for a terminal whose mode does not ask, or null for one that asks (or whose mode is not known). */
@@ -41,6 +46,11 @@ export declare const WAIT_LINE_MAX_EN = 16;
41
46
  /** What a message for a conversation open in a terminal waits for (`terminal_input_queued`), in the chat's language: one short
42
47
  * line within WAIT_LINE_MAX_ZH / WAIT_LINE_MAX_EN, so that a phone shows all of it. */
43
48
  export declare function queuedLine(reason: string, lang: Lang): string;
49
+ /** The whole line of a wait, for the turn's live view and the session card (not cut to the floating status): what a question on the
50
+ * terminal's screen asks when it waits for one (`terminal_dialog`), the floating status's line otherwise. */
51
+ export declare function queuedNote(reason: string, dialog: string | null, lang: Lang): string;
52
+ /** Said once per attach: the terminal's process has a registry row the connector cannot read, and how to make it known again. */
53
+ export declare function rowUnreadableLine(lang: Lang): string;
44
54
  /** What a message to a watched session is answered with: it was not sent, and what makes sending possible without taking the
45
55
  * conversation from the terminal; `takeover`: the status card also offers Take over…, which ends the terminal's session. */
46
56
  export declare function readOnlyRefused(lang: Lang, takeover?: boolean): string;
@@ -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;
@@ -12,6 +12,11 @@ export interface TurnDisplay {
12
12
  finish(parts: readonly string[], options: FinishWith): Promise<void>;
13
13
  /** After `finish`, when the turn of a queued message follows at once: what this turn showed must stay readable (optional). */
14
14
  handOver?(): Promise<void>;
15
+ /**
16
+ * Whether the display itself shows a wait's whole line (the session card does). A chat's stream shows only a short floating status,
17
+ * so what a question on the terminal asks is said there as a message of its own.
18
+ */
19
+ readonly showsWaits?: boolean;
15
20
  }
16
21
  export interface FinishWith {
17
22
  /** What the agent wrote (the AI label). */
@@ -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,10 @@ export declare class TurnRunner {
36
40
  private readonly ended;
37
41
  private readonly show;
38
42
  private readonly displayFor;
43
+ /** The questions on the terminal each turn's display said in the chat (by their line). */
44
+ private readonly questionsTold;
45
+ /** Per chat: what it was told of each message (Claw's number) waiting for a busy terminal (`tellBusy`), oldest first. */
46
+ private readonly toldBusy;
39
47
  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
48
  /** Watch the turn that is open on the chat's session. */
41
49
  start(request: TurnRequest): void;
@@ -61,10 +69,29 @@ export declare class TurnRunner {
61
69
  /** One stream, read until it ends or the turn does. */
62
70
  private readStream;
63
71
  private apply;
72
+ /**
73
+ * 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
74
+ * 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
75
+ * told so when it was sent (`queuedBehind`): not again here.
76
+ */
77
+ private tellBusy;
64
78
  /**
65
79
  * 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
80
  * send has not answered yet has no number to match: the refusal is kept for that send (`Prompts.queueBehind`).
67
81
  */
68
82
  private queuedRefused;
83
+ /**
84
+ * Why the message still waits for the terminal, in the chat's language: the whole line in the turn's live view and on the session
85
+ * card, a short one in the floating status; what a question on the terminal asks is also said in the chat when the display does
86
+ * not show the whole line; that it waits for a busy terminal is said in the chat at once (`tellBusy`).
87
+ */
88
+ private showWait;
89
+ /**
90
+ * What a question on the terminal asks, while the message waits for it: said in the chat once per question and turn (the stream's
91
+ * floating status has room for a few characters only, and the person must answer it at the terminal before anything runs).
92
+ */
93
+ private sayQuestion;
94
+ /** Once per attach: the terminal's registry row cannot be read, and a restart of it there makes it known again. */
95
+ private sayRowUnreadable;
69
96
  private sayRecovered;
70
97
  }
@@ -15,6 +15,8 @@ export declare class WindowTurn implements TurnDisplay {
15
15
  private readonly board;
16
16
  private readonly cutError;
17
17
  tail: string;
18
+ /** (the card's state line says why a message waits, whole) */
19
+ readonly showsWaits = true;
18
20
  private readonly segments;
19
21
  private newSegment;
20
22
  private closed;
@@ -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. */
@@ -76,6 +79,8 @@ export declare class StatusMessage<S> {
76
79
  private streamOver;
77
80
  /** The turn was cancelled (`close(true)`). */
78
81
  private hard;
82
+ /** The answer is on its way (`finish`): the progress message is the answer's to retire. */
83
+ private finishing;
79
84
  constructor(surface: TurnSurface, options: StatusOptions<S>);
80
85
  begin(): void;
81
86
  private openStream;
@@ -131,11 +136,19 @@ export declare class StatusMessage<S> {
131
136
  private update;
132
137
  /**
133
138
  * Stop sending progress. A sleeping flusher is cancelled; one that is mid-send finishes that one send, unless the turn
134
- * itself was cancelled (`hard`). A stream still open when the turn is cancelled is closed with INTERRUPTED, in the
135
- * background (the floating status must not spin until the chat's limit).
139
+ * itself was cancelled (`hard`). When the turn is cancelled, what shows it is ended in the background: a stream still open
140
+ * is closed with INTERRUPTED (the floating status must not spin until the chat's limit), and the progress message is
141
+ * retired (no answer follows it, so it must not stay in the chat as stale progress).
136
142
  */
137
143
  close(hard?: boolean): void;
144
+ /** The turn was cancelled: nothing more is repeated, and what shows it is ended (the first time only). */
145
+ private cancelled;
138
146
  private interrupt;
147
+ /**
148
+ * The turn was cancelled with its progress message on screen: no answer follows to replace it, so it is retired here
149
+ * (deleted, or edited down to INTERRUPTED where the chat will not delete it). Never fails the turn.
150
+ */
151
+ private retireCancelled;
139
152
  /**
140
153
  * The turn is over: the user gets `parts`, in order. With a stream the first part is its final message (in the place
141
154
  * of the status) and the others follow; without one they are NEW messages, and the progress message is then retired.
@@ -157,8 +170,9 @@ export declare class StatusMessage<S> {
157
170
  /** Wait until FINAL_SETTLE_SECONDS have passed since the last progress edit left. */
158
171
  private settle;
159
172
  /**
160
- * The answer is posted below: delete the progress message. The chat may refuse, and a queue cannot delete; the message
161
- * is then edited down to one line, so it does not sit above the answer as stale progress. Never fails the turn.
173
+ * The answer is posted below, or none will come (the turn was cancelled): delete the progress message. The chat may
174
+ * refuse, and a queue cannot delete; the message is then edited down to one line (`line`), so it does not sit in the
175
+ * chat as stale progress. Never fails the turn.
162
176
  */
163
177
  private retire;
164
178
  /** Live edits went out, so one may still arrive after `message` replaced the progress message: send it once more. */
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.4",
4
4
  "description": "The personal agent's channel-neutral core: domain logic, ports and plugin interfaces.",
5
5
  "license": "MIT",
6
6
  "repository": {