@curviate/cli 0.48.0 → 0.50.0-next.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 +72 -0
  2. package/README.md +47 -6
  3. package/dist/{account-WKQHMM7P.js → account-KGCGUYKF.js} +668 -116
  4. package/dist/analytics-HRAD4ABO.js +27 -0
  5. package/dist/beta-consent-364JI6IL.js +81 -0
  6. package/dist/billing-3SSVRS2Y.js +124 -0
  7. package/dist/{chunk-Q63IIPL2.js → chunk-25MO7BYN.js} +4 -4
  8. package/dist/{chunk-76SWLAZ6.js → chunk-2W4RN5ON.js} +59 -1
  9. package/dist/chunk-5S3MJVI5.js +22 -0
  10. package/dist/chunk-67S4JHZZ.js +339 -0
  11. package/dist/chunk-73DJ3KNE.js +54 -0
  12. package/dist/chunk-CQGDMARG.js +525 -0
  13. package/dist/{chunk-Y7K4UBFC.js → chunk-DOHBOYXN.js} +1 -1
  14. package/dist/{chunk-TSOIZBBU.js → chunk-DSGKYZDK.js} +1 -1
  15. package/dist/{chunk-YLSJ4HKU.js → chunk-ENBIMEKS.js} +26 -1
  16. package/dist/{chunk-LCGXJGPB.js → chunk-GHMRPX5H.js} +7 -1
  17. package/dist/chunk-GOICALYQ.js +28 -0
  18. package/dist/chunk-L4CIJT6F.js +144 -0
  19. package/dist/{chunk-PQWDDSV7.js → chunk-L7JH3W56.js} +1 -1
  20. package/dist/{chunk-YFXLXION.js → chunk-OE6YFYUM.js} +85 -10
  21. package/dist/chunk-PPGKQJKU.js +38 -0
  22. package/dist/{chunk-MKGVNDMJ.js → chunk-QM57YDJE.js} +13 -201
  23. package/dist/{chunk-CVMSQ3OF.js → chunk-RYWWSZUH.js} +17 -3
  24. package/dist/chunk-T6GBS5SS.js +58 -0
  25. package/dist/{chunk-AYKKXGTR.js → chunk-TE3WBPW6.js} +392 -14
  26. package/dist/chunk-UL53T4O6.js +52 -0
  27. package/dist/chunk-UWQPX4AE.js +20 -0
  28. package/dist/{chunk-OHXYFICP.js → chunk-YXVF5UST.js} +77 -4
  29. package/dist/cli.js +35 -17
  30. package/dist/{comment-7IQ6ZOJF.js → comment-5JKGNYOY.js} +90 -11
  31. package/dist/{company-RD7RDGSA.js → company-TXST2VXW.js} +65 -15
  32. package/dist/{config-EYBNYRGK.js → config-TVIQUVNK.js} +53 -4
  33. package/dist/{connect-HVXT67A6.js → connect-RBL6U4KV.js} +63 -18
  34. package/dist/contact-YAHC5QFX.js +32 -0
  35. package/dist/contact-groups-DKOIBC57.js +399 -0
  36. package/dist/contact-import-ITSJQV7K.js +336 -0
  37. package/dist/core-PWMJPPRG.js +46 -0
  38. package/dist/do-not-contact-WDYIBWYA.js +200 -0
  39. package/dist/{doctor-HUXQERLQ.js → doctor-F7JLPTED.js} +65 -11
  40. package/dist/{document-AUUCGST2.js → document-BHYAUJ6F.js} +1 -1
  41. package/dist/{draft-DFO22K6Q.js → draft-TDJJUXLH.js} +60 -14
  42. package/dist/enrollment-Q6UOKHPY.js +484 -0
  43. package/dist/{examples-64YT5V5K.js → examples-DQSVIIXZ.js} +2 -2
  44. package/dist/{exit-codes-AW6KHDDN.js → exit-codes-7DBETBDT.js} +1 -1
  45. package/dist/export-HIJSCJS6.js +96 -0
  46. package/dist/{feed-JWP6ANPI.js → feed-W56ZTA4Z.js} +13 -10
  47. package/dist/{group-SIQFJEZV.js → group-AUALYK5H.js} +18 -10
  48. package/dist/{inbox-MMIMCA5O.js → inbox-HLZR2ZPV.js} +31 -12
  49. package/dist/{inboxes-RND3D4C7.js → inboxes-IZTRD6FE.js} +14 -10
  50. package/dist/incoming-ULB2RNV4.js +218 -0
  51. package/dist/{job-ACFKBLFK.js → job-55IKS6LP.js} +65 -13
  52. package/dist/{login-ZOB5KVKQ.js → login-DPZ6CXNO.js} +13 -4
  53. package/dist/{message-OFK6UVXR.js → message-J44YKRDS.js} +9 -7
  54. package/dist/motion-SQI5F2EK.js +868 -0
  55. package/dist/network-K4QD7APQ.js +235 -0
  56. package/dist/{notification-KKGAZU7M.js → notification-SEDXZHXO.js} +38 -11
  57. package/dist/notifications-HGIBRUNQ.js +231 -0
  58. package/dist/{post-A5SBCFB2.js → post-L467SKIG.js} +92 -12
  59. package/dist/{profile-4SOOQZ4K.js → profile-A2N6RMR2.js} +79 -23
  60. package/dist/{recruiter-YN73STDP.js → recruiter-AR75RHBO.js} +132 -21
  61. package/dist/{sales-nav-JXF5RY2K.js → sales-nav-C2AYFXPV.js} +73 -18
  62. package/dist/{search-JAL242A2.js → search-Z4DZIG4X.js} +55 -23
  63. package/dist/{setup-WICWH4JG.js → setup-45BEVX6B.js} +69 -17
  64. package/dist/team-6QWY4IFP.js +450 -0
  65. package/dist/tier-2HS3BXDF.js +61 -0
  66. package/dist/unibox-DHUKG65Z.js +402 -0
  67. package/dist/{webhook-UGKVYWBC.js → webhook-Q53WUAI2.js} +273 -45
  68. package/package.json +2 -2
  69. package/dist/chunk-GQKC6E5K.js +0 -36
  70. package/dist/core-6XYGUNAY.js +0 -46
