@sentry/junior 0.140.0 → 0.141.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 (64) hide show
  1. package/dist/{agent-hooks-BFTDRFUO.js → agent-hooks-HIRVKUQJ.js} +10 -10
  2. package/dist/api/conversations/detail.d.ts +1 -0
  3. package/dist/api/conversations/event-list.d.ts +1 -0
  4. package/dist/api/schema/conversation.d.ts +4 -0
  5. package/dist/api.js +19 -19
  6. package/dist/app.js +31 -31
  7. package/dist/{catalog-runtime-RK664S5T.js → catalog-runtime-XVLED5UH.js} +5 -5
  8. package/dist/chat/agent/repository-context.d.ts +1 -0
  9. package/dist/chat/conversations/history.d.ts +2 -0
  10. package/dist/chat/conversations/projection.d.ts +8 -0
  11. package/dist/chat/conversations/store.d.ts +5 -0
  12. package/dist/chat/conversations/structured-events.d.ts +11 -0
  13. package/dist/chat/runtime/thread-state.d.ts +3 -1
  14. package/dist/chat/services/guardian-action-policy.d.ts +1 -1
  15. package/dist/chat/state/turn-session.d.ts +3 -4
  16. package/dist/{chunk-3B7O3GNU.js → chunk-2DOVDDZJ.js} +3 -3
  17. package/dist/{chunk-557HLSNH.js → chunk-3H42HMA2.js} +1 -1
  18. package/dist/{chunk-CPPTBHQN.js → chunk-43OPSFUY.js} +1 -1
  19. package/dist/{chunk-TKTZ4L4Z.js → chunk-44NWPKY3.js} +1 -1
  20. package/dist/{chunk-XX2QNQN4.js → chunk-5LPWHC7Q.js} +5 -5
  21. package/dist/{chunk-WSWM6A3R.js → chunk-5MFCEKR6.js} +19 -3
  22. package/dist/{chunk-D3X2PI3D.js → chunk-6FRAWWGR.js} +2 -2
  23. package/dist/{chunk-J5H65GY2.js → chunk-6U44QGXL.js} +1 -1
  24. package/dist/{chunk-4PIT6O7A.js → chunk-7ULXCNOZ.js} +6 -6
  25. package/dist/{chunk-5YAWB2AX.js → chunk-A2O7SGK5.js} +15 -17
  26. package/dist/{chunk-S3FAOKQU.js → chunk-BBLO66XT.js} +29 -29
  27. package/dist/{chunk-VRDHAITB.js → chunk-DBKS7JR2.js} +3 -3
  28. package/dist/{chunk-5KAZMR5U.js → chunk-DK3GQWJK.js} +6 -6
  29. package/dist/{chunk-A6BI25J3.js → chunk-DKH4WGZU.js} +8 -8
  30. package/dist/{chunk-HEFBGCCU.js → chunk-DVIJ6DP6.js} +2 -2
  31. package/dist/{chunk-N2I7W2VS.js → chunk-EYD523BV.js} +1 -1
  32. package/dist/{chunk-XROWZSOY.js → chunk-FWXSPJRN.js} +1 -1
  33. package/dist/{chunk-OGNL2QY7.js → chunk-FZFJZZR3.js} +4 -4
  34. package/dist/{chunk-DMDOKRPC.js → chunk-H4WNQFBH.js} +5 -5
  35. package/dist/{chunk-CDQ4YIZM.js → chunk-HLXXQI5Q.js} +55 -1
  36. package/dist/{chunk-TGIKZJ3Y.js → chunk-HN4UZTG7.js} +2 -2
  37. package/dist/{chunk-WTGLUX4K.js → chunk-HQAFIN6O.js} +1 -1
  38. package/dist/{chunk-Z2A7BDHT.js → chunk-LIVSCWI5.js} +15 -15
  39. package/dist/{chunk-I3OZR3HG.js → chunk-LMGKSDO4.js} +1 -1
  40. package/dist/{chunk-AA2EPMUF.js → chunk-NFL4FRIU.js} +4 -4
  41. package/dist/{chunk-YB363QGA.js → chunk-OFQBDHVG.js} +1 -1
  42. package/dist/{chunk-MYVCHWDG.js → chunk-OHO46E7F.js} +36 -18
  43. package/dist/{chunk-UXMRN2ZX.js → chunk-PGJUJCOQ.js} +1 -1
  44. package/dist/{chunk-BMFRFSTM.js → chunk-PIQKV7IR.js} +159 -88
  45. package/dist/{chunk-NPL66ZWL.js → chunk-UFEU4UX6.js} +1 -1
  46. package/dist/{chunk-3CUBAGA3.js → chunk-UONUDOJP.js} +7 -7
  47. package/dist/cli/chat.js +31 -31
  48. package/dist/cli/check.js +6 -6
  49. package/dist/cli/plugins.js +13 -13
  50. package/dist/cli/snapshot-create.js +9 -9
  51. package/dist/cli/upgrade.js +7 -7
  52. package/dist/{db-QOGYDDQM.js → db-PSMQZR4P.js} +7 -7
  53. package/dist/instrumentation.js +4 -4
  54. package/dist/nitro.js +2 -2
  55. package/dist/{oauth-callback-server-CT4RMGCP.js → oauth-callback-server-XZUK2AT6.js} +22 -22
  56. package/dist/{runner-PHMLHNLX.js → runner-5EKJCQWP.js} +14 -14
  57. package/dist/{skills-AYRM4QGF.js → skills-2PRM42SE.js} +6 -6
  58. package/dist/spawn-UGTLRTFP.js +38 -0
  59. package/dist/{validation-M5JNGRGL.js → validation-XLXAIRTR.js} +6 -6
  60. package/dist/version.js +1 -1
  61. package/dist/{work-LZWE6HK4.js → work-CNTNEQ2Q.js} +17 -17
  62. package/dist/{worker-KOGPXFYK.js → worker-BGW7CKZ7.js} +10 -10
  63. package/package.json +5 -5
  64. package/dist/spawn-OGRQFUNK.js +0 -38
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-N2I7W2VS.js";
3
+ } from "./chunk-EYD523BV.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  ToolInputError
3
- } from "./chunk-CDQ4YIZM.js";
3
+ } from "./chunk-HLXXQI5Q.js";
4
4
  import {
5
5
  canRouteResourceEvents,
6
6
  getPlugins
7
- } from "./chunk-4PIT6O7A.js";
7
+ } from "./chunk-7ULXCNOZ.js";
8
8
  import {
9
9
  getDb
10
- } from "./chunk-WSWM6A3R.js";
10
+ } from "./chunk-5MFCEKR6.js";
11
11
  import {
12
12
  juniorEventTasks,
13
13
  juniorSchedulerRuns,
14
14
  juniorSchedulerTasks,
15
15
  juniorStats
16
- } from "./chunk-557HLSNH.js";
16
+ } from "./chunk-3H42HMA2.js";
17
17
  import {
18
18
  juniorDestinations
19
19
  } from "./chunk-VFUK3X5B.js";
