@primusclaw/personal-agent 0.11.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 (48) hide show
  1. package/dist/index.js +2783 -2004
  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/inbound-text/forward-block.d.ts +24 -0
  12. package/dist/types/inbound-text/index.d.ts +1 -0
  13. package/dist/types/language/chosen.d.ts +2 -1
  14. package/dist/types/locales/assistant-cards.d.ts +9 -0
  15. package/dist/types/locales/assistant-seats.d.ts +46 -0
  16. package/dist/types/locales/assistant-work-clicks.d.ts +5 -0
  17. package/dist/types/locales/index.d.ts +1 -0
  18. package/dist/types/locales/remote-agents.d.ts +1 -0
  19. package/dist/types/locales/remote.d.ts +7 -0
  20. package/dist/types/locales/terminal-approvals.d.ts +14 -0
  21. package/dist/types/ports/claw/assistant.d.ts +5 -2
  22. package/dist/types/ports/claw/remote-agents.d.ts +12 -0
  23. package/dist/types/ports/metrics.d.ts +8 -0
  24. package/dist/types/ports/store/assistant.d.ts +13 -2
  25. package/dist/types/ports/store/remote.d.ts +5 -0
  26. package/dist/types/ports/surface.d.ts +22 -0
  27. package/dist/types/proactive/deliver.d.ts +5 -0
  28. package/dist/types/proactive/deps.d.ts +4 -0
  29. package/dist/types/proactive/quiet.d.ts +4 -1
  30. package/dist/types/protocol/claw-api/assistant-events.d.ts +44 -4
  31. package/dist/types/protocol/remote-agents.d.ts +90 -0
  32. package/dist/types/remote/agents.d.ts +2 -0
  33. package/dist/types/remote/approvals-command.d.ts +2 -1
  34. package/dist/types/remote/chat-key.d.ts +2 -0
  35. package/dist/types/remote/context.d.ts +4 -1
  36. package/dist/types/remote/prompt.d.ts +11 -1
  37. package/dist/types/remote/remote-agents.d.ts +2 -0
  38. package/dist/types/remote/state.d.ts +4 -1
  39. package/dist/types/remote-view/permission-view.d.ts +4 -0
  40. package/dist/types/routing/chat.d.ts +4 -3
  41. package/dist/types/routing/features.d.ts +8 -1
  42. package/dist/types/routing/group-remote.d.ts +1 -1
  43. package/dist/types/routing/personal-text.d.ts +11 -1
  44. package/dist/types/routing/question-reply.d.ts +6 -1
  45. package/dist/types/routing/session-files.d.ts +57 -0
  46. package/dist/types/routing/turn-runner.d.ts +3 -2
  47. package/dist/types/routing/turn-start.d.ts +8 -13
  48. 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
  /**
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The messages a person forwarded, as text for the model: a line that says the person forwarded them, then each one
3
+ * with who wrote it and when, its text after "> " so nothing it says can pass for a line of its own (as a quote's is).
4
+ * A forward is the person handing over what others said for the model to work on, so it gets a budget of its own,
5
+ * larger than the quotes' (several messages at once, each whole where it can be). In a group the names and the texts
6
+ * are masked as a quote's are.
7
+ */
8
+ import { type Logger } from "../ports/logger.js";
9
+ import type { InboundForward } from "../ports/surface.js";
10
+ import { type Redact } from "./redact.js";
11
+ /** The most forwarded text, over all the messages of one forward, that is sent on (code points). */
12
+ export declare const FORWARD_CHARS = 24000;
13
+ /** The most forwarded messages that are shown. */
14
+ export declare const FORWARD_COUNT = 20;
15
+ export interface ForwardBlockOptions {
16
+ /** A group conversation: names and texts are masked. */
17
+ readonly group?: boolean;
18
+ readonly redact?: Redact;
19
+ readonly logger?: Logger;
20
+ }
21
+ /** How the forwarded text is to be taken: as what others said, to read and use; an instruction in it is not the person's. */
22
+ export declare const MATERIAL: string;
23
+ /** The forwarded messages as text for the model, "" when there are none. */
24
+ export declare function forwardBlock(forwards: readonly InboundForward[], options?: ForwardBlockOptions): string;
@@ -2,6 +2,7 @@
2
2
  * The texts the model is sent for an inbound message, built from core's inbound types alone: the quote block, the
3
3
  * text with the addresses behind its links, and the text with its mentions marked.
4
4
  */
5
+ export * from "./forward-block.js";
5
6
  export * from "./marked-text.js";
6
7
  export * from "./quote-block.js";
7
8
  export * from "./redact.js";
