@sentry/junior 0.276.0 → 0.278.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 (80) hide show
  1. package/dist/{adapter-DoPR2jS-.js → adapter-BXosqTMx.js} +1 -1
  2. package/dist/{admin-BJTT-kXb.js → admin-Thn7NfOi.js} +1 -1
  3. package/dist/{agent-invocations-CUWrrzkc.js → agent-invocations-D7c4BQGc.js} +6 -2
  4. package/dist/{agent-runner-sMpA5qGM.js → agent-runner-DE-43MPb.js} +396 -877
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +5 -5
  7. package/dist/api.d.ts +13 -2
  8. package/dist/api.js +132 -61
  9. package/dist/{app-DTj-yAQt.d.ts → app-CHNS-AX2.d.ts} +6 -27
  10. package/dist/app.d.ts +3 -3
  11. package/dist/app.js +65 -57
  12. package/dist/{assistant-reply-DbxKnBQF.js → assistant-reply-pauL6qyn.js} +28 -6
  13. package/dist/{automation-B8_mC68r.js → automation-DphoTRYl.js} +1 -1
  14. package/dist/{background-compaction-queue-Bywqo1WJ.js → background-compaction-queue-CAL4A2y7.js} +2 -2
  15. package/dist/{briefs-IL7QnCCR.js → briefs-4fyPJJEu.js} +5 -6
  16. package/dist/{catalog-runtime--sC2CYLQ.js → catalog-runtime-BoOb5oUv.js} +1 -1
  17. package/dist/cli/chat.d.ts +1 -1
  18. package/dist/cli/chat.js +14 -14
  19. package/dist/cli/check.js +3 -3
  20. package/dist/cli/init.js +0 -2
  21. package/dist/cli/main.js +3 -3
  22. package/dist/cli/plugins.d.ts +1 -1
  23. package/dist/cli/plugins.js +4 -4
  24. package/dist/cli/snapshot-create.js +4 -4
  25. package/dist/cli/upgrade.d.ts +2 -2
  26. package/dist/cli/upgrade.js +3 -3
  27. package/dist/{client-7diKvInp.js → client-v_OVYuHZ.js} +3 -3
  28. package/dist/{config-Cb--cuv-.js → config-o2jLRY5J.js} +24 -99
  29. package/dist/{connections-C4-4fxaE.js → connections-RC4NXAx8.js} +10 -10
  30. package/dist/{conversation-DppJ83Hw.js → conversation-CZfyQvdm.js} +54 -109
  31. package/dist/{conversation-privacy-DTwdT3Pi.js → conversation-privacy-C23M8KaD.js} +1 -1
  32. package/dist/{credential-sync-Sl5RQCkS.js → credential-sync-Dd0WyNfF.js} +13 -13
  33. package/dist/{db-Ck6TXQIx.d.ts → db-BjLzDJCt.d.ts} +1 -1
  34. package/dist/{executor-BFKmqxYe.js → executor-CJfsD0VX.js} +13 -5
  35. package/dist/instrumentation.js +2 -2
  36. package/dist/{logging-B04X_eCB.js → logging-dFaXvBRK.js} +4 -2
  37. package/dist/{media-DstkkoNP.js → media-DTAA8Qs_.js} +21 -23
  38. package/dist/{message-DQMFyyE-.js → message-DSwxIZet.js} +22 -28
  39. package/dist/nitro.d.ts +2 -2
  40. package/dist/nitro.js +7 -3
  41. package/dist/{oauth-callback-server-BGq0_vQI.js → oauth-callback-server-CDcuCp27.js} +2 -2
  42. package/dist/{plugins-B_0Cr0MO.d.ts → plugins-DtmjkTza.d.ts} +1 -0
  43. package/dist/{projection-6dXaN0n-.js → projection-BTge9wrH.js} +5426 -5300
  44. package/dist/{prompt-B4fQKGZR.js → prompt-DDtCnlHP.js} +1 -1
  45. package/dist/{registry-CEqKR_ld.js → registry-Cp6CNmtP.js} +24 -8
  46. package/dist/{resolve-8I5DkrfI.js → resolve-B_7h2cXx.js} +3 -3
  47. package/dist/{result-BgAW90IM.js → result-5LBEfnLX.js} +9 -9
  48. package/dist/{runner-CSKDr_19.js → runner-C5-S4oq-.js} +11 -11
  49. package/dist/{sandbox-egress-signals-BxAT276e.js → sandbox-egress-signals-B4GehT1L.js} +1 -1
  50. package/dist/{schema-Cal-EFdi.js → schema-B5fpczDw.js} +82 -4
  51. package/dist/{schema-CaUWl2EV.d.ts → schema-Tr484cCC.d.ts} +935 -688
  52. package/dist/{service-account-CUuVJCKT.js → service-account-BkEv20zf.js} +3 -3
  53. package/dist/{service-account-CtOab1Xz.js → service-account-Cq_dLrZJ.js} +3 -3
  54. package/dist/{session-stop-DK8LuPZW.js → session-stop-BsS4qFS2.js} +26 -16
  55. package/dist/{skills-Bc0D7BGy.js → skills-M0BA0_s6.js} +2 -2
  56. package/dist/{spawn-DF_GUcd8.js → spawn-BO3y7H4d.js} +2 -3
  57. package/dist/{stop-DthSy-z8.js → stop-D5R82Wla.js} +612 -186
  58. package/dist/{store-C5uVTx2G.js → store-BGBzQWNf.js} +9 -16
  59. package/dist/{store-BgH2P3X9.js → store-CGJZTEVz.js} +3 -3
  60. package/dist/{task-queue-C6ROM_XJ.js → task-queue-UD27ei2U.js} +3 -3
  61. package/dist/{task-runner-BwAkjjVE.js → task-runner-noxjOjkM.js} +7 -7
  62. package/dist/{thread-state-BXjgk1pW.js → thread-state-BSu6rM6p.js} +4 -4
  63. package/dist/{turn-failure-response-CVI57qKL.js → turn-failure-response-wahwyPrZ.js} +7 -7
  64. package/dist/{turn-lifecycle-CF6ibonp.js → turn-lifecycle-Bo4Trccw.js} +1 -1
  65. package/dist/{turn-session-routing-DddybdNu.js → turn-session-routing-DnSaaEpn.js} +10 -10
  66. package/dist/{validation-BxF1nQbC.js → validation-B9-8iKyw.js} +1 -1
  67. package/dist/{version-CTzSbCmR.js → version-C7HejFP2.js} +1 -1
  68. package/dist/version.js +1 -1
  69. package/dist/{viewer-CQwBszc7.js → viewer-DLXajQZE.js} +94 -28
  70. package/dist/{work-BHlShEQ6.js → work-DRGSlfia.js} +12 -17
  71. package/dist/{worker-DhY9MnsH.js → worker-BGh5Dwc6.js} +6 -6
  72. package/migrations/0074_conversation_participant_pins.sql +1 -0
  73. package/migrations/0075_conversation_detail_version.sql +1 -0
  74. package/migrations/0076_conversation_auto_archive.sql +5 -0
  75. package/migrations/meta/0074_snapshot.json +4076 -0
  76. package/migrations/meta/0075_snapshot.json +4083 -0
  77. package/migrations/meta/0076_snapshot.json +4147 -0
  78. package/migrations/meta/_journal.json +21 -0
  79. package/package.json +5 -5
  80. package/dist/model-profile-B998sjVd.js +0 -67
