@inkeep/agents-core 0.41.2 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-client/base-client.d.ts +87 -8
- package/dist/api-client/base-client.js +174 -1
- package/dist/api-client/eval-api-client.d.ts +47 -0
- package/dist/api-client/eval-api-client.js +65 -0
- package/dist/api-client/index.d.ts +4 -0
- package/dist/api-client/index.js +5 -0
- package/dist/api-client/manage-api-client.d.ts +34 -0
- package/dist/api-client/manage-api-client.js +104 -0
- package/dist/auth/auth.d.ts +86 -20
- package/dist/auth/auth.js +55 -1
- package/dist/auth/authz/client.d.ts +81 -0
- package/dist/auth/authz/client.js +189 -0
- package/dist/auth/authz/config.d.ts +76 -0
- package/dist/auth/authz/config.js +76 -0
- package/dist/auth/authz/index.d.ts +5 -0
- package/dist/auth/authz/index.js +6 -0
- package/dist/auth/authz/permissions.d.ts +57 -0
- package/dist/auth/authz/permissions.js +83 -0
- package/dist/auth/authz/sync.d.ts +85 -0
- package/dist/auth/authz/sync.js +237 -0
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/auth/permissions.js +2 -181
- package/dist/client-exports.d.ts +8 -3
- package/dist/client-exports.js +3 -2
- package/dist/constants/context-breakdown.d.ts +61 -0
- package/dist/constants/context-breakdown.js +124 -0
- package/dist/constants/otel-attributes.d.ts +4 -0
- package/dist/constants/otel-attributes.js +4 -0
- package/dist/context/ContextConfig.d.ts +2 -2
- package/dist/context/ContextConfig.js +3 -3
- package/dist/context/TemplateEngine.js +0 -1
- package/dist/context/index.d.ts +1 -5
- package/dist/context/index.js +1 -5
- package/dist/credential-stuffer/CredentialStuffer.d.ts +1 -1
- package/dist/data-access/index.d.ts +34 -26
- package/dist/data-access/index.js +34 -26
- package/dist/data-access/manage/agentFull.d.ts +36 -0
- package/dist/data-access/{agentFull.js → manage/agentFull.js} +205 -7
- package/dist/data-access/{agents.d.ts → manage/agents.d.ts} +23 -22
- package/dist/data-access/{agents.js → manage/agents.js} +52 -7
- package/dist/data-access/{artifactComponents.d.ts → manage/artifactComponents.d.ts} +21 -21
- package/dist/data-access/{artifactComponents.js → manage/artifactComponents.js} +5 -5
- package/dist/data-access/{contextConfigs.d.ts → manage/contextConfigs.d.ts} +14 -14
- package/dist/data-access/{contextConfigs.js → manage/contextConfigs.js} +3 -3
- package/dist/data-access/{credentialReferences.d.ts → manage/credentialReferences.d.ts} +17 -17
- package/dist/data-access/{credentialReferences.js → manage/credentialReferences.js} +2 -2
- package/dist/data-access/{dataComponents.d.ts → manage/dataComponents.d.ts} +20 -20
- package/dist/data-access/{dataComponents.js → manage/dataComponents.js} +7 -7
- package/dist/data-access/manage/evalConfig.d.ts +221 -0
- package/dist/data-access/manage/evalConfig.js +275 -0
- package/dist/data-access/{externalAgents.d.ts → manage/externalAgents.d.ts} +16 -16
- package/dist/data-access/{externalAgents.js → manage/externalAgents.js} +2 -2
- package/dist/data-access/{functionTools.d.ts → manage/functionTools.d.ts} +65 -15
- package/dist/data-access/{functionTools.js → manage/functionTools.js} +90 -8
- package/dist/data-access/{functions.d.ts → manage/functions.d.ts} +9 -9
- package/dist/data-access/{functions.js → manage/functions.js} +3 -3
- package/dist/data-access/manage/projectFull.d.ts +38 -0
- package/dist/data-access/{projectFull.js → manage/projectFull.js} +64 -65
- package/dist/data-access/manage/projectLifecycle.d.ts +119 -0
- package/dist/data-access/manage/projectLifecycle.js +234 -0
- package/dist/data-access/manage/projects.d.ts +75 -0
- package/dist/data-access/{projects.js → manage/projects.js} +15 -16
- package/dist/data-access/{subAgentExternalAgentRelations.d.ts → manage/subAgentExternalAgentRelations.d.ts} +19 -19
- package/dist/data-access/{subAgentExternalAgentRelations.js → manage/subAgentExternalAgentRelations.js} +2 -2
- package/dist/data-access/{subAgentRelations.d.ts → manage/subAgentRelations.d.ts} +29 -29
- package/dist/data-access/{subAgentRelations.js → manage/subAgentRelations.js} +3 -3
- package/dist/data-access/{subAgentTeamAgentRelations.d.ts → manage/subAgentTeamAgentRelations.d.ts} +19 -19
- package/dist/data-access/{subAgentTeamAgentRelations.js → manage/subAgentTeamAgentRelations.js} +2 -2
- package/dist/data-access/{subAgents.d.ts → manage/subAgents.d.ts} +13 -13
- package/dist/data-access/{subAgents.js → manage/subAgents.js} +4 -4
- package/dist/data-access/{tools.d.ts → manage/tools.d.ts} +26 -19
- package/dist/data-access/{tools.js → manage/tools.js} +57 -35
- package/dist/data-access/manage/triggers.d.ts +80 -0
- package/dist/data-access/manage/triggers.js +81 -0
- package/dist/data-access/{apiKeys.d.ts → runtime/apiKeys.d.ts} +17 -17
- package/dist/data-access/{apiKeys.js → runtime/apiKeys.js} +3 -3
- package/dist/data-access/runtime/cascade-delete.d.ts +77 -0
- package/dist/data-access/runtime/cascade-delete.js +111 -0
- package/dist/data-access/{contextCache.d.ts → runtime/contextCache.d.ts} +13 -13
- package/dist/data-access/{contextCache.js → runtime/contextCache.js} +5 -5
- package/dist/data-access/{conversations.d.ts → runtime/conversations.d.ts} +68 -19
- package/dist/data-access/{conversations.js → runtime/conversations.js} +13 -7
- package/dist/data-access/runtime/evalRuns.d.ts +120 -0
- package/dist/data-access/runtime/evalRuns.js +168 -0
- package/dist/data-access/{ledgerArtifacts.d.ts → runtime/ledgerArtifacts.d.ts} +13 -13
- package/dist/data-access/{ledgerArtifacts.js → runtime/ledgerArtifacts.js} +3 -3
- package/dist/data-access/{messages.d.ts → runtime/messages.d.ts} +15 -15
- package/dist/data-access/{messages.js → runtime/messages.js} +2 -2
- package/dist/data-access/{organizations.d.ts → runtime/organizations.d.ts} +16 -7
- package/dist/data-access/{organizations.js → runtime/organizations.js} +15 -3
- package/dist/data-access/runtime/projects.d.ts +62 -0
- package/dist/data-access/runtime/projects.js +90 -0
- package/dist/data-access/runtime/tasks.d.ts +55 -0
- package/dist/data-access/{tasks.js → runtime/tasks.js} +2 -2
- package/dist/data-access/runtime/triggerInvocations.d.ts +62 -0
- package/dist/data-access/runtime/triggerInvocations.js +54 -0
- package/dist/data-access/runtime/users.d.ts +19 -0
- package/dist/data-access/{users.js → runtime/users.js} +2 -2
- package/dist/data-access/validation.d.ts +4 -4
- package/dist/data-access/validation.js +1 -1
- package/dist/db/clean.d.ts +8 -4
- package/dist/db/clean.js +14 -105
- package/dist/db/delete.d.ts +1 -1
- package/dist/db/delete.js +7 -10
- package/dist/db/manage/dolt-cleanup.d.ts +51 -0
- package/dist/db/manage/dolt-cleanup.js +132 -0
- package/dist/db/manage/manage-client.d.ts +26 -0
- package/dist/db/manage/manage-client.js +68 -0
- package/dist/db/{schema.d.ts → manage/manage-schema.d.ts} +1459 -1285
- package/dist/db/{schema.js → manage/manage-schema.js} +433 -341
- package/dist/db/manage/test-manage-client.d.ts +27 -0
- package/dist/db/manage/test-manage-client.js +68 -0
- package/dist/db/runtime/runtime-client.d.ts +20 -0
- package/dist/db/runtime/runtime-client.js +30 -0
- package/dist/db/runtime/runtime-schema.d.ts +2834 -0
- package/dist/db/runtime/runtime-schema.js +483 -0
- package/dist/db/runtime/test-runtime-client.d.ts +27 -0
- package/dist/db/{test-client.js → runtime/test-runtime-client.js} +11 -25
- package/dist/dolt/branch.d.ts +62 -0
- package/dist/dolt/branch.js +82 -0
- package/dist/dolt/branches-api.d.ts +108 -0
- package/dist/dolt/branches-api.js +162 -0
- package/dist/dolt/commit.d.ts +94 -0
- package/dist/dolt/commit.js +103 -0
- package/dist/dolt/diff.d.ts +27 -0
- package/dist/dolt/diff.js +21 -0
- package/dist/dolt/index.d.ts +10 -0
- package/dist/dolt/index.js +11 -0
- package/dist/dolt/merge.d.ts +63 -0
- package/dist/dolt/merge.js +81 -0
- package/dist/dolt/migrate-all-branches.d.ts +4 -0
- package/dist/dolt/migrate-all-branches.js +78 -0
- package/dist/dolt/migrate-dolt.d.ts +1 -0
- package/dist/dolt/migrate-dolt.js +22 -0
- package/dist/dolt/ref-helpers.d.ts +19 -0
- package/dist/dolt/ref-helpers.js +65 -0
- package/dist/dolt/ref-middleware.d.ts +82 -0
- package/dist/dolt/ref-middleware.js +217 -0
- package/dist/dolt/ref-scope.d.ts +101 -0
- package/dist/dolt/ref-scope.js +231 -0
- package/dist/dolt/schema-sync.d.ts +134 -0
- package/dist/dolt/schema-sync.js +246 -0
- package/dist/env.d.ts +6 -4
- package/dist/env.js +3 -2
- package/dist/index.d.ts +71 -44
- package/dist/index.js +74 -47
- package/dist/types/entities.d.ts +81 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/utility.d.ts +45 -4
- package/dist/utils/JsonTransformer.d.ts +44 -0
- package/dist/utils/JsonTransformer.js +112 -0
- package/dist/utils/apiKeys.d.ts +5 -1
- package/dist/utils/apiKeys.js +11 -1
- package/dist/utils/colors.d.ts +34 -0
- package/dist/utils/colors.js +49 -0
- package/dist/utils/credential-store-utils.d.ts +1 -1
- package/dist/utils/format-messages.d.ts +1 -1
- package/dist/utils/index.d.ts +7 -3
- package/dist/utils/index.js +7 -3
- package/dist/utils/internal-service-auth.d.ts +79 -0
- package/dist/utils/internal-service-auth.js +140 -0
- package/dist/utils/jwt-helpers.d.ts +56 -0
- package/dist/utils/jwt-helpers.js +90 -0
- package/dist/utils/service-token-auth.d.ts +9 -27
- package/dist/utils/service-token-auth.js +48 -96
- package/dist/utils/template-interpolation.d.ts +22 -0
- package/dist/utils/template-interpolation.js +62 -0
- package/dist/utils/third-party-mcp-servers/composio-client.js +23 -23
- package/dist/utils/trigger-auth.d.ts +62 -0
- package/dist/utils/trigger-auth.js +125 -0
- package/dist/validation/agentFull.js +2 -4
- package/dist/validation/dolt-schemas.d.ts +49 -0
- package/dist/validation/dolt-schemas.js +44 -0
- package/dist/validation/drizzle-schema-helpers.d.ts +4 -26
- package/dist/validation/drizzle-schema-helpers.js +5 -151
- package/dist/validation/index.d.ts +4 -3
- package/dist/validation/index.js +3 -2
- package/dist/validation/schemas.d.ts +17647 -4789
- package/dist/validation/schemas.js +328 -11
- package/drizzle/manage/0000_tearful_rhodey.sql +414 -0
- package/drizzle/manage/0001_broken_wendell_vaughn.sql +19 -0
- package/drizzle/manage/0002_bent_sunfire.sql +1 -0
- package/drizzle/manage/meta/0000_snapshot.json +2987 -0
- package/drizzle/manage/meta/0001_snapshot.json +3115 -0
- package/drizzle/manage/meta/0002_snapshot.json +3115 -0
- package/drizzle/manage/meta/_journal.json +27 -0
- package/drizzle/runtime/0008_silly_preak.sql +127 -0
- package/drizzle/runtime/0009_freezing_leo.sql +17 -0
- package/drizzle/runtime/meta/0008_snapshot.json +2263 -0
- package/drizzle/runtime/meta/0009_snapshot.json +2397 -0
- package/drizzle/{meta → runtime/meta}/_journal.json +14 -0
- package/package.json +48 -15
- package/dist/context/ContextFetcher.d.ts +0 -73
- package/dist/context/ContextFetcher.js +0 -291
- package/dist/context/ContextResolver.d.ts +0 -60
- package/dist/context/ContextResolver.js +0 -278
- package/dist/context/context.d.ts +0 -27
- package/dist/context/context.js +0 -128
- package/dist/context/contextCache.d.ts +0 -58
- package/dist/context/contextCache.js +0 -177
- package/dist/data-access/agentFull.d.ts +0 -33
- package/dist/data-access/projectFull.d.ts +0 -32
- package/dist/data-access/projects.d.ts +0 -71
- package/dist/data-access/tasks.d.ts +0 -45
- package/dist/data-access/users.d.ts +0 -19
- package/dist/db/client.d.ts +0 -20
- package/dist/db/client.js +0 -28
- package/dist/db/test-client.d.ts +0 -31
- package/dist/middleware/contextValidation.d.ts +0 -46
- package/dist/middleware/contextValidation.js +0 -280
- package/dist/middleware/index.d.ts +0 -2
- package/dist/middleware/index.js +0 -3
- package/dist/utils/execution.d.ts +0 -22
- package/dist/utils/execution.js +0 -25
- /package/drizzle/{0000_exotic_mysterio.sql → runtime/0000_exotic_mysterio.sql} +0 -0
- /package/drizzle/{0001_calm_sheva_callister.sql → runtime/0001_calm_sheva_callister.sql} +0 -0
- /package/drizzle/{0002_puzzling_goblin_queen.sql → runtime/0002_puzzling_goblin_queen.sql} +0 -0
- /package/drizzle/{0003_sweet_human_robot.sql → runtime/0003_sweet_human_robot.sql} +0 -0
- /package/drizzle/{0004_cuddly_shooting_star.sql → runtime/0004_cuddly_shooting_star.sql} +0 -0
- /package/drizzle/{0005_reflective_starfox.sql → runtime/0005_reflective_starfox.sql} +0 -0
- /package/drizzle/{0006_stale_thaddeus_ross.sql → runtime/0006_stale_thaddeus_ross.sql} +0 -0
- /package/drizzle/{0007_slim_karma.sql → runtime/0007_slim_karma.sql} +0 -0
- /package/drizzle/{meta → runtime/meta}/0000_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0001_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0003_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0005_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0006_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0007_snapshot.json +0 -0
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A2AError, A2ARequest, A2AResponse, APIKeySecurityScheme, AgentCapabilities, AgentCard, AgentProvider, AgentSkill, Artifact, AuthorizationCodeOAuthFlow, CancelTaskRequest, CancelTaskResponse, CancelTaskSuccessResponse, ClientCredentialsOAuthFlow, ContentTypeNotSupportedError, DataPart, FileBase, FilePart, FileWithBytes, FileWithUri, GetTaskPushNotificationConfigRequest, GetTaskPushNotificationConfigResponse, GetTaskPushNotificationConfigSuccessResponse, GetTaskRequest, GetTaskResponse, GetTaskSuccessResponse, HTTPAuthSecurityScheme, ImplicitOAuthFlow, InternalError, InvalidAgentResponseError, InvalidParamsError, InvalidRequestError, JSONParseError, JSONRPCError, JSONRPCErrorResponse, JSONRPCMessage, JSONRPCRequest, JSONRPCResult, Message, MessagePart, MessageSendConfiguration, MessageSendParams, MethodNotFoundError, OAuth2SecurityScheme, OAuthFlows, OpenIdConnectSecurityScheme, Part, PartBase, PasswordOAuthFlow, PushNotificationAuthenticationInfo, PushNotificationConfig, PushNotificationNotSupportedError, SecurityScheme, SecuritySchemeBase, SendMessageRequest, SendMessageResponse, SendMessageSuccessResponse, SendStreamingMessageRequest, SendStreamingMessageResponse, SendStreamingMessageSuccessResponse, SetTaskPushNotificationConfigRequest, SetTaskPushNotificationConfigResponse, SetTaskPushNotificationConfigSuccessResponse, Task, TaskArtifact, TaskArtifactUpdateEvent, TaskIdParams, TaskNotCancelableError, TaskNotFoundError, TaskPushNotificationConfig, TaskQueryParams, TaskResubscriptionRequest, TaskState, TaskStatus, TaskStatusUpdateEvent, TextPart, UnsupportedOperationError } from "./a2a.js";
|
|
2
|
-
import {
|
|
2
|
+
import { AgentConversationHistoryConfig, AgentScopeConfig, ApiKeyCreateResult, BaseExecutionContext, ContextCacheEntry, ContextFetchDefinition, ConversationHistoryConfig, ConversationMetadata, ConversationScopeOptions, CreateApiKeyParams, CredentialStoreType, DatasetItemExpectedOutput, DatasetItemInput, EvaluationJobFilterCriteria, EvaluationSuiteFilterCriteria, Filter, FullExecutionContext, MCPServerType, MCPTransportType, McpAuthType, McpServerAuth, McpServerCapabilities, McpToolDefinition, McpTransportConfig, MessageContent, MessageMetadata, MessageMode, MessageRole, MessageType, MessageVisibility, Models, PaginationConfig, PaginationResult, PassCriteria, PassCriteriaCondition, PassCriteriaOperator, ProjectInfo, ProjectModels, ProjectResourceCounts, ProjectScopeConfig, StatusComponent, StatusUpdateSettings, SubAgentScopeConfig, TOOL_STATUS_VALUES, TaskMetadataConfig, ToolMcpConfig, ToolServerCapabilities, ToolSimplifyConfig, VALID_RELATION_TYPES } from "./utility.js";
|
|
3
3
|
import { CorsConfig, CredentialStore, ServerConfig, ServerOptions } from "./server.js";
|
|
4
4
|
import { AgentMcpConfig, AgentMcpConfigInput, McpToolSelection, ToolPolicy, normalizeToolSelections } from "./tool-policies.js";
|
|
5
|
-
import {
|
|
6
|
-
export { A2AError, A2ARequest, A2AResponse, APIKeySecurityScheme, AgentApiInsert, AgentApiSelect, AgentApiUpdate, AgentCapabilities, AgentCard, AgentConversationHistoryConfig, AgentInsert, AgentMcpConfig, AgentMcpConfigInput, AgentProvider, AgentScopeConfig, AgentSelect, AgentSkill, AgentUpdate, AllAgentSelect, ApiKeyApiCreationResponse, ApiKeyApiInsert, ApiKeyApiSelect, ApiKeyApiUpdate, ApiKeyCreateResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentApiInsert, ArtifactComponentApiSelect, ArtifactComponentApiUpdate, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, AuthorizationCodeOAuthFlow, CanDelegateToExternalAgent, CanUseItem, CancelTaskRequest, CancelTaskResponse, CancelTaskSuccessResponse, ClientCredentialsOAuthFlow, ContentTypeNotSupportedError, ContextCacheApiInsert, ContextCacheApiSelect, ContextCacheApiUpdate, ContextCacheEntry, ContextCacheInsert, ContextCacheSelect, ContextCacheUpdate, ContextConfigApiInsert, ContextConfigApiSelect, ContextConfigApiUpdate, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ContextFetchDefinition, ConversationApiInsert, ConversationApiSelect, ConversationApiUpdate, ConversationHistoryConfig, ConversationInsert, ConversationMetadata, ConversationScopeOptions, ConversationSelect, ConversationUpdate, CorsConfig, CreateApiKeyParams, CredentialReferenceApiInsert, CredentialReferenceApiSelect, CredentialReferenceApiUpdate, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, CredentialStore, CredentialStoreType, DataComponentApiInsert, DataComponentApiSelect, DataComponentApiUpdate, DataComponentInsert, DataComponentSelect, DataComponentUpdate, DataPart,
|
|
5
|
+
import { AgentApiInsert, AgentApiSelect, AgentApiUpdate, AgentInsert, AgentSelect, AgentUpdate, AgentWithinContextOfProjectSelect, AgentWithinContextOfProjectSelectWithRelationIds, AllAgentSelect, ApiKeyApiCreationResponse, ApiKeyApiInsert, ApiKeyApiSelect, ApiKeyApiUpdate, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, ArtifactComponentApiInsert, ArtifactComponentApiSelect, ArtifactComponentApiUpdate, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, CanDelegateToExternalAgent, CanDelegateToExternalAgentInsert, CanDelegateToItem, CanDelegateToItemInsert, CanDelegateToTeamAgent, CanDelegateToTeamAgentInsert, CanRelateToInternalSubAgent, CanUseItem, ContextCacheApiInsert, ContextCacheApiSelect, ContextCacheApiUpdate, ContextCacheInsert, ContextCacheSelect, ContextCacheUpdate, ContextConfigApiInsert, ContextConfigApiSelect, ContextConfigApiUpdate, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ConversationApiInsert, ConversationApiSelect, ConversationApiUpdate, ConversationInsert, ConversationSelect, ConversationUpdate, CredentialReferenceApiInsert, CredentialReferenceApiSelect, CredentialReferenceApiUpdate, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, DataComponentApiInsert, DataComponentApiSelect, DataComponentApiUpdate, DataComponentInsert, DataComponentSelect, DataComponentUpdate, DatasetInsert, DatasetItemInsert, DatasetItemSelect, DatasetItemUpdate, DatasetRunConfigAgentRelationInsert, DatasetRunConfigAgentRelationSelect, DatasetRunConfigAgentRelationUpdate, DatasetRunConfigInsert, DatasetRunConfigSelect, DatasetRunConfigUpdate, DatasetRunConversationRelationInsert, DatasetRunConversationRelationSelect, DatasetRunConversationRelationUpdate, DatasetRunInsert, DatasetRunItem, DatasetRunSelect, DatasetRunUpdate, DatasetSelect, DatasetUpdate, EvaluationJobConfigEvaluatorRelationInsert, EvaluationJobConfigEvaluatorRelationSelect, EvaluationJobConfigEvaluatorRelationUpdate, EvaluationJobConfigInsert, EvaluationJobConfigSelect, EvaluationJobConfigUpdate, EvaluationResultInsert, EvaluationResultSelect, EvaluationResultUpdate, EvaluationRunConfigEvaluationSuiteConfigRelationInsert, EvaluationRunConfigEvaluationSuiteConfigRelationSelect, EvaluationRunConfigEvaluationSuiteConfigRelationUpdate, EvaluationRunConfigInsert, EvaluationRunConfigSelect, EvaluationRunConfigUpdate, EvaluationRunConfigWithSuiteConfigs, EvaluationRunInsert, EvaluationRunSelect, EvaluationRunUpdate, EvaluationSuiteConfigEvaluatorRelationInsert, EvaluationSuiteConfigEvaluatorRelationSelect, EvaluationSuiteConfigEvaluatorRelationUpdate, EvaluationSuiteConfigInsert, EvaluationSuiteConfigSelect, EvaluationSuiteConfigUpdate, EvaluatorInsert, EvaluatorSelect, EvaluatorUpdate, ExternalAgentApiInsert, ExternalAgentApiSelect, ExternalAgentApiUpdate, ExternalAgentInsert, ExternalAgentSelect, ExternalAgentUpdate, ExternalSubAgentRelationApiInsert, ExternalSubAgentRelationInsert, FetchConfig, FetchDefinition, FullAgentAgentInsert, FullAgentDefinition, FullAgentSelect, FullAgentSelectWithRelationIds, FullAgentSubAgentSelect, FullAgentSubAgentSelectWithRelationIds, FullProjectDefinition, FullProjectSelect, FullProjectSelectWithRelationIds, FunctionApiInsert, FunctionApiSelect, FunctionApiUpdate, FunctionInsert, FunctionSelect, FunctionToolApiInsert, FunctionToolApiSelect, FunctionToolApiUpdate, FunctionUpdate, LedgerArtifactApiInsert, LedgerArtifactApiSelect, LedgerArtifactApiUpdate, LedgerArtifactInsert, LedgerArtifactSelect, LedgerArtifactUpdate, MCPToolConfig, McpTool, MessageApiInsert, MessageApiSelect, MessageApiUpdate, MessageInsert, MessageSelect, MessageUpdate, Pagination, ProjectApiInsert, ProjectApiSelect, ProjectApiUpdate, ProjectInsert, ProjectMetadataInsert, ProjectMetadataSelect, ProjectSelect, ProjectUpdate, SubAgentApiInsert, SubAgentApiSelect, SubAgentApiUpdate, SubAgentArtifactComponentApiInsert, SubAgentArtifactComponentApiSelect, SubAgentArtifactComponentApiUpdate, SubAgentArtifactComponentInsert, SubAgentArtifactComponentSelect, SubAgentArtifactComponentUpdate, SubAgentDataComponentApiInsert, SubAgentDataComponentApiSelect, SubAgentDataComponentApiUpdate, SubAgentDataComponentInsert, SubAgentDataComponentSelect, SubAgentDataComponentUpdate, SubAgentDefinition, SubAgentExternalAgentRelationApiInsert, SubAgentExternalAgentRelationApiSelect, SubAgentExternalAgentRelationApiUpdate, SubAgentExternalAgentRelationInsert, SubAgentExternalAgentRelationSelect, SubAgentExternalAgentRelationUpdate, SubAgentInsert, SubAgentRelationApiInsert, SubAgentRelationApiSelect, SubAgentRelationApiUpdate, SubAgentRelationInsert, SubAgentRelationQuery, SubAgentRelationSelect, SubAgentRelationUpdate, SubAgentSelect, SubAgentTeamAgentRelationApiInsert, SubAgentTeamAgentRelationApiSelect, SubAgentTeamAgentRelationApiUpdate, SubAgentTeamAgentRelationInsert, SubAgentTeamAgentRelationSelect, SubAgentTeamAgentRelationUpdate, SubAgentToolRelationApiInsert, SubAgentToolRelationApiSelect, SubAgentToolRelationApiUpdate, SubAgentToolRelationInsert, SubAgentToolRelationSelect, SubAgentToolRelationUpdate, SubAgentUpdate, SummaryEvent, TaskApiInsert, TaskApiSelect, TaskApiUpdate, TaskInsert, TaskRelationApiInsert, TaskRelationApiSelect, TaskRelationApiUpdate, TaskRelationInsert, TaskRelationSelect, TaskRelationUpdate, TaskSelect, TaskUpdate, ToolApiInsert, ToolApiSelect, ToolApiUpdate, ToolDefinition, ToolInsert, ToolSelect, ToolUpdate, TriggerApiInsert, TriggerApiSelect, TriggerApiUpdate, TriggerBatchConversationEvaluationRequest, TriggerConversationEvaluationRequest, TriggerDatasetRunRequest, TriggerEvaluationJobRequest, TriggerInsert, TriggerInvocationApiInsert, TriggerInvocationApiSelect, TriggerInvocationApiUpdate, TriggerInvocationInsert, TriggerInvocationSelect, TriggerInvocationUpdate, TriggerSelect, TriggerUpdate } from "./entities.js";
|
|
6
|
+
export { A2AError, A2ARequest, A2AResponse, APIKeySecurityScheme, AgentApiInsert, AgentApiSelect, AgentApiUpdate, AgentCapabilities, AgentCard, AgentConversationHistoryConfig, AgentInsert, AgentMcpConfig, AgentMcpConfigInput, AgentProvider, AgentScopeConfig, AgentSelect, AgentSkill, AgentUpdate, AgentWithinContextOfProjectSelect, AgentWithinContextOfProjectSelectWithRelationIds, AllAgentSelect, ApiKeyApiCreationResponse, ApiKeyApiInsert, ApiKeyApiSelect, ApiKeyApiUpdate, ApiKeyCreateResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentApiInsert, ArtifactComponentApiSelect, ArtifactComponentApiUpdate, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, AuthorizationCodeOAuthFlow, BaseExecutionContext, CanDelegateToExternalAgent, CanDelegateToExternalAgentInsert, CanDelegateToItem, CanDelegateToItemInsert, CanDelegateToTeamAgent, CanDelegateToTeamAgentInsert, CanRelateToInternalSubAgent, CanUseItem, CancelTaskRequest, CancelTaskResponse, CancelTaskSuccessResponse, ClientCredentialsOAuthFlow, ContentTypeNotSupportedError, ContextCacheApiInsert, ContextCacheApiSelect, ContextCacheApiUpdate, ContextCacheEntry, ContextCacheInsert, ContextCacheSelect, ContextCacheUpdate, ContextConfigApiInsert, ContextConfigApiSelect, ContextConfigApiUpdate, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ContextFetchDefinition, ConversationApiInsert, ConversationApiSelect, ConversationApiUpdate, ConversationHistoryConfig, ConversationInsert, ConversationMetadata, ConversationScopeOptions, ConversationSelect, ConversationUpdate, CorsConfig, CreateApiKeyParams, CredentialReferenceApiInsert, CredentialReferenceApiSelect, CredentialReferenceApiUpdate, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, CredentialStore, CredentialStoreType, DataComponentApiInsert, DataComponentApiSelect, DataComponentApiUpdate, DataComponentInsert, DataComponentSelect, DataComponentUpdate, DataPart, DatasetInsert, DatasetItemExpectedOutput, DatasetItemInput, DatasetItemInsert, DatasetItemSelect, DatasetItemUpdate, DatasetRunConfigAgentRelationInsert, DatasetRunConfigAgentRelationSelect, DatasetRunConfigAgentRelationUpdate, DatasetRunConfigInsert, DatasetRunConfigSelect, DatasetRunConfigUpdate, DatasetRunConversationRelationInsert, DatasetRunConversationRelationSelect, DatasetRunConversationRelationUpdate, DatasetRunInsert, DatasetRunItem, DatasetRunSelect, DatasetRunUpdate, DatasetSelect, DatasetUpdate, EvaluationJobConfigEvaluatorRelationInsert, EvaluationJobConfigEvaluatorRelationSelect, EvaluationJobConfigEvaluatorRelationUpdate, EvaluationJobConfigInsert, EvaluationJobConfigSelect, EvaluationJobConfigUpdate, EvaluationJobFilterCriteria, EvaluationResultInsert, EvaluationResultSelect, EvaluationResultUpdate, EvaluationRunConfigEvaluationSuiteConfigRelationInsert, EvaluationRunConfigEvaluationSuiteConfigRelationSelect, EvaluationRunConfigEvaluationSuiteConfigRelationUpdate, EvaluationRunConfigInsert, EvaluationRunConfigSelect, EvaluationRunConfigUpdate, EvaluationRunConfigWithSuiteConfigs, EvaluationRunInsert, EvaluationRunSelect, EvaluationRunUpdate, EvaluationSuiteConfigEvaluatorRelationInsert, EvaluationSuiteConfigEvaluatorRelationSelect, EvaluationSuiteConfigEvaluatorRelationUpdate, EvaluationSuiteConfigInsert, EvaluationSuiteConfigSelect, EvaluationSuiteConfigUpdate, EvaluationSuiteFilterCriteria, EvaluatorInsert, EvaluatorSelect, EvaluatorUpdate, ExternalAgentApiInsert, ExternalAgentApiSelect, ExternalAgentApiUpdate, ExternalAgentInsert, ExternalAgentSelect, ExternalAgentUpdate, ExternalSubAgentRelationApiInsert, ExternalSubAgentRelationInsert, FetchConfig, FetchDefinition, FileBase, FilePart, FileWithBytes, FileWithUri, Filter, FullAgentAgentInsert, FullAgentDefinition, FullAgentSelect, FullAgentSelectWithRelationIds, FullAgentSubAgentSelect, FullAgentSubAgentSelectWithRelationIds, FullExecutionContext, FullProjectDefinition, FullProjectSelect, FullProjectSelectWithRelationIds, FunctionApiInsert, FunctionApiSelect, FunctionApiUpdate, FunctionInsert, FunctionSelect, FunctionToolApiInsert, FunctionToolApiSelect, FunctionToolApiUpdate, FunctionUpdate, GetTaskPushNotificationConfigRequest, GetTaskPushNotificationConfigResponse, GetTaskPushNotificationConfigSuccessResponse, GetTaskRequest, GetTaskResponse, GetTaskSuccessResponse, HTTPAuthSecurityScheme, ImplicitOAuthFlow, InternalError, InvalidAgentResponseError, InvalidParamsError, InvalidRequestError, JSONParseError, JSONRPCError, JSONRPCErrorResponse, JSONRPCMessage, JSONRPCRequest, JSONRPCResult, LedgerArtifactApiInsert, LedgerArtifactApiSelect, LedgerArtifactApiUpdate, LedgerArtifactInsert, LedgerArtifactSelect, LedgerArtifactUpdate, MCPServerType, MCPToolConfig, MCPTransportType, McpAuthType, McpServerAuth, McpServerCapabilities, McpTool, McpToolDefinition, McpToolSelection, McpTransportConfig, Message, MessageApiInsert, MessageApiSelect, MessageApiUpdate, MessageContent, MessageInsert, MessageMetadata, MessageMode, MessagePart, MessageRole, MessageSelect, MessageSendConfiguration, MessageSendParams, MessageType, MessageUpdate, MessageVisibility, MethodNotFoundError, Models, OAuth2SecurityScheme, OAuthFlows, OpenIdConnectSecurityScheme, Pagination, PaginationConfig, PaginationResult, Part, PartBase, PassCriteria, PassCriteriaCondition, PassCriteriaOperator, PasswordOAuthFlow, ProjectApiInsert, ProjectApiSelect, ProjectApiUpdate, ProjectInfo, ProjectInsert, ProjectMetadataInsert, ProjectMetadataSelect, ProjectModels, ProjectResourceCounts, ProjectScopeConfig, ProjectSelect, ProjectUpdate, PushNotificationAuthenticationInfo, PushNotificationConfig, PushNotificationNotSupportedError, SecurityScheme, SecuritySchemeBase, SendMessageRequest, SendMessageResponse, SendMessageSuccessResponse, SendStreamingMessageRequest, SendStreamingMessageResponse, SendStreamingMessageSuccessResponse, ServerConfig, ServerOptions, SetTaskPushNotificationConfigRequest, SetTaskPushNotificationConfigResponse, SetTaskPushNotificationConfigSuccessResponse, StatusComponent, StatusUpdateSettings, SubAgentApiInsert, SubAgentApiSelect, SubAgentApiUpdate, SubAgentArtifactComponentApiInsert, SubAgentArtifactComponentApiSelect, SubAgentArtifactComponentApiUpdate, SubAgentArtifactComponentInsert, SubAgentArtifactComponentSelect, SubAgentArtifactComponentUpdate, SubAgentDataComponentApiInsert, SubAgentDataComponentApiSelect, SubAgentDataComponentApiUpdate, SubAgentDataComponentInsert, SubAgentDataComponentSelect, SubAgentDataComponentUpdate, SubAgentDefinition, SubAgentExternalAgentRelationApiInsert, SubAgentExternalAgentRelationApiSelect, SubAgentExternalAgentRelationApiUpdate, SubAgentExternalAgentRelationInsert, SubAgentExternalAgentRelationSelect, SubAgentExternalAgentRelationUpdate, SubAgentInsert, SubAgentRelationApiInsert, SubAgentRelationApiSelect, SubAgentRelationApiUpdate, SubAgentRelationInsert, SubAgentRelationQuery, SubAgentRelationSelect, SubAgentRelationUpdate, SubAgentScopeConfig, SubAgentSelect, SubAgentTeamAgentRelationApiInsert, SubAgentTeamAgentRelationApiSelect, SubAgentTeamAgentRelationApiUpdate, SubAgentTeamAgentRelationInsert, SubAgentTeamAgentRelationSelect, SubAgentTeamAgentRelationUpdate, SubAgentToolRelationApiInsert, SubAgentToolRelationApiSelect, SubAgentToolRelationApiUpdate, SubAgentToolRelationInsert, SubAgentToolRelationSelect, SubAgentToolRelationUpdate, SubAgentUpdate, SummaryEvent, TOOL_STATUS_VALUES, Task, TaskApiInsert, TaskApiSelect, TaskApiUpdate, TaskArtifact, TaskArtifactUpdateEvent, TaskIdParams, TaskInsert, TaskMetadataConfig, TaskNotCancelableError, TaskNotFoundError, TaskPushNotificationConfig, TaskQueryParams, TaskRelationApiInsert, TaskRelationApiSelect, TaskRelationApiUpdate, TaskRelationInsert, TaskRelationSelect, TaskRelationUpdate, TaskResubscriptionRequest, TaskSelect, TaskState, TaskStatus, TaskStatusUpdateEvent, TaskUpdate, TextPart, ToolApiInsert, ToolApiSelect, ToolApiUpdate, ToolDefinition, ToolInsert, ToolMcpConfig, ToolPolicy, ToolSelect, ToolServerCapabilities, ToolSimplifyConfig, ToolUpdate, TriggerApiInsert, TriggerApiSelect, TriggerApiUpdate, TriggerBatchConversationEvaluationRequest, TriggerConversationEvaluationRequest, TriggerDatasetRunRequest, TriggerEvaluationJobRequest, TriggerInsert, TriggerInvocationApiInsert, TriggerInvocationApiSelect, TriggerInvocationApiUpdate, TriggerInvocationInsert, TriggerInvocationSelect, TriggerInvocationUpdate, TriggerSelect, TriggerUpdate, UnsupportedOperationError, VALID_RELATION_TYPES, normalizeToolSelections };
|
package/dist/types/utility.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ApiKeySelect } from "./entities.js";
|
|
1
|
+
import { ResolvedRef } from "../validation/dolt-schemas.js";
|
|
3
2
|
import "../index.js";
|
|
3
|
+
import { EvaluationJobFilterCriteriaSchema, McpTransportConfigSchema, ModelSchema, ProjectModelSchema, StatusComponentSchema, StatusUpdateSchema } from "../validation/schemas.js";
|
|
4
|
+
import { ApiKeySelect, FullProjectSelectWithRelationIds } from "./entities.js";
|
|
4
5
|
import { z } from "@hono/zod-openapi";
|
|
5
6
|
|
|
6
7
|
//#region src/types/utility.d.ts
|
|
@@ -142,6 +143,12 @@ type McpToolDefinition = {
|
|
|
142
143
|
description?: string;
|
|
143
144
|
inputSchema?: Record<string, unknown>;
|
|
144
145
|
};
|
|
146
|
+
type ToolSimplifyConfig = {
|
|
147
|
+
displayName?: string;
|
|
148
|
+
description?: string;
|
|
149
|
+
schema?: any;
|
|
150
|
+
transformation?: Record<string, string> | string;
|
|
151
|
+
};
|
|
145
152
|
type ToolMcpConfig = {
|
|
146
153
|
server: {
|
|
147
154
|
url: string;
|
|
@@ -150,6 +157,8 @@ type ToolMcpConfig = {
|
|
|
150
157
|
};
|
|
151
158
|
transport?: McpTransportConfig;
|
|
152
159
|
activeTools?: string[];
|
|
160
|
+
toolOverrides?: Record<string, ToolSimplifyConfig>;
|
|
161
|
+
prompt?: string;
|
|
153
162
|
};
|
|
154
163
|
type ToolServerCapabilities = {
|
|
155
164
|
tools?: boolean;
|
|
@@ -209,7 +218,7 @@ interface ApiKeyCreateResult {
|
|
|
209
218
|
* Execution context that gets propagated through agent calls
|
|
210
219
|
* Contains authentication and routing information for internal API calls
|
|
211
220
|
*/
|
|
212
|
-
interface
|
|
221
|
+
interface BaseExecutionContext {
|
|
213
222
|
/** The original API key from the client request */
|
|
214
223
|
apiKey: string;
|
|
215
224
|
/** Tenant ID extracted from API key */
|
|
@@ -222,6 +231,8 @@ interface ExecutionContext {
|
|
|
222
231
|
baseUrl: string;
|
|
223
232
|
/** API key ID for tracking */
|
|
224
233
|
apiKeyId: string;
|
|
234
|
+
/** Ref extracted from query params */
|
|
235
|
+
ref?: string;
|
|
225
236
|
/** Sub Agent ID extracted from request headers (only for internal A2A calls) */
|
|
226
237
|
subAgentId?: string;
|
|
227
238
|
/** Metadata for the execution context */
|
|
@@ -234,6 +245,10 @@ interface ExecutionContext {
|
|
|
234
245
|
};
|
|
235
246
|
};
|
|
236
247
|
}
|
|
248
|
+
interface FullExecutionContext extends BaseExecutionContext {
|
|
249
|
+
resolvedRef: ResolvedRef;
|
|
250
|
+
project: FullProjectSelectWithRelationIds;
|
|
251
|
+
}
|
|
237
252
|
/**
|
|
238
253
|
* Reusable filter type that supports and/or operations
|
|
239
254
|
*
|
|
@@ -285,5 +300,31 @@ type Filter<T extends Record<string, unknown>> = T | {
|
|
|
285
300
|
} | {
|
|
286
301
|
or: Array<Filter<T>>;
|
|
287
302
|
};
|
|
303
|
+
type PassCriteriaOperator = '>' | '<' | '>=' | '<=' | '=' | '!=';
|
|
304
|
+
type PassCriteriaCondition = {
|
|
305
|
+
field: string;
|
|
306
|
+
operator: PassCriteriaOperator;
|
|
307
|
+
value: number;
|
|
308
|
+
};
|
|
309
|
+
type PassCriteria = {
|
|
310
|
+
operator: 'and' | 'or';
|
|
311
|
+
conditions: PassCriteriaCondition[];
|
|
312
|
+
};
|
|
313
|
+
type EvaluationJobFilterCriteria = z.infer<typeof EvaluationJobFilterCriteriaSchema>;
|
|
314
|
+
type EvaluationSuiteFilterCriteria = {
|
|
315
|
+
agentIds?: string[];
|
|
316
|
+
[key: string]: unknown;
|
|
317
|
+
};
|
|
318
|
+
type DatasetItemInput = {
|
|
319
|
+
messages: Array<{
|
|
320
|
+
role: string;
|
|
321
|
+
content: MessageContent;
|
|
322
|
+
}>;
|
|
323
|
+
headers?: Record<string, string>;
|
|
324
|
+
};
|
|
325
|
+
type DatasetItemExpectedOutput = Array<{
|
|
326
|
+
role: string;
|
|
327
|
+
content: MessageContent;
|
|
328
|
+
}>;
|
|
288
329
|
//#endregion
|
|
289
|
-
export { AgentConversationHistoryConfig, AgentScopeConfig, ApiKeyCreateResult, ContextCacheEntry, ContextFetchDefinition, ConversationHistoryConfig, ConversationMetadata, ConversationScopeOptions, CreateApiKeyParams, CredentialStoreType,
|
|
330
|
+
export { AgentConversationHistoryConfig, AgentScopeConfig, ApiKeyCreateResult, BaseExecutionContext, ContextCacheEntry, ContextFetchDefinition, ConversationHistoryConfig, ConversationMetadata, ConversationScopeOptions, CreateApiKeyParams, CredentialStoreType, DatasetItemExpectedOutput, DatasetItemInput, EvaluationJobFilterCriteria, EvaluationSuiteFilterCriteria, Filter, FullExecutionContext, MCPServerType, MCPTransportType, McpAuthType, McpServerAuth, McpServerCapabilities, McpToolDefinition, McpTransportConfig, MessageContent, MessageMetadata, MessageMode, MessageRole, MessageType, MessageVisibility, Models, PaginationConfig, PaginationResult, PassCriteria, PassCriteriaCondition, PassCriteriaOperator, ProjectInfo, ProjectModels, ProjectResourceCounts, ProjectScopeConfig, StatusComponent, StatusUpdateSettings, SubAgentScopeConfig, TOOL_STATUS_VALUES, TaskMetadataConfig, ToolMcpConfig, ToolServerCapabilities, ToolSimplifyConfig, VALID_RELATION_TYPES };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/utils/JsonTransformer.d.ts
|
|
2
|
+
interface TransformOptions {
|
|
3
|
+
timeout?: number;
|
|
4
|
+
maxDepth?: number;
|
|
5
|
+
allowedFunctions?: string[];
|
|
6
|
+
}
|
|
7
|
+
declare class JsonTransformer {
|
|
8
|
+
private static readonly DEFAULT_TIMEOUT;
|
|
9
|
+
private static readonly MAX_EXPRESSION_LENGTH;
|
|
10
|
+
private static readonly DANGEROUS_PATTERNS;
|
|
11
|
+
/**
|
|
12
|
+
* Validate JMESPath expression for security and correctness
|
|
13
|
+
*/
|
|
14
|
+
private static validateJMESPath;
|
|
15
|
+
/**
|
|
16
|
+
* Execute JMESPath with timeout protection
|
|
17
|
+
*/
|
|
18
|
+
private static executeWithTimeout;
|
|
19
|
+
/**
|
|
20
|
+
* Transform input data using JMESPath expression with security validation
|
|
21
|
+
*/
|
|
22
|
+
static transform(input: any, jmesPathExpression: string, options?: TransformOptions): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Convert simple object transformation to JMESPath expression
|
|
25
|
+
* For SDK convenience - converts { key: 'path' } to JMESPath
|
|
26
|
+
*/
|
|
27
|
+
static objectToJMESPath(objectTransformation: Record<string, string>): string;
|
|
28
|
+
/**
|
|
29
|
+
* Transform using either direct JMESPath string or object transformation
|
|
30
|
+
* Supports both SDK patterns
|
|
31
|
+
*/
|
|
32
|
+
static transformWithConfig(input: any, config: {
|
|
33
|
+
jmespath?: string;
|
|
34
|
+
objectTransformation?: Record<string, string>;
|
|
35
|
+
}, options?: TransformOptions): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* Synchronous transform method for backward compatibility
|
|
38
|
+
* WARNING: This bypasses security validation - use async transform() instead
|
|
39
|
+
* @deprecated Use async transform() method instead
|
|
40
|
+
*/
|
|
41
|
+
static transformSync(input: any, jmesPathExpression: string): any;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { JsonTransformer };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { getLogger } from "./logger.js";
|
|
2
|
+
import * as jmespath$1 from "jmespath";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/JsonTransformer.ts
|
|
5
|
+
const jmespathExt = jmespath$1;
|
|
6
|
+
const logger = getLogger("JsonTransformer");
|
|
7
|
+
var JsonTransformer = class JsonTransformer {
|
|
8
|
+
static DEFAULT_TIMEOUT = 5e3;
|
|
9
|
+
static MAX_EXPRESSION_LENGTH = 1e3;
|
|
10
|
+
static DANGEROUS_PATTERNS = [
|
|
11
|
+
/\$\{.*\}/,
|
|
12
|
+
/eval\s*\(/,
|
|
13
|
+
/function\s*\(/,
|
|
14
|
+
/constructor/,
|
|
15
|
+
/prototype/,
|
|
16
|
+
/__proto__/
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Validate JMESPath expression for security and correctness
|
|
20
|
+
*/
|
|
21
|
+
static validateJMESPath(expression, _allowedFunctions) {
|
|
22
|
+
if (!expression || typeof expression !== "string") throw new Error("JMESPath expression must be a non-empty string");
|
|
23
|
+
if (expression.length > JsonTransformer.MAX_EXPRESSION_LENGTH) throw new Error(`JMESPath expression too long (max ${JsonTransformer.MAX_EXPRESSION_LENGTH} characters)`);
|
|
24
|
+
for (const pattern of JsonTransformer.DANGEROUS_PATTERNS) if (pattern.test(expression)) throw new Error(`JMESPath expression contains dangerous pattern: ${pattern.source}`);
|
|
25
|
+
try {
|
|
26
|
+
jmespathExt.compile(expression);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
throw new Error(`Invalid JMESPath syntax: ${error instanceof Error ? error.message : String(error)}`);
|
|
29
|
+
}
|
|
30
|
+
logger.debug("JMESPath expression validated", `${expression.substring(0, 100)}...`);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Execute JMESPath with timeout protection
|
|
34
|
+
*/
|
|
35
|
+
static executeWithTimeout(input, expression, timeoutMs) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const timeout = setTimeout(() => {
|
|
38
|
+
reject(/* @__PURE__ */ new Error(`JMESPath transformation timed out after ${timeoutMs}ms`));
|
|
39
|
+
}, timeoutMs);
|
|
40
|
+
try {
|
|
41
|
+
const result = jmespath$1.search(input, expression);
|
|
42
|
+
clearTimeout(timeout);
|
|
43
|
+
resolve(result);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
clearTimeout(timeout);
|
|
46
|
+
reject(error);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Transform input data using JMESPath expression with security validation
|
|
52
|
+
*/
|
|
53
|
+
static async transform(input, jmesPathExpression, options = {}) {
|
|
54
|
+
const { timeout = JsonTransformer.DEFAULT_TIMEOUT, allowedFunctions } = options;
|
|
55
|
+
JsonTransformer.validateJMESPath(jmesPathExpression, allowedFunctions);
|
|
56
|
+
try {
|
|
57
|
+
logger.debug("Executing JMESPath transformation", `inputType: ${typeof input}, expression: ${jmesPathExpression.substring(0, 100)}..., timeout: ${timeout}`);
|
|
58
|
+
const result = await JsonTransformer.executeWithTimeout(input, jmesPathExpression, timeout);
|
|
59
|
+
logger.debug("JMESPath transformation completed successfully", "");
|
|
60
|
+
return result;
|
|
61
|
+
} catch (error) {
|
|
62
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
63
|
+
logger.error("JMESPath transformation failed", `expression: ${jmesPathExpression.substring(0, 100)}..., error: ${message}`);
|
|
64
|
+
throw new Error(`JMESPath transformation failed for expression "${jmesPathExpression}": ${message}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Convert simple object transformation to JMESPath expression
|
|
69
|
+
* For SDK convenience - converts { key: 'path' } to JMESPath
|
|
70
|
+
*/
|
|
71
|
+
static objectToJMESPath(objectTransformation) {
|
|
72
|
+
if (!objectTransformation || typeof objectTransformation !== "object") throw new Error("Object transformation must be a non-null object");
|
|
73
|
+
return `{ ${Object.entries(objectTransformation).map(([key, path]) => {
|
|
74
|
+
if (!key || typeof key !== "string") throw new Error("Object transformation keys must be non-empty strings");
|
|
75
|
+
if (!path || typeof path !== "string") throw new Error("Object transformation values must be non-empty strings");
|
|
76
|
+
try {
|
|
77
|
+
jmespathExt.compile(path);
|
|
78
|
+
} catch (error) {
|
|
79
|
+
throw new Error(`Invalid JMESPath in object transformation value "${path}": ${error instanceof Error ? error.message : String(error)}`);
|
|
80
|
+
}
|
|
81
|
+
return `${key}: ${path}`;
|
|
82
|
+
}).join(", ")} }`;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Transform using either direct JMESPath string or object transformation
|
|
86
|
+
* Supports both SDK patterns
|
|
87
|
+
*/
|
|
88
|
+
static async transformWithConfig(input, config, options = {}) {
|
|
89
|
+
if (config.jmespath) return JsonTransformer.transform(input, config.jmespath, options);
|
|
90
|
+
if (config.objectTransformation) {
|
|
91
|
+
const jmesPath = JsonTransformer.objectToJMESPath(config.objectTransformation);
|
|
92
|
+
return JsonTransformer.transform(input, jmesPath, options);
|
|
93
|
+
}
|
|
94
|
+
throw new Error("Either jmespath or objectTransformation must be provided");
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Synchronous transform method for backward compatibility
|
|
98
|
+
* WARNING: This bypasses security validation - use async transform() instead
|
|
99
|
+
* @deprecated Use async transform() method instead
|
|
100
|
+
*/
|
|
101
|
+
static transformSync(input, jmesPathExpression) {
|
|
102
|
+
logger.warn("Using deprecated synchronous transform method - security validation bypassed", "");
|
|
103
|
+
try {
|
|
104
|
+
return jmespath$1.search(input, jmesPathExpression);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
throw new Error(`JMESPath transformation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
export { JsonTransformer };
|
package/dist/utils/apiKeys.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ type ApiKeyGenerationResult = {
|
|
|
10
10
|
* Generate a new API key with secure random bytes
|
|
11
11
|
*/
|
|
12
12
|
declare function generateApiKey(): Promise<ApiKeyGenerationResult>;
|
|
13
|
+
declare const getMetadataFromApiKey: (key: string) => {
|
|
14
|
+
tenantId: string;
|
|
15
|
+
projectId: string;
|
|
16
|
+
} | null;
|
|
13
17
|
/**
|
|
14
18
|
* Hash an API key using scrypt
|
|
15
19
|
*/
|
|
@@ -31,4 +35,4 @@ declare function extractPublicId(key: string): string | null;
|
|
|
31
35
|
*/
|
|
32
36
|
declare function maskApiKey(keyPrefix: string): string;
|
|
33
37
|
//#endregion
|
|
34
|
-
export { ApiKeyGenerationResult, extractPublicId, generateApiKey, hashApiKey, isApiKeyExpired, maskApiKey, validateApiKey };
|
|
38
|
+
export { ApiKeyGenerationResult, extractPublicId, generateApiKey, getMetadataFromApiKey, hashApiKey, isApiKeyExpired, maskApiKey, validateApiKey };
|
package/dist/utils/apiKeys.js
CHANGED
|
@@ -27,6 +27,16 @@ async function generateApiKey() {
|
|
|
27
27
|
keyPrefix
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
const getMetadataFromApiKey = (key) => {
|
|
31
|
+
const parts = key.split(".");
|
|
32
|
+
if (parts.length !== 2) return null;
|
|
33
|
+
const segments = parts[0].split("_");
|
|
34
|
+
if (segments.length < 3) return null;
|
|
35
|
+
return {
|
|
36
|
+
tenantId: segments[1],
|
|
37
|
+
projectId: segments[2]
|
|
38
|
+
};
|
|
39
|
+
};
|
|
30
40
|
/**
|
|
31
41
|
* Hash an API key using scrypt
|
|
32
42
|
*/
|
|
@@ -80,4 +90,4 @@ function maskApiKey(keyPrefix) {
|
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
//#endregion
|
|
83
|
-
export { extractPublicId, generateApiKey, hashApiKey, isApiKeyExpired, maskApiKey, validateApiKey };
|
|
93
|
+
export { extractPublicId, generateApiKey, getMetadataFromApiKey, hashApiKey, isApiKeyExpired, maskApiKey, validateApiKey };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/utils/colors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Color generation utilities using iwanthue library.
|
|
4
|
+
*/
|
|
5
|
+
interface ColorOptions {
|
|
6
|
+
/** Seed for deterministic color generation */
|
|
7
|
+
seed?: string;
|
|
8
|
+
/** Quality of clustering (higher = better but slower). Default: 50 */
|
|
9
|
+
quality?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Generates N visually distinct colors using iwanthue.
|
|
13
|
+
*
|
|
14
|
+
* @param count - Number of colors to generate
|
|
15
|
+
* @param options - Optional generation settings
|
|
16
|
+
* @returns Array of hex color strings
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const colors = generateDistinctColors(5);
|
|
21
|
+
* // ['#4a8fd9', '#d94a7a', '#5ad94a', '#d9a14a', '#9a4ad9']
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function generateDistinctColors(count: number, options?: ColorOptions): string[];
|
|
25
|
+
/**
|
|
26
|
+
* Creates a color map from an array of keys.
|
|
27
|
+
*
|
|
28
|
+
* @param keys - Array of unique string keys
|
|
29
|
+
* @param options - Optional generation settings
|
|
30
|
+
* @returns Map of key to hex color
|
|
31
|
+
*/
|
|
32
|
+
declare function createColorMap(keys: string[], options?: ColorOptions): Record<string, string>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { ColorOptions, createColorMap, generateDistinctColors };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import iwanthue from "iwanthue";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/colors.ts
|
|
4
|
+
/**
|
|
5
|
+
* Color generation utilities using iwanthue library.
|
|
6
|
+
*/
|
|
7
|
+
const DEFAULT_OPTIONS = {
|
|
8
|
+
seed: "inkeep-context-breakdown",
|
|
9
|
+
quality: 50
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Generates N visually distinct colors using iwanthue.
|
|
13
|
+
*
|
|
14
|
+
* @param count - Number of colors to generate
|
|
15
|
+
* @param options - Optional generation settings
|
|
16
|
+
* @returns Array of hex color strings
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const colors = generateDistinctColors(5);
|
|
21
|
+
* // ['#4a8fd9', '#d94a7a', '#5ad94a', '#d9a14a', '#9a4ad9']
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
function generateDistinctColors(count, options) {
|
|
25
|
+
const opts = {
|
|
26
|
+
...DEFAULT_OPTIONS,
|
|
27
|
+
...options
|
|
28
|
+
};
|
|
29
|
+
return iwanthue(count, {
|
|
30
|
+
seed: opts.seed,
|
|
31
|
+
quality: opts.quality
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates a color map from an array of keys.
|
|
36
|
+
*
|
|
37
|
+
* @param keys - Array of unique string keys
|
|
38
|
+
* @param options - Optional generation settings
|
|
39
|
+
* @returns Map of key to hex color
|
|
40
|
+
*/
|
|
41
|
+
function createColorMap(keys, options) {
|
|
42
|
+
const colors = generateDistinctColors(keys.length, options);
|
|
43
|
+
const colorMap = {};
|
|
44
|
+
for (let i = 0; i < keys.length; i++) colorMap[keys[i]] = colors[i];
|
|
45
|
+
return colorMap;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { createColorMap, generateDistinctColors };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
import { JwtVerifyResult, SignJwtOptions, VerifyJwtOptions, decodeJwtPayload, extractBearerToken, getJwtSecret, hasIssuer, signJwt, verifyJwt } from "./jwt-helpers.js";
|
|
2
|
+
import { GenerateInternalServiceTokenParams, InternalServiceId, InternalServiceTokenPayload, InternalServices, VerifyInternalServiceTokenResult, generateInternalServiceToken, isInternalServiceToken, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, verifyInternalServiceAuthHeader, verifyInternalServiceToken } from "./internal-service-auth.js";
|
|
1
3
|
import { LoggerFactoryConfig, PinoLogger, PinoLoggerConfig, getLogger, loggerFactory } from "./logger.js";
|
|
2
4
|
import { McpClient, McpClientOptions, McpSSEConfig, McpServerConfig, McpStreamableHttpConfig } from "./mcp-client.js";
|
|
3
|
-
import { ApiKeyGenerationResult, extractPublicId, generateApiKey, hashApiKey, isApiKeyExpired, maskApiKey, validateApiKey } from "./apiKeys.js";
|
|
5
|
+
import { ApiKeyGenerationResult, extractPublicId, generateApiKey, getMetadataFromApiKey, hashApiKey, isApiKeyExpired, maskApiKey, validateApiKey } from "./apiKeys.js";
|
|
4
6
|
import { McpOAuthFlowResult, McpTokenExchangeResult, OAuthConfig, detectAuthenticationRequired, exchangeMcpAuthorizationCode, initiateMcpOAuthFlow } from "./auth-detection.js";
|
|
5
7
|
import { generateId, getConversationId } from "./conversations.js";
|
|
6
8
|
import { getCredentialStoreLookupKeyFromRetrievalParams } from "./credential-store-utils.js";
|
|
7
9
|
import { normalizeDateString, toISODateString } from "./date.js";
|
|
8
10
|
import { CommonCreateErrorResponses, CommonDeleteErrorResponses, CommonGetErrorResponses, CommonUpdateErrorResponses, ERROR_DOCS_BASE_URL, ErrorCode, ErrorCodes, ErrorResponse, ProblemDetails, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, errorResponseSchema, errorSchemaFactory, handleApiError, problemDetailsSchema } from "./error.js";
|
|
9
|
-
import { createExecutionContext, getRequestExecutionContext } from "./execution.js";
|
|
10
11
|
import { LLMMessage, formatMessagesForLLM, formatMessagesForLLMContext } from "./format-messages.js";
|
|
12
|
+
import { JsonTransformer } from "./JsonTransformer.js";
|
|
11
13
|
import { parseEmbeddedJson } from "./json-parser.js";
|
|
12
14
|
import { ModelFactory } from "./model-factory.js";
|
|
13
15
|
import { convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, isZodSchema, jsonSchemaToZod, preview } from "./schema-conversion.js";
|
|
14
16
|
import { GenerateServiceTokenParams, ServiceTokenPayload, VerifyServiceTokenResult, generateServiceToken, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken } from "./service-token-auth.js";
|
|
15
17
|
import { SignedTempToken, TempTokenPayload, signTempToken, verifyTempToken } from "./temp-jwt.js";
|
|
18
|
+
import { interpolateTemplate } from "./template-interpolation.js";
|
|
16
19
|
import { CredentialScope, extractComposioServerId, fetchComposioServers, fetchSingleComposioServer, getComposioOAuthRedirectUrl, getComposioUserId, isComposioMCPServerAuthenticated } from "./third-party-mcp-servers/composio-client.js";
|
|
17
20
|
import { isThirdPartyMCPServerAuthenticated } from "./third-party-mcp-servers/third-party-check.js";
|
|
18
21
|
import "./third-party-mcp-servers/index.js";
|
|
19
22
|
import { getTracer, setSpanWithError } from "./tracer-factory.js";
|
|
20
|
-
|
|
23
|
+
import { HashedHeaderValue, TriggerAuthResult, hashAuthenticationHeaders, hashTriggerHeaderValue, validateTriggerHeaderValue, verifySigningSecret, verifyTriggerAuth } from "./trigger-auth.js";
|
|
24
|
+
export { ApiKeyGenerationResult, CommonCreateErrorResponses, CommonDeleteErrorResponses, CommonGetErrorResponses, CommonUpdateErrorResponses, CredentialScope, ERROR_DOCS_BASE_URL, ErrorCode, ErrorCodes, ErrorResponse, GenerateInternalServiceTokenParams, GenerateServiceTokenParams, HashedHeaderValue, InternalServiceId, InternalServiceTokenPayload, InternalServices, JsonTransformer, JwtVerifyResult, LLMMessage, LoggerFactoryConfig, McpClient, McpClientOptions, McpOAuthFlowResult, McpSSEConfig, McpServerConfig, McpStreamableHttpConfig, McpTokenExchangeResult, ModelFactory, OAuthConfig, PinoLogger, PinoLoggerConfig, ProblemDetails, ServiceTokenPayload, SignJwtOptions, SignedTempToken, TempTokenPayload, TriggerAuthResult, VerifyInternalServiceTokenResult, VerifyJwtOptions, VerifyServiceTokenResult, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, createApiError, decodeJwtPayload, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, fetchComposioServers, fetchSingleComposioServer, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateInternalServiceToken, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getJwtSecret, getLogger, getMetadataFromApiKey, getTracer, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isInternalServiceToken, isThirdPartyMCPServerAuthenticated, isZodSchema, jsonSchemaToZod, loggerFactory, maskApiKey, normalizeDateString, parseEmbeddedJson, preview, problemDetailsSchema, setSpanWithError, signJwt, signTempToken, toISODateString, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyServiceToken, verifySigningSecret, verifyTempToken, verifyTriggerAuth };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { detectAuthenticationRequired, exchangeMcpAuthorizationCode, initiateMcpOAuthFlow } from "./auth-detection.js";
|
|
2
2
|
import { PinoLogger, getLogger, loggerFactory } from "./logger.js";
|
|
3
|
+
import { decodeJwtPayload, extractBearerToken, getJwtSecret, hasIssuer, signJwt, verifyJwt } from "./jwt-helpers.js";
|
|
4
|
+
import { InternalServices, generateInternalServiceToken, isInternalServiceToken, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, verifyInternalServiceAuthHeader, verifyInternalServiceToken } from "./internal-service-auth.js";
|
|
3
5
|
import { convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, isZodSchema, jsonSchemaToZod, preview } from "./schema-conversion.js";
|
|
4
6
|
import { getCredentialStoreLookupKeyFromRetrievalParams } from "./credential-store-utils.js";
|
|
5
7
|
import { generateId, getConversationId } from "./conversations.js";
|
|
6
|
-
import { extractPublicId, generateApiKey, hashApiKey, isApiKeyExpired, maskApiKey, validateApiKey } from "./apiKeys.js";
|
|
8
|
+
import { extractPublicId, generateApiKey, getMetadataFromApiKey, hashApiKey, isApiKeyExpired, maskApiKey, validateApiKey } from "./apiKeys.js";
|
|
7
9
|
import { normalizeDateString, toISODateString } from "./date.js";
|
|
8
10
|
import { ERROR_DOCS_BASE_URL, ErrorCode, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, errorResponseSchema, errorSchemaFactory, handleApiError, problemDetailsSchema } from "./error.js";
|
|
9
|
-
import { createExecutionContext, getRequestExecutionContext } from "./execution.js";
|
|
10
11
|
import { formatMessagesForLLM, formatMessagesForLLMContext } from "./format-messages.js";
|
|
12
|
+
import { JsonTransformer } from "./JsonTransformer.js";
|
|
11
13
|
import { parseEmbeddedJson } from "./json-parser.js";
|
|
12
14
|
import { McpClient } from "./mcp-client.js";
|
|
13
15
|
import { ModelFactory } from "./model-factory.js";
|
|
14
16
|
import { generateServiceToken, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken } from "./service-token-auth.js";
|
|
15
17
|
import { signTempToken, verifyTempToken } from "./temp-jwt.js";
|
|
18
|
+
import { interpolateTemplate } from "./template-interpolation.js";
|
|
16
19
|
import { extractComposioServerId, fetchComposioServers, fetchSingleComposioServer, getComposioOAuthRedirectUrl, getComposioUserId, isComposioMCPServerAuthenticated } from "./third-party-mcp-servers/composio-client.js";
|
|
17
20
|
import { isThirdPartyMCPServerAuthenticated } from "./third-party-mcp-servers/third-party-check.js";
|
|
18
21
|
import "./third-party-mcp-servers/index.js";
|
|
19
22
|
import { getTracer, setSpanWithError } from "./tracer-factory.js";
|
|
23
|
+
import { hashAuthenticationHeaders, hashTriggerHeaderValue, validateTriggerHeaderValue, verifySigningSecret, verifyTriggerAuth } from "./trigger-auth.js";
|
|
20
24
|
|
|
21
|
-
export { ERROR_DOCS_BASE_URL, ErrorCode, McpClient, ModelFactory, PinoLogger, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, createApiError,
|
|
25
|
+
export { ERROR_DOCS_BASE_URL, ErrorCode, InternalServices, JsonTransformer, McpClient, ModelFactory, PinoLogger, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, createApiError, decodeJwtPayload, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, fetchComposioServers, fetchSingleComposioServer, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateInternalServiceToken, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getJwtSecret, getLogger, getMetadataFromApiKey, getTracer, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isInternalServiceToken, isThirdPartyMCPServerAuthenticated, isZodSchema, jsonSchemaToZod, loggerFactory, maskApiKey, normalizeDateString, parseEmbeddedJson, preview, problemDetailsSchema, setSpanWithError, signJwt, signTempToken, toISODateString, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyServiceToken, verifySigningSecret, verifyTempToken, verifyTriggerAuth };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { JwtVerifyResult } from "./jwt-helpers.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/internal-service-auth.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Known internal services that can authenticate
|
|
7
|
+
*/
|
|
8
|
+
declare const InternalServices: {
|
|
9
|
+
readonly INKEEP_AGENTS_RUN_API: "inkeep-agents-run-api";
|
|
10
|
+
readonly INKEEP_AGENTS_MANAGE_API: "inkeep-agents-manage-api";
|
|
11
|
+
readonly INKEEP_AGENTS_EVAL_API: "inkeep-agents-eval-api";
|
|
12
|
+
};
|
|
13
|
+
type InternalServiceId = (typeof InternalServices)[keyof typeof InternalServices];
|
|
14
|
+
/**
|
|
15
|
+
* Internal Service Token JWT Claims (for service-to-service communication)
|
|
16
|
+
*/
|
|
17
|
+
interface InternalServiceTokenPayload {
|
|
18
|
+
/** Issuer - always 'inkeep-agents-internal' */
|
|
19
|
+
iss: string;
|
|
20
|
+
/** Subject - the calling service ID */
|
|
21
|
+
sub: InternalServiceId;
|
|
22
|
+
/** Tenant ID scope (optional - for tenant-scoped operations) */
|
|
23
|
+
tenantId?: string;
|
|
24
|
+
/** Project ID scope (optional - for project-scoped operations) */
|
|
25
|
+
projectId?: string;
|
|
26
|
+
/** User ID scope (optional - indicates the user that originally authenticated the service) */
|
|
27
|
+
userId?: string;
|
|
28
|
+
/** Issued at timestamp */
|
|
29
|
+
iat: number;
|
|
30
|
+
/** Expiration timestamp */
|
|
31
|
+
exp: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Parameters for generating an internal service token
|
|
35
|
+
*/
|
|
36
|
+
interface GenerateInternalServiceTokenParams {
|
|
37
|
+
serviceId: InternalServiceId;
|
|
38
|
+
/** Optional tenant scope */
|
|
39
|
+
tenantId?: string;
|
|
40
|
+
/** Optional project scope */
|
|
41
|
+
projectId?: string;
|
|
42
|
+
/** Optional user ID scope - indicates the user that originally authenticated the service */
|
|
43
|
+
userId?: string;
|
|
44
|
+
/** Token expiry (default: '5m') */
|
|
45
|
+
expiresIn?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Result of verifying an internal service token
|
|
49
|
+
*/
|
|
50
|
+
type VerifyInternalServiceTokenResult = JwtVerifyResult<InternalServiceTokenPayload>;
|
|
51
|
+
/**
|
|
52
|
+
* Generate an internal service token for service-to-service authentication
|
|
53
|
+
*/
|
|
54
|
+
declare function generateInternalServiceToken(params: GenerateInternalServiceTokenParams): Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Verify and decode an internal service token
|
|
57
|
+
*/
|
|
58
|
+
declare function verifyInternalServiceToken(token: string): Promise<VerifyInternalServiceTokenResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Extract and verify an internal service token from Authorization header
|
|
61
|
+
*/
|
|
62
|
+
declare function verifyInternalServiceAuthHeader(authHeader: string | undefined): Promise<VerifyInternalServiceTokenResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Check if a token is an internal service token (vs user/agent token)
|
|
65
|
+
* by checking the issuer claim without full verification
|
|
66
|
+
*/
|
|
67
|
+
declare function isInternalServiceToken(token: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Validate that the token has access to the specified tenant.
|
|
70
|
+
* If token has no tenantId claim, it has access to all tenants (superuser service).
|
|
71
|
+
*/
|
|
72
|
+
declare function validateInternalServiceTenantAccess(payload: InternalServiceTokenPayload, tenantId: string): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Validate that the token has access to the specified project.
|
|
75
|
+
* If token has no projectId claim, it has access to all projects in the allowed tenant(s).
|
|
76
|
+
*/
|
|
77
|
+
declare function validateInternalServiceProjectAccess(payload: InternalServiceTokenPayload, projectId: string): boolean;
|
|
78
|
+
//#endregion
|
|
79
|
+
export { GenerateInternalServiceTokenParams, InternalServiceId, InternalServiceTokenPayload, InternalServices, VerifyInternalServiceTokenResult, generateInternalServiceToken, isInternalServiceToken, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, verifyInternalServiceAuthHeader, verifyInternalServiceToken };
|