@noisybrood/cli 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,17 +14,18 @@ writes to you, how often, who has gone quiet, and what Brood has decided about
14
14
  each. It never reads a message. The index holds no subject, no body and no
15
15
  attachment, so there is nothing of what anyone wrote for it to show you.
16
16
 
17
- It changes your mailbox in three ways only: `brood hush` and `brood unhush`,
18
- which file a sender's mail and bring it back, and `brood keep add`, which adds
19
- addresses and domains to the list of senders Brood never files. Each needs you
20
- to have signed in with that permission.
17
+ It changes your mailbox only when you tell it to: `brood hush`, `brood unhush`
18
+ and `brood proposals file` file a sender's mail or bring it back, `brood
19
+ unsubscribe` asks a sender to stop writing, and `brood keep add` adds addresses
20
+ and domains to the list of senders Brood never files. Each needs you to have
21
+ signed in with that permission.
21
22
 
22
23
  ## Install
23
24
 
24
25
  It needs Node 24 or later.
25
26
 
26
27
  ```
27
- npm install --global @noisybrood/cli@0.2.0
28
+ npm install --global @noisybrood/cli@0.4.0
28
29
  ```
29
30
 
30
31
  Name the version. Each one published is fixed once it is on npm, and carries
@@ -1,4 +1,5 @@
1
1
  import { APP_ORIGIN } from "./origin.js";
2
+ import { APPROVAL_SAID, REQUEST_SAID } from "./values.js";
2
3
  /**
3
4
  * What a client of the API needs, and nothing of how the app answers (#1408):
4
5
  * where to call and sign in, each operation's arguments and answer, and the
@@ -19,6 +20,18 @@ export const SIGN_IN = {
19
20
  issuer: "https://clerk.app.noisybrood.com",
20
21
  clients: { cli: "P029s9c7VAQInceB" },
21
22
  };
23
+ /**
24
+ * Where a request stands, as the app, the command line and an agent say it
25
+ * (D28 §2): waiting, what came of it once approved, with why where Brood
26
+ * refused it, or that nothing changed.
27
+ */
28
+ export const requestSaid = (r) => r.state !== "approved"
29
+ ? REQUEST_SAID[r.state]
30
+ : !r.outcome
31
+ ? REQUEST_SAID.under_way
32
+ : r.refused
33
+ ? `${APPROVAL_SAID[r.outcome]} ${PROBLEM_TITLES[r.refused].title}.`
34
+ : APPROVAL_SAID[r.outcome];
22
35
  /** The codes a problem carries, which clients branch on (DD21 §8, RFC 9457). */
23
36
  export const PROBLEM_CODES = [
24
37
  "invalid_argument",
@@ -14,7 +14,7 @@ export const CLASSIFICATION_STATES = [
14
14
  export const CLASSIFICATION_REASONS = [
15
15
  "volume",
16
16
  "subdomain_split",
17
- "customer",
17
+ "relationship",
18
18
  "silence",
19
19
  "correction_streak",
20
20
  "reproposed",
@@ -35,7 +35,7 @@ export const TONE_TITLES = {
35
35
  };
36
36
  /** What a sender is, as the app tags it. */
37
37
  export const SENDER_TAGS = [
38
- "customer",
38
+ "relationship",
39
39
  "filed",
40
40
  "quieted",
41
41
  "correspondence",
@@ -74,12 +74,12 @@ export const KEEP_OUTCOMES = [
74
74
  "unrenderable",
75
75
  ];
76
76
  /**
77
- * What became of one line given to `add_customers`, or would, as the
78
- * Customers page's paste says it, which a test keeps equal: a customer, one
77
+ * What became of one line given to `add_relationships`, or would, as the
78
+ * Relationships page's paste says it, which a test keeps equal: a relationship, one
79
79
  * already, a domain that names no organisation, one that cannot be read, a
80
80
  * site's address, or a line Brood failed on.
81
81
  */
82
- export const CUSTOMER_OUTCOMES = [
82
+ export const RELATIONSHIP_OUTCOMES = [
83
83
  "added",
84
84
  "already",
85
85
  "shared",
@@ -87,6 +87,163 @@ export const CUSTOMER_OUTCOMES = [
87
87
  "address",
88
88
  "failed",
89
89
  ];
90
+ /** What came of changing a group or a relationship's place in one. */
91
+ export const GROUP_OUTCOMES = ["done", "taken", "not_empty"];
92
+ /** What taking someone off the relationships list does, wherever it is said. */
93
+ export const RELATIONSHIP_REMOVAL = "Anything already filed stays filed, and a proposal waiting for them is withdrawn. Brood may then quiet them, will not bring them back after a quiet spell, and will not suggest them again.";
94
+ /** What came of taking up or dismissing a suggestion. */
95
+ export const SUGGESTION_OUTCOMES = ["done", "not_suggested"];
96
+ /**
97
+ * What came of restoring a quieted home: active again with its homes moved
98
+ * back, with a home the person renamed or removed left as it is, or with one
99
+ * a later rules pass moves back; or it was not quieted.
100
+ */
101
+ export const RESTORE_OUTCOMES = [
102
+ "restored",
103
+ "restored_left",
104
+ "restored_later",
105
+ "not_quieted",
106
+ ];
107
+ /**
108
+ * What came of leaving a quieted home quiet after its sender wrote again:
109
+ * answered; quiet already, answered before or with nothing to answer; or not
110
+ * quieted.
111
+ */
112
+ export const LEAVE_QUIET_OUTCOMES = [
113
+ "answered",
114
+ "already",
115
+ "not_quieted",
116
+ ];
117
+ /**
118
+ * What came of marking a home batched, or taking the mark off: as asked;
119
+ * already so, or not a home that can be marked; no arrival hours set yet; or
120
+ * a mailbox filing it cannot return mail in batches, or none is filing it.
121
+ */
122
+ export const BATCH_OUTCOMES = [
123
+ "batched",
124
+ "unbatched",
125
+ "unchanged",
126
+ "no_hours",
127
+ "cannot",
128
+ ];
129
+ /**
130
+ * Why one of your own filters cannot be taken over as it stands: it matches
131
+ * more than a sender, names no one sender, keeps mail in the inbox, forwards,
132
+ * does more than file, or files under none of your homes, or several.
133
+ */
134
+ export const ADOPT_REFUSALS = [
135
+ "matches_more",
136
+ "not_one_sender",
137
+ "keeps_in_inbox",
138
+ "forwards",
139
+ "does_more",
140
+ "no_home",
141
+ "several_homes",
142
+ ];
143
+ /**
144
+ * What came of taking over one of your own filters: taken over; refused for
145
+ * a reason in `ADOPT_REFUSALS`; gone from the mailbox; no mail from its
146
+ * sender yet; a part of a domain; a sender Brood already files or has
147
+ * quieted; one your never-quiet list keeps in view; one a filter cannot hold
148
+ * exactly; or its mailbox not connected.
149
+ */
150
+ export const ADOPT_OUTCOMES = [
151
+ "adopted",
152
+ ...ADOPT_REFUSALS,
153
+ "gone",
154
+ "no_mail",
155
+ "not_root",
156
+ "already_brood",
157
+ "never_quiet",
158
+ "unrenderable",
159
+ "not_connected",
160
+ ];
161
+ /** What one of your own filters does. */
162
+ export const OWN_RULE_DOES = [
163
+ "out_of_inbox",
164
+ "trash",
165
+ "read",
166
+ "starred",
167
+ "important",
168
+ "forwards",
169
+ ];
170
+ /**
171
+ * What came of keeping a sender out of a filing: kept out, its mail coming
172
+ * back; the same, with a filter the hourly reconcile has yet to narrow; a
173
+ * sender with a home of its own, to unhush instead; nothing files it; or an
174
+ * address a filter cannot hold exactly.
175
+ */
176
+ export const KEEP_OUT_OUTCOMES = [
177
+ "kept_out",
178
+ "kept_out_pending",
179
+ "own_home",
180
+ "not_filed",
181
+ "unrenderable",
182
+ ];
183
+ /**
184
+ * What came of filing what a filter would have filed had it been there
185
+ * already: all of it; some, the hourly rules pass filing the rest; none now,
186
+ * today's allowance being spent, so the pass files it; or none, since it
187
+ * stopped being one to file with.
188
+ */
189
+ export const FILE_EXISTING_OUTCOMES = [
190
+ "filed",
191
+ "continues",
192
+ "later",
193
+ "stopped",
194
+ ];
195
+ /**
196
+ * What came of changing the rule book's numbers: saved; the same as before,
197
+ * so nothing written; refused with no mailbox connected, where they apply to
198
+ * nothing; or refused as stale, the numbers in force no longer the ones the
199
+ * change was read against.
200
+ */
201
+ export const RULE_BOOK_OUTCOMES = [
202
+ "saved",
203
+ "unchanged",
204
+ "no_mailbox",
205
+ "stale",
206
+ ];
207
+ /**
208
+ * The rule book's numbers by name, in the order the engine's defaults list
209
+ * them. Listed here, since the CLI's public mirror carries figures as plain
210
+ * values alone, and held equal to `DEFAULT_THRESHOLDS` by the API's own list.
211
+ */
212
+ export const RULE_BOOK_KEYS = [
213
+ "file.min_events",
214
+ "file.window_days",
215
+ "file.subdomain_split",
216
+ "quiet.silence_days",
217
+ "quiet.correction_streak",
218
+ "surface.reply_window_days",
219
+ "surface.relationship_silence_days",
220
+ "relationship.window_months",
221
+ "relationship.min_active_months",
222
+ "relationship.min_inbound",
223
+ "relationship.inbound_per_reply",
224
+ ];
225
+ /** What came of asking for a declined classification to be proposed again. */
226
+ export const REPROPOSE_OUTCOMES = [
227
+ "reproposed",
228
+ "already_proposed",
229
+ "retiring",
230
+ "returning",
231
+ "not_declined",
232
+ ];
233
+ /**
234
+ * What came of asking a sender to stop, as the app's words for it, which a
235
+ * test keeps equal.
236
+ */
237
+ export const UNSUBSCRIBE_OUTCOMES = [
238
+ "asked",
239
+ "declined",
240
+ "unreachable",
241
+ "blocked",
242
+ "not_offered",
243
+ "never_quiet",
244
+ "relationship",
245
+ "limited",
246
+ ];
90
247
  /** A list of values as the reference writes them: each as code, `or` before the last. */
91
248
  export const listed = (values) => values.length < 2
92
249
  ? values.map((v) => `\`${v}\``).join("")
