@sentry/junior 0.100.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 (38) hide show
  1. package/README.md +0 -1
  2. package/dist/api/conversations/schema.d.ts +2 -2
  3. package/dist/api/schema.js +3 -3
  4. package/dist/api.js +11 -11
  5. package/dist/app.js +105 -55
  6. package/dist/chat/agent/request.d.ts +1 -1
  7. package/dist/chat/conversations/store.d.ts +1 -1
  8. package/dist/chat/mcp/auth-store.d.ts +1 -0
  9. package/dist/chat/mcp/client.d.ts +2 -0
  10. package/dist/chat/mcp/oauth-provider.d.ts +4 -1
  11. package/dist/chat/mcp/oauth.d.ts +3 -1
  12. package/dist/chat/mcp/tool-manager.d.ts +2 -0
  13. package/dist/chat/services/mcp-auth-orchestration.d.ts +1 -1
  14. package/dist/chat/services/pending-auth.d.ts +17 -9
  15. package/dist/chat/state/conversation.d.ts +7 -3
  16. package/dist/{chunk-VY7BT4SM.js → chunk-5VGJJSSV.js} +4 -3
  17. package/dist/{chunk-IDZBM3NW.js → chunk-DBPLXSBK.js} +1 -1
  18. package/dist/{chunk-2T7DCRAW.js → chunk-EBFJOOUE.js} +1 -1
  19. package/dist/{chunk-4AQUWWEM.js → chunk-HNIT4HXU.js} +1 -1
  20. package/dist/{chunk-MM5UFDAC.js → chunk-HYDQULR2.js} +1 -1
  21. package/dist/{chunk-XSBIISXS.js → chunk-L2JIOAA2.js} +2 -2
  22. package/dist/{chunk-45DMFMY2.js → chunk-UWGTSF5O.js} +220 -110
  23. package/dist/{chunk-QSBQJ3PA.js → chunk-VFBFK6EY.js} +1 -1
  24. package/dist/{chunk-6DTVCPLO.js → chunk-XIMUQ4IU.js} +4 -3
  25. package/dist/{chunk-NSOCZGOH.js → chunk-XVR4O24H.js} +5 -7
  26. package/dist/cli/chat.js +4 -4
  27. package/dist/cli/upgrade.js +119 -2
  28. package/dist/{detail-LU6COZO6.js → detail-4EPUMSDU.js} +2 -2
  29. package/dist/{detail-5SLCGT6J.js → detail-CD4SPJ4K.js} +3 -3
  30. package/dist/{list-4ALSU6ZW.js → list-7L5LY2WU.js} +3 -3
  31. package/dist/{list-2FI5SFV7.js → list-DA2ATOM4.js} +2 -2
  32. package/dist/{list-KHRAWZWU.js → list-J6ROVH56.js} +1 -1
  33. package/dist/{profile-3O3OVENT.js → profile-6NRWEKMZ.js} +2 -2
  34. package/dist/{runner-BM7D35YW.js → runner-CZIKSWGC.js} +3 -3
  35. package/dist/{stats-J3YGCYDF.js → stats-Q5FRUXLY.js} +1 -1
  36. package/dist/{subagent-P7HOSMVC.js → subagent-YIINCFAS.js} +2 -2
  37. package/package.json +6 -6
  38. package/dist/api-reference.d.ts +0 -14
