@dench.com/cli 3.12.16 → 3.12.17-staging.1330

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/ads.ts CHANGED
@@ -203,7 +203,7 @@ const DEMO_ADS: Ad[] = [
203
203
  },
204
204
  {
205
205
  id: "demo-dench",
206
- label: "Dench — your AI agent workspace",
206
+ label: "Dench — your AI Revenue Engine",
207
207
  url: "https://dench.com",
208
208
  icon: "◆",
209
209
  iconUrl: "https://dench.com/logos/favicon-32x32.png",
package/app-sdk.d.ts CHANGED
@@ -474,6 +474,7 @@ export interface ApiRequests {
474
474
  "campaigns.builder.save": {
475
475
  /** Your stable id for this request, 8-64 characters. Retrying with the same id returns the same draft instead of creating another. */
476
476
  clientRequestId: string;
477
+ /** Each list holds at most 12 values; pick the most important ones. */
477
478
  targeting: {
478
479
  titles: string[];
479
480
  locations: string[];
@@ -541,7 +542,7 @@ export interface ApiRequests {
541
542
  "campaigns.builder.build": {
542
543
  draftId: string;
543
544
  };
544
- /** Create a campaign from a reviewed signal draft. Does not launch the campaign. — `dench campaign builder create` — POST /api/v1/campaigns/builder/drafts/{draftId}/create */
545
+ /** Create a campaign from a built signal draft (status ready; a changed save reopens it until built again). Does not launch the campaign. — `dench campaign builder create` — POST /api/v1/campaigns/builder/drafts/{draftId}/create */
545
546
  "campaigns.builder.create": {
546
547
  draftId: string;
547
548
  name?: string;
@@ -2315,6 +2316,11 @@ export interface ApiRequests {
2315
2316
  contacts: Record<string, unknown>[];
2316
2317
  [key: string]: unknown;
2317
2318
  };
2319
+ /** Read a queued contact lookup by the enrichmentId it returned. Free, and never submits the lookup again: poll this, not person/contact, until status is succeeded or failed. — `dench crm enrich cell` — GET /api/v1/enrichment/jobs/{enrichmentId} */
2320
+ "enrichment.jobs.get": {
2321
+ /** The enrichmentId a queued person/contact call returned. */
2322
+ enrichmentId: string;
2323
+ };
2318
2324
  /** Look up up to 100 people or company profiles without buying emails or phones. Pass kind (people|companies) and lookups; results preserve inputIndex. People require linkedinUrl or email; companies require domain or linkedinUrl. — `dench crm enrich profiles` — POST /api/v1/enrichment/profiles/bulk */
2319
2325
  "enrichment.profiles.bulk": {
2320
2326
  kind: "people" | "companies";
@@ -6288,6 +6294,7 @@ export interface ApiResponses {
6288
6294
  [key: string]: unknown;
6289
6295
  };
6290
6296
  "enrichment.person.contact": Record<string, unknown>;
6297
+ "enrichment.jobs.get": unknown;
6291
6298
  "enrichment.profiles.bulk": {
6292
6299
  kind: "people" | "companies";
6293
6300
  records: Array<{
@@ -9047,7 +9054,7 @@ export type DenchApiTree = {
9047
9054
  autofill(args: Req<"campaigns.builder.autofill">): Promise<Res<"campaigns.builder.autofill">>;
9048
9055
  /** Start the same billable signal/audience/message build used by the UI; poll the draft for progress. (`dench campaign builder build`) */
9049
9056
  build(args: Req<"campaigns.builder.build">): Promise<Res<"campaigns.builder.build">>;
9050
- /** Create a campaign from a reviewed signal draft. Does not launch the campaign. (`dench campaign builder create`) */
9057
+ /** Create a campaign from a built signal draft (status ready; a changed save reopens it until built again). Does not launch the campaign. (`dench campaign builder create`) */
9051
9058
  create(args: Req<"campaigns.builder.create">): Promise<Res<"campaigns.builder.create">>;
9052
9059
  /** Discard a saved draft that has not become a campaign. (`dench campaign builder discard`) */
9053
9060
  discard(args: Req<"campaigns.builder.discard">): Promise<Res<"campaigns.builder.discard">>;
@@ -9738,6 +9745,8 @@ export type DenchApiTree = {
9738
9745
  related(args: Req<"enrichment.company.related">): Promise<Res<"enrichment.company.related">>;
9739
9746
  };
9740
9747
  jobs: {
9748
+ /** Read a queued contact lookup by the enrichmentId it returned. Free, and never submits the lookup again: poll this, not person/contact, until status is succeeded or failed. (`dench crm enrich cell`) */
9749
+ get(args: Req<"enrichment.jobs.get">): Promise<Res<"enrichment.jobs.get">>;
9741
9750
  /** Search job postings through Dench find. `companyDomains` takes up to 1000 domains (chunked automatically); `dench jobs find --company-list <id|view>` resolves a saved company list into it. (`dench jobs find`) */
9742
9751
  search(args: Req<"enrichment.jobs.search">): Promise<Res<"enrichment.jobs.search">>;
9743
9752
  };
@@ -2684,6 +2684,55 @@ const campaignTargeting = z.object({
2684
2684
  * dropped, since dropping it would quietly widen the audience.
2685
2685
  */
2686
2686
  const campaignTargetingInput = campaignTargeting.strict();
2687
+ /**
2688
+ * The most values a builder draft keeps per targeting list: Convex's
2689
+ * `ONBOARDING_LIST_MAX` (convex/lib/onboardingCampaign/validators.ts), which
2690
+ * this build cannot import; a test keeps the two equal.
2691
+ */
2692
+ export const CAMPAIGN_BUILDER_LIST_MAX = 12;
2693
+ const CAMPAIGN_BUILDER_LIST_LABELS = {
2694
+ titles: "Job roles",
2695
+ locations: "Locations",
2696
+ companySizes: "Company size",
2697
+ industries: "Industries",
2698
+ excludes: "Exclusions",
2699
+ companies: "Companies",
2700
+ companyTypes: "Company type",
2701
+ } as const;
2702
+ /**
2703
+ * Why a builder save's targeting would be refused, mirroring
2704
+ * `targetingProblem` in convex/lib/outreachSignalCampaign/draft.ts: a list
2705
+ * with more than `CAMPAIGN_BUILDER_LIST_MAX` distinct values is refused
2706
+ * there rather than trimmed. Checked in the request schema so API, MCP and
2707
+ * CLI callers are refused with the same words before the save reaches
2708
+ * Convex (#2989). A lookalike save is not checked: its targeting comes from
2709
+ * the lookalike.
2710
+ */
2711
+ function refineBuilderTargeting(
2712
+ input: {
2713
+ targeting: Record<string, string[] | undefined>;
2714
+ lookalike?: unknown;
2715
+ },
2716
+ ctx: z.RefinementCtx,
2717
+ ) {
2718
+ if (input.lookalike) return;
2719
+ for (const [key, label] of Object.entries(CAMPAIGN_BUILDER_LIST_LABELS)) {
2720
+ const distinct = new Set(
2721
+ (input.targeting[key] ?? [])
2722
+ .map((value) => value.trim().toLowerCase())
2723
+ .filter((value) => value.length > 0),
2724
+ );
2725
+ if (distinct.size > CAMPAIGN_BUILDER_LIST_MAX)
2726
+ ctx.addIssue({
2727
+ code: "custom",
2728
+ path: ["targeting", key],
2729
+ message: `${label} can have up to ${CAMPAIGN_BUILDER_LIST_MAX}.`,
2730
+ });
2731
+ }
2732
+ }
2733
+ const campaignBuilderTargetingInput = campaignTargetingInput.describe(
2734
+ `Each list holds at most ${CAMPAIGN_BUILDER_LIST_MAX} values; pick the most important ones.`,
2735
+ );
2687
2736
  const campaignSignalTerms = z
2688
2737
  .object({
2689
2738
  post_engagement: z
@@ -3470,7 +3519,7 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
3470
3519
  "campaigns.builder.save": z
3471
3520
  .object({
3472
3521
  clientRequestId: campaignClientRequestId,
3473
- targeting: campaignTargetingInput,
3522
+ targeting: campaignBuilderTargetingInput,
3474
3523
  signals: z.array(campaignSignal),
3475
3524
  signalTerms: campaignSignalTerms.optional(),
3476
3525
  findMoreMatching: z
@@ -3486,7 +3535,8 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
3486
3535
  'For source lookalike: the edited result of builder lookalike, with signals ["lookalike"].',
3487
3536
  ),
3488
3537
  })
3489
- .strict(),
3538
+ .strict()
3539
+ .superRefine(refineBuilderTargeting),
3490
3540
  "campaigns.builder.get": z.object({ draftId: z.string() }).strict(),
3491
3541
  "campaigns.builder.leads": z.object({ draftId: z.string() }).strict(),
3492
3542
  "campaigns.builder.build": z.object({ draftId: z.string() }).strict(),
@@ -9018,7 +9068,7 @@ export const responseExamples: Record<string, unknown> = {
9018
9068
  ],
9019
9069
  },
9020
9070
  "search.answer": {
9021
- answer: "Dench is an AI agent workspace with a built-in CRM.",
9071
+ answer: "Dench is an AI Revenue Engine and CRM.",
9022
9072
  citations: [
9023
9073
  {
9024
9074
  url: "https://www.dench.com",
@@ -114,7 +114,7 @@ export const APP_SDK_OPERATIONS: readonly AppSdkOperationInfo[] = [
114
114
  {"id":"campaigns.builder.get","group":"campaigns","summary":"Read signal build progress, preview people, messages and errors.","cli":"dench campaign builder get","method":"GET","path":"/campaigns/builder/drafts/{draftId}","permission":"campaigns:read","pathParams":["draftId"]},
115
115
  {"id":"campaigns.builder.leads","group":"campaigns","summary":"Read every lead a signal build kept (not just the five previewed): person, company, LinkedIn URL and the signal's evidence.","cli":"dench campaign builder leads","method":"GET","path":"/campaigns/builder/drafts/{draftId}/leads","permission":"campaigns:read","pathParams":["draftId"]},
116
116
  {"id":"campaigns.builder.build","group":"campaigns","summary":"Start the same billable signal/audience/message build used by the UI; poll the draft for progress.","cli":"dench campaign builder build","method":"POST","path":"/campaigns/builder/drafts/{draftId}/build","permission":"campaigns:write","pathParams":["draftId"]},
117
- {"id":"campaigns.builder.create","group":"campaigns","summary":"Create a campaign from a reviewed signal draft. Does not launch the campaign.","cli":"dench campaign builder create","method":"POST","path":"/campaigns/builder/drafts/{draftId}/create","permission":"campaigns:write","pathParams":["draftId"]},
117
+ {"id":"campaigns.builder.create","group":"campaigns","summary":"Create a campaign from a built signal draft (status ready; a changed save reopens it until built again). Does not launch the campaign.","cli":"dench campaign builder create","method":"POST","path":"/campaigns/builder/drafts/{draftId}/create","permission":"campaigns:write","pathParams":["draftId"]},
118
118
  {"id":"campaigns.builder.opener","group":"campaigns","summary":"Edit or reset one preview person's opening line before creating the campaign.","cli":"dench campaign builder opener","method":"PUT","path":"/campaigns/builder/drafts/{draftId}/people/{leadId}/opener","permission":"campaigns:write","pathParams":["draftId","leadId"]},
119
119
  {"id":"campaigns.builder.drafts","group":"campaigns","summary":"List saved, unfinished campaign drafts that can be resumed.","cli":"dench campaign builder drafts","method":"GET","path":"/campaigns/builder/drafts","permission":"campaigns:read","pathParams":[]},
120
120
  {"id":"campaigns.builder.resume","group":"campaigns","summary":"Read a saved draft's setup (source, name, targeting, signals, terms, lookalike) to resume it.","cli":"dench campaign builder resume","method":"GET","path":"/campaigns/builder/drafts/{draftId}/setup","permission":"campaigns:read","pathParams":["draftId"]},
@@ -313,6 +313,7 @@ export const APP_SDK_OPERATIONS: readonly AppSdkOperationInfo[] = [
313
313
  {"id":"enrichment.person","group":"crm","summary":"Look up one person profile.","cli":"dench crm enrich cell","method":"POST","path":"/enrichment/person","permission":"crm:write","pathParams":[]},
314
314
  {"id":"enrichment.company","group":"crm","summary":"Look up one company profile.","cli":"dench crm enrich cell","method":"POST","path":"/enrichment/company","permission":"crm:write","pathParams":[]},
315
315
  {"id":"enrichment.person.contact","group":"crm","summary":"Look up verified emails and phones for people.","cli":"dench crm enrich cell","method":"POST","path":"/enrichment/person/contact","permission":"crm:write","pathParams":[]},
316
+ {"id":"enrichment.jobs.get","group":"crm","summary":"Read a queued contact lookup by the enrichmentId it returned. Free, and never submits the lookup again: poll this, not person/contact, until status is succeeded or failed.","cli":"dench crm enrich cell","method":"GET","path":"/enrichment/jobs/{enrichmentId}","permission":"crm:read","pathParams":["enrichmentId"]},
316
317
  {"id":"enrichment.profiles.bulk","group":"crm","summary":"Look up up to 100 people or company profiles without buying emails or phones. Pass kind (people|companies) and lookups; results preserve inputIndex. People require linkedinUrl or email; companies require domain or linkedinUrl.","cli":"dench crm enrich profiles","method":"POST","path":"/enrichment/profiles/bulk","permission":"crm:write","pathParams":[]},
317
318
  {"id":"enrichment.company.related","group":"crm","summary":"Read company employees, founders, funding, investors, acquisitions, or investments. Pass domain or linkedinUrl, kind, limit (1–100), and optional pageToken. Does not import CRM records or buy contacts.","cli":"dench companies related","method":"POST","path":"/enrichment/company/related","permission":"crm:read","pathParams":[]},
318
319
  {"id":"enrichment.search.preview","group":"crm","summary":"Preview how many records a find would return.","cli":"dench leads find --limit 1","method":"POST","path":"/enrichment/search/preview","permission":"crm:read","pathParams":[]},
@@ -1708,6 +1708,18 @@ function sharedSenderNotes(rows: SenderRow[], channel: string): string[] {
1708
1708
  );
1709
1709
  }
1710
1710
 
1711
+ /**
1712
+ * What to run after saving a draft's outreach. Create refuses a draft
1713
+ * nobody was found for yet, or one a changed save reopened (#2989: agents
1714
+ * followed a bare "create" here and were refused).
1715
+ */
1716
+ export function nextBuilderStep(status: string, draftId: string): string {
1717
+ if (status === "editing" || status === "failed")
1718
+ return `dench campaign builder build ${draftId}`;
1719
+ if (status === "building") return `dench campaign builder get ${draftId}`;
1720
+ return `dench campaign builder create ${draftId}`;
1721
+ }
1722
+
1711
1723
  function failedBuildMessage(draft: RunDraft, draftId: string): string {
1712
1724
  if (draft.errorCode === "out_of_credits")
1713
1725
  return `Finding people stopped: the workspace is out of credits. Add credits (dench billing topup --amount 10 prints a link), then run dench campaign builder run --draft ${draftId} again.`;
@@ -2126,7 +2138,7 @@ export async function runCampaignAgentCommand(
2126
2138
  steps: draft.workflowSteps ?? draft.draftSteps ?? draft.steps ?? [],
2127
2139
  sending: draft.sending ?? null,
2128
2140
  approvalMode: draft.approvalMode ?? "manual",
2129
- next: `dench campaign builder create ${input.draftId}`,
2141
+ next: nextBuilderStep(draft.status, String(input.draftId)),
2130
2142
  });
2131
2143
  }
2132
2144
  if (verb === "estimate") {
@@ -570,7 +570,7 @@ const rawApiOperations = [
570
570
  id: "campaigns.builder.create",
571
571
  group: "campaigns",
572
572
  summary:
573
- "Create a campaign from a reviewed signal draft. Does not launch the campaign.",
573
+ "Create a campaign from a built signal draft (status ready; a changed save reopens it until built again). Does not launch the campaign.",
574
574
  cli: "dench campaign builder create",
575
575
  method: "POST",
576
576
  path: "/campaigns/builder/drafts/{draftId}/create",
@@ -3350,6 +3350,27 @@ const rawApiOperations = [
3350
3350
  responseSchema: anyResponse,
3351
3351
  backend: gateway("POST", "/enrichment/person/contact"),
3352
3352
  }),
3353
+ op({
3354
+ id: "enrichment.jobs.get",
3355
+ group: "crm",
3356
+ summary:
3357
+ "Read a queued contact lookup by the enrichmentId it returned. Free, and never submits the lookup again: poll this, not person/contact, until status is succeeded or failed.",
3358
+ cli: "dench crm enrich cell",
3359
+ method: "GET",
3360
+ path: "/enrichment/jobs/{enrichmentId}",
3361
+ requestSchema: z
3362
+ .object({
3363
+ enrichmentId: z
3364
+ .string()
3365
+ .trim()
3366
+ .min(1)
3367
+ .max(200)
3368
+ .describe("The enrichmentId a queued person/contact call returned."),
3369
+ })
3370
+ .strict(),
3371
+ responseSchema: anyResponse,
3372
+ backend: gateway("GET", "/enrichment/jobs/{enrichmentId}"),
3373
+ }),
3353
3374
  op({
3354
3375
  id: "enrichment.profiles.bulk",
3355
3376
  group: "crm",