@inkeep/agents-core 0.30.0 → 0.30.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.
@@ -1,6 +1,51 @@
1
1
  import { AgentWithinContextOfProjectSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-37BY2EHU.js';
2
2
  import { z } from 'zod';
3
3
 
4
+ // src/validation/cycleDetection.ts
5
+ function detectDelegationCycles(agentData) {
6
+ const graph = buildDelegationGraph(agentData);
7
+ const cycles = [];
8
+ const visited = /* @__PURE__ */ new Set();
9
+ const stack = /* @__PURE__ */ new Set();
10
+ const path = [];
11
+ function dfs(node) {
12
+ visited.add(node);
13
+ stack.add(node);
14
+ path.push(node);
15
+ for (const neighbor of graph.get(node) || []) {
16
+ if (!visited.has(neighbor)) {
17
+ if (dfs(neighbor)) return true;
18
+ } else if (stack.has(neighbor)) {
19
+ const cycleStart = path.indexOf(neighbor);
20
+ cycles.push(`Circular delegation detected: ${[...path.slice(cycleStart), neighbor].join(" \u2192 ")}`);
21
+ return true;
22
+ }
23
+ }
24
+ stack.delete(node);
25
+ path.pop();
26
+ return false;
27
+ }
28
+ for (const node of graph.keys()) {
29
+ if (!visited.has(node)) {
30
+ path.length = 0;
31
+ dfs(node);
32
+ }
33
+ }
34
+ return cycles;
35
+ }
36
+ function buildDelegationGraph(agentData) {
37
+ const graph = /* @__PURE__ */ new Map();
38
+ for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
39
+ const delegates = subAgent.canDelegateTo?.filter(
40
+ (d) => typeof d === "string"
41
+ );
42
+ if (delegates?.length) {
43
+ graph.set(subAgentId, delegates);
44
+ }
45
+ }
46
+ return graph;
47
+ }
48
+
4
49
  // src/validation/agentFull.ts
5
50
  function validateAndTypeAgentData(data) {
6
51
  return AgentWithinContextOfProjectSchema.parse(data);
@@ -94,6 +139,10 @@ function validateAgentRelationships(agentData) {
94
139
  }
95
140
  }
96
141
  }
142
+ const cycles = detectDelegationCycles(agentData);
143
+ if (cycles.length > 0) {
144
+ errors.push(...cycles);
145
+ }
97
146
  if (errors.length > 0)
98
147
  throw new Error(`Agent relationship validation failed:
99
148
  ${errors.join("\n")}`);
@@ -290,5 +339,56 @@ function validateRender(render) {
290
339
  errors
291
340
  };
292
341
  }
342
+ var TextStartEventSchema = z.object({
343
+ type: z.literal("text-start"),
344
+ id: z.string()
345
+ });
346
+ var TextDeltaEventSchema = z.object({
347
+ type: z.literal("text-delta"),
348
+ id: z.string(),
349
+ delta: z.string()
350
+ });
351
+ var TextEndEventSchema = z.object({
352
+ type: z.literal("text-end"),
353
+ id: z.string()
354
+ });
355
+ var DataComponentStreamEventSchema = z.object({
356
+ type: z.literal("data-component"),
357
+ id: z.string(),
358
+ data: z.any()
359
+ });
360
+ var DataOperationStreamEventSchema = z.object({
361
+ type: z.literal("data-operation"),
362
+ data: z.any()
363
+ // Contains OperationEvent types (AgentInitializingEvent, CompletionEvent, etc.)
364
+ });
365
+ var DataSummaryStreamEventSchema = z.object({
366
+ type: z.literal("data-summary"),
367
+ data: z.any()
368
+ // Contains SummaryEvent from entities.ts
369
+ });
370
+ var StreamErrorEventSchema = z.object({
371
+ type: z.literal("error"),
372
+ error: z.string()
373
+ });
374
+ var StreamFinishEventSchema = z.object({
375
+ type: z.literal("finish"),
376
+ finishReason: z.string().optional(),
377
+ usage: z.object({
378
+ promptTokens: z.number().optional(),
379
+ completionTokens: z.number().optional(),
380
+ totalTokens: z.number().optional()
381
+ }).optional()
382
+ });
383
+ var StreamEventSchema = z.discriminatedUnion("type", [
384
+ TextStartEventSchema,
385
+ TextDeltaEventSchema,
386
+ TextEndEventSchema,
387
+ DataComponentStreamEventSchema,
388
+ DataOperationStreamEventSchema,
389
+ DataSummaryStreamEventSchema,
390
+ StreamErrorEventSchema,
391
+ StreamFinishEventSchema
392
+ ]);
293
393
 
294
- export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences };
394
+ export { A2AMessageMetadataSchema, DataComponentStreamEventSchema, DataOperationDetailsSchema, DataOperationEventSchema, DataOperationStreamEventSchema, DataSummaryStreamEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, StreamErrorEventSchema, StreamEventSchema, StreamFinishEventSchema, TextDeltaEventSchema, TextEndEventSchema, TextStartEventSchema, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences };
package/dist/index.cjs CHANGED
@@ -215950,6 +215950,51 @@ function getConversationId() {
215950
215950
  return generateId();
215951
215951
  }
215952
215952
 
