@dench.com/cli 2.8.8-staging.192 → 2.9.0-staging.193

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.
@@ -225,6 +225,202 @@ const campaignRecipientInput = z.object({
225
225
  .describe("Values for {{variable}} placeholders in the template."),
226
226
  });
227
227
 
228
+ // ---------------------------------------------------------------------------
229
+ // Outreach campaign fragments (mirror convex/functions/outreachSequences.ts)
230
+ // ---------------------------------------------------------------------------
231
+
232
+ const campaignSendSchedule = z
233
+ .object({
234
+ name: z.string().describe('Label, e.g. "Mon-Fri 9-18".'),
235
+ timezone: z.string().describe("IANA timezone, e.g. America/Los_Angeles."),
236
+ startHour: z
237
+ .number()
238
+ .int()
239
+ .min(0)
240
+ .max(23)
241
+ .describe("First hour sends may go out (0-23)."),
242
+ endHour: z
243
+ .number()
244
+ .int()
245
+ .min(1)
246
+ .max(24)
247
+ .describe("Hour sends stop (1-24); must be after startHour."),
248
+ weekdays: z
249
+ .array(z.number().int().min(0).max(6))
250
+ .min(1)
251
+ .describe("Days sends may go out: 0 = Sunday ... 6 = Saturday."),
252
+ })
253
+ .describe(
254
+ "One send window. A campaign has one to eight; the first one's timezone is the campaign's.",
255
+ );
256
+
257
+ const campaignStepType = z
258
+ .enum([
259
+ "email",
260
+ "wait",
261
+ "linkedin_visit",
262
+ "linkedin_connection",
263
+ "linkedin_message",
264
+ ])
265
+ .describe("Step type.");
266
+
267
+ const campaignStepInput = z
268
+ .object({
269
+ type: campaignStepType,
270
+ waitHours: z
271
+ .number()
272
+ .optional()
273
+ .describe("wait steps: hours to wait before the next step."),
274
+ emailMailboxAccountId: z
275
+ .string()
276
+ .optional()
277
+ .describe(
278
+ "email steps: the connected mailbox that sends (an emailMailboxAccounts id from `dench campaign accounts`).",
279
+ ),
280
+ emailSubject: z
281
+ .string()
282
+ .optional()
283
+ .describe("email steps: subject; {{Column}} merge tokens allowed."),
284
+ emailHtmlBody: z.string().optional(),
285
+ emailTextBody: z.string().optional(),
286
+ emailReplyToPrevious: z
287
+ .boolean()
288
+ .optional()
289
+ .describe(
290
+ "email steps: thread under the previous email step instead of a new subject.",
291
+ ),
292
+ onlyIf: z
293
+ .enum(["always", "connected", "not_connected"])
294
+ .optional()
295
+ .describe(
296
+ "Run this step only when the person is / is not a LinkedIn connection.",
297
+ ),
298
+ linkedinAccountId: z
299
+ .string()
300
+ .optional()
301
+ .describe("LinkedIn steps: the connected LinkedIn account that acts."),
302
+ linkedinMessageBody: z
303
+ .string()
304
+ .optional()
305
+ .describe(
306
+ "linkedin_connection: the invite note (optional); linkedin_message: the message (up to 3000 chars).",
307
+ ),
308
+ linkedinMessageMode: z
309
+ .enum(["skip_if_not_connected", "wait_until_connected"])
310
+ .optional()
311
+ .describe(
312
+ "linkedin_message: what to do when the invite is still pending.",
313
+ ),
314
+ connectionTimeoutHours: z
315
+ .number()
316
+ .optional()
317
+ .describe(
318
+ "linkedin_message with linkedinMessageMode=wait_until_connected: give up waiting for the accept after this many hours (default 720).",
319
+ ),
320
+ })
321
+ .describe("One campaign step, in order.");
322
+
323
+ const campaignStatus = z
324
+ .enum(["draft", "active", "paused", "completed", "archived"])
325
+ .describe("Campaign lifecycle status.");
326
+
327
+ const campaignRow = z
328
+ .object({
329
+ _id: z.string(),
330
+ name: z.string(),
331
+ status: campaignStatus,
332
+ stopOnReply: z.boolean(),
333
+ timezone: z.string().optional(),
334
+ startsAt: z.number().optional(),
335
+ endsAt: z.number().optional(),
336
+ sendSchedules: z.array(campaignSendSchedule).optional(),
337
+ dailySendCap: z.number().optional(),
338
+ stepCount: z.number(),
339
+ totalEnrolled: z.number(),
340
+ activeCount: z.number(),
341
+ pausedCount: z.number(),
342
+ finishedCount: z.number(),
343
+ repliedCount: z.number(),
344
+ failedCount: z.number(),
345
+ stoppedCount: z.number(),
346
+ launchedAt: z.number().optional(),
347
+ ownerName: z.string().optional(),
348
+ isOwner: z.boolean().optional(),
349
+ createdAt: z.number(),
350
+ updatedAt: z.number(),
351
+ })
352
+ .passthrough();
353
+
354
+ const campaignEnrollResult = z.object({
355
+ added: z.number(),
356
+ requested: z.number(),
357
+ cappedAtLimit: z
358
+ .number()
359
+ .nullable()
360
+ .describe(
361
+ "The campaign's people cap when it cut the batch short (300), else null.",
362
+ ),
363
+ duplicates: z.number().describe("Already in this campaign."),
364
+ merged: z
365
+ .number()
366
+ .describe("Duplicates that gained a missing email or LinkedIn URL."),
367
+ duplicatesElsewhere: z
368
+ .number()
369
+ .describe(
370
+ "Active in another campaign; skipped unless checkDuplicatesAcrossWorkspace is false.",
371
+ ),
372
+ suppressed: z.number(),
373
+ invalid: z.number(),
374
+ skippedNoIdentity: z
375
+ .number()
376
+ .describe("No usable email or LinkedIn URL on the record."),
377
+ skippedSample: z.number(),
378
+ skippedMissingInfo: z
379
+ .number()
380
+ .describe(
381
+ "Launched campaigns only: a merge token the steps use is empty for them.",
382
+ ),
383
+ missingInfoSample: z
384
+ .object({
385
+ displayName: z.string().optional(),
386
+ missingKeys: z.array(z.string()),
387
+ })
388
+ .optional(),
389
+ });
390
+
391
+ const campaignLaunchBlocker = z
392
+ .object({
393
+ code: z.string(),
394
+ scope: z.enum(["sequence", "step", "person"]),
395
+ target: z.enum(["sequence", "people", "schedule"]),
396
+ title: z.string(),
397
+ hint: z.string().optional(),
398
+ stepIndex: z.number().optional(),
399
+ people: z.array(
400
+ z.object({ enrollmentId: z.string().optional(), name: z.string() }),
401
+ ),
402
+ count: z.number(),
403
+ })
404
+ .passthrough();
405
+
406
+ const campaignReadiness = z
407
+ .object({
408
+ ready: z.boolean(),
409
+ fingerprint: z
410
+ .string()
411
+ .describe(
412
+ "Pass this to `launch`; it changes whenever the campaign changes.",
413
+ ),
414
+ blockingReasons: z.array(z.string()),
415
+ blockers: z.array(campaignLaunchBlocker),
416
+ warnings: z.array(z.string()),
417
+ stepCount: z.number(),
418
+ audienceCount: z.number(),
419
+ usesEmail: z.boolean(),
420
+ usesLinkedin: z.boolean(),
421
+ })
422
+ .passthrough();
423
+
228
424
  // ---------------------------------------------------------------------------
