@primusclaw/personal-agent 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -21433,7 +21433,11 @@ var terminalApprovalText = defineCatalog({
|
|
|
21433
21433
|
approvalsOff: "Approvals from terminals are off: questions stay in the terminal.",
|
|
21434
21434
|
approvalsTurnedOn: "Turned on: questions your terminals ask come here too. `/approvals off` stops it.",
|
|
21435
21435
|
approvalsTurnedOff: "Turned off: questions stay in the terminal. `/approvals on` brings them back.",
|
|
21436
|
-
approvalsUsage: "Use `/approvals on
|
|
21436
|
+
approvalsUsage: "Use `/approvals` to see whether approvals from terminals are on, how often summaries come and which conversations are muted; `/approvals on` or `/approvals off` to change the first; `/approvals mute #12` (or `unmute #12`) for one terminal conversation, by the number its message names; `/approvals summary 60` (minutes, 15 to 1440, or `off`) for how often a conversation that keeps working on its own is summed up.",
|
|
21437
|
+
mutedNone: "No conversation is muted. `/approvals mute #12` mutes one, by the number its message names.",
|
|
21438
|
+
mutedHeader: (p) => `Muted conversations (${p.count}): what they ask, wait for or finish stays in their terminals. \`/approvals unmute #12\` brings one back.`,
|
|
21439
|
+
mutedLine: (p) => p.since ? `${p.who} (muted since ${p.since})` : p.who,
|
|
21440
|
+
mutedUnnamed: "a conversation",
|
|
21437
21441
|
muted: (p) => `Muted #${p.item}${p.where ? ` (${p.where})` : ""}: what that conversation asks, waits for or finishes stays in its terminal. \`/approvals unmute #${p.item}\` brings it back.`,
|
|
21438
21442
|
unmuted: (p) => `Unmuted #${p.item}${p.where ? ` (${p.where})` : ""}: that conversation's questions and ends come here again.`,
|
|
21439
21443
|
muteNotFound: (p) => `I have no item #${p.item} of yours.`,
|
|
@@ -21488,7 +21492,11 @@ var terminalApprovalText = defineCatalog({
|
|
|
21488
21492
|
approvalsOff: "\u7EC8\u7AEF\u5BA1\u6279\u63A8\u9001\u5DF2\u5173\u95ED\uFF1A\u8FD9\u4E9B\u95EE\u9898\u53EA\u5728\u7EC8\u7AEF\u91CC\u95EE\u3002",
|
|
21489
21493
|
approvalsTurnedOn: "\u5DF2\u5F00\u542F\uFF1A\u7EC8\u7AEF\u91CC\u7684\u95EE\u9898\u4E5F\u4F1A\u63A8\u5230\u8FD9\u91CC\u3002\u53D1 `/approvals off` \u5173\u95ED\u3002",
|
|
21490
21494
|
approvalsTurnedOff: "\u5DF2\u5173\u95ED\uFF1A\u95EE\u9898\u53EA\u5728\u7EC8\u7AEF\u91CC\u95EE\u3002\u53D1 `/approvals on` \u91CD\u65B0\u5F00\u542F\u3002",
|
|
21491
|
-
approvalsUsage: "\u7528 `/approvals on` \u6216 `/approvals off
|
|
21495
|
+
approvalsUsage: "\u53EA\u53D1 `/approvals` \u770B\u5F53\u524D\u72B6\u6001\uFF08\u7EC8\u7AEF\u5BA1\u6279\u63A8\u9001\u662F\u5426\u5F00\u542F\u3001\u6C47\u603B\u95F4\u9694\u3001\u5DF2\u9759\u97F3\u7684\u4F1A\u8BDD\uFF09\uFF1B\u7528 `/approvals on` \u6216 `/approvals off` \u5F00\u5173\u63A8\u9001\uFF1B\u5BF9\u5355\u4E2A\u7EC8\u7AEF\u4F1A\u8BDD\u7528 `/approvals mute #12`\uFF08\u6216 `unmute #12`\uFF09\uFF0C\u7F16\u53F7\u89C1\u63A8\u9001\u6D88\u606F\u91CC\u7684 #N\uFF1B`/approvals summary 60`\uFF08\u5206\u949F\uFF0C15 \u5230 1440\uFF0C\u6216 `off`\uFF09\u8BBE\u7F6E\u6301\u7EED\u5DE5\u4F5C\u7684\u4F1A\u8BDD\u591A\u4E45\u6C47\u603B\u4E00\u6B21\u3002",
|
|
21496
|
+
mutedNone: "\u6CA1\u6709\u5DF2\u9759\u97F3\u7684\u4F1A\u8BDD\u3002\u53D1 `/approvals mute #12` \u9759\u97F3\u67D0\u4E2A\u4F1A\u8BDD\uFF0C\u7F16\u53F7\u89C1\u63A8\u9001\u6D88\u606F\u91CC\u7684 #N\u3002",
|
|
21497
|
+
mutedHeader: (p) => `\u5DF2\u9759\u97F3\u7684\u4F1A\u8BDD\uFF08${p.count} \u4E2A\uFF09\uFF1A\u5B83\u4EEC\u7684\u63D0\u95EE\u3001\u7B49\u5F85\u548C\u5B8C\u6210\u53EA\u7559\u5728\u7EC8\u7AEF\u91CC\u3002\u53D1 \`/approvals unmute #12\` \u6062\u590D\u5176\u4E2D\u4E00\u4E2A\u3002`,
|
|
21498
|
+
mutedLine: (p) => p.since ? `${p.who}\uFF08${p.since} \u8D77\u9759\u97F3\uFF09` : p.who,
|
|
21499
|
+
mutedUnnamed: "\u4E00\u4E2A\u4F1A\u8BDD",
|
|
21492
21500
|
muted: (p) => `\u5DF2\u9759\u97F3 #${p.item}${p.where ? `\uFF08${p.where}\uFF09` : ""}\uFF1A\u8FD9\u4E2A\u4F1A\u8BDD\u7684\u63D0\u95EE\u3001\u7B49\u5F85\u548C\u5B8C\u6210\u90FD\u53EA\u7559\u5728\u7EC8\u7AEF\u91CC\u3002\u53D1 \`/approvals unmute #${p.item}\` \u6062\u590D\u3002`,
|
|
21493
21501
|
unmuted: (p) => `\u5DF2\u6062\u590D #${p.item}${p.where ? `\uFF08${p.where}\uFF09` : ""}\uFF1A\u8FD9\u4E2A\u4F1A\u8BDD\u7684\u63D0\u95EE\u548C\u5B8C\u6210\u4F1A\u91CD\u65B0\u63A8\u5230\u8FD9\u91CC\u3002`,
|
|
21494
21502
|
muteNotFound: (p) => `\u4F60\u6CA1\u6709\u7F16\u53F7\u4E3A #${p.item} \u7684\u4E8B\u9879\u3002`,
|
|
@@ -35943,6 +35951,11 @@ function summaryMinutes(arg) {
|
|
|
35943
35951
|
const n = Number(arg);
|
|
35944
35952
|
return n >= SUMMARY_MIN && n <= SUMMARY_MAX3 ? n : null;
|
|
35945
35953
|
}
|
|
35954
|
+
function mutedLine(m, words3) {
|
|
35955
|
+
const who = [m.item === null ? "" : `#${String(m.item)}`, lit(m.title, 60), lit(m.machine, 40)].filter(Boolean).join(" \xB7 ");
|
|
35956
|
+
const at = parseIsoSeconds(m.muted_since);
|
|
35957
|
+
return words3.mutedLine({ who: who || words3.mutedUnnamed, since: at === null ? "" : utcStamp2(at) });
|
|
35958
|
+
}
|
|
35946
35959
|
var TerminalApprovalsCommand = class {
|
|
35947
35960
|
constructor(claw) {
|
|
35948
35961
|
this.claw = claw;
|
|
@@ -35962,7 +35975,7 @@ var TerminalApprovalsCommand = class {
|
|
|
35962
35975
|
return true;
|
|
35963
35976
|
}
|
|
35964
35977
|
try {
|
|
35965
|
-
if (arg === "") await say3(await this.
|
|
35978
|
+
if (arg === "") await say3(await this.state(route));
|
|
35966
35979
|
else {
|
|
35967
35980
|
const enabled = await this.claw.setApprovals(route.credential, arg === "on");
|
|
35968
35981
|
await say3(enabled ? words3.approvalsTurnedOn : words3.approvalsTurnedOff);
|
|
@@ -35973,6 +35986,23 @@ var TerminalApprovalsCommand = class {
|
|
|
35973
35986
|
}
|
|
35974
35987
|
return true;
|
|
35975
35988
|
}
|
|
35989
|
+
/** The whole state, as one message: the switch, how often a conversation that works on its own is summed up, the muted ones. */
|
|
35990
|
+
async state(route) {
|
|
35991
|
+
const words3 = terminalApprovalText.in(route.lang());
|
|
35992
|
+
const [enabled, every, muted2] = await Promise.all([
|
|
35993
|
+
this.claw.approvals(route.credential),
|
|
35994
|
+
this.claw.summary(route.credential),
|
|
35995
|
+
this.claw.mutedTerminals(route.credential)
|
|
35996
|
+
]);
|
|
35997
|
+
const lines = [
|
|
35998
|
+
enabled ? words3.approvalsOn : words3.approvalsOff,
|
|
35999
|
+
every === 0 ? words3.summaryNever : words3.summaryEvery({ minutes: String(every) })
|
|
36000
|
+
];
|
|
36001
|
+
if (muted2.length === 0) lines.push(words3.mutedNone);
|
|
36002
|
+
else
|
|
36003
|
+
lines.push(words3.mutedHeader({ count: String(muted2.length) }), ...muted2.map((m) => `- ${mutedLine(m, words3)}`));
|
|
36004
|
+
return lines.join("\n");
|
|
36005
|
+
}
|
|
35976
36006
|
async summary(route, arg) {
|
|
35977
36007
|
const words3 = terminalApprovalText.in(route.lang());
|
|
35978
36008
|
const say3 = (text9) => route.conversation.send(textMessage(text9));
|
|
@@ -45,6 +45,15 @@ export declare const terminalApprovalText: import("./catalog.js").Catalog<{
|
|
|
45
45
|
approvalsTurnedOn: string;
|
|
46
46
|
approvalsTurnedOff: string;
|
|
47
47
|
approvalsUsage: string;
|
|
48
|
+
mutedNone: string;
|
|
49
|
+
mutedHeader: (p: {
|
|
50
|
+
count: string;
|
|
51
|
+
}) => string;
|
|
52
|
+
mutedLine: (p: {
|
|
53
|
+
who: string;
|
|
54
|
+
since: string;
|
|
55
|
+
}) => string;
|
|
56
|
+
mutedUnnamed: string;
|
|
48
57
|
muted: (p: {
|
|
49
58
|
item: string;
|
|
50
59
|
where: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JsonObject } from "../../json.js";
|
|
2
|
-
import type { RemoteHidden } from "../../protocol.js";
|
|
2
|
+
import type { RemoteHidden, RemoteMutedConversation } from "../../protocol.js";
|
|
3
3
|
import type { ClawCredential } from "../../claw/credential.js";
|
|
4
4
|
import type { SseEvent } from "../../claw/model.js";
|
|
5
5
|
import type { RemoteConnector, RemoteEventRow, RemotePairing, RemoteSession, RemoteSetup } from "../../claw/remote.js";
|
|
@@ -55,6 +55,11 @@ export interface ClawRemoteAgentsPort {
|
|
|
55
55
|
* is pushed while muted (`PUT /approvals/mutes`). Answers what Claw stored, and the machine and conversation it names.
|
|
56
56
|
*/
|
|
57
57
|
muteTerminal(key: ClawCredential, item: number, muted: boolean): Promise<TerminalMute>;
|
|
58
|
+
/**
|
|
59
|
+
* The conversations the caller muted, newest first (`GET /approvals/mutes`): each with its machine, its name now, since when and the
|
|
60
|
+
* `#<item>` that unmutes it (null when no item of it is left).
|
|
61
|
+
*/
|
|
62
|
+
mutedTerminals(key: ClawCredential): Promise<RemoteMutedConversation[]>;
|
|
58
63
|
/**
|
|
59
64
|
* How often (minutes; 0 never) a conversation of the caller's that keeps working in a terminal on its own is summed up
|
|
60
65
|
* (`GET /approvals`, `summary_minutes`; an hour unless they set otherwise).
|
|
@@ -327,6 +327,23 @@ export declare function parseTerminalMute(body: unknown): Parsed<{
|
|
|
327
327
|
item: number;
|
|
328
328
|
muted: boolean;
|
|
329
329
|
}>;
|
|
330
|
+
/**
|
|
331
|
+
* One conversation open in a terminal whose pushes its owner muted, as `GET /v1/remote-agents/approvals/mutes` lists them (newest
|
|
332
|
+
* mute first; `/approvals` says them).
|
|
333
|
+
*/
|
|
334
|
+
export interface RemoteMutedConversation {
|
|
335
|
+
/**
|
|
336
|
+
* The owner's latest work item of the conversation: the `#<item>` `/approvals unmute` and `PUT /v1/remote-agents/approvals/mutes`
|
|
337
|
+
* name it by. Null when no item of it is left to name it by.
|
|
338
|
+
*/
|
|
339
|
+
item: number | null;
|
|
340
|
+
/** Its machine's name; null when that machine is gone. */
|
|
341
|
+
machine: string | null;
|
|
342
|
+
/** The conversation's name now, as its machine lists it, else the title its item had when it was muted; null: it has none. */
|
|
343
|
+
title: string | null;
|
|
344
|
+
/** When it was muted (ISO 8601). */
|
|
345
|
+
muted_since: string;
|
|
346
|
+
}
|
|
330
347
|
/**
|
|
331
348
|
* Hiding conversations of a machine from its owner's lists (`POST /v1/remote-agents/connectors/:cid/hidden`), and the
|
|
332
349
|
* listing that leaves them out (`GET /v1/remote-agents/connectors`, `?hidden=include` to list them too). Nothing on the
|
|
@@ -3,8 +3,10 @@ import type { CommandHandler, CommandRoute } from "../ports/routing.js";
|
|
|
3
3
|
export declare class TerminalApprovalsCommand implements CommandHandler {
|
|
4
4
|
private readonly claw;
|
|
5
5
|
readonly name = "approvals";
|
|
6
|
-
constructor(claw: Pick<ClawRemoteAgentsPort, "approvals" | "setApprovals" | "muteTerminal" | "summary" | "setSummary">);
|
|
6
|
+
constructor(claw: Pick<ClawRemoteAgentsPort, "approvals" | "setApprovals" | "muteTerminal" | "mutedTerminals" | "summary" | "setSummary">);
|
|
7
7
|
run(route: CommandRoute, args: string): Promise<boolean>;
|
|
8
|
+
/** The whole state, as one message: the switch, how often a conversation that works on its own is summed up, the muted ones. */
|
|
9
|
+
private state;
|
|
8
10
|
private summary;
|
|
9
11
|
/** What to say when Claw refused or could not be reached; anything else is not this command's to answer. */
|
|
10
12
|
private refusal;
|