@elevasis/sdk 1.18.0 → 1.20.0

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.
Files changed (58) hide show
  1. package/dist/cli.cjs +1915 -70
  2. package/dist/index.d.ts +825 -16
  3. package/dist/index.js +714 -63
  4. package/dist/node/index.d.ts +1 -0
  5. package/dist/node/index.js +213 -2
  6. package/dist/test-utils/index.d.ts +479 -14
  7. package/dist/test-utils/index.js +660 -54
  8. package/dist/worker/index.js +516 -54
  9. package/package.json +4 -4
  10. package/reference/_navigation.md +2 -1
  11. package/reference/_reference-manifest.json +14 -0
  12. package/reference/claude-config/registries/graph-skills.json +4 -0
  13. package/reference/claude-config/rules/agent-start-here.md +5 -5
  14. package/reference/claude-config/rules/deployment.md +4 -3
  15. package/reference/claude-config/rules/frontend.md +2 -2
  16. package/reference/claude-config/rules/operations.md +17 -13
  17. package/reference/claude-config/rules/organization-model.md +7 -5
  18. package/reference/claude-config/rules/organization-os.md +13 -11
  19. package/reference/claude-config/rules/ui.md +3 -3
  20. package/reference/claude-config/rules/vibe.md +4 -4
  21. package/reference/claude-config/skills/explore/SKILL.md +4 -4
  22. package/reference/claude-config/skills/knowledge/SKILL.md +17 -16
  23. package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +7 -7
  24. package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +13 -13
  25. package/reference/claude-config/skills/knowledge/operations/customers.md +1 -1
  26. package/reference/claude-config/skills/knowledge/operations/goals.md +1 -1
  27. package/reference/claude-config/skills/knowledge/operations/identity.md +1 -1
  28. package/reference/claude-config/skills/knowledge/operations/offerings.md +1 -1
  29. package/reference/claude-config/skills/knowledge/operations/roles.md +1 -1
  30. package/reference/claude-config/skills/knowledge/operations/techStack.md +19 -91
  31. package/reference/claude-config/skills/project/SKILL.md +73 -13
  32. package/reference/claude-config/skills/save/SKILL.md +5 -5
  33. package/reference/claude-config/skills/tutorial/technical.md +11 -14
  34. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +60 -0
  35. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +34 -0
  36. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +38 -0
  37. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +32 -0
  38. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +33 -0
  39. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +69 -0
  40. package/reference/examples/organization-model.ts +17 -5
  41. package/reference/framework/index.mdx +1 -1
  42. package/reference/framework/project-structure.mdx +10 -8
  43. package/reference/packages/core/src/business/README.md +2 -2
  44. package/reference/packages/core/src/organization-model/README.md +10 -3
  45. package/reference/resources/index.mdx +27 -17
  46. package/reference/scaffold/core/organization-model.mdx +33 -14
  47. package/reference/scaffold/operations/workflow-recipes.md +35 -29
  48. package/reference/scaffold/recipes/add-a-feature.md +18 -3
  49. package/reference/scaffold/recipes/add-a-resource.md +50 -10
  50. package/reference/scaffold/recipes/customize-crm-actions.md +12 -6
  51. package/reference/scaffold/recipes/customize-organization-model.md +18 -3
  52. package/reference/scaffold/recipes/extend-crm.md +17 -19
  53. package/reference/scaffold/recipes/extend-lead-gen.md +31 -31
  54. package/reference/scaffold/recipes/index.md +1 -1
  55. package/reference/scaffold/reference/contracts.md +512 -307
  56. package/reference/scaffold/reference/feature-registry.md +1 -1
  57. package/reference/scaffold/reference/glossary.md +8 -3
  58. package/reference/scaffold/ui/recipes.md +21 -6
