@primusclaw/personal-agent 0.15.1 → 0.15.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
@@ -2517,7 +2517,8 @@ var noMetrics = {
2517
2517
  limited: () => void 0,
2518
2518
  filesDropped: () => void 0,
2519
2519
  probed: () => void 0,
2520
- inboundRearmed: () => void 0
2520
+ inboundRearmed: () => void 0,
2521
+ outboundUndelivered: () => void 0
2521
2522
  };
2522
2523
 
2523
2524
  // packages/core/src/limits/inbound-stats.ts
@@ -7652,7 +7653,7 @@ ${line3}` : line3));
7652
7653
  /**
7653
7654
  * The chat went on below the stream while the turn runs (the person wrote again, or something else was said there): the stream's
7654
7655
  * bubble stays where it opened, above all that. An answer begun in it and continued below would be read from its middle, its first
7655
- * part out of sight (2026-11-24: "(cont. 2/2)" under a queued message's notice, part 1 above both). So nothing of the agent's goes
7656
+ * part out of sight ("(cont. 2/2)" under a queued message's notice, part 1 above both). So nothing of the agent's goes
7656
7657
  * into the bubble from now on: while it shows only a status, that floats on until the turn ends; one that shows words already is
7657
7658
  * closed at once. Either way it ends with `line`, and the whole answer comes as messages of its own, below what was said since.
7658
7659
  * When it comes while the answer is going out (its first part in the bubble already), the whole answer is sent again below.
@@ -9794,7 +9795,8 @@ function readOne(raw, followed) {
9794
9795
  ignored: Array.isArray(ignored) ? ignored.filter((i) => typeof i === "string") : [],
9795
9796
  mergeNeedsConfirmation: heldOf(row2),
9796
9797
  queued: queuedOf(row2),
9797
- mergeByRequester: row2["merge_by_requester"] === true
9798
+ mergeByRequester: row2["merge_by_requester"] === true,
9799
+ ...row2["origin"] === "on_behalf" ? { origin: "on_behalf" } : {}
9798
9800
  };
9799
9801
  }
9800
9802
  function parseStartedReviews(data, followed = true) {
@@ -21453,10 +21455,10 @@ var terminalApprovalText = defineCatalog({
21453
21455
  endEarlierFailed: (p) => p.text ? `An earlier turn stopped with an error: ${p.text}${p.count > 1 ? ` (${String(p.count)} earlier turns did; see the terminal)` : ""}` : p.count > 1 ? `${String(p.count)} earlier turns stopped with an error; see the terminal.` : "An earlier turn stopped with an error; see the terminal.",
21454
21456
  endLatest: (p) => `Latest turn: ${p.text}`,
21455
21457
  approvalsUnavailable: "I could not reach the setting just now. Try again in a moment.",
21456
- summaryEvery: (p) => `A terminal conversation that keeps working on its own (turns another session or a schedule started) is summed up at most once every ${p.minutes} minutes; the end of a turn you started, or one that asks you something, comes at once. \`/approvals summary <minutes>|off\` changes it.`,
21457
- summaryNever: "Summaries are off: only the end of a turn you started, or one that asks you something, comes here. `/approvals summary 60` turns them back on.",
21458
- summarySet: (p) => `Done: a conversation that keeps working on its own is summed up at most once every ${p.minutes} minutes.`,
21459
- summaryOff: "Done: no more summaries; the end of a turn you started, or one that asks you something, still comes here.",
21458
+ summaryEvery: (p) => `A terminal conversation that keeps working on its own (turns another session or a schedule started) is summed up at most once every ${p.minutes} minutes; the end of a turn you started, or one that asks you something, comes at once. The reviews others asked of you are summed up the same way, in one message. \`/approvals summary <minutes>|off\` changes it.`,
21459
+ summaryNever: "Summaries are off: only the end of a turn you started, or one that asks you something, comes here, and the reviews others asked of you are not summed up (see /board). `/approvals summary 60` turns them back on.",
21460
+ summarySet: (p) => `Done: a conversation that keeps working on its own, and the reviews others asked of you, are summed up at most once every ${p.minutes} minutes.`,
21461
+ summaryOff: "Done: no more summaries, of terminal conversations or of the reviews others asked of you (see /board); the end of a turn you started, or one that asks you something, still comes here.",
21460
21462
  summaryUsage: "Use `/approvals summary <minutes>` with 15 to 1440 minutes, `/approvals summary off`, or `/approvals summary` to see it."
21461
21463
  },
21462
21464
  zh: {
@@ -21512,10 +21514,10 @@ var terminalApprovalText = defineCatalog({
21512
21514
  endEarlierFailed: (p) => p.text ? `\u65E9\u5148\u4E00\u8F6E\u51FA\u9519\u505C\u4E0B\uFF1A${p.text}${p.count > 1 ? `\uFF08\u65E9\u5148\u5171 ${String(p.count)} \u8F6E\u51FA\u9519\uFF0C\u8BE6\u89C1\u7EC8\u7AEF\uFF09` : ""}` : `\u65E9\u5148\u6709 ${String(p.count)} \u8F6E\u51FA\u9519\u505C\u4E0B\uFF0C\u8BE6\u89C1\u7EC8\u7AEF\u3002`,
21513
21515
  endLatest: (p) => `\u6700\u65B0\u4E00\u8F6E\uFF1A${p.text}`,
21514
21516
  approvalsUnavailable: "\u6682\u65F6\u8BFB\u4E0D\u5230\u8FD9\u4E2A\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",
21515
- summaryEvery: (p) => `\u5176\u4ED6\u4F1A\u8BDD\u6216\u5B9A\u65F6\u4EFB\u52A1\u9A71\u52A8\u3001\u6301\u7EED\u5728\u8DD1\u7684\u7EC8\u7AEF\u4F1A\u8BDD\uFF0C\u6700\u591A\u6BCF ${p.minutes} \u5206\u949F\u6C47\u603B\u4E00\u6B21\uFF1B\u4F60\u81EA\u5DF1\u53D1\u8D77\u7684\u56DE\u5408\u3001\u6216\u5728\u95EE\u4F60\u7684\u56DE\u5408\uFF0C\u7ED3\u675F\u65F6\u7ACB\u5373\u63A8\u9001\u3002\u53D1 \`/approvals summary <\u5206\u949F>|off\` \u4FEE\u6539\u3002`,
21516
- summaryNever: "\u6C47\u603B\u5DF2\u5173\u95ED\uFF1A\u53EA\u63A8\u9001\u4F60\u81EA\u5DF1\u53D1\u8D77\u7684\u56DE\u5408\u3001\u6216\u5728\u95EE\u4F60\u7684\u56DE\u5408\u3002\u53D1 `/approvals summary 60` \u91CD\u65B0\u5F00\u542F\u3002",
21517
- summarySet: (p) => `\u5DF2\u8BBE\u7F6E\uFF1A\u6301\u7EED\u5DE5\u4F5C\u7684\u7EC8\u7AEF\u4F1A\u8BDD\u6700\u591A\u6BCF ${p.minutes} \u5206\u949F\u6C47\u603B\u4E00\u6B21\u3002`,
21518
- summaryOff: "\u5DF2\u5173\u95ED\u6C47\u603B\uFF1B\u4F60\u81EA\u5DF1\u53D1\u8D77\u7684\u56DE\u5408\u3001\u6216\u5728\u95EE\u4F60\u7684\u56DE\u5408\uFF0C\u7ED3\u675F\u65F6\u4ECD\u4F1A\u63A8\u9001\u3002",
21517
+ summaryEvery: (p) => `\u5176\u4ED6\u4F1A\u8BDD\u6216\u5B9A\u65F6\u4EFB\u52A1\u9A71\u52A8\u3001\u6301\u7EED\u5728\u8DD1\u7684\u7EC8\u7AEF\u4F1A\u8BDD\uFF0C\u6700\u591A\u6BCF ${p.minutes} \u5206\u949F\u6C47\u603B\u4E00\u6B21\uFF1B\u4F60\u81EA\u5DF1\u53D1\u8D77\u7684\u56DE\u5408\u3001\u6216\u5728\u95EE\u4F60\u7684\u56DE\u5408\uFF0C\u7ED3\u675F\u65F6\u7ACB\u5373\u63A8\u9001\u3002\u522B\u4EBA\u8BF7\u4F60\u4EE3\u5BA1\u7684\u8BC4\u5BA1\u540C\u7406\uFF0C\u5408\u6210\u4E00\u6761\u6C47\u603B\u3002\u53D1 \`/approvals summary <\u5206\u949F>|off\` \u4FEE\u6539\u3002`,
21518
+ summaryNever: "\u6C47\u603B\u5DF2\u5173\u95ED\uFF1A\u53EA\u63A8\u9001\u4F60\u81EA\u5DF1\u53D1\u8D77\u7684\u56DE\u5408\u3001\u6216\u5728\u95EE\u4F60\u7684\u56DE\u5408\uFF1B\u522B\u4EBA\u8BF7\u4F60\u4EE3\u5BA1\u7684\u8BC4\u5BA1\u4E5F\u4E0D\u518D\u6C47\u603B\uFF08\u7ED3\u679C\u89C1 /board\uFF09\u3002\u53D1 `/approvals summary 60` \u91CD\u65B0\u5F00\u542F\u3002",
21519
+ summarySet: (p) => `\u5DF2\u8BBE\u7F6E\uFF1A\u6301\u7EED\u5DE5\u4F5C\u7684\u7EC8\u7AEF\u4F1A\u8BDD\u3001\u4EE5\u53CA\u522B\u4EBA\u8BF7\u4F60\u4EE3\u5BA1\u7684\u8BC4\u5BA1\uFF0C\u6700\u591A\u6BCF ${p.minutes} \u5206\u949F\u6C47\u603B\u4E00\u6B21\u3002`,
21520
+ summaryOff: "\u5DF2\u5173\u95ED\u6C47\u603B\uFF08\u7EC8\u7AEF\u4F1A\u8BDD\u548C\u522B\u4EBA\u8BF7\u4F60\u4EE3\u5BA1\u7684\u8BC4\u5BA1\u90FD\u4E0D\u518D\u6C47\u603B\uFF0C\u7ED3\u679C\u89C1 /board\uFF09\uFF1B\u4F60\u81EA\u5DF1\u53D1\u8D77\u7684\u56DE\u5408\u3001\u6216\u5728\u95EE\u4F60\u7684\u56DE\u5408\uFF0C\u7ED3\u675F\u65F6\u4ECD\u4F1A\u63A8\u9001\u3002",
21519
21521
  summaryUsage: "\u7528 `/approvals summary <\u5206\u949F>`\uFF0815 \u5230 1440\uFF09\uFF0C`/approvals summary off` \u5173\u95ED\uFF0C\u53EA\u53D1 `/approvals summary` \u67E5\u770B\u5F53\u524D\u8BBE\u7F6E\u3002"
21520
21522
  }
21521
21523
  });
