@inkeep/agents-core 0.50.6 → 0.52.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/auth/auth-schema.d.ts +139 -105
- package/dist/auth/auth-schema.js +3 -1
- package/dist/auth/auth-validation-schemas.d.ts +216 -148
- package/dist/auth/auth.d.ts +55 -23
- package/dist/auth/auth.js +22 -8
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/client-exports.d.ts +8 -14
- package/dist/data-access/index.d.ts +3 -3
- package/dist/data-access/index.js +3 -3
- package/dist/data-access/manage/agentFull.d.ts +2 -1
- package/dist/data-access/manage/agents.d.ts +39 -38
- package/dist/data-access/manage/artifactComponents.d.ts +18 -17
- package/dist/data-access/manage/contextConfigs.d.ts +18 -17
- package/dist/data-access/manage/credentialReferences.d.ts +2 -1
- package/dist/data-access/manage/dataComponents.d.ts +8 -7
- package/dist/data-access/manage/evalConfig.d.ts +2 -1
- package/dist/data-access/manage/externalAgents.d.ts +2 -1
- package/dist/data-access/manage/functionTools.d.ts +14 -14
- package/dist/data-access/manage/functions.d.ts +2 -2
- package/dist/data-access/manage/projectFull.d.ts +2 -1
- package/dist/data-access/manage/projects.d.ts +2 -1
- package/dist/data-access/manage/scheduledTriggers.d.ts +2 -2
- package/dist/data-access/manage/scheduledWorkflows.d.ts +2 -2
- package/dist/data-access/manage/scope-helpers.d.ts +15 -22
- package/dist/data-access/manage/scope-helpers.js +15 -12
- package/dist/data-access/manage/skills.d.ts +17 -16
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +20 -19
- package/dist/data-access/manage/subAgentRelations.d.ts +22 -21
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +20 -19
- package/dist/data-access/manage/subAgents.d.ts +17 -16
- package/dist/data-access/manage/tools.d.ts +29 -28
- package/dist/data-access/manage/triggers.d.ts +4 -4
- package/dist/data-access/runtime/apiKeys.d.ts +14 -13
- package/dist/data-access/runtime/cascade-delete.d.ts +1 -1
- package/dist/data-access/runtime/contextCache.d.ts +2 -2
- package/dist/data-access/runtime/conversations.d.ts +25 -24
- package/dist/data-access/runtime/evalRuns.d.ts +2 -1
- package/dist/data-access/runtime/ledgerArtifacts.d.ts +1 -1
- package/dist/data-access/runtime/messages.d.ts +23 -22
- package/dist/data-access/runtime/organizations.d.ts +11 -1
- package/dist/data-access/runtime/organizations.js +27 -1
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +2 -2
- package/dist/data-access/runtime/tasks.d.ts +7 -7
- package/dist/data-access/runtime/triggerInvocations.d.ts +2 -2
- package/dist/data-access/runtime/users.d.ts +9 -1
- package/dist/data-access/runtime/users.js +20 -3
- package/dist/data-access/runtime/workAppSlack.d.ts +1 -1
- package/dist/db/manage/manage-schema.d.ts +449 -449
- package/dist/db/manage/manage-schema.js +1 -1
- package/dist/db/manage/scope-definitions.d.ts +31 -0
- package/dist/db/manage/scope-definitions.js +31 -0
- package/dist/db/runtime/runtime-schema.d.ts +314 -297
- package/dist/db/runtime/runtime-schema.js +1 -0
- package/dist/dolt/branches-api.d.ts +2 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +5 -4
- package/dist/middleware/no-auth.d.ts +2 -2
- package/dist/types/index.d.ts +2 -1
- package/dist/types/utility.d.ts +2 -11
- package/dist/utils/error.d.ts +3 -1
- package/dist/utils/error.js +11 -1
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.js +3 -2
- package/dist/utils/retry.d.ts +8 -0
- package/dist/utils/retry.js +30 -0
- package/dist/validation/dolt-schemas.d.ts +1 -1
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/schemas.d.ts +1826 -1856
- package/dist/validation/schemas.js +2 -1
- package/dist/validation/stream-event-schemas.d.ts +4 -0
- package/dist/validation/stream-event-schemas.js +3 -1
- package/drizzle/manage/0010_oval_angel.sql +2 -0
- package/drizzle/manage/meta/0010_snapshot.json +3673 -0
- package/drizzle/manage/meta/_journal.json +7 -0
- package/drizzle/runtime/0015_soft_payback.sql +3 -0
- package/drizzle/runtime/meta/0015_snapshot.json +3772 -0
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +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 { AgentScopeConfig, ProjectScopeConfig, SubAgentScopeConfig } from "../db/manage/scope-definitions.js";
|
|
3
|
+
import { AgentConversationHistoryConfig, 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, StatusComponent, StatusUpdateSettings, TOOL_STATUS_VALUES, TaskMetadataConfig, ToolMcpConfig, ToolServerCapabilities, ToolSimplifyConfig, VALID_RELATION_TYPES, WorkAppGitHubAccountType, WorkAppGitHubInstallationStatus } from "./utility.js";
|
|
3
4
|
import { CorsConfig, CredentialStore, ServerConfig, ServerOptions } from "./server.js";
|
|
4
5
|
import { AgentMcpConfig, AgentMcpConfigInput, McpToolSelection, ToolPolicy, normalizeToolSelections } from "./tool-policies.js";
|
|
5
6
|
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, SkillApiInsert, SkillApiSelect, SkillApiUpdate, SkillInsert, SkillSelect, SkillUpdate, 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, SubAgentSkillApiInsert, SubAgentSkillApiSelect, SubAgentSkillApiUpdate, SubAgentSkillInsert, SubAgentSkillSelect, SubAgentSkillUpdate, SubAgentSkillWithIndex, 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, WorkAppGitHubInstallationInsert, WorkAppGitHubInstallationSelect, WorkAppGitHubMcpToolRepositoryAccessSelect, WorkAppGitHubProjectRepositoryAccessSelect, WorkAppGitHubRepositoryInput, WorkAppGitHubRepositoryInsert, WorkAppGitHubRepositorySelect } from "./entities.js";
|
package/dist/types/utility.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ResolvedRef } from "../validation/dolt-schemas.js";
|
|
2
|
+
import { AgentScopeConfig, ProjectScopeConfig, SubAgentScopeConfig } from "../db/manage/scope-definitions.js";
|
|
2
3
|
import "../index.js";
|
|
3
4
|
import { EvaluationJobFilterCriteriaSchema, McpTransportConfigSchema, ModelSchema, ProjectModelSchema, StatusComponentSchema, StatusUpdateSchema, WorkAppGitHubAccountTypeSchema, WorkAppGitHubInstallationStatusSchema } from "../validation/schemas.js";
|
|
4
5
|
import { ApiKeySelect, FullProjectSelectWithRelationIds } from "./entities.js";
|
|
@@ -23,16 +24,6 @@ type PaginationResult = {
|
|
|
23
24
|
total: number;
|
|
24
25
|
pages: number;
|
|
25
26
|
};
|
|
26
|
-
type ProjectScopeConfig = {
|
|
27
|
-
tenantId: string;
|
|
28
|
-
projectId: string;
|
|
29
|
-
};
|
|
30
|
-
type AgentScopeConfig = ProjectScopeConfig & {
|
|
31
|
-
agentId: string;
|
|
32
|
-
};
|
|
33
|
-
type SubAgentScopeConfig = AgentScopeConfig & {
|
|
34
|
-
subAgentId: string;
|
|
35
|
-
};
|
|
36
27
|
interface ConversationScopeOptions {
|
|
37
28
|
taskId?: string;
|
|
38
29
|
subAgentId?: string;
|
|
@@ -347,4 +338,4 @@ type WorkAppGitHubInstallationStatus = z.infer<typeof WorkAppGitHubInstallationS
|
|
|
347
338
|
*/
|
|
348
339
|
type WorkAppGitHubAccountType = z.infer<typeof WorkAppGitHubAccountTypeSchema>;
|
|
349
340
|
//#endregion
|
|
350
|
-
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, WorkAppGitHubAccountType, WorkAppGitHubInstallationStatus };
|
|
341
|
+
export { AgentConversationHistoryConfig, type 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, type ProjectScopeConfig, StatusComponent, StatusUpdateSettings, type SubAgentScopeConfig, TOOL_STATUS_VALUES, TaskMetadataConfig, ToolMcpConfig, ToolServerCapabilities, ToolSimplifyConfig, VALID_RELATION_TYPES, WorkAppGitHubAccountType, WorkAppGitHubInstallationStatus };
|
package/dist/utils/error.d.ts
CHANGED
|
@@ -83,6 +83,8 @@ declare const errorSchemaFactory: (code: ErrorCodes, description: string) => {
|
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
|
+
declare function isUniqueConstraintError(error: unknown): boolean;
|
|
87
|
+
declare function throwIfUniqueConstraintError(error: unknown, message: string): void;
|
|
86
88
|
declare const commonCreateErrorResponses: {
|
|
87
89
|
readonly 400: {
|
|
88
90
|
description: string;
|
|
@@ -533,4 +535,4 @@ type CommonUpdateErrorResponses = typeof commonUpdateErrorResponses;
|
|
|
533
535
|
type CommonGetErrorResponses = typeof commonGetErrorResponses;
|
|
534
536
|
type CommonDeleteErrorResponses = typeof commonDeleteErrorResponses;
|
|
535
537
|
//#endregion
|
|
536
|
-
export { CommonCreateErrorResponses, CommonDeleteErrorResponses, CommonGetErrorResponses, CommonUpdateErrorResponses, ERROR_DOCS_BASE_URL, ErrorCode, ErrorCodes, ErrorResponse, ProblemDetails, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, errorResponseSchema, errorSchemaFactory, handleApiError, problemDetailsSchema };
|
|
538
|
+
export { CommonCreateErrorResponses, CommonDeleteErrorResponses, CommonGetErrorResponses, CommonUpdateErrorResponses, ERROR_DOCS_BASE_URL, ErrorCode, ErrorCodes, ErrorResponse, ProblemDetails, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, errorResponseSchema, errorSchemaFactory, handleApiError, isUniqueConstraintError, problemDetailsSchema, throwIfUniqueConstraintError };
|
package/dist/utils/error.js
CHANGED
|
@@ -191,6 +191,16 @@ const errorSchemaFactory = (code, description) => ({
|
|
|
191
191
|
}).openapi({ description: "Legacy error format for backward compatibility." })
|
|
192
192
|
}).openapi(toTitleCase(description)) } }
|
|
193
193
|
});
|
|
194
|
+
function isUniqueConstraintError(error) {
|
|
195
|
+
const err = error;
|
|
196
|
+
return err?.cause?.code === "23505" || !!err?.cause?.message?.includes("1062") || !!err?.message?.includes("already exists");
|
|
197
|
+
}
|
|
198
|
+
function throwIfUniqueConstraintError(error, message) {
|
|
199
|
+
if (isUniqueConstraintError(error)) throw createApiError({
|
|
200
|
+
code: "conflict",
|
|
201
|
+
message
|
|
202
|
+
});
|
|
203
|
+
}
|
|
194
204
|
const commonCreateErrorResponses = {
|
|
195
205
|
400: errorSchemaFactory("bad_request", "Bad Request"),
|
|
196
206
|
401: errorSchemaFactory("unauthorized", "Unauthorized"),
|
|
@@ -224,4 +234,4 @@ const commonDeleteErrorResponses = {
|
|
|
224
234
|
};
|
|
225
235
|
|
|
226
236
|
//#endregion
|
|
227
|
-
export { ERROR_DOCS_BASE_URL, ErrorCode, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, errorResponseSchema, errorSchemaFactory, handleApiError, problemDetailsSchema };
|
|
237
|
+
export { ERROR_DOCS_BASE_URL, ErrorCode, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, errorResponseSchema, errorSchemaFactory, handleApiError, isUniqueConstraintError, problemDetailsSchema, throwIfUniqueConstraintError };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -7,13 +7,14 @@ import { McpOAuthFlowResult, McpTokenExchangeResult, OAuthConfig, detectAuthenti
|
|
|
7
7
|
import { generateId, getConversationId } from "./conversations.js";
|
|
8
8
|
import { getCredentialStoreLookupKeyFromRetrievalParams } from "./credential-store-utils.js";
|
|
9
9
|
import { normalizeDateString, toISODateString } from "./date.js";
|
|
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";
|
|
10
|
+
import { CommonCreateErrorResponses, CommonDeleteErrorResponses, CommonGetErrorResponses, CommonUpdateErrorResponses, ERROR_DOCS_BASE_URL, ErrorCode, ErrorCodes, ErrorResponse, ProblemDetails, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, errorResponseSchema, errorSchemaFactory, handleApiError, isUniqueConstraintError, problemDetailsSchema, throwIfUniqueConstraintError } from "./error.js";
|
|
11
11
|
import { LLMMessage, formatMessagesForLLM, formatMessagesForLLMContext } from "./format-messages.js";
|
|
12
12
|
import { getInProcessFetch, registerAppFetch } from "./in-process-fetch.js";
|
|
13
13
|
import { JsonTransformer } from "./JsonTransformer.js";
|
|
14
14
|
import { parseEmbeddedJson } from "./json-parser.js";
|
|
15
15
|
import { MockLanguageModel, createMockModel } from "./mock-provider.js";
|
|
16
16
|
import { ModelFactory } from "./model-factory.js";
|
|
17
|
+
import { retryWithBackoff } from "./retry.js";
|
|
17
18
|
import { convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, isZodSchema, preview } from "./schema-conversion.js";
|
|
18
19
|
import { GenerateServiceTokenParams, ServiceTokenPayload, VerifyServiceTokenResult, generateServiceToken, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken } from "./service-token-auth.js";
|
|
19
20
|
import { SignSlackLinkTokenParams, SlackLinkTokenPayload, SlackLinkTokenPayloadSchema, VerifySlackLinkTokenResult, signSlackLinkToken, verifySlackLinkToken } from "./slack-link-token.js";
|
|
@@ -27,4 +28,4 @@ import "./third-party-mcp-servers/index.js";
|
|
|
27
28
|
import { flushTraces, getTracer, setSpanWithError, unwrapError } from "./tracer-factory.js";
|
|
28
29
|
import { HashedHeaderValue, SignatureVerificationErrorCode, SignatureVerificationResult, TriggerAuthResult, hashAuthenticationHeaders, hashTriggerHeaderValue, validateTriggerHeaderValue, verifySignatureWithConfig, verifyTriggerAuth } from "./trigger-auth.js";
|
|
29
30
|
import { _resetWaitUntilCache, getWaitUntil } from "./wait-until.js";
|
|
30
|
-
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, MockLanguageModel, ModelFactory, OAuthConfig, ParsedSSEResponse, PinoLogger, PinoLoggerConfig, ProblemDetails, ServiceTokenPayload, SignJwtOptions, SignSlackLinkTokenParams, SignSlackUserTokenParams, SignatureVerificationErrorCode, SignatureVerificationResult, SignedTempToken, SlackAccessTokenPayload, SlackAccessTokenPayloadSchema, SlackLinkTokenPayload, SlackLinkTokenPayloadSchema, TempTokenPayload, TriggerAuthResult, VerifyInternalServiceTokenResult, VerifyJwtOptions, VerifyServiceTokenResult, VerifySlackLinkTokenResult, VerifySlackUserTokenResult, _resetWaitUntilCache, buildComposioMCPUrl, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, createApiError, createMockModel, decodeJwtPayload, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateInternalServiceToken, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getInProcessFetch, getJwtSecret, getLogger, getMetadataFromApiKey, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isInternalServiceToken, isSlackUserToken, isThirdPartyMCPServerAuthenticated, isZodSchema, loggerFactory, maskApiKey, normalizeDateString, parseEmbeddedJson, parseSSEResponse, preview, problemDetailsSchema, registerAppFetch, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, signTempToken, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
|
31
|
+
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, MockLanguageModel, ModelFactory, OAuthConfig, ParsedSSEResponse, PinoLogger, PinoLoggerConfig, ProblemDetails, ServiceTokenPayload, SignJwtOptions, SignSlackLinkTokenParams, SignSlackUserTokenParams, SignatureVerificationErrorCode, SignatureVerificationResult, SignedTempToken, SlackAccessTokenPayload, SlackAccessTokenPayloadSchema, SlackLinkTokenPayload, SlackLinkTokenPayloadSchema, TempTokenPayload, TriggerAuthResult, VerifyInternalServiceTokenResult, VerifyJwtOptions, VerifyServiceTokenResult, VerifySlackLinkTokenResult, VerifySlackUserTokenResult, _resetWaitUntilCache, buildComposioMCPUrl, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, createApiError, createMockModel, decodeJwtPayload, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateInternalServiceToken, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getInProcessFetch, getJwtSecret, getLogger, getMetadataFromApiKey, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isInternalServiceToken, isSlackUserToken, isThirdPartyMCPServerAuthenticated, isUniqueConstraintError, isZodSchema, loggerFactory, maskApiKey, normalizeDateString, parseEmbeddedJson, parseSSEResponse, preview, problemDetailsSchema, registerAppFetch, retryWithBackoff, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, signTempToken, throwIfUniqueConstraintError, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
package/dist/utils/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { getCredentialStoreLookupKeyFromRetrievalParams } from "./credential-sto
|
|
|
7
7
|
import { generateId, getConversationId } from "./conversations.js";
|
|
8
8
|
import { extractPublicId, generateApiKey, getMetadataFromApiKey, hashApiKey, isApiKeyExpired, maskApiKey, validateApiKey } from "./apiKeys.js";
|
|
9
9
|
import { normalizeDateString, toISODateString } from "./date.js";
|
|
10
|
-
import { ERROR_DOCS_BASE_URL, ErrorCode, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, errorResponseSchema, errorSchemaFactory, handleApiError, problemDetailsSchema } from "./error.js";
|
|
10
|
+
import { ERROR_DOCS_BASE_URL, ErrorCode, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, errorResponseSchema, errorSchemaFactory, handleApiError, isUniqueConstraintError, problemDetailsSchema, throwIfUniqueConstraintError } from "./error.js";
|
|
11
11
|
import { formatMessagesForLLM, formatMessagesForLLMContext } from "./format-messages.js";
|
|
12
12
|
import { getInProcessFetch, registerAppFetch } from "./in-process-fetch.js";
|
|
13
13
|
import { JsonTransformer } from "./JsonTransformer.js";
|
|
@@ -15,6 +15,7 @@ import { parseEmbeddedJson } from "./json-parser.js";
|
|
|
15
15
|
import { McpClient } from "./mcp-client.js";
|
|
16
16
|
import { MockLanguageModel, createMockModel } from "./mock-provider.js";
|
|
17
17
|
import { ModelFactory } from "./model-factory.js";
|
|
18
|
+
import { retryWithBackoff } from "./retry.js";
|
|
18
19
|
import { generateServiceToken, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken } from "./service-token-auth.js";
|
|
19
20
|
import { SlackLinkTokenPayloadSchema, signSlackLinkToken, verifySlackLinkToken } from "./slack-link-token.js";
|
|
20
21
|
import { SlackAccessTokenPayloadSchema, isSlackUserToken, signSlackUserToken, verifySlackUserToken } from "./slack-user-token.js";
|
|
@@ -28,4 +29,4 @@ import { flushTraces, getTracer, setSpanWithError, unwrapError } from "./tracer-
|
|
|
28
29
|
import { hashAuthenticationHeaders, hashTriggerHeaderValue, validateTriggerHeaderValue, verifySignatureWithConfig, verifyTriggerAuth } from "./trigger-auth.js";
|
|
29
30
|
import { _resetWaitUntilCache, getWaitUntil } from "./wait-until.js";
|
|
30
31
|
|
|
31
|
-
export { ERROR_DOCS_BASE_URL, ErrorCode, InternalServices, JsonTransformer, McpClient, MockLanguageModel, ModelFactory, PinoLogger, SlackAccessTokenPayloadSchema, SlackLinkTokenPayloadSchema, _resetWaitUntilCache, buildComposioMCPUrl, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, createApiError, createMockModel, decodeJwtPayload, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateInternalServiceToken, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getInProcessFetch, getJwtSecret, getLogger, getMetadataFromApiKey, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isInternalServiceToken, isSlackUserToken, isThirdPartyMCPServerAuthenticated, isZodSchema, loggerFactory, maskApiKey, normalizeDateString, parseEmbeddedJson, parseSSEResponse, preview, problemDetailsSchema, registerAppFetch, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, signTempToken, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
|
32
|
+
export { ERROR_DOCS_BASE_URL, ErrorCode, InternalServices, JsonTransformer, McpClient, MockLanguageModel, ModelFactory, PinoLogger, SlackAccessTokenPayloadSchema, SlackLinkTokenPayloadSchema, _resetWaitUntilCache, buildComposioMCPUrl, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, createApiError, createMockModel, decodeJwtPayload, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateInternalServiceToken, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getInProcessFetch, getJwtSecret, getLogger, getMetadataFromApiKey, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isInternalServiceToken, isSlackUserToken, isThirdPartyMCPServerAuthenticated, isUniqueConstraintError, isZodSchema, loggerFactory, maskApiKey, normalizeDateString, parseEmbeddedJson, parseSSEResponse, preview, problemDetailsSchema, registerAppFetch, retryWithBackoff, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, signTempToken, throwIfUniqueConstraintError, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getLogger } from "./logger.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/retry.ts
|
|
4
|
+
const logger = getLogger("retry");
|
|
5
|
+
async function retryWithBackoff(fn, opts = {}) {
|
|
6
|
+
const { maxAttempts = 3, maxDelayMs = 4e3, label = "operation" } = opts;
|
|
7
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) try {
|
|
8
|
+
return await fn();
|
|
9
|
+
} catch (error) {
|
|
10
|
+
const isTimeout = error.name === "AbortError";
|
|
11
|
+
const status = error.status;
|
|
12
|
+
if (!isTimeout && !(typeof status === "number" && status >= 500) && !(status === 429) || attempt === maxAttempts) throw error;
|
|
13
|
+
const retryAfter = error.headers?.get?.("Retry-After");
|
|
14
|
+
const retryAfterMs = retryAfter ? (Number(retryAfter) || 0) * 1e3 : 0;
|
|
15
|
+
const baseDelay = Math.min(500 * 2 ** (attempt - 1), maxDelayMs);
|
|
16
|
+
const delay = Math.max(baseDelay, retryAfterMs) + Math.random() * 100;
|
|
17
|
+
logger.warn({
|
|
18
|
+
attempt,
|
|
19
|
+
maxAttempts,
|
|
20
|
+
status,
|
|
21
|
+
delay: Math.round(delay),
|
|
22
|
+
label
|
|
23
|
+
}, `Retrying ${label} after transient failure`);
|
|
24
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
25
|
+
}
|
|
26
|
+
throw new Error("Unreachable");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { retryWithBackoff };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as drizzle_zod0 from "drizzle-zod";
|
|
3
3
|
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
4
4
|
|
|
5
5
|
//#region src/validation/drizzle-schema-helpers.d.ts
|
|
6
|
-
declare function createSelectSchemaWithModifiers<T extends AnySQLiteTable>(table: T, overrides?: Partial<Record<keyof T['_']['columns'], (schema: z.ZodTypeAny) => z.ZodTypeAny>>):
|
|
7
|
-
declare function createInsertSchemaWithModifiers<T extends AnySQLiteTable>(table: T, overrides?: Partial<Record<keyof T['_']['columns'], (schema: z.ZodTypeAny) => z.ZodTypeAny>>):
|
|
6
|
+
declare function createSelectSchemaWithModifiers<T extends AnySQLiteTable>(table: T, overrides?: Partial<Record<keyof T['_']['columns'], (schema: z.ZodTypeAny) => z.ZodTypeAny>>): drizzle_zod0.BuildSchema<"select", T["_"]["columns"], drizzle_zod0.BuildRefine<T["_"]["columns"], undefined>, undefined>;
|
|
7
|
+
declare function createInsertSchemaWithModifiers<T extends AnySQLiteTable>(table: T, overrides?: Partial<Record<keyof T['_']['columns'], (schema: z.ZodTypeAny) => z.ZodTypeAny>>): drizzle_zod0.BuildSchema<"insert", T["_"]["columns"], drizzle_zod0.BuildRefine<Pick<T["_"]["columns"], keyof T["$inferInsert"]>, undefined>, undefined>;
|
|
8
8
|
declare const createSelectSchema: typeof createSelectSchemaWithModifiers;
|
|
9
9
|
declare const createInsertSchema: typeof createInsertSchemaWithModifiers;
|
|
10
10
|
/**
|