@inkeep/agents-core 0.35.1 → 0.35.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.
Files changed (43) hide show
  1. package/dist/auth/auth-schema.d.ts +1097 -0
  2. package/dist/auth/auth-schema.js +1 -0
  3. package/dist/auth/auth-validation-schemas.d.ts +1881 -0
  4. package/dist/auth/auth-validation-schemas.js +39 -0
  5. package/dist/auth/auth.d.ts +118 -0
  6. package/dist/auth/auth.js +95 -0
  7. package/dist/auth/permissions.d.ts +273 -0
  8. package/dist/auth/permissions.js +1 -0
  9. package/dist/chunk-4JZT4QEE.js +162 -0
  10. package/dist/chunk-F5WWOOIX.js +62 -0
  11. package/dist/{chunk-YZ5ZBVHJ.js → chunk-NFYCSHD3.js} +3 -81
  12. package/dist/chunk-NOPEANIU.js +82 -0
  13. package/dist/{chunk-J5AHY6M2.js → chunk-SPRTYWRV.js} +1 -1
  14. package/dist/{chunk-OP3KPT4T.js → chunk-TGESM3JG.js} +1 -160
  15. package/dist/{chunk-DYGTCLJO.js → chunk-VBCCPAZK.js} +1 -1
  16. package/dist/chunk-ZYSTJ4XY.js +948 -0
  17. package/dist/client-CPYOMZF2.d.ts +19 -0
  18. package/dist/client-exports.js +4 -3
  19. package/dist/db/schema.d.ts +2 -1
  20. package/dist/db/schema.js +2 -1
  21. package/dist/index.d.ts +9 -154
  22. package/dist/index.js +1565 -2498
  23. package/dist/{schema-BWd551GM.d.ts → schema-5N2lPWNV.d.ts} +2 -1095
  24. package/dist/validation/index.js +2 -2
  25. package/package.json +17 -1
  26. package/dist/auth-detection-CGqhPDnj.d.cts +0 -435
  27. package/dist/client-exports.cjs +0 -2833
  28. package/dist/client-exports.d.cts +0 -289
  29. package/dist/constants/models.cjs +0 -40
  30. package/dist/constants/models.d.cts +0 -42
  31. package/dist/db/schema.cjs +0 -1090
  32. package/dist/db/schema.d.cts +0 -7
  33. package/dist/index.cjs +0 -227898
  34. package/dist/index.d.cts +0 -4893
  35. package/dist/props-validation-BMR1qNiy.d.cts +0 -15
  36. package/dist/schema-D4WR42em.d.cts +0 -6352
  37. package/dist/types/index.cjs +0 -39
  38. package/dist/types/index.d.cts +0 -132
  39. package/dist/utility-DbltUp2Q.d.cts +0 -17079
  40. package/dist/utils/schema-conversion.cjs +0 -232
  41. package/dist/utils/schema-conversion.d.cts +0 -26
  42. package/dist/validation/index.cjs +0 -2930
  43. package/dist/validation/index.d.cts +0 -279
