@primusclaw/personal-agent 0.12.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 +2326 -1710
- package/dist/types/assistant/actions.d.ts +8 -1
- package/dist/types/assistant/confirm-outcome.d.ts +5 -2
- package/dist/types/assistant/events.d.ts +34 -4
- package/dist/types/assistant/say.d.ts +5 -2
- package/dist/types/assistant/seat-dispatch-outcome.d.ts +8 -0
- package/dist/types/assistant/seat-outcome.d.ts +4 -0
- package/dist/types/assistant/views.d.ts +21 -0
- package/dist/types/claw/model.d.ts +10 -0
- package/dist/types/claw/work-item.d.ts +17 -1
- package/dist/types/commands/agent-args.d.ts +6 -0
- package/dist/types/commands/parse.d.ts +2 -1
- package/dist/types/language/chosen.d.ts +2 -1
- package/dist/types/locales/assistant-cards.d.ts +9 -0
- package/dist/types/locales/assistant-seats.d.ts +46 -0
- package/dist/types/locales/assistant-work-clicks.d.ts +5 -0
- package/dist/types/locales/index.d.ts +1 -0
- 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 +10 -1
- package/dist/types/locales/turn.d.ts +2 -0
- package/dist/types/ports/claw/assistant.d.ts +5 -2
- package/dist/types/ports/store/assistant.d.ts +13 -2
- package/dist/types/ports/store/remote.d.ts +5 -0
- package/dist/types/proactive/deliver.d.ts +5 -0
- package/dist/types/proactive/deps.d.ts +4 -0
- package/dist/types/proactive/quiet.d.ts +4 -1
- package/dist/types/protocol/claw-api/assistant-events.d.ts +44 -4
- package/dist/types/protocol/remote-agents.d.ts +57 -0
- package/dist/types/remote/board.d.ts +6 -0
- package/dist/types/remote/chat-key.d.ts +2 -0
- package/dist/types/remote/chats.d.ts +7 -6
- package/dist/types/remote/clicks-start.d.ts +1 -1
- package/dist/types/remote/context.d.ts +4 -1
- package/dist/types/remote/lines.d.ts +1 -1
- package/dist/types/remote/remote-agents.d.ts +1 -0
- package/dist/types/remote/state.d.ts +4 -1
- 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/permission-view.d.ts +4 -0
- package/dist/types/routing/chat.d.ts +11 -3
- package/dist/types/routing/features.d.ts +6 -0
- package/dist/types/routing/question-reply.d.ts +6 -1
- package/dist/types/routing/router.d.ts +6 -0
- package/dist/types/routing/turn-runner.d.ts +3 -2
- package/dist/types/routing/turn-start.d.ts +8 -13
- package/dist/types/turn/progress/status-message.d.ts +29 -1
- package/package.json +1 -1
|
@@ -70,6 +70,19 @@ export declare function connectorVersionStatus(version: string | null | undefine
|
|
|
70
70
|
export declare const REMOTE_EVENT_PERMISSION_REQUEST = "permissionRequest";
|
|
71
71
|
export declare const REMOTE_EVENT_PERMISSION_RESOLVED = "permission_resolved";
|
|
72
72
|
export declare const REMOTE_EVENT_SESSION_CLOSED = "session_closed";
|
|
73
|
+
/**
|
|
74
|
+
* A permission request of a turn sent with `park_permissions` outlived the connector's own wait (`permissionTtlMs`): instead of refusing
|
|
75
|
+
* it, the connector keeps it open until `parked_until` (at most {@link PERMISSION_PARK_MAX_MS} after it was asked), still answerable and
|
|
76
|
+
* cancellable as before. Data: `{actionId, cmd_seq, parked_until}` (`cmd_seq`: the prompt of the turn that asked, null when not known).
|
|
77
|
+
* When the park ends unanswered the connector refuses it and posts `permission_resolved` with `by: "park_expired"`.
|
|
78
|
+
*/
|
|
79
|
+
export declare const REMOTE_EVENT_PERMISSION_PARKED = "permission_parked";
|
|
80
|
+
/** The longest a connector keeps a parked permission request open (see {@link REMOTE_EVENT_PERMISSION_PARKED}). */
|
|
81
|
+
export declare const PERMISSION_PARK_MAX_MS: number;
|
|
82
|
+
/**
|
|
83
|
+
* `permissionRequest` and `permission_parked` carry `cmd_seq`: the prompt of the turn that asked (absent from connector 0.3.1 and
|
|
84
|
+
* older). `permission_resolved.by` is `park_expired` when a parked request's park ended unanswered.
|
|
85
|
+
*/
|
|
73
86
|
/**
|
|
74
87
|
* A turn of a conversation open in a terminal ended while nobody was at that terminal, posted on the conversation's terminal-hook
|
|
75
88
|
* session (`origin` "terminal_hook") by its connector: `{ref, outcome: "done" | "error", error?, message, agent, cwd, ended_at,
|
|
@@ -114,7 +127,51 @@ export interface RemoteHeartbeat {
|
|
|
114
127
|
cmdCursor: number | null;
|
|
115
128
|
/** What the connector holds that Claw has not acknowledged yet (`outbox` on the wire); absent from an older connector. */
|
|
116
129
|
outbox?: RemoteOutboxReport | null;
|
|
130
|
+
/**
|
|
131
|
+
* The git repository of each folder its sessions work in (`workspaces` on the wire, {@link parseWorkspacesReport}); absent (null)
|
|
132
|
+
* from a connector that does not report it, which is every connector before the agent capability `git_info`.
|
|
133
|
+
*/
|
|
134
|
+
workspaces?: RemoteWorkspace[] | null;
|
|
117
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* How much of the folders' git facts one heartbeat carries. A folder named by anyone, a remote and a branch named by whoever made the
|
|
138
|
+
* repository: each is cut to a shape that cannot carry more than a name, and the whole report is bounded.
|
|
139
|
+
*/
|
|
140
|
+
export declare const REMOTE_WORKSPACE_LIMITS: {
|
|
141
|
+
/** Folders one heartbeat reports, at most. */
|
|
142
|
+
readonly maxEntries: 32;
|
|
143
|
+
readonly maxCwdChars: 1024;
|
|
144
|
+
/** A remote as {@link normalizeGitRemote} writes it: `host/owner/repo`. */
|
|
145
|
+
readonly maxRemoteChars: 200;
|
|
146
|
+
readonly maxBranchChars: 100;
|
|
147
|
+
};
|
|
148
|
+
/** One folder's git facts: the remote its `origin` names and the branch checked out, each null when there is none or it is unreadable. */
|
|
149
|
+
export interface RemoteWorkspace {
|
|
150
|
+
cwd: string;
|
|
151
|
+
git_remote: string | null;
|
|
152
|
+
git_branch: string | null;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* A git remote as `host/owner/repo` (lower-case host, no scheme, no `.git`), or null when it is not a remote that can be written that
|
|
156
|
+
* way. Whatever names a person or carries a secret goes: the user (`git@`, `user:token@`), a query and a fragment; and a remote with a
|
|
157
|
+
* path segment shaped like a credential (`ghp_...`, a long opaque run) is no remote at all, never one with the secret cut out. A local
|
|
158
|
+
* path (`/srv/repo.git`, `file://`) is null: it names a folder on that machine, not a repository anyone else knows.
|
|
159
|
+
*/
|
|
160
|
+
export declare function normalizeGitRemote(raw: unknown): string | null;
|
|
161
|
+
/**
|
|
162
|
+
* A remote as a connector reports it: already `host/owner/repo` ({@link normalizeGitRemote} on the machine), checked to be exactly
|
|
163
|
+
* that shape again; else null. A URL (a connector that sent one raw) is normalized here the same way.
|
|
164
|
+
*/
|
|
165
|
+
export declare function normalizedRemote(raw: unknown): string | null;
|
|
166
|
+
/** A branch name as git allows it (and no more), or null: no `..`, no leading `-` or `/`, no control or space, at most 100 characters. */
|
|
167
|
+
export declare function normalizeGitBranch(raw: unknown): string | null;
|
|
168
|
+
/**
|
|
169
|
+
* The heartbeat's `workspaces`, or null when it is absent or not a list. Lenient, as the outbox report is: an entry that does not fit
|
|
170
|
+
* is left out, never a reason to refuse the heartbeat; a remote or a branch that does not normalize is null; at most
|
|
171
|
+
* {@link REMOTE_WORKSPACE_LIMITS.maxEntries} folders, each once. Normalized again here whatever the connector did: Claw never stores
|
|
172
|
+
* what it did not shape itself.
|
|
173
|
+
*/
|
|
174
|
+
export declare function parseWorkspacesReport(raw: unknown): RemoteWorkspace[] | null;
|
|
118
175
|
/** Sessions an outbox report names at most, the longest waiting first. */
|
|
119
176
|
export declare const REMOTE_OUTBOX_REPORT_MAX_SESSIONS = 20;
|
|
120
177
|
/** One session's part of an outbox report. */
|
|
@@ -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.
|
|
@@ -10,4 +10,6 @@ export declare const GROUP_KEY_SEP = "#";
|
|
|
10
10
|
export declare function groupChatKey(userId: string, conversationId: string): string;
|
|
11
11
|
/** The person a chat key belongs to: the key itself for a 1:1 chat, the binder for a group's. */
|
|
12
12
|
export declare function personOf(chatKey: string): string;
|
|
13
|
+
/** The group conversation a chat key binds ("" for a 1:1 chat's). */
|
|
14
|
+
export declare function groupConversationOf(chatKey: string): string;
|
|
13
15
|
export declare function isGroupKey(chatKey: string): boolean;
|
|
@@ -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;
|
|
@@ -7,6 +7,7 @@ import type { PublicErrors } from "../public-error/public-errors.js";
|
|
|
7
7
|
import type { Clock } from "../ports/clock.js";
|
|
8
8
|
import type { Logger } from "../ports/logger.js";
|
|
9
9
|
import type { Random } from "../ports/random.js";
|
|
10
|
+
import type { GroupLanguageRepository } from "../ports/store/group-language.js";
|
|
10
11
|
import type { ConversationRefRepository, PrefsRepository } from "../ports/store/people.js";
|
|
11
12
|
import type { RemotePermissionRepository, RemoteSessionNameRepository, RemoteStateRepository } from "../ports/store/remote.js";
|
|
12
13
|
import type { Conversation } from "../ports/surface.js";
|
|
@@ -69,6 +70,8 @@ export interface RemoteContext {
|
|
|
69
70
|
readonly sessionNames: RemoteSessionNameRepository;
|
|
70
71
|
readonly permissions: RemotePermissionRepository;
|
|
71
72
|
readonly prefs: PrefsRepository;
|
|
73
|
+
/** The language each group chat's members set (none given: a group binding's texts are English). */
|
|
74
|
+
readonly groupLanguage?: GroupLanguageRepository;
|
|
72
75
|
readonly references: ConversationRefRepository;
|
|
73
76
|
/** The conversation a stored reference posts to. */
|
|
74
77
|
conversationFor(reference: JsonObject): Conversation;
|
|
@@ -89,7 +92,7 @@ export interface RemoteContext {
|
|
|
89
92
|
readonly logger: Logger;
|
|
90
93
|
/** The hex digest of `text` (UTF-8): an idempotency key, a correlation id. */
|
|
91
94
|
digestHex(algorithm: "sha1" | "sha256", text: string): string;
|
|
92
|
-
/** The language a person is answered in. */
|
|
95
|
+
/** The language a person is answered in (their 1:1 chat's; a group binding's is the group's, `ChatState.lang`). */
|
|
93
96
|
langOf(person: string): Lang;
|
|
94
97
|
/** PA_DIRECT_CHAT: whose 1:1 chat is the agent's window itself. */
|
|
95
98
|
readonly directChat: DirectChat;
|
|
@@ -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>;
|
|
@@ -12,7 +12,10 @@ export declare class ChatState {
|
|
|
12
12
|
private readonly views;
|
|
13
13
|
constructor(ctx: RemoteContext, chats: ChatRegistry);
|
|
14
14
|
attached(chatKey: string): RemoteState | null;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* The language the chat is answered in ("en" when it cannot be read): a 1:1 chat's is its person's; a group binding's is the
|
|
17
|
+
* group's, the one its members set (`/lang zh|en`, `groupLangOf`), else English, never the binder's own.
|
|
18
|
+
*/
|
|
16
19
|
lang(chatKey: string): Lang;
|
|
17
20
|
/** PA_DIRECT_CHAT is on for this 1:1 chat's person (a group binding keeps its session card). */
|
|
18
21
|
directOn(chatKey: string): boolean;
|
|
@@ -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
|
/**
|
|
@@ -41,6 +41,10 @@ export interface RemoteAsk {
|
|
|
41
41
|
readonly agent: string;
|
|
42
42
|
/** Which errand: `#seq title`. */
|
|
43
43
|
readonly about: string;
|
|
44
|
+
/** The name the person gave the seat the errand went to (absent: none): the card's title names it. */
|
|
45
|
+
readonly seat?: string | undefined;
|
|
46
|
+
/** The one reminder of a request the agent keeps waiting on: the card says it still waits, until when. */
|
|
47
|
+
readonly parked?: boolean | undefined;
|
|
44
48
|
readonly expiresAt: number;
|
|
45
49
|
readonly zone: string;
|
|
46
50
|
}
|
|
@@ -22,10 +22,11 @@ export declare function helpLang(store: Pick<RouterStore, "prefs">, userId: stri
|
|
|
22
22
|
/**
|
|
23
23
|
* The language a group chat is answered in, its fixed texts and its answers alike: the one its members set (`/lang zh|en` there,
|
|
24
24
|
* or a pick on its language card); else (none set, or "follow the asker") the language of the message being answered (`written`).
|
|
25
|
-
* A
|
|
26
|
-
* language
|
|
25
|
+
* A message that says no language of its own ("help", "/new", a link) is answered in English: a group's members share no other
|
|
26
|
+
* language, so neither the sender's own (`/lang` in their 1:1 chat, or the one their messages were last written in) nor their
|
|
27
|
+
* client's locale is read here.
|
|
27
28
|
*/
|
|
28
|
-
export declare function groupLangOf(store:
|
|
29
|
+
export declare function groupLangOf(store: Partial<Pick<RouterStore, "groupLanguage">>, conversationId: string, written: string): Lang;
|
|
29
30
|
/** The language a group chat's members set, when it is one (`/lang zh|en`); undefined for none, and for "follow the asker". */
|
|
30
31
|
export declare function groupChosenLang(store: Partial<Pick<RouterStore, "groupLanguage">>, conversationId: string): Lang | undefined;
|
|
31
32
|
/** One chat as the router answers in it: who wrote, where to answer, and in which language. */
|
|
@@ -52,7 +53,14 @@ export declare class Chat {
|
|
|
52
53
|
say(text: string): Promise<void>;
|
|
53
54
|
sayRich(markdown: string): Promise<void>;
|
|
54
55
|
send(message: OutMessage): Promise<void>;
|
|
56
|
+
/** The same chat, said into through `conversation`. */
|
|
57
|
+
through(conversation: Conversation): Chat;
|
|
55
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;
|
|
56
64
|
/**
|
|
57
65
|
* THE way a click ends (the Python `Agent._close_card`): the clicked card is replaced, by `card` or by a note saying it,
|
|
58
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 {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Chat } from "./chat.js";
|
|
2
2
|
import type { RouterContext } from "./context.js";
|
|
3
3
|
/**
|
|
4
4
|
* A question with less than this left of its wait is not answered from a typed message: Brain may already have stopped
|
|
@@ -10,6 +10,11 @@ export declare const TYPED_ANSWER_MARGIN_SECONDS = 15;
|
|
|
10
10
|
export interface TypedReply {
|
|
11
11
|
readonly chat: Chat;
|
|
12
12
|
readonly text: string;
|
|
13
|
+
/**
|
|
14
|
+
* What the message forwards, as text for the model ("" none), read once there is a question to answer: it goes to Claw with
|
|
15
|
+
* the answer, since no other message carries it (the card shows only the words).
|
|
16
|
+
*/
|
|
17
|
+
readonly forward?: () => string;
|
|
13
18
|
/** The Claw credential of the person, read when there is a question to answer. */
|
|
14
19
|
readonly credential: () => Promise<string>;
|
|
15
20
|
}
|
|
@@ -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;
|
|
@@ -45,8 +45,9 @@ export interface TurnRun {
|
|
|
45
45
|
readonly lang: Lang;
|
|
46
46
|
/**
|
|
47
47
|
* The language the turn is to be answered in, told to Claw after the message: in a 1:1 chat the one the person chose (`/lang
|
|
48
|
-
* zh|en`, `chosenLang`), in a group the group's (`groupChosenLang`), or with none the
|
|
49
|
-
*
|
|
48
|
+
* zh|en`, `chosenLang`), in a group the group's (`groupChosenLang`), or with none the language of the message's own words
|
|
49
|
+
* (`writtenLang`), else English; undefined (a 1:1 chat with none chosen): the answer is in the language of what they wrote.
|
|
50
|
+
* A chat turn's only: a review's follows its request.
|
|
50
51
|
*/
|
|
51
52
|
readonly replyLang?: Lang;
|
|
52
53
|
/** The answer gets thumbs of the worker's own (a phone, whose own thumbs never reach the worker). */
|
|
@@ -51,6 +51,11 @@ export interface StartTurn {
|
|
|
51
51
|
readonly messageId: string;
|
|
52
52
|
readonly clientPlatform: string;
|
|
53
53
|
readonly quote?: string;
|
|
54
|
+
/**
|
|
55
|
+
* What it forwards, alone, as text for the model ("": nothing): part of `quote` (beside what it quotes and, in a group, the
|
|
56
|
+
* chat's recent messages), and what goes with the words when they answer a waiting question. Read only then.
|
|
57
|
+
*/
|
|
58
|
+
readonly forward?: () => string;
|
|
54
59
|
readonly sent?: string;
|
|
55
60
|
readonly files?: readonly InboundFile[];
|
|
56
61
|
readonly review?: ReviewTurnStart;
|
|
@@ -69,7 +74,6 @@ export interface StartTurn {
|
|
|
69
74
|
export declare class TurnStarter {
|
|
70
75
|
private readonly ctx;
|
|
71
76
|
private readonly running;
|
|
72
|
-
private readonly askers;
|
|
73
77
|
constructor(ctx: RouterContext);
|
|
74
78
|
/** The turns that run now (a test waits for them). */
|
|
75
79
|
settled(): Promise<void>;
|
|
@@ -102,9 +106,9 @@ export declare class TurnStarter {
|
|
|
102
106
|
/**
|
|
103
107
|
* The language a chat turn is to be answered in (a review's answer follows its request's language). In a 1:1 chat the one the
|
|
104
108
|
* person chose, if any. In a group the group's (`groupChosenLang`; the sender's own choice is not read there); with none set, or
|
|
105
|
-
* "follow the asker", the language of the @-message's own words (`writtenLang`), else
|
|
106
|
-
*
|
|
107
|
-
* the model answers in the language of that history, not the asker's.
|
|
109
|
+
* "follow the asker", the language of the @-message's own words (`writtenLang`), else English, as the group's fixed texts are
|
|
110
|
+
* (`groupLangOf`): a message with no words of its own (`help`, `ok #3`, a link) is answered in English. A group's shared
|
|
111
|
+
* session holds every member's turns, and without the line the model answers in the language of that history, not the asker's.
|
|
108
112
|
*/
|
|
109
113
|
private replyLang;
|
|
110
114
|
private hooks;
|
|
@@ -116,12 +120,3 @@ export declare class TurnStarter {
|
|
|
116
120
|
*/
|
|
117
121
|
private recordSession;
|
|
118
122
|
}
|
|
119
|
-
/**
|
|
120
|
-
* The language each member of a group last asked in there, for a message with no words of its own (`ok`, `#3`, a link): kept in
|
|
121
|
-
* memory, per group and member, the newest `ASKERS_MAX`. After a restart such a message gets no language until its sender writes one.
|
|
122
|
-
*/
|
|
123
|
-
export declare class AskerLanguages {
|
|
124
|
-
private readonly last;
|
|
125
|
-
/** The language of `text` when it has words (and it is remembered), else the one remembered for `userId` in `scope`. */
|
|
126
|
-
answer(scope: string, userId: string, text: string): Lang | undefined;
|
|
127
|
-
}
|
|
@@ -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
|
/**
|