@elevasis/sdk 1.15.1 → 1.17.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 (60) hide show
  1. package/dist/cli.cjs +2325 -124
  2. package/dist/index.d.ts +410 -473
  3. package/dist/index.js +96 -44
  4. package/dist/node/index.d.ts +69 -0
  5. package/dist/node/index.js +273 -0
  6. package/dist/test-utils/index.d.ts +473 -466
  7. package/dist/types/worker/platform.d.ts +2 -9
  8. package/package.json +12 -3
  9. package/reference/_navigation.md +23 -1
  10. package/reference/_reference-manifest.json +98 -0
  11. package/reference/claude-config/rules/agent-start-here.md +13 -0
  12. package/reference/claude-config/rules/organization-model.md +40 -40
  13. package/reference/claude-config/rules/organization-os.md +16 -16
  14. package/reference/claude-config/rules/vibe.md +13 -13
  15. package/reference/claude-config/skills/knowledge/SKILL.md +253 -0
  16. package/reference/claude-config/skills/{configure → knowledge}/operations/codify-level-a.md +100 -100
  17. package/reference/claude-config/skills/{configure → knowledge}/operations/codify-level-b.md +158 -158
  18. package/reference/claude-config/skills/knowledge/operations/customers.md +109 -0
  19. package/reference/claude-config/skills/knowledge/operations/features.md +113 -0
  20. package/reference/claude-config/skills/knowledge/operations/goals.md +118 -0
  21. package/reference/claude-config/skills/knowledge/operations/identity.md +93 -0
  22. package/reference/claude-config/skills/knowledge/operations/labels.md +89 -0
  23. package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -0
  24. package/reference/claude-config/skills/knowledge/operations/roles.md +99 -0
  25. package/reference/claude-config/skills/knowledge/operations/techStack.md +102 -0
  26. package/reference/claude-config/skills/run-ui/SKILL.md +73 -0
  27. package/reference/claude-config/skills/setup/SKILL.md +270 -270
  28. package/reference/claude-config/skills/tutorial/SKILL.md +249 -0
  29. package/reference/claude-config/skills/tutorial/progress-template.md +74 -0
  30. package/reference/claude-config/skills/tutorial/technical.md +1309 -0
  31. package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -0
  32. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -0
  33. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -0
  34. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -0
  35. package/reference/deployment/index.mdx +5 -5
  36. package/reference/examples/organization-model.ts +40 -0
  37. package/reference/framework/index.mdx +1 -1
  38. package/reference/framework/tutorial-system.mdx +86 -173
  39. package/reference/packages/core/src/knowledge/README.md +32 -0
  40. package/reference/packages/ui/src/knowledge/README.md +31 -0
  41. package/reference/packages/ui/src/theme/presets/README.md +19 -0
  42. package/reference/scaffold/core/organization-model.mdx +1 -1
  43. package/reference/scaffold/recipes/add-a-feature.md +1 -1
  44. package/reference/scaffold/recipes/customize-crm-actions.md +433 -433
  45. package/reference/scaffold/recipes/customize-organization-model.md +3 -3
  46. package/reference/scaffold/recipes/extend-lead-gen.md +90 -55
  47. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +1 -1
  48. package/reference/scaffold/recipes/index.md +6 -0
  49. package/reference/scaffold/reference/contracts.md +1265 -1154
  50. package/reference/scaffold/reference/feature-registry.md +2 -1
  51. package/reference/scaffold/ui/composition-extensibility.mdx +17 -0
  52. package/reference/claude-config/skills/configure/SKILL.md +0 -98
  53. package/reference/claude-config/skills/configure/operations/customers.md +0 -150
  54. package/reference/claude-config/skills/configure/operations/features.md +0 -162
  55. package/reference/claude-config/skills/configure/operations/goals.md +0 -147
  56. package/reference/claude-config/skills/configure/operations/identity.md +0 -133
  57. package/reference/claude-config/skills/configure/operations/labels.md +0 -128
  58. package/reference/claude-config/skills/configure/operations/offerings.md +0 -159
  59. package/reference/claude-config/skills/configure/operations/roles.md +0 -153
  60. package/reference/claude-config/skills/configure/operations/techStack.md +0 -139
@@ -237,56 +237,6 @@ interface IExecutionLogger {
237
237
  error(message: string, context?: LogContext): void;
238
238
  }
239
239
 
