@primusclaw/personal-agent 0.15.1 → 0.15.3

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.
@@ -104,6 +104,11 @@ export interface ReviewStart {
104
104
  readonly queued: string;
105
105
  /** The reviewer's account merges it; when the reviewer cannot merge, Claw asks the asker whether their own account merges it. */
106
106
  readonly mergeByRequester: boolean;
107
+ /**
108
+ * `on_behalf`: Claw recorded the review as sent for the asker by their coordinator and sums up how it ended for them, so it is not pushed
109
+ * to them stage by stage. Absent: Claw does not say so (an older Claw, or a review the person asked), and it is told as any review is.
110
+ */
111
+ readonly origin?: "on_behalf";
107
112
  }
108
113
  /** Which GitHub token Claw's GitHub tools use for the token's own user now (never the token). */
109
114
  export interface GithubConnection {
@@ -87,6 +87,10 @@ export declare const connectorReasonHints: import("./catalog.js").Catalog<{
87
87
  status: string;
88
88
  newSession: string;
89
89
  retry: string;
90
+ /** A length of time in the sentences that name one (`{wait}`): the connector's own whole seconds. */
91
+ seconds: (p: {
92
+ n: number;
93
+ }) => string;
90
94
  unknown: (p: {
91
95
  code: string;
92
96
  }) => string;
@@ -24,6 +24,8 @@ export interface MetricsPort {
24
24
  probed?(feedbackMs: number, replyMs: number | null): void;
25
25
  /** A receiver of the surface's inbound queue whose call on the broker hung was dropped and taken again (optional). */
26
26
  inboundRearmed?(): void;
27
+ /** A message a surface posts to its chat directly was not confirmed as delivered and was thrown to the sender (optional). */
28
+ outboundUndelivered?(): void;
27
29
  }
28
30
  /** Metrics that go nowhere: the default where a caller passes none. */
29
31
  export declare const noMetrics: MetricsPort;
@@ -36,7 +36,7 @@ export declare class Deliveries {
36
36
  * Claw's "on it" line for a turn that has already begun to answer: a say of the turn was delivered (or is being), or the
37
37
  * receipt under the person's message is showing the reply's words. The line came late (it was decided before the answer,
38
38
  * or the two crossed on the way here): it is dropped, never put in the receipt's place, where it would replace the words of
39
- * a reply that is being written or close it as if it were the answer (2026-11-11 0.3.0 acceptance: a refusal streamed into
39
+ * a reply that is being written or close it as if it were the answer (0.3.0 acceptance: a refusal streamed into
40
40
  * the receipt, the line closed it as "收到,我看一下。", and the refusal came as a message of its own).
41
41
  */
42
42
  private lateTurnAck;
@@ -384,6 +384,14 @@ export interface AssistantReviewHandoff {
384
384
  }>;
385
385
  merge: boolean;
386
386
  requester_note: string;
387
+ /**
388
+ * Where the person's message came from, when it was not typed by them: `on_behalf`, a message their coordinator posted into their own
389
+ * chat for them (`channel_context.via` of the message, which Claw keeps in a closed set). The channel then does not push the person the
390
+ * stages of the review (its receipt, its card, its progress): Claw sums its end up for them (`review-digest.ts`), and a failure and a
391
+ * conflict still reach them at once. Absent for a message the person typed, and from a Claw that does not say; a value this field does
392
+ * not know is read as absent.
393
+ */
394
+ origin?: "on_behalf";
387
395
  /**
388
396
  * What the router said in the same turn before handing the review over (another question of the person's answered), in order. Held
389
397
  * and never delivered on its own (`say-hold.ts`), so the channel's one answer carries it: the channel adds it to that answer. Absent
@@ -20,6 +20,12 @@ export interface StartedReview {
20
20
  pr: PrRef;
21
21
  /** The turn id of the session's first message (`claw-pending-<id>`), for a caller that follows that turn's stream. */
22
22
  message_id: string | null;
23
+ /**
24
+ * Present on a review asked of someone else that Claw recorded as sent for the asker by their coordinator (`origin: "on_behalf"` on the
25
+ * handoff it was started from): Claw sums up how it ended for the asker (`review-digest.ts`), so the channel need not push them its stages.
26
+ * A channel goes quiet only for an item that says so: an older Claw does not, and neither does a request that names no such handoff.
27
+ */
28
+ origin?: "on_behalf";
23
29
  /** What the request named that the review does not take (a review asked of someone else runs on their settings). */
24
30
  ignored?: Array<"model" | "effort">;
25
31
  /** The review never merges. */
@@ -98,7 +98,7 @@ export declare class StatusBoard {
98
98
  /**
99
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
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).
101
+ * that the messages still go to the bot ("now go to" said before a start that failed, then taken back).
102
102
  */
103
103
  sayStarting(chatKey: string, to: Conversation, state: RemoteState): Promise<void>;
104
104
  /**
@@ -4,6 +4,11 @@ import { Setup } from "./setup.js";
4
4
  export type Pair = readonly [zh: string, en: string];
5
5
  /** The release whose Claude agent runs as root with `approval = "never"`; an older connector there refuses every new session. */
6
6
  export declare const FIXED_IN: readonly [number, number, number];
7
+ /**
8
+ * `reason` with the connector's figure (`wait_s`, whole seconds) after it when it is a code that says one and the figure is good;
9
+ * `reason` as it is otherwise.
10
+ */
11
+ export declare function reasonWithWait(reason: string, wait: unknown): string;
7
12
  /** The one upgrade command: it installs the new version and restarts the connector on it, under whichever supervisor it has. */
8
13
  export declare const UPGRADE: Pair;
9
14
  export declare const SANDBOX: Pair;
@@ -25,7 +30,7 @@ export declare function isCode(reason: string): boolean;
25
30
  * [Chinese, English] for one reason code: what happened and what to do. An unknown code gets a generic pair that names it.
26
31
  * `setup`: the commands of the address this worker reaches Claw at (the login a revoked connector is given).
27
32
  */
28
- export declare function explain(code: string, version?: unknown, setup?: Setup): Pair;
33
+ export declare function explain(reason: string, version?: unknown, setup?: Setup): Pair;
29
34
  /** A reason as given: trimmed, without the full stops at its end. */
30
35
  export declare function bareReason(reason: string | null | undefined): string;
31
36
  /**
@@ -27,7 +27,7 @@ export declare class FollowControl {
27
27
  /**
28
28
  * A conversation open in a terminal, watched or typed into: what is typed there is answered there, with no turn of the phone's to
29
29
  * end it, so its reply is told after a few quiet seconds, as a watch's is. With the half-minute of a session of the phone's own it
30
- * came after the person had left (2026-11-11 guide re-check: nothing within 20 s, although the card says replies show up here).
30
+ * came after the person had left (a guide re-check: nothing within 20 s, although the card says replies show up here).
31
31
  * Read each time they are used: a worker that restarted learns only after its reader started whether the session is a terminal's
32
32
  * (`resume`).
33
33
  */
@@ -37,7 +37,7 @@ export declare const TYPED_CHARS_MAX = 4000;
37
37
  export declare function typedLine(text: string, lang: Lang): string;
38
38
  /**
39
39
  * Teams' floating status (an informative update) is cut on a phone after a few characters. Microsoft documents only an upper
40
- * bound (1000 characters) and no display width; the one measurement is a phone on 2026-11-10, which showed four Chinese
40
+ * bound (1000 characters) and no display width; the one measurement is a phone, which showed four Chinese
41
41
  * characters after the icon. So a line saying why a message still waits for its terminal is at most WAIT_LINE_MAX_ZH code points
42
42
  * in Chinese and WAIT_LINE_MAX_EN in English, the "⏳ " included.
43
43
  */
@@ -42,7 +42,7 @@ export declare class RemoteStatusPolicy implements StatusPolicy<RemoteStep> {
42
42
  * first run of backticks that no later run of the same length closes, and what follows it. Streamed, such a backtick is shown as a
43
43
  * look-alike (`inertAnswer`: one the rich text cannot pair), and once the agent closes the span it is a backtick again: the text no
44
44
  * longer begins with what the bubble shows, so the bubble ends on that lone character and the answer follows as a message of its own
45
- * (2026-11-11 guide re-check: a reply that began with `` `hook.txt` `` ended its bubble on "ˋ"). Escaped backticks open nothing.
45
+ * (a guide re-check: a reply that began with `` `hook.txt` `` ended its bubble on "ˋ"). Escaped backticks open nothing.
46
46
  */
47
47
  export declare function withoutOpenCode(text: string): string;
48
48
  /** The turn shown in the chat (a stream, else a progress message), as a `TurnDisplay`. */
@@ -17,6 +17,12 @@ export interface ReviewHandoff {
17
17
  readonly handoffId: string;
18
18
  /** What the assistant said in the same turn before handing this over: the answer to the handoff carries it. */
19
19
  readonly said: readonly string[];
20
+ /**
21
+ * `on_behalf`: the person's coordinator posted the message for them (`channel_context.via`), so the review's stages are not pushed to
22
+ * them: Claw sums up how it ended, and a failure still comes at once. '' for a message the person typed, from a Claw that does not say,
23
+ * and for a value this worker does not know. Optional in the type (it is exported): what builds a handoff itself need not say.
24
+ */
25
+ readonly origin?: "on_behalf" | "";
20
26
  }
21
27
  /** The `review` of an `assistant.action`, or undefined when it is not one in every field. */
22
28
  export declare function parseReviewHandoff(raw: unknown): ReviewHandoff | undefined;
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * How the asker of a review someone else runs hears of it: only its asker view (state, link, conclusion, merged, what a
3
- * waiting one waits for, what it found), as one line for one review, or one message for a request's several. And what the
4
- * reviewer hears when the reviews asked of them end. `viewStage` is the key that changes exactly when there is news.
3
+ * waiting one waits for, what it found), as one line for one review, or one message for a request's several. `viewStage` is
4
+ * the key that changes exactly when the view changes, and `isNewsStage` says which of those changes the asker is told at once.
5
+ * What the reviewer hears of the reviews asked of them is not here: Claw sums it up (`review-digest.ts`, the reviewer's one
6
+ * message every `/approvals summary` minutes), and what waits for them has its own notice (`Notices.tellReviewerWaiting`).
5
7
  */
6
8
  import type { AskerView, PullRef } from "../claw/model.js";
7
9
  import { type ReviewTurn } from "./review-turn.js";
@@ -29,14 +31,19 @@ export declare function requesterResultText(review: ReviewTurn, view: AskerView)
29
31
  export declare function itemEndText(view: AskerView): string;
30
32
  /** How a review of one's own ended, as its card shows it: from what its turn left on GitHub. */
31
33
  export declare function ownItemEndText(review: ReviewTurn): string;
32
- /** What the reviewer hears when a review asked of them ends. */
33
- export declare function reviewerResultText(review: ReviewTurn, view: AskerView): string;
34
34
  /** What the asker has been told of a review, as a key that changes exactly when there is news ('' nothing yet). */
35
35
  export declare function viewStage(view: AskerView): string;
36
36
  /** `viewStage` for one followed review, with one more piece of news: a review that waited for a slot has 'started'. */
37
37
  export declare function entryStage(entry: Followed, view: AskerView): string;
38
38
  /** The conclusion a `viewStage` key holds ('' none). */
39
39
  export declare function stageVerdict(stage: string): string;
40
+ /**
41
+ * Whether a change of the view is news to the asker, told at once: an end, a failure, a wait for the reviewer, and a conclusion that
42
+ * needs the author's hands (changes requested, a comment). Not news: that the review waits for a slot, that it started, and an approval
43
+ * that is not merged yet, which the end's line carries within minutes; a review may wait a day for CI, and the conclusions that ask
44
+ * something of the author are told as they come. For a request the person's coordinator sent for them (`onBehalf`), only a failure is.
45
+ */
46
+ export declare function isNewsStage(stage: string, onBehalf?: boolean): boolean;
40
47
  /** How a review someone else runs stands, as its asker is told. `started`: it waited for a slot, and has just started. */
41
48
  export declare function progressWords(review: ReviewTurn, view: AskerView, started?: boolean): string;
42
49
  /**
@@ -46,5 +53,3 @@ export declare function progressWords(review: ReviewTurn, view: AskerView, start
46
53
  export declare function progressText(entries: readonly Followed[], told: readonly (readonly [Followed, AskerView])[]): string;
47
54
  /** The asker's last line when the reviews they follow are still open at the deadline. */
48
55
  export declare function unfinishedText(left: readonly Followed[]): string;
49
- /** What the reviewer hears when reviews asked of them end. */
50
- export declare function reviewerEndedText(ended: readonly (readonly [Followed, AskerView])[]): string;
@@ -40,7 +40,7 @@ export declare function modelChosenNote(review: ReviewTurn, who: string, asked:
40
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
41
  * with that reviewer's account once they approve, said plainly, with "they confirm it first" when its merge waits for them; the
42
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
+ * asked first, only when the reviewer has no permission to merge. Nothing is merged with the asker's account unasked.
44
+ * One's own review says only whether its merge waits for one's own confirmation. '' when there is nothing to say.
45
45
  */
46
46
  export declare function mergeLine(reviews: readonly ReviewTurn[], who: string, merge: boolean, auto: boolean): string;
@@ -21,6 +21,8 @@ export interface ReviewAsk {
21
21
  readonly merge: boolean;
22
22
  /** The record Claw kept of a review the assistant handed back; '' for a typed request. */
23
23
  readonly handoffId: string;
24
+ /** `on_behalf`: a handed-back review the person's coordinator sent for them (`ReviewHandoff.origin`); '' otherwise. */
25
+ readonly origin: "on_behalf" | "";
24
26
  }
25
27
  export declare function reviewAsk(fields: Partial<ReviewAsk> & Pick<ReviewAsk, "who" | "pulls">): ReviewAsk;
26
28
  /**
@@ -59,6 +59,12 @@ export interface ReviewTurn {
59
59
  asItem: (() => Promise<boolean>) | undefined;
60
60
  /** The acknowledgement shown at the top of the review's progress message ('' nothing to acknowledge). */
61
61
  ack: string;
62
+ /**
63
+ * The person's coordinator sent the request for them (`ReviewHandoff.origin`) and Claw says it recorded that (`ReviewStart.origin`): its
64
+ * receipt, its card and its progress are not pushed to them, Claw sums up how it ended; a failure still comes at once. Kept with the follow, so a restart of the worker keeps it. Optional in
65
+ * the type (it is exported): absent is false.
66
+ */
67
+ onBehalf?: boolean;
62
68
  }
63
69
  export type NewReviewTurn = Pick<ReviewTurn, "requesterId" | "requesterName" | "actorId" | "actorUserId" | "actorName" | "actorChannelId" | "pull"> & Partial<ReviewTurn>;
64
70
  export declare function reviewTurn(fields: NewReviewTurn): ReviewTurn;
@@ -9,8 +9,15 @@ export declare const REQUESTER_VIEW_LIMIT_SECONDS: number;
9
9
  /** News is held this long for more to join it, at most this long in all. */
10
10
  export declare const VIEW_SETTLE_MS = 90000;
11
11
  export declare const VIEW_HOLD_MS = 600000;
12
- /** How often a last line is tried before it is left (to the next worker that starts). */
12
+ /** How often a last line is tried before it is left (to the next worker that starts; at the deadline the rows go all the same). */
13
13
  export declare const DEADLINE_TRIES = 10;
14
+ /**
15
+ * How long past its deadline (the stored one, so that a restart of the worker does not start it again) a follow goes on trying while Claw
16
+ * cannot answer a read or the chat refuses a line: then the rest is said to be open (or not, if nothing could be said) and the rows go, so
17
+ * that no follow outlives its deadline by more than this and a worker's own count of tries, whatever its restarts do. A worker that starts
18
+ * after it reads once and tries to say once more.
19
+ */
20
+ export declare const DEADLINE_GRACE_SECONDS = 3600;
14
21
  export declare class AskerFollow {
15
22
  private readonly deps;
16
23
  private readonly cards;
@@ -37,15 +44,32 @@ export declare class AskerFollow {
37
44
  /** Reads each open item's view every `viewMs`; news is held a little, then said in one message. */
38
45
  private watch;
39
46
  private tryFlush;
40
- /** The deadline: what is held is said, then that the rest is still open; the rows go once the asker has been told. */
47
+ /**
48
+ * The deadline: what is held is said, then that the rest is still open; the rows go once the asker has been told (or the tries ran out, or
49
+ * `end` came).
50
+ */
41
51
  private atDeadline;
52
+ /** The follow is over: none of its rows is kept. */
53
+ private letGo;
42
54
  /** The asker's view of one item now; undefined when it is not followed any more, "running" for a moment's trouble. */
43
55
  private viewOf;
56
+ /** One round, never the end of the follow (the items run in Claw all the same); false when a view could not be read or the round failed. */
57
+ private safeRound;
58
+ /**
59
+ * Reads each open item's view and says what is due; false when a view could not be read just now (a moment's trouble). Only that: news
60
+ * that could not be said (a chat that is gone) is held for the next round and leaves the views as read as they were.
61
+ */
44
62
  private round;
45
63
  /** An item the asker stopped on its card: that card is left as the press made it, and said there. */
46
64
  private endStopped;
47
65
  /** What one view is: news to hold, back to what was said, a start, or an end. */
48
66
  private note;
67
+ /**
68
+ * What the view's stage is to the asker: news to hold for the next message, a change they are not told (an approval not merged yet, that
69
+ * the review started) or back to what was said. A change not told is kept as what was seen, so that a later message counts the review
70
+ * right, and it lets go of news held from before it. Returns the stage.
71
+ */
72
+ private holdNews;
49
73
  /** Says the held news in one message; what is said is recorded first, and put back when the message did not go. */
50
74
  private flush;
51
75
  /** A line for the asker where they asked: in a group it @mentions them (and only them). */
@@ -23,6 +23,12 @@ export declare class ReviewLaunch {
23
23
  private nothingStarted;
24
24
  /** The acknowledgement: one message for several reviews, else at the top of the review's progress message. */
25
25
  private acknowledge;
26
+ /**
27
+ * Whether the receipt of a request the person's coordinator sent for them says anything: Claw sums up how it ended, so only what they
28
+ * must act on is said: a review that waits for a slot, one that did not start, a number that was not read as a pull request, and a
29
+ * reviewer who cannot be reached for a confirmation (`other`).
30
+ */
31
+ private needsWords;
26
32
  private severalText;
27
33
  /** A turn for each review of one's own; the asker follows the reviews asked of someone else together. */
28
34
  private run;
@@ -23,9 +23,6 @@ export declare class Notices {
23
23
  personalChatOf(person: Actor, via: ConversationRef): Promise<Conversation | undefined>;
24
24
  /** The reviewer's own 1:1 chat. */
25
25
  reviewerChat(review: ReviewTurn): Promise<Conversation | undefined>;
26
- tellReviewer(review: ReviewTurn, text: string): Promise<void>;
27
- /** The reviewer hears, in their own chat, that someone asked a review of them and that it is an item on their board. */
28
- tellReviewerStarted(review: ReviewTurn): Promise<void>;
29
26
  /** The reviewer's item as Claw shows it to them, read with their own key; undefined when it cannot be. */
30
27
  private reviewersItem;
31
28
  /** The reviewer's item waits for them: what it asks and how to answer, with the item's card when it can be read as them. */
@@ -120,7 +120,7 @@ export declare class StatusMessage<S> {
120
120
  /**
121
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
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
123
+ * part out of sight ("(cont. 2/2)" under a queued message's notice, part 1 above both). So nothing of the agent's goes
124
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
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
126
  * When it comes while the answer is going out (its first part in the bubble already), the whole answer is sent again below.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primusclaw/personal-agent",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "description": "The personal agent's channel-neutral core: domain logic, ports and plugin interfaces.",
5
5
  "license": "MIT",
6
6
  "repository": {