@inkeep/agents-core 0.24.1 → 0.24.2
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/index.cjs +20 -18
- package/dist/index.js +22 -20
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -215842,7 +215842,7 @@ var listContextConfigsPaginated = (db) => async (params) => {
|
|
|
215842
215842
|
};
|
|
215843
215843
|
};
|
|
215844
215844
|
var createContextConfig = (db) => async (params) => {
|
|
215845
|
-
const id = params.id ||
|
|
215845
|
+
const id = params.id || generateId();
|
|
215846
215846
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
215847
215847
|
let contextVariables = params.contextVariables;
|
|
215848
215848
|
if (contextVariables !== void 0 && contextVariables !== null && typeof contextVariables === "object" && Object.keys(contextVariables).length === 0) {
|
|
@@ -216402,7 +216402,7 @@ var addFunctionToolToSubAgent = (db) => {
|
|
|
216402
216402
|
const { scopes, subAgentId, functionToolId } = params;
|
|
216403
216403
|
const { tenantId, projectId, agentId } = scopes;
|
|
216404
216404
|
try {
|
|
216405
|
-
const relationId =
|
|
216405
|
+
const relationId = generateId();
|
|
216406
216406
|
await db.insert(subAgentFunctionToolRelations).values({
|
|
216407
216407
|
id: relationId,
|
|
216408
216408
|
tenantId,
|
|
@@ -216705,7 +216705,7 @@ var deleteAgentRelationsByAgent = (db) => async (params) => {
|
|
|
216705
216705
|
return (result.rowsAffected || 0) > 0;
|
|
216706
216706
|
};
|
|
216707
216707
|
var createAgentToolRelation = (db) => async (params) => {
|
|
216708
|
-
const finalRelationId = params.relationId ??
|
|
216708
|
+
const finalRelationId = params.relationId ?? generateId();
|
|
216709
216709
|
const relation = await db.insert(subAgentToolRelations).values({
|
|
216710
216710
|
id: finalRelationId,
|
|
216711
216711
|
tenantId: params.scopes.tenantId,
|
|
@@ -217126,7 +217126,7 @@ async function generateApiKey() {
|
|
|
217126
217126
|
const key = `sk_${publicId}.${secret}`;
|
|
217127
217127
|
const keyPrefix = key.substring(0, 12);
|
|
217128
217128
|
const keyHash = await hashApiKey(key);
|
|
217129
|
-
const id =
|
|
217129
|
+
const id = generateId();
|
|
217130
217130
|
return {
|
|
217131
217131
|
id,
|
|
217132
217132
|
publicId,
|
|
@@ -218259,7 +218259,7 @@ var deleteTool = (db) => async (params) => {
|
|
|
218259
218259
|
return !!deleted;
|
|
218260
218260
|
};
|
|
218261
218261
|
var addToolToAgent = (db) => async (params) => {
|
|
218262
|
-
const id =
|
|
218262
|
+
const id = generateId();
|
|
218263
218263
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
218264
218264
|
const [created] = await db.insert(subAgentToolRelations).values({
|
|
218265
218265
|
id,
|
|
@@ -218838,7 +218838,7 @@ var getFullAgentDefinition = (db) => async ({
|
|
|
218838
218838
|
return result;
|
|
218839
218839
|
};
|
|
218840
218840
|
var upsertAgent = (db) => async (params) => {
|
|
218841
|
-
const agentId = params.data.id ||
|
|
218841
|
+
const agentId = params.data.id || generateId();
|
|
218842
218842
|
const scopes = { tenantId: params.data.tenantId, projectId: params.data.projectId, agentId };
|
|
218843
218843
|
const existing = await getAgentById(db)({
|
|
218844
218844
|
scopes
|
|
@@ -219242,7 +219242,7 @@ var getArtifactComponentsForAgent = (db) => async (params) => {
|
|
|
219242
219242
|
};
|
|
219243
219243
|
var associateArtifactComponentWithAgent = (db) => async (params) => {
|
|
219244
219244
|
const [association] = await db.insert(subAgentArtifactComponents).values({
|
|
219245
|
-
id:
|
|
219245
|
+
id: generateId(),
|
|
219246
219246
|
tenantId: params.scopes.tenantId,
|
|
219247
219247
|
projectId: params.scopes.projectId,
|
|
219248
219248
|
agentId: params.scopes.agentId,
|
|
@@ -219405,7 +219405,7 @@ var getCacheEntry = (db) => async (params) => {
|
|
|
219405
219405
|
var setCacheEntry = (db) => async (entry) => {
|
|
219406
219406
|
try {
|
|
219407
219407
|
const cacheData = {
|
|
219408
|
-
id:
|
|
219408
|
+
id: generateId(),
|
|
219409
219409
|
tenantId: entry.tenantId,
|
|
219410
219410
|
projectId: entry.projectId,
|
|
219411
219411
|
conversationId: entry.conversationId,
|
|
@@ -219962,7 +219962,7 @@ var getDataComponentsForAgent = (db) => async (params) => {
|
|
|
219962
219962
|
};
|
|
219963
219963
|
var associateDataComponentWithAgent = (db) => async (params) => {
|
|
219964
219964
|
const association = await db.insert(subAgentDataComponents).values({
|
|
219965
|
-
id:
|
|
219965
|
+
id: generateId(),
|
|
219966
219966
|
tenantId: params.scopes.tenantId,
|
|
219967
219967
|
projectId: params.scopes.projectId,
|
|
219968
219968
|
agentId: params.scopes.agentId,
|
|
@@ -220266,7 +220266,7 @@ var createFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
|
|
|
220266
220266
|
logger14.info({}, "MCP Tools are project-scoped - skipping tool creation in agent");
|
|
220267
220267
|
let finalAgentId;
|
|
220268
220268
|
try {
|
|
220269
|
-
const agentId = typed.id ||
|
|
220269
|
+
const agentId = typed.id || generateId();
|
|
220270
220270
|
logger14.info({ agentId }, "Creating agent metadata");
|
|
220271
220271
|
const agent = await upsertAgent(db)({
|
|
220272
220272
|
data: {
|
|
@@ -220652,7 +220652,7 @@ var createFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
|
|
|
220652
220652
|
"Processing agent transfer relation"
|
|
220653
220653
|
);
|
|
220654
220654
|
await upsertSubAgentRelation(db)({
|
|
220655
|
-
id:
|
|
220655
|
+
id: generateId(),
|
|
220656
220656
|
tenantId,
|
|
220657
220657
|
projectId,
|
|
220658
220658
|
agentId: finalAgentId,
|
|
@@ -220686,7 +220686,7 @@ var createFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
|
|
|
220686
220686
|
"Processing agent delegation relation"
|
|
220687
220687
|
);
|
|
220688
220688
|
await upsertSubAgentRelation(db)({
|
|
220689
|
-
id:
|
|
220689
|
+
id: generateId(),
|
|
220690
220690
|
tenantId,
|
|
220691
220691
|
projectId,
|
|
220692
220692
|
agentId: finalAgentId,
|
|
@@ -220769,7 +220769,7 @@ var updateFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
|
|
|
220769
220769
|
logger14.info({}, "MCP Tools are project-scoped - skipping tool creation in agent update");
|
|
220770
220770
|
let finalAgentId;
|
|
220771
220771
|
try {
|
|
220772
|
-
const agentId = typedAgentDefinition.id ||
|
|
220772
|
+
const agentId = typedAgentDefinition.id || generateId();
|
|
220773
220773
|
logger14.info({ agentId }, "Getting/creating agent metadata");
|
|
220774
220774
|
const agent = await upsertAgent(db)({
|
|
220775
220775
|
data: {
|
|
@@ -221292,7 +221292,7 @@ var updateFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
|
|
|
221292
221292
|
const isTargetExternal = isExternalAgent(targetAgentData);
|
|
221293
221293
|
const targetField = isTargetExternal ? "externalSubAgentId" : "targetSubAgentId";
|
|
221294
221294
|
const relationData = {
|
|
221295
|
-
id:
|
|
221295
|
+
id: generateId(),
|
|
221296
221296
|
agentId: typedAgentDefinition.id || "",
|
|
221297
221297
|
sourceSubAgentId: subAgentId,
|
|
221298
221298
|
relationType: "transfer",
|
|
@@ -221326,7 +221326,7 @@ var updateFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
|
|
|
221326
221326
|
(async () => {
|
|
221327
221327
|
try {
|
|
221328
221328
|
const relationData = {
|
|
221329
|
-
id:
|
|
221329
|
+
id: generateId(),
|
|
221330
221330
|
agentId: typedAgentDefinition.id || "",
|
|
221331
221331
|
sourceSubAgentId: subAgentId,
|
|
221332
221332
|
relationType: "delegate",
|
|
@@ -221541,7 +221541,7 @@ var upsertLedgerArtifact = (db) => async (params) => {
|
|
|
221541
221541
|
const sanitizedArt = sanitizeArtifactForDatabase(artifact);
|
|
221542
221542
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
221543
221543
|
const artifactRow = {
|
|
221544
|
-
id: sanitizedArt.artifactId ??
|
|
221544
|
+
id: sanitizedArt.artifactId ?? generateId(),
|
|
221545
221545
|
tenantId: scopes.tenantId,
|
|
221546
221546
|
projectId: scopes.projectId,
|
|
221547
221547
|
taskId,
|
|
@@ -221591,7 +221591,7 @@ var addLedgerArtifacts = (db) => async (params) => {
|
|
|
221591
221591
|
const sanitizedArt = sanitizeArtifactForDatabase(art);
|
|
221592
221592
|
const resolvedTaskId = taskId ?? sanitizedArt.taskId ?? sanitizedArt.metadata?.taskId ?? null;
|
|
221593
221593
|
return {
|
|
221594
|
-
id: sanitizedArt.artifactId ??
|
|
221594
|
+
id: sanitizedArt.artifactId ?? generateId(),
|
|
221595
221595
|
tenantId: scopes.tenantId,
|
|
221596
221596
|
projectId: scopes.projectId,
|
|
221597
221597
|
taskId: resolvedTaskId,
|
|
@@ -222981,6 +222981,8 @@ var createValidatedDataAccess = (db, dataAccessFunctions) => {
|
|
|
222981
222981
|
|
|
222982
222982
|
// src/utils/tracer.ts
|
|
222983
222983
|
var tracer = getTracer("agents-core");
|
|
222984
|
+
|
|
222985
|
+
// src/context/contextCache.ts
|
|
222984
222986
|
var logger8 = getLogger("context-cache");
|
|
222985
222987
|
var ContextCache = class {
|
|
222986
222988
|
constructor(tenantId, projectId, dbClient) {
|
|
@@ -223043,7 +223045,7 @@ var ContextCache = class {
|
|
|
223043
223045
|
async set(entry) {
|
|
223044
223046
|
try {
|
|
223045
223047
|
const cacheData = {
|
|
223046
|
-
id:
|
|
223048
|
+
id: generateId(),
|
|
223047
223049
|
tenantId: this.tenantId,
|
|
223048
223050
|
projectId: this.projectId,
|
|
223049
223051
|
conversationId: entry.conversationId,
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { detectAuthenticationRequired } from './chunk-NJZ3ICNP.js';
|
|
2
2
|
export { ACTIVITY_NAMES, ACTIVITY_STATUS, ACTIVITY_TYPES, AGENT_IDS, AGGREGATE_OPERATORS, AI_OPERATIONS, AI_TOOL_TYPES, DATA_SOURCES, DATA_TYPES, DELEGATION_FROM_SUB_AGENT_ID, DELEGATION_ID, DELEGATION_TO_SUB_AGENT_ID, FIELD_TYPES, OPERATORS, ORDER_DIRECTIONS, PANEL_TYPES, QUERY_DEFAULTS, QUERY_EXPRESSIONS, QUERY_FIELD_CONFIGS, QUERY_TYPES, REDUCE_OPERATIONS, SPAN_KEYS, SPAN_NAMES, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, UNKNOWN_VALUE, detectAuthenticationRequired, exchangeMcpAuthorizationCode, initiateMcpOAuthFlow } from './chunk-NJZ3ICNP.js';
|
|
3
3
|
export { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from './chunk-MQTANAMG.js';
|
|
4
|
-
export { TaskState } from './chunk-H2F72PDA.js';
|
|
5
4
|
import { getLogger, convertZodToJsonSchema } from './chunk-YECQCT5N.js';
|
|
6
5
|
export { PinoLogger, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, getLogger, isZodSchema, loggerFactory, preview } from './chunk-YECQCT5N.js';
|
|
7
6
|
import { validatePreview, validateAndTypeAgentData, validateAgentStructure, isInternalAgent, isExternalAgent } from './chunk-ZGJI6UNK.js';
|
|
@@ -10,11 +9,12 @@ import { ContextConfigApiUpdateSchema, validatePropsAsJsonSchema } from './chunk
|
|
|
10
9
|
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-HN77JIDP.js';
|
|
11
10
|
import { schema_exports, contextConfigs, externalAgents, functions, functionTools, subAgentFunctionToolRelations, subAgentRelations, subAgents, subAgentToolRelations, tools, credentialReferences, agents, subAgentDataComponents, subAgentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, ledgerArtifacts, tasks, taskRelations } from './chunk-5B6IOJZY.js';
|
|
12
11
|
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-5B6IOJZY.js';
|
|
12
|
+
export { TaskState } from './chunk-H2F72PDA.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';
|
|
16
16
|
import { z as z$1 } from 'zod';
|
|
17
|
-
import { customAlphabet
|
|
17
|
+
import { customAlphabet } from 'nanoid';
|
|
18
18
|
import jmespath from 'jmespath';
|
|
19
19
|
import { createClient } from '@libsql/client';
|
|
20
20
|
import { drizzle } from 'drizzle-orm/libsql';
|
|
@@ -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) {
|
|
@@ -214177,7 +214177,7 @@ var addFunctionToolToSubAgent = (db) => {
|
|
|
214177
214177
|
const { scopes, subAgentId, functionToolId } = params;
|
|
214178
214178
|
const { tenantId, projectId, agentId } = scopes;
|
|
214179
214179
|
try {
|
|
214180
|
-
const relationId =
|
|
214180
|
+
const relationId = generateId();
|
|
214181
214181
|
await db.insert(subAgentFunctionToolRelations).values({
|
|
214182
214182
|
id: relationId,
|
|
214183
214183
|
tenantId,
|
|
@@ -214480,7 +214480,7 @@ var deleteAgentRelationsByAgent = (db) => async (params) => {
|
|
|
214480
214480
|
return (result.rowsAffected || 0) > 0;
|
|
214481
214481
|
};
|
|
214482
214482
|
var createAgentToolRelation = (db) => async (params) => {
|
|
214483
|
-
const finalRelationId = params.relationId ??
|
|
214483
|
+
const finalRelationId = params.relationId ?? generateId();
|
|
214484
214484
|
const relation = await db.insert(subAgentToolRelations).values({
|
|
214485
214485
|
id: finalRelationId,
|
|
214486
214486
|
tenantId: params.scopes.tenantId,
|
|
@@ -214901,7 +214901,7 @@ async function generateApiKey() {
|
|
|
214901
214901
|
const key = `sk_${publicId}.${secret}`;
|
|
214902
214902
|
const keyPrefix = key.substring(0, 12);
|
|
214903
214903
|
const keyHash = await hashApiKey(key);
|
|
214904
|
-
const id =
|
|
214904
|
+
const id = generateId();
|
|
214905
214905
|
return {
|
|
214906
214906
|
id,
|
|
214907
214907
|
publicId,
|
|
@@ -215873,7 +215873,7 @@ var deleteTool = (db) => async (params) => {
|
|
|
215873
215873
|
return !!deleted;
|
|
215874
215874
|
};
|
|
215875
215875
|
var addToolToAgent = (db) => async (params) => {
|
|
215876
|
-
const id =
|
|
215876
|
+
const id = generateId();
|
|
215877
215877
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
215878
215878
|
const [created] = await db.insert(subAgentToolRelations).values({
|
|
215879
215879
|
id,
|
|
@@ -216452,7 +216452,7 @@ var getFullAgentDefinition = (db) => async ({
|
|
|
216452
216452
|
return result;
|
|
216453
216453
|
};
|
|
216454
216454
|
var upsertAgent = (db) => async (params) => {
|
|
216455
|
-
const agentId = params.data.id ||
|
|
216455
|
+
const agentId = params.data.id || generateId();
|
|
216456
216456
|
const scopes = { tenantId: params.data.tenantId, projectId: params.data.projectId, agentId };
|
|
216457
216457
|
const existing = await getAgentById(db)({
|
|
216458
216458
|
scopes
|
|
@@ -216752,7 +216752,7 @@ var getArtifactComponentsForAgent = (db) => async (params) => {
|
|
|
216752
216752
|
};
|
|
216753
216753
|
var associateArtifactComponentWithAgent = (db) => async (params) => {
|
|
216754
216754
|
const [association] = await db.insert(subAgentArtifactComponents).values({
|
|
216755
|
-
id:
|
|
216755
|
+
id: generateId(),
|
|
216756
216756
|
tenantId: params.scopes.tenantId,
|
|
216757
216757
|
projectId: params.scopes.projectId,
|
|
216758
216758
|
agentId: params.scopes.agentId,
|
|
@@ -216915,7 +216915,7 @@ var getCacheEntry = (db) => async (params) => {
|
|
|
216915
216915
|
var setCacheEntry = (db) => async (entry) => {
|
|
216916
216916
|
try {
|
|
216917
216917
|
const cacheData = {
|
|
216918
|
-
id:
|
|
216918
|
+
id: generateId(),
|
|
216919
216919
|
tenantId: entry.tenantId,
|
|
216920
216920
|
projectId: entry.projectId,
|
|
216921
216921
|
conversationId: entry.conversationId,
|
|
@@ -217361,7 +217361,7 @@ var getDataComponentsForAgent = (db) => async (params) => {
|
|
|
217361
217361
|
};
|
|
217362
217362
|
var associateDataComponentWithAgent = (db) => async (params) => {
|
|
217363
217363
|
const association = await db.insert(subAgentDataComponents).values({
|
|
217364
|
-
id:
|
|
217364
|
+
id: generateId(),
|
|
217365
217365
|
tenantId: params.scopes.tenantId,
|
|
217366
217366
|
projectId: params.scopes.projectId,
|
|
217367
217367
|
agentId: params.scopes.agentId,
|
|
@@ -217550,7 +217550,7 @@ var createFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
217550
217550
|
logger13.info({}, "MCP Tools are project-scoped - skipping tool creation in agent");
|
|
217551
217551
|
let finalAgentId;
|
|
217552
217552
|
try {
|
|
217553
|
-
const agentId = typed.id ||
|
|
217553
|
+
const agentId = typed.id || generateId();
|
|
217554
217554
|
logger13.info({ agentId }, "Creating agent metadata");
|
|
217555
217555
|
const agent = await upsertAgent(db)({
|
|
217556
217556
|
data: {
|
|
@@ -217936,7 +217936,7 @@ var createFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
217936
217936
|
"Processing agent transfer relation"
|
|
217937
217937
|
);
|
|
217938
217938
|
await upsertSubAgentRelation(db)({
|
|
217939
|
-
id:
|
|
217939
|
+
id: generateId(),
|
|
217940
217940
|
tenantId,
|
|
217941
217941
|
projectId,
|
|
217942
217942
|
agentId: finalAgentId,
|
|
@@ -217970,7 +217970,7 @@ var createFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
217970
217970
|
"Processing agent delegation relation"
|
|
217971
217971
|
);
|
|
217972
217972
|
await upsertSubAgentRelation(db)({
|
|
217973
|
-
id:
|
|
217973
|
+
id: generateId(),
|
|
217974
217974
|
tenantId,
|
|
217975
217975
|
projectId,
|
|
217976
217976
|
agentId: finalAgentId,
|
|
@@ -218053,7 +218053,7 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218053
218053
|
logger13.info({}, "MCP Tools are project-scoped - skipping tool creation in agent update");
|
|
218054
218054
|
let finalAgentId;
|
|
218055
218055
|
try {
|
|
218056
|
-
const agentId = typedAgentDefinition.id ||
|
|
218056
|
+
const agentId = typedAgentDefinition.id || generateId();
|
|
218057
218057
|
logger13.info({ agentId }, "Getting/creating agent metadata");
|
|
218058
218058
|
const agent = await upsertAgent(db)({
|
|
218059
218059
|
data: {
|
|
@@ -218576,7 +218576,7 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218576
218576
|
const isTargetExternal = isExternalAgent(targetAgentData);
|
|
218577
218577
|
const targetField = isTargetExternal ? "externalSubAgentId" : "targetSubAgentId";
|
|
218578
218578
|
const relationData = {
|
|
218579
|
-
id:
|
|
218579
|
+
id: generateId(),
|
|
218580
218580
|
agentId: typedAgentDefinition.id || "",
|
|
218581
218581
|
sourceSubAgentId: subAgentId,
|
|
218582
218582
|
relationType: "transfer",
|
|
@@ -218610,7 +218610,7 @@ var updateFullAgentServerSide = (db, logger13 = defaultLogger) => async (scopes,
|
|
|
218610
218610
|
(async () => {
|
|
218611
218611
|
try {
|
|
218612
218612
|
const relationData = {
|
|
218613
|
-
id:
|
|
218613
|
+
id: generateId(),
|
|
218614
218614
|
agentId: typedAgentDefinition.id || "",
|
|
218615
218615
|
sourceSubAgentId: subAgentId,
|
|
218616
218616
|
relationType: "delegate",
|
|
@@ -218825,7 +218825,7 @@ var upsertLedgerArtifact = (db) => async (params) => {
|
|
|
218825
218825
|
const sanitizedArt = sanitizeArtifactForDatabase(artifact);
|
|
218826
218826
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
218827
218827
|
const artifactRow = {
|
|
218828
|
-
id: sanitizedArt.artifactId ??
|
|
218828
|
+
id: sanitizedArt.artifactId ?? generateId(),
|
|
218829
218829
|
tenantId: scopes.tenantId,
|
|
218830
218830
|
projectId: scopes.projectId,
|
|
218831
218831
|
taskId,
|
|
@@ -218875,7 +218875,7 @@ var addLedgerArtifacts = (db) => async (params) => {
|
|
|
218875
218875
|
const sanitizedArt = sanitizeArtifactForDatabase(art);
|
|
218876
218876
|
const resolvedTaskId = taskId ?? sanitizedArt.taskId ?? sanitizedArt.metadata?.taskId ?? null;
|
|
218877
218877
|
return {
|
|
218878
|
-
id: sanitizedArt.artifactId ??
|
|
218878
|
+
id: sanitizedArt.artifactId ?? generateId(),
|
|
218879
218879
|
tenantId: scopes.tenantId,
|
|
218880
218880
|
projectId: scopes.projectId,
|
|
218881
218881
|
taskId: resolvedTaskId,
|
|
@@ -220265,6 +220265,8 @@ var createValidatedDataAccess = (db, dataAccessFunctions) => {
|
|
|
220265
220265
|
|
|
220266
220266
|
// src/utils/tracer.ts
|
|
220267
220267
|
var tracer = getTracer("agents-core");
|
|
220268
|
+
|
|
220269
|
+
// src/context/contextCache.ts
|
|
220268
220270
|
var logger7 = getLogger("context-cache");
|
|
220269
220271
|
var ContextCache = class {
|
|
220270
220272
|
constructor(tenantId, projectId, dbClient) {
|
|
@@ -220327,7 +220329,7 @@ var ContextCache = class {
|
|
|
220327
220329
|
async set(entry) {
|
|
220328
220330
|
try {
|
|
220329
220331
|
const cacheData = {
|
|
220330
|
-
id:
|
|
220332
|
+
id: generateId(),
|
|
220331
220333
|
tenantId: this.tenantId,
|
|
220332
220334
|
projectId: this.projectId,
|
|
220333
220335
|
conversationId: entry.conversationId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-core",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
4
4
|
"description": "Agents Core contains the database schema, types, and validation schemas for Inkeep Agent Framework, along with core components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|