@inkeep/agents-core 0.42.0 → 0.44.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.d.ts +28 -26
- package/dist/auth/auth.js +21 -16
- package/dist/auth/authz/client.d.ts +8 -3
- package/dist/auth/authz/client.js +23 -17
- package/dist/auth/authz/config.d.ts +50 -29
- package/dist/auth/authz/config.js +42 -33
- package/dist/auth/authz/index.d.ts +3 -3
- package/dist/auth/authz/index.js +3 -3
- package/dist/auth/authz/permissions.d.ts +0 -4
- package/dist/auth/authz/permissions.js +9 -13
- package/dist/auth/authz/sync.d.ts +23 -2
- package/dist/auth/authz/sync.js +127 -53
- package/dist/auth/init.d.ts +1 -0
- package/dist/auth/init.js +115 -0
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/client-exports.d.ts +3 -6
- package/dist/client-exports.js +4 -7
- package/dist/constants/execution-limits-shared/defaults.d.ts +1 -1
- package/dist/constants/execution-limits-shared/defaults.js +1 -1
- package/dist/constants/execution-limits-shared/index.d.ts +1 -1
- package/dist/constants/otel-attributes.d.ts +5 -0
- package/dist/constants/otel-attributes.js +8 -3
- package/dist/constants/signoz-queries.d.ts +1 -0
- package/dist/constants/signoz-queries.js +2 -1
- package/dist/context/TemplateEngine.d.ts +0 -6
- package/dist/context/TemplateEngine.js +4 -18
- package/dist/credential-stores/keychain-store.d.ts +20 -8
- package/dist/credential-stores/keychain-store.js +107 -43
- package/dist/data-access/index.d.ts +5 -4
- package/dist/data-access/index.js +5 -4
- package/dist/data-access/manage/agentFull.js +70 -25
- package/dist/data-access/manage/agents.d.ts +41 -41
- package/dist/data-access/manage/agents.js +29 -21
- package/dist/data-access/manage/artifactComponents.d.ts +12 -12
- package/dist/data-access/manage/artifactComponents.js +1 -1
- package/dist/data-access/manage/contextConfigs.d.ts +12 -12
- package/dist/data-access/manage/dataComponents.d.ts +6 -6
- package/dist/data-access/manage/dataComponents.js +1 -1
- package/dist/data-access/manage/functionTools.d.ts +44 -21
- package/dist/data-access/manage/functionTools.js +34 -22
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentRelations.d.ts +26 -26
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
- package/dist/data-access/manage/subAgents.d.ts +15 -15
- package/dist/data-access/manage/tools.d.ts +39 -28
- package/dist/data-access/manage/tools.js +73 -31
- package/dist/data-access/manage/triggers.d.ts +27 -1
- package/dist/data-access/runtime/apiKeys.d.ts +20 -20
- package/dist/data-access/runtime/cascade-delete.d.ts +48 -1
- package/dist/data-access/runtime/cascade-delete.js +52 -2
- package/dist/data-access/runtime/conversations.d.ts +24 -24
- package/dist/data-access/runtime/github-work-app-installations.d.ts +261 -0
- package/dist/data-access/runtime/github-work-app-installations.js +457 -0
- package/dist/data-access/runtime/messages.d.ts +18 -18
- package/dist/data-access/runtime/organizations.d.ts +2 -2
- package/dist/data-access/runtime/organizations.js +4 -4
- package/dist/data-access/runtime/tasks.d.ts +6 -6
- package/dist/db/manage/manage-schema.d.ts +533 -402
- package/dist/db/manage/manage-schema.js +38 -27
- package/dist/db/runtime/runtime-schema.d.ts +1021 -177
- package/dist/db/runtime/runtime-schema.js +173 -5
- package/dist/db/utils.d.ts +6 -0
- package/dist/db/utils.js +42 -0
- package/dist/dolt/branch.js +1 -1
- package/dist/dolt/branches-api.js +1 -1
- package/dist/dolt/index.d.ts +2 -2
- package/dist/dolt/index.js +4 -4
- package/dist/dolt/migrate-all-branches.js +6 -1
- package/dist/dolt/migrate-dolt.js +4 -1
- package/dist/dolt/ref-helpers.js +1 -1
- package/dist/dolt/ref-middleware.js +1 -1
- package/dist/dolt/ref-scope.js +1 -1
- package/dist/dolt/schema-sync.d.ts +2 -1
- package/dist/dolt/schema-sync.js +10 -1
- package/dist/env.d.ts +6 -4
- package/dist/env.js +11 -10
- package/dist/index.d.ts +15 -16
- package/dist/index.js +23 -24
- package/dist/types/@napi-rs__keyring/index.d.ts +14 -0
- package/dist/types/entities.d.ts +9 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/utility.d.ts +17 -3
- package/dist/types/utility.js +2 -1
- package/dist/utils/JsonTransformer.d.ts +1 -3
- package/dist/utils/JsonTransformer.js +14 -23
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/utils/jmespath-utils.d.ts +152 -0
- package/dist/utils/jmespath-utils.js +213 -0
- package/dist/utils/mcp-client.d.ts +1 -1
- package/dist/utils/mcp-client.js +1 -1
- package/dist/utils/signature-validation.d.ts +2 -0
- package/dist/utils/signature-validation.js +3 -0
- package/dist/utils/third-party-mcp-servers/composio-client.d.ts +13 -1
- package/dist/utils/third-party-mcp-servers/composio-client.js +24 -6
- package/dist/utils/third-party-mcp-servers/index.d.ts +2 -2
- package/dist/utils/third-party-mcp-servers/index.js +2 -2
- package/dist/utils/trigger-auth.d.ts +31 -8
- package/dist/utils/trigger-auth.js +121 -13
- package/dist/validation/agentFull.js +1 -1
- package/dist/validation/drizzle-schema-helpers.d.ts +4 -23
- package/dist/validation/drizzle-schema-helpers.js +3 -30
- package/dist/validation/index.d.ts +3 -5
- package/dist/validation/index.js +5 -7
- package/dist/validation/render-validation.js +19 -0
- package/dist/validation/schemas.d.ts +3675 -1665
- package/dist/validation/schemas.js +409 -94
- package/dist/validation/stream-event-schemas.d.ts +96 -1
- package/dist/validation/stream-event-schemas.js +67 -2
- package/drizzle/manage/0003_tiny_captain_universe.sql +8 -0
- package/drizzle/manage/0004_curious_phil_sheldon.sql +2 -0
- package/drizzle/manage/0005_silent_shatterstar.sql +53 -0
- package/drizzle/manage/0006_fixed_umar.sql +1 -0
- package/drizzle/manage/meta/0003_snapshot.json +3134 -0
- package/drizzle/manage/meta/0004_snapshot.json +3141 -0
- package/drizzle/manage/meta/0005_snapshot.json +3141 -0
- package/drizzle/manage/meta/0006_snapshot.json +3148 -0
- package/drizzle/manage/meta/_journal.json +28 -0
- package/drizzle/runtime/0010_previous_black_knight.sql +84 -0
- package/drizzle/runtime/meta/0010_snapshot.json +3066 -0
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +12 -5
- package/spicedb/schema.zed +114 -0
- package/dist/validation/id-validation.d.ts +0 -24
- package/dist/validation/id-validation.js +0 -52
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { projects, subAgentFunctionToolRelations, subAgentToolRelations, subAgents } from "../../db/manage/manage-schema.js";
|
|
2
|
-
import { generateId } from "../../utils/conversations.js";
|
|
3
2
|
import { validateAgentStructure, validateAndTypeAgentData } from "../../validation/agentFull.js";
|
|
3
|
+
import { generateId } from "../../utils/conversations.js";
|
|
4
4
|
import { upsertContextConfig } from "./contextConfigs.js";
|
|
5
5
|
import { upsertFunction } from "./functions.js";
|
|
6
6
|
import { deleteFunctionTool, listFunctionTools, upsertFunctionTool, upsertSubAgentFunctionToolRelation } from "./functionTools.js";
|
|
@@ -345,6 +345,7 @@ const createFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
|
|
|
345
345
|
},
|
|
346
346
|
subAgentId,
|
|
347
347
|
functionToolId: toolId,
|
|
348
|
+
toolPolicies,
|
|
348
349
|
relationId: agentToolRelationId
|
|
349
350
|
});
|
|
350
351
|
logger.info({
|
|
@@ -855,31 +856,33 @@ const updateFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
|
|
|
855
856
|
triggerCount: Object.keys(typedAgentDefinition.triggers).length
|
|
856
857
|
}, "All triggers updated successfully");
|
|
857
858
|
}
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
859
|
+
if (typedAgentDefinition.triggers !== void 0) {
|
|
860
|
+
const incomingTriggerIds = new Set(Object.keys(typedAgentDefinition.triggers));
|
|
861
|
+
const existingTriggers = await listTriggers(db)({ scopes: {
|
|
862
|
+
tenantId,
|
|
863
|
+
projectId,
|
|
864
|
+
agentId: finalAgentId
|
|
865
|
+
} });
|
|
866
|
+
let deletedTriggerCount = 0;
|
|
867
|
+
for (const trigger of existingTriggers) if (!incomingTriggerIds.has(trigger.id)) try {
|
|
868
|
+
await deleteTrigger(db)({
|
|
869
|
+
scopes: {
|
|
870
|
+
tenantId,
|
|
871
|
+
projectId,
|
|
872
|
+
agentId: finalAgentId
|
|
873
|
+
},
|
|
874
|
+
triggerId: trigger.id
|
|
875
|
+
});
|
|
876
|
+
deletedTriggerCount++;
|
|
877
|
+
logger.info({ triggerId: trigger.id }, "Deleted orphaned trigger");
|
|
878
|
+
} catch (error) {
|
|
879
|
+
logger.error({
|
|
880
|
+
triggerId: trigger.id,
|
|
881
|
+
error
|
|
882
|
+
}, "Failed to delete orphaned trigger");
|
|
883
|
+
}
|
|
884
|
+
if (deletedTriggerCount > 0) logger.info({ deletedTriggerCount }, "Deleted orphaned triggers from agent");
|
|
881
885
|
}
|
|
882
|
-
if (deletedTriggerCount > 0) logger.info({ deletedTriggerCount }, "Deleted orphaned triggers from agent");
|
|
883
886
|
const subAgentPromises = Object.entries(typedAgentDefinition.subAgents).map(async ([subAgentId, agentData$1]) => {
|
|
884
887
|
const subAgent = agentData$1;
|
|
885
888
|
let existingSubAgent = null;
|
|
@@ -937,6 +940,47 @@ const updateFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
|
|
|
937
940
|
await Promise.all(subAgentPromises);
|
|
938
941
|
const subAgentCount = Object.entries(typedAgentDefinition.subAgents).length;
|
|
939
942
|
logger.info({ subAgentCount }, "All sub-agents created/updated successfully");
|
|
943
|
+
const relinkToolRelationPromises = [];
|
|
944
|
+
for (const [subAgentId, agentData$1] of Object.entries(typedAgentDefinition.subAgents)) if (agentData$1.canUse && Array.isArray(agentData$1.canUse)) for (const canUseItem of agentData$1.canUse) {
|
|
945
|
+
if (!canUseItem.agentToolRelationId) continue;
|
|
946
|
+
relinkToolRelationPromises.push((async () => {
|
|
947
|
+
try {
|
|
948
|
+
const { toolId, toolSelection, headers, toolPolicies, agentToolRelationId } = canUseItem;
|
|
949
|
+
if (typedAgentDefinition.functionTools && toolId in typedAgentDefinition.functionTools) await upsertSubAgentFunctionToolRelation(db)({
|
|
950
|
+
scopes: {
|
|
951
|
+
tenantId,
|
|
952
|
+
projectId,
|
|
953
|
+
agentId: finalAgentId
|
|
954
|
+
},
|
|
955
|
+
subAgentId,
|
|
956
|
+
functionToolId: toolId,
|
|
957
|
+
toolPolicies,
|
|
958
|
+
relationId: agentToolRelationId
|
|
959
|
+
});
|
|
960
|
+
else await upsertSubAgentToolRelation(db)({
|
|
961
|
+
scopes: {
|
|
962
|
+
tenantId,
|
|
963
|
+
projectId,
|
|
964
|
+
agentId: finalAgentId
|
|
965
|
+
},
|
|
966
|
+
subAgentId,
|
|
967
|
+
toolId,
|
|
968
|
+
selectedTools: toolSelection,
|
|
969
|
+
headers,
|
|
970
|
+
toolPolicies,
|
|
971
|
+
relationId: agentToolRelationId
|
|
972
|
+
});
|
|
973
|
+
} catch (error) {
|
|
974
|
+
logger.error({
|
|
975
|
+
subAgentId,
|
|
976
|
+
relationId: canUseItem.agentToolRelationId,
|
|
977
|
+
toolId: canUseItem.toolId,
|
|
978
|
+
error
|
|
979
|
+
}, "Failed to relink tool relation during sub-agent update");
|
|
980
|
+
}
|
|
981
|
+
})());
|
|
982
|
+
}
|
|
983
|
+
if (relinkToolRelationPromises.length > 0) await Promise.all(relinkToolRelationPromises);
|
|
940
984
|
logger.info({}, "External agents are project-scoped and managed at the project level.");
|
|
941
985
|
const incomingSubAgentIds = new Set(Object.keys(typedAgentDefinition.subAgents));
|
|
942
986
|
const existingSubAgents = await listSubAgents(db)({ scopes: {
|
|
@@ -1090,6 +1134,7 @@ const updateFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
|
|
|
1090
1134
|
},
|
|
1091
1135
|
subAgentId,
|
|
1092
1136
|
functionToolId: toolId,
|
|
1137
|
+
toolPolicies,
|
|
1093
1138
|
relationId: agentToolRelationId
|
|
1094
1139
|
});
|
|
1095
1140
|
logger.info({
|
|
@@ -8,14 +8,15 @@ import { PgTable } from "drizzle-orm/pg-core";
|
|
|
8
8
|
declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
9
9
|
scopes: AgentScopeConfig;
|
|
10
10
|
}) => Promise<{
|
|
11
|
-
tenantId: string;
|
|
12
|
-
projectId: string;
|
|
13
11
|
id: string;
|
|
14
12
|
name: string;
|
|
15
|
-
description: string | null;
|
|
16
|
-
prompt: string | null;
|
|
17
13
|
createdAt: string;
|
|
18
14
|
updatedAt: string;
|
|
15
|
+
description: string | null;
|
|
16
|
+
projectId: string;
|
|
17
|
+
tenantId: string;
|
|
18
|
+
defaultSubAgentId: string | null;
|
|
19
|
+
contextConfigId: string | null;
|
|
19
20
|
models: {
|
|
20
21
|
base?: {
|
|
21
22
|
model?: string | undefined;
|
|
@@ -30,11 +31,7 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
30
31
|
providerOptions?: Record<string, any> | undefined;
|
|
31
32
|
} | undefined;
|
|
32
33
|
} | null;
|
|
33
|
-
|
|
34
|
-
transferCountIs?: number | undefined;
|
|
35
|
-
} | null;
|
|
36
|
-
defaultSubAgentId: string | null;
|
|
37
|
-
contextConfigId: string | null;
|
|
34
|
+
prompt: string | null;
|
|
38
35
|
statusUpdates: {
|
|
39
36
|
enabled?: boolean | undefined;
|
|
40
37
|
numEvents?: number | undefined;
|
|
@@ -50,18 +47,22 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
50
47
|
} | undefined;
|
|
51
48
|
}[] | undefined;
|
|
52
49
|
} | null;
|
|
50
|
+
stopWhen: {
|
|
51
|
+
transferCountIs?: number | undefined;
|
|
52
|
+
} | null;
|
|
53
53
|
} | null>;
|
|
54
54
|
declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
55
55
|
scopes: AgentScopeConfig;
|
|
56
56
|
}) => Promise<{
|
|
57
|
-
tenantId: string;
|
|
58
|
-
projectId: string;
|
|
59
57
|
id: string;
|
|
60
58
|
name: string;
|
|
61
|
-
description: string | null;
|
|
62
|
-
prompt: string | null;
|
|
63
59
|
createdAt: string;
|
|
64
60
|
updatedAt: string;
|
|
61
|
+
description: string | null;
|
|
62
|
+
projectId: string;
|
|
63
|
+
tenantId: string;
|
|
64
|
+
defaultSubAgentId: string | null;
|
|
65
|
+
contextConfigId: string | null;
|
|
65
66
|
models: {
|
|
66
67
|
base?: {
|
|
67
68
|
model?: string | undefined;
|
|
@@ -76,11 +77,7 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
76
77
|
providerOptions?: Record<string, any> | undefined;
|
|
77
78
|
} | undefined;
|
|
78
79
|
} | null;
|
|
79
|
-
|
|
80
|
-
transferCountIs?: number | undefined;
|
|
81
|
-
} | null;
|
|
82
|
-
defaultSubAgentId: string | null;
|
|
83
|
-
contextConfigId: string | null;
|
|
80
|
+
prompt: string | null;
|
|
84
81
|
statusUpdates: {
|
|
85
82
|
enabled?: boolean | undefined;
|
|
86
83
|
numEvents?: number | undefined;
|
|
@@ -96,16 +93,18 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
96
93
|
} | undefined;
|
|
97
94
|
}[] | undefined;
|
|
98
95
|
} | null;
|
|
96
|
+
stopWhen: {
|
|
97
|
+
transferCountIs?: number | undefined;
|
|
98
|
+
} | null;
|
|
99
99
|
defaultSubAgent: {
|
|
100
|
-
tenantId: string;
|
|
101
|
-
projectId: string;
|
|
102
100
|
id: string;
|
|
103
101
|
name: string;
|
|
104
|
-
description: string | null;
|
|
105
|
-
prompt: string | null;
|
|
106
|
-
agentId: string;
|
|
107
102
|
createdAt: string;
|
|
108
103
|
updatedAt: string;
|
|
104
|
+
description: string | null;
|
|
105
|
+
agentId: string;
|
|
106
|
+
projectId: string;
|
|
107
|
+
tenantId: string;
|
|
109
108
|
models: {
|
|
110
109
|
base?: {
|
|
111
110
|
model?: string | undefined;
|
|
@@ -120,6 +119,7 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
120
119
|
providerOptions?: Record<string, any> | undefined;
|
|
121
120
|
} | undefined;
|
|
122
121
|
} | null;
|
|
122
|
+
prompt: string | null;
|
|
123
123
|
stopWhen: {
|
|
124
124
|
stepCountIs?: number | undefined;
|
|
125
125
|
} | null;
|
|
@@ -129,14 +129,15 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
129
129
|
declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
130
130
|
scopes: ProjectScopeConfig;
|
|
131
131
|
}) => Promise<{
|
|
132
|
-
tenantId: string;
|
|
133
|
-
projectId: string;
|
|
134
132
|
id: string;
|
|
135
133
|
name: string;
|
|
136
|
-
description: string | null;
|
|
137
|
-
prompt: string | null;
|
|
138
134
|
createdAt: string;
|
|
139
135
|
updatedAt: string;
|
|
136
|
+
description: string | null;
|
|
137
|
+
projectId: string;
|
|
138
|
+
tenantId: string;
|
|
139
|
+
defaultSubAgentId: string | null;
|
|
140
|
+
contextConfigId: string | null;
|
|
140
141
|
models: {
|
|
141
142
|
base?: {
|
|
142
143
|
model?: string | undefined;
|
|
@@ -151,11 +152,7 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
151
152
|
providerOptions?: Record<string, any> | undefined;
|
|
152
153
|
} | undefined;
|
|
153
154
|
} | null;
|
|
154
|
-
|
|
155
|
-
transferCountIs?: number | undefined;
|
|
156
|
-
} | null;
|
|
157
|
-
defaultSubAgentId: string | null;
|
|
158
|
-
contextConfigId: string | null;
|
|
155
|
+
prompt: string | null;
|
|
159
156
|
statusUpdates: {
|
|
160
157
|
enabled?: boolean | undefined;
|
|
161
158
|
numEvents?: number | undefined;
|
|
@@ -171,6 +168,9 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
171
168
|
} | undefined;
|
|
172
169
|
}[] | undefined;
|
|
173
170
|
} | null;
|
|
171
|
+
stopWhen: {
|
|
172
|
+
transferCountIs?: number | undefined;
|
|
173
|
+
} | null;
|
|
174
174
|
}[]>;
|
|
175
175
|
declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
|
|
176
176
|
scopes: ProjectScopeConfig;
|
|
@@ -228,14 +228,15 @@ declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params:
|
|
|
228
228
|
};
|
|
229
229
|
}>;
|
|
230
230
|
declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInsert) => Promise<{
|
|
231
|
-
tenantId: string;
|
|
232
|
-
projectId: string;
|
|
233
231
|
id: string;
|
|
234
232
|
name: string;
|
|
235
|
-
description: string | null;
|
|
236
|
-
prompt: string | null;
|
|
237
233
|
createdAt: string;
|
|
238
234
|
updatedAt: string;
|
|
235
|
+
description: string | null;
|
|
236
|
+
projectId: string;
|
|
237
|
+
tenantId: string;
|
|
238
|
+
defaultSubAgentId: string | null;
|
|
239
|
+
contextConfigId: string | null;
|
|
239
240
|
models: {
|
|
240
241
|
base?: {
|
|
241
242
|
model?: string | undefined;
|
|
@@ -250,11 +251,7 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
|
|
|
250
251
|
providerOptions?: Record<string, any> | undefined;
|
|
251
252
|
} | undefined;
|
|
252
253
|
} | null;
|
|
253
|
-
|
|
254
|
-
transferCountIs?: number | undefined;
|
|
255
|
-
} | null;
|
|
256
|
-
defaultSubAgentId: string | null;
|
|
257
|
-
contextConfigId: string | null;
|
|
254
|
+
prompt: string | null;
|
|
258
255
|
statusUpdates: {
|
|
259
256
|
enabled?: boolean | undefined;
|
|
260
257
|
numEvents?: number | undefined;
|
|
@@ -270,6 +267,9 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
|
|
|
270
267
|
} | undefined;
|
|
271
268
|
}[] | undefined;
|
|
272
269
|
} | null;
|
|
270
|
+
stopWhen: {
|
|
271
|
+
transferCountIs?: number | undefined;
|
|
272
|
+
} | null;
|
|
273
273
|
}>;
|
|
274
274
|
declare const updateAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
275
275
|
scopes: AgentScopeConfig;
|
|
@@ -198,7 +198,8 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
|
|
|
198
198
|
tenantId: functionTools.tenantId,
|
|
199
199
|
projectId: functionTools.projectId,
|
|
200
200
|
agentId: functionTools.agentId,
|
|
201
|
-
agentToolRelationId: subAgentFunctionToolRelations.id
|
|
201
|
+
agentToolRelationId: subAgentFunctionToolRelations.id,
|
|
202
|
+
toolPolicies: subAgentFunctionToolRelations.toolPolicies
|
|
202
203
|
}).from(subAgentFunctionToolRelations).innerJoin(functionTools, and(eq(subAgentFunctionToolRelations.functionToolId, functionTools.id), eq(subAgentFunctionToolRelations.tenantId, functionTools.tenantId), eq(subAgentFunctionToolRelations.projectId, functionTools.projectId), eq(subAgentFunctionToolRelations.agentId, functionTools.agentId))).where(and(eq(subAgentFunctionToolRelations.tenantId, tenantId), eq(subAgentFunctionToolRelations.projectId, projectId), eq(subAgentFunctionToolRelations.agentId, agentId), eq(subAgentFunctionToolRelations.subAgentId, agent$1.id)));
|
|
203
204
|
const agentDataComponentIds = (await db.query.subAgentDataComponents.findMany({ where: and(eq(subAgentDataComponents.tenantId, tenantId), eq(subAgentDataComponents.subAgentId, agent$1.id)) })).map((rel) => rel.dataComponentId);
|
|
204
205
|
const agentArtifactComponentIds = (await db.query.subAgentArtifactComponents.findMany({ where: and(eq(subAgentArtifactComponents.tenantId, tenantId), eq(subAgentArtifactComponents.subAgentId, agent$1.id)) })).map((rel) => rel.artifactComponentId);
|
|
@@ -214,7 +215,7 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
|
|
|
214
215
|
toolId: tool.id,
|
|
215
216
|
toolSelection: null,
|
|
216
217
|
headers: null,
|
|
217
|
-
toolPolicies: null
|
|
218
|
+
toolPolicies: tool.toolPolicies || null
|
|
218
219
|
}));
|
|
219
220
|
const canUse = [...mcpToolCanUse, ...functionToolCanUse];
|
|
220
221
|
return {
|
|
@@ -389,25 +390,31 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
|
|
|
389
390
|
console.warn("Failed to apply agent stepCountIs inheritance:", error);
|
|
390
391
|
}
|
|
391
392
|
try {
|
|
392
|
-
const
|
|
393
|
-
scopes: {
|
|
394
|
-
tenantId,
|
|
395
|
-
projectId
|
|
396
|
-
},
|
|
397
|
-
pagination: {
|
|
398
|
-
page: 1,
|
|
399
|
-
limit: 1e3
|
|
400
|
-
}
|
|
401
|
-
});
|
|
393
|
+
const usedToolIds = new Set(Object.values(agentsObject).flatMap((a) => Array.isArray(a?.canUse) ? a.canUse : []).map((ref) => ref?.toolId).filter(Boolean));
|
|
402
394
|
const toolsObject = {};
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
395
|
+
if (usedToolIds.size > 0) {
|
|
396
|
+
const { data } = await listTools(db)({
|
|
397
|
+
scopes: {
|
|
398
|
+
tenantId,
|
|
399
|
+
projectId
|
|
400
|
+
},
|
|
401
|
+
pagination: {
|
|
402
|
+
page: 1,
|
|
403
|
+
limit: 1e3
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
for (const tool of data) {
|
|
407
|
+
if (!usedToolIds.has(tool.id)) continue;
|
|
408
|
+
toolsObject[tool.id] = {
|
|
409
|
+
id: tool.id,
|
|
410
|
+
name: tool.name,
|
|
411
|
+
description: tool.description,
|
|
412
|
+
config: tool.config,
|
|
413
|
+
credentialReferenceId: tool.credentialReferenceId,
|
|
414
|
+
imageUrl: tool.imageUrl
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
}
|
|
411
418
|
result.tools = toolsObject;
|
|
412
419
|
const functionToolsList = await listFunctionTools(db)({
|
|
413
420
|
scopes: {
|
|
@@ -469,7 +476,8 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
|
|
|
469
476
|
outputTransform: trigger.outputTransform,
|
|
470
477
|
messageTemplate: trigger.messageTemplate,
|
|
471
478
|
authentication: trigger.authentication,
|
|
472
|
-
|
|
479
|
+
signingSecretCredentialReferenceId: trigger.signingSecretCredentialReferenceId,
|
|
480
|
+
signatureVerification: trigger.signatureVerification
|
|
473
481
|
};
|
|
474
482
|
result.triggers = triggersObject;
|
|
475
483
|
console.log(`[getFullAgentDefinitionInternal] Added triggers to result:`, Object.keys(triggersObject));
|
|
@@ -7,13 +7,13 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
|
|
|
7
7
|
scopes: ProjectScopeConfig;
|
|
8
8
|
id: string;
|
|
9
9
|
}) => Promise<{
|
|
10
|
-
tenantId: string;
|
|
11
|
-
projectId: string;
|
|
12
10
|
id: string;
|
|
13
11
|
name: string;
|
|
14
|
-
description: string | null;
|
|
15
12
|
createdAt: string;
|
|
16
13
|
updatedAt: string;
|
|
14
|
+
description: string | null;
|
|
15
|
+
projectId: string;
|
|
16
|
+
tenantId: string;
|
|
17
17
|
props: Record<string, unknown> | null;
|
|
18
18
|
render: {
|
|
19
19
|
component: string;
|
|
@@ -49,13 +49,13 @@ declare const listArtifactComponentsPaginated: (db: AgentsManageDatabaseClient)
|
|
|
49
49
|
};
|
|
50
50
|
}>;
|
|
51
51
|
declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
|
|
52
|
-
tenantId: string;
|
|
53
|
-
projectId: string;
|
|
54
52
|
id: string;
|
|
55
53
|
name: string;
|
|
56
|
-
description: string | null;
|
|
57
54
|
createdAt: string;
|
|
58
55
|
updatedAt: string;
|
|
56
|
+
description: string | null;
|
|
57
|
+
projectId: string;
|
|
58
|
+
tenantId: string;
|
|
59
59
|
props: Record<string, unknown> | null;
|
|
60
60
|
render: {
|
|
61
61
|
component: string;
|
|
@@ -104,11 +104,11 @@ declare const associateArtifactComponentWithAgent: (db: AgentsManageDatabaseClie
|
|
|
104
104
|
scopes: SubAgentScopeConfig;
|
|
105
105
|
artifactComponentId: string;
|
|
106
106
|
}) => Promise<{
|
|
107
|
-
tenantId: string;
|
|
108
|
-
projectId: string;
|
|
109
107
|
id: string;
|
|
110
|
-
agentId: string;
|
|
111
108
|
createdAt: string;
|
|
109
|
+
agentId: string;
|
|
110
|
+
projectId: string;
|
|
111
|
+
tenantId: string;
|
|
112
112
|
subAgentId: string;
|
|
113
113
|
artifactComponentId: string;
|
|
114
114
|
}>;
|
|
@@ -147,11 +147,11 @@ declare const upsertAgentArtifactComponentRelation: (db: AgentsManageDatabaseCli
|
|
|
147
147
|
scopes: SubAgentScopeConfig;
|
|
148
148
|
artifactComponentId: string;
|
|
149
149
|
}) => Promise<{
|
|
150
|
-
tenantId: string;
|
|
151
|
-
projectId: string;
|
|
152
150
|
id: string;
|
|
153
|
-
agentId: string;
|
|
154
151
|
createdAt: string;
|
|
152
|
+
agentId: string;
|
|
153
|
+
projectId: string;
|
|
154
|
+
tenantId: string;
|
|
155
155
|
subAgentId: string;
|
|
156
156
|
artifactComponentId: string;
|
|
157
157
|
} | null>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { artifactComponents, subAgentArtifactComponents, subAgentRelations, subAgents } from "../../db/manage/manage-schema.js";
|
|
2
2
|
import { validatePropsAsJsonSchema } from "../../validation/props-validation.js";
|
|
3
|
-
import { generateId } from "../../utils/conversations.js";
|
|
4
3
|
import { validateRender } from "../../validation/render-validation.js";
|
|
4
|
+
import { generateId } from "../../utils/conversations.js";
|
|
5
5
|
import { and, count, desc, eq } from "drizzle-orm";
|
|
6
6
|
|
|
7
7
|
//#region src/data-access/manage/artifactComponents.ts
|
|
@@ -8,26 +8,26 @@ declare const getContextConfigById: (db: AgentsManageDatabaseClient) => (params:
|
|
|
8
8
|
scopes: AgentScopeConfig;
|
|
9
9
|
id: string;
|
|
10
10
|
}) => Promise<{
|
|
11
|
-
tenantId: string;
|
|
12
|
-
projectId: string;
|
|
13
11
|
id: string;
|
|
14
|
-
agentId: string;
|
|
15
12
|
createdAt: string;
|
|
16
13
|
updatedAt: string;
|
|
17
14
|
headersSchema: unknown;
|
|
18
15
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
16
|
+
agentId: string;
|
|
17
|
+
projectId: string;
|
|
18
|
+
tenantId: string;
|
|
19
19
|
} | undefined>;
|
|
20
20
|
declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
|
|
21
21
|
scopes: AgentScopeConfig;
|
|
22
22
|
}) => Promise<{
|
|
23
|
-
tenantId: string;
|
|
24
|
-
projectId: string;
|
|
25
23
|
id: string;
|
|
26
|
-
agentId: string;
|
|
27
24
|
createdAt: string;
|
|
28
25
|
updatedAt: string;
|
|
29
26
|
headersSchema: unknown;
|
|
30
27
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
28
|
+
agentId: string;
|
|
29
|
+
projectId: string;
|
|
30
|
+
tenantId: string;
|
|
31
31
|
}[]>;
|
|
32
32
|
declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (params: {
|
|
33
33
|
scopes: AgentScopeConfig;
|
|
@@ -42,14 +42,14 @@ declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (
|
|
|
42
42
|
};
|
|
43
43
|
}>;
|
|
44
44
|
declare const createContextConfig: (db: AgentsManageDatabaseClient) => (params: ContextConfigInsert) => Promise<{
|
|
45
|
-
tenantId: string;
|
|
46
|
-
projectId: string;
|
|
47
45
|
id: string;
|
|
48
|
-
agentId: string;
|
|
49
46
|
createdAt: string;
|
|
50
47
|
updatedAt: string;
|
|
51
48
|
headersSchema: unknown;
|
|
52
49
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
50
|
+
agentId: string;
|
|
51
|
+
projectId: string;
|
|
52
|
+
tenantId: string;
|
|
53
53
|
}>;
|
|
54
54
|
declare const updateContextConfig: (db: AgentsManageDatabaseClient) => (params: {
|
|
55
55
|
scopes: AgentScopeConfig;
|
|
@@ -82,14 +82,14 @@ declare const countContextConfigs: (db: AgentsManageDatabaseClient) => (params:
|
|
|
82
82
|
declare const upsertContextConfig: (db: AgentsManageDatabaseClient) => (params: {
|
|
83
83
|
data: ContextConfigInsert;
|
|
84
84
|
}) => Promise<{
|
|
85
|
-
tenantId: string;
|
|
86
|
-
projectId: string;
|
|
87
85
|
id: string;
|
|
88
|
-
agentId: string;
|
|
89
86
|
createdAt: string;
|
|
90
87
|
updatedAt: string;
|
|
91
88
|
headersSchema: unknown;
|
|
92
89
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
90
|
+
agentId: string;
|
|
91
|
+
projectId: string;
|
|
92
|
+
tenantId: string;
|
|
93
93
|
}>;
|
|
94
94
|
//#endregion
|
|
95
95
|
export { countContextConfigs, createContextConfig, deleteContextConfig, getContextConfigById, hasContextConfig, listContextConfigs, listContextConfigsPaginated, updateContextConfig, upsertContextConfig };
|
|
@@ -64,11 +64,11 @@ declare const associateDataComponentWithAgent: (db: AgentsManageDatabaseClient)
|
|
|
64
64
|
scopes: SubAgentScopeConfig;
|
|
65
65
|
dataComponentId: string;
|
|
66
66
|
}) => Promise<{
|
|
67
|
-
tenantId: string;
|
|
68
|
-
projectId: string;
|
|
69
67
|
id: string;
|
|
70
|
-
agentId: string;
|
|
71
68
|
createdAt: string;
|
|
69
|
+
agentId: string;
|
|
70
|
+
projectId: string;
|
|
71
|
+
tenantId: string;
|
|
72
72
|
subAgentId: string;
|
|
73
73
|
dataComponentId: string;
|
|
74
74
|
}>;
|
|
@@ -106,11 +106,11 @@ declare const upsertAgentDataComponentRelation: (db: AgentsManageDatabaseClient)
|
|
|
106
106
|
scopes: SubAgentScopeConfig;
|
|
107
107
|
dataComponentId: string;
|
|
108
108
|
}) => Promise<{
|
|
109
|
-
tenantId: string;
|
|
110
|
-
projectId: string;
|
|
111
109
|
id: string;
|
|
112
|
-
agentId: string;
|
|
113
110
|
createdAt: string;
|
|
111
|
+
agentId: string;
|
|
112
|
+
projectId: string;
|
|
113
|
+
tenantId: string;
|
|
114
114
|
subAgentId: string;
|
|
115
115
|
dataComponentId: string;
|
|
116
116
|
} | null>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { dataComponents, subAgentDataComponents } from "../../db/manage/manage-schema.js";
|
|
2
2
|
import { validatePropsAsJsonSchema } from "../../validation/props-validation.js";
|
|
3
|
+
import { validateRender } from "../../validation/render-validation.js";
|
|
3
4
|
import { generateId } from "../../utils/conversations.js";
|
|
4
5
|
import { createApiError } from "../../utils/error.js";
|
|
5
6
|
import "../../utils/index.js";
|
|
6
|
-
import { validateRender } from "../../validation/render-validation.js";
|
|
7
7
|
import { and, count, desc, eq } from "drizzle-orm";
|
|
8
8
|
|
|
9
9
|
//#region src/data-access/manage/dataComponents.ts
|