@inkeep/agents-core 0.0.0-dev-20251008182848 → 0.0.0-dev-20251008200151

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.
Files changed (36) hide show
  1. package/dist/{chunk-AHSEMW6N.js → chunk-5ZHSPLXI.js} +1 -2
  2. package/dist/{chunk-AAOYOQTI.js → chunk-BNXFEUNP.js} +105 -2
  3. package/dist/{chunk-GS26HY5D.js → chunk-PR7XWHED.js} +1 -1
  4. package/dist/chunk-R2EERZSW.js +223 -0
  5. package/dist/client-exports.cjs +110 -9
  6. package/dist/client-exports.d.cts +14 -11
  7. package/dist/client-exports.d.ts +14 -11
  8. package/dist/client-exports.js +4 -10
  9. package/dist/db/schema.cjs +1 -2
  10. package/dist/db/schema.d.cts +2 -2
  11. package/dist/db/schema.d.ts +2 -2
  12. package/dist/db/schema.js +1 -1
  13. package/dist/index.cjs +549 -371
  14. package/dist/index.d.cts +262 -265
  15. package/dist/index.d.ts +262 -265
  16. package/dist/index.js +41 -188
  17. package/dist/props-validation-BMR1qNiy.d.cts +15 -0
  18. package/dist/props-validation-BMR1qNiy.d.ts +15 -0
  19. package/dist/{schema-D0E2bG9V.d.ts → schema-BYR5XAeI.d.ts} +3 -22
  20. package/dist/{schema-CTBfyt-o.d.cts → schema-Cn2ZkYOh.d.cts} +3 -22
  21. package/dist/types/index.d.cts +2 -2
  22. package/dist/types/index.d.ts +2 -2
  23. package/dist/{utility-BMAHFZX6.d.cts → utility-6UlHR5nQ.d.cts} +191 -216
  24. package/dist/{utility-BMAHFZX6.d.ts → utility-6UlHR5nQ.d.ts} +191 -216
  25. package/dist/utils/schema-conversion.cjs +236 -0
  26. package/dist/utils/schema-conversion.d.cts +26 -0
  27. package/dist/utils/schema-conversion.d.ts +26 -0
  28. package/dist/utils/schema-conversion.js +1 -0
  29. package/dist/validation/index.cjs +109 -2
  30. package/dist/validation/index.d.cts +3 -2
  31. package/dist/validation/index.d.ts +3 -2
  32. package/dist/validation/index.js +2 -2
  33. package/drizzle/0002_bumpy_romulus.sql +3 -0
  34. package/drizzle/meta/0002_snapshot.json +2428 -0
  35. package/drizzle/meta/_journal.json +7 -0
  36. package/package.json +1 -1
