@curviate/cli 0.54.0 → 0.55.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 (65) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +34 -17
  3. package/dist/{account-DW5N5MJ6.js → account-6L33JFZS.js} +98 -116
  4. package/dist/{analytics-T2K3OWVQ.js → analytics-HGJGXRAM.js} +5 -5
  5. package/dist/{beta-consent-O736ONE7.js → beta-consent-LIND4PPN.js} +4 -4
  6. package/dist/{billing-NTBL32EX.js → billing-QKPP5NPR.js} +5 -5
  7. package/dist/{chunk-5B4T6BMN.js → chunk-AMMAA62Z.js} +44 -44
  8. package/dist/{chunk-FBLCSVIU.js → chunk-BC4N5X3N.js} +47 -47
  9. package/dist/{chunk-N4IYTFIY.js → chunk-EA5LJ4CS.js} +1 -1
  10. package/dist/{chunk-A3UNS44U.js → chunk-FHSGANM6.js} +10 -10
  11. package/dist/chunk-J34JU27C.js +94 -0
  12. package/dist/{chunk-62YAYAUI.js → chunk-JKXGL7PT.js} +9 -9
  13. package/dist/{chunk-FUX3BRYP.js → chunk-JXDEV33Z.js} +1 -1
  14. package/dist/{chunk-V3HHYTBY.js → chunk-KLXDFFHT.js} +1 -1
  15. package/dist/{chunk-HOMRAZ6S.js → chunk-LGUZ52BU.js} +2 -2
  16. package/dist/{chunk-Q57PZJLX.js → chunk-OYZ27Q3B.js} +88 -88
  17. package/dist/{chunk-UFHT2KZG.js → chunk-Q5Z7FMXI.js} +2 -2
  18. package/dist/{chunk-R4HS2MWM.js → chunk-QBY6L77D.js} +14 -12
  19. package/dist/{chunk-KXJJFHSD.js → chunk-R7USRN52.js} +1 -1
  20. package/dist/{chunk-QW5K5DTC.js → chunk-RDKTHFQ6.js} +25 -6
  21. package/dist/{chunk-N76WNJ5T.js → chunk-S234PC5E.js} +1 -1
  22. package/dist/{chunk-ACKKHLUH.js → chunk-Z3RPQ5K4.js} +2 -2
  23. package/dist/cli.js +27 -25
  24. package/dist/{comment-ATVJOTWV.js → comment-IIKLEAEK.js} +8 -8
  25. package/dist/{company-BRKFROPE.js → company-CX5TZNB5.js} +11 -11
  26. package/dist/{config-E223SS5K.js → config-Y4FC7QKM.js} +2 -2
  27. package/dist/{connect-XVDQ5FTT.js → connect-GUUBX23F.js} +15 -15
  28. package/dist/{contact-4HOUOVD7.js → contact-OCYSFRTS.js} +8 -8
  29. package/dist/{contact-groups-ENA3VGGL.js → contact-groups-HWJSYRFJ.js} +85 -85
  30. package/dist/{contact-import-4EKVDFPV.js → contact-import-CTWSFT64.js} +10 -10
  31. package/dist/core-37XZS2RG.js +46 -0
  32. package/dist/{do-not-contact-S2WGHSQL.js → do-not-contact-6UVY3UKT.js} +29 -29
  33. package/dist/{doctor-OFIUGRUG.js → doctor-6CB6DCY3.js} +4 -4
  34. package/dist/{document-MDE2WJYX.js → document-ADK4GZA7.js} +1 -1
  35. package/dist/domain-BUJMHYIV.js +70 -0
  36. package/dist/{draft-DD3DTXBM.js → draft-SII6E6Z6.js} +4 -4
  37. package/dist/{enrollment-ESCHKQ5X.js → enrollment-OXGR5WVI.js} +38 -38
  38. package/dist/{examples-KAMXHRLE.js → examples-77WVMKZQ.js} +2 -2
  39. package/dist/{exit-codes-CYQHN4NE.js → exit-codes-ZSOLAXQO.js} +1 -1
  40. package/dist/{export-GUAGB7TF.js → export-D32J5GRN.js} +5 -5
  41. package/dist/{feed-ZC4FY4BA.js → feed-HOFHCP6W.js} +6 -6
  42. package/dist/{group-42ZE7K3K.js → group-AMYOAGNS.js} +6 -6
  43. package/dist/{inbox-2YS7CTXH.js → inbox-NS2LB2WQ.js} +9 -9
  44. package/dist/{inboxes-5RB3BGCQ.js → inboxes-XWUZJ5PN.js} +6 -6
  45. package/dist/{incoming-ATZN6JJA.js → incoming-UIWRL6QS.js} +13 -13
  46. package/dist/{job-WD3Z3P3Q.js → job-TKGPXU26.js} +10 -10
  47. package/dist/{login-JQ57YHEJ.js → login-B2YWX2JP.js} +2 -2
  48. package/dist/mailbox-LLSGX2FF.js +406 -0
  49. package/dist/{message-WGS2IIDC.js → message-M4THMNRZ.js} +7 -7
  50. package/dist/{motion-BRVBJJJP.js → motion-2OUGYR3O.js} +147 -147
  51. package/dist/{network-CODIWCJQ.js → network-MFWKXTEV.js} +5 -5
  52. package/dist/{notification-RLVF4NLJ.js → notification-5K4TCYQA.js} +6 -6
  53. package/dist/{notifications-HGEHM5KW.js → notifications-2GKUJB7C.js} +6 -6
  54. package/dist/{post-3GH2IPO6.js → post-BHH7YKGM.js} +8 -8
  55. package/dist/{profile-6RFJQMIB.js → profile-GKMRRKZF.js} +15 -15
  56. package/dist/{recruiter-GK3UNS62.js → recruiter-J53ZSD4P.js} +17 -17
  57. package/dist/{sales-nav-SLS3ABF4.js → sales-nav-6I5SYTRX.js} +15 -15
  58. package/dist/{search-45WRT5T3.js → search-HS2YAA33.js} +17 -17
  59. package/dist/{setup-5QZOM2Q2.js → setup-IYVOGVC6.js} +4 -4
  60. package/dist/{team-WM3RKOQ2.js → team-N6ILUHAD.js} +6 -6
  61. package/dist/{tier-5AMLO5KE.js → tier-QWXKFESB.js} +4 -4
  62. package/dist/{unibox-TTCF7YVO.js → unibox-D4WIHIZX.js} +34 -34
  63. package/dist/{webhook-UCCCSKDO.js → webhook-PKWGZZO2.js} +18 -18
  64. package/package.json +2 -2
  65. package/dist/core-6VDDV2NM.js +0 -46