240
- /**
241
- * Shared form field types for dynamic form generation
242
- * Used by: Command Queue, Execution Runner UI, future form-based features
243
- */
244
- /**
245
- * Supported form field types for action payloads
246
- * Maps to Mantine form components
247
- */
248
- type FormFieldType = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' | 'radio' | 'richtext';
249
- /**
250
- * Form field definition
251
- */
252
- interface FormField {
253
- /** Field key in payload object */
254
- name: string;
255
- /** Field label for UI */
256
- label: string;
257
- /** Field type (determines UI component) */
258
- type: FormFieldType;
259
- /** Default value */
260
- defaultValue?: unknown;
261
- /** Required field */
262
- required?: boolean;
263
- /** Placeholder text */
264
- placeholder?: string;
265
- /** Help text */
266
- description?: string;
267
- /** Options for select/radio */
268
- options?: Array<{
269
- label: string;
270
- value: string | number;
271
- }>;
272
- /** Min/max for number */
273
- min?: number;
274
- max?: number;
275
- /** Path to context value for pre-filling (dot notation, e.g., 'proposal.summary') */
276
- defaultValueFromContext?: string;
277
- }
278
- /**
279
- * Form schema for action payload collection
280
- */
281
- interface FormSchema {
282
- /** Form title */
283
- title?: string;
284
- /** Form description */
285
- description?: string;
286
- /** Form fields */
287
- fields: FormField[];
288
- }
289
-
290
240
  /**
291
241
  * Model Configuration
292
242
  * Centralized model information, configuration, options, constraints, and validation
@@ -385,6 +335,56 @@ interface ModelConfig {
385
335
  modelOptions?: ModelSpecificOptions;
386
336
  }
387
337
 
338
+ /**
339
+ * Shared form field types for dynamic form generation
340
+ * Used by: Command Queue, Execution Runner UI, future form-based features
341
+ */
342
+ /**
343
+ * Supported form field types for action payloads
344
+ * Maps to Mantine form components
345
+ */
346
+ type FormFieldType = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' | 'radio' | 'richtext';
347
+ /**
348
+ * Form field definition
349
+ */
350
+ interface FormField {
351
+ /** Field key in payload object */
352
+ name: string;
353
+ /** Field label for UI */
354
+ label: string;
355
+ /** Field type (determines UI component) */
356
+ type: FormFieldType;
357
+ /** Default value */
358
+ defaultValue?: unknown;
359
+ /** Required field */
360
+ required?: boolean;
361
+ /** Placeholder text */
362
+ placeholder?: string;
363
+ /** Help text */
364
+ description?: string;
365
+ /** Options for select/radio */
366
+ options?: Array<{
367
+ label: string;
368
+ value: string | number;
369
+ }>;
370
+ /** Min/max for number */
371
+ min?: number;
372
+ max?: number;
373
+ /** Path to context value for pre-filling (dot notation, e.g., 'proposal.summary') */
374
+ defaultValueFromContext?: string;
375
+ }
376
+ /**
377
+ * Form schema for action payload collection
378
+ */
379
+ interface FormSchema {
380
+ /** Form title */
381
+ title?: string;
382
+ /** Form description */
383
+ description?: string;
384
+ /** Form fields */
385
+ fields: FormField[];
386
+ }
387
+
388
388
  /**
389
389
  * Execution interface configuration
390
390
  * Defines how a resource is executed via the UI (forms, scheduling, webhooks)
@@ -442,6 +442,8 @@ interface WebhookConfig {
442
442
 
443
443
  interface WorkflowConfig extends ResourceDefinition {
444
444
  type: 'workflow';
445
+ /** Lead-gen capability key for registry derivation (e.g. 'lead-gen.company.apollo-import') */
446
+ capabilityKey?: string;
445
447
  }
446
448
  interface WorkflowStepDefinition {
447
449
  id: string;
@@ -3797,384 +3799,81 @@ type Database = {
3797
3799
  };
3798
3800
  };
3799
3801
 