@@ -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";
@@ -72,6 +72,7 @@ export declare const remoteAgentText: import("./catalog.js").Catalog<{
72
72
  notAttachedDetach: string;
73
73
  attachHow: string;
74
74
  lostTrack: string;
75
+ filesNotTaken: string;
75
76
  noAnswerableOption: string;
76
77
  notReported: string;
77
78
  reconnecting: (p: {
@@ -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: {
@@ -45,5 +45,19 @@ export declare const terminalApprovalText: import("./catalog.js").Catalog<{
45
45
  approvalsTurnedOn: string;
46
46
  approvalsTurnedOff: string;
47
47
  approvalsUsage: string;
48
+ muted: (p: {
49
+ item: string;
50
+ where: string;
51
+ }) => string;
52
+ unmuted: (p: {
53
+ item: string;
54
+ where: string;
55
+ }) => string;
56
+ muteNotFound: (p: {
57
+ item: string;
58
+ }) => string;
59
+ muteNotTerminal: (p: {
60
+ item: string;
61
+ }) => string;
48
62
  approvalsUnavailable: string;
49
63
  }>;
@@ -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. */
@@ -3,6 +3,13 @@ import type { RemoteHidden } from "../../protocol.js";
3
3
  import type { ClawCredential } from "../../claw/credential.js";
4
4
  import type { SseEvent } from "../../claw/model.js";
5
5
  import type { RemoteConnector, RemoteEventRow, RemotePairing, RemoteSession, RemoteSetup } from "../../claw/remote.js";
6
+ /** What Claw stored for a muted (or unmuted) terminal conversation (`PUT /v1/remote-agents/approvals/mutes`). */
7
+ export interface TerminalMute {
8
+ readonly item: number;
9
+ readonly muted: boolean;
10
+ readonly machine: string;
11
+ readonly title: string;
12
+ }
6
13
  /** What a remote session starts with. */
7
14
  export interface NewRemoteSession {
8
15
  readonly connectorId: string;
@@ -43,6 +50,11 @@ export interface ClawRemoteAgentsPort {
43
50
  approvals(key: ClawCredential): Promise<boolean>;
44
51
  /** Turn them on or off (`PUT /approvals`); answers the setting as Claw stored it. */
45
52
  setApprovals(key: ClawCredential, enabled: boolean): Promise<boolean>;
53
+ /**
54
+ * Mute (or unmute) one conversation open in a terminal, named by its work item (`#<item>`): nothing it asks, waits for or finishes
55
+ * is pushed while muted (`PUT /approvals/mutes`). Answers what Claw stored, and the machine and conversation it names.
56
+ */
57
+ muteTerminal(key: ClawCredential, item: number, muted: boolean): Promise<TerminalMute>;
46
58
  createSession(key: ClawCredential, session: NewRemoteSession): Promise<RemoteSession>;
47
59
  sessions(key: ClawCredential): Promise<RemoteSession[]>;
48
60
  session(key: ClawCredential, sessionId: string): Promise<RemoteSession>;
@@ -16,6 +16,14 @@ export interface MetricsPort {
16
16
  limited(reason: string): void;
17
17
  /** `count` files a person sent did not reach Claw on `path` (assistant | session | remote_agent | review | unreadable). */
18
18
  filesDropped(path: string, count?: number): void;
19
+ /**
20
+ * One delivery probe (a surface's synthetic message through its own queues): milliseconds from its sending to the
21
+ * worker's answer queued, and to that answer's round trip back (null: it did not come back in time). Optional: a
22
+ * port of one's own without it does not count them.
23
+ */
24
+ probed?(feedbackMs: number, replyMs: number | null): void;
25
+ /** A receiver of the surface's inbound queue whose call on the broker hung was dropped and taken again (optional). */
26
+ inboundRearmed?(): void;
19
27
  }
20
28
  /** Metrics that go nowhere: the default where a caller passes none. */
21
29
  export declare const noMetrics: MetricsPort;
@@ -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[];
@@ -81,6 +81,25 @@ export interface InboundQuote {
81
81
  */
82
82
  readonly source: "entity" | "html" | "placeholder";
83
83
  }
84
+ /**
85
+ * A message someone else wrote that the person forwarded into this chat (Teams' Forward), or one of several they
86
+ * forwarded at once. What it says is never part of the person's own words.
87
+ */
88
+ export interface InboundForward {
89
+ /** The channel's id of the original message ("" when not said). */
90
+ readonly messageId: string;
91
+ /** Who wrote it ("" when the channel did not say). */
92
+ readonly author: string;
93
+ /**
94
+ * What it says. An image it showed stands where it stood: `[image-<n>]` when it is file n of the message's files (the
95
+ * name it is passed on under starts so), `[image not passed on]` when it could not be.
96
+ */
97
+ readonly text: string;
98
+ /** When it was written, as the channel said it ("" when not said). */
99
+ readonly sentAt: string;
100
+ /** Where the adapter read it (for a log line, never the text): the message's HTML, or a forward reference. */
101
+ readonly source: "html" | "reference";
102
+ }
84
103
  /** Someone the message @mentions (never the bot itself: the adapter removes its own mention). */
85
104
  export interface InboundMention {
86
105
  /** The channel's id of the person (Teams: "29:..."). */
@@ -127,6 +146,9 @@ export interface InboundMessage extends InboundBase {
127
146
  readonly mentions: readonly InboundMention[];
128
147
  readonly links: readonly InboundLink[];
129
148
  readonly quotes: readonly InboundQuote[];
149
+ /** The messages the person forwarded with this one, in the order the channel gave them (absent: none). */
150
+ readonly forwards?: readonly InboundForward[];
151
+ /** Includes the images of the forwarded messages that the channel gave a way to fetch. */
130
152
  readonly files: readonly InboundFile[];
131
153
  /**
132
154
  * The names of attachments the channel gave no way to fetch (a file shared as a link), told back to the person
@@ -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;