@inkeep/agents-api 0.0.0-dev-20260212083055 → 0.0.0-dev-20260212085218
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 +19 -19
- package/dist/.well-known/workflow/v1/step.cjs +390 -220
- package/dist/createApp.d.ts +2 -2
- package/dist/createApp.js +12 -1
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/services/EvaluationService.d.ts +0 -5
- package/dist/domains/evals/services/EvaluationService.js +2 -51
- package/dist/domains/evals/workflow/routes.d.ts +2 -2
- package/dist/domains/manage/routes/availableAgents.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/signoz.d.ts +2 -2
- package/dist/domains/mcp/routes/mcp.d.ts +2 -2
- package/dist/domains/work-apps/index.d.ts +13 -0
- package/dist/domains/work-apps/index.js +23 -0
- package/dist/env.d.ts +2 -2
- package/dist/factory.d.ts +21 -21
- package/dist/index.d.ts +20 -20
- package/dist/middleware/cors.d.ts +6 -1
- package/dist/middleware/cors.js +27 -1
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/index.d.ts +3 -2
- package/dist/middleware/index.js +3 -2
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.js +16 -1
- 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 +71 -1
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/dist/middleware/tenantAccess.d.ts +2 -2
- package/dist/middleware/tracing.d.ts +3 -3
- package/dist/middleware/workAppsAuth.d.ts +7 -0
- package/dist/middleware/workAppsAuth.js +52 -0
- package/dist/openapi.d.ts +5 -0
- package/dist/openapi.js +6 -1
- package/package.json +5 -5
|
@@ -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(logger27) {
|
|
8523
|
+
if (logger27 === false) return noLogs;
|
|
8524
|
+
if (logger27 === void 0) return console;
|
|
8525
|
+
if (logger27.log && logger27.warn && logger27.error) return logger27;
|
|
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((logger27) => {
|
|
39664
|
+
_logger = logger27;
|
|
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((logger27) => {
|
|
64246
|
+
logging.setLogger(logger27);
|
|
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 logger27 = (0, global_utils_1.getGlobal)("diag");
|
|
94108
|
+
if (!logger27) {
|
|
94109
94109
|
return;
|
|
94110
94110
|
}
|
|
94111
94111
|
args2.unshift(namespace);
|
|
94112
|
-
return
|
|
94112
|
+
return logger27[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, logger27) {
|
|
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
|
+
logger27 = logger27 || {};
|
|
94155
94155
|
function _filterFunc(funcName, theLevel) {
|
|
94156
|
-
const theFunc =
|
|
94156
|
+
const theFunc = logger27[funcName];
|
|
94157
94157
|
if (typeof theFunc === "function" && maxLevel >= theLevel) {
|
|
94158
|
-
return theFunc.bind(
|
|
94158
|
+
return theFunc.bind(logger27);
|
|
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 logger27 = (0, global_utils_1.getGlobal)("diag");
|
|
94202
|
+
if (!logger27) return;
|
|
94203
|
+
return logger27[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((logger27, optionsOrLogLevel = {
|
|
94209
94209
|
logLevel: types_1.DiagLogLevel.INFO
|
|
94210
94210
|
}) => {
|
|
94211
94211
|
var _a19, _b17, _c;
|
|
94212
|
-
if (
|
|
94212
|
+
if (logger27 === 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, logger27);
|
|
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}`);
|
|
@@ -126479,7 +126479,10 @@ var runtime_schema_exports = /* @__PURE__ */ __exportAll({
|
|
|
126479
126479
|
workAppGitHubProjectRepositoryAccess: /* @__PURE__ */ __name(() => workAppGitHubProjectRepositoryAccess, "workAppGitHubProjectRepositoryAccess"),
|
|
126480
126480
|
workAppGitHubProjectRepositoryAccessRelations: /* @__PURE__ */ __name(() => workAppGitHubProjectRepositoryAccessRelations, "workAppGitHubProjectRepositoryAccessRelations"),
|
|
126481
126481
|
workAppGitHubRepositories: /* @__PURE__ */ __name(() => workAppGitHubRepositories, "workAppGitHubRepositories"),
|
|
126482
|
-
workAppGitHubRepositoriesRelations: /* @__PURE__ */ __name(() => workAppGitHubRepositoriesRelations, "workAppGitHubRepositoriesRelations")
|
|
126482
|
+
workAppGitHubRepositoriesRelations: /* @__PURE__ */ __name(() => workAppGitHubRepositoriesRelations, "workAppGitHubRepositoriesRelations"),
|
|
126483
|
+
workAppSlackChannelAgentConfigs: /* @__PURE__ */ __name(() => workAppSlackChannelAgentConfigs, "workAppSlackChannelAgentConfigs"),
|
|
126484
|
+
workAppSlackUserMappings: /* @__PURE__ */ __name(() => workAppSlackUserMappings, "workAppSlackUserMappings"),
|
|
126485
|
+
workAppSlackWorkspaces: /* @__PURE__ */ __name(() => workAppSlackWorkspaces, "workAppSlackWorkspaces")
|
|
126483
126486
|
});
|
|
126484
126487
|
var tenantScoped2 = {
|
|
126485
126488
|
tenantId: varchar("tenant_id", {
|
|
@@ -126664,6 +126667,131 @@ var triggerInvocations = pgTable("trigger_invocations", {
|
|
|
126664
126667
|
index("trigger_invocations_trigger_idx").on(table.triggerId, table.createdAt),
|
|
126665
126668
|
index("trigger_invocations_status_idx").on(table.triggerId, table.status)
|
|
126666
126669
|
]);
|
|
126670
|
+
var workAppSlackWorkspaces = pgTable("work_app_slack_workspaces", {
|
|
126671
|
+
id: varchar("id", {
|
|
126672
|
+
length: 256
|
|
126673
|
+
}).primaryKey(),
|
|
126674
|
+
tenantId: varchar("tenant_id", {
|
|
126675
|
+
length: 256
|
|
126676
|
+
}).notNull().references(() => organization.id, {
|
|
126677
|
+
onDelete: "cascade"
|
|
126678
|
+
}),
|
|
126679
|
+
slackTeamId: varchar("slack_team_id", {
|
|
126680
|
+
length: 256
|
|
126681
|
+
}).notNull(),
|
|
126682
|
+
slackEnterpriseId: varchar("slack_enterprise_id", {
|
|
126683
|
+
length: 256
|
|
126684
|
+
}),
|
|
126685
|
+
slackAppId: varchar("slack_app_id", {
|
|
126686
|
+
length: 256
|
|
126687
|
+
}),
|
|
126688
|
+
slackTeamName: varchar("slack_team_name", {
|
|
126689
|
+
length: 512
|
|
126690
|
+
}),
|
|
126691
|
+
nangoProviderConfigKey: varchar("nango_provider_config_key", {
|
|
126692
|
+
length: 256
|
|
126693
|
+
}).notNull().default("work-apps-slack"),
|
|
126694
|
+
nangoConnectionId: varchar("nango_connection_id", {
|
|
126695
|
+
length: 256
|
|
126696
|
+
}).notNull(),
|
|
126697
|
+
status: varchar("status", {
|
|
126698
|
+
length: 20
|
|
126699
|
+
}).notNull().default("active"),
|
|
126700
|
+
installedByUserId: text("installed_by_user_id").references(() => user.id, {
|
|
126701
|
+
onDelete: "set null"
|
|
126702
|
+
}),
|
|
126703
|
+
...timestamps2
|
|
126704
|
+
}, (table) => [
|
|
126705
|
+
unique("work_app_slack_workspaces_tenant_team_unique").on(table.tenantId, table.slackTeamId),
|
|
126706
|
+
unique("work_app_slack_workspaces_nango_connection_unique").on(table.nangoConnectionId),
|
|
126707
|
+
index("work_app_slack_workspaces_tenant_idx").on(table.tenantId),
|
|
126708
|
+
index("work_app_slack_workspaces_team_idx").on(table.slackTeamId)
|
|
126709
|
+
]);
|
|
126710
|
+
var workAppSlackUserMappings = pgTable("work_app_slack_user_mappings", {
|
|
126711
|
+
id: varchar("id", {
|
|
126712
|
+
length: 256
|
|
126713
|
+
}).primaryKey(),
|
|
126714
|
+
tenantId: varchar("tenant_id", {
|
|
126715
|
+
length: 256
|
|
126716
|
+
}).notNull().references(() => organization.id, {
|
|
126717
|
+
onDelete: "cascade"
|
|
126718
|
+
}),
|
|
126719
|
+
clientId: varchar("client_id", {
|
|
126720
|
+
length: 256
|
|
126721
|
+
}).notNull().default("work-apps-slack"),
|
|
126722
|
+
slackUserId: varchar("slack_user_id", {
|
|
126723
|
+
length: 256
|
|
126724
|
+
}).notNull(),
|
|
126725
|
+
slackTeamId: varchar("slack_team_id", {
|
|
126726
|
+
length: 256
|
|
126727
|
+
}).notNull(),
|
|
126728
|
+
slackEnterpriseId: varchar("slack_enterprise_id", {
|
|
126729
|
+
length: 256
|
|
126730
|
+
}),
|
|
126731
|
+
inkeepUserId: text("inkeep_user_id").notNull().references(() => user.id, {
|
|
126732
|
+
onDelete: "cascade"
|
|
126733
|
+
}),
|
|
126734
|
+
slackUsername: varchar("slack_username", {
|
|
126735
|
+
length: 256
|
|
126736
|
+
}),
|
|
126737
|
+
slackEmail: varchar("slack_email", {
|
|
126738
|
+
length: 256
|
|
126739
|
+
}),
|
|
126740
|
+
linkedAt: timestamp("linked_at", {
|
|
126741
|
+
mode: "string"
|
|
126742
|
+
}).notNull().defaultNow(),
|
|
126743
|
+
lastUsedAt: timestamp("last_used_at", {
|
|
126744
|
+
mode: "string"
|
|
126745
|
+
}),
|
|
126746
|
+
...timestamps2
|
|
126747
|
+
}, (table) => [
|
|
126748
|
+
unique("work_app_slack_user_mappings_unique").on(table.tenantId, table.clientId, table.slackTeamId, table.slackUserId),
|
|
126749
|
+
index("work_app_slack_user_mappings_tenant_idx").on(table.tenantId),
|
|
126750
|
+
index("work_app_slack_user_mappings_user_idx").on(table.inkeepUserId),
|
|
126751
|
+
index("work_app_slack_user_mappings_team_idx").on(table.slackTeamId),
|
|
126752
|
+
index("work_app_slack_user_mappings_slack_user_idx").on(table.slackUserId)
|
|
126753
|
+
]);
|
|
126754
|
+
var workAppSlackChannelAgentConfigs = pgTable("work_app_slack_channel_agent_configs", {
|
|
126755
|
+
id: varchar("id", {
|
|
126756
|
+
length: 256
|
|
126757
|
+
}).primaryKey(),
|
|
126758
|
+
tenantId: varchar("tenant_id", {
|
|
126759
|
+
length: 256
|
|
126760
|
+
}).notNull().references(() => organization.id, {
|
|
126761
|
+
onDelete: "cascade"
|
|
126762
|
+
}),
|
|
126763
|
+
slackTeamId: varchar("slack_team_id", {
|
|
126764
|
+
length: 256
|
|
126765
|
+
}).notNull(),
|
|
126766
|
+
slackChannelId: varchar("slack_channel_id", {
|
|
126767
|
+
length: 256
|
|
126768
|
+
}).notNull(),
|
|
126769
|
+
slackChannelName: varchar("slack_channel_name", {
|
|
126770
|
+
length: 256
|
|
126771
|
+
}),
|
|
126772
|
+
slackChannelType: varchar("slack_channel_type", {
|
|
126773
|
+
length: 50
|
|
126774
|
+
}),
|
|
126775
|
+
projectId: varchar("project_id", {
|
|
126776
|
+
length: 256
|
|
126777
|
+
}).notNull(),
|
|
126778
|
+
agentId: varchar("agent_id", {
|
|
126779
|
+
length: 256
|
|
126780
|
+
}).notNull(),
|
|
126781
|
+
agentName: varchar("agent_name", {
|
|
126782
|
+
length: 256
|
|
126783
|
+
}),
|
|
126784
|
+
configuredByUserId: text("configured_by_user_id").references(() => user.id, {
|
|
126785
|
+
onDelete: "set null"
|
|
126786
|
+
}),
|
|
126787
|
+
enabled: boolean("enabled").notNull().default(true),
|
|
126788
|
+
...timestamps2
|
|
126789
|
+
}, (table) => [
|
|
126790
|
+
unique("work_app_slack_channel_agent_configs_unique").on(table.tenantId, table.slackTeamId, table.slackChannelId),
|
|
126791
|
+
index("work_app_slack_channel_agent_configs_tenant_idx").on(table.tenantId),
|
|
126792
|
+
index("work_app_slack_channel_agent_configs_team_idx").on(table.slackTeamId),
|
|
126793
|
+
index("work_app_slack_channel_agent_configs_channel_idx").on(table.slackChannelId)
|
|
126794
|
+
]);
|
|
126667
126795
|
var messages = pgTable("messages", {
|
|
126668
126796
|
...projectScoped2,
|
|
126669
126797
|
conversationId: varchar("conversation_id", {
|
|
@@ -147518,12 +147646,12 @@ var LoggerFactory = class {
|
|
|
147518
147646
|
if (!logger$12) throw new Error(`Logger '${name18}' not found in cache`);
|
|
147519
147647
|
return logger$12;
|
|
147520
147648
|
}
|
|
147521
|
-
let
|
|
147522
|
-
if (this.config.loggerFactory)
|
|
147523
|
-
else if (this.config.defaultLogger)
|
|
147524
|
-
else
|
|
147525
|
-
this.loggers.set(name18,
|
|
147526
|
-
return
|
|
147649
|
+
let logger27;
|
|
147650
|
+
if (this.config.loggerFactory) logger27 = this.config.loggerFactory(name18);
|
|
147651
|
+
else if (this.config.defaultLogger) logger27 = this.config.defaultLogger;
|
|
147652
|
+
else logger27 = new PinoLogger(name18, this.config.pinoConfig);
|
|
147653
|
+
this.loggers.set(name18, logger27);
|
|
147654
|
+
return logger27;
|
|
147527
147655
|
}
|
|
147528
147656
|
/**
|
|
147529
147657
|
* Reset factory to default state
|
|
@@ -179789,7 +179917,7 @@ var PglitePreparedQuery = class extends PgPreparedQuery {
|
|
|
179789
179917
|
static {
|
|
179790
179918
|
__name(this, "PglitePreparedQuery");
|
|
179791
179919
|
}
|
|
179792
|
-
constructor(client, queryString, params,
|
|
179920
|
+
constructor(client, queryString, params, logger27, cache, queryMetadata, cacheConfig, fields, name18, _isResponseInArrayMode, customResultMapper) {
|
|
179793
179921
|
super({
|
|
179794
179922
|
sql: queryString,
|
|
179795
179923
|
params
|
|
@@ -179797,7 +179925,7 @@ var PglitePreparedQuery = class extends PgPreparedQuery {
|
|
|
179797
179925
|
this.client = client;
|
|
179798
179926
|
this.queryString = queryString;
|
|
179799
179927
|
this.params = params;
|
|
179800
|
-
this.logger =
|
|
179928
|
+
this.logger = logger27;
|
|
179801
179929
|
this.fields = fields;
|
|
179802
179930
|
this._isResponseInArrayMode = _isResponseInArrayMode;
|
|
179803
179931
|
this.customResultMapper = customResultMapper;
|
|
@@ -179950,11 +180078,11 @@ function construct(client, config4 = {}) {
|
|
|
179950
180078
|
const dialect = new PgDialect({
|
|
179951
180079
|
casing: config4.casing
|
|
179952
180080
|
});
|
|
179953
|
-
let
|
|
180081
|
+
let logger27;
|
|
179954
180082
|
if (config4.logger === true) {
|
|
179955
|
-
|
|
180083
|
+
logger27 = new DefaultLogger();
|
|
179956
180084
|
} else if (config4.logger !== false) {
|
|
179957
|
-
|
|
180085
|
+
logger27 = config4.logger;
|
|
179958
180086
|
}
|
|
179959
180087
|
let schema;
|
|
179960
180088
|
if (config4.schema) {
|
|
@@ -179966,7 +180094,7 @@ function construct(client, config4 = {}) {
|
|
|
179966
180094
|
};
|
|
179967
180095
|
}
|
|
179968
180096
|
const driver = new PgliteDriver(client, dialect, {
|
|
179969
|
-
logger:
|
|
180097
|
+
logger: logger27,
|
|
179970
180098
|
cache: config4.cache
|
|
179971
180099
|
});
|
|
179972
180100
|
const session2 = driver.createSession(schema);
|
|
@@ -180035,7 +180163,7 @@ var NodePgPreparedQuery = class extends PgPreparedQuery {
|
|
|
180035
180163
|
static {
|
|
180036
180164
|
__name(this, "NodePgPreparedQuery");
|
|
180037
180165
|
}
|
|
180038
|
-
constructor(client, queryString, params,
|
|
180166
|
+
constructor(client, queryString, params, logger27, cache, queryMetadata, cacheConfig, fields, name18, _isResponseInArrayMode, customResultMapper) {
|
|
180039
180167
|
super({
|
|
180040
180168
|
sql: queryString,
|
|
180041
180169
|
params
|
|
@@ -180043,7 +180171,7 @@ var NodePgPreparedQuery = class extends PgPreparedQuery {
|
|
|
180043
180171
|
this.client = client;
|
|
180044
180172
|
this.queryString = queryString;
|
|
180045
180173
|
this.params = params;
|
|
180046
|
-
this.logger =
|
|
180174
|
+
this.logger = logger27;
|
|
180047
180175
|
this.fields = fields;
|
|
180048
180176
|
this._isResponseInArrayMode = _isResponseInArrayMode;
|
|
180049
180177
|
this.customResultMapper = customResultMapper;
|
|
@@ -180267,11 +180395,11 @@ function construct2(client, config4 = {}) {
|
|
|
180267
180395
|
const dialect = new PgDialect({
|
|
180268
180396
|
casing: config4.casing
|
|
180269
180397
|
});
|
|
180270
|
-
let
|
|
180398
|
+
let logger27;
|
|
180271
180399
|
if (config4.logger === true) {
|
|
180272
|
-
|
|
180400
|
+
logger27 = new DefaultLogger();
|
|
180273
180401
|
} else if (config4.logger !== false) {
|
|
180274
|
-
|
|
180402
|
+
logger27 = config4.logger;
|
|
180275
180403
|
}
|
|
180276
180404
|
let schema;
|
|
180277
180405
|
if (config4.schema) {
|
|
@@ -180283,7 +180411,7 @@ function construct2(client, config4 = {}) {
|
|
|
180283
180411
|
};
|
|
180284
180412
|
}
|
|
180285
180413
|
const driver = new NodePgDriver(client, dialect, {
|
|
180286
|
-
logger:
|
|
180414
|
+
logger: logger27,
|
|
180287
180415
|
cache: config4.cache
|
|
180288
180416
|
});
|
|
180289
180417
|
const session2 = driver.createSession(schema);
|
|
@@ -182428,11 +182556,11 @@ var parseLogLevel = /* @__PURE__ */ __name((maybeLevel, sourceName, client) => {
|
|
|
182428
182556
|
function noop2() {
|
|
182429
182557
|
}
|
|
182430
182558
|
__name(noop2, "noop");
|
|
182431
|
-
function makeLogFn(fnLevel,
|
|
182432
|
-
if (!
|
|
182559
|
+
function makeLogFn(fnLevel, logger27, logLevel) {
|
|
182560
|
+
if (!logger27 || levelNumbers[fnLevel] > levelNumbers[logLevel]) {
|
|
182433
182561
|
return noop2;
|
|
182434
182562
|
} else {
|
|
182435
|
-
return
|
|
182563
|
+
return logger27[fnLevel].bind(logger27);
|
|
182436
182564
|
}
|
|
182437
182565
|
}
|
|
182438
182566
|
__name(makeLogFn, "makeLogFn");
|
|
@@ -182444,22 +182572,22 @@ var noopLogger = {
|
|
|
182444
182572
|
};
|
|
182445
182573
|
var cachedLoggers = /* @__PURE__ */ new WeakMap();
|
|
182446
182574
|
function loggerFor(client) {
|
|
182447
|
-
const
|
|
182575
|
+
const logger27 = client.logger;
|
|
182448
182576
|
const logLevel = client.logLevel ?? "off";
|
|
182449
|
-
if (!
|
|
182577
|
+
if (!logger27) {
|
|
182450
182578
|
return noopLogger;
|
|
182451
182579
|
}
|
|
182452
|
-
const cachedLogger = cachedLoggers.get(
|
|
182580
|
+
const cachedLogger = cachedLoggers.get(logger27);
|
|
182453
182581
|
if (cachedLogger && cachedLogger[0] === logLevel) {
|
|
182454
182582
|
return cachedLogger[1];
|
|
182455
182583
|
}
|
|
182456
182584
|
const levelLogger = {
|
|
182457
|
-
error: makeLogFn("error",
|
|
182458
|
-
warn: makeLogFn("warn",
|
|
182459
|
-
info: makeLogFn("info",
|
|
182460
|
-
debug: makeLogFn("debug",
|
|
182585
|
+
error: makeLogFn("error", logger27, logLevel),
|
|
182586
|
+
warn: makeLogFn("warn", logger27, logLevel),
|
|
182587
|
+
info: makeLogFn("info", logger27, logLevel),
|
|
182588
|
+
debug: makeLogFn("debug", logger27, logLevel)
|
|
182461
182589
|
};
|
|
182462
|
-
cachedLoggers.set(
|
|
182590
|
+
cachedLoggers.set(logger27, [
|
|
182463
182591
|
logLevel,
|
|
182464
182592
|
levelLogger
|
|
182465
182593
|
]);
|
|
@@ -188698,11 +188826,11 @@ var parseLogLevel2 = /* @__PURE__ */ __name((maybeLevel, sourceName, client) =>
|
|
|
188698
188826
|
function noop3() {
|
|
188699
188827
|
}
|
|
188700
188828
|
__name(noop3, "noop");
|
|
188701
|
-
function makeLogFn2(fnLevel,
|
|
188702
|
-
if (!
|
|
188829
|
+
function makeLogFn2(fnLevel, logger27, logLevel) {
|
|
188830
|
+
if (!logger27 || levelNumbers2[fnLevel] > levelNumbers2[logLevel]) {
|
|
188703
188831
|
return noop3;
|
|
188704
188832
|
} else {
|
|
188705
|
-
return
|
|
188833
|
+
return logger27[fnLevel].bind(logger27);
|
|
188706
188834
|
}
|
|
188707
188835
|
}
|
|
188708
188836
|
__name(makeLogFn2, "makeLogFn");
|
|
@@ -188714,22 +188842,22 @@ var noopLogger2 = {
|
|
|
188714
188842
|
};
|
|
188715
188843
|
var cachedLoggers2 = /* @__PURE__ */ new WeakMap();
|
|
188716
188844
|
function loggerFor2(client) {
|
|
188717
|
-
const
|
|
188845
|
+
const logger27 = client.logger;
|
|
188718
188846
|
const logLevel = client.logLevel ?? "off";
|
|
188719
|
-
if (!
|
|
188847
|
+
if (!logger27) {
|
|
188720
188848
|
return noopLogger2;
|
|
188721
188849
|
}
|
|
188722
|
-
const cachedLogger = cachedLoggers2.get(
|
|
188850
|
+
const cachedLogger = cachedLoggers2.get(logger27);
|
|
188723
188851
|
if (cachedLogger && cachedLogger[0] === logLevel) {
|
|
188724
188852
|
return cachedLogger[1];
|
|
188725
188853
|
}
|
|
188726
188854
|
const levelLogger = {
|
|
188727
|
-
error: makeLogFn2("error",
|
|
188728
|
-
warn: makeLogFn2("warn",
|
|
188729
|
-
info: makeLogFn2("info",
|
|
188730
|
-
debug: makeLogFn2("debug",
|
|
188855
|
+
error: makeLogFn2("error", logger27, logLevel),
|
|
188856
|
+
warn: makeLogFn2("warn", logger27, logLevel),
|
|
188857
|
+
info: makeLogFn2("info", logger27, logLevel),
|
|
188858
|
+
debug: makeLogFn2("debug", logger27, logLevel)
|
|
188731
188859
|
};
|
|
188732
|
-
cachedLoggers2.set(
|
|
188860
|
+
cachedLoggers2.set(logger27, [
|
|
188733
188861
|
logLevel,
|
|
188734
188862
|
levelLogger
|
|
188735
188863
|
]);
|
|
@@ -188774,7 +188902,7 @@ var Stream = class _Stream {
|
|
|
188774
188902
|
}
|
|
188775
188903
|
static fromSSEResponse(response, controller, client) {
|
|
188776
188904
|
let consumed = false;
|
|
188777
|
-
const
|
|
188905
|
+
const logger27 = client ? loggerFor2(client) : console;
|
|
188778
188906
|
async function* iterator2() {
|
|
188779
188907
|
if (consumed) {
|
|
188780
188908
|
throw new OpenAIError("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");
|
|
@@ -188793,8 +188921,8 @@ var Stream = class _Stream {
|
|
|
188793
188921
|
try {
|
|
188794
188922
|
data = JSON.parse(sse.data);
|
|
188795
188923
|
} catch (e) {
|
|
188796
|
-
|
|
188797
|
-
|
|
188924
|
+
logger27.error(`Could not parse message into JSON:`, sse.data);
|
|
188925
|
+
logger27.error(`From chunk:`, sse.raw);
|
|
188798
188926
|
throw e;
|
|
188799
188927
|
}
|
|
188800
188928
|
if (data && data.error) {
|
|
@@ -201529,12 +201657,12 @@ var logWarnings = /* @__PURE__ */ __name((options) => {
|
|
|
201529
201657
|
if (options.warnings.length === 0) {
|
|
201530
201658
|
return;
|
|
201531
201659
|
}
|
|
201532
|
-
const
|
|
201533
|
-
if (
|
|
201660
|
+
const logger27 = globalThis.AI_SDK_LOG_WARNINGS;
|
|
201661
|
+
if (logger27 === false) {
|
|
201534
201662
|
return;
|
|
201535
201663
|
}
|
|
201536
|
-
if (typeof
|
|
201537
|
-
|
|
201664
|
+
if (typeof logger27 === "function") {
|
|
201665
|
+
logger27(options);
|
|
201538
201666
|
return;
|
|
201539
201667
|
}
|
|
201540
201668
|
if (!hasLoggedBefore) {
|
|
@@ -228199,11 +228327,116 @@ var ModelFactory = class ModelFactory2 {
|
|
|
228199
228327
|
// ../packages/agents-core/dist/utils/service-token-auth.js
|
|
228200
228328
|
var logger16 = getLogger("service-token-auth");
|
|
228201
228329
|
|
|
228330
|
+
// ../packages/agents-core/dist/utils/slack-link-token.js
|
|
228331
|
+
var logger17 = getLogger("slack-link-token");
|
|
228332
|
+
var ISSUER = "inkeep-auth";
|
|
228333
|
+
var AUDIENCE = "slack-link";
|
|
228334
|
+
var TOKEN_USE = "slackLinkCode";
|
|
228335
|
+
var SlackLinkTokenPayloadSchema = external_exports.object({
|
|
228336
|
+
iss: external_exports.literal(ISSUER),
|
|
228337
|
+
aud: external_exports.literal(AUDIENCE),
|
|
228338
|
+
sub: external_exports.string().min(1),
|
|
228339
|
+
iat: external_exports.number(),
|
|
228340
|
+
exp: external_exports.number(),
|
|
228341
|
+
jti: external_exports.string().optional(),
|
|
228342
|
+
tokenUse: external_exports.literal(TOKEN_USE),
|
|
228343
|
+
tenantId: external_exports.string().min(1),
|
|
228344
|
+
slack: external_exports.object({
|
|
228345
|
+
teamId: external_exports.string().min(1),
|
|
228346
|
+
userId: external_exports.string().min(1),
|
|
228347
|
+
enterpriseId: external_exports.string().min(1).optional(),
|
|
228348
|
+
username: external_exports.string().optional()
|
|
228349
|
+
})
|
|
228350
|
+
});
|
|
228351
|
+
|
|
228352
|
+
// ../packages/agents-core/dist/utils/slack-user-token.js
|
|
228353
|
+
var logger18 = getLogger("slack-user-token");
|
|
228354
|
+
var ISSUER2 = "inkeep-auth";
|
|
228355
|
+
var AUDIENCE2 = "inkeep-api";
|
|
228356
|
+
var TOKEN_USE2 = "slackUser";
|
|
228357
|
+
var ACTOR_SUB = "inkeep-work-app-slack";
|
|
228358
|
+
var SlackAccessTokenPayloadSchema = external_exports.object({
|
|
228359
|
+
iss: external_exports.literal(ISSUER2),
|
|
228360
|
+
aud: external_exports.literal(AUDIENCE2),
|
|
228361
|
+
sub: external_exports.string().min(1),
|
|
228362
|
+
iat: external_exports.number(),
|
|
228363
|
+
exp: external_exports.number(),
|
|
228364
|
+
jti: external_exports.string().optional(),
|
|
228365
|
+
tokenUse: external_exports.literal(TOKEN_USE2),
|
|
228366
|
+
act: external_exports.object({
|
|
228367
|
+
sub: external_exports.literal(ACTOR_SUB)
|
|
228368
|
+
}),
|
|
228369
|
+
tenantId: external_exports.string().min(1),
|
|
228370
|
+
slack: external_exports.object({
|
|
228371
|
+
teamId: external_exports.string().min(1),
|
|
228372
|
+
userId: external_exports.string().min(1),
|
|
228373
|
+
enterpriseId: external_exports.string().min(1).optional(),
|
|
228374
|
+
email: external_exports.string().email().optional()
|
|
228375
|
+
})
|
|
228376
|
+
});
|
|
228377
|
+
|
|
228378
|
+
// ../packages/agents-core/dist/utils/sse-parser.js
|
|
228379
|
+
function parseSSEResponse(sseText) {
|
|
228380
|
+
let textContent = "";
|
|
228381
|
+
let hasError = false;
|
|
228382
|
+
let errorMessage = "";
|
|
228383
|
+
const lines = sseText.split("\n").filter((line2) => line2.startsWith("data: "));
|
|
228384
|
+
for (const line2 of lines) {
|
|
228385
|
+
const jsonStr = line2.slice(6).trim();
|
|
228386
|
+
if (!jsonStr || jsonStr === "[DONE]") continue;
|
|
228387
|
+
try {
|
|
228388
|
+
const data = JSON.parse(jsonStr);
|
|
228389
|
+
if (data.object === "chat.completion.chunk" && data.choices?.[0]?.delta) {
|
|
228390
|
+
const delta = data.choices[0].delta;
|
|
228391
|
+
if (delta.content && typeof delta.content === "string") try {
|
|
228392
|
+
const parsedContent = JSON.parse(delta.content);
|
|
228393
|
+
if (parsedContent.type === "data-operation") {
|
|
228394
|
+
if (parsedContent.data?.type === "error") {
|
|
228395
|
+
hasError = true;
|
|
228396
|
+
errorMessage = parsedContent.data.message || "Unknown error occurred";
|
|
228397
|
+
}
|
|
228398
|
+
continue;
|
|
228399
|
+
}
|
|
228400
|
+
textContent += delta.content;
|
|
228401
|
+
} catch {
|
|
228402
|
+
textContent += delta.content;
|
|
228403
|
+
}
|
|
228404
|
+
continue;
|
|
228405
|
+
}
|
|
228406
|
+
if (data.type === "text-delta" && data.delta) {
|
|
228407
|
+
textContent += data.delta;
|
|
228408
|
+
continue;
|
|
228409
|
+
}
|
|
228410
|
+
if (data.type === "text-start" || data.type === "text-end") continue;
|
|
228411
|
+
if (data.type === "data-operation") {
|
|
228412
|
+
if (data.data?.type === "error") {
|
|
228413
|
+
hasError = true;
|
|
228414
|
+
errorMessage = data.data.message || "Unknown error occurred";
|
|
228415
|
+
}
|
|
228416
|
+
continue;
|
|
228417
|
+
}
|
|
228418
|
+
if (data.type === "error") {
|
|
228419
|
+
hasError = true;
|
|
228420
|
+
errorMessage = data.message || "Unknown error occurred";
|
|
228421
|
+
}
|
|
228422
|
+
} catch {
|
|
228423
|
+
}
|
|
228424
|
+
}
|
|
228425
|
+
if (hasError) return {
|
|
228426
|
+
text: textContent.trim(),
|
|
228427
|
+
error: errorMessage
|
|
228428
|
+
};
|
|
228429
|
+
return {
|
|
228430
|
+
text: textContent.trim()
|
|
228431
|
+
};
|
|
228432
|
+
}
|
|
228433
|
+
__name(parseSSEResponse, "parseSSEResponse");
|
|
228434
|
+
|
|
228202
228435
|
// ../packages/agents-core/dist/utils/third-party-mcp-servers/composio-client.js
|
|
228203
228436
|
var logger$1 = getLogger("composio-client");
|
|
228204
228437
|
|
|
228205
228438
|
// ../packages/agents-core/dist/utils/third-party-mcp-servers/third-party-check.js
|
|
228206
|
-
var
|
|
228439
|
+
var logger19 = getLogger("third-party-check");
|
|
228207
228440
|
|
|
228208
228441
|
// ../packages/agents-core/dist/utils/trigger-auth.js
|
|
228209
228442
|
var import_node_crypto7 = require("node:crypto");
|
|
@@ -228211,10 +228444,10 @@ var import_node_util3 = require("node:util");
|
|
|
228211
228444
|
var scryptAsync2 = (0, import_node_util3.promisify)(import_node_crypto7.scrypt);
|
|
228212
228445
|
|
|
228213
228446
|
// ../packages/agents-core/dist/utils/tracer-factory.js
|
|
228214
|
-
var
|
|
228447
|
+
var logger20 = getLogger("tracer");
|
|
228215
228448
|
|
|
228216
228449
|
// ../packages/agents-core/dist/data-access/manage/tools.js
|
|
228217
|
-
var
|
|
228450
|
+
var logger21 = getLogger("tools");
|
|
228218
228451
|
var listTools = /* @__PURE__ */ __name((db) => async (params) => {
|
|
228219
228452
|
const page = params.pagination?.page || 1;
|
|
228220
228453
|
const limit3 = Math.min(params.pagination?.limit || 10, 100);
|
|
@@ -228692,10 +228925,10 @@ var defaultLogger = {
|
|
|
228692
228925
|
error: /* @__PURE__ */ __name(() => {
|
|
228693
228926
|
}, "error")
|
|
228694
228927
|
};
|
|
228695
|
-
var getFullAgent = /* @__PURE__ */ __name((db,
|
|
228928
|
+
var getFullAgent = /* @__PURE__ */ __name((db, logger27 = defaultLogger) => async (params) => {
|
|
228696
228929
|
const { scopes } = params;
|
|
228697
228930
|
const { tenantId, projectId } = scopes;
|
|
228698
|
-
|
|
228931
|
+
logger27.info({
|
|
228699
228932
|
tenantId,
|
|
228700
228933
|
agentId: scopes.agentId
|
|
228701
228934
|
}, "Retrieving full agent definition");
|
|
@@ -228708,20 +228941,20 @@ var getFullAgent = /* @__PURE__ */ __name((db, logger25 = defaultLogger) => asyn
|
|
|
228708
228941
|
}
|
|
228709
228942
|
});
|
|
228710
228943
|
if (!agent) {
|
|
228711
|
-
|
|
228944
|
+
logger27.info({
|
|
228712
228945
|
tenantId,
|
|
228713
228946
|
agentId: scopes.agentId
|
|
228714
228947
|
}, "Agent not found");
|
|
228715
228948
|
return null;
|
|
228716
228949
|
}
|
|
228717
|
-
|
|
228950
|
+
logger27.info({
|
|
228718
228951
|
tenantId,
|
|
228719
228952
|
agentId: scopes.agentId,
|
|
228720
228953
|
agentCount: Object.keys(agent.subAgents).length
|
|
228721
228954
|
}, "Full agent retrieved successfully");
|
|
228722
228955
|
return agent;
|
|
228723
228956
|
} catch (error92) {
|
|
228724
|
-
|
|
228957
|
+
logger27.error({
|
|
228725
228958
|
tenantId,
|
|
228726
228959
|
agentId: scopes.agentId,
|
|
228727
228960
|
error: error92 instanceof Error ? error92.message : "Unknown error"
|
|
@@ -228887,11 +229120,11 @@ var filterConversationsForJob = /* @__PURE__ */ __name((db) => async (params) =>
|
|
|
228887
229120
|
loadEnvironmentFiles();
|
|
228888
229121
|
|
|
228889
229122
|
// ../packages/agents-core/dist/dolt/ref-middleware.js
|
|
228890
|
-
var
|
|
229123
|
+
var logger22 = getLogger("ref-middleware");
|
|
228891
229124
|
|
|
228892
229125
|
// ../packages/agents-core/dist/dolt/ref-scope.js
|
|
228893
229126
|
var import_node_async_hooks2 = require("node:async_hooks");
|
|
228894
|
-
var
|
|
229127
|
+
var logger23 = getLogger("ref-scope");
|
|
228895
229128
|
var refScopeStorage = new import_node_async_hooks2.AsyncLocalStorage();
|
|
228896
229129
|
var NestedRefScopeError = class extends Error {
|
|
228897
229130
|
static {
|
|
@@ -228909,7 +229142,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228909
229142
|
const existingScope = refScopeStorage.getStore();
|
|
228910
229143
|
if (existingScope) {
|
|
228911
229144
|
if (existingScope.ref === resolvedRef.name) {
|
|
228912
|
-
|
|
229145
|
+
logger23.debug({
|
|
228913
229146
|
ref: resolvedRef.name,
|
|
228914
229147
|
existingConnectionId: existingScope.connectionId
|
|
228915
229148
|
}, "Reusing existing ref scope");
|
|
@@ -228932,7 +229165,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228932
229165
|
connection$1.release();
|
|
228933
229166
|
}
|
|
228934
229167
|
}
|
|
228935
|
-
|
|
229168
|
+
logger23.debug({
|
|
228936
229169
|
ref: resolvedRef.name,
|
|
228937
229170
|
refType: resolvedRef.type,
|
|
228938
229171
|
connectionId
|
|
@@ -228944,7 +229177,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228944
229177
|
schema: manage_schema_exports
|
|
228945
229178
|
});
|
|
228946
229179
|
if (resolvedRef.type === "branch") {
|
|
228947
|
-
|
|
229180
|
+
logger23.debug({
|
|
228948
229181
|
branch: resolvedRef.name,
|
|
228949
229182
|
connectionId
|
|
228950
229183
|
}, "Checking out branch");
|
|
@@ -228954,7 +229187,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228954
229187
|
});
|
|
228955
229188
|
} else {
|
|
228956
229189
|
tempBranch = `temp_${resolvedRef.type}_${Date.now()}_${generateId()}`;
|
|
228957
|
-
|
|
229190
|
+
logger23.debug({
|
|
228958
229191
|
tempBranch,
|
|
228959
229192
|
hash: resolvedRef.hash,
|
|
228960
229193
|
refType: resolvedRef.type,
|
|
@@ -228972,7 +229205,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228972
229205
|
}, () => dataAccessFn(db));
|
|
228973
229206
|
if (commit && resolvedRef.type === "branch") try {
|
|
228974
229207
|
if ((await doltStatus(db)()).length > 0) {
|
|
228975
|
-
|
|
229208
|
+
logger23.info({
|
|
228976
229209
|
branch: resolvedRef.name,
|
|
228977
229210
|
message: commitMessage,
|
|
228978
229211
|
connectionId
|
|
@@ -228984,19 +229217,19 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228984
229217
|
email: "api@inkeep.com"
|
|
228985
229218
|
}
|
|
228986
229219
|
});
|
|
228987
|
-
|
|
229220
|
+
logger23.info({
|
|
228988
229221
|
branch: resolvedRef.name,
|
|
228989
229222
|
connectionId
|
|
228990
229223
|
}, "Successfully committed changes");
|
|
228991
229224
|
}
|
|
228992
229225
|
} catch (commitError) {
|
|
228993
|
-
|
|
229226
|
+
logger23.error({
|
|
228994
229227
|
error: commitError,
|
|
228995
229228
|
branch: resolvedRef.name,
|
|
228996
229229
|
connectionId
|
|
228997
229230
|
}, "Failed to auto-commit changes");
|
|
228998
229231
|
}
|
|
228999
|
-
|
|
229232
|
+
logger23.debug({
|
|
229000
229233
|
ref: resolvedRef.name,
|
|
229001
229234
|
duration: Date.now() - startTime,
|
|
229002
229235
|
connectionId
|
|
@@ -229009,19 +229242,19 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
229009
229242
|
});
|
|
229010
229243
|
if ((await doltStatus(db)()).length > 0) {
|
|
229011
229244
|
await doltReset(db)();
|
|
229012
|
-
|
|
229245
|
+
logger23.info({
|
|
229013
229246
|
branch: resolvedRef.name,
|
|
229014
229247
|
connectionId
|
|
229015
229248
|
}, "Reset uncommitted changes due to failed operation");
|
|
229016
229249
|
}
|
|
229017
229250
|
} catch (resetError) {
|
|
229018
|
-
|
|
229251
|
+
logger23.error({
|
|
229019
229252
|
error: resetError,
|
|
229020
229253
|
branch: resolvedRef.name,
|
|
229021
229254
|
connectionId
|
|
229022
229255
|
}, "Failed to reset changes after error");
|
|
229023
229256
|
}
|
|
229024
|
-
|
|
229257
|
+
logger23.error({
|
|
229025
229258
|
ref: resolvedRef.name,
|
|
229026
229259
|
duration: Date.now() - startTime,
|
|
229027
229260
|
connectionId,
|
|
@@ -229032,7 +229265,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
229032
229265
|
try {
|
|
229033
229266
|
await connection.query(`SELECT DOLT_CHECKOUT('main')`);
|
|
229034
229267
|
if (tempBranch) {
|
|
229035
|
-
|
|
229268
|
+
logger23.debug({
|
|
229036
229269
|
tempBranch,
|
|
229037
229270
|
connectionId
|
|
229038
229271
|
}, "Deleting temporary branch");
|
|
@@ -229041,14 +229274,14 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
229041
229274
|
]);
|
|
229042
229275
|
}
|
|
229043
229276
|
} catch (cleanupError) {
|
|
229044
|
-
|
|
229277
|
+
logger23.error({
|
|
229045
229278
|
error: cleanupError,
|
|
229046
229279
|
tempBranch,
|
|
229047
229280
|
connectionId
|
|
229048
229281
|
}, "Error during ref scope cleanup");
|
|
229049
229282
|
} finally {
|
|
229050
229283
|
connection.release();
|
|
229051
|
-
|
|
229284
|
+
logger23.debug({
|
|
229052
229285
|
ref: resolvedRef.name,
|
|
229053
229286
|
duration: Date.now() - startTime,
|
|
229054
229287
|
connectionId
|
|
@@ -229164,7 +229397,7 @@ var runDbClient = createAgentsRunDatabaseClient({
|
|
|
229164
229397
|
var runDbClient_default = runDbClient;
|
|
229165
229398
|
|
|
229166
229399
|
// src/domains/evals/services/EvaluationService.ts
|
|
229167
|
-
var
|
|
229400
|
+
var logger24 = getLogger("EvaluationService");
|
|
229168
229401
|
var EvaluationService = class {
|
|
229169
229402
|
static {
|
|
229170
229403
|
__name(this, "EvaluationService");
|
|
@@ -229214,7 +229447,7 @@ var EvaluationService = class {
|
|
|
229214
229447
|
messages: initialMessages
|
|
229215
229448
|
});
|
|
229216
229449
|
} catch (error92) {
|
|
229217
|
-
|
|
229450
|
+
logger24.error({
|
|
229218
229451
|
error: error92 instanceof Error ? error92.message : String(error92),
|
|
229219
229452
|
datasetItemId: datasetItem2.id
|
|
229220
229453
|
}, "Error running dataset item through chat API");
|
|
@@ -229249,7 +229482,7 @@ var EvaluationService = class {
|
|
|
229249
229482
|
"x-inkeep-dataset-run-id": datasetRunId
|
|
229250
229483
|
}
|
|
229251
229484
|
};
|
|
229252
|
-
|
|
229485
|
+
logger24.info({
|
|
229253
229486
|
tenantId,
|
|
229254
229487
|
projectId,
|
|
229255
229488
|
agentId,
|
|
@@ -229264,7 +229497,7 @@ var EvaluationService = class {
|
|
|
229264
229497
|
});
|
|
229265
229498
|
if (!response.ok) {
|
|
229266
229499
|
const errorText = await response.text();
|
|
229267
|
-
|
|
229500
|
+
logger24.error({
|
|
229268
229501
|
status: response.status,
|
|
229269
229502
|
statusText: response.statusText,
|
|
229270
229503
|
errorText,
|
|
@@ -229277,9 +229510,9 @@ var EvaluationService = class {
|
|
|
229277
229510
|
};
|
|
229278
229511
|
}
|
|
229279
229512
|
const responseText = await response.text();
|
|
229280
|
-
const parseResult =
|
|
229513
|
+
const parseResult = parseSSEResponse(responseText);
|
|
229281
229514
|
if (parseResult.error) {
|
|
229282
|
-
|
|
229515
|
+
logger24.error({
|
|
229283
229516
|
datasetItemId: datasetItem2.id,
|
|
229284
229517
|
conversationId,
|
|
229285
229518
|
errorMessage: parseResult.error
|
|
@@ -229289,7 +229522,7 @@ var EvaluationService = class {
|
|
|
229289
229522
|
error: parseResult.error
|
|
229290
229523
|
};
|
|
229291
229524
|
}
|
|
229292
|
-
|
|
229525
|
+
logger24.info({
|
|
229293
229526
|
datasetItemId: datasetItem2.id,
|
|
229294
229527
|
conversationId,
|
|
229295
229528
|
responseLength: parseResult.text?.length || 0
|
|
@@ -229304,7 +229537,7 @@ var EvaluationService = class {
|
|
|
229304
229537
|
*/
|
|
229305
229538
|
async runDatasetItemWithSimulation(params) {
|
|
229306
229539
|
const { tenantId, projectId, agentId, datasetItem: datasetItem2, datasetRunId, conversationId, apiKey, initialMessages, simulationAgent } = params;
|
|
229307
|
-
|
|
229540
|
+
logger24.info({
|
|
229308
229541
|
tenantId,
|
|
229309
229542
|
projectId,
|
|
229310
229543
|
agentId,
|
|
@@ -229344,7 +229577,7 @@ var EvaluationService = class {
|
|
|
229344
229577
|
while (stepCount < maxSteps) {
|
|
229345
229578
|
try {
|
|
229346
229579
|
const simulationPrompt = this.buildSimulationPrompt(simulationAgent.prompt, conversationHistory);
|
|
229347
|
-
|
|
229580
|
+
logger24.debug({
|
|
229348
229581
|
stepCount,
|
|
229349
229582
|
maxSteps,
|
|
229350
229583
|
conversationHistoryLength: conversationHistory.length
|
|
@@ -229355,7 +229588,7 @@ var EvaluationService = class {
|
|
|
229355
229588
|
});
|
|
229356
229589
|
const nextUserMessage = simulationResponse.text.trim();
|
|
229357
229590
|
if (!nextUserMessage) {
|
|
229358
|
-
|
|
229591
|
+
logger24.warn({
|
|
229359
229592
|
stepCount,
|
|
229360
229593
|
datasetItemId: datasetItem2.id
|
|
229361
229594
|
}, "Simulation agent returned empty message, stopping conversation");
|
|
@@ -229381,7 +229614,7 @@ var EvaluationService = class {
|
|
|
229381
229614
|
]
|
|
229382
229615
|
});
|
|
229383
229616
|
if (agentResponse.error || !agentResponse.response) {
|
|
229384
|
-
|
|
229617
|
+
logger24.warn({
|
|
229385
229618
|
stepCount,
|
|
229386
229619
|
error: agentResponse.error,
|
|
229387
229620
|
datasetItemId: datasetItem2.id
|
|
@@ -229394,7 +229627,7 @@ var EvaluationService = class {
|
|
|
229394
229627
|
});
|
|
229395
229628
|
stepCount++;
|
|
229396
229629
|
} catch (error92) {
|
|
229397
|
-
|
|
229630
|
+
logger24.error({
|
|
229398
229631
|
error: error92 instanceof Error ? error92.message : String(error92),
|
|
229399
229632
|
stepCount,
|
|
229400
229633
|
datasetItemId: datasetItem2.id
|
|
@@ -229402,7 +229635,7 @@ var EvaluationService = class {
|
|
|
229402
229635
|
break;
|
|
229403
229636
|
}
|
|
229404
229637
|
}
|
|
229405
|
-
|
|
229638
|
+
logger24.info({
|
|
229406
229639
|
datasetItemId: datasetItem2.id,
|
|
229407
229640
|
conversationId,
|
|
229408
229641
|
finalStepCount: stepCount,
|
|
@@ -229456,7 +229689,7 @@ Generate the next user message:`;
|
|
|
229456
229689
|
const validMessages = input.messages.map((msg) => {
|
|
229457
229690
|
const mappedRole = roleMap[msg.role.toLowerCase()];
|
|
229458
229691
|
if (!mappedRole) {
|
|
229459
|
-
|
|
229692
|
+
logger24.warn({
|
|
229460
229693
|
datasetItemId: datasetItem2.id,
|
|
229461
229694
|
invalidRole: msg.role
|
|
229462
229695
|
}, "Invalid message role found, skipping message");
|
|
@@ -229468,7 +229701,7 @@ Generate the next user message:`;
|
|
|
229468
229701
|
};
|
|
229469
229702
|
}).filter((msg) => msg !== null);
|
|
229470
229703
|
if (validMessages.length === 0) {
|
|
229471
|
-
|
|
229704
|
+
logger24.warn({
|
|
229472
229705
|
datasetItemId: datasetItem2.id,
|
|
229473
229706
|
totalMessages: input.messages.length
|
|
229474
229707
|
}, "No valid messages found after filtering roles");
|
|
@@ -229483,7 +229716,7 @@ Generate the next user message:`;
|
|
|
229483
229716
|
const validMessages = parsed.messages.map((msg) => {
|
|
229484
229717
|
const mappedRole = roleMap[msg.role?.toLowerCase()];
|
|
229485
229718
|
if (!mappedRole) {
|
|
229486
|
-
|
|
229719
|
+
logger24.warn({
|
|
229487
229720
|
datasetItemId: datasetItem2.id,
|
|
229488
229721
|
invalidRole: msg.role
|
|
229489
229722
|
}, "Invalid message role found in parsed input, skipping message");
|
|
@@ -229508,69 +229741,6 @@ Generate the next user message:`;
|
|
|
229508
229741
|
return null;
|
|
229509
229742
|
}
|
|
229510
229743
|
/**
|
|
229511
|
-
* Parse SSE (Server-Sent Events) response from chat API
|
|
229512
|
-
* Handles text deltas, error operations, and other data operations
|
|
229513
|
-
*/
|
|
229514
|
-
parseSSEResponse(sseText) {
|
|
229515
|
-
let textContent = "";
|
|
229516
|
-
let hasError = false;
|
|
229517
|
-
let errorMessage = "";
|
|
229518
|
-
const lines = sseText.split("\n").filter((line2) => line2.startsWith("data: "));
|
|
229519
|
-
for (const line2 of lines) {
|
|
229520
|
-
try {
|
|
229521
|
-
const data = JSON.parse(line2.slice(6));
|
|
229522
|
-
if (data.object === "chat.completion.chunk" && data.choices?.[0]?.delta) {
|
|
229523
|
-
const delta = data.choices[0].delta;
|
|
229524
|
-
if (delta.content) {
|
|
229525
|
-
textContent += delta.content;
|
|
229526
|
-
}
|
|
229527
|
-
if (delta.content && typeof delta.content === "string") {
|
|
229528
|
-
try {
|
|
229529
|
-
const parsedContent = JSON.parse(delta.content);
|
|
229530
|
-
if (parsedContent.type === "data-operation" && parsedContent.data?.type === "error") {
|
|
229531
|
-
hasError = true;
|
|
229532
|
-
errorMessage = parsedContent.data.message || "Unknown error occurred";
|
|
229533
|
-
logger22.warn({
|
|
229534
|
-
errorMessage,
|
|
229535
|
-
errorData: parsedContent.data
|
|
229536
|
-
}, "Received error operation from chat API");
|
|
229537
|
-
}
|
|
229538
|
-
} catch {
|
|
229539
|
-
}
|
|
229540
|
-
}
|
|
229541
|
-
} else if (data.type === "text-delta" && data.delta) {
|
|
229542
|
-
textContent += data.delta;
|
|
229543
|
-
} else if (data.type === "data-operation" && data.data?.type === "error") {
|
|
229544
|
-
hasError = true;
|
|
229545
|
-
errorMessage = data.data.message || "Unknown error occurred";
|
|
229546
|
-
logger22.warn({
|
|
229547
|
-
errorMessage,
|
|
229548
|
-
errorData: data.data
|
|
229549
|
-
}, "Received error operation from chat API");
|
|
229550
|
-
} else if (data.type === "error") {
|
|
229551
|
-
hasError = true;
|
|
229552
|
-
errorMessage = data.message || "Unknown error occurred";
|
|
229553
|
-
logger22.warn({
|
|
229554
|
-
errorMessage,
|
|
229555
|
-
errorData: data
|
|
229556
|
-
}, "Received error event from chat API");
|
|
229557
|
-
} else if (data.content) {
|
|
229558
|
-
textContent += typeof data.content === "string" ? data.content : JSON.stringify(data.content);
|
|
229559
|
-
}
|
|
229560
|
-
} catch {
|
|
229561
|
-
}
|
|
229562
|
-
}
|
|
229563
|
-
if (hasError) {
|
|
229564
|
-
return {
|
|
229565
|
-
text: textContent.trim(),
|
|
229566
|
-
error: errorMessage
|
|
229567
|
-
};
|
|
229568
|
-
}
|
|
229569
|
-
return {
|
|
229570
|
-
text: textContent.trim()
|
|
229571
|
-
};
|
|
229572
|
-
}
|
|
229573
|
-
/**
|
|
229574
229744
|
* Run an evaluation job based on an evaluation job config
|
|
229575
229745
|
* Filters conversations based on jobFilters and runs evaluations with configured evaluators
|
|
229576
229746
|
*/
|
|
@@ -229581,7 +229751,7 @@ Generate the next user message:`;
|
|
|
229581
229751
|
if (!resolvedRef) {
|
|
229582
229752
|
throw new Error("Failed to resolve ref");
|
|
229583
229753
|
}
|
|
229584
|
-
|
|
229754
|
+
logger24.info({
|
|
229585
229755
|
tenantId,
|
|
229586
229756
|
projectId,
|
|
229587
229757
|
evaluationJobConfigId,
|
|
@@ -229618,7 +229788,7 @@ Generate the next user message:`;
|
|
|
229618
229788
|
if (validEvaluators.length === 0) {
|
|
229619
229789
|
throw new Error(`No valid evaluators found for job config: ${evaluationJobConfigId}`);
|
|
229620
229790
|
}
|
|
229621
|
-
|
|
229791
|
+
logger24.info({
|
|
229622
229792
|
tenantId,
|
|
229623
229793
|
projectId,
|
|
229624
229794
|
evaluationJobConfigId,
|
|
@@ -229634,7 +229804,7 @@ Generate the next user message:`;
|
|
|
229634
229804
|
if (sampleRate !== void 0 && sampleRate !== null) {
|
|
229635
229805
|
const originalCount = conversationsToEvaluate.length;
|
|
229636
229806
|
conversationsToEvaluate = this.applySampleRate(conversationsToEvaluate, sampleRate);
|
|
229637
|
-
|
|
229807
|
+
logger24.info({
|
|
229638
229808
|
tenantId,
|
|
229639
229809
|
projectId,
|
|
229640
229810
|
evaluationJobConfigId,
|
|
@@ -229643,14 +229813,14 @@ Generate the next user message:`;
|
|
|
229643
229813
|
sampleRate
|
|
229644
229814
|
}, "Applied sample rate to conversations");
|
|
229645
229815
|
}
|
|
229646
|
-
|
|
229816
|
+
logger24.info({
|
|
229647
229817
|
tenantId,
|
|
229648
229818
|
projectId,
|
|
229649
229819
|
evaluationJobConfigId,
|
|
229650
229820
|
conversationCount: conversationsToEvaluate.length
|
|
229651
229821
|
}, "Found conversations for evaluation");
|
|
229652
229822
|
if (conversationsToEvaluate.length === 0) {
|
|
229653
|
-
|
|
229823
|
+
logger24.warn({
|
|
229654
229824
|
tenantId,
|
|
229655
229825
|
projectId,
|
|
229656
229826
|
evaluationJobConfigId
|
|
@@ -229667,7 +229837,7 @@ Generate the next user message:`;
|
|
|
229667
229837
|
for (const conversation of conversationsToEvaluate) {
|
|
229668
229838
|
for (const evaluator2 of validEvaluators) {
|
|
229669
229839
|
try {
|
|
229670
|
-
|
|
229840
|
+
logger24.info({
|
|
229671
229841
|
tenantId,
|
|
229672
229842
|
conversationId: conversation.id,
|
|
229673
229843
|
evaluatorId: evaluator2.id
|
|
@@ -229700,14 +229870,14 @@ Generate the next user message:`;
|
|
|
229700
229870
|
if (updatedResult) {
|
|
229701
229871
|
results.push(updatedResult);
|
|
229702
229872
|
}
|
|
229703
|
-
|
|
229873
|
+
logger24.info({
|
|
229704
229874
|
tenantId,
|
|
229705
229875
|
conversationId: conversation.id,
|
|
229706
229876
|
evaluatorId: evaluator2.id,
|
|
229707
229877
|
resultId: evalResult.id
|
|
229708
229878
|
}, "Evaluation completed successfully");
|
|
229709
229879
|
} catch (error92) {
|
|
229710
|
-
|
|
229880
|
+
logger24.error({
|
|
229711
229881
|
error: error92,
|
|
229712
229882
|
tenantId,
|
|
229713
229883
|
conversationId: conversation.id,
|
|
@@ -229732,7 +229902,7 @@ Generate the next user message:`;
|
|
|
229732
229902
|
}
|
|
229733
229903
|
}
|
|
229734
229904
|
} catch (error92) {
|
|
229735
|
-
|
|
229905
|
+
logger24.error({
|
|
229736
229906
|
error: error92 instanceof Error ? error92.message : String(error92),
|
|
229737
229907
|
tenantId,
|
|
229738
229908
|
conversationId: conversation.id,
|
|
@@ -229741,7 +229911,7 @@ Generate the next user message:`;
|
|
|
229741
229911
|
}
|
|
229742
229912
|
}
|
|
229743
229913
|
}
|
|
229744
|
-
|
|
229914
|
+
logger24.info({
|
|
229745
229915
|
tenantId,
|
|
229746
229916
|
projectId,
|
|
229747
229917
|
evaluationJobConfigId,
|
|
@@ -229811,20 +229981,20 @@ Generate the next user message:`;
|
|
|
229811
229981
|
}
|
|
229812
229982
|
}));
|
|
229813
229983
|
} else {
|
|
229814
|
-
|
|
229984
|
+
logger24.warn({
|
|
229815
229985
|
conversationId: conversation.id,
|
|
229816
229986
|
agentId: conversation.agentId
|
|
229817
229987
|
}, "AgentId not found, cannot get agent definition");
|
|
229818
229988
|
}
|
|
229819
229989
|
} catch (error92) {
|
|
229820
|
-
|
|
229990
|
+
logger24.warn({
|
|
229821
229991
|
error: error92,
|
|
229822
229992
|
conversationId: conversation.id,
|
|
229823
229993
|
agentId: conversation.agentId
|
|
229824
229994
|
}, "Failed to fetch agent definition for evaluation");
|
|
229825
229995
|
}
|
|
229826
229996
|
const prettifiedTrace = await this.fetchTraceFromSigNoz(conversation.id);
|
|
229827
|
-
|
|
229997
|
+
logger24.info({
|
|
229828
229998
|
conversationId: conversation.id,
|
|
229829
229999
|
hasTrace: !!prettifiedTrace,
|
|
229830
230000
|
traceActivityCount: prettifiedTrace?.timeline?.length || 0
|
|
@@ -229838,7 +230008,7 @@ Generate the next user message:`;
|
|
|
229838
230008
|
try {
|
|
229839
230009
|
schemaObj = JSON.parse(evaluator2.schema);
|
|
229840
230010
|
} catch (error92) {
|
|
229841
|
-
|
|
230011
|
+
logger24.error({
|
|
229842
230012
|
error: error92,
|
|
229843
230013
|
schemaString: evaluator2.schema
|
|
229844
230014
|
}, "Failed to parse evaluator schema string");
|
|
@@ -229847,7 +230017,7 @@ Generate the next user message:`;
|
|
|
229847
230017
|
} else {
|
|
229848
230018
|
schemaObj = evaluator2.schema;
|
|
229849
230019
|
}
|
|
229850
|
-
|
|
230020
|
+
logger24.info({
|
|
229851
230021
|
evaluatorId: evaluator2.id,
|
|
229852
230022
|
schemaType: typeof schemaObj,
|
|
229853
230023
|
schemaKeys: schemaObj && typeof schemaObj === "object" ? Object.keys(schemaObj) : []
|
|
@@ -229912,13 +230082,13 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229912
230082
|
let resultSchema;
|
|
229913
230083
|
try {
|
|
229914
230084
|
resultSchema = external_exports.fromJSONSchema(schema);
|
|
229915
|
-
|
|
230085
|
+
logger24.info({
|
|
229916
230086
|
schemaType: typeof schema,
|
|
229917
230087
|
schemaKeys: schema && typeof schema === "object" ? Object.keys(schema) : [],
|
|
229918
230088
|
convertedSchema: "success"
|
|
229919
230089
|
}, "Converted JSON schema to Zod");
|
|
229920
230090
|
} catch (error92) {
|
|
229921
|
-
|
|
230091
|
+
logger24.error({
|
|
229922
230092
|
error: error92,
|
|
229923
230093
|
schema
|
|
229924
230094
|
}, "Failed to convert JSON schema to Zod, using fallback");
|
|
@@ -229926,7 +230096,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229926
230096
|
}
|
|
229927
230097
|
const evaluationSchema = resultSchema;
|
|
229928
230098
|
try {
|
|
229929
|
-
|
|
230099
|
+
logger24.info({
|
|
229930
230100
|
promptLength: prompt.length,
|
|
229931
230101
|
model: modelConfig.model
|
|
229932
230102
|
}, "Calling generateObject");
|
|
@@ -229944,7 +230114,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229944
230114
|
};
|
|
229945
230115
|
} catch (error92) {
|
|
229946
230116
|
const errorMessage = error92 instanceof Error ? error92.message : String(error92);
|
|
229947
|
-
|
|
230117
|
+
logger24.error({
|
|
229948
230118
|
error: errorMessage,
|
|
229949
230119
|
schema: JSON.stringify(schema, null, 2),
|
|
229950
230120
|
promptPreview: prompt.substring(0, 500)
|
|
@@ -229961,7 +230131,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229961
230131
|
const retryDelayMs = 2e4;
|
|
229962
230132
|
const initialDelayMs = 3e4;
|
|
229963
230133
|
try {
|
|
229964
|
-
|
|
230134
|
+
logger24.info({
|
|
229965
230135
|
conversationId,
|
|
229966
230136
|
manageUIUrl,
|
|
229967
230137
|
initialDelayMs
|
|
@@ -229969,21 +230139,21 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229969
230139
|
await new Promise((resolve4) => setTimeout(resolve4, initialDelayMs));
|
|
229970
230140
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
229971
230141
|
try {
|
|
229972
|
-
|
|
230142
|
+
logger24.info({
|
|
229973
230143
|
conversationId,
|
|
229974
230144
|
attempt: attempt + 1,
|
|
229975
230145
|
maxRetries: maxRetries + 1
|
|
229976
230146
|
}, "Fetching trace from SigNoz");
|
|
229977
230147
|
const traceResponse = await fetch(`${manageUIUrl}/api/signoz/conversations/${conversationId}`);
|
|
229978
230148
|
if (!traceResponse.ok) {
|
|
229979
|
-
|
|
230149
|
+
logger24.warn({
|
|
229980
230150
|
conversationId,
|
|
229981
230151
|
status: traceResponse.status,
|
|
229982
230152
|
statusText: traceResponse.statusText,
|
|
229983
230153
|
attempt: attempt + 1
|
|
229984
230154
|
}, "Failed to fetch trace from SigNoz");
|
|
229985
230155
|
if (attempt < maxRetries) {
|
|
229986
|
-
|
|
230156
|
+
logger24.info({
|
|
229987
230157
|
conversationId,
|
|
229988
230158
|
retryDelayMs
|
|
229989
230159
|
}, "Retrying trace fetch after delay");
|
|
@@ -229993,34 +230163,34 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229993
230163
|
return null;
|
|
229994
230164
|
}
|
|
229995
230165
|
const conversationDetail = await traceResponse.json();
|
|
229996
|
-
|
|
230166
|
+
logger24.debug({
|
|
229997
230167
|
conversationId,
|
|
229998
230168
|
activityTypes: conversationDetail.activities?.map((a2) => a2.type) || [],
|
|
229999
230169
|
activityCount: conversationDetail.activities?.length || 0
|
|
230000
230170
|
}, "Checking activities for ai_assistant_message type");
|
|
230001
230171
|
const hasAssistantMessage = conversationDetail.activities?.some((activity) => activity.type === "ai_assistant_message");
|
|
230002
230172
|
if (!hasAssistantMessage) {
|
|
230003
|
-
|
|
230173
|
+
logger24.warn({
|
|
230004
230174
|
conversationId,
|
|
230005
230175
|
attempt: attempt + 1,
|
|
230006
230176
|
activityCount: conversationDetail.activities?.length || 0,
|
|
230007
230177
|
activityTypes: conversationDetail.activities?.slice(0, 5).map((a2) => a2.type) || []
|
|
230008
230178
|
}, "Trace fetched but ai_assistant_message not found in activities");
|
|
230009
230179
|
if (attempt < maxRetries) {
|
|
230010
|
-
|
|
230180
|
+
logger24.info({
|
|
230011
230181
|
conversationId,
|
|
230012
230182
|
retryDelayMs
|
|
230013
230183
|
}, "Retrying trace fetch after delay to wait for assistant message");
|
|
230014
230184
|
await new Promise((resolve4) => setTimeout(resolve4, retryDelayMs));
|
|
230015
230185
|
continue;
|
|
230016
230186
|
}
|
|
230017
|
-
|
|
230187
|
+
logger24.warn({
|
|
230018
230188
|
conversationId,
|
|
230019
230189
|
maxRetries,
|
|
230020
230190
|
activityCount: conversationDetail.activities?.length || 0
|
|
230021
230191
|
}, "Max retries reached, ai_assistant_message not found - proceeding with available trace data");
|
|
230022
230192
|
} else {
|
|
230023
|
-
|
|
230193
|
+
logger24.info({
|
|
230024
230194
|
conversationId,
|
|
230025
230195
|
activityCount: conversationDetail.activities?.length || 0,
|
|
230026
230196
|
attempt: attempt + 1
|
|
@@ -230029,13 +230199,13 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
230029
230199
|
const prettifiedTrace = this.formatConversationAsPrettifiedTrace(conversationDetail);
|
|
230030
230200
|
return prettifiedTrace;
|
|
230031
230201
|
} catch (fetchError) {
|
|
230032
|
-
|
|
230202
|
+
logger24.warn({
|
|
230033
230203
|
error: fetchError,
|
|
230034
230204
|
conversationId,
|
|
230035
230205
|
attempt: attempt + 1
|
|
230036
230206
|
}, "Error fetching trace from SigNoz");
|
|
230037
230207
|
if (attempt < maxRetries) {
|
|
230038
|
-
|
|
230208
|
+
logger24.info({
|
|
230039
230209
|
conversationId,
|
|
230040
230210
|
retryDelayMs
|
|
230041
230211
|
}, "Retrying trace fetch after delay");
|
|
@@ -230047,7 +230217,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
230047
230217
|
}
|
|
230048
230218
|
return null;
|
|
230049
230219
|
} catch (error92) {
|
|
230050
|
-
|
|
230220
|
+
logger24.warn({
|
|
230051
230221
|
error: error92,
|
|
230052
230222
|
conversationId,
|
|
230053
230223
|
manageUIUrl
|
|
@@ -230084,7 +230254,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
230084
230254
|
};
|
|
230085
230255
|
|
|
230086
230256
|
// src/domains/evals/workflow/functions/evaluateConversation.ts
|
|
230087
|
-
var
|
|
230257
|
+
var logger25 = getLogger("workflow-evaluate-conversation");
|
|
230088
230258
|
async function getConversationStep(payload) {
|
|
230089
230259
|
const { tenantId, projectId, conversationId } = payload;
|
|
230090
230260
|
const conv = await getConversation(runDbClient_default)({
|
|
@@ -230152,7 +230322,7 @@ async function executeEvaluatorStep(payload, evaluatorId, conversation) {
|
|
|
230152
230322
|
output
|
|
230153
230323
|
}
|
|
230154
230324
|
});
|
|
230155
|
-
|
|
230325
|
+
logger25.info({
|
|
230156
230326
|
conversationId,
|
|
230157
230327
|
evaluatorId: evaluator2.id,
|
|
230158
230328
|
resultId: evalResult.id
|
|
@@ -230160,7 +230330,7 @@ async function executeEvaluatorStep(payload, evaluatorId, conversation) {
|
|
|
230160
230330
|
return updated;
|
|
230161
230331
|
} catch (error92) {
|
|
230162
230332
|
const errorMessage = error92 instanceof Error ? error92.message : "Unknown error";
|
|
230163
|
-
|
|
230333
|
+
logger25.error({
|
|
230164
230334
|
error: error92,
|
|
230165
230335
|
conversationId,
|
|
230166
230336
|
evaluatorId: evaluator2.id,
|
|
@@ -230183,7 +230353,7 @@ async function executeEvaluatorStep(payload, evaluatorId, conversation) {
|
|
|
230183
230353
|
}
|
|
230184
230354
|
__name(executeEvaluatorStep, "executeEvaluatorStep");
|
|
230185
230355
|
async function logStep(message, data) {
|
|
230186
|
-
|
|
230356
|
+
logger25.info(data, message);
|
|
230187
230357
|
}
|
|
230188
230358
|
__name(logStep, "logStep");
|
|
230189
230359
|
async function _evaluateConversationWorkflow(payload) {
|
|
@@ -230200,7 +230370,7 @@ registerStepFunction("step//src/domains/evals/workflow/functions/evaluateConvers
|
|
|
230200
230370
|
registerStepFunction("step//src/domains/evals/workflow/functions/evaluateConversation.ts//logStep", logStep);
|
|
230201
230371
|
|
|
230202
230372
|
// src/domains/evals/workflow/functions/runDatasetItem.ts
|
|
230203
|
-
var
|
|
230373
|
+
var logger26 = getLogger("workflow-run-dataset-item");
|
|
230204
230374
|
async function callChatApiStep(payload) {
|
|
230205
230375
|
const { tenantId, projectId, agentId, datasetItemId, datasetItemInput, datasetItemSimulationAgent, datasetRunId } = payload;
|
|
230206
230376
|
const evaluationService = new EvaluationService();
|
|
@@ -230216,7 +230386,7 @@ async function callChatApiStep(payload) {
|
|
|
230216
230386
|
datasetItem: datasetItem2,
|
|
230217
230387
|
datasetRunId
|
|
230218
230388
|
});
|
|
230219
|
-
|
|
230389
|
+
logger26.info({
|
|
230220
230390
|
tenantId,
|
|
230221
230391
|
projectId,
|
|
230222
230392
|
datasetItemId,
|
|
@@ -230239,7 +230409,7 @@ async function createRelationStep(payload, conversationId) {
|
|
|
230239
230409
|
conversationId,
|
|
230240
230410
|
datasetItemId
|
|
230241
230411
|
});
|
|
230242
|
-
|
|
230412
|
+
logger26.info({
|
|
230243
230413
|
tenantId,
|
|
230244
230414
|
projectId,
|
|
230245
230415
|
datasetItemId,
|
|
@@ -230253,7 +230423,7 @@ async function createRelationStep(payload, conversationId) {
|
|
|
230253
230423
|
};
|
|
230254
230424
|
} catch (error92) {
|
|
230255
230425
|
if (error92?.cause?.code === "23503" || error92?.code === "23503") {
|
|
230256
|
-
|
|
230426
|
+
logger26.warn({
|
|
230257
230427
|
tenantId,
|
|
230258
230428
|
projectId,
|
|
230259
230429
|
datasetItemId,
|
|
@@ -230284,7 +230454,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230284
230454
|
}
|
|
230285
230455
|
}));
|
|
230286
230456
|
if (!evaluator2) {
|
|
230287
|
-
|
|
230457
|
+
logger26.warn({
|
|
230288
230458
|
evaluatorId
|
|
230289
230459
|
}, "Evaluator not found");
|
|
230290
230460
|
return null;
|
|
@@ -230326,7 +230496,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230326
230496
|
output
|
|
230327
230497
|
}
|
|
230328
230498
|
});
|
|
230329
|
-
|
|
230499
|
+
logger26.info({
|
|
230330
230500
|
conversationId,
|
|
230331
230501
|
evaluatorId: evaluator2.id,
|
|
230332
230502
|
resultId: evalResult.id
|
|
@@ -230334,7 +230504,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230334
230504
|
return evalResult.id;
|
|
230335
230505
|
} catch (error92) {
|
|
230336
230506
|
const errorMessage = error92 instanceof Error ? error92.message : "Unknown error";
|
|
230337
|
-
|
|
230507
|
+
logger26.error({
|
|
230338
230508
|
error: error92,
|
|
230339
230509
|
conversationId,
|
|
230340
230510
|
evaluatorId: evaluator2.id
|
|
@@ -230356,7 +230526,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230356
230526
|
}
|
|
230357
230527
|
__name(executeEvaluatorStep2, "executeEvaluatorStep");
|
|
230358
230528
|
async function logStep2(message, data) {
|
|
230359
|
-
|
|
230529
|
+
logger26.info(data, message);
|
|
230360
230530
|
}
|
|
230361
230531
|
__name(logStep2, "logStep");
|
|
230362
230532
|
async function _runDatasetItemWorkflow(payload) {
|
|
@@ -244410,7 +244580,7 @@ __name(linkToCurrentContext, "linkToCurrentContext");
|
|
|
244410
244580
|
// ../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
|
|
244411
244581
|
function createLogger(namespace) {
|
|
244412
244582
|
const baseDebug = (0, import_debug2.default)(`workflow:${namespace}`);
|
|
244413
|
-
const
|
|
244583
|
+
const logger27 = /* @__PURE__ */ __name((level) => {
|
|
244414
244584
|
const levelDebug = baseDebug.extend(level);
|
|
244415
244585
|
return (message, metadata2) => {
|
|
244416
244586
|
levelDebug(message, metadata2);
|
|
@@ -244426,10 +244596,10 @@ function createLogger(namespace) {
|
|
|
244426
244596
|
};
|
|
244427
244597
|
}, "logger");
|
|
244428
244598
|
return {
|
|
244429
|
-
debug:
|
|
244430
|
-
info:
|
|
244431
|
-
warn:
|
|
244432
|
-
error:
|
|
244599
|
+
debug: logger27("debug"),
|
|
244600
|
+
info: logger27("info"),
|
|
244601
|
+
warn: logger27("warn"),
|
|
244602
|
+
error: logger27("error")
|
|
244433
244603
|
};
|
|
244434
244604
|
}
|
|
244435
244605
|
__name(createLogger, "createLogger");
|