@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.
- package/dist/index.js +872 -105
- package/dist/types/assistant/confirm-outcome.d.ts +7 -0
- package/dist/types/assistant/events.d.ts +1 -1
- package/dist/types/assistant/views.d.ts +2 -0
- package/dist/types/claw/model.d.ts +1 -1
- package/dist/types/locales/assistant-actions.d.ts +7 -0
- package/dist/types/locales/assistant-cards.d.ts +1 -0
- package/dist/types/locales/remote-leads.d.ts +2 -0
- package/dist/types/locales/remote.d.ts +5 -0
- package/dist/types/locales/review-onboarding.d.ts +48 -0
- package/dist/types/locales/review-start.d.ts +0 -2
- package/dist/types/ports/store/github.d.ts +58 -2
- package/dist/types/ports/store/policy.d.ts +2 -0
- package/dist/types/protocol/claw-api/assistant-events.d.ts +11 -2
- package/dist/types/protocol/claw-api/reviews.d.ts +5 -1
- package/dist/types/protocol/remote-agents.d.ts +36 -0
- package/dist/types/remote/chats.d.ts +4 -0
- package/dist/types/remote/connector/reasons.d.ts +6 -0
- package/dist/types/remote/events.d.ts +8 -0
- package/dist/types/remote/lines.d.ts +10 -0
- package/dist/types/remote/turns/display.d.ts +5 -0
- package/dist/types/remote/turns/runner.d.ts +15 -0
- package/dist/types/remote/turns/window-turn.d.ts +2 -0
- package/dist/types/review/index.d.ts +1 -0
- package/dist/types/review/refusals.d.ts +5 -3
- package/dist/types/review/service/account.d.ts +5 -0
- package/dist/types/review/service/context.d.ts +12 -0
- package/dist/types/review/service/github-review.d.ts +3 -0
- package/dist/types/review/service/notices.d.ts +7 -0
- package/dist/types/review/service/onboarding.d.ts +85 -0
- package/dist/types/review/service/start.d.ts +9 -13
- package/dist/types/turn/progress/status-message.d.ts +15 -4
- package/package.json +1 -1
|
@@ -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
|
-
|
|
11
|
-
export
|
|
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
|
-
/**
|
|
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;
|
|
@@ -79,6 +79,8 @@ export declare class StatusMessage<S> {
|
|
|
79
79
|
private streamOver;
|
|
80
80
|
/** The turn was cancelled (`close(true)`). */
|
|
81
81
|
private hard;
|
|
82
|
+
/** The answer is on its way (`finish`): the progress message is the answer's to retire. */
|
|
83
|
+
private finishing;
|
|
82
84
|
constructor(surface: TurnSurface, options: StatusOptions<S>);
|
|
83
85
|
begin(): void;
|
|
84
86
|
private openStream;
|
|
@@ -134,11 +136,19 @@ export declare class StatusMessage<S> {
|
|
|
134
136
|
private update;
|
|
135
137
|
/**
|
|
136
138
|
* Stop sending progress. A sleeping flusher is cancelled; one that is mid-send finishes that one send, unless the turn
|
|
137
|
-
* itself was cancelled (`hard`).
|
|
138
|
-
*
|
|
139
|
+
* itself was cancelled (`hard`). When the turn is cancelled, what shows it is ended in the background: a stream still open
|
|
140
|
+
* is closed with INTERRUPTED (the floating status must not spin until the chat's limit), and the progress message is
|
|
141
|
+
* retired (no answer follows it, so it must not stay in the chat as stale progress).
|
|
139
142
|
*/
|
|
140
143
|
close(hard?: boolean): void;
|
|
144
|
+
/** The turn was cancelled: nothing more is repeated, and what shows it is ended (the first time only). */
|
|
145
|
+
private cancelled;
|
|
141
146
|
private interrupt;
|
|
147
|
+
/**
|
|
148
|
+
* The turn was cancelled with its progress message on screen: no answer follows to replace it, so it is retired here
|
|
149
|
+
* (deleted, or edited down to INTERRUPTED where the chat will not delete it). Never fails the turn.
|
|
150
|
+
*/
|
|
151
|
+
private retireCancelled;
|
|
142
152
|
/**
|
|
143
153
|
* The turn is over: the user gets `parts`, in order. With a stream the first part is its final message (in the place
|
|
144
154
|
* of the status) and the others follow; without one they are NEW messages, and the progress message is then retired.
|
|
@@ -160,8 +170,9 @@ export declare class StatusMessage<S> {
|
|
|
160
170
|
/** Wait until FINAL_SETTLE_SECONDS have passed since the last progress edit left. */
|
|
161
171
|
private settle;
|
|
162
172
|
/**
|
|
163
|
-
* The answer is posted below: delete the progress message. The chat may
|
|
164
|
-
* is then edited down to one line, so it does not sit
|
|
173
|
+
* The answer is posted below, or none will come (the turn was cancelled): delete the progress message. The chat may
|
|
174
|
+
* refuse, and a queue cannot delete; the message is then edited down to one line (`line`), so it does not sit in the
|
|
175
|
+
* chat as stale progress. Never fails the turn.
|
|
165
176
|
*/
|
|
166
177
|
private retire;
|
|
167
178
|
/** Live edits went out, so one may still arrive after `message` replaced the progress message: send it once more. */
|