@sentry/junior 0.106.0 → 0.107.1
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-KR5BCWOK.js → agent-hooks-ICPIJAFY.js} +9 -7
- package/dist/api/conversations/detail.d.ts +1 -1
- package/dist/api/conversations/events.d.ts +14 -0
- package/dist/api/conversations/schema.d.ts +196 -463
- package/dist/api/schema.d.ts +2 -7
- package/dist/api/schema.js +10 -8
- package/dist/api.js +377 -810
- package/dist/app.js +3586 -3614
- package/dist/{catalog-runtime-5CVM2DOF.js → catalog-runtime-FOFNPR3P.js} +3 -2
- package/dist/chat/agent/prompt.d.ts +1 -1
- package/dist/chat/agent/request.d.ts +28 -29
- package/dist/chat/agent/resume.d.ts +7 -7
- package/dist/chat/agent/session.d.ts +5 -6
- package/dist/chat/agent/tools.d.ts +3 -3
- package/dist/chat/agent-dispatch/runner.d.ts +2 -0
- package/dist/chat/config.d.ts +2 -2
- package/dist/chat/conversations/history.d.ts +582 -167
- package/dist/chat/conversations/message-projection.d.ts +6 -0
- package/dist/chat/conversations/message-summaries.d.ts +9 -0
- package/dist/chat/conversations/messages.d.ts +13 -27
- package/dist/chat/conversations/projection.d.ts +30 -53
- package/dist/chat/conversations/provenance.d.ts +42 -0
- package/dist/chat/conversations/search.d.ts +2 -2
- package/dist/chat/conversations/sql/conversation-row.d.ts +1 -1
- package/dist/chat/conversations/sql/event-lock.d.ts +3 -0
- package/dist/chat/conversations/sql/history.d.ts +3 -3
- package/dist/chat/conversations/sql/privacy.d.ts +27 -0
- package/dist/chat/conversations/sql/purge.d.ts +2 -10
- package/dist/chat/conversations/sql/store.d.ts +0 -5
- package/dist/chat/conversations/store.d.ts +8 -13
- package/dist/chat/conversations/turn-lifecycle.d.ts +41 -0
- package/dist/chat/db.d.ts +4 -10
- package/dist/chat/model-profile.d.ts +10 -0
- package/dist/chat/oauth-flow.d.ts +0 -5
- package/dist/chat/pi/conversation-events.d.ts +33 -0
- package/dist/chat/pi/sql-model-usage.d.ts +10 -0
- package/dist/chat/plugins/agent-hooks.d.ts +4 -2
- package/dist/chat/resource-events/ingest.d.ts +0 -13
- package/dist/chat/runtime/delivered-turn-state.d.ts +1 -1
- package/dist/chat/runtime/generated-artifacts.d.ts +1 -1
- package/dist/chat/runtime/reply-executor.d.ts +2 -0
- package/dist/chat/runtime/slack-resume.d.ts +23 -28
- package/dist/chat/runtime/slack-runtime.d.ts +2 -0
- package/dist/chat/runtime/turn.d.ts +14 -1
- package/dist/chat/services/context-compaction-marker.d.ts +0 -1
- package/dist/chat/services/context-compaction.d.ts +1 -0
- package/dist/chat/services/conversation-memory.d.ts +9 -0
- package/dist/chat/services/plugin-auth-orchestration.d.ts +1 -4
- package/dist/chat/services/subscribed-decision.d.ts +1 -1
- package/dist/chat/services/turn-failure-response.d.ts +10 -3
- package/dist/chat/services/turn-result.d.ts +7 -12
- package/dist/chat/services/{turn-reasoning-level.d.ts → turn-router.d.ts} +12 -8
- package/dist/chat/services/turn-session-record.d.ts +15 -16
- package/dist/chat/slack/adapter.d.ts +2 -2
- package/dist/chat/slack/errors.d.ts +2 -0
- package/dist/chat/slack/outbound.d.ts +0 -1
- package/dist/chat/slack/reply.d.ts +2 -8
- package/dist/chat/slack/tools/channel-capabilities.d.ts +2 -2
- package/dist/chat/slack/tools/{send-message.d.ts → send-files.d.ts} +27 -19
- package/dist/chat/state/conversation.d.ts +4 -4
- package/dist/chat/state/turn-id.d.ts +2 -0
- package/dist/chat/state/turn-session-keys.d.ts +6 -0
- package/dist/chat/state/turn-session.d.ts +11 -9
- package/dist/chat/task-execution/state.d.ts +6 -1
- package/dist/chat/task-execution/store.d.ts +1 -1
- package/dist/chat/tool-support/pi-tool-adapter.d.ts +1 -1
- package/dist/chat/tool-support/tool-execution-report.d.ts +1 -0
- package/dist/chat/tools/handoff/tool.d.ts +2 -2
- package/dist/chat/tools/sandbox/file-uploads.d.ts +28 -6
- package/dist/chat/tools/types.d.ts +6 -9
- package/dist/chat/tools/web/image-generate.d.ts +4 -6
- package/dist/{chunk-DDRQ4U7I.js → chunk-4YF7Z6IA.js} +390 -270
- package/dist/{chunk-AZ5OMSN5.js → chunk-AUUOHQAT.js} +2 -2
- package/dist/chunk-B2Z2H66D.js +250 -0
- package/dist/{chunk-4W4O4DCV.js → chunk-CQ7KSO2B.js} +75 -45
- package/dist/{chunk-MJSJAHBW.js → chunk-DY7TRYB5.js} +1 -1
- package/dist/{chunk-GPPUTY5M.js → chunk-EDLNHZH3.js} +861 -891
- package/dist/{chunk-R5BFYK2O.js → chunk-IGHMVDWI.js} +134 -18
- package/dist/chunk-MU6HHZEN.js +99 -0
- package/dist/{chunk-XTKJPSMF.js → chunk-NVOTGWYX.js} +458 -684
- package/dist/{chunk-AEWZ7F65.js → chunk-O24R4DCK.js} +2 -179
- package/dist/{chunk-CCFROYAV.js → chunk-PUAMO4PI.js} +115 -125
- package/dist/{chunk-ZMRLBBD5.js → chunk-RMVOAJRL.js} +30 -13
- package/dist/{chunk-3NYUCBLE.js → chunk-SPUAJVVH.js} +6 -4
- package/dist/{chunk-4UYIRWDW.js → chunk-SS67LUOK.js} +41 -290
- package/dist/{chunk-FXFQNHRU.js → chunk-VFUK3X5B.js} +4 -2
- package/dist/{chunk-3MPPVPGZ.js → chunk-VH6KWKG2.js} +2 -2
- package/dist/chunk-VIXFG2VC.js +182 -0
- package/dist/{chunk-BKM4UXUD.js → chunk-YFQ7CQDE.js} +669 -18
- package/dist/{chunk-77LHNQK4.js → chunk-YIPD3L6L.js} +4 -2
- package/dist/{chunk-3OUSJPR7.js → chunk-YNP2ATQX.js} +6 -4
- package/dist/{chunk-WR7H7VLJ.js → chunk-YT72TOEK.js} +2 -2
- package/dist/cli/chat.js +21 -20
- package/dist/cli/check.js +4 -3
- package/dist/cli/plugins.js +11 -9
- package/dist/cli/snapshot-warmup.js +7 -5
- package/dist/cli/upgrade.js +2041 -105
- package/dist/db/schema/{agent-steps.d.ts → conversation-events.d.ts} +37 -21
- package/dist/db/schema.d.ts +28 -159
- package/dist/{db-S33LFWG2.js → db-DIGO4TGW.js} +6 -8
- package/dist/{runner-HA5XAL6K.js → runner-ACR2HAIC.js} +209 -101
- package/dist/{skills-722AXRV5.js → skills-ITNHBARB.js} +4 -3
- package/dist/{validation-EUI2UFRM.js → validation-AGQ46ZGV.js} +4 -3
- package/migrations/0005_conversation_events.sql +122 -0
- package/migrations/README.md +23 -10
- package/migrations/meta/0005_snapshot.json +948 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -5
- package/dist/api/conversations/activity.d.ts +0 -40
- package/dist/api/conversations/detail-projection.d.ts +0 -11
- package/dist/api/conversations/detail.query.d.ts +0 -3
- package/dist/api/conversations/subagent.d.ts +0 -10
- package/dist/api/conversations/transcript.d.ts +0 -28
- package/dist/chat/conversations/legacy-advisor-session.d.ts +0 -7
- package/dist/chat/conversations/legacy-import.d.ts +0 -38
- package/dist/chat/conversations/sql/legacy-history-import.d.ts +0 -55
- package/dist/chat/conversations/sql/messages.d.ts +0 -4
- package/dist/chat/conversations/visible-compactions.d.ts +0 -11
- package/dist/chat/conversations/visible-messages.d.ts +0 -47
- package/dist/chat/services/reply-delivery-plan.d.ts +0 -5
- package/dist/chat/state/session-log.d.ts +0 -384
- package/dist/chunk-P4P7O5WG.js +0 -1072
- package/dist/chunk-XIMUQ4IU.js +0 -147
- package/dist/db/schema/conversation-messages.d.ts +0 -153
- package/dist/handlers/github-webhook/check-suite.d.ts +0 -3
- package/dist/handlers/github-webhook/issue-comment.d.ts +0 -3
- package/dist/handlers/github-webhook/pull-request-review-comment.d.ts +0 -3
- package/dist/handlers/github-webhook/pull-request-review.d.ts +0 -3
- package/dist/handlers/github-webhook/pull-request.d.ts +0 -3
- package/dist/handlers/github-webhook/resource.d.ts +0 -10
- package/dist/handlers/github-webhook.d.ts +0 -15
- package/dist/legacy-import-TMJISRKO.js +0 -18
|
@@ -12,8 +12,7 @@ import {
|
|
|
12
12
|
withScope
|
|
13
13
|
} from "./chunk-6GWA276C.js";
|
|
14
14
|
import {
|
|
15
|
-
getDeploymentTelemetryAttributes
|
|
16
|
-
parseSlackTeamId
|
|
15
|
+
getDeploymentTelemetryAttributes
|
|
17
16
|
} from "./chunk-7FBGKXPE.js";
|
|
18
17
|
|
|
19
18
|
// src/chat/logging.ts
|
|
@@ -1433,173 +1432,6 @@ function extractGenAiUsageAttributes(...sources) {
|
|
|
1433
1432
|
};
|
|
1434
1433
|
}
|
|
1435
1434
|
|
|
1436
|
-
// src/chat/actor.ts
|
|
1437
|
-
import { z } from "zod";
|
|
1438
|
-
import { actorSchema } from "@sentry/junior-plugin-api";
|
|
1439
|
-
var SLACK_USER_ID_DISPLAY_PATTERN = /^[UW][A-Z0-9]{5,}$/;
|
|
1440
|
-
var EMAIL_PATTERN = /^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;
|
|
1441
|
-
var exactStoredStringSchema = z.string().min(1).refine((value) => value === value.trim());
|
|
1442
|
-
var storedSlackActorSchema = z.object({
|
|
1443
|
-
email: exactStoredStringSchema.optional(),
|
|
1444
|
-
fullName: exactStoredStringSchema.optional(),
|
|
1445
|
-
platform: z.literal("slack").optional(),
|
|
1446
|
-
slackUserId: exactStoredStringSchema.optional(),
|
|
1447
|
-
slackUserName: exactStoredStringSchema.optional(),
|
|
1448
|
-
teamId: exactStoredStringSchema.optional()
|
|
1449
|
-
}).strict();
|
|
1450
|
-
function isUserActor(actor) {
|
|
1451
|
-
return Boolean(actor && "userId" in actor);
|
|
1452
|
-
}
|
|
1453
|
-
function clean(value) {
|
|
1454
|
-
const trimmed = value?.trim();
|
|
1455
|
-
return trimmed ? trimmed : void 0;
|
|
1456
|
-
}
|
|
1457
|
-
function isSyntheticActorUserId(value) {
|
|
1458
|
-
return value.toLowerCase() === "unknown";
|
|
1459
|
-
}
|
|
1460
|
-
function isSlackUserId(value) {
|
|
1461
|
-
return SLACK_USER_ID_DISPLAY_PATTERN.test(value);
|
|
1462
|
-
}
|
|
1463
|
-
function cleanActorDisplayName(value, userId) {
|
|
1464
|
-
const displayName = clean(value);
|
|
1465
|
-
if (!displayName) {
|
|
1466
|
-
return void 0;
|
|
1467
|
-
}
|
|
1468
|
-
if (displayName.toLowerCase() === "unknown") {
|
|
1469
|
-
return void 0;
|
|
1470
|
-
}
|
|
1471
|
-
if (userId && displayName === userId) {
|
|
1472
|
-
return void 0;
|
|
1473
|
-
}
|
|
1474
|
-
return isSlackUserId(displayName) ? void 0 : displayName;
|
|
1475
|
-
}
|
|
1476
|
-
function cleanActorEmail(value) {
|
|
1477
|
-
const email = clean(value);
|
|
1478
|
-
return email && EMAIL_PATTERN.test(email) ? email : void 0;
|
|
1479
|
-
}
|
|
1480
|
-
function parseActorUserId(value) {
|
|
1481
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
1482
|
-
return void 0;
|
|
1483
|
-
}
|
|
1484
|
-
if (value !== value.trim() || isSyntheticActorUserId(value)) {
|
|
1485
|
-
return void 0;
|
|
1486
|
-
}
|
|
1487
|
-
return value;
|
|
1488
|
-
}
|
|
1489
|
-
function isActorUserId(value) {
|
|
1490
|
-
return parseActorUserId(value) === value;
|
|
1491
|
-
}
|
|
1492
|
-
function createActor(input, context) {
|
|
1493
|
-
const platform = context.platform ?? input?.platform;
|
|
1494
|
-
if (!platform) {
|
|
1495
|
-
return void 0;
|
|
1496
|
-
}
|
|
1497
|
-
const contextUserId = parseActorUserId(context.userId);
|
|
1498
|
-
if (context.userId !== void 0 && !contextUserId) {
|
|
1499
|
-
return void 0;
|
|
1500
|
-
}
|
|
1501
|
-
const inputUserId = parseActorUserId(input?.userId);
|
|
1502
|
-
if (input?.userId !== void 0 && !inputUserId) {
|
|
1503
|
-
return void 0;
|
|
1504
|
-
}
|
|
1505
|
-
const actorUserId = contextUserId ?? inputUserId;
|
|
1506
|
-
if (!actorUserId) {
|
|
1507
|
-
return void 0;
|
|
1508
|
-
}
|
|
1509
|
-
const contextTeamId = parseSlackTeamId(context.teamId);
|
|
1510
|
-
if (context.teamId !== void 0 && !contextTeamId) {
|
|
1511
|
-
return void 0;
|
|
1512
|
-
}
|
|
1513
|
-
const inputTeamId = parseSlackTeamId(input?.teamId);
|
|
1514
|
-
if (input?.teamId !== void 0 && !inputTeamId) {
|
|
1515
|
-
return void 0;
|
|
1516
|
-
}
|
|
1517
|
-
const actorTeamId = contextTeamId ?? inputTeamId;
|
|
1518
|
-
if (platform === "slack" && !actorTeamId) {
|
|
1519
|
-
return void 0;
|
|
1520
|
-
}
|
|
1521
|
-
const canUseInputProfile = (!contextUserId || !inputUserId || contextUserId === inputUserId) && (platform !== "slack" || !contextTeamId || !inputTeamId || contextTeamId === inputTeamId);
|
|
1522
|
-
const actor = {
|
|
1523
|
-
...canUseInputProfile && cleanActorEmail(input?.email) ? { email: cleanActorEmail(input?.email) } : {},
|
|
1524
|
-
...canUseInputProfile && cleanActorDisplayName(input?.fullName, actorUserId) ? {
|
|
1525
|
-
fullName: cleanActorDisplayName(input?.fullName, actorUserId)
|
|
1526
|
-
} : {},
|
|
1527
|
-
platform,
|
|
1528
|
-
userId: actorUserId,
|
|
1529
|
-
...canUseInputProfile && cleanActorDisplayName(input?.userName, actorUserId) ? {
|
|
1530
|
-
userName: cleanActorDisplayName(input?.userName, actorUserId)
|
|
1531
|
-
} : {}
|
|
1532
|
-
};
|
|
1533
|
-
if (platform === "slack") {
|
|
1534
|
-
return { ...actor, platform, teamId: actorTeamId };
|
|
1535
|
-
}
|
|
1536
|
-
return { ...actor, platform };
|
|
1537
|
-
}
|
|
1538
|
-
function createSlackActor(teamId, userId, profile) {
|
|
1539
|
-
const actorUserId = parseActorUserId(userId);
|
|
1540
|
-
const actorTeamId = parseSlackTeamId(teamId);
|
|
1541
|
-
if (!actorTeamId || !actorUserId) {
|
|
1542
|
-
throw new Error("Slack actor requires team and user ids");
|
|
1543
|
-
}
|
|
1544
|
-
const actor = createActor(
|
|
1545
|
-
{
|
|
1546
|
-
email: profile?.email,
|
|
1547
|
-
fullName: profile?.fullName,
|
|
1548
|
-
platform: "slack",
|
|
1549
|
-
teamId: actorTeamId,
|
|
1550
|
-
userId: actorUserId,
|
|
1551
|
-
userName: profile?.userName
|
|
1552
|
-
},
|
|
1553
|
-
{ teamId: actorTeamId, userId: actorUserId }
|
|
1554
|
-
);
|
|
1555
|
-
if (!actor || actor.platform !== "slack") {
|
|
1556
|
-
throw new Error("Slack actor requires team and user ids");
|
|
1557
|
-
}
|
|
1558
|
-
return actor;
|
|
1559
|
-
}
|
|
1560
|
-
function parseStoredSlackActor(value) {
|
|
1561
|
-
const parsed = storedSlackActorSchema.safeParse(value);
|
|
1562
|
-
if (!parsed.success) {
|
|
1563
|
-
return void 0;
|
|
1564
|
-
}
|
|
1565
|
-
if (parsed.data.slackUserId !== void 0 && !parseActorUserId(parsed.data.slackUserId)) {
|
|
1566
|
-
return void 0;
|
|
1567
|
-
}
|
|
1568
|
-
if (parsed.data.teamId !== void 0 && !parseSlackTeamId(parsed.data.teamId)) {
|
|
1569
|
-
return void 0;
|
|
1570
|
-
}
|
|
1571
|
-
if ((parsed.data.platform !== void 0 || parsed.data.teamId !== void 0) && (!parsed.data.platform || !parsed.data.teamId)) {
|
|
1572
|
-
return void 0;
|
|
1573
|
-
}
|
|
1574
|
-
return parsed.data;
|
|
1575
|
-
}
|
|
1576
|
-
function toStoredSlackActor(actor) {
|
|
1577
|
-
return {
|
|
1578
|
-
...actor.email ? { email: actor.email } : {},
|
|
1579
|
-
...actor.fullName ? { fullName: actor.fullName } : {},
|
|
1580
|
-
platform: actor.platform,
|
|
1581
|
-
slackUserId: actor.userId,
|
|
1582
|
-
...actor.userName ? { slackUserName: actor.userName } : {},
|
|
1583
|
-
teamId: actor.teamId
|
|
1584
|
-
};
|
|
1585
|
-
}
|
|
1586
|
-
function createSlackResumeActor(args) {
|
|
1587
|
-
if (args.actor) {
|
|
1588
|
-
if (args.actor.platform !== "slack" || args.actor.teamId !== args.teamId || args.actor.userId !== args.userId) {
|
|
1589
|
-
throw new Error("Stored Slack actor did not match resume actor");
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
const actor = createActor(args.actor, {
|
|
1593
|
-
platform: "slack",
|
|
1594
|
-
teamId: args.teamId,
|
|
1595
|
-
userId: args.userId
|
|
1596
|
-
});
|
|
1597
|
-
if (!actor || actor.platform !== "slack") {
|
|
1598
|
-
throw new Error("Slack actor requires team and user ids");
|
|
1599
|
-
}
|
|
1600
|
-
return actor;
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
1435
|
export {
|
|
1604
1436
|
normalizeIdentityEmail,
|
|
1605
1437
|
normalizeGenAiFinishReason,
|
|
@@ -1622,14 +1454,5 @@ export {
|
|
|
1622
1454
|
buildTurnFailureResponse,
|
|
1623
1455
|
serializeGenAiAttribute,
|
|
1624
1456
|
extractGenAiUsageSummary,
|
|
1625
|
-
extractGenAiUsageAttributes
|
|
1626
|
-
storedSlackActorSchema,
|
|
1627
|
-
isUserActor,
|
|
1628
|
-
parseActorUserId,
|
|
1629
|
-
isActorUserId,
|
|
1630
|
-
createActor,
|
|
1631
|
-
createSlackActor,
|
|
1632
|
-
parseStoredSlackActor,
|
|
1633
|
-
toStoredSlackActor,
|
|
1634
|
-
createSlackResumeActor
|
|
1457
|
+
extractGenAiUsageAttributes
|
|
1635
1458
|
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-PDO5BLNM.js";
|
|
4
4
|
import {
|
|
5
5
|
juniorDestinationKindSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VFUK3X5B.js";
|
|
7
7
|
|
|
8
8
|
// src/api/activity.ts
|
|
9
9
|
import { z } from "zod";
|
|
@@ -76,141 +76,131 @@ var conversationSummaryReportSchema = z2.object({
|
|
|
76
76
|
sentryTraceUrl: z2.string().optional(),
|
|
77
77
|
traceId: z2.string().optional()
|
|
78
78
|
}).strict();
|
|
79
|
-
var
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
"
|
|
83
|
-
"tool_result",
|
|
84
|
-
"unknown"
|
|
85
|
-
]);
|
|
86
|
-
var transcriptPartSchema = z2.object({
|
|
87
|
-
bytes: z2.number().optional(),
|
|
88
|
-
chars: z2.number().optional(),
|
|
89
|
-
id: z2.string().optional(),
|
|
90
|
-
input: z2.unknown().optional(),
|
|
91
|
-
inputKeys: z2.array(z2.string()).optional(),
|
|
92
|
-
inputSizeBytes: z2.number().optional(),
|
|
93
|
-
inputSizeChars: z2.number().optional(),
|
|
94
|
-
inputType: z2.string().optional(),
|
|
95
|
-
name: z2.string().optional(),
|
|
96
|
-
output: z2.unknown().optional(),
|
|
97
|
-
outputKeys: z2.array(z2.string()).optional(),
|
|
98
|
-
outputSizeBytes: z2.number().optional(),
|
|
99
|
-
outputSizeChars: z2.number().optional(),
|
|
100
|
-
outputType: z2.string().optional(),
|
|
101
|
-
redacted: z2.boolean().optional(),
|
|
102
|
-
sourceType: z2.string().optional(),
|
|
79
|
+
var conversationReportMessageEventDataSchema = z2.object({
|
|
80
|
+
type: z2.literal("message"),
|
|
81
|
+
messageId: z2.string().min(1),
|
|
82
|
+
role: z2.enum(["assistant", "system", "user"]),
|
|
103
83
|
text: z2.string().optional(),
|
|
104
|
-
|
|
84
|
+
redacted: z2.literal(true).optional()
|
|
85
|
+
}).strict().superRefine((data, context) => {
|
|
86
|
+
if (data.text === void 0 === (data.redacted !== true)) {
|
|
87
|
+
context.addIssue({
|
|
88
|
+
code: "custom",
|
|
89
|
+
message: "message content must be text or explicitly redacted"
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
var conversationReportMessageHandledEventDataSchema = z2.object({
|
|
94
|
+
type: z2.literal("message_handled"),
|
|
95
|
+
messageId: z2.string().min(1)
|
|
105
96
|
}).strict();
|
|
106
|
-
var
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
"tool",
|
|
110
|
-
"toolResult",
|
|
111
|
-
"unknown",
|
|
112
|
-
"user"
|
|
113
|
-
]);
|
|
114
|
-
var transcriptMessageSchema = z2.object({
|
|
115
|
-
outcome: z2.enum(["error", "aborted"]).optional(),
|
|
116
|
-
parts: z2.array(transcriptPartSchema),
|
|
117
|
-
role: transcriptRoleSchema,
|
|
118
|
-
timestamp: z2.number().optional()
|
|
97
|
+
var conversationReportToolStartedEventDataSchema = z2.object({
|
|
98
|
+
type: z2.literal("tool_started"),
|
|
99
|
+
name: z2.string().min(1)
|
|
119
100
|
}).strict();
|
|
120
|
-
var
|
|
121
|
-
"
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
])
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
101
|
+
var conversationReportTurnLifecycleEventDataSchema = z2.discriminatedUnion(
|
|
102
|
+
"state",
|
|
103
|
+
[
|
|
104
|
+
z2.object({
|
|
105
|
+
type: z2.literal("turn_lifecycle"),
|
|
106
|
+
turnId: z2.string().min(1),
|
|
107
|
+
state: z2.enum(["started", "succeeded", "no_reply"])
|
|
108
|
+
}).strict(),
|
|
109
|
+
z2.object({
|
|
110
|
+
type: z2.literal("turn_lifecycle"),
|
|
111
|
+
turnId: z2.string().min(1),
|
|
112
|
+
state: z2.literal("failed"),
|
|
113
|
+
failureKind: z2.enum(["agent", "delivery"])
|
|
114
|
+
}).strict()
|
|
115
|
+
]
|
|
116
|
+
);
|
|
117
|
+
var conversationReportCompactionEventDataSchema = z2.object({ type: z2.literal("compaction") }).strict();
|
|
118
|
+
var conversationReportHandoffEventDataSchema = z2.object({
|
|
119
|
+
type: z2.literal("handoff"),
|
|
120
|
+
toolStartedSeq: z2.number().int().nonnegative().optional()
|
|
139
121
|
}).strict();
|
|
140
|
-
var
|
|
141
|
-
type: z2.literal("
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
inputKeys: z2.array(z2.string()).optional(),
|
|
146
|
-
inputSizeBytes: z2.number().optional(),
|
|
147
|
-
inputSizeChars: z2.number().optional(),
|
|
148
|
-
inputType: z2.string().optional(),
|
|
149
|
-
redacted: z2.boolean().optional(),
|
|
150
|
-
status: conversationActivityStatusSchema,
|
|
151
|
-
subagents: z2.array(conversationSubagentActivityReportSchema),
|
|
152
|
-
toolCallId: z2.string(),
|
|
153
|
-
toolName: z2.string()
|
|
122
|
+
var conversationReportSubagentStartedEventDataSchema = z2.object({
|
|
123
|
+
type: z2.literal("subagent_started"),
|
|
124
|
+
childConversationId: z2.string().min(1),
|
|
125
|
+
subagentKind: z2.string().min(1),
|
|
126
|
+
toolStartedSeq: z2.number().int().nonnegative().optional()
|
|
154
127
|
}).strict();
|
|
155
|
-
var
|
|
156
|
-
|
|
157
|
-
|
|
128
|
+
var conversationReportSubagentEndedEventDataSchema = z2.object({
|
|
129
|
+
type: z2.literal("subagent_ended"),
|
|
130
|
+
startedSeq: z2.number().int().nonnegative(),
|
|
131
|
+
outcome: z2.enum(["success", "error", "aborted"])
|
|
132
|
+
}).strict();
|
|
133
|
+
var conversationReportEventDataSchema = z2.discriminatedUnion("type", [
|
|
134
|
+
conversationReportMessageEventDataSchema,
|
|
135
|
+
conversationReportMessageHandledEventDataSchema,
|
|
136
|
+
conversationReportToolStartedEventDataSchema,
|
|
137
|
+
conversationReportTurnLifecycleEventDataSchema,
|
|
138
|
+
conversationReportCompactionEventDataSchema,
|
|
139
|
+
conversationReportHandoffEventDataSchema,
|
|
140
|
+
conversationReportSubagentStartedEventDataSchema,
|
|
141
|
+
conversationReportSubagentEndedEventDataSchema
|
|
158
142
|
]);
|
|
159
|
-
var
|
|
143
|
+
var conversationReportEventSchema = z2.object({
|
|
144
|
+
seq: z2.number().int().nonnegative(),
|
|
145
|
+
createdAt: z2.string().datetime(),
|
|
146
|
+
data: conversationReportEventDataSchema
|
|
147
|
+
}).strict();
|
|
148
|
+
var conversationEventHistorySchema = z2.discriminatedUnion("status", [
|
|
149
|
+
z2.object({ status: z2.literal("available") }).strict(),
|
|
160
150
|
z2.object({
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
modelId: z2.string().optional(),
|
|
164
|
-
summary: z2.string().optional(),
|
|
165
|
-
transcriptIndex: z2.number().int().nonnegative()
|
|
151
|
+
status: z2.literal("redacted"),
|
|
152
|
+
reason: z2.literal("non_public_conversation")
|
|
166
153
|
}).strict(),
|
|
167
154
|
z2.object({
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
fromModelId: z2.string().optional(),
|
|
171
|
-
message: z2.string().optional(),
|
|
172
|
-
toModelId: z2.string(),
|
|
173
|
-
transcriptIndex: z2.number().int().nonnegative()
|
|
155
|
+
status: z2.literal("expired"),
|
|
156
|
+
expiredAt: z2.string().datetime()
|
|
174
157
|
}).strict()
|
|
175
158
|
]);
|
|
159
|
+
var conversationModelUsageSchema = z2.object({
|
|
160
|
+
modelId: z2.string(),
|
|
161
|
+
usage: conversationUsageSchema
|
|
162
|
+
}).strict();
|
|
176
163
|
var conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
contextEvents: z2.array(conversationContextEventSchema).optional(),
|
|
181
|
-
transcriptAvailable: z2.boolean(),
|
|
182
|
-
transcriptMetadata: z2.array(transcriptMessageSchema).optional(),
|
|
183
|
-
transcriptMessageCount: z2.number().optional(),
|
|
184
|
-
transcriptRedacted: z2.boolean().optional(),
|
|
185
|
-
transcriptRedactionReason: z2.literal("non_public_conversation").optional(),
|
|
186
|
-
transcriptExpired: z2.boolean().optional(),
|
|
187
|
-
transcriptExpiredAt: z2.string().optional(),
|
|
188
|
-
transcript: z2.array(transcriptMessageSchema),
|
|
164
|
+
modelUsage: z2.array(conversationModelUsageSchema).optional(),
|
|
165
|
+
events: z2.array(conversationReportEventSchema),
|
|
166
|
+
eventHistory: conversationEventHistorySchema,
|
|
189
167
|
generatedAt: z2.string(),
|
|
190
168
|
sentryConversationUrl: z2.string().optional()
|
|
191
|
-
}).strict()
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
169
|
+
}).strict().superRefine((report, context) => {
|
|
170
|
+
if (report.eventHistory.status === "expired" && report.events.length > 0) {
|
|
171
|
+
context.addIssue({
|
|
172
|
+
code: "custom",
|
|
173
|
+
path: ["events"],
|
|
174
|
+
message: "expired event history must not contain events"
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
for (let index = 1; index < report.events.length; index += 1) {
|
|
178
|
+
if (report.events[index].seq <= report.events[index - 1].seq) {
|
|
179
|
+
context.addIssue({
|
|
180
|
+
code: "custom",
|
|
181
|
+
path: ["events", index, "seq"],
|
|
182
|
+
message: "report event sequences must be strictly increasing"
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
for (const [index, event] of report.events.entries()) {
|
|
187
|
+
if (event.data.type !== "message") continue;
|
|
188
|
+
if (report.eventHistory.status === "redacted" && event.data.redacted !== true) {
|
|
189
|
+
context.addIssue({
|
|
190
|
+
code: "custom",
|
|
191
|
+
path: ["events", index, "data"],
|
|
192
|
+
message: "redacted event history must redact messages"
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (report.eventHistory.status === "available" && event.data.redacted === true) {
|
|
196
|
+
context.addIssue({
|
|
197
|
+
code: "custom",
|
|
198
|
+
path: ["events", index, "data"],
|
|
199
|
+
message: "available event history must expose messages"
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
});
|
|
214
204
|
var conversationFeedSchema = z2.object({
|
|
215
205
|
conversations: z2.array(conversationSummaryReportSchema),
|
|
216
206
|
source: z2.literal("conversation_index"),
|
|
@@ -345,15 +335,16 @@ var conversationParamsSchema = z5.object({ conversationId: z5.string().min(1) })
|
|
|
345
335
|
var conversationFeedQuerySchema = z5.object({
|
|
346
336
|
actorEmail: z5.string().trim().email().transform((value) => value.toLowerCase()).optional()
|
|
347
337
|
}).strict();
|
|
348
|
-
var subagentParamsSchema = conversationParamsSchema.extend({ subagentId: z5.string().min(1) }).strict();
|
|
349
338
|
var personParamsSchema = z5.object({ email: z5.string().trim().min(1) }).strict();
|
|
350
339
|
var locationParamsSchema = z5.object({ locationId: z5.string().min(1) }).strict();
|
|
351
340
|
|
|
352
341
|
export {
|
|
353
342
|
dailyConversationActivitySchema,
|
|
354
343
|
activityDays,
|
|
344
|
+
conversationReportEventDataSchema,
|
|
345
|
+
conversationReportEventSchema,
|
|
346
|
+
conversationEventHistorySchema,
|
|
355
347
|
conversationDetailReportSchema,
|
|
356
|
-
conversationSubagentTranscriptReportSchema,
|
|
357
348
|
conversationFeedSchema,
|
|
358
349
|
conversationStatsReportSchema,
|
|
359
350
|
actorDirectoryReportSchema,
|
|
@@ -363,7 +354,6 @@ export {
|
|
|
363
354
|
locationDetailReportSchema,
|
|
364
355
|
conversationParamsSchema,
|
|
365
356
|
conversationFeedQuerySchema,
|
|
366
|
-
subagentParamsSchema,
|
|
367
357
|
personParamsSchema,
|
|
368
358
|
locationParamsSchema
|
|
369
359
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPluginLogger,
|
|
3
3
|
createPluginState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AUUOHQAT.js";
|
|
5
5
|
import {
|
|
6
6
|
SANDBOX_WORKSPACE_ROOT
|
|
7
7
|
} from "./chunk-G3E7SCME.js";
|
|
@@ -10,21 +10,24 @@ import {
|
|
|
10
10
|
isConversationScopedChannel,
|
|
11
11
|
isDmChannel,
|
|
12
12
|
normalizeSlackConversationId
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VH6KWKG2.js";
|
|
14
14
|
import {
|
|
15
15
|
getDb
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-NVOTGWYX.js";
|
|
17
17
|
import {
|
|
18
18
|
botConfig,
|
|
19
19
|
completeObject,
|
|
20
|
-
embedTexts
|
|
21
|
-
|
|
20
|
+
embedTexts,
|
|
21
|
+
standardModelId
|
|
22
|
+
} from "./chunk-SS67LUOK.js";
|
|
22
23
|
import {
|
|
23
24
|
isActorUserId,
|
|
24
|
-
logInfo,
|
|
25
|
-
logWarn,
|
|
26
25
|
parseActorUserId
|
|
27
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-VIXFG2VC.js";
|
|
27
|
+
import {
|
|
28
|
+
logInfo,
|
|
29
|
+
logWarn
|
|
30
|
+
} from "./chunk-O24R4DCK.js";
|
|
28
31
|
import {
|
|
29
32
|
parseSlackChannelReferenceId,
|
|
30
33
|
parseSlackMessageTs,
|
|
@@ -32,13 +35,16 @@ import {
|
|
|
32
35
|
} from "./chunk-7FBGKXPE.js";
|
|
33
36
|
|
|
34
37
|
// src/chat/plugins/agent-hooks.ts
|
|
35
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
promptMessageSchema,
|
|
40
|
+
resourceEventSchema
|
|
41
|
+
} from "@sentry/junior-plugin-api";
|
|
36
42
|
|
|
37
43
|
// src/chat/plugins/model.ts
|
|
38
44
|
function createPluginModel(pluginName, options = {}, runtime = {}) {
|
|
39
45
|
return {
|
|
40
46
|
async completeObject(input) {
|
|
41
|
-
const modelId = options.structuredModelId ?? (options.structuredModel === "default" ? botConfig
|
|
47
|
+
const modelId = options.structuredModelId ?? (options.structuredModel === "default" ? standardModelId(botConfig) : botConfig.fastModelId);
|
|
42
48
|
const result = await completeObject({
|
|
43
49
|
modelId,
|
|
44
50
|
schema: input.schema,
|
|
@@ -282,7 +288,7 @@ function verifyScheduledTaskCredentialSubject(input) {
|
|
|
282
288
|
function resolveChannelCapabilities(channelId) {
|
|
283
289
|
return {
|
|
284
290
|
canCreateCanvas: isConversationScopedChannel(channelId),
|
|
285
|
-
|
|
291
|
+
canSendFiles: isConversationScopedChannel(channelId),
|
|
286
292
|
canPostToChannel: isConversationChannel(channelId),
|
|
287
293
|
canAddReactions: isConversationScopedChannel(channelId)
|
|
288
294
|
};
|
|
@@ -668,7 +674,7 @@ function routeMethods(route, pluginName) {
|
|
|
668
674
|
}
|
|
669
675
|
return methods;
|
|
670
676
|
}
|
|
671
|
-
function getPluginRoutes() {
|
|
677
|
+
function getPluginRoutes(options) {
|
|
672
678
|
const routes = [];
|
|
673
679
|
const seen = /* @__PURE__ */ new Set();
|
|
674
680
|
const methodsByPath = /* @__PURE__ */ new Map();
|
|
@@ -679,7 +685,18 @@ function getPluginRoutes() {
|
|
|
679
685
|
continue;
|
|
680
686
|
}
|
|
681
687
|
const pluginRoutes = hook({
|
|
682
|
-
...basePluginContext(plugin)
|
|
688
|
+
...basePluginContext(plugin),
|
|
689
|
+
resourceEvents: {
|
|
690
|
+
async publish(event) {
|
|
691
|
+
const parsed = resourceEventSchema.parse(event);
|
|
692
|
+
if (parsed.provider !== pluginName) {
|
|
693
|
+
throw new Error(
|
|
694
|
+
`Plugin "${pluginName}" cannot publish resource events for provider "${parsed.provider}"`
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
await options.resourceEvents.publish(parsed);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
683
700
|
});
|
|
684
701
|
if (!Array.isArray(pluginRoutes)) {
|
|
685
702
|
throw new Error(
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SANDBOX_WORKSPACE_ROOT
|
|
3
3
|
} from "./chunk-G3E7SCME.js";
|
|
4
|
+
import {
|
|
5
|
+
getStateAdapter
|
|
6
|
+
} from "./chunk-B2Z2H66D.js";
|
|
4
7
|
import {
|
|
5
8
|
sleep
|
|
6
9
|
} from "./chunk-4ZNGQH7C.js";
|
|
7
10
|
import {
|
|
8
|
-
getStateAdapter,
|
|
9
11
|
toOptionalTrimmed
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SS67LUOK.js";
|
|
11
13
|
import {
|
|
12
14
|
pluginCatalogRuntime
|
|
13
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YIPD3L6L.js";
|
|
14
16
|
import {
|
|
15
17
|
withSpan
|
|
16
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-O24R4DCK.js";
|
|
17
19
|
|
|
18
20
|
// src/chat/sandbox/runtime-dependencies.ts
|
|
19
21
|
var GLOBAL_RUNTIME_DEPENDENCIES = [
|