229
425
  // Response fragments. These mirror the real backend return shapes (Convex
230
426
  // `returns` validators / handler code / gateway response mapping). Objects
@@ -487,6 +683,12 @@ const savedViewDefinition = z
487
683
  })
488
684
  .passthrough();
489
685
 
686
+ const objectVisibility = z
687
+ .enum(["workspace", "owner_only", "owner_plus_members"])
688
+ .describe(
689
+ "Who can read the object's records. Always reported as the value the object behaves as: `meeting` defaults to owner_plus_members, `calendar_event` to owner_only, anything else to workspace.",
690
+ );
691
+
490
692
  const crmObjectDoc = z
491
693
  .object({
492
694
  _id: z.string(),
@@ -497,6 +699,7 @@ const crmObjectDoc = z
497
699
  defaultView: viewKind,
498
700
  sortOrder: z.number(),
499
701
  immutable: z.boolean(),
702
+ visibility: objectVisibility.optional(),
500
703
  icon: z.string().optional(),
501
704
  viewSettings: z.record(z.string(), z.unknown()).optional(),
502
705
  savedViews: z.array(z.record(z.string(), z.unknown())).optional(),
@@ -1488,6 +1691,121 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
1488
1691
  // Meta
1489
1692
  "commands.list": noInput,
1490
1693
 
1694
+ // Outreach campaigns (dench campaign)
1695
+ "campaigns.list": z.object({
1696
+ includeArchived: z
1697
+ .boolean()
1698
+ .optional()
1699
+ .describe("Include archived campaigns."),
1700
+ }),
1701
+ "campaigns.create": z.object({
1702
+ name: z.string(),
1703
+ timezone: z
1704
+ .string()
1705
+ .optional()
1706
+ .describe("IANA timezone for the default Mon-Fri 9-18 send window."),
1707
+ }),
1708
+ "campaigns.get": z.object({ sequenceId: z.string() }),
1709
+ "campaigns.analytics": z.object({ sequenceId: z.string() }),
1710
+ "campaigns.live": z.object({ sequenceId: z.string() }),
1711
+ "campaigns.update": z.object({
1712
+ sequenceId: z.string(),
1713
+ name: z.string().optional(),
1714
+ stopOnReply: z
1715
+ .boolean()
1716
+ .optional()
1717
+ .describe("Stop a person's remaining steps when they reply."),
1718
+ startsAt: z
1719
+ .number()
1720
+ .nullable()
1721
+ .optional()
1722
+ .describe("Epoch ms; null clears the start."),
1723
+ endsAt: z
1724
+ .number()
1725
+ .nullable()
1726
+ .optional()
1727
+ .describe("Epoch ms; null clears the end."),
1728
+ sendSchedules: z.array(campaignSendSchedule).min(1).max(8).optional(),
1729
+ dailySendCap: z
1730
+ .number()
1731
+ .int()
1732
+ .min(1)
1733
+ .max(100)
1734
+ .optional()
1735
+ .describe("Cold emails per day, 1-100."),
1736
+ }),
1737
+ "campaigns.steps.replace": z.object({
1738
+ sequenceId: z.string(),
1739
+ steps: z.array(campaignStepInput).min(1).max(20),
1740
+ }),
1741
+ "campaigns.people.addFromCrm": z.object({
1742
+ sequenceId: z.string(),
1743
+ objectName: z
1744
+ .string()
1745
+ .describe("CRM object the ids belong to, e.g. lead or people."),
1746
+ entryIds: z.array(z.string()).min(1).max(100),
1747
+ emailFieldName: z
1748
+ .string()
1749
+ .optional()
1750
+ .describe('Column holding the email when it is not "Email".'),
1751
+ linkedinUrlFieldName: z
1752
+ .string()
1753
+ .optional()
1754
+ .describe("Column holding the LinkedIn profile URL."),
1755
+ nameFieldName: z.string().optional(),
1756
+ relationFieldName: z
1757
+ .string()
1758
+ .optional()
1759
+ .describe("Follow this relation to the person record first."),
1760
+ relationDirection: z.literal("reverse").optional(),
1761
+ checkDuplicatesAcrossWorkspace: z
1762
+ .boolean()
1763
+ .optional()
1764
+ .describe("Default true: skip people active in another campaign."),
1765
+ }),
1766
+ "campaigns.people.add": z.object({
1767
+ sequenceId: z.string(),
1768
+ displayName: z.string().optional(),
1769
+ email: z.string().optional(),
1770
+ linkedinProfileUrl: z.string().optional(),
1771
+ entryId: z
1772
+ .string()
1773
+ .optional()
1774
+ .describe("Existing CRM people entry to link."),
1775
+ sourceEntryId: z.string().optional(),
1776
+ sourceObjectName: z.string().optional(),
1777
+ personalization: z.record(z.string(), z.unknown()).optional(),
1778
+ checkDuplicatesAcrossWorkspace: z.boolean().optional(),
1779
+ }),
1780
+ "campaigns.launch.preview": z.object({ sequenceId: z.string() }),
1781
+ "campaigns.launch": z.object({
1782
+ sequenceId: z.string(),
1783
+ fingerprint: z.string().describe("From the launch preview."),
1784
+ linkedinRiskAcknowledged: z
1785
+ .boolean()
1786
+ .optional()
1787
+ .describe("Required when the campaign has LinkedIn steps."),
1788
+ }),
1789
+ "campaigns.pause": z.object({ sequenceId: z.string() }),
1790
+ "campaigns.resume": z.object({ sequenceId: z.string() }),
1791
+ "campaigns.archive": z.object({ sequenceId: z.string() }),
1792
+ "campaigns.events": z.object({
1793
+ sequenceId: z.string(),
1794
+ numItems: z
1795
+ .number()
1796
+ .int()
1797
+ .min(1)
1798
+ .max(200)
1799
+ .optional()
1800
+ .describe("Page size, default 50."),
1801
+ cursor: z
1802
+ .string()
1803
+ .optional()
1804
+ .describe("continueCursor from the previous page."),
1805
+ }),
1806
+ "campaigns.people.stop": z.object({ enrollmentId: z.string() }),
1807
+ "campaigns.people.resume": z.object({ enrollmentId: z.string() }),
1808
+
1491
1809
  // Auth
1492
1810
  "auth.signin.create": z.object({
1493
1811
  codeHash: z.string(),
@@ -1671,6 +1989,11 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
1671
1989
  icon: z.string().optional(),
1672
1990
  viewSettings: z.record(z.string(), z.unknown()).optional(),
1673
1991
  savedViews: z.array(z.record(z.string(), z.unknown())).optional(),
1992
+ visibility: objectVisibility
1993
+ .optional()
1994
+ .describe(
1995
+ "Who can see the object's records: every workspace member, only the record's owner, or the owner plus the members listed on the record. Admins only (a signed-in admin; an org-scoped key cannot change it). Records created before the switch have no owner and are hidden from everyone until one is set; switch back to workspace to see them again.",
1996
+ ),
1674
1997
  }),
1675
1998
  "crm.objects.rename": z.object({
1676
1999
  from: z.string().describe("Current object name (path)."),
@@ -2461,6 +2784,94 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
2461
2784
 
2462
2785
  export const responseSchemas: Record<string, ZodTypeAny> = {
2463
2786
  // Meta
2787
+ // Outreach campaigns (dench campaign)
2788
+ "campaigns.list": z.array(campaignRow),
2789
+ "campaigns.create": z.object({ sequenceId: z.string() }),
2790
+ "campaigns.get": z
2791
+ .object({
2792
+ sequence: campaignRow,
2793
+ steps: z.array(campaignStepInput.passthrough()),
2794
+ enrollments: z.array(z.record(z.string(), z.unknown())),
2795
+ currentRuns: z
2796
+ .record(z.string(), z.unknown())
2797
+ .describe(
2798
+ "enrollmentId -> the step run in progress, its hold and LinkedIn action.",
2799
+ ),
2800
+ lastTouches: z.record(
2801
+ z.string(),
2802
+ z.object({ type: z.string(), at: z.number() }),
2803
+ ),
2804
+ connectedEntries: z
2805
+ .record(z.string(), z.unknown())
2806
+ .describe("enrollmentId -> linked CRM record and lead status."),
2807
+ connectedFieldNames: z.array(z.string()),
2808
+ isOwner: z.boolean(),
2809
+ })
2810
+ .passthrough()
2811
+ .nullable(),
2812
+ "campaigns.analytics": z
2813
+ .object({
2814
+ audience: z.number(),
2815
+ contacted: z.number(),
2816
+ linkedinInvited: z.number(),
2817
+ linkedinConnected: z.number(),
2818
+ linkedinMessaged: z.number(),
2819
+ linkedinReplied: z.number(),
2820
+ active: z.number(),
2821
+ paused: z.number(),
2822
+ finished: z.number(),
2823
+ replied: z.number(),
2824
+ failed: z.number(),
2825
+ stopped: z.number(),
2826
+ emailSent: z.number(),
2827
+ opened: z.number(),
2828
+ clicked: z.number(),
2829
+ linkedinSent: z.number(),
2830
+ replyRate: z.number(),
2831
+ openRate: z.number(),
2832
+ clickRate: z.number(),
2833
+ truncated: z.boolean(),
2834
+ })
2835
+ .passthrough(),
2836
+ "campaigns.live": z
2837
+ .object({
2838
+ status: campaignStatus,
2839
+ usesEmail: z.boolean(),
2840
+ usesLinkedin: z.boolean(),
2841
+ emailsToday: z.number(),
2842
+ dailySendCap: z.number().nullable(),
2843
+ nextEmailAt: z.number().nullable(),
2844
+ now: z.record(z.string(), z.unknown()).nullable(),
2845
+ next: z.record(z.string(), z.unknown()).nullable(),
2846
+ paused: z.record(z.string(), z.unknown()).nullable(),
2847
+ senders: z.array(z.record(z.string(), z.unknown())),
2848
+ })
2849
+ .passthrough(),
2850
+ "campaigns.update": okResponse,
2851
+ "campaigns.steps.replace": z.object({
2852
+ ok: z.boolean(),
2853
+ stepCount: z.number(),
2854
+ }),
2855
+ "campaigns.people.addFromCrm": campaignEnrollResult,
2856
+ "campaigns.people.add": z.object({ enrollmentId: z.string() }),
2857
+ "campaigns.launch.preview": campaignReadiness,
2858
+ "campaigns.launch": z.object({
2859
+ ok: z.boolean(),
2860
+ status: z.literal("active"),
2861
+ }),
2862
+ "campaigns.pause": okResponse,
2863
+ "campaigns.resume": okResponse,
2864
+ "campaigns.archive": okResponse,
2865
+ "campaigns.events": z
2866
+ .object({
2867
+ page: z.array(z.record(z.string(), z.unknown())),
2868
+ isDone: z.boolean(),
2869
+ continueCursor: z.string(),
2870
+ })
2871
+ .passthrough(),
2872
+ "campaigns.people.stop": okResponse,
2873
+ "campaigns.people.resume": okResponse,
2874
+
2464
2875
  "commands.list": z.object({
2465
2876
  operations: z.array(
2466
2877
  z.object({
@@ -3265,6 +3676,17 @@ export type ConvexExtras = {
3265
3676
  };
3266
3677
 
3267
3678
  export const convexExtras: Record<string, ConvexExtras> = {
3679
+ // The events query paginates with Convex's `paginationOpts`; the flat
3680
+ // `numItems` / `cursor` query params are folded into it here.
3681
+ "campaigns.events": {
3682
+ transformArgs: (input) => ({
3683
+ sequenceId: input.sequenceId,
3684
+ paginationOpts: {
3685
+ numItems: typeof input.numItems === "number" ? input.numItems : 50,
3686
+ cursor: typeof input.cursor === "string" ? input.cursor : null,
3687
+ },
3688
+ }),
3689
+ },
3268
3690
  "cron.enable": { fixedArgs: { enabled: true } },
3269
3691
  "cron.disable": { fixedArgs: { enabled: false } },
3270
3692
  // Archive/unarchive are one mutation behind two paths, so the flag comes
@@ -3335,6 +3757,52 @@ export const convexExtras: Record<string, ConvexExtras> = {
3335
3757
  // ---------------------------------------------------------------------------
3336
3758
 
3337
3759
  export const requestExamples: Record<string, unknown> = {
3760
+ "campaigns.create": {
3761
+ name: "Founder outreach",
3762
+ timezone: "America/Los_Angeles",
3763
+ },
3764
+ "campaigns.update": {
3765
+ sequenceId: "<sequenceId>",
3766
+ dailySendCap: 30,
3767
+ sendSchedules: [
3768
+ {
3769
+ name: "Mon-Fri 9-18",
3770
+ timezone: "America/Los_Angeles",
3771
+ startHour: 9,
3772
+ endHour: 18,
3773
+ weekdays: [1, 2, 3, 4, 5],
3774
+ },
3775
+ ],
3776
+ },
3777
+ "campaigns.steps.replace": {
3778
+ sequenceId: "<sequenceId>",
3779
+ steps: [
3780
+ { type: "linkedin_visit", linkedinAccountId: "<linkedinAccountId>" },
3781
+ {
3782
+ type: "linkedin_connection",
3783
+ linkedinAccountId: "<linkedinAccountId>",
3784
+ linkedinMessageBody:
3785
+ "Hi {{First name}}, enjoyed your post on {{Topic}}.",
3786
+ },
3787
+ { type: "wait", waitHours: 48 },
3788
+ {
3789
+ type: "email",
3790
+ emailMailboxAccountId: "<emailMailboxAccountId>",
3791
+ emailSubject: "Quick question, {{First name}}",
3792
+ emailTextBody: "Hi {{First name}}, ...",
3793
+ },
3794
+ ],
3795
+ },
3796
+ "campaigns.people.addFromCrm": {
3797
+ sequenceId: "<sequenceId>",
3798
+ objectName: "lead",
3799
+ entryIds: ["<entryId1>", "<entryId2>"],
3800
+ },
3801
+ "campaigns.launch": {
3802
+ sequenceId: "<sequenceId>",
3803
+ fingerprint: "<fingerprint from the launch preview>",
3804
+ linkedinRiskAcknowledged: true,
3805
+ },
3338
3806
  "browser.action": {
3339
3807
  action: "open",
3340
3808
  url: "https://example.com",