20
20
  import {
21
21
  logInfo
22
- } from "./chunk-NPL66ZWL.js";
22
+ } from "./chunk-UFEU4UX6.js";
23
23
 
24
24
  // src/chat/event-tasks/store.ts
25
25
  import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
@@ -5,12 +5,12 @@ import {
5
5
  juniorConversations,
6
6
  juniorIdentities,
7
7
  juniorUsers
8
- } from "./chunk-557HLSNH.js";
8
+ } from "./chunk-3H42HMA2.js";
9
9
  import {
10
10
  TURN_REASONING_LEVELS,
11
11
  getChatConfig,
12
12
  modelProfileSchema
13
- } from "./chunk-S3FAOKQU.js";
13
+ } from "./chunk-BBLO66XT.js";
14
14
  import {
15
15
  juniorDestinations
16
16
  } from "./chunk-VFUK3X5B.js";
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-F3B2YJ76.js";
21
21
  import {
22
22
  normalizeIdentityEmail
23
- } from "./chunk-NPL66ZWL.js";
23
+ } from "./chunk-UFEU4UX6.js";
24
24
 
25
25
  // src/chat/conversations/sql/store.ts
26
26
  import { randomUUID as randomUUID2 } from "crypto";
@@ -452,6 +452,11 @@ function conversationFromRow(readRow) {
452
452
  lastActivityAtMs: requiredMsFromDate(row.lastActivityAt),
453
453
  updatedAtMs: requiredMsFromDate(row.updatedAt),
454
454
  execution,
455
+ executionMetrics: {
456
+ durationMs: row.executionDurationMs,
457
+ ...row.metricRunId ? { runId: row.metricRunId } : {},
458
+ ...row.executionUsage ? { usage: row.executionUsage } : {}
459
+ },
455
460
  ...row.parentConversationId ? {
456
461
  lineage: {
457
462
  parentConversationId: row.parentConversationId
@@ -1479,6 +1484,17 @@ var SqlConversationEventStore = class {
1479
1484
  ).orderBy(asc2(juniorConversationEvents.seq));
1480
1485
  return rows.map(eventFromRow);
1481
1486
  }
1487
+ async loadLatestStructuredEvent(conversationId, namespace, name) {
1488
+ const [row] = await this.executor.db().select().from(juniorConversationEvents).where(
1489
+ and4(
1490
+ eq4(juniorConversationEvents.conversationId, conversationId),
1491
+ eq4(juniorConversationEvents.type, "structured_event"),
1492
+ sql4`${juniorConversationEvents.payload}->>'namespace' = ${namespace}`,
1493
+ sql4`${juniorConversationEvents.payload}->>'name' = ${name}`
1494
+ )
1495
+ ).orderBy(desc2(juniorConversationEvents.seq)).limit(1);
1496
+ return row ? eventFromRow(row) : void 0;
1497
+ }
1482
1498
  async loadLatestInstruction(conversationId) {
1483
1499
  const [row] = await this.executor.db().select().from(juniorConversationEvents).where(
1484
1500
  and4(
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-N2I7W2VS.js";
3
+ } from "./chunk-EYD523BV.js";
4
4
  import {
5
5
  logWarn
6
- } from "./chunk-NPL66ZWL.js";
6
+ } from "./chunk-UFEU4UX6.js";
7
7
  import {
8
8
  skillRoots
9
9
  } from "./chunk-H4HBKISO.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getChatConfig
3
- } from "./chunk-S3FAOKQU.js";
3
+ } from "./chunk-BBLO66XT.js";
4
4
 
5
5
  // src/chat/state/adapter.ts
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
@@ -4,30 +4,30 @@ import {
4
4
  isConversationScopedChannel,
5
5
  isDmChannel,
6
6
  normalizeSlackConversationId
7
- } from "./chunk-HEFBGCCU.js";
7
+ } from "./chunk-DVIJ6DP6.js";
8
8
  import {
9
9
  getConversationEventStore,
10
10
  getDb
11
- } from "./chunk-WSWM6A3R.js";
11
+ } from "./chunk-5MFCEKR6.js";
12
12
  import {
13
13
  juniorConversationAnnotations,
14
14
  juniorConversationEvents,
15
15
  juniorIdentities,
16
16
  juniorUsers
17
- } from "./chunk-557HLSNH.js";
17
+ } from "./chunk-3H42HMA2.js";
18
18
  import {
19
19
  SANDBOX_WORKSPACE_ROOT
20
20
  } from "./chunk-EM225ITJ.js";
