@inkeep/agents-core 0.35.1 → 0.35.2

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 (43) hide show
  1. package/dist/auth/auth-schema.d.ts +1097 -0
  2. package/dist/auth/auth-schema.js +1 -0
  3. package/dist/auth/auth-validation-schemas.d.ts +1881 -0
  4. package/dist/auth/auth-validation-schemas.js +39 -0
  5. package/dist/auth/auth.d.ts +118 -0
  6. package/dist/auth/auth.js +95 -0
  7. package/dist/auth/permissions.d.ts +273 -0
  8. package/dist/auth/permissions.js +1 -0
  9. package/dist/chunk-4JZT4QEE.js +162 -0
  10. package/dist/chunk-F5WWOOIX.js +62 -0
  11. package/dist/{chunk-YZ5ZBVHJ.js → chunk-NFYCSHD3.js} +3 -81
  12. package/dist/chunk-NOPEANIU.js +82 -0
  13. package/dist/{chunk-J5AHY6M2.js → chunk-SPRTYWRV.js} +1 -1
  14. package/dist/{chunk-OP3KPT4T.js → chunk-TGESM3JG.js} +1 -160
  15. package/dist/{chunk-DYGTCLJO.js → chunk-VBCCPAZK.js} +1 -1
  16. package/dist/chunk-ZYSTJ4XY.js +948 -0
  17. package/dist/client-CPYOMZF2.d.ts +19 -0
  18. package/dist/client-exports.js +4 -3
  19. package/dist/db/schema.d.ts +2 -1
  20. package/dist/db/schema.js +2 -1
  21. package/dist/index.d.ts +9 -154
  22. package/dist/index.js +1565 -2498
  23. package/dist/{schema-BWd551GM.d.ts → schema-5N2lPWNV.d.ts} +2 -1095
  24. package/dist/validation/index.js +2 -2
  25. package/package.json +17 -1
  26. package/dist/auth-detection-CGqhPDnj.d.cts +0 -435
  27. package/dist/client-exports.cjs +0 -2833
  28. package/dist/client-exports.d.cts +0 -289
  29. package/dist/constants/models.cjs +0 -40
  30. package/dist/constants/models.d.cts +0 -42
  31. package/dist/db/schema.cjs +0 -1090
  32. package/dist/db/schema.d.cts +0 -7
  33. package/dist/index.cjs +0 -227898
  34. package/dist/index.d.cts +0 -4893
  35. package/dist/props-validation-BMR1qNiy.d.cts +0 -15
  36. package/dist/schema-D4WR42em.d.cts +0 -6352
  37. package/dist/types/index.cjs +0 -39
  38. package/dist/types/index.d.cts +0 -132
  39. package/dist/utility-DbltUp2Q.d.cts +0 -17079
  40. package/dist/utils/schema-conversion.cjs +0 -232
  41. package/dist/utils/schema-conversion.d.cts +0 -26
  42. package/dist/validation/index.cjs +0 -2930
  43. package/dist/validation/index.d.cts +0 -279
