@dench.com/cli 2.8.7-staging.189 → 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(),
@@ -545,6 +748,73 @@ const crmEntryShape = z
545
748
 
546
749
  const entryWriteResponse = z.object({ entryId: z.string() });
547
750
 
751
+ const commentActorShape = z
752
+ .object({
753
+ kind: z.string(),
754
+ label: z.string(),
755
+ displayName: z.string().optional(),
756
+ imageUrl: z.string().optional(),
757
+ userId: z.string().optional(),
758
+ isDench: z.boolean(),
759
+ })
760
+ .passthrough();
761
+
762
+ const commentShape = z
763
+ .object({
764
+ _id: z.string(),
765
+ entryId: z.string(),
766
+ parentCommentId: z.string().optional(),
767
+ rootCommentId: z.string().optional(),
768
+ depth: z.number(),
769
+ body: z.string().describe("Markdown."),
770
+ actor: commentActorShape,
771
+ mentionedUserIds: z.array(z.string()),
772
+ mentionsDench: z.boolean(),
773
+ replyCount: z.number(),
774
+ reactionSummary: z.array(
775
+ z.object({ emoji: z.string(), count: z.number() }),
776
+ ),
777
+ viewerReactions: z.array(z.string()),
778
+ editedAt: z.number().optional(),
779
+ deletedAt: z.number().optional(),
780
+ denchStatus: z.enum(["pending", "failed", "done"]).optional(),
781
+ canEdit: z.boolean(),
782
+ createdAt: z.number(),
783
+ })
784
+ .passthrough()
785
+ .describe("A comment on a CRM entry.");
786
+
787
+ const commentPage = z.object({
788
+ page: z.array(commentShape),
789
+ isDone: z.boolean(),
790
+ continueCursor: z.string(),
791
+ });
792
+
793
+ const notificationShape = z
794
+ .object({
795
+ _id: z.string(),
796
+ kind: z.string(),
797
+ title: z.string(),
798
+ body: z.string().optional(),
799
+ link: z.string().optional(),
800
+ readAt: z.number().optional(),
801
+ archivedAt: z.number().optional(),
802
+ createdAt: z.number(),
803
+ })
804
+ .passthrough();
805
+
806
+ const notificationPreferencesShape = z.object({
807
+ inAppEnabled: z.boolean(),
808
+ emailEnabled: z.boolean(),
809
+ perKind: z.record(
810
+ z.string(),
811
+ z.object({ inApp: z.boolean().optional(), email: z.boolean().optional() }),
812
+ ),
813
+ timezone: z.string().nullable(),
814
+ digestWindowMinutes: z.number(),
815
+ maxEmailsPerDay: z.number(),
816
+ });
817
+
548
818
  const crmBatchResults = z.object({
549
819
  results: z.array(
550
820
  z
@@ -1421,6 +1691,121 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
1421
1691
  // Meta
1422
1692
  "commands.list": noInput,
1423
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
+
1424
1809
  // Auth
1425
1810
  "auth.signin.create": z.object({
1426
1811
  codeHash: z.string(),
@@ -1593,7 +1978,9 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
1593
1978
  icon: z
1594
1979
  .string()
1595
1980
  .optional()
1596
- .describe("Hugeicons (or legacy Lucide) icon name, e.g. user-multiple, target-01."),
1981
+ .describe(
1982
+ "Hugeicons (or legacy Lucide) icon name, e.g. user-multiple, target-01.",
1983
+ ),
1597
1984
  }),
1598
1985
  "crm.objects.update": z.object({
1599
1986
  name: z.string(),
@@ -1602,6 +1989,11 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
1602
1989
  icon: z.string().optional(),
1603
1990
  viewSettings: z.record(z.string(), z.unknown()).optional(),
1604
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
+ ),
1605
1997
  }),
1606
1998
  "crm.objects.rename": z.object({
1607
1999
  from: z.string().describe("Current object name (path)."),
@@ -1804,6 +2196,92 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
1804
2196
  entryIds: z.array(z.string()).max(200),
1805
2197
  }),
1806
2198
 
2199
+ // CRM comments
2200
+ "crm.comments.list": z.object({
2201
+ objectName: z.string(),
2202
+ entryId: z.string(),
2203
+ limit: z.coerce.number().int().min(1).max(100).optional(),
2204
+ cursor: z
2205
+ .string()
2206
+ .optional()
2207
+ .describe("continueCursor from the prior page."),
2208
+ replies: z.coerce
2209
+ .number()
2210
+ .int()
2211
+ .min(0)
2212
+ .max(50)
2213
+ .optional()
2214
+ .describe("Preview replies per root (default 2)."),
2215
+ }),
2216
+ "crm.comments.replies": z.object({
2217
+ commentId: z.string().describe("Root comment id."),
2218
+ limit: z.coerce.number().int().min(1).max(100).optional(),
2219
+ cursor: z.string().optional(),
2220
+ }),
2221
+ "crm.comments.get": z.object({ commentId: z.string() }),
2222
+ "crm.comments.create": z.object({
2223
+ objectName: z.string(),
2224
+ entryId: z.string(),
2225
+ body: z
2226
+ .string()
2227
+ .min(1)
2228
+ .describe(
2229
+ "Markdown. Mention a member with [@Name](/?member=<userId>); mention Dench with [@Dench](/?member=dench).",
2230
+ ),
2231
+ parentCommentId: z
2232
+ .string()
2233
+ .optional()
2234
+ .describe("Reply under this comment (any depth)."),
2235
+ mentionUserIds: z
2236
+ .array(z.string())
2237
+ .optional()
2238
+ .describe("Extra members to notify without writing mention links."),
2239
+ mentionDench: z
2240
+ .boolean()
2241
+ .optional()
2242
+ .describe("Summon Dench to reply in the thread."),
2243
+ }),
2244
+ "crm.comments.update": z.object({
2245
+ commentId: z.string(),
2246
+ body: z.string().min(1),
2247
+ }),
2248
+ "crm.comments.delete": z.object({ commentId: z.string() }),
2249
+ "crm.comments.react": z.object({
2250
+ commentId: z.string(),
2251
+ emoji: z.string().describe("A single emoji, e.g. 👍."),
2252
+ }),
2253
+ "crm.watch.get": z.object({ objectName: z.string(), entryId: z.string() }),
2254
+ "crm.watch.set": z.object({
2255
+ objectName: z.string(),
2256
+ entryId: z.string(),
2257
+ watching: z
2258
+ .boolean()
2259
+ .optional()
2260
+ .describe("Defaults to true; false unfollows."),
2261
+ }),
2262
+
2263
+ // CRM tasks
2264
+ "crm.tasks.mine": z.object({
2265
+ limit: z.coerce.number().int().min(1).max(500).optional(),
2266
+ }),
2267
+ "crm.tasks.forEntry": z.object({
2268
+ objectName: z.string(),
2269
+ entryId: z.string(),
2270
+ }),
2271
+ "crm.tasks.createForEntry": z.object({
2272
+ objectName: z.string(),
2273
+ entryId: z.string(),
2274
+ name: z.string().min(1),
2275
+ assigneeUserId: z.string().optional(),
2276
+ dueDateKey: z
2277
+ .string()
2278
+ .regex(/^\d{4}-\d{2}-\d{2}$/)
2279
+ .optional()
2280
+ .describe("YYYY-MM-DD"),
2281
+ }),
2282
+ "crm.tasks.complete": z.object({ entryId: z.string() }),
2283
+ "crm.tasks.reopen": z.object({ entryId: z.string() }),
2284
+
1807
2285
  // CRM cells
1808
2286
  "crm.cells.get": z.object({
1809
2287
  objectName: z.string(),
@@ -2265,6 +2743,39 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
2265
2743
  .string()
2266
2744
  .describe("Human name for the account. Empty clears it."),
2267
2745
  }),
2746
+
2747
+ // Notifications
2748
+ "notifications.list": z.object({
2749
+ filter: z.enum(["inbox", "unread", "archived", "all"]).optional(),
2750
+ limit: z.coerce.number().int().min(1).max(100).optional(),
2751
+ }),
2752
+ "notifications.unreadCount": noInput,
2753
+ "notifications.read": z.object({
2754
+ notificationId: z.string(),
2755
+ read: z
2756
+ .boolean()
2757
+ .optional()
2758
+ .describe("Defaults to true; false marks unread."),
2759
+ }),
2760
+ "notifications.readAll": noInput,
2761
+ "notifications.archive": z.object({ notificationId: z.string() }),
2762
+ "notifications.preferences.get": noInput,
2763
+ "notifications.preferences.update": z.object({
2764
+ inAppEnabled: z.boolean().optional(),
2765
+ emailEnabled: z.boolean().optional(),
2766
+ perKind: z
2767
+ .record(
2768
+ z.string(),
2769
+ z.object({
2770
+ inApp: z.boolean().optional(),
2771
+ email: z.boolean().optional(),
2772
+ }),
2773
+ )
2774
+ .optional(),
2775
+ timezone: z.string().optional(),
2776
+ digestWindowMinutes: z.number().int().optional(),
2777
+ maxEmailsPerDay: z.number().int().optional(),
2778
+ }),
2268
2779
  };
2269
2780
 
2270
2781
  // ---------------------------------------------------------------------------
@@ -2273,6 +2784,94 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
2273
2784
 
2274
2785
  export const responseSchemas: Record<string, ZodTypeAny> = {
2275
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
+
2276
2875
  "commands.list": z.object({
2277
2876
  operations: z.array(
2278
2877
  z.object({
@@ -2552,6 +3151,54 @@ export const responseSchemas: Record<string, ZodTypeAny> = {
2552
3151
  }),
2553
3152
  "crm.cells.append": entryWriteResponse,
2554
3153
 
3154
+ // CRM comments + tasks
3155
+ "crm.comments.list": commentPage.extend({
3156
+ page: z.array(commentShape.extend({ replies: z.array(commentShape) })),
3157
+ }),
3158
+ "crm.comments.replies": commentPage,
3159
+ "crm.comments.get": commentShape.extend({
3160
+ objectName: z.string(),
3161
+ entryLabel: z.string(),
3162
+ }),
3163
+ "crm.comments.create": z.object({
3164
+ id: z.string(),
3165
+ rootCommentId: z.string().optional(),
3166
+ depth: z.number(),
3167
+ mentionedUserIds: z.array(z.string()),
3168
+ mentionsDench: z.boolean(),
3169
+ }),
3170
+ "crm.comments.update": z.object({
3171
+ ok: z.boolean(),
3172
+ newlyMentioned: z.array(z.string()),
3173
+ }),
3174
+ "crm.comments.delete": z.object({ ok: z.boolean(), tombstoned: z.boolean() }),
3175
+ "crm.comments.react": z.object({
3176
+ reacted: z.boolean(),
3177
+ reactionSummary: z.array(
3178
+ z.object({ emoji: z.string(), count: z.number() }),
3179
+ ),
3180
+ }),
3181
+ "crm.watch.get": z.object({
3182
+ watching: z.boolean(),
3183
+ reason: z.string().optional(),
3184
+ watcherCount: z.number(),
3185
+ }),
3186
+ "crm.watch.set": z.object({ watching: z.boolean() }),
3187
+ "crm.tasks.mine": z.array(z.object({}).passthrough()),
3188
+ "crm.tasks.forEntry": z.array(z.object({}).passthrough()),
3189
+ "crm.tasks.createForEntry": z.object({}).passthrough(),
3190
+ "crm.tasks.complete": z.object({}).passthrough(),
3191
+ "crm.tasks.reopen": z.object({}).passthrough(),
3192
+
3193
+ // Notifications
3194
+ "notifications.list": z.array(notificationShape),
3195
+ "notifications.unreadCount": z.number(),
3196
+ "notifications.read": okResponse,
3197
+ "notifications.readAll": z.object({ ok: z.boolean(), patched: z.number() }),
3198
+ "notifications.archive": okResponse,
3199
+ "notifications.preferences.get": notificationPreferencesShape.nullable(),
3200
+ "notifications.preferences.update": okResponse,
3201
+
2555
3202
  // CRM query + search
2556
3203
  "crm.query": z
2557
3204
  .array(crmEntryShape)
@@ -3029,6 +3676,17 @@ export type ConvexExtras = {
3029
3676
  };
3030
3677
 
3031
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
+ },
3032
3690
  "cron.enable": { fixedArgs: { enabled: true } },
3033
3691
  "cron.disable": { fixedArgs: { enabled: false } },
3034
3692
  // Archive/unarchive are one mutation behind two paths, so the flag comes
@@ -3099,6 +3757,52 @@ export const convexExtras: Record<string, ConvexExtras> = {
3099
3757
  // ---------------------------------------------------------------------------
3100
3758
 
3101
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
+ },
3102
3806
  "browser.action": {
3103
3807
  action: "open",
3104
3808
  url: "https://example.com",
@@ -3147,6 +3851,21 @@ export const requestExamples: Record<string, unknown> = {
3147
3851
  Status: "New",
3148
3852
  },
3149
3853
  },
3854
+ "crm.comments.create": {
3855
+ body: "Kickoff went well — [@Bob](/?member=user_bob) can you send the proposal? [@Dench](/?member=dench) what's the ARR here?",
3856
+ },
3857
+ "crm.comments.update": { body: "Kickoff went well — proposal sent." },
3858
+ "crm.watch.set": { watching: true },
3859
+ "crm.tasks.createForEntry": {
3860
+ name: "Send proposal",
3861
+ assigneeUserId: "user_bob",
3862
+ dueDateKey: "2026-09-05",
3863
+ },
3864
+ "notifications.read": { read: true },
3865
+ "notifications.preferences.update": {
3866
+ emailEnabled: true,
3867
+ perKind: { entry_activity: { email: false } },
3868
+ },
3150
3869
  "crm.entries.createMany": {
3151
3870
  entries: [
3152
3871
  { Name: "Jane", Email: "jane@example.com" },
@@ -3696,6 +4415,79 @@ export const responseExamples: Record<string, unknown> = {
3696
4415
  ok: true,
3697
4416
  enumColors: ["#94a3b8", "#3b82f6", "#22c55e", "#ef4444"],
3698
4417
  },
4418
+ "crm.comments.list": {
4419
+ page: [
4420
+ {
4421
+ _id: "cmt_01",
4422
+ entryId: "ent_lead99",
4423
+ depth: 0,
4424
+ body: "Kickoff went well — [@Bob](/?member=user_bob) can you send the proposal?",
4425
+ actor: {
4426
+ kind: "user",
4427
+ label: "Ada",
4428
+ displayName: "Ada Lovelace",
4429
+ userId: "user_ada",
4430
+ isDench: false,
4431
+ },
4432
+ mentionedUserIds: ["user_bob"],
4433
+ mentionsDench: false,
4434
+ replyCount: 1,
4435
+ reactionSummary: [{ emoji: "👍", count: 2 }],
4436
+ viewerReactions: ["👍"],
4437
+ canEdit: true,
4438
+ createdAt: 1765526400000,
4439
+ replies: [
4440
+ {
4441
+ _id: "cmt_02",
4442
+ entryId: "ent_lead99",
4443
+ parentCommentId: "cmt_01",
4444
+ rootCommentId: "cmt_01",
4445
+ depth: 1,
4446
+ body: "On it.",
4447
+ actor: {
4448
+ kind: "user",
4449
+ label: "Bob",
4450
+ displayName: "Bob Smith",
4451
+ userId: "user_bob",
4452
+ isDench: false,
4453
+ },
4454
+ mentionedUserIds: [],
4455
+ mentionsDench: false,
4456
+ replyCount: 0,
4457
+ reactionSummary: [],
4458
+ viewerReactions: [],
4459
+ canEdit: false,
4460
+ createdAt: 1765530000000,
4461
+ },
4462
+ ],
4463
+ },
4464
+ ],
4465
+ isDone: true,
4466
+ continueCursor: "",
4467
+ },
4468
+ "crm.comments.create": {
4469
+ id: "cmt_03",
4470
+ rootCommentId: "cmt_01",
4471
+ depth: 1,
4472
+ mentionedUserIds: ["user_bob"],
4473
+ mentionsDench: true,
4474
+ },
4475
+ "crm.comments.react": {
4476
+ reacted: true,
4477
+ reactionSummary: [{ emoji: "👍", count: 3 }],
4478
+ },
4479
+ "crm.watch.get": { watching: true, reason: "commented", watcherCount: 3 },
4480
+ "notifications.list": [
4481
+ {
4482
+ _id: "ntf_01",
4483
+ kind: "mention",
4484
+ title: "Ada Lovelace mentioned you in Ramp",
4485
+ body: "Kickoff went well — @Bob can you send the proposal?",
4486
+ link: "/acme?entry=company%3Aent_lead99&comment=cmt_01",
4487
+ createdAt: 1765526400000,
4488
+ },
4489
+ ],
4490
+ "notifications.unreadCount": 3,
3699
4491
  "crm.entries.list": [
3700
4492
  {
3701
4493
  id: "ent_lead99",