@@ -0,0 +1,406 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ resolveSecret
4
+ } from "./chunk-J34JU27C.js";
5
+ import {
6
+ fail,
7
+ outputOpts,
8
+ rootClient,
9
+ usage
10
+ } from "./chunk-LGUZ52BU.js";
11
+ import {
12
+ buildPreviewOutput
13
+ } from "./chunk-TCUYH5GO.js";
14
+ import {
15
+ intFlag
16
+ } from "./chunk-NNV2OYEF.js";
17
+ import {
18
+ pageDelayFromFlags,
19
+ readCursorFlag,
20
+ readMaxPagesFlag,
21
+ readableObject,
22
+ readablePage,
23
+ rejectPaginationModifiersWithoutAll,
24
+ streamAll
25
+ } from "./chunk-R7USRN52.js";
26
+ import {
27
+ renderSuccess,
28
+ writeNdjsonItem
29
+ } from "./chunk-QM57YDJE.js";
30
+ import "./chunk-ENBIMEKS.js";
31
+ import "./chunk-S234PC5E.js";
32
+ import {
33
+ GLOBAL_FLAGS,
34
+ READ_SINGLE_FLAGS,
35
+ WRITE_SINGLE_FLAGS,
36
+ readOnly
37
+ } from "./chunk-QLKGOIWS.js";
38
+ import {
39
+ DESCRIPTIONS
40
+ } from "./chunk-QBY6L77D.js";
41
+ import {
42
+ readFileFlag
43
+ } from "./chunk-JKXGL7PT.js";
44
+ import "./chunk-FDJMAF7D.js";
45
+ import "./chunk-ZYURL5VK.js";
46
+ import {
47
+ getExitCode
48
+ } from "./chunk-RDKTHFQ6.js";
49
+
50
+ // src/commands/mailbox.ts
51
+ import { defineCommand } from "citty";
52
+ var STATES = ["connected", "ramping", "paused", "paused_by_bounces", "paused_by_provider", "reconnect_needed"];
53
+ var SIGNATURE_MAX_BYTES = 64 * 1024;
54
+ var online = (fn) => async ({ args, rawArgs }) => {
55
+ const f = args;
56
+ if ((rawArgs ?? []).some((t) => t.startsWith("--password-stdin="))) usage("--password-stdin takes no value: the password is read from stdin.");
57
+ await fn(await rootClient(f), f);
58
+ };
59
+ var preview = (method, args, body = {}) => void process.stdout.write(JSON.stringify(buildPreviewOutput({ method, args, body })) + "\n");
60
+ async function runList(c, f) {
61
+ rejectPaginationModifiersWithoutAll(f, process);
62
+ const params = {};
63
+ if (f.state !== void 0) {
64
+ if (!STATES.includes(f.state)) usage(`--state takes one of ${STATES.join(", ")}.`);
65
+ params["state"] = f.state;
66
+ }
67
+ for (const [flag, key] of [["sends-for", "sends_for"], ["domain", "domain"]]) {
68
+ const v = f[flag];
69
+ if (v === void 0) continue;
70
+ if (v.trim() === "") usage(`--${flag} was given an empty value.`);
71
+ params[key] = v;
72
+ }
73
+ if (f.limit !== void 0) params["limit"] = intFlag("limit", f.limit, 1, 100);
74
+ const cursor = readCursorFlag(f, process);
75
+ if (cursor) params["cursor"] = cursor;
76
+ try {
77
+ if (f.all) {
78
+ const page = (p) => c.mailboxes.list(p);
79
+ for await (const item of streamAll(page, params, { maxPages: readMaxPagesFlag(f, process), out: process, pageDelayMs: pageDelayFromFlags(f) })) writeNdjsonItem(process, item, f.fields);
80
+ } else {
81
+ renderSuccess(readablePage(await c.mailboxes.list(params)), outputOpts(f), process);
82
+ }
83
+ } catch (err) {
84
+ await fail(err, f);
85
+ }
86
+ }
87
+ async function runGet(c, f) {
88
+ try {
89
+ renderSuccess(readableObject(await c.mailboxes.get(String(f.id ?? ""))), outputOpts(f), process);
90
+ } catch (err) {
91
+ await fail(err, f);
92
+ }
93
+ }
94
+ async function runUpdate(c, f) {
95
+ const id = String(f.id ?? "");
96
+ const body = {};
97
+ const link = f["sends-for"];
98
+ if (link !== void 0) {
99
+ if (link.trim() === "") usage("--sends-for was given an empty value: an Account id (acc_...) or shared.");
100
+ body["sends_for"] = link === "shared" ? { kind: "shared" } : { kind: "account", account_id: link };
101
+ }
102
+ if (f["daily-cap"] !== void 0) body["daily_cap"] = intFlag("daily-cap", f["daily-cap"]);
103
+ if (f["signature-file"] !== void 0) body["signature"] = (await readFileFlag("signature-file", f["signature-file"], { maxBytes: SIGNATURE_MAX_BYTES, others: f })).trimEnd();
104
+ if (Object.keys(body).length === 0) usage("pass at least one of --sends-for, --daily-cap, --signature-file.");
105
+ if (f.preview) return preview("mailboxes.update", { id }, body);
106
+ try {
107
+ renderSuccess(readableObject(await c.mailboxes.update(id, body)), outputOpts(f), process);
108
+ } catch (err) {
109
+ await fail(err, f);
110
+ }
111
+ }
112
+ var act = (verb) => async (c, f) => {
113
+ const id = String(f.id ?? "");
114
+ if (f.preview) return preview(`mailboxes.${verb}`, { id });
115
+ try {
116
+ renderSuccess(readableObject(await c.mailboxes[verb](id)), outputOpts(f), process);
117
+ } catch (err) {
118
+ await fail(err, f);
119
+ }
120
+ };
121
+ var CONNECTIONS = ["google_app_password", "google_sign_in", "microsoft_sign_in", "imap_smtp"];
122
+ var PASSWORD_CONNECTIONS = ["google_app_password", "imap_smtp"];
123
+ var SERVER_FLAGS = ["imap-host", "imap-port", "imap-security", "smtp-host", "smtp-port", "smtp-security"];
124
+ var MAILBOX_REQUEST_INSTRUCTION = "Ask your user to open this link in the browser where they're signed in to Curviate. It expires in 15 minutes. Never ask them for their email password in chat; to submit an app password yourself, pipe it to --password-stdin.";
125
+ async function runDiscover(c, f) {
126
+ const address = String(f.address ?? "");
127
+ if (address.trim() === "") usage("the address is empty. Pass the email address to look up.");
128
+ try {
129
+ renderSuccess(readableObject(await c.mailboxes.discover(address)), outputOpts(f), process);
130
+ } catch (err) {
131
+ await fail(err, f);
132
+ }
133
+ }
134
+ async function readPassword(f) {
135
+ if (!f["password-stdin"]) return void 0;
136
+ if (f.preview) return "";
137
+ return resolveSecret({
138
+ stdinRequested: true,
139
+ isTTY: process.stdin.isTTY ?? false,
140
+ required: true,
141
+ failMessage: `--password-stdin read an empty password. Pipe the password in (printf '%s' "$APP_PASSWORD" | curviate mailbox ... --password-stdin), or leave the flag out and give the person the link.`,
142
+ out: process
143
+ });
144
+ }
145
+ var requestLines = (req) => req.status === "completed" ? [`Mailbox: ${req.mailbox_id ?? ""}`, `Request: ${req.id ?? ""}`] : [`Link: ${req.url ?? ""}`, `Expires: ${req.expires_at ?? ""}`, `Request: ${req.id ?? ""}`, ...req.admin_consent_url ? [`Administrator link: ${req.admin_consent_url}`] : []];
146
+ async function sendRequest(c, f, body) {
147
+ try {
148
+ const req = await c.connectRequests.create(body);
149
+ const opts = outputOpts(f);
150
+ if (opts.json) renderSuccess(req, opts, process);
151
+ if (req.error_code) {
152
+ process.stderr.write(`error [${req.error_code}] the request ${req.id ?? ""} is ${req.status ?? "open"}. Read it: curviate account connect-request get ${req.id ?? "<request_id>"}
153
+ `);
154
+ process.exit(getExitCode(req.error_code));
155
+ }
156
+ if (!opts.json) process.stdout.write(requestLines(req).join("\n") + "\n");
157
+ if (req.status !== "completed") process.stderr.write(`${MAILBOX_REQUEST_INSTRUCTION}
158
+ Check on it: curviate account connect-request get ${req.id ?? "<request_id>"}
159
+ `);
160
+ } catch (err) {
161
+ await fail(err, f);
162
+ }
163
+ }
164
+ var withPassword = (body, password) => password === void 0 ? body : { ...body, credentials: { password } };
165
+ async function runConnect(c, f) {
166
+ const address = String(f.address ?? "");
167
+ if (address.trim() === "") usage("the address is empty. Pass the email address to connect.");
168
+ const connection = f.connection ?? "";
169
+ if (!CONNECTIONS.includes(connection)) usage(`--connection takes one of ${CONNECTIONS.join(", ")}.`);
170
+ if (f["password-stdin"] && !PASSWORD_CONNECTIONS.includes(connection)) usage(`--password-stdin does not apply to ${connection}: the person signs in on the provider's page. It takes ${PASSWORD_CONNECTIONS.join(" or ")}.`);
171
+ const mailbox = { connection, address };
172
+ if (connection === "imap_smtp") {
173
+ const missing = SERVER_FLAGS.filter((k) => f[k] === void 0 || f[k].trim() === "");
174
+ if (missing.length > 0) usage(`--connection imap_smtp needs ${missing.map((k) => `--${k}`).join(", ")} (the settings from \`curviate mailbox discover\`, as the person confirmed them).`);
175
+ for (const side of ["imap", "smtp"]) {
176
+ const security = f[`${side}-security`];
177
+ if (security !== "tls" && security !== "starttls") usage(`--${side}-security takes tls or starttls, never cleartext.`);
178
+ mailbox[side] = { host: f[`${side}-host`], port: intFlag(`${side}-port`, f[`${side}-port`], 1, 65535), security };
179
+ }
180
+ } else {
181
+ const given = SERVER_FLAGS.filter((k) => f[k] !== void 0);
182
+ if (given.length > 0) usage(`${given.map((k) => `--${k}`).join(", ")} apply to --connection imap_smtp only.`);
183
+ }
184
+ const body = withPassword({ mailbox }, await readPassword(f));
185
+ if (f.preview) return preview("connectRequests.create", {}, body);
186
+ await sendRequest(c, f, body);
187
+ }
188
+ async function runReconnect(c, f) {
189
+ const id = String(f.id ?? "");
190
+ if (id.trim() === "") usage("the Mailbox id is empty. Pass the mbx_... id from `curviate mailbox list`.");
191
+ const body = withPassword({ mailbox_id: id }, await readPassword(f));
192
+ if (f.preview) return preview("connectRequests.create", {}, body);
193
+ await sendRequest(c, f, body);
194
+ }
195
+ var ID = { type: "positional", description: "The Mailbox (mbx_...), from `curviate mailbox list`." };
196
+ var NOT_FOUND = { MAILBOX_NOT_FOUND: "no Mailbox of your Team has this id (another Team's id answers the same)." };
197
+ var listCmd = defineCommand({
198
+ meta: {
199
+ name: "list",
200
+ description: "List your Team's Mailboxes, newest first: state, Sends for, daily cap, sent today, bounces over 7 days, paused until. Every role reads. A Mailbox in `ramping` works up to its cap; the steps are never shown. No secret is ever in the answer.",
201
+ risk: "read",
202
+ seeAlso: ["curviate mailbox get", "curviate domain check"],
203
+ examples: ["curviate mailbox list", "curviate mailbox list --state paused --domain acme.example", "curviate mailbox list --sends-for none"]
204
+ },
205
+ args: {
206
+ ...readOnly(GLOBAL_FLAGS),
207
+ limit: { ...GLOBAL_FLAGS.limit, description: "Mailboxes per page (1 to 100)." },
208
+ state: { type: "string", description: `Only Mailboxes in this state: ${STATES.join(" | ")}.` },
209
+ "sends-for": { type: "string", description: "Only Mailboxes linked to this Account (acc_...), or shared (any Account may send), or none (linked to nothing, sends nothing)." },
210
+ domain: { type: "string", description: "Only Mailboxes on this domain." }
211
+ },
212
+ run: online(runList)
213
+ });
214
+ var getCmd = defineCommand({
215
+ meta: {
216
+ name: "get",
217
+ description: "One Mailbox: address, state, Sends for and its suggestion, daily cap (and cap_lowered_to when a spam reading lowered it), sent today, bounces over 7 days, signature, which Accounts and Campaigns used it. Every role reads.",
218
+ risk: "read",
219
+ errors: NOT_FOUND,
220
+ seeAlso: ["curviate mailbox list", "curviate mailbox update"],
221
+ examples: ["curviate mailbox get mbx_YOUR_MAILBOX_ID"]
222
+ },
223
+ args: { ...readOnly(READ_SINGLE_FLAGS), id: ID },
224
+ run: online(runGet)
225
+ });
226
+ var updateCmd = defineCommand({
227
+ meta: {
228
+ name: "update",
229
+ description: "Change one Mailbox: who it sends for (--sends-for an Account id, or shared), its daily cap (--daily-cap, 1 to 50, one cap across every Campaign and Account, a hard maximum for every caller) and its signature (--signature-file, plain text, up to 2,000 characters, available as {{mailbox.signature}}; nothing adds it to an email by itself). Flags you leave out stay as they are. A Mailbox linked to no Account sends nothing. Owners and Managers change any Mailbox; a Member only the ones they connected.",
230
+ risk: "write",
231
+ rules: {
232
+ changes: "The Mailbox's link, daily cap or signature, from the next email on. Open threads stay on it.",
233
+ visible_to: "Your Team; the signature reaches recipients where a step uses {{mailbox.signature}}.",
234
+ budget_rows: [],
235
+ retry: "Safe: the same flags leave the same Mailbox.",
236
+ undo: "Update again with the previous values.",
237
+ blast_radius: "One Mailbox's sending, in every Campaign that uses it."
238
+ },
239
+ errors: { ...NOT_FOUND, ACCOUNT_NOT_FOUND: "--sends-for names an Account outside your Team.", INVALID_REQUEST: "a value is out of range (a cap above 50, a signature over 2,000 characters); the message names the limit.", INSUFFICIENT_ROLE: "a Member changes only the Mailboxes they connected." },
240
+ seeAlso: ["curviate mailbox get", "curviate mailbox pause"],
241
+ examples: [
242
+ "curviate mailbox update mbx_YOUR_MAILBOX_ID --sends-for acc_YOUR_ACCOUNT_ID",
243
+ "curviate mailbox update mbx_YOUR_MAILBOX_ID --sends-for shared --daily-cap 40",
244
+ "curviate mailbox update mbx_YOUR_MAILBOX_ID --signature-file signature.txt"
245
+ ],
246
+ requires: ["at least one of --sends-for, --daily-cap, --signature-file."]
247
+ },
248
+ args: {
249
+ ...WRITE_SINGLE_FLAGS,
250
+ id: ID,
251
+ "sends-for": { type: "string", description: "An Account id (acc_..., it then sends only for that Account) or shared (any Account of your Team may send from it)." },
252
+ "daily-cap": { type: "string", description: "Emails a day across every Campaign and Account, 1 to 50. The API refuses a higher value (exit 2, the message names 50)." },
253
+ "signature-file": { type: "string", stdinArg: true, description: "A plain-text file with the sign-off: a path, or - to read it from stdin. Up to 2,000 characters." }
254
+ },
255
+ run: online(runUpdate)
256
+ });
257
+ var pauseCmd = defineCommand({
258
+ meta: {
259
+ name: "pause",
260
+ description: "Stop a Mailbox sending until you resume it. Emails due from it wait; nothing is sent from it meanwhile.",
261
+ risk: "write",
262
+ rules: {
263
+ changes: "The Mailbox's state becomes paused; no email leaves it.",
264
+ visible_to: "Your Team.",
265
+ budget_rows: [],
266
+ retry: "Safe to repeat.",
267
+ undo: "`curviate mailbox resume <id>`.",
268
+ blast_radius: "One Mailbox's sending."
269
+ },
270
+ errors: { ...NOT_FOUND, MAILBOX_STATE_CONFLICT: "the Mailbox is not in a state that can be paused." },
271
+ seeAlso: ["curviate mailbox resume"],
272
+ examples: ["curviate mailbox pause mbx_YOUR_MAILBOX_ID"]
273
+ },
274
+ args: { ...WRITE_SINGLE_FLAGS, id: ID },
275
+ run: online(act("pause"))
276
+ });
277
+ var resumeCmd = defineCommand({
278
+ meta: {
279
+ name: "resume",
280
+ description: "Let a paused Mailbox send again. A Mailbox that is not paused, or one paused by bounces or by its provider with no date, is refused with MAILBOX_STATE_CONFLICT and stays as it was.",
281
+ risk: "write",
282
+ rules: {
283
+ changes: "The Mailbox sends again, under its daily cap.",
284
+ visible_to: "Your Team; recipients of what it then sends.",
285
+ budget_rows: [],
286
+ retry: "Safe: a second call on a Mailbox that already sends answers MAILBOX_STATE_CONFLICT.",
287
+ undo: "`curviate mailbox pause <id>`.",
288
+ blast_radius: "One Mailbox's sending."
289
+ },
290
+ errors: { ...NOT_FOUND, MAILBOX_STATE_CONFLICT: "the Mailbox is not paused by a person, or its pause is not yours to lift." },
291
+ seeAlso: ["curviate mailbox pause"],
292
+ examples: ["curviate mailbox resume mbx_YOUR_MAILBOX_ID"]
293
+ },
294
+ args: { ...WRITE_SINGLE_FLAGS, id: ID },
295
+ run: online(act("resume"))
296
+ });
297
+ var removeCmd = defineCommand({
298
+ meta: {
299
+ name: "remove",
300
+ description: "Remove a Mailbox and delete its stored credentials in one step. Changes no seat count and makes no billing call. Connect it again to use the address afterwards.",
301
+ risk: "high",
302
+ rules: {
303
+ changes: "The Mailbox and its credentials are deleted; emails due from it are not sent.",
304
+ visible_to: "Your Team.",
305
+ budget_rows: [],
306
+ retry: "Safe: a second call answers MAILBOX_NOT_FOUND.",
307
+ undo: "None: connect the address again.",
308
+ blast_radius: "One Mailbox and every Campaign that sends from it."
309
+ },
310
+ errors: NOT_FOUND,
311
+ seeAlso: ["curviate mailbox list", "curviate mailbox pause"],
312
+ examples: ["curviate mailbox remove mbx_YOUR_MAILBOX_ID"]
313
+ },
314
+ args: { ...WRITE_SINGLE_FLAGS, id: ID },
315
+ run: online(act("remove"))
316
+ });
317
+ var ADDRESS = { type: "positional", description: "The email address." };
318
+ var PASSWORD_STDIN = {
319
+ type: "boolean",
320
+ description: "Check and keep a password the person gave you: one line from stdin, never echoed, sent only in the request body and never printed. No flag takes the password as a value: it would show in `ps` and in shell history.",
321
+ default: false
322
+ };
323
+ var discoverCmd = defineCommand({
324
+ meta: {
325
+ name: "discover",
326
+ description: "Find the IMAP and SMTP settings for an email address, to show the person and confirm before connecting. An address on Google or Microsoft answers with its connection. confirm_required marks settings that arrived unencrypted. Takes no password and the answer holds none.",
327
+ risk: "read",
328
+ seeAlso: ["curviate mailbox connect"],
329
+ examples: ["curviate mailbox discover anna@acme.example"]
330
+ },
331
+ args: { ...readOnly(READ_SINGLE_FLAGS), address: ADDRESS },
332
+ run: online(runDiscover)
333
+ });
334
+ var connectCmd = defineCommand({
335
+ meta: {
336
+ name: "connect",
337
+ description: "Connect a new Mailbox: creates a Connect request and prints its link for the person, who finishes in their Curviate dashboard. --connection google_sign_in (a Google Workspace whose administrator trusts Curviate) and microsoft_sign_in print the sign-in link and, where the provider needs one, the administrator link. google_app_password and imap_smtp can also take the password from you: pipe it to --password-stdin, Curviate checks it before answering, and the Mailbox is connected in this one call. imap_smtp needs the six server flags (the settings from `curviate mailbox discover`, as the person confirmed them). One API call.",
338
+ risk: "write",
339
+ rules: {
340
+ changes: "Creates a Connect request. With --password-stdin on google_app_password or imap_smtp, the password is checked and, if it works, the Mailbox is connected and the password is stored sealed (never returned).",
341
+ visible_to: "Your Team: the request is listed under Accounts for the person it is for.",
342
+ budget_rows: [],
343
+ retry: "Not safe: a repeated call creates a second request. Read `curviate account connect-request get <request_id>` first.",
344
+ undo: "`curviate account connect-request cancel <request_id>` before it completes; `curviate mailbox remove <id>` after."
345
+ },
346
+ errors: {
347
+ MAILBOX_ALREADY_CONNECTED: "this address is already a Mailbox of your Team.",
348
+ MAILBOX_APP_PASSWORD_REQUIRED: "a private Gmail address connects with an app password, not google_sign_in; or the password is Google's own, not an app password.",
349
+ MAILBOX_CREDENTIAL_REJECTED: "the host refused the password (exit 8); the request stays open for another try.",
350
+ MAILBOX_TLS_FAILED: "the host does not offer the encryption the settings name (exit 8).",
351
+ MAILBOX_LIMIT_REACHED: "your Team is past its Mailbox allowance (exit 2)."
352
+ },
353
+ seeAlso: ["curviate mailbox discover", "curviate mailbox reconnect", "curviate account connect-request get"],
354
+ examples: [
355
+ "curviate mailbox connect anna@acme.example --connection google_sign_in",
356
+ "curviate mailbox connect anna@gmail.com --connection google_app_password --password-stdin < app-password.txt",
357
+ "curviate mailbox connect anna@acme.example --connection imap_smtp --imap-host imap.acme.example --imap-port 993 --imap-security tls --smtp-host smtp.acme.example --smtp-port 465 --smtp-security tls --password-stdin < mail-password.txt"
358
+ ],
359
+ requires: ["--connection: google_app_password, google_sign_in, microsoft_sign_in or imap_smtp.", "--connection imap_smtp: --imap-host, --imap-port, --imap-security, --smtp-host, --smtp-port, --smtp-security."]
360
+ },
361
+ args: {
362
+ ...WRITE_SINGLE_FLAGS,
363
+ address: ADDRESS,
364
+ connection: { type: "string", description: `How the Mailbox connects: ${CONNECTIONS.join(" | ")}.` },
365
+ "password-stdin": PASSWORD_STDIN,
366
+ "imap-host": { type: "string", description: "imap_smtp only: the IMAP host." },
367
+ "imap-port": { type: "string", description: "imap_smtp only: the IMAP port (usually 993 with tls, 143 with starttls)." },
368
+ "imap-security": { type: "string", description: "imap_smtp only: tls (TLS from the first byte) or starttls. Never cleartext." },
369
+ "smtp-host": { type: "string", description: "imap_smtp only: the SMTP submission host." },
370
+ "smtp-port": { type: "string", description: "imap_smtp only: the SMTP submission port (usually 465 with tls, 587 with starttls)." },
371
+ "smtp-security": { type: "string", description: "imap_smtp only: tls or starttls. Never cleartext." }
372
+ },
373
+ run: online(runConnect)
374
+ });
375
+ var reconnectCmd = defineCommand({
376
+ meta: {
377
+ name: "reconnect",
378
+ description: "Reconnect a Mailbox of your Team (state reconnect_needed, or any other): creates a Connect request and prints its link for the person. With --password-stdin on a google_app_password or imap_smtp Mailbox, the new password is checked and replaces the old one in this one call. On a google_sign_in Mailbox, --password-stdin adds an app password beside the sign-in, for warm-up; sending and reply checks stay on the sign-in. A microsoft_sign_in Mailbox takes no password. One API call.",
379
+ risk: "write",
380
+ rules: {
381
+ changes: "Creates a Connect request. With --password-stdin, the password is checked and stored sealed in place of the old one (never returned).",
382
+ visible_to: "Your Team.",
383
+ budget_rows: [],
384
+ retry: "Not safe: a repeated call creates a second request. Read `curviate account connect-request get <request_id>` first.",
385
+ undo: "`curviate account connect-request cancel <request_id>` before it completes."
386
+ },
387
+ errors: { ...NOT_FOUND, MAILBOX_CREDENTIAL_REJECTED: "the host refused the password (exit 8); the request stays open for another try.", MAILBOX_ADDRESS_MISMATCH: "the sign-in was for another address; nothing changed." },
388
+ seeAlso: ["curviate mailbox connect", "curviate account connect-request get"],
389
+ examples: ["curviate mailbox reconnect mbx_YOUR_MAILBOX_ID", "curviate mailbox reconnect mbx_YOUR_MAILBOX_ID --password-stdin < app-password.txt"]
390
+ },
391
+ args: { ...WRITE_SINGLE_FLAGS, id: ID, "password-stdin": PASSWORD_STDIN },
392
+ run: online(runReconnect)
393
+ });
394
+ var mailboxCommand = defineCommand({
395
+ meta: { name: "mailbox", description: DESCRIPTIONS["mailbox"] },
396
+ subCommands: { list: listCmd, get: getCmd, update: updateCmd, pause: pauseCmd, resume: resumeCmd, remove: removeCmd, discover: discoverCmd, connect: connectCmd, reconnect: reconnectCmd },
397
+ async run() {
398
+ const { showHelp } = await import("./examples-77WVMKZQ.js");
399
+ await showHelp(mailboxCommand, ["curviate", "mailbox"]);
400
+ }
401
+ });
402
+ export {
403
+ MAILBOX_REQUEST_INSTRUCTION,
404
+ mailboxCommand,
405
+ requestLines
406
+ };
@@ -13,21 +13,21 @@ import {
13
13
  runMessageSend,
14
14
  sentAsNotice,
15
15
  willSendAsNotice
16
- } from "./chunk-A3UNS44U.js";
16
+ } from "./chunk-FHSGANM6.js";
17
17
  import "./chunk-UWO2D4HW.js";
18
- import "./chunk-Q3ZPRFUX.js";
19
18
  import "./chunk-UEAX6KUB.js";
19
+ import "./chunk-Q3ZPRFUX.js";
20
20
  import "./chunk-VHNF6OZD.js";
21
- import "./chunk-ACKKHLUH.js";
21
+ import "./chunk-Z3RPQ5K4.js";
22
22
  import "./chunk-TCUYH5GO.js";
23
- import "./chunk-KXJJFHSD.js";
23
+ import "./chunk-R7USRN52.js";
24
24
  import "./chunk-QM57YDJE.js";
25
- import "./chunk-N76WNJ5T.js";
25
+ import "./chunk-S234PC5E.js";
26
26
  import "./chunk-QLKGOIWS.js";
27
- import "./chunk-R4HS2MWM.js";
27
+ import "./chunk-QBY6L77D.js";
28
28
  import "./chunk-FDJMAF7D.js";
29
29
  import "./chunk-ZYURL5VK.js";
30
- import "./chunk-QW5K5DTC.js";
30
+ import "./chunk-RDKTHFQ6.js";
31
31
  export {
32
32
  guardBareMessageForm,
33
33
  messageCommand,