@sentry/junior 0.124.2 → 0.125.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 (72) hide show
  1. package/dist/{agent-hooks-HJQTURNC.js → agent-hooks-MF5UZRCO.js} +8 -8
  2. package/dist/api/conversations/auxiliary-costs.d.ts +6 -0
  3. package/dist/api/conversations/detail.d.ts +10 -0
  4. package/dist/api/conversations/list.d.ts +11 -0
  5. package/dist/api/conversations/projection.d.ts +2 -1
  6. package/dist/api/locations/detail.d.ts +20 -0
  7. package/dist/api/people/profile.d.ts +10 -0
  8. package/dist/api/people/shared.d.ts +36 -0
  9. package/dist/api/plugin-reports.d.ts +1 -0
  10. package/dist/api/schema/conversation.d.ts +40 -0
  11. package/dist/api/schema/location.d.ts +10 -0
  12. package/dist/api/schema/person.d.ts +10 -0
  13. package/dist/api/schema.d.ts +2 -2
  14. package/dist/api/schema.js +4 -2
  15. package/dist/api.js +322 -169
  16. package/dist/app.js +22 -23
  17. package/dist/{catalog-runtime-F356WNZS.js → catalog-runtime-V6SJTUV7.js} +5 -5
  18. package/dist/chat/agent/prompt.d.ts +1 -0
  19. package/dist/chat/conversations/history.d.ts +4 -2
  20. package/dist/chat/conversations/sql/conversation-row.d.ts +7 -4
  21. package/dist/chat/conversations/sql/store.d.ts +2 -1
  22. package/dist/chat/conversations/store.d.ts +9 -1
  23. package/dist/chat/pi/client.d.ts +1 -0
  24. package/dist/chat/plugins/agent-hooks.d.ts +1 -0
  25. package/dist/chat/plugins/conversation-event-stats.d.ts +3 -0
  26. package/dist/chat/plugins/conversation-events.d.ts +1 -1
  27. package/dist/chat/slack/source-link.d.ts +5 -0
  28. package/dist/chat/source.d.ts +16 -0
  29. package/dist/{chunk-VMRKIKGO.js → chunk-2R5MASH3.js} +1 -1
  30. package/dist/{chunk-EOSC6JOC.js → chunk-2U5CLBYF.js} +1 -1
  31. package/dist/{chunk-AYQZCJZJ.js → chunk-6ZBSTNYN.js} +14 -0
  32. package/dist/{chunk-CMYDYVOD.js → chunk-7K57FJXR.js} +6 -5
  33. package/dist/{chunk-SMTAXLX4.js → chunk-CAPBVX4L.js} +2 -2
  34. package/dist/{chunk-7P7YVJKH.js → chunk-EXD2Z3YR.js} +2 -2
  35. package/dist/{chunk-SS7MAJF5.js → chunk-HT7DSLKL.js} +16 -14
  36. package/dist/{chunk-PR3M62LK.js → chunk-HX236W2U.js} +6 -4
  37. package/dist/{chunk-WKBPFZ25.js → chunk-IHNBJHEP.js} +1 -1
  38. package/dist/{chunk-DW6SLS5F.js → chunk-IS4DGI5J.js} +73 -17
  39. package/dist/{chunk-4JW3YNQZ.js → chunk-JT3YMQR3.js} +7 -9
  40. package/dist/{chunk-L7EZRQ2J.js → chunk-K6MQWEEJ.js} +7 -7
  41. package/dist/{chunk-574YK7QW.js → chunk-KN7QI56S.js} +23 -3
  42. package/dist/{chunk-NNKVDYXN.js → chunk-LG5TXWXI.js} +11 -11
  43. package/dist/{chunk-ASK74NM6.js → chunk-MVYNJECP.js} +1 -1
  44. package/dist/{chunk-AQKVWIPR.js → chunk-MYKSUTUV.js} +4 -4
  45. package/dist/{chunk-ZO6E537B.js → chunk-NM3PMQS6.js} +1 -1
  46. package/dist/{chunk-IXTIJQ7Z.js → chunk-ODB55JM7.js} +162 -15
  47. package/dist/{chunk-IMLJE2NY.js → chunk-Q3UF3K77.js} +2 -2
  48. package/dist/{chunk-GCGJGSQL.js → chunk-S4PUICSB.js} +2 -0
  49. package/dist/{chunk-PE44LDDQ.js → chunk-UTL3MHPC.js} +1 -0
  50. package/dist/{chunk-KYKLQYSU.js → chunk-XJYGLTYI.js} +1 -1
  51. package/dist/{chunk-7LDOW4QA.js → chunk-ZXGBLAYQ.js} +1 -1
  52. package/dist/cli/chat.js +23 -23
  53. package/dist/cli/check.js +6 -6
  54. package/dist/cli/plugins.js +11 -11
  55. package/dist/cli/snapshot-create.js +8 -8
  56. package/dist/cli/upgrade.js +6 -6
  57. package/dist/db/schema/conversations.d.ts +20 -0
  58. package/dist/db/schema.d.ts +19 -0
  59. package/dist/{db-4SU2HJSV.js → db-JSDSWK7T.js} +6 -6
  60. package/dist/instrumentation.js +2 -2
  61. package/dist/nitro.js +2 -2
  62. package/dist/{oauth-callback-server-MMCH5QV6.js → oauth-callback-server-UMS2T3HN.js} +16 -17
  63. package/dist/reporting-schema.d.ts +2 -0
  64. package/dist/{runner-ZDSNVGYA.js → runner-RGOANIRV.js} +11 -12
  65. package/dist/{skills-7G7LBHLK.js → skills-GBLPOQOD.js} +6 -6
  66. package/dist/{validation-2ETDADPB.js → validation-BMQY6CD4.js} +6 -6
  67. package/dist/version.js +1 -1
  68. package/migrations/0013_conversation_session_source.sql +38 -0
  69. package/migrations/meta/0013_snapshot.json +1250 -0
  70. package/migrations/meta/_journal.json +8 -1
  71. package/package.json +6 -6
  72. package/dist/chunk-BA5KHLPQ.js +0 -55