21
21
  import {
22
22
  getStateAdapter
23
- } from "./chunk-J5H65GY2.js";
23
+ } from "./chunk-6U44QGXL.js";
24
24
  import {
25
25
  botConfig,
26
26
  completeObject,
27
27
  embedTexts,
28
28
  getSlackBotToken,
29
29
  standardModelId
30
- } from "./chunk-S3FAOKQU.js";
30
+ } from "./chunk-BBLO66XT.js";
31
31
  import {
32
32
  isActorUserId,
33
33
  parseActorUserId
@@ -42,7 +42,7 @@ import {
42
42
  logInfo,
43
43
  logWarn,
44
44
  normalizeIdentityEmail
45
- } from "./chunk-NPL66ZWL.js";
45
+ } from "./chunk-UFEU4UX6.js";
46
46
 
47
47
  // src/chat/plugins/agent-hooks.ts
48
48
  import {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  appendAndEnqueueInboundMessage
3
- } from "./chunk-AA2EPMUF.js";
3
+ } from "./chunk-NFL4FRIU.js";
4
4
  import {
5
5
  ConversationTurnLifecycleService
6
6
  } from "./chunk-Q6QZTTLS.js";
@@ -12,7 +12,7 @@ import {
12
12
  agentBindingSchema,
13
13
  agentInvocationSchema,
14
14
  createAgentInvocationSchema
15
- } from "./chunk-DMDOKRPC.js";
15
+ } from "./chunk-H4WNQFBH.js";
16
16
  import {
17
17
  TurnInputCommitLostError,
18
18
  coerceThreadArtifactsState,
@@ -28,16 +28,20 @@ import {
28
28
  persistCompletedSessionRecord,
29
29
  persistThreadStateById,
30
30
  persistYieldSessionRecord
31
- } from "./chunk-BMFRFSTM.js";
31
+ } from "./chunk-PIQKV7IR.js";
32
32
  import {
33
33
  getConversationEventStore,
34
34
  getConversationStore,
35
35
  getSqlExecutor
36
- } from "./chunk-WSWM6A3R.js";
36
+ } from "./chunk-5MFCEKR6.js";
37
37
  import {
38
38
  juniorAgentBindings,
39
39
  juniorAgentInvocations
40
- } from "./chunk-557HLSNH.js";
40
+ } from "./chunk-3H42HMA2.js";
41
+ import {
42
+ botConfig,
43
+ modelIdForProfile
44
+ } from "./chunk-BBLO66XT.js";
41
45
 