package/dist/index.d.cts DELETED
@@ -1,4893 +0,0 @@
1
- export { ANTHROPIC_MODELS, AnthropicModel, GOOGLE_MODELS, GoogleModel, ModelName, OPENAI_MODELS, OpenAIModel } from './constants/models.cjs';
2
- import { r as PinoLogger, s as getLogger } from './auth-detection-CGqhPDnj.cjs';
3
- export { i as ACTIVITY_NAMES, g as ACTIVITY_STATUS, f as ACTIVITY_TYPES, h as AGENT_IDS, p as AGGREGATE_OPERATORS, A as AI_OPERATIONS, j as AI_TOOL_TYPES, o as DATA_SOURCES, k as DATA_TYPES, D as DELEGATION_FROM_SUB_AGENT_ID, b as DELEGATION_ID, a as DELEGATION_TO_SUB_AGENT_ID, F as FIELD_TYPES, L as LoggerFactoryConfig, M as McpOAuthFlowResult, u as McpTokenExchangeResult, t as OAuthConfig, O as OPERATORS, m as ORDER_DIRECTIONS, P as PANEL_TYPES, x as PinoLoggerConfig, q as QUERY_DEFAULTS, l as QUERY_EXPRESSIONS, Q as QUERY_FIELD_CONFIGS, n as QUERY_TYPES, R as REDUCE_OPERATIONS, e as SPAN_KEYS, S as SPAN_NAMES, T as TRANSFER_FROM_SUB_AGENT_ID, c as TRANSFER_TO_SUB_AGENT_ID, U as UNKNOWN_VALUE, d as detectAuthenticationRequired, w as exchangeMcpAuthorizationCode, v as initiateMcpOAuthFlow, y as loggerFactory } from './auth-detection-CGqhPDnj.cjs';
4
- import { z } from 'zod';
5
- import { r as CredentialReferenceApiInsert, s as ContextConfigSelect, l as ContextFetchDefinition, i as MCPTransportType, t as MCPToolConfig, u as ProjectScopeConfig, v as FullAgentDefinition, w as AgentScopeConfig, C as ConversationHistoryConfig, x as PaginationConfig, y as AgentInsert, z as AgentUpdate, B as AgentSelect, D as ApiKeySelect, E as ApiKeyInsert, G as ApiKeyUpdate, H as CreateApiKeyParams, I as ApiKeyCreateResult, J as ArtifactComponentSelect, K as ArtifactComponentInsert, L as ArtifactComponentUpdate, N as SubAgentScopeConfig, O as ContextCacheSelect, Q as ContextCacheInsert, R as ContextConfigInsert, U as ContextConfigUpdate, V as ConversationSelect, W as ConversationInsert, o as ConversationMetadata, X as ConversationUpdate, Y as CredentialReferenceSelect, Z as ToolSelect, _ as ExternalAgentSelect, $ as CredentialReferenceInsert, a0 as CredentialReferenceUpdate, a1 as DataComponentSelect, a2 as DataComponentInsert, a3 as DataComponentUpdate, a4 as ExternalAgentInsert, a5 as ExternalAgentUpdate, a6 as FunctionApiInsert, a7 as FunctionToolApiInsert, a8 as FunctionToolApiUpdate, a9 as Artifact, aa as LedgerArtifactSelect, q as MessageMetadata, p as MessageContent, ab as MessageVisibility, ac as MessageInsert, ad as MessageUpdate, ae as FullProjectDefinition, af as ProjectInfo, ag as ProjectSelect, ah as PaginationResult, ai as ProjectResourceCounts, aj as ProjectInsert, ak as ProjectUpdate, al as SubAgentExternalAgentRelationInsert, am as SubAgentRelationInsert, an as SubAgentRelationUpdate, ao as SubAgentToolRelationUpdate, m as ToolMcpConfig, n as ToolServerCapabilities, ap as SubAgentInsert, aq as SubAgentUpdate, ar as SubAgentSelect, as as SubAgentTeamAgentRelationInsert, at as TaskInsert, T as TaskMetadataConfig, au as TaskSelect, av as McpTool, aw as ToolInsert, ax as ToolUpdate, h as CredentialStoreType, ay as ExecutionContext } from './utility-DbltUp2Q.cjs';
6
- export { ba as A2AError, bG as A2ARequest, bH as A2AResponse, aL as APIKeySecurityScheme, bV as AgentApiInsert, e2 as AgentApiInsertSchema, bU as AgentApiSelect, e1 as AgentApiSelectSchema, bW as AgentApiUpdate, e3 as AgentApiUpdateSchema, aH as AgentCapabilities, aV as AgentCard, dx as AgentConversationHistoryConfig, d$ as AgentInsertSchema, gM as AgentListResponse, aI as AgentProvider, gw as AgentResponse, d_ as AgentSelectSchema, aJ as AgentSkill, e as AgentStopWhen, b as AgentStopWhenSchema, e0 as AgentUpdateSchema, h3 as AgentWithinContextOfProjectResponse, gg as AgentWithinContextOfProjectSchema, f6 as AllAgentSchema, cP as AllAgentSelect, cT as ApiKeyApiCreationResponse, fb as ApiKeyApiCreationResponseSchema, cR as ApiKeyApiInsert, fc as ApiKeyApiInsertSchema, cQ as ApiKeyApiSelect, fa as ApiKeyApiSelectSchema, cS as ApiKeyApiUpdate, A as ApiKeyApiUpdateSchema, f8 as ApiKeyInsertSchema, gQ as ApiKeyListResponse, gA as ApiKeyResponse, f7 as ApiKeySelectSchema, f9 as ApiKeyUpdateSchema, cE as ArtifactComponentApiInsert, eU as ArtifactComponentApiInsertSchema, cD as ArtifactComponentApiSelect, eT as ArtifactComponentApiSelectSchema, cF as ArtifactComponentApiUpdate, eV as ArtifactComponentApiUpdateSchema, hd as ArtifactComponentArrayResponse, eR as ArtifactComponentInsertSchema, gV as ArtifactComponentListResponse, gF as ArtifactComponentResponse, eQ as ArtifactComponentSelectSchema, eS as ArtifactComponentUpdateSchema, aO as AuthorizationCodeOAuthFlow, dg as CanDelegateToExternalAgent, df as CanUseItem, gc as CanUseItemSchema, bq as CancelTaskRequest, bB as CancelTaskResponse, bA as CancelTaskSuccessResponse, aP as ClientCredentialsOAuthFlow, h5 as ComponentAssociationListResponse, fo as ComponentAssociationSchema, b8 as ContentTypeNotSupportedError, cs as ContextCacheApiInsert, eB as ContextCacheApiInsertSchema, cr as ContextCacheApiSelect, eA as ContextCacheApiSelectSchema, ct as ContextCacheApiUpdate, eC as ContextCacheApiUpdateSchema, dy as ContextCacheEntry, ey as ContextCacheInsertSchema, ex as ContextCacheSelectSchema, cq as ContextCacheUpdate, ez as ContextCacheUpdateSchema, cm as ContextConfigApiInsert, fM as ContextConfigApiInsertSchema, cl as ContextConfigApiSelect, fL as ContextConfigApiSelectSchema, cn as ContextConfigApiUpdate, fN as ContextConfigApiUpdateSchema, fJ as ContextConfigInsertSchema, gP as ContextConfigListResponse, gz as ContextConfigResponse, fI as ContextConfigSelectSchema, fK as ContextConfigUpdateSchema, cf as ConversationApiInsert, ep as ConversationApiInsertSchema, ce as ConversationApiSelect, eo as ConversationApiSelectSchema, cg as ConversationApiUpdate, eq as ConversationApiUpdateSchema, em as ConversationInsertSchema, gY as ConversationListResponse, gI as ConversationResponse, dw as ConversationScopeOptions, el as ConversationSelectSchema, en as ConversationUpdateSchema, fl as CreateCredentialInStoreRequestSchema, fm as CreateCredentialInStoreResponseSchema, fh as CredentialReferenceApiInsertSchema, cU as CredentialReferenceApiSelect, fg as CredentialReferenceApiSelectSchema, cV as CredentialReferenceApiUpdate, fi as CredentialReferenceApiUpdateSchema, fe as CredentialReferenceInsertSchema, gR as CredentialReferenceListResponse, gB as CredentialReferenceResponse, fd as CredentialReferenceSelectSchema, ff as CredentialReferenceUpdateSchema, fk as CredentialStoreListResponseSchema, fj as CredentialStoreSchema, cv as DataComponentApiInsert, eI as DataComponentApiInsertSchema, cu as DataComponentApiSelect, eH as DataComponentApiSelectSchema, cw as DataComponentApiUpdate, eJ as DataComponentApiUpdateSchema, hc as DataComponentArrayResponse, eF as DataComponentBaseSchema, eE as DataComponentInsertSchema, gU as DataComponentListResponse, gE as DataComponentResponse, eD as DataComponentSelectSchema, eG as DataComponentUpdateSchema, aF as DataPart, gk as ErrorResponseSchema, gl as ExistsResponseSchema, cN as ExternalAgentApiInsert, f4 as ExternalAgentApiInsertSchema, cM as ExternalAgentApiSelect, f3 as ExternalAgentApiSelectSchema, cO as ExternalAgentApiUpdate, f5 as ExternalAgentApiUpdateSchema, f1 as ExternalAgentInsertSchema, gO as ExternalAgentListResponse, gy as ExternalAgentResponse, f0 as ExternalAgentSelectSchema, f2 as ExternalAgentUpdateSchema, bT as ExternalSubAgentRelationApiInsert, dZ as ExternalSubAgentRelationApiInsertSchema, bS as ExternalSubAgentRelationInsert, dY as ExternalSubAgentRelationInsertSchema, cp as FetchConfig, fG as FetchConfigSchema, co as FetchDefinition, fH as FetchDefinitionSchema, aB as FileBase, aE as FilePart, aC as FileWithBytes, aD as FileWithUri, de as FullAgentAgentInsert, a as FullAgentAgentInsertSchema, h2 as FullProjectDefinitionResponse, gt as FullProjectDefinitionSchema, F as FunctionApiInsertSchema, cb as FunctionApiSelect, j as FunctionApiSelectSchema, cc as FunctionApiUpdate, k as FunctionApiUpdateSchema, c9 as FunctionInsert, fE as FunctionInsertSchema, gS as FunctionListResponse, gC as FunctionResponse, c8 as FunctionSelect, fD as FunctionSelectSchema, fB as FunctionToolApiInsertSchema, cd as FunctionToolApiSelect, fA as FunctionToolApiSelectSchema, fC as FunctionToolApiUpdateSchema, dK as FunctionToolConfig, dJ as FunctionToolConfigSchema, fy as FunctionToolInsertSchema, gT as FunctionToolListResponse, gD as FunctionToolResponse, fx as FunctionToolSelectSchema, fz as FunctionToolUpdateSchema, ca as FunctionUpdate, fF as FunctionUpdateSchema, bs as GetTaskPushNotificationConfigRequest, bF as GetTaskPushNotificationConfigResponse, bE as GetTaskPushNotificationConfigSuccessResponse, bp as GetTaskRequest, bz as GetTaskResponse, by as GetTaskSuccessResponse, aM as HTTPAuthSecurityScheme, he as HeadersScopeSchema, aQ as ImplicitOAuthFlow, b3 as InternalError, b9 as InvalidAgentResponseError, b2 as InvalidParamsError, b0 as InvalidRequestError, a$ as JSONParseError, bk as JSONRPCError, bm as JSONRPCErrorResponse, bi as JSONRPCMessage, bj as JSONRPCRequest, bl as JSONRPCResult, dc as LedgerArtifactApiInsert, g8 as LedgerArtifactApiInsertSchema, db as LedgerArtifactApiSelect, g7 as LedgerArtifactApiSelectSchema, dd as LedgerArtifactApiUpdate, g9 as LedgerArtifactApiUpdateSchema, d9 as LedgerArtifactInsert, g5 as LedgerArtifactInsertSchema, g4 as LedgerArtifactSelectSchema, da as LedgerArtifactUpdate, g6 as LedgerArtifactUpdateSchema, gi as ListResponseSchema, dG as MCPServerType, fs as MCPToolConfigSchema, dz as McpAuthType, dA as McpServerAuth, dC as McpServerCapabilities, dD as McpToolDefinition, ei as McpToolDefinitionSchema, h7 as McpToolListResponse, h6 as McpToolResponse, fr as McpToolSchema, dB as McpTransportConfig, eg as McpTransportConfigSchema, aW as Message, cj as MessageApiInsert, ev as MessageApiInsertSchema, ci as MessageApiSelect, eu as MessageApiSelectSchema, ck as MessageApiUpdate, ew as MessageApiUpdateSchema, es as MessageInsertSchema, gZ as MessageListResponse, dr as MessageMode, bI as MessagePart, gJ as MessageResponse, dq as MessageRole, ch as MessageSelect, er as MessageSelectSchema, bg as MessageSendConfiguration, bh as MessageSendParams, dp as MessageType, et as MessageUpdateSchema, b1 as MethodNotFoundError, dH as ModelSchema, g as ModelSettings, M as ModelSettingsSchema, ds as Models, aS as OAuth2SecurityScheme, fq as OAuthCallbackQuerySchema, aN as OAuthFlows, fp as OAuthLoginQuerySchema, aT as OpenIdConnectSecurityScheme, dm as Pagination, hn as PaginationQueryParamsSchema, gh as PaginationSchema, P as Part, az as PartBase, aR as PasswordOAuthFlow, dk as ProjectApiInsert, gr as ProjectApiInsertSchema, dj as ProjectApiSelect, gq as ProjectApiSelectSchema, dl as ProjectApiUpdate, gs as ProjectApiUpdateSchema, go as ProjectInsertSchema, gK as ProjectListResponse, dI as ProjectModelSchema, dt as ProjectModels, gu as ProjectResponse, gn as ProjectSelectSchema, gp as ProjectUpdateSchema, bb as PushNotificationAuthenticationInfo, bc as PushNotificationConfig, b6 as PushNotificationNotSupportedError, h4 as RelatedAgentInfoListResponse, fn as RelatedAgentInfoSchema, gm as RemovedResponseSchema, aU as SecurityScheme, aK as SecuritySchemeBase, bn as SendMessageRequest, bv as SendMessageResponse, bu as SendMessageSuccessResponse, bo as SendStreamingMessageRequest, bx as SendStreamingMessageResponse, bw as SendStreamingMessageSuccessResponse, br as SetTaskPushNotificationConfigRequest, bD as SetTaskPushNotificationConfigResponse, bC as SetTaskPushNotificationConfigSuccessResponse, gj as SingleResponseSchema, dv as StatusComponent, ga as StatusComponentSchema, gb as StatusUpdateSchema, du as StatusUpdateSettings, d as StopWhen, S as StopWhenSchema, bL as SubAgentApiInsert, dP as SubAgentApiInsertSchema, bK as SubAgentApiSelect, dO as SubAgentApiSelectSchema, bM as SubAgentApiUpdate, dQ as SubAgentApiUpdateSchema, cK as SubAgentArtifactComponentApiInsert, e_ as SubAgentArtifactComponentApiInsertSchema, cJ as SubAgentArtifactComponentApiSelect, eZ as SubAgentArtifactComponentApiSelectSchema, cL as SubAgentArtifactComponentApiUpdate, e$ as SubAgentArtifactComponentApiUpdateSchema, cH as SubAgentArtifactComponentInsert, eX as SubAgentArtifactComponentInsertSchema, h1 as SubAgentArtifactComponentListResponse, g$ as SubAgentArtifactComponentResponse, cG as SubAgentArtifactComponentSelect, eW as SubAgentArtifactComponentSelectSchema, cI as SubAgentArtifactComponentUpdate, eY as SubAgentArtifactComponentUpdateSchema, cB as SubAgentDataComponentApiInsert, eO as SubAgentDataComponentApiInsertSchema, cA as SubAgentDataComponentApiSelect, eN as SubAgentDataComponentApiSelectSchema, cC as SubAgentDataComponentApiUpdate, eP as SubAgentDataComponentApiUpdateSchema, cy as SubAgentDataComponentInsert, eL as SubAgentDataComponentInsertSchema, h0 as SubAgentDataComponentListResponse, g_ as SubAgentDataComponentResponse, cx as SubAgentDataComponentSelect, eK as SubAgentDataComponentSelectSchema, cz as SubAgentDataComponentUpdate, eM as SubAgentDataComponentUpdateSchema, dh as SubAgentDefinition, d2 as SubAgentExternalAgentRelationApiInsert, fY as SubAgentExternalAgentRelationApiInsertSchema, d1 as SubAgentExternalAgentRelationApiSelect, fX as SubAgentExternalAgentRelationApiSelectSchema, d3 as SubAgentExternalAgentRelationApiUpdate, fZ as SubAgentExternalAgentRelationApiUpdateSchema, fV as SubAgentExternalAgentRelationInsertSchema, hb as SubAgentExternalAgentRelationListResponse, ha as SubAgentExternalAgentRelationResponse, c$ as SubAgentExternalAgentRelationSelect, fU as SubAgentExternalAgentRelationSelectSchema, d0 as SubAgentExternalAgentRelationUpdate, fW as SubAgentExternalAgentRelationUpdateSchema, dM as SubAgentInsertSchema, gL as SubAgentListResponse, bP as SubAgentRelationApiInsert, dV as SubAgentRelationApiInsertSchema, bO as SubAgentRelationApiSelect, dU as SubAgentRelationApiSelectSchema, bQ as SubAgentRelationApiUpdate, dW as SubAgentRelationApiUpdateSchema, dS as SubAgentRelationInsertSchema, gW as SubAgentRelationListResponse, bR as SubAgentRelationQuery, dX as SubAgentRelationQuerySchema, gG as SubAgentRelationResponse, bN as SubAgentRelationSelect, dR as SubAgentRelationSelectSchema, dT as SubAgentRelationUpdateSchema, gv as SubAgentResponse, dL as SubAgentSelectSchema, f as SubAgentStopWhen, c as SubAgentStopWhenSchema, d7 as SubAgentTeamAgentRelationApiInsert, g2 as SubAgentTeamAgentRelationApiInsertSchema, d6 as SubAgentTeamAgentRelationApiSelect, g1 as SubAgentTeamAgentRelationApiSelectSchema, d8 as SubAgentTeamAgentRelationApiUpdate, g3 as SubAgentTeamAgentRelationApiUpdateSchema, f$ as SubAgentTeamAgentRelationInsertSchema, h9 as SubAgentTeamAgentRelationListResponse, h8 as SubAgentTeamAgentRelationResponse, d4 as SubAgentTeamAgentRelationSelect, f_ as SubAgentTeamAgentRelationSelectSchema, d5 as SubAgentTeamAgentRelationUpdate, g0 as SubAgentTeamAgentRelationUpdateSchema, cZ as SubAgentToolRelationApiInsert, fS as SubAgentToolRelationApiInsertSchema, cY as SubAgentToolRelationApiSelect, fR as SubAgentToolRelationApiSelectSchema, c_ as SubAgentToolRelationApiUpdate, fT as SubAgentToolRelationApiUpdateSchema, cX as SubAgentToolRelationInsert, fP as SubAgentToolRelationInsertSchema, gX as SubAgentToolRelationListResponse, gH as SubAgentToolRelationResponse, cW as SubAgentToolRelationSelect, fO as SubAgentToolRelationSelectSchema, fQ as SubAgentToolRelationUpdateSchema, dN as SubAgentUpdateSchema, dn as SummaryEvent, dE as TOOL_STATUS_VALUES, aY as Task, bZ as TaskApiInsert, e8 as TaskApiInsertSchema, bY as TaskApiSelect, e7 as TaskApiSelectSchema, b_ as TaskApiUpdate, e9 as TaskApiUpdateSchema, bJ as TaskArtifact, a_ as TaskArtifactUpdateEvent, be as TaskIdParams, e5 as TaskInsertSchema, b5 as TaskNotCancelableError, b4 as TaskNotFoundError, bd as TaskPushNotificationConfig, bf as TaskQueryParams, c3 as TaskRelationApiInsert, ee as TaskRelationApiInsertSchema, c2 as TaskRelationApiSelect, ed as TaskRelationApiSelectSchema, c4 as TaskRelationApiUpdate, ef as TaskRelationApiUpdateSchema, c0 as TaskRelationInsert, eb as TaskRelationInsertSchema, b$ as TaskRelationSelect, ea as TaskRelationSelectSchema, c1 as TaskRelationUpdate, ec as TaskRelationUpdateSchema, bt as TaskResubscriptionRequest, e4 as TaskSelectSchema, aG as TaskState, aX as TaskStatus, aZ as TaskStatusUpdateEvent, bX as TaskUpdate, e6 as TaskUpdateSchema, gf as TeamAgentSchema, hg as TenantIdParamsSchema, hf as TenantParamsSchema, hk as TenantProjectAgentIdParamsSchema, hj as TenantProjectAgentParamsSchema, hm as TenantProjectAgentSubAgentIdParamsSchema, hl as TenantProjectAgentSubAgentParamsSchema, hi as TenantProjectIdParamsSchema, hh as TenantProjectParamsSchema, aA as TextPart, c6 as ToolApiInsert, fv as ToolApiInsertSchema, c5 as ToolApiSelect, fu as ToolApiSelectSchema, c7 as ToolApiUpdate, fw as ToolApiUpdateSchema, di as ToolDefinition, ek as ToolInsertSchema, gN as ToolListResponse, gx as ToolResponse, ej as ToolSelectSchema, eh as ToolStatusSchema, ft as ToolUpdateSchema, b7 as UnsupportedOperationError, dF as VALID_RELATION_TYPES, gd as canDelegateToExternalAgentSchema, ge as canDelegateToTeamAgentSchema } from './utility-DbltUp2Q.cjs';
7
- import { CredentialStore } from './types/index.cjs';
8
- export { CorsConfig, ServerConfig, ServerOptions } from './types/index.cjs';
9
- import { NodePgDatabase } from 'drizzle-orm/node-postgres';
10
- import { PgliteDatabase } from 'drizzle-orm/pglite';
11
- import { s as schema } from './schema-D4WR42em.cjs';
12
- export { Z as account, G as agentRelations, J as agentToolRelationsRelations, a as agents, y as apiKeys, I as apiKeysRelations, j as artifactComponents, O as artifactComponentsRelations, b as contextCache, E as contextCacheRelations, c as contextConfigs, D as contextConfigsRelations, v as conversations, M as conversationsRelations, z as credentialReferences, K as credentialReferencesRelations, h as dataComponents, Q as dataComponentsRelations, f as externalAgents, H as externalAgentsRelations, m as functionTools, V as functionToolsRelations, n as functions, T as functionsRelations, _ as invitation, x as ledgerArtifacts, S as ledgerArtifactsRelations, $ as member, w as messages, N as messagesRelations, a0 as organization, p as projects, B as projectsRelations, a1 as session, a2 as ssoProvider, k as subAgentArtifactComponents, P as subAgentArtifactComponentsRelations, i as subAgentDataComponents, R as subAgentDataComponentsRelations, q as subAgentExternalAgentRelations, X as subAgentExternalAgentRelationsRelations, u as subAgentFunctionToolRelations, W as subAgentFunctionToolRelationsRelations, e as subAgentRelations, U as subAgentRelationsRelations, r as subAgentTeamAgentRelations, Y as subAgentTeamAgentRelationsRelations, o as subAgentToolRelations, d as subAgents, F as subAgentsRelations, g as taskRelations, C as taskRelationsRelations, t as tasks, A as tasksRelations, l as tools, L as toolsRelations, a3 as user, a4 as verification } from './schema-D4WR42em.cjs';
13
- import { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
14
- import { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
15
- import { ClientCapabilities } from '@modelcontextprotocol/sdk/types.js';
16
- import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
17
- import { PgTable } from 'drizzle-orm/pg-core';
18
- import * as drizzle_zod from 'drizzle-zod';
19
- import { ValidateFunction } from 'ajv';
20
- import { Context, Next } from 'hono';
21
- import { z as z$1 } from '@hono/zod-openapi';
22
- import { HTTPException } from 'hono/http-exception';
23
- export { convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, isZodSchema, preview } from './utils/schema-conversion.cjs';
24
- import { Span, Tracer } from '@opentelemetry/api';
25
- export { A2AMessageMetadata, A2AMessageMetadataSchema, DataComponentStreamEvent, DataComponentStreamEventSchema, DataOperationDetails, DataOperationDetailsSchema, DataOperationEvent, DataOperationEventSchema, DataOperationStreamEvent, DataOperationStreamEventSchema, DataSummaryStreamEvent, DataSummaryStreamEventSchema, DelegationReturnedData, DelegationReturnedDataSchema, DelegationSentData, DelegationSentDataSchema, MAX_ID_LENGTH, MIN_ID_LENGTH, RenderValidationResult, StreamErrorEvent, StreamErrorEventSchema, StreamEvent, StreamEventSchema, StreamFinishEvent, StreamFinishEventSchema, TextDeltaEvent, TextDeltaEventSchema, TextEndEvent, TextEndEventSchema, TextStartEvent, TextStartEventSchema, TransferData, TransferDataSchema, URL_SAFE_ID_PATTERN, generateIdFromName, isValidResourceId, resourceIdSchema, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences } from './validation/index.cjs';
26
- export { P as PropsValidationResult, v as validatePropsAsJsonSchema } from './props-validation-BMR1qNiy.cjs';
27
- import 'pino';
28
- import 'drizzle-orm';
29
-
30
- /**
31
- * Shared base API client for making HTTP requests
32
- * Used by both CLI and SDK to ensure consistent API communication
33
- *
34
- * This is a thin wrapper around fetch that provides consistent header handling.
35
- * Implementations should construct Authorization headers and pass them via options.
36
- */
37
- /**
38
- * Makes an HTTP request with consistent header defaults
39
- *
40
- * @param url - The URL to fetch
41
- * @param options - Standard fetch options (headers will be merged with defaults)
42
- * @returns Promise<Response>
43
- *
44
- * @example
45
- * ```typescript
46
- * // With Authorization header
47
- * const response = await apiFetch('https://api.example.com/data', {
48
- * method: 'POST',
49
- * headers: {
50
- * Authorization: 'Bearer your-api-key'
51
- * },
52
- * body: JSON.stringify({ data: 'value' })
53
- * });
54
- *
55
- * // Without Authorization
56
- * const response = await apiFetch('https://api.example.com/public', {
57
- * method: 'GET'
58
- * });
59
- * ```
60
- */
61
- declare function apiFetch(url: string, options?: RequestInit): Promise<Response>;
62
-
63
- /**
64
- * Shared execution limit default constants used for runtime behavior across services.
65
- * These define limits and defaults for runtime execution, not schema validation.
66
- */
67
- declare const executionLimitsSharedDefaults: {
68
- readonly MCP_TOOL_CONNECTION_TIMEOUT_MS: 3000;
69
- readonly MCP_TOOL_MAX_RETRIES: 3;
70
- readonly MCP_TOOL_MAX_RECONNECTION_DELAY_MS: 30000;
71
- readonly MCP_TOOL_INITIAL_RECONNECTION_DELAY_MS: 1000;
72
- readonly MCP_TOOL_RECONNECTION_DELAY_GROWTH_FACTOR: 1.5;
73
- readonly CONVERSATION_HISTORY_DEFAULT_LIMIT: 50;
74
- readonly CONVERSATION_HISTORY_MAX_OUTPUT_TOKENS_DEFAULT: 8000;
75
- };
76
-
77
- declare const MCP_TOOL_CONNECTION_TIMEOUT_MS: 3000;
78
- declare const MCP_TOOL_MAX_RETRIES: 3;
79
- declare const MCP_TOOL_MAX_RECONNECTION_DELAY_MS: 30000;
80
- declare const MCP_TOOL_INITIAL_RECONNECTION_DELAY_MS: 1000;
81
- declare const MCP_TOOL_RECONNECTION_DELAY_GROWTH_FACTOR: 1.5;
82
- declare const CONVERSATION_HISTORY_DEFAULT_LIMIT: 50;
83
- declare const CONVERSATION_HISTORY_MAX_OUTPUT_TOKENS_DEFAULT: 8000;
84
-
85
- /**
86
- * Schema validation default constants used in Zod schemas.
87
- * These define limits and defaults for user-configurable values.
88
- */
89
- declare const schemaValidationDefaults: {
90
- readonly AGENT_EXECUTION_TRANSFER_COUNT_MIN: 1;
91
- readonly AGENT_EXECUTION_TRANSFER_COUNT_MAX: 1000;
92
- readonly AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT: 10;
93
- readonly SUB_AGENT_TURN_GENERATION_STEPS_MIN: 1;
94
- readonly SUB_AGENT_TURN_GENERATION_STEPS_MAX: 1000;
95
- readonly SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT: 12;
96
- readonly STATUS_UPDATE_MAX_NUM_EVENTS: 100;
97
- readonly STATUS_UPDATE_MAX_INTERVAL_SECONDS: 600;
98
- readonly VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS: 2000;
99
- readonly VALIDATION_AGENT_PROMPT_MAX_CHARS: 5000;
100
- readonly CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT: 10000;
101
- };
102
-
103
- declare const AGENT_EXECUTION_TRANSFER_COUNT_MIN: 1;
104
- declare const AGENT_EXECUTION_TRANSFER_COUNT_MAX: 1000;
105
- declare const AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT: 10;
106
- declare const SUB_AGENT_TURN_GENERATION_STEPS_MIN: 1;
107
- declare const SUB_AGENT_TURN_GENERATION_STEPS_MAX: 1000;
108
- declare const SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT: 12;
109
- declare const STATUS_UPDATE_MAX_NUM_EVENTS: 100;
110
- declare const STATUS_UPDATE_MAX_INTERVAL_SECONDS: 600;
111
- declare const VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS: 2000;
112
- declare const VALIDATION_AGENT_PROMPT_MAX_CHARS: 5000;
113
- declare const CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT: 10000;
114
-
115
- type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date;
116
- type JoinDot<P extends string, K extends string> = [P] extends [''] ? K : `${P}.${K}`;
117
- type DotPaths<T, P extends string = ''> = [T] extends [Primitive] ? P : T extends ReadonlyArray<infer U> ? P | DotPaths<U, `${P}[${number}]`> | DotPaths<U, `${P}[*]`> : T extends Array<infer U> ? P | DotPaths<U, `${P}[${number}]`> | DotPaths<U, `${P}[*]`> : T extends object ? P | {
118
- [K in Extract<keyof T, string>]: DotPaths<T[K], JoinDot<P, K>>;
119
- }[Extract<keyof T, string>] : P;
120
-
121
- type ExtractSchemasFromCV<CV> = {
122
- [K in keyof CV]: CV[K] extends builderFetchDefinition<infer S> ? S : never;
123
- };
124
- type InferContextFromSchemas<CZ> = {
125
- [K in keyof CZ]: CZ[K] extends z.ZodTypeAny ? z.infer<CZ[K]> : never;
126
- };
127
- type FullContext<CV> = InferContextFromSchemas<ExtractSchemasFromCV<CV>>;
128
- type AllowedPaths<CV> = DotPaths<FullContext<CV>>;
129
- interface HeadersSchemaBuilderOptions<R extends z.ZodTypeAny> {
130
- schema: R;
131
- }
132
- declare class HeadersSchemaBuilder<R extends z.ZodTypeAny> {
133
- private schema;
134
- constructor(options: HeadersSchemaBuilderOptions<R>);
135
- /** Template function for headers paths with type-safe autocomplete */
136
- toTemplate<P extends DotPaths<z.infer<R>>>(path: P): `{{headers.${P}}}`;
137
- getSchema(): R;
138
- getJsonSchema(): Record<string, unknown>;
139
- }
140
- type builderFetchDefinition<R extends z.ZodTypeAny> = {
141
- id: string;
142
- name?: string;
143
- trigger: 'initialization' | 'invocation';
144
- fetchConfig: {
145
- url: string;
146
- method?: string;
147
- headers?: Record<string, string>;
148
- body?: Record<string, unknown>;
149
- transform?: string;
150
- timeout?: number;
151
- };
152
- responseSchema: R;
153
- defaultValue?: unknown;
154
- credentialReference?: CredentialReferenceApiInsert;
155
- };
156
- interface ContextConfigBuilderOptions<R extends z.ZodTypeAny | undefined = undefined, CV = Record<string, builderFetchDefinition<z.ZodTypeAny>>> {
157
- id: string;
158
- headers?: R | HeadersSchemaBuilder<R extends z.ZodTypeAny ? R : z.ZodTypeAny>;
159
- contextVariables?: CV;
160
- tenantId?: string;
161
- projectId?: string;
162
- agentId?: string;
163
- baseURL?: string;
164
- }
165
- declare class ContextConfigBuilder<R extends z.ZodTypeAny | undefined, CV extends Record<string, builderFetchDefinition<z.ZodTypeAny>>> {
166
- private config;
167
- private baseURL;
168
- private tenantId;
169
- private projectId;
170
- private agentId;
171
- constructor(options: ContextConfigBuilderOptions<R, CV>);
172
- /**
173
- * Set the context (tenantId, projectId, agentId) for this context config
174
- * Called by agent.setConfig() when the agent is configured
175
- */
176
- setContext(tenantId: string, projectId: string, agentId: string, baseURL: string): void;
177
- /**
178
- * Convert the builder to a plain object for database operations
179
- */
180
- toObject(): ContextConfigSelect;
181
- getId(): string;
182
- getHeadersSchema(): any;
183
- getContextVariables(): Record<string, ContextFetchDefinition>;
184
- withHeadersSchema(schema: any): this;
185
- /** 4) The function you ship: path autocomplete + validation, returns {{path}} */
186
- toTemplate<P extends AllowedPaths<CV>>(path: P): `{{${P}}}`;
187
- validate(): {
188
- valid: boolean;
189
- errors: string[];
190
- };
191
- init(): Promise<void>;
192
- private upsertContextConfig;
193
- private parseErrorResponse;
194
- }
195
- declare function contextConfig<R extends z.ZodTypeAny | undefined = undefined, CV extends Record<string, builderFetchDefinition<z.ZodTypeAny>> = Record<string, builderFetchDefinition<z.ZodTypeAny>>>(options: ContextConfigBuilderOptions<R, CV> & {
196
- contextVariables?: CV;
197
- }): ContextConfigBuilder<R, CV>;
198
- declare function headers<R extends z.ZodTypeAny>(options: HeadersSchemaBuilderOptions<R>): HeadersSchemaBuilder<R>;
199
- declare function fetchDefinition<R extends z.ZodTypeAny>(options: builderFetchDefinition<R>): Omit<builderFetchDefinition<R>, 'credentialReference'> & {
200
- credentialReferenceId?: string;
201
- };
202
-
203
- /**
204
- * Registry for managing credential stores in the application context
205
- * Provides methods to register, retrieve, and manage credential stores
206
- */
207
- declare class CredentialStoreRegistry {
208
- private stores;
209
- private logger;
210
- constructor(initialStores?: CredentialStore[]);
211
- /**
212
- * Add a credential store to the registry
213
- */
214
- add(store: CredentialStore): void;
215
- /**
216
- * Get a credential store by ID
217
- */
218
- get(id: string): CredentialStore | undefined;
219
- /**
220
- * Get all registered credential stores
221
- */
222
- getAll(): CredentialStore[];
223
- /**
224
- * Get all credential store IDs
225
- */
226
- getIds(): string[];
227
- /**
228
- * Check if a credential store is registered
229
- */
230
- has(id: string): boolean;
231
- /**
232
- * Remove a credential store
233
- */
234
- remove(id: string): boolean;
235
- /**
236
- * Get the number of registered stores
237
- */
238
- size(): number;
239
- }
240
-
241
- type DatabaseClient = NodePgDatabase<typeof schema> | PgliteDatabase<typeof schema>;
242
- interface DatabaseConfig {
243
- connectionString?: string;
244
- poolSize?: number;
245
- ssl?: boolean;
246
- logger?: {
247
- logQuery: (query: string, params: unknown[]) => void;
248
- };
249
- }
250
- /**
251
- * Creates a PostgreSQL database client with connection pooling
252
- */
253
- declare function createDatabaseClient(config?: DatabaseConfig): DatabaseClient;
254
-
255
- interface TemplateContext {
256
- [key: string]: unknown;
257
- }
258
- interface TemplateRenderOptions {
259
- strict?: boolean;
260
- preserveUnresolved?: boolean;
261
- }
262
- declare class TemplateEngine {
263
- private static readonly DEFAULT_OPTIONS;
264
- /**
265
- * Render a template string with context data using JMESPath
266
- */
267
- static render(template: string, context: TemplateContext, options?: TemplateRenderOptions): string;
268
- /**
269
- * Normalize JMES path by wrapping property names with dashes in quotes
270
- * Example: headers.x-tenant-id -> headers."x-tenant-id"
271
- * Example: api-responses[0].response-code -> "api-responses"[0]."response-code"
272
- */
273
- private static normalizeJMESPath;
274
- /**
275
- * Process variable substitutions {{variable.path}} using JMESPath
276
- */
277
- private static processVariables;
278
- /**
279
- * Process built-in variables like $env, etc.
280
- */
281
- private static processBuiltinVariable;
282
- /**
283
- * Check if template contains template variables
284
- */
285
- private static hasTemplateVariables;
286
- /**
287
- * Extract all template variables from a template
288
- */
289
- private static extractTemplateVariables;
290
- /**
291
- * Validate template syntax
292
- */
293
- static validateTemplate(template: string): {
294
- valid: boolean;
295
- errors: string[];
296
- };
297
- /**
298
- * Preview template rendering with sample context
299
- */
300
- static preview(template: string, sampleContext: TemplateContext, options?: TemplateRenderOptions): {
301
- rendered: string;
302
- variables: string[];
303
- errors: string[];
304
- };
305
- }
306
-
307
- interface FetchResult {
308
- data: unknown;
309
- source: string;
310
- durationMs: number;
311
- }
312
- declare class ContextFetcher {
313
- private tenantId;
314
- private projectId;
315
- private defaultTimeout;
316
- private credentialStuffer?;
317
- private dbClient;
318
- constructor(tenantId: string, projectId: string, dbClient: DatabaseClient, credentialStoreRegistry?: CredentialStoreRegistry, defaultTimeout?: number);
319
- /**
320
- * Fetch data according to a fetch definition
321
- */
322
- fetch(definition: ContextFetchDefinition, context: TemplateContext): Promise<unknown>;
323
- private getCredential;
324
- /**
325
- * Resolve template variables in fetch configuration and inject credential headers
326
- */
327
- private resolveTemplateVariables;
328
- /**
329
- * Interpolate template variables in a string using TemplateEngine
330
- */
331
- private interpolateTemplate;
332
- /**
333
- * Interpolate template variables in an object recursively using TemplateEngine
334
- */
335
- private interpolateObjectTemplates;
336
- /**
337
- * Perform HTTP request
338
- */
339
- private performRequest;
340
- /**
341
- * Transform response data using JMESPath
342
- */
343
- private transformResponse;
344
- /**
345
- * Validate response against JSON Schema
346
- */
347
- private validateResponseWithJsonSchema;
348
- /**
349
- * Test a fetch definition without caching
350
- */
351
- test(definition: ContextFetchDefinition, context: TemplateContext): Promise<{
352
- success: boolean;
353
- data?: unknown;
354
- error?: string;
355
- durationMs: number;
356
- }>;
357
- /**
358
- * Get fetcher statistics
359
- */
360
- getStats(): {
361
- tenantId: string;
362
- defaultTimeout: number;
363
- };
364
- }
365
-
366
- interface ResolvedContext {
367
- [templateKey: string]: unknown;
368
- }
369
- interface ContextResolutionOptions {
370
- triggerEvent: 'initialization' | 'invocation';
371
- conversationId: string;
372
- headers?: Record<string, unknown>;
373
- tenantId: string;
374
- }
375
- interface ContextResolutionResult {
376
- resolvedContext: ResolvedContext;
377
- headers: Record<string, unknown>;
378
- fetchedDefinitions: string[];
379
- cacheHits: string[];
380
- cacheMisses: string[];
381
- errors: Array<{
382
- definitionId: string;
383
- error: string;
384
- }>;
385
- totalDurationMs: number;
386
- }
387
- declare class ContextResolver {
388
- private fetcher;
389
- private cache;
390
- private tenantId;
391
- private projectId;
392
- constructor(tenantId: string, projectId: string, dbClient: DatabaseClient, credentialStoreRegistry?: CredentialStoreRegistry);
393
- /**
394
- * Resolve all contexts for a given configuration and trigger event
395
- */
396
- resolve(contextConfig: ContextConfigSelect, options: ContextResolutionOptions): Promise<ContextResolutionResult>;
397
- /**
398
- * Resolve a single context variable
399
- */
400
- private resolveSingleFetchDefinition;
401
- /**
402
- * Resolve the headers for a given conversation
403
- */
404
- resolveHeaders(conversationId: string, contextConfigId: string): Promise<Record<string, unknown>>;
405
- /**
406
- * Create a hash of the headers for cache invalidation
407
- */
408
- private createRequestHash;
409
- /**
410
- * Clear cache
411
- */
412
- clearCache(tenantId: string, projectId: string, conversationId: string): Promise<void>;
413
- }
414
-
415
- declare function determineContextTrigger(tenantId: string, projectId: string, conversationId: string, dbClient: DatabaseClient): Promise<'initialization' | 'invocation'>;
416
- declare function handleContextConfigChange(tenantId: string, projectId: string, conversationId: string, agentId: string, newContextConfigId: string, dbClient: DatabaseClient, credentialStores?: CredentialStoreRegistry): Promise<void>;
417
- declare function handleContextResolution({ tenantId, projectId, agentId, conversationId, headers, dbClient, credentialStores, }: {
418
- tenantId: string;
419
- projectId: string;
420
- agentId: string;
421
- conversationId: string;
422
- headers: Record<string, unknown>;
423
- dbClient: DatabaseClient;
424
- credentialStores?: CredentialStoreRegistry;
425
- }): Promise<ResolvedContext | null>;
426
-
427
- interface CacheEntry {
428
- contextConfigId: string;
429
- contextVariableKey: string;
430
- conversationId: string;
431
- value: unknown;
432
- requestHash?: string;
433
- tenantId: string;
434
- }
435
- /**
436
- * Context cache with request hash-based invalidation and graceful error handling.
437
- *
438
- * Implements conversation-scoped caching with smart cache invalidation based on
439
- * request hash changes. All cache errors are treated as cache misses to ensure
440
- * system reliability.
441
- */
442
- declare class ContextCache {
443
- private tenantId;
444
- private projectId;
445
- private dbClient;
446
- constructor(tenantId: string, projectId: string, dbClient: DatabaseClient);
447
- /**
448
- * Get cached context data for a conversation
449
- */
450
- get({ conversationId, contextConfigId, contextVariableKey, requestHash, }: {
451
- conversationId: string;
452
- contextConfigId: string;
453
- contextVariableKey: string;
454
- requestHash?: string;
455
- }): Promise<CacheEntry | null>;
456
- /**
457
- * Set cached context data for a conversation
458
- */
459
- set(entry: CacheEntry): Promise<void>;
460
- /**
461
- * Clear cache entries for a specific conversation
462
- */
463
- clearConversation(tenantId: string, projectId: string, conversationId: string): Promise<void>;
464
- /**
465
- * Clear all cache entries for a specific context configuration
466
- */
467
- clearContextConfig(tenantId: string, projectId: string, contextConfigId: string): Promise<void>;
468
- /**
469
- * Clean up expired or orphaned cache entries
470
- */
471
- cleanup(): Promise<void>;
472
- invalidateInvocationDefinitions(tenantId: string, projectId: string, conversationId: string, contextConfigId: string, definitionIds: string[]): Promise<void>;
473
- invalidateHeaders(tenantId: string, projectId: string, conversationId: string, contextConfigId: string): Promise<void>;
474
- }
475
-
476
- /**
477
- * Create default credential stores based on environment variables
478
- */
479
- declare function createDefaultCredentialStores(): CredentialStore[];
480
-
481
- /**
482
- * KeyChainStore - Cross-platform system keychain credential storage
483
- *
484
- * Uses the native OS credential storage:
485
- * - macOS: Keychain
486
- * - Windows: Credential Vault
487
- * - Linux: Secret Service API/libsecret
488
- *
489
- * Requires the 'keytar' npm package to be installed.
490
- * Falls back gracefully if keytar is not available.
491
- *
492
- * ## macOS Permission Handling
493
- *
494
- * On macOS, when your Node.js app first calls keytar operations:
495
- * - `setPassword()` creates a new Keychain item (no prompt required)
496
- * - `getPassword()` may prompt the user for permission on first access
497
- * - Users can click "Allow", "Always Allow", or "Deny"
498
- * - If denied, keytar returns `null` which this implementation handles gracefully
499
- * - The calling binary (usually `node`) will be shown in the permission prompt
500
- * - For better UX in packaged apps, consider code signing and app bundling
501
- *
502
- * This implementation handles all permission scenarios gracefully:
503
- * - Returns `null` when access is denied or credentials don't exist
504
- * - Logs errors for debugging permission issues
505
- * - Never throws on permission denial, only on system-level errors
506
- */
507
- declare class KeyChainStore implements CredentialStore {
508
- readonly id: string;
509
- readonly type: "keychain";
510
- private readonly service;
511
- private readonly logger;
512
- private keytarAvailable;
513
- private keytar;
514
- private initializationPromise;
515
- constructor(id: string, servicePrefix?: string);
516
- /**
517
- * Initialize keytar dynamically to handle optional availability
518
- */
519
- private initializeKeytar;
520
- /**
521
- * Get a credential from the keychain
522
- */
523
- get(key: string): Promise<string | null>;
524
- /**
525
- * Set a credential in the keychain
526
- * @param metadata - Optional metadata (ignored by keychain store)
527
- */
528
- set(key: string, value: string, _metadata?: Record<string, string>): Promise<void>;
529
- /**
530
- * Check if a credential exists in the keychain
531
- */
532
- has(key: string): Promise<boolean>;
533
- /**
534
- * Check if the credential store is available and functional
535
- */
536
- checkAvailability(): Promise<{
537
- available: boolean;
538
- reason?: string;
539
- }>;
540
- /**
541
- * Delete a credential from the keychain
542
- */
543
- delete(key: string): Promise<boolean>;
544
- /**
545
- * Find all credentials for this service
546
- * Useful for debugging and listing stored credentials
547
- */
548
- findAllCredentials(): Promise<Array<{
549
- account: string;
550
- password: string;
551
- }>>;
552
- /**
553
- * Clear all credentials for this service
554
- * WARNING: This will delete all credentials stored under this service
555
- */
556
- clearAll(): Promise<number>;
557
- }
558
- /**
559
- * Factory function to create KeyChainStore
560
- * Provides consistent initialization and optional configuration
561
- *
562
- * ## Usage Recommendations for macOS Permission Handling
563
- *
564
- * 1. **First-time setup**: Inform users that they may see permission prompts
565
- * 2. **Error handling**: Check for `null` returns from `get()` operations
566
- * 3. **User guidance**: If credentials can't be retrieved, guide users to:
567
- * - Check Keychain Access app for denied permissions
568
- * - Re-run the application if they accidentally clicked "Deny"
569
- * 4. **Development**: Use a consistent `servicePrefix` to avoid permission prompt spam
570
- * 5. **Production**: Consider code-signing your distributed app for better permission prompts
571
- *
572
- * Example usage with permission handling:
573
- * ```typescript
574
- * const store = createKeyChainStore('my-app');
575
- *
576
- * // Always check for null when retrieving
577
- * const apiKey = await store.get('api-key');
578
- * if (!apiKey) {
579
- * console.log('API key not found or access denied');
580
- * // Guide user to check permissions or re-enter credentials
581
- * }
582
- * ```
583
- */
584
- declare function createKeyChainStore(id: string, options?: {
585
- servicePrefix?: string;
586
- }): KeyChainStore;
587
-
588
- /**
589
- * In-memory credential store implementation
590
- * Automatically loads environment variables prefixed with CREDENTIAL_STORE_ on initialization
591
- * Note: Runtime credentials are lost when the server restarts, but env vars are reloaded
592
- */
593
- declare class InMemoryCredentialStore implements CredentialStore {
594
- readonly id: string;
595
- readonly type: "memory";
596
- private credentials;
597
- constructor(id?: string);
598
- /**
599
- * Get a credential from the in memory store.
600
- * If the key is not found in the in memory store then it is loaded from environment variables.
601
- * If the key is not found in the environment variables or in the in memory store then returns null.
602
- * @param key - The key of the credential to get
603
- * @returns The credential value or null if not found
604
- */
605
- get(key: string): Promise<string | null>;
606
- /**
607
- * Set a credential in the in memory store.
608
- * @param key - The key of the credential to set
609
- * @param value - The value of the credential to set
610
- * @param metadata - Optional metadata (ignored by memory store)
611
- */
612
- set(key: string, value: string, _metadata?: Record<string, string>): Promise<void>;
613
- /**
614
- * Check if a credential exists in the in memory store.
615
- * @param key - The key of the credential to check
616
- * @returns True if the credential exists, false otherwise
617
- */
618
- has(key: string): Promise<boolean>;
619
- /**
620
- * Delete a credential from the in memory store.
621
- * @param key - The key of the credential to delete
622
- * @returns True if the credential was deleted, false otherwise
623
- */
624
- delete(key: string): Promise<boolean>;
625
- /**
626
- * Check if the credential store is available and functional
627
- */
628
- checkAvailability(): Promise<{
629
- available: boolean;
630
- reason?: string;
631
- }>;
632
- }
633
-
634
- interface NangoConfig {
635
- secretKey: string;
636
- apiUrl?: string;
637
- }
638
- /**
639
- * Nango-based CredentialStore that fetches OAuth credentials from Nango API
640
- * Uses connectionId and providerConfigKey from metadata to fetch live credentials
641
- */
642
- declare class NangoCredentialStore implements CredentialStore {
643
- readonly id: string;
644
- readonly type: "nango";
645
- private nangoConfig;
646
- private nangoClient;
647
- constructor(id: string, config: NangoConfig);
648
- private getAccessToken;
649
- private sanitizeMetadata;
650
- /**
651
- * Fetch a specific Nango integration
652
- */
653
- private fetchNangoIntegration;
654
- /**
655
- * Create an API key credential by setting up Nango integration and importing the connection
656
- */
657
- private createNangoApiKeyConnection;
658
- /**
659
- * Fetch credentials from Nango API using connection information
660
- * @param connectionId - The connection ID for the Nango connection
661
- * @param providerConfigKey - The provider config key for the Nango connection
662
- * @returns The credential data or null if the credentials are not found
663
- */
664
- private fetchCredentialsFromNango;
665
- /**
666
- * Get credentials by key - implements CredentialStore interface
667
- * Key format: JSON string with connectionId and providerConfigKey
668
- */
669
- get(key: string): Promise<string | null>;
670
- /**
671
- * Set credentials - this is used to save bearer auth
672
- * Key format: JSON string with connectionId and providerConfigKey
673
- */
674
- set(key: string, value: string, metadata?: Record<string, string>): Promise<void>;
675
- /**
676
- * Check if credentials exist by attempting to fetch them
677
- */
678
- has(key: string): Promise<boolean>;
679
- /**
680
- * Delete credentials - not supported for Nango (revoke through Nango dashboard)
681
- */
682
- delete(key: string): Promise<boolean>;
683
- /**
684
- * Check if the credential store is available and functional
685
- */
686
- checkAvailability(): Promise<{
687
- available: boolean;
688
- reason?: string;
689
- }>;
690
- }
691
- /**
692
- * Factory function to create NangoCredentialStore
693
- * Automatically reads NANGO_SECRET_KEY from environment and validates it
694
- */
695
- declare function createNangoCredentialStore(id: string, config?: Partial<NangoConfig>): NangoCredentialStore;
696
-
697
- interface SharedServerConfig {
698
- timeout?: number;
699
- activeTools?: string[];
700
- selectedTools?: string[];
701
- }
702
- interface McpStreamableHttpConfig extends SharedServerConfig {
703
- type: typeof MCPTransportType.streamableHttp;
704
- url: string | URL;
705
- headers?: Record<string, string>;
706
- requestInit?: StreamableHTTPClientTransportOptions['requestInit'];
707
- eventSourceInit?: SSEClientTransportOptions['eventSourceInit'];
708
- reconnectionOptions?: StreamableHTTPClientTransportOptions['reconnectionOptions'];
709
- sessionId?: StreamableHTTPClientTransportOptions['sessionId'];
710
- }
711
- interface McpSSEConfig extends SharedServerConfig {
712
- type: typeof MCPTransportType.sse;
713
- url: string | URL;
714
- headers?: Record<string, string>;
715
- eventSourceInit?: SSEClientTransportOptions['eventSourceInit'];
716
- }
717
- type McpServerConfig = McpStreamableHttpConfig | McpSSEConfig;
718
- interface McpClientOptions {
719
- name: string;
720
- version?: string;
721
- server: McpServerConfig;
722
- capabilities?: ClientCapabilities;
723
- timeout?: number;
724
- }
725
- declare class McpClient {
726
- name: string;
727
- private client;
728
- private readonly timeout;
729
- private transport?;
730
- private serverConfig;
731
- private connected;
732
- constructor(opts: McpClientOptions);
733
- isConnected(): boolean;
734
- connect(): Promise<void>;
735
- private connectSSE;
736
- private connectHttp;
737
- disconnect(): Promise<void>;
738
- private validateSelectedTools;
739
- private selectTools;
740
- tools(): Promise<Record<string, any>>;
741
- }
742
-
743
- /**
744
- * Context object for credential operations
745
- */
746
- interface CredentialContext {
747
- /** Tenant identifier */
748
- tenantId: string;
749
- /** Project identifier */
750
- projectId: string;
751
- /** Conversation identifier */
752
- conversationId?: string;
753
- /** Context configuration identifier */
754
- contextConfigId?: string;
755
- /** Additional context data */
756
- metadata?: Record<string, unknown>;
757
- }
758
- /**
759
- * Base credential data structure containing headers and metadata
760
- */
761
- interface CredentialData {
762
- /** HTTP headers for authentication */
763
- headers: Record<string, string>;
764
- /** Additional metadata for the credentials */
765
- metadata?: Record<string, any>;
766
- expiresAt?: Date;
767
- }
768
- /**
769
- * Credential store reference for lookups
770
- */
771
- interface CredentialStoreReference {
772
- /** Framework credential store ID */
773
- credentialStoreId: string;
774
- /** Configuration parameters for credential retrieval */
775
- retrievalParams: Record<string, unknown>;
776
- }
777
- interface CredentialResolverInput {
778
- context: CredentialContext;
779
- mcpType?: MCPToolConfig['mcpType'];
780
- storeReference?: CredentialStoreReference;
781
- headers?: Record<string, string>;
782
- }
783
- /**
784
- * Interface for context resolver (optional)
785
- */
786
- interface ContextResolverInterface {
787
- resolveHeaders(conversationId: string, contextConfigId: string): Promise<Record<string, unknown>>;
788
- }
789
- /**
790
- * Manages credential retrieval and injection for MCP tools
791
- * Uses CredentialStoreRegistry for credential store management
792
- */
793
- declare class CredentialStuffer {
794
- private credentialStoreRegistry;
795
- private contextResolver?;
796
- private readonly logger;
797
- constructor(credentialStoreRegistry: CredentialStoreRegistry, contextResolver?: ContextResolverInterface | undefined, logger?: PinoLogger);
798
- /**
799
- * Retrieve credentials from credential store registry
800
- */
801
- getCredentials(context: CredentialContext, storeReference: CredentialStoreReference, mcpType?: MCPToolConfig['mcpType']): Promise<CredentialData | null>;
802
- /**
803
- * Generate credential lookup key based on store type
804
- */
805
- private generateCredentialKey;
806
- /**
807
- * Get credentials from headers context
808
- */
809
- getCredentialsFromHeaders(credentialContext: CredentialContext, headers: Record<string, string>): Promise<CredentialData | null>;
810
- /**
811
- * Get credential headers for MCP server configuration
812
- */
813
- getCredentialHeaders({ context, mcpType, storeReference, headers, }: CredentialResolverInput): Promise<Record<string, string>>;
814
- /**
815
- * Build MCP server configuration with credentials
816
- */
817
- buildMcpServerConfig(context: CredentialContext, tool: MCPToolConfig, storeReference?: CredentialStoreReference, selectedTools?: string[]): Promise<McpServerConfig>;
818
- }
819
-
820
- interface AgentLogger {
821
- info(obj: Record<string, any>, msg?: string): void;
822
- error(obj: Record<string, any>, msg?: string): void;
823
- }
824
- /**
825
- * Server-side implementation of createFullAgent that performs actual database operations.
826
- * This function creates a complete agent with all agents, tools, and relationships.
827
- */
828
- declare const createFullAgentServerSide: (db: DatabaseClient, logger?: AgentLogger) => (scopes: ProjectScopeConfig, agentData: FullAgentDefinition) => Promise<FullAgentDefinition>;
829
- /**
830
- * Server-side implementation of updateFullAgent that performs actual database operations.
831
- * This function updates a complete agent with all agents, tools, and relationships.
832
- */
833
- declare const updateFullAgentServerSide: (db: DatabaseClient, logger?: AgentLogger) => (scopes: ProjectScopeConfig, agentData: FullAgentDefinition) => Promise<FullAgentDefinition>;
834
- /**
835
- * Get a complete agent definition by ID
836
- */
837
- declare const getFullAgent: (db: DatabaseClient, logger?: AgentLogger) => (params: {
838
- scopes: AgentScopeConfig;
839
- }) => Promise<FullAgentDefinition | null>;
840
- /**
841
- * Delete a complete agent and cascade to all related entities
842
- */
843
- declare const deleteFullAgent: (db: DatabaseClient, logger?: AgentLogger) => (params: {
844
- scopes: AgentScopeConfig;
845
- }) => Promise<boolean>;
846
-
847
- declare const getAgentById: (db: DatabaseClient) => (params: {
848
- scopes: AgentScopeConfig;
849
- }) => Promise<{
850
- tenantId: string;
851
- projectId: string;
852
- id: string;
853
- name: string;
854
- description: string | null;
855
- prompt: string | null;
856
- createdAt: string;
857
- updatedAt: string;
858
- models: {
859
- base?: {
860
- model?: string | undefined;
861
- providerOptions?: Record<string, any> | undefined;
862
- } | undefined;
863
- structuredOutput?: {
864
- model?: string | undefined;
865
- providerOptions?: Record<string, any> | undefined;
866
- } | undefined;
867
- summarizer?: {
868
- model?: string | undefined;
869
- providerOptions?: Record<string, any> | undefined;
870
- } | undefined;
871
- } | null;
872
- stopWhen: {
873
- transferCountIs?: number | undefined;
874
- } | null;
875
- defaultSubAgentId: string | null;
876
- contextConfigId: string | null;
877
- statusUpdates: {
878
- enabled?: boolean | undefined;
879
- numEvents?: number | undefined;
880
- timeInSeconds?: number | undefined;
881
- prompt?: string | undefined;
882
- statusComponents?: {
883
- type: string;
884
- description?: string | undefined;
885
- detailsSchema?: {
886
- type: "object";
887
- properties: Record<string, any>;
888
- required?: string[] | undefined;
889
- } | undefined;
890
- }[] | undefined;
891
- } | null;
892
- } | null>;
893
- declare const getAgentWithDefaultSubAgent: (db: DatabaseClient) => (params: {
894
- scopes: AgentScopeConfig;
895
- }) => Promise<{
896
- tenantId: string;
897
- projectId: string;
898
- id: string;
899
- name: string;
900
- description: string | null;
901
- prompt: string | null;
902
- createdAt: string;
903
- updatedAt: string;
904
- models: {
905
- base?: {
906
- model?: string | undefined;
907
- providerOptions?: Record<string, any> | undefined;
908
- } | undefined;
909
- structuredOutput?: {
910
- model?: string | undefined;
911
- providerOptions?: Record<string, any> | undefined;
912
- } | undefined;
913
- summarizer?: {
914
- model?: string | undefined;
915
- providerOptions?: Record<string, any> | undefined;
916
- } | undefined;
917
- } | null;
918
- stopWhen: {
919
- transferCountIs?: number | undefined;
920
- } | null;
921
- defaultSubAgentId: string | null;
922
- contextConfigId: string | null;
923
- statusUpdates: {
924
- enabled?: boolean | undefined;
925
- numEvents?: number | undefined;
926
- timeInSeconds?: number | undefined;
927
- prompt?: string | undefined;
928
- statusComponents?: {
929
- type: string;
930
- description?: string | undefined;
931
- detailsSchema?: {
932
- type: "object";
933
- properties: Record<string, any>;
934
- required?: string[] | undefined;
935
- } | undefined;
936
- }[] | undefined;
937
- } | null;
938
- defaultSubAgent: {
939
- tenantId: string;
940
- projectId: string;
941
- id: string;
942
- name: string;
943
- description: string;
944
- prompt: string;
945
- agentId: string;
946
- createdAt: string;
947
- updatedAt: string;
948
- models: {
949
- base?: {
950
- model?: string | undefined;
951
- providerOptions?: Record<string, any> | undefined;
952
- } | undefined;
953
- structuredOutput?: {
954
- model?: string | undefined;
955
- providerOptions?: Record<string, any> | undefined;
956
- } | undefined;
957
- summarizer?: {
958
- model?: string | undefined;
959
- providerOptions?: Record<string, any> | undefined;
960
- } | undefined;
961
- } | null;
962
- stopWhen: {
963
- stepCountIs?: number | undefined;
964
- } | null;
965
- conversationHistoryConfig: ConversationHistoryConfig | null;
966
- } | null;
967
- } | null>;
968
- declare const listAgents: (db: DatabaseClient) => (params: {
969
- scopes: ProjectScopeConfig;
970
- }) => Promise<{
971
- tenantId: string;
972
- projectId: string;
973
- id: string;
974
- name: string;
975
- description: string | null;
976
- prompt: string | null;
977
- createdAt: string;
978
- updatedAt: string;
979
- models: {
980
- base?: {
981
- model?: string | undefined;
982
- providerOptions?: Record<string, any> | undefined;
983
- } | undefined;
984
- structuredOutput?: {
985
- model?: string | undefined;
986
- providerOptions?: Record<string, any> | undefined;
987
- } | undefined;
988
- summarizer?: {
989
- model?: string | undefined;
990
- providerOptions?: Record<string, any> | undefined;
991
- } | undefined;
992
- } | null;
993
- stopWhen: {
994
- transferCountIs?: number | undefined;
995
- } | null;
996
- defaultSubAgentId: string | null;
997
- contextConfigId: string | null;
998
- statusUpdates: {
999
- enabled?: boolean | undefined;
1000
- numEvents?: number | undefined;
1001
- timeInSeconds?: number | undefined;
1002
- prompt?: string | undefined;
1003
- statusComponents?: {
1004
- type: string;
1005
- description?: string | undefined;
1006
- detailsSchema?: {
1007
- type: "object";
1008
- properties: Record<string, any>;
1009
- required?: string[] | undefined;
1010
- } | undefined;
1011
- }[] | undefined;
1012
- } | null;
1013
- }[]>;
1014
- declare const listAgentsPaginated: (db: DatabaseClient) => (params: {
1015
- scopes: ProjectScopeConfig;
1016
- pagination?: PaginationConfig;
1017
- }) => Promise<{
1018
- data: {
1019
- createdAt: string;
1020
- updatedAt: string;
1021
- name: string;
1022
- description: string | null;
1023
- defaultSubAgentId: string | null;
1024
- contextConfigId: string | null;
1025
- models: {
1026
- base?: {
1027
- model?: string | undefined;
1028
- providerOptions?: Record<string, any> | undefined;
1029
- } | undefined;
1030
- structuredOutput?: {
1031
- model?: string | undefined;
1032
- providerOptions?: Record<string, any> | undefined;
1033
- } | undefined;
1034
- summarizer?: {
1035
- model?: string | undefined;
1036
- providerOptions?: Record<string, any> | undefined;
1037
- } | undefined;
1038
- } | null;
1039
- statusUpdates: {
1040
- enabled?: boolean | undefined;
1041
- numEvents?: number | undefined;
1042
- timeInSeconds?: number | undefined;
1043
- prompt?: string | undefined;
1044
- statusComponents?: {
1045
- type: string;
1046
- description?: string | undefined;
1047
- detailsSchema?: {
1048
- type: "object";
1049
- properties: Record<string, any>;
1050
- required?: string[] | undefined;
1051
- } | undefined;
1052
- }[] | undefined;
1053
- } | null;
1054
- prompt: string | null;
1055
- stopWhen: {
1056
- transferCountIs?: number | undefined;
1057
- } | null;
1058
- projectId: string;
1059
- tenantId: string;
1060
- id: string;
1061
- }[];
1062
- pagination: {
1063
- page: number;
1064
- limit: number;
1065
- total: number;
1066
- pages: number;
1067
- };
1068
- }>;
1069
- declare const createAgent: (db: DatabaseClient) => (data: AgentInsert) => Promise<{
1070
- tenantId: string;
1071
- projectId: string;
1072
- id: string;
1073
- name: string;
1074
- description: string | null;
1075
- prompt: string | null;
1076
- createdAt: string;
1077
- updatedAt: string;
1078
- models: {
1079
- base?: {
1080
- model?: string | undefined;
1081
- providerOptions?: Record<string, any> | undefined;
1082
- } | undefined;
1083
- structuredOutput?: {
1084
- model?: string | undefined;
1085
- providerOptions?: Record<string, any> | undefined;
1086
- } | undefined;
1087
- summarizer?: {
1088
- model?: string | undefined;
1089
- providerOptions?: Record<string, any> | undefined;
1090
- } | undefined;
1091
- } | null;
1092
- stopWhen: {
1093
- transferCountIs?: number | undefined;
1094
- } | null;
1095
- defaultSubAgentId: string | null;
1096
- contextConfigId: string | null;
1097
- statusUpdates: {
1098
- enabled?: boolean | undefined;
1099
- numEvents?: number | undefined;
1100
- timeInSeconds?: number | undefined;
1101
- prompt?: string | undefined;
1102
- statusComponents?: {
1103
- type: string;
1104
- description?: string | undefined;
1105
- detailsSchema?: {
1106
- type: "object";
1107
- properties: Record<string, any>;
1108
- required?: string[] | undefined;
1109
- } | undefined;
1110
- }[] | undefined;
1111
- } | null;
1112
- }>;
1113
- declare const updateAgent: (db: DatabaseClient) => (params: {
1114
- scopes: AgentScopeConfig;
1115
- data: AgentUpdate;
1116
- }) => Promise<{
1117
- createdAt: string;
1118
- updatedAt: string;
1119
- name: string;
1120
- description: string | null;
1121
- defaultSubAgentId: string | null;
1122
- contextConfigId: string | null;
1123
- models: {
1124
- base?: {
1125
- model?: string | undefined;
1126
- providerOptions?: Record<string, any> | undefined;
1127
- } | undefined;
1128
- structuredOutput?: {
1129
- model?: string | undefined;
1130
- providerOptions?: Record<string, any> | undefined;
1131
- } | undefined;
1132
- summarizer?: {
1133
- model?: string | undefined;
1134
- providerOptions?: Record<string, any> | undefined;
1135
- } | undefined;
1136
- } | null;
1137
- statusUpdates: {
1138
- enabled?: boolean | undefined;
1139
- numEvents?: number | undefined;
1140
- timeInSeconds?: number | undefined;
1141
- prompt?: string | undefined;
1142
- statusComponents?: {
1143
- type: string;
1144
- description?: string | undefined;
1145
- detailsSchema?: {
1146
- type: "object";
1147
- properties: Record<string, any>;
1148
- required?: string[] | undefined;
1149
- } | undefined;
1150
- }[] | undefined;
1151
- } | null;
1152
- prompt: string | null;
1153
- stopWhen: {
1154
- transferCountIs?: number | undefined;
1155
- } | null;
1156
- projectId: string;
1157
- tenantId: string;
1158
- id: string;
1159
- }>;
1160
- declare const deleteAgent: (db: DatabaseClient) => (params: {
1161
- scopes: AgentScopeConfig;
1162
- }) => Promise<boolean>;
1163
- /**
1164
- * Helper function to fetch component relationships using efficient joins
1165
- */
1166
- declare const fetchComponentRelationships: (db: DatabaseClient) => <T extends Record<string, unknown>>(scopes: ProjectScopeConfig, subAgentIds: string[], config: {
1167
- relationTable: PgTable<any>;
1168
- componentTable: PgTable<any>;
1169
- relationIdField: unknown;
1170
- componentIdField: unknown;
1171
- subAgentIdField: unknown;
1172
- selectFields: Record<string, unknown>;
1173
- }) => Promise<Record<string, T>>;
1174
- declare const getAgentSubAgentInfos: (db: DatabaseClient) => ({ scopes: { tenantId, projectId }, agentId, subAgentId, }: {
1175
- scopes: ProjectScopeConfig;
1176
- agentId: string;
1177
- subAgentId: string;
1178
- }) => Promise<{
1179
- id: string;
1180
- name: string;
1181
- description: string;
1182
- }[]>;
1183
- declare const getFullAgentDefinition: (db: DatabaseClient) => ({ scopes: { tenantId, projectId, agentId }, }: {
1184
- scopes: AgentScopeConfig;
1185
- }) => Promise<FullAgentDefinition | null>;
1186
- /**
1187
- * Upsert an agent (create if it doesn't exist, update if it does)
1188
- */
1189
- declare const upsertAgent: (db: DatabaseClient) => (params: {
1190
- data: AgentInsert;
1191
- }) => Promise<AgentSelect | null>;
1192
-
1193
- declare const getApiKeyById: (db: DatabaseClient) => (params: {
1194
- scopes: ProjectScopeConfig;
1195
- id: string;
1196
- }) => Promise<{
1197
- tenantId: string;
1198
- projectId: string;
1199
- id: string;
1200
- name: string | null;
1201
- agentId: string;
1202
- publicId: string;
1203
- keyHash: string;
1204
- keyPrefix: string;
1205
- lastUsedAt: string | null;
1206
- expiresAt: string | null;
1207
- createdAt: string;
1208
- updatedAt: string;
1209
- } | undefined>;
1210
- declare const getApiKeyByPublicId: (db: DatabaseClient) => (publicId: string) => Promise<{
1211
- tenantId: string;
1212
- projectId: string;
1213
- id: string;
1214
- name: string | null;
1215
- agentId: string;
1216
- publicId: string;
1217
- keyHash: string;
1218
- keyPrefix: string;
1219
- lastUsedAt: string | null;
1220
- expiresAt: string | null;
1221
- createdAt: string;
1222
- updatedAt: string;
1223
- } | undefined>;
1224
- declare const listApiKeys: (db: DatabaseClient) => (params: {
1225
- scopes: ProjectScopeConfig;
1226
- agentId?: string;
1227
- }) => Promise<{
1228
- tenantId: string;
1229
- projectId: string;
1230
- id: string;
1231
- name: string | null;
1232
- agentId: string;
1233
- publicId: string;
1234
- keyHash: string;
1235
- keyPrefix: string;
1236
- lastUsedAt: string | null;
1237
- expiresAt: string | null;
1238
- createdAt: string;
1239
- updatedAt: string;
1240
- }[]>;
1241
- declare const listApiKeysPaginated: (db: DatabaseClient) => (params: {
1242
- scopes: ProjectScopeConfig;
1243
- pagination?: PaginationConfig;
1244
- agentId?: string;
1245
- }) => Promise<{
1246
- data: ApiKeySelect[];
1247
- pagination: {
1248
- page: number;
1249
- limit: number;
1250
- total: number;
1251
- pages: number;
1252
- };
1253
- }>;
1254
- declare const createApiKey: (db: DatabaseClient) => (params: ApiKeyInsert) => Promise<{
1255
- tenantId: string;
1256
- projectId: string;
1257
- id: string;
1258
- name: string | null;
1259
- agentId: string;
1260
- publicId: string;
1261
- keyHash: string;
1262
- keyPrefix: string;
1263
- lastUsedAt: string | null;
1264
- expiresAt: string | null;
1265
- createdAt: string;
1266
- updatedAt: string;
1267
- }>;
1268
- declare const updateApiKey: (db: DatabaseClient) => (params: {
1269
- scopes: ProjectScopeConfig;
1270
- id: string;
1271
- data: ApiKeyUpdate;
1272
- }) => Promise<{
1273
- createdAt: string;
1274
- updatedAt: string;
1275
- publicId: string;
1276
- keyHash: string;
1277
- keyPrefix: string;
1278
- name: string | null;
1279
- lastUsedAt: string | null;
1280
- expiresAt: string | null;
1281
- agentId: string;
1282
- projectId: string;
1283
- tenantId: string;
1284
- id: string;
1285
- }>;
1286
- declare const deleteApiKey: (db: DatabaseClient) => (params: {
1287
- scopes: ProjectScopeConfig;
1288
- id: string;
1289
- }) => Promise<boolean>;
1290
- declare const hasApiKey: (db: DatabaseClient) => (params: {
1291
- scopes: ProjectScopeConfig;
1292
- id: string;
1293
- }) => Promise<boolean>;
1294
- declare const updateApiKeyLastUsed: (db: DatabaseClient) => (id: string) => Promise<void>;
1295
- declare const countApiKeys: (db: DatabaseClient) => (params: {
1296
- scopes: ProjectScopeConfig;
1297
- agentId?: string;
1298
- }) => Promise<number>;
1299
- /**
1300
- * Create a new API key
1301
- * Returns both the API key record and the full key (which should be shown to the user only once)
1302
- */
1303
- declare const generateAndCreateApiKey: (params: CreateApiKeyParams, db: DatabaseClient) => Promise<ApiKeyCreateResult>;
1304
- /**
1305
- * Validate an API key and return the associated record if valid
1306
- */
1307
- declare const validateAndGetApiKey: (key: string, db: DatabaseClient) => Promise<ApiKeySelect | null>;
1308
-
1309
- declare const getArtifactComponentById: (db: DatabaseClient) => (params: {
1310
- scopes: ProjectScopeConfig;
1311
- id: string;
1312
- }) => Promise<{
1313
- tenantId: string;
1314
- projectId: string;
1315
- id: string;
1316
- name: string;
1317
- description: string;
1318
- createdAt: string;
1319
- updatedAt: string;
1320
- props: Record<string, unknown> | null;
1321
- } | undefined>;
1322
- declare const listArtifactComponents: (db: DatabaseClient) => (params: {
1323
- scopes: ProjectScopeConfig;
1324
- }) => Promise<{
1325
- createdAt: string;
1326
- updatedAt: string;
1327
- props: Record<string, unknown> | null;
1328
- name: string;
1329
- description: string;
1330
- projectId: string;
1331
- tenantId: string;
1332
- id: string;
1333
- }[]>;
1334
- declare const listArtifactComponentsPaginated: (db: DatabaseClient) => (params: {
1335
- scopes: ProjectScopeConfig;
1336
- pagination?: PaginationConfig;
1337
- }) => Promise<{
1338
- data: ArtifactComponentSelect[];
1339
- pagination: {
1340
- page: number;
1341
- limit: number;
1342
- total: number;
1343
- pages: number;
1344
- };
1345
- }>;
1346
- declare const createArtifactComponent: (db: DatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
1347
- tenantId: string;
1348
- projectId: string;
1349
- id: string;
1350
- name: string;
1351
- description: string;
1352
- createdAt: string;
1353
- updatedAt: string;
1354
- props: Record<string, unknown> | null;
1355
- }>;
1356
- declare const updateArtifactComponent: (db: DatabaseClient) => (params: {
1357
- scopes: ProjectScopeConfig;
1358
- id: string;
1359
- data: ArtifactComponentUpdate;
1360
- }) => Promise<{
1361
- createdAt: string;
1362
- updatedAt: string;
1363
- props: Record<string, unknown> | null;
1364
- name: string;
1365
- description: string;
1366
- projectId: string;
1367
- tenantId: string;
1368
- id: string;
1369
- }>;
1370
- declare const deleteArtifactComponent: (db: DatabaseClient) => (params: {
1371
- scopes: ProjectScopeConfig;
1372
- id: string;
1373
- }) => Promise<boolean>;
1374
- declare const getArtifactComponentsForAgent: (db: DatabaseClient) => (params: {
1375
- scopes: SubAgentScopeConfig;
1376
- }) => Promise<{
1377
- id: string;
1378
- tenantId: string;
1379
- projectId: string;
1380
- name: string;
1381
- description: string;
1382
- props: Record<string, unknown> | null;
1383
- createdAt: string;
1384
- updatedAt: string;
1385
- }[]>;
1386
- declare const associateArtifactComponentWithAgent: (db: DatabaseClient) => (params: {
1387
- scopes: SubAgentScopeConfig;
1388
- artifactComponentId: string;
1389
- }) => Promise<{
1390
- tenantId: string;
1391
- projectId: string;
1392
- id: string;
1393
- agentId: string;
1394
- createdAt: string;
1395
- subAgentId: string;
1396
- artifactComponentId: string;
1397
- }>;
1398
- declare const removeArtifactComponentFromAgent: (db: DatabaseClient) => (params: {
1399
- scopes: SubAgentScopeConfig;
1400
- artifactComponentId: string;
1401
- }) => Promise<boolean>;
1402
- declare const deleteAgentArtifactComponentRelationByAgent: (db: DatabaseClient) => (params: {
1403
- scopes: SubAgentScopeConfig;
1404
- }) => Promise<boolean>;
1405
- declare const getAgentsUsingArtifactComponent: (db: DatabaseClient) => (params: {
1406
- scopes: ProjectScopeConfig;
1407
- artifactComponentId: string;
1408
- }) => Promise<{
1409
- agentId: string;
1410
- subAgentId: string;
1411
- createdAt: string;
1412
- }[]>;
1413
- declare const isArtifactComponentAssociatedWithAgent: (db: DatabaseClient) => (params: {
1414
- scopes: SubAgentScopeConfig;
1415
- artifactComponentId: string;
1416
- }) => Promise<boolean>;
1417
- declare const agentHasArtifactComponents: (db: DatabaseClient) => (params: {
1418
- scopes: AgentScopeConfig;
1419
- }) => Promise<boolean>;
1420
- declare const countArtifactComponents: (db: DatabaseClient) => (params: {
1421
- scopes: ProjectScopeConfig;
1422
- }) => Promise<number>;
1423
- declare const countArtifactComponentsForAgent: (db: DatabaseClient) => (params: {
1424
- scopes: SubAgentScopeConfig;
1425
- }) => Promise<number>;
1426
- /**
1427
- * Upsert agent-artifact component relation (create if it doesn't exist, no-op if it does)
1428
- */
1429
- declare const upsertAgentArtifactComponentRelation: (db: DatabaseClient) => (params: {
1430
- scopes: SubAgentScopeConfig;
1431
- artifactComponentId: string;
1432
- }) => Promise<{
1433
- tenantId: string;
1434
- projectId: string;
1435
- id: string;
1436
- agentId: string;
1437
- createdAt: string;
1438
- subAgentId: string;
1439
- artifactComponentId: string;
1440
- } | null>;
1441
- /**
1442
- * Upsert an artifact component (create if it doesn't exist, update if it does)
1443
- */
1444
- declare const upsertArtifactComponent: (db: DatabaseClient) => (params: {
1445
- data: ArtifactComponentInsert;
1446
- }) => Promise<ArtifactComponentSelect>;
1447
-
1448
- /**
1449
- * Get cached context data for a conversation with optional request hash validation
1450
- */
1451
- declare const getCacheEntry: (db: DatabaseClient) => (params: {
1452
- conversationId: string;
1453
- contextConfigId: string;
1454
- contextVariableKey: string;
1455
- requestHash?: string;
1456
- }) => Promise<ContextCacheSelect | null>;
1457
- /**
1458
- * Set cached context data for a conversation
1459
- */
1460
- declare const setCacheEntry: (db: DatabaseClient) => (entry: ContextCacheInsert) => Promise<ContextCacheSelect | null>;
1461
- /**
1462
- * Clear cache entries for a specific conversation
1463
- */
1464
- declare const clearConversationCache: (db: DatabaseClient) => (params: {
1465
- scopes: ProjectScopeConfig;
1466
- conversationId: string;
1467
- }) => Promise<number>;
1468
- /**
1469
- * Clear all cache entries for a specific context configuration
1470
- */
1471
- declare const clearContextConfigCache: (db: DatabaseClient) => (params: {
1472
- scopes: ProjectScopeConfig;
1473
- contextConfigId: string;
1474
- }) => Promise<number>;
1475
- /**
1476
- * Clean up all cache entries for a tenant
1477
- */
1478
- declare const cleanupTenantCache: (db: DatabaseClient) => (params: {
1479
- scopes: ProjectScopeConfig;
1480
- }) => Promise<number>;
1481
- /**
1482
- * Invalidate the headers cache for a conversation
1483
- */
1484
- declare const invalidateHeadersCache: (db: DatabaseClient) => (params: {
1485
- scopes: ProjectScopeConfig;
1486
- conversationId: string;
1487
- contextConfigId: string;
1488
- }) => Promise<number>;
1489
- /**
1490
- * Invalidate specific cache entries for invocation-trigger definitions
1491
- */
1492
- declare const invalidateInvocationDefinitionsCache: (db: DatabaseClient) => (params: {
1493
- scopes: ProjectScopeConfig;
1494
- conversationId: string;
1495
- contextConfigId: string;
1496
- invocationDefinitionIds: string[];
1497
- }) => Promise<number>;
1498
- /**
1499
- * Get all cache entries for a conversation
1500
- */
1501
- declare const getConversationCacheEntries: (db: DatabaseClient) => (params: {
1502
- scopes: ProjectScopeConfig;
1503
- conversationId: string;
1504
- }) => Promise<ContextCacheSelect[]>;
1505
- /**
1506
- * Get all cache entries for a context configuration
1507
- */
1508
- declare const getContextConfigCacheEntries: (db: DatabaseClient) => (params: {
1509
- scopes: ProjectScopeConfig;
1510
- contextConfigId: string;
1511
- }) => Promise<ContextCacheSelect[]>;
1512
-
1513
- declare const getContextConfigById: (db: DatabaseClient) => (params: {
1514
- scopes: AgentScopeConfig;
1515
- id: string;
1516
- }) => Promise<{
1517
- tenantId: string;
1518
- projectId: string;
1519
- id: string;
1520
- agentId: string;
1521
- createdAt: string;
1522
- updatedAt: string;
1523
- headersSchema: unknown;
1524
- contextVariables: Record<string, ContextFetchDefinition> | null;
1525
- } | undefined>;
1526
- declare const listContextConfigs: (db: DatabaseClient) => (params: {
1527
- scopes: AgentScopeConfig;
1528
- }) => Promise<{
1529
- tenantId: string;
1530
- projectId: string;
1531
- id: string;
1532
- agentId: string;
1533
- createdAt: string;
1534
- updatedAt: string;
1535
- headersSchema: unknown;
1536
- contextVariables: Record<string, ContextFetchDefinition> | null;
1537
- }[]>;
1538
- declare const listContextConfigsPaginated: (db: DatabaseClient) => (params: {
1539
- scopes: AgentScopeConfig;
1540
- pagination?: PaginationConfig;
1541
- }) => Promise<{
1542
- data: any[];
1543
- pagination: {
1544
- page: number;
1545
- limit: number;
1546
- total: number;
1547
- pages: number;
1548
- };
1549
- }>;
1550
- declare const createContextConfig: (db: DatabaseClient) => (params: ContextConfigInsert) => Promise<{
1551
- tenantId: string;
1552
- projectId: string;
1553
- id: string;
1554
- agentId: string;
1555
- createdAt: string;
1556
- updatedAt: string;
1557
- headersSchema: unknown;
1558
- contextVariables: Record<string, ContextFetchDefinition> | null;
1559
- }>;
1560
- declare const updateContextConfig: (db: DatabaseClient) => (params: {
1561
- scopes: AgentScopeConfig;
1562
- id: string;
1563
- data: Partial<ContextConfigUpdate>;
1564
- }) => Promise<{
1565
- createdAt: string;
1566
- updatedAt: string;
1567
- headersSchema: unknown;
1568
- contextVariables: Record<string, ContextFetchDefinition> | null;
1569
- agentId: string;
1570
- projectId: string;
1571
- tenantId: string;
1572
- id: string;
1573
- }>;
1574
- declare const deleteContextConfig: (db: DatabaseClient) => (params: {
1575
- scopes: AgentScopeConfig;
1576
- id: string;
1577
- }) => Promise<boolean>;
1578
- declare const hasContextConfig: (db: DatabaseClient) => (params: {
1579
- scopes: AgentScopeConfig;
1580
- id: string;
1581
- }) => Promise<boolean>;
1582
- declare const countContextConfigs: (db: DatabaseClient) => (params: {
1583
- scopes: AgentScopeConfig;
1584
- }) => Promise<number>;
1585
- /**
1586
- * Upsert a context config (create if it doesn't exist, update if it does)
1587
- */
1588
- declare const upsertContextConfig: (db: DatabaseClient) => (params: {
1589
- data: ContextConfigInsert;
1590
- }) => Promise<{
1591
- tenantId: string;
1592
- projectId: string;
1593
- id: string;
1594
- agentId: string;
1595
- createdAt: string;
1596
- updatedAt: string;
1597
- headersSchema: unknown;
1598
- contextVariables: Record<string, ContextFetchDefinition> | null;
1599
- }>;
1600
-
1601
- declare const listConversations: (db: DatabaseClient) => (params: {
1602
- scopes: ProjectScopeConfig;
1603
- userId?: string;
1604
- pagination?: PaginationConfig;
1605
- }) => Promise<{
1606
- conversations: ConversationSelect[];
1607
- total: number;
1608
- }>;
1609
- declare const createConversation: (db: DatabaseClient) => (params: ConversationInsert) => Promise<{
1610
- tenantId: string;
1611
- projectId: string;
1612
- id: string;
1613
- title: string | null;
1614
- createdAt: string;
1615
- updatedAt: string;
1616
- metadata: ConversationMetadata | null;
1617
- userId: string | null;
1618
- activeSubAgentId: string;
1619
- lastContextResolution: string | null;
1620
- }>;
1621
- declare const updateConversation: (db: DatabaseClient) => (params: {
1622
- scopes: ProjectScopeConfig;
1623
- conversationId: string;
1624
- data: ConversationUpdate;
1625
- }) => Promise<{
1626
- createdAt: string;
1627
- updatedAt: string;
1628
- userId: string | null;
1629
- activeSubAgentId: string;
1630
- title: string | null;
1631
- lastContextResolution: string | null;
1632
- metadata: ConversationMetadata | null;
1633
- projectId: string;
1634
- tenantId: string;
1635
- id: string;
1636
- }>;
1637
- declare const deleteConversation: (db: DatabaseClient) => (params: {
1638
- scopes: ProjectScopeConfig;
1639
- conversationId: string;
1640
- }) => Promise<boolean>;
1641
- declare const updateConversationActiveAgent: (db: DatabaseClient) => (params: {
1642
- scopes: ProjectScopeConfig;
1643
- conversationId: string;
1644
- activeSubAgentId: string;
1645
- }) => Promise<{
1646
- createdAt: string;
1647
- updatedAt: string;
1648
- userId: string | null;
1649
- activeSubAgentId: string;
1650
- title: string | null;
1651
- lastContextResolution: string | null;
1652
- metadata: ConversationMetadata | null;
1653
- projectId: string;
1654
- tenantId: string;
1655
- id: string;
1656
- }>;
1657
- declare const getConversation: (db: DatabaseClient) => (params: {
1658
- scopes: ProjectScopeConfig;
1659
- conversationId: string;
1660
- }) => Promise<{
1661
- tenantId: string;
1662
- projectId: string;
1663
- id: string;
1664
- title: string | null;
1665
- createdAt: string;
1666
- updatedAt: string;
1667
- metadata: ConversationMetadata | null;
1668
- userId: string | null;
1669
- activeSubAgentId: string;
1670
- lastContextResolution: string | null;
1671
- } | undefined>;
1672
- declare const createOrGetConversation: (db: DatabaseClient) => (input: ConversationInsert) => Promise<{
1673
- activeSubAgentId: string;
1674
- projectId: string;
1675
- tenantId: string;
1676
- id: string;
1677
- createdAt?: string | undefined;
1678
- updatedAt?: string | undefined;
1679
- userId?: string | null | undefined;
1680
- title?: string | null | undefined;
1681
- lastContextResolution?: string | null | undefined;
1682
- metadata?: ConversationMetadata | null | undefined;
1683
- contextConfigId?: string | undefined;
1684
- } | {
1685
- tenantId: string;
1686
- projectId: string;
1687
- id: string;
1688
- title: string | null;
1689
- createdAt: string;
1690
- updatedAt: string;
1691
- metadata: ConversationMetadata | null;
1692
- userId: string | null;
1693
- activeSubAgentId: string;
1694
- lastContextResolution: string | null;
1695
- }>;
1696
- /**
1697
- * Get conversation history with filtering and context management
1698
- */
1699
- declare const getConversationHistory: (db: DatabaseClient) => (params: {
1700
- scopes: ProjectScopeConfig;
1701
- conversationId: string;
1702
- options?: ConversationHistoryConfig;
1703
- }) => Promise<any[]>;
1704
- /**
1705
- * Get active agent for a conversation
1706
- */
1707
- declare const getActiveAgentForConversation: (db: DatabaseClient) => (params: {
1708
- scopes: ProjectScopeConfig;
1709
- conversationId: string;
1710
- }) => Promise<{
1711
- tenantId: string;
1712
- projectId: string;
1713
- id: string;
1714
- title: string | null;
1715
- createdAt: string;
1716
- updatedAt: string;
1717
- metadata: ConversationMetadata | null;
1718
- userId: string | null;
1719
- activeSubAgentId: string;
1720
- lastContextResolution: string | null;
1721
- } | undefined>;
1722
- /**
1723
- * Set active agent for a conversation (upsert operation)
1724
- */
1725
- declare const setActiveAgentForConversation: (db: DatabaseClient) => (params: {
1726
- scopes: ProjectScopeConfig;
1727
- conversationId: string;
1728
- subAgentId: string;
1729
- }) => Promise<void>;
1730
- declare const setActiveAgentForThread: (db: DatabaseClient) => ({ scopes, threadId, subAgentId, }: {
1731
- scopes: ProjectScopeConfig;
1732
- threadId: string;
1733
- subAgentId: string;
1734
- }) => Promise<void>;
1735
-
1736
- type CredentialReferenceWithResources = CredentialReferenceSelect & {
1737
- tools: ToolSelect[];
1738
- externalAgents: ExternalAgentSelect[];
1739
- };
1740
- /**
1741
- * Get a credential reference by ID
1742
- */
1743
- declare const getCredentialReference: (db: DatabaseClient) => (params: {
1744
- scopes: ProjectScopeConfig;
1745
- id: string;
1746
- }) => Promise<CredentialReferenceSelect | undefined>;
1747
- /**
1748
- * Get a credential reference by ID with its related tools
1749
- */
1750
- declare const getCredentialReferenceWithResources: (db: DatabaseClient) => (params: {
1751
- scopes: ProjectScopeConfig;
1752
- id: string;
1753
- }) => Promise<CredentialReferenceWithResources | undefined>;
1754
- /**
1755
- * List all credential references for a tenant/project
1756
- */
1757
- declare const listCredentialReferences: (db: DatabaseClient) => (params: {
1758
- scopes: ProjectScopeConfig;
1759
- }) => Promise<CredentialReferenceSelect[]>;
1760
- /**
1761
- * List credential references with pagination
1762
- */
1763
- declare const listCredentialReferencesPaginated: (db: DatabaseClient) => (params: {
1764
- scopes: ProjectScopeConfig;
1765
- pagination?: PaginationConfig;
1766
- }) => Promise<{
1767
- data: CredentialReferenceSelect[];
1768
- pagination: {
1769
- page: number;
1770
- limit: number;
1771
- total: number;
1772
- pages: number;
1773
- };
1774
- }>;
1775
- /**
1776
- * Create a new credential reference
1777
- */
1778
- declare const createCredentialReference: (db: DatabaseClient) => (params: CredentialReferenceInsert) => Promise<CredentialReferenceSelect>;
1779
- /**
1780
- * Update a credential reference
1781
- */
1782
- declare const updateCredentialReference: (db: DatabaseClient) => (params: {
1783
- scopes: ProjectScopeConfig;
1784
- id: string;
1785
- data: Partial<CredentialReferenceUpdate>;
1786
- }) => Promise<CredentialReferenceWithResources | undefined>;
1787
- /**
1788
- * Delete a credential reference
1789
- */
1790
- declare const deleteCredentialReference: (db: DatabaseClient) => (params: {
1791
- scopes: ProjectScopeConfig;
1792
- id: string;
1793
- }) => Promise<boolean>;
1794
- /**
1795
- * Check if a credential reference exists
1796
- */
1797
- declare const hasCredentialReference: (db: DatabaseClient) => (params: {
1798
- scopes: ProjectScopeConfig;
1799
- id: string;
1800
- }) => Promise<boolean>;
1801
- /**
1802
- * Get credential reference by ID (simple version without tools)
1803
- */
1804
- declare const getCredentialReferenceById: (db: DatabaseClient) => (params: {
1805
- scopes: ProjectScopeConfig;
1806
- id: string;
1807
- }) => Promise<CredentialReferenceSelect | null>;
1808
- /**
1809
- * Count credential references for a tenant/project
1810
- */
1811
- declare const countCredentialReferences: (db: DatabaseClient) => (params: {
1812
- scopes: ProjectScopeConfig;
1813
- }) => Promise<number>;
1814
- /**
1815
- * Upsert a credential reference (create if it doesn't exist, update if it does)
1816
- */
1817
- declare const upsertCredentialReference: (db: DatabaseClient) => (params: {
1818
- data: CredentialReferenceInsert;
1819
- }) => Promise<CredentialReferenceSelect>;
1820
-
1821
- /**
1822
- * Get a data component by ID
1823
- */
1824
- declare const getDataComponent: (db: DatabaseClient) => (params: {
1825
- scopes: ProjectScopeConfig;
1826
- dataComponentId: string;
1827
- }) => Promise<DataComponentSelect | null>;
1828
- /**
1829
- * List all data components for a tenant/project
1830
- */
1831
- declare const listDataComponents: (db: DatabaseClient) => (params: {
1832
- scopes: ProjectScopeConfig;
1833
- }) => Promise<DataComponentSelect[]>;
1834
- /**
1835
- * List data components with pagination
1836
- */
1837
- declare const listDataComponentsPaginated: (db: DatabaseClient) => (params: {
1838
- scopes: ProjectScopeConfig;
1839
- pagination?: PaginationConfig;
1840
- }) => Promise<{
1841
- data: DataComponentSelect[];
1842
- pagination: {
1843
- page: number;
1844
- limit: number;
1845
- total: number;
1846
- pages: number;
1847
- };
1848
- }>;
1849
- /**
1850
- * Create a new data component
1851
- */
1852
- declare const createDataComponent: (db: DatabaseClient) => (params: DataComponentInsert) => Promise<DataComponentSelect>;
1853
- /**
1854
- * Update a data component
1855
- */
1856
- declare const updateDataComponent: (db: DatabaseClient) => (params: {
1857
- scopes: ProjectScopeConfig;
1858
- dataComponentId: string;
1859
- data: DataComponentUpdate;
1860
- }) => Promise<DataComponentSelect | null>;
1861
- /**
1862
- * Delete a data component
1863
- */
1864
- declare const deleteDataComponent: (db: DatabaseClient) => (params: {
1865
- scopes: ProjectScopeConfig;
1866
- dataComponentId: string;
1867
- }) => Promise<boolean>;
1868
- /**
1869
- * Get data components for a specific agent
1870
- */
1871
- declare const getDataComponentsForAgent: (db: DatabaseClient) => (params: {
1872
- scopes: SubAgentScopeConfig;
1873
- }) => Promise<DataComponentSelect[]>;
1874
- /**
1875
- * Associate a data component with an agent
1876
- */
1877
- declare const associateDataComponentWithAgent: (db: DatabaseClient) => (params: {
1878
- scopes: SubAgentScopeConfig;
1879
- dataComponentId: string;
1880
- }) => Promise<{
1881
- tenantId: string;
1882
- projectId: string;
1883
- id: string;
1884
- agentId: string;
1885
- createdAt: string;
1886
- subAgentId: string;
1887
- dataComponentId: string;
1888
- }>;
1889
- /**
1890
- * Remove association between data component and agent
1891
- */
1892
- declare const removeDataComponentFromAgent: (db: DatabaseClient) => (params: {
1893
- scopes: SubAgentScopeConfig;
1894
- dataComponentId: string;
1895
- }) => Promise<boolean>;
1896
- declare const deleteAgentDataComponentRelationByAgent: (db: DatabaseClient) => (params: {
1897
- scopes: SubAgentScopeConfig;
1898
- }) => Promise<boolean>;
1899
- /**
1900
- * Get all agents that use a specific data component
1901
- */
1902
- declare const getAgentsUsingDataComponent: (db: DatabaseClient) => (params: {
1903
- scopes: ProjectScopeConfig;
1904
- dataComponentId: string;
1905
- }) => Promise<{
1906
- subAgentId: string;
1907
- createdAt: string;
1908
- }[]>;
1909
- /**
1910
- * Check if a data component is associated with an agent
1911
- */
1912
- declare const isDataComponentAssociatedWithAgent: (db: DatabaseClient) => (params: {
1913
- scopes: SubAgentScopeConfig;
1914
- dataComponentId: string;
1915
- }) => Promise<boolean>;
1916
- /**
1917
- * Upsert agent-data component relation (create if it doesn't exist, no-op if it does)
1918
- */
1919
- declare const upsertAgentDataComponentRelation: (db: DatabaseClient) => (params: {
1920
- scopes: SubAgentScopeConfig;
1921
- dataComponentId: string;
1922
- }) => Promise<{
1923
- tenantId: string;
1924
- projectId: string;
1925
- id: string;
1926
- agentId: string;
1927
- createdAt: string;
1928
- subAgentId: string;
1929
- dataComponentId: string;
1930
- } | null>;
1931
- /**
1932
- * Count data components for a tenant/project
1933
- */
1934
- declare const countDataComponents: (db: DatabaseClient) => (params: {
1935
- scopes: ProjectScopeConfig;
1936
- }) => Promise<number>;
1937
- /**
1938
- * Upsert a data component (create if it doesn't exist, update if it does)
1939
- */
1940
- declare const upsertDataComponent: (db: DatabaseClient) => (params: {
1941
- data: DataComponentInsert;
1942
- }) => Promise<DataComponentSelect | null>;
1943
-
1944
- /**
1945
- * Create a new external agent
1946
- */
1947
- declare const createExternalAgent: (db: DatabaseClient) => (params: ExternalAgentInsert) => Promise<ExternalAgentSelect>;
1948
- /**
1949
- * Get external agent by ID
1950
- */
1951
- declare const getExternalAgent: (db: DatabaseClient) => (params: {
1952
- scopes: ProjectScopeConfig;
1953
- externalAgentId: string;
1954
- }) => Promise<ExternalAgentSelect | null>;
1955
- /**
1956
- * Get external agent by base URL
1957
- */
1958
- declare const getExternalAgentByUrl: (db: DatabaseClient) => (params: {
1959
- scopes: ProjectScopeConfig;
1960
- baseUrl: string;
1961
- }) => Promise<ExternalAgentSelect | null>;
1962
- /**
1963
- * List external agents for a project
1964
- */
1965
- declare const listExternalAgents: (db: DatabaseClient) => (params: {
1966
- scopes: ProjectScopeConfig;
1967
- }) => Promise<ExternalAgentSelect[]>;
1968
- /**
1969
- * List external agents with pagination
1970
- */
1971
- declare const listExternalAgentsPaginated: (db: DatabaseClient) => (params: {
1972
- scopes: ProjectScopeConfig;
1973
- pagination?: PaginationConfig;
1974
- }) => Promise<{
1975
- data: ExternalAgentSelect[];
1976
- pagination: {
1977
- page: number;
1978
- limit: number;
1979
- total: number;
1980
- pages: number;
1981
- };
1982
- }>;
1983
- /**
1984
- * Update an existing external agent
1985
- */
1986
- declare const updateExternalAgent: (db: DatabaseClient) => (params: {
1987
- scopes: ProjectScopeConfig;
1988
- externalAgentId: string;
1989
- data: Partial<ExternalAgentUpdate>;
1990
- }) => Promise<ExternalAgentSelect | null>;
1991
- /**
1992
- * Upsert external agent (create if it doesn't exist, update if it does)
1993
- */
1994
- declare const upsertExternalAgent: (db: DatabaseClient) => (params: {
1995
- data: ExternalAgentInsert;
1996
- }) => Promise<ExternalAgentSelect>;
1997
- /**
1998
- * Delete an external agent
1999
- */
2000
- declare const deleteExternalAgent: (db: DatabaseClient) => (params: {
2001
- scopes: ProjectScopeConfig;
2002
- externalAgentId: string;
2003
- }) => Promise<boolean>;
2004
- /**
2005
- * Check if an external agent exists
2006
- */
2007
- declare const externalAgentExists: (db: DatabaseClient) => (params: {
2008
- scopes: ProjectScopeConfig;
2009
- externalAgentId: string;
2010
- }) => Promise<boolean>;
2011
- /**
2012
- * Check if an external agent exists by URL
2013
- */
2014
- declare const externalAgentUrlExists: (db: DatabaseClient) => (params: {
2015
- scopes: ProjectScopeConfig;
2016
- baseUrl: string;
2017
- }) => Promise<boolean>;
2018
- /**
2019
- * Count external agents for a project
2020
- */
2021
- declare const countExternalAgents: (db: DatabaseClient) => (params: {
2022
- scopes: ProjectScopeConfig;
2023
- }) => Promise<number>;
2024
-
2025
- /**
2026
- * Create or update a function (project-scoped)
2027
- */
2028
- declare const upsertFunction: (db: DatabaseClient) => (params: {
2029
- data: FunctionApiInsert;
2030
- scopes: ProjectScopeConfig;
2031
- }) => Promise<void>;
2032
- /**
2033
- * Get a function by ID (project-scoped)
2034
- */
2035
- declare const getFunction: (db: DatabaseClient) => (params: {
2036
- functionId: string;
2037
- scopes: ProjectScopeConfig;
2038
- }) => Promise<FunctionApiInsert | null>;
2039
- /**
2040
- * List all functions for a project
2041
- */
2042
- declare const listFunctions: (db: DatabaseClient) => (params: {
2043
- scopes: ProjectScopeConfig;
2044
- }) => Promise<FunctionApiInsert[]>;
2045
- /**
2046
- * Delete a function (project-scoped)
2047
- */
2048
- declare const deleteFunction: (db: DatabaseClient) => (params: {
2049
- functionId: string;
2050
- scopes: ProjectScopeConfig;
2051
- }) => Promise<void>;
2052
-
2053
- /**
2054
- * Get a function tool by ID (agent-scoped)
2055
- */
2056
- declare const getFunctionToolById: (db: DatabaseClient) => (params: {
2057
- scopes: AgentScopeConfig;
2058
- functionToolId: string;
2059
- }) => Promise<{
2060
- createdAt: string;
2061
- updatedAt: string;
2062
- name: string;
2063
- description: string | null;
2064
- functionId: string;
2065
- agentId: string;
2066
- projectId: string;
2067
- tenantId: string;
2068
- id: string;
2069
- }>;
2070
- /**
2071
- * List function tools (agent-scoped)
2072
- */
2073
- declare const listFunctionTools: (db: DatabaseClient) => (params: {
2074
- scopes: AgentScopeConfig;
2075
- pagination?: PaginationConfig;
2076
- }) => Promise<{
2077
- data: {
2078
- createdAt: string;
2079
- updatedAt: string;
2080
- name: string;
2081
- description: string | null;
2082
- functionId: string;
2083
- agentId: string;
2084
- projectId: string;
2085
- tenantId: string;
2086
- id: string;
2087
- }[];
2088
- pagination: {
2089
- page: number;
2090
- limit: number;
2091
- total: number;
2092
- pages: number;
2093
- };
2094
- }>;
2095
- /**
2096
- * Create a function tool (agent-scoped)
2097
- */
2098
- declare const createFunctionTool: (db: DatabaseClient) => (params: {
2099
- data: FunctionToolApiInsert;
2100
- scopes: AgentScopeConfig;
2101
- }) => Promise<{
2102
- tenantId: string;
2103
- projectId: string;
2104
- id: string;
2105
- name: string;
2106
- description: string | null;
2107
- agentId: string;
2108
- createdAt: string;
2109
- updatedAt: string;
2110
- functionId: string;
2111
- }>;
2112
- /**
2113
- * Update a function tool (agent-scoped)
2114
- */
2115
- declare const updateFunctionTool: (db: DatabaseClient) => (params: {
2116
- scopes: AgentScopeConfig;
2117
- functionToolId: string;
2118
- data: FunctionToolApiUpdate;
2119
- }) => Promise<{
2120
- createdAt: string;
2121
- updatedAt: string;
2122
- name: string;
2123
- description: string | null;
2124
- functionId: string;
2125
- agentId: string;
2126
- projectId: string;
2127
- tenantId: string;
2128
- id: string;
2129
- }>;
2130
- /**
2131
- * Delete a function tool (agent-scoped)
2132
- */
2133
- declare const deleteFunctionTool: (db: DatabaseClient) => (params: {
2134
- scopes: AgentScopeConfig;
2135
- functionToolId: string;
2136
- }) => Promise<boolean>;
2137
- /**
2138
- * Upsert a function tool (create if it doesn't exist, update if it does)
2139
- */
2140
- declare const upsertFunctionTool: (db: DatabaseClient) => (params: {
2141
- data: FunctionToolApiInsert;
2142
- scopes: AgentScopeConfig;
2143
- }) => Promise<{
2144
- tenantId: string;
2145
- projectId: string;
2146
- id: string;
2147
- name: string;
2148
- description: string | null;
2149
- agentId: string;
2150
- createdAt: string;
2151
- updatedAt: string;
2152
- functionId: string;
2153
- }>;
2154
- declare const getFunctionToolsForSubAgent: (db: DatabaseClient) => (params: {
2155
- scopes: {
2156
- tenantId: string;
2157
- projectId: string;
2158
- agentId: string;
2159
- };
2160
- subAgentId: string;
2161
- }) => Promise<{
2162
- data: {
2163
- createdAt: string;
2164
- updatedAt: string;
2165
- name: string;
2166
- description: string | null;
2167
- functionId: string;
2168
- agentId: string;
2169
- projectId: string;
2170
- tenantId: string;
2171
- id: string;
2172
- }[];
2173
- pagination: {
2174
- page: number;
2175
- limit: number;
2176
- total: number;
2177
- pages: number;
2178
- };
2179
- }>;
2180
- /**
2181
- * Upsert a sub_agent-function tool relation (create if it doesn't exist, update if it does)
2182
- */
2183
- declare const upsertSubAgentFunctionToolRelation: (db: DatabaseClient) => (params: {
2184
- scopes: AgentScopeConfig;
2185
- subAgentId: string;
2186
- functionToolId: string;
2187
- relationId?: string;
2188
- }) => Promise<{
2189
- id: string;
2190
- }>;
2191
- /**
2192
- * Add a function tool to an agent
2193
- */
2194
- declare const addFunctionToolToSubAgent: (db: DatabaseClient) => (params: {
2195
- scopes: AgentScopeConfig;
2196
- subAgentId: string;
2197
- functionToolId: string;
2198
- }) => Promise<{
2199
- id: string;
2200
- }>;
2201
- /**
2202
- * Update an agent-function tool relation
2203
- */
2204
- declare const updateSubAgentFunctionToolRelation: (db: DatabaseClient) => (params: {
2205
- scopes: AgentScopeConfig;
2206
- relationId: string;
2207
- data: {
2208
- subAgentId: string;
2209
- functionToolId: string;
2210
- };
2211
- }) => Promise<{
2212
- id: string;
2213
- }>;
2214
-
2215
- /**
2216
- * Atomic upsert operation for a single artifact - prevents race conditions
2217
- */
2218
- declare const upsertLedgerArtifact: (db: DatabaseClient) => (params: {
2219
- scopes: ProjectScopeConfig;
2220
- contextId: string;
2221
- taskId: string;
2222
- toolCallId?: string | null;
2223
- artifact: Artifact;
2224
- }) => Promise<{
2225
- created: boolean;
2226
- existing?: any;
2227
- }>;
2228
- /**
2229
- * Save one or more artifacts to the ledger
2230
- */
2231
- declare const addLedgerArtifacts: (db: DatabaseClient) => (params: {
2232
- scopes: ProjectScopeConfig;
2233
- contextId: string;
2234
- taskId?: string | null;
2235
- toolCallId?: string | null;
2236
- artifacts: Artifact[];
2237
- }) => Promise<void>;
2238
- /**
2239
- * Retrieve artifacts by taskId, toolCallId, and/or artifactId.
2240
- * At least one of taskId, toolCallId, or artifactId must be provided.
2241
- */
2242
- declare const getLedgerArtifacts: (db: DatabaseClient) => (params: {
2243
- scopes: ProjectScopeConfig;
2244
- taskId?: string;
2245
- toolCallId?: string;
2246
- artifactId?: string;
2247
- }) => Promise<Artifact[]>;
2248
- /**
2249
- * Get ledger artifacts by context ID
2250
- */
2251
- declare const getLedgerArtifactsByContext: (db: DatabaseClient) => (params: {
2252
- scopes: ProjectScopeConfig;
2253
- contextId: string;
2254
- }) => Promise<LedgerArtifactSelect[]>;
2255
- /**
2256
- * Delete ledger artifacts by task ID
2257
- */
2258
- declare const deleteLedgerArtifactsByTask: (db: DatabaseClient) => (params: {
2259
- scopes: ProjectScopeConfig;
2260
- taskId: string;
2261
- }) => Promise<boolean>;
2262
- /**
2263
- * Delete ledger artifacts by context ID
2264
- */
2265
- declare const deleteLedgerArtifactsByContext: (db: DatabaseClient) => (params: {
2266
- scopes: ProjectScopeConfig;
2267
- contextId: string;
2268
- }) => Promise<boolean>;
2269
- /**
2270
- * Count ledger artifacts by task ID
2271
- */
2272
- declare const countLedgerArtifactsByTask: (db: DatabaseClient) => (params: {
2273
- scopes: ProjectScopeConfig;
2274
- taskId: string;
2275
- }) => Promise<number>;
2276
-
2277
- declare const getMessageById: (db: DatabaseClient) => (params: {
2278
- scopes: ProjectScopeConfig;
2279
- messageId: string;
2280
- }) => Promise<{
2281
- tenantId: string;
2282
- projectId: string;
2283
- id: string;
2284
- createdAt: string;
2285
- updatedAt: string;
2286
- metadata: MessageMetadata | null;
2287
- content: MessageContent;
2288
- role: string;
2289
- conversationId: string;
2290
- fromSubAgentId: string | null;
2291
- toSubAgentId: string | null;
2292
- fromExternalAgentId: string | null;
2293
- toExternalAgentId: string | null;
2294
- fromTeamAgentId: string | null;
2295
- toTeamAgentId: string | null;
2296
- visibility: string;
2297
- messageType: string;
2298
- taskId: string | null;
2299
- parentMessageId: string | null;
2300
- a2aTaskId: string | null;
2301
- a2aSessionId: string | null;
2302
- } | undefined>;
2303
- declare const listMessages: (db: DatabaseClient) => (params: {
2304
- scopes: ProjectScopeConfig;
2305
- pagination: PaginationConfig;
2306
- }) => Promise<{
2307
- createdAt: string;
2308
- updatedAt: string;
2309
- conversationId: string;
2310
- role: string;
2311
- fromSubAgentId: string | null;
2312
- toSubAgentId: string | null;
2313
- fromExternalAgentId: string | null;
2314
- toExternalAgentId: string | null;
2315
- fromTeamAgentId: string | null;
2316
- toTeamAgentId: string | null;
2317
- content: MessageContent;
2318
- visibility: string;
2319
- messageType: string;
2320
- taskId: string | null;
2321
- parentMessageId: string | null;
2322
- a2aTaskId: string | null;
2323
- a2aSessionId: string | null;
2324
- metadata: MessageMetadata | null;
2325
- projectId: string;
2326
- tenantId: string;
2327
- id: string;
2328
- }[]>;
2329
- declare const getMessagesByConversation: (db: DatabaseClient) => (params: {
2330
- scopes: ProjectScopeConfig;
2331
- conversationId: string;
2332
- pagination: PaginationConfig;
2333
- }) => Promise<{
2334
- createdAt: string;
2335
- updatedAt: string;
2336
- conversationId: string;
2337
- role: string;
2338
- fromSubAgentId: string | null;
2339
- toSubAgentId: string | null;
2340
- fromExternalAgentId: string | null;
2341
- toExternalAgentId: string | null;
2342
- fromTeamAgentId: string | null;
2343
- toTeamAgentId: string | null;
2344
- content: MessageContent;
2345
- visibility: string;
2346
- messageType: string;
2347
- taskId: string | null;
2348
- parentMessageId: string | null;
2349
- a2aTaskId: string | null;
2350
- a2aSessionId: string | null;
2351
- metadata: MessageMetadata | null;
2352
- projectId: string;
2353
- tenantId: string;
2354
- id: string;
2355
- }[]>;
2356
- declare const getMessagesByTask: (db: DatabaseClient) => (params: {
2357
- scopes: ProjectScopeConfig;
2358
- taskId: string;
2359
- pagination: PaginationConfig;
2360
- }) => Promise<{
2361
- createdAt: string;
2362
- updatedAt: string;
2363
- conversationId: string;
2364
- role: string;
2365
- fromSubAgentId: string | null;
2366
- toSubAgentId: string | null;
2367
- fromExternalAgentId: string | null;
2368
- toExternalAgentId: string | null;
2369
- fromTeamAgentId: string | null;
2370
- toTeamAgentId: string | null;
2371
- content: MessageContent;
2372
- visibility: string;
2373
- messageType: string;
2374
- taskId: string | null;
2375
- parentMessageId: string | null;
2376
- a2aTaskId: string | null;
2377
- a2aSessionId: string | null;
2378
- metadata: MessageMetadata | null;
2379
- projectId: string;
2380
- tenantId: string;
2381
- id: string;
2382
- }[]>;
2383
- declare const getVisibleMessages: (db: DatabaseClient) => (params: {
2384
- scopes: ProjectScopeConfig;
2385
- conversationId: string;
2386
- visibility?: MessageVisibility[];
2387
- pagination: PaginationConfig;
2388
- }) => Promise<{
2389
- createdAt: string;
2390
- updatedAt: string;
2391
- conversationId: string;
2392
- role: string;
2393
- fromSubAgentId: string | null;
2394
- toSubAgentId: string | null;
2395
- fromExternalAgentId: string | null;
2396
- toExternalAgentId: string | null;
2397
- fromTeamAgentId: string | null;
2398
- toTeamAgentId: string | null;
2399
- content: MessageContent;
2400
- visibility: string;
2401
- messageType: string;
2402
- taskId: string | null;
2403
- parentMessageId: string | null;
2404
- a2aTaskId: string | null;
2405
- a2aSessionId: string | null;
2406
- metadata: MessageMetadata | null;
2407
- projectId: string;
2408
- tenantId: string;
2409
- id: string;
2410
- }[]>;
2411
- declare const createMessage: (db: DatabaseClient) => (params: MessageInsert) => Promise<{
2412
- tenantId: string;
2413
- projectId: string;
2414
- id: string;
2415
- createdAt: string;
2416
- updatedAt: string;
2417
- metadata: MessageMetadata | null;
2418
- content: MessageContent;
2419
- role: string;
2420
- conversationId: string;
2421
- fromSubAgentId: string | null;
2422
- toSubAgentId: string | null;
2423
- fromExternalAgentId: string | null;
2424
- toExternalAgentId: string | null;
2425
- fromTeamAgentId: string | null;
2426
- toTeamAgentId: string | null;
2427
- visibility: string;
2428
- messageType: string;
2429
- taskId: string | null;
2430
- parentMessageId: string | null;
2431
- a2aTaskId: string | null;
2432
- a2aSessionId: string | null;
2433
- }>;
2434
- declare const updateMessage: (db: DatabaseClient) => (params: {
2435
- scopes: ProjectScopeConfig;
2436
- messageId: string;
2437
- data: MessageUpdate;
2438
- }) => Promise<{
2439
- createdAt: string;
2440
- updatedAt: string;
2441
- conversationId: string;
2442
- role: string;
2443
- fromSubAgentId: string | null;
2444
- toSubAgentId: string | null;
2445
- fromExternalAgentId: string | null;
2446
- toExternalAgentId: string | null;
2447
- fromTeamAgentId: string | null;
2448
- toTeamAgentId: string | null;
2449
- content: MessageContent;
2450
- visibility: string;
2451
- messageType: string;
2452
- taskId: string | null;
2453
- parentMessageId: string | null;
2454
- a2aTaskId: string | null;
2455
- a2aSessionId: string | null;
2456
- metadata: MessageMetadata | null;
2457
- projectId: string;
2458
- tenantId: string;
2459
- id: string;
2460
- }>;
2461
- declare const deleteMessage: (db: DatabaseClient) => (params: {
2462
- scopes: ProjectScopeConfig;
2463
- messageId: string;
2464
- }) => Promise<{
2465
- tenantId: string;
2466
- projectId: string;
2467
- id: string;
2468
- createdAt: string;
2469
- updatedAt: string;
2470
- metadata: MessageMetadata | null;
2471
- content: MessageContent;
2472
- role: string;
2473
- conversationId: string;
2474
- fromSubAgentId: string | null;
2475
- toSubAgentId: string | null;
2476
- fromExternalAgentId: string | null;
2477
- toExternalAgentId: string | null;
2478
- fromTeamAgentId: string | null;
2479
- toTeamAgentId: string | null;
2480
- visibility: string;
2481
- messageType: string;
2482
- taskId: string | null;
2483
- parentMessageId: string | null;
2484
- a2aTaskId: string | null;
2485
- a2aSessionId: string | null;
2486
- }>;
2487
- declare const countMessagesByConversation: (db: DatabaseClient) => (params: {
2488
- scopes: ProjectScopeConfig;
2489
- conversationId: string;
2490
- }) => Promise<number>;
2491
-
2492
- declare const UserSelectSchema: drizzle_zod.BuildSchema<"select", {
2493
- id: drizzle_orm_pg_core.PgColumn<{
2494
- name: "id";
2495
- tableName: "user";
2496
- dataType: "string";
2497
- columnType: "PgText";
2498
- data: string;
2499
- driverParam: string;
2500
- notNull: true;
2501
- hasDefault: false;
2502
- isPrimaryKey: true;
2503
- isAutoincrement: false;
2504
- hasRuntimeDefault: false;
2505
- enumValues: [string, ...string[]];
2506
- baseColumn: never;
2507
- identity: undefined;
2508
- generated: undefined;
2509
- }, {}, {}>;
2510
- name: drizzle_orm_pg_core.PgColumn<{
2511
- name: "name";
2512
- tableName: "user";
2513
- dataType: "string";
2514
- columnType: "PgText";
2515
- data: string;
2516
- driverParam: string;
2517
- notNull: true;
2518
- hasDefault: false;
2519
- isPrimaryKey: false;
2520
- isAutoincrement: false;
2521
- hasRuntimeDefault: false;
2522
- enumValues: [string, ...string[]];
2523
- baseColumn: never;
2524
- identity: undefined;
2525
- generated: undefined;
2526
- }, {}, {}>;
2527
- email: drizzle_orm_pg_core.PgColumn<{
2528
- name: "email";
2529
- tableName: "user";
2530
- dataType: "string";
2531
- columnType: "PgText";
2532
- data: string;
2533
- driverParam: string;
2534
- notNull: true;
2535
- hasDefault: false;
2536
- isPrimaryKey: false;
2537
- isAutoincrement: false;
2538
- hasRuntimeDefault: false;
2539
- enumValues: [string, ...string[]];
2540
- baseColumn: never;
2541
- identity: undefined;
2542
- generated: undefined;
2543
- }, {}, {}>;
2544
- emailVerified: drizzle_orm_pg_core.PgColumn<{
2545
- name: "email_verified";
2546
- tableName: "user";
2547
- dataType: "boolean";
2548
- columnType: "PgBoolean";
2549
- data: boolean;
2550
- driverParam: boolean;
2551
- notNull: true;
2552
- hasDefault: true;
2553
- isPrimaryKey: false;
2554
- isAutoincrement: false;
2555
- hasRuntimeDefault: false;
2556
- enumValues: undefined;
2557
- baseColumn: never;
2558
- identity: undefined;
2559
- generated: undefined;
2560
- }, {}, {}>;
2561
- image: drizzle_orm_pg_core.PgColumn<{
2562
- name: "image";
2563
- tableName: "user";
2564
- dataType: "string";
2565
- columnType: "PgText";
2566
- data: string;
2567
- driverParam: string;
2568
- notNull: false;
2569
- hasDefault: false;
2570
- isPrimaryKey: false;
2571
- isAutoincrement: false;
2572
- hasRuntimeDefault: false;
2573
- enumValues: [string, ...string[]];
2574
- baseColumn: never;
2575
- identity: undefined;
2576
- generated: undefined;
2577
- }, {}, {}>;
2578
- createdAt: drizzle_orm_pg_core.PgColumn<{
2579
- name: "created_at";
2580
- tableName: "user";
2581
- dataType: "date";
2582
- columnType: "PgTimestamp";
2583
- data: Date;
2584
- driverParam: string;
2585
- notNull: true;
2586
- hasDefault: true;
2587
- isPrimaryKey: false;
2588
- isAutoincrement: false;
2589
- hasRuntimeDefault: false;
2590
- enumValues: undefined;
2591
- baseColumn: never;
2592
- identity: undefined;
2593
- generated: undefined;
2594
- }, {}, {}>;
2595
- updatedAt: drizzle_orm_pg_core.PgColumn<{
2596
- name: "updated_at";
2597
- tableName: "user";
2598
- dataType: "date";
2599
- columnType: "PgTimestamp";
2600
- data: Date;
2601
- driverParam: string;
2602
- notNull: true;
2603
- hasDefault: true;
2604
- isPrimaryKey: false;
2605
- isAutoincrement: false;
2606
- hasRuntimeDefault: false;
2607
- enumValues: undefined;
2608
- baseColumn: never;
2609
- identity: undefined;
2610
- generated: undefined;
2611
- }, {}, {}>;
2612
- }, undefined, undefined>;
2613
- declare const UserOrganizationSchema: z.ZodObject<{
2614
- id: z.ZodString;
2615
- userId: z.ZodString;
2616
- organizationId: z.ZodString;
2617
- role: z.ZodString;
2618
- createdAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodDate]>, z.ZodTransform<string, string | Date>>;
2619
- organizationName: z.ZodNullable<z.ZodString>;
2620
- organizationSlug: z.ZodNullable<z.ZodString>;
2621
- }, z.core.$strip>;
2622
- type User = z.infer<typeof UserSelectSchema>;
2623
- type UserOrganization = z.infer<typeof UserOrganizationSchema>;
2624
-
2625
- /**
2626
- * Organization and Member data access layer
2627
- * All database queries for Better Auth's organization/member tables
2628
- */
2629
- /**
2630
- * Get all organizations for a user
2631
- * Queries Better Auth's member and organization tables
2632
- * Returns Date for createdAt (converted to string at API boundary)
2633
- */
2634
- declare const getUserOrganizations: (db: DatabaseClient) => (userId: string) => Promise<Array<Omit<UserOrganization, "createdAt"> & {
2635
- createdAt: Date;
2636
- }>>;
2637
- /**
2638
- * Get pending invitations for a user by email
2639
- * Returns invitations with status 'pending' that haven't expired
2640
- */
2641
- declare const getPendingInvitationsByEmail: (db: DatabaseClient) => (email: string) => Promise<{
2642
- id: string;
2643
- email: string;
2644
- organizationId: string;
2645
- organizationName: string | null;
2646
- organizationSlug: string | null;
2647
- role: string | null;
2648
- status: string;
2649
- expiresAt: Date;
2650
- inviterId: string;
2651
- }[]>;
2652
- /**
2653
- * Add user to organization
2654
- * Directly inserts into Better Auth's member table
2655
- */
2656
- declare const addUserToOrganization: (db: DatabaseClient) => (data: {
2657
- userId: string;
2658
- organizationId: string;
2659
- role: string;
2660
- }) => Promise<void>;
2661
-
2662
- /**
2663
- * Server-side data access layer for Full Project operations.
2664
- * This module provides functions for creating, retrieving, updating, and deleting
2665
- * complete project definitions with all nested resources (Agents, Sub Agents, tools, etc.).
2666
- */
2667
-
2668
- type ProjectLogger = ReturnType<typeof getLogger>;
2669
- /**
2670
- * Server-side implementation of createFullProject that performs actual database operations.
2671
- * This function creates a complete project with all agent and their nested resources.
2672
- */
2673
- declare const createFullProjectServerSide: (db: DatabaseClient, logger?: ProjectLogger) => (scopes: ProjectScopeConfig, projectData: FullProjectDefinition) => Promise<FullProjectDefinition>;
2674
- /**
2675
- * Server-side implementation of updateFullProject that performs actual database operations.
2676
- * This function updates a complete project with all agent and their nested resources.
2677
- */
2678
- declare const updateFullProjectServerSide: (db: DatabaseClient, logger?: ProjectLogger) => (scopes: ProjectScopeConfig, projectData: FullProjectDefinition) => Promise<FullProjectDefinition>;
2679
- /**
2680
- * Get a complete project definition with all nested resources
2681
- */
2682
- declare const getFullProject: (db: DatabaseClient, logger?: ProjectLogger) => (params: {
2683
- scopes: ProjectScopeConfig;
2684
- }) => Promise<FullProjectDefinition | null>;
2685
- /**
2686
- * Delete a complete project and cascade to all related entities
2687
- */
2688
- declare const deleteFullProject: (db: DatabaseClient, logger?: ProjectLogger) => (params: {
2689
- scopes: ProjectScopeConfig;
2690
- }) => Promise<boolean>;
2691
-
2692
- /**
2693
- * List all unique project IDs within a tenant by scanning all resource tables
2694
- */
2695
- declare const listProjects: (db: DatabaseClient) => (params: {
2696
- tenantId: string;
2697
- }) => Promise<ProjectInfo[]>;
2698
- /**
2699
- * List all unique project IDs within a tenant with pagination
2700
- */
2701
- declare const listProjectsPaginated: (db: DatabaseClient) => (params: {
2702
- tenantId: string;
2703
- pagination?: PaginationConfig;
2704
- }) => Promise<{
2705
- data: ProjectSelect[];
2706
- pagination: PaginationResult;
2707
- }>;
2708
- /**
2709
- * Get resource counts for a specific project
2710
- */
2711
- declare const getProjectResourceCounts: (db: DatabaseClient) => (params: ProjectScopeConfig) => Promise<ProjectResourceCounts>;
2712
- /**
2713
- * Check if a project exists (has any resources)
2714
- */
2715
- declare const projectExists: (db: DatabaseClient) => (params: ProjectScopeConfig) => Promise<boolean>;
2716
- /**
2717
- * Count total projects for a tenant
2718
- */
2719
- declare const countProjects: (db: DatabaseClient) => (params: {
2720
- tenantId: string;
2721
- }) => Promise<number>;
2722
- /**
2723
- * Get a single project by ID
2724
- */
2725
- declare const getProject: (db: DatabaseClient) => (params: {
2726
- scopes: ProjectScopeConfig;
2727
- }) => Promise<ProjectSelect | null>;
2728
- /**
2729
- * Create a new project
2730
- */
2731
- declare const createProject: (db: DatabaseClient) => (params: ProjectInsert) => Promise<ProjectSelect>;
2732
- /**
2733
- * Update an existing project
2734
- */
2735
- declare const updateProject: (db: DatabaseClient) => (params: {
2736
- scopes: ProjectScopeConfig;
2737
- data: ProjectUpdate;
2738
- }) => Promise<ProjectSelect | null>;
2739
- /**
2740
- * Check if a project exists in the projects table
2741
- */
2742
- declare const projectExistsInTable: (db: DatabaseClient) => (params: {
2743
- scopes: ProjectScopeConfig;
2744
- }) => Promise<boolean>;
2745
- /**
2746
- * Check if a project has any resources (used before deletion)
2747
- */
2748
- declare const projectHasResources: (db: DatabaseClient) => (params: ProjectScopeConfig) => Promise<boolean>;
2749
- /**
2750
- * Delete a project (with validation for existing resources)
2751
- */
2752
- declare const deleteProject: (db: DatabaseClient) => (params: {
2753
- scopes: ProjectScopeConfig;
2754
- }) => Promise<boolean>;
2755
-
2756
- declare const getSubAgentExternalAgentRelationById: (db: DatabaseClient) => (params: {
2757
- scopes: SubAgentScopeConfig;
2758
- relationId: string;
2759
- }) => Promise<{
2760
- tenantId: string;
2761
- projectId: string;
2762
- id: string;
2763
- agentId: string;
2764
- createdAt: string;
2765
- updatedAt: string;
2766
- headers: Record<string, string> | null;
2767
- externalAgentId: string;
2768
- subAgentId: string;
2769
- } | undefined>;
2770
- declare const listSubAgentExternalAgentRelations: (db: DatabaseClient) => (params: {
2771
- scopes: SubAgentScopeConfig;
2772
- pagination?: PaginationConfig;
2773
- }) => Promise<{
2774
- data: {
2775
- createdAt: string;
2776
- updatedAt: string;
2777
- externalAgentId: string;
2778
- headers: Record<string, string> | null;
2779
- subAgentId: string;
2780
- agentId: string;
2781
- projectId: string;
2782
- tenantId: string;
2783
- id: string;
2784
- }[];
2785
- pagination: {
2786
- page: number;
2787
- limit: number;
2788
- total: number;
2789
- pages: number;
2790
- };
2791
- }>;
2792
- declare const getSubAgentExternalAgentRelations: (db: DatabaseClient) => (params: {
2793
- scopes: SubAgentScopeConfig;
2794
- }) => Promise<{
2795
- tenantId: string;
2796
- projectId: string;
2797
- id: string;
2798
- agentId: string;
2799
- createdAt: string;
2800
- updatedAt: string;
2801
- headers: Record<string, string> | null;
2802
- externalAgentId: string;
2803
- subAgentId: string;
2804
- }[]>;
2805
- declare const getSubAgentExternalAgentRelationsByAgent: (db: DatabaseClient) => (params: {
2806
- scopes: AgentScopeConfig;
2807
- }) => Promise<{
2808
- tenantId: string;
2809
- projectId: string;
2810
- id: string;
2811
- agentId: string;
2812
- createdAt: string;
2813
- updatedAt: string;
2814
- headers: Record<string, string> | null;
2815
- externalAgentId: string;
2816
- subAgentId: string;
2817
- }[]>;
2818
- declare const getSubAgentExternalAgentRelationsByExternalAgent: (db: DatabaseClient) => (params: {
2819
- scopes: AgentScopeConfig;
2820
- externalAgentId: string;
2821
- pagination?: PaginationConfig;
2822
- }) => Promise<{
2823
- data: {
2824
- createdAt: string;
2825
- updatedAt: string;
2826
- externalAgentId: string;
2827
- headers: Record<string, string> | null;
2828
- subAgentId: string;
2829
- agentId: string;
2830
- projectId: string;
2831
- tenantId: string;
2832
- id: string;
2833
- }[];
2834
- pagination: {
2835
- page: number;
2836
- limit: number;
2837
- total: number;
2838
- pages: number;
2839
- };
2840
- }>;
2841
- declare const getExternalAgentsForSubAgent: (db: DatabaseClient) => (params: {
2842
- scopes: SubAgentScopeConfig;
2843
- pagination?: PaginationConfig;
2844
- }) => Promise<{
2845
- data: {
2846
- id: string;
2847
- tenantId: string;
2848
- projectId: string;
2849
- agentId: string;
2850
- subAgentId: string;
2851
- externalAgentId: string;
2852
- headers: Record<string, string> | null;
2853
- createdAt: string;
2854
- updatedAt: string;
2855
- externalAgent: {
2856
- id: string;
2857
- name: string;
2858
- description: string;
2859
- baseUrl: string;
2860
- credentialReferenceId: string | null;
2861
- tenantId: string;
2862
- projectId: string;
2863
- createdAt: string;
2864
- updatedAt: string;
2865
- };
2866
- }[];
2867
- pagination: {
2868
- page: number;
2869
- limit: number;
2870
- total: number;
2871
- pages: number;
2872
- };
2873
- }>;
2874
- declare const getSubAgentsForExternalAgent: (db: DatabaseClient) => (params: {
2875
- scopes: AgentScopeConfig;
2876
- externalAgentId: string;
2877
- pagination?: PaginationConfig;
2878
- }) => Promise<{
2879
- data: {
2880
- id: string;
2881
- tenantId: string;
2882
- projectId: string;
2883
- agentId: string;
2884
- subAgentId: string;
2885
- externalAgentId: string;
2886
- headers: Record<string, string> | null;
2887
- createdAt: string;
2888
- updatedAt: string;
2889
- subAgent: {
2890
- id: string;
2891
- name: string;
2892
- description: string;
2893
- prompt: string;
2894
- conversationHistoryConfig: ConversationHistoryConfig | null;
2895
- models: {
2896
- base?: {
2897
- model?: string | undefined;
2898
- providerOptions?: Record<string, any> | undefined;
2899
- } | undefined;
2900
- structuredOutput?: {
2901
- model?: string | undefined;
2902
- providerOptions?: Record<string, any> | undefined;
2903
- } | undefined;
2904
- summarizer?: {
2905
- model?: string | undefined;
2906
- providerOptions?: Record<string, any> | undefined;
2907
- } | undefined;
2908
- } | null;
2909
- stopWhen: {
2910
- stepCountIs?: number | undefined;
2911
- } | null;
2912
- createdAt: string;
2913
- updatedAt: string;
2914
- };
2915
- }[];
2916
- pagination: {
2917
- page: number;
2918
- limit: number;
2919
- total: number;
2920
- pages: number;
2921
- };
2922
- }>;
2923
- declare const createSubAgentExternalAgentRelation: (db: DatabaseClient) => (params: {
2924
- scopes: SubAgentScopeConfig;
2925
- relationId?: string;
2926
- data: {
2927
- externalAgentId: string;
2928
- headers?: Record<string, string> | null;
2929
- };
2930
- }) => Promise<{
2931
- tenantId: string;
2932
- projectId: string;
2933
- id: string;
2934
- agentId: string;
2935
- createdAt: string;
2936
- updatedAt: string;
2937
- headers: Record<string, string> | null;
2938
- externalAgentId: string;
2939
- subAgentId: string;
2940
- }>;
2941
- /**
2942
- * Check if sub-agent external agent relation exists by params
2943
- */
2944
- declare const getSubAgentExternalAgentRelationByParams: (db: DatabaseClient) => (params: {
2945
- scopes: SubAgentScopeConfig;
2946
- externalAgentId: string;
2947
- }) => Promise<{
2948
- tenantId: string;
2949
- projectId: string;
2950
- id: string;
2951
- agentId: string;
2952
- createdAt: string;
2953
- updatedAt: string;
2954
- headers: Record<string, string> | null;
2955
- externalAgentId: string;
2956
- subAgentId: string;
2957
- } | undefined>;
2958
- /**
2959
- * Upsert sub-agent external agent relation (create if it doesn't exist, update if it does)
2960
- */
2961
- declare const upsertSubAgentExternalAgentRelation: (db: DatabaseClient) => (params: {
2962
- scopes: SubAgentScopeConfig;
2963
- relationId?: string;
2964
- data: {
2965
- externalAgentId: string;
2966
- headers?: Record<string, string> | null;
2967
- };
2968
- }) => Promise<{
2969
- tenantId: string;
2970
- projectId: string;
2971
- id: string;
2972
- agentId: string;
2973
- createdAt: string;
2974
- updatedAt: string;
2975
- headers: Record<string, string> | null;
2976
- externalAgentId: string;
2977
- subAgentId: string;
2978
- }>;
2979
- declare const updateSubAgentExternalAgentRelation: (db: DatabaseClient) => (params: {
2980
- scopes: SubAgentScopeConfig;
2981
- relationId: string;
2982
- data: Partial<SubAgentExternalAgentRelationInsert>;
2983
- }) => Promise<{
2984
- createdAt: string;
2985
- updatedAt: string;
2986
- externalAgentId: string;
2987
- headers: Record<string, string> | null;
2988
- subAgentId: string;
2989
- agentId: string;
2990
- projectId: string;
2991
- tenantId: string;
2992
- id: string;
2993
- }>;
2994
- declare const deleteSubAgentExternalAgentRelation: (db: DatabaseClient) => (params: {
2995
- scopes: SubAgentScopeConfig;
2996
- relationId: string;
2997
- }) => Promise<boolean>;
2998
- declare const deleteSubAgentExternalAgentRelationsBySubAgent: (db: DatabaseClient) => (params: {
2999
- scopes: SubAgentScopeConfig;
3000
- }) => Promise<boolean>;
3001
- declare const deleteSubAgentExternalAgentRelationsByAgent: (db: DatabaseClient) => (params: {
3002
- scopes: AgentScopeConfig;
3003
- }) => Promise<boolean>;
3004
-
3005
- declare const getAgentRelationById: (db: DatabaseClient) => (params: {
3006
- scopes: AgentScopeConfig;
3007
- relationId: string;
3008
- }) => Promise<{
3009
- tenantId: string;
3010
- projectId: string;
3011
- id: string;
3012
- agentId: string;
3013
- createdAt: string;
3014
- updatedAt: string;
3015
- sourceSubAgentId: string;
3016
- targetSubAgentId: string | null;
3017
- relationType: string | null;
3018
- } | undefined>;
3019
- declare const listAgentRelations: (db: DatabaseClient) => (params: {
3020
- scopes: AgentScopeConfig;
3021
- pagination?: PaginationConfig;
3022
- }) => Promise<{
3023
- data: {
3024
- createdAt: string;
3025
- updatedAt: string;
3026
- sourceSubAgentId: string;
3027
- targetSubAgentId: string | null;
3028
- relationType: string | null;
3029
- agentId: string;
3030
- projectId: string;
3031
- tenantId: string;
3032
- id: string;
3033
- }[];
3034
- pagination: {
3035
- page: number;
3036
- limit: number;
3037
- total: number;
3038
- pages: number;
3039
- };
3040
- }>;
3041
- declare const getAgentRelations: (db: DatabaseClient) => (params: {
3042
- scopes: SubAgentScopeConfig;
3043
- }) => Promise<{
3044
- tenantId: string;
3045
- projectId: string;
3046
- id: string;
3047
- agentId: string;
3048
- createdAt: string;
3049
- updatedAt: string;
3050
- sourceSubAgentId: string;
3051
- targetSubAgentId: string | null;
3052
- relationType: string | null;
3053
- }[]>;
3054
- declare const getAgentRelationsByAgent: (db: DatabaseClient) => (params: {
3055
- scopes: AgentScopeConfig;
3056
- }) => Promise<{
3057
- tenantId: string;
3058
- projectId: string;
3059
- id: string;
3060
- agentId: string;
3061
- createdAt: string;
3062
- updatedAt: string;
3063
- sourceSubAgentId: string;
3064
- targetSubAgentId: string | null;
3065
- relationType: string | null;
3066
- }[]>;
3067
- declare const getAgentRelationsBySource: (db: DatabaseClient) => (params: {
3068
- scopes: AgentScopeConfig;
3069
- sourceSubAgentId: string;
3070
- pagination?: PaginationConfig;
3071
- }) => Promise<{
3072
- data: {
3073
- createdAt: string;
3074
- updatedAt: string;
3075
- sourceSubAgentId: string;
3076
- targetSubAgentId: string | null;
3077
- relationType: string | null;
3078
- agentId: string;
3079
- projectId: string;
3080
- tenantId: string;
3081
- id: string;
3082
- }[];
3083
- pagination: {
3084
- page: number;
3085
- limit: number;
3086
- total: number;
3087
- pages: number;
3088
- };
3089
- }>;
3090
- declare const getSubAgentRelationsByTarget: (db: DatabaseClient) => (params: {
3091
- scopes: AgentScopeConfig;
3092
- targetSubAgentId: string;
3093
- pagination?: PaginationConfig;
3094
- }) => Promise<{
3095
- data: {
3096
- createdAt: string;
3097
- updatedAt: string;
3098
- sourceSubAgentId: string;
3099
- targetSubAgentId: string | null;
3100
- relationType: string | null;
3101
- agentId: string;
3102
- projectId: string;
3103
- tenantId: string;
3104
- id: string;
3105
- }[];
3106
- pagination: {
3107
- page: number;
3108
- limit: number;
3109
- total: number;
3110
- pages: number;
3111
- };
3112
- }>;
3113
- declare const getRelatedAgentsForAgent: (db: DatabaseClient) => (params: {
3114
- scopes: AgentScopeConfig;
3115
- subAgentId: string;
3116
- }) => Promise<{
3117
- data: {
3118
- id: string;
3119
- name: string;
3120
- description: string;
3121
- relationType: string | null;
3122
- }[];
3123
- }>;
3124
- declare const createSubAgentRelation: (db: DatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
3125
- tenantId: string;
3126
- projectId: string;
3127
- id: string;
3128
- agentId: string;
3129
- createdAt: string;
3130
- updatedAt: string;
3131
- sourceSubAgentId: string;
3132
- targetSubAgentId: string | null;
3133
- relationType: string | null;
3134
- }>;
3135
- /**
3136
- * Check if sub-agent relation exists by agent, source, target, and relation type
3137
- */
3138
- declare const getAgentRelationByParams: (db: DatabaseClient) => (params: {
3139
- scopes: AgentScopeConfig;
3140
- sourceSubAgentId: string;
3141
- targetSubAgentId?: string;
3142
- relationType: string;
3143
- }) => Promise<{
3144
- tenantId: string;
3145
- projectId: string;
3146
- id: string;
3147
- agentId: string;
3148
- createdAt: string;
3149
- updatedAt: string;
3150
- sourceSubAgentId: string;
3151
- targetSubAgentId: string | null;
3152
- relationType: string | null;
3153
- } | undefined>;
3154
- /**
3155
- * Upsert agent relation (create if it doesn't exist, no-op if it does)
3156
- */
3157
- declare const upsertSubAgentRelation: (db: DatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
3158
- tenantId: string;
3159
- projectId: string;
3160
- id: string;
3161
- agentId: string;
3162
- createdAt: string;
3163
- updatedAt: string;
3164
- sourceSubAgentId: string;
3165
- targetSubAgentId: string | null;
3166
- relationType: string | null;
3167
- }>;
3168
- declare const updateAgentRelation: (db: DatabaseClient) => (params: {
3169
- scopes: AgentScopeConfig;
3170
- relationId: string;
3171
- data: SubAgentRelationUpdate;
3172
- }) => Promise<{
3173
- createdAt: string;
3174
- updatedAt: string;
3175
- sourceSubAgentId: string;
3176
- targetSubAgentId: string | null;
3177
- relationType: string | null;
3178
- agentId: string;
3179
- projectId: string;
3180
- tenantId: string;
3181
- id: string;
3182
- }>;
3183
- declare const deleteSubAgentRelation: (db: DatabaseClient) => (params: {
3184
- scopes: AgentScopeConfig;
3185
- relationId: string;
3186
- }) => Promise<boolean>;
3187
- declare const deleteAgentRelationsByAgent: (db: DatabaseClient) => (params: {
3188
- scopes: AgentScopeConfig;
3189
- }) => Promise<boolean>;
3190
- declare const createAgentToolRelation: (db: DatabaseClient) => (params: {
3191
- scopes: AgentScopeConfig;
3192
- relationId?: string;
3193
- data: {
3194
- subAgentId: string;
3195
- toolId: string;
3196
- selectedTools?: string[] | null;
3197
- headers?: Record<string, string> | null;
3198
- };
3199
- }) => Promise<{
3200
- tenantId: string;
3201
- projectId: string;
3202
- id: string;
3203
- agentId: string;
3204
- createdAt: string;
3205
- updatedAt: string;
3206
- headers: Record<string, string> | null;
3207
- toolId: string;
3208
- selectedTools: string[] | null;
3209
- subAgentId: string;
3210
- }>;
3211
- declare const updateAgentToolRelation: (db: DatabaseClient) => (params: {
3212
- scopes: AgentScopeConfig;
3213
- relationId: string;
3214
- data: SubAgentToolRelationUpdate;
3215
- }) => Promise<{
3216
- createdAt: string;
3217
- updatedAt: string;
3218
- toolId: string;
3219
- selectedTools: string[] | null;
3220
- headers: Record<string, string> | null;
3221
- subAgentId: string;
3222
- agentId: string;
3223
- projectId: string;
3224
- tenantId: string;
3225
- id: string;
3226
- }>;
3227
- declare const deleteAgentToolRelation: (db: DatabaseClient) => (params: {
3228
- scopes: AgentScopeConfig;
3229
- relationId: string;
3230
- }) => Promise<boolean>;
3231
- declare const deleteAgentToolRelationByAgent: (db: DatabaseClient) => (params: {
3232
- scopes: SubAgentScopeConfig;
3233
- }) => Promise<boolean>;
3234
- declare const getAgentToolRelationById: (db: DatabaseClient) => (params: {
3235
- scopes: SubAgentScopeConfig;
3236
- relationId: string;
3237
- }) => Promise<{
3238
- tenantId: string;
3239
- projectId: string;
3240
- id: string;
3241
- agentId: string;
3242
- createdAt: string;
3243
- updatedAt: string;
3244
- headers: Record<string, string> | null;
3245
- toolId: string;
3246
- selectedTools: string[] | null;
3247
- subAgentId: string;
3248
- } | undefined>;
3249
- declare const getAgentToolRelationByAgent: (db: DatabaseClient) => (params: {
3250
- scopes: SubAgentScopeConfig;
3251
- pagination?: PaginationConfig;
3252
- }) => Promise<{
3253
- data: {
3254
- createdAt: string;
3255
- updatedAt: string;
3256
- toolId: string;
3257
- selectedTools: string[] | null;
3258
- headers: Record<string, string> | null;
3259
- subAgentId: string;
3260
- agentId: string;
3261
- projectId: string;
3262
- tenantId: string;
3263
- id: string;
3264
- }[];
3265
- pagination: {
3266
- page: number;
3267
- limit: number;
3268
- total: number;
3269
- pages: number;
3270
- };
3271
- }>;
3272
- declare const getAgentToolRelationByTool: (db: DatabaseClient) => (params: {
3273
- scopes: AgentScopeConfig;
3274
- toolId: string;
3275
- pagination?: PaginationConfig;
3276
- }) => Promise<{
3277
- data: {
3278
- createdAt: string;
3279
- updatedAt: string;
3280
- toolId: string;
3281
- selectedTools: string[] | null;
3282
- headers: Record<string, string> | null;
3283
- subAgentId: string;
3284
- agentId: string;
3285
- projectId: string;
3286
- tenantId: string;
3287
- id: string;
3288
- }[];
3289
- pagination: {
3290
- page: number;
3291
- limit: number;
3292
- total: number;
3293
- pages: number;
3294
- };
3295
- }>;
3296
- declare const listAgentToolRelations: (db: DatabaseClient) => (params: {
3297
- scopes: AgentScopeConfig;
3298
- pagination?: PaginationConfig;
3299
- }) => Promise<{
3300
- data: {
3301
- createdAt: string;
3302
- updatedAt: string;
3303
- toolId: string;
3304
- selectedTools: string[] | null;
3305
- headers: Record<string, string> | null;
3306
- subAgentId: string;
3307
- agentId: string;
3308
- projectId: string;
3309
- tenantId: string;
3310
- id: string;
3311
- }[];
3312
- pagination: {
3313
- page: number;
3314
- limit: number;
3315
- total: number;
3316
- pages: number;
3317
- };
3318
- }>;
3319
- declare const getToolsForAgent: (db: DatabaseClient) => (params: {
3320
- scopes: SubAgentScopeConfig;
3321
- pagination?: PaginationConfig;
3322
- }) => Promise<{
3323
- data: {
3324
- id: string;
3325
- tenantId: string;
3326
- subAgentId: string;
3327
- toolId: string;
3328
- selectedTools: string[] | null;
3329
- headers: Record<string, string> | null;
3330
- createdAt: string;
3331
- updatedAt: string;
3332
- tool: {
3333
- id: string;
3334
- name: string;
3335
- description: string | null;
3336
- config: {
3337
- type: "mcp";
3338
- mcp: ToolMcpConfig;
3339
- };
3340
- createdAt: string;
3341
- updatedAt: string;
3342
- capabilities: ToolServerCapabilities | null;
3343
- lastError: string | null;
3344
- credentialReferenceId: string | null;
3345
- tenantId: string;
3346
- projectId: string;
3347
- headers: Record<string, string> | null;
3348
- imageUrl: string | null;
3349
- };
3350
- }[];
3351
- pagination: {
3352
- page: number;
3353
- limit: number;
3354
- total: number;
3355
- pages: number;
3356
- };
3357
- }>;
3358
- declare const getAgentsForTool: (db: DatabaseClient) => (params: {
3359
- scopes: AgentScopeConfig;
3360
- toolId: string;
3361
- pagination?: PaginationConfig;
3362
- }) => Promise<{
3363
- data: {
3364
- id: string;
3365
- tenantId: string;
3366
- subAgentId: string;
3367
- toolId: string;
3368
- selectedTools: string[] | null;
3369
- headers: Record<string, string> | null;
3370
- createdAt: string;
3371
- updatedAt: string;
3372
- subAgent: {
3373
- id: string;
3374
- name: string;
3375
- description: string;
3376
- prompt: string;
3377
- conversationHistoryConfig: ConversationHistoryConfig | null;
3378
- models: {
3379
- base?: {
3380
- model?: string | undefined;
3381
- providerOptions?: Record<string, any> | undefined;
3382
- } | undefined;
3383
- structuredOutput?: {
3384
- model?: string | undefined;
3385
- providerOptions?: Record<string, any> | undefined;
3386
- } | undefined;
3387
- summarizer?: {
3388
- model?: string | undefined;
3389
- providerOptions?: Record<string, any> | undefined;
3390
- } | undefined;
3391
- } | null;
3392
- stopWhen: {
3393
- stepCountIs?: number | undefined;
3394
- } | null;
3395
- createdAt: string;
3396
- updatedAt: string;
3397
- };
3398
- }[];
3399
- pagination: {
3400
- page: number;
3401
- limit: number;
3402
- total: number;
3403
- pages: number;
3404
- };
3405
- }>;
3406
- declare const validateSubAgent: (db: DatabaseClient) => (params: {
3407
- scopes: SubAgentScopeConfig;
3408
- }) => Promise<boolean>;
3409
-
3410
- declare const getSubAgentById: (db: DatabaseClient) => (params: {
3411
- scopes: AgentScopeConfig;
3412
- subAgentId: string;
3413
- }) => Promise<{
3414
- tenantId: string;
3415
- projectId: string;
3416
- id: string;
3417
- name: string;
3418
- description: string;
3419
- prompt: string;
3420
- agentId: string;
3421
- createdAt: string;
3422
- updatedAt: string;
3423
- models: {
3424
- base?: {
3425
- model?: string | undefined;
3426
- providerOptions?: Record<string, any> | undefined;
3427
- } | undefined;
3428
- structuredOutput?: {
3429
- model?: string | undefined;
3430
- providerOptions?: Record<string, any> | undefined;
3431
- } | undefined;
3432
- summarizer?: {
3433
- model?: string | undefined;
3434
- providerOptions?: Record<string, any> | undefined;
3435
- } | undefined;
3436
- } | null;
3437
- stopWhen: {
3438
- stepCountIs?: number | undefined;
3439
- } | null;
3440
- conversationHistoryConfig: ConversationHistoryConfig | null;
3441
- } | undefined>;
3442
- declare const listSubAgents: (db: DatabaseClient) => (params: {
3443
- scopes: AgentScopeConfig;
3444
- }) => Promise<{
3445
- tenantId: string;
3446
- projectId: string;
3447
- id: string;
3448
- name: string;
3449
- description: string;
3450
- prompt: string;
3451
- agentId: string;
3452
- createdAt: string;
3453
- updatedAt: string;
3454
- models: {
3455
- base?: {
3456
- model?: string | undefined;
3457
- providerOptions?: Record<string, any> | undefined;
3458
- } | undefined;
3459
- structuredOutput?: {
3460
- model?: string | undefined;
3461
- providerOptions?: Record<string, any> | undefined;
3462
- } | undefined;
3463
- summarizer?: {
3464
- model?: string | undefined;
3465
- providerOptions?: Record<string, any> | undefined;
3466
- } | undefined;
3467
- } | null;
3468
- stopWhen: {
3469
- stepCountIs?: number | undefined;
3470
- } | null;
3471
- conversationHistoryConfig: ConversationHistoryConfig | null;
3472
- }[]>;
3473
- declare const listSubAgentsPaginated: (db: DatabaseClient) => (params: {
3474
- scopes: AgentScopeConfig;
3475
- pagination?: PaginationConfig;
3476
- }) => Promise<{
3477
- data: {
3478
- createdAt: string;
3479
- updatedAt: string;
3480
- prompt: string;
3481
- conversationHistoryConfig: ConversationHistoryConfig | null;
3482
- models: {
3483
- base?: {
3484
- model?: string | undefined;
3485
- providerOptions?: Record<string, any> | undefined;
3486
- } | undefined;
3487
- structuredOutput?: {
3488
- model?: string | undefined;
3489
- providerOptions?: Record<string, any> | undefined;
3490
- } | undefined;
3491
- summarizer?: {
3492
- model?: string | undefined;
3493
- providerOptions?: Record<string, any> | undefined;
3494
- } | undefined;
3495
- } | null;
3496
- stopWhen: {
3497
- stepCountIs?: number | undefined;
3498
- } | null;
3499
- name: string;
3500
- description: string;
3501
- agentId: string;
3502
- projectId: string;
3503
- tenantId: string;
3504
- id: string;
3505
- }[];
3506
- pagination: {
3507
- page: number;
3508
- limit: number;
3509
- total: number;
3510
- pages: number;
3511
- };
3512
- }>;
3513
- declare const createSubAgent: (db: DatabaseClient) => (params: SubAgentInsert) => Promise<{
3514
- tenantId: string;
3515
- projectId: string;
3516
- id: string;
3517
- name: string;
3518
- description: string;
3519
- prompt: string;
3520
- agentId: string;
3521
- createdAt: string;
3522
- updatedAt: string;
3523
- models: {
3524
- base?: {
3525
- model?: string | undefined;
3526
- providerOptions?: Record<string, any> | undefined;
3527
- } | undefined;
3528
- structuredOutput?: {
3529
- model?: string | undefined;
3530
- providerOptions?: Record<string, any> | undefined;
3531
- } | undefined;
3532
- summarizer?: {
3533
- model?: string | undefined;
3534
- providerOptions?: Record<string, any> | undefined;
3535
- } | undefined;
3536
- } | null;
3537
- stopWhen: {
3538
- stepCountIs?: number | undefined;
3539
- } | null;
3540
- conversationHistoryConfig: ConversationHistoryConfig | null;
3541
- }>;
3542
- declare const updateSubAgent: (db: DatabaseClient) => (params: {
3543
- scopes: AgentScopeConfig;
3544
- subAgentId: string;
3545
- data: SubAgentUpdate;
3546
- }) => Promise<{
3547
- createdAt: string;
3548
- updatedAt: string;
3549
- prompt: string;
3550
- conversationHistoryConfig: ConversationHistoryConfig | null;
3551
- models: {
3552
- base?: {
3553
- model?: string | undefined;
3554
- providerOptions?: Record<string, any> | undefined;
3555
- } | undefined;
3556
- structuredOutput?: {
3557
- model?: string | undefined;
3558
- providerOptions?: Record<string, any> | undefined;
3559
- } | undefined;
3560
- summarizer?: {
3561
- model?: string | undefined;
3562
- providerOptions?: Record<string, any> | undefined;
3563
- } | undefined;
3564
- } | null;
3565
- stopWhen: {
3566
- stepCountIs?: number | undefined;
3567
- } | null;
3568
- name: string;
3569
- description: string;
3570
- agentId: string;
3571
- projectId: string;
3572
- tenantId: string;
3573
- id: string;
3574
- }>;
3575
- /**
3576
- * Upsert agent (create if it doesn't exist, update if it does)
3577
- */
3578
- declare const upsertSubAgent: (db: DatabaseClient) => (params: {
3579
- data: SubAgentInsert;
3580
- }) => Promise<SubAgentSelect>;
3581
- declare const deleteSubAgent: (db: DatabaseClient) => (params: {
3582
- scopes: AgentScopeConfig;
3583
- subAgentId: string;
3584
- }) => Promise<boolean>;
3585
- declare const getSubAgentsByIds: (db: DatabaseClient) => (params: {
3586
- scopes: AgentScopeConfig;
3587
- subAgentIds: string[];
3588
- }) => Promise<{
3589
- createdAt: string;
3590
- updatedAt: string;
3591
- prompt: string;
3592
- conversationHistoryConfig: ConversationHistoryConfig | null;
3593
- models: {
3594
- base?: {
3595
- model?: string | undefined;
3596
- providerOptions?: Record<string, any> | undefined;
3597
- } | undefined;
3598
- structuredOutput?: {
3599
- model?: string | undefined;
3600
- providerOptions?: Record<string, any> | undefined;
3601
- } | undefined;
3602
- summarizer?: {
3603
- model?: string | undefined;
3604
- providerOptions?: Record<string, any> | undefined;
3605
- } | undefined;
3606
- } | null;
3607
- stopWhen: {
3608
- stepCountIs?: number | undefined;
3609
- } | null;
3610
- name: string;
3611
- description: string;
3612
- agentId: string;
3613
- projectId: string;
3614
- tenantId: string;
3615
- id: string;
3616
- }[]>;
3617
-
3618
- declare const getSubAgentTeamAgentRelationById: (db: DatabaseClient) => (params: {
3619
- scopes: SubAgentScopeConfig;
3620
- relationId: string;
3621
- }) => Promise<{
3622
- tenantId: string;
3623
- projectId: string;
3624
- id: string;
3625
- agentId: string;
3626
- createdAt: string;
3627
- updatedAt: string;
3628
- headers: Record<string, string> | null;
3629
- subAgentId: string;
3630
- targetAgentId: string;
3631
- } | undefined>;
3632
- declare const listSubAgentTeamAgentRelations: (db: DatabaseClient) => (params: {
3633
- scopes: SubAgentScopeConfig;
3634
- pagination?: PaginationConfig;
3635
- }) => Promise<{
3636
- data: {
3637
- createdAt: string;
3638
- updatedAt: string;
3639
- targetAgentId: string;
3640
- headers: Record<string, string> | null;
3641
- subAgentId: string;
3642
- agentId: string;
3643
- projectId: string;
3644
- tenantId: string;
3645
- id: string;
3646
- }[];
3647
- pagination: {
3648
- page: number;
3649
- limit: number;
3650
- total: number;
3651
- pages: number;
3652
- };
3653
- }>;
3654
- declare const getSubAgentTeamAgentRelations: (db: DatabaseClient) => (params: {
3655
- scopes: SubAgentScopeConfig;
3656
- }) => Promise<{
3657
- tenantId: string;
3658
- projectId: string;
3659
- id: string;
3660
- agentId: string;
3661
- createdAt: string;
3662
- updatedAt: string;
3663
- headers: Record<string, string> | null;
3664
- subAgentId: string;
3665
- targetAgentId: string;
3666
- }[]>;
3667
- declare const getSubAgentTeamAgentRelationsByAgent: (db: DatabaseClient) => (params: {
3668
- scopes: AgentScopeConfig;
3669
- }) => Promise<{
3670
- tenantId: string;
3671
- projectId: string;
3672
- id: string;
3673
- agentId: string;
3674
- createdAt: string;
3675
- updatedAt: string;
3676
- headers: Record<string, string> | null;
3677
- subAgentId: string;
3678
- targetAgentId: string;
3679
- }[]>;
3680
- declare const getSubAgentTeamAgentRelationsByTeamAgent: (db: DatabaseClient) => (params: {
3681
- scopes: AgentScopeConfig;
3682
- targetAgentId: string;
3683
- pagination?: PaginationConfig;
3684
- }) => Promise<{
3685
- data: {
3686
- createdAt: string;
3687
- updatedAt: string;
3688
- targetAgentId: string;
3689
- headers: Record<string, string> | null;
3690
- subAgentId: string;
3691
- agentId: string;
3692
- projectId: string;
3693
- tenantId: string;
3694
- id: string;
3695
- }[];
3696
- pagination: {
3697
- page: number;
3698
- limit: number;
3699
- total: number;
3700
- pages: number;
3701
- };
3702
- }>;
3703
- declare const getTeamAgentsForSubAgent: (db: DatabaseClient) => (params: {
3704
- scopes: SubAgentScopeConfig;
3705
- pagination?: PaginationConfig;
3706
- }) => Promise<{
3707
- data: {
3708
- id: string;
3709
- tenantId: string;
3710
- projectId: string;
3711
- agentId: string;
3712
- subAgentId: string;
3713
- targetAgentId: string;
3714
- headers: Record<string, string> | null;
3715
- createdAt: string;
3716
- updatedAt: string;
3717
- targetAgent: {
3718
- id: string;
3719
- name: string;
3720
- description: string | null;
3721
- defaultSubAgentId: string | null;
3722
- contextConfigId: string | null;
3723
- models: {
3724
- base?: {
3725
- model?: string | undefined;
3726
- providerOptions?: Record<string, any> | undefined;
3727
- } | undefined;
3728
- structuredOutput?: {
3729
- model?: string | undefined;
3730
- providerOptions?: Record<string, any> | undefined;
3731
- } | undefined;
3732
- summarizer?: {
3733
- model?: string | undefined;
3734
- providerOptions?: Record<string, any> | undefined;
3735
- } | undefined;
3736
- } | null;
3737
- statusUpdates: {
3738
- enabled?: boolean | undefined;
3739
- numEvents?: number | undefined;
3740
- timeInSeconds?: number | undefined;
3741
- prompt?: string | undefined;
3742
- statusComponents?: {
3743
- type: string;
3744
- description?: string | undefined;
3745
- detailsSchema?: {
3746
- type: "object";
3747
- properties: Record<string, any>;
3748
- required?: string[] | undefined;
3749
- } | undefined;
3750
- }[] | undefined;
3751
- } | null;
3752
- prompt: string | null;
3753
- stopWhen: {
3754
- transferCountIs?: number | undefined;
3755
- } | null;
3756
- createdAt: string;
3757
- updatedAt: string;
3758
- };
3759
- }[];
3760
- pagination: {
3761
- page: number;
3762
- limit: number;
3763
- total: number;
3764
- pages: number;
3765
- };
3766
- }>;
3767
- declare const getSubAgentsForTeamAgent: (db: DatabaseClient) => (params: {
3768
- scopes: AgentScopeConfig;
3769
- targetAgentId: string;
3770
- pagination?: PaginationConfig;
3771
- }) => Promise<{
3772
- data: {
3773
- id: string;
3774
- tenantId: string;
3775
- projectId: string;
3776
- agentId: string;
3777
- subAgentId: string;
3778
- targetAgentId: string;
3779
- createdAt: string;
3780
- updatedAt: string;
3781
- subAgent: {
3782
- id: string;
3783
- name: string;
3784
- description: string;
3785
- prompt: string;
3786
- conversationHistoryConfig: ConversationHistoryConfig | null;
3787
- models: {
3788
- base?: {
3789
- model?: string | undefined;
3790
- providerOptions?: Record<string, any> | undefined;
3791
- } | undefined;
3792
- structuredOutput?: {
3793
- model?: string | undefined;
3794
- providerOptions?: Record<string, any> | undefined;
3795
- } | undefined;
3796
- summarizer?: {
3797
- model?: string | undefined;
3798
- providerOptions?: Record<string, any> | undefined;
3799
- } | undefined;
3800
- } | null;
3801
- stopWhen: {
3802
- stepCountIs?: number | undefined;
3803
- } | null;
3804
- createdAt: string;
3805
- updatedAt: string;
3806
- };
3807
- }[];
3808
- pagination: {
3809
- page: number;
3810
- limit: number;
3811
- total: number;
3812
- pages: number;
3813
- };
3814
- }>;
3815
- declare const createSubAgentTeamAgentRelation: (db: DatabaseClient) => (params: {
3816
- scopes: SubAgentScopeConfig;
3817
- relationId?: string;
3818
- data: {
3819
- targetAgentId: string;
3820
- headers?: Record<string, string> | null;
3821
- };
3822
- }) => Promise<{
3823
- tenantId: string;
3824
- projectId: string;
3825
- id: string;
3826
- agentId: string;
3827
- createdAt: string;
3828
- updatedAt: string;
3829
- headers: Record<string, string> | null;
3830
- subAgentId: string;
3831
- targetAgentId: string;
3832
- }>;
3833
- /**
3834
- * Check if sub-agent team agent relation exists by params
3835
- */
3836
- declare const getSubAgentTeamAgentRelationByParams: (db: DatabaseClient) => (params: {
3837
- scopes: SubAgentScopeConfig;
3838
- targetAgentId: string;
3839
- }) => Promise<{
3840
- tenantId: string;
3841
- projectId: string;
3842
- id: string;
3843
- agentId: string;
3844
- createdAt: string;
3845
- updatedAt: string;
3846
- headers: Record<string, string> | null;
3847
- subAgentId: string;
3848
- targetAgentId: string;
3849
- } | undefined>;
3850
- /**
3851
- * Upsert sub-agent team agent relation (create if it doesn't exist, update if it does)
3852
- */
3853
- declare const upsertSubAgentTeamAgentRelation: (db: DatabaseClient) => (params: {
3854
- scopes: SubAgentScopeConfig;
3855
- relationId?: string;
3856
- data: {
3857
- targetAgentId: string;
3858
- headers?: Record<string, string> | null;
3859
- };
3860
- }) => Promise<{
3861
- tenantId: string;
3862
- projectId: string;
3863
- id: string;
3864
- agentId: string;
3865
- createdAt: string;
3866
- updatedAt: string;
3867
- headers: Record<string, string> | null;
3868
- subAgentId: string;
3869
- targetAgentId: string;
3870
- }>;
3871
- declare const updateSubAgentTeamAgentRelation: (db: DatabaseClient) => (params: {
3872
- scopes: SubAgentScopeConfig;
3873
- relationId: string;
3874
- data: Partial<SubAgentTeamAgentRelationInsert>;
3875
- }) => Promise<{
3876
- createdAt: string;
3877
- updatedAt: string;
3878
- targetAgentId: string;
3879
- headers: Record<string, string> | null;
3880
- subAgentId: string;
3881
- agentId: string;
3882
- projectId: string;
3883
- tenantId: string;
3884
- id: string;
3885
- }>;
3886
- declare const deleteSubAgentTeamAgentRelation: (db: DatabaseClient) => (params: {
3887
- scopes: SubAgentScopeConfig;
3888
- relationId: string;
3889
- }) => Promise<boolean>;
3890
- declare const deleteSubAgentTeamAgentRelationsBySubAgent: (db: DatabaseClient) => (params: {
3891
- scopes: SubAgentScopeConfig;
3892
- }) => Promise<boolean>;
3893
- declare const deleteSubAgentTeamAgentRelationsByAgent: (db: DatabaseClient) => (params: {
3894
- scopes: AgentScopeConfig;
3895
- }) => Promise<boolean>;
3896
-
3897
- declare const createTask: (db: DatabaseClient) => (params: TaskInsert) => Promise<{
3898
- tenantId: string;
3899
- projectId: string;
3900
- id: string;
3901
- agentId: string;
3902
- createdAt: string;
3903
- updatedAt: string;
3904
- metadata: TaskMetadataConfig | null;
3905
- status: string;
3906
- contextId: string;
3907
- subAgentId: string;
3908
- }>;
3909
- declare const getTask: (db: DatabaseClient) => (params: {
3910
- id: string;
3911
- }) => Promise<TaskSelect | null>;
3912
- declare const updateTask: (db: DatabaseClient) => (params: {
3913
- taskId: string;
3914
- data: {
3915
- status?: string;
3916
- metadata?: any;
3917
- };
3918
- }) => Promise<{
3919
- createdAt: string;
3920
- updatedAt: string;
3921
- contextId: string;
3922
- status: string;
3923
- metadata: TaskMetadataConfig | null;
3924
- subAgentId: string;
3925
- agentId: string;
3926
- projectId: string;
3927
- tenantId: string;
3928
- id: string;
3929
- }>;
3930
- declare const listTaskIdsByContextId: (db: DatabaseClient) => (params: {
3931
- contextId: string;
3932
- }) => Promise<string[]>;
3933
-
3934
- declare const dbResultToMcpTool: (dbResult: ToolSelect, dbClient: DatabaseClient, credentialStoreRegistry?: CredentialStoreRegistry, relationshipId?: string) => Promise<McpTool>;
3935
- declare const getToolById: (db: DatabaseClient) => (params: {
3936
- scopes: ProjectScopeConfig;
3937
- toolId: string;
3938
- }) => Promise<{
3939
- tenantId: string;
3940
- projectId: string;
3941
- id: string;
3942
- name: string;
3943
- description: string | null;
3944
- config: {
3945
- type: "mcp";
3946
- mcp: ToolMcpConfig;
3947
- };
3948
- credentialReferenceId: string | null;
3949
- createdAt: string;
3950
- updatedAt: string;
3951
- headers: Record<string, string> | null;
3952
- capabilities: ToolServerCapabilities | null;
3953
- imageUrl: string | null;
3954
- lastError: string | null;
3955
- } | null>;
3956
- declare const listTools: (db: DatabaseClient) => (params: {
3957
- scopes: ProjectScopeConfig;
3958
- pagination?: PaginationConfig;
3959
- }) => Promise<{
3960
- data: {
3961
- createdAt: string;
3962
- updatedAt: string;
3963
- name: string;
3964
- description: string | null;
3965
- config: {
3966
- type: "mcp";
3967
- mcp: ToolMcpConfig;
3968
- };
3969
- credentialReferenceId: string | null;
3970
- headers: Record<string, string> | null;
3971
- imageUrl: string | null;
3972
- capabilities: ToolServerCapabilities | null;
3973
- lastError: string | null;
3974
- projectId: string;
3975
- tenantId: string;
3976
- id: string;
3977
- }[];
3978
- pagination: {
3979
- page: number;
3980
- limit: number;
3981
- total: number;
3982
- pages: number;
3983
- };
3984
- }>;
3985
- declare const createTool: (db: DatabaseClient) => (params: ToolInsert) => Promise<{
3986
- tenantId: string;
3987
- projectId: string;
3988
- id: string;
3989
- name: string;
3990
- description: string | null;
3991
- config: {
3992
- type: "mcp";
3993
- mcp: ToolMcpConfig;
3994
- };
3995
- credentialReferenceId: string | null;
3996
- createdAt: string;
3997
- updatedAt: string;
3998
- headers: Record<string, string> | null;
3999
- capabilities: ToolServerCapabilities | null;
4000
- imageUrl: string | null;
4001
- lastError: string | null;
4002
- }>;
4003
- declare const updateTool: (db: DatabaseClient) => (params: {
4004
- scopes: ProjectScopeConfig;
4005
- toolId: string;
4006
- data: ToolUpdate;
4007
- }) => Promise<{
4008
- createdAt: string;
4009
- updatedAt: string;
4010
- name: string;
4011
- description: string | null;
4012
- config: {
4013
- type: "mcp";
4014
- mcp: ToolMcpConfig;
4015
- };
4016
- credentialReferenceId: string | null;
4017
- headers: Record<string, string> | null;
4018
- imageUrl: string | null;
4019
- capabilities: ToolServerCapabilities | null;
4020
- lastError: string | null;
4021
- projectId: string;
4022
- tenantId: string;
4023
- id: string;
4024
- }>;
4025
- declare const deleteTool: (db: DatabaseClient) => (params: {
4026
- scopes: ProjectScopeConfig;
4027
- toolId: string;
4028
- }) => Promise<boolean>;
4029
- declare const addToolToAgent: (db: DatabaseClient) => (params: {
4030
- scopes: AgentScopeConfig;
4031
- subAgentId: string;
4032
- toolId: string;
4033
- selectedTools?: string[] | null;
4034
- headers?: Record<string, string> | null;
4035
- }) => Promise<{
4036
- tenantId: string;
4037
- projectId: string;
4038
- id: string;
4039
- agentId: string;
4040
- createdAt: string;
4041
- updatedAt: string;
4042
- headers: Record<string, string> | null;
4043
- toolId: string;
4044
- selectedTools: string[] | null;
4045
- subAgentId: string;
4046
- }>;
4047
- declare const removeToolFromAgent: (db: DatabaseClient) => (params: {
4048
- scopes: AgentScopeConfig;
4049
- subAgentId: string;
4050
- toolId: string;
4051
- }) => Promise<{
4052
- tenantId: string;
4053
- projectId: string;
4054
- id: string;
4055
- agentId: string;
4056
- createdAt: string;
4057
- updatedAt: string;
4058
- headers: Record<string, string> | null;
4059
- toolId: string;
4060
- selectedTools: string[] | null;
4061
- subAgentId: string;
4062
- }>;
4063
- /**
4064
- * Upsert agent-tool relation (create if it doesn't exist, update if it does)
4065
- */
4066
- declare const upsertSubAgentToolRelation: (db: DatabaseClient) => (params: {
4067
- scopes: AgentScopeConfig;
4068
- subAgentId: string;
4069
- toolId: string;
4070
- selectedTools?: string[] | null;
4071
- headers?: Record<string, string> | null;
4072
- relationId?: string;
4073
- }) => Promise<{
4074
- tenantId: string;
4075
- projectId: string;
4076
- id: string;
4077
- agentId: string;
4078
- createdAt: string;
4079
- updatedAt: string;
4080
- headers: Record<string, string> | null;
4081
- toolId: string;
4082
- selectedTools: string[] | null;
4083
- subAgentId: string;
4084
- }>;
4085
- /**
4086
- * Upsert a tool (create if it doesn't exist, update if it does)
4087
- */
4088
- declare const upsertTool: (db: DatabaseClient) => (params: {
4089
- data: ToolInsert;
4090
- }) => Promise<{
4091
- tenantId: string;
4092
- projectId: string;
4093
- id: string;
4094
- name: string;
4095
- description: string | null;
4096
- config: {
4097
- type: "mcp";
4098
- mcp: ToolMcpConfig;
4099
- };
4100
- credentialReferenceId: string | null;
4101
- createdAt: string;
4102
- updatedAt: string;
4103
- headers: Record<string, string> | null;
4104
- capabilities: ToolServerCapabilities | null;
4105
- imageUrl: string | null;
4106
- lastError: string | null;
4107
- }>;
4108
-
4109
- /**
4110
- * User data access layer
4111
- * All database queries for Better Auth's user table
4112
- */
4113
- /**
4114
- * Get user by ID
4115
- */
4116
- declare const getUserById: (db: DatabaseClient) => (userId: string) => Promise<User | null>;
4117
- /**
4118
- * Get user by email
4119
- */
4120
- declare const getUserByEmail: (db: DatabaseClient) => (email: string) => Promise<User | null>;
4121
-
4122
- /**
4123
- * Validates that a project exists before performing database operations
4124
- * This provides runtime validation even when foreign key constraints are not enforced
4125
- */
4126
- declare const validateProjectExists: (db: DatabaseClient, tenantId: string, projectId: string) => Promise<void>;
4127
- /**
4128
- * Wraps a database operation with project validation
4129
- * Ensures the project exists before executing the operation
4130
- */
4131
- declare const withProjectValidation: <T extends (...args: any[]) => Promise<any>>(db: DatabaseClient, operation: T) => (params: Parameters<T>[0]) => Promise<ReturnType<T>>;
4132
- /**
4133
- * Creates a validated version of data access functions
4134
- * Automatically adds project validation to insert/update operations
4135
- */
4136
- declare const createValidatedDataAccess: <T extends Record<string, any>>(db: DatabaseClient, dataAccessFunctions: T) => T;
4137
-
4138
- /**
4139
- * Creates a test database client using an in-memory PostgreSQL database (PGlite)
4140
- * This provides real database operations for integration testing with perfect isolation
4141
- * Each call creates a fresh database with all migrations applied
4142
- */
4143
- declare function createTestDatabaseClient(drizzleDir?: string): Promise<DatabaseClient>;
4144
- /**
4145
- * Cleans up test database by removing all data but keeping schema
4146
- * Dynamically gets all tables from the public schema and truncates them
4147
- */
4148
- declare function cleanupTestDatabase(db: DatabaseClient): Promise<void>;
4149
- /**
4150
- * Closes the test database and removes the file
4151
- */
4152
- declare function closeTestDatabase(db: DatabaseClient): Promise<void>;
4153
- /**
4154
- * Creates a test organization in the database
4155
- * This is a helper for tests that need organization records before creating projects/agents
4156
- */
4157
- declare function createTestOrganization(db: DatabaseClient, tenantId: string): Promise<void>;
4158
- /**
4159
- * Creates a test project in the database
4160
- * Ensures the organization exists first
4161
- */
4162
- declare function createTestProject(db: DatabaseClient, tenantId: string, projectId?: string): Promise<void>;
4163
-
4164
- declare const loadEnvironmentFiles: () => void;
4165
-
4166
- declare const HTTP_REQUEST_PARTS: readonly ["headers"];
4167
- type HttpRequestPart = (typeof HTTP_REQUEST_PARTS)[number];
4168
- interface ContextValidationError {
4169
- field: string;
4170
- message: string;
4171
- value?: unknown;
4172
- }
4173
- interface ContextValidationResult {
4174
- valid: boolean;
4175
- errors: ContextValidationError[];
4176
- validatedContext?: Record<string, unknown> | ParsedHttpRequest;
4177
- }
4178
- interface ParsedHttpRequest {
4179
- headers?: Record<string, string>;
4180
- }
4181
- declare function isValidHttpRequest(obj: any): obj is ParsedHttpRequest;
4182
- declare function getCachedValidator(schema: Record<string, unknown>): ValidateFunction;
4183
- declare function validationHelper(jsonSchema: Record<string, unknown>): ValidateFunction<unknown>;
4184
- declare function validateAgainstJsonSchema(jsonSchema: Record<string, unknown>, context: unknown): boolean;
4185
- declare function validateHttpRequestHeaders(headersSchema: any, httpRequest: ParsedHttpRequest): Promise<ContextValidationResult>;
4186
- declare function validateHeaders({ tenantId, projectId, agentId, conversationId, parsedRequest, dbClient, credentialStores, }: {
4187
- tenantId: string;
4188
- projectId: string;
4189
- agentId: string;
4190
- conversationId: string;
4191
- parsedRequest: ParsedHttpRequest;
4192
- dbClient: DatabaseClient;
4193
- credentialStores?: CredentialStoreRegistry;
4194
- }): Promise<ContextValidationResult>;
4195
- declare function contextValidationMiddleware(dbClient: DatabaseClient): (c: Context, next: Next) => Promise<void>;
4196
-
4197
- type ApiKeyGenerationResult = {
4198
- id: string;
4199
- publicId: string;
4200
- key: string;
4201
- keyHash: string;
4202
- keyPrefix: string;
4203
- };
4204
- /**
4205
- * Generate a new API key with secure random bytes
4206
- */
4207
- declare function generateApiKey(): Promise<ApiKeyGenerationResult>;
4208
- /**
4209
- * Hash an API key using scrypt
4210
- */
4211
- declare function hashApiKey(key: string): Promise<string>;
4212
- /**
4213
- * Validate an API key against its hash
4214
- */
4215
- declare function validateApiKey(key: string, storedHash: string): Promise<boolean>;
4216
- /**
4217
- * Check if an API key has expired
4218
- */
4219
- declare function isApiKeyExpired(expiresAt?: string | null): boolean;
4220
- /**
4221
- * Extract the publicId from an API key
4222
- */
4223
- declare function extractPublicId(key: string): string | null;
4224
- /**
4225
- * Mask an API key for display (show only prefix and last 4 chars)
4226
- */
4227
- declare function maskApiKey(keyPrefix: string): string;
4228
-
4229
- declare const generateId: (size?: number) => string;
4230
- /**
4231
- * Generates a standardized conversation ID.
4232
- *
4233
- * The generated ID follows these rules:
4234
- * 1. Always lowercase
4235
- * 2. No leading hyphens
4236
- *
4237
- * @returns A unique conversation ID
4238
- *
4239
- * @example
4240
- * ```typescript
4241
- * const id = getConversationId(); // returns something like "v1stgxr8z5jdhi6bmyt"
4242
- * ```
4243
- */
4244
- declare function getConversationId(): string;
4245
-
4246
- /**
4247
- * Get a lookup key for a credential store from retrieval params
4248
- * @param retrievalParams - The retrieval params for the credential store
4249
- * @param credentialStoreType - The type of credential store
4250
- * @returns A lookup key for the credential store, used to call <CredentialStore>.get()
4251
- */
4252
- declare function getCredentialStoreLookupKeyFromRetrievalParams({ retrievalParams, credentialStoreType, }: {
4253
- retrievalParams: Record<string, unknown>;
4254
- credentialStoreType: keyof typeof CredentialStoreType;
4255
- }): string | null;
4256
-
4257
- /**
4258
- * Checks if a date string is in PostgreSQL timestamp format and normalizes it to ISO 8601
4259
- * PostgreSQL format: "2025-11-07 21:48:24.858" or "2025-11-07 21:48:24"
4260
- * ISO 8601 format: "2025-11-07T21:48:24.858Z"
4261
- */
4262
- declare function normalizeDateString(dateString: string | Date): string | Date;
4263
-
4264
- declare const ErrorCode: z$1.ZodEnum<{
4265
- bad_request: "bad_request";
4266
- unauthorized: "unauthorized";
4267
- forbidden: "forbidden";
4268
- not_found: "not_found";
4269
- conflict: "conflict";
4270
- internal_server_error: "internal_server_error";
4271
- unprocessable_entity: "unprocessable_entity";
4272
- }>;
4273
- declare const ERROR_DOCS_BASE_URL = "https://docs.inkeep.com/agents-api/errors";
4274
- declare const problemDetailsSchema: z$1.ZodObject<{
4275
- title: z$1.ZodString;
4276
- status: z$1.ZodNumber;
4277
- detail: z$1.ZodString;
4278
- instance: z$1.ZodOptional<z$1.ZodString>;
4279
- requestId: z$1.ZodOptional<z$1.ZodString>;
4280
- code: z$1.ZodEnum<{
4281
- bad_request: "bad_request";
4282
- unauthorized: "unauthorized";
4283
- forbidden: "forbidden";
4284
- not_found: "not_found";
4285
- conflict: "conflict";
4286
- internal_server_error: "internal_server_error";
4287
- unprocessable_entity: "unprocessable_entity";
4288
- }>;
4289
- }, z$1.core.$strip>;
4290
- type ProblemDetails = z$1.infer<typeof problemDetailsSchema>;
4291
- type ErrorCodes = z$1.infer<typeof ErrorCode>;
4292
- declare const errorResponseSchema: z$1.ZodObject<{
4293
- error: z$1.ZodObject<{
4294
- code: z$1.ZodEnum<{
4295
- bad_request: "bad_request";
4296
- unauthorized: "unauthorized";
4297
- forbidden: "forbidden";
4298
- not_found: "not_found";
4299
- conflict: "conflict";
4300
- internal_server_error: "internal_server_error";
4301
- unprocessable_entity: "unprocessable_entity";
4302
- }>;
4303
- message: z$1.ZodString;
4304
- }, z$1.core.$strip>;
4305
- }, z$1.core.$strip>;
4306
- type ErrorResponse = z$1.infer<typeof errorResponseSchema>;
4307
- declare function createApiError({ code, message, instance, requestId, }: {
4308
- code: ErrorCodes;
4309
- message: string;
4310
- instance?: string;
4311
- requestId?: string;
4312
- }): HTTPException;
4313
- declare function handleApiError(error: unknown, requestId?: string): Promise<ProblemDetails & {
4314
- error: {
4315
- code: ErrorCodes;
4316
- message: string;
4317
- };
4318
- }>;
4319
- declare const errorSchemaFactory: (code: ErrorCodes, description: string) => {
4320
- description: string;
4321
- content: {
4322
- 'application/problem+json': {
4323
- schema: z$1.ZodObject<{
4324
- instance: z$1.ZodOptional<z$1.ZodString>;
4325
- requestId: z$1.ZodOptional<z$1.ZodString>;
4326
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4327
- detail: z$1.ZodString;
4328
- title: z$1.ZodString;
4329
- status: z$1.ZodNumber;
4330
- error: z$1.ZodObject<{
4331
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4332
- message: z$1.ZodString;
4333
- }, z$1.core.$strip>;
4334
- }, z$1.core.$strip>;
4335
- };
4336
- };
4337
- };
4338
- declare const commonCreateErrorResponses: {
4339
- readonly 400: {
4340
- description: string;
4341
- content: {
4342
- 'application/problem+json': {
4343
- schema: z$1.ZodObject<{
4344
- instance: z$1.ZodOptional<z$1.ZodString>;
4345
- requestId: z$1.ZodOptional<z$1.ZodString>;
4346
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4347
- detail: z$1.ZodString;
4348
- title: z$1.ZodString;
4349
- status: z$1.ZodNumber;
4350
- error: z$1.ZodObject<{
4351
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4352
- message: z$1.ZodString;
4353
- }, z$1.core.$strip>;
4354
- }, z$1.core.$strip>;
4355
- };
4356
- };
4357
- };
4358
- readonly 401: {
4359
- description: string;
4360
- content: {
4361
- 'application/problem+json': {
4362
- schema: z$1.ZodObject<{
4363
- instance: z$1.ZodOptional<z$1.ZodString>;
4364
- requestId: z$1.ZodOptional<z$1.ZodString>;
4365
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4366
- detail: z$1.ZodString;
4367
- title: z$1.ZodString;
4368
- status: z$1.ZodNumber;
4369
- error: z$1.ZodObject<{
4370
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4371
- message: z$1.ZodString;
4372
- }, z$1.core.$strip>;
4373
- }, z$1.core.$strip>;
4374
- };
4375
- };
4376
- };
4377
- readonly 403: {
4378
- description: string;
4379
- content: {
4380
- 'application/problem+json': {
4381
- schema: z$1.ZodObject<{
4382
- instance: z$1.ZodOptional<z$1.ZodString>;
4383
- requestId: z$1.ZodOptional<z$1.ZodString>;
4384
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4385
- detail: z$1.ZodString;
4386
- title: z$1.ZodString;
4387
- status: z$1.ZodNumber;
4388
- error: z$1.ZodObject<{
4389
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4390
- message: z$1.ZodString;
4391
- }, z$1.core.$strip>;
4392
- }, z$1.core.$strip>;
4393
- };
4394
- };
4395
- };
4396
- readonly 422: {
4397
- description: string;
4398
- content: {
4399
- 'application/problem+json': {
4400
- schema: z$1.ZodObject<{
4401
- instance: z$1.ZodOptional<z$1.ZodString>;
4402
- requestId: z$1.ZodOptional<z$1.ZodString>;
4403
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4404
- detail: z$1.ZodString;
4405
- title: z$1.ZodString;
4406
- status: z$1.ZodNumber;
4407
- error: z$1.ZodObject<{
4408
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4409
- message: z$1.ZodString;
4410
- }, z$1.core.$strip>;
4411
- }, z$1.core.$strip>;
4412
- };
4413
- };
4414
- };
4415
- readonly 500: {
4416
- description: string;
4417
- content: {
4418
- 'application/problem+json': {
4419
- schema: z$1.ZodObject<{
4420
- instance: z$1.ZodOptional<z$1.ZodString>;
4421
- requestId: z$1.ZodOptional<z$1.ZodString>;
4422
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4423
- detail: z$1.ZodString;
4424
- title: z$1.ZodString;
4425
- status: z$1.ZodNumber;
4426
- error: z$1.ZodObject<{
4427
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4428
- message: z$1.ZodString;
4429
- }, z$1.core.$strip>;
4430
- }, z$1.core.$strip>;
4431
- };
4432
- };
4433
- };
4434
- };
4435
- declare const commonUpdateErrorResponses: {
4436
- readonly 400: {
4437
- description: string;
4438
- content: {
4439
- 'application/problem+json': {
4440
- schema: z$1.ZodObject<{
4441
- instance: z$1.ZodOptional<z$1.ZodString>;
4442
- requestId: z$1.ZodOptional<z$1.ZodString>;
4443
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4444
- detail: z$1.ZodString;
4445
- title: z$1.ZodString;
4446
- status: z$1.ZodNumber;
4447
- error: z$1.ZodObject<{
4448
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4449
- message: z$1.ZodString;
4450
- }, z$1.core.$strip>;
4451
- }, z$1.core.$strip>;
4452
- };
4453
- };
4454
- };
4455
- readonly 401: {
4456
- description: string;
4457
- content: {
4458
- 'application/problem+json': {
4459
- schema: z$1.ZodObject<{
4460
- instance: z$1.ZodOptional<z$1.ZodString>;
4461
- requestId: z$1.ZodOptional<z$1.ZodString>;
4462
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4463
- detail: z$1.ZodString;
4464
- title: z$1.ZodString;
4465
- status: z$1.ZodNumber;
4466
- error: z$1.ZodObject<{
4467
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4468
- message: z$1.ZodString;
4469
- }, z$1.core.$strip>;
4470
- }, z$1.core.$strip>;
4471
- };
4472
- };
4473
- };
4474
- readonly 403: {
4475
- description: string;
4476
- content: {
4477
- 'application/problem+json': {
4478
- schema: z$1.ZodObject<{
4479
- instance: z$1.ZodOptional<z$1.ZodString>;
4480
- requestId: z$1.ZodOptional<z$1.ZodString>;
4481
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4482
- detail: z$1.ZodString;
4483
- title: z$1.ZodString;
4484
- status: z$1.ZodNumber;
4485
- error: z$1.ZodObject<{
4486
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4487
- message: z$1.ZodString;
4488
- }, z$1.core.$strip>;
4489
- }, z$1.core.$strip>;
4490
- };
4491
- };
4492
- };
4493
- readonly 404: {
4494
- description: string;
4495
- content: {
4496
- 'application/problem+json': {
4497
- schema: z$1.ZodObject<{
4498
- instance: z$1.ZodOptional<z$1.ZodString>;
4499
- requestId: z$1.ZodOptional<z$1.ZodString>;
4500
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4501
- detail: z$1.ZodString;
4502
- title: z$1.ZodString;
4503
- status: z$1.ZodNumber;
4504
- error: z$1.ZodObject<{
4505
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4506
- message: z$1.ZodString;
4507
- }, z$1.core.$strip>;
4508
- }, z$1.core.$strip>;
4509
- };
4510
- };
4511
- };
4512
- readonly 422: {
4513
- description: string;
4514
- content: {
4515
- 'application/problem+json': {
4516
- schema: z$1.ZodObject<{
4517
- instance: z$1.ZodOptional<z$1.ZodString>;
4518
- requestId: z$1.ZodOptional<z$1.ZodString>;
4519
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4520
- detail: z$1.ZodString;
4521
- title: z$1.ZodString;
4522
- status: z$1.ZodNumber;
4523
- error: z$1.ZodObject<{
4524
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4525
- message: z$1.ZodString;
4526
- }, z$1.core.$strip>;
4527
- }, z$1.core.$strip>;
4528
- };
4529
- };
4530
- };
4531
- readonly 500: {
4532
- description: string;
4533
- content: {
4534
- 'application/problem+json': {
4535
- schema: z$1.ZodObject<{
4536
- instance: z$1.ZodOptional<z$1.ZodString>;
4537
- requestId: z$1.ZodOptional<z$1.ZodString>;
4538
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4539
- detail: z$1.ZodString;
4540
- title: z$1.ZodString;
4541
- status: z$1.ZodNumber;
4542
- error: z$1.ZodObject<{
4543
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4544
- message: z$1.ZodString;
4545
- }, z$1.core.$strip>;
4546
- }, z$1.core.$strip>;
4547
- };
4548
- };
4549
- };
4550
- };
4551
- declare const commonGetErrorResponses: {
4552
- readonly 400: {
4553
- description: string;
4554
- content: {
4555
- 'application/problem+json': {
4556
- schema: z$1.ZodObject<{
4557
- instance: z$1.ZodOptional<z$1.ZodString>;
4558
- requestId: z$1.ZodOptional<z$1.ZodString>;
4559
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4560
- detail: z$1.ZodString;
4561
- title: z$1.ZodString;
4562
- status: z$1.ZodNumber;
4563
- error: z$1.ZodObject<{
4564
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4565
- message: z$1.ZodString;
4566
- }, z$1.core.$strip>;
4567
- }, z$1.core.$strip>;
4568
- };
4569
- };
4570
- };
4571
- readonly 401: {
4572
- description: string;
4573
- content: {
4574
- 'application/problem+json': {
4575
- schema: z$1.ZodObject<{
4576
- instance: z$1.ZodOptional<z$1.ZodString>;
4577
- requestId: z$1.ZodOptional<z$1.ZodString>;
4578
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4579
- detail: z$1.ZodString;
4580
- title: z$1.ZodString;
4581
- status: z$1.ZodNumber;
4582
- error: z$1.ZodObject<{
4583
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4584
- message: z$1.ZodString;
4585
- }, z$1.core.$strip>;
4586
- }, z$1.core.$strip>;
4587
- };
4588
- };
4589
- };
4590
- readonly 403: {
4591
- description: string;
4592
- content: {
4593
- 'application/problem+json': {
4594
- schema: z$1.ZodObject<{
4595
- instance: z$1.ZodOptional<z$1.ZodString>;
4596
- requestId: z$1.ZodOptional<z$1.ZodString>;
4597
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4598
- detail: z$1.ZodString;
4599
- title: z$1.ZodString;
4600
- status: z$1.ZodNumber;
4601
- error: z$1.ZodObject<{
4602
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4603
- message: z$1.ZodString;
4604
- }, z$1.core.$strip>;
4605
- }, z$1.core.$strip>;
4606
- };
4607
- };
4608
- };
4609
- readonly 404: {
4610
- description: string;
4611
- content: {
4612
- 'application/problem+json': {
4613
- schema: z$1.ZodObject<{
4614
- instance: z$1.ZodOptional<z$1.ZodString>;
4615
- requestId: z$1.ZodOptional<z$1.ZodString>;
4616
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4617
- detail: z$1.ZodString;
4618
- title: z$1.ZodString;
4619
- status: z$1.ZodNumber;
4620
- error: z$1.ZodObject<{
4621
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4622
- message: z$1.ZodString;
4623
- }, z$1.core.$strip>;
4624
- }, z$1.core.$strip>;
4625
- };
4626
- };
4627
- };
4628
- readonly 422: {
4629
- description: string;
4630
- content: {
4631
- 'application/problem+json': {
4632
- schema: z$1.ZodObject<{
4633
- instance: z$1.ZodOptional<z$1.ZodString>;
4634
- requestId: z$1.ZodOptional<z$1.ZodString>;
4635
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4636
- detail: z$1.ZodString;
4637
- title: z$1.ZodString;
4638
- status: z$1.ZodNumber;
4639
- error: z$1.ZodObject<{
4640
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4641
- message: z$1.ZodString;
4642
- }, z$1.core.$strip>;
4643
- }, z$1.core.$strip>;
4644
- };
4645
- };
4646
- };
4647
- readonly 500: {
4648
- description: string;
4649
- content: {
4650
- 'application/problem+json': {
4651
- schema: z$1.ZodObject<{
4652
- instance: z$1.ZodOptional<z$1.ZodString>;
4653
- requestId: z$1.ZodOptional<z$1.ZodString>;
4654
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4655
- detail: z$1.ZodString;
4656
- title: z$1.ZodString;
4657
- status: z$1.ZodNumber;
4658
- error: z$1.ZodObject<{
4659
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4660
- message: z$1.ZodString;
4661
- }, z$1.core.$strip>;
4662
- }, z$1.core.$strip>;
4663
- };
4664
- };
4665
- };
4666
- };
4667
- declare const commonDeleteErrorResponses: {
4668
- readonly 400: {
4669
- description: string;
4670
- content: {
4671
- 'application/problem+json': {
4672
- schema: z$1.ZodObject<{
4673
- instance: z$1.ZodOptional<z$1.ZodString>;
4674
- requestId: z$1.ZodOptional<z$1.ZodString>;
4675
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4676
- detail: z$1.ZodString;
4677
- title: z$1.ZodString;
4678
- status: z$1.ZodNumber;
4679
- error: z$1.ZodObject<{
4680
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4681
- message: z$1.ZodString;
4682
- }, z$1.core.$strip>;
4683
- }, z$1.core.$strip>;
4684
- };
4685
- };
4686
- };
4687
- readonly 401: {
4688
- description: string;
4689
- content: {
4690
- 'application/problem+json': {
4691
- schema: z$1.ZodObject<{
4692
- instance: z$1.ZodOptional<z$1.ZodString>;
4693
- requestId: z$1.ZodOptional<z$1.ZodString>;
4694
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4695
- detail: z$1.ZodString;
4696
- title: z$1.ZodString;
4697
- status: z$1.ZodNumber;
4698
- error: z$1.ZodObject<{
4699
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4700
- message: z$1.ZodString;
4701
- }, z$1.core.$strip>;
4702
- }, z$1.core.$strip>;
4703
- };
4704
- };
4705
- };
4706
- readonly 403: {
4707
- description: string;
4708
- content: {
4709
- 'application/problem+json': {
4710
- schema: z$1.ZodObject<{
4711
- instance: z$1.ZodOptional<z$1.ZodString>;
4712
- requestId: z$1.ZodOptional<z$1.ZodString>;
4713
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4714
- detail: z$1.ZodString;
4715
- title: z$1.ZodString;
4716
- status: z$1.ZodNumber;
4717
- error: z$1.ZodObject<{
4718
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4719
- message: z$1.ZodString;
4720
- }, z$1.core.$strip>;
4721
- }, z$1.core.$strip>;
4722
- };
4723
- };
4724
- };
4725
- readonly 404: {
4726
- description: string;
4727
- content: {
4728
- 'application/problem+json': {
4729
- schema: z$1.ZodObject<{
4730
- instance: z$1.ZodOptional<z$1.ZodString>;
4731
- requestId: z$1.ZodOptional<z$1.ZodString>;
4732
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4733
- detail: z$1.ZodString;
4734
- title: z$1.ZodString;
4735
- status: z$1.ZodNumber;
4736
- error: z$1.ZodObject<{
4737
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4738
- message: z$1.ZodString;
4739
- }, z$1.core.$strip>;
4740
- }, z$1.core.$strip>;
4741
- };
4742
- };
4743
- };
4744
- readonly 422: {
4745
- description: string;
4746
- content: {
4747
- 'application/problem+json': {
4748
- schema: z$1.ZodObject<{
4749
- instance: z$1.ZodOptional<z$1.ZodString>;
4750
- requestId: z$1.ZodOptional<z$1.ZodString>;
4751
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4752
- detail: z$1.ZodString;
4753
- title: z$1.ZodString;
4754
- status: z$1.ZodNumber;
4755
- error: z$1.ZodObject<{
4756
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4757
- message: z$1.ZodString;
4758
- }, z$1.core.$strip>;
4759
- }, z$1.core.$strip>;
4760
- };
4761
- };
4762
- };
4763
- readonly 500: {
4764
- description: string;
4765
- content: {
4766
- 'application/problem+json': {
4767
- schema: z$1.ZodObject<{
4768
- instance: z$1.ZodOptional<z$1.ZodString>;
4769
- requestId: z$1.ZodOptional<z$1.ZodString>;
4770
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4771
- detail: z$1.ZodString;
4772
- title: z$1.ZodString;
4773
- status: z$1.ZodNumber;
4774
- error: z$1.ZodObject<{
4775
- code: z$1.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
4776
- message: z$1.ZodString;
4777
- }, z$1.core.$strip>;
4778
- }, z$1.core.$strip>;
4779
- };
4780
- };
4781
- };
4782
- };
4783
- type CommonCreateErrorResponses = typeof commonCreateErrorResponses;
4784
- type CommonUpdateErrorResponses = typeof commonUpdateErrorResponses;
4785
- type CommonGetErrorResponses = typeof commonGetErrorResponses;
4786
- type CommonDeleteErrorResponses = typeof commonDeleteErrorResponses;
4787
-
4788
- /**
4789
- * Create execution context from middleware values
4790
- */
4791
- declare function createExecutionContext(params: {
4792
- apiKey: string;
4793
- tenantId: string;
4794
- projectId: string;
4795
- agentId: string;
4796
- apiKeyId: string;
4797
- baseUrl?: string;
4798
- }): ExecutionContext;
4799
- /**
4800
- * Get execution context from API key authentication
4801
- */
4802
- declare function getRequestExecutionContext(c: Context): ExecutionContext;
4803
-
4804
- /**
4805
- * Service Token JWT Claims
4806
- */
4807
- interface ServiceTokenPayload {
4808
- /** Issuer - always 'inkeep-agents' */
4809
- iss: string;
4810
- /** Audience - the target agent ID */
4811
- aud: string;
4812
- /** Subject - the origin agent ID */
4813
- sub: string;
4814
- /** Tenant ID - must match for both origin and target agents */
4815
- tenantId: string;
4816
- /** Project ID - must match for both origin and target agents */
4817
- projectId: string;
4818
- /** Issued at timestamp */
4819
- iat: number;
4820
- /** Expiration timestamp (5 minutes from issue) */
4821
- exp: number;
4822
- }
4823
- /**
4824
- * Parameters for generating a service token
4825
- */
4826
- interface GenerateServiceTokenParams {
4827
- tenantId: string;
4828
- projectId: string;
4829
- originAgentId: string;
4830
- targetAgentId: string;
4831
- }
4832
- /**
4833
- * Result of verifying a service token
4834
- */
4835
- interface VerifyServiceTokenResult {
4836
- valid: boolean;
4837
- payload?: ServiceTokenPayload;
4838
- error?: string;
4839
- }
4840
- /**
4841
- * Generate a JWT token for team agent authentication
4842
- * Token expires in 5 minutes
4843
- *
4844
- * @param params - Token generation parameters
4845
- * @returns Signed JWT token string
4846
- */
4847
- declare function generateServiceToken(params: GenerateServiceTokenParams): Promise<string>;
4848
- /**
4849
- * Verify and decode a service JWT token
4850
- *
4851
- * @param token - JWT token string to verify
4852
- * @returns Verification result with payload if valid
4853
- */
4854
- declare function verifyServiceToken(token: string): Promise<VerifyServiceTokenResult>;
4855
- /**
4856
- * Validate that the token's tenant ID matches the expected tenant
4857
- * This prevents cross-tenant delegation attempts
4858
- *
4859
- * @param payload - Decoded token payload
4860
- * @param expectedTenantId - The tenant ID to validate against
4861
- * @returns true if tenant IDs match, false otherwise
4862
- */
4863
- declare function validateTenantId(payload: ServiceTokenPayload, expectedTenantId: string): boolean;
4864
- /**
4865
- * Validate that the token's target agent ID matches the expected agent
4866
- *
4867
- * @param payload - Decoded token payload
4868
- * @param expectedTargetAgentId - The agent ID to validate against
4869
- * @returns true if agent IDs match, false otherwise
4870
- */
4871
- declare function validateTargetAgent(payload: ServiceTokenPayload, expectedTargetAgentId: string): boolean;
4872
- /**
4873
- * Extract the Authorization header and verify the bearer token
4874
- *
4875
- * @param authHeader - The Authorization header value (e.g., "Bearer <token>")
4876
- * @returns Verification result with payload if valid
4877
- */
4878
- declare function verifyAuthorizationHeader(authHeader: string | undefined): Promise<VerifyServiceTokenResult>;
4879
-
4880
- /**
4881
- * Helper function to handle span errors consistently
4882
- * Records the exception, sets error status, and optionally logs
4883
- */
4884
- declare function setSpanWithError(span: Span, error: Error, logger?: {
4885
- error: (obj: any, msg?: string) => void;
4886
- }, logMessage?: string): void;
4887
- /**
4888
- * Get a tracer instance for the specified service
4889
- * Returns a no-op tracer if OpenTelemetry is not available
4890
- */
4891
- declare function getTracer(serviceName: string, serviceVersion?: string): Tracer;
4892
-
4893
- export { AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT, AGENT_EXECUTION_TRANSFER_COUNT_MAX, AGENT_EXECUTION_TRANSFER_COUNT_MIN, AgentInsert, type AgentLogger, AgentScopeConfig, AgentSelect, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT, CONVERSATION_HISTORY_DEFAULT_LIMIT, CONVERSATION_HISTORY_MAX_OUTPUT_TOKENS_DEFAULT, type CommonCreateErrorResponses, type CommonDeleteErrorResponses, type CommonGetErrorResponses, type CommonUpdateErrorResponses, ContextCache, ContextCacheInsert, ContextCacheSelect, ContextConfigBuilder, type ContextConfigBuilderOptions, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ContextFetchDefinition, ContextFetcher, type ContextResolutionOptions, type ContextResolutionResult, ContextResolver, type ContextResolverInterface, type ContextValidationError, type ContextValidationResult, ConversationHistoryConfig, ConversationInsert, ConversationMetadata, ConversationSelect, ConversationUpdate, CreateApiKeyParams, type CredentialContext, type CredentialData, CredentialReferenceApiInsert, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, type CredentialReferenceWithResources, type CredentialResolverInput, CredentialStore, type CredentialStoreReference, CredentialStoreRegistry, CredentialStoreType, CredentialStuffer, DataComponentInsert, DataComponentSelect, DataComponentUpdate, type DatabaseClient, type DatabaseConfig, type DotPaths, ERROR_DOCS_BASE_URL, ErrorCode, type ErrorCodes, type ErrorResponse, ExecutionContext, ExternalAgentInsert, ExternalAgentSelect, ExternalAgentUpdate, type FetchResult, FullAgentDefinition, FullProjectDefinition, FunctionApiInsert, FunctionToolApiInsert, FunctionToolApiUpdate, type GenerateServiceTokenParams, HTTP_REQUEST_PARTS, type HttpRequestPart, InMemoryCredentialStore, KeyChainStore, LedgerArtifactSelect, MCPToolConfig, MCPTransportType, MCP_TOOL_CONNECTION_TIMEOUT_MS, MCP_TOOL_INITIAL_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RETRIES, MCP_TOOL_RECONNECTION_DELAY_GROWTH_FACTOR, McpClient, type McpClientOptions, type McpSSEConfig, type McpServerConfig, type McpStreamableHttpConfig, McpTool, MessageContent, MessageInsert, MessageMetadata, MessageUpdate, MessageVisibility, NangoCredentialStore, PaginationConfig, PaginationResult, type ParsedHttpRequest, PinoLogger, type ProblemDetails, ProjectInfo, ProjectInsert, type ProjectLogger, ProjectResourceCounts, ProjectScopeConfig, ProjectSelect, ProjectUpdate, type ResolvedContext, STATUS_UPDATE_MAX_INTERVAL_SECONDS, STATUS_UPDATE_MAX_NUM_EVENTS, SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT, SUB_AGENT_TURN_GENERATION_STEPS_MAX, SUB_AGENT_TURN_GENERATION_STEPS_MIN, type ServiceTokenPayload, SubAgentExternalAgentRelationInsert, SubAgentInsert, SubAgentRelationInsert, SubAgentRelationUpdate, SubAgentScopeConfig, SubAgentSelect, SubAgentTeamAgentRelationInsert, SubAgentToolRelationUpdate, SubAgentUpdate, TaskInsert, TaskMetadataConfig, TaskSelect, type TemplateContext, TemplateEngine, type TemplateRenderOptions, ToolInsert, ToolMcpConfig, ToolSelect, ToolServerCapabilities, ToolUpdate, VALIDATION_AGENT_PROMPT_MAX_CHARS, VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS, type VerifyServiceTokenResult, addFunctionToolToSubAgent, addLedgerArtifacts, addToolToAgent, addUserToOrganization, agentHasArtifactComponents, apiFetch, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, cleanupTestDatabase, clearContextConfigCache, clearConversationCache, closeTestDatabase, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createFullAgentServerSide, createFullProjectServerSide, createFunctionTool, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createSubAgent, createSubAgentExternalAgentRelation, createSubAgentRelation, createSubAgentTeamAgentRelation, createTask, createTestDatabaseClient, createTestOrganization, createTestProject, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullAgent, deleteFullProject, deleteFunction, deleteFunctionTool, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteSubAgent, deleteSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelationsByAgent, deleteSubAgentExternalAgentRelationsBySubAgent, deleteSubAgentRelation, deleteSubAgentTeamAgentRelation, deleteSubAgentTeamAgentRelationsByAgent, deleteSubAgentTeamAgentRelationsBySubAgent, deleteTool, determineContextTrigger, errorResponseSchema, errorSchemaFactory, executionLimitsSharedDefaults, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, generateId, generateServiceToken, getActiveAgentForConversation, getAgentById, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentSubAgentInfos, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentWithDefaultSubAgent, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getConversation, getConversationCacheEntries, getConversationHistory, getConversationId, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithResources, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFullAgent, getFullAgentDefinition, getFullProject, getFunction, getFunctionToolById, getFunctionToolsForSubAgent, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getPendingInvitationsByEmail, getProject, getProjectResourceCounts, getRelatedAgentsForAgent, getRequestExecutionContext, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentTeamAgentRelationById, getSubAgentTeamAgentRelationByParams, getSubAgentTeamAgentRelations, getSubAgentTeamAgentRelationsByAgent, getSubAgentTeamAgentRelationsByTeamAgent, getSubAgentsByIds, getSubAgentsForExternalAgent, getSubAgentsForTeamAgent, getTask, getTeamAgentsForSubAgent, getToolById, getToolsForAgent, getTracer, getUserByEmail, getUserById, getUserOrganizations, getVisibleMessages, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, headers, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listFunctionTools, listFunctions, listMessages, listProjects, listProjectsPaginated, listSubAgentExternalAgentRelations, listSubAgentTeamAgentRelations, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, maskApiKey, normalizeDateString, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, schemaValidationDefaults, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullAgentServerSide, updateFullProjectServerSide, updateFunctionTool, updateMessage, updateProject, updateSubAgent, updateSubAgentExternalAgentRelation, updateSubAgentFunctionToolRelation, updateSubAgentTeamAgentRelation, updateTask, updateTool, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertFunction, upsertFunctionTool, upsertLedgerArtifact, upsertSubAgent, upsertSubAgentExternalAgentRelation, upsertSubAgentFunctionToolRelation, upsertSubAgentRelation, upsertSubAgentTeamAgentRelation, upsertSubAgentToolRelation, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateHeaders, validateHttpRequestHeaders, validateProjectExists, validateSubAgent, validateTargetAgent, validateTenantId, validationHelper, verifyAuthorizationHeader, verifyServiceToken, withProjectValidation };