@sentry/junior 0.101.0 → 0.102.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.
Files changed (70) hide show
  1. package/dist/{agent-hooks-V6KU7PQN.js → agent-hooks-I4I2DHSW.js} +7 -7
  2. package/dist/api/conversations/stats.query.d.ts +1 -1
  3. package/dist/api/locations/list.d.ts +7 -0
  4. package/dist/api/locations/schema.d.ts +13 -0
  5. package/dist/api/people/schema.d.ts +13 -0
  6. package/dist/api/people/shared.d.ts +1 -1
  7. package/dist/api/schema.d.ts +3 -3
  8. package/dist/api/schema.js +4 -2
  9. package/dist/api.js +15 -15
  10. package/dist/app.js +65 -53
  11. package/dist/{catalog-runtime-PFHVMHDR.js → catalog-runtime-5CVM2DOF.js} +2 -2
  12. package/dist/chat/agent/prompt.d.ts +1 -1
  13. package/dist/chat/agent-dispatch/validation.d.ts +1 -1
  14. package/dist/chat/conversation-privacy.d.ts +2 -6
  15. package/dist/chat/credentials/context.d.ts +33 -6
  16. package/dist/chat/credentials/subject.d.ts +15 -1
  17. package/dist/chat/logging.d.ts +4 -2
  18. package/dist/chat/mcp/tool-manager.d.ts +1 -1
  19. package/dist/chat/sandbox/egress/schemas.d.ts +13 -2
  20. package/dist/chat/services/context-compaction-marker.d.ts +8 -0
  21. package/dist/{chunk-XJA7BPHS.js → chunk-3OABPOHR.js} +3 -3
  22. package/dist/{chunk-EBFJOOUE.js → chunk-3UK5DFKW.js} +2 -2
  23. package/dist/{chunk-VFBFK6EY.js → chunk-4XNQSJAX.js} +62 -6
  24. package/dist/{chunk-DBPLXSBK.js → chunk-4YN2ZXKB.js} +9 -1
  25. package/dist/{chunk-XVR4O24H.js → chunk-5K4N73TP.js} +4 -4
  26. package/dist/{chunk-LMJPRYHP.js → chunk-77LHNQK4.js} +32 -8
  27. package/dist/{chunk-I35CTGPO.js → chunk-AEWZ7F65.js} +41 -17
  28. package/dist/{chunk-IQIBZXGB.js → chunk-B5QS4AVO.js} +2 -2
  29. package/dist/{chunk-L2JIOAA2.js → chunk-DTUSCR2Y.js} +8 -11
  30. package/dist/{chunk-VVIXK2BX.js → chunk-EMUZSROX.js} +2 -2
  31. package/dist/{chunk-IVXL57YF.js → chunk-EOB77KME.js} +4 -4
  32. package/dist/{chunk-PGGEOCQY.js → chunk-F4CQEUTP.js} +1 -1
  33. package/dist/{chunk-FP5N5OWZ.js → chunk-IQ36I3DF.js} +2 -2
  34. package/dist/{chunk-GEUUJRQF.js → chunk-KFP3TZOS.js} +2 -2
  35. package/dist/{chunk-JSAANELJ.js → chunk-LJB2TLVT.js} +3 -3
  36. package/dist/{chunk-D5KZYS4T.js → chunk-MJSJAHBW.js} +1 -1
  37. package/dist/{chunk-5VGJJSSV.js → chunk-NSP6OGL2.js} +5 -5
  38. package/dist/{chunk-VHRM6GNH.js → chunk-QZGVPPIJ.js} +27 -3
  39. package/dist/{chunk-LVA4I4H7.js → chunk-RT5BUHR5.js} +15 -44
  40. package/dist/{chunk-A7X2FDUO.js → chunk-SHBPSE7A.js} +88 -66
  41. package/dist/{chunk-CM5EZD5F.js → chunk-UIE3R5XU.js} +1 -1
  42. package/dist/{chunk-JPQISMMJ.js → chunk-VSAFV2GI.js} +7 -6
  43. package/dist/{chunk-HNIT4HXU.js → chunk-WPHCUGN7.js} +10 -1
  44. package/dist/{chunk-3ECW2K2O.js → chunk-WR7H7VLJ.js} +2 -2
  45. package/dist/{chunk-TPTJEHUE.js → chunk-X2IPNCB5.js} +61 -25
  46. package/dist/{chunk-UWGTSF5O.js → chunk-ZIX4PNBI.js} +129 -91
  47. package/dist/{chunk-PWC24W5F.js → chunk-ZSHL44IQ.js} +2 -2
  48. package/dist/cli/chat.js +21 -21
  49. package/dist/cli/check.js +3 -3
  50. package/dist/cli/plugins.js +9 -9
  51. package/dist/cli/snapshot-warmup.js +5 -5
  52. package/dist/cli/upgrade.js +85 -13
  53. package/dist/db/postgres-json.d.ts +5 -0
  54. package/dist/{db-RCZB7KNM.js → db-6QP6HY7U.js} +4 -4
  55. package/dist/{detail-4EPUMSDU.js → detail-OEIVZYXS.js} +11 -11
  56. package/dist/{detail-CD4SPJ4K.js → detail-V37NTVBN.js} +7 -7
  57. package/dist/instrumentation.js +2 -2
  58. package/dist/{legacy-import-VCYLWT2V.js → legacy-import-R3BMM2GH.js} +5 -5
  59. package/dist/{list-J6ROVH56.js → list-AJ6RWBOG.js} +7 -7
  60. package/dist/{list-7L5LY2WU.js → list-FWLIZHSW.js} +7 -7
  61. package/dist/list-NTUT6A5M.js +121 -0
  62. package/dist/{plugin-conversations-JANXC4GA.js → plugin-conversations-F3IBVNFX.js} +7 -7
  63. package/dist/{profile-6NRWEKMZ.js → profile-3FRQP4HP.js} +7 -7
  64. package/dist/{runner-CZIKSWGC.js → runner-C2ZTIOUD.js} +12 -12
  65. package/dist/{skills-MAZXZ2KE.js → skills-722AXRV5.js} +3 -3
  66. package/dist/{stats-Q5FRUXLY.js → stats-7UFY6FPE.js} +6 -6
  67. package/dist/{subagent-YIINCFAS.js → subagent-X3ZWJHR4.js} +10 -10
  68. package/dist/{validation-FMEAEKCY.js → validation-EUI2UFRM.js} +3 -3
  69. package/package.json +6 -6
  70. package/dist/list-DA2ATOM4.js +0 -80