package/dist/index.js CHANGED
@@ -78,6 +78,7 @@ var ORGANIZATION_MODEL_ICON_TOKENS = [
78
78
  "knowledge.reference",
79
79
  "feature.dashboard",
80
80
  "feature.calendar",
81
+ "feature.business",
81
82
  "feature.sales",
82
83
  "feature.crm",
83
84
  "feature.finance",
@@ -198,13 +199,64 @@ z.object({
198
199
  pipelines: z.array(SalesPipelineSchema).min(1)
199
200
  });
200
201
  var CRM_DISCOVERY_REPLIED_STATE = {
201
- stateKey: "discovery_replied"};
202
+ stateKey: "discovery_replied",
203
+ label: "Discovery Replied"
204
+ };
202
205
  var CRM_DISCOVERY_LINK_SENT_STATE = {
203
- stateKey: "discovery_link_sent"};
206
+ stateKey: "discovery_link_sent",
207
+ label: "Discovery Link Sent"
208
+ };
204
209
  var CRM_DISCOVERY_NUDGING_STATE = {
205
- stateKey: "discovery_nudging"};
210
+ stateKey: "discovery_nudging",
211
+ label: "Discovery Nudging"
212
+ };
206
213
  var CRM_DISCOVERY_BOOKING_CANCELLED_STATE = {
207
- stateKey: "discovery_booking_cancelled"};
214
+ stateKey: "discovery_booking_cancelled",
215
+ label: "Discovery Booking Cancelled"
216
+ };
217
+ var CRM_REPLY_SENT_STATE = {
218
+ stateKey: "reply_sent",
219
+ label: "Reply Sent"
220
+ };
221
+ var CRM_FOLLOWUP_1_SENT_STATE = {
222
+ stateKey: "followup_1_sent",
223
+ label: "Follow-up 1 Sent"
224
+ };
225
+ var CRM_FOLLOWUP_2_SENT_STATE = {
226
+ stateKey: "followup_2_sent",
227
+ label: "Follow-up 2 Sent"
228
+ };
229
+ var CRM_FOLLOWUP_3_SENT_STATE = {
230
+ stateKey: "followup_3_sent",
231
+ label: "Follow-up 3 Sent"
232
+ };
233
+ var CRM_PIPELINE_DEFINITION = {
234
+ pipelineKey: "crm",
235
+ label: "CRM",
236
+ entityKey: "crm.deal",
237
+ stages: [
238
+ {
239
+ stageKey: "interested",
240
+ label: "Interested",
241
+ color: "blue",
242
+ states: [
243
+ CRM_DISCOVERY_REPLIED_STATE,
244
+ CRM_DISCOVERY_LINK_SENT_STATE,
245
+ CRM_DISCOVERY_NUDGING_STATE,
246
+ CRM_DISCOVERY_BOOKING_CANCELLED_STATE,
247
+ CRM_REPLY_SENT_STATE,
248
+ CRM_FOLLOWUP_1_SENT_STATE,
249
+ CRM_FOLLOWUP_2_SENT_STATE,
250
+ CRM_FOLLOWUP_3_SENT_STATE
251
+ ]
252
+ },
253
+ { stageKey: "proposal", label: "Proposal", color: "yellow", states: [] },
254
+ { stageKey: "closing", label: "Closing", color: "orange", states: [] },
255
+ { stageKey: "closed_won", label: "Closed Won", color: "green", states: [] },
256
+ { stageKey: "closed_lost", label: "Closed Lost", color: "red", states: [] },
257
+ { stageKey: "nurturing", label: "Nurturing", color: "grape", states: [] }
258
+ ]
259
+ };
208
260
  var LEAD_GEN_STAGE_CATALOG = {
209
261
  // Prospecting — company population
210
262
  scraped: {
@@ -221,6 +273,13 @@ var LEAD_GEN_STAGE_CATALOG = {
221
273
  order: 2,
222
274
  entity: "company"
223
275
  },
276
+ crawled: {
277
+ key: "crawled",
278
+ label: "Websites crawled",
279
+ description: "Company websites have been crawled (e.g. via Apify) and raw page content stored for downstream LLM analysis.",
280
+ order: 2.5,
281
+ entity: "company"
282
+ },
224
283
  extracted: {
225
284
  key: "extracted",
226
285
  label: "Websites analyzed",
@@ -240,7 +299,9 @@ var LEAD_GEN_STAGE_CATALOG = {
240
299
  label: "Decision-makers found",
241
300
  description: "Decision-maker contacts discovered and attached to a qualified company.",
242
301
  order: 6,
243
- entity: "company"
302
+ entity: "company",
303
+ recordEntity: "contact",
304
+ recordStageKey: "discovered"
244
305
  },
245
306
  // Prospecting — contact discovery
246
307
  discovered: {
@@ -278,7 +339,8 @@ var LEAD_GEN_STAGE_CATALOG = {
278
339
  label: "Reviewed and exported",
279
340
  description: "Approved records have been reviewed and exported for handoff.",
280
341
  order: 10,
281
- entity: "contact"
342
+ entity: "company",
343
+ additionalEntities: ["contact"]
282
344
  },
283
345
  interested: {
284
346
  key: "interested",
@@ -290,18 +352,47 @@ var LEAD_GEN_STAGE_CATALOG = {
290
352
  };
291
353
  var ProspectingLifecycleStageSchema = DisplayMetadataSchema.extend({
292
354
  id: ModelIdSchema,
293
- order: z.number().int().min(0)
355
+ order: z.number().min(0)
356
+ });
357
+ var RecordColumnConfigSchema = z.object({
358
+ key: ModelIdSchema,
359
+ label: z.string().trim().min(1).max(120),
360
+ path: z.string().trim().min(1).max(500),
361
+ width: z.union([z.number().positive(), z.string().trim().min(1).max(100)]).optional(),
362
+ renderType: z.enum(["text", "badge", "datetime", "count", "json"]).optional(),
363
+ badgeColor: z.string().trim().min(1).max(40).optional()
364
+ });
365
+ var RecordColumnsConfigSchema = z.object({
366
+ company: z.array(RecordColumnConfigSchema).optional(),
367
+ contact: z.array(RecordColumnConfigSchema).optional()
368
+ }).refine((columns) => Boolean(columns.company?.length || columns.contact?.length), {
369
+ message: "recordColumns must include at least one entity column set"
370
+ });
371
+ var CredentialRequirementSchema = z.object({
372
+ key: ModelIdSchema,
373
+ provider: ModelIdSchema,
374
+ credentialType: z.enum(["api-key", "api-key-secret", "oauth", "webhook-secret"]),
375
+ label: z.string().trim().min(1).max(120),
376
+ required: z.boolean(),
377
+ selectionMode: z.enum(["single", "multiple"]).optional(),
378
+ inputPath: z.string().trim().min(1).max(500),
379
+ verifyOnRun: z.boolean().optional()
294
380
  });
295
381
  var ProspectingBuildTemplateStepSchema = DisplayMetadataSchema.extend({
296
382
  id: ModelIdSchema,
297
383
  primaryEntity: z.enum(["company", "contact"]),
298
384
  outputs: z.array(z.enum(["company", "contact", "export"])).min(1),
299
385
  stageKey: ModelIdSchema,
386
+ recordEntity: z.enum(["company", "contact"]).optional(),
387
+ recordsStageKey: ModelIdSchema.optional(),
388
+ recordSourceStageKey: ModelIdSchema.optional(),
300
389
  dependsOn: z.array(ModelIdSchema).optional(),
301
390
  dependencyMode: z.literal("per-record-eligibility"),
302
391
  capabilityKey: ModelIdSchema,
303
392
  defaultBatchSize: z.number().int().positive(),
304
- maxBatchSize: z.number().int().positive()
393
+ maxBatchSize: z.number().int().positive(),
394
+ recordColumns: RecordColumnsConfigSchema.optional(),
395
+ credentialRequirements: z.array(CredentialRequirementSchema).optional()
305
396
  }).refine((step) => step.defaultBatchSize <= step.maxBatchSize, {
306
397
  message: "defaultBatchSize must be less than or equal to maxBatchSize",
307
398
  path: ["defaultBatchSize"]
@@ -310,20 +401,148 @@ var ProspectingBuildTemplateSchema = DisplayMetadataSchema.extend({
310
401
  id: ModelIdSchema,
311
402
  steps: z.array(ProspectingBuildTemplateStepSchema).min(1)
312
403
  });
313
- var CAPABILITY_REGISTRY = {
314
- "lead-gen.company.source": "lgn-import-workflow",
315
- "lead-gen.company.apollo-import": "lgn-01c-apollo-import-workflow",
316
- "lead-gen.contact.discover": "lgn-04-email-discovery-workflow",
317
- "lead-gen.contact.verify-email": "lgn-05-email-verification-workflow",
318
- "lead-gen.company.website-extract": "lgn-02-website-extract-workflow",
319
- "lead-gen.company.qualify": "lgn-03-company-qualification-workflow",
320
- "lead-gen.company.dtc-subscription-qualify": "lgn-03b-dtc-subscription-score-workflow",
321
- "lead-gen.contact.apollo-decision-maker-enrich": "lgn-04b-apollo-decision-maker-enrich-workflow",
322
- "lead-gen.contact.personalize": "ist-personalization-workflow",
323
- "lead-gen.review.outreach-ready": "ist-upload-contacts-workflow",
324
- "lead-gen.export.list": "lgn-06-export-list-workflow",
325
- "lead-gen.company.cleanup": "lgn-company-cleanup-workflow"
404
+ var DTC_RECORD_COLUMNS = {
405
+ populated: {
406
+ company: [
407
+ { key: "name", label: "Company", path: "company.name" },
408
+ { key: "domain", label: "Domain", path: "company.domain" },
409
+ { key: "employee-count", label: "Employees", path: "company.numEmployees", renderType: "count" },
410
+ { key: "apollo-industry", label: "Apollo industry", path: "company.category" },
411
+ { key: "location", label: "Location", path: "company.locationState" }
412
+ ]
413
+ },
414
+ crawled: {
415
+ company: [
416
+ { key: "name", label: "Company", path: "company.name" },
417
+ { key: "domain", label: "Domain", path: "company.domain" },
418
+ { key: "page-count", label: "Pages", path: "company.enrichmentData.websiteCrawl.pageCount", renderType: "count" },
419
+ { key: "crawl-status", label: "Crawl status", path: "processingState.crawled.status", renderType: "badge" }
420
+ ]
421
+ },
422
+ extracted: {
423
+ company: [
424
+ { key: "name", label: "Company", path: "company.name" },
425
+ { key: "domain", label: "Domain", path: "company.domain" },
426
+ { key: "description", label: "Description", path: "company.enrichmentData.websiteCrawl.companyDescription" },
427
+ { key: "services", label: "Services", path: "company.enrichmentData.websiteCrawl.services", renderType: "json" },
428
+ { key: "automation-gaps", label: "Automation gaps", path: "company.enrichmentData.websiteCrawl.automationGaps", renderType: "json" },
429
+ { key: "contact-count", label: "Contacts", path: "company.enrichmentData.websiteCrawl.emailCount", renderType: "count" }
430
+ ]
431
+ },
432
+ qualified: {
433
+ company: [
434
+ { key: "name", label: "Company", path: "company.name" },
435
+ { key: "domain", label: "Domain", path: "company.domain" },
436
+ { key: "score", label: "Score", path: "company.qualificationScore", renderType: "badge", badgeColor: "green" },
437
+ { key: "signals", label: "Signals", path: "company.qualificationSignals", renderType: "json" },
438
+ { key: "disqualified-reason", label: "Disqualified reason", path: "processingState.qualified.data.disqualifiedReason" }
439
+ ]
440
+ },
441
+ decisionMakers: {
442
+ contact: [
443
+ { key: "name", label: "Name", path: "contact.name" },
444
+ { key: "title", label: "Title", path: "contact.title" },
445
+ { key: "email", label: "Email", path: "contact.email" },
446
+ { key: "linkedin", label: "LinkedIn", path: "contact.linkedinUrl" },
447
+ { key: "priority-score", label: "Priority", path: "contact.enrichmentData.apollo.priorityScore", renderType: "badge" }
448
+ ]
449
+ },
450
+ uploaded: {
451
+ company: [
452
+ { key: "name", label: "Company", path: "company.name" },
453
+ { key: "domain", label: "Domain", path: "company.domain" },
454
+ { key: "contacts", label: "Contacts", path: "company.enrichmentData.approvedLeadListExport.contacts", renderType: "json" },
455
+ { key: "score", label: "Score", path: "company.qualificationScore", renderType: "badge", badgeColor: "green" },
456
+ { key: "approval", label: "Approval", path: "company.enrichmentData.approvedLeadListExport.approvalStatus", renderType: "badge" }
457
+ ]
458
+ }
326
459
  };
460
+ z.object({
461
+ id: ModelIdSchema,
462
+ label: z.string(),
463
+ description: z.string(),
464
+ resourceId: ModelIdSchema
465
+ });
466
+ var CAPABILITY_REGISTRY = [
467
+ {
468
+ id: "lead-gen.company.source",
469
+ label: "Source companies",
470
+ description: "Import source companies from a list provider.",
471
+ resourceId: "lgn-import-workflow"
472
+ },
473
+ {
474
+ id: "lead-gen.company.apollo-import",
475
+ label: "Import from Apollo",
476
+ description: "Pull companies and seed contact data from an Apollo search or list.",
477
+ resourceId: "lgn-01c-apollo-import-workflow"
478
+ },
479
+ {
480
+ id: "lead-gen.contact.discover",
481
+ label: "Discover contact emails",
482
+ description: "Find email addresses for contacts at qualified companies.",
483
+ resourceId: "lgn-04-email-discovery-workflow"
484
+ },
485
+ {
486
+ id: "lead-gen.contact.verify-email",
487
+ label: "Verify emails",
488
+ description: "Check email deliverability before outreach.",
489
+ resourceId: "lgn-05-email-verification-workflow"
490
+ },
491
+ {
492
+ id: "lead-gen.company.apify-crawl",
493
+ label: "Crawl websites",
494
+ description: "Crawl company websites via Apify and store raw page markdown in enrichmentData.websiteCrawl.pages for downstream LLM analysis.",
495
+ resourceId: "lgn-02a-apify-website-crawl-workflow"
496
+ },
497
+ {
498
+ id: "lead-gen.company.website-extract",
499
+ label: "Extract website signals",
500
+ description: "Scrape and analyze company websites for qualification signals.",
501
+ resourceId: "lgn-02-website-extract-workflow"
502
+ },
503
+ {
504
+ id: "lead-gen.company.qualify",
505
+ label: "Qualify companies",
506
+ description: "Score and filter companies against the ICP rubric.",
507
+ resourceId: "lgn-03-company-qualification-workflow"
508
+ },
509
+ {
510
+ id: "lead-gen.company.dtc-subscription-qualify",
511
+ label: "Qualify DTC subscription fit",
512
+ description: "Classify subscription potential and consumable-product fit for DTC brands.",
513
+ resourceId: "lgn-03b-dtc-subscription-score-workflow"
514
+ },
515
+ {
516
+ id: "lead-gen.contact.apollo-decision-maker-enrich",
517
+ label: "Enrich decision-makers",
518
+ description: "Find and enrich qualified contacts at qualified companies via Apollo.",
519
+ resourceId: "lgn-04b-apollo-decision-maker-enrich-workflow"
520
+ },
521
+ {
522
+ id: "lead-gen.contact.personalize",
523
+ label: "Personalize outreach",
524
+ description: "Generate personalized opening lines for each contact.",
525
+ resourceId: "ist-personalization-workflow"
526
+ },
527
+ {
528
+ id: "lead-gen.review.outreach-ready",
529
+ label: "Upload to outreach",
530
+ description: "Upload approved contacts to the outreach sequence after QC review.",
531
+ resourceId: "ist-upload-contacts-workflow"
532
+ },
533
+ {
534
+ id: "lead-gen.export.list",
535
+ label: "Export lead list",
536
+ description: "Export approved leads as a downloadable lead list.",
537
+ resourceId: "lgn-06-export-list-workflow"
538
+ },
539
+ {
540
+ id: "lead-gen.company.cleanup",
541
+ label: "Clean up companies",
542
+ description: "Remove disqualified or duplicate companies from the list.",
543
+ resourceId: "lgn-company-cleanup-workflow"
544
+ }
545
+ ];
327
546
  var PROSPECTING_STEPS = {
328
547
  localServices: {
329
548
  sourceCompanies: {
@@ -421,7 +640,45 @@ var PROSPECTING_STEPS = {
421
640
  dependencyMode: "per-record-eligibility",
422
641
  capabilityKey: "lead-gen.company.apollo-import",
423
642
  defaultBatchSize: 250,
424
- maxBatchSize: 1e3
643
+ maxBatchSize: 1e3,
644
+ recordColumns: DTC_RECORD_COLUMNS.populated,
645
+ credentialRequirements: [
646
+ {
647
+ key: "apollo",
648
+ provider: "apollo",
649
+ credentialType: "api-key-secret",
650
+ label: "Apollo API key",
651
+ required: true,
652
+ selectionMode: "single",
653
+ inputPath: "credential"
654
+ }
655
+ ]
656
+ },
657
+ apifyCrawl: {
658
+ id: "apify-crawl",
659
+ label: "Websites crawled",
660
+ description: "Crawl company websites via Apify and store raw page markdown in enrichmentData.websiteCrawl.pages for downstream LLM analysis. Overwrites the synthetic seed Apollo Import wrote with real page content.",
661
+ primaryEntity: "company",
662
+ outputs: ["company"],
663
+ stageKey: "crawled",
664
+ dependsOn: ["import-apollo-search"],
665
+ dependencyMode: "per-record-eligibility",
666
+ capabilityKey: "lead-gen.company.apify-crawl",
667
+ defaultBatchSize: 50,
668
+ maxBatchSize: 100,
669
+ recordColumns: DTC_RECORD_COLUMNS.crawled,
670
+ credentialRequirements: [
671
+ {
672
+ key: "apify",
673
+ provider: "apify",
674
+ credentialType: "api-key-secret",
675
+ label: "Apify API token",
676
+ required: true,
677
+ selectionMode: "single",
678
+ inputPath: "credential",
679
+ verifyOnRun: true
680
+ }
681
+ ]
425
682
  },
426
683
  analyzeWebsites: {
427
684
  id: "analyze-websites",
@@ -430,11 +687,12 @@ var PROSPECTING_STEPS = {
430
687
  primaryEntity: "company",
431
688
  outputs: ["company"],
432
689
  stageKey: "extracted",
433
- dependsOn: ["import-apollo-search"],
690
+ dependsOn: ["apify-crawl"],
434
691
  dependencyMode: "per-record-eligibility",
435
692
  capabilityKey: "lead-gen.company.website-extract",
436
693
  defaultBatchSize: 50,
437
- maxBatchSize: 100
694
+ maxBatchSize: 100,
695
+ recordColumns: DTC_RECORD_COLUMNS.extracted
438
696
  },
439
697
  scoreDtcFit: {
440
698
  id: "score-dtc-fit",
@@ -447,7 +705,8 @@ var PROSPECTING_STEPS = {
447
705
  dependencyMode: "per-record-eligibility",
448
706
  capabilityKey: "lead-gen.company.dtc-subscription-qualify",
449
707
  defaultBatchSize: 100,
450
- maxBatchSize: 250
708
+ maxBatchSize: 250,
709
+ recordColumns: DTC_RECORD_COLUMNS.qualified
451
710
  },
452
711
  enrichDecisionMakers: {
453
712
  id: "enrich-decision-makers",
@@ -456,37 +715,52 @@ var PROSPECTING_STEPS = {
456
715
  primaryEntity: "company",
457
716
  outputs: ["contact"],
458
717
  stageKey: "decision-makers-enriched",
718
+ recordEntity: "contact",
459
719
  dependsOn: ["score-dtc-fit"],
460
720
  dependencyMode: "per-record-eligibility",
461
721
  capabilityKey: "lead-gen.contact.apollo-decision-maker-enrich",
462
722
  defaultBatchSize: 100,
463
- maxBatchSize: 250
464
- },
465
- verifyEmails: {
466
- id: "verify-emails",
467
- label: "Emails verified",
468
- description: "Verify deliverability before the QC and handoff step.",
469
- primaryEntity: "contact",
470
- outputs: ["contact"],
471
- stageKey: "verified",
472
- dependsOn: ["enrich-decision-makers"],
473
- dependencyMode: "per-record-eligibility",
474
- capabilityKey: "lead-gen.contact.verify-email",
475
- defaultBatchSize: 250,
476
- maxBatchSize: 500
723
+ maxBatchSize: 250,
724
+ recordColumns: DTC_RECORD_COLUMNS.decisionMakers,
725
+ credentialRequirements: [
726
+ {
727
+ key: "apollo",
728
+ provider: "apollo",
729
+ credentialType: "api-key-secret",
730
+ label: "Apollo API key",
731
+ required: true,
732
+ selectionMode: "single",
733
+ inputPath: "credential"
734
+ }
735
+ ]
477
736
  },
478
737
  reviewAndExport: {
479
738
  id: "review-and-export",
480
739
  label: "Reviewed and exported",
481
- description: "Operator QC approves or rejects leads, then approved records are exported as a lead list.",
740
+ description: "Operator QC approves or rejects qualified companies, then approved records are exported as a lead list with unverified emails.",
482
741
  primaryEntity: "company",
483
742
  outputs: ["export"],
484
743
  stageKey: "uploaded",
485
- dependsOn: ["verify-emails"],
744
+ recordsStageKey: "uploaded",
745
+ recordSourceStageKey: "qualified",
746
+ dependsOn: ["enrich-decision-makers"],
486
747
  dependencyMode: "per-record-eligibility",
487
748
  capabilityKey: "lead-gen.export.list",
488
749
  defaultBatchSize: 100,
489
- maxBatchSize: 250
750
+ maxBatchSize: 250,
751
+ recordColumns: DTC_RECORD_COLUMNS.uploaded,
752
+ credentialRequirements: [
753
+ {
754
+ key: "clickup",
755
+ provider: "clickup",
756
+ credentialType: "api-key-secret",
757
+ label: "ClickUp API token",
758
+ required: true,
759
+ selectionMode: "single",
760
+ inputPath: "clickupCredential",
761
+ verifyOnRun: true
762
+ }
763
+ ]
490
764
  }
491
765
  }
492
766
  };
@@ -508,7 +782,7 @@ function toProspectingLifecycleStage(stage) {
508
782
  };
509
783
  }
510
784
  function leadGenStagesForEntity(entity) {
511
- return Object.values(LEAD_GEN_STAGE_CATALOG).filter((stage) => stage.entity === entity).sort((a, b) => a.order - b.order).map(toProspectingLifecycleStage);
785
+ return Object.values(LEAD_GEN_STAGE_CATALOG).filter((stage) => stage.entity === entity || stage.additionalEntities?.includes(entity)).sort((a, b) => a.order - b.order).map(toProspectingLifecycleStage);
512
786
  }
513
787
  var DEFAULT_ORGANIZATION_MODEL_PROSPECTING = {
514
788
  companyStages: leadGenStagesForEntity("company"),
@@ -534,10 +808,10 @@ var DEFAULT_ORGANIZATION_MODEL_PROSPECTING = {
534
808
  description: "Prospecting pipeline for DTC subscription or subscription-ready brands where Apollo is the source and contact-enrichment layer, Elevasis handles company research and fit scoring, and approved leads export as an approved lead list.",
535
809
  steps: [
536
810
  PROSPECTING_STEPS.dtcApolloClickup.importApolloSearch,
811
+ PROSPECTING_STEPS.dtcApolloClickup.apifyCrawl,
537
812
  PROSPECTING_STEPS.dtcApolloClickup.analyzeWebsites,
538
813
  PROSPECTING_STEPS.dtcApolloClickup.scoreDtcFit,
539
814
  PROSPECTING_STEPS.dtcApolloClickup.enrichDecisionMakers,
540
- PROSPECTING_STEPS.dtcApolloClickup.verifyEmails,
541
815
  PROSPECTING_STEPS.dtcApolloClickup.reviewAndExport
542
816
  ]
543
817
  }
@@ -812,6 +1086,149 @@ var RegistryValidationError = class extends Error {
812
1086
  this.name = "RegistryValidationError";
813
1087
  }
814
1088
  };
1089
+ function getResourceValidatorMode(explicitMode) {
1090
+ if (explicitMode) return explicitMode;
1091
+ const env = globalThis.process?.env;
1092
+ return env?.ELEVASIS_RESOURCE_VALIDATOR === "warn-only" ? "warn-only" : "strict";
1093
+ }
1094
+ function addGovernanceIssue(issues, type, orgName, resourceId, message) {
1095
+ issues.push({
1096
+ type,
1097
+ orgName,
1098
+ resourceId,
1099
+ message
1100
+ });
1101
+ }
1102
+ function emitGovernanceIssues(issues, mode, onWarning) {
1103
+ if (issues.length === 0) return;
1104
+ if (mode === "strict") {
1105
+ const first = issues[0];
1106
+ throw new RegistryValidationError(first.orgName, first.resourceId, "organizationModel.resources", first.message);
1107
+ }
1108
+ const warn = onWarning ?? ((issue) => console.warn(issue.message));
1109
+ for (const issue of issues) {
1110
+ warn(issue);
1111
+ }
1112
+ }
1113
+ function getRuntimeResources(resources) {
1114
+ return [
1115
+ ...(resources.workflows ?? []).map((workflow) => ({
1116
+ resourceId: workflow.config.resourceId,
1117
+ type: workflow.config.type,
1118
+ descriptor: workflow.config.resource
1119
+ })),
1120
+ ...(resources.agents ?? []).map((agent) => ({
1121
+ resourceId: agent.config.resourceId,
1122
+ type: agent.config.type,
1123
+ descriptor: agent.config.resource
1124
+ })),
1125
+ ...(resources.integrations ?? []).map((integration) => ({
1126
+ resourceId: integration.resourceId,
1127
+ type: integration.type,
1128
+ descriptor: integration.resource
1129
+ }))
1130
+ ];
1131
+ }
1132
+ function validateResourceGovernance(orgName, deployment, organizationModel = deployment.organizationModel, options = {}) {
1133
+ const mode = getResourceValidatorMode(options.mode);
1134
+ const omResources = organizationModel?.resources?.entries;
1135
+ const omSystems = organizationModel?.systems?.systems;
1136
+ const issues = [];
1137
+ if (!omResources || !omSystems) {
1138
+ return { valid: true, mode, issues };
1139
+ }
1140
+ const systemsById = new Map(omSystems.map((system) => [system.id, system]));
1141
+ const activeOmResources = omResources.filter((resource) => resource.status === "active");
1142
+ const omResourcesById = new Map(activeOmResources.map((resource) => [resource.id, resource]));
1143
+ const runtimeResources = getRuntimeResources(deployment);
1144
+ const runtimeResourcesById = new Map(runtimeResources.map((resource) => [resource.resourceId, resource]));
1145
+ for (const resource of activeOmResources) {
1146
+ if (!systemsById.has(resource.systemId)) {
1147
+ addGovernanceIssue(
1148
+ issues,
1149
+ "missing-om-system",
1150
+ orgName,
1151
+ resource.id,
1152
+ `[${orgName}] OM resource '${resource.id}' references missing System '${resource.systemId}'.`
1153
+ );
1154
+ }
1155
+ const runtimeResource = runtimeResourcesById.get(resource.id);
1156
+ if (!runtimeResource) {
1157
+ addGovernanceIssue(
1158
+ issues,
1159
+ "missing-code-resource",
1160
+ orgName,
1161
+ resource.id,
1162
+ `[${orgName}] OM resource '${resource.id}' has no matching code-side resource.`
1163
+ );
1164
+ continue;
1165
+ }
1166
+ if (runtimeResource.type !== resource.kind) {
1167
+ addGovernanceIssue(
1168
+ issues,
1169
+ "type-mismatch",
1170
+ orgName,
1171
+ resource.id,
1172
+ `[${orgName}] Resource '${resource.id}' type mismatch: code has '${runtimeResource.type}', OM has '${resource.kind}'.`
1173
+ );
1174
+ }
1175
+ if (runtimeResource.descriptor && runtimeResource.descriptor.systemId !== resource.systemId) {
1176
+ addGovernanceIssue(
1177
+ issues,
1178
+ "system-mismatch",
1179
+ orgName,
1180
+ resource.id,
1181
+ `[${orgName}] Resource '${resource.id}' system mismatch: code descriptor has '${runtimeResource.descriptor.systemId}', OM has '${resource.systemId}'.`
1182
+ );
1183
+ }
1184
+ }
1185
+ for (const runtimeResource of runtimeResources) {
1186
+ const omResource = omResourcesById.get(runtimeResource.resourceId);
1187
+ if (!omResource) {
1188
+ addGovernanceIssue(
1189
+ issues,
1190
+ "missing-om-resource",
1191
+ orgName,
1192
+ runtimeResource.resourceId,
1193
+ `[${orgName}] Code-side resource '${runtimeResource.resourceId}' has no active OM Resource descriptor.`
1194
+ );
1195
+ }
1196
+ if (!runtimeResource.descriptor) {
1197
+ addGovernanceIssue(
1198
+ issues,
1199
+ "raw-resource-id",
1200
+ orgName,
1201
+ runtimeResource.resourceId,
1202
+ `[${orgName}] Code-side resource '${runtimeResource.resourceId}' authors raw resourceId/type values. Use an OM Resource descriptor and bindResourceDescriptor().`
1203
+ );
1204
+ continue;
1205
+ }
1206
+ if (runtimeResource.descriptor.id !== runtimeResource.resourceId) {
1207
+ addGovernanceIssue(
1208
+ issues,
1209
+ "raw-resource-id",
1210
+ orgName,
1211
+ runtimeResource.resourceId,
1212
+ `[${orgName}] Code-side resource '${runtimeResource.resourceId}' does not derive identity from its OM descriptor '${runtimeResource.descriptor.id}'.`
1213
+ );
1214
+ }
1215
+ if (runtimeResource.descriptor.kind !== runtimeResource.type) {
1216
+ addGovernanceIssue(
1217
+ issues,
1218
+ "type-mismatch",
1219
+ orgName,
1220
+ runtimeResource.resourceId,
1221
+ `[${orgName}] Code-side resource '${runtimeResource.resourceId}' descriptor kind '${runtimeResource.descriptor.kind}' does not match runtime type '${runtimeResource.type}'.`
1222
+ );
1223
+ }
1224
+ }
1225
+ emitGovernanceIssues(issues, mode, options.onWarning);
1226
+ return {
1227
+ valid: issues.length === 0,
1228
+ mode,
1229
+ issues
1230
+ };
1231
+ }
815
1232
  function validateDeploymentSpec(orgName, resources) {
816
1233
  const seenIds = /* @__PURE__ */ new Set();
817
1234
  resources.workflows?.forEach((workflow) => {
@@ -848,6 +1265,7 @@ function validateDeploymentSpec(orgName, resources) {
848
1265
  validateExecutionInterface(orgName, id, agent.interface, agent.contract.inputSchema);
849
1266
  }
850
1267
  });
1268
+ validateResourceGovernance(orgName, resources);
851
1269
  }
852
1270
  function validateResourceModelConfig(orgName, resourceId, modelConfig) {
853
1271
  try {
@@ -3331,6 +3749,29 @@ function redactSecret(value) {
3331
3749
  }
3332
3750
 
3333
3751
  // ../core/src/platform/registry/serialization.ts
3752
+ function summarizeSystem(system) {
3753
+ if (!system) return void 0;
3754
+ return {
3755
+ id: system.id,
3756
+ title: system.title,
3757
+ description: system.description,
3758
+ kind: system.kind,
3759
+ status: system.status
3760
+ };
3761
+ }
3762
+ function createGovernanceMetadataResolver(resources) {
3763
+ const resourcesById = new Map((resources.organizationModel?.resources?.entries ?? []).map((r) => [r.id, r]));
3764
+ const systemsById = new Map((resources.organizationModel?.systems?.systems ?? []).map((s) => [s.id, s]));
3765
+ return (resourceId, descriptor) => {
3766
+ const resource = descriptor ?? resourcesById.get(resourceId);
3767
+ if (!resource) return {};
3768
+ return {
3769
+ systemId: resource.systemId,
3770
+ system: summarizeSystem(systemsById.get(resource.systemId)),
3771
+ governanceStatus: resource.status
3772
+ };
3773
+ };
3774
+ }
3334
3775
  function serializeAllOrganizations(registry) {
3335
3776
  const cache = /* @__PURE__ */ new Map();
3336
3777
  for (const [orgName, resources] of Object.entries(registry)) {
@@ -3339,6 +3780,7 @@ function serializeAllOrganizations(registry) {
3339
3780
  return cache;
3340
3781
  }
3341
3782
  function serializeOrganization(resources) {
3783
+ const getGovernanceMetadata = createGovernanceMetadataResolver(resources);
3342
3784
  const workflowDefinitions = /* @__PURE__ */ new Map();
3343
3785
  const workflowResources = [];
3344
3786
  const commandViewWorkflows = [];
@@ -3354,7 +3796,8 @@ function serializeOrganization(resources) {
3354
3796
  type: "workflow",
3355
3797
  status: workflow.config.status,
3356
3798
  links: workflow.config.links,
3357
- category: workflow.config.category
3799
+ category: workflow.config.category,
3800
+ ...getGovernanceMetadata(resourceId, workflow.config.resource)
3358
3801
  });
3359
3802
  commandViewWorkflows.push({
3360
3803
  resourceId,
@@ -3365,6 +3808,7 @@ function serializeOrganization(resources) {
3365
3808
  status: workflow.config.status,
3366
3809
  links: workflow.config.links,
3367
3810
  category: workflow.config.category,
3811
+ ...getGovernanceMetadata(resourceId, workflow.config.resource),
3368
3812
  stepCount: Object.keys(workflow.steps).length,
3369
3813
  entryPoint: workflow.entryPoint
3370
3814
  });
@@ -3384,7 +3828,8 @@ function serializeOrganization(resources) {
3384
3828
  type: "agent",
3385
3829
  status: agent.config.status,
3386
3830
  links: agent.config.links,
3387
- category: agent.config.category
3831
+ category: agent.config.category,
3832
+ ...getGovernanceMetadata(resourceId, agent.config.resource)
3388
3833
  });
3389
3834
  commandViewAgents.push({
3390
3835
  resourceId,
@@ -3395,6 +3840,7 @@ function serializeOrganization(resources) {
3395
3840
  status: agent.config.status,
3396
3841
  links: agent.config.links,
3397
3842
  category: agent.config.category,
3843
+ ...getGovernanceMetadata(resourceId, agent.config.resource),
3398
3844
  modelProvider: agent.modelConfig.provider,
3399
3845
  modelId: agent.modelConfig.model,
3400
3846
  toolCount: agent.tools.length,
@@ -3539,6 +3985,16 @@ function filterArchived(org) {
3539
3985
  humanCheckpoints: org.humanCheckpoints?.filter((h) => !h.archived)
3540
3986
  };
3541
3987
  }
3988
+ function summarizeSystem2(system) {
3989
+ if (!system) return void 0;
3990
+ return {
3991
+ id: system.id,
3992
+ title: system.title,
3993
+ description: system.description,
3994
+ kind: system.kind,
3995
+ status: system.status
3996
+ };
3997
+ }
3542
3998
  var ResourceRegistry = class {
3543
3999
  constructor(registry) {
3544
4000
  this.registry = registry;
@@ -3685,6 +4141,17 @@ var ResourceRegistry = class {
3685
4141
  environment
3686
4142
  };
3687
4143
  }
4144
+ const resourcesById = new Map((orgResources.organizationModel?.resources?.entries ?? []).map((r) => [r.id, r]));
4145
+ const systemsById = new Map((orgResources.organizationModel?.systems?.systems ?? []).map((s) => [s.id, s]));
4146
+ const getGovernanceMetadata = (resourceId, descriptor) => {
4147
+ const resource = descriptor ?? resourcesById.get(resourceId);
4148
+ if (!resource) return {};
4149
+ return {
4150
+ systemId: resource.systemId,
4151
+ system: summarizeSystem2(systemsById.get(resource.systemId)),
4152
+ governanceStatus: resource.status
4153
+ };
4154
+ };
3688
4155
  const workflows = (orgResources.workflows || []).map((def) => ({
3689
4156
  resourceId: def.config.resourceId,
3690
4157
  name: def.config.name,
@@ -3694,7 +4161,8 @@ var ResourceRegistry = class {
3694
4161
  status: def.config.status,
3695
4162
  links: def.config.links,
3696
4163
  category: def.config.category,
3697
- origin: this.remoteResources.has(`${organizationName}/${def.config.resourceId}`) ? "remote" : "local"
4164
+ origin: this.remoteResources.has(`${organizationName}/${def.config.resourceId}`) ? "remote" : "local",
4165
+ ...getGovernanceMetadata(def.config.resourceId, def.config.resource)
3698
4166
  })).filter((resource) => !environment || resource.status === environment);
3699
4167
  const agents = (orgResources.agents || []).map((def) => ({
3700
4168
  resourceId: def.config.resourceId,
@@ -3706,7 +4174,8 @@ var ResourceRegistry = class {
3706
4174
  links: def.config.links,
3707
4175
  category: def.config.category,
3708
4176
  sessionCapable: def.config.sessionCapable ?? false,
3709
- origin: this.remoteResources.has(`${organizationName}/${def.config.resourceId}`) ? "remote" : "local"
4177
+ origin: this.remoteResources.has(`${organizationName}/${def.config.resourceId}`) ? "remote" : "local",
4178
+ ...getGovernanceMetadata(def.config.resourceId, def.config.resource)
3710
4179
  })).filter((resource) => !environment || resource.status === environment);
3711
4180
  return {
3712
4181
  workflows,
@@ -4204,9 +4673,13 @@ var ProcessingStageStatusSchema = z.enum(["success", "no_result", "skipped", "er
4204
4673
  var LeadGenStageKeySchema = z.string().refine((value) => Object.prototype.hasOwnProperty.call(LEAD_GEN_STAGE_CATALOG, value), {
4205
4674
  message: "processing state key must match LEAD_GEN_STAGE_CATALOG"
4206
4675
  });
4207
- var LeadGenCapabilityKeySchema = z.string().refine((value) => Object.prototype.hasOwnProperty.call(CAPABILITY_REGISTRY, value), {
4676
+ var LeadGenCapabilityKeySchema = z.string().refine((value) => CAPABILITY_REGISTRY.some((c) => c.id === value), {
4208
4677
  message: "capabilityKey must match CAPABILITY_REGISTRY"
4209
4678
  });
4679
+ var crmStageKeys = CRM_PIPELINE_DEFINITION.stages.map((stage) => stage.stageKey);
4680
+ var crmStateKeys = CRM_PIPELINE_DEFINITION.stages.flatMap((stage) => stage.states.map((state) => state.stateKey));
4681
+ var CrmStageKeySchema = z.enum(crmStageKeys);
4682
+ var CrmStateKeySchema = z.enum(crmStateKeys);
4210
4683
  var ProcessingStateEntrySchema = z.object({
4211
4684
  status: ProcessingStageStatusSchema,
4212
4685
  data: z.unknown().optional()
@@ -4214,7 +4687,7 @@ var ProcessingStateEntrySchema = z.object({
4214
4687
  var ProcessingStateSchema = z.record(LeadGenStageKeySchema, ProcessingStateEntrySchema);
4215
4688
  var CompanyProcessingStateSchema = ProcessingStateSchema;
4216
4689
  var ContactProcessingStateSchema = ProcessingStateSchema;
4217
- var DealStageSchema = z.enum(["interested", "proposal", "closing", "closed_won", "closed_lost", "nurturing"]);
4690
+ var DealStageSchema = CrmStageKeySchema;
4218
4691
  var AcqDealTaskKindSchema = z.enum(["call", "email", "meeting", "other"]);
4219
4692
  z.object({
4220
4693
  dealId: UuidSchema
@@ -4225,6 +4698,9 @@ z.object({
4225
4698
  });
4226
4699
  z.object({
4227
4700
  stage: DealStageSchema.optional(),
4701
+ list: UuidSchema.optional(),
4702
+ batch: z.string().trim().min(1).max(255).optional(),
4703
+ staleSince: z.string().datetime().optional(),
4228
4704
  search: z.string().optional(),
4229
4705
  limit: z.coerce.number().int().positive().default(50),
4230
4706
  offset: z.coerce.number().int().min(0).default(0)
@@ -4250,12 +4726,19 @@ z.object({
4250
4726
  z.object({
4251
4727
  pipelineKey: z.string().min(1),
4252
4728
  stageKey: z.string().min(1),
4253
- stateKey: z.string().nullable().optional(),
4729
+ stateKey: z.string().min(1).nullable().optional(),
4254
4730
  reason: z.string().optional(),
4255
4731
  expectedUpdatedAt: z.string().datetime().optional()
4256
4732
  }).strict();
4257
4733
  z.object({
4258
- stateKey: z.string().min(1),
4734
+ pipelineKey: z.literal(CRM_PIPELINE_DEFINITION.pipelineKey),
4735
+ stageKey: CrmStageKeySchema,
4736
+ stateKey: CrmStateKeySchema.nullable().optional(),
4737
+ reason: z.string().optional(),
4738
+ expectedUpdatedAt: z.string().datetime().optional()
4739
+ }).strict();
4740
+ z.object({
4741
+ stateKey: CrmStateKeySchema,
4259
4742
  reason: z.string().optional(),
4260
4743
  expectedUpdatedAt: z.string().datetime().optional()
4261
4744
  }).strict();
@@ -4300,6 +4783,7 @@ var DealListItemSchema = z.object({
4300
4783
  // acq_deals columns
4301
4784
  id: z.string(),
4302
4785
  organization_id: z.string(),
4786
+ client_id: z.string().nullable().optional(),
4303
4787
  contact_id: z.string().nullable(),
4304
4788
  contact_email: z.string(),
4305
4789
  pipeline_key: z.string(),
@@ -4380,8 +4864,31 @@ var ConversationMessageSchema = z.object({
4380
4864
  var DealConversationSchema = z.object({
4381
4865
  messages: z.array(ConversationMessageSchema)
4382
4866
  });
4867
+ var DealLineageListRefSchema = z.object({
4868
+ id: z.string(),
4869
+ name: z.string(),
4870
+ status: z.string()
4871
+ });
4872
+ var DealLineageProjectRefSchema = z.object({
4873
+ id: z.string(),
4874
+ name: z.string(),
4875
+ kind: z.string(),
4876
+ status: z.string(),
4877
+ updatedAt: z.string()
4878
+ });
4879
+ var DealLineageClientRefSchema = z.object({
4880
+ id: z.string(),
4881
+ name: z.string(),
4882
+ status: z.string()
4883
+ });
4884
+ var DealLineageSchema = z.object({
4885
+ list: DealLineageListRefSchema.nullable(),
4886
+ projects: z.array(DealLineageProjectRefSchema),
4887
+ client: DealLineageClientRefSchema.nullable()
4888
+ });
4383
4889
  DealListItemSchema.extend({
4384
- conversation: DealConversationSchema
4890
+ conversation: DealConversationSchema,
4891
+ lineage: DealLineageSchema.optional()
4385
4892
  });
4386
4893
  var DealNoteResponseSchema = z.object({
4387
4894
  id: z.string(),
@@ -4442,11 +4949,19 @@ var BuildPlanSnapshotStepSchema = z.object({
4442
4949
  primaryEntity: z.enum(["company", "contact"]),
4443
4950
  outputs: z.array(z.enum(["company", "contact", "export"])).min(1),
4444
4951
  stageKey: LeadGenStageKeySchema,
4952
+ recordEntity: z.enum(["company", "contact"]).optional(),
4953
+ recordsStageKey: LeadGenStageKeySchema.optional(),
4954
+ recordSourceStageKey: LeadGenStageKeySchema.optional(),
4445
4955
  dependsOn: z.array(z.string().trim().min(1).max(100)).optional(),
4446
4956
  dependencyMode: z.literal("per-record-eligibility"),
4447
4957
  capabilityKey: LeadGenCapabilityKeySchema,
4448
4958
  defaultBatchSize: z.number().int().positive(),
4449
- maxBatchSize: z.number().int().positive()
4959
+ maxBatchSize: z.number().int().positive(),
4960
+ recordColumns: z.object({
4961
+ company: z.array(RecordColumnConfigSchema).optional(),
4962
+ contact: z.array(RecordColumnConfigSchema).optional()
4963
+ }).optional(),
4964
+ credentialRequirements: z.array(CredentialRequirementSchema).optional()
4450
4965
  }).refine((step) => step.defaultBatchSize <= step.maxBatchSize, {
4451
4966
  message: "defaultBatchSize must be less than or equal to maxBatchSize",
4452
4967
  path: ["defaultBatchSize"]
@@ -4585,6 +5100,23 @@ var AcqListResponseSchema = z.object({
4585
5100
  });
4586
5101
  z.array(AcqListResponseSchema);
4587
5102
  z.array(ListTelemetrySchema);
5103
+ var QueryBooleanSchema = z.preprocess((value) => {
5104
+ if (value === "true" || value === "1" || value === true) return true;
5105
+ if (value === "false" || value === "0" || value === false) return false;
5106
+ return value;
5107
+ }, z.boolean());
5108
+ z.object({
5109
+ status: ListStatusSchema.optional(),
5110
+ batch: z.string().trim().min(1).max(255).optional(),
5111
+ vertical: z.string().trim().min(1).max(255).optional(),
5112
+ limit: z.coerce.number().int().min(1).max(500).optional(),
5113
+ offset: z.coerce.number().int().min(0).optional()
5114
+ }).strict();
5115
+ z.object({
5116
+ includeDeals: QueryBooleanSchema.default(true),
5117
+ includeProgress: QueryBooleanSchema.default(false),
5118
+ dealLimit: z.coerce.number().int().min(0).max(100).default(25)
5119
+ }).strict();
4588
5120
  var ListStageProgressSchema = z.object({
4589
5121
  total: z.number().int().min(0),
4590
5122
  attempted: z.number().int().min(0),
@@ -4595,12 +5127,48 @@ var ListStageProgressSchema = z.object({
4595
5127
  other: z.number().int().min(0),
4596
5128
  notAttempted: z.number().int().min(0)
4597
5129
  });
4598
- z.object({
5130
+ var ListProgressResponseSchema = z.object({
4599
5131
  totalMembers: z.number().int().min(0),
4600
5132
  totalCompanies: z.number().int().min(0),
4601
5133
  byCompanyStage: z.record(z.string(), ListStageProgressSchema),
4602
5134
  byContactStage: z.record(z.string(), ListStageProgressSchema)
4603
5135
  });
5136
+ var AcqListDealRefSchema = z.object({
5137
+ id: z.string(),
5138
+ contactEmail: z.string(),
5139
+ stageKey: z.string().nullable(),
5140
+ stateKey: z.string().nullable(),
5141
+ sourceType: z.string().nullable(),
5142
+ lastActivityAt: z.string()
5143
+ });
5144
+ var AcqListLineageSchema = z.object({
5145
+ deals: z.object({
5146
+ total: z.number().int().min(0),
5147
+ refs: z.array(AcqListDealRefSchema),
5148
+ truncated: z.boolean()
5149
+ })
5150
+ });
5151
+ AcqListResponseSchema.extend({
5152
+ lineage: AcqListLineageSchema.optional(),
5153
+ progress: ListProgressResponseSchema.optional()
5154
+ });
5155
+ var AcqListStatusListItemSchema = z.object({
5156
+ listId: z.string(),
5157
+ name: z.string(),
5158
+ status: ListStatusSchema,
5159
+ totalCompanies: z.number().int().min(0),
5160
+ totalContacts: z.number().int().min(0),
5161
+ totalDeals: z.number().int().min(0),
5162
+ createdAt: z.string()
5163
+ });
5164
+ z.object({
5165
+ totalLists: z.number().int().min(0),
5166
+ totalCompanies: z.number().int().min(0),
5167
+ totalContacts: z.number().int().min(0),
5168
+ totalDeals: z.number().int().min(0),
5169
+ byStatus: z.record(z.string(), z.number().int().min(0)),
5170
+ lists: z.array(AcqListStatusListItemSchema)
5171
+ });
4604
5172
  var ListExecutionSummarySchema = z.object({
4605
5173
  executionId: z.string(),
4606
5174
  resourceId: z.string(),
@@ -4611,11 +5179,6 @@ var ListExecutionSummarySchema = z.object({
4611
5179
  input: z.unknown().nullable().optional()
4612
5180
  });
4613
5181
  z.array(ListExecutionSummarySchema);
4614
- var QueryBooleanSchema = z.preprocess((value) => {
4615
- if (value === "true" || value === "1" || value === true) return true;
4616
- if (value === "false" || value === "0" || value === false) return false;
4617
- return value;
4618
- }, z.boolean());
4619
5182
  var AcqCompanyStatusSchema = z.enum(["active", "invalid"]);
4620
5183
  var AcqContactStatusSchema = z.enum(["active", "invalid"]);
4621
5184
  var AcqEmailValidSchema = z.enum(["VALID", "INVALID", "RISKY", "UNKNOWN"]);
@@ -4650,6 +5213,7 @@ z.object({
4650
5213
  }).strict();
4651
5214
  z.object({
4652
5215
  name: z.string().trim().min(1).max(255),
5216
+ clientId: UuidSchema.nullable().optional(),
4653
5217
  domain: z.string().trim().min(1).max(255).optional(),
4654
5218
  linkedinUrl: z.string().trim().url().optional(),
4655
5219
  website: z.string().trim().url().optional(),
@@ -4665,6 +5229,7 @@ z.object({
4665
5229
  }).strict();
4666
5230
  z.object({
4667
5231
  name: z.string().trim().min(1).max(255).optional(),
5232
+ clientId: UuidSchema.nullable().optional(),
4668
5233
  domain: z.string().trim().min(1).max(255).optional(),
4669
5234
  linkedinUrl: z.string().trim().url().optional(),
4670
5235
  website: z.string().trim().url().optional(),
@@ -4682,13 +5247,14 @@ z.object({
4682
5247
  status: AcqCompanyStatusSchema.optional(),
4683
5248
  verticalResearch: z.string().trim().min(1).max(5e3).nullable().optional()
4684
5249
  }).strict().refine(
4685
- (data) => data.name !== void 0 || data.domain !== void 0 || data.linkedinUrl !== void 0 || data.website !== void 0 || data.numEmployees !== void 0 || data.foundedYear !== void 0 || data.locationCity !== void 0 || data.locationState !== void 0 || data.category !== void 0 || data.segment !== void 0 || data.processingState !== void 0 || data.pipelineStatus !== void 0 || data.enrichmentData !== void 0 || data.source !== void 0 || data.batchId !== void 0 || data.status !== void 0 || data.verticalResearch !== void 0,
5250
+ (data) => data.name !== void 0 || data.clientId !== void 0 || data.domain !== void 0 || data.linkedinUrl !== void 0 || data.website !== void 0 || data.numEmployees !== void 0 || data.foundedYear !== void 0 || data.locationCity !== void 0 || data.locationState !== void 0 || data.category !== void 0 || data.segment !== void 0 || data.processingState !== void 0 || data.pipelineStatus !== void 0 || data.enrichmentData !== void 0 || data.source !== void 0 || data.batchId !== void 0 || data.status !== void 0 || data.verticalResearch !== void 0,
4686
5251
  {
4687
5252
  message: "At least one field must be provided"
4688
5253
  }
4689
5254
  );
4690
5255
  z.object({
4691
5256
  email: z.string().trim().email(),
5257
+ clientId: UuidSchema.nullable().optional(),
4692
5258
  companyId: UuidSchema.optional(),
4693
5259
  firstName: z.string().trim().min(1).max(255).optional(),
4694
5260
  lastName: z.string().trim().min(1).max(255).optional(),
@@ -4701,6 +5267,7 @@ z.object({
4701
5267
  }).strict();
4702
5268
  z.object({
4703
5269
  companyId: UuidSchema.optional(),
5270
+ clientId: UuidSchema.nullable().optional(),
4704
5271
  emailValid: AcqEmailValidSchema.optional(),
4705
5272
  firstName: z.string().trim().min(1).max(255).optional(),
4706
5273
  lastName: z.string().trim().min(1).max(255).optional(),
@@ -4714,7 +5281,7 @@ z.object({
4714
5281
  enrichmentData: z.record(z.string(), z.unknown()).optional(),
4715
5282
  status: AcqContactStatusSchema.optional()
4716
5283
  }).strict().refine(
4717
- (data) => data.companyId !== void 0 || data.emailValid !== void 0 || data.firstName !== void 0 || data.lastName !== void 0 || data.linkedinUrl !== void 0 || data.title !== void 0 || data.headline !== void 0 || data.filterReason !== void 0 || data.openingLine !== void 0 || data.processingState !== void 0 || data.pipelineStatus !== void 0 || data.enrichmentData !== void 0 || data.status !== void 0,
5284
+ (data) => data.companyId !== void 0 || data.clientId !== void 0 || data.emailValid !== void 0 || data.firstName !== void 0 || data.lastName !== void 0 || data.linkedinUrl !== void 0 || data.title !== void 0 || data.headline !== void 0 || data.filterReason !== void 0 || data.openingLine !== void 0 || data.processingState !== void 0 || data.pipelineStatus !== void 0 || data.enrichmentData !== void 0 || data.status !== void 0,
4718
5285
  {
4719
5286
  message: "At least one field must be provided"
4720
5287
  }
@@ -4722,6 +5289,7 @@ z.object({
4722
5289
  var AcqCompanyResponseSchema = z.object({
4723
5290
  id: z.string(),
4724
5291
  organizationId: z.string(),
5292
+ clientId: z.string().nullable().optional(),
4725
5293
  name: z.string(),
4726
5294
  domain: z.string().nullable(),
4727
5295
  linkedinUrl: z.string().nullable(),
@@ -4768,6 +5336,7 @@ var AcqContactCompanySummarySchema = z.object({
4768
5336
  var AcqContactResponseSchema = z.object({
4769
5337
  id: z.string(),
4770
5338
  organizationId: z.string(),
5339
+ clientId: z.string().nullable().optional(),
4771
5340
  companyId: z.string().nullable(),
4772
5341
  email: z.string(),
4773
5342
  emailValid: AcqEmailValidSchema.nullable(),
@@ -4827,6 +5396,24 @@ z.object({
4827
5396
  limit: z.coerce.number().int().min(1).max(500).default(50),
4828
5397
  offset: z.coerce.number().int().min(0).default(0)
4829
5398
  }).strict();
5399
+ var ListRecordEntitySchema = z.enum(["company", "contact"]);
5400
+ z.object({
5401
+ entity: ListRecordEntitySchema,
5402
+ stage: LeadGenStageKeySchema.optional(),
5403
+ limit: z.coerce.number().int().min(1).max(500).default(50),
5404
+ offset: z.coerce.number().int().min(0).default(0)
5405
+ }).strict().superRefine((query, ctx) => {
5406
+ if (!query.stage) return;
5407
+ const stage = LEAD_GEN_STAGE_CATALOG[query.stage];
5408
+ const validEntity = stage?.entity === query.entity || stage?.additionalEntities?.includes(query.entity) || stage?.recordEntity === query.entity;
5409
+ if (!validEntity) {
5410
+ ctx.addIssue({
5411
+ code: z.ZodIssueCode.custom,
5412
+ message: `stage "${query.stage}" is not valid for ${query.entity} records`,
5413
+ path: ["stage"]
5414
+ });
5415
+ }
5416
+ });
4830
5417
  z.object({
4831
5418
  memberId: UuidSchema
4832
5419
  });
@@ -4855,6 +5442,70 @@ var AcqListMemberResponseSchema = z.object({
4855
5442
  z.object({
4856
5443
  members: z.array(AcqListMemberResponseSchema)
4857
5444
  });
5445
+ var AcqListRecordCompanySummarySchema = z.object({
5446
+ id: z.string(),
5447
+ name: z.string(),
5448
+ domain: z.string().nullable(),
5449
+ website: z.string().nullable(),
5450
+ linkedinUrl: z.string().nullable(),
5451
+ numEmployees: z.number().nullable(),
5452
+ foundedYear: z.number().nullable(),
5453
+ locationCity: z.string().nullable(),
5454
+ locationState: z.string().nullable(),
5455
+ category: z.string().nullable(),
5456
+ segment: z.string().nullable(),
5457
+ status: AcqCompanyStatusSchema,
5458
+ qualificationScore: z.number().nullable(),
5459
+ qualificationSignals: z.record(z.string(), z.unknown()).nullable(),
5460
+ qualificationRubricKey: z.string().nullable()
5461
+ });
5462
+ var AcqListRecordContactSummarySchema = z.object({
5463
+ id: z.string(),
5464
+ email: z.string(),
5465
+ firstName: z.string().nullable(),
5466
+ lastName: z.string().nullable(),
5467
+ title: z.string().nullable(),
5468
+ headline: z.string().nullable(),
5469
+ linkedinUrl: z.string().nullable(),
5470
+ companyId: z.string().nullable(),
5471
+ status: AcqContactStatusSchema,
5472
+ qualificationScore: z.number().nullable(),
5473
+ qualificationSignals: z.record(z.string(), z.unknown()).nullable(),
5474
+ qualificationRubricKey: z.string().nullable()
5475
+ });
5476
+ var ListRecordBaseSchema = z.object({
5477
+ id: z.string(),
5478
+ listId: z.string(),
5479
+ pipelineKey: z.string(),
5480
+ stageKey: z.string(),
5481
+ stateKey: z.string(),
5482
+ activityLog: z.unknown(),
5483
+ addedAt: z.string(),
5484
+ addedBy: z.string().nullable(),
5485
+ sourceExecutionId: z.string().nullable(),
5486
+ processingState: z.record(z.string(), z.unknown()).nullable(),
5487
+ enrichmentData: z.record(z.string(), z.unknown()).nullable()
5488
+ });
5489
+ var AcqListCompanyRecordRowSchema = ListRecordBaseSchema.extend({
5490
+ entity: z.literal("company"),
5491
+ companyId: z.string(),
5492
+ company: AcqListRecordCompanySummarySchema.nullable()
5493
+ });
5494
+ var AcqListContactRecordRowSchema = ListRecordBaseSchema.extend({
5495
+ entity: z.literal("contact"),
5496
+ contactId: z.string(),
5497
+ contact: AcqListRecordContactSummarySchema.nullable()
5498
+ });
5499
+ var ListRecordRowSchema = z.discriminatedUnion("entity", [
5500
+ AcqListCompanyRecordRowSchema,
5501
+ AcqListContactRecordRowSchema
5502
+ ]);
5503
+ z.object({
5504
+ data: z.array(ListRecordRowSchema),
5505
+ total: z.number().int().min(0),
5506
+ limit: z.number().int().min(1),
5507
+ offset: z.number().int().min(0)
5508
+ });
4858
5509
  z.object({
4859
5510
  listCompanyId: UuidSchema
4860
5511
  });
@@ -5019,4 +5670,4 @@ function isOurReplyAction(deal) {
5019
5670
  var listBuilderStageKeys = Object.keys(LEAD_GEN_STAGE_CATALOG);
5020
5671
  var ListBuilderStageKeySchema = z.enum(listBuilderStageKeys);
5021
5672
 
5022
- export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ProspectingBuildTemplateSchema as BuildTemplateSchema, DEFAULT_CRM_ACTIONS, EmailSchema, ExecutionError, LEAD_GEN_STAGE_CATALOG, ListBuilderStageKeySchema, ProcessingStageStatusSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, deriveActions };
5673
+ export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ProspectingBuildTemplateSchema as BuildTemplateSchema, CRM_PIPELINE_DEFINITION, CrmStageKeySchema, CrmStateKeySchema, DEFAULT_CRM_ACTIONS, EmailSchema, ExecutionError, LEAD_GEN_STAGE_CATALOG, ListBuilderStageKeySchema, ProcessingStageStatusSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, deriveActions, validateResourceGovernance };