@primusclaw/personal-agent 0.10.3 → 0.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +209 -28
- package/dist/types/assistant/confirm-outcome.d.ts +7 -0
- package/dist/types/assistant/events.d.ts +1 -1
- package/dist/types/locales/assistant-actions.d.ts +7 -0
- package/dist/types/locales/remote-leads.d.ts +2 -0
- package/dist/types/locales/remote.d.ts +5 -0
- package/dist/types/protocol/claw-api/assistant-events.d.ts +11 -2
- package/dist/types/remote/chats.d.ts +4 -0
- package/dist/types/remote/connector/reasons.d.ts +6 -0
- package/dist/types/remote/events.d.ts +8 -0
- package/dist/types/remote/lines.d.ts +10 -0
- package/dist/types/remote/turns/display.d.ts +5 -0
- package/dist/types/remote/turns/runner.d.ts +15 -0
- package/dist/types/remote/turns/window-turn.d.ts +2 -0
- package/dist/types/turn/progress/status-message.d.ts +15 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3994,7 +3994,14 @@ var assistantActionText = defineCatalog({
|
|
|
3994
3994
|
sent: (p) => `Sent to ${p.agent} on ${p.machine}${p.seq ? ` as #${p.seq}` : ""}. I will tell you when it is done or needs your approval.`,
|
|
3995
3995
|
notSent: "OK, not sent.",
|
|
3996
3996
|
sendExpired: "That card has expired; nothing was sent. Ask me again if you want it.",
|
|
3997
|
-
notSentWhy: (p) => `It could not be sent (${p.why})
|
|
3997
|
+
notSentWhy: (p) => `It could not be sent (${p.why}).`,
|
|
3998
|
+
githubMerged: "Merged.",
|
|
3999
|
+
githubQueued: "Put in the merge queue; it merges once its checks pass.",
|
|
4000
|
+
githubApproved: "Approval posted.",
|
|
4001
|
+
githubNotMerged: "OK, not merged.",
|
|
4002
|
+
githubNotApproved: "OK, the approval was not posted.",
|
|
4003
|
+
githubStale: "The pull request got new commits since, so nothing was done. Ask me to review it again.",
|
|
4004
|
+
githubRetry: "PrimusClaw could not try it just now, and it still waits for you. Press it again in a moment."
|
|
3998
4005
|
},
|
|
3999
4006
|
zh: {
|
|
4000
4007
|
...buttons,
|
|
@@ -4016,7 +4023,14 @@ var assistantActionText = defineCatalog({
|
|
|
4016
4023
|
sent: (p) => `\u5DF2\u53D1\u7ED9 ${p.machine} \u4E0A\u7684 ${p.agent}${p.seq ? `\uFF08#${p.seq}\uFF09` : ""}\u3002\u505A\u5B8C\u6216\u9700\u8981\u4F60\u6279\u51C6\u65F6\u6211\u4F1A\u544A\u8BC9\u4F60\u3002`,
|
|
4017
4024
|
notSent: "\u597D\u7684\uFF0C\u6CA1\u6709\u53D1\u9001\u3002",
|
|
4018
4025
|
sendExpired: "\u8FD9\u5F20\u5361\u5DF2\u8FC7\u671F\uFF0C\u4EC0\u4E48\u90FD\u6CA1\u53D1\u3002\u9700\u8981\u7684\u8BDD\u8BF7\u518D\u8DDF\u6211\u8BF4\u4E00\u6B21\u3002",
|
|
4019
|
-
notSentWhy: (p) => `\u6CA1\u80FD\u53D1\u9001\uFF08${p.why}\uFF09\u3002
|
|
4026
|
+
notSentWhy: (p) => `\u6CA1\u80FD\u53D1\u9001\uFF08${p.why}\uFF09\u3002`,
|
|
4027
|
+
githubMerged: "\u5DF2\u5408\u5165\u3002",
|
|
4028
|
+
githubQueued: "\u5DF2\u653E\u8FDB\u5408\u5E76\u961F\u5217\uFF0C\u68C0\u67E5\u901A\u8FC7\u540E\u5408\u5165\u3002",
|
|
4029
|
+
githubApproved: "\u6279\u51C6\u5DF2\u53D1\u51FA\u3002",
|
|
4030
|
+
githubNotMerged: "\u597D\u7684\uFF0C\u6CA1\u6709\u5408\u5165\u3002",
|
|
4031
|
+
githubNotApproved: "\u597D\u7684\uFF0C\u6CA1\u6709\u53D1\u51FA\u6279\u51C6\u3002",
|
|
4032
|
+
githubStale: "\u8FD9\u4E2A PR \u4E4B\u540E\u6709\u4E86\u65B0\u63D0\u4EA4\uFF0C\u6240\u4EE5\u4EC0\u4E48\u90FD\u6CA1\u505A\u3002\u9700\u8981\u7684\u8BDD\u8BA9\u6211\u518D\u5BA1\u4E00\u6B21\u3002",
|
|
4033
|
+
githubRetry: "PrimusClaw \u6682\u65F6\u6CA1\u80FD\u6267\u884C\uFF0C\u5B83\u8FD8\u5728\u7B49\u4F60\u786E\u8BA4\uFF0C\u8BF7\u8FC7\u4E00\u4F1A\u513F\u518D\u6309\u4E00\u6B21\u3002"
|
|
4020
4034
|
}
|
|
4021
4035
|
});
|
|
4022
4036
|
|
|
@@ -7183,6 +7197,8 @@ var StatusMessage = class {
|
|
|
7183
7197
|
streamOver = false;
|
|
7184
7198
|
/** The turn was cancelled (`close(true)`). */
|
|
7185
7199
|
hard = false;
|
|
7200
|
+
/** The answer is on its way (`finish`): the progress message is the answer's to retire. */
|
|
7201
|
+
finishing = false;
|
|
7186
7202
|
constructor(surface, options) {
|
|
7187
7203
|
this.surface = surface;
|
|
7188
7204
|
this.clock = options.clock;
|
|
@@ -7436,32 +7452,48 @@ ${line2}` : line2));
|
|
|
7436
7452
|
}
|
|
7437
7453
|
/**
|
|
7438
7454
|
* Stop sending progress. A sleeping flusher is cancelled; one that is mid-send finishes that one send, unless the turn
|
|
7439
|
-
* itself was cancelled (`hard`).
|
|
7440
|
-
*
|
|
7455
|
+
* itself was cancelled (`hard`). When the turn is cancelled, what shows it is ended in the background: a stream still open
|
|
7456
|
+
* is closed with INTERRUPTED (the floating status must not spin until the chat's limit), and the progress message is
|
|
7457
|
+
* retired (no answer follows it, so it must not stay in the chat as stale progress).
|
|
7441
7458
|
*/
|
|
7442
7459
|
close(hard = false) {
|
|
7443
7460
|
this.closed = true;
|
|
7444
|
-
this.hard = this.hard || hard;
|
|
7445
7461
|
this.stopPreparingTimer();
|
|
7446
7462
|
if (this.flusher && !this.flusher.done && (hard || !this.sending)) this.flusher.cancel();
|
|
7447
|
-
if (hard)
|
|
7448
|
-
|
|
7463
|
+
if (hard) this.cancelled();
|
|
7464
|
+
}
|
|
7465
|
+
/** The turn was cancelled: nothing more is repeated, and what shows it is ended (the first time only). */
|
|
7466
|
+
cancelled() {
|
|
7467
|
+
const first = !this.hard;
|
|
7468
|
+
this.hard = true;
|
|
7469
|
+
for (const task of [this.again, this.expiry, this.choice]) task?.cancel();
|
|
7470
|
+
if (this.live?.closable && !this.streamOver) {
|
|
7449
7471
|
this.streamOver = true;
|
|
7450
7472
|
const live = this.live;
|
|
7451
7473
|
detach(() => this.interrupt(live));
|
|
7452
7474
|
}
|
|
7475
|
+
if (first && this.posted && !this.finishing) detach(() => this.retireCancelled());
|
|
7453
7476
|
}
|
|
7454
7477
|
async interrupt(stream) {
|
|
7455
7478
|
const closed = await stream.final(plainMessage(turnText.in(this.lang).interrupted));
|
|
7456
7479
|
if (!closed.ok)
|
|
7457
7480
|
this.log.warn("the stream of a cancelled turn could not be closed; the chat closes it at its limit");
|
|
7458
7481
|
}
|
|
7482
|
+
/**
|
|
7483
|
+
* The turn was cancelled with its progress message on screen: no answer follows to replace it, so it is retired here
|
|
7484
|
+
* (deleted, or edited down to INTERRUPTED where the chat will not delete it). Never fails the turn.
|
|
7485
|
+
*/
|
|
7486
|
+
async retireCancelled() {
|
|
7487
|
+
const messageId = await this.messageId();
|
|
7488
|
+
if (messageId) await this.retire(messageId, plainMessage(turnText.in(this.lang).interrupted));
|
|
7489
|
+
}
|
|
7459
7490
|
/**
|
|
7460
7491
|
* The turn is over: the user gets `parts`, in order. With a stream the first part is its final message (in the place
|
|
7461
7492
|
* of the status) and the others follow; without one they are NEW messages, and the progress message is then retired.
|
|
7462
7493
|
* The thumbs (`feedback`) and suggested replies go under the LAST part, and nowhere else.
|
|
7463
7494
|
*/
|
|
7464
7495
|
async finish(parts2, options = {}) {
|
|
7496
|
+
this.finishing = true;
|
|
7465
7497
|
await this.quiesce();
|
|
7466
7498
|
const messages = answerMessages(parts2, options);
|
|
7467
7499
|
if (this.stream && this.stream.open && !this.streamOver) {
|
|
@@ -7527,10 +7559,11 @@ ${line2}` : line2));
|
|
|
7527
7559
|
if (wait > 0) await sleepSeconds(this.clock, wait);
|
|
7528
7560
|
}
|
|
7529
7561
|
/**
|
|
7530
|
-
* The answer is posted below: delete the progress message. The chat may
|
|
7531
|
-
* is then edited down to one line, so it does not sit
|
|
7562
|
+
* The answer is posted below, or none will come (the turn was cancelled): delete the progress message. The chat may
|
|
7563
|
+
* refuse, and a queue cannot delete; the message is then edited down to one line (`line`), so it does not sit in the
|
|
7564
|
+
* chat as stale progress. Never fails the turn.
|
|
7532
7565
|
*/
|
|
7533
|
-
async retire(messageId) {
|
|
7566
|
+
async retire(messageId, line2 = plainMessage(turnEnglish.doneLine)) {
|
|
7534
7567
|
await this.settle();
|
|
7535
7568
|
let removed;
|
|
7536
7569
|
try {
|
|
@@ -7541,9 +7574,8 @@ ${line2}` : line2));
|
|
|
7541
7574
|
}
|
|
7542
7575
|
if (removed) return;
|
|
7543
7576
|
this.log.warn("the progress message was not deleted; leaving it as one line");
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
this.reassert(messageId, done);
|
|
7577
|
+
await this.update(messageId, line2);
|
|
7578
|
+
this.reassert(messageId, line2);
|
|
7547
7579
|
}
|
|
7548
7580
|
/** Live edits went out, so one may still arrive after `message` replaced the progress message: send it once more. */
|
|
7549
7581
|
reassert(messageId, message) {
|
|
@@ -16569,9 +16601,35 @@ function skillSaveOutcome(status, out, lang) {
|
|
|
16569
16601
|
if (status === "expired") return t4.expired;
|
|
16570
16602
|
return s.refused({ why: or(result["message"], or(result["error"], status)) });
|
|
16571
16603
|
}
|
|
16604
|
+
function isGithubWrite(kind) {
|
|
16605
|
+
return kind === "github_merge" || kind === "github_review";
|
|
16606
|
+
}
|
|
16607
|
+
function githubWriteOutcome(kind, out, lang) {
|
|
16608
|
+
const t4 = assistantActionText.in(lang);
|
|
16609
|
+
const merge = kind === "github_merge";
|
|
16610
|
+
switch (or(out["status"], "")) {
|
|
16611
|
+
case "merged":
|
|
16612
|
+
return t4.githubMerged;
|
|
16613
|
+
case "queued":
|
|
16614
|
+
return t4.githubQueued;
|
|
16615
|
+
case "submitted":
|
|
16616
|
+
return t4.githubApproved;
|
|
16617
|
+
case "denied":
|
|
16618
|
+
return merge ? t4.githubNotMerged : t4.githubNotApproved;
|
|
16619
|
+
case "stale":
|
|
16620
|
+
return t4.githubStale;
|
|
16621
|
+
case "expired":
|
|
16622
|
+
return t4.expired;
|
|
16623
|
+
case "retry":
|
|
16624
|
+
return t4.githubRetry;
|
|
16625
|
+
default:
|
|
16626
|
+
return t4.notDone({ why: or(out["reason"], or(out["status"], "?")) });
|
|
16627
|
+
}
|
|
16628
|
+
}
|
|
16572
16629
|
function confirmOutcome(kind, out, lang) {
|
|
16573
16630
|
const t4 = assistantActionText.in(lang);
|
|
16574
16631
|
const status = or(out["status"], "");
|
|
16632
|
+
if (isGithubWrite(kind)) return githubWriteOutcome(kind, out, lang);
|
|
16575
16633
|
const create2 = kind === "trigger_create";
|
|
16576
16634
|
if (kind === "devenv_send") return devenvSendOutcome(status, out, lang);
|
|
16577
16635
|
if (kind === "devenv_hide") return devenvHideOutcome(status, out, lang);
|
|
@@ -16712,6 +16770,11 @@ var AssistantActions = class {
|
|
|
16712
16770
|
await this.notAnswered(click, card, error);
|
|
16713
16771
|
return;
|
|
16714
16772
|
}
|
|
16773
|
+
if (isGithubWrite(card.kind) && pyStr(out["status"]) === "retry") {
|
|
16774
|
+
store.assistantButtons.moveConfirmCard(card.cardId, "open");
|
|
16775
|
+
await this.again(click, card, confirmOutcome(card.kind, out, click.lang()));
|
|
16776
|
+
return;
|
|
16777
|
+
}
|
|
16715
16778
|
store.assistantButtons.moveConfirmCard(card.cardId, "done");
|
|
16716
16779
|
await finish(click, confirmOutcome(card.kind, out, click.lang()));
|
|
16717
16780
|
}
|
|
@@ -17831,7 +17894,9 @@ var CONFIRM_KINDS = [
|
|
|
17831
17894
|
"devenv_send",
|
|
17832
17895
|
"github_comment",
|
|
17833
17896
|
"devenv_hide",
|
|
17834
|
-
"skill_save"
|
|
17897
|
+
"skill_save",
|
|
17898
|
+
"github_merge",
|
|
17899
|
+
"github_review"
|
|
17835
17900
|
];
|
|
17836
17901
|
var ASSISTANT_SUGGESTED_REPLIES = {
|
|
17837
17902
|
zh: [
|
|
@@ -19219,6 +19284,9 @@ ${p.quoted}`,
|
|
|
19219
19284
|
unsolicitedOwn: (p) => `**${p.label}**, on its own:`,
|
|
19220
19285
|
unattendedNote: "Unattended: runs without asking for approval",
|
|
19221
19286
|
noAsk: (p) => `\u26A0\uFE0F This terminal is in ${p.name} mode: what you send from here runs at once, with no approval card.`,
|
|
19287
|
+
dialogAsks: (p) => `\u23F3 The terminal is waiting for your confirmation: ${p.what}`,
|
|
19288
|
+
dialogAsksBare: "\u23F3 The terminal is waiting for your confirmation",
|
|
19289
|
+
rowUnreadable: "\u2139\uFE0F Claude Code's session record for this terminal cannot be read, so the connector recognizes the session only by the name on its input box, and a confirmation on the screen hides it. Exit Claude Code there and reopen this conversation with `claude --resume`: then it is recognized reliably.",
|
|
19222
19290
|
noTextOutput: "Done. There was no text output.",
|
|
19223
19291
|
answerShortened: "\n\n... (shortened: ask the agent to continue, or read the rest on your machine)",
|
|
19224
19292
|
pairBody: (p) => `On the machine you want to connect, open a terminal in the folder the agents may work in and run this one line (it works once, within ${p.minutes} minutes):
|
|
@@ -19400,6 +19468,9 @@ ${p.quoted}`,
|
|
|
19400
19468
|
unsolicitedOwn: (p) => `**${p.label}**\uFF0C\u81EA\u5DF1\u8BF4\u7684\uFF1A`,
|
|
19401
19469
|
unattendedNote: "\u26A0\uFE0F \u65E0\u4EBA\u503C\u5B88\uFF1A\u6267\u884C\u524D\u4E0D\u4F1A\u8BF7\u6C42\u6279\u51C6",
|
|
19402
19470
|
noAsk: (p) => `\u26A0\uFE0F \u8FD9\u4E2A\u7EC8\u7AEF\u662F ${p.name} \u6A21\u5F0F\uFF1A\u624B\u673A\u53D1\u7684\u6307\u4EE4\u4F1A\u76F4\u63A5\u6267\u884C\uFF0C\u4E0D\u4F1A\u518D\u5F39\u5BA1\u6279\u5361\u3002`,
|
|
19471
|
+
dialogAsks: (p) => `\u23F3 \u7EC8\u7AEF\u5728\u7B49\u4F60\u786E\u8BA4\uFF1A${p.what}`,
|
|
19472
|
+
dialogAsksBare: "\u23F3 \u7EC8\u7AEF\u5728\u7B49\u4F60\u786E\u8BA4",
|
|
19473
|
+
rowUnreadable: "\u2139\uFE0F \u8FD9\u4E2A\u7EC8\u7AEF\u91CC Claude Code \u7684\u4F1A\u8BDD\u767B\u8BB0\u8BFB\u4E0D\u51FA\u6765\uFF0C\u8FDE\u63A5\u5668\u53EA\u80FD\u9760\u8F93\u5165\u6846\u4E0A\u7684\u4F1A\u8BDD\u540D\u8BA4\u51FA\u5B83\uFF0C\u7EC8\u7AEF\u5F39\u51FA\u786E\u8BA4\u65F6\u5C31\u8BA4\u4E0D\u51FA\u4E86\u3002\u5728\u7EC8\u7AEF\u91CC\u9000\u51FA Claude Code\uFF0C\u518D\u7528 `claude --resume` \u91CD\u65B0\u6253\u5F00\u8FD9\u6BB5\u4F1A\u8BDD\uFF0C\u4E4B\u540E\u5C31\u80FD\u7A33\u5B9A\u8BC6\u522B\u3002",
|
|
19403
19474
|
noTextOutput: "\u5B8C\u6210\u4E86\uFF0C\u6CA1\u6709\u6587\u5B57\u8F93\u51FA\u3002",
|
|
19404
19475
|
answerShortened: "\n\n\u2026\u2026\uFF08\u5DF2\u622A\u65AD\uFF1A\u8BA9 agent \u63A5\u7740\u8BF4\uFF0C\u6216\u5728\u4F60\u7684\u673A\u5668\u4E0A\u770B\u5176\u4F59\u90E8\u5206\uFF09",
|
|
19405
19476
|
pairBody: (p) => `\u5728\u8981\u8FDE\u63A5\u7684\u673A\u5668\u4E0A\u6253\u5F00\u7EC8\u7AEF\uFF0C\u8FDB\u5165 agent \u53EF\u4EE5\u5DE5\u4F5C\u7684\u76EE\u5F55\uFF0C\u8FD0\u884C\u4E0B\u9762\u8FD9\u4E00\u884C\uFF08${p.minutes} \u5206\u949F\u5185\u6709\u6548\uFF0C\u53EA\u80FD\u7528\u4E00\u6B21\uFF09\uFF1A
|
|
@@ -19443,7 +19514,7 @@ var remoteQueuedText = defineCatalog({
|
|
|
19443
19514
|
en: {
|
|
19444
19515
|
terminalWorking: "Queued",
|
|
19445
19516
|
terminalWaiting: "Needs confirm",
|
|
19446
|
-
terminalDialog: "
|
|
19517
|
+
terminalDialog: "Confirm there",
|
|
19447
19518
|
terminalTyping: "Box in use",
|
|
19448
19519
|
terminalScrolled: "Scrolled back",
|
|
19449
19520
|
other: "Waiting"
|
|
@@ -19451,7 +19522,7 @@ var remoteQueuedText = defineCatalog({
|
|
|
19451
19522
|
zh: {
|
|
19452
19523
|
terminalWorking: "\u5DF2\u6392\u961F",
|
|
19453
19524
|
terminalWaiting: "\u5F85\u786E\u8BA4",
|
|
19454
|
-
terminalDialog: "\u7B49\
|
|
19525
|
+
terminalDialog: "\u7B49\u4F60\u786E\u8BA4",
|
|
19455
19526
|
terminalTyping: "\u8F93\u5165\u6846\u5FD9",
|
|
19456
19527
|
terminalScrolled: "\u56DE\u6EDA\u4E2D",
|
|
19457
19528
|
other: "\u7B49\u7EC8\u7AEF"
|
|
@@ -21802,7 +21873,12 @@ function githubConfirmButtons(confirmationId, review, lang = "zh") {
|
|
|
21802
21873
|
var TYPED_MODE_HINT = "\u6309\u94AE\u70B9\u4E0D\u4E86\u65F6\uFF0C\u76F4\u63A5\u56DE\u590D\u300C\u786E\u8BA4\u5168\u81EA\u52A8\u300D\u6216\u300C\u786E\u8BA4\u9AD8\u98CE\u9669\u518D\u95EE\u6211\u300D\u5373\u53EF\u3002 / If the buttons do not work, reply \u786E\u8BA4\u5168\u81EA\u52A8 or \u786E\u8BA4\u9AD8\u98CE\u9669\u518D\u95EE\u6211.";
|
|
21803
21874
|
var REVIEW_MODES = {
|
|
21804
21875
|
high_risk_confirm: ["\u9AD8\u98CE\u9669\u4EBA\u5DE5\u518D\u786E\u8BA4\u4E00\u6B21\uFF08\u9ED8\u8BA4\uFF09", "A person confirms high-risk changes (default)"],
|
|
21805
|
-
|
|
21876
|
+
// (not "nobody is asked": a repository that asks for a person still holds a merge under it, and since 2026-11-18 a review the person
|
|
21877
|
+
// asks for in the chat merges unasked too)
|
|
21878
|
+
fully_auto: [
|
|
21879
|
+
"\u5168\u81EA\u52A8\u5408\u5165\uFF08\u4ED3\u5E93\u81EA\u8EAB\u8981\u6C42\u7684\u68C0\u67E5\u4ECD\u7136\u751F\u6548\uFF09",
|
|
21880
|
+
"Fully automatic merge (the repository's own requirements still apply)"
|
|
21881
|
+
]
|
|
21806
21882
|
};
|
|
21807
21883
|
|
|
21808
21884
|
// packages/core/src/review/review-turn.ts
|
|
@@ -26447,6 +26523,7 @@ __export(remote_exports, {
|
|
|
26447
26523
|
SUBFOLDER_MAX: () => SUBFOLDER_MAX,
|
|
26448
26524
|
TAKEOVER_STATES: () => TAKEOVER_STATES,
|
|
26449
26525
|
TERMINAL_CLOSED: () => TERMINAL_CLOSED,
|
|
26526
|
+
TERMINAL_INPUT_UNCONFIRMED: () => TERMINAL_INPUT_UNCONFIRMED,
|
|
26450
26527
|
THOUGHT_MAX: () => THOUGHT_MAX,
|
|
26451
26528
|
TOOL_TITLE_MAX: () => TOOL_TITLE_MAX,
|
|
26452
26529
|
TYPED_CHARS_MAX: () => TYPED_CHARS_MAX,
|
|
@@ -26498,12 +26575,14 @@ __export(remote_exports, {
|
|
|
26498
26575
|
placeOf: () => placeOf,
|
|
26499
26576
|
plain: () => plain3,
|
|
26500
26577
|
queuedLine: () => queuedLine,
|
|
26578
|
+
queuedNote: () => queuedNote,
|
|
26501
26579
|
readOnlyRefused: () => readOnlyRefused,
|
|
26502
26580
|
recoveredLine: () => recoveredLine,
|
|
26503
26581
|
remoteButton: () => remoteButton,
|
|
26504
26582
|
remoteData: () => remoteData,
|
|
26505
26583
|
remoteStep: () => remoteStep,
|
|
26506
26584
|
resumableOf: () => resumableOf,
|
|
26585
|
+
rowUnreadableLine: () => rowUnreadableLine,
|
|
26507
26586
|
sessionFacts: () => sessionFacts,
|
|
26508
26587
|
sessionPageUrl: () => sessionPageUrl,
|
|
26509
26588
|
sessionTitle: () => sessionTitle,
|
|
@@ -26519,6 +26598,7 @@ __export(remote_exports, {
|
|
|
26519
26598
|
typesInto: () => typesInto,
|
|
26520
26599
|
unattendedAllowed: () => unattendedAllowed,
|
|
26521
26600
|
unsolicitedParts: () => unsolicitedParts,
|
|
26601
|
+
unwrapPasted: () => unwrapPasted,
|
|
26522
26602
|
watchesLive: () => watchesLive,
|
|
26523
26603
|
whereLine: () => whereLine,
|
|
26524
26604
|
withdraws: () => withdraws
|
|
@@ -26694,6 +26774,7 @@ function hiddenOf(agent) {
|
|
|
26694
26774
|
|
|
26695
26775
|
// packages/core/src/remote/events.ts
|
|
26696
26776
|
import { z as z8 } from "zod";
|
|
26777
|
+
var DIALOG_MAX = 120;
|
|
26697
26778
|
var NOTHING2 = Object.freeze({
|
|
26698
26779
|
chunk: null,
|
|
26699
26780
|
tool: null,
|
|
@@ -26715,6 +26796,9 @@ var NOTHING2 = Object.freeze({
|
|
|
26715
26796
|
readOnly: null,
|
|
26716
26797
|
recovered: null,
|
|
26717
26798
|
queued: null,
|
|
26799
|
+
dialog: null,
|
|
26800
|
+
waitLine: null,
|
|
26801
|
+
rowUnreadable: false,
|
|
26718
26802
|
queuedFor: null,
|
|
26719
26803
|
queuedSeq: null,
|
|
26720
26804
|
queuedHeld: false,
|
|
@@ -26810,8 +26894,16 @@ function chunk(payload, kind) {
|
|
|
26810
26894
|
if (!text8) return NOTHING2;
|
|
26811
26895
|
return remoteStep({ chunk: { kind: kind === "agent_message_chunk" ? "message" : "thought", text: text8 } });
|
|
26812
26896
|
}
|
|
26897
|
+
var PASTED_BLOCK = /\n*<pasted_content id="([^"\s<>]{1,64})">\n([\s\S]*?)\n<\/pasted_content id="\1">\n*/gu;
|
|
26898
|
+
function unwrapPasted(text8) {
|
|
26899
|
+
if (!text8.includes("<pasted_content ")) return text8;
|
|
26900
|
+
return text8.replace(PASTED_BLOCK, (whole4, _id, inner, at, all) => {
|
|
26901
|
+
const end = at + whole4.length;
|
|
26902
|
+
return `${at > 0 ? "\n" : ""}${inner}${end < all.length ? "\n" : ""}`;
|
|
26903
|
+
});
|
|
26904
|
+
}
|
|
26813
26905
|
function typed(payload) {
|
|
26814
|
-
const text8 = pyStrip(textOf5(payload));
|
|
26906
|
+
const text8 = pyStrip(unwrapPasted(textOf5(payload)));
|
|
26815
26907
|
return text8 && !NOT_TYPED.test(text8) ? remoteStep({ typed: text8 }) : NOTHING2;
|
|
26816
26908
|
}
|
|
26817
26909
|
var TOOL_NAME = /^[A-Za-z][\w.-]{0,63}$/u;
|
|
@@ -26836,7 +26928,9 @@ function terminalQueued(payload) {
|
|
|
26836
26928
|
queued: str6(payload["reason"]) || "terminal_working",
|
|
26837
26929
|
queuedFor: forId || null,
|
|
26838
26930
|
queuedSeq: seq,
|
|
26839
|
-
queuedHeld: payload["held"] === "terminal"
|
|
26931
|
+
queuedHeld: payload["held"] === "terminal",
|
|
26932
|
+
dialog: neutral2(str6(payload["dialog"]), DIALOG_MAX) || null,
|
|
26933
|
+
rowUnreadable: payload["registry_row_unreadable"] === true
|
|
26840
26934
|
});
|
|
26841
26935
|
}
|
|
26842
26936
|
function turnEnd(payload, _kind, errors) {
|
|
@@ -26863,7 +26957,8 @@ function sessionStarted(payload) {
|
|
|
26863
26957
|
readOnly: flag2(payload["read_only"]) ?? false,
|
|
26864
26958
|
terminal: payload["input"] === "terminal",
|
|
26865
26959
|
terminalMode: neutral2(str6(payload["terminal_mode"]), 40) || null,
|
|
26866
|
-
acp: neutral2(str6(payload["acp_session_id"]), RESUME_REF_MAX) || null
|
|
26960
|
+
acp: neutral2(str6(payload["acp_session_id"]), RESUME_REF_MAX) || null,
|
|
26961
|
+
rowUnreadable: payload["registry_row_unreadable"] === true
|
|
26867
26962
|
});
|
|
26868
26963
|
}
|
|
26869
26964
|
function modeUpdate(payload) {
|
|
@@ -27010,6 +27105,7 @@ var DELIVERY_UNCONFIRMED = "delivery_unconfirmed";
|
|
|
27010
27105
|
var READ_ONLY_REASONS = ["read_only_live_session", "session_read_only"];
|
|
27011
27106
|
var TERMINAL_CLOSED = "terminal_closed";
|
|
27012
27107
|
var CONNECTOR_RESTARTED = "connector_restarted";
|
|
27108
|
+
var TERMINAL_INPUT_UNCONFIRMED = "terminal_input_unconfirmed";
|
|
27013
27109
|
var NO_ASK_MODES = {
|
|
27014
27110
|
bypassPermissions: "bypass permissions",
|
|
27015
27111
|
auto: "auto",
|
|
@@ -27066,6 +27162,15 @@ function queuedLine(reason, lang) {
|
|
|
27066
27162
|
const key = QUEUED_KEYS.get(reason);
|
|
27067
27163
|
return `\u23F3 ${key ? words3[key] : words3.other}`;
|
|
27068
27164
|
}
|
|
27165
|
+
function queuedNote(reason, dialog, lang) {
|
|
27166
|
+
if (reason !== "terminal_dialog") return queuedLine(reason, lang);
|
|
27167
|
+
const words3 = remoteText.in(lang);
|
|
27168
|
+
const what = dialog ? neutral2(masked2(dialog), 120) : "";
|
|
27169
|
+
return what ? words3.dialogAsks({ what }) : words3.dialogAsksBare;
|
|
27170
|
+
}
|
|
27171
|
+
function rowUnreadableLine(lang) {
|
|
27172
|
+
return remoteText.in(lang).rowUnreadable;
|
|
27173
|
+
}
|
|
27069
27174
|
function readOnlyRefused(lang, takeover = false) {
|
|
27070
27175
|
const words3 = remoteText.in(lang);
|
|
27071
27176
|
return words3.readOnly + (takeover ? words3.readOnlyTakeoverTail : "");
|
|
@@ -27751,7 +27856,7 @@ var RemoteLiveView = class {
|
|
|
27751
27856
|
apply(step) {
|
|
27752
27857
|
const before = this.render();
|
|
27753
27858
|
const waited = this.waiting;
|
|
27754
|
-
if (step.queued !== null) this.waiting = step.note ?? "";
|
|
27859
|
+
if (step.queued !== null) this.waiting = step.waitLine ?? step.note ?? "";
|
|
27755
27860
|
else if (showsTheTurn(step)) this.waiting = "";
|
|
27756
27861
|
if (step.chunk) this.addText(step.chunk.kind, step.chunk.text);
|
|
27757
27862
|
else if (step.tool) {
|
|
@@ -29206,6 +29311,8 @@ var ChatRegistry = class {
|
|
|
29206
29311
|
readOnly = /* @__PURE__ */ new Map();
|
|
29207
29312
|
readOnlyKnown = /* @__PURE__ */ new Map();
|
|
29208
29313
|
terminalInput = /* @__PURE__ */ new Map();
|
|
29314
|
+
/** The session each chat was told its terminal's registry row cannot be read for (once per attach). */
|
|
29315
|
+
rowHinted = /* @__PURE__ */ new Map();
|
|
29209
29316
|
tickets = /* @__PURE__ */ new Map();
|
|
29210
29317
|
/** How many messages wait behind the chat's running turn. */
|
|
29211
29318
|
queuedCount(chatKey) {
|
|
@@ -29299,6 +29406,12 @@ var ChatRegistry = class {
|
|
|
29299
29406
|
if (terminal) this.terminalInput.set(chatKey, sessionId);
|
|
29300
29407
|
else if (this.terminalInput.get(chatKey) === sessionId) this.terminalInput.delete(chatKey);
|
|
29301
29408
|
}
|
|
29409
|
+
/** True the first time for a chat's session: the chat is to be told its terminal's registry row cannot be read. */
|
|
29410
|
+
firstRowHint(chatKey, sessionId) {
|
|
29411
|
+
if (!sessionId || this.rowHinted.get(chatKey) === sessionId) return false;
|
|
29412
|
+
this.rowHinted.set(chatKey, sessionId);
|
|
29413
|
+
return true;
|
|
29414
|
+
}
|
|
29302
29415
|
/** What is sent to the chat's session is typed into a terminal on the machine. */
|
|
29303
29416
|
typesIntoTerminal(chatKey, sessionId) {
|
|
29304
29417
|
return sessionId !== null && this.terminalInput.get(chatKey) === sessionId;
|
|
@@ -29338,6 +29451,7 @@ var ChatRegistry = class {
|
|
|
29338
29451
|
this.agentUnattended.delete(chatKey);
|
|
29339
29452
|
this.readOnly.delete(chatKey);
|
|
29340
29453
|
this.readOnlyKnown.delete(chatKey);
|
|
29454
|
+
this.rowHinted.delete(chatKey);
|
|
29341
29455
|
this.queuedPrompts.delete(chatKey);
|
|
29342
29456
|
this.refusals.delete(chatKey);
|
|
29343
29457
|
}
|
|
@@ -30360,6 +30474,8 @@ var remoteLeads = {
|
|
|
30360
30474
|
sessionEnded: ["\u4F1A\u8BDD\u5DF2\u7ED3\u675F", "The session ended"],
|
|
30361
30475
|
couldNotStart: ["\u4F1A\u8BDD\u6CA1\u80FD\u542F\u52A8", "The session could not start"],
|
|
30362
30476
|
turnIncomplete: ["\u8FD9\u4E00\u8F6E\u6CA1\u6709\u5B8C\u6210", "The turn did not complete"],
|
|
30477
|
+
/** (a message the terminal may have taken: never said as a turn that did not complete) */
|
|
30478
|
+
inputUnconfirmed: ["\u8FD8\u6CA1\u786E\u8BA4\u7EC8\u7AEF\u6536\u5230", "Not confirmed by the terminal yet"],
|
|
30363
30479
|
modeNotSwitched: ["\u6A21\u5F0F\u6CA1\u6709\u5207\u6362", "The mode was not switched"],
|
|
30364
30480
|
notSwitchedTo: (mode) => [`\u6CA1\u6709\u5207\u5230 \`${mode}\``, `The agent did not switch to \`${mode}\``]
|
|
30365
30481
|
};
|
|
@@ -30419,7 +30535,8 @@ var connectorReasonText = defineCatalog({
|
|
|
30419
30535
|
terminal_input_failed: "Typing the message into the terminal failed; it was not sent.",
|
|
30420
30536
|
// (a connector after 0.1.22: the paste never showed in the box in the 20 seconds it waited)
|
|
30421
30537
|
terminal_input_unseen: "The message was typed into the terminal, but the terminal did not show it for 20 seconds (Claude Code there is busy or not taking input), so nothing was sent. Send it again in a moment.",
|
|
30422
|
-
|
|
30538
|
+
// (not a failure: the terminal may well have taken it; what the session does next still shows here)
|
|
30539
|
+
terminal_input_unconfirmed: "The message was typed into the terminal, but its transcript did not show it within 20 seconds, so it is not known whether the session took it. Whatever the session answers still shows here. Look at the terminal before you send it again, so it does not run twice.",
|
|
30423
30540
|
terminal_input_unavailable: "After a restart the connector could not prove that terminal again, so the message was not typed in. Attach again.",
|
|
30424
30541
|
empty_prompt: "The message was empty once its control characters were removed; nothing was typed.",
|
|
30425
30542
|
// (a prompt to a session that only watches a terminal's conversation; also a turn_end error)
|
|
@@ -30492,7 +30609,7 @@ var connectorReasonText = defineCatalog({
|
|
|
30492
30609
|
terminal_switched: "\u90A3\u4E2A\u7EC8\u7AEF\u5DF2\u7ECF\u6362\u5230\u53E6\u4E00\u6BB5\u5BF9\u8BDD\u4E86\uFF08\u5728\u7EC8\u7AEF\u91CC /resume \u6216 /clear \u8FC7\uFF09\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002",
|
|
30493
30610
|
terminal_input_failed: "\u5F80\u7EC8\u7AEF\u91CC\u8F93\u5165\u8FD9\u6761\u6D88\u606F\u5931\u8D25\u4E86\uFF0C\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002",
|
|
30494
30611
|
terminal_input_unseen: "\u8FD9\u6761\u6D88\u606F\u8F93\u8FDB\u7EC8\u7AEF\u540E\uFF0C\u7B49\u4E86 20 \u79D2\u7EC8\u7AEF\u90FD\u6CA1\u6709\u663E\u793A\u5B83\uFF08\u90A3\u8FB9\u7684 Claude Code \u6B63\u5FD9\u6216\u6CA1\u5728\u63A5\u6536\u8F93\u5165\uFF09\uFF0C\u6240\u4EE5\u6CA1\u6709\u53D1\u51FA\u53BB\u3002\u7A0D\u540E\u518D\u53D1\u4E00\u6B21\u3002",
|
|
30495
|
-
terminal_input_unconfirmed: "\u6D88\u606F\u5DF2\u7ECF\u8F93\u5165\u7EC8\u7AEF\uFF0C\u4F46\u7EC8\u7AEF\u7684\u8BB0\u5F55\u91CC\u6CA1\u770B\u5230\u5B83\uFF0C\
|
|
30612
|
+
terminal_input_unconfirmed: "\u6D88\u606F\u5DF2\u7ECF\u8F93\u5165\u7EC8\u7AEF\uFF0C\u4F46 20 \u79D2\u5185\u7EC8\u7AEF\u7684\u5BF9\u8BDD\u8BB0\u5F55\u91CC\u8FD8\u6CA1\u770B\u5230\u5B83\uFF0C\u6682\u65F6\u4E0D\u80FD\u786E\u8BA4\u90A3\u8FB9\u5DF2\u7ECF\u6536\u5230\u3002\u90A3\u8FB9\u4E4B\u540E\u7684\u56DE\u590D\u4ECD\u4F1A\u53D1\u5230\u8FD9\u91CC\u3002\u8981\u91CD\u53D1\u7684\u8BDD\u5148\u770B\u4E00\u773C\u7EC8\u7AEF\uFF0C\u514D\u5F97\u540C\u4E00\u4EF6\u4E8B\u505A\u4E24\u904D\u3002",
|
|
30496
30613
|
terminal_input_unavailable: "\u8FDE\u63A5\u5668\u91CD\u542F\u540E\u6CA1\u80FD\u518D\u786E\u8BA4\u90A3\u4E2A\u7EC8\u7AEF\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u91CD\u65B0 attach \u4E00\u6B21\u3002",
|
|
30497
30614
|
empty_prompt: "\u8FD9\u6761\u6D88\u606F\u53BB\u6389\u63A7\u5236\u5B57\u7B26\u540E\u662F\u7A7A\u7684\uFF0C\u6CA1\u6709\u53D1\u8FDB\u7EC8\u7AEF\u3002",
|
|
30498
30615
|
read_only_live_session: "\u8FD9\u6BB5\u5BF9\u8BDD\u6B63\u5F00\u5728\u90A3\u53F0\u673A\u5668\u7684\u7EC8\u7AEF\u91CC\uFF0C\u8FD9\u8FB9\u53EA\u80FD\u770B\u3001\u4E0D\u80FD\u8F93\u5165\uFF0C\u8FD9\u6761\u6D88\u606F\u6CA1\u6709\u53D1\u8FDB\u53BB\u3002\u5728\u7EC8\u7AEF\u91CC\u8F93\u5165\uFF0C\u6216\u5148\u63A5\u7BA1\u518D\u53D1\u3002",
|
|
@@ -30550,6 +30667,9 @@ var UPGRADE = both((lang) => connectorReasonHints.in(lang).upgrade({ command: UP
|
|
|
30550
30667
|
var SANDBOX = both((lang) => connectorReasonHints.in(lang).sandbox);
|
|
30551
30668
|
var STATUS2 = both((lang) => connectorReasonHints.in(lang).status);
|
|
30552
30669
|
var OLD_CONNECTOR = /* @__PURE__ */ new Set(["mode_unavailable", "mode_not_enforced"]);
|
|
30670
|
+
var FIXED_LATER = {
|
|
30671
|
+
terminal_input_unconfirmed: [0, 1, 22]
|
|
30672
|
+
};
|
|
30553
30673
|
var THEN_NEW = /* @__PURE__ */ new Set([
|
|
30554
30674
|
"adapter_gone",
|
|
30555
30675
|
"adapter_cannot_resume",
|
|
@@ -30592,6 +30712,13 @@ ${hints.sandbox}
|
|
|
30592
30712
|
` };
|
|
30593
30713
|
return { sep: " ", hint: hints.status };
|
|
30594
30714
|
}
|
|
30715
|
+
const fixedIn = own(FIXED_LATER, code3);
|
|
30716
|
+
if (fixedIn) {
|
|
30717
|
+
const parsed = parseVersion2(version);
|
|
30718
|
+
if (parsed !== null && older(parsed, fixedIn))
|
|
30719
|
+
return { sep: "\n\n", hint: hints.upgrade({ command: UPGRADE_COMMAND }) };
|
|
30720
|
+
return null;
|
|
30721
|
+
}
|
|
30595
30722
|
if (THEN_NEW.has(code3)) return { sep: " ", hint: hints.newSession };
|
|
30596
30723
|
if (THEN_RETRY.has(code3)) return { sep: " ", hint: hints.retry };
|
|
30597
30724
|
return null;
|
|
@@ -30645,7 +30772,8 @@ var EndedWords = class {
|
|
|
30645
30772
|
* sentence then offers the upgrade, which cannot hurt).
|
|
30646
30773
|
*/
|
|
30647
30774
|
async connectorVersion(key, provider, connectorId, reason) {
|
|
30648
|
-
|
|
30775
|
+
const code3 = (reason ?? "").trim();
|
|
30776
|
+
if (!(OLD_CONNECTOR.has(code3) || Object.hasOwn(FIXED_LATER, code3)) || !connectorId) return null;
|
|
30649
30777
|
try {
|
|
30650
30778
|
const credential2 = await credentialOf(key, provider);
|
|
30651
30779
|
if (!credential2) return null;
|
|
@@ -31518,6 +31646,8 @@ var Watches = class {
|
|
|
31518
31646
|
const lang = this.state.lang(w.chatKey);
|
|
31519
31647
|
const warning = step.terminal === true ? noAskLine(step.terminalMode, lang) : null;
|
|
31520
31648
|
if (warning) await w.to.send(textMessage(warning));
|
|
31649
|
+
if (step.terminal === true && step.rowUnreadable && this.state.chats.firstRowHint(w.chatKey, w.sessionId))
|
|
31650
|
+
await w.to.send(textMessage(rowUnreadableLine(lang)));
|
|
31521
31651
|
const switched = w.want ? await this.approvalNote(w, w.want, signal) : "";
|
|
31522
31652
|
const state = this.state.attached(w.chatKey);
|
|
31523
31653
|
if (state?.sessionId !== w.sessionId) return;
|
|
@@ -33375,6 +33505,8 @@ var TurnRunner = class {
|
|
|
33375
33505
|
ended;
|
|
33376
33506
|
show;
|
|
33377
33507
|
displayFor;
|
|
33508
|
+
/** The questions on the terminal each turn's display said in the chat (by their line). */
|
|
33509
|
+
questionsTold = /* @__PURE__ */ new WeakMap();
|
|
33378
33510
|
/** Per chat: what it was told of each message (Claw's number) waiting for a busy terminal (`tellBusy`), oldest first. */
|
|
33379
33511
|
toldBusy = /* @__PURE__ */ new Map();
|
|
33380
33512
|
/** Watch the turn that is open on the chat's session. */
|
|
@@ -33461,7 +33593,14 @@ var TurnRunner = class {
|
|
|
33461
33593
|
splitErrorTail: (text8) => this.ctx.errors.splitErrorTail(text8),
|
|
33462
33594
|
withhold: (detail) => this.ctx.errors.withhold("remote_turn_failed", detail, { session: state.sessionId }),
|
|
33463
33595
|
sessionEnded: (reason) => this.ended.sessionEnded(chatKey, request.key, request.provider, state.connectorId, reason),
|
|
33464
|
-
turnIncomplete: (code3) => this.ended.said(
|
|
33596
|
+
turnIncomplete: (code3) => this.ended.said(
|
|
33597
|
+
chatKey,
|
|
33598
|
+
code3 === TERMINAL_INPUT_UNCONFIRMED ? remoteLeads.inputUnconfirmed : remoteLeads.turnIncomplete,
|
|
33599
|
+
request.key,
|
|
33600
|
+
request.provider,
|
|
33601
|
+
state.connectorId,
|
|
33602
|
+
code3
|
|
33603
|
+
),
|
|
33465
33604
|
...signer ? { sign: (parts2) => signer.later(parts2) } : {}
|
|
33466
33605
|
}
|
|
33467
33606
|
);
|
|
@@ -33538,9 +33677,9 @@ var TurnRunner = class {
|
|
|
33538
33677
|
if (step.rejected?.type === "prompt" && step.rejected.cmdSeq !== null) {
|
|
33539
33678
|
await this.queuedRefused(chatKey, to, step.rejected.cmdSeq, step.rejected.reason);
|
|
33540
33679
|
}
|
|
33541
|
-
|
|
33542
|
-
display.progress(
|
|
33543
|
-
if (step.
|
|
33680
|
+
if (step.queued !== null) await this.showWait(request, step, display);
|
|
33681
|
+
else display.progress(step);
|
|
33682
|
+
if (step.rowUnreadable) await this.sayRowUnreadable(chatKey, sid, to);
|
|
33544
33683
|
if (saysModes(step)) this.ctx.remoteState.setRemoteModes(chatKey, sid, step);
|
|
33545
33684
|
if (step.permission !== null) await this.show(chatKey, sid, step.permission, to);
|
|
33546
33685
|
if (step.resolved !== null) this.ctx.permissions.closeRemotePermission(sid, actionIdOf(step.resolved), "decided");
|
|
@@ -33590,6 +33729,46 @@ var TurnRunner = class {
|
|
|
33590
33729
|
this.ctx.logger.warn("that a queued message was refused could not be told", { error: errorName(error) });
|
|
33591
33730
|
}
|
|
33592
33731
|
}
|
|
33732
|
+
/**
|
|
33733
|
+
* Why the message still waits for the terminal, in the chat's language: the whole line in the turn's live view and on the session
|
|
33734
|
+
* card, a short one in the floating status; what a question on the terminal asks is also said in the chat when the display does
|
|
33735
|
+
* not show the whole line; that it waits for a busy terminal is said in the chat at once (`tellBusy`).
|
|
33736
|
+
*/
|
|
33737
|
+
async showWait(request, step, display) {
|
|
33738
|
+
const { chatKey, to } = request;
|
|
33739
|
+
const lang = this.state.lang(chatKey);
|
|
33740
|
+
const reason = step.queued ?? "";
|
|
33741
|
+
const note = queuedNote(reason, step.dialog, lang);
|
|
33742
|
+
display.progress({ ...step, note, waitLine: queuedLine(reason, lang) });
|
|
33743
|
+
if (reason === "terminal_dialog" && !display.showsWaits) await this.sayQuestion(display, note, to);
|
|
33744
|
+
if (BUSY_REASONS.has(reason)) await this.tellBusy(request, step);
|
|
33745
|
+
}
|
|
33746
|
+
/**
|
|
33747
|
+
* What a question on the terminal asks, while the message waits for it: said in the chat once per question and turn (the stream's
|
|
33748
|
+
* floating status has room for a few characters only, and the person must answer it at the terminal before anything runs).
|
|
33749
|
+
*/
|
|
33750
|
+
async sayQuestion(display, line2, to) {
|
|
33751
|
+
const told = this.questionsTold.get(display) ?? /* @__PURE__ */ new Set();
|
|
33752
|
+
if (told.has(line2)) return;
|
|
33753
|
+
told.add(line2);
|
|
33754
|
+
this.questionsTold.set(display, told);
|
|
33755
|
+
try {
|
|
33756
|
+
await to.send(textMessage(line2));
|
|
33757
|
+
} catch (error) {
|
|
33758
|
+
this.ctx.logger.warn("what the terminal's question asks could not be told", { error: errorName(error) });
|
|
33759
|
+
}
|
|
33760
|
+
}
|
|
33761
|
+
/** Once per attach: the terminal's registry row cannot be read, and a restart of it there makes it known again. */
|
|
33762
|
+
async sayRowUnreadable(chatKey, sid, to) {
|
|
33763
|
+
if (!this.state.chats.firstRowHint(chatKey, sid)) return;
|
|
33764
|
+
try {
|
|
33765
|
+
await to.send(textMessage(rowUnreadableLine(this.state.lang(chatKey))));
|
|
33766
|
+
} catch (error) {
|
|
33767
|
+
this.ctx.logger.warn("that the terminal's registry row cannot be read could not be told", {
|
|
33768
|
+
error: errorName(error)
|
|
33769
|
+
});
|
|
33770
|
+
}
|
|
33771
|
+
}
|
|
33593
33772
|
async sayRecovered(chatKey, to, interrupted, continuing) {
|
|
33594
33773
|
const state = this.ctx.remoteState.getRemote(chatKey);
|
|
33595
33774
|
if (!state?.sessionId) return;
|
|
@@ -33637,6 +33816,8 @@ var WindowTurn = class {
|
|
|
33637
33816
|
board;
|
|
33638
33817
|
cutError;
|
|
33639
33818
|
tail = "";
|
|
33819
|
+
/** (the card's state line says why a message waits, whole) */
|
|
33820
|
+
showsWaits = true;
|
|
33640
33821
|
segments = [];
|
|
33641
33822
|
newSegment = true;
|
|
33642
33823
|
closed = false;
|
|
@@ -8,6 +8,13 @@ export declare function commentOutcome(out: Fields, lang: Lang): string | undefi
|
|
|
8
8
|
export declare function devenvSendOutcome(status: string, out: Fields, lang: Lang): string;
|
|
9
9
|
/** What came of Save or Discard on a drafted skill's card: saved (which version), discarded, or why not. */
|
|
10
10
|
export declare function skillSaveOutcome(status: string, out: Fields, lang: Lang): string;
|
|
11
|
+
/** A merge or an approval a review holds (`github_merge`, `github_review`). */
|
|
12
|
+
export declare function isGithubWrite(kind: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* What came of a press on a merge's or an approval's card: Claw's answer to the review's own decision
|
|
15
|
+
* (`POST /v1/github-review/confirmations/:id/decision`: `merged`, `queued`, `submitted`, `denied`, `stale`, `expired`, `refused`, `retry`).
|
|
16
|
+
*/
|
|
17
|
+
export declare function githubWriteOutcome(kind: string, out: Fields, lang: Lang): string;
|
|
11
18
|
/** What came of a press on a held write's card of `kind`, in one line: Claw's answer said plainly. */
|
|
12
19
|
export declare function confirmOutcome(kind: string, out: Fields, lang: Lang): string;
|
|
13
20
|
export {};
|
|
@@ -13,7 +13,7 @@ export declare const SUGGESTED_REPLY_MAX = 30;
|
|
|
13
13
|
/** The suggested replies kept under a message when the channel's own limit is not given (`SurfaceCaps.suggestionsMax`). */
|
|
14
14
|
export declare const SUGGESTIONS_MAX = 3;
|
|
15
15
|
/** The writes Claw holds for the person that this worker draws as a card. */
|
|
16
|
-
export declare const CONFIRM_KINDS: readonly ["trigger_create", "trigger_cancel", "devenv_send", "github_comment", "devenv_hide", "skill_save"];
|
|
16
|
+
export declare const CONFIRM_KINDS: readonly ["trigger_create", "trigger_cancel", "devenv_send", "github_comment", "devenv_hide", "skill_save", "github_merge", "github_review"];
|
|
17
17
|
/** The default replies under what the assistant said: (what the button says, what it sends). */
|
|
18
18
|
export declare const ASSISTANT_SUGGESTED_REPLIES: Readonly<Record<Lang, readonly SuggestedReply[]>>;
|
|
19
19
|
type Event = Readonly<Record<string, unknown>>;
|
|
@@ -45,6 +45,13 @@ export declare const assistantActionText: import("./catalog.js").Catalog<{
|
|
|
45
45
|
notSentWhy: (p: {
|
|
46
46
|
why: string;
|
|
47
47
|
}) => string;
|
|
48
|
+
githubMerged: string;
|
|
49
|
+
githubQueued: string;
|
|
50
|
+
githubApproved: string;
|
|
51
|
+
githubNotMerged: string;
|
|
52
|
+
githubNotApproved: string;
|
|
53
|
+
githubStale: string;
|
|
54
|
+
githubRetry: string;
|
|
48
55
|
actionGone: string;
|
|
49
56
|
actionUsed: string;
|
|
50
57
|
confirmGone: string;
|
|
@@ -7,6 +7,8 @@ export declare const remoteLeads: {
|
|
|
7
7
|
readonly sessionEnded: readonly ["会话已结束", "The session ended"];
|
|
8
8
|
readonly couldNotStart: readonly ["会话没能启动", "The session could not start"];
|
|
9
9
|
readonly turnIncomplete: readonly ["这一轮没有完成", "The turn did not complete"];
|
|
10
|
+
/** (a message the terminal may have taken: never said as a turn that did not complete) */
|
|
11
|
+
readonly inputUnconfirmed: readonly ["还没确认终端收到", "Not confirmed by the terminal yet"];
|
|
10
12
|
readonly modeNotSwitched: readonly ["模式没有切换", "The mode was not switched"];
|
|
11
13
|
readonly notSwitchedTo: (mode: string) => Pair;
|
|
12
14
|
};
|
|
@@ -310,6 +310,11 @@ export declare const remoteText: import("./catalog.js").Catalog<{
|
|
|
310
310
|
noAsk: (p: {
|
|
311
311
|
name: string;
|
|
312
312
|
}) => string;
|
|
313
|
+
dialogAsks: (p: {
|
|
314
|
+
what: string;
|
|
315
|
+
}) => string;
|
|
316
|
+
dialogAsksBare: string;
|
|
317
|
+
rowUnreadable: string;
|
|
313
318
|
noTextOutput: string;
|
|
314
319
|
answerShortened: string;
|
|
315
320
|
pairBody: (p: {
|
|
@@ -18,6 +18,13 @@ export interface AssistantItemSnapshot {
|
|
|
18
18
|
board_state: string;
|
|
19
19
|
result_version: number;
|
|
20
20
|
can_accept: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The result version Claw delivered without the user's Accept (`CLAW_ASSISTANT_AUTO_DELIVER`), while the item stands delivered:
|
|
23
|
+
* closed by that delivery, or open only to watch a pull request (`watching_pr`). Absent otherwise, and from an API without it.
|
|
24
|
+
*/
|
|
25
|
+
delivered_version?: number;
|
|
26
|
+
/** The pull requests, as owner/repo#123, a delivered item stays open watching for comments and failed CI. Absent when none. */
|
|
27
|
+
watching_pr?: string[];
|
|
21
28
|
}
|
|
22
29
|
interface AssistantEventBase {
|
|
23
30
|
/** The id of the stored message: the receiver's dedup key. */
|
|
@@ -65,9 +72,11 @@ export interface AssistantConfirmWrite {
|
|
|
65
72
|
/**
|
|
66
73
|
* `devenv_send`: an instruction for an agent on the person's own machine (`assistant/devenv-tools.ts`). `skill_save`: a personal skill
|
|
67
74
|
* the assistant drafted on its own, saved only when the person lets it through (`assistant/skill-writes.ts`); its message carries
|
|
68
|
-
* `skill_card` with what would be saved.
|
|
75
|
+
* `skill_card` with what would be saved. `github_merge` and `github_review`: a merge, or an approval, that a review the assistant
|
|
76
|
+
* started for the person's own account holds for them (`claw_github_confirmations`, `assistant/review-items.ts`); the same decision
|
|
77
|
+
* route answers it, and it is made exactly as `POST /v1/github-review/confirmations/{confirmation_id}/decision` makes it.
|
|
69
78
|
*/
|
|
70
|
-
kind: "trigger_create" | "trigger_cancel" | "github_comment" | "devenv_send" | "devenv_hide" | "skill_save";
|
|
79
|
+
kind: "trigger_create" | "trigger_cancel" | "github_comment" | "devenv_send" | "devenv_hide" | "skill_save" | "github_merge" | "github_review";
|
|
71
80
|
/** What the button that lets it through says, in the language of the text. */
|
|
72
81
|
allow_label: string;
|
|
73
82
|
expires_at: string;
|
|
@@ -68,6 +68,8 @@ export declare class ChatRegistry {
|
|
|
68
68
|
private readonly readOnly;
|
|
69
69
|
private readonly readOnlyKnown;
|
|
70
70
|
private readonly terminalInput;
|
|
71
|
+
/** The session each chat was told its terminal's registry row cannot be read for (once per attach). */
|
|
72
|
+
private readonly rowHinted;
|
|
71
73
|
private readonly tickets;
|
|
72
74
|
/** How many messages wait behind the chat's running turn. */
|
|
73
75
|
queuedCount(chatKey: string): number;
|
|
@@ -98,6 +100,8 @@ export declare class ChatRegistry {
|
|
|
98
100
|
/** A new session says itself whether it only watches. */
|
|
99
101
|
clearReadOnly(chatKey: string): void;
|
|
100
102
|
markTerminal(chatKey: string, sessionId: string, terminal: boolean): void;
|
|
103
|
+
/** True the first time for a chat's session: the chat is to be told its terminal's registry row cannot be read. */
|
|
104
|
+
firstRowHint(chatKey: string, sessionId: string): boolean;
|
|
101
105
|
/** What is sent to the chat's session is typed into a terminal on the machine. */
|
|
102
106
|
typesIntoTerminal(chatKey: string, sessionId: string | null): boolean;
|
|
103
107
|
/**
|
|
@@ -10,6 +10,12 @@ export declare const SANDBOX: Pair;
|
|
|
10
10
|
export declare const STATUS: Pair;
|
|
11
11
|
/** Codes an older connector hits on a root machine with `approval = "never"`: an upgrade fixes them (see `FIXED_IN`). */
|
|
12
12
|
export declare const OLD_CONNECTOR: ReadonlySet<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Codes a connector before a release hits far more often than one after it, with the release that fixed that: an older connector is
|
|
15
|
+
* told to upgrade after the code's own sentence. Before 0.1.22 a connector did not recognise a pasted message (Claude Code records a
|
|
16
|
+
* paste of several lines as a `<pasted_content>` block), so nearly every long message it typed into a terminal ended unconfirmed.
|
|
17
|
+
*/
|
|
18
|
+
export declare const FIXED_LATER: Readonly<Record<string, readonly [number, number, number]>>;
|
|
13
19
|
/** Every code that has a sentence of its own. */
|
|
14
20
|
export declare function knownReasons(): string[];
|
|
15
21
|
/** `0.1.4` (or `v0.1.4`, `0.1.5-rc.1`) as [major, minor, patch]; null for anything else. */
|
|
@@ -53,6 +53,12 @@ export interface RemoteStep {
|
|
|
53
53
|
} | null;
|
|
54
54
|
/** A message for a terminal's conversation waits for that terminal (the connector's reason). */
|
|
55
55
|
readonly queued: string | null;
|
|
56
|
+
/** What the question on that terminal's screen asks, while the message waits for it (`terminal_dialog`): one short line. */
|
|
57
|
+
readonly dialog: string | null;
|
|
58
|
+
/** The short line of Teams' floating status for that wait (said by the runner; `note` is the whole line). */
|
|
59
|
+
readonly waitLine: string | null;
|
|
60
|
+
/** The connector cannot read Claude Code's registry row of the terminal's process (`registry_row_unreadable`). */
|
|
61
|
+
readonly rowUnreadable: boolean;
|
|
56
62
|
/** Which message waits (its `cmd_id`, else Claw's number of it), null when the connector did not say. */
|
|
57
63
|
readonly queuedFor: string | null;
|
|
58
64
|
/** Claw's number of the message that waits, null when the connector did not say. */
|
|
@@ -71,6 +77,8 @@ export interface RemoteStep {
|
|
|
71
77
|
export declare const NOTHING: RemoteStep;
|
|
72
78
|
/** A step that says only `fields`. */
|
|
73
79
|
export declare function remoteStep(fields?: Partial<RemoteStep>): RemoteStep;
|
|
80
|
+
/** `text` with each pasted block as the text that was pasted, on lines of its own. */
|
|
81
|
+
export declare function unwrapPasted(text: string): string;
|
|
74
82
|
/** One SSE frame of a remote session to what the runner does. What cannot be read is skipped (usage_update, history_complete
|
|
75
83
|
* and every type this client does not know are nothing). */
|
|
76
84
|
export declare function decode(event: SseEvent, errors: PublicErrors): RemoteStep;
|
|
@@ -10,6 +10,11 @@ export declare const READ_ONLY_REASONS: readonly string[];
|
|
|
10
10
|
export declare const TERMINAL_CLOSED = "terminal_closed";
|
|
11
11
|
/** The connector's own word for a turn it ended because it restarted. */
|
|
12
12
|
export declare const CONNECTOR_RESTARTED = "connector_restarted";
|
|
13
|
+
/**
|
|
14
|
+
* A connector's end of a turn whose message went into a terminal that did not show it in its transcript in time: the terminal may
|
|
15
|
+
* well have taken it, so it is never said as a turn that failed, and what the session says next is still followed.
|
|
16
|
+
*/
|
|
17
|
+
export declare const TERMINAL_INPUT_UNCONFIRMED = "terminal_input_unconfirmed";
|
|
13
18
|
/** A terminal's permission modes in which Claude Code acts without asking, and what they are called. */
|
|
14
19
|
export declare const NO_ASK_MODES: Readonly<Record<string, string>>;
|
|
15
20
|
/** The warning for a terminal whose mode does not ask, or null for one that asks (or whose mode is not known). */
|
|
@@ -41,6 +46,11 @@ export declare const WAIT_LINE_MAX_EN = 16;
|
|
|
41
46
|
/** What a message for a conversation open in a terminal waits for (`terminal_input_queued`), in the chat's language: one short
|
|
42
47
|
* line within WAIT_LINE_MAX_ZH / WAIT_LINE_MAX_EN, so that a phone shows all of it. */
|
|
43
48
|
export declare function queuedLine(reason: string, lang: Lang): string;
|
|
49
|
+
/** The whole line of a wait, for the turn's live view and the session card (not cut to the floating status): what a question on the
|
|
50
|
+
* terminal's screen asks when it waits for one (`terminal_dialog`), the floating status's line otherwise. */
|
|
51
|
+
export declare function queuedNote(reason: string, dialog: string | null, lang: Lang): string;
|
|
52
|
+
/** Said once per attach: the terminal's process has a registry row the connector cannot read, and how to make it known again. */
|
|
53
|
+
export declare function rowUnreadableLine(lang: Lang): string;
|
|
44
54
|
/** What a message to a watched session is answered with: it was not sent, and what makes sending possible without taking the
|
|
45
55
|
* conversation from the terminal; `takeover`: the status card also offers Take over…, which ends the terminal's session. */
|
|
46
56
|
export declare function readOnlyRefused(lang: Lang, takeover?: boolean): string;
|
|
@@ -12,6 +12,11 @@ export interface TurnDisplay {
|
|
|
12
12
|
finish(parts: readonly string[], options: FinishWith): Promise<void>;
|
|
13
13
|
/** After `finish`, when the turn of a queued message follows at once: what this turn showed must stay readable (optional). */
|
|
14
14
|
handOver?(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the display itself shows a wait's whole line (the session card does). A chat's stream shows only a short floating status,
|
|
17
|
+
* so what a question on the terminal asks is said there as a message of its own.
|
|
18
|
+
*/
|
|
19
|
+
readonly showsWaits?: boolean;
|
|
15
20
|
}
|
|
16
21
|
export interface FinishWith {
|
|
17
22
|
/** What the agent wrote (the AI label). */
|
|
@@ -40,6 +40,8 @@ export declare class TurnRunner {
|
|
|
40
40
|
private readonly ended;
|
|
41
41
|
private readonly show;
|
|
42
42
|
private readonly displayFor;
|
|
43
|
+
/** The questions on the terminal each turn's display said in the chat (by their line). */
|
|
44
|
+
private readonly questionsTold;
|
|
43
45
|
/** Per chat: what it was told of each message (Claw's number) waiting for a busy terminal (`tellBusy`), oldest first. */
|
|
44
46
|
private readonly toldBusy;
|
|
45
47
|
constructor(ctx: RemoteContext, state: ChatState, board: StatusBoard, follow: FollowControl, ended: EndedWords, show: (chatKey: string, sid: string, request: Readonly<Record<string, unknown>>, to: Conversation) => Promise<void>, displayFor: DisplayFor);
|
|
@@ -78,5 +80,18 @@ export declare class TurnRunner {
|
|
|
78
80
|
* send has not answered yet has no number to match: the refusal is kept for that send (`Prompts.queueBehind`).
|
|
79
81
|
*/
|
|
80
82
|
private queuedRefused;
|
|
83
|
+
/**
|
|
84
|
+
* Why the message still waits for the terminal, in the chat's language: the whole line in the turn's live view and on the session
|
|
85
|
+
* card, a short one in the floating status; what a question on the terminal asks is also said in the chat when the display does
|
|
86
|
+
* not show the whole line; that it waits for a busy terminal is said in the chat at once (`tellBusy`).
|
|
87
|
+
*/
|
|
88
|
+
private showWait;
|
|
89
|
+
/**
|
|
90
|
+
* What a question on the terminal asks, while the message waits for it: said in the chat once per question and turn (the stream's
|
|
91
|
+
* floating status has room for a few characters only, and the person must answer it at the terminal before anything runs).
|
|
92
|
+
*/
|
|
93
|
+
private sayQuestion;
|
|
94
|
+
/** Once per attach: the terminal's registry row cannot be read, and a restart of it there makes it known again. */
|
|
95
|
+
private sayRowUnreadable;
|
|
81
96
|
private sayRecovered;
|
|
82
97
|
}
|
|
@@ -15,6 +15,8 @@ export declare class WindowTurn implements TurnDisplay {
|
|
|
15
15
|
private readonly board;
|
|
16
16
|
private readonly cutError;
|
|
17
17
|
tail: string;
|
|
18
|
+
/** (the card's state line says why a message waits, whole) */
|
|
19
|
+
readonly showsWaits = true;
|
|
18
20
|
private readonly segments;
|
|
19
21
|
private newSegment;
|
|
20
22
|
private closed;
|
|
@@ -79,6 +79,8 @@ export declare class StatusMessage<S> {
|
|
|
79
79
|
private streamOver;
|
|
80
80
|
/** The turn was cancelled (`close(true)`). */
|
|
81
81
|
private hard;
|
|
82
|
+
/** The answer is on its way (`finish`): the progress message is the answer's to retire. */
|
|
83
|
+
private finishing;
|
|
82
84
|
constructor(surface: TurnSurface, options: StatusOptions<S>);
|
|
83
85
|
begin(): void;
|
|
84
86
|
private openStream;
|
|
@@ -134,11 +136,19 @@ export declare class StatusMessage<S> {
|
|
|
134
136
|
private update;
|
|
135
137
|
/**
|
|
136
138
|
* Stop sending progress. A sleeping flusher is cancelled; one that is mid-send finishes that one send, unless the turn
|
|
137
|
-
* itself was cancelled (`hard`).
|
|
138
|
-
*
|
|
139
|
+
* itself was cancelled (`hard`). When the turn is cancelled, what shows it is ended in the background: a stream still open
|
|
140
|
+
* is closed with INTERRUPTED (the floating status must not spin until the chat's limit), and the progress message is
|
|
141
|
+
* retired (no answer follows it, so it must not stay in the chat as stale progress).
|
|
139
142
|
*/
|
|
140
143
|
close(hard?: boolean): void;
|
|
144
|
+
/** The turn was cancelled: nothing more is repeated, and what shows it is ended (the first time only). */
|
|
145
|
+
private cancelled;
|
|
141
146
|
private interrupt;
|
|
147
|
+
/**
|
|
148
|
+
* The turn was cancelled with its progress message on screen: no answer follows to replace it, so it is retired here
|
|
149
|
+
* (deleted, or edited down to INTERRUPTED where the chat will not delete it). Never fails the turn.
|
|
150
|
+
*/
|
|
151
|
+
private retireCancelled;
|
|
142
152
|
/**
|
|
143
153
|
* The turn is over: the user gets `parts`, in order. With a stream the first part is its final message (in the place
|
|
144
154
|
* of the status) and the others follow; without one they are NEW messages, and the progress message is then retired.
|
|
@@ -160,8 +170,9 @@ export declare class StatusMessage<S> {
|
|
|
160
170
|
/** Wait until FINAL_SETTLE_SECONDS have passed since the last progress edit left. */
|
|
161
171
|
private settle;
|
|
162
172
|
/**
|
|
163
|
-
* The answer is posted below: delete the progress message. The chat may
|
|
164
|
-
* is then edited down to one line, so it does not sit
|
|
173
|
+
* The answer is posted below, or none will come (the turn was cancelled): delete the progress message. The chat may
|
|
174
|
+
* refuse, and a queue cannot delete; the message is then edited down to one line (`line`), so it does not sit in the
|
|
175
|
+
* chat as stale progress. Never fails the turn.
|
|
165
176
|
*/
|
|
166
177
|
private retire;
|
|
167
178
|
/** Live edits went out, so one may still arrive after `message` replaced the progress message: send it once more. */
|