@primusclaw/personal-agent 0.10.4 → 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.
@@ -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). */
@@ -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;
@@ -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. */
@@ -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;
@@ -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. */
@@ -0,0 +1,85 @@
1
+ import { type OnboardingStep } from "../../locales/review-onboarding.js";
2
+ import type { ClickRoute } from "../../ports/routing.js";
3
+ import type { Conversation, UserRef } from "../../ports/surface.js";
4
+ import type { Random } from "../../ports/random.js";
5
+ import type { PullRef } from "../../claw/model.js";
6
+ import { type ReviewAsk } from "../request-parse.js";
7
+ import type { ReviewDeps } from "./deps.js";
8
+ import type { Notices } from "./notices.js";
9
+ import type { Actor } from "./reviewer.js";
10
+ import type { RequestContext } from "./context.js";
11
+ /** How often the reviewers something waits for are read again (a confirmation at the identity service sends nothing). */
12
+ export declare const ONBOARDING_SWEEP_MS = 60000;
13
+ /** The click kind of the buttons this sends. */
14
+ export declare const ONBOARDING_CLICK = "review_onboarding";
15
+ /** Where a reviewer is: the step to do now, every one done, or undefined when it could not be read just now. */
16
+ export type ReviewerProgress = OnboardingStep | "ready";
17
+ export declare class ReviewerOnboarding {
18
+ private readonly deps;
19
+ private readonly notices;
20
+ private readonly random;
21
+ /** Starts a request again, as the asker's press of the retry button (the review service's checks). */
22
+ private readonly retry;
23
+ /** `/github <args>` as the person typed it in their 1:1 chat (the steps' buttons). */
24
+ private readonly github;
25
+ private readonly running;
26
+ constructor(deps: ReviewDeps, notices: Notices, random: Random,
27
+ /** Starts a request again, as the asker's press of the retry button (the review service's checks). */
28
+ retry: (ctx: RequestContext, ask: ReviewAsk, actor: Actor) => Promise<void>,
29
+ /** `/github <args>` as the person typed it in their 1:1 chat (the steps' buttons). */
30
+ github: (sender: UserRef, args: string, conversation: Conversation) => Promise<void>);
31
+ /** Settles when the reads started by messages have ended. For tests. */
32
+ idle(): Promise<void>;
33
+ /** The step this person is to do now for a review asked of them, or undefined when it cannot be read just now. */
34
+ progress(userId: string): Promise<ReviewerProgress | undefined>;
35
+ private linked;
36
+ /**
37
+ * A review for someone else did not start because `step` is theirs to do: kept, the steps sent to them (once a day, the
38
+ * identity card too while the identity service does not know them), and one line where it was asked naming the step.
39
+ */
40
+ refused(ctx: RequestContext, ask: ReviewAsk, actor: Actor, pulls: readonly PullRef[], step: OnboardingStep): Promise<void>;
41
+ /**
42
+ * What goes with a step, after its text went: a card that could not be sent is not worth saying the step again for
43
+ * (the text names what to type), so it is only logged and the step counts as said.
44
+ */
45
+ private cardAfterText;
46
+ /** What goes with a step: the identity card, or a button that does the step. */
47
+ private stepCard;
48
+ /**
49
+ * A reviewer who undid a step they had done (`/github unbind`, or an identity service that no longer knows them) is
50
+ * behind what they were told: each open ask told further than `rank` is put just below it, so the step they are at
51
+ * now is said again (once, by whoever raises it first). True when any was.
52
+ */
53
+ private behind;
54
+ /** A message of this person's: when something waits for them, their state is read again (in the background). */
55
+ activity(userId: string): void;
56
+ /** Every reviewer something waits for, read again; every asker still owed a reviewer's no, told. */
57
+ sweep(): Promise<void>;
58
+ /**
59
+ * This person's state, read again: a step further than they were told is answered with the next one (once, whoever
60
+ * reads it first), and so is a step they undid; all done, each asker is told where they asked. A step that could not
61
+ * be said is claimed back, so the next read (their next message, or the sweep) says it.
62
+ */
63
+ advance(userId: string): Promise<void>;
64
+ /** The step `now` said in the reviewer's own chat; false when that chat could not be reached. */
65
+ private tell;
66
+ private via;
67
+ /**
68
+ * Every step is done: each asker, where they asked, hears it with the button that asks again, and only then is the
69
+ * request marked told; one that could not be told is claimed back (from `rank`) and told on the next read. The
70
+ * reviewer hears it too.
71
+ */
72
+ private ready;
73
+ /**
74
+ * The reviewer turned their standing authorization off, or said not now: each asker waiting on them is told, once. Each
75
+ * is marked declined first (nothing waits for the reviewer any more), and stays owed to its asker until the telling
76
+ * went, so a send that fails is tried again by the sweep.
77
+ */
78
+ declined(userId: string): Promise<void>;
79
+ /** Each asker owed a reviewer's no is told it where they asked (once, whoever takes it first); then it is dropped. */
80
+ private tellDeclined;
81
+ /** A press of one of the buttons this sent. */
82
+ click(click: ClickRoute): Promise<void>;
83
+ /** The asker's press of "ask again": the same request, started again through every check, once. */
84
+ private retryClick;
85
+ }
@@ -1,22 +1,14 @@
1
1
  import { type GithubState } from "../../ports/github.js";
