@sentry/junior 0.232.0 → 0.234.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 (55) hide show
  1. package/dist/{agent-hooks-n9qfV697.js → agent-hooks-BcH6E48y.js} +89 -12
  2. package/dist/{agent-runner-D_FVvrwA.js → agent-runner-DUkGlK89.js} +224 -768
  3. package/dist/api/schema.d.ts +538 -2
  4. package/dist/api/schema.js +4 -4
  5. package/dist/api.js +230 -19
  6. package/dist/app.js +31 -21
  7. package/dist/{briefs-B7wDx-LM.js → briefs-lyAQbDxJ.js} +4 -4
  8. package/dist/{catalog-runtime-FU8TmK-W.js → catalog-runtime-BSgsPVnr.js} +1 -1
  9. package/dist/{checkpoint-DuA1tIcd.js → checkpoint-BNfXlq_1.js} +7 -7
  10. package/dist/cli/chat.js +13 -13
  11. package/dist/cli/check.js +3 -3
  12. package/dist/cli/main.js +1 -1
  13. package/dist/cli/plugins.js +3 -3
  14. package/dist/cli/snapshot-create.js +3 -3
  15. package/dist/cli/upgrade.js +3 -3
  16. package/dist/{client-BMqP14EE.js → client-BX5lJRqW.js} +2 -2
  17. package/dist/{config-Q7ayKDYh.js → config-DuCzUoCo.js} +2 -2
  18. package/dist/{conversation-DsuDtoYR.js → conversation-CPjHYOV5.js} +13 -2
  19. package/dist/{conversation-privacy-DNNsgprf.js → conversation-privacy-CSxvdSoV.js} +1 -1
  20. package/dist/{credential-sync-DbgAGIhd.js → credential-sync-BO4DfH9a.js} +13 -13
  21. package/dist/{executor-DDonSWxn.js → executor--jWf-Nnm.js} +1 -1
  22. package/dist/{images-Bj8PcvZ5.js → images-BaL19wFC.js} +3 -3
  23. package/dist/instrumentation.js +2 -2
  24. package/dist/{job-queue-Dqc7qQbR.js → job-queue-cwHVOwVZ.js} +1 -1
  25. package/dist/{logging-X4U7SInw.js → logging-Cox1Mgcv.js} +1 -1
  26. package/dist/nitro.js +3 -3
  27. package/dist/{oauth-authorization-CetcZcwQ.js → oauth-authorization-CC8a1JKP.js} +1 -1
  28. package/dist/{oauth-callback-server-o34WSoGm.js → oauth-callback-server-Z7QSt416.js} +2 -2
  29. package/dist/{pending-auth-XoxEa4O5.js → pending-auth-DQhC3eSR.js} +1 -1
  30. package/dist/{profile-DzqqgpDo.js → profile-BdApelHS.js} +4 -4
  31. package/dist/{prompt-D5RPLy92.js → prompt-3D0sSbTC.js} +1 -1
  32. package/dist/{registry-RrIfDnkS.js → registry-DiY6B8CN.js} +1 -1
  33. package/dist/{resolve-Ccu6uGtp.js → resolve-VpJoiDpc.js} +2 -2
  34. package/dist/{runner-DDQCEV1P.js → runner-BIMegnPE.js} +9 -9
  35. package/dist/{sandbox-egress-signals-CT3xOtNG.js → sandbox-egress-signals-Cbtxe492.js} +1 -1
  36. package/dist/{schema-B-Taar1W.js → schema-CxwnlTDN.js} +4 -117
  37. package/dist/{skills-NB_I9BuR.js → skills-WttpPJUy.js} +2 -2
  38. package/dist/{spawn-DmwIhiNu.js → spawn-DhfMKt4y.js} +2 -2
  39. package/dist/{task-queue-B5CERq_E.js → task-queue-CZqUNJD0.js} +3 -3
  40. package/dist/{task-runner-COivEGS3.js → task-runner-BZaqoUCT.js} +16 -13
  41. package/dist/{thread-state-C7yyfiVM.js → thread-state-8tXZhu0y.js} +5 -5
  42. package/dist/{turn-failure-response-D990svo-.js → turn-failure-response-DFJ9L9NQ.js} +8 -8
  43. package/dist/{turn-lifecycle-C-LUNJC6.js → turn-lifecycle-WbpTUQ_r.js} +1 -1
  44. package/dist/{turn-session-routing-CoF0GbaY.js → turn-session-routing--EhI76rH.js} +1 -1
  45. package/dist/types-Du-HbEun.js +621 -0
  46. package/dist/{validation-f0y71ety.js → validation-0F9IgG3b.js} +1 -1
  47. package/dist/{version-CkRTIRkV.js → version-A7-RRBOE.js} +1 -1
  48. package/dist/version.js +1 -1
  49. package/dist/{web-authorization-BBwQsNCZ.js → web-authorization-BJggXofy.js} +6 -6
  50. package/dist/{web-input-Bkn-JGWd.js → web-input-B-siN5Dr.js} +212 -164
  51. package/dist/web-message-id-CVVCTWUb.js +464 -0
  52. package/dist/{work-vWPq9P5x.js → work-CNc0ejGG.js} +7 -7
  53. package/dist/{worker-BgZog5Jp.js → worker-BHbqpUAu.js} +5 -5
  54. package/package.json +5 -5
  55. package/dist/web-message-id-xPI_EFSC.js +0 -239
