@sentry/junior 0.189.0 → 0.191.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 (86) hide show
  1. package/dist/{agent-hooks-6QRYH6PX.js → agent-hooks-HIWWBBKO.js} +11 -11
  2. package/dist/api.js +27 -27
  3. package/dist/app.js +134 -152
  4. package/dist/{catalog-runtime-IETJLJFG.js → catalog-runtime-4OKH4265.js} +4 -4
  5. package/dist/chat/actor.d.ts +7 -2
  6. package/dist/chat/agent/resume.d.ts +0 -1
  7. package/dist/chat/agent/types.d.ts +0 -1
  8. package/dist/chat/agent-invocations/types.d.ts +44 -308
  9. package/dist/chat/event-tasks/tool-support.d.ts +1 -1
  10. package/dist/chat/providers/slack/runtime.d.ts +1 -2
  11. package/dist/chat/providers/slack/system-turn.d.ts +9 -4
  12. package/dist/chat/providers/slack/turn.d.ts +0 -1
  13. package/dist/chat/resource-events/actor.d.ts +2 -2
  14. package/dist/chat/services/turn-router.d.ts +1 -1
  15. package/dist/chat/slack/dispatch-turn.d.ts +0 -1
  16. package/dist/chat/slack/timestamp-param.d.ts +1 -1
  17. package/dist/chat/source.d.ts +3 -3
  18. package/dist/chat/task-execution/assistant-message.d.ts +7 -7
  19. package/dist/chat/task-execution/checkpoint.d.ts +0 -1
  20. package/dist/chat/task-execution/conversation-turn.d.ts +2 -2
  21. package/dist/chat/task-execution/mailbox-turn.d.ts +16 -6
  22. package/dist/chat/task-execution/state.d.ts +2 -5
  23. package/dist/chat/task-execution/store.d.ts +1 -2
  24. package/dist/chat/task-execution/turn-cursor.d.ts +10 -3
  25. package/dist/chat/task-execution/worker.d.ts +0 -1
  26. package/dist/chat/tools/types.d.ts +9 -2
  27. package/dist/{chunk-BYBSI5TI.js → chunk-2JAWOTUT.js} +2 -2
  28. package/dist/{chunk-WN6VLHOU.js → chunk-3PDR63SX.js} +30 -9
  29. package/dist/{chunk-SR6OMO5C.js → chunk-5IMKUVMS.js} +8 -11
  30. package/dist/{chunk-YYSEH2WC.js → chunk-6KISW5UY.js} +2 -2
  31. package/dist/{chunk-WDHPN2GH.js → chunk-7PYCRKQL.js} +3 -3
  32. package/dist/{chunk-YNZPOFF3.js → chunk-AWFSSFAX.js} +9 -11
  33. package/dist/{chunk-OEIITG5F.js → chunk-BVWC5DBM.js} +1 -1
  34. package/dist/{chunk-DYXVAO2E.js → chunk-BVYUIVXE.js} +1 -1
  35. package/dist/{chunk-WYDF6PGK.js → chunk-CCPOZMS4.js} +3 -3
  36. package/dist/{chunk-YYZNESC3.js → chunk-CECRMPXJ.js} +9 -8
  37. package/dist/{chunk-6AUR6PWR.js → chunk-CUUE5MGF.js} +3 -3
  38. package/dist/{chunk-MVPLEPSI.js → chunk-DP6H3U2X.js} +1 -1
  39. package/dist/{chunk-E3PDZPGV.js → chunk-EQZUBYRF.js} +1 -1
  40. package/dist/{chunk-PCPSX4ES.js → chunk-GQN4REF5.js} +14 -12
  41. package/dist/{chunk-AC7MDOJW.js → chunk-HNMRX2EN.js} +5 -5
  42. package/dist/{chunk-7R5JRPCY.js → chunk-K2NKG42A.js} +5 -5
  43. package/dist/{chunk-MFSET7Q7.js → chunk-KTW62MG5.js} +31 -13
  44. package/dist/{chunk-PY3EIEAF.js → chunk-L4JLLS6C.js} +1 -1
  45. package/dist/{chunk-CMWIMFM6.js → chunk-LOYTPSAK.js} +5 -5
  46. package/dist/{chunk-S3SGZUOI.js → chunk-MFZOIKET.js} +1 -1
  47. package/dist/{chunk-MI6ZBDTS.js → chunk-NK3UEKAW.js} +25 -10
  48. package/dist/{chunk-QNIOBNOY.js → chunk-NY5SJGJZ.js} +52 -46
  49. package/dist/{chunk-4RHJ3CXR.js → chunk-Q32BSFN4.js} +13 -12
  50. package/dist/{chunk-ZV6PFUA4.js → chunk-QRNJO7DZ.js} +1 -1
  51. package/dist/{chunk-KN32OWL2.js → chunk-RZS4F5K4.js} +3 -3
  52. package/dist/{chunk-CUYFCI4G.js → chunk-S7NSFCCW.js} +16 -13
  53. package/dist/{chunk-5VWAY27R.js → chunk-SEIZ2XLD.js} +1 -1
  54. package/dist/{chunk-MRXMFB4L.js → chunk-SGRL7NV6.js} +5 -5
  55. package/dist/{chunk-WWYUYKKV.js → chunk-TH6LMEOW.js} +1 -1
  56. package/dist/{chunk-WMUAKAIF.js → chunk-VGYZ3YZM.js} +85 -41
  57. package/dist/{chunk-ZUPDSJUE.js → chunk-WBNQYVCM.js} +2 -2
  58. package/dist/{chunk-GP32KD2J.js → chunk-WCSXTDOL.js} +1 -1
  59. package/dist/{chunk-O35GZCKL.js → chunk-WNIVCR74.js} +2 -2
  60. package/dist/{chunk-UCWO5MKP.js → chunk-X6PQKQTY.js} +5 -7
  61. package/dist/{chunk-5CXCGDIL.js → chunk-YNRLCUCB.js} +1 -1
  62. package/dist/{chunk-LHKZKAZ4.js → chunk-ZJRGWZZ2.js} +3 -3
  63. package/dist/{chunk-NY2F7BZA.js → chunk-ZNFNGDT7.js} +1 -1
  64. package/dist/{chunk-VKQWU4PO.js → chunk-ZRN3OS7M.js} +1 -1
  65. package/dist/cli/chat.js +33 -33
  66. package/dist/cli/check.js +5 -5
  67. package/dist/cli/plugins.js +12 -12
  68. package/dist/cli/snapshot-create.js +9 -9
  69. package/dist/cli/upgrade.js +6 -6
  70. package/dist/db/schema/agent-invocations.d.ts +18 -6
  71. package/dist/db/schema.d.ts +18 -6
  72. package/dist/{db-LPJKR2EO.js → db-LG4ZEWA3.js} +6 -6
  73. package/dist/instrumentation.js +3 -3
  74. package/dist/nitro.js +6 -6
  75. package/dist/{oauth-callback-server-DMXF4TTQ.js → oauth-callback-server-KI7ZRTOG.js} +29 -29
  76. package/dist/{runner-L5DPVYCN.js → runner-K2EOSAZQ.js} +21 -21
  77. package/dist/{skills-NXG3LBCK.js → skills-JTRDFKMA.js} +5 -5
  78. package/dist/spawn-SRBETYCF.js +42 -0
  79. package/dist/task-runner-INQIQ4VF.js +36 -0
  80. package/dist/{validation-CH36LTOS.js → validation-NBWURHAP.js} +5 -5
  81. package/dist/version.js +1 -1
  82. package/dist/{work-HBC5Y5VZ.js → work-35TBEAUI.js} +21 -21
  83. package/dist/{worker-5RDZHLXH.js → worker-F762M6XM.js} +10 -10
  84. package/package.json +6 -6
  85. package/dist/spawn-VRUIGKWW.js +0 -42
  86. package/dist/task-runner-7YTBSPXW.js +0 -36
