@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.
- package/dist/{agent-hooks-DZU5nsd1.js → agent-hooks-DNLBwmsh.js} +6 -6
- package/dist/{agent-Bzbf92vv.js → agent-runner-9g6TQk9y.js} +809 -34
- package/dist/api.js +14 -14
- package/dist/app.js +1507 -59
- package/dist/{briefs-BJPfCrlT.js → briefs-CjXnGKzZ.js} +2 -2
- package/dist/{catalog-runtime-BthunUDD.js → catalog-runtime-CVZ9TEuK.js} +1 -1
- package/dist/{checkpoint-Deu-OVb3.js → checkpoint-Ceck_fLO.js} +7 -7
- package/dist/cli/chat.js +14 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +1 -1
- package/dist/cli/plugins.js +3 -3
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-DjC6-6iU.js → client-B27ufhzl.js} +2 -2
- package/dist/{config-CtoUVs72.js → config-BAhl7-RC.js} +2 -2
- package/dist/{conversation-privacy-xS1t92xa.js → conversation-privacy-C-4JQzKD.js} +1 -1
- package/dist/credential-sync-BXHIxbtS.js +940 -0
- package/dist/{execution-stats-CrXs9vSH.js → execution-stats-DikPOxJ1.js} +3 -3
- package/dist/{executor-AOhG9X1t.js → executor-BG2Armby.js} +1 -1
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-CNd9cpIy.js → job-queue-D4oAVrL9.js} +1 -1
- package/dist/{logging-DiN3o3nB.js → logging-iY0ssa2q.js} +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{pending-auth-D7vmttn_.js → oauth-authorization-BIijVS2N.js} +6 -48
- package/dist/{oauth-callback-server-Ca0VLUEw.js → oauth-callback-server-DPkK3kzi.js} +4 -4
- package/dist/{profile-BsNrw8lj.js → profile-6KWhg_-U.js} +5 -9
- package/dist/{registry-Dankt-Pl.js → registry-Ctgdjt-W.js} +1 -1
- package/dist/{resolve-B38CpJe2.js → resolve-CB45ZukQ.js} +2 -2
- package/dist/{runner-Ck5rEjCm.js → runner-BwKCqoF3.js} +8 -9
- package/dist/{sandbox-egress-signals-BOfFkvly.js → sandbox-egress-signals-Cmy8ODat.js} +1 -1
- package/dist/{short-title-BHd_jUFX.js → short-title-xEkZwkcV.js} +2 -2
- package/dist/{skills-DbP4TDft.js → skills-c2bMDVRS.js} +2 -2
- package/dist/{spawn-DzXc_PKO.js → spawn-Cg6lyjE7.js} +2 -2
- package/dist/{stats-pNGp3G5q.js → stats-DP9zl3Jg.js} +6 -6
- package/dist/{task-queue-Cy9y1foT.js → task-queue-SL4uLfBB.js} +3 -3
- package/dist/{task-runner-DI1FBJFJ.js → task-runner-fntmnqzx.js} +8 -83
- package/dist/{thread-state-DXgxOYpZ.js → thread-state-Wfr0GdKS.js} +5 -5
- package/dist/{auth-pause-state-Bn2vX4PA.js → turn-failure-response-DLjSEm-R.js} +73 -72
- package/dist/{turn-lifecycle-Bjf6y2GO.js → turn-lifecycle-5_jvLqRz.js} +1 -1
- package/dist/turn-session-routing-CQaysLoe.js +77 -0
- package/dist/{validation-D5CIslEu.js → validation-CnZkCN7o.js} +1 -1
- package/dist/{version-_ZQFlslB.js → version-C6lA-h_o.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{web-authorization-6mmfS_o-.js → web-authorization-Bbx999_q.js} +1 -1
- package/dist/{web-input-BJpWm6go.js → web-input-BoE1xE-K.js} +7 -7
- package/dist/{work-DvIlJR3C.js → work-4Nhz9mVv.js} +52 -10
- package/dist/{worker-D1qidg-Y.js → worker-CdWPsNL2.js} +5 -5
- package/package.json +4 -4
- package/dist/agent-runner-2VQ9WhkG.js +0 -679
- package/dist/credential-sync-CKdXEUDO.js +0 -2811
- package/dist/experimental-CIXf7Uye.js +0 -46
- package/dist/turn-execution-BNOXrZ-M.js +0 -47
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as logWarn } from "./logging-
|
|
2
|
-
import { in as agentTurnTotalTokens, qt as getDb, rn as agentTurnCostUsd } from "./agent-hooks-
|
|
3
|
-
import { E as juniorConversations, s as juniorAutomationExecutions } from "./executor-
|
|
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-
|
|
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";
|
package/dist/instrumentation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { M as getDeploymentServiceVersion, N as getDeploymentTelemetryAttributes } from "./logging-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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 {
|
|
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/
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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 {
|
|
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 {
|
|
2
|
-
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-
|
|
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(
|
|
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, {
|
|
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-
|
|
2
|
-
import { _ as setSpanAttributes, v as setSpanStatus } from "./logging-
|
|
3
|
-
import { a as getChatConfig } from "./config-
|
|
4
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
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 {
|
|
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-
|
|
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-
|
|
2
|
-
import {
|
|
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 {
|
|
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-
|
|
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 {
|
|
7
|
-
import {
|
|
8
|
-
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-
|
|
9
|
-
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
10
|
-
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
11
|
-
import {
|
|
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 {
|
|
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-
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
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-
|
|
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-
|
|
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 {
|
|
3
|
-
import { n as createAndEnqueueAgentInvocation } from "./work-
|
|
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-
|
|
2
|
-
import { a as getChatConfig } from "./config-
|
|
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-
|
|
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-
|
|
7
|
-
import { t as fallbackShortTitle } from "./short-title-
|
|
8
|
-
import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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 {
|
|
6
|
-
import { w as getStateAdapter } from "./profile-
|
|
7
|
-
import { u as recordAutomationExecution } from "./execution-stats-
|
|
8
|
-
import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
9
|
-
import {
|
|
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 {
|
|
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-
|
|
2
|
-
import { pt as JUNIOR_THREAD_STATE_TTL_MS, qt as getDb } from "./agent-hooks-
|
|
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-
|
|
5
|
-
import {
|
|
6
|
-
import { w as getStateAdapter } from "./profile-
|
|
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 {
|
|
2
|
-
import {
|
|
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-
|
|
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 {
|
|
7
|
-
import { qt as buildDeterministicTurnId } from "./stats-
|
|
8
|
-
import {
|
|
9
|
-
import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
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/
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
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-
|
|
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 {
|