@inkeep/agents-core 0.59.4 → 0.60.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 +86 -86
- package/dist/auth/auth-validation-schemas.d.ts +154 -154
- package/dist/auth/auth.d.ts +6 -6
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/client-exports.d.ts +2 -2
- package/dist/client-exports.js +2 -2
- package/dist/constants/context-breakdown.js +5 -0
- package/dist/constants/otel-attributes.d.ts +25 -1
- package/dist/constants/otel-attributes.js +25 -1
- package/dist/data-access/manage/agentFull.js +5 -5
- package/dist/data-access/manage/agents.d.ts +31 -31
- package/dist/data-access/manage/artifactComponents.d.ts +14 -14
- package/dist/data-access/manage/contextConfigs.d.ts +8 -8
- package/dist/data-access/manage/dataComponents.d.ts +6 -6
- package/dist/data-access/manage/functionTools.d.ts +14 -14
- package/dist/data-access/manage/functionTools.js +2 -2
- package/dist/data-access/manage/skills.d.ts +13 -13
- package/dist/data-access/manage/skills.js +2 -3
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +18 -18
- package/dist/data-access/manage/subAgentExternalAgentRelations.js +2 -2
- package/dist/data-access/manage/subAgentRelations.d.ts +20 -20
- package/dist/data-access/manage/subAgentRelations.js +2 -2
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
- package/dist/data-access/manage/subAgentTeamAgentRelations.js +2 -2
- package/dist/data-access/manage/subAgents.d.ts +21 -21
- package/dist/data-access/manage/tools.d.ts +18 -18
- package/dist/data-access/manage/tools.js +2 -2
- package/dist/data-access/manage/triggers.d.ts +2 -2
- package/dist/data-access/runtime/apiKeys.d.ts +16 -16
- package/dist/data-access/runtime/apps.d.ts +13 -10
- package/dist/data-access/runtime/conversations.d.ts +18 -18
- package/dist/data-access/runtime/conversations.js +17 -1
- package/dist/data-access/runtime/messages.d.ts +27 -27
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
- package/dist/data-access/runtime/tasks.d.ts +4 -4
- package/dist/db/manage/manage-schema.d.ts +453 -453
- package/dist/db/runtime/runtime-schema.d.ts +353 -334
- package/dist/db/runtime/runtime-schema.js +4 -1
- package/dist/dolt/fk-map.d.ts +5 -0
- package/dist/dolt/fk-map.js +34 -0
- package/dist/dolt/index.d.ts +3 -2
- package/dist/dolt/index.js +3 -2
- package/dist/dolt/resolve-conflicts.d.ts +11 -1
- package/dist/dolt/resolve-conflicts.js +105 -47
- package/dist/index.d.ts +8 -5
- package/dist/index.js +7 -4
- package/dist/types/utility.d.ts +2 -0
- package/dist/utils/apiKeys.js +1 -1
- package/dist/utils/conversations.d.ts +7 -1
- package/dist/utils/conversations.js +10 -1
- package/dist/utils/error.d.ts +51 -51
- package/dist/utils/index.d.ts +6 -2
- package/dist/utils/index.js +4 -2
- package/dist/utils/model-factory.js +35 -10
- package/dist/utils/token-estimator.d.ts +19 -0
- package/dist/utils/token-estimator.js +17 -0
- package/dist/utils/usage-cost-middleware.d.ts +13 -0
- package/dist/utils/usage-cost-middleware.js +60 -0
- package/dist/utils/usage-tracker.d.ts +2 -0
- package/dist/utils/usage-tracker.js +1 -0
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/schemas.d.ts +2162 -2086
- package/drizzle/runtime/0025_faulty_kylun.sql +1 -0
- package/drizzle/runtime/meta/0025_snapshot.json +4276 -0
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +1 -1
|
@@ -9,13 +9,11 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
|
|
|
9
9
|
scopes: ProjectScopeConfig;
|
|
10
10
|
id: string;
|
|
11
11
|
}) => Promise<{
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
12
|
description: string | null;
|
|
13
|
+
name: string;
|
|
15
14
|
tenantId: string;
|
|
16
15
|
projectId: string;
|
|
17
|
-
|
|
18
|
-
updatedAt: string;
|
|
16
|
+
id: string;
|
|
19
17
|
props: {
|
|
20
18
|
[x: string]: unknown;
|
|
21
19
|
type: "object";
|
|
@@ -28,6 +26,8 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
|
|
|
28
26
|
component: string;
|
|
29
27
|
mockData: Record<string, unknown>;
|
|
30
28
|
} | null;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
updatedAt: string;
|
|
31
31
|
} | undefined>;
|
|
32
32
|
declare const listArtifactComponents: (db: AgentsManageDatabaseClient) => (params: {
|
|
33
33
|
scopes: ProjectScopeConfig;
|
|
@@ -65,13 +65,11 @@ declare const listArtifactComponentsPaginated: (db: AgentsManageDatabaseClient)
|
|
|
65
65
|
};
|
|
66
66
|
}>;
|
|
67
67
|
declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
|
|
68
|
-
id: string;
|
|
69
|
-
name: string;
|
|
70
68
|
description: string | null;
|
|
69
|
+
name: string;
|
|
71
70
|
tenantId: string;
|
|
72
71
|
projectId: string;
|
|
73
|
-
|
|
74
|
-
updatedAt: string;
|
|
72
|
+
id: string;
|
|
75
73
|
props: {
|
|
76
74
|
[x: string]: unknown;
|
|
77
75
|
type: "object";
|
|
@@ -84,6 +82,8 @@ declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (para
|
|
|
84
82
|
component: string;
|
|
85
83
|
mockData: Record<string, unknown>;
|
|
86
84
|
} | null;
|
|
85
|
+
createdAt: string;
|
|
86
|
+
updatedAt: string;
|
|
87
87
|
}>;
|
|
88
88
|
declare const updateArtifactComponent: (db: AgentsManageDatabaseClient) => (params: {
|
|
89
89
|
scopes: ProjectScopeConfig;
|
|
@@ -141,12 +141,12 @@ declare const associateArtifactComponentWithAgent: (db: AgentsManageDatabaseClie
|
|
|
141
141
|
scopes: SubAgentScopeConfig;
|
|
142
142
|
artifactComponentId: string;
|
|
143
143
|
}) => Promise<{
|
|
144
|
-
id: string;
|
|
145
144
|
tenantId: string;
|
|
146
145
|
projectId: string;
|
|
147
|
-
agentId: string;
|
|
148
|
-
createdAt: string;
|
|
149
146
|
subAgentId: string;
|
|
147
|
+
id: string;
|
|
148
|
+
createdAt: string;
|
|
149
|
+
agentId: string;
|
|
150
150
|
artifactComponentId: string;
|
|
151
151
|
}>;
|
|
152
152
|
declare const removeArtifactComponentFromAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -184,12 +184,12 @@ declare const upsertAgentArtifactComponentRelation: (db: AgentsManageDatabaseCli
|
|
|
184
184
|
scopes: SubAgentScopeConfig;
|
|
185
185
|
artifactComponentId: string;
|
|
186
186
|
}) => Promise<{
|
|
187
|
-
id: string;
|
|
188
187
|
tenantId: string;
|
|
189
188
|
projectId: string;
|
|
190
|
-
agentId: string;
|
|
191
|
-
createdAt: string;
|
|
192
189
|
subAgentId: string;
|
|
190
|
+
id: string;
|
|
191
|
+
createdAt: string;
|
|
192
|
+
agentId: string;
|
|
193
193
|
artifactComponentId: string;
|
|
194
194
|
} | null>;
|
|
195
195
|
/**
|
|
@@ -9,24 +9,24 @@ declare const getContextConfigById: (db: AgentsManageDatabaseClient) => (params:
|
|
|
9
9
|
scopes: AgentScopeConfig;
|
|
10
10
|
id: string;
|
|
11
11
|
}) => Promise<{
|
|
12
|
-
id: string;
|
|
13
12
|
tenantId: string;
|
|
14
13
|
projectId: string;
|
|
15
|
-
|
|
14
|
+
id: string;
|
|
16
15
|
createdAt: string;
|
|
17
16
|
updatedAt: string;
|
|
17
|
+
agentId: string;
|
|
18
18
|
headersSchema: unknown;
|
|
19
19
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
20
20
|
} | undefined>;
|
|
21
21
|
declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
|
|
22
22
|
scopes: AgentScopeConfig;
|
|
23
23
|
}) => Promise<{
|
|
24
|
-
id: string;
|
|
25
24
|
tenantId: string;
|
|
26
25
|
projectId: string;
|
|
27
|
-
|
|
26
|
+
id: string;
|
|
28
27
|
createdAt: string;
|
|
29
28
|
updatedAt: string;
|
|
29
|
+
agentId: string;
|
|
30
30
|
headersSchema: unknown;
|
|
31
31
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
32
32
|
}[]>;
|
|
@@ -43,12 +43,12 @@ declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (
|
|
|
43
43
|
};
|
|
44
44
|
}>;
|
|
45
45
|
declare const createContextConfig: (db: AgentsManageDatabaseClient) => (params: ContextConfigInsert) => Promise<{
|
|
46
|
-
id: string;
|
|
47
46
|
tenantId: string;
|
|
48
47
|
projectId: string;
|
|
49
|
-
|
|
48
|
+
id: string;
|
|
50
49
|
createdAt: string;
|
|
51
50
|
updatedAt: string;
|
|
51
|
+
agentId: string;
|
|
52
52
|
headersSchema: unknown;
|
|
53
53
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
54
54
|
}>;
|
|
@@ -83,12 +83,12 @@ declare const countContextConfigs: (db: AgentsManageDatabaseClient) => (params:
|
|
|
83
83
|
declare const upsertContextConfig: (db: AgentsManageDatabaseClient) => (params: {
|
|
84
84
|
data: ContextConfigInsert;
|
|
85
85
|
}) => Promise<{
|
|
86
|
-
id: string;
|
|
87
86
|
tenantId: string;
|
|
88
87
|
projectId: string;
|
|
89
|
-
|
|
88
|
+
id: string;
|
|
90
89
|
createdAt: string;
|
|
91
90
|
updatedAt: string;
|
|
91
|
+
agentId: string;
|
|
92
92
|
headersSchema: unknown;
|
|
93
93
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
94
94
|
}>;
|
|
@@ -65,12 +65,12 @@ declare const associateDataComponentWithAgent: (db: AgentsManageDatabaseClient)
|
|
|
65
65
|
scopes: SubAgentScopeConfig;
|
|
66
66
|
dataComponentId: string;
|
|
67
67
|
}) => Promise<{
|
|
68
|
-
id: string;
|
|
69
68
|
tenantId: string;
|
|
70
69
|
projectId: string;
|
|
71
|
-
agentId: string;
|
|
72
|
-
createdAt: string;
|
|
73
70
|
subAgentId: string;
|
|
71
|
+
id: string;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
agentId: string;
|
|
74
74
|
dataComponentId: string;
|
|
75
75
|
}>;
|
|
76
76
|
/**
|
|
@@ -107,12 +107,12 @@ declare const upsertAgentDataComponentRelation: (db: AgentsManageDatabaseClient)
|
|
|
107
107
|
scopes: SubAgentScopeConfig;
|
|
108
108
|
dataComponentId: string;
|
|
109
109
|
}) => Promise<{
|
|
110
|
-
id: string;
|
|
111
110
|
tenantId: string;
|
|
112
111
|
projectId: string;
|
|
113
|
-
agentId: string;
|
|
114
|
-
createdAt: string;
|
|
115
112
|
subAgentId: string;
|
|
113
|
+
id: string;
|
|
114
|
+
createdAt: string;
|
|
115
|
+
agentId: string;
|
|
116
116
|
dataComponentId: string;
|
|
117
117
|
} | null>;
|
|
118
118
|
/**
|
|
@@ -53,14 +53,14 @@ declare const createFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
53
53
|
data: FunctionToolApiInsert;
|
|
54
54
|
scopes: AgentScopeConfig;
|
|
55
55
|
}) => Promise<{
|
|
56
|
-
id: string;
|
|
57
|
-
name: string;
|
|
58
56
|
description: string | null;
|
|
57
|
+
name: string;
|
|
59
58
|
tenantId: string;
|
|
60
59
|
projectId: string;
|
|
61
|
-
|
|
60
|
+
id: string;
|
|
62
61
|
createdAt: string;
|
|
63
62
|
updatedAt: string;
|
|
63
|
+
agentId: string;
|
|
64
64
|
functionId: string;
|
|
65
65
|
}>;
|
|
66
66
|
/**
|
|
@@ -95,14 +95,14 @@ declare const upsertFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
95
95
|
data: FunctionToolApiInsert;
|
|
96
96
|
scopes: AgentScopeConfig;
|
|
97
97
|
}) => Promise<{
|
|
98
|
-
id: string;
|
|
99
|
-
name: string;
|
|
100
98
|
description: string | null;
|
|
99
|
+
name: string;
|
|
101
100
|
tenantId: string;
|
|
102
101
|
projectId: string;
|
|
103
|
-
|
|
102
|
+
id: string;
|
|
104
103
|
createdAt: string;
|
|
105
104
|
updatedAt: string;
|
|
105
|
+
agentId: string;
|
|
106
106
|
functionId: string;
|
|
107
107
|
}>;
|
|
108
108
|
declare const getFunctionToolsForSubAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -157,17 +157,17 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
|
|
|
157
157
|
needsApproval?: boolean;
|
|
158
158
|
}> | null;
|
|
159
159
|
}) => Promise<{
|
|
160
|
-
id: string;
|
|
161
160
|
tenantId: string;
|
|
162
161
|
projectId: string;
|
|
163
|
-
|
|
162
|
+
subAgentId: string;
|
|
163
|
+
id: string;
|
|
164
164
|
createdAt: string;
|
|
165
165
|
updatedAt: string;
|
|
166
|
+
agentId: string;
|
|
167
|
+
functionToolId: string;
|
|
166
168
|
toolPolicies: Record<string, {
|
|
167
169
|
needsApproval?: boolean;
|
|
168
170
|
}> | null;
|
|
169
|
-
subAgentId: string;
|
|
170
|
-
functionToolId: string;
|
|
171
171
|
}>;
|
|
172
172
|
/**
|
|
173
173
|
* Update an agent-function tool relation
|
|
@@ -222,17 +222,17 @@ declare const associateFunctionToolWithSubAgent: (db: AgentsManageDatabaseClient
|
|
|
222
222
|
needsApproval?: boolean;
|
|
223
223
|
}> | null;
|
|
224
224
|
}) => Promise<{
|
|
225
|
-
id: string;
|
|
226
225
|
tenantId: string;
|
|
227
226
|
projectId: string;
|
|
228
|
-
|
|
227
|
+
subAgentId: string;
|
|
228
|
+
id: string;
|
|
229
229
|
createdAt: string;
|
|
230
230
|
updatedAt: string;
|
|
231
|
+
agentId: string;
|
|
232
|
+
functionToolId: string;
|
|
231
233
|
toolPolicies: Record<string, {
|
|
232
234
|
needsApproval?: boolean;
|
|
233
235
|
}> | null;
|
|
234
|
-
subAgentId: string;
|
|
235
|
-
functionToolId: string;
|
|
236
236
|
}>;
|
|
237
237
|
//#endregion
|
|
238
238
|
export { addFunctionToolToSubAgent, associateFunctionToolWithSubAgent, createFunctionTool, deleteFunctionTool, getFunctionToolById, getFunctionToolsForSubAgent, getSubAgentsUsingFunctionTool, isFunctionToolAssociatedWithSubAgent, listFunctionTools, removeFunctionToolFromSubAgent, updateFunctionTool, updateSubAgentFunctionToolRelation, upsertFunctionTool, upsertSubAgentFunctionToolRelation };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { functionTools, subAgentFunctionToolRelations } from "../../db/manage/manage-schema.js";
|
|
2
2
|
import { getLogger } from "../../utils/logger.js";
|
|
3
|
-
import {
|
|
3
|
+
import { deriveRelationId } from "../../utils/conversations.js";
|
|
4
4
|
import { agentScopedWhere } from "./scope-helpers.js";
|
|
5
5
|
import { and, count, desc, eq } from "drizzle-orm";
|
|
6
6
|
|
|
@@ -170,7 +170,7 @@ const addFunctionToolToSubAgent = (db) => {
|
|
|
170
170
|
return async (params) => {
|
|
171
171
|
const { scopes, subAgentId, functionToolId, toolPolicies } = params;
|
|
172
172
|
try {
|
|
173
|
-
const relationId =
|
|
173
|
+
const relationId = deriveRelationId(scopes.tenantId, scopes.projectId, scopes.agentId, subAgentId, functionToolId);
|
|
174
174
|
const [result] = await db.insert(subAgentFunctionToolRelations).values({
|
|
175
175
|
id: relationId,
|
|
176
176
|
...scopes,
|
|
@@ -8,15 +8,15 @@ declare const getSkillById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
8
8
|
scopes: ProjectScopeConfig;
|
|
9
9
|
skillId: string;
|
|
10
10
|
}) => Promise<{
|
|
11
|
-
id: string;
|
|
12
|
-
name: string;
|
|
13
11
|
description: string;
|
|
12
|
+
name: string;
|
|
13
|
+
content: string;
|
|
14
14
|
tenantId: string;
|
|
15
15
|
projectId: string;
|
|
16
|
+
id: string;
|
|
16
17
|
createdAt: string;
|
|
17
18
|
updatedAt: string;
|
|
18
19
|
metadata: Record<string, string> | null;
|
|
19
|
-
content: string;
|
|
20
20
|
} | null>;
|
|
21
21
|
declare const listSkills: (db: AgentsManageDatabaseClient) => (params: {
|
|
22
22
|
scopes: ProjectScopeConfig;
|
|
@@ -41,26 +41,26 @@ declare const listSkills: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
41
41
|
};
|
|
42
42
|
}>;
|
|
43
43
|
declare const createSkill: (db: AgentsManageDatabaseClient) => (data: SkillInsert) => Promise<{
|
|
44
|
-
id: string;
|
|
45
|
-
name: string;
|
|
46
44
|
description: string;
|
|
45
|
+
name: string;
|
|
46
|
+
content: string;
|
|
47
47
|
tenantId: string;
|
|
48
48
|
projectId: string;
|
|
49
|
+
id: string;
|
|
49
50
|
createdAt: string;
|
|
50
51
|
updatedAt: string;
|
|
51
52
|
metadata: Record<string, string> | null;
|
|
52
|
-
content: string;
|
|
53
53
|
}>;
|
|
54
54
|
declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillInsert) => Promise<{
|
|
55
|
-
id: string;
|
|
56
|
-
name: string;
|
|
57
55
|
description: string;
|
|
56
|
+
name: string;
|
|
57
|
+
content: string;
|
|
58
58
|
tenantId: string;
|
|
59
59
|
projectId: string;
|
|
60
|
+
id: string;
|
|
60
61
|
createdAt: string;
|
|
61
62
|
updatedAt: string;
|
|
62
63
|
metadata: Record<string, string> | null;
|
|
63
|
-
content: string;
|
|
64
64
|
}>;
|
|
65
65
|
declare const updateSkill: (db: AgentsManageDatabaseClient) => (params: {
|
|
66
66
|
scopes: ProjectScopeConfig;
|
|
@@ -91,16 +91,16 @@ declare const upsertSubAgentSkill: (db: AgentsManageDatabaseClient) => (params:
|
|
|
91
91
|
index: number;
|
|
92
92
|
alwaysLoaded?: boolean;
|
|
93
93
|
}) => Promise<{
|
|
94
|
-
id: string;
|
|
95
94
|
tenantId: string;
|
|
96
95
|
projectId: string;
|
|
97
|
-
|
|
96
|
+
subAgentId: string;
|
|
97
|
+
id: string;
|
|
98
98
|
createdAt: string;
|
|
99
99
|
updatedAt: string;
|
|
100
|
+
agentId: string;
|
|
101
|
+
skillId: string;
|
|
100
102
|
index: number;
|
|
101
103
|
alwaysLoaded: boolean;
|
|
102
|
-
skillId: string;
|
|
103
|
-
subAgentId: string;
|
|
104
104
|
}>;
|
|
105
105
|
declare const deleteSubAgentSkill: (db: AgentsManageDatabaseClient) => (params: {
|
|
106
106
|
scopes: AgentScopeConfig;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { skills, subAgentSkills } from "../../db/manage/manage-schema.js";
|
|
2
2
|
import { getLogger } from "../../utils/logger.js";
|
|
3
|
-
import {
|
|
3
|
+
import { deriveRelationId } from "../../utils/conversations.js";
|
|
4
4
|
import { agentScopedWhere, projectScopedWhere, subAgentScopedWhere } from "./scope-helpers.js";
|
|
5
|
-
import "../../index.js";
|
|
6
5
|
import { and, asc, count, desc, eq, inArray } from "drizzle-orm";
|
|
7
6
|
|
|
8
7
|
//#region src/data-access/manage/skills.ts
|
|
@@ -109,7 +108,7 @@ const upsertSubAgentSkill = (db) => async (params) => {
|
|
|
109
108
|
}
|
|
110
109
|
const insertData = {
|
|
111
110
|
...params.scopes,
|
|
112
|
-
id:
|
|
111
|
+
id: deriveRelationId(params.scopes.tenantId, params.scopes.projectId, params.scopes.agentId, params.scopes.subAgentId, params.skillId),
|
|
113
112
|
skillId: params.skillId,
|
|
114
113
|
index: params.index,
|
|
115
114
|
alwaysLoaded: params.alwaysLoaded ?? false,
|
|
@@ -9,15 +9,15 @@ declare const getSubAgentExternalAgentRelationById: (db: AgentsManageDatabaseCli
|
|
|
9
9
|
scopes: SubAgentScopeConfig;
|
|
10
10
|
relationId: string;
|
|
11
11
|
}) => Promise<{
|
|
12
|
-
id: string;
|
|
13
12
|
tenantId: string;
|
|
14
13
|
projectId: string;
|
|
15
|
-
|
|
14
|
+
subAgentId: string;
|
|
15
|
+
id: string;
|
|
16
16
|
createdAt: string;
|
|
17
17
|
updatedAt: string;
|
|
18
|
+
agentId: string;
|
|
18
19
|
headers: Record<string, string> | null;
|
|
19
20
|
externalAgentId: string;
|
|
20
|
-
subAgentId: string;
|
|
21
21
|
} | undefined>;
|
|
22
22
|
declare const listSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
23
23
|
scopes: SubAgentScopeConfig;
|
|
@@ -44,28 +44,28 @@ declare const listSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClien
|
|
|
44
44
|
declare const getSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
45
45
|
scopes: SubAgentScopeConfig;
|
|
46
46
|
}) => Promise<{
|
|
47
|
-
id: string;
|
|
48
47
|
tenantId: string;
|
|
49
48
|
projectId: string;
|
|
50
|
-
|
|
49
|
+
subAgentId: string;
|
|
50
|
+
id: string;
|
|
51
51
|
createdAt: string;
|
|
52
52
|
updatedAt: string;
|
|
53
|
+
agentId: string;
|
|
53
54
|
headers: Record<string, string> | null;
|
|
54
55
|
externalAgentId: string;
|
|
55
|
-
subAgentId: string;
|
|
56
56
|
}[]>;
|
|
57
57
|
declare const getSubAgentExternalAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
58
58
|
scopes: AgentScopeConfig;
|
|
59
59
|
}) => Promise<{
|
|
60
|
-
id: string;
|
|
61
60
|
tenantId: string;
|
|
62
61
|
projectId: string;
|
|
63
|
-
|
|
62
|
+
subAgentId: string;
|
|
63
|
+
id: string;
|
|
64
64
|
createdAt: string;
|
|
65
65
|
updatedAt: string;
|
|
66
|
+
agentId: string;
|
|
66
67
|
headers: Record<string, string> | null;
|
|
67
68
|
externalAgentId: string;
|
|
68
|
-
subAgentId: string;
|
|
69
69
|
}[]>;
|
|
70
70
|
declare const getSubAgentExternalAgentRelationsByExternalAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
71
71
|
scopes: AgentScopeConfig;
|
|
@@ -180,15 +180,15 @@ declare const createSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
|
|
|
180
180
|
headers?: Record<string, string> | null;
|
|
181
181
|
};
|
|
182
182
|
}) => Promise<{
|
|
183
|
-
id: string;
|
|
184
183
|
tenantId: string;
|
|
185
184
|
projectId: string;
|
|
186
|
-
|
|
185
|
+
subAgentId: string;
|
|
186
|
+
id: string;
|
|
187
187
|
createdAt: string;
|
|
188
188
|
updatedAt: string;
|
|
189
|
+
agentId: string;
|
|
189
190
|
headers: Record<string, string> | null;
|
|
190
191
|
externalAgentId: string;
|
|
191
|
-
subAgentId: string;
|
|
192
192
|
}>;
|
|
193
193
|
/**
|
|
194
194
|
* Check if sub-agent external agent relation exists by params
|
|
@@ -197,15 +197,15 @@ declare const getSubAgentExternalAgentRelationByParams: (db: AgentsManageDatabas
|
|
|
197
197
|
scopes: SubAgentScopeConfig;
|
|
198
198
|
externalAgentId: string;
|
|
199
199
|
}) => Promise<{
|
|
200
|
-
id: string;
|
|
201
200
|
tenantId: string;
|
|
202
201
|
projectId: string;
|
|
203
|
-
|
|
202
|
+
subAgentId: string;
|
|
203
|
+
id: string;
|
|
204
204
|
createdAt: string;
|
|
205
205
|
updatedAt: string;
|
|
206
|
+
agentId: string;
|
|
206
207
|
headers: Record<string, string> | null;
|
|
207
208
|
externalAgentId: string;
|
|
208
|
-
subAgentId: string;
|
|
209
209
|
} | undefined>;
|
|
210
210
|
/**
|
|
211
211
|
* Upsert sub-agent external agent relation (create if it doesn't exist, update if it does)
|
|
@@ -218,15 +218,15 @@ declare const upsertSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
|
|
|
218
218
|
headers?: Record<string, string> | null;
|
|
219
219
|
};
|
|
220
220
|
}) => Promise<{
|
|
221
|
-
id: string;
|
|
222
221
|
tenantId: string;
|
|
223
222
|
projectId: string;
|
|
224
|
-
|
|
223
|
+
subAgentId: string;
|
|
224
|
+
id: string;
|
|
225
225
|
createdAt: string;
|
|
226
226
|
updatedAt: string;
|
|
227
|
+
agentId: string;
|
|
227
228
|
headers: Record<string, string> | null;
|
|
228
229
|
externalAgentId: string;
|
|
229
|
-
subAgentId: string;
|
|
230
230
|
}>;
|
|
231
231
|
declare const updateSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
|
|
232
232
|
scopes: SubAgentScopeConfig;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { externalAgents, subAgentExternalAgentRelations, subAgents } from "../../db/manage/manage-schema.js";
|
|
2
|
+
import { deriveRelationId } from "../../utils/conversations.js";
|
|
2
3
|
import { agentScopedWhere, subAgentScopedWhere } from "./scope-helpers.js";
|
|
3
4
|
import { and, count, desc, eq } from "drizzle-orm";
|
|
4
|
-
import { nanoid } from "nanoid";
|
|
5
5
|
|
|
6
6
|
//#region src/data-access/manage/subAgentExternalAgentRelations.ts
|
|
7
7
|
const getSubAgentExternalAgentRelationById = (db) => async (params) => {
|
|
@@ -122,7 +122,7 @@ const getSubAgentsForExternalAgent = (db) => async (params) => {
|
|
|
122
122
|
};
|
|
123
123
|
};
|
|
124
124
|
const createSubAgentExternalAgentRelation = (db) => async (params) => {
|
|
125
|
-
const finalRelationId = params.relationId ??
|
|
125
|
+
const finalRelationId = params.relationId ?? deriveRelationId(params.scopes.tenantId, params.scopes.projectId, params.scopes.agentId, params.scopes.subAgentId, params.data.externalAgentId);
|
|
126
126
|
return (await db.insert(subAgentExternalAgentRelations).values({
|
|
127
127
|
id: finalRelationId,
|
|
128
128
|
tenantId: params.scopes.tenantId,
|
|
@@ -9,12 +9,12 @@ declare const getAgentRelationById: (db: AgentsManageDatabaseClient) => (params:
|
|
|
9
9
|
scopes: AgentScopeConfig;
|
|
10
10
|
relationId: string;
|
|
11
11
|
}) => Promise<{
|
|
12
|
-
id: string;
|
|
13
12
|
tenantId: string;
|
|
14
13
|
projectId: string;
|
|
15
|
-
|
|
14
|
+
id: string;
|
|
16
15
|
createdAt: string;
|
|
17
16
|
updatedAt: string;
|
|
17
|
+
agentId: string;
|
|
18
18
|
sourceSubAgentId: string;
|
|
19
19
|
targetSubAgentId: string | null;
|
|
20
20
|
relationType: string | null;
|
|
@@ -44,12 +44,12 @@ declare const listAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
44
44
|
declare const getAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
45
45
|
scopes: SubAgentScopeConfig;
|
|
46
46
|
}) => Promise<{
|
|
47
|
-
id: string;
|
|
48
47
|
tenantId: string;
|
|
49
48
|
projectId: string;
|
|
50
|
-
|
|
49
|
+
id: string;
|
|
51
50
|
createdAt: string;
|
|
52
51
|
updatedAt: string;
|
|
52
|
+
agentId: string;
|
|
53
53
|
sourceSubAgentId: string;
|
|
54
54
|
targetSubAgentId: string | null;
|
|
55
55
|
relationType: string | null;
|
|
@@ -57,12 +57,12 @@ declare const getAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
57
57
|
declare const getAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
58
58
|
scopes: AgentScopeConfig;
|
|
59
59
|
}) => Promise<{
|
|
60
|
-
id: string;
|
|
61
60
|
tenantId: string;
|
|
62
61
|
projectId: string;
|
|
63
|
-
|
|
62
|
+
id: string;
|
|
64
63
|
createdAt: string;
|
|
65
64
|
updatedAt: string;
|
|
65
|
+
agentId: string;
|
|
66
66
|
sourceSubAgentId: string;
|
|
67
67
|
targetSubAgentId: string | null;
|
|
68
68
|
relationType: string | null;
|
|
@@ -126,12 +126,12 @@ declare const getRelatedAgentsForAgent: (db: AgentsManageDatabaseClient) => (par
|
|
|
126
126
|
}[];
|
|
127
127
|
}>;
|
|
128
128
|
declare const createSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
|
|
129
|
-
id: string;
|
|
130
129
|
tenantId: string;
|
|
131
130
|
projectId: string;
|
|
132
|
-
|
|
131
|
+
id: string;
|
|
133
132
|
createdAt: string;
|
|
134
133
|
updatedAt: string;
|
|
134
|
+
agentId: string;
|
|
135
135
|
sourceSubAgentId: string;
|
|
136
136
|
targetSubAgentId: string | null;
|
|
137
137
|
relationType: string | null;
|
|
@@ -145,12 +145,12 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
|
|
|
145
145
|
targetSubAgentId?: string;
|
|
146
146
|
relationType: string;
|
|
147
147
|
}) => Promise<{
|
|
148
|
-
id: string;
|
|
149
148
|
tenantId: string;
|
|
150
149
|
projectId: string;
|
|
151
|
-
|
|
150
|
+
id: string;
|
|
152
151
|
createdAt: string;
|
|
153
152
|
updatedAt: string;
|
|
153
|
+
agentId: string;
|
|
154
154
|
sourceSubAgentId: string;
|
|
155
155
|
targetSubAgentId: string | null;
|
|
156
156
|
relationType: string | null;
|
|
@@ -159,12 +159,12 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
|
|
|
159
159
|
* Upsert agent relation (create if it doesn't exist, no-op if it does)
|
|
160
160
|
*/
|
|
161
161
|
declare const upsertSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
|
|
162
|
-
id: string;
|
|
163
162
|
tenantId: string;
|
|
164
163
|
projectId: string;
|
|
165
|
-
|
|
164
|
+
id: string;
|
|
166
165
|
createdAt: string;
|
|
167
166
|
updatedAt: string;
|
|
167
|
+
agentId: string;
|
|
168
168
|
sourceSubAgentId: string;
|
|
169
169
|
targetSubAgentId: string | null;
|
|
170
170
|
relationType: string | null;
|
|
@@ -204,18 +204,18 @@ declare const createAgentToolRelation: (db: AgentsManageDatabaseClient) => (para
|
|
|
204
204
|
}> | null;
|
|
205
205
|
};
|
|
206
206
|
}) => Promise<{
|
|
207
|
-
id: string;
|
|
208
207
|
tenantId: string;
|
|
209
208
|
projectId: string;
|
|
210
|
-
|
|
209
|
+
subAgentId: string;
|
|
210
|
+
id: string;
|
|
211
211
|
createdAt: string;
|
|
212
212
|
updatedAt: string;
|
|
213
|
-
|
|
213
|
+
agentId: string;
|
|
214
214
|
headers: Record<string, string> | null;
|
|
215
|
+
toolId: string;
|
|
215
216
|
toolPolicies: Record<string, {
|
|
216
217
|
needsApproval?: boolean;
|
|
217
218
|
}> | null;
|
|
218
|
-
subAgentId: string;
|
|
219
219
|
selectedTools: string[] | null;
|
|
220
220
|
}>;
|
|
221
221
|
declare const updateAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -248,18 +248,18 @@ declare const getAgentToolRelationById: (db: AgentsManageDatabaseClient) => (par
|
|
|
248
248
|
scopes: SubAgentScopeConfig;
|
|
249
249
|
relationId: string;
|
|
250
250
|
}) => Promise<{
|
|
251
|
-
id: string;
|
|
252
251
|
tenantId: string;
|
|
253
252
|
projectId: string;
|
|
254
|
-
|
|
253
|
+
subAgentId: string;
|
|
254
|
+
id: string;
|
|
255
255
|
createdAt: string;
|
|
256
256
|
updatedAt: string;
|
|
257
|
-
|
|
257
|
+
agentId: string;
|
|
258
258
|
headers: Record<string, string> | null;
|
|
259
|
+
toolId: string;
|
|
259
260
|
toolPolicies: Record<string, {
|
|
260
261
|
needsApproval?: boolean;
|
|
261
262
|
}> | null;
|
|
262
|
-
subAgentId: string;
|
|
263
263
|
selectedTools: string[] | null;
|
|
264
264
|
} | undefined>;
|
|
265
265
|
declare const getAgentToolRelationByAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { subAgentRelations, subAgentToolRelations, subAgents, tools } from "../../db/manage/manage-schema.js";
|
|
2
|
-
import {
|
|
2
|
+
import { deriveRelationId } from "../../utils/conversations.js";
|
|
3
3
|
import { agentScopedWhere, subAgentScopedWhere } from "./scope-helpers.js";
|
|
4
4
|
import { and, count, desc, eq, isNotNull } from "drizzle-orm";
|
|
5
5
|
|
|
@@ -126,7 +126,7 @@ const deleteAgentRelationsByAgent = (db) => async (params) => {
|
|
|
126
126
|
return (await db.delete(subAgentRelations).where(agentScopedWhere(subAgentRelations, params.scopes)).returning()).length > 0;
|
|
127
127
|
};
|
|
128
128
|
const createAgentToolRelation = (db) => async (params) => {
|
|
129
|
-
const finalRelationId = params.relationId ??
|
|
129
|
+
const finalRelationId = params.relationId ?? deriveRelationId(params.scopes.tenantId, params.scopes.projectId, params.scopes.agentId, params.data.subAgentId, params.data.toolId);
|
|
130
130
|
return (await db.insert(subAgentToolRelations).values({
|
|
131
131
|
id: finalRelationId,
|
|
132
132
|
...params.scopes,
|