@primusclaw/personal-agent 0.12.0 → 0.13.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 +2038 -1635
  2. package/dist/types/assistant/actions.d.ts +8 -1
  3. package/dist/types/assistant/confirm-outcome.d.ts +5 -2
  4. package/dist/types/assistant/events.d.ts +34 -4
  5. package/dist/types/assistant/say.d.ts +5 -2
  6. package/dist/types/assistant/seat-dispatch-outcome.d.ts +8 -0
  7. package/dist/types/assistant/seat-outcome.d.ts +4 -0
  8. package/dist/types/assistant/views.d.ts +21 -0
  9. package/dist/types/claw/model.d.ts +10 -0
  10. package/dist/types/claw/work-item.d.ts +17 -1
  11. package/dist/types/language/chosen.d.ts +2 -1
  12. package/dist/types/locales/assistant-cards.d.ts +9 -0
  13. package/dist/types/locales/assistant-seats.d.ts +46 -0
  14. package/dist/types/locales/assistant-work-clicks.d.ts +5 -0
  15. package/dist/types/locales/index.d.ts +1 -0
  16. package/dist/types/locales/remote.d.ts +7 -0
  17. package/dist/types/ports/claw/assistant.d.ts +5 -2
  18. package/dist/types/ports/store/assistant.d.ts +13 -2
  19. package/dist/types/ports/store/remote.d.ts +5 -0
  20. package/dist/types/proactive/deliver.d.ts +5 -0
  21. package/dist/types/proactive/deps.d.ts +4 -0
  22. package/dist/types/proactive/quiet.d.ts +4 -1
  23. package/dist/types/protocol/claw-api/assistant-events.d.ts +44 -4
  24. package/dist/types/protocol/remote-agents.d.ts +57 -0
  25. package/dist/types/remote/chat-key.d.ts +2 -0
  26. package/dist/types/remote/context.d.ts +4 -1
  27. package/dist/types/remote/state.d.ts +4 -1
  28. package/dist/types/remote-view/permission-view.d.ts +4 -0
  29. package/dist/types/routing/chat.d.ts +4 -3
  30. package/dist/types/routing/question-reply.d.ts +6 -1
  31. package/dist/types/routing/turn-runner.d.ts +3 -2
  32. package/dist/types/routing/turn-start.d.ts +8 -13
  33. package/package.json +1 -1