@@ -0,0 +1,484 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ fail,
4
+ listFlag,
5
+ outputOpts,
6
+ rootClient,
7
+ usage
8
+ } from "./chunk-T6GBS5SS.js";
9
+ import {
10
+ buildPreviewOutput
11
+ } from "./chunk-TCUYH5GO.js";
12
+ import {
13
+ intFlag
14
+ } from "./chunk-NNV2OYEF.js";
15
+ import {
16
+ pageDelayFromFlags,
17
+ readCursorFlag,
18
+ readMaxPagesFlag,
19
+ readableObject,
20
+ readablePage,
21
+ rejectPaginationModifiersWithoutAll,
22
+ streamAll
23
+ } from "./chunk-L4CIJT6F.js";
24
+ import {
25
+ renderSuccess,
26
+ writeNdjsonItem
27
+ } from "./chunk-QM57YDJE.js";
28
+ import "./chunk-YXVF5UST.js";
29
+ import {
30
+ GLOBAL_FLAGS,
31
+ READ_SINGLE_FLAGS,
32
+ WRITE_SINGLE_FLAGS,
33
+ readOnly
34
+ } from "./chunk-RYWWSZUH.js";
35
+ import {
36
+ DESCRIPTIONS
37
+ } from "./chunk-73DJ3KNE.js";
38
+ import "./chunk-ZYURL5VK.js";
39
+
40
+ // src/commands/enrollment.ts
41
+ import { defineCommand } from "citty";
42
+ import { setTimeout as sleep } from "timers/promises";
43
+ var POLL_MS = 2e3;
44
+ var RETRY_WAIT_MS = 10 * 60 * 1e3;
45
+ function preview(method, args, body = {}) {
46
+ process.stdout.write(JSON.stringify(buildPreviewOutput({ method, args, body })) + "\n");
47
+ }
48
+ function filters(f) {
49
+ const q = {};
50
+ const one = (flag, key) => {
51
+ const v = f[flag];
52
+ if (v === void 0) return;
53
+ if (typeof v !== "string" || v.trim() === "") usage(`--${String(flag)} was given an empty value.`);
54
+ q[key] = v;
55
+ };
56
+ one("motion", "motion_id");
57
+ one("contact", "contact_id");
58
+ one("done-step", "done_step");
59
+ one("outcome", "outcome");
60
+ one("variant", "variant_id");
61
+ if (f.step !== void 0) q["step_id"] = listFlag("step", f.step);
62
+ if (f.status !== void 0) q["status"] = listFlag("status", f.status);
63
+ if (f.reason !== void 0) q["reason"] = listFlag("reason", f.reason);
64
+ if (f.relationship !== void 0) q["relationship_at_enrollment"] = listFlag("relationship", f.relationship);
65
+ if (f.version !== void 0) q["version"] = intFlag("version", f.version);
66
+ return q;
67
+ }
68
+ var paired = (code, message) => code != null && message != null ? `${code}: ${message}` : code;
69
+ function humanReasons(data) {
70
+ if (Array.isArray(data)) return data.map(humanReasons);
71
+ if (!data || typeof data !== "object") return data;
72
+ const o = { ...data };
73
+ for (const k of ["skip", "finish"]) {
74
+ if (`${k}_message` in o) {
75
+ o[`${k}_reason`] = paired(o[`${k}_reason`], o[`${k}_message`]);
76
+ delete o[`${k}_message`];
77
+ }
78
+ }
79
+ if ("reason_message" in o) {
80
+ o["reason"] = paired(o["reason"], o["reason_message"]);
81
+ delete o["reason_message"];
82
+ }
83
+ for (const k of ["items", "history"]) if (Array.isArray(o[k])) o[k] = o[k].map(humanReasons);
84
+ return o;
85
+ }
86
+ function show(result, f) {
87
+ const opts = outputOpts(f);
88
+ renderSuccess(opts.json ? result : humanReasons(result), opts, process);
89
+ }
90
+ async function runList(c, f) {
91
+ rejectPaginationModifiersWithoutAll(f, process);
92
+ const params = filters(f);
93
+ const accounts = f.accounts ?? f.account;
94
+ if (accounts !== void 0) params["account_id"] = listFlag("accounts", accounts);
95
+ if (f.limit !== void 0) params["limit"] = intFlag("limit", f.limit, 1, 100);
96
+ const cursor = readCursorFlag(f, process);
97
+ if (cursor) params["cursor"] = cursor;
98
+ try {
99
+ if (f.all) {
100
+ const page = (p) => c.enrollments.list(p);
101
+ for await (const item of streamAll(page, params, { maxPages: readMaxPagesFlag(f, process), out: process, pageDelayMs: pageDelayFromFlags(f) })) writeNdjsonItem(process, item, f.fields);
102
+ } else {
103
+ show(readablePage(await c.enrollments.list(params)), f);
104
+ }
105
+ } catch (err) {
106
+ await fail(err, f);
107
+ }
108
+ }
109
+ async function runGet(c, f) {
110
+ try {
111
+ const e = readableObject(await c.enrollments.get(String(f.id ?? "")));
112
+ show(e, f);
113
+ if (e.history_truncated && !outputOpts(f).json) {
114
+ process.stderr.write("history_truncated: Steps older than about 12 months are no longer stored in detail; the history lists the later ones only.\n");
115
+ }
116
+ } catch (err) {
117
+ await fail(err, f);
118
+ }
119
+ }
120
+ var single = (method, body = () => void 0) => async (c, f) => {
121
+ const b = body(f);
122
+ if (f.preview) return preview(`enrollments.${method}`, { id: f.id }, b ?? {});
123
+ try {
124
+ const call = c.enrollments[method];
125
+ show(await call.call(c.enrollments, String(f.id ?? ""), b), f);
126
+ } catch (err) {
127
+ await fail(err, f);
128
+ }
129
+ };
130
+ var required = (flag, v, what) => {
131
+ if (v === void 0 || v.trim() === "") usage(`--${flag} is required: ${what}.`);
132
+ return v;
133
+ };
134
+ async function runRetry(c, f) {
135
+ const id = String(f.id ?? "");
136
+ const waitMs = f["wait-timeout"] === void 0 ? RETRY_WAIT_MS : intFlag("wait-timeout", f["wait-timeout"], 0, 24 * 60 * 60 * 1e3);
137
+ if (f.preview) return preview("enrollments.retry", { id });
138
+ const read = async () => {
139
+ const e = await c.enrollments.get(id);
140
+ return Array.isArray(e?.history) ? e.history : [];
141
+ };
142
+ let before;
143
+ try {
144
+ before = await read();
145
+ } catch (err) {
146
+ return fail(err, f);
147
+ }
148
+ const failed = [...before].reverse().find((h) => h.outcome === "failed");
149
+ let item;
150
+ try {
151
+ item = await c.enrollments.retry(id);
152
+ } catch (err) {
153
+ const { CurviateError } = await import("@curviate/sdk");
154
+ if (err instanceof CurviateError) return fail(err, f);
155
+ process.stderr.write(`error: the API answered the retry without a readable result. It may have been applied: check with \`curviate enrollment get ${id}\` before sending it again.
156
+ `);
157
+ process.exit(7);
158
+ }
159
+ if (!failed?.step_id) {
160
+ process.stderr.write(`The retry was accepted, but no failed Step was in the history read just before it: read the outcome with \`curviate enrollment get ${id}\`.
161
+ `);
162
+ return renderSuccess(item, outputOpts(f), process);
163
+ }
164
+ const deadline = Date.now() + waitMs;
165
+ for (; ; ) {
166
+ const now = await read().catch(() => null);
167
+ const record = now?.slice(before.length).find((h) => h.step_id === failed.step_id);
168
+ if (record) return renderSuccess({ step_id: failed.step_id, outcome: record.outcome ?? null, reason: record.reason ?? null, message: record.reason_message ?? null }, outputOpts(f), process);
169
+ const left = deadline - Date.now();
170
+ if (left <= 0) break;
171
+ await sleep(Math.min(POLL_MS, left));
172
+ }
173
+ process.stderr.write(
174
+ `error: Step ${failed.step_id} was resumed but has not run within ${waitMs} ms; it may wait for pacing or a budget. Read it later with \`curviate enrollment get ${id}\`. Do not retry it: it is already resumed.
175
+ `
176
+ );
177
+ process.exit(7);
178
+ }
179
+ var ACTIONS = ["pause", "resume", "stop", "retry", "event", "reassign"];
180
+ async function runBulk(c, f) {
181
+ const action = required("action", f.action, ACTIONS.join(", "));
182
+ if (!ACTIONS.includes(action)) usage(`--action takes one of ${ACTIONS.join(", ")}.`);
183
+ const ids = listFlag("id", f.id);
184
+ const filter = filters(f);
185
+ if (ids.length > 0 === (f.motion !== void 0)) usage("name the Enrollments either with --id (repeatable, or a comma list) or with --motion and its filters, not both.");
186
+ if (ids.length && Object.keys(filter).length) usage("the list filters apply with --motion, not with --id.");
187
+ const body = { action, ...ids.length ? { ids } : { filter } };
188
+ if (f.at !== void 0) body["at"] = f.at;
189
+ if (f.name !== void 0) body["name"] = f.name;
190
+ if (f.account !== void 0) body["account_id"] = f.account;
191
+ if (f.preview) return preview("enrollments.bulk", {}, body);
192
+ let result;
193
+ try {
194
+ result = await c.enrollments.bulk(body);
195
+ } catch (err) {
196
+ return fail(err, f);
197
+ }
198
+ const results = Array.isArray(result?.results) ? result.results : [];
199
+ if (outputOpts(f).json) renderSuccess(result, outputOpts(f), process);
200
+ else {
201
+ for (const r of results) {
202
+ const warn = (r.warnings ?? []).map((w) => ` (warning: ${w.message ?? ""})`).join("");
203
+ process.stdout.write(`${r.enrollment_id} ${r.outcome === "ok" ? "ok" : `error ${r.error?.code}: ${r.error?.message ?? ""}`}${warn}
204
+ `);
205
+ }
206
+ }
207
+ const firstError = results.find((r) => r.outcome !== "ok");
208
+ if (firstError) {
209
+ const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
210
+ process.stderr.write(`error: ${results.filter((r) => r.outcome !== "ok").length} of ${results.length} Enrollments were refused; each refusal is listed.
211
+ `);
212
+ process.exit(getExitCode(firstError.error?.code ?? "INTERNAL"));
213
+ }
214
+ }
215
+ var online = (fn) => async ({ args }) => {
216
+ const f = args;
217
+ await fn(await rootClient(f), f);
218
+ };
219
+ var ID = { type: "positional", description: "Enrollment id (enr_...)." };
220
+ var ROLE = { INSUFFICIENT_ROLE: "your role cannot operate the Enrollment's Account.", ACCOUNT_NOT_SHARED: "the Enrollment's Account is not shared with you." };
221
+ var NOT_ACTIVE = { ENROLLMENT_NOT_ACTIVE: "the Enrollment's status does not take this operation." };
222
+ var IN_FLIGHT = { STEP_IN_FLIGHT: "a Step of the Enrollment is being sent right now; read it again in a minute, then retry." };
223
+ var SEE = ["curviate enrollment get", "curviate enrollment list"];
224
+ var FILTER_ARGS = {
225
+ motion: { type: "string", description: "Only this Motion's Enrollments (mot_...)." },
226
+ contact: { type: "string", description: "Only this Contact's Enrollments (con_...)." },
227
+ status: { type: "string", description: "Comma list of pending, active, paused, finished, skipped." },
228
+ step: { type: "string", description: "Only Enrollments now at one of these Step ids: repeatable or a comma list." },
229
+ version: { type: "string", description: "Only Enrollments running this Sequence version (1 or more)." },
230
+ "done-step": { type: "string", description: "Only Enrollments that ran this Step id. With --outcome: how it ended." },
231
+ outcome: { type: "string", description: "With --done-step: executed, skipped, failed, accepted, not_accepted, replied, no_reply or seen." },
232
+ reason: { type: "string", description: "Comma list of reason codes (skip, finish or Step reasons; narrowed to --done-step when given)." },
233
+ variant: { type: "string", description: "Only Enrollments given this variant id." },
234
+ relationship: { type: "string", description: "Comma list of connected, not_connected, invite_pending, unknown: the Contact's relationship to the Account when it started." }
235
+ };
236
+ var listCmd = defineCommand({
237
+ meta: {
238
+ name: "list",
239
+ description: "List Enrollments, newest first, filtered by Motion, Contact, status, current Step, or how a Step ended. Each counts once per Contact, Motion and Account.",
240
+ risk: "read",
241
+ output: ["Each reason code comes with its sentence beside it (`skip_reason` and `skip_message`, `finish_reason` and `finish_message`)."],
242
+ examples: [
243
+ "curviate enrollment list --motion mot_YOUR_MOTION_ID",
244
+ "curviate enrollment list --motion mot_YOUR_MOTION_ID --done-step opener --outcome failed",
245
+ "curviate enrollment list --motion mot_YOUR_MOTION_ID --reason already_connected,known_chat --relationship connected"
246
+ ]
247
+ },
248
+ args: {
249
+ ...readOnly(GLOBAL_FLAGS),
250
+ ...FILTER_ARGS,
251
+ accounts: { type: "string", description: "Only Enrollments on one of these Accounts: a comma list of ids (acc_...). --account a,b is accepted as the same filter." }
252
+ },
253
+ run: online(runList)
254
+ });
255
+ var getCmd = defineCommand({
256
+ meta: {
257
+ name: "get",
258
+ description: "One Enrollment with the history of its Steps: outcome, reason and its sentence, the Account that ran it. Metadata only, never the text sent.",
259
+ risk: "read",
260
+ examples: ["curviate enrollment get enr_YOUR_ENROLLMENT_ID"]
261
+ },
262
+ args: { ...readOnly(READ_SINGLE_FLAGS), id: ID },
263
+ run: online(runGet)
264
+ });
265
+ var pauseCmd = defineCommand({
266
+ meta: {
267
+ name: "pause",
268
+ description: "Hold one Enrollment until you resume it; its waits freeze with the time they had left. Replies are still recorded.",
269
+ risk: "write",
270
+ rules: {
271
+ changes: "No Step of this Enrollment runs until it is resumed.",
272
+ visible_to: "Your Team.",
273
+ budget_rows: [],
274
+ retry: "A second pause answers ENROLLMENT_NOT_ACTIVE; nothing changes.",
275
+ undo: "`curviate enrollment resume <enrollment_id>`."
276
+ },
277
+ errors: { ...NOT_ACTIVE, ...IN_FLIGHT, MOTION_STATUS_CONFLICT: "the Motion is archived or past its end.", ...ROLE },
278
+ examples: ["curviate enrollment pause enr_YOUR_ENROLLMENT_ID"]
279
+ },
280
+ args: { ...WRITE_SINGLE_FLAGS, id: ID },
281
+ run: online(single("pause"))
282
+ });
283
+ var resumeCmd = defineCommand({
284
+ meta: {
285
+ name: "resume",
286
+ description: "Without --at: lift your own pause; the Enrollment continues where it was. With --at: jump to that Step of its Sequence version. The jump is not guarded: it re-enters the Step even when that Step already sent, so a message can go out again. To retry a failed Step use `curviate enrollment retry <enrollment_id>`, which acts only on a failure. Needs Automate.",
287
+ risk: "high",
288
+ rules: {
289
+ changes: "The Enrollment runs again from its Account; with --at, from the named Step.",
290
+ visible_to: "The Contact, once its next Step reaches LinkedIn.",
291
+ budget_rows: [],
292
+ retry: "With --at, every call jumps again and may send again: read `curviate enrollment get <enrollment_id>` first.",
293
+ undo: "`curviate enrollment pause <enrollment_id>`; what was sent stays sent.",
294
+ blast_radius: "One Enrollment: one Contact, from one Account."
295
+ },
296
+ errors: { ...NOT_ACTIVE, ...IN_FLIGHT, MOTION_STATUS_CONFLICT: "the Motion is archived or past its end.", ...ROLE },
297
+ seeAlso: ["curviate enrollment retry", "curviate enrollment get"],
298
+ examples: ["curviate enrollment resume enr_YOUR_ENROLLMENT_ID", "curviate enrollment resume enr_YOUR_ENROLLMENT_ID --at bump"]
299
+ },
300
+ args: {
301
+ ...WRITE_SINGLE_FLAGS,
302
+ id: ID,
303
+ at: { type: "string", description: "Jump to this Step id (the out-of-office path). Not guarded: a Step that already sent sends again." }
304
+ },
305
+ run: online(single("resume", (f) => f.at === void 0 ? void 0 : { at: required("at", f.at, "a Step id") }))
306
+ });
307
+ var retryCmd = defineCommand({
308
+ meta: {
309
+ name: "retry",
310
+ description: "Retry the failed Step of one Enrollment. Acts only while that Step's latest outcome is failed, so a repeated retry never re-sends a delivered message. Then waits for the Step's next record and prints it as {outcome, reason, message}; the Step may wait for pacing or a budget.",
311
+ risk: "high",
312
+ rules: {
313
+ changes: "Resumes the Enrollment at its failed Step, which runs again when its Account may send.",
314
+ visible_to: "The Contact, if the Step reaches LinkedIn.",
315
+ budget_rows: [],
316
+ retry: "Safe: with nothing failed it answers NOTHING_TO_RETRY and sends nothing.",
317
+ undo: "`curviate enrollment pause <enrollment_id>` before the Step runs; what was sent stays sent.",
318
+ blast_radius: "One Step of one Enrollment."
319
+ },
320
+ errors: {
321
+ NOTHING_TO_RETRY: "nothing to retry: the Enrollment's latest Step outcome is not failed.",
322
+ ...IN_FLIGHT,
323
+ ...NOT_ACTIVE,
324
+ MOTION_STATUS_CONFLICT: "the Motion is archived or past its end.",
325
+ ...ROLE
326
+ },
327
+ output: ["The re-run's record, {step_id, outcome, reason, message}. Exit 7 when the wait runs out first: the Step is resumed; read it later."],
328
+ seeAlso: ["curviate enrollment get", "curviate enrollment bulk"],
329
+ examples: ["curviate enrollment retry enr_YOUR_ENROLLMENT_ID", "curviate enrollment retry enr_YOUR_ENROLLMENT_ID --wait-timeout 60000"]
330
+ },
331
+ args: {
332
+ ...WRITE_SINGLE_FLAGS,
333
+ id: ID,
334
+ "wait-timeout": { type: "string", description: "How long to wait for the re-run, in milliseconds (default 600000). --timeout stays the request timeout." }
335
+ },
336
+ run: online(runRetry)
337
+ });
338
+ var stopCmd = defineCommand({
339
+ meta: {
340
+ name: "stop",
341
+ description: "Stop a pending, active or paused Enrollment: it finishes (stopped) and runs no further Step.",
342
+ risk: "write",
343
+ rules: {
344
+ changes: "The Enrollment finishes with reason stopped.",
345
+ visible_to: "Your Team.",
346
+ budget_rows: [],
347
+ retry: "A second stop answers ENROLLMENT_NOT_ACTIVE.",
348
+ undo: "`curviate enrollment resume <enrollment_id> --at <step_id>` restarts it at a Step."
349
+ },
350
+ errors: { ...NOT_ACTIVE, ...ROLE },
351
+ examples: ["curviate enrollment stop enr_YOUR_ENROLLMENT_ID"]
352
+ },
353
+ args: { ...WRITE_SINGLE_FLAGS, id: ID },
354
+ run: online(single("stop"))
355
+ });
356
+ var EVENT_ARGS = {
357
+ ...WRITE_SINGLE_FLAGS,
358
+ id: ID,
359
+ name: { type: "positional", description: "The event name a Step of its Sequence waits for (`until event.<name>`)." }
360
+ };
361
+ var eventMeta = (name, description, example) => ({
362
+ name,
363
+ description,
364
+ risk: "write",
365
+ rules: {
366
+ changes: "Records the event; a Step waiting for it continues. Fires no webhook.",
367
+ visible_to: "Your Team; the Contact once the next Step runs.",
368
+ budget_rows: [],
369
+ retry: "A second event is recorded again; a Step already past the wait ignores it.",
370
+ undo: "Cannot be undone; pause or stop the Enrollment to keep its next Step from running."
371
+ },
372
+ errors: { ...NOT_ACTIVE, INVALID_REQUEST: "no Step of its version waits for this name; the message lists the awaited names.", ...ROLE },
373
+ examples: [example]
374
+ });
375
+ var eventCmd = defineCommand({
376
+ meta: eventMeta(
377
+ "event",
378
+ "Send a custom event to an active or paused Enrollment whose Sequence waits for it, for example once your agent wrote the researched text to the Contact's custom fields. Input only: fires no webhook. Needs Automate.",
379
+ "curviate enrollment event enr_YOUR_ENROLLMENT_ID research_ready"
380
+ ),
381
+ args: EVENT_ARGS,
382
+ run: online(single("events", (f) => ({ name: f.name ?? "" })))
383
+ });
384
+ var signalCmd = defineCommand({
385
+ meta: eventMeta(
386
+ "signal",
387
+ "Deprecated alias of `curviate enrollment event`, accepted until 2027-01-19. Sends the same event. Needs Automate.",
388
+ "curviate enrollment signal enr_YOUR_ENROLLMENT_ID research_ready"
389
+ ),
390
+ args: EVENT_ARGS,
391
+ async run(ctx) {
392
+ process.stderr.write("warning: `curviate enrollment signal` is deprecated; use `curviate enrollment event`. It stops working on 2027-01-19.\n");
393
+ await online(single("events", (f) => ({ name: f.name ?? "" })))(ctx);
394
+ }
395
+ });
396
+ var reassignCmd = defineCommand({
397
+ meta: {
398
+ name: "reassign",
399
+ description: "Move an Enrollment to another sending Account of its Motion; it restarts there at the first Step of its version (one you paused stays paused). Refused, nothing changed, when its Account already engaged the person, the target already holds them, or the target has a chat with them. Needs Automate.",
400
+ risk: "high",
401
+ rules: {
402
+ changes: "The Enrollment restarts on the target Account; Steps already skipped are named in warnings.",
403
+ visible_to: "The Contact, once the target Account's first Step reaches LinkedIn.",
404
+ budget_rows: [],
405
+ retry: "A second call to the same Account answers ALREADY_ENROLLED_ON_ACCOUNT.",
406
+ undo: "Reassign it back while the target has not engaged the person yet.",
407
+ blast_radius: "One Enrollment: one Contact, from one Account."
408
+ },
409
+ errors: {
410
+ ACCOUNT_NOT_FOUND: "the target is not a sending Account of the Motion.",
411
+ ...NOT_ACTIVE,
412
+ ...IN_FLIGHT,
413
+ ACCOUNT_ALREADY_ENGAGED: "its current Account already did something the person can see.",
414
+ ALREADY_ENROLLED_ON_ACCOUNT: "the target already holds this Contact in the Motion, or is the current Account.",
415
+ KNOWN_CHAT: "the target already has a chat with the person.",
416
+ ...ROLE
417
+ },
418
+ seeAlso: ["curviate enrollment get", "curviate motion get"],
419
+ examples: ["curviate enrollment reassign enr_YOUR_ENROLLMENT_ID --account acc_YOUR_ACCOUNT_ID"]
420
+ },
421
+ args: {
422
+ ...WRITE_SINGLE_FLAGS,
423
+ id: ID,
424
+ account: { type: "string", required: true, description: "The target sending Account of the Motion (acc_...). Never defaulted." }
425
+ },
426
+ run: online(single("reassign", (f) => ({ account_id: required("account", f.account, "the target Account (acc_...)") })))
427
+ });
428
+ var bulkCmd = defineCommand({
429
+ meta: {
430
+ name: "bulk",
431
+ description: "Pause, resume, stop, retry, send an event to or reassign many Enrollments in one call, named with --id or matched by --motion and the list filters. Each is decided alone, as its own command would be; not atomic. Up to 1000 items: ids, or Enrollments the filters match. List with the same filters first to see the matches.",
432
+ risk: "high",
433
+ rules: {
434
+ changes: "Each Enrollment gets the action as its single command would.",
435
+ visible_to: "The Contacts whose next Step reaches LinkedIn.",
436
+ budget_rows: [],
437
+ retry: "A retried call is a new call: each Enrollment answers again on its own (a second stop is ENROLLMENT_NOT_ACTIVE for it).",
438
+ undo: "Per Enrollment, as its single command says; what was sent stays sent.",
439
+ blast_radius: "Up to 1000 items (Enrollments), every Contact and Account they cover."
440
+ },
441
+ errors: { ...NOT_ACTIVE, NOTHING_TO_RETRY: "retry, per Enrollment: nothing failed.", ...IN_FLIGHT, ...ROLE },
442
+ output: ["One line per Enrollment, `<enrollment_id> ok` or `<enrollment_id> error <code>: <message>`; with --json (or piped) the API's answer. Exit 0 when every one is ok, else the first refusal's exit."],
443
+ seeAlso: SEE,
444
+ examples: [
445
+ "curviate enrollment bulk --action stop --id enr_A,enr_B",
446
+ "curviate enrollment bulk --action retry --motion mot_YOUR_MOTION_ID --done-step opener --outcome failed"
447
+ ]
448
+ },
449
+ args: {
450
+ ...WRITE_SINGLE_FLAGS,
451
+ action: { type: "string", required: true, description: `One of ${ACTIONS.join(", ")}.` },
452
+ id: { type: "string", description: "An Enrollment id (enr_...); repeatable, or a comma list. Not with --motion." },
453
+ ...FILTER_ARGS,
454
+ motion: { type: "string", description: "Act on this Motion's Enrollments (mot_...) that the other filters match. Not with --id." },
455
+ at: { type: "string", description: "With --action resume: jump to this Step id (not guarded, see `curviate enrollment resume`)." },
456
+ name: { type: "string", description: "With --action event: the event name." },
457
+ account: { type: "string", description: "With --action reassign: the target sending Account (acc_...). Never defaulted." }
458
+ },
459
+ run: online(runBulk)
460
+ });
461
+ var enrollmentCommand = defineCommand({
462
+ meta: { name: "enrollment", description: DESCRIPTIONS.enrollment },
463
+ subCommands: {
464
+ list: listCmd,
465
+ get: getCmd,
466
+ pause: pauseCmd,
467
+ resume: resumeCmd,
468
+ retry: retryCmd,
469
+ stop: stopCmd,
470
+ event: eventCmd,
471
+ signal: signalCmd,
472
+ reassign: reassignCmd,
473
+ bulk: bulkCmd
474
+ },
475
+ async run() {
476
+ const { showHelp } = await import("./examples-DQSVIIXZ.js");
477
+ await showHelp(enrollmentCommand, ["curviate", "enrollment"]);
478
+ }
479
+ });
480
+ export {
481
+ enrollmentCommand,
482
+ humanReasons,
483
+ runRetry
484
+ };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  EXIT_CODE_MAP
4
- } from "./chunk-76SWLAZ6.js";
4
+ } from "./chunk-2W4RN5ON.js";
5
5
 
