@inkeep/agents-core 0.23.4 → 0.24.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.
@@ -1,4 +1,4 @@
1
- import { AgentWithinContextOfProjectSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-HN77JIDP.js';
1
+ import { AgentWithinContextOfProjectSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-A7UJQKCD.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  // src/validation/agentFull.ts
@@ -173,15 +173,38 @@ function generateIdFromName(name) {
173
173
  var MAX_CODE_SIZE = 5e4;
174
174
  var MAX_DATA_SIZE = 1e4;
175
175
  var DANGEROUS_PATTERNS = [
176
- /\beval\s*\(/i,
177
- /\bFunction\s*\(/i,
178
- /dangerouslySetInnerHTML/i,
179
- /<script\b/i,
180
- /\bon\w+\s*=/i,
181
- // inline event handlers like onclick=
182
- /document\.write/i,
183
- /window\.location/i,
184
- /\.innerHTML\s*=/i
176
+ {
177
+ pattern: /\beval\s*\(/i,
178
+ message: "eval() is not allowed"
179
+ },
180
+ {
181
+ pattern: /\bFunction\s*\(/i,
182
+ message: "Function constructor is not allowed"
183
+ },
184
+ {
185
+ pattern: /dangerouslySetInnerHTML/i,
186
+ message: "dangerouslySetInnerHTML is not allowed"
187
+ },
188
+ {
189
+ pattern: /<script\b/i,
190
+ message: "Script tags are not allowed"
191
+ },
192
+ {
193
+ pattern: /\bon\w+\s*=/i,
194
+ message: "Inline event handlers (onClick=, onLoad=, etc.) are not allowed"
195
+ },
196
+ {
197
+ pattern: /document\.write/i,
198
+ message: "document.write is not allowed"
199
+ },
200
+ {
201
+ pattern: /window\.location/i,
202
+ message: "window.location is not allowed"
203
+ },
204
+ {
205
+ pattern: /\.innerHTML\s*=/i,
206
+ message: "innerHTML manipulation is not allowed"
207
+ }
185
208
  ];
186
209
  var ALLOWED_IMPORTS = ["lucide-react"];
187
210
  function validatePreview(preview) {
@@ -211,11 +234,11 @@ function validatePreview(preview) {
211
234
  message: `Data size exceeds maximum allowed (${MAX_DATA_SIZE} characters)`
212
235
  });
213
236
  }
214
- for (const pattern of DANGEROUS_PATTERNS) {
237
+ for (const { pattern, message } of DANGEROUS_PATTERNS) {
215
238
  if (pattern.test(preview.code)) {
216
239
  errors.push({
217
240
  field: "preview.code",
218
- message: `Code contains potentially dangerous pattern: ${pattern.source}`
241
+ message: `Code contains potentially dangerous pattern: ${message}`
219
242
  });
220
243
  }
221
244
  }
@@ -1,6 +1,6 @@
1
1
  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 } from './chunk-NJZ3ICNP.js';
2
- import { ModelSettingsSchema, FullAgentAgentInsertSchema, ArtifactComponentApiInsertSchema } from './chunk-HN77JIDP.js';
3
- export { AgentStopWhenSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, ModelSettingsSchema, StopWhenSchema, SubAgentStopWhenSchema, validatePropsAsJsonSchema } from './chunk-HN77JIDP.js';
2
+ import { ModelSettingsSchema, FullAgentAgentInsertSchema, ArtifactComponentApiInsertSchema } from './chunk-A7UJQKCD.js';
3
+ export { AgentStopWhenSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, ModelSettingsSchema, StopWhenSchema, SubAgentStopWhenSchema, validatePropsAsJsonSchema } from './chunk-A7UJQKCD.js';
4
4
  import { CredentialStoreType } from './chunk-YFHT5M2R.js';
5
5
  export { CredentialStoreType, MCPTransportType } from './chunk-YFHT5M2R.js';
6
6
  import { z } from 'zod';
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 || nanoid.nanoid();
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 = nanoid.nanoid();
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 ?? nanoid.nanoid();
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 = nanoid.nanoid();
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 = nanoid.nanoid();
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 || nanoid.nanoid();
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: nanoid.nanoid(),
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: nanoid.nanoid(),
219408
+ id: generateId(),
219409
219409
  tenantId: entry.tenantId,
219410
219410
  projectId: entry.projectId,
219411
219411
  conversationId: entry.conversationId,
@@ -219729,15 +219729,38 @@ var setActiveAgentForThread = (db) => async ({
219729
219729
  var MAX_CODE_SIZE = 5e4;
219730
219730
  var MAX_DATA_SIZE = 1e4;
219731
219731
  var DANGEROUS_PATTERNS = [
219732
- /\beval\s*\(/i,
219733
- /\bFunction\s*\(/i,
219734
- /dangerouslySetInnerHTML/i,
219735
- /<script\b/i,
219736
- /\bon\w+\s*=/i,
219737
- // inline event handlers like onclick=
219738
- /document\.write/i,
219739
- /window\.location/i,
219740
- /\.innerHTML\s*=/i
219732
+ {
219733
+ pattern: /\beval\s*\(/i,
219734
+ message: "eval() is not allowed"
219735
+ },
219736
+ {
219737
+ pattern: /\bFunction\s*\(/i,
219738
+ message: "Function constructor is not allowed"
219739
+ },
219740
+ {
219741
+ pattern: /dangerouslySetInnerHTML/i,
219742
+ message: "dangerouslySetInnerHTML is not allowed"
219743
+ },
219744
+ {
219745
+ pattern: /<script\b/i,
219746
+ message: "Script tags are not allowed"
219747
+ },
219748
+ {
219749
+ pattern: /\bon\w+\s*=/i,
219750
+ message: "Inline event handlers (onClick=, onLoad=, etc.) are not allowed"
219751
+ },
219752
+ {
219753
+ pattern: /document\.write/i,
219754
+ message: "document.write is not allowed"
219755
+ },
219756
+ {
219757
+ pattern: /window\.location/i,
219758
+ message: "window.location is not allowed"
219759
+ },
219760
+ {
219761
+ pattern: /\.innerHTML\s*=/i,
219762
+ message: "innerHTML manipulation is not allowed"
219763
+ }
219741
219764
  ];
219742
219765
  var ALLOWED_IMPORTS = ["lucide-react"];
219743
219766
  function validatePreview(preview2) {
@@ -219767,11 +219790,11 @@ function validatePreview(preview2) {
219767
219790
  message: `Data size exceeds maximum allowed (${MAX_DATA_SIZE} characters)`
219768
219791
  });
219769
219792
  }
219770
- for (const pattern of DANGEROUS_PATTERNS) {
219793
+ for (const { pattern, message } of DANGEROUS_PATTERNS) {
219771
219794
  if (pattern.test(preview2.code)) {
219772
219795
  errors.push({
219773
219796
  field: "preview.code",
219774
- message: `Code contains potentially dangerous pattern: ${pattern.source}`
219797
+ message: `Code contains potentially dangerous pattern: ${message}`
219775
219798
  });
219776
219799
  }
219777
219800
  }
@@ -219939,7 +219962,7 @@ var getDataComponentsForAgent = (db) => async (params) => {
219939
219962
  };
219940
219963
  var associateDataComponentWithAgent = (db) => async (params) => {
219941
219964
  const association = await db.insert(subAgentDataComponents).values({
219942
- id: nanoid.nanoid(),
219965
+ id: generateId(),
219943
219966
  tenantId: params.scopes.tenantId,
219944
219967
  projectId: params.scopes.projectId,
219945
219968
  agentId: params.scopes.agentId,
@@ -220243,7 +220266,7 @@ var createFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
220243
220266
  logger14.info({}, "MCP Tools are project-scoped - skipping tool creation in agent");
220244
220267
  let finalAgentId;
220245
220268
  try {
220246
- const agentId = typed.id || nanoid.nanoid();
220269
+ const agentId = typed.id || generateId();
220247
220270
  logger14.info({ agentId }, "Creating agent metadata");
220248
220271
  const agent = await upsertAgent(db)({
220249
220272
  data: {
@@ -220629,7 +220652,7 @@ var createFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
220629
220652
  "Processing agent transfer relation"
220630
220653
  );
220631
220654
  await upsertSubAgentRelation(db)({
220632
- id: nanoid.nanoid(),
220655
+ id: generateId(),
220633
220656
  tenantId,
220634
220657
  projectId,
220635
220658
  agentId: finalAgentId,
@@ -220663,7 +220686,7 @@ var createFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
220663
220686
  "Processing agent delegation relation"
220664
220687
  );
220665
220688
  await upsertSubAgentRelation(db)({
220666
- id: nanoid.nanoid(),
220689
+ id: generateId(),
220667
220690
  tenantId,
220668
220691
  projectId,
220669
220692
  agentId: finalAgentId,
@@ -220746,7 +220769,7 @@ var updateFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
220746
220769
  logger14.info({}, "MCP Tools are project-scoped - skipping tool creation in agent update");
220747
220770
  let finalAgentId;
220748
220771
  try {
220749
- const agentId = typedAgentDefinition.id || nanoid.nanoid();
220772
+ const agentId = typedAgentDefinition.id || generateId();
220750
220773
  logger14.info({ agentId }, "Getting/creating agent metadata");
220751
220774
  const agent = await upsertAgent(db)({
220752
220775
  data: {
@@ -221269,7 +221292,7 @@ var updateFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
221269
221292
  const isTargetExternal = isExternalAgent(targetAgentData);
221270
221293
  const targetField = isTargetExternal ? "externalSubAgentId" : "targetSubAgentId";
221271
221294
  const relationData = {
221272
- id: nanoid.nanoid(),
221295
+ id: generateId(),
221273
221296
  agentId: typedAgentDefinition.id || "",
221274
221297
  sourceSubAgentId: subAgentId,
221275
221298
  relationType: "transfer",
@@ -221303,7 +221326,7 @@ var updateFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
221303
221326
  (async () => {
221304
221327
  try {
221305
221328
  const relationData = {
221306
- id: nanoid.nanoid(),
221329
+ id: generateId(),
221307
221330
  agentId: typedAgentDefinition.id || "",
221308
221331
  sourceSubAgentId: subAgentId,
221309
221332
  relationType: "delegate",
@@ -221518,7 +221541,7 @@ var upsertLedgerArtifact = (db) => async (params) => {
221518
221541
  const sanitizedArt = sanitizeArtifactForDatabase(artifact);
221519
221542
  const now = (/* @__PURE__ */ new Date()).toISOString();
221520
221543
  const artifactRow = {
221521
- id: sanitizedArt.artifactId ?? nanoid.nanoid(),
221544
+ id: sanitizedArt.artifactId ?? generateId(),
221522
221545
  tenantId: scopes.tenantId,
221523
221546
  projectId: scopes.projectId,
221524
221547
  taskId,
@@ -221568,7 +221591,7 @@ var addLedgerArtifacts = (db) => async (params) => {
221568
221591
  const sanitizedArt = sanitizeArtifactForDatabase(art);
221569
221592
  const resolvedTaskId = taskId ?? sanitizedArt.taskId ?? sanitizedArt.metadata?.taskId ?? null;
221570
221593
  return {
221571
- id: sanitizedArt.artifactId ?? nanoid.nanoid(),
221594
+ id: sanitizedArt.artifactId ?? generateId(),
221572
221595
  tenantId: scopes.tenantId,
221573
221596
  projectId: scopes.projectId,
221574
221597
  taskId: resolvedTaskId,
@@ -222958,6 +222981,8 @@ var createValidatedDataAccess = (db, dataAccessFunctions) => {
222958
222981
 
222959
222982
  // src/utils/tracer.ts
222960
222983
  var tracer = getTracer("agents-core");
222984
+
222985
+ // src/context/contextCache.ts
222961
222986
  var logger8 = getLogger("context-cache");
222962
222987
  var ContextCache = class {
222963
222988
  constructor(tenantId, projectId, dbClient) {
@@ -223020,7 +223045,7 @@ var ContextCache = class {
223020
223045
  async set(entry) {
223021
223046
  try {
223022
223047
  const cacheData = {
223023
- id: nanoid.nanoid(),
223048
+ id: generateId(),
223024
223049
  tenantId: this.tenantId,
223025
223050
  projectId: this.projectId,
223026
223051
  conversationId: entry.conversationId,
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
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
- export { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from './chunk-MQTANAMG.js';
4
3
  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
- import { validatePreview, validateAndTypeAgentData, validateAgentStructure, isInternalAgent, isExternalAgent } from './chunk-AN3YZP42.js';
8
- export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validatePreview, validateToolReferences } from './chunk-AN3YZP42.js';
9
- import { ContextConfigApiUpdateSchema, validatePropsAsJsonSchema } from './chunk-HN77JIDP.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, 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
- 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
- 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';
6
+ import { validatePreview, validateAndTypeAgentData, validateAgentStructure, isInternalAgent, isExternalAgent } from './chunk-G77LKOKP.js';
7
+ export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validatePreview, validateToolReferences } from './chunk-G77LKOKP.js';
8
+ import { ContextConfigApiUpdateSchema, validatePropsAsJsonSchema } from './chunk-A7UJQKCD.js';
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-A7UJQKCD.js';
13
10
  import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-YFHT5M2R.js';
14
11
  export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-YFHT5M2R.js';
12
+ 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';
13
+ 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';
14
+ export { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from './chunk-MQTANAMG.js';
15
15
  import { __commonJS, __require, __publicField } from './chunk-E6R6PML7.js';
16
16
  import { z as z$1 } from 'zod';
17
- import { customAlphabet, nanoid } from 'nanoid';
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 || nanoid();
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 = nanoid();
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 ?? nanoid();
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 = nanoid();
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 = nanoid();
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 || nanoid();
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: nanoid(),
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: nanoid(),
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: nanoid(),
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 || nanoid();
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: nanoid(),
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: nanoid(),
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 || nanoid();
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: nanoid(),
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: nanoid(),
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 ?? nanoid(),
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 ?? nanoid(),
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: nanoid(),
220332
+ id: generateId(),
220331
220333
  tenantId: this.tenantId,
220332
220334
  projectId: this.projectId,
220333
220335
  conversationId: entry.conversationId,
@@ -1794,15 +1794,38 @@ function generateIdFromName(name) {
1794
1794
  var MAX_CODE_SIZE = 5e4;
1795
1795
  var MAX_DATA_SIZE = 1e4;
1796
1796
  var DANGEROUS_PATTERNS = [
1797
- /\beval\s*\(/i,
1798
- /\bFunction\s*\(/i,
1799
- /dangerouslySetInnerHTML/i,
1800
- /<script\b/i,
1801
- /\bon\w+\s*=/i,
1802
- // inline event handlers like onclick=
1803
- /document\.write/i,
1804
- /window\.location/i,
1805
- /\.innerHTML\s*=/i
1797
+ {
1798
+ pattern: /\beval\s*\(/i,
1799
+ message: "eval() is not allowed"
1800
+ },
1801
+ {
1802
+ pattern: /\bFunction\s*\(/i,
1803
+ message: "Function constructor is not allowed"
1804
+ },
1805
+ {
1806
+ pattern: /dangerouslySetInnerHTML/i,
1807
+ message: "dangerouslySetInnerHTML is not allowed"
1808
+ },
1809
+ {
1810
+ pattern: /<script\b/i,
1811
+ message: "Script tags are not allowed"
1812
+ },
1813
+ {
1814
+ pattern: /\bon\w+\s*=/i,
1815
+ message: "Inline event handlers (onClick=, onLoad=, etc.) are not allowed"
1816
+ },
1817
+ {
1818
+ pattern: /document\.write/i,
1819
+ message: "document.write is not allowed"
1820
+ },
1821
+ {
1822
+ pattern: /window\.location/i,
1823
+ message: "window.location is not allowed"
1824
+ },
1825
+ {
1826
+ pattern: /\.innerHTML\s*=/i,
1827
+ message: "innerHTML manipulation is not allowed"
1828
+ }
1806
1829
  ];
1807
1830
  var ALLOWED_IMPORTS = ["lucide-react"];
1808
1831
  function validatePreview(preview) {
@@ -1832,11 +1855,11 @@ function validatePreview(preview) {
1832
1855
  message: `Data size exceeds maximum allowed (${MAX_DATA_SIZE} characters)`
1833
1856
  });
1834
1857
  }
1835
- for (const pattern of DANGEROUS_PATTERNS) {
1858
+ for (const { pattern, message } of DANGEROUS_PATTERNS) {
1836
1859
  if (pattern.test(preview.code)) {
1837
1860
  errors.push({
1838
1861
  field: "preview.code",
1839
- message: `Code contains potentially dangerous pattern: ${pattern.source}`
1862
+ message: `Code contains potentially dangerous pattern: ${message}`
1840
1863
  });
1841
1864
  }
1842
1865
  }
@@ -1,2 +1,2 @@
1
- export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validatePreview, validateToolReferences } from '../chunk-AN3YZP42.js';
2
- 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';
1
+ export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validatePreview, validateToolReferences } from '../chunk-G77LKOKP.js';
2
+ 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-A7UJQKCD.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-core",
3
- "version": "0.23.4",
3
+ "version": "0.24.0",
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",
@@ -1,5 +1,5 @@
1
- import { subAgents, subAgentRelations, agents, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, subAgentDataComponents, artifactComponents, subAgentArtifactComponents, externalAgents, apiKeys, credentialReferences, functionTools, functions, contextConfigs, subAgentToolRelations, ledgerArtifacts, projects } from './chunk-5B6IOJZY.js';
2
1
  import { VALID_RELATION_TYPES, MCPTransportType, TOOL_STATUS_VALUES, CredentialStoreType, MCPServerType } from './chunk-YFHT5M2R.js';
2
+ import { subAgents, subAgentRelations, agents, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, subAgentDataComponents, artifactComponents, subAgentArtifactComponents, externalAgents, apiKeys, credentialReferences, functionTools, functions, contextConfigs, subAgentToolRelations, ledgerArtifacts, projects } from './chunk-5B6IOJZY.js';
3
3
  import { z } from '@hono/zod-openapi';
4
4
  import { createSelectSchema, createInsertSchema } from 'drizzle-zod';
5
5
  import Ajv from 'ajv';