3800
- /** Raw database row type for acq_deals table */
3801
- type AcqDealRow = Database['public']['Tables']['acq_deals']['Row'];
3802
- /**
3803
- * Tracks pipeline status for a company across all processing stages.
3804
- */
3805
- interface CompanyPipelineStatus {
3806
- acquired: boolean;
3807
- enrichment: {
3808
- [source: string]: {
3809
- status: 'pending' | 'complete' | 'failed' | 'skipped';
3810
- completedAt?: string;
3811
- error?: string;
3812
- };
3813
- };
3814
- }
3815
- /**
3816
- * Tracks pipeline status for a contact across all processing stages.
3817
- */
3818
- interface ContactPipelineStatus {
3819
- enrichment: {
3820
- [source: string]: {
3821
- status: 'pending' | 'complete' | 'failed' | 'skipped';
3822
- completedAt?: string;
3823
- error?: string;
3824
- };
3825
- };
3826
- personalization: {
3827
- status: 'pending' | 'complete' | 'failed' | 'skipped';
3828
- completedAt?: string;
3829
- };
3830
- outreach: {
3831
- status: 'pending' | 'sent' | 'replied' | 'bounced' | 'opted-out';
3832
- sentAt?: string;
3833
- channel?: string;
3834
- campaignId?: string;
3835
- };
3836
- }
3837
- /**
3838
- * Enrichment data collected for a company from various sources.
3839
- */
3840
- interface CompanyEnrichmentData {
3841
- googleMaps?: {
3842
- placeId?: string;
3843
- totalScore?: number;
3844
- reviewsCount?: number;
3845
- address?: string;
3846
- phone?: string;
3847
- categoryName?: string;
3848
- googleMapsUrl?: string;
3849
- scrapedAt?: string;
3850
- };
3851
- websiteCrawl?: {
3852
- companyDescription?: string;
3853
- services?: string[];
3854
- specialties?: string[];
3855
- staff?: Array<{
3856
- name: string;
3857
- title?: string;
3858
- email?: string;
3859
- }>;
3860
- automationGaps?: string[];
3861
- targetAudience?: string;
3862
- category?: string;
3863
- segment?: string;
3864
- recentWin?: string;
3865
- emailCount?: number;
3866
- pageCount?: number;
3867
- totalChars?: number;
3868
- crawledAt?: string;
3869
- extractedAt?: string;
3870
- };
3871
- website?: {
3872
- missionVision?: string;
3873
- uniqueAttributes?: string;
3874
- coreOfferings?: string;
3875
- targetAudience?: string;
3876
- companyValues?: string;
3877
- businessDescription?: string;
3878
- recentPosts?: Array<{
3879
- date?: string;
3880
- title?: string;
3881
- summary?: string;
3882
- aiInsight?: string;
3883
- }>;
3884
- };
3885
- tomba?: {
3886
- waterfallEmail?: {
3887
- email: string;
3888
- name?: string;
3889
- title?: string;
3890
- department?: string;
3891
- } | null;
3892
- genericEmail?: string | null;
3893
- totalFound?: number;
3894
- searchedAt?: string;
3895
- };
3896
- }
3897
- /**
3898
- * Enrichment data collected for a contact from various sources.
3899
- */
3900
- interface ContactEnrichmentData {
3901
- linkedin?: {
3902
- summary?: string;
3903
- pastExperience?: string;
3904
- education?: string;
3905
- activity?: Array<{
3906
- date?: string;
3907
- content?: string;
3908
- }>;
3909
- };
3910
- }
3911
- type ListStatus = 'draft' | 'enriching' | 'launched' | 'closing' | 'archived';
3912
- interface ScrapingConfig {
3913
- source?: string;
3914
- query?: string;
3915
- filters?: Record<string, unknown>;
3916
- [key: string]: unknown;
3917
- }
3918
- interface IcpRubric {
3919
- targetDescription?: string;
3920
- minReviewCount?: number;
3921
- minRating?: number;
3922
- excludeFranchises?: boolean;
3923
- customRules?: string;
3924
- qualificationRubricKey?: string | null;
3925
- [key: string]: unknown;
3926
- }
3927
- interface PipelineStage {
3928
- key: string;
3929
- label?: string;
3930
- description?: string;
3931
- resourceId?: string;
3932
- inputTemplate?: Record<string, unknown>;
3933
- enabled?: boolean;
3934
- order?: number;
3935
- }
3936
- interface PipelineConfig {
3937
- stages: PipelineStage[];
3938
- }
3939
- type BuildPlanSnapshotPrimaryEntity = 'company' | 'contact';
3940
- type BuildPlanSnapshotOutput = 'company' | 'contact' | 'export';
3941
- type BuildPlanSnapshotDependencyMode = 'per-record-eligibility';
3942
- interface BuildPlanSnapshotStep {
3943
- id: string;
3944
- label: string;
3945
- description?: string;
3946
- primaryEntity: BuildPlanSnapshotPrimaryEntity;
3947
- outputs: BuildPlanSnapshotOutput[];
3948
- stageKey: string;
3949
- dependsOn?: string[];
3950
- dependencyMode: BuildPlanSnapshotDependencyMode;
3951
- capabilityKey: string;
3952
- defaultBatchSize: number;
3953
- maxBatchSize: number;
3954
- }
3955
- interface BuildPlanSnapshot {
3956
- templateId: string;
3957
- templateLabel: string;
3958
- steps: BuildPlanSnapshotStep[];
3959
- }
3960
- interface AcqListMetadata extends Record<string, unknown> {
3961
- buildPlanSnapshot?: BuildPlanSnapshot;
3962
- }
3963
- interface AcqList {
3964
- id: string;
3965
- organizationId: string;
3966
- name: string;
3967
- description: string | null;
3968
- batchIds: string[];
3969
- instantlyCampaignId: string | null;
3970
- status: ListStatus;
3971
- scrapingConfig: ScrapingConfig;
3972
- icp: IcpRubric;
3973
- pipelineConfig: PipelineConfig;
3974
- metadata: AcqListMetadata;
3975
- launchedAt: Date | null;
3976
- completedAt: Date | null;
3977
- createdAt: Date;
3978
- }
3979
- /**
3980
- * Company record in the acquisition database.
3981
- * Contains enriched company data from various sources.
3982
- * Transformed from AcqCompanyRow with camelCase properties.
3983
- */
3984
- interface AcqCompany {
3985
- id: string;
3986
- organizationId: string;
3987
- name: string;
3988
- domain: string | null;
3989
- linkedinUrl: string | null;
3990
- website: string | null;
3991
- numEmployees: number | null;
3992
- foundedYear: number | null;
3993
- locationCity: string | null;
3994
- locationState: string | null;
3995
- category: string | null;
3996
- categoryPain: string | null;
3997
- segment: string | null;
3998
- pipelineStatus: CompanyPipelineStatus | null;
3999
- enrichmentData: CompanyEnrichmentData | null;
4000
- source: string | null;
4001
- batchId: string | null;
4002
- status: 'active' | 'invalid';
4003
- verticalResearch: string | null;
4004
- /** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
4005
- qualificationScore: number | null;
4006
- /** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
4007
- qualificationSignals: Record<string, unknown> | null;
4008
- /** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
4009
- qualificationRubricKey: string | null;
4010
- createdAt: Date;
4011
- updatedAt: Date;
4012
- }
4013
- /**
4014
- * Contact record in the acquisition database.
4015
- * Contains enriched contact data and personalization content.
4016
- * Transformed from AcqContactRow with camelCase properties.
4017
- */
4018
- interface AcqContact {
4019
- id: string;
4020
- organizationId: string;
4021
- companyId: string | null;
4022
- email: string;
4023
- emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null;
4024
- firstName: string | null;
4025
- lastName: string | null;
4026
- linkedinUrl: string | null;
4027
- title: string | null;
4028
- headline: string | null;
4029
- filterReason: string | null;
4030
- openingLine: string | null;
4031
- source: string | null;
4032
- sourceId: string | null;
4033
- pipelineStatus: ContactPipelineStatus | null;
4034
- enrichmentData: ContactEnrichmentData | null;
4035
- /** Attio Person record ID - set when contact responds and is added to CRM */
4036
- attioPersonId: string | null;
4037
- batchId: string | null;
4038
- status: 'active' | 'invalid';
4039
- createdAt: Date;
4040
- updatedAt: Date;
4041
- }
4042
- type DealPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting' | 'stale' | 'closed_low';
4043
- interface DealPriority {
4044
- bucketKey: DealPriorityBucketKey;
4045
- rank: number;
4046
- label: string;
4047
- color: string;
4048
- reason: string;
4049
- latestActivityAt: string | null;
4050
- nextActionAt: string | null;
4051
- }
4052
- interface DealContact {
4053
- id: string;
4054
- first_name: string | null;
4055
- last_name: string | null;
4056
- email: string;
4057
- title: string | null;
4058
- headline: string | null;
4059
- linkedin_url: string | null;
4060
- pipeline_status: Record<string, unknown> | null;
4061
- enrichment_data: Record<string, unknown> | null;
4062
- company: {
4063
- id: string;
4064
- name: string;
4065
- domain: string | null;
4066
- website: string | null;
4067
- linkedin_url: string | null;
4068
- segment: string | null;
4069
- category: string | null;
4070
- num_employees: number | null;
4071
- } | null;
4072
- }
4073
- /** Deal list item with joined contact and company data */
4074
- interface DealListItem extends AcqDealRow {
4075
- priority: DealPriority;
4076
- ownership: 'us' | 'them' | null;
4077
- nextAction: string | null;
4078
- contact: DealContact | null;
4079
- }
4080
- type DealDetail = DealListItem;
4081
- /** Task kind options for a deal task (human follow-up action type) */
4082
- type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other';
4083
- /**
4084
- * A CRM to-do item attached to a deal representing a human follow-up action.
4085
- * Transformed from AcqDealTaskRow with camelCase properties.
4086
- */
4087
- interface AcqDealTask {
4088
- id: string;
4089
- organizationId: string;
4090
- dealId: string;
4091
- title: string;
4092
- description: string | null;
4093
- kind: AcqDealTaskKind;
4094
- dueAt: string | null;
4095
- assigneeUserId: string | null;
4096
- completedAt: string | null;
4097
- completedByUserId: string | null;
4098
- createdAt: string;
4099
- updatedAt: string;
4100
- createdByUserId: string | null;
4101
- }
4102
-
4103
- declare const DealSchemas: {
4104
- DealIdParams: z.ZodObject<{
4105
- dealId: z.ZodString;
4106
- }, z.core.$strip>;
4107
- DealTaskIdParams: z.ZodObject<{
4108
- dealId: z.ZodString;
4109
- taskId: z.ZodString;
4110
- }, z.core.$strip>;
4111
- ListDealsQuery: z.ZodObject<{
4112
- stage: z.ZodOptional<z.ZodEnum<{
4113
- nurturing: "nurturing";
4114
- closed_won: "closed_won";
4115
- closed_lost: "closed_lost";
4116
- interested: "interested";
4117
- proposal: "proposal";
4118
- closing: "closing";
4119
- }>>;
4120
- search: z.ZodOptional<z.ZodString>;
4121
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4122
- offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4123
- }, z.core.$strict>;
4124
- DealLookupQuery: z.ZodObject<{
4125
- search: z.ZodOptional<z.ZodString>;
4126
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4127
- }, z.core.$strict>;
4128
- ListDealTasksDueQuery: z.ZodObject<{
4129
- window: z.ZodOptional<z.ZodEnum<{
4130
- upcoming: "upcoming";
4131
- overdue: "overdue";
4132
- today: "today";
4133
- today_and_overdue: "today_and_overdue";
4134
- }>>;
4135
- assigneeUserId: z.ZodOptional<z.ZodString>;
4136
- }, z.core.$strict>;
4137
- CreateDealNoteRequest: z.ZodObject<{
4138
- body: z.ZodString;
4139
- }, z.core.$strict>;
4140
- CreateDealTaskRequest: z.ZodObject<{
4141
- title: z.ZodString;
4142
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4143
- kind: z.ZodOptional<z.ZodEnum<{
4144
- other: "other";
4145
- email: "email";
4146
- call: "call";
4147
- meeting: "meeting";
4148
- }>>;
4149
- dueAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4150
- assigneeUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4151
- }, z.core.$strict>;
4152
- TransitionItemRequest: z.ZodObject<{
4153
- pipelineKey: z.ZodString;
4154
- stageKey: z.ZodString;
4155
- stateKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4156
- reason: z.ZodOptional<z.ZodString>;
4157
- expectedUpdatedAt: z.ZodOptional<z.ZodString>;
4158
- }, z.core.$strict>;
4159
- TransitionDealStateRequest: z.ZodObject<{
4160
- stateKey: z.ZodString;
4161
- reason: z.ZodOptional<z.ZodString>;
4162
- expectedUpdatedAt: z.ZodOptional<z.ZodString>;
4163
- }, z.core.$strict>;
4164
- ExecuteActionParams: z.ZodObject<{
4165
- dealId: z.ZodString;
4166
- actionKey: z.ZodString;
4167
- }, z.core.$strict>;
4168
- ExecuteActionRequest: z.ZodObject<{
4169
- payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4170
- }, z.core.$strict>;
4171
- DealPriority: z.ZodObject<{
4172
- bucketKey: z.ZodEnum<{
4173
- needs_response: "needs_response";
4174
- follow_up_due: "follow_up_due";
4175
- waiting: "waiting";
4176
- stale: "stale";
4177
- closed_low: "closed_low";
3802
+ declare const DealSchemas: {
3803
+ DealIdParams: z.ZodObject<{
3804
+ dealId: z.ZodString;
3805
+ }, z.core.$strip>;
3806
+ DealTaskIdParams: z.ZodObject<{
3807
+ dealId: z.ZodString;
3808
+ taskId: z.ZodString;
3809
+ }, z.core.$strip>;
3810
+ ListDealsQuery: z.ZodObject<{
3811
+ stage: z.ZodOptional<z.ZodEnum<{
3812
+ nurturing: "nurturing";
3813
+ closed_won: "closed_won";
3814
+ closed_lost: "closed_lost";
3815
+ interested: "interested";
3816
+ proposal: "proposal";
3817
+ closing: "closing";
3818
+ }>>;
3819
+ search: z.ZodOptional<z.ZodString>;
3820
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3821
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3822
+ }, z.core.$strict>;
3823
+ DealLookupQuery: z.ZodObject<{
3824
+ search: z.ZodOptional<z.ZodString>;
3825
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
3826
+ }, z.core.$strict>;
3827
+ ListDealTasksDueQuery: z.ZodObject<{
3828
+ window: z.ZodOptional<z.ZodEnum<{
3829
+ upcoming: "upcoming";
3830
+ overdue: "overdue";
3831
+ today: "today";
3832
+ today_and_overdue: "today_and_overdue";
3833
+ }>>;
3834
+ assigneeUserId: z.ZodOptional<z.ZodString>;
3835
+ }, z.core.$strict>;
3836
+ CreateDealNoteRequest: z.ZodObject<{
3837
+ body: z.ZodString;
3838
+ }, z.core.$strict>;
3839
+ CreateDealTaskRequest: z.ZodObject<{
3840
+ title: z.ZodString;
3841
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3842
+ kind: z.ZodOptional<z.ZodEnum<{
3843
+ other: "other";
3844
+ email: "email";
3845
+ call: "call";
3846
+ meeting: "meeting";
3847
+ }>>;
3848
+ dueAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3849
+ assigneeUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3850
+ }, z.core.$strict>;
3851
+ TransitionItemRequest: z.ZodObject<{
3852
+ pipelineKey: z.ZodString;
3853
+ stageKey: z.ZodString;
3854
+ stateKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3855
+ reason: z.ZodOptional<z.ZodString>;
3856
+ expectedUpdatedAt: z.ZodOptional<z.ZodString>;
3857
+ }, z.core.$strict>;
3858
+ TransitionDealStateRequest: z.ZodObject<{
3859
+ stateKey: z.ZodString;
3860
+ reason: z.ZodOptional<z.ZodString>;
3861
+ expectedUpdatedAt: z.ZodOptional<z.ZodString>;
3862
+ }, z.core.$strict>;
3863
+ ExecuteActionParams: z.ZodObject<{
3864
+ dealId: z.ZodString;
3865
+ actionKey: z.ZodString;
3866
+ }, z.core.$strict>;
3867
+ ExecuteActionRequest: z.ZodObject<{
3868
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3869
+ }, z.core.$strict>;
3870
+ DealPriority: z.ZodObject<{
3871
+ bucketKey: z.ZodEnum<{
3872
+ needs_response: "needs_response";
3873
+ follow_up_due: "follow_up_due";
3874
+ waiting: "waiting";
3875
+ stale: "stale";
3876
+ closed_low: "closed_low";
4178
3877
  }>;
4179
3878
  rank: z.ZodNumber;
4180
3879
  label: z.ZodString;
@@ -4408,47 +4107,353 @@ declare const DealSchemas: {
4408
4107
  call: "call";
4409
4108
  meeting: "meeting";
4410
4109
  }>;
4411
- dueAt: z.ZodNullable<z.ZodString>;
4412
- assigneeUserId: z.ZodNullable<z.ZodString>;
4413
- completedAt: z.ZodNullable<z.ZodString>;
4414
- completedByUserId: z.ZodNullable<z.ZodString>;
4415
- createdAt: z.ZodString;
4416
- updatedAt: z.ZodString;
4417
- createdByUserId: z.ZodNullable<z.ZodString>;
4418
- }, z.core.$strip>;
4419
- DealTaskListResponse: z.ZodArray<z.ZodObject<{
4420
- id: z.ZodString;
4421
- organizationId: z.ZodString;
4422
- dealId: z.ZodString;
4423
- title: z.ZodString;
4424
- description: z.ZodNullable<z.ZodString>;
4425
- kind: z.ZodEnum<{
4426
- other: "other";
4427
- email: "email";
4428
- call: "call";
4429
- meeting: "meeting";
4110
+ dueAt: z.ZodNullable<z.ZodString>;
4111
+ assigneeUserId: z.ZodNullable<z.ZodString>;
4112
+ completedAt: z.ZodNullable<z.ZodString>;
4113
+ completedByUserId: z.ZodNullable<z.ZodString>;
4114
+ createdAt: z.ZodString;
4115
+ updatedAt: z.ZodString;
4116
+ createdByUserId: z.ZodNullable<z.ZodString>;
4117
+ }, z.core.$strip>;
4118
+ DealTaskListResponse: z.ZodArray<z.ZodObject<{
4119
+ id: z.ZodString;
4120
+ organizationId: z.ZodString;
4121
+ dealId: z.ZodString;
4122
+ title: z.ZodString;
4123
+ description: z.ZodNullable<z.ZodString>;
4124
+ kind: z.ZodEnum<{
4125
+ other: "other";
4126
+ email: "email";
4127
+ call: "call";
4128
+ meeting: "meeting";
4129
+ }>;
4130
+ dueAt: z.ZodNullable<z.ZodString>;
4131
+ assigneeUserId: z.ZodNullable<z.ZodString>;
4132
+ completedAt: z.ZodNullable<z.ZodString>;
4133
+ completedByUserId: z.ZodNullable<z.ZodString>;
4134
+ createdAt: z.ZodString;
4135
+ updatedAt: z.ZodString;
4136
+ createdByUserId: z.ZodNullable<z.ZodString>;
4137
+ }, z.core.$strip>>;
4138
+ };
4139
+ /**
4140
+ * One stage entry in a list's `pipeline_config.stages[]`. The `key` is
4141
+ * validated against `LEAD_GEN_STAGE_CATALOG` so list pipeline definitions
4142
+ * stay aligned with the org-os semantic layer.
4143
+ */
4144
+ declare const PipelineStageSchema: z.ZodObject<{
4145
+ key: z.ZodString;
4146
+ label: z.ZodOptional<z.ZodString>;
4147
+ enabled: z.ZodOptional<z.ZodBoolean>;
4148
+ order: z.ZodOptional<z.ZodNumber>;
4149
+ }, z.core.$strip>;
4150
+ /**
4151
+ * Terminal row-level status for one lead-gen processing stage.
4152
+ * Missing key still means not attempted; legacy boolean `true` is normalized
4153
+ * to `success` by the API reader during rollout.
4154
+ */
4155
+ declare const ProcessingStageStatusSchema: z.ZodEnum<{
4156
+ error: "error";
4157
+ success: "success";
4158
+ no_result: "no_result";
4159
+ skipped: "skipped";
4160
+ }>;
4161
+ type PipelineStage = z.infer<typeof PipelineStageSchema>;
4162
+ type ProcessingStageStatus = z.infer<typeof ProcessingStageStatusSchema>;
4163
+
4164
+ /** Raw database row type for acq_deals table */
4165
+ type AcqDealRow = Database['public']['Tables']['acq_deals']['Row'];
4166
+ /**
4167
+ * Tracks pipeline status for a company across all processing stages.
4168
+ */
4169
+ interface CompanyPipelineStatus {
4170
+ acquired: boolean;
4171
+ enrichment: {
4172
+ [source: string]: {
4173
+ status: 'pending' | 'complete' | 'failed' | 'skipped';
4174
+ completedAt?: string;
4175
+ error?: string;
4176
+ };
4177
+ };
4178
+ }
4179
+ /**
4180
+ * Tracks pipeline status for a contact across all processing stages.
4181
+ */
4182
+ interface ContactPipelineStatus {
4183
+ enrichment: {
4184
+ [source: string]: {
4185
+ status: 'pending' | 'complete' | 'failed' | 'skipped';
4186
+ completedAt?: string;
4187
+ error?: string;
4188
+ };
4189
+ };
4190
+ personalization: {
4191
+ status: 'pending' | 'complete' | 'failed' | 'skipped';
4192
+ completedAt?: string;
4193
+ };
4194
+ outreach: {
4195
+ status: 'pending' | 'sent' | 'replied' | 'bounced' | 'opted-out';
4196
+ sentAt?: string;
4197
+ channel?: string;
4198
+ campaignId?: string;
4199
+ };
4200
+ }
4201
+ /**
4202
+ * Enrichment data collected for a company from various sources.
4203
+ */
4204
+ interface CompanyEnrichmentData {
4205
+ googleMaps?: {
4206
+ placeId?: string;
4207
+ totalScore?: number;
4208
+ reviewsCount?: number;
4209
+ address?: string;
4210
+ phone?: string;
4211
+ categoryName?: string;
4212
+ googleMapsUrl?: string;
4213
+ scrapedAt?: string;
4214
+ };
4215
+ websiteCrawl?: {
4216
+ companyDescription?: string;
4217
+ services?: string[];
4218
+ specialties?: string[];
4219
+ staff?: Array<{
4220
+ name: string;
4221
+ title?: string;
4222
+ email?: string;
4223
+ }>;
4224
+ automationGaps?: string[];
4225
+ targetAudience?: string;
4226
+ category?: string;
4227
+ segment?: string;
4228
+ recentWin?: string;
4229
+ emailCount?: number;
4230
+ pageCount?: number;
4231
+ totalChars?: number;
4232
+ crawledAt?: string;
4233
+ extractedAt?: string;
4234
+ };
4235
+ website?: {
4236
+ missionVision?: string;
4237
+ uniqueAttributes?: string;
4238
+ coreOfferings?: string;
4239
+ targetAudience?: string;
4240
+ companyValues?: string;
4241
+ businessDescription?: string;
4242
+ recentPosts?: Array<{
4243
+ date?: string;
4244
+ title?: string;
4245
+ summary?: string;
4246
+ aiInsight?: string;
4247
+ }>;
4248
+ };
4249
+ tomba?: {
4250
+ waterfallEmail?: {
4251
+ email: string;
4252
+ name?: string;
4253
+ title?: string;
4254
+ department?: string;
4255
+ } | null;
4256
+ genericEmail?: string | null;
4257
+ totalFound?: number;
4258
+ searchedAt?: string;
4259
+ };
4260
+ }
4261
+ /**
4262
+ * Enrichment data collected for a contact from various sources.
4263
+ */
4264
+ interface ContactEnrichmentData {
4265
+ linkedin?: {
4266
+ summary?: string;
4267
+ pastExperience?: string;
4268
+ education?: string;
4269
+ activity?: Array<{
4270
+ date?: string;
4271
+ content?: string;
4430
4272
  }>;
4431
- dueAt: z.ZodNullable<z.ZodString>;
4432
- assigneeUserId: z.ZodNullable<z.ZodString>;
4433
- completedAt: z.ZodNullable<z.ZodString>;
4434
- completedByUserId: z.ZodNullable<z.ZodString>;
4435
- createdAt: z.ZodString;
4436
- updatedAt: z.ZodString;
4437
- createdByUserId: z.ZodNullable<z.ZodString>;
4438
- }, z.core.$strip>>;
4439
- };
4273
+ };
4274
+ }
4275
+ type ListStatus = 'draft' | 'enriching' | 'launched' | 'closing' | 'archived';
4276
+ interface ScrapingConfig {
4277
+ source?: string;
4278
+ query?: string;
4279
+ filters?: Record<string, unknown>;
4280
+ [key: string]: unknown;
4281
+ }
4282
+ interface IcpRubric {
4283
+ targetDescription?: string;
4284
+ minReviewCount?: number;
4285
+ minRating?: number;
4286
+ excludeFranchises?: boolean;
4287
+ customRules?: string;
4288
+ qualificationRubricKey?: string | null;
4289
+ [key: string]: unknown;
4290
+ }
4291
+ interface PipelineConfig {
4292
+ stages: PipelineStage[];
4293
+ }
4294
+ type BuildPlanSnapshotPrimaryEntity = 'company' | 'contact';
4295
+ type BuildPlanSnapshotOutput = 'company' | 'contact' | 'export';
4296
+ type BuildPlanSnapshotDependencyMode = 'per-record-eligibility';
4297
+ interface BuildPlanSnapshotStep {
4298
+ id: string;
4299
+ label: string;
4300
+ description?: string;
4301
+ primaryEntity: BuildPlanSnapshotPrimaryEntity;
4302
+ outputs: BuildPlanSnapshotOutput[];
4303
+ stageKey: string;
4304
+ dependsOn?: string[];
4305
+ dependencyMode: BuildPlanSnapshotDependencyMode;
4306
+ capabilityKey: string;
4307
+ defaultBatchSize: number;
4308
+ maxBatchSize: number;
4309
+ }
4310
+ interface BuildPlanSnapshot {
4311
+ templateId: string;
4312
+ templateLabel: string;
4313
+ steps: BuildPlanSnapshotStep[];
4314
+ }
4315
+ interface AcqListMetadata extends Record<string, unknown> {
4316
+ buildPlanSnapshot?: BuildPlanSnapshot;
4317
+ }
4318
+ interface AcqList {
4319
+ id: string;
4320
+ organizationId: string;
4321
+ name: string;
4322
+ description: string | null;
4323
+ batchIds: string[];
4324
+ instantlyCampaignId: string | null;
4325
+ status: ListStatus;
4326
+ scrapingConfig: ScrapingConfig;
4327
+ icp: IcpRubric;
4328
+ pipelineConfig: PipelineConfig;
4329
+ metadata: AcqListMetadata;
4330
+ launchedAt: Date | null;
4331
+ completedAt: Date | null;
4332
+ createdAt: Date;
4333
+ }
4440
4334
  /**
4441
- * Terminal row-level status for one lead-gen processing stage.
4442
- * Missing key still means not attempted; legacy boolean `true` is normalized
4443
- * to `success` by the API reader during rollout.
4335
+ * Company record in the acquisition database.
4336
+ * Contains enriched company data from various sources.
4337
+ * Transformed from AcqCompanyRow with camelCase properties.
4444
4338
  */
4445
- declare const ProcessingStageStatusSchema: z.ZodEnum<{
4446
- error: "error";
4447
- success: "success";
4448
- skipped: "skipped";
4449
- no_result: "no_result";
4450
- }>;
4451
- type ProcessingStageStatus = z.infer<typeof ProcessingStageStatusSchema>;
4339
+ interface AcqCompany {
4340
+ id: string;
4341
+ organizationId: string;
4342
+ name: string;
4343
+ domain: string | null;
4344
+ linkedinUrl: string | null;
4345
+ website: string | null;
4346
+ numEmployees: number | null;
4347
+ foundedYear: number | null;
4348
+ locationCity: string | null;
4349
+ locationState: string | null;
4350
+ category: string | null;
4351
+ categoryPain: string | null;
4352
+ segment: string | null;
4353
+ pipelineStatus: CompanyPipelineStatus | null;
4354
+ enrichmentData: CompanyEnrichmentData | null;
4355
+ source: string | null;
4356
+ batchId: string | null;
4357
+ status: 'active' | 'invalid';
4358
+ verticalResearch: string | null;
4359
+ /** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
4360
+ qualificationScore: number | null;
4361
+ /** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
4362
+ qualificationSignals: Record<string, unknown> | null;
4363
+ /** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
4364
+ qualificationRubricKey: string | null;
4365
+ createdAt: Date;
4366
+ updatedAt: Date;
4367
+ }
4368
+ /**
4369
+ * Contact record in the acquisition database.
4370
+ * Contains enriched contact data and personalization content.
4371
+ * Transformed from AcqContactRow with camelCase properties.
4372
+ */
4373
+ interface AcqContact {
4374
+ id: string;
4375
+ organizationId: string;
4376
+ companyId: string | null;
4377
+ email: string;
4378
+ emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null;
4379
+ firstName: string | null;
4380
+ lastName: string | null;
4381
+ linkedinUrl: string | null;
4382
+ title: string | null;
4383
+ headline: string | null;
4384
+ filterReason: string | null;
4385
+ openingLine: string | null;
4386
+ source: string | null;
4387
+ sourceId: string | null;
4388
+ pipelineStatus: ContactPipelineStatus | null;
4389
+ enrichmentData: ContactEnrichmentData | null;
4390
+ /** Attio Person record ID - set when contact responds and is added to CRM */
4391
+ attioPersonId: string | null;
4392
+ batchId: string | null;
4393
+ status: 'active' | 'invalid';
4394
+ createdAt: Date;
4395
+ updatedAt: Date;
4396
+ }
4397
+ type DealPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting' | 'stale' | 'closed_low';
4398
+ interface DealPriority {
4399
+ bucketKey: DealPriorityBucketKey;
4400
+ rank: number;
4401
+ label: string;
4402
+ color: string;
4403
+ reason: string;
4404
+ latestActivityAt: string | null;
4405
+ nextActionAt: string | null;
4406
+ }
4407
+ interface DealContact {
4408
+ id: string;
4409
+ first_name: string | null;
4410
+ last_name: string | null;
4411
+ email: string;
4412
+ title: string | null;
4413
+ headline: string | null;
4414
+ linkedin_url: string | null;
4415
+ pipeline_status: Record<string, unknown> | null;
4416
+ enrichment_data: Record<string, unknown> | null;
4417
+ company: {
4418
+ id: string;
4419
+ name: string;
4420
+ domain: string | null;
4421
+ website: string | null;
4422
+ linkedin_url: string | null;
4423
+ segment: string | null;
4424
+ category: string | null;
4425
+ num_employees: number | null;
4426
+ } | null;
4427
+ }
4428
+ /** Deal list item with joined contact and company data */
4429
+ interface DealListItem extends AcqDealRow {
4430
+ priority: DealPriority;
4431
+ ownership: 'us' | 'them' | null;
4432
+ nextAction: string | null;
4433
+ contact: DealContact | null;
4434
+ }
4435
+ type DealDetail = DealListItem;
4436
+ /** Task kind options for a deal task (human follow-up action type) */
4437
+ type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other';
4438
+ /**
4439
+ * A CRM to-do item attached to a deal representing a human follow-up action.
4440
+ * Transformed from AcqDealTaskRow with camelCase properties.
4441
+ */
4442
+ interface AcqDealTask {
4443
+ id: string;
4444
+ organizationId: string;
4445
+ dealId: string;
4446
+ title: string;
4447
+ description: string | null;
4448
+ kind: AcqDealTaskKind;
4449
+ dueAt: string | null;
4450
+ assigneeUserId: string | null;
4451
+ completedAt: string | null;
4452
+ completedByUserId: string | null;
4453
+ createdAt: string;
4454
+ updatedAt: string;
4455
+ createdByUserId: string | null;
4456
+ }
4452
4457
 
4453
4458
  /**
4454
4459
  * Lead Service Types
@@ -4536,6 +4541,7 @@ interface CompanyFilters {
4536
4541
  status?: 'active' | 'invalid';
4537
4542
  includeAll?: boolean;
4538
4543
  excludeColumns?: Array<'enrichmentData' | 'pipelineStatus'>;
4544
+ limit?: number;
4539
4545
  }
4540
4546
  interface CreateContactParams {
4541
4547
  organizationId: string;
@@ -8514,6 +8520,7 @@ declare const LinkSchema: z.ZodObject<{
8514
8520
  maps_to: "maps_to";
8515
8521
  "operates-on": "operates-on";
8516
8522
  uses: "uses";
8523
+ governs: "governs";
8517
8524
  }>;
8518
8525
  }, z.core.$strip>;
8519
8526
  type Link = z.infer<typeof LinkSchema>;