@sentry/junior 0.95.0 → 0.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-hooks-FTQ5EGPO.js → agent-hooks-XSUIVRQS.js} +10 -8
- package/dist/{reporting → api}/conversations/activity.d.ts +1 -1
- package/dist/api/conversations/detail-projection.d.ts +10 -0
- package/dist/api/conversations/detail.d.ts +3 -0
- package/dist/api/conversations/detail.query.d.ts +3 -0
- package/dist/api/conversations/list.d.ts +3 -0
- package/dist/api/conversations/list.query.d.ts +94 -0
- package/dist/api/conversations/projection.d.ts +14 -0
- package/dist/api/conversations/schema.d.ts +683 -0
- package/dist/{reporting → api}/conversations/shared.d.ts +1 -5
- package/dist/api/conversations/stats.d.ts +3 -0
- package/dist/api/conversations/stats.query.d.ts +3 -0
- package/dist/api/conversations/subagent.d.ts +3 -0
- package/dist/{reporting → api}/conversations/transcript.d.ts +4 -4
- package/dist/api/people/list.d.ts +1 -2
- package/dist/api/people/list.query.d.ts +3 -4
- package/dist/api/people/profile.d.ts +1 -2
- package/dist/api/people/profile.query.d.ts +3 -4
- package/dist/api/people/schema.d.ts +193 -0
- package/dist/api/people/shared.d.ts +31 -9
- package/dist/api/schema.d.ts +20 -0
- package/dist/api/schema.js +50 -0
- package/dist/api-reference.d.ts +4 -3
- package/dist/api.d.ts +3 -0
- package/dist/api.js +156 -0
- package/dist/app.d.ts +1 -4
- package/dist/app.js +108 -370
- package/dist/build/virtual-config.d.ts +2 -2
- package/dist/{catalog-runtime-2D7IVKUT.js → catalog-runtime-PFHVMHDR.js} +5 -4
- package/dist/chat/agent/resume.d.ts +3 -1
- package/dist/chat/agent/tools.d.ts +2 -1
- package/dist/chat/config.d.ts +1 -8
- package/dist/chat/conversations/history.d.ts +241 -27
- package/dist/chat/conversations/legacy-advisor-session.d.ts +7 -0
- package/dist/chat/conversations/legacy-import.d.ts +2 -2
- package/dist/chat/conversations/projection.d.ts +19 -3
- package/dist/chat/conversations/sql/legacy-history-import.d.ts +1 -1
- package/dist/chat/conversations/sql/store.d.ts +15 -9
- package/dist/chat/conversations/store.d.ts +9 -4
- package/dist/chat/logging.d.ts +2 -2
- package/dist/chat/model-profile.d.ts +14 -0
- package/dist/chat/pi/transcript.d.ts +5 -3
- package/dist/chat/plugins/auth/oauth-request.d.ts +2 -0
- package/dist/chat/resource-events/notification.d.ts +2 -0
- package/dist/chat/resource-events/store.d.ts +2 -2
- package/dist/chat/runtime/agent-run-outcome.d.ts +3 -0
- package/dist/chat/sentry.d.ts +1 -1
- package/dist/chat/services/context-compaction.d.ts +15 -0
- package/dist/chat/services/turn-result.d.ts +1 -0
- package/dist/chat/services/turn-session-record.d.ts +6 -6
- package/dist/chat/state/turn-session.d.ts +18 -5
- package/dist/chat/task-execution/store.d.ts +2 -2
- package/dist/chat/tools/handoff/tool.d.ts +45 -0
- package/dist/chat/tools/types.d.ts +7 -2
- package/dist/chat/usage.d.ts +27 -13
- package/dist/{chunk-6ONME5IG.js → chunk-35BNLDOJ.js} +339 -578
- package/dist/{chunk-HDTO3A74.js → chunk-3ECW2K2O.js} +8 -3
- package/dist/{chunk-CRRBJ3JP.js → chunk-3F4OPKGF.js} +90 -56
- package/dist/chunk-3V7OFJZC.js +264 -0
- package/dist/chunk-4ZNGQH7C.js +25 -0
- package/dist/{chunk-NSCHU54X.js → chunk-5HLDPVYS.js} +15 -448
- package/dist/{chunk-3DA7X2U3.js → chunk-6GWA276C.js} +15 -0
- package/dist/{chunk-HZNJLKKI.js → chunk-6U26PYI5.js} +24 -14
- package/dist/chunk-AUUCAFDE.js +546 -0
- package/dist/{chunk-6APU57E6.js → chunk-B3IT5END.js} +41 -260
- package/dist/chunk-CEA3A3UA.js +86 -0
- package/dist/{chunk-AYP4ERVZ.js → chunk-D5KZYS4T.js} +1 -1
- package/dist/{chunk-GUE7HTNR.js → chunk-EEZCY5WX.js} +79 -29
- package/dist/{chunk-E3E2XNCN.js → chunk-EOWXRY5E.js} +2 -2
- package/dist/{chunk-5XMNOD3S.js → chunk-FBHZJFHI.js} +3 -3
- package/dist/{chunk-CZEX6KIQ.js → chunk-G3E7SCME.js} +0 -23
- package/dist/chunk-GUAP3H7O.js +319 -0
- package/dist/{chunk-WCMQJE4F.js → chunk-H66UCBPW.js} +7 -5
- package/dist/{chunk-WPOJ443W.js → chunk-I35CTGPO.js} +58 -6
- package/dist/{chunk-GVOUCI2O.js → chunk-LMJPRYHP.js} +16 -6
- package/dist/chunk-LUAE4MGW.js +199 -0
- package/dist/{chunk-GY34VGP5.js → chunk-LVA4I4H7.js} +3 -1
- package/dist/chunk-LVUKF5CE.js +63 -0
- package/dist/{chunk-EKNJM5IG.js → chunk-NG2AV7IB.js} +2 -72
- package/dist/chunk-ON6YKIQ7.js +260 -0
- package/dist/chunk-PDO5BLNM.js +22 -0
- package/dist/chunk-QNVHH5PU.js +20 -0
- package/dist/{chunk-XX4N4E6C.js → chunk-T533JLM3.js} +9 -11
- package/dist/chunk-UAMKJPDF.js +11 -0
- package/dist/chunk-VFH4ZKZT.js +66 -0
- package/dist/{chunk-KDPCGVIT.js → chunk-WGXMTFNU.js} +17 -75
- package/dist/{chunk-WAGQ377B.js → chunk-WJOSZOON.js} +288 -263
- package/dist/chunk-WTYEKPXU.js +451 -0
- package/dist/{chunk-HCXXB35T.js → chunk-XIRPQQVE.js} +613 -369
- package/dist/cli/chat.js +26 -23
- package/dist/cli/check.js +6 -5
- package/dist/cli/init.js +12 -0
- package/dist/cli/main.js +1 -1
- package/dist/cli/plugins.js +14 -11
- package/dist/cli/snapshot-warmup.js +10 -8
- package/dist/cli/upgrade.js +267 -139
- package/dist/db/db.d.ts +4 -0
- package/dist/db/schema/conversations.d.ts +128 -0
- package/dist/db/schema.d.ts +129 -60
- package/dist/{db-W55B74OP.js → db-BWXYIKFQ.js} +5 -5
- package/dist/detail-GA6NXWQJ.js +43 -0
- package/dist/discovery-RMHYSRL7.js +43 -0
- package/dist/handlers/health.d.ts +3 -0
- package/dist/instrumentation.js +2 -2
- package/dist/{legacy-import-ZPLGLAFD.js → legacy-import-3NQJVGQL.js} +6 -6
- package/dist/{api/people/list.js → list-A3WFRIYX.js} +26 -16
- package/dist/list-UXJI5Q5X.js +27 -0
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +2 -1
- package/dist/plugin-conversations-DDNGC35A.js +36 -0
- package/dist/{api/people/profile.js → profile-4RYDXWTF.js} +33 -18
- package/dist/reporting/plugin-conversations.d.ts +3 -0
- package/dist/reporting-schema.d.ts +140 -0
- package/dist/reporting.d.ts +12 -81
- package/dist/{runner-OOSBDYRK.js → runner-JALSYH2P.js} +19 -14
- package/dist/{sentry-EGFOV3DH.js → sentry-JMWTS32N.js} +11 -1
- package/dist/skills-MAZXZ2KE.js +26 -0
- package/dist/stats-XKXH3PTY.js +217 -0
- package/dist/subagent-TZ55XY37.js +48 -0
- package/dist/usage-schema.d.ts +25 -0
- package/dist/{validation-QCGRFRFZ.js → validation-FMEAEKCY.js} +6 -5
- package/migrations/0000_initial.sql +115 -0
- package/migrations/0001_conversation_metrics.sql +4 -0
- package/migrations/README.md +12 -30
- package/migrations/meta/0000_snapshot.json +1 -33
- package/migrations/meta/0001_snapshot.json +972 -0
- package/migrations/meta/_journal.json +9 -2
- package/package.json +14 -18
- package/dist/api/people/types.d.ts +0 -85
- package/dist/chat/advisor-request.d.ts +0 -4
- package/dist/chat/conversations/sql/migrations.d.ts +0 -22
- package/dist/chat/tools/advisor/session-store.d.ts +0 -9
- package/dist/chat/tools/advisor/tool.d.ts +0 -72
- package/dist/chunk-N4RNJ32C.js +0 -48
- package/dist/chunk-RAIB6WSG.js +0 -142
- package/dist/db/schema/migrations.d.ts +0 -58
- package/dist/reporting/conversations/context.d.ts +0 -8
- package/dist/reporting/conversations/details.d.ts +0 -6
- package/dist/reporting/conversations/index.d.ts +0 -4
- package/dist/reporting/conversations/statistics.d.ts +0 -4
- package/dist/reporting/conversations/summaries.d.ts +0 -17
- package/dist/reporting/conversations/types.d.ts +0 -178
- package/dist/reporting/conversations.d.ts +0 -1
- package/dist/reporting.js +0 -1065
|
@@ -4,12 +4,13 @@ import {
|
|
|
4
4
|
} from "./chunk-OB42YVAE.js";
|
|
5
5
|
import {
|
|
6
6
|
captureException,
|
|
7
|
+
getActiveSpan,
|
|
7
8
|
sentry_exports,
|
|
8
9
|
setTag,
|
|
9
10
|
setUser,
|
|
10
11
|
startSpan,
|
|
11
12
|
withScope
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6GWA276C.js";
|
|
13
14
|
import {
|
|
14
15
|
getDeploymentTelemetryAttributes,
|
|
15
16
|
parseSlackTeamId
|
|
@@ -1184,14 +1185,14 @@ function getTracePropagationHeaders() {
|
|
|
1184
1185
|
return headers;
|
|
1185
1186
|
}
|
|
1186
1187
|
function setSpanAttributes(attributes) {
|
|
1187
|
-
const span = (
|
|
1188
|
+
const span = getActiveSpan();
|
|
1188
1189
|
if (!span) {
|
|
1189
1190
|
return;
|
|
1190
1191
|
}
|
|
1191
1192
|
setAttributesOnSpan(span, attributes);
|
|
1192
1193
|
}
|
|
1193
1194
|
function setSpanStatus(status) {
|
|
1194
|
-
const span = (
|
|
1195
|
+
const span = getActiveSpan();
|
|
1195
1196
|
if (!span) {
|
|
1196
1197
|
return;
|
|
1197
1198
|
}
|
|
@@ -1288,6 +1289,12 @@ function toFiniteTokenCount(value) {
|
|
|
1288
1289
|
const rounded = Math.floor(value);
|
|
1289
1290
|
return rounded >= 0 ? rounded : void 0;
|
|
1290
1291
|
}
|
|
1292
|
+
function toFiniteCost(value) {
|
|
1293
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
1294
|
+
}
|
|
1295
|
+
function addCost(left, right) {
|
|
1296
|
+
return Math.round(((left ?? 0) + right) * 1e12) / 1e12;
|
|
1297
|
+
}
|
|
1291
1298
|
function sumTokenCounts(...values) {
|
|
1292
1299
|
let total = 0;
|
|
1293
1300
|
let hasValue = false;
|
|
@@ -1305,8 +1312,16 @@ var PI_USAGE_FIELDS = [
|
|
|
1305
1312
|
["output", "outputTokens"],
|
|
1306
1313
|
["cacheRead", "cachedInputTokens"],
|
|
1307
1314
|
["cacheWrite", "cacheCreationTokens"],
|
|
1315
|
+
["reasoning", "reasoningTokens"],
|
|
1308
1316
|
["totalTokens", "totalTokens"]
|
|
1309
1317
|
];
|
|
1318
|
+
var PI_COST_FIELDS = [
|
|
1319
|
+
"input",
|
|
1320
|
+
"output",
|
|
1321
|
+
"cacheRead",
|
|
1322
|
+
"cacheWrite",
|
|
1323
|
+
"total"
|
|
1324
|
+
];
|
|
1310
1325
|
function readPiUsage(source) {
|
|
1311
1326
|
const record = asRecord(source);
|
|
1312
1327
|
if (!record) {
|
|
@@ -1320,17 +1335,46 @@ function readPiUsage(source) {
|
|
|
1320
1335
|
summary[ourKey] = value;
|
|
1321
1336
|
}
|
|
1322
1337
|
}
|
|
1338
|
+
const piCost = asRecord(usage.cost);
|
|
1339
|
+
if (piCost) {
|
|
1340
|
+
const cost = {};
|
|
1341
|
+
for (const field of PI_COST_FIELDS) {
|
|
1342
|
+
const value = toFiniteCost(piCost[field]);
|
|
1343
|
+
if (value !== void 0) {
|
|
1344
|
+
cost[field] = value;
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
if (Object.keys(cost).length > 0) {
|
|
1348
|
+
summary.cost = cost;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1323
1351
|
return summary;
|
|
1324
1352
|
}
|
|
1325
1353
|
function extractGenAiUsageSummary(...sources) {
|
|
1326
1354
|
const summary = {};
|
|
1355
|
+
const cost = {};
|
|
1327
1356
|
for (const source of sources) {
|
|
1328
1357
|
const single = readPiUsage(source);
|
|
1329
|
-
for (const field of
|
|
1358
|
+
for (const field of [
|
|
1359
|
+
"inputTokens",
|
|
1360
|
+
"outputTokens",
|
|
1361
|
+
"cachedInputTokens",
|
|
1362
|
+
"cacheCreationTokens",
|
|
1363
|
+
"reasoningTokens",
|
|
1364
|
+
"totalTokens"
|
|
1365
|
+
]) {
|
|
1330
1366
|
const value = single[field];
|
|
1331
1367
|
if (value === void 0) continue;
|
|
1332
1368
|
summary[field] = (summary[field] ?? 0) + value;
|
|
1333
1369
|
}
|
|
1370
|
+
for (const field of PI_COST_FIELDS) {
|
|
1371
|
+
const value = single.cost?.[field];
|
|
1372
|
+
if (value === void 0) continue;
|
|
1373
|
+
cost[field] = addCost(cost[field], value);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
if (Object.keys(cost).length > 0) {
|
|
1377
|
+
summary.cost = cost;
|
|
1334
1378
|
}
|
|
1335
1379
|
return summary;
|
|
1336
1380
|
}
|
|
@@ -1340,7 +1384,9 @@ function extractGenAiUsageAttributes(...sources) {
|
|
|
1340
1384
|
outputTokens,
|
|
1341
1385
|
cachedInputTokens,
|
|
1342
1386
|
cacheCreationTokens,
|
|
1343
|
-
|
|
1387
|
+
reasoningTokens,
|
|
1388
|
+
totalTokens,
|
|
1389
|
+
cost
|
|
1344
1390
|
} = extractGenAiUsageSummary(...sources);
|
|
1345
1391
|
const semanticInputTokens = sumTokenCounts(
|
|
1346
1392
|
inputTokens,
|
|
@@ -1353,7 +1399,13 @@ function extractGenAiUsageAttributes(...sources) {
|
|
|
1353
1399
|
...outputTokens !== void 0 ? { "gen_ai.usage.output_tokens": outputTokens } : {},
|
|
1354
1400
|
...semanticTotalTokens !== void 0 ? { "gen_ai.usage.total_tokens": semanticTotalTokens } : {},
|
|
1355
1401
|
...cachedInputTokens !== void 0 ? { "gen_ai.usage.input_tokens.cached": cachedInputTokens } : {},
|
|
1356
|
-
...cacheCreationTokens !== void 0 ? { "gen_ai.usage.input_tokens.cache_write": cacheCreationTokens } : {}
|
|
1402
|
+
...cacheCreationTokens !== void 0 ? { "gen_ai.usage.input_tokens.cache_write": cacheCreationTokens } : {},
|
|
1403
|
+
...reasoningTokens !== void 0 ? { "app.ai.reasoning_tokens": reasoningTokens } : {},
|
|
1404
|
+
...cost?.input !== void 0 ? { "app.ai.cost.input_usd": cost.input } : {},
|
|
1405
|
+
...cost?.output !== void 0 ? { "app.ai.cost.output_usd": cost.output } : {},
|
|
1406
|
+
...cost?.cacheRead !== void 0 ? { "app.ai.cost.cache_read_usd": cost.cacheRead } : {},
|
|
1407
|
+
...cost?.cacheWrite !== void 0 ? { "app.ai.cost.cache_write_usd": cost.cacheWrite } : {},
|
|
1408
|
+
...cost?.total !== void 0 ? { "app.ai.cost.total_usd": cost.total } : {}
|
|
1357
1409
|
};
|
|
1358
1410
|
}
|
|
1359
1411
|
|
|
@@ -3,12 +3,14 @@ import {
|
|
|
3
3
|
logWarn,
|
|
4
4
|
parseActorUserId,
|
|
5
5
|
setSpanAttributes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-I35CTGPO.js";
|
|
7
7
|
import {
|
|
8
8
|
discoverInstalledPluginPackageContent,
|
|
9
|
-
normalizePluginPackageNames
|
|
9
|
+
normalizePluginPackageNames
|
|
10
|
+
} from "./chunk-B3IT5END.js";
|
|
11
|
+
import {
|
|
10
12
|
pluginRoots
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3V7OFJZC.js";
|
|
12
14
|
|
|
13
15
|
// src/chat/plugins/registry.ts
|
|
14
16
|
import { readFileSync, readdirSync, statSync } from "fs";
|
|
@@ -1313,7 +1315,10 @@ function buildOAuthTokenRequest(input) {
|
|
|
1313
1315
|
function parseOAuthTokenResponse(data, requestedScope, options) {
|
|
1314
1316
|
const response = requireTokenResponseObject(data);
|
|
1315
1317
|
const accessToken = requireNonEmptyTokenField(response, "access_token");
|
|
1316
|
-
const
|
|
1318
|
+
const resolvedRefreshToken = response.refresh_token === void 0 ? options?.refreshToken : requireNonEmptyTokenField(response, "refresh_token");
|
|
1319
|
+
if (!resolvedRefreshToken) {
|
|
1320
|
+
throw new Error("OAuth token response missing refresh_token");
|
|
1321
|
+
}
|
|
1317
1322
|
const expiresIn = response.expires_in;
|
|
1318
1323
|
const refreshTokenExpiresIn = response.refresh_token_expires_in;
|
|
1319
1324
|
const responseScope = response.scope;
|
|
@@ -1333,7 +1338,11 @@ function parseOAuthTokenResponse(data, requestedScope, options) {
|
|
|
1333
1338
|
} else {
|
|
1334
1339
|
scope = normalizeOAuthScope(requestedScope);
|
|
1335
1340
|
}
|
|
1336
|
-
const result = {
|
|
1341
|
+
const result = {
|
|
1342
|
+
accessToken,
|
|
1343
|
+
refreshToken: resolvedRefreshToken,
|
|
1344
|
+
...scope ? { scope } : {}
|
|
1345
|
+
};
|
|
1337
1346
|
if (expiresIn !== void 0) {
|
|
1338
1347
|
if (typeof expiresIn !== "number" || !Number.isFinite(expiresIn) || expiresIn <= 0) {
|
|
1339
1348
|
throw new Error("OAuth token response returned invalid expires_in");
|
|
@@ -1409,7 +1418,8 @@ async function refreshAccessToken(refreshToken, oauth, requestedScope) {
|
|
|
1409
1418
|
}
|
|
1410
1419
|
const data = await response.json();
|
|
1411
1420
|
return parseOAuthTokenResponse(data, requestedScope, {
|
|
1412
|
-
treatEmptyScopeAsUnreported: oauth.treatEmptyScopeAsUnreported
|
|
1421
|
+
treatEmptyScopeAsUnreported: oauth.treatEmptyScopeAsUnreported,
|
|
1422
|
+
refreshToken
|
|
1413
1423
|
});
|
|
1414
1424
|
}
|
|
1415
1425
|
function getLeaseExpiry(expiresAt) {
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import {
|
|
2
|
+
usageSchema
|
|
3
|
+
} from "./chunk-PDO5BLNM.js";
|
|
4
|
+
|
|
5
|
+
// src/api/conversations/schema.ts
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
var conversationReportStatusSchema = z.enum([
|
|
8
|
+
"active",
|
|
9
|
+
"completed",
|
|
10
|
+
"failed",
|
|
11
|
+
"hung"
|
|
12
|
+
]);
|
|
13
|
+
var conversationSurfaceSchema = z.enum([
|
|
14
|
+
"api",
|
|
15
|
+
"internal",
|
|
16
|
+
"scheduler",
|
|
17
|
+
"slack"
|
|
18
|
+
]);
|
|
19
|
+
var conversationUsageSchema = usageSchema;
|
|
20
|
+
var actorIdentitySchema = z.object({
|
|
21
|
+
email: z.string().optional(),
|
|
22
|
+
fullName: z.string().optional(),
|
|
23
|
+
slackUserId: z.string().optional(),
|
|
24
|
+
slackUserName: z.string().optional()
|
|
25
|
+
}).strict();
|
|
26
|
+
var conversationSummaryReportSchema = z.object({
|
|
27
|
+
displayTitle: z.string(),
|
|
28
|
+
cumulativeDurationMs: z.number(),
|
|
29
|
+
cumulativeUsage: conversationUsageSchema.optional(),
|
|
30
|
+
conversationId: z.string(),
|
|
31
|
+
status: conversationReportStatusSchema,
|
|
32
|
+
startedAt: z.string(),
|
|
33
|
+
lastSeenAt: z.string(),
|
|
34
|
+
lastProgressAt: z.string(),
|
|
35
|
+
surface: conversationSurfaceSchema,
|
|
36
|
+
actorIdentity: actorIdentitySchema.optional(),
|
|
37
|
+
channel: z.string().optional(),
|
|
38
|
+
channelName: z.string().optional(),
|
|
39
|
+
channelNameRedacted: z.boolean().optional(),
|
|
40
|
+
sentryTraceUrl: z.string().optional(),
|
|
41
|
+
traceId: z.string().optional()
|
|
42
|
+
}).strict();
|
|
43
|
+
var transcriptPartTypeSchema = z.enum([
|
|
44
|
+
"text",
|
|
45
|
+
"thinking",
|
|
46
|
+
"tool_call",
|
|
47
|
+
"tool_result",
|
|
48
|
+
"unknown"
|
|
49
|
+
]);
|
|
50
|
+
var transcriptPartSchema = z.object({
|
|
51
|
+
bytes: z.number().optional(),
|
|
52
|
+
chars: z.number().optional(),
|
|
53
|
+
id: z.string().optional(),
|
|
54
|
+
input: z.unknown().optional(),
|
|
55
|
+
inputKeys: z.array(z.string()).optional(),
|
|
56
|
+
inputSizeBytes: z.number().optional(),
|
|
57
|
+
inputSizeChars: z.number().optional(),
|
|
58
|
+
inputType: z.string().optional(),
|
|
59
|
+
name: z.string().optional(),
|
|
60
|
+
output: z.unknown().optional(),
|
|
61
|
+
outputKeys: z.array(z.string()).optional(),
|
|
62
|
+
outputSizeBytes: z.number().optional(),
|
|
63
|
+
outputSizeChars: z.number().optional(),
|
|
64
|
+
outputType: z.string().optional(),
|
|
65
|
+
redacted: z.boolean().optional(),
|
|
66
|
+
sourceType: z.string().optional(),
|
|
67
|
+
text: z.string().optional(),
|
|
68
|
+
type: transcriptPartTypeSchema
|
|
69
|
+
}).strict();
|
|
70
|
+
var transcriptRoleSchema = z.enum([
|
|
71
|
+
"assistant",
|
|
72
|
+
"system",
|
|
73
|
+
"tool",
|
|
74
|
+
"toolResult",
|
|
75
|
+
"unknown",
|
|
76
|
+
"user"
|
|
77
|
+
]);
|
|
78
|
+
var transcriptMessageSchema = z.object({
|
|
79
|
+
parts: z.array(transcriptPartSchema),
|
|
80
|
+
role: transcriptRoleSchema,
|
|
81
|
+
timestamp: z.number().optional()
|
|
82
|
+
}).strict();
|
|
83
|
+
var conversationActivityStatusSchema = z.enum([
|
|
84
|
+
"aborted",
|
|
85
|
+
"completed",
|
|
86
|
+
"error",
|
|
87
|
+
"running",
|
|
88
|
+
"success"
|
|
89
|
+
]);
|
|
90
|
+
var conversationSubagentActivityReportSchema = z.object({
|
|
91
|
+
type: z.literal("subagent"),
|
|
92
|
+
createdAt: z.string(),
|
|
93
|
+
endedAt: z.string().optional(),
|
|
94
|
+
id: z.string(),
|
|
95
|
+
modelId: z.string().optional(),
|
|
96
|
+
outcome: z.enum(["success", "error", "aborted"]).optional(),
|
|
97
|
+
parentToolCallId: z.string().optional(),
|
|
98
|
+
reasoningLevel: z.string().optional(),
|
|
99
|
+
status: conversationActivityStatusSchema,
|
|
100
|
+
subagentKind: z.string(),
|
|
101
|
+
transcriptAvailable: z.boolean().optional()
|
|
102
|
+
}).strict();
|
|
103
|
+
var conversationToolActivityReportSchema = z.object({
|
|
104
|
+
type: z.literal("tool_execution"),
|
|
105
|
+
args: z.unknown().optional(),
|
|
106
|
+
createdAt: z.string(),
|
|
107
|
+
id: z.string(),
|
|
108
|
+
inputKeys: z.array(z.string()).optional(),
|
|
109
|
+
inputSizeBytes: z.number().optional(),
|
|
110
|
+
inputSizeChars: z.number().optional(),
|
|
111
|
+
inputType: z.string().optional(),
|
|
112
|
+
redacted: z.boolean().optional(),
|
|
113
|
+
status: conversationActivityStatusSchema,
|
|
114
|
+
subagents: z.array(conversationSubagentActivityReportSchema),
|
|
115
|
+
toolCallId: z.string(),
|
|
116
|
+
toolName: z.string()
|
|
117
|
+
}).strict();
|
|
118
|
+
var conversationActivityReportSchema = z.discriminatedUnion("type", [
|
|
119
|
+
conversationToolActivityReportSchema,
|
|
120
|
+
conversationSubagentActivityReportSchema
|
|
121
|
+
]);
|
|
122
|
+
var conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
123
|
+
activity: z.array(conversationActivityReportSchema).optional(),
|
|
124
|
+
transcriptAvailable: z.boolean(),
|
|
125
|
+
transcriptMetadata: z.array(transcriptMessageSchema).optional(),
|
|
126
|
+
transcriptMessageCount: z.number().optional(),
|
|
127
|
+
transcriptRedacted: z.boolean().optional(),
|
|
128
|
+
transcriptRedactionReason: z.literal("non_public_conversation").optional(),
|
|
129
|
+
transcriptExpired: z.boolean().optional(),
|
|
130
|
+
transcriptExpiredAt: z.string().optional(),
|
|
131
|
+
transcript: z.array(transcriptMessageSchema),
|
|
132
|
+
generatedAt: z.string(),
|
|
133
|
+
sentryConversationUrl: z.string().optional()
|
|
134
|
+
}).strict();
|
|
135
|
+
var conversationSubagentTranscriptReportSchema = z.object({
|
|
136
|
+
type: z.literal("subagent"),
|
|
137
|
+
createdAt: z.string(),
|
|
138
|
+
endedAt: z.string().optional(),
|
|
139
|
+
id: z.string(),
|
|
140
|
+
modelId: z.string().optional(),
|
|
141
|
+
outcome: z.enum(["success", "error", "aborted"]).optional(),
|
|
142
|
+
parentToolCallId: z.string().optional(),
|
|
143
|
+
reasoningLevel: z.string().optional(),
|
|
144
|
+
status: conversationActivityStatusSchema,
|
|
145
|
+
subagentConversationId: z.string().optional(),
|
|
146
|
+
subagentKind: z.string(),
|
|
147
|
+
subagentSentryConversationUrl: z.string().optional(),
|
|
148
|
+
transcript: z.array(transcriptMessageSchema),
|
|
149
|
+
transcriptAvailable: z.boolean(),
|
|
150
|
+
transcriptMessageCount: z.number().optional(),
|
|
151
|
+
transcriptRedacted: z.boolean().optional(),
|
|
152
|
+
transcriptRedactionReason: z.literal("non_public_conversation").optional(),
|
|
153
|
+
transcriptExpired: z.boolean().optional(),
|
|
154
|
+
transcriptExpiredAt: z.string().optional(),
|
|
155
|
+
unavailableReason: z.enum(["missing_transcript_range", "missing_transcript_ref", "not_found"]).optional()
|
|
156
|
+
}).strict();
|
|
157
|
+
var conversationFeedSchema = z.object({
|
|
158
|
+
conversations: z.array(conversationSummaryReportSchema),
|
|
159
|
+
source: z.literal("conversation_index"),
|
|
160
|
+
generatedAt: z.string()
|
|
161
|
+
}).strict();
|
|
162
|
+
var conversationStatsItemSchema = z.object({
|
|
163
|
+
active: z.number(),
|
|
164
|
+
conversations: z.number(),
|
|
165
|
+
durationMs: z.number(),
|
|
166
|
+
failed: z.number(),
|
|
167
|
+
hung: z.number(),
|
|
168
|
+
label: z.string(),
|
|
169
|
+
costUsd: z.number().optional(),
|
|
170
|
+
tokens: z.number().optional()
|
|
171
|
+
}).strict();
|
|
172
|
+
var conversationStatsReportSchema = z.object({
|
|
173
|
+
active: z.number(),
|
|
174
|
+
conversations: z.number(),
|
|
175
|
+
durationMs: z.number(),
|
|
176
|
+
failed: z.number(),
|
|
177
|
+
generatedAt: z.string(),
|
|
178
|
+
hung: z.number(),
|
|
179
|
+
locations: z.array(conversationStatsItemSchema),
|
|
180
|
+
actors: z.array(conversationStatsItemSchema),
|
|
181
|
+
sampleLimit: z.number(),
|
|
182
|
+
sampleSize: z.number(),
|
|
183
|
+
source: z.literal("conversation_index"),
|
|
184
|
+
costUsd: z.number().optional(),
|
|
185
|
+
tokens: z.number().optional(),
|
|
186
|
+
truncated: z.boolean(),
|
|
187
|
+
windowEnd: z.string(),
|
|
188
|
+
windowStart: z.string()
|
|
189
|
+
}).strict();
|
|
190
|
+
|
|
191
|
+
export {
|
|
192
|
+
actorIdentitySchema,
|
|
193
|
+
conversationSummaryReportSchema,
|
|
194
|
+
conversationDetailReportSchema,
|
|
195
|
+
conversationSubagentTranscriptReportSchema,
|
|
196
|
+
conversationFeedSchema,
|
|
197
|
+
conversationStatsItemSchema,
|
|
198
|
+
conversationStatsReportSchema
|
|
199
|
+
};
|
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
parseSlackTeamId
|
|
8
8
|
} from "./chunk-7FBGKXPE.js";
|
|
9
9
|
|
|
10
|
+
// src/chat/conversation-privacy.ts
|
|
11
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
12
|
+
|
|
10
13
|
// src/chat/slack/context.ts
|
|
11
14
|
import { z } from "zod";
|
|
12
15
|
function toTrimmedSlackString(value) {
|
|
@@ -95,7 +98,6 @@ function resolveSlackChannelIdFromMessage(message) {
|
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
// src/chat/conversation-privacy.ts
|
|
98
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
99
101
|
var SAFE_METADATA_KEY_LIMIT = 20;
|
|
100
102
|
var conversationPrivacyStorage = new AsyncLocalStorage();
|
|
101
103
|
function privateNarrowingFromChannelId(channelId) {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getClient
|
|
3
|
+
} from "./chunk-6GWA276C.js";
|
|
4
|
+
|
|
5
|
+
// src/chat/sentry-links.ts
|
|
6
|
+
function getSentryOrgSlug() {
|
|
7
|
+
const slug = process.env.SENTRY_ORG_SLUG?.trim();
|
|
8
|
+
return slug || void 0;
|
|
9
|
+
}
|
|
10
|
+
function isSentrySaasDsnHost(host) {
|
|
11
|
+
return host === "sentry.io" || host.endsWith(".sentry.io");
|
|
12
|
+
}
|
|
13
|
+
function buildSentryWebBaseUrl(dsn) {
|
|
14
|
+
if (isSentrySaasDsnHost(dsn.host)) {
|
|
15
|
+
return "https://sentry.io";
|
|
16
|
+
}
|
|
17
|
+
const port = dsn.port ? `:${dsn.port}` : "";
|
|
18
|
+
const path = dsn.path ? `/${dsn.path}` : "";
|
|
19
|
+
return `${dsn.protocol}://${dsn.host}${port}${path}`;
|
|
20
|
+
}
|
|
21
|
+
function buildSentryConversationUrl(conversationId) {
|
|
22
|
+
const client = getClient();
|
|
23
|
+
const dsn = client?.getDsn();
|
|
24
|
+
if (!dsn?.host || !dsn.projectId) {
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
const orgSlug = getSentryOrgSlug();
|
|
28
|
+
if (!orgSlug) {
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
const encodedId = encodeURIComponent(conversationId);
|
|
32
|
+
const params = new URLSearchParams();
|
|
33
|
+
params.set("project", dsn.projectId);
|
|
34
|
+
const path = `explore/conversations/${encodedId}/?${params.toString()}`;
|
|
35
|
+
if (isSentrySaasDsnHost(dsn.host)) {
|
|
36
|
+
return `https://${orgSlug}.sentry.io/${path}`;
|
|
37
|
+
}
|
|
38
|
+
return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
|
|
39
|
+
}
|
|
40
|
+
function buildSentryTraceUrl(traceId) {
|
|
41
|
+
const client = getClient();
|
|
42
|
+
const dsn = client?.getDsn();
|
|
43
|
+
if (!dsn?.host || !dsn.projectId) {
|
|
44
|
+
return void 0;
|
|
45
|
+
}
|
|
46
|
+
const orgSlug = getSentryOrgSlug();
|
|
47
|
+
if (!orgSlug) {
|
|
48
|
+
return void 0;
|
|
49
|
+
}
|
|
50
|
+
const encodedTraceId = encodeURIComponent(traceId);
|
|
51
|
+
const params = new URLSearchParams();
|
|
52
|
+
params.set("project", dsn.projectId);
|
|
53
|
+
const path = `performance/trace/${encodedTraceId}/?${params.toString()}`;
|
|
54
|
+
if (isSentrySaasDsnHost(dsn.host)) {
|
|
55
|
+
return `https://${orgSlug}.sentry.io/${path}`;
|
|
56
|
+
}
|
|
57
|
+
return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
buildSentryConversationUrl,
|
|
62
|
+
buildSentryTraceUrl
|
|
63
|
+
};
|
|
@@ -1,76 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeSlackConversationId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WTYEKPXU.js";
|
|
4
4
|
import {
|
|
5
5
|
parseSlackThreadId
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
getClient
|
|
9
|
-
} from "./chunk-3DA7X2U3.js";
|
|
10
|
-
|
|
11
|
-
// src/handlers/health.ts
|
|
12
|
-
function GET() {
|
|
13
|
-
return Response.json({
|
|
14
|
-
status: "ok",
|
|
15
|
-
service: "junior",
|
|
16
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// src/chat/sentry-links.ts
|
|
21
|
-
function getSentryOrgSlug() {
|
|
22
|
-
const slug = process.env.SENTRY_ORG_SLUG?.trim();
|
|
23
|
-
return slug || void 0;
|
|
24
|
-
}
|
|
25
|
-
function isSentrySaasDsnHost(host) {
|
|
26
|
-
return host === "sentry.io" || host.endsWith(".sentry.io");
|
|
27
|
-
}
|
|
28
|
-
function buildSentryWebBaseUrl(dsn) {
|
|
29
|
-
if (isSentrySaasDsnHost(dsn.host)) {
|
|
30
|
-
return "https://sentry.io";
|
|
31
|
-
}
|
|
32
|
-
const port = dsn.port ? `:${dsn.port}` : "";
|
|
33
|
-
const path = dsn.path ? `/${dsn.path}` : "";
|
|
34
|
-
return `${dsn.protocol}://${dsn.host}${port}${path}`;
|
|
35
|
-
}
|
|
36
|
-
function buildSentryConversationUrl(conversationId) {
|
|
37
|
-
const client = getClient();
|
|
38
|
-
const dsn = client?.getDsn();
|
|
39
|
-
if (!dsn?.host || !dsn.projectId) {
|
|
40
|
-
return void 0;
|
|
41
|
-
}
|
|
42
|
-
const orgSlug = getSentryOrgSlug();
|
|
43
|
-
if (!orgSlug) {
|
|
44
|
-
return void 0;
|
|
45
|
-
}
|
|
46
|
-
const encodedId = encodeURIComponent(conversationId);
|
|
47
|
-
const params = new URLSearchParams();
|
|
48
|
-
params.set("project", dsn.projectId);
|
|
49
|
-
const path = `explore/conversations/${encodedId}/?${params.toString()}`;
|
|
50
|
-
if (isSentrySaasDsnHost(dsn.host)) {
|
|
51
|
-
return `https://${orgSlug}.sentry.io/${path}`;
|
|
52
|
-
}
|
|
53
|
-
return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
|
|
54
|
-
}
|
|
55
|
-
function buildSentryTraceUrl(traceId) {
|
|
56
|
-
const client = getClient();
|
|
57
|
-
const dsn = client?.getDsn();
|
|
58
|
-
if (!dsn?.host || !dsn.projectId) {
|
|
59
|
-
return void 0;
|
|
60
|
-
}
|
|
61
|
-
const orgSlug = getSentryOrgSlug();
|
|
62
|
-
if (!orgSlug) {
|
|
63
|
-
return void 0;
|
|
64
|
-
}
|
|
65
|
-
const encodedTraceId = encodeURIComponent(traceId);
|
|
66
|
-
const params = new URLSearchParams();
|
|
67
|
-
params.set("project", dsn.projectId);
|
|
68
|
-
const path = `performance/trace/${encodedTraceId}/?${params.toString()}`;
|
|
69
|
-
if (isSentrySaasDsnHost(dsn.host)) {
|
|
70
|
-
return `https://${orgSlug}.sentry.io/${path}`;
|
|
71
|
-
}
|
|
72
|
-
return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
|
|
73
|
-
}
|
|
6
|
+
} from "./chunk-LVA4I4H7.js";
|
|
74
7
|
|
|
75
8
|
// src/chat/slack/conversation-context.ts
|
|
76
9
|
function normalizeConversationName(type, channelName) {
|
|
@@ -155,9 +88,6 @@ function formatSlackConversationRedactedLabel(context) {
|
|
|
155
88
|
}
|
|
156
89
|
|
|
157
90
|
export {
|
|
158
|
-
GET,
|
|
159
|
-
buildSentryConversationUrl,
|
|
160
|
-
buildSentryTraceUrl,
|
|
161
91
|
conversationVisibilityFromSlackChannelType,
|
|
162
92
|
resolveSlackChannelTypeFromMessage,
|
|
163
93
|
resolveSlackConversationContext,
|