42
46
  // src/chat/agent-invocations/work.ts
43
47
  import { z } from "zod";
@@ -427,24 +431,18 @@ async function recoverRunningSession(invocation) {
427
431
  if (!session || session.state !== "running") {
428
432
  return;
429
433
  }
430
- if (!session.modelId) {
431
- await failAgentTurnSessionRecord({
432
- conversationId: invocation.childConversationId,
433
- expectedVersion: session.version,
434
- sessionId: session.sessionId,
435
- errorMessage: `Running agent invocation session is missing its model for ${invocation.invocationId}`
436
- });
437
- return;
438
- }
434
+ const projection = await openConversationProjection({
435
+ conversationId: invocation.childConversationId
436
+ });
439
437
  const parked = await persistYieldSessionRecord({
440
438
  conversationId: invocation.childConversationId,
441
439
  currentSliceId: session.sliceId,
442
440
  errorMessage: "Recovered running agent invocation after worker loss",
443
441
  messages: session.piMessages,
444
- modelId: session.modelId,
445
- // Execution actor lives on the parent invocation record, not Redis.
442
+ modelId: modelIdForProfile(botConfig, projection.modelProfile),
443
+ // Execution actor and reasoning live on the parent invocation, not Redis.
446
444
  actor: invocation.actor,
447
- reasoningLevel: session.reasoningLevel,
445
+ reasoningLevel: invocation.reasoningLevel,
448
446
  sessionId: session.sessionId,
449
447
  surface: session.surface
450
448
  });
@@ -3,7 +3,7 @@ import {
3
3
  toCanonicalInputMessage,
4
4
  toCanonicalOutputMessage,
5
5
  toGenAiMessagesTraceAttributes
6
- } from "./chunk-UXMRN2ZX.js";
6
+ } from "./chunk-PGJUJCOQ.js";
7
7
  import {
8
8
  extractGenAiUsageAttributes,
9
9
  logException,
@@ -11,7 +11,7 @@ import {
11
11
  normalizeGenAiFinishReason,
12
12
  serializeGenAiAttribute,
13
13
  withSpan
14
- } from "./chunk-NPL66ZWL.js";
14
+ } from "./chunk-UFEU4UX6.js";
15
15
 
16
16
  // src/chat/services/provider-error.ts
17
17
  var ProviderError = class extends Error {
@@ -195,6 +195,31 @@ function getProviderErrorAttributes(error) {
195
195
  };
196
196
  }
197
197
 