@@ -11,14 +11,14 @@ import {
11
11
  persistRunningSessionRecord,
12
12
  persistTimeoutSessionRecord,
13
13
  persistYieldSessionRecord
14
- } from "./chunk-XVR4O24H.js";
14
+ } from "./chunk-5K4N73TP.js";
15
15
  import {
16
16
  JUNIOR_THREAD_STATE_TTL_MS
17
17
  } from "./chunk-XIMUQ4IU.js";
18
18
  import {
19
19
  addAgentTurnUsage,
20
20
  hasAgentTurnUsage
21
- } from "./chunk-IVXL57YF.js";
21
+ } from "./chunk-EOB77KME.js";
22
22
  import {
23
23
  loadConnectedMcpProviders,
24
24
  loadConversationProjection,
@@ -26,12 +26,12 @@ import {
26
26
  recordAuthorizationRequested,
27
27
  recordMcpProviderConnected,
28
28
  recordToolExecutionStarted
29
- } from "./chunk-IQIBZXGB.js";
29
+ } from "./chunk-B5QS4AVO.js";
30
30
  import {
31
31
  estimateTextTokens,
32
32
  getAgentContextCompactionTriggerTokens,
33
33
  updateConversationStats
34
- } from "./chunk-JPQISMMJ.js";
34
+ } from "./chunk-VSAFV2GI.js";
35
35
  import {
36
36
  buildNonInteractiveShellScript,
37
37
  createSandboxInstance,
@@ -41,10 +41,10 @@ import {
41
41
  isSnapshotMissingError,
42
42
  resolveRuntimeDependencySnapshot,
43
43
  runNonInteractiveCommand
44
- } from "./chunk-XJA7BPHS.js";
44
+ } from "./chunk-3OABPOHR.js";
45
45
  import {
46
46
  privateTraceResultAttributes
47
- } from "./chunk-CM5EZD5F.js";
47
+ } from "./chunk-UIE3R5XU.js";
48
48
  import {
49
49
  createPluginHookRunner,
50
50
  getPluginSystemPromptContributions,
@@ -53,7 +53,7 @@ import {
53
53
  getPlugins,
54
54
  getSlackToolContext,
55
55
  resolveChannelCapabilities
56
- } from "./chunk-TPTJEHUE.js";
56
+ } from "./chunk-X2IPNCB5.js";
57
57
  import {
58
58
  SlackActionError,
59
59
  downloadPrivateSlackFile,
@@ -63,10 +63,10 @@ import {
63
63
  isDmChannel,
64
64
  normalizeSlackConversationId,
65
65
  withSlackRetries
66
- } from "./chunk-FP5N5OWZ.js";
66
+ } from "./chunk-IQ36I3DF.js";
67
67
  import {
68
68
  createPluginLogger
69
- } from "./chunk-PWC24W5F.js";
69
+ } from "./chunk-ZSHL44IQ.js";
70
70
  import {
71
71
  contextProvenance,
72
72
  getAgentStepStore,
@@ -75,7 +75,7 @@ import {
75
75
  getDb,
76
76
  instructionActors,
77
77
  instructionProvenanceFor
78
- } from "./chunk-VHRM6GNH.js";
78
+ } from "./chunk-QZGVPPIJ.js";
79
79
  import {
80
80
  SANDBOX_DATA_ROOT,
81
81
  SANDBOX_SKILLS_ROOT,
@@ -87,11 +87,13 @@ import {
87
87
  sleep
88
88
  } from "./chunk-4ZNGQH7C.js";
89
89
  import {
90
+ COMPACTION_SUMMARY_PREFIX,
90
91
  DEFAULT_HANDOFF_MODEL_PROFILE,
91
92
  GEN_AI_PROVIDER_NAME,
92
93
  GEN_AI_SERVER_ADDRESS,
93
94
  GEN_AI_SERVER_PORT,
94
95
  MISSING_GATEWAY_CREDENTIALS_ERROR,
96
+ MODEL_HANDOFF_SUMMARY_PREFIX,
95
97
  ModelProfileNotConfiguredError,
96
98
  STANDARD_MODEL_PROFILE,
97
99
  TURN_CONTEXT_TAG,
@@ -106,8 +108,10 @@ import {
106
108
  getPiGatewayApiKey,
107
109
  getStateAdapter,
108
110
  getTerminalAssistantMessages,
111
+ hasCompactedConversationContext,
109
112
  hasRuntimeTurnContext,
110
113
  isAssistantMessage,
114
+ isCompactionSummaryText,
111
115
  isProviderRetryError,
112
116
  isToolResultError,
113
117
  isToolResultMessage,
@@ -121,19 +125,17 @@ import {
121
125
  stripRuntimeTurnContext,
122
126
  trimTrailingAssistantMessages,
123
127
  unwrapCurrentInstruction
124
- } from "./chunk-A7X2FDUO.js";
128
+ } from "./chunk-SHBPSE7A.js";
125
129
  import {
126
130
  parseSlackThreadId,
127
131
  resolveConversationPrivacy,
128
132
  runWithConversationPrivacy,
129
133
  toCanonicalInputMessage,
130
134
  toCanonicalOutputMessage,
131
- toGenAiMessageMetadata,
132
135
  toGenAiMessagesTraceAttributes,
133
136
  toGenAiPayloadMetadata,
134
- toGenAiPayloadTraceAttributes,
135
- toGenAiTextMetadata
136
- } from "./chunk-LVA4I4H7.js";
137
+ toGenAiPayloadTraceAttributes
138
+ } from "./chunk-RT5BUHR5.js";
137
139
  import {
138
140
  parseDestination
139
141
  } from "./chunk-B7PUBQQM.js";
@@ -142,19 +144,19 @@ import {
142
144
  findSkillByName,
143
145
  loadSkillsByName,
144
146
  parseSkillInvocation
145
- } from "./chunk-3ECW2K2O.js";
147
+ } from "./chunk-WR7H7VLJ.js";
146
148
  import {
147
149
  CredentialUnavailableError,
148
150
  credentialContextSchema,
149
151
  pluginCatalogRuntime,
150
152
  resolveAuthTokenPlaceholder,
151
153
  resolvePluginCommandEnv
152
- } from "./chunk-LMJPRYHP.js";
154
+ } from "./chunk-77LHNQK4.js";
153
155
  import {
154
156
  createActor,
155
157
  extractGenAiUsageAttributes,
156
158
  extractGenAiUsageSummary,
157
- getLogContextAttributes,
159
+ getLogContextAttributesForSpan,
158
160
  getTracePropagationHeaders,
159
161
  isUserActor,
160
162
  logError,
@@ -168,7 +170,7 @@ import {
168
170
  setTags,
169
171
  summarizeMessageText,
170
172
  withSpan
171
- } from "./chunk-I35CTGPO.js";
173
+ } from "./chunk-AEWZ7F65.js";
172
174
  import {
173
175
  isRecord
174
176
  } from "./chunk-OB42YVAE.js";