package/dist/app.js CHANGED
@@ -50,7 +50,7 @@ import {
50
50
  startConversationWork,
51
51
  startSlackProcessingReaction,
52
52
  stripLeadingBotMention
53
- } from "./chunk-NNKVDYXN.js";
53
+ } from "./chunk-LG5TXWXI.js";
54
54
  import "./chunk-FA6POGLH.js";
55
55
  import {
56
56
  ConversationTurnLifecycleService,
@@ -65,16 +65,15 @@ import {
65
65
  processPluginTask,
66
66
  requireTurnFailureEventId,
67
67
  scheduleSessionCompletedPluginTasks
68
- } from "./chunk-4JW3YNQZ.js";
68
+ } from "./chunk-JT3YMQR3.js";
69
69
  import {
70
70
  GET,
71
71
  conversationVisibilityFromSlackChannelType,
72
72
  resolveSlackChannelTypeFromMessage,
73
73
  resolveSlackConversationContext
74
- } from "./chunk-7P7YVJKH.js";
74
+ } from "./chunk-EXD2Z3YR.js";
75
75
  import "./chunk-4CODA7P5.js";
76
- import "./chunk-BA5KHLPQ.js";
77
- import "./chunk-PE44LDDQ.js";
76
+ import "./chunk-UTL3MHPC.js";
78
77
  import {
79
78
  ConversationQueueMessageRejectedError,
80
79
  conversationQueueMessageSchema,
@@ -91,7 +90,7 @@ import {
91
90
  import {
92
91
  validatePluginEgressCredentialHooks,
93
92
  validatePluginRegistrations
94
- } from "./chunk-WKBPFZ25.js";
93
+ } from "./chunk-IHNBJHEP.js";
95
94
  import {
96
95
  defineJuniorPlugins,
97
96
  pluginCatalogConfigFromEnv,
@@ -124,7 +123,7 @@ import {
124
123
  setConfigDefaults,
125
124
  shouldEmitDevAgentTrace,
126
125
  shouldPropagateSandboxEgressTrace
127
- } from "./chunk-SS7MAJF5.js";
126
+ } from "./chunk-HT7DSLKL.js";
128
127
  import "./chunk-DIB4GX3G.js";
129
128
  import {
130
129
  RetryableDeliveryError,
@@ -135,7 +134,7 @@ import {
135
134
  formatProviderLabel,
136
135
  postSlackMessage,
137
136
  startOAuthFlow
138
- } from "./chunk-L7EZRQ2J.js";
137
+ } from "./chunk-K6MQWEEJ.js";
139
138
  import {
140
139
  ConversationTurnBoundaryError,
141
140
  CooperativeTurnYieldError,
@@ -191,11 +190,11 @@ import {
191
190
  trimTrailingAssistantMessages,
192
191
  updateConversationStats,
193
192
  upsertConversationMessage
194
- } from "./chunk-CMYDYVOD.js";
193
+ } from "./chunk-7K57FJXR.js";
195
194
  import "./chunk-HDSDCEPK.js";
196
- import "./chunk-AQKVWIPR.js";
197
- import "./chunk-IMLJE2NY.js";
198
- import "./chunk-PR3M62LK.js";
195
+ import "./chunk-MYKSUTUV.js";
196
+ import "./chunk-Q3UF3K77.js";
197
+ import "./chunk-HX236W2U.js";
199
198
  import "./chunk-PDO5BLNM.js";
200
199
  import "./chunk-UIE3R5XU.js";
201
200
  import {
@@ -219,7 +218,7 @@ import {
219
218
  validatePlugins,
220
219
  verifyScheduledTaskCredentialSubject,
221
220
  verifySlackDirectCredentialSubject
222
- } from "./chunk-IXTIJQ7Z.js";
221
+ } from "./chunk-ODB55JM7.js";
223
222
  import {
224
223
  contextProvenance,
225
224
  createSlackDestination,
@@ -230,16 +229,16 @@ import {
230
229
  instructionProvenanceFor,
231
230
  requireSlackDestination,
232
231
  withConversationEventLock
233
- } from "./chunk-DW6SLS5F.js";
232
+ } from "./chunk-IS4DGI5J.js";
234
233
  import {
235
234
  juniorConversationEvents,
236
235
  juniorConversations
237
- } from "./chunk-GCGJGSQL.js";
236
+ } from "./chunk-S4PUICSB.js";
238
237
  import {
239
238
  acquireActiveLock,
240
239
  getStateAdapter,
241
240
  sleep
242
- } from "./chunk-KYKLQYSU.js";
241
+ } from "./chunk-XJYGLTYI.js";
243
242
  import {
244
243
  STANDARD_MODEL_PROFILE,
245
244
  botConfig,
@@ -257,18 +256,18 @@ import {
257
256
  modelIdForProfile,
258
257
  setSlackReactionConfig,
259
258
  standardModelId
260
- } from "./chunk-574YK7QW.js";
259
+ } from "./chunk-KN7QI56S.js";
261
260
  import {
262
261
  juniorDestinations
263
262
  } from "./chunk-VFUK3X5B.js";