198
+ // src/chat/model-profile.ts
199
+ import { z } from "zod";
200
+ var STANDARD_MODEL_PROFILE = "standard";
201
+ var DEFAULT_HANDOFF_MODEL_PROFILE = "handoff";
202
+ var modelProfileSchema = z.string().regex(/^[a-z][a-z0-9_-]*$/);
203
+ var ModelProfileNotConfiguredError = class extends Error {
204
+ constructor(profile) {
205
+ super(`Model profile "${profile}" is not configured`);
206
+ this.name = "ModelProfileNotConfiguredError";
207
+ }
208
+ };
209
+ function modelIdForProfile(config, profile) {
210
+ return profileConfig(config, profile).modelId;
211
+ }
212
+ function standardModelId(config) {
213
+ return modelIdForProfile(config, STANDARD_MODEL_PROFILE);
214
+ }
215
+ function profileConfig(config, profile) {
216
+ const profileConfig2 = Object.hasOwn(config.profiles, profile) ? config.profiles[profile] : void 0;
217
+ if (!profileConfig2) {
218
+ throw new ModelProfileNotConfiguredError(profile);
219
+ }
220
+ return profileConfig2;
221
+ }
222
+
198
223
  // src/chat/config.ts
199
224
  import { getModel as getModel2 } from "@earendil-works/pi-ai/compat";
200
225
 
@@ -652,7 +677,7 @@ function normalizeSlackEmojiName(value) {
652
677
  }
653
678
 
654
679
  // src/chat/reasoning-level.ts
655
- import { z } from "zod";
680
+ import { z as z2 } from "zod";
656
681
  var TURN_REASONING_LEVELS = [
657
682
  "none",
658
683
  "low",
@@ -661,32 +686,7 @@ var TURN_REASONING_LEVELS = [
661
686
  "xhigh"
662
687
  ];
663
688
  function parseTurnReasoningLevel(value) {
664
- return z.enum(TURN_REASONING_LEVELS).parse(value);
665
- }
666
-
667
- // src/chat/model-profile.ts
668
- import { z as z2 } from "zod";
669
- var STANDARD_MODEL_PROFILE = "standard";
670
- var DEFAULT_HANDOFF_MODEL_PROFILE = "handoff";
671
- var modelProfileSchema = z2.string().regex(/^[a-z][a-z0-9_-]*$/);
672
- var ModelProfileNotConfiguredError = class extends Error {
673
- constructor(profile) {
674
- super(`Model profile "${profile}" is not configured`);
675
- this.name = "ModelProfileNotConfiguredError";
676
- }
677
- };
678
- function modelIdForProfile(config, profile) {
679
- return profileConfig(config, profile).modelId;
680
- }
681
- function standardModelId(config) {
682
- return modelIdForProfile(config, STANDARD_MODEL_PROFILE);
683
- }
684
- function profileConfig(config, profile) {
685
- const profileConfig2 = Object.hasOwn(config.profiles, profile) ? config.profiles[profile] : void 0;
686
- if (!profileConfig2) {
687
- throw new ModelProfileNotConfiguredError(profile);
688
- }
689
- return profileConfig2;
689
+ return z2.enum(TURN_REASONING_LEVELS).parse(value);
690
690
  }
691
691
 
692
692
  // src/chat/config.ts
@@ -18,20 +18,20 @@ import {
18
18
  releaseConversationWork,
19
19
  requestConversationContinuation,
20
20
  startConversationWork
21
- } from "./chunk-AA2EPMUF.js";
21
+ } from "./chunk-NFL4FRIU.js";
22
22
  import {
23
23
  ConversationQueueMessageRejectedError
24
24
  } from "./chunk-IUFM5JWV.js";
25
25
  import {
26
26
  getChatConfig,
27
27
  isProviderRetryError
28
- } from "./chunk-S3FAOKQU.js";
28
+ } from "./chunk-BBLO66XT.js";
29
29
  import {
30
30
  logException,
31
31
  logInfo,
32
32
  logWarn,
33
33
  withLogContext
34
- } from "./chunk-NPL66ZWL.js";
34
+ } from "./chunk-UFEU4UX6.js";
35
35
 
36
36
  // src/chat/task-execution/worker.ts
37
37
  var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
