@elevasis/sdk 1.4.0 → 1.5.1

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 (31) hide show
  1. package/dist/cli.cjs +100 -12
  2. package/dist/index.d.ts +1464 -749
  3. package/dist/index.js +74 -7
  4. package/dist/types/worker/adapters/crm.d.ts +20 -0
  5. package/dist/types/worker/adapters/index.d.ts +2 -0
  6. package/dist/types/worker/adapters/projects.d.ts +20 -0
  7. package/dist/worker/index.js +41 -1
  8. package/package.json +2 -2
  9. package/reference/_navigation.md +24 -0
  10. package/reference/deployment/provided-features.mdx +64 -25
  11. package/reference/framework/index.mdx +2 -2
  12. package/reference/framework/project-structure.mdx +10 -8
  13. package/reference/index.mdx +3 -3
  14. package/reference/packages/core/src/organization-model/README.md +19 -4
  15. package/reference/resources/patterns.mdx +54 -8
  16. package/reference/scaffold/core/organization-graph.mdx +262 -0
  17. package/reference/scaffold/core/organization-model.mdx +257 -0
  18. package/reference/scaffold/index.mdx +59 -0
  19. package/reference/scaffold/operations/workflow-recipes.md +419 -0
  20. package/reference/scaffold/recipes/add-a-feature.md +142 -0
  21. package/reference/scaffold/recipes/add-a-resource.md +163 -0
  22. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +152 -0
  23. package/reference/scaffold/recipes/index.md +32 -0
  24. package/reference/scaffold/reference/contracts.md +1044 -0
  25. package/reference/scaffold/reference/feature-registry.md +30 -0
  26. package/reference/scaffold/reference/glossary.md +88 -0
  27. package/reference/scaffold/ui/composition-extensibility.mdx +216 -0
  28. package/reference/scaffold/ui/customization.md +239 -0
  29. package/reference/scaffold/ui/feature-flags-and-gating.md +265 -0
  30. package/reference/scaffold/ui/feature-shell.mdx +241 -0
  31. package/reference/scaffold/ui/recipes.md +418 -0
package/dist/index.d.ts CHANGED
@@ -3755,703 +3755,320 @@ type Database = {
3755
3755
  };
3756
3756
  };
3757
3757
 
3758
+ /** Raw database row type for acq_deals table */
3759
+ type AcqDealRow = Database['public']['Tables']['acq_deals']['Row'];
3758
3760
  /**
3759
- * Origin resource type - where an execution/task originated from.
3760
- * Used for audit trails and tracking execution lineage.
3761
+ * Tracks pipeline status for a company across all processing stages.
3761
3762
  */
3762
- type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
3763
-
3763
+ interface CompanyPipelineStatus {
3764
+ acquired: boolean;
3765
+ enrichment: {
3766
+ [source: string]: {
3767
+ status: 'pending' | 'complete' | 'failed' | 'skipped';
3768
+ completedAt?: string;
3769
+ error?: string;
3770
+ };
3771
+ };
3772
+ }
3764
3773
  /**
3765
- * Target for schedule execution - identifies what resource to execute.
3766
- * Unlike ExecutionTarget, payload is NOT included here because schedules
3767
- * store payload in the scheduleConfig (varies per step/item).
3774
+ * Tracks pipeline status for a contact across all processing stages.
3768
3775
  */
