@sentry/junior 0.279.0 → 0.281.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/{actor-B4DYygOB.js → actor-6jsm_v96.js} +1 -1
  2. package/dist/{adapter-phTTgw7H.js → adapter-RVQGEa98.js} +1 -1
  3. package/dist/{admin-PcpJDugZ.js → admin-DQpHx6Og.js} +1 -1
  4. package/dist/{agent-runner-DwvT1BY0.js → agent-runner-B229gXUY.js} +1002 -980
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +7 -7
  7. package/dist/api.d.ts +3 -3
  8. package/dist/api.js +188 -86
  9. package/dist/{app-DVs6noo7.d.ts → app-BQ9RZS43.d.ts} +4 -4
  10. package/dist/app.d.ts +1 -1
  11. package/dist/app.js +45 -38
  12. package/dist/{assistant-reply-BXfxczd7.js → assistant-reply-DQbtwc6j.js} +1 -1
  13. package/dist/{automation-BehArCcq.js → automation-sIsmIXH7.js} +2 -2
  14. package/dist/{background-compaction-queue-CcbuLJrZ.js → background-compaction-queue-oegyrxSe.js} +3 -3
  15. package/dist/{briefs-Dd_ezwED.js → briefs-BwzGWJgR.js} +5 -9
  16. package/dist/{catalog-runtime-BWVMeZhW.js → catalog-runtime-ClKzLvbN.js} +1 -1
  17. package/dist/cli/chat.js +15 -15
  18. package/dist/cli/check.js +3 -3
  19. package/dist/cli/main.js +3 -3
  20. package/dist/cli/plugins.js +4 -4
  21. package/dist/cli/snapshot-create.js +4 -4
  22. package/dist/cli/upgrade.d.ts +1 -1
  23. package/dist/cli/upgrade.js +3 -3
  24. package/dist/{client-Bpxe4vKa.js → client-DkG0Tj53.js} +2 -2
  25. package/dist/{config-C_bmRhrJ.js → config-3AZ11aSM.js} +2 -2
  26. package/dist/{connections-B2rHe5W5.js → connections-C0ut_6RW.js} +11 -11
  27. package/dist/{conversation-CIiJtx5q.js → conversation-DNtcULyX.js} +45 -14
  28. package/dist/{conversation-pending-messages-CnBvE6-6.js → conversation-pending-messages-LlFnr9-m.js} +11 -3
  29. package/dist/{conversation-privacy-CzOfcz0U.js → conversation-privacy-DAgeBGLN.js} +1 -1
  30. package/dist/{credential-sync-Dal_unpv.js → credential-sync-Bg8NPuvj.js} +16 -16
  31. package/dist/{db-CyLrV9C7.d.ts → db-BCFM0CUX.d.ts} +2 -2
  32. package/dist/{executor-BfYH-Wws.js → executor-DLKnzP6S.js} +149 -6
  33. package/dist/instrumentation.js +2 -2
  34. package/dist/{logging-CkT3_Xxp.js → logging-DHzrobea.js} +1 -1
  35. package/dist/{media-DTAA8Qs_.js → media-Dq9_svfQ.js} +1 -1
  36. package/dist/{message-Q5dkgaJ5.js → message-LR8z5jXJ.js} +9 -9
  37. package/dist/nitro.d.ts +1 -1
  38. package/dist/nitro.js +3 -3
  39. package/dist/{oauth-callback-server-BDRaqe8O.js → oauth-callback-server-EWdpj0_y.js} +2 -2
  40. package/dist/{oauth-relay-D0G3T16m.js → oauth-relay-D6xxVywK.js} +1 -1
  41. package/dist/{projection-DWxX7pb1.js → projection-Bhz1tp0G.js} +194 -119
  42. package/dist/{prompt--dwus7Y-.js → prompt-DI6KCtwb.js} +6 -27
  43. package/dist/{queue-C37RbDVc.d.ts → queue-CZyYgPF0.d.ts} +1 -1
  44. package/dist/{registry-DnrdeO4s.js → registry-EjhulgQW.js} +3 -3
  45. package/dist/{reporting-window-DgHgwQB3.js → reporting-window-B-QP9zX1.js} +28 -2
  46. package/dist/{resolve-C_QXfqD_.js → resolve-Cw6OW4Fj.js} +4 -4
  47. package/dist/{result-DNmOxT-N.js → result-BoD0jevy.js} +11 -11
  48. package/dist/{runner-zd_noJ1l.js → runner-D22bsBDS.js} +11 -11
  49. package/dist/{sandbox-egress-signals-DQjv-nbG.js → sandbox-egress-signals-BG5GYacQ.js} +1 -1
  50. package/dist/{schema-CNJNzvr8.js → schema-BN34Jy-U.js} +30 -7
  51. package/dist/{schema-e90H5FIN.d.ts → schema-CsqJzkP5.d.ts} +95 -13
  52. package/dist/{service-account-CCH2Hv4h.js → service-account-Dd1nnAQZ.js} +3 -3
  53. package/dist/{service-account-BK26XlHo.js → service-account-xo-CeMqI.js} +3 -3
  54. package/dist/{session-stop-6Tf--T7G.js → session-stop-CHSYB2uw.js} +13 -14
  55. package/dist/{skills-BNrk8gi4.js → skills-BGJr6xtW.js} +3 -3
  56. package/dist/{spawn-C75hAB9l.js → spawn-Cl8WS7zi.js} +2 -2
  57. package/dist/{stop-RYbf7PWi.js → stop-C9lHWpvl.js} +332 -149
  58. package/dist/{store-G3h2djJU.js → store-C4z8gOgZ.js} +3 -3
  59. package/dist/{store-CO5vGjwD.js → store-DeTnwVJt.js} +6 -6
  60. package/dist/{task-queue-DlN58XeM.js → task-queue-BBos68l0.js} +4 -4
  61. package/dist/{task-runner-B-Bdm23d.js → task-runner-BSF9zO-H.js} +8 -8
  62. package/dist/{thread-state-Cj_7Slru.js → thread-state-DGq1o5JX.js} +4 -4
  63. package/dist/{turn-failure-response-CE7gaoC7.js → turn-failure-response--9bA4uLP.js} +8 -8
  64. package/dist/{turn-lifecycle-7sXwXLJ6.js → turn-lifecycle-t5fimxwQ.js} +1 -1
  65. package/dist/{turn-session-routing-FBdaH1zf.js → turn-session-routing-RBtUe-3y.js} +10 -11
  66. package/dist/{validation-DLWxEzWW.js → validation-DrR0leBT.js} +1 -1
  67. package/dist/{version-DtQ8WFIZ.js → version-D_HFt_Dq.js} +1 -1
  68. package/dist/version.js +1 -1
  69. package/dist/{viewer-vsM8_90o.js → viewer-DWlpSFdj.js} +9 -8
  70. package/dist/{work-DsoFRO_0.js → work-pPoqtRea.js} +12 -12
  71. package/dist/{worker-6kZEsCXs.js → worker-CoVKgJ-O.js} +6 -6
  72. package/package.json +5 -5
  73. package/dist/agent-invocations-CUg_SODU.js +0 -181