@@ -4,7 +4,7 @@ import {
4
4
  recordConversationActivity,
5
5
  recordConversationExecution,
6
6
  requestConversationWork
7
- } from "../chunk-2T7DCRAW.js";
7
+ } from "../chunk-EBFJOOUE.js";
8
8
  import {
9
9
  defineJuniorPlugins,
10
10
  pluginCatalogConfigFromEnv,
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  JUNIOR_THREAD_STATE_TTL_MS,
16
16
  coerceThreadConversationState
17
- } from "../chunk-6DTVCPLO.js";
17
+ } from "../chunk-XIMUQ4IU.js";
18
18
  import {
19
19
  addAgentTurnUsage,
20
20
  listAgentTurnSessionSummariesForConversations
@@ -1122,12 +1122,129 @@ var redisConversationStateMigration = {
1122
1122
  run: migrateRedisConversationState
1123
1123
  };
1124
1124
 
1125
+ // src/cli/upgrade/migrations/agent-turn-session-actor.ts
1126
+ import { THREAD_STATE_TTL_MS } from "chat";
1127
+ var AGENT_TURN_SESSION_PREFIX2 = "junior:agent_turn_session";
1128
+ var AGENT_TURN_SESSION_INDEX_KEY2 = `${AGENT_TURN_SESSION_PREFIX2}:index`;
1129
+ var AGENT_TURN_SESSION_INDEX_MAX_LENGTH = 5e3;
1130
+ function conversationIndexKey(conversationId) {
1131
+ return `${AGENT_TURN_SESSION_PREFIX2}:conversation:${conversationId}:index`;
1132
+ }
1133
+ function sessionRecordKey(conversationId, sessionId) {
1134
+ return `${AGENT_TURN_SESSION_PREFIX2}:${conversationId}:${sessionId}`;
1135
+ }
1136
+ function migrateRequesterToActor(value) {
1137
+ if (!isRecord(value) || value.requester === void 0) {
1138
+ return { changed: false, value };
1139
+ }
1140
+ const { requester, ...record } = value;
1141
+ return {
1142
+ changed: true,
1143
+ value: {
1144
+ ...record,
1145
+ ...record.actor === void 0 ? { actor: requester } : {}
1146
+ }
1147
+ };
1148
+ }
1149
+ async function rewriteList(args) {
1150
+ const values = await args.stateAdapter.getList(args.key);
1151
+ const migrated = values.map(migrateRequesterToActor);
1152
+ const changed = migrated.filter((entry) => entry.changed).length;
1153
+ if (changed === 0) {
1154
+ return { migrated: 0, values };
1155
+ }
1156
+ await args.stateAdapter.delete(args.key);
1157
+ for (const entry of migrated) {
1158
+ await args.stateAdapter.appendToList(args.key, entry.value, {
1159
+ ...args.maxLength !== void 0 ? { maxLength: args.maxLength } : {},
1160
+ ttlMs: THREAD_STATE_TTL_MS
1161
+ });
1162
+ }
1163
+ return { migrated: changed, values: migrated.map((entry) => entry.value) };
1164
+ }
1165
+ async function migrateSessionRecord(args) {
1166
+ const key = sessionRecordKey(args.conversationId, args.sessionId);
1167
+ const existing = await args.stateAdapter.get(key);
1168
+ if (existing === void 0) {
1169
+ return "missing";
1170
+ }
1171
+ const migrated = migrateRequesterToActor(existing);
1172
+ if (!migrated.changed) {
1173
+ return "existing";
1174
+ }
1175
+ await args.stateAdapter.set(key, migrated.value, THREAD_STATE_TTL_MS);
1176
+ return "migrated";
1177
+ }
1178
+ async function migrateAgentTurnSessionActor(context) {
1179
+ const result = {
1180
+ existing: 0,
1181
+ migrated: 0,
1182
+ missing: 0,
1183
+ scanned: 0
1184
+ };
1185
+ const global = await rewriteList({
1186
+ key: AGENT_TURN_SESSION_INDEX_KEY2,
1187
+ maxLength: AGENT_TURN_SESSION_INDEX_MAX_LENGTH,
1188
+ stateAdapter: context.stateAdapter
1189
+ });
1190
+ result.scanned += global.values.length;
1191
+ result.migrated += global.migrated;
1192
+ const conversations = /* @__PURE__ */ new Set();
1193
+ const sessions = /* @__PURE__ */ new Set();
1194
+ for (const value of global.values) {
1195
+ if (!isRecord(value)) {
1196
+ continue;
1197
+ }
1198
+ const conversationId = toOptionalString(value.conversationId);
1199
+ const sessionId = toOptionalString(value.sessionId);
1200
+ if (!conversationId) {
1201
+ continue;
1202
+ }
1203
+ conversations.add(conversationId);
1204
+ if (sessionId) {
1205
+ sessions.add(`${conversationId}\0${sessionId}`);
1206
+ }
1207
+ }
1208
+ for (const conversationId of conversations) {
1209
+ const conversation = await rewriteList({
1210
+ key: conversationIndexKey(conversationId),
1211
+ stateAdapter: context.stateAdapter
1212
+ });
1213
+ result.scanned += conversation.values.length;
1214
+ result.migrated += conversation.migrated;
1215
+ }
1216
+ for (const session of sessions) {
1217
+ const separator = session.indexOf("\0");
1218
+ const conversationId = session.slice(0, separator);
1219
+ const sessionId = session.slice(separator + 1);
1220
+ result.scanned += 1;
1221
+ const status = await migrateSessionRecord({
1222
+ conversationId,
1223
+ sessionId,
1224
+ stateAdapter: context.stateAdapter
1225
+ });
1226
+ if (status === "migrated") {
1227
+ result.migrated += 1;
1228
+ } else if (status === "existing") {
1229
+ result.existing += 1;
1230
+ } else {
1231
+ result.missing += 1;
1232
+ }
1233
+ }
1234
+ return result;
1235
+ }
1236
+ var agentTurnSessionActorMigration = {
1237
+ name: "migrate-agent-turn-session-requester-to-actor",
1238
+ run: migrateAgentTurnSessionActor
1239
+ };
1240
+
1125
1241
  // src/cli/upgrade.ts
1126
1242
  var DEFAULT_IO = {
1127
1243
  info: console.log
1128
1244
  };
1129
1245
  var localPluginLoader = createJiti(import.meta.url, { moduleCache: false });
1130
1246
  var MIGRATIONS = [
1247
+ agentTurnSessionActorMigration,
1131
1248
  redisConversationStateMigration,
1132
1249
  coreSqlSchemaMigration,
1133
1250
  sqlConversationMigration,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  buildConversationDetail
3
- } from "./chunk-VY7BT4SM.js";
3
+ } from "./chunk-5VGJJSSV.js";
4
4
  import {
5
5
  readConversationRecordFromSql
6
6
  } from "./chunk-JSAANELJ.js";
