@inkeep/agents-core 0.24.1 → 0.25.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/{chunk-5B6IOJZY.js → chunk-ALZI4IXB.js} +57 -17
- package/dist/{chunk-ZGJI6UNK.js → chunk-HMVAAUTK.js} +42 -23
- package/dist/{chunk-HN77JIDP.js → chunk-NXC2HZQL.js} +46 -13
- package/dist/client-exports.cjs +99 -36
- package/dist/client-exports.d.cts +7 -11
- package/dist/client-exports.d.ts +7 -11
- package/dist/client-exports.js +3 -11
- package/dist/db/schema.cjs +56 -16
- package/dist/db/schema.d.cts +2 -2
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.js +1 -1
- package/dist/index.cjs +1069 -592
- package/dist/index.d.cts +276 -86
- package/dist/index.d.ts +276 -86
- package/dist/index.js +910 -544
- package/dist/{schema-PgBNwsV-.d.ts → schema-CDKDLrBu.d.ts} +188 -62
- package/dist/{schema-B8NMPwEM.d.cts → schema-P1kG10Kn.d.cts} +188 -62
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/{utility-mGrlR4Ta.d.cts → utility-CWjvUL4k.d.cts} +329 -71
- package/dist/{utility-mGrlR4Ta.d.ts → utility-CWjvUL4k.d.ts} +329 -71
- package/dist/validation/index.cjs +146 -50
- package/dist/validation/index.d.cts +5 -5
- package/dist/validation/index.d.ts +5 -5
- package/dist/validation/index.js +2 -2
- package/drizzle/0011_slippery_korg.sql +36 -0
- package/drizzle/meta/0011_snapshot.json +2849 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ export { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from './chunk-MQTANAMG
|
|
|
4
4
|
export { TaskState } from './chunk-H2F72PDA.js';
|
|
5
5
|
import { getLogger, convertZodToJsonSchema } from './chunk-YECQCT5N.js';
|
|
6
6
|
export { PinoLogger, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, getLogger, isZodSchema, loggerFactory, preview } from './chunk-YECQCT5N.js';
|
|
7
|
-
import { validatePreview, validateAndTypeAgentData, validateAgentStructure
|
|
8
|
-
export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName,
|
|
9
|
-
import { ContextConfigApiUpdateSchema, validatePropsAsJsonSchema } from './chunk-
|
|
10
|
-
export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentInsertSchema, AgentListResponse, AgentResponse, AgentSelectSchema, AgentStopWhenSchema, AgentUpdateSchema, AgentWithinContextOfProjectSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeyListResponse, ApiKeyResponse, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentListResponse, ArtifactComponentResponse, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigListResponse, ContextConfigResponse, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationListResponse, ConversationResponse, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceListResponse, CredentialReferenceResponse, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentListResponse, DataComponentResponse, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentListResponse, ExternalAgentResponse, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, ExternalSubAgentRelationApiInsertSchema, ExternalSubAgentRelationInsertSchema, FetchConfigSchema, FetchDefinitionSchema, FullAgentAgentInsertSchema, FullProjectDefinitionSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, FunctionInsertSchema, FunctionListResponse, FunctionResponse, FunctionSelectSchema, FunctionToolApiInsertSchema, FunctionToolApiSelectSchema, FunctionToolApiUpdateSchema, FunctionToolConfigSchema, FunctionToolInsertSchema, FunctionToolListResponse, FunctionToolResponse, FunctionToolSelectSchema, FunctionToolUpdateSchema, FunctionUpdateSchema, HeadersScopeSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageListResponse, MessageResponse, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectListResponse, ProjectModelSchema, ProjectResponse, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, SubAgentApiInsertSchema, SubAgentApiSelectSchema, SubAgentApiUpdateSchema, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiSelectSchema, SubAgentArtifactComponentApiUpdateSchema, SubAgentArtifactComponentInsertSchema, SubAgentArtifactComponentListResponse, SubAgentArtifactComponentResponse, SubAgentArtifactComponentSelectSchema, SubAgentArtifactComponentUpdateSchema, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiSelectSchema, SubAgentDataComponentApiUpdateSchema, SubAgentDataComponentInsertSchema, SubAgentDataComponentListResponse, SubAgentDataComponentResponse, SubAgentDataComponentSelectSchema, SubAgentDataComponentUpdateSchema, SubAgentInsertSchema, SubAgentListResponse, SubAgentRelationApiInsertSchema, SubAgentRelationApiSelectSchema, SubAgentRelationApiUpdateSchema, SubAgentRelationInsertSchema, SubAgentRelationListResponse, SubAgentRelationQuerySchema, SubAgentRelationResponse, SubAgentRelationSelectSchema, SubAgentRelationUpdateSchema, SubAgentResponse, SubAgentSelectSchema, SubAgentStopWhenSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiSelectSchema, SubAgentToolRelationApiUpdateSchema, SubAgentToolRelationInsertSchema, SubAgentToolRelationListResponse, SubAgentToolRelationResponse, SubAgentToolRelationSelectSchema, SubAgentToolRelationUpdateSchema, SubAgentUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, TenantProjectAgentSubAgentIdParamsSchema, TenantProjectAgentSubAgentParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolListResponse, ToolResponse, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema, validatePropsAsJsonSchema } from './chunk-
|
|
11
|
-
import { schema_exports, contextConfigs, externalAgents, functions, functionTools, subAgentFunctionToolRelations,
|
|
12
|
-
export { agentRelations, agentToolRelationsRelations, agents, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, functionTools, functionToolsRelations, functions, functionsRelations, ledgerArtifacts, ledgerArtifactsRelations, messages, messagesRelations, projects, projectsRelations, subAgentArtifactComponents, subAgentArtifactComponentsRelations, subAgentDataComponents, subAgentDataComponentsRelations, subAgentFunctionToolRelations, subAgentFunctionToolRelationsRelations, subAgentRelations, subAgentRelationsRelations, subAgentToolRelations, subAgents, subAgentsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-
|
|
7
|
+
import { validatePreview, validateAndTypeAgentData, validateAgentStructure } from './chunk-HMVAAUTK.js';
|
|
8
|
+
export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validatePreview, validateSubAgentExternalAgentRelations, validateToolReferences } from './chunk-HMVAAUTK.js';
|
|
9
|
+
import { ContextConfigApiUpdateSchema, validatePropsAsJsonSchema } from './chunk-NXC2HZQL.js';
|
|
10
|
+
export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentInsertSchema, AgentListResponse, AgentResponse, AgentSelectSchema, AgentStopWhenSchema, AgentUpdateSchema, AgentWithinContextOfProjectSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeyListResponse, ApiKeyResponse, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentListResponse, ArtifactComponentResponse, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigListResponse, ContextConfigResponse, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationListResponse, ConversationResponse, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceListResponse, CredentialReferenceResponse, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentListResponse, DataComponentResponse, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentListResponse, ExternalAgentResponse, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, ExternalSubAgentRelationApiInsertSchema, ExternalSubAgentRelationInsertSchema, FetchConfigSchema, FetchDefinitionSchema, FullAgentAgentInsertSchema, FullProjectDefinitionSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, FunctionInsertSchema, FunctionListResponse, FunctionResponse, FunctionSelectSchema, FunctionToolApiInsertSchema, FunctionToolApiSelectSchema, FunctionToolApiUpdateSchema, FunctionToolConfigSchema, FunctionToolInsertSchema, FunctionToolListResponse, FunctionToolResponse, FunctionToolSelectSchema, FunctionToolUpdateSchema, FunctionUpdateSchema, HeadersScopeSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageListResponse, MessageResponse, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectListResponse, ProjectModelSchema, ProjectResponse, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, SubAgentApiInsertSchema, SubAgentApiSelectSchema, SubAgentApiUpdateSchema, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiSelectSchema, SubAgentArtifactComponentApiUpdateSchema, SubAgentArtifactComponentInsertSchema, SubAgentArtifactComponentListResponse, SubAgentArtifactComponentResponse, SubAgentArtifactComponentSelectSchema, SubAgentArtifactComponentUpdateSchema, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiSelectSchema, SubAgentDataComponentApiUpdateSchema, SubAgentDataComponentInsertSchema, SubAgentDataComponentListResponse, SubAgentDataComponentResponse, SubAgentDataComponentSelectSchema, SubAgentDataComponentUpdateSchema, SubAgentExternalAgentRelationApiInsertSchema, SubAgentExternalAgentRelationApiSelectSchema, SubAgentExternalAgentRelationApiUpdateSchema, SubAgentExternalAgentRelationInsertSchema, SubAgentExternalAgentRelationSelectSchema, SubAgentExternalAgentRelationUpdateSchema, SubAgentInsertSchema, SubAgentListResponse, SubAgentRelationApiInsertSchema, SubAgentRelationApiSelectSchema, SubAgentRelationApiUpdateSchema, SubAgentRelationInsertSchema, SubAgentRelationListResponse, SubAgentRelationQuerySchema, SubAgentRelationResponse, SubAgentRelationSelectSchema, SubAgentRelationUpdateSchema, SubAgentResponse, SubAgentSelectSchema, SubAgentStopWhenSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiSelectSchema, SubAgentToolRelationApiUpdateSchema, SubAgentToolRelationInsertSchema, SubAgentToolRelationListResponse, SubAgentToolRelationResponse, SubAgentToolRelationSelectSchema, SubAgentToolRelationUpdateSchema, SubAgentUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, TenantProjectAgentSubAgentIdParamsSchema, TenantProjectAgentSubAgentParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolListResponse, ToolResponse, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, canDelegateToExternalAgentSchema, resourceIdSchema, validatePropsAsJsonSchema } from './chunk-NXC2HZQL.js';
|
|
11
|
+
import { schema_exports, contextConfigs, externalAgents, functions, functionTools, subAgentFunctionToolRelations, subAgentExternalAgentRelations, subAgents, subAgentRelations, subAgentToolRelations, tools, credentialReferences, agents, subAgentDataComponents, subAgentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, ledgerArtifacts, tasks, taskRelations } from './chunk-ALZI4IXB.js';
|
|
12
|
+
export { agentRelations, agentToolRelationsRelations, agents, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, functionTools, functionToolsRelations, functions, functionsRelations, ledgerArtifacts, ledgerArtifactsRelations, messages, messagesRelations, projects, projectsRelations, subAgentArtifactComponents, subAgentArtifactComponentsRelations, subAgentDataComponents, subAgentDataComponentsRelations, subAgentExternalAgentRelations, subAgentExternalAgentRelationsRelations, subAgentFunctionToolRelations, subAgentFunctionToolRelationsRelations, subAgentRelations, subAgentRelationsRelations, subAgentToolRelations, subAgents, subAgentsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-ALZI4IXB.js';
|
|
13
13
|
import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-YFHT5M2R.js';
|
|
14
14
|
export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-YFHT5M2R.js';
|
|
15
15
|
import { __commonJS, __require, __publicField } from './chunk-E6R6PML7.js';
|
|
@@ -2497,7 +2497,7 @@ var require_typescript = __commonJS({
|
|
|
2497
2497
|
affectsEmitOptionDeclarations: () => affectsEmitOptionDeclarations,
|
|
2498
2498
|
allKeysStartWithDot: () => allKeysStartWithDot,
|
|
2499
2499
|
altDirectorySeparator: () => altDirectorySeparator,
|
|
2500
|
-
and: () =>
|
|
2500
|
+
and: () => and21,
|
|
2501
2501
|
append: () => append,
|
|
2502
2502
|
appendIfUnique: () => appendIfUnique,
|
|
2503
2503
|
arrayFrom: () => arrayFrom,
|
|
@@ -4719,16 +4719,16 @@ var require_typescript = __commonJS({
|
|
|
4719
4719
|
return -1;
|
|
4720
4720
|
}
|
|
4721
4721
|
function countWhere(array, predicate) {
|
|
4722
|
-
let
|
|
4722
|
+
let count17 = 0;
|
|
4723
4723
|
if (array !== void 0) {
|
|
4724
4724
|
for (let i = 0; i < array.length; i++) {
|
|
4725
4725
|
const v = array[i];
|
|
4726
4726
|
if (predicate(v, i)) {
|
|
4727
|
-
|
|
4727
|
+
count17++;
|
|
4728
4728
|
}
|
|
4729
4729
|
}
|
|
4730
4730
|
}
|
|
4731
|
-
return
|
|
4731
|
+
return count17;
|
|
4732
4732
|
}
|
|
4733
4733
|
function filter(array, f) {
|
|
4734
4734
|
if (array !== void 0) {
|
|
@@ -5281,12 +5281,12 @@ var require_typescript = __commonJS({
|
|
|
5281
5281
|
}
|
|
5282
5282
|
return ~low;
|
|
5283
5283
|
}
|
|
5284
|
-
function reduceLeft(array, f, initial, start,
|
|
5284
|
+
function reduceLeft(array, f, initial, start, count17) {
|
|
5285
5285
|
if (array && array.length > 0) {
|
|
5286
5286
|
const size = array.length;
|
|
5287
5287
|
if (size > 0) {
|
|
5288
5288
|
let pos = start === void 0 || start < 0 ? 0 : start;
|
|
5289
|
-
const end =
|
|
5289
|
+
const end = count17 === void 0 || pos + count17 > size - 1 ? size - 1 : pos + count17;
|
|
5290
5290
|
let result;
|
|
5291
5291
|
if (arguments.length <= 2) {
|
|
5292
5292
|
result = array[pos];
|
|
@@ -5338,9 +5338,9 @@ var require_typescript = __commonJS({
|
|
|
5338
5338
|
}
|
|
5339
5339
|
return values;
|
|
5340
5340
|
}
|
|
5341
|
-
function arrayOf(
|
|
5342
|
-
const result = new Array(
|
|
5343
|
-
for (let i = 0; i <
|
|
5341
|
+
function arrayOf(count17, f) {
|
|
5342
|
+
const result = new Array(count17);
|
|
5343
|
+
for (let i = 0; i < count17; i++) {
|
|
5344
5344
|
result[i] = f(i);
|
|
5345
5345
|
}
|
|
5346
5346
|
return result;
|
|
@@ -5948,7 +5948,7 @@ var require_typescript = __commonJS({
|
|
|
5948
5948
|
function isPatternMatch({ prefix, suffix }, candidate) {
|
|
5949
5949
|
return candidate.length >= prefix.length + suffix.length && startsWith(candidate, prefix) && endsWith(candidate, suffix);
|
|
5950
5950
|
}
|
|
5951
|
-
function
|
|
5951
|
+
function and21(f, g) {
|
|
5952
5952
|
return (arg) => f(arg) && g(arg);
|
|
5953
5953
|
}
|
|
5954
5954
|
function or(...fs2) {
|
|
@@ -7452,8 +7452,8 @@ ${lanes.join("\n")}
|
|
|
7452
7452
|
var durations = /* @__PURE__ */ new Map();
|
|
7453
7453
|
function mark(markName) {
|
|
7454
7454
|
if (enabled) {
|
|
7455
|
-
const
|
|
7456
|
-
counts.set(markName,
|
|
7455
|
+
const count17 = counts.get(markName) ?? 0;
|
|
7456
|
+
counts.set(markName, count17 + 1);
|
|
7457
7457
|
marks.set(markName, timestamp());
|
|
7458
7458
|
performanceImpl == null ? void 0 : performanceImpl.mark(markName);
|
|
7459
7459
|
if (typeof onProfilerEvent === "function") {
|
|
@@ -14963,20 +14963,20 @@ ${lanes.join("\n")}
|
|
|
14963
14963
|
tokenValue = text.substring(start2, pos);
|
|
14964
14964
|
return isOctal;
|
|
14965
14965
|
}
|
|
14966
|
-
function scanExactNumberOfHexDigits(
|
|
14966
|
+
function scanExactNumberOfHexDigits(count17, canHaveSeparators) {
|
|
14967
14967
|
const valueString = scanHexDigits(
|
|
14968
14968
|
/*minCount*/
|
|
14969
|
-
|
|
14969
|
+
count17,
|
|
14970
14970
|
/*scanAsManyAsPossible*/
|
|
14971
14971
|
false,
|
|
14972
14972
|
canHaveSeparators
|
|
14973
14973
|
);
|
|
14974
14974
|
return valueString ? parseInt(valueString, 16) : -1;
|
|
14975
14975
|
}
|
|
14976
|
-
function scanMinimumNumberOfHexDigits(
|
|
14976
|
+
function scanMinimumNumberOfHexDigits(count17, canHaveSeparators) {
|
|
14977
14977
|
return scanHexDigits(
|
|
14978
14978
|
/*minCount*/
|
|
14979
|
-
|
|
14979
|
+
count17,
|
|
14980
14980
|
/*scanAsManyAsPossible*/
|
|
14981
14981
|
true,
|
|
14982
14982
|
canHaveSeparators
|
|
@@ -33793,13 +33793,13 @@ ${lanes.join("\n")}
|
|
|
33793
33793
|
[expression]
|
|
33794
33794
|
);
|
|
33795
33795
|
}
|
|
33796
|
-
function createReadHelper(iteratorRecord,
|
|
33796
|
+
function createReadHelper(iteratorRecord, count17) {
|
|
33797
33797
|
context.requestEmitHelper(readHelper);
|
|
33798
33798
|
return factory2.createCallExpression(
|
|
33799
33799
|
getUnscopedHelperName("__read"),
|
|
33800
33800
|
/*typeArguments*/
|
|
33801
33801
|
void 0,
|
|
33802
|
-
|
|
33802
|
+
count17 !== void 0 ? [iteratorRecord, factory2.createNumericLiteral(count17 + "")] : [iteratorRecord]
|
|
33803
33803
|
);
|
|
33804
33804
|
}
|
|
33805
33805
|
function createGeneratorHelper(body) {
|
|
@@ -56106,11 +56106,11 @@ ${lanes.join("\n")}
|
|
|
56106
56106
|
return comparePaths(a, b, ignoreCase) === 0;
|
|
56107
56107
|
}
|
|
56108
56108
|
function countPathComponents(path2) {
|
|
56109
|
-
let
|
|
56109
|
+
let count17 = 0;
|
|
56110
56110
|
for (let i = startsWith(path2, "./") ? 2 : 0; i < path2.length; i++) {
|
|
56111
|
-
if (path2.charCodeAt(i) === 47)
|
|
56111
|
+
if (path2.charCodeAt(i) === 47) count17++;
|
|
56112
56112
|
}
|
|
56113
|
-
return
|
|
56113
|
+
return count17;
|
|
56114
56114
|
}
|
|
56115
56115
|
function comparePathsByRedirectAndNumberOfDirectorySeparators(a, b) {
|
|
56116
56116
|
return compareBooleans(b.isRedirect, a.isRedirect) || compareNumberOfDirectorySeparators(a.path, b.path);
|
|
@@ -56943,7 +56943,7 @@ ${lanes.join("\n")}
|
|
|
56943
56943
|
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
|
|
56944
56944
|
return SignatureCheckMode3;
|
|
56945
56945
|
})(SignatureCheckMode || {});
|
|
56946
|
-
var isNotOverloadAndNotAccessor =
|
|
56946
|
+
var isNotOverloadAndNotAccessor = and21(isNotOverload, isNotAccessor);
|
|
56947
56947
|
var intrinsicTypeKinds = new Map(Object.entries({
|
|
56948
56948
|
Uppercase: 0,
|
|
56949
56949
|
Lowercase: 1,
|
|
@@ -62683,7 +62683,7 @@ ${lanes.join("\n")}
|
|
|
62683
62683
|
deepCloneOrReuseNode
|
|
62684
62684
|
)), node);
|
|
62685
62685
|
}
|
|
62686
|
-
function deepCloneOrReuseNodes(nodes, visitor, test, start,
|
|
62686
|
+
function deepCloneOrReuseNodes(nodes, visitor, test, start, count17) {
|
|
62687
62687
|
if (nodes && nodes.length === 0) {
|
|
62688
62688
|
return setTextRange(factory.createNodeArray(
|
|
62689
62689
|
/*elements*/
|
|
@@ -62691,7 +62691,7 @@ ${lanes.join("\n")}
|
|
|
62691
62691
|
nodes.hasTrailingComma
|
|
62692
62692
|
), nodes);
|
|
62693
62693
|
}
|
|
62694
|
-
return visitNodes2(nodes, visitor, test, start,
|
|
62694
|
+
return visitNodes2(nodes, visitor, test, start, count17);
|
|
62695
62695
|
}
|
|
62696
62696
|
}
|
|
62697
62697
|
function createTypeNodeFromObjectType(type2) {
|
|
@@ -66647,10 +66647,10 @@ ${lanes.join("\n")}
|
|
|
66647
66647
|
if (t.flags & 512 || !expandingEnum && t.flags | 1056) {
|
|
66648
66648
|
const baseType = t.flags & 512 ? booleanType : getBaseTypeOfEnumLikeType(t);
|
|
66649
66649
|
if (baseType.flags & 1048576) {
|
|
66650
|
-
const
|
|
66651
|
-
if (i +
|
|
66650
|
+
const count17 = baseType.types.length;
|
|
66651
|
+
if (i + count17 <= types.length && getRegularTypeOfLiteralType(types[i + count17 - 1]) === getRegularTypeOfLiteralType(baseType.types[count17 - 1])) {
|
|
66652
66652
|
result.push(baseType);
|
|
66653
|
-
i +=
|
|
66653
|
+
i += count17 - 1;
|
|
66654
66654
|
continue;
|
|
66655
66655
|
}
|
|
66656
66656
|
}
|
|
@@ -71616,18 +71616,18 @@ ${lanes.join("\n")}
|
|
|
71616
71616
|
let i = 0;
|
|
71617
71617
|
while (i < length2) {
|
|
71618
71618
|
const startId = types[i].id;
|
|
71619
|
-
let
|
|
71620
|
-
while (i +
|
|
71621
|
-
|
|
71619
|
+
let count17 = 1;
|
|
71620
|
+
while (i + count17 < length2 && types[i + count17].id === startId + count17) {
|
|
71621
|
+
count17++;
|
|
71622
71622
|
}
|
|
71623
71623
|
if (result.length) {
|
|
71624
71624
|
result += ",";
|
|
71625
71625
|
}
|
|
71626
71626
|
result += startId;
|
|
71627
|
-
if (
|
|
71628
|
-
result += ":" +
|
|
71627
|
+
if (count17 > 1) {
|
|
71628
|
+
result += ":" + count17;
|
|
71629
71629
|
}
|
|
71630
|
-
i +=
|
|
71630
|
+
i += count17;
|
|
71631
71631
|
}
|
|
71632
71632
|
}
|
|
71633
71633
|
return result;
|
|
@@ -72907,7 +72907,7 @@ ${lanes.join("\n")}
|
|
|
72907
72907
|
const hasEmptyObject = hasObjectTypes && some(types, (t) => !!(t.flags & 524288) && !isGenericMappedType(t) && isEmptyResolvedType(resolveStructuredTypeMembers(t)));
|
|
72908
72908
|
const len = types.length;
|
|
72909
72909
|
let i = len;
|
|
72910
|
-
let
|
|
72910
|
+
let count17 = 0;
|
|
72911
72911
|
while (i > 0) {
|
|
72912
72912
|
i--;
|
|
72913
72913
|
const source = types[i];
|
|
@@ -72922,15 +72922,15 @@ ${lanes.join("\n")}
|
|
|
72922
72922
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
72923
72923
|
for (const target of types) {
|
|
72924
72924
|
if (source !== target) {
|
|
72925
|
-
if (
|
|
72926
|
-
const estimatedCount =
|
|
72925
|
+
if (count17 === 1e5) {
|
|
72926
|
+
const estimatedCount = count17 / (len - i) * len;
|
|
72927
72927
|
if (estimatedCount > 1e6) {
|
|
72928
72928
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t) => t.id) });
|
|
72929
72929
|
error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
72930
72930
|
return void 0;
|
|
72931
72931
|
}
|
|
72932
72932
|
}
|
|
72933
|
-
|
|
72933
|
+
count17++;
|
|
72934
72934
|
if (keyProperty && target.flags & (524288 | 2097152 | 58982400)) {
|
|
72935
72935
|
const t = getTypeOfPropertyOfType(target, keyProperty.escapedName);
|
|
72936
72936
|
if (t && isUnitType(t) && getRegularTypeOfLiteralType(t) !== keyPropertyType) {
|
|
@@ -73431,9 +73431,9 @@ ${lanes.join("\n")}
|
|
|
73431
73431
|
return true;
|
|
73432
73432
|
}
|
|
73433
73433
|
function getCrossProductIntersections(types, flags) {
|
|
73434
|
-
const
|
|
73434
|
+
const count17 = getCrossProductUnionSize(types);
|
|
73435
73435
|
const intersections = [];
|
|
73436
|
-
for (let i = 0; i <
|
|
73436
|
+
for (let i = 0; i < count17; i++) {
|
|
73437
73437
|
const constituents = types.slice();
|
|
73438
73438
|
let n = i;
|
|
73439
73439
|
for (let j = types.length - 1; j >= 0; j--) {
|
|
@@ -79295,14 +79295,14 @@ ${lanes.join("\n")}
|
|
|
79295
79295
|
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
79296
79296
|
}
|
|
79297
79297
|
const identity2 = getRecursionIdentity(type);
|
|
79298
|
-
let
|
|
79298
|
+
let count17 = 0;
|
|
79299
79299
|
let lastTypeId = 0;
|
|
79300
79300
|
for (let i = 0; i < depth; i++) {
|
|
79301
79301
|
const t = stack[i];
|
|
79302
79302
|
if (hasMatchingRecursionIdentity(t, identity2)) {
|
|
79303
79303
|
if (t.id >= lastTypeId) {
|
|
79304
|
-
|
|
79305
|
-
if (
|
|
79304
|
+
count17++;
|
|
79305
|
+
if (count17 >= maxDepth) {
|
|
79306
79306
|
return true;
|
|
79307
79307
|
}
|
|
79308
79308
|
}
|
|
@@ -80762,8 +80762,8 @@ ${lanes.join("\n")}
|
|
|
80762
80762
|
];
|
|
80763
80763
|
}
|
|
80764
80764
|
function inferFromTypeArguments(sourceTypes, targetTypes, variances) {
|
|
80765
|
-
const
|
|
80766
|
-
for (let i = 0; i <
|
|
80765
|
+
const count17 = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
|
|
80766
|
+
for (let i = 0; i < count17; i++) {
|
|
80767
80767
|
if (i < variances.length && (variances[i] & 7) === 2) {
|
|
80768
80768
|
inferFromContravariantTypes(sourceTypes[i], targetTypes[i]);
|
|
80769
80769
|
} else {
|
|
@@ -81507,7 +81507,7 @@ ${lanes.join("\n")}
|
|
|
81507
81507
|
}
|
|
81508
81508
|
function mapTypesByKeyProperty(types, name) {
|
|
81509
81509
|
const map2 = /* @__PURE__ */ new Map();
|
|
81510
|
-
let
|
|
81510
|
+
let count17 = 0;
|
|
81511
81511
|
for (const type of types) {
|
|
81512
81512
|
if (type.flags & (524288 | 2097152 | 58982400)) {
|
|
81513
81513
|
const discriminant = getTypeOfPropertyOfType(type, name);
|
|
@@ -81526,11 +81526,11 @@ ${lanes.join("\n")}
|
|
|
81526
81526
|
duplicate = true;
|
|
81527
81527
|
}
|
|
81528
81528
|
});
|
|
81529
|
-
if (!duplicate)
|
|
81529
|
+
if (!duplicate) count17++;
|
|
81530
81530
|
}
|
|
81531
81531
|
}
|
|
81532
81532
|
}
|
|
81533
|
-
return
|
|
81533
|
+
return count17 >= 10 && count17 * 2 >= types.length ? map2 : void 0;
|
|
81534
81534
|
}
|
|
81535
81535
|
function getKeyPropertyName(unionType) {
|
|
81536
81536
|
const types = unionType.types;
|
|
@@ -99754,7 +99754,7 @@ ${lanes.join("\n")}
|
|
|
99754
99754
|
if (flags & (1920 | 384)) {
|
|
99755
99755
|
return;
|
|
99756
99756
|
}
|
|
99757
|
-
const exportedDeclarationsCount = countWhere(declarations,
|
|
99757
|
+
const exportedDeclarationsCount = countWhere(declarations, and21(isNotOverloadAndNotAccessor, not2(isInterfaceDeclaration)));
|
|
99758
99758
|
if (flags & 524288 && exportedDeclarationsCount <= 2) {
|
|
99759
99759
|
return;
|
|
99760
99760
|
}
|
|
@@ -104142,7 +104142,7 @@ ${lanes.join("\n")}
|
|
|
104142
104142
|
Debug.assertNode(visitedNode, test);
|
|
104143
104143
|
return visitedNode;
|
|
104144
104144
|
}
|
|
104145
|
-
function visitNodes2(nodes, visitor, test, start,
|
|
104145
|
+
function visitNodes2(nodes, visitor, test, start, count17) {
|
|
104146
104146
|
if (nodes === void 0) {
|
|
104147
104147
|
return nodes;
|
|
104148
104148
|
}
|
|
@@ -104150,20 +104150,20 @@ ${lanes.join("\n")}
|
|
|
104150
104150
|
if (start === void 0 || start < 0) {
|
|
104151
104151
|
start = 0;
|
|
104152
104152
|
}
|
|
104153
|
-
if (
|
|
104154
|
-
|
|
104153
|
+
if (count17 === void 0 || count17 > length2 - start) {
|
|
104154
|
+
count17 = length2 - start;
|
|
104155
104155
|
}
|
|
104156
104156
|
let hasTrailingComma;
|
|
104157
104157
|
let pos = -1;
|
|
104158
104158
|
let end = -1;
|
|
104159
|
-
if (start > 0 ||
|
|
104160
|
-
hasTrailingComma = nodes.hasTrailingComma && start +
|
|
104159
|
+
if (start > 0 || count17 < length2) {
|
|
104160
|
+
hasTrailingComma = nodes.hasTrailingComma && start + count17 === length2;
|
|
104161
104161
|
} else {
|
|
104162
104162
|
pos = nodes.pos;
|
|
104163
104163
|
end = nodes.end;
|
|
104164
104164
|
hasTrailingComma = nodes.hasTrailingComma;
|
|
104165
104165
|
}
|
|
104166
|
-
const updated = visitArrayWorker(nodes, visitor, test, start,
|
|
104166
|
+
const updated = visitArrayWorker(nodes, visitor, test, start, count17);
|
|
104167
104167
|
if (updated !== nodes) {
|
|
104168
104168
|
const updatedArray = factory.createNodeArray(updated, hasTrailingComma);
|
|
104169
104169
|
setTextRangePosEnd(updatedArray, pos, end);
|
|
@@ -104171,7 +104171,7 @@ ${lanes.join("\n")}
|
|
|
104171
104171
|
}
|
|
104172
104172
|
return nodes;
|
|
104173
104173
|
}
|
|
104174
|
-
function visitArray(nodes, visitor, test, start,
|
|
104174
|
+
function visitArray(nodes, visitor, test, start, count17) {
|
|
104175
104175
|
if (nodes === void 0) {
|
|
104176
104176
|
return nodes;
|
|
104177
104177
|
}
|
|
@@ -104179,18 +104179,18 @@ ${lanes.join("\n")}
|
|
|
104179
104179
|
if (start === void 0 || start < 0) {
|
|
104180
104180
|
start = 0;
|
|
104181
104181
|
}
|
|
104182
|
-
if (
|
|
104183
|
-
|
|
104182
|
+
if (count17 === void 0 || count17 > length2 - start) {
|
|
104183
|
+
count17 = length2 - start;
|
|
104184
104184
|
}
|
|
104185
|
-
return visitArrayWorker(nodes, visitor, test, start,
|
|
104185
|
+
return visitArrayWorker(nodes, visitor, test, start, count17);
|
|
104186
104186
|
}
|
|
104187
|
-
function visitArrayWorker(nodes, visitor, test, start,
|
|
104187
|
+
function visitArrayWorker(nodes, visitor, test, start, count17) {
|
|
104188
104188
|
let updated;
|
|
104189
104189
|
const length2 = nodes.length;
|
|
104190
|
-
if (start > 0 ||
|
|
104190
|
+
if (start > 0 || count17 < length2) {
|
|
104191
104191
|
updated = [];
|
|
104192
104192
|
}
|
|
104193
|
-
for (let i = 0; i <
|
|
104193
|
+
for (let i = 0; i < count17; i++) {
|
|
104194
104194
|
const node = nodes[i + start];
|
|
104195
104195
|
const visited = node !== void 0 ? visitor ? visitor(node) : node : void 0;
|
|
104196
104196
|
if (updated !== void 0 || visited === void 0 || visited !== node) {
|
|
@@ -135474,7 +135474,7 @@ ${lanes.join("\n")}
|
|
|
135474
135474
|
break;
|
|
135475
135475
|
}
|
|
135476
135476
|
}
|
|
135477
|
-
function emitList(parentNode, children, format, parenthesizerRule, start,
|
|
135477
|
+
function emitList(parentNode, children, format, parenthesizerRule, start, count17) {
|
|
135478
135478
|
emitNodeList(
|
|
135479
135479
|
emit,
|
|
135480
135480
|
parentNode,
|
|
@@ -135482,18 +135482,18 @@ ${lanes.join("\n")}
|
|
|
135482
135482
|
format | (parentNode && getEmitFlags(parentNode) & 2 ? 65536 : 0),
|
|
135483
135483
|
parenthesizerRule,
|
|
135484
135484
|
start,
|
|
135485
|
-
|
|
135485
|
+
count17
|
|
135486
135486
|
);
|
|
135487
135487
|
}
|
|
135488
|
-
function emitExpressionList(parentNode, children, format, parenthesizerRule, start,
|
|
135489
|
-
emitNodeList(emitExpression, parentNode, children, format, parenthesizerRule, start,
|
|
135488
|
+
function emitExpressionList(parentNode, children, format, parenthesizerRule, start, count17) {
|
|
135489
|
+
emitNodeList(emitExpression, parentNode, children, format, parenthesizerRule, start, count17);
|
|
135490
135490
|
}
|
|
135491
|
-
function emitNodeList(emit2, parentNode, children, format, parenthesizerRule, start = 0,
|
|
135491
|
+
function emitNodeList(emit2, parentNode, children, format, parenthesizerRule, start = 0, count17 = children ? children.length - start : 0) {
|
|
135492
135492
|
const isUndefined = children === void 0;
|
|
135493
135493
|
if (isUndefined && format & 16384) {
|
|
135494
135494
|
return;
|
|
135495
135495
|
}
|
|
135496
|
-
const isEmpty = children === void 0 || start >= children.length ||
|
|
135496
|
+
const isEmpty = children === void 0 || start >= children.length || count17 === 0;
|
|
135497
135497
|
if (isEmpty && format & 32768) {
|
|
135498
135498
|
onBeforeEmitNodeArray == null ? void 0 : onBeforeEmitNodeArray(children);
|
|
135499
135499
|
onAfterEmitNodeArray == null ? void 0 : onAfterEmitNodeArray(children);
|
|
@@ -135517,7 +135517,7 @@ ${lanes.join("\n")}
|
|
|
135517
135517
|
writeSpace();
|
|
135518
135518
|
}
|
|
135519
135519
|
} else {
|
|
135520
|
-
emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start,
|
|
135520
|
+
emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count17, children.hasTrailingComma, children);
|
|
135521
135521
|
}
|
|
135522
135522
|
onAfterEmitNodeArray == null ? void 0 : onAfterEmitNodeArray(children);
|
|
135523
135523
|
if (format & 15360) {
|
|
@@ -135527,7 +135527,7 @@ ${lanes.join("\n")}
|
|
|
135527
135527
|
writePunctuation(getClosingBracket(format));
|
|
135528
135528
|
}
|
|
135529
135529
|
}
|
|
135530
|
-
function emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start,
|
|
135530
|
+
function emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count17, hasTrailingComma, childrenTextRange) {
|
|
135531
135531
|
const mayEmitInterveningComments = (format & 262144) === 0;
|
|
135532
135532
|
let shouldEmitInterveningComments = mayEmitInterveningComments;
|
|
135533
135533
|
const leadingLineTerminatorCount = getLeadingLineTerminatorCount(parentNode, children[start], format);
|
|
@@ -135543,7 +135543,7 @@ ${lanes.join("\n")}
|
|
|
135543
135543
|
const emitListItem = getEmitListItem(emit2, parenthesizerRule);
|
|
135544
135544
|
let previousSibling;
|
|
135545
135545
|
let shouldDecreaseIndentAfterEmit = false;
|
|
135546
|
-
for (let i = 0; i <
|
|
135546
|
+
for (let i = 0; i < count17; i++) {
|
|
135547
135547
|
const child = children[start + i];
|
|
135548
135548
|
if (format & 32) {
|
|
135549
135549
|
writeLine();
|
|
@@ -135608,7 +135608,7 @@ ${lanes.join("\n")}
|
|
|
135608
135608
|
if (format & 128) {
|
|
135609
135609
|
decreaseIndent();
|
|
135610
135610
|
}
|
|
135611
|
-
const closingLineTerminatorCount = getClosingLineTerminatorCount(parentNode, children[start +
|
|
135611
|
+
const closingLineTerminatorCount = getClosingLineTerminatorCount(parentNode, children[start + count17 - 1], format, childrenTextRange);
|
|
135612
135612
|
if (closingLineTerminatorCount) {
|
|
135613
135613
|
writeLine(closingLineTerminatorCount);
|
|
135614
135614
|
} else if (format & (2097152 | 256)) {
|
|
@@ -135658,8 +135658,8 @@ ${lanes.join("\n")}
|
|
|
135658
135658
|
writer.write(s);
|
|
135659
135659
|
}
|
|
135660
135660
|
}
|
|
135661
|
-
function writeLine(
|
|
135662
|
-
for (let i = 0; i <
|
|
135661
|
+
function writeLine(count17 = 1) {
|
|
135662
|
+
for (let i = 0; i < count17; i++) {
|
|
135663
135663
|
writer.writeLine(i > 0);
|
|
135664
135664
|
}
|
|
135665
135665
|
}
|
|
@@ -136188,10 +136188,10 @@ ${lanes.join("\n")}
|
|
|
136188
136188
|
}
|
|
136189
136189
|
}
|
|
136190
136190
|
while (true) {
|
|
136191
|
-
const
|
|
136191
|
+
const count17 = tempFlags2 & 268435455;
|
|
136192
136192
|
tempFlags2++;
|
|
136193
|
-
if (
|
|
136194
|
-
const name =
|
|
136193
|
+
if (count17 !== 8 && count17 !== 13) {
|
|
136194
|
+
const name = count17 < 26 ? "_" + String.fromCharCode(97 + count17) : "_" + (count17 - 26);
|
|
136195
136195
|
const fullName = formatGeneratedName(privateName, prefix, name, suffix);
|
|
136196
136196
|
if (isUniqueName(fullName, privateName)) {
|
|
136197
136197
|
if (privateName) {
|
|
@@ -148258,12 +148258,12 @@ ${lanes.join("\n")}
|
|
|
148258
148258
|
for (const line of output) {
|
|
148259
148259
|
sys2.write(line);
|
|
148260
148260
|
}
|
|
148261
|
-
function example(ex,
|
|
148261
|
+
function example(ex, desc16) {
|
|
148262
148262
|
const examples = typeof ex === "string" ? [ex] : ex;
|
|
148263
148263
|
for (const example2 of examples) {
|
|
148264
148264
|
output.push(" " + colors.blue(example2) + sys2.newLine);
|
|
148265
148265
|
}
|
|
148266
|
-
output.push(" " + getDiagnosticText(
|
|
148266
|
+
output.push(" " + getDiagnosticText(desc16) + sys2.newLine + sys2.newLine);
|
|
148267
148267
|
}
|
|
148268
148268
|
}
|
|
148269
148269
|
function printAllHelp(sys2, compilerOptions, buildOptions, watchOptions) {
|
|
@@ -148915,7 +148915,7 @@ ${lanes.join("\n")}
|
|
|
148915
148915
|
reportCountStatistic("Lines of " + key, value);
|
|
148916
148916
|
}
|
|
148917
148917
|
} else {
|
|
148918
|
-
reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum,
|
|
148918
|
+
reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum, count17) => sum + count17, 0));
|
|
148919
148919
|
}
|
|
148920
148920
|
reportCountStatistic("Identifiers", program.getIdentifierCount());
|
|
148921
148921
|
reportCountStatistic("Symbols", program.getSymbolCount());
|
|
@@ -149020,11 +149020,11 @@ ${lanes.join("\n")}
|
|
|
149020
149020
|
statistics.push(s);
|
|
149021
149021
|
if (aggregate) solutionPerformance == null ? void 0 : solutionPerformance.addAggregateStatistic(s);
|
|
149022
149022
|
}
|
|
149023
|
-
function reportCountStatistic(name,
|
|
149023
|
+
function reportCountStatistic(name, count17) {
|
|
149024
149024
|
reportStatisticalValue(
|
|
149025
149025
|
{
|
|
149026
149026
|
name,
|
|
149027
|
-
value:
|
|
149027
|
+
value: count17,
|
|
149028
149028
|
type: 1
|
|
149029
149029
|
/* count */
|
|
149030
149030
|
},
|
|
@@ -149525,8 +149525,8 @@ ${lanes.join("\n")}
|
|
|
149525
149525
|
nonlocalNode ? visitNodesWithoutCopyingPositions : void 0
|
|
149526
149526
|
);
|
|
149527
149527
|
}
|
|
149528
|
-
function visitNodesWithoutCopyingPositions(nodes, visitor, test, start,
|
|
149529
|
-
let result = visitNodes2(nodes, visitor, test, start,
|
|
149528
|
+
function visitNodesWithoutCopyingPositions(nodes, visitor, test, start, count17) {
|
|
149529
|
+
let result = visitNodes2(nodes, visitor, test, start, count17);
|
|
149530
149530
|
if (result) {
|
|
149531
149531
|
if (result.pos !== -1 || result.end !== -1) {
|
|
149532
149532
|
if (result === nodes) {
|
|
@@ -152419,9 +152419,9 @@ ${lanes.join("\n")}
|
|
|
152419
152419
|
function getSnapshotText(snap) {
|
|
152420
152420
|
return snap.getText(0, snap.getLength());
|
|
152421
152421
|
}
|
|
152422
|
-
function repeatString(str,
|
|
152422
|
+
function repeatString(str, count17) {
|
|
152423
152423
|
let result = "";
|
|
152424
|
-
for (let i = 0; i <
|
|
152424
|
+
for (let i = 0; i < count17; i++) {
|
|
152425
152425
|
result += str;
|
|
152426
152426
|
}
|
|
152427
152427
|
return result;
|
|
@@ -170542,7 +170542,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
170542
170542
|
const maybeHeritageClauseSymbol = getHeritageClauseSymbolTable(classDeclaration, checker);
|
|
170543
170543
|
const implementedType = checker.getTypeAtLocation(implementedTypeNode);
|
|
170544
170544
|
const implementedTypeSymbols = checker.getPropertiesOfType(implementedType);
|
|
170545
|
-
const nonPrivateAndNotExistedInHeritageClauseMembers = implementedTypeSymbols.filter(
|
|
170545
|
+
const nonPrivateAndNotExistedInHeritageClauseMembers = implementedTypeSymbols.filter(and21(symbolPointsToNonPrivateMember, (symbol) => !maybeHeritageClauseSymbol.has(symbol.escapedName)));
|
|
170546
170546
|
const classType = checker.getTypeAtLocation(classDeclaration);
|
|
170547
170547
|
const constructor = find(classDeclaration.members, (m) => isConstructorDeclaration(m));
|
|
170548
170548
|
if (!classType.getNumberIndexType()) {
|
|
@@ -185199,8 +185199,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
185199
185199
|
function isAmbientModuleDeclaration(node) {
|
|
185200
185200
|
return node.kind === 268 && node.name.kind === 11;
|
|
185201
185201
|
}
|
|
185202
|
-
function isExternalModuleImportEquals(
|
|
185203
|
-
return
|
|
185202
|
+
function isExternalModuleImportEquals(eq21) {
|
|
185203
|
+
return eq21.moduleReference.kind === 284 && eq21.moduleReference.expression.kind === 11;
|
|
185204
185204
|
}
|
|
185205
185205
|
var DefinitionKind = /* @__PURE__ */ ((DefinitionKind2) => {
|
|
185206
185206
|
DefinitionKind2[DefinitionKind2["Symbol"] = 0] = "Symbol";
|
|
@@ -190847,13 +190847,13 @@ ${content}
|
|
|
190847
190847
|
if (candidates[i] === resolvedSignature) {
|
|
190848
190848
|
selectedItemIndex = itemsSeen;
|
|
190849
190849
|
if (item.length > 1) {
|
|
190850
|
-
let
|
|
190850
|
+
let count17 = 0;
|
|
190851
190851
|
for (const i2 of item) {
|
|
190852
190852
|
if (i2.isVariadic || i2.parameters.length >= argumentCount) {
|
|
190853
|
-
selectedItemIndex = itemsSeen +
|
|
190853
|
+
selectedItemIndex = itemsSeen + count17;
|
|
190854
190854
|
break;
|
|
190855
190855
|
}
|
|
190856
|
-
|
|
190856
|
+
count17++;
|
|
190857
190857
|
}
|
|
190858
190858
|
}
|
|
190859
190859
|
}
|
|
@@ -193154,8 +193154,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
193154
193154
|
setTextRangePosEnd(newNode, getPos2(node), getEnd(node));
|
|
193155
193155
|
return newNode;
|
|
193156
193156
|
}
|
|
193157
|
-
function assignPositionsToNodeArray(nodes, visitor, test, start,
|
|
193158
|
-
const visited = visitNodes2(nodes, visitor, test, start,
|
|
193157
|
+
function assignPositionsToNodeArray(nodes, visitor, test, start, count17) {
|
|
193158
|
+
const visited = visitNodes2(nodes, visitor, test, start, count17);
|
|
193159
193159
|
if (!visited) {
|
|
193160
193160
|
return visited;
|
|
193161
193161
|
}
|
|
@@ -197832,7 +197832,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
197832
197832
|
affectsEmitOptionDeclarations: () => affectsEmitOptionDeclarations,
|
|
197833
197833
|
allKeysStartWithDot: () => allKeysStartWithDot,
|
|
197834
197834
|
altDirectorySeparator: () => altDirectorySeparator,
|
|
197835
|
-
and: () =>
|
|
197835
|
+
and: () => and21,
|
|
197836
197836
|
append: () => append,
|
|
197837
197837
|
appendIfUnique: () => appendIfUnique,
|
|
197838
197838
|
arrayFrom: () => arrayFrom,
|
|
@@ -213617,7 +213617,7 @@ var listContextConfigsPaginated = (db) => async (params) => {
|
|
|
213617
213617
|
};
|
|
213618
213618
|
};
|
|
213619
213619
|
var createContextConfig = (db) => async (params) => {
|
|
213620
|
-
const id = params.id ||
|
|
213620
|
+
const id = params.id || generateId();
|
|
213621
213621
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
213622
213622
|
let contextVariables = params.contextVariables;
|
|
213623
213623
|
if (contextVariables !== void 0 && contextVariables !== null && typeof contextVariables === "object" && Object.keys(contextVariables).length === 0) {
|
|
@@ -213723,8 +213723,7 @@ var getExternalAgent = (db) => async (params) => {
|
|
|
213723
213723
|
where: and(
|
|
213724
213724
|
eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
213725
213725
|
eq(externalAgents.projectId, params.scopes.projectId),
|
|
213726
|
-
eq(externalAgents.
|
|
213727
|
-
eq(externalAgents.id, params.subAgentId)
|
|
213726
|
+
eq(externalAgents.id, params.externalAgentId)
|
|
213728
213727
|
)
|
|
213729
213728
|
});
|
|
213730
213729
|
return result || null;
|
|
@@ -213734,7 +213733,6 @@ var getExternalAgentByUrl = (db) => async (params) => {
|
|
|
213734
213733
|
where: and(
|
|
213735
213734
|
eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
213736
213735
|
eq(externalAgents.projectId, params.scopes.projectId),
|
|
213737
|
-
eq(externalAgents.agentId, params.scopes.agentId),
|
|
213738
213736
|
eq(externalAgents.baseUrl, params.baseUrl)
|
|
213739
213737
|
)
|
|
213740
213738
|
});
|
|
@@ -213744,8 +213742,7 @@ var listExternalAgents = (db) => async (params) => {
|
|
|
213744
213742
|
return await db.query.externalAgents.findMany({
|
|
213745
213743
|
where: and(
|
|
213746
213744
|
eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
213747
|
-
eq(externalAgents.projectId, params.scopes.projectId)
|
|
213748
|
-
eq(externalAgents.agentId, params.scopes.agentId)
|
|
213745
|
+
eq(externalAgents.projectId, params.scopes.projectId)
|
|
213749
213746
|
),
|
|
213750
213747
|
orderBy: [asc(externalAgents.name)]
|
|
213751
213748
|
});
|
|
@@ -213758,15 +213755,13 @@ var listExternalAgentsPaginated = (db) => async (params) => {
|
|
|
213758
213755
|
db.select().from(externalAgents).where(
|
|
213759
213756
|
and(
|
|
213760
213757
|
eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
213761
|
-
eq(externalAgents.projectId, params.scopes.projectId)
|
|
213762
|
-
eq(externalAgents.agentId, params.scopes.agentId)
|
|
213758
|
+
eq(externalAgents.projectId, params.scopes.projectId)
|
|
213763
213759
|
)
|
|
213764
213760
|
).limit(limit).offset(offset).orderBy(desc(externalAgents.createdAt)),
|
|
213765
213761
|
db.select({ count: count() }).from(externalAgents).where(
|
|
213766
213762
|
and(
|
|
213767
213763
|
eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
213768
|
-
eq(externalAgents.projectId, params.scopes.projectId)
|
|
213769
|
-
eq(externalAgents.agentId, params.scopes.agentId)
|
|
213764
|
+
eq(externalAgents.projectId, params.scopes.projectId)
|
|
213770
213765
|
)
|
|
213771
213766
|
)
|
|
213772
213767
|
]);
|
|
@@ -213785,9 +213780,6 @@ var updateExternalAgent = (db) => async (params) => {
|
|
|
213785
213780
|
if (Object.keys(updateData).length === 1) {
|
|
213786
213781
|
throw new Error("No fields to update");
|
|
213787
213782
|
}
|
|
213788
|
-
if (updateData.headers !== void 0 && (updateData.headers === null || Object.keys(updateData.headers || {}).length === 0)) {
|
|
213789
|
-
updateData.headers = null;
|
|
213790
|
-
}
|
|
213791
213783
|
if (updateData.credentialReferenceId === void 0) {
|
|
213792
213784
|
updateData.credentialReferenceId = null;
|
|
213793
213785
|
}
|
|
@@ -213795,8 +213787,7 @@ var updateExternalAgent = (db) => async (params) => {
|
|
|
213795
213787
|
and(
|
|
213796
213788
|
eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
213797
213789
|
eq(externalAgents.projectId, params.scopes.projectId),
|
|
213798
|
-
eq(externalAgents.
|
|
213799
|
-
eq(externalAgents.id, params.subAgentId)
|
|
213790
|
+
eq(externalAgents.id, params.externalAgentId)
|
|
213800
213791
|
)
|
|
213801
213792
|
).returning();
|
|
213802
213793
|
return result[0] || null;
|
|
@@ -213804,23 +213795,21 @@ var updateExternalAgent = (db) => async (params) => {
|
|
|
213804
213795
|
var upsertExternalAgent = (db) => async (params) => {
|
|
213805
213796
|
const scopes = {
|
|
213806
213797
|
tenantId: params.data.tenantId,
|
|
213807
|
-
projectId: params.data.projectId
|
|
213808
|
-
agentId: params.data.agentId
|
|
213798
|
+
projectId: params.data.projectId
|
|
213809
213799
|
};
|
|
213810
213800
|
const existing = await getExternalAgent(db)({
|
|
213811
213801
|
scopes,
|
|
213812
|
-
|
|
213802
|
+
externalAgentId: params.data.id
|
|
213813
213803
|
});
|
|
213814
213804
|
if (existing) {
|
|
213815
213805
|
const updated = await updateExternalAgent(db)({
|
|
213816
213806
|
scopes,
|
|
213817
|
-
|
|
213807
|
+
externalAgentId: params.data.id,
|
|
213818
213808
|
data: {
|
|
213819
213809
|
name: params.data.name,
|
|
213820
213810
|
description: params.data.description,
|
|
213821
213811
|
baseUrl: params.data.baseUrl,
|
|
213822
|
-
credentialReferenceId: params.data.credentialReferenceId
|
|
213823
|
-
headers: params.data.headers
|
|
213812
|
+
credentialReferenceId: params.data.credentialReferenceId
|
|
213824
213813
|
}
|
|
213825
213814
|
});
|
|
213826
213815
|
if (!updated) {
|
|
@@ -213837,8 +213826,7 @@ var deleteExternalAgent = (db) => async (params) => {
|
|
|
213837
213826
|
and(
|
|
213838
213827
|
eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
213839
213828
|
eq(externalAgents.projectId, params.scopes.projectId),
|
|
213840
|
-
eq(externalAgents.
|
|
213841
|
-
eq(externalAgents.id, params.subAgentId)
|
|
213829
|
+
eq(externalAgents.id, params.externalAgentId)
|
|
213842
213830
|
)
|
|
213843
213831
|
).returning();
|
|
213844
213832
|
return result.length > 0;
|
|
@@ -213859,8 +213847,7 @@ var countExternalAgents = (db) => async (params) => {
|
|
|
213859
213847
|
const result = await db.select({ count: count() }).from(externalAgents).where(
|
|
213860
213848
|
and(
|
|
213861
213849
|
eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
213862
|
-
eq(externalAgents.projectId, params.scopes.projectId)
|
|
213863
|
-
eq(externalAgents.agentId, params.scopes.agentId)
|
|
213850
|
+
eq(externalAgents.projectId, params.scopes.projectId)
|
|
213864
213851
|
)
|
|
213865
213852
|
);
|
|
213866
213853
|
const countValue = result[0]?.count;
|
|
@@ -214177,7 +214164,7 @@ var addFunctionToolToSubAgent = (db) => {
|
|
|
214177
214164
|
const { scopes, subAgentId, functionToolId } = params;
|
|
214178
214165
|
const { tenantId, projectId, agentId } = scopes;
|
|
214179
214166
|
try {
|
|
214180
|
-
const relationId =
|
|
214167
|
+
const relationId = generateId();
|
|
214181
214168
|
await db.insert(subAgentFunctionToolRelations).values({
|
|
214182
214169
|
id: relationId,
|
|
214183
214170
|
tenantId,
|
|
@@ -214230,6 +214217,284 @@ var updateSubAgentFunctionToolRelation = (db) => {
|
|
|
214230
214217
|
}
|
|
214231
214218
|
};
|
|
214232
214219
|
};
|
|
214220
|
+
var getSubAgentExternalAgentRelationById = (db) => async (params) => {
|
|
214221
|
+
return db.query.subAgentExternalAgentRelations.findFirst({
|
|
214222
|
+
where: and(
|
|
214223
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214224
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214225
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214226
|
+
eq(subAgentExternalAgentRelations.subAgentId, params.scopes.subAgentId),
|
|
214227
|
+
eq(subAgentExternalAgentRelations.id, params.relationId)
|
|
214228
|
+
)
|
|
214229
|
+
});
|
|
214230
|
+
};
|
|
214231
|
+
var listSubAgentExternalAgentRelations = (db) => async (params) => {
|
|
214232
|
+
const page = params.pagination?.page || 1;
|
|
214233
|
+
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
214234
|
+
const offset = (page - 1) * limit;
|
|
214235
|
+
const whereClause = and(
|
|
214236
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214237
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214238
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214239
|
+
eq(subAgentExternalAgentRelations.subAgentId, params.scopes.subAgentId)
|
|
214240
|
+
);
|
|
214241
|
+
const [data, totalResult] = await Promise.all([
|
|
214242
|
+
db.select().from(subAgentExternalAgentRelations).where(whereClause).limit(limit).offset(offset).orderBy(desc(subAgentExternalAgentRelations.createdAt)),
|
|
214243
|
+
db.select({ count: count() }).from(subAgentExternalAgentRelations).where(whereClause)
|
|
214244
|
+
]);
|
|
214245
|
+
const total = totalResult[0]?.count || 0;
|
|
214246
|
+
const pages = Math.ceil(total / limit);
|
|
214247
|
+
return { data, pagination: { page, limit, total, pages } };
|
|
214248
|
+
};
|
|
214249
|
+
var getSubAgentExternalAgentRelations = (db) => async (params) => {
|
|
214250
|
+
return await db.query.subAgentExternalAgentRelations.findMany({
|
|
214251
|
+
where: and(
|
|
214252
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214253
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214254
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214255
|
+
eq(subAgentExternalAgentRelations.subAgentId, params.scopes.subAgentId)
|
|
214256
|
+
)
|
|
214257
|
+
});
|
|
214258
|
+
};
|
|
214259
|
+
var getSubAgentExternalAgentRelationsByAgent = (db) => async (params) => {
|
|
214260
|
+
return await db.query.subAgentExternalAgentRelations.findMany({
|
|
214261
|
+
where: and(
|
|
214262
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214263
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214264
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId)
|
|
214265
|
+
)
|
|
214266
|
+
});
|
|
214267
|
+
};
|
|
214268
|
+
var getSubAgentExternalAgentRelationsByExternalAgent = (db) => async (params) => {
|
|
214269
|
+
const page = params.pagination?.page || 1;
|
|
214270
|
+
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
214271
|
+
const offset = (page - 1) * limit;
|
|
214272
|
+
const whereClause = and(
|
|
214273
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214274
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214275
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214276
|
+
eq(subAgentExternalAgentRelations.externalAgentId, params.externalAgentId)
|
|
214277
|
+
);
|
|
214278
|
+
const [data, totalResult] = await Promise.all([
|
|
214279
|
+
db.select().from(subAgentExternalAgentRelations).where(whereClause).limit(limit).offset(offset).orderBy(desc(subAgentExternalAgentRelations.createdAt)),
|
|
214280
|
+
db.select({ count: count() }).from(subAgentExternalAgentRelations).where(whereClause)
|
|
214281
|
+
]);
|
|
214282
|
+
const total = totalResult[0]?.count || 0;
|
|
214283
|
+
const pages = Math.ceil(total / limit);
|
|
214284
|
+
return {
|
|
214285
|
+
data,
|
|
214286
|
+
pagination: { page, limit, total, pages }
|
|
214287
|
+
};
|
|
214288
|
+
};
|
|
214289
|
+
var getExternalAgentsForSubAgent = (db) => async (params) => {
|
|
214290
|
+
const page = params.pagination?.page || 1;
|
|
214291
|
+
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
214292
|
+
const offset = (page - 1) * limit;
|
|
214293
|
+
const [data, totalResult] = await Promise.all([
|
|
214294
|
+
db.select({
|
|
214295
|
+
id: subAgentExternalAgentRelations.id,
|
|
214296
|
+
tenantId: subAgentExternalAgentRelations.tenantId,
|
|
214297
|
+
projectId: subAgentExternalAgentRelations.projectId,
|
|
214298
|
+
agentId: subAgentExternalAgentRelations.agentId,
|
|
214299
|
+
subAgentId: subAgentExternalAgentRelations.subAgentId,
|
|
214300
|
+
externalAgentId: subAgentExternalAgentRelations.externalAgentId,
|
|
214301
|
+
headers: subAgentExternalAgentRelations.headers,
|
|
214302
|
+
createdAt: subAgentExternalAgentRelations.createdAt,
|
|
214303
|
+
updatedAt: subAgentExternalAgentRelations.updatedAt,
|
|
214304
|
+
externalAgent: {
|
|
214305
|
+
id: externalAgents.id,
|
|
214306
|
+
name: externalAgents.name,
|
|
214307
|
+
description: externalAgents.description,
|
|
214308
|
+
baseUrl: externalAgents.baseUrl,
|
|
214309
|
+
credentialReferenceId: externalAgents.credentialReferenceId,
|
|
214310
|
+
tenantId: externalAgents.tenantId,
|
|
214311
|
+
projectId: externalAgents.projectId,
|
|
214312
|
+
createdAt: externalAgents.createdAt,
|
|
214313
|
+
updatedAt: externalAgents.updatedAt
|
|
214314
|
+
}
|
|
214315
|
+
}).from(subAgentExternalAgentRelations).innerJoin(
|
|
214316
|
+
externalAgents,
|
|
214317
|
+
and(
|
|
214318
|
+
eq(subAgentExternalAgentRelations.tenantId, externalAgents.tenantId),
|
|
214319
|
+
eq(subAgentExternalAgentRelations.projectId, externalAgents.projectId),
|
|
214320
|
+
eq(subAgentExternalAgentRelations.externalAgentId, externalAgents.id)
|
|
214321
|
+
)
|
|
214322
|
+
).where(
|
|
214323
|
+
and(
|
|
214324
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214325
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214326
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214327
|
+
eq(subAgentExternalAgentRelations.subAgentId, params.scopes.subAgentId)
|
|
214328
|
+
)
|
|
214329
|
+
).limit(limit).offset(offset).orderBy(desc(subAgentExternalAgentRelations.createdAt)),
|
|
214330
|
+
db.select({ count: count() }).from(subAgentExternalAgentRelations).where(
|
|
214331
|
+
and(
|
|
214332
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214333
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214334
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214335
|
+
eq(subAgentExternalAgentRelations.subAgentId, params.scopes.subAgentId)
|
|
214336
|
+
)
|
|
214337
|
+
)
|
|
214338
|
+
]);
|
|
214339
|
+
const total = totalResult[0]?.count || 0;
|
|
214340
|
+
const pages = Math.ceil(total / limit);
|
|
214341
|
+
return {
|
|
214342
|
+
data,
|
|
214343
|
+
pagination: { page, limit, total, pages }
|
|
214344
|
+
};
|
|
214345
|
+
};
|
|
214346
|
+
var getSubAgentsForExternalAgent = (db) => async (params) => {
|
|
214347
|
+
const page = params.pagination?.page || 1;
|
|
214348
|
+
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
214349
|
+
const offset = (page - 1) * limit;
|
|
214350
|
+
const [data, totalResult] = await Promise.all([
|
|
214351
|
+
db.select({
|
|
214352
|
+
id: subAgentExternalAgentRelations.id,
|
|
214353
|
+
tenantId: subAgentExternalAgentRelations.tenantId,
|
|
214354
|
+
projectId: subAgentExternalAgentRelations.projectId,
|
|
214355
|
+
agentId: subAgentExternalAgentRelations.agentId,
|
|
214356
|
+
subAgentId: subAgentExternalAgentRelations.subAgentId,
|
|
214357
|
+
externalAgentId: subAgentExternalAgentRelations.externalAgentId,
|
|
214358
|
+
headers: subAgentExternalAgentRelations.headers,
|
|
214359
|
+
createdAt: subAgentExternalAgentRelations.createdAt,
|
|
214360
|
+
updatedAt: subAgentExternalAgentRelations.updatedAt,
|
|
214361
|
+
subAgent: {
|
|
214362
|
+
id: subAgents.id,
|
|
214363
|
+
name: subAgents.name,
|
|
214364
|
+
description: subAgents.description,
|
|
214365
|
+
prompt: subAgents.prompt,
|
|
214366
|
+
conversationHistoryConfig: subAgents.conversationHistoryConfig,
|
|
214367
|
+
models: subAgents.models,
|
|
214368
|
+
stopWhen: subAgents.stopWhen,
|
|
214369
|
+
createdAt: subAgents.createdAt,
|
|
214370
|
+
updatedAt: subAgents.updatedAt
|
|
214371
|
+
}
|
|
214372
|
+
}).from(subAgentExternalAgentRelations).innerJoin(
|
|
214373
|
+
subAgents,
|
|
214374
|
+
and(
|
|
214375
|
+
eq(subAgentExternalAgentRelations.subAgentId, subAgents.id),
|
|
214376
|
+
eq(subAgentExternalAgentRelations.tenantId, subAgents.tenantId),
|
|
214377
|
+
eq(subAgentExternalAgentRelations.projectId, subAgents.projectId),
|
|
214378
|
+
eq(subAgentExternalAgentRelations.agentId, subAgents.agentId)
|
|
214379
|
+
)
|
|
214380
|
+
).where(
|
|
214381
|
+
and(
|
|
214382
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214383
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214384
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214385
|
+
eq(subAgentExternalAgentRelations.externalAgentId, params.externalAgentId)
|
|
214386
|
+
)
|
|
214387
|
+
).limit(limit).offset(offset).orderBy(desc(subAgentExternalAgentRelations.createdAt)),
|
|
214388
|
+
db.select({ count: count() }).from(subAgentExternalAgentRelations).where(
|
|
214389
|
+
and(
|
|
214390
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214391
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214392
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214393
|
+
eq(subAgentExternalAgentRelations.externalAgentId, params.externalAgentId)
|
|
214394
|
+
)
|
|
214395
|
+
)
|
|
214396
|
+
]);
|
|
214397
|
+
const total = totalResult[0]?.count || 0;
|
|
214398
|
+
const pages = Math.ceil(total / limit);
|
|
214399
|
+
return {
|
|
214400
|
+
data,
|
|
214401
|
+
pagination: { page, limit, total, pages }
|
|
214402
|
+
};
|
|
214403
|
+
};
|
|
214404
|
+
var createSubAgentExternalAgentRelation = (db) => async (params) => {
|
|
214405
|
+
const finalRelationId = params.relationId ?? nanoid();
|
|
214406
|
+
const relation = await db.insert(subAgentExternalAgentRelations).values({
|
|
214407
|
+
id: finalRelationId,
|
|
214408
|
+
tenantId: params.scopes.tenantId,
|
|
214409
|
+
projectId: params.scopes.projectId,
|
|
214410
|
+
agentId: params.scopes.agentId,
|
|
214411
|
+
subAgentId: params.scopes.subAgentId,
|
|
214412
|
+
externalAgentId: params.data.externalAgentId,
|
|
214413
|
+
headers: params.data.headers
|
|
214414
|
+
}).returning();
|
|
214415
|
+
return relation[0];
|
|
214416
|
+
};
|
|
214417
|
+
var getSubAgentExternalAgentRelationByParams = (db) => async (params) => {
|
|
214418
|
+
return db.query.subAgentExternalAgentRelations.findFirst({
|
|
214419
|
+
where: and(
|
|
214420
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214421
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214422
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214423
|
+
eq(subAgentExternalAgentRelations.subAgentId, params.scopes.subAgentId),
|
|
214424
|
+
eq(subAgentExternalAgentRelations.externalAgentId, params.externalAgentId)
|
|
214425
|
+
)
|
|
214426
|
+
});
|
|
214427
|
+
};
|
|
214428
|
+
var upsertSubAgentExternalAgentRelation = (db) => async (params) => {
|
|
214429
|
+
if (params.relationId) {
|
|
214430
|
+
return await updateSubAgentExternalAgentRelation(db)({
|
|
214431
|
+
scopes: params.scopes,
|
|
214432
|
+
relationId: params.relationId,
|
|
214433
|
+
data: params.data
|
|
214434
|
+
});
|
|
214435
|
+
}
|
|
214436
|
+
const existing = await getSubAgentExternalAgentRelationByParams(db)({
|
|
214437
|
+
scopes: params.scopes,
|
|
214438
|
+
externalAgentId: params.data.externalAgentId
|
|
214439
|
+
});
|
|
214440
|
+
if (existing) {
|
|
214441
|
+
return await updateSubAgentExternalAgentRelation(db)({
|
|
214442
|
+
scopes: params.scopes,
|
|
214443
|
+
relationId: existing.id,
|
|
214444
|
+
data: params.data
|
|
214445
|
+
});
|
|
214446
|
+
}
|
|
214447
|
+
return await createSubAgentExternalAgentRelation(db)(params);
|
|
214448
|
+
};
|
|
214449
|
+
var updateSubAgentExternalAgentRelation = (db) => async (params) => {
|
|
214450
|
+
const updateData = {
|
|
214451
|
+
...params.data,
|
|
214452
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
214453
|
+
};
|
|
214454
|
+
const relation = await db.update(subAgentExternalAgentRelations).set(updateData).where(
|
|
214455
|
+
and(
|
|
214456
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214457
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214458
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214459
|
+
eq(subAgentExternalAgentRelations.subAgentId, params.scopes.subAgentId),
|
|
214460
|
+
eq(subAgentExternalAgentRelations.id, params.relationId)
|
|
214461
|
+
)
|
|
214462
|
+
).returning();
|
|
214463
|
+
return relation[0];
|
|
214464
|
+
};
|
|
214465
|
+
var deleteSubAgentExternalAgentRelation = (db) => async (params) => {
|
|
214466
|
+
const result = await db.delete(subAgentExternalAgentRelations).where(
|
|
214467
|
+
and(
|
|
214468
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214469
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214470
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214471
|
+
eq(subAgentExternalAgentRelations.subAgentId, params.scopes.subAgentId),
|
|
214472
|
+
eq(subAgentExternalAgentRelations.id, params.relationId)
|
|
214473
|
+
)
|
|
214474
|
+
);
|
|
214475
|
+
return (result.rowsAffected || 0) > 0;
|
|
214476
|
+
};
|
|
214477
|
+
var deleteSubAgentExternalAgentRelationsBySubAgent = (db) => async (params) => {
|
|
214478
|
+
const result = await db.delete(subAgentExternalAgentRelations).where(
|
|
214479
|
+
and(
|
|
214480
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214481
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214482
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
214483
|
+
eq(subAgentExternalAgentRelations.subAgentId, params.scopes.subAgentId)
|
|
214484
|
+
)
|
|
214485
|
+
);
|
|
214486
|
+
return (result.rowsAffected || 0) > 0;
|
|
214487
|
+
};
|
|
214488
|
+
var deleteSubAgentExternalAgentRelationsByAgent = (db) => async (params) => {
|
|
214489
|
+
const result = await db.delete(subAgentExternalAgentRelations).where(
|
|
214490
|
+
and(
|
|
214491
|
+
eq(subAgentExternalAgentRelations.tenantId, params.scopes.tenantId),
|
|
214492
|
+
eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
214493
|
+
eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId)
|
|
214494
|
+
)
|
|
214495
|
+
);
|
|
214496
|
+
return (result.rowsAffected || 0) > 0;
|
|
214497
|
+
};
|
|
214233
214498
|
var getAgentRelationById = (db) => async (params) => {
|
|
214234
214499
|
return db.query.subAgentRelations.findFirst({
|
|
214235
214500
|
where: and(
|
|
@@ -214318,29 +214583,8 @@ var getSubAgentRelationsByTarget = (db) => async (params) => {
|
|
|
214318
214583
|
pagination: { page, limit, total, pages }
|
|
214319
214584
|
};
|
|
214320
214585
|
};
|
|
214321
|
-
var getExternalAgentRelations = (db) => async (params) => {
|
|
214322
|
-
const page = params.pagination?.page || 1;
|
|
214323
|
-
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
214324
|
-
const offset = (page - 1) * limit;
|
|
214325
|
-
const whereClause = and(
|
|
214326
|
-
eq(subAgentRelations.tenantId, params.scopes.tenantId),
|
|
214327
|
-
eq(subAgentRelations.projectId, params.scopes.projectId),
|
|
214328
|
-
eq(subAgentRelations.agentId, params.scopes.agentId),
|
|
214329
|
-
eq(subAgentRelations.externalSubAgentId, params.externalSubAgentId)
|
|
214330
|
-
);
|
|
214331
|
-
const [data, totalResult] = await Promise.all([
|
|
214332
|
-
db.select().from(subAgentRelations).where(whereClause).limit(limit).offset(offset).orderBy(desc(subAgentRelations.createdAt)),
|
|
214333
|
-
db.select({ count: count() }).from(subAgentRelations).where(whereClause)
|
|
214334
|
-
]);
|
|
214335
|
-
const total = totalResult[0]?.count || 0;
|
|
214336
|
-
const pages = Math.ceil(total / limit);
|
|
214337
|
-
return {
|
|
214338
|
-
data,
|
|
214339
|
-
pagination: { page, limit, total, pages }
|
|
214340
|
-
};
|
|
214341
|
-
};
|
|
214342
214586
|
var getRelatedAgentsForAgent = (db) => async (params) => {
|
|
214343
|
-
const
|
|
214587
|
+
const data = await db.select({
|
|
214344
214588
|
id: subAgents.id,
|
|
214345
214589
|
name: subAgents.name,
|
|
214346
214590
|
description: subAgents.description,
|
|
@@ -214362,35 +214606,8 @@ var getRelatedAgentsForAgent = (db) => async (params) => {
|
|
|
214362
214606
|
isNotNull(subAgentRelations.targetSubAgentId)
|
|
214363
214607
|
)
|
|
214364
214608
|
);
|
|
214365
|
-
const externalRelations = await db.select({
|
|
214366
|
-
id: subAgentRelations.id,
|
|
214367
|
-
relationType: subAgentRelations.relationType,
|
|
214368
|
-
externalAgent: {
|
|
214369
|
-
id: externalAgents.id,
|
|
214370
|
-
name: externalAgents.name,
|
|
214371
|
-
description: externalAgents.description,
|
|
214372
|
-
baseUrl: externalAgents.baseUrl
|
|
214373
|
-
}
|
|
214374
|
-
}).from(subAgentRelations).innerJoin(
|
|
214375
|
-
externalAgents,
|
|
214376
|
-
and(
|
|
214377
|
-
eq(subAgentRelations.externalSubAgentId, externalAgents.id),
|
|
214378
|
-
eq(subAgentRelations.tenantId, externalAgents.tenantId),
|
|
214379
|
-
eq(subAgentRelations.projectId, externalAgents.projectId),
|
|
214380
|
-
eq(subAgentRelations.agentId, externalAgents.agentId)
|
|
214381
|
-
)
|
|
214382
|
-
).where(
|
|
214383
|
-
and(
|
|
214384
|
-
eq(subAgentRelations.tenantId, params.scopes.tenantId),
|
|
214385
|
-
eq(subAgentRelations.projectId, params.scopes.projectId),
|
|
214386
|
-
eq(subAgentRelations.agentId, params.scopes.agentId),
|
|
214387
|
-
eq(subAgentRelations.sourceSubAgentId, params.subAgentId),
|
|
214388
|
-
isNotNull(subAgentRelations.externalSubAgentId)
|
|
214389
|
-
)
|
|
214390
|
-
);
|
|
214391
214609
|
return {
|
|
214392
|
-
|
|
214393
|
-
externalRelations
|
|
214610
|
+
data
|
|
214394
214611
|
};
|
|
214395
214612
|
};
|
|
214396
214613
|
var createSubAgentRelation = (db) => async (params) => {
|
|
@@ -214418,9 +214635,6 @@ var getAgentRelationByParams = (db) => async (params) => {
|
|
|
214418
214635
|
if (params.targetSubAgentId) {
|
|
214419
214636
|
whereConditions.push(eq(subAgentRelations.targetSubAgentId, params.targetSubAgentId));
|
|
214420
214637
|
}
|
|
214421
|
-
if (params.externalSubAgentId) {
|
|
214422
|
-
whereConditions.push(eq(subAgentRelations.externalSubAgentId, params.externalSubAgentId));
|
|
214423
|
-
}
|
|
214424
214638
|
return db.query.subAgentRelations.findFirst({
|
|
214425
214639
|
where: and(...whereConditions)
|
|
214426
214640
|
});
|
|
@@ -214430,7 +214644,6 @@ var upsertSubAgentRelation = (db) => async (params) => {
|
|
|
214430
214644
|
scopes: { tenantId: params.tenantId, projectId: params.projectId, agentId: params.agentId },
|
|
214431
214645
|
sourceSubAgentId: params.sourceSubAgentId,
|
|
214432
214646
|
targetSubAgentId: params.targetSubAgentId,
|
|
214433
|
-
externalSubAgentId: params.externalSubAgentId,
|
|
214434
214647
|
relationType: params.relationType ?? ""
|
|
214435
214648
|
});
|
|
214436
214649
|
if (!existing) {
|
|
@@ -214438,12 +214651,6 @@ var upsertSubAgentRelation = (db) => async (params) => {
|
|
|
214438
214651
|
}
|
|
214439
214652
|
return existing;
|
|
214440
214653
|
};
|
|
214441
|
-
var createExternalAgentRelation = (db) => async (params) => {
|
|
214442
|
-
return await createSubAgentRelation(db)({
|
|
214443
|
-
...params,
|
|
214444
|
-
targetSubAgentId: void 0
|
|
214445
|
-
});
|
|
214446
|
-
};
|
|
214447
214654
|
var updateAgentRelation = (db) => async (params) => {
|
|
214448
214655
|
const updateData = {
|
|
214449
214656
|
...params.data,
|
|
@@ -214480,7 +214687,7 @@ var deleteAgentRelationsByAgent = (db) => async (params) => {
|
|
|
214480
214687
|
return (result.rowsAffected || 0) > 0;
|
|
214481
214688
|
};
|
|
214482
214689
|
var createAgentToolRelation = (db) => async (params) => {
|
|
214483
|
-
const finalRelationId = params.relationId ??
|
|
214690
|
+
const finalRelationId = params.relationId ?? generateId();
|
|
214484
214691
|
const relation = await db.insert(subAgentToolRelations).values({
|
|
214485
214692
|
id: finalRelationId,
|
|
214486
214693
|
tenantId: params.scopes.tenantId,
|
|
@@ -214740,7 +214947,7 @@ var getAgentsForTool = (db) => async (params) => {
|
|
|
214740
214947
|
pagination: { page, limit, total, pages }
|
|
214741
214948
|
};
|
|
214742
214949
|
};
|
|
214743
|
-
var
|
|
214950
|
+
var validateSubAgent = (db) => async (params) => {
|
|
214744
214951
|
const result = await db.select({ id: subAgents.id }).from(subAgents).where(
|
|
214745
214952
|
and(
|
|
214746
214953
|
eq(subAgents.tenantId, params.scopes.tenantId),
|
|
@@ -214751,17 +214958,6 @@ var validateInternalSubAgent = (db) => async (params) => {
|
|
|
214751
214958
|
).limit(1);
|
|
214752
214959
|
return result.length > 0;
|
|
214753
214960
|
};
|
|
214754
|
-
var validateExternalAgent = (db) => async (params) => {
|
|
214755
|
-
const result = await db.select({ id: externalAgents.id }).from(externalAgents).where(
|
|
214756
|
-
and(
|
|
214757
|
-
eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
214758
|
-
eq(externalAgents.projectId, params.scopes.projectId),
|
|
214759
|
-
eq(externalAgents.agentId, params.scopes.agentId),
|
|
214760
|
-
eq(externalAgents.id, params.scopes.subAgentId)
|
|
214761
|
-
)
|
|
214762
|
-
).limit(1);
|
|
214763
|
-
return result.length > 0;
|
|
214764
|
-
};
|
|
214765
214961
|
var getSubAgentById = (db) => async (params) => {
|
|
214766
214962
|
const result = await db.query.subAgents.findFirst({
|
|
214767
214963
|
where: and(
|
|
@@ -214901,7 +215097,7 @@ async function generateApiKey() {
|
|
|
214901
215097
|
const key = `sk_${publicId}.${secret}`;
|
|
214902
215098
|
const keyPrefix = key.substring(0, 12);
|
|
214903
215099
|
const keyHash = await hashApiKey(key);
|
|
214904
|
-
const id =
|
|
215100
|
+
const id = generateId();
|
|
214905
215101
|
return {
|
|
214906
215102
|
id,
|
|
214907
215103
|
publicId,
|
|
@@ -215468,8 +215664,8 @@ var getCredentialReference = (db) => async (params) => {
|
|
|
215468
215664
|
)
|
|
215469
215665
|
});
|
|
215470
215666
|
};
|
|
215471
|
-
var
|
|
215472
|
-
const [credential, relatedTools] = await Promise.all([
|
|
215667
|
+
var getCredentialReferenceWithResources = (db) => async (params) => {
|
|
215668
|
+
const [credential, relatedTools, relatedExternalAgents] = await Promise.all([
|
|
215473
215669
|
db.query.credentialReferences.findFirst({
|
|
215474
215670
|
where: and(
|
|
215475
215671
|
eq(credentialReferences.tenantId, params.scopes.tenantId),
|
|
@@ -215483,6 +215679,13 @@ var getCredentialReferenceWithTools = (db) => async (params) => {
|
|
|
215483
215679
|
eq(tools.projectId, params.scopes.projectId),
|
|
215484
215680
|
eq(tools.credentialReferenceId, params.id)
|
|
215485
215681
|
)
|
|
215682
|
+
),
|
|
215683
|
+
db.select().from(externalAgents).where(
|
|
215684
|
+
and(
|
|
215685
|
+
eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
215686
|
+
eq(externalAgents.projectId, params.scopes.projectId),
|
|
215687
|
+
eq(externalAgents.credentialReferenceId, params.id)
|
|
215688
|
+
)
|
|
215486
215689
|
)
|
|
215487
215690
|
]);
|
|
215488
215691
|
if (!credential) {
|
|
@@ -215490,7 +215693,8 @@ var getCredentialReferenceWithTools = (db) => async (params) => {
|
|
|
215490
215693
|
}
|
|
215491
215694
|
return {
|
|
215492
215695
|
...credential,
|
|
215493
|
-
tools: relatedTools
|
|
215696
|
+
tools: relatedTools,
|
|
215697
|
+
externalAgents: relatedExternalAgents
|
|
215494
215698
|
};
|
|
215495
215699
|
};
|
|
215496
215700
|
var listCredentialReferences = (db) => async (params) => {
|
|
@@ -215542,7 +215746,7 @@ var updateCredentialReference = (db) => async (params) => {
|
|
|
215542
215746
|
eq(credentialReferences.id, params.id)
|
|
215543
215747
|
)
|
|
215544
215748
|
);
|
|
215545
|
-
return await
|
|
215749
|
+
return await getCredentialReferenceWithResources(db)({
|
|
215546
215750
|
scopes: params.scopes,
|
|
215547
215751
|
id: params.id
|
|
215548
215752
|
});
|
|
@@ -215873,7 +216077,7 @@ var deleteTool = (db) => async (params) => {
|
|
|
215873
216077
|
return !!deleted;
|
|
215874
216078
|
};
|
|
215875
216079
|
var addToolToAgent = (db) => async (params) => {
|
|
215876
|
-
const id =
|
|
216080
|
+
const id = generateId();
|
|
215877
216081
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
215878
216082
|
const [created] = await db.insert(subAgentToolRelations).values({
|
|
215879
216083
|
id,
|
|
@@ -216118,11 +216322,12 @@ var getFullAgentDefinition = (db) => async ({
|
|
|
216118
216322
|
eq(subAgents.agentId, agentId)
|
|
216119
216323
|
)
|
|
216120
216324
|
});
|
|
216325
|
+
const externalAgentRelations = await getSubAgentExternalAgentRelationsByAgent(db)({
|
|
216326
|
+
scopes: { tenantId, projectId, agentId }
|
|
216327
|
+
});
|
|
216121
216328
|
const externalSubAgentIds = /* @__PURE__ */ new Set();
|
|
216122
|
-
for (const relation of
|
|
216123
|
-
|
|
216124
|
-
externalSubAgentIds.add(relation.externalSubAgentId);
|
|
216125
|
-
}
|
|
216329
|
+
for (const relation of externalAgentRelations) {
|
|
216330
|
+
externalSubAgentIds.add(relation.externalAgentId);
|
|
216126
216331
|
}
|
|
216127
216332
|
const processedSubAgents = await Promise.all(
|
|
216128
216333
|
agentSubAgents.map(async (agent2) => {
|
|
@@ -216131,7 +216336,13 @@ var getFullAgentDefinition = (db) => async ({
|
|
|
216131
216336
|
(relation) => relation.sourceSubAgentId === agent2.id
|
|
216132
216337
|
);
|
|
216133
216338
|
const canTransferTo = subAgentRelationsList.filter((rel) => rel.relationType === "transfer" || rel.relationType === "transfer_to").map((rel) => rel.targetSubAgentId).filter((id) => id !== null);
|
|
216134
|
-
const
|
|
216339
|
+
const canDelegateToInternal = subAgentRelationsList.filter((rel) => rel.relationType === "delegate" || rel.relationType === "delegate_to").map((rel) => rel.targetSubAgentId).filter((id) => id !== null);
|
|
216340
|
+
const canDelegateToExternal = externalAgentRelations.filter((rel) => rel.subAgentId === agent2.id).map((rel) => ({
|
|
216341
|
+
externalAgentId: rel.externalAgentId,
|
|
216342
|
+
subAgentExternalAgentRelationId: rel.id,
|
|
216343
|
+
headers: rel.headers
|
|
216344
|
+
}));
|
|
216345
|
+
const canDelegateTo = [...canDelegateToInternal, ...canDelegateToExternal];
|
|
216135
216346
|
const subAgentTools = await db.select({
|
|
216136
216347
|
id: tools.id,
|
|
216137
216348
|
name: tools.name,
|
|
@@ -216236,10 +216447,10 @@ var getFullAgentDefinition = (db) => async ({
|
|
|
216236
216447
|
})
|
|
216237
216448
|
);
|
|
216238
216449
|
const externalAgents2 = await Promise.all(
|
|
216239
|
-
Array.from(externalSubAgentIds).map(async (
|
|
216450
|
+
Array.from(externalSubAgentIds).map(async (externalAgentId) => {
|
|
216240
216451
|
const subAgent = await getExternalAgent(db)({
|
|
216241
|
-
scopes: { tenantId, projectId
|
|
216242
|
-
|
|
216452
|
+
scopes: { tenantId, projectId },
|
|
216453
|
+
externalAgentId
|
|
216243
216454
|
});
|
|
216244
216455
|
if (!subAgent) return null;
|
|
216245
216456
|
return {
|
|
@@ -216248,24 +216459,26 @@ var getFullAgentDefinition = (db) => async ({
|
|
|
216248
216459
|
};
|
|
216249
216460
|
})
|
|
216250
216461
|
);
|
|
216251
|
-
const validSubAgents =
|
|
216462
|
+
const validSubAgents = processedSubAgents.filter(
|
|
216463
|
+
(agent2) => agent2 !== null
|
|
216464
|
+
);
|
|
216465
|
+
const validExternalAgents = externalAgents2.filter(
|
|
216252
216466
|
(agent2) => agent2 !== null
|
|
216253
216467
|
);
|
|
216254
216468
|
const agentsObject = {};
|
|
216469
|
+
const externalAgentsObject = {};
|
|
216255
216470
|
for (const subAgent of validSubAgents) {
|
|
216256
|
-
|
|
216257
|
-
|
|
216258
|
-
|
|
216259
|
-
|
|
216260
|
-
|
|
216261
|
-
|
|
216262
|
-
|
|
216263
|
-
|
|
216264
|
-
|
|
216265
|
-
|
|
216266
|
-
}
|
|
216267
|
-
agentsObject[subAgent.id] = subAgent;
|
|
216268
|
-
}
|
|
216471
|
+
agentsObject[subAgent.id] = subAgent;
|
|
216472
|
+
}
|
|
216473
|
+
for (const externalAgent of validExternalAgents) {
|
|
216474
|
+
externalAgentsObject[externalAgent.id] = {
|
|
216475
|
+
id: externalAgent.id,
|
|
216476
|
+
name: externalAgent.name,
|
|
216477
|
+
description: externalAgent.description,
|
|
216478
|
+
baseUrl: externalAgent.baseUrl,
|
|
216479
|
+
credentialReferenceId: externalAgent.credentialReferenceId,
|
|
216480
|
+
type: "external"
|
|
216481
|
+
};
|
|
216269
216482
|
}
|
|
216270
216483
|
let contextConfig2 = null;
|
|
216271
216484
|
if (agent.contextConfigId) {
|
|
@@ -216325,6 +216538,9 @@ var getFullAgentDefinition = (db) => async ({
|
|
|
216325
216538
|
createdAt: agent.createdAt && !Number.isNaN(new Date(agent.createdAt).getTime()) ? new Date(agent.createdAt).toISOString() : (/* @__PURE__ */ new Date()).toISOString(),
|
|
216326
216539
|
updatedAt: agent.updatedAt && !Number.isNaN(new Date(agent.updatedAt).getTime()) ? new Date(agent.updatedAt).toISOString() : (/* @__PURE__ */ new Date()).toISOString()
|
|
216327
216540
|
};
|
|
216541
|
+
if (Object.keys(externalAgentsObject).length > 0) {
|
|
216542
|
+
result.externalAgents = externalAgentsObject;
|
|
216543
|
+
}
|
|
216328
216544
|
if (agent.models) {
|
|
216329
216545
|
result.models = agent.models;
|
|
216330
216546
|
}
|
|
@@ -216452,7 +216668,7 @@ var getFullAgentDefinition = (db) => async ({
|
|
|
216452
216668
|
return result;
|
|
216453
216669
|
};
|
|
216454
216670
|
var upsertAgent = (db) => async (params) => {
|
|
216455
|
-
const agentId = params.data.id ||
|
|
216671
|
+
const agentId = params.data.id || generateId();
|
|
216456
216672
|
const scopes = { tenantId: params.data.tenantId, projectId: params.data.projectId, agentId };
|
|
216457
216673
|
const existing = await getAgentById(db)({
|
|
216458
216674
|
scopes
|
|
@@ -216752,7 +216968,7 @@ var getArtifactComponentsForAgent = (db) => async (params) => {
|
|
|
216752
216968
|
};
|
|
216753
216969
|
var associateArtifactComponentWithAgent = (db) => async (params) => {
|
|
216754
216970
|
const [association] = await db.insert(subAgentArtifactComponents).values({
|
|
216755
|
-
id:
|
|
216971
|
+
id: generateId(),
|
|
216756
216972
|
tenantId: params.scopes.tenantId,
|
|
216757
216973
|
projectId: params.scopes.projectId,
|
|
216758
216974
|
agentId: params.scopes.agentId,
|
|
@@ -216915,7 +217131,7 @@ var getCacheEntry = (db) => async (params) => {
|
|
|
216915
217131
|
var setCacheEntry = (db) => async (entry) => {
|
|
216916
217132
|
try {
|
|
216917
217133
|
const cacheData = {
|
|
216918
|
-
id:
|
|
217134
|
+
id: generateId(),
|
|
216919
217135
|
tenantId: entry.tenantId,
|
|
216920
217136
|
projectId: entry.projectId,
|
|
216921
217137
|
conversationId: entry.conversationId,
|
|
@@ -217361,7 +217577,7 @@ var getDataComponentsForAgent = (db) => async (params) => {
|
|
|
217361
217577
|
};
|
|
217362
217578
|
var associateDataComponentWithAgent = (db) => async (params) => {
|
|
217363
217579
|
const association = await db.insert(subAgentDataComponents).values({
|
|
217364
|
-
id:
|
|
217580
|
+
id: generateId(),
|
|
217365
217581
|
tenantId: params.scopes.tenantId,
|
|
217366
217582
|
projectId: params.scopes.projectId,
|
|
217367
217583
|
agentId: params.scopes.agentId,
|
|
@@ -217509,7 +217725,7 @@ async function applyExecutionLimitsInheritance(db, logger13, scopes, agentData)
|
|
|
217509
217725
|
"Propagating stepCountIs to agents"
|
|
217510
217726
|
);
|
|
217511
217727
|
for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) {
|
|
217512
|
-
if (
|
|
217728
|
+
if (subAgentData.canTransferTo && Array.isArray(subAgentData.canTransferTo)) {
|
|
217513
217729
|
const agent = agentData;
|
|
217514
217730
|
if (!agent.stopWhen) {
|
|
217515
217731
|
agent.stopWhen = {};
|
|
@@ -217550,7 +217766,7 @@ var createFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
217550
217766
|
logger13.info({}, "MCP Tools are project-scoped - skipping tool creation in agent");
|
|
217551
217767
|
let finalAgentId;
|
|
217552
217768
|
try {
|
|
217553
|
-
const agentId = typed.id ||
|
|
217769
|
+
const agentId = typed.id || generateId();
|
|
217554
217770
|
logger13.info({ agentId }, "Creating agent metadata");
|
|
217555
217771
|
const agent = await upsertAgent(db)({
|
|
217556
217772
|
data: {
|
|
@@ -217722,85 +217938,39 @@ var createFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
217722
217938
|
"All function tools created successfully"
|
|
217723
217939
|
);
|
|
217724
217940
|
}
|
|
217725
|
-
const
|
|
217726
|
-
|
|
217727
|
-
|
|
217728
|
-
|
|
217729
|
-
|
|
217730
|
-
|
|
217731
|
-
|
|
217732
|
-
|
|
217733
|
-
|
|
217734
|
-
|
|
217735
|
-
|
|
217736
|
-
|
|
217737
|
-
|
|
217738
|
-
|
|
217739
|
-
|
|
217740
|
-
|
|
217741
|
-
|
|
217742
|
-
|
|
217743
|
-
|
|
217744
|
-
|
|
217745
|
-
|
|
217746
|
-
|
|
217747
|
-
|
|
217748
|
-
|
|
217749
|
-
await Promise.all(internalAgentPromises);
|
|
217750
|
-
const internalAgentCount = Object.entries(typed.subAgents).filter(
|
|
217751
|
-
([_, agentData2]) => isInternalAgent(agentData2)
|
|
217752
|
-
).length;
|
|
217753
|
-
logger13.info({ internalAgentCount }, "All internal agents created/updated successfully");
|
|
217754
|
-
const externalAgentPromises = Object.entries(typed.subAgents).filter(([_, agentData2]) => isExternalAgent(agentData2)).map(async ([subAgentId, agentData2]) => {
|
|
217755
|
-
const externalAgent = agentData2;
|
|
217756
|
-
try {
|
|
217757
|
-
logger13.info({ subAgentId }, "Processing external agent");
|
|
217758
|
-
await upsertExternalAgent(db)({
|
|
217759
|
-
data: {
|
|
217760
|
-
id: subAgentId,
|
|
217761
|
-
tenantId,
|
|
217762
|
-
projectId,
|
|
217763
|
-
agentId: finalAgentId,
|
|
217764
|
-
name: externalAgent.name,
|
|
217765
|
-
description: externalAgent.description || "",
|
|
217766
|
-
baseUrl: externalAgent.baseUrl,
|
|
217767
|
-
credentialReferenceId: externalAgent.credentialReferenceId || void 0,
|
|
217768
|
-
headers: externalAgent.headers || void 0
|
|
217769
|
-
}
|
|
217770
|
-
});
|
|
217771
|
-
logger13.info({ subAgentId }, "External agent processed successfully");
|
|
217772
|
-
} catch (error) {
|
|
217773
|
-
logger13.error({ subAgentId, error }, "Failed to create/update external agent");
|
|
217774
|
-
throw error;
|
|
217775
|
-
}
|
|
217776
|
-
});
|
|
217777
|
-
await Promise.all(externalAgentPromises);
|
|
217778
|
-
const externalAgentCount = Object.entries(typed.subAgents).filter(
|
|
217779
|
-
([_, agentData2]) => isExternalAgent(agentData2)
|
|
217780
|
-
).length;
|
|
217781
|
-
logger13.info({ externalAgentCount }, "All external agents created/updated successfully");
|
|
217782
|
-
if (contextConfigId) {
|
|
217783
|
-
try {
|
|
217784
|
-
logger13.info(
|
|
217785
|
-
{ agentId: finalAgentId, contextConfigId },
|
|
217786
|
-
"Updating agent with context config"
|
|
217787
|
-
);
|
|
217788
|
-
await updateAgent(db)({
|
|
217789
|
-
scopes: { tenantId, projectId, agentId: finalAgentId },
|
|
217790
|
-
data: { contextConfigId }
|
|
217791
|
-
});
|
|
217792
|
-
logger13.info({ agentId: finalAgentId }, "Agent updated with context config");
|
|
217793
|
-
} catch (error) {
|
|
217794
|
-
logger13.error(
|
|
217795
|
-
{ agentId: finalAgentId, error },
|
|
217796
|
-
"Failed to update agent with context config"
|
|
217797
|
-
);
|
|
217798
|
-
throw error;
|
|
217941
|
+
const subAgentPromises = Object.entries(typed.subAgents).map(
|
|
217942
|
+
async ([subAgentId, agentData2]) => {
|
|
217943
|
+
const subAgent = agentData2;
|
|
217944
|
+
try {
|
|
217945
|
+
logger13.info({ subAgentId }, "Processing sub-agent");
|
|
217946
|
+
await upsertSubAgent(db)({
|
|
217947
|
+
data: {
|
|
217948
|
+
id: subAgentId,
|
|
217949
|
+
tenantId,
|
|
217950
|
+
projectId,
|
|
217951
|
+
agentId: finalAgentId,
|
|
217952
|
+
name: subAgent.name || "",
|
|
217953
|
+
description: subAgent.description || "",
|
|
217954
|
+
prompt: subAgent.prompt || "",
|
|
217955
|
+
conversationHistoryConfig: subAgent.conversationHistoryConfig,
|
|
217956
|
+
models: subAgent.models,
|
|
217957
|
+
stopWhen: subAgent.stopWhen
|
|
217958
|
+
}
|
|
217959
|
+
});
|
|
217960
|
+
logger13.info({ subAgentId }, "Sub-agent processed successfully");
|
|
217961
|
+
} catch (error) {
|
|
217962
|
+
logger13.error({ subAgentId, error }, "Failed to create/update sub-agent");
|
|
217963
|
+
throw error;
|
|
217964
|
+
}
|
|
217799
217965
|
}
|
|
217800
|
-
|
|
217966
|
+
);
|
|
217967
|
+
await Promise.all(subAgentPromises);
|
|
217968
|
+
const subAgentCount = Object.entries(typed.subAgents).length;
|
|
217969
|
+
logger13.info({ subAgentCount }, "All sub-agents created/updated successfully");
|
|
217970
|
+
logger13.info({}, "External agents are project-scoped and managed at the project level.");
|
|
217801
217971
|
const agentToolPromises = [];
|
|
217802
217972
|
for (const [subAgentId, agentData2] of Object.entries(typed.subAgents)) {
|
|
217803
|
-
if (
|
|
217973
|
+
if (agentData2.canUse && Array.isArray(agentData2.canUse)) {
|
|
217804
217974
|
for (const canUseItem of agentData2.canUse) {
|
|
217805
217975
|
agentToolPromises.push(
|
|
217806
217976
|
(async () => {
|
|
@@ -217862,7 +218032,7 @@ var createFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
217862
218032
|
);
|
|
217863
218033
|
const agentDataComponentPromises = [];
|
|
217864
218034
|
for (const [subAgentId, agentData2] of Object.entries(typed.subAgents)) {
|
|
217865
|
-
if (
|
|
218035
|
+
if (agentData2.dataComponents) {
|
|
217866
218036
|
for (const dataComponentId of agentData2.dataComponents) {
|
|
217867
218037
|
agentDataComponentPromises.push(
|
|
217868
218038
|
(async () => {
|
|
@@ -217894,7 +218064,7 @@ var createFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
217894
218064
|
logger13.info({}, "All agent-data component relations created");
|
|
217895
218065
|
const agentArtifactComponentPromises = [];
|
|
217896
218066
|
for (const [subAgentId, agentData2] of Object.entries(typed.subAgents)) {
|
|
217897
|
-
if (
|
|
218067
|
+
if (agentData2.artifactComponents) {
|
|
217898
218068
|
for (const artifactComponentId of agentData2.artifactComponents) {
|
|
217899
218069
|
agentArtifactComponentPromises.push(
|
|
217900
218070
|
(async () => {
|
|
@@ -217925,8 +218095,9 @@ var createFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
217925
218095
|
await Promise.all(agentArtifactComponentPromises);
|
|
217926
218096
|
logger13.info({}, "All agent-artifact component relations created");
|
|
217927
218097
|
const subAgentRelationPromises = [];
|
|
218098
|
+
const subAgentExternalAgentRelationPromises = [];
|
|
217928
218099
|
for (const [subAgentId, agentData2] of Object.entries(typed.subAgents)) {
|
|
217929
|
-
if (
|
|
218100
|
+
if (agentData2.canTransferTo) {
|
|
217930
218101
|
for (const targetSubAgentId of agentData2.canTransferTo) {
|
|
217931
218102
|
subAgentRelationPromises.push(
|
|
217932
218103
|
(async () => {
|
|
@@ -217936,7 +218107,7 @@ var createFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
217936
218107
|
"Processing agent transfer relation"
|
|
217937
218108
|
);
|
|
217938
218109
|
await upsertSubAgentRelation(db)({
|
|
217939
|
-
id:
|
|
218110
|
+
id: generateId(),
|
|
217940
218111
|
tenantId,
|
|
217941
218112
|
projectId,
|
|
217942
218113
|
agentId: finalAgentId,
|
|
@@ -217957,48 +218128,98 @@ var createFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
217957
218128
|
})()
|
|
217958
218129
|
);
|
|
217959
218130
|
}
|
|
217960
|
-
|
|
217961
|
-
|
|
217962
|
-
|
|
217963
|
-
|
|
217964
|
-
|
|
217965
|
-
|
|
217966
|
-
|
|
217967
|
-
|
|
217968
|
-
|
|
217969
|
-
|
|
217970
|
-
|
|
217971
|
-
|
|
217972
|
-
|
|
217973
|
-
|
|
217974
|
-
|
|
217975
|
-
|
|
217976
|
-
|
|
217977
|
-
|
|
217978
|
-
|
|
217979
|
-
|
|
217980
|
-
|
|
217981
|
-
|
|
217982
|
-
|
|
217983
|
-
|
|
217984
|
-
|
|
217985
|
-
|
|
217986
|
-
|
|
217987
|
-
|
|
217988
|
-
|
|
217989
|
-
|
|
217990
|
-
|
|
217991
|
-
|
|
217992
|
-
|
|
217993
|
-
|
|
218131
|
+
if (agentData2.canDelegateTo) {
|
|
218132
|
+
for (const targetItem of agentData2.canDelegateTo) {
|
|
218133
|
+
if (typeof targetItem === "string") {
|
|
218134
|
+
subAgentRelationPromises.push(
|
|
218135
|
+
(async () => {
|
|
218136
|
+
try {
|
|
218137
|
+
logger13.info(
|
|
218138
|
+
{ subAgentId, targetSubAgentId: targetItem, type: "delegate" },
|
|
218139
|
+
"Processing sub-agent delegation relation"
|
|
218140
|
+
);
|
|
218141
|
+
await upsertSubAgentRelation(db)({
|
|
218142
|
+
id: generateId(),
|
|
218143
|
+
tenantId,
|
|
218144
|
+
projectId,
|
|
218145
|
+
agentId: finalAgentId,
|
|
218146
|
+
sourceSubAgentId: subAgentId,
|
|
218147
|
+
targetSubAgentId: targetItem,
|
|
218148
|
+
relationType: "delegate"
|
|
218149
|
+
});
|
|
218150
|
+
logger13.info(
|
|
218151
|
+
{ subAgentId, targetSubAgentId: targetItem, type: "delegate" },
|
|
218152
|
+
"Sub-agent delegation relation processed successfully"
|
|
218153
|
+
);
|
|
218154
|
+
} catch (error) {
|
|
218155
|
+
logger13.error(
|
|
218156
|
+
{ subAgentId, targetSubAgentId: targetItem, type: "delegate", error },
|
|
218157
|
+
"Failed to create sub-agent delegation relation"
|
|
218158
|
+
);
|
|
218159
|
+
}
|
|
218160
|
+
})()
|
|
218161
|
+
);
|
|
218162
|
+
} else {
|
|
218163
|
+
subAgentExternalAgentRelationPromises.push(
|
|
218164
|
+
(async () => {
|
|
218165
|
+
try {
|
|
218166
|
+
logger13.info(
|
|
218167
|
+
{
|
|
218168
|
+
subAgentId,
|
|
218169
|
+
externalAgentId: targetItem.externalAgentId,
|
|
218170
|
+
type: "delegate"
|
|
218171
|
+
},
|
|
218172
|
+
"Processing external agent delegation relation"
|
|
218173
|
+
);
|
|
218174
|
+
await upsertSubAgentExternalAgentRelation(db)({
|
|
218175
|
+
scopes: {
|
|
218176
|
+
tenantId,
|
|
218177
|
+
projectId,
|
|
218178
|
+
agentId: finalAgentId,
|
|
218179
|
+
subAgentId
|
|
218180
|
+
},
|
|
218181
|
+
relationId: targetItem.subAgentExternalAgentRelationId,
|
|
218182
|
+
data: {
|
|
218183
|
+
externalAgentId: targetItem.externalAgentId,
|
|
218184
|
+
headers: targetItem.headers || null
|
|
218185
|
+
}
|
|
218186
|
+
});
|
|
218187
|
+
logger13.info(
|
|
218188
|
+
{
|
|
218189
|
+
subAgentId,
|
|
218190
|
+
externalAgentId: targetItem.externalAgentId,
|
|
218191
|
+
type: "delegate"
|
|
218192
|
+
},
|
|
218193
|
+
"External agent delegation relation processed successfully"
|
|
218194
|
+
);
|
|
218195
|
+
} catch (error) {
|
|
218196
|
+
logger13.error(
|
|
218197
|
+
{
|
|
218198
|
+
subAgentId,
|
|
218199
|
+
externalAgentId: targetItem.externalAgentId,
|
|
218200
|
+
type: "delegate",
|
|
218201
|
+
error
|
|
218202
|
+
},
|
|
218203
|
+
"Failed to create external delegation relation"
|
|
218204
|
+
);
|
|
218205
|
+
}
|
|
218206
|
+
})()
|
|
218207
|
+
);
|
|
218208
|
+
}
|
|
218209
|
+
}
|
|
217994
218210
|
}
|
|
217995
218211
|
}
|
|
217996
218212
|
}
|
|
217997
218213
|
await Promise.all(subAgentRelationPromises);
|
|
218214
|
+
await Promise.all(subAgentExternalAgentRelationPromises);
|
|
217998
218215
|
logger13.info(
|
|
217999
218216
|
{ subAgentRelationCount: subAgentRelationPromises.length },
|
|
218000
218217
|
"All sub-agent relations created"
|
|
218001
218218
|
);
|
|
218219
|
+
logger13.info(
|
|
218220
|
+
{ subAgentExternalAgentRelationCount: subAgentExternalAgentRelationPromises.length },
|
|
218221
|
+
"All sub-agent external agent relations created"
|
|
218222
|
+
);
|
|
218002
218223
|
const createdAgent = await getFullAgentDefinition(db)({
|
|
218003
218224
|
scopes: { tenantId, projectId, agentId: finalAgentId }
|
|
218004
218225
|
});
|
|
@@ -218053,7 +218274,7 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218053
218274
|
logger13.info({}, "MCP Tools are project-scoped - skipping tool creation in agent update");
|
|
218054
218275
|
let finalAgentId;
|
|
218055
218276
|
try {
|
|
218056
|
-
const agentId = typedAgentDefinition.id ||
|
|
218277
|
+
const agentId = typedAgentDefinition.id || generateId();
|
|
218057
218278
|
logger13.info({ agentId }, "Getting/creating agent metadata");
|
|
218058
218279
|
const agent = await upsertAgent(db)({
|
|
218059
218280
|
data: {
|
|
@@ -218230,151 +218451,147 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218230
218451
|
"All function tools updated successfully"
|
|
218231
218452
|
);
|
|
218232
218453
|
}
|
|
218233
|
-
const
|
|
218234
|
-
|
|
218235
|
-
|
|
218236
|
-
|
|
218237
|
-
|
|
218238
|
-
|
|
218239
|
-
|
|
218240
|
-
|
|
218241
|
-
|
|
218242
|
-
|
|
218243
|
-
|
|
218244
|
-
|
|
218245
|
-
|
|
218246
|
-
|
|
218247
|
-
|
|
218248
|
-
|
|
218249
|
-
|
|
218250
|
-
|
|
218251
|
-
|
|
218252
|
-
|
|
218253
|
-
|
|
218254
|
-
|
|
218255
|
-
|
|
218256
|
-
|
|
218257
|
-
|
|
218258
|
-
|
|
218259
|
-
|
|
218260
|
-
|
|
218261
|
-
|
|
218262
|
-
|
|
218263
|
-
|
|
218264
|
-
|
|
218265
|
-
|
|
218266
|
-
|
|
218267
|
-
|
|
218454
|
+
const subAgentPromises = Object.entries(typedAgentDefinition.subAgents).map(
|
|
218455
|
+
async ([subAgentId, agentData2]) => {
|
|
218456
|
+
const subAgent = agentData2;
|
|
218457
|
+
let existingSubAgent = null;
|
|
218458
|
+
try {
|
|
218459
|
+
existingSubAgent = await db.query.subAgents.findFirst({
|
|
218460
|
+
where: and(
|
|
218461
|
+
eq(subAgents.id, subAgentId),
|
|
218462
|
+
eq(subAgents.tenantId, tenantId),
|
|
218463
|
+
eq(subAgents.projectId, projectId)
|
|
218464
|
+
),
|
|
218465
|
+
columns: {
|
|
218466
|
+
models: true
|
|
218467
|
+
}
|
|
218468
|
+
});
|
|
218469
|
+
} catch (_error) {
|
|
218470
|
+
}
|
|
218471
|
+
let finalModelSettings = subAgent.models === void 0 ? void 0 : subAgent.models;
|
|
218472
|
+
if (existingSubAgent?.models && typedAgentDefinition.models) {
|
|
218473
|
+
const subAgentModels = existingSubAgent.models;
|
|
218474
|
+
const agentModels = typedAgentDefinition.models;
|
|
218475
|
+
const modelTypes = ["base", "structuredOutput", "summarizer"];
|
|
218476
|
+
const cascadedModels = { ...finalModelSettings };
|
|
218477
|
+
for (const modelType of modelTypes) {
|
|
218478
|
+
if (subAgentModels[modelType]?.model && existingAgentModels?.[modelType]?.model && subAgentModels[modelType].model === existingAgentModels[modelType].model && agentModels[modelType] && (agentModels[modelType].model !== existingAgentModels[modelType]?.model || JSON.stringify(agentModels[modelType].providerOptions) !== JSON.stringify(existingAgentModels[modelType]?.providerOptions))) {
|
|
218479
|
+
cascadedModels[modelType] = agentModels[modelType];
|
|
218480
|
+
logger13.info(
|
|
218481
|
+
{
|
|
218482
|
+
subAgentId,
|
|
218483
|
+
modelType,
|
|
218484
|
+
oldModel: existingAgentModels[modelType]?.model,
|
|
218485
|
+
newModel: agentModels[modelType].model,
|
|
218486
|
+
hasProviderOptions: !!agentModels[modelType].providerOptions
|
|
218487
|
+
},
|
|
218488
|
+
"Cascading model change from parent agent to subAgent"
|
|
218489
|
+
);
|
|
218490
|
+
}
|
|
218268
218491
|
}
|
|
218492
|
+
finalModelSettings = cascadedModels;
|
|
218493
|
+
}
|
|
218494
|
+
try {
|
|
218495
|
+
logger13.info({ subAgentId }, "Processing sub-agent");
|
|
218496
|
+
await upsertSubAgent(db)({
|
|
218497
|
+
data: {
|
|
218498
|
+
id: subAgentId,
|
|
218499
|
+
tenantId,
|
|
218500
|
+
projectId,
|
|
218501
|
+
agentId: finalAgentId,
|
|
218502
|
+
name: subAgent.name || "",
|
|
218503
|
+
description: subAgent.description || "",
|
|
218504
|
+
prompt: subAgent.prompt || "",
|
|
218505
|
+
conversationHistoryConfig: subAgent.conversationHistoryConfig,
|
|
218506
|
+
models: finalModelSettings,
|
|
218507
|
+
stopWhen: subAgent.stopWhen
|
|
218508
|
+
}
|
|
218509
|
+
});
|
|
218510
|
+
logger13.info({ subAgentId }, "Sub-agent processed successfully");
|
|
218511
|
+
} catch (error) {
|
|
218512
|
+
logger13.error({ subAgentId, error }, "Failed to create/update sub-agent");
|
|
218513
|
+
throw error;
|
|
218269
218514
|
}
|
|
218270
|
-
finalModelSettings = cascadedModels;
|
|
218271
|
-
}
|
|
218272
|
-
try {
|
|
218273
|
-
logger13.info({ subAgentId }, "Processing internal agent");
|
|
218274
|
-
await upsertSubAgent(db)({
|
|
218275
|
-
data: {
|
|
218276
|
-
id: subAgentId,
|
|
218277
|
-
tenantId,
|
|
218278
|
-
projectId,
|
|
218279
|
-
agentId: finalAgentId,
|
|
218280
|
-
name: internalAgent.name || "",
|
|
218281
|
-
description: internalAgent.description || "",
|
|
218282
|
-
prompt: internalAgent.prompt || "",
|
|
218283
|
-
conversationHistoryConfig: internalAgent.conversationHistoryConfig,
|
|
218284
|
-
models: finalModelSettings,
|
|
218285
|
-
stopWhen: internalAgent.stopWhen
|
|
218286
|
-
}
|
|
218287
|
-
});
|
|
218288
|
-
logger13.info({ subAgentId }, "Internal agent processed successfully");
|
|
218289
|
-
} catch (error) {
|
|
218290
|
-
logger13.error({ subAgentId, error }, "Failed to create/update internal agent");
|
|
218291
|
-
throw error;
|
|
218292
|
-
}
|
|
218293
|
-
});
|
|
218294
|
-
await Promise.all(internalAgentPromises);
|
|
218295
|
-
const internalAgentCount = Object.entries(typedAgentDefinition.subAgents).filter(
|
|
218296
|
-
([_, agentData2]) => isInternalAgent(agentData2)
|
|
218297
|
-
).length;
|
|
218298
|
-
logger13.info({ internalAgentCount }, "All internal agents created/updated successfully");
|
|
218299
|
-
const externalAgentPromises = Object.entries(typedAgentDefinition.subAgents).filter(([_, agentData2]) => isExternalAgent(agentData2)).map(async ([subAgentId, agentData2]) => {
|
|
218300
|
-
const externalAgent = agentData2;
|
|
218301
|
-
try {
|
|
218302
|
-
logger13.info({ subAgentId }, "Processing external agent");
|
|
218303
|
-
await upsertExternalAgent(db)({
|
|
218304
|
-
data: {
|
|
218305
|
-
id: subAgentId,
|
|
218306
|
-
tenantId,
|
|
218307
|
-
projectId,
|
|
218308
|
-
agentId: finalAgentId,
|
|
218309
|
-
name: externalAgent.name,
|
|
218310
|
-
description: externalAgent.description || "",
|
|
218311
|
-
baseUrl: externalAgent.baseUrl,
|
|
218312
|
-
credentialReferenceId: externalAgent.credentialReferenceId || void 0,
|
|
218313
|
-
headers: externalAgent.headers || void 0
|
|
218314
|
-
}
|
|
218315
|
-
});
|
|
218316
|
-
logger13.info({ subAgentId }, "External agent processed successfully");
|
|
218317
|
-
} catch (error) {
|
|
218318
|
-
logger13.error({ subAgentId, error }, "Failed to create/update external agent");
|
|
218319
|
-
throw error;
|
|
218320
218515
|
}
|
|
218321
|
-
|
|
218322
|
-
await Promise.all(
|
|
218323
|
-
const
|
|
218324
|
-
|
|
218325
|
-
)
|
|
218326
|
-
|
|
218327
|
-
const
|
|
218328
|
-
const existingInternalAgents = await listSubAgents(db)({
|
|
218329
|
-
scopes: { tenantId, projectId, agentId: finalAgentId }
|
|
218330
|
-
});
|
|
218331
|
-
const existingExternalAgents = await listExternalAgents(db)({
|
|
218516
|
+
);
|
|
218517
|
+
await Promise.all(subAgentPromises);
|
|
218518
|
+
const subAgentCount = Object.entries(typedAgentDefinition.subAgents).length;
|
|
218519
|
+
logger13.info({ subAgentCount }, "All sub-agents created/updated successfully");
|
|
218520
|
+
logger13.info({}, "External agents are project-scoped and managed at the project level.");
|
|
218521
|
+
const incomingSubAgentIds = new Set(Object.keys(typedAgentDefinition.subAgents));
|
|
218522
|
+
const existingSubAgents = await listSubAgents(db)({
|
|
218332
218523
|
scopes: { tenantId, projectId, agentId: finalAgentId }
|
|
218333
218524
|
});
|
|
218334
|
-
let
|
|
218335
|
-
for (const
|
|
218336
|
-
if (!
|
|
218525
|
+
let deletedSubAgentCount = 0;
|
|
218526
|
+
for (const subAgent of existingSubAgents) {
|
|
218527
|
+
if (!incomingSubAgentIds.has(subAgent.id)) {
|
|
218337
218528
|
try {
|
|
218338
218529
|
await deleteSubAgent(db)({
|
|
218339
218530
|
scopes: { tenantId, projectId, agentId: finalAgentId },
|
|
218340
|
-
subAgentId:
|
|
218531
|
+
subAgentId: subAgent.id
|
|
218341
218532
|
});
|
|
218342
|
-
|
|
218343
|
-
logger13.info({ subAgentId:
|
|
218533
|
+
deletedSubAgentCount++;
|
|
218534
|
+
logger13.info({ subAgentId: subAgent.id }, "Deleted orphaned sub-agent");
|
|
218344
218535
|
} catch (error) {
|
|
218345
|
-
logger13.error(
|
|
218346
|
-
{ subAgentId: agent.id, error },
|
|
218347
|
-
"Failed to delete orphaned internal agent"
|
|
218348
|
-
);
|
|
218536
|
+
logger13.error({ subAgentId: subAgent.id, error }, "Failed to delete orphaned sub-agent");
|
|
218349
218537
|
}
|
|
218350
218538
|
}
|
|
218351
218539
|
}
|
|
218352
|
-
|
|
218353
|
-
|
|
218354
|
-
|
|
218540
|
+
if (deletedSubAgentCount > 0) {
|
|
218541
|
+
logger13.info(
|
|
218542
|
+
{
|
|
218543
|
+
deletedSubAgentCount
|
|
218544
|
+
},
|
|
218545
|
+
"Deleted orphaned sub-agents from agent"
|
|
218546
|
+
);
|
|
218547
|
+
}
|
|
218548
|
+
const incomingExternalAgentRelationIds = /* @__PURE__ */ new Set();
|
|
218549
|
+
for (const [_subAgentId, agentData2] of Object.entries(typedAgentDefinition.subAgents)) {
|
|
218550
|
+
if (agentData2.canDelegateTo && Array.isArray(agentData2.canDelegateTo)) {
|
|
218551
|
+
for (const delegateItem of agentData2.canDelegateTo) {
|
|
218552
|
+
if (typeof delegateItem === "object" && delegateItem.subAgentExternalAgentRelationId) {
|
|
218553
|
+
incomingExternalAgentRelationIds.add(delegateItem.subAgentExternalAgentRelationId);
|
|
218554
|
+
}
|
|
218555
|
+
}
|
|
218556
|
+
}
|
|
218557
|
+
}
|
|
218558
|
+
const existingExternalAgentRelations = await getSubAgentExternalAgentRelationsByAgent(db)({
|
|
218559
|
+
scopes: { tenantId, projectId, agentId: finalAgentId }
|
|
218560
|
+
});
|
|
218561
|
+
let deletedExternalAgentRelationCount = 0;
|
|
218562
|
+
for (const relation of existingExternalAgentRelations) {
|
|
218563
|
+
if (!incomingExternalAgentRelationIds.has(relation.id)) {
|
|
218355
218564
|
try {
|
|
218356
|
-
await
|
|
218357
|
-
scopes: {
|
|
218358
|
-
|
|
218565
|
+
await deleteSubAgentExternalAgentRelation(db)({
|
|
218566
|
+
scopes: {
|
|
218567
|
+
tenantId,
|
|
218568
|
+
projectId,
|
|
218569
|
+
agentId: finalAgentId,
|
|
218570
|
+
subAgentId: relation.subAgentId
|
|
218571
|
+
},
|
|
218572
|
+
relationId: relation.id
|
|
218359
218573
|
});
|
|
218360
|
-
|
|
218361
|
-
logger13.info(
|
|
218574
|
+
deletedExternalAgentRelationCount++;
|
|
218575
|
+
logger13.info(
|
|
218576
|
+
{
|
|
218577
|
+
relationId: relation.id,
|
|
218578
|
+
subAgentId: relation.subAgentId,
|
|
218579
|
+
externalAgentId: relation.externalAgentId
|
|
218580
|
+
},
|
|
218581
|
+
"Deleted orphaned external agent relation"
|
|
218582
|
+
);
|
|
218362
218583
|
} catch (error) {
|
|
218363
218584
|
logger13.error(
|
|
218364
|
-
{
|
|
218365
|
-
"Failed to delete orphaned external agent"
|
|
218585
|
+
{ relationId: relation.id, error },
|
|
218586
|
+
"Failed to delete orphaned external agent relation"
|
|
218366
218587
|
);
|
|
218367
218588
|
}
|
|
218368
218589
|
}
|
|
218369
218590
|
}
|
|
218370
|
-
if (
|
|
218591
|
+
if (deletedExternalAgentRelationCount > 0) {
|
|
218371
218592
|
logger13.info(
|
|
218372
|
-
{
|
|
218373
|
-
|
|
218374
|
-
deletedExternalCount,
|
|
218375
|
-
totalDeleted: deletedInternalCount + deletedExternalCount
|
|
218376
|
-
},
|
|
218377
|
-
"Deleted orphaned agents from agent"
|
|
218593
|
+
{ deletedExternalAgentRelationCount },
|
|
218594
|
+
"Deleted orphaned external agent relations from agent"
|
|
218378
218595
|
);
|
|
218379
218596
|
}
|
|
218380
218597
|
await updateAgent(db)({
|
|
@@ -218393,7 +218610,7 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218393
218610
|
logger13.info({ agentId: typedAgentDefinition.id }, "Agent metadata updated");
|
|
218394
218611
|
const incomingRelationshipIds = /* @__PURE__ */ new Set();
|
|
218395
218612
|
for (const [_subAgentId, agentData2] of Object.entries(typedAgentDefinition.subAgents)) {
|
|
218396
|
-
if (
|
|
218613
|
+
if (agentData2.canUse && Array.isArray(agentData2.canUse)) {
|
|
218397
218614
|
for (const canUseItem of agentData2.canUse) {
|
|
218398
218615
|
if (canUseItem.agentToolRelationId) {
|
|
218399
218616
|
incomingRelationshipIds.add(canUseItem.agentToolRelationId);
|
|
@@ -218433,17 +218650,20 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218433
218650
|
logger13.error({ subAgentId, error }, "Failed to delete orphaned agent-tool relations");
|
|
218434
218651
|
}
|
|
218435
218652
|
}
|
|
218436
|
-
const
|
|
218653
|
+
const subAgentToolPromises = [];
|
|
218437
218654
|
for (const [subAgentId, agentData2] of Object.entries(typedAgentDefinition.subAgents)) {
|
|
218438
|
-
if (
|
|
218655
|
+
if (agentData2.canUse && Array.isArray(agentData2.canUse)) {
|
|
218439
218656
|
for (const canUseItem of agentData2.canUse) {
|
|
218440
|
-
|
|
218657
|
+
subAgentToolPromises.push(
|
|
218441
218658
|
(async () => {
|
|
218442
218659
|
try {
|
|
218443
218660
|
const { toolId, toolSelection, headers: headers2, agentToolRelationId } = canUseItem;
|
|
218444
218661
|
const isFunctionTool = typedAgentDefinition.functionTools && toolId in typedAgentDefinition.functionTools;
|
|
218445
218662
|
if (isFunctionTool) {
|
|
218446
|
-
logger13.info(
|
|
218663
|
+
logger13.info(
|
|
218664
|
+
{ subAgentId, toolId },
|
|
218665
|
+
"Processing sub-agent-function tool relation"
|
|
218666
|
+
);
|
|
218447
218667
|
await upsertSubAgentFunctionToolRelation(db)({
|
|
218448
218668
|
scopes: { tenantId, projectId, agentId: finalAgentId },
|
|
218449
218669
|
subAgentId,
|
|
@@ -218452,10 +218672,10 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218452
218672
|
});
|
|
218453
218673
|
logger13.info(
|
|
218454
218674
|
{ subAgentId, toolId, relationId: agentToolRelationId },
|
|
218455
|
-
"
|
|
218675
|
+
"Sub-agent-function tool relation upserted"
|
|
218456
218676
|
);
|
|
218457
218677
|
} else {
|
|
218458
|
-
logger13.info({ subAgentId, toolId }, "Processing agent-MCP tool relation");
|
|
218678
|
+
logger13.info({ subAgentId, toolId }, "Processing sub-agent-MCP tool relation");
|
|
218459
218679
|
await upsertSubAgentToolRelation(db)({
|
|
218460
218680
|
scopes: { tenantId, projectId, agentId: finalAgentId },
|
|
218461
218681
|
subAgentId,
|
|
@@ -218466,7 +218686,7 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218466
218686
|
});
|
|
218467
218687
|
logger13.info(
|
|
218468
218688
|
{ subAgentId, toolId, relationId: agentToolRelationId },
|
|
218469
|
-
"
|
|
218689
|
+
"Sub-agent-MCP tool relation upserted"
|
|
218470
218690
|
);
|
|
218471
218691
|
}
|
|
218472
218692
|
} catch (error) {
|
|
@@ -218485,10 +218705,10 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218485
218705
|
}
|
|
218486
218706
|
}
|
|
218487
218707
|
}
|
|
218488
|
-
await Promise.all(
|
|
218708
|
+
await Promise.all(subAgentToolPromises);
|
|
218489
218709
|
logger13.info(
|
|
218490
|
-
{
|
|
218491
|
-
"All agent-tool relations updated"
|
|
218710
|
+
{ subAgentToolPromisesCount: subAgentToolPromises.length },
|
|
218711
|
+
"All sub-agent-tool relations updated"
|
|
218492
218712
|
);
|
|
218493
218713
|
for (const subAgentId of Object.keys(typedAgentDefinition.subAgents)) {
|
|
218494
218714
|
await deleteAgentDataComponentRelationByAgent(db)({
|
|
@@ -218497,7 +218717,7 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218497
218717
|
}
|
|
218498
218718
|
const agentDataComponentPromises = [];
|
|
218499
218719
|
for (const [subAgentId, agentData2] of Object.entries(typedAgentDefinition.subAgents)) {
|
|
218500
|
-
if (
|
|
218720
|
+
if (agentData2.dataComponents) {
|
|
218501
218721
|
for (const dataComponentId of agentData2.dataComponents) {
|
|
218502
218722
|
agentDataComponentPromises.push(
|
|
218503
218723
|
(async () => {
|
|
@@ -218508,12 +218728,12 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218508
218728
|
});
|
|
218509
218729
|
logger13.info(
|
|
218510
218730
|
{ subAgentId, dataComponentId },
|
|
218511
|
-
"
|
|
218731
|
+
"Sub-agent-dataComponent relation created"
|
|
218512
218732
|
);
|
|
218513
218733
|
} catch (error) {
|
|
218514
218734
|
logger13.error(
|
|
218515
218735
|
{ subAgentId, dataComponentId, error },
|
|
218516
|
-
"Failed to create agent-dataComponent relation"
|
|
218736
|
+
"Failed to create sub-agent-dataComponent relation"
|
|
218517
218737
|
);
|
|
218518
218738
|
}
|
|
218519
218739
|
})()
|
|
@@ -218524,7 +218744,7 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218524
218744
|
await Promise.all(agentDataComponentPromises);
|
|
218525
218745
|
logger13.info(
|
|
218526
218746
|
{ agentDataComponentPromisesCount: agentDataComponentPromises.length },
|
|
218527
|
-
"All agent-dataComponent relations updated"
|
|
218747
|
+
"All sub-agent-dataComponent relations updated"
|
|
218528
218748
|
);
|
|
218529
218749
|
for (const subAgentId of Object.keys(typedAgentDefinition.subAgents)) {
|
|
218530
218750
|
await deleteAgentArtifactComponentRelationByAgent(db)({
|
|
@@ -218533,7 +218753,7 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218533
218753
|
}
|
|
218534
218754
|
const agentArtifactComponentPromises = [];
|
|
218535
218755
|
for (const [subAgentId, agentData2] of Object.entries(typedAgentDefinition.subAgents)) {
|
|
218536
|
-
if (
|
|
218756
|
+
if (agentData2.artifactComponents) {
|
|
218537
218757
|
for (const artifactComponentId of agentData2.artifactComponents) {
|
|
218538
218758
|
agentArtifactComponentPromises.push(
|
|
218539
218759
|
(async () => {
|
|
@@ -218544,12 +218764,12 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218544
218764
|
});
|
|
218545
218765
|
logger13.info(
|
|
218546
218766
|
{ subAgentId, artifactComponentId },
|
|
218547
|
-
"
|
|
218767
|
+
"Sub-agent-artifactComponent relation created"
|
|
218548
218768
|
);
|
|
218549
218769
|
} catch (error) {
|
|
218550
218770
|
logger13.error(
|
|
218551
218771
|
{ subAgentId, artifactComponentId, error },
|
|
218552
|
-
"Failed to create agent-artifactComponent relation"
|
|
218772
|
+
"Failed to create sub-agent-artifactComponent relation"
|
|
218553
218773
|
);
|
|
218554
218774
|
}
|
|
218555
218775
|
})()
|
|
@@ -218560,37 +218780,29 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218560
218780
|
await Promise.all(agentArtifactComponentPromises);
|
|
218561
218781
|
logger13.info(
|
|
218562
218782
|
{ agentArtifactComponentPromisesCount: agentArtifactComponentPromises.length },
|
|
218563
|
-
"All agent-artifactComponent relations updated"
|
|
218783
|
+
"All sub-agent-artifactComponent relations updated"
|
|
218564
218784
|
);
|
|
218565
218785
|
await deleteAgentRelationsByAgent(db)({
|
|
218566
218786
|
scopes: { tenantId, projectId, agentId: typedAgentDefinition.id }
|
|
218567
218787
|
});
|
|
218568
|
-
const
|
|
218788
|
+
const subAgentRelationPromises = [];
|
|
218789
|
+
const subAgentExternalAgentRelationPromises = [];
|
|
218569
218790
|
for (const [subAgentId, agentData2] of Object.entries(typedAgentDefinition.subAgents)) {
|
|
218570
|
-
if (
|
|
218791
|
+
if (agentData2.canTransferTo) {
|
|
218571
218792
|
for (const targetSubAgentId of agentData2.canTransferTo) {
|
|
218572
|
-
|
|
218793
|
+
subAgentRelationPromises.push(
|
|
218573
218794
|
(async () => {
|
|
218574
218795
|
try {
|
|
218575
|
-
const targetAgentData = typedAgentDefinition.subAgents[targetSubAgentId];
|
|
218576
|
-
const isTargetExternal = isExternalAgent(targetAgentData);
|
|
218577
|
-
const targetField = isTargetExternal ? "externalSubAgentId" : "targetSubAgentId";
|
|
218578
|
-
const relationData = {
|
|
218579
|
-
id: nanoid(),
|
|
218580
|
-
agentId: typedAgentDefinition.id || "",
|
|
218581
|
-
sourceSubAgentId: subAgentId,
|
|
218582
|
-
relationType: "transfer",
|
|
218583
|
-
[targetField]: targetSubAgentId
|
|
218584
|
-
};
|
|
218585
218796
|
await createSubAgentRelation(db)({
|
|
218586
218797
|
tenantId,
|
|
218587
218798
|
projectId,
|
|
218588
|
-
|
|
218799
|
+
id: generateId(),
|
|
218800
|
+
agentId: typedAgentDefinition.id || "",
|
|
218801
|
+
sourceSubAgentId: subAgentId,
|
|
218802
|
+
targetSubAgentId,
|
|
218803
|
+
relationType: "transfer"
|
|
218589
218804
|
});
|
|
218590
|
-
logger13.info(
|
|
218591
|
-
{ subAgentId, targetSubAgentId, isTargetExternal },
|
|
218592
|
-
"Transfer relation created"
|
|
218593
|
-
);
|
|
218805
|
+
logger13.info({ subAgentId, targetSubAgentId }, "Transfer relation created");
|
|
218594
218806
|
} catch (error) {
|
|
218595
218807
|
logger13.error(
|
|
218596
218808
|
{ subAgentId, targetSubAgentId, error },
|
|
@@ -218601,42 +218813,77 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218601
218813
|
);
|
|
218602
218814
|
}
|
|
218603
218815
|
}
|
|
218604
|
-
if (
|
|
218605
|
-
for (const
|
|
218606
|
-
|
|
218607
|
-
|
|
218608
|
-
|
|
218609
|
-
|
|
218610
|
-
|
|
218611
|
-
|
|
218612
|
-
|
|
218613
|
-
|
|
218614
|
-
|
|
218615
|
-
|
|
218616
|
-
|
|
218617
|
-
|
|
218618
|
-
|
|
218619
|
-
|
|
218620
|
-
|
|
218621
|
-
|
|
218622
|
-
|
|
218623
|
-
})
|
|
218624
|
-
|
|
218625
|
-
|
|
218626
|
-
|
|
218627
|
-
|
|
218628
|
-
|
|
218629
|
-
|
|
218630
|
-
|
|
218631
|
-
|
|
218632
|
-
|
|
218816
|
+
if (agentData2.canDelegateTo) {
|
|
218817
|
+
for (const targetItem of agentData2.canDelegateTo) {
|
|
218818
|
+
if (typeof targetItem === "string") {
|
|
218819
|
+
subAgentRelationPromises.push(
|
|
218820
|
+
(async () => {
|
|
218821
|
+
try {
|
|
218822
|
+
await createSubAgentRelation(db)({
|
|
218823
|
+
tenantId,
|
|
218824
|
+
projectId,
|
|
218825
|
+
id: generateId(),
|
|
218826
|
+
agentId: typedAgentDefinition.id || "",
|
|
218827
|
+
sourceSubAgentId: subAgentId,
|
|
218828
|
+
targetSubAgentId: targetItem,
|
|
218829
|
+
relationType: "delegate"
|
|
218830
|
+
});
|
|
218831
|
+
logger13.info(
|
|
218832
|
+
{ subAgentId, targetSubAgentId: targetItem },
|
|
218833
|
+
"Sub-agent delegation relation created"
|
|
218834
|
+
);
|
|
218835
|
+
} catch (error) {
|
|
218836
|
+
logger13.error(
|
|
218837
|
+
{ subAgentId, targetSubAgentId: targetItem, error },
|
|
218838
|
+
"Failed to create sub-agent delegation relation"
|
|
218839
|
+
);
|
|
218840
|
+
}
|
|
218841
|
+
})()
|
|
218842
|
+
);
|
|
218843
|
+
} else {
|
|
218844
|
+
subAgentExternalAgentRelationPromises.push(
|
|
218845
|
+
(async () => {
|
|
218846
|
+
try {
|
|
218847
|
+
await upsertSubAgentExternalAgentRelation(db)({
|
|
218848
|
+
scopes: {
|
|
218849
|
+
tenantId,
|
|
218850
|
+
projectId,
|
|
218851
|
+
agentId: typedAgentDefinition.id || "",
|
|
218852
|
+
subAgentId
|
|
218853
|
+
},
|
|
218854
|
+
relationId: targetItem.subAgentExternalAgentRelationId,
|
|
218855
|
+
data: {
|
|
218856
|
+
externalAgentId: targetItem.externalAgentId,
|
|
218857
|
+
headers: targetItem.headers || null
|
|
218858
|
+
}
|
|
218859
|
+
});
|
|
218860
|
+
logger13.info(
|
|
218861
|
+
{ subAgentId, externalAgentId: targetItem.externalAgentId },
|
|
218862
|
+
"External delegation relation created"
|
|
218863
|
+
);
|
|
218864
|
+
} catch (error) {
|
|
218865
|
+
logger13.error(
|
|
218866
|
+
{ subAgentId, externalAgentId: targetItem.externalAgentId, error },
|
|
218867
|
+
"Failed to create external delegation relation"
|
|
218868
|
+
);
|
|
218869
|
+
}
|
|
218870
|
+
})()
|
|
218871
|
+
);
|
|
218872
|
+
}
|
|
218633
218873
|
}
|
|
218634
218874
|
}
|
|
218635
218875
|
}
|
|
218636
|
-
await Promise.all(
|
|
218876
|
+
await Promise.all(subAgentRelationPromises);
|
|
218877
|
+
logger13.info(
|
|
218878
|
+
{ subAgentRelationPromisesCount: subAgentRelationPromises.length },
|
|
218879
|
+
"All sub-agent relations updated"
|
|
218880
|
+
);
|
|
218881
|
+
await Promise.all(subAgentExternalAgentRelationPromises);
|
|
218637
218882
|
logger13.info(
|
|
218638
|
-
{
|
|
218639
|
-
|
|
218883
|
+
{
|
|
218884
|
+
subAgentExternalAgentRelationPromisesCount: subAgentExternalAgentRelationPromises.length
|
|
218885
|
+
},
|
|
218886
|
+
"All sub-agent external agent relations updated"
|
|
218640
218887
|
);
|
|
218641
218888
|
const updatedAgent = await getFullAgentDefinition(db)({
|
|
218642
218889
|
scopes: { tenantId, projectId, agentId: typedAgentDefinition.id }
|
|
@@ -218825,7 +219072,7 @@ var upsertLedgerArtifact = (db) => async (params) => {
|
|
|
218825
219072
|
const sanitizedArt = sanitizeArtifactForDatabase(artifact);
|
|
218826
219073
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
218827
219074
|
const artifactRow = {
|
|
218828
|
-
id: sanitizedArt.artifactId ??
|
|
219075
|
+
id: sanitizedArt.artifactId ?? generateId(),
|
|
218829
219076
|
tenantId: scopes.tenantId,
|
|
218830
219077
|
projectId: scopes.projectId,
|
|
218831
219078
|
taskId,
|
|
@@ -218875,7 +219122,7 @@ var addLedgerArtifacts = (db) => async (params) => {
|
|
|
218875
219122
|
const sanitizedArt = sanitizeArtifactForDatabase(art);
|
|
218876
219123
|
const resolvedTaskId = taskId ?? sanitizedArt.taskId ?? sanitizedArt.metadata?.taskId ?? null;
|
|
218877
219124
|
return {
|
|
218878
|
-
id: sanitizedArt.artifactId ??
|
|
219125
|
+
id: sanitizedArt.artifactId ?? generateId(),
|
|
218879
219126
|
tenantId: scopes.tenantId,
|
|
218880
219127
|
projectId: scopes.projectId,
|
|
218881
219128
|
taskId: resolvedTaskId,
|
|
@@ -219443,6 +219690,50 @@ var createFullProjectServerSide = (db, logger13 = defaultLogger2) => async (scop
|
|
|
219443
219690
|
"All project tools created successfully"
|
|
219444
219691
|
);
|
|
219445
219692
|
}
|
|
219693
|
+
if (typed.externalAgents && Object.keys(typed.externalAgents).length > 0) {
|
|
219694
|
+
logger13.info(
|
|
219695
|
+
{
|
|
219696
|
+
projectId: typed.id,
|
|
219697
|
+
count: Object.keys(typed.externalAgents).length
|
|
219698
|
+
},
|
|
219699
|
+
"Creating project externalAgents"
|
|
219700
|
+
);
|
|
219701
|
+
const externalAgentPromises = Object.entries(typed.externalAgents).map(
|
|
219702
|
+
async ([externalAgentId, externalAgentData]) => {
|
|
219703
|
+
try {
|
|
219704
|
+
logger13.info(
|
|
219705
|
+
{ projectId: typed.id, externalAgentId },
|
|
219706
|
+
"Creating externalAgent in project"
|
|
219707
|
+
);
|
|
219708
|
+
await upsertExternalAgent(db)({
|
|
219709
|
+
data: {
|
|
219710
|
+
...externalAgentData,
|
|
219711
|
+
tenantId,
|
|
219712
|
+
projectId: typed.id
|
|
219713
|
+
}
|
|
219714
|
+
});
|
|
219715
|
+
logger13.info(
|
|
219716
|
+
{ projectId: typed.id, externalAgentId },
|
|
219717
|
+
"ExternalAgent created successfully"
|
|
219718
|
+
);
|
|
219719
|
+
} catch (error) {
|
|
219720
|
+
logger13.error(
|
|
219721
|
+
{ projectId: typed.id, externalAgentId, error },
|
|
219722
|
+
"Failed to create externalAgent in project"
|
|
219723
|
+
);
|
|
219724
|
+
throw error;
|
|
219725
|
+
}
|
|
219726
|
+
}
|
|
219727
|
+
);
|
|
219728
|
+
await Promise.all(externalAgentPromises);
|
|
219729
|
+
logger13.info(
|
|
219730
|
+
{
|
|
219731
|
+
projectId: typed.id,
|
|
219732
|
+
count: Object.keys(typed.externalAgents).length
|
|
219733
|
+
},
|
|
219734
|
+
"All project externalAgents created successfully"
|
|
219735
|
+
);
|
|
219736
|
+
}
|
|
219446
219737
|
if (typed.dataComponents && Object.keys(typed.dataComponents).length > 0) {
|
|
219447
219738
|
logger13.info(
|
|
219448
219739
|
{
|
|
@@ -219550,6 +219841,8 @@ var createFullProjectServerSide = (db, logger13 = defaultLogger2) => async (scop
|
|
|
219550
219841
|
// Pass project-level functions for validation
|
|
219551
219842
|
dataComponents: typed.dataComponents || {},
|
|
219552
219843
|
artifactComponents: typed.artifactComponents || {},
|
|
219844
|
+
externalAgents: typed.externalAgents || {},
|
|
219845
|
+
// Pass project-level external agents
|
|
219553
219846
|
credentialReferences: typed.credentialReferences || {},
|
|
219554
219847
|
statusUpdates: agentData.statusUpdates === null ? void 0 : agentData.statusUpdates
|
|
219555
219848
|
};
|
|
@@ -219751,6 +220044,50 @@ var updateFullProjectServerSide = (db, logger13 = defaultLogger2) => async (scop
|
|
|
219751
220044
|
"All project tools updated successfully"
|
|
219752
220045
|
);
|
|
219753
220046
|
}
|
|
220047
|
+
if (typed.externalAgents && Object.keys(typed.externalAgents).length > 0) {
|
|
220048
|
+
logger13.info(
|
|
220049
|
+
{
|
|
220050
|
+
projectId: typed.id,
|
|
220051
|
+
count: Object.keys(typed.externalAgents).length
|
|
220052
|
+
},
|
|
220053
|
+
"Updating project externalAgents"
|
|
220054
|
+
);
|
|
220055
|
+
const externalAgentPromises = Object.entries(typed.externalAgents).map(
|
|
220056
|
+
async ([externalAgentId, externalAgentData]) => {
|
|
220057
|
+
try {
|
|
220058
|
+
logger13.info(
|
|
220059
|
+
{ projectId: typed.id, externalAgentId },
|
|
220060
|
+
"Updating externalAgent in project"
|
|
220061
|
+
);
|
|
220062
|
+
await upsertExternalAgent(db)({
|
|
220063
|
+
data: {
|
|
220064
|
+
...externalAgentData,
|
|
220065
|
+
tenantId,
|
|
220066
|
+
projectId: typed.id
|
|
220067
|
+
}
|
|
220068
|
+
});
|
|
220069
|
+
logger13.info(
|
|
220070
|
+
{ projectId: typed.id, externalAgentId },
|
|
220071
|
+
"ExternalAgent updated successfully"
|
|
220072
|
+
);
|
|
220073
|
+
} catch (error) {
|
|
220074
|
+
logger13.error(
|
|
220075
|
+
{ projectId: typed.id, externalAgentId, error },
|
|
220076
|
+
"Failed to update externalAgent in project"
|
|
220077
|
+
);
|
|
220078
|
+
throw error;
|
|
220079
|
+
}
|
|
220080
|
+
}
|
|
220081
|
+
);
|
|
220082
|
+
await Promise.all(externalAgentPromises);
|
|
220083
|
+
logger13.info(
|
|
220084
|
+
{
|
|
220085
|
+
projectId: typed.id,
|
|
220086
|
+
count: Object.keys(typed.externalAgents).length
|
|
220087
|
+
},
|
|
220088
|
+
"All project externalAgents updated successfully"
|
|
220089
|
+
);
|
|
220090
|
+
}
|
|
219754
220091
|
if (typed.dataComponents && Object.keys(typed.dataComponents).length > 0) {
|
|
219755
220092
|
logger13.info(
|
|
219756
220093
|
{
|
|
@@ -219891,6 +220228,8 @@ var updateFullProjectServerSide = (db, logger13 = defaultLogger2) => async (scop
|
|
|
219891
220228
|
// Pass project-level functions for validation
|
|
219892
220229
|
dataComponents: typed.dataComponents || {},
|
|
219893
220230
|
artifactComponents: typed.artifactComponents || {},
|
|
220231
|
+
externalAgents: typed.externalAgents || {},
|
|
220232
|
+
// Pass project-level external agents
|
|
219894
220233
|
credentialReferences: typed.credentialReferences || {},
|
|
219895
220234
|
statusUpdates: agentData.statusUpdates === null ? void 0 : agentData.statusUpdates
|
|
219896
220235
|
};
|
|
@@ -219984,6 +220323,30 @@ var getFullProject = (db, logger13 = defaultLogger2) => async (params) => {
|
|
|
219984
220323
|
} catch (error) {
|
|
219985
220324
|
logger13.warn({ tenantId, projectId, error }, "Failed to retrieve tools for project");
|
|
219986
220325
|
}
|
|
220326
|
+
const projectExternalAgents = {};
|
|
220327
|
+
try {
|
|
220328
|
+
const externalAgentsList = await listExternalAgents(db)({
|
|
220329
|
+
scopes: { tenantId, projectId }
|
|
220330
|
+
});
|
|
220331
|
+
for (const externalAgent of externalAgentsList) {
|
|
220332
|
+
projectExternalAgents[externalAgent.id] = {
|
|
220333
|
+
id: externalAgent.id,
|
|
220334
|
+
name: externalAgent.name,
|
|
220335
|
+
description: externalAgent.description,
|
|
220336
|
+
baseUrl: externalAgent.baseUrl,
|
|
220337
|
+
credentialReferenceId: externalAgent.credentialReferenceId || void 0
|
|
220338
|
+
};
|
|
220339
|
+
}
|
|
220340
|
+
logger13.info(
|
|
220341
|
+
{ tenantId, projectId, count: Object.keys(projectExternalAgents).length },
|
|
220342
|
+
"ExternalAgents retrieved for project"
|
|
220343
|
+
);
|
|
220344
|
+
} catch (error) {
|
|
220345
|
+
logger13.warn(
|
|
220346
|
+
{ tenantId, projectId, error },
|
|
220347
|
+
"Failed to retrieve externalAgents for project"
|
|
220348
|
+
);
|
|
220349
|
+
}
|
|
219987
220350
|
const projectDataComponents = {};
|
|
219988
220351
|
try {
|
|
219989
220352
|
const dataComponentsList = await listDataComponents(db)({
|
|
@@ -220095,6 +220458,7 @@ var getFullProject = (db, logger13 = defaultLogger2) => async (params) => {
|
|
|
220095
220458
|
stopWhen: project.stopWhen || void 0,
|
|
220096
220459
|
agents: agents2,
|
|
220097
220460
|
tools: projectTools,
|
|
220461
|
+
externalAgents: projectExternalAgents,
|
|
220098
220462
|
dataComponents: projectDataComponents,
|
|
220099
220463
|
artifactComponents: projectArtifactComponents,
|
|
220100
220464
|
credentialReferences: projectCredentialReferences,
|
|
@@ -220265,6 +220629,8 @@ var createValidatedDataAccess = (db, dataAccessFunctions) => {
|
|
|
220265
220629
|
|
|
220266
220630
|
// src/utils/tracer.ts
|
|
220267
220631
|
var tracer = getTracer("agents-core");
|
|
220632
|
+
|
|
220633
|
+
// src/context/contextCache.ts
|
|
220268
220634
|
var logger7 = getLogger("context-cache");
|
|
220269
220635
|
var ContextCache = class {
|
|
220270
220636
|
constructor(tenantId, projectId, dbClient) {
|
|
@@ -220327,7 +220693,7 @@ var ContextCache = class {
|
|
|
220327
220693
|
async set(entry) {
|
|
220328
220694
|
try {
|
|
220329
220695
|
const cacheData = {
|
|
220330
|
-
id:
|
|
220696
|
+
id: generateId(),
|
|
220331
220697
|
tenantId: this.tenantId,
|
|
220332
220698
|
projectId: this.projectId,
|
|
220333
220699
|
conversationId: entry.conversationId,
|
|
@@ -222534,4 +222900,4 @@ typescript/lib/typescript.js:
|
|
|
222534
222900
|
***************************************************************************** *)
|
|
222535
222901
|
*/
|
|
222536
222902
|
|
|
222537
|
-
export { ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStoreRegistry, CredentialStuffer, ERROR_DOCS_BASE_URL, ErrorCode, HTTP_REQUEST_PARTS, InMemoryCredentialStore, KeyChainStore, McpClient, NangoCredentialStore, TemplateEngine, addFunctionToolToSubAgent, addLedgerArtifacts, addToolToAgent, agentHasArtifactComponents, apiFetch, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent,
|
|
222903
|
+
export { ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStoreRegistry, CredentialStuffer, ERROR_DOCS_BASE_URL, ErrorCode, HTTP_REQUEST_PARTS, InMemoryCredentialStore, KeyChainStore, McpClient, NangoCredentialStore, TemplateEngine, addFunctionToolToSubAgent, addLedgerArtifacts, addToolToAgent, agentHasArtifactComponents, apiFetch, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createFullAgentServerSide, createFullProjectServerSide, createFunctionTool, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createSubAgent, createSubAgentExternalAgentRelation, createSubAgentRelation, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullAgent, deleteFullProject, deleteFunction, deleteFunctionTool, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteSubAgent, deleteSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelationsByAgent, deleteSubAgentExternalAgentRelationsBySubAgent, deleteSubAgentRelation, deleteTool, determineContextTrigger, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, generateId, getActiveAgentForConversation, getAgentById, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentSubAgentInfos, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentWithDefaultSubAgent, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getConversation, getConversationCacheEntries, getConversationHistory, getConversationId, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithResources, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFullAgent, getFullAgentDefinition, getFullProject, getFunction, getFunctionToolById, getFunctionToolsForSubAgent, getLedgerArtifacts, getLedgerArtifactsByContext, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForAgent, getRequestExecutionContext, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentsByIds, getSubAgentsForExternalAgent, getTask, getToolById, getToolsForAgent, getTracer, getVisibleMessages, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, headers, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listFunctionTools, listFunctions, listMessages, listProjects, listProjectsPaginated, listSubAgentExternalAgentRelations, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullAgentServerSide, updateFullProjectServerSide, updateFunctionTool, updateMessage, updateProject, updateSubAgent, updateSubAgentExternalAgentRelation, updateSubAgentFunctionToolRelation, updateTask, updateTool, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertFunction, upsertFunctionTool, upsertLedgerArtifact, upsertSubAgent, upsertSubAgentExternalAgentRelation, upsertSubAgentFunctionToolRelation, upsertSubAgentRelation, upsertSubAgentToolRelation, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateHeaders, validateHttpRequestHeaders, validateProjectExists, validateSubAgent, validationHelper, withProjectValidation };
|