@sentry/junior 0.144.0 → 0.145.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-L7D2BDVV.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 +335 -409
- package/dist/{catalog-runtime-DWVYKDC6.js → catalog-runtime-QLAC4Q3W.js} +5 -5
- package/dist/chat/agent/request.d.ts +1 -1
- package/dist/chat/agent/resume.d.ts +6 -15
- package/dist/chat/agent/tools.d.ts +1 -1
- package/dist/chat/agent-dispatch/types.d.ts +1 -1
- package/dist/chat/app/conversation-work.d.ts +24 -0
- package/dist/chat/conversations/projection.d.ts +11 -3
- package/dist/chat/conversations/store.d.ts +1 -1
- 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/state/locks.d.ts +28 -0
- package/dist/chat/task-execution/checkpoint.d.ts +86 -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 -42
- package/dist/chat/task-execution/turn-wake.d.ts +29 -0
- package/dist/chat/tools/types.d.ts +1 -1
- package/dist/{chunk-HNO2E5WB.js → chunk-27TEJTZO.js} +1 -1
- package/dist/{chunk-RIFJUJSI.js → chunk-2LWPFSB4.js} +1 -1
- package/dist/{chunk-SBZP2J5Q.js → chunk-2UH3JI64.js} +10 -9
- package/dist/{chunk-QUZJDAQQ.js → chunk-2XET6PKP.js} +93 -89
- package/dist/{chunk-SUK7NC5A.js → chunk-5PNPQYTO.js} +2 -2
- package/dist/{chunk-SSDTQDYQ.js → chunk-64SBYW2O.js} +132 -127
- package/dist/{chunk-DVO5VKYQ.js → chunk-B46ZMVOV.js} +5 -5
- package/dist/{chunk-A67GZN73.js → chunk-CD2XFGYQ.js} +1 -1
- package/dist/{chunk-WTX2RFJG.js → chunk-DS3J6WGY.js} +1 -1
- package/dist/{chunk-PKH6762I.js → chunk-DXEQAIUV.js} +1 -1
- package/dist/{chunk-WSOLZJJS.js → chunk-EIX2LQ6L.js} +3 -3
- package/dist/{chunk-KQBXT5B7.js → chunk-FUBRJA5F.js} +6 -6
- package/dist/{chunk-I44JB7HQ.js → chunk-GDV5LXRA.js} +1 -1
- package/dist/{chunk-7KAW7UF4.js → chunk-GUWLDMGF.js} +4 -4
- package/dist/{chunk-PELZ2ZSY.js → chunk-HISR3DTV.js} +33 -61
- package/dist/{chunk-HD6BHR25.js → chunk-HLOUZC5C.js} +32 -34
- package/dist/{chunk-BBCWYXHB.js → chunk-I47UGQPJ.js} +7 -7
- package/dist/{chunk-IUFM5JWV.js → chunk-JAL3CH4G.js} +3 -0
- package/dist/{chunk-E7HCWOHG.js → chunk-JLMVCNXL.js} +2 -1
- package/dist/{chunk-STFCL3K4.js → chunk-JTGS3ZZE.js} +1 -1
- package/dist/{chunk-GKA74DRA.js → chunk-LVVSIMBB.js} +1 -1
- package/dist/{chunk-SHEEZSLY.js → chunk-PJ4NMVQB.js} +2 -2
- package/dist/{chunk-W7JFV5SB.js → chunk-QJBDABQA.js} +14 -17
- package/dist/{chunk-UDQMY6RS.js → chunk-QUG4JSZK.js} +43 -1
- package/dist/{chunk-4X5KM7Z6.js → chunk-RUSS62EN.js} +14 -14
- package/dist/{chunk-ZF3N3JD6.js → chunk-SIN3MXH6.js} +1 -1
- package/dist/{chunk-QE3TICD4.js → chunk-TZRXYWRE.js} +2 -2
- package/dist/{chunk-CNTWB2SM.js → chunk-VTDMB7XX.js} +1 -1
- package/dist/{chunk-LDWNYCZ6.js → chunk-WF5HVH3M.js} +1 -1
- package/dist/{chunk-KCBZSJRU.js → chunk-WR76IVA5.js} +5 -2
- package/dist/{chunk-3GU4PWA3.js → chunk-XFKIRN3Q.js} +29 -29
- package/dist/{chunk-ZZCTGAIT.js → chunk-YD54Q45G.js} +4 -4
- package/dist/{chunk-BEGGFVFR.js → chunk-ZIAMN2UW.js} +407 -523
- package/dist/{chunk-44RJWAND.js → chunk-ZIMRGFYL.js} +6 -6
- package/dist/{chunk-54JMYQYS.js → chunk-ZYAJMESY.js} +2 -2
- 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-62PW6LM3.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +4 -4
- package/dist/{oauth-callback-server-RO3IQKWM.js → oauth-callback-server-6NZNHJAM.js} +25 -25
- package/dist/{runner-LOWW7JKA.js → runner-GCRPG3GQ.js} +19 -18
- package/dist/{skills-ZLMUG7AE.js → skills-2S3MDFIQ.js} +6 -6
- package/dist/spawn-7WK37BTD.js +39 -0
- package/dist/{validation-MAKEZNTS.js → validation-HAOLCJ5A.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-5OAGC3I4.js → work-R4XYKMUW.js} +17 -16
- package/dist/worker-U2UCVR7M.js +24 -0
- package/package.json +4 -4
- package/dist/chat/agent/session.d.ts +0 -19
- 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/state/turn-session-keys.d.ts +0 -6
- package/dist/spawn-R3LUV6RF.js +0 -38
- package/dist/worker-KTGGRTTP.js +0 -24
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
PluginCredentialFailureError,
|
|
8
8
|
agentNameSchema,
|
|
9
9
|
createPluginAuthOrchestration
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-B46ZMVOV.js";
|
|
11
11
|
import {
|
|
12
12
|
authorizationId
|
|
13
13
|
} from "./chunk-DIB4GX3G.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
patchMcpAuthSession,
|
|
29
29
|
selectPluginGrant,
|
|
30
30
|
toMcpProviderError
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-I47UGQPJ.js";
|
|
32
32
|
import {
|
|
33
33
|
RetryableDeliveryError,
|
|
34
34
|
actorFromRouting,
|
|
@@ -44,12 +44,12 @@ import {
|
|
|
44
44
|
getSlackMessagePermalink,
|
|
45
45
|
resolveBaseUrl,
|
|
46
46
|
uploadFilesToConversation
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-FUBRJA5F.js";
|
|
48
48
|
import {
|
|
49
49
|
estimateTextTokens,
|
|
50
50
|
getAgentContextCompactionTriggerTokens,
|
|
51
51
|
getAgentContextInputLimitTokens
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-VTDMB7XX.js";
|
|
53
53
|
import {
|
|
54
54
|
AGENTS_REMOVAL_NOTICE,
|
|
55
55
|
AGENTS_REPLACEMENT_NOTICE,
|
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
canReusePendingAuthLink,
|
|
67
67
|
collectFiles,
|
|
68
68
|
containsNoReplyMarker,
|
|
69
|
+
continuableMessages,
|
|
69
70
|
decideReply,
|
|
70
71
|
extractAssistantText,
|
|
71
72
|
findSingleRepositoryDirectory,
|
|
@@ -86,17 +87,13 @@ import {
|
|
|
86
87
|
isTurnInputCommitLostError,
|
|
87
88
|
loadConnectedMcpProviders,
|
|
88
89
|
loadConversationProjection,
|
|
90
|
+
loadTurnCheckpoint,
|
|
89
91
|
loadTurnRoute,
|
|
90
|
-
loadTurnSessionRecord,
|
|
91
92
|
mergeArtifactsState,
|
|
92
93
|
missingPathSearchResult,
|
|
93
94
|
normalizeToLf,
|
|
94
95
|
normalizeToolNameFromResult,
|
|
95
96
|
openConversationProjection,
|
|
96
|
-
persistAuthPauseSessionRecord,
|
|
97
|
-
persistContinuationSessionRecord,
|
|
98
|
-
persistRunningSessionRecord,
|
|
99
|
-
persistYieldSessionRecord,
|
|
100
97
|
piMessageFromHistoryItem,
|
|
101
98
|
positiveInteger,
|
|
102
99
|
recordAgentsInstructionsUpdated,
|
|
@@ -110,10 +107,11 @@ import {
|
|
|
110
107
|
resolveWorkspacePath,
|
|
111
108
|
retainRuntimeTurnContext,
|
|
112
109
|
sanitizeAssistantText,
|
|
110
|
+
saveTurnCheckpoint,
|
|
113
111
|
stripRuntimeTurnContext,
|
|
114
112
|
trimTrailingAssistantMessages,
|
|
115
113
|
truncateText
|
|
116
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-ZIAMN2UW.js";
|
|
117
115
|
import {
|
|
118
116
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
119
117
|
} from "./chunk-3Y47VMHV.js";
|
|
@@ -145,7 +143,7 @@ import {
|
|
|
145
143
|
runNonInteractiveCommand,
|
|
146
144
|
throwSandboxOperationError,
|
|
147
145
|
wrapSandboxSetupError
|
|
148
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-GUWLDMGF.js";
|
|
149
147
|
import {
|
|
150
148
|
SCHEDULED_TASK_SYSTEM_ACTOR,
|
|
151
149
|
compactEventTask,
|
|
@@ -177,15 +175,15 @@ import {
|
|
|
177
175
|
saveEventTask,
|
|
178
176
|
scheduledTaskAttributes,
|
|
179
177
|
writableEventTask
|
|
180
|
-
} from "./chunk-
|
|
178
|
+
} from "./chunk-YD54Q45G.js";
|
|
181
179
|
import {
|
|
182
180
|
parseSlackThreadId
|
|
183
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-DXEQAIUV.js";
|
|
184
182
|
import {
|
|
185
183
|
SHORT_TITLE_MAX_LENGTH,
|
|
186
184
|
generateShortTitle,
|
|
187
185
|
resolveTaskTitle
|
|
188
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-ZYAJMESY.js";
|
|
189
187
|
import {
|
|
190
188
|
ToolInputError,
|
|
191
189
|
addAgentTurnUsage,
|
|
@@ -203,7 +201,7 @@ import {
|
|
|
203
201
|
getSlackToolContext,
|
|
204
202
|
readActorIdentity,
|
|
205
203
|
resolveChannelCapabilities
|
|
206
|
-
} from "./chunk-
|
|
204
|
+
} from "./chunk-ZIMRGFYL.js";
|
|
207
205
|
import {
|
|
208
206
|
SlackActionError,
|
|
209
207
|
downloadPrivateSlackFile,
|
|
@@ -212,7 +210,7 @@ import {
|
|
|
212
210
|
isConversationScopedChannel,
|
|
213
211
|
normalizeSlackConversationId,
|
|
214
212
|
withSlackRetries
|
|
215
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-TZRXYWRE.js";
|
|
216
214
|
import {
|
|
217
215
|
KNOWN_CONVERSATION_EVENT_TYPES,
|
|
218
216
|
contextProvenance,
|
|
@@ -223,7 +221,7 @@ import {
|
|
|
223
221
|
instructionActors,
|
|
224
222
|
instructionProvenanceFor,
|
|
225
223
|
sameActorIdentity
|
|
226
|
-
} from "./chunk-
|
|
224
|
+
} from "./chunk-2UH3JI64.js";
|
|
227
225
|
import {
|
|
228
226
|
SANDBOX_DATA_ROOT,
|
|
229
227
|
SANDBOX_SKILLS_ROOT,
|
|
@@ -235,7 +233,7 @@ import {
|
|
|
235
233
|
} from "./chunk-EM225ITJ.js";
|
|
236
234
|
import {
|
|
237
235
|
getStateAdapter
|
|
238
|
-
} from "./chunk-
|
|
236
|
+
} from "./chunk-QUG4JSZK.js";
|
|
239
237
|
import {
|
|
240
238
|
ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
|
|
241
239
|
COMPACTION_SUMMARY_PREFIX,
|
|
@@ -269,7 +267,7 @@ import {
|
|
|
269
267
|
resolveGatewayCredential,
|
|
270
268
|
resolveGatewayModel,
|
|
271
269
|
unwrapCurrentInstruction
|
|
272
|
-
} from "./chunk-
|
|
270
|
+
} from "./chunk-XFKIRN3Q.js";
|
|
273
271
|
import {
|
|
274
272
|
canExposeConversationPayload,
|
|
275
273
|
resolveConversationPrivacy,
|
|
@@ -279,16 +277,16 @@ import {
|
|
|
279
277
|
toGenAiMessagesTraceAttributes,
|
|
280
278
|
toGenAiPayloadMetadata,
|
|
281
279
|
toGenAiPayloadTraceAttributes
|
|
282
|
-
} from "./chunk-
|
|
280
|
+
} from "./chunk-JTGS3ZZE.js";
|
|
283
281
|
import {
|
|
284
282
|
discoverSkills,
|
|
285
283
|
findSkillByName,
|
|
286
284
|
loadSkillsByName,
|
|
287
285
|
parseSkillInvocation
|
|
288
|
-
} from "./chunk-
|
|
286
|
+
} from "./chunk-5PNPQYTO.js";
|
|
289
287
|
import {
|
|
290
288
|
pluginCatalogRuntime
|
|
291
|
-
} from "./chunk-
|
|
289
|
+
} from "./chunk-SIN3MXH6.js";
|
|
292
290
|
import {
|
|
293
291
|
CredentialUnavailableError,
|
|
294
292
|
OAuthProviderError,
|
|
@@ -296,7 +294,7 @@ import {
|
|
|
296
294
|
getOAuthProviderErrorAttributes,
|
|
297
295
|
resolveAuthTokenPlaceholder,
|
|
298
296
|
resolvePluginCommandEnv
|
|
299
|
-
} from "./chunk-
|
|
297
|
+
} from "./chunk-CD2XFGYQ.js";
|
|
300
298
|
import {
|
|
301
299
|
credentialUserSubjectId
|
|
302
300
|
} from "./chunk-RUIXF3YQ.js";
|
|
@@ -325,7 +323,7 @@ import {
|
|
|
325
323
|
summarizeMessageText,
|
|
326
324
|
withLogContext,
|
|
327
325
|
withSpan
|
|
328
|
-
} from "./chunk-
|
|
326
|
+
} from "./chunk-2LWPFSB4.js";
|
|
329
327
|
import {
|
|
330
328
|
startInactiveSpan,
|
|
331
329
|
withActiveSpan
|
|
@@ -1404,21 +1402,6 @@ function actionConfirmationRetryMessages(messages) {
|
|
|
1404
1402
|
return retryMessages;
|
|
1405
1403
|
}
|
|
1406
1404
|
|
|
1407
|
-
// src/chat/agent/session.ts
|
|
1408
|
-
async function restoreSessionRecord(args) {
|
|
1409
|
-
const sessionRecordState = await loadTurnSessionRecord({
|
|
1410
|
-
conversationId: args.conversationId,
|
|
1411
|
-
sessionId: args.turnId
|
|
1412
|
-
});
|
|
1413
|
-
const { resumedFromSessionRecord, currentSliceId, existingSessionRecord } = sessionRecordState;
|
|
1414
|
-
return {
|
|
1415
|
-
currentSliceId,
|
|
1416
|
-
existingSessionRecord,
|
|
1417
|
-
resumedFromSessionRecord,
|
|
1418
|
-
sessionRecordState
|
|
1419
|
-
};
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
1405
|
// src/chat/mcp/tool-name.ts
|
|
1423
1406
|
function parseMcpProviderFromToolName(toolName) {
|
|
1424
1407
|
if (!toolName.startsWith("mcp__")) return void 0;
|
|
@@ -15599,6 +15582,18 @@ function extractSliceUsage(messages, beforeMessageCount) {
|
|
|
15599
15582
|
);
|
|
15600
15583
|
return hasAgentTurnUsage(usage) ? usage : void 0;
|
|
15601
15584
|
}
|
|
15585
|
+
function boundaryKey(messages) {
|
|
15586
|
+
return messages.map((message) => {
|
|
15587
|
+
const record2 = message;
|
|
15588
|
+
const content = typeof record2.content === "string" ? record2.content : JSON.stringify(record2.content ?? null);
|
|
15589
|
+
return [
|
|
15590
|
+
String(record2.role ?? ""),
|
|
15591
|
+
String(record2.timestamp ?? ""),
|
|
15592
|
+
String(record2.toolCallId ?? ""),
|
|
15593
|
+
content
|
|
15594
|
+
].join("");
|
|
15595
|
+
}).join("");
|
|
15596
|
+
}
|
|
15602
15597
|
function createResumeState(args) {
|
|
15603
15598
|
let beforeMessageCount = 0;
|
|
15604
15599
|
let inputCommitted = false;
|
|
@@ -15607,19 +15602,29 @@ function createResumeState(args) {
|
|
|
15607
15602
|
let resumeMessages = [];
|
|
15608
15603
|
let turnContexts = [];
|
|
15609
15604
|
let turnStartMessageIndex;
|
|
15610
|
-
|
|
15611
|
-
|
|
15612
|
-
|
|
15613
|
-
|
|
15605
|
+
let advancedPastResume = !args.checkpoint.resumed;
|
|
15606
|
+
let resumedBoundaryKey = "";
|
|
15607
|
+
if (args.checkpoint.resumed && args.checkpoint.record.piMessages.length) {
|
|
15608
|
+
const prior = args.checkpoint.record;
|
|
15609
|
+
latestSafeBoundaryMessages = [...prior.piMessages];
|
|
15610
|
+
resumeMessages = [...prior.piMessages];
|
|
15611
|
+
resumedBoundaryKey = boundaryKey(
|
|
15612
|
+
continuableMessages(prior.piMessages, prior.piMessages)
|
|
15613
|
+
);
|
|
15614
|
+
}
|
|
15615
|
+
const currentSliceId = args.checkpoint.sliceId;
|
|
15616
|
+
const durationMs = () => Date.now() - args.startedAtMs;
|
|
15617
|
+
const writeBase = () => ({
|
|
15614
15618
|
conversationId: args.conversationId,
|
|
15619
|
+
turnId: args.turnId,
|
|
15620
|
+
modelId: args.getModelId(),
|
|
15621
|
+
channelName: args.channelName,
|
|
15615
15622
|
destination: args.destination,
|
|
15616
|
-
|
|
15617
|
-
|
|
15623
|
+
destinationVisibility: args.destinationVisibility,
|
|
15624
|
+
dispatchId: args.dispatchId,
|
|
15618
15625
|
source: args.runSource,
|
|
15619
|
-
sessionId: args.turnId,
|
|
15620
15626
|
loadedSkillNames: args.getLoadedSkillNames(),
|
|
15621
|
-
|
|
15622
|
-
...args.getReasoningLevel() ? { reasoningLevel: args.getReasoningLevel() } : {},
|
|
15627
|
+
reasoningLevel: args.getReasoningLevel(),
|
|
15623
15628
|
actor: args.actor,
|
|
15624
15629
|
surface: args.surface
|
|
15625
15630
|
});
|
|
@@ -15642,7 +15647,7 @@ function createResumeState(args) {
|
|
|
15642
15647
|
setTurnContexts(contexts) {
|
|
15643
15648
|
turnContexts = contexts;
|
|
15644
15649
|
},
|
|
15645
|
-
/**
|
|
15650
|
+
/** Use an already committed boundary as the resume baseline. */
|
|
15646
15651
|
adoptCommittedBoundary(messages) {
|
|
15647
15652
|
latestSafeBoundaryMessages = [...messages];
|
|
15648
15653
|
resumeMessages = [...messages];
|
|
@@ -15664,18 +15669,23 @@ function createResumeState(args) {
|
|
|
15664
15669
|
inputCommitted = true;
|
|
15665
15670
|
},
|
|
15666
15671
|
async persistSafeBoundary(messages, trailingMessageProvenance) {
|
|
15667
|
-
const
|
|
15668
|
-
|
|
15672
|
+
const saved = await saveTurnCheckpoint({
|
|
15673
|
+
mode: "running",
|
|
15674
|
+
...writeBase(),
|
|
15669
15675
|
sliceId: currentSliceId,
|
|
15670
15676
|
messages,
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
|
|
15677
|
+
trailingMessageProvenance,
|
|
15678
|
+
turnContexts: turnContexts.length > 0 ? turnContexts : void 0,
|
|
15679
|
+
turnStartMessageIndex
|
|
15674
15680
|
});
|
|
15675
|
-
if (!
|
|
15681
|
+
if (!saved) {
|
|
15676
15682
|
return false;
|
|
15677
15683
|
}
|
|
15678
15684
|
latestSafeBoundaryMessages = [...messages];
|
|
15685
|
+
const persistedKey = boundaryKey(continuableMessages(messages, messages));
|
|
15686
|
+
if (resumedBoundaryKey.length === 0 || persistedKey !== resumedBoundaryKey) {
|
|
15687
|
+
advancedPastResume = true;
|
|
15688
|
+
}
|
|
15679
15689
|
return true;
|
|
15680
15690
|
},
|
|
15681
15691
|
async requireDurableInputCheckpoint(messages, trailingMessageProvenance) {
|
|
@@ -15690,34 +15700,34 @@ function createResumeState(args) {
|
|
|
15690
15700
|
}
|
|
15691
15701
|
return persisted;
|
|
15692
15702
|
},
|
|
15693
|
-
/** Prepare a cooperative yield at the current durable boundary. */
|
|
15694
15703
|
prepareYieldIfDue(currentMessages) {
|
|
15695
15704
|
if (!args.durability.shouldYield?.()) {
|
|
15696
15705
|
return void 0;
|
|
15697
15706
|
}
|
|
15698
|
-
const
|
|
15699
|
-
if (!isContinuablePiBoundary(
|
|
15707
|
+
const next = this.getResumeSnapshot(currentMessages);
|
|
15708
|
+
if (!isContinuablePiBoundary(next)) {
|
|
15700
15709
|
return void 0;
|
|
15701
15710
|
}
|
|
15702
|
-
resumeMessages =
|
|
15711
|
+
resumeMessages = next;
|
|
15703
15712
|
return new CooperativeTurnYieldError(
|
|
15704
|
-
`Agent turn yielded at a safe boundary after ${
|
|
15713
|
+
`Agent turn yielded at a safe boundary after ${durationMs()}ms`
|
|
15705
15714
|
);
|
|
15706
15715
|
},
|
|
15707
|
-
/** Persist an auth pause; only a durable pause may return `awaiting_auth`. */
|
|
15708
15716
|
async parkForAuth(pause, currentUsage) {
|
|
15709
15717
|
const usage = currentUsage ?? (resumeMessages.length > 0 ? extractSliceUsage(resumeMessages, beforeMessageCount) : void 0);
|
|
15710
15718
|
try {
|
|
15711
15719
|
await args.recordActiveMcpProviders();
|
|
15712
|
-
const
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15720
|
+
const record2 = await saveTurnCheckpoint({
|
|
15721
|
+
mode: "paused",
|
|
15722
|
+
reason: "auth",
|
|
15723
|
+
...writeBase(),
|
|
15724
|
+
sliceId: currentSliceId,
|
|
15725
|
+
durationMs: durationMs(),
|
|
15726
|
+
usage,
|
|
15717
15727
|
messages: resumeMessages,
|
|
15718
15728
|
errorMessage: pause.message
|
|
15719
15729
|
});
|
|
15720
|
-
if (!
|
|
15730
|
+
if (!record2) {
|
|
15721
15731
|
throw new AuthPausePersistenceError(args.conversationId, args.turnId);
|
|
15722
15732
|
}
|
|
15723
15733
|
return {
|
|
@@ -15727,7 +15737,7 @@ function createResumeState(args) {
|
|
|
15727
15737
|
...usage ? { usage } : {}
|
|
15728
15738
|
};
|
|
15729
15739
|
} catch (error) {
|
|
15730
|
-
if (error instanceof AuthPausePersistenceError) {
|
|
15740
|
+
if (error instanceof AuthPausePersistenceError || error instanceof TurnSliceLimitExceededError) {
|
|
15731
15741
|
throw error;
|
|
15732
15742
|
}
|
|
15733
15743
|
throw new AuthPausePersistenceError(
|
|
@@ -15737,62 +15747,61 @@ function createResumeState(args) {
|
|
|
15737
15747
|
);
|
|
15738
15748
|
}
|
|
15739
15749
|
},
|
|
15740
|
-
/** Persist a yield, retry, or timeout as a suspended run. */
|
|
15741
15750
|
async translateSuspension(ending) {
|
|
15742
15751
|
const { error } = ending;
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
15752
|
-
|
|
15752
|
+
const reason = error instanceof CooperativeTurnYieldError ? "yield" : error instanceof RetryableDeliveryError ? "retry" : timedOut ? "timeout" : void 0;
|
|
15753
|
+
if (!reason) {
|
|
15754
|
+
return void 0;
|
|
15755
|
+
}
|
|
15756
|
+
if (reason === "retry") {
|
|
15757
|
+
resumeMessages = [...latestSafeBoundaryMessages];
|
|
15758
|
+
}
|
|
15759
|
+
const parkMessages = reason === "yield" ? [...resumeMessages] : continuableMessages(resumeMessages, latestSafeBoundaryMessages);
|
|
15760
|
+
const parkKey = boundaryKey(parkMessages);
|
|
15761
|
+
if (!advancedPastResume && resumedBoundaryKey.length > 0 && parkKey === resumedBoundaryKey) {
|
|
15762
|
+
logWarn("agent.turn.no_progress_fail", {
|
|
15763
|
+
"app.ai.resume_conversation_id": args.conversationId,
|
|
15764
|
+
"app.ai.resume_session_id": args.turnId,
|
|
15765
|
+
"app.ai.resume_slice_id": currentSliceId,
|
|
15766
|
+
"app.ai.resume_reason": reason
|
|
15753
15767
|
});
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
|
|
15757
|
-
|
|
15758
|
-
|
|
15768
|
+
await saveTurnCheckpoint({
|
|
15769
|
+
mode: "failed",
|
|
15770
|
+
...writeBase(),
|
|
15771
|
+
sliceId: currentSliceId,
|
|
15772
|
+
durationMs: durationMs(),
|
|
15773
|
+
messages: parkMessages,
|
|
15774
|
+
errorMessage: "Turn made no progress: continue parked at the same boundary"
|
|
15775
|
+
});
|
|
15776
|
+
throw new Error(
|
|
15777
|
+
`Turn made no progress for conversation=${args.conversationId} turn=${args.turnId}`
|
|
15778
|
+
);
|
|
15779
|
+
}
|
|
15780
|
+
const usage = ending.currentUsage ?? extractSliceUsage(parkMessages, beforeMessageCount);
|
|
15781
|
+
await args.recordActiveMcpProviders();
|
|
15782
|
+
const record2 = await saveTurnCheckpoint({
|
|
15783
|
+
mode: "paused",
|
|
15784
|
+
reason,
|
|
15785
|
+
...writeBase(),
|
|
15786
|
+
sliceId: currentSliceId,
|
|
15787
|
+
durationMs: durationMs(),
|
|
15788
|
+
usage,
|
|
15789
|
+
messages: parkMessages,
|
|
15790
|
+
errorMessage: error instanceof Error ? error.message : String(error)
|
|
15791
|
+
});
|
|
15792
|
+
if (!record2) {
|
|
15793
|
+
throw new Error(
|
|
15794
|
+
`Failed to persist continuation for conversation=${args.conversationId} turn=${args.turnId}`
|
|
15795
|
+
);
|
|
15796
|
+
}
|
|
15797
|
+
if (record2.state === "paused") {
|
|
15759
15798
|
return {
|
|
15760
15799
|
status: "suspended",
|
|
15761
|
-
resumeVersion:
|
|
15800
|
+
resumeVersion: record2.version,
|
|
15762
15801
|
...usage ? { usage } : {}
|
|
15763
15802
|
};
|
|
15764
15803
|
}
|
|
15765
|
-
|
|
15766
|
-
if (resumeReason) {
|
|
15767
|
-
if (resumeReason === "retry") {
|
|
15768
|
-
resumeMessages = [...latestSafeBoundaryMessages];
|
|
15769
|
-
}
|
|
15770
|
-
const usage = ending.currentUsage ?? extractSliceUsage(resumeMessages, beforeMessageCount);
|
|
15771
|
-
await args.recordActiveMcpProviders();
|
|
15772
|
-
const sessionRecord = await persistContinuationSessionRecord({
|
|
15773
|
-
...sessionRecordBase(),
|
|
15774
|
-
currentSliceId,
|
|
15775
|
-
currentDurationMs: currentDurationMs(),
|
|
15776
|
-
currentUsage: usage,
|
|
15777
|
-
messages: resumeMessages,
|
|
15778
|
-
errorMessage: error instanceof Error ? error.message : String(error),
|
|
15779
|
-
resumeReason
|
|
15780
|
-
});
|
|
15781
|
-
if (!sessionRecord) {
|
|
15782
|
-
throw new Error(
|
|
15783
|
-
`Failed to persist continuation for conversation=${args.conversationId} turn=${args.turnId}`
|
|
15784
|
-
);
|
|
15785
|
-
}
|
|
15786
|
-
if (sessionRecord.state === "awaiting_resume") {
|
|
15787
|
-
return {
|
|
15788
|
-
status: "suspended",
|
|
15789
|
-
resumeVersion: sessionRecord.version,
|
|
15790
|
-
...usage ? { usage } : {}
|
|
15791
|
-
};
|
|
15792
|
-
}
|
|
15793
|
-
throw new TurnSliceLimitExceededError(botConfig.maxSlicesPerTurn);
|
|
15794
|
-
}
|
|
15795
|
-
return void 0;
|
|
15804
|
+
throw new TurnSliceLimitExceededError(botConfig.maxSlicesPerTurn);
|
|
15796
15805
|
}
|
|
15797
15806
|
};
|
|
15798
15807
|
}
|
|
@@ -16487,15 +16496,10 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
16487
16496
|
loadedSkillNamesForResume = activeSkills.map((skill) => skill.name);
|
|
16488
16497
|
};
|
|
16489
16498
|
const skillSandbox = new SkillSandbox(availableSkills, activeSkills);
|
|
16490
|
-
const {
|
|
16491
|
-
|
|
16492
|
-
|
|
16493
|
-
|
|
16494
|
-
existingSessionRecord
|
|
16495
|
-
} = await restoreSessionRecord({
|
|
16496
|
-
conversationId,
|
|
16497
|
-
turnId
|
|
16498
|
-
});
|
|
16499
|
+
const checkpoint = await loadTurnCheckpoint({ conversationId, turnId });
|
|
16500
|
+
const resumedFromSessionRecord = checkpoint.resumed;
|
|
16501
|
+
const currentSliceId = checkpoint.sliceId;
|
|
16502
|
+
const existingSessionRecord = checkpoint.record;
|
|
16499
16503
|
const committedInstructionProvenance = [
|
|
16500
16504
|
...existingSessionRecord?.piMessageProvenance ?? [],
|
|
16501
16505
|
...(existingSessionRecord?.actors ?? []).map(instructionProvenanceFor),
|
|
@@ -16533,7 +16537,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
16533
16537
|
runSource,
|
|
16534
16538
|
conversationId,
|
|
16535
16539
|
turnId,
|
|
16536
|
-
|
|
16540
|
+
checkpoint,
|
|
16537
16541
|
startedAtMs: replyStartedAtMs,
|
|
16538
16542
|
surface
|
|
16539
16543
|
});
|
|
@@ -17134,6 +17138,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17134
17138
|
runResume.setTurnStartMessageIndex(
|
|
17135
17139
|
existingSessionRecord.turnStartMessageIndex
|
|
17136
17140
|
);
|
|
17141
|
+
runResume.adoptCommittedBoundary([...agent.state.messages]);
|
|
17137
17142
|
} else if (promptHistoryMessages.length > 0) {
|
|
17138
17143
|
agent.state.messages = [...promptHistoryMessages];
|
|
17139
17144
|
}
|
|
@@ -17458,7 +17463,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17458
17463
|
throw error.originalError;
|
|
17459
17464
|
}
|
|
17460
17465
|
const runError = error instanceof AssistantMessageDeliveryError ? error.originalError : error;
|
|
17461
|
-
if (runError instanceof AuthPausePersistenceError) {
|
|
17466
|
+
if (runError instanceof AuthPausePersistenceError || runError instanceof TurnSliceLimitExceededError) {
|
|
17462
17467
|
throw runError;
|
|
17463
17468
|
}
|
|
17464
17469
|
if (resume && runError instanceof AuthorizationPauseError) {
|
|
@@ -4,24 +4,24 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
formatProviderLabel,
|
|
6
6
|
startOAuthFlow
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FUBRJA5F.js";
|
|
8
8
|
import {
|
|
9
9
|
abandonReplacedPendingAuth,
|
|
10
10
|
canReusePendingAuthLink,
|
|
11
11
|
recordAuthorizationRequested
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZIAMN2UW.js";
|
|
13
13
|
import {
|
|
14
14
|
parseSandboxEgressAuthRequiredSignal
|
|
15
15
|
} from "./chunk-HUO3UTAQ.js";
|
|
16
16
|
import {
|
|
17
17
|
AGENT_INVOCATION_MAILBOX_STATUSES
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-27TEJTZO.js";
|
|
19
19
|
import {
|
|
20
20
|
TURN_REASONING_LEVELS
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-XFKIRN3Q.js";
|
|
22
22
|
import {
|
|
23
23
|
pluginCatalogRuntime
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-SIN3MXH6.js";
|
|
25
25
|
import {
|
|
26
26
|
credentialContextSchema
|
|
27
27
|
} from "./chunk-RUIXF3YQ.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDb
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2UH3JI64.js";
|
|
4
4
|
import {
|
|
5
5
|
juniorConversations,
|
|
6
6
|
juniorTaskExecutions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-27TEJTZO.js";
|
|
8
8
|
import {
|
|
9
9
|
logWarn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2LWPFSB4.js";
|
|
11
11
|
|
|
12
12
|
// src/chat/tasks/execution-stats.ts
|
|
13
13
|
import {
|
|
@@ -4,19 +4,19 @@ import {
|
|
|
4
4
|
isDmChannel,
|
|
5
5
|
normalizeSlackConversationId,
|
|
6
6
|
withSlackRetries
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TZRXYWRE.js";
|
|
8
8
|
import {
|
|
9
9
|
parseDestination
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2UH3JI64.js";
|
|
11
11
|
import {
|
|
12
12
|
getStateAdapter
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QUG4JSZK.js";
|
|
14
14
|
import {
|
|
15
15
|
normalizeSlackEmojiName
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XFKIRN3Q.js";
|
|
17
17
|
import {
|
|
18
18
|
pluginCatalogRuntime
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-SIN3MXH6.js";
|
|
20
20
|
import {
|
|
21
21
|
parseSlackMessageTs,
|
|
22
22
|
parseSlackUserId
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
isRecord,
|
|
26
26
|
logInfo,
|
|
27
27
|
logWarn
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-2LWPFSB4.js";
|
|
29
29
|
|
|
30
30
|
// src/chat/slack/outbound.ts
|
|
31
31
|
var MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
} from "./chunk-EM225ITJ.js";
|
|
5
5
|
import {
|
|
6
6
|
getStateAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QUG4JSZK.js";
|
|
8
8
|
import {
|
|
9
9
|
toOptionalTrimmed
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XFKIRN3Q.js";
|
|
11
11
|
import {
|
|
12
12
|
pluginCatalogRuntime
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SIN3MXH6.js";
|
|
14
14
|
import {
|
|
15
15
|
setSpanAttributes,
|
|
16
16
|
setSpanStatus,
|
|
17
17
|
withSpan
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-2LWPFSB4.js";
|
|
19
19
|
|
|
20
20
|
// src/chat/sandbox/resources.ts
|
|
21
21
|
var configuredResources;
|