@curviate/cli 0.56.0 → 0.58.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 (70) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/README.md +9 -2
  3. package/dist/{account-ZF5NEMID.js → account-GSL6BCNX.js} +49 -13
  4. package/dist/{analytics-M7JWS67A.js → analytics-4FUMJSMC.js} +6 -6
  5. package/dist/{beta-consent-4Q2LZZQC.js → beta-consent-EC2QF6CM.js} +4 -4
  6. package/dist/billing-STRNXA4H.js +19 -0
  7. package/dist/{chunk-XP6S6E55.js → chunk-3IL3D5IZ.js} +2 -2
  8. package/dist/{chunk-UWRWZG4N.js → chunk-5OAJ4D65.js} +2 -2
  9. package/dist/{chunk-AMTKGO37.js → chunk-5Z3CCE5N.js} +1 -1
  10. package/dist/chunk-7F6B7P32.js +359 -0
  11. package/dist/{chunk-UOWOKEB2.js → chunk-CQHCPZ5I.js} +1 -1
  12. package/dist/{chunk-RDKTHFQ6.js → chunk-EWSOIFG2.js} +21 -0
  13. package/dist/{chunk-RKNW4UX4.js → chunk-JKOQX46J.js} +6 -0
  14. package/dist/{chunk-VHNF6OZD.js → chunk-JY26SUNH.js} +18 -2
  15. package/dist/{chunk-VEMK4MJM.js → chunk-KS4I4B3Z.js} +6 -6
  16. package/dist/{chunk-MIOEYSBQ.js → chunk-KUVJM5CP.js} +1 -1
  17. package/dist/{chunk-CRO7PJ4I.js → chunk-MLZSXQZC.js} +2 -2
  18. package/dist/{chunk-7PLTQHNO.js → chunk-PBJZQZPO.js} +1 -1
  19. package/dist/{chunk-J4SFOFMT.js → chunk-WGGZWJPO.js} +11 -11
  20. package/dist/{chunk-L3RJU7C3.js → chunk-WITIJCUU.js} +115 -14
  21. package/dist/{chunk-MWVTFTWV.js → chunk-XDPU2YAF.js} +8 -5
  22. package/dist/{chunk-EI64VFBE.js → chunk-XXB4MAX3.js} +121 -11
  23. package/dist/cli.js +30 -28
  24. package/dist/{comment-D6RSZTVK.js → comment-MUELYZYN.js} +8 -8
  25. package/dist/{company-3Z6PXGTW.js → company-5N7CXORR.js} +21 -10
  26. package/dist/company-record-HWLTP4TV.js +213 -0
  27. package/dist/{config-VY5MCJMN.js → config-PI7JMQ2L.js} +2 -2
  28. package/dist/{connect-G2RTLV7G.js → connect-NNZOOPWV.js} +11 -11
  29. package/dist/{contact-QSLJCBDE.js → contact-VNG7HRCN.js} +8 -8
  30. package/dist/{contact-groups-OITAD73K.js → contact-groups-6JF7VX6Q.js} +10 -10
  31. package/dist/{contact-import-LT7BKESC.js → contact-import-TMJWY2VD.js} +10 -10
  32. package/dist/core-ZRJY3HTF.js +46 -0
  33. package/dist/{do-not-contact-ZA7KS5WD.js → do-not-contact-GDVIUNMT.js} +19 -17
  34. package/dist/{doctor-JQT3DO6G.js → doctor-ZNAR5AZ2.js} +21 -4
  35. package/dist/{document-H65EXU4L.js → document-G6UND26L.js} +1 -1
  36. package/dist/{domain-7EX4E34B.js → domain-62YUYVDW.js} +8 -8
  37. package/dist/{draft-7U6H4BPF.js → draft-ED6RL67K.js} +5 -5
  38. package/dist/{enrollment-AZ6XGVVL.js → enrollment-LN3Z3RC5.js} +11 -7
  39. package/dist/{examples-IGQJCSNL.js → examples-5FJS47QF.js} +2 -2
  40. package/dist/{exit-codes-ZSOLAXQO.js → exit-codes-LQDMGDII.js} +1 -1
  41. package/dist/{export-OYMQXL62.js → export-S6D4FEAG.js} +4 -4
  42. package/dist/{feed-M5D4SJW7.js → feed-AC7HWUCD.js} +6 -6
  43. package/dist/{group-UTC3YBKE.js → group-6N37Q5ZS.js} +6 -6
  44. package/dist/{inbox-VSGNHSLG.js → inbox-JFRBROQ2.js} +6 -6
  45. package/dist/{inboxes-23C2MJK4.js → inboxes-IBZHZKSD.js} +6 -6
  46. package/dist/{incoming-QVPP32K7.js → incoming-YDRPPO24.js} +5 -5
  47. package/dist/{job-ZHVFFRWE.js → job-CSRHIFZM.js} +6 -6
  48. package/dist/{login-6OTNXEJZ.js → login-M7ZLOR2U.js} +2 -2
  49. package/dist/mailbox-E2K3I2VH.js +712 -0
  50. package/dist/{message-PIV77W47.js → message-SX6RDGWP.js} +7 -7
  51. package/dist/{motion-AHYF34DP.js → motion-4HH3OFI6.js} +118 -13
  52. package/dist/{network-RJHJFZEY.js → network-JQYLSQDH.js} +9 -9
  53. package/dist/{notification-XGR4NT3S.js → notification-ZAQM463D.js} +6 -6
  54. package/dist/{notifications-BHRWSHPR.js → notifications-N55F3DP3.js} +14 -9
  55. package/dist/{post-Z7AVDDKA.js → post-SIHHJX3P.js} +8 -8
  56. package/dist/{profile-YZNBX2RP.js → profile-VBHX3QGP.js} +12 -12
  57. package/dist/{recruiter-EXM4P7X7.js → recruiter-7AGFKQPI.js} +9 -9
  58. package/dist/{sales-nav-CKDSEXV2.js → sales-nav-ADVFBKWB.js} +9 -9
  59. package/dist/{search-B7FB6674.js → search-THJFPGOH.js} +16 -16
  60. package/dist/{setup-VZVPLJ4V.js → setup-D6D7SNND.js} +4 -4
  61. package/dist/signal-TGSF7WEP.js +438 -0
  62. package/dist/{team-PYABBUHO.js → team-MVNHCWJP.js} +59 -5
  63. package/dist/{tier-PRK4WQKR.js → tier-DAF7Y2HN.js} +6 -5
  64. package/dist/unibox-7B6B4SXB.js +741 -0
  65. package/dist/{webhook-V74EV4E2.js → webhook-NUVSTDXF.js} +9 -9
  66. package/package.json +3 -3
  67. package/dist/billing-LYPSX5SR.js +0 -196
  68. package/dist/core-RFTNNB6P.js +0 -46
  69. package/dist/mailbox-HD2UXZCA.js +0 -405
  70. package/dist/unibox-ZNKX2EKL.js +0 -410