215953
+ // src/validation/cycleDetection.ts
215954
+ function detectDelegationCycles(agentData) {
215955
+ const graph = buildDelegationGraph(agentData);
215956
+ const cycles = [];
215957
+ const visited = /* @__PURE__ */ new Set();
215958
+ const stack = /* @__PURE__ */ new Set();
215959
+ const path2 = [];
215960
+ function dfs(node) {
215961
+ visited.add(node);
215962
+ stack.add(node);
215963
+ path2.push(node);
215964
+ for (const neighbor of graph.get(node) || []) {
215965
+ if (!visited.has(neighbor)) {
215966
+ if (dfs(neighbor)) return true;
215967
+ } else if (stack.has(neighbor)) {
215968
+ const cycleStart = path2.indexOf(neighbor);
215969
+ cycles.push(`Circular delegation detected: ${[...path2.slice(cycleStart), neighbor].join(" \u2192 ")}`);
215970
+ return true;
215971
+ }
215972
+ }
215973
+ stack.delete(node);
215974
+ path2.pop();
215975
+ return false;
215976
+ }
215977
+ for (const node of graph.keys()) {
215978
+ if (!visited.has(node)) {
215979
+ path2.length = 0;
215980
+ dfs(node);
215981
+ }
215982
+ }
215983
+ return cycles;
215984
+ }
215985
+ function buildDelegationGraph(agentData) {
215986
+ const graph = /* @__PURE__ */ new Map();
215987
+ for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
215988
+ const delegates = subAgent.canDelegateTo?.filter(
215989
+ (d) => typeof d === "string"
215990
+ );
215991
+ if (delegates?.length) {
215992
+ graph.set(subAgentId, delegates);
215993
+ }
215994
+ }
215995
+ return graph;
215996
+ }
215997
+
215953
215998
  // src/validation/agentFull.ts
215954
215999
  function validateAndTypeAgentData(data) {
215955
216000
  return AgentWithinContextOfProjectSchema.parse(data);
@@ -216043,6 +216088,10 @@ function validateAgentRelationships(agentData) {
216043
216088
  }
216044
216089
  }
216045
216090
  }
216091
+ const cycles = detectDelegationCycles(agentData);
216092
+ if (cycles.length > 0) {
216093
+ errors.push(...cycles);
216094
+ }
216046
216095
  if (errors.length > 0)
216047
216096
  throw new Error(`Agent relationship validation failed:
216048
216097
  ${errors.join("\n")}`);
@@ -226412,6 +226461,57 @@ function generateIdFromName(name) {
226412
226461
  }
226413
226462
  return truncatedId;
226414
226463
  }
