@sentry/junior 0.299.0 → 0.300.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 (78) hide show
  1. package/dist/{adapter-AgCNqqsG.js → adapter-S5UkjNK3.js} +5 -4
  2. package/dist/{admin-1VwEXztm.js → admin-UrTniSPO.js} +2 -2
  3. package/dist/{agent-runner-Ciet8_nn.js → agent-runner-bY4_0UPm.js} +508 -203
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +6 -7
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +293 -61
  8. package/dist/{app--ky-Eu33.d.ts → app-D-AcIcCV.d.ts} +13 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +57 -219
  11. package/dist/{automation-M3RFJUBf.js → automation-Dw82oQ-h.js} +2 -2
  12. package/dist/{background-compaction-queue-CnimvRdk.js → background-compaction-queue-B6U3060-.js} +8 -4
  13. package/dist/{briefs-CwzvgdCa.js → briefs-DqiwWu-n.js} +3 -3
  14. package/dist/{catalog-runtime-DaBaHY7u.js → catalog-runtime-D1oYNv04.js} +1 -1
  15. package/dist/cli/chat.js +16 -16
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.js +5 -5
  19. package/dist/cli/snapshot-create.js +4 -4
  20. package/dist/cli/upgrade.d.ts +1 -1
  21. package/dist/cli/upgrade.js +4 -4
  22. package/dist/{config-CAXIpWQb.js → config-9nHoFiJP.js} +39 -8
  23. package/dist/{connections-Dy0hPdUq.js → connections-DZjTN3JC.js} +6 -6
  24. package/dist/{continue-in-slack-DIOjFj76.js → continue-in-slack-Dtv7_U42.js} +6 -6
  25. package/dist/{conversation-fCWD9Az3.js → conversation-Dyjq2CZ8.js} +19 -8
  26. package/dist/{conversation-feed-BPK8vkkZ.js → conversation-feed-CcDxlrlQ.js} +23 -2
  27. package/dist/{conversation-privacy-DUgtRkf8.js → conversation-privacy-D-5HTXjS.js} +1 -1
  28. package/dist/{conversation-turn-DkJB6yMF.js → conversation-turn-Cxl8WZD7.js} +17 -17
  29. package/dist/{credential-sync-RX24Y8aY.js → credential-sync-C49ClwDX.js} +15 -15
  30. package/dist/{db-B07FtU9g.d.ts → db-2resqBh1.d.ts} +1 -1
  31. package/dist/{db-COYOGzYS.js → db-BJNo6fK5.js} +13 -8
  32. package/dist/{executor-BWmAgSyi.js → executor-DBIaOeJ_.js} +9 -4
  33. package/dist/instrumentation.js +14 -5
  34. package/dist/{lineage-D-5jm_oj.js → lineage-0dereG7H.js} +2 -2
  35. package/dist/{logging-DPLEa8Bn.js → logging-BIclibct.js} +1 -1
  36. package/dist/{message-BIHR1yRk.js → message-dkOl-Iii.js} +8 -8
  37. package/dist/{model-input-BPZYH8Nd.js → model-input-CLo9TaUd.js} +4 -4
  38. package/dist/nitro.d.ts +1 -1
  39. package/dist/nitro.js +4 -4
  40. package/dist/{oauth-callback-server-R7qvSzFG.js → oauth-callback-server-WmpjfJgQ.js} +2 -2
  41. package/dist/{plugins-CBW2Prb_.js → plugins-BBX07Jzt.js} +1 -1
  42. package/dist/{projection-DEdP1q6f.js → projection-w_X-zi7v.js} +3742 -3624
  43. package/dist/{prompt-4M98h_tC.js → prompt-B1Xw46-S.js} +4 -4
  44. package/dist/{registry-BTKmKM-r.js → registry-BmP5vnlj.js} +2 -2
  45. package/dist/{resolve-B8hXNVZ3.js → resolve-goo34bJK.js} +3 -3
  46. package/dist/{result-g-XAaOj6.js → result-PVBeU0Wf.js} +9 -9
  47. package/dist/{runner-BlPSA5A8.js → runner-DKrfvNV6.js} +9 -9
  48. package/dist/{sandbox-egress-signals-Pai-MzEY.js → sandbox-egress-signals-DsUcqrI0.js} +1 -1
  49. package/dist/{schema-BNnY_trV.js → schema-C9iNFz5n.js} +20 -16
  50. package/dist/{schema-DbuWR-DN.d.ts → schema-Dns-sTas.d.ts} +219 -6
  51. package/dist/{service-account-BYGZ08DQ.js → service-account-CMAAloAL.js} +3 -3
  52. package/dist/{service-account-9OLNQMyz.js → service-account-CmowamcB.js} +4 -4
  53. package/dist/{session-stop-2XJrcNCy.js → session-stop-BcAXze8a.js} +15 -41
  54. package/dist/{skills-DpBQoeHV.js → skills-DfsazET6.js} +2 -2
  55. package/dist/{slack-conversation-unfurl-BcDIWo67.js → slack-conversation-unfurl-CzQonuWz.js} +7 -7
  56. package/dist/{spawn-09GssFod.js → spawn-C7o0FDDp.js} +6 -6
  57. package/dist/{state-Cufq0_rH.js → state-zSilNpbi.js} +2 -2
  58. package/dist/{statuses-B8mUfghF.js → statuses-Hn-HsOph.js} +86 -2
  59. package/dist/{stop-U7iUrR1g.js → stop-CFOujp8C.js} +2938 -76
  60. package/dist/{store-CSgUTMdv.js → store-Dkeis_8o.js} +9 -9
  61. package/dist/{store-BHiaHCQu.js → store-E3x2Fg_F.js} +5 -5
  62. package/dist/{task-queue-bMNq0clp.js → task-queue-D-hCqdZW.js} +3 -3
  63. package/dist/{task-runner-B__rxwxU.js → task-runner-vohUPLHe.js} +8 -8
  64. package/dist/{thread-context-d0ceWbVT.js → thread-context-BzvdkgI9.js} +8 -8
  65. package/dist/{turn-session-routing-BVZHBFCF.js → turn-session-routing-Bo_LxFum.js} +5 -5
  66. package/dist/{turn-user-message-BEw7acTP.js → turn-user-message-D5RnVmxQ.js} +3 -3
  67. package/dist/{users-BK3dbxZL.js → users-2bggndVg.js} +3 -3
  68. package/dist/{validation-BDVJjO2E.js → validation-BbWikeSa.js} +1 -1
  69. package/dist/{version-DQgZoQ3D.js → version-GVBMW2jA.js} +1 -1
  70. package/dist/version.js +1 -1
  71. package/dist/{viewer-CAWfFo29.js → viewer-BpxRliyO.js} +16 -114
  72. package/dist/{warmup-9ySPacF9.js → warmup-BW2qwnal.js} +18 -16
  73. package/dist/{worker-D8jJO-WO.js → worker-Cbd-iuwZ.js} +24 -20
  74. package/migrations/0107_attachment_deferred_download.sql +2 -0
  75. package/migrations/meta/0107_snapshot.json +4617 -0
  76. package/migrations/meta/_journal.json +7 -0
  77. package/package.json +10 -8
  78. package/dist/media-BAHvgkok.js +0 -85