@@ -7,23 +7,23 @@ import {
7
7
  import {
8
8
  formatProviderLabel,
9
9
  startOAuthFlow
10
- } from "./chunk-PCPSX4ES.js";
10
+ } from "./chunk-GQN4REF5.js";
11
11
  import {
12
12
  abandonReplacedPendingAuth,
13
13
  canReusePendingAuthLink
14
- } from "./chunk-GP32KD2J.js";
14
+ } from "./chunk-WCSXTDOL.js";
15
15
  import {
16
16
  recordAuthorizationRequested
17
- } from "./chunk-MFSET7Q7.js";
17
+ } from "./chunk-KTW62MG5.js";
18
18
  import {
19
19
  AGENT_INVOCATION_MAILBOX_STATUSES
20
- } from "./chunk-5VWAY27R.js";
20
+ } from "./chunk-SEIZ2XLD.js";
21
21
  import {
22
22
  TURN_REASONING_LEVELS
23
23
  } from "./chunk-D4YV5TDV.js";
24
24
  import {
25
25
  pluginCatalogRuntime
26
- } from "./chunk-E3PDZPGV.js";
26
+ } from "./chunk-EQZUBYRF.js";
27
27
  import {
28
28
  credentialContextSchema
29
29
  } from "./chunk-CEMMLV5L.js";
