@sentry/junior 0.223.0 → 0.224.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 (52) hide show
  1. package/dist/{agent-hooks-DZU5nsd1.js → agent-hooks-DNLBwmsh.js} +6 -6
  2. package/dist/{agent-Bzbf92vv.js → agent-runner-9g6TQk9y.js} +809 -34
  3. package/dist/api.js +14 -14
  4. package/dist/app.js +1507 -59
  5. package/dist/{briefs-BJPfCrlT.js → briefs-CjXnGKzZ.js} +2 -2
  6. package/dist/{catalog-runtime-BthunUDD.js → catalog-runtime-CVZ9TEuK.js} +1 -1
  7. package/dist/{checkpoint-Deu-OVb3.js → checkpoint-Ceck_fLO.js} +7 -7
  8. package/dist/cli/chat.js +14 -15
  9. package/dist/cli/check.js +3 -3
  10. package/dist/cli/main.js +1 -1
  11. package/dist/cli/plugins.js +3 -3
  12. package/dist/cli/snapshot-create.js +3 -3
  13. package/dist/cli/upgrade.js +3 -3
  14. package/dist/{client-DjC6-6iU.js → client-B27ufhzl.js} +2 -2
  15. package/dist/{config-CtoUVs72.js → config-BAhl7-RC.js} +2 -2
  16. package/dist/{conversation-privacy-xS1t92xa.js → conversation-privacy-C-4JQzKD.js} +1 -1
  17. package/dist/credential-sync-BXHIxbtS.js +940 -0
  18. package/dist/{execution-stats-CrXs9vSH.js → execution-stats-DikPOxJ1.js} +3 -3
  19. package/dist/{executor-AOhG9X1t.js → executor-BG2Armby.js} +1 -1
  20. package/dist/instrumentation.js +2 -2
  21. package/dist/{job-queue-CNd9cpIy.js → job-queue-D4oAVrL9.js} +1 -1
  22. package/dist/{logging-DiN3o3nB.js → logging-iY0ssa2q.js} +1 -1
  23. package/dist/nitro.js +3 -3
  24. package/dist/{pending-auth-D7vmttn_.js → oauth-authorization-BIijVS2N.js} +6 -48
  25. package/dist/{oauth-callback-server-Ca0VLUEw.js → oauth-callback-server-DPkK3kzi.js} +4 -4
  26. package/dist/{profile-BsNrw8lj.js → profile-6KWhg_-U.js} +5 -9
  27. package/dist/{registry-Dankt-Pl.js → registry-Ctgdjt-W.js} +1 -1
  28. package/dist/{resolve-B38CpJe2.js → resolve-CB45ZukQ.js} +2 -2
  29. package/dist/{runner-Ck5rEjCm.js → runner-BwKCqoF3.js} +8 -9
  30. package/dist/{sandbox-egress-signals-BOfFkvly.js → sandbox-egress-signals-Cmy8ODat.js} +1 -1
  31. package/dist/{short-title-BHd_jUFX.js → short-title-xEkZwkcV.js} +2 -2
  32. package/dist/{skills-DbP4TDft.js → skills-c2bMDVRS.js} +2 -2
  33. package/dist/{spawn-DzXc_PKO.js → spawn-Cg6lyjE7.js} +2 -2
  34. package/dist/{stats-pNGp3G5q.js → stats-DP9zl3Jg.js} +6 -6
  35. package/dist/{task-queue-Cy9y1foT.js → task-queue-SL4uLfBB.js} +3 -3
  36. package/dist/{task-runner-DI1FBJFJ.js → task-runner-fntmnqzx.js} +8 -83
  37. package/dist/{thread-state-DXgxOYpZ.js → thread-state-Wfr0GdKS.js} +5 -5
  38. package/dist/{auth-pause-state-Bn2vX4PA.js → turn-failure-response-DLjSEm-R.js} +73 -72
  39. package/dist/{turn-lifecycle-Bjf6y2GO.js → turn-lifecycle-5_jvLqRz.js} +1 -1
  40. package/dist/turn-session-routing-CQaysLoe.js +77 -0
  41. package/dist/{validation-D5CIslEu.js → validation-CnZkCN7o.js} +1 -1
  42. package/dist/{version-_ZQFlslB.js → version-C6lA-h_o.js} +1 -1
  43. package/dist/version.js +1 -1
  44. package/dist/{web-authorization-6mmfS_o-.js → web-authorization-Bbx999_q.js} +1 -1
  45. package/dist/{web-input-BJpWm6go.js → web-input-BoE1xE-K.js} +7 -7
  46. package/dist/{work-DvIlJR3C.js → work-4Nhz9mVv.js} +52 -10
  47. package/dist/{worker-D1qidg-Y.js → worker-CdWPsNL2.js} +5 -5
  48. package/package.json +4 -4
  49. package/dist/agent-runner-2VQ9WhkG.js +0 -679
  50. package/dist/credential-sync-CKdXEUDO.js +0 -2811
  51. package/dist/experimental-CIXf7Uye.js +0 -46
  52. package/dist/turn-execution-BNOXrZ-M.js +0 -47
@@ -1,6 +1,6 @@
1
- import { f as logWarn } from "./logging-DiN3o3nB.js";
2
- import { in as agentTurnTotalTokens, qt as getDb, rn as agentTurnCostUsd } from "./agent-hooks-DZU5nsd1.js";
3
- import { E as juniorConversations, s as juniorAutomationExecutions } from "./executor-AOhG9X1t.js";
1
+ import { f as logWarn } from "./logging-iY0ssa2q.js";
2
+ import { in as agentTurnTotalTokens, qt as getDb, rn as agentTurnCostUsd } from "./agent-hooks-DNLBwmsh.js";
3
+ import { E as juniorConversations, s as juniorAutomationExecutions } from "./executor-BG2Armby.js";
4
4
  import { and, asc, count, desc, eq, gte, inArray, lte, max, or, sql } from "drizzle-orm";
