@sentry/junior 0.93.0 → 0.95.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 (122) hide show
  1. package/dist/{agent-hooks-ZG7IDOIN.js → agent-hooks-FTQ5EGPO.js} +9 -10
  2. package/dist/api/people/list.js +7 -7
  3. package/dist/api/people/profile.js +7 -7
  4. package/dist/api/people/shared.d.ts +2 -2
  5. package/dist/api-reference.d.ts +1 -1
  6. package/dist/app.js +474 -231
  7. package/dist/{catalog-runtime-NZHMSMYC.js → catalog-runtime-2D7IVKUT.js} +3 -3
  8. package/dist/chat/advisor-request.d.ts +4 -0
  9. package/dist/chat/agent/request.d.ts +2 -0
  10. package/dist/chat/agent/resume.d.ts +2 -0
  11. package/dist/chat/conversations/history.d.ts +128 -0
  12. package/dist/chat/conversations/legacy-import.d.ts +38 -0
  13. package/dist/chat/conversations/messages.d.ts +39 -0
  14. package/dist/chat/conversations/projection.d.ts +94 -0
  15. package/dist/chat/conversations/retention.d.ts +36 -0
  16. package/dist/chat/conversations/sql/conversation-row.d.ts +14 -0
  17. package/dist/chat/conversations/sql/history.d.ts +4 -0
  18. package/dist/chat/conversations/sql/legacy-history-import.d.ts +55 -0
  19. package/dist/chat/conversations/sql/messages.d.ts +4 -0
  20. package/dist/chat/conversations/sql/migrations.d.ts +14 -3
  21. package/dist/chat/conversations/sql/purge.d.ts +53 -0
  22. package/dist/chat/conversations/sql/store.d.ts +7 -2
  23. package/dist/chat/conversations/store.d.ts +19 -0
  24. package/dist/chat/conversations/visible-compactions.d.ts +11 -0
  25. package/dist/chat/conversations/visible-messages.d.ts +47 -0
  26. package/dist/chat/db.d.ts +12 -1
  27. package/dist/chat/egress/credentialed.d.ts +1 -1
  28. package/dist/chat/identities/sql.d.ts +1 -1
  29. package/dist/chat/logging.d.ts +2 -1
  30. package/dist/chat/resource-events/store.d.ts +2 -1
  31. package/dist/chat/runtime/reply-executor.d.ts +8 -0
  32. package/dist/chat/runtime/thread-state.d.ts +2 -0
  33. package/dist/chat/sandbox/egress/schemas.d.ts +4 -0
  34. package/dist/chat/sandbox/egress/session.d.ts +2 -2
  35. package/dist/chat/sandbox/resources.d.ts +4 -0
  36. package/dist/chat/services/mcp-auth-orchestration.d.ts +8 -0
  37. package/dist/chat/services/plugin-auth-orchestration.d.ts +12 -0
  38. package/dist/chat/services/turn-session-record.d.ts +14 -2
  39. package/dist/chat/sleep.d.ts +2 -0
  40. package/dist/chat/state/conversation.d.ts +7 -4
  41. package/dist/chat/state/session-log.d.ts +23 -1
  42. package/dist/chat/state/turn-session.d.ts +6 -0
  43. package/dist/chat/tool-support/private-trace-result.d.ts +4 -0
  44. package/dist/chat/tool-support/zod-tool.d.ts +1 -0
  45. package/dist/chat/tools/advisor/tool.d.ts +9 -4
  46. package/dist/chat/tools/definition.d.ts +2 -0
  47. package/dist/chat/tools/execution/tool-error-handler.d.ts +2 -2
  48. package/dist/chat/tools/system-time.d.ts +8 -0
  49. package/dist/chat/xml.d.ts +2 -0
  50. package/dist/{chunk-NYWPISSO.js → chunk-2XXEKR44.js} +1 -1
  51. package/dist/{chunk-QGEWC27H.js → chunk-5XMNOD3S.js} +5 -7
  52. package/dist/{chunk-NFXSLTYG.js → chunk-6ONME5IG.js} +864 -62
  53. package/dist/{chunk-LFLTJQVR.js → chunk-7FBGKXPE.js} +4 -0
  54. package/dist/{chunk-MC4ZZE4Q.js → chunk-AYP4ERVZ.js} +1 -1
  55. package/dist/{chunk-GHGPTPBL.js → chunk-B7PUBQQM.js} +1 -1
  56. package/dist/chunk-CM5EZD5F.js +17 -0
  57. package/dist/chunk-CRRBJ3JP.js +1037 -0
  58. package/dist/{chunk-G3E7SCME.js → chunk-CZEX6KIQ.js} +23 -0
  59. package/dist/{chunk-TNUUATT7.js → chunk-E3E2XNCN.js} +2 -2
  60. package/dist/{chunk-LNCREA5Z.js → chunk-EKNJM5IG.js} +3 -127
  61. package/dist/{chunk-NAPITCZ6.js → chunk-GUE7HTNR.js} +251 -6
  62. package/dist/{chunk-BTH37NCU.js → chunk-GVOUCI2O.js} +1 -1
  63. package/dist/{chunk-YYBX2BD5.js → chunk-GY34VGP5.js} +1 -1
  64. package/dist/{chunk-JJUJ4CO2.js → chunk-HCXXB35T.js} +1489 -360
  65. package/dist/{chunk-YTNPU7I2.js → chunk-HDTO3A74.js} +2 -2
  66. package/dist/{chunk-YJ4OPVNA.js → chunk-HZNJLKKI.js} +1 -1
  67. package/dist/{chunk-HDNWZMUN.js → chunk-KDPCGVIT.js} +116 -51
  68. package/dist/chunk-N4RNJ32C.js +48 -0
  69. package/dist/{chunk-UUB3D2XI.js → chunk-NSCHU54X.js} +8 -10
  70. package/dist/{chunk-PFXC67GJ.js → chunk-RAIB6WSG.js} +6 -80
  71. package/dist/chunk-WAGQ377B.js +724 -0
  72. package/dist/{chunk-6H4PP63X.js → chunk-WCMQJE4F.js} +24 -14
  73. package/dist/{chunk-S6QKIGRM.js → chunk-WPOJ443W.js} +15 -25
  74. package/dist/{chunk-MAVOJ54A.js → chunk-XX4N4E6C.js} +25 -388
  75. package/dist/cli/chat.js +24 -23
  76. package/dist/cli/check.js +4 -4
  77. package/dist/cli/plugins.js +11 -12
  78. package/dist/cli/snapshot-warmup.js +7 -8
  79. package/dist/cli/upgrade.js +78 -17
  80. package/dist/db/schema/agent-steps.d.ts +134 -0
  81. package/dist/db/schema/conversation-messages.d.ts +153 -0
  82. package/dist/{chat/conversations/sql → db}/schema/conversations.d.ts +34 -0
  83. package/dist/{chat/conversations/sql → db}/schema.d.ts +319 -8
  84. package/dist/db-W55B74OP.js +24 -0
  85. package/dist/deployment.d.ts +2 -0
  86. package/dist/handlers/retention.d.ts +6 -0
  87. package/dist/instrumentation.js +16 -3
  88. package/dist/legacy-import-ZPLGLAFD.js +17 -0
  89. package/dist/nitro.js +14 -4
  90. package/dist/reporting/conversations/activity.d.ts +40 -0
  91. package/dist/reporting/conversations/context.d.ts +8 -0
  92. package/dist/reporting/conversations/details.d.ts +6 -0
  93. package/dist/reporting/conversations/index.d.ts +4 -0
  94. package/dist/reporting/conversations/shared.d.ts +9 -0
  95. package/dist/reporting/conversations/statistics.d.ts +4 -0
  96. package/dist/reporting/conversations/summaries.d.ts +17 -0
  97. package/dist/reporting/conversations/transcript.d.ts +28 -0
  98. package/dist/reporting/conversations/types.d.ts +178 -0
  99. package/dist/reporting/conversations.d.ts +1 -178
  100. package/dist/reporting.d.ts +4 -3
  101. package/dist/reporting.js +603 -827
  102. package/dist/{runner-XAZPJNAQ.js → runner-OOSBDYRK.js} +35 -41
  103. package/dist/{validation-KYAWETI4.js → validation-QCGRFRFZ.js} +4 -4
  104. package/migrations/README.md +32 -0
  105. package/migrations/meta/0000_snapshot.json +978 -0
  106. package/migrations/meta/_journal.json +13 -0
  107. package/package.json +9 -6
  108. package/dist/chat/sql/schema.d.ts +0 -1049
  109. package/dist/chat/state/conversation-details.d.ts +0 -47
  110. package/dist/chunk-7STN2ZSK.js +0 -250
  111. package/dist/chunk-LE5ANBUZ.js +0 -1040
  112. package/dist/chunk-QL66APYJ.js +0 -1377
  113. package/dist/db-YDN6AFJH.js +0 -18
  114. /package/dist/{chat/sql → db}/db.d.ts +0 -0
  115. /package/dist/{chat/sql → db}/executor.d.ts +0 -0
  116. /package/dist/{chat/sql → db}/neon.d.ts +0 -0
  117. /package/dist/{chat/sql → db}/postgres.d.ts +0 -0
  118. /package/dist/{chat/conversations/sql → db}/schema/destinations.d.ts +0 -0
  119. /package/dist/{chat/conversations/sql → db}/schema/identities.d.ts +0 -0
  120. /package/dist/{chat/conversations/sql → db}/schema/migrations.d.ts +0 -0
  121. /package/dist/{chat/conversations/sql → db}/schema/timestamps.d.ts +0 -0
  122. /package/dist/{chat/conversations/sql → db}/schema/users.d.ts +0 -0