@@ -4,19 +4,19 @@ import {
4
4
  isDmChannel,
5
5
  normalizeSlackConversationId,
6
6
  withSlackRetries
7
- } from "./chunk-HEFBGCCU.js";
7
+ } from "./chunk-DVIJ6DP6.js";
8
8
  import {
9
9
  parseDestination
10
- } from "./chunk-WSWM6A3R.js";
10
+ } from "./chunk-5MFCEKR6.js";
11
11
  import {
12
12
  getStateAdapter
13
- } from "./chunk-J5H65GY2.js";
13
+ } from "./chunk-6U44QGXL.js";
14
14
  import {
15
15
  normalizeSlackEmojiName
16
- } from "./chunk-S3FAOKQU.js";
16
+ } from "./chunk-BBLO66XT.js";
17
17
  import {
18
18
  pluginCatalogRuntime
19
- } from "./chunk-N2I7W2VS.js";
19
+ } from "./chunk-EYD523BV.js";
20
20
  import {
21
21
  parseSlackMessageTs,
22
22
  parseSlackUserId
@@ -25,7 +25,7 @@ import {
25
25
  isRecord,
26
26
  logInfo,
27
27
  logWarn
28
- } from "./chunk-NPL66ZWL.js";
28
+ } from "./chunk-UFEU4UX6.js";
29
29
 
30
30
  // src/chat/slack/outbound.ts
31
31
  var MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recordTaskExecution
3
- } from "./chunk-3B7O3GNU.js";
3
+ } from "./chunk-2DOVDDZJ.js";
4
4
  import {
5
5
  pluginTaskId,
6
6
  pluginTaskParamsSchema,
@@ -25,7 +25,7 @@ import {
25
25
  persistThreadStateById,
26
26
  stripRuntimeTurnContext,
27
27
  updateConversationStats
28
- } from "./chunk-BMFRFSTM.js";
28
+ } from "./chunk-PIQKV7IR.js";
29
29
  import {
30
30
  JUNIOR_THREAD_STATE_TTL_MS
31
31
  } from "./chunk-3Y47VMHV.js";
@@ -36,21 +36,21 @@ import {
36
36
  createPluginModel,
37
37
  createPluginState,
38
38
  getPlugins
39
- } from "./chunk-4PIT6O7A.js";
39
+ } from "./chunk-7ULXCNOZ.js";
40
40
  import {
41
41
  getConversationStore,
42
42
  getDb,
43
43
  sameActorIdentity
44
- } from "./chunk-WSWM6A3R.js";
44
+ } from "./chunk-5MFCEKR6.js";
45
45
  import {
46
46
  getStateAdapter
47
- } from "./chunk-J5H65GY2.js";
47
+ } from "./chunk-6U44QGXL.js";
48
48
  import {
49
49
  ProviderError,
50
50
  findProviderError,
51
51
  getProviderErrorAttributes,
52
52
  getProviderErrorUserMessage
53
- } from "./chunk-S3FAOKQU.js";
53
+ } from "./chunk-BBLO66XT.js";
54
54
  import {
55
55
  credentialSubjectSchema
56
56
  } from "./chunk-RUIXF3YQ.js";
@@ -59,7 +59,7 @@ import {
59
59
  } from "./chunk-F3B2YJ76.js";
60
60
  import {
61
61
  buildTurnFailureResponse
62
- } from "./chunk-NPL66ZWL.js";
62
+ } from "./chunk-UFEU4UX6.js";
63
63
 
64
64
  // src/chat/runtime/delivered-turn-state.ts