@@ -476,7 +478,7 @@ import {
476
478
  function attributeModeForPrivacy(conversationPrivacy) {
477
479
  return conversationPrivacy === "public" ? "content" : "metadata";
478
480
  }
479
- function buildChatStartAttributes(model, context, mode, conversationPrivacy) {
481
+ function buildChatStartAttributes(model, context, options, mode, conversationPrivacy) {
480
482
  const attributes = {
481
483
  "gen_ai.operation.name": "chat",
482
484
  "gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
@@ -485,35 +487,45 @@ function buildChatStartAttributes(model, context, mode, conversationPrivacy) {
485
487
  "gen_ai.output.type": "text",
486
488
  "server.address": GEN_AI_SERVER_ADDRESS,
487
489
  "server.port": GEN_AI_SERVER_PORT,
490
+ ...options?.temperature !== void 0 ? { "gen_ai.request.temperature": options.temperature } : {},
491
+ ...options?.maxTokens !== void 0 ? { "gen_ai.request.max_tokens": options.maxTokens } : {},
492
+ ...options?.reasoning ? { "gen_ai.request.reasoning.level": options.reasoning } : {},
493
+ ...hasCompactedConversationContext(context.messages) ? { "gen_ai.conversation.compacted": true } : {},
488
494
  ...conversationPrivacy ? { "app.conversation.privacy": conversationPrivacy } : {},
489
- ...toGenAiMessagesTraceAttributes("app.ai.input", context.messages)
495
+ ...toGenAiMessagesTraceAttributes("gen_ai.input", context.messages)
490
496
  };
491
- const inputMessages = serializeGenAiAttribute(
492
- mode === "metadata" ? context.messages.map(toGenAiMessageMetadata) : context.messages.map(toCanonicalInputMessage)
493
- );
494
- if (inputMessages) {
495
- attributes["gen_ai.input.messages"] = inputMessages;
497
+ if (mode === "content") {
498
+ const inputMessages = serializeGenAiAttribute(
499
+ context.messages.map(toCanonicalInputMessage)
500
+ );
501
+ if (inputMessages) {
502
+ attributes["gen_ai.input.messages"] = inputMessages;
503
+ }
496
504
  }
497
505
  if (context.systemPrompt) {
498
- const systemInstructions = serializeGenAiAttribute([
499
- mode === "metadata" ? toGenAiTextMetadata(context.systemPrompt) : { type: "text", content: context.systemPrompt }
500
- ]);
501
- if (systemInstructions) {
502
- attributes["gen_ai.system_instructions"] = systemInstructions;
506
+ if (mode === "content") {
507
+ const systemInstructions = serializeGenAiAttribute([
508
+ { type: "text", content: context.systemPrompt }
509
+ ]);
510
+ if (systemInstructions) {
511
+ attributes["gen_ai.system_instructions"] = systemInstructions;
512
+ }
503
513
  }
504
- attributes["app.ai.system_instructions.content_chars"] = context.systemPrompt.length;
514
+ attributes["gen_ai.system_instructions.content_chars"] = context.systemPrompt.length;
505
515
  }
506
516
  return attributes;
507
517
  }
508
518
  function buildChatEndAttributes(message, mode) {
509
519
  const attributes = {
510
- ...toGenAiMessagesTraceAttributes("app.ai.output", [message])
520
+ ...toGenAiMessagesTraceAttributes("gen_ai.output", [message])
511
521
  };
512
- const outputMessages = serializeGenAiAttribute(
513
- mode === "metadata" ? [toGenAiMessageMetadata(message)] : [toCanonicalOutputMessage(message)]
514
- );
515
- if (outputMessages) {
516
- attributes["gen_ai.output.messages"] = outputMessages;
522
+ if (mode === "content") {
523
+ const outputMessages = serializeGenAiAttribute([
524
+ toCanonicalOutputMessage(message)
525
+ ]);
526
+ if (outputMessages) {
527
+ attributes["gen_ai.output.messages"] = outputMessages;
528
+ }
517
529
  }
518
530
  Object.assign(attributes, extractGenAiUsageAttributes(message));
519
531
  if (message.stopReason) {
@@ -538,8 +550,14 @@ function createTracedStreamFn(baseOrOptions = streamSimple) {
538
550
  name: `chat ${model.id}`,
539
551
  op: "gen_ai.chat",
540
552
  attributes: {
541
- ...getLogContextAttributes(),
542
- ...buildChatStartAttributes(model, context, mode, effectivePrivacy)
553
+ ...getLogContextAttributesForSpan("gen_ai.chat"),
554
+ ...buildChatStartAttributes(
555
+ model,
556
+ context,
557
+ options,
558
+ mode,
559
+ effectivePrivacy
560
+ )
543
561
  }
544
562
  });
545
563
  try {
@@ -555,11 +573,19 @@ function createTracedStreamFn(baseOrOptions = streamSimple) {
555
573
  )) {
556
574
  span.setAttribute(key, value);
557
575
  }
576
+ if (finalMessage.stopReason === "error") {
577
+ span.setAttribute("error.type", "provider_error");
578
+ span.setStatus({ code: 2, message: "LLM stream failed" });
579
+ }
558
580
  } finally {
559
581
  span.end();
560
582
  }
561
583
  },
562
- () => {
584
+ (error) => {
585
+ span.setAttribute(
586
+ "error.type",
587
+ error instanceof Error ? error.name : typeof error
588
+ );
563
589
  span.setStatus({ code: 2, message: "LLM stream failed" });
564
590
  span.end();
565
591
  }
@@ -567,6 +593,10 @@ function createTracedStreamFn(baseOrOptions = streamSimple) {
567
593
  });
568
594
  return stream;
569
595
  } catch (error) {
596
+ span.setAttribute(
597
+ "error.type",
598
+ error instanceof Error ? error.name : typeof error
599
+ );
570
600
  span.setStatus({ code: 2, message: "LLM call failed" });
571
601
  span.end();
572
602
  throw error;
@@ -999,10 +1029,10 @@ async function selectTurnReasoningLevel(args) {
999
1029
  minimum: trimmedContext || turnBlockCount > 0 ? "medium" : void 0
1000
1030
  });
1001
1031
  setSpanAttributes({
1002
- "app.ai.reasoning_level": normalizedSelection.reasoningLevel,
1003
- "app.ai.reasoning_level_reason": normalizedSelection.reason,
1032
+ "gen_ai.request.reasoning.level": normalizedSelection.reasoningLevel,
1033
+ "gen_ai.request.reasoning.level_reason": normalizedSelection.reason,
1004
1034
  ...normalizedSelection.confidence !== void 0 ? {
1005
- "app.ai.reasoning_level_confidence": normalizedSelection.confidence
1035
+ "gen_ai.request.reasoning.level_confidence": normalizedSelection.confidence
1006
1036
  } : {}
1007
1037
  });
1008
1038
  return normalizedSelection;
@@ -2622,7 +2652,18 @@ async function assemblePrompt(args) {
2622
2652
  }
2623
2653
  ];
2624
2654
  const inputMessagesAttribute = serializeGenAiAttribute(
2625
- args.conversationPrivacy !== "public" ? inputMessages.map(toGenAiMessageMetadata) : inputMessages
2655
+ args.conversationPrivacy === "public" ? [
2656
+ {
2657
+ role: "system",
2658
+ parts: [{ type: "text", content: baseInstructions }]
2659
+ },
2660
+ {
2661
+ role: "user",
2662
+ parts: promptContentParts.flatMap(
2663
+ (part) => part.type === "text" ? [{ type: "text", content: part.text }] : []
2664
+ )
2665
+ }
2666
+ ] : void 0
2626
2667
  );
2627
2668
  return {
2628
2669
  baseInstructions,
@@ -3680,13 +3721,14 @@ var McpToolManager = class {
3680
3721
  plugin.manifest.name,
3681
3722
  tool
3682
3723
  ),
3683
- "gen_ai.tool.type": "extension",
3724
+ "gen_ai.tool.type": "function",
3684
3725
  "app.plugin.name": plugin.manifest.name,
3685
3726
  ...options?.toolCallId ? { "gen_ai.tool.call.id": options.toolCallId } : {}
3686
3727
  };
3687
3728
  const argumentAttribute = serializeMcpPayload(
3688
3729
  resolvedArgs,
3689
- conversationPrivacy
3730
+ conversationPrivacy,
3731
+ { privateMetadata: true }
3690
3732
  );
3691
3733
  return await withSpan(
3692
3734
  `execute_tool ${managedToolName}`,
@@ -3700,7 +3742,8 @@ var McpToolManager = class {
3700
3742
  }
3701
3743
  const resultAttribute = serializeMcpPayload(
3702
3744
  result,
3703
- conversationPrivacy
3745
+ conversationPrivacy,
3746
+ { privateMetadata: true }
3704
3747
  );
3705
3748
  if (resultAttribute) {
3706
3749
  setSpanAttributes({
@@ -3791,10 +3834,11 @@ var McpToolManager = class {
3791
3834
  function toOptionalRecord(value) {
3792
3835
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
3793
3836
  }
3794
- function serializeMcpPayload(payload, privacy) {
3795
- return serializeGenAiAttribute(
3796
- privacy === "private" ? toGenAiPayloadMetadata(payload) : payload
3797
- );
3837
+ function serializeMcpPayload(payload, privacy, options = {}) {
3838
+ if (privacy !== "private") {
3839
+ return serializeGenAiAttribute(payload);
3840
+ }
3841
+ return options.privateMetadata ? serializeGenAiAttribute(toGenAiPayloadMetadata(payload)) : void 0;
3798
3842
  }
3799
3843
 
3800
3844
  // src/chat/tools/sandbox/bash.ts
@@ -10228,7 +10272,6 @@ function handleToolExecutionError(error, toolName, toolCallId, shouldTrace, trac
10228
10272
  traceContext,
10229
10273
  {
10230
10274
  "app.credential.provider": error.provider,
10231
- "gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
10232
10275
  "gen_ai.operation.name": "execute_tool",
10233
10276
  "gen_ai.tool.name": toolName,
10234
10277
  ...toolCallId ? { "gen_ai.tool.call.id": toolCallId } : {},
@@ -10244,7 +10287,6 @@ function handleToolExecutionError(error, toolName, toolCallId, shouldTrace, trac
10244
10287
  "agent_tool_call_failed",
10245
10288
  traceContext,
10246
10289
  {
10247
- "gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
10248
10290
  "gen_ai.operation.name": "execute_tool",
10249
10291
  "gen_ai.tool.name": toolName,
10250
10292
  ...toolCallId ? { "gen_ai.tool.call.id": toolCallId } : {},
@@ -10261,7 +10303,6 @@ function handleToolExecutionError(error, toolName, toolCallId, shouldTrace, trac
10261
10303
  "agent_tool_call_failed",
10262
10304
  {},
10263
10305
  {
10264
- "gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
10265
10306
  "gen_ai.operation.name": "execute_tool",
10266
10307
  "gen_ai.tool.name": toolName,
10267
10308
  ...toolCallId ? { "gen_ai.tool.call.id": toolCallId } : {},
@@ -10629,9 +10670,7 @@ function createPiAgentTools(tools, sandbox, spanContext, onStatus, sandboxExecut
10629
10670
  visibleTools[EXECUTE_TOOL_NAME] = createExecuteToolTool();
10630
10671
  const shouldTrace = shouldEmitDevAgentTrace();
10631
10672
  const effectiveConversationPrivacy = conversationPrivacy ?? "private";
10632
- const serializeToolPayload = (payload, options = {}) => serializeGenAiAttribute(
10633
- effectiveConversationPrivacy === "private" && !options.exposePrivate ? toGenAiPayloadMetadata(payload) : payload
10634
- );
10673
+ const serializeToolPayload = (payload, options = {}) => effectiveConversationPrivacy === "private" && !options.exposePrivate ? options.privateMetadata ? serializeGenAiAttribute(toGenAiPayloadMetadata(payload)) : void 0 : serializeGenAiAttribute(payload);
10635
10674
  const notifyToolResult = async (report) => {
10636
10675
  try {
10637
10676
  await onToolResult?.(report);
@@ -10722,14 +10761,17 @@ function createPiAgentTools(tools, sandbox, spanContext, onStatus, sandboxExecut
10722
10761
  }
10723
10762
  const toolResultAttribute = effectiveConversationPrivacy === "private" && toolDef.privateTraceResult && !hasProjectedPrivateResult ? void 0 : serializeToolPayload(
10724
10763
  hasProjectedPrivateResult ? projectedPrivateResult : resultAttributeValue,
10725
- { exposePrivate: hasProjectedPrivateResult }
10764
+ {
10765
+ exposePrivate: hasProjectedPrivateResult,
10766
+ privateMetadata: true
10767
+ }
10726
10768
  );
10727
10769
  if (toolResultAttribute) {
10728
10770
  setSpanAttributes2({
10729
10771
  "gen_ai.tool.call.result": toolResultAttribute,
10730
10772
  ...hasProjectedPrivateResult ? privateTraceResultAttributes() : {},
10731
10773
  ...toGenAiPayloadTraceAttributes(
10732
- "app.ai.tool.call.result",
10774
+ "gen_ai.tool.call.result",
10733
10775
  resultAttributeValue
10734
10776
  )
10735
10777
  });
@@ -10760,9 +10802,11 @@ function createPiAgentTools(tools, sandbox, spanContext, onStatus, sandboxExecut
10760
10802
  executionMode: toolDef.executionMode,
10761
10803
  execute: async (toolCallId, params, signal) => {
10762
10804
  const normalizedToolCallId = typeof toolCallId === "string" && toolCallId.length > 0 ? toolCallId : void 0;
10763
- const toolArgumentsAttribute = serializeToolPayload(params);
10805
+ const toolArgumentsAttribute = serializeToolPayload(params, {
10806
+ privateMetadata: true
10807
+ });
10764
10808
  const toolArgumentsMetadata = toGenAiPayloadTraceAttributes(
10765
- "app.ai.tool.call.arguments",
10809
+ "gen_ai.tool.call.arguments",
10766
10810
  params
10767
10811
  );
10768
10812
  return withSpan(
@@ -10782,7 +10826,7 @@ function createPiAgentTools(tools, sandbox, spanContext, onStatus, sandboxExecut
10782
10826
  executionToolName = resolvedCatalogCall.toolName;
10783
10827
  executionParams = resolvedCatalogCall.arguments;
10784
10828
  setSpanAttributes2({
10785
- "app.ai.tool.dispatcher.name": EXECUTE_TOOL_NAME,
10829
+ "gen_ai.tool.dispatcher.name": EXECUTE_TOOL_NAME,
10786
10830
  "gen_ai.tool.description": resolvedCatalogCall.definition.description,
10787
10831
  "gen_ai.tool.name": resolvedCatalogCall.toolName
10788
10832
  });
@@ -10829,11 +10873,10 @@ function createPiAgentTools(tools, sandbox, spanContext, onStatus, sandboxExecut
10829
10873
  }
10830
10874
  },
10831
10875
  {
10832
- "gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
10833
10876
  "gen_ai.operation.name": "execute_tool",
10834
10877
  "gen_ai.tool.name": toolName,
10835
10878
  "gen_ai.tool.description": toolDef.description,
10836
- "gen_ai.tool.type": "extension",
10879
+ "gen_ai.tool.type": "function",
10837
10880
  ...toolArgumentsMetadata,
10838
10881
  ...normalizedToolCallId ? { "gen_ai.tool.call.id": normalizedToolCallId } : {},
10839
10882
  ...toolArgumentsAttribute ? { "gen_ai.tool.call.arguments": toolArgumentsAttribute } : {}
@@ -14952,9 +14995,6 @@ var MAX_SUMMARY_INPUT_CHARS = 8e4;
14952
14995
  var MAX_VISIBLE_CONTEXT_CHARS = 2e4;
14953
14996
  var MAX_SUMMARY_CHARS = 6e3;
14954
14997
  var MAX_RENDERED_MESSAGE_CHARS = 4e3;
14955
- var COMPACTION_SUMMARY_PREFIX = "Context compaction summary for future Junior turns:";
14956
- var LEGACY_COMPACTION_SUMMARY_PREFIX = "Context handoff summary for future Junior turns:";
14957
- var MODEL_HANDOFF_SUMMARY_PREFIX = "Model handoff checkpoint. Continue the outstanding request now using this summary as the complete prior context:";
14958
14998
  var OMITTED_OLDER_CONTEXT_NOTICE = "[older context omitted]";
14959
14999
  function textPart(value) {
14960
15000
  if (value && typeof value === "object" && value.type === "text" && typeof value.text === "string") {
@@ -14988,8 +15028,7 @@ function truncateToTokenBudget(text, maxTokens) {
14988
15028
  return `${text.slice(0, Math.max(0, maxChars - 3)).trimEnd()}...`;
14989
15029
  }
14990
15030
  function isCompactionSummary(text) {
14991
- const normalized = text.trimStart();
14992
- return normalized.startsWith(COMPACTION_SUMMARY_PREFIX) || normalized.startsWith(LEGACY_COMPACTION_SUMMARY_PREFIX) || normalized.startsWith(MODEL_HANDOFF_SUMMARY_PREFIX);
15031
+ return isCompactionSummaryText(text);
14993
15032
  }
14994
15033
  function isPayloadHeavy(text) {
14995
15034
  return /<data_base64>[\s\S]*?<\/data_base64>|data:image\/[a-z0-9.+-]+;base64,/i.test(
@@ -15522,14 +15561,6 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
15522
15561
  fastModelId: botConfig.fastModelId,
15523
15562
  messageText: userInput
15524
15563
  });
15525
- setSpanAttributes({
15526
- "gen_ai.request.model": activeModelId,
15527
- "gen_ai.request.reasoning.level": reasoningSelection.reasoningLevel,
15528
- "app.ai.reasoning_level_reason": reasoningSelection.reason,
15529
- ...reasoningSelection.confidence !== void 0 ? {
15530
- "app.ai.reasoning_level_confidence": reasoningSelection.confidence
15531
- } : {}
15532
- });
15533
15564
  const generatedFiles = [];
15534
15565
  const artifactStatePatch = {};
15535
15566
  const toolCalls = [];
@@ -15787,9 +15818,9 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
15787
15818
  runResume.setTurnStartMessageIndex(0);
15788
15819
  runResume.adoptCommittedBoundary(replacement);
15789
15820
  setSpanAttributes({
15790
- "gen_ai.request.model": activeModelId,
15791
- "gen_ai.request.reasoning.level": reasoningSelection.reasoningLevel,
15792
- "app.ai.model_profile": activeModelProfile
15821
+ "gen_ai.agent.model": activeModelId,
15822
+ "gen_ai.agent.model_profile": activeModelProfile,
15823
+ "gen_ai.agent.reasoning.level": reasoningSelection.reasoningLevel
15793
15824
  });
15794
15825
  update = {
15795
15826
  context: {
@@ -15873,7 +15904,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
15873
15904
  runResume.setTurnStartMessageIndex(agent.state.messages.length);
15874
15905
  }
15875
15906
  await withSpan(
15876
- `invoke_agent ${activeModelId}`,
15907
+ `invoke_agent ${botConfig.userName}`,
15877
15908
  "gen_ai.invoke_agent",
15878
15909
  spanContext,
15879
15910
  async () => {
@@ -15994,8 +16025,9 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
15994
16025
  );
15995
16026
  const outputMessages = newMessages.filter(isAssistantMessage);
15996
16027
  const outputMessagesAttribute = serializeGenAiAttribute(
15997
- conversationPrivacy !== "public" ? outputMessages.map(toGenAiMessageMetadata) : outputMessages.map(toCanonicalOutputMessage)
16028
+ conversationPrivacy === "public" ? outputMessages.map(toCanonicalOutputMessage) : void 0
15998
16029
  );
16030
+ const lastAssistant = outputMessages.at(-1);
15999
16031
  const usageSummary = extractGenAiUsageSummary(...outputMessages);
16000
16032
  const currentUsage = hasAgentTurnUsage(usageSummary) ? usageSummary : void 0;
16001
16033
  const currentPhaseUsage = addAgentTurnUsage(
@@ -16006,9 +16038,14 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
16006
16038
  setSpanAttributes({
16007
16039
  ...outputMessagesAttribute ? { "gen_ai.output.messages": outputMessagesAttribute } : {},
16008
16040
  ...toGenAiMessagesTraceAttributes(
16009
- "app.ai.output",
16041
+ "gen_ai.output",
16010
16042
  outputMessages
16011
16043
  ),
16044
+ ...lastAssistant ? {
16045
+ "gen_ai.response.finish_reasons": [
16046
+ normalizeGenAiFinishReason(lastAssistant.stopReason)
16047
+ ]
16048
+ } : {},
16012
16049
  ...extractGenAiUsageAttributes(usageSummary)
16013
16050
  });
16014
16051
  if (getPendingAuthPause()) {
@@ -16017,7 +16054,6 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
16017
16054
  );
16018
16055
  throw getPendingAuthPause();
16019
16056
  }
16020
- const lastAssistant = outputMessages.at(-1);
16021
16057
  const providerRetry = nextProviderRetry({
16022
16058
  attempt,
16023
16059
  lastAssistant,
@@ -16041,18 +16077,20 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
16041
16077
  }
16042
16078
  },
16043
16079
  {
16044
- "gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
16045
16080
  "gen_ai.operation.name": "invoke_agent",
16046
- "gen_ai.request.model": activeModelId,
16081
+ "gen_ai.agent.model": activeModelId,
16082
+ "gen_ai.agent.model_profile": activeModelProfile,
16083
+ "gen_ai.agent.reasoning.level": reasoningSelection.reasoningLevel,
16084
+ "gen_ai.agent.reasoning.level_reason": reasoningSelection.reason,
16085
+ ...reasoningSelection.confidence !== void 0 ? {
16086
+ "gen_ai.agent.reasoning.level_confidence": reasoningSelection.confidence
16087
+ } : {},
16047
16088
  "gen_ai.output.type": "text",
16048
- "server.address": GEN_AI_SERVER_ADDRESS,
16049
- "server.port": GEN_AI_SERVER_PORT,
16050
16089
  ...conversationPrivacy ? { "app.conversation.privacy": conversationPrivacy } : {},
16051
16090
  ...sessionConversationId ? { "app.ai.session.conversation_id": sessionConversationId } : {},
16052
16091
  ...sessionId ? { "app.ai.turn.session_id": sessionId } : {},
16053
16092
  ...currentSliceId ? { "app.ai.turn.slice_id": currentSliceId } : {},
16054
- "gen_ai.request.reasoning.level": reasoningSelection.reasoningLevel,
16055
- ...toGenAiMessagesTraceAttributes("app.ai.input", inputMessages),
16093
+ ...toGenAiMessagesTraceAttributes("gen_ai.input", inputMessages),
16056
16094
  ...inputMessagesAttribute ? { "gen_ai.input.messages": inputMessagesAttribute } : {}
16057
16095
  }
16058
16096
  );
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getStateAdapter
3
- } from "./chunk-A7X2FDUO.js";
3
+ } from "./chunk-SHBPSE7A.js";
4
4
  import {
5
5
  logException,
6
6
  logInfo,
7
7
  logWarn
8
- } from "./chunk-I35CTGPO.js";
8
+ } from "./chunk-AEWZ7F65.js";
9
9
 
10
10
  // src/chat/plugins/logging.ts
11
11
  function createPluginLogger(plugin) {
package/dist/cli/chat.js CHANGED
@@ -1,31 +1,31 @@
1
1
  import {
2
2
  createAgentRunner,
3
3
  executeAgentRun
4
- } from "../chunk-UWGTSF5O.js";
5
- import "../chunk-XVR4O24H.js";
4
+ } from "../chunk-ZIX4PNBI.js";
5
+ import "../chunk-5K4N73TP.js";
6
6
  import "../chunk-XIMUQ4IU.js";
7
- import "../chunk-IVXL57YF.js";
8
- import "../chunk-IQIBZXGB.js";
9
- import "../chunk-JPQISMMJ.js";
10
- import "../chunk-XJA7BPHS.js";
7
+ import "../chunk-EOB77KME.js";
8
+ import "../chunk-B5QS4AVO.js";
9
+ import "../chunk-VSAFV2GI.js";
10
+ import "../chunk-3OABPOHR.js";
11
11
  import "../chunk-PDO5BLNM.js";
12
- import "../chunk-CM5EZD5F.js";
12
+ import "../chunk-UIE3R5XU.js";
13
13
  import {
14
14
  loadAppPluginSet
15
15
  } from "../chunk-Y2CM7HXH.js";
16
- import "../chunk-TPTJEHUE.js";
17
- import "../chunk-FP5N5OWZ.js";
18
- import "../chunk-PWC24W5F.js";
19
- import "../chunk-VHRM6GNH.js";
16
+ import "../chunk-X2IPNCB5.js";
17
+ import "../chunk-IQ36I3DF.js";
18
+ import "../chunk-ZSHL44IQ.js";
19
+ import "../chunk-QZGVPPIJ.js";
20
20
  import "../chunk-G3E7SCME.js";
21
21
  import "../chunk-4ZNGQH7C.js";
22
- import "../chunk-A7X2FDUO.js";
22
+ import "../chunk-SHBPSE7A.js";
23
23
  import "../chunk-FXFQNHRU.js";
24
- import "../chunk-LVA4I4H7.js";
24
+ import "../chunk-RT5BUHR5.js";
25
25
  import "../chunk-B7PUBQQM.js";
26
- import "../chunk-3ECW2K2O.js";
27
- import "../chunk-LMJPRYHP.js";
28
- import "../chunk-I35CTGPO.js";
26
+ import "../chunk-WR7H7VLJ.js";
27
+ import "../chunk-77LHNQK4.js";
28
+ import "../chunk-AEWZ7F65.js";
29
29
  import "../chunk-OB42YVAE.js";
30
30
  import "../chunk-6GWA276C.js";
31
31
  import "../chunk-B3IT5END.js";
@@ -153,10 +153,10 @@ async function configureLocalChatPlugins(pluginSet) {
153
153
  databaseModule
154
154
  ] = await Promise.all([
155
155
  import("../plugins-PZMDS7AT.js"),
156
- import("../agent-hooks-V6KU7PQN.js"),
157
- import("../catalog-runtime-PFHVMHDR.js"),
158
- import("../validation-FMEAEKCY.js"),
159
- import("../db-RCZB7KNM.js")
156
+ import("../agent-hooks-I4I2DHSW.js"),
157
+ import("../catalog-runtime-5CVM2DOF.js"),
158
+ import("../validation-EUI2UFRM.js"),
159
+ import("../db-6QP6HY7U.js")
160
160
  ]);
161
161
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
162
162
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -217,7 +217,7 @@ function newRunConversationId() {
217
217
  async function prepareLocalChatRun(io, pluginSet) {
218
218
  defaultStateAdapterForLocalChat();
219
219
  await configureLocalChatPlugins(pluginSet);
220
- const { runLocalAgentTurn } = await import("../runner-CZIKSWGC.js");
220
+ const { runLocalAgentTurn } = await import("../runner-C2ZTIOUD.js");
221
221
  const deps = {
222
222
  agentRunner: createAgentRunner(executeAgentRun),
223
223
  deliverReply: async (reply) => {
package/dist/cli/check.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  parseSkillFile
3
- } from "../chunk-3ECW2K2O.js";
3
+ } from "../chunk-WR7H7VLJ.js";
4
4
  import {
5
5
  parseInlinePluginManifest,
6
6
  parsePluginManifest
7
- } from "../chunk-LMJPRYHP.js";
8
- import "../chunk-I35CTGPO.js";
7
+ } from "../chunk-77LHNQK4.js";
8
+ import "../chunk-AEWZ7F65.js";
9
9
  import "../chunk-OB42YVAE.js";
10
10
  import "../chunk-6GWA276C.js";
11
11
  import "../chunk-B3IT5END.js";