7
7
  import {
8
8
  conversationDetailReportSchema
9
- } from "./chunk-MM5UFDAC.js";
9
+ } from "./chunk-HYDQULR2.js";
10
10
  import "./chunk-LVUKF5CE.js";
11
11
  import "./chunk-VVIXK2BX.js";
12
12
  import {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  readLocationDetailFromSql
3
- } from "./chunk-QSBQJ3PA.js";
3
+ } from "./chunk-VFBFK6EY.js";
4
4
  import "./chunk-QOZOJNSE.js";
5
5
  import "./chunk-PGGEOCQY.js";
6
6
  import {
7
7
  locationDetailReportSchema
8
- } from "./chunk-4AQUWWEM.js";
9
- import "./chunk-MM5UFDAC.js";
8
+ } from "./chunk-HNIT4HXU.js";
9
+ import "./chunk-HYDQULR2.js";
10
10
  import "./chunk-PDO5BLNM.js";
11
11
  import "./chunk-VHRM6GNH.js";
12
12
  import "./chunk-A7X2FDUO.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  readLocationDirectoryFromSql
3
- } from "./chunk-QSBQJ3PA.js";
3
+ } from "./chunk-VFBFK6EY.js";
4
4
  import "./chunk-QOZOJNSE.js";
5
5
  import "./chunk-PGGEOCQY.js";
6
6
  import {
7
7
  locationDirectoryReportSchema
8
- } from "./chunk-4AQUWWEM.js";
9
- import "./chunk-MM5UFDAC.js";
8
+ } from "./chunk-HNIT4HXU.js";
9
+ import "./chunk-HYDQULR2.js";
10
10
  import "./chunk-PDO5BLNM.js";
11
11
  import "./chunk-VHRM6GNH.js";
12
12
  import "./chunk-A7X2FDUO.js";
@@ -8,8 +8,8 @@ import {
8
8
  } from "./chunk-PGGEOCQY.js";
9
9
  import {
10
10
  actorDirectoryReportSchema
11
- } from "./chunk-IDZBM3NW.js";
12
- import "./chunk-MM5UFDAC.js";
11
+ } from "./chunk-DBPLXSBK.js";
12
+ import "./chunk-HYDQULR2.js";
13
13
  import "./chunk-PDO5BLNM.js";
14
14
  import {
15
15
  getDb,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JSAANELJ.js";
4
4
  import {
5
5
  conversationFeedSchema
6
- } from "./chunk-MM5UFDAC.js";
6
+ } from "./chunk-HYDQULR2.js";
7
7
  import "./chunk-VVIXK2BX.js";
8
8
  import "./chunk-PDO5BLNM.js";
9
9
  import "./chunk-FP5N5OWZ.js";
@@ -18,8 +18,8 @@ import {
18
18
  } from "./chunk-PGGEOCQY.js";
19
19
  import {
20
20
  actorProfileReportSchema
21
- } from "./chunk-IDZBM3NW.js";
22
- import "./chunk-MM5UFDAC.js";
21
+ } from "./chunk-DBPLXSBK.js";
22
+ import "./chunk-HYDQULR2.js";
23
23
  import "./chunk-PDO5BLNM.js";
24
24
  import {
25
25
  getDb,
@@ -3,7 +3,7 @@ import {
3
3
  finalizeFailedTurnReply,
4
4
  processPluginTask,
5
5
  scheduleSessionCompletedPluginTasks
6
- } from "./chunk-XSBIISXS.js";
6
+ } from "./chunk-L2JIOAA2.js";
7
7
  import "./chunk-KNFROR7R.js";
8
8
  import {
9
9
  coerceThreadArtifactsState,
@@ -13,10 +13,10 @@ import {
13
13
  markTurnFailed,
14
14
  persistThreadStateById,
15
15
  startActiveTurn
16
- } from "./chunk-NSOCZGOH.js";
16
+ } from "./chunk-XVR4O24H.js";
17
17
  import {
18
18
  coerceThreadConversationState
19
- } from "./chunk-6DTVCPLO.js";
19
+ } from "./chunk-XIMUQ4IU.js";
20
20
  import "./chunk-IVXL57YF.js";
