@sentry/junior 0.99.0 → 0.101.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.
Files changed (91) hide show
  1. package/README.md +0 -1
  2. package/dist/{agent-hooks-OSW6C3CJ.js → agent-hooks-V6KU7PQN.js} +6 -5
  3. package/dist/api/activity.d.ts +14 -0
  4. package/dist/api/conversations/aggregate.d.ts +16 -0
  5. package/dist/api/conversations/detail-projection.d.ts +1 -0
  6. package/dist/api/conversations/list.query.d.ts +3 -0
  7. package/dist/api/conversations/projection.d.ts +1 -0
  8. package/dist/api/conversations/reporting.d.ts +42 -0
  9. package/dist/api/conversations/schema.d.ts +9 -9
  10. package/dist/api/conversations/stats.query.d.ts +1 -1
  11. package/dist/api/locations/detail.d.ts +81 -0
  12. package/dist/api/locations/list.d.ts +30 -0
  13. package/dist/api/locations/query.d.ts +5 -0
  14. package/dist/api/locations/schema.d.ts +175 -0
  15. package/dist/api/people/list.query.d.ts +1 -1
  16. package/dist/api/people/profile.query.d.ts +1 -1
  17. package/dist/api/people/schema.d.ts +10 -14
  18. package/dist/api/people/shared.d.ts +38 -78
  19. package/dist/api/schema.d.ts +8 -0
  20. package/dist/api/schema.js +14 -3
  21. package/dist/api.js +24 -11
  22. package/dist/app.js +126 -70
  23. package/dist/chat/agent/request.d.ts +4 -1
  24. package/dist/chat/config.d.ts +2 -0
  25. package/dist/chat/conversations/store.d.ts +1 -1
  26. package/dist/chat/mcp/auth-store.d.ts +1 -0
  27. package/dist/chat/mcp/client.d.ts +2 -0
  28. package/dist/chat/mcp/oauth-provider.d.ts +4 -1
  29. package/dist/chat/mcp/oauth.d.ts +3 -1
  30. package/dist/chat/mcp/tool-manager.d.ts +2 -0
  31. package/dist/chat/reasoning-level.d.ts +4 -0
  32. package/dist/chat/services/mcp-auth-orchestration.d.ts +1 -1
  33. package/dist/chat/services/pending-auth.d.ts +17 -9
  34. package/dist/chat/services/{turn-thinking-level.d.ts → turn-reasoning-level.d.ts} +11 -10
  35. package/dist/chat/services/turn-result.d.ts +3 -3
  36. package/dist/chat/state/conversation.d.ts +7 -3
  37. package/dist/chat/tools/search-tools.d.ts +2 -2
  38. package/dist/{chunk-T55RBE4Z.js → chunk-2RNOB32R.js} +3 -1
  39. package/dist/{chunk-ZZUBLPXD.js → chunk-5VGJJSSV.js} +9 -7
  40. package/dist/{chunk-EEZCY5WX.js → chunk-A7X2FDUO.js} +18 -2
  41. package/dist/{chunk-CRQVIHDI.js → chunk-DBPLXSBK.js} +2 -8
  42. package/dist/{chunk-NJEDJFK4.js → chunk-EBFJOOUE.js} +2 -2
  43. package/dist/{chunk-WTYEKPXU.js → chunk-FP5N5OWZ.js} +1 -1
  44. package/dist/chunk-FXFQNHRU.js +48 -0
  45. package/dist/chunk-GEUUJRQF.js +102 -0
  46. package/dist/chunk-HNIT4HXU.js +75 -0
  47. package/dist/{chunk-EUZ44ROE.js → chunk-HYDQULR2.js} +2 -4
  48. package/dist/{chunk-DHHU2WSG.js → chunk-IQIBZXGB.js} +2 -2
  49. package/dist/{chunk-OL6XQ23W.js → chunk-IVXL57YF.js} +3 -3
  50. package/dist/{chunk-IO65E4ZD.js → chunk-JPQISMMJ.js} +3 -3
  51. package/dist/{chunk-KFUSLFLL.js → chunk-JSAANELJ.js} +11 -4
  52. package/dist/{chunk-ER45IV77.js → chunk-L2JIOAA2.js} +10 -10
  53. package/dist/chunk-PGGEOCQY.js +77 -0
  54. package/dist/{chunk-EOWXRY5E.js → chunk-PWC24W5F.js} +1 -1
  55. package/dist/chunk-QOZOJNSE.js +96 -0
  56. package/dist/{chunk-FTTFV6DC.js → chunk-TPTJEHUE.js} +4 -4
  57. package/dist/{chunk-PYK7R5A7.js → chunk-UWGTSF5O.js} +285 -174
  58. package/dist/chunk-VFBFK6EY.js +275 -0
  59. package/dist/{chunk-OGHXZ4KQ.js → chunk-VHRM6GNH.js} +88 -122
  60. package/dist/{chunk-NG2AV7IB.js → chunk-VVIXK2BX.js} +1 -1
  61. package/dist/{chunk-6DTVCPLO.js → chunk-XIMUQ4IU.js} +4 -3
  62. package/dist/{chunk-H66UCBPW.js → chunk-XJA7BPHS.js} +1 -1
  63. package/dist/{chunk-WJ7STXT6.js → chunk-XVR4O24H.js} +8 -10
  64. package/dist/cli/chat.js +16 -15
  65. package/dist/cli/plugins.js +6 -5
  66. package/dist/cli/snapshot-warmup.js +2 -2
  67. package/dist/cli/upgrade.js +126 -8
  68. package/dist/db/schema/conversations.d.ts +17 -0
  69. package/dist/db/schema/destinations.d.ts +12 -3
  70. package/dist/db/schema.d.ts +19 -2
  71. package/dist/{db-GFSCDAHS.js → db-RCZB7KNM.js} +3 -2
  72. package/dist/{detail-Q4IVDNGS.js → detail-4EPUMSDU.js} +11 -10
  73. package/dist/detail-CD4SPJ4K.js +29 -0
  74. package/dist/{legacy-import-6WWXMALY.js → legacy-import-VCYLWT2V.js} +4 -3
  75. package/dist/list-7L5LY2WU.js +30 -0
  76. package/dist/list-DA2ATOM4.js +80 -0
  77. package/dist/{list-A3F5JDYV.js → list-J6ROVH56.js} +7 -6
  78. package/dist/{plugin-conversations-PDCQWU3O.js → plugin-conversations-JANXC4GA.js} +6 -5
  79. package/dist/profile-6NRWEKMZ.js +212 -0
  80. package/dist/{runner-267ZRLZD.js → runner-CZIKSWGC.js} +13 -12
  81. package/dist/stats-Q5FRUXLY.js +174 -0
  82. package/dist/{subagent-UN3MP6LV.js → subagent-YIINCFAS.js} +10 -9
  83. package/migrations/0003_peaceful_scalphunter.sql +4 -0
  84. package/migrations/meta/0003_snapshot.json +1035 -0
  85. package/migrations/meta/_journal.json +8 -1
  86. package/package.json +6 -6
  87. package/dist/api-reference.d.ts +0 -14
  88. package/dist/chunk-CV22LUIV.js +0 -261
  89. package/dist/list-M5BRWW3D.js +0 -92
  90. package/dist/profile-UEIRSVT3.js +0 -146
  91. package/dist/stats-L62E4O4U.js +0 -207
