@sentry/junior 0.285.0 → 0.286.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 (73) hide show
  1. package/dist/{adapter-DN5AB4VU.js → adapter-JQZaJ-B_.js} +1 -1
  2. package/dist/{admin-DOITMKnn.js → admin-Dm2bimJ-.js} +1 -1
  3. package/dist/{agent-runner-BsWhHe4N.js → agent-runner-DGCwOEyL.js} +1567 -1048
  4. package/dist/api/schema.d.ts +1 -1
  5. package/dist/api/schema.js +5 -5
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +70 -92
  8. package/dist/{app-DyMs9330.d.ts → app-BKq0JzWx.d.ts} +2 -3
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +37 -40
  11. package/dist/{assistant-reply-9Jip5bsr.js → assistant-reply-CAPafcUY.js} +1 -1
  12. package/dist/{automation-Mk8aaHzy.js → automation-B-jJN_gM.js} +1 -1
  13. package/dist/{background-compaction-queue-DXkLsWoH.js → background-compaction-queue-Btu2oab_.js} +137 -3
  14. package/dist/{briefs-Cl8-nK9B.js → briefs-UMeYehUe.js} +4 -4
  15. package/dist/{catalog-runtime-Bte6jRB2.js → catalog-runtime-Bym8GVdh.js} +1 -1
  16. package/dist/cli/chat.js +14 -14
  17. package/dist/cli/check.js +3 -3
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +5 -6
  21. package/dist/cli/upgrade.d.ts +1 -1
  22. package/dist/cli/upgrade.js +3 -3
  23. package/dist/{client-DDbBucBw.js → client-B0aAs7wC.js} +2 -2
  24. package/dist/{config-DqFnykQT.js → config-B9f9Lqo5.js} +1 -1
  25. package/dist/{connections-DA4LT9LL.js → connections-CQ7p0aNJ.js} +16 -50
  26. package/dist/{conversation-D8kVoCrP.js → conversation-BusI2uzj.js} +15 -6
  27. package/dist/{conversation-pending-messages-BvROq1bq.js → conversation-pending-messages-DwehU0Fd.js} +1 -1
  28. package/dist/{conversation-privacy-D0j_h70R.js → conversation-privacy-Cd_nZZBM.js} +1 -1
  29. package/dist/{credential-sync-hcsYatw-.js → credential-sync-DmiJi_At.js} +13 -13
  30. package/dist/{db-BhHZSuFw.d.ts → db-C5zi4ecs.d.ts} +4 -4
  31. package/dist/{executor-BLEMIgIZ.js → executor-Dipi2Ixl.js} +11 -17
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{logging-BfORLKoq.js → logging-CMFhLLj4.js} +1 -1
  34. package/dist/{media-Bu9C6lz0.js → media-B-BpXo41.js} +14 -2
  35. package/dist/{message-DqjuKzUx.js → message-D1xLljUF.js} +9 -9
  36. package/dist/nitro.d.ts +1 -1
  37. package/dist/nitro.js +2 -3
  38. package/dist/{oauth-callback-server-CFSRzu1n.js → oauth-callback-server-DCAFIUQr.js} +2 -2
  39. package/dist/{projection-DliWYrnT.js → projection-CoeMNxJ4.js} +286 -212
  40. package/dist/{prompt-BvIUzY4y.js → prompt-C9OQEfan.js} +1 -1
  41. package/dist/{registry-rC7MCxu8.js → registry-u-sFYtx_.js} +1 -1
  42. package/dist/{resolve-Biu8Qw3u.js → resolve-DYqgL3Eo.js} +3 -3
  43. package/dist/{result-DxJMCX47.js → result-CescSwAw.js} +8 -8
  44. package/dist/{runner-BQJSFLKg.js → runner-Cr67a8TB.js} +16 -12
  45. package/dist/{sandbox-egress-signals-6aMxJSDn.js → sandbox-egress-signals-DLOazy5W.js} +1 -1
  46. package/dist/{schema-BasXTvi2.js → schema-BUSi3sgv.js} +5 -5
  47. package/dist/{schema-BUviRAs8.d.ts → schema-Ih60j59-.d.ts} +44 -7
  48. package/dist/{service-account-BI5Wgx22.js → service-account-CGEqz9wG.js} +3 -3
  49. package/dist/{service-account-CAE-_1dR.js → service-account-CsKxktLk.js} +3 -3
  50. package/dist/{session-stop-CA-jOJ84.js → session-stop-CGz5DByb.js} +22 -20
  51. package/dist/{skills-B22duVJU.js → skills-COCqf61f.js} +2 -2
  52. package/dist/{spawn-BB2_4VYn.js → spawn-C8F_iXWO.js} +13 -2
  53. package/dist/{stop-DioIcEAu.js → stop-GyFZkHuQ.js} +242 -952
  54. package/dist/{store-Dn4W7qgH.js → store-D0-8plWp.js} +3 -3
  55. package/dist/{turn-session-routing-CGMKrYOj.js → task-runner-xPuQmEot.js} +1439 -993
  56. package/dist/{store-B26LV6UP.js → turn-failure-response-BOviBdT-.js} +331 -5
  57. package/dist/{validation-TzhfQABF.js → validation-DZDKorGz.js} +1 -1
  58. package/dist/{version-DSk8CFvA.js → version-BTIz7fGi.js} +1 -1
  59. package/dist/version.js +1 -1
  60. package/dist/{viewer-1Ea81s0b.js → viewer-CH-ASQzh.js} +39 -36
  61. package/dist/{work-ybG4_q5C.js → work-C75_IM5e.js} +92 -87
  62. package/dist/{worker-ccSyZRNz.js → worker-Dl47I729.js} +6 -6
  63. package/migrations/0086_shared_archive.sql +31 -0
  64. package/migrations/0087_child_location.sql +64 -0
  65. package/migrations/meta/0086_snapshot.json +4366 -0
  66. package/migrations/meta/0087_snapshot.json +4366 -0
  67. package/migrations/meta/_journal.json +14 -0
  68. package/package.json +5 -4
  69. package/dist/task-queue-Bt0IoR2i.js +0 -139
  70. package/dist/task-runner-D8lddjzp.js +0 -290
  71. package/dist/thread-state-CrFk3K_7.js +0 -173
  72. package/dist/turn-failure-response-DaJ04qVj.js +0 -224
  73. package/dist/turn-lifecycle-C2mXS7AZ.js +0 -58
