@kana-ai/edgar-ext-slack 0.1.4 → 0.1.5

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.
@@ -130,13 +130,12 @@ export const tools = {
130
130
  ];
131
131
  const buttons = [...answers, ...open];
132
132
  const question = cutEscaped(`${EMOJI.waiting} ${escape(input.question)}`, SECTION_CHARS - 1).text;
133
- const small = page === undefined ? `${how} ${SAYS.reach(ctx.run_id)}` : how;
134
133
  const blocks = [
135
134
  { type: "section", text: { type: "mrkdwn", text: question } },
136
135
  ...(buttons.length === 0 ? [] : [{ type: "actions", elements: buttons }]),
137
- { type: "context", elements: [{ type: "mrkdwn", text: small }] },
136
+ { type: "context", elements: [{ type: "mrkdwn", text: how }] },
138
137
  ];
139
- const text = [question, small, ...(page === undefined ? [] : [link(page, SAYS.run)])].join("\n");
138
+ const text = [question, how, ...(page === undefined ? [] : [link(page, SAYS.run)])].join("\n");
140
139
  const sent = await post(ctx, input.channel, input.thread, text, {
141
140
  blocks,
142
141
  metadata: mark("edgar_ask", { key }),
@@ -9,6 +9,7 @@ export declare const EMOJI: {
9
9
  readonly working: ":hourglass_flowing_sand:";
10
10
  readonly waiting: ":raised_hand:";
11
11
  readonly decision: ":raised_hand:";
12
+ readonly handed: ":raised_hand:";
12
13
  readonly waits: ":hourglass:";
13
14
  readonly done: ":white_check_mark:";
14
15
  readonly opened: ":eyes:";
@@ -22,6 +23,8 @@ export declare const EMOJI: {
22
23
  };
23
24
  /** What a person reads for each stage of the built-in workflows, in place of its id. A stage with no entry reads as its id in words: `rebuild_index` is "Rebuild index". */
24
25
  export declare const STAGE: Readonly<Record<string, string>>;
26
+ /** The moving line under the thread while a long stage of the built-in workflows works, which Slack shows after the app's name: "Edgar is working out a plan…". A stage with no entry is "is on it:" and its label. */
27
+ export declare const MOVING: Readonly<Record<string, string>>;
25
28
  /** What a stage that waits is waiting on, for the stages of the built-in workflows; `person` marks the one wait that a person ends. */
26
29
  export declare const WAITS: Readonly<Record<string, {
27
30
  readonly label: string;
@@ -29,6 +32,12 @@ export declare const WAITS: Readonly<Record<string, {
29
32
  }>>;
30
33
  /** The stage of the built-in workflows that waits for a review of the pull request. When it starts to wait, people are told one time that the pull request is ready for them. */
31
34
  export declare const REVIEW_WAIT = "wait_review";
35
+ /** What EDGAR says in the thread of a person whose words started a run, when a stage of the built-in `answer` workflow acts on them: `started` when the stage starts, `done` when it ends done, followed by the text of its output's `says` field when it has one. So each action a reply in Slack asks for is said where it was asked, not only on the card. */
36
+ export declare const ACTED: Readonly<Record<string, {
37
+ readonly started?: string;
38
+ readonly done?: string;
39
+ readonly says?: string;
40
+ }>>;
32
41
  /** The built-in workflows whose run is an answer to a person: a comment on a card, and a chat with no card. Their failure is one plain line in the thread the person wrote in. */
33
42
  export declare const ANSWER_FLOWS: ReadonlySet<string>;
34
43
  /** The lines that go on a card with a person's words from Slack, so the role that answers reads the talk around them. */
@@ -42,6 +51,8 @@ export declare const CONTEXT: {
42
51
  };
43
52
  /** What progress says in the thread a person wrote in, when EDGAR answers there. */
44
53
  export declare const ANSWER: {
54
+ readonly unsure: ":warning: I'm not fully sure about this one, so please check it before you rely on it.";
55
+ readonly sources: (list: string) => string;
45
56
  readonly said: (user: string | undefined, text: string) => string;
46
57
  readonly failed: (why: string) => string;
47
58
  readonly opened: (card: string) => string;
@@ -56,26 +67,60 @@ interface NoteWords {
56
67
  }
57
68
  /** What the end note of each kind says, in the voice of a teammate. */
58
69
  export declare const NOTE: Readonly<Record<EndNote["what"], NoteWords>>;
70
+ /** The status of a card's first message in words beside its emoji: the title of the end note's kind once a run is over, else what EDGAR does now. */
71
+ export declare const STATUS: {
72
+ readonly working: "I'm on it";
73
+ readonly waiting: "Waiting for you";
74
+ readonly opened: string;
75
+ readonly merged: string;
76
+ readonly approved: string;
77
+ readonly changes: string;
78
+ readonly closed: string;
79
+ readonly decision: string;
80
+ readonly handed: string;
81
+ readonly waits: string;
82
+ readonly failed: string;
83
+ readonly stopped: string;
84
+ readonly done: string;
85
+ readonly recovered: string;
86
+ };
59
87
  /** The other words of the notes, of the approval question, and of a question of the `ask` tool. */
60
88
  export declare const SAYS: {
89
+ readonly behalf: (who: string) => string;
90
+ readonly behalfOwn: (who: string, what: string) => string;
91
+ readonly paid: (who: string, what: string) => string;
92
+ readonly paidOnly: (who: string, what: string) => string;
93
+ readonly holder: (who: string) => string;
94
+ readonly stopper: (who: string) => string;
95
+ readonly noReason: "The run stopped before it finished, and it left no reason I can read.";
61
96
  readonly willPost: (channel: string) => string;
62
97
  readonly posted: (channel: string) => string;
63
98
  readonly notPosted: (channel: string) => string;
64
99
  readonly greet: (who: string) => string;
100
+ readonly handedTo: (name: string, who: string) => string;
65
101
  readonly next: "Your move:";
66
- readonly replay: (check: string, run: string) => string;
102
+ readonly replay: (check: string) => string;
103
+ readonly tryAgain: "Try again";
104
+ readonly triedAgain: (user: string) => string;
105
+ readonly stop: "Stop";
106
+ readonly stoppedBy: (user: string) => string;
107
+ readonly stoppedWork: (name: string, who: string) => string;
67
108
  readonly more: "There's more to it, so follow the links below for the rest.";
68
109
  readonly unread: (run: string) => string;
69
- readonly reach: (run: string) => string;
70
110
  readonly detail: (stage: string | undefined, failure: string) => string;
71
111
  readonly approvedBy: (names: string) => string;
72
112
  readonly commit: (sha: string) => string;
73
113
  readonly card: "Open the card";
74
- readonly pull: (label: string) => string;
114
+ readonly pull: (label: string, many: boolean) => string;
115
+ readonly risk: (sentence: string) => string;
75
116
  readonly run: "See the run";
76
117
  readonly approvalTitle: "Quick one for you";
77
- readonly approval: (tool: string) => string;
78
- readonly approvalNext: (input: boolean) => "Hit Approve and I'll run it with the input below, or Deny and I'll skip it." | "Hit Approve and I'll run it, or Deny and I'll skip it.";
118
+ readonly approval: (doing: string, system: string | undefined) => string;
119
+ readonly approvalWhy: (policy: string | undefined) => "I ask because this project wants a person's OK before I do this." | "I ask because this project wants a person's OK each time before I do this." | "I ask because this project wants a person's OK once in each run before I do this.";
120
+ readonly approvalDetails: "If you approve, I'll do it with these details:";
121
+ readonly approvalRemoves: ":warning: This deletes or removes something, so please check it twice.";
122
+ readonly approvalMore: (count: number) => string;
123
+ readonly approvalNext: (input: boolean) => "Hit Approve and I'll do it with the details above, or Deny and I'll skip it." | "Hit Approve and I'll do it, or Deny and I'll skip it.";
79
124
  readonly approvalCut: (page: string) => string;
80
125
  readonly approvalTool: (tool: string, run: string) => string;
81
126
  readonly approve: "Approve";
@@ -86,13 +131,13 @@ export declare const SAYS: {
86
131
  readonly askPick: "Pick an answer below, and I'll carry on from there.";
87
132
  readonly askHere: "Reply here when you're ready, and I'll carry on from your answer.";
88
133
  readonly askThread: "Reply in this thread when you're ready, and I'll carry on from your answer.";
134
+ readonly askedAbove: "I need your call on the question above";
89
135
  };
90
- /** The words of the progress message: the status in words beside the emoji while the run waits its turn, while EDGAR works and when the run is over, short because the end note under it says why and what to do, the line of a run with no step yet, what a queued run waits on, the one line that stands for the done steps when there are many, a wait that the built-in table does not know, and the moving line under the thread. */
136
+ /** The words of the progress message: the status in words beside the emoji while the run waits its turn and while EDGAR works (once the run is over, the title of its end note's kind in `NOTE`, except a failure, whose status is short because the end note under it says why and what to do), the line of a run with no step yet, what a queued run waits on, the one line that stands for the done steps when there are many, a wait that the built-in table does not know, and the moving line under the thread. */
91
137
  export declare const PLAN: {
92
138
  readonly title: {
93
139
  readonly queued: "Queued";
94
140
  readonly working: "I'm on it";
95
- readonly done: "All done";
96
141
  readonly failed: "Ended early";
97
142
  };
98
143
  readonly started: "I'll show each step here as I go.";
@@ -106,6 +151,8 @@ export declare const REPLY: {
106
151
  readonly reading: "is reading your reply…";
107
152
  readonly readingMessage: "is reading your message…";
108
153
  readonly busy: "Got it. I'm still on your previous message, so I'll answer both together.";
154
+ readonly chatting: (thread: boolean) => "On it: reading the thread." | "On it: reading your message.";
155
+ readonly welcome: "You're welcome! Write here whenever you need me.";
109
156
  readonly bound: (card: string) => string;
110
157
  readonly threadUnread: (why: string) => string;
111
158
  readonly threadPrivate: "I only read a Slack thread you link when it's in this channel or a public one, so I've gone on without it.";
@@ -120,6 +167,8 @@ export declare const REPLY: {
120
167
  readonly notRelayed: (why: string) => string;
121
168
  readonly operatorsAnswer: "Only the project's operators can answer this one, so I've left it open for them.";
122
169
  readonly operatorsStop: "Only the project's operators can stop this work, so I'm carrying on. One of them can press stop.";
170
+ readonly operatorsReplay: "Only the project's operators can start this again, so I've left the button for them.";
171
+ readonly notReplayed: (why: string) => string;
123
172
  readonly operatorsChoose: "Only the project's operators can make this call, so I've left the buttons for them.";
124
173
  readonly toBeLetIn: (user: string) => string;
125
174
  readonly notChecked: (why: string) => string;
@@ -3,6 +3,7 @@ export const EMOJI = {
3
3
  working: ":hourglass_flowing_sand:",
4
4
  waiting: ":raised_hand:",
5
5
  decision: ":raised_hand:",
6
+ handed: ":raised_hand:",
6
7
  waits: ":hourglass:",
7
8
  done: ":white_check_mark:",
8
9
  opened: ":eyes:",
@@ -74,6 +75,36 @@ export const STAGE = {
74
75
  wait_review: "Wait for a review",
75
76
  wait_review_again: "Wait for a review after the fix",
76
77
  };
78
+ /** The moving line under the thread while a long stage of the built-in workflows works, which Slack shows after the app's name: "Edgar is working out a plan…". A stage with no entry is "is on it:" and its label. */
79
+ export const MOVING = {
80
+ analyze: "is looking into it…",
81
+ answer: "is working out an answer…",
82
+ checks: "is running the checks…",
83
+ classify: "is reading the card…",
84
+ classify_intent: "is reading your reply…",
85
+ final_checks: "is running the checks…",
86
+ fix: "is fixing what the review found…",
87
+ fix_pull_request: "is changing the pull request…",
88
+ implement: "is writing the change…",
89
+ investigate: "is looking into it…",
90
+ linked: "is reading the linked pull requests…",
91
+ open_pr: "is opening the pull request…",
92
+ other_services: "is changing the other services…",
93
+ postmortem: "is writing the postmortem…",
94
+ propose: "is working out a plan…",
95
+ push: "is pushing the branch…",
96
+ recheck: "is running the checks…",
97
+ repair: "is fixing what the checks found…",
98
+ review: "is reviewing the change…",
99
+ review_pull_request: "is reviewing the pull request…",
100
+ reviewer: "is reviewing the change…",
101
+ revise_review: "is making the changes the review asks for…",
102
+ verify: "is checking the fix…",
103
+ wait_ci: "is waiting for CI…",
104
+ wait_ci_again: "is waiting for CI…",
105
+ wait_green: "is waiting for CI to pass…",
106
+ work: "is getting to work on the card…",
107
+ };
77
108
  /** What a stage that waits is waiting on, for the stages of the built-in workflows; `person` marks the one wait that a person ends. */
78
109
  export const WAITS = {
79
110
  wait_ci: { label: "Waiting for CI", person: false },
@@ -85,6 +116,37 @@ export const WAITS = {
85
116
  };
86
117
  /** The stage of the built-in workflows that waits for a review of the pull request. When it starts to wait, people are told one time that the pull request is ready for them. */
87
118
  export const REVIEW_WAIT = "wait_review";
119
+ /** What EDGAR says in the thread of a person whose words started a run, when a stage of the built-in `answer` workflow acts on them: `started` when the stage starts, `done` when it ends done, followed by the text of its output's `says` field when it has one. So each action a reply in Slack asks for is said where it was asked, not only on the card. */
120
+ export const ACTED = {
121
+ held: { done: 'I\'ve paused the work on this card. Write "resume" here when it should go on.' },
122
+ resumed: { done: "I'm going on with the work on this card." },
123
+ learn: {
124
+ started: "Thanks, I'll learn from that. I'm writing it into this project's EDGAR files for a person to review.",
125
+ },
126
+ revise: {
127
+ started: "I'm changing the pull request as you asked. I'll tell you here once it's pushed.",
128
+ done: "I've pushed the change to the pull request.",
129
+ },
130
+ reviewer: {
131
+ started: "I'm reviewing the pull request now.",
132
+ done: "Here's my review, which is on the card too:",
133
+ says: "summary",
134
+ },
135
+ review_fix: {
136
+ started: "I'm fixing what my review found on the pull request.",
137
+ done: "I've pushed the fixes to the pull request.",
138
+ },
139
+ merge_unapproved: {
140
+ done: "I didn't merge the pull request: no review approves it yet. Ask me again once a reviewer approves it.",
141
+ },
142
+ merge_checks: {
143
+ started: "The pull request is approved. I'm waiting for its checks to pass before I merge it.",
144
+ },
145
+ merge_red: {
146
+ done: "I didn't merge the pull request: a check failed on it. Ask me again once its checks pass.",
147
+ },
148
+ merge: { done: "I've merged the pull request." },
149
+ };
88
150
  /** The built-in workflows whose run is an answer to a person: a comment on a card, and a chat with no card. Their failure is one plain line in the thread the person wrote in. */
89
151
  export const ANSWER_FLOWS = new Set(["answer", "chat"]);
90
152
  /** The lines that go on a card with a person's words from Slack, so the role that answers reads the talk around them. */
@@ -98,6 +160,8 @@ export const CONTEXT = {
98
160
  };
99
161
  /** What progress says in the thread a person wrote in, when EDGAR answers there. */
100
162
  export const ANSWER = {
163
+ unsure: ":warning: I'm not fully sure about this one, so please check it before you rely on it.",
164
+ sources: (list) => `Sources: ${list}`,
101
165
  said: (user, text) => user === undefined ? text : `<@${user}> ${text}`,
102
166
  failed: (why) => `I couldn't finish that answer: ${why.replace(/\.$/, "")}.`,
103
167
  opened: (card) => `That sounds like work, so I've opened card ${card} for it. I'll keep you posted in this thread.`,
@@ -161,6 +225,11 @@ export const NOTE = {
161
225
  ? "Reply in this thread and tell me what to do. I'll take it from there."
162
226
  : `Reply in this thread with ${numbersOf(options)}, and I'll take it from there.`,
163
227
  },
228
+ handed: {
229
+ title: "Over to a person",
230
+ said: (name) => `I've handed ${name} back.`,
231
+ next: undefined,
232
+ },
164
233
  waits: {
165
234
  title: "On hold",
166
235
  said: (name) => `I'm holding off on ${name} for now.`,
@@ -171,12 +240,12 @@ export const NOTE = {
171
240
  said: (name, pulls) => pulls === 0
172
241
  ? `I couldn't finish ${name}, and I didn't open a pull request.`
173
242
  : `I couldn't finish ${name}. I'd already opened ${pullsOf(pulls)} before it broke.`,
174
- next: (run) => `Once that's sorted, run \`edgar run replay ${run}\` and I'll give it another go.`,
243
+ next: () => "Once that's sorted, press Try again and I'll give it another go.",
175
244
  },
176
245
  stopped: {
177
246
  title: "Stopped",
178
247
  said: (name) => `Heads up: someone stopped my work on ${name} before I finished.`,
179
- next: undefined,
248
+ next: () => "Press Try again if it should start over.",
180
249
  },
181
250
  done: {
182
251
  title: "Done",
@@ -189,29 +258,67 @@ export const NOTE = {
189
258
  next: undefined,
190
259
  },
191
260
  };
261
+ /** The status of a card's first message in words beside its emoji: the title of the end note's kind once a run is over, else what EDGAR does now. */
262
+ export const STATUS = {
263
+ working: "I'm on it",
264
+ waiting: "Waiting for you",
265
+ opened: NOTE.opened.title,
266
+ merged: NOTE.merged.title,
267
+ approved: NOTE.approved.title,
268
+ changes: NOTE.changes.title,
269
+ closed: NOTE.closed.title,
270
+ decision: NOTE.decision.title,
271
+ handed: NOTE.handed.title,
272
+ waits: NOTE.waits.title,
273
+ failed: NOTE.failed.title,
274
+ stopped: NOTE.stopped.title,
275
+ done: NOTE.done.title,
276
+ recovered: NOTE.recovered.title,
277
+ };
192
278
  /** The other words of the notes, of the approval question, and of a question of the `ask` tool. */
193
279
  export const SAYS = {
280
+ behalf: (who) => `On behalf of ${who}`,
281
+ behalfOwn: (who, what) => `On behalf of ${who}, on their ${what}`,
282
+ paid: (who, what) => `on ${who}'s ${what}`,
283
+ paidOnly: (who, what) => `On ${who}'s ${what}`,
284
+ holder: (who) => `Assignee ${who}`,
285
+ stopper: (who) => `Stopped by ${who}`,
286
+ noReason: "The run stopped before it finished, and it left no reason I can read.",
194
287
  willPost: (channel) => `I'll post the result in ${channel} when the work is done.`,
195
288
  posted: (channel) => `I posted the result in ${channel}.`,
196
289
  notPosted: (channel) => `I couldn't post the result in ${channel}: I'm not in that channel, or Slack can't find it. Invite me there with \`/invite\`, then ask again.`,
197
290
  greet: (who) => `Hey ${who},`,
291
+ handedTo: (name, who) => `I've handed ${name} to ${who}.`,
198
292
  next: "Your move:",
199
- replay: (check, run) => `${check}, then run \`edgar run replay ${run}\` and I'll give it another go.`,
293
+ replay: (check) => `${check}, then press Try again and I'll give it another go.`,
294
+ tryAgain: "Try again",
295
+ triedAgain: (user) => `<@${user}> asked me to try again, so I'm starting now.`,
296
+ stop: "Stop",
297
+ stoppedBy: (user) => `<@${user}> asked me to stop, so I've stopped this run.`,
298
+ stoppedWork: (name, who) => `Heads up: ${who} stopped my work on ${name} before I finished.`,
200
299
  more: "There's more to it, so follow the links below for the rest.",
201
- unread: (run) => `Run ${run} is over, but I couldn't read how it ended. You can check it with \`edgar runs ${run}\`.`,
202
- reach: (run) => `No link for this one. You can see it with \`edgar runs ${run}\`.`,
300
+ unread: (run) => `Run ${run} is over, but I couldn't read how it ended.`,
203
301
  detail: (stage, failure) => stage === undefined ? `What I got back: ${failure}` : `Step ${stage} said: ${failure}`,
204
302
  approvedBy: (names) => `${names} approved it.`,
205
303
  commit: (sha) => `The merge commit is \`${sha}\`.`,
206
304
  card: "Open the card",
207
- pull: (label) => `Open ${label}`,
305
+ pull: (label, many) => many ? `Open pull request ${label}` : "Open pull request",
306
+ risk: (sentence) => `:warning: ${sentence}`,
208
307
  run: "See the run",
209
308
  approvalTitle: "Quick one for you",
210
- approval: (tool) => `Can I go ahead and run *${tool}*? I'll wait for your OK.`,
309
+ approval: (doing, system) => `Can I go ahead and *${doing}*${system === undefined ? "" : ` in ${system}`}? I'll wait for your OK.`,
310
+ approvalWhy: (policy) => policy === "always"
311
+ ? "I ask because this project wants a person's OK each time before I do this."
312
+ : policy === "once"
313
+ ? "I ask because this project wants a person's OK once in each run before I do this."
314
+ : "I ask because this project wants a person's OK before I do this.",
315
+ approvalDetails: "If you approve, I'll do it with these details:",
316
+ approvalRemoves: ":warning: This deletes or removes something, so please check it twice.",
317
+ approvalMore: (count) => `…and ${String(count)} more`,
211
318
  approvalNext: (input) => input
212
- ? "Hit Approve and I'll run it with the input below, or Deny and I'll skip it."
213
- : "Hit Approve and I'll run it, or Deny and I'll skip it.",
214
- approvalCut: (page) => `The input below is only its start. The whole thing is in the console, under ${page}.`,
319
+ ? "Hit Approve and I'll do it with the details above, or Deny and I'll skip it."
320
+ : "Hit Approve and I'll do it, or Deny and I'll skip it.",
321
+ approvalCut: (page) => `The details are only their start. The whole call is in the console, under ${page}.`,
215
322
  approvalTool: (tool, run) => `Tool \`${tool}\` · run ${run}`,
216
323
  approve: "Approve",
217
324
  deny: "Deny",
@@ -221,12 +328,13 @@ export const SAYS = {
221
328
  askPick: "Pick an answer below, and I'll carry on from there.",
222
329
  askHere: "Reply here when you're ready, and I'll carry on from your answer.",
223
330
  askThread: "Reply in this thread when you're ready, and I'll carry on from your answer.",
331
+ askedAbove: "I need your call on the question above",
224
332
  };
225
333
  /** The value EDGAR counts a run under when its input has no value at any field of its workflow's concurrency key. */
226
334
  const NO_VALUE = "null";
227
- /** The words of the progress message: the status in words beside the emoji while the run waits its turn, while EDGAR works and when the run is over, short because the end note under it says why and what to do, the line of a run with no step yet, what a queued run waits on, the one line that stands for the done steps when there are many, a wait that the built-in table does not know, and the moving line under the thread. */
335
+ /** The words of the progress message: the status in words beside the emoji while the run waits its turn and while EDGAR works (once the run is over, the title of its end note's kind in `NOTE`, except a failure, whose status is short because the end note under it says why and what to do), the line of a run with no step yet, what a queued run waits on, the one line that stands for the done steps when there are many, a wait that the built-in table does not know, and the moving line under the thread. */
228
336
  export const PLAN = {
229
- title: { queued: "Queued", working: "I'm on it", done: "All done", failed: "Ended early" },
337
+ title: { queued: "Queued", working: "I'm on it", failed: "Ended early" },
230
338
  started: "I'll show each step here as I go.",
231
339
  queued: (key, value, limit, workflow) => {
232
340
  const many = (one) => `${String(limit)} ${one}${limit === 1 ? "" : "s"}`;
@@ -248,6 +356,8 @@ export const REPLY = {
248
356
  reading: "is reading your reply…",
249
357
  readingMessage: "is reading your message…",
250
358
  busy: "Got it. I'm still on your previous message, so I'll answer both together.",
359
+ chatting: (thread) => thread ? "On it: reading the thread." : "On it: reading your message.",
360
+ welcome: "You're welcome! Write here whenever you need me.",
251
361
  bound: (card) => `Got it, thanks. I've put your message on card ${card} and I'm reading it now. Anything else you write in this thread goes there too.`,
252
362
  threadUnread: (why) => `I couldn't read the Slack thread you linked, so I've gone on without it. Here's what went wrong: ${why}`,
253
363
  threadPrivate: "I only read a Slack thread you link when it's in this channel or a public one, so I've gone on without it.",
@@ -262,6 +372,8 @@ export const REPLY = {
262
372
  notRelayed: (why) => `Sorry, I couldn't put your reply on the card. Here's what went wrong: ${why}`,
263
373
  operatorsAnswer: "Only the project's operators can answer this one, so I've left it open for them.",
264
374
  operatorsStop: "Only the project's operators can stop this work, so I'm carrying on. One of them can press stop.",
375
+ operatorsReplay: "Only the project's operators can start this again, so I've left the button for them.",
376
+ notReplayed: (why) => `Sorry, I couldn't start it again. Here's what went wrong: ${why}`,
265
377
  operatorsChoose: "Only the project's operators can make this call, so I've left the buttons for them.",
266
378
  toBeLetIn: (user) => `To be let in, add \`ids = { slack = "${user}" }\` to your \`[people.<name>]\` table in edgar.toml, and your name to \`[roles] operator\`.`,
267
379
  notChecked: (why) => `Sorry, I couldn't check whether you can do this, so nothing changed. Here's what went wrong: ${why}`,
@@ -26,6 +26,7 @@ export declare const config: z.ZodObject<{
26
26
  channel: z.ZodOptional<z.ZodString>;
27
27
  dm: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodEmail]>>>;
28
28
  people: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodEmail]>>>;
29
+ tag: z.ZodOptional<z.ZodArray<z.ZodString>>;
29
30
  close_on_done: z.ZodDefault<z.ZodBoolean>;
30
31
  console_url: z.ZodOptional<z.ZodURL>;
31
32
  status: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -61,6 +61,10 @@ export const config = z.strictObject({
61
61
  .record(z.string().min(1), person)
62
62
  .default({})
63
63
  .describe("Who the end note and an approval question mention: the name of a card's assignee, as the tracker gives it, to their Slack user id or email. Default none."),
64
+ tag: z
65
+ .array(z.string().min(1))
66
+ .optional()
67
+ .describe("The only people a message may tag, so only they are notified: each a name of `people` or `operators`, or a Slack user id. Everyone else is written as their name. Not set: everyone may be tagged. Empty: nobody is."),
64
68
  close_on_done: z
65
69
  .boolean()
66
70
  .default(false)
@@ -72,7 +76,7 @@ export const config = z.strictObject({
72
76
  status: z
73
77
  .record(z.string(), z.string().min(1))
74
78
  .default({})
75
- .describe('The phrase of the status line while a stage works, by stage name, such as fix = "is reading the code". A stage with no phrase shows "is on it:" and its label.'),
79
+ .describe('The phrase of the status line while a stage works, by stage name, such as fix = "is reading the code". A stage with no phrase shows the built-in phrase of a long stage, else "is on it:" and its label.'),
76
80
  });
77
81
  /** The table of a call, with its defaults; one that does not match is a permanent `invalid`. */
78
82
  export function settingsOf(value) {
@@ -5,22 +5,33 @@ export declare const slackOrigin: z.ZodObject<{
5
5
  channel: z.ZodString;
6
6
  thread: z.ZodString;
7
7
  }, z.core.$strip>;
8
- /** What started a run, from its `run_created` payload: `subrun:<parent>:<pass>` for a run that a stage of another run started, who the run's card is assigned to, as the tracker names them, its workflow, and the place of the words a service relayed to start it. */
8
+ /** What started a run, from its `run_created` payload: `subrun:<parent>:<pass>` for a run that a stage of another run started, who the run's card is assigned to, as the tracker names them, who asked for the work, by name and by their id in the service that opened the card for them, what the card asks, its workflow, and the place of the words a service relayed to start it. */
9
9
  export declare const runTrigger: z.ZodObject<{
10
10
  trigger_key: z.ZodOptional<z.ZodString>;
11
11
  assignee: z.ZodOptional<z.ZodString>;
12
+ requested_by: z.ZodOptional<z.ZodString>;
13
+ requested_by_id: z.ZodOptional<z.ZodString>;
14
+ ask: z.ZodOptional<z.ZodString>;
12
15
  workflow: z.ZodOptional<z.ZodString>;
13
16
  relayed: z.ZodOptional<z.ZodUnknown>;
14
17
  }, z.core.$loose>;
15
- /** The answer a done stage gave a person: an `attempt_outcome` payload whose output has a `text`, as the built-in `schemas/answer.json` makes it. */
18
+ /** The answer a done stage gave a person: an `attempt_outcome` payload whose output has a `text`, with the `sources` it rests on and whether it is `confident`, as the built-in `schemas/answer.json` makes it. A source or a flag of another shape is left out, so the answer still goes. */
16
19
  export declare const answerOutcome: z.ZodObject<{
17
20
  outcome: z.ZodObject<{
18
21
  outcome: z.ZodLiteral<"done">;
19
22
  output: z.ZodObject<{
20
23
  text: z.ZodString;
24
+ sources: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodString>>>;
25
+ confident: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
21
26
  }, z.core.$loose>;
22
27
  }, z.core.$loose>;
23
28
  }, z.core.$loose>;
29
+ /** The output of a stage, as far as the words a person reads of it go: an `attempt_outcome` payload whose output is an object. */
30
+ export declare const outputOutcome: z.ZodObject<{
31
+ outcome: z.ZodObject<{
32
+ output: z.ZodRecord<z.ZodString, z.ZodUnknown>;
33
+ }, z.core.$loose>;
34
+ }, z.core.$loose>;
24
35
  /** The card a done stage of a run with no card opened: an `attempt_outcome` payload whose output is the `id` that `tracker__create_card` gives. */
25
36
  export declare const openedOutcome: z.ZodObject<{
26
37
  outcome: z.ZodObject<{
@@ -39,6 +50,30 @@ export declare const questionOutcome: z.ZodObject<{
39
50
  }, z.core.$loose>;
40
51
  }, z.core.$loose>;
41
52
  }, z.core.$loose>;
53
+ /** A person a run names: their id in a service, such as `github`, `linear` or `slack`, their `email` or their `name`, and `why`. The engine adds the Slack id and the email of the person of `[people]` that one of these matches. */
54
+ export declare const reachable: z.ZodRecord<z.ZodString, z.ZodString>;
55
+ /** The people that a done stage named as able to act on its question: the `who_can_act` of its output, none when it has none or they do not read. */
56
+ export declare const actorsOutcome: z.ZodObject<{
57
+ outcome: z.ZodObject<{
58
+ output: z.ZodObject<{
59
+ who_can_act: z.ZodCatch<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodString>>>;
60
+ }, z.core.$loose>;
61
+ }, z.core.$loose>;
62
+ }, z.core.$loose>;
63
+ /** Who asked for the work, from a `run_created` payload: by name and by their id in the service that opened the card, with the engine's match in `[people]` as `requester`. */
64
+ export declare const runRequester: z.ZodObject<{
65
+ requested_by: z.ZodOptional<z.ZodString>;
66
+ requested_by_id: z.ZodOptional<z.ZodString>;
67
+ requester: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
68
+ }, z.core.$loose>;
69
+ /** What the end of a run says of its question: the question, the people its newest output named as able to act, and when the run began, in Unix milliseconds, from a `run_outcome` payload. */
70
+ export declare const endActors: z.ZodObject<{
71
+ end: z.ZodObject<{
72
+ question: z.ZodOptional<z.ZodString>;
73
+ started: z.ZodOptional<z.ZodNumber>;
74
+ who_can_act: z.ZodCatch<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodString>>>;
75
+ }, z.core.$loose>;
76
+ }, z.core.$loose>;
42
77
  /** A done stage whose output names the chat channel that a person asked to get the result in: the `post_in` of a classification. */
43
78
  export declare const postOutcome: z.ZodObject<{
44
79
  outcome: z.ZodObject<{
@@ -96,12 +131,40 @@ export declare const outcomeRecord: z.ZodObject<{
96
131
  /** The first message of a card's thread: the card's link and the runs whose messages go in the thread, newest last. */
97
132
  export declare const cardRoot: z.ZodObject<{
98
133
  card: z.ZodString;
134
+ title: z.ZodOptional<z.ZodString>;
99
135
  runs: z.ZodArray<z.ZodString>;
100
136
  }, z.core.$loose>;
101
- /** The part of an `approval_requested` payload the question reads. `assignee` is who the run's card is assigned to, as the tracker names them. */
137
+ /** The person of `[people]` whose own key or subscription a run ran on, from the `end` of its `run_outcome`: their name, the kind of credential, the provider, and the Slack id and email that the engine found for them. */
138
+ export declare const endPaid: z.ZodObject<{
139
+ end: z.ZodObject<{
140
+ paid_by: z.ZodObject<{
141
+ name: z.ZodString;
142
+ credential: z.ZodString;
143
+ provider: z.ZodOptional<z.ZodString>;
144
+ slack: z.ZodOptional<z.ZodString>;
145
+ email: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$loose>;
147
+ }, z.core.$loose>;
148
+ }, z.core.$loose>;
149
+ /** What a card's first message shows besides the card, kept in its metadata so a change of one part keeps the others: the status of the card's newest run, what the card asks, who asked for the work and who holds the card, each as Slack writes them, whose own key or subscription the run ran on (`paid`) and what it was (`paid_with`), such as "Claude subscription", and the pull requests to open. */
150
+ export declare const rootView: z.ZodObject<{
151
+ status: z.ZodOptional<z.ZodString>;
152
+ ask: z.ZodOptional<z.ZodString>;
153
+ by: z.ZodOptional<z.ZodString>;
154
+ paid: z.ZodOptional<z.ZodString>;
155
+ paid_with: z.ZodOptional<z.ZodString>;
156
+ holder: z.ZodOptional<z.ZodString>;
157
+ pulls: z.ZodOptional<z.ZodArray<z.ZodObject<{
158
+ url: z.ZodString;
159
+ label: z.ZodString;
160
+ }, z.core.$strip>>>;
161
+ }, z.core.$strip>;
162
+ export type RootView = z.infer<typeof rootView>;
163
+ /** The part of an `approval_requested` payload the question reads. `policy` is how often the project asks, and `assignee` is who the run's card is assigned to, as the tracker names them. */
102
164
  export declare const approvalRequested: z.ZodObject<{
103
165
  operation_id: z.ZodString;
104
166
  tool: z.ZodString;
167
+ policy: z.ZodCatch<z.ZodOptional<z.ZodString>>;
105
168
  input: z.ZodOptional<z.ZodUnknown>;
106
169
  assignee: z.ZodOptional<z.ZodString>;
107
170
  }, z.core.$loose>;
@@ -5,20 +5,31 @@ export const slackOrigin = z.object({
5
5
  channel: z.string().min(1),
6
6
  thread: z.string().min(1),
7
7
  });
8
- /** What started a run, from its `run_created` payload: `subrun:<parent>:<pass>` for a run that a stage of another run started, who the run's card is assigned to, as the tracker names them, its workflow, and the place of the words a service relayed to start it. */
8
+ /** What started a run, from its `run_created` payload: `subrun:<parent>:<pass>` for a run that a stage of another run started, who the run's card is assigned to, as the tracker names them, who asked for the work, by name and by their id in the service that opened the card for them, what the card asks, its workflow, and the place of the words a service relayed to start it. */
9
9
  export const runTrigger = z.looseObject({
10
10
  trigger_key: z.string().optional(),
11
11
  assignee: z.string().min(1).optional(),
12
+ requested_by: z.string().min(1).optional(),
13
+ requested_by_id: z.string().min(1).optional(),
14
+ ask: z.string().min(1).optional(),
12
15
  workflow: z.string().min(1).optional(),
13
16
  relayed: z.unknown().optional(),
14
17
  });
15
- /** The answer a done stage gave a person: an `attempt_outcome` payload whose output has a `text`, as the built-in `schemas/answer.json` makes it. */
18
+ /** The answer a done stage gave a person: an `attempt_outcome` payload whose output has a `text`, with the `sources` it rests on and whether it is `confident`, as the built-in `schemas/answer.json` makes it. A source or a flag of another shape is left out, so the answer still goes. */
16
19
  export const answerOutcome = z.looseObject({
17
20
  outcome: z.looseObject({
18
21
  outcome: z.literal("done"),
19
- output: z.looseObject({ text: z.string().min(1) }),
22
+ output: z.looseObject({
23
+ text: z.string().min(1),
24
+ sources: z.array(z.string()).optional().catch(undefined),
25
+ confident: z.boolean().optional().catch(undefined),
26
+ }),
20
27
  }),
21
28
  });
29
+ /** The output of a stage, as far as the words a person reads of it go: an `attempt_outcome` payload whose output is an object. */
30
+ export const outputOutcome = z.looseObject({
31
+ outcome: z.looseObject({ output: z.record(z.string(), z.unknown()) }),
32
+ });
22
33
  /** The card a done stage of a run with no card opened: an `attempt_outcome` payload whose output is the `id` that `tracker__create_card` gives. */
23
34
  export const openedOutcome = z.looseObject({
24
35
  outcome: z.looseObject({
@@ -33,6 +44,28 @@ export const questionOutcome = z.looseObject({
33
44
  output: z.looseObject({ question: z.string().trim().min(1) }),
34
45
  }),
35
46
  });
47
+ /** A person a run names: their id in a service, such as `github`, `linear` or `slack`, their `email` or their `name`, and `why`. The engine adds the Slack id and the email of the person of `[people]` that one of these matches. */
48
+ export const reachable = z.record(z.string(), z.string());
49
+ /** The people that a done stage named as able to act on its question: the `who_can_act` of its output, none when it has none or they do not read. */
50
+ export const actorsOutcome = z.looseObject({
51
+ outcome: z.looseObject({
52
+ output: z.looseObject({ who_can_act: z.array(reachable).catch([]) }),
53
+ }),
54
+ });
55
+ /** Who asked for the work, from a `run_created` payload: by name and by their id in the service that opened the card, with the engine's match in `[people]` as `requester`. */
56
+ export const runRequester = z.looseObject({
57
+ requested_by: z.string().min(1).optional(),
58
+ requested_by_id: z.string().min(1).optional(),
59
+ requester: reachable.optional().catch(undefined),
60
+ });
61
+ /** What the end of a run says of its question: the question, the people its newest output named as able to act, and when the run began, in Unix milliseconds, from a `run_outcome` payload. */
62
+ export const endActors = z.looseObject({
63
+ end: z.looseObject({
64
+ question: z.string().optional(),
65
+ started: z.number().optional(),
66
+ who_can_act: z.array(reachable).catch([]),
67
+ }),
68
+ });
36
69
  /** A done stage whose output names the chat channel that a person asked to get the result in: the `post_in` of a classification. */
37
70
  export const postOutcome = z.looseObject({
38
71
  outcome: z.looseObject({
@@ -64,11 +97,38 @@ export const reviewOutcome = z.looseObject({
64
97
  /** The outcome word of an `attempt_outcome` or `run_outcome` payload. */
65
98
  export const outcomeRecord = z.looseObject({ outcome: z.looseObject({ outcome: z.string() }) });
66
99
  /** The first message of a card's thread: the card's link and the runs whose messages go in the thread, newest last. */
67
- export const cardRoot = z.looseObject({ card: z.string(), runs: z.array(z.string()) });
68
- /** The part of an `approval_requested` payload the question reads. `assignee` is who the run's card is assigned to, as the tracker names them. */
100
+ export const cardRoot = z.looseObject({
101
+ card: z.string(),
102
+ title: z.string().optional(),
103
+ runs: z.array(z.string()),
104
+ });
105
+ /** The person of `[people]` whose own key or subscription a run ran on, from the `end` of its `run_outcome`: their name, the kind of credential, the provider, and the Slack id and email that the engine found for them. */
106
+ export const endPaid = z.looseObject({
107
+ end: z.looseObject({
108
+ paid_by: z.looseObject({
109
+ name: z.string().min(1),
110
+ credential: z.string(),
111
+ provider: z.string().min(1).optional(),
112
+ slack: z.string().optional(),
113
+ email: z.string().optional(),
114
+ }),
115
+ }),
116
+ });
117
+ /** What a card's first message shows besides the card, kept in its metadata so a change of one part keeps the others: the status of the card's newest run, what the card asks, who asked for the work and who holds the card, each as Slack writes them, whose own key or subscription the run ran on (`paid`) and what it was (`paid_with`), such as "Claude subscription", and the pull requests to open. */
118
+ export const rootView = z.object({
119
+ status: z.string().optional(),
120
+ ask: z.string().optional(),
121
+ by: z.string().optional(),
122
+ paid: z.string().optional(),
123
+ paid_with: z.string().optional(),
124
+ holder: z.string().optional(),
125
+ pulls: z.array(z.object({ url: z.string(), label: z.string() })).optional(),
126
+ });
127
+ /** The part of an `approval_requested` payload the question reads. `policy` is how often the project asks, and `assignee` is who the run's card is assigned to, as the tracker names them. */
69
128
  export const approvalRequested = z.looseObject({
70
129
  operation_id: z.string().min(1),
71
130
  tool: z.string().min(1),
131
+ policy: z.string().optional().catch(undefined),
72
132
  input: z.unknown().optional(),
73
133
  assignee: z.string().min(1).optional(),
74
134
  });