@inkeep/agents-api 0.0.0-dev-20260211191741 → 0.0.0-dev-20260211220939
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 +424 -250
- package/dist/createApp.js +12 -1
- 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 +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/passwordResetLinks.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/Agent.js +2 -2
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/utils/SchemaProcessor.d.ts +1 -1
- package/dist/domains/run/utils/project.js +2 -2
- package/dist/domains/run/utils/token-estimator.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 +20 -20
- package/dist/index.d.ts +18 -18
- 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/projectConfig.d.ts +3 -3
- 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 +30 -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(logger26) {
|
|
8523
|
+
if (logger26 === false) return noLogs;
|
|
8524
|
+
if (logger26 === void 0) return console;
|
|
8525
|
+
if (logger26.log && logger26.warn && logger26.error) return logger26;
|
|
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((logger26) => {
|
|
39664
|
+
_logger = logger26;
|
|
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((logger26) => {
|
|
64246
|
+
logging.setLogger(logger26);
|
|
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 logger26 = (0, global_utils_1.getGlobal)("diag");
|
|
94108
|
+
if (!logger26) {
|
|
94109
94109
|
return;
|
|
94110
94110
|
}
|
|
94111
94111
|
args2.unshift(namespace);
|
|
94112
|
-
return
|
|
94112
|
+
return logger26[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, logger26) {
|
|
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
|
+
logger26 = logger26 || {};
|
|
94155
94155
|
function _filterFunc(funcName, theLevel) {
|
|
94156
|
-
const theFunc =
|
|
94156
|
+
const theFunc = logger26[funcName];
|
|
94157
94157
|
if (typeof theFunc === "function" && maxLevel >= theLevel) {
|
|
94158
|
-
return theFunc.bind(
|
|
94158
|
+
return theFunc.bind(logger26);
|
|
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 logger26 = (0, global_utils_1.getGlobal)("diag");
|
|
94202
|
+
if (!logger26) return;
|
|
94203
|
+
return logger26[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((logger26, optionsOrLogLevel = {
|
|
94209
94209
|
logLevel: types_1.DiagLogLevel.INFO
|
|
94210
94210
|
}) => {
|
|
94211
94211
|
var _a19, _b17, _c;
|
|
94212
|
-
if (
|
|
94212
|
+
if (logger26 === 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, logger26);
|
|
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}`);
|
|
@@ -124668,10 +124668,7 @@ var projects = pgTable("projects", {
|
|
|
124668
124668
|
]);
|
|
124669
124669
|
var agents = pgTable("agent", {
|
|
124670
124670
|
...projectScoped,
|
|
124671
|
-
|
|
124672
|
-
length: 256
|
|
124673
|
-
}).notNull(),
|
|
124674
|
-
description: text("description"),
|
|
124671
|
+
...uiProperties,
|
|
124675
124672
|
defaultSubAgentId: varchar("default_sub_agent_id", {
|
|
124676
124673
|
length: 256
|
|
124677
124674
|
}),
|
|
@@ -124891,7 +124888,7 @@ var externalAgents = pgTable("external_agents", {
|
|
|
124891
124888
|
var dataComponents = pgTable("data_components", {
|
|
124892
124889
|
...projectScoped,
|
|
124893
124890
|
...uiProperties,
|
|
124894
|
-
props: jsonb("props").$type(),
|
|
124891
|
+
props: jsonb("props").$type().notNull(),
|
|
124895
124892
|
render: jsonb("render").$type(),
|
|
124896
124893
|
...timestamps
|
|
124897
124894
|
}, (table) => [
|
|
@@ -125035,10 +125032,7 @@ var subAgentArtifactComponents = pgTable("sub_agent_artifact_components", {
|
|
|
125035
125032
|
]);
|
|
125036
125033
|
var tools = pgTable("tools", {
|
|
125037
125034
|
...projectScoped,
|
|
125038
|
-
|
|
125039
|
-
length: 256
|
|
125040
|
-
}).notNull(),
|
|
125041
|
-
description: text("description"),
|
|
125035
|
+
...uiProperties,
|
|
125042
125036
|
config: jsonb("config").$type().notNull(),
|
|
125043
125037
|
credentialReferenceId: varchar("credential_reference_id", {
|
|
125044
125038
|
length: 256
|
|
@@ -125083,10 +125077,7 @@ var tools = pgTable("tools", {
|
|
|
125083
125077
|
]);
|
|
125084
125078
|
var functionTools = pgTable("function_tools", {
|
|
125085
125079
|
...agentScoped,
|
|
125086
|
-
|
|
125087
|
-
length: 256
|
|
125088
|
-
}).notNull(),
|
|
125089
|
-
description: text("description"),
|
|
125080
|
+
...uiProperties,
|
|
125090
125081
|
functionId: varchar("function_id", {
|
|
125091
125082
|
length: 256
|
|
125092
125083
|
}).notNull(),
|
|
@@ -125342,9 +125333,7 @@ var subAgentFunctionToolRelations = pgTable("sub_agent_function_tool_relations",
|
|
|
125342
125333
|
]);
|
|
125343
125334
|
var credentialReferences = pgTable("credential_references", {
|
|
125344
125335
|
...projectScoped,
|
|
125345
|
-
name:
|
|
125346
|
-
length: 256
|
|
125347
|
-
}).notNull(),
|
|
125336
|
+
name: uiProperties.name,
|
|
125348
125337
|
type: varchar("type", {
|
|
125349
125338
|
length: 256
|
|
125350
125339
|
}).notNull(),
|
|
@@ -125386,9 +125375,7 @@ var credentialReferences = pgTable("credential_references", {
|
|
|
125386
125375
|
]);
|
|
125387
125376
|
var dataset = pgTable("dataset", {
|
|
125388
125377
|
...projectScoped,
|
|
125389
|
-
name:
|
|
125390
|
-
length: 256
|
|
125391
|
-
}).notNull(),
|
|
125378
|
+
name: uiProperties.name,
|
|
125392
125379
|
...timestamps
|
|
125393
125380
|
}, (table) => [
|
|
125394
125381
|
primaryKey({
|
|
@@ -126363,7 +126350,10 @@ var runtime_schema_exports = /* @__PURE__ */ __exportAll({
|
|
|
126363
126350
|
workAppGitHubProjectRepositoryAccess: /* @__PURE__ */ __name(() => workAppGitHubProjectRepositoryAccess, "workAppGitHubProjectRepositoryAccess"),
|
|
126364
126351
|
workAppGitHubProjectRepositoryAccessRelations: /* @__PURE__ */ __name(() => workAppGitHubProjectRepositoryAccessRelations, "workAppGitHubProjectRepositoryAccessRelations"),
|
|
126365
126352
|
workAppGitHubRepositories: /* @__PURE__ */ __name(() => workAppGitHubRepositories, "workAppGitHubRepositories"),
|
|
126366
|
-
workAppGitHubRepositoriesRelations: /* @__PURE__ */ __name(() => workAppGitHubRepositoriesRelations, "workAppGitHubRepositoriesRelations")
|
|
126353
|
+
workAppGitHubRepositoriesRelations: /* @__PURE__ */ __name(() => workAppGitHubRepositoriesRelations, "workAppGitHubRepositoriesRelations"),
|
|
126354
|
+
workAppSlackChannelAgentConfigs: /* @__PURE__ */ __name(() => workAppSlackChannelAgentConfigs, "workAppSlackChannelAgentConfigs"),
|
|
126355
|
+
workAppSlackUserMappings: /* @__PURE__ */ __name(() => workAppSlackUserMappings, "workAppSlackUserMappings"),
|
|
126356
|
+
workAppSlackWorkspaces: /* @__PURE__ */ __name(() => workAppSlackWorkspaces, "workAppSlackWorkspaces")
|
|
126367
126357
|
});
|
|
126368
126358
|
var tenantScoped2 = {
|
|
126369
126359
|
tenantId: varchar("tenant_id", {
|
|
@@ -126548,6 +126538,131 @@ var triggerInvocations = pgTable("trigger_invocations", {
|
|
|
126548
126538
|
index("trigger_invocations_trigger_idx").on(table.triggerId, table.createdAt),
|
|
126549
126539
|
index("trigger_invocations_status_idx").on(table.triggerId, table.status)
|
|
126550
126540
|
]);
|
|
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
|
+
]);
|
|
126551
126666
|
var messages = pgTable("messages", {
|
|
126552
126667
|
...projectScoped2,
|
|
126553
126668
|
conversationId: varchar("conversation_id", {
|
|
@@ -144051,21 +144166,10 @@ var DatasetRunConfigAgentRelationInsertSchema = createInsertSchema2(datasetRunCo
|
|
|
144051
144166
|
id: ResourceIdSchema
|
|
144052
144167
|
});
|
|
144053
144168
|
var DatasetRunConfigAgentRelationUpdateSchema = DatasetRunConfigAgentRelationInsertSchema.partial();
|
|
144054
|
-
var DatasetRunConfigAgentRelationApiSelectSchema = createApiSchema(DatasetRunConfigAgentRelationSelectSchema).openapi("DatasetRunConfigAgentRelation");
|
|
144055
|
-
var DatasetRunConfigAgentRelationApiInsertSchema = createApiInsertSchema(DatasetRunConfigAgentRelationInsertSchema).omit({
|
|
144056
|
-
id: true
|
|
144057
|
-
}).openapi("DatasetRunConfigAgentRelationCreate");
|
|
144058
|
-
var DatasetRunConfigAgentRelationApiUpdateSchema = createApiUpdateSchema(DatasetRunConfigAgentRelationUpdateSchema).omit({
|
|
144059
|
-
id: true
|
|
144060
|
-
}).openapi("DatasetRunConfigAgentRelationUpdate");
|
|
144061
144169
|
var DataComponentSelectSchema = createSelectSchema2(dataComponents);
|
|
144062
144170
|
var DataComponentInsertSchema = createInsertSchema2(dataComponents).extend({
|
|
144063
144171
|
id: ResourceIdSchema
|
|
144064
144172
|
});
|
|
144065
|
-
var DataComponentBaseSchema = DataComponentInsertSchema.omit({
|
|
144066
|
-
createdAt: true,
|
|
144067
|
-
updatedAt: true
|
|
144068
|
-
});
|
|
144069
144173
|
var DataComponentUpdateSchema = DataComponentInsertSchema.partial();
|
|
144070
144174
|
var DataComponentApiSelectSchema = createApiSchema(DataComponentSelectSchema).openapi("DataComponent");
|
|
144071
144175
|
var DataComponentApiInsertSchema = createApiInsertSchema(DataComponentInsertSchema).openapi("DataComponentCreate");
|
|
@@ -144968,6 +145072,34 @@ var WorkAppGitHubAccessGetResponseSchema = external_exports.object({
|
|
|
144968
145072
|
mode: WorkAppGitHubAccessModeSchema,
|
|
144969
145073
|
repositories: external_exports.array(WorkAppGitHubRepositorySelectSchema)
|
|
144970
145074
|
});
|
|
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();
|
|
144971
145103
|
|
|
144972
145104
|
// ../packages/agents-core/dist/utils/colors.js
|
|
144973
145105
|
var import_iwanthue = __toESM(require_iwanthue(), 1);
|
|
@@ -147311,12 +147443,12 @@ var LoggerFactory = class {
|
|
|
147311
147443
|
if (!logger$12) throw new Error(`Logger '${name18}' not found in cache`);
|
|
147312
147444
|
return logger$12;
|
|
147313
147445
|
}
|
|
147314
|
-
let
|
|
147315
|
-
if (this.config.loggerFactory)
|
|
147316
|
-
else if (this.config.defaultLogger)
|
|
147317
|
-
else
|
|
147318
|
-
this.loggers.set(name18,
|
|
147319
|
-
return
|
|
147446
|
+
let logger26;
|
|
147447
|
+
if (this.config.loggerFactory) logger26 = this.config.loggerFactory(name18);
|
|
147448
|
+
else if (this.config.defaultLogger) logger26 = this.config.defaultLogger;
|
|
147449
|
+
else logger26 = new PinoLogger(name18, this.config.pinoConfig);
|
|
147450
|
+
this.loggers.set(name18, logger26);
|
|
147451
|
+
return logger26;
|
|
147320
147452
|
}
|
|
147321
147453
|
/**
|
|
147322
147454
|
* Reset factory to default state
|
|
@@ -179582,7 +179714,7 @@ var PglitePreparedQuery = class extends PgPreparedQuery {
|
|
|
179582
179714
|
static {
|
|
179583
179715
|
__name(this, "PglitePreparedQuery");
|
|
179584
179716
|
}
|
|
179585
|
-
constructor(client, queryString, params,
|
|
179717
|
+
constructor(client, queryString, params, logger26, cache, queryMetadata, cacheConfig, fields, name18, _isResponseInArrayMode, customResultMapper) {
|
|
179586
179718
|
super({
|
|
179587
179719
|
sql: queryString,
|
|
179588
179720
|
params
|
|
@@ -179590,7 +179722,7 @@ var PglitePreparedQuery = class extends PgPreparedQuery {
|
|
|
179590
179722
|
this.client = client;
|
|
179591
179723
|
this.queryString = queryString;
|
|
179592
179724
|
this.params = params;
|
|
179593
|
-
this.logger =
|
|
179725
|
+
this.logger = logger26;
|
|
179594
179726
|
this.fields = fields;
|
|
179595
179727
|
this._isResponseInArrayMode = _isResponseInArrayMode;
|
|
179596
179728
|
this.customResultMapper = customResultMapper;
|
|
@@ -179743,11 +179875,11 @@ function construct(client, config4 = {}) {
|
|
|
179743
179875
|
const dialect = new PgDialect({
|
|
179744
179876
|
casing: config4.casing
|
|
179745
179877
|
});
|
|
179746
|
-
let
|
|
179878
|
+
let logger26;
|
|
179747
179879
|
if (config4.logger === true) {
|
|
179748
|
-
|
|
179880
|
+
logger26 = new DefaultLogger();
|
|
179749
179881
|
} else if (config4.logger !== false) {
|
|
179750
|
-
|
|
179882
|
+
logger26 = config4.logger;
|
|
179751
179883
|
}
|
|
179752
179884
|
let schema;
|
|
179753
179885
|
if (config4.schema) {
|
|
@@ -179759,7 +179891,7 @@ function construct(client, config4 = {}) {
|
|
|
179759
179891
|
};
|
|
179760
179892
|
}
|
|
179761
179893
|
const driver = new PgliteDriver(client, dialect, {
|
|
179762
|
-
logger:
|
|
179894
|
+
logger: logger26,
|
|
179763
179895
|
cache: config4.cache
|
|
179764
179896
|
});
|
|
179765
179897
|
const session2 = driver.createSession(schema);
|
|
@@ -179828,7 +179960,7 @@ var NodePgPreparedQuery = class extends PgPreparedQuery {
|
|
|
179828
179960
|
static {
|
|
179829
179961
|
__name(this, "NodePgPreparedQuery");
|
|
179830
179962
|
}
|
|
179831
|
-
constructor(client, queryString, params,
|
|
179963
|
+
constructor(client, queryString, params, logger26, cache, queryMetadata, cacheConfig, fields, name18, _isResponseInArrayMode, customResultMapper) {
|
|
179832
179964
|
super({
|
|
179833
179965
|
sql: queryString,
|
|
179834
179966
|
params
|
|
@@ -179836,7 +179968,7 @@ var NodePgPreparedQuery = class extends PgPreparedQuery {
|
|
|
179836
179968
|
this.client = client;
|
|
179837
179969
|
this.queryString = queryString;
|
|
179838
179970
|
this.params = params;
|
|
179839
|
-
this.logger =
|
|
179971
|
+
this.logger = logger26;
|
|
179840
179972
|
this.fields = fields;
|
|
179841
179973
|
this._isResponseInArrayMode = _isResponseInArrayMode;
|
|
179842
179974
|
this.customResultMapper = customResultMapper;
|
|
@@ -180060,11 +180192,11 @@ function construct2(client, config4 = {}) {
|
|
|
180060
180192
|
const dialect = new PgDialect({
|
|
180061
180193
|
casing: config4.casing
|
|
180062
180194
|
});
|
|
180063
|
-
let
|
|
180195
|
+
let logger26;
|
|
180064
180196
|
if (config4.logger === true) {
|
|
180065
|
-
|
|
180197
|
+
logger26 = new DefaultLogger();
|
|
180066
180198
|
} else if (config4.logger !== false) {
|
|
180067
|
-
|
|
180199
|
+
logger26 = config4.logger;
|
|
180068
180200
|
}
|
|
180069
180201
|
let schema;
|
|
180070
180202
|
if (config4.schema) {
|
|
@@ -180076,7 +180208,7 @@ function construct2(client, config4 = {}) {
|
|
|
180076
180208
|
};
|
|
180077
180209
|
}
|
|
180078
180210
|
const driver = new NodePgDriver(client, dialect, {
|
|
180079
|
-
logger:
|
|
180211
|
+
logger: logger26,
|
|
180080
180212
|
cache: config4.cache
|
|
180081
180213
|
});
|
|
180082
180214
|
const session2 = driver.createSession(schema);
|
|
@@ -182221,11 +182353,11 @@ var parseLogLevel = /* @__PURE__ */ __name((maybeLevel, sourceName, client) => {
|
|
|
182221
182353
|
function noop2() {
|
|
182222
182354
|
}
|
|
182223
182355
|
__name(noop2, "noop");
|
|
182224
|
-
function makeLogFn(fnLevel,
|
|
182225
|
-
if (!
|
|
182356
|
+
function makeLogFn(fnLevel, logger26, logLevel) {
|
|
182357
|
+
if (!logger26 || levelNumbers[fnLevel] > levelNumbers[logLevel]) {
|
|
182226
182358
|
return noop2;
|
|
182227
182359
|
} else {
|
|
182228
|
-
return
|
|
182360
|
+
return logger26[fnLevel].bind(logger26);
|
|
182229
182361
|
}
|
|
182230
182362
|
}
|
|
182231
182363
|
__name(makeLogFn, "makeLogFn");
|
|
@@ -182237,22 +182369,22 @@ var noopLogger = {
|
|
|
182237
182369
|
};
|
|
182238
182370
|
var cachedLoggers = /* @__PURE__ */ new WeakMap();
|
|
182239
182371
|
function loggerFor(client) {
|
|
182240
|
-
const
|
|
182372
|
+
const logger26 = client.logger;
|
|
182241
182373
|
const logLevel = client.logLevel ?? "off";
|
|
182242
|
-
if (!
|
|
182374
|
+
if (!logger26) {
|
|
182243
182375
|
return noopLogger;
|
|
182244
182376
|
}
|
|
182245
|
-
const cachedLogger = cachedLoggers.get(
|
|
182377
|
+
const cachedLogger = cachedLoggers.get(logger26);
|
|
182246
182378
|
if (cachedLogger && cachedLogger[0] === logLevel) {
|
|
182247
182379
|
return cachedLogger[1];
|
|
182248
182380
|
}
|
|
182249
182381
|
const levelLogger = {
|
|
182250
|
-
error: makeLogFn("error",
|
|
182251
|
-
warn: makeLogFn("warn",
|
|
182252
|
-
info: makeLogFn("info",
|
|
182253
|
-
debug: makeLogFn("debug",
|
|
182382
|
+
error: makeLogFn("error", logger26, logLevel),
|
|
182383
|
+
warn: makeLogFn("warn", logger26, logLevel),
|
|
182384
|
+
info: makeLogFn("info", logger26, logLevel),
|
|
182385
|
+
debug: makeLogFn("debug", logger26, logLevel)
|
|
182254
182386
|
};
|
|
182255
|
-
cachedLoggers.set(
|
|
182387
|
+
cachedLoggers.set(logger26, [
|
|
182256
182388
|
logLevel,
|
|
182257
182389
|
levelLogger
|
|
182258
182390
|
]);
|
|
@@ -188491,11 +188623,11 @@ var parseLogLevel2 = /* @__PURE__ */ __name((maybeLevel, sourceName, client) =>
|
|
|
188491
188623
|
function noop3() {
|
|
188492
188624
|
}
|
|
188493
188625
|
__name(noop3, "noop");
|
|
188494
|
-
function makeLogFn2(fnLevel,
|
|
188495
|
-
if (!
|
|
188626
|
+
function makeLogFn2(fnLevel, logger26, logLevel) {
|
|
188627
|
+
if (!logger26 || levelNumbers2[fnLevel] > levelNumbers2[logLevel]) {
|
|
188496
188628
|
return noop3;
|
|
188497
188629
|
} else {
|
|
188498
|
-
return
|
|
188630
|
+
return logger26[fnLevel].bind(logger26);
|
|
188499
188631
|
}
|
|
188500
188632
|
}
|
|
188501
188633
|
__name(makeLogFn2, "makeLogFn");
|
|
@@ -188507,22 +188639,22 @@ var noopLogger2 = {
|
|
|
188507
188639
|
};
|
|
188508
188640
|
var cachedLoggers2 = /* @__PURE__ */ new WeakMap();
|
|
188509
188641
|
function loggerFor2(client) {
|
|
188510
|
-
const
|
|
188642
|
+
const logger26 = client.logger;
|
|
188511
188643
|
const logLevel = client.logLevel ?? "off";
|
|
188512
|
-
if (!
|
|
188644
|
+
if (!logger26) {
|
|
188513
188645
|
return noopLogger2;
|
|
188514
188646
|
}
|
|
188515
|
-
const cachedLogger = cachedLoggers2.get(
|
|
188647
|
+
const cachedLogger = cachedLoggers2.get(logger26);
|
|
188516
188648
|
if (cachedLogger && cachedLogger[0] === logLevel) {
|
|
188517
188649
|
return cachedLogger[1];
|
|
188518
188650
|
}
|
|
188519
188651
|
const levelLogger = {
|
|
188520
|
-
error: makeLogFn2("error",
|
|
188521
|
-
warn: makeLogFn2("warn",
|
|
188522
|
-
info: makeLogFn2("info",
|
|
188523
|
-
debug: makeLogFn2("debug",
|
|
188652
|
+
error: makeLogFn2("error", logger26, logLevel),
|
|
188653
|
+
warn: makeLogFn2("warn", logger26, logLevel),
|
|
188654
|
+
info: makeLogFn2("info", logger26, logLevel),
|
|
188655
|
+
debug: makeLogFn2("debug", logger26, logLevel)
|
|
188524
188656
|
};
|
|
188525
|
-
cachedLoggers2.set(
|
|
188657
|
+
cachedLoggers2.set(logger26, [
|
|
188526
188658
|
logLevel,
|
|
188527
188659
|
levelLogger
|
|
188528
188660
|
]);
|
|
@@ -188567,7 +188699,7 @@ var Stream = class _Stream {
|
|
|
188567
188699
|
}
|
|
188568
188700
|
static fromSSEResponse(response, controller, client) {
|
|
188569
188701
|
let consumed = false;
|
|
188570
|
-
const
|
|
188702
|
+
const logger26 = client ? loggerFor2(client) : console;
|
|
188571
188703
|
async function* iterator2() {
|
|
188572
188704
|
if (consumed) {
|
|
188573
188705
|
throw new OpenAIError("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");
|
|
@@ -188586,8 +188718,8 @@ var Stream = class _Stream {
|
|
|
188586
188718
|
try {
|
|
188587
188719
|
data = JSON.parse(sse.data);
|
|
188588
188720
|
} catch (e) {
|
|
188589
|
-
|
|
188590
|
-
|
|
188721
|
+
logger26.error(`Could not parse message into JSON:`, sse.data);
|
|
188722
|
+
logger26.error(`From chunk:`, sse.raw);
|
|
188591
188723
|
throw e;
|
|
188592
188724
|
}
|
|
188593
188725
|
if (data && data.error) {
|
|
@@ -201303,12 +201435,12 @@ var logWarnings = /* @__PURE__ */ __name((options) => {
|
|
|
201303
201435
|
if (options.warnings.length === 0) {
|
|
201304
201436
|
return;
|
|
201305
201437
|
}
|
|
201306
|
-
const
|
|
201307
|
-
if (
|
|
201438
|
+
const logger26 = globalThis.AI_SDK_LOG_WARNINGS;
|
|
201439
|
+
if (logger26 === false) {
|
|
201308
201440
|
return;
|
|
201309
201441
|
}
|
|
201310
|
-
if (typeof
|
|
201311
|
-
|
|
201442
|
+
if (typeof logger26 === "function") {
|
|
201443
|
+
logger26(options);
|
|
201312
201444
|
return;
|
|
201313
201445
|
}
|
|
201314
201446
|
if (!hasLoggedBefore) {
|
|
@@ -227973,11 +228105,116 @@ var ModelFactory = class ModelFactory2 {
|
|
|
227973
228105
|
// ../packages/agents-core/dist/utils/service-token-auth.js
|
|
227974
228106
|
var logger15 = getLogger("service-token-auth");
|
|
227975
228107
|
|
|
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
|
+
|
|
227976
228213
|
// ../packages/agents-core/dist/utils/third-party-mcp-servers/composio-client.js
|
|
227977
228214
|
var logger$1 = getLogger("composio-client");
|
|
227978
228215
|
|
|
227979
228216
|
// ../packages/agents-core/dist/utils/third-party-mcp-servers/third-party-check.js
|
|
227980
|
-
var
|
|
228217
|
+
var logger18 = getLogger("third-party-check");
|
|
227981
228218
|
|
|
227982
228219
|
// ../packages/agents-core/dist/utils/trigger-auth.js
|
|
227983
228220
|
var import_node_crypto7 = require("node:crypto");
|
|
@@ -227985,10 +228222,10 @@ var import_node_util3 = require("node:util");
|
|
|
227985
228222
|
var scryptAsync2 = (0, import_node_util3.promisify)(import_node_crypto7.scrypt);
|
|
227986
228223
|
|
|
227987
228224
|
// ../packages/agents-core/dist/utils/tracer-factory.js
|
|
227988
|
-
var
|
|
228225
|
+
var logger19 = getLogger("tracer");
|
|
227989
228226
|
|
|
227990
228227
|
// ../packages/agents-core/dist/data-access/manage/tools.js
|
|
227991
|
-
var
|
|
228228
|
+
var logger20 = getLogger("tools");
|
|
227992
228229
|
var listTools = /* @__PURE__ */ __name((db) => async (params) => {
|
|
227993
228230
|
const page = params.pagination?.page || 1;
|
|
227994
228231
|
const limit3 = Math.min(params.pagination?.limit || 10, 100);
|
|
@@ -228443,10 +228680,10 @@ var defaultLogger = {
|
|
|
228443
228680
|
error: /* @__PURE__ */ __name(() => {
|
|
228444
228681
|
}, "error")
|
|
228445
228682
|
};
|
|
228446
|
-
var getFullAgent = /* @__PURE__ */ __name((db,
|
|
228683
|
+
var getFullAgent = /* @__PURE__ */ __name((db, logger26 = defaultLogger) => async (params) => {
|
|
228447
228684
|
const { scopes } = params;
|
|
228448
228685
|
const { tenantId, projectId } = scopes;
|
|
228449
|
-
|
|
228686
|
+
logger26.info({
|
|
228450
228687
|
tenantId,
|
|
228451
228688
|
agentId: scopes.agentId
|
|
228452
228689
|
}, "Retrieving full agent definition");
|
|
@@ -228459,20 +228696,20 @@ var getFullAgent = /* @__PURE__ */ __name((db, logger24 = defaultLogger) => asyn
|
|
|
228459
228696
|
}
|
|
228460
228697
|
});
|
|
228461
228698
|
if (!agent) {
|
|
228462
|
-
|
|
228699
|
+
logger26.info({
|
|
228463
228700
|
tenantId,
|
|
228464
228701
|
agentId: scopes.agentId
|
|
228465
228702
|
}, "Agent not found");
|
|
228466
228703
|
return null;
|
|
228467
228704
|
}
|
|
228468
|
-
|
|
228705
|
+
logger26.info({
|
|
228469
228706
|
tenantId,
|
|
228470
228707
|
agentId: scopes.agentId,
|
|
228471
228708
|
agentCount: Object.keys(agent.subAgents).length
|
|
228472
228709
|
}, "Full agent retrieved successfully");
|
|
228473
228710
|
return agent;
|
|
228474
228711
|
} catch (error92) {
|
|
228475
|
-
|
|
228712
|
+
logger26.error({
|
|
228476
228713
|
tenantId,
|
|
228477
228714
|
agentId: scopes.agentId,
|
|
228478
228715
|
error: error92 instanceof Error ? error92.message : "Unknown error"
|
|
@@ -228638,11 +228875,11 @@ var filterConversationsForJob = /* @__PURE__ */ __name((db) => async (params) =>
|
|
|
228638
228875
|
loadEnvironmentFiles();
|
|
228639
228876
|
|
|
228640
228877
|
// ../packages/agents-core/dist/dolt/ref-middleware.js
|
|
228641
|
-
var
|
|
228878
|
+
var logger21 = getLogger("ref-middleware");
|
|
228642
228879
|
|
|
228643
228880
|
// ../packages/agents-core/dist/dolt/ref-scope.js
|
|
228644
228881
|
var import_node_async_hooks2 = require("node:async_hooks");
|
|
228645
|
-
var
|
|
228882
|
+
var logger22 = getLogger("ref-scope");
|
|
228646
228883
|
var refScopeStorage = new import_node_async_hooks2.AsyncLocalStorage();
|
|
228647
228884
|
var NestedRefScopeError = class extends Error {
|
|
228648
228885
|
static {
|
|
@@ -228660,7 +228897,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228660
228897
|
const existingScope = refScopeStorage.getStore();
|
|
228661
228898
|
if (existingScope) {
|
|
228662
228899
|
if (existingScope.ref === resolvedRef.name) {
|
|
228663
|
-
|
|
228900
|
+
logger22.debug({
|
|
228664
228901
|
ref: resolvedRef.name,
|
|
228665
228902
|
existingConnectionId: existingScope.connectionId
|
|
228666
228903
|
}, "Reusing existing ref scope");
|
|
@@ -228683,7 +228920,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228683
228920
|
connection$1.release();
|
|
228684
228921
|
}
|
|
228685
228922
|
}
|
|
228686
|
-
|
|
228923
|
+
logger22.debug({
|
|
228687
228924
|
ref: resolvedRef.name,
|
|
228688
228925
|
refType: resolvedRef.type,
|
|
228689
228926
|
connectionId
|
|
@@ -228695,7 +228932,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228695
228932
|
schema: manage_schema_exports
|
|
228696
228933
|
});
|
|
228697
228934
|
if (resolvedRef.type === "branch") {
|
|
228698
|
-
|
|
228935
|
+
logger22.debug({
|
|
228699
228936
|
branch: resolvedRef.name,
|
|
228700
228937
|
connectionId
|
|
228701
228938
|
}, "Checking out branch");
|
|
@@ -228705,7 +228942,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228705
228942
|
});
|
|
228706
228943
|
} else {
|
|
228707
228944
|
tempBranch = `temp_${resolvedRef.type}_${Date.now()}_${generateId()}`;
|
|
228708
|
-
|
|
228945
|
+
logger22.debug({
|
|
228709
228946
|
tempBranch,
|
|
228710
228947
|
hash: resolvedRef.hash,
|
|
228711
228948
|
refType: resolvedRef.type,
|
|
@@ -228723,7 +228960,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228723
228960
|
}, () => dataAccessFn(db));
|
|
228724
228961
|
if (commit && resolvedRef.type === "branch") try {
|
|
228725
228962
|
if ((await doltStatus(db)()).length > 0) {
|
|
228726
|
-
|
|
228963
|
+
logger22.info({
|
|
228727
228964
|
branch: resolvedRef.name,
|
|
228728
228965
|
message: commitMessage,
|
|
228729
228966
|
connectionId
|
|
@@ -228735,19 +228972,19 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228735
228972
|
email: "api@inkeep.com"
|
|
228736
228973
|
}
|
|
228737
228974
|
});
|
|
228738
|
-
|
|
228975
|
+
logger22.info({
|
|
228739
228976
|
branch: resolvedRef.name,
|
|
228740
228977
|
connectionId
|
|
228741
228978
|
}, "Successfully committed changes");
|
|
228742
228979
|
}
|
|
228743
228980
|
} catch (commitError) {
|
|
228744
|
-
|
|
228981
|
+
logger22.error({
|
|
228745
228982
|
error: commitError,
|
|
228746
228983
|
branch: resolvedRef.name,
|
|
228747
228984
|
connectionId
|
|
228748
228985
|
}, "Failed to auto-commit changes");
|
|
228749
228986
|
}
|
|
228750
|
-
|
|
228987
|
+
logger22.debug({
|
|
228751
228988
|
ref: resolvedRef.name,
|
|
228752
228989
|
duration: Date.now() - startTime,
|
|
228753
228990
|
connectionId
|
|
@@ -228760,19 +228997,19 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228760
228997
|
});
|
|
228761
228998
|
if ((await doltStatus(db)()).length > 0) {
|
|
228762
228999
|
await doltReset(db)();
|
|
228763
|
-
|
|
229000
|
+
logger22.info({
|
|
228764
229001
|
branch: resolvedRef.name,
|
|
228765
229002
|
connectionId
|
|
228766
229003
|
}, "Reset uncommitted changes due to failed operation");
|
|
228767
229004
|
}
|
|
228768
229005
|
} catch (resetError) {
|
|
228769
|
-
|
|
229006
|
+
logger22.error({
|
|
228770
229007
|
error: resetError,
|
|
228771
229008
|
branch: resolvedRef.name,
|
|
228772
229009
|
connectionId
|
|
228773
229010
|
}, "Failed to reset changes after error");
|
|
228774
229011
|
}
|
|
228775
|
-
|
|
229012
|
+
logger22.error({
|
|
228776
229013
|
ref: resolvedRef.name,
|
|
228777
229014
|
duration: Date.now() - startTime,
|
|
228778
229015
|
connectionId,
|
|
@@ -228783,7 +229020,7 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228783
229020
|
try {
|
|
228784
229021
|
await connection.query(`SELECT DOLT_CHECKOUT('main')`);
|
|
228785
229022
|
if (tempBranch) {
|
|
228786
|
-
|
|
229023
|
+
logger22.debug({
|
|
228787
229024
|
tempBranch,
|
|
228788
229025
|
connectionId
|
|
228789
229026
|
}, "Deleting temporary branch");
|
|
@@ -228792,14 +229029,14 @@ async function withRef(pool2, resolvedRef, dataAccessFn, options) {
|
|
|
228792
229029
|
]);
|
|
228793
229030
|
}
|
|
228794
229031
|
} catch (cleanupError) {
|
|
228795
|
-
|
|
229032
|
+
logger22.error({
|
|
228796
229033
|
error: cleanupError,
|
|
228797
229034
|
tempBranch,
|
|
228798
229035
|
connectionId
|
|
228799
229036
|
}, "Error during ref scope cleanup");
|
|
228800
229037
|
} finally {
|
|
228801
229038
|
connection.release();
|
|
228802
|
-
|
|
229039
|
+
logger22.debug({
|
|
228803
229040
|
ref: resolvedRef.name,
|
|
228804
229041
|
duration: Date.now() - startTime,
|
|
228805
229042
|
connectionId
|
|
@@ -228915,7 +229152,7 @@ var runDbClient = createAgentsRunDatabaseClient({
|
|
|
228915
229152
|
var runDbClient_default = runDbClient;
|
|
228916
229153
|
|
|
228917
229154
|
// src/domains/evals/services/EvaluationService.ts
|
|
228918
|
-
var
|
|
229155
|
+
var logger23 = getLogger("EvaluationService");
|
|
228919
229156
|
var EvaluationService = class {
|
|
228920
229157
|
static {
|
|
228921
229158
|
__name(this, "EvaluationService");
|
|
@@ -228965,7 +229202,7 @@ var EvaluationService = class {
|
|
|
228965
229202
|
messages: initialMessages
|
|
228966
229203
|
});
|
|
228967
229204
|
} catch (error92) {
|
|
228968
|
-
|
|
229205
|
+
logger23.error({
|
|
228969
229206
|
error: error92 instanceof Error ? error92.message : String(error92),
|
|
228970
229207
|
datasetItemId: datasetItem2.id
|
|
228971
229208
|
}, "Error running dataset item through chat API");
|
|
@@ -229000,7 +229237,7 @@ var EvaluationService = class {
|
|
|
229000
229237
|
"x-inkeep-dataset-run-id": datasetRunId
|
|
229001
229238
|
}
|
|
229002
229239
|
};
|
|
229003
|
-
|
|
229240
|
+
logger23.info({
|
|
229004
229241
|
tenantId,
|
|
229005
229242
|
projectId,
|
|
229006
229243
|
agentId,
|
|
@@ -229015,7 +229252,7 @@ var EvaluationService = class {
|
|
|
229015
229252
|
});
|
|
229016
229253
|
if (!response.ok) {
|
|
229017
229254
|
const errorText = await response.text();
|
|
229018
|
-
|
|
229255
|
+
logger23.error({
|
|
229019
229256
|
status: response.status,
|
|
229020
229257
|
statusText: response.statusText,
|
|
229021
229258
|
errorText,
|
|
@@ -229028,9 +229265,9 @@ var EvaluationService = class {
|
|
|
229028
229265
|
};
|
|
229029
229266
|
}
|
|
229030
229267
|
const responseText = await response.text();
|
|
229031
|
-
const parseResult =
|
|
229268
|
+
const parseResult = parseSSEResponse(responseText);
|
|
229032
229269
|
if (parseResult.error) {
|
|
229033
|
-
|
|
229270
|
+
logger23.error({
|
|
229034
229271
|
datasetItemId: datasetItem2.id,
|
|
229035
229272
|
conversationId,
|
|
229036
229273
|
errorMessage: parseResult.error
|
|
@@ -229040,7 +229277,7 @@ var EvaluationService = class {
|
|
|
229040
229277
|
error: parseResult.error
|
|
229041
229278
|
};
|
|
229042
229279
|
}
|
|
229043
|
-
|
|
229280
|
+
logger23.info({
|
|
229044
229281
|
datasetItemId: datasetItem2.id,
|
|
229045
229282
|
conversationId,
|
|
229046
229283
|
responseLength: parseResult.text?.length || 0
|
|
@@ -229055,7 +229292,7 @@ var EvaluationService = class {
|
|
|
229055
229292
|
*/
|
|
229056
229293
|
async runDatasetItemWithSimulation(params) {
|
|
229057
229294
|
const { tenantId, projectId, agentId, datasetItem: datasetItem2, datasetRunId, conversationId, apiKey, initialMessages, simulationAgent } = params;
|
|
229058
|
-
|
|
229295
|
+
logger23.info({
|
|
229059
229296
|
tenantId,
|
|
229060
229297
|
projectId,
|
|
229061
229298
|
agentId,
|
|
@@ -229095,7 +229332,7 @@ var EvaluationService = class {
|
|
|
229095
229332
|
while (stepCount < maxSteps) {
|
|
229096
229333
|
try {
|
|
229097
229334
|
const simulationPrompt = this.buildSimulationPrompt(simulationAgent.prompt, conversationHistory);
|
|
229098
|
-
|
|
229335
|
+
logger23.debug({
|
|
229099
229336
|
stepCount,
|
|
229100
229337
|
maxSteps,
|
|
229101
229338
|
conversationHistoryLength: conversationHistory.length
|
|
@@ -229106,7 +229343,7 @@ var EvaluationService = class {
|
|
|
229106
229343
|
});
|
|
229107
229344
|
const nextUserMessage = simulationResponse.text.trim();
|
|
229108
229345
|
if (!nextUserMessage) {
|
|
229109
|
-
|
|
229346
|
+
logger23.warn({
|
|
229110
229347
|
stepCount,
|
|
229111
229348
|
datasetItemId: datasetItem2.id
|
|
229112
229349
|
}, "Simulation agent returned empty message, stopping conversation");
|
|
@@ -229132,7 +229369,7 @@ var EvaluationService = class {
|
|
|
229132
229369
|
]
|
|
229133
229370
|
});
|
|
229134
229371
|
if (agentResponse.error || !agentResponse.response) {
|
|
229135
|
-
|
|
229372
|
+
logger23.warn({
|
|
229136
229373
|
stepCount,
|
|
229137
229374
|
error: agentResponse.error,
|
|
229138
229375
|
datasetItemId: datasetItem2.id
|
|
@@ -229145,7 +229382,7 @@ var EvaluationService = class {
|
|
|
229145
229382
|
});
|
|
229146
229383
|
stepCount++;
|
|
229147
229384
|
} catch (error92) {
|
|
229148
|
-
|
|
229385
|
+
logger23.error({
|
|
229149
229386
|
error: error92 instanceof Error ? error92.message : String(error92),
|
|
229150
229387
|
stepCount,
|
|
229151
229388
|
datasetItemId: datasetItem2.id
|
|
@@ -229153,7 +229390,7 @@ var EvaluationService = class {
|
|
|
229153
229390
|
break;
|
|
229154
229391
|
}
|
|
229155
229392
|
}
|
|
229156
|
-
|
|
229393
|
+
logger23.info({
|
|
229157
229394
|
datasetItemId: datasetItem2.id,
|
|
229158
229395
|
conversationId,
|
|
229159
229396
|
finalStepCount: stepCount,
|
|
@@ -229207,7 +229444,7 @@ Generate the next user message:`;
|
|
|
229207
229444
|
const validMessages = input.messages.map((msg) => {
|
|
229208
229445
|
const mappedRole = roleMap[msg.role.toLowerCase()];
|
|
229209
229446
|
if (!mappedRole) {
|
|
229210
|
-
|
|
229447
|
+
logger23.warn({
|
|
229211
229448
|
datasetItemId: datasetItem2.id,
|
|
229212
229449
|
invalidRole: msg.role
|
|
229213
229450
|
}, "Invalid message role found, skipping message");
|
|
@@ -229219,7 +229456,7 @@ Generate the next user message:`;
|
|
|
229219
229456
|
};
|
|
229220
229457
|
}).filter((msg) => msg !== null);
|
|
229221
229458
|
if (validMessages.length === 0) {
|
|
229222
|
-
|
|
229459
|
+
logger23.warn({
|
|
229223
229460
|
datasetItemId: datasetItem2.id,
|
|
229224
229461
|
totalMessages: input.messages.length
|
|
229225
229462
|
}, "No valid messages found after filtering roles");
|
|
@@ -229234,7 +229471,7 @@ Generate the next user message:`;
|
|
|
229234
229471
|
const validMessages = parsed.messages.map((msg) => {
|
|
229235
229472
|
const mappedRole = roleMap[msg.role?.toLowerCase()];
|
|
229236
229473
|
if (!mappedRole) {
|
|
229237
|
-
|
|
229474
|
+
logger23.warn({
|
|
229238
229475
|
datasetItemId: datasetItem2.id,
|
|
229239
229476
|
invalidRole: msg.role
|
|
229240
229477
|
}, "Invalid message role found in parsed input, skipping message");
|
|
@@ -229259,69 +229496,6 @@ Generate the next user message:`;
|
|
|
229259
229496
|
return null;
|
|
229260
229497
|
}
|
|
229261
229498
|
/**
|
|
229262
|
-
* Parse SSE (Server-Sent Events) response from chat API
|
|
229263
|
-
* Handles text deltas, error operations, and other data operations
|
|
229264
|
-
*/
|
|
229265
|
-
parseSSEResponse(sseText) {
|
|
229266
|
-
let textContent = "";
|
|
229267
|
-
let hasError = false;
|
|
229268
|
-
let errorMessage = "";
|
|
229269
|
-
const lines = sseText.split("\n").filter((line2) => line2.startsWith("data: "));
|
|
229270
|
-
for (const line2 of lines) {
|
|
229271
|
-
try {
|
|
229272
|
-
const data = JSON.parse(line2.slice(6));
|
|
229273
|
-
if (data.object === "chat.completion.chunk" && data.choices?.[0]?.delta) {
|
|
229274
|
-
const delta = data.choices[0].delta;
|
|
229275
|
-
if (delta.content) {
|
|
229276
|
-
textContent += delta.content;
|
|
229277
|
-
}
|
|
229278
|
-
if (delta.content && typeof delta.content === "string") {
|
|
229279
|
-
try {
|
|
229280
|
-
const parsedContent = JSON.parse(delta.content);
|
|
229281
|
-
if (parsedContent.type === "data-operation" && parsedContent.data?.type === "error") {
|
|
229282
|
-
hasError = true;
|
|
229283
|
-
errorMessage = parsedContent.data.message || "Unknown error occurred";
|
|
229284
|
-
logger21.warn({
|
|
229285
|
-
errorMessage,
|
|
229286
|
-
errorData: parsedContent.data
|
|
229287
|
-
}, "Received error operation from chat API");
|
|
229288
|
-
}
|
|
229289
|
-
} catch {
|
|
229290
|
-
}
|
|
229291
|
-
}
|
|
229292
|
-
} else if (data.type === "text-delta" && data.delta) {
|
|
229293
|
-
textContent += data.delta;
|
|
229294
|
-
} else if (data.type === "data-operation" && data.data?.type === "error") {
|
|
229295
|
-
hasError = true;
|
|
229296
|
-
errorMessage = data.data.message || "Unknown error occurred";
|
|
229297
|
-
logger21.warn({
|
|
229298
|
-
errorMessage,
|
|
229299
|
-
errorData: data.data
|
|
229300
|
-
}, "Received error operation from chat API");
|
|
229301
|
-
} else if (data.type === "error") {
|
|
229302
|
-
hasError = true;
|
|
229303
|
-
errorMessage = data.message || "Unknown error occurred";
|
|
229304
|
-
logger21.warn({
|
|
229305
|
-
errorMessage,
|
|
229306
|
-
errorData: data
|
|
229307
|
-
}, "Received error event from chat API");
|
|
229308
|
-
} else if (data.content) {
|
|
229309
|
-
textContent += typeof data.content === "string" ? data.content : JSON.stringify(data.content);
|
|
229310
|
-
}
|
|
229311
|
-
} catch {
|
|
229312
|
-
}
|
|
229313
|
-
}
|
|
229314
|
-
if (hasError) {
|
|
229315
|
-
return {
|
|
229316
|
-
text: textContent.trim(),
|
|
229317
|
-
error: errorMessage
|
|
229318
|
-
};
|
|
229319
|
-
}
|
|
229320
|
-
return {
|
|
229321
|
-
text: textContent.trim()
|
|
229322
|
-
};
|
|
229323
|
-
}
|
|
229324
|
-
/**
|
|
229325
229499
|
* Run an evaluation job based on an evaluation job config
|
|
229326
229500
|
* Filters conversations based on jobFilters and runs evaluations with configured evaluators
|
|
229327
229501
|
*/
|
|
@@ -229332,7 +229506,7 @@ Generate the next user message:`;
|
|
|
229332
229506
|
if (!resolvedRef) {
|
|
229333
229507
|
throw new Error("Failed to resolve ref");
|
|
229334
229508
|
}
|
|
229335
|
-
|
|
229509
|
+
logger23.info({
|
|
229336
229510
|
tenantId,
|
|
229337
229511
|
projectId,
|
|
229338
229512
|
evaluationJobConfigId,
|
|
@@ -229369,7 +229543,7 @@ Generate the next user message:`;
|
|
|
229369
229543
|
if (validEvaluators.length === 0) {
|
|
229370
229544
|
throw new Error(`No valid evaluators found for job config: ${evaluationJobConfigId}`);
|
|
229371
229545
|
}
|
|
229372
|
-
|
|
229546
|
+
logger23.info({
|
|
229373
229547
|
tenantId,
|
|
229374
229548
|
projectId,
|
|
229375
229549
|
evaluationJobConfigId,
|
|
@@ -229385,7 +229559,7 @@ Generate the next user message:`;
|
|
|
229385
229559
|
if (sampleRate !== void 0 && sampleRate !== null) {
|
|
229386
229560
|
const originalCount = conversationsToEvaluate.length;
|
|
229387
229561
|
conversationsToEvaluate = this.applySampleRate(conversationsToEvaluate, sampleRate);
|
|
229388
|
-
|
|
229562
|
+
logger23.info({
|
|
229389
229563
|
tenantId,
|
|
229390
229564
|
projectId,
|
|
229391
229565
|
evaluationJobConfigId,
|
|
@@ -229394,14 +229568,14 @@ Generate the next user message:`;
|
|
|
229394
229568
|
sampleRate
|
|
229395
229569
|
}, "Applied sample rate to conversations");
|
|
229396
229570
|
}
|
|
229397
|
-
|
|
229571
|
+
logger23.info({
|
|
229398
229572
|
tenantId,
|
|
229399
229573
|
projectId,
|
|
229400
229574
|
evaluationJobConfigId,
|
|
229401
229575
|
conversationCount: conversationsToEvaluate.length
|
|
229402
229576
|
}, "Found conversations for evaluation");
|
|
229403
229577
|
if (conversationsToEvaluate.length === 0) {
|
|
229404
|
-
|
|
229578
|
+
logger23.warn({
|
|
229405
229579
|
tenantId,
|
|
229406
229580
|
projectId,
|
|
229407
229581
|
evaluationJobConfigId
|
|
@@ -229418,7 +229592,7 @@ Generate the next user message:`;
|
|
|
229418
229592
|
for (const conversation of conversationsToEvaluate) {
|
|
229419
229593
|
for (const evaluator2 of validEvaluators) {
|
|
229420
229594
|
try {
|
|
229421
|
-
|
|
229595
|
+
logger23.info({
|
|
229422
229596
|
tenantId,
|
|
229423
229597
|
conversationId: conversation.id,
|
|
229424
229598
|
evaluatorId: evaluator2.id
|
|
@@ -229451,14 +229625,14 @@ Generate the next user message:`;
|
|
|
229451
229625
|
if (updatedResult) {
|
|
229452
229626
|
results.push(updatedResult);
|
|
229453
229627
|
}
|
|
229454
|
-
|
|
229628
|
+
logger23.info({
|
|
229455
229629
|
tenantId,
|
|
229456
229630
|
conversationId: conversation.id,
|
|
229457
229631
|
evaluatorId: evaluator2.id,
|
|
229458
229632
|
resultId: evalResult.id
|
|
229459
229633
|
}, "Evaluation completed successfully");
|
|
229460
229634
|
} catch (error92) {
|
|
229461
|
-
|
|
229635
|
+
logger23.error({
|
|
229462
229636
|
error: error92,
|
|
229463
229637
|
tenantId,
|
|
229464
229638
|
conversationId: conversation.id,
|
|
@@ -229483,7 +229657,7 @@ Generate the next user message:`;
|
|
|
229483
229657
|
}
|
|
229484
229658
|
}
|
|
229485
229659
|
} catch (error92) {
|
|
229486
|
-
|
|
229660
|
+
logger23.error({
|
|
229487
229661
|
error: error92 instanceof Error ? error92.message : String(error92),
|
|
229488
229662
|
tenantId,
|
|
229489
229663
|
conversationId: conversation.id,
|
|
@@ -229492,7 +229666,7 @@ Generate the next user message:`;
|
|
|
229492
229666
|
}
|
|
229493
229667
|
}
|
|
229494
229668
|
}
|
|
229495
|
-
|
|
229669
|
+
logger23.info({
|
|
229496
229670
|
tenantId,
|
|
229497
229671
|
projectId,
|
|
229498
229672
|
evaluationJobConfigId,
|
|
@@ -229562,20 +229736,20 @@ Generate the next user message:`;
|
|
|
229562
229736
|
}
|
|
229563
229737
|
}));
|
|
229564
229738
|
} else {
|
|
229565
|
-
|
|
229739
|
+
logger23.warn({
|
|
229566
229740
|
conversationId: conversation.id,
|
|
229567
229741
|
agentId: conversation.agentId
|
|
229568
229742
|
}, "AgentId not found, cannot get agent definition");
|
|
229569
229743
|
}
|
|
229570
229744
|
} catch (error92) {
|
|
229571
|
-
|
|
229745
|
+
logger23.warn({
|
|
229572
229746
|
error: error92,
|
|
229573
229747
|
conversationId: conversation.id,
|
|
229574
229748
|
agentId: conversation.agentId
|
|
229575
229749
|
}, "Failed to fetch agent definition for evaluation");
|
|
229576
229750
|
}
|
|
229577
229751
|
const prettifiedTrace = await this.fetchTraceFromSigNoz(conversation.id);
|
|
229578
|
-
|
|
229752
|
+
logger23.info({
|
|
229579
229753
|
conversationId: conversation.id,
|
|
229580
229754
|
hasTrace: !!prettifiedTrace,
|
|
229581
229755
|
traceActivityCount: prettifiedTrace?.timeline?.length || 0
|
|
@@ -229589,7 +229763,7 @@ Generate the next user message:`;
|
|
|
229589
229763
|
try {
|
|
229590
229764
|
schemaObj = JSON.parse(evaluator2.schema);
|
|
229591
229765
|
} catch (error92) {
|
|
229592
|
-
|
|
229766
|
+
logger23.error({
|
|
229593
229767
|
error: error92,
|
|
229594
229768
|
schemaString: evaluator2.schema
|
|
229595
229769
|
}, "Failed to parse evaluator schema string");
|
|
@@ -229598,7 +229772,7 @@ Generate the next user message:`;
|
|
|
229598
229772
|
} else {
|
|
229599
229773
|
schemaObj = evaluator2.schema;
|
|
229600
229774
|
}
|
|
229601
|
-
|
|
229775
|
+
logger23.info({
|
|
229602
229776
|
evaluatorId: evaluator2.id,
|
|
229603
229777
|
schemaType: typeof schemaObj,
|
|
229604
229778
|
schemaKeys: schemaObj && typeof schemaObj === "object" ? Object.keys(schemaObj) : []
|
|
@@ -229663,13 +229837,13 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229663
229837
|
let resultSchema;
|
|
229664
229838
|
try {
|
|
229665
229839
|
resultSchema = external_exports.fromJSONSchema(schema);
|
|
229666
|
-
|
|
229840
|
+
logger23.info({
|
|
229667
229841
|
schemaType: typeof schema,
|
|
229668
229842
|
schemaKeys: schema && typeof schema === "object" ? Object.keys(schema) : [],
|
|
229669
229843
|
convertedSchema: "success"
|
|
229670
229844
|
}, "Converted JSON schema to Zod");
|
|
229671
229845
|
} catch (error92) {
|
|
229672
|
-
|
|
229846
|
+
logger23.error({
|
|
229673
229847
|
error: error92,
|
|
229674
229848
|
schema
|
|
229675
229849
|
}, "Failed to convert JSON schema to Zod, using fallback");
|
|
@@ -229677,7 +229851,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229677
229851
|
}
|
|
229678
229852
|
const evaluationSchema = resultSchema;
|
|
229679
229853
|
try {
|
|
229680
|
-
|
|
229854
|
+
logger23.info({
|
|
229681
229855
|
promptLength: prompt.length,
|
|
229682
229856
|
model: modelConfig.model
|
|
229683
229857
|
}, "Calling generateObject");
|
|
@@ -229695,7 +229869,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229695
229869
|
};
|
|
229696
229870
|
} catch (error92) {
|
|
229697
229871
|
const errorMessage = error92 instanceof Error ? error92.message : String(error92);
|
|
229698
|
-
|
|
229872
|
+
logger23.error({
|
|
229699
229873
|
error: errorMessage,
|
|
229700
229874
|
schema: JSON.stringify(schema, null, 2),
|
|
229701
229875
|
promptPreview: prompt.substring(0, 500)
|
|
@@ -229712,7 +229886,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229712
229886
|
const retryDelayMs = 2e4;
|
|
229713
229887
|
const initialDelayMs = 3e4;
|
|
229714
229888
|
try {
|
|
229715
|
-
|
|
229889
|
+
logger23.info({
|
|
229716
229890
|
conversationId,
|
|
229717
229891
|
manageUIUrl,
|
|
229718
229892
|
initialDelayMs
|
|
@@ -229720,21 +229894,21 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229720
229894
|
await new Promise((resolve4) => setTimeout(resolve4, initialDelayMs));
|
|
229721
229895
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
229722
229896
|
try {
|
|
229723
|
-
|
|
229897
|
+
logger23.info({
|
|
229724
229898
|
conversationId,
|
|
229725
229899
|
attempt: attempt + 1,
|
|
229726
229900
|
maxRetries: maxRetries + 1
|
|
229727
229901
|
}, "Fetching trace from SigNoz");
|
|
229728
229902
|
const traceResponse = await fetch(`${manageUIUrl}/api/signoz/conversations/${conversationId}`);
|
|
229729
229903
|
if (!traceResponse.ok) {
|
|
229730
|
-
|
|
229904
|
+
logger23.warn({
|
|
229731
229905
|
conversationId,
|
|
229732
229906
|
status: traceResponse.status,
|
|
229733
229907
|
statusText: traceResponse.statusText,
|
|
229734
229908
|
attempt: attempt + 1
|
|
229735
229909
|
}, "Failed to fetch trace from SigNoz");
|
|
229736
229910
|
if (attempt < maxRetries) {
|
|
229737
|
-
|
|
229911
|
+
logger23.info({
|
|
229738
229912
|
conversationId,
|
|
229739
229913
|
retryDelayMs
|
|
229740
229914
|
}, "Retrying trace fetch after delay");
|
|
@@ -229744,34 +229918,34 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229744
229918
|
return null;
|
|
229745
229919
|
}
|
|
229746
229920
|
const conversationDetail = await traceResponse.json();
|
|
229747
|
-
|
|
229921
|
+
logger23.debug({
|
|
229748
229922
|
conversationId,
|
|
229749
229923
|
activityTypes: conversationDetail.activities?.map((a2) => a2.type) || [],
|
|
229750
229924
|
activityCount: conversationDetail.activities?.length || 0
|
|
229751
229925
|
}, "Checking activities for ai_assistant_message type");
|
|
229752
229926
|
const hasAssistantMessage = conversationDetail.activities?.some((activity) => activity.type === "ai_assistant_message");
|
|
229753
229927
|
if (!hasAssistantMessage) {
|
|
229754
|
-
|
|
229928
|
+
logger23.warn({
|
|
229755
229929
|
conversationId,
|
|
229756
229930
|
attempt: attempt + 1,
|
|
229757
229931
|
activityCount: conversationDetail.activities?.length || 0,
|
|
229758
229932
|
activityTypes: conversationDetail.activities?.slice(0, 5).map((a2) => a2.type) || []
|
|
229759
229933
|
}, "Trace fetched but ai_assistant_message not found in activities");
|
|
229760
229934
|
if (attempt < maxRetries) {
|
|
229761
|
-
|
|
229935
|
+
logger23.info({
|
|
229762
229936
|
conversationId,
|
|
229763
229937
|
retryDelayMs
|
|
229764
229938
|
}, "Retrying trace fetch after delay to wait for assistant message");
|
|
229765
229939
|
await new Promise((resolve4) => setTimeout(resolve4, retryDelayMs));
|
|
229766
229940
|
continue;
|
|
229767
229941
|
}
|
|
229768
|
-
|
|
229942
|
+
logger23.warn({
|
|
229769
229943
|
conversationId,
|
|
229770
229944
|
maxRetries,
|
|
229771
229945
|
activityCount: conversationDetail.activities?.length || 0
|
|
229772
229946
|
}, "Max retries reached, ai_assistant_message not found - proceeding with available trace data");
|
|
229773
229947
|
} else {
|
|
229774
|
-
|
|
229948
|
+
logger23.info({
|
|
229775
229949
|
conversationId,
|
|
229776
229950
|
activityCount: conversationDetail.activities?.length || 0,
|
|
229777
229951
|
attempt: attempt + 1
|
|
@@ -229780,13 +229954,13 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229780
229954
|
const prettifiedTrace = this.formatConversationAsPrettifiedTrace(conversationDetail);
|
|
229781
229955
|
return prettifiedTrace;
|
|
229782
229956
|
} catch (fetchError) {
|
|
229783
|
-
|
|
229957
|
+
logger23.warn({
|
|
229784
229958
|
error: fetchError,
|
|
229785
229959
|
conversationId,
|
|
229786
229960
|
attempt: attempt + 1
|
|
229787
229961
|
}, "Error fetching trace from SigNoz");
|
|
229788
229962
|
if (attempt < maxRetries) {
|
|
229789
|
-
|
|
229963
|
+
logger23.info({
|
|
229790
229964
|
conversationId,
|
|
229791
229965
|
retryDelayMs
|
|
229792
229966
|
}, "Retrying trace fetch after delay");
|
|
@@ -229798,7 +229972,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229798
229972
|
}
|
|
229799
229973
|
return null;
|
|
229800
229974
|
} catch (error92) {
|
|
229801
|
-
|
|
229975
|
+
logger23.warn({
|
|
229802
229976
|
error: error92,
|
|
229803
229977
|
conversationId,
|
|
229804
229978
|
manageUIUrl
|
|
@@ -229835,7 +230009,7 @@ Return your evaluation as a JSON object matching the schema above.`;
|
|
|
229835
230009
|
};
|
|
229836
230010
|
|
|
229837
230011
|
// src/domains/evals/workflow/functions/evaluateConversation.ts
|
|
229838
|
-
var
|
|
230012
|
+
var logger24 = getLogger("workflow-evaluate-conversation");
|
|
229839
230013
|
async function getConversationStep(payload) {
|
|
229840
230014
|
const { tenantId, projectId, conversationId } = payload;
|
|
229841
230015
|
const conv = await getConversation(runDbClient_default)({
|
|
@@ -229903,7 +230077,7 @@ async function executeEvaluatorStep(payload, evaluatorId, conversation) {
|
|
|
229903
230077
|
output
|
|
229904
230078
|
}
|
|
229905
230079
|
});
|
|
229906
|
-
|
|
230080
|
+
logger24.info({
|
|
229907
230081
|
conversationId,
|
|
229908
230082
|
evaluatorId: evaluator2.id,
|
|
229909
230083
|
resultId: evalResult.id
|
|
@@ -229911,7 +230085,7 @@ async function executeEvaluatorStep(payload, evaluatorId, conversation) {
|
|
|
229911
230085
|
return updated;
|
|
229912
230086
|
} catch (error92) {
|
|
229913
230087
|
const errorMessage = error92 instanceof Error ? error92.message : "Unknown error";
|
|
229914
|
-
|
|
230088
|
+
logger24.error({
|
|
229915
230089
|
error: error92,
|
|
229916
230090
|
conversationId,
|
|
229917
230091
|
evaluatorId: evaluator2.id,
|
|
@@ -229934,7 +230108,7 @@ async function executeEvaluatorStep(payload, evaluatorId, conversation) {
|
|
|
229934
230108
|
}
|
|
229935
230109
|
__name(executeEvaluatorStep, "executeEvaluatorStep");
|
|
229936
230110
|
async function logStep(message, data) {
|
|
229937
|
-
|
|
230111
|
+
logger24.info(data, message);
|
|
229938
230112
|
}
|
|
229939
230113
|
__name(logStep, "logStep");
|
|
229940
230114
|
async function _evaluateConversationWorkflow(payload) {
|
|
@@ -229951,7 +230125,7 @@ registerStepFunction("step//src/domains/evals/workflow/functions/evaluateConvers
|
|
|
229951
230125
|
registerStepFunction("step//src/domains/evals/workflow/functions/evaluateConversation.ts//logStep", logStep);
|
|
229952
230126
|
|
|
229953
230127
|
// src/domains/evals/workflow/functions/runDatasetItem.ts
|
|
229954
|
-
var
|
|
230128
|
+
var logger25 = getLogger("workflow-run-dataset-item");
|
|
229955
230129
|
async function callChatApiStep(payload) {
|
|
229956
230130
|
const { tenantId, projectId, agentId, datasetItemId, datasetItemInput, datasetItemSimulationAgent, datasetRunId } = payload;
|
|
229957
230131
|
const evaluationService = new EvaluationService();
|
|
@@ -229967,7 +230141,7 @@ async function callChatApiStep(payload) {
|
|
|
229967
230141
|
datasetItem: datasetItem2,
|
|
229968
230142
|
datasetRunId
|
|
229969
230143
|
});
|
|
229970
|
-
|
|
230144
|
+
logger25.info({
|
|
229971
230145
|
tenantId,
|
|
229972
230146
|
projectId,
|
|
229973
230147
|
datasetItemId,
|
|
@@ -229990,7 +230164,7 @@ async function createRelationStep(payload, conversationId) {
|
|
|
229990
230164
|
conversationId,
|
|
229991
230165
|
datasetItemId
|
|
229992
230166
|
});
|
|
229993
|
-
|
|
230167
|
+
logger25.info({
|
|
229994
230168
|
tenantId,
|
|
229995
230169
|
projectId,
|
|
229996
230170
|
datasetItemId,
|
|
@@ -230004,7 +230178,7 @@ async function createRelationStep(payload, conversationId) {
|
|
|
230004
230178
|
};
|
|
230005
230179
|
} catch (error92) {
|
|
230006
230180
|
if (error92?.cause?.code === "23503" || error92?.code === "23503") {
|
|
230007
|
-
|
|
230181
|
+
logger25.warn({
|
|
230008
230182
|
tenantId,
|
|
230009
230183
|
projectId,
|
|
230010
230184
|
datasetItemId,
|
|
@@ -230035,7 +230209,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230035
230209
|
}
|
|
230036
230210
|
}));
|
|
230037
230211
|
if (!evaluator2) {
|
|
230038
|
-
|
|
230212
|
+
logger25.warn({
|
|
230039
230213
|
evaluatorId
|
|
230040
230214
|
}, "Evaluator not found");
|
|
230041
230215
|
return null;
|
|
@@ -230077,7 +230251,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230077
230251
|
output
|
|
230078
230252
|
}
|
|
230079
230253
|
});
|
|
230080
|
-
|
|
230254
|
+
logger25.info({
|
|
230081
230255
|
conversationId,
|
|
230082
230256
|
evaluatorId: evaluator2.id,
|
|
230083
230257
|
resultId: evalResult.id
|
|
@@ -230085,7 +230259,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230085
230259
|
return evalResult.id;
|
|
230086
230260
|
} catch (error92) {
|
|
230087
230261
|
const errorMessage = error92 instanceof Error ? error92.message : "Unknown error";
|
|
230088
|
-
|
|
230262
|
+
logger25.error({
|
|
230089
230263
|
error: error92,
|
|
230090
230264
|
conversationId,
|
|
230091
230265
|
evaluatorId: evaluator2.id
|
|
@@ -230107,7 +230281,7 @@ async function executeEvaluatorStep2(tenantId, projectId, conversationId, evalua
|
|
|
230107
230281
|
}
|
|
230108
230282
|
__name(executeEvaluatorStep2, "executeEvaluatorStep");
|
|
230109
230283
|
async function logStep2(message, data) {
|
|
230110
|
-
|
|
230284
|
+
logger25.info(data, message);
|
|
230111
230285
|
}
|
|
230112
230286
|
__name(logStep2, "logStep");
|
|
230113
230287
|
async function _runDatasetItemWorkflow(payload) {
|
|
@@ -244161,7 +244335,7 @@ __name(linkToCurrentContext, "linkToCurrentContext");
|
|
|
244161
244335
|
// ../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
|
|
244162
244336
|
function createLogger(namespace) {
|
|
244163
244337
|
const baseDebug = (0, import_debug2.default)(`workflow:${namespace}`);
|
|
244164
|
-
const
|
|
244338
|
+
const logger26 = /* @__PURE__ */ __name((level) => {
|
|
244165
244339
|
const levelDebug = baseDebug.extend(level);
|
|
244166
244340
|
return (message, metadata2) => {
|
|
244167
244341
|
levelDebug(message, metadata2);
|
|
@@ -244177,10 +244351,10 @@ function createLogger(namespace) {
|
|
|
244177
244351
|
};
|
|
244178
244352
|
}, "logger");
|
|
244179
244353
|
return {
|
|
244180
|
-
debug:
|
|
244181
|
-
info:
|
|
244182
|
-
warn:
|
|
244183
|
-
error:
|
|
244354
|
+
debug: logger26("debug"),
|
|
244355
|
+
info: logger26("info"),
|
|
244356
|
+
warn: logger26("warn"),
|
|
244357
|
+
error: logger26("error")
|
|
244184
244358
|
};
|
|
244185
244359
|
}
|
|
244186
244360
|
__name(createLogger, "createLogger");
|