@getsupervisor/agents-studio-sdk 1.41.0-patch.1 → 1.41.0-patch.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -452,6 +452,7 @@ type components = {
452
452
  message?: string;
453
453
  };
454
454
  ToolConnectionRequest: {
455
+ connectionKey?: string;
455
456
  agentId: string;
456
457
  metadata?: {
457
458
  [key: string]: unknown;
@@ -459,7 +460,7 @@ type components = {
459
460
  auth?: components['schemas']['ToolConnectionAuth'];
460
461
  };
461
462
  ToolConnectionResponse: {
462
- status: 'connected' | 'pending' | 'error';
463
+ status: 'connected' | 'pending' | 'error' | 'revoked';
463
464
  toolAgentConnectionId?: string | null;
464
465
  toolId: string;
465
466
  workspaceId: string;
@@ -472,7 +473,7 @@ type components = {
472
473
  };
473
474
  };
474
475
  ToolConnectionAuth: {
475
- type: 'none' | 'oauth2' | 'api_key';
476
+ type: 'none' | 'oauth2' | 'api_key' | 'custom';
476
477
  data?: {
477
478
  [key: string]: unknown;
478
479
  };
@@ -495,6 +496,7 @@ type components = {
495
496
  toolId: string;
496
497
  toolAgentConnectionId?: string | null;
497
498
  providerRef?: string | null;
499
+ toolExecutionId: string;
498
500
  message?: string | null;
499
501
  };
500
502
  CatalogItemLinks: {
@@ -723,6 +725,36 @@ type components = {
723
725
  [key: string]: components['schemas']['ToolConfigSchemaAction'];
724
726
  };
725
727
  };
728
+ ToolConnectionListItem: {
729
+ toolAgentConnectionId: string;
730
+ toolId: string;
731
+ workspaceId: string;
732
+ agentId: string;
733
+ connectionKey: string;
734
+ status: 'connected' | 'pending' | 'error' | 'revoked';
735
+ providerRef?: string | null;
736
+ descriptionUsage?: string | null;
737
+ usageExample?: string | null;
738
+ };
739
+ ToolConnectionListResponse: {
740
+ data: components['schemas']['ToolConnectionListItem'][];
741
+ meta: components['schemas']['PaginationMeta'];
742
+ };
743
+ CreateToolConnectionRequest: {
744
+ toolId: string;
745
+ agentId: string;
746
+ connectionKey?: string;
747
+ metadata?: {
748
+ [key: string]: unknown;
749
+ };
750
+ auth?: components['schemas']['ToolConnectionAuth'];
751
+ };
752
+ ExecuteToolConnectionRequest: {
753
+ action: string;
754
+ args?: {
755
+ [key: string]: unknown;
756
+ };
757
+ };
726
758
  CatalogItemLanguageMetadata: {
727
759
  code: string;
728
760
  locale?: string | null;
@@ -780,6 +812,7 @@ type components = {
780
812
  ApiKeyId: string;
781
813
  XCacheRefresh?: boolean;
782
814
  IdempotencyKey: string;
815
+ XApiKey?: string;
783
816
  };
784
817
  requestBodies: never;
785
818
  headers: never;
@@ -1034,8 +1067,12 @@ type ToolResourceUploadRequest = components['schemas']['ToolResourceUploadReques
1034
1067
  type ToolResourceUploadResponse = components['schemas']['ToolResourceUploadResponse'];
1035
1068
  type ToolResourceReloadResponse = components['schemas']['ToolResourceReloadResponse'];
1036
1069
  type ToolConnectionAuth = components['schemas']['ToolConnectionAuth'];
1070
+ type CreateToolConnectionRequest = components['schemas']['CreateToolConnectionRequest'];
1037
1071
  type ToolConnectionRequest = components['schemas']['ToolConnectionRequest'];
1038
1072
  type ToolConnectionResponse = components['schemas']['ToolConnectionResponse'];
1073
+ type ToolConnectionListItem = components['schemas']['ToolConnectionListItem'];
1074
+ type ToolConnectionListResponse = components['schemas']['ToolConnectionListResponse'];
1075
+ type ExecuteToolConnectionRequest = components['schemas']['ExecuteToolConnectionRequest'];
1039
1076
  type ErrorResponse = components['schemas']['ErrorResponse'];
1040
1077
  type CampaignStatus = components['schemas']['CampaignStatus'];
1041
1078
  type Campaign = components['schemas']['Campaign'];
@@ -1070,6 +1107,9 @@ declare class NetworkError extends Error {
1070
1107
  url?: string;
1071
1108
  constructor(cause?: unknown, url?: string);
1072
1109
  }
1110
+ declare class WorkspaceNotSelectedError extends Error {
1111
+ constructor();
1112
+ }
1073
1113
  type RetryPolicy = {
1074
1114
  maxRetries?: number;
1075
1115
  baseDelayMs?: number;
@@ -1662,19 +1702,31 @@ type ListToolsOptions = ListQueryOptions & {
1662
1702
  type ListToolResourcesOptions = Pick<ListQueryOptions, 'page' | 'limit'> & {
1663
1703
  type?: 'document' | 'media' | 'file';
1664
1704
  };
1705
+ type ListToolConnectionsOptions = ListQueryOptions;
1665
1706
  type UploadToolResourcePayload = FormData | (Omit<ToolResourceUploadRequest, 'file'> & {
1666
1707
  file: unknown;
1667
1708
  });
1668
1709
  declare function createToolsApi(cfg: ClientConfig & {
1669
1710
  retry?: RetryPolicy;
1670
1711
  }): {
1712
+ connections: {
1713
+ readonly connect: (toolId: string, payload: ToolConnectionRequest, options?: IdempotentRequestOptions) => Promise<ToolConnectionResponse>;
1714
+ readonly create: (payload: CreateToolConnectionRequest, options?: IdempotentRequestOptions) => Promise<ToolConnectionResponse>;
1715
+ readonly execute: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: IdempotentRequestOptions) => Promise<ExecuteToolResponse>;
1716
+ readonly list: (options?: ListToolConnectionsOptions) => Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
1717
+ readonly createConnection: (payload: CreateToolConnectionRequest, options?: IdempotentRequestOptions) => Promise<ToolConnectionResponse>;
1718
+ readonly executeConnection: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: IdempotentRequestOptions) => Promise<ExecuteToolResponse>;
1719
+ };
1671
1720
  list(options?: ListToolsOptions): Promise<PaginatedResult<ToolListResponse, ListToolsOptions>>;
1672
1721
  listResources(toolId: string, options?: ListToolResourcesOptions): Promise<PaginatedResult<ToolResourceListResponse, ListToolResourcesOptions>>;
1722
+ listConnections(options?: ListToolConnectionsOptions): Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
1673
1723
  uploadResource(toolId: string, payload: UploadToolResourcePayload): Promise<ToolResourceUploadResponse>;
1674
1724
  deleteResource(toolId: string, resourceId: string): Promise<void>;
1675
1725
  reloadResource(toolId: string, resourceId: string): Promise<ToolResourceReloadResponse>;
1676
1726
  execute(toolId: string, payload: ExecuteToolRequest, options?: IdempotentRequestOptions): Promise<ExecuteToolResponse>;
1677
1727
  connect(toolId: string, payload: ToolConnectionRequest, options?: IdempotentRequestOptions): Promise<ToolConnectionResponse>;
1728
+ createConnection(payload: CreateToolConnectionRequest, options?: IdempotentRequestOptions): Promise<ToolConnectionResponse>;
1729
+ executeConnection(toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: IdempotentRequestOptions): Promise<ExecuteToolResponse>;
1678
1730
  };
1679
1731
 
1680
1732
  type ListVoicesOptions = ListQueryOptions & {
@@ -1816,8 +1868,27 @@ declare function createClient(initialCfg: ClientConfig & {
1816
1868
  enable(workspaceId: string, payload: WorkspaceEnableRequest): Promise<WorkspaceEnableResponse>;
1817
1869
  };
1818
1870
  tools: {
1871
+ connections: {
1872
+ readonly connect: (toolId: string, payload: ToolConnectionRequest, options?: {
1873
+ idempotencyKey?: string;
1874
+ }) => Promise<ToolConnectionResponse>;
1875
+ readonly create: (payload: CreateToolConnectionRequest, options?: {
1876
+ idempotencyKey?: string;
1877
+ }) => Promise<ToolConnectionResponse>;
1878
+ readonly execute: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
1879
+ idempotencyKey?: string;
1880
+ }) => Promise<ExecuteToolResponse>;
1881
+ readonly list: (options?: ListToolConnectionsOptions) => Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
1882
+ readonly createConnection: (payload: CreateToolConnectionRequest, options?: {
1883
+ idempotencyKey?: string;
1884
+ }) => Promise<ToolConnectionResponse>;
1885
+ readonly executeConnection: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
1886
+ idempotencyKey?: string;
1887
+ }) => Promise<ExecuteToolResponse>;
1888
+ };
1819
1889
  list(options?: ListToolsOptions): Promise<PaginatedResult<ToolListResponse, ListToolsOptions>>;
1820
1890
  listResources(toolId: string, options?: ListToolResourcesOptions): Promise<PaginatedResult<ToolResourceListResponse, ListToolResourcesOptions>>;
1891
+ listConnections(options?: ListToolConnectionsOptions): Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
1821
1892
  uploadResource(toolId: string, payload: FormData | (Omit<{
1822
1893
  file: string;
1823
1894
  type?: "document" | "media" | "file";
@@ -1836,6 +1907,12 @@ declare function createClient(initialCfg: ClientConfig & {
1836
1907
  connect(toolId: string, payload: ToolConnectionRequest, options?: {
1837
1908
  idempotencyKey?: string;
1838
1909
  }): Promise<ToolConnectionResponse>;
1910
+ createConnection(payload: CreateToolConnectionRequest, options?: {
1911
+ idempotencyKey?: string;
1912
+ }): Promise<ToolConnectionResponse>;
1913
+ executeConnection(toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
1914
+ idempotencyKey?: string;
1915
+ }): Promise<ExecuteToolResponse>;
1839
1916
  };
1840
1917
  catalogs: {
1841
1918
  templates: {
@@ -1930,8 +2007,27 @@ declare function createClient(initialCfg: ClientConfig & {
1930
2007
  enable(workspaceId: string, payload: WorkspaceEnableRequest): Promise<WorkspaceEnableResponse>;
1931
2008
  };
1932
2009
  tools: {
2010
+ connections: {
2011
+ readonly connect: (toolId: string, payload: ToolConnectionRequest, options?: {
2012
+ idempotencyKey?: string;
2013
+ }) => Promise<ToolConnectionResponse>;
2014
+ readonly create: (payload: CreateToolConnectionRequest, options?: {
2015
+ idempotencyKey?: string;
2016
+ }) => Promise<ToolConnectionResponse>;
2017
+ readonly execute: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
2018
+ idempotencyKey?: string;
2019
+ }) => Promise<ExecuteToolResponse>;
2020
+ readonly list: (options?: ListToolConnectionsOptions) => Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
2021
+ readonly createConnection: (payload: CreateToolConnectionRequest, options?: {
2022
+ idempotencyKey?: string;
2023
+ }) => Promise<ToolConnectionResponse>;
2024
+ readonly executeConnection: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
2025
+ idempotencyKey?: string;
2026
+ }) => Promise<ExecuteToolResponse>;
2027
+ };
1933
2028
  list(options?: ListToolsOptions): Promise<PaginatedResult<ToolListResponse, ListToolsOptions>>;
1934
2029
  listResources(toolId: string, options?: ListToolResourcesOptions): Promise<PaginatedResult<ToolResourceListResponse, ListToolResourcesOptions>>;
2030
+ listConnections(options?: ListToolConnectionsOptions): Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
1935
2031
  uploadResource(toolId: string, payload: FormData | (Omit<{
1936
2032
  file: string;
1937
2033
  type?: "document" | "media" | "file";
@@ -1950,6 +2046,12 @@ declare function createClient(initialCfg: ClientConfig & {
1950
2046
  connect(toolId: string, payload: ToolConnectionRequest, options?: {
1951
2047
  idempotencyKey?: string;
1952
2048
  }): Promise<ToolConnectionResponse>;
2049
+ createConnection(payload: CreateToolConnectionRequest, options?: {
2050
+ idempotencyKey?: string;
2051
+ }): Promise<ToolConnectionResponse>;
2052
+ executeConnection(toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
2053
+ idempotencyKey?: string;
2054
+ }): Promise<ExecuteToolResponse>;
1953
2055
  };
1954
2056
  catalogs: {
1955
2057
  templates: {
@@ -2008,4 +2110,4 @@ declare function createHttp(cfg: ClientConfig & {
2008
2110
  resolveAccessToken: () => string;
2009
2111
  };
2010
2112
 
2011
- export { type AgentBlueprint, type AgentBlueprintListItem, type AgentBlueprintListResponse, type AgentBlueprintsApi$1 as AgentBlueprintsApi, type AgentDetail, type AgentEntity, type AgentEntityFactoryOptions, type AgentListResponse, type AgentSchedule, type AgentScheduleApi, type AgentScheduleException, type AgentScheduleExceptionListResponse, type AgentScheduleListResponse, type AgentStageTriggersApi$1 as AgentStageTriggersApi, type AgentStagesApi$1 as AgentStagesApi, type AgentSummary, type AgentTagRequest, type AgentTagsResponse, type AgentVersionDetail, type AgentVersionListResponse, type AgentVersionSummary, type AgentsApi, type AgentsApiWithEntities, type ApiKeyListResponse, type ApiKeySummary, type ApiKeysApi, type BlueprintStage, type BlueprintStageListResponse, type BlueprintStageReorderRequest, type BlueprintStageTrigger, type BlueprintStageTriggerListResponse, type Campaign, type CampaignExecution, type CampaignExecutionListResponse, type CampaignListResponse, type CampaignStatus, type CatalogItemCreateRequest, type CatalogItemDetail, type CatalogItemLinks, type CatalogItemListResponse, type CatalogItemSummary, type CatalogTemplateDetail, type CatalogTemplateListResponse, type CatalogTemplateSummary, type CatalogTemplateVisibility, type ClientConfig, type ConnectPhoneRequest, type CreateAgentBlueprintRequest, type CreateAgentRequest, type CreateAgentScheduleExceptionRequest, type CreateAgentVersionRequest, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateBlueprintStageRequest, type CreateBlueprintStageTriggerRequest, type CreateCampaignPayload, type CreateEventSubscriptionRequest, type CreateInstructionRequest, type CreateWebhookRequest, type ErrorResponse, type EventSubscriptionDetail, type EventSubscriptionListResponse, type EventSubscriptionSummary, type ExecuteToolRequest, type ExecuteToolResponse, type ForkAgentFromTemplateRequest, HttpError, type Instruction, type InstructionCreatedResponse, type InstructionListResponse, type ListAgentBlueprintsOptions, type ListAgentScheduleExceptionsOptions, type ListAgentSchedulesOptions, type ListAgentStageTriggersOptions, type ListAgentStagesOptions, type ListAgentVersionInstructionsOptions, type ListAgentVersionsOptions, type ListAgentsOptions, type ListCampaignExecutionsOptions, type ListCampaignsOptions, type ListCatalogItemsOptions, type ListCatalogTemplatesOptions, type ListQueryOptions, type ListToolResourcesOptions, type ListToolsOptions, type ListVoicesOptions, type ListWebhooksOptions, type ListWorkspacePhonesOptions, type ListWorkspacesOptions, NetworkError, type PaginatedResult, type PaginationMeta, type PhoneAssignmentResponse, type PublishAgentVersionRequest, type QueryBuilderInput, type QueryBuilderSerializable, type QueryFilterOperators, type QueryFilters, type QueryOrGroups, type QueryValue, type RetryPolicy, TimeoutError, type ToolConnectionAuth, type ToolConnectionRequest, type ToolConnectionResponse, type ToolListResponse, type ToolResourceListResponse, type ToolResourceReloadResponse, type ToolResourceSummary, type ToolResourceUploadRequest, type ToolResourceUploadResponse, type ToolSummary, type UpdateAgentBlueprintRequest, type UpdateAgentRequest, type UpdateAgentScheduleExceptionRequest, type UpdateAgentScheduleRequest, type UpdateAgentVersionNotesRequest, type UpdateBlueprintStageRequest, type UpdateBlueprintStageTriggerRequest, type UpdateEventSubscriptionRequest, type UpdateInstructionRequest, type UpdateWebhookRequest, type VoiceListResponse, type VoiceSummary, type WebhookDetail, type WebhookListResponse, type WebhookSummary, type WorkspaceEnableRequest, type WorkspaceEnableResponse, type WorkspaceListResponse, type WorkspacePhone, type WorkspacePhoneChannel, type WorkspacePhonesResponse, type WorkspaceSummary, bindAgentBlueprints, bindAgentPhones, bindAgentSchedule, bindAgentScheduleExceptions, bindAgentSchedules, bindAgentStageTriggers, bindAgentStages, bindAgentTags, bindAgentVersions, createAgentBlueprintsApi, createAgentEntity, createAgentPhonesApi, createAgentScheduleApi, createAgentScheduleExceptionsApi, createAgentStageTriggersApi, createAgentStagesApi, createAgentTagsApi, createAgentVersionsApi, createAgentsApi, createApiKeysApi, createCampaignsApi, createCatalogTemplatesApi, createCatalogsApi, createClient, createHttp, createToolsApi, createVoicesApi, createWebhooksApi, createWorkspacesApi };
2113
+ export { type AgentBlueprint, type AgentBlueprintListItem, type AgentBlueprintListResponse, type AgentBlueprintsApi$1 as AgentBlueprintsApi, type AgentDetail, type AgentEntity, type AgentEntityFactoryOptions, type AgentListResponse, type AgentSchedule, type AgentScheduleApi, type AgentScheduleException, type AgentScheduleExceptionListResponse, type AgentScheduleListResponse, type AgentStageTriggersApi$1 as AgentStageTriggersApi, type AgentStagesApi$1 as AgentStagesApi, type AgentSummary, type AgentTagRequest, type AgentTagsResponse, type AgentVersionDetail, type AgentVersionListResponse, type AgentVersionSummary, type AgentsApi, type AgentsApiWithEntities, type ApiKeyListResponse, type ApiKeySummary, type ApiKeysApi, type BlueprintStage, type BlueprintStageListResponse, type BlueprintStageReorderRequest, type BlueprintStageTrigger, type BlueprintStageTriggerListResponse, type Campaign, type CampaignExecution, type CampaignExecutionListResponse, type CampaignListResponse, type CampaignStatus, type CatalogItemCreateRequest, type CatalogItemDetail, type CatalogItemLinks, type CatalogItemListResponse, type CatalogItemSummary, type CatalogTemplateDetail, type CatalogTemplateListResponse, type CatalogTemplateSummary, type CatalogTemplateVisibility, type ClientConfig, type ConnectPhoneRequest, type CreateAgentBlueprintRequest, type CreateAgentRequest, type CreateAgentScheduleExceptionRequest, type CreateAgentVersionRequest, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateBlueprintStageRequest, type CreateBlueprintStageTriggerRequest, type CreateCampaignPayload, type CreateEventSubscriptionRequest, type CreateInstructionRequest, type CreateToolConnectionRequest, type CreateWebhookRequest, type ErrorResponse, type EventSubscriptionDetail, type EventSubscriptionListResponse, type EventSubscriptionSummary, type ExecuteToolConnectionRequest, type ExecuteToolRequest, type ExecuteToolResponse, type ForkAgentFromTemplateRequest, HttpError, type Instruction, type InstructionCreatedResponse, type InstructionListResponse, type ListAgentBlueprintsOptions, type ListAgentScheduleExceptionsOptions, type ListAgentSchedulesOptions, type ListAgentStageTriggersOptions, type ListAgentStagesOptions, type ListAgentVersionInstructionsOptions, type ListAgentVersionsOptions, type ListAgentsOptions, type ListCampaignExecutionsOptions, type ListCampaignsOptions, type ListCatalogItemsOptions, type ListCatalogTemplatesOptions, type ListQueryOptions, type ListToolConnectionsOptions, type ListToolResourcesOptions, type ListToolsOptions, type ListVoicesOptions, type ListWebhooksOptions, type ListWorkspacePhonesOptions, type ListWorkspacesOptions, NetworkError, type PaginatedResult, type PaginationMeta, type PhoneAssignmentResponse, type PublishAgentVersionRequest, type QueryBuilderInput, type QueryBuilderSerializable, type QueryFilterOperators, type QueryFilters, type QueryOrGroups, type QueryValue, type RetryPolicy, TimeoutError, type ToolConnectionAuth, type ToolConnectionListItem, type ToolConnectionListResponse, type ToolConnectionRequest, type ToolConnectionResponse, type ToolListResponse, type ToolResourceListResponse, type ToolResourceReloadResponse, type ToolResourceSummary, type ToolResourceUploadRequest, type ToolResourceUploadResponse, type ToolSummary, type UpdateAgentBlueprintRequest, type UpdateAgentRequest, type UpdateAgentScheduleExceptionRequest, type UpdateAgentScheduleRequest, type UpdateAgentVersionNotesRequest, type UpdateBlueprintStageRequest, type UpdateBlueprintStageTriggerRequest, type UpdateEventSubscriptionRequest, type UpdateInstructionRequest, type UpdateWebhookRequest, type VoiceListResponse, type VoiceSummary, type WebhookDetail, type WebhookListResponse, type WebhookSummary, type WorkspaceEnableRequest, type WorkspaceEnableResponse, type WorkspaceListResponse, WorkspaceNotSelectedError, type WorkspacePhone, type WorkspacePhoneChannel, type WorkspacePhonesResponse, type WorkspaceSummary, bindAgentBlueprints, bindAgentPhones, bindAgentSchedule, bindAgentScheduleExceptions, bindAgentSchedules, bindAgentStageTriggers, bindAgentStages, bindAgentTags, bindAgentVersions, createAgentBlueprintsApi, createAgentEntity, createAgentPhonesApi, createAgentScheduleApi, createAgentScheduleExceptionsApi, createAgentStageTriggersApi, createAgentStagesApi, createAgentTagsApi, createAgentVersionsApi, createAgentsApi, createApiKeysApi, createCampaignsApi, createCatalogTemplatesApi, createCatalogsApi, createClient, createHttp, createToolsApi, createVoicesApi, createWebhooksApi, createWorkspacesApi };
package/dist/index.d.ts CHANGED
@@ -452,6 +452,7 @@ type components = {
452
452
  message?: string;
453
453
  };
454
454
  ToolConnectionRequest: {
455
+ connectionKey?: string;
455
456
  agentId: string;
456
457
  metadata?: {
457
458
  [key: string]: unknown;
@@ -459,7 +460,7 @@ type components = {
459
460
  auth?: components['schemas']['ToolConnectionAuth'];
460
461
  };
461
462
  ToolConnectionResponse: {
462
- status: 'connected' | 'pending' | 'error';
463
+ status: 'connected' | 'pending' | 'error' | 'revoked';
463
464
  toolAgentConnectionId?: string | null;
464
465
  toolId: string;
465
466
  workspaceId: string;
@@ -472,7 +473,7 @@ type components = {
472
473
  };
473
474
  };
474
475
  ToolConnectionAuth: {
475
- type: 'none' | 'oauth2' | 'api_key';
476
+ type: 'none' | 'oauth2' | 'api_key' | 'custom';
476
477
  data?: {
477
478
  [key: string]: unknown;
478
479
  };
@@ -495,6 +496,7 @@ type components = {
495
496
  toolId: string;
496
497
  toolAgentConnectionId?: string | null;
497
498
  providerRef?: string | null;
499
+ toolExecutionId: string;
498
500
  message?: string | null;
499
501
  };
500
502
  CatalogItemLinks: {
@@ -723,6 +725,36 @@ type components = {
723
725
  [key: string]: components['schemas']['ToolConfigSchemaAction'];
724
726
  };
725
727
  };
728
+ ToolConnectionListItem: {
729
+ toolAgentConnectionId: string;
730
+ toolId: string;
731
+ workspaceId: string;
732
+ agentId: string;
733
+ connectionKey: string;
734
+ status: 'connected' | 'pending' | 'error' | 'revoked';
735
+ providerRef?: string | null;
736
+ descriptionUsage?: string | null;
737
+ usageExample?: string | null;
738
+ };
739
+ ToolConnectionListResponse: {
740
+ data: components['schemas']['ToolConnectionListItem'][];
741
+ meta: components['schemas']['PaginationMeta'];
742
+ };
743
+ CreateToolConnectionRequest: {
744
+ toolId: string;
745
+ agentId: string;
746
+ connectionKey?: string;
747
+ metadata?: {
748
+ [key: string]: unknown;
749
+ };
750
+ auth?: components['schemas']['ToolConnectionAuth'];
751
+ };
752
+ ExecuteToolConnectionRequest: {
753
+ action: string;
754
+ args?: {
755
+ [key: string]: unknown;
756
+ };
757
+ };
726
758
  CatalogItemLanguageMetadata: {
727
759
  code: string;
728
760
  locale?: string | null;
@@ -780,6 +812,7 @@ type components = {
780
812
  ApiKeyId: string;
781
813
  XCacheRefresh?: boolean;
782
814
  IdempotencyKey: string;
815
+ XApiKey?: string;
783
816
  };
784
817
  requestBodies: never;
785
818
  headers: never;
@@ -1034,8 +1067,12 @@ type ToolResourceUploadRequest = components['schemas']['ToolResourceUploadReques
1034
1067
  type ToolResourceUploadResponse = components['schemas']['ToolResourceUploadResponse'];
1035
1068
  type ToolResourceReloadResponse = components['schemas']['ToolResourceReloadResponse'];
1036
1069
  type ToolConnectionAuth = components['schemas']['ToolConnectionAuth'];
1070
+ type CreateToolConnectionRequest = components['schemas']['CreateToolConnectionRequest'];
1037
1071
  type ToolConnectionRequest = components['schemas']['ToolConnectionRequest'];
1038
1072
  type ToolConnectionResponse = components['schemas']['ToolConnectionResponse'];
1073
+ type ToolConnectionListItem = components['schemas']['ToolConnectionListItem'];
1074
+ type ToolConnectionListResponse = components['schemas']['ToolConnectionListResponse'];
1075
+ type ExecuteToolConnectionRequest = components['schemas']['ExecuteToolConnectionRequest'];
1039
1076
  type ErrorResponse = components['schemas']['ErrorResponse'];
1040
1077
  type CampaignStatus = components['schemas']['CampaignStatus'];
1041
1078
  type Campaign = components['schemas']['Campaign'];
@@ -1070,6 +1107,9 @@ declare class NetworkError extends Error {
1070
1107
  url?: string;
1071
1108
  constructor(cause?: unknown, url?: string);
1072
1109
  }
1110
+ declare class WorkspaceNotSelectedError extends Error {
1111
+ constructor();
1112
+ }
1073
1113
  type RetryPolicy = {
1074
1114
  maxRetries?: number;
1075
1115
  baseDelayMs?: number;
@@ -1662,19 +1702,31 @@ type ListToolsOptions = ListQueryOptions & {
1662
1702
  type ListToolResourcesOptions = Pick<ListQueryOptions, 'page' | 'limit'> & {
1663
1703
  type?: 'document' | 'media' | 'file';
1664
1704
  };
1705
+ type ListToolConnectionsOptions = ListQueryOptions;
1665
1706
  type UploadToolResourcePayload = FormData | (Omit<ToolResourceUploadRequest, 'file'> & {
1666
1707
  file: unknown;
1667
1708
  });
1668
1709
  declare function createToolsApi(cfg: ClientConfig & {
1669
1710
  retry?: RetryPolicy;
1670
1711
  }): {
1712
+ connections: {
1713
+ readonly connect: (toolId: string, payload: ToolConnectionRequest, options?: IdempotentRequestOptions) => Promise<ToolConnectionResponse>;
1714
+ readonly create: (payload: CreateToolConnectionRequest, options?: IdempotentRequestOptions) => Promise<ToolConnectionResponse>;
1715
+ readonly execute: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: IdempotentRequestOptions) => Promise<ExecuteToolResponse>;
1716
+ readonly list: (options?: ListToolConnectionsOptions) => Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
1717
+ readonly createConnection: (payload: CreateToolConnectionRequest, options?: IdempotentRequestOptions) => Promise<ToolConnectionResponse>;
1718
+ readonly executeConnection: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: IdempotentRequestOptions) => Promise<ExecuteToolResponse>;
1719
+ };
1671
1720
  list(options?: ListToolsOptions): Promise<PaginatedResult<ToolListResponse, ListToolsOptions>>;
1672
1721
  listResources(toolId: string, options?: ListToolResourcesOptions): Promise<PaginatedResult<ToolResourceListResponse, ListToolResourcesOptions>>;
1722
+ listConnections(options?: ListToolConnectionsOptions): Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
1673
1723
  uploadResource(toolId: string, payload: UploadToolResourcePayload): Promise<ToolResourceUploadResponse>;
1674
1724
  deleteResource(toolId: string, resourceId: string): Promise<void>;
1675
1725
  reloadResource(toolId: string, resourceId: string): Promise<ToolResourceReloadResponse>;
1676
1726
  execute(toolId: string, payload: ExecuteToolRequest, options?: IdempotentRequestOptions): Promise<ExecuteToolResponse>;
1677
1727
  connect(toolId: string, payload: ToolConnectionRequest, options?: IdempotentRequestOptions): Promise<ToolConnectionResponse>;
1728
+ createConnection(payload: CreateToolConnectionRequest, options?: IdempotentRequestOptions): Promise<ToolConnectionResponse>;
1729
+ executeConnection(toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: IdempotentRequestOptions): Promise<ExecuteToolResponse>;
1678
1730
  };
1679
1731
 
1680
1732
  type ListVoicesOptions = ListQueryOptions & {
@@ -1816,8 +1868,27 @@ declare function createClient(initialCfg: ClientConfig & {
1816
1868
  enable(workspaceId: string, payload: WorkspaceEnableRequest): Promise<WorkspaceEnableResponse>;
1817
1869
  };
1818
1870
  tools: {
1871
+ connections: {
1872
+ readonly connect: (toolId: string, payload: ToolConnectionRequest, options?: {
1873
+ idempotencyKey?: string;
1874
+ }) => Promise<ToolConnectionResponse>;
1875
+ readonly create: (payload: CreateToolConnectionRequest, options?: {
1876
+ idempotencyKey?: string;
1877
+ }) => Promise<ToolConnectionResponse>;
1878
+ readonly execute: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
1879
+ idempotencyKey?: string;
1880
+ }) => Promise<ExecuteToolResponse>;
1881
+ readonly list: (options?: ListToolConnectionsOptions) => Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
1882
+ readonly createConnection: (payload: CreateToolConnectionRequest, options?: {
1883
+ idempotencyKey?: string;
1884
+ }) => Promise<ToolConnectionResponse>;
1885
+ readonly executeConnection: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
1886
+ idempotencyKey?: string;
1887
+ }) => Promise<ExecuteToolResponse>;
1888
+ };
1819
1889
  list(options?: ListToolsOptions): Promise<PaginatedResult<ToolListResponse, ListToolsOptions>>;
1820
1890
  listResources(toolId: string, options?: ListToolResourcesOptions): Promise<PaginatedResult<ToolResourceListResponse, ListToolResourcesOptions>>;
1891
+ listConnections(options?: ListToolConnectionsOptions): Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
1821
1892
  uploadResource(toolId: string, payload: FormData | (Omit<{
1822
1893
  file: string;
1823
1894
  type?: "document" | "media" | "file";
@@ -1836,6 +1907,12 @@ declare function createClient(initialCfg: ClientConfig & {
1836
1907
  connect(toolId: string, payload: ToolConnectionRequest, options?: {
1837
1908
  idempotencyKey?: string;
1838
1909
  }): Promise<ToolConnectionResponse>;
1910
+ createConnection(payload: CreateToolConnectionRequest, options?: {
1911
+ idempotencyKey?: string;
1912
+ }): Promise<ToolConnectionResponse>;
1913
+ executeConnection(toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
1914
+ idempotencyKey?: string;
1915
+ }): Promise<ExecuteToolResponse>;
1839
1916
  };
1840
1917
  catalogs: {
1841
1918
  templates: {
@@ -1930,8 +2007,27 @@ declare function createClient(initialCfg: ClientConfig & {
1930
2007
  enable(workspaceId: string, payload: WorkspaceEnableRequest): Promise<WorkspaceEnableResponse>;
1931
2008
  };
1932
2009
  tools: {
2010
+ connections: {
2011
+ readonly connect: (toolId: string, payload: ToolConnectionRequest, options?: {
2012
+ idempotencyKey?: string;
2013
+ }) => Promise<ToolConnectionResponse>;
2014
+ readonly create: (payload: CreateToolConnectionRequest, options?: {
2015
+ idempotencyKey?: string;
2016
+ }) => Promise<ToolConnectionResponse>;
2017
+ readonly execute: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
2018
+ idempotencyKey?: string;
2019
+ }) => Promise<ExecuteToolResponse>;
2020
+ readonly list: (options?: ListToolConnectionsOptions) => Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
2021
+ readonly createConnection: (payload: CreateToolConnectionRequest, options?: {
2022
+ idempotencyKey?: string;
2023
+ }) => Promise<ToolConnectionResponse>;
2024
+ readonly executeConnection: (toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
2025
+ idempotencyKey?: string;
2026
+ }) => Promise<ExecuteToolResponse>;
2027
+ };
1933
2028
  list(options?: ListToolsOptions): Promise<PaginatedResult<ToolListResponse, ListToolsOptions>>;
1934
2029
  listResources(toolId: string, options?: ListToolResourcesOptions): Promise<PaginatedResult<ToolResourceListResponse, ListToolResourcesOptions>>;
2030
+ listConnections(options?: ListToolConnectionsOptions): Promise<PaginatedResult<ToolConnectionListResponse, ListToolConnectionsOptions>>;
1935
2031
  uploadResource(toolId: string, payload: FormData | (Omit<{
1936
2032
  file: string;
1937
2033
  type?: "document" | "media" | "file";
@@ -1950,6 +2046,12 @@ declare function createClient(initialCfg: ClientConfig & {
1950
2046
  connect(toolId: string, payload: ToolConnectionRequest, options?: {
1951
2047
  idempotencyKey?: string;
1952
2048
  }): Promise<ToolConnectionResponse>;
2049
+ createConnection(payload: CreateToolConnectionRequest, options?: {
2050
+ idempotencyKey?: string;
2051
+ }): Promise<ToolConnectionResponse>;
2052
+ executeConnection(toolAgentConnectionId: string, payload: ExecuteToolConnectionRequest, options?: {
2053
+ idempotencyKey?: string;
2054
+ }): Promise<ExecuteToolResponse>;
1953
2055
  };
1954
2056
  catalogs: {
1955
2057
  templates: {
@@ -2008,4 +2110,4 @@ declare function createHttp(cfg: ClientConfig & {
2008
2110
  resolveAccessToken: () => string;
2009
2111
  };
2010
2112
 
2011
- export { type AgentBlueprint, type AgentBlueprintListItem, type AgentBlueprintListResponse, type AgentBlueprintsApi$1 as AgentBlueprintsApi, type AgentDetail, type AgentEntity, type AgentEntityFactoryOptions, type AgentListResponse, type AgentSchedule, type AgentScheduleApi, type AgentScheduleException, type AgentScheduleExceptionListResponse, type AgentScheduleListResponse, type AgentStageTriggersApi$1 as AgentStageTriggersApi, type AgentStagesApi$1 as AgentStagesApi, type AgentSummary, type AgentTagRequest, type AgentTagsResponse, type AgentVersionDetail, type AgentVersionListResponse, type AgentVersionSummary, type AgentsApi, type AgentsApiWithEntities, type ApiKeyListResponse, type ApiKeySummary, type ApiKeysApi, type BlueprintStage, type BlueprintStageListResponse, type BlueprintStageReorderRequest, type BlueprintStageTrigger, type BlueprintStageTriggerListResponse, type Campaign, type CampaignExecution, type CampaignExecutionListResponse, type CampaignListResponse, type CampaignStatus, type CatalogItemCreateRequest, type CatalogItemDetail, type CatalogItemLinks, type CatalogItemListResponse, type CatalogItemSummary, type CatalogTemplateDetail, type CatalogTemplateListResponse, type CatalogTemplateSummary, type CatalogTemplateVisibility, type ClientConfig, type ConnectPhoneRequest, type CreateAgentBlueprintRequest, type CreateAgentRequest, type CreateAgentScheduleExceptionRequest, type CreateAgentVersionRequest, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateBlueprintStageRequest, type CreateBlueprintStageTriggerRequest, type CreateCampaignPayload, type CreateEventSubscriptionRequest, type CreateInstructionRequest, type CreateWebhookRequest, type ErrorResponse, type EventSubscriptionDetail, type EventSubscriptionListResponse, type EventSubscriptionSummary, type ExecuteToolRequest, type ExecuteToolResponse, type ForkAgentFromTemplateRequest, HttpError, type Instruction, type InstructionCreatedResponse, type InstructionListResponse, type ListAgentBlueprintsOptions, type ListAgentScheduleExceptionsOptions, type ListAgentSchedulesOptions, type ListAgentStageTriggersOptions, type ListAgentStagesOptions, type ListAgentVersionInstructionsOptions, type ListAgentVersionsOptions, type ListAgentsOptions, type ListCampaignExecutionsOptions, type ListCampaignsOptions, type ListCatalogItemsOptions, type ListCatalogTemplatesOptions, type ListQueryOptions, type ListToolResourcesOptions, type ListToolsOptions, type ListVoicesOptions, type ListWebhooksOptions, type ListWorkspacePhonesOptions, type ListWorkspacesOptions, NetworkError, type PaginatedResult, type PaginationMeta, type PhoneAssignmentResponse, type PublishAgentVersionRequest, type QueryBuilderInput, type QueryBuilderSerializable, type QueryFilterOperators, type QueryFilters, type QueryOrGroups, type QueryValue, type RetryPolicy, TimeoutError, type ToolConnectionAuth, type ToolConnectionRequest, type ToolConnectionResponse, type ToolListResponse, type ToolResourceListResponse, type ToolResourceReloadResponse, type ToolResourceSummary, type ToolResourceUploadRequest, type ToolResourceUploadResponse, type ToolSummary, type UpdateAgentBlueprintRequest, type UpdateAgentRequest, type UpdateAgentScheduleExceptionRequest, type UpdateAgentScheduleRequest, type UpdateAgentVersionNotesRequest, type UpdateBlueprintStageRequest, type UpdateBlueprintStageTriggerRequest, type UpdateEventSubscriptionRequest, type UpdateInstructionRequest, type UpdateWebhookRequest, type VoiceListResponse, type VoiceSummary, type WebhookDetail, type WebhookListResponse, type WebhookSummary, type WorkspaceEnableRequest, type WorkspaceEnableResponse, type WorkspaceListResponse, type WorkspacePhone, type WorkspacePhoneChannel, type WorkspacePhonesResponse, type WorkspaceSummary, bindAgentBlueprints, bindAgentPhones, bindAgentSchedule, bindAgentScheduleExceptions, bindAgentSchedules, bindAgentStageTriggers, bindAgentStages, bindAgentTags, bindAgentVersions, createAgentBlueprintsApi, createAgentEntity, createAgentPhonesApi, createAgentScheduleApi, createAgentScheduleExceptionsApi, createAgentStageTriggersApi, createAgentStagesApi, createAgentTagsApi, createAgentVersionsApi, createAgentsApi, createApiKeysApi, createCampaignsApi, createCatalogTemplatesApi, createCatalogsApi, createClient, createHttp, createToolsApi, createVoicesApi, createWebhooksApi, createWorkspacesApi };
2113
+ export { type AgentBlueprint, type AgentBlueprintListItem, type AgentBlueprintListResponse, type AgentBlueprintsApi$1 as AgentBlueprintsApi, type AgentDetail, type AgentEntity, type AgentEntityFactoryOptions, type AgentListResponse, type AgentSchedule, type AgentScheduleApi, type AgentScheduleException, type AgentScheduleExceptionListResponse, type AgentScheduleListResponse, type AgentStageTriggersApi$1 as AgentStageTriggersApi, type AgentStagesApi$1 as AgentStagesApi, type AgentSummary, type AgentTagRequest, type AgentTagsResponse, type AgentVersionDetail, type AgentVersionListResponse, type AgentVersionSummary, type AgentsApi, type AgentsApiWithEntities, type ApiKeyListResponse, type ApiKeySummary, type ApiKeysApi, type BlueprintStage, type BlueprintStageListResponse, type BlueprintStageReorderRequest, type BlueprintStageTrigger, type BlueprintStageTriggerListResponse, type Campaign, type CampaignExecution, type CampaignExecutionListResponse, type CampaignListResponse, type CampaignStatus, type CatalogItemCreateRequest, type CatalogItemDetail, type CatalogItemLinks, type CatalogItemListResponse, type CatalogItemSummary, type CatalogTemplateDetail, type CatalogTemplateListResponse, type CatalogTemplateSummary, type CatalogTemplateVisibility, type ClientConfig, type ConnectPhoneRequest, type CreateAgentBlueprintRequest, type CreateAgentRequest, type CreateAgentScheduleExceptionRequest, type CreateAgentVersionRequest, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateBlueprintStageRequest, type CreateBlueprintStageTriggerRequest, type CreateCampaignPayload, type CreateEventSubscriptionRequest, type CreateInstructionRequest, type CreateToolConnectionRequest, type CreateWebhookRequest, type ErrorResponse, type EventSubscriptionDetail, type EventSubscriptionListResponse, type EventSubscriptionSummary, type ExecuteToolConnectionRequest, type ExecuteToolRequest, type ExecuteToolResponse, type ForkAgentFromTemplateRequest, HttpError, type Instruction, type InstructionCreatedResponse, type InstructionListResponse, type ListAgentBlueprintsOptions, type ListAgentScheduleExceptionsOptions, type ListAgentSchedulesOptions, type ListAgentStageTriggersOptions, type ListAgentStagesOptions, type ListAgentVersionInstructionsOptions, type ListAgentVersionsOptions, type ListAgentsOptions, type ListCampaignExecutionsOptions, type ListCampaignsOptions, type ListCatalogItemsOptions, type ListCatalogTemplatesOptions, type ListQueryOptions, type ListToolConnectionsOptions, type ListToolResourcesOptions, type ListToolsOptions, type ListVoicesOptions, type ListWebhooksOptions, type ListWorkspacePhonesOptions, type ListWorkspacesOptions, NetworkError, type PaginatedResult, type PaginationMeta, type PhoneAssignmentResponse, type PublishAgentVersionRequest, type QueryBuilderInput, type QueryBuilderSerializable, type QueryFilterOperators, type QueryFilters, type QueryOrGroups, type QueryValue, type RetryPolicy, TimeoutError, type ToolConnectionAuth, type ToolConnectionListItem, type ToolConnectionListResponse, type ToolConnectionRequest, type ToolConnectionResponse, type ToolListResponse, type ToolResourceListResponse, type ToolResourceReloadResponse, type ToolResourceSummary, type ToolResourceUploadRequest, type ToolResourceUploadResponse, type ToolSummary, type UpdateAgentBlueprintRequest, type UpdateAgentRequest, type UpdateAgentScheduleExceptionRequest, type UpdateAgentScheduleRequest, type UpdateAgentVersionNotesRequest, type UpdateBlueprintStageRequest, type UpdateBlueprintStageTriggerRequest, type UpdateEventSubscriptionRequest, type UpdateInstructionRequest, type UpdateWebhookRequest, type VoiceListResponse, type VoiceSummary, type WebhookDetail, type WebhookListResponse, type WebhookSummary, type WorkspaceEnableRequest, type WorkspaceEnableResponse, type WorkspaceListResponse, WorkspaceNotSelectedError, type WorkspacePhone, type WorkspacePhoneChannel, type WorkspacePhonesResponse, type WorkspaceSummary, bindAgentBlueprints, bindAgentPhones, bindAgentSchedule, bindAgentScheduleExceptions, bindAgentSchedules, bindAgentStageTriggers, bindAgentStages, bindAgentTags, bindAgentVersions, createAgentBlueprintsApi, createAgentEntity, createAgentPhonesApi, createAgentScheduleApi, createAgentScheduleExceptionsApi, createAgentStageTriggersApi, createAgentStagesApi, createAgentTagsApi, createAgentVersionsApi, createAgentsApi, createApiKeysApi, createCampaignsApi, createCatalogTemplatesApi, createCatalogsApi, createClient, createHttp, createToolsApi, createVoicesApi, createWebhooksApi, createWorkspacesApi };
package/dist/index.js CHANGED
@@ -25,6 +25,12 @@ var NetworkError = class extends Error {
25
25
  this.name = "NetworkError";
26
26
  }
27
27
  };
28
+ var WorkspaceNotSelectedError = class extends Error {
29
+ constructor() {
30
+ super("Workspace is not selected");
31
+ this.name = "WorkspaceNotSelectedError";
32
+ }
33
+ };
28
34
 
29
35
  // src/http.ts
30
36
  function toQueryString(query) {
@@ -1088,9 +1094,21 @@ var createAgentEntity = (dto, options) => {
1088
1094
 
1089
1095
  // src/api/agents.ts
1090
1096
  function createAgentsApi(cfg, relatedApis) {
1091
- const { base, doFetch } = createHttp(cfg);
1097
+ const { base, doFetch, resolveWorkspaceId, resolveApiKey } = createHttp(cfg);
1098
+ const requireWorkspace = () => {
1099
+ const workspaceId = resolveWorkspaceId();
1100
+ if (typeof workspaceId === "string" && workspaceId.trim().length > 0) {
1101
+ return;
1102
+ }
1103
+ const apiKey = resolveApiKey();
1104
+ if (typeof apiKey === "string" && apiKey.trim().length > 0) {
1105
+ return;
1106
+ }
1107
+ throw new WorkspaceNotSelectedError();
1108
+ };
1092
1109
  const jsonHeaders = { "content-type": "application/json" };
1093
1110
  const fetchAgentsPage = async (options = {}) => {
1111
+ requireWorkspace();
1094
1112
  const sanitizedOptions = {
1095
1113
  page: options.page,
1096
1114
  limit: options.limit,
@@ -1109,12 +1127,14 @@ function createAgentsApi(cfg, relatedApis) {
1109
1127
  return attachPaginator(response, fetchAgentsPage, normalizedOptions);
1110
1128
  };
1111
1129
  const getAgentDetail = async (agentId) => {
1130
+ requireWorkspace();
1112
1131
  const res = await doFetch(`${base}/agents/${agentId}`, {
1113
1132
  method: "GET"
1114
1133
  });
1115
1134
  return res.json();
1116
1135
  };
1117
1136
  const createAgent = async (payload) => {
1137
+ requireWorkspace();
1118
1138
  const res = await doFetch(`${base}/agents`, {
1119
1139
  method: "POST",
1120
1140
  body: JSON.stringify(payload),
@@ -1123,6 +1143,7 @@ function createAgentsApi(cfg, relatedApis) {
1123
1143
  return res.json();
1124
1144
  };
1125
1145
  const forkAgentFromTemplate = async (payload) => {
1146
+ requireWorkspace();
1126
1147
  const res = await doFetch(`${base}/agents/from-template`, {
1127
1148
  method: "POST",
1128
1149
  body: JSON.stringify(payload),
@@ -1131,6 +1152,7 @@ function createAgentsApi(cfg, relatedApis) {
1131
1152
  return res.json();
1132
1153
  };
1133
1154
  const updateAgent = async (agentId, payload) => {
1155
+ requireWorkspace();
1134
1156
  const res = await doFetch(`${base}/agents/${agentId}`, {
1135
1157
  method: "PATCH",
1136
1158
  body: JSON.stringify(payload),
@@ -1142,6 +1164,7 @@ function createAgentsApi(cfg, relatedApis) {
1142
1164
  return typeof agent === "string" ? agent : agent.agentId;
1143
1165
  };
1144
1166
  const deleteAgent = async (agent) => {
1167
+ requireWorkspace();
1145
1168
  const agentId = resolveAgentId(agent);
1146
1169
  await doFetch(`${base}/agents/${agentId}`, {
1147
1170
  method: "DELETE"
@@ -1464,7 +1487,15 @@ function createToolsApi(cfg) {
1464
1487
  });
1465
1488
  return res.json();
1466
1489
  };
1467
- return {
1490
+ const fetchToolConnectionsPage = async (options = {}) => {
1491
+ const query = serializeListOptions(options ?? {});
1492
+ const res = await doFetch(`${base}/tools/connections`, {
1493
+ method: "GET",
1494
+ query
1495
+ });
1496
+ return res.json();
1497
+ };
1498
+ const api = {
1468
1499
  async list(options = {}) {
1469
1500
  const normalizedOptions = { ...options ?? {} };
1470
1501
  const response = await fetchToolsPage(normalizedOptions);
@@ -1478,6 +1509,17 @@ function createToolsApi(cfg) {
1478
1509
  const response = await fetchPage(normalizedOptions);
1479
1510
  return attachPaginator(response, fetchPage, normalizedOptions);
1480
1511
  },
1512
+ async listConnections(options = {}) {
1513
+ const normalizedOptions = {
1514
+ ...options ?? {}
1515
+ };
1516
+ const response = await fetchToolConnectionsPage(normalizedOptions);
1517
+ return attachPaginator(
1518
+ response,
1519
+ fetchToolConnectionsPage,
1520
+ normalizedOptions
1521
+ );
1522
+ },
1481
1523
  async uploadResource(toolId, payload) {
1482
1524
  const formData = toFormData(payload);
1483
1525
  const res = await doFetch(`${base}/tools/${toolId}/resources`, {
@@ -1523,8 +1565,47 @@ function createToolsApi(cfg) {
1523
1565
  body: JSON.stringify(payload)
1524
1566
  });
1525
1567
  return res.json();
1568
+ },
1569
+ async createConnection(payload, options = {}) {
1570
+ const idempotencyKey = generateIdempotencyKey(options.idempotencyKey);
1571
+ const res = await doFetch(`${base}/tools/connections`, {
1572
+ method: "POST",
1573
+ headers: {
1574
+ ...jsonHeaders,
1575
+ [IDEMPOTENCY_HEADER]: idempotencyKey
1576
+ },
1577
+ body: JSON.stringify(payload)
1578
+ });
1579
+ return res.json();
1580
+ },
1581
+ async executeConnection(toolAgentConnectionId, payload, options = {}) {
1582
+ const idempotencyKey = generateIdempotencyKey(options.idempotencyKey);
1583
+ const res = await doFetch(
1584
+ `${base}/tools/connections/${toolAgentConnectionId}/execute`,
1585
+ {
1586
+ method: "POST",
1587
+ headers: {
1588
+ ...jsonHeaders,
1589
+ [IDEMPOTENCY_HEADER]: idempotencyKey
1590
+ },
1591
+ body: JSON.stringify(payload)
1592
+ }
1593
+ );
1594
+ return res.json();
1526
1595
  }
1527
1596
  };
1597
+ const connections = {
1598
+ connect: api.connect,
1599
+ create: api.createConnection,
1600
+ execute: api.executeConnection,
1601
+ list: api.listConnections,
1602
+ createConnection: api.createConnection,
1603
+ executeConnection: api.executeConnection
1604
+ };
1605
+ return {
1606
+ ...api,
1607
+ connections
1608
+ };
1528
1609
  }
1529
1610
 
1530
1611
  // src/utils/catalog-voices.ts
@@ -2065,6 +2146,7 @@ export {
2065
2146
  HttpError,
2066
2147
  NetworkError,
2067
2148
  TimeoutError,
2149
+ WorkspaceNotSelectedError,
2068
2150
  bindAgentBlueprints,
2069
2151
  bindAgentPhones,
2070
2152
  bindAgentSchedule,