264
263
  import {
265
264
  parseSlackThreadId
266
265
  } from "./chunk-S7G34U75.js";
267
- import "./chunk-SMTAXLX4.js";
266
+ import "./chunk-CAPBVX4L.js";
268
267
  import {
269
268
  pluginCatalogRuntime
270
- } from "./chunk-ZO6E537B.js";
271
- import "./chunk-EOSC6JOC.js";
269
+ } from "./chunk-NM3PMQS6.js";
270
+ import "./chunk-2U5CLBYF.js";
272
271
  import {
273
272
  credentialSubjectSchema
274
273
  } from "./chunk-W3U3YQYI.js";
@@ -295,7 +294,7 @@ import {
295
294
  withContext,
296
295
  withLogContext,
297
296
  withSpan
298
- } from "./chunk-ASK74NM6.js";
297
+ } from "./chunk-MVYNJECP.js";
299
298
  import {
300
299
  toOptionalString
301
300
  } from "./chunk-OB42YVAE.js";
@@ -310,10 +309,10 @@ import "./chunk-OOUNJNMR.js";
310
309
  import "./chunk-H4HBKISO.js";
311
310
  import {
312
311
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
313
- } from "./chunk-VMRKIKGO.js";
312
+ } from "./chunk-2R5MASH3.js";
314
313
  import {
315
314
  JUNIOR_VERSION
316
- } from "./chunk-7LDOW4QA.js";
315
+ } from "./chunk-ZXGBLAYQ.js";
317
316
  import "./chunk-MLKGABMK.js";
318
317
 
