@sentry/junior 0.144.0 → 0.146.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-GCUTGKY3.js → agent-hooks-SLJADYE5.js} +10 -10
- package/dist/api/conversations/detail.d.ts +1 -0
- package/dist/api/schema/conversation.d.ts +2 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +40 -22
- package/dist/app.js +400 -461
- package/dist/{catalog-runtime-DWVYKDC6.js → catalog-runtime-RQIMSDPR.js} +5 -5
- package/dist/chat/agent/request.d.ts +1 -1
- package/dist/chat/agent/resume.d.ts +6 -18
- package/dist/chat/agent/skills.d.ts +0 -1
- package/dist/chat/agent/tools.d.ts +1 -2
- package/dist/chat/agent-dispatch/types.d.ts +1 -1
- package/dist/chat/app/conversation-work.d.ts +24 -0
- package/dist/chat/conversations/message-search.d.ts +32 -0
- package/dist/chat/conversations/projection.d.ts +11 -3
- package/dist/chat/conversations/sql/message-search.d.ts +4 -0
- package/dist/chat/conversations/store.d.ts +1 -1
- package/dist/chat/conversations/tool-source.d.ts +5 -0
- package/dist/chat/db.d.ts +2 -2
- package/dist/chat/runtime/agent-run-outcome.d.ts +1 -1
- package/dist/chat/runtime/reply-executor.d.ts +5 -5
- package/dist/chat/runtime/slack-resume.d.ts +12 -4
- package/dist/chat/slack/message/attachments.d.ts +2 -0
- package/dist/chat/slack/message/blocks.d.ts +2 -0
- package/dist/chat/slack/message/content.d.ts +18 -0
- package/dist/chat/slack/message/identity.d.ts +7 -0
- package/dist/chat/slack/tools/{conversation-search.d.ts → conversation-message-search.d.ts} +21 -14
- package/dist/chat/slack/tools/user-lookup.d.ts +2 -1
- package/dist/chat/state/locks.d.ts +28 -0
- package/dist/chat/task-execution/checkpoint.d.ts +84 -0
- package/dist/chat/task-execution/paused-turn.d.ts +29 -0
- package/dist/chat/task-execution/queue-signing.d.ts +1 -0
- package/dist/chat/task-execution/queue.d.ts +7 -1
- package/dist/chat/task-execution/slack-work.d.ts +1 -1
- package/dist/chat/task-execution/state.d.ts +4 -4
- package/dist/chat/task-execution/store.d.ts +2 -2
- package/dist/chat/task-execution/turn-cursor-keys.d.ts +6 -0
- package/dist/chat/{state/turn-session.d.ts → task-execution/turn-cursor.d.ts} +52 -51
- package/dist/chat/task-execution/turn-wake.d.ts +29 -0
- package/dist/chat/tools/{query-conversation-events.d.ts → search-conversation-events.d.ts} +3 -3
- package/dist/chat/tools/types.d.ts +1 -1
- package/dist/{chunk-SBZP2J5Q.js → chunk-37EVZP66.js} +48 -35
- package/dist/{chunk-A67GZN73.js → chunk-37JJDS4H.js} +1 -1
- package/dist/{chunk-BBCWYXHB.js → chunk-47OSH2ZO.js} +7 -7
- package/dist/{chunk-4X5KM7Z6.js → chunk-AISNSNDV.js} +14 -14
- package/dist/{chunk-RIFJUJSI.js → chunk-B63BF443.js} +1 -1
- package/dist/{chunk-SSDTQDYQ.js → chunk-BLETMLRX.js} +566 -268
- package/dist/{chunk-I44JB7HQ.js → chunk-F7REGDKO.js} +1 -1
- package/dist/{chunk-DVO5VKYQ.js → chunk-FEKQHPVA.js} +5 -5
- package/dist/{chunk-SUK7NC5A.js → chunk-FGHADGIC.js} +2 -2
- package/dist/{chunk-7KAW7UF4.js → chunk-FXDDDSPL.js} +4 -4
- package/dist/{chunk-BEGGFVFR.js → chunk-GDQEU4I7.js} +414 -542
- package/dist/{chunk-UDQMY6RS.js → chunk-GYEKOX7N.js} +43 -1
- package/dist/{chunk-W7JFV5SB.js → chunk-H6U2U3EP.js} +14 -17
- package/dist/{chunk-WTX2RFJG.js → chunk-HQE6EJS5.js} +1 -1
- package/dist/{chunk-IUFM5JWV.js → chunk-JAL3CH4G.js} +3 -0
- package/dist/{chunk-E7HCWOHG.js → chunk-JLMVCNXL.js} +2 -1
- package/dist/{chunk-PELZ2ZSY.js → chunk-JUA6VU2Z.js} +33 -63
- package/dist/{chunk-SHEEZSLY.js → chunk-LVW7BLLT.js} +2 -2
- package/dist/{chunk-GKA74DRA.js → chunk-M6ZWP4RI.js} +1 -1
- package/dist/{chunk-HNO2E5WB.js → chunk-MCFIXAV5.js} +1 -1
- package/dist/{chunk-3GU4PWA3.js → chunk-MKRIZ4VG.js} +29 -30
- package/dist/{chunk-QUZJDAQQ.js → chunk-OFPYOC3M.js} +93 -90
- package/dist/{chunk-ZF3N3JD6.js → chunk-PB222GIA.js} +1 -1
- package/dist/{chunk-PKH6762I.js → chunk-PH4Q3A6W.js} +1 -1
- package/dist/{chunk-STFCL3K4.js → chunk-QG7OOKIN.js} +1 -1
- package/dist/{chunk-WSOLZJJS.js → chunk-QSXZ42KX.js} +3 -3
- package/dist/{chunk-44RJWAND.js → chunk-SCGVWUZX.js} +6 -6
- package/dist/{chunk-CNTWB2SM.js → chunk-T5GXFFLA.js} +1 -1
- package/dist/{chunk-LDWNYCZ6.js → chunk-TCEJ7XXM.js} +1 -1
- package/dist/{chunk-QE3TICD4.js → chunk-V6SRLKUB.js} +2 -2
- package/dist/{chunk-54JMYQYS.js → chunk-W65V465O.js} +2 -2
- package/dist/{chunk-KCBZSJRU.js → chunk-WR76IVA5.js} +5 -2
- package/dist/{chunk-ZZCTGAIT.js → chunk-X22KCSCO.js} +4 -4
- package/dist/{chunk-HD6BHR25.js → chunk-X2WMBTS3.js} +32 -34
- package/dist/{chunk-KQBXT5B7.js → chunk-ZDGHGY74.js} +6 -6
- package/dist/cli/chat.js +32 -32
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +13 -13
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +7 -7
- package/dist/{db-EFLHTBU6.js → db-WWOMXWTT.js} +9 -9
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +4 -4
- package/dist/{oauth-callback-server-RO3IQKWM.js → oauth-callback-server-A6ZZX74U.js} +25 -25
- package/dist/{runner-LOWW7JKA.js → runner-KSGB2UAV.js} +19 -20
- package/dist/{skills-ZLMUG7AE.js → skills-26QPWKVS.js} +6 -6
- package/dist/spawn-5LAJXZ2P.js +39 -0
- package/dist/{validation-MAKEZNTS.js → validation-OPSRGFGH.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-5OAGC3I4.js → work-VMSW7STJ.js} +17 -16
- package/dist/worker-2JNFB7C7.js +24 -0
- package/package.json +5 -5
- package/dist/chat/agent/session.d.ts +0 -19
- package/dist/chat/conversations/search.d.ts +0 -24
- package/dist/chat/conversations/sql/search.d.ts +0 -4
- package/dist/chat/runtime/agent-continue-runner.d.ts +0 -37
- package/dist/chat/services/agent-continue.d.ts +0 -29
- package/dist/chat/services/turn-session-record.d.ts +0 -164
- package/dist/chat/slack/legacy-attachments.d.ts +0 -4
- package/dist/chat/slack/message.d.ts +0 -12
- package/dist/chat/state/turn-session-keys.d.ts +0 -6
- package/dist/spawn-R3LUV6RF.js +0 -38
- package/dist/worker-KTGGRTTP.js +0 -24
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
ensureConversationWake,
|
|
6
6
|
requestConversationWork
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-X2WMBTS3.js";
|
|
8
8
|
import {
|
|
9
9
|
buildConversationContext,
|
|
10
10
|
buildDeliveredTurnStatePatch,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
resolveTurnSessionRouting,
|
|
22
22
|
scheduleSessionCompletedPluginTasks,
|
|
23
23
|
turnHasReply
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-H6U2U3EP.js";
|
|
25
25
|
import {
|
|
26
26
|
ConversationTurnLifecycleService
|
|
27
27
|
} from "./chunk-Q6QZTTLS.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
} from "./chunk-4CODA7P5.js";
|
|
31
31
|
import {
|
|
32
32
|
getVercelConversationWorkQueue
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-WR76IVA5.js";
|
|
34
34
|
import {
|
|
35
35
|
createUserTokenStore,
|
|
36
36
|
deleteMcpAuthSession,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
getMcpProviderErrorAttributes,
|
|
40
40
|
getMcpStoredOAuthCredentials,
|
|
41
41
|
resolvePluginOAuthAccount
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-47OSH2ZO.js";
|
|
43
43
|
import {
|
|
44
44
|
RetryableDeliveryError
|
|
45
45
|
} from "./chunk-R776HKPK.js";
|
|
@@ -55,58 +55,59 @@ import {
|
|
|
55
55
|
removeReactionFromMessage,
|
|
56
56
|
resolveBaseUrl,
|
|
57
57
|
truncateStatusText
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-ZDGHGY74.js";
|
|
59
59
|
import {
|
|
60
60
|
TurnSliceLimitExceededError,
|
|
61
|
-
|
|
61
|
+
abandonTurnRecord,
|
|
62
62
|
buildTurnLimitResponse,
|
|
63
63
|
clearPendingAuth,
|
|
64
64
|
coerceThreadArtifactsState,
|
|
65
65
|
coerceThreadConversationState,
|
|
66
66
|
commitAcceptedReply,
|
|
67
|
-
|
|
68
|
-
getAgentTurnSessionRecord,
|
|
67
|
+
failTurnRecord,
|
|
69
68
|
getAssistantReplyText,
|
|
70
69
|
getChannelConfigurationServiceById,
|
|
71
70
|
getConversationPendingAuth,
|
|
72
71
|
getPersistedSandboxState,
|
|
73
72
|
getPersistedThreadState,
|
|
73
|
+
getTurnRecord,
|
|
74
74
|
hydrateConversationMessages,
|
|
75
75
|
isPendingAuthLatestRequest,
|
|
76
76
|
loadProjection,
|
|
77
|
+
loadTurnCheckpoint,
|
|
77
78
|
markTurnFailed,
|
|
78
|
-
persistCompletedSessionRecord,
|
|
79
79
|
persistThreadStateById,
|
|
80
80
|
persistWithRetry,
|
|
81
|
-
recordAgentTurnSessionSummary,
|
|
82
81
|
recordAuthenticationLinked,
|
|
83
|
-
recordAuthorizationCompleted
|
|
84
|
-
|
|
82
|
+
recordAuthorizationCompleted,
|
|
83
|
+
recordTurnSummary,
|
|
84
|
+
saveTurnCheckpoint
|
|
85
|
+
} from "./chunk-GDQEU4I7.js";
|
|
85
86
|
import {
|
|
86
87
|
parseSlackThreadId,
|
|
87
88
|
readSlackRawMessageContext,
|
|
88
89
|
resolveSlackChannelIdFromMessage,
|
|
89
90
|
resolveSlackChannelIdFromThreadId
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-PH4Q3A6W.js";
|
|
91
92
|
import {
|
|
92
93
|
getDashboardConversationLink,
|
|
93
94
|
getPluginSlackConversationLink
|
|
94
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-SCGVWUZX.js";
|
|
95
96
|
import {
|
|
96
97
|
SlackActionError,
|
|
97
98
|
getHeaderString,
|
|
98
99
|
getSlackClient,
|
|
99
100
|
isDmChannel,
|
|
100
101
|
normalizeSlackConversationId
|
|
101
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-V6SRLKUB.js";
|
|
102
103
|
import {
|
|
103
104
|
getConversationEventStore,
|
|
104
105
|
requireSlackDestination
|
|
105
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-37EVZP66.js";
|
|
106
107
|
import {
|
|
107
108
|
acquireActiveLock,
|
|
108
109
|
getStateAdapter
|
|
109
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-GYEKOX7N.js";
|
|
110
111
|
import {
|
|
111
112
|
FUNCTION_TIMEOUT_BUFFER_SECONDS,
|
|
112
113
|
botConfig,
|
|
@@ -115,18 +116,18 @@ import {
|
|
|
115
116
|
getRuntimeMetadata,
|
|
116
117
|
normalizeSlackEmojiName,
|
|
117
118
|
standardModelId
|
|
118
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-MKRIZ4VG.js";
|
|
119
120
|
import {
|
|
120
121
|
discoverSkills
|
|
121
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-FGHADGIC.js";
|
|
122
123
|
import {
|
|
123
124
|
pluginCatalogRuntime
|
|
124
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-PB222GIA.js";
|
|
125
126
|
import {
|
|
126
127
|
buildOAuthTokenRequest,
|
|
127
128
|
hasRequiredOAuthScope,
|
|
128
129
|
parseOAuthTokenResponse
|
|
129
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-37JJDS4H.js";
|
|
130
131
|
import {
|
|
131
132
|
createSlackResumeActor,
|
|
132
133
|
isUserActor
|
|
@@ -142,7 +143,7 @@ import {
|
|
|
142
143
|
setTags,
|
|
143
144
|
toOptionalString,
|
|
144
145
|
withLogContext
|
|
145
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-B63BF443.js";
|
|
146
147
|
import {
|
|
147
148
|
homeDir
|
|
148
149
|
} from "./chunk-H4HBKISO.js";
|
|
@@ -1319,8 +1320,8 @@ async function resumeSlackTurnInContext(args) {
|
|
|
1319
1320
|
const stateAdapter = getStateAdapter();
|
|
1320
1321
|
await stateAdapter.connect();
|
|
1321
1322
|
const lockKey = args.lockKey ?? getDefaultLockKey(args.channelId, args.threadTs);
|
|
1322
|
-
const lock = await acquireActiveLock(stateAdapter, lockKey);
|
|
1323
|
-
if (!lock) {
|
|
1323
|
+
const lock = args.ownsConversationLease ? void 0 : await acquireActiveLock(stateAdapter, lockKey);
|
|
1324
|
+
if (!args.ownsConversationLease && !lock) {
|
|
1324
1325
|
throw new ResumeTurnBusyError(lockKey);
|
|
1325
1326
|
}
|
|
1326
1327
|
const status = createSlackWebApiAssistantStatusSession({
|
|
@@ -1490,13 +1491,13 @@ async function resumeSlackTurnInContext(args) {
|
|
|
1490
1491
|
if (messageTs && dispatchId && routing) {
|
|
1491
1492
|
try {
|
|
1492
1493
|
await persistWithRetry(
|
|
1493
|
-
() =>
|
|
1494
|
+
() => recordTurnSummary({
|
|
1494
1495
|
conversationId: runArgs.conversationId,
|
|
1495
1496
|
destination: routing.destination,
|
|
1496
1497
|
destinationVisibility: routing.destinationVisibility,
|
|
1497
1498
|
dispatchId,
|
|
1498
1499
|
resultMessageId: messageTs,
|
|
1499
|
-
|
|
1500
|
+
turnId: runArgs.turnId,
|
|
1500
1501
|
sliceId: runArgs.sliceId ?? 1,
|
|
1501
1502
|
source: routing.source,
|
|
1502
1503
|
state: "running",
|
|
@@ -1591,13 +1592,13 @@ async function resumeSlackTurnInContext(args) {
|
|
|
1591
1592
|
await status.clear();
|
|
1592
1593
|
failureCode = "persistence_failed";
|
|
1593
1594
|
if (reply.piMessages?.length) {
|
|
1594
|
-
await
|
|
1595
|
+
await saveTurnCheckpoint({
|
|
1596
|
+
mode: "completed",
|
|
1595
1597
|
conversationId: runArgs.conversationId,
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
currentUsage: reply.diagnostics.usage,
|
|
1598
|
+
turnId: runArgs.turnId,
|
|
1599
|
+
messages: reply.piMessages,
|
|
1600
|
+
durationMs: reply.diagnostics.durationMs,
|
|
1601
|
+
usage: reply.diagnostics.usage,
|
|
1601
1602
|
destination: replyContext.routing.destination,
|
|
1602
1603
|
destinationVisibility: replyContext.routing.destinationVisibility,
|
|
1603
1604
|
dispatchId: replyContext.routing.dispatch?.id,
|
|
@@ -1610,14 +1611,14 @@ async function resumeSlackTurnInContext(args) {
|
|
|
1610
1611
|
sliceId: runArgs.sliceId
|
|
1611
1612
|
});
|
|
1612
1613
|
} else if (replyContext.routing.dispatch?.id) {
|
|
1613
|
-
await
|
|
1614
|
+
await recordTurnSummary({
|
|
1614
1615
|
conversationId: runArgs.conversationId,
|
|
1615
1616
|
destination: replyContext.routing.destination,
|
|
1616
1617
|
destinationVisibility: replyContext.routing.destinationVisibility,
|
|
1617
1618
|
dispatchId: replyContext.routing.dispatch?.id,
|
|
1618
1619
|
dispatchOutcome: reply.diagnostics.outcome === "success" ? "completed" : "failed",
|
|
1619
1620
|
...acceptedDeliveryId ? { resultMessageId: acceptedDeliveryId } : {},
|
|
1620
|
-
|
|
1621
|
+
turnId: runArgs.turnId,
|
|
1621
1622
|
sliceId: runArgs.sliceId ?? 1,
|
|
1622
1623
|
source: replyContext.routing.source,
|
|
1623
1624
|
state: reply.diagnostics.outcome === "success" ? "completed" : "failed",
|
|
@@ -1691,7 +1692,9 @@ async function resumeSlackTurnInContext(args) {
|
|
|
1691
1692
|
} else {
|
|
1692
1693
|
await processingReaction?.stop();
|
|
1693
1694
|
}
|
|
1694
|
-
|
|
1695
|
+
if (lock) {
|
|
1696
|
+
await stateAdapter.releaseLock(lock);
|
|
1697
|
+
}
|
|
1695
1698
|
}
|
|
1696
1699
|
if (postDeliveryCommitError) {
|
|
1697
1700
|
const eventId = logException(
|
|
@@ -1743,13 +1746,14 @@ async function resumeSlackTurnInContext(args) {
|
|
|
1743
1746
|
return true;
|
|
1744
1747
|
}
|
|
1745
1748
|
|
|
1746
|
-
// src/chat/
|
|
1747
|
-
async function
|
|
1748
|
-
const
|
|
1749
|
-
args.conversationId,
|
|
1750
|
-
args.
|
|
1751
|
-
);
|
|
1752
|
-
|
|
1749
|
+
// src/chat/task-execution/turn-wake.ts
|
|
1750
|
+
async function getPausedTurnRequest(args) {
|
|
1751
|
+
const checkpoint = await loadTurnCheckpoint({
|
|
1752
|
+
conversationId: args.conversationId,
|
|
1753
|
+
turnId: args.turnId
|
|
1754
|
+
});
|
|
1755
|
+
const turn = checkpoint.record;
|
|
1756
|
+
if (!turn || turn.state !== "paused" || turn.resumeReason !== "timeout" && turn.resumeReason !== "yield" && turn.resumeReason !== "retry" || turn.resumeReason === "timeout" && turn.sliceId < 2) {
|
|
1753
1757
|
return void 0;
|
|
1754
1758
|
}
|
|
1755
1759
|
let routing;
|
|
@@ -1759,10 +1763,10 @@ async function getAwaitingAgentContinueRequest(args) {
|
|
|
1759
1763
|
conversationStore: args.conversationStore
|
|
1760
1764
|
});
|
|
1761
1765
|
} catch (error) {
|
|
1762
|
-
await
|
|
1766
|
+
await failTurnRecord({
|
|
1763
1767
|
conversationId: args.conversationId,
|
|
1764
|
-
expectedVersion:
|
|
1765
|
-
|
|
1768
|
+
expectedVersion: turn.version,
|
|
1769
|
+
turnId: args.turnId,
|
|
1766
1770
|
errorMessage: error instanceof Error ? error.message : String(error)
|
|
1767
1771
|
});
|
|
1768
1772
|
return void 0;
|
|
@@ -1770,11 +1774,11 @@ async function getAwaitingAgentContinueRequest(args) {
|
|
|
1770
1774
|
return {
|
|
1771
1775
|
conversationId: args.conversationId,
|
|
1772
1776
|
destination: routing.destination,
|
|
1773
|
-
|
|
1774
|
-
expectedVersion:
|
|
1777
|
+
turnId: args.turnId,
|
|
1778
|
+
expectedVersion: turn.version
|
|
1775
1779
|
};
|
|
1776
1780
|
}
|
|
1777
|
-
async function
|
|
1781
|
+
async function wakePausedTurn(request, options = {}) {
|
|
1778
1782
|
const nowMs = options.nowMs ?? Date.now();
|
|
1779
1783
|
await requestConversationWork({
|
|
1780
1784
|
conversationId: request.conversationId,
|
|
@@ -1788,7 +1792,7 @@ async function scheduleAgentContinue(request, options = {}) {
|
|
|
1788
1792
|
idempotencyKey: [
|
|
1789
1793
|
"agent-continue",
|
|
1790
1794
|
request.conversationId,
|
|
1791
|
-
request.
|
|
1795
|
+
request.turnId,
|
|
1792
1796
|
request.expectedVersion,
|
|
1793
1797
|
nowMs
|
|
1794
1798
|
].join(":"),
|
|
@@ -1896,9 +1900,9 @@ async function persistCompletedReplyState(channelId, threadTs, sessionId, reply)
|
|
|
1896
1900
|
}
|
|
1897
1901
|
async function failSessionRecordBestEffort(args) {
|
|
1898
1902
|
try {
|
|
1899
|
-
await
|
|
1903
|
+
await failTurnRecord({
|
|
1900
1904
|
conversationId: args.conversationId,
|
|
1901
|
-
|
|
1905
|
+
turnId: args.turnId,
|
|
1902
1906
|
errorMessage: args.errorMessage,
|
|
1903
1907
|
expectedVersion: args.expectedVersion
|
|
1904
1908
|
});
|
|
@@ -1908,7 +1912,7 @@ async function failSessionRecordBestEffort(args) {
|
|
|
1908
1912
|
"mcp.oauth_callback.session_record.failure_persistence.failed",
|
|
1909
1913
|
{
|
|
1910
1914
|
"app.ai.conversation_id": args.conversationId,
|
|
1911
|
-
"app.ai.session_id": args.
|
|
1915
|
+
"app.ai.session_id": args.turnId
|
|
1912
1916
|
}
|
|
1913
1917
|
);
|
|
1914
1918
|
}
|
|
@@ -1928,7 +1932,7 @@ async function persistFailedReplyState(channelId, threadTs, sessionId, expectedV
|
|
|
1928
1932
|
});
|
|
1929
1933
|
await failSessionRecordBestEffort({
|
|
1930
1934
|
conversationId: threadId,
|
|
1931
|
-
sessionId,
|
|
1935
|
+
turnId: sessionId,
|
|
1932
1936
|
errorMessage: "OAuth-resumed MCP turn failed",
|
|
1933
1937
|
expectedVersion
|
|
1934
1938
|
});
|
|
@@ -1963,9 +1967,9 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
1963
1967
|
if (!isPendingAuthLatestRequest(conversation, pendingAuth)) {
|
|
1964
1968
|
clearPendingAuth(conversation, pendingAuth.sessionId);
|
|
1965
1969
|
await persistThreadStateById(threadId, { conversation });
|
|
1966
|
-
await
|
|
1970
|
+
await abandonTurnRecord({
|
|
1967
1971
|
conversationId: authSession.conversationId,
|
|
1968
|
-
|
|
1972
|
+
turnId: pendingAuth.sessionId,
|
|
1969
1973
|
errorMessage: "Auth completed after a newer thread message abandoned this blocked request."
|
|
1970
1974
|
});
|
|
1971
1975
|
return;
|
|
@@ -2009,9 +2013,9 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
2009
2013
|
await persistThreadStateById(threadId, {
|
|
2010
2014
|
conversation: lockedConversation
|
|
2011
2015
|
});
|
|
2012
|
-
await
|
|
2016
|
+
await abandonTurnRecord({
|
|
2013
2017
|
conversationId: authSession.conversationId,
|
|
2014
|
-
|
|
2018
|
+
turnId: lockedPendingAuth.sessionId,
|
|
2015
2019
|
errorMessage: "Auth completed after a newer thread message abandoned this blocked request."
|
|
2016
2020
|
});
|
|
2017
2021
|
return false;
|
|
@@ -2023,11 +2027,11 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
2023
2027
|
if (!lockedUserMessage) {
|
|
2024
2028
|
return false;
|
|
2025
2029
|
}
|
|
2026
|
-
const lockedSessionRecord = await
|
|
2030
|
+
const lockedSessionRecord = await getTurnRecord(
|
|
2027
2031
|
authSession.conversationId,
|
|
2028
2032
|
lockedSessionId
|
|
2029
2033
|
);
|
|
2030
|
-
if (!lockedSessionRecord || lockedSessionRecord.state !== "
|
|
2034
|
+
if (!lockedSessionRecord || lockedSessionRecord.state !== "paused" || lockedSessionRecord.resumeReason !== "auth") {
|
|
2031
2035
|
return false;
|
|
2032
2036
|
}
|
|
2033
2037
|
const lockedConversationContext = buildConversationContext(
|
|
@@ -2046,10 +2050,10 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
2046
2050
|
userId: authSession.userId
|
|
2047
2051
|
});
|
|
2048
2052
|
} catch {
|
|
2049
|
-
await
|
|
2053
|
+
await failTurnRecord({
|
|
2050
2054
|
conversationId: authSession.conversationId,
|
|
2051
2055
|
expectedVersion: lockedSessionRecord.version,
|
|
2052
|
-
|
|
2056
|
+
turnId: lockedSessionId,
|
|
2053
2057
|
errorMessage: "Unable to rebuild Slack actor for OAuth resume"
|
|
2054
2058
|
});
|
|
2055
2059
|
return false;
|
|
@@ -2060,10 +2064,10 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
2060
2064
|
conversationId: authSession.conversationId
|
|
2061
2065
|
});
|
|
2062
2066
|
} catch (error) {
|
|
2063
|
-
await
|
|
2067
|
+
await failTurnRecord({
|
|
2064
2068
|
conversationId: authSession.conversationId,
|
|
2065
2069
|
expectedVersion: lockedSessionRecord.version,
|
|
2066
|
-
|
|
2070
|
+
turnId: lockedSessionId,
|
|
2067
2071
|
errorMessage: error instanceof Error ? error.message : String(error)
|
|
2068
2072
|
});
|
|
2069
2073
|
return false;
|
|
@@ -2128,10 +2132,10 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
2128
2132
|
);
|
|
2129
2133
|
},
|
|
2130
2134
|
onPostDeliveryCommitFailure: async () => {
|
|
2131
|
-
await
|
|
2135
|
+
await failTurnRecord({
|
|
2132
2136
|
conversationId: authSession.conversationId,
|
|
2133
2137
|
expectedVersion: lockedSessionRecord.version,
|
|
2134
|
-
|
|
2138
|
+
turnId: lockedSessionId,
|
|
2135
2139
|
errorMessage: "OAuth-resumed MCP reply was delivered but completion state did not persist"
|
|
2136
2140
|
});
|
|
2137
2141
|
},
|
|
@@ -2161,10 +2165,10 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
2161
2165
|
});
|
|
2162
2166
|
},
|
|
2163
2167
|
onSuspend: async (resumeVersion) => {
|
|
2164
|
-
await
|
|
2168
|
+
await wakePausedTurn({
|
|
2165
2169
|
conversationId: authSession.conversationId,
|
|
2166
2170
|
destination,
|
|
2167
|
-
|
|
2171
|
+
turnId: lockedSessionId,
|
|
2168
2172
|
expectedVersion: resumeVersion
|
|
2169
2173
|
});
|
|
2170
2174
|
}
|
|
@@ -2501,10 +2505,10 @@ function pluginAuthorizationId(args) {
|
|
|
2501
2505
|
}
|
|
2502
2506
|
async function failSessionRecordBestEffort2(args) {
|
|
2503
2507
|
try {
|
|
2504
|
-
await
|
|
2508
|
+
await failTurnRecord({
|
|
2505
2509
|
conversationId: args.conversationId,
|
|
2506
2510
|
expectedVersion: args.expectedVersion,
|
|
2507
|
-
|
|
2511
|
+
turnId: args.turnId,
|
|
2508
2512
|
errorMessage: args.errorMessage
|
|
2509
2513
|
});
|
|
2510
2514
|
} catch (error) {
|
|
@@ -2513,7 +2517,7 @@ async function failSessionRecordBestEffort2(args) {
|
|
|
2513
2517
|
"oauth.callback.session_record.failure_persistence.failed",
|
|
2514
2518
|
{
|
|
2515
2519
|
"app.ai.conversation_id": args.conversationId,
|
|
2516
|
-
"app.ai.session_id": args.
|
|
2520
|
+
"app.ai.session_id": args.turnId
|
|
2517
2521
|
}
|
|
2518
2522
|
);
|
|
2519
2523
|
}
|
|
@@ -2536,7 +2540,7 @@ async function persistFailedOAuthReplyState(args) {
|
|
|
2536
2540
|
await failSessionRecordBestEffort2({
|
|
2537
2541
|
conversationId: args.conversationId,
|
|
2538
2542
|
expectedVersion: args.expectedVersion,
|
|
2539
|
-
|
|
2543
|
+
turnId: args.sessionId,
|
|
2540
2544
|
errorMessage: "OAuth-resumed turn failed"
|
|
2541
2545
|
});
|
|
2542
2546
|
await persistThreadStateById(args.conversationId, {
|
|
@@ -2574,15 +2578,15 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2574
2578
|
await persistThreadStateById(stored.resumeConversationId, {
|
|
2575
2579
|
conversation
|
|
2576
2580
|
});
|
|
2577
|
-
await
|
|
2581
|
+
await abandonTurnRecord({
|
|
2578
2582
|
conversationId: stored.resumeConversationId,
|
|
2579
|
-
|
|
2583
|
+
turnId: pendingAuth.sessionId,
|
|
2580
2584
|
errorMessage: "Auth completed after a newer thread message abandoned this blocked request."
|
|
2581
2585
|
});
|
|
2582
2586
|
return;
|
|
2583
2587
|
}
|
|
2584
2588
|
}
|
|
2585
|
-
const sessionRecord = await
|
|
2589
|
+
const sessionRecord = await getTurnRecord(
|
|
2586
2590
|
stored.resumeConversationId,
|
|
2587
2591
|
resolvedSessionId
|
|
2588
2592
|
);
|
|
@@ -2592,7 +2596,7 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2592
2596
|
if (sessionRecord.state === "completed" || sessionRecord.state === "failed" || sessionRecord.state === "abandoned") {
|
|
2593
2597
|
return;
|
|
2594
2598
|
}
|
|
2595
|
-
if (sessionRecord.state !== "
|
|
2599
|
+
if (sessionRecord.state !== "paused" || sessionRecord.resumeReason !== "auth") {
|
|
2596
2600
|
return;
|
|
2597
2601
|
}
|
|
2598
2602
|
if (!userMessage?.author?.userId) {
|
|
@@ -2632,11 +2636,11 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2632
2636
|
if (lockedSessionId !== resolvedSessionId) {
|
|
2633
2637
|
return false;
|
|
2634
2638
|
}
|
|
2635
|
-
const lockedSessionRecord = await
|
|
2639
|
+
const lockedSessionRecord = await getTurnRecord(
|
|
2636
2640
|
stored.resumeConversationId,
|
|
2637
2641
|
lockedSessionId
|
|
2638
2642
|
);
|
|
2639
|
-
if (!lockedSessionRecord || lockedSessionRecord.state !== "
|
|
2643
|
+
if (!lockedSessionRecord || lockedSessionRecord.state !== "paused" || lockedSessionRecord.resumeReason !== "auth") {
|
|
2640
2644
|
return false;
|
|
2641
2645
|
}
|
|
2642
2646
|
if (lockedPendingAuth) {
|
|
@@ -2645,9 +2649,9 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2645
2649
|
await persistThreadStateById(stored.resumeConversationId, {
|
|
2646
2650
|
conversation: lockedConversation
|
|
2647
2651
|
});
|
|
2648
|
-
await
|
|
2652
|
+
await abandonTurnRecord({
|
|
2649
2653
|
conversationId: stored.resumeConversationId,
|
|
2650
|
-
|
|
2654
|
+
turnId: lockedPendingAuth.sessionId,
|
|
2651
2655
|
errorMessage: "Auth completed after a newer thread message abandoned this blocked request."
|
|
2652
2656
|
});
|
|
2653
2657
|
return false;
|
|
@@ -2678,10 +2682,10 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2678
2682
|
userId: lockedUserMessage.author.userId
|
|
2679
2683
|
});
|
|
2680
2684
|
} catch {
|
|
2681
|
-
await
|
|
2685
|
+
await failTurnRecord({
|
|
2682
2686
|
conversationId: stored.resumeConversationId,
|
|
2683
2687
|
expectedVersion: lockedSessionRecord.version,
|
|
2684
|
-
|
|
2688
|
+
turnId: lockedSessionId,
|
|
2685
2689
|
errorMessage: "Unable to rebuild Slack actor for OAuth resume"
|
|
2686
2690
|
});
|
|
2687
2691
|
return false;
|
|
@@ -2692,10 +2696,10 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2692
2696
|
conversationId: stored.resumeConversationId
|
|
2693
2697
|
});
|
|
2694
2698
|
} catch (error) {
|
|
2695
|
-
await
|
|
2699
|
+
await failTurnRecord({
|
|
2696
2700
|
conversationId: stored.resumeConversationId,
|
|
2697
2701
|
expectedVersion: lockedSessionRecord.version,
|
|
2698
|
-
|
|
2702
|
+
turnId: lockedSessionId,
|
|
2699
2703
|
errorMessage: error instanceof Error ? error.message : String(error)
|
|
2700
2704
|
});
|
|
2701
2705
|
return false;
|
|
@@ -2768,10 +2772,10 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2768
2772
|
});
|
|
2769
2773
|
},
|
|
2770
2774
|
onPostDeliveryCommitFailure: async () => {
|
|
2771
|
-
await
|
|
2775
|
+
await failTurnRecord({
|
|
2772
2776
|
conversationId: stored.resumeConversationId,
|
|
2773
2777
|
expectedVersion: lockedSessionRecord.version,
|
|
2774
|
-
|
|
2778
|
+
turnId: lockedSessionId,
|
|
2775
2779
|
errorMessage: "OAuth-resumed reply was delivered but completion state did not persist"
|
|
2776
2780
|
});
|
|
2777
2781
|
},
|
|
@@ -2789,10 +2793,10 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2789
2793
|
});
|
|
2790
2794
|
},
|
|
2791
2795
|
onSuspend: async (resumeVersion) => {
|
|
2792
|
-
await
|
|
2796
|
+
await wakePausedTurn({
|
|
2793
2797
|
conversationId: stored.resumeConversationId,
|
|
2794
2798
|
destination,
|
|
2795
|
-
|
|
2799
|
+
turnId: lockedSessionId,
|
|
2796
2800
|
expectedVersion: resumeVersion
|
|
2797
2801
|
});
|
|
2798
2802
|
}
|
|
@@ -3153,10 +3157,9 @@ export {
|
|
|
3153
3157
|
buildAuthPauseResponse,
|
|
3154
3158
|
getTurnRequestDeadline,
|
|
3155
3159
|
runWithTurnRequestDeadline,
|
|
3156
|
-
ResumeTurnBusyError,
|
|
3157
3160
|
resumeSlackTurn,
|
|
3158
|
-
|
|
3159
|
-
|
|
3161
|
+
getPausedTurnRequest,
|
|
3162
|
+
wakePausedTurn,
|
|
3160
3163
|
GET,
|
|
3161
3164
|
publishAppHomeView,
|
|
3162
3165
|
GET2,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDb
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-37EVZP66.js";
|
|
4
4
|
import {
|
|
5
5
|
juniorConversations,
|
|
6
6
|
juniorTaskExecutions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MCFIXAV5.js";
|
|
8
8
|
import {
|
|
9
9
|
logWarn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-B63BF443.js";
|
|
11
11
|
|
|
12
12
|
// src/chat/tasks/execution-stats.ts
|
|
13
13
|
import {
|
|
@@ -4,30 +4,30 @@ import {
|
|
|
4
4
|
isConversationScopedChannel,
|
|
5
5
|
isDmChannel,
|
|
6
6
|
normalizeSlackConversationId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-V6SRLKUB.js";
|
|
8
8
|
import {
|
|
9
9
|
getConversationEventStore,
|
|
10
10
|
getDb
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-37EVZP66.js";
|
|
12
12
|
import {
|
|
13
13
|
juniorConversationAnnotations,
|
|
14
14
|
juniorConversationEvents,
|
|
15
15
|
juniorIdentities,
|
|
16
16
|
juniorUsers
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MCFIXAV5.js";
|
|
18
18
|
import {
|
|
19
19
|
SANDBOX_WORKSPACE_ROOT
|
|
20
20
|
} from "./chunk-EM225ITJ.js";
|
|
21
21
|
import {
|
|
22
22
|
getStateAdapter
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-GYEKOX7N.js";
|
|
24
24
|
import {
|
|
25
25
|
botConfig,
|
|
26
26
|
completeObject,
|
|
27
27
|
embedTexts,
|
|
28
28
|
getSlackBotToken,
|
|
29
29
|
standardModelId
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-MKRIZ4VG.js";
|
|
31
31
|
import {
|
|
32
32
|
isActorUserId,
|
|
33
33
|
parseActorUserId
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
logInfo,
|
|
43
43
|
logWarn,
|
|
44
44
|
normalizeIdentityEmail
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-B63BF443.js";
|
|
46
46
|
|
|
47
47
|
// src/chat/plugins/agent-hooks.ts
|
|
48
48
|
import {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-EM225ITJ.js";
|
|
4
4
|
import {
|
|
5
5
|
getSlackBotToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MKRIZ4VG.js";
|
|
7
7
|
import {
|
|
8
8
|
parseSlackChannelReferenceId
|
|
9
9
|
} from "./chunk-F3B2YJ76.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
setSpanAttributes,
|
|
13
13
|
setSpanStatus,
|
|
14
14
|
withSpan
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-B63BF443.js";
|
|
16
16
|
|
|
17
17
|
// src/chat/slack/client.ts
|
|
18
18
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|