@dench.com/cli 3.0.3 → 3.1.0-staging.292

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.
package/README.md CHANGED
@@ -201,6 +201,42 @@ dench signin --staging
201
201
  dench signin --host https://staging.dench.com
202
202
  ```
203
203
 
204
+ ## Prospect review lists
205
+
206
+ People found with `dench leads find` stay in saved lists, not the CRM.
207
+ Open the list in Find for a teammate to mark profiles **ICP approved**,
208
+ **Rejected**, or **Needs research**; missing decisions are **Unreviewed**.
209
+ ICP means ideal customer profile, not sales qualification.
210
+
211
+ ```bash
212
+ dench leads find --titles "VP Sales" --save-as "Q3 targets" --json
213
+ dench lists reviews <artifactId> --limit 100 --json
214
+ dench lists reviews <artifactId> --limit 100 --cursor <continueCursor> --json
215
+ dench lists assess <artifactId> --row-json '<exact returned profile row>' --fit likely_fit --reason 'Matches the requested role; company size is still unknown.' --json
216
+ ```
217
+
218
+ `reviews` returns `page`, `continueCursor`, and `isDone`; its limit is 1–100
219
+ (default 50). `assess` records only an AI suggestion, never human approval.
220
+ Its `--fit` accepts `likely_fit`, `unlikely_fit`, or `unknown`. Reuse the
221
+ returned profile identity rather than inventing a row. Material profile
222
+ changes require human review again; formatting and added contacts do not.
223
+
224
+ Approval starts nothing by itself. In Find, a teammate separately chooses
225
+ **Enrich selected**, selects contact fields, and confirms the credit spend.
226
+ Results stay with the list and appear in `reviews` and **Export review CSV**.
227
+ Do not resubmit pending or uncertain lookups through another tool.
228
+
229
+ Only when the human explicitly asks to import approved profiles:
230
+
231
+ ```bash
232
+ dench artifacts import <artifactId> --to lead --view "Q3 outbound" --pin
233
+ ```
234
+
235
+ This imports currently approved profiles and known contacts, reusing existing
236
+ CRM records. It does not buy contacts, mark Leads `Qualified`, or start outreach.
237
+ See the [lead-finding workflow](../convex/lib/seedSkills/lead-finding.md)
238
+ and [sales pipeline playbook](../public/references/SALES.md).
239
+
204
240
  ## Outreach campaigns
205
241
 
206
242
  `dench campaign` runs email + LinkedIn outreach campaigns (the Outreach →
package/app-sdk.d.ts CHANGED
@@ -90,6 +90,21 @@ export interface ApiRequests {
90
90
  "lists.rename": Record<string, unknown>;
91
91
  /** Delete a saved search / list, its exported CSV/JSONL files, and any linked watch. — `dench lists delete` — DELETE /api/v1/lists/{artifactId} */
92
92
  "lists.delete": Record<string, unknown>;
93
+ /** Read saved prospect review decisions and enrichment outcomes. Human approval is separate from AI suggestions. — `dench lists reviews` — GET /api/v1/lists/{artifactId}/reviews */
94
+ "lists.prospects.reviews": {
95
+ artifactId: string;
96
+ limit?: number;
97
+ cursor?: string;
98
+ };
99
+ /** Suggest ICP fit for one profile. Never changes a human review decision. — `dench lists assess` — POST /api/v1/lists/{artifactId}/assess */
100
+ "lists.prospects.assess": {
101
+ artifactId: string;
102
+ row: Record<string, unknown>;
103
+ suggestion: {
104
+ fit: "likely_fit" | "unlikely_fit" | "unknown";
105
+ reason: string;
106
+ };
107
+ };
93
108
  /** Search durable workspace memory. — `dench memory search` — GET /api/v1/memory/search */
94
109
  "memory.search": {
95
110
  /** Full-text query. */
@@ -570,6 +585,12 @@ export interface ApiRequests {
570
585
  /** Defaults to true; false unfollows. */
571
586
  watching?: boolean;
572
587
  };
588
+ /** Page assigned tasks in priority order (or completed tasks by recency). — `dench crm tasks mine --page` — POST /api/v1/crm/tasks/assigned/page */
589
+ "crm.tasks.pageAssigned": Record<string, unknown>;
590
+ /** Page all tasks linked to a record, including subtasks. — `dench crm tasks list --page` — POST /api/v1/crm/objects/{objectName}/entries/{entryId}/tasks/page */
591
+ "crm.tasks.pageForEntry": Record<string, unknown>;
592
+ /** Start or resume preparation of exact task ordering and progress. — `dench crm tasks prepare` — POST /api/v1/crm/tasks/prepare */
593
+ "crm.tasks.prepare": Record<string, unknown>;
573
594
  /** Your open tasks (plus ones completed today). — `dench crm tasks mine` — GET /api/v1/crm/tasks/mine */
574
595
  "crm.tasks.mine": {
575
596
  limit?: number;
@@ -796,6 +817,8 @@ export interface ApiRequests {
796
817
  /** Which `user` field "assigned" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field. */
797
818
  assigneeField?: string;
798
819
  };
820
+ /** Scan CRM entries with a resumable cursor. Empty filtered pages can have more results. — `dench crm query --page` — POST /api/v1/crm/query/page */
821
+ "crm.queryPage": Record<string, unknown>;
799
822
  /** Run CRM SQL-compatible query. — `dench crm sql` — POST /api/v1/crm/sql */
800
823
  "crm.sql": {
801
824
  objectName: string;
@@ -2775,6 +2798,8 @@ export interface ApiResponses {
2775
2798
  "lists.update": unknown;
2776
2799
  "lists.rename": unknown;
2777
2800
  "lists.delete": unknown;
2801
+ "lists.prospects.reviews": unknown;
2802
+ "lists.prospects.assess": unknown;
2778
2803
  "memory.search": Array<{
2779
2804
  _id: string;
2780
2805
  _creationTime: number;
@@ -3350,6 +3375,9 @@ export interface ApiResponses {
3350
3375
  "crm.watch.set": {
3351
3376
  watching: boolean;
3352
3377
  };
3378
+ "crm.tasks.pageAssigned": unknown;
3379
+ "crm.tasks.pageForEntry": unknown;
3380
+ "crm.tasks.prepare": unknown;
3353
3381
  "crm.tasks.mine": Record<string, unknown>[];
3354
3382
  "crm.tasks.forEntry": Record<string, unknown>[];
3355
3383
  "crm.tasks.createForEntry": Record<string, unknown>;
@@ -3417,6 +3445,7 @@ export interface ApiResponses {
3417
3445
  updatedBy: string;
3418
3446
  sortOrder: number;
3419
3447
  }[];
3448
+ "crm.queryPage": unknown;
3420
3449
  "crm.sql": {
3421
3450
  id: string;
3422
3451
  objectId: string;
@@ -6149,6 +6178,8 @@ export type DenchApiTree = {
6149
6178
  };
6150
6179
  /** Query CRM entries. (`dench crm query`) */
6151
6180
  query(args: Req<"crm.query">): Promise<Res<"crm.query">>;
6181
+ /** Scan CRM entries with a resumable cursor. Empty filtered pages can have more results. (`dench crm query --page`) */
6182
+ queryPage(args: Req<"crm.queryPage">): Promise<Res<"crm.queryPage">>;
6152
6183
  reports: {
6153
6184
  /** Generate a CRM report. (`dench crm reports generate`) */
6154
6185
  generate(args: Req<"crm.reports.generate">): Promise<Res<"crm.reports.generate">>;
@@ -6194,6 +6225,12 @@ export type DenchApiTree = {
6194
6225
  forEntry(args: Req<"crm.tasks.forEntry">): Promise<Res<"crm.tasks.forEntry">>;
6195
6226
  /** Your open tasks (plus ones completed today). (`dench crm tasks mine`) */
6196
6227
  mine(args?: Req<"crm.tasks.mine">): Promise<Res<"crm.tasks.mine">>;
6228
+ /** Page assigned tasks in priority order (or completed tasks by recency). (`dench crm tasks mine --page`) */
6229
+ pageAssigned(args: Req<"crm.tasks.pageAssigned">): Promise<Res<"crm.tasks.pageAssigned">>;
6230
+ /** Page all tasks linked to a record, including subtasks. (`dench crm tasks list --page`) */
6231
+ pageForEntry(args: Req<"crm.tasks.pageForEntry">): Promise<Res<"crm.tasks.pageForEntry">>;
6232
+ /** Start or resume preparation of exact task ordering and progress. (`dench crm tasks prepare`) */
6233
+ prepare(args: Req<"crm.tasks.prepare">): Promise<Res<"crm.tasks.prepare">>;
6197
6234
  /** Reopen a completed task. (`dench crm tasks reopen`) */
6198
6235
  reopen(args: Req<"crm.tasks.reopen">): Promise<Res<"crm.tasks.reopen">>;
6199
6236
  repeat: {
@@ -6455,6 +6492,12 @@ export type DenchApiTree = {
6455
6492
  get(args: Req<"lists.get">): Promise<Res<"lists.get">>;
6456
6493
  /** List saved searches (find-result lists) in the workspace, newest first. (`dench lists`) */
6457
6494
  list(args?: Req<"lists.list">): Promise<Res<"lists.list">>;
6495
+ prospects: {
6496
+ /** Suggest ICP fit for one profile. Never changes a human review decision. (`dench lists assess`) */
6497
+ assess(args: Req<"lists.prospects.assess">): Promise<Res<"lists.prospects.assess">>;
6498
+ /** Read saved prospect review decisions and enrichment outcomes. Human approval is separate from AI suggestions. (`dench lists reviews`) */
6499
+ reviews(args: Req<"lists.prospects.reviews">): Promise<Res<"lists.prospects.reviews">>;
6500
+ };
6458
6501
  /** Rename a saved search / list. (`dench lists rename`) */
6459
6502
  rename(args: Req<"lists.rename">): Promise<Res<"lists.rename">>;
6460
6503
  /** Save find results as a named list (rows + filters become a workspace artifact). (`dench leads find --save-as "Name"`) */
package/campaign.ts CHANGED
@@ -290,6 +290,17 @@ async function callMutation(
290
290
  } as never);
291
291
  }
292
292
 
293
+ async function callAction(
294
+ ctx: CampaignCliContext,
295
+ name: string,
296
+ args: JsonRecord,
297
+ ): Promise<unknown> {
298
+ return await ctx.convex.action(makeFunctionReference<"action">(name), {
299
+ ...args,
300
+ sessionToken: ctx.sessionToken,
301
+ } as never);
302
+ }
303
+
293
304
  function out(
294
305
  ctx: CampaignCliContext,
295
306
  payload: unknown,
@@ -1289,7 +1300,7 @@ async function runGet(ctx: CampaignCliContext): Promise<void> {
1289
1300
  const sequenceId = String(row._id);
1290
1301
  const [detail, analytics, live] = await Promise.all([
1291
1302
  loadDetail(ctx, sequenceId),
1292
- callQuery(ctx, `${OUTREACH}:getSequenceAnalytics`, {
1303
+ callAction(ctx, `${OUTREACH}:computeSequenceAnalytics`, {
1293
1304
  sequenceId,
1294
1305
  }) as Promise<CampaignAnalytics>,
1295
1306
  callQuery(ctx, `${OUTREACH}:getSequenceLive`, {
package/chat.ts CHANGED
@@ -63,15 +63,11 @@ function parseLimit(raw: string | undefined): number | undefined {
63
63
  }
64
64
 
65
65
  const api = {
66
- listPastChats: makeFunctionReference<"query">(
67
- "functions/chat:listPastChats",
68
- ),
69
- searchPastChats: makeFunctionReference<"query">(
70
- "functions/chat:searchPastChats",
71
- ),
72
- readPastChat: makeFunctionReference<"query">(
73
- "functions/chat:readPastChat",
66
+ listPastChats: makeFunctionReference<"query">("functions/chat:listPastChats"),
67
+ searchPastChats: makeFunctionReference<"action">(
68
+ "functions/chat:searchPastChatsComplete",
74
69
  ),
70
+ readPastChat: makeFunctionReference<"query">("functions/chat:readPastChat"),
75
71
  renameThreads: makeFunctionReference<"mutation">(
76
72
  "functions/chat:renameThreads",
77
73
  ),
@@ -247,7 +243,8 @@ async function runChatSearchCommand(ctx: ChatCliContext): Promise<void> {
247
243
  }
248
244
  out(
249
245
  ctx,
250
- await callQuery(ctx, api.searchPastChats, {
246
+ await ctx.convex.action(api.searchPastChats, {
247
+ ...commonArgs(ctx),
251
248
  query,
252
249
  limit,
253
250
  includeAutomated,
@@ -536,7 +533,10 @@ async function runChatTreeCommand(ctx: ChatCliContext): Promise<void> {
536
533
  // Sort children oldest-first within each parent (spawn order),
537
534
  // roots newest-first (most recent root at the top).
538
535
  for (const list of childrenByParent.values()) {
539
- list.sort((a, b) => (a.createdAt || a.lastMessageAt) - (b.createdAt || b.lastMessageAt));
536
+ list.sort(
537
+ (a, b) =>
538
+ (a.createdAt || a.lastMessageAt) - (b.createdAt || b.lastMessageAt),
539
+ );
540
540
  }
541
541
  roots.sort((a, b) => b.lastMessageAt - a.lastMessageAt);
542
542
 
package/crm-comments.ts CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  assertNoUnknownFlags,
14
14
  type CrmCliContext,
15
15
  CrmCliError,
16
+ callAction,
16
17
  callMutation,
17
18
  callQuery,
18
19
  out,
@@ -44,6 +45,15 @@ const api = {
44
45
  ),
45
46
  },
46
47
  tasks: {
48
+ pageAssigned: makeFunctionReference<"query">(
49
+ "functions/crm/tasks:pageAssignedTasks",
50
+ ),
51
+ pageEntry: makeFunctionReference<"query">(
52
+ "functions/crm/tasks:pageEntryTasks",
53
+ ),
54
+ prepare: makeFunctionReference<"mutation">(
55
+ "functions/crm/taskReadModels:ensureReady",
56
+ ),
47
57
  listMyOpenTasks: makeFunctionReference<"query">(
48
58
  "functions/crm/tasks:listMyOpenTasks",
49
59
  ),
@@ -71,8 +81,8 @@ const api = {
71
81
  setTaskParent: makeFunctionReference<"mutation">(
72
82
  "functions/crm/tasks:setTaskParent",
73
83
  ),
74
- deleteTask: makeFunctionReference<"mutation">(
75
- "functions/crm/tasks:deleteTask",
84
+ deleteTask: makeFunctionReference<"action">(
85
+ "functions/crm/tasks:deleteTaskComplete",
76
86
  ),
77
87
  },
78
88
  repeat: {
@@ -310,26 +320,71 @@ export async function runWatchCommand(ctx: CrmCliContext): Promise<void> {
310
320
  export async function runTasksCommand(ctx: CrmCliContext): Promise<void> {
311
321
  const verb = ctx.args.shift();
312
322
  switch (verb) {
323
+ case "prepare": {
324
+ assertNoUnknownFlags(ctx.args, "crm tasks prepare");
325
+ out(ctx, await callMutation(ctx, api.tasks.prepare, {}));
326
+ return;
327
+ }
313
328
  case "mine": {
314
329
  const rawLimit = getFlag(ctx.args, "--limit");
315
330
  const priority = getFlag(ctx.args, "--priority");
331
+ const cursor = getFlag(ctx.args, "--cursor");
332
+ const paged = hasFlag(ctx.args, "--page") || cursor !== undefined;
333
+ const done = hasFlag(ctx.args, "--done");
316
334
  assertNoUnknownFlags(ctx.args, "crm tasks mine");
317
335
  out(
318
336
  ctx,
319
- await callQuery(ctx, api.tasks.listMyOpenTasks, {
320
- ...(rawLimit ? { limit: Number.parseInt(rawLimit, 10) } : {}),
321
- ...(priority ? { priority } : {}),
322
- }),
337
+ await callQuery(
338
+ ctx,
339
+ paged || done ? api.tasks.pageAssigned : api.tasks.listMyOpenTasks,
340
+ {
341
+ ...(paged || done
342
+ ? {
343
+ paginationOpts: {
344
+ cursor: cursor ?? null,
345
+ numItems: Number.parseInt(rawLimit ?? "25", 10),
346
+ },
347
+ done,
348
+ }
349
+ : rawLimit
350
+ ? { limit: Number.parseInt(rawLimit, 10) }
351
+ : {}),
352
+ ...(priority ? { priority } : {}),
353
+ },
354
+ ),
323
355
  );
324
356
  return;
325
357
  }
326
358
  case "list": {
327
359
  const objectName = shift(ctx.args, "object name");
328
360
  const entryId = shift(ctx.args, "entry id");
361
+ const cursor = getFlag(ctx.args, "--cursor");
362
+ const limit = getFlag(ctx.args, "--limit");
363
+ const paged =
364
+ hasFlag(ctx.args, "--page") ||
365
+ cursor !== undefined ||
366
+ limit !== undefined;
367
+ const done = hasFlag(ctx.args, "--done");
329
368
  assertNoUnknownFlags(ctx.args, "crm tasks list");
330
369
  out(
331
370
  ctx,
332
- await callQuery(ctx, api.tasks.listEntryTasks, { objectName, entryId }),
371
+ await callQuery(
372
+ ctx,
373
+ paged || done ? api.tasks.pageEntry : api.tasks.listEntryTasks,
374
+ {
375
+ objectName,
376
+ entryId,
377
+ ...(paged || done
378
+ ? {
379
+ done,
380
+ paginationOpts: {
381
+ cursor: cursor ?? null,
382
+ numItems: Number.parseInt(limit ?? "25", 10),
383
+ },
384
+ }
385
+ : {}),
386
+ },
387
+ ),
333
388
  );
334
389
  return;
335
390
  }
@@ -450,8 +505,34 @@ export async function runTasksCommand(ctx: CrmCliContext): Promise<void> {
450
505
  }
451
506
  case "subtasks": {
452
507
  const entryId = shift(ctx.args, "task entry id");
508
+ const cursor = getFlag(ctx.args, "--cursor");
509
+ const limit = getFlag(ctx.args, "--limit");
510
+ const paged =
511
+ hasFlag(ctx.args, "--page") ||
512
+ cursor !== undefined ||
513
+ limit !== undefined;
514
+ const done = hasFlag(ctx.args, "--done");
453
515
  assertNoUnknownFlags(ctx.args, "crm tasks subtasks");
454
- out(ctx, await callQuery(ctx, api.tasks.listSubtasks, { entryId }));
516
+ out(
517
+ ctx,
518
+ await callQuery(
519
+ ctx,
520
+ paged || done ? api.tasks.pageEntry : api.tasks.listSubtasks,
521
+ {
522
+ entryId,
523
+ ...(paged || done
524
+ ? {
525
+ objectName: "task",
526
+ done,
527
+ paginationOpts: {
528
+ cursor: cursor ?? null,
529
+ numItems: Number.parseInt(limit ?? "25", 10),
530
+ },
531
+ }
532
+ : {}),
533
+ },
534
+ ),
535
+ );
455
536
  return;
456
537
  }
457
538
  case "create-subtask": {
@@ -503,7 +584,7 @@ export async function runTasksCommand(ctx: CrmCliContext): Promise<void> {
503
584
  assertNoUnknownFlags(ctx.args, "crm tasks delete");
504
585
  out(
505
586
  ctx,
506
- await callMutation(ctx, api.tasks.deleteTask, {
587
+ await callAction(ctx, api.tasks.deleteTask, {
507
588
  entryId,
508
589
  subtasks: keep ? "keep" : "delete",
509
590
  }),
package/crm.ts CHANGED
@@ -764,7 +764,7 @@ export async function callMutation(
764
764
  }
765
765
  }
766
766
 
767
- async function callAction(
767
+ export async function callAction(
768
768
  ctx: CrmCliContext,
769
769
  fn: Parameters<ConvexHttpClient["action"]>[0],
770
770
  args: Record<string, unknown> = {},
@@ -882,8 +882,8 @@ const api = {
882
882
  objects: {
883
883
  list: makeFunctionReference<"query">("functions/crm/objects:list"),
884
884
  get: makeFunctionReference<"query">("functions/crm/objects:get"),
885
- materializeView: makeFunctionReference<"query">(
886
- "functions/crm/objects:materializeView",
885
+ materializeView: makeFunctionReference<"action">(
886
+ "functions/crm/objects:completeView",
887
887
  ),
888
888
  create: makeFunctionReference<"mutation">("functions/crm/objects:create"),
889
889
  update: makeFunctionReference<"mutation">("functions/crm/objects:update"),
@@ -972,8 +972,11 @@ const api = {
972
972
  append: makeFunctionReference<"mutation">("functions/crm/cells:append"),
973
973
  },
974
974
  query: {
975
- queryEntries: makeFunctionReference<"query">(
976
- "functions/crm/query:queryEntries",
975
+ queryEntries: makeFunctionReference<"action">(
976
+ "functions/crm/query:runQueryEntries",
977
+ ),
978
+ scanEntries: makeFunctionReference<"query">(
979
+ "functions/crm/query:scanEntries",
977
980
  ),
978
981
  aggregate: makeFunctionReference<"query">("functions/crm/query:aggregate"),
979
982
  search: makeFunctionReference<"query">("functions/crm/query:search"),
@@ -1802,6 +1805,7 @@ async function runViewsCommand(ctx: CrmCliContext): Promise<void> {
1802
1805
  10,
1803
1806
  );
1804
1807
  const withMeta = hasFlag(ctx.args, "--with-meta");
1808
+ const after = getFlag(ctx.args, "--cursor");
1805
1809
  const assigneeScopeArgs = resolveAssigneeScopeFlags(ctx.args);
1806
1810
  assertNoUnknownFlags(ctx.args, "crm views entries");
1807
1811
  if (!Number.isFinite(page) || page < 1) {
@@ -1827,10 +1831,11 @@ async function runViewsCommand(ctx: CrmCliContext): Promise<void> {
1827
1831
  )
1828
1832
  : undefined;
1829
1833
  const materialized = (await suppressForwardedConvexLogs(() =>
1830
- callQuery(ctx, api.objects.materializeView, {
1834
+ callAction(ctx, api.objects.materializeView, {
1831
1835
  objectName,
1832
1836
  page,
1833
1837
  pageSize,
1838
+ after,
1834
1839
  filters: view.filters,
1835
1840
  sort: Array.isArray(view.sort) ? view.sort : undefined,
1836
1841
  pinnedEntryIds,
@@ -1843,6 +1848,10 @@ async function runViewsCommand(ctx: CrmCliContext): Promise<void> {
1843
1848
  page?: number;
1844
1849
  pageSize?: number;
1845
1850
  truncated?: boolean;
1851
+ continueCursor?: string;
1852
+ isDone?: boolean;
1853
+ startedAt?: number;
1854
+ completedAt?: number;
1846
1855
  assigneeScope?: unknown;
1847
1856
  } | null;
1848
1857
 
@@ -1879,6 +1888,10 @@ async function runViewsCommand(ctx: CrmCliContext): Promise<void> {
1879
1888
  page: materialized.page ?? page,
1880
1889
  pageSize: materialized.pageSize ?? pageSize,
1881
1890
  truncated: materialized.truncated ?? false,
1891
+ continueCursor: materialized.continueCursor,
1892
+ isDone: materialized.isDone,
1893
+ startedAt: materialized.startedAt,
1894
+ completedAt: materialized.completedAt,
1882
1895
  assigneeScope: materialized.assigneeScope ?? null,
1883
1896
  entries,
1884
1897
  });
@@ -2856,12 +2869,14 @@ async function runQueryCommand(ctx: CrmCliContext): Promise<void> {
2856
2869
  | undefined;
2857
2870
  const select = getFlag(ctx.args, "--select")?.split(",").filter(Boolean);
2858
2871
  const sort = getFlag(ctx.args, "--sort");
2872
+ const cursor = getFlag(ctx.args, "--cursor");
2873
+ const pageMode = hasFlag(ctx.args, "--page") || cursor !== undefined;
2859
2874
  // The server clamps at 1000 silently; surface the clamp on stderr so
2860
2875
  // callers never mistake a truncated page for the full dataset. Output
2861
2876
  // here is a bare JSON array, so stderr is the only safe channel.
2862
2877
  const limit = resolveLimitFlag(ctx.args, {
2863
2878
  defaultValue: 100,
2864
- cap: 1000,
2879
+ cap: pageMode ? 100 : 1000,
2865
2880
  command: "crm query",
2866
2881
  });
2867
2882
  const assigneeScopeArgs = resolveAssigneeScopeFlags(ctx.args);
@@ -2871,15 +2886,17 @@ async function runQueryCommand(ctx: CrmCliContext): Promise<void> {
2871
2886
  // has any operator-shaped clause.
2872
2887
  const dsl = { filter, select, sort, limit: limit.effective };
2873
2888
  const hasDollarKey = filter ? containsDollarKey(filter) : false;
2889
+ const args = hasDollarKey
2890
+ ? { objectName, dslJson: JSON.stringify(dsl), ...assigneeScopeArgs }
2891
+ : { objectName, dsl, ...assigneeScopeArgs };
2874
2892
  out(
2875
2893
  ctx,
2876
- await callQuery(
2877
- ctx,
2878
- api.query.queryEntries,
2879
- hasDollarKey
2880
- ? { objectName, dslJson: JSON.stringify(dsl), ...assigneeScopeArgs }
2881
- : { objectName, dsl, ...assigneeScopeArgs },
2882
- ),
2894
+ pageMode
2895
+ ? await callQuery(ctx, api.query.scanEntries, {
2896
+ ...args,
2897
+ paginationOpts: { cursor: cursor ?? null, numItems: limit.effective },
2898
+ })
2899
+ : await callAction(ctx, api.query.queryEntries, args),
2883
2900
  );
2884
2901
  }
2885
2902
 
@@ -3640,7 +3657,7 @@ async function runSqlCommand(ctx: CrmCliContext): Promise<void> {
3640
3657
  : undefined;
3641
3658
  out(
3642
3659
  ctx,
3643
- await callQuery(ctx, api.query.queryEntries, {
3660
+ await callAction(ctx, api.query.queryEntries, {
3644
3661
  objectName,
3645
3662
  dsl: { select, sort, limit },
3646
3663
  }),
@@ -4607,6 +4624,8 @@ Cells (single-field updates):
4607
4624
 
4608
4625
  Query DSL:
4609
4626
  dench crm query <object> --where '{"Status":"New"}' --select Name,Email --sort -Score --limit 100
4627
+ dench crm query <object> --page --select Name,Email --limit 100 [--cursor '<continueCursor>'] --json
4628
+ Cursor pages use index order (omit --sort). Continue until isDone, including empty filtered pages.
4610
4629
  [--assigned-to me|unassigned|<userId|email> | --mine] [--assignee-field <Field>]
4611
4630
  --mine AND-s "assigned to me" onto --where without you having to
4612
4631
  know your own userId or the object's people field.
package/email.ts CHANGED
@@ -1410,7 +1410,7 @@ async function runMultichannel(ctx: EmailCliContext) {
1410
1410
  const sequenceId = requiredFlag(ctx.args, "--sequence");
1411
1411
  const [detail, analytics] = await Promise.all([
1412
1412
  callQuery(ctx, "functions/outreachSequences:getSequence", { sequenceId }),
1413
- callQuery(ctx, "functions/outreachSequences:getSequenceAnalytics", {
1413
+ callAction(ctx, "functions/outreachSequences:computeSequenceAnalytics", {
1414
1414
  sequenceId,
1415
1415
  }),
1416
1416
  ]);
package/leads.ts CHANGED
@@ -51,6 +51,8 @@ const api = {
51
51
  ),
52
52
  list: makeFunctionReference<"query">("functions/workspaceArtifacts:list"),
53
53
  get: makeFunctionReference<"query">("functions/workspaceArtifacts:get"),
54
+ reviews: makeFunctionReference<"query">("functions/prospectReviews:list"),
55
+ assess: makeFunctionReference<"mutation">("functions/prospectReviews:assess"),
54
56
  importArtifact: makeFunctionReference<"action">(
55
57
  "functions/workspaceArtifacts:importArtifact",
56
58
  ),
@@ -511,6 +513,10 @@ Usage:
511
513
  dench lists delete <id> [--json]
512
514
 
513
515
  Lists are saved searches from Find (people / companies / job postings).
516
+ People lists are review queues, not Leads. In Find, mark profiles ICP approved,
517
+ then explicitly confirm enrichment or import. Agents can suggest fit, not approve.
518
+ dench lists reviews <id> [--limit 100] [--cursor <cursor>] [--json]
519
+ dench lists assess <id> --row-json '<profile>' --fit likely_fit|unlikely_fit|unknown --reason '<evidence and unknowns>' [--json]
514
520
  Create one with \`dench leads|companies|jobs find --save-as "Name"\`.
515
521
  Delete removes the list, its exported CSV/JSONL files, and any linked watch.
516
522
  CRM lists (saved views on Leads/Companies/Job Postings) are managed with
@@ -563,6 +569,54 @@ export async function runListsCommand(opts: {
563
569
  return true;
564
570
  }
565
571
  args.shift();
572
+ if (verb === "reviews") {
573
+ const artifactId = shift(args, "list id");
574
+ const limit = Number(getFlag(args, "--limit") ?? 50);
575
+ const cursor = getFlag(args, "--cursor") ?? null;
576
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100)
577
+ throw new FindCliError("--limit must be between 1 and 100");
578
+ assertNoUnknownFlags(args, "lists reviews");
579
+ out(
580
+ ctx,
581
+ await callQuery(ctx, api.reviews, {
582
+ artifactId,
583
+ paginationOpts: { numItems: limit, cursor },
584
+ }),
585
+ );
586
+ return true;
587
+ }
588
+ if (verb === "assess") {
589
+ const artifactId = shift(args, "list id");
590
+ const rowJson = getFlag(args, "--row-json");
591
+ const fit = getFlag(args, "--fit");
592
+ const reason = getFlag(args, "--reason");
593
+ assertNoUnknownFlags(args, "lists assess");
594
+ if (
595
+ !rowJson ||
596
+ !reason ||
597
+ !fit ||
598
+ !["likely_fit", "unlikely_fit", "unknown"].includes(fit)
599
+ )
600
+ throw new FindCliError(
601
+ "Use --row-json, --fit likely_fit|unlikely_fit|unknown, and --reason. This records an AI suggestion, not human approval.",
602
+ );
603
+ let row: unknown;
604
+ try {
605
+ row = JSON.parse(rowJson);
606
+ } catch {
607
+ throw new FindCliError("--row-json must be valid JSON");
608
+ }
609
+ out(
610
+ ctx,
611
+ await ctx.convex.mutation(api.assess, {
612
+ artifactId,
613
+ row,
614
+ suggestion: { fit, reason },
615
+ ...(ctx.sessionToken ? { sessionToken: ctx.sessionToken } : {}),
616
+ } as never),
617
+ );
618
+ return true;
619
+ }
566
620
  if (verb === "show") {
567
621
  const artifactId = shift(args, "list id");
568
622
  assertNoUnknownFlags(args, "lists show");
@@ -100,6 +100,8 @@ export const APP_SDK_OPERATIONS: readonly AppSdkOperationInfo[] = [
100
100
  {"id":"lists.update","group":"lists","summary":"Update a saved list in place (title, filters, and/or replacement rows).","cli":"dench lists update","method":"PATCH","path":"/lists/{artifactId}","permission":"lists:write","pathParams":["artifactId"]},
101
101
  {"id":"lists.rename","group":"lists","summary":"Rename a saved search / list.","cli":"dench lists rename","method":"POST","path":"/lists/{artifactId}/rename","permission":"lists:write","pathParams":["artifactId"]},
102
102
  {"id":"lists.delete","group":"lists","summary":"Delete a saved search / list, its exported CSV/JSONL files, and any linked watch.","cli":"dench lists delete","method":"DELETE","path":"/lists/{artifactId}","permission":"lists:write","pathParams":["artifactId"]},
103
+ {"id":"lists.prospects.reviews","group":"lists","summary":"Read saved prospect review decisions and enrichment outcomes. Human approval is separate from AI suggestions.","cli":"dench lists reviews","method":"GET","path":"/lists/{artifactId}/reviews","permission":"lists:read","pathParams":["artifactId"]},
104
+ {"id":"lists.prospects.assess","group":"lists","summary":"Suggest ICP fit for one profile. Never changes a human review decision.","cli":"dench lists assess","method":"POST","path":"/lists/{artifactId}/assess","permission":"lists:write","pathParams":["artifactId"]},
103
105
  {"id":"memory.search","group":"memory","summary":"Search durable workspace memory.","cli":"dench memory search","method":"GET","path":"/memory/search","permission":"memory:read","pathParams":[]},
104
106
  {"id":"memory.save","group":"memory","summary":"Save a durable workspace memory fact.","cli":"dench memory save","method":"POST","path":"/memory","permission":"memory:write","pathParams":[]},
105
107
  {"id":"approval.request","group":"approvals","summary":"Request human approval.","cli":"dench approval request","method":"POST","path":"/approvals","permission":"approvals:write","pathParams":[]},
@@ -162,6 +164,9 @@ export const APP_SDK_OPERATIONS: readonly AppSdkOperationInfo[] = [
162
164
  {"id":"crm.comments.react","group":"crm","summary":"Toggle an emoji reaction on a comment.","cli":"dench crm comments react","method":"PUT","path":"/crm/comments/{commentId}/reactions/{emoji}","permission":"crm:write","pathParams":["commentId","emoji"]},
163
165
  {"id":"crm.watch.get","group":"crm","summary":"Whether you follow a CRM entry's activity.","cli":"dench crm watch status","method":"GET","path":"/crm/objects/{objectName}/entries/{entryId}/watch","permission":"crm:read","pathParams":["objectName","entryId"]},
164
166
  {"id":"crm.watch.set","group":"crm","summary":"Follow or unfollow a CRM entry's activity.","cli":"dench crm watch","method":"PUT","path":"/crm/objects/{objectName}/entries/{entryId}/watch","permission":"crm:write","pathParams":["objectName","entryId"]},
167
+ {"id":"crm.tasks.pageAssigned","group":"crm","summary":"Page assigned tasks in priority order (or completed tasks by recency).","cli":"dench crm tasks mine --page","method":"POST","path":"/crm/tasks/assigned/page","permission":"crm:read","pathParams":[]},
168
+ {"id":"crm.tasks.pageForEntry","group":"crm","summary":"Page all tasks linked to a record, including subtasks.","cli":"dench crm tasks list --page","method":"POST","path":"/crm/objects/{objectName}/entries/{entryId}/tasks/page","permission":"crm:read","pathParams":["objectName","entryId"]},
169
+ {"id":"crm.tasks.prepare","group":"crm","summary":"Start or resume preparation of exact task ordering and progress.","cli":"dench crm tasks prepare","method":"POST","path":"/crm/tasks/prepare","permission":"crm:write","pathParams":[]},
165
170
  {"id":"crm.tasks.mine","group":"crm","summary":"Your open tasks (plus ones completed today).","cli":"dench crm tasks mine","method":"GET","path":"/crm/tasks/mine","permission":"crm:read","pathParams":[]},
166
171
  {"id":"crm.tasks.forEntry","group":"crm","summary":"Tasks linked to a CRM entry.","cli":"dench crm tasks list","method":"GET","path":"/crm/objects/{objectName}/entries/{entryId}/tasks","permission":"crm:read","pathParams":["objectName","entryId"]},
167
172
  {"id":"crm.tasks.createForEntry","group":"crm","summary":"Create a task linked to a CRM entry.","cli":"dench crm tasks create","method":"POST","path":"/crm/objects/{objectName}/entries/{entryId}/tasks","permission":"crm:write","pathParams":["objectName","entryId"]},
@@ -191,6 +196,7 @@ export const APP_SDK_OPERATIONS: readonly AppSdkOperationInfo[] = [
191
196
  {"id":"crm.cells.setMany","group":"crm","summary":"Set many CRM cell values.","cli":"dench crm cells set-many","method":"POST","path":"/crm/cells/batch","permission":"crm:write","pathParams":[]},
192
197
  {"id":"crm.cells.append","group":"crm","summary":"Append to a CRM cell.","cli":"dench crm cells append","method":"POST","path":"/crm/objects/{objectName}/entries/{entryId}/fields/{fieldName}/append","permission":"crm:write","pathParams":["objectName","entryId","fieldName"]},
193
198
  {"id":"crm.query","group":"crm","summary":"Query CRM entries.","cli":"dench crm query","method":"POST","path":"/crm/query","permission":"crm:read","pathParams":[]},
199
+ {"id":"crm.queryPage","group":"crm","summary":"Scan CRM entries with a resumable cursor. Empty filtered pages can have more results.","cli":"dench crm query --page","method":"POST","path":"/crm/query/page","permission":"crm:read","pathParams":[]},
194
200
  {"id":"crm.sql","group":"crm","summary":"Run CRM SQL-compatible query.","cli":"dench crm sql","method":"POST","path":"/crm/sql","permission":"crm:read","pathParams":[]},
195
201
  {"id":"crm.aggregate","group":"crm","summary":"Aggregate CRM entries.","cli":"dench crm aggregate","method":"POST","path":"/crm/aggregate","permission":"crm:read","pathParams":[]},
196
202
  {"id":"crm.search","group":"crm","summary":"Search CRM entries.","cli":"dench crm search","method":"GET","path":"/crm/search","permission":"crm:read","pathParams":[]},
@@ -1393,6 +1393,9 @@ export const GROUP_SCOPE_OVERRIDES: Record<string, string> = {
1393
1393
  /** Operations that are reads despite a non-GET method. */
1394
1394
  export const READ_OPERATION_OVERRIDES = new Set<string>([
1395
1395
  "crm.query",
1396
+ "crm.queryPage",
1397
+ "crm.tasks.pageAssigned",
1398
+ "crm.tasks.pageForEntry",
1396
1399
  "crm.sql",
1397
1400
  "crm.aggregate",
1398
1401
  "crm.analytics.compute",
@@ -409,6 +409,48 @@ const rawApiOperations = [
409
409
  backend: convex("mutation", "functions/workspaceArtifacts:remove"),
410
410
  }),
411
411
 
412
+ op({
413
+ id: "lists.prospects.reviews",
414
+ group: "lists",
415
+ summary:
416
+ "Read saved prospect review decisions and enrichment outcomes. Human approval is separate from AI suggestions.",
417
+ cli: "dench lists reviews",
418
+ method: "GET",
419
+ path: "/lists/{artifactId}/reviews",
420
+ requestSchema: z.object({
421
+ artifactId: z.string().min(1),
422
+ limit: z.coerce.number().int().min(1).max(100).optional(),
423
+ cursor: z.string().optional(),
424
+ }),
425
+ responseSchema: anyResponse,
426
+ backend: {
427
+ ...convex("query", "functions/prospectReviews:list"),
428
+ transformArgs: (input) => ({
429
+ artifactId: input.artifactId,
430
+ paginationOpts: paginationOptsFrom(input, 50),
431
+ }),
432
+ },
433
+ }),
434
+ op({
435
+ id: "lists.prospects.assess",
436
+ group: "lists",
437
+ summary:
438
+ "Suggest ICP fit for one profile. Never changes a human review decision.",
439
+ cli: "dench lists assess",
440
+ method: "POST",
441
+ path: "/lists/{artifactId}/assess",
442
+ requestSchema: z.object({
443
+ artifactId: z.string().min(1),
444
+ row: z.record(z.string(), z.unknown()),
445
+ suggestion: z.object({
446
+ fit: z.enum(["likely_fit", "unlikely_fit", "unknown"]),
447
+ reason: z.string().min(1).max(2000),
448
+ }),
449
+ }),
450
+ responseSchema: anyResponse,
451
+ backend: convex("mutation", "functions/prospectReviews:assess"),
452
+ }),
453
+
412
454
  // Memory and approvals.
413
455
  op({
414
456
  id: "memory.search",
@@ -518,9 +560,14 @@ const rawApiOperations = [
518
560
  path: "/chat/search",
519
561
  requestSchema: anyObject,
520
562
  responseSchema: anyResponse,
521
- backend: convex("query", "functions/chat:searchPastChats", "bearer", {
522
- includeRunId: true,
523
- }),
563
+ backend: convex(
564
+ "action",
565
+ "functions/chat:searchPastChatsComplete",
566
+ "bearer",
567
+ {
568
+ includeRunId: true,
569
+ },
570
+ ),
524
571
  }),
525
572
  op({
526
573
  id: "chat.read",
@@ -734,7 +781,7 @@ const rawApiOperations = [
734
781
  path: "/crm/objects/{objectName}/views/{viewName}/entries",
735
782
  requestSchema: noBody,
736
783
  responseSchema: anyResponse,
737
- backend: convex("query", "functions/crm/objects:materializeView"),
784
+ backend: convex("action", "functions/crm/objects:completeView"),
738
785
  }),
739
786
  op({
740
787
  id: "crm.views.create",
@@ -1199,6 +1246,40 @@ const rawApiOperations = [
1199
1246
  // CRM tasks — conveniences over the protected `task` object. Tasks are
1200
1247
  // still ordinary entries (`crm.entries.*` works on them); these add the
1201
1248
  // "mine", "for this record", complete/reopen shortcuts the app uses.
1249
+ op({
1250
+ id: "crm.tasks.pageAssigned",
1251
+ group: "crm",
1252
+ summary:
1253
+ "Page assigned tasks in priority order (or completed tasks by recency).",
1254
+ cli: "dench crm tasks mine --page",
1255
+ method: "POST",
1256
+ path: "/crm/tasks/assigned/page",
1257
+ requestSchema: anyObject,
1258
+ responseSchema: anyResponse,
1259
+ backend: convex("query", "functions/crm/tasks:pageAssignedTasks"),
1260
+ }),
1261
+ op({
1262
+ id: "crm.tasks.pageForEntry",
1263
+ group: "crm",
1264
+ summary: "Page all tasks linked to a record, including subtasks.",
1265
+ cli: "dench crm tasks list --page",
1266
+ method: "POST",
1267
+ path: "/crm/objects/{objectName}/entries/{entryId}/tasks/page",
1268
+ requestSchema: anyObject,
1269
+ responseSchema: anyResponse,
1270
+ backend: convex("query", "functions/crm/tasks:pageEntryTasks"),
1271
+ }),
1272
+ op({
1273
+ id: "crm.tasks.prepare",
1274
+ group: "crm",
1275
+ summary: "Start or resume preparation of exact task ordering and progress.",
1276
+ cli: "dench crm tasks prepare",
1277
+ method: "POST",
1278
+ path: "/crm/tasks/prepare",
1279
+ requestSchema: noBody,
1280
+ responseSchema: anyResponse,
1281
+ backend: convex("mutation", "functions/crm/taskReadModels:ensureReady"),
1282
+ }),
1202
1283
  op({
1203
1284
  id: "crm.tasks.mine",
1204
1285
  group: "crm",
@@ -1317,7 +1398,7 @@ const rawApiOperations = [
1317
1398
  requestSchema: anyObject,
1318
1399
  responseSchema: anyResponse,
1319
1400
  backend: {
1320
- ...convex("mutation", "functions/crm/tasks:deleteTask"),
1401
+ ...convex("action", "functions/crm/tasks:deleteTaskComplete"),
1321
1402
  transformArgs: (input) => ({
1322
1403
  entryId: input.entryId,
1323
1404
  subtasks: input.subtasks === "keep" ? "keep" : "delete",
@@ -1555,7 +1636,19 @@ const rawApiOperations = [
1555
1636
  path: "/crm/query",
1556
1637
  requestSchema: anyObject,
1557
1638
  responseSchema: anyResponse,
1558
- backend: convex("query", "functions/crm/query:queryEntries"),
1639
+ backend: convex("action", "functions/crm/query:runQueryEntries"),
1640
+ }),
1641
+ op({
1642
+ id: "crm.queryPage",
1643
+ group: "crm",
1644
+ summary:
1645
+ "Scan CRM entries with a resumable cursor. Empty filtered pages can have more results.",
1646
+ cli: "dench crm query --page",
1647
+ method: "POST",
1648
+ path: "/crm/query/page",
1649
+ requestSchema: anyObject,
1650
+ responseSchema: anyResponse,
1651
+ backend: convex("query", "functions/crm/query:scanEntries"),
1559
1652
  }),
1560
1653
  op({
1561
1654
  id: "crm.sql",
@@ -1566,7 +1659,7 @@ const rawApiOperations = [
1566
1659
  path: "/crm/sql",
1567
1660
  requestSchema: anyObject,
1568
1661
  responseSchema: anyResponse,
1569
- backend: convex("query", "functions/crm/query:queryEntries"),
1662
+ backend: convex("action", "functions/crm/query:runQueryEntries"),
1570
1663
  }),
1571
1664
  op({
1572
1665
  id: "crm.aggregate",
@@ -3025,8 +3118,8 @@ const rawApiOperations = [
3025
3118
  requestSchema: anyObject,
3026
3119
  responseSchema: anyResponse,
3027
3120
  backend: convex(
3028
- "query",
3029
- "functions/outreachSequences:getSequenceAnalytics",
3121
+ "action",
3122
+ "functions/outreachSequences:computeSequenceAnalytics",
3030
3123
  ),
3031
3124
  }),
3032
3125
  op({
package/members.ts CHANGED
@@ -280,16 +280,37 @@ async function runMemberActivity(ctx: MembersCliContext): Promise<void> {
280
280
  async function runMemberTasks(ctx: MembersCliContext): Promise<void> {
281
281
  const target = shiftArg(ctx, "member id or email");
282
282
  const rawLimit = getFlag(ctx.args, "--limit");
283
+ const cursor = getFlag(ctx.args, "--cursor");
284
+ const paged = hasFlag(ctx.args, "--page") || cursor !== undefined;
285
+ const done = hasFlag(ctx.args, "--done");
283
286
  assertNoFlags(ctx, "dench members tasks");
284
287
  const userId = await resolveMemberId(ctx, target);
285
288
  const todayStart = new Date();
286
289
  todayStart.setHours(0, 0, 0, 0);
287
290
  out(
288
- await callQuery(ctx, api.profiles.tasks, {
289
- userId,
290
- todayStartMs: todayStart.getTime(),
291
- ...(rawLimit ? { limit: Number.parseInt(rawLimit, 10) } : {}),
292
- }),
291
+ await callQuery(
292
+ ctx,
293
+ paged || done
294
+ ? makeFunctionReference<"query">(
295
+ "functions/crm/tasks:pageAssignedTasks",
296
+ )
297
+ : api.profiles.tasks,
298
+ {
299
+ userId,
300
+ todayStartMs: todayStart.getTime(),
301
+ ...(paged || done
302
+ ? {
303
+ done,
304
+ paginationOpts: {
305
+ cursor: cursor ?? null,
306
+ numItems: Number.parseInt(rawLimit ?? "25", 10),
307
+ },
308
+ }
309
+ : rawLimit
310
+ ? { limit: Number.parseInt(rawLimit, 10) }
311
+ : {}),
312
+ },
313
+ ),
293
314
  );
294
315
  }
295
316
 
@@ -437,8 +458,8 @@ Subcommands:
437
458
  dench members activity <userId|email> [--limit N] [--kinds comments,changes]
438
459
  What they did across the CRM, newest first: their comments and the
439
460
  field changes they made (Dench / automations acting for them excluded).
440
- dench members tasks <userId|email> [--limit N]
441
- Open tasks assigned to them (plus ones completed today).
461
+ dench members tasks <userId|email> [--limit N] [--page] [--cursor TOKEN] [--done]
462
+ Assigned-task preview, or a cursor page for complete traversal.
442
463
  dench members presence [<userId|email>...]
443
464
  Live presence for some or all members.
444
465
  dench members me [--name "…"] [--tagline "…"] [--timezone <IANA>|--auto-timezone]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "3.0.3",
3
+ "version": "3.1.0-staging.292",
4
4
  "description": "Dench agent workspace CLI.",
5
5
  "type": "module",
6
6
  "bin": {