2
- import type { Conversation, InboundMessage, UserRef } from "../../ports/surface.js";
3
2
  import type { PullRef } from "../../claw/model.js";
4
3
  import type { ReviewAsk } from "../request-parse.js";
5
4
  import { type ReviewTurn } from "../review-turn.js";
6
5
  import type { ReviewDeps, ReviewTaskSlots } from "./deps.js";
7
6
  import type { ReviewItems } from "./items.js";
8
7
  import type { Notices } from "./notices.js";
8
+ import type { ReviewerOnboarding } from "./onboarding.js";
9
9
  import type { Actor, ReviewerReader } from "./reviewer.js";
10
- /** Where and by whom a request was made. */
11
- export interface RequestContext {
12
- readonly message: InboundMessage;
13
- readonly sender: UserRef;
14
- readonly conversation: Conversation;
15
- readonly scope: string;
16
- /** What the person wrote (the asker's note to the reviewer). */
17
- readonly text: string;
18
- readonly group: boolean;
19
- }
10
+ import type { RequestContext } from "./context.js";
11
+ export type { RequestContext } from "./context.js";
20
12
  /** What `take` settled, for the start: who asks and for whom, with what. */
21
13
  export interface Settled {
22
14
  readonly ctx: RequestContext;
@@ -42,8 +34,9 @@ export declare class ReviewChecks {
42
34
  private readonly reviewers;
43
35
  private readonly items;
44
36
  private readonly notices;
37
+ private readonly onboarding;
45
38
  private readonly launch;
46
- constructor(deps: ReviewDeps, reviewers: ReviewerReader, items: ReviewItems, notices: Notices, launch: Launch);
39
+ constructor(deps: ReviewDeps, reviewers: ReviewerReader, items: ReviewItems, notices: Notices, onboarding: ReviewerOnboarding, launch: Launch);
47
40
  private say;
48
41
  /** The pull requests' checks, then `take`. `named`: the reviewer, already known (a handoff); undefined: read from the message. */
49
42
  request(ctx: RequestContext, ask: ReviewAsk, named?: Actor): Promise<void>;
@@ -51,7 +44,10 @@ export declare class ReviewChecks {
51
44
  private askerToken;
52
45
  /** Who reviews: the asker (a 1:1 chat that names nobody), the reviewer a handoff named, or the one the message names. */
53
46
  private whoReviews;
54
- /** The reviewer's GitHub binding, usable and authorized, or undefined when the asker was told why not. */
47
+ /**
48
+ * The reviewer's GitHub binding, usable and authorized, or undefined when the asker was told why not. A review asked of
49
+ * someone else who has a step left is kept until they have done it (`ReviewerOnboarding`), and the asker is told which.
50
+ */
55
51
  private reviewerState;
56
52
  /** A review asked of someone else runs on their own token and key: both, or undefined when the asker was told. */
57
53
  private actingCredentials;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primusclaw/personal-agent",
3
- "version": "0.10.4",
3
+ "version": "0.11.0",
4
4
  "description": "The personal agent's channel-neutral core: domain logic, ports and plugin interfaces.",
5
5
  "license": "MIT",
6
6
  "repository": {