@elevasis/sdk 1.11.0 → 1.12.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 (38) hide show
  1. package/dist/cli.cjs +31 -8
  2. package/dist/index.d.ts +345 -48
  3. package/dist/index.js +210 -8
  4. package/dist/test-utils/index.d.ts +216 -40
  5. package/dist/test-utils/index.js +4756 -125
  6. package/dist/types/worker/adapters/llm.d.ts +1 -1
  7. package/dist/worker/index.js +10 -4
  8. package/package.json +2 -2
  9. package/reference/claude-config/rules/agent-start-here.md +14 -14
  10. package/reference/claude-config/skills/configure/SKILL.md +3 -3
  11. package/reference/claude-config/skills/setup/SKILL.md +6 -6
  12. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +55 -0
  13. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +101 -0
  14. package/reference/cli.mdx +57 -0
  15. package/reference/examples/organization-model.ts +3 -0
  16. package/reference/packages/core/src/organization-model/README.md +1 -0
  17. package/reference/scaffold/core/organization-graph.mdx +5 -2
  18. package/reference/scaffold/core/organization-model.mdx +6 -0
  19. package/reference/scaffold/index.mdx +3 -0
  20. package/reference/scaffold/operations/propagation-pipeline.md +4 -1
  21. package/reference/scaffold/operations/scaffold-maintenance.md +3 -0
  22. package/reference/scaffold/operations/workflow-recipes.md +13 -10
  23. package/reference/scaffold/recipes/add-a-feature.md +3 -0
  24. package/reference/scaffold/recipes/add-a-resource.md +3 -0
  25. package/reference/scaffold/recipes/customize-organization-model.md +3 -0
  26. package/reference/scaffold/recipes/extend-a-base-entity.md +11 -8
  27. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +3 -0
  28. package/reference/scaffold/recipes/index.md +3 -0
  29. package/reference/scaffold/reference/contracts.md +62 -304
  30. package/reference/scaffold/reference/feature-registry.md +5 -2
  31. package/reference/scaffold/reference/glossary.md +3 -0
  32. package/reference/scaffold/ui/composition-extensibility.mdx +3 -0
  33. package/reference/scaffold/ui/customization.md +3 -0
  34. package/reference/scaffold/ui/feature-flags-and-gating.md +3 -0
  35. package/reference/scaffold/ui/feature-shell.mdx +3 -0
  36. package/reference/scaffold/ui/recipes.md +3 -0
  37. package/reference/claude-config/logs/pre-edit-vibe-gate.log +0 -40
  38. package/reference/claude-config/logs/scaffold-registry-reminder.log +0 -38
