@elevasis/sdk 1.13.1 → 1.13.2

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/dist/cli.cjs CHANGED
@@ -40481,7 +40481,7 @@ function wrapAction(commandName, fn) {
40481
40481
  // package.json
40482
40482
  var package_default = {
40483
40483
  name: "@elevasis/sdk",
40484
- version: "1.13.1",
40484
+ version: "1.13.2",
40485
40485
  description: "SDK for building Elevasis organization resources",
40486
40486
  type: "module",
40487
40487
  bin: {
package/dist/index.d.ts CHANGED
@@ -702,6 +702,16 @@ interface WorkflowDefinition {
702
702
  * If provided, workflow appears in Execution Runner UI
703
703
  */
704
704
  interface?: ExecutionInterface;
705
+ /**
706
+ * Lead-gen processing stage this workflow implements (optional).
707
+ * Must match a key in the platform lead-gen stage catalog.
708
+ * Used by org-os graph derivation to surface workflow→stage edges and
709
+ * by pipeline_config validation to confirm each catalog stage has an
710
+ * implementing workflow before a list is activated.
711
+ *
712
+ * Example: stageImplemented: 'verified' on the email-verification workflow.
713
+ */
714
+ stageImplemented?: string;
705
715
  }
706
716
 
707
717
  /**
@@ -1875,57 +1885,54 @@ type Database = {
1875
1885
  };
1876
1886
  acq_lists: {
1877
1887
  Row: {
1878
- activity_log: Json;
1879
1888
  batch_ids: string[];
1880
1889
  completed_at: string | null;
1881
- config: Json;
1882
1890
  created_at: string;
1883
1891
  description: string | null;
1892
+ icp: Json;
1884
1893
  id: string;
1885
1894
  instantly_campaign_id: string | null;
1886
1895
  launched_at: string | null;
1887
1896
  metadata: Json;
1888
1897
  name: string;
1889
1898
  organization_id: string;
1890
- pipeline_key: string;
1891
- stage_key: string;
1892
- state_key: string;
1899
+ pipeline_config: Json;
1900
+ scraping_config: Json;
1901
+ status: string;
1893
1902
  type: string;
1894
1903
  };
1895
1904
  Insert: {
1896
- activity_log?: Json;
1897
1905
  batch_ids?: string[];
1898
1906
  completed_at?: string | null;
1899
- config?: Json;
1900
1907
  created_at?: string;
1901
1908
  description?: string | null;
1909
+ icp?: Json;
1902
1910
  id?: string;
1903
1911
  instantly_campaign_id?: string | null;
1904
1912
  launched_at?: string | null;
1905
1913
  metadata?: Json;
1906
1914
  name: string;
1907
1915
  organization_id: string;
1908
- pipeline_key?: string;
1909
- stage_key?: string;
1910
- state_key?: string;
1916
+ pipeline_config?: Json;
1917
+ scraping_config?: Json;
1918
+ status?: string;
1911
1919
  type?: string;
1912
1920
  };
1913
1921
  Update: {
1914
- activity_log?: Json;
1915
1922
  batch_ids?: string[];
1916
1923
  completed_at?: string | null;
1917
- config?: Json;
1918
1924
  created_at?: string;
1919
1925
  description?: string | null;
1926
+ icp?: Json;
1920
1927
  id?: string;
1921
1928
  instantly_campaign_id?: string | null;
1922
1929
  launched_at?: string | null;
1923
1930
  metadata?: Json;
1924
1931
  name?: string;
1925
1932
  organization_id?: string;
1926
- pipeline_key?: string;
1927
- stage_key?: string;
1928
- state_key?: string;
1933
+ pipeline_config?: Json;
1934
+ scraping_config?: Json;
1935
+ status?: string;
1929
1936
  type?: string;
1930
1937
  };
1931
1938
  Relationships: [
@@ -4167,14 +4174,34 @@ interface ContactEnrichmentData {
4167
4174
  }>;
4168
4175
  };
4169
4176
  }
4170
- /**
4171
- * Acquisition list for organizing contacts and companies.
4172
- * Transformed from AcqListRow with camelCase properties.
4173
- *
4174
- * Track B: acq_lists adopts the Stateful trait (pipeline_key / stage_key / state_key / activity_log).
4175
- * `status` is preserved as a convenience alias for `state_key` so existing consumers continue to
4176
- * compile until they are migrated to read the trait fields directly.
4177
- */
4177
+ type ListStatus = 'draft' | 'enriching' | 'launched' | 'closing' | 'archived';
4178
+ interface ScrapingConfig {
4179
+ source?: string;
4180
+ query?: string;
4181
+ filters?: Record<string, unknown>;
4182
+ [key: string]: unknown;
4183
+ }
4184
+ interface IcpRubric {
4185
+ targetDescription?: string;
4186
+ minReviewCount?: number;
4187
+ minRating?: number;
4188
+ excludeFranchises?: boolean;
4189
+ customRules?: string;
4190
+ qualificationRubricKey?: string | null;
4191
+ [key: string]: unknown;
4192
+ }
4193
+ interface PipelineStage {
4194
+ key: string;
4195
+ label?: string;
4196
+ description?: string;
4197
+ resourceId?: string;
4198
+ inputTemplate?: Record<string, unknown>;
4199
+ enabled?: boolean;
4200
+ order?: number;
4201
+ }
4202
+ interface PipelineConfig {
4203
+ stages: PipelineStage[];
4204
+ }
4178
4205
  interface AcqList {
4179
4206
  id: string;
4180
4207
  organizationId: string;
@@ -4183,19 +4210,14 @@ interface AcqList {
4183
4210
  type: string;
4184
4211
  batchIds: string[];
4185
4212
  instantlyCampaignId: string | null;
4186
- /** @deprecated Use state_key. Retained as alias mapped from state_key for backward-compatibility. */
4187
- status: string;
4188
- /** Stateful trait: pipeline identifier (always 'lead-gen' for acq_lists). Added by W2 migration. */
4189
- pipelineKey: string;
4190
- /** Stateful trait: stage within the pipeline (always 'lifecycle' for acq_lists). Added by W2 migration. */
4191
- stageKey: string;
4192
- /** Stateful trait: lifecycle state (draft | enriching | launched | closing | archived). Added by W2 migration. */
4193
- stateKey: string;
4213
+ status: ListStatus;
4214
+ scrapingConfig: ScrapingConfig;
4215
+ icp: IcpRubric;
4216
+ pipelineConfig: PipelineConfig;
4194
4217
  metadata: Record<string, unknown>;
4195
4218
  launchedAt: Date | null;
4196
4219
  completedAt: Date | null;
4197
4220
  createdAt: Date;
4198
- config: ListConfig;
4199
4221
  }
4200
4222
  /**
4201
4223
  * Company record in the acquisition database.
@@ -4307,76 +4329,6 @@ interface AcqDealTask {
4307
4329
  updatedAt: string;
4308
4330
  createdByUserId: string | null;
4309
4331
  }
4310
- /**
4311
- * One ordered step in a list's pipeline. Maps to a deployed workflow
4312
- * (e.g. 'lgn-03-company-qualification-workflow'). The `inputTemplate`
4313
- * is merged with `{ listId }` at run time to form the workflow input.
4314
- */
4315
- interface PipelineStep {
4316
- /** Stable key, e.g. 'scrape' | 'extract' | 'qualify' | 'discover' | 'verify' | 'personalize'. */
4317
- key: string;
4318
- /** Human label rendered in the UI stepper. */
4319
- label: string;
4320
- /** Deployed workflow resourceId (e.g. 'lgn-03-company-qualification-workflow'). */
4321
- resourceId: string;
4322
- /** Input defaults merged with `{ listId }` at dispatch. */
4323
- inputTemplate: Record<string, unknown>;
4324
- /** Whether the UI shows the Run button. */
4325
- enabled: boolean;
4326
- /** Display order (ascending). */
4327
- order: number;
4328
- }
4329
- type CompanyListStage = 'populated' | 'extracted' | 'qualified';
4330
- type ContactListStage = 'discovered' | 'verified' | 'personalized' | 'uploaded';
4331
- /**
4332
- * Per-list pipeline configuration stored as jsonb in `acq_lists.config`.
4333
- *
4334
- * `qualification` is the only required subtree. Every other subtree is optional
4335
- * and inherits global defaults when omitted: workflows resolve values as
4336
- * `list.config.foo ?? globalDefaults.foo`. Seeded rows from
4337
- * `20260413000100_backfill_list_configs.sql` only populate `qualification`
4338
- * and `scraping`; the rest was intentionally omitted.
4339
- */
4340
- interface ListConfig {
4341
- qualification: {
4342
- /** One-line description of the target vertical/segment. */
4343
- targetDescription: string;
4344
- /** Minimum Google review count to qualify. */
4345
- minReviewCount: number;
4346
- /** Minimum Google star rating to qualify (e.g. 3.0). */
4347
- minRating: number;
4348
- /** Whether to exclude franchises/chains during qualification. */
4349
- excludeFranchises: boolean;
4350
- /** Free-form LLM rules layered on top of the structured criteria. */
4351
- customRules: string;
4352
- /**
4353
- * Free-form text key identifying the ICP qualification rubric applied to this list.
4354
- * Decision C4: stays as free-form text until an Org OS rubric registry lands.
4355
- */
4356
- qualificationRubricKey?: string | null;
4357
- };
4358
- enrichment?: {
4359
- emailDiscovery?: {
4360
- primary: 'tomba' | 'anymailfinder';
4361
- credentialName?: string;
4362
- };
4363
- emailVerification?: {
4364
- provider: 'millionverifier';
4365
- threshold?: 'ok' | 'ok+catch_all';
4366
- };
4367
- };
4368
- personalization?: {
4369
- industryContext?: string;
4370
- /** Email body template with tags like {{opening_line}} / {{category_pain}}. */
4371
- emailBody?: string;
4372
- creativeDirection?: string;
4373
- /** Contradiction-prevention rules layered into the personalization prompt. */
4374
- exclusionRules?: string[];
4375
- };
4376
- pipeline?: {
4377
- steps: PipelineStep[];
4378
- };
4379
- }
4380
4332
 
4381
4333
  /**
4382
4334
  * Lead Service Types
@@ -4398,14 +4350,15 @@ interface CreateListParams {
4398
4350
  type?: string;
4399
4351
  batchIds?: string[];
4400
4352
  instantlyCampaignId?: string;
4401
- status?: string;
4353
+ status?: ListStatus;
4402
4354
  metadata?: Record<string, unknown>;
4403
- config?: ListConfig;
4355
+ scrapingConfig?: ScrapingConfig;
4356
+ icp?: IcpRubric;
4357
+ pipelineConfig?: PipelineConfig;
4404
4358
  }
4405
4359
  interface UpdateListParams {
4406
4360
  name?: string;
4407
4361
  description?: string;
4408
- status?: string;
4409
4362
  batchIds?: string[];
4410
4363
  }
4411
4364
  interface CreateCompanyParams {
@@ -4730,14 +4683,14 @@ interface UpdateCompanyStageParams {
4730
4683
  organizationId: string;
4731
4684
  listId: string;
4732
4685
  companyId: string;
4733
- stage: CompanyListStage;
4686
+ stage: string;
4734
4687
  executionId?: string;
4735
4688
  }
4736
4689
  interface UpdateContactStageParams {
4737
4690
  organizationId: string;
4738
4691
  listId: string;
4739
4692
  contactId: string;
4740
- stage: ContactListStage;
4693
+ stage: string;
4741
4694
  executionId?: string;
4742
4695
  }
4743
4696
  interface RecordListExecutionParams {
@@ -8086,7 +8039,11 @@ type ListToolMap = {
8086
8039
  params: {
8087
8040
  listId: string;
8088
8041
  };
8089
- result: ListConfig;
8042
+ result: {
8043
+ scrapingConfig: ScrapingConfig;
8044
+ icp: IcpRubric;
8045
+ pipelineConfig: PipelineConfig;
8046
+ };
8090
8047
  };
8091
8048
  recordExecution: {
8092
8049
  params: Omit<RecordListExecutionParams, 'organizationId'>;
package/dist/index.js CHANGED
@@ -3726,8 +3726,9 @@ var ActivityEventSchema = z.discriminatedUnion("type", [
3726
3726
  TaskCreatedEventSchema,
3727
3727
  DealCreatedEventSchema
3728
3728
  ]);
3729
-
3730
- // ../core/src/business/acquisition/derive-actions.ts
3729
+ var SendReplyActionPayloadSchema = z.object({
3730
+ replyBody: z.string().trim().min(1).max(1e4)
3731
+ }).strict();
3731
3732
  var DEFAULT_CRM_ACTIONS = [
3732
3733
  {
3733
3734
  key: "move_to_proposal",
@@ -3759,6 +3760,13 @@ var DEFAULT_CRM_ACTIONS = [
3759
3760
  isAvailableFor: (deal) => deal.stage_key === "interested" || deal.stage_key === "proposal" || deal.stage_key === "closing",
3760
3761
  workflowId: "move_to_nurturing-workflow"
3761
3762
  },
3763
+ {
3764
+ key: "send_reply",
3765
+ label: "Send Reply",
3766
+ isAvailableFor: (deal) => deal.stage_key === "interested" && deal.state_key === "discovery_replied",
3767
+ workflowId: "crm-send-reply-workflow",
3768
+ payloadSchema: SendReplyActionPayloadSchema
3769
+ },
3762
3770
  {
3763
3771
  key: "send_link",
3764
3772
  label: "Send Booking Link",
@@ -483,6 +483,16 @@ interface WorkflowDefinition {
483
483
  * If provided, workflow appears in Execution Runner UI
484
484
  */
485
485
  interface?: ExecutionInterface;
486
+ /**
487
+ * Lead-gen processing stage this workflow implements (optional).
488
+ * Must match a key in the platform lead-gen stage catalog.
489
+ * Used by org-os graph derivation to surface workflow→stage edges and
490
+ * by pipeline_config validation to confirm each catalog stage has an
491
+ * implementing workflow before a list is activated.
492
+ *
493
+ * Example: stageImplemented: 'verified' on the email-verification workflow.
494
+ */
495
+ stageImplemented?: string;
486
496
  }
487
497
 
488
498
  /**
@@ -1656,57 +1666,54 @@ type Database = {
1656
1666
  };
1657
1667
  acq_lists: {
1658
1668
  Row: {
1659
- activity_log: Json;
1660
1669
  batch_ids: string[];
1661
1670
  completed_at: string | null;
1662
- config: Json;
1663
1671
  created_at: string;
1664
1672
  description: string | null;
1673
+ icp: Json;
1665
1674
  id: string;
1666
1675
  instantly_campaign_id: string | null;
1667
1676
  launched_at: string | null;
1668
1677
  metadata: Json;
1669
1678
  name: string;
1670
1679
  organization_id: string;
1671
- pipeline_key: string;
1672
- stage_key: string;
1673
- state_key: string;
1680
+ pipeline_config: Json;
1681
+ scraping_config: Json;
1682
+ status: string;
1674
1683
  type: string;
1675
1684
  };
1676
1685
  Insert: {
1677
- activity_log?: Json;
1678
1686
  batch_ids?: string[];
1679
1687
  completed_at?: string | null;
1680
- config?: Json;
1681
1688
  created_at?: string;
1682
1689
  description?: string | null;
1690
+ icp?: Json;
1683
1691
  id?: string;
1684
1692
  instantly_campaign_id?: string | null;
1685
1693
  launched_at?: string | null;
1686
1694
  metadata?: Json;
1687
1695
  name: string;
1688
1696
  organization_id: string;
1689
- pipeline_key?: string;
1690
- stage_key?: string;
1691
- state_key?: string;
1697
+ pipeline_config?: Json;
1698
+ scraping_config?: Json;
1699
+ status?: string;
1692
1700
  type?: string;
1693
1701
  };
1694
1702
  Update: {
1695
- activity_log?: Json;
1696
1703
  batch_ids?: string[];
1697
1704
  completed_at?: string | null;
1698
- config?: Json;
1699
1705
  created_at?: string;
1700
1706
  description?: string | null;
1707
+ icp?: Json;
1701
1708
  id?: string;
1702
1709
  instantly_campaign_id?: string | null;
1703
1710
  launched_at?: string | null;
1704
1711
  metadata?: Json;
1705
1712
  name?: string;
1706
1713
  organization_id?: string;
1707
- pipeline_key?: string;
1708
- stage_key?: string;
1709
- state_key?: string;
1714
+ pipeline_config?: Json;
1715
+ scraping_config?: Json;
1716
+ status?: string;
1710
1717
  type?: string;
1711
1718
  };
1712
1719
  Relationships: [
@@ -3948,14 +3955,34 @@ interface ContactEnrichmentData {
3948
3955
  }>;
3949
3956
  };
3950
3957
  }
3951
- /**
3952
- * Acquisition list for organizing contacts and companies.
3953
- * Transformed from AcqListRow with camelCase properties.
3954
- *
3955
- * Track B: acq_lists adopts the Stateful trait (pipeline_key / stage_key / state_key / activity_log).
3956
- * `status` is preserved as a convenience alias for `state_key` so existing consumers continue to
3957
- * compile until they are migrated to read the trait fields directly.
3958
- */
3958
+ type ListStatus = 'draft' | 'enriching' | 'launched' | 'closing' | 'archived';
3959
+ interface ScrapingConfig {
3960
+ source?: string;
3961
+ query?: string;
3962
+ filters?: Record<string, unknown>;
3963
+ [key: string]: unknown;
3964
+ }
3965
+ interface IcpRubric {
3966
+ targetDescription?: string;
3967
+ minReviewCount?: number;
3968
+ minRating?: number;
3969
+ excludeFranchises?: boolean;
3970
+ customRules?: string;
3971
+ qualificationRubricKey?: string | null;
3972
+ [key: string]: unknown;
3973
+ }
3974
+ interface PipelineStage {
3975
+ key: string;
3976
+ label?: string;
3977
+ description?: string;
3978
+ resourceId?: string;
3979
+ inputTemplate?: Record<string, unknown>;
3980
+ enabled?: boolean;
3981
+ order?: number;
3982
+ }
3983
+ interface PipelineConfig {
3984
+ stages: PipelineStage[];
3985
+ }
3959
3986
  interface AcqList {
3960
3987
  id: string;
3961
3988
  organizationId: string;
@@ -3964,19 +3991,14 @@ interface AcqList {
3964
3991
  type: string;
3965
3992
  batchIds: string[];
3966
3993
  instantlyCampaignId: string | null;
3967
- /** @deprecated Use state_key. Retained as alias mapped from state_key for backward-compatibility. */
3968
- status: string;
3969
- /** Stateful trait: pipeline identifier (always 'lead-gen' for acq_lists). Added by W2 migration. */
3970
- pipelineKey: string;
3971
- /** Stateful trait: stage within the pipeline (always 'lifecycle' for acq_lists). Added by W2 migration. */
3972
- stageKey: string;
3973
- /** Stateful trait: lifecycle state (draft | enriching | launched | closing | archived). Added by W2 migration. */
3974
- stateKey: string;
3994
+ status: ListStatus;
3995
+ scrapingConfig: ScrapingConfig;
3996
+ icp: IcpRubric;
3997
+ pipelineConfig: PipelineConfig;
3975
3998
  metadata: Record<string, unknown>;
3976
3999
  launchedAt: Date | null;
3977
4000
  completedAt: Date | null;
3978
4001
  createdAt: Date;
3979
- config: ListConfig;
3980
4002
  }
3981
4003
  /**
3982
4004
  * Company record in the acquisition database.
@@ -4088,76 +4110,6 @@ interface AcqDealTask {
4088
4110
  updatedAt: string;
4089
4111
  createdByUserId: string | null;
4090
4112
  }
4091
- /**
4092
- * One ordered step in a list's pipeline. Maps to a deployed workflow
4093
- * (e.g. 'lgn-03-company-qualification-workflow'). The `inputTemplate`
4094
- * is merged with `{ listId }` at run time to form the workflow input.
4095
- */
4096
- interface PipelineStep {
4097
- /** Stable key, e.g. 'scrape' | 'extract' | 'qualify' | 'discover' | 'verify' | 'personalize'. */
4098
- key: string;
4099
- /** Human label rendered in the UI stepper. */
4100
- label: string;
4101
- /** Deployed workflow resourceId (e.g. 'lgn-03-company-qualification-workflow'). */
4102
- resourceId: string;
4103
- /** Input defaults merged with `{ listId }` at dispatch. */
4104
- inputTemplate: Record<string, unknown>;
4105
- /** Whether the UI shows the Run button. */
4106
- enabled: boolean;
4107
- /** Display order (ascending). */
4108
- order: number;
4109
- }
4110
- type CompanyListStage = 'populated' | 'extracted' | 'qualified';
4111
- type ContactListStage = 'discovered' | 'verified' | 'personalized' | 'uploaded';
4112
- /**
4113
- * Per-list pipeline configuration stored as jsonb in `acq_lists.config`.
4114
- *
4115
- * `qualification` is the only required subtree. Every other subtree is optional
4116
- * and inherits global defaults when omitted: workflows resolve values as
4117
- * `list.config.foo ?? globalDefaults.foo`. Seeded rows from
4118
- * `20260413000100_backfill_list_configs.sql` only populate `qualification`
4119
- * and `scraping`; the rest was intentionally omitted.
4120
- */
4121
- interface ListConfig {
4122
- qualification: {
4123
- /** One-line description of the target vertical/segment. */
4124
- targetDescription: string;
4125
- /** Minimum Google review count to qualify. */
4126
- minReviewCount: number;
4127
- /** Minimum Google star rating to qualify (e.g. 3.0). */
4128
- minRating: number;
4129
- /** Whether to exclude franchises/chains during qualification. */
4130
- excludeFranchises: boolean;
4131
- /** Free-form LLM rules layered on top of the structured criteria. */
4132
- customRules: string;
4133
- /**
4134
- * Free-form text key identifying the ICP qualification rubric applied to this list.
4135
- * Decision C4: stays as free-form text until an Org OS rubric registry lands.
4136
- */
4137
- qualificationRubricKey?: string | null;
4138
- };
4139
- enrichment?: {
4140
- emailDiscovery?: {
4141
- primary: 'tomba' | 'anymailfinder';
4142
- credentialName?: string;
4143
- };
4144
- emailVerification?: {
4145
- provider: 'millionverifier';
4146
- threshold?: 'ok' | 'ok+catch_all';
4147
- };
4148
- };
4149
- personalization?: {
4150
- industryContext?: string;
4151
- /** Email body template with tags like {{opening_line}} / {{category_pain}}. */
4152
- emailBody?: string;
4153
- creativeDirection?: string;
4154
- /** Contradiction-prevention rules layered into the personalization prompt. */
4155
- exclusionRules?: string[];
4156
- };
4157
- pipeline?: {
4158
- steps: PipelineStep[];
4159
- };
4160
- }
4161
4113
 
4162
4114
  /**
4163
4115
  * Lead Service Types
@@ -4179,14 +4131,15 @@ interface CreateListParams {
4179
4131
  type?: string;
4180
4132
  batchIds?: string[];
4181
4133
  instantlyCampaignId?: string;
4182
- status?: string;
4134
+ status?: ListStatus;
4183
4135
  metadata?: Record<string, unknown>;
4184
- config?: ListConfig;
4136
+ scrapingConfig?: ScrapingConfig;
4137
+ icp?: IcpRubric;
4138
+ pipelineConfig?: PipelineConfig;
4185
4139
  }
4186
4140
  interface UpdateListParams {
4187
4141
  name?: string;
4188
4142
  description?: string;
4189
- status?: string;
4190
4143
  batchIds?: string[];
4191
4144
  }
4192
4145
  interface CreateCompanyParams {
@@ -4511,14 +4464,14 @@ interface UpdateCompanyStageParams {
4511
4464
  organizationId: string;
4512
4465
  listId: string;
4513
4466
  companyId: string;
4514
- stage: CompanyListStage;
4467
+ stage: string;
4515
4468
  executionId?: string;
4516
4469
  }
4517
4470
  interface UpdateContactStageParams {
4518
4471
  organizationId: string;
4519
4472
  listId: string;
4520
4473
  contactId: string;
4521
- stage: ContactListStage;
4474
+ stage: string;
4522
4475
  executionId?: string;
4523
4476
  }
4524
4477
  interface RecordListExecutionParams {
@@ -7798,7 +7751,11 @@ type ListToolMap = {
7798
7751
  params: {
7799
7752
  listId: string;
7800
7753
  };
7801
- result: ListConfig;
7754
+ result: {
7755
+ scrapingConfig: ScrapingConfig;
7756
+ icp: IcpRubric;
7757
+ pipelineConfig: PipelineConfig;
7758
+ };
7802
7759
  };
7803
7760
  recordExecution: {
7804
7761
  params: Omit<RecordListExecutionParams, 'organizationId'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/sdk",
3
- "version": "1.13.1",
3
+ "version": "1.13.2",
4
4
  "description": "SDK for building Elevasis organization resources",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1342,6 +1342,13 @@ export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1342
1342
  deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1343
1343
  workflowId: 'move_to_nurturing-workflow'
1344
1344
  },
1345
+ {
1346
+ key: 'send_reply',
1347
+ label: 'Send Reply',
1348
+ isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_replied',
1349
+ workflowId: 'crm-send-reply-workflow',
1350
+ payloadSchema: SendReplyActionPayloadSchema
1351
+ },
1345
1352
  {
1346
1353
  key: 'send_link',
1347
1354
  label: 'Send Booking Link',
@@ -1534,14 +1541,6 @@ export interface ContactEnrichmentData {
1534
1541
  ### `AcqList`
1535
1542
 
1536
1543
  ```typescript
1537
- /**
1538
- * Acquisition list for organizing contacts and companies.
1539
- * Transformed from AcqListRow with camelCase properties.
1540
- *
1541
- * Track B: acq_lists adopts the Stateful trait (pipeline_key / stage_key / state_key / activity_log).
1542
- * `status` is preserved as a convenience alias for `state_key` so existing consumers continue to
1543
- * compile until they are migrated to read the trait fields directly.
1544
- */
1545
1544
  export interface AcqList {
1546
1545
  id: string
1547
1546
  organizationId: string
@@ -1550,19 +1549,14 @@ export interface AcqList {
1550
1549
  type: string
1551
1550
  batchIds: string[]
1552
1551
  instantlyCampaignId: string | null
1553
- /** @deprecated Use state_key. Retained as alias mapped from state_key for backward-compatibility. */
1554
- status: string
1555
- /** Stateful trait: pipeline identifier (always 'lead-gen' for acq_lists). Added by W2 migration. */
1556
- pipelineKey: string
1557
- /** Stateful trait: stage within the pipeline (always 'lifecycle' for acq_lists). Added by W2 migration. */
1558
- stageKey: string
1559
- /** Stateful trait: lifecycle state (draft | enriching | launched | closing | archived). Added by W2 migration. */
1560
- stateKey: string
1552
+ status: ListStatus
1553
+ scrapingConfig: ScrapingConfig
1554
+ icp: IcpRubric
1555
+ pipelineConfig: PipelineConfig
1561
1556
  metadata: Record<string, unknown>
1562
1557
  launchedAt: Date | null
1563
1558
  completedAt: Date | null
1564
1559
  createdAt: Date
1565
- config: ListConfig
1566
1560
  }
1567
1561
  ```
1568
1562
 
@@ -1639,96 +1633,6 @@ export interface AcqContact {
1639
1633
  }
1640
1634
  ```
1641
1635
 
1642
- ### `PipelineStep`
1643
-
1644
- ```typescript
1645
- /**
1646
- * One ordered step in a list's pipeline. Maps to a deployed workflow
1647
- * (e.g. 'lgn-03-company-qualification-workflow'). The `inputTemplate`
1648
- * is merged with `{ listId }` at run time to form the workflow input.
1649
- */
1650
- export interface PipelineStep {
1651
- /** Stable key, e.g. 'scrape' | 'extract' | 'qualify' | 'discover' | 'verify' | 'personalize'. */
1652
- key: string
1653
- /** Human label rendered in the UI stepper. */
1654
- label: string
1655
- /** Deployed workflow resourceId (e.g. 'lgn-03-company-qualification-workflow'). */
1656
- resourceId: string
1657
- /** Input defaults merged with `{ listId }` at dispatch. */
1658
- inputTemplate: Record<string, unknown>
1659
- /** Whether the UI shows the Run button. */
1660
- enabled: boolean
1661
- /** Display order (ascending). */
1662
- order: number
1663
- }
1664
- ```
1665
-
1666
- ### `CompanyListStage`
1667
-
1668
- ```typescript
1669
- export type CompanyListStage = 'populated' | 'extracted' | 'qualified'
1670
- ```
1671
-
1672
- ### `ContactListStage`
1673
-
1674
- ```typescript
1675
- export type ContactListStage = 'discovered' | 'verified' | 'personalized' | 'uploaded'
1676
- ```
1677
-
1678
- ### `ListConfig`
1679
-
1680
- ```typescript
1681
- /**
1682
- * Per-list pipeline configuration stored as jsonb in `acq_lists.config`.
1683
- *
1684
- * `qualification` is the only required subtree. Every other subtree is optional
1685
- * and inherits global defaults when omitted: workflows resolve values as
1686
- * `list.config.foo ?? globalDefaults.foo`. Seeded rows from
1687
- * `20260413000100_backfill_list_configs.sql` only populate `qualification`
1688
- * and `scraping`; the rest was intentionally omitted.
1689
- */
1690
- export interface ListConfig {
1691
- qualification: {
1692
- /** One-line description of the target vertical/segment. */
1693
- targetDescription: string
1694
- /** Minimum Google review count to qualify. */
1695
- minReviewCount: number
1696
- /** Minimum Google star rating to qualify (e.g. 3.0). */
1697
- minRating: number
1698
- /** Whether to exclude franchises/chains during qualification. */
1699
- excludeFranchises: boolean
1700
- /** Free-form LLM rules layered on top of the structured criteria. */
1701
- customRules: string
1702
- /**
1703
- * Free-form text key identifying the ICP qualification rubric applied to this list.
1704
- * Decision C4: stays as free-form text until an Org OS rubric registry lands.
1705
- */
1706
- qualificationRubricKey?: string | null
1707
- }
1708
- enrichment?: {
1709
- emailDiscovery?: {
1710
- primary: 'tomba' | 'anymailfinder'
1711
- credentialName?: string
1712
- }
1713
- emailVerification?: {
1714
- provider: 'millionverifier'
1715
- threshold?: 'ok' | 'ok+catch_all'
1716
- }
1717
- }
1718
- personalization?: {
1719
- industryContext?: string
1720
- /** Email body template with tags like {{opening_line}} / {{category_pain}}. */
1721
- emailBody?: string
1722
- creativeDirection?: string
1723
- /** Contradiction-prevention rules layered into the personalization prompt. */
1724
- exclusionRules?: string[]
1725
- }
1726
- pipeline?: {
1727
- steps: PipelineStep[]
1728
- }
1729
- }
1730
- ```
1731
-
1732
1636
  ### `ListTelemetry`
1733
1637
 
1734
1638
  ```typescript
@@ -1761,89 +1665,6 @@ export interface ListTelemetry {
1761
1665
  }
1762
1666
  ```
1763
1667
 
1764
- ### `ListQualificationSchema`
1765
-
1766
- ```typescript
1767
- export const ListQualificationSchema = z.object({
1768
- targetDescription: z.string(),
1769
- minReviewCount: z.number().int().min(0),
1770
- minRating: z.number().min(0).max(5),
1771
- excludeFranchises: z.boolean(),
1772
- customRules: z.string(),
1773
- /**
1774
- * Free-form text key identifying the ICP rubric applied to this list.
1775
- * Decision C4: stays free-form until an Org OS rubric registry lands.
1776
- */
1777
- qualificationRubricKey: z.string().trim().max(255).nullish()
1778
- })
1779
- ```
1780
-
1781
- ### `ListEnrichmentSchema`
1782
-
1783
- ```typescript
1784
- export const ListEnrichmentSchema = z.object({
1785
- emailDiscovery: z
1786
- .object({
1787
- primary: z.enum(['tomba', 'anymailfinder']),
1788
- credentialName: z.string().optional()
1789
- })
1790
- .optional(),
1791
- emailVerification: z
1792
- .object({
1793
- provider: z.literal('millionverifier'),
1794
- threshold: z.enum(['ok', 'ok+catch_all']).optional()
1795
- })
1796
- .optional()
1797
- })
1798
- ```
1799
-
1800
- ### `ListPersonalizationSchema`
1801
-
1802
- ```typescript
1803
- export const ListPersonalizationSchema = z.object({
1804
- industryContext: z.string().optional(),
1805
- emailBody: z.string().optional(),
1806
- creativeDirection: z.string().optional(),
1807
- exclusionRules: z.array(z.string()).optional()
1808
- })
1809
- ```
1810
-
1811
- ### `PipelineStepSchema`
1812
-
1813
- ```typescript
1814
- export const PipelineStepSchema = z.object({
1815
- key: z.string(),
1816
- label: z.string(),
1817
- resourceId: z.string(),
1818
- inputTemplate: z.record(z.string(), z.unknown()),
1819
- enabled: z.boolean(),
1820
- order: z.number().int()
1821
- })
1822
- ```
1823
-
1824
- ### `ListPipelineSchema`
1825
-
1826
- ```typescript
1827
- export const ListPipelineSchema = z.object({
1828
- steps: z.array(PipelineStepSchema)
1829
- })
1830
- ```
1831
-
1832
- ### `ListConfigSchema`
1833
-
1834
- ```typescript
1835
- /**
1836
- * Full ListConfig shape. `qualification` is required; everything else optional.
1837
- * Matches `acq_lists.config` jsonb and ListConfig type in types.ts.
1838
- */
1839
- export const ListConfigSchema = z.object({
1840
- qualification: ListQualificationSchema,
1841
- enrichment: ListEnrichmentSchema.optional(),
1842
- personalization: ListPersonalizationSchema.optional(),
1843
- pipeline: ListPipelineSchema.optional()
1844
- })
1845
- ```
1846
-
1847
1668
  ### `ListStageCountsSchema`
1848
1669
 
1849
1670
  ```typescript
@@ -1896,9 +1717,10 @@ export const CreateListRequestSchema = z
1896
1717
  name: z.string().trim().min(1).max(255),
1897
1718
  description: z.string().trim().nullable().optional(),
1898
1719
  type: z.string().default('manual'),
1899
- /** Stateful trait pipeline key. Defaults to 'lead-gen'. */
1900
- pipelineKey: z.string().trim().min(1).max(100).optional(),
1901
- config: ListConfigSchema.optional()
1720
+ status: ListStatusSchema.optional(),
1721
+ scrapingConfig: ScrapingConfigSchema.optional(),
1722
+ icp: IcpRubricSchema.optional(),
1723
+ pipelineConfig: PipelineConfigSchema.optional()
1902
1724
  })
1903
1725
  .strict()
1904
1726
  ```
@@ -1910,39 +1732,32 @@ export const UpdateListRequestSchema = z
1910
1732
  .object({
1911
1733
  name: z.string().trim().min(1).max(255).optional(),
1912
1734
  description: z.string().trim().nullable().optional(),
1913
- status: z.string().optional(),
1914
1735
  batchIds: z.array(z.string()).optional()
1915
1736
  })
1916
1737
  .strict()
1917
- .refine(
1918
- (data) =>
1919
- data.name !== undefined ||
1920
- data.description !== undefined ||
1921
- data.status !== undefined ||
1922
- data.batchIds !== undefined,
1923
- {
1924
- message: 'At least one field (name, description, status, or batchIds) must be provided'
1925
- }
1926
- )
1738
+ .refine((data) => data.name !== undefined || data.description !== undefined || data.batchIds !== undefined, {
1739
+ message: 'At least one field (name, description, or batchIds) must be provided'
1740
+ })
1927
1741
  ```
1928
1742
 
1929
1743
  ### `UpdateListConfigRequestSchema`
1930
1744
 
1931
1745
  ```typescript
1932
1746
  /**
1933
- * Partial patch for list.config UI sends only the edited tab's subtree.
1934
- * Zod v4: use .partial() on each subtree and remake the root schema.
1935
- * Since the root ListConfigSchema marks `qualification` as required, we must
1936
- * produce a manually-built deep-partial that makes qualification optional too.
1747
+ * Partial patch for the three jsonb config columns. UI sends only the edited
1748
+ * subtree; server writes the field as-is (no deep merge each column is
1749
+ * replaced atomically when present in the patch).
1937
1750
  */
1938
1751
  export const UpdateListConfigRequestSchema = z
1939
1752
  .object({
1940
- qualification: ListQualificationSchema.partial().optional(),
1941
- enrichment: ListEnrichmentSchema.partial().optional(),
1942
- personalization: ListPersonalizationSchema.partial().optional(),
1943
- pipeline: ListPipelineSchema.partial().optional()
1753
+ scrapingConfig: ScrapingConfigSchema.partial().optional(),
1754
+ icp: IcpRubricSchema.partial().optional(),
1755
+ pipelineConfig: PipelineConfigSchema.partial().optional()
1944
1756
  })
1945
1757
  .strict()
1758
+ .refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
1759
+ message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
1760
+ })
1946
1761
  ```
1947
1762
 
1948
1763
  ### `AddCompaniesToListRequestSchema`
@@ -2001,19 +1816,18 @@ export const AcqListResponseSchema = z.object({
2001
1816
  type: z.string(),
2002
1817
  batchIds: z.array(z.string()),
2003
1818
  instantlyCampaignId: z.string().nullable(),
2004
- /** @deprecated Alias for stateKey retained for backward compatibility. */
2005
- status: z.string(),
2006
- /** Stateful trait: pipeline identifier (always 'lead-gen'). Added by W2 migration. */
2007
- pipelineKey: z.string(),
2008
- /** Stateful trait: stage within the pipeline (always 'lifecycle'). Added by W2 migration. */
2009
- stageKey: z.string(),
2010
- /** Stateful trait: lifecycle state (draft | enriching | launched | closing | archived). */
2011
- stateKey: z.string(),
1819
+ /** Lifecycle status (draft | enriching | launched | closing | archived). */
1820
+ status: ListStatusSchema,
2012
1821
  metadata: z.record(z.string(), z.unknown()),
2013
1822
  launchedAt: z.string().nullable(),
2014
1823
  completedAt: z.string().nullable(),
2015
1824
  createdAt: z.string(),
2016
- config: ListConfigSchema
1825
+ /** Scraping criteria stored as jsonb on the row. */
1826
+ scrapingConfig: ScrapingConfigSchema,
1827
+ /** ICP / qualification rubric stored as jsonb on the row. */
1828
+ icp: IcpRubricSchema,
1829
+ /** Pipeline presentation contract stored as jsonb on the row. */
1830
+ pipelineConfig: PipelineConfigSchema
2017
1831
  })
2018
1832
  ```
2019
1833
 
@@ -2576,14 +2390,18 @@ export const AcqListSchemas = {
2576
2390
  ListIdParams: ListIdParamsSchema,
2577
2391
 
2578
2392
  // Primitives (for UI / tests)
2579
- ListConfig: ListConfigSchema,
2393
+ ListStatus: ListStatusSchema,
2394
+ ScrapingConfig: ScrapingConfigSchema,
2395
+ IcpRubric: IcpRubricSchema,
2396
+ PipelineConfig: PipelineConfigSchema,
2397
+ PipelineStage: PipelineStageSchema,
2580
2398
  ListStageCounts: ListStageCountsSchema,
2581
2399
  ListTelemetry: ListTelemetrySchema,
2582
- PipelineStep: PipelineStepSchema,
2583
2400
 
2584
2401
  // Requests
2585
2402
  CreateListRequest: CreateListRequestSchema,
2586
2403
  UpdateListRequest: UpdateListRequestSchema,
2404
+ UpdateListStatusRequest: UpdateListStatusRequestSchema,
2587
2405
  UpdateListConfigRequest: UpdateListConfigRequestSchema,
2588
2406
  AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2589
2407
  RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
@@ -2713,33 +2531,6 @@ export interface StatefulPipelineDefinition {
2713
2531
  }
2714
2532
  ```
2715
2533
 
2716
- ### `ACQ_LISTS_LEAD_GEN_PIPELINE`
2717
-
2718
- ```typescript
2719
- /**
2720
- * Lead-gen pipeline definition for acq_lists.
2721
- * Single stage: 'lifecycle' with five ordered states (Decision B9).
2722
- */
2723
- export const ACQ_LISTS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2724
- pipelineKey: 'lead-gen',
2725
- label: 'Lead Generation',
2726
- entityKey: 'acq.list',
2727
- stages: [
2728
- {
2729
- stageKey: 'lifecycle',
2730
- label: 'Lifecycle',
2731
- states: [
2732
- { stateKey: 'draft', label: 'Draft' },
2733
- { stateKey: 'enriching', label: 'Enriching' },
2734
- { stateKey: 'launched', label: 'Launched' },
2735
- { stateKey: 'closing', label: 'Closing' },
2736
- { stateKey: 'archived', label: 'Archived' }
2737
- ]
2738
- }
2739
- ]
2740
- }
2741
- ```
2742
-
2743
2534
  ### `ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE`
2744
2535
 
2745
2536
  ```typescript
@@ -2829,7 +2620,6 @@ export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition =
2829
2620
  * Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
2830
2621
  */
2831
2622
  export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
2832
- 'acq.list': [ACQ_LISTS_LEAD_GEN_PIPELINE],
2833
2623
  'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
2834
2624
  'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
2835
2625
  }
@@ -2865,9 +2655,11 @@ export interface CreateListParams {
2865
2655
  type?: string
2866
2656
  batchIds?: string[]
2867
2657
  instantlyCampaignId?: string
2868
- status?: string
2658
+ status?: ListStatus
2869
2659
  metadata?: Record<string, unknown>
2870
- config?: ListConfig
2660
+ scrapingConfig?: ScrapingConfig
2661
+ icp?: IcpRubric
2662
+ pipelineConfig?: PipelineConfig
2871
2663
  }
2872
2664
  ```
2873
2665
 
@@ -2877,7 +2669,6 @@ export interface CreateListParams {
2877
2669
  export interface UpdateListParams {
2878
2670
  name?: string
2879
2671
  description?: string
2880
- status?: string
2881
2672
  batchIds?: string[]
2882
2673
  }
2883
2674
  ```
@@ -3080,8 +2871,9 @@ export interface AddContactsToListResult {
3080
2871
  export interface UpdateListConfigParams {
3081
2872
  organizationId: string
3082
2873
  listId: string
3083
- /** Deep-partial patch — any subtree that is present is replaced at that level. */
3084
- configPatch: Record<string, unknown>
2874
+ scrapingConfig?: ScrapingConfig
2875
+ icp?: IcpRubric
2876
+ pipelineConfig?: PipelineConfig
3085
2877
  }
3086
2878
  ```
3087
2879
 
@@ -3092,7 +2884,7 @@ export interface UpdateCompanyStageParams {
3092
2884
  organizationId: string
3093
2885
  listId: string
3094
2886
  companyId: string
3095
- stage: CompanyListStage
2887
+ stage: string
3096
2888
  executionId?: string
3097
2889
  }
3098
2890
  ```
@@ -3104,7 +2896,7 @@ export interface UpdateContactStageParams {
3104
2896
  organizationId: string
3105
2897
  listId: string
3106
2898
  contactId: string
3107
- stage: ContactListStage
2899
+ stage: string
3108
2900
  executionId?: string
3109
2901
  }
3110
2902
  ```
@@ -3403,7 +3195,10 @@ export type LeadToolMap = {
3403
3195
 
3404
3196
  ```typescript
3405
3197
  export type ListToolMap = {
3406
- getConfig: { params: { listId: string }; result: ListConfig }
3198
+ getConfig: {
3199
+ params: { listId: string }
3200
+ result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
3201
+ }
3407
3202
  recordExecution: {
3408
3203
  params: Omit<RecordListExecutionParams, 'organizationId'>
3409
3204
  result: void