@sentry/junior 0.148.0 → 0.150.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-VAUYT6PD.js → agent-hooks-SEOGOGKX.js} +10 -10
- package/dist/api/conversations/aggregate.d.ts +2 -0
- package/dist/api/conversations/create.d.ts +1 -1
- package/dist/api/conversations/pending-messages.d.ts +15 -0
- package/dist/api/people/shared.d.ts +2 -0
- package/dist/api/schema/conversation.d.ts +78 -4
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +186 -35
- package/dist/app.js +152 -186
- package/dist/{catalog-runtime-WADOZVTB.js → catalog-runtime-HA7RIWYT.js} +5 -5
- package/dist/chat/agent/index.d.ts +5 -4
- package/dist/chat/agent/prompt.d.ts +8 -5
- package/dist/chat/agent/resume.d.ts +2 -2
- package/dist/chat/agent/tools.d.ts +4 -7
- package/dist/chat/agent/{request.d.ts → types.d.ts} +138 -129
- package/dist/chat/agent-dispatch/types.d.ts +2 -2
- package/dist/chat/agent-invocations/spawn.d.ts +2 -2
- package/dist/chat/api-turns/work.d.ts +6 -1
- package/dist/chat/app/services.d.ts +1 -1
- package/dist/chat/plugins/viewer.d.ts +4 -0
- package/dist/chat/runtime/agent-runner.d.ts +7 -5
- package/dist/chat/runtime/reply-executor.d.ts +0 -2
- package/dist/chat/runtime/slack-resume.d.ts +3 -3
- package/dist/chat/services/conversation-memory.d.ts +2 -2
- package/dist/chat/services/conversation-title.d.ts +20 -0
- package/dist/chat/slack/assistant-thread/title.d.ts +10 -27
- package/dist/chat/state/conversation.d.ts +1 -0
- package/dist/chat/task-execution/paused-turn.d.ts +2 -2
- package/dist/chat/tools/types.d.ts +1 -1
- package/dist/{chunk-QOWHHM3F.js → chunk-3GL327SC.js} +1 -1
- package/dist/{chunk-45LOR4PU.js → chunk-3JVUWLR7.js} +45 -1
- package/dist/{chunk-4GXJUYJV.js → chunk-3ZMKDHCT.js} +2 -2
- package/dist/{chunk-DUY5CDAM.js → chunk-4KAYAIBV.js} +1 -1
- package/dist/{chunk-ULAU5ZGU.js → chunk-4VH7KLGC.js} +106 -113
- package/dist/{chunk-V2FXMOEA.js → chunk-64K7GKRW.js} +2 -2
- package/dist/{chunk-2B3PT3V2.js → chunk-6PFDWAK2.js} +1 -1
- package/dist/{chunk-LNVEIJ2L.js → chunk-7D4GNUV2.js} +5 -5
- package/dist/{chunk-ZPL2RR7F.js → chunk-7GOP6VFJ.js} +40 -36
- package/dist/{chunk-HWQGBIH7.js → chunk-7NLW2NF5.js} +1 -1
- package/dist/{chunk-55F4QU2V.js → chunk-7QB2CKCW.js} +1 -1
- package/dist/{chunk-WCN4YSH7.js → chunk-DWETNV66.js} +6 -6
- package/dist/{chunk-D3WPMGEX.js → chunk-F5NMSEBL.js} +1 -1
- package/dist/{chunk-IL4EDBMV.js → chunk-FEFEIA3Z.js} +5 -5
- package/dist/{chunk-WOONT5ZP.js → chunk-H2RLIJ7G.js} +1 -1
- package/dist/{chunk-VRHTNBA6.js → chunk-ILYL6YFD.js} +3 -3
- package/dist/{chunk-VCYSOXON.js → chunk-IPGNWXA3.js} +545 -7
- package/dist/{chunk-LAZGHEYU.js → chunk-IZRSLANA.js} +1 -1
- package/dist/{chunk-EAI67NTM.js → chunk-JQXJ2E53.js} +1 -1
- package/dist/{chunk-HLPLT3NY.js → chunk-M5OZSVJI.js} +8 -4
- package/dist/{chunk-XJ42NBP5.js → chunk-MCNP7A7T.js} +8 -8
- package/dist/{chunk-OJCP3C3J.js → chunk-NCGVQXX5.js} +22 -26
- package/dist/{chunk-4AQZYNHM.js → chunk-NNOCRVQO.js} +2 -2
- package/dist/{chunk-GXYDVZKM.js → chunk-P43QM7JY.js} +5 -5
- package/dist/{chunk-EINWQFXI.js → chunk-QPIPYVGE.js} +5 -5
- package/dist/{chunk-GDFF3BQG.js → chunk-RF6J3DIO.js} +34 -36
- package/dist/{chunk-D6YX4NNN.js → chunk-SH6ZKJFZ.js} +4 -4
- package/dist/{chunk-LE5H7LMT.js → chunk-SHDREBGC.js} +1 -1
- package/dist/{chunk-VMNRXKAH.js → chunk-TZLYAO2J.js} +191 -134
- package/dist/{chunk-RRJV5UR5.js → chunk-UIMBNY6O.js} +11 -337
- package/dist/{chunk-ZCHIC2GM.js → chunk-UOFQEVR5.js} +15 -6
- package/dist/{chunk-7OEIXFC3.js → chunk-Y2VZ54CQ.js} +12 -12
- package/dist/{chunk-VY6W3T43.js → chunk-ZBOGYZ53.js} +4 -4
- package/dist/{chunk-POSZWRGL.js → chunk-ZUQT35YC.js} +1 -1
- package/dist/cli/chat.js +31 -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-XUKZRFFK.js → db-HUW75QG7.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-LPZMMGFI.js → oauth-callback-server-DP7NIZPQ.js} +24 -25
- package/dist/{runner-DGKUTMPX.js → runner-AINV7K3M.js} +47 -45
- package/dist/{skills-P7YUFSXM.js → skills-PKS37E6B.js} +6 -6
- package/dist/spawn-NJCDEPPL.js +38 -0
- package/dist/{validation-S7U5M5NR.js → validation-PDC3MVMM.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-GAA7TVAD.js → work-KJLJRPXS.js} +17 -17
- package/dist/{worker-JXPJH3QB.js → worker-TYQ7YVIR.js} +11 -11
- package/package.json +5 -5
- package/dist/chunk-4EA2SFK2.js +0 -137
- package/dist/spawn-DSK3ZEVD.js +0 -38
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
PluginCredentialFailureError,
|
|
8
8
|
agentNameSchema,
|
|
9
9
|
createPluginAuthOrchestration
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QPIPYVGE.js";
|
|
11
11
|
import {
|
|
12
12
|
authorizationId
|
|
13
13
|
} from "./chunk-DIB4GX3G.js";
|
|
@@ -32,15 +32,15 @@ import {
|
|
|
32
32
|
searchSlackUsers,
|
|
33
33
|
selectPluginGrant,
|
|
34
34
|
toMcpProviderError
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-MCNP7A7T.js";
|
|
36
36
|
import {
|
|
37
37
|
RetryableDeliveryError,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
actorFromRun,
|
|
39
|
+
assertRunConsistency,
|
|
40
40
|
isAgentRunFeatureDisabled,
|
|
41
|
-
|
|
41
|
+
surfaceFromRun,
|
|
42
42
|
toolInvocationDestination
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-RF6J3DIO.js";
|
|
44
44
|
import {
|
|
45
45
|
addReactionToMessage,
|
|
46
46
|
deliverOAuthAuthorization,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
getSlackMessagePermalink,
|
|
49
49
|
resolveBaseUrl,
|
|
50
50
|
uploadFilesToConversation
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-DWETNV66.js";
|
|
52
52
|
import {
|
|
53
53
|
parseSandboxEgressAuthRequiredSignal,
|
|
54
54
|
parseSandboxEgressPermissionDeniedSignal,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
runNonInteractiveCommand,
|
|
78
78
|
throwSandboxOperationError,
|
|
79
79
|
wrapSandboxSetupError
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-ZBOGYZ53.js";
|
|
81
81
|
import {
|
|
82
82
|
SCHEDULED_TASK_SYSTEM_ACTOR,
|
|
83
83
|
compactEventTask,
|
|
@@ -109,18 +109,10 @@ import {
|
|
|
109
109
|
saveEventTask,
|
|
110
110
|
scheduledTaskAttributes,
|
|
111
111
|
writableEventTask
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-P43QM7JY.js";
|
|
113
113
|
import {
|
|
114
114
|
parseSlackThreadId
|
|
115
|
-
} from "./chunk-
|
|
116
|
-
import {
|
|
117
|
-
SHORT_TITLE_MAX_LENGTH,
|
|
118
|
-
estimateTextTokens,
|
|
119
|
-
generateShortTitle,
|
|
120
|
-
getAgentContextCompactionTriggerTokens,
|
|
121
|
-
getAgentContextInputLimitTokens,
|
|
122
|
-
resolveTaskTitle
|
|
123
|
-
} from "./chunk-4EA2SFK2.js";
|
|
115
|
+
} from "./chunk-H2RLIJ7G.js";
|
|
124
116
|
import {
|
|
125
117
|
AGENTS_REMOVAL_NOTICE,
|
|
126
118
|
AGENTS_REPLACEMENT_NOTICE,
|
|
@@ -129,6 +121,7 @@ import {
|
|
|
129
121
|
MAX_TEXT_CHARS,
|
|
130
122
|
NO_REPLY_MARKER,
|
|
131
123
|
RIPGREP_EXCLUDED_GLOBS,
|
|
124
|
+
SHORT_TITLE_MAX_LENGTH,
|
|
132
125
|
TURN_CONTEXT_TAG,
|
|
133
126
|
ToolInputError,
|
|
134
127
|
TurnInputCommitLostError,
|
|
@@ -141,9 +134,13 @@ import {
|
|
|
141
134
|
containsNoReplyMarker,
|
|
142
135
|
continuableMessages,
|
|
143
136
|
decideReply,
|
|
137
|
+
estimateTextTokens,
|
|
144
138
|
extractAssistantText,
|
|
145
139
|
findSingleRepositoryDirectory,
|
|
146
140
|
findVisibleAgentsInstructions,
|
|
141
|
+
generateShortTitle,
|
|
142
|
+
getAgentContextCompactionTriggerTokens,
|
|
143
|
+
getAgentContextInputLimitTokens,
|
|
147
144
|
getAssistantReplyText,
|
|
148
145
|
getPiMessageRole,
|
|
149
146
|
getRipgrepSearchLocation,
|
|
@@ -177,6 +174,7 @@ import {
|
|
|
177
174
|
recordTurnRoute,
|
|
178
175
|
renderAgentsInstructions,
|
|
179
176
|
resolveRepositoryInstructions,
|
|
177
|
+
resolveTaskTitle,
|
|
180
178
|
resolveWorkspacePath,
|
|
181
179
|
retainRuntimeTurnContext,
|
|
182
180
|
sanitizeAssistantText,
|
|
@@ -184,7 +182,7 @@ import {
|
|
|
184
182
|
stripRuntimeTurnContext,
|
|
185
183
|
trimTrailingAssistantMessages,
|
|
186
184
|
truncateText
|
|
187
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-IPGNWXA3.js";
|
|
188
186
|
import {
|
|
189
187
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
190
188
|
} from "./chunk-3Y47VMHV.js";
|
|
@@ -200,7 +198,7 @@ import {
|
|
|
200
198
|
getSlackToolContext,
|
|
201
199
|
readActorIdentity,
|
|
202
200
|
resolveChannelCapabilities
|
|
203
|
-
} from "./chunk-
|
|
201
|
+
} from "./chunk-UOFQEVR5.js";
|
|
204
202
|
import {
|
|
205
203
|
SlackActionError,
|
|
206
204
|
downloadPrivateSlackFile,
|
|
@@ -209,7 +207,7 @@ import {
|
|
|
209
207
|
isConversationScopedChannel,
|
|
210
208
|
normalizeSlackConversationId,
|
|
211
209
|
withSlackRetries
|
|
212
|
-
} from "./chunk-
|
|
210
|
+
} from "./chunk-64K7GKRW.js";
|
|
213
211
|
import {
|
|
214
212
|
KNOWN_CONVERSATION_EVENT_TYPES,
|
|
215
213
|
contextProvenance,
|
|
@@ -221,10 +219,10 @@ import {
|
|
|
221
219
|
instructionActors,
|
|
222
220
|
instructionProvenanceFor,
|
|
223
221
|
sameActorIdentity
|
|
224
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-ILYL6YFD.js";
|
|
225
223
|
import {
|
|
226
224
|
juniorIdentities
|
|
227
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-F5NMSEBL.js";
|
|
228
226
|
import {
|
|
229
227
|
SANDBOX_DATA_ROOT,
|
|
230
228
|
SANDBOX_SKILLS_ROOT,
|
|
@@ -236,7 +234,7 @@ import {
|
|
|
236
234
|
} from "./chunk-EM225ITJ.js";
|
|
237
235
|
import {
|
|
238
236
|
getStateAdapter
|
|
239
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-6PFDWAK2.js";
|
|
240
238
|
import {
|
|
241
239
|
ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
|
|
242
240
|
COMPACTION_SUMMARY_PREFIX,
|
|
@@ -269,7 +267,7 @@ import {
|
|
|
269
267
|
resolveGatewayCredential,
|
|
270
268
|
resolveGatewayModel,
|
|
271
269
|
unwrapCurrentInstruction
|
|
272
|
-
} from "./chunk-
|
|
270
|
+
} from "./chunk-3ZMKDHCT.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-SHDREBGC.js";
|
|
283
281
|
import {
|
|
284
282
|
discoverSkills,
|
|
285
283
|
findSkillByName,
|
|
286
284
|
loadSkillsByName,
|
|
287
285
|
parseSkillInvocation
|
|
288
|
-
} from "./chunk-
|
|
286
|
+
} from "./chunk-NNOCRVQO.js";
|
|
289
287
|
import {
|
|
290
288
|
pluginCatalogRuntime
|
|
291
|
-
} from "./chunk-
|
|
289
|
+
} from "./chunk-7NLW2NF5.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-ZUQT35YC.js";
|
|
300
298
|
import {
|
|
301
299
|
credentialUserSubjectId
|
|
302
300
|
} from "./chunk-RUIXF3YQ.js";
|
|
@@ -326,7 +324,7 @@ import {
|
|
|
326
324
|
summarizeMessageText,
|
|
327
325
|
withLogContext,
|
|
328
326
|
withSpan
|
|
329
|
-
} from "./chunk-
|
|
327
|
+
} from "./chunk-JQXJ2E53.js";
|
|
330
328
|
import {
|
|
331
329
|
startInactiveSpan,
|
|
332
330
|
withActiveSpan
|
|
@@ -2245,12 +2243,13 @@ function buildUserTurnInput(args) {
|
|
|
2245
2243
|
}
|
|
2246
2244
|
return { contextContentParts: [], routerBlocks, userContentParts };
|
|
2247
2245
|
}
|
|
2248
|
-
function buildPromptInput(
|
|
2249
|
-
const
|
|
2246
|
+
function buildPromptInput(args) {
|
|
2247
|
+
const { instruction, history } = args;
|
|
2248
|
+
const promptConversationContext = history && history.length > 0 && !instruction.includeConversationContextWithHistory ? void 0 : instruction.context;
|
|
2250
2249
|
const promptInput = buildUserTurnInput({
|
|
2251
|
-
omittedImageAttachmentCount:
|
|
2252
|
-
userAttachments:
|
|
2253
|
-
userTurnText: buildUserTurnText(
|
|
2250
|
+
omittedImageAttachmentCount: instruction.omittedImageAttachmentCount ?? 0,
|
|
2251
|
+
userAttachments: instruction.attachments ? [...instruction.attachments] : void 0,
|
|
2252
|
+
userTurnText: buildUserTurnText(instruction.text, instruction.actor)
|
|
2254
2253
|
});
|
|
2255
2254
|
const trimmedContext = promptConversationContext?.trim();
|
|
2256
2255
|
return {
|
|
@@ -2261,7 +2260,7 @@ function buildPromptInput(input) {
|
|
|
2261
2260
|
function buildSteeringPiMessage(message) {
|
|
2262
2261
|
const { userContentParts } = buildUserTurnInput({
|
|
2263
2262
|
userTurnText: buildUserTurnText(message.text, message.actor),
|
|
2264
|
-
userAttachments: message.
|
|
2263
|
+
userAttachments: message.attachments ? [...message.attachments] : void 0,
|
|
2265
2264
|
omittedImageAttachmentCount: message.omittedImageAttachmentCount ?? 0
|
|
2266
2265
|
});
|
|
2267
2266
|
return {
|
|
@@ -2335,7 +2334,7 @@ function checkpointedPrompt(args) {
|
|
|
2335
2334
|
};
|
|
2336
2335
|
}
|
|
2337
2336
|
async function assemblePrompt(args) {
|
|
2338
|
-
const source = args.
|
|
2337
|
+
const source = args.run.source;
|
|
2339
2338
|
const hasPromptCheckpoint = args.resumedFromSessionRecord && args.existingTurnStartMessageIndex !== void 0;
|
|
2340
2339
|
const shouldPromptAgent = !args.resumedFromSessionRecord || !hasPromptCheckpoint;
|
|
2341
2340
|
const requestContentParts = args.userContentParts;
|
|
@@ -2367,11 +2366,11 @@ async function assemblePrompt(args) {
|
|
|
2367
2366
|
toolGuidance: args.toolGuidance,
|
|
2368
2367
|
runtime: {
|
|
2369
2368
|
conversationId: args.spanContext.conversationId,
|
|
2370
|
-
slackConversation: args.
|
|
2369
|
+
slackConversation: args.run.slackConversation
|
|
2371
2370
|
},
|
|
2372
|
-
dispatch: args.
|
|
2373
|
-
...args.
|
|
2374
|
-
destination: args.
|
|
2371
|
+
dispatch: args.run.dispatch ? {
|
|
2372
|
+
...args.run.dispatch,
|
|
2373
|
+
destination: args.run.destination,
|
|
2375
2374
|
source
|
|
2376
2375
|
} : void 0,
|
|
2377
2376
|
actor: isUserActor(args.currentActor) ? args.currentActor : void 0,
|
|
@@ -15920,8 +15919,8 @@ async function tryRecordSkillLoadStat(skill) {
|
|
|
15920
15919
|
}
|
|
15921
15920
|
}
|
|
15922
15921
|
function resolveToolRuntimeRoute(args) {
|
|
15923
|
-
const destination = toolInvocationDestination(args.
|
|
15924
|
-
switch (args.
|
|
15922
|
+
const destination = toolInvocationDestination(args.run);
|
|
15923
|
+
switch (args.run.source.platform) {
|
|
15925
15924
|
case "slack": {
|
|
15926
15925
|
if (destination.platform !== "slack") {
|
|
15927
15926
|
throw new TypeError("Slack tool runtime requires a Slack destination");
|
|
@@ -15929,8 +15928,8 @@ function resolveToolRuntimeRoute(args) {
|
|
|
15929
15928
|
return {
|
|
15930
15929
|
destination,
|
|
15931
15930
|
actor: args.actor?.platform === "slack" ? args.actor : void 0,
|
|
15932
|
-
source: args.
|
|
15933
|
-
slackActionToken: args.
|
|
15931
|
+
source: args.run.source,
|
|
15932
|
+
slackActionToken: args.run.slackActionToken
|
|
15934
15933
|
};
|
|
15935
15934
|
}
|
|
15936
15935
|
case "local": {
|
|
@@ -15940,20 +15939,20 @@ function resolveToolRuntimeRoute(args) {
|
|
|
15940
15939
|
return {
|
|
15941
15940
|
destination,
|
|
15942
15941
|
actor: args.actor?.platform === "local" ? args.actor : void 0,
|
|
15943
|
-
source: args.
|
|
15942
|
+
source: args.run.source
|
|
15944
15943
|
};
|
|
15945
15944
|
}
|
|
15946
15945
|
case "web":
|
|
15947
15946
|
return {
|
|
15948
15947
|
destination,
|
|
15949
15948
|
actor: args.actor?.platform === "web" ? args.actor : void 0,
|
|
15950
|
-
source: args.
|
|
15949
|
+
source: args.run.source
|
|
15951
15950
|
};
|
|
15952
15951
|
}
|
|
15953
15952
|
}
|
|
15954
15953
|
async function wireAgentTools(args) {
|
|
15955
|
-
const runSource = args.
|
|
15956
|
-
const credentialUserId = args.
|
|
15954
|
+
const runSource = args.run.source;
|
|
15955
|
+
const credentialUserId = args.run.credentialContext ? credentialUserSubjectId(args.run.credentialContext) : void 0;
|
|
15957
15956
|
const userTokenStore = createUserTokenStore();
|
|
15958
15957
|
const pluginHooks = createPluginHookRunner({
|
|
15959
15958
|
actor: args.currentActor,
|
|
@@ -15963,54 +15962,54 @@ async function wireAgentTools(args) {
|
|
|
15963
15962
|
sandboxRef: args.state.sandboxRef,
|
|
15964
15963
|
skills: args.availableSkills,
|
|
15965
15964
|
traceContext: args.spanContext,
|
|
15966
|
-
tracePropagation: args.
|
|
15967
|
-
egressSignals: args.
|
|
15968
|
-
credentialEgress: args.
|
|
15965
|
+
tracePropagation: args.run.environment?.sandboxTracePropagation,
|
|
15966
|
+
egressSignals: args.run.environment?.sandboxEgressSignals,
|
|
15967
|
+
credentialEgress: args.run.credentialContext,
|
|
15969
15968
|
actor: args.currentActor,
|
|
15970
|
-
locationConfiguration: args.
|
|
15969
|
+
locationConfiguration: args.run.environment?.locationConfiguration,
|
|
15971
15970
|
configurationValues: args.configurationValues,
|
|
15972
15971
|
getActiveSkill: () => args.skillSandbox.getActiveSkill(),
|
|
15973
15972
|
prepareSandbox: pluginHooks.prepareSandbox,
|
|
15974
15973
|
onSandboxRefChanged: args.onSandboxRefChanged,
|
|
15975
15974
|
persistSandboxRef: args.durability.onSandboxRefChanged
|
|
15976
15975
|
});
|
|
15977
|
-
const slackDestination = args.
|
|
15976
|
+
const slackDestination = args.run.destination.platform === "slack" ? args.run.destination : void 0;
|
|
15978
15977
|
const slackChannelId = slackDestination?.channelId;
|
|
15979
15978
|
const mcpAuth = createMcpAuthOrchestration({
|
|
15980
15979
|
abortAgent: args.abortAgent,
|
|
15981
|
-
conversationId: args.conversationId,
|
|
15982
|
-
sessionId: args.turnId,
|
|
15980
|
+
conversationId: args.run.conversationId,
|
|
15981
|
+
sessionId: args.run.turnId,
|
|
15983
15982
|
actorId: credentialUserId,
|
|
15984
15983
|
channelId: slackChannelId,
|
|
15985
|
-
destination: args.
|
|
15984
|
+
destination: args.run.destination,
|
|
15986
15985
|
source: runSource,
|
|
15987
|
-
threadTs: args.
|
|
15988
|
-
toolChannelId: args.
|
|
15986
|
+
threadTs: args.run.source.platform === "slack" ? args.run.source.threadTs : void 0,
|
|
15987
|
+
toolChannelId: args.run.toolChannelId,
|
|
15989
15988
|
userMessage: args.userInput,
|
|
15990
15989
|
pendingAuth: args.state.pendingAuth,
|
|
15991
15990
|
getConfiguration: () => args.configurationValues,
|
|
15992
15991
|
recordPendingAuth: args.durability.recordPendingAuth,
|
|
15993
15992
|
interactiveAuthEnabled: !isAgentRunFeatureDisabled(
|
|
15994
|
-
args.
|
|
15993
|
+
args.run.disabledFeatures,
|
|
15995
15994
|
"interactive-auth"
|
|
15996
15995
|
),
|
|
15997
15996
|
authorization: args.authorization
|
|
15998
15997
|
});
|
|
15999
15998
|
const pluginAuth = createPluginAuthOrchestration({
|
|
16000
15999
|
abortAgent: args.abortAgent,
|
|
16001
|
-
conversationId: args.conversationId,
|
|
16002
|
-
sessionId: args.turnId,
|
|
16000
|
+
conversationId: args.run.conversationId,
|
|
16001
|
+
sessionId: args.run.turnId,
|
|
16003
16002
|
actorId: credentialUserId,
|
|
16004
16003
|
actor: args.currentActor,
|
|
16005
16004
|
channelId: slackChannelId,
|
|
16006
|
-
destination: args.
|
|
16005
|
+
destination: args.run.destination,
|
|
16007
16006
|
source: runSource,
|
|
16008
|
-
threadTs: args.
|
|
16007
|
+
threadTs: args.run.source.platform === "slack" ? args.run.source.threadTs : void 0,
|
|
16009
16008
|
userMessage: args.userInput,
|
|
16010
16009
|
pendingAuth: args.state.pendingAuth,
|
|
16011
16010
|
recordPendingAuth: args.durability.recordPendingAuth,
|
|
16012
16011
|
interactiveAuthEnabled: !isAgentRunFeatureDisabled(
|
|
16013
|
-
args.
|
|
16012
|
+
args.run.disabledFeatures,
|
|
16014
16013
|
"interactive-auth"
|
|
16015
16014
|
),
|
|
16016
16015
|
userTokenStore,
|
|
@@ -16024,7 +16023,7 @@ async function wireAgentTools(args) {
|
|
|
16024
16023
|
onToolSuccess: async (input) => {
|
|
16025
16024
|
await pluginHooks.afterMcpTool({
|
|
16026
16025
|
...input,
|
|
16027
|
-
conversationId: args.conversationId
|
|
16026
|
+
conversationId: args.run.conversationId
|
|
16028
16027
|
});
|
|
16029
16028
|
}
|
|
16030
16029
|
}
|
|
@@ -16037,11 +16036,11 @@ async function wireAgentTools(args) {
|
|
|
16037
16036
|
args.invokedSkill && args.activeSkills.some((skill) => skill.name === args.invokedSkill?.name)
|
|
16038
16037
|
);
|
|
16039
16038
|
const commonToolRuntimeContext = {
|
|
16040
|
-
conversationId: args.conversationId,
|
|
16039
|
+
conversationId: args.run.conversationId,
|
|
16041
16040
|
userText: args.userInput,
|
|
16042
16041
|
configuration: args.configurationValues,
|
|
16043
16042
|
egress: createPluginEgress({
|
|
16044
|
-
credentialContext: args.
|
|
16043
|
+
credentialContext: args.run.credentialContext,
|
|
16045
16044
|
pluginAuth: {
|
|
16046
16045
|
async handleAuthRequired(signal) {
|
|
16047
16046
|
await pluginAuth.maybeHandleAuthSignal({
|
|
@@ -16069,7 +16068,7 @@ async function wireAgentTools(args) {
|
|
|
16069
16068
|
};
|
|
16070
16069
|
const toolRoute = resolveToolRuntimeRoute({
|
|
16071
16070
|
actor: args.currentActor,
|
|
16072
|
-
|
|
16071
|
+
run: args.run
|
|
16073
16072
|
});
|
|
16074
16073
|
const toolRuntimeContext = {
|
|
16075
16074
|
...commonToolRuntimeContext,
|
|
@@ -16078,16 +16077,16 @@ async function wireAgentTools(args) {
|
|
|
16078
16077
|
const actionReview = createToolActionReview({
|
|
16079
16078
|
context: {
|
|
16080
16079
|
actor: args.currentActor,
|
|
16081
|
-
conversationId: args.conversationId,
|
|
16082
|
-
credentialContext: args.
|
|
16080
|
+
conversationId: args.run.conversationId,
|
|
16081
|
+
credentialContext: args.run.credentialContext,
|
|
16083
16082
|
destination: toolRoute.destination,
|
|
16084
16083
|
source: runSource,
|
|
16085
16084
|
userIntent: args.currentUserIntent,
|
|
16086
16085
|
evidence: () => buildToolActionEvidence(args.currentAgentMessages())
|
|
16087
16086
|
},
|
|
16088
16087
|
onDecision: ({ toolCallId, toolName, decision }) => recordGuardianActionReviewed({
|
|
16089
|
-
conversationId: args.conversationId,
|
|
16090
|
-
turnId: args.turnId,
|
|
16088
|
+
conversationId: args.run.conversationId,
|
|
16089
|
+
turnId: args.run.turnId,
|
|
16091
16090
|
toolCallId,
|
|
16092
16091
|
toolName,
|
|
16093
16092
|
costUsd: decision.costUsd,
|
|
@@ -16110,7 +16109,7 @@ async function wireAgentTools(args) {
|
|
|
16110
16109
|
args.generatedFiles.push(...files);
|
|
16111
16110
|
return refs;
|
|
16112
16111
|
},
|
|
16113
|
-
toolOverrides: args.
|
|
16112
|
+
toolOverrides: args.run.environment?.toolOverrides,
|
|
16114
16113
|
onSkillLoaded: async (loadedSkill) => {
|
|
16115
16114
|
const resolvedSkill = await args.skillSandbox.loadSkill(
|
|
16116
16115
|
loadedSkill.name
|
|
@@ -16182,10 +16181,12 @@ async function wireAgentTools(args) {
|
|
|
16182
16181
|
const activeMcpCatalogs = toActiveMcpCatalogSummaries(
|
|
16183
16182
|
mcpToolManager.getActiveToolCatalog()
|
|
16184
16183
|
);
|
|
16184
|
+
const emitEvent = args.onEvent;
|
|
16185
16185
|
const onToolCall = async (toolCallId, toolName, params) => {
|
|
16186
16186
|
args.toolCalls.push(toolName);
|
|
16187
16187
|
try {
|
|
16188
|
-
await
|
|
16188
|
+
await emitEvent?.({
|
|
16189
|
+
type: "tool_started",
|
|
16189
16190
|
params,
|
|
16190
16191
|
toolCallId,
|
|
16191
16192
|
toolName
|
|
@@ -16197,17 +16198,23 @@ async function wireAgentTools(args) {
|
|
|
16197
16198
|
});
|
|
16198
16199
|
}
|
|
16199
16200
|
};
|
|
16201
|
+
const onStatus = emitEvent ? async (status) => {
|
|
16202
|
+
await emitEvent({ type: "status", text: status.text });
|
|
16203
|
+
} : void 0;
|
|
16204
|
+
const onToolResult = emitEvent ? async (report) => {
|
|
16205
|
+
await emitEvent({ type: "tool_finished", report });
|
|
16206
|
+
} : void 0;
|
|
16200
16207
|
const agentTools = createPiAgentTools(
|
|
16201
16208
|
tools,
|
|
16202
16209
|
args.skillSandbox,
|
|
16203
16210
|
args.spanContext,
|
|
16204
|
-
|
|
16211
|
+
onStatus,
|
|
16205
16212
|
agentSandbox.tools,
|
|
16206
16213
|
pluginAuth,
|
|
16207
16214
|
onToolCall,
|
|
16208
16215
|
pluginHooks,
|
|
16209
16216
|
args.conversationPrivacy,
|
|
16210
|
-
|
|
16217
|
+
onToolResult,
|
|
16211
16218
|
actionReview
|
|
16212
16219
|
);
|
|
16213
16220
|
return {
|
|
@@ -17028,33 +17035,33 @@ function waitForAbortSettlement(promise, timeoutMs) {
|
|
|
17028
17035
|
);
|
|
17029
17036
|
});
|
|
17030
17037
|
}
|
|
17031
|
-
async function executeAgentRun(
|
|
17032
|
-
if (!
|
|
17038
|
+
async function executeAgentRun(run, streamFn) {
|
|
17039
|
+
if (!run.destination) {
|
|
17033
17040
|
throw new TypeError("Assistant reply generation requires a destination");
|
|
17034
17041
|
}
|
|
17035
17042
|
const destinationVisibility = await resolveDestinationVisibility({
|
|
17036
|
-
destination:
|
|
17037
|
-
visibility:
|
|
17043
|
+
destination: run.destination,
|
|
17044
|
+
visibility: run.destinationVisibility
|
|
17038
17045
|
});
|
|
17039
17046
|
const conversationPrivacy = resolveConversationPrivacy({
|
|
17040
17047
|
visibility: destinationVisibility
|
|
17041
17048
|
});
|
|
17042
|
-
const
|
|
17043
|
-
...
|
|
17044
|
-
|
|
17045
|
-
} :
|
|
17046
|
-
const credentialActor =
|
|
17047
|
-
const actor =
|
|
17049
|
+
const resolvedRun = destinationVisibility ? {
|
|
17050
|
+
...run,
|
|
17051
|
+
destinationVisibility
|
|
17052
|
+
} : run;
|
|
17053
|
+
const credentialActor = run.credentialContext?.actor;
|
|
17054
|
+
const actor = actorFromRun(run);
|
|
17048
17055
|
const userActor = actor && "userId" in actor ? actor : void 0;
|
|
17049
17056
|
const runLogContext = {
|
|
17050
|
-
conversationId:
|
|
17051
|
-
platform:
|
|
17052
|
-
messageConversationId:
|
|
17053
|
-
destinationName:
|
|
17057
|
+
conversationId: run.conversationId,
|
|
17058
|
+
platform: run.source.platform,
|
|
17059
|
+
messageConversationId: run.source.platform === "slack" ? run.conversationId : run.source.conversationId,
|
|
17060
|
+
destinationName: run.destination.platform === "slack" ? run.destination.channelId : run.destination.conversationId,
|
|
17054
17061
|
userId: userActor?.userId,
|
|
17055
17062
|
userName: userActor?.userName,
|
|
17056
17063
|
userEmail: userActor?.email,
|
|
17057
|
-
runId:
|
|
17064
|
+
runId: run.runId,
|
|
17058
17065
|
actorType: credentialActor ? "type" in credentialActor ? credentialActor.type : "system" : void 0,
|
|
17059
17066
|
actorId: credentialActor ? "type" in credentialActor ? credentialActor.userId : credentialActor.name : void 0,
|
|
17060
17067
|
assistantUserName: botConfig.userName
|
|
@@ -17064,7 +17071,7 @@ async function executeAgentRun(request, streamFn) {
|
|
|
17064
17071
|
() => runWithConversationPrivacy(
|
|
17065
17072
|
conversationPrivacy,
|
|
17066
17073
|
() => executeAgentRunInPrivacyContext(
|
|
17067
|
-
|
|
17074
|
+
resolvedRun,
|
|
17068
17075
|
conversationPrivacy,
|
|
17069
17076
|
runLogContext,
|
|
17070
17077
|
streamFn
|
|
@@ -17072,17 +17079,68 @@ async function executeAgentRun(request, streamFn) {
|
|
|
17072
17079
|
)
|
|
17073
17080
|
);
|
|
17074
17081
|
}
|
|
17075
|
-
async function executeAgentRunInPrivacyContext(
|
|
17076
|
-
const
|
|
17077
|
-
const
|
|
17082
|
+
async function executeAgentRunInPrivacyContext(run, conversationPrivacy, runLogContext, streamFn) {
|
|
17083
|
+
const conversationId = run.conversationId;
|
|
17084
|
+
const turnId = run.turnId;
|
|
17085
|
+
const runId = run.runId;
|
|
17086
|
+
const input = {
|
|
17087
|
+
actor: run.instruction.actor,
|
|
17088
|
+
includeConversationContextWithPiMessages: run.instruction.includeConversationContextWithHistory,
|
|
17089
|
+
messageText: run.instruction.text,
|
|
17090
|
+
userAttachments: run.instruction.attachments ? [...run.instruction.attachments] : void 0,
|
|
17091
|
+
inboundAttachmentCount: run.instruction.inboundAttachmentCount,
|
|
17092
|
+
omittedImageAttachmentCount: run.instruction.omittedImageAttachmentCount,
|
|
17093
|
+
piMessages: run.history ? [...run.history] : void 0,
|
|
17094
|
+
conversationContext: run.instruction.context
|
|
17095
|
+
};
|
|
17096
|
+
const routing = {
|
|
17097
|
+
actor: run.actor,
|
|
17098
|
+
credentialContext: run.credentialContext,
|
|
17099
|
+
source: run.source,
|
|
17100
|
+
slackConversation: run.slackConversation,
|
|
17101
|
+
slackActionToken: run.slackActionToken,
|
|
17102
|
+
destination: run.destination,
|
|
17103
|
+
publishExternally: run.publishExternally,
|
|
17104
|
+
destinationVisibility: run.destinationVisibility,
|
|
17105
|
+
surface: run.surface,
|
|
17106
|
+
dispatch: run.dispatch,
|
|
17107
|
+
toolChannelId: run.toolChannelId
|
|
17108
|
+
};
|
|
17109
|
+
const policy = {
|
|
17110
|
+
disabledFeatures: run.disabledFeatures,
|
|
17111
|
+
turnDeadlineAtMs: run.deadlineAtMs,
|
|
17112
|
+
signal: run.signal,
|
|
17113
|
+
reasoningLevel: run.reasoning,
|
|
17114
|
+
configuration: run.environment?.configuration,
|
|
17115
|
+
locationConfiguration: run.environment?.locationConfiguration,
|
|
17116
|
+
skillDirs: run.environment?.skillDirs,
|
|
17117
|
+
sandboxTracePropagation: run.environment?.sandboxTracePropagation,
|
|
17118
|
+
sandboxEgressSignals: run.environment?.sandboxEgressSignals,
|
|
17119
|
+
toolOverrides: run.environment?.toolOverrides
|
|
17120
|
+
};
|
|
17078
17121
|
const signal = policy.signal;
|
|
17079
|
-
const state =
|
|
17080
|
-
const observers =
|
|
17081
|
-
|
|
17082
|
-
|
|
17083
|
-
|
|
17122
|
+
const state = run.state ?? {};
|
|
17123
|
+
const observers = {
|
|
17124
|
+
onStatus: run.onEvent ? async (status) => {
|
|
17125
|
+
await run.onEvent?.({ type: "status", text: status.text });
|
|
17126
|
+
} : void 0,
|
|
17127
|
+
onToolInvocation: run.onEvent ? async (invocation) => {
|
|
17128
|
+
await run.onEvent?.({
|
|
17129
|
+
type: "tool_started",
|
|
17130
|
+
params: invocation.params,
|
|
17131
|
+
toolCallId: invocation.toolCallId,
|
|
17132
|
+
toolName: invocation.toolName
|
|
17133
|
+
});
|
|
17134
|
+
} : void 0,
|
|
17135
|
+
onToolResult: run.onEvent ? async (report) => {
|
|
17136
|
+
await run.onEvent?.({ type: "tool_finished", report });
|
|
17137
|
+
} : void 0
|
|
17138
|
+
};
|
|
17139
|
+
const delivery = run.delivery;
|
|
17140
|
+
const authorization = run.authorization;
|
|
17141
|
+
const durability = run.durability ?? {};
|
|
17084
17142
|
signal?.throwIfAborted();
|
|
17085
|
-
|
|
17143
|
+
assertRunConsistency(run);
|
|
17086
17144
|
const replyStartedAtMs = Date.now();
|
|
17087
17145
|
const configuredTurnDeadlineAtMs = replyStartedAtMs + botConfig.turnTimeoutMs;
|
|
17088
17146
|
const policyTurnDeadlineAtMs = typeof policy.turnDeadlineAtMs === "number" && Number.isFinite(policy.turnDeadlineAtMs) ? Math.floor(policy.turnDeadlineAtMs) : void 0;
|
|
@@ -17109,8 +17167,8 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17109
17167
|
) : void 0;
|
|
17110
17168
|
let activeModelProfile = STANDARD_MODEL_PROFILE;
|
|
17111
17169
|
let activeModelId = modelIdForProfile(botConfig, activeModelProfile);
|
|
17112
|
-
const actor =
|
|
17113
|
-
const surface =
|
|
17170
|
+
const actor = actorFromRun(run);
|
|
17171
|
+
const surface = surfaceFromRun(run);
|
|
17114
17172
|
const runSource = routing.source;
|
|
17115
17173
|
const slackSource = runSource.platform === "slack" ? runSource : void 0;
|
|
17116
17174
|
const slackDestination = routing.destination.platform === "slack" ? routing.destination : void 0;
|
|
@@ -17236,9 +17294,12 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17236
17294
|
skillSandbox
|
|
17237
17295
|
});
|
|
17238
17296
|
const explicitSkill = invokedSkill ? activeSkills.find((skill) => skill.name === invokedSkill.name) ?? null : null;
|
|
17239
|
-
const { contextContentParts, routerBlocks, userContentParts } = buildPromptInput(
|
|
17297
|
+
const { contextContentParts, routerBlocks, userContentParts } = buildPromptInput({
|
|
17298
|
+
instruction: run.instruction,
|
|
17299
|
+
history: run.history
|
|
17300
|
+
});
|
|
17240
17301
|
const preAgentPromptMessages = () => existingSessionRecord?.piMessages ?? [...input.piMessages ?? []];
|
|
17241
|
-
const handoffEnabled = !isAgentRunFeatureDisabled(policy, "handoff");
|
|
17302
|
+
const handoffEnabled = !isAgentRunFeatureDisabled(policy.disabledFeatures, "handoff");
|
|
17242
17303
|
const storedTurnRoute = await loadTurnRoute({ conversationId, turnId });
|
|
17243
17304
|
if (storedTurnRoute) {
|
|
17244
17305
|
const resumedAfterHandoff = handoffEnabled && activeModelProfile !== STANDARD_MODEL_PROFILE && activeModelProfile !== storedTurnRoute.modelProfile;
|
|
@@ -17433,7 +17494,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17433
17494
|
authorization,
|
|
17434
17495
|
generatedFiles,
|
|
17435
17496
|
invokedSkill,
|
|
17436
|
-
|
|
17497
|
+
onEvent: run.onEvent,
|
|
17437
17498
|
onFatalToolError(error) {
|
|
17438
17499
|
pendingPiHookError = error;
|
|
17439
17500
|
agent?.abort();
|
|
@@ -17441,15 +17502,12 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17441
17502
|
onSandboxRefChanged: (sandboxRef) => {
|
|
17442
17503
|
lastKnownSandboxRef = sandboxRef;
|
|
17443
17504
|
},
|
|
17444
|
-
policy,
|
|
17445
17505
|
preAgentPromptMessages,
|
|
17446
17506
|
priorPiMessages,
|
|
17447
17507
|
recordConnectedMcpProvider,
|
|
17448
17508
|
requestHandoff,
|
|
17449
17509
|
resume: runResume,
|
|
17450
|
-
|
|
17451
|
-
conversationId,
|
|
17452
|
-
turnId,
|
|
17510
|
+
run,
|
|
17453
17511
|
skillSandbox,
|
|
17454
17512
|
spanContext,
|
|
17455
17513
|
state,
|
|
@@ -17531,7 +17589,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17531
17589
|
explicitSkill,
|
|
17532
17590
|
priorPiMessages,
|
|
17533
17591
|
resumedFromSessionRecord,
|
|
17534
|
-
|
|
17592
|
+
run,
|
|
17535
17593
|
spanContext,
|
|
17536
17594
|
turnId,
|
|
17537
17595
|
toolGuidance: wiring.toolGuidance,
|
|
@@ -17840,7 +17898,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17840
17898
|
tools: agent.state.tools
|
|
17841
17899
|
});
|
|
17842
17900
|
}
|
|
17843
|
-
const runAgentStep = async (
|
|
17901
|
+
const runAgentStep = async (run3, abortRun = () => agent.abort()) => {
|
|
17844
17902
|
let timeoutId;
|
|
17845
17903
|
let removeAbortListener;
|
|
17846
17904
|
const timeoutPromise = new Promise((_, reject) => {
|
|
@@ -17877,7 +17935,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17877
17935
|
let result2;
|
|
17878
17936
|
try {
|
|
17879
17937
|
result2 = await Promise.race(
|
|
17880
|
-
abortPromise ? [
|
|
17938
|
+
abortPromise ? [run3, timeoutPromise, abortPromise] : [run3, timeoutPromise]
|
|
17881
17939
|
);
|
|
17882
17940
|
} catch (error) {
|
|
17883
17941
|
if (runResume.timedOut) {
|
|
@@ -17895,7 +17953,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17895
17953
|
)
|
|
17896
17954
|
});
|
|
17897
17955
|
const settled = await waitForAbortSettlement(
|
|
17898
|
-
|
|
17956
|
+
run3,
|
|
17899
17957
|
AGENT_ABORT_SETTLE_GRACE_MS
|
|
17900
17958
|
);
|
|
17901
17959
|
if (!settled) {
|
|
@@ -17929,7 +17987,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17929
17987
|
return result2;
|
|
17930
17988
|
};
|
|
17931
17989
|
const requestedProfile = activeModelProfile === STANDARD_MODEL_PROFILE ? turnRoute.profile : void 0;
|
|
17932
|
-
let
|
|
17990
|
+
let run2;
|
|
17933
17991
|
let handoffApplied = false;
|
|
17934
17992
|
if (requestedProfile && requestedProfile !== STANDARD_MODEL_PROFILE) {
|
|
17935
17993
|
const handoffAbortController = new AbortController();
|
|
@@ -17969,7 +18027,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17969
18027
|
freshPromptMessage
|
|
17970
18028
|
]);
|
|
17971
18029
|
}
|
|
17972
|
-
|
|
18030
|
+
run2 = shouldPromptAgent && !capacityUpdate ? agent.prompt(freshPromptMessage) : agent.continue();
|
|
17973
18031
|
let discardedRetryUsage;
|
|
17974
18032
|
let actionConfirmationRetryUsed = false;
|
|
17975
18033
|
let providerRetryAttempt = 0;
|
|
@@ -17985,7 +18043,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
17985
18043
|
};
|
|
17986
18044
|
try {
|
|
17987
18045
|
for (; ; ) {
|
|
17988
|
-
await runAgentStep(
|
|
18046
|
+
await runAgentStep(run2);
|
|
17989
18047
|
if (assistantMessageDeliveryError) {
|
|
17990
18048
|
throw assistantMessageDeliveryError;
|
|
17991
18049
|
}
|
|
@@ -18029,7 +18087,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
18029
18087
|
if (confirmationRetry) {
|
|
18030
18088
|
actionConfirmationRetryUsed = true;
|
|
18031
18089
|
await prepareRetry(confirmationRetry);
|
|
18032
|
-
|
|
18090
|
+
run2 = agent.continue();
|
|
18033
18091
|
continue;
|
|
18034
18092
|
}
|
|
18035
18093
|
const emptyOutputContinuation = nextEmptyOutputContinuation({
|
|
@@ -18043,7 +18101,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
18043
18101
|
logWarn("agent.turn.empty_output.retrying", {
|
|
18044
18102
|
"app.ai.empty_output.attempt": emptyOutputAttempt
|
|
18045
18103
|
});
|
|
18046
|
-
|
|
18104
|
+
run2 = agent.continue();
|
|
18047
18105
|
continue;
|
|
18048
18106
|
}
|
|
18049
18107
|
if (emptyOutputContinuation.kind === "exhausted") {
|
|
@@ -18063,7 +18121,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
18063
18121
|
await prepareRetry(providerRetry.messages);
|
|
18064
18122
|
logWarn("agent.turn.provider.retrying");
|
|
18065
18123
|
await sleep(providerRetry.delayMs, signal);
|
|
18066
|
-
|
|
18124
|
+
run2 = agent.continue();
|
|
18067
18125
|
}
|
|
18068
18126
|
} catch (error) {
|
|
18069
18127
|
if (error instanceof AuthorizationPauseError) {
|
|
@@ -18209,29 +18267,28 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
|
|
|
18209
18267
|
}
|
|
18210
18268
|
|
|
18211
18269
|
// src/chat/runtime/agent-runner.ts
|
|
18212
|
-
function createAgentRunner(
|
|
18270
|
+
function createAgentRunner(execute, options) {
|
|
18271
|
+
const streamFn = options?.streamFn;
|
|
18213
18272
|
const tracePropagation = options?.tracePropagation;
|
|
18214
18273
|
const bindSpawnAgent = options?.bindSpawnAgent;
|
|
18215
18274
|
const canBindSpawn = Boolean(bindSpawnAgent) && isExperimentalFeatureEnabled("subagents");
|
|
18216
|
-
if (!tracePropagation && !canBindSpawn) {
|
|
18217
|
-
return { run };
|
|
18218
|
-
}
|
|
18219
18275
|
return {
|
|
18220
|
-
run: async (
|
|
18221
|
-
const spawnAgent = bindSpawnAgent && canBindSpawn && !isAgentRunFeatureDisabled(
|
|
18222
|
-
|
|
18223
|
-
...
|
|
18224
|
-
|
|
18225
|
-
...
|
|
18226
|
-
sandboxTracePropagation:
|
|
18276
|
+
run: async (run) => {
|
|
18277
|
+
const spawnAgent = bindSpawnAgent && canBindSpawn && !isAgentRunFeatureDisabled(run.disabledFeatures, "subagents") ? bindSpawnAgent(run) : void 0;
|
|
18278
|
+
const nextRun = {
|
|
18279
|
+
...run,
|
|
18280
|
+
environment: {
|
|
18281
|
+
...run.environment,
|
|
18282
|
+
sandboxTracePropagation: run.environment?.sandboxTracePropagation ?? tracePropagation
|
|
18227
18283
|
},
|
|
18228
18284
|
...spawnAgent ? {
|
|
18229
18285
|
durability: {
|
|
18230
|
-
...
|
|
18286
|
+
...run.durability,
|
|
18231
18287
|
spawnAgent
|
|
18232
18288
|
}
|
|
18233
18289
|
} : {}
|
|
18234
|
-
}
|
|
18290
|
+
};
|
|
18291
|
+
return await execute(nextRun, streamFn);
|
|
18235
18292
|
}
|
|
18236
18293
|
};
|
|
18237
18294
|
}
|