@@ -0,0 +1,77 @@
1
+ import {
2
+ juniorConversations
3
+ } from "./chunk-VHRM6GNH.js";
4
+
5
+ // src/api/conversations/aggregate.ts
6
+ import { sql } from "drizzle-orm";
7
+ function tokenValue() {
8
+ return sql`
9
+ CASE
10
+ WHEN ${juniorConversations.usage}->>'totalTokens' IS NOT NULL
11
+ THEN (${juniorConversations.usage}->>'totalTokens')::double precision
12
+ WHEN COALESCE(
13
+ ${juniorConversations.usage}->>'inputTokens',
14
+ ${juniorConversations.usage}->>'outputTokens',
15
+ ${juniorConversations.usage}->>'cachedInputTokens',
16
+ ${juniorConversations.usage}->>'cacheCreationTokens'
17
+ ) IS NOT NULL
18
+ THEN COALESCE((${juniorConversations.usage}->>'inputTokens')::double precision, 0)
19
+ + COALESCE((${juniorConversations.usage}->>'outputTokens')::double precision, 0)
20
+ + COALESCE((${juniorConversations.usage}->>'cachedInputTokens')::double precision, 0)
21
+ + COALESCE((${juniorConversations.usage}->>'cacheCreationTokens')::double precision, 0)
22
+ ELSE NULL
23
+ END
24
+ `;
25
+ }
26
+ function costValue() {
27
+ return sql`
28
+ CASE
29
+ WHEN ${juniorConversations.usage}->'cost'->>'total' IS NOT NULL
30
+ THEN (${juniorConversations.usage}->'cost'->>'total')::double precision
31
+ WHEN COALESCE(
32
+ ${juniorConversations.usage}->'cost'->>'input',
33
+ ${juniorConversations.usage}->'cost'->>'output',
34
+ ${juniorConversations.usage}->'cost'->>'cacheRead',
35
+ ${juniorConversations.usage}->'cost'->>'cacheWrite'
36
+ ) IS NOT NULL
37
+ THEN COALESCE((${juniorConversations.usage}->'cost'->>'input')::double precision, 0)
38
+ + COALESCE((${juniorConversations.usage}->'cost'->>'output')::double precision, 0)
39
+ + COALESCE((${juniorConversations.usage}->'cost'->>'cacheRead')::double precision, 0)
40
+ + COALESCE((${juniorConversations.usage}->'cost'->>'cacheWrite')::double precision, 0)
41
+ ELSE NULL
42
+ END
43
+ `;
44
+ }
45
+ function conversationAggregateColumns() {
46
+ return {
47
+ active: sql`COUNT(*) FILTER (
48
+ WHERE ${juniorConversations.executionStatus} NOT IN ('idle', 'failed')
49
+ )::integer`,
50
+ conversations: sql`COUNT(*)::integer`,
51
+ costUsd: sql`SUM(${costValue()})::double precision`,
52
+ durationMs: sql`COALESCE(SUM(${juniorConversations.durationMs}), 0)::double precision`,
53
+ failed: sql`COUNT(*) FILTER (
54
+ WHERE ${juniorConversations.executionStatus} = 'failed'
55
+ )::integer`,
56
+ tokens: sql`SUM(${tokenValue()})::double precision`
57
+ };
58
+ }
59
+ function conversationRangeColumns() {
60
+ return {
61
+ firstSeenAt: sql`MIN(${juniorConversations.createdAt})`.mapWith(
62
+ juniorConversations.createdAt
63
+ ),
64
+ lastSeenAt: sql`MAX(${juniorConversations.lastActivityAt})`.mapWith(
65
+ juniorConversations.lastActivityAt
66
+ )
67
+ };
68
+ }
69
+ function conversationActiveDaysColumn() {
70
+ return sql`COUNT(DISTINCT (${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC')::date)::integer`;
71
+ }
72
+
73
+ export {
74
+ conversationAggregateColumns,
75
+ conversationRangeColumns,
76
+ conversationActiveDaysColumn
77
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getStateAdapter
3
- } from "./chunk-EEZCY5WX.js";
3
+ } from "./chunk-A7X2FDUO.js";
4
4
  import {
5
5
  logException,
6
6
  logInfo,
@@ -0,0 +1,96 @@
1
+ // src/api/conversations/reporting.ts
2
+ var PRIVATE_CONVERSATION_LABEL = "Private Conversation";
3
+ function channelFromConversationId(conversationId) {
4
+ const [provider, channel] = conversationId.split(":");
5
+ return provider === "slack" && channel ? channel : void 0;
6
+ }
7
+ function surfaceFromRow(row) {
8
+ if (row.source === "api" || row.source === "scheduler" || row.source === "slack") {
9
+ return row.source;
10
+ }
11
+ if (row.conversationId.startsWith("slack:")) return "slack";
12
+ if (row.conversationId.startsWith("scheduler:")) return "scheduler";
13
+ if (row.conversationId.startsWith("api:")) return "api";
14
+ return "internal";
15
+ }
16
+ function statusFromRow(row) {
17
+ if (row.executionStatus === "failed") return "failed";
18
+ if (row.executionStatus === "idle") return "completed";
19
+ return "active";
20
+ }
21
+ function surfaceLabel(surface) {
22
+ if (surface === "scheduler") return "Scheduler";
23
+ if (surface === "api") return "API";
24
+ if (surface === "internal") return "Internal";
25
+ return "Conversation";
26
+ }
27
+ function slackLocationLabel(args) {
28
+ const channelId = args.channel;
29
+ if (!channelId) return void 0;
30
+ if (args.channelNameRedacted && args.channelName) return args.channelName;
31
+ const name = args.channelName?.replace(/^#/, "");
32
+ if (channelId.startsWith("D")) return "Direct Message";
33
+ if (channelId.startsWith("C")) {
34
+ return name ? `#${name}` : "Public Channel";
35
+ }
36
+ if (channelId.startsWith("G")) {
37
+ if (name?.startsWith("mpdm-")) return "Group DM";
38
+ return "Private Channel";
39
+ }
40
+ return name || channelId;
41
+ }
42
+ function channelNameFromRow(row) {
43
+ if (row.destinationVisibility !== "public") {
44
+ return PRIVATE_CONVERSATION_LABEL;
45
+ }
46
+ return row.channelName ?? void 0;
47
+ }
48
+ function titleFromRow(row, surface) {
49
+ if (row.destinationVisibility !== "public") {
50
+ return PRIVATE_CONVERSATION_LABEL;
51
+ }
52
+ const channel = channelFromConversationId(row.conversationId);
53
+ return row.title ?? slackLocationLabel({
54
+ channel,
55
+ channelName: row.channelName ?? void 0
56
+ }) ?? surfaceLabel(surface);
57
+ }
58
+ function actorFromRow(row) {
59
+ const actor = {
60
+ ...row.email ? { email: row.email } : {},
61
+ ...row.fullName ? { fullName: row.fullName } : {},
62
+ ...row.providerSubjectId ? { slackUserId: row.providerSubjectId } : {},
63
+ ...row.handle ? { slackUserName: row.handle } : {}
64
+ };
65
+ return Object.keys(actor).length ? actor : void 0;
66
+ }
67
+ function summaryFromRow(row) {
68
+ const surface = surfaceFromRow(row);
69
+ const channel = channelFromConversationId(row.conversationId);
70
+ const channelName = channelNameFromRow(row);
71
+ const channelNameRedacted = row.destinationVisibility !== "public";
72
+ const actorIdentity = actorFromRow(row);
73
+ return {
74
+ conversationId: row.conversationId,
75
+ cumulativeDurationMs: row.durationMs,
76
+ displayTitle: titleFromRow(row, surface),
77
+ lastProgressAt: new Date(
78
+ row.executionUpdatedAt ?? row.updatedAt
79
+ ).toISOString(),
80
+ lastSeenAt: row.lastActivityAt.toISOString(),
81
+ startedAt: row.createdAt.toISOString(),
82
+ status: statusFromRow(row),
83
+ surface,
84
+ ...actorIdentity ? { actorIdentity } : {},
85
+ ...channel ? { channel } : {},
86
+ ...channelName ? { channelName } : {},
87
+ ...channelNameRedacted ? { channelNameRedacted: true } : {},
88
+ ...row.destinationVisibility === "public" && row.destinationId ? { locationId: row.destinationId } : {}
89
+ };
90
+ }
91
+
92
+ export {
93
+ surfaceLabel,
94
+ slackLocationLabel,
95
+ summaryFromRow
96
+ };
@@ -3,14 +3,14 @@ import {
3
3
  isConversationScopedChannel,
4
4
  isDmChannel,
5
5
  normalizeSlackConversationId
6
- } from "./chunk-WTYEKPXU.js";
6
+ } from "./chunk-FP5N5OWZ.js";
7
7
  import {
8
8
  createPluginLogger,
9
9
  createPluginState
10
- } from "./chunk-EOWXRY5E.js";
10
+ } from "./chunk-PWC24W5F.js";
11
11
  import {
12
12
  getDb
13
- } from "./chunk-OGHXZ4KQ.js";
13
+ } from "./chunk-VHRM6GNH.js";
14
14
  import {
15
15
  SANDBOX_WORKSPACE_ROOT
16
16
  } from "./chunk-G3E7SCME.js";
@@ -18,7 +18,7 @@ import {
18
18
  botConfig,
19
19
  completeObject,
20
20
  embedTexts
21
- } from "./chunk-EEZCY5WX.js";
21
+ } from "./chunk-A7X2FDUO.js";
22
22
  import {
23
23
  isActorUserId,
24
24
  logInfo,