5
5
  //#region src/api/conversations/aggregate.ts
6
6
  function usageTokenValue(source, field) {
@@ -1,5 +1,5 @@
1
1
  import { g as startSpanManual } from "./sentry-CgWZM_kV.js";
2
- import "./config-CtoUVs72.js";
2
+ import "./config-BAhl7-RC.js";
3
3
  import { n as juniorDestinations, r as timestamptz } from "./destinations-BeBiJeEM.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { getTableColumns, sql } from "drizzle-orm";
@@ -1,6 +1,6 @@
1
- import { M as getDeploymentServiceVersion, N as getDeploymentTelemetryAttributes } from "./logging-DiN3o3nB.js";
1
+ import { M as getDeploymentServiceVersion, N as getDeploymentTelemetryAttributes } from "./logging-iY0ssa2q.js";
2
2
  import { _ as vercelAIIntegration, a as getClient, b as withStreamedSpan, c as init, o as getGlobalScope } from "./sentry-CgWZM_kV.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-xS1t92xa.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-C-4JQzKD.js";
4
4
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-BLvBjy_e.js";
5
5
  //#region src/chat/sentry-payload-filter.ts
6
6
  const PAYLOAD_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
@@ -1,4 +1,4 @@
1
- import { a as getChatConfig } from "./config-CtoUVs72.js";
1
+ import { a as getChatConfig } from "./config-BAhl7-RC.js";
2
2
  import { a as signQueueMessage, i as QUEUE_SIGNATURE_MAX_AGE_MS, o as verifyQueueMessage, s as createVercelQueueClient } from "./vercel-queue-DIkVcfK4.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { z } from "zod";
@@ -1,5 +1,5 @@
1
1
  import { d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException, y as withScope } from "./sentry-CgWZM_kV.js";
2
- import { t as JUNIOR_VERSION } from "./version-_ZQFlslB.js";
2
+ import { t as JUNIOR_VERSION } from "./version-C6lA-h_o.js";
3
3
  import path from "node:path";
4
4
  import { styleText } from "node:util";
5
5
  import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
package/dist/nitro.js CHANGED
@@ -1,9 +1,9 @@
1
- import { A as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, D as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, E as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_RETENTION_CRON_SCHEDULE, T as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_RETENTION_ROUTE, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "./logging-DiN3o3nB.js";
1
+ import { A as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, D as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, E as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_RETENTION_CRON_SCHEDULE, T as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_RETENTION_ROUTE, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "./logging-iY0ssa2q.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-7a9YqLhE.js";
3
3
  import { n as resolveConversationWorkQueueTopic } from "./vercel-queue-DIkVcfK4.js";
4
- import { t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-CNd9cpIy.js";
4
+ import { t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-D4oAVrL9.js";
5
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-egKWjgue.js";
6
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-Cy9y1foT.js";
6
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-SL4uLfBB.js";
7
7
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-BKGOXca2.js";
8
8
  import path from "node:path";
9
9
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
@@ -1,5 +1,4 @@
1
- import { g as extractAssistantText, i as abandonTurnRecord } from "./checkpoint-Deu-OVb3.js";
2
- import { qt as buildDeterministicTurnId } from "./stats-pNGp3G5q.js";
1
+ import { h as extractAssistantText } from "./checkpoint-Ceck_fLO.js";
3
2
  //#region src/chat/runtime/turn.ts
4
3
  /** Classified Slack turn failure carrying the owning Sentry capture outward. */
5
4
  var ConversationTurnBoundaryError = class extends Error {
@@ -135,51 +134,10 @@ function getAssistantReplyText(message) {
135
134
  return decision.kind === "deliver" ? decision.text : void 0;
136
135
  }
137
136
  //#endregion
138
- //#region src/chat/services/pending-auth.ts
139
- const AUTH_LINK_REUSE_WINDOW_MS = 6e5;
140
- const NON_REQUEST_SKIPPED_REASON_PREFIXES = ["directed_to_other_party:", "side_conversation:"];
141
- function isSkippedNonRequest(reason) {
142
- return NON_REQUEST_SKIPPED_REASON_PREFIXES.some((prefix) => reason?.startsWith(prefix));
143
- }
144
- /** Decide whether the same agent-run session can reuse its fresh auth link. */
145
- function canReusePendingAuthLink(args) {
146
- const { pendingAuth } = args;
147
- if (!pendingAuth) return false;
148
- return pendingAuth.kind === args.kind && pendingAuth.provider === args.provider && pendingAuth.actorId === args.actorId && pendingAuth.scope === args.scope && pendingAuth.sessionId === args.sessionId && pendingAuth.linkSentAtMs + AUTH_LINK_REUSE_WINDOW_MS > (args.nowMs ?? Date.now());
149
- }
150
- function getConversationPendingAuth(args) {
151
- const pendingAuth = args.conversation.processing.pendingAuth;
152
- if (!pendingAuth) return;
153
- if (pendingAuth.kind !== args.kind || pendingAuth.provider !== args.provider || pendingAuth.actorId !== args.actorId || pendingAuth.scope !== args.scope) return;
154
- return pendingAuth;
155
- }
156
- function clearPendingAuth(conversation, sessionId) {
157
- if (!conversation.processing.pendingAuth) return;
158
- if (sessionId && conversation.processing.pendingAuth.sessionId !== sessionId) return;
159
- conversation.processing.pendingAuth = void 0;
160
- }
161
- /** Mark the prior blocked turn abandoned after a new auth attempt replaces it. */
162
- async function abandonReplacedPendingAuth(args) {
163
- if (args.previousPendingAuth && args.previousPendingAuth.sessionId !== args.nextPendingAuth.sessionId && args.conversationId) await abandonTurnRecord({
164
- conversationId: args.conversationId,
165
- turnId: args.previousPendingAuth.sessionId,
166
- errorMessage: "Abandoned by a newer auth-blocked request in the same conversation."
167
- });
168
- }
169
- /**
170
- * Decide whether an auth callback still belongs to the latest real human
171
- * request, ignoring bot-authored and passive bystander rows while treating
172
- * failed human turns and opt-outs as newer freshness blockers.
173
- */
174
- function isPendingAuthLatestRequest(conversation, pendingAuth) {
175
- for (let index = conversation.messages.length - 1; index >= 0; index -= 1) {
176
- const message = conversation.messages[index];
177
- if (message?.role !== "user") continue;
178
- if (message.author?.isBot) continue;
179
- if (isSkippedNonRequest(message.meta?.skippedReason)) continue;
180
- return buildDeterministicTurnId(message.id) === pendingAuth.sessionId;
181
- }
182
- return false;
137
+ //#region src/chat/oauth-authorization.ts
138
+ /** Build the stable event identity shared by authorization request and completion. */
139
+ function authorizationId(args) {
140
+ return `${args.sessionId}:${args.kind}:${args.provider}`;
183
141
  }
184
142
  //#endregion
185
- export { startActiveTurn as S, isTurnInputCommitLostError as _, isPendingAuthLatestRequest as a, markTurnCompleted as b, sanitizeAssistantText as c, ConversationTurnBoundaryError as d, CooperativeTurnYieldError as f, isCooperativeTurnYieldError as g, getConversationTurnBoundaryError as h, getConversationPendingAuth as i, NO_REPLY_MARKER as l, TurnInputDeferredError as m, canReusePendingAuthLink as n, decideReply as o, TurnInputCommitLostError as p, clearPendingAuth as r, getAssistantReplyText as s, abandonReplacedPendingAuth as t, isNoReplyMarker as u, isTurnInputDeferredError as v, markTurnFailed as x, markTurnClosed as y };
143
+ export { markTurnFailed as _, NO_REPLY_MARKER as a, CooperativeTurnYieldError as c, getConversationTurnBoundaryError as d, isCooperativeTurnYieldError as f, markTurnCompleted as g, markTurnClosed as h, sanitizeAssistantText as i, TurnInputCommitLostError as l, isTurnInputDeferredError as m, decideReply as n, isNoReplyMarker as o, isTurnInputCommitLostError as p, getAssistantReplyText as r, ConversationTurnBoundaryError as s, authorizationId as t, TurnInputDeferredError as u, startActiveTurn as v };
@@ -1,5 +1,5 @@
1
- import { X as createUserTokenStore } from "./agent-Bzbf92vv.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-CKdXEUDO.js";
1
+ import { gt as createUserTokenStore } from "./agent-runner-9g6TQk9y.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-BXHIxbtS.js";
3
3
  import { createServer } from "node:http";
4
4
  //#region src/chat/local/oauth-callback-server.ts
5
5
  const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
@@ -14,7 +14,7 @@ function decodeProvider(value) {
14
14
  }
15
15
  }
16
16
  /** Start the loopback callback that completes OAuth in the local CLI process. */
17
- async function startLocalOAuthCallbackServer(agentRunner) {
17
+ async function startLocalOAuthCallbackServer() {
18
18
  let pendingAuthorization;
19
19
  const completeAuthorization = (authorization, result) => {
20
20
  if (authorization.settled) return;
@@ -61,7 +61,7 @@ async function startLocalOAuthCallbackServer(agentRunner) {
61
61
  };
62
62
  try {
63
63
  const request = new Request(requestUrl, { method: "GET" });
64
- const response = mcpMatch ? await GET(request, provider, waitUntil, { agentRunner }) : await GET$1(request, provider, waitUntil, { agentRunner });
64
+ const response = mcpMatch ? await GET(request, provider, waitUntil, {}) : await GET$1(request, provider, waitUntil, {});
65
65
  const body = Buffer.from(await response.arrayBuffer());
66
66
  await Promise.all(backgroundTasks);
67
67
  if (response.ok) {
@@ -1,7 +1,7 @@
1
- import { w as toOptionalTrimmed } from "./client-DjC6-6iU.js";
2
- import { _ as setSpanAttributes, v as setSpanStatus } from "./logging-DiN3o3nB.js";
3
- import { a as getChatConfig } from "./config-CtoUVs72.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BthunUDD.js";
1
+ import { w as toOptionalTrimmed } from "./client-B27ufhzl.js";
2
+ import { _ as setSpanAttributes, v as setSpanStatus } from "./logging-iY0ssa2q.js";
3
+ import { a as getChatConfig } from "./config-BAhl7-RC.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-CVZ9TEuK.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
7
7
  import { createRedisState } from "@chat-adapter/state-redis";
@@ -98,10 +98,6 @@ async function withLock(state, key, run, options = {}) {
98
98
  async function fenceLock(state, lock, ttlMs = MUTATION_LOCK_TTL_MS) {
99
99
  if (!await state.extendLock(lock, ttlMs)) throw new Error(`Lock ownership was lost before write for ${lock.threadId}`);
100
100
  }
101
- /** Run work under the active lock, reporting contention without ambiguity. */
102
- async function withActiveLock(state, key, run) {
103
- return await withLock(state, key, run);
104
- }
105
101
  //#endregion
106
102
  //#region src/chat/state/adapter.ts
107
103
  const ACTIVE_LOCK_HEARTBEAT_MS = 3e4;
@@ -859,4 +855,4 @@ function isStale(profile, createdAtMs) {
859
855
  return maxAgeMs === 0 || Date.now() - createdAtMs > maxAgeMs;
860
856
  }
861
857
  //#endregion
862
- export { sleep as A, getDefaultRedisStateAdapterFor as C, fenceLock as D, acquireActiveLock as E, sandboxSkillDir as F, sandboxSkillFile as I, sandboxSkillPathResolution as L, SANDBOX_REPOS_ROOT as M, SANDBOX_SKILLS_ROOT as N, withActiveLock as O, SANDBOX_WORKSPACE_ROOT as P, disconnectStateAdapter as S, MUTATION_LOCK_TTL_MS as T, workspaceSnapshotNotReadyUserMessage as _, isAbortError as a, buildNonInteractiveShellScript as b, isSandboxCommandStreamInterruptedError as c, isSnapshottingError as d, throwSandboxOperationError as f, isWorkspaceSnapshotNotReadyError as g, getWorkspaceSnapshotNotReadyError as h, ensureDockerDaemon as i, SANDBOX_DATA_ROOT as j, withLock as k, isSandboxMissingError as l, WorkspaceSnapshotNotReadyError as m, hash as n, isAlreadyExistsError as o, wrapSandboxSetupError as p, isStale as r, isSandboxApiTransientError as s, create as t, isSandboxUnavailableError as u, getVercelSandboxCredentials as v, getStateAdapter as w, runNonInteractiveCommand as x, buildCommandScript as y };
858
+ export { SANDBOX_DATA_ROOT as A, getDefaultRedisStateAdapterFor as C, fenceLock as D, acquireActiveLock as E, sandboxSkillFile as F, sandboxSkillPathResolution as I, SANDBOX_SKILLS_ROOT as M, SANDBOX_WORKSPACE_ROOT as N, withLock as O, sandboxSkillDir as P, disconnectStateAdapter as S, MUTATION_LOCK_TTL_MS as T, workspaceSnapshotNotReadyUserMessage as _, isAbortError as a, buildNonInteractiveShellScript as b, isSandboxCommandStreamInterruptedError as c, isSnapshottingError as d, throwSandboxOperationError as f, isWorkspaceSnapshotNotReadyError as g, getWorkspaceSnapshotNotReadyError as h, ensureDockerDaemon as i, SANDBOX_REPOS_ROOT as j, sleep as k, isSandboxMissingError as l, WorkspaceSnapshotNotReadyError as m, hash as n, isAlreadyExistsError as o, wrapSandboxSetupError as p, isStale as r, isSandboxApiTransientError as s, create as t, isSandboxUnavailableError as u, getVercelSandboxCredentials as v, getStateAdapter as w, runNonInteractiveCommand as x, buildCommandScript as y };
@@ -1,4 +1,4 @@
1
- import { _ as setSpanAttributes, d as logInfo, f as logWarn } from "./logging-DiN3o3nB.js";
1
+ import { _ as setSpanAttributes, d as logInfo, f as logWarn } from "./logging-iY0ssa2q.js";
2
2
  import { i as credentialUserSubjectId } from "./context-Bplcgypl.js";
3
3
  import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-7a9YqLhE.js";
4
4
  import path from "node:path";
@@ -1,5 +1,5 @@
1
- import { C as withSpan, _ as setSpanAttributes } from "./logging-DiN3o3nB.js";
2
- import { A as sleep, P as SANDBOX_WORKSPACE_ROOT, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-BsNrw8lj.js";
1
+ import { C as withSpan, _ as setSpanAttributes } from "./logging-iY0ssa2q.js";
2
+ import { N as SANDBOX_WORKSPACE_ROOT, k as sleep, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-6KWhg_-U.js";
3
3
  import { z } from "zod";
4
4
  import { FileSystem, Sandbox } from "@vercel/sandbox";
5
5
  //#region src/chat/sandbox/resources.ts
@@ -1,14 +1,13 @@
1
- import { p as authorizationId } from "./agent-Bzbf92vv.js";
2
- import { S as withLogContext, u as logException, y as setTags } from "./logging-DiN3o3nB.js";
1
+ import { S as withLogContext, u as logException, y as setTags } from "./logging-iY0ssa2q.js";
3
2
  import { t as credentialContextForActor } from "./context-Bplcgypl.js";
4
- import { Kt as getConversationStore, Wt as getConversationEventStore } from "./agent-hooks-DZU5nsd1.js";
3
+ import { Kt as getConversationStore, Wt as getConversationEventStore } from "./agent-hooks-DNLBwmsh.js";
5
4
  import { M as messageCardText } from "./conversation-1HUoZr2l.js";
6
- import { F as loadProjection, V as recordAuthorizationCompleted, X as persistConversationMessages, Y as hydrateConversationMessages, ct as recordDeliveredAssistantMessage, d as persistWithRetry, j as commitAcceptedReply, ot as markConversationMessage, r as saveTurnCheckpoint, st as normalizeConversationText, tt as buildConversationContext, ut as upsertConversationMessage } from "./checkpoint-Deu-OVb3.js";
7
- import { S as startActiveTurn, s as getAssistantReplyText, x as markTurnFailed } from "./pending-auth-D7vmttn_.js";
8
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-DI1FBJFJ.js";
9
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-Bjf6y2GO.js";
10
- import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-DXgxOYpZ.js";
11
- import { f as buildDeliveredTurnStatePatch, r as finalizeFailedTurnReplyWithEvent, s as loadPendingMessageCards, t as completeAuthPauseTurn } from "./auth-pause-state-Bn2vX4PA.js";
5
+ import { A as commitAcceptedReply, B as recordAuthorizationCompleted, J as hydrateConversationMessages, P as loadProjection, Y as persistConversationMessages, at as markConversationMessage, et as buildConversationContext, lt as upsertConversationMessage, ot as normalizeConversationText, r as saveTurnCheckpoint, st as recordDeliveredAssistantMessage, u as persistWithRetry } from "./checkpoint-Ceck_fLO.js";
6
+ import { _ as markTurnFailed, r as getAssistantReplyText, t as authorizationId, v as startActiveTurn } from "./oauth-authorization-BIijVS2N.js";
7
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-fntmnqzx.js";
8
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-5_jvLqRz.js";
9
+ import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-Wfr0GdKS.js";
10
+ import { d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent } from "./turn-failure-response-DLjSEm-R.js";
12
11
  import { randomUUID } from "node:crypto";
13
12
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
14
13
  //#region src/chat/local/runner.ts
@@ -1,4 +1,4 @@
1
- import { Y as sandboxEgressSignalsResponseSchema } from "./agent-Bzbf92vv.js";
1
+ import { rt as sandboxEgressSignalsResponseSchema } from "./agent-runner-9g6TQk9y.js";
2
2
  //#region src/chat/local/sandbox-egress-signals.ts
3
3
  const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
4
4
  const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
@@ -1,5 +1,5 @@
1
- import { f as logWarn } from "./logging-DiN3o3nB.js";
2
- import { n as botConfig } from "./config-CtoUVs72.js";
1
+ import { f as logWarn } from "./logging-iY0ssa2q.js";
2
+ import { n as botConfig } from "./config-BAhl7-RC.js";
3
3
  const TITLE_PROMPTS = {
4
4
  conversation: [
5
5
  "Generate a concise 5-8 word conversation title from the first user message below.",
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { f as logWarn } from "./logging-DiN3o3nB.js";
2
+ import { f as logWarn } from "./logging-iY0ssa2q.js";
3
3
  import { s as skillRoots } from "./package-discovery-7a9YqLhE.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BthunUDD.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-CVZ9TEuK.js";
5
5
  import path from "node:path";
6
6
  import { z } from "zod";
7
7
  import fs from "node:fs/promises";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { C as toolInvocationDestination, y as actorFromRun } from "./agent-runner-2VQ9WhkG.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-DvIlJR3C.js";
2
+ import { bt as actorFromRun, xt as toolInvocationDestination } from "./agent-runner-9g6TQk9y.js";
3
+ import { n as createAndEnqueueAgentInvocation } from "./work-4Nhz9mVv.js";
4
4
  //#region src/chat/agent-invocations/spawn.ts
5
5
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
6
6
  /** Bind a Run's Actor and credentials to new Agent invocations. */
@@ -1,11 +1,11 @@
1
- import { F as isRecord$1, I as toOptionalNumber, L as toOptionalString } from "./logging-DiN3o3nB.js";
2
- import { a as getChatConfig } from "./config-CtoUVs72.js";
1
+ import { F as isRecord$1, I as toOptionalNumber, L as toOptionalString } from "./logging-iY0ssa2q.js";
2
+ import { a as getChatConfig } from "./config-BAhl7-RC.js";
3
3
  import { _ as parseSlackMessageTs, d as parseStoredSlackActor, h as parseSlackTeamId, p as parseSlackChannelId } from "./context-Bplcgypl.js";
4
- import { Ft as saveObjectAnnotations, J as withSlackRetries, Kt as getConversationStore, U as getSlackClient, fn as parseDestination, ht as getDashboardTaskLink, mn as sameDestination, pt as JUNIOR_THREAD_STATE_TTL_MS, qt as getDb, u as getPlugins } from "./agent-hooks-DZU5nsd1.js";
4
+ import { Ft as saveObjectAnnotations, J as withSlackRetries, Kt as getConversationStore, U as getSlackClient, fn as parseDestination, ht as getDashboardTaskLink, mn as sameDestination, pt as JUNIOR_THREAD_STATE_TTL_MS, qt as getDb, u as getPlugins } from "./agent-hooks-DNLBwmsh.js";
5
5
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
6
- import { E as juniorConversations, a as juniorSchedulerRuns, c as juniorStats, l as juniorEventAutomations, o as juniorSchedulerTasks, w as juniorAttachments } from "./executor-AOhG9X1t.js";
7
- import { t as fallbackShortTitle } from "./short-title-BHd_jUFX.js";
8
- import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-BsNrw8lj.js";
6
+ import { E as juniorConversations, a as juniorSchedulerRuns, c as juniorStats, l as juniorEventAutomations, o as juniorSchedulerTasks, w as juniorAttachments } from "./executor-BG2Armby.js";
7
+ import { t as fallbackShortTitle } from "./short-title-xEkZwkcV.js";
8
+ import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-6KWhg_-U.js";
9
9
  import "./vercel-queue-DIkVcfK4.js";
10
10
  import { z } from "zod";
11
11
  import { createHash, randomUUID } from "node:crypto";
@@ -1,6 +1,6 @@
1
- import { f as logWarn } from "./logging-DiN3o3nB.js";
1
+ import { f as logWarn } from "./logging-iY0ssa2q.js";
2
2
  import { a as signQueueMessage, i as QUEUE_SIGNATURE_MAX_AGE_MS, o as verifyQueueMessage, s as createVercelQueueClient } from "./vercel-queue-DIkVcfK4.js";
3
- import { o as runWithTurnRequestDeadline } from "./job-queue-CNd9cpIy.js";
3
+ import { o as runWithTurnRequestDeadline } from "./job-queue-D4oAVrL9.js";
4
4
  import { z } from "zod";
5
5
  import { createHash } from "node:crypto";
6
6
  import { handleCallback, registerDevConsumer } from "@vercel/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-DI1FBJFJ.js").then((n) => n.r);
113
+ const { processPluginTask } = await import("./task-runner-fntmnqzx.js").then((n) => n.r);
114
114
  await processPluginTask(message);
115
115
  },
116
116
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -1,12 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
2
  import { _ as parseSlackMessageTs, r as credentialSubjectSchema } from "./context-Bplcgypl.js";
3
- import { At as createPluginConversationEvents, Kt as getConversationStore, Q as readActorIdentity, _t as createPluginState, bt as createPluginLogger, p as coreTaskRegistrations, pt as JUNIOR_THREAD_STATE_TTL_MS, qt as getDb, u as getPlugins, vt as createPluginEmbedder, yt as createPluginModel } from "./agent-hooks-DZU5nsd1.js";
3
+ import { At as createPluginConversationEvents, Kt as getConversationStore, Q as readActorIdentity, _t as createPluginState, bt as createPluginLogger, p as coreTaskRegistrations, pt as JUNIOR_THREAD_STATE_TTL_MS, qt as getDb, u as getPlugins, vt as createPluginEmbedder, yt as createPluginModel } from "./agent-hooks-DNLBwmsh.js";
4
4
  import { X as sameActorIdentity } from "./conversation-1HUoZr2l.js";
5
- import { E as normalizeToolNameFromResult, O as stripRuntimeTurnContext, T as isToolResultMessage, Y as hydrateConversationMessages, _ as getPiMessageRole, s as getTurnRecord, w as isToolResultError, x as instructionTextForProjection } from "./checkpoint-Deu-OVb3.js";
6
- import { w as getStateAdapter } from "./profile-BsNrw8lj.js";
7
- import { u as recordAutomationExecution } from "./execution-stats-CrXs9vSH.js";
8
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-DXgxOYpZ.js";
9
- import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-Cy9y1foT.js";
5
+ import { C as isToolResultError, D as stripRuntimeTurnContext, J as hydrateConversationMessages, T as normalizeToolNameFromResult, b as instructionTextForProjection, g as getPiMessageRole, s as getTurnRecord, w as isToolResultMessage } from "./checkpoint-Ceck_fLO.js";
6
+ import { w as getStateAdapter } from "./profile-6KWhg_-U.js";
7
+ import { u as recordAutomationExecution } from "./execution-stats-DikPOxJ1.js";
8
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-Wfr0GdKS.js";
9
+ import { t as resolveConversationRouting } from "./turn-session-routing-CQaysLoe.js";
10
+ import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-SL4uLfBB.js";
10
11
  import { z } from "zod";
11
12
  import { createHash } from "node:crypto";
12
13
  import { destinationSchema, destinationVisibilitySchema, isSlackDestination, pluginRunContextSchema, replyAttributionSchema, sourceSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
@@ -309,82 +310,6 @@ async function getPluginDispatchProjection(args) {
309
310
  return toDispatchProjection(record);
310
311
  }
311
312
  //#endregion
312
- //#region src/chat/services/turn-session-routing.ts
313
- async function loadConversationChain(conversationId, conversationStore) {
314
- const chain = [];
315
- const seen = /* @__PURE__ */ new Set();
316
- let cursor = conversationId;
317
- while (cursor && !seen.has(cursor)) {
318
- seen.add(cursor);
319
- const conversation = await conversationStore.get({ conversationId: cursor });
320
- if (!conversation) break;
321
- chain.push(conversation);
322
- cursor = conversation.parentConversationId;
323
- }
324
- return chain;
325
- }
326
- /**
327
- * Normalize a stored Slack session source against the conversation destination.
328
- *
329
- * Does not create channel or thread values from the conversation id.
330
- */
331
- function slackSourceForDestination(args) {
332
- if (args.source?.kind !== "slack" || args.source.channelId !== args.destination.channelId) return;
333
- const threadTs = args.source.threadTs?.trim();
334
- return {
335
- kind: "slack",
336
- visibility: args.source.visibility ?? "public",
337
- teamId: args.source.teamId?.trim() || args.destination.teamId,
338
- channelId: args.source.channelId,
339
- ...threadTs ? { threadTs } : void 0
340
- };
341
- }
342
- /**
343
- * Resolve the Conversation Location, Destination, and session Source.
344
- *
345
- * Reads parent Conversations when this Conversation has no Destination.
346
- */
347
- async function resolveConversationRouting(args) {
348
- const conversationStore = args.conversationStore ?? (await import("./agent-hooks-DZU5nsd1.js").then((n) => n.Ut)).getConversationStore();
349
- const chain = await loadConversationChain(args.conversationId, conversationStore);
350
- let destination;
351
- let source;
352
- let location;
353
- for (const conversation of chain) {
354
- destination ??= conversation.destination;
355
- source ??= conversation.sessionSource;
356
- location ??= conversation.location;
357
- if (destination && source) break;
358
- }
359
- if (!destination) return;
360
- if (destination.platform === "slack") {
361
- const slackSource = slackSourceForDestination({
362
- destination,
363
- source
364
- });
365
- return {
366
- destination,
367
- ...location ? { location } : void 0,
368
- ...slackSource ? { source: slackSource } : void 0
369
- };
370
- }
371
- return {
372
- destination,
373
- ...location ? { location } : void 0,
374
- ...source ? { source } : void 0
375
- };
376
- }
377
- /** Require the Conversation Destination and Source from SQL. */
378
- async function resolveTurnSessionRouting(args) {
379
- const routing = await resolveConversationRouting(args);
380
- if (!routing?.destination || !routing.source) throw new Error(`Conversation ${args.conversationId} is missing durable routing metadata`);
381
- return {
382
- destination: routing.destination,
383
- ...routing.location ? { location: routing.location } : void 0,
384
- source: routing.source
385
- };
386
- }
387
- //#endregion
388
313
  //#region src/chat/plugins/task-runner.ts
389
314
  var task_runner_exports = /* @__PURE__ */ __exportAll({
390
315
  processPluginTask: () => processPluginTask,
@@ -636,4 +561,4 @@ async function processPluginTask(message, options = {}) {
636
561
  });
637
562
  }
638
563
  //#endregion
639
- export { markDispatchCompleted as _, claimDispatchMailboxAppend as a, getDispatchConversationId as c, getDispatchTurnId as d, getPluginDispatchProjection as f, markDispatchBlocked as g, markDispatchAwaitingResume as h, resolveTurnSessionRouting as i, getDispatchInputMessageId as l, listPendingDispatchMailboxAppends as m, scheduleSessionCompletedPluginTasks as n, confirmDispatchMailboxAppend as o, isTerminalDispatchStatus as p, task_runner_exports as r, createOrGetDispatch as s, processPluginTask as t, getDispatchRecord as u, markDispatchFailed as v, markDispatchRunning as y };
564
+ export { markDispatchFailed as _, confirmDispatchMailboxAppend as a, getDispatchInputMessageId as c, getPluginDispatchProjection as d, isTerminalDispatchStatus as f, markDispatchCompleted as g, markDispatchBlocked as h, claimDispatchMailboxAppend as i, getDispatchRecord as l, markDispatchAwaitingResume as m, scheduleSessionCompletedPluginTasks as n, createOrGetDispatch as o, listPendingDispatchMailboxAppends as p, task_runner_exports as r, getDispatchConversationId as s, processPluginTask as t, getDispatchTurnId as u, markDispatchRunning as v };
@@ -1,9 +1,9 @@
1
- import { F as isRecord, I as toOptionalNumber, L as toOptionalString } from "./logging-DiN3o3nB.js";
2
- import { pt as JUNIOR_THREAD_STATE_TTL_MS, qt as getDb } from "./agent-hooks-DZU5nsd1.js";
1
+ import { F as isRecord, I as toOptionalNumber, L as toOptionalString } from "./logging-iY0ssa2q.js";
2
+ import { pt as JUNIOR_THREAD_STATE_TTL_MS, qt as getDb } from "./agent-hooks-DNLBwmsh.js";
3
3
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
4
- import { u as juniorLocationConfigurations } from "./executor-AOhG9X1t.js";
5
- import { X as persistConversationMessages } from "./checkpoint-Deu-OVb3.js";
6
- import { w as getStateAdapter } from "./profile-BsNrw8lj.js";
4
+ import { u as juniorLocationConfigurations } from "./executor-BG2Armby.js";
5
+ import { Y as persistConversationMessages } from "./checkpoint-Ceck_fLO.js";
6
+ import { w as getStateAdapter } from "./profile-6KWhg_-U.js";
7
7
  import { z } from "zod";
8
8
  import { randomUUID } from "node:crypto";
9
9
  import { and, eq, sql } from "drizzle-orm";
@@ -1,12 +1,52 @@
1
- import { _ as findProviderError, h as ProviderError, v as getProviderErrorAttributes, y as getProviderErrorUserMessage } from "./client-DjC6-6iU.js";
2
- import { F as isRecord, t as buildTurnFailureResponse } from "./logging-DiN3o3nB.js";
1
+ import { y as clearPendingAuth } from "./agent-runner-9g6TQk9y.js";
2
+ import { _ as findProviderError, h as ProviderError, v as getProviderErrorAttributes, y as getProviderErrorUserMessage } from "./client-B27ufhzl.js";
3
+ import { F as isRecord, t as buildTurnFailureResponse } from "./logging-iY0ssa2q.js";
3
4
  import { _ as parseSlackMessageTs } from "./context-Bplcgypl.js";
4
- import { Wt as getConversationEventStore } from "./agent-hooks-DZU5nsd1.js";
5
+ import { Wt as getConversationEventStore } from "./agent-hooks-DNLBwmsh.js";
5
6
  import { A as messageCardKey, N as readMessageCards, j as messageCardRefSchema } from "./conversation-1HUoZr2l.js";
6
- import { Y as hydrateConversationMessages, ot as markConversationMessage } from "./checkpoint-Deu-OVb3.js";
7
- import { qt as buildDeterministicTurnId } from "./stats-pNGp3G5q.js";
8
- import { b as markTurnCompleted, r as clearPendingAuth, y as markTurnClosed } from "./pending-auth-D7vmttn_.js";
9
- import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-DXgxOYpZ.js";
7
+ import { J as hydrateConversationMessages, at as markConversationMessage } from "./checkpoint-Ceck_fLO.js";
8
+ import { qt as buildDeterministicTurnId } from "./stats-DP9zl3Jg.js";
9
+ import { g as markTurnCompleted, h as markTurnClosed } from "./oauth-authorization-BIijVS2N.js";
10
+ import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-Wfr0GdKS.js";
11
+ //#region src/chat/conversations/pending-cards.ts
12
+ /** Read undelivered card snapshots across resume and history replacement. */
13
+ async function loadPendingMessageCards(conversationId) {
14
+ const cards = /* @__PURE__ */ new Map();
15
+ const deleted = /* @__PURE__ */ new Set();
16
+ let beforeSeq;
17
+ while (true) {
18
+ const page = await getConversationEventStore().query(conversationId, {
19
+ beforeSeq,
20
+ limit: 100,
21
+ types: [
22
+ "tool_result",
23
+ "message",
24
+ "turn_started"
25
+ ]
26
+ });
27
+ for (const event of [...page.events].reverse()) {
28
+ const data = event.data;
29
+ if (data.type === "turn_started" || data.type === "message" && data.role === "assistant") return [...cards.values()].reverse();
30
+ if (data.type !== "tool_result" || data.isError || typeof data.toolName !== "string" || !isRecord(data.details)) continue;
31
+ if (data.details.timed_out === true) continue;
32
+ if (Array.isArray(data.details.removedCards)) for (const ref of messageCardRefSchema.array().parse(data.details.removedCards)) deleted.add(JSON.stringify([ref.plugin, ref.key]));
33
+ for (const card of readMessageCards(data.details)) {
34
+ const key = messageCardKey(card);
35
+ if (!deleted.has(key) && !cards.has(key)) cards.set(key, card);
36
+ }
37
+ }
38
+ if (!page.hasOlder || page.events.length === 0) return [...cards.values()].reverse();
39
+ beforeSeq = page.events[0].seq;
40
+ }
41
+ }
42
+ //#endregion
43
+ //#region src/chat/interruption-marker.ts
44
+ const INTERRUPTED_MARKER = "\n\n[Response interrupted before completion]";
45
+ /** Return the marker added when a visible reply ended mid-execution. */
46
+ function getInterruptionMarker() {
47
+ return INTERRUPTED_MARKER;
48
+ }
49
+ //#endregion
10
50
  //#region src/chat/runtime/delivered-turn-state.ts
11
51
  /** Build state after destination delivery or intentional no-reply completion. */
12
52
  function buildDeliveredTurnStatePatch(args) {
@@ -55,43 +95,32 @@ function getTurnUserReplyAttachmentContext(message) {
55
95
  };
56
96
  }
57
97
  //#endregion
58
- //#region src/chat/conversations/pending-cards.ts
59
- /** Read undelivered card snapshots across resume and history replacement. */
60
- async function loadPendingMessageCards(conversationId) {
61
- const cards = /* @__PURE__ */ new Map();
62
- const deleted = /* @__PURE__ */ new Set();
63
- let beforeSeq;
64
- while (true) {
65
- const page = await getConversationEventStore().query(conversationId, {
66
- beforeSeq,
67
- limit: 100,
68
- types: [
69
- "tool_result",
70
- "message",
71
- "turn_started"
72
- ]
73
- });
74
- for (const event of [...page.events].reverse()) {
75
- const data = event.data;
76
- if (data.type === "turn_started" || data.type === "message" && data.role === "assistant") return [...cards.values()].reverse();
77
- if (data.type !== "tool_result" || data.isError || typeof data.toolName !== "string" || !isRecord(data.details)) continue;
78
- if (data.details.timed_out === true) continue;
79
- if (Array.isArray(data.details.removedCards)) for (const ref of messageCardRefSchema.array().parse(data.details.removedCards)) deleted.add(JSON.stringify([ref.plugin, ref.key]));
80
- for (const card of readMessageCards(data.details)) {
81
- const key = messageCardKey(card);
82
- if (!deleted.has(key) && !cards.has(key)) cards.set(key, card);
83
- }
84
- }
85
- if (!page.hasOlder || page.events.length === 0) return [...cards.values()].reverse();
86
- beforeSeq = page.events[0].seq;
87
- }
98
+ //#region src/chat/runtime/auth-pause-state.ts
99
+ /** Mark an auth-paused turn complete after private authorization link delivery. */
100
+ function completeAuthPauseTurn(args) {
101
+ markConversationMessage(args.conversation, getTurnUserMessageId(args.conversation, args.sessionId), {
102
+ replied: true,
103
+ skippedReason: void 0
104
+ });
105
+ markTurnClosed({
106
+ conversation: args.conversation,
107
+ nowMs: Date.now(),
108
+ sessionId: args.sessionId
109
+ });
88
110
  }
89
- //#endregion
90
- //#region src/chat/interruption-marker.ts
91
- const INTERRUPTED_MARKER = "\n\n[Response interrupted before completion]";
92
- /** Return the marker added when a visible reply ended mid-execution. */
93
- function getInterruptionMarker() {
94
- return INTERRUPTED_MARKER;
111
+ /** Reload thread state, mark the auth pause as parked, and persist it. */
112
+ async function persistAuthPauseTurnState(args) {
113
+ const currentState = await getPersistedThreadState(args.threadStateId);
114
+ const conversation = coerceThreadConversationState(currentState);
115
+ await hydrateConversationMessages({
116
+ conversation,
117
+ conversationId: args.threadStateId
118
+ });
119
+ completeAuthPauseTurn({
120
+ conversation,
121
+ sessionId: args.sessionId
122
+ });
123
+ await persistThreadStateById(args.threadStateId, { conversation });
95
124
  }
96
125
  //#endregion
97
126
  //#region src/chat/services/turn-failure-response.ts
@@ -171,32 +200,4 @@ function finalizeFailedTurnReplyWithEvent(args) {
171
200
  };
172
201
  }
173
202
  //#endregion
174
- //#region src/chat/runtime/auth-pause-state.ts
175
- /** Mark an auth-paused turn complete after private authorization link delivery. */
176
- function completeAuthPauseTurn(args) {
177
- markConversationMessage(args.conversation, getTurnUserMessageId(args.conversation, args.sessionId), {
178
- replied: true,
179
- skippedReason: void 0
180
- });
181
- markTurnClosed({
182
- conversation: args.conversation,
183
- nowMs: Date.now(),
184
- sessionId: args.sessionId
185
- });
186
- }
187
- /** Reload thread state, mark the auth pause as parked, and persist it. */
188
- async function persistAuthPauseTurnState(args) {
189
- const currentState = await getPersistedThreadState(args.threadStateId);
190
- const conversation = coerceThreadConversationState(currentState);
191
- await hydrateConversationMessages({
192
- conversation,
193
- conversationId: args.threadStateId
194
- });
195
- completeAuthPauseTurn({
196
- conversation,
197
- sessionId: args.sessionId
198
- });
199
- await persistThreadStateById(args.threadStateId, { conversation });
200
- }
201
- //#endregion
202
- export { requireTurnFailureEventId as a, getTurnUserMessage as c, getTurnUserSlackMessageTs as d, buildDeliveredTurnStatePatch as f, getAgentTurnDiagnosticsAttributes as i, getTurnUserMessageId as l, persistAuthPauseTurnState as n, getInterruptionMarker as o, finalizeFailedTurnReplyWithEvent as r, loadPendingMessageCards as s, completeAuthPauseTurn as t, getTurnUserReplyAttachmentContext as u };
203
+ export { persistAuthPauseTurnState as a, getTurnUserSlackMessageTs as c, loadPendingMessageCards as d, completeAuthPauseTurn as i, buildDeliveredTurnStatePatch as l, getAgentTurnDiagnosticsAttributes as n, getTurnUserMessage as o, requireTurnFailureEventId as r, getTurnUserReplyAttachmentContext as s, finalizeFailedTurnReplyWithEvent as t, getInterruptionMarker as u };
@@ -1,4 +1,4 @@
1
- import { Wt as getConversationEventStore } from "./agent-hooks-DZU5nsd1.js";
1
+ import { Wt as getConversationEventStore } from "./agent-hooks-DNLBwmsh.js";
2
2
  //#region src/chat/conversations/turn-lifecycle.ts
3
3
  /** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
4
4
  var ConversationTurnLifecycleService = class {