@noisybrood/cli 0.1.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 +16 -6
- package/dist/brood/api/src/client.js +71 -0
- package/dist/brood/api/src/origin.js +7 -0
- package/dist/brood/api/src/values.js +281 -2
- package/dist/brood/figures/index.js +2 -6
- package/dist/brood/tokens/dark.js +2 -0
- package/dist/brood.js +22 -0
- package/dist/client.js +7 -7
- package/dist/commands.js +1022 -14
- package/dist/keychain.js +104 -0
- package/dist/main.js +108 -8
- package/dist/sign-in.js +8 -8
- package/dist/store.js +62 -7
- package/dist/wren.js +7 -13
- package/package.json +3 -3
- package/dist/brood/api/src/fields.js +0 -335
- package/dist/brood/api/src/index.js +0 -528
- package/dist/brood/tokens/dark.css +0 -86
- package/dist/brood/tokens/src/contrast.js +0 -109
package/README.md
CHANGED
|
@@ -14,15 +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
|
|
18
|
-
|
|
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.
|
|
19
22
|
|
|
20
23
|
## Install
|
|
21
24
|
|
|
22
25
|
It needs Node 24 or later.
|
|
23
26
|
|
|
24
27
|
```
|
|
25
|
-
npm install --global @noisybrood/cli@0.
|
|
28
|
+
npm install --global @noisybrood/cli@0.4.0
|
|
26
29
|
```
|
|
27
30
|
|
|
28
31
|
Name the version. Each one published is fixed once it is on npm, and carries
|
|
@@ -40,9 +43,10 @@ signed in to Noisy Brood, and approve the code. Nothing is typed into the
|
|
|
40
43
|
terminal but the command. `brood login --read-only` asks for a session that
|
|
41
44
|
can only read.
|
|
42
45
|
|
|
43
|
-
The session is kept in
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
The session is kept in your keychain: macOS's, or on Linux the desktop's
|
|
47
|
+
Secret Service. Where there is none, it goes in `~/.config/brood/credentials.json`
|
|
48
|
+
(or under `XDG_CONFIG_HOME`), readable only by you. `brood logout` ends it at
|
|
49
|
+
Brood before forgetting it. To shut it out at once, revoke it on your account page.
|
|
46
50
|
|
|
47
51
|
## Ask
|
|
48
52
|
|
|
@@ -60,6 +64,12 @@ as the API gives it.
|
|
|
60
64
|
Before an answer, brood says any mailbox it could not read whole, so a quiet
|
|
61
65
|
answer is never taken for a quiet mailbox.
|
|
62
66
|
|
|
67
|
+
## Reading the comments
|
|
68
|
+
|
|
69
|
+
The code's comments refer to internal design documents and issues, such as
|
|
70
|
+
`DD10 §6` or `#1367`. Those are private. You do not need them to read the code
|
|
71
|
+
or run its tests.
|
|
72
|
+
|
|
63
73
|
## This repository
|
|
64
74
|
|
|
65
75
|
This repository is where brood is built and published, copied one way from a
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { APP_ORIGIN } from "./origin.js";
|
|
2
|
+
import { APPROVAL_SAID, REQUEST_SAID } from "./values.js";
|
|
3
|
+
/**
|
|
4
|
+
* What a client of the API needs, and nothing of how the app answers (#1408):
|
|
5
|
+
* where to call and sign in, each operation's arguments and answer, and the
|
|
6
|
+
* problems a client branches on. The CLI imports this alone, so its public
|
|
7
|
+
* mirror carries it alone; the operations' descriptions, the arguments'
|
|
8
|
+
* narrowing and when each problem is answered are the app's half of this
|
|
9
|
+
* package, which re-exports this.
|
|
10
|
+
*/
|
|
11
|
+
export * from "./values.js";
|
|
12
|
+
/** Where every operation is called, by POST with its arguments in the body (DD21 §2, §3). */
|
|
13
|
+
export const API_BASE = `${APP_ORIGIN}/api/v1`;
|
|
14
|
+
/**
|
|
15
|
+
* Where a client signs in (DD21 §4): Clerk's OAuth server for the production
|
|
16
|
+
* instance, and each client's id there. A client id is not a secret: a public
|
|
17
|
+
* client is known by it alone, and ships it (#1354).
|
|
18
|
+
*/
|
|
19
|
+
export const SIGN_IN = {
|
|
20
|
+
issuer: "https://clerk.app.noisybrood.com",
|
|
21
|
+
clients: { cli: "P029s9c7VAQInceB" },
|
|
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];
|
|
35
|
+
/** The codes a problem carries, which clients branch on (DD21 §8, RFC 9457). */
|
|
36
|
+
export const PROBLEM_CODES = [
|
|
37
|
+
"invalid_argument",
|
|
38
|
+
"unauthenticated",
|
|
39
|
+
"credential_revoked",
|
|
40
|
+
"insufficient_scope",
|
|
41
|
+
"plan_required",
|
|
42
|
+
"not_found",
|
|
43
|
+
"mailbox_unreachable",
|
|
44
|
+
"never_quiet",
|
|
45
|
+
"in_progress",
|
|
46
|
+
"rate_limited",
|
|
47
|
+
"internal",
|
|
48
|
+
];
|
|
49
|
+
/**
|
|
50
|
+
* Each problem's status and title (DD21 §8, RFC 9457), which a client shows
|
|
51
|
+
* and branches on.
|
|
52
|
+
*/
|
|
53
|
+
export const PROBLEM_TITLES = {
|
|
54
|
+
invalid_argument: { status: 400, title: "An argument is not valid" },
|
|
55
|
+
unauthenticated: { status: 401, title: "Not signed in" },
|
|
56
|
+
credential_revoked: { status: 401, title: "This credential was revoked" },
|
|
57
|
+
insufficient_scope: { status: 403, title: "This credential may not do that" },
|
|
58
|
+
plan_required: { status: 403, title: "This needs Pro" },
|
|
59
|
+
not_found: { status: 404, title: "Not found" },
|
|
60
|
+
mailbox_unreachable: {
|
|
61
|
+
status: 409,
|
|
62
|
+
title: "Brood cannot reach this mailbox",
|
|
63
|
+
},
|
|
64
|
+
never_quiet: {
|
|
65
|
+
status: 409,
|
|
66
|
+
title: "Your never-quiet list keeps this in view",
|
|
67
|
+
},
|
|
68
|
+
in_progress: { status: 409, title: "Brood is still undoing this" },
|
|
69
|
+
rate_limited: { status: 429, title: "Too many calls" },
|
|
70
|
+
internal: { status: 500, title: "Something went wrong" },
|
|
71
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The app's origin: where the API answers, and where every surface that links
|
|
3
|
+
* into the app or posts to it builds its address from. A file of its own,
|
|
4
|
+
* with no imports, so the pitch site's middleware and the checks can read it
|
|
5
|
+
* without the rest of the API.
|
|
6
|
+
*/
|
|
7
|
+
export const APP_ORIGIN = "https://app.noisybrood.com";
|
|
@@ -14,7 +14,7 @@ export const CLASSIFICATION_STATES = [
|
|
|
14
14
|
export const CLASSIFICATION_REASONS = [
|
|
15
15
|
"volume",
|
|
16
16
|
"subdomain_split",
|
|
17
|
-
"
|
|
17
|
+
"relationship",
|
|
18
18
|
"silence",
|
|
19
19
|
"correction_streak",
|
|
20
20
|
"reproposed",
|
|
@@ -22,6 +22,7 @@ export const CLASSIFICATION_REASONS = [
|
|
|
22
22
|
"restored",
|
|
23
23
|
"kept_out",
|
|
24
24
|
"adopted",
|
|
25
|
+
"by_hand",
|
|
25
26
|
];
|
|
26
27
|
/** How a week sounded beside the one before; `first` with none to compare. */
|
|
27
28
|
export const TONES = ["quieter", "louder", "much the same", "first"];
|
|
@@ -34,7 +35,7 @@ export const TONE_TITLES = {
|
|
|
34
35
|
};
|
|
35
36
|
/** What a sender is, as the app tags it. */
|
|
36
37
|
export const SENDER_TAGS = [
|
|
37
|
-
"
|
|
38
|
+
"relationship",
|
|
38
39
|
"filed",
|
|
39
40
|
"quieted",
|
|
40
41
|
"correspondence",
|
|
@@ -50,6 +51,199 @@ export const SHOWN = ["active", "quieted", "left"];
|
|
|
50
51
|
export const DIRECTIONS = ["inbound", "outbound"];
|
|
51
52
|
/** How the person was addressed on a message. */
|
|
52
53
|
export const ADDRESSED = ["to", "cc", "neither"];
|
|
54
|
+
/**
|
|
55
|
+
* What an entry on the never-quiet list names: one sender's address, a domain
|
|
56
|
+
* and everything under it, a pattern on an address's local part, or an
|
|
57
|
+
* address copied on a message, which keeps that mail alone in view (#663).
|
|
58
|
+
*/
|
|
59
|
+
export const KEPT_KINDS = ["address", "domain", "pattern", "copied"];
|
|
60
|
+
/**
|
|
61
|
+
* What became of one line given to `keep`, or would, as the never-quiet
|
|
62
|
+
* list's paste says it in the app, which a test keeps equal: kept, there
|
|
63
|
+
* already, said twice, not in force since a filter could not change, or
|
|
64
|
+
* refused for what it is.
|
|
65
|
+
*/
|
|
66
|
+
export const KEEP_OUTCOMES = [
|
|
67
|
+
"added",
|
|
68
|
+
"already_listed",
|
|
69
|
+
"repeated",
|
|
70
|
+
"not_in_force",
|
|
71
|
+
"invalid_address",
|
|
72
|
+
"invalid_domain",
|
|
73
|
+
"invalid_pattern",
|
|
74
|
+
"unrenderable",
|
|
75
|
+
];
|
|
76
|
+
/**
|
|
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
|
+
* already, a domain that names no organisation, one that cannot be read, a
|
|
80
|
+
* site's address, or a line Brood failed on.
|
|
81
|
+
*/
|
|
82
|
+
export const RELATIONSHIP_OUTCOMES = [
|
|
83
|
+
"added",
|
|
84
|
+
"already",
|
|
85
|
+
"shared",
|
|
86
|
+
"invalid",
|
|
87
|
+
"address",
|
|
88
|
+
"failed",
|
|
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
|
+
];
|
|
53
247
|
/** A list of values as the reference writes them: each as code, `or` before the last. */
|
|
54
248
|
export const listed = (values) => values.length < 2
|
|
55
249
|
? values.map((v) => `\`${v}\``).join("")
|
|
@@ -57,3 +251,88 @@ export const listed = (values) => values.length < 2
|
|
|
57
251
|
.slice(0, -1)
|
|
58
252
|
.map((v) => `\`${v}\``)
|
|
59
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,10 +1,6 @@
|
|
|
1
1
|
// The figures the CLI uses, as Brood's figures hold them.
|
|
2
|
-
export const API_ACTS_PER_MINUTE = 10;
|
|
3
|
-
export const API_CALLS_PER_MINUTE = 120;
|
|
4
2
|
export const API_PAGE_MAX = 200;
|
|
5
3
|
export const API_STRETCH_DAYS = 30;
|
|
6
|
-
export const
|
|
4
|
+
export const APPROVAL_MINUTES = 10;
|
|
7
5
|
export const PORTRAIT_DAYS = 90;
|
|
8
|
-
export const
|
|
9
|
-
export const QUIET_REGULAR_MONTHS = 3;
|
|
10
|
-
export const RETENTION_DAYS = 120;
|
|
6
|
+
export const PROPOSALS_AT_ONCE = 50;
|
package/dist/brood.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { createInterface } from "node:readline/promises";
|
|
4
|
+
import { text } from "node:stream/consumers";
|
|
5
|
+
import { keychainFor } from "./keychain.js";
|
|
2
6
|
import { run } from "./main.js";
|
|
3
7
|
process.exitCode = await run({
|
|
4
8
|
fetch: (url, init) => fetch(url, init),
|
|
@@ -8,4 +12,22 @@ process.exitCode = await run({
|
|
|
8
12
|
out: (line) => process.stdout.write(`${line}\n`),
|
|
9
13
|
err: (line) => process.stderr.write(`${line}\n`),
|
|
10
14
|
tty: process.stdout.isTTY === true,
|
|
15
|
+
input: () => text(process.stdin),
|
|
16
|
+
read: (path) => readFile(path, "utf8"),
|
|
17
|
+
// Asked on standard error, so an answer piped elsewhere holds none of it.
|
|
18
|
+
ask: process.stdin.isTTY && process.stderr.isTTY
|
|
19
|
+
? async (question) => {
|
|
20
|
+
const terminal = createInterface({
|
|
21
|
+
input: process.stdin,
|
|
22
|
+
output: process.stderr,
|
|
23
|
+
});
|
|
24
|
+
try {
|
|
25
|
+
return await terminal.question(question);
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
terminal.close();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
: null,
|
|
32
|
+
keychain: keychainFor(process.platform),
|
|
11
33
|
}, process.argv.slice(2));
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { API_BASE, PROBLEM_CODES,
|
|
1
|
+
import { API_BASE, PROBLEM_CODES, PROBLEM_TITLES, } from "./brood/api/src/client.js";
|
|
2
2
|
import { clean, cleaned, isRecord, Refused, Refusal } from "./io.js";
|
|
3
3
|
import { freshCredentials, refresh } from "./sign-in.js";
|
|
4
4
|
import { VERSION } from "./version.js";
|
|
@@ -27,16 +27,16 @@ function refusalOf(problem, retryAfter) {
|
|
|
27
27
|
// The day's rule changes have a reason the server gives; the minute's
|
|
28
28
|
// limit has only its wait.
|
|
29
29
|
return new Refusal(problem.detail
|
|
30
|
-
? `${
|
|
30
|
+
? `${PROBLEM_TITLES.rate_limited.title}. ${problem.detail}`
|
|
31
31
|
: retryAfter
|
|
32
|
-
? `${
|
|
33
|
-
: `${
|
|
32
|
+
? `${PROBLEM_TITLES.rate_limited.title}. Try again in ${clean(retryAfter)} seconds.`
|
|
33
|
+
: `${PROBLEM_TITLES.rate_limited.title}. Try again in a minute.`);
|
|
34
34
|
case "invalid_argument":
|
|
35
|
-
return new Refusal(`${
|
|
35
|
+
return new Refusal(`${PROBLEM_TITLES.invalid_argument.title}: ${problem.detail ?? "the request"}.`);
|
|
36
36
|
default:
|
|
37
37
|
return new Refusal(problem.detail
|
|
38
|
-
? `${
|
|
39
|
-
: `${
|
|
38
|
+
? `${PROBLEM_TITLES[problem.code].title}. ${problem.detail}`
|
|
39
|
+
: `${PROBLEM_TITLES[problem.code].title}.`);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
async function send(io, operation, args, credentials) {
|