@@ -1,14 +1,9 @@
1
1
  import {
2
- buildConversationContext,
3
2
  buildDeliveredTurnStatePatch,
4
3
  finalizeFailedTurnReply,
5
- markConversationMessage,
6
- normalizeConversationText,
7
4
  processPluginTask,
8
- scheduleSessionCompletedPluginTasks,
9
- updateConversationStats,
10
- upsertConversationMessage
11
- } from "./chunk-MAVOJ54A.js";
5
+ scheduleSessionCompletedPluginTasks
6
+ } from "./chunk-XX4N4E6C.js";
12
7
  import "./chunk-KNFROR7R.js";
13
8
  import {
14
9
  coerceThreadArtifactsState,
@@ -18,31 +13,40 @@ import {
18
13
  markTurnFailed,
19
14
  persistThreadStateById,
20
15
  startActiveTurn
21
- } from "./chunk-HDNWZMUN.js";
16
+ } from "./chunk-KDPCGVIT.js";
22
17
  import {
23
18
  coerceThreadConversationState
24
- } from "./chunk-PFXC67GJ.js";
19
+ } from "./chunk-RAIB6WSG.js";
25
20
  import {
26
21
  commitMessages,
27
22
  loadProjection
28
- } from "./chunk-QL66APYJ.js";
29
- import "./chunk-UUB3D2XI.js";
30
- import "./chunk-TNUUATT7.js";
31
- import "./chunk-G3E7SCME.js";
32
- import "./chunk-7STN2ZSK.js";
33
- import "./chunk-NFXSLTYG.js";
23
+ } from "./chunk-WAGQ377B.js";
24
+ import {
25
+ buildConversationContext,
26
+ hydrateConversationMessages,
27
+ markConversationMessage,
28
+ normalizeConversationText,
29
+ updateConversationStats,
30
+ upsertConversationMessage
31
+ } from "./chunk-CRRBJ3JP.js";
32
+ import "./chunk-NSCHU54X.js";
33
+ import "./chunk-E3E2XNCN.js";
34
+ import {
35
+ sleep
36
+ } from "./chunk-CZEX6KIQ.js";
37
+ import "./chunk-6ONME5IG.js";
34
38
  import {
35
39
  stripRuntimeTurnContext,
36
40
  trimTrailingAssistantMessages
37
- } from "./chunk-NAPITCZ6.js";
38
- import "./chunk-YYBX2BD5.js";
39
- import "./chunk-GHGPTPBL.js";
41
+ } from "./chunk-GUE7HTNR.js";
42
+ import "./chunk-GY34VGP5.js";
43
+ import "./chunk-B7PUBQQM.js";
40
44
  import {
41
45
  logException
42
- } from "./chunk-S6QKIGRM.js";
46
+ } from "./chunk-WPOJ443W.js";
43
47
  import "./chunk-OB42YVAE.js";