226464
+ var TextStartEventSchema = zod.z.object({
226465
+ type: zod.z.literal("text-start"),
226466
+ id: zod.z.string()
226467
+ });
226468
+ var TextDeltaEventSchema = zod.z.object({
226469
+ type: zod.z.literal("text-delta"),
226470
+ id: zod.z.string(),
226471
+ delta: zod.z.string()
226472
+ });
226473
+ var TextEndEventSchema = zod.z.object({
226474
+ type: zod.z.literal("text-end"),
226475
+ id: zod.z.string()
226476
+ });
226477
+ var DataComponentStreamEventSchema = zod.z.object({
226478
+ type: zod.z.literal("data-component"),
226479
+ id: zod.z.string(),
226480
+ data: zod.z.any()
226481
+ });
226482
+ var DataOperationStreamEventSchema = zod.z.object({
226483
+ type: zod.z.literal("data-operation"),
226484
+ data: zod.z.any()
226485
+ // Contains OperationEvent types (AgentInitializingEvent, CompletionEvent, etc.)
226486
+ });
226487
+ var DataSummaryStreamEventSchema = zod.z.object({
226488
+ type: zod.z.literal("data-summary"),
226489
+ data: zod.z.any()
226490
+ // Contains SummaryEvent from entities.ts
226491
+ });
226492
+ var StreamErrorEventSchema = zod.z.object({
226493
+ type: zod.z.literal("error"),
226494
+ error: zod.z.string()
226495
+ });
226496
+ var StreamFinishEventSchema = zod.z.object({
226497
+ type: zod.z.literal("finish"),
226498
+ finishReason: zod.z.string().optional(),
226499
+ usage: zod.z.object({
226500
+ promptTokens: zod.z.number().optional(),
226501
+ completionTokens: zod.z.number().optional(),
226502
+ totalTokens: zod.z.number().optional()
226503
+ }).optional()
226504
+ });
226505
+ var StreamEventSchema = zod.z.discriminatedUnion("type", [
226506
+ TextStartEventSchema,
226507
+ TextDeltaEventSchema,
226508
+ TextEndEventSchema,
226509
+ DataComponentStreamEventSchema,
226510
+ DataOperationStreamEventSchema,
226511
+ DataSummaryStreamEventSchema,
226512
+ StreamErrorEventSchema,
226513
+ StreamFinishEventSchema
226514
+ ]);
226415
226515
  /*! Bundled license information:
226416
226516
 
226417
226517
  typescript/lib/typescript.js:
@@ -226519,9 +226619,12 @@ exports.DataComponentInsertSchema = DataComponentInsertSchema;
226519
226619
  exports.DataComponentListResponse = DataComponentListResponse;
226520
226620
  exports.DataComponentResponse = DataComponentResponse;
226521
226621
  exports.DataComponentSelectSchema = DataComponentSelectSchema;
226622
+ exports.DataComponentStreamEventSchema = DataComponentStreamEventSchema;
226522
226623
  exports.DataComponentUpdateSchema = DataComponentUpdateSchema;
226523
226624
  exports.DataOperationDetailsSchema = DataOperationDetailsSchema;
226524
226625
  exports.DataOperationEventSchema = DataOperationEventSchema;
226626
+ exports.DataOperationStreamEventSchema = DataOperationStreamEventSchema;
226627
+ exports.DataSummaryStreamEventSchema = DataSummaryStreamEventSchema;
226525
226628
  exports.DelegationReturnedDataSchema = DelegationReturnedDataSchema;
226526
226629
  exports.DelegationSentDataSchema = DelegationSentDataSchema;
226527
226630
  exports.ERROR_DOCS_BASE_URL = ERROR_DOCS_BASE_URL;
@@ -226620,6 +226723,9 @@ exports.SingleResponseSchema = SingleResponseSchema;
226620
226723
  exports.StatusComponentSchema = StatusComponentSchema;
226621
226724
  exports.StatusUpdateSchema = StatusUpdateSchema;
226622
226725
  exports.StopWhenSchema = StopWhenSchema;
226726
+ exports.StreamErrorEventSchema = StreamErrorEventSchema;
226727
+ exports.StreamEventSchema = StreamEventSchema;
226728
+ exports.StreamFinishEventSchema = StreamFinishEventSchema;
226623
226729
  exports.SubAgentApiInsertSchema = SubAgentApiInsertSchema;
226624
226730
  exports.SubAgentApiSelectSchema = SubAgentApiSelectSchema;
226625
226731
  exports.SubAgentApiUpdateSchema = SubAgentApiUpdateSchema;
@@ -226700,6 +226806,9 @@ exports.TenantProjectAgentSubAgentIdParamsSchema = TenantProjectAgentSubAgentIdP
226700
226806
  exports.TenantProjectAgentSubAgentParamsSchema = TenantProjectAgentSubAgentParamsSchema;
226701
226807
  exports.TenantProjectIdParamsSchema = TenantProjectIdParamsSchema;
226702
226808
  exports.TenantProjectParamsSchema = TenantProjectParamsSchema;
226809
+ exports.TextDeltaEventSchema = TextDeltaEventSchema;
226810
+ exports.TextEndEventSchema = TextEndEventSchema;
226811
+ exports.TextStartEventSchema = TextStartEventSchema;
226703
226812
  exports.ToolApiInsertSchema = ToolApiInsertSchema;
226704
226813
  exports.ToolApiSelectSchema = ToolApiSelectSchema;
226705
226814
  exports.ToolApiUpdateSchema = ToolApiUpdateSchema;
package/dist/index.d.cts CHANGED
@@ -19,7 +19,7 @@ import { z as z$1 } from '@hono/zod-openapi';
19
19
  import { HTTPException } from 'hono/http-exception';
20
20
  export { convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, isZodSchema, preview } from './utils/schema-conversion.cjs';
21
21
  import { Span, Tracer } from '@opentelemetry/api';
22
- export { A2AMessageMetadata, A2AMessageMetadataSchema, DataOperationDetails, DataOperationDetailsSchema, DataOperationEvent, DataOperationEventSchema, DelegationReturnedData, DelegationReturnedDataSchema, DelegationSentData, DelegationSentDataSchema, RenderValidationResult, TransferData, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences } from './validation/index.cjs';
22
+ export { A2AMessageMetadata, A2AMessageMetadataSchema, DataComponentStreamEvent, DataComponentStreamEventSchema, DataOperationDetails, DataOperationDetailsSchema, DataOperationEvent, DataOperationEventSchema, DataOperationStreamEvent, DataOperationStreamEventSchema, DataSummaryStreamEvent, DataSummaryStreamEventSchema, DelegationReturnedData, DelegationReturnedDataSchema, DelegationSentData, DelegationSentDataSchema, RenderValidationResult, StreamErrorEvent, StreamErrorEventSchema, StreamEvent, StreamEventSchema, StreamFinishEvent, StreamFinishEventSchema, TextDeltaEvent, TextDeltaEventSchema, TextEndEvent, TextEndEventSchema, TextStartEvent, TextStartEventSchema, TransferData, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences } from './validation/index.cjs';
23
23
  export { P as PropsValidationResult, v as validatePropsAsJsonSchema } from './props-validation-BMR1qNiy.cjs';
24
24
  import 'pino';
25
25
  import 'drizzle-zod';
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ import { z as z$1 } from '@hono/zod-openapi';
19
19
  import { HTTPException } from 'hono/http-exception';
20
20
  export { convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, isZodSchema, preview } from './utils/schema-conversion.js';
21
21
  import { Span, Tracer } from '@opentelemetry/api';
22
- export { A2AMessageMetadata, A2AMessageMetadataSchema, DataOperationDetails, DataOperationDetailsSchema, DataOperationEvent, DataOperationEventSchema, DelegationReturnedData, DelegationReturnedDataSchema, DelegationSentData, DelegationSentDataSchema, RenderValidationResult, TransferData, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences } from './validation/index.js';
22
+ export { A2AMessageMetadata, A2AMessageMetadataSchema, DataComponentStreamEvent, DataComponentStreamEventSchema, DataOperationDetails, DataOperationDetailsSchema, DataOperationEvent, DataOperationEventSchema, DataOperationStreamEvent, DataOperationStreamEventSchema, DataSummaryStreamEvent, DataSummaryStreamEventSchema, DelegationReturnedData, DelegationReturnedDataSchema, DelegationSentData, DelegationSentDataSchema, RenderValidationResult, StreamErrorEvent, StreamErrorEventSchema, StreamEvent, StreamEventSchema, StreamFinishEvent, StreamFinishEventSchema, TextDeltaEvent, TextDeltaEventSchema, TextEndEvent, TextEndEventSchema, TextStartEvent, TextStartEventSchema, TransferData, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences } from './validation/index.js';
23
23
  export { P as PropsValidationResult, v as validatePropsAsJsonSchema } from './props-validation-BMR1qNiy.js';
24
24
  import 'pino';
25
25
  import 'drizzle-zod';
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { detectAuthenticationRequired } from './chunk-FGRAVXBC.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-FGRAVXBC.js';
3
3
  export { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from './chunk-MQTANAMG.js';
4
+ export { TaskState } from './chunk-H2F72PDA.js';
4
5
  import { getLogger, convertZodToJsonSchema } from './chunk-YECQCT5N.js';
5
6
  export { PinoLogger, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, getLogger, isZodSchema, loggerFactory, preview } from './chunk-YECQCT5N.js';
6
- export { TaskState } from './chunk-H2F72PDA.js';
7
- import { validateRender, validateAndTypeAgentData, validateAgentStructure } from './chunk-4FQG5A4Z.js';
8
- export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences } from './chunk-4FQG5A4Z.js';
7
+ import { validateRender, validateAndTypeAgentData, validateAgentStructure } from './chunk-5EDDDVYT.js';
8
+ export { A2AMessageMetadataSchema, DataComponentStreamEventSchema, DataOperationDetailsSchema, DataOperationEventSchema, DataOperationStreamEventSchema, DataSummaryStreamEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, StreamErrorEventSchema, StreamEventSchema, StreamFinishEventSchema, TextDeltaEventSchema, TextEndEventSchema, TextStartEventSchema, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences } from './chunk-5EDDDVYT.js';
9
9
  import { ContextConfigApiUpdateSchema, validatePropsAsJsonSchema } from './chunk-37BY2EHU.js';
10
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, SubAgentTeamAgentRelationApiInsertSchema, SubAgentTeamAgentRelationApiSelectSchema, SubAgentTeamAgentRelationApiUpdateSchema, SubAgentTeamAgentRelationInsertSchema, SubAgentTeamAgentRelationSelectSchema, SubAgentTeamAgentRelationUpdateSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiSelectSchema, SubAgentToolRelationApiUpdateSchema, SubAgentToolRelationInsertSchema, SubAgentToolRelationListResponse, SubAgentToolRelationResponse, SubAgentToolRelationSelectSchema, SubAgentToolRelationUpdateSchema, SubAgentUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TeamAgentSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, TenantProjectAgentSubAgentIdParamsSchema, TenantProjectAgentSubAgentParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolListResponse, ToolResponse, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, canDelegateToExternalAgentSchema, canDelegateToTeamAgentSchema, resourceIdSchema, validatePropsAsJsonSchema } from './chunk-37BY2EHU.js';
11
11
  import { schema_exports, contextConfigs, externalAgents, functions, functionTools, subAgentFunctionToolRelations, subAgentExternalAgentRelations, subAgents, subAgentRelations, subAgentToolRelations, tools, subAgentTeamAgentRelations, agents, credentialReferences, subAgentDataComponents, subAgentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, ledgerArtifacts, tasks, taskRelations } from './chunk-T5TTDZ6L.js';
@@ -11,7 +11,50 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
11
 
12
12
  var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
13
13
 
14
- // src/validation/schemas.ts
14
+ // src/validation/cycleDetection.ts
15
+ function detectDelegationCycles(agentData) {
16
+ const graph = buildDelegationGraph(agentData);
17
+ const cycles = [];
18
+ const visited = /* @__PURE__ */ new Set();
19
+ const stack = /* @__PURE__ */ new Set();
20
+ const path = [];
21
+ function dfs(node) {
22
+ visited.add(node);
23
+ stack.add(node);
24
+ path.push(node);
25
+ for (const neighbor of graph.get(node) || []) {
26
+ if (!visited.has(neighbor)) {
27
+ if (dfs(neighbor)) return true;
28
+ } else if (stack.has(neighbor)) {
29
+ const cycleStart = path.indexOf(neighbor);
30
+ cycles.push(`Circular delegation detected: ${[...path.slice(cycleStart), neighbor].join(" \u2192 ")}`);
31
+ return true;
32
+ }
33
+ }
34
+ stack.delete(node);
35
+ path.pop();
36
+ return false;
37
+ }
38
+ for (const node of graph.keys()) {
39
+ if (!visited.has(node)) {
40
+ path.length = 0;
41
+ dfs(node);
42
+ }
43
+ }
44
+ return cycles;
45
+ }
46
+ function buildDelegationGraph(agentData) {
47
+ const graph = /* @__PURE__ */ new Map();
48
+ for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
49
+ const delegates = subAgent.canDelegateTo?.filter(
50
+ (d) => typeof d === "string"
51
+ );
52
+ if (delegates?.length) {
53
+ graph.set(subAgentId, delegates);
54
+ }
55
+ }
56
+ return graph;
57
+ }
15
58
  var tenantScoped = {
16
59
  tenantId: sqliteCore.text("tenant_id").notNull(),
17
60
  id: sqliteCore.text("id").notNull()
@@ -1884,6 +1927,10 @@ function validateAgentRelationships(agentData) {
1884
1927
  }
1885
1928
  }