@@ -1,16 +1,16 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { a as embedTexts, r as completeObject } from "./client-BMqP14EE.js";
3
- import { F as normalizeIdentityEmail, I as isRecord$2, d as logException, f as logInfo, p as logWarn, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-X4U7SInw.js";
2
+ import { a as embedTexts, r as completeObject } from "./client-BX5lJRqW.js";
3
+ import { F as normalizeIdentityEmail, I as isRecord$2, a as extractGenAiUsageSummary, d as logException, f as logInfo, p as logWarn, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-Cox1Mgcv.js";
4
4
  import { a as getClient$1 } from "./sentry-CgWZM_kV.js";
5
- import { t as canExposeConversationPayload } from "./conversation-privacy-DNNsgprf.js";
6
- import { a as getChatConfig, n as botConfig, s as getSlackBotToken } from "./config-Q7ayKDYh.js";
5
+ import { t as canExposeConversationPayload } from "./conversation-privacy-CSxvdSoV.js";
6
+ import { a as getChatConfig, n as botConfig, s as getSlackBotToken } from "./config-DuCzUoCo.js";
7
7
  import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
8
8
  import { b as parseSlackMessageTs, c as isActorUserId, h as parseSlackTeamId, m as parseSlackChannelReferenceId, u as parseActorUserId } from "./context-0Et9iVSB.js";
9
9
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
10
- import { C as juniorCodeRepositories, D as juniorIdentities, E as juniorConversations, O as juniorUsers, S as juniorCodeChanges, T as conversationReadColumns, _ as CONVERSATION_METRICS, g as juniorConversationBriefs, h as juniorConversationBindings, i as juniorWorkspaces, m as juniorConversationParticipants, n as juniorSnapshots, r as juniorWorkspaceRepos, t as createJuniorSqlExecutor, v as juniorConversationMetrics, w as juniorAttachments, x as juniorConversationAnnotations, y as juniorConversationEvents } from "./executor-DDonSWxn.js";
11
- import { $ as encodeHistoryPayload, C as conversationReportEventSchema, H as readMessageCardRefs, L as conversationBriefSchema, Q as newConversationEventSchema, R as parseBriefInput, X as decodeStoredConversationEvent, Z as historyReplacementSchema, it as usageSchema, j as readMessageAttachments, q as conversationEventDataSchema } from "./conversation-DsuDtoYR.js";
12
- import { C as getDefaultRedisStateAdapterFor, N as SANDBOX_WORKSPACE_ROOT, k as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-DzqqgpDo.js";
13
- import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-D5RPLy92.js";
10
+ import { C as juniorCodeRepositories, D as juniorIdentities, E as juniorConversations, O as juniorUsers, S as juniorCodeChanges, T as conversationReadColumns, _ as CONVERSATION_METRICS, g as juniorConversationBriefs, h as juniorConversationBindings, i as juniorWorkspaces, m as juniorConversationParticipants, n as juniorSnapshots, r as juniorWorkspaceRepos, t as createJuniorSqlExecutor, v as juniorConversationMetrics, w as juniorAttachments, x as juniorConversationAnnotations, y as juniorConversationEvents } from "./executor--jWf-Nnm.js";
11
+ import { $ as encodeHistoryPayload, C as conversationReportEventSchema, H as readMessageCardRefs, L as conversationBriefSchema, Q as newConversationEventSchema, R as parseBriefInput, X as decodeStoredConversationEvent, Z as historyReplacementSchema, it as usageSchema, j as readMessageAttachments, q as conversationEventDataSchema } from "./conversation-CPjHYOV5.js";
12
+ import { C as getDefaultRedisStateAdapterFor, N as SANDBOX_WORKSPACE_ROOT, k as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-BdApelHS.js";
13
+ import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-3D0sSbTC.js";
14
14
  import { AsyncLocalStorage } from "node:async_hooks";
15
15
  import { z } from "zod";
16
16
  import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
@@ -1902,6 +1902,46 @@ function buildSentryEventUrl(eventId) {
1902
1902
  });
1903
1903
  }
1904
1904
  //#endregion
1905
+ //#region src/api/conversations/event-model.ts
1906
+ /** Apply recorded model choices without carrying a previous turn's settings forward. */
1907
+ function conversationEventModel(data, current) {
1908
+ if (data.type === "turn_started") return void 0;
1909
+ if (data.type === "turn_routed" || data.type === "handoff") return {
1910
+ modelId: data.modelId,
1911
+ modelProfile: data.modelProfile,
1912
+ ...data.reasoningLevel ? { reasoningLevel: data.reasoningLevel } : void 0
1913
+ };
1914
+ if (data.type === "assistant_message") {
1915
+ const model = text$1(data.model);
1916
+ const provider = text$1(data.provider);
1917
+ if (model) {
1918
+ const modelId = model.includes("/") || !provider ? model : `${provider}/${model}`;
1919
+ return {
1920
+ ...current,
1921
+ modelId
1922
+ };
1923
+ }
1924
+ }
1925
+ return current;
1926
+ }
1927
+ function text$1(value) {
1928
+ return typeof value === "string" && value.length > 0 ? value : void 0;
1929
+ }
1930
+ /** Allowlist model-call diagnostics; never expose opaque provider metadata. */
1931
+ function conversationEventModelCall(data) {
1932
+ if (data.type !== "assistant_message") return void 0;
1933
+ const usage = extractGenAiUsageSummary(data);
1934
+ const provider = text$1(data.provider);
1935
+ const api = text$1(data.api);
1936
+ const stopReason = text$1(data.stopReason);
1937
+ return {
1938
+ ...provider ? { provider } : void 0,
1939
+ ...api ? { api } : void 0,
1940
+ ...stopReason ? { stopReason } : void 0,
1941
+ ...hasAgentTurnUsage(usage) ? { usage } : void 0
1942
+ };
1943
+ }
1944
+ //#endregion
1905
1945
  //#region src/api/conversations/events.ts
1906
1946
  /** Canonical event types that can contribute to the reporting projection. */
1907
1947
  const conversationReportSourceEventTypes = [
@@ -2025,7 +2065,10 @@ function reportAssistantMessage(args) {
2025
2065
  if (!message.data.content.some((part) => {
2026
2066
  const reasoning = reportingReasoningPartSchema.safeParse(part);
2027
2067
  return reasoning.success && reasoning.data.redacted !== true && reasoning.data.thinking.trim().length > 0;
2028
- })) return reportToolCalls(args);
2068
+ })) return reportToolCalls(args) ?? {
2069
+ type: "assistant_message",
2070
+ parts: []
2071
+ };
2029
2072
  const reasoningParts = [];
2030
2073
  const assistantParts = [];
2031
2074
  for (const part of message.data.content) {
@@ -2218,7 +2261,16 @@ function projectConversationReportEventPage(args) {
2218
2261
  });
2219
2262
  }