3769
- interface ScheduleTarget {
3770
- resourceType: 'agent' | 'workflow';
3771
- resourceId: string;
3776
+ interface ContactPipelineStatus {
3777
+ enrichment: {
3778
+ [source: string]: {
3779
+ status: 'pending' | 'complete' | 'failed' | 'skipped';
3780
+ completedAt?: string;
3781
+ error?: string;
3782
+ };
3783
+ };
3784
+ personalization: {
3785
+ status: 'pending' | 'complete' | 'failed' | 'skipped';
3786
+ completedAt?: string;
3787
+ };
3788
+ outreach: {
3789
+ status: 'pending' | 'sent' | 'replied' | 'bounced' | 'opted-out';
3790
+ sentAt?: string;
3791
+ channel?: string;
3792
+ campaignId?: string;
3793
+ };
3772
3794
  }
3773
3795
  /**
3774
- * Optional origin tracking for schedules.
3775
- * Unlike OriginTracking (which is required), these fields are all optional
3776
- * for schedules created directly via API (not triggered by another resource).
3796
+ * Enrichment data collected for a company from various sources.
3777
3797
  */
3778
- interface ScheduleOriginTracking {
3779
- originExecutionId?: string;
3780
- originResourceType?: OriginResourceType;
3781
- originResourceId?: string;
3782
- }
3783
- type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
3784
- interface RecurringScheduleConfig {
3785
- type: 'recurring';
3786
- cron?: string;
3787
- interval?: 'daily' | 'weekly' | 'monthly';
3788
- time?: string;
3789
- timezone: string;
3790
- payload: Record<string, unknown>;
3791
- endAt?: string | null;
3792
- overduePolicy?: 'skip' | 'execute';
3793
- }
3794
- interface RelativeScheduleConfig {
3795
- type: 'relative';
3796
- anchorAt: string;
3797
- anchorLabel?: string;
3798
- items: RelativeScheduleItem[];
3799
- overduePolicy?: 'skip' | 'execute';
3800
- }
3801
- interface RelativeScheduleItem {
3802
- offset: string;
3803
- payload: Record<string, unknown>;
3804
- label?: string;
3805
- }
3806
- interface AbsoluteScheduleConfig {
3807
- type: 'absolute';
3808
- items: AbsoluteScheduleItem[];
3809
- overduePolicy?: 'skip' | 'execute';
3798
+ interface CompanyEnrichmentData {
3799
+ googleMaps?: {
3800
+ placeId?: string;
3801
+ totalScore?: number;
3802
+ reviewsCount?: number;
3803
+ address?: string;
3804
+ phone?: string;
3805
+ categoryName?: string;
3806
+ googleMapsUrl?: string;
3807
+ scrapedAt?: string;
3808
+ };
3809
+ websiteCrawl?: {
3810
+ companyDescription?: string;
3811
+ services?: string[];
3812
+ specialties?: string[];
3813
+ staff?: Array<{
3814
+ name: string;
3815
+ title?: string;
3816
+ email?: string;
3817
+ }>;
3818
+ automationGaps?: string[];
3819
+ targetAudience?: string;
3820
+ category?: string;
3821
+ segment?: string;
3822
+ recentWin?: string;
3823
+ emailCount?: number;
3824
+ pageCount?: number;
3825
+ totalChars?: number;
3826
+ crawledAt?: string;
3827
+ extractedAt?: string;
3828
+ };
3829
+ website?: {
3830
+ missionVision?: string;
3831
+ uniqueAttributes?: string;
3832
+ coreOfferings?: string;
3833
+ targetAudience?: string;
3834
+ companyValues?: string;
3835
+ businessDescription?: string;
3836
+ recentPosts?: Array<{
3837
+ date?: string;
3838
+ title?: string;
3839
+ summary?: string;
3840
+ aiInsight?: string;
3841
+ }>;
3842
+ };
3843
+ tomba?: {
3844
+ waterfallEmail?: {
3845
+ email: string;
3846
+ name?: string;
3847
+ title?: string;
3848
+ department?: string;
3849
+ } | null;
3850
+ genericEmail?: string | null;
3851
+ totalFound?: number;
3852
+ searchedAt?: string;
3853
+ };
3810
3854
  }
3811
- interface AbsoluteScheduleItem {
3812
- runAt: string;
3813
- payload: Record<string, unknown>;
3814
- label?: string;
3855
+ /**
3856
+ * Enrichment data collected for a contact from various sources.
3857
+ */
3858
+ interface ContactEnrichmentData {
3859
+ linkedin?: {
3860
+ summary?: string;
3861
+ pastExperience?: string;
3862
+ education?: string;
3863
+ activity?: Array<{
3864
+ date?: string;
3865
+ content?: string;
3866
+ }>;
3867
+ };
3815
3868
  }
3816
- interface TaskSchedule extends ScheduleOriginTracking {
3869
+ /**
3870
+ * Acquisition list for organizing contacts and companies.
3871
+ * Transformed from AcqListRow with camelCase properties.
3872
+ */
3873
+ interface AcqList {
3817
3874
  id: string;
3818
3875
  organizationId: string;
3819
3876
  name: string;
3820
- description?: string;
3821
- target: ScheduleTarget;
3822
- scheduleConfig: TaskScheduleConfig;
3823
- nextRunAt?: Date;
3824
- currentStep: number;
3825
- status: 'active' | 'paused' | 'completed' | 'cancelled';
3826
- lastRunAt?: Date;
3827
- lastExecutionId?: string;
3828
- maxRetries: number;
3829
- idempotencyKey?: string;
3877
+ description: string | null;
3878
+ type: string;
3879
+ batchIds: string[];
3880
+ instantlyCampaignId: string | null;
3881
+ status: string;
3882
+ metadata: Record<string, unknown>;
3883
+ launchedAt: Date | null;
3884
+ completedAt: Date | null;
3830
3885
  createdAt: Date;
3831
- updatedAt: Date;
3886
+ config: ListConfig;
3832
3887
  }
3833
- interface CreateScheduleInput extends ScheduleOriginTracking {
3888
+ /**
3889
+ * Company record in the acquisition database.
3890
+ * Contains enriched company data from various sources.
3891
+ * Transformed from AcqCompanyRow with camelCase properties.
3892
+ */
3893
+ interface AcqCompany {
3894
+ id: string;
3834
3895
  organizationId: string;
3835
3896
  name: string;
3836
- description?: string;
3837
- target: ScheduleTarget;
3838
- scheduleConfig: TaskScheduleConfig;
3839
- maxRetries?: number;
3840
- idempotencyKey?: string;
3841
- metadata?: Record<string, unknown>;
3897
+ domain: string | null;
3898
+ linkedinUrl: string | null;
3899
+ website: string | null;
3900
+ numEmployees: number | null;
3901
+ foundedYear: number | null;
3902
+ locationCity: string | null;
3903
+ locationState: string | null;
3904
+ category: string | null;
3905
+ categoryPain: string | null;
3906
+ segment: string | null;
3907
+ pipelineStatus: CompanyPipelineStatus | null;
3908
+ enrichmentData: CompanyEnrichmentData | null;
3909
+ source: string | null;
3910
+ batchId: string | null;
3911
+ status: 'active' | 'invalid';
3912
+ verticalResearch: string | null;
3913
+ createdAt: Date;
3914
+ updatedAt: Date;
3842
3915
  }
3843
-
3844
- type NotificationRow = Database['public']['Tables']['notifications']['Row'];
3845
- interface CreateNotificationParams {
3846
- userId: string;
3916
+ /**
3917
+ * Contact record in the acquisition database.
3918
+ * Contains enriched contact data and personalization content.
3919
+ * Transformed from AcqContactRow with camelCase properties.
3920
+ */
3921
+ interface AcqContact {
3922
+ id: string;
3847
3923
  organizationId: string;
3848
- category: NotificationRow['category'];
3849
- title: string;
3850
- message: string;
3851
- actionUrl?: string;
3924
+ companyId: string | null;
3925
+ email: string;
3926
+ emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null;
3927
+ firstName: string | null;
3928
+ lastName: string | null;
3929
+ linkedinUrl: string | null;
3930
+ title: string | null;
3931
+ headline: string | null;
3932
+ filterReason: string | null;
3933
+ openingLine: string | null;
3934
+ source: string | null;
3935
+ sourceId: string | null;
3936
+ pipelineStatus: ContactPipelineStatus | null;
3937
+ enrichmentData: ContactEnrichmentData | null;
3938
+ /** Attio Person record ID - set when contact responds and is added to CRM */
3939
+ attioPersonId: string | null;
3940
+ batchId: string | null;
3941
+ status: 'active' | 'invalid';
3942
+ createdAt: Date;
3943
+ updatedAt: Date;
3852
3944
  }
3853
-
3945
+ interface DealContact {
3946
+ id: string;
3947
+ first_name: string | null;
3948
+ last_name: string | null;
3949
+ email: string;
3950
+ title: string | null;
3951
+ headline: string | null;
3952
+ linkedin_url: string | null;
3953
+ pipeline_status: Record<string, unknown> | null;
3954
+ enrichment_data: Record<string, unknown> | null;
3955
+ company: {
3956
+ id: string;
3957
+ name: string;
3958
+ domain: string | null;
3959
+ website: string | null;
3960
+ linkedin_url: string | null;
3961
+ segment: string | null;
3962
+ category: string | null;
3963
+ num_employees: number | null;
3964
+ } | null;
3965
+ }
3966
+ /** Deal list item with joined contact and company data */
3967
+ interface DealListItem extends AcqDealRow {
3968
+ contact: DealContact | null;
3969
+ }
3970
+ type DealDetail = DealListItem;
3971
+ /** Task kind options for a deal task (human follow-up action type) */
3972
+ type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other';
3854
3973
  /**
3855
- * ResourceRegistry - Resource discovery and lookup
3856
- * Handles resource definitions from OrganizationRegistry
3857
- *
3858
- * Features:
3859
- * - Resource discovery by organization
3860
- * - Startup validation (duplicate IDs, model configs, relationships, interface-schema alignment)
3861
- * - Pre-serialization cache for instant API responses
3862
- * - Command View data generation
3974
+ * A CRM to-do item attached to a deal representing a human follow-up action.
3975
+ * Transformed from AcqDealTaskRow with camelCase properties.
3863
3976
  */
3864
-
3977
+ interface AcqDealTask {
3978
+ id: string;
3979
+ organizationId: string;
3980
+ dealId: string;
3981
+ title: string;
3982
+ description: string | null;
3983
+ kind: AcqDealTaskKind;
3984
+ dueAt: string | null;
3985
+ assigneeUserId: string | null;
3986
+ completedAt: string | null;
3987
+ completedByUserId: string | null;
3988
+ createdAt: string;
3989
+ updatedAt: string;
3990
+ createdByUserId: string | null;
3991
+ }
3865
3992
  /**
3866
- * Configuration for a remotely-deployed organization
3867
- *
3868
- * Stored alongside runtime-registered organizations to support
3869
- * worker thread execution branching and credential management.
3993
+ * One ordered step in a list's pipeline. Maps to a deployed workflow
3994
+ * (e.g. 'lgn-03-company-qualification-workflow'). The `inputTemplate`
3995
+ * is merged with `{ listId }` at run time to form the workflow input.
3870
3996
  */
3871
- interface RemoteOrgConfig {
3872
- /** Supabase Storage path: "{orgId}/{deploymentId}/bundle.js" */
3873
- storagePath: string;
3874
- /** Deployment record ID */
3875
- deploymentId: string;
3876
- /** OS temp path to bundle -- set after first download, used by worker threads */
3877
- cachedTempPath?: string;
3878
- /** Platform tool name -> credential name mapping */
3879
- toolCredentials?: Record<string, string>;
3880
- /** SDK version used to deploy this bundle */
3881
- sdkVersion?: string;
3882
- /** Deployment version (semver) of the deployed bundle */
3883
- deploymentVersion?: string;
3997
+ interface PipelineStep {
3998
+ /** Stable key, e.g. 'scrape' | 'extract' | 'qualify' | 'discover' | 'verify' | 'personalize'. */
3999
+ key: string;
4000
+ /** Human label rendered in the UI stepper. */
4001
+ label: string;
4002
+ /** Deployed workflow resourceId (e.g. 'lgn-03-company-qualification-workflow'). */
4003
+ resourceId: string;
4004
+ /** Input defaults merged with `{ listId }` at dispatch. */
4005
+ inputTemplate: Record<string, unknown>;
4006
+ /** Whether the UI shows the Run button. */
4007
+ enabled: boolean;
4008
+ /** Display order (ascending). */
4009
+ order: number;
3884
4010
  }
4011
+ type CompanyListStage = 'populated' | 'extracted' | 'qualified';
4012
+ type ContactListStage = 'discovered' | 'verified' | 'personalized' | 'uploaded';
3885
4013
  /**
3886
- * Organization-specific resource collection
4014
+ * Per-list pipeline configuration stored as jsonb in `acq_lists.config`.
3887
4015
  *
3888
- * Complete manifest of all automation resources for an organization.
3889
- * Used by ResourceRegistry for discovery and Command View for visualization.
4016
+ * `qualification` is the only required subtree. Every other subtree is optional
4017
+ * and inherits global defaults when omitted: workflows resolve values as
4018
+ * `list.config.foo ?? globalDefaults.foo`. Seeded rows from
4019
+ * `20260413000100_backfill_list_configs.sql` only populate `qualification`
4020
+ * and `scraping`; the rest was intentionally omitted.
3890
4021
  */
3891
- interface DeploymentSpec {
3892
- /** Deployment version (semver) */
3893
- version: string;
3894
- /** Workflow definitions */
3895
- workflows?: WorkflowDefinition[];
3896
- /** Agent definitions */
3897
- agents?: AgentDefinition[];
3898
- /** Trigger definitions - entry points that initiate executions */
3899
- triggers?: TriggerDefinition[];
3900
- /** Integration definitions - external service connections */
3901
- integrations?: IntegrationDefinition[];
3902
- /** Explicit relationship declarations between resources */
3903
- relationships?: ResourceRelationships;
3904
- /** External automation resources (n8n, Make, Zapier, etc.) */
3905
- externalResources?: ExternalResourceDefinition[];
3906
- /** Human checkpoint definitions - human decision points in automation */
3907
- humanCheckpoints?: HumanCheckpointDefinition[];
4022
+ interface ListConfig {
4023
+ qualification: {
4024
+ /** One-line description of the target vertical/segment. */
4025
+ targetDescription: string;
4026
+ /** Minimum Google review count to qualify. */
4027
+ minReviewCount: number;
4028
+ /** Minimum Google star rating to qualify (e.g. 3.0). */
4029
+ minRating: number;
4030
+ /** Whether to exclude franchises/chains during qualification. */
4031
+ excludeFranchises: boolean;
4032
+ /** Free-form LLM rules layered on top of the structured criteria. */
4033
+ customRules: string;
4034
+ };
4035
+ enrichment?: {
4036
+ emailDiscovery?: {
4037
+ primary: 'tomba' | 'anymailfinder';
4038
+ credentialName?: string;
4039
+ };
4040
+ emailVerification?: {
4041
+ provider: 'millionverifier';
4042
+ threshold?: 'ok' | 'ok+catch_all';
4043
+ };
4044
+ };
4045
+ personalization?: {
4046
+ industryContext?: string;
4047
+ /** Email body template with tags like {{opening_line}} / {{category_pain}}. */
4048
+ emailBody?: string;
4049
+ creativeDirection?: string;
4050
+ /** Contradiction-prevention rules layered into the personalization prompt. */
4051
+ exclusionRules?: string[];
4052
+ };
4053
+ pipeline?: {
4054
+ steps: PipelineStep[];
4055
+ };
3908
4056
  }
4057
+
3909
4058
  /**
3910
- * Organization Registry type
4059
+ * Lead Service Types
4060
+ * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
4061
+ *
4062
+ * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
3911
4063
  */
3912
- type OrganizationRegistry = Record<string, DeploymentSpec>;
3913
- declare class ResourceRegistry {
3914
- private registry;
3915
- /**
3916
- * Pre-serialized organization data cache
3917
- * Computed once at construction for static orgs, updated incrementally for runtime orgs
3918
- */
3919
- private serializedCache;
3920
- /**
3921
- * Per-resource remote configuration (external deployments)
3922
- * Key: "orgName/resourceId", Value: RemoteOrgConfig for that resource.
3923
- * Tracks which individual resources were added at runtime via deploy pipeline.
3924
- * Static and remote resources coexist in the same org.
3925
- */
3926
- private remoteResources;
3927
- constructor(registry: OrganizationRegistry);
3928
- /**
3929
- * Validates registry on construction
3930
- * - Checks for duplicate resourceIds within organizations
3931
- * - Validates model configurations against constraints
3932
- * - Validates ExecutionInterface matches inputSchema
3933
- * @throws Error if validation fails
3934
- */
3935
- private validateRegistry;
3936
- /**
3937
- * Validates relationship declarations reference valid resources
3938
- * Runs at API server startup - fails fast in development
3939
- * @throws Error if validation fails
3940
- */
3941
- private validateRelationships;
3942
- /**
3943
- * Get a resource definition by ID
3944
- * Returns full definition (WorkflowDefinition or AgentDefinition)
3945
- * Check definition.config.type to determine if it's a workflow or agent
3946
- */
3947
- getResourceDefinition(organizationName: string, resourceId: string): WorkflowDefinition | AgentDefinition | null;
3948
- /**
3949
- * List all resources for an organization
3950
- * Returns ResourceDefinition metadata (not full definitions)
3951
- *
3952
- * All resources are returned regardless of server environment.
3953
- * Pass an explicit `environment` filter to get only 'dev' or 'prod' resources.
3954
- */
3955
- listResourcesForOrganization(organizationName: string, environment?: ResourceStatus$1): ResourceList;
3956
- /**
3957
- * List all resources from all organizations
3958
- * NOTE: For debugging only - returns raw registry data
3959
- */
3960
- listAllResources(): OrganizationRegistry;
3961
- /**
3962
- * Register external resources at runtime
3963
- *
3964
- * Called during deploy pipeline when an external developer deploys their bundle.
3965
- * Merges the incoming stub definitions into the org's registry and stores
3966
- * per-resource remote config for worker thread execution branching.
3967
- *
3968
- * Static and remote resources coexist in the same org. If the org already
3969
- * has static resources, the incoming remote resources are merged alongside them.
3970
- * If redeploying (some resources already registered as remote for this org),
3971
- * the previous remote resources are unregistered first.
3972
- *
3973
- * @param orgName - Organization name (used as registry key)
3974
- * @param org - Stub resource definitions (workflows/agents with placeholder handlers)
3975
- * @param remote - Remote configuration (bundle path, deployment ID, env vars)
3976
- * @throws Error if incoming resourceId conflicts with a static resource
3977
- * @throws Error if incoming deployment contains duplicate resourceIds
3978
- */
3979
- registerOrganization(orgName: string, org: DeploymentSpec, remote: RemoteOrgConfig): void;
3980
- /**
3981
- * Patch serialized cache with pre-serialized schemas from an external manifest.
3982
- *
3983
- * External deployments use stub definitions with z.any() schemas (never called).
3984
- * The manifest carries the real schemas as pre-serialized JSON Schema from the worker.
3985
- * This method patches those into the serialized cache so describe/CLI display them.
3986
- *
3987
- * @param orgName - Organization name
3988
- * @param manifestSchemas - Map of resourceId -> { contract, steps } with JSON Schema
3989
- */
3990
- patchManifestSchemas(orgName: string, manifestSchemas: Array<{
3991
- resourceId: string;
3992
- type: 'workflow' | 'agent';
3993
- contract?: {
3994
- inputSchema?: object;
3995
- outputSchema?: object;
3996
- };
3997
- steps?: Array<{
3998
- id: string;
3999
- inputSchema?: object;
4000
- outputSchema?: object;
4001
- }>;
4002
- }>): void;
4003
- /**
4004
- * Register built-in platform resources (static, local execution)
4005
- *
4006
- * Unlike registerOrganization(), these resources:
4007
- * - Do NOT have remote config (execute in-process, not in worker threads)
4008
- * - Are NOT removed by unregisterOrganization() (persist across redeployments)
4009
- * - Use reserved resource IDs that external deployments cannot claim
4010
- *
4011
- * @param orgName - Organization name
4012
- * @param org - Resource definitions with real handlers (not stubs)
4013
- */
4014
- registerStaticResources(orgName: string, org: DeploymentSpec): void;
4015
- /**
4016
- * Unregister runtime-registered resources for an organization
4017
- *
4018
- * Removes only resources that were registered at runtime (via registerOrganization).
4019
- * Static resources loaded at startup are preserved. If the org still has static
4020
- * resources after removal, the serialization cache is rebuilt. If no resources
4021
- * remain, the org is fully removed from the registry.
4022
- * No-op if the org has no remote resources.
4023
- *
4024
- * @param orgName - Organization name to unregister remote resources from
4025
- */
4026
- unregisterOrganization(orgName: string): void;
4027
- /**
4028
- * Get remote configuration for a specific resource
4029
- *
4030
- * Returns the RemoteOrgConfig if the resource was registered at runtime,
4031
- * or null if it's a static resource or doesn't exist.
4032
- * Used by the execution coordinator to branch between local and worker execution.
4033
- *
4034
- * @param orgName - Organization name
4035
- * @param resourceId - Resource ID
4036
- * @returns Remote config or null
4037
- */
4038
- getRemoteConfig(orgName: string, resourceId: string): RemoteOrgConfig | null;
4039
- /**
4040
- * Check if an organization has any remote (externally deployed) resources
4041
- *
4042
- * @param orgName - Organization name
4043
- * @returns true if the org has at least one runtime-registered resource
4044
- */
4045
- isRemote(orgName: string): boolean;
4046
- /**
4047
- * Get the remote config for any resource in an organization.
4048
- * Used when the specific resource ID is unknown (e.g., to clean up a
4049
- * temp file before unregistering an org -- all resources share one config).
4050
- *
4051
- * @param orgName - Organization name
4052
- * @returns Remote config or null if org has no remote resources
4053
- */
4054
- getAnyRemoteConfig(orgName: string): RemoteOrgConfig | null;
4055
- /**
4056
- * Get statistics about remotely-deployed resources
4057
- * Used by the health endpoint for platform-wide deployment visibility.
4058
- */
4059
- getRemoteStats(): {
4060
- activeOrgs: number;
4061
- totalResources: number;
4062
- };
4063
- /**
4064
- * Get triggers for an organization
4065
- * @param organizationName - Organization name
4066
- * @returns Array of trigger definitions (empty if none defined)
4067
- */
4068
- getTriggers(organizationName: string): TriggerDefinition[];
4069
- /**
4070
- * Get integrations for an organization
4071
- * @param organizationName - Organization name
4072
- * @returns Array of integration definitions (empty if none defined)
4073
- */
4074
- getIntegrations(organizationName: string): IntegrationDefinition[];
4075
- /**
4076
- * Get resource relationships for an organization
4077
- * @param organizationName - Organization name
4078
- * @returns Resource relationships map (undefined if none defined)
4079
- */
4080
- getRelationships(organizationName: string): ResourceRelationships | undefined;
4081
- /**
4082
- * Get a specific trigger by ID
4083
- * @param organizationName - Organization name
4084
- * @param triggerId - Trigger ID
4085
- * @returns Trigger definition or null if not found
4086
- */
4087
- getTrigger(organizationName: string, triggerId: string): TriggerDefinition | null;
4088
- /**
4089
- * Get a specific integration by ID
4090
- * @param organizationName - Organization name
4091
- * @param integrationId - Integration ID
4092
- * @returns Integration definition or null if not found
4093
- */
4094
- getIntegration(organizationName: string, integrationId: string): IntegrationDefinition | null;
4095
- /**
4096
- * Get external resources for an organization
4097
- * @param organizationName - Organization name
4098
- * @returns Array of external resource definitions (empty if none defined)
4099
- */
4100
- getExternalResources(organizationName: string): ExternalResourceDefinition[];
4101
- /**
4102
- * Get a specific external resource by ID
4103
- * @param organizationName - Organization name
4104
- * @param externalId - External resource ID
4105
- * @returns External resource definition or null if not found
4106
- */
4107
- getExternalResource(organizationName: string, externalId: string): ExternalResourceDefinition | null;
4108
- /**
4109
- * Get human checkpoints for an organization
4110
- * @param organizationName - Organization name
4111
- * @returns Array of human checkpoint definitions (empty if none defined)
4112
- */
4113
- getHumanCheckpoints(organizationName: string): HumanCheckpointDefinition[];
4114
- /**
4115
- * Get a specific human checkpoint by ID
4116
- * @param organizationName - Organization name
4117
- * @param humanCheckpointId - Human checkpoint ID
4118
- * @returns Human checkpoint definition or null if not found
4119
- */
4120
- getHumanCheckpoint(organizationName: string, humanCheckpointId: string): HumanCheckpointDefinition | null;
4121
- /**
4122
- * Get serialized resource definition (instant lookup)
4123
- * Use for API responses - returns pre-computed JSON-safe structure
4124
- *
4125
- * @param organizationName - Organization name
4126
- * @param resourceId - Resource ID
4127
- * @returns Serialized definition or null if not found
4128
- */
4129
- getSerializedDefinition(organizationName: string, resourceId: string): SerializedAgentDefinition | SerializedWorkflowDefinition | null;
4130
- /**
4131
- * Get resource list for organization (instant lookup)
4132
- * Use for /resources endpoint - returns pre-computed ResourceDefinition array
4133
- *
4134
- * @param organizationName - Organization name
4135
- * @returns Resource list with workflows, agents, and total count
4136
- */
4137
- getResourceList(organizationName: string): {
4138
- workflows: ResourceDefinition[];
4139
- agents: ResourceDefinition[];
4140
- total: number;
4141
- };
4142
- /**
4143
- * Get Command View data for organization (instant lookup)
4144
- * Use for /command-view endpoint - returns complete graph data
4145
- *
4146
- * @param organizationName - Organization name
4147
- * @returns Command View data with nodes and edges
4148
- */
4149
- getCommandViewData(organizationName: string): CommandViewData;
4150
- /**
4151
- * List resources that have UI interfaces configured
4152
- * Used by Execution Runner Catalog UI
4153
- *
4154
- * @param organizationName - Organization name
4155
- * @param environment - Optional environment filter ('dev' or 'prod')
4156
- * @returns Array of resources with interfaces
4157
- */
4158
- listExecutable(organizationName: string, environment?: 'dev' | 'prod'): Array<{
4159
- resourceId: string;
4160
- resourceName: string;
4161
- resourceType: 'workflow' | 'agent';
4162
- description?: string;
4163
- status: 'dev' | 'prod';
4164
- version: string;
4165
- interface: SerializedExecutionInterface;
4166
- }>;
4167
- }
4168
4064
 
4169
- /**
4170
- * Tracks pipeline status for a company across all processing stages.
4171
- */
4172
- interface CompanyPipelineStatus {
4173
- acquired: boolean;
4174
- enrichment: {
4175
- [source: string]: {
4176
- status: 'pending' | 'complete' | 'failed' | 'skipped';
4177
- completedAt?: string;
4178
- error?: string;
4179
- };
4180
- };
4181
- }
4182
- /**
4183
- * Tracks pipeline status for a contact across all processing stages.
4184
- */
4185
- interface ContactPipelineStatus {
4186
- enrichment: {
4187
- [source: string]: {
4188
- status: 'pending' | 'complete' | 'failed' | 'skipped';
4189
- completedAt?: string;
4190
- error?: string;
4191
- };
4192
- };
4193
- personalization: {
4194
- status: 'pending' | 'complete' | 'failed' | 'skipped';
4195
- completedAt?: string;
4196
- };
4197
- outreach: {
4198
- status: 'pending' | 'sent' | 'replied' | 'bounced' | 'opted-out';
4199
- sentAt?: string;
4200
- channel?: string;
4201
- campaignId?: string;
4202
- };
4203
- }
4204
- /**
4205
- * Enrichment data collected for a company from various sources.
4206
- */
4207
- interface CompanyEnrichmentData {
4208
- googleMaps?: {
4209
- placeId?: string;
4210
- totalScore?: number;
4211
- reviewsCount?: number;
4212
- address?: string;
4213
- phone?: string;
4214
- categoryName?: string;
4215
- googleMapsUrl?: string;
4216
- scrapedAt?: string;
4217
- };
4218
- websiteCrawl?: {
4219
- companyDescription?: string;
4220
- services?: string[];
4221
- specialties?: string[];
4222
- staff?: Array<{
4223
- name: string;
4224
- title?: string;
4225
- email?: string;
4226
- }>;
4227
- automationGaps?: string[];
4228
- targetAudience?: string;
4229
- category?: string;
4230
- segment?: string;
4231
- recentWin?: string;
4232
- emailCount?: number;
4233
- pageCount?: number;
4234
- totalChars?: number;
4235
- crawledAt?: string;
4236
- extractedAt?: string;
4237
- };
4238
- website?: {
4239
- missionVision?: string;
4240
- uniqueAttributes?: string;
4241
- coreOfferings?: string;
4242
- targetAudience?: string;
4243
- companyValues?: string;
4244
- businessDescription?: string;
4245
- recentPosts?: Array<{
4246
- date?: string;
4247
- title?: string;
4248
- summary?: string;
4249
- aiInsight?: string;
4250
- }>;
4251
- };
4252
- tomba?: {
4253
- waterfallEmail?: {
4254
- email: string;
4255
- name?: string;
4256
- title?: string;
4257
- department?: string;
4258
- } | null;
4259
- genericEmail?: string | null;
4260
- totalFound?: number;
4261
- searchedAt?: string;
4262
- };
4263
- }
4264
- /**
4265
- * Enrichment data collected for a contact from various sources.
4266
- */
4267
- interface ContactEnrichmentData {
4268
- linkedin?: {
4269
- summary?: string;
4270
- pastExperience?: string;
4271
- education?: string;
4272
- activity?: Array<{
4273
- date?: string;
4274
- content?: string;
4275
- }>;
4276
- };
4065
+ interface PaginatedResult<T> {
4066
+ data: T[];
4067
+ total: number;
4068
+ limit: number;
4069
+ offset: number;
4277
4070
  }
4278
- /**
4279
- * Acquisition list for organizing contacts and companies.
4280
- * Transformed from AcqListRow with camelCase properties.
4281
- */
4282
- interface AcqList {
4283
- id: string;
4284
- organizationId: string;
4285
- name: string;
4286
- description: string | null;
4287
- type: string;
4288
- batchIds: string[];
4289
- instantlyCampaignId: string | null;
4290
- status: string;
4291
- metadata: Record<string, unknown>;
4292
- launchedAt: Date | null;
4293
- completedAt: Date | null;
4294
- createdAt: Date;
4295
- config: ListConfig;
4296
- }
4297
- /**
4298
- * Company record in the acquisition database.
4299
- * Contains enriched company data from various sources.
4300
- * Transformed from AcqCompanyRow with camelCase properties.
4301
- */
4302
- interface AcqCompany {
4303
- id: string;
4304
- organizationId: string;
4305
- name: string;
4306
- domain: string | null;
4307
- linkedinUrl: string | null;
4308
- website: string | null;
4309
- numEmployees: number | null;
4310
- foundedYear: number | null;
4311
- locationCity: string | null;
4312
- locationState: string | null;
4313
- category: string | null;
4314
- categoryPain: string | null;
4315
- segment: string | null;
4316
- pipelineStatus: CompanyPipelineStatus | null;
4317
- enrichmentData: CompanyEnrichmentData | null;
4318
- source: string | null;
4319
- batchId: string | null;
4320
- status: 'active' | 'invalid';
4321
- verticalResearch: string | null;
4322
- createdAt: Date;
4323
- updatedAt: Date;
4324
- }
4325
- /**
4326
- * Contact record in the acquisition database.
4327
- * Contains enriched contact data and personalization content.
4328
- * Transformed from AcqContactRow with camelCase properties.
4329
- */
4330
- interface AcqContact {
4331
- id: string;
4332
- organizationId: string;
4333
- companyId: string | null;
4334
- email: string;
4335
- emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null;
4336
- firstName: string | null;
4337
- lastName: string | null;
4338
- linkedinUrl: string | null;
4339
- title: string | null;
4340
- headline: string | null;
4341
- filterReason: string | null;
4342
- openingLine: string | null;
4343
- source: string | null;
4344
- sourceId: string | null;
4345
- pipelineStatus: ContactPipelineStatus | null;
4346
- enrichmentData: ContactEnrichmentData | null;
4347
- /** Attio Person record ID - set when contact responds and is added to CRM */
4348
- attioPersonId: string | null;
4349
- batchId: string | null;
4350
- status: 'active' | 'invalid';
4351
- createdAt: Date;
4352
- updatedAt: Date;
4353
- }
4354
- /** Task kind options for a deal task (human follow-up action type) */
4355
- type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other';
4356
- /**
4357
- * A CRM to-do item attached to a deal representing a human follow-up action.
4358
- * Transformed from AcqDealTaskRow with camelCase properties.
4359
- */
4360
- interface AcqDealTask {
4361
- id: string;
4362
- organizationId: string;
4363
- dealId: string;
4364
- title: string;
4365
- description: string | null;
4366
- kind: AcqDealTaskKind;
4367
- dueAt: string | null;
4368
- assigneeUserId: string | null;
4369
- completedAt: string | null;
4370
- completedByUserId: string | null;
4371
- createdAt: string;
4372
- updatedAt: string;
4373
- createdByUserId: string | null;
4374
- }
4375
- /**
4376
- * One ordered step in a list's pipeline. Maps to a deployed workflow
4377
- * (e.g. 'lgn-03-company-qualification-workflow'). The `inputTemplate`
4378
- * is merged with `{ listId }` at run time to form the workflow input.
4379
- */
4380
- interface PipelineStep {
4381
- /** Stable key, e.g. 'scrape' | 'extract' | 'qualify' | 'discover' | 'verify' | 'personalize'. */
4382
- key: string;
4383
- /** Human label rendered in the UI stepper. */
4384
- label: string;
4385
- /** Deployed workflow resourceId (e.g. 'lgn-03-company-qualification-workflow'). */
4386
- resourceId: string;
4387
- /** Input defaults merged with `{ listId }` at dispatch. */
4388
- inputTemplate: Record<string, unknown>;
4389
- /** Whether the UI shows the Run button. */
4390
- enabled: boolean;
4391
- /** Display order (ascending). */
4392
- order: number;
4393
- }
4394
- type CompanyListStage = 'populated' | 'extracted' | 'qualified';
4395
- type ContactListStage = 'discovered' | 'verified' | 'personalized' | 'uploaded';
4396
- /**
4397
- * Per-list pipeline configuration stored as jsonb in `acq_lists.config`.
4398
- *
4399
- * `qualification` is the only required subtree. Every other subtree is optional
4400
- * and inherits global defaults when omitted: workflows resolve values as
4401
- * `list.config.foo ?? globalDefaults.foo`. Seeded rows from
4402
- * `20260413000100_backfill_list_configs.sql` only populate `qualification`
4403
- * and `scraping`; the rest was intentionally omitted.
4404
- */
4405
- interface ListConfig {
4406
- qualification: {
4407
- /** One-line description of the target vertical/segment. */
4408
- targetDescription: string;
4409
- /** Minimum Google review count to qualify. */
4410
- minReviewCount: number;
4411
- /** Minimum Google star rating to qualify (e.g. 3.0). */
4412
- minRating: number;
4413
- /** Whether to exclude franchises/chains during qualification. */
4414
- excludeFranchises: boolean;
4415
- /** Free-form LLM rules layered on top of the structured criteria. */
4416
- customRules: string;
4417
- };
4418
- enrichment?: {
4419
- emailDiscovery?: {
4420
- primary: 'tomba' | 'anymailfinder';
4421
- credentialName?: string;
4422
- };
4423
- emailVerification?: {
4424
- provider: 'millionverifier';
4425
- threshold?: 'ok' | 'ok+catch_all';
4426
- };
4427
- };
4428
- personalization?: {
4429
- industryContext?: string;
4430
- /** Email body template with tags like {{opening_line}} / {{category_pain}}. */
4431
- emailBody?: string;
4432
- creativeDirection?: string;
4433
- /** Contradiction-prevention rules layered into the personalization prompt. */
4434
- exclusionRules?: string[];
4435
- };
4436
- pipeline?: {
4437
- steps: PipelineStep[];
4438
- };
4439
- }
4440
-
4441
- /**
4442
- * Lead Service Types
4443
- * CRUD operation types for the acquisition platform (lists, companies, contacts, deals)
4444
- *
4445
- * Implementation: apps/api/src/acquisition/lead-service.ts (LeadService class)
4446
- */
4447
-
4448
- interface PaginatedResult<T> {
4449
- data: T[];
4450
- total: number;
4451
- limit: number;
4452
- offset: number;
4453
- }
4454
- interface CreateListParams {
4071
+ interface CreateListParams {
4455
4072
  organizationId: string;
4456
4073
  name: string;
4457
4074
  description?: string;
@@ -4834,95 +4451,471 @@ interface BulkImportCompaniesResult {
4834
4451
  }
4835
4452
 
4836
4453
  /**
4837
- * Platform Storage Tool Types
4838
- * Zod schemas and TypeScript types for storage platform tools
4454
+ * Origin resource type - where an execution/task originated from.
4455
+ * Used for audit trails and tracking execution lineage.
4839
4456
  */
4457
+ type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api';
4840
4458
 
4841
4459
  /**
4842
- * Schema for storage upload tool input
4843
- */
4844
- declare const StorageUploadInputSchema: z.ZodObject<{
4845
- bucket: z.ZodString;
4846
- path: z.ZodString;
4847
- content: z.ZodString;
4848
- contentType: z.ZodString;
4849
- upsert: z.ZodOptional<z.ZodBoolean>;
4850
- }, z.core.$strip>;
4851
- /**
4852
- * Schema for storage signed URL tool input
4853
- */
4854
- declare const StorageSignedUrlInputSchema: z.ZodObject<{
4855
- bucket: z.ZodString;
4856
- path: z.ZodString;
4857
- expiresIn: z.ZodDefault<z.ZodNumber>;
4858
- }, z.core.$strip>;
4859
- /**
4860
- * Schema for storage download tool input
4861
- */
4862
- declare const StorageDownloadInputSchema: z.ZodObject<{
4863
- bucket: z.ZodString;
4864
- path: z.ZodString;
4865
- }, z.core.$strip>;
4866
- /**
4867
- * Schema for storage delete tool input
4868
- */
4869
- declare const StorageDeleteInputSchema: z.ZodObject<{
4870
- bucket: z.ZodString;
4871
- path: z.ZodString;
4872
- }, z.core.$strip>;
4873
- /**
4874
- * Schema for storage list tool input
4875
- */
4876
- declare const StorageListInputSchema: z.ZodObject<{
4877
- bucket: z.ZodString;
4878
- prefix: z.ZodOptional<z.ZodString>;
4879
- }, z.core.$strip>;
4880
- /**
4881
- * Schema for storage upload tool output
4882
- */
4883
- declare const StorageUploadOutputSchema: z.ZodObject<{
4884
- success: z.ZodBoolean;
4885
- path: z.ZodString;
4886
- fullPath: z.ZodString;
4887
- }, z.core.$strip>;
4888
- /**
4889
- * Schema for storage signed URL tool output
4890
- */
4891
- declare const StorageSignedUrlOutputSchema: z.ZodObject<{
4892
- success: z.ZodBoolean;
4893
- signedUrl: z.ZodString;
4894
- expiresAt: z.ZodString;
4895
- }, z.core.$strip>;
4896
- /**
4897
- * Schema for storage download tool output
4898
- */
4899
- declare const StorageDownloadOutputSchema: z.ZodObject<{
4900
- success: z.ZodBoolean;
4901
- content: z.ZodString;
4902
- contentType: z.ZodOptional<z.ZodString>;
4903
- }, z.core.$strip>;
4904
- /**
4905
- * Schema for storage delete tool output
4460
+ * Target for schedule execution - identifies what resource to execute.
4461
+ * Unlike ExecutionTarget, payload is NOT included here because schedules
4462
+ * store payload in the scheduleConfig (varies per step/item).
4906
4463
  */
4907
- declare const StorageDeleteOutputSchema: z.ZodObject<{
4908
- success: z.ZodBoolean;
4909
- }, z.core.$strip>;
4464
+ interface ScheduleTarget {
4465
+ resourceType: 'agent' | 'workflow';
4466
+ resourceId: string;
4467
+ }
4910
4468
  /**
4911
- * Schema for storage list tool output
4469
+ * Optional origin tracking for schedules.
4470
+ * Unlike OriginTracking (which is required), these fields are all optional
4471
+ * for schedules created directly via API (not triggered by another resource).
4912
4472
  */
4913
- declare const StorageListOutputSchema: z.ZodObject<{
4914
- success: z.ZodBoolean;
4915
- files: z.ZodArray<z.ZodString>;
4916
- }, z.core.$strip>;
4917
- type StorageUploadInput = z.infer<typeof StorageUploadInputSchema>;
4918
- type StorageSignedUrlInput = z.infer<typeof StorageSignedUrlInputSchema>;
4919
- type StorageDownloadInput = z.infer<typeof StorageDownloadInputSchema>;
4920
- type StorageDeleteInput = z.infer<typeof StorageDeleteInputSchema>;
4921
- type StorageListInput = z.infer<typeof StorageListInputSchema>;
4922
- type StorageUploadOutput = z.infer<typeof StorageUploadOutputSchema>;
4923
- type StorageSignedUrlOutput = z.infer<typeof StorageSignedUrlOutputSchema>;
4924
- type StorageDownloadOutput = z.infer<typeof StorageDownloadOutputSchema>;
4925
- type StorageDeleteOutput = z.infer<typeof StorageDeleteOutputSchema>;
4473
+ interface ScheduleOriginTracking {
4474
+ originExecutionId?: string;
4475
+ originResourceType?: OriginResourceType;
4476
+ originResourceId?: string;
4477
+ }
4478
+ type TaskScheduleConfig = RecurringScheduleConfig | RelativeScheduleConfig | AbsoluteScheduleConfig;
4479
+ interface RecurringScheduleConfig {
4480
+ type: 'recurring';
4481
+ cron?: string;
4482
+ interval?: 'daily' | 'weekly' | 'monthly';
4483
+ time?: string;
4484
+ timezone: string;
4485
+ payload: Record<string, unknown>;
4486
+ endAt?: string | null;
4487
+ overduePolicy?: 'skip' | 'execute';
4488
+ }
4489
+ interface RelativeScheduleConfig {
4490
+ type: 'relative';
4491
+ anchorAt: string;
4492
+ anchorLabel?: string;
4493
+ items: RelativeScheduleItem[];
4494
+ overduePolicy?: 'skip' | 'execute';
4495
+ }
4496
+ interface RelativeScheduleItem {
4497
+ offset: string;
4498
+ payload: Record<string, unknown>;
4499
+ label?: string;
4500
+ }
4501
+ interface AbsoluteScheduleConfig {
4502
+ type: 'absolute';
4503
+ items: AbsoluteScheduleItem[];
4504
+ overduePolicy?: 'skip' | 'execute';
4505
+ }
4506
+ interface AbsoluteScheduleItem {
4507
+ runAt: string;
4508
+ payload: Record<string, unknown>;
4509
+ label?: string;
4510
+ }
4511
+ interface TaskSchedule extends ScheduleOriginTracking {
4512
+ id: string;
4513
+ organizationId: string;
4514
+ name: string;
4515
+ description?: string;
4516
+ target: ScheduleTarget;
4517
+ scheduleConfig: TaskScheduleConfig;
4518
+ nextRunAt?: Date;
4519
+ currentStep: number;
4520
+ status: 'active' | 'paused' | 'completed' | 'cancelled';
4521
+ lastRunAt?: Date;
4522
+ lastExecutionId?: string;
4523
+ maxRetries: number;
4524
+ idempotencyKey?: string;
4525
+ createdAt: Date;
4526
+ updatedAt: Date;
4527
+ }
4528
+ interface CreateScheduleInput extends ScheduleOriginTracking {
4529
+ organizationId: string;
4530
+ name: string;
4531
+ description?: string;
4532
+ target: ScheduleTarget;
4533
+ scheduleConfig: TaskScheduleConfig;
4534
+ maxRetries?: number;
4535
+ idempotencyKey?: string;
4536
+ metadata?: Record<string, unknown>;
4537
+ }
4538
+
4539
+ type NotificationRow = Database['public']['Tables']['notifications']['Row'];
4540
+ interface CreateNotificationParams {
4541
+ userId: string;
4542
+ organizationId: string;
4543
+ category: NotificationRow['category'];
4544
+ title: string;
4545
+ message: string;
4546
+ actionUrl?: string;
4547
+ }
4548
+
4549
+ type ProjectRow = Database['public']['Tables']['prj_projects']['Row'];
4550
+ type MilestoneRow = Database['public']['Tables']['prj_milestones']['Row'];
4551
+ type TaskRow = Database['public']['Tables']['prj_tasks']['Row'];
4552
+ type NoteRow = Database['public']['Tables']['prj_notes']['Row'];
4553
+ interface ProjectWithCounts extends ProjectRow {
4554
+ milestoneCount: number;
4555
+ taskCount: number;
4556
+ completedMilestones?: number;
4557
+ completedTasks?: number;
4558
+ }
4559
+ interface ProjectDetail extends ProjectRow {
4560
+ milestones: MilestoneRow[];
4561
+ tasks: TaskRow[];
4562
+ company: {
4563
+ id: string;
4564
+ name: string;
4565
+ domain: string | null;
4566
+ } | null;
4567
+ }
4568
+
4569
+ declare const DealSchemas: {
4570
+ DealIdParams: z.ZodObject<{
4571
+ dealId: z.ZodString;
4572
+ }, z.core.$strip>;
4573
+ DealTaskIdParams: z.ZodObject<{
4574
+ dealId: z.ZodString;
4575
+ taskId: z.ZodString;
4576
+ }, z.core.$strip>;
4577
+ ListDealsQuery: z.ZodObject<{
4578
+ stage: z.ZodOptional<z.ZodEnum<{
4579
+ interested: "interested";
4580
+ proposal: "proposal";
4581
+ closing: "closing";
4582
+ closed_won: "closed_won";
4583
+ closed_lost: "closed_lost";
4584
+ nurturing: "nurturing";
4585
+ }>>;
4586
+ search: z.ZodOptional<z.ZodString>;
4587
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4588
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4589
+ }, z.core.$strict>;
4590
+ ListDealTasksDueQuery: z.ZodObject<{
4591
+ window: z.ZodOptional<z.ZodEnum<{
4592
+ overdue: "overdue";
4593
+ today: "today";
4594
+ today_and_overdue: "today_and_overdue";
4595
+ upcoming: "upcoming";
4596
+ }>>;
4597
+ assigneeUserId: z.ZodOptional<z.ZodString>;
4598
+ }, z.core.$strict>;
4599
+ CreateDealNoteRequest: z.ZodObject<{
4600
+ body: z.ZodString;
4601
+ }, z.core.$strict>;
4602
+ CreateDealTaskRequest: z.ZodObject<{
4603
+ title: z.ZodString;
4604
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4605
+ kind: z.ZodOptional<z.ZodEnum<{
4606
+ other: "other";
4607
+ email: "email";
4608
+ call: "call";
4609
+ meeting: "meeting";
4610
+ }>>;
4611
+ dueAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4612
+ assigneeUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4613
+ }, z.core.$strict>;
4614
+ SyncDealStageRequest: z.ZodObject<{
4615
+ stage: z.ZodEnum<{
4616
+ interested: "interested";
4617
+ proposal: "proposal";
4618
+ closing: "closing";
4619
+ closed_won: "closed_won";
4620
+ closed_lost: "closed_lost";
4621
+ nurturing: "nurturing";
4622
+ }>;
4623
+ }, z.core.$strict>;
4624
+ DealListResponse: z.ZodArray<z.ZodObject<{
4625
+ id: z.ZodString;
4626
+ organization_id: z.ZodString;
4627
+ contact_id: z.ZodNullable<z.ZodString>;
4628
+ contact_email: z.ZodString;
4629
+ cached_stage: z.ZodNullable<z.ZodString>;
4630
+ activity_log: z.ZodUnknown;
4631
+ discovery_data: z.ZodNullable<z.ZodUnknown>;
4632
+ discovery_submitted_at: z.ZodNullable<z.ZodString>;
4633
+ discovery_submitted_by: z.ZodNullable<z.ZodString>;
4634
+ proposal_data: z.ZodNullable<z.ZodUnknown>;
4635
+ proposal_status: z.ZodNullable<z.ZodString>;
4636
+ proposal_sent_at: z.ZodNullable<z.ZodString>;
4637
+ proposal_pdf_url: z.ZodNullable<z.ZodString>;
4638
+ signature_envelope_id: z.ZodNullable<z.ZodString>;
4639
+ source_list_id: z.ZodNullable<z.ZodString>;
4640
+ source_type: z.ZodNullable<z.ZodString>;
4641
+ initial_fee: z.ZodNullable<z.ZodNumber>;
4642
+ monthly_fee: z.ZodNullable<z.ZodNumber>;
4643
+ closed_lost_at: z.ZodNullable<z.ZodString>;
4644
+ closed_lost_reason: z.ZodNullable<z.ZodString>;
4645
+ created_at: z.ZodString;
4646
+ updated_at: z.ZodString;
4647
+ contact: z.ZodNullable<z.ZodObject<{
4648
+ id: z.ZodString;
4649
+ first_name: z.ZodNullable<z.ZodString>;
4650
+ last_name: z.ZodNullable<z.ZodString>;
4651
+ email: z.ZodString;
4652
+ title: z.ZodNullable<z.ZodString>;
4653
+ headline: z.ZodNullable<z.ZodString>;
4654
+ linkedin_url: z.ZodNullable<z.ZodString>;
4655
+ pipeline_status: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4656
+ enrichment_data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4657
+ company: z.ZodNullable<z.ZodObject<{
4658
+ id: z.ZodString;
4659
+ name: z.ZodString;
4660
+ domain: z.ZodNullable<z.ZodString>;
4661
+ website: z.ZodNullable<z.ZodString>;
4662
+ linkedin_url: z.ZodNullable<z.ZodString>;
4663
+ segment: z.ZodNullable<z.ZodString>;
4664
+ category: z.ZodNullable<z.ZodString>;
4665
+ num_employees: z.ZodNullable<z.ZodNumber>;
4666
+ }, z.core.$strip>>;
4667
+ }, z.core.$strip>>;
4668
+ }, z.core.$strip>>;
4669
+ DealDetailResponse: z.ZodObject<{
4670
+ id: z.ZodString;
4671
+ organization_id: z.ZodString;
4672
+ contact_id: z.ZodNullable<z.ZodString>;
4673
+ contact_email: z.ZodString;
4674
+ cached_stage: z.ZodNullable<z.ZodString>;
4675
+ activity_log: z.ZodUnknown;
4676
+ discovery_data: z.ZodNullable<z.ZodUnknown>;
4677
+ discovery_submitted_at: z.ZodNullable<z.ZodString>;
4678
+ discovery_submitted_by: z.ZodNullable<z.ZodString>;
4679
+ proposal_data: z.ZodNullable<z.ZodUnknown>;
4680
+ proposal_status: z.ZodNullable<z.ZodString>;
4681
+ proposal_sent_at: z.ZodNullable<z.ZodString>;
4682
+ proposal_pdf_url: z.ZodNullable<z.ZodString>;
4683
+ signature_envelope_id: z.ZodNullable<z.ZodString>;
4684
+ source_list_id: z.ZodNullable<z.ZodString>;
4685
+ source_type: z.ZodNullable<z.ZodString>;
4686
+ initial_fee: z.ZodNullable<z.ZodNumber>;
4687
+ monthly_fee: z.ZodNullable<z.ZodNumber>;
4688
+ closed_lost_at: z.ZodNullable<z.ZodString>;
4689
+ closed_lost_reason: z.ZodNullable<z.ZodString>;
4690
+ created_at: z.ZodString;
4691
+ updated_at: z.ZodString;
4692
+ contact: z.ZodNullable<z.ZodObject<{
4693
+ id: z.ZodString;
4694
+ first_name: z.ZodNullable<z.ZodString>;
4695
+ last_name: z.ZodNullable<z.ZodString>;
4696
+ email: z.ZodString;
4697
+ title: z.ZodNullable<z.ZodString>;
4698
+ headline: z.ZodNullable<z.ZodString>;
4699
+ linkedin_url: z.ZodNullable<z.ZodString>;
4700
+ pipeline_status: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4701
+ enrichment_data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4702
+ company: z.ZodNullable<z.ZodObject<{
4703
+ id: z.ZodString;
4704
+ name: z.ZodString;
4705
+ domain: z.ZodNullable<z.ZodString>;
4706
+ website: z.ZodNullable<z.ZodString>;
4707
+ linkedin_url: z.ZodNullable<z.ZodString>;
4708
+ segment: z.ZodNullable<z.ZodString>;
4709
+ category: z.ZodNullable<z.ZodString>;
4710
+ num_employees: z.ZodNullable<z.ZodNumber>;
4711
+ }, z.core.$strip>>;
4712
+ }, z.core.$strip>>;
4713
+ }, z.core.$strip>;
4714
+ DealNoteResponse: z.ZodObject<{
4715
+ id: z.ZodString;
4716
+ dealId: z.ZodString;
4717
+ organizationId: z.ZodString;
4718
+ authorUserId: z.ZodNullable<z.ZodString>;
4719
+ body: z.ZodString;
4720
+ createdAt: z.ZodString;
4721
+ updatedAt: z.ZodString;
4722
+ }, z.core.$strip>;
4723
+ DealNoteListResponse: z.ZodArray<z.ZodObject<{
4724
+ id: z.ZodString;
4725
+ dealId: z.ZodString;
4726
+ organizationId: z.ZodString;
4727
+ authorUserId: z.ZodNullable<z.ZodString>;
4728
+ body: z.ZodString;
4729
+ createdAt: z.ZodString;
4730
+ updatedAt: z.ZodString;
4731
+ }, z.core.$strip>>;
4732
+ DealTaskResponse: z.ZodObject<{
4733
+ id: z.ZodString;
4734
+ organizationId: z.ZodString;
4735
+ dealId: z.ZodString;
4736
+ title: z.ZodString;
4737
+ description: z.ZodNullable<z.ZodString>;
4738
+ kind: z.ZodEnum<{
4739
+ other: "other";
4740
+ email: "email";
4741
+ call: "call";
4742
+ meeting: "meeting";
4743
+ }>;
4744
+ dueAt: z.ZodNullable<z.ZodString>;
4745
+ assigneeUserId: z.ZodNullable<z.ZodString>;
4746
+ completedAt: z.ZodNullable<z.ZodString>;
4747
+ completedByUserId: z.ZodNullable<z.ZodString>;
4748
+ createdAt: z.ZodString;
4749
+ updatedAt: z.ZodString;
4750
+ createdByUserId: z.ZodNullable<z.ZodString>;
4751
+ }, z.core.$strip>;
4752
+ DealTaskListResponse: z.ZodArray<z.ZodObject<{
4753
+ id: z.ZodString;
4754
+ organizationId: z.ZodString;
4755
+ dealId: z.ZodString;
4756
+ title: z.ZodString;
4757
+ description: z.ZodNullable<z.ZodString>;
4758
+ kind: z.ZodEnum<{
4759
+ other: "other";
4760
+ email: "email";
4761
+ call: "call";
4762
+ meeting: "meeting";
4763
+ }>;
4764
+ dueAt: z.ZodNullable<z.ZodString>;
4765
+ assigneeUserId: z.ZodNullable<z.ZodString>;
4766
+ completedAt: z.ZodNullable<z.ZodString>;
4767
+ completedByUserId: z.ZodNullable<z.ZodString>;
4768
+ createdAt: z.ZodString;
4769
+ updatedAt: z.ZodString;
4770
+ createdByUserId: z.ZodNullable<z.ZodString>;
4771
+ }, z.core.$strip>>;
4772
+ };
4773
+
4774
+ /**
4775
+ * A single CRM activity entry (note, stage change, or deal creation).
4776
+ * Matches the CrmActivityEntry interface from useRecentCrmActivity.ts.
4777
+ */
4778
+ declare const RecentActivityEntrySchema: z.ZodObject<{
4779
+ id: z.ZodString;
4780
+ kind: z.ZodEnum<{
4781
+ note: "note";
4782
+ stage_change: "stage_change";
4783
+ deal_created: "deal_created";
4784
+ }>;
4785
+ dealId: z.ZodString;
4786
+ occurredAt: z.ZodString;
4787
+ description: z.ZodString;
4788
+ contactName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4789
+ companyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4790
+ stage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4791
+ }, z.core.$strip>;
4792
+ declare const CrmSchemas: {
4793
+ GetRecentActivityQuery: z.ZodObject<{
4794
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4795
+ }, z.core.$strict>;
4796
+ RecentActivityEntry: z.ZodObject<{
4797
+ id: z.ZodString;
4798
+ kind: z.ZodEnum<{
4799
+ note: "note";
4800
+ stage_change: "stage_change";
4801
+ deal_created: "deal_created";
4802
+ }>;
4803
+ dealId: z.ZodString;
4804
+ occurredAt: z.ZodString;
4805
+ description: z.ZodString;
4806
+ contactName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4807
+ companyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4808
+ stage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4809
+ }, z.core.$strip>;
4810
+ GetRecentActivityResponse: z.ZodObject<{
4811
+ entries: z.ZodArray<z.ZodObject<{
4812
+ id: z.ZodString;
4813
+ kind: z.ZodEnum<{
4814
+ note: "note";
4815
+ stage_change: "stage_change";
4816
+ deal_created: "deal_created";
4817
+ }>;
4818
+ dealId: z.ZodString;
4819
+ occurredAt: z.ZodString;
4820
+ description: z.ZodString;
4821
+ contactName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4822
+ companyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4823
+ stage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4824
+ }, z.core.$strip>>;
4825
+ }, z.core.$strip>;
4826
+ };
4827
+ type RecentActivityEntry = z.infer<typeof RecentActivityEntrySchema>;
4828
+
4829
+ /**
4830
+ * Platform Storage Tool Types
4831
+ * Zod schemas and TypeScript types for storage platform tools
4832
+ */
4833
+
4834
+ /**
4835
+ * Schema for storage upload tool input
4836
+ */
4837
+ declare const StorageUploadInputSchema: z.ZodObject<{
4838
+ bucket: z.ZodString;
4839
+ path: z.ZodString;
4840
+ content: z.ZodString;
4841
+ contentType: z.ZodString;
4842
+ upsert: z.ZodOptional<z.ZodBoolean>;
4843
+ }, z.core.$strip>;
4844
+ /**
4845
+ * Schema for storage signed URL tool input
4846
+ */
4847
+ declare const StorageSignedUrlInputSchema: z.ZodObject<{
4848
+ bucket: z.ZodString;
4849
+ path: z.ZodString;
4850
+ expiresIn: z.ZodDefault<z.ZodNumber>;
4851
+ }, z.core.$strip>;
4852
+ /**
4853
+ * Schema for storage download tool input
4854
+ */
4855
+ declare const StorageDownloadInputSchema: z.ZodObject<{
4856
+ bucket: z.ZodString;
4857
+ path: z.ZodString;
4858
+ }, z.core.$strip>;
4859
+ /**
4860
+ * Schema for storage delete tool input
4861
+ */
4862
+ declare const StorageDeleteInputSchema: z.ZodObject<{
4863
+ bucket: z.ZodString;
4864
+ path: z.ZodString;
4865
+ }, z.core.$strip>;
4866
+ /**
4867
+ * Schema for storage list tool input
4868
+ */
4869
+ declare const StorageListInputSchema: z.ZodObject<{
4870
+ bucket: z.ZodString;
4871
+ prefix: z.ZodOptional<z.ZodString>;
4872
+ }, z.core.$strip>;
4873
+ /**
4874
+ * Schema for storage upload tool output
4875
+ */
4876
+ declare const StorageUploadOutputSchema: z.ZodObject<{
4877
+ success: z.ZodBoolean;
4878
+ path: z.ZodString;
4879
+ fullPath: z.ZodString;
4880
+ }, z.core.$strip>;
4881
+ /**
4882
+ * Schema for storage signed URL tool output
4883
+ */
4884
+ declare const StorageSignedUrlOutputSchema: z.ZodObject<{
4885
+ success: z.ZodBoolean;
4886
+ signedUrl: z.ZodString;
4887
+ expiresAt: z.ZodString;
4888
+ }, z.core.$strip>;
4889
+ /**
4890
+ * Schema for storage download tool output
4891
+ */
4892
+ declare const StorageDownloadOutputSchema: z.ZodObject<{
4893
+ success: z.ZodBoolean;
4894
+ content: z.ZodString;
4895
+ contentType: z.ZodOptional<z.ZodString>;
4896
+ }, z.core.$strip>;
4897
+ /**
4898
+ * Schema for storage delete tool output
4899
+ */
4900
+ declare const StorageDeleteOutputSchema: z.ZodObject<{
4901
+ success: z.ZodBoolean;
4902
+ }, z.core.$strip>;
4903
+ /**
4904
+ * Schema for storage list tool output
4905
+ */
4906
+ declare const StorageListOutputSchema: z.ZodObject<{
4907
+ success: z.ZodBoolean;
4908
+ files: z.ZodArray<z.ZodString>;
4909
+ }, z.core.$strip>;
4910
+ type StorageUploadInput = z.infer<typeof StorageUploadInputSchema>;
4911
+ type StorageSignedUrlInput = z.infer<typeof StorageSignedUrlInputSchema>;
4912
+ type StorageDownloadInput = z.infer<typeof StorageDownloadInputSchema>;
4913
+ type StorageDeleteInput = z.infer<typeof StorageDeleteInputSchema>;
4914
+ type StorageListInput = z.infer<typeof StorageListInputSchema>;
4915
+ type StorageUploadOutput = z.infer<typeof StorageUploadOutputSchema>;
4916
+ type StorageSignedUrlOutput = z.infer<typeof StorageSignedUrlOutputSchema>;
4917
+ type StorageDownloadOutput = z.infer<typeof StorageDownloadOutputSchema>;
4918
+ type StorageDeleteOutput = z.infer<typeof StorageDeleteOutputSchema>;
4926
4919
  type StorageListOutput = z.infer<typeof StorageListOutputSchema>;
4927
4920
 
4928
4921
  /**
@@ -6479,6 +6472,238 @@ interface CreateCheckoutSessionResult {
6479
6472
  expiresAt: number;
6480
6473
  }
6481
6474
 
6475
+ declare const ProjectSchemas: {
6476
+ CreateProjectRequest: z.ZodObject<{
6477
+ name: z.ZodString;
6478
+ kind: z.ZodEnum<{
6479
+ other: "other";
6480
+ client_engagement: "client_engagement";
6481
+ internal: "internal";
6482
+ research: "research";
6483
+ }>;
6484
+ status: z.ZodOptional<z.ZodEnum<{
6485
+ completed: "completed";
6486
+ active: "active";
6487
+ paused: "paused";
6488
+ on_track: "on_track";
6489
+ at_risk: "at_risk";
6490
+ blocked: "blocked";
6491
+ }>>;
6492
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6493
+ deal_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6494
+ client_company_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6495
+ start_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6496
+ target_end_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6497
+ contract_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
6498
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
6499
+ }, z.core.$strict>;
6500
+ UpdateProjectRequest: z.ZodObject<{
6501
+ name: z.ZodOptional<z.ZodString>;
6502
+ kind: z.ZodOptional<z.ZodEnum<{
6503
+ other: "other";
6504
+ client_engagement: "client_engagement";
6505
+ internal: "internal";
6506
+ research: "research";
6507
+ }>>;
6508
+ status: z.ZodOptional<z.ZodEnum<{
6509
+ completed: "completed";
6510
+ active: "active";
6511
+ paused: "paused";
6512
+ on_track: "on_track";
6513
+ at_risk: "at_risk";
6514
+ blocked: "blocked";
6515
+ }>>;
6516
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6517
+ deal_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6518
+ client_company_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6519
+ start_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6520
+ target_end_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6521
+ actual_end_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6522
+ contract_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
6523
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
6524
+ }, z.core.$strict>;
6525
+ GetProjectsQuery: z.ZodObject<{
6526
+ kind: z.ZodOptional<z.ZodEnum<{
6527
+ other: "other";
6528
+ client_engagement: "client_engagement";
6529
+ internal: "internal";
6530
+ research: "research";
6531
+ }>>;
6532
+ status: z.ZodOptional<z.ZodEnum<{
6533
+ completed: "completed";
6534
+ active: "active";
6535
+ paused: "paused";
6536
+ on_track: "on_track";
6537
+ at_risk: "at_risk";
6538
+ blocked: "blocked";
6539
+ }>>;
6540
+ }, z.core.$strict>;
6541
+ ProjectIdParams: z.ZodObject<{
6542
+ id: z.ZodString;
6543
+ }, z.core.$strip>;
6544
+ CreateMilestoneRequest: z.ZodObject<{
6545
+ name: z.ZodString;
6546
+ status: z.ZodOptional<z.ZodEnum<{
6547
+ completed: "completed";
6548
+ overdue: "overdue";
6549
+ upcoming: "upcoming";
6550
+ blocked: "blocked";
6551
+ in_progress: "in_progress";
6552
+ }>>;
6553
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6554
+ due_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6555
+ sequence: z.ZodOptional<z.ZodNumber>;
6556
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
6557
+ }, z.core.$strict>;
6558
+ UpdateMilestoneRequest: z.ZodObject<{
6559
+ name: z.ZodOptional<z.ZodString>;
6560
+ status: z.ZodOptional<z.ZodEnum<{
6561
+ completed: "completed";
6562
+ overdue: "overdue";
6563
+ upcoming: "upcoming";
6564
+ blocked: "blocked";
6565
+ in_progress: "in_progress";
6566
+ }>>;
6567
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6568
+ due_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6569
+ completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6570
+ sequence: z.ZodOptional<z.ZodNumber>;
6571
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
6572
+ }, z.core.$strict>;
6573
+ ProjectIdPathParams: z.ZodObject<{
6574
+ projectId: z.ZodString;
6575
+ }, z.core.$strip>;
6576
+ MilestoneIdParams: z.ZodObject<{
6577
+ id: z.ZodString;
6578
+ }, z.core.$strip>;
6579
+ CreateTaskRequest: z.ZodObject<{
6580
+ project_id: z.ZodString;
6581
+ name: z.ZodString;
6582
+ type: z.ZodOptional<z.ZodEnum<{
6583
+ code: "code";
6584
+ other: "other";
6585
+ documentation: "documentation";
6586
+ report: "report";
6587
+ design: "design";
6588
+ research: "research";
6589
+ refactor: "refactor";
6590
+ feature: "feature";
6591
+ bug: "bug";
6592
+ }>>;
6593
+ status: z.ZodOptional<z.ZodEnum<{
6594
+ completed: "completed";
6595
+ cancelled: "cancelled";
6596
+ blocked: "blocked";
6597
+ in_progress: "in_progress";
6598
+ planned: "planned";
6599
+ submitted: "submitted";
6600
+ approved: "approved";
6601
+ rejected: "rejected";
6602
+ revision_requested: "revision_requested";
6603
+ }>>;
6604
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6605
+ milestone_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6606
+ parent_task_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6607
+ due_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6608
+ checklist: z.ZodOptional<z.ZodArray<z.ZodObject<{
6609
+ id: z.ZodString;
6610
+ label: z.ZodString;
6611
+ completed: z.ZodBoolean;
6612
+ }, z.core.$strip>>>;
6613
+ resume_context: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
6614
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
6615
+ }, z.core.$strict>;
6616
+ UpdateTaskRequest: z.ZodObject<{
6617
+ name: z.ZodOptional<z.ZodString>;
6618
+ type: z.ZodOptional<z.ZodEnum<{
6619
+ code: "code";
6620
+ other: "other";
6621
+ documentation: "documentation";
6622
+ report: "report";
6623
+ design: "design";
6624
+ research: "research";
6625
+ refactor: "refactor";
6626
+ feature: "feature";
6627
+ bug: "bug";
6628
+ }>>;
6629
+ status: z.ZodOptional<z.ZodEnum<{
6630
+ completed: "completed";
6631
+ cancelled: "cancelled";
6632
+ blocked: "blocked";
6633
+ in_progress: "in_progress";
6634
+ planned: "planned";
6635
+ submitted: "submitted";
6636
+ approved: "approved";
6637
+ rejected: "rejected";
6638
+ revision_requested: "revision_requested";
6639
+ }>>;
6640
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6641
+ milestone_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6642
+ parent_task_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6643
+ due_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6644
+ completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6645
+ checklist: z.ZodOptional<z.ZodArray<z.ZodObject<{
6646
+ id: z.ZodString;
6647
+ label: z.ZodString;
6648
+ completed: z.ZodBoolean;
6649
+ }, z.core.$strip>>>;
6650
+ resume_context: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
6651
+ file_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6652
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
6653
+ }, z.core.$strict>;
6654
+ MergeResumeContextRequest: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6655
+ GetTasksQuery: z.ZodObject<{
6656
+ status: z.ZodOptional<z.ZodEnum<{
6657
+ completed: "completed";
6658
+ cancelled: "cancelled";
6659
+ blocked: "blocked";
6660
+ in_progress: "in_progress";
6661
+ planned: "planned";
6662
+ submitted: "submitted";
6663
+ approved: "approved";
6664
+ rejected: "rejected";
6665
+ revision_requested: "revision_requested";
6666
+ }>>;
6667
+ milestone_id: z.ZodOptional<z.ZodString>;
6668
+ parent_task_id: z.ZodOptional<z.ZodString>;
6669
+ }, z.core.$strict>;
6670
+ TaskIdParams: z.ZodObject<{
6671
+ id: z.ZodString;
6672
+ }, z.core.$strip>;
6673
+ CreateNoteRequest: z.ZodObject<{
6674
+ project_id: z.ZodString;
6675
+ content: z.ZodString;
6676
+ type: z.ZodOptional<z.ZodEnum<{
6677
+ call_note: "call_note";
6678
+ status_update: "status_update";
6679
+ issue: "issue";
6680
+ blocker: "blocker";
6681
+ }>>;
6682
+ summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6683
+ task_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6684
+ milestone_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6685
+ occurred_at: z.ZodOptional<z.ZodString>;
6686
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
6687
+ }, z.core.$strict>;
6688
+ UpdateNoteRequest: z.ZodObject<{
6689
+ content: z.ZodOptional<z.ZodString>;
6690
+ type: z.ZodOptional<z.ZodEnum<{
6691
+ call_note: "call_note";
6692
+ status_update: "status_update";
6693
+ issue: "issue";
6694
+ blocker: "blocker";
6695
+ }>>;
6696
+ summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6697
+ task_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6698
+ milestone_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6699
+ occurred_at: z.ZodOptional<z.ZodString>;
6700
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
6701
+ }, z.core.$strict>;
6702
+ NoteIdParams: z.ZodObject<{
6703
+ id: z.ZodString;
6704
+ }, z.core.$strip>;
6705
+ };
6706
+
6482
6707
  /**
6483
6708
  * Tool Method Maps
6484
6709
  *
@@ -6646,6 +6871,163 @@ type NotificationToolMap = {
6646
6871
  result: void;
6647
6872
  };
6648
6873
  };
6874
+ type ProjectsListParams = z.infer<typeof ProjectSchemas.GetProjectsQuery>;
6875
+ type ProjectCreateParams = z.infer<typeof ProjectSchemas.CreateProjectRequest>;
6876
+ type ProjectUpdateParams = z.infer<typeof ProjectSchemas.UpdateProjectRequest>;
6877
+ type MilestoneCreateParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams> & z.infer<typeof ProjectSchemas.CreateMilestoneRequest>;
6878
+ type MilestoneUpdateParams = z.infer<typeof ProjectSchemas.UpdateMilestoneRequest>;
6879
+ type TaskListParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams> & z.infer<typeof ProjectSchemas.GetTasksQuery>;
6880
+ type TaskCreateParams = z.infer<typeof ProjectSchemas.CreateTaskRequest>;
6881
+ type TaskUpdateParams = z.infer<typeof ProjectSchemas.UpdateTaskRequest>;
6882
+ type TaskResumeContextParams = z.infer<typeof ProjectSchemas.TaskIdParams> & z.infer<typeof ProjectSchemas.MergeResumeContextRequest>;
6883
+ type NoteListParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams>;
6884
+ type NoteCreateParams = z.infer<typeof ProjectSchemas.CreateNoteRequest>;
6885
+ type NoteUpdateParams = z.infer<typeof ProjectSchemas.UpdateNoteRequest>;
6886
+ type TaskResumeContextResult = Pick<TaskRow, 'id' | 'resume_context' | 'updated_at'>;
6887
+ type ProjectsToolMap = {
6888
+ listProjects: {
6889
+ params: ProjectsListParams;
6890
+ result: ProjectWithCounts[];
6891
+ };
6892
+ getProject: {
6893
+ params: z.infer<typeof ProjectSchemas.ProjectIdParams>;
6894
+ result: ProjectDetail;
6895
+ };
6896
+ createProject: {
6897
+ params: ProjectCreateParams;
6898
+ result: ProjectRow;
6899
+ };
6900
+ updateProject: {
6901
+ params: z.infer<typeof ProjectSchemas.ProjectIdParams> & ProjectUpdateParams;
6902
+ result: ProjectRow;
6903
+ };
6904
+ deleteProject: {
6905
+ params: z.infer<typeof ProjectSchemas.ProjectIdParams>;
6906
+ result: void;
6907
+ };
6908
+ listMilestones: {
6909
+ params: z.infer<typeof ProjectSchemas.ProjectIdPathParams>;
6910
+ result: MilestoneRow[];
6911
+ };
6912
+ createMilestone: {
6913
+ params: MilestoneCreateParams;
6914
+ result: MilestoneRow;
6915
+ };
6916
+ updateMilestone: {
6917
+ params: z.infer<typeof ProjectSchemas.MilestoneIdParams> & MilestoneUpdateParams;
6918
+ result: MilestoneRow;
6919
+ };
6920
+ deleteMilestone: {
6921
+ params: z.infer<typeof ProjectSchemas.MilestoneIdParams>;
6922
+ result: void;
6923
+ };
6924
+ listTasks: {
6925
+ params: TaskListParams;
6926
+ result: TaskRow[];
6927
+ };
6928
+ getTask: {
6929
+ params: z.infer<typeof ProjectSchemas.TaskIdParams>;
6930
+ result: TaskRow;
6931
+ };
6932
+ createTask: {
6933
+ params: TaskCreateParams;
6934
+ result: TaskRow;
6935
+ };
6936
+ updateTask: {
6937
+ params: z.infer<typeof ProjectSchemas.TaskIdParams> & TaskUpdateParams;
6938
+ result: TaskRow;
6939
+ };
6940
+ deleteTask: {
6941
+ params: z.infer<typeof ProjectSchemas.TaskIdParams>;
6942
+ result: void;
6943
+ };
6944
+ mergeTaskResumeContext: {
6945
+ params: TaskResumeContextParams;
6946
+ result: TaskResumeContextResult;
6947
+ };
6948
+ listNotes: {
6949
+ params: NoteListParams;
6950
+ result: NoteRow[];
6951
+ };
6952
+ createNote: {
6953
+ params: NoteCreateParams;
6954
+ result: NoteRow;
6955
+ };
6956
+ updateNote: {
6957
+ params: z.infer<typeof ProjectSchemas.NoteIdParams> & NoteUpdateParams;
6958
+ result: NoteRow;
6959
+ };
6960
+ deleteNote: {
6961
+ params: z.infer<typeof ProjectSchemas.NoteIdParams>;
6962
+ result: void;
6963
+ };
6964
+ };
6965
+ type CrmRecentActivityParams = Partial<z.infer<typeof CrmSchemas.GetRecentActivityQuery>>;
6966
+ type CrmListDealsParams = Partial<z.infer<typeof DealSchemas.ListDealsQuery>>;
6967
+ type CrmGetDealParams = z.infer<typeof DealSchemas.DealIdParams>;
6968
+ type CrmUpdateDealStageParams = z.infer<typeof DealSchemas.DealIdParams> & z.infer<typeof DealSchemas.SyncDealStageRequest>;
6969
+ type CrmGetDealByEmailParams = {
6970
+ email: string;
6971
+ };
6972
+ type CrmTaskDueParams = Partial<z.infer<typeof DealSchemas.ListDealTasksDueQuery>>;
6973
+ type CrmDealTaskParams = Omit<CreateDealTaskParams, 'organizationId'>;
6974
+ type CrmDealNoteParams = Omit<CreateDealNoteParams, 'organizationId'>;
6975
+ type CrmRecordActivityParams = Omit<RecordDealActivityParams, 'organizationId'>;
6976
+ type CrmDeleteDealParams = Omit<DeleteDealParams, 'organizationId'>;
6977
+ type CrmToolMap = {
6978
+ getRecentActivity: {
6979
+ params: CrmRecentActivityParams;
6980
+ result: RecentActivityEntry[];
6981
+ };
6982
+ listDeals: {
6983
+ params: CrmListDealsParams;
6984
+ result: DealListItem[];
6985
+ };
6986
+ getDeal: {
6987
+ params: CrmGetDealParams;
6988
+ result: DealDetail | null;
6989
+ };
6990
+ getDealByEmail: {
6991
+ params: CrmGetDealByEmailParams;
6992
+ result: DealDetail | null;
6993
+ };
6994
+ updateDealStage: {
6995
+ params: CrmUpdateDealStageParams;
6996
+ result: void;
6997
+ };
6998
+ createDealNote: {
6999
+ params: CrmDealNoteParams;
7000
+ result: AcqDealNote;
7001
+ };
7002
+ listDealNotes: {
7003
+ params: Omit<ListDealNotesParams, 'organizationId'>;
7004
+ result: AcqDealNote[];
7005
+ };
7006
+ createDealTask: {
7007
+ params: CrmDealTaskParams;
7008
+ result: AcqDealTask;
7009
+ };
7010
+ listDealTasks: {
7011
+ params: Omit<ListDealTasksParams, 'organizationId'>;
7012
+ result: AcqDealTask[];
7013
+ };
7014
+ listDealTasksDue: {
7015
+ params: CrmTaskDueParams;
7016
+ result: AcqDealTask[];
7017
+ };
7018
+ completeDealTask: {
7019
+ params: Omit<CompleteDealTaskParams, 'organizationId'>;
7020
+ result: AcqDealTask;
7021
+ };
7022
+ recordActivity: {
7023
+ params: CrmRecordActivityParams;
7024
+ result: void;
7025
+ };
7026
+ deleteDeal: {
7027
+ params: CrmDeleteDealParams;
7028
+ result: void;
7029
+ };
7030
+ };
6649
7031
  type StripeToolMap = {
6650
7032
  createPaymentLink: {
6651
7033
  params: CreatePaymentLinkParams;
@@ -7926,6 +8308,339 @@ declare const DOMAINS: {
7926
8308
  */
7927
8309
  type ResourceDomain = (typeof DOMAINS)[keyof typeof DOMAINS];
7928
8310
 
8311
+ /**
8312
+ * ResourceRegistry - Resource discovery and lookup
8313
+ * Handles resource definitions from OrganizationRegistry
8314
+ *
8315
+ * Features:
8316
+ * - Resource discovery by organization
8317
+ * - Startup validation (duplicate IDs, model configs, relationships, interface-schema alignment)
8318
+ * - Pre-serialization cache for instant API responses
8319
+ * - Command View data generation
8320
+ */
8321
+
8322
+ /**
8323
+ * Configuration for a remotely-deployed organization
8324
+ *
8325
+ * Stored alongside runtime-registered organizations to support
8326
+ * worker thread execution branching and credential management.
8327
+ */
8328
+ interface RemoteOrgConfig {
8329
+ /** Supabase Storage path: "{orgId}/{deploymentId}/bundle.js" */
8330
+ storagePath: string;
8331
+ /** Deployment record ID */
8332
+ deploymentId: string;
8333
+ /** OS temp path to bundle -- set after first download, used by worker threads */
8334
+ cachedTempPath?: string;
8335
+ /** Platform tool name -> credential name mapping */
8336
+ toolCredentials?: Record<string, string>;
8337
+ /** SDK version used to deploy this bundle */
8338
+ sdkVersion?: string;
8339
+ /** Deployment version (semver) of the deployed bundle */
8340
+ deploymentVersion?: string;
8341
+ }
8342
+ /**
8343
+ * Organization-specific resource collection
8344
+ *
8345
+ * Complete manifest of all automation resources for an organization.
8346
+ * Used by ResourceRegistry for discovery and Command View for visualization.
8347
+ */
8348
+ interface DeploymentSpec {
8349
+ /** Deployment version (semver) */
8350
+ version: string;
8351
+ /** Workflow definitions */
8352
+ workflows?: WorkflowDefinition[];
8353
+ /** Agent definitions */
8354
+ agents?: AgentDefinition[];
8355
+ /** Trigger definitions - entry points that initiate executions */
8356
+ triggers?: TriggerDefinition[];
8357
+ /** Integration definitions - external service connections */
8358
+ integrations?: IntegrationDefinition[];
8359
+ /** Explicit relationship declarations between resources */
8360
+ relationships?: ResourceRelationships;
8361
+ /** External automation resources (n8n, Make, Zapier, etc.) */
8362
+ externalResources?: ExternalResourceDefinition[];
8363
+ /** Human checkpoint definitions - human decision points in automation */
8364
+ humanCheckpoints?: HumanCheckpointDefinition[];
8365
+ }
8366
+ /**
8367
+ * Organization Registry type
8368
+ */
8369
+ type OrganizationRegistry = Record<string, DeploymentSpec>;
8370
+ declare class ResourceRegistry {
8371
+ private registry;
8372
+ /**
8373
+ * Pre-serialized organization data cache
8374
+ * Computed once at construction for static orgs, updated incrementally for runtime orgs
8375
+ */
8376
+ private serializedCache;
8377
+ /**
8378
+ * Per-resource remote configuration (external deployments)
8379
+ * Key: "orgName/resourceId", Value: RemoteOrgConfig for that resource.
8380
+ * Tracks which individual resources were added at runtime via deploy pipeline.
8381
+ * Static and remote resources coexist in the same org.
8382
+ */
8383
+ private remoteResources;
8384
+ constructor(registry: OrganizationRegistry);
8385
+ /**
8386
+ * Validates registry on construction
8387
+ * - Checks for duplicate resourceIds within organizations
8388
+ * - Validates model configurations against constraints
8389
+ * - Validates ExecutionInterface matches inputSchema
8390
+ * @throws Error if validation fails
8391
+ */
8392
+ private validateRegistry;
8393
+ /**
8394
+ * Validates relationship declarations reference valid resources
8395
+ * Runs at API server startup - fails fast in development
8396
+ * @throws Error if validation fails
8397
+ */
8398
+ private validateRelationships;
8399
+ /**
8400
+ * Get the remote resource IDs currently registered for an organization.
8401
+ * Used to validate redeployments against the post-swap state before any
8402
+ * live registry mutation occurs.
8403
+ */
8404
+ private getRemoteResourceIds;
8405
+ /**
8406
+ * Build the "static + surviving" baseline for registration validation.
8407
+ * On redeploy, this strips the currently remote-owned resources and
8408
+ * deployment-owned metadata so validation reflects the state after swap.
8409
+ */
8410
+ private buildRegistrationBase;
8411
+ /**
8412
+ * Validate the registry state that would exist after registration succeeds.
8413
+ * This runs before any live mutation so invalid redeploys preserve the
8414
+ * currently active remote resources.
8415
+ */
8416
+ private validateRegistrationCandidate;
8417
+ /**
8418
+ * Get a resource definition by ID
8419
+ * Returns full definition (WorkflowDefinition or AgentDefinition)
8420
+ * Check definition.config.type to determine if it's a workflow or agent
8421
+ */
8422
+ getResourceDefinition(organizationName: string, resourceId: string): WorkflowDefinition | AgentDefinition | null;
8423
+ /**
8424
+ * List all resources for an organization
8425
+ * Returns ResourceDefinition metadata (not full definitions)
8426
+ *
8427
+ * All resources are returned regardless of server environment.
8428
+ * Pass an explicit `environment` filter to get only 'dev' or 'prod' resources.
8429
+ */
8430
+ listResourcesForOrganization(organizationName: string, environment?: ResourceStatus$1): ResourceList;
8431
+ /**
8432
+ * List all resources from all organizations
8433
+ * NOTE: For debugging only - returns raw registry data
8434
+ */
8435
+ listAllResources(): OrganizationRegistry;
8436
+ /**
8437
+ * Register external resources at runtime
8438
+ *
8439
+ * Called during deploy pipeline when an external developer deploys their bundle.
8440
+ * Merges the incoming stub definitions into the org's registry and stores
8441
+ * per-resource remote config for worker thread execution branching.
8442
+ *
8443
+ * Static and remote resources coexist in the same org. If the org already
8444
+ * has static resources, the incoming remote resources are merged alongside them.
8445
+ * If redeploying (some resources already registered as remote for this org),
8446
+ * the previous remote resources are unregistered first.
8447
+ *
8448
+ * @param orgName - Organization name (used as registry key)
8449
+ * @param org - Stub resource definitions (workflows/agents with placeholder handlers)
8450
+ * @param remote - Remote configuration (bundle path, deployment ID, env vars)
8451
+ * @throws Error if incoming resourceId conflicts with a static resource
8452
+ * @throws Error if incoming deployment contains duplicate resourceIds
8453
+ */
8454
+ registerOrganization(orgName: string, org: DeploymentSpec, remote: RemoteOrgConfig): void;
8455
+ /**
8456
+ * Patch serialized cache with pre-serialized schemas from an external manifest.
8457
+ *
8458
+ * External deployments use stub definitions with z.any() schemas (never called).
8459
+ * The manifest carries the real schemas as pre-serialized JSON Schema from the worker.
8460
+ * This method patches those into the serialized cache so describe/CLI display them.
8461
+ *
8462
+ * @param orgName - Organization name
8463
+ * @param manifestSchemas - Map of resourceId -> { contract, steps } with JSON Schema
8464
+ */
8465
+ patchManifestSchemas(orgName: string, manifestSchemas: Array<{
8466
+ resourceId: string;
8467
+ type: 'workflow' | 'agent';
8468
+ contract?: {
8469
+ inputSchema?: object;
8470
+ outputSchema?: object;
8471
+ };
8472
+ steps?: Array<{
8473
+ id: string;
8474
+ inputSchema?: object;
8475
+ outputSchema?: object;
8476
+ }>;
8477
+ }>): void;
8478
+ /**
8479
+ * Register built-in platform resources (static, local execution)
8480
+ *
8481
+ * Unlike registerOrganization(), these resources:
8482
+ * - Do NOT have remote config (execute in-process, not in worker threads)
8483
+ * - Are NOT removed by unregisterOrganization() (persist across redeployments)
8484
+ * - Use reserved resource IDs that external deployments cannot claim
8485
+ *
8486
+ * @param orgName - Organization name
8487
+ * @param org - Resource definitions with real handlers (not stubs)
8488
+ */
8489
+ registerStaticResources(orgName: string, org: DeploymentSpec): void;
8490
+ /**
8491
+ * Unregister runtime-registered resources for an organization
8492
+ *
8493
+ * Removes only resources that were registered at runtime (via registerOrganization).
8494
+ * Static resources loaded at startup are preserved. If the org still has static
8495
+ * resources after removal, the serialization cache is rebuilt. If no resources
8496
+ * remain, the org is fully removed from the registry.
8497
+ * No-op if the org has no remote resources.
8498
+ *
8499
+ * @param orgName - Organization name to unregister remote resources from
8500
+ */
8501
+ unregisterOrganization(orgName: string): void;
8502
+ /**
8503
+ * Get remote configuration for a specific resource
8504
+ *
8505
+ * Returns the RemoteOrgConfig if the resource was registered at runtime,
8506
+ * or null if it's a static resource or doesn't exist.
8507
+ * Used by the execution coordinator to branch between local and worker execution.
8508
+ *
8509
+ * @param orgName - Organization name
8510
+ * @param resourceId - Resource ID
8511
+ * @returns Remote config or null
8512
+ */
8513
+ getRemoteConfig(orgName: string, resourceId: string): RemoteOrgConfig | null;
8514
+ /**
8515
+ * Check if an organization has any remote (externally deployed) resources
8516
+ *
8517
+ * @param orgName - Organization name
8518
+ * @returns true if the org has at least one runtime-registered resource
8519
+ */
8520
+ isRemote(orgName: string): boolean;
8521
+ /**
8522
+ * Get the remote config for any resource in an organization.
8523
+ * Used when the specific resource ID is unknown (e.g., to clean up a
8524
+ * temp file before unregistering an org -- all resources share one config).
8525
+ *
8526
+ * @param orgName - Organization name
8527
+ * @returns Remote config or null if org has no remote resources
8528
+ */
8529
+ getAnyRemoteConfig(orgName: string): RemoteOrgConfig | null;
8530
+ /**
8531
+ * Get statistics about remotely-deployed resources
8532
+ * Used by the health endpoint for platform-wide deployment visibility.
8533
+ */
8534
+ getRemoteStats(): {
8535
+ activeOrgs: number;
8536
+ totalResources: number;
8537
+ };
8538
+ /**
8539
+ * Get triggers for an organization
8540
+ * @param organizationName - Organization name
8541
+ * @returns Array of trigger definitions (empty if none defined)
8542
+ */
8543
+ getTriggers(organizationName: string): TriggerDefinition[];
8544
+ /**
8545
+ * Get integrations for an organization
8546
+ * @param organizationName - Organization name
8547
+ * @returns Array of integration definitions (empty if none defined)
8548
+ */
8549
+ getIntegrations(organizationName: string): IntegrationDefinition[];
8550
+ /**
8551
+ * Get resource relationships for an organization
8552
+ * @param organizationName - Organization name
8553
+ * @returns Resource relationships map (undefined if none defined)
8554
+ */
8555
+ getRelationships(organizationName: string): ResourceRelationships | undefined;
8556
+ /**
8557
+ * Get a specific trigger by ID
8558
+ * @param organizationName - Organization name
8559
+ * @param triggerId - Trigger ID
8560
+ * @returns Trigger definition or null if not found
8561
+ */
8562
+ getTrigger(organizationName: string, triggerId: string): TriggerDefinition | null;
8563
+ /**
8564
+ * Get a specific integration by ID
8565
+ * @param organizationName - Organization name
8566
+ * @param integrationId - Integration ID
8567
+ * @returns Integration definition or null if not found
8568
+ */
8569
+ getIntegration(organizationName: string, integrationId: string): IntegrationDefinition | null;
8570
+ /**
8571
+ * Get external resources for an organization
8572
+ * @param organizationName - Organization name
8573
+ * @returns Array of external resource definitions (empty if none defined)
8574
+ */
8575
+ getExternalResources(organizationName: string): ExternalResourceDefinition[];
8576
+ /**
8577
+ * Get a specific external resource by ID
8578
+ * @param organizationName - Organization name
8579
+ * @param externalId - External resource ID
8580
+ * @returns External resource definition or null if not found
8581
+ */
8582
+ getExternalResource(organizationName: string, externalId: string): ExternalResourceDefinition | null;
8583
+ /**
8584
+ * Get human checkpoints for an organization
8585
+ * @param organizationName - Organization name
8586
+ * @returns Array of human checkpoint definitions (empty if none defined)
8587
+ */
8588
+ getHumanCheckpoints(organizationName: string): HumanCheckpointDefinition[];
8589
+ /**
8590
+ * Get a specific human checkpoint by ID
8591
+ * @param organizationName - Organization name
8592
+ * @param humanCheckpointId - Human checkpoint ID
8593
+ * @returns Human checkpoint definition or null if not found
8594
+ */
8595
+ getHumanCheckpoint(organizationName: string, humanCheckpointId: string): HumanCheckpointDefinition | null;
8596
+ /**
8597
+ * Get serialized resource definition (instant lookup)
8598
+ * Use for API responses - returns pre-computed JSON-safe structure
8599
+ *
8600
+ * @param organizationName - Organization name
8601
+ * @param resourceId - Resource ID
8602
+ * @returns Serialized definition or null if not found
8603
+ */
8604
+ getSerializedDefinition(organizationName: string, resourceId: string): SerializedAgentDefinition | SerializedWorkflowDefinition | null;
8605
+ /**
8606
+ * Get resource list for organization (instant lookup)
8607
+ * Use for /resources endpoint - returns pre-computed ResourceDefinition array
8608
+ *
8609
+ * @param organizationName - Organization name
8610
+ * @returns Resource list with workflows, agents, and total count
8611
+ */
8612
+ getResourceList(organizationName: string): {
8613
+ workflows: ResourceDefinition[];
8614
+ agents: ResourceDefinition[];
8615
+ total: number;
8616
+ };
8617
+ /**
8618
+ * Get Command View data for organization (instant lookup)
8619
+ * Use for /command-view endpoint - returns complete graph data
8620
+ *
8621
+ * @param organizationName - Organization name
8622
+ * @returns Command View data with nodes and edges
8623
+ */
8624
+ getCommandViewData(organizationName: string): CommandViewData;
8625
+ /**
8626
+ * List resources that have UI interfaces configured
8627
+ * Used by Execution Runner Catalog UI
8628
+ *
8629
+ * @param organizationName - Organization name
8630
+ * @param environment - Optional environment filter ('dev' or 'prod')
8631
+ * @returns Array of resources with interfaces
8632
+ */
8633
+ listExecutable(organizationName: string, environment?: 'dev' | 'prod'): Array<{
8634
+ resourceId: string;
8635
+ resourceName: string;
8636
+ resourceType: 'workflow' | 'agent';
8637
+ description?: string;
8638
+ status: 'dev' | 'prod';
8639
+ version: string;
8640
+ interface: SerializedExecutionInterface;
8641
+ }>;
8642
+ }
8643
+
7929
8644
  /**
7930
8645
  * Registry Validation Utilities
7931
8646
  *
@@ -8013,4 +8728,4 @@ declare class ToolingError extends ExecutionError {
8013
8728
  }
8014
8729
 
8015
8730
  export { ExecutionError, RegistryValidationError, ResourceRegistry, StepType, ToolingError };
8016
- 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, DeleteDealParams, DeleteNoteParams, DeleteNoteResult, DeleteRecordParams, DeleteRecordResult, DeleteRowByValueParams, DeleteRowByValueResult, DeploymentSpec, DomainDefinition, 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, QueryRecordsParams, QueryRecordsResult, ReadSheetParams, ReadSheetResult, Recipient, RecurringScheduleConfig, RelationshipDeclaration, RelativeScheduleConfig, RemoveFromSubsequenceParams, RemoveFromSubsequenceResult, ResendGetEmailParams, ResendGetEmailResult, ResendSendEmailParams, ResendSendEmailResult, ResendToolMap, ResourceDefinition, ResourceDomain, 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 };
8731
+ 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, DomainDefinition, 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, ResourceDefinition, ResourceDomain, 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 };