6
6
  // src/lib/examples.ts
7
7
  import { renderUsage } from "citty";
@@ -22,7 +22,7 @@ function renderRules(rules) {
22
22
  }
23
23
  async function renderSections(cmd) {
24
24
  const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
25
- const { renderDocument } = meta?.document ? await import("./document-AUUCGST2.js") : { renderDocument: () => [] };
25
+ const { renderDocument } = meta?.document ? await import("./document-BHYAUJ6F.js") : { renderDocument: () => [] };
26
26
  const body = {
27
27
  DOCUMENT: meta?.document ? renderDocument(meta.document) : void 0,
28
28
  RULES: renderRules(meta?.rules),
@@ -3,7 +3,7 @@ import {
3
3
  AUTH_NEEDED,
4
4
  EXIT_CODE_MAP,
5
5
  getExitCode
6
- } from "./chunk-76SWLAZ6.js";
6
+ } from "./chunk-2W4RN5ON.js";
7
7
  export {
8
8
  AUTH_NEEDED,
9
9
  EXIT_CODE_MAP,
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ writeExport
4
+ } from "./chunk-PPGKQJKU.js";
5
+ import {
6
+ fail,
7
+ outputOpts,
8
+ rootClient,
9
+ usage
10
+ } from "./chunk-T6GBS5SS.js";
11
+ import {
12
+ renderSuccess
13
+ } from "./chunk-QM57YDJE.js";
14
+ import {
15
+ downloadBinary
16
+ } from "./chunk-YXVF5UST.js";
17
+ import {
18
+ GLOBAL_FLAGS,
19
+ READ_SINGLE_FLAGS,
20
+ readOnly
21
+ } from "./chunk-RYWWSZUH.js";
22
+ import {
23
+ DESCRIPTIONS
24
+ } from "./chunk-73DJ3KNE.js";
25
+ import "./chunk-ZYURL5VK.js";
26
+
27
+ // src/commands/export.ts
28
+ import { defineCommand } from "citty";
29
+ var ERRORS = {
30
+ EXPORT_NOT_READY: "the export is queued, running or failed: read its status with `curviate export get <export_id>`.",
31
+ EXPORT_EXPIRED: "the file has expired: run the export again.",
32
+ EXPORT_REMOVED: "the export was removed because a Contact was deleted: run it again."
33
+ };
34
+ async function runGet(c, f) {
35
+ try {
36
+ renderSuccess(await c.exports.get(String(f.id ?? "")), outputOpts(f), process);
37
+ } catch (err) {
38
+ await fail(err, f);
39
+ }
40
+ }
41
+ async function runDownload(c, f) {
42
+ if (f.output === void 0 && process.stdout.isTTY) usage("pass -o <file> to save the export, or redirect stdout.");
43
+ try {
44
+ const bytes = await downloadBinary(() => c.exports.download(String(f.id ?? "")));
45
+ await writeExport(f.output, new Uint8Array(bytes));
46
+ } catch (err) {
47
+ await fail(err, f);
48
+ }
49
+ }
50
+ var online = (fn) => async ({ args }) => {
51
+ const f = args;
52
+ await fn(await rootClient(f), f);
53
+ };
54
+ var ID = { type: "positional", description: "The export id (exp_...), from `curviate analytics export --job`." };
55
+ var getCmd = defineCommand({
56
+ meta: {
57
+ name: "get",
58
+ description: "One export job: status (queued, running, ready, failed, expired, removed), rows, bytes and when the file expires.",
59
+ risk: "read",
60
+ errors: { RESOURCE_NOT_FOUND: "no export with this id that you started." },
61
+ examples: ["curviate export get exp_YOUR_EXPORT_ID"]
62
+ },
63
+ args: { ...readOnly(READ_SINGLE_FLAGS), id: ID },
64
+ run: online(runGet)
65
+ });
66
+ var downloadCmd = defineCommand({
67
+ meta: {
68
+ name: "download",
69
+ description: "Download a ready export's file, byte for byte, to a file (mode 0600) or stdout.",
70
+ risk: "read",
71
+ errors: ERRORS,
72
+ output: ["The file's bytes only: CSV, JSON, NDJSON or a ZIP of several tables."],
73
+ examples: ["curviate export download exp_YOUR_EXPORT_ID -o analytics.zip"]
74
+ },
75
+ args: {
76
+ "api-key": GLOBAL_FLAGS["api-key"],
77
+ profile: GLOBAL_FLAGS.profile,
78
+ team: GLOBAL_FLAGS.team,
79
+ "base-url": GLOBAL_FLAGS["base-url"],
80
+ timeout: GLOBAL_FLAGS.timeout,
81
+ id: ID,
82
+ output: { type: "string", alias: "o", description: "File to write (mode 0600), or - for stdout." }
83
+ },
84
+ run: online(runDownload)
85
+ });
86
+ var exportCommand = defineCommand({
87
+ meta: { name: "export", description: DESCRIPTIONS.export },
88
+ subCommands: { get: getCmd, download: downloadCmd },
89
+ async run() {
90
+ const { showHelp } = await import("./examples-DQSVIIXZ.js");
91
+ await showHelp(exportCommand, ["curviate", "export"]);
92
+ }
93
+ });
94
+ export {
95
+ exportCommand
96
+ };
@@ -1,32 +1,34 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  requireAccount
4
- } from "./chunk-Q63IIPL2.js";
4
+ } from "./chunk-25MO7BYN.js";
5
5
  import {
6
6
  pageDelayFromFlags,
7
7
  readCursorFlag,
8
8
  readMaxPagesFlag,
9
9
  readablePage,
10
10
  rejectPaginationModifiersWithoutAll,
11
+ streamAll
12
+ } from "./chunk-L4CIJT6F.js";
13
+ import {
11
14
  renderError,
12
15
  renderSuccess,
13
16
  renderUnexpectedError,
14
- resolveEffectiveConfig,
15
- streamAll,
16
17
  writeNdjsonItem
17
- } from "./chunk-MKGVNDMJ.js";
18
- import "./chunk-76SWLAZ6.js";
18
+ } from "./chunk-QM57YDJE.js";
19
19
  import {
20
- createClient
21
- } from "./chunk-OHXYFICP.js";
20
+ createClient,
21
+ resolveEffectiveConfig
22
+ } from "./chunk-YXVF5UST.js";
22
23
  import {
23
24
  GLOBAL_FLAGS,
24
25
  readOnly
25
- } from "./chunk-CVMSQ3OF.js";
26
+ } from "./chunk-RYWWSZUH.js";
26
27
  import {
27
28
  DESCRIPTIONS
28
- } from "./chunk-GQKC6E5K.js";
29
+ } from "./chunk-73DJ3KNE.js";
29
30
  import "./chunk-ZYURL5VK.js";
31
+ import "./chunk-2W4RN5ON.js";
30
32
 
31
33
  // src/commands/feed.ts
32
34
  import { defineCommand } from "citty";
@@ -47,7 +49,7 @@ function resolveOutputOpts(flags) {
47
49
  async function handleSdkError(err, outOpts, out) {
48
50
  const { CurviateError } = await import("@curviate/sdk");
49
51
  if (err instanceof CurviateError) {
50
- const { getExitCode } = await import("./exit-codes-AW6KHDDN.js");
52
+ const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
51
53
  renderError(err, outOpts, out);
52
54
  process.exit(getExitCode(err));
53
55
  }
@@ -96,6 +98,7 @@ var feedHomeCommand = defineCommand({
96
98
  meta: {
97
99
  name: "home",
98
100
  description: "Read the connected account's LinkedIn home feed as agent-actionable posts. Every post carries its text and created_at. On the default recent sort every engagement count is null (unknown, not zero) and only the author's name resolves; --sort relevant fills engagement and the author's ids.",
101
+ risk: "read",
99
102
  examples: [
100
103
  "curviate core feed home",
101
104
  "curviate core feed home --sort relevant",