2220
2263
  const projected = [];
2264
+ let model;
2265
+ for (const event of args.modelContextEvents ?? []) {
2266
+ model = conversationEventModel(event.data, model);
2267
+ if (event.data.type === "turn_completed" || event.data.type === "turn_failed") model = void 0;
2268
+ }
2221
2269
  for (const event of args.events) {
2270
+ model = conversationEventModel(event.data, model);
2271
+ const eventModel = model;
2272
+ const modelCall = conversationEventModelCall(event.data);
2273
+ if (event.data.type === "turn_completed" || event.data.type === "turn_failed") model = void 0;
2222
2274
  let data;
2223
2275
  if (event.data.type === "assistant_message" || event.data.type === "tool_result") {
2224
2276
  const reportArgs = {
@@ -2295,7 +2347,9 @@ function projectConversationReportEventPage(args) {
2295
2347
  projected.push(conversationReportEventSchema.parse({
2296
2348
  seq: event.seq,
2297
2349
  createdAt: new Date(event.createdAtMs).toISOString(),
2298
- data
2350
+ data,
2351
+ ...eventModel ? { model: eventModel } : void 0,
2352
+ ...modelCall ? { modelCall } : void 0
2299
2353
  }));
2300
2354
  }
2301
2355
  return projected;
@@ -2333,6 +2387,25 @@ function decodeConversationEventRow(row) {
2333
2387
  /** Project stored rows and resolve entity starts that precede the page. */
2334
2388
  async function projectConversationEventRows(executor, args) {
2335
2389
  const events = args.rows.map(decodeConversationEventRow).sort((left, right) => left.seq - right.seq);
2390
+ const modelContextRows = events[0] ? (await Promise.all([readConversationEventRows(executor, {
2391
+ conversationId: args.conversationId,
2392
+ beforeSeq: events[0].seq,
2393
+ direction: "backward",
2394
+ limit: 1,
2395
+ types: [
2396
+ "turn_started",
2397
+ "turn_routed",
2398
+ "handoff",
2399
+ "turn_completed",
2400
+ "turn_failed"
2401
+ ]
2402
+ }), readConversationEventRows(executor, {
2403
+ conversationId: args.conversationId,
2404
+ beforeSeq: events[0].seq,
2405
+ direction: "backward",
2406
+ limit: 1,
2407
+ types: ["assistant_message"]
2408
+ })])).flat().sort((left, right) => left.seq - right.seq) : [];
2336
2409
  const endedInvocationIds = [...new Set(events.flatMap((event) => event.data.type === "subagent_ended" ? [event.data.subagentInvocationId] : []))];
2337
2410
  const subagentStartRows = endedInvocationIds.length === 0 ? [] : await readConversationEventRows(executor, {
2338
2411
  conversationId: args.conversationId,
@@ -2354,7 +2427,8 @@ async function projectConversationEventRows(executor, args) {
2354
2427
  canExposePayload: args.canExposePayload,
2355
2428
  events,
2356
2429
  subagentStartEvents: subagentStartRows.map(decodeConversationEventRow),
2357
- toolStartEvents: toolStartRows.map(decodeConversationEventRow)
2430
+ toolStartEvents: toolStartRows.map(decodeConversationEventRow),
2431
+ modelContextEvents: modelContextRows.map(decodeConversationEventRow)
2358
2432
  });
2359
2433
  }
2360
2434
  /**
@@ -5542,7 +5616,10 @@ function createPluginHookRunner(input = {}) {
5542
5616
  ...basePluginContext(plugin),
5543
5617
  ...tool.conversationId ? { conversationId: tool.conversationId } : void 0,
5544
5618
  ...annotations ? { annotations } : void 0,
5545
- result: tool.structuredContent !== void 0 ? { structuredContent: tool.structuredContent } : {},
5619
+ result: {
5620
+ content: tool.content,
5621
+ structuredContent: tool.structuredContent
5622
+ },
5546
5623
  tool: {
5547
5624
  arguments: tool.arguments,
5548
5625
  name: tool.toolName