@@ -2,16 +2,16 @@ import {
2
2
  coerceThreadConversationState,
3
3
  getPersistedThreadState,
4
4
  persistThreadStateById
5
- } from "./chunk-MRXMFB4L.js";
5
+ } from "./chunk-SGRL7NV6.js";
6
6
  import {
7
7
  clearPendingAuth,
8
8
  markTurnClosed,
9
9
  markTurnCompleted
10
- } from "./chunk-GP32KD2J.js";
10
+ } from "./chunk-WCSXTDOL.js";
11
11
  import {
12
12
  hydrateConversationMessages,
13
13
  markConversationMessage
14
- } from "./chunk-MFSET7Q7.js";
14
+ } from "./chunk-KTW62MG5.js";
15
15
  import {
16
16
  buildDeterministicTurnId
17
17
  } from "./chunk-DA2KGZZI.js";
@@ -20,13 +20,13 @@ import {
20
20
  findProviderError,
21
21
  getProviderErrorAttributes,
22
22
  getProviderErrorUserMessage
23
- } from "./chunk-BYBSI5TI.js";
23
+ } from "./chunk-2JAWOTUT.js";
24
24
  import {
25
25
  parseSlackMessageTs
26
26
  } from "./chunk-N7TMSOZH.js";
27
27
  import {
28
28
  buildTurnFailureResponse
29
- } from "./chunk-PY3EIEAF.js";
29
+ } from "./chunk-L4JLLS6C.js";
30
30
 
31
31
  // src/chat/runtime/delivered-turn-state.ts
32
32
  function buildDeliveredTurnStatePatch(args) {
@@ -7,7 +7,7 @@ import {
7
7
  authenticationUnlinkedEvent,
8
8
  fallbackShortTitle,
9
9
  generateShortTitle
10
- } from "./chunk-O35GZCKL.js";
10
+ } from "./chunk-WNIVCR74.js";
11
11
  import {
12
12
  bindProviderConversation,
13
13
  createSqlConversationEventStore,
@@ -16,18 +16,18 @@ import {
16
16
  getSqlExecutor,
17
17
  sanitizePostgresJson,
18
18
  withConversationEventLock
19
- } from "./chunk-CUYFCI4G.js";
19
+ } from "./chunk-S7NSFCCW.js";
20
20
  import {
21
21
  SANDBOX_REPOS_ROOT,
22
22
  SANDBOX_WORKSPACE_ROOT,
23
23
  sleep
24
- } from "./chunk-WDHPN2GH.js";
24
+ } from "./chunk-7PYCRKQL.js";
25
25
  import {
26
26
  MUTATION_LOCK_TTL_MS,
27
27
  fenceLock,
28
28
  getStateAdapter,
29
29
  withLock
30
- } from "./chunk-5CXCGDIL.js";
30
+ } from "./chunk-YNRLCUCB.js";
31
31
  import {
32
32
  agentHistoryItemSchema,
33
33
  contextProvenance,
@@ -40,7 +40,7 @@ import {
40
40
  escapeXml,
41
41
  resolveGatewayModel,
42
42
  unwrapCurrentInstruction
43
- } from "./chunk-BYBSI5TI.js";
43
+ } from "./chunk-2JAWOTUT.js";
44
44
  import {
45
45
  parseSlackMessageTs,
46
46
  toStoredSlackActor
@@ -50,7 +50,7 @@ import {
50
50
  logException,
51
51
  logWarn,
52
52
  setSpanAttributes
53
- } from "./chunk-PY3EIEAF.js";
53
+ } from "./chunk-L4JLLS6C.js";
54
54
 