65
65
  function buildDeliveredTurnStatePatch(args) {
@@ -95,7 +95,7 @@ import {
95
95
 
96
96
  // src/chat/services/turn-session-routing.ts
97
97
  async function resolveTurnSessionRouting(args) {
98
- const conversationStore = args.conversationStore ?? (await import("./db-QOGYDDQM.js")).getConversationStore();
98
+ const conversationStore = args.conversationStore ?? (await import("./db-PSMQZR4P.js")).getConversationStore();
99
99
  const conversation = await conversationStore.get({
100
100
  conversationId: args.conversationId
101
101
  });
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-EM225ITJ.js";
4
4
  import {
5
5
  getSlackBotToken
6
- } from "./chunk-S3FAOKQU.js";
6
+ } from "./chunk-BBLO66XT.js";
7
7
  import {
8
8
  parseSlackChannelReferenceId
9
9
  } from "./chunk-F3B2YJ76.js";
@@ -12,7 +12,7 @@ import {
12
12
  setSpanAttributes,
13
13
  setSpanStatus,
14
14
  withSpan
15
- } from "./chunk-NPL66ZWL.js";
15
+ } from "./chunk-UFEU4UX6.js";
16
16
 
17
17
  // src/chat/slack/client.ts
18
18
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPluginCatalogRuntime
3
- } from "./chunk-I3OZR3HG.js";
3
+ } from "./chunk-LMGKSDO4.js";
4
4
 
5
5
  // src/chat/plugins/catalog-runtime.ts
6
6
  var pluginCatalogRuntime = createPluginCatalogRuntime();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createAndEnqueueAgentInvocation
3
- } from "./chunk-5YAWB2AX.js";
3
+ } from "./chunk-A2O7SGK5.js";
4
4
  import {
5
5
  actorFromRouting,
6
6
  toolInvocationDestination
@@ -4,18 +4,18 @@ import {
4
4
  } from "./chunk-EM225ITJ.js";
5
5
  import {
6
6
  getStateAdapter
7
- } from "./chunk-J5H65GY2.js";
7
+ } from "./chunk-6U44QGXL.js";
8
8
  import {
9
9
  toOptionalTrimmed
10
- } from "./chunk-S3FAOKQU.js";
10
+ } from "./chunk-BBLO66XT.js";
11
11
  import {
12
12
  pluginCatalogRuntime
13
- } from "./chunk-N2I7W2VS.js";
13
+ } from "./chunk-EYD523BV.js";
14
14
  import {
15
15
  setSpanAttributes,
16
16
  setSpanStatus,
17
17
  withSpan
18
- } from "./chunk-NPL66ZWL.js";
18
+ } from "./chunk-UFEU4UX6.js";
19
19
 
20
20
  // src/chat/sandbox/resources.ts
21
21
  var configuredResources;
@@ -4,24 +4,24 @@ import {
4
4
  import {
5
5
  formatProviderLabel,
6
6
  startOAuthFlow
7
- } from "./chunk-5KAZMR5U.js";
7
+ } from "./chunk-DK3GQWJK.js";
8
8
  import {
9
9
  abandonReplacedPendingAuth,
10
10
  canReusePendingAuthLink,
11
11
  recordAuthorizationRequested
12
- } from "./chunk-BMFRFSTM.js";
12
+ } from "./chunk-PIQKV7IR.js";
13
13
  import {
14
14
  parseSandboxEgressAuthRequiredSignal
15
15
  } from "./chunk-HUO3UTAQ.js";
16
16
  import {
17
17
  AGENT_INVOCATION_MAILBOX_STATUSES
18
- } from "./chunk-557HLSNH.js";
18
+ } from "./chunk-3H42HMA2.js";
19
19
  import {
20
20
  TURN_REASONING_LEVELS
21
- } from "./chunk-S3FAOKQU.js";
21
+ } from "./chunk-BBLO66XT.js";
22
22
  import {
23
23
  pluginCatalogRuntime
24
- } from "./chunk-N2I7W2VS.js";
24
+ } from "./chunk-EYD523BV.js";
25
25
  import {
26
26
  credentialContextSchema
27
27
  } from "./chunk-RUIXF3YQ.js";
@@ -16,9 +16,41 @@ var authenticationEventContentSchema = z.object({
16
16
  provider: z.string().regex(/^[a-z][a-z0-9-]*$/),
17
17
  providerLabel: z.string().trim().min(1).max(80).optional()
18
18
  }).strict();