@@ -1,232 +0,0 @@
1
- 'use strict';
2
-
3
- var zod = require('zod');
4
- var pino = require('pino');
5
- var pinoPretty = require('pino-pretty');
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
-
9
- var pino__default = /*#__PURE__*/_interopDefault(pino);
10
- var pinoPretty__default = /*#__PURE__*/_interopDefault(pinoPretty);
11
-
12
- // src/utils/schema-conversion.ts
13
- var PinoLogger = class {
14
- constructor(name, config = {}) {
15
- this.name = name;
16
- this.options = {
17
- name: this.name,
18
- level: process.env.LOG_LEVEL || (process.env.ENVIRONMENT === "test" ? "silent" : "info"),
19
- serializers: {
20
- obj: (value) => ({ ...value })
21
- },
22
- redact: ["req.headers.authorization", 'req.headers["x-inkeep-admin-authentication"]'],
23
- ...config.options
24
- };
25
- if (config.transportConfigs) {
26
- this.transportConfigs = config.transportConfigs;
27
- }
28
- if (this.transportConfigs.length > 0) {
29
- this.pinoInstance = pino__default.default(this.options, pino__default.default.transport({ targets: this.transportConfigs }));
30
- } else {
31
- try {
32
- const prettyStream = pinoPretty__default.default({
33
- colorize: true,
34
- translateTime: "HH:MM:ss",
35
- ignore: "pid,hostname"
36
- });
37
- this.pinoInstance = pino__default.default(this.options, prettyStream);
38
- } catch (error) {
39
- console.warn("Warning: pino-pretty failed, using standard JSON output:", error);
40
- this.pinoInstance = pino__default.default(this.options);
41
- }
42
- }
43
- }
44
- transportConfigs = [];
45
- pinoInstance;
46
- options;
47
- /**
48
- * Recreate the pino instance with current transports
49
- */
50
- recreateInstance() {
51
- if (this.pinoInstance && typeof this.pinoInstance.flush === "function") {
52
- this.pinoInstance.flush();
53
- }
54
- if (this.transportConfigs.length === 0) {
55
- try {
56
- const prettyStream = pinoPretty__default.default({
57
- colorize: true,
58
- translateTime: "HH:MM:ss",
59
- ignore: "pid,hostname"
60
- });
61
- this.pinoInstance = pino__default.default(this.options, prettyStream);
62
- } catch (error) {
63
- console.warn("Warning: pino-pretty failed, using standard JSON output:", error);
64
- this.pinoInstance = pino__default.default(this.options);
65
- }
66
- } else {
67
- const multiTransport = { targets: this.transportConfigs };
68
- const pinoTransport = pino__default.default.transport(multiTransport);
69
- this.pinoInstance = pino__default.default(this.options, pinoTransport);
70
- }
71
- }
72
- /**
73
- * Add a new transport to the logger
74
- */
75
- addTransport(transportConfig) {
76
- this.transportConfigs.push(transportConfig);
77
- this.recreateInstance();
78
- }
79
- /**
80
- * Remove a transport by index
81
- */
82
- removeTransport(index) {
83
- if (index >= 0 && index < this.transportConfigs.length) {
84
- this.transportConfigs.splice(index, 1);
85
- this.recreateInstance();
86
- }
87
- }
88
- /**
89
- * Get current transports
90
- */
91
- getTransports() {
92
- return [...this.transportConfigs];
93
- }
94
- /**
95
- * Update logger options
96
- */
97
- updateOptions(options) {
98
- this.options = {
99
- ...this.options,
100
- ...options
101
- };
102
- this.recreateInstance();
103
- }
104
- /**
105
- * Get the underlying pino instance for advanced usage
106
- */
107
- getPinoInstance() {
108
- return this.pinoInstance;
109
- }
110
- error(data, message) {
111
- this.pinoInstance.error(data, message);
112
- }
113
- warn(data, message) {
114
- this.pinoInstance.warn(data, message);
115
- }
116
- info(data, message) {
117
- this.pinoInstance.info(data, message);
118
- }
119
- debug(data, message) {
120
- this.pinoInstance.debug(data, message);
121
- }
122
- };
123
- var LoggerFactory = class {
124
- config = {};
125
- loggers = /* @__PURE__ */ new Map();
126
- /**
127
- * Configure the logger factory
128
- */
129
- configure(config) {
130
- this.config = config;
131
- this.loggers.clear();
132
- }
133
- /**
134
- * Get or create a logger instance
135
- */
136
- getLogger(name) {
137
- if (this.loggers.has(name)) {
138
- const logger3 = this.loggers.get(name);
139
- if (!logger3) {
140
- throw new Error(`Logger '${name}' not found in cache`);
141
- }
142
- return logger3;
143
- }
144
- let logger2;
145
- if (this.config.loggerFactory) {
146
- logger2 = this.config.loggerFactory(name);
147
- } else if (this.config.defaultLogger) {
148
- logger2 = this.config.defaultLogger;
149
- } else {
150
- logger2 = new PinoLogger(name, this.config.pinoConfig);
151
- }
152
- this.loggers.set(name, logger2);
153
- return logger2;
154
- }
155
- /**
156
- * Reset factory to default state
157
- */
158
- reset() {
159
- this.config = {};
160
- this.loggers.clear();
161
- }
162
- };
163
- var loggerFactory = new LoggerFactory();
164
- function getLogger(name) {
165
- return loggerFactory.getLogger(name);
166
- }
167
-
168
- // src/utils/schema-conversion.ts
169
- var logger = getLogger("schema-conversion");
170
- function convertZodToJsonSchema(zodSchema) {
171
- try {
172
- const jsonSchema = zod.z.toJSONSchema(zodSchema);
173
- if (jsonSchema.$schema) {
174
- delete jsonSchema.$schema;
175
- }
176
- return jsonSchema;
177
- } catch (error) {
178
- logger.error(
179
- {
180
- error: error instanceof Error ? error.message : "Unknown error",
181
- stack: error instanceof Error ? error.stack : void 0
182
- },
183
- "Failed to convert Zod schema to JSON Schema"
184
- );
185
- throw new Error("Failed to convert Zod schema to JSON Schema");
186
- }
187
- }
188
- var preview = (schema) => {
189
- schema._def.inPreview = true;
190
- return schema;
191
- };
192
- function convertZodToJsonSchemaWithPreview(zodSchema) {
193
- const jsonSchema = convertZodToJsonSchema(zodSchema);
194
- if (zodSchema instanceof zod.z.ZodObject && jsonSchema.properties) {
195
- const shape = zodSchema.shape;
196
- for (const [key, fieldSchema] of Object.entries(shape)) {
197
- if (fieldSchema?._def?.inPreview === true) {
198
- jsonSchema.properties[key].inPreview = true;
199
- }
200
- }
201
- }
202
- return jsonSchema;
203
- }
204
- function isZodSchema(value) {
205
- return value?._def?.type === "object";
206
- }
207
- function extractPreviewFields(schema) {
208
- const previewFields = [];
209
- if (schema instanceof zod.z.ZodObject) {
210
- const shape = schema.shape;
211
- for (const [key, fieldSchema] of Object.entries(shape)) {
212
- if (fieldSchema?._def?.inPreview === true) {
213
- previewFields.push(key);
214
- }
215
- }
216
- return previewFields;
217
- }
218
- if (schema?.type === "object" && schema.properties) {
219
- for (const [key, prop] of Object.entries(schema.properties)) {
220
- if (prop.inPreview === true) {
221
- previewFields.push(key);
222
- }
223
- }
224
- }
225
- return previewFields;
226
- }
227
-
228
- exports.convertZodToJsonSchema = convertZodToJsonSchema;
229
- exports.convertZodToJsonSchemaWithPreview = convertZodToJsonSchemaWithPreview;
230
- exports.extractPreviewFields = extractPreviewFields;
231
- exports.isZodSchema = isZodSchema;
232
- exports.preview = preview;
@@ -1,26 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- /**
4
- * Utility function for converting Zod schemas to JSON Schema
5
- * Uses Zod's built-in toJSONSchema method
6
- */
7
- declare function convertZodToJsonSchema(zodSchema: any): Record<string, unknown>;
8
- /**
9
- * Simple helper to mark a Zod schema field as a preview field
10
- * Adds metadata to the schema definition without modifying Zod's core
11
- */
12
- declare const preview: <T extends z.ZodTypeAny>(schema: T) => T;
13
- /**
14
- * Convert Zod schema to JSON Schema while preserving preview metadata
15
- */
16
- declare function convertZodToJsonSchemaWithPreview(zodSchema: z.ZodTypeAny): Record<string, unknown>;
17
- /**
18
- * Type guard to check if a value is a Zod schema
19
- */
20
- declare function isZodSchema(value: any): value is z.ZodObject<any>;
21
- /**
22
- * Extract preview fields from either JSON Schema or Zod schema
23
- */
24
- declare function extractPreviewFields(schema: any): string[];
25
-
26
- export { convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, isZodSchema, preview };