@dench.com/cli 3.2.0-staging.294 → 3.2.1

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
@@ -204,11 +204,20 @@ dench signin --host https://staging.dench.com
204
204
  ## Saved prospect lists
205
205
 
206
206
  People found with `dench leads find` stay in saved lists, not the CRM.
207
- Open the list in Find, select profiles, and choose **Enrich selected**.
208
- The lead-finding skill establishes `/workspace/ICP.md` on first use and
209
- reads it before later searches. There is no mandatory per-profile ICP decision.
210
- A teammate confirms the contact fields
211
- and credit spend; progress and results remain in the saved list.
207
+ For new prospect discovery, the lead-finding skill establishes a general
208
+ `/workspace/ICP.md` on first use and reads it before later prospect searches.
209
+ Campaign filters, dates, and counts stay with the search; the current request
210
+ overrides general preferences. Existing-list actions do not restart ICP setup.
211
+ Ordinary web, company, or hiring research does not require lead-finding or ICP
212
+ questions, reads, or scoring. There is no mandatory per-profile ICP decision.
213
+ In Find, click **Find** in a Work email, Phone, or Personal email cell to
214
+ request that field. The control discloses credit use; the lookup starts directly.
215
+ Different people run concurrently; wait for a person's current lookup before
216
+ starting another field. The cell shimmers with **Enriching**, then shows the
217
+ returned value or **Not found**. Header play targets selected profiles, or the
218
+ whole saved list when none are selected, with credit confirmation inline.
219
+ Bulk progress floats temporarily and disappears when finished, including misses.
220
+ Contact results persist in the list; other columns remain under View settings.
212
221
 