19
+ var agentsInstructionsUpdatedContentSchema = z.object({
20
+ action: z.enum(["loaded", "replaced", "cleared"]),
21
+ directory: z.string().trim().min(1).max(500).optional(),
22
+ fingerprint: z.string().trim().min(1).max(128),
23
+ sources: z.array(
24
+ z.object({
25
+ content: z.string().min(1).max(32 * 1024),
26
+ path: z.string().trim().min(1).max(500)
27
+ }).strict()
28
+ ).max(32),
29
+ textBytes: z.number().int().nonnegative().optional()
30
+ }).strict();
19
31
  function providerTitle(content) {
20
32
  return content.providerLabel?.trim() || content.provider;
21
33
  }
34
+ function agentsInstructionsTitle(action) {
35
+ if (action === "loaded") return "Loaded AGENTS.md";
36
+ if (action === "replaced") return "Updated AGENTS.md";
37
+ return "Cleared AGENTS.md";
38
+ }
39
+ function sourceFilename(sourcePath) {
40
+ return sourcePath.split("/").at(-1) || sourcePath;
41
+ }
42
+ function formatBytes(bytes) {
43
+ if (bytes < 1024) return `${bytes} bytes`;
44
+ const kilobytes = bytes / 1024;
45
+ return `${Number.isInteger(kilobytes) ? kilobytes : kilobytes.toFixed(1)} KB`;
46
+ }
47
+ function agentsInstructionsPreview(content) {
48
+ const source = content.sources[0];
49
+ if (!source) return void 0;
50
+ const filename = sourceFilename(source.path);
51
+ const label = content.sources.length === 1 ? filename : `${content.sources.length} AGENTS.md files`;
52
+ return typeof content.textBytes === "number" ? `${label} \xB7 ${formatBytes(content.textBytes)}` : label;
53
+ }
22
54
  var authenticationLinkedEvent = defineConversationEvent({
23
55
  name: "authentication_linked",
24
56
  version: 1,
@@ -57,9 +89,30 @@ var authenticationUnlinkedEvent = defineConversationEvent({
57
89
  };
58
90
  }
59
91
  });
92
+ var agentsInstructionsUpdatedEvent = defineConversationEvent({
93
+ name: "agents_instructions_updated",
94
+ version: 1,
95
+ schema: agentsInstructionsUpdatedContentSchema,
96
+ renderEvent(event) {
97
+ const title = agentsInstructionsTitle(event.action);
98
+ const preview = agentsInstructionsPreview(event);
99
+ return {
100
+ icon: "brain",
101
+ title,
102
+ ...preview ? { preview } : {},
103
+ ...event.sources.length > 0 ? {
104
+ details: event.sources.map((source) => ({
105
+ title: sourceFilename(source.path),
106
+ content: source.content
107
+ }))
108
+ } : {}
109
+ };
110
+ }
111
+ });
60
112
  var NATIVE_EVENT_DEFINITIONS = [
61
113
  authenticationLinkedEvent,
62
- authenticationUnlinkedEvent
114
+ authenticationUnlinkedEvent,
115
+ agentsInstructionsUpdatedEvent
63
116
  ];
64
117
  function getJuniorNativeEventDefinition(args) {
65
118
  return NATIVE_EVENT_DEFINITIONS.find(
@@ -176,6 +229,7 @@ export {
176
229
  JUNIOR_NATIVE_EVENT_NAMESPACE,
177
230
  authenticationLinkedEvent,
178
231
  authenticationUnlinkedEvent,
232
+ agentsInstructionsUpdatedEvent,
179
233
  renderJuniorNativeConversationEvent,
180
234
  ToolInputError,
181
235
  agentTurnUsageSchema,
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-UTL3MHPC.js";
4
4
  import {
5
5
  parseSlackThreadId
6
- } from "./chunk-WTGLUX4K.js";
6
+ } from "./chunk-HQAFIN6O.js";
7
7
  import {
8
8
  normalizeSlackConversationId
9
- } from "./chunk-HEFBGCCU.js";
9
+ } from "./chunk-DVIJ6DP6.js";
10
10
 
11
11
  // src/handlers/health.ts
12
12
  function readHealthReport() {
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-F3B2YJ76.js";
6
6
  import {
7
7
  toOptionalString
8
- } from "./chunk-NPL66ZWL.js";
8
+ } from "./chunk-UFEU4UX6.js";
9
9
 
10
10
  // src/chat/slack/context.ts
11
11
  import { z } from "zod";