@inkeep/agents-core 0.41.1 → 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-schema.d.ts +104 -104
- package/dist/auth/auth-validation-schemas.d.ts +146 -146
- package/dist/auth/auth.d.ts +114 -20
- package/dist/auth/auth.js +72 -2
- 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} +44 -43
- package/dist/data-access/{agents.js → manage/agents.js} +52 -7
- package/dist/data-access/{artifactComponents.d.ts → manage/artifactComponents.d.ts} +31 -31
- package/dist/data-access/{artifactComponents.js → manage/artifactComponents.js} +5 -5
- package/dist/data-access/{contextConfigs.d.ts → manage/contextConfigs.d.ts} +26 -26
- 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} +24 -24
- 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} +73 -23
- 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} +43 -43
- package/dist/data-access/{subAgentExternalAgentRelations.js → manage/subAgentExternalAgentRelations.js} +2 -2
- package/dist/data-access/{subAgentRelations.d.ts → manage/subAgentRelations.d.ts} +57 -57
- package/dist/data-access/{subAgentRelations.js → manage/subAgentRelations.js} +3 -3
- package/dist/data-access/{subAgentTeamAgentRelations.d.ts → manage/subAgentTeamAgentRelations.d.ts} +43 -43
- package/dist/data-access/{subAgentTeamAgentRelations.js → manage/subAgentTeamAgentRelations.js} +2 -2
- package/dist/data-access/{subAgents.d.ts → manage/subAgents.d.ts} +28 -28
- package/dist/data-access/{subAgents.js → manage/subAgents.js} +4 -4
- package/dist/data-access/{tools.d.ts → manage/tools.d.ts} +59 -52
- 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} +32 -32
- 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} +84 -35
- 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} +27 -27
- 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 +17867 -5009
- 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 +49 -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
|
@@ -1,36 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import { CredentialStoreRegistry } from "
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
1
|
+
import { AgentScopeConfig, PaginationConfig, ProjectScopeConfig, ToolMcpConfig, ToolServerCapabilities } from "../../types/utility.js";
|
|
2
|
+
import "../../types/index.js";
|
|
3
|
+
import { CredentialStoreRegistry } from "../../credential-stores/CredentialStoreRegistry.js";
|
|
4
|
+
import "../../credential-stores/index.js";
|
|
5
|
+
import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
|
|
6
|
+
import "../../index.js";
|
|
7
|
+
import { McpTool, ToolInsert, ToolSelect, ToolUpdate } from "../../types/entities.js";
|
|
8
8
|
|
|
9
|
-
//#region src/data-access/tools.d.ts
|
|
10
|
-
declare const dbResultToMcpTool: (dbResult: ToolSelect, dbClient:
|
|
11
|
-
declare const getToolById: (db:
|
|
9
|
+
//#region src/data-access/manage/tools.d.ts
|
|
10
|
+
declare const dbResultToMcpTool: (dbResult: ToolSelect, dbClient: AgentsManageDatabaseClient, credentialStoreRegistry?: CredentialStoreRegistry, relationshipId?: string, userId?: string) => Promise<McpTool>;
|
|
11
|
+
declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
|
|
12
12
|
scopes: ProjectScopeConfig;
|
|
13
13
|
toolId: string;
|
|
14
14
|
}) => Promise<{
|
|
15
|
+
tenantId: string;
|
|
16
|
+
projectId: string;
|
|
15
17
|
id: string;
|
|
16
18
|
name: string;
|
|
17
|
-
createdAt: string;
|
|
18
|
-
updatedAt: string;
|
|
19
19
|
description: string | null;
|
|
20
|
-
tenantId: string;
|
|
21
|
-
projectId: string;
|
|
22
|
-
credentialReferenceId: string | null;
|
|
23
20
|
config: {
|
|
24
21
|
type: "mcp";
|
|
25
22
|
mcp: ToolMcpConfig;
|
|
26
23
|
};
|
|
27
|
-
|
|
24
|
+
credentialReferenceId: string | null;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
updatedAt: string;
|
|
28
27
|
headers: Record<string, string> | null;
|
|
28
|
+
credentialScope: string;
|
|
29
29
|
imageUrl: string | null;
|
|
30
30
|
capabilities: ToolServerCapabilities | null;
|
|
31
31
|
lastError: string | null;
|
|
32
32
|
} | null>;
|
|
33
|
-
declare const
|
|
33
|
+
declare const getMcpToolById: (db: AgentsManageDatabaseClient) => (params: {
|
|
34
|
+
scopes: ProjectScopeConfig;
|
|
35
|
+
toolId: string;
|
|
36
|
+
relationshipId?: string;
|
|
37
|
+
credentialStoreRegistry?: CredentialStoreRegistry;
|
|
38
|
+
userId?: string;
|
|
39
|
+
}) => Promise<McpTool | null>;
|
|
40
|
+
declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
|
|
34
41
|
scopes: ProjectScopeConfig;
|
|
35
42
|
pagination?: PaginationConfig;
|
|
36
43
|
}) => Promise<{
|
|
@@ -60,26 +67,26 @@ declare const listTools: (db: DatabaseClient) => (params: {
|
|
|
60
67
|
pages: number;
|
|
61
68
|
};
|
|
62
69
|
}>;
|
|
63
|
-
declare const createTool: (db:
|
|
70
|
+
declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
|
|
71
|
+
tenantId: string;
|
|
72
|
+
projectId: string;
|
|
64
73
|
id: string;
|
|
65
74
|
name: string;
|
|
66
|
-
createdAt: string;
|
|
67
|
-
updatedAt: string;
|
|
68
75
|
description: string | null;
|
|
69
|
-
tenantId: string;
|
|
70
|
-
projectId: string;
|
|
71
|
-
credentialReferenceId: string | null;
|
|
72
76
|
config: {
|
|
73
77
|
type: "mcp";
|
|
74
78
|
mcp: ToolMcpConfig;
|
|
75
79
|
};
|
|
76
|
-
|
|
80
|
+
credentialReferenceId: string | null;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
updatedAt: string;
|
|
77
83
|
headers: Record<string, string> | null;
|
|
84
|
+
credentialScope: string;
|
|
78
85
|
imageUrl: string | null;
|
|
79
86
|
capabilities: ToolServerCapabilities | null;
|
|
80
87
|
lastError: string | null;
|
|
81
88
|
}>;
|
|
82
|
-
declare const updateTool: (db:
|
|
89
|
+
declare const updateTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
83
90
|
scopes: ProjectScopeConfig;
|
|
84
91
|
toolId: string;
|
|
85
92
|
data: ToolUpdate;
|
|
@@ -102,11 +109,11 @@ declare const updateTool: (db: DatabaseClient) => (params: {
|
|
|
102
109
|
tenantId: string;
|
|
103
110
|
id: string;
|
|
104
111
|
}>;
|
|
105
|
-
declare const deleteTool: (db:
|
|
112
|
+
declare const deleteTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
106
113
|
scopes: ProjectScopeConfig;
|
|
107
114
|
toolId: string;
|
|
108
115
|
}) => Promise<boolean>;
|
|
109
|
-
declare const addToolToAgent: (db:
|
|
116
|
+
declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
110
117
|
scopes: AgentScopeConfig;
|
|
111
118
|
subAgentId: string;
|
|
112
119
|
toolId: string;
|
|
@@ -116,43 +123,43 @@ declare const addToolToAgent: (db: DatabaseClient) => (params: {
|
|
|
116
123
|
needsApproval?: boolean;
|
|
117
124
|
}> | null;
|
|
118
125
|
}) => Promise<{
|
|
119
|
-
id: string;
|
|
120
|
-
createdAt: string;
|
|
121
|
-
updatedAt: string;
|
|
122
126
|
tenantId: string;
|
|
123
127
|
projectId: string;
|
|
128
|
+
id: string;
|
|
124
129
|
agentId: string;
|
|
130
|
+
createdAt: string;
|
|
131
|
+
updatedAt: string;
|
|
125
132
|
toolId: string;
|
|
126
|
-
subAgentId: string;
|
|
127
133
|
headers: Record<string, string> | null;
|
|
128
|
-
selectedTools: string[] | null;
|
|
129
134
|
toolPolicies: Record<string, {
|
|
130
135
|
needsApproval?: boolean;
|
|
131
136
|
}> | null;
|
|
137
|
+
subAgentId: string;
|
|
138
|
+
selectedTools: string[] | null;
|
|
132
139
|
}>;
|
|
133
|
-
declare const removeToolFromAgent: (db:
|
|
140
|
+
declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
134
141
|
scopes: AgentScopeConfig;
|
|
135
142
|
subAgentId: string;
|
|
136
143
|
toolId: string;
|
|
137
144
|
}) => Promise<{
|
|
138
|
-
id: string;
|
|
139
|
-
createdAt: string;
|
|
140
|
-
updatedAt: string;
|
|
141
145
|
tenantId: string;
|
|
142
146
|
projectId: string;
|
|
147
|
+
id: string;
|
|
143
148
|
agentId: string;
|
|
149
|
+
createdAt: string;
|
|
150
|
+
updatedAt: string;
|
|
144
151
|
toolId: string;
|
|
145
|
-
subAgentId: string;
|
|
146
152
|
headers: Record<string, string> | null;
|
|
147
|
-
selectedTools: string[] | null;
|
|
148
153
|
toolPolicies: Record<string, {
|
|
149
154
|
needsApproval?: boolean;
|
|
150
155
|
}> | null;
|
|
156
|
+
subAgentId: string;
|
|
157
|
+
selectedTools: string[] | null;
|
|
151
158
|
}>;
|
|
152
159
|
/**
|
|
153
160
|
* Upsert agent-tool relation (create if it doesn't exist, update if it does)
|
|
154
161
|
*/
|
|
155
|
-
declare const upsertSubAgentToolRelation: (db:
|
|
162
|
+
declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
|
|
156
163
|
scopes: AgentScopeConfig;
|
|
157
164
|
subAgentId: string;
|
|
158
165
|
toolId: string;
|
|
@@ -163,43 +170,43 @@ declare const upsertSubAgentToolRelation: (db: DatabaseClient) => (params: {
|
|
|
163
170
|
}> | null;
|
|
164
171
|
relationId?: string;
|
|
165
172
|
}) => Promise<{
|
|
166
|
-
id: string;
|
|
167
|
-
createdAt: string;
|
|
168
|
-
updatedAt: string;
|
|
169
173
|
tenantId: string;
|
|
170
174
|
projectId: string;
|
|
175
|
+
id: string;
|
|
171
176
|
agentId: string;
|
|
177
|
+
createdAt: string;
|
|
178
|
+
updatedAt: string;
|
|
172
179
|
toolId: string;
|
|
173
|
-
subAgentId: string;
|
|
174
180
|
headers: Record<string, string> | null;
|
|
175
|
-
selectedTools: string[] | null;
|
|
176
181
|
toolPolicies: Record<string, {
|
|
177
182
|
needsApproval?: boolean;
|
|
178
183
|
}> | null;
|
|
184
|
+
subAgentId: string;
|
|
185
|
+
selectedTools: string[] | null;
|
|
179
186
|
}>;
|
|
180
187
|
/**
|
|
181
188
|
* Upsert a tool (create if it doesn't exist, update if it does)
|
|
182
189
|
*/
|
|
183
|
-
declare const upsertTool: (db:
|
|
190
|
+
declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
184
191
|
data: ToolInsert;
|
|
185
192
|
}) => Promise<{
|
|
193
|
+
tenantId: string;
|
|
194
|
+
projectId: string;
|
|
186
195
|
id: string;
|
|
187
196
|
name: string;
|
|
188
|
-
createdAt: string;
|
|
189
|
-
updatedAt: string;
|
|
190
197
|
description: string | null;
|
|
191
|
-
tenantId: string;
|
|
192
|
-
projectId: string;
|
|
193
|
-
credentialReferenceId: string | null;
|
|
194
198
|
config: {
|
|
195
199
|
type: "mcp";
|
|
196
200
|
mcp: ToolMcpConfig;
|
|
197
201
|
};
|
|
198
|
-
|
|
202
|
+
credentialReferenceId: string | null;
|
|
203
|
+
createdAt: string;
|
|
204
|
+
updatedAt: string;
|
|
199
205
|
headers: Record<string, string> | null;
|
|
206
|
+
credentialScope: string;
|
|
200
207
|
imageUrl: string | null;
|
|
201
208
|
capabilities: ToolServerCapabilities | null;
|
|
202
209
|
lastError: string | null;
|
|
203
210
|
}>;
|
|
204
211
|
//#endregion
|
|
205
|
-
export { addToolToAgent, createTool, dbResultToMcpTool, deleteTool, getToolById, listTools, removeToolFromAgent, updateTool, upsertSubAgentToolRelation, upsertTool };
|
|
212
|
+
export { addToolToAgent, createTool, dbResultToMcpTool, deleteTool, getMcpToolById, getToolById, listTools, removeToolFromAgent, updateTool, upsertSubAgentToolRelation, upsertTool };
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { CredentialStoreType, MCPServerType, MCPTransportType } from "
|
|
2
|
-
import { subAgentToolRelations, tools } from "
|
|
3
|
-
import { detectAuthenticationRequired } from "
|
|
4
|
-
import { getLogger } from "
|
|
5
|
-
import { getCredentialStoreLookupKeyFromRetrievalParams } from "
|
|
6
|
-
import { CredentialStuffer } from "
|
|
7
|
-
import
|
|
1
|
+
import { CredentialStoreType, MCPServerType, MCPTransportType } from "../../types/utility.js";
|
|
2
|
+
import { subAgentToolRelations, tools } from "../../db/manage/manage-schema.js";
|
|
3
|
+
import { detectAuthenticationRequired } from "../../utils/auth-detection.js";
|
|
4
|
+
import { getLogger } from "../../utils/logger.js";
|
|
5
|
+
import { getCredentialStoreLookupKeyFromRetrievalParams } from "../../utils/credential-store-utils.js";
|
|
6
|
+
import { CredentialStuffer } from "../../credential-stuffer/CredentialStuffer.js";
|
|
7
|
+
import "../../credential-stuffer/index.js";
|
|
8
|
+
import { generateId } from "../../utils/conversations.js";
|
|
8
9
|
import { updateAgentToolRelation } from "./subAgentRelations.js";
|
|
9
|
-
import "
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import "../utils/index.js";
|
|
10
|
+
import { toISODateString } from "../../utils/date.js";
|
|
11
|
+
import { McpClient } from "../../utils/mcp-client.js";
|
|
12
|
+
import { isThirdPartyMCPServerAuthenticated } from "../../utils/third-party-mcp-servers/third-party-check.js";
|
|
13
|
+
import "../../utils/index.js";
|
|
14
14
|
import { getCredentialReference, getUserScopedCredentialReference } from "./credentialReferences.js";
|
|
15
|
-
import { ContextResolver } from "../context/ContextResolver.js";
|
|
16
|
-
import "../context/index.js";
|
|
17
15
|
import { and, count, desc, eq } from "drizzle-orm";
|
|
18
16
|
|
|
19
|
-
//#region src/data-access/tools.ts
|
|
17
|
+
//#region src/data-access/manage/tools.ts
|
|
20
18
|
const logger = getLogger("tools");
|
|
21
19
|
/**
|
|
22
20
|
* Extract expiration date from credential data stored in credential store
|
|
@@ -49,7 +47,10 @@ async function getCredentialExpiresAt(credentialReference, credentialStoreRegist
|
|
|
49
47
|
* - parameters (direct) - alternative format
|
|
50
48
|
* - schema - another possible location
|
|
51
49
|
*/
|
|
52
|
-
function extractInputSchema(toolDef) {
|
|
50
|
+
function extractInputSchema(toolDef, _toolName, _toolOverrides) {
|
|
51
|
+
return extractOriginalSchema(toolDef);
|
|
52
|
+
}
|
|
53
|
+
function extractOriginalSchema(toolDef) {
|
|
53
54
|
if (toolDef.inputSchema) return toolDef.inputSchema;
|
|
54
55
|
if (toolDef.parameters?.properties) return toolDef.parameters.properties;
|
|
55
56
|
if (toolDef.parameters && typeof toolDef.parameters === "object") return toolDef.parameters;
|
|
@@ -65,7 +66,8 @@ const convertToMCPToolConfig = (tool) => {
|
|
|
65
66
|
serverUrl: tool.config.mcp.server.url,
|
|
66
67
|
mcpType: tool.config.mcp.server.url.includes("api.nango.dev") ? MCPServerType.nango : MCPServerType.generic,
|
|
67
68
|
transport: tool.config.mcp.transport,
|
|
68
|
-
headers: tool.headers
|
|
69
|
+
headers: tool.headers,
|
|
70
|
+
toolOverrides: tool.config.mcp.toolOverrides
|
|
69
71
|
};
|
|
70
72
|
};
|
|
71
73
|
const discoverToolsFromServer = async (tool, dbClient, credentialStoreRegistry, userId) => {
|
|
@@ -92,7 +94,7 @@ const discoverToolsFromServer = async (tool, dbClient, credentialStoreRegistry,
|
|
|
92
94
|
retrievalParams: credentialReference.retrievalParams || {}
|
|
93
95
|
};
|
|
94
96
|
if (!credentialStoreRegistry) throw new Error("CredentialStoreRegistry is required for authenticated tools");
|
|
95
|
-
serverConfig = await new CredentialStuffer(credentialStoreRegistry
|
|
97
|
+
serverConfig = await new CredentialStuffer(credentialStoreRegistry).buildMcpServerConfig({
|
|
96
98
|
tenantId: tool.tenantId,
|
|
97
99
|
projectId: tool.projectId
|
|
98
100
|
}, convertToMCPToolConfig(tool), storeReference);
|
|
@@ -122,11 +124,15 @@ const discoverToolsFromServer = async (tool, dbClient, credentialStoreRegistry,
|
|
|
122
124
|
await client.connect();
|
|
123
125
|
const serverTools = await client.tools();
|
|
124
126
|
await client.disconnect();
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
const toolOverrides = tool.config.mcp.toolOverrides;
|
|
128
|
+
return Object.entries(serverTools).map(([name, toolDef]) => {
|
|
129
|
+
const schema = extractInputSchema(toolDef, name, toolOverrides);
|
|
130
|
+
return {
|
|
131
|
+
name,
|
|
132
|
+
description: toolDef.description || "",
|
|
133
|
+
inputSchema: schema
|
|
134
|
+
};
|
|
135
|
+
});
|
|
130
136
|
} catch (error) {
|
|
131
137
|
logger.error({
|
|
132
138
|
toolId: tool.id,
|
|
@@ -196,17 +202,25 @@ const dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry, re
|
|
|
196
202
|
}
|
|
197
203
|
}
|
|
198
204
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
try {
|
|
206
|
+
await updateTool(dbClient)({
|
|
207
|
+
scopes: {
|
|
208
|
+
tenantId: dbResult.tenantId,
|
|
209
|
+
projectId: dbResult.projectId
|
|
210
|
+
},
|
|
211
|
+
toolId: dbResult.id,
|
|
212
|
+
data: {
|
|
213
|
+
updatedAt: now,
|
|
214
|
+
lastError: lastErrorComputed
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
} catch (updateError) {
|
|
218
|
+
if (updateError instanceof Error && (updateError.message.includes("serialization failure") || updateError.message.includes("40001") || updateError.cause?.code === "XX000")) logger.debug({ toolId: dbResult.id }, "Skipping tool metadata update due to serialization conflict (concurrent request)");
|
|
219
|
+
else logger.warn({
|
|
220
|
+
toolId: dbResult.id,
|
|
221
|
+
error: updateError
|
|
222
|
+
}, "Failed to update tool metadata - continuing with stale data");
|
|
223
|
+
}
|
|
210
224
|
return {
|
|
211
225
|
...rest,
|
|
212
226
|
status,
|
|
@@ -226,6 +240,14 @@ const dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry, re
|
|
|
226
240
|
const getToolById = (db) => async (params) => {
|
|
227
241
|
return await db.query.tools.findFirst({ where: and(eq(tools.tenantId, params.scopes.tenantId), eq(tools.projectId, params.scopes.projectId), eq(tools.id, params.toolId)) }) ?? null;
|
|
228
242
|
};
|
|
243
|
+
const getMcpToolById = (db) => async (params) => {
|
|
244
|
+
const tool = await getToolById(db)({
|
|
245
|
+
scopes: params.scopes,
|
|
246
|
+
toolId: params.toolId
|
|
247
|
+
});
|
|
248
|
+
if (!tool) return null;
|
|
249
|
+
return await dbResultToMcpTool(tool, db, params.credentialStoreRegistry, params.relationshipId, params.userId);
|
|
250
|
+
};
|
|
229
251
|
const listTools = (db) => async (params) => {
|
|
230
252
|
const page = params.pagination?.page || 1;
|
|
231
253
|
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
@@ -329,4 +351,4 @@ const upsertTool = (db) => async (params) => {
|
|
|
329
351
|
};
|
|
330
352
|
|
|
331
353
|
//#endregion
|
|
332
|
-
export { addToolToAgent, createTool, dbResultToMcpTool, deleteTool, getToolById, listTools, removeToolFromAgent, updateTool, upsertSubAgentToolRelation, upsertTool };
|
|
354
|
+
export { addToolToAgent, createTool, dbResultToMcpTool, deleteTool, getMcpToolById, getToolById, listTools, removeToolFromAgent, updateTool, upsertSubAgentToolRelation, upsertTool };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { AgentScopeConfig, PaginationConfig } from "../../types/utility.js";
|
|
2
|
+
import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
|
|
3
|
+
import { TriggerInsert, TriggerSelect, TriggerUpdate } from "../../types/entities.js";
|
|
4
|
+
|
|
5
|
+
//#region src/data-access/manage/triggers.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get a trigger by ID (agent-scoped)
|
|
9
|
+
*/
|
|
10
|
+
declare const getTriggerById: (db: AgentsManageDatabaseClient) => (params: {
|
|
11
|
+
scopes: AgentScopeConfig;
|
|
12
|
+
triggerId: string;
|
|
13
|
+
}) => Promise<TriggerSelect | undefined>;
|
|
14
|
+
/**
|
|
15
|
+
* List all triggers for an agent
|
|
16
|
+
*/
|
|
17
|
+
declare const listTriggers: (db: AgentsManageDatabaseClient) => (params: {
|
|
18
|
+
scopes: AgentScopeConfig;
|
|
19
|
+
}) => Promise<TriggerSelect[]>;
|
|
20
|
+
/**
|
|
21
|
+
* List triggers for an agent with pagination
|
|
22
|
+
*/
|
|
23
|
+
declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params: {
|
|
24
|
+
scopes: AgentScopeConfig;
|
|
25
|
+
pagination?: PaginationConfig;
|
|
26
|
+
}) => Promise<{
|
|
27
|
+
data: {
|
|
28
|
+
createdAt: string;
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
inputSchema: Record<string, unknown> | null;
|
|
32
|
+
outputTransform: {
|
|
33
|
+
jmespath?: string;
|
|
34
|
+
objectTransformation?: Record<string, string>;
|
|
35
|
+
} | null;
|
|
36
|
+
messageTemplate: string | null;
|
|
37
|
+
authentication: unknown;
|
|
38
|
+
signingSecret: string | null;
|
|
39
|
+
name: string;
|
|
40
|
+
description: string | null;
|
|
41
|
+
agentId: string;
|
|
42
|
+
projectId: string;
|
|
43
|
+
tenantId: string;
|
|
44
|
+
id: string;
|
|
45
|
+
}[];
|
|
46
|
+
pagination: {
|
|
47
|
+
page: number;
|
|
48
|
+
limit: number;
|
|
49
|
+
total: number;
|
|
50
|
+
pages: number;
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Create a new trigger (agent-scoped)
|
|
55
|
+
*/
|
|
56
|
+
declare const createTrigger: (db: AgentsManageDatabaseClient) => (params: TriggerInsert) => Promise<TriggerSelect>;
|
|
57
|
+
/**
|
|
58
|
+
* Update a trigger (agent-scoped)
|
|
59
|
+
*/
|
|
60
|
+
declare const updateTrigger: (db: AgentsManageDatabaseClient) => (params: {
|
|
61
|
+
scopes: AgentScopeConfig;
|
|
62
|
+
triggerId: string;
|
|
63
|
+
data: TriggerUpdate;
|
|
64
|
+
}) => Promise<TriggerSelect>;
|
|
65
|
+
/**
|
|
66
|
+
* Delete a trigger (agent-scoped)
|
|
67
|
+
*/
|
|
68
|
+
declare const deleteTrigger: (db: AgentsManageDatabaseClient) => (params: {
|
|
69
|
+
scopes: AgentScopeConfig;
|
|
70
|
+
triggerId: string;
|
|
71
|
+
}) => Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Upsert a trigger (create or update based on existence)
|
|
74
|
+
*/
|
|
75
|
+
declare const upsertTrigger: (db: AgentsManageDatabaseClient) => (params: {
|
|
76
|
+
scopes: AgentScopeConfig;
|
|
77
|
+
data: TriggerInsert;
|
|
78
|
+
}) => Promise<TriggerSelect>;
|
|
79
|
+
//#endregion
|
|
80
|
+
export { createTrigger, deleteTrigger, getTriggerById, listTriggers, listTriggersPaginated, updateTrigger, upsertTrigger };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { triggers } from "../../db/manage/manage-schema.js";
|
|
2
|
+
import { and, count, desc, eq } from "drizzle-orm";
|
|
3
|
+
|
|
4
|
+
//#region src/data-access/manage/triggers.ts
|
|
5
|
+
/**
|
|
6
|
+
* Get a trigger by ID (agent-scoped)
|
|
7
|
+
*/
|
|
8
|
+
const getTriggerById = (db) => async (params) => {
|
|
9
|
+
const { scopes, triggerId } = params;
|
|
10
|
+
return await db.query.triggers.findFirst({ where: and(eq(triggers.tenantId, scopes.tenantId), eq(triggers.projectId, scopes.projectId), eq(triggers.agentId, scopes.agentId), eq(triggers.id, triggerId)) });
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* List all triggers for an agent
|
|
14
|
+
*/
|
|
15
|
+
const listTriggers = (db) => async (params) => {
|
|
16
|
+
return await db.query.triggers.findMany({ where: and(eq(triggers.tenantId, params.scopes.tenantId), eq(triggers.projectId, params.scopes.projectId), eq(triggers.agentId, params.scopes.agentId)) });
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* List triggers for an agent with pagination
|
|
20
|
+
*/
|
|
21
|
+
const listTriggersPaginated = (db) => async (params) => {
|
|
22
|
+
const page = params.pagination?.page || 1;
|
|
23
|
+
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
24
|
+
const offset = (page - 1) * limit;
|
|
25
|
+
const whereClause = and(eq(triggers.tenantId, params.scopes.tenantId), eq(triggers.projectId, params.scopes.projectId), eq(triggers.agentId, params.scopes.agentId));
|
|
26
|
+
const [data, totalResult] = await Promise.all([db.select().from(triggers).where(whereClause).limit(limit).offset(offset).orderBy(desc(triggers.createdAt)), db.select({ count: count() }).from(triggers).where(whereClause)]);
|
|
27
|
+
const total = totalResult[0]?.count || 0;
|
|
28
|
+
return {
|
|
29
|
+
data,
|
|
30
|
+
pagination: {
|
|
31
|
+
page,
|
|
32
|
+
limit,
|
|
33
|
+
total,
|
|
34
|
+
pages: Math.ceil(total / limit)
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Create a new trigger (agent-scoped)
|
|
40
|
+
*/
|
|
41
|
+
const createTrigger = (db) => async (params) => {
|
|
42
|
+
return (await db.insert(triggers).values(params).returning())[0];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Update a trigger (agent-scoped)
|
|
46
|
+
*/
|
|
47
|
+
const updateTrigger = (db) => async (params) => {
|
|
48
|
+
const updateData = {
|
|
49
|
+
...params.data,
|
|
50
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
51
|
+
};
|
|
52
|
+
return (await db.update(triggers).set(updateData).where(and(eq(triggers.tenantId, params.scopes.tenantId), eq(triggers.projectId, params.scopes.projectId), eq(triggers.agentId, params.scopes.agentId), eq(triggers.id, params.triggerId))).returning())[0];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Delete a trigger (agent-scoped)
|
|
56
|
+
*/
|
|
57
|
+
const deleteTrigger = (db) => async (params) => {
|
|
58
|
+
await db.delete(triggers).where(and(eq(triggers.tenantId, params.scopes.tenantId), eq(triggers.projectId, params.scopes.projectId), eq(triggers.agentId, params.scopes.agentId), eq(triggers.id, params.triggerId)));
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Upsert a trigger (create or update based on existence)
|
|
62
|
+
*/
|
|
63
|
+
const upsertTrigger = (db) => async (params) => {
|
|
64
|
+
const { scopes, data } = params;
|
|
65
|
+
if (await db.query.triggers.findFirst({ where: and(eq(triggers.tenantId, scopes.tenantId), eq(triggers.projectId, scopes.projectId), eq(triggers.agentId, scopes.agentId), eq(triggers.id, data.id)) })) {
|
|
66
|
+
const updateData = {
|
|
67
|
+
...data,
|
|
68
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
69
|
+
};
|
|
70
|
+
return (await db.update(triggers).set(updateData).where(and(eq(triggers.tenantId, scopes.tenantId), eq(triggers.projectId, scopes.projectId), eq(triggers.agentId, scopes.agentId), eq(triggers.id, data.id))).returning())[0];
|
|
71
|
+
}
|
|
72
|
+
return (await db.insert(triggers).values({
|
|
73
|
+
...data,
|
|
74
|
+
tenantId: scopes.tenantId,
|
|
75
|
+
projectId: scopes.projectId,
|
|
76
|
+
agentId: scopes.agentId
|
|
77
|
+
}).returning())[0];
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { createTrigger, deleteTrigger, getTriggerById, listTriggers, listTriggersPaginated, updateTrigger, upsertTrigger };
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ApiKeyCreateResult, CreateApiKeyParams, PaginationConfig, ProjectScopeConfig } from "../../types/utility.js";
|
|
2
|
+
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
3
|
+
import { ApiKeyInsert, ApiKeySelect, ApiKeyUpdate } from "../../types/entities.js";
|
|
4
4
|
|
|
5
|
-
//#region src/data-access/apiKeys.d.ts
|
|
6
|
-
declare const getApiKeyById: (db:
|
|
5
|
+
//#region src/data-access/runtime/apiKeys.d.ts
|
|
6
|
+
declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
|
|
7
7
|
scopes: ProjectScopeConfig;
|
|
8
8
|
id: string;
|
|
9
9
|
}) => Promise<{
|
|
10
|
-
id: string;
|
|
11
|
-
name: string | null;
|
|
12
|
-
createdAt: string;
|
|
13
|
-
updatedAt: string;
|
|
14
10
|
tenantId: string;
|
|
15
11
|
projectId: string;
|
|
12
|
+
id: string;
|
|
13
|
+
name: string | null;
|
|
16
14
|
agentId: string;
|
|
17
15
|
publicId: string;
|
|
18
16
|
keyHash: string;
|
|
19
17
|
keyPrefix: string;
|
|
20
18
|
lastUsedAt: string | null;
|
|
21
19
|
expiresAt: string | null;
|
|
22
|
-
} | undefined>;
|
|
23
|
-
declare const getApiKeyByPublicId: (db: DatabaseClient) => (publicId: string) => Promise<{
|
|
24
|
-
id: string;
|
|
25
|
-
name: string | null;
|
|
26
20
|
createdAt: string;
|
|
27
21
|
updatedAt: string;
|
|
22
|
+
} | undefined>;
|
|
23
|
+
declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: string) => Promise<{
|
|
28
24
|
tenantId: string;
|
|
29
25
|
projectId: string;
|
|
26
|
+
id: string;
|
|
27
|
+
name: string | null;
|
|
30
28
|
agentId: string;
|
|
31
29
|
publicId: string;
|
|
32
30
|
keyHash: string;
|
|
33
31
|
keyPrefix: string;
|
|
34
32
|
lastUsedAt: string | null;
|
|
35
33
|
expiresAt: string | null;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
36
|
} | undefined>;
|
|
37
|
-
declare const listApiKeys: (db:
|
|
37
|
+
declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
|
|
38
38
|
scopes: ProjectScopeConfig;
|
|
39
39
|
agentId?: string;
|
|
40
40
|
}) => Promise<{
|
|
41
|
-
id: string;
|
|
42
|
-
name: string | null;
|
|
43
|
-
createdAt: string;
|
|
44
|
-
updatedAt: string;
|
|
45
41
|
tenantId: string;
|
|
46
42
|
projectId: string;
|
|
43
|
+
id: string;
|
|
44
|
+
name: string | null;
|
|
47
45
|
agentId: string;
|
|
48
46
|
publicId: string;
|
|
49
47
|
keyHash: string;
|
|
50
48
|
keyPrefix: string;
|
|
51
49
|
lastUsedAt: string | null;
|
|
52
50
|
expiresAt: string | null;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
53
|
}[]>;
|
|
54
|
-
declare const listApiKeysPaginated: (db:
|
|
54
|
+
declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
55
55
|
scopes: ProjectScopeConfig;
|
|
56
56
|
pagination?: PaginationConfig;
|
|
57
57
|
agentId?: string;
|
|
@@ -64,48 +64,48 @@ declare const listApiKeysPaginated: (db: DatabaseClient) => (params: {
|
|
|
64
64
|
pages: number;
|
|
65
65
|
};
|
|
66
66
|
}>;
|
|
67
|
-
declare const createApiKey: (db:
|
|
68
|
-
id: string;
|
|
69
|
-
name: string | null;
|
|
70
|
-
createdAt: string;
|
|
71
|
-
updatedAt: string;
|
|
67
|
+
declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
|
|
72
68
|
tenantId: string;
|
|
73
69
|
projectId: string;
|
|
70
|
+
id: string;
|
|
71
|
+
name: string | null;
|
|
74
72
|
agentId: string;
|
|
75
73
|
publicId: string;
|
|
76
74
|
keyHash: string;
|
|
77
75
|
keyPrefix: string;
|
|
78
76
|
lastUsedAt: string | null;
|
|
79
77
|
expiresAt: string | null;
|
|
78
|
+
createdAt: string;
|
|
79
|
+
updatedAt: string;
|
|
80
80
|
}>;
|
|
81
|
-
declare const updateApiKey: (db:
|
|
81
|
+
declare const updateApiKey: (db: AgentsRunDatabaseClient) => (params: {
|
|
82
82
|
scopes: ProjectScopeConfig;
|
|
83
83
|
id: string;
|
|
84
84
|
data: ApiKeyUpdate;
|
|
85
85
|
}) => Promise<{
|
|
86
86
|
createdAt: string;
|
|
87
87
|
updatedAt: string;
|
|
88
|
+
agentId: string;
|
|
88
89
|
publicId: string;
|
|
89
90
|
keyHash: string;
|
|
90
91
|
keyPrefix: string;
|
|
91
92
|
name: string | null;
|
|
92
93
|
lastUsedAt: string | null;
|
|
93
94
|
expiresAt: string | null;
|
|
94
|
-
agentId: string;
|
|
95
95
|
projectId: string;
|
|
96
96
|
tenantId: string;
|
|
97
97
|
id: string;
|
|
98
98
|
}>;
|
|
99
|
-
declare const deleteApiKey: (db:
|
|
99
|
+
declare const deleteApiKey: (db: AgentsRunDatabaseClient) => (params: {
|
|
100
100
|
scopes: ProjectScopeConfig;
|
|
101
101
|
id: string;
|
|
102
102
|
}) => Promise<boolean>;
|
|
103
|
-
declare const hasApiKey: (db:
|
|
103
|
+
declare const hasApiKey: (db: AgentsRunDatabaseClient) => (params: {
|
|
104
104
|
scopes: ProjectScopeConfig;
|
|
105
105
|
id: string;
|
|
106
106
|
}) => Promise<boolean>;
|
|
107
|
-
declare const updateApiKeyLastUsed: (db:
|
|
108
|
-
declare const countApiKeys: (db:
|
|
107
|
+
declare const updateApiKeyLastUsed: (db: AgentsRunDatabaseClient) => (id: string) => Promise<void>;
|
|
108
|
+
declare const countApiKeys: (db: AgentsRunDatabaseClient) => (params: {
|
|
109
109
|
scopes: ProjectScopeConfig;
|
|
110
110
|
agentId?: string;
|
|
111
111
|
}) => Promise<number>;
|
|
@@ -113,10 +113,10 @@ declare const countApiKeys: (db: DatabaseClient) => (params: {
|
|
|
113
113
|
* Create a new API key
|
|
114
114
|
* Returns both the API key record and the full key (which should be shown to the user only once)
|
|
115
115
|
*/
|
|
116
|
-
declare const generateAndCreateApiKey: (params: CreateApiKeyParams, db:
|
|
116
|
+
declare const generateAndCreateApiKey: (params: CreateApiKeyParams, db: AgentsRunDatabaseClient) => Promise<ApiKeyCreateResult>;
|
|
117
117
|
/**
|
|
118
118
|
* Validate an API key and return the associated record if valid
|
|
119
119
|
*/
|
|
120
|
-
declare const validateAndGetApiKey: (key: string, db:
|
|
120
|
+
declare const validateAndGetApiKey: (key: string, db: AgentsRunDatabaseClient) => Promise<ApiKeySelect | null>;
|
|
121
121
|
//#endregion
|
|
122
122
|
export { countApiKeys, createApiKey, deleteApiKey, generateAndCreateApiKey, getApiKeyById, getApiKeyByPublicId, hasApiKey, listApiKeys, listApiKeysPaginated, updateApiKey, updateApiKeyLastUsed, validateAndGetApiKey };
|