@@ -1,12 +1,12 @@
1
- import { Di as JUNIOR_THREAD_STATE_TTL_MS, Pi as getDashboardTaskLink, da as escapeSlackMrkdwnText, do as ToolInputError, fa as formatSlackLink, w as fallbackShortTitle, wa as postSlackMessage, xa as openSlackDirectMessage } from "./projection-DEdP1q6f.js";
2
- import { n as botConfig } from "./config-CAXIpWQb.js";
3
- import { _ as runBestEffort, h as logWarn } from "./logging-DPLEa8Bn.js";
4
- import { X as agentTurnTotalTokens, Y as agentTurnCostUsd, o as getDb } from "./db-COYOGzYS.js";
5
- import { d as juniorAutomationVersions, f as juniorAutomations, j as juniorConversations, u as juniorAutomationRuns } from "./executor-BWmAgSyi.js";
6
- import { r as getStateAdapter } from "./adapter-AgCNqqsG.js";
7
- import { h as credentialSubjectSchema } from "./registry-BTKmKM-r.js";
8
- import { u as automationEventCatalog, v as registeredEventTriggerProblems } from "./turn-session-routing-BVZHBFCF.js";
9
- import { B as automationTaskColumns, H as automationTaskSchema, M as scheduledAutomationSchema, S as automationVersionSchema, V as automationTaskDescription, k as eventAutomationSchema, z as automationSkillNameSchema } from "./automation-M3RFJUBf.js";
1
+ import { Di as JUNIOR_THREAD_STATE_TTL_MS, Pi as getDashboardTaskLink, Qa as ToolInputError, Sa as openSlackDirectMessage, Ta as postSlackMessage, fa as escapeSlackMrkdwnText, pa as formatSlackLink, w as fallbackShortTitle } from "./projection-w_X-zi7v.js";
2
+ import { n as botConfig } from "./config-9nHoFiJP.js";
3
+ import { _ as runBestEffort, h as logWarn } from "./logging-BIclibct.js";
4
+ import { X as agentTurnTotalTokens, Y as agentTurnCostUsd, o as getDb } from "./db-BJNo6fK5.js";
5
+ import { d as juniorAutomationVersions, f as juniorAutomations, j as juniorConversations, u as juniorAutomationRuns } from "./executor-DBIaOeJ_.js";
6
+ import { r as getStateAdapter } from "./adapter-S5UkjNK3.js";
7
+ import { h as credentialSubjectSchema } from "./registry-BmP5vnlj.js";
8
+ import { u as automationEventCatalog, v as registeredEventTriggerProblems } from "./turn-session-routing-Bo_LxFum.js";
9
+ import { B as automationTaskColumns, H as automationTaskSchema, M as scheduledAutomationSchema, S as automationVersionSchema, V as automationTaskDescription, k as eventAutomationSchema, z as automationSkillNameSchema } from "./automation-Dw82oQ-h.js";
10
10
  import * as z from "zod";
11
11
  import { createHash } from "node:crypto";
