import { type AiTypes } from "@cargo-ai/types"; import type { JsonSchema } from "@cargo-ai/utils"; import { z } from "zod"; import type { ApiType, DateToString } from "../types.js"; export declare namespace Ai { type Agent = ApiType; type AgentIcon = ApiType; type AgentTrigger = ApiType; type AgentTriggerConnector = ApiType; type AgentTriggerCron = ApiType; type AgentTriggerNative = ApiType; type Template = ApiType; type TemplateCategory = ApiType; type TemplateKind = ApiType; type TemplateAgent = ApiType; type TemplateMcpServer = ApiType; type SuggestedAction = ApiType; type Release = ApiType; type McpServer = ApiType; type McpClient = ApiType; type McpClientAuthentication = ApiType; type Action = ApiType; type TemplateAction = ApiType; type Resource = ApiType; type ModelResource = ApiType; type FileResource = ApiType; type FileOrFolder = ApiType; type ModelResourceTemplate = ApiType; type FileResourceTemplate = ApiType; type ResourceTemplate = ApiType; type Capability = ApiType; type Chat = ApiType; type ChatTrigger = ApiType; type Message = ApiType; type Output = ApiType; type Heartbeat = ApiType; type Evaluator = ApiType; type HarnessSlug = ApiType; type Repository = ApiType; type Evaluation = ApiType; type EvaluatedTool = ApiType; type EvaluatedToolInvocationOutput = ApiType>; type MessageMetadata = ApiType; type Vote = ApiType; type Document = ApiType; type DocumentKind = ApiType; type DocumentSuggestion = ApiType; type Memory = ApiType; const agentConfig: { jsonSchema: JsonSchema; uiSchema: Record; flatJsonSchema: JsonSchema; }; namespace Api { type ListTemplatesPayload = { hasDocumentation?: boolean; isPreset?: boolean; kinds?: TemplateKind[]; }; type ListTemplatesResult = { templates: Template[]; }; type GetAgentResult = { agent: Agent; }; type CreateAgentPayload = DateToString<{ name: string; description?: string; icon: AiTypes.AgentIcon; triggers?: (Omit | AiTypes.AgentTriggerConnector | AiTypes.AgentTriggerNative)[]; folderUuid?: string; }>; type CreateAgentResult = { agent: Agent; }; const zodCreateAgentErrorReason: z.ZodEnum<{ folderNotFound: "folderNotFound"; }>; type AllAgentsResult = { agents: Agent[]; }; type UpdateAgentPayload = DateToString<{ uuid: string; name?: string; icon?: AiTypes.AgentIcon; description?: string | null; triggers?: (Omit | AiTypes.AgentTriggerConnector | AiTypes.AgentTriggerNative)[]; folderUuid?: string | null; template?: { isAvailable: boolean; scope: "public" | "private"; }; }>; const zodUpdateAgentErrorReason: z.ZodEnum<{ folderNotFound: "folderNotFound"; agentNotFound: "agentNotFound"; }>; type UpdateAgentResult = { agent: Agent; }; const zodRemoveAgentErrorReason: z.ZodEnum<{ agentNotFound: "agentNotFound"; }>; type GetReleaseResult = { release: Release; }; type ListReleasesPayload = DateToString<{ agentUuid?: string; userUuid?: string; statuses?: AiTypes.ReleaseStatus[]; limit?: number; offset?: number; }>; type ListReleasesResult = { releases: Release[]; }; type GetDraftReleasePayload = DateToString<{ agentUuid: string; }>; type GetDraftReleaseResult = { release: Release; }; type GetDeployedReleasePayload = DateToString<{ agentUuid: string; }>; type GetDeployedReleaseResult = { release: Release; }; const zodGetDeployedReleaseErrorReason: z.ZodEnum<{ releaseNotFound: "releaseNotFound"; }>; type UpdateDraftReleasePayload = DateToString<{ agentUuid: string; parentUuid?: string; actions?: AiTypes.Action[]; mcpClients?: AiTypes.McpClient[]; resources?: AiTypes.Resource[]; capabilities?: AiTypes.Capability[]; suggestedActions?: AiTypes.SuggestedAction[]; systemPrompt?: string; withReasoning?: boolean; temperature?: number; maxSteps?: number; integrationSlug?: string; connectorUuid?: string; languageModelSlug?: string; output?: AiTypes.Output | null; heartbeat?: AiTypes.Heartbeat | null; evaluator?: AiTypes.Evaluator | null; harnessSlug?: AiTypes.HarnessSlug | null; repository?: AiTypes.Repository | null; options?: { connectorUuidsByIntegrationSlug?: Record; modelUuidsByIntegrationSlug?: Record; }; }>; const zodUpdateDraftReleaseErrorReason: z.ZodEnum<{ agentNotFound: "agentNotFound"; draftReleaseNotFound: "draftReleaseNotFound"; invalidParent: "invalidParent"; invalidConnector: "invalidConnector"; failedToReconciliateAgentAiTools: "failedToReconciliateAgentAiTools"; }>; type UpdateDraftReleaseResult = { release: Release; }; type DeployDraftReleasePayload = DateToString<{ agentUuid: string; actions: AiTypes.Action[]; mcpClients: AiTypes.McpClient[]; resources: AiTypes.Resource[]; capabilities: AiTypes.Capability[]; suggestedActions: AiTypes.SuggestedAction[]; systemPrompt?: string; withReasoning?: boolean; temperature?: number; maxSteps?: number; integrationSlug?: string; connectorUuid?: string; languageModelSlug?: string; output?: AiTypes.Output | null; heartbeat?: AiTypes.Heartbeat | null; evaluator?: AiTypes.Evaluator | null; harnessSlug?: AiTypes.HarnessSlug | null; repository?: AiTypes.Repository | null; version?: string; description?: string; options?: { connectorUuidsByIntegrationSlug?: Record; modelUuidsByIntegrationSlug?: Record; }; }>; const zodDeployDraftReleaseErrorReason: z.ZodEnum<{ agentNotFound: "agentNotFound"; draftReleaseNotFound: "draftReleaseNotFound"; failedToReconciliateAgentAiTools: "failedToReconciliateAgentAiTools"; invalidReleaseVersion: "invalidReleaseVersion"; missingLanguageModel: "missingLanguageModel"; }>; type DeployDraftReleaseResult = { release: Release; }; type CreateChatPayload = DateToString<{ uuid?: string; name?: string; agentUuid?: string; releaseUuid?: string; trigger: AiTypes.ChatTrigger; heartbeat?: AiTypes.Heartbeat; evaluator?: AiTypes.Evaluator; harnessSlug?: AiTypes.HarnessSlug; repository?: AiTypes.Repository; }>; type CreateChatResult = { chat: Chat; }; type GetChatResult = { chat: Chat; }; const zodGetChatErrorReason: z.ZodEnum<{ chatNotFound: "chatNotFound"; }>; type UpdateChatPayload = DateToString<{ uuid: string; name?: string | null; }>; type UpdateChatResult = { chat: Chat; }; const zodUpdateChatErrorReason: z.ZodEnum<{ chatNotFound: "chatNotFound"; }>; type RemoveChatPayload = DateToString<{ uuid: string; }>; type RemoveChatResult = { outcome: "removed"; }; const zodRemoveChatErrorReason: z.ZodEnum<{ chatNotFound: "chatNotFound"; }>; type CloseChatResult = { chat: Chat; }; const zodCloseChatErrorReason: z.ZodEnum<{ chatNotFound: "chatNotFound"; }>; type ListChatsPayload = DateToString<{ agentUuid?: string; releaseUuid?: string; userUuid?: string; triggerType?: AiTypes.ChatTrigger["type"]; messageStatuses?: AiTypes.MessageStatus[]; name?: string; search?: string; createdAfter?: Date; createdBefore?: Date; limit?: number; offset?: number; }>; type ListChatsResult = { chats: Chat[]; }; type ListMessagesPayload = DateToString<{ chatUuid: string; limit?: number; offset?: number; }>; type ListMessagesResult = { messages: Message[]; }; type CreateMessagePayload = DateToString<{ chatUuid?: string; agentUuid?: string; releaseUuid?: string; parts: AiTypes.MessagePart[]; actions?: AiTypes.Action[]; resources?: AiTypes.Resource[]; capabilities?: AiTypes.Capability[]; mcpClients?: AiTypes.McpClient[]; systemPrompt?: string; withReasoning?: boolean; temperature?: number; maxSteps?: number; integrationSlug?: string; connectorUuid?: string; languageModelSlug?: string; output?: AiTypes.Output; harnessSlug?: AiTypes.HarnessSlug; repository?: AiTypes.Repository; }>; type CreateMessageResult = { userMessage: Message; assistantMessage: Message; }; const zodCreateMessageErrorReason: z.ZodEnum<{ chatNotFound: "chatNotFound"; lastMessageNotFinished: "lastMessageNotFinished"; chatClosed: "chatClosed"; }>; /** * What a client-run harness turn reports it spent. It states a cost, not a * credit count: credits are priced on the server, so a caller cannot set * its own bill. */ type IngestMessagesUsage = { costUsd?: number; totalTokens?: number; inputTokens?: number; outputTokens?: number; cacheReadTokens?: number; cacheWriteTokens?: number; reasoningTokens?: number; }; type IngestMessagesPayload = DateToString<{ chatUuid: string; agentUuid?: string; connectorUuid: string; integrationSlug: string; languageModelSlug: string; userParts: AiTypes.MessagePart[]; assistantParts: AiTypes.MessagePart[]; usage?: IngestMessagesUsage; cancelled?: boolean; turnOwnerId?: string; }>; type IngestMessagesResult = { userMessage: Message; assistantMessage: Message; }; const zodIngestMessagesErrorReason: z.ZodEnum<{ chatNotFound: "chatNotFound"; harnessNotFound: "harnessNotFound"; }>; type MintProxyTokenResult = { token: string; expiresInSeconds: number; connectorUuid: string; integrationSlug: string; languageModelSlug: string; }; const zodMintProxyTokenErrorReason: z.ZodEnum<{ chatNotFound: "chatNotFound"; lastMessageNotFinished: "lastMessageNotFinished"; harnessNotFound: "harnessNotFound"; notEnoughCredits: "notEnoughCredits"; connectorNotFound: "connectorNotFound"; languageModelNotFound: "languageModelNotFound"; }>; type ClaimChatTurnPayload = { ownerId: string; }; type ClaimChatTurnResult = { claimed: true; }; const zodClaimChatTurnErrorReason: z.ZodEnum<{ turnInFlight: "turnInFlight"; }>; type ReleaseChatTurnPayload = { ownerId: string; }; type ReleaseChatTurnResult = { released: true; }; type GetMessageResult = { message: Message; }; const zodGetMessageErrorReason: z.ZodEnum<{ messageNotFound: "messageNotFound"; }>; const zodRemoveMessageErrorReason: z.ZodEnum<{ messageNotFound: "messageNotFound"; messageNotUser: "messageNotUser"; }>; type CancelMessagesPayload = { uuids: string[]; }; type UpsertVotePayload = DateToString<{ chatUuid: string; messageUuid: string; isUpvoted: boolean; }>; type UpsertVoteResult = { vote: Vote; }; type ListVotesPayload = DateToString<{ chatUuid: string; }>; type ListVotesResult = { votes: Vote[]; }; type GetDocumentResult = { document: Document; }; type ListDocumentsPayload = DateToString<{ uuid: string; limit?: number; offset?: number; }>; type ListDocumentsResult = { documents: Document[]; }; type CreateDocumentPayload = DateToString<{ uuid: string; kind: AiTypes.DocumentKind; title: string; content: string; }>; type CreateDocumentResult = { document: Document; }; type ResetDocumentPayload = DateToString<{ uuid: string; createdAt: Date; }>; type ResetDocumentResult = { document: Document; }; type GetMcpServerResult = { mcpServer: McpServer; }; type CreateMcpServerPayload = DateToString<{ name: string; description?: string; actions: AiTypes.Action[]; resources: AiTypes.Resource[]; capabilities?: AiTypes.Capability[]; folderUuid?: string; }>; type CreateMcpServerResult = { mcpServer: McpServer; }; type AllMcpServersResult = { mcpServers: McpServer[]; }; type UpdateMcpServerPayload = DateToString<{ uuid: string; name?: string; description?: string | null; actions?: AiTypes.Action[]; resources?: AiTypes.Resource[]; capabilities?: AiTypes.Capability[]; folderUuid?: string | null; }>; const zodUpdateMcpServerErrorReason: z.ZodEnum<{ folderNotFound: "folderNotFound"; mcpServerNotFound: "mcpServerNotFound"; mcpServerIsReadOnly: "mcpServerIsReadOnly"; }>; type UpdateMcpServerResult = { mcpServer: McpServer; }; type ConnectMcpClientPayload = DateToString<{ mcpClient: AiTypes.McpClient; }>; type ConnectMcpClientResult = { tools: { slug: string; description?: string; config: { jsonSchema: JsonSchema; }; }[]; }; const zodRemoveMcpServerErrorReason: z.ZodEnum<{ mcpServerNotFound: "mcpServerNotFound"; mcpServerIsReadOnly: "mcpServerIsReadOnly"; }>; type OptimizePromptPayload = DateToString<{ prompt: string; }>; type OptimizePromptResult = { prompt: string; }; type EvaluatePromptPayload = DateToString<{ prompt: string; actions: AiTypes.Action[]; resources: AiTypes.Resource[]; capabilities: AiTypes.Capability[]; }>; type EvaluatePromptResult = { prompt?: string; errorMessage?: string; }; type GenerateJsonSchemaFromPromptPayload = DateToString<{ prompt: string; systemPrompt?: string; }>; type GenerateJsonSchemaFromPromptResult = { jsonSchema: Record; }; type ListMemoriesPayload = { scope: "user"; } | { scope: "agent"; agentUuid: string; }; type ListMemoriesResult = { memories: Memory[]; }; type RemoveMemoryPayload = DateToString<{ mem0Id: string; } & ({ scope: "user"; } | { scope: "agent"; agentUuid: string; })>; const zodRemoveMemoryErrorReason: z.ZodEnum<{ memoryNotFound: "memoryNotFound"; }>; type UpdateMemoryPayload = DateToString<{ mem0Id: string; content: string; } & ({ scope: "user"; } | { scope: "agent"; agentUuid: string; })>; const zodUpdateMemoryErrorReason: z.ZodEnum<{ memoryNotFound: "memoryNotFound"; }>; type GenerateSuggestedActionsPayload = DateToString<{ messageUuid?: string; systemPrompt?: string; contextPrompt?: string; agentUuid?: string; actions?: AiTypes.Action[]; resources?: AiTypes.Resource[]; capabilities?: AiTypes.Capability[]; cacheKey?: string; }>; type GenerateSuggestedActionsResult = { suggestedActions: AiTypes.SuggestedAction[]; }; type GetTemplatePayload = { slug: string; }; type GetTemplateResult = { template: Template; }; const zodGetTemplateErrorReason: z.ZodEnum<{ templateNotFound: "templateNotFound"; }>; } const templateKeys: { all: () => readonly ["templates"]; get: (slug: string) => readonly ["templates", string]; list: (payload: Api.ListTemplatesPayload) => readonly ["templates", Api.ListTemplatesPayload]; }; const mcpServerKeys: { all: (workspaceUuid: string) => readonly ["batches", string]; }; const agentKeys: { all: (workspaceUuid: string) => readonly ["agents", string]; }; const chatKeys: { all: (workspaceUuid: string) => readonly ["chats", string]; get: (workspaceUuid: string, uuid: string) => readonly ["chats", string, string]; list: (workspaceUuid: string, payload: Api.ListChatsPayload) => readonly ["chats", string, { agentUuid?: string | undefined; releaseUuid?: string | undefined; userUuid?: string | undefined; triggerType?: "draft" | "chat" | "connector" | "web_extension" | "app" | "cli" | "workflow" | "schedule" | "native" | undefined; messageStatuses?: AiTypes.MessageStatus[] | undefined; name?: string | undefined; search?: string | undefined; createdAfter?: string | undefined; createdBefore?: string | undefined; limit?: number | undefined; offset?: number | undefined; }]; }; const messageKeys: { all: (workspaceUuid: string) => readonly ["messages", string]; get: (workspaceUuid: string, uuid: string) => readonly ["messages", string, string]; list: (workspaceUuid: string, payload: Api.ListMessagesPayload) => readonly ["messages", string, { chatUuid: string; limit?: number | undefined; offset?: number | undefined; }]; }; const memoryKeys: { all: (workspaceUuid: string) => readonly ["memories", string]; list: (workspaceUuid: string, payload: Api.ListMemoriesPayload) => readonly ["memories", string, Api.ListMemoriesPayload]; }; const voteKeys: { all: (workspaceUuid: string) => readonly ["votes", string]; list: (workspaceUuid: string, payload: Api.ListVotesPayload) => readonly ["votes", string, { chatUuid: string; }]; }; const releaseKeys: { all: (workspaceUuid: string) => readonly ["releases", string]; get: (workspaceUuid: string, uuid: string) => readonly ["releases", string, string]; getDraft: (workspaceUuid: string, workflowUuid: string) => readonly ["releases", string, string]; list: (workspaceUuid: string, payload: Api.ListReleasesPayload) => readonly ["releases", string, { agentUuid?: string | undefined; userUuid?: string | undefined; statuses?: AiTypes.ReleaseStatus[] | undefined; limit?: number | undefined; offset?: number | undefined; }]; }; const documentKeys: { all: (workspaceUuid: string) => readonly ["documents", string]; get: (workspaceUuid: string, uuid: string) => readonly ["documents", string, string]; list: (workspaceUuid: string, payload: Api.ListDocumentsPayload) => readonly ["documents", string, { uuid: string; limit?: number | undefined; offset?: number | undefined; }]; }; } //# sourceMappingURL=ai.d.ts.map