@@ -94,3 +251,88 @@ export const listed = (values) => values.length < 2
94
251
  .slice(0, -1)
95
252
  .map((v) => `\`${v}\``)
96
253
  .join(", ")} or \`${values.at(-1)}\``;
254
+ /** How often a person wants the letter of what Brood did, if at all (#609). */
255
+ export const LETTER_CHOICES = ["off", "month", "week"];
256
+ /**
257
+ * What came of choosing whether the first proposals' email is wanted:
258
+ * recorded, or sent already, so there was nothing left to change.
259
+ */
260
+ export const FIRST_PROPOSALS_OUTCOMES = ["recorded", "sent"];
261
+ /**
262
+ * The changes a person approves in the app, never a token alone (DD21 §4):
263
+ * the account's owner's, each asked by a program and made only when the
264
+ * person presses a button in Brood, signed in as the app asks.
265
+ */
266
+ export const APPROVED_IN_APP = [
267
+ "disconnect_mailbox",
268
+ "remove_never_quiet",
269
+ "allow_program",
270
+ "revoke_program",
271
+ ];
272
+ /** Where a request to approve in the app stands. */
273
+ export const REQUEST_STATES = [
274
+ "waiting",
275
+ "approved",
276
+ "declined",
277
+ "expired",
278
+ ];
279
+ /**
280
+ * What came of an approved request, as the app's own pages say it: a
281
+ * mailbox letting go or already let go, an entry removed or not on the list,
282
+ * a program allowed or revoked, or already so; an agent's change made, or
283
+ * unchanged where it was already so, such as the rule book's numbers, or
284
+ * refused; or a change that failed.
285
+ */
286
+ export const APPROVAL_OUTCOMES = [
287
+ "disconnecting",
288
+ "disconnected",
289
+ "removed",
290
+ "not_listed",
291
+ "allowed",
292
+ "already_allowed",
293
+ "revoked",
294
+ "already_revoked",
295
+ "reconnected",
296
+ "made",
297
+ "unchanged",
298
+ "refused",
299
+ "failed",
300
+ ];
301
+ /** What each outcome of an approved request is said as, in the app and at the command line. */
302
+ export const APPROVAL_SAID = {
303
+ disconnecting: "Approved. Brood has stopped syncing the mailbox, and is letting it go.",
304
+ disconnected: "Approved. That mailbox was already disconnected.",
305
+ removed: "Approved. It is off your never-quiet list.",
306
+ not_listed: "Approved. It was no longer on your never-quiet list.",
307
+ allowed: "Approved. The program is allowed again.",
308
+ already_allowed: "Approved. The program was already allowed.",
309
+ revoked: "Approved. The program is revoked.",
310
+ already_revoked: "Approved. The program was already revoked.",
311
+ reconnected: "Approved, but the mailbox was connected again after this was asked for, so it stays connected. Ask again to let it go.",
312
+ made: "Approved. The change is made.",
313
+ unchanged: "Approved. Those were already the numbers in force, so nothing changed.",
314
+ refused: "Approved, but Brood refused it, so nothing was changed.",
315
+ failed: "Approved, but nothing was changed. Ask for it again.",
316
+ };
317
+ /**
318
+ * What every tool an agent asks for a change by says first (D28 §2), so it
319
+ * knows before calling that the change waits on the person, and does not
320
+ * tell them it is done.
321
+ */
322
+ export const ASKS_FIRST = "This asks for a change and makes none: the person approves or declines it in Brood, on the page the answer names, before it lapses. Tell them that, in the answer's own words, and never that the change is made; `get_request` says what came of it.";
323
+ /**
324
+ * What every request's answer says first (D28 §2): nothing has changed yet,
325
+ * where to approve it, and when it lapses, so an agent relaying it never
326
+ * tells the person a change was made.
327
+ */
328
+ export const askedSaid = (approveAt, expiresAt) => `Nothing has changed yet. Approve it in Brood, at ${approveAt}, before ${expiresAt.toISOString().slice(11, 19)} UTC.`;
329
+ /**
330
+ * What a request is said as when it was not approved, or was approved and
331
+ * has yet to say what came of it, in the app and at the command line.
332
+ */
333
+ export const REQUEST_SAID = {
334
+ waiting: "Nothing has changed yet. It waits for you to approve it in Brood.",
335
+ declined: "Declined. Nothing changed.",
336
+ expired: "Nobody approved it in time. Nothing changed.",
337
+ under_way: "Approved, and under way.",
338
+ };
@@ -1,4 +1,6 @@
1
1
  // The figures the CLI uses, as Brood's figures hold them.
2
2
  export const API_PAGE_MAX = 200;
3
3
  export const API_STRETCH_DAYS = 30;
4
+ export const APPROVAL_MINUTES = 10;
4
5
  export const PORTRAIT_DAYS = 90;
6
+ export const PROPOSALS_AT_ONCE = 50;