@primusclaw/personal-agent 0.10.3 → 0.11.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.
Files changed (33) hide show
  1. package/dist/index.js +872 -105
  2. package/dist/types/assistant/confirm-outcome.d.ts +7 -0
  3. package/dist/types/assistant/events.d.ts +1 -1
  4. package/dist/types/assistant/views.d.ts +2 -0
  5. package/dist/types/claw/model.d.ts +1 -1
  6. package/dist/types/locales/assistant-actions.d.ts +7 -0
  7. package/dist/types/locales/assistant-cards.d.ts +1 -0
  8. package/dist/types/locales/remote-leads.d.ts +2 -0
  9. package/dist/types/locales/remote.d.ts +5 -0
  10. package/dist/types/locales/review-onboarding.d.ts +48 -0
  11. package/dist/types/locales/review-start.d.ts +0 -2
  12. package/dist/types/ports/store/github.d.ts +58 -2
  13. package/dist/types/ports/store/policy.d.ts +2 -0
  14. package/dist/types/protocol/claw-api/assistant-events.d.ts +11 -2
  15. package/dist/types/protocol/claw-api/reviews.d.ts +5 -1
  16. package/dist/types/protocol/remote-agents.d.ts +36 -0
  17. package/dist/types/remote/chats.d.ts +4 -0
  18. package/dist/types/remote/connector/reasons.d.ts +6 -0
  19. package/dist/types/remote/events.d.ts +8 -0
  20. package/dist/types/remote/lines.d.ts +10 -0
  21. package/dist/types/remote/turns/display.d.ts +5 -0
  22. package/dist/types/remote/turns/runner.d.ts +15 -0
  23. package/dist/types/remote/turns/window-turn.d.ts +2 -0
  24. package/dist/types/review/index.d.ts +1 -0
  25. package/dist/types/review/refusals.d.ts +5 -3
  26. package/dist/types/review/service/account.d.ts +5 -0
  27. package/dist/types/review/service/context.d.ts +12 -0
  28. package/dist/types/review/service/github-review.d.ts +3 -0
  29. package/dist/types/review/service/notices.d.ts +7 -0
  30. package/dist/types/review/service/onboarding.d.ts +85 -0
  31. package/dist/types/review/service/start.d.ts +9 -13
  32. package/dist/types/turn/progress/status-message.d.ts +15 -4
  33. package/package.json +1 -1
@@ -8,6 +8,13 @@ export declare function commentOutcome(out: Fields, lang: Lang): string | undefi
8
8
  export declare function devenvSendOutcome(status: string, out: Fields, lang: Lang): string;
9
9
  /** What came of Save or Discard on a drafted skill's card: saved (which version), discarded, or why not. */
10
10
  export declare function skillSaveOutcome(status: string, out: Fields, lang: Lang): string;
11
+ /** A merge or an approval a review holds (`github_merge`, `github_review`). */
12
+ export declare function isGithubWrite(kind: string): boolean;
13
+ /**
14
+ * What came of a press on a merge's or an approval's card: Claw's answer to the review's own decision
15
+ * (`POST /v1/github-review/confirmations/:id/decision`: `merged`, `queued`, `submitted`, `denied`, `stale`, `expired`, `refused`, `retry`).
16
+ */
17
+ export declare function githubWriteOutcome(kind: string, out: Fields, lang: Lang): string;
11
18
  /** What came of a press on a held write's card of `kind`, in one line: Claw's answer said plainly. */
12
19
  export declare function confirmOutcome(kind: string, out: Fields, lang: Lang): string;
13
20
  export {};
@@ -13,7 +13,7 @@ export declare const SUGGESTED_REPLY_MAX = 30;
13
13
  /** The suggested replies kept under a message when the channel's own limit is not given (`SurfaceCaps.suggestionsMax`). */
14
14
  export declare const SUGGESTIONS_MAX = 3;
15
15
  /** The writes Claw holds for the person that this worker draws as a card. */
16
- export declare const CONFIRM_KINDS: readonly ["trigger_create", "trigger_cancel", "devenv_send", "github_comment", "devenv_hide", "skill_save"];
16
+ export declare const CONFIRM_KINDS: readonly ["trigger_create", "trigger_cancel", "devenv_send", "github_comment", "devenv_hide", "skill_save", "github_merge", "github_review"];
17
17
  /** The default replies under what the assistant said: (what the button says, what it sends). */
18
18
  export declare const ASSISTANT_SUGGESTED_REPLIES: Readonly<Record<Lang, readonly SuggestedReply[]>>;
19
19
  type Event = Readonly<Record<string, unknown>>;
@@ -66,6 +66,8 @@ export interface ConfirmWriteModel {
66
66
  readonly cardId: string;
67
67
  /** Claw's word for letting it through ("" for "Confirm"). */
68
68
  readonly allowLabel: string;
69
+ /** What is held (`github_merge`, `trigger_create`, ...): a merge's other button says "Don't merge". Absent: "Don't". */
70
+ readonly kind?: string;
69
71
  readonly lang: string;
70
72
  }