@@ -22021,7 +22023,7 @@ var Deliveries = class {
22021
22023
  * Claw's "on it" line for a turn that has already begun to answer: a say of the turn was delivered (or is being), or the
22022
22024
  * receipt under the person's message is showing the reply's words. The line came late (it was decided before the answer,
22023
22025
  * or the two crossed on the way here): it is dropped, never put in the receipt's place, where it would replace the words of
22024
- * a reply that is being written or close it as if it were the answer (2026-11-11 0.3.0 acceptance: a refusal streamed into
22026
+ * a reply that is being written or close it as if it were the answer (0.3.0 acceptance: a refusal streamed into
22025
22027
  * the receipt, the line closed it as "收到,我看一下。", and the refusal came as a message of its own).
22026
22028
  */
22027
22029
  lateTurnAck(conversation, event) {
@@ -22895,7 +22897,7 @@ function githubConfirmButtons(confirmationId, review, lang = "zh") {
22895
22897
  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.";
22896
22898
  var REVIEW_MODES = {
22897
22899
  high_risk_confirm: ["\u9AD8\u98CE\u9669\u4EBA\u5DE5\u518D\u786E\u8BA4\u4E00\u6B21\uFF08\u9ED8\u8BA4\uFF09", "A person confirms high-risk changes (default)"],
22898
- // (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
22900
+ // (not "nobody is asked": a repository that asks for a person still holds a merge under it, and now a review the person
22899
22901
  // asks for in the chat merges unasked too)
22900
22902
  fully_auto: [
22901
22903
  "\u5168\u81EA\u52A8\u5408\u5165\uFF08\u4ED3\u5E93\u81EA\u8EAB\u8981\u6C42\u7684\u68C0\u67E5\u4ECD\u7136\u751F\u6548\uFF09",
@@ -22931,6 +22933,7 @@ function reviewTurn(fields2) {
22931
22933
  forReviewer: false,
22932
22934
  asItem: void 0,
22933
22935
  ack: "",
22936
+ onBehalf: false,
22934
22937
  ...fields2
22935
22938
  };
22936
22939
  }
@@ -22966,7 +22969,8 @@ var FOLLOW_FIELDS = [
22966
22969
  "reviewOnly:review_only",
22967
22970
  "mergeHeld:merge_held",
22968
22971
  "lang:lang",
22969
- "where:where"
22972
+ "where:where",
22973
+ "onBehalf:on_behalf"
22970
22974
  ];
22971
22975
  function followRecord(review, wire) {
22972
22976
  if (review.item === void 0) throw new TypeError("a followed review has an item");
@@ -23003,6 +23007,7 @@ function reviewOfRecord(raw) {
23003
23007
  mergeHeld: record6.merge_held === true,
23004
23008
  lang: record6.lang === "en" ? "en" : "zh",
23005
23009
  where: text7(record6.where),
23010
+ onBehalf: record6.on_behalf === true,
23006
23011
  pull: pullRef2
23007
23012
  });
23008
23013
  review.item = {
@@ -23438,6 +23443,7 @@ function reviewAsk(fields2) {
23438
23443
  unread: [],
23439
23444
  merge: true,
23440
23445
  handoffId: "",
23446
+ origin: "",
23441
23447
  ...fields2
23442
23448
  };
23443
23449
  }
@@ -24913,12 +24919,6 @@ function ownItemEndText(review) {
24913
24919
  const merge = statuses.has("merged") ? "\uFF0C\u5DF2\u5408\u5165" : statuses.has("queued") ? "\uFF0C\u5DF2\u52A0\u5165\u5408\u5E76\u961F\u5217" : "\uFF0C\u6CA1\u6709\u5408\u5165";
24914
24920
  return `\u5DF2\u7ED3\u675F\uFF1A${verdict ? `\u7ED3\u8BBA\uFF1A${verdict}` : "\u5DF2\u5B8C\u6210"}${merge}`;
24915
24921
  }
24916
- function reviewerResultText(review, view7) {
24917
- const line3 = prSummaryLine(view7.prSummary);
24918
- return `${askerName(review)}\u8BF7\u4F60\u4EE3\u5BA1\u7684 ${shortName(review.pull)}\uFF1A${viewWords(view7)}\u3002${line3 ? `
24919
- ${line3}
24920
- ` : ""}\u8BE6\u60C5\u5728\u4F60\u7684\u770B\u677F\u4E0A\uFF08/board\uFF09\u3002`;
24921
- }
24922
24922
  function viewStage(view7) {
24923
24923
  if (view7.status === "queued") return "queued";
24924
24924
  if (viewFinished(view7)) return `end:${view7.status}:${view7.verdict}:${view7.merged ? "1" : "0"}`;
@@ -24935,6 +24935,12 @@ function stageVerdict(stage) {
24935
24935
  if (parts2[0] === "end") return parts2[2] ?? "";
24936
24936
  return (parts2[0] === "wait" || parts2[0] === "verdict") && parts2.length > 1 ? parts2[1] ?? "" : "";
24937
24937
  }
24938
+ function isNewsStage(stage, onBehalf = false) {
24939
+ if (onBehalf) return stage === "failed";
24940
+ const [kind, verdict] = stage.split(":");
24941
+ if (kind === "end" || kind === "failed" || kind === "wait") return true;
24942
+ return kind === "verdict" && (verdict === "request_changes" || verdict === "comment");
24943
+ }
24938
24944
  function foundWords(view7) {
24939
24945
  if (view7.findings === null) return "";
24940
24946
  if (view7.findings === 0) return view7.verdict ? "\uFF1B\u6CA1\u6709\u63D0\u51FA\u5F85\u6539\u7684\u95EE\u9898" : "";
@@ -25000,19 +25006,6 @@ function unfinishedText(left) {
25000
25006
  return `${who} \u7684\u4EE3\u5BA1\u8FD8\u6709 ${String(left.length)} \u4E2A\u6CA1\u6709\u7ED3\u675F\uFF0C\u7ED3\u679C\u8BF7\u770B PR\uFF1A
25001
25007
  ${left.map((e) => `- ${pullUrl(e.review.pull)}`).join("\n")}`;
25002
25008
  }
25003
- function reviewerEndedText(ended2) {
25004
- const [first] = ended2;
25005
- if (first === void 0) return "";
25006
- if (ended2.length === 1) return reviewerResultText(first[0].review, first[1]);
25007
- const lines = ended2.map(([e, v]) => {
25008
- const line3 = prSummaryLine(v.prSummary);
25009
- return `- ${shortName(e.review.pull)}\uFF1A${viewWords(v)}${line3 ? `
25010
- ${line3}` : ""}`;
25011
- });
25012
- return `${askerName(first[0].review)}\u8BF7\u4F60\u4EE3\u5BA1\u7684 ${String(ended2.length)} \u4E2A PR \u7ED3\u675F\u4E86\uFF1A
25013
- ${lines.join("\n")}
25014
- \u8BE6\u60C5\u5728\u4F60\u7684\u770B\u677F\u4E0A\uFF08/board\uFF09\u3002`;
25015
- }
25016
25009
 
25017
25010
  // packages/core/src/review/service/follow.ts
25018
25011
  var REQUESTER_VIEW_MS = 3e4;
@@ -25020,6 +25013,7 @@ var REQUESTER_VIEW_LIMIT_SECONDS = 24 * 3600;
25020
25013
  var VIEW_SETTLE_MS = 9e4;
25021
25014
  var VIEW_HOLD_MS = 6e5;
25022
25015
  var DEADLINE_TRIES = 10;
25016
+ var DEADLINE_GRACE_SECONDS = 3600;
25023
25017
  function waitsNewly(entry, view7) {
25024
25018
  return viewWaitsForReviewer(view7) && view7.waitingFor !== "failed" && !entry.reviewerTold;
25025
25019
  }
@@ -25131,27 +25125,36 @@ var AskerFollow = class {
25131
25125
  first: 0,
25132
25126
  last: 0
25133
25127
  };
25128
+ const end = deadline + DEADLINE_GRACE_SECONDS;
25134
25129
  let tries = 0;
25130
+ let readAtDeadline = false;
25131
+ let readTried = false;
25135
25132
  try {
25136
25133
  while (state.open.size || state.news.size) {
25137
25134
  if (!state.open.size) {
25138
25135
  await this.deps.clock.sleep(this.viewMs);
25139
- if (!await this.tryFlush(entries, conversation, state)) tries += 1;
25140
- if (tries >= DEADLINE_TRIES) return;
25136
+ if (!await this.tryFlush(entries, conversation, state)) {
25137
+ tries += 1;
25138
+ if (tries >= DEADLINE_TRIES || this.deps.store.now() >= end) {
25139
+ if (this.deps.store.now() >= deadline) this.letGo(entries);
25140
+ return;
25141
+ }
25142
+ }
25141
25143
  continue;
25142
25144
  }
25143
- if (this.deps.store.now() >= deadline) {
25144
- if (await this.atDeadline(entries, conversation, state, ++tries)) return;
25145
+ const now = this.deps.store.now();
25146
+ if (now >= deadline) {
25147
+ if (!readAtDeadline && (!readTried || now < end)) {
25148
+ readTried = true;
25149
+ readAtDeadline = await this.safeRound(entries, conversation, state);
25150
+ if (!readAtDeadline) await this.deps.clock.sleep(this.viewMs);
25151
+ continue;
25152
+ }
25153
+ if (await this.atDeadline(entries, conversation, state, ++tries, end)) return;
25145
25154
  continue;
25146
25155
  }
25147
25156
  await this.deps.clock.sleep(this.viewMs);
25148
- try {
25149
- await this.round(entries, conversation, state);
25150
- } catch (err2) {
25151
- this.deps.logger.warn("a round of following a request's reviews for their asker failed", {
25152
- error: errorName(err2)
25153
- });
25154
- }
25157
+ await this.safeRound(entries, conversation, state);
25155
25158
  }
25156
25159
  } finally {
25157
25160
  for (const entry of entries) {
@@ -25165,14 +25168,17 @@ var AskerFollow = class {
25165
25168
  await this.flush(entries, conversation, state);
25166
25169
  return true;
25167
25170
  } catch (err2) {
25168
- this.deps.logger.warn("the end of a request's reviews could not be said to their asker", {
25171
+ this.deps.logger.warn("what a request's reviews have to tell could not be said to their asker", {
25169
25172
  error: errorName(err2)
25170
25173
  });
25171
25174
  return false;
25172
25175
  }
25173
25176
  }
25174
- /** The deadline: what is held is said, then that the rest is still open; the rows go once the asker has been told. */
25175
- async atDeadline(entries, conversation, state, tries) {
25177
+ /**
25178
+ * The deadline: what is held is said, then that the rest is still open; the rows go once the asker has been told (or the tries ran out, or
25179
+ * `end` came).
25180
+ */
25181
+ async atDeadline(entries, conversation, state, tries, end) {
25176
25182
  const left = [...state.open.values()];
25177
25183
  try {
25178
25184
  if (state.news.size) await this.flush(entries, conversation, state);
@@ -25180,14 +25186,18 @@ var AskerFollow = class {
25180
25186
  if (first !== void 0) await this.sayToAsker(first.review, conversation, unfinishedText(left));
25181
25187
  } catch (err2) {
25182
25188
  this.deps.logger.warn("the asker could not be told their reviews are still open", { error: errorName(err2) });
25183
- if (tries < DEADLINE_TRIES) {
25189
+ if (tries < DEADLINE_TRIES && this.deps.store.now() < end) {
25184
25190
  await this.deps.clock.sleep(this.viewMs);
25185
25191
  return false;
25186
25192
  }
25187
25193
  }
25188
- for (const entry of left) this.deps.store.reviewDelegation.dropAskerFollow(followedItemId(entry));
25194
+ this.letGo(entries);
25189
25195
  return true;
25190
25196
  }
25197
+ /** The follow is over: none of its rows is kept. */
25198
+ letGo(entries) {
25199
+ for (const entry of entries) this.deps.store.reviewDelegation.dropAskerFollow(followedItemId(entry));
25200
+ }
25191
25201
  /** The asker's view of one item now; undefined when it is not followed any more, "running" for a moment's trouble. */
25192
25202
  async viewOf(entry, state) {
25193
25203
  const itemId = followedItemId(entry);
@@ -25212,8 +25222,24 @@ var AskerFollow = class {
25212
25222
  return "trouble";
25213
25223
  }
25214
25224
  }
25225
+ /** One round, never the end of the follow (the items run in Claw all the same); false when a view could not be read or the round failed. */
25226
+ async safeRound(entries, conversation, state) {
25227
+ try {
25228
+ return await this.round(entries, conversation, state);
25229
+ } catch (err2) {
25230
+ this.deps.logger.warn("a round of following a request's reviews for their asker failed", {
25231
+ error: errorName(err2)
25232
+ });
25233
+ return false;
25234
+ }
25235
+ }
25236
+ /**
25237
+ * Reads each open item's view and says what is due; false when a view could not be read just now (a moment's trouble). Only that: news
25238
+ * that could not be said (a chat that is gone) is held for the next round and leaves the views as read as they were.
25239
+ */
25215
25240
  async round(entries, conversation, state) {
25216
25241
  let running = false;
25242
+ let read = true;
25217
25243
  const waiting = [];
25218
25244
  for (const entry of [...state.open.values()]) {
25219
25245
  if (await this.endStopped(entry, state)) continue;
@@ -25221,6 +25247,7 @@ var AskerFollow = class {
25221
25247
  if (view7 === "gone") continue;
25222
25248
  if (view7 === "trouble") {
25223
25249
  running = true;
25250
+ read = false;
25224
25251
  continue;
25225
25252
  }
25226
25253
  if (waitsNewly(entry, view7)) waiting.push([entry, view7.prSummary]);
@@ -25234,7 +25261,8 @@ var AskerFollow = class {
25234
25261
  }
25235
25262
  const now = this.deps.clock.monotonicMs();
25236
25263
  const due = !running || !state.open.size || now - state.last >= VIEW_SETTLE_MS || now - state.first >= VIEW_HOLD_MS;
25237
- if (state.news.size && due) await this.flush(entries, conversation, state);
25264
+ if (state.news.size && due) await this.tryFlush(entries, conversation, state);
25265
+ return read;
25238
25266
  }
25239
25267
  /** An item the asker stopped on its card: that card is left as the press made it, and said there. */
25240
25268
  async endStopped(entry, state) {
@@ -25252,9 +25280,27 @@ var AskerFollow = class {
25252
25280
  const itemId = followedItemId(entry);
25253
25281
  if (view7.status === "queued") entry.seenQueued = true;
25254
25282
  else if (!viewFinished(view7) && (entry.seenQueued || entry.said === "queued")) await this.cards.started(itemId);
25283
+ const stage = this.holdNews(entry, view7, state);
25284
+ if (viewFinished(view7)) {
25285
+ state.open.delete(itemId);
25286
+ await this.cards.end(itemId, itemEndText(view7), view7.prSummary);
25287
+ if (stage === entry.said) this.deps.store.reviewDelegation.dropAskerFollow(itemId);
25288
+ }
25289
+ }
25290
+ /**
25291
+ * What the view's stage is to the asker: news to hold for the next message, a change they are not told (an approval not merged yet, that
25292
+ * the review started) or back to what was said. A change not told is kept as what was seen, so that a later message counts the review
25293
+ * right, and it lets go of news held from before it. Returns the stage.
25294
+ */
25295
+ holdNews(entry, view7, state) {
25296
+ const itemId = followedItemId(entry);
25255
25297
  const stage = entryStage(entry, view7);
25256
25298
  const held = state.news.get(itemId);
25257
- if (stage && stage !== entry.said) {
25299
+ if (stage && stage !== entry.said && !isNewsStage(stage, entry.review.onBehalf)) {
25300
+ state.news.delete(itemId);
25301
+ entry.said = stage;
25302
+ this.deps.store.reviewDelegation.askerFollowSaid(itemId, stage);
25303
+ } else if (stage && stage !== entry.said) {
25258
25304
  if (held === void 0 || entryStage(entry, held[1]) !== stage) {
25259
25305
  const now = this.deps.clock.monotonicMs();
25260
25306
  state.first = state.first || now;
@@ -25264,11 +25310,7 @@ var AskerFollow = class {
25264
25310
  } else if (held !== void 0 && stage === entry.said) {
25265
25311
  state.news.delete(itemId);
25266
25312
  }
25267
- if (viewFinished(view7)) {
25268
- state.open.delete(itemId);
25269
- await this.cards.end(itemId, itemEndText(view7), view7.prSummary);
25270
- if (stage === entry.said) this.deps.store.reviewDelegation.dropAskerFollow(itemId);
25271
- }
25313
+ return stage;
25272
25314
  }
25273
25315
  /** Says the held news in one message; what is said is recorded first, and put back when the message did not go. */
25274
25316
  async flush(entries, conversation, state) {
@@ -25292,9 +25334,6 @@ var AskerFollow = class {
25292
25334
  state.first = state.last = 0;
25293
25335
  for (const [entry, view7] of told)
25294
25336
  if (viewFinished(view7)) this.deps.store.reviewDelegation.dropAskerFollow(followedItemId(entry));
25295
- const ended2 = told.filter(([, v]) => viewFinished(v));
25296
- const [one] = ended2;
25297
- if (one !== void 0) await this.notices.tellReviewer(one[0].review, reviewerEndedText(ended2));
25298
25337
  }
25299
25338
  /** A line for the asker where they asked: in a group it @mentions them (and only them). */
25300
25339
  async sayToAsker(review, conversation, text9) {
@@ -25643,6 +25682,7 @@ var ReviewItems = class {
25643
25682
  review.modelReported = true;
25644
25683
  }
25645
25684
  review.forReviewer = Boolean(request.actingToken);
25685
+ review.onBehalf = review.onBehalf === true && one.origin === "on_behalf";
25646
25686
  taken.push(review);
25647
25687
  }
25648
25688
  return taken;
@@ -25727,8 +25767,11 @@ function markHeld(reviews, handedOver) {
25727
25767
  review.mergeHeld = told === true || told === null && review.item !== void 0 && handedOver;
25728
25768
  }
25729
25769
  }
25770
+ function summedUp(review) {
25771
+ return review.onBehalf === true && review.item !== void 0;
25772
+ }
25730
25773
  function stopHint(reviews, group) {
25731
- if (!reviews.some((r) => r.item !== void 0)) return "";
25774
+ if (!reviews.some((r) => r.item !== void 0) || reviews.every(summedUp)) return "";
25732
25775
  return group ? reviewStartText.stopInGroup : reviewStartText.stopHere;
25733
25776
  }
25734
25777
  var ReviewLaunch = class {
@@ -25753,7 +25796,8 @@ var ReviewLaunch = class {
25753
25796
  async launch(s, held, handed) {
25754
25797
  const who = s.actor.name || "\u5BF9\u65B9";
25755
25798
  const readAs = reviewStartText.readAs(s.ask.repo);
25756
- let unread = s.ask.unread.length ? reviewStartText.unreadNumbers(s.ask.unread.map((n) => `#${String(n)}`).join("\u3001")) : "";
25799
+ const unreadNumbers = s.ask.unread.length ? reviewStartText.unreadNumbers(s.ask.unread.map((n) => `#${String(n)}`).join("\u3001")) : "";
25800
+ let unread = unreadNumbers;
25757
25801
  const reviewerMode = s.reviews.length ? await modeOf(this.deps, s.actor.userId) : "";
25758
25802
  for (const review of s.reviews) review.reviewMode = isReviewMode(reviewerMode) ? reviewerMode : DEFAULT_MODE;
25759
25803
  let reviews = s.reviews;
@@ -25775,7 +25819,7 @@ var ReviewLaunch = class {
25775
25819
  await this.postCards(s, carded);
25776
25820
  return;
25777
25821
  }
25778
- await this.acknowledge(s, reviews, readAs, unread, reviewerMode === "fully_auto");
25822
+ await this.acknowledge(s, reviews, readAs, unread, reviewerMode === "fully_auto", unreadNumbers !== "");
25779
25823
  await this.run(s, reviews, handed);
25780
25824
  await this.postCards(s, carded);
25781
25825
  }
@@ -25842,7 +25886,7 @@ var ReviewLaunch = class {
25842
25886
  await say2(this.deps, s.ctx.conversation, text9);
25843
25887
  }
25844
25888
  /** The acknowledgement: one message for several reviews, else at the top of the review's progress message. */
25845
- async acknowledge(s, reviews, readAs, unread, auto) {
25889
+ async acknowledge(s, reviews, readAs, unread, auto, numbersLeftOut) {
25846
25890
  const who = s.actor.name || "\u5BF9\u65B9";
25847
25891
  const [first] = reviews;
25848
25892
  if (first === void 0) return;
@@ -25852,6 +25896,7 @@ var ReviewLaunch = class {
25852
25896
  reviews.find((r) => r.forReviewer),
25853
25897
  s.ctx.conversation.caps.shortName
25854
25898
  );
25899
+ if (reviews.every(summedUp) && !this.needsWords(s, reviews, numbersLeftOut || reach !== "")) return;
25855
25900
  const setting = [mergeLine(reviews, who, s.ask.merge, auto), reach].filter(Boolean).join("\n\n");
25856
25901
  const stop = stopHint(reviews, s.ctx.group);
25857
25902
  const verb = s.ask.merge ? "review \u5408\u5165" : "review\uFF08\u53EA review\uFF0C\u4E0D\u5408\u5165\uFF09";
@@ -25868,6 +25913,14 @@ var ReviewLaunch = class {
25868
25913
  first.ack = reviewStartText.single(readAs, who, verb, shortName(first.pull), note) + chosen + setting + unread + stop;
25869
25914
  }
25870
25915
  }
25916
+ /**
25917
+ * Whether the receipt of a request the person's coordinator sent for them says anything: Claw sums up how it ended, so only what they
25918
+ * must act on is said: a review that waits for a slot, one that did not start, a number that was not read as a pull request, and a
25919
+ * reviewer who cannot be reached for a confirmation (`other`).
25920
+ */
25921
+ needsWords(s, reviews, other) {
25922
+ return other || s.refused.length > 0 || reviews.some((r) => r.item?.queued);
25923
+ }
25871
25924
  severalText(s, reviews, p) {
25872
25925
  const lined = reviews.some((r) => r.item?.queued);
25873
25926
  const head = reviewStartText.several({
@@ -25897,7 +25950,6 @@ ${p.setting}` : "") + refused3 + p.unread + p.stop;
25897
25950
  if (review.forReviewer) {
25898
25951
  if (review.ack) await say2(this.deps, s.ctx.conversation, review.ack);
25899
25952
  followed.push(review);
25900
- await this.notices.tellReviewerStarted(review);
25901
25953
  continue;
25902
25954
  }
25903
25955
  const message = s.several ? { ...s.ctx.message, id: `${s.ctx.message.id}-${String(index + 1)}` } : s.ctx.message;
@@ -25984,12 +26036,12 @@ ${p.setting}` : "") + refused3 + p.unread + p.stop;
25984
26036
  item: started.item?.itemId ?? ""
25985
26037
  });
25986
26038
  this.follows.follow([started], s.ctx.conversation);
25987
- await this.notices.tellReviewerStarted(started);
25988
26039
  await this.postCards(s, [started]);
25989
26040
  return true;
25990
26041
  }
25991
26042
  /** The cards with Stop, in the asker's own chat (a group's request too). */
25992
26043
  async postCards(s, reviews) {
26044
+ if (reviews.every(summedUp)) return;
25993
26045
  if (!reviews.some((r) => r.item !== void 0)) return;
25994
26046
  let target = s.ctx.conversation;
25995
26047
  if (s.ctx.group) {
@@ -26058,26 +26110,6 @@ var Notices = class {
26058
26110
  reviewerChat(review) {
26059
26111
  return personalChat(this.deps, { userId: review.actorId, channelUserId: review.actorChannelId }, review.asked);
26060
26112
  }
26061
- async tellReviewer(review, text9) {
26062
- try {
26063
- const chat = await this.reviewerChat(review);
26064
- if (chat !== void 0) await say2(this.deps, chat, text9);
26065
- } catch (err2) {
26066
- this.deps.logger.warn("the reviewer could not be told about a review asked of them", { error: errorName(err2) });
26067
- }
26068
- }
26069
- /** The reviewer hears, in their own chat, that someone asked a review of them and that it is an item on their board. */
26070
- async tellReviewerStarted(review) {
26071
- const item = review.item;
26072
- const seq = item?.seq ? `\uFF08\u4E8B\u9879 #${String(item.seq)}\uFF09` : "";
26073
- const verb = review.reviewOnly ? "review\uFF08\u53EA review\uFF0C\u4E0D\u5408\u5165\uFF09" : "review \u5408\u5165";
26074
- const held = review.mergeHeld && !review.reviewOnly ? "\u5408\u5165\u524D\u4F1A\u5148\u8BF7\u4F60\u786E\u8BA4\uFF08\u5361\u7247\u6309\u94AE\u6216\u56DE\u590D\u300C\u6279\u51C6 #\u7F16\u53F7\u300D\uFF09\uFF0C\u4F60\u786E\u8BA4\u4E4B\u524D\u4E0D\u4F1A\u5408\u5165\u3002" : "";
26075
- const state = item?.queued ? `\u5DF2\u4F5C\u4E3A\u4F60\u770B\u677F\u4E0A\u7684\u4E8B\u9879\u6392\u961F${seq}\uFF08${queueReason(item.queued, "\u4F60", askerName(review), true)}\uFF09\uFF0C\u540D\u989D\u7A7A\u51FA\u540E\u4F1A\u81EA\u52A8\u5F00\u59CB` : `\u5DF2\u4F5C\u4E3A\u4F60\u770B\u677F\u4E0A\u7684\u4E8B\u9879\u5F00\u59CB${seq}`;
26076
- await this.tellReviewer(
26077
- review,
26078
- `${askerName(review)}\u5728${review.where}\u8BF7\u4F60\u4EE3 ${verb} ${shortName(review.pull)}\uFF0C${state}\uFF0C\u7528\u4F60\u7684 GitHub \u8D26\u53F7\u548C\u4F60\u7684\u6A21\u578B\u989D\u5EA6\u3002${held}\u53D1 /board \u67E5\u770B\u6216\u505C\u6B62\u3002`
26079
- );
26080
- }
26081
26113
  /** The reviewer's item as Claw shows it to them, read with their own key; undefined when it cannot be. */
26082
26114
  async reviewersItem(review) {
26083
26115
  const key = review.item ? this.deps.store.links.getKey(review.actorId) : null;
@@ -26305,6 +26337,7 @@ function keptOf(row2) {
26305
26337
  models: Array.isArray(r.models) ? r.models.filter((m) => typeof m === "string" && m !== "") : [],
26306
26338
  note: str6(r.note),
26307
26339
  handoffId: str6(r.handoffId),
26340
+ origin: r.origin === "on_behalf" ? "on_behalf" : "",
26308
26341
  askedAt: typeof r.askedAt === "number" ? r.askedAt : 0,
26309
26342
  asked: asked3,
26310
26343
  group: r.group === true,
@@ -26381,6 +26414,7 @@ var ReviewerOnboarding = class {
26381
26414
  models: [...ask3.models],
26382
26415
  note: ctx.text,
26383
26416
  handoffId: ask3.handoffId,
26417
+ origin: ask3.origin,
26384
26418
  askedAt: epochSeconds(this.deps.clock),
26385
26419
  asked: ctx.conversation.ref.wire,
26386
26420
  group: ctx.group,
@@ -26653,7 +26687,9 @@ var ReviewerOnboarding = class {
26653
26687
  merge: kept.merge,
26654
26688
  models: kept.models,
26655
26689
  named: [kept.actor.channelUserId],
26656
- handoffId: fresh ? kept.handoffId : ""
26690
+ handoffId: fresh ? kept.handoffId : "",
26691
+ // (it is Claw's record of the handoff that says where the request came from: an ask without it is an ordinary one)
26692
+ origin: fresh ? kept.origin : ""
26657
26693
  });
26658
26694
  const message = {
26659
26695
  type: "message",
@@ -27337,7 +27373,8 @@ var ReviewChecks = class {
27337
27373
  fromGroup: ctx.group,
27338
27374
  lang: pickLang(ctx.text),
27339
27375
  reviewOnly: !ask3.merge,
27340
- actorLogin: state.login
27376
+ actorLogin: state.login,
27377
+ onBehalf: ask3.origin === "on_behalf"
27341
27378
  });
27342
27379
  reviews.push(review);
27343
27380
  tickets.set(review, ticket);
@@ -27705,7 +27742,8 @@ var GithubReview = class {
27705
27742
  pulls: handoff.pulls,
27706
27743
  merge: handoff.merge,
27707
27744
  named: [channelUserId],
27708
- handoffId: handoff.handoffId
27745
+ handoffId: handoff.handoffId,
27746
+ origin: handoff.origin ?? ""
27709
27747
  });
27710
27748
  const ctx = {
27711
27749
  message,
@@ -27909,7 +27947,9 @@ var handoffSchema = z7.object({
27909
27947
  merge: z7.boolean(),
27910
27948
  requester_note: z7.string().optional().default(""),
27911
27949
  handoff_id: z7.string().max(128).optional().default(""),
27912
- held_says: z7.array(z7.string()).optional().default([])
27950
+ held_says: z7.array(z7.string()).optional().default([]),
27951
+ // (read as what it is, never refused for its value: an optional field a later Claw may widen)
27952
+ origin: z7.unknown().optional()
27913
27953
  });
27914
27954
  function parseReviewHandoff(raw) {
27915
27955
  const parsed = handoffSchema.safeParse(raw);
@@ -27930,7 +27970,8 @@ function parseReviewHandoff(raw) {
27930
27970
  merge: data.merge,
27931
27971
  note: cpHead(pyStrip(data.requester_note), REQUESTER_NOTE_MAX),
27932
27972
  handoffId: pyStrip(data.handoff_id),
27933
- said: said2
27973
+ said: said2,
27974
+ origin: data.origin === "on_behalf" ? "on_behalf" : ""
27934
27975
  };
27935
27976
  }
27936
27977
 
@@ -28354,6 +28395,444 @@ function hiddenOf(agent) {
28354
28395
 
28355
28396
  // packages/core/src/remote/events.ts
28356
28397
  import { z as z8 } from "zod";
28398
+
28399
+ // packages/core/src/locales/connector-reasons.ts
28400
+ var connectorReasonText = defineCatalog({
28401
+ en: {
28402
+ mode_unavailable: 'The agent on that machine does not offer the permission mode this session needs. Most often the connector runs as root and the agent has `approval = "never"`: Claude offers no bypassPermissions mode to root, so a connector older than 0.1.5 refuses the session.',
28403
+ mode_not_enforced: 'The agent could not be put in the permission mode the connector requires (or warned it will no longer ask), so the connector closed the session to stay safe. This happens with Claude running as root (older connectors), or when Claude\'s `permissions.defaultMode` is bypassPermissions and the agent has no `approval = "never"`.',
28404
+ mode_not_confirmed: "The agent did not confirm the permission mode it was asked for, so the connector closed the session to stay safe. Upgrade the connector (it brings a newer agent adapter) and try again.",
28405
+ mode_mismatch: "The agent reported a different permission mode from the one it was asked for, so the connector closed the session to stay safe. Upgrade the connector and try again; if it persists, check Claude's settings there.",
28406
+ mode_not_allowed: 'That mode does not ask before each step, and the agent is not allowed to run that way on that machine. To allow it, set `approval = "never"` on the agent in agents.toml and restart the connector; otherwise pick a mode that asks.',
28407
+ mode_id_required: "The mode switch named no mode. Tap Mode and pick one again.",
28408
+ set_mode_failed: "The agent could not switch its mode; it keeps the one it had.",
28409
+ adapter_gone: "The agent program on that machine has exited.",
28410
+ adapter_start_failed: "The connector could not start the agent program on that machine (often: no access to the npm registry, or the command is missing). Run `claw-connector status` there and look at `run.log` in its state directory.",
28411
+ adapter_unavailable: "The connector could not start the agent program for this turn.",
28412
+ adapter_protocol: "The agent program answered in a way the connector does not expect, most likely a version mismatch. Upgrade the connector and try again.",
28413
+ adapter_cannot_resume: "This agent cannot pick up the earlier conversation.",
28414
+ adapter_error: "The agent program failed. Look at `run.log` in the connector's state directory on that machine.",
28415
+ agent_auth_required: "The agent is not signed in on that machine. Run the agent there once (`claude`, for example) to sign in, then try again.",
28416
+ cwd_outside_roots: "That directory is outside the roots the agent may work in. Pick one inside them, or add it to `roots` in agents.toml and restart the connector.",
28417
+ cwd_not_found: "That folder does not exist on that machine: pick one that exists there, or create it there first.",
28418
+ cwd_not_directory: "That path is not a directory.",
28419
+ cwd_not_absolute: "The directory must be an absolute path (starting with /).",
28420
+ invalid_cwd: "That directory name is not valid.",
28421
+ cwd_mismatch: "That conversation is not in this directory. Pick it again from the list.",
28422
+ unknown_agent: "That machine has no such agent (agents.toml may have changed). Check agents.toml there and restart the connector after a change.",
28423
+ not_delivered: "The machine never got it, so nothing ran: it looked online when it was sent but had gone (a laptop closed, for one). Send it again once the machine is back.",
28424
+ delivery_unconfirmed: "The machine went just as this was sent and did not confirm it got it, so it may not have run. If it does once the machine is back, what it says shows up here.",
28425
+ connector_revoked: "That machine's connector was signed out (logout or `/agent off`), and its sessions closed with it. To go on, sign the connector in again there and start a new session.",
28426
+ machine_reconnected: "That machine registered again (a reinstall, lost local state or a rebuilt container), and the old session closed with its old registration.",
28427
+ unknown_session: "The connector no longer knows this session (it may have restarted).",
28428
+ too_many_sessions: "Too many sessions are open on that machine. Close one with `/agent close` first.",
28429
+ resume_not_supported: "This agent cannot continue an existing session.",
28430
+ attach_unavailable: "This agent cannot take over a terminal conversation. Configure an agent with the `claude-attach` preset for that.",
28431
+ resume_ref_required: "No conversation was named to take over. Pick one from the list.",
28432
+ invalid_resume_ref: "That conversation reference is not valid. Pick one from the list.",
28433
+ already_attached: "That conversation is already open from the phone. Switch to it with `/agent sessions`.",
28434
+ catalog_unavailable: "The connector could not read the list of conversations on that machine.",
28435
+ session_live: "That conversation is still open in a terminal on that machine. Quit it there first, then take it over.",
28436
+ recently_written: "A terminal wrote to that conversation moments ago and may still be using it. Try again in {wait}.",
28437
+ twin_check_failed: "The connector could not check whether the conversation is still open in a terminal, so it did not take it over.",
28438
+ terminal_did_not_exit: "The terminal did not let the conversation go when asked, so it was not taken over; it is still there. Quit it in the terminal first, then take it over.",
28439
+ session_live_elsewhere: "That conversation is open on another machine or container sharing the Claude config directory; it cannot be ended from here, so it was not taken over. Quit it there, then try again.",
28440
+ takeover_not_permitted: "The terminal holding the conversation belongs to another user, so the connector may not end it; it was not taken over.",
28441
+ takeover_failed: "Ending the terminal's hold on the conversation failed, so it was not taken over.",
28442
+ // (since connector 0.1.19 a running turn never holds a message back: Claude Code queues it; only someone's half-typed text in
28443
+ // the box, or a screen scrolled back, held for 10 minutes ends it terminal_busy)
28444
+ terminal_busy: "Someone was typing in the terminal (or had it scrolled back) for 10 minutes, so the message was not typed in. Send it again later.",
28445
+ // (Claude Code took the message into its own queue, then someone at the terminal pulled that queue back into the box)
28446
+ terminal_input_withdrawn: "The message was in Claude Code's queue in the terminal, but someone there pulled the queue back into the input box (up-arrow to edit), so it was not sent as the phone's message; it is now in the terminal's input box. To send it, press Enter in the terminal, or send it again from the phone.",
28447
+ // (a terminal whose Claude Code cannot be told to hold this conversation, for 10 minutes)
28448
+ terminal_state_unknown: "For 10 minutes the connector could not confirm that the terminal's Claude Code still has this conversation open, so the message was not typed in. Look at the terminal, make sure it is still on this conversation, and send again.",
28449
+ terminal_gone: "The terminal's tmux pane is gone, so the message was not typed in.",
28450
+ terminal_switched: "That terminal has moved to another conversation (a /resume or /clear there), so the message was not typed in.",
28451
+ terminal_input_failed: "Typing the message into the terminal failed; it was not sent.",
28452
+ // (a connector after 0.1.22: the paste never showed in the box in the 20 seconds it waited)
28453
+ 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.",
28454
+ // (not a failure: the terminal may well have taken it; what the session does next still shows here)
28455
+ 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.",
28456
+ terminal_input_unavailable: "After a restart the connector could not prove that terminal again, so the message was not typed in. Attach again.",
28457
+ empty_prompt: "The message was empty once its control characters were removed; nothing was typed.",
28458
+ // (a prompt to a session that only watches a terminal's conversation; also a turn_end error)
28459
+ read_only_live_session: "That conversation is open in a terminal on that machine and can only be watched from here, so the message was not sent. Type it in the terminal, or take the conversation over first.",
28460
+ terminal_session: "That conversation is open in a terminal, which keeps its own mode.",
28461
+ terminal_mode_not_allowed: "The terminal's conversation is in a permission mode that does not ask (auto, for example), which this agent's approval setting does not allow from the phone, so the message was not typed in. Switch the terminal to a mode that asks (shift+tab in Claude Code: manual or plan) and send again, or set `approval = \"never\"` for this agent in agents.toml on that machine.",
28462
+ terminal_mode_unknown: "The connector could not read which permission mode the terminal's conversation is in, so nothing was typed. Make sure Claude Code there is up to date and shows its mode below the input box, then send again.",
28463
+ terminal_screen_unknown: "The connector could not read the terminal's screen for 30 seconds (no Claude Code input box, and it did not say it was busy), so the message was not typed in. Look at the terminal, close whatever is on it, and send again.",
28464
+ terminal_command_refused: "A message that starts with ! or / would run a command in that terminal, so it is not typed from the phone. Rephrase it, or run the command at the terminal.",
28465
+ takeover_expired: "The confirmation to take that conversation over reached the machine too late; it was not taken over. Open it again and confirm again.",
28466
+ cwd_ambiguous: "More than one of this agent's roots has a folder by that name. Give its full path.",
28467
+ root_unavailable: "The folder's disk is not answering on that machine (a network mount that is down or not mounted yet). Try again in a minute, or check the mount there.",
28468
+ session_closed: "That session has already closed.",
28469
+ closed: "The session was closed as asked.",
28470
+ stopped: "The connector on that machine was stopped. Start it again there (`claw-connector run`, or the service's `sh keepalive.sh`).",
28471
+ paused: "The connector on that machine is paused. Run `claw-connector resume` there.",
28472
+ revoked: "That machine's connector was revoked. Run `{login}` there to sign in again.",
28473
+ text_required: "The message to the agent was empty.",
28474
+ action_and_option_required: "That answer named no request or option. Tap the card again.",
28475
+ too_many_queued_prompts: "The agent has too many messages waiting; this one was not taken. Send it again when it has caught up.",
28476
+ cancelled: "That message was dropped unrun when the agent was stopped.",
28477
+ unknown_action: "That approval request is gone.",
28478
+ option_not_offered: "That option is not one the agent offered."
28479
+ },
28480
+ zh: {
28481
+ mode_unavailable: '\u90A3\u53F0\u673A\u5668\u4E0A\u7684 agent \u4E0D\u63D0\u4F9B\u8FD9\u4E2A\u4F1A\u8BDD\u9700\u8981\u7684\u6743\u9650\u6A21\u5F0F\u3002\u6700\u5E38\u89C1\u7684\u539F\u56E0\uFF1A\u8FDE\u63A5\u5668\u4EE5 root \u8FD0\u884C\u4E14\u8BE5 agent \u8BBE\u4E86 `approval = "never"`\uFF0Croot \u4E0B\u7684 Claude \u4E0D\u63D0\u4F9B bypassPermissions\uFF0C\u65E7\u7248\u8FDE\u63A5\u5668\uFF080.1.5 \u4E4B\u524D\uFF09\u56E0\u6B64\u62D2\u7EDD\u5F00\u4F1A\u8BDD\u3002',
28482
+ mode_not_enforced: 'agent \u6CA1\u80FD\u5207\u5230\u8FDE\u63A5\u5668\u8981\u6C42\u7684\u6743\u9650\u6A21\u5F0F\uFF08\u6216\u63D0\u793A\u5B83\u4E0D\u4F1A\u518D\u9010\u6B65\u8BE2\u95EE\uFF09\uFF0C\u8FDE\u63A5\u5668\u4E3A\u5B89\u5168\u8D77\u89C1\u5173\u95ED\u4E86\u4F1A\u8BDD\u3002\u5E38\u89C1\u4E8E root \u4E0B\u7684 Claude \uFF08\u65E7\u7248\u8FDE\u63A5\u5668\uFF09\uFF0C\u6216 Claude \u7684 `permissions.defaultMode` \u662F bypassPermissions \u800C\u8BE5 agent \u6CA1\u8BBE `approval = "never"`\u3002',
28483
+ mode_not_confirmed: "agent \u6CA1\u6709\u786E\u8BA4\u5B83\u5DF2\u5207\u5230\u8981\u6C42\u7684\u6743\u9650\u6A21\u5F0F\uFF0C\u8FDE\u63A5\u5668\u4E3A\u5B89\u5168\u8D77\u89C1\u5173\u95ED\u4E86\u4F1A\u8BDD\u3002\u5347\u7EA7\u8FDE\u63A5\u5668\uFF08\u4F1A\u5E26\u4E0A\u8F83\u65B0\u7684 agent \u9002\u914D\u5668\uFF09\u540E\u518D\u8BD5\u3002",
28484
+ mode_mismatch: "agent \u62A5\u544A\u7684\u6743\u9650\u6A21\u5F0F\u548C\u8981\u6C42\u7684\u4E0D\u4E00\u81F4\uFF0C\u8FDE\u63A5\u5668\u4E3A\u5B89\u5168\u8D77\u89C1\u5173\u95ED\u4E86\u4F1A\u8BDD\u3002\u5347\u7EA7\u8FDE\u63A5\u5668\u540E\u518D\u8BD5\uFF1B\u4ECD\u7136\u51FA\u73B0\u7684\u8BDD\uFF0C\u68C0\u67E5\u90A3\u53F0\u673A\u5668\u4E0A Claude \u7684\u8BBE\u7F6E\u3002",
28485
+ mode_not_allowed: '\u8FD9\u4E2A\u6A21\u5F0F\u4E0D\u9010\u6B65\u8BE2\u95EE\u6743\u9650\uFF0C\u800C\u8BE5 agent \u5728\u90A3\u53F0\u673A\u5668\u4E0A\u6CA1\u6709\u88AB\u5141\u8BB8\u8FD9\u6837\u8FD0\u884C\u3002\u8981\u5141\u8BB8\uFF0C\u5728 agents.toml \u91CC\u7ED9\u8BE5 agent \u8BBE `approval = "never"` \u5E76\u91CD\u542F\u8FDE\u63A5\u5668\uFF1B\u5426\u5219\u8BF7\u9009\u4E00\u4E2A\u4F1A\u8BE2\u95EE\u7684\u6A21\u5F0F\u3002',
28486
+ mode_id_required: "\u5207\u6362\u6A21\u5F0F\u7684\u8BF7\u6C42\u91CC\u7F3A\u5C11\u6A21\u5F0F\u540D\u3002\u70B9\u300C\u6A21\u5F0F\u300D\u518D\u9009\u4E00\u6B21\u3002",
28487
+ set_mode_failed: "agent \u6CA1\u80FD\u5207\u6362\u6A21\u5F0F\uFF0C\u4ECD\u662F\u539F\u6765\u7684\u6A21\u5F0F\u3002",
28488
+ adapter_gone: "\u90A3\u53F0\u673A\u5668\u4E0A\u7684 agent \u7A0B\u5E8F\u5DF2\u7ECF\u9000\u51FA\u4E86\u3002",
28489
+ adapter_start_failed: "\u8FDE\u63A5\u5668\u6CA1\u80FD\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u542F\u52A8 agent \u7A0B\u5E8F\uFF08\u5E38\u89C1\u539F\u56E0\uFF1A\u8BBF\u95EE\u4E0D\u4E86 npm \u4ED3\u5E93\u3001\u547D\u4EE4\u4E0D\u5B58\u5728\uFF09\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C `claw-connector status`\uFF0C\u5E76\u770B\u72B6\u6001\u76EE\u5F55\u91CC\u7684 `run.log`\u3002",
28490
+ adapter_unavailable: "\u8FDE\u63A5\u5668\u6CA1\u80FD\u4E3A\u8FD9\u4E00\u8F6E\u542F\u52A8 agent \u7A0B\u5E8F\u3002",
28491
+ adapter_protocol: "agent \u7A0B\u5E8F\u7684\u5E94\u7B54\u548C\u8FDE\u63A5\u5668\u9884\u671F\u7684\u4E0D\u4E00\u81F4\uFF0C\u591A\u534A\u662F\u7248\u672C\u4E0D\u5339\u914D\u3002\u5347\u7EA7\u8FDE\u63A5\u5668\u540E\u518D\u8BD5\u3002",
28492
+ adapter_cannot_resume: "\u8FD9\u4E2A agent \u4E0D\u80FD\u63A5\u7740\u4E4B\u524D\u7684\u5BF9\u8BDD\u7EE7\u7EED\u3002",
28493
+ adapter_error: "agent \u7A0B\u5E8F\u62A5\u9519\u4E86\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u770B\u8FDE\u63A5\u5668\u72B6\u6001\u76EE\u5F55\u91CC\u7684 `run.log`\u3002",
28494
+ agent_auth_required: "\u90A3\u53F0\u673A\u5668\u4E0A\u7684 agent \u8FD8\u6CA1\u767B\u5F55\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C\u4E00\u6B21 agent\uFF08\u4F8B\u5982 `claude`\uFF09\u5B8C\u6210\u767B\u5F55\uFF0C\u518D\u8BD5\u3002",
28495
+ cwd_outside_roots: "\u8FD9\u4E2A\u76EE\u5F55\u4E0D\u5728\u8BE5 agent \u5141\u8BB8\u7684 roots \u91CC\u3002\u6362\u4E00\u4E2A roots \u91CC\u7684\u76EE\u5F55\uFF0C\u6216\u5728 agents.toml \u7684 `roots` \u91CC\u52A0\u4E0A\u5B83\u5E76\u91CD\u542F\u8FDE\u63A5\u5668\u3002",
28496
+ cwd_not_found: "\u90A3\u53F0\u673A\u5668\u4E0A\u6CA1\u6709\u8FD9\u4E2A\u76EE\u5F55\uFF1A\u9009\u4E00\u4E2A\u90A3\u91CC\u5DF2\u6709\u7684\u76EE\u5F55\uFF0C\u6216\u8005\u5148\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u5EFA\u597D\u5B83\u3002",
28497
+ cwd_not_directory: "\u8FD9\u4E2A\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\u3002",
28498
+ cwd_not_absolute: "\u76EE\u5F55\u8981\u5199\u6210\u7EDD\u5BF9\u8DEF\u5F84\uFF08\u4EE5 / \u5F00\u5934\uFF09\u3002",
28499
+ invalid_cwd: "\u8FD9\u4E2A\u76EE\u5F55\u540D\u65E0\u6548\uFF0C\u6362\u4E00\u4E2A\u76EE\u5F55\u518D\u8BD5\u3002",
28500
+ cwd_mismatch: "\u6240\u9009\u5BF9\u8BDD\u4E0D\u5728\u8FD9\u4E2A\u76EE\u5F55\u91CC\u3002\u4ECE\u5217\u8868\u91CC\u91CD\u65B0\u9009\u3002",
28501
+ unknown_agent: "\u90A3\u53F0\u673A\u5668\u4E0A\u6CA1\u6709\u8FD9\u4E2A agent\uFF08agents.toml \u53EF\u80FD\u6539\u8FC7\uFF09\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u68C0\u67E5 agents.toml\uFF0C\u6539\u540E\u91CD\u542F\u8FDE\u63A5\u5668\u3002",
28502
+ not_delivered: "\u90A3\u53F0\u673A\u5668\u6CA1\u6536\u5230\uFF0C\u4EC0\u4E48\u90FD\u6CA1\u6267\u884C\uFF1A\u53D1\u51FA\u65F6\u5B83\u770B\u8D77\u6765\u5728\u7EBF\uFF0C\u4F46\u5DF2\u7ECF\u65AD\u5F00\uFF08\u6BD4\u5982\u7B14\u8BB0\u672C\u5408\u76D6\u4E86\uFF09\u3002\u7B49\u5B83\u91CD\u65B0\u8FDE\u4E0A\u540E\u518D\u53D1\u4E00\u6B21\u3002",
28503
+ delivery_unconfirmed: "\u90A3\u53F0\u673A\u5668\u5728\u8FD9\u6761\u6D88\u606F\u53D1\u51FA\u524D\u540E\u65AD\u5F00\u4E86\uFF0C\u6CA1\u6709\u786E\u8BA4\u6536\u5230\uFF0C\u53EF\u80FD\u6CA1\u6709\u6267\u884C\u3002\u5B83\u91CD\u65B0\u8FDE\u4E0A\u540E\u5982\u679C\u505A\u4E86\uFF0C\u7ED3\u679C\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002",
28504
+ connector_revoked: "\u90A3\u53F0\u673A\u5668\u7684\u8FDE\u63A5\u5668\u5DF2\u88AB\u6CE8\u9500\uFF08logout \u6216 `/agent off`\uFF09\uFF0C\u5B83\u4E0A\u9762\u7684\u4F1A\u8BDD\u968F\u4E4B\u5173\u95ED\u3002\u8981\u7EE7\u7EED\uFF0C\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u91CD\u65B0\u767B\u5F55\u8FDE\u63A5\u5668\uFF0C\u518D\u5F00\u65B0\u4F1A\u8BDD\u3002",
28505
+ machine_reconnected: "\u90A3\u53F0\u673A\u5668\u91CD\u65B0\u6CE8\u518C\u8FC7\uFF08\u91CD\u88C5\u3001\u4E22\u4E86\u672C\u5730\u72B6\u6001\u6216\u91CD\u5EFA\u4E86\u5BB9\u5668\uFF09\uFF0C\u65E7\u4F1A\u8BDD\u968F\u65E7\u6CE8\u518C\u5173\u95ED\u4E86\u3002",
28506
+ unknown_session: "\u8FDE\u63A5\u5668\u4E0D\u8BA4\u8BC6\u8FD9\u4E2A\u4F1A\u8BDD\u4E86\uFF08\u53EF\u80FD\u5DF2\u91CD\u542F\u6216\u6E05\u7406\u8FC7\uFF09\u3002",
28507
+ too_many_sessions: "\u90A3\u53F0\u673A\u5668\u4E0A\u540C\u65F6\u5F00\u7740\u7684\u4F1A\u8BDD\u592A\u591A\u4E86\u3002\u5148\u7528 `/agent close` \u5173\u6389\u4E00\u4E2A\u3002",
28508
+ resume_not_supported: "\u8FD9\u4E2A agent \u4E0D\u652F\u6301\u63A5\u7740\u5DF2\u6709\u7684\u4F1A\u8BDD\u7EE7\u7EED\u3002",
28509
+ attach_unavailable: "\u8FD9\u4E2A agent \u4E0D\u652F\u6301\u63A5\u7BA1\u7EC8\u7AEF\u91CC\u7684\u5BF9\u8BDD\u3002\u8981\u63A5\u7BA1\uFF0C\u8BF7\u7528 `claude-attach` \u9884\u8BBE\u914D\u7F6E\u4E00\u4E2A agent\u3002",
28510
+ resume_ref_required: "\u6CA1\u6709\u6307\u660E\u8981\u63A5\u7BA1\u54EA\u6BB5\u5BF9\u8BDD\u3002\u4ECE\u5217\u8868\u91CC\u91CD\u65B0\u9009\u3002",
28511
+ invalid_resume_ref: "\u8981\u63A5\u7BA1\u7684\u5BF9\u8BDD\u7F16\u53F7\u65E0\u6548\u3002\u4ECE\u5217\u8868\u91CC\u91CD\u65B0\u9009\u3002",
28512
+ already_attached: "\u8FD9\u6BB5\u5BF9\u8BDD\u5DF2\u7ECF\u5728\u624B\u673A\u4E0A\u6253\u5F00\u4E86\u3002\u7528 `/agent sessions` \u5207\u8FC7\u53BB\u3002",
28513
+ catalog_unavailable: "\u8FDE\u63A5\u5668\u6682\u65F6\u8BFB\u4E0D\u5230\u90A3\u53F0\u673A\u5668\u4E0A\u7684\u5BF9\u8BDD\u5217\u8868\u3002",
28514
+ session_live: "\u8FD9\u6BB5\u5BF9\u8BDD\u8FD8\u5728\u90A3\u53F0\u673A\u5668\u7684\u7EC8\u7AEF\u91CC\u5F00\u7740\u3002\u5148\u5728\u7EC8\u7AEF\u91CC\u9000\u51FA\u5B83\uFF0C\u518D\u63A5\u7BA1\u3002",
28515
+ recently_written: "\u7EC8\u7AEF\u521A\u5199\u8FC7\u8FD9\u6BB5\u5BF9\u8BDD\uFF0C\u53EF\u80FD\u8FD8\u5728\u7528\u3002\u8FC7 {wait}\u518D\u8BD5\u3002",
28516
+ twin_check_failed: "\u8FDE\u63A5\u5668\u6CA1\u80FD\u786E\u8BA4\u8FD9\u6BB5\u5BF9\u8BDD\u662F\u5426\u8FD8\u5728\u7EC8\u7AEF\u91CC\u5F00\u7740\uFF0C\u4E3A\u5B89\u5168\u8D77\u89C1\u6CA1\u6709\u63A5\u7BA1\u3002",
28517
+ terminal_did_not_exit: "\u7EC8\u7AEF\u91CC\u7684\u8FD9\u6BB5\u5BF9\u8BDD\u6CA1\u6709\u6309\u8981\u6C42\u9000\u51FA\uFF0C\u6240\u4EE5\u6CA1\u6709\u63A5\u7BA1\uFF0C\u5B83\u8FD8\u5728\u7EC8\u7AEF\u91CC\u3002\u5148\u5728\u7EC8\u7AEF\u91CC\u9000\u51FA\u5B83\uFF0C\u518D\u63A5\u7BA1\u3002",
28518
+ session_live_elsewhere: "\u8FD9\u6BB5\u5BF9\u8BDD\u5F00\u5728\u53E6\u4E00\u53F0\u673A\u5668\u6216\u5BB9\u5668\u91CC\uFF08\u5171\u7528\u540C\u4E00\u4E2A Claude \u914D\u7F6E\u76EE\u5F55\uFF09\uFF0C\u8FD9\u91CC\u7ED3\u675F\u4E0D\u4E86\u5B83\uFF0C\u6240\u4EE5\u6CA1\u6709\u63A5\u7BA1\u3002\u5728\u90A3\u8FB9\u9000\u51FA\u5B83\u518D\u8BD5\u3002",
28519
+ takeover_not_permitted: "\u7EC8\u7AEF\u91CC\u7684\u8FD9\u6BB5\u5BF9\u8BDD\u5C5E\u4E8E\u53E6\u4E00\u4E2A\u7CFB\u7EDF\u7528\u6237\uFF0C\u8FDE\u63A5\u5668\u65E0\u6743\u7ED3\u675F\u5B83\uFF0C\u6240\u4EE5\u6CA1\u6709\u63A5\u7BA1\u3002",
28520
+ takeover_failed: "\u7ED3\u675F\u7EC8\u7AEF\u91CC\u7684\u8FD9\u6BB5\u5BF9\u8BDD\u5931\u8D25\u4E86\uFF0C\u6240\u4EE5\u6CA1\u6709\u63A5\u7BA1\u3002",
28521
+ terminal_busy: "\u7EC8\u7AEF\u91CC\u6709\u4EBA\u5728\u8F93\u5165\uFF08\u6216\u6B63\u5728\u56DE\u6EDA\u67E5\u770B\uFF09\uFF0C\u7B49\u4E86 10 \u5206\u949F\u4E5F\u6CA1\u7A7A\u51FA\u6765\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u7A0D\u540E\u518D\u53D1\u3002",
28522
+ terminal_input_withdrawn: "\u8FD9\u6761\u6D88\u606F\u5DF2\u7ECF\u6392\u8FDB\u7EC8\u7AEF\u91CC Claude Code \u7684\u961F\u5217\uFF0C\u4F46\u540E\u6765\u7EC8\u7AEF\u91CC\u6709\u4EBA\u628A\u961F\u5217\u62C9\u56DE\u4E86\u8F93\u5165\u6846\uFF08\u6309\u4E86\u4E0A\u952E\u7F16\u8F91\uFF09\uFF0C\u6240\u4EE5\u5B83\u6CA1\u6709\u4F5C\u4E3A\u624B\u673A\u6D88\u606F\u53D1\u51FA\uFF0C\u73B0\u5728\u5728\u7EC8\u7AEF\u7684\u8F93\u5165\u6846\u91CC\u3002\u8981\u53D1\uFF0C\u8BF7\u5728\u7EC8\u7AEF\u91CC\u56DE\u8F66\uFF0C\u6216\u4ECE\u624B\u673A\u91CD\u53D1\u3002",
28523
+ terminal_state_unknown: "\u8FDE\u63A5\u5668 10 \u5206\u949F\u5185\u90FD\u6CA1\u6CD5\u786E\u8BA4\u90A3\u4E2A\u7EC8\u7AEF\u91CC\u7684 Claude Code \u8FD8\u5F00\u7740\u8FD9\u6BB5\u5BF9\u8BDD\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u770B\u4E00\u773C\u7EC8\u7AEF\uFF0C\u786E\u8BA4\u5B83\u8FD8\u5728\u8FD9\u6BB5\u5BF9\u8BDD\u91CC\uFF0C\u518D\u53D1\u4E00\u6B21\u3002",
28524
+ terminal_gone: "\u7EC8\u7AEF\u90A3\u8FB9\u7684 tmux \u7A97\u683C\u5DF2\u7ECF\u6CA1\u4E86\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002",
28525
+ 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",
28526
+ terminal_input_failed: "\u5F80\u7EC8\u7AEF\u91CC\u8F93\u5165\u8FD9\u6761\u6D88\u606F\u5931\u8D25\u4E86\uFF0C\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002",
28527
+ 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",
28528
+ 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",
28529
+ 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",
28530
+ empty_prompt: "\u8FD9\u6761\u6D88\u606F\u53BB\u6389\u63A7\u5236\u5B57\u7B26\u540E\u662F\u7A7A\u7684\uFF0C\u6CA1\u6709\u53D1\u8FDB\u7EC8\u7AEF\u3002",
28531
+ 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",
28532
+ terminal_session: "\u8FD9\u6BB5\u5BF9\u8BDD\u5F00\u5728\u7EC8\u7AEF\u91CC\uFF0C\u6A21\u5F0F\u7531\u7EC8\u7AEF\u51B3\u5B9A\uFF0C\u8FD9\u91CC\u6539\u4E0D\u4E86\u3002",
28533
+ terminal_mode_not_allowed: '\u7EC8\u7AEF\u91CC\u8FD9\u6BB5\u5BF9\u8BDD\u7684\u6743\u9650\u6A21\u5F0F\uFF08\u4F8B\u5982 auto\uFF09\u4E0D\u9010\u6B65\u8BE2\u95EE\uFF0C\u800C\u8FD9\u4E2A agent \u7684\u5BA1\u6279\u8BBE\u7F6E\u4E0D\u5141\u8BB8\u4ECE\u624B\u673A\u5F80\u8FD9\u79CD\u6A21\u5F0F\u91CC\u8F93\u5165\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u5728\u7EC8\u7AEF\u91CC\u6309 shift+tab \u5207\u5230\u4F1A\u8BE2\u95EE\u7684\u6A21\u5F0F\uFF08manual \u6216 plan\uFF09\u518D\u53D1\uFF1B\u6216\u5728\u90A3\u53F0\u673A\u5668\u7684 agents.toml \u91CC\u7ED9\u8FD9\u4E2A agent \u8BBE `approval = "never"`\u3002',
28534
+ terminal_mode_unknown: "\u8FDE\u63A5\u5668\u8BFB\u4E0D\u51FA\u7EC8\u7AEF\u91CC\u8FD9\u6BB5\u5BF9\u8BDD\u5904\u4E8E\u54EA\u79CD\u6743\u9650\u6A21\u5F0F\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u786E\u8BA4\u90A3\u8FB9\u7684 Claude Code \u662F\u65B0\u7248\u3001\u8F93\u5165\u6846\u4E0B\u65B9\u663E\u793A\u7740\u6A21\u5F0F\uFF0C\u518D\u53D1\u4E00\u6B21\u3002",
28535
+ terminal_screen_unknown: "\u8FDE\u63A5\u5668 30 \u79D2\u5185\u90FD\u8BA4\u4E0D\u51FA\u90A3\u4E2A\u7EC8\u7AEF\u7684\u753B\u9762\uFF08\u4E0D\u662F Claude Code \u7684\u8F93\u5165\u6846\uFF0C\u5B83\u4E5F\u6CA1\u8BF4\u81EA\u5DF1\u5728\u5FD9\uFF09\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u770B\u4E00\u773C\u7EC8\u7AEF\uFF0C\u5173\u6389\u4E0A\u9762\u7684\u4E1C\u897F\u518D\u53D1\u3002",
28536
+ terminal_command_refused: "\u4EE5 ! \u6216 / \u5F00\u5934\u7684\u6D88\u606F\u4F1A\u5728\u90A3\u4E2A\u7EC8\u7AEF\u91CC\u6267\u884C\u547D\u4EE4\uFF0C\u6240\u4EE5\u4E0D\u4ECE\u624B\u673A\u8F93\u5165\u3002\u6362\u4E2A\u8BF4\u6CD5\uFF0C\u6216\u8005\u5728\u7EC8\u7AEF\u91CC\u81EA\u5DF1\u6267\u884C\u3002",
28537
+ takeover_expired: "\u63A5\u7BA1\u786E\u8BA4\u5230\u8FBE\u90A3\u53F0\u673A\u5668\u65F6\u5DF2\u7ECF\u8FC7\u671F\uFF0C\u6CA1\u6709\u63A5\u7BA1\u3002\u91CD\u65B0\u6253\u5F00\u5E76\u518D\u786E\u8BA4\u4E00\u6B21\u3002",
28538
+ cwd_ambiguous: "\u8FD9\u4E2A agent \u6709\u4E0D\u6B62\u4E00\u4E2A\u6839\u76EE\u5F55\u91CC\u6709\u540C\u540D\u6587\u4EF6\u5939\u3002\u8BF7\u5199\u51FA\u5B8C\u6574\u8DEF\u5F84\u3002",
28539
+ root_unavailable: "\u90A3\u53F0\u673A\u5668\u4E0A\u8FD9\u4E2A\u76EE\u5F55\u6240\u5728\u7684\u76D8\u6CA1\u6709\u54CD\u5E94\uFF08\u7F51\u7EDC\u76D8\u65AD\u4E86\u6216\u8FD8\u6CA1\u6302\u4E0A\uFF09\u3002\u8FC7\u4E00\u5206\u949F\u518D\u8BD5\uFF0C\u6216\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u68C0\u67E5\u6302\u8F7D\u3002",
28540
+ session_closed: "\u8FD9\u4E2A\u4F1A\u8BDD\u5DF2\u7ECF\u5173\u4E86\u3002",
28541
+ closed: "\u4F1A\u8BDD\u5DF2\u6309\u8981\u6C42\u5173\u95ED\u3002",
28542
+ stopped: "\u90A3\u53F0\u673A\u5668\u4E0A\u7684\u8FDE\u63A5\u5668\u505C\u4E86\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u91CD\u65B0\u542F\u52A8\u5B83\uFF08`claw-connector run`\uFF0C\u6216\u670D\u52A1\u7684 `sh keepalive.sh`\uFF09\u3002",
28543
+ paused: "\u90A3\u53F0\u673A\u5668\u4E0A\u7684\u8FDE\u63A5\u5668\u6682\u505C\u4E86\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C `claw-connector resume`\u3002",
28544
+ revoked: "\u90A3\u53F0\u673A\u5668\u7684\u8FDE\u63A5\u5668\u5DF2\u88AB\u6CE8\u9500\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C `{login}` \u91CD\u65B0\u767B\u5F55\u3002",
28545
+ text_required: "\u53D1\u7ED9 agent \u7684\u6D88\u606F\u662F\u7A7A\u7684\u3002",
28546
+ action_and_option_required: "\u8FD9\u6B21\u6279\u51C6\u7F3A\u5C11\u8981\u56DE\u7B54\u7684\u8BF7\u6C42\u6216\u9009\u9879\u3002\u5728\u5361\u7247\u4E0A\u518D\u70B9\u4E00\u6B21\u3002",
28547
+ too_many_queued_prompts: "agent \u624B\u4E0A\u6392\u961F\u7684\u6D88\u606F\u592A\u591A\u4E86\uFF0C\u8FD9\u6761\u6CA1\u6709\u6536\u4E0B\u3002\u7B49\u5B83\u5904\u7406\u5B8C\u518D\u53D1\u3002",
28548
+ cancelled: "\u8FD9\u6761\u6D88\u606F\u8FD8\u6CA1\u8FD0\u884C\u5C31\u56E0\u4E3A\u505C\u6B62\u800C\u88AB\u4E22\u5F03\u4E86\u3002",
28549
+ unknown_action: "\u8FD9\u4E2A\u6279\u51C6\u8BF7\u6C42\u5DF2\u7ECF\u4E0D\u5728\u4E86\u3002",
28550
+ option_not_offered: "\u8FD9\u4E2A\u9009\u9879\u4E0D\u662F agent \u63D0\u4F9B\u7684\u3002"
28551
+ }
28552
+ });
28553
+ var connectorReasonHints = defineCatalog({
28554
+ en: {
28555
+ upgrade: (p) => `Upgrade the connector: on that machine run \`${p.command}\` (it installs the new version and restarts the connector on it).`,
28556
+ sandbox: 'Workaround (only when the connector runs as root and the agent has `approval = "never"`): add `env = { IS_SANDBOX = "1" }` under that agent in agents.toml (or `IS_SANDBOX = "1"` in its existing `[agents.env]`), then restart the connector.',
28557
+ status: "Run `claw-connector status` on that machine and look for a warning or problem line.",
28558
+ newSession: "Start a new one with `/agent new`.",
28559
+ retry: "Try again in a moment.",
28560
+ /** A length of time in the sentences that name one (`{wait}`): the connector's own whole seconds. */
28561
+ seconds: (p) => `${String(p.n)} ${p.n === 1 ? "second" : "seconds"}`,
28562
+ unknown: (p) => `The connector gave a reason I do not know (${p.code}). Run \`claw-connector status\` on that machine, or upgrade the connector and try again.`,
28563
+ /** Between a lead and the reason after it, and the end of a lead with none. */
28564
+ leadSep: ": ",
28565
+ leadEnd: "."
28566
+ },
28567
+ zh: {
28568
+ upgrade: (p) => `\u5347\u7EA7\u8FDE\u63A5\u5668\uFF1A\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C \`${p.command}\`\uFF08\u4F1A\u88C5\u4E0A\u65B0\u7248\u672C\u5E76\u91CD\u542F\u8FDE\u63A5\u5668\uFF09\u3002`,
28569
+ sandbox: '\u4E34\u65F6\u7ED5\u8FC7\uFF08\u4EC5\u5F53\u8FDE\u63A5\u5668\u4EE5 root \u8FD0\u884C\u3001\u4E14\u8BE5 agent \u8BBE\u4E86 `approval = "never"`\uFF09\uFF1A\u5728 agents.toml \u91CC\u8BE5 agent \u4E0B\u52A0 `env = { IS_SANDBOX = "1" }`\uFF08\u5DF2\u6709 `[agents.env]` \u7684\uFF0C\u5728\u5176\u4E2D\u52A0 `IS_SANDBOX = "1"`\uFF09\uFF0C\u518D\u91CD\u542F\u8FDE\u63A5\u5668\u3002',
28570
+ status: "\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C `claw-connector status`\uFF0C\u770B\u6709\u6CA1\u6709 warning \u6216 problem \u884C\u3002",
28571
+ newSession: "\u7528 `/agent new` \u5F00\u4E00\u4E2A\u65B0\u4F1A\u8BDD\u3002",
28572
+ retry: "\u7A0D\u540E\u518D\u8BD5\u4E00\u6B21\u3002",
28573
+ seconds: (p) => `${String(p.n)} \u79D2`,
28574
+ unknown: (p) => `\u8FDE\u63A5\u5668\u7ED9\u51FA\u4E86\u4E00\u4E2A\u6211\u4E0D\u8BA4\u8BC6\u7684\u539F\u56E0\uFF08${p.code}\uFF09\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C \`claw-connector status\` \u770B\u770B\uFF0C\u6216\u5347\u7EA7\u8FDE\u63A5\u5668\u540E\u518D\u8BD5\u3002`,
28575
+ leadSep: "\uFF1A",
28576
+ leadEnd: "\u3002"
28577
+ }
28578
+ });
28579
+
28580
+ // packages/core/src/remote/fields.ts
28581
+ function textOf6(value) {
28582
+ if (typeof value === "string") return value;
28583
+ if (typeof value === "number") return value === 0 ? "" : String(value);
28584
+ return value === true ? "True" : "";
28585
+ }
28586
+ function recordOf(value) {
28587
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
28588
+ }
28589
+
28590
+ // packages/core/src/locales/connector-setup.ts
28591
+ var connectorSetupText = defineCatalog({
28592
+ en: {
28593
+ noMachine: "You have no machine connected.",
28594
+ /** Between the first line and `runOn`. */
28595
+ sep: " ",
28596
+ runOn: "On the machine you want to use (Node.js 22 or newer), run:",
28597
+ after: "`init` writes agents.toml and prints where: set `roots` there to the folders an agent may work in (the sample uses `~/work`). `login` prints a link and a code: open it where you are signed in and confirm. Then send /agents to see the machine.",
28598
+ /** What differs per system, one line each. */
28599
+ notes: "- Linux: if `service install` asks, also run `loginctl enable-linger $USER` once; in a container or dev pod without systemd, add the two lines it prints to crontab or the container's startup command.\n- macOS: the same commands; launchd keeps it running.\n- Windows: run the same commands inside WSL (for example Ubuntu).\n- npm says `EACCES`: run `npm config set prefix ~/.npm-global` and put `~/.npm-global/bin` on your `PATH` instead of using sudo.",
28600
+ upgrade: (p) => `On that machine, run \`${p.command}\` to upgrade it and restart it.`,
28601
+ versionUnsupported: (p) => `Its connector (${p.version}) is too old for a new session.`,
28602
+ versionOutdated: (p) => `Its connector (${p.version}) is out of date.`,
28603
+ offlineHint: "On that machine, run `claw-connector status` to see why, then `claw-connector service install` to start it again."
28604
+ },
28605
+ zh: {
28606
+ noMachine: "\u4F60\u8FD8\u6CA1\u6709\u8FDE\u63A5\u4EFB\u4F55\u673A\u5668\u3002",
28607
+ sep: "",
28608
+ runOn: "\u5728\u8981\u4F7F\u7528\u7684\u673A\u5668\u4E0A\uFF08\u9700\u8981 Node.js 22 \u53CA\u4EE5\u4E0A\uFF09\u4F9D\u6B21\u8FD0\u884C\uFF1A",
28609
+ after: "`init` \u4F1A\u751F\u6210 agents.toml \u5E76\u6253\u5370\u4F4D\u7F6E\uFF1A\u628A\u5176\u4E2D\u7684 `roots` \u6539\u6210\u5141\u8BB8 agent \u5DE5\u4F5C\u7684\u76EE\u5F55\uFF08\u793A\u4F8B\u662F `~/work`\uFF09\u3002`login` \u4F1A\u6253\u5370\u4E00\u4E2A\u94FE\u63A5\u548C\u9A8C\u8BC1\u7801\uFF1A\u5728\u5DF2\u767B\u5F55\u7684\u6D4F\u89C8\u5668\u91CC\u6253\u5F00\u5E76\u786E\u8BA4\u3002\u4E4B\u540E\u53D1 /agents \u5C31\u80FD\u770B\u5230\u8FD9\u53F0\u673A\u5668\u3002",
28610
+ notes: "- Linux\uFF1A`service install` \u82E5\u63D0\u793A\uFF0C\u518D\u8FD0\u884C\u4E00\u6B21 `loginctl enable-linger $USER`\uFF1B\u5BB9\u5668\u6216 dev pod \u6CA1\u6709 systemd \u65F6\uFF0C\u628A\u5B83\u6253\u5370\u7684\u4E24\u884C\u52A0\u8FDB crontab \u6216\u5BB9\u5668\u542F\u52A8\u547D\u4EE4\u3002\n- macOS\uFF1A\u540C\u6837\u7684\u547D\u4EE4\uFF0C\u7531 launchd \u5E38\u9A7B\u3002\n- Windows\uFF1A\u5728 WSL\uFF08\u4F8B\u5982 Ubuntu\uFF09\u91CC\u8FD0\u884C\u540C\u6837\u7684\u547D\u4EE4\u3002\n- npm \u62A5 `EACCES`\uFF1A\u5148 `npm config set prefix ~/.npm-global`\uFF0C\u628A `~/.npm-global/bin` \u52A0\u8FDB `PATH`\uFF0C\u4E0D\u8981\u7528 sudo\u3002",
28611
+ upgrade: (p) => `\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C \`${p.command}\` \u5347\u7EA7\u5E76\u91CD\u542F\u5B83\u3002`,
28612
+ versionUnsupported: (p) => `\u8FDE\u63A5\u5668\u7248\u672C ${p.version} \u592A\u65E7\uFF0C\u4E0D\u80FD\u5F00\u65B0\u4F1A\u8BDD\u3002`,
28613
+ versionOutdated: (p) => `\u8FDE\u63A5\u5668\u7248\u672C ${p.version} \u8F83\u65E7\uFF0C\u5EFA\u8BAE\u5347\u7EA7\u3002`,
28614
+ offlineHint: "\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C `claw-connector status` \u770B\u539F\u56E0\uFF0C\u518D\u8FD0\u884C `claw-connector service install` \u91CD\u65B0\u542F\u52A8\u5B83\u3002"
28615
+ }
28616
+ });
28617
+
28618
+ // packages/core/src/remote/connector/setup.ts
28619
+ var CONNECTOR_PACKAGE_NAME = "@primusclaw/connector";
28620
+ var UPGRADE_COMMAND = `npm install -g ${CONNECTOR_PACKAGE_NAME}@latest && claw-connector stop && claw-connector service install`;
28621
+ var SAFE_URL = /^https?:\/\/[A-Za-z0-9.-]{1,253}(?::\d{1,5})?(?:\/[A-Za-z0-9._~-]{1,100}){0,8}$/;
28622
+ var PAIR_CODE = /^[0-9A-HJKMNP-TV-Z]{4}-[0-9A-HJKMNP-TV-Z]{4}-[0-9A-HJKMNP-TV-Z]{4}$/;
28623
+ function safeUrl(value) {
28624
+ const text9 = pyRstrip(pyStrip(textOf6(value)), "/");
28625
+ return SAFE_URL.test(text9) ? text9 : null;
28626
+ }
28627
+ function originOf(url) {
28628
+ const match = /^(https?):\/\/([^/]+)/u.exec(url);
28629
+ return match ? `${match[1] ?? ""}://${match[2] ?? ""}` : "";
28630
+ }
28631
+ function sameHost(a, b3) {
28632
+ return originOf(a).toLowerCase() === originOf(b3).toLowerCase();
28633
+ }
28634
+ var Setup = class {
28635
+ constructor(server, identityUrl) {
28636
+ this.server = server;
28637
+ this.identityUrl = identityUrl;
28638
+ }
28639
+ server;
28640
+ identityUrl;
28641
+ login() {
28642
+ return "claw-connector login" + (this.server ? ` --server ${this.server}` : "") + (this.identityUrl ? ` --identity-url ${this.identityUrl}` : "");
28643
+ }
28644
+ commands() {
28645
+ return [
28646
+ `npm install -g ${CONNECTOR_PACKAGE_NAME}`,
28647
+ "claw-connector init",
28648
+ this.login(),
28649
+ "claw-connector service install"
28650
+ ];
28651
+ }
28652
+ };
28653
+ function setupFrom(data, baseUrl) {
28654
+ const base = safeUrl(baseUrl);
28655
+ if (!base) return new Setup("", null);
28656
+ const origin = originOf(base);
28657
+ const given = recordOf(data);
28658
+ const server = given ? safeUrl(given.server) : null;
28659
+ if (given && server && sameHost(server, base)) {
28660
+ const identity = safeUrl(given.identity_url);
28661
+ return new Setup(server, identity && sameHost(identity, base) ? identity : origin);
28662
+ }
28663
+ return new Setup(base, origin);
28664
+ }
28665
+ function pairCommand(data, baseUrl) {
28666
+ const given = recordOf(data);
28667
+ if (!given) return null;
28668
+ const code3 = textOf6(given.code).trim();
28669
+ const server = safeUrl(given.server);
28670
+ const base = safeUrl(baseUrl) ?? "";
28671
+ if (!PAIR_CODE.test(code3) || !server || !sameHost(server, base)) return null;
28672
+ return `npm install -g --no-update-notifier ${CONNECTOR_PACKAGE_NAME}@latest && claw-connector pair ${code3} --server ${server}`;
28673
+ }
28674
+ function connectSteps(setup, lang, lead = "") {
28675
+ const text9 = connectorSetupText.in(lang);
28676
+ return {
28677
+ lead: (lead || text9.noMachine) + text9.sep + text9.runOn,
28678
+ commands: setup.commands(),
28679
+ after: text9.after,
28680
+ notes: text9.notes
28681
+ };
28682
+ }
28683
+ function connectMarkdown(setup, lang, lead = "") {
28684
+ const steps = connectSteps(setup, lang, lead);
28685
+ const block = "```\n" + steps.commands.join("\n") + "\n```";
28686
+ return [steps.lead, block, steps.after, steps.notes].join("\n\n");
28687
+ }
28688
+ function upgradeText(lang, command = UPGRADE_COMMAND) {
28689
+ return connectorSetupText.in(lang).upgrade({ command });
28690
+ }
28691
+ function versionNote(connector, lang = "en") {
28692
+ const status = connector.versionStatus;
28693
+ if (status !== "outdated" && status !== "unsupported") return null;
28694
+ const version = connector.version.replace(/[^0-9A-Za-z.+-]/gu, "").slice(0, 40) || "?";
28695
+ const text9 = connectorSetupText.in(lang);
28696
+ const head = status === "unsupported" ? text9.versionUnsupported({ version }) : text9.versionOutdated({ version });
28697
+ return head + text9.sep + upgradeText(lang);
28698
+ }
28699
+ function offlineHint(lang = "en") {
28700
+ return connectorSetupText.in(lang).offlineHint;
28701
+ }
28702
+ var ConnectorSetup = class {
28703
+ constructor(setup) {
28704
+ this.setup = setup;
28705
+ }
28706
+ setup;
28707
+ connectMarkdown(lang, lead = "") {
28708
+ return connectMarkdown(this.setup, lang, lead);
28709
+ }
28710
+ connectSteps(lang, lead = "") {
28711
+ return connectSteps(this.setup, lang, lead);
28712
+ }
28713
+ versionNote(connector, lang) {
28714
+ return versionNote(connector, lang);
28715
+ }
28716
+ offlineHint(lang) {
28717
+ return offlineHint(lang);
28718
+ }
28719
+ login() {
28720
+ return this.setup.login();
28721
+ }
28722
+ };
28723
+
28724
+ // packages/core/src/remote/connector/reasons.ts
28725
+ var FIXED_IN = [0, 1, 5];
28726
+ var CODE3 = /^[a-z][a-z0-9_]{0,63}$/u;
28727
+ var VERSION = /^v?(\d+)\.(\d+)\.(\d+)/u;
28728
+ var FIGURE_DEFAULT = { recently_written: 10 };
28729
+ var MAX_FIGURE = 3600;
28730
+ var FIGURED = /^([a-z][a-z0-9_]{0,63}):([1-9][0-9]{0,3})$/u;
28731
+ function splitFigure(reason) {
28732
+ const match = FIGURED.exec(reason);
28733
+ const code3 = match?.[1] ?? "";
28734
+ const n = Number(match?.[2]);
28735
+ return match !== null && Object.hasOwn(FIGURE_DEFAULT, code3) && n <= MAX_FIGURE ? { code: code3, n } : null;
28736
+ }
28737
+ function reasonWithWait(reason, wait) {
28738
+ return Object.hasOwn(FIGURE_DEFAULT, reason) && typeof wait === "number" && Number.isInteger(wait) && wait >= 1 && wait <= MAX_FIGURE ? `${reason}:${String(wait)}` : reason;
28739
+ }
28740
+ var both = (fn) => [fn("zh"), fn("en")];
28741
+ var UPGRADE = both((lang) => connectorReasonHints.in(lang).upgrade({ command: UPGRADE_COMMAND }));
28742
+ var SANDBOX = both((lang) => connectorReasonHints.in(lang).sandbox);
28743
+ var STATUS2 = both((lang) => connectorReasonHints.in(lang).status);
28744
+ var OLD_CONNECTOR = /* @__PURE__ */ new Set(["mode_unavailable", "mode_not_enforced"]);
28745
+ var FIXED_LATER = {
28746
+ terminal_input_unconfirmed: [0, 1, 22]
28747
+ };
28748
+ var THEN_NEW = /* @__PURE__ */ new Set([
28749
+ "adapter_gone",
28750
+ "adapter_cannot_resume",
28751
+ "unknown_session",
28752
+ "resume_not_supported",
28753
+ "session_closed",
28754
+ "set_mode_failed",
28755
+ "machine_reconnected"
28756
+ ]);
28757
+ var THEN_RETRY = /* @__PURE__ */ new Set(["catalog_unavailable", "twin_check_failed", "adapter_unavailable"]);
28758
+ var KNOWN = new Set(Object.keys(connectorReasonText.in("en")));
28759
+ function parseVersion2(value) {
28760
+ const match = VERSION.exec(typeof value === "string" ? value.trim() : "");
28761
+ return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
28762
+ }
28763
+ function older(version, than) {
28764
+ for (let i = 0; i < than.length; i++) {
28765
+ const a = version[i] ?? 0;
28766
+ const b3 = than[i] ?? 0;
28767
+ if (a !== b3) return a < b3;
28768
+ }
28769
+ return false;
28770
+ }
28771
+ function isCode(reason) {
28772
+ return CODE3.test(reason) || splitFigure(reason) !== null;
28773
+ }
28774
+ function sentence2(code3, lang, setup, figure) {
28775
+ const text9 = own(connectorReasonText.in(lang), code3) ?? "";
28776
+ const seconds = connectorReasonHints.in(lang).seconds({ n: figure ?? own(FIGURE_DEFAULT, code3) ?? 0 });
28777
+ return (code3 === "revoked" ? text9.replaceAll("{login}", setup.login()) : text9).replaceAll("{wait}", seconds);
28778
+ }
28779
+ function hintAfter(code3, lang, version) {
28780
+ const hints = connectorReasonHints.in(lang);
28781
+ if (OLD_CONNECTOR.has(code3)) {
28782
+ const parsed = parseVersion2(version);
28783
+ if (parsed === null || older(parsed, FIXED_IN))
28784
+ return { sep: "\n\n", hint: `${hints.upgrade({ command: UPGRADE_COMMAND })}
28785
+
28786
+ ${hints.sandbox}
28787
+
28788
+ ` };
28789
+ return { sep: " ", hint: hints.status };
28790
+ }
28791
+ const fixedIn = own(FIXED_LATER, code3);
28792
+ if (fixedIn) {
28793
+ const parsed = parseVersion2(version);
28794
+ if (parsed !== null && older(parsed, fixedIn))
28795
+ return { sep: "\n\n", hint: hints.upgrade({ command: UPGRADE_COMMAND }) };
28796
+ return null;
28797
+ }
28798
+ if (THEN_NEW.has(code3)) return { sep: " ", hint: hints.newSession };
28799
+ if (THEN_RETRY.has(code3)) return { sep: " ", hint: hints.retry };
28800
+ return null;
28801
+ }
28802
+ function explain(reason, version = null, setup = new Setup("", null)) {
28803
+ const figured2 = splitFigure(reason);
28804
+ const code3 = figured2?.code ?? reason;
28805
+ if (!KNOWN.has(code3)) return both((lang) => connectorReasonHints.in(lang).unknown({ code: code3 }));
28806
+ return both((lang) => {
28807
+ const after = hintAfter(code3, lang, version);
28808
+ const own3 = sentence2(code3, lang, setup, figured2?.n);
28809
+ return after ? `${own3}${after.sep}${after.hint}` : own3;
28810
+ });
28811
+ }
28812
+ function bareReason(reason) {
28813
+ return pyStrip(pyRstrip(pyStrip(reason ?? ""), "."));
28814
+ }
28815
+ function inLang(lang, pair) {
28816
+ if (lang === "zh") return pair[0];
28817
+ if (lang === "en") return pair[1];
28818
+ return `${pair[0]}
28819
+ ${pair[1]}`;
28820
+ }
28821
+ function describe2(reason, lang, version = null, setup) {
28822
+ const bare2 = bareReason(reason);
28823
+ if (!bare2) return "";
28824
+ if (!isCode(bare2)) return `${bare2}.`;
28825
+ return inLang(lang, explain(bare2, version, setup));
28826
+ }
28827
+ function ended(lead, reason, lang, version = null, setup) {
28828
+ if (lang === null) return ["zh", "en"].map((one) => ended(lead, reason, one, version, setup)).join("\n");
28829
+ const why = describe2(reason, lang, version, setup);
28830
+ const hints = connectorReasonHints.in(lang);
28831
+ const head = inLang(lang, lead);
28832
+ return why ? `${head}${hints.leadSep}${why}` : `${head}${hints.leadEnd}`;
28833
+ }
28834
+
28835
+ // packages/core/src/remote/events.ts
28357
28836
  var DIALOG_MAX = 120;
28358
28837
  var NOTHING2 = Object.freeze({
28359
28838
  chunk: null,
@@ -28408,7 +28887,7 @@ function update(payload) {
28408
28887
  const inner = Record_.safeParse(payload["update"]);
28409
28888
  return inner.success ? inner.data : payload;
28410
28889
  }
28411
- function textOf6(payload) {
28890
+ function textOf7(payload) {
28412
28891
  const u = update(payload);
28413
28892
  const content = u["content"];
28414
28893
  const inner = Record_.safeParse(content);
@@ -28470,7 +28949,7 @@ var NOT_TYPED = new RegExp(
28470
28949
  "^(?:<(?:command-|local-command-|system-reminder|bash-|user-prompt-submit-hook|task-notification|cross-session-message|agent-message)|\\[Request interrupted|Another Claude session sent a message:|This session is being continued from a previous conversation)"
28471
28950
  );
28472
28951
  function chunk(payload, kind) {
28473
- const text9 = textOf6(payload);
28952
+ const text9 = textOf7(payload);
28474
28953
  if (!text9) return NOTHING2;
28475
28954
  return remoteStep({ chunk: { kind: kind === "agent_message_chunk" ? "message" : "thought", text: text9 } });
28476
28955
  }
@@ -28483,7 +28962,7 @@ function unwrapPasted(text9) {
28483
28962
  });
28484
28963
  }
28485
28964
  function typed(payload) {
28486
- const text9 = pyStrip(unwrapPasted(textOf6(payload)));
28965
+ const text9 = pyStrip(unwrapPasted(textOf7(payload)));
28487
28966
  return text9 && !NOT_TYPED.test(text9) ? remoteStep({ typed: text9 }) : NOTHING2;
28488
28967
  }
28489
28968
  var TOOL_NAME = /^[A-Za-z][\w.-]{0,63}$/u;
@@ -28524,7 +29003,7 @@ function turnEnd(payload, _kind, errors) {
28524
29003
  finished: true,
28525
29004
  endsSeq: seqOf(payload["cmd_seq"]),
28526
29005
  stopReason: reason,
28527
- note: error ? neutral2(errors.publicReason(error, "remote_turn_end"), 300) : null
29006
+ note: error ? figured(neutral2(errors.publicReason(error, "remote_turn_end"), 300), payload) : null
28528
29007
  });
28529
29008
  }
28530
29009
  function sessionStarted(payload) {
@@ -28563,14 +29042,17 @@ function sessionResumed(payload) {
28563
29042
  }
28564
29043
  function sessionClosed(payload, _kind, errors) {
28565
29044
  const reason = str7(payload["reason"]) || str7(payload["message"]) || str7(payload["error"]);
28566
- return remoteStep({ closed: neutral2(errors.publicReason(reason, "remote_session_closed"), 300) });
29045
+ return remoteStep({ closed: figured(neutral2(errors.publicReason(reason, "remote_session_closed"), 300), payload) });
29046
+ }
29047
+ function figured(reason, payload) {
29048
+ return reasonWithWait(reason, payload["wait_s"]);
28567
29049
  }
28568
29050
  function commandRejected(payload, _kind, errors) {
28569
29051
  const reason = str7(payload["reason"]);
28570
29052
  return remoteStep({
28571
29053
  rejected: {
28572
29054
  type: str7(payload["type"]),
28573
- reason: neutral2(errors.publicReason(reason, "remote_command_rejected"), 300),
29055
+ reason: figured(neutral2(errors.publicReason(reason, "remote_command_rejected"), 300), payload),
28574
29056
  cmdSeq: seqOf(payload["cmd_seq"])
28575
29057
  }
28576
29058
  });
@@ -28615,7 +29097,7 @@ function decode(event, errors) {
28615
29097
  }
28616
29098
 
28617
29099
  // packages/core/src/remote/health.ts
28618
- var CODE3 = /^[a-z][a-z0-9_]{0,63}$/;
29100
+ var CODE4 = /^[a-z][a-z0-9_]{0,63}$/;
28619
29101
  var COMMAND_FIX = /^\(?(?:claude|codex|claw-connector|npm|npx|mkdir|chmod|export|loginctl|agent|curl|crontab|sh)\b/;
28620
29102
  function problemsOf(agent) {
28621
29103
  const health = objOrNull(agent.capabilities["health"]);
@@ -28636,7 +29118,7 @@ function machineProblems(connector) {
28636
29118
  for (const raw of list(health.problems).slice(0, HEALTH_READ_MAX)) {
28637
29119
  const problem = objOrNull(raw);
28638
29120
  const code3 = problem?.["code"];
28639
- if (!problem || typeof code3 !== "string" || !CODE3.test(code3)) continue;
29121
+ if (!problem || typeof code3 !== "string" || !CODE4.test(code3)) continue;
28640
29122
  const machineWide = problem["scope"] === "machine";
28641
29123
  const key = JSON.stringify([machineWide ? null : agent.agentId, code3, cpSlice(pyStr(problem["detail"]), 0, 200)]);
28642
29124
  if (seen.has(key)) continue;
@@ -30841,7 +31323,7 @@ var StatusBoard = class {
30841
31323
  /**
30842
31324
  * A chat that is the agent's window itself has just asked for a new session: one line says what starts where. Nothing says the
30843
31325
  * chat's messages go there yet: that is said once the agent has started (`sayEntered`), and a session that cannot start says
30844
- * that the messages still go to the bot (2026-11-24: "now go to" said before a start that failed, then taken back).
31326
+ * that the messages still go to the bot ("now go to" said before a start that failed, then taken back).
30845
31327
  */
30846
31328
  async sayStarting(chatKey, to, state) {
30847
31329
  const words3 = remoteAgentText.in(this.state.lang(chatKey));
@@ -31078,16 +31560,6 @@ var ChatRegistry = class {
31078
31560
  }
31079
31561
  };
31080
31562
 
31081
- // packages/core/src/remote/fields.ts
31082
- function textOf7(value) {
31083
- if (typeof value === "string") return value;
31084
- if (typeof value === "number") return value === 0 ? "" : String(value);
31085
- return value === true ? "True" : "";
31086
- }
31087
- function recordOf(value) {
31088
- return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
31089
- }
31090
-
31091
31563
  // packages/core/src/remote/machines.ts
31092
31564
  function agentRefOf(connector, agent) {
31093
31565
  return `${neutral(connector.name, 80)}/${neutral(agent.agentId, 64)}`.replaceAll("`", "'");
@@ -31479,7 +31951,7 @@ var Targets = class {
31479
31951
  * ticket, once, in time): then the connector ends the terminal first.
31480
31952
  */
31481
31953
  takeoverOf(chatKey, connector, agent, data, now, lang) {
31482
- const entry = resumableOf(agent).find((e) => e.ref === textOf7(data["resume"]));
31954
+ const entry = resumableOf(agent).find((e) => e.ref === textOf6(data["resume"]));
31483
31955
  const no = (sentence3) => ({
31484
31956
  entry: null,
31485
31957
  problem: saidIn(lang, sentence3)
@@ -31487,7 +31959,7 @@ var Targets = class {
31487
31959
  if (entry === void 0) return no("conversationGone");
31488
31960
  if (entry.state === WATCH_STATE && data["takeover"]) {
31489
31961
  const held = this.chats.ticketOf(chatKey);
31490
- const fresh = held !== void 0 && held.connectorId === connector.connectorId && held.agentId === agent.agentId && held.ref === entry.ref && held.ticket === textOf7(data["takeover"]) && held.until >= now;
31962
+ const fresh = held !== void 0 && held.connectorId === connector.connectorId && held.agentId === agent.agentId && held.ref === entry.ref && held.ticket === textOf6(data["takeover"]) && held.until >= now;
31491
31963
  if (!fresh) return no("confirmExpired");
31492
31964
  if (!canTakeOver(agent)) return no("stillInTerminal");
31493
31965
  this.chats.spendTicket(chatKey);
@@ -31508,14 +31980,14 @@ var Targets = class {
31508
31980
  problem: saidIn(lang, sentence3)
31509
31981
  });
31510
31982
  if ("typed" in data) {
31511
- const path = this.chats.typedPath(chatKey, textOf7(data["typed"]), now);
31983
+ const path = this.chats.typedPath(chatKey, textOf6(data["typed"]), now);
31512
31984
  return path ? { path, problem: "" } : no("cardExpired");
31513
31985
  }
31514
31986
  const slot = slotOf(data);
31515
31987
  if (slot < 0) return no("tapInvalidAgents");
31516
31988
  const roots = agentRoots(agent);
31517
31989
  if (roots.length === 0) {
31518
- const path = textOf7(own(data, `dir${String(slot)}`)).trim();
31990
+ const path = textOf6(own(data, `dir${String(slot)}`)).trim();
31519
31991
  return path ? { path, problem: "" } : no("typeFolder");
31520
31992
  }
31521
31993
  const root = own(data, `root${String(slot)}`);
@@ -31545,8 +32017,8 @@ var StartClicks = class {
31545
32017
  /** The connector and agent a tap names, from the person's own list as Claw gives it now; null (said) when gone. */
31546
32018
  async named(click) {
31547
32019
  const { connectors } = await this.p.lists.machines(click.key);
31548
- const connector = connectorById(connectors, textOf7(click.data["connector_id"]));
31549
- const agent = agentById(connector, textOf7(click.data["agent_id"]));
32020
+ const connector = connectorById(connectors, textOf6(click.data["connector_id"]));
32021
+ const agent = agentById(connector, textOf6(click.data["agent_id"]));
31550
32022
  if (connector === void 0 || agent === void 0) {
31551
32023
  await this.c.home(click, saidIn(this.c.lang(click), "agentGone"));
31552
32024
  return null;
@@ -31627,7 +32099,7 @@ var StartClicks = class {
31627
32099
  async attach(click) {
31628
32100
  const lang = this.c.lang(click);
31629
32101
  if (this.p.state.chats.turns.has(click.chatKey)) return this.c.home(click, saidIn(lang, "stopFirst"));
31630
- const wanted = textOf7(click.data["session_id"]);
32102
+ const wanted = textOf6(click.data["session_id"]);
31631
32103
  const session = (await this.p.lists.sessions(click.key)).sessions.find((s) => s.sessionId === wanted);
31632
32104
  if (session === void 0) return this.c.home(click, saidIn(lang, "sessionNotFound"));
31633
32105
  const hooks = this.p.ops.attachHooks(click.chatKey, click.key, click.provider, click.to);
@@ -31649,7 +32121,7 @@ var StartClicks = class {
31649
32121
  const { connector, agent } = named2;
31650
32122
  if (!connector.online)
31651
32123
  return this.c.home(click, remoteAgentText.in(lang).offlineTap({ host: neutral(connector.name, 80) }));
31652
- const entry = resumableOf(agent).find((e) => e.ref === textOf7(click.data["resume"]));
32124
+ const entry = resumableOf(agent).find((e) => e.ref === textOf6(click.data["resume"]));
31653
32125
  if (entry === void 0) return this.c.home(click, saidIn(lang, "conversationGone"));
31654
32126
  if (entry.state !== "live") return this.c.home(click, saidIn(lang, "notInTerminal"));
31655
32127
  if (!canTakeOver(agent)) return this.c.home(click, saidIn(lang, "cannotTakeOver"));
@@ -31663,7 +32135,7 @@ var StartClicks = class {
31663
32135
  });
31664
32136
  await this.c.repost(
31665
32137
  click,
31666
- this.p.ctx.views.takeover(connector, agent, entry, lang, textOf7(click.data["view"]), ticket)
32138
+ this.p.ctx.views.takeover(connector, agent, entry, lang, textOf6(click.data["view"]), ticket)
31667
32139
  );
31668
32140
  }
31669
32141
  /**
@@ -31715,140 +32187,6 @@ var StartClicks = class {
31715
32187
  }
31716
32188
  };
31717
32189
 
31718
- // packages/core/src/locales/connector-setup.ts
31719
- var connectorSetupText = defineCatalog({
31720
- en: {
31721
- noMachine: "You have no machine connected.",
31722
- /** Between the first line and `runOn`. */
31723
- sep: " ",
31724
- runOn: "On the machine you want to use (Node.js 22 or newer), run:",
31725
- after: "`init` writes agents.toml and prints where: set `roots` there to the folders an agent may work in (the sample uses `~/work`). `login` prints a link and a code: open it where you are signed in and confirm. Then send /agents to see the machine.",
31726
- /** What differs per system, one line each. */
31727
- notes: "- Linux: if `service install` asks, also run `loginctl enable-linger $USER` once; in a container or dev pod without systemd, add the two lines it prints to crontab or the container's startup command.\n- macOS: the same commands; launchd keeps it running.\n- Windows: run the same commands inside WSL (for example Ubuntu).\n- npm says `EACCES`: run `npm config set prefix ~/.npm-global` and put `~/.npm-global/bin` on your `PATH` instead of using sudo.",
31728
- upgrade: (p) => `On that machine, run \`${p.command}\` to upgrade it and restart it.`,
31729
- versionUnsupported: (p) => `Its connector (${p.version}) is too old for a new session.`,
31730
- versionOutdated: (p) => `Its connector (${p.version}) is out of date.`,
31731
- offlineHint: "On that machine, run `claw-connector status` to see why, then `claw-connector service install` to start it again."
31732
- },
31733
- zh: {
31734
- noMachine: "\u4F60\u8FD8\u6CA1\u6709\u8FDE\u63A5\u4EFB\u4F55\u673A\u5668\u3002",
31735
- sep: "",
31736
- runOn: "\u5728\u8981\u4F7F\u7528\u7684\u673A\u5668\u4E0A\uFF08\u9700\u8981 Node.js 22 \u53CA\u4EE5\u4E0A\uFF09\u4F9D\u6B21\u8FD0\u884C\uFF1A",
31737
- after: "`init` \u4F1A\u751F\u6210 agents.toml \u5E76\u6253\u5370\u4F4D\u7F6E\uFF1A\u628A\u5176\u4E2D\u7684 `roots` \u6539\u6210\u5141\u8BB8 agent \u5DE5\u4F5C\u7684\u76EE\u5F55\uFF08\u793A\u4F8B\u662F `~/work`\uFF09\u3002`login` \u4F1A\u6253\u5370\u4E00\u4E2A\u94FE\u63A5\u548C\u9A8C\u8BC1\u7801\uFF1A\u5728\u5DF2\u767B\u5F55\u7684\u6D4F\u89C8\u5668\u91CC\u6253\u5F00\u5E76\u786E\u8BA4\u3002\u4E4B\u540E\u53D1 /agents \u5C31\u80FD\u770B\u5230\u8FD9\u53F0\u673A\u5668\u3002",
31738
- notes: "- Linux\uFF1A`service install` \u82E5\u63D0\u793A\uFF0C\u518D\u8FD0\u884C\u4E00\u6B21 `loginctl enable-linger $USER`\uFF1B\u5BB9\u5668\u6216 dev pod \u6CA1\u6709 systemd \u65F6\uFF0C\u628A\u5B83\u6253\u5370\u7684\u4E24\u884C\u52A0\u8FDB crontab \u6216\u5BB9\u5668\u542F\u52A8\u547D\u4EE4\u3002\n- macOS\uFF1A\u540C\u6837\u7684\u547D\u4EE4\uFF0C\u7531 launchd \u5E38\u9A7B\u3002\n- Windows\uFF1A\u5728 WSL\uFF08\u4F8B\u5982 Ubuntu\uFF09\u91CC\u8FD0\u884C\u540C\u6837\u7684\u547D\u4EE4\u3002\n- npm \u62A5 `EACCES`\uFF1A\u5148 `npm config set prefix ~/.npm-global`\uFF0C\u628A `~/.npm-global/bin` \u52A0\u8FDB `PATH`\uFF0C\u4E0D\u8981\u7528 sudo\u3002",
31739
- upgrade: (p) => `\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C \`${p.command}\` \u5347\u7EA7\u5E76\u91CD\u542F\u5B83\u3002`,
31740
- versionUnsupported: (p) => `\u8FDE\u63A5\u5668\u7248\u672C ${p.version} \u592A\u65E7\uFF0C\u4E0D\u80FD\u5F00\u65B0\u4F1A\u8BDD\u3002`,
31741
- versionOutdated: (p) => `\u8FDE\u63A5\u5668\u7248\u672C ${p.version} \u8F83\u65E7\uFF0C\u5EFA\u8BAE\u5347\u7EA7\u3002`,
31742
- offlineHint: "\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C `claw-connector status` \u770B\u539F\u56E0\uFF0C\u518D\u8FD0\u884C `claw-connector service install` \u91CD\u65B0\u542F\u52A8\u5B83\u3002"
31743
- }
31744
- });
31745
-
31746
- // packages/core/src/remote/connector/setup.ts
31747
- var CONNECTOR_PACKAGE_NAME = "@primusclaw/connector";
31748
- var UPGRADE_COMMAND = `npm install -g ${CONNECTOR_PACKAGE_NAME}@latest && claw-connector stop && claw-connector service install`;
31749
- var SAFE_URL = /^https?:\/\/[A-Za-z0-9.-]{1,253}(?::\d{1,5})?(?:\/[A-Za-z0-9._~-]{1,100}){0,8}$/;
31750
- var PAIR_CODE = /^[0-9A-HJKMNP-TV-Z]{4}-[0-9A-HJKMNP-TV-Z]{4}-[0-9A-HJKMNP-TV-Z]{4}$/;
31751
- function safeUrl(value) {
31752
- const text9 = pyRstrip(pyStrip(textOf7(value)), "/");
31753
- return SAFE_URL.test(text9) ? text9 : null;
31754
- }
31755
- function originOf(url) {
31756
- const match = /^(https?):\/\/([^/]+)/u.exec(url);
31757
- return match ? `${match[1] ?? ""}://${match[2] ?? ""}` : "";
31758
- }
31759
- function sameHost(a, b3) {
31760
- return originOf(a).toLowerCase() === originOf(b3).toLowerCase();
31761
- }
31762
- var Setup = class {
31763
- constructor(server, identityUrl) {
31764
- this.server = server;
31765
- this.identityUrl = identityUrl;
31766
- }
31767
- server;
31768
- identityUrl;
31769
- login() {
31770
- return "claw-connector login" + (this.server ? ` --server ${this.server}` : "") + (this.identityUrl ? ` --identity-url ${this.identityUrl}` : "");
31771
- }
31772
- commands() {
31773
- return [
31774
- `npm install -g ${CONNECTOR_PACKAGE_NAME}`,
31775
- "claw-connector init",
31776
- this.login(),
31777
- "claw-connector service install"
31778
- ];
31779
- }
31780
- };
31781
- function setupFrom(data, baseUrl) {
31782
- const base = safeUrl(baseUrl);
31783
- if (!base) return new Setup("", null);
31784
- const origin = originOf(base);
31785
- const given = recordOf(data);
31786
- const server = given ? safeUrl(given.server) : null;
31787
- if (given && server && sameHost(server, base)) {
31788
- const identity = safeUrl(given.identity_url);
31789
- return new Setup(server, identity && sameHost(identity, base) ? identity : origin);
31790
- }
31791
- return new Setup(base, origin);
31792
- }
31793
- function pairCommand(data, baseUrl) {
31794
- const given = recordOf(data);
31795
- if (!given) return null;
31796
- const code3 = textOf7(given.code).trim();
31797
- const server = safeUrl(given.server);
31798
- const base = safeUrl(baseUrl) ?? "";
31799
- if (!PAIR_CODE.test(code3) || !server || !sameHost(server, base)) return null;
31800
- return `npm install -g --no-update-notifier ${CONNECTOR_PACKAGE_NAME}@latest && claw-connector pair ${code3} --server ${server}`;
31801
- }
31802
- function connectSteps(setup, lang, lead = "") {
31803
- const text9 = connectorSetupText.in(lang);
31804
- return {
31805
- lead: (lead || text9.noMachine) + text9.sep + text9.runOn,
31806
- commands: setup.commands(),
31807
- after: text9.after,
31808
- notes: text9.notes
31809
- };
31810
- }
31811
- function connectMarkdown(setup, lang, lead = "") {
31812
- const steps = connectSteps(setup, lang, lead);
31813
- const block = "```\n" + steps.commands.join("\n") + "\n```";
31814
- return [steps.lead, block, steps.after, steps.notes].join("\n\n");
31815
- }
31816
- function upgradeText(lang, command = UPGRADE_COMMAND) {
31817
- return connectorSetupText.in(lang).upgrade({ command });
31818
- }
31819
- function versionNote(connector, lang = "en") {
31820
- const status = connector.versionStatus;
31821
- if (status !== "outdated" && status !== "unsupported") return null;
31822
- const version = connector.version.replace(/[^0-9A-Za-z.+-]/gu, "").slice(0, 40) || "?";
31823
- const text9 = connectorSetupText.in(lang);
31824
- const head = status === "unsupported" ? text9.versionUnsupported({ version }) : text9.versionOutdated({ version });
31825
- return head + text9.sep + upgradeText(lang);
31826
- }
31827
- function offlineHint(lang = "en") {
31828
- return connectorSetupText.in(lang).offlineHint;
31829
- }
31830
- var ConnectorSetup = class {
31831
- constructor(setup) {
31832
- this.setup = setup;
31833
- }
31834
- setup;
31835
- connectMarkdown(lang, lead = "") {
31836
- return connectMarkdown(this.setup, lang, lead);
31837
- }
31838
- connectSteps(lang, lead = "") {
31839
- return connectSteps(this.setup, lang, lead);
31840
- }
31841
- versionNote(connector, lang) {
31842
- return versionNote(connector, lang);
31843
- }
31844
- offlineHint(lang) {
31845
- return offlineHint(lang);
31846
- }
31847
- login() {
31848
- return this.setup.login();
31849
- }
31850
- };
31851
-
31852
32190
  // packages/core/src/remote/lists.ts
31853
32191
  var RemoteOff = class extends Error {
31854
32192
  name = "RemoteOff";
@@ -31994,7 +32332,7 @@ var MachineClicks = class {
31994
32332
  /** The person's connector the tapped button names, as Claw lists it now; null (said) when it is not theirs any more. */
31995
32333
  async ownConnector(click, includeHidden = false) {
31996
32334
  const { connectors } = await this.p.lists.machines(click.key, includeHidden);
31997
- const found = connectorById(connectors, textOf7(click.data["connector_id"]));
32335
+ const found = connectorById(connectors, textOf6(click.data["connector_id"]));
31998
32336
  if (found === void 0) await this.c.home(click, saidIn(this.c.lang(click), "agentGone"));
31999
32337
  return found ?? null;
32000
32338
  }
@@ -32005,10 +32343,10 @@ var MachineClicks = class {
32005
32343
  const lang = this.c.lang(click);
32006
32344
  let entries;
32007
32345
  if (click.data["all"] === "idle") {
32008
- const agent = connector.agents.find((a) => a.agentId === textOf7(click.data["agent_id"]));
32346
+ const agent = connector.agents.find((a) => a.agentId === textOf6(click.data["agent_id"]));
32009
32347
  entries = (agent ? resumableOf(agent) : []).filter((e) => e.state === "idle");
32010
32348
  } else {
32011
- const ref = textOf7(click.data["ref"]);
32349
+ const ref = textOf6(click.data["ref"]);
32012
32350
  entries = connector.agents.flatMap((a) => resumableOf(a).filter((e) => e.ref === ref)).slice(0, 1);
32013
32351
  }
32014
32352
  if (entries.length === 0) return this.c.home(click, saidIn(lang, "conversationGone"));
@@ -32041,7 +32379,7 @@ var MachineClicks = class {
32041
32379
  const connector = await this.ownConnector(click, true);
32042
32380
  if (connector === null) return;
32043
32381
  const hidden2 = connector.agents.flatMap((a) => hiddenOf(a));
32044
- const ref = textOf7(click.data["ref"]);
32382
+ const ref = textOf6(click.data["ref"]);
32045
32383
  const refs = click.data["all"] ? hidden2.map((e) => e.ref) : hidden2.filter((e) => e.ref === ref).map((e) => e.ref);
32046
32384
  const lang = this.c.lang(click);
32047
32385
  if (refs.length === 0) return this.c.home(click, saidIn(lang, "conversationGone"));
@@ -32057,7 +32395,7 @@ var MachineClicks = class {
32057
32395
  const words3 = remoteOffText.in(lang);
32058
32396
  if (!this.p.ctx.settings.enabled) return this.settled(click, words3.inactive);
32059
32397
  if (click.data["confirm"] !== true) return this.settled(click, words3.kept);
32060
- const connectorId = textOf7(click.data["connector_id"]);
32398
+ const connectorId = textOf6(click.data["connector_id"]);
32061
32399
  let connector;
32062
32400
  try {
32063
32401
  connector = connectorById((await this.p.lists.machines(click.key)).connectors, connectorId);
@@ -32083,7 +32421,7 @@ var MachineClicks = class {
32083
32421
  /** It did not go through: said; where pressing again can help, the card comes back with its buttons. */
32084
32422
  async offRefused(click, error, name, lang) {
32085
32423
  const words3 = remoteOffText.in(lang);
32086
- const connectorId = textOf7(click.data["connector_id"]);
32424
+ const connectorId = textOf6(click.data["connector_id"]);
32087
32425
  const again = async (text9) => {
32088
32426
  await this.c.end(click, disconnectAgainCard(text9, connectorId, disconnectTitle(name, lang), lang), text9);
32089
32427
  };
@@ -32110,280 +32448,6 @@ var remoteLeads = {
32110
32448
  notSwitchedTo: (mode) => [`\u6CA1\u6709\u5207\u5230 \`${mode}\``, `The agent did not switch to \`${mode}\``]
32111
32449
  };
32112
32450
 
32113
- // packages/core/src/locales/connector-reasons.ts
32114
- var connectorReasonText = defineCatalog({
32115
- en: {
32116
- mode_unavailable: 'The agent on that machine does not offer the permission mode this session needs. Most often the connector runs as root and the agent has `approval = "never"`: Claude offers no bypassPermissions mode to root, so a connector older than 0.1.5 refuses the session.',
32117
- mode_not_enforced: 'The agent could not be put in the permission mode the connector requires (or warned it will no longer ask), so the connector closed the session to stay safe. This happens with Claude running as root (older connectors), or when Claude\'s `permissions.defaultMode` is bypassPermissions and the agent has no `approval = "never"`.',
32118
- mode_not_confirmed: "The agent did not confirm the permission mode it was asked for, so the connector closed the session to stay safe. Upgrade the connector (it brings a newer agent adapter) and try again.",
32119
- mode_mismatch: "The agent reported a different permission mode from the one it was asked for, so the connector closed the session to stay safe. Upgrade the connector and try again; if it persists, check Claude's settings there.",
32120
- mode_not_allowed: 'That mode does not ask before each step, and the agent is not allowed to run that way on that machine. To allow it, set `approval = "never"` on the agent in agents.toml and restart the connector; otherwise pick a mode that asks.',
32121
- mode_id_required: "The mode switch named no mode. Tap Mode and pick one again.",
32122
- set_mode_failed: "The agent could not switch its mode; it keeps the one it had.",
32123
- adapter_gone: "The agent program on that machine has exited.",
32124
- adapter_start_failed: "The connector could not start the agent program on that machine (often: no access to the npm registry, or the command is missing). Run `claw-connector status` there and look at `run.log` in its state directory.",
32125
- adapter_unavailable: "The connector could not start the agent program for this turn.",
32126
- adapter_protocol: "The agent program answered in a way the connector does not expect, most likely a version mismatch. Upgrade the connector and try again.",
32127
- adapter_cannot_resume: "This agent cannot pick up the earlier conversation.",
32128
- adapter_error: "The agent program failed. Look at `run.log` in the connector's state directory on that machine.",
32129
- agent_auth_required: "The agent is not signed in on that machine. Run the agent there once (`claude`, for example) to sign in, then try again.",
32130
- cwd_outside_roots: "That directory is outside the roots the agent may work in. Pick one inside them, or add it to `roots` in agents.toml and restart the connector.",
32131
- cwd_not_found: "That folder does not exist on that machine: pick one that exists there, or create it there first.",
32132
- cwd_not_directory: "That path is not a directory.",
32133
- cwd_not_absolute: "The directory must be an absolute path (starting with /).",
32134
- invalid_cwd: "That directory name is not valid.",
32135
- cwd_mismatch: "That conversation is not in this directory. Pick it again from the list.",
32136
- unknown_agent: "That machine has no such agent (agents.toml may have changed). Check agents.toml there and restart the connector after a change.",
32137
- not_delivered: "The machine never got it, so nothing ran: it looked online when it was sent but had gone (a laptop closed, for one). Send it again once the machine is back.",
32138
- delivery_unconfirmed: "The machine went just as this was sent and did not confirm it got it, so it may not have run. If it does once the machine is back, what it says shows up here.",
32139
- connector_revoked: "That machine's connector was signed out (logout or `/agent off`), and its sessions closed with it. To go on, sign the connector in again there and start a new session.",
32140
- machine_reconnected: "That machine registered again (a reinstall, lost local state or a rebuilt container), and the old session closed with its old registration.",
32141
- unknown_session: "The connector no longer knows this session (it may have restarted).",
32142
- too_many_sessions: "Too many sessions are open on that machine. Close one with `/agent close` first.",
32143
- resume_not_supported: "This agent cannot continue an existing session.",
32144
- attach_unavailable: "This agent cannot take over a terminal conversation. Configure an agent with the `claude-attach` preset for that.",
32145
- resume_ref_required: "No conversation was named to take over. Pick one from the list.",
32146
- invalid_resume_ref: "That conversation reference is not valid. Pick one from the list.",
32147
- already_attached: "That conversation is already open from the phone. Switch to it with `/agent sessions`.",
32148
- catalog_unavailable: "The connector could not read the list of conversations on that machine.",
32149
- session_live: "That conversation is still open in a terminal on that machine. Quit it there first, then take it over.",
32150
- recently_written: "A terminal wrote to that conversation moments ago and may still be using it. Try again in a minute.",
32151
- twin_check_failed: "The connector could not check whether the conversation is still open in a terminal, so it did not take it over.",
32152
- terminal_did_not_exit: "The terminal did not let the conversation go when asked, so it was not taken over; it is still there. Quit it in the terminal first, then take it over.",
32153
- session_live_elsewhere: "That conversation is open on another machine or container sharing the Claude config directory; it cannot be ended from here, so it was not taken over. Quit it there, then try again.",
32154
- takeover_not_permitted: "The terminal holding the conversation belongs to another user, so the connector may not end it; it was not taken over.",
32155
- takeover_failed: "Ending the terminal's hold on the conversation failed, so it was not taken over.",
32156
- // (since connector 0.1.19 a running turn never holds a message back: Claude Code queues it; only someone's half-typed text in
32157
- // the box, or a screen scrolled back, held for 10 minutes ends it terminal_busy)
32158
- terminal_busy: "Someone was typing in the terminal (or had it scrolled back) for 10 minutes, so the message was not typed in. Send it again later.",
32159
- // (Claude Code took the message into its own queue, then someone at the terminal pulled that queue back into the box)
32160
- terminal_input_withdrawn: "The message was in Claude Code's queue in the terminal, but someone there pulled the queue back into the input box (up-arrow to edit), so it was not sent as the phone's message; it is now in the terminal's input box. To send it, press Enter in the terminal, or send it again from the phone.",
32161
- // (a terminal whose Claude Code cannot be told to hold this conversation, for 10 minutes)
32162
- terminal_state_unknown: "For 10 minutes the connector could not confirm that the terminal's Claude Code still has this conversation open, so the message was not typed in. Look at the terminal, make sure it is still on this conversation, and send again.",
32163
- terminal_gone: "The terminal's tmux pane is gone, so the message was not typed in.",
32164
- terminal_switched: "That terminal has moved to another conversation (a /resume or /clear there), so the message was not typed in.",
32165
- terminal_input_failed: "Typing the message into the terminal failed; it was not sent.",
32166
- // (a connector after 0.1.22: the paste never showed in the box in the 20 seconds it waited)
32167
- 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.",
32168
- // (not a failure: the terminal may well have taken it; what the session does next still shows here)
32169
- 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.",
32170
- terminal_input_unavailable: "After a restart the connector could not prove that terminal again, so the message was not typed in. Attach again.",
32171
- empty_prompt: "The message was empty once its control characters were removed; nothing was typed.",
32172
- // (a prompt to a session that only watches a terminal's conversation; also a turn_end error)
32173
- read_only_live_session: "That conversation is open in a terminal on that machine and can only be watched from here, so the message was not sent. Type it in the terminal, or take the conversation over first.",
32174
- terminal_session: "That conversation is open in a terminal, which keeps its own mode.",
32175
- terminal_mode_not_allowed: "The terminal's conversation is in a permission mode that does not ask (auto, for example), which this agent's approval setting does not allow from the phone, so the message was not typed in. Switch the terminal to a mode that asks (shift+tab in Claude Code: manual or plan) and send again, or set `approval = \"never\"` for this agent in agents.toml on that machine.",
32176
- terminal_mode_unknown: "The connector could not read which permission mode the terminal's conversation is in, so nothing was typed. Make sure Claude Code there is up to date and shows its mode below the input box, then send again.",
32177
- terminal_screen_unknown: "The connector could not read the terminal's screen for 30 seconds (no Claude Code input box, and it did not say it was busy), so the message was not typed in. Look at the terminal, close whatever is on it, and send again.",
32178
- terminal_command_refused: "A message that starts with ! or / would run a command in that terminal, so it is not typed from the phone. Rephrase it, or run the command at the terminal.",
32179
- takeover_expired: "The confirmation to take that conversation over reached the machine too late; it was not taken over. Open it again and confirm again.",
32180
- cwd_ambiguous: "More than one of this agent's roots has a folder by that name. Give its full path.",
32181
- root_unavailable: "The folder's disk is not answering on that machine (a network mount that is down or not mounted yet). Try again in a minute, or check the mount there.",
32182
- session_closed: "That session has already closed.",
32183
- closed: "The session was closed as asked.",
32184
- stopped: "The connector on that machine was stopped. Start it again there (`claw-connector run`, or the service's `sh keepalive.sh`).",
32185
- paused: "The connector on that machine is paused. Run `claw-connector resume` there.",
32186
- revoked: "That machine's connector was revoked. Run `{login}` there to sign in again.",
32187
- text_required: "The message to the agent was empty.",
32188
- action_and_option_required: "That answer named no request or option. Tap the card again.",
32189
- too_many_queued_prompts: "The agent has too many messages waiting; this one was not taken. Send it again when it has caught up.",
32190
- cancelled: "That message was dropped unrun when the agent was stopped.",
32191
- unknown_action: "That approval request is gone.",
32192
- option_not_offered: "That option is not one the agent offered."
32193
- },
32194
- zh: {
32195
- mode_unavailable: '\u90A3\u53F0\u673A\u5668\u4E0A\u7684 agent \u4E0D\u63D0\u4F9B\u8FD9\u4E2A\u4F1A\u8BDD\u9700\u8981\u7684\u6743\u9650\u6A21\u5F0F\u3002\u6700\u5E38\u89C1\u7684\u539F\u56E0\uFF1A\u8FDE\u63A5\u5668\u4EE5 root \u8FD0\u884C\u4E14\u8BE5 agent \u8BBE\u4E86 `approval = "never"`\uFF0Croot \u4E0B\u7684 Claude \u4E0D\u63D0\u4F9B bypassPermissions\uFF0C\u65E7\u7248\u8FDE\u63A5\u5668\uFF080.1.5 \u4E4B\u524D\uFF09\u56E0\u6B64\u62D2\u7EDD\u5F00\u4F1A\u8BDD\u3002',
32196
- mode_not_enforced: 'agent \u6CA1\u80FD\u5207\u5230\u8FDE\u63A5\u5668\u8981\u6C42\u7684\u6743\u9650\u6A21\u5F0F\uFF08\u6216\u63D0\u793A\u5B83\u4E0D\u4F1A\u518D\u9010\u6B65\u8BE2\u95EE\uFF09\uFF0C\u8FDE\u63A5\u5668\u4E3A\u5B89\u5168\u8D77\u89C1\u5173\u95ED\u4E86\u4F1A\u8BDD\u3002\u5E38\u89C1\u4E8E root \u4E0B\u7684 Claude \uFF08\u65E7\u7248\u8FDE\u63A5\u5668\uFF09\uFF0C\u6216 Claude \u7684 `permissions.defaultMode` \u662F bypassPermissions \u800C\u8BE5 agent \u6CA1\u8BBE `approval = "never"`\u3002',
32197
- mode_not_confirmed: "agent \u6CA1\u6709\u786E\u8BA4\u5B83\u5DF2\u5207\u5230\u8981\u6C42\u7684\u6743\u9650\u6A21\u5F0F\uFF0C\u8FDE\u63A5\u5668\u4E3A\u5B89\u5168\u8D77\u89C1\u5173\u95ED\u4E86\u4F1A\u8BDD\u3002\u5347\u7EA7\u8FDE\u63A5\u5668\uFF08\u4F1A\u5E26\u4E0A\u8F83\u65B0\u7684 agent \u9002\u914D\u5668\uFF09\u540E\u518D\u8BD5\u3002",
32198
- mode_mismatch: "agent \u62A5\u544A\u7684\u6743\u9650\u6A21\u5F0F\u548C\u8981\u6C42\u7684\u4E0D\u4E00\u81F4\uFF0C\u8FDE\u63A5\u5668\u4E3A\u5B89\u5168\u8D77\u89C1\u5173\u95ED\u4E86\u4F1A\u8BDD\u3002\u5347\u7EA7\u8FDE\u63A5\u5668\u540E\u518D\u8BD5\uFF1B\u4ECD\u7136\u51FA\u73B0\u7684\u8BDD\uFF0C\u68C0\u67E5\u90A3\u53F0\u673A\u5668\u4E0A Claude \u7684\u8BBE\u7F6E\u3002",
32199
- mode_not_allowed: '\u8FD9\u4E2A\u6A21\u5F0F\u4E0D\u9010\u6B65\u8BE2\u95EE\u6743\u9650\uFF0C\u800C\u8BE5 agent \u5728\u90A3\u53F0\u673A\u5668\u4E0A\u6CA1\u6709\u88AB\u5141\u8BB8\u8FD9\u6837\u8FD0\u884C\u3002\u8981\u5141\u8BB8\uFF0C\u5728 agents.toml \u91CC\u7ED9\u8BE5 agent \u8BBE `approval = "never"` \u5E76\u91CD\u542F\u8FDE\u63A5\u5668\uFF1B\u5426\u5219\u8BF7\u9009\u4E00\u4E2A\u4F1A\u8BE2\u95EE\u7684\u6A21\u5F0F\u3002',
32200
- mode_id_required: "\u5207\u6362\u6A21\u5F0F\u7684\u8BF7\u6C42\u91CC\u7F3A\u5C11\u6A21\u5F0F\u540D\u3002\u70B9\u300C\u6A21\u5F0F\u300D\u518D\u9009\u4E00\u6B21\u3002",
32201
- set_mode_failed: "agent \u6CA1\u80FD\u5207\u6362\u6A21\u5F0F\uFF0C\u4ECD\u662F\u539F\u6765\u7684\u6A21\u5F0F\u3002",
32202
- adapter_gone: "\u90A3\u53F0\u673A\u5668\u4E0A\u7684 agent \u7A0B\u5E8F\u5DF2\u7ECF\u9000\u51FA\u4E86\u3002",
32203
- adapter_start_failed: "\u8FDE\u63A5\u5668\u6CA1\u80FD\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u542F\u52A8 agent \u7A0B\u5E8F\uFF08\u5E38\u89C1\u539F\u56E0\uFF1A\u8BBF\u95EE\u4E0D\u4E86 npm \u4ED3\u5E93\u3001\u547D\u4EE4\u4E0D\u5B58\u5728\uFF09\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C `claw-connector status`\uFF0C\u5E76\u770B\u72B6\u6001\u76EE\u5F55\u91CC\u7684 `run.log`\u3002",
32204
- adapter_unavailable: "\u8FDE\u63A5\u5668\u6CA1\u80FD\u4E3A\u8FD9\u4E00\u8F6E\u542F\u52A8 agent \u7A0B\u5E8F\u3002",
32205
- adapter_protocol: "agent \u7A0B\u5E8F\u7684\u5E94\u7B54\u548C\u8FDE\u63A5\u5668\u9884\u671F\u7684\u4E0D\u4E00\u81F4\uFF0C\u591A\u534A\u662F\u7248\u672C\u4E0D\u5339\u914D\u3002\u5347\u7EA7\u8FDE\u63A5\u5668\u540E\u518D\u8BD5\u3002",
32206
- adapter_cannot_resume: "\u8FD9\u4E2A agent \u4E0D\u80FD\u63A5\u7740\u4E4B\u524D\u7684\u5BF9\u8BDD\u7EE7\u7EED\u3002",
32207
- adapter_error: "agent \u7A0B\u5E8F\u62A5\u9519\u4E86\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u770B\u8FDE\u63A5\u5668\u72B6\u6001\u76EE\u5F55\u91CC\u7684 `run.log`\u3002",
32208
- agent_auth_required: "\u90A3\u53F0\u673A\u5668\u4E0A\u7684 agent \u8FD8\u6CA1\u767B\u5F55\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C\u4E00\u6B21 agent\uFF08\u4F8B\u5982 `claude`\uFF09\u5B8C\u6210\u767B\u5F55\uFF0C\u518D\u8BD5\u3002",
32209
- cwd_outside_roots: "\u8FD9\u4E2A\u76EE\u5F55\u4E0D\u5728\u8BE5 agent \u5141\u8BB8\u7684 roots \u91CC\u3002\u6362\u4E00\u4E2A roots \u91CC\u7684\u76EE\u5F55\uFF0C\u6216\u5728 agents.toml \u7684 `roots` \u91CC\u52A0\u4E0A\u5B83\u5E76\u91CD\u542F\u8FDE\u63A5\u5668\u3002",
32210
- cwd_not_found: "\u90A3\u53F0\u673A\u5668\u4E0A\u6CA1\u6709\u8FD9\u4E2A\u76EE\u5F55\uFF1A\u9009\u4E00\u4E2A\u90A3\u91CC\u5DF2\u6709\u7684\u76EE\u5F55\uFF0C\u6216\u8005\u5148\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u5EFA\u597D\u5B83\u3002",
32211
- cwd_not_directory: "\u8FD9\u4E2A\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\u3002",
32212
- cwd_not_absolute: "\u76EE\u5F55\u8981\u5199\u6210\u7EDD\u5BF9\u8DEF\u5F84\uFF08\u4EE5 / \u5F00\u5934\uFF09\u3002",
32213
- invalid_cwd: "\u8FD9\u4E2A\u76EE\u5F55\u540D\u65E0\u6548\uFF0C\u6362\u4E00\u4E2A\u76EE\u5F55\u518D\u8BD5\u3002",
32214
- cwd_mismatch: "\u6240\u9009\u5BF9\u8BDD\u4E0D\u5728\u8FD9\u4E2A\u76EE\u5F55\u91CC\u3002\u4ECE\u5217\u8868\u91CC\u91CD\u65B0\u9009\u3002",
32215
- unknown_agent: "\u90A3\u53F0\u673A\u5668\u4E0A\u6CA1\u6709\u8FD9\u4E2A agent\uFF08agents.toml \u53EF\u80FD\u6539\u8FC7\uFF09\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u68C0\u67E5 agents.toml\uFF0C\u6539\u540E\u91CD\u542F\u8FDE\u63A5\u5668\u3002",
32216
- not_delivered: "\u90A3\u53F0\u673A\u5668\u6CA1\u6536\u5230\uFF0C\u4EC0\u4E48\u90FD\u6CA1\u6267\u884C\uFF1A\u53D1\u51FA\u65F6\u5B83\u770B\u8D77\u6765\u5728\u7EBF\uFF0C\u4F46\u5DF2\u7ECF\u65AD\u5F00\uFF08\u6BD4\u5982\u7B14\u8BB0\u672C\u5408\u76D6\u4E86\uFF09\u3002\u7B49\u5B83\u91CD\u65B0\u8FDE\u4E0A\u540E\u518D\u53D1\u4E00\u6B21\u3002",
32217
- delivery_unconfirmed: "\u90A3\u53F0\u673A\u5668\u5728\u8FD9\u6761\u6D88\u606F\u53D1\u51FA\u524D\u540E\u65AD\u5F00\u4E86\uFF0C\u6CA1\u6709\u786E\u8BA4\u6536\u5230\uFF0C\u53EF\u80FD\u6CA1\u6709\u6267\u884C\u3002\u5B83\u91CD\u65B0\u8FDE\u4E0A\u540E\u5982\u679C\u505A\u4E86\uFF0C\u7ED3\u679C\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002",
32218
- connector_revoked: "\u90A3\u53F0\u673A\u5668\u7684\u8FDE\u63A5\u5668\u5DF2\u88AB\u6CE8\u9500\uFF08logout \u6216 `/agent off`\uFF09\uFF0C\u5B83\u4E0A\u9762\u7684\u4F1A\u8BDD\u968F\u4E4B\u5173\u95ED\u3002\u8981\u7EE7\u7EED\uFF0C\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u91CD\u65B0\u767B\u5F55\u8FDE\u63A5\u5668\uFF0C\u518D\u5F00\u65B0\u4F1A\u8BDD\u3002",
32219
- machine_reconnected: "\u90A3\u53F0\u673A\u5668\u91CD\u65B0\u6CE8\u518C\u8FC7\uFF08\u91CD\u88C5\u3001\u4E22\u4E86\u672C\u5730\u72B6\u6001\u6216\u91CD\u5EFA\u4E86\u5BB9\u5668\uFF09\uFF0C\u65E7\u4F1A\u8BDD\u968F\u65E7\u6CE8\u518C\u5173\u95ED\u4E86\u3002",
32220
- unknown_session: "\u8FDE\u63A5\u5668\u4E0D\u8BA4\u8BC6\u8FD9\u4E2A\u4F1A\u8BDD\u4E86\uFF08\u53EF\u80FD\u5DF2\u91CD\u542F\u6216\u6E05\u7406\u8FC7\uFF09\u3002",
32221
- too_many_sessions: "\u90A3\u53F0\u673A\u5668\u4E0A\u540C\u65F6\u5F00\u7740\u7684\u4F1A\u8BDD\u592A\u591A\u4E86\u3002\u5148\u7528 `/agent close` \u5173\u6389\u4E00\u4E2A\u3002",
32222
- resume_not_supported: "\u8FD9\u4E2A agent \u4E0D\u652F\u6301\u63A5\u7740\u5DF2\u6709\u7684\u4F1A\u8BDD\u7EE7\u7EED\u3002",
32223
- attach_unavailable: "\u8FD9\u4E2A agent \u4E0D\u652F\u6301\u63A5\u7BA1\u7EC8\u7AEF\u91CC\u7684\u5BF9\u8BDD\u3002\u8981\u63A5\u7BA1\uFF0C\u8BF7\u7528 `claude-attach` \u9884\u8BBE\u914D\u7F6E\u4E00\u4E2A agent\u3002",
32224
- resume_ref_required: "\u6CA1\u6709\u6307\u660E\u8981\u63A5\u7BA1\u54EA\u6BB5\u5BF9\u8BDD\u3002\u4ECE\u5217\u8868\u91CC\u91CD\u65B0\u9009\u3002",
32225
- invalid_resume_ref: "\u8981\u63A5\u7BA1\u7684\u5BF9\u8BDD\u7F16\u53F7\u65E0\u6548\u3002\u4ECE\u5217\u8868\u91CC\u91CD\u65B0\u9009\u3002",
32226
- already_attached: "\u8FD9\u6BB5\u5BF9\u8BDD\u5DF2\u7ECF\u5728\u624B\u673A\u4E0A\u6253\u5F00\u4E86\u3002\u7528 `/agent sessions` \u5207\u8FC7\u53BB\u3002",
32227
- catalog_unavailable: "\u8FDE\u63A5\u5668\u6682\u65F6\u8BFB\u4E0D\u5230\u90A3\u53F0\u673A\u5668\u4E0A\u7684\u5BF9\u8BDD\u5217\u8868\u3002",
32228
- session_live: "\u8FD9\u6BB5\u5BF9\u8BDD\u8FD8\u5728\u90A3\u53F0\u673A\u5668\u7684\u7EC8\u7AEF\u91CC\u5F00\u7740\u3002\u5148\u5728\u7EC8\u7AEF\u91CC\u9000\u51FA\u5B83\uFF0C\u518D\u63A5\u7BA1\u3002",
32229
- recently_written: "\u7EC8\u7AEF\u521A\u5199\u8FC7\u8FD9\u6BB5\u5BF9\u8BDD\uFF0C\u53EF\u80FD\u8FD8\u5728\u7528\u3002\u8FC7\u4E00\u5206\u949F\u518D\u8BD5\u3002",
32230
- twin_check_failed: "\u8FDE\u63A5\u5668\u6CA1\u80FD\u786E\u8BA4\u8FD9\u6BB5\u5BF9\u8BDD\u662F\u5426\u8FD8\u5728\u7EC8\u7AEF\u91CC\u5F00\u7740\uFF0C\u4E3A\u5B89\u5168\u8D77\u89C1\u6CA1\u6709\u63A5\u7BA1\u3002",
32231
- terminal_did_not_exit: "\u7EC8\u7AEF\u91CC\u7684\u8FD9\u6BB5\u5BF9\u8BDD\u6CA1\u6709\u6309\u8981\u6C42\u9000\u51FA\uFF0C\u6240\u4EE5\u6CA1\u6709\u63A5\u7BA1\uFF0C\u5B83\u8FD8\u5728\u7EC8\u7AEF\u91CC\u3002\u5148\u5728\u7EC8\u7AEF\u91CC\u9000\u51FA\u5B83\uFF0C\u518D\u63A5\u7BA1\u3002",
32232
- session_live_elsewhere: "\u8FD9\u6BB5\u5BF9\u8BDD\u5F00\u5728\u53E6\u4E00\u53F0\u673A\u5668\u6216\u5BB9\u5668\u91CC\uFF08\u5171\u7528\u540C\u4E00\u4E2A Claude \u914D\u7F6E\u76EE\u5F55\uFF09\uFF0C\u8FD9\u91CC\u7ED3\u675F\u4E0D\u4E86\u5B83\uFF0C\u6240\u4EE5\u6CA1\u6709\u63A5\u7BA1\u3002\u5728\u90A3\u8FB9\u9000\u51FA\u5B83\u518D\u8BD5\u3002",
32233
- takeover_not_permitted: "\u7EC8\u7AEF\u91CC\u7684\u8FD9\u6BB5\u5BF9\u8BDD\u5C5E\u4E8E\u53E6\u4E00\u4E2A\u7CFB\u7EDF\u7528\u6237\uFF0C\u8FDE\u63A5\u5668\u65E0\u6743\u7ED3\u675F\u5B83\uFF0C\u6240\u4EE5\u6CA1\u6709\u63A5\u7BA1\u3002",
32234
- takeover_failed: "\u7ED3\u675F\u7EC8\u7AEF\u91CC\u7684\u8FD9\u6BB5\u5BF9\u8BDD\u5931\u8D25\u4E86\uFF0C\u6240\u4EE5\u6CA1\u6709\u63A5\u7BA1\u3002",
32235
- terminal_busy: "\u7EC8\u7AEF\u91CC\u6709\u4EBA\u5728\u8F93\u5165\uFF08\u6216\u6B63\u5728\u56DE\u6EDA\u67E5\u770B\uFF09\uFF0C\u7B49\u4E86 10 \u5206\u949F\u4E5F\u6CA1\u7A7A\u51FA\u6765\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u7A0D\u540E\u518D\u53D1\u3002",
32236
- terminal_input_withdrawn: "\u8FD9\u6761\u6D88\u606F\u5DF2\u7ECF\u6392\u8FDB\u7EC8\u7AEF\u91CC Claude Code \u7684\u961F\u5217\uFF0C\u4F46\u540E\u6765\u7EC8\u7AEF\u91CC\u6709\u4EBA\u628A\u961F\u5217\u62C9\u56DE\u4E86\u8F93\u5165\u6846\uFF08\u6309\u4E86\u4E0A\u952E\u7F16\u8F91\uFF09\uFF0C\u6240\u4EE5\u5B83\u6CA1\u6709\u4F5C\u4E3A\u624B\u673A\u6D88\u606F\u53D1\u51FA\uFF0C\u73B0\u5728\u5728\u7EC8\u7AEF\u7684\u8F93\u5165\u6846\u91CC\u3002\u8981\u53D1\uFF0C\u8BF7\u5728\u7EC8\u7AEF\u91CC\u56DE\u8F66\uFF0C\u6216\u4ECE\u624B\u673A\u91CD\u53D1\u3002",
32237
- terminal_state_unknown: "\u8FDE\u63A5\u5668 10 \u5206\u949F\u5185\u90FD\u6CA1\u6CD5\u786E\u8BA4\u90A3\u4E2A\u7EC8\u7AEF\u91CC\u7684 Claude Code \u8FD8\u5F00\u7740\u8FD9\u6BB5\u5BF9\u8BDD\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u770B\u4E00\u773C\u7EC8\u7AEF\uFF0C\u786E\u8BA4\u5B83\u8FD8\u5728\u8FD9\u6BB5\u5BF9\u8BDD\u91CC\uFF0C\u518D\u53D1\u4E00\u6B21\u3002",
32238
- terminal_gone: "\u7EC8\u7AEF\u90A3\u8FB9\u7684 tmux \u7A97\u683C\u5DF2\u7ECF\u6CA1\u4E86\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002",
32239
- 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",
32240
- terminal_input_failed: "\u5F80\u7EC8\u7AEF\u91CC\u8F93\u5165\u8FD9\u6761\u6D88\u606F\u5931\u8D25\u4E86\uFF0C\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002",
32241
- 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",
32242
- 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",
32243
- 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",
32244
- empty_prompt: "\u8FD9\u6761\u6D88\u606F\u53BB\u6389\u63A7\u5236\u5B57\u7B26\u540E\u662F\u7A7A\u7684\uFF0C\u6CA1\u6709\u53D1\u8FDB\u7EC8\u7AEF\u3002",
32245
- 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",
32246
- terminal_session: "\u8FD9\u6BB5\u5BF9\u8BDD\u5F00\u5728\u7EC8\u7AEF\u91CC\uFF0C\u6A21\u5F0F\u7531\u7EC8\u7AEF\u51B3\u5B9A\uFF0C\u8FD9\u91CC\u6539\u4E0D\u4E86\u3002",
32247
- terminal_mode_not_allowed: '\u7EC8\u7AEF\u91CC\u8FD9\u6BB5\u5BF9\u8BDD\u7684\u6743\u9650\u6A21\u5F0F\uFF08\u4F8B\u5982 auto\uFF09\u4E0D\u9010\u6B65\u8BE2\u95EE\uFF0C\u800C\u8FD9\u4E2A agent \u7684\u5BA1\u6279\u8BBE\u7F6E\u4E0D\u5141\u8BB8\u4ECE\u624B\u673A\u5F80\u8FD9\u79CD\u6A21\u5F0F\u91CC\u8F93\u5165\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u5728\u7EC8\u7AEF\u91CC\u6309 shift+tab \u5207\u5230\u4F1A\u8BE2\u95EE\u7684\u6A21\u5F0F\uFF08manual \u6216 plan\uFF09\u518D\u53D1\uFF1B\u6216\u5728\u90A3\u53F0\u673A\u5668\u7684 agents.toml \u91CC\u7ED9\u8FD9\u4E2A agent \u8BBE `approval = "never"`\u3002',
32248
- terminal_mode_unknown: "\u8FDE\u63A5\u5668\u8BFB\u4E0D\u51FA\u7EC8\u7AEF\u91CC\u8FD9\u6BB5\u5BF9\u8BDD\u5904\u4E8E\u54EA\u79CD\u6743\u9650\u6A21\u5F0F\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u786E\u8BA4\u90A3\u8FB9\u7684 Claude Code \u662F\u65B0\u7248\u3001\u8F93\u5165\u6846\u4E0B\u65B9\u663E\u793A\u7740\u6A21\u5F0F\uFF0C\u518D\u53D1\u4E00\u6B21\u3002",
32249
- terminal_screen_unknown: "\u8FDE\u63A5\u5668 30 \u79D2\u5185\u90FD\u8BA4\u4E0D\u51FA\u90A3\u4E2A\u7EC8\u7AEF\u7684\u753B\u9762\uFF08\u4E0D\u662F Claude Code \u7684\u8F93\u5165\u6846\uFF0C\u5B83\u4E5F\u6CA1\u8BF4\u81EA\u5DF1\u5728\u5FD9\uFF09\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u770B\u4E00\u773C\u7EC8\u7AEF\uFF0C\u5173\u6389\u4E0A\u9762\u7684\u4E1C\u897F\u518D\u53D1\u3002",
32250
- terminal_command_refused: "\u4EE5 ! \u6216 / \u5F00\u5934\u7684\u6D88\u606F\u4F1A\u5728\u90A3\u4E2A\u7EC8\u7AEF\u91CC\u6267\u884C\u547D\u4EE4\uFF0C\u6240\u4EE5\u4E0D\u4ECE\u624B\u673A\u8F93\u5165\u3002\u6362\u4E2A\u8BF4\u6CD5\uFF0C\u6216\u8005\u5728\u7EC8\u7AEF\u91CC\u81EA\u5DF1\u6267\u884C\u3002",
32251
- takeover_expired: "\u63A5\u7BA1\u786E\u8BA4\u5230\u8FBE\u90A3\u53F0\u673A\u5668\u65F6\u5DF2\u7ECF\u8FC7\u671F\uFF0C\u6CA1\u6709\u63A5\u7BA1\u3002\u91CD\u65B0\u6253\u5F00\u5E76\u518D\u786E\u8BA4\u4E00\u6B21\u3002",
32252
- cwd_ambiguous: "\u8FD9\u4E2A agent \u6709\u4E0D\u6B62\u4E00\u4E2A\u6839\u76EE\u5F55\u91CC\u6709\u540C\u540D\u6587\u4EF6\u5939\u3002\u8BF7\u5199\u51FA\u5B8C\u6574\u8DEF\u5F84\u3002",
32253
- root_unavailable: "\u90A3\u53F0\u673A\u5668\u4E0A\u8FD9\u4E2A\u76EE\u5F55\u6240\u5728\u7684\u76D8\u6CA1\u6709\u54CD\u5E94\uFF08\u7F51\u7EDC\u76D8\u65AD\u4E86\u6216\u8FD8\u6CA1\u6302\u4E0A\uFF09\u3002\u8FC7\u4E00\u5206\u949F\u518D\u8BD5\uFF0C\u6216\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u68C0\u67E5\u6302\u8F7D\u3002",
32254
- session_closed: "\u8FD9\u4E2A\u4F1A\u8BDD\u5DF2\u7ECF\u5173\u4E86\u3002",
32255
- closed: "\u4F1A\u8BDD\u5DF2\u6309\u8981\u6C42\u5173\u95ED\u3002",
32256
- stopped: "\u90A3\u53F0\u673A\u5668\u4E0A\u7684\u8FDE\u63A5\u5668\u505C\u4E86\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u91CD\u65B0\u542F\u52A8\u5B83\uFF08`claw-connector run`\uFF0C\u6216\u670D\u52A1\u7684 `sh keepalive.sh`\uFF09\u3002",
32257
- paused: "\u90A3\u53F0\u673A\u5668\u4E0A\u7684\u8FDE\u63A5\u5668\u6682\u505C\u4E86\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C `claw-connector resume`\u3002",
32258
- revoked: "\u90A3\u53F0\u673A\u5668\u7684\u8FDE\u63A5\u5668\u5DF2\u88AB\u6CE8\u9500\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C `{login}` \u91CD\u65B0\u767B\u5F55\u3002",
32259
- text_required: "\u53D1\u7ED9 agent \u7684\u6D88\u606F\u662F\u7A7A\u7684\u3002",
32260
- action_and_option_required: "\u8FD9\u6B21\u6279\u51C6\u7F3A\u5C11\u8981\u56DE\u7B54\u7684\u8BF7\u6C42\u6216\u9009\u9879\u3002\u5728\u5361\u7247\u4E0A\u518D\u70B9\u4E00\u6B21\u3002",
32261
- too_many_queued_prompts: "agent \u624B\u4E0A\u6392\u961F\u7684\u6D88\u606F\u592A\u591A\u4E86\uFF0C\u8FD9\u6761\u6CA1\u6709\u6536\u4E0B\u3002\u7B49\u5B83\u5904\u7406\u5B8C\u518D\u53D1\u3002",
32262
- cancelled: "\u8FD9\u6761\u6D88\u606F\u8FD8\u6CA1\u8FD0\u884C\u5C31\u56E0\u4E3A\u505C\u6B62\u800C\u88AB\u4E22\u5F03\u4E86\u3002",
32263
- unknown_action: "\u8FD9\u4E2A\u6279\u51C6\u8BF7\u6C42\u5DF2\u7ECF\u4E0D\u5728\u4E86\u3002",
32264
- option_not_offered: "\u8FD9\u4E2A\u9009\u9879\u4E0D\u662F agent \u63D0\u4F9B\u7684\u3002"
32265
- }
32266
- });
32267
- var connectorReasonHints = defineCatalog({
32268
- en: {
32269
- upgrade: (p) => `Upgrade the connector: on that machine run \`${p.command}\` (it installs the new version and restarts the connector on it).`,
32270
- sandbox: 'Workaround (only when the connector runs as root and the agent has `approval = "never"`): add `env = { IS_SANDBOX = "1" }` under that agent in agents.toml (or `IS_SANDBOX = "1"` in its existing `[agents.env]`), then restart the connector.',
32271
- status: "Run `claw-connector status` on that machine and look for a warning or problem line.",
32272
- newSession: "Start a new one with `/agent new`.",
32273
- retry: "Try again in a moment.",
32274
- unknown: (p) => `The connector gave a reason I do not know (${p.code}). Run \`claw-connector status\` on that machine, or upgrade the connector and try again.`,
32275
- /** Between a lead and the reason after it, and the end of a lead with none. */
32276
- leadSep: ": ",
32277
- leadEnd: "."
32278
- },
32279
- zh: {
32280
- upgrade: (p) => `\u5347\u7EA7\u8FDE\u63A5\u5668\uFF1A\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C \`${p.command}\`\uFF08\u4F1A\u88C5\u4E0A\u65B0\u7248\u672C\u5E76\u91CD\u542F\u8FDE\u63A5\u5668\uFF09\u3002`,
32281
- sandbox: '\u4E34\u65F6\u7ED5\u8FC7\uFF08\u4EC5\u5F53\u8FDE\u63A5\u5668\u4EE5 root \u8FD0\u884C\u3001\u4E14\u8BE5 agent \u8BBE\u4E86 `approval = "never"`\uFF09\uFF1A\u5728 agents.toml \u91CC\u8BE5 agent \u4E0B\u52A0 `env = { IS_SANDBOX = "1" }`\uFF08\u5DF2\u6709 `[agents.env]` \u7684\uFF0C\u5728\u5176\u4E2D\u52A0 `IS_SANDBOX = "1"`\uFF09\uFF0C\u518D\u91CD\u542F\u8FDE\u63A5\u5668\u3002',
32282
- status: "\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C `claw-connector status`\uFF0C\u770B\u6709\u6CA1\u6709 warning \u6216 problem \u884C\u3002",
32283
- newSession: "\u7528 `/agent new` \u5F00\u4E00\u4E2A\u65B0\u4F1A\u8BDD\u3002",
32284
- retry: "\u7A0D\u540E\u518D\u8BD5\u4E00\u6B21\u3002",
32285
- unknown: (p) => `\u8FDE\u63A5\u5668\u7ED9\u51FA\u4E86\u4E00\u4E2A\u6211\u4E0D\u8BA4\u8BC6\u7684\u539F\u56E0\uFF08${p.code}\uFF09\u3002\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u8FD0\u884C \`claw-connector status\` \u770B\u770B\uFF0C\u6216\u5347\u7EA7\u8FDE\u63A5\u5668\u540E\u518D\u8BD5\u3002`,
32286
- leadSep: "\uFF1A",
32287
- leadEnd: "\u3002"
32288
- }
32289
- });
32290
-
32291
- // packages/core/src/remote/connector/reasons.ts
32292
- var FIXED_IN = [0, 1, 5];
32293
- var CODE4 = /^[a-z][a-z0-9_]{0,63}$/u;
32294
- var VERSION = /^v?(\d+)\.(\d+)\.(\d+)/u;
32295
- var both = (fn) => [fn("zh"), fn("en")];
32296
- var UPGRADE = both((lang) => connectorReasonHints.in(lang).upgrade({ command: UPGRADE_COMMAND }));
32297
- var SANDBOX = both((lang) => connectorReasonHints.in(lang).sandbox);
32298
- var STATUS2 = both((lang) => connectorReasonHints.in(lang).status);
32299
- var OLD_CONNECTOR = /* @__PURE__ */ new Set(["mode_unavailable", "mode_not_enforced"]);
32300
- var FIXED_LATER = {
32301
- terminal_input_unconfirmed: [0, 1, 22]
32302
- };
32303
- var THEN_NEW = /* @__PURE__ */ new Set([
32304
- "adapter_gone",
32305
- "adapter_cannot_resume",
32306
- "unknown_session",
32307
- "resume_not_supported",
32308
- "session_closed",
32309
- "set_mode_failed",
32310
- "machine_reconnected"
32311
- ]);
32312
- var THEN_RETRY = /* @__PURE__ */ new Set(["catalog_unavailable", "twin_check_failed", "adapter_unavailable"]);
32313
- var KNOWN = new Set(Object.keys(connectorReasonText.in("en")));
32314
- function parseVersion2(value) {
32315
- const match = VERSION.exec(typeof value === "string" ? value.trim() : "");
32316
- return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
32317
- }
32318
- function older(version, than) {
32319
- for (let i = 0; i < than.length; i++) {
32320
- const a = version[i] ?? 0;
32321
- const b3 = than[i] ?? 0;
32322
- if (a !== b3) return a < b3;
32323
- }
32324
- return false;
32325
- }
32326
- function isCode(reason) {
32327
- return CODE4.test(reason);
32328
- }
32329
- function sentence2(code3, lang, setup) {
32330
- const text9 = own(connectorReasonText.in(lang), code3) ?? "";
32331
- return code3 === "revoked" ? text9.replaceAll("{login}", setup.login()) : text9;
32332
- }
32333
- function hintAfter(code3, lang, version) {
32334
- const hints = connectorReasonHints.in(lang);
32335
- if (OLD_CONNECTOR.has(code3)) {
32336
- const parsed = parseVersion2(version);
32337
- if (parsed === null || older(parsed, FIXED_IN))
32338
- return { sep: "\n\n", hint: `${hints.upgrade({ command: UPGRADE_COMMAND })}
32339
-
32340
- ${hints.sandbox}
32341
-
32342
- ` };
32343
- return { sep: " ", hint: hints.status };
32344
- }
32345
- const fixedIn = own(FIXED_LATER, code3);
32346
- if (fixedIn) {
32347
- const parsed = parseVersion2(version);
32348
- if (parsed !== null && older(parsed, fixedIn))
32349
- return { sep: "\n\n", hint: hints.upgrade({ command: UPGRADE_COMMAND }) };
32350
- return null;
32351
- }
32352
- if (THEN_NEW.has(code3)) return { sep: " ", hint: hints.newSession };
32353
- if (THEN_RETRY.has(code3)) return { sep: " ", hint: hints.retry };
32354
- return null;
32355
- }
32356
- function explain(code3, version = null, setup = new Setup("", null)) {
32357
- if (!KNOWN.has(code3)) return both((lang) => connectorReasonHints.in(lang).unknown({ code: code3 }));
32358
- return both((lang) => {
32359
- const after = hintAfter(code3, lang, version);
32360
- const own3 = sentence2(code3, lang, setup);
32361
- return after ? `${own3}${after.sep}${after.hint}` : own3;
32362
- });
32363
- }
32364
- function bareReason(reason) {
32365
- return pyStrip(pyRstrip(pyStrip(reason ?? ""), "."));
32366
- }
32367
- function inLang(lang, pair) {
32368
- if (lang === "zh") return pair[0];
32369
- if (lang === "en") return pair[1];
32370
- return `${pair[0]}
32371
- ${pair[1]}`;
32372
- }
32373
- function describe2(reason, lang, version = null, setup) {
32374
- const bare2 = bareReason(reason);
32375
- if (!bare2) return "";
32376
- if (!isCode(bare2)) return `${bare2}.`;
32377
- return inLang(lang, explain(bare2, version, setup));
32378
- }
32379
- function ended(lead, reason, lang, version = null, setup) {
32380
- if (lang === null) return ["zh", "en"].map((one) => ended(lead, reason, one, version, setup)).join("\n");
32381
- const why = describe2(reason, lang, version, setup);
32382
- const hints = connectorReasonHints.in(lang);
32383
- const head = inLang(lang, lead);
32384
- return why ? `${head}${hints.leadSep}${why}` : `${head}${hints.leadEnd}`;
32385
- }
32386
-
32387
32451
  // packages/core/src/remote/ended.ts
32388
32452
  async function credentialOf(key, provider) {
32389
32453
  return provider ? await provider() : key;
@@ -32510,7 +32574,7 @@ function filled(payload) {
32510
32574
  return payload !== null && Object.keys(payload).length > 0;
32511
32575
  }
32512
32576
  function actionIdOf(payload) {
32513
- return textOf7(payload.actionId);
32577
+ return textOf6(payload.actionId);
32514
32578
  }
32515
32579
  async function readTail(read, decode2) {
32516
32580
  const fold = new TailFold();
@@ -33798,7 +33862,7 @@ var SessionClicks = class {
33798
33862
  /** A tap that did not go through: the status card again when it was one of its buttons and still the chat's, else the list. */
33799
33863
  async back(click, lead) {
33800
33864
  const state = this.p.state.attached(click.chatKey);
33801
- const op = textOf7(click.data["op"]);
33865
+ const op = textOf6(click.data["op"]);
33802
33866
  if (state !== null && (["detach", "mode", "set_mode", "row", "stop"].includes(op) || isGroupKey(click.chatKey)) && // (a group: never the list)
33803
33867
  state.sessionId === click.data["session_id"]) {
33804
33868
  await this.end(click, (await this.p.ops.rowCard(click.chatKey, click.key, state, lead)).message, lead);
@@ -33860,7 +33924,7 @@ var SessionClicks = class {
33860
33924
  async send(click) {
33861
33925
  const state = await this.ownSession(click);
33862
33926
  if (state === null) return;
33863
- const text9 = cpSlice(pyStrip(textOf7(own(click.data, INPUT_ID))), 0, INPUT_MAX);
33927
+ const text9 = cpSlice(pyStrip(textOf6(own(click.data, INPUT_ID))), 0, INPUT_MAX);
33864
33928
  const view7 = this.p.state.view(click.chatKey, state);
33865
33929
  if (!text9) {
33866
33930
  await this.closer(click)(remoteAgentText.in(this.lang(click)).emptySend);
@@ -33915,7 +33979,7 @@ ${block}`, { aiGenerated: true }));
33915
33979
  async setMode(click) {
33916
33980
  const state = await this.ownSession(click);
33917
33981
  if (state === null) return;
33918
- const mode = textOf7(click.data["mode"]);
33982
+ const mode = textOf6(click.data["mode"]);
33919
33983
  const refusal4 = await this.commands.changeMode(click, mode);
33920
33984
  const lead = refusal4 ?? remoteAgentText.in(this.lang(click)).askingSwitch({ mode: neutral(mode, MODE_ID_MAX) });
33921
33985
  await this.end(click, (await this.p.ops.rowCard(click.chatKey, click.key, state, lead)).message, lead);
@@ -33943,7 +34007,7 @@ ${block}`, { aiGenerated: true }));
33943
34007
  if (done && click.tapped) this.p.ctx.remoteState.setRemoteStatusCard(click.chatKey, click.tapped);
33944
34008
  }
33945
34009
  async close(click) {
33946
- const wanted = textOf7(click.data["session_id"]);
34010
+ const wanted = textOf6(click.data["session_id"]);
33947
34011
  const { sessions } = await this.p.lists.sessions(click.key);
33948
34012
  const session = sessions.find((s) => s.sessionId === wanted);
33949
34013
  if (session === void 0) return this.home(click, saidIn(this.lang(click), "sessionNotFound"));
@@ -34043,7 +34107,7 @@ var FollowControl = class {
34043
34107
  /**
34044
34108
  * A conversation open in a terminal, watched or typed into: what is typed there is answered there, with no turn of the phone's to
34045
34109
  * end it, so its reply is told after a few quiet seconds, as a watch's is. With the half-minute of a session of the phone's own it
34046
- * came after the person had left (2026-11-11 guide re-check: nothing within 20 s, although the card says replies show up here).
34110
+ * came after the person had left (a guide re-check: nothing within 20 s, although the card says replies show up here).
34047
34111
  * Read each time they are used: a worker that restarted learns only after its reader started whether the session is a terminal's
34048
34112
  * (`resume`).
34049
34113
  */
@@ -34148,8 +34212,8 @@ var Permissions = class {
34148
34212
  const personal2 = isGroupKey(chatKey) ? this.ctx.references.getReference(personOf2(chatKey)) : null;
34149
34213
  const groupLang = this.state.lang(chatKey);
34150
34214
  const lang = personal2 ? this.state.lang(personOf2(chatKey)) : groupLang;
34151
- const actionId = textOf7(request["actionId"]);
34152
- if (TERMINAL_ORIGINS.has(textOf7(request["origin"]))) return;
34215
+ const actionId = textOf6(request["actionId"]);
34216
+ if (TERMINAL_ORIGINS.has(textOf6(request["origin"]))) return;
34153
34217
  const options = parseOptions(request["options"]);
34154
34218
  if (!actionId || options.length === 0) {
34155
34219
  await to.send(textMessage(saidIn(groupLang, "noAnswerableOption")));
@@ -34157,7 +34221,7 @@ var Permissions = class {
34157
34221
  }
34158
34222
  const expiresAt = this.ctx.clock.epochMs() / 1e3 + secondsOf2(request["timeout_ms"]);
34159
34223
  const words3 = remoteText.in(lang);
34160
- const tool2 = textOf7(request["tool"]) || words3.anAction;
34224
+ const tool2 = textOf6(request["tool"]) || words3.anAction;
34161
34225
  if (!this.ctx.permissions.saveRemotePermission({
34162
34226
  userId: chatKey,
34163
34227
  sessionId,
@@ -34218,7 +34282,7 @@ var Permissions = class {
34218
34282
  /** A click on an option of a permission card (see the module). */
34219
34283
  async decide(click) {
34220
34284
  const [sessionId, actionId, optionId] = ["session_id", "action_id", "option_id"].map(
34221
- (k) => textOf7(own(click.data, k))
34285
+ (k) => textOf6(own(click.data, k))
34222
34286
  );
34223
34287
  const perm = this.ctx.settings.enabled ? this.ctx.permissions.getRemotePermission(sessionId ?? "", actionId ?? "") : null;
34224
34288
  const lang = this.cardLang(perm, click.person);
@@ -34439,7 +34503,8 @@ var Prompts = class {
34439
34503
  this.closeTurn(p.chatKey, state);
34440
34504
  this.runner.stopReading(p.chatKey);
34441
34505
  }
34442
- if (refused3 !== void 0) await this.say(p.to, text9.queuedRefused({ reason: refused3 }));
34506
+ if (refused3 !== void 0)
34507
+ await this.say(p.to, text9.queuedRefused({ reason: describe2(refused3, this.state.lang(p.chatKey)) }));
34443
34508
  return;
34444
34509
  }
34445
34510
  if (reader) return;
@@ -35398,7 +35463,8 @@ var TurnRunner = class {
35398
35463
  }
35399
35464
  display.movedOn?.();
35400
35465
  try {
35401
- await to.send(textMessage(remoteAgentText.in(this.state.lang(chatKey)).queuedRefused({ reason })));
35466
+ const lang = this.state.lang(chatKey);
35467
+ await to.send(textMessage(remoteAgentText.in(lang).queuedRefused({ reason: describe2(reason, lang) })));
35402
35468
  } catch (error) {
35403
35469
  this.ctx.logger.warn("that a queued message was refused could not be told", { error: errorName(error) });
35404
35470
  }