@primusclaw/personal-agent 0.13.0 → 0.15.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 +484 -83
- package/dist/types/assistant/events.d.ts +28 -0
- 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/terminal-approvals.d.ts +29 -0
- package/dist/types/locales/turn.d.ts +2 -0
- package/dist/types/ports/claw/remote-agents.d.ts +7 -0
- package/dist/types/proactive/deliver.d.ts +5 -0
- package/dist/types/protocol/claw-api/assistant-events.d.ts +40 -0
- package/dist/types/protocol/remote-agents.d.ts +28 -1
- package/dist/types/remote/approvals-command.d.ts +4 -1
- 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/remote-view/index.d.ts +3 -0
- package/dist/types/remote-view/terminal-ask-view.d.ts +2 -0
- package/dist/types/remote-view/terminal-end-view.d.ts +44 -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
|
@@ -128,6 +128,34 @@ export interface RemoteNotice {
|
|
|
128
128
|
* request whose card may be in the chat already.
|
|
129
129
|
*/
|
|
130
130
|
readonly parked?: boolean;
|
|
131
|
+
/** A turn of a conversation open in a terminal that ended while nobody was at it (`remote.end`, with `kind` done or error). */
|
|
132
|
+
readonly end?: TerminalEnd;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* A terminal's turn that ended while nobody was at that terminal, as Claw describes it for a card (`remote.end`). Every string is the
|
|
136
|
+
* agent's or its machine's: shown as inert text, never followed.
|
|
137
|
+
*/
|
|
138
|
+
export interface TerminalEnd {
|
|
139
|
+
readonly itemSeq: number;
|
|
140
|
+
readonly name: string;
|
|
141
|
+
readonly folder: string;
|
|
142
|
+
/** Why it stopped ("" for a turn that finished). */
|
|
143
|
+
readonly error: string;
|
|
144
|
+
readonly summary: string;
|
|
145
|
+
readonly full: string;
|
|
146
|
+
readonly more: boolean;
|
|
147
|
+
/** `/agent attach <ref>` for the conversation, as Claw wrote it ("" when its connector does not list it). */
|
|
148
|
+
readonly attach: string;
|
|
149
|
+
/**
|
|
150
|
+
* Earlier turns folded into this end that asked the person something or failed, said before `summary` (the latest turn's): that
|
|
151
|
+
* turn's words ("" when Claw no longer has them) and how many did. Empty when none did.
|
|
152
|
+
*/
|
|
153
|
+
readonly earlier: readonly TerminalEarlier[];
|
|
154
|
+
}
|
|
155
|
+
export interface TerminalEarlier {
|
|
156
|
+
readonly kind: "asked" | "failed";
|
|
157
|
+
readonly text: string;
|
|
158
|
+
readonly count: number;
|
|
131
159
|
}
|
|
132
160
|
/** What an `assistant.say` says of an agent session on the person's machine, or undefined for any other message. */
|
|
133
161
|
export declare function remoteNoticeOf(event: Event): RemoteNotice | undefined;
|
|
@@ -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;
|
|
@@ -59,5 +59,34 @@ export declare const terminalApprovalText: import("./catalog.js").Catalog<{
|
|
|
59
59
|
muteNotTerminal: (p: {
|
|
60
60
|
item: string;
|
|
61
61
|
}) => string;
|
|
62
|
+
endDone: string;
|
|
63
|
+
endError: (p: {
|
|
64
|
+
error: string;
|
|
65
|
+
}) => string;
|
|
66
|
+
endIdle: string;
|
|
67
|
+
endFull: string;
|
|
68
|
+
endRest: string;
|
|
69
|
+
endAttach: string;
|
|
70
|
+
endMute: string;
|
|
71
|
+
endEarlierAsked: (p: {
|
|
72
|
+
text: string;
|
|
73
|
+
count: number;
|
|
74
|
+
}) => string;
|
|
75
|
+
endEarlierFailed: (p: {
|
|
76
|
+
text: string;
|
|
77
|
+
count: number;
|
|
78
|
+
}) => string;
|
|
79
|
+
endLatest: (p: {
|
|
80
|
+
text: string;
|
|
81
|
+
}) => string;
|
|
62
82
|
approvalsUnavailable: string;
|
|
83
|
+
summaryEvery: (p: {
|
|
84
|
+
minutes: string;
|
|
85
|
+
}) => string;
|
|
86
|
+
summaryNever: string;
|
|
87
|
+
summarySet: (p: {
|
|
88
|
+
minutes: string;
|
|
89
|
+
}) => string;
|
|
90
|
+
summaryOff: string;
|
|
91
|
+
summaryUsage: string;
|
|
63
92
|
}>;
|
|
@@ -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;
|
|
@@ -55,6 +55,13 @@ 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
|
+
* How often (minutes; 0 never) a conversation of the caller's that keeps working in a terminal on its own is summed up
|
|
60
|
+
* (`GET /approvals`, `summary_minutes`; an hour unless they set otherwise).
|
|
61
|
+
*/
|
|
62
|
+
summary(key: ClawCredential): Promise<number>;
|
|
63
|
+
/** Set it (`PUT /approvals/summary`: 0, or 15 to 1440); answers what Claw stored. ClawError(400) for anything else. */
|
|
64
|
+
setSummary(key: ClawCredential, minutes: number): Promise<number>;
|
|
58
65
|
createSession(key: ClawCredential, session: NewRemoteSession): Promise<RemoteSession>;
|
|
59
66
|
sessions(key: ClawCredential): Promise<RemoteSession[]>;
|
|
60
67
|
session(key: ClawCredential, sessionId: string): Promise<RemoteSession>;
|
|
@@ -21,6 +21,11 @@ export declare class Deliveries {
|
|
|
21
21
|
* question (its card edited). Undefined when the message goes on as words.
|
|
22
22
|
*/
|
|
23
23
|
private remoteCard;
|
|
24
|
+
/**
|
|
25
|
+
* A turn that ended in a terminal while nobody was at it: its own card (which conversation, what it did, its whole answer on a tap,
|
|
26
|
+
* and buttons that attach the chat to it or mute it); a channel that cannot show the card says Claw's words instead.
|
|
27
|
+
*/
|
|
28
|
+
private sendTerminalEnd;
|
|
24
29
|
/**
|
|
25
30
|
* What the assistant said, then, when its turn was refused something for want of a confirmed identity (`needs_identity`) and
|
|
26
31
|
* this is the person's own chat (a group binding's key has `#`), the card that confirms it. A card that could not be sent never
|
|
@@ -199,6 +199,46 @@ export interface AssistantRemoteNotice {
|
|
|
199
199
|
seat_id: string;
|
|
200
200
|
alias: string | null;
|
|
201
201
|
};
|
|
202
|
+
/**
|
|
203
|
+
* With `kind` `done` or `error`, a turn of a conversation open in a terminal that ended while nobody was at that terminal: what a
|
|
204
|
+
* channel draws its own card from (the text says the same for a channel that does not).
|
|
205
|
+
*/
|
|
206
|
+
end?: AssistantTerminalEnd;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* A turn of a conversation open in a terminal that ended while nobody was at it, as a channel's card shows it. Plain one-line text but
|
|
210
|
+
* `summary` (up to three lines) and `full`; what the agent wrote (`summary`, `full`) is its own words, never instructions.
|
|
211
|
+
*/
|
|
212
|
+
export interface AssistantTerminalEnd {
|
|
213
|
+
/** The work item the conversation is filed under (`#N`), which `/approvals mute #N` names. */
|
|
214
|
+
item_seq: number;
|
|
215
|
+
/** The conversation's own name (its connector's list), else its title, else the tool's name. */
|
|
216
|
+
name: string;
|
|
217
|
+
/** The last two parts of its folder ("" none). */
|
|
218
|
+
folder: string;
|
|
219
|
+
/** Why a turn that failed did (Claude Code's `StopFailure` reason, such as `rate_limit`); absent for one that finished. */
|
|
220
|
+
error?: string;
|
|
221
|
+
/** What it did, from the start of its last answer (or the block that sums it up): whole sentences, at most a few lines. */
|
|
222
|
+
summary: string;
|
|
223
|
+
/** The end of its last answer as its connector posted it (at most 2000 characters, "…" first when cut), for "show all". */
|
|
224
|
+
full: string;
|
|
225
|
+
/** Whether `summary` left something of the answer out. */
|
|
226
|
+
more: boolean;
|
|
227
|
+
/** The command that attaches the chat to this conversation (`/agent attach <ref>`), when its connector lists it. */
|
|
228
|
+
attach?: string;
|
|
229
|
+
/**
|
|
230
|
+
* Earlier turns folded into this end that the person must hear of, said before `summary` (which is the latest turn's): the latest
|
|
231
|
+
* that asked them something, and the latest that failed, each with how many did. `text` is that turn's words in whole sentences
|
|
232
|
+
* (untrusted), "" when its connector no longer carries them (the terminal has them). Absent when no earlier turn asked or failed.
|
|
233
|
+
*/
|
|
234
|
+
earlier?: AssistantTerminalEarlier[];
|
|
235
|
+
}
|
|
236
|
+
/** An earlier turn folded into a terminal's end that asked the person something (`asked`) or failed (`failed`). */
|
|
237
|
+
export interface AssistantTerminalEarlier {
|
|
238
|
+
kind: "asked" | "failed";
|
|
239
|
+
text: string;
|
|
240
|
+
/** How many earlier turns of the run did (at least 1). */
|
|
241
|
+
count: number;
|
|
202
242
|
}
|
|
203
243
|
/** A permission request a development environment's agent waits on (`permissionRequest`), as its connector posted it. */
|
|
204
244
|
export interface AssistantRemoteAsk {
|
|
@@ -89,7 +89,13 @@ export declare const PERMISSION_PARK_MAX_MS: number;
|
|
|
89
89
|
* away_ms}`. `message` is the end of what the agent last said (untrusted text); `error` names why a turn that failed did
|
|
90
90
|
* (Claude Code's `StopFailure` reason, such as `rate_limit`). The connector posts it only once the terminal has had no input for a
|
|
91
91
|
* minute after the turn ended, and never while a chat follows the conversation; Claw tells the owner, unless they turned the
|
|
92
|
-
* terminal pushes off or muted that conversation.
|
|
92
|
+
* terminal pushes off or muted that conversation. From connector 0.3.4 it also says who started the turn, as Claude Code's transcript
|
|
93
|
+
* records it (`origin`: "person" or "automation"; absent when that is not known), and an end that stands for a run of turns nobody
|
|
94
|
+
* typed carries `turns` (how many), `earlier` (the earlier ones' last words, oldest first, at most five), `since` (ISO time of the
|
|
95
|
+
* first), `failed_earlier` and `asked_earlier` (how many of the earlier ones failed, or asked the person something, when any did),
|
|
96
|
+
* and `earlier_failed` (the positions in `earlier` of the words of turns that failed, when any are carried). Claw pushes at once only
|
|
97
|
+
* a person's turn, one that asks the person something, or one that failed (in any turn of the run: the push then leads with that
|
|
98
|
+
* earlier question or failure); it sums up the others.
|
|
93
99
|
*/
|
|
94
100
|
export declare const REMOTE_EVENT_TERMINAL_TURN_END = "terminal_turn_end";
|
|
95
101
|
/**
|
|
@@ -295,6 +301,27 @@ export declare function parseTerminalSessionOpen(body: unknown): Parsed<RemoteTe
|
|
|
295
301
|
export declare function parseApprovalsSetting(body: unknown): Parsed<{
|
|
296
302
|
enabled: boolean;
|
|
297
303
|
}>;
|
|
304
|
+
/**
|
|
305
|
+
* Whether what the agent last said asks the person something or waits for their decision: its last paragraph ends in a question, or
|
|
306
|
+
* says in so many words that it waits for them (a choice, an approval, a confirmation), in Chinese or English. Deterministic and narrow
|
|
307
|
+
* on purpose: only the end of the answer is read (where an answer that needs the person says so); a question quoted earlier in a report
|
|
308
|
+
* does not count. Shared: the connector counts the questions of the ends it folds into one, and Claw decides what to push with it.
|
|
309
|
+
*/
|
|
310
|
+
export declare function turnAsksPerson(message: string): boolean;
|
|
311
|
+
/**
|
|
312
|
+
* The summary of a conversation open in a terminal that keeps working on its own (turns another session or a schedule started):
|
|
313
|
+
* at most one every `minutes` per conversation, of what it did since the last one. `0` turns the summaries off. Each owner sets theirs
|
|
314
|
+
* (`PUT /v1/remote-agents/approvals/summary`, `/approvals summary <minutes>|off`); no setting: every hour.
|
|
315
|
+
*/
|
|
316
|
+
export declare const TERMINAL_SUMMARY: {
|
|
317
|
+
readonly defaultMinutes: 60;
|
|
318
|
+
readonly minMinutes: 15;
|
|
319
|
+
readonly maxMinutes: number;
|
|
320
|
+
};
|
|
321
|
+
/** `PUT /v1/remote-agents/approvals/summary`: how often (minutes) such a summary may come, or 0 for never. */
|
|
322
|
+
export declare function parseTerminalSummarySetting(body: unknown): Parsed<{
|
|
323
|
+
minutes: number;
|
|
324
|
+
}>;
|
|
298
325
|
/** `PUT /v1/remote-agents/approvals/mutes`: mute (or unmute) the conversation behind work item `#item`, one open in a terminal. */
|
|
299
326
|
export declare function parseTerminalMute(body: unknown): Parsed<{
|
|
300
327
|
item: number;
|
|
@@ -3,7 +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">);
|
|
6
|
+
constructor(claw: Pick<ClawRemoteAgentsPort, "approvals" | "setApprovals" | "muteTerminal" | "summary" | "setSummary">);
|
|
7
7
|
run(route: CommandRoute, args: string): Promise<boolean>;
|
|
8
|
+
private summary;
|
|
9
|
+
/** What to say when Claw refused or could not be reached; anything else is not this command's to answer. */
|
|
10
|
+
private refusal;
|
|
8
11
|
private mute;
|
|
9
12
|
}
|
|
@@ -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
|
/**
|
|
@@ -9,6 +9,7 @@ import type { DecidedView, PermissionView, RemoteAskView } from "./permission-vi
|
|
|
9
9
|
import type { SessionsView } from "./sessions-view.js";
|
|
10
10
|
import type { StatusView } from "./status-view.js";
|
|
11
11
|
import type { TerminalAskView } from "./terminal-ask-view.js";
|
|
12
|
+
import type { TerminalEndView } from "./terminal-end-view.js";
|
|
12
13
|
import type { HiddenView } from "./hidden-view.js";
|
|
13
14
|
import type { WindowCardView } from "./window-view.js";
|
|
14
15
|
export * from "./agents-view.js";
|
|
@@ -20,6 +21,7 @@ export * from "./permission-view.js";
|
|
|
20
21
|
export * from "./sessions-view.js";
|
|
21
22
|
export * from "./status-view.js";
|
|
22
23
|
export * from "./terminal-ask-view.js";
|
|
24
|
+
export * from "./terminal-end-view.js";
|
|
23
25
|
export * from "./window-view.js";
|
|
24
26
|
export { remoteHealthText, remoteOffText, remoteQueuedText, remoteStopText, remoteText } from "../locales/remote.js";
|
|
25
27
|
export { remoteWindowCardText } from "../locales/remote-window-card.js";
|
|
@@ -31,6 +33,7 @@ declare module "../ports/surface.js" {
|
|
|
31
33
|
remotePermission: PermissionView;
|
|
32
34
|
remoteAsk: RemoteAskView;
|
|
33
35
|
terminalAsk: TerminalAskView;
|
|
36
|
+
terminalEnd: TerminalEndView;
|
|
34
37
|
remoteDecided: DecidedView;
|
|
35
38
|
remoteDisconnect: DisconnectView;
|
|
36
39
|
remoteTakeover: TakeoverView;
|
|
@@ -74,5 +74,7 @@ export interface TerminalAsk {
|
|
|
74
74
|
export declare function terminalAsksOf(ask: Reported): TerminalAsks | undefined;
|
|
75
75
|
/** Whether `remote.ask` is a question a terminal asks (a connector's approval hooks), not one an agent Claw started asks. */
|
|
76
76
|
export declare function isTerminalAsk(ask: Reported | undefined): boolean;
|
|
77
|
+
/** Text whose markdown (lists, bold) is kept, but no link can be built from it (`](` gets a zero-width space inside). */
|
|
78
|
+
export declare const wordsText: (v: string) => string;
|
|
77
79
|
/** The card of a question a terminal asks. */
|
|
78
80
|
export declare function terminalAskView(input: TerminalAsk, lang?: Lang): TerminalAskView;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The card of a turn that ended in a terminal while nobody was at it (Claw's `remote.end`, `kind` done or error): which conversation,
|
|
3
|
+
* at a glance (its name and its status in the title; the tool, the machine, the folder, that the terminal sat idle and the item number
|
|
4
|
+
* in one small line under it), what the agent did in a few lines, its last answer whole behind "Show all", and buttons that send the
|
|
5
|
+
* commands for it as the person's own message: attach the chat to that conversation (`/agent attach <ref>`, when Claw offers it) and
|
|
6
|
+
* mute it (`/approvals mute #N`). Everything the agent or its machine wrote is inert text.
|
|
7
|
+
*/
|
|
8
|
+
import type { TerminalEnd } from "../assistant/events.js";
|
|
9
|
+
import type { Lang } from "../locales/lang.js";
|
|
10
|
+
/** A button that sends `command` as if the person typed it (Teams: an imBack). */
|
|
11
|
+
export interface CommandButton {
|
|
12
|
+
readonly title: string;
|
|
13
|
+
readonly command: string;
|
|
14
|
+
}
|
|
15
|
+
export interface TerminalEndView {
|
|
16
|
+
readonly lang: Lang;
|
|
17
|
+
/** The conversation's name and its status: "ops 做完了". */
|
|
18
|
+
readonly title: string;
|
|
19
|
+
readonly failed: boolean;
|
|
20
|
+
/** The tool, the machine, the folder, the terminal idle and the item, in one small line. */
|
|
21
|
+
readonly where: string;
|
|
22
|
+
/**
|
|
23
|
+
* Earlier turns folded into this end that asked the person something or failed, one line each, said before `summary` (markup
|
|
24
|
+
* escaped, links broken); empty when none did.
|
|
25
|
+
*/
|
|
26
|
+
readonly earlier: readonly string[];
|
|
27
|
+
/** What it did (markup escaped, links broken), "Latest turn:" first when `earlier` says something; "" when it said nothing. */
|
|
28
|
+
readonly summary: string;
|
|
29
|
+
/** Its last answer whole (markdown kept, links broken), shown on "Show all"; "" when the summary is all of it. */
|
|
30
|
+
readonly full: string;
|
|
31
|
+
readonly fullLabel: string;
|
|
32
|
+
/** "The rest is in the terminal." when something was left out and there is no whole answer to show; else "". */
|
|
33
|
+
readonly rest: string;
|
|
34
|
+
readonly buttons: readonly CommandButton[];
|
|
35
|
+
}
|
|
36
|
+
export interface TerminalEndInput {
|
|
37
|
+
readonly end: TerminalEnd;
|
|
38
|
+
readonly machine: string;
|
|
39
|
+
/** The tool's name as people know it (Claude Code, Codex), or the agent's id. */
|
|
40
|
+
readonly agent: string;
|
|
41
|
+
readonly lang: Lang;
|
|
42
|
+
}
|
|
43
|
+
/** The view of one turn's end, as Claw described it. */
|
|
44
|
+
export declare function terminalEndView(input: TerminalEndInput): TerminalEndView;
|
|
@@ -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
|
/**
|