@@ -1,8 +1,8 @@
1
- import { c as modelProfileSchema, u as TURN_REASONING_LEVELS } from "./model-profile-B998sjVd.js";
2
- import { C as getSqlExecutor, x as getConversationStore } from "./viewer-CQwBszc7.js";
3
- import { a as juniorAgentInvocations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-CUWrrzkc.js";
4
- import "./executor-BFKmqxYe.js";
5
- import { p as credentialContextSchema } from "./registry-CEqKR_ld.js";
1
+ import { g as TURN_REASONING_LEVELS } from "./config-o2jLRY5J.js";
2
+ import { C as getSqlExecutor, x as getConversationStore } from "./viewer-DLXajQZE.js";
3
+ import { a as juniorAgentInvocations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-D7c4BQGc.js";
4
+ import "./executor-CJfsD0VX.js";
5
+ import { p as credentialContextSchema } from "./registry-Cp6CNmtP.js";
6
6
  import { createHash } from "node:crypto";
7
7
  import { z } from "zod";
8
8
  import { and, asc, count, countDistinct, desc, eq, inArray, lt, ne, or, sql } from "drizzle-orm";
@@ -105,8 +105,7 @@ function markTurnFailed(args) {
105
105
  * code reads only these fields, never a type name, so types can later come
106
106
  * from configuration. Types do not limit tools: Guardian reviews each child
107
107
  * action against the root user's messages, as for any child. A child keeps its
108
- * type for later agent invocations, the same as its profile. A child without
109
- * a type starts fresh.
108
+ * type for later agent invocations. A child without a type starts fresh.
110
109
  */
111
110
  const AGENT_TYPES = [
112
111
  "fork",
@@ -114,8 +113,8 @@ const AGENT_TYPES = [
114
113
  "reviewer"
115
114
  ];
116
115
  /**
117
- * Stored name of a child agent type. Like a model profile, a stored name stays
118
- * readable after its type is removed; the runtime then treats the child as a
116
+ * Stored name of a child agent type. A stored name stays readable after its
117
+ * type is removed; the runtime then treats the child as a
119
118
  * child without a type.
120
119
  */
121
120
  const agentTypeSchema = z.string().regex(/^[a-z][a-z0-9_-]*$/);
@@ -179,7 +178,6 @@ const agentInvocationBaseSchema = z.object({
179
178
  parentConversationId: exactStringSchema,
180
179
  parentToolCallId: exactStringSchema.optional(),
181
180
  agentType: agentTypeSchema.optional(),
182
- modelProfile: modelProfileSchema.optional(),
183
181
  reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
184
182
  source: sourceSchema,
185
183
  title: exactStringSchema.optional(),
@@ -218,7 +216,6 @@ const createAgentInvocationSchema = z.object({
218
216
  parentConversationId: exactStringSchema,
219
217
  parentToolCallId: exactStringSchema.optional(),
220
218
  agentType: agentTypeSchema.optional(),
221
- modelProfile: modelProfileSchema.optional(),
222
219
  reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
223
220
  title: exactStringSchema.optional()
224
221
  }).strict();
@@ -385,7 +382,6 @@ function invocationFromRow(row) {
385
382
  ...row.parentMailboxStatus ? { parentMailboxStatus: row.parentMailboxStatus } : void 0,
386
383
  ...row.parentToolCallId ? { parentToolCallId: row.parentToolCallId } : void 0,
387
384
  ...row.agentType ? { agentType: row.agentType } : void 0,
388
- ...row.modelProfile ? { modelProfile: row.modelProfile } : void 0,
389
385
  ...row.reasoningLevel ? { reasoningLevel: row.reasoningLevel } : void 0,
390
386
  ...row.result !== null ? { result: row.result } : void 0,
391
387
  source: row.source,
@@ -401,7 +397,7 @@ function invocationFromRow(row) {
401
397
  * stored title wins.
402
398
  */
403
399
  function sameCreateInput(invocation, input) {
404
- return invocation.parentConversationId === input.parentConversationId && invocation.agentName === input.agentName && invocation.input === input.input && invocation.agentType === input.agentType && invocation.modelProfile === input.modelProfile && invocation.reasoningLevel === input.reasoningLevel && JSON.stringify(invocation.actor) === JSON.stringify(input.actor) && JSON.stringify(invocation.credentialContext) === JSON.stringify(input.credentialContext) && JSON.stringify(invocation.destination) === JSON.stringify(input.destination);
400
+ return invocation.parentConversationId === input.parentConversationId && invocation.agentName === input.agentName && invocation.input === input.input && invocation.agentType === input.agentType && invocation.reasoningLevel === input.reasoningLevel && JSON.stringify(invocation.actor) === JSON.stringify(input.actor) && JSON.stringify(invocation.credentialContext) === JSON.stringify(input.credentialContext) && JSON.stringify(invocation.destination) === JSON.stringify(input.destination);
405
401
  }
406
402
  /** Read one durable agent invocation. */
407
403
  async function getAgentInvocation(invocationId) {
@@ -503,7 +499,6 @@ async function createAgentInvocation(rawInput, nowMs = Date.now()) {
503
499
  source: { kind: "agent_invocation" },
504
500
  destination: input.destination,
505
501
  agentType: input.agentType ?? null,
506
- modelProfile: input.modelProfile ?? null,
507
502
  reasoningLevel: input.reasoningLevel ?? null,
508
503
  parentToolCallId: input.parentToolCallId ?? null,
509
504
  status: "pending",
@@ -538,7 +533,6 @@ async function createAgentInvocationFromLatest(args, nowMs = Date.now()) {
538
533
  source: args.runAs?.source ?? { kind: "agent_invocation" },
539
534
  destination: args.latest.destination,
540
535
  agentType: args.latest.agentType ?? null,
541
- modelProfile: args.latest.modelProfile ?? null,
542
536
  reasoningLevel: args.latest.reasoningLevel ?? null,
543
537
  status: "pending",
544
538
  mailboxStatus: "pending",
@@ -593,7 +587,6 @@ async function createAgentInvocationForMessage(input, nowMs = Date.now()) {
593
587
  source: { kind: "agent_invocation" },
594
588
  destination: input.destination,
595
589
  agentType: latest.agentType ?? null,
596
- modelProfile: latest.modelProfile ?? null,
597
590
  reasoningLevel: latest.reasoningLevel ?? null,
598
591
  parentToolCallId: input.parentToolCallId,
599
592
  status: "pending",
@@ -1,6 +1,6 @@
1
- import { At as recordConversationRetry$1, Dt as listActiveConversationIds$1, Ft as startConversationWork$1, It as steerWebPendingMessages$1, Lt as stopConversationWork$1, Mt as removeActiveConversation$1, Nt as requestAnotherSlice$1, Ot as markConversationWorkEnqueued$1, Pt as requestConversationWork$1, St as getConversationWorkState$1, _t as completeConversationStop$1, bt as drainConversationMailbox$1, dt as appendInboundMessage, ft as beginConversationResume$1, gt as clearExpiredConversationLease$1, ht as clearConsumedConversationWake$1, jt as releaseConversationWork$1, kt as recordAttemptFailure$1, lt as ackMessages$1, mt as checkInConversationWork$1, pt as cancelHumanFacingPendingMessages$1, ut as appendExclusiveInboundMessage, vt as completeConversationWork$1, xt as getConversation$1, yt as deadLetterAttempt$1 } from "./projection-6dXaN0n-.js";
2
- import { x as getConversationStore } from "./viewer-CQwBszc7.js";
3
- import "./background-compaction-queue-Bywqo1WJ.js";
1
+ import { At as requestAnotherSlice$1, Dt as recordConversationRetry$1, Et as recordAttemptFailure$1, Mt as startConversationWork$1, Nt as steerWebPendingMessages$1, Ot as releaseConversationWork$1, Pt as stopConversationWork$1, Tt as markConversationWorkEnqueued$1, _t as drainConversationMailbox$1, ct as appendInboundMessage, dt as checkInConversationWork$1, ft as clearConsumedConversationWake$1, gt as deadLetterAttempt$1, ht as completeConversationWork$1, jt as requestConversationWork$1, kt as removeActiveConversation$1, lt as beginConversationResume$1, mt as completeConversationStop$1, ot as ackMessages$1, pt as clearExpiredConversationLease$1, st as appendExclusiveInboundMessage, ut as cancelHumanFacingPendingMessages$1, vt as getConversation$1, wt as listActiveConversationIds$1, yt as getConversationWorkState$1 } from "./projection-BTge9wrH.js";
2
+ import { x as getConversationStore } from "./viewer-DLXajQZE.js";
3
+ import "./background-compaction-queue-CAL4A2y7.js";
4
4
  // src/chat/task-execution/store.ts
5
5
  function metadataStore(options) {
6
6
  return options.conversationStore ?? getConversationStore();
@@ -1,5 +1,5 @@
1
- import { h as logWarn } from "./logging-B04X_eCB.js";
2
- import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-Bywqo1WJ.js";
1
+ import { h as logWarn } from "./logging-dFaXvBRK.js";
2
+ import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-CAL4A2y7.js";
3
3
  import { createHash } from "node:crypto";
4
4
  import { z } from "zod";
5
5
  // src/chat/queue/callback.ts
@@ -110,7 +110,7 @@ function pluginTaskCallback() {
110
110
  maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
111
111
  onRejected: logPluginTaskQueueMessageRejected,
112
112
  run: async (message) => {
113
- const { processPluginTask } = await import("./task-runner-BwAkjjVE.js").then((n) => n.r);
113
+ const { processPluginTask } = await import("./task-runner-noxjOjkM.js").then((n) => n.r);
114
114
  await processPluginTask(message);
115
115
  },
116
116
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -1,12 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { $t as instructionTextForProjection, Aa as createPluginLogger, Ba as createPluginConversationEvents, Bn as getPlugins, Da as createPluginState, Jt as getPiMessageRole, Oa as createPluginEmbedder, Un as coreTaskRegistrations, an as normalizeToolNameFromResult, in as isToolResultMessage, io as createPluginCache, it as getTurnRecord, ka as createPluginModel, rn as isToolResultError, sn as stripRuntimeTurnContext, x as hydrateConversationMessages } from "./projection-6dXaN0n-.js";
2
+ import { Bn as coreTaskRegistrations, Gr as createPluginState, Gt as getPiMessageRole, Ha as createPluginConversationEvents, Ln as getPlugins, Xt as instructionTextForProjection, co as createPluginCache, en as isToolResultError, ga as createPluginModel, ha as createPluginEmbedder, in as stripRuntimeTurnContext, ka as createPluginLogger, nn as normalizeToolNameFromResult, tn as isToolResultMessage, tt as getTurnRecord, v as hydrateConversationMessages } from "./projection-BTge9wrH.js";
3
3
  import { h as parseSlackMessageTs } from "./actor-B4DYygOB.js";
4
- import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-CQwBszc7.js";
5
- import { _ as sameActorIdentity } from "./media-DstkkoNP.js";
6
- import { r as getStateAdapter } from "./adapter-DoPR2jS-.js";
7
- import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-DddybdNu.js";
8
- import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BXjgk1pW.js";
9
- import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-C6ROM_XJ.js";
4
+ import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-DLXajQZE.js";
5
+ import { _ as sameActorIdentity } from "./media-DTAA8Qs_.js";
6
+ import { r as getStateAdapter } from "./adapter-BXosqTMx.js";
7
+ import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-DnSaaEpn.js";
8
+ import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BSu6rM6p.js";
9
+ import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-UD27ei2U.js";
10
10
  import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
11
11
  // src/chat/plugins/task-runner.ts
12
12
  /**
@@ -1,7 +1,7 @@
1
- import { S as persistConversationMessages, ao as createDurableLocationConfigurationService, sa as JUNIOR_THREAD_STATE_TTL_MS } from "./projection-6dXaN0n-.js";
2
- import { H as isRecord, U as toOptionalNumber, W as toOptionalString } from "./logging-B04X_eCB.js";
3
- import { S as getDb } from "./viewer-CQwBszc7.js";
4
- import { r as getStateAdapter } from "./adapter-DoPR2jS-.js";
1
+ import { Rr as JUNIOR_THREAD_STATE_TTL_MS, lo as createDurableLocationConfigurationService, y as persistConversationMessages } from "./projection-BTge9wrH.js";
2
+ import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-dFaXvBRK.js";
3
+ import { S as getDb } from "./viewer-DLXajQZE.js";
4
+ import { r as getStateAdapter } from "./adapter-BXosqTMx.js";
5
5
  // src/chat/state/conversation.ts
6
6
  function defaultConversationState() {
7
7
  return {
@@ -1,11 +1,11 @@
1
- import { $a as listConversationAnnotations, F as markConversationMessage, Y as clearPendingAuth, pn as buildDeterministicTurnId, x as hydrateConversationMessages } from "./projection-6dXaN0n-.js";
2
- import { _ as findProviderError, h as ProviderError, v as getProviderErrorAttributes, y as getProviderErrorUserMessage } from "./client-7diKvInp.js";
3
- import { H as isRecord, t as buildTurnFailureResponse } from "./logging-B04X_eCB.js";
1
+ import { K as clearPendingAuth, M as markConversationMessage, ro as listConversationAnnotations, un as buildDeterministicTurnId, v as hydrateConversationMessages } from "./projection-BTge9wrH.js";
2
+ import { _ as findProviderError, h as ProviderError, v as getProviderErrorAttributes, y as getProviderErrorUserMessage } from "./client-v_OVYuHZ.js";
3
+ import { W as isRecord, t as buildTurnFailureResponse } from "./logging-dFaXvBRK.js";
4
4
  import { h as parseSlackMessageTs } from "./actor-B4DYygOB.js";
5
- import { S as getDb, y as getConversationEventStore } from "./viewer-CQwBszc7.js";
6
- import { H as removedCardSchema, U as resolveMessageCards, V as readMessageCardRefs } from "./conversation-DppJ83Hw.js";
7
- import { O as parseAgentInvocationResultMessageId, Q as markTurnCompleted, Z as markTurnClosed, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-C5uVTx2G.js";
8
- import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BXjgk1pW.js";
5
+ import { S as getDb, y as getConversationEventStore } from "./viewer-DLXajQZE.js";
6
+ import { M as readMessageCardRefs, N as removedCardSchema, P as resolveMessageCards } from "./conversation-CZfyQvdm.js";
7
+ import { O as parseAgentInvocationResultMessageId, Q as markTurnCompleted, Z as markTurnClosed, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-BGBzQWNf.js";
8
+ import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BSu6rM6p.js";
9
9
  // src/chat/conversations/pending-cards.ts
10
10
  /**
11
11
  * Add the cards that tool results selected since the last visible assistant
@@ -1,4 +1,4 @@
1
- import { y as getConversationEventStore } from "./viewer-CQwBszc7.js";
1
+ import { y as getConversationEventStore } from "./viewer-DLXajQZE.js";
2
2
  // src/chat/conversations/turn-lifecycle.ts
3
3
  /** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
4
4
  var ConversationTurnLifecycleService = class {
@@ -1,12 +1,12 @@
1
- import { $r as postSlackMessage, D as fallbackShortTitle, Hr as formatSlackLink, Vr as escapeSlackMrkdwnText, Xr as openSlackDirectMessage, da as getDashboardTaskLink, pa as ToolInputError, sa as JUNIOR_THREAD_STATE_TTL_MS } from "./projection-6dXaN0n-.js";
2
- import { n as botConfig } from "./config-Cb--cuv-.js";
3
- import { _ as runBestEffort, h as logWarn } from "./logging-B04X_eCB.js";
4
- import { G as agentTurnCostUsd, K as agentTurnTotalTokens, S as getDb } from "./viewer-CQwBszc7.js";
5
- import { s as juniorConversations } from "./agent-invocations-CUWrrzkc.js";
6
- import { d as juniorAutomations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-BFKmqxYe.js";
7
- import { h as credentialSubjectSchema } from "./registry-CEqKR_ld.js";
8
- import { r as getStateAdapter } from "./adapter-DoPR2jS-.js";
9
- import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-B8_mC68r.js";
1
+ import { Ei as openSlackDirectMessage, Hr as getDashboardTaskLink, Rr as JUNIOR_THREAD_STATE_TTL_MS, Wr as ToolInputError, _i as escapeSlackMrkdwnText, ki as postSlackMessage, vi as formatSlackLink, w as fallbackShortTitle } from "./projection-BTge9wrH.js";
2
+ import { n as botConfig } from "./config-o2jLRY5J.js";
3
+ import { _ as runBestEffort, h as logWarn } from "./logging-dFaXvBRK.js";
4
+ import { Q as agentTurnTotalTokens, S as getDb, Z as agentTurnCostUsd } from "./viewer-DLXajQZE.js";
5
+ import { s as juniorConversations } from "./agent-invocations-D7c4BQGc.js";
6
+ import { d as juniorAutomations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-CJfsD0VX.js";
7
+ import { h as credentialSubjectSchema } from "./registry-Cp6CNmtP.js";
8
+ import { r as getStateAdapter } from "./adapter-BXosqTMx.js";
9
+ import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-DphoTRYl.js";
10
10
  import { createHash } from "node:crypto";
11
11
  import { z } from "zod";
12
12
  import { and, asc, count, desc, eq, gte, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
@@ -1584,7 +1584,7 @@ function slackSourceForDestination(args) {
1584
1584
  * Reads parent Conversations when this Conversation has no Destination.
1585
1585
  */
1586
1586
  async function resolveConversationRouting(args) {
1587
- const conversationStore = args.conversationStore ?? (await import("./viewer-CQwBszc7.js").then((n) => n.v)).getConversationStore();
1587
+ const conversationStore = args.conversationStore ?? (await import("./viewer-DLXajQZE.js").then((n) => n.v)).getConversationStore();
1588
1588
  const chain = await loadConversationChain(args.conversationId, conversationStore);
1589
1589
  let destination;
1590
1590
  let source;
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime--sC2CYLQ.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BoOb5oUv.js";
3
3
  import { isDeepStrictEqual } from "node:util";
4
4
  // src/chat/plugins/validation.ts
5
5
  var validation_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.276.0";
2
+ var version = "0.278.0";
3
3
  // src/version.ts
4
4
  /** Installed Junior package version, or `unknown` when package metadata is unavailable. */
5
5
  const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export { t as JUNIOR_VERSION } from "./version-CTzSbCmR.js";
1
+ export { t as JUNIOR_VERSION } from "./version-C7HejFP2.js";
@@ -1,14 +1,15 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { i as getChatConfig } from "./config-Cb--cuv-.js";
3
- import { V as normalizeIdentityEmail, h as logWarn, z as GOOGLE_IDENTITY_PROVIDER } from "./logging-B04X_eCB.js";
2
+ import { i as getChatConfig } from "./config-o2jLRY5J.js";
3
+ import { U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-dFaXvBRK.js";
4
4
  import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-B4DYygOB.js";
5
- import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-CUWrrzkc.js";
6
- import { S as juniorConversationAnnotations, b as juniorConversationEvents, g as juniorConversationBindings, h as juniorConversationParticipants, t as createJuniorSqlExecutor, v as CONVERSATION_METRICS, y as juniorConversationMetrics } from "./executor-BFKmqxYe.js";
7
- import { d as newConversationEventSchema, f as encodeHistoryPayload, l as decodeStoredConversationEvent, n as detectImageMediaType, o as conversationEventDataSchema, u as historyReplacementSchema, v as usageSchema } from "./media-DstkkoNP.js";
5
+ import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-D7c4BQGc.js";
6
+ import { S as juniorConversationAnnotations, b as juniorConversationEvents, g as juniorConversationBindings, h as juniorConversationParticipants, t as createJuniorSqlExecutor, v as CONVERSATION_METRICS, y as juniorConversationMetrics } from "./executor-CJfsD0VX.js";
7
+ import { d as newConversationEventSchema, f as encodeHistoryPayload, l as decodeStoredConversationEvent, n as detectImageMediaType, o as conversationEventDataSchema, u as historyReplacementSchema, v as usageSchema } from "./media-DTAA8Qs_.js";
8
8
  import { a as withLock } from "./locks-D-0h111u.js";
9
9
  import { createHash, randomUUID } from "node:crypto";
10
10
  import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
11
11
  import { destinationSchema, identitySchema, locationSchema, sourceSchema, userSchema } from "@sentry/junior-plugin-api";
12
+ import { alias } from "drizzle-orm/pg-core";
12
13
  // src/chat/destination.ts
13
14
  /** Build Junior's canonical destination from Slack workspace and channel ids. */
14
15
  function createSlackDestination(input) {
@@ -167,6 +168,32 @@ function addAgentTurnUsage(...usages) {
167
168
  };
168
169
  return hasAgentTurnUsage(result) ? result : void 0;
169
170
  }
171
+ // src/chat/conversations/sql/detail-version.ts
172
+ /** SQL that advances `detail_version` inside a `juniorConversations` set. */
173
+ const nextDetailVersion = sql`${juniorConversations.detailVersion} + 1`;
174
+ function bumpDetailVersion(db, conversationIds) {
175
+ return db.update(juniorConversations).set({ detailVersion: nextDetailVersion }).where(inArray(juniorConversations.conversationId, [...conversationIds]));
176
+ }
177
+ /**
178
+ * Return a CTE that marks the detail report of each Conversation as changed,
179
+ * in the same statement as the write that it covers:
180
+ * `db.with(conversationDetailTouch(db, ids)).insert(table)`.
181
+ * Postgres runs a data-modifying CTE even when the statement does not read it,
182
+ * and both changes commit together.
183
+ */
184
+ function conversationDetailTouch(db, conversationIds) {
185
+ return db.$with("conversation_detail_touch").as(bumpDetailVersion(db, conversationIds).returning({ conversationId: juniorConversations.conversationId }));
186
+ }
187
+ /**
188
+ * Mark the detail report of each Conversation as changed, for a write that
189
+ * cannot carry `conversationDetailTouch`. Call it after that write, in the same
190
+ * transaction when there is one. A bump before the write lets a detail read
191
+ * store old content under the new version.
192
+ */
193
+ async function touchConversationDetail(db, conversationIds) {
194
+ if (conversationIds.length === 0) return;
195
+ await bumpDetailVersion(db, conversationIds);
196
+ }
170
197
  // src/chat/conversations/metrics.ts
171
198
  function finite(value) {
172
199
  return value !== void 0 && Number.isFinite(value) && value >= 0 ? value : void 0;
@@ -279,7 +306,8 @@ async function replaceConversationMetrics(executor, args) {
279
306
  'reasoningTokens', ${metric("reasoning_tokens")},
280
307
  'cost', ${cost}
281
308
  ))
282
- end`
309
+ end`,
310
+ detailVersion: nextDetailVersion
283
311
  }).where(eq(juniorConversations.conversationId, args.conversationId));
284
312
  }
285
313
  // src/chat/source.ts
@@ -711,7 +739,10 @@ function visibilityFromLocationRow(row) {
711
739
  /** Store a channel-level Location's first bound post as its thread. */
712
740
  async function startLocationThread(executor, binding) {
713
741
  const location = juniorConversations.location;
714
- await executor.db().update(juniorConversations).set({ location: sql`${location} || jsonb_build_object('threadTs', ${binding.providerConversationId}::text)` }).where(and(eq(juniorConversations.conversationId, binding.conversationId), sql`${location}->>'provider' = ${binding.provider}`, sql`${location}->>'teamId' = ${binding.providerTenantId}`, sql`${location}->>'channelId' = ${binding.providerDestinationId}`, isNull(sql`${location}->>'threadTs'`)));
742
+ await executor.db().update(juniorConversations).set({
743
+ location: sql`${location} || jsonb_build_object('threadTs', ${binding.providerConversationId}::text)`,
744
+ detailVersion: nextDetailVersion
745
+ }).where(and(eq(juniorConversations.conversationId, binding.conversationId), sql`${location}->>'provider' = ${binding.provider}`, sql`${location}->>'teamId' = ${binding.providerTenantId}`, sql`${location}->>'channelId' = ${binding.providerDestinationId}`, isNull(sql`${location}->>'threadTs'`)));
715
746
  }
716
747
  // src/chat/conversations/sql/store.ts
717
748
  const CONVERSATION_MUTATION_LOCK_PREFIX = "junior_conversation";
@@ -974,7 +1005,8 @@ var SqlStore = class {
974
1005
  if (incomingIsFresh) await this.executor.db().update(juniorConversations).set({
975
1006
  metricRunId: args.execution.runId,
976
1007
  executionDurationMs: args.metrics.durationMs,
977
- executionUsage: args.metrics.usage ?? null
1008
+ executionUsage: args.metrics.usage ?? null,
1009
+ detailVersion: nextDetailVersion
978
1010
  }).where(eq(juniorConversations.conversationId, args.conversationId));
979
1011
  }
980
1012
  });
@@ -1096,7 +1128,8 @@ var SqlStore = class {
1096
1128
  runId: sql`case when ${incomingExecutionIsFresh} then excluded.run_id else ${juniorConversations.runId} end`,
1097
1129
  lastCheckpointAt: sql`case when ${incomingExecutionIsFresh} then coalesce(excluded.last_checkpoint_at, ${juniorConversations.lastCheckpointAt}) else ${juniorConversations.lastCheckpointAt} end`,
1098
1130
  lastEnqueuedAt: sql`case when ${incomingExecutionIsFresh} then coalesce(excluded.last_enqueued_at, ${juniorConversations.lastEnqueuedAt}) else ${juniorConversations.lastEnqueuedAt} end`,
1099
- rootConversationId: sql`coalesce(${juniorConversations.rootConversationId}, excluded.root_conversation_id)`
1131
+ rootConversationId: sql`coalesce(${juniorConversations.rootConversationId}, excluded.root_conversation_id)`,
1132
+ detailVersion: nextDetailVersion
1100
1133
  }
1101
1134
  }).returning({
1102
1135
  actorIdentityId: juniorConversations.actorIdentityId,
@@ -1177,7 +1210,8 @@ async function ensureConversationRow(executor, conversationId, atMs, options = {
1177
1210
  set: {
1178
1211
  lastActivityAt: sql`greatest(${juniorConversations.lastActivityAt}, excluded.last_activity_at)`,
1179
1212
  updatedAt: sql`greatest(${juniorConversations.updatedAt}, excluded.updated_at)`,
1180
- transcriptPurgedAt: null
1213
+ transcriptPurgedAt: null,
1214
+ detailVersion: nextDetailVersion
1181
1215
  }
1182
1216
  });
1183
1217
  }
@@ -1413,7 +1447,8 @@ var SqlConversationEventStore = class {
1413
1447
  });
1414
1448
  rows.push(insertFromEvent(conversationId, seq++, historyVersion, event, actorIdentityId));
1415
1449
  }
1416
- await this.executor.db().insert(juniorConversationEvents).values(rows);
1450
+ const db = this.executor.db();
1451
+ await db.with(conversationDetailTouch(db, [conversationId])).insert(juniorConversationEvents).values(rows);
1417
1452
  for (const event of pending) if (event.data.type === "turn_started") await this.recordTurnInputParticipants(conversationId, event.data.inputMessageIds);
1418
1453
  return rows.map((row) => ({
1419
1454
  seq: row.seq,
@@ -1450,7 +1485,8 @@ var SqlConversationEventStore = class {
1450
1485
  };
1451
1486
  await ensureConversationRow(this.executor, conversationId, Date.now());
1452
1487
  const historyVersion = currentHistoryVersion + 1;
1453
- await this.executor.db().insert(juniorConversationEvents).values(insertFromEvent(conversationId, cursor.nextSeq, historyVersion, parsed));
1488
+ const db = this.executor.db();
1489
+ await db.with(conversationDetailTouch(db, [conversationId])).insert(juniorConversationEvents).values(insertFromEvent(conversationId, cursor.nextSeq, historyVersion, parsed));
1454
1490
  return {
1455
1491
  status: "replaced",
1456
1492
  historyVersion
@@ -1554,6 +1590,50 @@ var SqlConversationEventStore = class {
1554
1590
  function createSqlConversationEventStore(executor) {
1555
1591
  return new SqlConversationEventStore(executor);
1556
1592
  }
1593
+ // src/chat/conversations/sql/annotation-filter.ts
1594
+ function annotationKeyMatches(key) {
1595
+ const annotation = key.toLowerCase();
1596
+ return sql`(
1597
+ lower(${juniorConversationAnnotations.key}) = ${annotation}
1598
+ or starts_with(
1599
+ lower(${juniorConversationAnnotations.key}),
1600
+ ${`${annotation}#`}
1601
+ )
1602
+ )`;
1603
+ }
1604
+ /**
1605
+ * Match Conversations that have an Annotation with `key`, or a nested child
1606
+ * key that continues with `#`. Matching ignores case.
1607
+ */
1608
+ function hasAnnotationKey(conversationId, key) {
1609
+ return sql`exists (
1610
+ select 1
1611
+ from ${juniorConversationAnnotations}
1612
+ where ${and(eq(juniorConversationAnnotations.conversationId, conversationId), annotationKeyMatches(key))}
1613
+ )`;
1614
+ }
1615
+ const ANNOTATED_ALIAS = "annotated_conversations";
1616
+ /**
1617
+ * Match root Conversations where any Conversation in the tree has an
1618
+ * Annotation with `key`. Tools write the Annotation on the Conversation that
1619
+ * ran them, which can be a child agent.
1620
+ */
1621
+ function treeHasAnnotationKey(rootConversationId, key) {
1622
+ const annotated = alias(juniorConversations, ANNOTATED_ALIAS);
1623
+ return sql`exists (
1624
+ select 1
1625
+ from ${juniorConversationAnnotations}
1626
+ inner join ${juniorConversations} as ${sql.identifier(ANNOTATED_ALIAS)}
1627
+ on ${annotated.conversationId} = ${juniorConversationAnnotations.conversationId}
1628
+ where ${and(eq(annotated.rootConversationId, rootConversationId), annotationKeyMatches(key))}
1629
+ )`;
1630
+ }
1631
+ /** Return the IDs in `conversationIds` that have an Annotation with `key`. */
1632
+ async function conversationIdsWithAnnotation(db, conversationIds, key) {
1633
+ if (conversationIds.length === 0) return /* @__PURE__ */ new Set();
1634
+ const rows = await db.selectDistinct({ conversationId: juniorConversationAnnotations.conversationId }).from(juniorConversationAnnotations).where(and(inArray(juniorConversationAnnotations.conversationId, [...conversationIds]), annotationKeyMatches(key)));
1635
+ return new Set(rows.map((row) => row.conversationId));
1636
+ }
1557
1637
  // src/chat/conversations/sql/message-search.ts
1558
1638
  const EXCERPT_WITHOUT_QUERY_CHARS = 240;
1559
1639
  var SqlConversationMessageSearchStore = class {
@@ -1585,21 +1665,7 @@ var SqlConversationMessageSearchStore = class {
1585
1665
  if (args.filters.channelId) conditions.push(eq(juniorDestinations.providerDestinationId, args.filters.channelId));
1586
1666
  if (args.filters.afterMs !== void 0 && Number.isFinite(args.filters.afterMs)) conditions.push(gte(juniorConversations.lastActivityAt, new Date(args.filters.afterMs)));
1587
1667
  if (args.filters.beforeMs !== void 0 && Number.isFinite(args.filters.beforeMs)) conditions.push(lt(juniorConversations.lastActivityAt, new Date(args.filters.beforeMs)));
1588
- if (args.filters.annotation) {
1589
- const annotation = args.filters.annotation.toLowerCase();
1590
- const nestedAnnotationPrefix = `${annotation}#`;
1591
- conditions.push(sql`exists (
1592
- select 1
1593
- from ${juniorConversationAnnotations}
1594
- where ${and(eq(juniorConversationAnnotations.conversationId, juniorConversations.conversationId), sql`(
1595
- lower(${juniorConversationAnnotations.key}) = ${annotation}
1596
- or starts_with(
1597
- lower(${juniorConversationAnnotations.key}),
1598
- ${nestedAnnotationPrefix}
1599
- )
1600
- )`)}
1601
- )`);
1602
- }
1668
+ if (args.filters.annotation) conditions.push(hasAnnotationKey(juniorConversations.conversationId, args.filters.annotation));
1603
1669
  const bestPerConversation = db.selectDistinctOn([juniorConversations.conversationId], {
1604
1670
  channelName: juniorDestinations.displayName,
1605
1671
  conversationId: juniorConversations.conversationId,
@@ -1990,4 +2056,4 @@ async function readIdentityByIdFromSql(db, identityId) {
1990
2056
  async function readIdentityById(identityId) {
1991
2057
  return await readIdentityByIdFromSql(getDb(), identityId);
1992
2058
  }
1993
- export { sameDestination as $, locationFromRow as A, saveUserTimezone as B, getSqlExecutor as C, loadConversationSlackTenantIds as D, withConversationEventLock as E, deleteProviderIdentityForSlackUser as F, agentTurnCostUsd as G, bindProviderConversation as H, deleteProviderIdentityForUser as I, hasAgentTurnUsage as J, agentTurnTotalTokens as K, findUserByVerifiedEmails as L, SYSTEM_IDENTITY_ID as M, resolveActorIdentityId as N, createSqlStore as O, saveActorAvatar as P, requireSlackDestination as Q, readUserTimezone as R, getDb as S, eventFromRow as T, parseSessionSource as U, upsertLinkedIdentity as V, addAgentTurnUsage as W, createSlackDestination as X, resolveRootConversationId as Y, parseDestination as Z, closeDb as _, readActorIdentityFromSql as a, getConversationMessageSearchStore as b, readViewerAvatarUrl as c, updateViewerDisplayName as d, identityAvatarUrl as f, createCache as g, readUserAvatarUrls as h, readActorIdentity as i, startLocationThread as j, withConversationMutationLock as k, resolveViewerUser as l, readAvatarImage as m, findUserByEmailFromSql as n, readIdentityById as o, parseAvatarUrl as p, agentTurnUsageSchema as q, listAdminUsersFromSql as r, readIdentityByIdFromSql as s, findUserByEmail as t, setUserAdminFromSql as u, db_exports as v, createSqlConversationEventStore as w, getConversationStore as x, getConversationEventStore as y, recordGoogleSignIn as z };
2059
+ export { agentTurnUsageSchema as $, loadConversationSlackTenantIds as A, findUserByVerifiedEmails as B, getSqlExecutor as C, createSqlConversationEventStore as D, treeHasAnnotationKey as E, SYSTEM_IDENTITY_ID as F, bindProviderConversation as G, recordGoogleSignIn as H, resolveActorIdentityId as I, nextDetailVersion as J, parseSessionSource as K, saveActorAvatar as L, withConversationMutationLock as M, locationFromRow as N, eventFromRow as O, startLocationThread as P, agentTurnTotalTokens as Q, deleteProviderIdentityForSlackUser as R, getDb as S, hasAnnotationKey as T, saveUserTimezone as U, readUserTimezone as V, upsertLinkedIdentity as W, addAgentTurnUsage as X, touchConversationDetail as Y, agentTurnCostUsd as Z, closeDb as _, readActorIdentityFromSql as a, sameDestination as at, getConversationMessageSearchStore as b, readViewerAvatarUrl as c, updateViewerDisplayName as d, hasAgentTurnUsage as et, identityAvatarUrl as f, createCache as g, readUserAvatarUrls as h, readActorIdentity as i, requireSlackDestination as it, createSqlStore as j, withConversationEventLock as k, resolveViewerUser as l, readAvatarImage as m, findUserByEmailFromSql as n, createSlackDestination as nt, readIdentityById as o, parseAvatarUrl as p, conversationDetailTouch as q, listAdminUsersFromSql as r, parseDestination as rt, readIdentityByIdFromSql as s, findUserByEmail as t, resolveRootConversationId as tt, setUserAdminFromSql as u, db_exports as v, conversationIdsWithAnnotation as w, getConversationStore as x, getConversationEventStore as y, deleteProviderIdentityForUser as z };
@@ -1,14 +1,14 @@
1
- import { G as AuthorizationFlowDisabledError, V as PluginCredentialFailureError, Wa as loadForkHistory, Wt as isTurnExecutionLimitExceededError, Yt as getTerminalAssistantMessages, et as saveTurnCheckpoint, it as getTurnRecord, l as openConversationProjection, rt as failTurnRecord, tt as abandonTurnRecord } from "./projection-6dXaN0n-.js";
2
- import { n as botConfig } from "./config-Cb--cuv-.js";
3
- import { M as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-CQwBszc7.js";
4
- import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-DstkkoNP.js";
5
- import { At as withoutSavedSteeringMessages, It as readBlockedReport, St as recordSubagentStarted, kt as buildSteeringPiMessage, xt as recordSubagentEnded, yt as stopChildAgentsOf } from "./agent-runner-sMpA5qGM.js";
6
- import { B as agentTypeInstructions, C as markAgentInvocationMailboxAppended, D as markAgentInvocationSteered, E as markAgentInvocationRunning, G as TurnInputCommitLostError, T as markAgentInvocationPaused, V as agentTypeStartsWithParentHistory, Y as isTurnInputCommitLostError, _ as getLatestAgentInvocationForConversation, b as listAgentInvocationsForConversation, c as getAgentInvocation, f as getAgentInvocationMessageId, i as createAgentInvocation, k as reportReplacedAgentInvocation, m as getAgentInvocationTurnId, n as NON_TERMINAL_AGENT_INVOCATION_STATUSES, q as getConversationTurnBoundaryError, r as completeAgentInvocation, s as getActiveAgentInvocationForConversation, t as ACTIVE_AGENT_INVOCATION_STATUSES, y as isTerminalAgentInvocation } from "./store-C5uVTx2G.js";
7
- import { n as getAssistantReplyText } from "./assistant-reply-DbxKnBQF.js";
8
- import { E as maybePostAutomatedTurnLimitNotice, M as recordFinishedTurnForAutomatedLimit, N as resetAutomatedTurnLimit } from "./session-stop-DK8LuPZW.js";
9
- import { r as appendAndEnqueueInboundMessage } from "./store-BgH2P3X9.js";
10
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-CF6ibonp.js";
11
- import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-BXjgk1pW.js";
1
+ import { H as AuthorizationFlowDisabledError, Ja as loadForkHistory, Kt as getTerminalAssistantMessages, Q as abandonTurnRecord, R as PluginCredentialFailureError, Vt as isTurnExecutionLimitExceededError, Z as saveTurnCheckpoint, et as failTurnRecord, s as openConversationProjection, tt as getTurnRecord } from "./projection-BTge9wrH.js";
2
+ import { n as botConfig } from "./config-o2jLRY5J.js";
3
+ import { F as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-DLXajQZE.js";
4
+ import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-DTAA8Qs_.js";
5
+ import { At as withoutSavedSteeringMessages, It as readBlockedReport, St as recordSubagentStarted, kt as buildSteeringPiMessage, xt as recordSubagentEnded, yt as stopChildAgentsOf } from "./agent-runner-DE-43MPb.js";
6
+ import { B as agentTypeInstructions, C as markAgentInvocationMailboxAppended, D as markAgentInvocationSteered, E as markAgentInvocationRunning, G as TurnInputCommitLostError, T as markAgentInvocationPaused, V as agentTypeStartsWithParentHistory, Y as isTurnInputCommitLostError, _ as getLatestAgentInvocationForConversation, b as listAgentInvocationsForConversation, c as getAgentInvocation, f as getAgentInvocationMessageId, i as createAgentInvocation, k as reportReplacedAgentInvocation, m as getAgentInvocationTurnId, n as NON_TERMINAL_AGENT_INVOCATION_STATUSES, q as getConversationTurnBoundaryError, r as completeAgentInvocation, s as getActiveAgentInvocationForConversation, t as ACTIVE_AGENT_INVOCATION_STATUSES, y as isTerminalAgentInvocation } from "./store-BGBzQWNf.js";
7
+ import { n as getAssistantReplyText } from "./assistant-reply-pauL6qyn.js";
8
+ import { E as maybePostAutomatedTurnLimitNotice, M as recordFinishedTurnForAutomatedLimit, N as resetAutomatedTurnLimit } from "./session-stop-BsS4qFS2.js";
9
+ import { r as appendAndEnqueueInboundMessage } from "./store-CGJZTEVz.js";
10
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-Bo4Trccw.js";
11
+ import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-BSu6rM6p.js";
12
12
  import { isDeepStrictEqual } from "node:util";
13
13
  import { z } from "zod";
14
14
  // src/chat/runtime/turn-execution.ts
@@ -64,12 +64,7 @@ const agentInvocationMailboxMetadataSchema = z.object({
64
64
  /** Map a durable invocation's model settings and depth to the child Run policy. */
65
65
  function agentInvocationRunPolicy(invocation, canSpawn) {
66
66
  return {
67
- disabledFeatures: canSpawn ? ["handoff", "interactive-auth"] : [
68
- "handoff",
69
- "interactive-auth",
70
- "subagents"
71
- ],
72
- ...invocation.modelProfile ? { modelProfile: invocation.modelProfile } : void 0,
67
+ disabledFeatures: canSpawn ? ["interactive-auth"] : ["interactive-auth", "subagents"],
73
68
  ...invocation.reasoningLevel ? { reasoning: invocation.reasoningLevel } : void 0
74
69
  };
75
70
  }
@@ -1,10 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { Ct as hasConversationStop, Et as isInvalidConversationRecordError, Tt as isFinalAttempt } from "./projection-6dXaN0n-.js";
3
- import { b as isProviderRetryError } from "./client-7diKvInp.js";
4
- import { i as getChatConfig } from "./config-Cb--cuv-.js";
5
- import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-B04X_eCB.js";
6
- import { g as getTurnRequestDeadline, v as ConversationQueueMessageRejectedError } from "./background-compaction-queue-Bywqo1WJ.js";
7
- import { C as requestAnotherSlice, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-BgH2P3X9.js";
2
+ import { Ct as isInvalidConversationRecordError, St as isFinalAttempt, bt as hasConversationStop } from "./projection-BTge9wrH.js";
3
+ import { b as isProviderRetryError } from "./client-v_OVYuHZ.js";
4
+ import { i as getChatConfig } from "./config-o2jLRY5J.js";
5
+ import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-dFaXvBRK.js";
6
+ import { g as getTurnRequestDeadline, v as ConversationQueueMessageRejectedError } from "./background-compaction-queue-CAL4A2y7.js";
7
+ import { C as requestAnotherSlice, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-CGJZTEVz.js";
8
8
  // src/chat/task-execution/attempt-selection.ts
9
9
  function selectContiguousTurnBatch(messages) {
10
10
  const first = messages[0];
@@ -0,0 +1 @@
1
+ ALTER TABLE "junior_conversation_participants" ADD COLUMN "pinned_at" timestamp with time zone;
@@ -0,0 +1 @@
1
+ ALTER TABLE "junior_conversations" ADD COLUMN "detail_version" integer DEFAULT 0 NOT NULL;
@@ -0,0 +1,5 @@
1
+ ALTER TABLE "junior_conversation_participants" ADD COLUMN "auto_archive" boolean;--> statement-breakpoint
2
+ ALTER TABLE "junior_users" ADD COLUMN "auto_archive_default" boolean DEFAULT false NOT NULL;--> statement-breakpoint
3
+ ALTER TABLE "junior_users" ADD COLUMN "auto_archive_grace_hours" integer DEFAULT 24 NOT NULL;--> statement-breakpoint
4
+ CREATE INDEX "junior_conversation_participants_auto_archive_idx" ON "junior_conversation_participants" USING btree ("user_id") WHERE "junior_conversation_participants"."auto_archive" and "junior_conversation_participants"."archived_at" is null;--> statement-breakpoint
5
+ CREATE INDEX "junior_conversation_participants_unarchived_activity_idx" ON "junior_conversation_participants" USING btree ("user_id","last_message_at","root_conversation_id") WHERE "junior_conversation_participants"."archived_at" is null;