1886
1929
  }
1930
+ const cycles = detectDelegationCycles(agentData);
1931
+ if (cycles.length > 0) {
1932
+ errors.push(...cycles);
1933
+ }
1887
1934
  if (errors.length > 0)
1888
1935
  throw new Error(`Agent relationship validation failed:
1889
1936
  ${errors.join("\n")}`);
@@ -2182,6 +2229,57 @@ function validateRender(render) {
2182
2229
  errors
2183
2230
  };
2184
2231
  }
2232
+ var TextStartEventSchema = zod.z.object({
2233
+ type: zod.z.literal("text-start"),
2234
+ id: zod.z.string()
2235
+ });
2236
+ var TextDeltaEventSchema = zod.z.object({
2237
+ type: zod.z.literal("text-delta"),
2238
+ id: zod.z.string(),
2239
+ delta: zod.z.string()
2240
+ });
2241
+ var TextEndEventSchema = zod.z.object({
2242
+ type: zod.z.literal("text-end"),
2243
+ id: zod.z.string()
2244
+ });
2245
+ var DataComponentStreamEventSchema = zod.z.object({
2246
+ type: zod.z.literal("data-component"),
2247
+ id: zod.z.string(),
2248
+ data: zod.z.any()
2249
+ });
2250
+ var DataOperationStreamEventSchema = zod.z.object({
2251
+ type: zod.z.literal("data-operation"),
2252
+ data: zod.z.any()
2253
+ // Contains OperationEvent types (AgentInitializingEvent, CompletionEvent, etc.)
2254
+ });
2255
+ var DataSummaryStreamEventSchema = zod.z.object({
2256
+ type: zod.z.literal("data-summary"),
2257
+ data: zod.z.any()
2258
+ // Contains SummaryEvent from entities.ts
2259
+ });
2260
+ var StreamErrorEventSchema = zod.z.object({
2261
+ type: zod.z.literal("error"),
2262
+ error: zod.z.string()
2263
+ });
2264
+ var StreamFinishEventSchema = zod.z.object({
2265
+ type: zod.z.literal("finish"),
2266
+ finishReason: zod.z.string().optional(),
2267
+ usage: zod.z.object({
2268
+ promptTokens: zod.z.number().optional(),
2269
+ completionTokens: zod.z.number().optional(),
2270
+ totalTokens: zod.z.number().optional()
2271
+ }).optional()
2272
+ });
2273
+ var StreamEventSchema = zod.z.discriminatedUnion("type", [
2274
+ TextStartEventSchema,
2275
+ TextDeltaEventSchema,
2276
+ TextEndEventSchema,
2277
+ DataComponentStreamEventSchema,
2278
+ DataOperationStreamEventSchema,
2279
+ DataSummaryStreamEventSchema,
2280
+ StreamErrorEventSchema,
2281
+ StreamFinishEventSchema
2282
+ ]);
2185
2283
 