@@ -1,4 +1,4 @@
1
- import { G as conversationBriefSchema, K as parseBriefInput, U as briefOutcomeStatusSchema } from "./conversation-D8kVoCrP.js";
1
+ import { G as conversationBriefSchema, K as parseBriefInput, U as briefOutcomeStatusSchema } from "./conversation-BusI2uzj.js";
2
2
  import * as z from "zod";
3
3
  // src/chat/briefs/generate.ts
4
4
  const MAX_INPUT_CHARS = 6e4;
@@ -1,4 +1,4 @@
1
- import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-BfORLKoq.js";
1
+ import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-CMFhLLj4.js";
2
2
  import { o as isUserActor, s as parseActorUserId } from "./actor-6jsm_v96.js";
3
3
  import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-DJhGdS4c.js";
4
4
  import path from "node:path";
@@ -1,6 +1,6 @@
1
- import { Di as isStale, La as SANDBOX_COMMAND_PATH, Ti as create, Va as SANDBOX_WORKSPACE_ROOT, ja as sleep, ki as getSandboxProvider, qa as runNonInteractiveCommand } from "./projection-DliWYrnT.js";
2
- import { E as withSpan, b as setSpanAttributes } from "./logging-BfORLKoq.js";
3
- import { r as getStateAdapter } from "./adapter-DN5AB4VU.js";
1
+ import { Di as create, Na as sleep, Ua as SANDBOX_WORKSPACE_ROOT, Ya as runNonInteractiveCommand, ji as getSandboxProvider, ki as isStale, za as SANDBOX_COMMAND_PATH } from "./projection-CoeMNxJ4.js";
2
+ import { E as withSpan, b as setSpanAttributes } from "./logging-CMFhLLj4.js";
3
+ import { r as getStateAdapter } from "./adapter-JQZaJ-B_.js";
4
4
  import * as z from "zod";
5
5
  // src/chat/sandbox/resources.ts
6
6
  let configuredResources;
@@ -1,12 +1,12 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { _n as renderUntrustedTag } from "./projection-DliWYrnT.js";
3
- import { H as SYSTEM_IDENTITY_ID } from "./viewer-1Ea81s0b.js";
4
- import { f as credentialContextForActor } from "./registry-rC7MCxu8.js";
5
- import { jt as listUnreportedSiblingAgents } from "./agent-runner-BsWhHe4N.js";
6
- import { A as getAgentInvocationIdForEvents, M as getAgentInvocationIdForResult, P as getAgentInvocationResultMessageId, a as getAgentInvocation, h as markAgentInvocationParentMailboxAppended, j as getAgentInvocationIdForMessage, l as isTerminalAgentInvocation, s as getLatestAgentInvocationForConversation } from "./store-B26LV6UP.js";
7
- import { C as isEventMailboxMetadata, T as timerWatchCredentialSubject, b as EVENT_WAIT_MS, d as getEventBatchDelayMs, n as isWatchEvent, p as parseEventMessages, s as eventReviewItemInputs, w as renderEventBatchInputs } from "./session-stop-CA-jOJ84.js";
8
- import { r as appendAndEnqueueInboundMessage } from "./store-Dn4W7qgH.js";
9
- import { a as resolveAgentInvocationId, i as enqueueAgentInvocation, l as createAgentInvocationFromLatest, t as createAgentInvocationWorker } from "./work-ybG4_q5C.js";
2
+ import { yn as renderUntrustedTag } from "./projection-CoeMNxJ4.js";
3
+ import { V as SYSTEM_IDENTITY_ID } from "./viewer-CH-ASQzh.js";
4
+ import { f as credentialContextForActor } from "./registry-u-sFYtx_.js";
5
+ import { Vt as listUnreportedSiblingAgents } from "./agent-runner-DGCwOEyL.js";
6
+ import { C as isTerminalAgentInvocation, G as getAgentInvocationIdForMessage, J as getAgentInvocationResultMessageId, K as getAgentInvocationIdForResult, W as getAgentInvocationIdForEvents, k as markAgentInvocationParentMailboxAppended, x as getLatestAgentInvocationForConversation, y as getAgentInvocation } from "./turn-failure-response-BOviBdT-.js";
7
+ import { D as timerWatchCredentialSubject, E as renderEventBatchInputs, S as EVENT_WAIT_MS, T as isEventMailboxMetadata, f as getEventBatchDelayMs, m as parseEventMessages, n as isWatchEvent, s as eventReviewItemInputs } from "./session-stop-CGz5DByb.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-D0-8plWp.js";
9
+ import { a as enqueueAgentInvocation, l as createAgentInvocationFromLatest, o as resolveAgentInvocationId, t as createAgentInvocationWorker } from "./work-C75_IM5e.js";
10
10
  import { n as isAgentInvocationResultEventType, t as agentInvocationResultEventType } from "./result-event-type-DD6BAgT7.js";
11
11
  // src/chat/agent-invocations/result.ts