@@ -325,8 +325,7 @@ var artifactComponents = sqliteTable(
325
325
  {
326
326
  ...projectScoped,
327
327
  ...uiProperties,
328
- summaryProps: blob("summary_props", { mode: "json" }).$type(),
329
- fullProps: blob("full_props", { mode: "json" }).$type(),
328
+ props: blob("props", { mode: "json" }).$type(),
330
329
  ...timestamps
331
330
  },
332
331
  (table) => [
@@ -1,7 +1,8 @@
1
+ import { agents, agentRelations, agentGraph, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, externalAgents, apiKeys, credentialReferences, contextConfigs, agentToolRelations, ledgerArtifacts, projects } from './chunk-5ZHSPLXI.js';
1
2
  import { VALID_RELATION_TYPES, MCPTransportType, TOOL_STATUS_VALUES, CredentialStoreType, MCPServerType } from './chunk-YFHT5M2R.js';
2
- import { agents, agentRelations, agentGraph, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, externalAgents, apiKeys, credentialReferences, contextConfigs, agentToolRelations, ledgerArtifacts, projects } from './chunk-AHSEMW6N.js';
3
3
  import { z } from '@hono/zod-openapi';
4
4
  import { createSelectSchema, createInsertSchema } from 'drizzle-zod';
5
+ import Ajv from 'ajv';
5
6
 
6
7
  var StopWhenSchema = z.object({
7
8
  transferCountIs: z.number().min(1).max(100).optional(),
@@ -627,5 +628,107 @@ var PaginationQueryParamsSchema = z.object({
627
628
  page: z.coerce.number().min(1).default(1),
628
629
  limit: z.coerce.number().min(1).max(100).default(10)
629
630
  });
631
+ function validatePropsAsJsonSchema(props) {
632
+ if (!props || typeof props === "object" && Object.keys(props).length === 0) {
633
+ return {
634
+ isValid: true,
635
+ errors: []
636
+ };
637
+ }
638
+ if (typeof props !== "object" || Array.isArray(props)) {
639
+ return {
640
+ isValid: false,
641
+ errors: [
642
+ {
643
+ field: "props",
644
+ message: "Props must be a valid JSON Schema object",
645
+ value: props
646
+ }
647
+ ]
648
+ };
649
+ }
650
+ if (!props.type) {
651
+ return {
652
+ isValid: false,
653
+ errors: [
654
+ {
655
+ field: "props.type",
656
+ message: 'JSON Schema must have a "type" field'
657
+ }
658
+ ]
659
+ };
660
+ }
661
+ if (props.type !== "object") {
662
+ return {
663
+ isValid: false,
664
+ errors: [
665
+ {
666
+ field: "props.type",
667
+ message: 'JSON Schema type must be "object" for component props',
668
+ value: props.type
669
+ }
670
+ ]
671
+ };
672
+ }
673
+ if (!props.properties || typeof props.properties !== "object") {
674
+ return {
675
+ isValid: false,
676
+ errors: [
677
+ {
678
+ field: "props.properties",
679
+ message: 'JSON Schema must have a "properties" object'
680
+ }
681
+ ]
682
+ };
683
+ }
684
+ if (props.required !== void 0 && !Array.isArray(props.required)) {
685
+ return {
686
+ isValid: false,
687
+ errors: [
688
+ {
689
+ field: "props.required",
690
+ message: 'If present, "required" must be an array'
691
+ }
692
+ ]
693
+ };
694
+ }
695
+ try {
696
+ const schemaToValidate = { ...props };
697
+ delete schemaToValidate.$schema;
698
+ const schemaValidator = new Ajv({
699
+ strict: false,
700
+ // Allow unknown keywords like inPreview
701
+ validateSchema: true,
702
+ // Validate the schema itself
703
+ addUsedSchema: false
704
+ // Don't add schemas to the instance
705
+ });
706
+ const isValid = schemaValidator.validateSchema(schemaToValidate);
707
+ if (!isValid) {
708
+ const errors = schemaValidator.errors || [];
709
+ return {
710
+ isValid: false,
711
+ errors: errors.map((error) => ({
712
+ field: `props${error.instancePath || ""}`,
713
+ message: error.message || "Invalid schema"
714
+ }))
715
+ };
716
+ }
717
+ return {
718
+ isValid: true,
719
+ errors: []
720
+ };
721
+ } catch (error) {
722
+ return {
723
+ isValid: false,
724
+ errors: [
725
+ {
726
+ field: "props",
727
+ message: `Schema validation failed: ${error instanceof Error ? error.message : "Unknown error"}`
728
+ }
729
+ ]
730
+ };
731
+ }
732
+ }
630
733
 
631
- export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, IdParamsSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema };
734
+ export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, IdParamsSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema, validatePropsAsJsonSchema };
@@ -1,4 +1,4 @@
1
- import { FullGraphDefinitionSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-AAOYOQTI.js';
1
+ import { FullGraphDefinitionSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-BNXFEUNP.js';
2
2
 
3
3
  // src/validation/graphFull.ts
4
4
  function isInternalAgent(agent) {
@@ -0,0 +1,223 @@
1
+ import { __publicField } from './chunk-MKBO26DX.js';
2
+ import { z } from 'zod';
3
+ import pino from 'pino';
4
+ import pinoPretty from 'pino-pretty';
5
+
6
+ var PinoLogger = class {
7
+ constructor(name, config = {}) {
8
+ this.name = name;
9
+ __publicField(this, "transportConfigs", []);
10
+ __publicField(this, "pinoInstance");
11
+ __publicField(this, "options");
12
+ this.options = {
13
+ name: this.name,
14
+ level: process.env.LOG_LEVEL || (process.env.ENVIRONMENT === "test" ? "silent" : "info"),
15
+ serializers: {
16
+ obj: (value) => ({ ...value })
17
+ },
18
+ redact: ["req.headers.authorization", 'req.headers["x-inkeep-admin-authentication"]'],
19
+ ...config.options
20
+ };
21
+ if (config.transportConfigs) {
22
+ this.transportConfigs = config.transportConfigs;
23
+ }
24
+ if (this.transportConfigs.length > 0) {
25
+ this.pinoInstance = pino(this.options, pino.transport({ targets: this.transportConfigs }));
26
+ } else {
27
+ try {
28
+ const prettyStream = pinoPretty({
29
+ colorize: true,
30
+ translateTime: "HH:MM:ss",
31
+ ignore: "pid,hostname"
32
+ });
33
+ this.pinoInstance = pino(this.options, prettyStream);
34
+ } catch (error) {
35
+ console.warn("Warning: pino-pretty failed, using standard JSON output:", error);
36
+ this.pinoInstance = pino(this.options);
37
+ }
38
+ }
39
+ }
40
+ /**
41
+ * Recreate the pino instance with current transports
42
+ */
43
+ recreateInstance() {
44
+ if (this.pinoInstance && typeof this.pinoInstance.flush === "function") {
45
+ this.pinoInstance.flush();
46
+ }
47
+ if (this.transportConfigs.length === 0) {
48
+ try {
49
+ const prettyStream = pinoPretty({
50
+ colorize: true,
51
+ translateTime: "HH:MM:ss",
52
+ ignore: "pid,hostname"
53
+ });
54
+ this.pinoInstance = pino(this.options, prettyStream);
55
+ } catch (error) {
56
+ console.warn("Warning: pino-pretty failed, using standard JSON output:", error);
57
+ this.pinoInstance = pino(this.options);
58
+ }
59
+ } else {
60
+ const multiTransport = { targets: this.transportConfigs };
61
+ const pinoTransport = pino.transport(multiTransport);
62
+ this.pinoInstance = pino(this.options, pinoTransport);
63
+ }
64
+ }
65
+ /**
66
+ * Add a new transport to the logger
67
+ */
68
+ addTransport(transportConfig) {
69
+ this.transportConfigs.push(transportConfig);
70
+ this.recreateInstance();
71
+ }
72
+ /**
73
+ * Remove a transport by index
74
+ */
75
+ removeTransport(index) {
76
+ if (index >= 0 && index < this.transportConfigs.length) {
77
+ this.transportConfigs.splice(index, 1);
78
+ this.recreateInstance();
79
+ }
80
+ }
81
+ /**
82
+ * Get current transports
83
+ */
84
+ getTransports() {
85
+ return [...this.transportConfigs];
86
+ }
87
+ /**
88
+ * Update logger options
89
+ */
90
+ updateOptions(options) {
91
+ this.options = {
92
+ ...this.options,
93
+ ...options
94
+ };
95
+ this.recreateInstance();
96
+ }
97
+ /**
98
+ * Get the underlying pino instance for advanced usage
99
+ */
100
+ getPinoInstance() {
101
+ return this.pinoInstance;
102
+ }
103
+ error(data, message) {
104
+ this.pinoInstance.error(data, message);
105
+ }
106
+ warn(data, message) {
107
+ this.pinoInstance.warn(data, message);
108
+ }
109
+ info(data, message) {
110
+ this.pinoInstance.info(data, message);
111
+ }
112
+ debug(data, message) {
113
+ this.pinoInstance.debug(data, message);
114
+ }
115
+ };
116
+ var LoggerFactory = class {
117
+ constructor() {
118
+ __publicField(this, "config", {});
119
+ __publicField(this, "loggers", /* @__PURE__ */ new Map());
120
+ }
121
+ /**
122
+ * Configure the logger factory
123
+ */
124
+ configure(config) {
125
+ this.config = config;
126
+ this.loggers.clear();
127
+ }
128
+ /**
129
+ * Get or create a logger instance
130
+ */
131
+ getLogger(name) {
132
+ if (this.loggers.has(name)) {
133
+ const logger3 = this.loggers.get(name);
134
+ if (!logger3) {
135
+ throw new Error(`Logger '${name}' not found in cache`);
136
+ }
137
+ return logger3;
138
+ }
139
+ let logger2;
140
+ if (this.config.loggerFactory) {
141
+ logger2 = this.config.loggerFactory(name);
142
+ } else if (this.config.defaultLogger) {
143
+ logger2 = this.config.defaultLogger;
144
+ } else {
145
+ logger2 = new PinoLogger(name, this.config.pinoConfig);
146
+ }
147
+ this.loggers.set(name, logger2);
148
+ return logger2;
149
+ }
150
+ /**
151
+ * Reset factory to default state
152
+ */
153
+ reset() {
154
+ this.config = {};
155
+ this.loggers.clear();
156
+ }
157
+ };
158
+ var loggerFactory = new LoggerFactory();
159
+ function getLogger(name) {
160
+ return loggerFactory.getLogger(name);
161
+ }
162
+
163
+ // src/utils/schema-conversion.ts
164
+ var logger = getLogger("schema-conversion");
165
+ function convertZodToJsonSchema(zodSchema) {
166
+ try {
167
+ const jsonSchema = z.toJSONSchema(zodSchema);
168
+ if (jsonSchema.$schema) {
169
+ delete jsonSchema.$schema;
170
+ }
171
+ return jsonSchema;
172
+ } catch (error) {
173
+ logger.error(
174
+ {
175
+ error: error instanceof Error ? error.message : "Unknown error",
176
+ stack: error instanceof Error ? error.stack : void 0
177
+ },
178
+ "Failed to convert Zod schema to JSON Schema"
179
+ );
180
+ throw new Error("Failed to convert Zod schema to JSON Schema");
181
+ }
182
+ }
183
+ var preview = (schema) => {
184
+ schema._def.inPreview = true;
185
+ return schema;
186
+ };
187
+ function convertZodToJsonSchemaWithPreview(zodSchema) {
188
+ const jsonSchema = convertZodToJsonSchema(zodSchema);
189
+ if (zodSchema instanceof z.ZodObject && jsonSchema.properties) {
190
+ const shape = zodSchema.shape;
191
+ for (const [key, fieldSchema] of Object.entries(shape)) {
192
+ if (fieldSchema?._def?.inPreview === true) {
193
+ jsonSchema.properties[key].inPreview = true;
194
+ }
195
+ }
196
+ }
197
+ return jsonSchema;
198
+ }
199
+ function isZodSchema(value) {
200
+ return value?._def?.type === "object";
201
+ }
202
+ function extractPreviewFields(schema) {
203
+ const previewFields = [];
204
+ if (schema instanceof z.ZodObject) {
205
+ const shape = schema.shape;
206
+ for (const [key, fieldSchema] of Object.entries(shape)) {
207
+ if (fieldSchema?._def?.inPreview === true) {
208
+ previewFields.push(key);
209
+ }
210
+ }
211
+ return previewFields;
212
+ }
213
+ if (schema?.type === "object" && schema.properties) {
214
+ for (const [key, prop] of Object.entries(schema.properties)) {
215
+ if (prop.inPreview === true) {
216
+ previewFields.push(key);
217
+ }
218
+ }
219
+ }
220
+ return previewFields;
221
+ }
222
+
223
+ export { PinoLogger, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, getLogger, isZodSchema, loggerFactory, preview };
@@ -5,6 +5,11 @@ var zodOpenapi = require('@hono/zod-openapi');
5
5
  var drizzleZod = require('drizzle-zod');
6
6
  var drizzleOrm = require('drizzle-orm');
7
7
  var sqliteCore = require('drizzle-orm/sqlite-core');
8
+ var Ajv = require('ajv');
9
+
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
8
13
 
9
14
  // src/client-exports.ts
10
15
 
@@ -303,8 +308,7 @@ var artifactComponents = sqliteCore.sqliteTable(
303
308
  {
304
309
  ...projectScoped,
305
310
  ...uiProperties,
306
- summaryProps: sqliteCore.blob("summary_props", { mode: "json" }).$type(),
307
- fullProps: sqliteCore.blob("full_props", { mode: "json" }).$type(),
311
+ props: sqliteCore.blob("props", { mode: "json" }).$type(),
308
312
  ...timestamps
309
313
  },
310
314
  (table) => [
@@ -1436,6 +1440,108 @@ zodOpenapi.z.object({
1436
1440
  page: zodOpenapi.z.coerce.number().min(1).default(1),
1437
1441
  limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10)
1438
1442
  });
1443
+ function validatePropsAsJsonSchema(props) {
1444
+ if (!props || typeof props === "object" && Object.keys(props).length === 0) {
1445
+ return {
1446
+ isValid: true,
1447
+ errors: []
1448
+ };
1449
+ }
1450
+ if (typeof props !== "object" || Array.isArray(props)) {
1451
+ return {
1452
+ isValid: false,
1453
+ errors: [
1454
+ {
1455
+ field: "props",
1456
+ message: "Props must be a valid JSON Schema object",
1457
+ value: props
1458
+ }
1459
+ ]
1460
+ };
1461
+ }
1462
+ if (!props.type) {
1463
+ return {
1464
+ isValid: false,
1465
+ errors: [
1466
+ {
1467
+ field: "props.type",
1468
+ message: 'JSON Schema must have a "type" field'
1469
+ }
1470
+ ]
1471
+ };
1472
+ }
1473
+ if (props.type !== "object") {
1474
+ return {
1475
+ isValid: false,
1476
+ errors: [
1477
+ {
1478
+ field: "props.type",
1479
+ message: 'JSON Schema type must be "object" for component props',
1480
+ value: props.type
1481
+ }
1482
+ ]
1483
+ };
1484
+ }
1485
+ if (!props.properties || typeof props.properties !== "object") {
1486
+ return {
1487
+ isValid: false,
1488
+ errors: [
1489
+ {
1490
+ field: "props.properties",
1491
+ message: 'JSON Schema must have a "properties" object'
1492
+ }
1493
+ ]
1494
+ };
1495
+ }
1496
+ if (props.required !== void 0 && !Array.isArray(props.required)) {
1497
+ return {
1498
+ isValid: false,
1499
+ errors: [
1500
+ {
1501
+ field: "props.required",
1502
+ message: 'If present, "required" must be an array'
1503
+ }
1504
+ ]
1505
+ };
1506
+ }
1507
+ try {
1508
+ const schemaToValidate = { ...props };
1509
+ delete schemaToValidate.$schema;
1510
+ const schemaValidator = new Ajv__default.default({
1511
+ strict: false,
1512
+ // Allow unknown keywords like inPreview
1513
+ validateSchema: true,
1514
+ // Validate the schema itself
1515
+ addUsedSchema: false
1516
+ // Don't add schemas to the instance
1517
+ });
1518
+ const isValid = schemaValidator.validateSchema(schemaToValidate);
1519
+ if (!isValid) {
1520
+ const errors = schemaValidator.errors || [];
1521
+ return {
1522
+ isValid: false,
1523
+ errors: errors.map((error) => ({
1524
+ field: `props${error.instancePath || ""}`,
1525
+ message: error.message || "Invalid schema"
1526
+ }))
1527
+ };
1528
+ }
1529
+ return {
1530
+ isValid: true,
1531
+ errors: []
1532
+ };
1533
+ } catch (error) {
1534
+ return {
1535
+ isValid: false,
1536
+ errors: [
1537
+ {
1538
+ field: "props",
1539
+ message: `Schema validation failed: ${error instanceof Error ? error.message : "Unknown error"}`
1540
+ }
1541
+ ]
1542
+ };
1543
+ }
1544
+ }
1439
1545
 
1440
1546
  // src/client-exports.ts
1441
1547
  var TenantParamsSchema2 = zod.z.object({
@@ -1523,13 +1629,7 @@ var DataComponentApiInsertSchema2 = zod.z.object({
1523
1629
  description: zod.z.string().optional(),
1524
1630
  props: zod.z.record(zod.z.string(), zod.z.unknown())
1525
1631
  });
1526
- var ArtifactComponentApiInsertSchema2 = zod.z.object({
1527
- id: zod.z.string(),
1528
- name: zod.z.string(),
1529
- description: zod.z.string().optional(),
1530
- summaryProps: zod.z.record(zod.z.string(), zod.z.unknown()),
1531
- fullProps: zod.z.record(zod.z.string(), zod.z.unknown())
1532
- });
1632
+ var ArtifactComponentApiInsertSchema2 = ArtifactComponentApiInsertSchema;
1533
1633
  var ContextConfigApiInsertSchema2 = zod.z.object({
1534
1634
  id: zod.z.string().optional(),
1535
1635
  name: zod.z.string().optional(),
@@ -1642,3 +1742,4 @@ exports.ToolApiInsertSchema = ToolApiInsertSchema2;
1642
1742
  exports.URL_SAFE_ID_PATTERN = URL_SAFE_ID_PATTERN2;
1643
1743
  exports.generateIdFromName = generateIdFromName;
1644
1744
  exports.resourceIdSchema = resourceIdSchema2;
1745
+ exports.validatePropsAsJsonSchema = validatePropsAsJsonSchema;
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { C as ConversationHistoryConfig, A as ApiKeyApiUpdateSchema, F as FullGraphAgentInsertSchema } from './utility-BMAHFZX6.cjs';
3
- export { d as AgentStopWhen, a as AgentStopWhenSchema, f as CredentialStoreType, c as GraphStopWhen, G as GraphStopWhenSchema, g as MCPTransportType, e as ModelSettings, M as ModelSettingsSchema, b as StopWhen, S as StopWhenSchema } from './utility-BMAHFZX6.cjs';
2
+ import { C as ConversationHistoryConfig, A as ApiKeyApiUpdateSchema, F as FullGraphAgentInsertSchema } from './utility-6UlHR5nQ.cjs';
3
+ export { d as AgentStopWhen, a as AgentStopWhenSchema, f as CredentialStoreType, c as GraphStopWhen, G as GraphStopWhenSchema, g as MCPTransportType, e as ModelSettings, M as ModelSettingsSchema, b as StopWhen, S as StopWhenSchema } from './utility-6UlHR5nQ.cjs';
4
+ export { v as validatePropsAsJsonSchema } from './props-validation-BMR1qNiy.cjs';
4
5
  import 'drizzle-zod';
5
6
  import 'drizzle-orm/sqlite-core';
6
7
  import '@hono/zod-openapi';
@@ -127,12 +128,14 @@ declare const DataComponentApiInsertSchema: z.ZodObject<{
127
128
  props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
128
129
  }, z.core.$strip>;
129
130
  declare const ArtifactComponentApiInsertSchema: z.ZodObject<{
130
- id: z.ZodString;
131
131
  name: z.ZodString;
132
- description: z.ZodOptional<z.ZodString>;
133
- summaryProps: z.ZodRecord<z.ZodString, z.ZodUnknown>;
134
- fullProps: z.ZodRecord<z.ZodString, z.ZodUnknown>;
135
- }, z.core.$strip>;
132
+ id: z.ZodString;
133
+ description: z.ZodString;
134
+ props: z.ZodOptional<z.ZodNullable<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>>;
135
+ }, {
136
+ out: {};
137
+ in: {};
138
+ }>;
136
139
  declare const ContextConfigApiInsertSchema: z.ZodObject<{
137
140
  id: z.ZodOptional<z.ZodString>;
138
141
  name: z.ZodOptional<z.ZodString>;
@@ -161,13 +164,11 @@ declare const FullGraphDefinitionSchema: z.ZodObject<{
161
164
  description: z.ZodOptional<z.ZodString>;
162
165
  defaultAgentId: z.ZodOptional<z.ZodString>;
163
166
  agents: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
164
- id: z.ZodString;
165
167
  name: z.ZodString;
166
- description: z.ZodString;
167
- prompt: z.ZodString;
168
+ id: z.ZodString;
168
169
  createdAt: z.ZodOptional<z.ZodString>;
169
170
  updatedAt: z.ZodOptional<z.ZodString>;
170
- conversationHistoryConfig: z.ZodOptional<z.ZodNullable<z.ZodType<ConversationHistoryConfig, ConversationHistoryConfig, z.core.$ZodTypeInternals<ConversationHistoryConfig, ConversationHistoryConfig>>>>;
171
+ description: z.ZodString;
171
172
  models: z.ZodOptional<z.ZodObject<{
172
173
  base: z.ZodOptional<z.ZodObject<{
173
174
  model: z.ZodOptional<z.ZodString>;
@@ -191,6 +192,8 @@ declare const FullGraphDefinitionSchema: z.ZodObject<{
191
192
  }, {
192
193
  stepCountIs?: number | undefined;
193
194
  }>>>>;
195
+ prompt: z.ZodString;
196
+ conversationHistoryConfig: z.ZodOptional<z.ZodNullable<z.ZodType<ConversationHistoryConfig, ConversationHistoryConfig, z.core.$ZodTypeInternals<ConversationHistoryConfig, ConversationHistoryConfig>>>>;
194
197
  type: z.ZodLiteral<"internal">;
195
198
  canUse: z.ZodArray<z.ZodObject<{
196
199
  agentToolRelationId: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { C as ConversationHistoryConfig, A as ApiKeyApiUpdateSchema, F as FullGraphAgentInsertSchema } from './utility-BMAHFZX6.js';
3
- export { d as AgentStopWhen, a as AgentStopWhenSchema, f as CredentialStoreType, c as GraphStopWhen, G as GraphStopWhenSchema, g as MCPTransportType, e as ModelSettings, M as ModelSettingsSchema, b as StopWhen, S as StopWhenSchema } from './utility-BMAHFZX6.js';
2
+ import { C as ConversationHistoryConfig, A as ApiKeyApiUpdateSchema, F as FullGraphAgentInsertSchema } from './utility-6UlHR5nQ.js';
3
+ export { d as AgentStopWhen, a as AgentStopWhenSchema, f as CredentialStoreType, c as GraphStopWhen, G as GraphStopWhenSchema, g as MCPTransportType, e as ModelSettings, M as ModelSettingsSchema, b as StopWhen, S as StopWhenSchema } from './utility-6UlHR5nQ.js';
4
+ export { v as validatePropsAsJsonSchema } from './props-validation-BMR1qNiy.js';
4
5
  import 'drizzle-zod';
5
6
  import 'drizzle-orm/sqlite-core';
6
7
  import '@hono/zod-openapi';
@@ -127,12 +128,14 @@ declare const DataComponentApiInsertSchema: z.ZodObject<{
127
128
  props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
128
129
  }, z.core.$strip>;
129
130
  declare const ArtifactComponentApiInsertSchema: z.ZodObject<{
130
- id: z.ZodString;
131
131
  name: z.ZodString;
132
- description: z.ZodOptional<z.ZodString>;
133
- summaryProps: z.ZodRecord<z.ZodString, z.ZodUnknown>;
134
- fullProps: z.ZodRecord<z.ZodString, z.ZodUnknown>;
135
- }, z.core.$strip>;
132
+ id: z.ZodString;
133
+ description: z.ZodString;
134
+ props: z.ZodOptional<z.ZodNullable<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>>;
135
+ }, {
136
+ out: {};
137
+ in: {};
138
+ }>;
136
139
  declare const ContextConfigApiInsertSchema: z.ZodObject<{
137
140
  id: z.ZodOptional<z.ZodString>;
138
141
  name: z.ZodOptional<z.ZodString>;
@@ -161,13 +164,11 @@ declare const FullGraphDefinitionSchema: z.ZodObject<{
161
164
  description: z.ZodOptional<z.ZodString>;
162
165
  defaultAgentId: z.ZodOptional<z.ZodString>;
163
166
  agents: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
164
- id: z.ZodString;
165
167
  name: z.ZodString;
166
- description: z.ZodString;
167
- prompt: z.ZodString;
168
+ id: z.ZodString;
168
169
  createdAt: z.ZodOptional<z.ZodString>;
169
170
  updatedAt: z.ZodOptional<z.ZodString>;
170
- conversationHistoryConfig: z.ZodOptional<z.ZodNullable<z.ZodType<ConversationHistoryConfig, ConversationHistoryConfig, z.core.$ZodTypeInternals<ConversationHistoryConfig, ConversationHistoryConfig>>>>;
171
+ description: z.ZodString;
171
172
  models: z.ZodOptional<z.ZodObject<{
172
173
  base: z.ZodOptional<z.ZodObject<{
173
174
  model: z.ZodOptional<z.ZodString>;
@@ -191,6 +192,8 @@ declare const FullGraphDefinitionSchema: z.ZodObject<{
191
192
  }, {
192
193
  stepCountIs?: number | undefined;
193
194
  }>>>>;
195
+ prompt: z.ZodString;
196
+ conversationHistoryConfig: z.ZodOptional<z.ZodNullable<z.ZodType<ConversationHistoryConfig, ConversationHistoryConfig, z.core.$ZodTypeInternals<ConversationHistoryConfig, ConversationHistoryConfig>>>>;
194
197
  type: z.ZodLiteral<"internal">;
195
198
  canUse: z.ZodArray<z.ZodObject<{
196
199
  agentToolRelationId: z.ZodOptional<z.ZodString>;
@@ -1,5 +1,5 @@
1
- import { ModelSettingsSchema, FullGraphAgentInsertSchema } from './chunk-AAOYOQTI.js';
2
- export { AgentStopWhenSchema, GraphStopWhenSchema, ModelSettingsSchema, StopWhenSchema } from './chunk-AAOYOQTI.js';
1
+ import { ModelSettingsSchema, FullGraphAgentInsertSchema, ArtifactComponentApiInsertSchema } from './chunk-BNXFEUNP.js';
2
+ export { AgentStopWhenSchema, GraphStopWhenSchema, ModelSettingsSchema, StopWhenSchema, validatePropsAsJsonSchema } from './chunk-BNXFEUNP.js';
3
3
  import { CredentialStoreType } from './chunk-YFHT5M2R.js';
4
4
  export { CredentialStoreType, MCPTransportType } from './chunk-YFHT5M2R.js';
5
5
  import { z } from 'zod';
@@ -89,13 +89,7 @@ var DataComponentApiInsertSchema = z.object({
89
89
  description: z.string().optional(),
90
90
  props: z.record(z.string(), z.unknown())
91
91
  });
92
- var ArtifactComponentApiInsertSchema = z.object({
93
- id: z.string(),
94
- name: z.string(),
95
- description: z.string().optional(),
96
- summaryProps: z.record(z.string(), z.unknown()),
97
- fullProps: z.record(z.string(), z.unknown())
98
- });
92
+ var ArtifactComponentApiInsertSchema2 = ArtifactComponentApiInsertSchema;
99
93
  var ContextConfigApiInsertSchema = z.object({
100
94
  id: z.string().optional(),
101
95
  name: z.string().optional(),
@@ -178,4 +172,4 @@ function generateIdFromName(name) {
178
172
  return name.toLowerCase().replace(/[^a-zA-Z0-9]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, MAX_ID_LENGTH);
179
173
  }
180
174
 
181
- export { AgentApiInsertSchema, AgentGraphApiInsertSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiSelectSchema, ArtifactComponentApiInsertSchema, ContextConfigApiInsertSchema, CredentialReferenceApiInsertSchema, DataComponentApiInsertSchema, ErrorResponseSchema, ExternalAgentApiInsertSchema, FullGraphDefinitionSchema, IdParamsSchema, ListResponseSchema, MAX_ID_LENGTH, MIN_ID_LENGTH, PaginationSchema, SingleResponseSchema, TenantParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, URL_SAFE_ID_PATTERN, generateIdFromName, resourceIdSchema };
175
+ export { AgentApiInsertSchema, AgentGraphApiInsertSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiSelectSchema, ArtifactComponentApiInsertSchema2 as ArtifactComponentApiInsertSchema, ContextConfigApiInsertSchema, CredentialReferenceApiInsertSchema, DataComponentApiInsertSchema, ErrorResponseSchema, ExternalAgentApiInsertSchema, FullGraphDefinitionSchema, IdParamsSchema, ListResponseSchema, MAX_ID_LENGTH, MIN_ID_LENGTH, PaginationSchema, SingleResponseSchema, TenantParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, URL_SAFE_ID_PATTERN, generateIdFromName, resourceIdSchema };
@@ -283,8 +283,7 @@ var artifactComponents = sqliteCore.sqliteTable(
283
283
  {
284
284
  ...projectScoped,
285
285
  ...uiProperties,
286
- summaryProps: sqliteCore.blob("summary_props", { mode: "json" }).$type(),
287
- fullProps: sqliteCore.blob("full_props", { mode: "json" }).$type(),
286
+ props: sqliteCore.blob("props", { mode: "json" }).$type(),
288
287
  ...timestamps
289
288
  },
290
289
  (table) => [