2186
2284
  exports.A2AMessageMetadataSchema = A2AMessageMetadataSchema;
2187
2285
  exports.AgentApiInsertSchema = AgentApiInsertSchema;
@@ -2251,9 +2349,12 @@ exports.DataComponentInsertSchema = DataComponentInsertSchema;
2251
2349
  exports.DataComponentListResponse = DataComponentListResponse;
2252
2350
  exports.DataComponentResponse = DataComponentResponse;
2253
2351
  exports.DataComponentSelectSchema = DataComponentSelectSchema;
2352
+ exports.DataComponentStreamEventSchema = DataComponentStreamEventSchema;
2254
2353
  exports.DataComponentUpdateSchema = DataComponentUpdateSchema;
2255
2354
  exports.DataOperationDetailsSchema = DataOperationDetailsSchema;
2256
2355
  exports.DataOperationEventSchema = DataOperationEventSchema;
2356
+ exports.DataOperationStreamEventSchema = DataOperationStreamEventSchema;
2357
+ exports.DataSummaryStreamEventSchema = DataSummaryStreamEventSchema;
2257
2358
  exports.DelegationReturnedDataSchema = DelegationReturnedDataSchema;
2258
2359
  exports.DelegationSentDataSchema = DelegationSentDataSchema;
2259
2360
  exports.ErrorResponseSchema = ErrorResponseSchema;
@@ -2329,6 +2430,9 @@ exports.SingleResponseSchema = SingleResponseSchema;
2329
2430
  exports.StatusComponentSchema = StatusComponentSchema;
2330
2431
  exports.StatusUpdateSchema = StatusUpdateSchema;
2331
2432
  exports.StopWhenSchema = StopWhenSchema;
2433
+ exports.StreamErrorEventSchema = StreamErrorEventSchema;
2434
+ exports.StreamEventSchema = StreamEventSchema;
2435
+ exports.StreamFinishEventSchema = StreamFinishEventSchema;
2332
2436
  exports.SubAgentApiInsertSchema = SubAgentApiInsertSchema;
2333
2437
  exports.SubAgentApiSelectSchema = SubAgentApiSelectSchema;
2334
2438
  exports.SubAgentApiUpdateSchema = SubAgentApiUpdateSchema;
@@ -2404,6 +2508,9 @@ exports.TenantProjectAgentSubAgentIdParamsSchema = TenantProjectAgentSubAgentIdP
2404
2508
  exports.TenantProjectAgentSubAgentParamsSchema = TenantProjectAgentSubAgentParamsSchema;
2405
2509
  exports.TenantProjectIdParamsSchema = TenantProjectIdParamsSchema;
2406
2510
  exports.TenantProjectParamsSchema = TenantProjectParamsSchema;
2511
+ exports.TextDeltaEventSchema = TextDeltaEventSchema;
2512
+ exports.TextEndEventSchema = TextEndEventSchema;
2513
+ exports.TextStartEventSchema = TextStartEventSchema;
2407
2514
  exports.ToolApiInsertSchema = ToolApiInsertSchema;
2408
2515
  exports.ToolApiSelectSchema = ToolApiSelectSchema;
2409
2516
  exports.ToolApiUpdateSchema = ToolApiUpdateSchema;