319
318
  // src/app.ts
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-ZO6E537B.js";
4
- import "./chunk-EOSC6JOC.js";
3
+ } from "./chunk-NM3PMQS6.js";
4
+ import "./chunk-2U5CLBYF.js";
5
5
  import "./chunk-W3U3YQYI.js";
6
6
  import "./chunk-HZF5P5UN.js";
7
- import "./chunk-ASK74NM6.js";
7
+ import "./chunk-MVYNJECP.js";
8
8
  import "./chunk-OB42YVAE.js";
9
9
  import "./chunk-F3B2YJ76.js";
10
10
  import "./chunk-6GWA276C.js";
11
11
  import "./chunk-OOUNJNMR.js";
12
12
  import "./chunk-H4HBKISO.js";
13
- import "./chunk-VMRKIKGO.js";
14
- import "./chunk-7LDOW4QA.js";
13
+ import "./chunk-2R5MASH3.js";
14
+ import "./chunk-ZXGBLAYQ.js";
15
15
  import "./chunk-MLKGABMK.js";
16
16
  export {
17
17
  pluginCatalogRuntime
@@ -72,6 +72,7 @@ export declare function assemblePrompt(args: {
72
72
  resumedFromSessionRecord: boolean;
73
73
  routing: AgentRunRouting;
74
74
  spanContext: LogContext;
75
+ turnId: string;
75
76
  toolGuidance: Array<{
76
77
  name: string;
77
78
  promptGuidelines: AnyToolDefinition["promptGuidelines"];
@@ -944,8 +944,10 @@ export interface ConversationEventPage {
944
944
  }
945
945
  /** Persist and read the canonical per-conversation event log. */
946
946
  export interface ConversationEventStore {
947
- /** Append events atomically, assigning `seq = max+1` under the lease. */
948
- append(conversationId: string, events: NewConversationEvent[]): Promise<void>;
947
+ /** Append events atomically, optionally preserving conversation activity. */
948
+ append(conversationId: string, events: NewConversationEvent[], options?: {
949
+ activity?: "preserve";
950
+ }): Promise<void>;
949
951
  /** Replace active model history with a compaction or handoff event. */
950
952
  replaceHistory(conversationId: string, replacement: HistoryReplacement): Promise<void>;
951
953
  /** One event selected by its retry-stable key across history versions. */
@@ -6,9 +6,12 @@ import type { JuniorSqlDatabase } from "@/db/db";
6
6
  *
7
7
  * First contact creates the row; every later content write advances the
8
8
  * activity clock so retention mirrors append-refresh semantics (each content
9
- * append refreshes the retention window). The timestamp is content-intrinsic
10
- * (the first item's `createdAtMs`), and `greatest(...)` guarantees a backfilled
11
- * or imported historical write — which carries an old timestamp — can never
9
+ * append refreshes the retention window). Background observations may opt out
10
+ * and leave an existing row unchanged. The timestamp is content-intrinsic (the
11
+ * first item's `createdAtMs`), and `greatest(...)` guarantees a backfilled or
12
+ * imported historical write — which carries an old timestamp — can never
12
13
  * regress `last_activity_at`.
13
14
  */
14
- export declare function ensureConversationRow(executor: JuniorSqlDatabase, conversationId: string, atMs: number): Promise<void>;
15
+ export declare function ensureConversationRow(executor: JuniorSqlDatabase, conversationId: string, atMs: number, options?: {
16
+ activity?: "preserve";
17
+ }): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { Destination } from "@sentry/junior-plugin-api";
1
+ import type { Destination, Source } from "@sentry/junior-plugin-api";
2
2
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
3
3
  import type { StoredSlackActor } from "@/chat/actor";
4
4
  import type { JuniorSqlDatabase } from "@/db/db";
@@ -18,6 +18,7 @@ export declare class SqlStore implements ConversationStore {
18
18
  nowMs?: number;
19
19
  actor?: StoredSlackActor;
20
20
  source?: ConversationSource;
21
+ sessionSource?: Source;
21
22
  title?: string;
22
23
  visibility?: ConversationPrivacy;
23
24
  }): Promise<void>;
@@ -1,6 +1,7 @@
1
- import type { Destination } from "@sentry/junior-plugin-api";
1
+ import type { Destination, Source } from "@sentry/junior-plugin-api";
2
2
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
3
3
  import type { StoredSlackActor } from "@/chat/actor";
4
+ import type { SessionSource } from "@/chat/source";
4
5
  import type { AgentTurnUsage } from "@/chat/usage";
5
6
  export type ConversationSource = "api" | "internal" | "local" | "plugin" | "resource_event" | "scheduler" | "slack";
6
7
  export type ConversationStatus = "awaiting_resume" | "failed" | "idle" | "pending" | "running";
@@ -27,6 +28,11 @@ export interface Conversation {
27
28
  actor?: StoredSlackActor;
28
29
  schemaVersion: 1;
29
30
  source?: ConversationSource;
31
+ /**
32
+ * Structured inbound Source locator for this conversation session.
33
+ * Session-stable (Slack thread anchor, not per-message ts). Set-once.
34
+ */
35
+ sessionSource?: SessionSource;
30
36
  title?: string;
31
37
  updatedAtMs: number;
32
38
  /**
@@ -57,6 +63,8 @@ export interface ConversationStore {
57
63
  nowMs?: number;
58
64
  actor?: StoredSlackActor;
59
65
  source?: ConversationSource;
66
+ /** Source normalized to a stable session locator; set-once when absent. */
67
+ sessionSource?: Source;
60
68
  title?: string;
61
69
  /** Source-confirmed visibility from the current event's signal only. */
62
70
  visibility?: ConversationPrivacy;
@@ -59,6 +59,7 @@ export declare function embedTexts(params: {
59
59
  signal?: AbortSignal;
60
60
  metadata?: Record<string, unknown>;
61
61
  }): Promise<{
62
+ costUsd?: number;
62
63
  dimensions: number;
63
64
  model: string;
64
65
  provider: string;
@@ -48,6 +48,7 @@ export declare function getPluginSystemPromptContributions(source: ToolRuntimeCo
48
48
  /** Collect request-scoped plugin prompt contributions. */
49
49
  export declare function getPluginUserPromptContributions(args: {
50
50
  context: Pick<ToolRuntimeContext, "conversationId" | "destination" | "actor" | "source" | "userText">;
51
+ turnId?: string;
51
52
  }): Promise<PluginPromptContributionContext[]>;
52
53
  /** Collect turn-scoped tools exposed by plugins. */
53
54
  export declare function getPluginTools(context: ToolRuntimeContext): Record<string, AnyToolDefinition>;
@@ -0,0 +1,3 @@
1
+ import type { PluginConversationEventStats, PluginRegistration } from "@sentry/junior-plugin-api";
2
+ /** Create aggregate event-cost reads bound to one plugin's registered namespace. */
3
+ export declare function createPluginConversationEventStats(plugin: PluginRegistration, now?: () => number): PluginConversationEventStats;
@@ -1,5 +1,5 @@
1
1
  import type { ConversationEventPresentation, PluginConversationEvents, PluginRegistration } from "@sentry/junior-plugin-api";
2
- /** Create a conversation-bound writer for one plugin task operation. */
2
+ /** Create a conversation-bound writer for one plugin operation. */
3
3
  export declare function createPluginConversationEvents(args: {
4
4
  conversationId: string;
5
5
  operationId: string;
@@ -0,0 +1,5 @@
1
+ /** Build Slack's browser-safe redirect to a conversation when its IDs are valid. */
2
+ export declare function buildSlackSourceUrl(args: {
3
+ channelId: string;
4
+ teamId: string;
5
+ }): string | undefined;
@@ -0,0 +1,16 @@
1
+ import { type Source } from "@sentry/junior-plugin-api";
2
+ /** Source coordinates reduced to the stable locator for one conversation. */
3
+ export type SessionSource = Extract<Source, {
4
+ platform: "local";
5
+ }> | (Omit<Extract<Source, {
6
+ platform: "slack";
7
+ }>, "messageTs" | "threadTs"> & {
8
+ threadTs: string;
9
+ });
10
+ /**
11
+ * Normalize a turn Source into the session-stable locator persisted on a
12
+ * conversation. Drops per-message timestamps; requires a Slack thread anchor.
13
+ */
14
+ export declare function normalizeSessionSource(value: Source | undefined): SessionSource | undefined;
15
+ /** Parse a serialized Source into the stable locator stored on a conversation. */
16
+ export declare function parseSessionSource(value: unknown): SessionSource | undefined;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JUNIOR_VERSION
3
- } from "./chunk-7LDOW4QA.js";
3
+ } from "./chunk-ZXGBLAYQ.js";
4
4
 
5
5
  // src/deployment.ts
6
6
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
@@ -5,7 +5,7 @@ import {
5
5
  logInfo,
6
6
  logWarn,
7
7
  setSpanAttributes
8
- } from "./chunk-ASK74NM6.js";
8
+ } from "./chunk-MVYNJECP.js";
9
9
  import {
10
10
  discoverInstalledPluginPackageContent,
11
11
  normalizePluginPackageNames
@@ -74,10 +74,22 @@ var actorIdentitySchema = z2.object({
74
74
  slackUserId: z2.string().optional(),
75
75
  slackUserName: z2.string().optional()
76
76
  }).strict();
77
+ var conversationAuxiliaryCostsSchema = z2.object({
78
+ costUsd: z2.number().finite().nonnegative(),
79
+ operations: z2.array(
80
+ z2.object({
81
+ costUsd: z2.number().finite().nonnegative(),
82
+ events: z2.number().int().positive(),
83
+ name: z2.string().min(1),
84
+ namespace: z2.string().min(1)
85
+ }).strict()
86
+ ).min(1)
87
+ }).strict();
77
88
  var conversationSummaryReportSchema = z2.object({
78
89
  displayTitle: z2.string(),
79
90
  cumulativeDurationMs: z2.number(),
80
91
  cumulativeUsage: conversationUsageSchema.optional(),
92
+ auxiliaryCosts: conversationAuxiliaryCostsSchema.optional(),
81
93
  conversationId: z2.string(),
82
94
  isParticipant: z2.boolean(),
83
95
  status: conversationReportStatusSchema,
@@ -92,6 +104,7 @@ var conversationSummaryReportSchema = z2.object({
92
104
  channelNameRedacted: z2.boolean().optional(),
93
105
  locationId: z2.string().optional(),
94
106
  sentryTraceUrl: z2.string().optional(),
107
+ sourceUrl: z2.string().url().optional(),
95
108
  traceId: z2.string().optional()
96
109
  }).strict();
97
110
  var conversationReportMessageEventDataSchema = z2.object({
@@ -592,6 +605,7 @@ export {
592
605
  conversationFeedQuerySchema,
593
606
  archiveConversationBodySchema,
594
607
  archiveConversationResponseSchema,
608
+ conversationAuxiliaryCostsSchema,
595
609
  conversationSummaryReportSchema,
596
610
  conversationReportEventDataSchema,
597
611
  conversationReportEventSchema,
@@ -4,7 +4,7 @@ import {
4
4
  agentTurnUsageSchema,
5
5
  authenticationLinkedEvent,
6
6
  authenticationUnlinkedEvent
7
- } from "./chunk-PR3M62LK.js";
7
+ } from "./chunk-HX236W2U.js";
8
8
  import {
9
9
  agentHistoryItemSchema,
10
10
  contextProvenance,
@@ -16,17 +16,17 @@ import {
16
16
  instructionProvenanceFor,
17
17
  sanitizePostgresJson,
18
18
  withConversationEventLock
19
- } from "./chunk-DW6SLS5F.js";
19
+ } from "./chunk-IS4DGI5J.js";
20
20
  import {
21
21
  getStateAdapter,
22
22
  sleep
23
- } from "./chunk-KYKLQYSU.js";
23
+ } from "./chunk-XJYGLTYI.js";
24
24
  import {
25
25
  botConfig,
26
26
  escapeXml,
27
27
  resolveGatewayModel,
28
28
  unwrapCurrentInstruction
29
- } from "./chunk-574YK7QW.js";
29
+ } from "./chunk-KN7QI56S.js";
30
30
  import {
31
31
  toStoredSlackActor
32
32
  } from "./chunk-HZF5P5UN.js";
@@ -35,7 +35,7 @@ import {
35
35
  logException,
36
36
  logWarn,
37
37
  setSpanAttributes
38
- } from "./chunk-ASK74NM6.js";
38
+ } from "./chunk-MVYNJECP.js";
39
39
  import {
40
40
  isRecord,
41
41
  toOptionalNumber,
@@ -1502,6 +1502,7 @@ async function recordConversationActivityMetadata(args) {
1502
1502
  nowMs: args.nowMs,
1503
1503
  actor: sessionLogActor(args.summary.actor),
1504
1504
  source,
1505
+ ...args.summary.source ? { sessionSource: args.summary.source } : {},
1505
1506
  visibility: args.destinationVisibility
1506
1507
  });
1507
1508
  await conversationStore.recordExecution({
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-ZO6E537B.js";
3
+ } from "./chunk-NM3PMQS6.js";
4
4
  import {
5
5
  logWarn
6
- } from "./chunk-ASK74NM6.js";
6
+ } from "./chunk-MVYNJECP.js";
7
7
  import {
8
8
  skillRoots
9
9
  } from "./chunk-H4HBKISO.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  healthReportSchema
3
- } from "./chunk-PE44LDDQ.js";
3
+ } from "./chunk-UTL3MHPC.js";
4
4
  import {
5
5
  normalizeSlackConversationId
6
- } from "./chunk-IXTIJQ7Z.js";
6
+ } from "./chunk-ODB55JM7.js";
7
7
  import {
8
8
  parseSlackThreadId
9
9
  } from "./chunk-S7G34U75.js";
@@ -30,7 +30,7 @@ import {
30
30
  toMcpProviderError,
31
31
  toolInvocationDestination,
32
32
  uploadFilesToConversation
33
- } from "./chunk-L7EZRQ2J.js";
33
+ } from "./chunk-K6MQWEEJ.js";
34
34
  import {
35
35
  CooperativeTurnYieldError,
36
36
  JUNIOR_THREAD_STATE_TTL_MS,
@@ -80,7 +80,7 @@ import {
80
80
  stripRuntimeTurnContext,
81
81
  trimTrailingAssistantMessages,
82
82
  updateConversationStats
83
- } from "./chunk-CMYDYVOD.js";
83
+ } from "./chunk-7K57FJXR.js";
84
84
  import {
85
85
  parseSandboxEgressAuthRequiredSignal,
86
86
  parseSandboxEgressPermissionDeniedSignal,
@@ -104,14 +104,14 @@ import {
104
104
  runNonInteractiveCommand,
105
105
  throwSandboxOperationError,
106
106
  wrapSandboxSetupError
107
- } from "./chunk-AQKVWIPR.js";
107
+ } from "./chunk-MYKSUTUV.js";
108
108
  import {
109
109
  incrementStat
110
- } from "./chunk-IMLJE2NY.js";
110
+ } from "./chunk-Q3UF3K77.js";
111
111
  import {
112
112
  addAgentTurnUsage,
113
113
  hasAgentTurnUsage
114
- } from "./chunk-PR3M62LK.js";
114
+ } from "./chunk-HX236W2U.js";
115
115
  import {
116
116
  privateTraceResultAttributes
117
117
  } from "./chunk-UIE3R5XU.js";
@@ -129,7 +129,7 @@ import {
129
129
  normalizeSlackConversationId,
130
130
  resolveChannelCapabilities,
131
131
  withSlackRetries
132
- } from "./chunk-IXTIJQ7Z.js";
132
+ } from "./chunk-ODB55JM7.js";
133
133
  import {
134
134
  KNOWN_CONVERSATION_EVENT_TYPES,
135
135
  contextProvenance,
@@ -139,7 +139,7 @@ import {
139
139
  instructionActors,
140
140
  instructionProvenanceFor,
141
141
  sameActorIdentity
142
- } from "./chunk-DW6SLS5F.js";
142
+ } from "./chunk-IS4DGI5J.js";
143
143
  import {
144
144
  SANDBOX_DATA_ROOT,
145
145
  SANDBOX_SKILLS_ROOT,
@@ -149,7 +149,7 @@ import {
149
149
  sandboxSkillFile,
150
150
  sandboxSkillPathResolution,
151
151
  sleep
152
- } from "./chunk-KYKLQYSU.js";
152
+ } from "./chunk-XJYGLTYI.js";
153
153
  import {
154
154
  ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
155
155
  COMPACTION_SUMMARY_PREFIX,
@@ -183,7 +183,7 @@ import {
183
183
  renderCurrentInstruction,
184
184
  resolveGatewayModel,
185
185
  unwrapCurrentInstruction
186
- } from "./chunk-574YK7QW.js";
186
+ } from "./chunk-KN7QI56S.js";
187
187
  import {
188
188
  canExposeConversationPayload,
189
189
  parseSlackThreadId,
@@ -200,10 +200,10 @@ import {
200
200
  findSkillByName,
201
201
  loadSkillsByName,
202
202
  parseSkillInvocation
203
- } from "./chunk-SMTAXLX4.js";
203
+ } from "./chunk-CAPBVX4L.js";
204
204
  import {
205
205
  pluginCatalogRuntime
206
- } from "./chunk-ZO6E537B.js";
206
+ } from "./chunk-NM3PMQS6.js";
207
207
  import {
208
208
  CredentialUnavailableError,
209
209
  OAuthProviderError,
@@ -211,7 +211,7 @@ import {
211
211
  getOAuthProviderErrorAttributes,
212
212
  resolveAuthTokenPlaceholder,
213
213
  resolvePluginCommandEnv
214
- } from "./chunk-EOSC6JOC.js";
214
+ } from "./chunk-2U5CLBYF.js";
215
215
  import {
216
216
  credentialUserSubjectId
217
217
  } from "./chunk-W3U3YQYI.js";
@@ -235,7 +235,7 @@ import {
235
235
  summarizeMessageText,
236
236
  withLogContext,
237
237
  withSpan
238
- } from "./chunk-ASK74NM6.js";
238
+ } from "./chunk-MVYNJECP.js";
239
239
  import {
240
240
  parseSlackChannelId,
241
241
  parseSlackMessageTs,
@@ -2374,7 +2374,8 @@ async function assemblePrompt(args) {
2374
2374
  );
2375
2375
  const baseInstructions = [buildSystemPrompt({ source }), pluginSystemPrompt].filter((section) => Boolean(section)).join("\n\n");
2376
2376
  const pluginUserPromptContributions = !shouldPromptAgent || replayedPromptContent ? [] : await getPluginUserPromptContributions({
2377
- context: args.toolRuntimeContext
2377
+ context: args.toolRuntimeContext,
2378
+ turnId: args.turnId
2378
2379
  });
2379
2380
  const turnContextPrompt = needsBootstrapContextForPrompt || pluginUserPromptContributions.length > 0 ? buildTurnContextPrompt({
2380
2381
  availableSkills: args.availableSkills,
@@ -15881,6 +15882,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
15881
15882
  resumedFromSessionRecord,
15882
15883
  routing,
15883
15884
  spanContext,
15885
+ turnId,
15884
15886
  toolGuidance: wiring.toolGuidance,
15885
15887
  toolRuntimeContext: wiring.toolRuntimeContext,
15886
15888
  userContentParts
@@ -57,7 +57,10 @@ var authenticationUnlinkedEvent = defineConversationEvent({
57
57
  };
58
58
  }
59
59
  });
60
- var NATIVE_EVENT_DEFINITIONS = [authenticationLinkedEvent, authenticationUnlinkedEvent];
60
+ var NATIVE_EVENT_DEFINITIONS = [
61
+ authenticationLinkedEvent,
62
+ authenticationUnlinkedEvent
63
+ ];
61
64
  function getJuniorNativeEventDefinition(args) {
62
65
  return NATIVE_EVENT_DEFINITIONS.find(
63
66
  (definition) => definition.eventName === args.name && definition.version === args.version
@@ -67,9 +70,8 @@ function renderJuniorNativeConversationEvent(args) {
67
70
  if (args.namespace !== JUNIOR_NATIVE_EVENT_NAMESPACE) return void 0;
68
71
  const definition = getJuniorNativeEventDefinition(args);
69
72
  if (!definition) return void 0;
70
- return conversationEventPresentationSchema.parse(
71
- definition.renderEvent(definition.parse(args.content))
72
- );
73
+ const presentation = definition.renderEvent(definition.parse(args.content));
74
+ return presentation === void 0 ? void 0 : conversationEventPresentationSchema.parse(presentation);
73
75
  }
74
76
 
75
77
  // src/chat/usage.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-ZO6E537B.js";
3
+ } from "./chunk-NM3PMQS6.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";