44
48
  import "./chunk-3DA7X2U3.js";
45
- import "./chunk-LFLTJQVR.js";
49
+ import "./chunk-7FBGKXPE.js";
46
50
  import "./chunk-MLKGABMK.js";
47
51
 
48
52
  // src/chat/local/runner.ts
@@ -50,7 +54,6 @@ import {
50
54
  createLocalSource,
51
55
  localDestinationSchema
52
56
  } from "@sentry/junior-plugin-api";
53
- import { THREAD_STATE_TTL_MS } from "chat";
54
57
  var DELIVERED_STATE_PERSIST_ATTEMPTS = 3;
55
58
  function localDestination(conversationId) {
56
59
  const parsed = localDestinationSchema.safeParse({
@@ -70,26 +73,17 @@ function localReply(reply) {
70
73
  text: reply.text
71
74
  };
72
75
  }
73
- function sleep(ms) {
74
- return new Promise((resolve) => setTimeout(resolve, ms));
75
- }
76
76
  function nextUserMessageSequence(conversation) {
77
77
  return conversation.messages.filter((message) => message.role === "user").length + 1;
78
78
  }
79
- function preparedLocalPiMessages(messages) {
80
- return stripRuntimeTurnContext(trimTrailingAssistantMessages(messages));
81
- }
82
79
  async function loadLocalPiMessages(args) {
83
80
  const projection = await loadProjection({
84
81
  conversationId: args.conversationId
85
82
  });
86
- if (args.fallback.length >= projection.length && args.fallback.length > 0) {
87
- return preparedLocalPiMessages(args.fallback);
83
+ if (projection.length === 0) {
84
+ return void 0;
88
85
  }
89
- if (projection.length > 0) {
90
- return preparedLocalPiMessages(projection);
91
- }
92
- return void 0;
86
+ return stripRuntimeTurnContext(trimTrailingAssistantMessages(projection));
93
87
  }
94
88
  async function persistDeliveredLocalTurnState(conversationId, patch) {
95
89
  let lastError;
@@ -119,6 +113,10 @@ async function runLocalAgentTurn(input, deps) {
119
113
  const now = deps.now ?? (() => Date.now());
120
114
  const persisted = await getPersistedThreadState(input.conversationId);
121
115
  const conversation = coerceThreadConversationState(persisted);
116
+ await hydrateConversationMessages({
117
+ conversation,
118
+ conversationId: input.conversationId
119
+ });
122
120
  let artifacts = coerceThreadArtifactsState(persisted);
123
121
  let { sandboxId, sandboxDependencyProfileHash } = getPersistedSandboxState(persisted);
124
122
  const initialArtifacts = artifacts;
@@ -160,8 +158,7 @@ async function runLocalAgentTurn(input, deps) {
160
158
  };
161
159
  try {
162
160
  const piMessages = await loadLocalPiMessages({
163
- conversationId: input.conversationId,
164
- fallback: conversation.piMessages
161
+ conversationId: input.conversationId
165
162
  });
166
163
  piMessagesBeforeRun = piMessages;
167
164
  const outcome = await deps.agentRunner.run({
@@ -251,8 +248,7 @@ async function runLocalAgentTurn(input, deps) {
251
248
  if (reply) {
252
249
  await commitMessages({
253
250
  conversationId: input.conversationId,
254
- messages: piMessagesBeforeRun ?? [],
255
- ttlMs: THREAD_STATE_TTL_MS
251
+ messages: piMessagesBeforeRun ?? []
256
252
  });
257
253
  }
258
254
  markTurnFailed({
@@ -273,10 +269,7 @@ async function runLocalAgentTurn(input, deps) {
273
269
  }
274
270
  await persistDeliveredLocalTurnState(input.conversationId, {
275
271
  artifacts: completedState.artifacts ?? artifacts,
276
- conversation: reply.piMessages ? {
277
- ...completedState.conversation,
278
- piMessages: reply.piMessages
279
- } : completedState.conversation,
272
+ conversation: completedState.conversation,
280
273
  sandboxId: reply.sandboxId ?? sandboxId,
281
274
  sandboxDependencyProfileHash: reply.sandboxDependencyProfileHash ?? sandboxDependencyProfileHash
282
275
  });
@@ -288,6 +281,7 @@ async function runLocalAgentTurn(input, deps) {
288
281
  messages: reply.piMessages,
289
282
  durationMs: reply.diagnostics.durationMs,
290
283
  usage: reply.diagnostics.usage,
284
+ reasoningLevel: reply.diagnostics.thinkingLevel,
291
285
  destination,
292
286
  source,
293
287
  actor: localActor,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  validatePluginEgressCredentialHooks,
3
3
  validatePluginRegistrations
4
- } from "./chunk-MC4ZZE4Q.js";
5
- import "./chunk-BTH37NCU.js";
6
- import "./chunk-S6QKIGRM.js";
4
+ } from "./chunk-AYP4ERVZ.js";
5
+ import "./chunk-GVOUCI2O.js";
6
+ import "./chunk-WPOJ443W.js";
7
7
  import "./chunk-OB42YVAE.js";
8
8
  import "./chunk-3DA7X2U3.js";
9
9
  import "./chunk-6APU57E6.js";
10
- import "./chunk-LFLTJQVR.js";
10
+ import "./chunk-7FBGKXPE.js";
11
11
  import "./chunk-MLKGABMK.js";
12
12
  export {
13
13
  validatePluginEgressCredentialHooks,
@@ -0,0 +1,32 @@
1
+ # SQL migrations for `@sentry/junior`
2
+
3
+ drizzle-kit is the DDL **generator** for the shared Junior SQL schema
4
+ (`src/db/schema.ts`). It is **not** the applier: `junior upgrade` applies
5
+ checksum-pinned migrations under an advisory lock with the expand-only deploy
6
+ contract (`specs/conversation-storage.md`). Never run `drizzle-kit migrate` or
7
+ `migrate()` in any runtime path.
8
+
9
+ ## Baseline (0000)
10
+
11
+ `meta/0000_snapshot.json` + `meta/_journal.json` are the kit baseline for the
12
+ schema that migrations `0001_conversation_core` through
13
+ `0005_conversation_transcripts` already provision on live databases. They exist
14
+ only so `pnpm --filter @sentry/junior db:generate` diffs future schema edits
15
+ against the current state.
16
+
17
+ The `0000_*.sql` baseline file is intentionally **deleted** and must never be
18
+ registered with the runner — the inline `0001`–`0005` migrations in
19
+ `src/chat/conversations/sql/migrations.ts` own that DDL and their recorded
20
+ checksums must stay byte-stable.
21
+
22
+ ## Migrations 0006 onward
23
+
24
+ 1. Edit the Drizzle schema under `src/db/schema/`.
25
+ 2. Run `pnpm --filter @sentry/junior db:generate`. Keep the generated
26
+ `0006_*.sql` file (do not delete it like the baseline) plus its snapshot.
27
+ 3. Register it as one line in `src/chat/conversations/sql/migrations.ts`:
28
+ `defineMigrationFromFile("0006_<name>", "0006_<name>.sql")`.
29
+
30
+ `db:generate` emitting **"No schema changes, nothing to migrate"** means the
31
+ Drizzle schema and the recorded snapshot agree — run it in CI as the schema/DDL
32
+ parity check.