21
21
  import {
22
22
  commitMessages,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-PGGEOCQY.js";
4
4
  import {
5
5
  conversationStatsReportSchema
6
- } from "./chunk-MM5UFDAC.js";
6
+ } from "./chunk-HYDQULR2.js";
7
7
  import "./chunk-PDO5BLNM.js";
8
8
  import {
9
9
  getDb,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  buildConversationSubagent
3
- } from "./chunk-VY7BT4SM.js";
3
+ } from "./chunk-5VGJJSSV.js";
4
4
  import {
5
5
  readConversationRecordFromSql
6
6
  } from "./chunk-JSAANELJ.js";
7
7
  import {
8
8
  conversationSubagentTranscriptReportSchema
9
- } from "./chunk-MM5UFDAC.js";
9
+ } from "./chunk-HYDQULR2.js";
10
10
  import "./chunk-LVUKF5CE.js";
11
11
  import "./chunk-VVIXK2BX.js";
12
12
  import "./chunk-IQIBZXGB.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.100.0",
3
+ "version": "0.101.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -75,7 +75,7 @@
75
75
  "pg": "^8.16.3",
76
76
  "yaml": "^2.9.0",
77
77
  "zod": "^4.4.3",
78
- "@sentry/junior-plugin-api": "0.100.0"
78
+ "@sentry/junior-plugin-api": "0.101.0"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@emnapi/core": "^1.10.0",
@@ -92,10 +92,10 @@
92
92
  "typescript": "^6.0.3",
93
93
  "vercel": "^54.4.0",
94
94
  "vitest": "^4.1.7",
95
- "@sentry/junior-github": "0.100.0",
96
- "@sentry/junior-scheduler": "0.100.0",
97
- "@sentry/junior-testing": "0.0.0",
98
- "@sentry/junior-memory": "0.100.0"
95
+ "@sentry/junior-memory": "0.101.0",
96
+ "@sentry/junior-github": "0.101.0",
97
+ "@sentry/junior-scheduler": "0.101.0",
98
+ "@sentry/junior-testing": "0.0.0"
99
99
  },
100
100
  "scripts": {
101
101
  "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
@@ -1,14 +0,0 @@
1
- export { createApp } from "./app";
2
- export { createJuniorApi } from "./api";
3
- export type { JuniorAppOptions, JuniorDashboardOptions } from "./app";
4
- export { initSentry } from "./instrumentation";
5
- export { juniorNitro } from "./nitro";
6
- export type { JuniorNitroDashboardOptions, JuniorNitroOptions } from "./nitro";
7
- export { defineJuniorPlugins } from "./plugins";
8
- export type { JuniorPluginInput, JuniorPluginSet, JuniorPluginSetOptions, } from "./plugins";
9
- export type { PluginRunContext, PluginRunTranscriptEntry, PluginTaskContext, PluginTaskDefinition, PluginTasks, PluginConversationStatus, PluginConversations, PluginConversationSummary, SubscribableResource, } from "@sentry/junior-plugin-api";
10
- export { definePluginTool, pluginRunContextSchema, pluginRunTranscriptEntrySchema, zodTool, } from "@sentry/junior-plugin-api";
11
- export { actorDirectoryReportSchema, actorProfileReportSchema, conversationDetailReportSchema, conversationFeedSchema, conversationFeedQuerySchema, conversationParamsSchema, conversationStatsReportSchema, conversationSubagentTranscriptReportSchema, healthReportSchema, personParamsSchema, pluginOperationalReportFeedSchema, pluginOperationalReportSchema, pluginPackageContentItemReportSchema, pluginPackageContentReportSchema, pluginReportSchema, pluginReportsSchema, runtimeInfoReportSchema, skillReportSchema, skillReportsSchema, subagentParamsSchema, } from "./api/schema";
12
- export type { ActorActivityDayReport, ActorDirectoryReport, ActorIdentity, ActorProfileReport, ActorSummaryReport, ActorTotalsReport, ConversationActivityReport, ConversationActivityStatus, ConversationContextEvent, ConversationCost, ConversationDetailReport, ConversationFeed, ConversationParams, ConversationReportStatus, ConversationStatsItem, ConversationStatsReport, ConversationSubagentActivityReport, ConversationSubagentTranscriptReport, ConversationSummaryReport, ConversationSurface, ConversationToolActivityReport, ConversationUsage, HealthReport, PersonParams, PluginOperationalReport, PluginOperationalReportFeed, PluginPackageContentItemReport, PluginPackageContentReport, PluginReport, PluginReports, RuntimeInfoReport, SkillReport, SkillReports, SubagentParams, TranscriptMessage, TranscriptPart, TranscriptPartType, TranscriptRole, } from "./api/schema";
13
- export { juniorVercelConfig } from "./vercel";
14
- export type { JuniorVercelConfigOptions } from "./vercel";