213
222
  ```bash
214
223
  dench leads find --titles "VP Sales" --save-as "Q3 targets" --json
@@ -225,6 +234,23 @@ unchanged. Optional `--filters-json` stores criteria/source evidence metadata.
225
234
  In chat, explicitly present the final list; research batches stay in activity
226
235
  details instead of becoming competing result sets.
227
236
 
237
+ Before presenting a prospect shortlist, the skill saves an ICP relevance score
238
+ (0–100) and short reason for each profile against that search's resolved criteria,
239
+ using the general brief as relevant guidance. These appear as
240
+ **ICP fit** and **Why this lead** in Find and in CSV exports. Scores are not
241
+ conversion probabilities or CRM statuses. To save assessments for canonical
242
+ rows returned by `lists rows`, create a JSON array of
243
+ `{row, suggestion: {fit, score, reason}}` (1–100 items per file):
244
+
245
+ ```bash
246
+ dench lists assess <artifactId> --assessments-file /tmp/icp-assessments.json --json
247
+ ```
248
+
249
+ `fit` is `likely_fit`, `unlikely_fit`, or `unknown`; `score` is a whole number
250
+ from 0 to 100. The CLI validates the file before writes and reports partial
251
+ failures; retrying updates existing assessments. Re-read rows to verify every
252
+ saved score and reason. Older unscored profiles remain **Not scored** until assessed.
253
+
228
254
  Directory and row reads return `page`, `continueCursor`, and `isDone`.
229
255
  Follow cursors even through empty filtered pages. Lists survive new chats;
230
256
  read fresh rows and contacts instead of an old transcript or CSV. Each row
package/app-sdk.d.ts CHANGED
@@ -123,6 +123,8 @@ export interface ApiRequests {
123
123
  row: Record<string, unknown>;
124
124
  suggestion: {
125
125
  fit: "likely_fit" | "unlikely_fit" | "unknown";
126
+ /** AI relevance to the saved ICP, not conversion probability. */
127
+ score?: number;
126
128
  reason: string;
127
129
  };
128
130
  };
package/leads.ts CHANGED
@@ -22,6 +22,7 @@ import {
22
22
  searchPeople,
23
23
  } from "./lib/enrichment-gateway";
24
24
  import { FIND_FILTER_OPTION_CATALOG } from "./lib/find-filter-options.generated";
25
+ import { parseProspectAssessments } from "./lib/prospect-assessment";
25
26
 
26
27
  class FindCliError extends Error {
27
28
  constructor(message: string) {
@@ -536,7 +537,10 @@ there is no mandatory per-profile ICP decision. Import only on explicit request,
536
537
  requested configured CRM status. Follow pagination until isDone, even across
537
538
  empty filtered pages. --rows uses original zero-based indices from lists rows.
538
539
  dench lists reviews <id> [--limit 100] [--cursor <cursor>] [--json]
539
- dench lists assess <id> --row-json '<profile>' --fit likely_fit|unlikely_fit|unknown --reason '<evidence and unknowns>' [--json]
540
+ dench lists assess <id> --row-json '<profile>' --fit likely_fit|unlikely_fit|unknown --score 0-100 --reason '<short ICP reason>' [--json]
541
+ dench lists assess <id> --assessments-file <assessments.json> [--json]
542
+ Assessments files contain 1–100 {row, suggestion: {fit, score, reason}} items.
543
+ Scores are AI relevance to the saved ICP, not conversion probabilities or CRM qualification.
540
544
  Create one with \`dench leads|companies|jobs find --save-as "Name"\`.
541
545
  Consolidate selected search profiles with \`dench lists save\`: --people-file
542
546
  is a JSON array of person rows, not a CSV or a whole tool response. It saves
@@ -679,9 +683,48 @@ export async function runListsCommand(opts: {
679
683
  if (verb === "assess") {
680
684
  const artifactId = shift(args, "list id");
681
685
  const rowJson = getFlag(args, "--row-json");
686
+ const assessmentsFile = getFlag(args, "--assessments-file");
682
687
  const fit = getFlag(args, "--fit");
688
+ const scoreRaw = getFlag(args, "--score");
683
689
  const reason = getFlag(args, "--reason");
684
690
  assertNoUnknownFlags(args, "lists assess");
691
+ if (assessmentsFile) {
692
+ if (
693
+ rowJson !== undefined ||
694
+ fit !== undefined ||
695
+ scoreRaw !== undefined ||
696
+ reason !== undefined
697
+ )
698
+ throw new FindCliError(
699
+ "Use --assessments-file alone, or --row-json with --fit, --score, and --reason.",
700
+ );
701
+ let input: unknown;
702
+ try {
703
+ input = JSON.parse(await readFile(assessmentsFile, "utf-8"));
704
+ } catch {
705
+ throw new FindCliError(
706
+ "--assessments-file must be a readable JSON array of assessments.",
707
+ );
708
+ }
709
+ const assessments = parseProspectAssessments(input);
710
+ let saved = 0;
711
+ try {
712
+ for (const assessment of assessments) {
713
+ await ctx.convex.mutation(api.assess, {
714
+ artifactId,
715
+ ...assessment,
716
+ ...(ctx.sessionToken ? { sessionToken: ctx.sessionToken } : {}),
717
+ } as never);
718
+ saved++;
719
+ }
720
+ } catch (error) {
721
+ throw new FindCliError(
722
+ `Saved ${saved} of ${assessments.length} assessments. Retry the file to continue; assessments are replaced, not duplicated. ${error instanceof Error ? error.message : "Assessment failed."}`,
723
+ );
724
+ }
725
+ out(ctx, { assessed: saved });
726
+ return true;
727
+ }
685
728
  if (
686
729
  !rowJson ||
687
730
  !reason ||
@@ -701,8 +744,18 @@ export async function runListsCommand(opts: {
701
744
  ctx,
702
745
  await ctx.convex.mutation(api.assess, {
703
746
  artifactId,
704
- row,
705
- suggestion: { fit, reason },
747
+ ...parseProspectAssessments([
748
+ {
749
+ row,
750
+ suggestion: {
751
+ fit,
752
+ reason,
753
+ ...(scoreRaw !== undefined
754
+ ? { score: scoreRaw.trim() ? Number(scoreRaw) : NaN }
755
+ : {}),
756
+ },
757
+ },
758
+ ])[0],
706
759
  ...(ctx.sessionToken ? { sessionToken: ctx.sessionToken } : {}),
707
760
  } as never),
708
761
  );
@@ -857,9 +910,7 @@ export async function runLeadsCommand(opts: {
857
910
  jobFunctions: flags.functions,
858
911
  subFunctions: flags.subFunctions,
859
912
  industries: flags.industries,
860
- organizationDomains: flags.companyDomain
861
- ? [flags.companyDomain]
862
- : undefined,
913
+ companyDomain: flags.companyDomain,
863
914
  companyDomains: mergeUnique(flags.companyDomains, companyList?.domains),
864
915
  companyNames: mergeUnique(flags.companyNames, companyList?.names),
865
916
  pastCompanyNames: flags.pastCompanyNames,
@@ -510,6 +510,15 @@ const rawApiOperations = [
510
510
  row: z.record(z.string(), z.unknown()),
511
511
  suggestion: z.object({
512
512
  fit: z.enum(["likely_fit", "unlikely_fit", "unknown"]),
513
+ score: z
514
+ .number()
515
+ .int()
516
+ .min(0)
517
+ .max(100)
518
+ .optional()
519
+ .describe(
520
+ "AI relevance to the saved ICP, not conversion probability.",
521
+ ),
513
522
  reason: z.string().min(1).max(2000),
514
523
  }),
515
524
  }),
@@ -54,6 +54,15 @@ export type SearchFilterItem =
54
54
  export type SearchRangeFilter = { min?: number; max?: number };
55
55
 
56
56
  export type SearchPeopleBody = {
57
+ /** Canonical gateway fields. locations is the PERSON; companyHeadquarters is the employer. */
58
+ linkedinUrl?: string;
59
+ fullName?: string;
60
+ firstName?: string;
61
+ lastName?: string;
62
+ companyDomain?: string;
63
+ companyName?: string;
64
+ exactMatch?: boolean;
65
+ preferCache?: boolean;
57
66
  personTitles?: string[];
58
67
  personLocations?: string[];
59
68
  personSeniorities?: string[];
@@ -97,6 +106,8 @@ export type SearchPeopleBody = {
97
106
  };
98
107
 
99
108
  export type SearchCompaniesBody = {
109
+ exactMatch?: boolean;
110
+ preferCache?: boolean;
100
111
  domain?: string;
101
112
  name?: string;
102
113
  linkedinUrl?: string;
@@ -1270,13 +1281,25 @@ export async function aviatoEnrichCompany(
1270
1281
  // searchPeople — calls POST /v1/enrichment/people/search (synchronous)
1271
1282
  // ---------------------------------------------------------------------------
1272
1283
 
1273
- export async function searchPeople(
1284
+ export function buildPeopleSearchRequest(
1274
1285
  body: SearchPeopleBody,
1275
- options: EnrichmentGatewayOptions = {},
1276
- ): Promise<Record<string, unknown>> {
1286
+ ): Record<string, unknown> {
1277
1287
  // Request body matches gateway `peopleSearchRequestSchema`:
1278
1288
  // `locations`, `headcountRanges`, `titles`, `companyDomain`, etc.
1279
- const payload: Record<string, unknown> = { preferCache: true };
1289
+ const payload: Record<string, unknown> = {
1290
+ preferCache: body.preferCache ?? true,
1291
+ };
1292
+ for (const key of [
1293
+ "linkedinUrl",
1294
+ "fullName",
1295
+ "firstName",
1296
+ "lastName",
1297
+ "companyDomain",
1298
+ "companyName",
1299
+ "exactMatch",
1300
+ ] as const) {
1301
+ if (body[key] !== undefined) payload[key] = body[key];
1302
+ }
1280
1303
 
1281
1304
  const mergeItems = (
1282
1305
  legacy: string[] | undefined,
@@ -1291,14 +1314,17 @@ export async function searchPeople(
1291
1314
  const titles = mergeItems(body.personTitles, body.titles);
1292
1315
  if (titles.length > 0) payload.titles = titles;
1293
1316
 
1294
- const locations = mergeItems(
1295
- [...(body.personLocations ?? []), ...(body.organizationLocations ?? [])],
1296
- body.locations,
1297
- );
1317
+ const locations = mergeItems(body.personLocations, body.locations);
1298
1318
  if (locations.length > 0) payload.locations = locations;
1299
1319
 
1300
- if (body.organizationDomains && body.organizationDomains.length > 0) {
1301
- payload.companyDomain = body.organizationDomains[0];
1320
+ const headquarters = mergeItems(
1321
+ body.organizationLocations,
1322
+ body.companyHeadquarters,
1323
+ );
1324
+ if (headquarters.length) payload.companyHeadquarters = headquarters;
1325
+ const domains = mergeItems(body.organizationDomains, body.companyDomains);
1326
+ if (domains.length) {
1327
+ payload.companyDomains = domains;
1302
1328
  }
1303
1329
 
1304
1330
  const headcountRanges = mergeItems(
@@ -1321,8 +1347,6 @@ export async function searchPeople(
1321
1347
  "subFunctions",
1322
1348
  "companyNames",
1323
1349
  "pastCompanyNames",
1324
- "companyDomains",
1325
- "companyHeadquarters",
1326
1350
  "companyTypes",
1327
1351
  "universities",
1328
1352
  "skills",
@@ -1350,12 +1374,22 @@ export async function searchPeople(
1350
1374
  if (body.limit !== undefined) payload.limit = body.limit;
1351
1375
  else if (body.perPage !== undefined) payload.limit = body.perPage;
1352
1376
  if (body.offset !== undefined) payload.offset = body.offset;
1377
+ else if (body.page !== undefined && body.page > 1) {
1378
+ payload.offset = (body.page - 1) * (body.limit ?? body.perPage ?? 10);
1379
+ }
1353
1380
  if (body.searchAfter !== undefined) payload.searchAfter = body.searchAfter;
1354
1381
  if (body.pageToken) payload.pageToken = body.pageToken;
1355
1382
 
1383
+ return payload;
1384
+ }
1385
+
1386
+ export async function searchPeople(
1387
+ body: SearchPeopleBody,
1388
+ options: EnrichmentGatewayOptions = {},
1389
+ ): Promise<Record<string, unknown>> {
1356
1390
  return callGatewayJson("/v1/enrichment/people/search", {
1357
1391
  method: "POST",
1358
- body: payload,
1392
+ body: buildPeopleSearchRequest(body),
1359
1393
  options,
1360
1394
  });
1361
1395
  }
@@ -1364,7 +1398,10 @@ export async function searchCompanies(
1364
1398
  body: SearchCompaniesBody,
1365
1399
  options: EnrichmentGatewayOptions = {},
1366
1400
  ): Promise<Record<string, unknown>> {
1367
- const payload: Record<string, unknown> = { preferCache: true };
1401
+ const payload: Record<string, unknown> = {
1402
+ preferCache: body.preferCache ?? true,
1403
+ };
1404
+ if (body.exactMatch !== undefined) payload.exactMatch = body.exactMatch;
1368
1405
  if (body.domain) payload.domain = body.domain;
1369
1406
  if (body.name) payload.name = body.name;
1370
1407
  if (body.linkedinUrl) payload.linkedinUrl = body.linkedinUrl;
@@ -0,0 +1,50 @@
1
+ export type ProspectAssessment = {
2
+ row: Record<string, unknown>;
3
+ suggestion: {
4
+ fit: "likely_fit" | "unlikely_fit" | "unknown";
5
+ score?: number;
6
+ reason: string;
7
+ };
8
+ };
9
+
10
+ /** Validate the entire file before the first write, including optional legacy scores. */
11
+ export function parseProspectAssessments(input: unknown): ProspectAssessment[] {
12
+ if (!Array.isArray(input) || !input.length || input.length > 100)
13
+ throw new Error("Provide 1–100 assessments containing row and suggestion.");
14
+ return input.map((entry) => {
15
+ const row = entry?.row;
16
+ const suggestion = entry?.suggestion;
17
+ if (
18
+ !row ||
19
+ typeof row !== "object" ||
20
+ Array.isArray(row) ||
21
+ !suggestion ||
22
+ !["likely_fit", "unlikely_fit", "unknown"].includes(suggestion.fit) ||
23
+ typeof suggestion.reason !== "string" ||
24
+ !suggestion.reason.trim() ||
25
+ suggestion.reason.length > 2000
26
+ )
27
+ throw new Error(
28
+ "Each assessment needs a profile row, fit (likely_fit|unlikely_fit|unknown), and a reason of 1–2000 characters.",
29
+ );
30
+ const score = suggestion.score;
31
+ if (
32
+ score !== undefined &&
33
+ (typeof score !== "number" ||
34
+ !Number.isInteger(score) ||
35
+ score < 0 ||
36
+ score > 100)
37
+ )
38
+ throw new Error(
39
+ "ICP relevance score must be a whole number from 0 to 100.",
40
+ );
41
+ return {
42
+ row,
43
+ suggestion: {
44
+ fit: suggestion.fit,
45
+ reason: suggestion.reason.trim(),
46
+ ...(score !== undefined ? { score } : {}),
47
+ },
48
+ };
49
+ });
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "3.2.0-staging.294",
3
+ "version": "3.2.1",
4
4
  "description": "Dench agent workspace CLI.",
5
5
  "type": "module",
6
6
  "bin": {