@primusclaw/personal-agent 0.13.0 → 0.14.0
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 +291 -78
- package/dist/types/commands/agent-args.d.ts +6 -0
- package/dist/types/commands/parse.d.ts +2 -1
- package/dist/types/locales/remote-agents.d.ts +20 -3
- package/dist/types/locales/remote-leads.d.ts +2 -0
- package/dist/types/locales/remote.d.ts +3 -1
- package/dist/types/locales/turn.d.ts +2 -0
- package/dist/types/remote/board.d.ts +6 -0
- package/dist/types/remote/chats.d.ts +7 -6
- package/dist/types/remote/clicks-start.d.ts +1 -1
- package/dist/types/remote/lines.d.ts +1 -1
- package/dist/types/remote/remote-agents.d.ts +1 -0
- package/dist/types/remote/turns/chat-turn.d.ts +1 -0
- package/dist/types/remote/turns/display.d.ts +5 -0
- package/dist/types/routing/chat.d.ts +7 -0
- package/dist/types/routing/features.d.ts +6 -0
- package/dist/types/routing/router.d.ts +6 -0
- package/dist/types/turn/progress/status-message.d.ts +29 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -770,6 +770,39 @@ function isCommand(name) {
|
|
|
770
770
|
return within(COMMANDS, name);
|
|
771
771
|
}
|
|
772
772
|
|
|
773
|
+
// packages/core/src/commands/agent-args.ts
|
|
774
|
+
var AGENT_SUBCOMMANDS = ["new", "attach", "detach", "mode", "sessions", "close", "off", "pair"];
|
|
775
|
+
function isSubcommand(word2) {
|
|
776
|
+
return AGENT_SUBCOMMANDS.includes(word2);
|
|
777
|
+
}
|
|
778
|
+
function parseAgentCommand(arg) {
|
|
779
|
+
const [head, rest] = splitOnce(pyStrip(arg));
|
|
780
|
+
const verb = head === void 0 ? void 0 : pyLower(head);
|
|
781
|
+
if (verb === void 0 || !isSubcommand(verb)) return null;
|
|
782
|
+
return { verb, rest: rest === void 0 ? "" : pyStrip(rest) };
|
|
783
|
+
}
|
|
784
|
+
var AGENTS_WORDS = ["agents", "agent"];
|
|
785
|
+
function oneEditApart(a, b3) {
|
|
786
|
+
if (a === b3 || Math.abs(a.length - b3.length) > 1) return a === b3;
|
|
787
|
+
let i = 0;
|
|
788
|
+
while (i < a.length && i < b3.length && a[i] === b3[i]) i += 1;
|
|
789
|
+
if (a.length === b3.length) {
|
|
790
|
+
if (a.slice(i + 1) === b3.slice(i + 1)) return true;
|
|
791
|
+
return a[i] === b3[i + 1] && a[i + 1] === b3[i] && a.slice(i + 2) === b3.slice(i + 2);
|
|
792
|
+
}
|
|
793
|
+
const [longer, shorter] = a.length > b3.length ? [a, b3] : [b3, a];
|
|
794
|
+
return longer.slice(i + 1) === shorter.slice(i);
|
|
795
|
+
}
|
|
796
|
+
function isAgentsSlip(text9) {
|
|
797
|
+
const said2 = pyStrip(text9);
|
|
798
|
+
if (/\s/u.test(said2)) return false;
|
|
799
|
+
const found = new RegExp("^[/\uFF0F](\\p{L}{4,8})[.?!\u3002\uFF1F\uFF01]*$", "u").exec(said2);
|
|
800
|
+
const word2 = found?.[1] === void 0 ? "" : pyLower(found[1]);
|
|
801
|
+
if (!word2) return false;
|
|
802
|
+
if (said2 === `/${word2}` && isKnownCommand(word2)) return false;
|
|
803
|
+
return AGENTS_WORDS.some((w) => oneEditApart(word2, w));
|
|
804
|
+
}
|
|
805
|
+
|
|
773
806
|
// packages/core/src/commands/parse.ts
|
|
774
807
|
function parseCommand(text9) {
|
|
775
808
|
const word2 = pyLower(pyStrip(text9));
|
|
@@ -802,6 +835,7 @@ function looksLikeACode(word2) {
|
|
|
802
835
|
return isUpper(word2) || new RegExp("\\p{Nd}", "u").test(word2);
|
|
803
836
|
}
|
|
804
837
|
function menuCommand(text9, group = false) {
|
|
838
|
+
if (!group && isAgentsSlip(text9)) return "/agents";
|
|
805
839
|
const said2 = squashSpaces(text9);
|
|
806
840
|
const lower = pyLower(said2);
|
|
807
841
|
const command = Object.hasOwn(MENU_COMMANDS, lower) ? MENU_COMMANDS[lower] : void 0;
|
|
@@ -6214,6 +6248,8 @@ var turnText = defineCatalog({
|
|
|
6214
6248
|
stillWorking: "Still working on it; the result will follow as a new message.",
|
|
6215
6249
|
/** A turn whose stream is closed because a card now waits for the person's choice. */
|
|
6216
6250
|
awaitingChoice: "Waiting for your choice in the card; I will continue once you pick.",
|
|
6251
|
+
/** A turn whose stream is closed because the chat went on below it: the whole answer comes below. */
|
|
6252
|
+
answerBelow: "The answer follows below, as new messages.",
|
|
6217
6253
|
interrupted: "Interrupted.",
|
|
6218
6254
|
/** What a turn the person stopped ends with. */
|
|
6219
6255
|
stopped: "Stopped.",
|
|
@@ -6236,6 +6272,7 @@ var turnText = defineCatalog({
|
|
|
6236
6272
|
thinking: "\u601D\u8003\u4E2D\u2026",
|
|
6237
6273
|
stillWorking: "\u4ECD\u5728\u5904\u7406\uFF0C\u5B8C\u6210\u540E\u53E6\u53D1\u7ED3\u679C\u3002",
|
|
6238
6274
|
awaitingChoice: "\u8BF7\u5728\u5361\u7247\u91CC\u9009\u62E9\uFF0C\u9009\u597D\u540E\u6211\u63A5\u7740\u505A\u3002",
|
|
6275
|
+
answerBelow: "\u56DE\u7B54\u4F1A\u5728\u4E0B\u9762\u53E6\u53D1\u3002",
|
|
6239
6276
|
interrupted: "\u5DF2\u4E2D\u65AD\u3002",
|
|
6240
6277
|
stopped: "\u5DF2\u505C\u6B62\u3002",
|
|
6241
6278
|
doneShort: "\u5B8C\u6210\u3002",
|
|
@@ -7459,6 +7496,10 @@ var StatusMessage = class {
|
|
|
7459
7496
|
hard = false;
|
|
7460
7497
|
/** The answer is on its way (`finish`): the progress message is the answer's to retire. */
|
|
7461
7498
|
finishing = false;
|
|
7499
|
+
/** The chat went on below the stream (`movedOn`): the line its bubble ends with; the answer comes whole below. */
|
|
7500
|
+
wentOn = "";
|
|
7501
|
+
/** Closing the stream because the chat went on below it, once its words show there (`movedOn`). */
|
|
7502
|
+
moving;
|
|
7462
7503
|
constructor(surface, options) {
|
|
7463
7504
|
this.surface = surface;
|
|
7464
7505
|
this.clock = options.clock;
|
|
@@ -7531,16 +7572,24 @@ ${header}` : header;
|
|
|
7531
7572
|
if (this.closed || !live.closable || this.streamOver || this.expiring) return;
|
|
7532
7573
|
this.expiring = true;
|
|
7533
7574
|
if (this.stream && this.flusher && !this.flusher.done) await unlessAborted(this.flusher.settled(), signal);
|
|
7575
|
+
await this.endStream(live, line3, why);
|
|
7576
|
+
this.log.info("the turn's stream was closed; the answer follows as a message of its own", {
|
|
7577
|
+
why,
|
|
7578
|
+
age: Math.round(live.age())
|
|
7579
|
+
});
|
|
7580
|
+
}
|
|
7581
|
+
/**
|
|
7582
|
+
* End the stream with `line` after the agent's words in its bubble: the answer, whenever it comes, is a message of its own. The
|
|
7583
|
+
* words not yet streamed go into the bubble too, unless the chat went on below it (`movedOn`): the answer then comes whole below,
|
|
7584
|
+
* and the bubble keeps only what it already shows (the chat will not let that shrink).
|
|
7585
|
+
*/
|
|
7586
|
+
async endStream(live, line3, why) {
|
|
7534
7587
|
this.streamOver = true;
|
|
7535
|
-
const words3 = this.streamable() || live.streamed;
|
|
7588
|
+
const words3 = this.wentOn ? live.streamed : this.streamable() || live.streamed;
|
|
7536
7589
|
const closed = await live.final(plainMessage(words3 ? `${words3}
|
|
7537
7590
|
|
|
7538
7591
|
${line3}` : line3));
|
|
7539
7592
|
if (!closed.ok) this.log.warn(`the turn's stream could not be closed ${why}; the answer follows as a message`);
|
|
7540
|
-
this.log.info("the turn's stream was closed; the answer follows as a message of its own", {
|
|
7541
|
-
why,
|
|
7542
|
-
age: Math.round(live.age())
|
|
7543
|
-
});
|
|
7544
7593
|
}
|
|
7545
7594
|
/**
|
|
7546
7595
|
* A card now waits for the person (a question of the agent): it is their turn, so the floating status must not go on
|
|
@@ -7576,6 +7625,28 @@ ${line3}` : line3));
|
|
|
7576
7625
|
});
|
|
7577
7626
|
return true;
|
|
7578
7627
|
}
|
|
7628
|
+
/**
|
|
7629
|
+
* The chat went on below the stream while the turn runs (the person wrote again, or something else was said there): the stream's
|
|
7630
|
+
* bubble stays where it opened, above all that. An answer begun in it and continued below would be read from its middle, its first
|
|
7631
|
+
* 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
|
|
7632
|
+
* 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
|
|
7633
|
+
* closed at once. Either way it ends with `line`, and the whole answer comes as messages of its own, below what was said since.
|
|
7634
|
+
* When it comes while the answer is going out (its first part in the bubble already), the whole answer is sent again below.
|
|
7635
|
+
* Nothing when no stream is open or one is already closing. Never fails the turn.
|
|
7636
|
+
*/
|
|
7637
|
+
movedOn(line3) {
|
|
7638
|
+
const live = this.live;
|
|
7639
|
+
if (!live || this.streamOver || this.expiring || this.wentOn) return;
|
|
7640
|
+
this.wentOn = line3;
|
|
7641
|
+
if (this.closed) return;
|
|
7642
|
+
this.moving = detach(async (signal) => {
|
|
7643
|
+
if (this.opening && !this.opening.done) await unlessAborted(this.opening.settled(), signal);
|
|
7644
|
+
if (this.flusher && !this.flusher.done) await unlessAborted(this.flusher.settled(), signal);
|
|
7645
|
+
if (!live.streamed) return;
|
|
7646
|
+
if (!this.expiring) this.expiry?.cancel();
|
|
7647
|
+
await this.closeEarly(live, line3, "because the chat went on below it", signal);
|
|
7648
|
+
});
|
|
7649
|
+
}
|
|
7579
7650
|
/** The chat's id of the posted message; undefined when the post failed or its id never came (nothing is edited then). */
|
|
7580
7651
|
async messageId(signal) {
|
|
7581
7652
|
if (!this.posted) return void 0;
|
|
@@ -7639,6 +7710,10 @@ ${line3}` : line3));
|
|
|
7639
7710
|
streamable() {
|
|
7640
7711
|
return this.stream ? this.policy.streamable(this.stream.streamed) : "";
|
|
7641
7712
|
}
|
|
7713
|
+
/** The agent's words for the bubble now: none once the chat went on below it (its status only; the words come below). */
|
|
7714
|
+
bubbleWords() {
|
|
7715
|
+
return this.wentOn ? "" : this.streamable();
|
|
7716
|
+
}
|
|
7642
7717
|
/** Whether the turn is still shown by its stream (a refusal hands it to the progress message). */
|
|
7643
7718
|
streaming() {
|
|
7644
7719
|
return this.stream !== void 0;
|
|
@@ -7680,7 +7755,8 @@ ${line3}` : line3));
|
|
|
7680
7755
|
await sleepSeconds(this.clock, wait, signal);
|
|
7681
7756
|
continue;
|
|
7682
7757
|
}
|
|
7683
|
-
|
|
7758
|
+
if (this.wentOn && stream.streamed) return;
|
|
7759
|
+
const streamed = this.bubbleWords();
|
|
7684
7760
|
const text9 = streamed || statusText(this.statusLines());
|
|
7685
7761
|
if (text9 === this.lastText || streamed && streamed === stream.streamed) return;
|
|
7686
7762
|
this.lastText = text9;
|
|
@@ -7726,7 +7802,7 @@ ${line3}` : line3));
|
|
|
7726
7802
|
cancelled() {
|
|
7727
7803
|
const first = !this.hard;
|
|
7728
7804
|
this.hard = true;
|
|
7729
|
-
for (const task of [this.again, this.expiry, this.choice]) task?.cancel();
|
|
7805
|
+
for (const task of [this.again, this.expiry, this.choice, this.moving]) task?.cancel();
|
|
7730
7806
|
if (this.live?.closable && !this.streamOver) {
|
|
7731
7807
|
this.streamOver = true;
|
|
7732
7808
|
const live = this.live;
|
|
@@ -7757,40 +7833,56 @@ ${line3}` : line3));
|
|
|
7757
7833
|
await this.quiesce();
|
|
7758
7834
|
const messages = answerMessages(parts2, options);
|
|
7759
7835
|
if (this.stream && this.stream.open && !this.streamOver) {
|
|
7760
|
-
|
|
7836
|
+
if (!this.wentOn) {
|
|
7837
|
+
await this.finishStream(this.stream, messages, parts2, options);
|
|
7838
|
+
return;
|
|
7839
|
+
}
|
|
7840
|
+
await this.endStream(this.stream, this.wentOn, "because the chat went on below it");
|
|
7841
|
+
for (const message of messages) await this.surface.send(message);
|
|
7761
7842
|
return;
|
|
7762
7843
|
}
|
|
7763
7844
|
const messageId = await this.messageId();
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
for (const message of rest) await this.surface.send(message);
|
|
7845
|
+
if (this.live && this.live.closable && !this.streamOver) await this.closeRefusedStream(this.live, messages);
|
|
7846
|
+
else for (const message of messages) await this.surface.send(message);
|
|
7767
7847
|
if (messageId) await this.retire(messageId);
|
|
7768
7848
|
}
|
|
7769
7849
|
/** Stop the live view and wait for what is still on its way: the stream's opening, the last edit, a closing stream. */
|
|
7770
7850
|
async quiesce() {
|
|
7771
7851
|
this.close();
|
|
7772
7852
|
if (this.expiry && !this.expiry.done && !this.expiring) this.expiry.cancel();
|
|
7773
|
-
for (const task of [
|
|
7853
|
+
for (const task of [
|
|
7854
|
+
this.opening,
|
|
7855
|
+
this.flusher,
|
|
7856
|
+
this.expiring ? this.expiry : void 0,
|
|
7857
|
+
this.choice,
|
|
7858
|
+
this.moving
|
|
7859
|
+
]) {
|
|
7774
7860
|
if (task) await task.settled();
|
|
7775
7861
|
}
|
|
7776
7862
|
}
|
|
7777
7863
|
/**
|
|
7778
7864
|
* The stream opened and the chat later refused an update of it, so the progress message took over: the stream is still
|
|
7779
|
-
* closed, with the first part of the answer when the chat takes that
|
|
7865
|
+
* closed, with the first part of the answer when the chat takes that, and what is left of the answer is sent as messages.
|
|
7780
7866
|
*/
|
|
7781
7867
|
async closeRefusedStream(live, messages) {
|
|
7782
7868
|
let final;
|
|
7783
7869
|
let rest;
|
|
7784
7870
|
const [first, ...others] = messages;
|
|
7785
|
-
if (
|
|
7871
|
+
if (this.wentOn)
|
|
7872
|
+
[final, rest] = [plainMessage(live.streamed ? `${live.streamed}
|
|
7873
|
+
|
|
7874
|
+
${this.wentOn}` : this.wentOn), messages];
|
|
7875
|
+
else if (live.streamed) [final, rest] = [plainMessage(live.streamed), messages];
|
|
7786
7876
|
else if (first) [final, rest] = [first, others];
|
|
7787
7877
|
else [final, rest] = [plainMessage(turnText.in(this.lang).doneShort), []];
|
|
7788
7878
|
const closed = await live.final(final);
|
|
7789
|
-
if (closed.ok)
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7879
|
+
if (!closed.ok) {
|
|
7880
|
+
this.log.warn("the refused stream could not be closed either; the chat closes it at its limit", {
|
|
7881
|
+
reason: closed.error.reason
|
|
7882
|
+
});
|
|
7883
|
+
rest = messages;
|
|
7884
|
+
}
|
|
7885
|
+
await this.sendAfterBubble(closed.ok && final === first, rest, messages);
|
|
7794
7886
|
}
|
|
7795
7887
|
/**
|
|
7796
7888
|
* The stream's final message is the first part of the answer (the chat then draws its AI label and thumbs); the other
|
|
@@ -7810,7 +7902,20 @@ ${line3}` : line3));
|
|
|
7810
7902
|
});
|
|
7811
7903
|
rest = messages;
|
|
7812
7904
|
}
|
|
7813
|
-
|
|
7905
|
+
await this.sendAfterBubble(closed.ok, rest, messages);
|
|
7906
|
+
}
|
|
7907
|
+
/**
|
|
7908
|
+
* Send `rest`, what follows the stream's final. When that final showed part of the answer above (`shown`) and the chat goes on
|
|
7909
|
+
* below the bubble while the rest goes out (`movedOn`: the person wrote meanwhile), the whole answer is sent again below that, so
|
|
7910
|
+
* it is never read from its middle. A final that is the whole answer (nothing follows it) stays as it is.
|
|
7911
|
+
*/
|
|
7912
|
+
async sendAfterBubble(shown3, rest, messages) {
|
|
7913
|
+
const wentOn = () => shown3 && rest.length > 0 && this.wentOn !== "";
|
|
7914
|
+
for (const message of rest) {
|
|
7915
|
+
if (wentOn()) break;
|
|
7916
|
+
await this.surface.send(message);
|
|
7917
|
+
}
|
|
7918
|
+
if (wentOn()) for (const message of messages) await this.surface.send(message);
|
|
7814
7919
|
}
|
|
7815
7920
|
/** Wait until FINAL_SETTLE_SECONDS have passed since the last progress edit left. */
|
|
7816
7921
|
async settle() {
|
|
@@ -10123,7 +10228,7 @@ function groupChosenLang(store, conversationId) {
|
|
|
10123
10228
|
const lang = conversationId ? store.groupLanguage?.groupLanguage(conversationId) : null;
|
|
10124
10229
|
return lang === "zh" || lang === "en" ? lang : void 0;
|
|
10125
10230
|
}
|
|
10126
|
-
var Chat = class {
|
|
10231
|
+
var Chat = class _Chat {
|
|
10127
10232
|
constructor(store, sender, conversation, scope, locale, written3 = "") {
|
|
10128
10233
|
this.store = store;
|
|
10129
10234
|
this.sender = sender;
|
|
@@ -10154,7 +10259,50 @@ var Chat = class {
|
|
|
10154
10259
|
send(message) {
|
|
10155
10260
|
return this.conversation.send(message);
|
|
10156
10261
|
}
|
|
10262
|
+
/** The same chat, said into through `conversation`. */
|
|
10263
|
+
through(conversation) {
|
|
10264
|
+
return new _Chat(this.store, this.sender, conversation, this.scope, this.locale, this.written);
|
|
10265
|
+
}
|
|
10157
10266
|
};
|
|
10267
|
+
function postingAfter(conversation, first) {
|
|
10268
|
+
return {
|
|
10269
|
+
get ref() {
|
|
10270
|
+
return conversation.ref;
|
|
10271
|
+
},
|
|
10272
|
+
get caps() {
|
|
10273
|
+
return conversation.caps;
|
|
10274
|
+
},
|
|
10275
|
+
get replyTo() {
|
|
10276
|
+
return conversation.replyTo;
|
|
10277
|
+
},
|
|
10278
|
+
get edited() {
|
|
10279
|
+
return conversation.edited;
|
|
10280
|
+
},
|
|
10281
|
+
markSettled: (id) => {
|
|
10282
|
+
conversation.markSettled(id);
|
|
10283
|
+
},
|
|
10284
|
+
typing: () => conversation.typing(),
|
|
10285
|
+
send: (message) => {
|
|
10286
|
+
first();
|
|
10287
|
+
return conversation.send(message);
|
|
10288
|
+
},
|
|
10289
|
+
post: (message) => {
|
|
10290
|
+
first();
|
|
10291
|
+
return conversation.post(message);
|
|
10292
|
+
},
|
|
10293
|
+
update: (id, message, options) => conversation.update(id, message, options),
|
|
10294
|
+
delete: (id) => conversation.delete(id),
|
|
10295
|
+
outgoing: (message) => conversation.outgoing(message),
|
|
10296
|
+
deliver: (envelope) => {
|
|
10297
|
+
first();
|
|
10298
|
+
return conversation.deliver(envelope);
|
|
10299
|
+
},
|
|
10300
|
+
openStream: (replyTo, status) => {
|
|
10301
|
+
first();
|
|
10302
|
+
return conversation.openStream(replyTo, status);
|
|
10303
|
+
}
|
|
10304
|
+
};
|
|
10305
|
+
}
|
|
10158
10306
|
async function settleClick(click, logger, card, options = {}) {
|
|
10159
10307
|
const fallback = typeof card === "string" ? options.fallback ?? card : options.fallback;
|
|
10160
10308
|
const message = typeof card === "string" ? click.note(card) : card;
|
|
@@ -12227,18 +12375,6 @@ function naturalCommand(text9, group = false, off = /* @__PURE__ */ new Set(), b
|
|
|
12227
12375
|
return off.has(first) || off.has(parts2.slice(0, 2).join(" ")) ? text9 : command;
|
|
12228
12376
|
}
|
|
12229
12377
|
|
|
12230
|
-
// packages/core/src/commands/agent-args.ts
|
|
12231
|
-
var AGENT_SUBCOMMANDS = ["new", "attach", "detach", "mode", "sessions", "close", "off", "pair"];
|
|
12232
|
-
function isSubcommand(word2) {
|
|
12233
|
-
return AGENT_SUBCOMMANDS.includes(word2);
|
|
12234
|
-
}
|
|
12235
|
-
function parseAgentCommand(arg) {
|
|
12236
|
-
const [head, rest] = splitOnce(pyStrip(arg));
|
|
12237
|
-
const verb = head === void 0 ? void 0 : pyLower(head);
|
|
12238
|
-
if (verb === void 0 || !isSubcommand(verb)) return null;
|
|
12239
|
-
return { verb, rest: rest === void 0 ? "" : pyStrip(rest) };
|
|
12240
|
-
}
|
|
12241
|
-
|
|
12242
12378
|
// packages/core/src/commands/repo.ts
|
|
12243
12379
|
var REPO_HOST = "https://github.com";
|
|
12244
12380
|
var OWNER = /^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$/u;
|
|
@@ -15585,11 +15721,11 @@ var Router = class _Router {
|
|
|
15585
15721
|
}
|
|
15586
15722
|
async route(event) {
|
|
15587
15723
|
const scope = event.conversation.kind === "group" ? event.conversation.id : "";
|
|
15588
|
-
const chat = this.ctx.chatOf(event, scope);
|
|
15589
15724
|
if (event.type === "vote") {
|
|
15590
|
-
await this.vote(event,
|
|
15725
|
+
await this.vote(event, this.ctx.chatOf(event, scope));
|
|
15591
15726
|
return;
|
|
15592
15727
|
}
|
|
15728
|
+
const chat = this.goingOn(event, this.ctx.chatOf(event, scope));
|
|
15593
15729
|
try {
|
|
15594
15730
|
await this.dispatch(event, chat);
|
|
15595
15731
|
} catch (error) {
|
|
@@ -15598,6 +15734,20 @@ var Router = class _Router {
|
|
|
15598
15734
|
}
|
|
15599
15735
|
await this.settleOpen(event, chat, routingText.in(chat.lang()).buttonInactive);
|
|
15600
15736
|
}
|
|
15737
|
+
/**
|
|
15738
|
+
* What happens in the chat now happens below the stream of an attached agent's turn running there, whatever it is (a message
|
|
15739
|
+
* of the person's, a command answered at once, a click whose outcome is said): that turn's answer must come below it, whole,
|
|
15740
|
+
* never begun above it and continued below (`movedOn`). A message is in the chat already; a click, once it posts something.
|
|
15741
|
+
*/
|
|
15742
|
+
goingOn(event, chat) {
|
|
15743
|
+
const goesOn = this.ctx.deps.remote.goesOn?.(chat.sender.id, chat.scope);
|
|
15744
|
+
if (goesOn === void 0) return chat;
|
|
15745
|
+
if (event.type === "message") {
|
|
15746
|
+
goesOn();
|
|
15747
|
+
return chat;
|
|
15748
|
+
}
|
|
15749
|
+
return chat.through(postingAfter(chat.conversation, goesOn));
|
|
15750
|
+
}
|
|
15601
15751
|
/** The safety net under every card click: a click whose card is still the placeholder ends with a note. */
|
|
15602
15752
|
async settleOpen(event, chat, text9) {
|
|
15603
15753
|
if (event.type !== "action" || !event.invoke || !event.cardMessageId) return;
|
|
@@ -19925,7 +20075,7 @@ ${p.quoted}`,
|
|
|
19925
20075
|
shareNoteTyped: "Open in a terminal: once connected, what you send here is typed into that terminal, and its replies and what is typed there show up here; the terminal keeps working, and you can leave at any time",
|
|
19926
20076
|
shareNoteNoTmux: "Open in a terminal: a message from here cannot be typed into it now, so you can watch. To send from here, open the conversation in tmux, and in that one terminal only",
|
|
19927
20077
|
shareNoteOld: "Open in a terminal: this machine's connector cannot type into a terminal yet (it needs 0.1.9 or newer), so you can watch",
|
|
19928
|
-
terminalClosed:
|
|
20078
|
+
terminalClosed: (p) => `The conversation was closed in the terminal, so the watch is over and your messages go to ${p.bot} again. Switch to it again to carry on with it.`,
|
|
19929
20079
|
switched: (p) => `\u2014\u2014 Now: ${p.where} \u2014\u2014`,
|
|
19930
20080
|
recoveredWhere: (p) => `${p.label} on ${p.host}`,
|
|
19931
20081
|
recoveredContinuing: (p) => `\u2705 Recovered: the connector of ${p.where} restarted; it is going on from where it stopped, and what was waiting for your approval comes back as a new card.`,
|
|
@@ -20111,7 +20261,7 @@ ${p.quoted}`,
|
|
|
20111
20261
|
shareNoteTyped: "\u7EC8\u7AEF\u91CC\u6B63\u5728\u7528\uFF1A\u8FDE\u4E0A\u540E\uFF0C\u4F60\u5728\u8FD9\u91CC\u53D1\u7684\u6D88\u606F\u4F1A\u4F5C\u4E3A\u8F93\u5165\u6253\u8FDB\u90A3\u4E2A\u7EC8\u7AEF\uFF0C\u56DE\u590D\u548C\u7EC8\u7AEF\u91CC\u6572\u7684\u5185\u5BB9\u90FD\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\uFF1B\u7EC8\u7AEF\u7167\u5E38\u7528\uFF0C\u968F\u65F6\u53EF\u4EE5\u65AD\u5F00",
|
|
20112
20262
|
shareNoteNoTmux: "\u7EC8\u7AEF\u91CC\u6B63\u5728\u7528\uFF1A\u8FD9\u91CC\u53D1\u7684\u6D88\u606F\u73B0\u5728\u6253\u4E0D\u8FDB\u90A3\u4E2A\u7EC8\u7AEF\uFF0C\u53EA\u80FD\u770B\u3002\u8981\u80FD\u53D1\uFF1A\u5728 tmux \u91CC\u6253\u5F00\u8FD9\u4E2A\u4F1A\u8BDD\uFF0C\u5E76\u4E14\u53EA\u5728\u8FD9\u4E00\u4E2A\u7EC8\u7AEF\u91CC\u5F00\u7740\u5B83",
|
|
20113
20263
|
shareNoteOld: "\u7EC8\u7AEF\u91CC\u6B63\u5728\u7528\uFF1A\u8FD9\u53F0\u673A\u5668\u7684\u8FDE\u63A5\u5668\u8FD8\u4E0D\u80FD\u5F80\u7EC8\u7AEF\u91CC\u8F93\u5165\uFF08\u9700\u8981 0.1.9 \u6216\u66F4\u65B0\uFF09\uFF0C\u73B0\u5728\u53EA\u80FD\u770B",
|
|
20114
|
-
terminalClosed:
|
|
20264
|
+
terminalClosed: (p) => `\u7EC8\u7AEF\u91CC\u7684\u4F1A\u8BDD\u5DF2\u7ECF\u9000\u51FA\uFF0C\u65C1\u89C2\u7ED3\u675F\uFF0C\u4F60\u7684\u6D88\u606F\u56DE\u5230 ${p.bot}\u3002\u8981\u63A5\u7740\u7528\u5B83\uFF0C\u518D\u5207\u8FC7\u53BB\u5C31\u884C\u3002`,
|
|
20115
20265
|
switched: (p) => `\u2014\u2014 \u73B0\u5728\u662F ${p.where} \u2014\u2014`,
|
|
20116
20266
|
recoveredWhere: (p) => `${p.host} \u4E0A\u7684 ${p.label}`,
|
|
20117
20267
|
recoveredContinuing: (p) => `\u2705 \u5DF2\u6062\u590D\uFF1A${p.where} \u7684\u8FDE\u63A5\u5668\u91CD\u542F\u8FC7\uFF0C\u6B63\u5728\u4ECE\u65AD\u70B9\u63A5\u7740\u505A\uFF1B\u521A\u624D\u7B49\u4F60\u6279\u51C6\u7684\u64CD\u4F5C\u4F1A\u91CD\u65B0\u53D1\u4E00\u5F20\u5361\u3002`,
|
|
@@ -28450,8 +28600,8 @@ function readOnlyRefused(lang, takeover = false) {
|
|
|
28450
28600
|
const words3 = remoteText.in(lang);
|
|
28451
28601
|
return words3.readOnly + (takeover ? words3.readOnlyTakeoverTail : "");
|
|
28452
28602
|
}
|
|
28453
|
-
function terminalClosedLine(lang) {
|
|
28454
|
-
return remoteText.in(lang).terminalClosed;
|
|
28603
|
+
function terminalClosedLine(lang, bot) {
|
|
28604
|
+
return remoteText.in(lang).terminalClosed({ bot });
|
|
28455
28605
|
}
|
|
28456
28606
|
function whereLine(label, host) {
|
|
28457
28607
|
return `${neutral2(host, 80)} \xB7 ${neutral2(label, 80)}`;
|
|
@@ -29910,7 +30060,11 @@ var remoteAgentText = defineCatalog({
|
|
|
29910
30060
|
keyRejected: "PrimusClaw rejected your linked key (it may have expired or been deleted). Send /unlink, then link again.",
|
|
29911
30061
|
whichSession: "I could not tell which session you mean. Send `/agent sessions`, then `/agent attach N`.",
|
|
29912
30062
|
whichSessionOrAgent: "I could not tell which session or agent you mean. Send `/agent sessions` to pick one.",
|
|
29913
|
-
|
|
30063
|
+
backToBot: (p) => `Your messages go to ${p.bot} again.`,
|
|
30064
|
+
/** A new session that never started: the chat was never said to be in it, so its messages never left the bot. */
|
|
30065
|
+
stillToBot: (p) => `Your messages still go to ${p.bot}.`,
|
|
30066
|
+
/** A New session tap or `/agent new`, said at once: what starts where; where messages go is said once the agent has started. */
|
|
30067
|
+
starting: (p) => `Starting ${p.label} on ${p.host}${p.folder ? ` in ${p.folder}` : ""}\u2026 I will say here when it is running.`,
|
|
29914
30068
|
tapInactive: "That button is not active any more.",
|
|
29915
30069
|
tapInvalid: "That button is no longer valid.",
|
|
29916
30070
|
cardExpired: "That card has expired. Send the command again, or use /agents.",
|
|
@@ -29951,11 +30105,11 @@ var remoteAgentText = defineCatalog({
|
|
|
29951
30105
|
notAcceptedRef: (p) => `PrimusClaw did not accept that (ref ${p.ref}).`,
|
|
29952
30106
|
couldNotTake: (p) => `PrimusClaw could not take that (error ${String(p.status)}).`,
|
|
29953
30107
|
/** A session that ended while the chat was idle, when its end cannot be described (said in English, as the worker did). */
|
|
29954
|
-
endedWhileIdle: (p) => (p.reason ? `The session ended: ${p.reason}.` : "The session ended.") +
|
|
30108
|
+
endedWhileIdle: (p) => (p.reason ? `The session ended: ${p.reason}.` : "The session ended.") + ` Your messages go to ${p.bot} again. Start a new session with \`/agent new AGENT PATH\`.`,
|
|
29955
30109
|
noMachineYet: "You have no machine connected yet.",
|
|
29956
30110
|
changedElsewhere: "(Switched: see the status card below)",
|
|
29957
30111
|
listBelow: "(Updated: see the card below)",
|
|
29958
|
-
endedFollowTail:
|
|
30112
|
+
endedFollowTail: (p) => ` Your messages go to ${p.bot} again. Start a new session with \`/agent new AGENT PATH\`.`,
|
|
29959
30113
|
endedTail: " Start a new one with `/agent new AGENT PATH`.",
|
|
29960
30114
|
approvalInPersonal: (p) => `${p.who} is waiting for your approval. I sent the card to our 1:1 chat, so the group does not see what it asks.`,
|
|
29961
30115
|
ranOutRefused: (p) => `${p.tool}: this request ran out and was refused. Ask the agent to run it again if you still want it.`,
|
|
@@ -29989,7 +30143,7 @@ var remoteAgentText = defineCatalog({
|
|
|
29989
30143
|
closedNumber: (p) => `Closed session ${String(p.number)}${p.where}.`,
|
|
29990
30144
|
closedSession: (p) => `Closed the session${p.where}.`,
|
|
29991
30145
|
closedIn: (p) => ` in ${p.folder}`,
|
|
29992
|
-
closedBack:
|
|
30146
|
+
closedBack: (p) => ` Your messages go to ${p.bot} again.`,
|
|
29993
30147
|
newUsage: "Use `/agent new AGENT PATH`, for example `/agent new codex /home/me/repo`, or pick a folder here and tap New session.",
|
|
29994
30148
|
modeIs: (p) => `Mode: \`${p.mode}\`. `,
|
|
29995
30149
|
modesOffered: (p) => `The agent offers ${p.have}. Change it with \`/agent mode ID\`.`,
|
|
@@ -30037,7 +30191,9 @@ var remoteAgentText = defineCatalog({
|
|
|
30037
30191
|
keyRejected: "PrimusClaw \u62D2\u7EDD\u4E86\u4F60\u5173\u8054\u7684 key\uFF08\u53EF\u80FD\u5DF2\u8FC7\u671F\u6216\u88AB\u5220\u9664\uFF09\u3002\u53D1 /unlink\uFF0C\u7136\u540E\u91CD\u65B0\u5173\u8054\u3002",
|
|
30038
30192
|
whichSession: "\u6211\u5206\u4E0D\u6E05\u4F60\u8BF4\u7684\u662F\u54EA\u4E2A\u4F1A\u8BDD\u3002\u53D1 `/agent sessions`\uFF0C\u518D\u53D1 `/agent attach N`\u3002",
|
|
30039
30193
|
whichSessionOrAgent: "\u6211\u5206\u4E0D\u6E05\u4F60\u8BF4\u7684\u662F\u54EA\u4E2A\u4F1A\u8BDD\u6216 agent\u3002\u53D1 `/agent sessions` \u9009\u4E00\u4E2A\u3002",
|
|
30040
|
-
|
|
30194
|
+
backToBot: (p) => `\u4F60\u7684\u6D88\u606F\u4F1A\u91CD\u65B0\u53D1\u7ED9 ${p.bot}\u3002`,
|
|
30195
|
+
stillToBot: (p) => `\u4F60\u7684\u6D88\u606F\u4ECD\u7136\u53D1\u7ED9 ${p.bot}\u3002`,
|
|
30196
|
+
starting: (p) => `\u6B63\u5728 ${p.host} \u4E0A\u542F\u52A8 ${p.label}${p.folder ? `\uFF08${p.folder}\uFF09` : ""}\u2026\u2026\u542F\u52A8\u597D\u4E86\u6211\u5728\u8FD9\u91CC\u8BF4\u3002`,
|
|
30041
30197
|
tapInactive: "\u8FD9\u4E2A\u6309\u94AE\u5DF2\u7ECF\u5931\u6548\u4E86\u3002",
|
|
30042
30198
|
tapInvalid: "\u8FD9\u4E2A\u6309\u94AE\u5DF2\u7ECF\u4E0D\u80FD\u7528\u4E86\u3002",
|
|
30043
30199
|
cardExpired: "\u8FD9\u5F20\u5361\u7247\u5DF2\u7ECF\u8FC7\u671F\u4E86\u3002\u91CD\u65B0\u53D1\u4E00\u6B21\u547D\u4EE4\uFF0C\u6216\u8005\u7528 /agents\u3002",
|
|
@@ -30077,11 +30233,11 @@ var remoteAgentText = defineCatalog({
|
|
|
30077
30233
|
notAccepted: (p) => `PrimusClaw \u6CA1\u6709\u63A5\u53D7\u8FD9\u4E2A\u8BF7\u6C42\uFF08${p.code}\uFF09\u3002`,
|
|
30078
30234
|
notAcceptedRef: (p) => `PrimusClaw \u6CA1\u6709\u63A5\u53D7\u8FD9\u4E2A\u8BF7\u6C42\uFF08ref ${p.ref}\uFF09\u3002`,
|
|
30079
30235
|
couldNotTake: (p) => `PrimusClaw \u5904\u7406\u4E0D\u4E86\u8FD9\u4E2A\u8BF7\u6C42\uFF08\u9519\u8BEF ${String(p.status)}\uFF09\u3002`,
|
|
30080
|
-
endedWhileIdle: (p) => (p.reason ? `\u4F1A\u8BDD\u5DF2\u7ED3\u675F\uFF1A${p.reason}\u3002` : "\u4F1A\u8BDD\u5DF2\u7ED3\u675F\u3002") +
|
|
30236
|
+
endedWhileIdle: (p) => (p.reason ? `\u4F1A\u8BDD\u5DF2\u7ED3\u675F\uFF1A${p.reason}\u3002` : "\u4F1A\u8BDD\u5DF2\u7ED3\u675F\u3002") + `\u4F60\u7684\u6D88\u606F\u4F1A\u91CD\u65B0\u53D1\u7ED9 ${p.bot}\u3002\u7528 \`/agent new AGENT PATH\` \u5F00\u65B0\u4F1A\u8BDD\u3002`,
|
|
30081
30237
|
noMachineYet: "\u4F60\u8FD8\u6CA1\u6709\u8FDE\u63A5\u4EFB\u4F55\u673A\u5668\u3002",
|
|
30082
30238
|
changedElsewhere: "\uFF08\u5DF2\u5207\u6362\uFF0C\u89C1\u4E0B\u65B9\u7684\u65B0\u72B6\u6001\u5361\uFF09",
|
|
30083
30239
|
listBelow: "\uFF08\u5DF2\u66F4\u65B0\uFF0C\u89C1\u4E0B\u65B9\u7684\u65B0\u5361\u7247\uFF09",
|
|
30084
|
-
endedFollowTail:
|
|
30240
|
+
endedFollowTail: (p) => ` \u4F60\u7684\u6D88\u606F\u4F1A\u91CD\u65B0\u53D1\u7ED9 ${p.bot}\u3002\u7528 \`/agent new AGENT PATH\` \u5F00\u65B0\u4F1A\u8BDD\u3002`,
|
|
30085
30241
|
endedTail: " \u7528 `/agent new AGENT PATH` \u5F00\u65B0\u4F1A\u8BDD\u3002",
|
|
30086
30242
|
approvalInPersonal: (p) => `${p.who} \u5728\u7B49\u4F60\u6279\u51C6\u3002\u5BA1\u6279\u5361\u53D1\u5230\u4E86\u4F60\u548C\u6211\u7684 1:1 \u804A\u5929\u91CC\uFF0C\u7FA4\u91CC\u770B\u4E0D\u5230\u5B83\u8981\u505A\u4EC0\u4E48\u3002`,
|
|
30087
30243
|
ranOutRefused: (p) => `${p.tool}\uFF1A\u8FD9\u4E2A\u8BF7\u6C42\u5DF2\u7ECF\u8FC7\u671F\uFF0C\u5DF2\u81EA\u52A8\u62D2\u7EDD\u3002\u8FD8\u9700\u8981\u7684\u8BDD\uFF0C\u8BA9 agent \u518D\u6267\u884C\u4E00\u6B21\u3002`,
|
|
@@ -30120,7 +30276,7 @@ var remoteAgentText = defineCatalog({
|
|
|
30120
30276
|
closedNumber: (p) => `\u5DF2\u5173\u95ED\u4F1A\u8BDD ${String(p.number)}${p.where}\u3002`,
|
|
30121
30277
|
closedSession: (p) => `\u5DF2\u5173\u95ED\u4F1A\u8BDD${p.where}\u3002`,
|
|
30122
30278
|
closedIn: (p) => `\uFF08${p.folder}\uFF09`,
|
|
30123
|
-
closedBack:
|
|
30279
|
+
closedBack: (p) => `\u4F60\u7684\u6D88\u606F\u4F1A\u91CD\u65B0\u53D1\u7ED9 ${p.bot}\u3002`,
|
|
30124
30280
|
// (said in English, as the worker did)
|
|
30125
30281
|
newUsage: "Use `/agent new AGENT PATH`, for example `/agent new codex /home/me/repo`, or pick a folder here and tap New session.",
|
|
30126
30282
|
modeIs: (p) => `Mode: \`${p.mode}\`. `,
|
|
@@ -30492,7 +30648,8 @@ var StatusBoard = class {
|
|
|
30492
30648
|
const state = this.state.attached(chatKey);
|
|
30493
30649
|
if (state === null) return;
|
|
30494
30650
|
if (this.state.direct(chatKey)) {
|
|
30495
|
-
await this.
|
|
30651
|
+
if (phase === "starting") await this.sayStarting(chatKey, to, state);
|
|
30652
|
+
else await this.sayEntered(chatKey, to, state, unattended, lead);
|
|
30496
30653
|
return;
|
|
30497
30654
|
}
|
|
30498
30655
|
const card = this.statusOf(chatKey, state, phase, lead, unattended);
|
|
@@ -30524,6 +30681,19 @@ var StatusBoard = class {
|
|
|
30524
30681
|
const [title, value] = backReply(lang, this.ctx.settings.botName);
|
|
30525
30682
|
await to.send({ ...textMessage(line3), suggestions: [{ title, value }] });
|
|
30526
30683
|
}
|
|
30684
|
+
/**
|
|
30685
|
+
* 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
|
|
30686
|
+
* chat's messages go there yet: that is said once the agent has started (`sayEntered`), and a session that cannot start says
|
|
30687
|
+
* that the messages still go to the bot (2026-11-24: "now go to" said before a start that failed, then taken back).
|
|
30688
|
+
*/
|
|
30689
|
+
async sayStarting(chatKey, to, state) {
|
|
30690
|
+
const words3 = remoteAgentText.in(this.state.lang(chatKey));
|
|
30691
|
+
this.ctx.remoteState.setRemoteStatusCard(chatKey, "");
|
|
30692
|
+
const folder = state.cwd ? `\`${neutral(state.cwd, 120)}\`` : "";
|
|
30693
|
+
await to.send(
|
|
30694
|
+
textMessage(words3.starting({ label: neutral(state.agentLabel, 80), host: neutral(state.host, 80), folder }))
|
|
30695
|
+
);
|
|
30696
|
+
}
|
|
30527
30697
|
/**
|
|
30528
30698
|
* The suggested replies under what the assistant says to a chat that is the agent's window itself: back to the assistant while
|
|
30529
30699
|
* attached, else back to the agent it last talked to.
|
|
@@ -30567,6 +30737,7 @@ function newTurn() {
|
|
|
30567
30737
|
task: null,
|
|
30568
30738
|
stopRequested: false,
|
|
30569
30739
|
waitsForTerminal: false,
|
|
30740
|
+
display: null,
|
|
30570
30741
|
get ended() {
|
|
30571
30742
|
return this.task?.running !== true;
|
|
30572
30743
|
}
|
|
@@ -30595,6 +30766,18 @@ var ChatRegistry = class {
|
|
|
30595
30766
|
/** The session each chat was told its terminal's registry row cannot be read for (once per attach). */
|
|
30596
30767
|
rowHinted = /* @__PURE__ */ new Map();
|
|
30597
30768
|
tickets = /* @__PURE__ */ new Map();
|
|
30769
|
+
/** The chat went on below its running turn's display: that turn's answer must come below what was said since (`movedOn`). */
|
|
30770
|
+
movedOn(chatKey) {
|
|
30771
|
+
this.turns.get(chatKey)?.display?.movedOn?.();
|
|
30772
|
+
}
|
|
30773
|
+
/** The turns running now in a 1:1 chat (`userId`) or, with `scope`, in that group (every binding's there). */
|
|
30774
|
+
turnsIn(userId, scope) {
|
|
30775
|
+
if (!scope) {
|
|
30776
|
+
const turn = this.turns.get(userId);
|
|
30777
|
+
return turn ? [turn] : [];
|
|
30778
|
+
}
|
|
30779
|
+
return [...this.turns].filter(([chatKey]) => groupConversationOf(chatKey) === scope).map(([, turn]) => turn);
|
|
30780
|
+
}
|
|
30598
30781
|
/** How many messages wait behind the chat's running turn. */
|
|
30599
30782
|
queuedCount(chatKey) {
|
|
30600
30783
|
return this.queuedPrompts.get(chatKey)?.length ?? 0;
|
|
@@ -31241,7 +31424,8 @@ var StartClicks = class {
|
|
|
31241
31424
|
const state = this.p.state.attached(click.chatKey);
|
|
31242
31425
|
await this.becomeStatus(
|
|
31243
31426
|
click,
|
|
31244
|
-
state ? await this.p.ops.rowCard(click.chatKey, click.key, state, "", agent, "starting") : null
|
|
31427
|
+
state ? await this.p.ops.rowCard(click.chatKey, click.key, state, "", agent, "starting") : null,
|
|
31428
|
+
true
|
|
31245
31429
|
);
|
|
31246
31430
|
const watch = {
|
|
31247
31431
|
chatKey: click.chatKey,
|
|
@@ -31330,13 +31514,14 @@ var StartClicks = class {
|
|
|
31330
31514
|
* and the tapped card deleted (a phone does not redraw an edit). Where no new card can be sent, the tapped card becomes the
|
|
31331
31515
|
* status card in place.
|
|
31332
31516
|
*/
|
|
31333
|
-
async becomeStatus(click, card) {
|
|
31517
|
+
async becomeStatus(click, card, starting = false) {
|
|
31334
31518
|
const lang = this.c.lang(click);
|
|
31335
31519
|
const state = this.p.state.attached(click.chatKey);
|
|
31336
31520
|
if (card === null || state === null) return this.c.home(click, saidIn(lang, "sessionUnavailable"));
|
|
31337
31521
|
const old = this.p.ctx.remoteState.getRemote(click.chatKey)?.statusCard ?? "";
|
|
31338
31522
|
if (this.p.state.direct(click.chatKey)) {
|
|
31339
|
-
await this.p.board.
|
|
31523
|
+
if (starting) await this.p.board.sayStarting(click.chatKey, click.to, state);
|
|
31524
|
+
else await this.p.board.sayEntered(click.chatKey, click.to, state);
|
|
31340
31525
|
if (click.tapped) await this.removeTapped(click);
|
|
31341
31526
|
return;
|
|
31342
31527
|
}
|
|
@@ -31759,6 +31944,8 @@ var MachineClicks = class {
|
|
|
31759
31944
|
var remoteLeads = {
|
|
31760
31945
|
sessionEnded: ["\u4F1A\u8BDD\u5DF2\u7ED3\u675F", "The session ended"],
|
|
31761
31946
|
couldNotStart: ["\u4F1A\u8BDD\u6CA1\u80FD\u542F\u52A8", "The session could not start"],
|
|
31947
|
+
/** (`folder`: already shown inert, in backticks) */
|
|
31948
|
+
couldNotStartIn: (folder) => [`\u4F1A\u8BDD\u6CA1\u80FD\u5728 ${folder} \u542F\u52A8`, `The session could not start in ${folder}`],
|
|
31762
31949
|
turnIncomplete: ["\u8FD9\u4E00\u8F6E\u6CA1\u6709\u5B8C\u6210", "The turn did not complete"],
|
|
31763
31950
|
/** (a message the terminal may have taken: never said as a turn that did not complete) */
|
|
31764
31951
|
inputUnconfirmed: ["\u8FD8\u6CA1\u786E\u8BA4\u7EC8\u7AEF\u6536\u5230", "Not confirmed by the terminal yet"],
|
|
@@ -31784,7 +31971,7 @@ var connectorReasonText = defineCatalog({
|
|
|
31784
31971
|
adapter_error: "The agent program failed. Look at `run.log` in the connector's state directory on that machine.",
|
|
31785
31972
|
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.",
|
|
31786
31973
|
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.",
|
|
31787
|
-
cwd_not_found: "That
|
|
31974
|
+
cwd_not_found: "That folder does not exist on that machine: pick one that exists there, or create it there first.",
|
|
31788
31975
|
cwd_not_directory: "That path is not a directory.",
|
|
31789
31976
|
cwd_not_absolute: "The directory must be an absolute path (starting with /).",
|
|
31790
31977
|
invalid_cwd: "That directory name is not valid.",
|
|
@@ -31863,7 +32050,7 @@ var connectorReasonText = defineCatalog({
|
|
|
31863
32050
|
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",
|
|
31864
32051
|
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",
|
|
31865
32052
|
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",
|
|
31866
|
-
cwd_not_found: "\u90A3\u53F0\u673A\u5668\u4E0A\u6CA1\u6709\u8FD9\u4E2A\u76EE\u5F55\u3002",
|
|
32053
|
+
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",
|
|
31867
32054
|
cwd_not_directory: "\u8FD9\u4E2A\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\u3002",
|
|
31868
32055
|
cwd_not_absolute: "\u76EE\u5F55\u8981\u5199\u6210\u7EDD\u5BF9\u8DEF\u5F84\uFF08\u4EE5 / \u5F00\u5934\uFF09\u3002",
|
|
31869
32056
|
invalid_cwd: "\u8FD9\u4E2A\u76EE\u5F55\u540D\u65E0\u6548\uFF0C\u6362\u4E00\u4E2A\u76EE\u5F55\u518D\u8BD5\u3002",
|
|
@@ -32083,7 +32270,7 @@ var EndedWords = class {
|
|
|
32083
32270
|
const lang = this.state.lang(chatKey);
|
|
32084
32271
|
const words3 = remoteAgentText.in(lang);
|
|
32085
32272
|
const head = await this.said(chatKey, remoteLeads.sessionEnded, key, provider, connectorId, reason);
|
|
32086
|
-
return head + (follow ? words3.endedFollowTail : words3.endedTail);
|
|
32273
|
+
return head + (follow ? words3.endedFollowTail({ bot: this.ctx.settings.botName }) : words3.endedTail);
|
|
32087
32274
|
}
|
|
32088
32275
|
};
|
|
32089
32276
|
|
|
@@ -32495,8 +32682,8 @@ var BurstSpeaker = class {
|
|
|
32495
32682
|
if (reference === null) return;
|
|
32496
32683
|
this.deps.remoteState.detachRemote(this.chatKey);
|
|
32497
32684
|
const bare2 = bareReason(reason);
|
|
32498
|
-
let text9 = remoteAgentText.in("en").endedWhileIdle({ reason: bare2 });
|
|
32499
|
-
if (bare2 === TERMINAL_CLOSED) text9 = terminalClosedLine(this.langOr("en"));
|
|
32685
|
+
let text9 = remoteAgentText.in("en").endedWhileIdle({ reason: bare2, bot: this.deps.botName });
|
|
32686
|
+
if (bare2 === TERMINAL_CLOSED) text9 = terminalClosedLine(this.langOr("en"), this.deps.botName);
|
|
32500
32687
|
else if (this.deps.describeEnd !== void 0) {
|
|
32501
32688
|
try {
|
|
32502
32689
|
text9 = await unlessCutOff(this.deps.describeEnd(bare2), this.cutOff);
|
|
@@ -32906,16 +33093,13 @@ var Watches = class {
|
|
|
32906
33093
|
async couldNotStart(w, state, reason) {
|
|
32907
33094
|
this.ctx.guard.giveBack(w.chatKey, "remote_agent", w.ticket);
|
|
32908
33095
|
const lang = this.state.lang(w.chatKey);
|
|
32909
|
-
const
|
|
32910
|
-
|
|
32911
|
-
|
|
32912
|
-
w.key,
|
|
32913
|
-
w.provider,
|
|
32914
|
-
state.connectorId,
|
|
32915
|
-
reason
|
|
32916
|
-
);
|
|
33096
|
+
const lead = state.cwd ? remoteLeads.couldNotStartIn(`\`${neutral(state.cwd, 120)}\``) : remoteLeads.couldNotStart;
|
|
33097
|
+
const said2 = await this.ended.said(w.chatKey, lead, w.key, w.provider, state.connectorId, reason);
|
|
33098
|
+
const direct = this.state.direct(w.chatKey);
|
|
32917
33099
|
this.follow.detach(w.chatKey);
|
|
32918
|
-
|
|
33100
|
+
const words3 = remoteAgentText.in(lang);
|
|
33101
|
+
const bot = this.ctx.settings.botName;
|
|
33102
|
+
await w.to.send(textMessage(`${said2} ${direct ? words3.stillToBot({ bot }) : words3.backToBot({ bot })}`));
|
|
32919
33103
|
}
|
|
32920
33104
|
/** Open in a terminal: watched, read-only; its output is told as it comes. */
|
|
32921
33105
|
async watching(w) {
|
|
@@ -32923,7 +33107,8 @@ var Watches = class {
|
|
|
32923
33107
|
this.ctx.guard.giveBack(w.chatKey, "remote_agent", w.ticket);
|
|
32924
33108
|
const state = this.state.attached(w.chatKey);
|
|
32925
33109
|
if (state?.sessionId !== w.sessionId) return;
|
|
32926
|
-
if (await this.board.
|
|
33110
|
+
if (this.state.direct(w.chatKey)) await this.board.sayEntered(w.chatKey, w.to, state);
|
|
33111
|
+
else if (await this.board.settleStatus(w.chatKey, w.to, state, "watching")) return;
|
|
32927
33112
|
const lang = this.state.lang(w.chatKey);
|
|
32928
33113
|
const head = remoteAgentText.in(lang).watchingHead({ label: state.agentLabel, host: state.host });
|
|
32929
33114
|
await w.to.send(textMessage(`${head} ${readOnlyRefused(lang, this.state.offersTakeover(w.chatKey))}`));
|
|
@@ -32938,6 +33123,7 @@ var Watches = class {
|
|
|
32938
33123
|
const state = this.state.attached(w.chatKey);
|
|
32939
33124
|
if (state?.sessionId !== w.sessionId) return;
|
|
32940
33125
|
if (state.unattended === false) this.ctx.guard.giveBack(w.chatKey, "remote_agent", w.ticket);
|
|
33126
|
+
if (this.state.direct(w.chatKey)) return this.board.sayEntered(w.chatKey, w.to, state, void 0, switched.trim());
|
|
32941
33127
|
if (await this.board.settleStatus(w.chatKey, w.to, state, "idle", switched.trim())) {
|
|
32942
33128
|
if (switched) await w.to.send(textMessage(switched.trim()));
|
|
32943
33129
|
return;
|
|
@@ -32948,6 +33134,8 @@ var Watches = class {
|
|
|
32948
33134
|
const lang = this.state.lang(w.chatKey);
|
|
32949
33135
|
const state = this.state.attached(w.chatKey);
|
|
32950
33136
|
const lead = remoteAgentText.in(lang).notReportedLead;
|
|
33137
|
+
if (state !== null && this.state.direct(w.chatKey))
|
|
33138
|
+
return this.board.sayEntered(w.chatKey, w.to, state, void 0, lead);
|
|
32951
33139
|
if (state === null || !await this.board.settleStatus(w.chatKey, w.to, state, "idle", lead)) {
|
|
32952
33140
|
await w.to.send(textMessage(saidIn(lang, "notReported")));
|
|
32953
33141
|
}
|
|
@@ -34067,6 +34255,7 @@ var Prompts = class {
|
|
|
34067
34255
|
const text9 = remoteAgentText.in(this.state.lang(p.chatKey));
|
|
34068
34256
|
const waiting = this.state.chats.queuedCount(p.chatKey);
|
|
34069
34257
|
if (this.state.chats.queuedMessage(p.chatKey, p.messageId)) return;
|
|
34258
|
+
this.state.chats.movedOn(p.chatKey);
|
|
34070
34259
|
if (waiting >= QUEUED_PROMPTS_MAX) return this.say(p.to, text9.queueFull({ n: QUEUED_PROMPTS_MAX }));
|
|
34071
34260
|
const sid = state.sessionId;
|
|
34072
34261
|
let cmdSeq = void 0;
|
|
@@ -34106,7 +34295,7 @@ var Prompts = class {
|
|
|
34106
34295
|
const lang = this.state.lang(p.chatKey);
|
|
34107
34296
|
if (await this.state.watchOver(p.key, state)) {
|
|
34108
34297
|
this.follow.detach(p.chatKey);
|
|
34109
|
-
return this.say(p.to, terminalClosedLine(lang));
|
|
34298
|
+
return this.say(p.to, terminalClosedLine(lang, this.ctx.settings.botName));
|
|
34110
34299
|
}
|
|
34111
34300
|
await this.say(p.to, readOnlyRefused(lang, this.state.offersTakeover(p.chatKey)));
|
|
34112
34301
|
}
|
|
@@ -34135,7 +34324,10 @@ var Prompts = class {
|
|
|
34135
34324
|
}
|
|
34136
34325
|
if (error instanceof ClawError && error.status === 409 && error.code === "session_closed") {
|
|
34137
34326
|
this.follow.detach(p.chatKey);
|
|
34138
|
-
await this.say(
|
|
34327
|
+
await this.say(
|
|
34328
|
+
p.to,
|
|
34329
|
+
`${this.failure(error, p.chatKey)} ${remoteAgentText.in(lang).backToBot({ bot: this.ctx.settings.botName })}`
|
|
34330
|
+
);
|
|
34139
34331
|
return false;
|
|
34140
34332
|
}
|
|
34141
34333
|
if (!(error instanceof ClawError) && !isTransport2(error)) throw error;
|
|
@@ -34400,7 +34592,7 @@ var SessionOps = class {
|
|
|
34400
34592
|
}
|
|
34401
34593
|
const words3 = remoteAgentText.in(lang);
|
|
34402
34594
|
const where = folder ? words3.closedIn({ folder: neutral(folder, 300) }) : "";
|
|
34403
|
-
const text9 = (number ? words3.closedNumber({ number, where }) : words3.closedSession({ where })) + (mine ? words3.closedBack : "");
|
|
34595
|
+
const text9 = (number ? words3.closedNumber({ number, where }) : words3.closedSession({ where })) + (mine ? words3.closedBack({ bot: this.ctx.settings.botName }) : "");
|
|
34404
34596
|
return { done: true, text: text9 };
|
|
34405
34597
|
}
|
|
34406
34598
|
};
|
|
@@ -34751,6 +34943,9 @@ var ChatTurn = class {
|
|
|
34751
34943
|
close(hard = false) {
|
|
34752
34944
|
this.status.close(hard);
|
|
34753
34945
|
}
|
|
34946
|
+
movedOn() {
|
|
34947
|
+
this.status.movedOn(turnText.in(toLang(this.options.lang)).answerBelow);
|
|
34948
|
+
}
|
|
34754
34949
|
finish(parts2, options) {
|
|
34755
34950
|
return this.status.finish(parts2, { rich: true, feedback: false, ai: options.ai, replies: options.replies });
|
|
34756
34951
|
}
|
|
@@ -34873,6 +35068,7 @@ var TurnRunner = class {
|
|
|
34873
35068
|
async run(request, turn, signal) {
|
|
34874
35069
|
const { chatKey, to, state } = request;
|
|
34875
35070
|
const { display, signer } = this.display(request);
|
|
35071
|
+
turn.display = display;
|
|
34876
35072
|
display.begin();
|
|
34877
35073
|
const fold = new RemoteTurnState(this.ctx.errors, request.cmdSeq);
|
|
34878
35074
|
const cursor = this.ctx.remoteState.getRemote(chatKey)?.cursor ?? "";
|
|
@@ -34991,16 +35187,19 @@ var TurnRunner = class {
|
|
|
34991
35187
|
const sid = request.state.sessionId ?? "";
|
|
34992
35188
|
noteWaiting(this.state.chats.turns.get(chatKey), step);
|
|
34993
35189
|
if (step.rejected?.type === "prompt" && step.rejected.cmdSeq !== null) {
|
|
34994
|
-
await this.queuedRefused(chatKey, to, step.rejected.cmdSeq, step.rejected.reason);
|
|
35190
|
+
await this.queuedRefused(chatKey, to, step.rejected.cmdSeq, step.rejected.reason, display);
|
|
34995
35191
|
}
|
|
34996
35192
|
if (step.queued !== null) await this.showWait(request, step, display);
|
|
34997
35193
|
else display.progress(step);
|
|
34998
|
-
if (step.rowUnreadable) await this.sayRowUnreadable(chatKey, sid, to);
|
|
35194
|
+
if (step.rowUnreadable) await this.sayRowUnreadable(chatKey, sid, to, display);
|
|
34999
35195
|
if (saysModes(step)) this.ctx.remoteState.setRemoteModes(chatKey, sid, step);
|
|
35000
|
-
if (step.permission !== null)
|
|
35196
|
+
if (step.permission !== null) {
|
|
35197
|
+
display.movedOn?.();
|
|
35198
|
+
await this.show(chatKey, sid, step.permission, to);
|
|
35199
|
+
}
|
|
35001
35200
|
if (step.resolved !== null) this.ctx.permissions.closeRemotePermission(sid, actionIdOf(step.resolved), "decided");
|
|
35002
35201
|
if (step.recovered !== null && (step.recovered.continuing || !step.recovered.interrupted)) {
|
|
35003
|
-
await this.sayRecovered(chatKey, to, step.recovered.interrupted, step.recovered.continuing);
|
|
35202
|
+
await this.sayRecovered(chatKey, to, step.recovered.interrupted, step.recovered.continuing, display);
|
|
35004
35203
|
}
|
|
35005
35204
|
}
|
|
35006
35205
|
/**
|
|
@@ -35008,7 +35207,7 @@ var TurnRunner = class {
|
|
|
35008
35207
|
* how to take it back (in the terminal when its own queue holds it; else /stop). A message queued behind a turn of this chat was
|
|
35009
35208
|
* told so when it was sent (`queuedBehind`): not again here.
|
|
35010
35209
|
*/
|
|
35011
|
-
async tellBusy(request, step) {
|
|
35210
|
+
async tellBusy(request, step, display) {
|
|
35012
35211
|
const { chatKey, to } = request;
|
|
35013
35212
|
const mine = request.cmdSeq?.();
|
|
35014
35213
|
if (step.queuedSeq === null || mine === void 0 || step.queuedSeq !== mine) return;
|
|
@@ -35024,6 +35223,7 @@ var TurnRunner = class {
|
|
|
35024
35223
|
this.toldBusy.set(chatKey, told);
|
|
35025
35224
|
const words3 = remoteAgentText.in(this.state.lang(chatKey));
|
|
35026
35225
|
const text9 = before === "waiting" ? words3.terminalBusyNowHeld : words3.terminalBusy + (step.queuedHeld ? words3.terminalBusyHeld : words3.terminalBusyWaiting);
|
|
35226
|
+
display.movedOn?.();
|
|
35027
35227
|
try {
|
|
35028
35228
|
await to.send(textMessage(text9));
|
|
35029
35229
|
} catch (error) {
|
|
@@ -35034,11 +35234,12 @@ var TurnRunner = class {
|
|
|
35034
35234
|
* A message waiting behind this turn was refused on the machine before it ran: it waits no more, and the person is told. One whose
|
|
35035
35235
|
* send has not answered yet has no number to match: the refusal is kept for that send (`Prompts.queueBehind`).
|
|
35036
35236
|
*/
|
|
35037
|
-
async queuedRefused(chatKey, to, cmdSeq, reason) {
|
|
35237
|
+
async queuedRefused(chatKey, to, cmdSeq, reason, display) {
|
|
35038
35238
|
if (this.state.chats.takeQueuedSeq(chatKey, cmdSeq) === void 0) {
|
|
35039
35239
|
this.state.chats.noteRefusal(chatKey, cmdSeq, reason);
|
|
35040
35240
|
return;
|
|
35041
35241
|
}
|
|
35242
|
+
display.movedOn?.();
|
|
35042
35243
|
try {
|
|
35043
35244
|
await to.send(textMessage(remoteAgentText.in(this.state.lang(chatKey)).queuedRefused({ reason })));
|
|
35044
35245
|
} catch (error) {
|
|
@@ -35057,7 +35258,7 @@ var TurnRunner = class {
|
|
|
35057
35258
|
const note = queuedNote(reason, step.dialog, lang);
|
|
35058
35259
|
display.progress({ ...step, note, waitLine: queuedLine(reason, lang) });
|
|
35059
35260
|
if (reason === "terminal_dialog" && !display.showsWaits) await this.sayQuestion(display, note, to);
|
|
35060
|
-
if (BUSY_REASONS.has(reason)) await this.tellBusy(request, step);
|
|
35261
|
+
if (BUSY_REASONS.has(reason)) await this.tellBusy(request, step, display);
|
|
35061
35262
|
}
|
|
35062
35263
|
/**
|
|
35063
35264
|
* 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
|
|
@@ -35068,6 +35269,7 @@ var TurnRunner = class {
|
|
|
35068
35269
|
if (told.has(line3)) return;
|
|
35069
35270
|
told.add(line3);
|
|
35070
35271
|
this.questionsTold.set(display, told);
|
|
35272
|
+
display.movedOn?.();
|
|
35071
35273
|
try {
|
|
35072
35274
|
await to.send(textMessage(line3));
|
|
35073
35275
|
} catch (error) {
|
|
@@ -35075,8 +35277,9 @@ var TurnRunner = class {
|
|
|
35075
35277
|
}
|
|
35076
35278
|
}
|
|
35077
35279
|
/** Once per attach: the terminal's registry row cannot be read, and a restart of it there makes it known again. */
|
|
35078
|
-
async sayRowUnreadable(chatKey, sid, to) {
|
|
35280
|
+
async sayRowUnreadable(chatKey, sid, to, display) {
|
|
35079
35281
|
if (!this.state.chats.firstRowHint(chatKey, sid)) return;
|
|
35282
|
+
display.movedOn?.();
|
|
35080
35283
|
try {
|
|
35081
35284
|
await to.send(textMessage(rowUnreadableLine(this.state.lang(chatKey))));
|
|
35082
35285
|
} catch (error) {
|
|
@@ -35085,9 +35288,10 @@ var TurnRunner = class {
|
|
|
35085
35288
|
});
|
|
35086
35289
|
}
|
|
35087
35290
|
}
|
|
35088
|
-
async sayRecovered(chatKey, to, interrupted, continuing) {
|
|
35291
|
+
async sayRecovered(chatKey, to, interrupted, continuing, display) {
|
|
35089
35292
|
const state = this.ctx.remoteState.getRemote(chatKey);
|
|
35090
35293
|
if (!state?.sessionId) return;
|
|
35294
|
+
display.movedOn?.();
|
|
35091
35295
|
try {
|
|
35092
35296
|
const line3 = recoveredLine(state.agentLabel, state.host, this.state.lang(chatKey), interrupted, continuing);
|
|
35093
35297
|
await to.send(textMessage(line3));
|
|
@@ -35394,6 +35598,13 @@ var RemoteAgents = class {
|
|
|
35394
35598
|
currentTurn(chatKey) {
|
|
35395
35599
|
return this.chats.turns.get(chatKey);
|
|
35396
35600
|
}
|
|
35601
|
+
goesOn(userId, scope) {
|
|
35602
|
+
const turns = this.chats.turnsIn(userId, scope);
|
|
35603
|
+
if (turns.length === 0) return void 0;
|
|
35604
|
+
return () => {
|
|
35605
|
+
for (const turn of turns) turn.display?.movedOn?.();
|
|
35606
|
+
};
|
|
35607
|
+
}
|
|
35397
35608
|
/** The chat's session card is its window (`/agent mode card`, not a direct chat): a turn is shown there, with its own Stop. */
|
|
35398
35609
|
windowed(chatKey) {
|
|
35399
35610
|
const state = this.enabled ? this.state.attached(chatKey) : null;
|
|
@@ -36040,6 +36251,7 @@ export {
|
|
|
36040
36251
|
insertLinks,
|
|
36041
36252
|
integrationRegistry,
|
|
36042
36253
|
intentPrompt,
|
|
36254
|
+
isAgentsSlip,
|
|
36043
36255
|
isAlnum,
|
|
36044
36256
|
isApiKey,
|
|
36045
36257
|
isAsciiAlpha,
|
|
@@ -36172,6 +36384,7 @@ export {
|
|
|
36172
36384
|
plainLine,
|
|
36173
36385
|
plainText,
|
|
36174
36386
|
pointAt,
|
|
36387
|
+
postingAfter,
|
|
36175
36388
|
prShortPattern,
|
|
36176
36389
|
prUrlPattern,
|
|
36177
36390
|
proactiveLines,
|
|
@@ -7,3 +7,9 @@ export interface AgentCommand {
|
|
|
7
7
|
}
|
|
8
8
|
/** The arguments of `/agent ARGS`; null when ARGS is empty or names no subcommand (the caller shows the usage). */
|
|
9
9
|
export declare function parseAgentCommand(arg: string): AgentCommand | null;
|
|
10
|
+
/**
|
|
11
|
+
* Whether `text` is a slip of `/agents` with nothing after it: a full-width slash, a capital, a full stop or a question mark
|
|
12
|
+
* after it, or one letter off (`/agnets`, `/agens`, `/agentss`). Such a message shows the list, as `/agents` does; it never
|
|
13
|
+
* starts or attaches anything, and it never goes on to the assistant as words. A known command (`/agent`, `/agents`) is not a slip.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isAgentsSlip(text: string): boolean;
|
|
@@ -14,7 +14,8 @@ export declare const MENU_COMMANDS: Readonly<Record<string, string>>;
|
|
|
14
14
|
export declare const GROUP_MENU_COMMANDS: readonly ["help", "new", "stop", "whoami", "feedback"];
|
|
15
15
|
/**
|
|
16
16
|
* `text` as the command it is when it is exactly a word of the commands menu (case and spacing do not matter), `link CODE` with a
|
|
17
|
-
* code of the console's shape as `/link CODE`,
|
|
17
|
+
* code of the console's shape as `/link CODE`, a slip of `/agents` (`/agnets`, `/agents`) as `/agents` in a 1:1 chat, and
|
|
18
|
+
* `text` itself otherwise. `group`: a group chat reads only its own menu's words.
|
|
18
19
|
*/
|
|
19
20
|
export declare function menuCommand(text: string, group?: boolean): string;
|
|
20
21
|
/** The code of a `/link CODE` message, else null. */
|
|
@@ -44,7 +44,19 @@ export declare const remoteAgentText: import("./catalog.js").Catalog<{
|
|
|
44
44
|
keyRejected: string;
|
|
45
45
|
whichSession: string;
|
|
46
46
|
whichSessionOrAgent: string;
|
|
47
|
-
|
|
47
|
+
backToBot: (p: {
|
|
48
|
+
bot: string;
|
|
49
|
+
}) => string;
|
|
50
|
+
/** A new session that never started: the chat was never said to be in it, so its messages never left the bot. */
|
|
51
|
+
stillToBot: (p: {
|
|
52
|
+
bot: string;
|
|
53
|
+
}) => string;
|
|
54
|
+
/** A New session tap or `/agent new`, said at once: what starts where; where messages go is said once the agent has started. */
|
|
55
|
+
starting: (p: {
|
|
56
|
+
label: string;
|
|
57
|
+
host: string;
|
|
58
|
+
folder: string;
|
|
59
|
+
}) => string;
|
|
48
60
|
tapInactive: string;
|
|
49
61
|
tapInvalid: string;
|
|
50
62
|
cardExpired: string;
|
|
@@ -105,11 +117,14 @@ export declare const remoteAgentText: import("./catalog.js").Catalog<{
|
|
|
105
117
|
/** A session that ended while the chat was idle, when its end cannot be described (said in English, as the worker did). */
|
|
106
118
|
endedWhileIdle: (p: {
|
|
107
119
|
reason: string;
|
|
120
|
+
bot: string;
|
|
108
121
|
}) => string;
|
|
109
122
|
noMachineYet: string;
|
|
110
123
|
changedElsewhere: string;
|
|
111
124
|
listBelow: string;
|
|
112
|
-
endedFollowTail:
|
|
125
|
+
endedFollowTail: (p: {
|
|
126
|
+
bot: string;
|
|
127
|
+
}) => string;
|
|
113
128
|
endedTail: string;
|
|
114
129
|
approvalInPersonal: (p: {
|
|
115
130
|
who: string;
|
|
@@ -193,7 +208,9 @@ export declare const remoteAgentText: import("./catalog.js").Catalog<{
|
|
|
193
208
|
closedIn: (p: {
|
|
194
209
|
folder: string;
|
|
195
210
|
}) => string;
|
|
196
|
-
closedBack:
|
|
211
|
+
closedBack: (p: {
|
|
212
|
+
bot: string;
|
|
213
|
+
}) => string;
|
|
197
214
|
newUsage: string;
|
|
198
215
|
modeIs: (p: {
|
|
199
216
|
mode: string;
|
|
@@ -6,6 +6,8 @@ type Pair = readonly [zh: string, en: string];
|
|
|
6
6
|
export declare const remoteLeads: {
|
|
7
7
|
readonly sessionEnded: readonly ["会话已结束", "The session ended"];
|
|
8
8
|
readonly couldNotStart: readonly ["会话没能启动", "The session could not start"];
|
|
9
|
+
/** (`folder`: already shown inert, in backticks) */
|
|
10
|
+
readonly couldNotStartIn: (folder: string) => Pair;
|
|
9
11
|
readonly turnIncomplete: readonly ["这一轮没有完成", "The turn did not complete"];
|
|
10
12
|
/** (a message the terminal may have taken: never said as a turn that did not complete) */
|
|
11
13
|
readonly inputUnconfirmed: readonly ["还没确认终端收到", "Not confirmed by the terminal yet"];
|
|
@@ -219,7 +219,9 @@ export declare const remoteText: import("./catalog.js").Catalog<{
|
|
|
219
219
|
shareNoteTyped: string;
|
|
220
220
|
shareNoteNoTmux: string;
|
|
221
221
|
shareNoteOld: string;
|
|
222
|
-
terminalClosed:
|
|
222
|
+
terminalClosed: (p: {
|
|
223
|
+
bot: string;
|
|
224
|
+
}) => string;
|
|
223
225
|
switched: (p: {
|
|
224
226
|
where: string;
|
|
225
227
|
}) => string;
|
|
@@ -23,6 +23,8 @@ export declare const turnText: import("./catalog.js").Catalog<{
|
|
|
23
23
|
stillWorking: string;
|
|
24
24
|
/** A turn whose stream is closed because a card now waits for the person's choice. */
|
|
25
25
|
awaitingChoice: string;
|
|
26
|
+
/** A turn whose stream is closed because the chat went on below it: the whole answer comes below. */
|
|
27
|
+
answerBelow: string;
|
|
26
28
|
interrupted: string;
|
|
27
29
|
/** What a turn the person stopped ends with. */
|
|
28
30
|
stopped: string;
|
|
@@ -95,6 +95,12 @@ export declare class StatusBoard {
|
|
|
95
95
|
* may still have from before is forgotten, so nothing edits it any more.
|
|
96
96
|
*/
|
|
97
97
|
sayEntered(chatKey: string, to: Conversation, state: RemoteState, unattended?: boolean, lead?: string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* 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
|
|
100
|
+
* chat's messages go there yet: that is said once the agent has started (`sayEntered`), and a session that cannot start says
|
|
101
|
+
* that the messages still go to the bot (2026-11-24: "now go to" said before a start that failed, then taken back).
|
|
102
|
+
*/
|
|
103
|
+
sayStarting(chatKey: string, to: Conversation, state: RemoteState): Promise<void>;
|
|
98
104
|
/**
|
|
99
105
|
* The suggested replies under what the assistant says to a chat that is the agent's window itself: back to the assistant while
|
|
100
106
|
* attached, else back to the agent it last talked to.
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What this process knows of each chat attached to a remote session, beside what the store keeps: what reads the session now (a
|
|
3
|
-
* turn, a short watch, the follower), what its connector reported when the chat attached, whether the session only watches a
|
|
4
|
-
* conversation open in a terminal, and the one-time tokens of the cards it showed. Keyed by the chat key (`chat-key.ts`). All of it
|
|
5
|
-
* is lost when the process restarts, as it was in the Python worker; what must survive is in the store.
|
|
6
|
-
*/
|
|
7
1
|
import type { Follower } from "./follow/follower.js";
|
|
8
2
|
import type { Task } from "./tasks.js";
|
|
3
|
+
import type { TurnDisplay } from "./turns/display.js";
|
|
9
4
|
/** Folders typed in a `/agent new MACHINE PATH` kept for the buttons of the card that asks which agent, per chat. */
|
|
10
5
|
export declare const TYPED_PATHS_KEPT = 20;
|
|
11
6
|
export declare const TYPED_PATH_SECONDS = 3600;
|
|
@@ -19,6 +14,8 @@ export interface RemoteTurn {
|
|
|
19
14
|
waitsForTerminal: boolean;
|
|
20
15
|
/** Nothing runs it any more (or nothing ever did): a Stop card's press for it stops nothing. */
|
|
21
16
|
readonly ended: boolean;
|
|
17
|
+
/** What shows it in the chat, once it has begun: told when the chat goes on below it (`TurnDisplay.movedOn`). */
|
|
18
|
+
display: TurnDisplay | null;
|
|
22
19
|
}
|
|
23
20
|
/**
|
|
24
21
|
* A message sent to the attached session while a turn of the chat still ran. Claw keeps it in order and the machine runs it once the
|
|
@@ -71,6 +68,10 @@ export declare class ChatRegistry {
|
|
|
71
68
|
/** The session each chat was told its terminal's registry row cannot be read for (once per attach). */
|
|
72
69
|
private readonly rowHinted;
|
|
73
70
|
private readonly tickets;
|
|
71
|
+
/** The chat went on below its running turn's display: that turn's answer must come below what was said since (`movedOn`). */
|
|
72
|
+
movedOn(chatKey: string): void;
|
|
73
|
+
/** The turns running now in a 1:1 chat (`userId`) or, with `scope`, in that group (every binding's there). */
|
|
74
|
+
turnsIn(userId: string, scope: string): RemoteTurn[];
|
|
74
75
|
/** How many messages wait behind the chat's running turn. */
|
|
75
76
|
queuedCount(chatKey: string): number;
|
|
76
77
|
enqueue(chatKey: string, prompt: QueuedPrompt): void;
|
|
@@ -29,7 +29,7 @@ export declare class StartClicks {
|
|
|
29
29
|
* and the tapped card deleted (a phone does not redraw an edit). Where no new card can be sent, the tapped card becomes the
|
|
30
30
|
* status card in place.
|
|
31
31
|
*/
|
|
32
|
-
becomeStatus(click: Click, card: Shown | null): Promise<void>;
|
|
32
|
+
becomeStatus(click: Click, card: Shown | null, starting?: boolean): Promise<void>;
|
|
33
33
|
private post;
|
|
34
34
|
private inPlace;
|
|
35
35
|
private removeTapped;
|
|
@@ -55,7 +55,7 @@ export declare function rowUnreadableLine(lang: Lang): string;
|
|
|
55
55
|
* conversation from the terminal; `takeover`: the status card also offers Take over…, which ends the terminal's session. */
|
|
56
56
|
export declare function readOnlyRefused(lang: Lang, takeover?: boolean): string;
|
|
57
57
|
/** The watch is over because the terminal let the conversation go. */
|
|
58
|
-
export declare function terminalClosedLine(lang: Lang): string;
|
|
58
|
+
export declare function terminalClosedLine(lang: Lang, bot: string): string;
|
|
59
59
|
/** `dev-pod · 🟠 Claude Code`: which session a chat talks to, in one line. */
|
|
60
60
|
export declare function whereLine(label: string, host: string): string;
|
|
61
61
|
/** The short line a switch leaves in the chat, so that on a phone the two stretches of conversation can be told apart. */
|
|
@@ -60,6 +60,7 @@ export declare class RemoteAgents implements RemoteChat {
|
|
|
60
60
|
stop(chat: UserRef, credential: string, conversation: Conversation, only?: RemoteTurn): Promise<boolean>;
|
|
61
61
|
/** The turn this worker is watching for the chat now, if any (what a phone's Stop card is sent for). */
|
|
62
62
|
currentTurn(chatKey: string): RemoteTurn | undefined;
|
|
63
|
+
goesOn(userId: string, scope: string): (() => void) | undefined;
|
|
63
64
|
/** The chat's session card is its window (`/agent mode card`, not a direct chat): a turn is shown there, with its own Stop. */
|
|
64
65
|
windowed(chatKey: string): boolean;
|
|
65
66
|
agents(sender: UserRef, credential: string, conversation: Conversation): Promise<void>;
|
|
@@ -10,6 +10,11 @@ export interface TurnDisplay {
|
|
|
10
10
|
close(hard?: boolean): void;
|
|
11
11
|
/** The answer: `parts` in order, the suggested `replies` under the last. */
|
|
12
12
|
finish(parts: readonly string[], options: FinishWith): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* The chat went on below what shows the turn (the person wrote again, or the chat was told something): the answer must come below
|
|
15
|
+
* that, whole, never begun above it (optional: a display that posts nothing until the end has nothing to move).
|
|
16
|
+
*/
|
|
17
|
+
movedOn?(): void;
|
|
13
18
|
/** After `finish`, when the turn of a queued message follows at once: what this turn showed must stay readable (optional). */
|
|
14
19
|
handOver?(): Promise<void>;
|
|
15
20
|
/**
|
|
@@ -53,7 +53,14 @@ export declare class Chat {
|
|
|
53
53
|
say(text: string): Promise<void>;
|
|
54
54
|
sayRich(markdown: string): Promise<void>;
|
|
55
55
|
send(message: OutMessage): Promise<void>;
|
|
56
|
+
/** The same chat, said into through `conversation`. */
|
|
57
|
+
through(conversation: Conversation): Chat;
|
|
56
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* `conversation`, with `first` called before anything new is posted in it (a message, an envelope, a stream); an edit of a
|
|
61
|
+
* message already there is not new.
|
|
62
|
+
*/
|
|
63
|
+
export declare function postingAfter(conversation: Conversation, first: () => void): Conversation;
|
|
57
64
|
/**
|
|
58
65
|
* THE way a click ends (the Python `Agent._close_card`): the clicked card is replaced, by `card` or by a note saying it,
|
|
59
66
|
* and the outcome is said in a new message too, because a phone does not redraw an edited message. A click with no line
|
|
@@ -139,6 +139,12 @@ export interface RemoteChat {
|
|
|
139
139
|
forgetPerson(userId: string): void;
|
|
140
140
|
/** The chat key of a person's binding in a group chat. */
|
|
141
141
|
groupChatKey(userId: string, scope: string): string;
|
|
142
|
+
/**
|
|
143
|
+
* Something is said in the chat (a 1:1 chat's `userId`, or the group `scope`) below the stream of an attached agent's turn running
|
|
144
|
+
* there now: what tells those turns, so their answers come below it (`TurnDisplay.movedOn`); undefined when none runs there.
|
|
145
|
+
* Bound to the turns running when it is asked: a turn that starts later is never told by it.
|
|
146
|
+
*/
|
|
147
|
+
goesOn?(userId: string, scope: string): (() => void) | undefined;
|
|
142
148
|
}
|
|
143
149
|
/** The person's notification subscription in Claw (Python `subscriptions.Subscriptions`); undefined when notifications are off. */
|
|
144
150
|
export interface Subscriptions {
|
|
@@ -24,6 +24,12 @@ export declare class Router {
|
|
|
24
24
|
constructor(deps: RouterDeps);
|
|
25
25
|
handle(event: InboundEvent): Promise<void>;
|
|
26
26
|
private route;
|
|
27
|
+
/**
|
|
28
|
+
* What happens in the chat now happens below the stream of an attached agent's turn running there, whatever it is (a message
|
|
29
|
+
* of the person's, a command answered at once, a click whose outcome is said): that turn's answer must come below it, whole,
|
|
30
|
+
* never begun above it and continued below (`movedOn`). A message is in the chat already; a click, once it posts something.
|
|
31
|
+
*/
|
|
32
|
+
private goingOn;
|
|
27
33
|
/** The safety net under every card click: a click whose card is still the placeholder ends with a note. */
|
|
28
34
|
private settleOpen;
|
|
29
35
|
private vote;
|
|
@@ -81,6 +81,10 @@ export declare class StatusMessage<S> {
|
|
|
81
81
|
private hard;
|
|
82
82
|
/** The answer is on its way (`finish`): the progress message is the answer's to retire. */
|
|
83
83
|
private finishing;
|
|
84
|
+
/** The chat went on below the stream (`movedOn`): the line its bubble ends with; the answer comes whole below. */
|
|
85
|
+
private wentOn;
|
|
86
|
+
/** Closing the stream because the chat went on below it, once its words show there (`movedOn`). */
|
|
87
|
+
private moving;
|
|
84
88
|
constructor(surface: TurnSurface, options: StatusOptions<S>);
|
|
85
89
|
begin(): void;
|
|
86
90
|
private openStream;
|
|
@@ -94,6 +98,12 @@ export declare class StatusMessage<S> {
|
|
|
94
98
|
* a message of its own. Nothing more is sent to the stream once this has begun.
|
|
95
99
|
*/
|
|
96
100
|
private closeEarly;
|
|
101
|
+
/**
|
|
102
|
+
* End the stream with `line` after the agent's words in its bubble: the answer, whenever it comes, is a message of its own. The
|
|
103
|
+
* words not yet streamed go into the bubble too, unless the chat went on below it (`movedOn`): the answer then comes whole below,
|
|
104
|
+
* and the bubble keeps only what it already shows (the chat will not let that shrink).
|
|
105
|
+
*/
|
|
106
|
+
private endStream;
|
|
97
107
|
/**
|
|
98
108
|
* A card now waits for the person (a question of the agent): it is their turn, so the floating status must not go on
|
|
99
109
|
* saying "Thinking…" until the chat's limit. An open stream is closed at once with AWAITING_CHOICE, and the answer comes
|
|
@@ -107,6 +117,16 @@ export declare class StatusMessage<S> {
|
|
|
107
117
|
* after all, `notice` is said as a message. False when there is no stream: the caller says it. Never fails the turn.
|
|
108
118
|
*/
|
|
109
119
|
queued(notice: string): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* The chat went on below the stream while the turn runs (the person wrote again, or something else was said there): the stream's
|
|
122
|
+
* bubble stays where it opened, above all that. An answer begun in it and continued below would be read from its middle, its first
|
|
123
|
+
* 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
|
|
124
|
+
* 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
|
|
125
|
+
* closed at once. Either way it ends with `line`, and the whole answer comes as messages of its own, below what was said since.
|
|
126
|
+
* When it comes while the answer is going out (its first part in the bubble already), the whole answer is sent again below.
|
|
127
|
+
* Nothing when no stream is open or one is already closing. Never fails the turn.
|
|
128
|
+
*/
|
|
129
|
+
movedOn(line: string): void;
|
|
110
130
|
/** The chat's id of the posted message; undefined when the post failed or its id never came (nothing is edited then). */
|
|
111
131
|
private messageId;
|
|
112
132
|
/**
|
|
@@ -125,6 +145,8 @@ export declare class StatusMessage<S> {
|
|
|
125
145
|
progress(step: S): void;
|
|
126
146
|
/** The text for the answer's bubble ('' when there is none); what was streamed when it no longer grows from that. */
|
|
127
147
|
private streamable;
|
|
148
|
+
/** The agent's words for the bubble now: none once the chat went on below it (its status only; the words come below). */
|
|
149
|
+
private bubbleWords;
|
|
128
150
|
/** Whether the turn is still shown by its stream (a refusal hands it to the progress message). */
|
|
129
151
|
private streaming;
|
|
130
152
|
private flush;
|
|
@@ -159,7 +181,7 @@ export declare class StatusMessage<S> {
|
|
|
159
181
|
private quiesce;
|
|
160
182
|
/**
|
|
161
183
|
* The stream opened and the chat later refused an update of it, so the progress message took over: the stream is still
|
|
162
|
-
* closed, with the first part of the answer when the chat takes that
|
|
184
|
+
* closed, with the first part of the answer when the chat takes that, and what is left of the answer is sent as messages.
|
|
163
185
|
*/
|
|
164
186
|
private closeRefusedStream;
|
|
165
187
|
/**
|
|
@@ -167,6 +189,12 @@ export declare class StatusMessage<S> {
|
|
|
167
189
|
* parts follow as messages. A final the chat refuses is sent as a message of its own, so the answer is never lost.
|
|
168
190
|
*/
|
|
169
191
|
private finishStream;
|
|
192
|
+
/**
|
|
193
|
+
* Send `rest`, what follows the stream's final. When that final showed part of the answer above (`shown`) and the chat goes on
|
|
194
|
+
* below the bubble while the rest goes out (`movedOn`: the person wrote meanwhile), the whole answer is sent again below that, so
|
|
195
|
+
* it is never read from its middle. A final that is the whole answer (nothing follows it) stays as it is.
|
|
196
|
+
*/
|
|
197
|
+
private sendAfterBubble;
|
|
170
198
|
/** Wait until FINAL_SETTLE_SECONDS have passed since the last progress edit left. */
|
|
171
199
|
private settle;
|
|
172
200
|
/**
|