@@ -0,0 +1,741 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ print,
4
+ table
5
+ } from "./chunk-5S3MJVI5.js";
6
+ import {
7
+ AttachError,
8
+ readAttachment,
9
+ toAttachmentPayload
10
+ } from "./chunk-JY26SUNH.js";
11
+ import {
12
+ fail,
13
+ listFlag,
14
+ outputOpts,
15
+ rootClient,
16
+ usage
17
+ } from "./chunk-5OAJ4D65.js";
18
+ import {
19
+ buildPreviewOutput
20
+ } from "./chunk-TCUYH5GO.js";
21
+ import {
22
+ intFlag
23
+ } from "./chunk-NNV2OYEF.js";
24
+ import {
25
+ pageDelayFromFlags,
26
+ readCursorFlag,
27
+ readMaxPagesFlag,
28
+ readablePage,
29
+ rejectPaginationModifiersWithoutAll,
30
+ streamAll
31
+ } from "./chunk-KUVJM5CP.js";
32
+ import {
33
+ renderSuccess,
34
+ writeNdjsonItem
35
+ } from "./chunk-QM57YDJE.js";
36
+ import "./chunk-PBJZQZPO.js";
37
+ import {
38
+ GLOBAL_FLAGS,
39
+ WRITE_SINGLE_FLAGS,
40
+ readOnly
41
+ } from "./chunk-QLKGOIWS.js";
42
+ import {
43
+ DESCRIPTIONS
44
+ } from "./chunk-XDPU2YAF.js";
45
+ import "./chunk-ZYURL5VK.js";
46
+
47
+ // src/commands/unibox.ts
48
+ import { defineCommand } from "citty";
49
+ var EMAIL_MAX_FILES = 10;
50
+ var EMAIL_MAX_FILE_BYTES = 20 * 1024 * 1024;
51
+ var ids = (f) => ({ accountId: String(f.accountId ?? ""), chatId: String(f.chatId ?? "") });
52
+ var preview = (method, args, body = {}) => print(JSON.stringify(buildPreviewOutput({ method, args, body })));
53
+ async function paged(f, params, fetch, human) {
54
+ rejectPaginationModifiersWithoutAll(f, process);
55
+ const cursor = readCursorFlag(f, process);
56
+ if (cursor) params["cursor"] = cursor;
57
+ if (f.all) {
58
+ for await (const item of streamAll((p) => fetch(p), params, { maxPages: readMaxPagesFlag(f, process), out: process, pageDelayMs: pageDelayFromFlags(f) })) writeNdjsonItem(process, item, f.fields);
59
+ return;
60
+ }
61
+ const page = readablePage(await fetch(params));
62
+ if (outputOpts(f).json) return renderSuccess(page, outputOpts(f), process);
63
+ human(page);
64
+ if (page["cursor"]) print(`next page: --cursor ${String(page["cursor"])}`);
65
+ }
66
+ function chatWith(i) {
67
+ const g = i["group"];
68
+ if (!g) return i["counterpart"]?.["name"];
69
+ if (g["title"]) return g["title"];
70
+ const members = g["members"] ?? [];
71
+ return g["members_known"] && members.length ? members.map((m) => m["name"] ?? "Name pending").join(", ") : "Group chat";
72
+ }
73
+ async function runList(c, f) {
74
+ const q = {};
75
+ if (f.accounts !== void 0) q["account_ids"] = listFlag("accounts", f.accounts);
76
+ if (f.campaign !== void 0) q["campaign_ids"] = listFlag("campaign", f.campaign);
77
+ if (f.tag !== void 0) q["tags"] = listFlag("tag", f.tag);
78
+ if (f.person !== void 0) q["person"] = f.person;
79
+ if (f.unread !== void 0) q["unread"] = f.unread;
80
+ if (f["last-from"] !== void 0) q["last_message_from"] = f["last-from"];
81
+ if (f.type !== void 0) q["type"] = f.type;
82
+ if (f.query !== void 0) q["q"] = f.query;
83
+ if (f["reply-label"] !== void 0) q["reply_label"] = listFlag("reply-label", f["reply-label"]);
84
+ if (f.total) q["include_total"] = true;
85
+ if (f.limit !== void 0) q["limit"] = intFlag("limit", f.limit, 1, 100);
86
+ try {
87
+ await paged(f, q, (p) => c.unibox.list(p), (page) => {
88
+ const unread = (i) => i["unread"] ? i["marked_unread"] ? "marked" : "yes" : "";
89
+ const campaign = (i) => i["campaign_context"]?.["campaign_name"];
90
+ const label = (i) => i["reply_label"]?.["label"];
91
+ print(table(
92
+ ["ACCOUNT", "CHAT", "WITH", "UNREAD", "LAST", "FROM", "LABEL", "CAMPAIGN", "TAGS"],
93
+ page.items.map((i) => [i["account_id"], i["chat_id"], chatWith(i), unread(i), i["last_activity_at"], i["last_message_from"], label(i), campaign(i), i["tags"]?.join(", ")])
94
+ ));
95
+ if (typeof page["total"] === "number") print(`total: ${page["total"]} chats match`);
96
+ });
97
+ } catch (err) {
98
+ await fail(err, f);
99
+ }
100
+ }
101
+ async function runGet(c, f) {
102
+ const { accountId, chatId } = ids(f);
103
+ try {
104
+ renderSuccess(await c.unibox.get(accountId, chatId), outputOpts(f), process);
105
+ } catch (err) {
106
+ await fail(err, f);
107
+ }
108
+ }
109
+ async function runUnread(c, f) {
110
+ try {
111
+ renderSuccess(await c.unibox.unreadCount(f.accounts === void 0 ? {} : { account_ids: listFlag("accounts", f.accounts) }), outputOpts(f), process);
112
+ } catch (err) {
113
+ await fail(err, f);
114
+ }
115
+ }
116
+ async function runMessages(c, f) {
117
+ const { accountId, chatId } = ids(f);
118
+ const q = {};
119
+ if (f.limit !== void 0) q["limit"] = intFlag("limit", f.limit, 1, 25);
120
+ try {
121
+ await paged(f, q, (p) => c.account(accountId).messaging.listMessages(chatId, p), (page) => print(table(["AT", "FROM", "ORIGIN", "TEXT"], page.items.map((m) => [m["timestamp"], m["is_sender"] ? "me" : m["sender"]?.["display_name"] ?? m["sender_id"], m["origin"], m["text"]]))));
122
+ } catch (err) {
123
+ await fail(err, f);
124
+ }
125
+ }
126
+ var conversationId = (f, cmd) => {
127
+ const id = String(f.conversationId ?? "");
128
+ return id.trim() !== "" ? id : usage(`the conversation id is missing: \`curviate unibox ${cmd} <conversation_id>\` (each chat of \`unibox list\` carries conversation_id).`);
129
+ };
130
+ async function runConversationMark(c, f) {
131
+ const id = conversationId(f, "conversation mark");
132
+ if (f.read === void 0 === (f.unread === void 0)) usage("pass exactly one of --read or --unread.");
133
+ const body = { read: f.read ?? !f.unread };
134
+ if (f.preview) return preview("unibox.markConversation", { conversation_id: id }, body);
135
+ try {
136
+ renderSuccess(await c.unibox.markConversation(id, body), outputOpts(f), process);
137
+ } catch (err) {
138
+ await fail(err, f);
139
+ }
140
+ }
141
+ async function runEmailSend(c, f) {
142
+ const id = conversationId(f, "email send");
143
+ if (!f.text || f.text.trim() === "") usage('the email text is required: `curviate unibox email send <conversation_id> "<text>" (--thread <thread_id> | --subject <subject>)`.');
144
+ if (f.thread === void 0 === (f.subject === void 0)) usage("pass --thread <thread_id> to reply in a thread, or --subject <subject> to start a new one (not both).");
145
+ if (f.mailbox !== void 0 && f.thread !== void 0) usage("--mailbox goes with a new thread (--subject): a reply goes from its thread's Mailbox.");
146
+ const body = { text: f.text, ...f.thread !== void 0 ? { thread_id: f.thread } : { subject: f.subject }, ...f.mailbox !== void 0 ? { mailbox_id: f.mailbox } : {} };
147
+ const cc = f.cc === void 0 ? [] : listFlag("cc", f.cc);
148
+ const bcc = f.bcc === void 0 ? [] : listFlag("bcc", f.bcc);
149
+ if (cc.length + bcc.length > 20) usage("--cc and --bcc take at most 20 addresses together.");
150
+ if (cc.length) body["cc"] = cc;
151
+ if (bcc.length) body["bcc"] = bcc;
152
+ const paths = f.attach === void 0 ? [] : [].concat(f.attach);
153
+ if (paths.length > EMAIL_MAX_FILES) usage(`--attach takes at most ${EMAIL_MAX_FILES} files.`);
154
+ const files = [];
155
+ for (const p of paths) {
156
+ try {
157
+ files.push({ path: p, buf: await readAttachment(p) });
158
+ } catch (err) {
159
+ if (err instanceof AttachError) usage(err.message);
160
+ throw err;
161
+ }
162
+ }
163
+ const total = files.reduce((n, x) => n + x.buf.length, 0);
164
+ if (total > EMAIL_MAX_FILE_BYTES) usage(`--attach: the files total ${total} bytes, over 20 MiB; nothing was sent. A link usually lands better than a file.`);
165
+ if (files.length) body["attachments"] = files.map((x) => {
166
+ const a = toAttachmentPayload(x.path, x.buf);
167
+ return { filename: a.filename, content_type: a.content_type, content: a.content };
168
+ });
169
+ if (f.preview) return void print(JSON.stringify(buildPreviewOutput({ method: "unibox.sendEmail", args: { conversation_id: id }, body: { ...body, attachments: void 0 }, attachments: files.map((x) => ({ name: x.path.split("/").pop(), buffer: x.buf })) })));
170
+ try {
171
+ const sent = await c.unibox.sendEmail(id, body);
172
+ for (const w of sent["warnings"] ?? []) {
173
+ process.stderr.write(`warning: ${String(w["code"])}: ${(w["addresses"] ?? []).join(", ")} got nothing; everyone else did.
174
+ `);
175
+ }
176
+ renderSuccess(sent, outputOpts(f), process);
177
+ } catch (err) {
178
+ if (err.outcomeUnknown === true) {
179
+ process.stderr.write(`The outcome is unknown: the email may have been sent, and it is kept in the conversation as sent. Do not send it again; read \`curviate unibox conversation timeline ${id} --channel email\`.
180
+ `);
181
+ }
182
+ await fail(err, f);
183
+ }
184
+ }
185
+ var messageId = (f, cmd) => {
186
+ const id = String(f.messageId ?? "");
187
+ return id.trim() !== "" ? id : usage(`the message id is missing: \`curviate unibox referral ${cmd} <message_id>\` (the reply labelled referral).`);
188
+ };
189
+ async function runReferralSearch(c, f) {
190
+ const id = messageId(f, "search");
191
+ const body = f.name === void 0 ? {} : { name: f.name };
192
+ if (f.preview) return preview("unibox.referralSearch", { message_id: id }, body);
193
+ try {
194
+ renderSuccess(await c.unibox.referralSearch(id, body), outputOpts(f), process);
195
+ } catch (err) {
196
+ await fail(err, f);
197
+ }
198
+ }
199
+ async function runReferralConfirm(c, f) {
200
+ const id = messageId(f, "confirm");
201
+ if (f["provider-id"] === void 0 === (f["linkedin-url"] === void 0)) usage("pass exactly one of --provider-id (from `unibox referral search`) or --linkedin-url.");
202
+ const body = f["provider-id"] !== void 0 ? { provider_id: f["provider-id"] } : { linkedin_url: f["linkedin-url"] };
203
+ if (f.preview) return preview("unibox.referralConfirm", { message_id: id }, body);
204
+ try {
205
+ renderSuccess(await c.unibox.referralConfirm(id, body), outputOpts(f), process);
206
+ } catch (err) {
207
+ await fail(err, f);
208
+ }
209
+ }
210
+ async function runConversation(c, f) {
211
+ const id = conversationId(f, "conversation get");
212
+ try {
213
+ renderSuccess(await c.unibox.getConversation(id), outputOpts(f), process);
214
+ } catch (err) {
215
+ await fail(err, f);
216
+ }
217
+ }
218
+ async function runTimeline(c, f) {
219
+ const id = conversationId(f, "conversation timeline");
220
+ try {
221
+ const q = {};
222
+ if (f.channel !== void 0) {
223
+ if (!["linkedin", "email"].includes(f.channel)) usage("--channel takes linkedin or email.");
224
+ q["channel"] = f.channel;
225
+ }
226
+ if (f.limit !== void 0) q["limit"] = intFlag("limit", f.limit, 1, 100);
227
+ await paged(f, q, (p) => c.unibox.listConversationMessages(id, p), (page) => print(table(["AT", "CHANNEL", "FROM", "TEXT"], page.items.map((m) => [
228
+ m["timestamp"],
229
+ m["channel"] ?? "event",
230
+ m["channel"] === null ? m["kind"] : m["is_sender"] ? "me" : m["sender"]?.["display_name"] ?? m["from"] ?? m["sender_id"],
231
+ m["channel"] === null ? m["campaign_name"] ?? "" : m["channel"] === "email" ? m["subject"] ?? m["text"] : m["text"]
232
+ ]))));
233
+ } catch (err) {
234
+ await fail(err, f);
235
+ }
236
+ }
237
+ async function runReply(c, f) {
238
+ const { accountId, chatId } = ids(f);
239
+ if (!f.text) usage('the message text is required: `curviate unibox reply <account_id> <chat_id> "<text>"`.');
240
+ const body = { text: f.text };
241
+ if (f.preview) return preview("messaging.sendMessage", { account_id: accountId, chat_id: chatId }, body);
242
+ try {
243
+ renderSuccess(await c.account(accountId).messaging.sendMessage(chatId, body), outputOpts(f), process);
244
+ } catch (err) {
245
+ await fail(err, f);
246
+ }
247
+ }
248
+ async function runMark(c, f) {
249
+ const { accountId, chatId } = ids(f);
250
+ if (f.read === void 0 === (f.unread === void 0)) usage("pass exactly one of --read or --unread.");
251
+ const body = { read: f.read ?? !f.unread };
252
+ if (f.preview) return preview("messaging.markChatRead", { account_id: accountId, chat_id: chatId }, body);
253
+ try {
254
+ renderSuccess(await c.account(accountId).messaging.markChatRead(chatId, body), outputOpts(f), process);
255
+ } catch (err) {
256
+ await fail(err, f);
257
+ }
258
+ }
259
+ async function runTag(c, f) {
260
+ const { accountId, chatId } = ids(f);
261
+ const body = f.tag === void 0 ? {} : { tags: listFlag("tag", f.tag) };
262
+ if (f.preview) return preview("unibox.tagLead", { account_id: accountId, chat_id: chatId }, body);
263
+ try {
264
+ renderSuccess(await c.unibox.tagLead(accountId, chatId, body), outputOpts(f), process);
265
+ } catch (err) {
266
+ await fail(err, f);
267
+ }
268
+ }
269
+ async function runEnroll(c, f) {
270
+ const { accountId, chatId } = ids(f);
271
+ const campaign = typeof f.campaign === "string" && f.campaign.trim() !== "" ? f.campaign : usage("--campaign is required: the Campaign to enroll the person in (mot_...).");
272
+ const body = { campaign_id: campaign };
273
+ if (f.preview) return preview("unibox.enroll", { account_id: accountId, chat_id: chatId }, body);
274
+ try {
275
+ renderSuccess(await c.unibox.enroll(accountId, chatId, body), outputOpts(f), process);
276
+ } catch (err) {
277
+ await fail(err, f);
278
+ }
279
+ }
280
+ async function runRefresh(c, f) {
281
+ const body = f.accounts === void 0 ? {} : { account_ids: listFlag("accounts", f.accounts) };
282
+ if (f.preview) return preview("unibox.refresh", {}, body);
283
+ try {
284
+ renderSuccess(await c.unibox.refresh(body), outputOpts(f), process);
285
+ } catch (err) {
286
+ await fail(err, f);
287
+ }
288
+ }
289
+ var REPLY_LABELS = ["interested", "not_now", "not_interested", "opt_out", "out_of_office", "referral", "other"];
290
+ async function runLabel(c, f) {
291
+ const messageId2 = String(f.messageId ?? "");
292
+ if (messageId2.trim() === "") usage("the message id is required: `curviate unibox label <message_id>`, as `curviate unibox messages` prints it.");
293
+ if (f.set !== void 0) {
294
+ if (!REPLY_LABELS.includes(f.set)) usage(`--set takes one of ${REPLY_LABELS.join(", ")}.`);
295
+ const body = { reply_label: f.set };
296
+ if (f.preview) return preview("unibox.updateMessage", { message_id: messageId2 }, body);
297
+ try {
298
+ renderSuccess(await c.unibox.updateMessage(messageId2, body), outputOpts(f), process);
299
+ } catch (err) {
300
+ await fail(err, f);
301
+ }
302
+ return;
303
+ }
304
+ try {
305
+ const res = await c.unibox.getReplyLabel(messageId2);
306
+ if (outputOpts(f).json) return renderSuccess(res, outputOpts(f), process);
307
+ const cur = res.current;
308
+ print(cur ? `${String(cur["label"])} (${String(cur["source"])}${cur["confidence"] == null ? "" : `, confidence ${String(cur["confidence"])}`})` : "no label");
309
+ const history = res.history ?? [];
310
+ if (history.length > 1) print(table(["AT", "LABEL", "SOURCE", "CONFIDENCE", "SET BY"], history.map((h) => [h["set_at"], h["label"], h["source"], h["confidence"], h["set_by"]?.["name"]])));
311
+ } catch (err) {
312
+ await fail(err, f);
313
+ }
314
+ }
315
+ async function runAccounts(c, f) {
316
+ try {
317
+ const res = await c.unibox.accounts.list();
318
+ if (outputOpts(f).json) return renderSuccess(res, outputOpts(f), process);
319
+ print(table(
320
+ ["ACCOUNT", "STATUS", "FULL INBOX", "SYNC", "NEXT READ"],
321
+ (res.items ?? []).map((i) => [i["account_id"], i["account_status"], i["sync_full_inbox"] ? "on" : "off", i["sync"]?.["state"], i["sync"]?.["next_run_at"]])
322
+ ));
323
+ } catch (err) {
324
+ await fail(err, f);
325
+ }
326
+ }
327
+ async function runConsent(c, f) {
328
+ if (Boolean(f.on) === Boolean(f.off)) usage("pass exactly one of --on or --off.");
329
+ const accountId = String(f.accountId ?? "");
330
+ const body = { sync_full_inbox: Boolean(f.on) };
331
+ if (f.preview) return preview("unibox.accounts.update", { account_id: accountId }, body);
332
+ try {
333
+ renderSuccess(await c.unibox.accounts.update(accountId, body), outputOpts(f), process);
334
+ } catch (err) {
335
+ await fail(err, f);
336
+ }
337
+ }
338
+ var online = (fn) => async ({ args }) => {
339
+ const f = args;
340
+ await fn(await rootClient(f), f);
341
+ };
342
+ var ACCOUNT = { type: "positional", description: "The chat's Account (acc_...), as `curviate unibox list` prints it." };
343
+ var CHAT = { type: "positional", description: "The chat id, as `curviate unibox list` prints it." };
344
+ var ACCOUNTS = { type: "string", description: "Only these Accounts: a comma list of ids (acc_...). Never filled from your profile's default Account." };
345
+ var AUTOMATE = { TIER_REQUIRED: "your plan does not include the Unibox actions (Automate)." };
346
+ var ONE_TO_ONE = { CHAT_NOT_ONE_TO_ONE: "the chat is a group chat: there is no one person to save." };
347
+ var listCmd = defineCommand({
348
+ meta: {
349
+ name: "list",
350
+ description: "List the chats of every Account you may operate, newest activity first. Served from Curviate's store: no LinkedIn call, no budget. An Account without full-inbox sync shows only its Campaign chats; a disconnected Account's chats are listed read-only.",
351
+ risk: "read",
352
+ output: ["A table of Account, chat, person, unread (`marked` when made unread without a newer message), last activity, Reply label, Campaign and tags; with --total the count of matching chats. --json (or piped) prints the API page."],
353
+ examples: ["curviate unibox list --unread", "curviate unibox list --reply-label interested,unsure", "curviate unibox list --person con_YOUR_LEAD_ID --campaign none --total"]
354
+ },
355
+ args: {
356
+ ...readOnly(GLOBAL_FLAGS),
357
+ limit: { ...GLOBAL_FLAGS.limit, description: "Chats per page (1 to 100)." },
358
+ accounts: ACCOUNTS,
359
+ campaign: { type: "string", description: "Only chats linked to these Campaigns (mot_...), repeatable or a comma list; `none` for chats no Campaign links." },
360
+ person: { type: "string", description: "Only chats with this person: a Lead id (con_...) or a LinkedIn id (ACo...)." },
361
+ tag: { type: "string", description: "Only chats whose Lead has this tag; repeatable or a comma list." },
362
+ unread: { type: "boolean", description: "--unread for unread chats only, --no-unread for read ones; omit for both." },
363
+ "last-from": { type: "string", description: "Who wrote the last message: me or them." },
364
+ "reply-label": { type: "string", description: "Only chats whose latest Reply label is one of these, repeatable or a comma list: interested, not_now, not_interested, opt_out, out_of_office, referral, other, unsure; `none` adds chats with no label." },
365
+ type: { type: "string", description: "classic, inmail, sales_navigator or recruiter." },
366
+ query: { type: "string", description: "Person name or message text contains this (3 characters or more)." },
367
+ total: { type: "boolean", description: "Also count every chat that matches the filters (`total`)." }
368
+ },
369
+ run: online(runList)
370
+ });
371
+ var getCmd = defineCommand({
372
+ meta: {
373
+ name: "get",
374
+ description: "One chat as the Unibox lists it, with `marked_unread` ({origin, at}, or null) and its Campaign context.",
375
+ risk: "read",
376
+ examples: ["curviate unibox get acc_YOUR_ACCOUNT_ID YOUR_CHAT_ID"]
377
+ },
378
+ args: { ...readOnly(WRITE_SINGLE_FLAGS), accountId: ACCOUNT, chatId: CHAT },
379
+ run: online(runGet)
380
+ });
381
+ var conversationGetCmd = defineCommand({
382
+ meta: {
383
+ name: "get",
384
+ description: "One conversation: one person on one account across LinkedIn and email (each chat of `unibox list` carries its conversation_id), with its channels, marks and email state (whether email is available, why not, and from which Mailboxes). From what Curviate has stored: no LinkedIn call, no mailbox read.",
385
+ risk: "read",
386
+ seeAlso: ["curviate unibox conversation timeline", "curviate unibox email send", "curviate unibox list"],
387
+ examples: ["curviate unibox conversation get cnv_YOUR_CONVERSATION_ID"]
388
+ },
389
+ args: { ...readOnly(WRITE_SINGLE_FLAGS), conversationId: { type: "positional", description: "Conversation id (cnv_...)." } },
390
+ run: online(runConversation)
391
+ });
392
+ var conversationTimelineCmd = defineCommand({
393
+ meta: {
394
+ name: "timeline",
395
+ description: "A conversation's timeline, newest first: its LinkedIn messages, its emails, and Campaign events (a bounce, an unsubscribe, the end of an Enrollment) in one list. A page holds --limit LinkedIn messages and every email and event since the oldest of them; --channel email serves every email at once. From what Curviate has stored: no LinkedIn call, no mailbox read.",
396
+ risk: "read",
397
+ seeAlso: ["curviate unibox conversation get", "curviate unibox messages"],
398
+ examples: ["curviate unibox conversation timeline cnv_YOUR_CONVERSATION_ID", "curviate unibox conversation timeline cnv_YOUR_CONVERSATION_ID --channel email --json"]
399
+ },
400
+ args: {
401
+ ...readOnly(GLOBAL_FLAGS),
402
+ limit: { ...GLOBAL_FLAGS.limit, description: "LinkedIn messages per page (1 to 100); every email and event since the oldest of them comes with them." },
403
+ conversationId: { type: "positional", description: "Conversation id (cnv_...)." },
404
+ channel: { type: "string", description: "Only linkedin or email." }
405
+ },
406
+ run: online(runTimeline)
407
+ });
408
+ var conversationMarkCmd = defineCommand({
409
+ meta: {
410
+ name: "mark",
411
+ description: "Mark a conversation read or unread: its LinkedIn chat on LinkedIn, as `unibox mark` does, and its email in Curviate (the Mailbox itself is never changed). Mark it unread to hand it to a person or another AI. An email from them makes it unread again.",
412
+ risk: "write",
413
+ rules: {
414
+ changes: "The conversation's read state: the LinkedIn chat's on LinkedIn, the email's in Curviate.",
415
+ visible_to: "Everyone who reads this Account's chats; on LinkedIn, the Account's own person.",
416
+ budget_rows: [],
417
+ retry: "Safe: the same state again.",
418
+ undo: "Run it again with the other flag."
419
+ },
420
+ examples: ["curviate unibox conversation mark cnv_YOUR_CONVERSATION_ID --unread"]
421
+ },
422
+ args: {
423
+ ...WRITE_SINGLE_FLAGS,
424
+ conversationId: { type: "positional", description: "Conversation id (cnv_...)." },
425
+ read: { type: "boolean", description: "Mark it read." },
426
+ unread: { type: "boolean", description: "Mark it unread." }
427
+ },
428
+ run: online(runConversationMark)
429
+ });
430
+ var conversationCmd = defineCommand({
431
+ meta: { name: "conversation", description: "One person on one Account across LinkedIn and email: read it (get), its timeline, mark it read or unread." },
432
+ subCommands: { get: conversationGetCmd, timeline: conversationTimelineCmd, mark: conversationMarkCmd },
433
+ async run() {
434
+ const { showHelp } = await import("./examples-5FJS47QF.js");
435
+ await showHelp(conversationCmd, ["curviate", "unibox", "conversation"]);
436
+ }
437
+ });
438
+ var emailSendCmd = defineCommand({
439
+ meta: {
440
+ name: "send",
441
+ description: "Send one plain-text email to the conversation's Lead, at once: a reply in one of its threads (--thread, a thread_id from `conversation timeline`), or a new thread (--subject, and --mailbox when more than one Mailbox can send). It goes to the Lead's one address with no signature and no opt-out line, counts against the Mailbox's daily limit, and ends the Lead's open Enrollments on this Account as a reply would. --cc and --bcc (at most 20 addresses together) and --attach (files, at most 10, 20 MiB in all, refused here before anything is sent) ride along; a link usually lands better than a file. A Cc or Bcc address the receiving server refused while it took the Lead's is a recipients_refused warning on stderr: those got nothing, everyone else did. Check first with `conversation get` that email is available. One request: a retry after a timeout can send twice, so read the timeline before you send again. An unknown outcome (the provider stopped answering after it had the whole email) exits 1, never 7: do not send it again.",
442
+ risk: "write",
443
+ rules: {
444
+ changes: "An email is sent to the Lead now; their open Enrollments on this Account end as on a reply.",
445
+ visible_to: "The Lead (the recipient), and everyone who reads this conversation.",
446
+ budget_rows: [],
447
+ retry: "Never blind: a retry after a timeout can send the email twice. Read `curviate unibox conversation timeline <id> --channel email` first.",
448
+ undo: "None: an email cannot be unsent."
449
+ },
450
+ errors: {
451
+ EMAIL_UNAVAILABLE: "email is not available in this conversation; reason names why (no_email_address, email_bounced, no_email, do_not_contact, no_mailbox, group_chat). Nothing is sent.",
452
+ MAILBOX_STATE_CONFLICT: "the Mailbox needs reconnecting, is paused, or has sent its daily limit; the message names the way on.",
453
+ DO_NOT_CONTACT: "a Cc or Bcc address is a Lead on your Do-not-contact list or opted out of email; nothing was sent.",
454
+ PLATFORM_ERROR: "the provider did not take the email: nothing was sent (exit 7 when a retry may work). With an unknown outcome it may have been sent: exit 1, do not send it again.",
455
+ UNSUPPORTED_MEDIA_TYPE: "an attachment is an executable, a script or a macro-enabled Office file; nothing was sent."
456
+ },
457
+ seeAlso: ["curviate unibox conversation get", "curviate unibox conversation timeline"],
458
+ examples: [
459
+ 'curviate unibox email send cnv_YOUR_CONVERSATION_ID "Thanks, Thursday works." --thread thr_YOUR_THREAD_ID',
460
+ 'curviate unibox email send cnv_YOUR_CONVERSATION_ID "Following up on our call." --subject "Next steps" --preview'
461
+ ]
462
+ },
463
+ args: {
464
+ ...WRITE_SINGLE_FLAGS,
465
+ conversationId: { type: "positional", description: "Conversation id (cnv_...)." },
466
+ text: { type: "positional", description: "The email's text, plain text, 1 to 10,000 characters." },
467
+ thread: { type: "string", description: "Reply in this thread (thread_id)." },
468
+ subject: { type: "string", description: "Start a new thread with this subject." },
469
+ mailbox: { type: "string", description: "New thread only: the Mailbox to send from (mbx_...), one of the conversation's email.mailboxes." },
470
+ cc: { type: "string", description: "Cc addresses, repeatable or a comma list; every recipient sees them." },
471
+ bcc: { type: "string", description: "Bcc addresses, repeatable or a comma list; no other recipient sees them." },
472
+ attach: { type: "string", description: "A file to send, repeatable: at most 10, 20 MiB in all. From a Microsoft sign-in Mailbox, about 2.2 MB in all go today; more is refused with PLATFORM_ERROR and nothing is sent: send a link or a smaller file." }
473
+ },
474
+ run: online(runEmailSend)
475
+ });
476
+ var emailCmd = defineCommand({
477
+ meta: { name: "email", description: "Email from a conversation: send one plain-text email to its Lead." },
478
+ subCommands: { send: emailSendCmd },
479
+ async run() {
480
+ const { showHelp } = await import("./examples-5FJS47QF.js");
481
+ await showHelp(emailCmd, ["curviate", "unibox", "email"]);
482
+ }
483
+ });
484
+ var MESSAGE = { type: "positional", description: "The reply labelled referral (message id)." };
485
+ var referralSearchCmd = defineCommand({
486
+ meta: {
487
+ name: "search",
488
+ description: "For a reply labelled Referral: one LinkedIn people search, as the conversation's Account, for the referred person (the name Curviate suggests from the reply, or --name). At most 10 candidates, each counted against the Account's search limit. A reply labelled otherwise is NOT_A_REFERRAL and nothing is searched.",
489
+ risk: "write",
490
+ rules: {
491
+ changes: "Nothing stored but the name on the label; the search spends the Account's search limit.",
492
+ visible_to: "Your Team. LinkedIn sees one search by the Account.",
493
+ budget_rows: ["search"],
494
+ retry: "Each call is a new search and spends the limit again.",
495
+ undo: "Nothing to undo."
496
+ },
497
+ errors: { NOT_A_REFERRAL: "the message's label is not referral; nothing was searched." },
498
+ seeAlso: ["curviate unibox referral confirm", "curviate unibox label"],
499
+ examples: ["curviate unibox referral search YOUR_MESSAGE_ID", 'curviate unibox referral search YOUR_MESSAGE_ID --name "Jane Doe"']
500
+ },
501
+ args: { ...WRITE_SINGLE_FLAGS, messageId: MESSAGE, name: { type: "string", description: "The name to search for, instead of the one Curviate suggests." } },
502
+ run: online(runReferralSearch)
503
+ });
504
+ var referralConfirmCmd = defineCommand({
505
+ meta: {
506
+ name: "confirm",
507
+ description: "For a reply labelled Referral: save the person you picked as a Lead (--provider-id from `referral search`, or --linkedin-url), or get the Lead you already hold. It never enrolls them.",
508
+ risk: "write",
509
+ rules: {
510
+ changes: "A new Lead, or none when you already hold the person.",
511
+ visible_to: "Your Team.",
512
+ budget_rows: [],
513
+ retry: "Safe: a person you already hold answers with that Lead.",
514
+ undo: "`curviate lead delete <lead_id>`."
515
+ },
516
+ errors: { NOT_A_REFERRAL: "the message's label is not referral; nothing was saved.", LEAD_LIMIT_REACHED: "a new Lead would pass your Team's Lead limit." },
517
+ examples: ["curviate unibox referral confirm YOUR_MESSAGE_ID --provider-id ACoAAB1234567"]
518
+ },
519
+ args: {
520
+ ...WRITE_SINGLE_FLAGS,
521
+ messageId: MESSAGE,
522
+ "provider-id": { type: "string", description: "A candidate's provider_id, from `unibox referral search`." },
523
+ "linkedin-url": { type: "string", description: "Or the person's LinkedIn profile URL." }
524
+ },
525
+ run: online(runReferralConfirm)
526
+ });
527
+ var referralCmd = defineCommand({
528
+ meta: { name: "referral", description: "A reply labelled Referral: find the referred person on LinkedIn, then save them as a Lead." },
529
+ subCommands: { search: referralSearchCmd, confirm: referralConfirmCmd },
530
+ async run() {
531
+ const { showHelp } = await import("./examples-5FJS47QF.js");
532
+ await showHelp(referralCmd, ["curviate", "unibox", "referral"]);
533
+ }
534
+ });
535
+ var unreadCmd = defineCommand({
536
+ meta: {
537
+ name: "unread",
538
+ description: "Count unread chats (chats, not messages) across your Accounts; cheap to poll.",
539
+ risk: "read",
540
+ examples: ["curviate unibox unread", "curviate unibox unread --accounts acc_YOUR_ACCOUNT_ID"]
541
+ },
542
+ args: { ...readOnly(WRITE_SINGLE_FLAGS), accounts: ACCOUNTS },
543
+ run: online(runUnread)
544
+ });
545
+ var messagesCmd = defineCommand({
546
+ meta: {
547
+ name: "messages",
548
+ description: "Read one chat's messages, newest first. Each message carries `origin` when known: campaign, unibox, api or linkedin.",
549
+ risk: "read",
550
+ seeAlso: ["curviate core inbox messages"],
551
+ examples: ["curviate unibox messages acc_YOUR_ACCOUNT_ID YOUR_CHAT_ID", "curviate unibox messages acc_YOUR_ACCOUNT_ID YOUR_CHAT_ID --all"]
552
+ },
553
+ args: { ...readOnly(GLOBAL_FLAGS), limit: { ...GLOBAL_FLAGS.limit, description: "Messages per page (1 to 25; more than 25 is refused with exit 2). --all pages on." }, accountId: ACCOUNT, chatId: CHAT },
554
+ run: online(runMessages)
555
+ });
556
+ var replyCmd = defineCommand({
557
+ meta: {
558
+ name: "reply",
559
+ description: "Send a message into the chat from its Account. The send marks the chat read.",
560
+ risk: "write",
561
+ rules: {
562
+ changes: "Sends one LinkedIn message and marks the chat read.",
563
+ visible_to: "The other people in the chat, at once.",
564
+ budget_rows: [],
565
+ retry: "A retry after a timeout can send the message twice: read `curviate unibox messages` first.",
566
+ undo: "`curviate core message delete` removes it on LinkedIn; it may have been read already."
567
+ },
568
+ errors: { REAUTH_REQUIRED: "the Account is disconnected: reconnect it to write.", CHAT_NOT_VISIBLE: "the chat is not visible to you." },
569
+ examples: ['curviate unibox reply acc_YOUR_ACCOUNT_ID YOUR_CHAT_ID "Thanks, Tuesday works."']
570
+ },
571
+ args: { ...WRITE_SINGLE_FLAGS, accountId: ACCOUNT, chatId: CHAT, text: { type: "positional", description: "The message text (1 to 8000 characters)." } },
572
+ run: online(runReply)
573
+ });
574
+ var markCmd = defineCommand({
575
+ meta: {
576
+ name: "mark",
577
+ description: "Mark the chat read or unread on LinkedIn, for everyone who sees this Account's inbox.",
578
+ risk: "write",
579
+ rules: {
580
+ changes: "Sets the chat's read state on LinkedIn.",
581
+ visible_to: "Your Team and the Account's own LinkedIn inbox; not the other person.",
582
+ budget_rows: [],
583
+ retry: "Safe to repeat: the same state again.",
584
+ undo: "Mark it the other way."
585
+ },
586
+ errors: { REAUTH_REQUIRED: "the Account is disconnected: reconnect it to write." },
587
+ examples: ["curviate unibox mark acc_YOUR_ACCOUNT_ID YOUR_CHAT_ID --read"]
588
+ },
589
+ args: {
590
+ ...WRITE_SINGLE_FLAGS,
591
+ accountId: ACCOUNT,
592
+ chatId: CHAT,
593
+ read: { type: "boolean", description: "Mark it read." },
594
+ unread: { type: "boolean", description: "Mark it unread." }
595
+ },
596
+ run: online(runMark)
597
+ });
598
+ var tagCmd = defineCommand({
599
+ meta: {
600
+ name: "tag",
601
+ description: "Save the other person of a one-to-one chat as a Lead (or find the one you hold) and add tags, never removing any. Needs Automate.",
602
+ risk: "write",
603
+ rules: {
604
+ changes: "Creates or finds the Lead and adds the tags.",
605
+ visible_to: "Your Team.",
606
+ budget_rows: [],
607
+ retry: "Safe to repeat: the same Lead, tags already there stay.",
608
+ undo: "Remove the tags or the Lead with `curviate lead`."
609
+ },
610
+ errors: { ...AUTOMATE, ...ONE_TO_ONE },
611
+ examples: ["curviate unibox tag acc_YOUR_ACCOUNT_ID YOUR_CHAT_ID --tag warm"]
612
+ },
613
+ args: { ...WRITE_SINGLE_FLAGS, accountId: ACCOUNT, chatId: CHAT, tag: { type: "string", description: "A tag to add; repeatable or a comma list. Omit to only save the Lead." } },
614
+ run: online(runTag)
615
+ });
616
+ var enrollCmd = defineCommand({
617
+ meta: {
618
+ name: "enroll",
619
+ description: "Save the other person of a one-to-one chat as a Lead and enroll them in a Campaign through this chat's Account (one of its sending Accounts). A direct add: the rule that skips people you already chat with does not apply; every other rule does. Needs Automate.",
620
+ risk: "high",
621
+ rules: {
622
+ changes: "Creates the Enrollment; the Campaign's Steps run for this person from this Account.",
623
+ visible_to: "The person, once a Step reaches LinkedIn.",
624
+ budget_rows: [],
625
+ retry: "A second call answers that the person is already enrolled.",
626
+ undo: "`curviate enrollment stop <enrollment_id>`; what was sent stays sent.",
627
+ blast_radius: "One person, from one Account."
628
+ },
629
+ errors: { ...AUTOMATE, ...ONE_TO_ONE, ALREADY_ENROLLED_ON_ACCOUNT: "the person is already in this Campaign on this Account." },
630
+ seeAlso: ["curviate enrollment get"],
631
+ examples: ["curviate unibox enroll acc_YOUR_ACCOUNT_ID YOUR_CHAT_ID --campaign mot_YOUR_CAMPAIGN_ID"]
632
+ },
633
+ args: { ...WRITE_SINGLE_FLAGS, accountId: ACCOUNT, chatId: CHAT, campaign: { type: "string", required: true, description: "The Campaign (mot_...)." } },
634
+ run: online(runEnroll)
635
+ });
636
+ var refreshCmd = defineCommand({
637
+ meta: {
638
+ name: "refresh",
639
+ description: "Queue a re-read of the newest chats of each Account the inbox poll covers, or of --accounts; it runs within minutes. Once per Account in a short cooldown: a repeat answers cooldown with next_allowed_at. An Account without Sync full inbox is re-read for its Campaign conversations only; one with neither answers not_synced. The poll keeps the Account's active hours: on a Team whose active days are Monday to Friday nothing is polled at the weekend, and a refresh then answers paused until the next active day. Needs Automate.",
640
+ risk: "write",
641
+ rules: {
642
+ changes: "Queues one read of each Account's newest chats.",
643
+ visible_to: "Nobody: reads only.",
644
+ budget_rows: ["inbox_sync"],
645
+ retry: "A repeat inside the cooldown answers cooldown; nothing new is queued.",
646
+ undo: "Nothing to undo: a refresh only reads."
647
+ },
648
+ errors: AUTOMATE,
649
+ examples: ["curviate unibox refresh", "curviate unibox refresh --accounts acc_YOUR_ACCOUNT_ID"]
650
+ },
651
+ args: { ...WRITE_SINGLE_FLAGS, accounts: ACCOUNTS },
652
+ run: online(runRefresh)
653
+ });
654
+ var labelCmd = defineCommand({
655
+ meta: {
656
+ name: "label",
657
+ description: "Read a reply's Reply label and its history (who set it, Curviate's confidence as a whole percent, or a rule), or with --set correct it. A correction acts as when Curviate sets the label: opt_out puts the person on your Do-not-contact list (not_interested too when your Team turned that on), out_of_office makes the Lead wait 7 days, and your Team's Tag for the label is added. No LinkedIn call. --set needs Automate.",
658
+ risk: "write",
659
+ rules: {
660
+ changes: "With --set: the message's Reply label, stored as a correction; the earlier label stays in the history.",
661
+ visible_to: "Your Team.",
662
+ budget_rows: [],
663
+ retry: "Safe to repeat: the same label again.",
664
+ undo: "Set the label back with --set; a Do-not-contact entry it added stays: `curviate do-not-contact remove`."
665
+ },
666
+ errors: { ...AUTOMATE, REPLY_NOT_LABELLABLE: "this message takes no Reply label: a direct conversation (no Campaign), your own message, or a warm-up message." },
667
+ seeAlso: ["curviate unibox messages", "curviate team reply-labels"],
668
+ examples: ["curviate unibox label YOUR_MESSAGE_ID", "curviate unibox label YOUR_MESSAGE_ID --set not_now"]
669
+ },
670
+ args: {
671
+ ...WRITE_SINGLE_FLAGS,
672
+ messageId: { type: "positional", description: "The message id, as `curviate unibox messages` prints it." },
673
+ set: {
674
+ type: "string",
675
+ description: "Set or correct the label, each with its effect: interested (informs), not_now (informs), not_interested (puts the person on the Do-not-contact list when your Team turned that on), opt_out (puts the person on the Do-not-contact list), out_of_office (the Lead waits 7 days), referral (informs; the referred name rides on it, `unibox referral search` finds them), other (informs)."
676
+ }
677
+ },
678
+ run: online(runLabel)
679
+ });
680
+ var accountsCmd = defineCommand({
681
+ meta: {
682
+ name: "accounts",
683
+ description: "For every Account you may operate: whether Sync full inbox is on, and how far the chat-list sync is. Read `sync` before trusting an empty Unibox.",
684
+ risk: "read",
685
+ examples: ["curviate unibox accounts"]
686
+ },
687
+ args: readOnly(WRITE_SINGLE_FLAGS),
688
+ run: online(runAccounts)
689
+ });
690
+ var consentCmd = defineCommand({
691
+ meta: {
692
+ name: "consent",
693
+ description: "Turn Sync full inbox on or off for one Account. Only the person who connected the Account can. On starts a paced listing that takes hours (needs Automate); off hides the Account's non-Campaign chats at once and deletes them shortly after.",
694
+ risk: "high",
695
+ rules: {
696
+ changes: "Copies the Account's whole inbox into the Unibox (on), or removes the non-Campaign chats from it (off).",
697
+ visible_to: "Your Team: every teammate who may operate the Account reads its whole inbox while on.",
698
+ budget_rows: ["inbox_sync"],
699
+ retry: "Safe to repeat: the same setting again.",
700
+ undo: "Run it with the other flag; chats removed by off are listed again by a new sync.",
701
+ blast_radius: "One Account's whole inbox."
702
+ },
703
+ errors: { ...AUTOMATE, ACCOUNT_OWNER_ONLY: "only the person who connected the Account can change this." },
704
+ seeAlso: ["curviate unibox refresh", "curviate unibox list"],
705
+ examples: ["curviate unibox consent acc_YOUR_ACCOUNT_ID --on"]
706
+ },
707
+ args: {
708
+ ...WRITE_SINGLE_FLAGS,
709
+ accountId: { type: "positional", description: "Your Account (acc_...)." },
710
+ on: { type: "boolean", description: "Turn Sync full inbox on." },
711
+ off: { type: "boolean", description: "Turn Sync full inbox off." }
712
+ },
713
+ run: online(runConsent)
714
+ });
715
+ var uniboxCommand = defineCommand({
716
+ meta: { name: "unibox", description: DESCRIPTIONS.unibox },
717
+ subCommands: {
718
+ list: listCmd,
719
+ get: getCmd,
720
+ unread: unreadCmd,
721
+ messages: messagesCmd,
722
+ conversation: conversationCmd,
723
+ email: emailCmd,
724
+ referral: referralCmd,
725
+ reply: replyCmd,
726
+ mark: markCmd,
727
+ tag: tagCmd,
728
+ enroll: enrollCmd,
729
+ label: labelCmd,
730
+ refresh: refreshCmd,
731
+ accounts: accountsCmd,
732
+ consent: consentCmd
733
+ },
734
+ async run() {
735
+ const { showHelp } = await import("./examples-5FJS47QF.js");
736
+ await showHelp(uniboxCommand, ["curviate", "unibox"]);
737
+ }
738
+ });
739
+ export {
740
+ uniboxCommand
741
+ };