@@ -24,7 +24,7 @@ declare function validateDataComponentReferences(agentData: FullAgentDefinition,
24
24
  */
25
25
  declare function validateArtifactComponentReferences(agentData: FullAgentDefinition, availableArtifactComponentIds?: Set<string>): void;
26
26
  /**
27
- * Validates agent relationships (transfer and delegation targets exist)
27
+ * Validates agent relationships (transfer and delegation targets exist, and there is no circular delegation)
28
28
  */
29
29
  declare function validateAgentRelationships(agentData: FullAgentDefinition): void;
30
30
  declare function validateSubAgentExternalAgentRelations(agentData: FullAgentDefinition, availableExternalAgentIds?: Set<string>): void;
@@ -151,4 +151,124 @@ declare function validateRender(render: {
151
151
  mockData: Record<string, unknown>;
152
152
  }): RenderValidationResult;
153
153
 
154
- export { type A2AMessageMetadata, A2AMessageMetadataSchema, AgentWithinContextOfProjectSchema, type DataOperationDetails, DataOperationDetailsSchema, type DataOperationEvent, DataOperationEventSchema, type DelegationReturnedData, DelegationReturnedDataSchema, type DelegationSentData, DelegationSentDataSchema, type RenderValidationResult, type TransferData, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences };
154
+ /**
155
+ * Vercel AI SDK Data Stream Protocol Event Schemas
156
+ *
157
+ * These schemas define the structure of events sent by the Inkeep Agents Run API.
158
+ * They are used by both the streaming backend and AI SDK providers to ensure type safety.
159
+ */
160
+ /**
161
+ * Marks the beginning of a text stream
162
+ */
163
+ declare const TextStartEventSchema: z.ZodObject<{
164
+ type: z.ZodLiteral<"text-start">;
165
+ id: z.ZodString;
166
+ }, z.core.$strip>;
167
+ /**
168
+ * Represents a chunk of streaming text
169
+ */
170
+ declare const TextDeltaEventSchema: z.ZodObject<{
171
+ type: z.ZodLiteral<"text-delta">;
172
+ id: z.ZodString;
173
+ delta: z.ZodString;
174
+ }, z.core.$strip>;
175
+ /**
176
+ * Marks the end of a text stream
177
+ */
178
+ declare const TextEndEventSchema: z.ZodObject<{
179
+ type: z.ZodLiteral<"text-end">;
180
+ id: z.ZodString;
181
+ }, z.core.$strip>;
182
+ /**
183
+ * Data component event - structured data in the stream
184
+ * Used for artifacts, visualizations, or other structured outputs
185
+ */
186
+ declare const DataComponentStreamEventSchema: z.ZodObject<{
187
+ type: z.ZodLiteral<"data-component">;
188
+ id: z.ZodString;
189
+ data: z.ZodAny;
190
+ }, z.core.$strip>;
191
+ /**
192
+ * Data operation event - agent operations and state changes
193
+ * Wraps operation events (agent_initializing, completion, etc.)
194
+ */
195
+ declare const DataOperationStreamEventSchema: z.ZodObject<{
196
+ type: z.ZodLiteral<"data-operation">;
197
+ data: z.ZodAny;
198
+ }, z.core.$strip>;
199
+ /**
200
+ * Data summary event - progress summaries and status updates
201
+ */
202
+ declare const DataSummaryStreamEventSchema: z.ZodObject<{
203
+ type: z.ZodLiteral<"data-summary">;
204
+ data: z.ZodAny;
205
+ }, z.core.$strip>;
206
+ /**
207
+ * Stream error event
208
+ */
209
+ declare const StreamErrorEventSchema: z.ZodObject<{
210
+ type: z.ZodLiteral<"error">;
211
+ error: z.ZodString;
212
+ }, z.core.$strip>;
213
+ /**
214
+ * Stream finish event with usage statistics
215
+ */
216
+ declare const StreamFinishEventSchema: z.ZodObject<{
217
+ type: z.ZodLiteral<"finish">;
218
+ finishReason: z.ZodOptional<z.ZodString>;
219
+ usage: z.ZodOptional<z.ZodObject<{
220
+ promptTokens: z.ZodOptional<z.ZodNumber>;
221
+ completionTokens: z.ZodOptional<z.ZodNumber>;
222
+ totalTokens: z.ZodOptional<z.ZodNumber>;
223
+ }, z.core.$strip>>;
224
+ }, z.core.$strip>;
225
+ /**
226
+ * Union of all stream event types
227
+ * This is the main schema used for validating incoming stream events
228
+ */
229
+ declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
230
+ type: z.ZodLiteral<"text-start">;
231
+ id: z.ZodString;
232
+ }, z.core.$strip>, z.ZodObject<{
233
+ type: z.ZodLiteral<"text-delta">;
234
+ id: z.ZodString;
235
+ delta: z.ZodString;
236
+ }, z.core.$strip>, z.ZodObject<{
237
+ type: z.ZodLiteral<"text-end">;
238
+ id: z.ZodString;
239
+ }, z.core.$strip>, z.ZodObject<{
240
+ type: z.ZodLiteral<"data-component">;
241
+ id: z.ZodString;
242
+ data: z.ZodAny;
243
+ }, z.core.$strip>, z.ZodObject<{
244
+ type: z.ZodLiteral<"data-operation">;
245
+ data: z.ZodAny;
246
+ }, z.core.$strip>, z.ZodObject<{
247
+ type: z.ZodLiteral<"data-summary">;
248
+ data: z.ZodAny;
249
+ }, z.core.$strip>, z.ZodObject<{
250
+ type: z.ZodLiteral<"error">;
251
+ error: z.ZodString;
252
+ }, z.core.$strip>, z.ZodObject<{
253
+ type: z.ZodLiteral<"finish">;
254
+ finishReason: z.ZodOptional<z.ZodString>;
255
+ usage: z.ZodOptional<z.ZodObject<{
256
+ promptTokens: z.ZodOptional<z.ZodNumber>;
257
+ completionTokens: z.ZodOptional<z.ZodNumber>;
258
+ totalTokens: z.ZodOptional<z.ZodNumber>;
259
+ }, z.core.$strip>>;
260
+ }, z.core.$strip>], "type">;
261
+ type TextStartEvent = z.infer<typeof TextStartEventSchema>;
262
+ type TextDeltaEvent = z.infer<typeof TextDeltaEventSchema>;
263
+ type TextEndEvent = z.infer<typeof TextEndEventSchema>;
264
+ type DataComponentStreamEvent = z.infer<typeof DataComponentStreamEventSchema>;
265
+ type DataOperationStreamEvent = z.infer<typeof DataOperationStreamEventSchema>;
266
+ type DataSummaryStreamEvent = z.infer<typeof DataSummaryStreamEventSchema>;
267
+ type StreamErrorEvent = z.infer<typeof StreamErrorEventSchema>;
268
+ type StreamFinishEvent = z.infer<typeof StreamFinishEventSchema>;
269
+ /**
270
+ * Union type of all possible stream events
271
+ */
272
+ type StreamEvent = z.infer<typeof StreamEventSchema>;
273
+
274
+ export { type A2AMessageMetadata, A2AMessageMetadataSchema, AgentWithinContextOfProjectSchema, type DataComponentStreamEvent, DataComponentStreamEventSchema, type DataOperationDetails, DataOperationDetailsSchema, type DataOperationEvent, DataOperationEventSchema, type DataOperationStreamEvent, DataOperationStreamEventSchema, type DataSummaryStreamEvent, DataSummaryStreamEventSchema, type DelegationReturnedData, DelegationReturnedDataSchema, type DelegationSentData, DelegationSentDataSchema, type RenderValidationResult, type StreamErrorEvent, StreamErrorEventSchema, type StreamEvent, StreamEventSchema, type StreamFinishEvent, StreamFinishEventSchema, type TextDeltaEvent, TextDeltaEventSchema, type TextEndEvent, TextEndEventSchema, type TextStartEvent, TextStartEventSchema, type TransferData, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences };
@@ -24,7 +24,7 @@ declare function validateDataComponentReferences(agentData: FullAgentDefinition,
24
24
  */
25
25
  declare function validateArtifactComponentReferences(agentData: FullAgentDefinition, availableArtifactComponentIds?: Set<string>): void;
26
26
  /**
27
- * Validates agent relationships (transfer and delegation targets exist)
27
+ * Validates agent relationships (transfer and delegation targets exist, and there is no circular delegation)
28
28
  */
29
29
  declare function validateAgentRelationships(agentData: FullAgentDefinition): void;
30
30
  declare function validateSubAgentExternalAgentRelations(agentData: FullAgentDefinition, availableExternalAgentIds?: Set<string>): void;
@@ -151,4 +151,124 @@ declare function validateRender(render: {
151
151
  mockData: Record<string, unknown>;
152
152
  }): RenderValidationResult;
153
153
 
154
- export { type A2AMessageMetadata, A2AMessageMetadataSchema, AgentWithinContextOfProjectSchema, type DataOperationDetails, DataOperationDetailsSchema, type DataOperationEvent, DataOperationEventSchema, type DelegationReturnedData, DelegationReturnedDataSchema, type DelegationSentData, DelegationSentDataSchema, type RenderValidationResult, type TransferData, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences };
154
+ /**
155
+ * Vercel AI SDK Data Stream Protocol Event Schemas
156
+ *
157
+ * These schemas define the structure of events sent by the Inkeep Agents Run API.
158
+ * They are used by both the streaming backend and AI SDK providers to ensure type safety.
159
+ */
160
+ /**
161
+ * Marks the beginning of a text stream
162
+ */
163
+ declare const TextStartEventSchema: z.ZodObject<{
164
+ type: z.ZodLiteral<"text-start">;
165
+ id: z.ZodString;
166
+ }, z.core.$strip>;
167
+ /**
168
+ * Represents a chunk of streaming text
169
+ */
170
+ declare const TextDeltaEventSchema: z.ZodObject<{
171
+ type: z.ZodLiteral<"text-delta">;
172
+ id: z.ZodString;
173
+ delta: z.ZodString;
174
+ }, z.core.$strip>;
175
+ /**
176
+ * Marks the end of a text stream
177
+ */
178
+ declare const TextEndEventSchema: z.ZodObject<{
179
+ type: z.ZodLiteral<"text-end">;
180
+ id: z.ZodString;
181
+ }, z.core.$strip>;
182
+ /**
183
+ * Data component event - structured data in the stream
184
+ * Used for artifacts, visualizations, or other structured outputs
185
+ */
186
+ declare const DataComponentStreamEventSchema: z.ZodObject<{
187
+ type: z.ZodLiteral<"data-component">;
188
+ id: z.ZodString;
189
+ data: z.ZodAny;
190
+ }, z.core.$strip>;
191
+ /**
192
+ * Data operation event - agent operations and state changes
193
+ * Wraps operation events (agent_initializing, completion, etc.)
194
+ */
195
+ declare const DataOperationStreamEventSchema: z.ZodObject<{
196
+ type: z.ZodLiteral<"data-operation">;
197
+ data: z.ZodAny;
198
+ }, z.core.$strip>;
199
+ /**
200
+ * Data summary event - progress summaries and status updates
201
+ */
202
+ declare const DataSummaryStreamEventSchema: z.ZodObject<{
203
+ type: z.ZodLiteral<"data-summary">;
204
+ data: z.ZodAny;
205
+ }, z.core.$strip>;
206
+ /**
207
+ * Stream error event
208
+ */
209
+ declare const StreamErrorEventSchema: z.ZodObject<{
210
+ type: z.ZodLiteral<"error">;
211
+ error: z.ZodString;
212
+ }, z.core.$strip>;
213
+ /**
214
+ * Stream finish event with usage statistics
215
+ */
216
+ declare const StreamFinishEventSchema: z.ZodObject<{
217
+ type: z.ZodLiteral<"finish">;
218
+ finishReason: z.ZodOptional<z.ZodString>;
219
+ usage: z.ZodOptional<z.ZodObject<{
220
+ promptTokens: z.ZodOptional<z.ZodNumber>;
221
+ completionTokens: z.ZodOptional<z.ZodNumber>;
222
+ totalTokens: z.ZodOptional<z.ZodNumber>;
223
+ }, z.core.$strip>>;
224
+ }, z.core.$strip>;
225
+ /**
226
+ * Union of all stream event types
227
+ * This is the main schema used for validating incoming stream events
228
+ */
229
+ declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
230
+ type: z.ZodLiteral<"text-start">;
231
+ id: z.ZodString;
232
+ }, z.core.$strip>, z.ZodObject<{
233
+ type: z.ZodLiteral<"text-delta">;
234
+ id: z.ZodString;
235
+ delta: z.ZodString;
236
+ }, z.core.$strip>, z.ZodObject<{
237
+ type: z.ZodLiteral<"text-end">;
238
+ id: z.ZodString;
239
+ }, z.core.$strip>, z.ZodObject<{
240
+ type: z.ZodLiteral<"data-component">;
241
+ id: z.ZodString;
242
+ data: z.ZodAny;
243
+ }, z.core.$strip>, z.ZodObject<{
244
+ type: z.ZodLiteral<"data-operation">;
245
+ data: z.ZodAny;
246
+ }, z.core.$strip>, z.ZodObject<{
247
+ type: z.ZodLiteral<"data-summary">;
248
+ data: z.ZodAny;
249
+ }, z.core.$strip>, z.ZodObject<{
250
+ type: z.ZodLiteral<"error">;
251
+ error: z.ZodString;
252
+ }, z.core.$strip>, z.ZodObject<{
253
+ type: z.ZodLiteral<"finish">;
254
+ finishReason: z.ZodOptional<z.ZodString>;
255
+ usage: z.ZodOptional<z.ZodObject<{
256
+ promptTokens: z.ZodOptional<z.ZodNumber>;
257
+ completionTokens: z.ZodOptional<z.ZodNumber>;
258
+ totalTokens: z.ZodOptional<z.ZodNumber>;
259
+ }, z.core.$strip>>;
260
+ }, z.core.$strip>], "type">;
261
+ type TextStartEvent = z.infer<typeof TextStartEventSchema>;
262
+ type TextDeltaEvent = z.infer<typeof TextDeltaEventSchema>;
263
+ type TextEndEvent = z.infer<typeof TextEndEventSchema>;
264
+ type DataComponentStreamEvent = z.infer<typeof DataComponentStreamEventSchema>;
265
+ type DataOperationStreamEvent = z.infer<typeof DataOperationStreamEventSchema>;
266
+ type DataSummaryStreamEvent = z.infer<typeof DataSummaryStreamEventSchema>;
267
+ type StreamErrorEvent = z.infer<typeof StreamErrorEventSchema>;
268
+ type StreamFinishEvent = z.infer<typeof StreamFinishEventSchema>;
269
+ /**
270
+ * Union type of all possible stream events
271
+ */
272
+ type StreamEvent = z.infer<typeof StreamEventSchema>;
273
+
274
+ export { type A2AMessageMetadata, A2AMessageMetadataSchema, AgentWithinContextOfProjectSchema, type DataComponentStreamEvent, DataComponentStreamEventSchema, type DataOperationDetails, DataOperationDetailsSchema, type DataOperationEvent, DataOperationEventSchema, type DataOperationStreamEvent, DataOperationStreamEventSchema, type DataSummaryStreamEvent, DataSummaryStreamEventSchema, type DelegationReturnedData, DelegationReturnedDataSchema, type DelegationSentData, DelegationSentDataSchema, type RenderValidationResult, type StreamErrorEvent, StreamErrorEventSchema, type StreamEvent, StreamEventSchema, type StreamFinishEvent, StreamFinishEventSchema, type TextDeltaEvent, TextDeltaEventSchema, type TextEndEvent, TextEndEventSchema, type TextStartEvent, TextStartEventSchema, type TransferData, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences };
@@ -1,2 +1,2 @@
1
- export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences } from '../chunk-4FQG5A4Z.js';
1
+ export { A2AMessageMetadataSchema, DataComponentStreamEventSchema, DataOperationDetailsSchema, DataOperationEventSchema, DataOperationStreamEventSchema, DataSummaryStreamEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, StreamErrorEventSchema, StreamEventSchema, StreamFinishEventSchema, TextDeltaEventSchema, TextEndEventSchema, TextStartEventSchema, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences } from '../chunk-5EDDDVYT.js';
2
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, SubAgentExternalAgentRelationApiInsertSchema, SubAgentExternalAgentRelationApiSelectSchema, SubAgentExternalAgentRelationApiUpdateSchema, SubAgentExternalAgentRelationInsertSchema, SubAgentExternalAgentRelationSelectSchema, SubAgentExternalAgentRelationUpdateSchema, SubAgentInsertSchema, SubAgentListResponse, SubAgentRelationApiInsertSchema, SubAgentRelationApiSelectSchema, SubAgentRelationApiUpdateSchema, SubAgentRelationInsertSchema, SubAgentRelationListResponse, SubAgentRelationQuerySchema, SubAgentRelationResponse, SubAgentRelationSelectSchema, SubAgentRelationUpdateSchema, SubAgentResponse, SubAgentSelectSchema, SubAgentStopWhenSchema, SubAgentTeamAgentRelationApiInsertSchema, SubAgentTeamAgentRelationApiSelectSchema, SubAgentTeamAgentRelationApiUpdateSchema, SubAgentTeamAgentRelationInsertSchema, SubAgentTeamAgentRelationSelectSchema, SubAgentTeamAgentRelationUpdateSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiSelectSchema, SubAgentToolRelationApiUpdateSchema, SubAgentToolRelationInsertSchema, SubAgentToolRelationListResponse, SubAgentToolRelationResponse, SubAgentToolRelationSelectSchema, SubAgentToolRelationUpdateSchema, SubAgentUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TeamAgentSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, TenantProjectAgentSubAgentIdParamsSchema, TenantProjectAgentSubAgentParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolListResponse, ToolResponse, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, canDelegateToExternalAgentSchema, canDelegateToTeamAgentSchema, resourceIdSchema, validatePropsAsJsonSchema } from '../chunk-37BY2EHU.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-core",
3
- "version": "0.30.0",
3
+ "version": "0.30.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",