12
12
  import { and, asc, count, desc, eq, gte, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
@@ -1,7 +1,7 @@
1
- import { At as getConversationWorkStates$1, Bt as recordConversationRetry$1, Dt as dropPendingMessages$1, Et as drainConversationMailbox$1, Ft as listActiveConversationIds$1, Gt as startConversationWork$1, Ht as releaseInboundMessage, It as markConversationWorkEnqueued$1, Jt as takeDeferredConversationMove, Kt as steerWebPendingMessages$1, Mt as hasRunnableConversationWork, Ot as getConversation$1, St as completeConversationWork$1, Ut as requestAnotherSlice$1, Vt as releaseConversationWork$1, Wt as requestConversationWork$1, _t as checkInConversationWork$1, bt as clearExpiredConversationLease$1, ft as ackMessages$1, gt as cancelHumanFacingPendingMessages$1, ht as beginConversationResume$1, kt as getConversationWorkState$1, mt as appendInboundMessage, pt as appendExclusiveInboundMessage, qt as stopConversationWork$1, vt as claimInboundMessage$1, wt as deadLetterAttempt$1, xt as completeConversationStop$1, yt as clearConsumedConversationWake$1, zt as recordAttemptFailure$1 } from "./projection-DEdP1q6f.js";
2
- import { p as logException } from "./logging-DPLEa8Bn.js";
3
- import { a as getConversationStore } from "./db-COYOGzYS.js";
4
- import "./background-compaction-queue-CnimvRdk.js";
1
+ import { At as getConversationWorkStates$1, Bt as recordConversationRetry$1, Dt as dropPendingMessages$1, Et as drainConversationMailbox$1, Ft as listActiveConversationIds$1, Gt as startConversationWork$1, Ht as releaseInboundMessage, It as markConversationWorkEnqueued$1, Jt as takeDeferredConversationMove, Kt as steerWebPendingMessages$1, Mt as hasRunnableConversationWork, Ot as getConversation$1, St as completeConversationWork$1, Ut as requestAnotherSlice$1, Vt as releaseConversationWork$1, Wt as requestConversationWork$1, _t as checkInConversationWork$1, bt as clearExpiredConversationLease$1, ft as ackMessages$1, gt as cancelHumanFacingPendingMessages$1, ht as beginConversationResume$1, kt as getConversationWorkState$1, mt as appendInboundMessage, pt as appendExclusiveInboundMessage, qt as stopConversationWork$1, vt as claimInboundMessage$1, wt as deadLetterAttempt$1, xt as completeConversationStop$1, yt as clearConsumedConversationWake$1, zt as recordAttemptFailure$1 } from "./projection-w_X-zi7v.js";
2
+ import { p as logException } from "./logging-BIclibct.js";
3
+ import { a as getConversationStore } from "./db-BJNo6fK5.js";
4
+ import "./background-compaction-queue-B6U3060-.js";
5
5
  // src/chat/task-execution/store.ts
6
6
  function metadataStore(options) {
7
7
  return options.conversationStore ?? getConversationStore();
@@ -304,7 +304,7 @@ async function runDeferredMove(args) {
304
304
  const move = await takeDeferredConversationMove(args);
305
305
  if (move === void 0) return;
306
306
  try {
307
- const { continueDeferredSlackClick } = await import("./slack-conversation-unfurl-BcDIWo67.js").then((n) => n.r);
307
+ const { continueDeferredSlackClick } = await import("./slack-conversation-unfurl-CzQonuWz.js").then((n) => n.r);
308
308
  await continueDeferredSlackClick(move, args.getSlackAdapter);
309
309
  } catch (error) {
310
310
  logException(error, "slack.continue_here.deferred.failed", { "gen_ai.conversation.id": args.conversationId });
@@ -1,5 +1,5 @@
1
- import { h as logWarn } from "./logging-DPLEa8Bn.js";
2
- import { C as queueCallback, S as verifyQueueMessage, T as getQueueProvider, b as QUEUE_SIGNATURE_MAX_AGE_MS, x as signQueueMessage } from "./background-compaction-queue-CnimvRdk.js";
1
+ import { h as logWarn } from "./logging-BIclibct.js";
2
+ import { C as verifyQueueMessage, E as getQueueProvider, S as signQueueMessage, w as queueCallback, x as QUEUE_SIGNATURE_MAX_AGE_MS } from "./background-compaction-queue-B6U3060-.js";
3
3
  import * as z from "zod";
4
4
  import { createHash } from "node:crypto";
5
5
  // src/chat/plugins/task-queue.ts
@@ -60,7 +60,7 @@ function pluginTaskCallback() {
60
60
  maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
61
61
  onRejected: logPluginTaskQueueMessageRejected,
62
62
  run: async (message) => {
63
- const { processPluginTask } = await import("./task-runner-B__rxwxU.js").then((n) => n.r);
63
+ const { processPluginTask } = await import("./task-runner-vohUPLHe.js").then((n) => n.r);
64
64
  await processPluginTask(message);
65
65
  },
66
66
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -1,14 +1,14 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Dn as instructionTextForProjection, Do as createPluginModelCostRecorder, In as stripRuntimeTurnContext, Mn as isToolResultMessage, Oo as createPluginLogger, Pn as normalizeToolNameFromResult, Ri as createPluginState, Sn as getPiMessageRole, dr as getPlugins, ho as createPluginModel, jn as isToolResultError, mo as createPluginEmbedder, mr as coreTaskRegistrations, ps as createPluginCache, st as getTurnRecord, v as hydrateConversationMessages, zo as createPluginConversationEvents } from "./projection-DEdP1q6f.js";
3
- import { E as withSpan } from "./logging-DPLEa8Bn.js";
2
+ import { Dn as instructionTextForProjection, Eo as createPluginConversationEvents, In as stripRuntimeTurnContext, Mn as isToolResultMessage, Pn as normalizeToolNameFromResult, Sn as getPiMessageRole, _s as createPluginCache, dr as getPlugins, ho as createPluginLogger, jn as isToolResultError, mo as createPluginModelCostRecorder, mr as coreTaskRegistrations, no as createPluginModel, st as getTurnRecord, to as createPluginEmbedder, v as hydrateConversationMessages, zi as createPluginState } from "./projection-w_X-zi7v.js";
3
+ import { E as withSpan } from "./logging-BIclibct.js";
4
4
  import { v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
5
- import { a as getConversationStore, o as getDb } from "./db-COYOGzYS.js";
5
+ import { a as getConversationStore, o as getDb } from "./db-BJNo6fK5.js";
6
6
  import { m as sameActorIdentity } from "./history-IjdmO_r6.js";
7
- import { r as getStateAdapter } from "./adapter-AgCNqqsG.js";
8
- import { i as readActorIdentity } from "./viewer-CAWfFo29.js";
9
- import { a as getPersistedThreadState, c as coerceThreadConversationState, t as resolveConversationRouting } from "./turn-session-routing-BVZHBFCF.js";
10
- import { c as getDispatchRecord } from "./store-CSgUTMdv.js";
11
- import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-bMNq0clp.js";
7
+ import { r as getStateAdapter } from "./adapter-S5UkjNK3.js";
8
+ import { i as readActorIdentity } from "./viewer-BpxRliyO.js";
9
+ import { a as getPersistedThreadState, c as coerceThreadConversationState, t as resolveConversationRouting } from "./turn-session-routing-Bo_LxFum.js";
10
+ import { c as getDispatchRecord } from "./store-Dkeis_8o.js";
11
+ import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-D-hCqdZW.js";
12
12
  import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
13
13
  // src/chat/plugins/task-runner.ts
14
14
  /**
@@ -1,11 +1,11 @@
1
- import { E as buildConversationContext, X as clearPendingAuth, as as listConversationAnnotations, j as markConversationMessage, v as hydrateConversationMessages } from "./projection-DEdP1q6f.js";
2
- import { H as findProviderError, U as getProviderErrorAttributes, W as getProviderErrorUserMessage, z as ProviderError } from "./config-CAXIpWQb.js";
3
- import { G as isRecord, b as setSpanAttributes, t as buildTurnFailureResponse } from "./logging-DPLEa8Bn.js";
4
- import { o as getDb, r as getConversationEventStore } from "./db-COYOGzYS.js";
5
- import { H as removedCardSchema, U as resolveMessageCards, V as readMessageCardRefs } from "./conversation-fCWD9Az3.js";
6
- import { S as listChildMessages, m as markTurnCompleted, n as getTurnUserMessageId, p as markTurnClosed, x as isAgentInvocationResult } from "./turn-user-message-BEw7acTP.js";
7
- import { _ as getConversationWorkState } from "./store-BHiaHCQu.js";
8
- import { a as getPersistedThreadState, c as coerceThreadConversationState, s as persistThreadStateById } from "./turn-session-routing-BVZHBFCF.js";
1
+ import { E as buildConversationContext, X as clearPendingAuth, j as markConversationMessage, ls as listConversationAnnotations, v as hydrateConversationMessages } from "./projection-w_X-zi7v.js";
2
+ import { B as ProviderError, G as getProviderErrorUserMessage, U as findProviderError, W as getProviderErrorAttributes } from "./config-9nHoFiJP.js";
3
+ import { G as isRecord, b as setSpanAttributes, t as buildTurnFailureResponse } from "./logging-BIclibct.js";
4
+ import { o as getDb, r as getConversationEventStore } from "./db-BJNo6fK5.js";
5
+ import { H as readMessageCardRefs, U as removedCardSchema, W as resolveMessageCards } from "./conversation-Dyjq2CZ8.js";
6
+ import { S as listChildMessages, m as markTurnCompleted, n as getTurnUserMessageId, p as markTurnClosed, x as isAgentInvocationResult } from "./turn-user-message-D5RnVmxQ.js";
7
+ import { _ as getConversationWorkState } from "./store-E3x2Fg_F.js";
8
+ import { a as getPersistedThreadState, c as coerceThreadConversationState, s as persistThreadStateById } from "./turn-session-routing-Bo_LxFum.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,7 +1,7 @@
1
- import { Di as JUNIOR_THREAD_STATE_TTL_MS, b as persistConversationMessages, do as ToolInputError, ms as createDurableLocationConfigurationService } from "./projection-DEdP1q6f.js";
2
- import { G as isRecord, K as toOptionalNumber, q as toOptionalString } from "./logging-DPLEa8Bn.js";
3
- import { o as getDb } from "./db-COYOGzYS.js";
4
- import { r as getStateAdapter } from "./adapter-AgCNqqsG.js";
1
+ import { Di as JUNIOR_THREAD_STATE_TTL_MS, Qa as ToolInputError, b as persistConversationMessages, vs as createDurableLocationConfigurationService } from "./projection-w_X-zi7v.js";
2
+ import { G as isRecord, K as toOptionalNumber, q as toOptionalString } from "./logging-BIclibct.js";
3
+ import { o as getDb } from "./db-BJNo6fK5.js";
4
+ import { r as getStateAdapter } from "./adapter-S5UkjNK3.js";
5
5
  import * as z from "zod";
6
6
  import { agentEventMatchSchema, anyResourceMatchFields, describeEventTrigger, eventTriggerChoices, eventTriggerProblems, normalizeEventIdentifier, normalizeEventMatch } from "@sentry/junior-plugin-api";
7
7
  // src/chat/events/catalog.ts
@@ -338,7 +338,7 @@ function slackSourceForDestination(args) {
338
338
  * Reads parent Conversations when this Conversation has no Destination.
339
339
  */
340
340
  async function resolveConversationRouting(args) {
341
- const conversationStore = args.conversationStore ?? (await import("./db-COYOGzYS.js").then((n) => n.n)).getConversationStore();
341
+ const conversationStore = args.conversationStore ?? (await import("./db-BJNo6fK5.js").then((n) => n.n)).getConversationStore();
342
342
  const chain = await loadConversationChain(args.conversationId, conversationStore);
343
343
  let destination;
344
344
  let source;
@@ -1,7 +1,7 @@
1
- import { Yt as readInboundMessageSender } from "./projection-DEdP1q6f.js";
1
+ import { Yt as readInboundMessageSender } from "./projection-w_X-zi7v.js";
2
2
  import { v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
3
- import { r as getConversationEventStore, s as getSqlExecutor } from "./db-COYOGzYS.js";
4
- import { g as juniorAgentInvocations } from "./executor-BWmAgSyi.js";
3
+ import { r as getConversationEventStore, s as getSqlExecutor } from "./db-BJNo6fK5.js";
4
+ import { g as juniorAgentInvocations } from "./executor-DBIaOeJ_.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { inArray } from "drizzle-orm";
7
7
  // src/chat/state/turn-id.ts
@@ -1,6 +1,6 @@
1
- import { Ba as runWithSlackInstallationToken, Fa as getSlackClient, Va as withSlackRetries, ja as SlackActionError } from "./projection-DEdP1q6f.js";
2
- import { a as getConversationStore } from "./db-COYOGzYS.js";
3
- import { r as getStateAdapter } from "./adapter-AgCNqqsG.js";
1
+ import { $o as runWithSlackInstallationToken, Jo as getSlackClient, Wo as SlackActionError, ts as withSlackRetries } from "./projection-w_X-zi7v.js";
2
+ import { a as getConversationStore } from "./db-BJNo6fK5.js";
3
+ import { r as getStateAdapter } from "./adapter-S5UkjNK3.js";
4
4
  import * as z from "zod";
5
5
  // src/chat/slack/channel.ts
6
6
  const replySubtypeSchema = z.object({ subtype: z.string().optional() });
@@ -1,5 +1,5 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DaBaHY7u.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-D1oYNv04.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.299.0";
2
+ var version = "0.300.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-DQgZoQ3D.js";
1
+ export { t as JUNIOR_VERSION } from "./version-GVBMW2jA.js";
@@ -1,27 +1,21 @@
1
- import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-DPLEa8Bn.js";
2
- import { H as clearCachedUser, M as findActorIdentityId, U as readCachedUserByEmail, W as createCache, o as getDb } from "./db-COYOGzYS.js";
3
- import { M as juniorIdentities, N as juniorUsers } from "./executor-BWmAgSyi.js";
4
- import { r as detectImageMediaType } from "./media-BAHvgkok.js";
1
+ import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail } from "./logging-BIclibct.js";
2
+ import { H as clearCachedUser, M as findActorIdentityId, U as readCachedUserByEmail, o as getDb } from "./db-BJNo6fK5.js";
3
+ import { M as juniorIdentities, N as juniorUsers } from "./executor-DBIaOeJ_.js";
5
4
  import { createHash, randomUUID } from "node:crypto";
6
5
  import { and, asc, eq, inArray, isNotNull } from "drizzle-orm";
7
6
  import { identitySchema, userSchema } from "@sentry/junior-plugin-api";
8
7
  // src/chat/identities/avatar.ts
9
8
  /**
10
9
  * Profile photos of people, saved on their native Slack and Google
11
- * identities. Junior serves each photo from its own API, so browsers never
12
- * load a photo from Slack or Google.
10
+ * identities. `/api/people/avatars/:identityId` serves each photo through
11
+ * the shared image route code, so browsers never load a photo from Slack or
12
+ * Google.
13
13
  */
14
14
  const AVATAR_HOSTS = {
15
15
  slack: ["avatars.slack-edge.com"],
16
16
  [GOOGLE_IDENTITY_PROVIDER]: ["googleusercontent.com"]
17
17
  };
18
18
  const AVATAR_PROVIDERS = Object.keys(AVATAR_HOSTS);
19
- const AVATAR_CACHE_TTL_MS = 864e5;
20
- const AVATAR_FAILURE_TTL_MS = 3e5;
21
- const AVATAR_FETCH_TIMEOUT_MS = 5e3;
22
- const MAX_AVATAR_BYTES = 1048576;
23
- const AVATAR_EDGE_PX = 96;
24
- const MAX_AVATAR_REDIRECTS = 3;
25
19
  /**
26
20
  * Return the URL when it is HTTPS on a photo host of the provider or a
27
21
  * subdomain. Junior fetches only these URLs.
@@ -34,11 +28,8 @@ function parseAvatarUrl(value, provider) {
34
28
  const host = url.hostname.toLowerCase();
35
29
  return hosts.some((allowed) => host === allowed || host.endsWith(`.${allowed}`)) ? url.href : void 0;
36
30
  }
37
- function avatarUrlHash(url) {
38
- return createHash("sha256").update(url).digest("hex");
39
- }
40
31
  function avatarVersion(url) {
41
- return avatarUrlHash(url).slice(0, 16);
32
+ return createHash("sha256").update(url).digest("hex").slice(0, 16);
42
33
  }
43
34
  function avatarPath(identityId, avatarUrl) {
44
35
  return `/api/people/avatars/${encodeURIComponent(identityId)}?v=${avatarVersion(avatarUrl)}`;
@@ -76,110 +67,21 @@ function identityAvatarUrl(row, userAvatarUrls) {
76
67
  if (row.userId) return userAvatarUrls.get(row.userId);
77
68
  return row.avatarUrl ? avatarPath(row.identityId, row.avatarUrl) : void 0;
78
69
  }
79
- async function readBoundedBody(response, maxBytes) {
80
- if (!response.body) return /* @__PURE__ */ new Uint8Array();
81
- const reader = response.body.getReader();
82
- const chunks = [];
83
- let total = 0;
84
- while (true) {
85
- const { done, value } = await reader.read();
86
- if (done) return Buffer.concat(chunks);
87
- total += value.byteLength;
88
- if (total > maxBytes) {
89
- await reader.cancel();
90
- return;
91
- }
92
- chunks.push(value);
93
- }
94
- }
95
- function avatarFetchFailed(host, attributes) {
96
- logWarn("avatar.fetch.failed", {
97
- "server.address": host,
98
- ...attributes
99
- });
100
- return null;
101
- }
102
- async function fetchAvatarResponse(url, provider, signal) {
103
- let current = url;
104
- for (let redirects = 0;; redirects += 1) {
105
- const response = await fetch(current, {
106
- redirect: "manual",
107
- signal
108
- });
109
- const location = response.headers.get("location");
110
- if (response.status < 300 || response.status >= 400 || !location) return response;
111
- await response.body?.cancel();
112
- const next = URL.canParse(location, current) ? parseAvatarUrl(new URL(location, current).href, provider) : void 0;
113
- if (!next) return "redirect_off_host";
114
- if (redirects >= MAX_AVATAR_REDIRECTS) return "too_many_redirects";
115
- current = next;
116
- }
117
- }
118
- async function fetchAvatarImage(url, provider) {
119
- const host = new URL(url).hostname;
120
- let data;
121
- try {
122
- const response = await fetchAvatarResponse(url, provider, AbortSignal.timeout(AVATAR_FETCH_TIMEOUT_MS));
123
- if (typeof response === "string") return avatarFetchFailed(host, { "app.reason": response });
124
- if (!response.ok) {
125
- await response.body?.cancel();
126
- return avatarFetchFailed(host, { "http.response.status_code": response.status });
127
- }
128
- data = await readBoundedBody(response, MAX_AVATAR_BYTES);
129
- } catch (error) {
130
- return avatarFetchFailed(host, { "exception.message": error instanceof Error ? error.message : String(error) });
131
- }
132
- if (!data) return avatarFetchFailed(host, { "app.reason": "too_large" });
133
- const contentType = detectImageMediaType(data);
134
- if (!contentType) return avatarFetchFailed(host, { "app.reason": "not_an_image" });
135
- try {
136
- return {
137
- contentType: "image/webp",
138
- data: await shrinkAvatar(data)
139
- };
140
- } catch (error) {
141
- logWarn("avatar.resize.failed", {
142
- "server.address": host,
143
- "exception.message": error instanceof Error ? error.message : String(error)
144
- });
145
- return {
146
- contentType,
147
- data: Buffer.from(data).toString("base64")
148
- };
149
- }
150
- }
151
- async function shrinkAvatar(data) {
152
- const { default: sharp } = await import("sharp");
153
- return (await sharp(data).rotate().resize({
154
- width: AVATAR_EDGE_PX,
155
- height: AVATAR_EDGE_PX,
156
- withoutEnlargement: true
157
- }).webp({ quality: 80 }).toBuffer()).toString("base64");
158
- }
159
70
  /**
160
- * Read the saved photo of one Identity and its version. Junior fetches it
161
- * from the provider once, resizes it, and keeps it in the state cache for a
162
- * day. Return undefined when the Identity has no photo or the provider does
163
- * not return one.
71
+ * Return how to fetch the photo of one user Identity, or nothing when it has
72
+ * no photo on a photo host of its provider. A redirect cannot leave the
73
+ * photo hosts of the provider.
164
74
  */
165
- async function readAvatarImage(db, state, identityId) {
75
+ async function readAvatarFetch(db, identityId) {
166
76
  const [row] = await db.select({
167
77
  avatarUrl: juniorIdentities.avatarUrl,
168
78
  provider: juniorIdentities.provider
169
79
  }).from(juniorIdentities).where(and(eq(juniorIdentities.id, identityId), eq(juniorIdentities.kind, "user"))).limit(1);
170
80
  const url = row ? parseAvatarUrl(row.avatarUrl, row.provider) : void 0;
171
- if (!row?.avatarUrl || !url) return void 0;
172
- const key = `avatar:${AVATAR_EDGE_PX}:${avatarUrlHash(url)}`;
173
- const image = await createCache(state, "core").getOrLoad(key, async () => {
174
- const loaded = await fetchAvatarImage(url, row.provider);
175
- return {
176
- value: loaded,
177
- ttlMs: loaded ? AVATAR_CACHE_TTL_MS : AVATAR_FAILURE_TTL_MS
178
- };
179
- });
180
- return image ? {
181
- image,
182
- version: avatarVersion(row.avatarUrl)
81
+ const hosts = row && AVATAR_HOSTS[row.provider];
82
+ return url && hosts ? {
83
+ hosts,
84
+ url
183
85
  } : void 0;
184
86
  }
185
87
  // src/chat/plugins/viewer.ts
@@ -305,4 +207,4 @@ async function readIdentityByIdFromSql(db, identityId) {
305
207
  async function readIdentityById(identityId) {
306
208
  return await readIdentityByIdFromSql(getDb(), identityId);
307
209
  }
308
- export { readActorIdentityFromSql as a, readViewerAvatarUrl as c, updateViewerDisplayName as d, identityAvatarUrl as f, userAvatarUrlsFromIdentities as g, readUserAvatarUrls as h, readActorIdentity as i, resolveViewerUser as l, readAvatarImage as m, findUserByEmailFromSql as n, readIdentityById as o, parseAvatarUrl as p, listAdminUsersFromSql as r, readIdentityByIdFromSql as s, findUserByEmail as t, setUserAdminFromSql as u };
210
+ export { readActorIdentityFromSql as a, readViewerAvatarUrl as c, updateViewerDisplayName as d, identityAvatarUrl as f, userAvatarUrlsFromIdentities as g, readUserAvatarUrls as h, readActorIdentity as i, resolveViewerUser as l, readAvatarFetch as m, findUserByEmailFromSql as n, readIdentityById as o, parseAvatarUrl as p, listAdminUsersFromSql as r, readIdentityByIdFromSql as s, findUserByEmail as t, setUserAdminFromSql as u };
@@ -1,21 +1,21 @@
1
1
  import { n as captureMessage, u as sentry_exports, v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { $ as loadTurnCheckpoint, Cn as getTerminalAssistantMessages, H as PluginCredentialFailureError, Jo as FORK_INSTRUCTIONS, K as AuthorizationFlowDisabledError, Oo as createPluginLogger, Un as escapeClosingTags, X as clearPendingAuth, Yo as loadForkHistory, at as failTurnRecord, dr as getPlugins, et as lostWorkerBeforeFirstSave, fn as NO_REPLY_TOOL_NAME, in as REPLY_TOOL_NAME, j as markConversationMessage, nt as saveTurnCheckpoint, on as readTurnAnswer, ps as createPluginCache, qn as renderTag, rn as isTurnExecutionLimitExceededError, rt as abandonTurnRecord, s as openConversationProjection, st as getTurnRecord, tt as pauseLostWorkerTurn, un as getAssistantReplyText, v as hydrateConversationMessages, vi as listWatches, vn as REPORT_BLOCKED_TOOL_NAME } from "./projection-DEdP1q6f.js";
3
- import { E as resolveGatewayModel, K as isProviderRetryError, g as TURN_REASONING_LEVELS, i as getChatConfig, n as botConfig } from "./config-CAXIpWQb.js";
4
- import { E as withSpan, h as logWarn, m as logInfo, x as setSpanStatus } from "./logging-DPLEa8Bn.js";
2
+ import { $ as loadTurnCheckpoint, Cn as getTerminalAssistantMessages, Fo as FORK_INSTRUCTIONS, H as PluginCredentialFailureError, Io as loadForkHistory, K as AuthorizationFlowDisabledError, Un as escapeClosingTags, X as clearPendingAuth, _s as createPluginCache, at as failTurnRecord, dr as getPlugins, et as lostWorkerBeforeFirstSave, fn as NO_REPLY_TOOL_NAME, ho as createPluginLogger, in as REPLY_TOOL_NAME, j as markConversationMessage, nt as saveTurnCheckpoint, on as readTurnAnswer, qn as renderTag, rn as isTurnExecutionLimitExceededError, rt as abandonTurnRecord, s as openConversationProjection, st as getTurnRecord, tt as pauseLostWorkerTurn, un as getAssistantReplyText, v as hydrateConversationMessages, vi as listWatches, vn as REPORT_BLOCKED_TOOL_NAME } from "./projection-w_X-zi7v.js";
3
+ import { D as resolveGatewayModel, _ as TURN_REASONING_LEVELS, i as getChatConfig, n as botConfig, q as isProviderRetryError } from "./config-9nHoFiJP.js";
4
+ import { E as withSpan, h as logWarn, m as logInfo, x as setSpanStatus } from "./logging-BIclibct.js";
5
5
  import { o as isUserActor } from "./actor-D2iXzvlN.js";
6
- import { C as isPersonInput, D as conversationKindFromRow, E as turnBehavior, a as getConversationStore, et as rootConversationIsArchived, j as SYSTEM_IDENTITY_ID, o as getDb, r as getConversationEventStore, s as getSqlExecutor, w as isTopLevelKind, y as userMessageQueries } from "./db-COYOGzYS.js";
7
- import { g as juniorAgentInvocations, h as juniorAgentBindings, j as juniorConversations, w as juniorConversationEvents } from "./executor-BWmAgSyi.js";
6
+ import { C as isPersonInput, D as conversationKindFromRow, E as turnBehavior, a as getConversationStore, et as rootConversationIsArchived, j as SYSTEM_IDENTITY_ID, o as getDb, r as getConversationEventStore, s as getSqlExecutor, w as isTopLevelKind, y as userMessageQueries } from "./db-BJNo6fK5.js";
7
+ import { g as juniorAgentInvocations, h as juniorAgentBindings, j as juniorConversations, w as juniorConversationEvents } from "./executor-DBIaOeJ_.js";
8
8
  import { d as contextProvenance, m as sameActorIdentity, u as agentInstructionProvenance } from "./history-IjdmO_r6.js";
9
- import { r as getStateAdapter } from "./adapter-AgCNqqsG.js";
10
- import { p as credentialContextSchema } from "./registry-BTKmKM-r.js";
11
- import { u as completeText } from "./prompt-4M98h_tC.js";
12
- import { A as agentTypeSchema, k as agentTypeInstructions } from "./conversation-fCWD9Az3.js";
13
- import { C as getAuthPausedConversationTurnId, E as listActiveMailboxTurns, F as isEventMailboxMetadata, T as listActiveMailboxTurnSources, X as maybePostAutomatedTurnLimitNotice, at as conversationSubtreeColumns, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, i as resumeStoppedConversationTree, it as conversationSubtree, m as instructionForInputs, n as isSkippedAfterConversationStop, nt as recordFinishedTurnForAutomatedLimit, ot as buildDeploymentSystemPrompt, r as markConversationsStopped, rt as resetAutomatedTurnLimit, st as systemPromptHash, t as getConversationStoppedAtMs } from "./session-stop-2XJrcNCy.js";
14
- import { l as getVercelConversationWorkQueue, w as getTurnRequestDeadline, y as sendCacheWarmup } from "./background-compaction-queue-CnimvRdk.js";
15
- import { A as getAgentInvocationResultMessageId, C as ownAgentInvocation, I as getUnnamedAgentConversationId, N as getChildAgentLockName, O as getAgentInvocationIdForResult, P as getNamedAgentConversationId, R as buildDeterministicTurnId, S as listChildMessages, T as getAgentInvocationId, _ as ConversationTurnLifecycleService, b as hasAgentInvocationReply, d as isTurnInputCommitLostError, j as getAgentInvocationTurnId, k as getAgentInvocationMessageId, l as getConversationTurnBoundaryError, p as markTurnClosed, s as TurnInputCommitLostError, t as getTurnUserMessage, w as readChildMessageSender } from "./turn-user-message-BEw7acTP.js";
16
- import { D as stopConversationWork, _ as getConversationWorkState, h as ensureConversationWake, m as dropPendingMessages, r as appendAndEnqueueInboundMessage, v as getConversationWorkStates, w as requestConversationWork } from "./store-BHiaHCQu.js";
17
- import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, n as resolveTurnSessionRouting, s as persistThreadStateById } from "./turn-session-routing-BVZHBFCF.js";
18
- import { g as AGENT_PARENT_MESSAGE_EVENT_TYPE, m as AGENT_INVOCATION_EVENT_NAMESPACE, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, t as AGENT_INVOCATION_MAILBOX_STATUSES, y as isAgentInvocationResultEventType } from "./statuses-B8mUfghF.js";
9
+ import { r as getStateAdapter } from "./adapter-S5UkjNK3.js";
10
+ import { p as credentialContextSchema } from "./registry-BmP5vnlj.js";
11
+ import { u as completeText } from "./prompt-B1Xw46-S.js";
12
+ import { A as agentTypeInstructions, j as agentTypeSchema } from "./conversation-Dyjq2CZ8.js";
13
+ import { C as getAuthPausedConversationTurnId, E as listActiveMailboxTurns, F as isEventMailboxMetadata, T as listActiveMailboxTurnSources, X as maybePostAutomatedTurnLimitNotice, at as conversationSubtreeColumns, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, i as resumeStoppedConversationTree, it as conversationSubtree, m as instructionForInputs, n as isSkippedAfterConversationStop, nt as recordFinishedTurnForAutomatedLimit, ot as buildDeploymentSystemPrompt, r as markConversationsStopped, rt as resetAutomatedTurnLimit, st as systemPromptHash, t as getConversationStoppedAtMs } from "./session-stop-BcAXze8a.js";
14
+ import { T as getTurnRequestDeadline, b as sendCacheWarmup, l as getVercelConversationWorkQueue } from "./background-compaction-queue-B6U3060-.js";
15
+ import { A as getAgentInvocationResultMessageId, C as ownAgentInvocation, I as getUnnamedAgentConversationId, N as getChildAgentLockName, O as getAgentInvocationIdForResult, P as getNamedAgentConversationId, R as buildDeterministicTurnId, S as listChildMessages, T as getAgentInvocationId, _ as ConversationTurnLifecycleService, b as hasAgentInvocationReply, d as isTurnInputCommitLostError, j as getAgentInvocationTurnId, k as getAgentInvocationMessageId, l as getConversationTurnBoundaryError, p as markTurnClosed, s as TurnInputCommitLostError, t as getTurnUserMessage, w as readChildMessageSender } from "./turn-user-message-D5RnVmxQ.js";
16
+ import { D as stopConversationWork, _ as getConversationWorkState, h as ensureConversationWake, m as dropPendingMessages, r as appendAndEnqueueInboundMessage, v as getConversationWorkStates, w as requestConversationWork } from "./store-E3x2Fg_F.js";
17
+ import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, n as resolveTurnSessionRouting, s as persistThreadStateById } from "./turn-session-routing-Bo_LxFum.js";
18
+ import { C as isAgentInvocationResultEventType, b as AGENT_PARENT_MESSAGE_EVENT_TYPE, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, t as AGENT_INVOCATION_MAILBOX_STATUSES, v as AGENT_INVOCATION_EVENT_NAMESPACE } from "./statuses-Hn-HsOph.js";
19
19
  import * as z from "zod";
20
20
  import { streamSimple } from "@earendil-works/pi-ai/compat";
21
21
  import { isDeepStrictEqual, promisify } from "node:util";
@@ -474,7 +474,9 @@ const IMAGE_REF_PREFIX = "sha256:";
474
474
  const imageKey = (conversationId, sha256) => `${KEY_PREFIX}:image:${conversationId}:${sha256}`;
475
475
  function imageParts(message) {
476
476
  if (message.role === "assistant" || typeof message.content === "string") return [];
477
- return message.content.filter((part) => part.type === "image");
477
+ const images = [];
478
+ for (const part of message.content) if (part.type === "image") images.push(part);
479
+ return images;
478
480
  }
479
481
  function snapshotContext(context, toRef) {
480
482
  return {
@@ -1,30 +1,23 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Ct as countPendingConversationMessages, Nt as isFinalAttempt, Pt as isInvalidConversationRecordError, jt as hasConversationStop } from "./projection-DEdP1q6f.js";
3
- import { K as isProviderRetryError, i as getChatConfig } from "./config-CAXIpWQb.js";
4
- import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-DPLEa8Bn.js";
5
- import { t as getConversationStoppedAtMs } from "./session-stop-2XJrcNCy.js";
6
- import { bt as isAttemptInterrupt, xt as selectAttemptMessages } from "./warmup-9ySPacF9.js";
7
- import { f as ConversationQueueMessageRejectedError, w as getTurnRequestDeadline } from "./background-compaction-queue-CnimvRdk.js";
8
- import { C as requestAnotherSlice, S as releaseConversationWork, T as startConversationWork, _ as getConversationWorkState, b as recordAttemptFailure, c as clearConsumedConversationWake, d as completeConversationWork, f as deadLetterAttempt, h as ensureConversationWake, i as beginConversationResume, o as checkInConversationWork, p as drainConversationMailbox, t as ackMessages, u as completeConversationStop, x as recordConversationRetry } from "./store-BHiaHCQu.js";
9
- // src/chat/task-execution/worker.ts
10
- var worker_exports = /* @__PURE__ */ __exportAll({
11
- CONVERSATION_WORK_DEFER_DELAY_MS: () => CONVERSATION_WORK_DEFER_DELAY_MS,
12
- processConversationWork: () => processConversationWork
13
- });
14
- const CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
15
- const CONVERSATION_STOP_CHECK_INTERVAL_MS = 500;
16
- function now(options) {
17
- return options.nowMs?.() ?? Date.now();
18
- }
19
- function nudgeIdempotencyKey(reason, conversationId, nowMs) {
20
- return `${reason}:${conversationId}:${nowMs}`;
21
- }
2
+ import { Ct as countPendingConversationMessages, Nt as isFinalAttempt, Pt as isInvalidConversationRecordError, jt as hasConversationStop } from "./projection-w_X-zi7v.js";
3
+ import { i as getChatConfig, q as isProviderRetryError } from "./config-9nHoFiJP.js";
4
+ import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-BIclibct.js";
5
+ import { t as getConversationStoppedAtMs } from "./session-stop-BcAXze8a.js";
6
+ import { bt as isAttemptInterrupt, xt as selectAttemptMessages } from "./warmup-BW2qwnal.js";
7
+ import { T as getTurnRequestDeadline, f as ConversationQueueMessageRejectedError, h as nudgeIdempotencyKey } from "./background-compaction-queue-B6U3060-.js";
8
+ import { C as requestAnotherSlice, S as releaseConversationWork, T as startConversationWork, _ as getConversationWorkState, b as recordAttemptFailure, c as clearConsumedConversationWake, d as completeConversationWork, f as deadLetterAttempt, h as ensureConversationWake, i as beginConversationResume, o as checkInConversationWork, p as drainConversationMailbox, t as ackMessages, u as completeConversationStop, x as recordConversationRetry } from "./store-E3x2Fg_F.js";
9
+ // src/chat/task-execution/lost-lease.ts
10
+ /**
11
+ * Count a slice that lost its Conversation Lease as a failed attempt, then
12
+ * hand the work to a new slice, or stop it when retries are exhausted.
13
+ */
22
14
  async function requestLostLeaseRecovery(args) {
23
15
  const before = await getConversationWorkState({
24
16
  conversationId: args.conversationId,
25
17
  state: args.options.state
26
18
  });
27
19
  const retry = await recordConversationRetry({
20
+ beforeWorkStops: args.options.beforeWorkStops,
28
21
  conversationId: args.conversationId,
29
22
  leaseToken: args.leaseToken,
30
23
  conversationStore: args.options.conversationStore,
@@ -65,6 +58,16 @@ async function requestLostLeaseRecovery(args) {
65
58
  state: args.options.state
66
59
  });
67
60
  }
61
+ // src/chat/task-execution/worker.ts
62
+ var worker_exports = /* @__PURE__ */ __exportAll({
63
+ CONVERSATION_WORK_DEFER_DELAY_MS: () => CONVERSATION_WORK_DEFER_DELAY_MS,
64
+ processConversationWork: () => processConversationWork
65
+ });
66
+ const CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
67
+ const CONVERSATION_STOP_CHECK_INTERVAL_MS = 500;
68
+ function now(options) {
69
+ return options.nowMs?.() ?? Date.now();
70
+ }
68
71
  /**
69
72
  * Record one failed delivery attempt and surface dead-lettered messages.
70
73
  *
@@ -589,6 +592,7 @@ async function processConversationWorkInContext(message, options) {
589
592
  });
590
593
  } else {
591
594
  if ((failure ? failure.status : await recordConversationRetry({
595
+ beforeWorkStops: options.beforeWorkStops,
592
596
  conversationId,
593
597
  leaseToken: lease.leaseToken,
594
598
  conversationStore: options.conversationStore,
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "junior_attachments" ALTER COLUMN "storage_key" DROP NOT NULL;--> statement-breakpoint
2
+ ALTER TABLE "junior_attachments" ALTER COLUMN "sha256" DROP NOT NULL;