@inkeep/agents-api 0.0.0-dev-20260211235751 → 0.0.0-dev-20260212003026
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/.well-known/workflow/v1/manifest.debug.json +11 -11
- package/dist/.well-known/workflow/v1/step.cjs +220 -418
- package/dist/createApp.d.ts +2 -2
- package/dist/createApp.js +1 -12
- package/dist/data/db/manageDbClient.d.ts +2 -2
- package/dist/data/db/runDbClient.d.ts +2 -2
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/evals/services/EvaluationService.d.ts +5 -0
- package/dist/domains/evals/services/EvaluationService.js +51 -2
- package/dist/domains/evals/workflow/routes.d.ts +2 -2
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/invitations.d.ts +2 -2
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/passwordResetLinks.d.ts +2 -2
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/users.d.ts +2 -2
- package/dist/domains/mcp/routes/mcp.d.ts +2 -2
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/factory.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/middleware/cors.d.ts +1 -6
- package/dist/middleware/cors.js +1 -27
- package/dist/middleware/index.d.ts +2 -3
- package/dist/middleware/index.js +2 -3
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.js +1 -16
- package/dist/middleware/projectAccess.d.ts +2 -2
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/runAuth.js +1 -71
- package/dist/openapi.d.ts +0 -5
- package/dist/openapi.js +1 -6
- package/package.json +5 -5
- package/dist/domains/work-apps/index.d.ts +0 -13
- package/dist/domains/work-apps/index.js +0 -23
- package/dist/middleware/workAppsAuth.d.ts +0 -7
- package/dist/middleware/workAppsAuth.js +0 -30
|
@@ -8519,10 +8519,10 @@ var require_core = __commonJS({
|
|
|
8519
8519
|
error() {
|
|
8520
8520
|
}
|
|
8521
8521
|
};
|
|
8522
|
-
function getLogger2(
|
|
8523
|
-
if (
|
|
8524
|
-
if (
|
|
8525
|
-
if (
|
|
8522
|
+
function getLogger2(logger24) {
|
|
8523
|
+
if (logger24 === false) return noLogs;
|
|
8524
|
+
if (logger24 === void 0) return console;
|
|
8525
|
+
if (logger24.log && logger24.warn && logger24.error) return logger24;
|
|
8526
8526
|
throw new Error("logger must implement log, warn and error methods");
|
|
8527
8527
|
}
|
|
8528
8528
|
__name(getLogger2, "getLogger");
|
|
@@ -39660,8 +39660,8 @@ var require_logging = __commonJS({
|
|
|
39660
39660
|
return _logger;
|
|
39661
39661
|
}, "getLogger");
|
|
39662
39662
|
exports2.getLogger = getLogger2;
|
|
39663
|
-
var setLogger = /* @__PURE__ */ __name((
|
|
39664
|
-
_logger =
|
|
39663
|
+
var setLogger = /* @__PURE__ */ __name((logger24) => {
|
|
39664
|
+
_logger = logger24;
|
|
39665
39665
|
}, "setLogger");
|
|
39666
39666
|
exports2.setLogger = setLogger;
|
|
39667
39667
|
var setLoggerVerbosity = /* @__PURE__ */ __name((verbosity) => {
|
|
@@ -64242,8 +64242,8 @@ var require_src3 = __commonJS({
|
|
|
64242
64242
|
throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead");
|
|
64243
64243
|
}, "load");
|
|
64244
64244
|
exports2.load = load;
|
|
64245
|
-
var setLogger = /* @__PURE__ */ __name((
|
|
64246
|
-
logging.setLogger(
|
|
64245
|
+
var setLogger = /* @__PURE__ */ __name((logger24) => {
|
|
64246
|
+
logging.setLogger(logger24);
|
|
64247
64247
|
}, "setLogger");
|
|
64248
64248
|
exports2.setLogger = setLogger;
|
|
64249
64249
|
var setLogVerbosity = /* @__PURE__ */ __name((verbosity) => {
|
|
@@ -94104,12 +94104,12 @@ var require_ComponentLogger = __commonJS({
|
|
|
94104
94104
|
};
|
|
94105
94105
|
exports2.DiagComponentLogger = DiagComponentLogger;
|
|
94106
94106
|
function logProxy(funcName, namespace, args2) {
|
|
94107
|
-
const
|
|
94108
|
-
if (!
|
|
94107
|
+
const logger24 = (0, global_utils_1.getGlobal)("diag");
|
|
94108
|
+
if (!logger24) {
|
|
94109
94109
|
return;
|
|
94110
94110
|
}
|
|
94111
94111
|
args2.unshift(namespace);
|
|
94112
|
-
return
|
|
94112
|
+
return logger24[funcName](...args2);
|
|
94113
94113
|
}
|
|
94114
94114
|
__name(logProxy, "logProxy");
|
|
94115
94115
|
}
|
|
@@ -94145,17 +94145,17 @@ var require_logLevelLogger = __commonJS({
|
|
|
94145
94145
|
});
|
|
94146
94146
|
exports2.createLogLevelDiagLogger = void 0;
|
|
94147
94147
|
var types_1 = require_types3();
|
|
94148
|
-
function createLogLevelDiagLogger(maxLevel,
|
|
94148
|
+
function createLogLevelDiagLogger(maxLevel, logger24) {
|
|
94149
94149
|
if (maxLevel < types_1.DiagLogLevel.NONE) {
|
|
94150
94150
|
maxLevel = types_1.DiagLogLevel.NONE;
|
|
94151
94151
|
} else if (maxLevel > types_1.DiagLogLevel.ALL) {
|
|
94152
94152
|
maxLevel = types_1.DiagLogLevel.ALL;
|
|
94153
94153
|
}
|
|
94154
|
-
|
|
94154
|
+
logger24 = logger24 || {};
|
|
94155
94155
|
function _filterFunc(funcName, theLevel) {
|
|
94156
|
-
const theFunc =
|
|
94156
|
+
const theFunc = logger24[funcName];
|
|
94157
94157
|
if (typeof theFunc === "function" && maxLevel >= theLevel) {
|
|
94158
|
-
return theFunc.bind(
|
|
94158
|
+
return theFunc.bind(logger24);
|
|
94159
94159
|
}
|
|
94160
94160
|
return function() {
|
|
94161
94161
|
};
|
|
@@ -94198,18 +94198,18 @@ var require_diag = __commonJS({
|
|
|
94198
94198
|
constructor() {
|
|
94199
94199
|
function _logProxy(funcName) {
|
|
94200
94200
|
return function(...args2) {
|
|
94201
|
-
const
|
|
94202
|
-
if (!
|
|
94203
|
-
return
|
|
94201
|
+
const logger24 = (0, global_utils_1.getGlobal)("diag");
|
|
94202
|
+
if (!logger24) return;
|
|
94203
|
+
return logger24[funcName](...args2);
|
|
94204
94204
|
};
|
|
94205
94205
|
}
|
|
94206
94206
|
__name(_logProxy, "_logProxy");
|
|
94207
94207
|
const self2 = this;
|
|
94208
|
-
const setLogger = /* @__PURE__ */ __name((
|
|
94208
|
+
const setLogger = /* @__PURE__ */ __name((logger24, optionsOrLogLevel = {
|
|
94209
94209
|
logLevel: types_1.DiagLogLevel.INFO
|
|
94210
94210
|
}) => {
|
|
94211
94211
|
var _a19, _b17, _c;
|
|
94212
|
-
if (
|
|
94212
|
+
if (logger24 === self2) {
|
|
94213
94213
|
const err2 = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
94214
94214
|
self2.error((_a19 = err2.stack) !== null && _a19 !== void 0 ? _a19 : err2.message);
|
|
94215
94215
|
return false;
|
|
@@ -94220,7 +94220,7 @@ var require_diag = __commonJS({
|
|
|
94220
94220
|
};
|
|
94221
94221
|
}
|
|
94222
94222
|
const oldLogger = (0, global_utils_1.getGlobal)("diag");
|
|
94223
|
-
const newLogger = (0, logLevelLogger_1.createLogLevelDiagLogger)((_b17 = optionsOrLogLevel.logLevel) !== null && _b17 !== void 0 ? _b17 : types_1.DiagLogLevel.INFO,
|
|
94223
|
+
const newLogger = (0, logLevelLogger_1.createLogLevelDiagLogger)((_b17 = optionsOrLogLevel.logLevel) !== null && _b17 !== void 0 ? _b17 : types_1.DiagLogLevel.INFO, logger24);
|
|
94224
94224
|
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
94225
94225
|
const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
94226
94226
|
oldLogger.warn(`Current logger will be overwritten from ${stack}`);
|
|
@@ -126350,10 +126350,7 @@ var runtime_schema_exports = /* @__PURE__ */ __exportAll({
|
|
|
126350
126350
|
workAppGitHubProjectRepositoryAccess: /* @__PURE__ */ __name(() => workAppGitHubProjectRepositoryAccess, "workAppGitHubProjectRepositoryAccess"),
|
|
126351
126351
|
workAppGitHubProjectRepositoryAccessRelations: /* @__PURE__ */ __name(() => workAppGitHubProjectRepositoryAccessRelations, "workAppGitHubProjectRepositoryAccessRelations"),
|
|
126352
126352
|
workAppGitHubRepositories: /* @__PURE__ */ __name(() => workAppGitHubRepositories, "workAppGitHubRepositories"),
|
|
126353
|
-
workAppGitHubRepositoriesRelations: /* @__PURE__ */ __name(() => workAppGitHubRepositoriesRelations, "workAppGitHubRepositoriesRelations")
|
|
126354
|
-
workAppSlackChannelAgentConfigs: /* @__PURE__ */ __name(() => workAppSlackChannelAgentConfigs, "workAppSlackChannelAgentConfigs"),
|
|
126355
|
-
workAppSlackUserMappings: /* @__PURE__ */ __name(() => workAppSlackUserMappings, "workAppSlackUserMappings"),
|
|
126356
|
-
workAppSlackWorkspaces: /* @__PURE__ */ __name(() => workAppSlackWorkspaces, "workAppSlackWorkspaces")
|
|
126353
|
+
workAppGitHubRepositoriesRelations: /* @__PURE__ */ __name(() => workAppGitHubRepositoriesRelations, "workAppGitHubRepositoriesRelations")
|
|
126357
126354
|
});
|
|
126358
126355
|
var tenantScoped2 = {
|
|
126359
126356
|
tenantId: varchar("tenant_id", {
|
|
@@ -126538,131 +126535,6 @@ var triggerInvocations = pgTable("trigger_invocations", {
|
|
|
126538
126535
|
index("trigger_invocations_trigger_idx").on(table.triggerId, table.createdAt),
|
|
126539
126536
|
index("trigger_invocations_status_idx").on(table.triggerId, table.status)
|
|
126540
126537
|
]);
|
|
126541
|
-
var workAppSlackWorkspaces = pgTable("work_app_slack_workspaces", {
|
|
126542
|
-
id: varchar("id", {
|
|
126543
|
-
length: 256
|
|
126544
|
-
}).primaryKey(),
|
|
126545
|
-
tenantId: varchar("tenant_id", {
|
|
126546
|
-
length: 256
|
|
126547
|
-
}).notNull().references(() => organization.id, {
|
|
126548
|
-
onDelete: "cascade"
|
|
126549
|
-
}),
|
|
126550
|
-
slackTeamId: varchar("slack_team_id", {
|
|
126551
|
-
length: 256
|
|
126552
|
-
}).notNull(),
|
|
126553
|
-
slackEnterpriseId: varchar("slack_enterprise_id", {
|
|
126554
|
-
length: 256
|
|
126555
|
-
}),
|
|
126556
|
-
slackAppId: varchar("slack_app_id", {
|
|
126557
|
-
length: 256
|
|
126558
|
-
}),
|
|
126559
|
-
slackTeamName: varchar("slack_team_name", {
|
|
126560
|
-
length: 512
|
|
126561
|
-
}),
|
|
126562
|
-
nangoProviderConfigKey: varchar("nango_provider_config_key", {
|
|
126563
|
-
length: 256
|
|
126564
|
-
}).notNull().default("work-apps-slack"),
|
|
126565
|
-
nangoConnectionId: varchar("nango_connection_id", {
|
|
126566
|
-
length: 256
|
|
126567
|
-
}).notNull(),
|
|
126568
|
-
status: varchar("status", {
|
|
126569
|
-
length: 20
|
|
126570
|
-
}).notNull().default("active"),
|
|
126571
|
-
installedByUserId: text("installed_by_user_id").references(() => user.id, {
|
|
126572
|
-
onDelete: "set null"
|
|
126573
|
-
}),
|
|
126574
|
-
...timestamps2
|
|
126575
|
-
}, (table) => [
|
|
126576
|
-
unique("work_app_slack_workspaces_tenant_team_unique").on(table.tenantId, table.slackTeamId),
|
|
126577
|
-
unique("work_app_slack_workspaces_nango_connection_unique").on(table.nangoConnectionId),
|
|
126578
|
-
index("work_app_slack_workspaces_tenant_idx").on(table.tenantId),
|
|
126579
|
-
index("work_app_slack_workspaces_team_idx").on(table.slackTeamId)
|
|
126580
|
-
]);
|
|
126581
|
-
var workAppSlackUserMappings = pgTable("work_app_slack_user_mappings", {
|
|
126582
|
-
id: varchar("id", {
|
|
126583
|
-
length: 256
|
|
126584
|
-
}).primaryKey(),
|
|
126585
|
-
tenantId: varchar("tenant_id", {
|
|
126586
|
-
length: 256
|
|
126587
|
-
}).notNull().references(() => organization.id, {
|
|
126588
|
-
onDelete: "cascade"
|
|
126589
|
-
}),
|
|
126590
|
-
clientId: varchar("client_id", {
|
|
126591
|
-
length: 256
|
|
126592
|
-
}).notNull().default("work-apps-slack"),
|
|
126593
|
-
slackUserId: varchar("slack_user_id", {
|
|
126594
|
-
length: 256
|
|
126595
|
-
}).notNull(),
|
|
126596
|
-
slackTeamId: varchar("slack_team_id", {
|
|
126597
|
-
length: 256
|
|
126598
|
-
}).notNull(),
|
|
126599
|
-
slackEnterpriseId: varchar("slack_enterprise_id", {
|
|
126600
|
-
length: 256
|
|
126601
|
-
}),
|
|
126602
|
-
inkeepUserId: text("inkeep_user_id").notNull().references(() => user.id, {
|
|
126603
|
-
onDelete: "cascade"
|
|
126604
|
-
}),
|
|
126605
|
-
slackUsername: varchar("slack_username", {
|
|
126606
|
-
length: 256
|
|
126607
|
-
}),
|
|
126608
|
-
slackEmail: varchar("slack_email", {
|
|
126609
|
-
length: 256
|
|
126610
|
-
}),
|
|
126611
|
-
linkedAt: timestamp("linked_at", {
|
|
126612
|
-
mode: "string"
|
|
126613
|
-
}).notNull().defaultNow(),
|
|
126614
|
-
lastUsedAt: timestamp("last_used_at", {
|
|
126615
|
-
mode: "string"
|
|
126616
|
-
}),
|
|
126617
|
-
...timestamps2
|
|
126618
|
-
}, (table) => [
|
|
126619
|
-
unique("work_app_slack_user_mappings_unique").on(table.tenantId, table.clientId, table.slackTeamId, table.slackUserId),
|
|
126620
|
-
index("work_app_slack_user_mappings_tenant_idx").on(table.tenantId),
|
|
126621
|
-
index("work_app_slack_user_mappings_user_idx").on(table.inkeepUserId),
|
|
126622
|
-
index("work_app_slack_user_mappings_team_idx").on(table.slackTeamId),
|
|
126623
|
-
index("work_app_slack_user_mappings_slack_user_idx").on(table.slackUserId)
|
|
126624
|
-
]);
|
|
126625
|
-
var workAppSlackChannelAgentConfigs = pgTable("work_app_slack_channel_agent_configs", {
|
|
126626
|
-
id: varchar("id", {
|
|
126627
|
-
length: 256
|
|
126628
|
-
}).primaryKey(),
|
|
126629
|
-
tenantId: varchar("tenant_id", {
|
|
126630
|
-
length: 256
|
|
126631
|
-
}).notNull().references(() => organization.id, {
|
|
126632
|
-
onDelete: "cascade"
|
|
126633
|
-
}),
|
|
126634
|
-
slackTeamId: varchar("slack_team_id", {
|
|
126635
|
-
length: 256
|
|
126636
|
-
}).notNull(),
|
|
126637
|
-
slackChannelId: varchar("slack_channel_id", {
|
|
126638
|
-
length: 256
|
|
126639
|
-
}).notNull(),
|
|
126640
|
-
slackChannelName: varchar("slack_channel_name", {
|
|
126641
|
-
length: 256
|
|
126642
|
-
}),
|
|
126643
|
-
slackChannelType: varchar("slack_channel_type", {
|
|
126644
|
-
length: 50
|
|
126645
|
-
}),
|
|
126646
|
-
projectId: varchar("project_id", {
|
|
126647
|
-
length: 256
|
|
126648
|
-
}).notNull(),
|
|
126649
|
-
agentId: varchar("agent_id", {
|
|
126650
|
-
length: 256
|
|
126651
|
-
}).notNull(),
|
|
126652
|
-
agentName: varchar("agent_name", {
|
|
126653
|
-
length: 256
|
|
126654
|
-
}),
|
|
126655
|
-
configuredByUserId: text("configured_by_user_id").references(() => user.id, {
|
|
126656
|
-
onDelete: "set null"
|
|
126657
|
-
}),
|
|
126658
|
-
enabled: boolean("enabled").notNull().default(true),
|
|
126659
|
-
...timestamps2
|
|
126660
|
-
}, (table) => [
|
|
126661
|
-
unique("work_app_slack_channel_agent_configs_unique").on(table.tenantId, table.slackTeamId, table.slackChannelId),
|
|
126662
|
-
index("work_app_slack_channel_agent_configs_tenant_idx").on(table.tenantId),
|
|
126663
|
-
index("work_app_slack_channel_agent_configs_team_idx").on(table.slackTeamId),
|
|
126664
|
-
index("work_app_slack_channel_agent_configs_channel_idx").on(table.slackChannelId)
|
|
126665
|
-
]);
|
|
126666
126538
|
var messages = pgTable("messages", {
|
|
126667
126539
|
...projectScoped2,
|
|
126668
126540
|
conversationId: varchar("conversation_id", {
|
|
@@ -145072,34 +144944,6 @@ var WorkAppGitHubAccessGetResponseSchema = external_exports.object({
|
|
|
145072
144944
|
mode: WorkAppGitHubAccessModeSchema,
|
|
145073
144945
|
repositories: external_exports.array(WorkAppGitHubRepositorySelectSchema)
|
|
145074
144946
|
});
|
|
145075
|
-
var WorkAppSlackWorkspaceStatusSchema = external_exports.enum([
|
|
145076
|
-
"active",
|
|
145077
|
-
"suspended",
|
|
145078
|
-
"disconnected"
|
|
145079
|
-
]);
|
|
145080
|
-
var WorkAppSlackWorkspaceSelectSchema = createSelectSchema2(workAppSlackWorkspaces);
|
|
145081
|
-
var WorkAppSlackWorkspaceInsertSchema = createInsertSchema2(workAppSlackWorkspaces).omit({
|
|
145082
|
-
createdAt: true,
|
|
145083
|
-
updatedAt: true
|
|
145084
|
-
}).extend({
|
|
145085
|
-
status: WorkAppSlackWorkspaceStatusSchema.optional().default("active")
|
|
145086
|
-
});
|
|
145087
|
-
var WorkAppSlackWorkspaceUpdateSchema = WorkAppSlackWorkspaceInsertSchema.partial();
|
|
145088
|
-
var WorkAppSlackUserMappingSelectSchema = createSelectSchema2(workAppSlackUserMappings);
|
|
145089
|
-
var WorkAppSlackUserMappingInsertSchema = createInsertSchema2(workAppSlackUserMappings).omit({
|
|
145090
|
-
createdAt: true,
|
|
145091
|
-
updatedAt: true,
|
|
145092
|
-
linkedAt: true
|
|
145093
|
-
}).extend({
|
|
145094
|
-
clientId: external_exports.string().optional().default("work-apps-slack")
|
|
145095
|
-
});
|
|
145096
|
-
var WorkAppSlackUserMappingUpdateSchema = WorkAppSlackUserMappingInsertSchema.partial();
|
|
145097
|
-
var WorkAppSlackChannelAgentConfigSelectSchema = createSelectSchema2(workAppSlackChannelAgentConfigs);
|
|
145098
|
-
var WorkAppSlackChannelAgentConfigInsertSchema = createInsertSchema2(workAppSlackChannelAgentConfigs).omit({
|
|
145099
|
-
createdAt: true,
|
|
145100
|
-
updatedAt: true
|
|
145101
|
-
});
|
|
145102
|
-
var WorkAppSlackChannelAgentConfigUpdateSchema = WorkAppSlackChannelAgentConfigInsertSchema.partial();
|
|
145103
144947
|
|
|
145104
144948
|
// ../packages/agents-core/dist/utils/colors.js
|
|
145105
144949
|
var import_iwanthue = __toESM(require_iwanthue(), 1);
|
|
@@ -147443,12 +147287,12 @@ var LoggerFactory = class {
|
|
|
147443
147287
|
if (!logger$12) throw new Error(`Logger '${name18}' not found in cache`);
|
|
147444
147288
|
return logger$12;
|
|
147445
147289
|
}
|
|
147446
|
-
let
|
|
147447
|
-
if (this.config.loggerFactory)
|
|
147448
|
-
else if (this.config.defaultLogger)
|
|
147449
|
-
else
|
|
147450
|
-
this.loggers.set(name18,
|
|
147451
|
-
return
|
|
147290
|
+
let logger24;
|
|
147291
|
+
if (this.config.loggerFactory) logger24 = this.config.loggerFactory(name18);
|
|
147292
|
+
else if (this.config.defaultLogger) logger24 = this.config.defaultLogger;
|
|
147293
|
+
else logger24 = new PinoLogger(name18, this.config.pinoConfig);
|
|
147294
|
+
this.loggers.set(name18, logger24);
|
|
147295
|
+
return logger24;
|
|
147452
147296
|
}
|
|
147453
147297
|
/**
|
|
147454
147298
|
* Reset factory to default state
|
|
@@ -179714,7 +179558,7 @@ var PglitePreparedQuery = class extends PgPreparedQuery {
|
|
|
179714
179558
|
static {
|
|
179715
179559
|
__name(this, "PglitePreparedQuery");
|
|
179716
179560
|
}
|
|
179717
|
-
constructor(client, queryString, params,
|
|
179561
|
+
constructor(client, queryString, params, logger24, cache, queryMetadata, cacheConfig, fields, name18, _isResponseInArrayMode, customResultMapper) {
|
|
179718
179562
|
super({
|
|
179719
179563
|
sql: queryString,
|
|
179720
179564
|
params
|
|
@@ -179722,7 +179566,7 @@ var PglitePreparedQuery = class extends PgPreparedQuery {
|
|
|
179722
179566
|
this.client = client;
|
|
179723
179567
|
this.queryString = queryString;
|
|
179724
179568
|
this.params = params;
|
|
179725
|
-
this.logger =
|
|
179569
|
+
this.logger = logger24;
|
|
179726
179570
|
this.fields = fields;
|
|
179727
179571
|
this._isResponseInArrayMode = _isResponseInArrayMode;
|
|
179728
179572
|
this.customResultMapper = customResultMapper;
|
|
@@ -179875,11 +179719,11 @@ function construct(client, config4 = {}) {
|
|
|
179875
179719
|
const dialect = new PgDialect({
|
|
179876
179720
|
casing: config4.casing
|
|
179877
179721
|
});
|
|
179878
|
-
let
|
|
179722
|
+
let logger24;
|
|
179879
179723
|
if (config4.logger === true) {
|
|
179880
|
-
|
|
179724
|
+
logger24 = new DefaultLogger();
|
|
179881
179725
|
} else if (config4.logger !== false) {
|
|
179882
|
-
|
|
179726
|
+
logger24 = config4.logger;
|
|
179883
179727
|
}
|
|
179884
179728
|
let schema;
|
|
179885
179729
|
if (config4.schema) {
|
|
@@ -179891,7 +179735,7 @@ function construct(client, config4 = {}) {
|
|
|
179891
179735
|
};
|
|
179892
179736
|
}
|
|
179893
179737
|
const driver = new PgliteDriver(client, dialect, {
|
|
179894
|
-
logger:
|
|
179738
|
+
logger: logger24,
|
|
179895
179739
|
cache: config4.cache
|
|
179896
179740
|
});
|
|
179897
179741
|
const session2 = driver.createSession(schema);
|
|
@@ -179960,7 +179804,7 @@ var NodePgPreparedQuery = class extends PgPreparedQuery {
|
|
|
179960
179804
|
static {
|
|
179961
179805
|
__name(this, "NodePgPreparedQuery");
|
|
179962
179806
|
}
|
|
179963
|
-
constructor(client, queryString, params,
|
|
179807
|
+
constructor(client, queryString, params, logger24, cache, queryMetadata, cacheConfig, fields, name18, _isResponseInArrayMode, customResultMapper) {
|
|
179964
179808
|
super({
|
|
179965
179809
|
sql: queryString,
|
|
179966
179810
|
params
|
|
@@ -179968,7 +179812,7 @@ var NodePgPreparedQuery = class extends PgPreparedQuery {
|
|
|
179968
179812
|
this.client = client;
|
|
179969
179813
|
this.queryString = queryString;
|
|
179970
179814
|
this.params = params;
|
|
179971
|
-
this.logger =
|
|
179815
|
+
this.logger = logger24;
|
|
179972
179816
|
this.fields = fields;
|
|
179973
179817
|
this._isResponseInArrayMode = _isResponseInArrayMode;
|
|
179974
179818
|
this.customResultMapper = customResultMapper;
|
|
@@ -180192,11 +180036,11 @@ function construct2(client, config4 = {}) {
|
|
|
180192
180036
|
const dialect = new PgDialect({
|
|
180193
180037
|
casing: config4.casing
|
|
180194
180038
|
});
|
|
180195
|
-
let
|
|
180039
|
+
let logger24;
|
|
180196
180040
|
if (config4.logger === true) {
|
|
180197
|
-
|
|
180041
|
+
logger24 = new DefaultLogger();
|
|
180198
180042
|
} else if (config4.logger !== false) {
|
|
180199
|
-
|
|
180043
|
+
logger24 = config4.logger;
|
|
180200
180044
|
}
|
|
180201
180045
|
let schema;
|
|
180202
180046
|
if (config4.schema) {
|
|
@@ -180208,7 +180052,7 @@ function construct2(client, config4 = {}) {
|
|
|
180208
180052
|
};
|
|
180209
180053
|
}
|
|
180210
180054
|
const driver = new NodePgDriver(client, dialect, {
|
|
180211
|
-
logger:
|
|
180055
|
+
logger: logger24,
|
|
180212
180056
|
cache: config4.cache
|
|
180213
180057
|
});
|
|
180214
180058
|
const session2 = driver.createSession(schema);
|
|
@@ -182353,11 +182197,11 @@ var parseLogLevel = /* @__PURE__ */ __name((maybeLevel, sourceName, client) => {
|
|
|
182353
182197
|
function noop2() {
|
|
182354
182198
|
}
|
|
182355
182199
|
__name(noop2, "noop");
|
|
182356
|
-
function makeLogFn(fnLevel,
|
|
182357
|
-
if (!
|
|
182200
|
+
function makeLogFn(fnLevel, logger24, logLevel) {
|
|
182201
|
+
if (!logger24 || levelNumbers[fnLevel] > levelNumbers[logLevel]) {
|
|
182358
182202
|
return noop2;
|
|
182359
182203
|
} else {
|
|
182360
|
-
return
|
|
182204
|
+
return logger24[fnLevel].bind(logger24);
|
|
182361
182205
|
}
|
|
182362
182206
|
}
|
|
182363
182207
|
__name(makeLogFn, "makeLogFn");
|
|
@@ -182369,22 +182213,22 @@ var noopLogger = {
|
|
|
182369
182213
|
};
|
|
182370
182214
|
var cachedLoggers = /* @__PURE__ */ new WeakMap();
|
|
182371
182215
|
function loggerFor(client) {
|
|
182372
|
-
const
|
|
182216
|
+
const logger24 = client.logger;
|
|
182373
182217
|
const logLevel = client.logLevel ?? "off";
|
|
182374
|
-
if (!
|
|
182218
|
+
if (!logger24) {
|
|
182375
182219
|
return noopLogger;
|
|
182376
182220
|
}
|
|
182377
|
-
const cachedLogger = cachedLoggers.get(
|
|
182221
|
+
const cachedLogger = cachedLoggers.get(logger24);
|
|
182378
182222
|
if (cachedLogger && cachedLogger[0] === logLevel) {
|
|
182379
182223
|
return cachedLogger[1];
|
|
182380
182224
|
}
|
|
182381
182225
|
const levelLogger = {
|
|
182382
|
-
error: makeLogFn("error",
|
|
182383
|
-
warn: makeLogFn("warn",
|
|
182384
|
-
info: makeLogFn("info",
|
|
182385
|
-
debug: makeLogFn("debug",
|
|
182226
|
+
error: makeLogFn("error", logger24, logLevel),
|
|
182227
|
+
warn: makeLogFn("warn", logger24, logLevel),
|
|
182228
|
+
info: makeLogFn("info", logger24, logLevel),
|
|
182229
|
+
debug: makeLogFn("debug", logger24, logLevel)
|
|
182386
182230
|
};
|
|
182387
|
-
cachedLoggers.set(
|
|
182231
|
+
cachedLoggers.set(logger24, [
|
|
182388
182232
|
logLevel,
|
|
182389
182233
|
levelLogger
|
|
182390
182234
|
]);
|
|
@@ -188623,11 +188467,11 @@ var parseLogLevel2 = /* @__PURE__ */ __name((maybeLevel, sourceName, client) =>
|
|
|
188623
188467
|
function noop3() {
|
|
188624
188468
|
}
|
|
188625
188469
|
__name(noop3, "noop");
|
|
188626
|
-
function makeLogFn2(fnLevel,
|
|
188627
|
-
if (!
|
|
188470
|
+
function makeLogFn2(fnLevel, logger24, logLevel) {
|
|
188471
|
+
if (!logger24 || levelNumbers2[fnLevel] > levelNumbers2[logLevel]) {
|
|
188628
188472
|
return noop3;
|
|
188629
188473
|
} else {
|
|
188630
|
-
return
|
|
188474
|
+
return logger24[fnLevel].bind(logger24);
|
|
188631
188475
|
}
|
|
188632
188476
|
}
|
|
188633
188477
|
__name(makeLogFn2, "makeLogFn");
|
|
@@ -188639,22 +188483,22 @@ var noopLogger2 = {
|
|
|
188639
188483
|
};
|
|
188640
188484
|
var cachedLoggers2 = /* @__PURE__ */ new WeakMap();
|
|
188641
188485
|
function loggerFor2(client) {
|
|
188642
|
-
const
|
|
188486
|
+
const logger24 = client.logger;
|
|
188643
188487
|
const logLevel = client.logLevel ?? "off";
|
|
188644
|
-
if (!
|
|
188488
|
+
if (!logger24) {
|
|
188645
188489
|
return noopLogger2;
|
|
188646
188490
|
}
|
|
188647
|
-
const cachedLogger = cachedLoggers2.get(
|
|
188491
|
+
const cachedLogger = cachedLoggers2.get(logger24);
|
|
188648
188492
|
if (cachedLogger && cachedLogger[0] === logLevel) {
|
|
188649
188493
|
return cachedLogger[1];
|
|
188650
188494
|
}
|
|
188651
188495
|
const levelLogger = {
|
|
188652
|
-
error: makeLogFn2("error",
|
|
188653
|
-
warn: makeLogFn2("warn",
|
|
188654
|
-
info: makeLogFn2("info",
|
|
188655
|
-
debug: makeLogFn2("debug",
|
|
188496
|
+
error: makeLogFn2("error", logger24, logLevel),
|
|
188497
|
+
warn: makeLogFn2("warn", logger24, logLevel),
|
|
188498
|
+
info: makeLogFn2("info", logger24, logLevel),
|
|
188499
|
+
debug: makeLogFn2("debug", logger24, logLevel)
|
|
188656
188500
|
};
|
|
188657
|
-
cachedLoggers2.set(
|
|
188501
|
+
cachedLoggers2.set(logger24, [
|
|
188658
188502
|
logLevel,
|
|
188659
188503
|
levelLogger
|
|
188660
188504
|
]);
|
|
@@ -188699,7 +188543,7 @@ var Stream = class _Stream {
|
|
|
188699
188543
|
}
|
|
188700
188544
|
static fromSSEResponse(response, controller, client) {
|
|
188701
188545
|
let consumed = false;
|
|
188702
|
-
const
|
|
188546
|
+
const logger24 = client ? loggerFor2(client) : console;
|
|
188703
188547
|
async function* iterator2() {
|
|
188704
188548
|
if (consumed) {
|
|
188705
188549
|
throw new OpenAIError("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");
|
|
@@ -188718,8 +188562,8 @@ var Stream = class _Stream {
|
|
|
188718
188562
|
try {
|
|
188719
188563
|
data = JSON.parse(sse.data);
|
|
188720
188564
|
} catch (e) {
|
|
188721
|
-
|
|
188722
|
-
|
|
188565
|
+
logger24.error(`Could not parse message into JSON:`, sse.data);
|
|
188566
|
+
logger24.error(`From chunk:`, sse.raw);
|
|
188723
188567
|
throw e;
|
|
188724
188568
|
}
|
|
188725
188569
|
if (data && data.error) {
|
|
@@ -201435,12 +201279,12 @@ var logWarnings = /* @__PURE__ */ __name((options) => {
|
|
|
201435
201279
|
if (options.warnings.length === 0) {
|
|
201436
201280
|
return;
|
|
201437
201281
|
}
|
|
201438
|
-
const
|
|
201439
|
-
if (
|
|
201282
|
+
const logger24 = globalThis.AI_SDK_LOG_WARNINGS;
|
|
201283
|
+
if (logger24 === false) {
|
|
201440
201284
|
return;
|
|
201441
201285
|
}
|
|
201442
|
-
if (typeof
|
|
201443
|
-
|
|
201286
|
+
if (typeof logger24 === "function") {
|
|
201287
|
+
logger24(options);
|
|
201444
201288
|
return;
|
|
201445
201289
|
}
|
|
201446
201290
|
if (!hasLoggedBefore) {
|
|
@@ -228105,116 +227949,11 @@ var ModelFactory = class ModelFactory2 {
|
|
|
228105
227949
|
// ../packages/agents-core/dist/utils/service-token-auth.js
|
|
228106
227950
|
var logger15 = getLogger("service-token-auth");
|
|
228107
227951
|
|
|
228108
|
-
// ../packages/agents-core/dist/utils/slack-link-token.js
|
|
228109
|
-
var logger16 = getLogger("slack-link-token");
|
|
228110
|
-
var ISSUER = "inkeep-auth";
|
|
228111
|
-
var AUDIENCE = "slack-link";
|
|
228112
|
-
var TOKEN_USE = "slackLinkCode";
|
|
228113
|
-
var SlackLinkTokenPayloadSchema = external_exports.object({
|
|
228114
|
-
iss: external_exports.literal(ISSUER),
|
|
228115
|
-
aud: external_exports.literal(AUDIENCE),
|
|
228116
|
-
sub: external_exports.string().min(1),
|
|
228117
|
-
iat: external_exports.number(),
|
|
228118
|
-
exp: external_exports.number(),
|
|
228119
|
-
jti: external_exports.string().optional(),
|
|
228120
|
-
tokenUse: external_exports.literal(TOKEN_USE),
|
|
228121
|
-
tenantId: external_exports.string().min(1),
|
|
228122
|
-
slack: external_exports.object({
|
|
228123
|
-
teamId: external_exports.string().min(1),
|
|
228124
|
-
userId: external_exports.string().min(1),
|
|
228125
|
-
enterpriseId: external_exports.string().min(1).optional(),
|
|
228126
|
-
username: external_exports.string().optional()
|
|
228127
|
-
})
|
|
228128
|
-
});
|
|
228129
|
-
|
|
228130
|
-
// ../packages/agents-core/dist/utils/slack-user-token.js
|
|
228131
|
-
var logger17 = getLogger("slack-user-token");
|
|
228132
|
-
var ISSUER2 = "inkeep-auth";
|
|
228133
|
-
var AUDIENCE2 = "inkeep-api";
|
|
228134
|
-
var TOKEN_USE2 = "slackUser";
|
|
228135
|
-
var ACTOR_SUB = "inkeep-work-app-slack";
|
|
228136
|
-
var SlackAccessTokenPayloadSchema = external_exports.object({
|
|
228137
|
-
iss: external_exports.literal(ISSUER2),
|
|
228138
|
-
aud: external_exports.literal(AUDIENCE2),
|
|
228139
|
-
sub: external_exports.string().min(1),
|
|
228140
|
-
iat: external_exports.number(),
|
|
228141
|
-
exp: external_exports.number(),
|
|
228142
|
-
jti: external_exports.string().optional(),
|
|
228143
|
-
tokenUse: external_exports.literal(TOKEN_USE2),
|
|
228144
|
-
act: external_exports.object({
|
|
228145
|
-
sub: external_exports.literal(ACTOR_SUB)
|
|
228146
|
-
}),
|
|
228147
|
-
tenantId: external_exports.string().min(1),
|
|
228148
|
-
slack: external_exports.object({
|
|
228149
|
-
teamId: external_exports.string().min(1),
|
|
228150
|
-
userId: external_exports.string().min(1),
|
|
228151
|
-
enterpriseId: external_exports.string().min(1).optional(),
|
|
228152
|
-
email: external_exports.string().email().optional()
|
|
228153
|
-
})
|
|
228154
|
-
});
|
|
228155
|
-
|
|
228156
|
-
// ../packages/agents-core/dist/utils/sse-parser.js
|
|
228157
|
-
function parseSSEResponse(sseText) {
|
|
228158
|
-
let textContent = "";
|
|
228159
|
-
let hasError = false;
|
|
228160
|
-
let errorMessage = "";
|
|
228161
|
-
const lines = sseText.split("\n").filter((line2) => line2.startsWith("data: "));
|
|
228162
|
-
for (const line2 of lines) {
|
|
228163
|
-
const jsonStr = line2.slice(6).trim();
|
|
228164
|
-
if (!jsonStr || jsonStr === "[DONE]") continue;
|
|
228165
|
-
try {
|
|
228166
|
-
const data = JSON.parse(jsonStr);
|
|
228167
|
-
if (data.object === "chat.completion.chunk" && data.choices?.[0]?.delta) {
|
|
228168
|
-
const delta = data.choices[0].delta;
|
|
228169
|
-
if (delta.content && typeof delta.content === "string") try {
|
|
228170
|
-
const parsedContent = JSON.parse(delta.content);
|
|
228171
|
-
if (parsedContent.type === "data-operation") {
|
|
228172
|
-
if (parsedContent.data?.type === "error") {
|
|
228173
|
-
hasError = true;
|
|
228174
|
-
errorMessage = parsedContent.data.message || "Unknown error occurred";
|
|
228175
|
-
}
|
|
228176
|
-
continue;
|
|
228177
|
-
}
|
|
228178
|
-
textContent += delta.content;
|
|
228179
|
-
} catch {
|
|
228180
|
-
textContent += delta.content;
|
|
228181
|
-
}
|
|
228182
|
-
continue;
|
|
228183
|
-
}
|
|
228184
|
-
if (data.type === "text-delta" && data.delta) {
|
|
228185
|
-
textContent += data.delta;
|
|
228186
|
-
continue;
|
|
228187
|
-
}
|
|
228188
|
-
if (data.type === "text-start" || data.type === "text-end") continue;
|
|
228189
|
-
if (data.type === "data-operation") {
|
|
228190
|
-
if (data.data?.type === "error") {
|
|
228191
|
-
hasError = true;
|
|
228192
|
-
errorMessage = data.data.message || "Unknown error occurred";
|
|
228193
|
-
}
|
|
228194
|
-
continue;
|
|
228195
|
-
}
|
|
228196
|
-
if (data.type === "error") {
|
|
228197
|
-
hasError = true;
|
|
228198
|
-
errorMessage = data.message || "Unknown error occurred";
|
|
228199
|
-
}
|
|
228200
|
-
} catch {
|
|
228201
|
-
}
|
|
228202
|
-
}
|
|
228203
|
-
if (hasError) return {
|
|
228204
|
-
text: textContent.trim(),
|
|
228205
|
-
error: errorMessage
|
|
228206
|
-
};
|
|
228207
|
-
return {
|
|
228208
|
-
text: textContent.trim()
|
|
228209
|
-
};
|
|
228210
|
-
}
|
|
228211
|
-
__name(parseSSEResponse, "parseSSEResponse");
|
|
228212
|
-
|
|
228213
227952
|
// ../packages/agents-core/dist/utils/third-party-mcp-servers/composio-client.js
|
|
228214
227953
|
var logger$1 = getLogger("composio-client");
|
|
228215
227954
|
|
|
228216
227955
|
// ../packages/agents-core/dist/utils/third-party-mcp-servers/third-party-check.js
|
|
228217
|
-
var
|
|
227956
|
+
var logger16 = getLogger("third-party-check");
|
|
228218
227957
|
|
|
228219
227958
|
// ../packages/agents-core/dist/utils/trigger-auth.js
|
|
228220
227959
|
var import_node_crypto7 = require("node:crypto");
|
|
@@ -228222,10 +227961,10 @@ var import_node_util3 = require("node:util");
|
|
|
228222
227961
|
var scryptAsync2 = (0, import_node_util3.promisify)(import_node_crypto7.scrypt);
|
|
228223
227962
|
|
|
228224
227963
|
// ../packages/agents-core/dist/utils/tracer-factory.js
|
|
228225
|
-
var
|
|
227964
|
+
var logger17 = getLogger("tracer");
|
|
228226
227965
|
|
|
228227
227966
|
// ../packages/agents-core/dist/data-access/manage/tools.js
|
|
228228
|
-
var
|
|
227967
|
+
var logger18 = getLogger("tools");
|
|
228229
227968
|
var listTools = /* @__PURE__ */ __name((db) => async (params) => {
|
|
228230
227969
|
const page = params.pagination?.page || 1;
|
|
228231
227970
|
const limit3 = Math.min(params.pagination?.limit || 10, 100);
|
|
@@ -228680,10 +228419,10 @@ var defaultLogger = {
|
|
|
228680
228419
|
error: /* @__PURE__ */ __name(() => {
|
|
228681
228420
|
}, "error")
|
|
228682
228421
|
};
|
|
228683
|
-
var getFullAgent = /* @__PURE__ */ __name((db,
|
|
228422
|
+
var getFullAgent = /* @__PURE__ */ __name((db, logger24 = defaultLogger) => async (params) => {
|
|
228684
228423
|
const { scopes } = params;
|
|
228685
228424
|
const { tenantId, projectId } = scopes;
|
|
228686
|
-
|
|
228425
|
+
logger24.info({
|
|
228687
228426
|
tenantId,
|
|
228688
228427
|
agentId: scopes.agentId
|
|
228689
228428
|
}, "Retrieving full agent definition");
|
|
@@ -228696,20 +228435,20 @@ var getFullAgent = /* @__PURE__ */ __name((db, logger26 = defaultLogger) => asyn
|
|
|
228696
228435
|
}
|
|
228697
228436
|
});
|
|
228698
228437
|
if (!agent) {
|
|
228699
|
-
|
|
228438
|
+
logger24.info({
|
|
228700
228439
|
tenantId,
|
|
228701
228440
|
agentId: scopes.agentId
|
|
228702
228441
|
}, "Agent not found");
|
|
228703
228442
|
return null;
|
|
228704
228443
|
}
|
|
228705
|
-
|
|
228444
|
+
logger24.info({
|
|
228706
228445
|
tenantId,
|
|
228707
228446
|
agentId: scopes.agentId,
|
|
228708
228447
|
agentCount: Object.keys(agent.subAgents).length
|
|
228709
228448
|
}, "Full agent retrieved successfully");
|
|
228710
228449
|
return agent;
|
|
228711
228450
|
} catch (error92) {
|
|
228712
|
-
|
|
228451
|
+
logger24.error({
|
|
228713
228452
|
tenantId,
|
|
228714
228453
|
agentId: scopes.agentId,
|
|
228715
228454
|
error: error92 instanceof Error ? error92.message : "Unknown error"
|
|
@@ -228875,11 +228614,11 @@ var filterConversationsForJob = /* @__PURE__ */ __name((db) => async (params) =>
|
|
|
228875
228614
|
loadEnvironmentFiles();
|
|
228876
228615
|
|
|
228877
228616
|
// ../packages/agents-core/dist/dolt/ref-middleware.js
|
|
228878
|
-
var
|
|
228617
|
+
var logger19 = getLogger("ref-middleware");
|
|
228879
228618
|
|
|
228880
228619
|
// ../packages/agents-core/dist/dolt/ref-scope.js
|
|
228881
228620
|
var import_node_async_hooks2 = require("node:async_hooks");
|
|
228882
|
-
var
|
|
228621
|
+
var logger20 = getLogger("ref-scope");
|
|
228883
228622
|
var refScopeStorage = new import_node_async_hooks2.AsyncLocalStorage();
|
|
228884
228623
|
var NestedRefScopeError = class extends Error {
|
|
228885
228624
|
static {
|
|
@@ -228897,7 +228636,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228897
228636
|
const existingScope = refScopeStorage.getStore();
|
|
228898
228637
|
if (existingScope) {
|
|
228899
228638
|
if (existingScope.ref === resolvedRef.name) {
|
|
228900
|
-
|
|
228639
|
+
logger20.debug({
|
|
228901
228640
|
ref: resolvedRef.name,
|
|
228902
228641
|
existingConnectionId: existingScope.connectionId
|
|
228903
228642
|
}, "Reusing existing ref scope");
|
|
@@ -228920,7 +228659,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228920
228659
|
connection$1.release();
|
|
228921
228660
|
}
|
|
228922
228661
|
}
|
|
228923
|
-
|
|
228662
|
+
logger20.debug({
|
|
228924
228663
|
ref: resolvedRef.name,
|
|
228925
228664
|
refType: resolvedRef.type,
|
|
228926
228665
|
connectionId
|
|
@@ -228932,7 +228671,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228932
228671
|
schema: manage_schema_exports
|
|
228933
228672
|
});
|
|
228934
228673
|
if (resolvedRef.type === "branch") {
|
|
228935
|
-
|
|
228674
|
+
logger20.debug({
|
|
228936
228675
|
branch: resolvedRef.name,
|
|
228937
228676
|
connectionId
|
|
228938
228677
|
}, "Checking out branch");
|
|
@@ -228942,7 +228681,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228942
228681
|
});
|
|
228943
228682
|
} else {
|
|
228944
228683
|
tempBranch = `temp_${resolvedRef.type}_${Date.now()}_${generateId()}`;
|
|
228945
|
-
|
|
228684
|
+
logger20.debug({
|
|
228946
228685
|
tempBranch,
|
|
228947
228686
|
hash: resolvedRef.hash,
|
|
228948
228687
|
refType: resolvedRef.type,
|
|
@@ -228960,7 +228699,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228960
228699
|
}, () => dataAccessFn(db));
|
|
228961
228700
|
if (commit && resolvedRef.type === "branch") try {
|
|
228962
228701
|
if ((await doltStatus(db)()).length > 0) {
|
|
228963
|
-
|
|
228702
|
+
logger20.info({
|
|
228964
228703
|
branch: resolvedRef.name,
|
|
228965
228704
|
message: commitMessage,
|
|
228966
228705
|
connectionId
|
|
@@ -228972,19 +228711,19 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228972
228711
|
email: "api@inkeep.com"
|
|
228973
228712
|
}
|
|
228974
228713
|
});
|
|
228975
|
-
|
|
228714
|
+
logger20.info({
|
|
228976
228715
|
branch: resolvedRef.name,
|
|
228977
228716
|
connectionId
|
|
228978
228717
|
}, "Successfully committed changes");
|
|
228979
228718
|
}
|
|
228980
228719
|
} catch (commitError) {
|
|
228981
|
-
|
|
228720
|
+
logger20.error({
|
|
228982
228721
|
error: commitError,
|
|
228983
228722
|
branch: resolvedRef.name,
|
|
228984
228723
|
connectionId
|
|
228985
228724
|
}, "Failed to auto-commit changes");
|
|
228986
228725
|
}
|
|
228987
|
-
|
|
228726
|
+
logger20.debug({
|
|
228988
228727
|
ref: resolvedRef.name,
|
|
228989
228728
|
duration: Date.now() - startTime,
|
|
228990
228729
|
connectionId
|
|
@@ -228997,19 +228736,19 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228997
228736
|
});
|
|
228998
228737
|
if ((await doltStatus(db)()).length > 0) {
|
|
228999
228738
|
await doltReset(db)();
|
|
229000
|
-
|
|
228739
|
+
logger20.info({
|
|
229001
228740
|
branch: resolvedRef.name,
|
|
229002
228741
|
connectionId
|
|
229003
228742
|
}, "Reset uncommitted changes due to failed operation");
|
|
229004
228743
|
}
|
|
229005
228744
|
} catch (resetError) {
|
|
229006
|
-
|
|
228745
|
+
logger20.error({
|
|
229007
228746
|
error: resetError,
|
|
229008
228747
|
branch: resolvedRef.name,
|
|
229009
228748
|
connectionId
|
|
229010
228749
|
}, "Failed to reset changes after error");
|
|
229011
228750
|
}
|
|
229012
|
-
|
|
228751
|
+
logger20.error({
|
|
229013
228752
|
ref: resolvedRef.name,
|
|
229014
228753
|
duration: Date.now() - startTime,
|
|
229015
228754
|
connectionId,
|
|
@@ -229020,7 +228759,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
229020
228759
|
try {
|
|
229021
228760
|
await connection.query(`SELECT DOLT_CHECKOUT('main')`);
|
|
229022
228761
|
if (tempBranch) {
|
|
229023
|
-
|
|
228762
|
+
logger20.debug({
|
|
229024
228763
|
tempBranch,
|
|
229025
228764
|
connectionId
|
|
229026
228765
|
}, "Deleting temporary branch");
|
|
@@ -229029,14 +228768,14 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
229029
228768
|
]);
|
|
229030
228769
|
}
|
|
229031
228770
|
} catch (cleanupError) {
|
|
229032
|
-
|
|
228771
|
+
logger20.error({
|
|
229033
228772
|
error: cleanupError,
|
|
229034
228773
|
tempBranch,
|
|
229035
228774
|
connectionId
|
|
229036
228775
|
}, "Error during ref scope cleanup");
|
|
229037
228776
|
} finally {
|
|
229038
228777
|
connection.release();
|
|
229039
|
-
|
|
228778
|
+
logger20.debug({
|
|
229040
228779
|
ref: resolvedRef.name,
|
|
229041
228780
|
duration: Date.now() - startTime,
|
|
229042
228781
|
connectionId
|
|
@@ -229152,7 +228891,7 @@ var runDbClient = createAgentsRunDatabaseClient({
|
|
|
229152
228891
|
var runDbClient_default = runDbClient;
|
|
229153
228892
|
|
|
229154
228893
|
// src/domains/evals/services/EvaluationService.ts
|
|
229155
|
-
var
|
|
228894
|
+
var logger21 = getLogger("EvaluationService");
|
|
229156
228895
|
var EvaluationService = class {
|
|
229157
228896
|
static {
|
|
229158
228897
|
__name(this, "EvaluationService");
|
|
@@ -229202,7 +228941,7 @@ var EvaluationService = class {
|
|
|
229202
228941
|
messages: initialMessages
|
|
229203
228942
|
});
|
|
229204
228943
|
} catch (error92) {
|
|
229205
|
-
|
|
228944
|
+
logger21.error({
|
|
229206
228945
|
error: error92 instanceof Error ? error92.message : String(error92),
|
|
229207
228946
|
datasetItemId: datasetItem2.id
|
|
229208
228947
|
}, "Error running dataset item through chat API");
|
|
@@ -229237,7 +228976,7 @@ var EvaluationService = class {
|
|
|
229237
228976
|
"x-inkeep-dataset-run-id": datasetRunId
|
|
229238
228977
|
}
|
|
229239
228978
|
};
|
|
229240
|
-
|
|
228979
|
+
logger21.info({
|
|
229241
228980
|
tenantId,
|
|
229242
228981
|
projectId,
|
|
229243
228982
|
agentId,
|
|
@@ -229252,7 +228991,7 @@ var EvaluationService = class {
|
|
|
229252
228991
|
});
|
|
229253
228992
|
if (!response.ok) {
|
|
229254
228993
|
const errorText = await response.text();
|
|
229255
|
-
|
|
228994
|
+
logger21.error({
|
|
229256
228995
|
status: response.status,
|
|
229257
228996
|
statusText: response.statusText,
|
|
229258
228997
|
errorText,
|
|
@@ -229265,9 +229004,9 @@ var EvaluationService = class {
|
|
|
229265
229004
|
};
|
|
229266
229005
|
}
|
|
229267
229006
|
const responseText = await response.text();
|
|
229268
|
-
const parseResult = parseSSEResponse(responseText);
|
|
229007
|
+
const parseResult = this.parseSSEResponse(responseText);
|
|
229269
229008
|
if (parseResult.error) {
|
|
229270
|
-
|
|
229009
|
+
logger21.error({
|
|
229271
229010
|
datasetItemId: datasetItem2.id,
|
|
229272
229011
|
conversationId,
|
|
229273
229012
|
errorMessage: parseResult.error
|
|
@@ -229277,7 +229016,7 @@ var EvaluationService = class {
|
|
|
229277
229016
|
error: parseResult.error
|
|
229278
229017
|
};
|
|
229279
229018
|
}
|
|
229280
|
-
|
|
229019
|
+
logger21.info({
|
|
229281
229020
|
datasetItemId: datasetItem2.id,
|
|
229282
229021
|
conversationId,
|
|
229283
229022
|
responseLength: parseResult.text?.length || 0
|
|
@@ -229292,7 +229031,7 @@ var EvaluationService = class {
|
|
|
229292
229031
|
*/
|
|
229293
229032
|
async runDatasetItemWithSimulation(params) {
|
|
229294
229033
|
const { tenantId, projectId, agentId, datasetItem: datasetItem2, datasetRunId, conversationId, apiKey, initialMessages, simulationAgent } = params;
|
|
229295
|
-
|
|
229034
|
+
logger21.info({
|
|
229296
229035
|
tenantId,
|
|
229297
229036
|
projectId,
|
|
229298
229037
|
agentId,
|
|
@@ -229332,7 +229071,7 @@ var EvaluationService = class {
|
|
|
229332
229071
|
while (stepCount < maxSteps) {
|
|
229333
229072
|
try {
|
|
229334
229073
|
const simulationPrompt = this.buildSimulationPrompt(simulationAgent.prompt, conversationHistory);
|
|
229335
|
-
|
|
229074
|
+
logger21.debug({
|
|
229336
229075
|
stepCount,
|
|
229337
229076
|
maxSteps,
|
|
229338
229077
|
conversationHistoryLength: conversationHistory.length
|
|
@@ -229343,7 +229082,7 @@ var EvaluationService = class {
|
|
|
229343
229082
|
});
|
|
229344
229083
|
const nextUserMessage = simulationResponse.text.trim();
|
|
229345
229084
|
if (!nextUserMessage) {
|
|
229346
|
-
|
|
229085
|
+
logger21.warn({
|
|
229347
229086
|
stepCount,
|
|
229348
229087
|
datasetItemId: datasetItem2.id
|
|
229349
229088
|
}, "Simulation agent returned empty message, stopping conversation");
|
|
@@ -229369,7 +229108,7 @@ var EvaluationService = class {
|
|
|
229369
229108
|
]
|
|
229370
229109
|
});
|
|
229371
229110
|
if (agentResponse.error || !agentResponse.response) {
|
|
229372
|
-
|
|
229111
|
+
logger21.warn({
|
|
229373
229112
|
stepCount,
|
|
229374
229113
|
error: agentResponse.error,
|
|
229375
229114
|
datasetItemId: datasetItem2.id
|
|
@@ -229382,7 +229121,7 @@ var EvaluationService = class {
|
|
|
229382
229121
|
});
|
|
229383
229122
|
stepCount++;
|
|
229384
229123
|
} catch (error92) {
|
|
229385
|
-
|
|
229124
|
+
logger21.error({
|
|
229386
229125
|
error: error92 instanceof Error ? error92.message : String(error92),
|
|
229387
229126
|
stepCount,
|
|
229388
229127
|
datasetItemId: datasetItem2.id
|
|
@@ -229390,7 +229129,7 @@ var EvaluationService = class {
|
|
|
229390
229129
|
break;
|
|
229391
229130
|
}
|
|
229392
229131
|
}
|
|
229393
|
-
|
|
229132
|
+
logger21.info({
|
|
229394
229133
|
datasetItemId: datasetItem2.id,
|
|
229395
229134
|
conversationId,
|
|
229396
229135
|
finalStepCount: stepCount,
|
|
@@ -229444,7 +229183,7 @@ Generate the next user message:`;
|
|
|
229444
229183
|
const validMessages = input.messages.map((msg) => {
|
|
229445
229184
|
const mappedRole = roleMap[msg.role.toLowerCase()];
|
|
229446
229185
|
if (!mappedRole) {
|
|
229447
|
-
|
|
229186
|
+
logger21.warn({
|
|
229448
229187
|
datasetItemId: datasetItem2.id,
|
|
229449
229188
|
invalidRole: msg.role
|
|
229450
229189
|
}, "Invalid message role found, skipping message");
|
|
@@ -229456,7 +229195,7 @@ Generate the next user message:`;
|
|
|
229456
229195
|
};
|
|
229457
229196
|
}).filter((msg) => msg !== null);
|
|
229458
229197
|
if (validMessages.length === 0) {
|
|
229459
|
-
|
|
229198
|
+
logger21.warn({
|
|
229460
229199
|
datasetItemId: datasetItem2.id,
|
|
229461
229200
|
totalMessages: input.messages.length
|
|
229462
229201
|
}, "No valid messages found after filtering roles");
|
|
@@ -229471,7 +229210,7 @@ Generate the next user message:`;
|
|
|
229471
229210
|
const validMessages = parsed.messages.map((msg) => {
|
|
229472
229211
|
const mappedRole = roleMap[msg.role?.toLowerCase()];
|
|
229473
229212
|
if (!mappedRole) {
|
|
229474
|
-
|
|
229213
|
+
logger21.warn({
|
|
229475
229214
|
datasetItemId: datasetItem2.id,
|
|
229476
229215
|
invalidRole: msg.role
|
|
229477
229216
|
}, "Invalid message role found in parsed input, skipping message");
|
|
@@ -229496,6 +229235,69 @@ Generate the next user message:`;
|
|
|
229496
229235
|
return null;
|
|
229497
229236
|
}
|
|
229498
229237
|
/**
|
|
229238
|
+
* Parse SSE (Server-Sent Events) response from chat API
|
|
229239
|
+
* Handles text deltas, error operations, and other data operations
|
|
229240
|
+
*/
|
|
229241
|
+
parseSSEResponse(sseText) {
|
|
229242
|
+
let textContent = "";
|
|
229243
|
+
let hasError = false;
|
|
229244
|
+
let errorMessage = "";
|
|
229245
|
+
const lines = sseText.split("\n").filter((line2) => line2.startsWith("data: "));
|
|
229246
|
+
for (const line2 of lines) {
|
|
229247
|
+
try {
|
|
229248
|
+
const data = JSON.parse(line2.slice(6));
|
|
229249
|
+
if (data.object === "chat.completion.chunk" && data.choices?.[0]?.delta) {
|
|
229250
|
+
const delta = data.choices[0].delta;
|
|
229251
|
+
if (delta.content) {
|
|
229252
|
+
textContent += delta.content;
|
|
229253
|
+
}
|
|
229254
|
+
if (delta.content && typeof delta.content === "string") {
|
|
229255
|
+
try {
|
|
229256
|
+
const parsedContent = JSON.parse(delta.content);
|
|
229257
|
+
if (parsedContent.type === "data-operation" && parsedContent.data?.type === "error") {
|
|
229258
|
+
hasError = true;
|
|
229259
|
+
errorMessage = parsedContent.data.message || "Unknown error occurred";
|
|
229260
|
+
logger21.warn({
|
|
229261
|
+
errorMessage,
|
|
229262
|
+
errorData: parsedContent.data
|
|
229263
|
+
}, "Received error operation from chat API");
|
|
229264
|
+
}
|
|
229265
|
+
} catch {
|
|
229266
|
+
}
|
|
229267
|
+
}
|
|
229268
|
+
} else if (data.type === "text-delta" && data.delta) {
|
|
229269
|
+
textContent += data.delta;
|
|
229270
|
+
} else if (data.type === "data-operation" && data.data?.type === "error") {
|
|
229271
|
+
hasError = true;
|
|
229272
|
+
errorMessage = data.data.message || "Unknown error occurred";
|
|
229273
|
+
logger21.warn({
|
|
229274
|
+
errorMessage,
|
|
229275
|
+
errorData: data.data
|
|
229276
|
+
}, "Received error operation from chat API");
|
|
229277
|
+
} else if (data.type === "error") {
|
|
229278
|
+
hasError = true;
|
|
229279
|
+
errorMessage = data.message || "Unknown error occurred";
|
|
229280
|
+
logger21.warn({
|
|
229281
|
+
errorMessage,
|
|
229282
|
+
errorData: data
|
|
229283
|
+
}, "Received error event from chat API");
|
|
229284
|
+
} else if (data.content) {
|
|
229285
|
+
textContent += typeof data.content === "string" ? data.content : JSON.stringify(data.content);
|
|
229286
|
+
}
|
|
229287
|
+
} catch {
|
|
229288
|
+
}
|
|
229289
|
+
}
|
|
229290
|
+
if (hasError) {
|
|
229291
|
+
return {
|
|
229292
|
+
text: textContent.trim(),
|
|
229293
|
+
error: errorMessage
|
|
229294
|
+
};
|
|
229295
|
+
}
|
|
229296
|
+
return {
|
|
229297
|
+
text: textContent.trim()
|
|
229298
|
+
};
|
|
229299
|
+
}
|
|
229300
|
+
/**
|
|
229499
229301
|
* Run an evaluation job based on an evaluation job config
|
|
229500
229302
|
* Filters conversations based on jobFilters and runs evaluations with configured evaluators
|
|
229501
229303
|
*/
|
|
@@ -229506,7 +229308,7 @@ Generate the next user message:`;
|
|
|
229506
229308
|
if (!resolvedRef) {
|
|
229507
229309
|
throw new Error("Failed to resolve ref");
|
|
229508
229310
|
}
|
|
229509
|
-
|
|
229311
|
+
logger21.info({
|
|
229510
229312
|
tenantId,
|
|
229511
229313
|
projectId,
|
|
229512
229314
|
evaluationJobConfigId,
|
|
@@ -229543,7 +229345,7 @@ Generate the next user message:`;
|
|
|
229543
229345
|
if (validEvaluators.length === 0) {
|
|
229544
229346
|
throw new Error(`No valid evaluators found for job config: ${evaluationJobConfigId}`);
|
|
229545
229347
|
}
|
|
229546
|
-
|
|
229348
|
+
logger21.info({
|
|
229547
229349
|
tenantId,
|
|
229548
229350
|
projectId,
|
|
229549
229351
|
evaluationJobConfigId,
|
|
@@ -229559,7 +229361,7 @@ Generate the next user message:`;
|
|
|
229559
229361
|
if (sampleRate !== void 0 && sampleRate !== null) {
|
|
229560
229362
|
const originalCount = conversationsToEvaluate.length;
|
|
229561
229363
|
conversationsToEvaluate = this.applySampleRate(conversationsToEvaluate, sampleRate);
|
|
229562
|
-
|
|
229364
|
+
logger21.info({
|
|
229563
229365
|
tenantId,
|
|
229564
229366
|
projectId,
|
|
229565
229367
|
evaluationJobConfigId,
|
|
@@ -229568,14 +229370,14 @@ Generate the next user message:`;
|
|
|
229568
229370
|
sampleRate
|
|
229569
229371
|
}, "Applied sample rate to conversations");
|
|
229570
229372
|
}
|
|
229571
|
-
|
|
229373
|
+
logger21.info({
|
|
229572
229374
|
tenantId,
|
|
229573
229375
|
projectId,
|
|
229574
229376
|
evaluationJobConfigId,
|
|
229575
229377
|
conversationCount: conversationsToEvaluate.length
|
|
229576
229378
|
}, "Found conversations for evaluation");
|
|
229577
229379
|
if (conversationsToEvaluate.length === 0) {
|
|
229578
|
-
|
|
229380
|
+
logger21.warn({
|
|
229579
229381
|
tenantId,
|
|
229580
229382
|
projectId,
|
|
229581
229383
|
evaluationJobConfigId
|
|
@@ -229592,7 +229394,7 @@ Generate the next user message:`;
|
|
|
229592
229394
|
for (const conversation of conversationsToEvaluate) {
|
|
229593
229395
|
for (const evaluator2 of validEvaluators) {
|
|
229594
229396
|
try {
|
|
229595
|
-
|
|
229397
|
+
logger21.info({
|
|
229596
229398
|
tenantId,
|
|
229597
229399
|
conversationId: conversation.id,
|
|
229598
229400
|
evaluatorId: evaluator2.id
|
|
@@ -229625,14 +229427,14 @@ Generate the next user message:`;
|
|
|
229625
229427
|
if (updatedResult) {
|
|
229626
229428
|
results.push(updatedResult);
|
|
229627
229429
|
}
|
|
229628
|
-
|
|
229430
|
+
logger21.info({
|
|
229629
229431
|
tenantId,
|
|
229630
229432
|
conversationId: conversation.id,
|
|
229631
229433
|
evaluatorId: evaluator2.id,
|
|
229632
229434
|
resultId: evalResult.id
|
|
229633
229435
|
}, "Evaluation completed successfully");
|
|
229634
229436
|
} catch (error92) {
|
|
229635
|
-
|
|
229437
|
+
logger21.error({
|
|
229636
229438
|
error: error92,
|
|
229637
229439
|
tenantId,
|
|
229638
229440
|
conversationId: conversation.id,
|
|
@@ -229657,7 +229459,7 @@ Generate the next user message:`;
|
|
|
229657
229459
|
}
|
|
229658
229460
|
}
|
|
229659
229461
|
} catch (error92) {
|
|
229660
|
-
|
|
229462
|
+
logger21.error({
|
|
229661
229463
|
error: error92 instanceof Error ? error92.message : String(error92),
|
|
229662
229464
|
tenantId,
|
|
229663
229465
|
conversationId: conversation.id,
|
|
@@ -229666,7 +229468,7 @@ Generate the next user message:`;
|
|
|
229666
229468
|
}
|
|
229667
229469
|
}
|
|
229668
229470
|
}
|
|
229669
|
-
|
|
229471
|
+
logger21.info({
|
|
229670
229472
|
tenantId,
|
|
229671
229473
|
projectId,
|
|
229672
229474
|
evaluationJobConfigId,
|
|
@@ -229736,20 +229538,20 @@ Generate the next user message:`;
|
|
|
229736
229538
|
}
|
|
229737
229539
|
}));
|
|
229738
229540
|
} else {
|
|
229739
|
-
|
|
229541
|
+
logger21.warn({
|
|
229740
229542
|
conversationId: conversation.id,
|
|
229741
229543
|
agentId: conversation.agentId
|
|
229742
229544
|
}, "AgentId not found, cannot get agent definition");
|
|
229743
229545
|
}
|
|
229744
229546
|
} catch (error92) {
|
|
229745
|
-
|
|
229547
|
+
logger21.warn({
|
|
229746
229548
|
error: error92,
|
|
229747
229549
|
conversationId: conversation.id,
|
|
229748
229550
|
agentId: conversation.agentId
|
|
229749
229551
|
}, "Failed to fetch agent definition for evaluation");
|
|
229750
229552
|
}
|
|
229751
229553
|
const prettifiedTrace = await this.fetchTraceFromSigNoz(conversation.id);
|
|
229752
|
-
|
|
229554
|
+
logger21.info({
|
|
229753
229555
|
conversationId: conversation.id,
|
|
229754
229556
|
hasTrace: !!prettifiedTrace,
|
|
229755
229557
|
traceActivityCount: prettifiedTrace?.timeline?.length || 0
|
|
@@ -229763,7 +229565,7 @@ Generate the next user message:`;
|
|
|
229763
229565
|
try {
|
|
229764
229566
|
schemaObj = JSON.parse(evaluator2.schema);
|
|
229765
229567
|
} catch (error92) {
|
|
229766
|
-
|
|
229568
|
+
logger21.error({
|
|
229767
229569
|
error: error92,
|
|
229768
229570
|
schemaString: evaluator2.schema
|
|
229769
229571
|
}, "Failed to parse evaluator schema string");
|
|
@@ -229772,7 +229574,7 @@ Generate the next user message:`;
|
|
|
229772
229574
|
} else {
|
|
229773
229575
|
schemaObj = evaluator2.schema;
|
|
229774
229576
|
}
|
|
229775
|
-
|
|
229577
|
+
logger21.info({
|
|
229776
229578
|
evaluatorId: evaluator2.id,
|
|
229777
229579
|
schemaType: typeof schemaObj,
|
|
229778
229580
|
schemaKeys: schemaObj && typeof schemaObj === "object" ? Object.keys(schemaObj) : []
|
|
@@ -229837,13 +229639,13 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229837
229639
|
let resultSchema;
|
|
229838
229640
|
try {
|
|
229839
229641
|
resultSchema = external_exports.fromJSONSchema(schema);
|
|
229840
|
-
|
|
229642
|
+
logger21.info({
|
|
229841
229643
|
schemaType: typeof schema,
|
|
229842
229644
|
schemaKeys: schema && typeof schema === "object" ? Object.keys(schema) : [],
|
|
229843
229645
|
convertedSchema: "success"
|
|
229844
229646
|
}, "Converted JSON schema to Zod");
|
|
229845
229647
|
} catch (error92) {
|
|
229846
|
-
|
|
229648
|
+
logger21.error({
|
|
229847
229649
|
error: error92,
|
|
229848
229650
|
schema
|
|
229849
229651
|
}, "Failed to convert JSON schema to Zod, using fallback");
|
|
@@ -229851,7 +229653,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229851
229653
|
}
|
|
229852
229654
|
const evaluationSchema = resultSchema;
|
|
229853
229655
|
try {
|
|
229854
|
-
|
|
229656
|
+
logger21.info({
|
|
229855
229657
|
promptLength: prompt.length,
|
|
229856
229658
|
model: modelConfig.model
|
|
229857
229659
|
}, "Calling generateObject");
|
|
@@ -229869,7 +229671,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229869
229671
|
};
|
|
229870
229672
|
} catch (error92) {
|
|
229871
229673
|
const errorMessage = error92 instanceof Error ? error92.message : String(error92);
|
|
229872
|
-
|
|
229674
|
+
logger21.error({
|
|
229873
229675
|
error: errorMessage,
|
|
229874
229676
|
schema: JSON.stringify(schema, null, 2),
|
|
229875
229677
|
promptPreview: prompt.substring(0, 500)
|
|
@@ -229886,7 +229688,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229886
229688
|
const retryDelayMs = 2e4;
|
|
229887
229689
|
const initialDelayMs = 3e4;
|
|
229888
229690
|
try {
|
|
229889
|
-
|
|
229691
|
+
logger21.info({
|
|
229890
229692
|
conversationId,
|
|
229891
229693
|
manageUIUrl,
|
|
229892
229694
|
initialDelayMs
|
|
@@ -229894,21 +229696,21 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229894
229696
|
await new Promise((resolve4) => setTimeout(resolve4, initialDelayMs));
|
|
229895
229697
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
229896
229698
|
try {
|
|
229897
|
-
|
|
229699
|
+
logger21.info({
|
|
229898
229700
|
conversationId,
|
|
229899
229701
|
attempt: attempt + 1,
|
|
229900
229702
|
maxRetries: maxRetries + 1
|
|
229901
229703
|
}, "Fetching trace from SigNoz");
|
|
229902
229704
|
const traceResponse = await fetch(`${manageUIUrl}/api/signoz/conversations/${conversationId}`);
|
|
229903
229705
|
if (!traceResponse.ok) {
|
|
229904
|
-
|
|
229706
|
+
logger21.warn({
|
|
229905
229707
|
conversationId,
|
|
229906
229708
|
status: traceResponse.status,
|
|
229907
229709
|
statusText: traceResponse.statusText,
|
|
229908
229710
|
attempt: attempt + 1
|
|
229909
229711
|
}, "Failed to fetch trace from SigNoz");
|
|
229910
229712
|
if (attempt < maxRetries) {
|
|
229911
|
-
|
|
229713
|
+
logger21.info({
|
|
229912
229714
|
conversationId,
|
|
229913
229715
|
retryDelayMs
|
|
229914
229716
|
}, "Retrying trace fetch after delay");
|
|
@@ -229918,34 +229720,34 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229918
229720
|
return null;
|
|
229919
229721
|
}
|
|
229920
229722
|
const conversationDetail = await traceResponse.json();
|
|
229921
|
-
|
|
229723
|
+
logger21.debug({
|
|
229922
229724
|
conversationId,
|
|
229923
229725
|
activityTypes: conversationDetail.activities?.map((a2) => a2.type) || [],
|
|
229924
229726
|
activityCount: conversationDetail.activities?.length || 0
|
|
229925
229727
|
}, "Checking activities for ai_assistant_message type");
|
|
229926
229728
|
const hasAssistantMessage = conversationDetail.activities?.some((activity) => activity.type === "ai_assistant_message");
|
|
229927
229729
|
if (!hasAssistantMessage) {
|
|
229928
|
-
|
|
229730
|
+
logger21.warn({
|
|
229929
229731
|
conversationId,
|
|
229930
229732
|
attempt: attempt + 1,
|
|
229931
229733
|
activityCount: conversationDetail.activities?.length || 0,
|
|
229932
229734
|
activityTypes: conversationDetail.activities?.slice(0, 5).map((a2) => a2.type) || []
|
|
229933
229735
|
}, "Trace fetched but ai_assistant_message not found in activities");
|
|
229934
229736
|
if (attempt < maxRetries) {
|
|
229935
|
-
|
|
229737
|
+
logger21.info({
|
|
229936
229738
|
conversationId,
|
|
229937
229739
|
retryDelayMs
|
|
229938
229740
|
}, "Retrying trace fetch after delay to wait for assistant message");
|
|
229939
229741
|
await new Promise((resolve4) => setTimeout(resolve4, retryDelayMs));
|
|
229940
229742
|
continue;
|
|
229941
229743
|
}
|
|
229942
|
-
|
|
229744
|
+
logger21.warn({
|
|
229943
229745
|
conversationId,
|
|
229944
229746
|
maxRetries,
|
|
229945
229747
|
activityCount: conversationDetail.activities?.length || 0
|
|
229946
229748
|
}, "Max retries reached, ai_assistant_message not found - proceeding with available trace data");
|
|
229947
229749
|
} else {
|
|
229948
|
-
|
|
229750
|
+
logger21.info({
|
|
229949
229751
|
conversationId,
|
|
229950
229752
|
activityCount: conversationDetail.activities?.length || 0,
|
|
229951
229753
|
attempt: attempt + 1
|
|
@@ -229954,13 +229756,13 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229954
229756
|
const prettifiedTrace = this.formatConversationAsPrettifiedTrace(conversationDetail);
|
|
229955
229757
|
return prettifiedTrace;
|
|
229956
229758
|
} catch (fetchError) {
|
|
229957
|
-
|
|
229759
|
+
logger21.warn({
|
|
229958
229760
|
error: fetchError,
|
|
229959
229761
|
conversationId,
|
|
229960
229762
|
attempt: attempt + 1
|
|
229961
229763
|
}, "Error fetching trace from SigNoz");
|
|
229962
229764
|
if (attempt < maxRetries) {
|
|
229963
|
-
|
|
229765
|
+
logger21.info({
|
|
229964
229766
|
conversationId,
|
|
229965
229767
|
retryDelayMs
|
|
229966
229768
|
}, "Retrying trace fetch after delay");
|
|
@@ -229972,7 +229774,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229972
229774
|
}
|
|
229973
229775
|
return null;
|
|
229974
229776
|
} catch (error92) {
|
|
229975
|
-
|
|
229777
|
+
logger21.warn({
|
|
229976
229778
|
error: error92,
|
|
229977
229779
|
conversationId,
|
|
229978
229780
|
manageUIUrl
|
|
@@ -230009,7 +229811,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
230009
229811
|
};
|
|
230010
229812
|
|
|
230011
229813
|
// src/domains/evals/workflow/functions/evaluateConversation.ts
|
|
230012
|
-
var
|
|
229814
|
+
var logger22 = getLogger("workflow-evaluate-conversation");
|
|
230013
229815
|
async function getConversationStep(payload) {
|
|
230014
229816
|
const { tenantId, projectId, conversationId } = payload;
|
|
230015
229817
|
const conv = await getConversation(runDbClient_default)({
|
|
@@ -230077,7 +229879,7 @@ async function executeEvaluatorStep(payload, evaluatorId, conversation) {
|
|
|
230077
229879
|
output
|
|
230078
229880
|
}
|
|
230079
229881
|
});
|
|
230080
|
-
|
|
229882
|
+
logger22.info({
|
|
230081
229883
|
conversationId,
|
|
230082
229884
|
evaluatorId: evaluator2.id,
|
|
230083
229885
|
resultId: evalResult.id
|
|
@@ -230085,7 +229887,7 @@ async function executeEvaluatorStep(payload, evaluatorId, conversation) {
|
|
|
230085
229887
|
return updated;
|
|
230086
229888
|
} catch (error92) {
|
|
230087
229889
|
const errorMessage = error92 instanceof Error ? error92.message : "Unknown error";
|
|
230088
|
-
|
|
229890
|
+
logger22.error({
|
|
230089
229891
|
error: error92,
|
|
230090
229892
|
conversationId,
|
|
230091
229893
|
evaluatorId: evaluator2.id,
|
|
@@ -230108,7 +229910,7 @@ async function executeEvaluatorStep(payload, evaluatorId, conversation) {
|
|
|
230108
229910
|
}
|
|
230109
229911
|
__name(executeEvaluatorStep, "executeEvaluatorStep");
|
|
230110
229912
|
async function logStep(message, data) {
|
|
230111
|
-
|
|
229913
|
+
logger22.info(data, message);
|
|
230112
229914
|
}
|
|
230113
229915
|
__name(logStep, "logStep");
|
|
230114
229916
|
async function _evaluateConversationWorkflow(payload) {
|
|
@@ -230125,7 +229927,7 @@ registerStepFunction("step//src/domains/evals/workflow/functions/evaluateConvers
|
|
|
230125
229927
|
registerStepFunction("step//src/domains/evals/workflow/functions/evaluateConversation.ts//logStep", logStep);
|
|
230126
229928
|
|
|
230127
229929
|
// src/domains/evals/workflow/functions/runDatasetItem.ts
|
|
230128
|
-
var
|
|
229930
|
+
var logger23 = getLogger("workflow-run-dataset-item");
|
|
230129
229931
|
async function callChatApiStep(payload) {
|
|
230130
229932
|
const { tenantId, projectId, agentId, datasetItemId, datasetItemInput, datasetItemSimulationAgent, datasetRunId } = payload;
|
|
230131
229933
|
const evaluationService = new EvaluationService();
|
|
@@ -230141,7 +229943,7 @@ async function callChatApiStep(payload) {
|
|
|
230141
229943
|
datasetItem: datasetItem2,
|
|
230142
229944
|
datasetRunId
|
|
230143
229945
|
});
|
|
230144
|
-
|
|
229946
|
+
logger23.info({
|
|
230145
229947
|
tenantId,
|
|
230146
229948
|
projectId,
|
|
230147
229949
|
datasetItemId,
|
|
@@ -230164,7 +229966,7 @@ async function createRelationStep(payload, conversationId) {
|
|
|
230164
229966
|
conversationId,
|
|
230165
229967
|
datasetItemId
|
|
230166
229968
|
});
|
|
230167
|
-
|
|
229969
|
+
logger23.info({
|
|
230168
229970
|
tenantId,
|
|
230169
229971
|
projectId,
|
|
230170
229972
|
datasetItemId,
|
|
@@ -230178,7 +229980,7 @@ async function createRelationStep(payload, conversationId) {
|
|
|
230178
229980
|
};
|
|
230179
229981
|
} catch (error92) {
|
|
230180
229982
|
if (error92?.cause?.code === "23503" || error92?.code === "23503") {
|
|
230181
|
-
|
|
229983
|
+
logger23.warn({
|
|
230182
229984
|
tenantId,
|
|
230183
229985
|
projectId,
|
|
230184
229986
|
datasetItemId,
|
|
@@ -230209,7 +230011,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230209
230011
|
}
|
|
230210
230012
|
}));
|
|
230211
230013
|
if (!evaluator2) {
|
|
230212
|
-
|
|
230014
|
+
logger23.warn({
|
|
230213
230015
|
evaluatorId
|
|
230214
230016
|
}, "Evaluator not found");
|
|
230215
230017
|
return null;
|
|
@@ -230251,7 +230053,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230251
230053
|
output
|
|
230252
230054
|
}
|
|
230253
230055
|
});
|
|
230254
|
-
|
|
230056
|
+
logger23.info({
|
|
230255
230057
|
conversationId,
|
|
230256
230058
|
evaluatorId: evaluator2.id,
|
|
230257
230059
|
resultId: evalResult.id
|
|
@@ -230259,7 +230061,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230259
230061
|
return evalResult.id;
|
|
230260
230062
|
} catch (error92) {
|
|
230261
230063
|
const errorMessage = error92 instanceof Error ? error92.message : "Unknown error";
|
|
230262
|
-
|
|
230064
|
+
logger23.error({
|
|
230263
230065
|
error: error92,
|
|
230264
230066
|
conversationId,
|
|
230265
230067
|
evaluatorId: evaluator2.id
|
|
@@ -230281,7 +230083,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230281
230083
|
}
|
|
230282
230084
|
__name(executeEvaluatorStep2, "executeEvaluatorStep");
|
|
230283
230085
|
async function logStep2(message, data) {
|
|
230284
|
-
|
|
230086
|
+
logger23.info(data, message);
|
|
230285
230087
|
}
|
|
230286
230088
|
__name(logStep2, "logStep");
|
|
230287
230089
|
async function _runDatasetItemWorkflow(payload) {
|
|
@@ -244335,7 +244137,7 @@ __name(linkToCurrentContext, "linkToCurrentContext");
|
|
|
244335
244137
|
// ../node_modules/.pnpm/@workflow+core@4.0.1-beta.28_@aws-sdk+client-sts@3.970.0_@opentelemetry+api@1.9.0/node_modules/@workflow/core/dist/logger.js
|
|
244336
244138
|
function createLogger(namespace) {
|
|
244337
244139
|
const baseDebug = (0, import_debug2.default)(`workflow:${namespace}`);
|
|
244338
|
-
const
|
|
244140
|
+
const logger24 = /* @__PURE__ */ __name((level) => {
|
|
244339
244141
|
const levelDebug = baseDebug.extend(level);
|
|
244340
244142
|
return (message, metadata2) => {
|
|
244341
244143
|
levelDebug(message, metadata2);
|
|
@@ -244351,10 +244153,10 @@ function createLogger(namespace) {
|
|
|
244351
244153
|
};
|
|
244352
244154
|
}, "logger");
|
|
244353
244155
|
return {
|
|
244354
|
-
debug:
|
|
244355
|
-
info:
|
|
244356
|
-
warn:
|
|
244357
|
-
error:
|
|
244156
|
+
debug: logger24("debug"),
|
|
244157
|
+
info: logger24("info"),
|
|
244158
|
+
warn: logger24("warn"),
|
|
244159
|
+
error: logger24("error")
|
|
244358
244160
|
};
|
|
244359
244161
|
}
|
|
244360
244162
|
__name(createLogger, "createLogger");
|