@inkeep/agents-core 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +112 -32
- package/dist/index.js +111 -30
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var zod = require('zod');
|
|
4
|
+
var pino = require('pino');
|
|
5
|
+
var pinoPretty = require('pino-pretty');
|
|
4
6
|
var zodOpenapi = require('@hono/zod-openapi');
|
|
5
7
|
var drizzleZod = require('drizzle-zod');
|
|
6
8
|
var drizzleOrm = require('drizzle-orm');
|
|
@@ -32,6 +34,8 @@ var findUp = require('find-up');
|
|
|
32
34
|
|
|
33
35
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
34
36
|
|
|
37
|
+
var pino__default = /*#__PURE__*/_interopDefault(pino);
|
|
38
|
+
var pinoPretty__default = /*#__PURE__*/_interopDefault(pinoPretty);
|
|
35
39
|
var jmespath__default = /*#__PURE__*/_interopDefault(jmespath);
|
|
36
40
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
37
41
|
var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
|
|
@@ -47,33 +51,114 @@ var __export = (target, all) => {
|
|
|
47
51
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
48
52
|
};
|
|
49
53
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var ConsoleLogger = class {
|
|
53
|
-
constructor(name) {
|
|
54
|
+
var PinoLogger = class {
|
|
55
|
+
constructor(name, config = {}) {
|
|
54
56
|
this.name = name;
|
|
57
|
+
__publicField(this, "transportConfigs", []);
|
|
58
|
+
__publicField(this, "pinoInstance");
|
|
59
|
+
__publicField(this, "options");
|
|
60
|
+
this.options = {
|
|
61
|
+
name: this.name,
|
|
62
|
+
level: process.env.LOG_LEVEL || "info",
|
|
63
|
+
serializers: {
|
|
64
|
+
obj: (value) => ({ ...value })
|
|
65
|
+
},
|
|
66
|
+
redact: ["req.headers.authorization", 'req.headers["x-inkeep-admin-authentication"]'],
|
|
67
|
+
...config.options
|
|
68
|
+
};
|
|
69
|
+
if (config.transportConfigs) {
|
|
70
|
+
this.transportConfigs = config.transportConfigs;
|
|
71
|
+
}
|
|
72
|
+
if (this.transportConfigs.length > 0) {
|
|
73
|
+
this.pinoInstance = pino__default.default(this.options, pino__default.default.transport({ targets: this.transportConfigs }));
|
|
74
|
+
} else {
|
|
75
|
+
try {
|
|
76
|
+
const prettyStream = pinoPretty__default.default({
|
|
77
|
+
colorize: true,
|
|
78
|
+
translateTime: "HH:MM:ss",
|
|
79
|
+
ignore: "pid,hostname"
|
|
80
|
+
});
|
|
81
|
+
this.pinoInstance = pino__default.default(this.options, prettyStream);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.warn("Warning: pino-pretty failed, using standard JSON output:", error);
|
|
84
|
+
this.pinoInstance = pino__default.default(this.options);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
55
87
|
}
|
|
56
|
-
|
|
57
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Recreate the pino instance with current transports
|
|
90
|
+
*/
|
|
91
|
+
recreateInstance() {
|
|
92
|
+
if (this.pinoInstance && typeof this.pinoInstance.flush === "function") {
|
|
93
|
+
this.pinoInstance.flush();
|
|
94
|
+
}
|
|
95
|
+
if (this.transportConfigs.length === 0) {
|
|
96
|
+
try {
|
|
97
|
+
const prettyStream = pinoPretty__default.default({
|
|
98
|
+
colorize: true,
|
|
99
|
+
translateTime: "HH:MM:ss",
|
|
100
|
+
ignore: "pid,hostname"
|
|
101
|
+
});
|
|
102
|
+
this.pinoInstance = pino__default.default(this.options, prettyStream);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.warn("Warning: pino-pretty failed, using standard JSON output:", error);
|
|
105
|
+
this.pinoInstance = pino__default.default(this.options);
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
const multiTransport = { targets: this.transportConfigs };
|
|
109
|
+
const pinoTransport = pino__default.default.transport(multiTransport);
|
|
110
|
+
this.pinoInstance = pino__default.default(this.options, pinoTransport);
|
|
111
|
+
}
|
|
58
112
|
}
|
|
59
|
-
|
|
60
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Add a new transport to the logger
|
|
115
|
+
*/
|
|
116
|
+
addTransport(transportConfig) {
|
|
117
|
+
this.transportConfigs.push(transportConfig);
|
|
118
|
+
this.recreateInstance();
|
|
61
119
|
}
|
|
62
|
-
|
|
63
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Remove a transport by index
|
|
122
|
+
*/
|
|
123
|
+
removeTransport(index2) {
|
|
124
|
+
if (index2 >= 0 && index2 < this.transportConfigs.length) {
|
|
125
|
+
this.transportConfigs.splice(index2, 1);
|
|
126
|
+
this.recreateInstance();
|
|
127
|
+
}
|
|
64
128
|
}
|
|
65
|
-
|
|
66
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Get current transports
|
|
131
|
+
*/
|
|
132
|
+
getTransports() {
|
|
133
|
+
return [...this.transportConfigs];
|
|
67
134
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Update logger options
|
|
137
|
+
*/
|
|
138
|
+
updateOptions(options) {
|
|
139
|
+
this.options = {
|
|
140
|
+
...this.options,
|
|
141
|
+
...options
|
|
142
|
+
};
|
|
143
|
+
this.recreateInstance();
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Get the underlying pino instance for advanced usage
|
|
147
|
+
*/
|
|
148
|
+
getPinoInstance() {
|
|
149
|
+
return this.pinoInstance;
|
|
150
|
+
}
|
|
151
|
+
error(data, message) {
|
|
152
|
+
this.pinoInstance.error(data, message);
|
|
71
153
|
}
|
|
72
|
-
warn(
|
|
154
|
+
warn(data, message) {
|
|
155
|
+
this.pinoInstance.warn(data, message);
|
|
73
156
|
}
|
|
74
|
-
info(
|
|
157
|
+
info(data, message) {
|
|
158
|
+
this.pinoInstance.info(data, message);
|
|
75
159
|
}
|
|
76
|
-
debug(
|
|
160
|
+
debug(data, message) {
|
|
161
|
+
this.pinoInstance.debug(data, message);
|
|
77
162
|
}
|
|
78
163
|
};
|
|
79
164
|
var LoggerFactory = class {
|
|
@@ -105,7 +190,7 @@ var LoggerFactory = class {
|
|
|
105
190
|
} else if (this.config.defaultLogger) {
|
|
106
191
|
logger11 = this.config.defaultLogger;
|
|
107
192
|
} else {
|
|
108
|
-
logger11 = new
|
|
193
|
+
logger11 = new PinoLogger(name, this.config.pinoConfig);
|
|
109
194
|
}
|
|
110
195
|
this.loggers.set(name, logger11);
|
|
111
196
|
return logger11;
|
|
@@ -122,9 +207,6 @@ var loggerFactory = new LoggerFactory();
|
|
|
122
207
|
function getLogger(name) {
|
|
123
208
|
return loggerFactory.getLogger(name);
|
|
124
209
|
}
|
|
125
|
-
function configureLogging(config) {
|
|
126
|
-
loggerFactory.configure(config);
|
|
127
|
-
}
|
|
128
210
|
|
|
129
211
|
// src/db/schema.ts
|
|
130
212
|
var schema_exports = {};
|
|
@@ -5822,17 +5904,17 @@ var updateFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
|
|
|
5822
5904
|
const modelTypes = ["base", "structuredOutput", "summarizer"];
|
|
5823
5905
|
const cascadedModels = { ...finalModelSettings };
|
|
5824
5906
|
for (const modelType of modelTypes) {
|
|
5825
|
-
if (agentModels[modelType]?.model && existingGraphModels?.[modelType]?.model && agentModels[modelType].model === existingGraphModels[modelType].model && graphModels[modelType]
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
};
|
|
5907
|
+
if (agentModels[modelType]?.model && existingGraphModels?.[modelType]?.model && agentModels[modelType].model === existingGraphModels[modelType].model && graphModels[modelType] && // Model name changed
|
|
5908
|
+
(graphModels[modelType].model !== existingGraphModels[modelType].model || // OR providerOptions changed
|
|
5909
|
+
JSON.stringify(graphModels[modelType].providerOptions) !== JSON.stringify(existingGraphModels[modelType].providerOptions))) {
|
|
5910
|
+
cascadedModels[modelType] = graphModels[modelType];
|
|
5830
5911
|
logger11.info(
|
|
5831
5912
|
{
|
|
5832
5913
|
agentId,
|
|
5833
5914
|
modelType,
|
|
5834
5915
|
oldModel: agentModels[modelType].model,
|
|
5835
|
-
newModel: graphModels[modelType].model
|
|
5916
|
+
newModel: graphModels[modelType].model,
|
|
5917
|
+
hasProviderOptions: !!graphModels[modelType].providerOptions
|
|
5836
5918
|
},
|
|
5837
5919
|
"Cascading model change from graph to agent"
|
|
5838
5920
|
);
|
|
@@ -10115,7 +10197,7 @@ function createDefaultCredentialStores() {
|
|
|
10115
10197
|
if (process.env.NANGO_SECRET_KEY) {
|
|
10116
10198
|
stores.push(
|
|
10117
10199
|
createNangoCredentialStore("nango-default", {
|
|
10118
|
-
apiUrl: process.env.
|
|
10200
|
+
apiUrl: process.env.NANGO_SERVER_URL || "https://api.nango.dev",
|
|
10119
10201
|
secretKey: process.env.NANGO_SECRET_KEY
|
|
10120
10202
|
})
|
|
10121
10203
|
);
|
|
@@ -10241,7 +10323,6 @@ exports.ArtifactComponentApiUpdateSchema = ArtifactComponentApiUpdateSchema;
|
|
|
10241
10323
|
exports.ArtifactComponentInsertSchema = ArtifactComponentInsertSchema;
|
|
10242
10324
|
exports.ArtifactComponentSelectSchema = ArtifactComponentSelectSchema;
|
|
10243
10325
|
exports.ArtifactComponentUpdateSchema = ArtifactComponentUpdateSchema;
|
|
10244
|
-
exports.ConsoleLogger = ConsoleLogger;
|
|
10245
10326
|
exports.ContextCache = ContextCache;
|
|
10246
10327
|
exports.ContextCacheApiInsertSchema = ContextCacheApiInsertSchema;
|
|
10247
10328
|
exports.ContextCacheApiSelectSchema = ContextCacheApiSelectSchema;
|
|
@@ -10329,9 +10410,9 @@ exports.MessageUpdateSchema = MessageUpdateSchema;
|
|
|
10329
10410
|
exports.ModelSchema = ModelSchema;
|
|
10330
10411
|
exports.ModelSettingsSchema = ModelSettingsSchema;
|
|
10331
10412
|
exports.NangoCredentialStore = NangoCredentialStore;
|
|
10332
|
-
exports.NoOpLogger = NoOpLogger;
|
|
10333
10413
|
exports.PaginationQueryParamsSchema = PaginationQueryParamsSchema;
|
|
10334
10414
|
exports.PaginationSchema = PaginationSchema;
|
|
10415
|
+
exports.PinoLogger = PinoLogger;
|
|
10335
10416
|
exports.ProjectApiInsertSchema = ProjectApiInsertSchema;
|
|
10336
10417
|
exports.ProjectApiSelectSchema = ProjectApiSelectSchema;
|
|
10337
10418
|
exports.ProjectApiUpdateSchema = ProjectApiUpdateSchema;
|
|
@@ -10401,7 +10482,6 @@ exports.commonCreateErrorResponses = commonCreateErrorResponses;
|
|
|
10401
10482
|
exports.commonDeleteErrorResponses = commonDeleteErrorResponses;
|
|
10402
10483
|
exports.commonGetErrorResponses = commonGetErrorResponses;
|
|
10403
10484
|
exports.commonUpdateErrorResponses = commonUpdateErrorResponses;
|
|
10404
|
-
exports.configureLogging = configureLogging;
|
|
10405
10485
|
exports.contextCache = contextCache;
|
|
10406
10486
|
exports.contextCacheRelations = contextCacheRelations;
|
|
10407
10487
|
exports.contextConfig = contextConfig;
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
export { TaskState } from './chunk-H2F72PDA.js';
|
|
2
1
|
import { validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-XQRFKXVV.js';
|
|
3
2
|
export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-XQRFKXVV.js';
|
|
4
3
|
import { ContextConfigApiUpdateSchema } from './chunk-LPIKPCE5.js';
|
|
5
4
|
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, 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 } from './chunk-LPIKPCE5.js';
|
|
5
|
+
export { TaskState } from './chunk-H2F72PDA.js';
|
|
6
6
|
import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-SVGQSPW4.js';
|
|
7
7
|
export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-SVGQSPW4.js';
|
|
8
8
|
import { schema_exports, agentRelations, agents, externalAgents, agentToolRelations, tools, contextConfigs, agentGraph, agentDataComponents, agentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, credentialReferences, ledgerArtifacts, tasks, taskRelations } from './chunk-LFWFXR4O.js';
|
|
9
9
|
export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentDataComponentsRelations, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsRelations, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-LFWFXR4O.js';
|
|
10
10
|
import { __publicField } from './chunk-MKBO26DX.js';
|
|
11
11
|
import { z as z$1 } from 'zod';
|
|
12
|
+
import pino from 'pino';
|
|
13
|
+
import pinoPretty from 'pino-pretty';
|
|
12
14
|
import jmespath from 'jmespath';
|
|
13
15
|
import { createClient } from '@libsql/client';
|
|
14
16
|
import { drizzle } from 'drizzle-orm/libsql';
|
|
@@ -36,32 +38,114 @@ import dotenv from 'dotenv';
|
|
|
36
38
|
import { expand } from 'dotenv-expand';
|
|
37
39
|
import { findUpSync } from 'find-up';
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
constructor(name) {
|
|
41
|
+
var PinoLogger = class {
|
|
42
|
+
constructor(name, config = {}) {
|
|
42
43
|
this.name = name;
|
|
44
|
+
__publicField(this, "transportConfigs", []);
|
|
45
|
+
__publicField(this, "pinoInstance");
|
|
46
|
+
__publicField(this, "options");
|
|
47
|
+
this.options = {
|
|
48
|
+
name: this.name,
|
|
49
|
+
level: process.env.LOG_LEVEL || "info",
|
|
50
|
+
serializers: {
|
|
51
|
+
obj: (value) => ({ ...value })
|
|
52
|
+
},
|
|
53
|
+
redact: ["req.headers.authorization", 'req.headers["x-inkeep-admin-authentication"]'],
|
|
54
|
+
...config.options
|
|
55
|
+
};
|
|
56
|
+
if (config.transportConfigs) {
|
|
57
|
+
this.transportConfigs = config.transportConfigs;
|
|
58
|
+
}
|
|
59
|
+
if (this.transportConfigs.length > 0) {
|
|
60
|
+
this.pinoInstance = pino(this.options, pino.transport({ targets: this.transportConfigs }));
|
|
61
|
+
} else {
|
|
62
|
+
try {
|
|
63
|
+
const prettyStream = pinoPretty({
|
|
64
|
+
colorize: true,
|
|
65
|
+
translateTime: "HH:MM:ss",
|
|
66
|
+
ignore: "pid,hostname"
|
|
67
|
+
});
|
|
68
|
+
this.pinoInstance = pino(this.options, prettyStream);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.warn("Warning: pino-pretty failed, using standard JSON output:", error);
|
|
71
|
+
this.pinoInstance = pino(this.options);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
43
74
|
}
|
|
44
|
-
|
|
45
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Recreate the pino instance with current transports
|
|
77
|
+
*/
|
|
78
|
+
recreateInstance() {
|
|
79
|
+
if (this.pinoInstance && typeof this.pinoInstance.flush === "function") {
|
|
80
|
+
this.pinoInstance.flush();
|
|
81
|
+
}
|
|
82
|
+
if (this.transportConfigs.length === 0) {
|
|
83
|
+
try {
|
|
84
|
+
const prettyStream = pinoPretty({
|
|
85
|
+
colorize: true,
|
|
86
|
+
translateTime: "HH:MM:ss",
|
|
87
|
+
ignore: "pid,hostname"
|
|
88
|
+
});
|
|
89
|
+
this.pinoInstance = pino(this.options, prettyStream);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.warn("Warning: pino-pretty failed, using standard JSON output:", error);
|
|
92
|
+
this.pinoInstance = pino(this.options);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
const multiTransport = { targets: this.transportConfigs };
|
|
96
|
+
const pinoTransport = pino.transport(multiTransport);
|
|
97
|
+
this.pinoInstance = pino(this.options, pinoTransport);
|
|
98
|
+
}
|
|
46
99
|
}
|
|
47
|
-
|
|
48
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Add a new transport to the logger
|
|
102
|
+
*/
|
|
103
|
+
addTransport(transportConfig) {
|
|
104
|
+
this.transportConfigs.push(transportConfig);
|
|
105
|
+
this.recreateInstance();
|
|
49
106
|
}
|
|
50
|
-
|
|
51
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Remove a transport by index
|
|
109
|
+
*/
|
|
110
|
+
removeTransport(index) {
|
|
111
|
+
if (index >= 0 && index < this.transportConfigs.length) {
|
|
112
|
+
this.transportConfigs.splice(index, 1);
|
|
113
|
+
this.recreateInstance();
|
|
114
|
+
}
|
|
52
115
|
}
|
|
53
|
-
|
|
54
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Get current transports
|
|
118
|
+
*/
|
|
119
|
+
getTransports() {
|
|
120
|
+
return [...this.transportConfigs];
|
|
55
121
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Update logger options
|
|
124
|
+
*/
|
|
125
|
+
updateOptions(options) {
|
|
126
|
+
this.options = {
|
|
127
|
+
...this.options,
|
|
128
|
+
...options
|
|
129
|
+
};
|
|
130
|
+
this.recreateInstance();
|
|
59
131
|
}
|
|
60
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Get the underlying pino instance for advanced usage
|
|
134
|
+
*/
|
|
135
|
+
getPinoInstance() {
|
|
136
|
+
return this.pinoInstance;
|
|
61
137
|
}
|
|
62
|
-
|
|
138
|
+
error(data, message) {
|
|
139
|
+
this.pinoInstance.error(data, message);
|
|
63
140
|
}
|
|
64
|
-
|
|
141
|
+
warn(data, message) {
|
|
142
|
+
this.pinoInstance.warn(data, message);
|
|
143
|
+
}
|
|
144
|
+
info(data, message) {
|
|
145
|
+
this.pinoInstance.info(data, message);
|
|
146
|
+
}
|
|
147
|
+
debug(data, message) {
|
|
148
|
+
this.pinoInstance.debug(data, message);
|
|
65
149
|
}
|
|
66
150
|
};
|
|
67
151
|
var LoggerFactory = class {
|
|
@@ -93,7 +177,7 @@ var LoggerFactory = class {
|
|
|
93
177
|
} else if (this.config.defaultLogger) {
|
|
94
178
|
logger11 = this.config.defaultLogger;
|
|
95
179
|
} else {
|
|
96
|
-
logger11 = new
|
|
180
|
+
logger11 = new PinoLogger(name, this.config.pinoConfig);
|
|
97
181
|
}
|
|
98
182
|
this.loggers.set(name, logger11);
|
|
99
183
|
return logger11;
|
|
@@ -110,9 +194,6 @@ var loggerFactory = new LoggerFactory();
|
|
|
110
194
|
function getLogger(name) {
|
|
111
195
|
return loggerFactory.getLogger(name);
|
|
112
196
|
}
|
|
113
|
-
function configureLogging(config) {
|
|
114
|
-
loggerFactory.configure(config);
|
|
115
|
-
}
|
|
116
197
|
|
|
117
198
|
// src/context/ContextConfig.ts
|
|
118
199
|
var logger = getLogger("context-config");
|
|
@@ -4082,17 +4163,17 @@ var updateFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
|
|
|
4082
4163
|
const modelTypes = ["base", "structuredOutput", "summarizer"];
|
|
4083
4164
|
const cascadedModels = { ...finalModelSettings };
|
|
4084
4165
|
for (const modelType of modelTypes) {
|
|
4085
|
-
if (agentModels[modelType]?.model && existingGraphModels?.[modelType]?.model && agentModels[modelType].model === existingGraphModels[modelType].model && graphModels[modelType]
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
};
|
|
4166
|
+
if (agentModels[modelType]?.model && existingGraphModels?.[modelType]?.model && agentModels[modelType].model === existingGraphModels[modelType].model && graphModels[modelType] && // Model name changed
|
|
4167
|
+
(graphModels[modelType].model !== existingGraphModels[modelType].model || // OR providerOptions changed
|
|
4168
|
+
JSON.stringify(graphModels[modelType].providerOptions) !== JSON.stringify(existingGraphModels[modelType].providerOptions))) {
|
|
4169
|
+
cascadedModels[modelType] = graphModels[modelType];
|
|
4090
4170
|
logger11.info(
|
|
4091
4171
|
{
|
|
4092
4172
|
agentId,
|
|
4093
4173
|
modelType,
|
|
4094
4174
|
oldModel: agentModels[modelType].model,
|
|
4095
|
-
newModel: graphModels[modelType].model
|
|
4175
|
+
newModel: graphModels[modelType].model,
|
|
4176
|
+
hasProviderOptions: !!graphModels[modelType].providerOptions
|
|
4096
4177
|
},
|
|
4097
4178
|
"Cascading model change from graph to agent"
|
|
4098
4179
|
);
|
|
@@ -8375,7 +8456,7 @@ function createDefaultCredentialStores() {
|
|
|
8375
8456
|
if (process.env.NANGO_SECRET_KEY) {
|
|
8376
8457
|
stores.push(
|
|
8377
8458
|
createNangoCredentialStore("nango-default", {
|
|
8378
|
-
apiUrl: process.env.
|
|
8459
|
+
apiUrl: process.env.NANGO_SERVER_URL || "https://api.nango.dev",
|
|
8379
8460
|
secretKey: process.env.NANGO_SECRET_KEY
|
|
8380
8461
|
})
|
|
8381
8462
|
);
|
|
@@ -8431,4 +8512,4 @@ ${error.message}`
|
|
|
8431
8512
|
};
|
|
8432
8513
|
parseEnv();
|
|
8433
8514
|
|
|
8434
|
-
export {
|
|
8515
|
+
export { ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStoreRegistry, CredentialStuffer, ERROR_DOCS_BASE_URL, ErrorCode, HTTP_REQUEST_PARTS, InMemoryCredentialStore, KeyChainStore, McpClient, NangoCredentialStore, PinoLogger, TemplateEngine, addLedgerArtifacts, addToolToAgent, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentGraph, createAgentRelation, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createFullProjectServerSide, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelation, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteFullProject, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, getActiveAgentForConversation, getAgentById, getAgentGraphById, getAgentGraphWithDefaultAgent, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsByIds, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getContextConfigsByName, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getFullProject, getGraphAgentInfos, getHealthyToolsForAgent, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getTask, getToolById, getToolsByStatus, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, invalidateInvocationDefinitionsCache, invalidateRequestContextCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listMessages, listProjects, listProjectsPaginated, listTaskIdsByContextId, listTools, listToolsByStatus, loadEnvironmentFiles, loggerFactory, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateFullProjectServerSide, updateMessage, updateProject, updateTask, updateTool, updateToolStatus, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertAgentToolRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHttpRequestHeaders, validateInternalAgent, validateProjectExists, validateRequestContext, validationHelper, withProjectValidation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Agents Core contains the database schema, types, and validation schemas for Inkeep Agent Framework, along with core components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
"jmespath": "^0.16.0",
|
|
47
47
|
"keytar": "^7.9.0",
|
|
48
48
|
"nanoid": "^5.0.9",
|
|
49
|
+
"pino": "^9.11.0",
|
|
50
|
+
"pino-pretty": "^13.1.1",
|
|
49
51
|
"ts-pattern": "^5.7.1",
|
|
50
52
|
"zod": "^4.1.5"
|
|
51
53
|
},
|