55
55
  // src/chat/turn-context-tag.ts
56
56
  var TURN_CONTEXT_TAG = "runtime-turn-context";
@@ -1556,6 +1556,10 @@ async function persistWithRetry(persist) {
1556
1556
  }
1557
1557
 
1558
1558
  // src/chat/task-execution/turn-cursor.ts
1559
+ import {
1560
+ actorSchema,
1561
+ sourceSchema
1562
+ } from "@sentry/junior-plugin-api";
1559
1563
  import { z as z2 } from "zod";
1560
1564
 
1561
1565
  // src/chat/repository-instructions.ts
@@ -2047,6 +2051,8 @@ var storedTurnSummarySchema = z2.object({
2047
2051
  updatedAtMs: nonNegativeNumberSchema
2048
2052
  }).strip();
2049
2053
  var storedTurnRecordSchema = z2.object({
2054
+ // TODO(dcramer): Require Actor after no deployed Turn cursor can omit it.
2055
+ actor: actorSchema.optional(),
2050
2056
  schemaVersion: z2.literal(TURN_CURSOR_SCHEMA_VERSION),
2051
2057
  version: z2.number().int().nonnegative(),
2052
2058
  conversationId: z2.string().min(1),
@@ -2056,6 +2062,7 @@ var storedTurnRecordSchema = z2.object({
2056
2062
  lastProgressAtMs: nonNegativeNumberSchema,
2057
2063
  resumeReason: turnPauseReasonSchema.optional(),
2058
2064
  publishExternally: z2.boolean().optional(),
2065
+ source: sourceSchema.optional(),
2059
2066
  resumedFromSliceId: z2.number().int().nonnegative().optional(),
2060
2067
  turnId: z2.string().min(1),
2061
2068
  sliceId: z2.number().int().nonnegative(),
@@ -2120,7 +2127,7 @@ async function recordConversationActivityMetadata(args) {
2120
2127
  if (!hasParent && !destination && !conversation) {
2121
2128
  return;
2122
2129
  }
2123
- const activitySource = hasParent ? "internal" : args.source?.platform === "web" ? "web" : destination?.platform === "local" ? "local" : destination ? args.summary.surface : void 0;
2130
+ const activitySource = hasParent ? "internal" : args.source?.kind === "web" ? "web" : destination?.platform === "local" ? "local" : destination ? args.summary.surface : void 0;
2124
2131
  await conversationStore.recordActivity({
2125
2132
  activityAtMs: args.summary.updatedAtMs,
2126
2133
  channelName: args.summary.channelName,
@@ -2152,6 +2159,7 @@ async function recordConversationActivityMetadata(args) {
2152
2159
  function materializeTurnRecord(stored, piProjection, turnStartMessageIndex, restoreVolatileContext = true, runtimeMetrics) {
2153
2160
  const restoredProjection = restoreVolatileContext && (stored.state === "running" || stored.state === "paused") ? restoreRuntimeContext(piProjection, stored.runtimeContext) : piProjection;
2154
2161
  return {
2162
+ ...definedProps({ actor: stored.actor }),
2155
2163
  schemaVersion: stored.schemaVersion,
2156
2164
  version: stored.version,
2157
2165
  conversationId: stored.conversationId,
@@ -2172,7 +2180,7 @@ function materializeTurnRecord(stored, piProjection, turnStartMessageIndex, rest
2172
2180
  dispatchOutcome: stored.dispatchOutcome,
2173
2181
  errorMessage: stored.errorMessage,
2174
2182
  resumeReason: stored.resumeReason,
2175
- publishExternally: stored.publishExternally,
2183
+ source: stored.source,
2176
2184
  resultMessageId: stored.resultMessageId,
2177
2185
  resumedFromSliceId: stored.resumedFromSliceId,
2178
2186
  surface: stored.surface,
@@ -2279,12 +2287,14 @@ function buildStoredRecord(args) {
2279
2287
  updatedAtMs: nowMs,
2280
2288
  committedSeq: args.committedSeq,
2281
2289
  ...definedProps({
2290
+ actor: args.actor,
2282
2291
  dispatchId: args.dispatchId,
2283
2292
  dispatchOutcome: args.dispatchOutcome,
2284
2293
  errorMessage: args.errorMessage,
2285
2294
  historyVersion: args.historyVersion,
2286
2295
  resumeReason: args.resumeReason,
2287
2296
  publishExternally: args.publishExternally,
2297
+ source: args.source,
2288
2298
  resultMessageId: args.resultMessageId,
2289
2299
  resumedFromSliceId: args.resumedFromSliceId,
2290
2300
  runtimeContext: args.runtimeContext && args.runtimeContext.length > 0 ? args.runtimeContext : void 0,
@@ -2343,6 +2353,7 @@ async function updateTurnState(args) {
2343
2353
  return void 0;
2344
2354
  }
2345
2355
  return await setStoredRecord({
2356
+ actor: args.existing.actor,
2346
2357
  fence: args.fence,
2347
2358
  piMessages: args.existing.piMessages,
2348
2359
  piMessageProvenance: args.existing.piMessageProvenance,
@@ -2358,6 +2369,7 @@ async function updateTurnState(args) {
2358
2369
  turnStartMessageIndex: args.existing.turnStartMessageIndex
2359
2370
  }),
2360
2371
  record: buildStoredRecord({
2372
+ actor: args.existing.actor,
2361
2373
  conversationId: args.existing.conversationId,
2362
2374
  turnId: args.existing.turnId,
2363
2375
  sliceId: args.existing.sliceId,
@@ -2372,7 +2384,8 @@ async function updateTurnState(args) {
2372
2384
  errorMessage: args.errorMessage ?? args.existing.errorMessage,
2373
2385
  historyVersion: parsed.historyVersion,
2374
2386
  resumeReason: args.existing.resumeReason,
2375
- publishExternally: args.existing.publishExternally,
2387
+ publishExternally: parsed.publishExternally,
2388
+ source: args.existing.source,
2376
2389
  resultMessageId: args.resultMessageId ?? args.existing.resultMessageId,
2377
2390
  resumedFromSliceId: args.existing.resumedFromSliceId,
2378
2391
  surface: args.existing.surface,
@@ -2425,8 +2438,12 @@ async function upsertTurnRecordLocked(args, fence) {
2425
2438
  const retainedRuntimeContext = runtimeContext.length > 0 ? runtimeContext : existingRecord?.historyVersion === commit.historyVersion ? existingRecord.runtimeContext : void 0;
2426
2439
  const turnStartSeq = durableTurnStartMessageIndex === void 0 ? existingRecord?.turnStartSeq : durableTurnStartMessageIndex <= 0 ? -1 : commit.messageSeqs[durableTurnStartMessageIndex - 1] ?? commit.committedSeq;
2427
2440
  const turnStartMessageIndex = durableTurnStartMessageIndex ?? (turnStartSeq === void 0 ? void 0 : commit.messageSeqs.filter((seq) => seq <= turnStartSeq).length);
2441
+ const turnSource = args.source ?? existingRecord?.source;
2442
+ const dispatchId = args.dispatchId ?? existingRecord?.dispatchId;
2443
+ const hasProviderLocation = Boolean(conversation?.location) || args.destination?.platform === "slack";
2444
+ const publishExternally = dispatchId || turnSource ? hasProviderLocation && (Boolean(dispatchId) || turnSource?.kind === "slack" || turnSource?.kind === "resource_event") : existingRecord?.publishExternally ?? false;
2428
2445
  return await setStoredRecord({
2429
- actor: args.actor,
2446
+ actor: existingRecord?.actor ?? args.actor,
2430
2447
  fence,
2431
2448
  conversationStore: args.conversationStore,
2432
2449
  destination: args.destination,
@@ -2447,6 +2464,7 @@ async function upsertTurnRecordLocked(args, fence) {
2447
2464
  ...definedProps({ indexTtlMs: args.ttlMs }),
2448
2465
  turnStartMessageIndex,
2449
2466
  record: buildStoredRecord({
2467
+ actor: existingRecord?.actor ?? args.actor,
2450
2468
  conversationId: args.conversationId,
2451
2469
  turnId: args.turnId,
2452
2470
  sliceId: args.sliceId,
@@ -2455,12 +2473,13 @@ async function upsertTurnRecordLocked(args, fence) {
2455
2473
  historyVersion: commit.historyVersion,
2456
2474
  previousVersion: existingRecord?.version,
2457
2475
  ...definedProps({
2458
- dispatchId: args.dispatchId ?? existingRecord?.dispatchId,
2476
+ dispatchId,
2459
2477
  dispatchOutcome: args.dispatchOutcome ?? existingRecord?.dispatchOutcome,
2460
2478
  errorMessage: args.errorMessage,
2461
2479
  lastProgressAtMs: args.lastProgressAtMs,
2462
2480
  resumeReason: args.resumeReason,
2463
- publishExternally: args.publishExternally ?? existingRecord?.publishExternally,
2481
+ publishExternally,
2482
+ source: args.source ?? existingRecord?.source,
2464
2483
  resultMessageId: args.resultMessageId ?? existingRecord?.resultMessageId,
2465
2484
  resumedFromSliceId: args.resumedFromSliceId,
2466
2485
  runtimeContext: args.state === "running" || args.state === "paused" ? retainedRuntimeContext : void 0,
@@ -2677,7 +2696,6 @@ function sharedWrite(args, latest) {
2677
2696
  destination: args.destination,
2678
2697
  destinationVisibility: args.destinationVisibility,
2679
2698
  dispatchId: args.dispatchId ?? latest?.dispatchId,
2680
- publishExternally: args.publishExternally ?? latest?.publishExternally,
2681
2699
  source: args.source,
2682
2700
  surface: args.surface ?? latest?.surface,
2683
2701
  traceId: getActiveTraceId() ?? latest?.traceId,
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-PEQXYSSE.js";
13
13
  import {
14
14
  JUNIOR_VERSION
15
- } from "./chunk-NY2F7BZA.js";
15
+ } from "./chunk-ZNFNGDT7.js";
16
16
 
17
17
  // src/deployment.ts
18
18
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ToolInputError
3
- } from "./chunk-O35GZCKL.js";
3
+ } from "./chunk-WNIVCR74.js";
4
4
  import {
5
5
  getPlugins
6
- } from "./chunk-MI6ZBDTS.js";
6
+ } from "./chunk-NK3UEKAW.js";
7
7
  import {
8
8
  getDb
9
- } from "./chunk-CUYFCI4G.js";
9
+ } from "./chunk-S7NSFCCW.js";
10
10
  import {
11
11
  juniorAttachments,
12
12
  juniorConversations,
@@ -14,7 +14,7 @@ import {
14
14
  juniorSchedulerRuns,
15
15
  juniorSchedulerTasks,
16
16
  juniorStats
17
- } from "./chunk-5VWAY27R.js";
17
+ } from "./chunk-SEIZ2XLD.js";
18
18
  import {
19
19
  juniorDestinations
20
20
  } from "./chunk-VFUK3X5B.js";
@@ -542,7 +542,7 @@ function requireSupportedEventTaskTrigger(catalog, trigger) {
542
542
  });
543
543
  }
544
544
  function requireEventTaskSlackContext(context) {
545
- if (context.source.platform !== "slack" || context.destination.platform !== "slack" || context.actor?.platform !== "slack" || context.actor.teamId !== context.source.teamId) {
545
+ if (context.source.kind !== "slack" || context.destination.platform !== "slack" || context.actor?.platform !== "slack" || context.actor.teamId !== context.source.teamId) {
546
546
  throw new ToolInputError(
547
547
  "Event tasks require an active Slack channel or DM and actor."
548
548
  );
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FUNCTION_TIMEOUT_BUFFER_SECONDS,
3
3
  getChatConfig
4
- } from "./chunk-BYBSI5TI.js";
4
+ } from "./chunk-2JAWOTUT.js";
5
5
 
6
6
  // src/chat/runtime/request-deadline.ts
7
7
  import { AsyncLocalStorage } from "async_hooks";
@@ -5,7 +5,7 @@ import {
5
5
  getConversationEventStore,
6
6
  getDb,
7
7
  getSqlExecutor
8
- } from "./chunk-CUYFCI4G.js";
8
+ } from "./chunk-S7NSFCCW.js";
9
9
  import {
10
10
  juniorCodeChanges,
11
11
  juniorCodeRepositories,
@@ -16,7 +16,7 @@ import {
16
16
  juniorUsers,
17
17
  juniorWorkspaceRepos,
18
18
  juniorWorkspaces
19
- } from "./chunk-5VWAY27R.js";
19
+ } from "./chunk-SEIZ2XLD.js";
20
20
  import {
21
21
  SANDBOX_WORKSPACE_ROOT,
22
22
  getVercelSandboxCredentials,
@@ -24,16 +24,16 @@ import {
24
24
  isSandboxMissingError,
25
25
  runNonInteractiveCommand,
26
26
  sleep
27
- } from "./chunk-WDHPN2GH.js";
27
+ } from "./chunk-7PYCRKQL.js";
28
28
  import {
29
29
  getStateAdapter
30
- } from "./chunk-5CXCGDIL.js";
30
+ } from "./chunk-YNRLCUCB.js";
31
31
  import {
32
32
  botConfig,
33
33
  completeObject,
34
34
  embedTexts,
35
35
  getSlackBotToken
36
- } from "./chunk-BYBSI5TI.js";
36
+ } from "./chunk-2JAWOTUT.js";
37
37
  import {
38
38
  defaultModelId
39
39
  } from "./chunk-D4YV5TDV.js";
@@ -52,7 +52,7 @@ import {
52
52
  setSpanAttributes,
53
53
  setSpanStatus,
54
54
  withSpan
55
- } from "./chunk-PY3EIEAF.js";
55
+ } from "./chunk-L4JLLS6C.js";
56
56
 
57
57
  // src/chat/plugins/agent-hooks.ts
58
58
  import {
@@ -898,7 +898,7 @@ var RESOURCE_WATCH_TOOL_SOURCE = {
898
898
 
899
899
  // src/chat/slack/tool-support/context.ts
900
900
  function getSlackToolContext(context) {
901
- if (context.source.platform !== "slack") {
901
+ if (context.source.kind !== "slack") {
902
902
  return void 0;
903
903
  }
904
904
  if (context.destination.platform !== "slack") {
@@ -2304,7 +2304,7 @@ function pluginInvocationContext(context) {
2304
2304
  conversationId: context.conversationId,
2305
2305
  locationId: context.locationId
2306
2306
  };
2307
- switch (context.source.platform) {
2307
+ switch (context.source.kind) {
2308
2308
  case "slack": {
2309
2309
  if (context.destination.platform !== "slack") {
2310
2310
  throw new TypeError("Slack plugin context requires Slack destination");
@@ -2334,6 +2334,13 @@ function pluginInvocationContext(context) {
2334
2334
  destination: context.destination,
2335
2335
  source: context.source
2336
2336
  };
2337
+ case "resource_event":
2338
+ return {
2339
+ ...common,
2340
+ actor: context.actor?.platform === "system" ? context.actor : void 0,
2341
+ destination: context.destination,
2342
+ source: context.source
2343
+ };
2337
2344
  }
2338
2345
  }
2339
2346
  function invocationPluginContext(plugin, context, turnId) {
@@ -2529,7 +2536,7 @@ async function getPluginSystemPromptContributions(source) {
2529
2536
  const pluginContributions = await hook({
2530
2537
  ...systemPromptPluginContext(plugin),
2531
2538
  // Plugin system prompts only distinguish Slack vs non-Slack surfaces.
2532
- platform: source.platform === "slack" ? "slack" : "local"
2539
+ platform: source.kind === "slack" ? "slack" : "local"
2533
2540
  });
2534
2541
  const result = systemPromptMessageArraySchema.safeParse(pluginContributions);
2535
2542
  if (!result.success) {
@@ -2725,7 +2732,7 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
2725
2732
  }
2726
2733
  };
2727
2734
  let pluginContext;
2728
- switch (context.source.platform) {
2735
+ switch (context.source.kind) {
2729
2736
  case "slack":
2730
2737
  if (context.destination.platform !== "slack") {
2731
2738
  throw new TypeError(
@@ -2761,6 +2768,14 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
2761
2768
  source: context.source
2762
2769
  };
2763
2770
  break;
2771
+ case "resource_event":
2772
+ pluginContext = {
2773
+ ...common,
2774
+ actor: context.actor?.platform === "system" ? context.actor : void 0,
2775
+ destination: context.destination,
2776
+ source: context.source
2777
+ };
2778
+ break;
2764
2779
  }
2765
2780
  const pluginTools = hook(pluginContext);
2766
2781
  const namespace = pluginToolNamespace(pluginName);