@sentry/junior 0.108.0 → 0.110.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-NU5HK3PS.js → agent-hooks-ELT4ODFF.js} +12 -13
- package/dist/api/conversations/access.d.ts +9 -0
- package/dist/api/conversations/aggregate.d.ts +12 -1
- package/dist/api/conversations/archive.d.ts +3 -5
- package/dist/api/conversations/detail.d.ts +156 -7
- package/dist/api/conversations/events.d.ts +2 -2
- package/dist/api/conversations/list.d.ts +57 -6
- package/dist/api/conversations/projection.d.ts +6 -7
- package/dist/api/conversations/reporting.d.ts +10 -4
- package/dist/api/conversations/routes.d.ts +2 -1
- package/dist/api/conversations/shared.d.ts +1 -1
- package/dist/api/conversations/stats.d.ts +37 -6
- package/dist/api/conversations/stats.query.d.ts +1 -1
- package/dist/api/conversations/usage.d.ts +9 -0
- package/dist/api/http.d.ts +7 -0
- package/dist/api/locations/detail.d.ts +102 -6
- package/dist/api/locations/list.d.ts +43 -5
- package/dist/api/locations/query.d.ts +4 -2
- package/dist/api/locations/routes.d.ts +2 -1
- package/dist/api/people/list.d.ts +28 -6
- package/dist/api/people/list.query.d.ts +1 -1
- package/dist/api/people/profile.d.ts +96 -7
- package/dist/api/people/profile.query.d.ts +4 -2
- package/dist/api/people/routes.d.ts +2 -1
- package/dist/api/people/shared.d.ts +1219 -2
- package/dist/api/route.d.ts +18 -4
- package/dist/api/schema/common.d.ts +6 -0
- package/dist/api/{conversations/schema.d.ts → schema/conversation.d.ts} +88 -9
- package/dist/api/{locations/schema.d.ts → schema/location.d.ts} +5 -0
- package/dist/api/{people/schema.d.ts → schema/person.d.ts} +37 -45
- package/dist/api/schema.d.ts +8 -22
- package/dist/api/schema.js +10 -2
- package/dist/api.d.ts +5 -1
- package/dist/api.js +838 -369
- package/dist/app.d.ts +1 -0
- package/dist/app.js +1564 -486
- package/dist/catalog-runtime-4GI22PXK.js +16 -0
- package/dist/chat/agent/resume.d.ts +11 -12
- package/dist/chat/conversations/history.d.ts +3 -0
- package/dist/chat/conversations/sql/privacy.d.ts +3 -15
- package/dist/chat/conversations/sql/store.d.ts +0 -7
- package/dist/chat/log-context.d.ts +40 -0
- package/dist/chat/logging.d.ts +3 -26
- package/dist/chat/pi/messages.d.ts +2 -2
- package/dist/chat/pi/sql-model-usage.d.ts +4 -1
- package/dist/chat/runtime/slack-resume.d.ts +2 -2
- package/dist/chat/services/auth-pause.d.ts +4 -0
- package/dist/chat/services/context-compaction.d.ts +1 -0
- package/dist/chat/services/turn-session-record.d.ts +0 -2
- package/dist/chat/slack/reply.d.ts +7 -19
- package/dist/chat/state/conversation.d.ts +1 -0
- package/dist/chat/task-execution/queue-signing.d.ts +10 -8
- package/dist/chat/task-execution/queue.d.ts +9 -7
- package/dist/chat/task-execution/slack-work.d.ts +6 -6
- package/dist/{chunk-UD6THJ2I.js → chunk-2T7TIEXI.js} +197 -12
- package/dist/{chunk-CEA3A3UA.js → chunk-2ZTTXTSZ.js} +24 -1
- package/dist/{chunk-XKB7LGIW.js → chunk-3S7YYHBI.js} +3 -139
- package/dist/chunk-3TV7OEHL.js +10 -0
- package/dist/{chunk-A5CO2EHL.js → chunk-3UBQI73J.js} +11 -15
- package/dist/{chunk-7FBGKXPE.js → chunk-42WRQLJ6.js} +10 -33
- package/dist/{chunk-TE4QHJH4.js → chunk-4QU44P7Q.js} +135 -595
- package/dist/{chunk-RT5BUHR5.js → chunk-6Y5L4BOM.js} +3 -5
- package/dist/{chunk-VIXFG2VC.js → chunk-C4MZ3GP5.js} +1 -2
- package/dist/{chunk-3RGQLX2F.js → chunk-C5XAFTHY.js} +1011 -29
- package/dist/{chunk-PUAMO4PI.js → chunk-FPK7XY3F.js} +139 -99
- package/dist/{chunk-H3QYZL7K.js → chunk-GK47NBDE.js} +28 -3
- package/dist/{chunk-O24R4DCK.js → chunk-IYKPU7H6.js} +94 -56
- package/dist/chunk-JQFJO5WH.js +477 -0
- package/dist/{chunk-VH6KWKG2.js → chunk-L5XQPJ7T.js} +3 -3
- package/dist/{chunk-2XXEKR44.js → chunk-MIAKQNYX.js} +43 -31
- package/dist/{chunk-KPMPQ6AA.js → chunk-RHHRKSPI.js} +249 -223
- package/dist/{chunk-YT72TOEK.js → chunk-SBOBTS27.js} +2 -2
- package/dist/{chunk-B5I5LMSP.js → chunk-W6RJZG7F.js} +5 -7
- package/dist/chunk-W75ZPAGG.js +44 -0
- package/dist/{chunk-SS67LUOK.js → chunk-WNOVRQ67.js} +6 -7
- package/dist/{chunk-YIPD3L6L.js → chunk-Y3H2DN6F.js} +8 -10
- package/dist/{chunk-DY7TRYB5.js → chunk-Y5FK3CNG.js} +1 -1
- package/dist/chunk-ZKIOWEFL.js +125 -0
- package/dist/cli/chat.js +23 -24
- package/dist/cli/check.js +9 -7
- package/dist/cli/plugins.js +16 -17
- package/dist/cli/snapshot-warmup.js +11 -10
- package/dist/cli/upgrade.js +314 -3505
- package/dist/db/db.d.ts +1 -1
- package/dist/db/schema/conversations.d.ts +17 -0
- package/dist/db/schema.d.ts +17 -0
- package/dist/{db-AMRBAT5D.js → db-Y6W6CWWW.js} +8 -7
- package/dist/instrumentation.js +4 -3
- package/dist/nitro.js +4 -4
- package/dist/reporting-schema.d.ts +46 -0
- package/dist/{runner-TQH5GAJ4.js → runner-BBFV5GLR.js} +17 -21
- package/dist/{skills-ITNHBARB.js → skills-AR4AF32L.js} +8 -6
- package/dist/{validation-AGQ46ZGV.js → validation-FBIEPTC2.js} +8 -6
- package/dist/version.d.ts +2 -0
- package/dist/version.js +7 -0
- package/migrations/0006_drop_legacy_conversation_messages.sql +1 -0
- package/migrations/0007_thick_sugar_man.sql +23 -0
- package/migrations/README.md +12 -9
- package/migrations/meta/0006_snapshot.json +948 -0
- package/migrations/meta/0007_snapshot.json +1013 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +9 -5
- package/dist/catalog-runtime-FOFNPR3P.js +0 -14
- package/dist/chunk-AHJR2IFF.js +0 -115
- package/dist/chunk-B7PUBQQM.js +0 -53
- package/dist/chunk-G3E7SCME.js +0 -28
- package/dist/chunk-J3B3FPP2.js +0 -1061
- package/dist/chunk-OB42YVAE.js +0 -16
- package/dist/chunk-TWINAEZQ.js +0 -1283
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CooperativeTurnYieldError,
|
|
3
|
+
JUNIOR_THREAD_STATE_TTL_MS,
|
|
3
4
|
TurnInputCommitLostError,
|
|
4
5
|
TurnSliceLimitExceededError,
|
|
5
6
|
abandonReplacedPendingAuth,
|
|
@@ -8,23 +9,20 @@ import {
|
|
|
8
9
|
getAgentContextCompactionTriggerTokens,
|
|
9
10
|
getInterruptionMarker,
|
|
10
11
|
isTurnInputCommitLostError,
|
|
12
|
+
loadConnectedMcpProviders,
|
|
13
|
+
loadConversationProjection,
|
|
11
14
|
loadTurnSessionRecord,
|
|
12
15
|
mergeArtifactsState,
|
|
16
|
+
openConversationProjection,
|
|
13
17
|
persistAuthPauseSessionRecord,
|
|
14
18
|
persistContinuationSessionRecord,
|
|
15
19
|
persistRunningSessionRecord,
|
|
16
20
|
persistYieldSessionRecord,
|
|
17
|
-
updateConversationStats
|
|
18
|
-
} from "./chunk-3RGQLX2F.js";
|
|
19
|
-
import {
|
|
20
|
-
JUNIOR_THREAD_STATE_TTL_MS,
|
|
21
|
-
loadConnectedMcpProviders,
|
|
22
|
-
loadConversationProjection,
|
|
23
|
-
openConversationProjection,
|
|
24
21
|
recordAuthorizationRequested,
|
|
25
22
|
recordMcpProviderConnected,
|
|
26
|
-
recordToolExecutionStarted
|
|
27
|
-
|
|
23
|
+
recordToolExecutionStarted,
|
|
24
|
+
updateConversationStats
|
|
25
|
+
} from "./chunk-C5XAFTHY.js";
|
|
28
26
|
import {
|
|
29
27
|
buildNonInteractiveShellScript,
|
|
30
28
|
createSandboxInstance,
|
|
@@ -34,7 +32,7 @@ import {
|
|
|
34
32
|
isSnapshotMissingError,
|
|
35
33
|
resolveRuntimeDependencySnapshot,
|
|
36
34
|
runNonInteractiveCommand
|
|
37
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-W6RJZG7F.js";
|
|
38
36
|
import {
|
|
39
37
|
addAgentTurnUsage,
|
|
40
38
|
hasAgentTurnUsage
|
|
@@ -44,27 +42,23 @@ import {
|
|
|
44
42
|
} from "./chunk-UIE3R5XU.js";
|
|
45
43
|
import {
|
|
46
44
|
createPluginHookRunner,
|
|
45
|
+
createPluginLogger,
|
|
47
46
|
getPluginSystemPromptContributions,
|
|
48
47
|
getPluginTools,
|
|
49
48
|
getPluginUserPromptContributions,
|
|
50
49
|
getPlugins,
|
|
51
50
|
getSlackToolContext,
|
|
52
51
|
resolveChannelCapabilities
|
|
53
|
-
} from "./chunk-
|
|
54
|
-
import {
|
|
55
|
-
createPluginLogger
|
|
56
|
-
} from "./chunk-AHJR2IFF.js";
|
|
52
|
+
} from "./chunk-2T7TIEXI.js";
|
|
57
53
|
import {
|
|
58
54
|
SANDBOX_DATA_ROOT,
|
|
59
55
|
SANDBOX_SKILLS_ROOT,
|
|
60
56
|
SANDBOX_WORKSPACE_ROOT,
|
|
57
|
+
acquireActiveLock,
|
|
58
|
+
getStateAdapter,
|
|
61
59
|
sandboxSkillDir,
|
|
62
60
|
sandboxSkillFile
|
|
63
|
-
} from "./chunk-
|
|
64
|
-
import {
|
|
65
|
-
acquireActiveLock,
|
|
66
|
-
getStateAdapter
|
|
67
|
-
} from "./chunk-H3QYZL7K.js";
|
|
61
|
+
} from "./chunk-GK47NBDE.js";
|
|
68
62
|
import {
|
|
69
63
|
SlackActionError,
|
|
70
64
|
downloadPrivateSlackFile,
|
|
@@ -74,7 +68,7 @@ import {
|
|
|
74
68
|
isDmChannel,
|
|
75
69
|
normalizeSlackConversationId,
|
|
76
70
|
withSlackRetries
|
|
77
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-L5XQPJ7T.js";
|
|
78
72
|
import {
|
|
79
73
|
contextProvenance,
|
|
80
74
|
getConversationEventStore,
|
|
@@ -82,8 +76,9 @@ import {
|
|
|
82
76
|
getConversationStore,
|
|
83
77
|
getDb,
|
|
84
78
|
instructionActors,
|
|
85
|
-
instructionProvenanceFor
|
|
86
|
-
|
|
79
|
+
instructionProvenanceFor,
|
|
80
|
+
parseDestination
|
|
81
|
+
} from "./chunk-4QU44P7Q.js";
|
|
87
82
|
import {
|
|
88
83
|
sleep
|
|
89
84
|
} from "./chunk-4ZNGQH7C.js";
|
|
@@ -126,7 +121,7 @@ import {
|
|
|
126
121
|
stripRuntimeTurnContext,
|
|
127
122
|
trimTrailingAssistantMessages,
|
|
128
123
|
unwrapCurrentInstruction
|
|
129
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-WNOVRQ67.js";
|
|
130
125
|
import {
|
|
131
126
|
parseSlackThreadId,
|
|
132
127
|
resolveConversationPrivacy,
|
|
@@ -136,26 +131,26 @@ import {
|
|
|
136
131
|
toGenAiMessagesTraceAttributes,
|
|
137
132
|
toGenAiPayloadMetadata,
|
|
138
133
|
toGenAiPayloadTraceAttributes
|
|
139
|
-
} from "./chunk-
|
|
140
|
-
import {
|
|
141
|
-
parseDestination
|
|
142
|
-
} from "./chunk-B7PUBQQM.js";
|
|
134
|
+
} from "./chunk-6Y5L4BOM.js";
|
|
143
135
|
import {
|
|
144
136
|
discoverSkills,
|
|
145
137
|
findSkillByName,
|
|
146
138
|
loadSkillsByName,
|
|
147
139
|
parseSkillInvocation
|
|
148
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-SBOBTS27.js";
|
|
141
|
+
import {
|
|
142
|
+
pluginCatalogRuntime
|
|
143
|
+
} from "./chunk-3TV7OEHL.js";
|
|
149
144
|
import {
|
|
150
145
|
CredentialUnavailableError,
|
|
151
146
|
credentialContextSchema,
|
|
152
|
-
|
|
147
|
+
credentialUserSubjectId,
|
|
153
148
|
resolveAuthTokenPlaceholder,
|
|
154
149
|
resolvePluginCommandEnv
|
|
155
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-Y3H2DN6F.js";
|
|
156
151
|
import {
|
|
157
152
|
isUserActor
|
|
158
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-C4MZ3GP5.js";
|
|
159
154
|
import {
|
|
160
155
|
extractGenAiUsageAttributes,
|
|
161
156
|
extractGenAiUsageSummary,
|
|
@@ -171,20 +166,19 @@ import {
|
|
|
171
166
|
setSpanStatus,
|
|
172
167
|
setTags,
|
|
173
168
|
summarizeMessageText,
|
|
169
|
+
withLogContext,
|
|
174
170
|
withSpan
|
|
175
|
-
} from "./chunk-
|
|
171
|
+
} from "./chunk-IYKPU7H6.js";
|
|
176
172
|
import {
|
|
177
|
-
isRecord
|
|
178
|
-
|
|
173
|
+
isRecord,
|
|
174
|
+
parseSlackChannelId,
|
|
175
|
+
parseSlackMessageTs,
|
|
176
|
+
parseSlackUserId
|
|
177
|
+
} from "./chunk-42WRQLJ6.js";
|
|
179
178
|
import {
|
|
180
179
|
startInactiveSpan,
|
|
181
180
|
withActiveSpan
|
|
182
181
|
} from "./chunk-6GWA276C.js";
|
|
183
|
-
import {
|
|
184
|
-
parseSlackChannelId,
|
|
185
|
-
parseSlackMessageTs,
|
|
186
|
-
parseSlackUserId
|
|
187
|
-
} from "./chunk-7FBGKXPE.js";
|
|
188
182
|
import {
|
|
189
183
|
listReferenceFiles,
|
|
190
184
|
soulPathCandidates,
|
|
@@ -1073,9 +1067,9 @@ async function selectTurnRoute(args) {
|
|
|
1073
1067
|
messageText: args.messageText
|
|
1074
1068
|
});
|
|
1075
1069
|
const logContext = {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1070
|
+
messageConversationId: args.context?.threadId,
|
|
1071
|
+
destinationName: args.context?.channelId,
|
|
1072
|
+
userId: args.context?.actorId,
|
|
1079
1073
|
runId: args.context?.runId,
|
|
1080
1074
|
modelId: args.fastModelId
|
|
1081
1075
|
};
|
|
@@ -1213,6 +1207,15 @@ var AuthorizationPauseError = class extends Error {
|
|
|
1213
1207
|
this.providerDisplayName = providerDisplayName;
|
|
1214
1208
|
}
|
|
1215
1209
|
};
|
|
1210
|
+
var AuthPausePersistenceError = class extends Error {
|
|
1211
|
+
constructor(conversationId, turnId, cause) {
|
|
1212
|
+
super(
|
|
1213
|
+
`Failed to persist auth pause for conversation=${conversationId} turn=${turnId}`,
|
|
1214
|
+
cause === void 0 ? void 0 : { cause }
|
|
1215
|
+
);
|
|
1216
|
+
this.name = "AuthPausePersistenceError";
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1216
1219
|
var AuthorizationFlowDisabledError = class extends Error {
|
|
1217
1220
|
kind;
|
|
1218
1221
|
provider;
|
|
@@ -14633,7 +14636,7 @@ async function writeSandboxGeneratedArtifacts(sandbox, files) {
|
|
|
14633
14636
|
// src/chat/agent/tools.ts
|
|
14634
14637
|
async function wireAgentTools(args) {
|
|
14635
14638
|
const runSource = args.routing.source;
|
|
14636
|
-
const
|
|
14639
|
+
const credentialUserId = args.routing.credentialContext ? credentialUserSubjectId(args.routing.credentialContext) : void 0;
|
|
14637
14640
|
const userTokenStore = createUserTokenStore();
|
|
14638
14641
|
const pluginHooks = createPluginHookRunner({
|
|
14639
14642
|
actor: args.currentActor,
|
|
@@ -14681,7 +14684,7 @@ async function wireAgentTools(args) {
|
|
|
14681
14684
|
abortAgent: args.abortAgent,
|
|
14682
14685
|
conversationId: args.conversationId,
|
|
14683
14686
|
sessionId: args.turnId,
|
|
14684
|
-
actorId:
|
|
14687
|
+
actorId: credentialUserId,
|
|
14685
14688
|
channelId: slackChannelId,
|
|
14686
14689
|
destination: args.routing.destination,
|
|
14687
14690
|
source: runSource,
|
|
@@ -14702,7 +14705,7 @@ async function wireAgentTools(args) {
|
|
|
14702
14705
|
abortAgent: args.abortAgent,
|
|
14703
14706
|
conversationId: args.conversationId,
|
|
14704
14707
|
sessionId: args.turnId,
|
|
14705
|
-
actorId:
|
|
14708
|
+
actorId: credentialUserId,
|
|
14706
14709
|
channelId: slackChannelId,
|
|
14707
14710
|
destination: args.routing.destination,
|
|
14708
14711
|
source: runSource,
|
|
@@ -14836,32 +14839,25 @@ async function wireAgentTools(args) {
|
|
|
14836
14839
|
})
|
|
14837
14840
|
);
|
|
14838
14841
|
const pendingMcpProvider = args.state.pendingAuth?.kind === "mcp" ? args.state.pendingAuth.provider : void 0;
|
|
14839
|
-
|
|
14840
|
-
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
|
|
14858
|
-
}
|
|
14859
|
-
if (await mcpToolManager.activateForSkill(skill)) {
|
|
14860
|
-
await args.recordConnectedMcpProvider(skill.pluginProvider);
|
|
14861
|
-
}
|
|
14862
|
-
if (mcpAuth.getPendingPause()) {
|
|
14863
|
-
args.resume.captureResumeSnapshot(args.preAgentPromptMessages());
|
|
14864
|
-
throw mcpAuth.getPendingPause();
|
|
14842
|
+
if (credentialUserId) {
|
|
14843
|
+
const providersToRestore = /* @__PURE__ */ new Set([
|
|
14844
|
+
...args.connectedMcpProviders,
|
|
14845
|
+
...inferActiveMcpProvidersFromPiMessages(args.priorPiMessages),
|
|
14846
|
+
...args.activeSkills.flatMap(
|
|
14847
|
+
(skill) => skill.pluginProvider ? [skill.pluginProvider] : []
|
|
14848
|
+
)
|
|
14849
|
+
]);
|
|
14850
|
+
for (const provider of providersToRestore) {
|
|
14851
|
+
if (provider === pendingMcpProvider) {
|
|
14852
|
+
continue;
|
|
14853
|
+
}
|
|
14854
|
+
if (await mcpToolManager.activateProvider(provider)) {
|
|
14855
|
+
await args.recordConnectedMcpProvider(provider);
|
|
14856
|
+
}
|
|
14857
|
+
if (mcpAuth.getPendingPause()) {
|
|
14858
|
+
args.resume.captureResumeSnapshot(args.preAgentPromptMessages());
|
|
14859
|
+
throw mcpAuth.getPendingPause();
|
|
14860
|
+
}
|
|
14865
14861
|
}
|
|
14866
14862
|
}
|
|
14867
14863
|
const activeMcpCatalogs = toActiveMcpCatalogSummaries(
|
|
@@ -14920,7 +14916,6 @@ function extractSliceUsage(messages, beforeMessageCount) {
|
|
|
14920
14916
|
}
|
|
14921
14917
|
function createResumeState(args) {
|
|
14922
14918
|
let beforeMessageCount = 0;
|
|
14923
|
-
let cooperativeYieldError;
|
|
14924
14919
|
let inputCommitted = false;
|
|
14925
14920
|
let latestSafeBoundaryMessages = [];
|
|
14926
14921
|
let timedOut = false;
|
|
@@ -14951,9 +14946,6 @@ function createResumeState(args) {
|
|
|
14951
14946
|
get timedOut() {
|
|
14952
14947
|
return timedOut;
|
|
14953
14948
|
},
|
|
14954
|
-
get cooperativeYieldError() {
|
|
14955
|
-
return cooperativeYieldError;
|
|
14956
|
-
},
|
|
14957
14949
|
setTurnStartMessageIndex(index) {
|
|
14958
14950
|
turnStartMessageIndex = index;
|
|
14959
14951
|
},
|
|
@@ -15007,25 +14999,53 @@ function createResumeState(args) {
|
|
|
15007
14999
|
}
|
|
15008
15000
|
return persisted;
|
|
15009
15001
|
},
|
|
15010
|
-
|
|
15002
|
+
/** Prepare a cooperative yield at the current durable boundary. */
|
|
15003
|
+
prepareYieldIfDue(currentMessages) {
|
|
15011
15004
|
if (!args.durability.shouldYield?.()) {
|
|
15012
|
-
return;
|
|
15005
|
+
return void 0;
|
|
15013
15006
|
}
|
|
15014
15007
|
resumeMessages = this.getResumeSnapshot(currentMessages);
|
|
15015
|
-
|
|
15008
|
+
return new CooperativeTurnYieldError(
|
|
15016
15009
|
`Agent turn yielded at a safe boundary after ${currentDurationMs()}ms`
|
|
15017
15010
|
);
|
|
15018
|
-
throw cooperativeYieldError;
|
|
15019
15011
|
},
|
|
15020
|
-
/**
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
|
|
15012
|
+
/** Persist an auth pause; only a durable pause may return `awaiting_auth`. */
|
|
15013
|
+
async parkForAuth(pause, currentUsage) {
|
|
15014
|
+
const usage = currentUsage ?? (resumeMessages.length > 0 ? extractSliceUsage(resumeMessages, beforeMessageCount) : void 0);
|
|
15015
|
+
try {
|
|
15016
|
+
await args.recordActiveMcpProviders();
|
|
15017
|
+
const sessionRecord = await persistAuthPauseSessionRecord({
|
|
15018
|
+
...sessionRecordBase(),
|
|
15019
|
+
currentSliceId,
|
|
15020
|
+
currentDurationMs: currentDurationMs(),
|
|
15021
|
+
currentUsage: usage,
|
|
15022
|
+
messages: resumeMessages,
|
|
15023
|
+
errorMessage: pause.message
|
|
15024
|
+
});
|
|
15025
|
+
if (!sessionRecord) {
|
|
15026
|
+
throw new AuthPausePersistenceError(args.conversationId, args.turnId);
|
|
15027
|
+
}
|
|
15028
|
+
return {
|
|
15029
|
+
status: "awaiting_auth",
|
|
15030
|
+
providerDisplayName: pause.providerDisplayName,
|
|
15031
|
+
...usage ? { usage } : {}
|
|
15032
|
+
};
|
|
15033
|
+
} catch (error) {
|
|
15034
|
+
if (error instanceof AuthPausePersistenceError) {
|
|
15035
|
+
throw error;
|
|
15036
|
+
}
|
|
15037
|
+
throw new AuthPausePersistenceError(
|
|
15038
|
+
args.conversationId,
|
|
15039
|
+
args.turnId,
|
|
15040
|
+
error
|
|
15041
|
+
);
|
|
15042
|
+
}
|
|
15043
|
+
},
|
|
15044
|
+
/** Persist a yield, retry, or timeout as a suspended run. */
|
|
15045
|
+
async translateSuspension(ending) {
|
|
15046
|
+
const { error } = ending;
|
|
15047
|
+
if (error instanceof CooperativeTurnYieldError) {
|
|
15048
|
+
const usage = ending.currentUsage ?? extractSliceUsage(resumeMessages, beforeMessageCount);
|
|
15029
15049
|
await args.recordActiveMcpProviders();
|
|
15030
15050
|
const sessionRecord = await persistYieldSessionRecord({
|
|
15031
15051
|
...sessionRecordBase(),
|
|
@@ -15041,11 +15061,9 @@ function createResumeState(args) {
|
|
|
15041
15061
|
);
|
|
15042
15062
|
}
|
|
15043
15063
|
return {
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
...usage ? { usage } : {}
|
|
15048
|
-
}
|
|
15064
|
+
status: "suspended",
|
|
15065
|
+
resumeVersion: sessionRecord.version,
|
|
15066
|
+
...usage ? { usage } : {}
|
|
15049
15067
|
};
|
|
15050
15068
|
}
|
|
15051
15069
|
const resumeReason = error instanceof RetryableDeliveryError ? "retry" : timedOut ? "timeout" : void 0;
|
|
@@ -15053,7 +15071,7 @@ function createResumeState(args) {
|
|
|
15053
15071
|
if (resumeReason === "retry") {
|
|
15054
15072
|
resumeMessages = [...latestSafeBoundaryMessages];
|
|
15055
15073
|
}
|
|
15056
|
-
const usage =
|
|
15074
|
+
const usage = ending.currentUsage ?? extractSliceUsage(resumeMessages, beforeMessageCount);
|
|
15057
15075
|
await args.recordActiveMcpProviders();
|
|
15058
15076
|
const sessionRecord = await persistContinuationSessionRecord({
|
|
15059
15077
|
...sessionRecordBase(),
|
|
@@ -15071,37 +15089,14 @@ function createResumeState(args) {
|
|
|
15071
15089
|
}
|
|
15072
15090
|
if (sessionRecord.state === "awaiting_resume") {
|
|
15073
15091
|
return {
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15077
|
-
...usage ? { usage } : {}
|
|
15078
|
-
}
|
|
15092
|
+
status: "suspended",
|
|
15093
|
+
resumeVersion: sessionRecord.version,
|
|
15094
|
+
...usage ? { usage } : {}
|
|
15079
15095
|
};
|
|
15080
15096
|
}
|
|
15081
15097
|
throw new TurnSliceLimitExceededError(botConfig.maxSlicesPerTurn);
|
|
15082
15098
|
}
|
|
15083
|
-
|
|
15084
|
-
const usage = args2.currentUsage ?? (resumeMessages.length > 0 ? extractSliceUsage(resumeMessages, beforeMessageCount) : void 0);
|
|
15085
|
-
await args.recordActiveMcpProviders();
|
|
15086
|
-
const sessionRecord = await persistAuthPauseSessionRecord({
|
|
15087
|
-
...sessionRecordBase(),
|
|
15088
|
-
currentSliceId,
|
|
15089
|
-
currentDurationMs: currentDurationMs(),
|
|
15090
|
-
currentUsage: usage,
|
|
15091
|
-
messages: resumeMessages,
|
|
15092
|
-
errorMessage: error.message
|
|
15093
|
-
});
|
|
15094
|
-
if (sessionRecord) {
|
|
15095
|
-
return {
|
|
15096
|
-
outcome: {
|
|
15097
|
-
status: "awaiting_auth",
|
|
15098
|
-
providerDisplayName: error.providerDisplayName,
|
|
15099
|
-
...usage ? { usage } : {}
|
|
15100
|
-
}
|
|
15101
|
-
};
|
|
15102
|
-
}
|
|
15103
|
-
}
|
|
15104
|
-
return {};
|
|
15099
|
+
return void 0;
|
|
15105
15100
|
}
|
|
15106
15101
|
};
|
|
15107
15102
|
}
|
|
@@ -15326,9 +15321,9 @@ async function maybeCompactWithDeps(args, deps) {
|
|
|
15326
15321
|
logWarn(
|
|
15327
15322
|
"context_compaction_summary_failed",
|
|
15328
15323
|
{
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
|
|
15324
|
+
messageConversationId: args.metadata?.threadId,
|
|
15325
|
+
userId: args.metadata?.actorId,
|
|
15326
|
+
destinationName: args.metadata?.channelId,
|
|
15332
15327
|
runId: args.metadata?.runId,
|
|
15333
15328
|
assistantUserName: botConfig.userName,
|
|
15334
15329
|
modelId: botConfig.fastModelId
|
|
@@ -15419,6 +15414,7 @@ ${await summarizeContext(args, deps)}`;
|
|
|
15419
15414
|
type: "handoff",
|
|
15420
15415
|
modelProfile: args.target.modelProfile,
|
|
15421
15416
|
modelId: args.target.modelId,
|
|
15417
|
+
...args.target.reasoningLevel ? { reasoningLevel: args.target.reasoningLevel } : {},
|
|
15422
15418
|
...args.triggeringToolCallId ? { triggeringToolCallId: args.triggeringToolCallId } : {},
|
|
15423
15419
|
replacementHistory: replacementMessages.map((replacementMessage) => ({
|
|
15424
15420
|
message: replacementMessage,
|
|
@@ -15478,12 +15474,35 @@ async function executeAgentRun(request) {
|
|
|
15478
15474
|
// a compatibility fallback for callers that have not projected it yet.
|
|
15479
15475
|
visibility: request.routing.destinationVisibility ?? request.routing.slackConversation?.visibility
|
|
15480
15476
|
});
|
|
15481
|
-
|
|
15482
|
-
|
|
15483
|
-
|
|
15477
|
+
const credentialActor = request.routing.credentialContext?.actor;
|
|
15478
|
+
const actor = actorFromRouting(request.routing);
|
|
15479
|
+
const userActor = actor && "userId" in actor ? actor : void 0;
|
|
15480
|
+
const runLogContext = {
|
|
15481
|
+
conversationId: request.conversationId,
|
|
15482
|
+
platform: request.routing.source.platform,
|
|
15483
|
+
messageConversationId: request.routing.source.platform === "slack" ? request.conversationId : request.routing.source.conversationId,
|
|
15484
|
+
destinationName: request.routing.destination.platform === "slack" ? request.routing.destination.channelId : request.routing.destination.conversationId,
|
|
15485
|
+
userId: userActor?.userId,
|
|
15486
|
+
userName: userActor?.userName,
|
|
15487
|
+
userEmail: userActor?.email,
|
|
15488
|
+
runId: request.runId,
|
|
15489
|
+
actorType: credentialActor ? "type" in credentialActor ? credentialActor.type : "system" : void 0,
|
|
15490
|
+
actorId: credentialActor ? "type" in credentialActor ? credentialActor.userId : credentialActor.name : void 0,
|
|
15491
|
+
assistantUserName: botConfig.userName
|
|
15492
|
+
};
|
|
15493
|
+
return withLogContext(
|
|
15494
|
+
runLogContext,
|
|
15495
|
+
() => runWithConversationPrivacy(
|
|
15496
|
+
conversationPrivacy ?? "private",
|
|
15497
|
+
() => executeAgentRunInPrivacyContext(
|
|
15498
|
+
request,
|
|
15499
|
+
conversationPrivacy,
|
|
15500
|
+
runLogContext
|
|
15501
|
+
)
|
|
15502
|
+
)
|
|
15484
15503
|
);
|
|
15485
15504
|
}
|
|
15486
|
-
async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
15505
|
+
async function executeAgentRunInPrivacyContext(request, conversationPrivacy, runLogContext) {
|
|
15487
15506
|
const { conversationId, input, routing, runId, turnId } = request;
|
|
15488
15507
|
const policy = request.policy ?? {};
|
|
15489
15508
|
const signal = policy.signal;
|
|
@@ -15560,16 +15579,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
15560
15579
|
activeModelProfile = projection.modelProfile;
|
|
15561
15580
|
activeModelId = modelIdForProfile(botConfig, activeModelProfile);
|
|
15562
15581
|
const shouldTrace = shouldEmitDevAgentTrace();
|
|
15563
|
-
const spanContext = {
|
|
15564
|
-
conversationId,
|
|
15565
|
-
slackThreadId: slackSource ? conversationId : void 0,
|
|
15566
|
-
slackUserId: slackActor?.userId,
|
|
15567
|
-
slackChannelId: slackDestination?.channelId,
|
|
15568
|
-
runId,
|
|
15569
|
-
...credentialActorLogContext,
|
|
15570
|
-
assistantUserName: botConfig.userName,
|
|
15571
|
-
modelId: activeModelId
|
|
15572
|
-
};
|
|
15582
|
+
const spanContext = { modelId: activeModelId };
|
|
15573
15583
|
const availableSkills = await discoverRunSkills({
|
|
15574
15584
|
skillDirs: policy.skillDirs,
|
|
15575
15585
|
spanContext
|
|
@@ -15726,12 +15736,13 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
15726
15736
|
);
|
|
15727
15737
|
const phaseUsage = hasAgentTurnUsage(standardPhaseUsage) ? standardPhaseUsage : void 0;
|
|
15728
15738
|
const selectedProfile = profileConfig(botConfig, args.profile);
|
|
15739
|
+
const handoffReasoningLevel = selectedProfile.reasoningLevel ?? turnRoute.reasoningLevel;
|
|
15729
15740
|
const target = {
|
|
15730
15741
|
modelId: selectedProfile.modelId,
|
|
15731
|
-
modelProfile: args.profile
|
|
15742
|
+
modelProfile: args.profile,
|
|
15743
|
+
reasoningLevel: handoffReasoningLevel
|
|
15732
15744
|
};
|
|
15733
15745
|
const handoffModel = resolveGatewayModel(target.modelId);
|
|
15734
|
-
const handoffReasoningLevel = selectedProfile.reasoningLevel ?? turnRoute.reasoningLevel;
|
|
15735
15746
|
const handoffThinkingLevel = toPiReasoningLevel(handoffReasoningLevel);
|
|
15736
15747
|
void (async () => {
|
|
15737
15748
|
await observers.onStatus?.({ text: "Switching models" });
|
|
@@ -15789,13 +15800,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
15789
15800
|
})
|
|
15790
15801
|
};
|
|
15791
15802
|
setTags({
|
|
15792
|
-
|
|
15793
|
-
slackThreadId: slackSource ? conversationId : void 0,
|
|
15794
|
-
slackUserId: slackActor?.userId,
|
|
15795
|
-
slackChannelId: slackDestination?.channelId,
|
|
15796
|
-
runId,
|
|
15797
|
-
...credentialActorLogContext,
|
|
15798
|
-
assistantUserName: botConfig.userName,
|
|
15803
|
+
...runLogContext,
|
|
15799
15804
|
modelId: activeModelId
|
|
15800
15805
|
});
|
|
15801
15806
|
const wiring = await wireAgentTools({
|
|
@@ -15954,6 +15959,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
15954
15959
|
}
|
|
15955
15960
|
};
|
|
15956
15961
|
const apiKeyOverride = getPiGatewayApiKey();
|
|
15962
|
+
let pendingPiHookError;
|
|
15957
15963
|
agent = new Agent({
|
|
15958
15964
|
...apiKeyOverride ? { getApiKey: () => apiKeyOverride } : {},
|
|
15959
15965
|
streamFn: createTracedStreamFn({ conversationPrivacy }),
|
|
@@ -15977,7 +15983,11 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
15977
15983
|
prepareNextTurn: async () => {
|
|
15978
15984
|
const update = applyPendingHandoff();
|
|
15979
15985
|
await drainSteeringMessages();
|
|
15980
|
-
runResume.
|
|
15986
|
+
const yieldError = runResume.prepareYieldIfDue(currentAgentMessages());
|
|
15987
|
+
if (yieldError) {
|
|
15988
|
+
pendingPiHookError = yieldError;
|
|
15989
|
+
throw yieldError;
|
|
15990
|
+
}
|
|
15981
15991
|
return update;
|
|
15982
15992
|
},
|
|
15983
15993
|
initialState: {
|
|
@@ -16024,7 +16034,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
16024
16034
|
if (shouldPromptAgent) {
|
|
16025
16035
|
runResume.setTurnStartMessageIndex(agent.state.messages.length);
|
|
16026
16036
|
}
|
|
16027
|
-
await withSpan(
|
|
16037
|
+
const authPauseOutcome = await withSpan(
|
|
16028
16038
|
`invoke_agent ${botConfig.userName}`,
|
|
16029
16039
|
"gen_ai.invoke_agent",
|
|
16030
16040
|
spanContext,
|
|
@@ -16077,8 +16087,9 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
16077
16087
|
});
|
|
16078
16088
|
removeAbortListener = () => signal.removeEventListener("abort", rejectWithAbort);
|
|
16079
16089
|
}) : void 0;
|
|
16090
|
+
let result2;
|
|
16080
16091
|
try {
|
|
16081
|
-
|
|
16092
|
+
result2 = await Promise.race(
|
|
16082
16093
|
abortPromise ? [run2, timeoutPromise, abortPromise] : [run2, timeoutPromise]
|
|
16083
16094
|
);
|
|
16084
16095
|
} catch (error) {
|
|
@@ -16119,11 +16130,12 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
16119
16130
|
runResume.getResumeSnapshot(currentAgentMessages())
|
|
16120
16131
|
);
|
|
16121
16132
|
}
|
|
16122
|
-
|
|
16133
|
+
const pendingAuthPause = getPendingAuthPause();
|
|
16134
|
+
if (pendingAuthPause) {
|
|
16123
16135
|
runResume.captureResumeSnapshot(
|
|
16124
16136
|
runResume.getResumeSnapshot(currentAgentMessages())
|
|
16125
16137
|
);
|
|
16126
|
-
throw
|
|
16138
|
+
throw pendingAuthPause;
|
|
16127
16139
|
}
|
|
16128
16140
|
throw error;
|
|
16129
16141
|
} finally {
|
|
@@ -16132,6 +16144,12 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
16132
16144
|
}
|
|
16133
16145
|
removeAbortListener?.();
|
|
16134
16146
|
}
|
|
16147
|
+
if (pendingPiHookError) {
|
|
16148
|
+
const error = pendingPiHookError;
|
|
16149
|
+
pendingPiHookError = void 0;
|
|
16150
|
+
throw error;
|
|
16151
|
+
}
|
|
16152
|
+
return result2;
|
|
16135
16153
|
};
|
|
16136
16154
|
const requestedProfile = activeModelProfile === STANDARD_MODEL_PROFILE ? turnRoute.profile : void 0;
|
|
16137
16155
|
let run;
|
|
@@ -16160,69 +16178,77 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
16160
16178
|
run = shouldPromptAgent ? agent.prompt(freshPromptMessage) : agent.continue();
|
|
16161
16179
|
}
|
|
16162
16180
|
let retryUsage;
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16166
|
-
|
|
16167
|
-
|
|
16168
|
-
|
|
16169
|
-
|
|
16170
|
-
|
|
16171
|
-
|
|
16172
|
-
|
|
16173
|
-
|
|
16174
|
-
|
|
16175
|
-
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
setSpanAttributes({
|
|
16188
|
-
...outputMessagesAttribute ? { "gen_ai.output.messages": outputMessagesAttribute } : {},
|
|
16189
|
-
...toGenAiMessagesTraceAttributes(
|
|
16190
|
-
"gen_ai.output",
|
|
16191
|
-
outputMessages
|
|
16192
|
-
),
|
|
16193
|
-
...lastAssistant ? {
|
|
16194
|
-
"gen_ai.response.finish_reasons": [
|
|
16195
|
-
normalizeGenAiFinishReason(lastAssistant.stopReason)
|
|
16196
|
-
]
|
|
16197
|
-
} : {},
|
|
16198
|
-
...extractGenAiUsageAttributes(usageSummary)
|
|
16199
|
-
});
|
|
16200
|
-
if (getPendingAuthPause()) {
|
|
16201
|
-
runResume.captureResumeSnapshot(
|
|
16202
|
-
runResume.getResumeSnapshot(currentAgentMessages())
|
|
16181
|
+
try {
|
|
16182
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
16183
|
+
await runAgentStep(run);
|
|
16184
|
+
if (assistantMessageDeliveryError) {
|
|
16185
|
+
throw assistantMessageDeliveryError;
|
|
16186
|
+
}
|
|
16187
|
+
signal?.throwIfAborted();
|
|
16188
|
+
newMessages = agent.state.messages.slice(
|
|
16189
|
+
runResume.beforeMessageCount
|
|
16190
|
+
);
|
|
16191
|
+
const outputMessages = newMessages.filter(isAssistantMessage);
|
|
16192
|
+
const outputMessagesAttribute = serializeGenAiAttribute(
|
|
16193
|
+
conversationPrivacy === "public" ? outputMessages.map(toCanonicalOutputMessage) : void 0
|
|
16194
|
+
);
|
|
16195
|
+
const lastAssistant = outputMessages.at(-1);
|
|
16196
|
+
const usageSummary = extractGenAiUsageSummary(...outputMessages);
|
|
16197
|
+
const currentUsage = hasAgentTurnUsage(usageSummary) ? usageSummary : void 0;
|
|
16198
|
+
const currentPhaseUsage = addAgentTurnUsage(
|
|
16199
|
+
retryUsage,
|
|
16200
|
+
currentUsage
|
|
16201
|
+
);
|
|
16202
|
+
turnUsage = addAgentTurnUsage(
|
|
16203
|
+
handoffPhaseUsage,
|
|
16204
|
+
currentPhaseUsage
|
|
16203
16205
|
);
|
|
16204
|
-
|
|
16206
|
+
setSpanAttributes({
|
|
16207
|
+
...outputMessagesAttribute ? { "gen_ai.output.messages": outputMessagesAttribute } : {},
|
|
16208
|
+
...toGenAiMessagesTraceAttributes(
|
|
16209
|
+
"gen_ai.output",
|
|
16210
|
+
outputMessages
|
|
16211
|
+
),
|
|
16212
|
+
...lastAssistant ? {
|
|
16213
|
+
"gen_ai.response.finish_reasons": [
|
|
16214
|
+
normalizeGenAiFinishReason(lastAssistant.stopReason)
|
|
16215
|
+
]
|
|
16216
|
+
} : {},
|
|
16217
|
+
...extractGenAiUsageAttributes(usageSummary)
|
|
16218
|
+
});
|
|
16219
|
+
const pendingAuthPause = getPendingAuthPause();
|
|
16220
|
+
if (pendingAuthPause) {
|
|
16221
|
+
runResume.captureResumeSnapshot(
|
|
16222
|
+
runResume.getResumeSnapshot(currentAgentMessages())
|
|
16223
|
+
);
|
|
16224
|
+
throw pendingAuthPause;
|
|
16225
|
+
}
|
|
16226
|
+
const providerRetry = nextProviderRetry({
|
|
16227
|
+
attempt,
|
|
16228
|
+
messages: agent.state.messages,
|
|
16229
|
+
retryableFailure: lastAssistant !== void 0 && isRetryableAssistantError(lastAssistant)
|
|
16230
|
+
});
|
|
16231
|
+
if (!providerRetry) {
|
|
16232
|
+
break;
|
|
16233
|
+
}
|
|
16234
|
+
retryUsage = currentPhaseUsage;
|
|
16235
|
+
agent.state.messages = providerRetry.messages;
|
|
16236
|
+
await runResume.persistSafeBoundary(providerRetry.messages);
|
|
16237
|
+
logWarn(
|
|
16238
|
+
"agent_turn_provider_retry",
|
|
16239
|
+
spanContext,
|
|
16240
|
+
{},
|
|
16241
|
+
"Retrying transient provider failure"
|
|
16242
|
+
);
|
|
16243
|
+
await sleep(providerRetry.delayMs, signal);
|
|
16244
|
+
signal?.throwIfAborted();
|
|
16245
|
+
run = agent.continue();
|
|
16205
16246
|
}
|
|
16206
|
-
|
|
16207
|
-
|
|
16208
|
-
|
|
16209
|
-
retryableFailure: lastAssistant !== void 0 && isRetryableAssistantError(lastAssistant)
|
|
16210
|
-
});
|
|
16211
|
-
if (!providerRetry) {
|
|
16212
|
-
break;
|
|
16247
|
+
} catch (error) {
|
|
16248
|
+
if (error instanceof AuthorizationPauseError) {
|
|
16249
|
+
return await runResume.parkForAuth(error, turnUsage);
|
|
16213
16250
|
}
|
|
16214
|
-
|
|
16215
|
-
agent.state.messages = providerRetry.messages;
|
|
16216
|
-
await runResume.persistSafeBoundary(providerRetry.messages);
|
|
16217
|
-
logWarn(
|
|
16218
|
-
"agent_turn_provider_retry",
|
|
16219
|
-
spanContext,
|
|
16220
|
-
{},
|
|
16221
|
-
"Retrying transient provider failure"
|
|
16222
|
-
);
|
|
16223
|
-
await sleep(providerRetry.delayMs, signal);
|
|
16224
|
-
signal?.throwIfAborted();
|
|
16225
|
-
run = agent.continue();
|
|
16251
|
+
throw error;
|
|
16226
16252
|
}
|
|
16227
16253
|
},
|
|
16228
16254
|
{
|
|
@@ -16243,6 +16269,9 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
16243
16269
|
...inputMessagesAttribute ? { "gen_ai.input.messages": inputMessagesAttribute } : {}
|
|
16244
16270
|
}
|
|
16245
16271
|
);
|
|
16272
|
+
if (authPauseOutcome) {
|
|
16273
|
+
return authPauseOutcome;
|
|
16274
|
+
}
|
|
16246
16275
|
} finally {
|
|
16247
16276
|
unsubscribe();
|
|
16248
16277
|
}
|
|
@@ -16273,8 +16302,14 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
16273
16302
|
throw error.originalError;
|
|
16274
16303
|
}
|
|
16275
16304
|
const runError = error instanceof AssistantMessageDeliveryError ? error.originalError : error;
|
|
16305
|
+
if (runError instanceof AuthPausePersistenceError) {
|
|
16306
|
+
throw runError;
|
|
16307
|
+
}
|
|
16308
|
+
if (resume && runError instanceof AuthorizationPauseError) {
|
|
16309
|
+
return await resume.parkForAuth(runError, turnUsage);
|
|
16310
|
+
}
|
|
16276
16311
|
if (resume) {
|
|
16277
|
-
const
|
|
16312
|
+
const outcome = await resume.translateSuspension({
|
|
16278
16313
|
currentUsage: turnUsage,
|
|
16279
16314
|
error: runError
|
|
16280
16315
|
});
|
|
@@ -16303,16 +16338,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
16303
16338
|
logException(
|
|
16304
16339
|
error,
|
|
16305
16340
|
"assistant_reply_generation_failed",
|
|
16306
|
-
{
|
|
16307
|
-
conversationId,
|
|
16308
|
-
slackThreadId: slackSource ? conversationId : void 0,
|
|
16309
|
-
slackUserId: slackActor?.userId,
|
|
16310
|
-
slackChannelId: slackDestination?.channelId,
|
|
16311
|
-
runId,
|
|
16312
|
-
...credentialActorLogContext,
|
|
16313
|
-
assistantUserName: botConfig.userName,
|
|
16314
|
-
modelId: activeModelId
|
|
16315
|
-
},
|
|
16341
|
+
{ modelId: activeModelId },
|
|
16316
16342
|
{},
|
|
16317
16343
|
"executeAgentRun failed"
|
|
16318
16344
|
);
|