@@ -1,6 +1,6 @@
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-DWxX7pb1.js";
2
- import { x as getConversationStore } from "./viewer-vsM8_90o.js";
3
- import "./background-compaction-queue-CcbuLJrZ.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-Bhz1tp0G.js";
2
+ import { x as getConversationStore } from "./viewer-DWlpSFdj.js";
3
+ import "./background-compaction-queue-oegyrxSe.js";
4
4
  // src/chat/task-execution/store.ts
5
5
  function metadataStore(options) {
6
6
  return options.conversationStore ?? getConversationStore();
@@ -1,10 +1,10 @@
1
- import { g as TURN_REASONING_LEVELS } from "./config-C_bmRhrJ.js";
2
- import { C as getSqlExecutor, x as getConversationStore } from "./viewer-vsM8_90o.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-CUg_SODU.js";
4
- import "./executor-BfYH-Wws.js";
5
- import { p as credentialContextSchema } from "./registry-DnrdeO4s.js";
1
+ import { g as TURN_REASONING_LEVELS } from "./config-3AZ11aSM.js";
2
+ import { C as getSqlExecutor, x as getConversationStore } from "./viewer-DWlpSFdj.js";
3
+ import { h as juniorAgentInvocations, m as juniorAgentBindings } from "./executor-DLKnzP6S.js";
4
+ import { p as credentialContextSchema } from "./registry-EjhulgQW.js";
5
+ import { S as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, x as AGENT_INVOCATION_MAILBOX_STATUSES } from "./reporting-window-B-QP9zX1.js";
6
6
  import { createHash } from "node:crypto";
7
- import { z } from "zod";
7
+ import * as z from "zod";
8
8
  import { and, asc, count, countDistinct, desc, eq, inArray, lt, ne, or, sql } from "drizzle-orm";
9
9
  import { actorSchema, destinationSchema, sourceSchema } from "@sentry/junior-plugin-api";
10
10
  // src/chat/runtime/turn.ts
@@ -1,7 +1,7 @@
1
- import { h as logWarn } from "./logging-CkT3_Xxp.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-CcbuLJrZ.js";
1
+ import { h as logWarn } from "./logging-DHzrobea.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-oegyrxSe.js";
3
3
  import { createHash } from "node:crypto";
4
- import { z } from "zod";
4
+ import * as z from "zod";
5
5
  // src/chat/queue/callback.ts
6
6
  /** Shared queue callback wiring for signed messages. */
7
7
  /** Build the HTTP callback and local-dev consumer for one signed queue. */
@@ -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-B-Bdm23d.js").then((n) => n.r);
113
+ const { processPluginTask } = await import("./task-runner-BSF9zO-H.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 { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Aa as createPluginLogger, Bn as coreTaskRegistrations, Gr as createPluginState, Gt as getPiMessageRole, Ln as getPlugins, Ua as createPluginConversationEvents, Xt as instructionTextForProjection, do as createPluginCache, en as isToolResultError, ga as createPluginModel, ha as createPluginEmbedder, in as stripRuntimeTurnContext, ka as createPluginModelCostRecorder, nn as normalizeToolNameFromResult, tn as isToolResultMessage, tt as getTurnRecord, v as hydrateConversationMessages } from "./projection-DWxX7pb1.js";
3
- import { h as parseSlackMessageTs } from "./actor-B4DYygOB.js";
4
- import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-vsM8_90o.js";
5
- import { _ as sameActorIdentity } from "./media-DTAA8Qs_.js";
6
- import { r as getStateAdapter } from "./adapter-phTTgw7H.js";
7
- import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-FBdaH1zf.js";
8
- import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Cj_7Slru.js";
9
- import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-DlN58XeM.js";
2
+ import { Aa as createPluginLogger, Bn as coreTaskRegistrations, Gr as createPluginState, Gt as getPiMessageRole, Ln as getPlugins, Ua as createPluginConversationEvents, Xt as instructionTextForProjection, en as isToolResultError, ga as createPluginModel, ha as createPluginEmbedder, in as stripRuntimeTurnContext, ka as createPluginModelCostRecorder, nn as normalizeToolNameFromResult, po as createPluginCache, tn as isToolResultMessage, tt as getTurnRecord, v as hydrateConversationMessages } from "./projection-Bhz1tp0G.js";
3
+ import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
4
+ import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-DWlpSFdj.js";
5
+ import { _ as sameActorIdentity } from "./media-Dq9_svfQ.js";
6
+ import { r as getStateAdapter } from "./adapter-RVQGEa98.js";
7
+ import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-RBtUe-3y.js";
8
+ import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-DGq1o5JX.js";
9
+ import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-BBos68l0.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 { Rr as JUNIOR_THREAD_STATE_TTL_MS, fo as createDurableLocationConfigurationService, y as persistConversationMessages } from "./projection-DWxX7pb1.js";
2
- import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-CkT3_Xxp.js";
3
- import { S as getDb } from "./viewer-vsM8_90o.js";
4
- import { r as getStateAdapter } from "./adapter-phTTgw7H.js";
1
+ import { Rr as JUNIOR_THREAD_STATE_TTL_MS, mo as createDurableLocationConfigurationService, y as persistConversationMessages } from "./projection-Bhz1tp0G.js";
2
+ import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-DHzrobea.js";
3
+ import { S as getDb } from "./viewer-DWlpSFdj.js";
4
+ import { r as getStateAdapter } from "./adapter-RVQGEa98.js";
5
5
  // src/chat/state/conversation.ts
6
6
  function defaultConversationState() {
7
7
  return {
@@ -1,11 +1,11 @@
1
- import { K as clearPendingAuth, M as markConversationMessage, oo as listConversationAnnotations, un as buildDeterministicTurnId, v as hydrateConversationMessages } from "./projection-DWxX7pb1.js";
2
- import { b as getProviderErrorUserMessage, g as ProviderError, v as findProviderError, y as getProviderErrorAttributes } from "./client-Bpxe4vKa.js";
3
- import { W as isRecord, t as buildTurnFailureResponse } from "./logging-CkT3_Xxp.js";
4
- import { h as parseSlackMessageTs } from "./actor-B4DYygOB.js";
5
- import { S as getDb, y as getConversationEventStore } from "./viewer-vsM8_90o.js";
6
- import { M as readMessageCardRefs, N as removedCardSchema, P as resolveMessageCards } from "./conversation-CIiJtx5q.js";
7
- import { O as parseAgentInvocationResultMessageId, Q as markTurnCompleted, Z as markTurnClosed, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-CO5vGjwD.js";
8
- import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Cj_7Slru.js";
1
+ import { K as clearPendingAuth, M as markConversationMessage, co as listConversationAnnotations, un as buildDeterministicTurnId, v as hydrateConversationMessages } from "./projection-Bhz1tp0G.js";
2
+ import { b as getProviderErrorUserMessage, g as ProviderError, v as findProviderError, y as getProviderErrorAttributes } from "./client-DkG0Tj53.js";
3
+ import { W as isRecord, t as buildTurnFailureResponse } from "./logging-DHzrobea.js";
4
+ import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
5
+ import { S as getDb, y as getConversationEventStore } from "./viewer-DWlpSFdj.js";
6
+ import { M as readMessageCardRefs, N as removedCardSchema, P as resolveMessageCards } from "./conversation-DNtcULyX.js";
7
+ import { O as parseAgentInvocationResultMessageId, Q as markTurnCompleted, Z as markTurnClosed, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-DeTnwVJt.js";
8
+ import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-DGq1o5JX.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-vsM8_90o.js";
1
+ import { y as getConversationEventStore } from "./viewer-DWlpSFdj.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,14 +1,13 @@
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-DWxX7pb1.js";
2
- import { n as botConfig } from "./config-C_bmRhrJ.js";
3
- import { _ as runBestEffort, h as logWarn } from "./logging-CkT3_Xxp.js";
4
- import { Q as agentTurnTotalTokens, S as getDb, Z as agentTurnCostUsd } from "./viewer-vsM8_90o.js";
5
- import { s as juniorConversations } from "./agent-invocations-CUg_SODU.js";
6
- import { d as juniorAutomations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-BfYH-Wws.js";
7
- import { h as credentialSubjectSchema } from "./registry-DnrdeO4s.js";
8
- import { r as getStateAdapter } from "./adapter-phTTgw7H.js";
9
- import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-BehArCcq.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-Bhz1tp0G.js";
2
+ import { n as botConfig } from "./config-3AZ11aSM.js";
3
+ import { _ as runBestEffort, h as logWarn } from "./logging-DHzrobea.js";
4
+ import { Q as agentTurnTotalTokens, S as getDb, Z as agentTurnCostUsd } from "./viewer-DWlpSFdj.js";
5
+ import { d as juniorAutomations, k as juniorConversations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-DLKnzP6S.js";
6
+ import { h as credentialSubjectSchema } from "./registry-EjhulgQW.js";
7
+ import { r as getStateAdapter } from "./adapter-RVQGEa98.js";
8
+ import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-sIsmIXH7.js";
10
9
  import { createHash } from "node:crypto";
11
- import { z } from "zod";
10
+ import * as z from "zod";
12
11
  import { and, asc, count, desc, eq, gte, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
13
12
  import { agentEventMatchSchema, anyResourceMatchFields, describeEventTrigger, destinationSchema, destinationVisibilitySchema, eventMatches, eventTriggerChoices, eventTriggerProblems, isSlackDestination, normalizeEventIdentifier, normalizeEventMatch, replyAttributionSchema, sourceSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
14
13
  // src/chat/events/catalog.ts
@@ -1584,7 +1583,7 @@ function slackSourceForDestination(args) {
1584
1583
  * Reads parent Conversations when this Conversation has no Destination.
1585
1584
  */
1586
1585
  async function resolveConversationRouting(args) {
1587
- const conversationStore = args.conversationStore ?? (await import("./viewer-vsM8_90o.js").then((n) => n.v)).getConversationStore();
1586
+ const conversationStore = args.conversationStore ?? (await import("./viewer-DWlpSFdj.js").then((n) => n.v)).getConversationStore();
1588
1587
  const chain = await loadConversationChain(args.conversationId, conversationStore);
1589
1588
  let destination;
1590
1589
  let source;
@@ -1,5 +1,5 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BWVMeZhW.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-ClKzLvbN.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.279.0";
2
+ var version = "0.281.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-DtQ8WFIZ.js";
1
+ export { t as JUNIOR_VERSION } from "./version-D_HFt_Dq.js";
@@ -1,10 +1,9 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { i as getChatConfig } from "./config-C_bmRhrJ.js";
3
- import { U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-CkT3_Xxp.js";
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-CUg_SODU.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-BfYH-Wws.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";
2
+ import { i as getChatConfig } from "./config-3AZ11aSM.js";
3
+ import { U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-DHzrobea.js";
4
+ import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-6jsm_v96.js";
5
+ import { A as juniorIdentities, M as juniorDestinations, O as conversationReadColumns, S as juniorConversationEvents, _ as juniorConversationParticipants, b as CONVERSATION_METRICS, j as juniorUsers, k as juniorConversations, t as createJuniorSqlExecutor, v as juniorConversationBindings, w as juniorConversationAnnotations, x as juniorConversationMetrics } from "./executor-DLKnzP6S.js";
6
+ import { d as newConversationEventSchema, f as encodeHistoryPayload, l as decodeStoredConversationEvent, n as detectImageMediaType, o as conversationEventDataSchema, u as historyReplacementSchema, v as usageSchema } from "./media-Dq9_svfQ.js";
8
7
  import { a as withLock } from "./locks-D-0h111u.js";
9
8
  import { createHash, randomUUID } from "node:crypto";
10
9
  import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
@@ -495,7 +494,8 @@ async function deleteProviderIdentityForUser(executor, userId, provider, provide
495
494
  }
496
495
  /**
497
496
  * Save one Google sign-in. Link the Google identity to the user of its
498
- * verified email, and set its sign-in time.
497
+ * verified email, and set its sign-in time. Return the previous sign-in
498
+ * time, if any.
499
499
  */
500
500
  async function recordGoogleSignIn(executor, account, nowMs = Date.now()) {
501
501
  const stored = await upsertIdentity(executor, {
@@ -507,8 +507,9 @@ async function recordGoogleSignIn(executor, account, nowMs = Date.now()) {
507
507
  displayName: account.displayName,
508
508
  avatarUrl: account.avatarUrl ?? null
509
509
  }, nowMs);
510
+ const [previous] = await executor.db().select({ signedInAt: juniorIdentities.signedInAt }).from(juniorIdentities).where(eq(juniorIdentities.id, stored.id)).limit(1);
510
511
  await executor.db().update(juniorIdentities).set({ signedInAt: dateFromMs$1(nowMs) }).where(eq(juniorIdentities.id, stored.id));
511
- return stored;
512
+ return previous?.signedInAt?.getTime();
512
513
  }
513
514
  // src/chat/identities/actor.ts
514
515
  /**
@@ -1,16 +1,16 @@
1
- import { H as AuthorizationFlowDisabledError, Kt as getTerminalAssistantMessages, Q as abandonTurnRecord, R as PluginCredentialFailureError, Vt as isTurnExecutionLimitExceededError, Z as saveTurnCheckpoint, Za as loadForkHistory, et as failTurnRecord, s as openConversationProjection, tt as getTurnRecord } from "./projection-DWxX7pb1.js";
2
- import { n as botConfig } from "./config-C_bmRhrJ.js";
3
- import { F as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-vsM8_90o.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-DwvT1BY0.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-CO5vGjwD.js";
7
- import { n as getAssistantReplyText } from "./assistant-reply-BXfxczd7.js";
8
- import { E as maybePostAutomatedTurnLimitNotice, M as recordFinishedTurnForAutomatedLimit, N as resetAutomatedTurnLimit } from "./session-stop-6Tf--T7G.js";
9
- import { r as appendAndEnqueueInboundMessage } from "./store-G3h2djJU.js";
10
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-7sXwXLJ6.js";
11
- import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-Cj_7Slru.js";
1
+ import { H as AuthorizationFlowDisabledError, Kt as getTerminalAssistantMessages, Q as abandonTurnRecord, Qa as loadForkHistory, R as PluginCredentialFailureError, Vt as isTurnExecutionLimitExceededError, Z as saveTurnCheckpoint, et as failTurnRecord, s as openConversationProjection, tt as getTurnRecord } from "./projection-Bhz1tp0G.js";
2
+ import { n as botConfig } from "./config-3AZ11aSM.js";
3
+ import { F as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-DWlpSFdj.js";
4
+ import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-Dq9_svfQ.js";
5
+ import { At as withoutSavedSteeringMessages, It as readBlockedReport, St as recordSubagentStarted, kt as buildSteeringPiMessage, xt as recordSubagentEnded, yt as stopChildAgentsOf } from "./agent-runner-B229gXUY.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-DeTnwVJt.js";
7
+ import { n as getAssistantReplyText } from "./assistant-reply-DQbtwc6j.js";
8
+ import { E as maybePostAutomatedTurnLimitNotice, M as recordFinishedTurnForAutomatedLimit, N as resetAutomatedTurnLimit } from "./session-stop-CHSYB2uw.js";
9
+ import { r as appendAndEnqueueInboundMessage } from "./store-C4z8gOgZ.js";
10
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-t5fimxwQ.js";
11
+ import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-DGq1o5JX.js";
12
12
  import { isDeepStrictEqual } from "node:util";
13
- import { z } from "zod";
13
+ import * as z from "zod";
14
14
  // src/chat/runtime/turn-execution.ts
15
15
  /** An error thrown while the agent advances a Run. */
16
16
  var AgentRunError = class extends Error {
@@ -1,10 +1,10 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Ct as isInvalidConversationRecordError, St as isFinalAttempt, bt as hasConversationStop } from "./projection-DWxX7pb1.js";
3
- import { x as isProviderRetryError } from "./client-Bpxe4vKa.js";
4
- import { i as getChatConfig } from "./config-C_bmRhrJ.js";
5
- import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-CkT3_Xxp.js";
6
- import { g as getTurnRequestDeadline, v as ConversationQueueMessageRejectedError } from "./background-compaction-queue-CcbuLJrZ.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-G3h2djJU.js";
2
+ import { Ct as isInvalidConversationRecordError, St as isFinalAttempt, bt as hasConversationStop } from "./projection-Bhz1tp0G.js";
3
+ import { x as isProviderRetryError } from "./client-DkG0Tj53.js";
4
+ import { i as getChatConfig } from "./config-3AZ11aSM.js";
5
+ import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-DHzrobea.js";
6
+ import { g as getTurnRequestDeadline, v as ConversationQueueMessageRejectedError } from "./background-compaction-queue-oegyrxSe.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-C4z8gOgZ.js";
8
8
  // src/chat/task-execution/attempt-selection.ts
9
9
  function selectContiguousTurnBatch(messages) {
10
10
  const first = messages[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.279.0",
3
+ "version": "0.281.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -91,7 +91,7 @@
91
91
  "sharp": "^0.35.3",
92
92
  "yaml": "^2.9.0",
93
93
  "zod": "^4.5.4",
94
- "@sentry/junior-plugin-api": "0.279.0"
94
+ "@sentry/junior-plugin-api": "0.281.0"
95
95
  },
96
96
  "peerDependencies": {
97
97
  "bullmq": "^6.5.0",
@@ -126,9 +126,9 @@
126
126
  "typescript": "^7.0.2",
127
127
  "vercel": "^54.4.0",
128
128
  "vitest": "^4.1.12",
129
- "@sentry/junior-github": "0.279.0",
130
- "@sentry/junior-memory": "0.279.0",
131
- "@sentry/junior-testing": "0.0.0"
129
+ "@sentry/junior-github": "0.281.0",
130
+ "@sentry/junior-testing": "0.0.0",
131
+ "@sentry/junior-memory": "0.281.0"
132
132
  },
133
133
  "scripts": {
134
134
  "build": "tsdown",
@@ -1,181 +0,0 @@
1
- import { z } from "zod";
2
- import { getTableColumns, sql } from "drizzle-orm";
3
- import { boolean, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
4
- // src/db/schema/timestamps.ts
5
- const timestamptz = (name) => timestamp(name, { withTimezone: true });
6
- // src/db/schema/destinations.ts
7
- const juniorDestinationKindSchema = z.enum([
8
- "channel",
9
- "dm",
10
- "group",
11
- "local_conversation",
12
- "thread",
13
- "web_session"
14
- ]);
15
- const juniorDestinations = pgTable("junior_destinations", {
16
- id: text("id").primaryKey(),
17
- provider: text("provider").notNull(),
18
- providerTenantId: text("provider_tenant_id").notNull().default(""),
19
- providerDestinationId: text("provider_destination_id").notNull(),
20
- kind: text("kind").$type().notNull(),
21
- parentDestinationId: text("parent_destination_id"),
22
- displayName: text("display_name"),
23
- visibility: text("visibility").$type().notNull().default("unknown"),
24
- metadata: jsonb("metadata_json"),
25
- createdAt: timestamptz("created_at").notNull(),
26
- updatedAt: timestamptz("updated_at").notNull()
27
- }, (table) => [uniqueIndex("junior_destinations_provider_destination_uidx").on(table.provider, table.providerTenantId, table.providerDestinationId), index("junior_destinations_provider_kind_idx").on(table.provider, table.kind)]);
28
- const juniorUsers = pgTable("junior_users", {
29
- id: text("id").primaryKey(),
30
- primaryEmail: text("primary_email").notNull(),
31
- primaryEmailNormalized: text("primary_email_normalized").notNull(),
32
- displayName: text("display_name"),
33
- timezone: text("timezone"),
34
- /** Text the user saved to change how Junior replies to them. */
35
- customization: text("customization"),
36
- /** Junior-wide admin role. Only the `junior admin` CLI changes it. */
37
- isAdmin: boolean("is_admin").notNull().default(false),
38
- /** Auto-archive this user's conversations when their work is done. */
39
- autoArchiveDefault: boolean("auto_archive_default").notNull().default(false),
40
- /** Hours done work and the conversation stay quiet before auto-archive. */
41
- autoArchiveGraceHours: integer("auto_archive_grace_hours").notNull().default(24),
42
- createdAt: timestamptz("created_at").notNull(),
43
- updatedAt: timestamptz("updated_at").notNull()
44
- }, (table) => [uniqueIndex("junior_users_primary_email_normalized_uidx").on(table.primaryEmailNormalized)]);
45
- // src/db/schema/identities.ts
46
- const juniorIdentities = pgTable("junior_identities", {
47
- id: text("id").primaryKey(),
48
- kind: text("kind").$type().notNull(),
49
- provider: text("provider").notNull(),
50
- providerTenantId: text("provider_tenant_id").notNull().default(""),
51
- providerSubjectId: text("provider_subject_id").notNull(),
52
- displayName: text("display_name"),
53
- handle: text("handle"),
54
- email: text("email"),
55
- avatarUrl: text("avatar_url"),
56
- metadata: jsonb("metadata_json"),
57
- createdAt: timestamptz("created_at").notNull(),
58
- updatedAt: timestamptz("updated_at").notNull(),
59
- userId: text("user_id").references(() => juniorUsers.id),
60
- emailNormalized: text("email_normalized"),
61
- emailVerified: boolean("email_verified").notNull().default(false),
62
- signedInAt: timestamptz("signed_in_at")
63
- }, (table) => [
64
- uniqueIndex("junior_identities_provider_subject_uidx").on(table.provider, table.providerTenantId, table.providerSubjectId),
65
- index("junior_identities_user_idx").on(table.userId),
66
- index("junior_identities_verified_email_idx").on(table.emailNormalized).where(sql`${table.emailVerified} = true AND ${table.emailNormalized} IS NOT NULL`),
67
- index("junior_identities_kind_provider_idx").on(table.kind, table.provider)
68
- ]);
69
- // src/db/schema/conversations.ts
70
- const juniorConversations = pgTable("junior_conversations", {
71
- conversationId: text("conversation_id").primaryKey(),
72
- schemaVersion: integer("schema_version").notNull().default(1),
73
- source: text("source").$type(),
74
- /** Structured session Source locator; set-once on the conversation root. */
75
- sessionSource: jsonb("source_json").$type(),
76
- /** Complete Location associated with this Conversation. */
77
- location: jsonb("location_json").$type(),
78
- destinationId: text("destination_id").references(() => juniorDestinations.id),
79
- destination: jsonb("destination_json").$type(),
80
- actorIdentityId: text("actor_identity_id").references(() => juniorIdentities.id),
81
- creatorIdentityId: text("creator_identity_id").references(() => juniorIdentities.id),
82
- credentialSubjectIdentityId: text("credential_subject_identity_id").references(() => juniorIdentities.id),
83
- actor: jsonb("actor_json").$type(),
84
- channelName: text("channel_name"),
85
- title: text("title"),
86
- createdAt: timestamptz("created_at").notNull(),
87
- lastActivityAt: timestamptz("last_activity_at").notNull(),
88
- updatedAt: timestamptz("updated_at").notNull(),
89
- executionUpdatedAt: timestamptz("execution_updated_at"),
90
- executionStatus: text("execution_status").$type().notNull(),
91
- runId: text("run_id"),
92
- lastCheckpointAt: timestamptz("last_checkpoint_at"),
93
- lastEnqueuedAt: timestamptz("last_enqueued_at"),
94
- parentConversationId: text("parent_conversation_id").references(() => juniorConversations.conversationId),
95
- forkedFromConversationId: text("forked_from_conversation_id").references(() => juniorConversations.conversationId, { onDelete: "set null" }),
96
- quickQuestionAt: timestamptz("quick_question_at"),
97
- rootConversationId: text("root_conversation_id").references(() => juniorConversations.conversationId),
98
- transcriptPurgedAt: timestamptz("transcript_purged_at"),
99
- /** Latest session stop. Automated input received before it is dropped. */
100
- stoppedAt: timestamptz("stopped_at"),
101
- durationMs: integer("duration_ms").notNull().default(0),
102
- usage: jsonb("usage_json").$type(),
103
- executionDurationMs: integer("execution_duration_ms").notNull().default(0),
104
- executionUsage: jsonb("execution_usage_json").$type(),
105
- metricRunId: text("metric_run_id"),
106
- detailVersion: integer("detail_version").notNull().default(0),
107
- legacyArchivedAt: timestamptz("archived_at")
108
- }, (table) => [
109
- index("junior_conversations_last_activity_idx").on(table.lastActivityAt.desc(), table.conversationId),
110
- index("junior_conversations_active_idx").using("btree", sql`coalesce(${table.executionUpdatedAt}, ${table.updatedAt})`, table.conversationId).where(sql`${table.executionStatus} <> 'idle'`),
111
- index("junior_conversations_destination_activity_idx").on(table.destinationId, table.lastActivityAt.desc()),
112
- index("junior_conversations_actor_activity_idx").on(table.actorIdentityId, table.lastActivityAt.desc()),
113
- index("junior_conversations_parent_idx").on(table.parentConversationId),
114
- index("junior_conversations_forked_from_idx").on(table.forkedFromConversationId),
115
- index("junior_conversations_root_idx").on(table.rootConversationId)
116
- ]);
117
- /** Select runtime conversation fields without reading the legacy archive column. */
118
- function conversationReadColumns() {
119
- const { legacyArchivedAt, ...columns } = getTableColumns(juniorConversations);
120
- return columns;
121
- }
122
- // src/db/schema/agent-invocations.ts
123
- const AGENT_INVOCATION_STATUSES = [
124
- "pending",
125
- "running",
126
- "paused",
127
- "blocked",
128
- "completed",
129
- "failed",
130
- "stopped"
131
- ];
132
- const AGENT_INVOCATION_MAILBOX_STATUSES = ["pending", "appended"];
133
- /**
134
- * Parent mailbox append state. Only terminal invocations have a value.
135
- * `replaced` means the child still had open work, so a later agent invocation
136
- * on the same child sends the result instead. `skipped` means a stop ended
137
- * the work, so the result is never used. `steered` means the agent invocation
138
- * that was running read the input as a steering message, so its result covers
139
- * this one.
140
- */
141
- const AGENT_INVOCATION_PARENT_MAILBOX_STATUSES = [
142
- "pending",
143
- "appended",
144
- "replaced",
145
- "skipped",
146
- "steered"
147
- ];
148
- const juniorAgentBindings = pgTable("junior_agent_bindings", {
149
- parentConversationId: text("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
150
- name: text("name").notNull(),
151
- childConversationId: text("child_conversation_id").notNull().references(() => juniorConversations.conversationId)
152
- }, (table) => [primaryKey({ columns: [table.parentConversationId, table.name] }), uniqueIndex("junior_agent_bindings_child_idx").on(table.childConversationId)]);
153
- const juniorAgentInvocations = pgTable("junior_agent_invocations", {
154
- invocationId: text("invocation_id").primaryKey(),
155
- parentConversationId: text("parent_conversation_id").notNull().references(() => juniorConversations.conversationId),
156
- childConversationId: text("child_conversation_id").notNull().references(() => juniorConversations.conversationId),
157
- agentName: text("agent_name"),
158
- input: text("input").notNull(),
159
- title: text("title"),
160
- actor: jsonb("actor_json").$type().notNull(),
161
- credentialContext: jsonb("credential_context_json").$type(),
162
- source: jsonb("source_json").$type().notNull(),
163
- destination: jsonb("destination_json").$type().notNull(),
164
- destinationVisibility: text("destination_visibility").$type(),
165
- agentType: text("agent_type").$type(),
166
- reasoningLevel: text("reasoning_level").$type(),
167
- parentToolCallId: text("parent_tool_call_id"),
168
- status: text("status").$type().notNull(),
169
- mailboxStatus: text("mailbox_status").$type().notNull(),
170
- parentMailboxStatus: text("parent_mailbox_status").$type(),
171
- result: text("result"),
172
- errorMessage: text("error_message"),
173
- createdAt: timestamptz("created_at").notNull(),
174
- updatedAt: timestamptz("updated_at").notNull(),
175
- terminalAt: timestamptz("terminal_at")
176
- }, (table) => [
177
- index("junior_agent_invocations_child_idx").on(table.childConversationId),
178
- index("junior_agent_invocations_mailbox_idx").on(table.mailboxStatus, table.createdAt),
179
- index("junior_agent_invocations_parent_mailbox_idx").on(table.parentMailboxStatus, table.terminalAt)
180
- ]);
181
- export { juniorAgentInvocations as a, juniorIdentities as c, juniorDestinations as d, timestamptz as f, juniorAgentBindings as i, juniorUsers as l, AGENT_INVOCATION_PARENT_MAILBOX_STATUSES as n, conversationReadColumns as o, AGENT_INVOCATION_STATUSES as r, juniorConversations as s, AGENT_INVOCATION_MAILBOX_STATUSES as t, juniorDestinationKindSchema as u };