@@ -50,9 +50,16 @@ export declare class AssistantActions {
50
50
  private run;
51
51
  /**
52
52
  * Allow or Deny (`op`) on a write Claw holds until the person answers. The card must be the presser's and not yet used; what it
53
- * answers is the recorded confirmation, as the person with their exchanged token. Of two presses exactly one is sent.
53
+ * answers is the recorded confirmation, as the person with their exchanged token. Of two presses exactly one is sent. On a choice
54
+ * card (places to pick from) Allow carries the place's index (`pick`): the place Claw is told was picked is read from the record,
55
+ * and a press that names none of its places sends nothing.
54
56
  */
55
57
  confirmClick(click: CardClick): Promise<void>;
58
+ /**
59
+ * The held write a press answers, how, and (a choice card's Allow) the place it picked; undefined when the press answers nothing
60
+ * (the presser was told why): not the presser's card, not a held write, used already, or a place the card does not offer.
61
+ */
62
+ private pressed;
56
63
  /** The presser's exchanged token; undefined when it cannot be had (the card was answered with why, as it was). */
57
64
  private token;
58
65
  /** Claw did not answer, or refused: a 403 or 404 ends the card (pressing again cannot help); anything else gives it back. */
@@ -15,6 +15,9 @@ export declare function isGithubWrite(kind: string): boolean;
15
15
  * (`POST /v1/github-review/confirmations/:id/decision`: `merged`, `queued`, `submitted`, `denied`, `stale`, `expired`, `refused`, `retry`).
16
16
  */
17
17
  export declare function githubWriteOutcome(kind: string, out: Fields, lang: Lang): string;
18
- /** What came of a press on a held write's card of `kind`, in one line: Claw's answer said plainly. */
19
- export declare function confirmOutcome(kind: string, out: Fields, lang: Lang): string;
18
+ /**
19
+ * What came of a press on a held write's card of `kind`, in one line: Claw's answer said plainly. `picked`: the label of the place a
20
+ * choice card's press picked ("" none).
21
+ */
22
+ export declare function confirmOutcome(kind: string, out: Fields, lang: Lang, picked?: string): string;
20
23
  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", "github_merge", "github_review"];
16
+ export declare const CONFIRM_KINDS: readonly ["trigger_create", "trigger_cancel", "devenv_send", "github_comment", "devenv_hide", "skill_save", "seat_role", "seat_set", "seat_dispatch", "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>>;
@@ -29,12 +29,30 @@ export interface ConfirmAction {
29
29
  * whole); undefined when it carries none that could be one. `exactCommand` is the router's test of a command typed whole.
30
30
  */
31
31
  export declare function confirmActionOf(event: Event, exactCommand: (text: string) => boolean): ConfirmAction | undefined;
32
+ /** One place a seat dispatch's choice card offers (`confirm_write.options`): what a press answers with, and what it shows. */
33
+ export interface ConfirmOption {
34
+ /** What Claw is told was picked (a seat's id, or `sandbox`). */
35
+ readonly id: string;
36
+ /** The name the person gave the seat, else `<machine>/<agent>`: the button's words. */
37
+ readonly label: string;
38
+ /** The folder, as the machine reported it ("" none): shown as text only. */
39
+ readonly detail: string;
40
+ }
41
+ /** The fewest and the most places a seat dispatch's choice card offers (Claw sends 2 to 5). */
42
+ export declare const CONFIRM_OPTIONS_MIN = 2;
43
+ export declare const CONFIRM_OPTIONS_MAX = 5;
32
44
  export interface ConfirmWrite {
33
45
  readonly confirmationId: string;
34
46
  readonly kind: (typeof CONFIRM_KINDS)[number];
35
47
  readonly allowLabel: string;
48
+ /** A choice card (`seat_dispatch` only): one button per option; absent for a card that is let through or not. */
49
+ readonly options?: readonly ConfirmOption[];
36
50
  }
37
- /** The write Claw holds for the person (`confirm_write` of an `assistant.say`); undefined when it carries none this worker draws. */
51
+ /**
52
+ * The write Claw holds for the person (`confirm_write` of an `assistant.say`); undefined when it carries none this worker draws. A
53
+ * seat dispatch that offers places it cannot read whole is none (its words still name them, for the person to answer in the chat):
54
+ * a card without them could only send a choice Claw refuses.
55
+ */
38
56
  export declare function confirmWriteOf(event: Event): ConfirmWrite | undefined;
39
57
  /**
40
58
  * The suggested replies under an `assistant.say` (none under anything else, or with the style off): Claw's own, each one plain
@@ -87,8 +105,11 @@ export interface SayChoice {
87
105
  */
88
106
  export declare function choiceOf(event: Event): SayChoice | undefined;
89
107
  export interface RemoteNotice {
90
- /** `resolved`: a question a terminal asked no longer waits here (answered there, or given up); `resolved` says which. */
91
- readonly kind: "done" | "needs_you" | "error" | "resolved";
108
+ /**
109
+ * `resolved`: a question a terminal asked no longer waits here (answered there, or given up); `resolved` says which. `progress`:
110
+ * the hourly line of a task handed to a seat that has run more than an hour (its words say all).
111
+ */
112
+ readonly kind: "done" | "needs_you" | "error" | "resolved" | "progress";
92
113
  readonly sessionId: string;
93
114
  readonly ask: Event | undefined;
94
115
  readonly machine: string;
@@ -98,6 +119,15 @@ export interface RemoteNotice {
98
119
  readonly actionId: string;
99
120
  readonly by: string;
100
121
  };
122
+ /** A task the assistant handed to a seat: its item number (`#N`); undefined for a session's own message. */
123
+ readonly itemSeq?: number;
124
+ /** A task the assistant handed to a seat: the name the person gave that seat ("" none). */
125
+ readonly seatAlias?: string;
126
+ /**
127
+ * The request outlived its first wait and the agent keeps waiting until `ask.expires_at` (`ask.parked`): the one reminder of a
128
+ * request whose card may be in the chat already.
129
+ */
130
+ readonly parked?: boolean;
101
131
  }
102
132
  /** What an `assistant.say` says of an agent session on the person's machine, or undefined for any other message. */
103
133
  export declare function remoteNoticeOf(event: Event): RemoteNotice | undefined;
@@ -4,8 +4,11 @@
4
4
  * - What was said, whole and once: a long text is split into up to three messages at paragraph breaks, never cut, after what the
5
5
  * receipt already shows of it (`shown`). It is an AI answer: the AI label and the thumbs under it, a citation for each source it
6
6
  * cites as [n], and the replies to tap under the last of its messages when no card follows.
7
- * - When the event's item holds a result that waits, a card with Accept and Stop; when it holds a write for the person, a card
8
- * that lets it through or not; when it puts a command to the person, a card with Run and Cancel; when it puts a choice to the
7
+ * - When the event's item holds a result that waits, a card with Accept and Stop; when Claw delivered the result without an Accept,
8
+ * a card that says so (only for a say that puts no choice and offers no replies of its own; one that does keeps its choice card and
9
+ * replies), with the pull request it still watches and that a reply changes it (none for the system's own notice, whose
10
+ * words say all that); when it holds a write for the person, a card
11
+ * that lets it through or not (a seat dispatch that offers several places: a button for each, and Cancel); when it puts a command to the person, a card with Run and Cancel; when it puts a choice to the
9
12
  * person, a card with the options and Send; when it is about one of the person's skills, the skill's card with Undo and Edit,
10
13
  * or a draft's with Save and Discard (each recorded first, so its buttons mean something). A card holds the words only when they
11
14
  * are short and not shown already; a skill's card always does.
@@ -0,0 +1,8 @@
1
+ import type { Lang } from "../locales/lang.js";
2
+ type Fields = Readonly<Record<string, unknown>>;
3
+ /**
4
+ * What came of the press: `picked` is the label of the place a choice card's press picked ("" for a card of one place), said when
5
+ * Claw names no seat back.
6
+ */
7
+ export declare function seatDispatchOutcome(status: string, out: Fields, lang: Lang, picked?: string): string;
8
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { Lang } from "../locales/lang.js";
2
+ type Fields = Readonly<Record<string, unknown>>;
3
+ export declare function seatOutcome(kind: "seat_role" | "seat_set", status: string, out: Fields, lang: Lang): string;
4
+ export {};
@@ -20,6 +20,17 @@ export interface WorkCardModel {
20
20
  /** "zh" or "en"; null to follow what was said, or the item's title. */
21
21
  readonly lang: string | null;
22
22
  }
23
+ /**
24
+ * A result Claw delivered without an Accept (`WorkItem.delivered`), in place of the card that asked for one: the version, the pull
25
+ * request the item still watches, and that a reply changes it. No buttons: nothing waits for the person.
26
+ */
27
+ export interface WorkDeliveredModel {
28
+ readonly item: WorkItem;
29
+ /** What the assistant said about it ("" when said apart). */
30
+ readonly text: string;
31
+ /** "zh" or "en"; null to follow what was said, or the item's title. */
32
+ readonly lang: string | null;
33
+ }
23
34
  /** What replaces a work card after Accept or Stop went through (render.work_done_card). */
24
35
  export interface WorkDoneModel {
25
36
  /** "Accepted" (the version is said), or how it ended otherwise. */
@@ -68,6 +79,15 @@ export interface ConfirmWriteModel {
68
79
  readonly allowLabel: string;
69
80
  /** What is held (`github_merge`, `trigger_create`, ...): a merge's other button says "Don't merge". Absent: "Don't". */
70
81
  readonly kind?: string;
82
+ /**
83
+ * A choice card (`seat_dispatch` with several places): a button for each, in this order, and Cancel instead of Allow and Deny.
84
+ * A button carries the card and the place's index; what Claw is told was picked is read from the card's record. Absent or empty:
85
+ * Allow and Deny.
86
+ */
87
+ readonly options?: readonly {
88
+ readonly label: string;
89
+ readonly detail: string;
90
+ }[];
71
91
  readonly lang: string;
72
92
  }
73
93
  /** A choice the assistant put to the person: its options as radio buttons (or check boxes) and Send. */
@@ -98,6 +118,7 @@ declare module "../ports/surface.js" {
98
118
  board: BoardModel;
99
119
  confirmWrite: ConfirmWriteModel;
100
120
  workCard: WorkCardModel;
121
+ workDelivered: WorkDeliveredModel;
101
122
  workDone: WorkDoneModel;
102
123
  workNote: WorkNoteModel;
103
124
  }
@@ -32,6 +32,16 @@ export interface WorkItem {
32
32
  readonly pull: PullRef | null;
33
33
  /** When Claw last changed it (ISO 8601; "" not said). */
34
34
  readonly updatedAt: string;
35
+ /**
36
+ * A result Claw delivered without an Accept, while the item stands delivered (closed by it, or open only to watch a pull
37
+ * request); absent or null otherwise, and from a Claw that does not deliver.
38
+ */
39
+ readonly delivered?: Delivered | null;
40
+ }
41
+ /** A result Claw delivered without an Accept: its version, and the pull requests (owner/repo#123) the item still watches. */
42
+ export interface Delivered {
43
+ readonly version: number;
44
+ readonly watching: readonly string[];
35
45
  }
36
46
  /**
37
47
  * What Claw answered to a person's accept, stop or retry: `ok`, or a 409 that says why not (`error`) and carries the item
@@ -1,4 +1,20 @@
1
- import type { AskerView, PullRef, WorkItem } from "./model.js";
1
+ import type { AskerView, Delivered, PullRef, WorkItem } from "./model.js";
2
+ /** `{ delivered }` when there is one, else nothing: an item that is not delivered reads as it did before. */
3
+ export declare function delivery(d: Delivered | null): {
4
+ delivered?: Delivered;
5
+ };
6
+ /**
7
+ * A result Claw delivered without an Accept, while the item stands delivered: as an event's item says it (`delivered_version`,
8
+ * `watching_pr`), else as a board row's state and `params` show it (closed as accepted with `params.delivered`, or open with
9
+ * `params.watching_pr`). Null when it does not, and for anything malformed.
10
+ */
11
+ export declare function deliveredOf(item: {
12
+ readonly board_state?: string | undefined;
13
+ readonly outcome?: string | undefined;
14
+ readonly params?: Readonly<Record<string, unknown>> | undefined;
15
+ readonly delivered_version?: unknown;
16
+ readonly watching_pr?: unknown;
17
+ }): Delivered | null;
2
18
  /** The pull request of a review item (`params.pr`); null for anything else, or for one that is not a pull request. */
3
19
  export declare function pullOf(params: Readonly<Record<string, unknown>> | undefined): PullRef | null;
4
20
  /**
@@ -6,7 +6,8 @@
6
6
  * choice, nothing is sent, and Claw reads the language from the message as before. To the assistant the choice goes in the
7
7
  * message's `channel_context` (`reply_language`); to a plain session (a 1:1 chat without the assistant) as the line Claw's
8
8
  * assistant uses for it, after the message (`replyLanguageLine`). A group's turn carries the group's language in that line
9
- * instead (`groupChosenLang`), or with none set the language the asker writes in: in a group a person's own choice is not read.
9
+ * instead (`groupChosenLang`), or with none set the language the asker writes in, else English: in a group a person's own
10
+ * choice is not read.
10
11
  */
11
12
  import type { Lang } from "../locales/lang.js";
12
13
  /** What of a person's preferences says the choice (`Prefs.lang`, `Prefs.langSet`). */
@@ -4,6 +4,15 @@ export declare const assistantCardText: import("./catalog.js").Catalog<{
4
4
  }) => string;
5
5
  waiting: string;
6
6
  replyForChanges: string;
7
+ /** A result Claw delivered without an Accept: its version, and the pull request the item still watches. */
8
+ delivered: (p: {
9
+ version: number;
10
+ }) => string;
11
+ deliveredWatching: (p: {
12
+ version: number;
13
+ pulls: string;
14
+ }) => string;
15
+ replyToChange: string;
7
16
  accept: (p: {
8
17
  version: number;
9
18
  }) => string;
@@ -0,0 +1,46 @@
1
+ export declare const seatOutcomeText: import("./catalog.js").Catalog<{
2
+ kept: (p: {
3
+ what: string;
4
+ }) => string;
5
+ alreadyAnswered: string;
6
+ retired: string;
7
+ denied: string;
8
+ expired: string;
9
+ stale: string;
10
+ gone: string;
11
+ failed: (p: {
12
+ why: string;
13
+ }) => string;
14
+ }>;
15
+ /**
16
+ * A task the assistant hands to a seat (`seat_dispatch`): its card (one place, or a choice of several places) and what came of a
17
+ * press on it, in one line.
18
+ */
19
+ export declare const seatDispatchText: import("./catalog.js").Catalog<{
20
+ choiceTitle: string;
21
+ cancel: string;
22
+ sent: (p: {
23
+ who: string;
24
+ seq: string;
25
+ }) => string;
26
+ queued: (p: {
27
+ who: string;
28
+ why: string;
29
+ seq: string;
30
+ position: string;
31
+ ahead: string;
32
+ }) => string;
33
+ busy: string;
34
+ inTerminal: string;
35
+ offline: string;
36
+ theSeat: string;
37
+ notSent: string;
38
+ alreadyAnswered: string;
39
+ expired: string;
40
+ notOnCard: string;
41
+ failed: (p: {
42
+ why: string;
43
+ }) => string;
44
+ }>;
45
+ /** Why Claw did not send a task to a seat (`result.error` of a `seat_dispatch` decision), as the person reads it. */
46
+ export declare const SEAT_DISPATCH_FAILED: Readonly<Record<string, Readonly<Record<"en" | "zh", string>>>>;
@@ -76,6 +76,11 @@ export declare const workClickText: import("./catalog.js").Catalog<{
76
76
  label: string;
77
77
  outcome: string;
78
78
  }) => string;
79
+ /** An Accept pressed on a card drawn before Claw delivered the result by itself. */
80
+ alreadyDelivered: (p: {
81
+ label: string;
82
+ version: number;
83
+ }) => string;
79
84
  waitingVersion: (p: {
80
85
  label: string;
81
86
  version: number;
@@ -10,6 +10,7 @@ export * from "./assistant-board.js";
10
10
  export * from "./assistant-cards.js";
11
11
  export * from "./assistant-chat.js";
12
12
  export * from "./assistant-devenv-hide.js";
13
+ export * from "./assistant-seats.js";
13
14
  export * from "./assistant-work-clicks.js";
14
15
  export * from "./assistant.js";
15
16
  export * from "./skills.js";
@@ -31,6 +31,13 @@ export declare const remoteText: import("./catalog.js").Catalog<{
31
31
  until: string;
32
32
  zone: string;
33
33
  }) => string;
34
+ seatNeedsApproval: (p: {
35
+ seat: string;
36
+ }) => string;
37
+ stillWaiting: (p: {
38
+ until: string;
39
+ zone: string;
40
+ }) => string;
34
41
  alwaysChanges: string;
35
42
  needsApproval: string;
36
43
  waitsForYou: (p: {
@@ -42,8 +42,11 @@ export interface ClawAssistantPort {
42
42
  send(key: ClawCredential, sessionId: string, text: string, options?: AssistantMessageOptions): Promise<string | null>;
43
43
  /** The caller's brief, put together now: `{date, lang, sections, needs_you, text}`. */
44
44
  brief(key: ClawCredential, lang: string, timezone: string): Promise<JsonObject>;
45
- /** The person's answer to a held write the assistant put to them (`allow` or `deny`); exchanged token only. */
46
- decideConfirmation(token: ClawCredential, confirmationId: string, decision: string): Promise<JsonObject>;
45
+ /**
46
+ * The person's answer to a held write the assistant put to them (`allow` or `deny`); exchanged token only. `choice`: on a choice
47
+ * card's `allow`, the id of the place picked (sent only when given).
48
+ */
49
+ decideConfirmation(token: ClawCredential, confirmationId: string, decision: string, choice?: string): Promise<JsonObject>;
47
50
  /** Reviews as `actingAs`, each a work item. ReviewsRefused: none started. ClawError(404): a Claw without the route. */
48
51
  startReviews(token: ClawCredential, request: StartReviews): Promise<ReviewStart[]>;
49
52
  /** Makes the key owner's watcher of `scope` observe it. */
@@ -49,13 +49,24 @@ export interface ConfirmCard {
49
49
  readonly cardId: string;
50
50
  readonly userId: string;
51
51
  readonly confirmationId: string;
52
- /** trigger_create | trigger_cancel | devenv_send | github_comment */
52
+ /** trigger_create | trigger_cancel | devenv_send | github_comment | seat_dispatch | ... */
53
53
  readonly kind: string;
54
54
  /** What the button that lets it through says. */
55
55
  readonly label: string;
56
+ /**
57
+ * A choice card's places (`seat_dispatch`), in the card's order: a button carries only the card and the place's index here, and
58
+ * what Claw is told was picked is read from this record. Empty for a card that is let through or not.
59
+ */
60
+ readonly options: readonly ConfirmCardOption[];
56
61
  readonly state: CardState;
57
62
  readonly createdAt: number;
58
63
  }
64
+ /** One place a choice card offers: what Claw is told was picked, and what the card showed for it. */
65
+ export interface ConfirmCardOption {
66
+ readonly id: string;
67
+ readonly label: string;
68
+ readonly detail: string;
69
+ }
59
70
  /** A choice the assistant put to the person: what was asked, the options, and (once sent) what was picked. */
60
71
  export interface ChoiceCard {
61
72
  readonly cardId: string;
@@ -105,7 +116,7 @@ export interface AssistantButtonRepository {
105
116
  /** Null once it is older than ASSISTANT_MESSAGE_KEEP_SECONDS. */
106
117
  getActionCard(cardId: string): ActionCard | null;
107
118
  moveActionCard(cardId: string, state: CardState, options?: MoveOptions): boolean;
108
- addConfirmCard(userId: string, confirmationId: string, kind: string, label?: string): string;
119
+ addConfirmCard(userId: string, confirmationId: string, kind: string, label?: string, options?: readonly ConfirmCardOption[]): string;
109
120
  /** Null once it is older than CONFIRM_CARD_KEEP_SECONDS. */
110
121
  getConfirmCard(cardId: string): ConfirmCard | null;
111
122
  moveConfirmCard(cardId: string, state: CardState, options?: MoveOptions): boolean;
@@ -117,6 +117,11 @@ export interface NewRemotePermission {
117
117
  export interface RemotePermissionRepository {
118
118
  /** Recorded before it is shown; false when this request already has a row. */
119
119
  saveRemotePermission(permission: NewRemotePermission): boolean;
120
+ /**
121
+ * A request the agent keeps waiting on past its first wait (parked): pending again until `expiresAt`, unless it was answered or an
122
+ * answer is on its way. True when it waits now.
123
+ */
124
+ keepRemotePermission(sessionId: string, actionId: string, expiresAt: number): boolean;
120
125
  getRemotePermission(sessionId: string, actionId: string): RemotePermission | null;
121
126
  /** Pending and not run out, oldest first. */
122
127
  pendingRemotePermissions(userId: string, sessionId: string): RemotePermission[];
@@ -63,6 +63,11 @@ export declare class Deliveries {
63
63
  * or it ran out while held), undefined when it offers nothing that can be answered (its words go as they are).
64
64
  */
65
65
  private sendRemoteAsk;
66
+ /**
67
+ * The one reminder of a request the agent keeps waiting on (parked) whose card the person was shown already: it waits again until
68
+ * the longer wait ends, unless it was answered (or an answer is on its way). True when it does, and its card comes again.
69
+ */
70
+ private keptParked;
66
71
  /**
67
72
  * A question a terminal asked no longer waits here (`resolved`): answered at the terminal, or given up. Its card is edited in
68
73
  * place to say so, without its buttons, and a click on it is told the same. True when that is done (or there is nothing to
@@ -20,6 +20,10 @@ export interface RemoteAskRequest {
20
20
  readonly agent: string;
21
21
  /** Which work item asks ("#seq title"; "" none). */
22
22
  readonly about: string;
23
+ /** The name the person gave the seat the task was handed to (absent: none); the card's title names it. */
24
+ readonly seat?: string;
25
+ /** The one reminder of a request the agent keeps waiting on (`ask.parked`): the card says it still waits, until when. */
26
+ readonly parked?: boolean;
23
27
  readonly expiresAt: number;
24
28
  readonly zone: string;
25
29
  readonly lang: string;
@@ -23,5 +23,8 @@ export declare function muted(prefs: Prefs, now: number): Muted | undefined;
23
23
  export declare function isoSeconds(raw: unknown): number | undefined;
24
24
  /** When an approval event runs out: its `approval.expires_at`, else APPROVAL_DEFAULT_SECONDS from now. */
25
25
  export declare function approvalExpiry(event: Readonly<Record<string, unknown>>, now: number): number;
26
- /** When a pushed permission request runs out: its `expires_at`, at most an hour on; else PERMISSION_DEFAULT_SECONDS from now. */
26
+ /**
27
+ * When a pushed permission request runs out: its `expires_at`, at most an hour on (a day for a parked one); else
28
+ * PERMISSION_DEFAULT_SECONDS from now.
29
+ */
27
30
  export declare function remoteAskExpiry(ask: Readonly<Record<string, unknown>>, now: number): number;
@@ -76,10 +76,34 @@ export interface AssistantConfirmWrite {
76
76
  * started for the person's own account holds for them (`claw_github_confirmations`, `assistant/review-items.ts`); the same decision
77
77
  * route answers it, and it is made exactly as `POST /v1/github-review/confirmations/{confirmation_id}/decision` makes it.
78
78
  */
79
- kind: "trigger_create" | "trigger_cancel" | "github_comment" | "devenv_send" | "devenv_hide" | "skill_save" | "github_merge" | "github_review";
79
+ kind: "trigger_create" | "trigger_cancel" | "github_comment" | "devenv_send" | "devenv_hide" | "skill_save" | "seat_role" | "seat_set" | "seat_dispatch" | "github_merge" | "github_review";
80
80
  /** What the button that lets it through says, in the language of the text. */
81
81
  allow_label: string;
82
82
  expires_at: string;
83
+ /**
84
+ * Only on `seat_dispatch` when the router named several places a task could go (2 to 5): a choice card. A channel draws one button per
85
+ * option and one that cancels (`deny`); the button carries only the card, and the channel reads which option it was from its own record
86
+ * of the card, then posts `{decision: "allow", choice: option.id}`. Claw checks the choice is one it offered. A channel that cannot draw
87
+ * buttons shows the text; the person names the place in the chat.
88
+ */
89
+ options?: AssistantConfirmOption[];
90
+ }
91
+ /** One place a `seat_dispatch` choice card offers. */
92
+ export interface AssistantConfirmOption {
93
+ /** Opaque, at most 64 characters (a seat's id, or `sandbox`). */
94
+ id: string;
95
+ /** The name the person confirmed for the seat, else `<machine>/<agent>`: one plain line of at most 40 code points. */
96
+ label: string;
97
+ /** The folder, as the machine reported it: shown as text only. */
98
+ detail?: string;
99
+ }
100
+ /**
101
+ * The body of `POST /v1/assistant/confirmations/{confirmation_id}/decision`. `choice` only on a card with `options`, and required there
102
+ * for `allow`: the `id` of the option picked.
103
+ */
104
+ export interface AssistantConfirmationDecision {
105
+ decision: "allow" | "deny";
106
+ choice?: string;
83
107
  }
84
108
  /**
85
109
  * A personal skill as a message shows it (`assistant/skill-writes.ts`): what was just saved, changed, turned off or deleted at the
@@ -147,9 +171,10 @@ export interface AssistantRemoteNotice {
147
171
  /**
148
172
  * `resolved` (only for a terminal's request, `ask.origin` "terminal"): a request this channel was sent as a card was answered, or stopped
149
173
  * waiting, somewhere else (`resolved`), so a channel that still shows that card marks it so in place; the text says the same in one line
150
- * for a channel that does not.
174
+ * for a channel that does not. `progress` (only for a task the assistant handed to a seat): the hourly line of a task that has run
175
+ * more than an hour, naming its latest step.
151
176
  */
152
- kind: "done" | "needs_you" | "error" | "resolved";
177
+ kind: "done" | "needs_you" | "error" | "resolved" | "progress";
153
178
  session_id: string;
154
179
  machine: string;
155
180
  agent: string;
@@ -159,11 +184,21 @@ export interface AssistantRemoteNotice {
159
184
  */
160
185
  tool?: "claude" | "codex" | "cursor";
161
186
  ask?: AssistantRemoteAsk;
162
- /** With `kind: "resolved"`: which request, and who ended it (`terminal`, or `timeout`, `session_end`, `connector_restart` when nobody did). */
187
+ /**
188
+ * With `kind: "resolved"`: which request, and who ended it (`terminal`, or `timeout`, `park_expired`, `session_end`, `connector_restart`
189
+ * when nobody did).
190
+ */
163
191
  resolved?: {
164
192
  action_id: string;
165
193
  by: string;
166
194
  };
195
+ /** A task the assistant handed to a seat: its item number (`#N`). Absent for a session's own message. */
196
+ item_seq?: number;
197
+ /** A task the assistant handed to a seat: which seat; `alias` is the name the person confirmed for it, null when none. */
198
+ seat?: {
199
+ seat_id: string;
200
+ alias: string | null;
201
+ };
167
202
  }
168
203
  /** A permission request a development environment's agent waits on (`permissionRequest`), as its connector posted it. */
169
204
  export interface AssistantRemoteAsk {
@@ -203,6 +238,11 @@ export interface AssistantRemoteAsk {
203
238
  * which withdraws the card (Codex).
204
239
  */
205
240
  terminal_asks?: TerminalAsks;
241
+ /**
242
+ * The request outlived its first wait and the connector keeps waiting (a task the assistant handed to a seat): `expires_at` is then
243
+ * when that longer wait ends. The one reminder Claw sends for it carries this.
244
+ */
245
+ parked?: true;
206
246
  }
207
247
  /** When a terminal asks a request that is also on a card, besides alongside it: see {@link AssistantRemoteAsk.terminal_asks}. */
208
248
  export type TerminalAsks = "after_card" | "on_input";
@@ -70,6 +70,19 @@ export declare function connectorVersionStatus(version: string | null | undefine
70
70
  export declare const REMOTE_EVENT_PERMISSION_REQUEST = "permissionRequest";
71
71
  export declare const REMOTE_EVENT_PERMISSION_RESOLVED = "permission_resolved";
72
72
  export declare const REMOTE_EVENT_SESSION_CLOSED = "session_closed";
73
+ /**
74
+ * A permission request of a turn sent with `park_permissions` outlived the connector's own wait (`permissionTtlMs`): instead of refusing
75
+ * it, the connector keeps it open until `parked_until` (at most {@link PERMISSION_PARK_MAX_MS} after it was asked), still answerable and
76
+ * cancellable as before. Data: `{actionId, cmd_seq, parked_until}` (`cmd_seq`: the prompt of the turn that asked, null when not known).
77
+ * When the park ends unanswered the connector refuses it and posts `permission_resolved` with `by: "park_expired"`.
78
+ */
79
+ export declare const REMOTE_EVENT_PERMISSION_PARKED = "permission_parked";
80
+ /** The longest a connector keeps a parked permission request open (see {@link REMOTE_EVENT_PERMISSION_PARKED}). */
81
+ export declare const PERMISSION_PARK_MAX_MS: number;
82
+ /**
83
+ * `permissionRequest` and `permission_parked` carry `cmd_seq`: the prompt of the turn that asked (absent from connector 0.3.1 and
84
+ * older). `permission_resolved.by` is `park_expired` when a parked request's park ended unanswered.
85
+ */
73
86
  /**
74
87
  * A turn of a conversation open in a terminal ended while nobody was at that terminal, posted on the conversation's terminal-hook
75
88
  * session (`origin` "terminal_hook") by its connector: `{ref, outcome: "done" | "error", error?, message, agent, cwd, ended_at,
@@ -114,7 +127,51 @@ export interface RemoteHeartbeat {
114
127
  cmdCursor: number | null;
115
128
  /** What the connector holds that Claw has not acknowledged yet (`outbox` on the wire); absent from an older connector. */
116
129
  outbox?: RemoteOutboxReport | null;
130
+ /**
131
+ * The git repository of each folder its sessions work in (`workspaces` on the wire, {@link parseWorkspacesReport}); absent (null)
132
+ * from a connector that does not report it, which is every connector before the agent capability `git_info`.
133
+ */
134
+ workspaces?: RemoteWorkspace[] | null;
117
135
  }
136
+ /**
137
+ * How much of the folders' git facts one heartbeat carries. A folder named by anyone, a remote and a branch named by whoever made the
138
+ * repository: each is cut to a shape that cannot carry more than a name, and the whole report is bounded.
139
+ */
140
+ export declare const REMOTE_WORKSPACE_LIMITS: {
141
+ /** Folders one heartbeat reports, at most. */
142
+ readonly maxEntries: 32;
143
+ readonly maxCwdChars: 1024;
144
+ /** A remote as {@link normalizeGitRemote} writes it: `host/owner/repo`. */
145
+ readonly maxRemoteChars: 200;
146
+ readonly maxBranchChars: 100;
147
+ };
148
+ /** One folder's git facts: the remote its `origin` names and the branch checked out, each null when there is none or it is unreadable. */
149
+ export interface RemoteWorkspace {
150
+ cwd: string;
151
+ git_remote: string | null;
152
+ git_branch: string | null;
153
+ }
154
+ /**
155
+ * A git remote as `host/owner/repo` (lower-case host, no scheme, no `.git`), or null when it is not a remote that can be written that
156
+ * way. Whatever names a person or carries a secret goes: the user (`git@`, `user:token@`), a query and a fragment; and a remote with a
157
+ * path segment shaped like a credential (`ghp_...`, a long opaque run) is no remote at all, never one with the secret cut out. A local
158
+ * path (`/srv/repo.git`, `file://`) is null: it names a folder on that machine, not a repository anyone else knows.
159
+ */
160
+ export declare function normalizeGitRemote(raw: unknown): string | null;
161
+ /**
162
+ * A remote as a connector reports it: already `host/owner/repo` ({@link normalizeGitRemote} on the machine), checked to be exactly
163
+ * that shape again; else null. A URL (a connector that sent one raw) is normalized here the same way.
164
+ */
165
+ export declare function normalizedRemote(raw: unknown): string | null;
166
+ /** A branch name as git allows it (and no more), or null: no `..`, no leading `-` or `/`, no control or space, at most 100 characters. */
167
+ export declare function normalizeGitBranch(raw: unknown): string | null;
168
+ /**
169
+ * The heartbeat's `workspaces`, or null when it is absent or not a list. Lenient, as the outbox report is: an entry that does not fit
170
+ * is left out, never a reason to refuse the heartbeat; a remote or a branch that does not normalize is null; at most
171
+ * {@link REMOTE_WORKSPACE_LIMITS.maxEntries} folders, each once. Normalized again here whatever the connector did: Claw never stores
172
+ * what it did not shape itself.
173
+ */
174
+ export declare function parseWorkspacesReport(raw: unknown): RemoteWorkspace[] | null;
118
175
  /** Sessions an outbox report names at most, the longest waiting first. */
119
176
  export declare const REMOTE_OUTBOX_REPORT_MAX_SESSIONS = 20;
120
177
  /** One session's part of an outbox report. */
@@ -10,4 +10,6 @@ export declare const GROUP_KEY_SEP = "#";
10
10
  export declare function groupChatKey(userId: string, conversationId: string): string;
11
11
  /** The person a chat key belongs to: the key itself for a 1:1 chat, the binder for a group's. */
12
12
  export declare function personOf(chatKey: string): string;
13
+ /** The group conversation a chat key binds ("" for a 1:1 chat's). */
14
+ export declare function groupConversationOf(chatKey: string): string;
13
15
  export declare function isGroupKey(chatKey: string): boolean;
@@ -7,6 +7,7 @@ import type { PublicErrors } from "../public-error/public-errors.js";
7
7
  import type { Clock } from "../ports/clock.js";
8
8
  import type { Logger } from "../ports/logger.js";
9
9
  import type { Random } from "../ports/random.js";
10
+ import type { GroupLanguageRepository } from "../ports/store/group-language.js";
10
11
  import type { ConversationRefRepository, PrefsRepository } from "../ports/store/people.js";
11
12
  import type { RemotePermissionRepository, RemoteSessionNameRepository, RemoteStateRepository } from "../ports/store/remote.js";
12
13
  import type { Conversation } from "../ports/surface.js";
@@ -69,6 +70,8 @@ export interface RemoteContext {
69
70
  readonly sessionNames: RemoteSessionNameRepository;
70
71
  readonly permissions: RemotePermissionRepository;
71
72
  readonly prefs: PrefsRepository;
73
+ /** The language each group chat's members set (none given: a group binding's texts are English). */
74
+ readonly groupLanguage?: GroupLanguageRepository;
72
75
  readonly references: ConversationRefRepository;
73
76
  /** The conversation a stored reference posts to. */
74
77
  conversationFor(reference: JsonObject): Conversation;
@@ -89,7 +92,7 @@ export interface RemoteContext {
89
92
  readonly logger: Logger;
90
93
  /** The hex digest of `text` (UTF-8): an idempotency key, a correlation id. */
91
94
  digestHex(algorithm: "sha1" | "sha256", text: string): string;
92
- /** The language a person is answered in. */
95
+ /** The language a person is answered in (their 1:1 chat's; a group binding's is the group's, `ChatState.lang`). */
93
96
  langOf(person: string): Lang;
94
97
  /** PA_DIRECT_CHAT: whose 1:1 chat is the agent's window itself. */
95
98
  readonly directChat: DirectChat;
@@ -12,7 +12,10 @@ export declare class ChatState {
12
12
  private readonly views;
13
13
  constructor(ctx: RemoteContext, chats: ChatRegistry);
14
14
  attached(chatKey: string): RemoteState | null;
15
- /** The language the chat is answered in ("en" when it cannot be read). */
15
+ /**
16
+ * The language the chat is answered in ("en" when it cannot be read): a 1:1 chat's is its person's; a group binding's is the
17
+ * group's, the one its members set (`/lang zh|en`, `groupLangOf`), else English, never the binder's own.
18
+ */
16
19
  lang(chatKey: string): Lang;
17
20
  /** PA_DIRECT_CHAT is on for this 1:1 chat's person (a group binding keeps its session card). */
18
21
  directOn(chatKey: string): boolean;