package/dist/index.d.ts CHANGED
@@ -1508,7 +1508,6 @@ type Database = {
1508
1508
  acq_deals: {
1509
1509
  Row: {
1510
1510
  activity_log: Json;
1511
- cached_stage: string | null;
1512
1511
  closed_lost_at: string | null;
1513
1512
  closed_lost_reason: string | null;
1514
1513
  contact_email: string;
@@ -1523,6 +1522,7 @@ type Database = {
1523
1522
  organization_id: string;
1524
1523
  payment_link_sent_at: string | null;
1525
1524
  payment_received_at: string | null;
1525
+ pipeline_key: string;
1526
1526
  proposal_data: Json | null;
1527
1527
  proposal_generated_at: string | null;
1528
1528
  proposal_pdf_url: string | null;
@@ -1530,10 +1530,11 @@ type Database = {
1530
1530
  proposal_reviewed_by: string | null;
1531
1531
  proposal_sent_at: string | null;
1532
1532
  proposal_signed_at: string | null;
1533
- proposal_status: string | null;
1534
1533
  signature_envelope_id: string | null;
1535
1534
  source_list_id: string | null;
1536
1535
  source_type: string | null;
1536
+ stage_key: string | null;
1537
+ state_key: string | null;
1537
1538
  stripe_payment_id: string | null;
1538
1539
  stripe_payment_link: string | null;
1539
1540
  stripe_payment_link_id: string | null;
@@ -1542,7 +1543,6 @@ type Database = {
1542
1543
  };
1543
1544
  Insert: {
1544
1545
  activity_log?: Json;
1545
- cached_stage?: string | null;
1546
1546
  closed_lost_at?: string | null;
1547
1547
  closed_lost_reason?: string | null;
1548
1548
  contact_email: string;
@@ -1557,6 +1557,7 @@ type Database = {
1557
1557
  organization_id: string;
1558
1558
  payment_link_sent_at?: string | null;
1559
1559
  payment_received_at?: string | null;
1560
+ pipeline_key?: string;
1560
1561
  proposal_data?: Json | null;
1561
1562
  proposal_generated_at?: string | null;
1562
1563
  proposal_pdf_url?: string | null;
@@ -1564,10 +1565,11 @@ type Database = {
1564
1565
  proposal_reviewed_by?: string | null;
1565
1566
  proposal_sent_at?: string | null;
1566
1567
  proposal_signed_at?: string | null;
1567
- proposal_status?: string | null;
1568
1568
  signature_envelope_id?: string | null;
1569
1569
  source_list_id?: string | null;
1570
1570
  source_type?: string | null;
1571
+ stage_key?: string | null;
1572
+ state_key?: string | null;
1571
1573
  stripe_payment_id?: string | null;
1572
1574
  stripe_payment_link?: string | null;
1573
1575
  stripe_payment_link_id?: string | null;
@@ -1576,7 +1578,6 @@ type Database = {
1576
1578
  };
1577
1579
  Update: {
1578
1580
  activity_log?: Json;
1579
- cached_stage?: string | null;
1580
1581
  closed_lost_at?: string | null;
1581
1582
  closed_lost_reason?: string | null;
1582
1583
  contact_email?: string;
@@ -1591,6 +1592,7 @@ type Database = {
1591
1592
  organization_id?: string;
1592
1593
  payment_link_sent_at?: string | null;
1593
1594
  payment_received_at?: string | null;
1595
+ pipeline_key?: string;
1594
1596
  proposal_data?: Json | null;
1595
1597
  proposal_generated_at?: string | null;
1596
1598
  proposal_pdf_url?: string | null;
@@ -1598,10 +1600,11 @@ type Database = {
1598
1600
  proposal_reviewed_by?: string | null;
1599
1601
  proposal_sent_at?: string | null;
1600
1602
  proposal_signed_at?: string | null;
1601
- proposal_status?: string | null;
1602
1603
  signature_envelope_id?: string | null;
1603
1604
  source_list_id?: string | null;
1604
1605
  source_type?: string | null;
1606
+ stage_key?: string | null;
1607
+ state_key?: string | null;
1605
1608
  stripe_payment_id?: string | null;
1606
1609
  stripe_payment_link?: string | null;
1607
1610
  stripe_payment_link_id?: string | null;
@@ -2770,6 +2773,7 @@ type Database = {
2770
2773
  Row: {
2771
2774
  config: Json;
2772
2775
  created_at: string | null;
2776
+ effective_permissions: string[];
2773
2777
  id: string;
2774
2778
  membership_status: string | null;
2775
2779
  organization_id: string;
@@ -2781,6 +2785,7 @@ type Database = {
2781
2785
  Insert: {
2782
2786
  config?: Json;
2783
2787
  created_at?: string | null;
2788
+ effective_permissions?: string[];
2784
2789
  id?: string;
2785
2790
  membership_status?: string | null;
2786
2791
  organization_id: string;
@@ -2792,6 +2797,7 @@ type Database = {
2792
2797
  Update: {
2793
2798
  config?: Json;
2794
2799
  created_at?: string | null;
2800
+ effective_permissions?: string[];
2795
2801
  id?: string;
2796
2802
  membership_status?: string | null;
2797
2803
  organization_id?: string;
@@ -2817,6 +2823,147 @@ type Database = {
2817
2823
  }
2818
2824
  ];
2819
2825
  };
2826
+ org_rol_assignments: {
2827
+ Row: {
2828
+ granted_at: string;
2829
+ granted_by: string | null;
2830
+ membership_id: string;
2831
+ role_id: string;
2832
+ };
2833
+ Insert: {
2834
+ granted_at?: string;
2835
+ granted_by?: string | null;
2836
+ membership_id: string;
2837
+ role_id: string;
2838
+ };
2839
+ Update: {
2840
+ granted_at?: string;
2841
+ granted_by?: string | null;
2842
+ membership_id?: string;
2843
+ role_id?: string;
2844
+ };
2845
+ Relationships: [
2846
+ {
2847
+ foreignKeyName: "org_rol_assignments_granted_by_fkey";
2848
+ columns: ["granted_by"];
2849
+ isOneToOne: false;
2850
+ referencedRelation: "users";
2851
+ referencedColumns: ["id"];
2852
+ },
2853
+ {
2854
+ foreignKeyName: "org_rol_assignments_membership_id_fkey";
2855
+ columns: ["membership_id"];
2856
+ isOneToOne: false;
2857
+ referencedRelation: "org_memberships";
2858
+ referencedColumns: ["id"];
2859
+ },
2860
+ {
2861
+ foreignKeyName: "org_rol_assignments_role_id_fkey";
2862
+ columns: ["role_id"];
2863
+ isOneToOne: false;
2864
+ referencedRelation: "org_rol_definitions";
2865
+ referencedColumns: ["id"];
2866
+ }
2867
+ ];
2868
+ };
2869
+ org_rol_definitions: {
2870
+ Row: {
2871
+ created_at: string;
2872
+ description: string | null;
2873
+ id: string;
2874
+ is_system: boolean;
2875
+ name: string;
2876
+ organization_id: string | null;
2877
+ slug: string;
2878
+ updated_at: string;
2879
+ };
2880
+ Insert: {
2881
+ created_at?: string;
2882
+ description?: string | null;
2883
+ id?: string;
2884
+ is_system?: boolean;
2885
+ name: string;
2886
+ organization_id?: string | null;
2887
+ slug: string;
2888
+ updated_at?: string;
2889
+ };
2890
+ Update: {
2891
+ created_at?: string;
2892
+ description?: string | null;
2893
+ id?: string;
2894
+ is_system?: boolean;
2895
+ name?: string;
2896
+ organization_id?: string | null;
2897
+ slug?: string;
2898
+ updated_at?: string;
2899
+ };
2900
+ Relationships: [
2901
+ {
2902
+ foreignKeyName: "org_rol_definitions_organization_id_fkey";
2903
+ columns: ["organization_id"];
2904
+ isOneToOne: false;
2905
+ referencedRelation: "organizations";
2906
+ referencedColumns: ["id"];
2907
+ }
2908
+ ];
2909
+ };
2910
+ org_rol_grants: {
2911
+ Row: {
2912
+ granted_at: string;
2913
+ permission_key: string;
2914
+ role_id: string;
2915
+ };
2916
+ Insert: {
2917
+ granted_at?: string;
2918
+ permission_key: string;
2919
+ role_id: string;
2920
+ };
2921
+ Update: {
2922
+ granted_at?: string;
2923
+ permission_key?: string;
2924
+ role_id?: string;
2925
+ };
2926
+ Relationships: [
2927
+ {
2928
+ foreignKeyName: "org_rol_grants_permission_key_fkey";
2929
+ columns: ["permission_key"];
2930
+ isOneToOne: false;
2931
+ referencedRelation: "org_rol_permissions";
2932
+ referencedColumns: ["key"];
2933
+ },
2934
+ {
2935
+ foreignKeyName: "org_rol_grants_role_id_fkey";
2936
+ columns: ["role_id"];
2937
+ isOneToOne: false;
2938
+ referencedRelation: "org_rol_definitions";
2939
+ referencedColumns: ["id"];
2940
+ }
2941
+ ];
2942
+ };
2943
+ org_rol_permissions: {
2944
+ Row: {
2945
+ created_at: string;
2946
+ description: string;
2947
+ is_org_grantable: boolean;
2948
+ key: string;
2949
+ updated_at: string;
2950
+ };
2951
+ Insert: {
2952
+ created_at?: string;
2953
+ description: string;
2954
+ is_org_grantable?: boolean;
2955
+ key: string;
2956
+ updated_at?: string;
2957
+ };
2958
+ Update: {
2959
+ created_at?: string;
2960
+ description?: string;
2961
+ is_org_grantable?: boolean;
2962
+ key?: string;
2963
+ updated_at?: string;
2964
+ };
2965
+ Relationships: [];
2966
+ };
2820
2967
  organizations: {
2821
2968
  Row: {
2822
2969
  config: Json;
@@ -3574,7 +3721,8 @@ type Database = {
3574
3721
  created_at: string;
3575
3722
  description: string | null;
3576
3723
  id: string;
3577
- key: string;
3724
+ key_hash: string;
3725
+ key_prefix: string | null;
3578
3726
  last_triggered_at: string | null;
3579
3727
  name: string;
3580
3728
  organization_id: string;
@@ -3587,7 +3735,8 @@ type Database = {
3587
3735
  created_at?: string;
3588
3736
  description?: string | null;
3589
3737
  id?: string;
3590
- key: string;
3738
+ key_hash: string;
3739
+ key_prefix?: string | null;
3591
3740
  last_triggered_at?: string | null;
3592
3741
  name: string;
3593
3742
  organization_id: string;
@@ -3600,7 +3749,8 @@ type Database = {
3600
3749
  created_at?: string;
3601
3750
  description?: string | null;
3602
3751
  id?: string;
3603
- key?: string;
3752
+ key_hash?: string;
3753
+ key_prefix?: string | null;
3604
3754
  last_triggered_at?: string | null;
3605
3755
  name?: string;
3606
3756
  organization_id?: string;
@@ -3646,6 +3796,13 @@ type Database = {
3646
3796
  Args: never;
3647
3797
  Returns: string;
3648
3798
  };
3799
+ can_assign_role_in_org: {
3800
+ Args: {
3801
+ p_role_id: string;
3802
+ p_target_membership_id: string;
3803
+ };
3804
+ Returns: boolean;
3805
+ };
3649
3806
  current_user_is_platform_admin: {
3650
3807
  Args: never;
3651
3808
  Returns: boolean;
@@ -3675,6 +3832,10 @@ type Database = {
3675
3832
  user_id: string;
3676
3833
  }[];
3677
3834
  };
3835
+ get_platform_credential_kek: {
3836
+ Args: never;
3837
+ Returns: string;
3838
+ };
3678
3839
  get_storage_org_id: {
3679
3840
  Args: {
3680
3841
  file_path: string;
@@ -3685,9 +3846,10 @@ type Database = {
3685
3846
  Args: never;
3686
3847
  Returns: string;
3687
3848
  };
3688
- is_org_admin: {
3849
+ has_org_permission: {
3689
3850
  Args: {
3690
3851
  org_id: string;
3852
+ perm_key: string;
3691
3853
  };
3692
3854
  Returns: boolean;
3693
3855
  };
@@ -3717,6 +3879,22 @@ type Database = {
3717
3879
  Args: never;
3718
3880
  Returns: Json;
3719
3881
  };
3882
+ recompute_all_memberships: {
3883
+ Args: never;
3884
+ Returns: undefined;
3885
+ };
3886
+ sync_all_memberships_with_role: {
3887
+ Args: {
3888
+ p_role_id: string;
3889
+ };
3890
+ Returns: undefined;
3891
+ };
3892
+ sync_one_membership: {
3893
+ Args: {
3894
+ p_membership_id: string;
3895
+ };
3896
+ Returns: undefined;
3897
+ };
3720
3898
  upsert_user_profile: {
3721
3899
  Args: never;
3722
3900
  Returns: {
@@ -4176,7 +4354,6 @@ interface UpdateProposalDataParams {
4176
4354
  contactEmail: string;
4177
4355
  proposalData: unknown;
4178
4356
  proposalPdfUrl?: string;
4179
- proposalStatus?: string;
4180
4357
  }
4181
4358
  interface MarkProposalSentParams {
4182
4359
  organizationId: string;
@@ -4200,10 +4377,14 @@ interface UpdateFeesParams {
4200
4377
  initialFee?: number;
4201
4378
  monthlyFee?: number;
4202
4379
  }
4203
- interface SyncDealStageParams {
4380
+ interface TransitionItemParams {
4204
4381
  organizationId: string;
4205
4382
  dealId: string;
4206
- stage: string;
4383
+ pipelineKey: string;
4384
+ stageKey: string;
4385
+ stateKey?: string | null;
4386
+ reason?: string;
4387
+ expectedUpdatedAt?: string;
4207
4388
  }
4208
4389
  interface SetContactNurtureParams {
4209
4390
  organizationId: string;
@@ -4222,7 +4403,7 @@ interface ClearDealFieldsParams {
4222
4403
  organizationId: string;
4223
4404
  contactEmail?: string;
4224
4405
  dealId?: string;
4225
- fields: ('proposalPdfUrl' | 'proposalStatus' | 'proposalGeneratedAt' | 'initialFee' | 'monthlyFee' | 'closedLostReason' | 'closedLostAt' | 'discoveryData' | 'discoverySubmittedAt')[];
4406
+ fields: ('proposalPdfUrl' | 'proposalGeneratedAt' | 'initialFee' | 'monthlyFee' | 'closedLostReason' | 'closedLostAt' | 'discoveryData' | 'discoverySubmittedAt')[];
4226
4407
  }
4227
4408
  interface DeleteDealParams {
4228
4409
  organizationId: string;
@@ -4268,10 +4449,11 @@ interface AcqDeal {
4268
4449
  id: string;
4269
4450
  organizationId: string;
4270
4451
  contactEmail: string;
4271
- cachedStage?: string | null;
4452
+ pipelineKey: string;
4453
+ stageKey?: string | null;
4454
+ stateKey?: string | null;
4272
4455
  discoveryData?: Json | null;
4273
4456
  proposalData?: Json | null;
4274
- proposalStatus?: string | null;
4275
4457
  proposalSentAt?: string | null;
4276
4458
  proposalPdfUrl?: string | null;
4277
4459
  signatureEnvelopeId?: string | null;
@@ -4349,7 +4531,7 @@ interface DealStageSummary {
4349
4531
  interface StaleDeal {
4350
4532
  id: string;
4351
4533
  contactEmail: string;
4352
- cachedStage: string;
4534
+ stageKey: string;
4353
4535
  updatedAt: string;
4354
4536
  daysStale: number;
4355
4537
  }
@@ -4548,6 +4730,96 @@ interface ProjectDetail extends ProjectRow {
4548
4730
  } | null;
4549
4731
  }
4550
4732
 
4733
+ declare const ActivityEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4734
+ type: z.ZodLiteral<"stage_change">;
4735
+ timestamp: z.ZodString;
4736
+ stageBefore: z.ZodString;
4737
+ stageAfter: z.ZodString;
4738
+ reason: z.ZodOptional<z.ZodString>;
4739
+ }, z.core.$strip>, z.ZodObject<{
4740
+ type: z.ZodLiteral<"state_change">;
4741
+ timestamp: z.ZodString;
4742
+ stateBefore: z.ZodNullable<z.ZodString>;
4743
+ stateAfter: z.ZodNullable<z.ZodString>;
4744
+ reason: z.ZodOptional<z.ZodString>;
4745
+ }, z.core.$strip>, z.ZodObject<{
4746
+ type: z.ZodLiteral<"action_taken">;
4747
+ timestamp: z.ZodString;
4748
+ actionKey: z.ZodString;
4749
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4750
+ }, z.core.$strip>, z.ZodObject<{
4751
+ type: z.ZodLiteral<"approval_created">;
4752
+ timestamp: z.ZodString;
4753
+ commandId: z.ZodString;
4754
+ dealStageBefore: z.ZodOptional<z.ZodString>;
4755
+ dealStageAfter: z.ZodOptional<z.ZodString>;
4756
+ }, z.core.$strip>, z.ZodObject<{
4757
+ type: z.ZodLiteral<"approval_resolved">;
4758
+ timestamp: z.ZodString;
4759
+ commandId: z.ZodString;
4760
+ resolution: z.ZodEnum<{
4761
+ superseded: "superseded";
4762
+ }>;
4763
+ originResourceType: z.ZodOptional<z.ZodString>;
4764
+ }, z.core.$strip>, z.ZodObject<{
4765
+ type: z.ZodLiteral<"approval_stale">;
4766
+ timestamp: z.ZodString;
4767
+ commandId: z.ZodString;
4768
+ dealStageBefore: z.ZodOptional<z.ZodString>;
4769
+ dealStageAfter: z.ZodOptional<z.ZodString>;
4770
+ }, z.core.$strip>, z.ZodObject<{
4771
+ type: z.ZodLiteral<"task_created">;
4772
+ timestamp: z.ZodString;
4773
+ taskId: z.ZodString;
4774
+ }, z.core.$strip>, z.ZodObject<{
4775
+ type: z.ZodLiteral<"deal_created">;
4776
+ timestamp: z.ZodString;
4777
+ }, z.core.$strip>, z.ZodObject<{
4778
+ type: z.ZodLiteral<"reply_received">;
4779
+ timestamp: z.ZodString;
4780
+ messageId: z.ZodOptional<z.ZodString>;
4781
+ source: z.ZodOptional<z.ZodString>;
4782
+ }, z.core.$strip>, z.ZodObject<{
4783
+ type: z.ZodLiteral<"reply_sent_to_lead">;
4784
+ timestamp: z.ZodString;
4785
+ messageId: z.ZodOptional<z.ZodString>;
4786
+ source: z.ZodOptional<z.ZodString>;
4787
+ }, z.core.$strip>, z.ZodObject<{
4788
+ type: z.ZodLiteral<"booking_nudge_sent">;
4789
+ timestamp: z.ZodString;
4790
+ followupDay: z.ZodNumber;
4791
+ }, z.core.$strip>, z.ZodObject<{
4792
+ type: z.ZodLiteral<"reminder_sent">;
4793
+ timestamp: z.ZodString;
4794
+ followupDay: z.ZodOptional<z.ZodNumber>;
4795
+ }, z.core.$strip>, z.ZodObject<{
4796
+ type: z.ZodLiteral<"booking_cancelled">;
4797
+ timestamp: z.ZodString;
4798
+ reason: z.ZodOptional<z.ZodString>;
4799
+ }, z.core.$strip>, z.ZodObject<{
4800
+ type: z.ZodLiteral<"discovery_submitted">;
4801
+ timestamp: z.ZodString;
4802
+ }, z.core.$strip>, z.ZodObject<{
4803
+ type: z.ZodLiteral<"moved_to_nurturing">;
4804
+ timestamp: z.ZodString;
4805
+ }, z.core.$strip>, z.ZodObject<{
4806
+ type: z.ZodLiteral<"no_show">;
4807
+ timestamp: z.ZodString;
4808
+ }, z.core.$strip>, z.ZodObject<{
4809
+ type: z.ZodLiteral<"followup_email_sent">;
4810
+ timestamp: z.ZodString;
4811
+ followupDay: z.ZodOptional<z.ZodNumber>;
4812
+ }, z.core.$strip>], "type">;
4813
+ type ActivityEvent = z.infer<typeof ActivityEventSchema>;
4814
+
4815
+ interface Action {
4816
+ key: string;
4817
+ label: string;
4818
+ kind: 'transition' | 'edit' | 'modal';
4819
+ payload?: Record<string, unknown>;
4820
+ }
4821
+ declare function deriveActions(deal: AcqDealRow): Action[];
4822
+
4551
4823
  declare const DealSchemas: {
4552
4824
  DealIdParams: z.ZodObject<{
4553
4825
  dealId: z.ZodString;
@@ -4597,15 +4869,12 @@ declare const DealSchemas: {
4597
4869
  dueAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4598
4870
  assigneeUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4599
4871
  }, z.core.$strict>;
4600
- SyncDealStageRequest: z.ZodObject<{
4601
- stage: z.ZodEnum<{
4602
- nurturing: "nurturing";
4603
- closed_won: "closed_won";
4604
- closed_lost: "closed_lost";
4605
- interested: "interested";
4606
- proposal: "proposal";
4607
- closing: "closing";
4608
- }>;
4872
+ TransitionItemRequest: z.ZodObject<{
4873
+ pipelineKey: z.ZodString;
4874
+ stageKey: z.ZodString;
4875
+ stateKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4876
+ reason: z.ZodOptional<z.ZodString>;
4877
+ expectedUpdatedAt: z.ZodOptional<z.ZodString>;
4609
4878
  }, z.core.$strict>;
4610
4879
  DealListResponse: z.ZodObject<{
4611
4880
  data: z.ZodArray<z.ZodObject<{
@@ -4613,13 +4882,14 @@ declare const DealSchemas: {
4613
4882
  organization_id: z.ZodString;
4614
4883
  contact_id: z.ZodNullable<z.ZodString>;
4615
4884
  contact_email: z.ZodString;
4616
- cached_stage: z.ZodNullable<z.ZodString>;
4885
+ pipeline_key: z.ZodString;
4886
+ stage_key: z.ZodNullable<z.ZodString>;
4887
+ state_key: z.ZodNullable<z.ZodString>;
4617
4888
  activity_log: z.ZodUnknown;
4618
4889
  discovery_data: z.ZodNullable<z.ZodUnknown>;
4619
4890
  discovery_submitted_at: z.ZodNullable<z.ZodString>;
4620
4891
  discovery_submitted_by: z.ZodNullable<z.ZodString>;
4621
4892
  proposal_data: z.ZodNullable<z.ZodUnknown>;
4622
- proposal_status: z.ZodNullable<z.ZodString>;
4623
4893
  proposal_sent_at: z.ZodNullable<z.ZodString>;
4624
4894
  proposal_pdf_url: z.ZodNullable<z.ZodString>;
4625
4895
  signature_envelope_id: z.ZodNullable<z.ZodString>;
@@ -4674,7 +4944,7 @@ declare const DealSchemas: {
4674
4944
  staleDeals: z.ZodArray<z.ZodObject<{
4675
4945
  id: z.ZodString;
4676
4946
  contactEmail: z.ZodString;
4677
- cachedStage: z.ZodString;
4947
+ stageKey: z.ZodString;
4678
4948
  updatedAt: z.ZodString;
4679
4949
  daysStale: z.ZodNumber;
4680
4950
  }, z.core.$strip>>;
@@ -4682,7 +4952,7 @@ declare const DealSchemas: {
4682
4952
  DealLookupResponse: z.ZodArray<z.ZodObject<{
4683
4953
  id: z.ZodString;
4684
4954
  contactEmail: z.ZodString;
4685
- cachedStage: z.ZodNullable<z.ZodString>;
4955
+ stageKey: z.ZodNullable<z.ZodString>;
4686
4956
  updatedAt: z.ZodString;
4687
4957
  contactName: z.ZodNullable<z.ZodString>;
4688
4958
  companyName: z.ZodNullable<z.ZodString>;
@@ -4693,13 +4963,14 @@ declare const DealSchemas: {
4693
4963
  organization_id: z.ZodString;
4694
4964
  contact_id: z.ZodNullable<z.ZodString>;
4695
4965
  contact_email: z.ZodString;
4696
- cached_stage: z.ZodNullable<z.ZodString>;
4966
+ pipeline_key: z.ZodString;
4967
+ stage_key: z.ZodNullable<z.ZodString>;
4968
+ state_key: z.ZodNullable<z.ZodString>;
4697
4969
  activity_log: z.ZodUnknown;
4698
4970
  discovery_data: z.ZodNullable<z.ZodUnknown>;
4699
4971
  discovery_submitted_at: z.ZodNullable<z.ZodString>;
4700
4972
  discovery_submitted_by: z.ZodNullable<z.ZodString>;
4701
4973
  proposal_data: z.ZodNullable<z.ZodUnknown>;
4702
- proposal_status: z.ZodNullable<z.ZodString>;
4703
4974
  proposal_sent_at: z.ZodNullable<z.ZodString>;
4704
4975
  proposal_pdf_url: z.ZodNullable<z.ZodString>;
4705
4976
  signature_envelope_id: z.ZodNullable<z.ZodString>;
@@ -6995,7 +7266,6 @@ type ProjectsToolMap = {
6995
7266
  type CrmRecentActivityParams = Partial<z.infer<typeof CrmSchemas.GetRecentActivityQuery>>;
6996
7267
  type CrmListDealsParams = Partial<z.infer<typeof DealSchemas.ListDealsQuery>>;
6997
7268
  type CrmGetDealParams = z.infer<typeof DealSchemas.DealIdParams>;
6998
- type CrmUpdateDealStageParams = z.infer<typeof DealSchemas.DealIdParams> & z.infer<typeof DealSchemas.SyncDealStageRequest>;
6999
7269
  type CrmGetDealByEmailParams = {
7000
7270
  email: string;
7001
7271
  };
@@ -7021,10 +7291,6 @@ type CrmToolMap = {
7021
7291
  params: CrmGetDealByEmailParams;
7022
7292
  result: DealDetail | null;
7023
7293
  };
7024
- updateDealStage: {
7025
- params: CrmUpdateDealStageParams;
7026
- result: void;
7027
- };
7028
7294
  createDealNote: {
7029
7295
  params: CrmDealNoteParams;
7030
7296
  result: AcqDealNote;
@@ -7501,8 +7767,8 @@ type LeadToolMap = {
7501
7767
  params: Omit<UpdateFeesParams, 'organizationId'>;
7502
7768
  result: void;
7503
7769
  };
7504
- syncDealStage: {
7505
- params: Omit<SyncDealStageParams, 'organizationId'>;
7770
+ transitionItem: {
7771
+ params: Omit<TransitionItemParams, 'organizationId'>;
7506
7772
  result: void;
7507
7773
  };
7508
7774
  setContactNurture: {
@@ -8414,6 +8680,19 @@ interface RemoteOrgConfig {
8414
8680
  /** Deployment version (semver) of the deployed bundle */
8415
8681
  deploymentVersion?: string;
8416
8682
  }
8683
+ /**
8684
+ * Configuration for a first-class System resource.
8685
+ *
8686
+ * System resources are owned by the platform, registered under the 'system' org,
8687
+ * and execute via the static-bundle loader mode in executeInWorker(). The moduleId
8688
+ * maps to an entry in the API's STATIC_MODULE_MAP.
8689
+ */
8690
+ interface SystemConfig {
8691
+ kind: 'static';
8692
+ moduleId: string;
8693
+ /** Always undefined for system resources; present for API compatibility with RemoteOrgConfig consumers */
8694
+ sdkVersion?: never;
8695
+ }
8417
8696
  /**
8418
8697
  * Organization-specific resource collection
8419
8698
  *
@@ -8456,6 +8735,12 @@ declare class ResourceRegistry {
8456
8735
  * Static and remote resources coexist in the same org.
8457
8736
  */
8458
8737
  private remoteResources;
8738
+ /**
8739
+ * System configs for first-class platform resources.
8740
+ * Key: "orgName/resourceId", Value: SystemConfig.
8741
+ * Registered at startup alongside registerStaticResources().
8742
+ */
8743
+ private systemConfigs;
8459
8744
  constructor(registry: OrganizationRegistry);
8460
8745
  /**
8461
8746
  * Validates registry on construction
@@ -8575,17 +8860,29 @@ declare class ResourceRegistry {
8575
8860
  */
8576
8861
  unregisterOrganization(orgName: string): void;
8577
8862
  /**
8578
- * Get remote configuration for a specific resource
8863
+ * Get remote configuration for a specific resource.
8579
8864
  *
8580
- * Returns the RemoteOrgConfig if the resource was registered at runtime,
8581
- * or null if it's a static resource or doesn't exist.
8582
- * Used by the execution coordinator to branch between local and worker execution.
8865
+ * Returns RemoteOrgConfig for externally-deployed resources, SystemConfig for
8866
+ * first-class platform resources, or null for static in-process resources.
8867
+ * Used by the execution coordinator to determine the execution path.
8583
8868
  *
8584
8869
  * @param orgName - Organization name
8585
8870
  * @param resourceId - Resource ID
8586
- * @returns Remote config or null
8871
+ * @returns Remote or System config, or null
8872
+ */
8873
+ getRemoteConfig(orgName: string, resourceId: string): RemoteOrgConfig | SystemConfig | null;
8874
+ /**
8875
+ * Register a System config for a first-class platform resource.
8876
+ *
8877
+ * Called at startup alongside registerStaticResources() so that
8878
+ * getRemoteConfig('system', resourceId) returns truthy and the execution
8879
+ * coordinator routes the resource through the worker-thread path.
8880
+ *
8881
+ * @param orgName - Organization name (typically 'system')
8882
+ * @param resourceId - Resource ID
8883
+ * @param config - SystemConfig with kind:'static' and moduleId
8587
8884
  */
8588
- getRemoteConfig(orgName: string, resourceId: string): RemoteOrgConfig | null;
8885
+ registerSystemConfig(orgName: string, resourceId: string, config: SystemConfig): void;
8589
8886
  /**
8590
8887
  * Check if an organization has any remote (externally deployed) resources
8591
8888
  *
@@ -8736,7 +9033,7 @@ declare class RegistryValidationError extends Error {
8736
9033
  * Typed wrapper over platform.call() for LLM generation.
8737
9034
  * Singleton export -- no credential needed (platform tool).
8738
9035
  *
8739
- * Types are shared with the server-side LLM engine via @repo/core/execution.
9036
+ * Types are shared with the server-side LLM engine and inlined for SDK consumers.
8740
9037
  */
8741
9038
 
8742
9039
  type LLMProvider = 'openai' | 'anthropic' | 'openrouter' | 'google';
@@ -8794,5 +9091,5 @@ declare class ToolingError extends ExecutionError {
8794
9091
  constructor(errorType: string, message: string, details?: unknown);
8795
9092
  }
8796
9093
 
8797
- export { ExecutionError, RegistryValidationError, ResourceRegistry, StepType, ToolingError };
8798
- export type { AbsoluteScheduleConfig, AcqCompany, AcqContact, AcqDeal, AcqList, AddToCampaignLead, AddToCampaignParams, AddToCampaignResult, AgentConfig, AgentConstraints, AgentDefinition, AgentMemory, FindCompanyEmailParams as AnymailfinderFindCompanyEmailParams, FindCompanyEmailResult as AnymailfinderFindCompanyEmailResult, FindDecisionMakerEmailParams as AnymailfinderFindDecisionMakerEmailParams, FindDecisionMakerEmailResult as AnymailfinderFindDecisionMakerEmailResult, FindPersonEmailParams as AnymailfinderFindPersonEmailParams, FindPersonEmailResult as AnymailfinderFindPersonEmailResult, AnymailfinderToolMap, VerifyEmailParams as AnymailfinderVerifyEmailParams, VerifyEmailResult as AnymailfinderVerifyEmailResult, ApifyToolMap, ApifyWebhookConfig, AppendRowsParams, AppendRowsResult, ApprovalToolMap, AttioToolMap, BatchUpdateParams, BatchUpdateResult, BulkDeleteLeadsParams, BulkDeleteLeadsResult, BulkImportParams, BulkImportResult, CancelHitlByDealIdParams, CancelSchedulesAndHitlByEmailParams, ClearDealFieldsParams, ClearRangeParams, ClearRangeResult, CompanyFilters, ConditionalNext, ContactFilters, Contract, CreateAttributeParams, CreateAttributeResult, CreateAutoPaymentLinkParams, CreateAutoPaymentLinkResult, CreateCheckoutSessionParams, CreateCheckoutSessionResult, CreateCompanyParams, CreateContactParams, CreateEnvelopeParams, CreateEnvelopeResult, CreateFolderParams, CreateFolderResult, CreateListParams, CreateNoteParams, CreateNoteResult, CreatePaymentLinkParams, CreatePaymentLinkResult, CreateRecordParams, CreateRecordResult, CreateScheduleInput, CrmToolMap, DeleteDealParams, DeleteNoteParams, DeleteNoteResult, DeleteRecordParams, DeleteRecordResult, DeleteRowByValueParams, DeleteRowByValueResult, DeploymentSpec, DownloadDocumentParams, DownloadDocumentResult, DropboxToolMap, ElevasConfig, EmailToolMap, EnvelopeDocument, EventTriggerConfig, ExecutionContext, ExecutionInterface, ExecutionMetadata, ExecutionToolMap, FilterExpression, FilterRowsParams, FilterRowsResult, FormField, FormFieldType, FormSchema, GetDailyCampaignAnalyticsParams, GetDailyCampaignAnalyticsResult, GetEmailsParams, GetEmailsResult, GetEnvelopeParams, GetEnvelopeResult, GetHeadersParams, GetHeadersResult, GetLastRowParams, GetLastRowResult, GetPaymentLinkParams, GetPaymentLinkResult, GetRecordParams, GetRecordResult, GetRowByValueParams, GetRowByValueResult, GetSpreadsheetMetadataParams, GetSpreadsheetMetadataResult, GmailSendEmailParams, GmailSendEmailResult, GmailToolMap, GoogleSheetsToolMap, HumanCheckpointDefinition, InstantlyToolMap, IntegrationDefinition, LLMAdapterFactory, LLMGenerateRequest, LLMGenerateResponse, LLMMessage, LLMModel, LeadToolMap, LinearNext, ListAttributesParams, ListAttributesResult, ListLeadsParams, ListLeadsResult, ListNotesParams, ListNotesResult, ListObjectsResult, ListPaymentLinksParams, ListPaymentLinksResult, ListToolMap, MarkProposalReviewedParams, MarkProposalSentParams, MethodEntry, MillionVerifierToolMap, ModelConfig, NextConfig, NotificationSDKInput, NotificationToolMap, PaginatedResult, PaginationParams, PdfToolMap, ProjectsToolMap, QueryRecordsParams, QueryRecordsResult, ReadSheetParams, ReadSheetResult, Recipient, RecurringScheduleConfig, RelationshipDeclaration, RelativeScheduleConfig, RemoveFromSubsequenceParams, RemoveFromSubsequenceResult, ResendGetEmailParams, ResendGetEmailResult, ResendSendEmailParams, ResendSendEmailResult, ResendToolMap, ResourceCategory, ResourceDefinition, ResourceLink, ResourceMetricsConfig, ResourceRelationships, ResourceStatus$1 as ResourceStatus, ResourceType, RunActorParams, RunActorResult, SDKLLMGenerateParams, ScheduleOriginTracking, ScheduleTarget, ScheduleTriggerConfig, SchedulerToolMap, SendReplyParams, SendReplyResult, SetContactNurtureParams, SheetInfo, SignatureApiFieldType, SignatureApiToolMap, SigningPlace, SortCriteria, StartActorParams, StartActorResult, StepHandler, StorageDeleteInput, StorageDeleteOutput, StorageDownloadInput, StorageDownloadOutput, StorageListInput, StorageListOutput, StorageSignedUrlInput, StorageSignedUrlOutput, StorageToolMap, StorageUploadInput, StorageUploadOutput, StripeToolMap, SyncDealStageParams, TaskSchedule, TaskScheduleConfig, TombaToolMap, Tool, ToolExecutionOptions, ToolMethodMap, ToolingErrorType, TriggerConfig, TriggerDefinition, UpdateAttributeParams, UpdateAttributeResult, UpdateCloseLostReasonParams, UpdateCompanyParams, UpdateContactParams, UpdateDiscoveryDataParams, UpdateFeesParams, UpdateInterestStatusParams, UpdateInterestStatusResult, UpdateListParams, UpdatePaymentLinkParams, UpdatePaymentLinkResult, UpdateProposalDataParams, UpdateRecordParams, UpdateRecordResult, UpdateRowByValueParams, UpdateRowByValueResult, UploadFileParams, UploadFileResult, UpsertCompanyParams, UpsertContactParams, UpsertDealParams, UpsertRowParams, UpsertRowResult, VoidEnvelopeParams, VoidEnvelopeResult, WebhookProviderType, WebhookTriggerConfig, WorkflowConfig, WorkflowDefinition, WorkflowStep, WriteSheetParams, WriteSheetResult };
9094
+ export { ActivityEventSchema, ExecutionError, RegistryValidationError, ResourceRegistry, StepType, ToolingError, deriveActions };
9095
+ export type { AbsoluteScheduleConfig, AcqCompany, AcqContact, AcqDeal, AcqDealRow, AcqList, Action, ActivityEvent, AddToCampaignLead, AddToCampaignParams, AddToCampaignResult, AgentConfig, AgentConstraints, AgentDefinition, AgentMemory, FindCompanyEmailParams as AnymailfinderFindCompanyEmailParams, FindCompanyEmailResult as AnymailfinderFindCompanyEmailResult, FindDecisionMakerEmailParams as AnymailfinderFindDecisionMakerEmailParams, FindDecisionMakerEmailResult as AnymailfinderFindDecisionMakerEmailResult, FindPersonEmailParams as AnymailfinderFindPersonEmailParams, FindPersonEmailResult as AnymailfinderFindPersonEmailResult, AnymailfinderToolMap, VerifyEmailParams as AnymailfinderVerifyEmailParams, VerifyEmailResult as AnymailfinderVerifyEmailResult, ApifyToolMap, ApifyWebhookConfig, AppendRowsParams, AppendRowsResult, ApprovalToolMap, AttioToolMap, BatchUpdateParams, BatchUpdateResult, BulkDeleteLeadsParams, BulkDeleteLeadsResult, BulkImportParams, BulkImportResult, CancelHitlByDealIdParams, CancelSchedulesAndHitlByEmailParams, ClearDealFieldsParams, ClearRangeParams, ClearRangeResult, CompanyFilters, ConditionalNext, ContactFilters, Contract, CreateAttributeParams, CreateAttributeResult, CreateAutoPaymentLinkParams, CreateAutoPaymentLinkResult, CreateCheckoutSessionParams, CreateCheckoutSessionResult, CreateCompanyParams, CreateContactParams, CreateEnvelopeParams, CreateEnvelopeResult, CreateFolderParams, CreateFolderResult, CreateListParams, CreateNoteParams, CreateNoteResult, CreatePaymentLinkParams, CreatePaymentLinkResult, CreateRecordParams, CreateRecordResult, CreateScheduleInput, CrmToolMap, DeleteDealParams, DeleteNoteParams, DeleteNoteResult, DeleteRecordParams, DeleteRecordResult, DeleteRowByValueParams, DeleteRowByValueResult, DeploymentSpec, DownloadDocumentParams, DownloadDocumentResult, DropboxToolMap, ElevasConfig, EmailToolMap, EnvelopeDocument, EventTriggerConfig, ExecutionContext, ExecutionInterface, ExecutionMetadata, ExecutionToolMap, FilterExpression, FilterRowsParams, FilterRowsResult, FormField, FormFieldType, FormSchema, GetDailyCampaignAnalyticsParams, GetDailyCampaignAnalyticsResult, GetEmailsParams, GetEmailsResult, GetEnvelopeParams, GetEnvelopeResult, GetHeadersParams, GetHeadersResult, GetLastRowParams, GetLastRowResult, GetPaymentLinkParams, GetPaymentLinkResult, GetRecordParams, GetRecordResult, GetRowByValueParams, GetRowByValueResult, GetSpreadsheetMetadataParams, GetSpreadsheetMetadataResult, GmailSendEmailParams, GmailSendEmailResult, GmailToolMap, GoogleSheetsToolMap, HumanCheckpointDefinition, InstantlyToolMap, IntegrationDefinition, LLMAdapterFactory, LLMGenerateRequest, LLMGenerateResponse, LLMMessage, LLMModel, LeadToolMap, LinearNext, ListAttributesParams, ListAttributesResult, ListLeadsParams, ListLeadsResult, ListNotesParams, ListNotesResult, ListObjectsResult, ListPaymentLinksParams, ListPaymentLinksResult, ListToolMap, MarkProposalReviewedParams, MarkProposalSentParams, MethodEntry, MillionVerifierToolMap, ModelConfig, NextConfig, NotificationSDKInput, NotificationToolMap, PaginatedResult, PaginationParams, PdfToolMap, ProjectsToolMap, QueryRecordsParams, QueryRecordsResult, ReadSheetParams, ReadSheetResult, Recipient, RecurringScheduleConfig, RelationshipDeclaration, RelativeScheduleConfig, RemoveFromSubsequenceParams, RemoveFromSubsequenceResult, ResendGetEmailParams, ResendGetEmailResult, ResendSendEmailParams, ResendSendEmailResult, ResendToolMap, ResourceCategory, ResourceDefinition, ResourceLink, ResourceMetricsConfig, ResourceRelationships, ResourceStatus$1 as ResourceStatus, ResourceType, RunActorParams, RunActorResult, SDKLLMGenerateParams, ScheduleOriginTracking, ScheduleTarget, ScheduleTriggerConfig, SchedulerToolMap, SendReplyParams, SendReplyResult, SetContactNurtureParams, SheetInfo, SignatureApiFieldType, SignatureApiToolMap, SigningPlace, SortCriteria, StartActorParams, StartActorResult, StepHandler, StorageDeleteInput, StorageDeleteOutput, StorageDownloadInput, StorageDownloadOutput, StorageListInput, StorageListOutput, StorageSignedUrlInput, StorageSignedUrlOutput, StorageToolMap, StorageUploadInput, StorageUploadOutput, StripeToolMap, TaskSchedule, TaskScheduleConfig, TombaToolMap, Tool, ToolExecutionOptions, ToolMethodMap, ToolingErrorType, TransitionItemParams, TriggerConfig, TriggerDefinition, UpdateAttributeParams, UpdateAttributeResult, UpdateCloseLostReasonParams, UpdateCompanyParams, UpdateContactParams, UpdateDiscoveryDataParams, UpdateFeesParams, UpdateInterestStatusParams, UpdateInterestStatusResult, UpdateListParams, UpdatePaymentLinkParams, UpdatePaymentLinkResult, UpdateProposalDataParams, UpdateRecordParams, UpdateRecordResult, UpdateRowByValueParams, UpdateRowByValueResult, UploadFileParams, UploadFileResult, UpsertCompanyParams, UpsertContactParams, UpsertDealParams, UpsertRowParams, UpsertRowResult, VoidEnvelopeParams, VoidEnvelopeResult, WebhookProviderType, WebhookTriggerConfig, WorkflowConfig, WorkflowDefinition, WorkflowStep, WriteSheetParams, WriteSheetResult };