71
73
  /** A choice the assistant put to the person: its options as radio buttons (or check boxes) and Send. */
@@ -92,7 +92,7 @@ export interface ReviewStart {
92
92
  readonly mergeNeedsConfirmation: boolean | null;
93
93
  /** The item limit that was full when Claw queued it ("" it started). */
94
94
  readonly queued: string;
95
- /** Claw merges it with the asker's own account once approved and green. */
95
+ /** The reviewer's account merges it; when the reviewer cannot merge, Claw asks the asker whether their own account merges it. */
96
96
  readonly mergeByRequester: boolean;
97
97
  }
98
98
  /** Which GitHub token Claw's GitHub tools use for the token's own user now (never the token). */
@@ -45,6 +45,13 @@ export declare const assistantActionText: import("./catalog.js").Catalog<{
45
45
  notSentWhy: (p: {
46
46
  why: string;
47
47
  }) => string;
48
+ githubMerged: string;
49
+ githubQueued: string;
50
+ githubApproved: string;
51
+ githubNotMerged: string;
52
+ githubNotApproved: string;
53
+ githubStale: string;
54
+ githubRetry: string;
48
55
  actionGone: string;
49
56
  actionUsed: string;
50
57
  confirmGone: string;
@@ -24,6 +24,7 @@ export declare const assistantCardText: import("./catalog.js").Catalog<{
24
24
  confirmTitle: string;
25
25
  confirm: string;
26
26
  deny: string;
27
+ denyMerge: string;
27
28
  boardTitle: string;
28
29
  boardWaiting: (p: {
29
30
  n: number;
@@ -7,6 +7,8 @@ export declare const remoteLeads: {
7
7
  readonly sessionEnded: readonly ["会话已结束", "The session ended"];
8
8
  readonly couldNotStart: readonly ["会话没能启动", "The session could not start"];
9
9
  readonly turnIncomplete: readonly ["这一轮没有完成", "The turn did not complete"];
10
+ /** (a message the terminal may have taken: never said as a turn that did not complete) */
11
+ readonly inputUnconfirmed: readonly ["还没确认终端收到", "Not confirmed by the terminal yet"];
10
12
  readonly modeNotSwitched: readonly ["模式没有切换", "The mode was not switched"];
11
13
  readonly notSwitchedTo: (mode: string) => Pair;
12
14
  };
@@ -310,6 +310,11 @@ export declare const remoteText: import("./catalog.js").Catalog<{
310
310
  noAsk: (p: {
311
311
  name: string;
312
312
  }) => string;
313
+ dialogAsks: (p: {
314
+ what: string;
315
+ }) => string;
316
+ dialogAsksBare: string;
317
+ rowUnreadable: string;
313
318
  noTextOutput: string;
314
319
  answerShortened: string;
315
320
  pairBody: (p: {
@@ -0,0 +1,48 @@
1
+ /**
2
+ * What a reviewer who cannot be acted as yet is told, step by step, and what the asker is told about them: which step is
3
+ * missing, and once all are done that the review can start. The reviewer's lines are in English and Chinese, as the
4
+ * review service's other notices to a reviewer are; the asker's are in Chinese, as its other answers to the asker are.
5
+ */
6
+ /** The steps that let a colleague have a review done as this person, in the order they can be done. */
7
+ export declare const ONBOARDING_STEPS: readonly ["identity", "bind", "auto_merge", "link"];
8
+ export type OnboardingStep = (typeof ONBOARDING_STEPS)[number];
9
+ /** The steps this person is shown: the three every reviewer needs, and their own key when it is missing. */
10
+ export declare function stepsShown(withLink: boolean): readonly OnboardingStep[];
11
+ export interface StepsAsked {
12
+ /** Who asked ("" not known). */
13
+ readonly asker: string;
14
+ readonly group: boolean;
15
+ readonly pulls: string;
16
+ readonly merge: boolean;
17
+ }
18
+ export declare const onboardingText: {
19
+ /** The reviewer's first message: what was asked of them, and every step with the one to do now marked. */
20
+ readonly first: (asked: StepsAsked, steps: readonly OnboardingStep[], current: OnboardingStep) => string;
21
+ /** A step (or more) was done: the next one, with every step marked. */
22
+ readonly next: (askers: string, steps: readonly OnboardingStep[], current: OnboardingStep) => string;
23
+ /** Every step is done. */
24
+ readonly allDone: (askers: string) => string;
25
+ /** The buttons' card under a step. */
26
+ readonly bindPrompt: "Connect GitHub now? / 现在连接 GitHub?";
27
+ readonly bindButton: "Connect GitHub / 连接 GitHub";
28
+ readonly autoMergePrompt: "Allow reviews as you now? You can turn it off at any time with `/github auto-merge off`. / 现在开启代审授权?随时可以用 `/github auto-merge off` 关闭。";
29
+ readonly autoMergeButton: "Allow / 开启代审授权";
30
+ readonly declineButton: "Not now / 暂不开启";
31
+ readonly binding: "Connecting GitHub: the code follows. / 正在连接 GitHub,验证码见下一条。";
32
+ readonly allowed: "Done. / 已处理。";
33
+ readonly declined: "Understood: reviews as you stay off, and the colleague is told. / 好的,不开启代审授权,我会告诉同事。";
34
+ readonly notYours: "This button is for someone else. / 这个按钮不是给你的。";
35
+ readonly inactive: "This button is no longer active. / 这个按钮已失效。";
36
+ readonly oneToOne: "Please do this in your 1:1 chat with me. / 请在和我的 1:1 聊天里操作。";
37
+ /** The asker, where they asked: which step the reviewer has left, and what happens next. */
38
+ readonly missing: (who: string, steps: readonly OnboardingStep[], current: OnboardingStep, sent: boolean, group: boolean) => string;
39
+ /** The asker, where they asked, once every step is done. */
40
+ readonly ready: (who: string, pulls: string, merge: boolean) => string;
41
+ readonly readyTitle: "可以开始代审了";
42
+ readonly retryButton: "重新发起代审";
43
+ readonly retried: (pulls: string) => string;
44
+ readonly onlyAsker: "只有发起这次代审的人可以重新发起。";
45
+ readonly retryGone: "这个按钮已失效(已用过或已过期),需要的话请再发一次请求。";
46
+ /** The asker, where they asked, when the reviewer said no. */
47
+ readonly refused: (who: string, pulls: string) => string;
48
+ };
@@ -13,8 +13,6 @@ export declare const reviewStartText: {
13
13
  readonly unsureWho: (bot: string) => string;
14
14
  readonly unsureWhoFull: (bot: string) => string;
15
15
  readonly githubUnknown: (who: string) => string;
16
- readonly notAuthorized: (who: string, merge: boolean) => string;
17
- readonly reviewerNotLinked: (who: string, bot: string) => string;
18
16
  readonly reviewerNotConnected: (who: string, bot: string) => string;
19
17
  readonly reviewerPlatformDown: (who: string) => string;
20
18
  readonly modelsUnknown: (whose: string, model: string) => string;
@@ -1,5 +1,6 @@
1
- /** GitHub review delegation: held writes, sessions that act as someone, followed reviews and rationed notices
2
- * (tables `github_confirmations`, `acting_sessions`, `review_notices`, `asker_follows`, `github_notices`). */
1
+ /** GitHub review delegation: held writes, sessions that act as someone, followed reviews, rationed notices and the
2
+ * reviewers a request waits for (tables `github_confirmations`, `acting_sessions`, `review_notices`, `asker_follows`,
3
+ * `github_notices`, `review_onboarding`). */
3
4
  import type { JsonObject } from "./json.js";
4
5
  export type ConfirmationState = "pending" | "sending" | "done" | (string & {});
5
6
  /** A write that waits for the person the review acts for. A click is checked against this row, never the card. */
@@ -55,6 +56,27 @@ export interface AskerFollow {
55
56
  readonly reviewerTold: boolean;
56
57
  readonly deadline: number;
57
58
  }
59
+ /**
60
+ * A review asked of someone who cannot be acted as yet (their Primus account, GitHub or standing authorization is
61
+ * missing): kept so that each step they complete is followed by the next, and the asker is told once all are done.
62
+ */
63
+ export interface ReviewOnboarding {
64
+ readonly onboardingId: string;
65
+ /** The reviewer. */
66
+ readonly actorId: string;
67
+ readonly requesterId: string;
68
+ /** The pull requests, "owner/repo#n" joined by spaces in the order asked. */
69
+ readonly pulls: string;
70
+ /** What the request is started again from (who, where, the merge flag, the note). */
71
+ readonly request: JsonObject;
72
+ /** The rank of the last step the reviewer was told about (0: none). */
73
+ readonly toldRank: number;
74
+ /** The asker was told the reviewer is ready. */
75
+ readonly done: boolean;
76
+ /** The reviewer said no: the asker is owed (or is being told) that, and nothing waits for the reviewer. */
77
+ readonly declined: boolean;
78
+ readonly createdAt: number;
79
+ }
58
80
  export interface ReviewDelegationRepository {
59
81
  /** A session that acts as another person (a review for a colleague). */
60
82
  noteActingSession(sessionId: string, requesterId: string, actorId: string): void;
@@ -78,4 +100,38 @@ export interface ReviewDelegationRepository {
78
100
  /** One notice of this kind per person per `interval` seconds. */
79
101
  claimGithubNotice(userId: string, kind: string, interval: number): boolean;
80
102
  releaseGithubNotice(userId: string, kind: string): void;
103
+ /**
104
+ * Keeps (or refreshes) what waits for `actorId` to finish their steps, one per reviewer, asker and pull requests: an
105
+ * earlier one of the same three takes this id (a button sent for the earlier request no longer answers), this request
106
+ * and told rank, and is owed to the asker again. Drops
107
+ * those older than REVIEW_ONBOARDING_KEEP_SECONDS. The kept row.
108
+ */
109
+ saveReviewOnboarding(onboarding: {
110
+ readonly onboardingId: string;
111
+ readonly actorId: string;
112
+ readonly requesterId: string;
113
+ readonly pulls: string;
114
+ readonly request: JsonObject;
115
+ readonly toldRank: number;
116
+ }): ReviewOnboarding;
117
+ getReviewOnboarding(onboardingId: string): ReviewOnboarding | null;
118
+ /** What still waits for this reviewer (the asker not yet told), oldest first. */
119
+ openReviewOnboardings(actorId: string): ReviewOnboarding[];
120
+ /** Every reviewer something still waits for. */
121
+ onboardingReviewers(): string[];
122
+ /** Raises the told rank of every open one of `actorId` below `rank`; true for the one caller that raised any. */
123
+ claimOnboardingStep(actorId: string, rank: number): boolean;
124
+ /** Undoes a claim whose step could not be said: this one back to `to` while it is open and still at `from`. */
125
+ releaseOnboardingStep(onboardingId: string, from: number, to: number): void;
126
+ /** Marks it done (the asker is to be told); true for the one caller that marked it. */
127
+ finishReviewOnboarding(onboardingId: string): boolean;
128
+ dropReviewOnboarding(onboardingId: string): void;
129
+ /** Marks an open one declined (the asker is owed that); true for the one caller that marked it. */
130
+ declineReviewOnboarding(onboardingId: string): boolean;
131
+ /** The declined ones whose asker is not yet told (of `actorId`, or of everyone), oldest first. */
132
+ declinedReviewOnboardings(actorId?: string): ReviewOnboarding[];
133
+ /** Takes a declined one to tell its asker; true for the one caller that took it. */
134
+ claimDeclinedOnboarding(onboardingId: string): boolean;
135
+ /** Gives back a declined one whose asker could not be told, for the next sweep. */
136
+ releaseDeclinedOnboarding(onboardingId: string): void;
81
137
  }
@@ -48,6 +48,8 @@ export declare const HELD_TTL_SECONDS: number;
48
48
  export declare const APPROVAL_TTL_SECONDS: number;
49
49
  /** How long a review session is remembered as one that acts as a user. */
50
50
  export declare const ACTING_SESSION_KEEP_SECONDS: number;
51
+ /** How long a review asked of someone who has steps left waits for them to finish (and its retry button works). */
52
+ export declare const REVIEW_ONBOARDING_KEEP_SECONDS: number;
51
53
  /** The repositories /repo remembers per user (and lists). */
52
54
  export declare const RECENT_REPOS = 5;
53
55
  /** "My next message is for this repository" is forgotten after this. */
@@ -18,6 +18,13 @@ export interface AssistantItemSnapshot {
18
18
  board_state: string;
19
19
  result_version: number;
20
20
  can_accept: boolean;
21
+ /**
22
+ * The result version Claw delivered without the user's Accept (`CLAW_ASSISTANT_AUTO_DELIVER`), while the item stands delivered:
23
+ * closed by that delivery, or open only to watch a pull request (`watching_pr`). Absent otherwise, and from an API without it.
24
+ */
25
+ delivered_version?: number;
26
+ /** The pull requests, as owner/repo#123, a delivered item stays open watching for comments and failed CI. Absent when none. */
27
+ watching_pr?: string[];
21
28
  }
22
29
  interface AssistantEventBase {
23
30
  /** The id of the stored message: the receiver's dedup key. */
@@ -65,9 +72,11 @@ export interface AssistantConfirmWrite {
65
72
  /**
66
73
  * `devenv_send`: an instruction for an agent on the person's own machine (`assistant/devenv-tools.ts`). `skill_save`: a personal skill
67
74
  * the assistant drafted on its own, saved only when the person lets it through (`assistant/skill-writes.ts`); its message carries
68
- * `skill_card` with what would be saved.
75
+ * `skill_card` with what would be saved. `github_merge` and `github_review`: a merge, or an approval, that a review the assistant
76
+ * started for the person's own account holds for them (`claw_github_confirmations`, `assistant/review-items.ts`); the same decision
77
+ * route answers it, and it is made exactly as `POST /v1/github-review/confirmations/{confirmation_id}/decision` makes it.
69
78
  */
70
- kind: "trigger_create" | "trigger_cancel" | "github_comment" | "devenv_send" | "devenv_hide" | "skill_save";
79
+ kind: "trigger_create" | "trigger_cancel" | "github_comment" | "devenv_send" | "devenv_hide" | "skill_save" | "github_merge" | "github_review";
71
80
  /** What the button that lets it through says, in the language of the text. */
72
81
  allow_label: string;
73
82
  expires_at: string;
@@ -26,7 +26,11 @@ export interface StartedReview {
26
26
  review_only: boolean;
27
27
  /** Present when every merge of this review waits for the acting user's own confirmation, whatever their review mode. */
28
28
  merge_needs_confirmation?: true;
29
- /** Present on a review asked of someone else that may merge: the requester's own account merges it once it is approved and green. */
29
+ /**
30
+ * Present on a review asked of someone else that may merge. The reviewer's account merges it once they approve (at once under their
31
+ * fully automatic setting, else on their own confirmation); only when the reviewer cannot merge it (no permission) is the requester
32
+ * asked, with a card, whether their own account merges it. Nothing is merged with the requester's account unasked.
33
+ */
30
34
  merge_by_requester?: true;
31
35
  /** With model choice on: the model the review runs on (null: the deployment's default). Absent with model choice off. */
32
36
  model?: string | null;
@@ -99,7 +99,43 @@ export interface RemoteHeartbeat {
99
99
  agents: RemoteAgentDescriptor[];
100
100
  /** Highest `cmd_seq` the connector has fully handled; the server may forget up to it. */
101
101
  cmdCursor: number | null;
102
+ /** What the connector holds that Claw has not acknowledged yet (`outbox` on the wire); absent from an older connector. */
103
+ outbox?: RemoteOutboxReport | null;
102
104
  }
105
+ /** Sessions an outbox report names at most, the longest waiting first. */
106
+ export declare const REMOTE_OUTBOX_REPORT_MAX_SESSIONS = 20;
107
+ /** One session's part of an outbox report. */
108
+ export interface RemoteOutboxSession {
109
+ sessionId: string;
110
+ /** Its events not acknowledged yet. */
111
+ pending: number;
112
+ /** How long the oldest of them has waited, in milliseconds. */
113
+ oldestAgeMs: number;
114
+ }
115
+ /**
116
+ * The connector's own account of its event outbox, sent with every heartbeat (`outbox`, snake_case on the wire): how many
117
+ * events wait, how long the oldest has, and how many posts in a row failed and for how long. It is what tells Claw that a
118
+ * machine's replies are not getting through when the reason is on Claw's side (a batch Claw keeps refusing with a 5xx) as
119
+ * well as when it is not (a proxy, a network). Only ever a report: a malformed one is ignored, never a reason to refuse the
120
+ * heartbeat that carries it.
121
+ */
122
+ export interface RemoteOutboxReport {
123
+ pending: number;
124
+ oldestAgeMs: number;
125
+ /** Consecutive failed posts; 0 once a post succeeded. */
126
+ failures: number;
127
+ /** How long ago the first of those failures was, in milliseconds; 0 with no failure. */
128
+ failingMs: number;
129
+ /** What the last failure was: `http_<status>`, `network` or `error`; null with no failure. */
130
+ lastError: string | null;
131
+ /** The sessions with events waiting, the longest waiting first, at most {@link REMOTE_OUTBOX_REPORT_MAX_SESSIONS}. */
132
+ sessions: RemoteOutboxSession[];
133
+ }
134
+ /**
135
+ * The heartbeat's `outbox`, or null when it is absent or malformed. Total, like every parser here, and lenient by design: a
136
+ * report is advice about delivery, and a heartbeat refused over it would take the machine offline.
137
+ */
138
+ export declare function parseOutboxReport(raw: unknown): RemoteOutboxReport | null;
103
139
  export declare function parseConnectorRegistration(body: unknown): Parsed<{
104
140
  name: string;
105
141
  version: string | null;
@@ -68,6 +68,8 @@ export declare class ChatRegistry {
68
68
  private readonly readOnly;
69
69
  private readonly readOnlyKnown;
70
70
  private readonly terminalInput;
71
+ /** The session each chat was told its terminal's registry row cannot be read for (once per attach). */
72
+ private readonly rowHinted;
71
73
  private readonly tickets;
72
74
  /** How many messages wait behind the chat's running turn. */
73
75
  queuedCount(chatKey: string): number;
@@ -98,6 +100,8 @@ export declare class ChatRegistry {
98
100
  /** A new session says itself whether it only watches. */
99
101
  clearReadOnly(chatKey: string): void;
100
102
  markTerminal(chatKey: string, sessionId: string, terminal: boolean): void;
103
+ /** True the first time for a chat's session: the chat is to be told its terminal's registry row cannot be read. */
104
+ firstRowHint(chatKey: string, sessionId: string): boolean;
101
105
  /** What is sent to the chat's session is typed into a terminal on the machine. */
102
106
  typesIntoTerminal(chatKey: string, sessionId: string | null): boolean;
103
107
  /**
@@ -10,6 +10,12 @@ export declare const SANDBOX: Pair;
10
10
  export declare const STATUS: Pair;
11
11
  /** Codes an older connector hits on a root machine with `approval = "never"`: an upgrade fixes them (see `FIXED_IN`). */
12
12
  export declare const OLD_CONNECTOR: ReadonlySet<string>;
13
+ /**
14
+ * Codes a connector before a release hits far more often than one after it, with the release that fixed that: an older connector is
15
+ * told to upgrade after the code's own sentence. Before 0.1.22 a connector did not recognise a pasted message (Claude Code records a
16
+ * paste of several lines as a `<pasted_content>` block), so nearly every long message it typed into a terminal ended unconfirmed.
17
+ */
18
+ export declare const FIXED_LATER: Readonly<Record<string, readonly [number, number, number]>>;
13
19
  /** Every code that has a sentence of its own. */
14
20
  export declare function knownReasons(): string[];
15
21
  /** `0.1.4` (or `v0.1.4`, `0.1.5-rc.1`) as [major, minor, patch]; null for anything else. */
@@ -53,6 +53,12 @@ export interface RemoteStep {
53
53
  } | null;
54
54
  /** A message for a terminal's conversation waits for that terminal (the connector's reason). */
55
55
  readonly queued: string | null;
56
+ /** What the question on that terminal's screen asks, while the message waits for it (`terminal_dialog`): one short line. */
57
+ readonly dialog: string | null;
58
+ /** The short line of Teams' floating status for that wait (said by the runner; `note` is the whole line). */
59
+ readonly waitLine: string | null;
60
+ /** The connector cannot read Claude Code's registry row of the terminal's process (`registry_row_unreadable`). */
61
+ readonly rowUnreadable: boolean;
56
62
  /** Which message waits (its `cmd_id`, else Claw's number of it), null when the connector did not say. */
57
63
  readonly queuedFor: string | null;
58
64
  /** Claw's number of the message that waits, null when the connector did not say. */
@@ -71,6 +77,8 @@ export interface RemoteStep {
71
77
  export declare const NOTHING: RemoteStep;
72
78
  /** A step that says only `fields`. */
73
79
  export declare function remoteStep(fields?: Partial<RemoteStep>): RemoteStep;
80
+ /** `text` with each pasted block as the text that was pasted, on lines of its own. */
81
+ export declare function unwrapPasted(text: string): string;
74
82
  /** One SSE frame of a remote session to what the runner does. What cannot be read is skipped (usage_update, history_complete
75
83
  * and every type this client does not know are nothing). */
76
84
  export declare function decode(event: SseEvent, errors: PublicErrors): RemoteStep;
@@ -10,6 +10,11 @@ export declare const READ_ONLY_REASONS: readonly string[];
10
10
  export declare const TERMINAL_CLOSED = "terminal_closed";
11
11
  /** The connector's own word for a turn it ended because it restarted. */
12
12
  export declare const CONNECTOR_RESTARTED = "connector_restarted";
13
+ /**
14
+ * A connector's end of a turn whose message went into a terminal that did not show it in its transcript in time: the terminal may
15
+ * well have taken it, so it is never said as a turn that failed, and what the session says next is still followed.
16
+ */
17
+ export declare const TERMINAL_INPUT_UNCONFIRMED = "terminal_input_unconfirmed";
13
18
  /** A terminal's permission modes in which Claude Code acts without asking, and what they are called. */
14
19
  export declare const NO_ASK_MODES: Readonly<Record<string, string>>;
15
20
  /** The warning for a terminal whose mode does not ask, or null for one that asks (or whose mode is not known). */
@@ -41,6 +46,11 @@ export declare const WAIT_LINE_MAX_EN = 16;
41
46
  /** What a message for a conversation open in a terminal waits for (`terminal_input_queued`), in the chat's language: one short
42
47
  * line within WAIT_LINE_MAX_ZH / WAIT_LINE_MAX_EN, so that a phone shows all of it. */
43
48
  export declare function queuedLine(reason: string, lang: Lang): string;
49
+ /** The whole line of a wait, for the turn's live view and the session card (not cut to the floating status): what a question on the
50
+ * terminal's screen asks when it waits for one (`terminal_dialog`), the floating status's line otherwise. */
51
+ export declare function queuedNote(reason: string, dialog: string | null, lang: Lang): string;
52
+ /** Said once per attach: the terminal's process has a registry row the connector cannot read, and how to make it known again. */
53
+ export declare function rowUnreadableLine(lang: Lang): string;
44
54
  /** What a message to a watched session is answered with: it was not sent, and what makes sending possible without taking the
45
55
  * conversation from the terminal; `takeover`: the status card also offers Take over…, which ends the terminal's session. */
46
56
  export declare function readOnlyRefused(lang: Lang, takeover?: boolean): string;
@@ -12,6 +12,11 @@ export interface TurnDisplay {
12
12
  finish(parts: readonly string[], options: FinishWith): Promise<void>;
13
13
  /** After `finish`, when the turn of a queued message follows at once: what this turn showed must stay readable (optional). */
14
14
  handOver?(): Promise<void>;
15
+ /**
16
+ * Whether the display itself shows a wait's whole line (the session card does). A chat's stream shows only a short floating status,
17
+ * so what a question on the terminal asks is said there as a message of its own.
18
+ */
19
+ readonly showsWaits?: boolean;
15
20
  }
16
21
  export interface FinishWith {
17
22
  /** What the agent wrote (the AI label). */
@@ -40,6 +40,8 @@ export declare class TurnRunner {
40
40
  private readonly ended;
41
41
  private readonly show;
42
42
  private readonly displayFor;
43
+ /** The questions on the terminal each turn's display said in the chat (by their line). */
44
+ private readonly questionsTold;
43
45
  /** Per chat: what it was told of each message (Claw's number) waiting for a busy terminal (`tellBusy`), oldest first. */
44
46
  private readonly toldBusy;
45
47
  constructor(ctx: RemoteContext, state: ChatState, board: StatusBoard, follow: FollowControl, ended: EndedWords, show: (chatKey: string, sid: string, request: Readonly<Record<string, unknown>>, to: Conversation) => Promise<void>, displayFor: DisplayFor);
@@ -78,5 +80,18 @@ export declare class TurnRunner {
78
80
  * send has not answered yet has no number to match: the refusal is kept for that send (`Prompts.queueBehind`).
79
81
  */
80
82
  private queuedRefused;
83
+ /**
84
+ * Why the message still waits for the terminal, in the chat's language: the whole line in the turn's live view and on the session
85
+ * card, a short one in the floating status; what a question on the terminal asks is also said in the chat when the display does
86
+ * not show the whole line; that it waits for a busy terminal is said in the chat at once (`tellBusy`).
87
+ */
88
+ private showWait;
89
+ /**
90
+ * What a question on the terminal asks, while the message waits for it: said in the chat once per question and turn (the stream's
91
+ * floating status has room for a few characters only, and the person must answer it at the terminal before anything runs).
92
+ */
93
+ private sayQuestion;
94
+ /** Once per attach: the terminal's registry row cannot be read, and a restart of it there makes it known again. */
95
+ private sayRowUnreadable;
81
96
  private sayRecovered;
82
97
  }
@@ -15,6 +15,8 @@ export declare class WindowTurn implements TurnDisplay {
15
15
  private readonly board;
16
16
  private readonly cutError;
17
17
  tail: string;
18
+ /** (the card's state line says why a message waits, whole) */
19
+ readonly showsWaits = true;
18
20
  private readonly segments;
19
21
  private newSegment;
20
22
  private closed;
@@ -7,6 +7,7 @@ export { REVIEW_MODE_NAMES, isReviewMode, type ReviewMode } from "./review-turn.
7
7
  export { connectionsText, UNKNOWN, type ConnectionsInput } from "./connect/connections.js";
8
8
  export { GithubReview } from "./service/github-review.js";
9
9
  export { ReviewHandoffAction, type HandoffActionDeps } from "./service/handoff-action.js";
10
+ export { ONBOARDING_SWEEP_MS } from "./service/onboarding.js";
10
11
  export type { ReviewDeps, ReviewHost, StartReviewTurn, Guard, Audit, FollowWire, RestoreRef } from "./service/deps.js";
11
12
  export type { PostWorkCard } from "./service/notices.js";
12
13
  export { reviewTurnStart, routedReviewTurns, type AfterReviewTurn, type StartRouterTurn, } from "./service/routed-turn.js";
@@ -37,8 +37,10 @@ export declare function refusedText(refused: readonly (readonly [PullRef, string
37
37
  */
38
38
  export declare function modelChosenNote(review: ReviewTurn, who: string, asked: string): string;
39
39
  /**
40
- * What the receipt says of how the merges will be made: only what the reviews started say. Every one waits for the
41
- * reviewer's confirmation: that, plainly. Otherwise the reviewer's fully automatic setting is said, a held one among the
42
- * others is named, and a merge Claw makes with the asker's own account is said. '' when there is nothing to say.
40
+ * What the receipt says of how the merges will be made: only what the reviews started say. A review asked of someone else is merged
41
+ * with that reviewer's account once they approve, said plainly, with "they confirm it first" when its merge waits for them; the
42
+ * reviewer's fully automatic setting is said; and when Claw may put the merge to the asker (`mergeByRequester`), that the asker is
43
+ * asked first, only when the reviewer has no permission to merge. Nothing is merged with the asker's account unasked
44
+ * (2026-11-20). One's own review says only whether its merge waits for one's own confirmation. '' when there is nothing to say.
43
45
  */
44
46
  export declare function mergeLine(reviews: readonly ReviewTurn[], who: string, merge: boolean, auto: boolean): string;
@@ -2,6 +2,8 @@ import { type CredentialFailure, type DeviceCode } from "../../ports/github.js";
2
2
  import type { Conversation, OutMessage, UserRef } from "../../ports/surface.js";
3
3
  import { type ReviewMode } from "../review-turn.js";
4
4
  import type { ReviewDeps } from "./deps.js";
5
+ /** What a person changed on their binding, for what waits on it (`GithubAccount.changed`). */
6
+ export type AccountChange = "bound" | "delegation_on" | "delegation_off";
5
7
  /** `(connected, login)` once a device flow has ended, for a question that waited for it. */
6
8
  export type OnBound = (connected: boolean, login: string) => Promise<void>;
7
9
  export declare class GithubAccount {
@@ -10,7 +12,10 @@ export declare class GithubAccount {
10
12
  private readonly binding;
11
13
  /** Teams user -> the confirmation setting chosen while their binding is made. */
12
14
  private readonly modeChosen;
15
+ /** Told after a person connected GitHub or switched their standing authorization (errors are logged, never thrown). */
16
+ changed: ((userId: string, change: AccountChange) => Promise<void>) | undefined;
13
17
  constructor(deps: ReviewDeps);
18
+ private tellChanged;
14
19
  /** Settles when every device flow started so far has ended (for tests and an orderly stop). */
15
20
  idle(): Promise<void>;
16
21
  /** `/github ...` in a 1:1 chat. */
@@ -0,0 +1,12 @@
1
+ /** What the review service reads a request from (the message, or a press of a button that asks it again). */
2
+ import type { Conversation, InboundMessage, UserRef } from "../../ports/surface.js";
3
+ /** Where and by whom a request was made. */
4
+ export interface RequestContext {
5
+ readonly message: InboundMessage;
6
+ readonly sender: UserRef;
7
+ readonly conversation: Conversation;
8
+ readonly scope: string;
9
+ /** What the person wrote (the asker's note to the reviewer). */
10
+ readonly text: string;
11
+ readonly group: boolean;
12
+ }
@@ -26,11 +26,14 @@ export declare class GithubReview {
26
26
  private readonly held;
27
27
  private readonly checks;
28
28
  private readonly launch;
29
+ private readonly onboarding;
29
30
  constructor(deps: ReviewDeps, random: Random, postWorkCard: PostWorkCard);
30
31
  /** Settles when the background work started so far (device flows, follows, hints) has ended. For tests. */
31
32
  idle(): Promise<void>;
32
33
  /** Which channel id is whose, from a message of theirs: a mention in a group can then be read without the member list. */
33
34
  remember(message: InboundMessage): void;
35
+ /** The reviewers a review waits for, read again: each step done is answered with the next (every ONBOARDING_SWEEP_MS). */
36
+ sweepOnboarding(): Promise<void>;
34
37
  private context;
35
38
  /**
36
39
  * A message that may be "请 XX 帮我 review 合入 <PR> [<PR> ...]". True when it was one (answered here, or started), false
@@ -38,6 +38,13 @@ export declare class Notices {
38
38
  reachNote(review: ReviewTurn | undefined, channel: string): Promise<string>;
39
39
  /** Sends what `send` says into the person's own chat, at most once a day for this kind; true when they have it. */
40
40
  onceADay(person: Actor, via: ConversationRef, kind: string, send: (chat: Conversation) => Promise<void>): Promise<boolean>;
41
+ /**
42
+ * As `onceADay`, telling apart sent now ("sent"), held back because a notice of this kind already went to them today
43
+ * ("earlier": what that one said may not be this), and not sent ("failed").
44
+ */
45
+ onceADayOutcome(person: Actor, via: ConversationRef, kind: string, send: (chat: Conversation) => Promise<void>): Promise<"sent" | "earlier" | "failed">;
46
+ /** Sends what `send` says into the person's own chat, with no daily limit; true when it went. */
47
+ toPerson(person: Actor, via: ConversationRef, send: (chat: Conversation) => Promise<void>): Promise<boolean>;
41
48
  /** The asker has no Primus key of their own linked, and a review runs on it: one line where asked, and the steps in their chat. */
42
49
  requesterMustLink(via: ConversationRef, group: boolean, requester: Actor, conversation: Conversation, pulls: readonly PullRef[]): Promise<void>;
43
50
  /** The person named cannot be acted as yet: one line where asked and, once a day, the steps in their own chat. */