12
12
  var result_exports = /* @__PURE__ */ __exportAll({
@@ -1,14 +1,11 @@
1
- import { F as recordDeliveredAssistantMessage, L as upsertConversationMessage, N as markConversationMessage, O as buildConversationContext, P as normalizeConversationText, Q as saveTurnCheckpoint, V as authorizationId, a as loadProjection, d as recordAuthorizationCompleted, qt as persistWithRetry, t as commitAcceptedReply, v as hydrateConversationMessages, y as persistConversationMessages } from "./projection-DliWYrnT.js";
2
- import { S as setTags, T as withLogContext, p as logException } from "./logging-BfORLKoq.js";
3
- import { H as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-1Ea81s0b.js";
4
- import { f as credentialContextForActor } from "./registry-rC7MCxu8.js";
5
- import { N as messageCardText } from "./conversation-D8kVoCrP.js";
6
- import { X as markTurnFailed, Z as startActiveTurn } from "./store-B26LV6UP.js";
7
- import { n as getAssistantReplyText } from "./assistant-reply-9Jip5bsr.js";
8
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-C2mXS7AZ.js";
9
- import { a as persistThreadStateById, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-CrFk3K_7.js";
10
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-D8lddjzp.js";
11
- import { i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-DaJ04qVj.js";
1
+ import { L as upsertConversationMessage, M as markConversationMessage, N as normalizeConversationText, P as recordDeliveredAssistantMessage, V as authorizationId, Yt as persistWithRetry, a as loadProjection, b as persistConversationMessages, d as recordAuthorizationCompleted, et as saveTurnCheckpoint, j as latestConversationMessageSeq, t as commitAcceptedReply, v as hydrateConversationMessages } from "./projection-CoeMNxJ4.js";
2
+ import { S as setTags, T as withLogContext, p as logException } from "./logging-CMFhLLj4.js";
3
+ import { V as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-CH-ASQzh.js";
4
+ import { f as credentialContextForActor } from "./registry-u-sFYtx_.js";
5
+ import { N as messageCardText } from "./conversation-BusI2uzj.js";
6
+ import { dt as startActiveTurn, f as ConversationTurnLifecycleService, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, m as loadPendingMessageCards, t as finalizeFailedTurnReplyWithEvent, u as buildTurnThreadContext, ut as markTurnFailed } from "./turn-failure-response-BOviBdT-.js";
7
+ import { n as getAssistantReplyText } from "./assistant-reply-CAPafcUY.js";
8
+ import { _t as getPersistedThreadState, bt as coerceThreadConversationState, gt as getPersistedSandboxState, n as scheduleSessionCompletedPluginTasks, t as processPluginTask, yt as persistThreadStateById } from "./task-runner-xPuQmEot.js";
12
9
  import { randomUUID } from "node:crypto";
13
10
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
14
11
  // src/chat/local/runner.ts
@@ -115,6 +112,7 @@ async function runLocalAgentTurnInContext(input, deps) {
115
112
  createdAtMs: Date.now(),
116
113
  inputMessageIds: [userMessageId],
117
114
  surface: "internal",
115
+ threadContextThroughSeq: latestConversationMessageSeq(conversation),
118
116
  turnId
119
117
  });
120
118
  startActiveTurn({
@@ -184,7 +182,13 @@ async function runLocalAgentTurnInContext(input, deps) {
184
182
  runId: currentRunId,
185
183
  instruction: {
186
184
  text,
187
- context: buildConversationContext(conversation, { excludeMessageIds: [userMessageId] })
185
+ context: await buildTurnThreadContext({
186
+ conversation,
187
+ conversationId: input.conversationId,
188
+ excludeMessageIds: [userMessageId],
189
+ hasHistory: Boolean(messages?.length),
190
+ turnId
191
+ })
188
192
  },
189
193
  history: messages,
190
194
  actor: localActor,
@@ -1,4 +1,4 @@
1
- import { Ea as sandboxEgressSignalsResponseSchema } from "./projection-DliWYrnT.js";
1
+ import { Oa as sandboxEgressSignalsResponseSchema } from "./projection-CoeMNxJ4.js";
2
2
  // src/chat/local/sandbox-egress-signals.ts
3
3
  const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
4
4
  const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
@@ -1,8 +1,8 @@
1
1
  import { r as notificationScheduleSchema } from "./schedule-BTp__wrw.js";
2
- import { D as conversationChildAgentTotalsSchema, S as conversationUsageSchema, b as conversationSummaryReportSchema, i as actorIdentitySchema, s as conversationAuxiliaryCostsSchema } from "./conversation-D8kVoCrP.js";
2
+ import { D as conversationChildAgentTotalsSchema, S as conversationUsageSchema, b as conversationSummaryReportSchema, i as actorIdentitySchema, s as conversationAuxiliaryCostsSchema } from "./conversation-BusI2uzj.js";
3
3
  import { C as AGENT_INVOCATION_STATUSES, b as userInputRequestSchema, i as fillUtcHours, r as fillUtcDays, s as sumUtcHoursIntoSixHours } from "./reporting-window-B4TwyuJo.js";
4
- import "./automation-Mk8aaHzy.js";
5
- import "./conversation-pending-messages-BvROq1bq.js";
4
+ import "./automation-B-jJN_gM.js";
5
+ import "./conversation-pending-messages-DwehU0Fd.js";
6
6
  import { t as isPushServiceEndpoint } from "./push-endpoint-CO-nomUd.js";
7
7
  import * as z from "zod";
8
8
  import { codeChangeStateSchema, eventMatchSchema } from "@sentry/junior-plugin-api";
@@ -165,6 +165,8 @@ const continueConversationInSlackResponseSchema = z.object({
165
165
  */
166
166
  const conversationChildAgentSchema = z.object({
167
167
  auxiliaryCosts: conversationAuxiliaryCostsSchema.optional(),
168
+ /** When the child was archived for everyone, or null. */
169
+ archivedAt: z.string().datetime().nullable(),
168
170
  childAgentTotals: conversationChildAgentTotalsSchema.optional(),
169
171
  conversationId: z.string().min(1),
170
172
  cumulativeDurationMs: z.number(),
@@ -175,8 +177,6 @@ const conversationChildAgentSchema = z.object({
175
177
  redacted: z.literal(true).optional(),
176
178
  status: z.enum(AGENT_INVOCATION_STATUSES),
177
179
  task: z.string().optional(),
178
- /** When the child was archived for everyone, or null. */
179
- childArchivedAt: z.string().datetime().nullable(),
180
180
  title: z.string().min(1).optional(),
181
181
  updatedAt: z.string().datetime()
182
182
  }).strict().superRefine((data, context) => {
@@ -669,7 +669,6 @@ declare const conversationSummaryReportSchema: z.ZodObject<{
669
669
  thread: "thread";
670
670
  }>;
671
671
  parentConversationId: z.ZodOptional<z.ZodString>;
672
- childArchivedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
673
672
  isParticipant: z.ZodBoolean;
674
673
  visibility: z.ZodOptional<z.ZodEnum<{
675
674
  private: "private";
@@ -863,6 +862,7 @@ declare const conversationReportEventDataSchema: z.ZodDiscriminatedUnion<[z.ZodO
863
862
  actorIdentityId: z.ZodOptional<z.ZodString>;
864
863
  agentInvocationId: z.ZodOptional<z.ZodString>;
865
864
  eventType: z.ZodOptional<z.ZodString>;
865
+ eventNamespace: z.ZodOptional<z.ZodString>;
866
866
  eventObjectType: z.ZodOptional<z.ZodEnum<{
867
867
  automation: "automation";
868
868
  calendar_event: "calendar_event";
@@ -1028,6 +1028,11 @@ declare const conversationReportEventDataSchema: z.ZodDiscriminatedUnion<[z.ZodO
1028
1028
  contentType: z.ZodString;
1029
1029
  bytes: z.ZodNumber;
1030
1030
  }, z.core.$strict>>;
1031
+ }, z.core.$strict>, z.ZodObject<{
1032
+ type: z.ZodLiteral<"reply_posted">;
1033
+ plugin: z.ZodString;
1034
+ text: z.ZodString;
1035
+ url: z.ZodOptional<z.ZodString>;
1031
1036
  }, z.core.$strict>, z.ZodObject<{
1032
1037
  type: z.ZodLiteral<"guardian_action_reviewed">;
1033
1038
  turnId: z.ZodString;
@@ -1108,6 +1113,7 @@ declare const conversationReportEventSchema: z.ZodObject<{
1108
1113
  actorIdentityId: z.ZodOptional<z.ZodString>;
1109
1114
  agentInvocationId: z.ZodOptional<z.ZodString>;
1110
1115
  eventType: z.ZodOptional<z.ZodString>;
1116
+ eventNamespace: z.ZodOptional<z.ZodString>;
1111
1117
  eventObjectType: z.ZodOptional<z.ZodEnum<{
1112
1118
  automation: "automation";
1113
1119
  calendar_event: "calendar_event";
@@ -1273,6 +1279,11 @@ declare const conversationReportEventSchema: z.ZodObject<{
1273
1279
  contentType: z.ZodString;
1274
1280
  bytes: z.ZodNumber;
1275
1281
  }, z.core.$strict>>;
1282
+ }, z.core.$strict>, z.ZodObject<{
1283
+ type: z.ZodLiteral<"reply_posted">;
1284
+ plugin: z.ZodString;
1285
+ text: z.ZodString;
1286
+ url: z.ZodOptional<z.ZodString>;
1276
1287
  }, z.core.$strict>, z.ZodObject<{
1277
1288
  type: z.ZodLiteral<"guardian_action_reviewed">;
1278
1289
  turnId: z.ZodString;
@@ -1433,6 +1444,7 @@ declare const conversationEventPageSchema: z.ZodObject<{
1433
1444
  actorIdentityId: z.ZodOptional<z.ZodString>;
1434
1445
  agentInvocationId: z.ZodOptional<z.ZodString>;
1435
1446
  eventType: z.ZodOptional<z.ZodString>;
1447
+ eventNamespace: z.ZodOptional<z.ZodString>;
1436
1448
  eventObjectType: z.ZodOptional<z.ZodEnum<{
1437
1449
  automation: "automation";
1438
1450
  calendar_event: "calendar_event";
@@ -1598,6 +1610,11 @@ declare const conversationEventPageSchema: z.ZodObject<{
1598
1610
  contentType: z.ZodString;
1599
1611
  bytes: z.ZodNumber;
1600
1612
  }, z.core.$strict>>;
1613
+ }, z.core.$strict>, z.ZodObject<{
1614
+ type: z.ZodLiteral<"reply_posted">;
1615
+ plugin: z.ZodString;
1616
+ text: z.ZodString;
1617
+ url: z.ZodOptional<z.ZodString>;
1601
1618
  }, z.core.$strict>, z.ZodObject<{
1602
1619
  type: z.ZodLiteral<"guardian_action_reviewed">;
1603
1620
  turnId: z.ZodString;
@@ -1777,7 +1794,6 @@ declare const conversationDetailReportSchema: z.ZodObject<{
1777
1794
  thread: "thread";
1778
1795
  }>;
1779
1796
  parentConversationId: z.ZodOptional<z.ZodString>;
1780
- childArchivedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1781
1797
  isParticipant: z.ZodBoolean;
1782
1798
  visibility: z.ZodOptional<z.ZodEnum<{
1783
1799
  private: "private";
@@ -1975,6 +1991,7 @@ declare const conversationDetailReportSchema: z.ZodObject<{
1975
1991
  actorIdentityId: z.ZodOptional<z.ZodString>;
1976
1992
  agentInvocationId: z.ZodOptional<z.ZodString>;
1977
1993
  eventType: z.ZodOptional<z.ZodString>;
1994
+ eventNamespace: z.ZodOptional<z.ZodString>;
1978
1995
  eventObjectType: z.ZodOptional<z.ZodEnum<{
1979
1996
  automation: "automation";
1980
1997
  calendar_event: "calendar_event";
@@ -2140,6 +2157,11 @@ declare const conversationDetailReportSchema: z.ZodObject<{
2140
2157
  contentType: z.ZodString;
2141
2158
  bytes: z.ZodNumber;
2142
2159
  }, z.core.$strict>>;
2160
+ }, z.core.$strict>, z.ZodObject<{
2161
+ type: z.ZodLiteral<"reply_posted">;
2162
+ plugin: z.ZodString;
2163
+ text: z.ZodString;
2164
+ url: z.ZodOptional<z.ZodString>;
2143
2165
  }, z.core.$strict>, z.ZodObject<{
2144
2166
  type: z.ZodLiteral<"guardian_action_reviewed">;
2145
2167
  turnId: z.ZodString;
@@ -2371,6 +2393,7 @@ declare const conversationDetailReportSchema: z.ZodObject<{
2371
2393
  actorIdentityId: z.ZodOptional<z.ZodString>;
2372
2394
  agentInvocationId: z.ZodOptional<z.ZodString>;
2373
2395
  eventType: z.ZodOptional<z.ZodString>;
2396
+ eventNamespace: z.ZodOptional<z.ZodString>;
2374
2397
  eventObjectType: z.ZodOptional<z.ZodEnum<{
2375
2398
  automation: "automation";
2376
2399
  calendar_event: "calendar_event";
@@ -2536,6 +2559,11 @@ declare const conversationDetailReportSchema: z.ZodObject<{
2536
2559
  contentType: z.ZodString;
2537
2560
  bytes: z.ZodNumber;
2538
2561
  }, z.core.$strict>>;
2562
+ }, z.core.$strict>, z.ZodObject<{
2563
+ type: z.ZodLiteral<"reply_posted">;
2564
+ plugin: z.ZodString;
2565
+ text: z.ZodString;
2566
+ url: z.ZodOptional<z.ZodString>;
2539
2567
  }, z.core.$strict>, z.ZodObject<{
2540
2568
  type: z.ZodLiteral<"guardian_action_reviewed">;
2541
2569
  turnId: z.ZodString;
@@ -2868,7 +2896,6 @@ declare const conversationDetailWithMailboxReportSchema: z.ZodObject<{
2868
2896
  thread: "thread";
2869
2897
  }>;
2870
2898
  parentConversationId: z.ZodOptional<z.ZodString>;
2871
- childArchivedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2872
2899
  isParticipant: z.ZodBoolean;
2873
2900
  visibility: z.ZodOptional<z.ZodEnum<{
2874
2901
  private: "private";
@@ -3066,6 +3093,7 @@ declare const conversationDetailWithMailboxReportSchema: z.ZodObject<{
3066
3093
  actorIdentityId: z.ZodOptional<z.ZodString>;
3067
3094
  agentInvocationId: z.ZodOptional<z.ZodString>;
3068
3095
  eventType: z.ZodOptional<z.ZodString>;
3096
+ eventNamespace: z.ZodOptional<z.ZodString>;
3069
3097
  eventObjectType: z.ZodOptional<z.ZodEnum<{
3070
3098
  automation: "automation";
3071
3099
  calendar_event: "calendar_event";
@@ -3231,6 +3259,11 @@ declare const conversationDetailWithMailboxReportSchema: z.ZodObject<{
3231
3259
  contentType: z.ZodString;
3232
3260
  bytes: z.ZodNumber;
3233
3261
  }, z.core.$strict>>;
3262
+ }, z.core.$strict>, z.ZodObject<{
3263
+ type: z.ZodLiteral<"reply_posted">;
3264
+ plugin: z.ZodString;
3265
+ text: z.ZodString;
3266
+ url: z.ZodOptional<z.ZodString>;
3234
3267
  }, z.core.$strict>, z.ZodObject<{
3235
3268
  type: z.ZodLiteral<"guardian_action_reviewed">;
3236
3269
  turnId: z.ZodString;
@@ -3462,6 +3495,7 @@ declare const conversationDetailWithMailboxReportSchema: z.ZodObject<{
3462
3495
  actorIdentityId: z.ZodOptional<z.ZodString>;
3463
3496
  agentInvocationId: z.ZodOptional<z.ZodString>;
3464
3497
  eventType: z.ZodOptional<z.ZodString>;
3498
+ eventNamespace: z.ZodOptional<z.ZodString>;
3465
3499
  eventObjectType: z.ZodOptional<z.ZodEnum<{
3466
3500
  automation: "automation";
3467
3501
  calendar_event: "calendar_event";
@@ -3627,6 +3661,11 @@ declare const conversationDetailWithMailboxReportSchema: z.ZodObject<{
3627
3661
  contentType: z.ZodString;
3628
3662
  bytes: z.ZodNumber;
3629
3663
  }, z.core.$strict>>;
3664
+ }, z.core.$strict>, z.ZodObject<{
3665
+ type: z.ZodLiteral<"reply_posted">;
3666
+ plugin: z.ZodString;
3667
+ text: z.ZodString;
3668
+ url: z.ZodOptional<z.ZodString>;
3630
3669
  }, z.core.$strict>, z.ZodObject<{
3631
3670
  type: z.ZodLiteral<"guardian_action_reviewed">;
3632
3671
  turnId: z.ZodString;
@@ -4205,6 +4244,7 @@ declare const conversationChildAgentSchema: z.ZodObject<{
4205
4244
  namespace: z.ZodString;
4206
4245
  }, z.core.$strict>>;
4207
4246
  }, z.core.$strict>>;
4247
+ archivedAt: z.ZodNullable<z.ZodString>;
4208
4248
  childAgentTotals: z.ZodOptional<z.ZodObject<{
4209
4249
  auxiliaryCostUsd: z.ZodOptional<z.ZodNumber>;
4210
4250
  count: z.ZodNumber;
@@ -4259,7 +4299,6 @@ declare const conversationChildAgentSchema: z.ZodObject<{
4259
4299
  stopped: "stopped";
4260
4300
  }>;
4261
4301
  task: z.ZodOptional<z.ZodString>;
4262
- childArchivedAt: z.ZodNullable<z.ZodString>;
4263
4302
  title: z.ZodOptional<z.ZodString>;
4264
4303
  updatedAt: z.ZodString;
4265
4304
  }, z.core.$strict>;
@@ -4275,6 +4314,7 @@ declare const conversationChildAgentsReportSchema: z.ZodObject<{
4275
4314
  namespace: z.ZodString;
4276
4315
  }, z.core.$strict>>;
4277
4316
  }, z.core.$strict>>;
4317
+ archivedAt: z.ZodNullable<z.ZodString>;
4278
4318
  childAgentTotals: z.ZodOptional<z.ZodObject<{
4279
4319
  auxiliaryCostUsd: z.ZodOptional<z.ZodNumber>;
4280
4320
  count: z.ZodNumber;
@@ -4329,7 +4369,6 @@ declare const conversationChildAgentsReportSchema: z.ZodObject<{
4329
4369
  stopped: "stopped";
4330
4370
  }>;
4331
4371
  task: z.ZodOptional<z.ZodString>;
4332
- childArchivedAt: z.ZodNullable<z.ZodString>;
4333
4372
  title: z.ZodOptional<z.ZodString>;
4334
4373
  updatedAt: z.ZodString;
4335
4374
  }, z.core.$strict>>;
@@ -4658,7 +4697,6 @@ declare const actorProfileReportSchema: z.ZodObject<{
4658
4697
  thread: "thread";
4659
4698
  }>;
4660
4699
  parentConversationId: z.ZodOptional<z.ZodString>;
4661
- childArchivedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4662
4700
  isParticipant: z.ZodBoolean;
4663
4701
  visibility: z.ZodOptional<z.ZodEnum<{
4664
4702
  private: "private";
@@ -5092,7 +5130,6 @@ declare const locationDetailReportSchema: z.ZodObject<{
5092
5130
  thread: "thread";
5093
5131
  }>;
5094
5132
  parentConversationId: z.ZodOptional<z.ZodString>;
5095
- childArchivedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5096
5133
  isParticipant: z.ZodBoolean;
5097
5134
  visibility: z.ZodOptional<z.ZodEnum<{
5098
5135
  private: "private";
@@ -1,7 +1,7 @@
1
- import { W as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-BfORLKoq.js";
2
- import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-rC7MCxu8.js";
1
+ import { W as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-CMFhLLj4.js";
2
+ import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-u-sFYtx_.js";
3
3
  import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS } from "./locks-D-0h111u.js";
4
- import { r as getStateAdapter } from "./adapter-DN5AB4VU.js";
4
+ import { r as getStateAdapter } from "./adapter-JQZaJ-B_.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { randomUUID } from "node:crypto";
7
7
  import { UnauthorizedError, auth } from "@modelcontextprotocol/sdk/client/auth.js";
@@ -1,6 +1,6 @@
1
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bte6jRB2.js";
2
- import { t as disconnectStateAdapter } from "./adapter-DN5AB4VU.js";
3
- import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-BI5Wgx22.js";
1
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Bym8GVdh.js";
2
+ import { t as disconnectStateAdapter } from "./adapter-JQZaJ-B_.js";
3
+ import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-CGEqz9wG.js";
4
4
  import { CLI_USAGE } from "./cli/run.js";
5
5
  import { createServer } from "node:http";
6
6
  // src/cli/service-account.ts
@@ -1,20 +1,20 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Br as cancelSubscriptions, Ha as sandboxSkillDir, Kn as getPluginUserPromptContributions, Li as escapeSlackMrkdwnText, Lo as JUNIOR_NATIVE_EVENT_NAMESPACE, Mn as isExperimentalFeatureEnabled, P as normalizeConversationText, Qt as hasRuntimeTurnContext, Ra as SANDBOX_DATA_ROOT, Ri as formatSlackLink, Ro as conversationNoteEvent, Ua as sandboxSkillFile, Un as getPluginSlackConversationLink, Va as SANDBOX_WORKSPACE_ROOT, Wa as sandboxSkillPathResolution, Wn as getPluginSystemPromptContributions, Yi as postSlackMessage, _i as listWorkspaces, _n as renderUntrustedTag, ai as getDashboardObjectIconLink, an as isToolResultMessage, b as toStoredConversationMessage, cn as stripRuntimeTurnContext, dn as SESSION_CONTEXT_SECTION_TAG, fn as TURN_CONTEXT_TAG, fr as getReviewItem, gn as renderTag$1, hn as renderChildTag, ho as buildSentryConversationUrl, ii as getDashboardConversationLink, in as isToolResultError, mn as escapeTagText, ni as verifyTimerWatchCredentialSubject, nt as getTurnRecord, on as normalizeToolNameFromResult, pn as escapeClosingTags, qn as getPlugins, ri as JUNIOR_THREAD_STATE_TTL_MS, rt as listTurnSummaries, sn as retainRuntimeTurnContext, tn as isAssistantMessage, ui as ToolInputError, un as REQUEST_CONTEXT_SECTION_TAG, vn as tagJson, zi as normalizeSlackReplyMarkdown } from "./projection-DliWYrnT.js";
3
- import { f as renderCurrentInstruction, h as escapeXmlText, m as escapeXml } from "./client-DDbBucBw.js";
4
- import { n as botConfig } from "./config-DqFnykQT.js";
5
- import { h as logWarn, m as logInfo, p as logException, v as serializeGenAiAttribute } from "./logging-BfORLKoq.js";
2
+ import { Ba as SANDBOX_DATA_ROOT, Bi as formatSlackLink, Ga as sandboxSkillFile, Gn as getPluginSlackConversationLink, Hr as cancelSubscriptions, Jn as getPluginUserPromptContributions, Ka as sandboxSkillPathResolution, Kn as getPluginSystemPromptContributions, N as normalizeConversationText, Pn as isExperimentalFeatureEnabled, Ro as JUNIOR_NATIVE_EVENT_NAMESPACE, Ua as SANDBOX_WORKSPACE_ROOT, Vi as normalizeSlackReplyMarkdown, Wa as sandboxSkillDir, Yn as getPlugins, Zi as postSlackMessage, _n as renderChildTag, ai as JUNIOR_THREAD_STATE_TTL_MS, at as listTurnSummaries, bn as tagJson, cn as normalizeToolNameFromResult, en as hasRuntimeTurnContext, fi as ToolInputError, fn as REQUEST_CONTEXT_SECTION_TAG, gn as escapeTagText, hn as escapeClosingTags, ho as buildSentryConversationUrl, ii as verifyTimerWatchCredentialSubject, it as getTurnRecord, ln as retainRuntimeTurnContext, mn as TURN_CONTEXT_TAG, mr as getReviewItem, oi as getDashboardConversationLink, on as isToolResultError, pn as SESSION_CONTEXT_SECTION_TAG, rn as isAssistantMessage, si as getDashboardObjectIconLink, sn as isToolResultMessage, un as stripRuntimeTurnContext, vn as renderTag$1, x as toStoredConversationMessage, yi as listWorkspaces, yn as renderUntrustedTag, zi as escapeSlackMrkdwnText, zo as conversationNoteEvent } from "./projection-CoeMNxJ4.js";
3
+ import { f as renderCurrentInstruction, h as escapeXmlText, m as escapeXml } from "./client-B0aAs7wC.js";
4
+ import { n as botConfig } from "./config-B9f9Lqo5.js";
5
+ import { h as logWarn, m as logInfo, p as logException, v as serializeGenAiAttribute } from "./logging-CMFhLLj4.js";
6
6
  import { o as isUserActor, t as createActor } from "./actor-6jsm_v96.js";
7
- import { C as getSqlExecutor, H as SYSTEM_IDENTITY_ID, S as getDb, tt as nextDetailVersion, x as getConversationStore, y as getConversationEventStore } from "./viewer-1Ea81s0b.js";
8
- import { N as juniorUsers, j as juniorConversations } from "./executor-BLEMIgIZ.js";
9
- import { i as isVisionImageMediaType } from "./media-Bu9C6lz0.js";
7
+ import { C as getSqlExecutor, S as getDb, V as SYSTEM_IDENTITY_ID, et as nextDetailVersion, x as getConversationStore, y as getConversationEventStore } from "./viewer-CH-ASQzh.js";
8
+ import { A as juniorConversations, M as juniorUsers } from "./executor-Dipi2Ixl.js";
9
+ import { i as isVisionImageMediaType } from "./media-B-BpXo41.js";
10
10
  import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-DJhGdS4c.js";
11
- import { h as credentialSubjectSchema } from "./registry-rC7MCxu8.js";
12
- import { r as getStateAdapter } from "./adapter-DN5AB4VU.js";
13
- import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage, r as EVENT_AUTHOR_ID } from "./prompt-BvIUzY4y.js";
14
- import { a as QUIET_MARKER, i as NO_REPLY_MARKER, r as sanitizeAssistantText } from "./assistant-reply-9Jip5bsr.js";
11
+ import { h as credentialSubjectSchema } from "./registry-u-sFYtx_.js";
12
+ import { r as getStateAdapter } from "./adapter-JQZaJ-B_.js";
13
+ import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage, r as EVENT_AUTHOR_ID } from "./prompt-C9OQEfan.js";
14
+ import { a as QUIET_MARKER, i as NO_REPLY_MARKER, r as sanitizeAssistantText } from "./assistant-reply-CAPafcUY.js";
15
15
  import { E as userCustomizationTextSchema, _ as formatUserInputAnswer } from "./reporting-window-B4TwyuJo.js";
16
- import { r as appendAndEnqueueInboundMessage } from "./store-Dn4W7qgH.js";
17
- import { dt as CORE_EVENT_NAMESPACE, ht as eventGuidance, mt as eventCatalogEntry } from "./turn-session-routing-CGMKrYOj.js";
16
+ import { r as appendAndEnqueueInboundMessage } from "./store-D0-8plWp.js";
17
+ import { Tt as eventGuidance, wt as eventCatalogEntry, xt as CORE_EVENT_NAMESPACE } from "./task-runner-xPuQmEot.js";
18
18
  import path from "node:path";
19
19
  import { isDeepStrictEqual } from "node:util";
20
20
  import * as z from "zod";
@@ -898,7 +898,7 @@ const MAX_INLINE_ATTACHMENT_BASE64_CHARS = 12e4;
898
898
  * background text so ambient messages never look like more instruction.
899
899
  */
900
900
  function renderThreadContextForPrompt(context) {
901
- if (/^<(?:thread-context|thread-compactions|thread-transcript|thread-background|recent-thread-messages)(?:\s|>)/.test(context)) return context;
901
+ if (/^<(?:thread-context|thread-transcript|thread-background|recent-thread-messages)(?:\s|>)/.test(context)) return context;
902
902
  return [
903
903
  "<thread-context authority=\"evidence-only\">",
904
904
  context,
@@ -1030,14 +1030,13 @@ function buildUserTurnInput(args) {
1030
1030
  }
1031
1031
  /** Build the prompt-facing user input. */
1032
1032
  function buildPromptInput(args) {
1033
- const { instruction, history } = args;
1034
- const promptConversationContext = history && history.length > 0 && !instruction.includeConversationContextWithHistory ? void 0 : instruction.context;
1033
+ const { instruction } = args;
1035
1034
  const promptInput = buildUserTurnInput({
1036
1035
  omittedImageAttachmentCount: instruction.omittedImageAttachmentCount ?? 0,
1037
1036
  userAttachments: instruction.attachments ? [...instruction.attachments] : void 0,
1038
1037
  inputParts: renderInputParts(instruction)
1039
1038
  });
1040
- const trimmedContext = promptConversationContext?.trim();
1039
+ const trimmedContext = instruction.context?.trim();
1041
1040
  return {
1042
1041
  ...promptInput,
1043
1042
  contextContentParts: trimmedContext ? [{
@@ -1831,7 +1830,8 @@ async function releaseFailedNoticeClaim(args) {
1831
1830
  /** Post the pause notice for one Conversation Location when known. */
1832
1831
  async function postAutomatedTurnLimitNoticeForConversation(args) {
1833
1832
  try {
1834
- const location = (await getConversationStore().get({ conversationId: args.conversationId }))?.location;
1833
+ const conversation = await getConversationStore().get({ conversationId: args.conversationId });
1834
+ const location = conversation?.parentConversationId ? void 0 : conversation?.location;
1835
1835
  if (!location || location.provider !== "slack") {
1836
1836
  logWarn("automated_turn_limit.notice_skipped", {
1837
1837
  conversationId: args.conversationId,
@@ -2452,6 +2452,7 @@ function eventBatchMessageMeta(messages) {
2452
2452
  const events = watched.length > 1 ? watched.flatMap(messageEvent) : reviewItemChanges.length && primary ? messageEvent(primary) : [];
2453
2453
  return {
2454
2454
  eventType: metadata.event.eventType,
2455
+ eventNamespace: metadata.event.namespace,
2455
2456
  eventObjectType: metadata.event.objectType,
2456
2457
  ...metadata.event.trustedSummary ? { trustedSummary: metadata.event.trustedSummary } : void 0,
2457
2458
  ...events.length ? { events } : void 0,
@@ -2626,7 +2627,7 @@ async function getActiveConversationTurnId(conversationId) {
2626
2627
  /** Return the web and event mailbox Turns that are paused or running. */
2627
2628
  async function listActiveMailboxTurns(conversationId) {
2628
2629
  const summaries = await listTurnSummaries(conversationId);
2629
- return (await Promise.all(summaries.filter((summary) => !summary.dispatchId && (summary.state === "paused" || summary.state === "running")).map((summary) => getTurnRecord(conversationId, summary.turnId)))).filter((record) => record !== void 0 && !record.dispatchId && (record.source?.kind === "web" || record.source?.kind === "event" || !record.source && (record.surface === "api" || hasEventActor(record.actors))) && (record.state === "paused" || record.state === "running"));
2630
+ return (await Promise.all(summaries.filter((summary) => !summary.dispatchId && (summary.state === "paused" || summary.state === "running")).map((summary) => getTurnRecord(conversationId, summary.turnId)))).filter((record) => record !== void 0 && !record.dispatchId && record.surface !== "internal" && (record.source?.kind === "web" || record.source?.kind === "event" || !record.source && (record.surface === "api" || hasEventActor(record.actors))) && (record.state === "paused" || record.state === "running"));
2630
2631
  }
2631
2632
  /** Return the active web or event mailbox Turn. */
2632
2633
  async function getActiveMailboxTurnId(conversationId) {
@@ -2641,6 +2642,7 @@ async function getAuthPausedConversationTurnId(conversationId) {
2641
2642
  const record = await getTurnRecord(conversationId, turnId);
2642
2643
  return record?.state === "paused" && record.resumeReason === "auth" ? turnId : void 0;
2643
2644
  }
2645
+ /** Read one web input batch as Turn input. A batch with no web input gives []. */
2644
2646
  function parseWebMessages(messages) {
2645
2647
  if (messages.length === 0) return [];
2646
2648
  const parsed = messages.map((message) => ({
@@ -2921,4 +2923,4 @@ async function saveStoppedConversationEvents(conversationId, messages) {
2921
2923
  }
2922
2924
  }]);
2923
2925
  }
2924
- export { saveUserCustomization as $, slackChannelMessageReplyThreadTs as A, resolveSlackReplyTarget as B, isEventMailboxMetadata as C, SLACK_EVENT_NAMESPACE as D, getEventCatalog as E, workspaceSnapshotFinishedEvent as F, resetAutomatedTurnLimit as G, renderSlackObjectCard as H, workspaceSnapshotWatch as I, buildSteeringPiMessage as J, assemblePrompt as K, renderTaskInput as L, slackChannelMessageTrigger as M, WORKSPACE_SNAPSHOT_FAILED_EVENT as N, requireSlackChannelMessageScope as O, WORKSPACE_SNAPSHOT_READY_EVENT as P, readUserCustomization as Q, maybePostAutomatedTurnLimitNotice as R, eventBatchMessageMeta as S, timerWatchCredentialSubject as T, admitAutomatedTurn as U, sendSlackReply as V, recordFinishedTurnForAutomatedLimit as W, loadPromptTurnContext as X, instructionForInputs as Y, withoutSavedSteeringMessages as Z, legacyWebMailboxMetadataSchema as _, session_stop_exports as a, automationResultSchema as at, EVENT_WAIT_MS as b, loadReviewItemInput as c, postsRunNotices as ct, getEventBatchDelayMs as d, runDispatchOutcome as dt, addConversationNote as et, listActiveMailboxTurns as f, turnInputFactsFromConversationMessage as g, sourceFromTurnInput as h, resumeStoppedConversationTree as i, FINISH_AUTOMATION_RUN_TOOL_NAME as it, slackChannelMessageRunsAutomation as j, slackChannelMessageEvent as k, savedInputInstruction as l, readAutomationResult as lt, resolveMailboxTurnWork as m, isWatchEvent as n, REPORT_BLOCKED_TOOL_NAME as nt, skipInputAfterConversationStop as o, deliversFinalText as ot, parseEventMessages as p, buildPromptInput as q, markConversationsStopped as r, readBlockedReport as rt, eventReviewItemInputs as s, finishedRunReply as st, getConversationStoppedAtMs as t, JUNIOR_PERSONALITY as tt, getAuthPausedConversationTurnId as u, remindMissingAutomationResult as ut, conversationSubtree as v, renderEventBatchInputs as w, enqueueEventNotification as x, conversationSubtreeColumns as y, postAutomatedTurnLimitNoticeForConversation as z };
2926
+ export { withoutSavedSteeringMessages as $, requireSlackChannelMessageScope as A, maybePostAutomatedTurnLimitNotice as B, enqueueEventNotification as C, timerWatchCredentialSubject as D, renderEventBatchInputs as E, WORKSPACE_SNAPSHOT_FAILED_EVENT as F, admitAutomatedTurn as G, resolveSlackReplyTarget as H, WORKSPACE_SNAPSHOT_READY_EVENT as I, assemblePrompt as J, recordFinishedTurnForAutomatedLimit as K, workspaceSnapshotFinishedEvent as L, slackChannelMessageReplyThreadTs as M, slackChannelMessageRunsAutomation as N, getEventCatalog as O, slackChannelMessageTrigger as P, loadPromptTurnContext as Q, workspaceSnapshotWatch as R, EVENT_WAIT_MS as S, isEventMailboxMetadata as T, sendSlackReply as U, postAutomatedTurnLimitNoticeForConversation as V, renderSlackObjectCard as W, buildSteeringPiMessage as X, buildPromptInput as Y, instructionForInputs as Z, sourceFromTurnInput as _, session_stop_exports as a, readBlockedReport as at, conversationSubtree as b, loadReviewItemInput as c, deliversFinalText as ct, getAuthPausedConversationTurnId as d, readAutomationResult as dt, readUserCustomization as et, getEventBatchDelayMs as f, remindMissingAutomationResult as ft, resolveMailboxTurnWork as g, parseWebMessages as h, resumeStoppedConversationTree as i, REPORT_BLOCKED_TOOL_NAME as it, slackChannelMessageEvent as j, SLACK_EVENT_NAMESPACE as k, savedInputInstruction as l, finishedRunReply as lt, parseEventMessages as m, isWatchEvent as n, addConversationNote as nt, skipInputAfterConversationStop as o, FINISH_AUTOMATION_RUN_TOOL_NAME as ot, listActiveMailboxTurns as p, runDispatchOutcome as pt, resetAutomatedTurnLimit as q, markConversationsStopped as r, JUNIOR_PERSONALITY as rt, eventReviewItemInputs as s, automationResultSchema as st, getConversationStoppedAtMs as t, saveUserCustomization as tt, getActiveConversationTurnId as u, postsRunNotices as ut, turnInputFactsFromConversationMessage as v, eventBatchMessageMeta as w, conversationSubtreeColumns as x, legacyWebMailboxMetadataSchema as y, renderTaskInput as z };
@@ -1,7 +1,7 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { h as logWarn } from "./logging-BfORLKoq.js";
2
+ import { h as logWarn } from "./logging-CMFhLLj4.js";
3
3
  import { s as skillRoots } from "./package-discovery-DJhGdS4c.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bte6jRB2.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Bym8GVdh.js";
5
5
  import path from "node:path";
6
6
  import * as z from "zod";
7
7
  import fs from "node:fs/promises";
@@ -1,14 +1,25 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Ft as actorFromRun, It as toolInvocationDestination } from "./agent-runner-BsWhHe4N.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-ybG4_q5C.js";
2
+ import { n as botConfig } from "./config-B9f9Lqo5.js";
3
+ import { Gt as actorFromRun, Kt as toolInvocationDestination, Pt as AgentDepthLimitError, i as readConversationLineage } from "./agent-runner-DGCwOEyL.js";
4
+ import { n as createAndEnqueueAgentInvocation } from "./work-C75_IM5e.js";
4
5
  // src/chat/agent-invocations/spawn.ts
5
6
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
7
+ /**
8
+ * Count the parents of the Conversation that starts a child agent. A chain
9
+ * that does not end at a root, such as a cycle, cannot start one.
10
+ */
11
+ async function assertCanStartChildAgent(conversationId, maxAgentDepth) {
12
+ const lineage = await readConversationLineage(conversationId);
13
+ const root = lineage[0];
14
+ if (!root || root.parentConversationId || lineage.length - 1 > maxAgentDepth) throw new AgentDepthLimitError(maxAgentDepth);
15
+ }
6
16
  /** Bind a Run's Actor and credentials to new Agent invocations. */
7
17
  function bindSpawnAgent(run, options) {
8
18
  const actor = actorFromRun(run);
9
19
  if (!actor) return;
10
20
  return async (input, call) => {
11
21
  call.signal?.throwIfAborted();
22
+ await assertCanStartChildAgent(run.conversationId, options.maxAgentDepth ?? botConfig.maxAgentDepth);
12
23
  const queue = typeof options.queue === "function" ? options.queue() : options.queue;
13
24
  return { childConversationId: (await createAndEnqueueAgentInvocation({
14
25
  actor,