@sentry/junior 0.150.1 → 0.151.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-G4LEACQB.js → agent-hooks-EYUAEBMA.js} +10 -10
- package/dist/api/schema/conversation.d.ts +24 -4
- package/dist/api/schema.js +1 -1
- package/dist/api.js +63 -35
- package/dist/app.js +123 -200
- package/dist/{catalog-runtime-ZRSNE2MH.js → catalog-runtime-2LCLLOBI.js} +5 -5
- package/dist/chat/agent/skills.d.ts +5 -4
- package/dist/chat/agent/tools.d.ts +5 -5
- package/dist/chat/conversations/history.d.ts +12 -3
- package/dist/chat/conversations/projection.d.ts +7 -3
- package/dist/chat/mcp/tool-manager.d.ts +0 -4
- package/dist/chat/runtime/agent-run-outcome.d.ts +4 -0
- package/dist/chat/tools/search-conversation-events.d.ts +1 -1
- package/dist/chat/tools/skill/call-mcp-tool.d.ts +0 -1
- package/dist/chat/tools/skill/load-skill.d.ts +2 -5
- package/dist/chat/tools/types.d.ts +1 -2
- package/dist/{chunk-TZRYLW3R.js → chunk-2MGJ64SL.js} +1 -1
- package/dist/{chunk-IQW6RFXG.js → chunk-3WOK4ZLX.js} +72 -218
- package/dist/{chunk-XED3H34M.js → chunk-4ABTAQYC.js} +3 -3
- package/dist/{chunk-KFHJQYKQ.js → chunk-5N3XLYBW.js} +1 -1
- package/dist/{chunk-JVOLC6JZ.js → chunk-6A46QL4O.js} +4 -4
- package/dist/{chunk-2DIRU2C2.js → chunk-6DLWRSGV.js} +1 -1
- package/dist/{chunk-OWLJZ6I7.js → chunk-6PGJPCN2.js} +1 -1
- package/dist/{chunk-AD6N2KNE.js → chunk-6WNWM5JD.js} +5 -5
- package/dist/{chunk-D2PVJU5E.js → chunk-AGSUPAD5.js} +2 -2
- package/dist/{chunk-W3FQZAX5.js → chunk-B7KWBJAR.js} +6 -6
- package/dist/{chunk-QO3OSJDS.js → chunk-C7D2ONB5.js} +1 -1
- package/dist/{chunk-LSI3EKZQ.js → chunk-CL5DT6D2.js} +4 -4
- package/dist/{chunk-FGP5W3NS.js → chunk-D22FO4LW.js} +2 -2
- package/dist/{chunk-6IWDFUXW.js → chunk-DJAOSWB6.js} +1 -1
- package/dist/{chunk-JBYWR6FW.js → chunk-EMB4VY7H.js} +5 -5
- package/dist/{chunk-R53UTQ2Q.js → chunk-H7ZMEHAN.js} +1 -1
- package/dist/{chunk-N6QJAPZS.js → chunk-J5LAA2LI.js} +9 -9
- package/dist/{chunk-2AWDPNP7.js → chunk-JIJOPRD4.js} +16 -10
- package/dist/{chunk-6A24WEKX.js → chunk-JSKTDBSS.js} +4 -4
- package/dist/{chunk-GZ25ZSTX.js → chunk-K3QXMZDU.js} +11 -4
- package/dist/{chunk-IZE2EGCX.js → chunk-KPQBQRNM.js} +5 -5
- package/dist/{chunk-SZ74ECCC.js → chunk-M6KRPBXC.js} +6 -6
- package/dist/{chunk-3WIFZBJL.js → chunk-OAPPJ3TM.js} +1 -1
- package/dist/{chunk-LWFHRWJI.js → chunk-OFRJXFTH.js} +8 -8
- package/dist/{chunk-2Z7YX5PI.js → chunk-OYRFUQOV.js} +106 -16
- package/dist/{chunk-6ZYGORV4.js → chunk-PQUV3NA5.js} +2 -2
- package/dist/{chunk-5NOHC2Z4.js → chunk-PWMVR2MD.js} +1 -1
- package/dist/{chunk-QNSV46AW.js → chunk-QVQBWWXQ.js} +6 -6
- package/dist/{chunk-4JV7GUUH.js → chunk-UDDCHQN2.js} +1 -1
- package/dist/{chunk-JUBPTYNO.js → chunk-WVXFEQXE.js} +1 -1
- package/dist/{chunk-3JVUWLR7.js → chunk-XN3QKNQX.js} +8 -1
- package/dist/{chunk-B2YA2G26.js → chunk-YN4W5SRJ.js} +1 -1
- package/dist/{chunk-QZGYKKH6.js → chunk-ZGSL5ARH.js} +50 -22
- package/dist/cli/chat.js +30 -30
- 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-WRA5ZHYE.js → db-ALCBI4JZ.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-QWAYG3MI.js → oauth-callback-server-3RRMG62B.js} +23 -23
- package/dist/{runner-5JQ54J6P.js → runner-V6C3EELU.js} +14 -14
- package/dist/{skills-3YD55WPO.js → skills-43PFYZIZ.js} +6 -6
- package/dist/spawn-UZNNTNFU.js +38 -0
- package/dist/{validation-ZXE3IRSB.js → validation-4MNN6QKE.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-7G2U64WI.js → work-YZO6XTEB.js} +17 -17
- package/dist/{worker-HJM2FZNI.js → worker-42AR7323.js} +11 -11
- package/migrations/0025_mcp_credential_subject.sql +8 -0
- package/migrations/meta/0025_snapshot.json +2275 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/dist/chat/pi/derived-state.d.ts +0 -5
- package/dist/spawn-OOO26XDL.js +0 -38
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
PluginCredentialFailureError,
|
|
8
8
|
agentNameSchema,
|
|
9
9
|
createPluginAuthOrchestration
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KPQBQRNM.js";
|
|
11
11
|
import {
|
|
12
12
|
authorizationId
|
|
13
13
|
} from "./chunk-DIB4GX3G.js";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
searchSlackUsers,
|
|
33
33
|
selectPluginGrant,
|
|
34
34
|
toMcpProviderError
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-OFRJXFTH.js";
|
|
36
36
|
import {
|
|
37
37
|
RetryableDeliveryError,
|
|
38
38
|
actorFromRun,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
getSlackMessagePermalink,
|
|
49
49
|
resolveBaseUrl,
|
|
50
50
|
uploadFilesToConversation
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-M6KRPBXC.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-JSKTDBSS.js";
|
|
81
81
|
import {
|
|
82
82
|
SCHEDULED_TASK_SYSTEM_ACTOR,
|
|
83
83
|
compactEventTask,
|
|
@@ -109,10 +109,10 @@ import {
|
|
|
109
109
|
saveEventTask,
|
|
110
110
|
scheduledTaskAttributes,
|
|
111
111
|
writableEventTask
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-6WNWM5JD.js";
|
|
113
113
|
import {
|
|
114
114
|
parseSlackThreadId
|
|
115
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-UDDCHQN2.js";
|
|
116
116
|
import {
|
|
117
117
|
AGENTS_REMOVAL_NOTICE,
|
|
118
118
|
AGENTS_REPLACEMENT_NOTICE,
|
|
@@ -182,7 +182,7 @@ import {
|
|
|
182
182
|
stripRuntimeTurnContext,
|
|
183
183
|
trimTrailingAssistantMessages,
|
|
184
184
|
truncateText
|
|
185
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-JIJOPRD4.js";
|
|
186
186
|
import {
|
|
187
187
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
188
188
|
} from "./chunk-3Y47VMHV.js";
|
|
@@ -198,7 +198,7 @@ import {
|
|
|
198
198
|
getSlackToolContext,
|
|
199
199
|
readActorIdentity,
|
|
200
200
|
resolveChannelCapabilities
|
|
201
|
-
} from "./chunk-
|
|
201
|
+
} from "./chunk-QVQBWWXQ.js";
|
|
202
202
|
import {
|
|
203
203
|
SlackActionError,
|
|
204
204
|
downloadPrivateSlackFile,
|
|
@@ -207,7 +207,7 @@ import {
|
|
|
207
207
|
isConversationScopedChannel,
|
|
208
208
|
normalizeSlackConversationId,
|
|
209
209
|
withSlackRetries
|
|
210
|
-
} from "./chunk-
|
|
210
|
+
} from "./chunk-AGSUPAD5.js";
|
|
211
211
|
import {
|
|
212
212
|
KNOWN_CONVERSATION_EVENT_TYPES,
|
|
213
213
|
contextProvenance,
|
|
@@ -219,10 +219,10 @@ import {
|
|
|
219
219
|
instructionActors,
|
|
220
220
|
instructionProvenanceFor,
|
|
221
221
|
sameActorIdentity
|
|
222
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-K3QXMZDU.js";
|
|
223
223
|
import {
|
|
224
224
|
juniorIdentities
|
|
225
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-5N3XLYBW.js";
|
|
226
226
|
import {
|
|
227
227
|
SANDBOX_DATA_ROOT,
|
|
228
228
|
SANDBOX_SKILLS_ROOT,
|
|
@@ -234,7 +234,7 @@ import {
|
|
|
234
234
|
} from "./chunk-EM225ITJ.js";
|
|
235
235
|
import {
|
|
236
236
|
getStateAdapter
|
|
237
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-YN4W5SRJ.js";
|
|
238
238
|
import {
|
|
239
239
|
ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
|
|
240
240
|
COMPACTION_SUMMARY_PREFIX,
|
|
@@ -267,7 +267,7 @@ import {
|
|
|
267
267
|
resolveGatewayCredential,
|
|
268
268
|
resolveGatewayModel,
|
|
269
269
|
unwrapCurrentInstruction
|
|
270
|
-
} from "./chunk-
|
|
270
|
+
} from "./chunk-D22FO4LW.js";
|
|
271
271
|
import {
|
|
272
272
|
canExposeConversationPayload,
|
|
273
273
|
resolveConversationPrivacy,
|
|
@@ -277,16 +277,16 @@ import {
|
|
|
277
277
|
toGenAiMessagesTraceAttributes,
|
|
278
278
|
toGenAiPayloadMetadata,
|
|
279
279
|
toGenAiPayloadTraceAttributes
|
|
280
|
-
} from "./chunk-
|
|
280
|
+
} from "./chunk-PWMVR2MD.js";
|
|
281
281
|
import {
|
|
282
282
|
discoverSkills,
|
|
283
283
|
findSkillByName,
|
|
284
284
|
loadSkillsByName,
|
|
285
285
|
parseSkillInvocation
|
|
286
|
-
} from "./chunk-
|
|
286
|
+
} from "./chunk-PQUV3NA5.js";
|
|
287
287
|
import {
|
|
288
288
|
pluginCatalogRuntime
|
|
289
|
-
} from "./chunk-
|
|
289
|
+
} from "./chunk-6DLWRSGV.js";
|
|
290
290
|
import {
|
|
291
291
|
CredentialUnavailableError,
|
|
292
292
|
OAuthProviderError,
|
|
@@ -294,7 +294,7 @@ import {
|
|
|
294
294
|
getOAuthProviderErrorAttributes,
|
|
295
295
|
resolveAuthTokenPlaceholder,
|
|
296
296
|
resolvePluginCommandEnv
|
|
297
|
-
} from "./chunk-
|
|
297
|
+
} from "./chunk-2MGJ64SL.js";
|
|
298
298
|
import {
|
|
299
299
|
credentialUserSubjectId
|
|
300
300
|
} from "./chunk-RUIXF3YQ.js";
|
|
@@ -324,7 +324,7 @@ import {
|
|
|
324
324
|
summarizeMessageText,
|
|
325
325
|
withLogContext,
|
|
326
326
|
withSpan
|
|
327
|
-
} from "./chunk-
|
|
327
|
+
} from "./chunk-OAPPJ3TM.js";
|
|
328
328
|
import {
|
|
329
329
|
startInactiveSpan,
|
|
330
330
|
withActiveSpan
|
|
@@ -1399,136 +1399,6 @@ function actionConfirmationRetryMessages(messages) {
|
|
|
1399
1399
|
return retryMessages;
|
|
1400
1400
|
}
|
|
1401
1401
|
|
|
1402
|
-
// src/chat/mcp/tool-name.ts
|
|
1403
|
-
function parseMcpProviderFromToolName(toolName) {
|
|
1404
|
-
if (!toolName.startsWith("mcp__")) return void 0;
|
|
1405
|
-
const afterPrefix = toolName.slice("mcp__".length);
|
|
1406
|
-
const delimiterIndex = afterPrefix.indexOf("__");
|
|
1407
|
-
return delimiterIndex > 0 ? afterPrefix.slice(0, delimiterIndex) : void 0;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
// src/chat/pi/derived-state.ts
|
|
1411
|
-
var MCP_BRIDGE_TOOLS = /* @__PURE__ */ new Set(["callMcpTool", "searchMcpTools"]);
|
|
1412
|
-
function isRecord2(value) {
|
|
1413
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
1414
|
-
}
|
|
1415
|
-
function providerFromToolName(value) {
|
|
1416
|
-
if (typeof value !== "string") {
|
|
1417
|
-
return void 0;
|
|
1418
|
-
}
|
|
1419
|
-
return parseMcpProviderFromToolName(value);
|
|
1420
|
-
}
|
|
1421
|
-
function addString(values, value) {
|
|
1422
|
-
if (typeof value === "string" && value.trim()) {
|
|
1423
|
-
values.add(value.trim());
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
function getToolName(value) {
|
|
1427
|
-
return typeof value.toolName === "string" ? value.toolName : typeof value.name === "string" ? value.name : void 0;
|
|
1428
|
-
}
|
|
1429
|
-
function addBridgeToolProvider(toolName, value, providers) {
|
|
1430
|
-
const bridgeTool = toolName && MCP_BRIDGE_TOOLS.has(toolName) ? toolName : void 0;
|
|
1431
|
-
if (bridgeTool === "searchMcpTools") {
|
|
1432
|
-
for (const argsKey of ["input", "args", "arguments", "params"]) {
|
|
1433
|
-
const args = value[argsKey];
|
|
1434
|
-
if (isRecord2(args)) {
|
|
1435
|
-
addString(providers, args.provider);
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
addString(providers, value.provider);
|
|
1439
|
-
}
|
|
1440
|
-
if (bridgeTool === "callMcpTool") {
|
|
1441
|
-
for (const argsKey of ["input", "args", "arguments", "params"]) {
|
|
1442
|
-
const args = value[argsKey];
|
|
1443
|
-
if (isRecord2(args)) {
|
|
1444
|
-
addString(providers, providerFromToolName(args.tool_name));
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
addString(providers, providerFromToolName(value.tool_name));
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
function addMcpResultProvider(message, providers) {
|
|
1451
|
-
const toolName = typeof message.toolName === "string" ? message.toolName : void 0;
|
|
1452
|
-
if (message.isError === true) {
|
|
1453
|
-
return;
|
|
1454
|
-
}
|
|
1455
|
-
if (toolName === "loadSkill") {
|
|
1456
|
-
if (isRecord2(message.details)) {
|
|
1457
|
-
addString(providers, message.details.mcp_provider);
|
|
1458
|
-
}
|
|
1459
|
-
addString(providers, message.mcp_provider);
|
|
1460
|
-
return;
|
|
1461
|
-
}
|
|
1462
|
-
if (toolName === "searchMcpTools") {
|
|
1463
|
-
if (isRecord2(message.details)) {
|
|
1464
|
-
addString(providers, message.details.provider);
|
|
1465
|
-
if (Array.isArray(message.details.tools)) {
|
|
1466
|
-
for (const tool of message.details.tools) {
|
|
1467
|
-
if (isRecord2(tool)) {
|
|
1468
|
-
addString(providers, providerFromToolName(tool.tool_name));
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
addString(providers, message.provider);
|
|
1474
|
-
return;
|
|
1475
|
-
}
|
|
1476
|
-
if (toolName === "callMcpTool") {
|
|
1477
|
-
for (const argsKey of ["input", "args", "arguments", "params"]) {
|
|
1478
|
-
const args = message[argsKey];
|
|
1479
|
-
if (isRecord2(args)) {
|
|
1480
|
-
addString(providers, providerFromToolName(args.tool_name));
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
if (isRecord2(message.details)) {
|
|
1484
|
-
addString(providers, message.details.provider);
|
|
1485
|
-
addString(providers, providerFromToolName(message.details.tool_name));
|
|
1486
|
-
}
|
|
1487
|
-
addString(providers, providerFromToolName(message.tool_name));
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
function scanMcpProviders(message, providers) {
|
|
1491
|
-
if (!isRecord2(message)) {
|
|
1492
|
-
return;
|
|
1493
|
-
}
|
|
1494
|
-
if (message.role === "toolResult") {
|
|
1495
|
-
addMcpResultProvider(message, providers);
|
|
1496
|
-
return;
|
|
1497
|
-
}
|
|
1498
|
-
const content = message.content;
|
|
1499
|
-
if (!Array.isArray(content)) {
|
|
1500
|
-
return;
|
|
1501
|
-
}
|
|
1502
|
-
for (const part of content) {
|
|
1503
|
-
if (!isRecord2(part)) {
|
|
1504
|
-
continue;
|
|
1505
|
-
}
|
|
1506
|
-
addBridgeToolProvider(getToolName(part), part, providers);
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
function scanLoadedSkills(message, skills) {
|
|
1510
|
-
if (isRecord2(message) && message.role === "toolResult" && message.toolName === "loadSkill" && message.isError !== true) {
|
|
1511
|
-
if (isRecord2(message.details)) {
|
|
1512
|
-
addString(skills, message.details.skill_name);
|
|
1513
|
-
}
|
|
1514
|
-
addString(skills, message.skill_name);
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
function inferActiveMcpProvidersFromPiMessages(messages) {
|
|
1518
|
-
const providers = /* @__PURE__ */ new Set();
|
|
1519
|
-
for (const message of messages ?? []) {
|
|
1520
|
-
scanMcpProviders(message, providers);
|
|
1521
|
-
}
|
|
1522
|
-
return [...providers].sort((left, right) => left.localeCompare(right));
|
|
1523
|
-
}
|
|
1524
|
-
function inferLoadedSkillNamesFromPiMessages(messages) {
|
|
1525
|
-
const skills = /* @__PURE__ */ new Set();
|
|
1526
|
-
for (const message of messages ?? []) {
|
|
1527
|
-
scanLoadedSkills(message, skills);
|
|
1528
|
-
}
|
|
1529
|
-
return [...skills].sort((left, right) => left.localeCompare(right));
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
1402
|
// src/chat/agent/skills.ts
|
|
1533
1403
|
var startupDiscoveryLogged = false;
|
|
1534
1404
|
function upsertActiveSkill(activeSkills, next) {
|
|
@@ -1563,23 +1433,30 @@ async function discoverRunSkills(args) {
|
|
|
1563
1433
|
}
|
|
1564
1434
|
return availableSkills;
|
|
1565
1435
|
}
|
|
1566
|
-
|
|
1567
|
-
for (
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
if (restoredSkill) {
|
|
1572
|
-
upsertActiveSkill(args.activeSkills, restoredSkill);
|
|
1436
|
+
function lastLoadedSkillName(messages) {
|
|
1437
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
1438
|
+
const message = messages[index];
|
|
1439
|
+
if (message.role !== "toolResult" || message.toolName !== "loadSkill" || message.isError === true) {
|
|
1440
|
+
continue;
|
|
1573
1441
|
}
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
);
|
|
1579
|
-
if (restoredSkill) {
|
|
1580
|
-
upsertActiveSkill(args.activeSkills, restoredSkill);
|
|
1442
|
+
const details = message.details;
|
|
1443
|
+
const skillName = details && typeof details === "object" && "skill_name" in details ? details.skill_name : message.skill_name;
|
|
1444
|
+
if (typeof skillName === "string" && skillName.trim()) {
|
|
1445
|
+
return skillName;
|
|
1581
1446
|
}
|
|
1582
1447
|
}
|
|
1448
|
+
return void 0;
|
|
1449
|
+
}
|
|
1450
|
+
async function loadRunSkill(args) {
|
|
1451
|
+
const skillName = args.invokedSkill?.name ?? (args.resumed ? lastLoadedSkillName(args.currentTurnMessages) : void 0);
|
|
1452
|
+
if (!skillName) {
|
|
1453
|
+
return null;
|
|
1454
|
+
}
|
|
1455
|
+
const loadedSkill = await args.skillSandbox.loadSkill(skillName);
|
|
1456
|
+
if (loadedSkill) {
|
|
1457
|
+
upsertActiveSkill(args.activeSkills, loadedSkill);
|
|
1458
|
+
}
|
|
1459
|
+
return loadedSkill;
|
|
1583
1460
|
}
|
|
1584
1461
|
|
|
1585
1462
|
// src/chat/agent/prompt.ts
|
|
@@ -5789,11 +5666,11 @@ function replaceGeneratedTextContent(content, text) {
|
|
|
5789
5666
|
...withoutFirstGeneratedTextContent(content)
|
|
5790
5667
|
];
|
|
5791
5668
|
}
|
|
5792
|
-
function
|
|
5669
|
+
function isRecord2(value) {
|
|
5793
5670
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
5794
5671
|
}
|
|
5795
5672
|
function hasContinuation(value) {
|
|
5796
|
-
return
|
|
5673
|
+
return isRecord2(value) && isRecord2(value.continuation);
|
|
5797
5674
|
}
|
|
5798
5675
|
function stringField(record2, key) {
|
|
5799
5676
|
const value = record2[key];
|
|
@@ -5808,7 +5685,7 @@ function stringListField(record2, key) {
|
|
|
5808
5685
|
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
5809
5686
|
}
|
|
5810
5687
|
function accountText(value) {
|
|
5811
|
-
if (!
|
|
5688
|
+
if (!isRecord2(value)) {
|
|
5812
5689
|
return void 0;
|
|
5813
5690
|
}
|
|
5814
5691
|
const label = stringField(value, "label") || stringField(value, "id");
|
|
@@ -5819,7 +5696,7 @@ function accountText(value) {
|
|
|
5819
5696
|
return id && id !== label ? `${label} (${id})` : label;
|
|
5820
5697
|
}
|
|
5821
5698
|
function upstreamPermissionDeniedText(value) {
|
|
5822
|
-
if (!
|
|
5699
|
+
if (!isRecord2(value) || !isRecord2(value.permission_denied)) {
|
|
5823
5700
|
return void 0;
|
|
5824
5701
|
}
|
|
5825
5702
|
const signal = value.permission_denied;
|
|
@@ -5834,7 +5711,7 @@ function upstreamPermissionDeniedText(value) {
|
|
|
5834
5711
|
if (!provider || !message || !upstreamHost || !upstreamPath || !status) {
|
|
5835
5712
|
return void 0;
|
|
5836
5713
|
}
|
|
5837
|
-
const grant =
|
|
5714
|
+
const grant = isRecord2(signal.grant) ? signal.grant : {};
|
|
5838
5715
|
const grantName = stringField(grant, "name");
|
|
5839
5716
|
const grantAccess = stringField(grant, "access");
|
|
5840
5717
|
const grantReason = stringField(grant, "reason");
|
|
@@ -6503,12 +6380,6 @@ var McpToolManager = class {
|
|
|
6503
6380
|
active: this.activeProviders.has(provider)
|
|
6504
6381
|
}));
|
|
6505
6382
|
}
|
|
6506
|
-
async activateForSkill(skill) {
|
|
6507
|
-
if (!skill.pluginProvider) {
|
|
6508
|
-
return false;
|
|
6509
|
-
}
|
|
6510
|
-
return await this.activateProvider(skill.pluginProvider);
|
|
6511
|
-
}
|
|
6512
6383
|
async activateProvider(provider) {
|
|
6513
6384
|
if (this.activeProviders.has(provider)) {
|
|
6514
6385
|
return false;
|
|
@@ -7016,6 +6887,14 @@ function createImageGenerateTool(hooks, options, deps = {}) {
|
|
|
7016
6887
|
});
|
|
7017
6888
|
}
|
|
7018
6889
|
|
|
6890
|
+
// src/chat/mcp/tool-name.ts
|
|
6891
|
+
function parseMcpProviderFromToolName(toolName) {
|
|
6892
|
+
if (!toolName.startsWith("mcp__")) return void 0;
|
|
6893
|
+
const afterPrefix = toolName.slice("mcp__".length);
|
|
6894
|
+
const delimiterIndex = afterPrefix.indexOf("__");
|
|
6895
|
+
return delimiterIndex > 0 ? afterPrefix.slice(0, delimiterIndex) : void 0;
|
|
6896
|
+
}
|
|
6897
|
+
|
|
7019
6898
|
// src/chat/tools/skill/call-mcp-tool.ts
|
|
7020
6899
|
import { z as z12 } from "zod";
|
|
7021
6900
|
function resolveMcpArguments(input) {
|
|
@@ -7084,9 +6963,6 @@ function createCallMcpToolTool(mcpToolManager) {
|
|
|
7084
6963
|
execute: async (input, options) => {
|
|
7085
6964
|
const { tool_name } = input;
|
|
7086
6965
|
const provider = parseMcpProviderFromToolName(tool_name);
|
|
7087
|
-
if (provider) {
|
|
7088
|
-
await mcpToolManager.activateProvider(provider);
|
|
7089
|
-
}
|
|
7090
6966
|
const activeTools = mcpToolManager.getResolvedActiveTools();
|
|
7091
6967
|
const mcpTool = activeTools.find(
|
|
7092
6968
|
(candidate) => candidate.name === tool_name
|
|
@@ -7167,7 +7043,7 @@ function createLoadSkillTool(availableSkills, options) {
|
|
|
7167
7043
|
openWorldHint: false,
|
|
7168
7044
|
readOnlyHint: false
|
|
7169
7045
|
},
|
|
7170
|
-
description: "Load a skill by name for this turn. The result includes working_directory; resolve skill paths there and run skill-owned bash commands from there or with absolute paths. When the
|
|
7046
|
+
description: "Load a skill by name for this turn. The result includes working_directory; resolve skill paths there and run skill-owned bash commands from there or with absolute paths. When the skill instructions name an MCP provider, use searchMcpTools before callMcpTool. Use when a request clearly matches a known skill.",
|
|
7171
7047
|
inputSchema: z13.object({
|
|
7172
7048
|
skill_name: z13.string().min(1).describe("Skill name to load, without the leading slash.")
|
|
7173
7049
|
}),
|
|
@@ -7176,10 +7052,7 @@ function createLoadSkillTool(availableSkills, options) {
|
|
|
7176
7052
|
const result = await loadSkillFromHost(availableSkills, skill_name);
|
|
7177
7053
|
const loadedSkill = toLoadedSkill(result, availableSkills);
|
|
7178
7054
|
if (loadedSkill) {
|
|
7179
|
-
|
|
7180
|
-
if (metadata) {
|
|
7181
|
-
Object.assign(result, metadata);
|
|
7182
|
-
}
|
|
7055
|
+
await options?.onSkillLoaded?.(loadedSkill);
|
|
7183
7056
|
}
|
|
7184
7057
|
return result;
|
|
7185
7058
|
}
|
|
@@ -16116,26 +15989,7 @@ async function wireAgentTools(args) {
|
|
|
16116
15989
|
);
|
|
16117
15990
|
const effective = resolvedSkill ?? loadedSkill;
|
|
16118
15991
|
upsertActiveSkill(args.activeSkills, effective);
|
|
16119
|
-
if (await mcpToolManager.activateForSkill(effective)) {
|
|
16120
|
-
await args.recordConnectedMcpProvider(effective.pluginProvider);
|
|
16121
|
-
}
|
|
16122
15992
|
await tryRecordSkillLoadStat(effective);
|
|
16123
|
-
if (mcpAuth.getPendingPause()) {
|
|
16124
|
-
return void 0;
|
|
16125
|
-
}
|
|
16126
|
-
if (!effective.pluginProvider) {
|
|
16127
|
-
return void 0;
|
|
16128
|
-
}
|
|
16129
|
-
if (!mcpToolManager.getActiveProviders().includes(effective.pluginProvider)) {
|
|
16130
|
-
return void 0;
|
|
16131
|
-
}
|
|
16132
|
-
const availableToolCount = mcpToolManager.getActiveToolCatalog({
|
|
16133
|
-
provider: effective.pluginProvider
|
|
16134
|
-
}).length;
|
|
16135
|
-
return {
|
|
16136
|
-
mcp_provider: effective.pluginProvider,
|
|
16137
|
-
available_tool_count: availableToolCount
|
|
16138
|
-
};
|
|
16139
15993
|
}
|
|
16140
15994
|
},
|
|
16141
15995
|
toolRuntimeContext,
|
|
@@ -16158,14 +16012,7 @@ async function wireAgentTools(args) {
|
|
|
16158
16012
|
);
|
|
16159
16013
|
const pendingMcpProvider = args.state.pendingAuth?.kind === "mcp" ? args.state.pendingAuth.provider : void 0;
|
|
16160
16014
|
if (credentialUserId) {
|
|
16161
|
-
const
|
|
16162
|
-
...args.connectedMcpProviders,
|
|
16163
|
-
...inferActiveMcpProvidersFromPiMessages(args.priorPiMessages),
|
|
16164
|
-
...args.activeSkills.flatMap(
|
|
16165
|
-
(skill) => skill.pluginProvider ? [skill.pluginProvider] : []
|
|
16166
|
-
)
|
|
16167
|
-
]);
|
|
16168
|
-
for (const provider of providersToRestore) {
|
|
16015
|
+
for (const provider of args.connectedMcpProviders) {
|
|
16169
16016
|
if (provider === pendingMcpProvider) {
|
|
16170
16017
|
continue;
|
|
16171
16018
|
}
|
|
@@ -16428,7 +16275,7 @@ function createResumeState(args) {
|
|
|
16428
16275
|
}
|
|
16429
16276
|
const parkMessages = reason === "yield" ? [...resumeMessages] : continuableMessages(resumeMessages, latestSafeBoundaryMessages);
|
|
16430
16277
|
const parkKey = boundaryKey(parkMessages);
|
|
16431
|
-
if (!advancedPastResume && resumedBoundaryKey.length > 0 && parkKey === resumedBoundaryKey) {
|
|
16278
|
+
if (reason !== "timeout" && !advancedPastResume && resumedBoundaryKey.length > 0 && parkKey === resumedBoundaryKey) {
|
|
16432
16279
|
logWarn("agent.turn.no_progress_fail", {
|
|
16433
16280
|
"app.ai.resume_conversation_id": args.conversationId,
|
|
16434
16281
|
"app.ai.resume_session_id": args.turnId,
|
|
@@ -16467,6 +16314,7 @@ function createResumeState(args) {
|
|
|
16467
16314
|
if (record2.state === "paused") {
|
|
16468
16315
|
return {
|
|
16469
16316
|
status: "suspended",
|
|
16317
|
+
reason,
|
|
16470
16318
|
resumeVersion: record2.version,
|
|
16471
16319
|
...usage ? { usage } : {}
|
|
16472
16320
|
};
|
|
@@ -17174,14 +17022,18 @@ async function executeAgentRunInPrivacyContext(run, conversationPrivacy, runLogC
|
|
|
17174
17022
|
const slackDestination = routing.destination.platform === "slack" ? routing.destination : void 0;
|
|
17175
17023
|
const slackActor = actor?.platform === "slack" ? actor : void 0;
|
|
17176
17024
|
const userInput = input.messageText;
|
|
17025
|
+
const credentialUserId = run.credentialContext ? credentialUserSubjectId(run.credentialContext) : void 0;
|
|
17177
17026
|
const recordConnectedMcpProvider = async (provider) => {
|
|
17178
17027
|
if (connectedMcpProviders.has(provider)) {
|
|
17179
17028
|
return;
|
|
17180
17029
|
}
|
|
17181
|
-
|
|
17182
|
-
|
|
17183
|
-
|
|
17184
|
-
|
|
17030
|
+
if (credentialUserId) {
|
|
17031
|
+
await recordMcpProviderConnected({
|
|
17032
|
+
conversationId,
|
|
17033
|
+
provider,
|
|
17034
|
+
credentialSubjectId: credentialUserId
|
|
17035
|
+
});
|
|
17036
|
+
}
|
|
17185
17037
|
connectedMcpProviders.add(provider);
|
|
17186
17038
|
};
|
|
17187
17039
|
const recordActiveMcpProviders = async () => {
|
|
@@ -17285,15 +17137,18 @@ async function executeAgentRunInPrivacyContext(run, conversationPrivacy, runLogC
|
|
|
17285
17137
|
};
|
|
17286
17138
|
const priorPiMessages = resumedFromSessionRecord ? existingSessionRecord?.piMessages : input.piMessages;
|
|
17287
17139
|
connectedMcpProviders = new Set(
|
|
17288
|
-
await loadConnectedMcpProviders({
|
|
17140
|
+
credentialUserId ? await loadConnectedMcpProviders({
|
|
17141
|
+
conversationId,
|
|
17142
|
+
credentialSubjectId: credentialUserId
|
|
17143
|
+
}) : []
|
|
17289
17144
|
);
|
|
17290
|
-
await
|
|
17145
|
+
const explicitSkill = await loadRunSkill({
|
|
17291
17146
|
activeSkills,
|
|
17147
|
+
currentTurnMessages,
|
|
17292
17148
|
invokedSkill,
|
|
17293
|
-
|
|
17149
|
+
resumed: resumedFromSessionRecord,
|
|
17294
17150
|
skillSandbox
|
|
17295
17151
|
});
|
|
17296
|
-
const explicitSkill = invokedSkill ? activeSkills.find((skill) => skill.name === invokedSkill.name) ?? null : null;
|
|
17297
17152
|
const { contextContentParts, routerBlocks, userContentParts } = buildPromptInput({
|
|
17298
17153
|
instruction: run.instruction,
|
|
17299
17154
|
history: run.history
|
|
@@ -17503,7 +17358,6 @@ async function executeAgentRunInPrivacyContext(run, conversationPrivacy, runLogC
|
|
|
17503
17358
|
lastKnownSandboxRef = sandboxRef;
|
|
17504
17359
|
},
|
|
17505
17360
|
preAgentPromptMessages,
|
|
17506
|
-
priorPiMessages,
|
|
17507
17361
|
recordConnectedMcpProvider,
|
|
17508
17362
|
requestHandoff,
|
|
17509
17363
|
resume: runResume,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTurnUserMessageId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J5LAA2LI.js";
|
|
4
4
|
import {
|
|
5
5
|
coerceThreadConversationState,
|
|
6
6
|
getPersistedThreadState,
|
|
7
7
|
persistThreadStateById
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EMB4VY7H.js";
|
|
9
9
|
import {
|
|
10
10
|
hydrateConversationMessages,
|
|
11
11
|
markConversationMessage,
|
|
12
12
|
markTurnClosed
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JIJOPRD4.js";
|
|
14
14
|
|
|
15
15
|
// src/chat/runtime/auth-pause-state.ts
|
|
16
16
|
function completeAuthPauseTurn(args) {
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
getConversationStore,
|
|
9
9
|
parseDestination,
|
|
10
10
|
sameDestination
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-K3QXMZDU.js";
|
|
12
12
|
import {
|
|
13
13
|
getDefaultRedisStateAdapterFor,
|
|
14
14
|
getStateAdapter
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YN4W5SRJ.js";
|
|
16
16
|
import {
|
|
17
17
|
getChatConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-D22FO4LW.js";
|
|
19
19
|
import {
|
|
20
20
|
parseStoredSlackActor
|
|
21
21
|
} from "./chunk-HZF5P5UN.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
isRecord,
|
|
24
24
|
toOptionalNumber,
|
|
25
25
|
toOptionalString
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-OAPPJ3TM.js";
|
|
27
27
|
|
|
28
28
|
// src/chat/task-execution/state.ts
|
|
29
29
|
import { randomUUID } from "crypto";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ToolInputError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JIJOPRD4.js";
|
|
4
4
|
import {
|
|
5
5
|
canRouteResourceEvents,
|
|
6
6
|
getPlugins
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QVQBWWXQ.js";
|
|
8
8
|
import {
|
|
9
9
|
getDb
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-K3QXMZDU.js";
|
|
11
11
|
import {
|
|
12
12
|
juniorEventTasks,
|
|
13
13
|
juniorSchedulerRuns,
|
|
14
14
|
juniorSchedulerTasks,
|
|
15
15
|
juniorStats
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-5N3XLYBW.js";
|
|
17
17
|
import {
|
|
18
18
|
juniorDestinations
|
|
19
19
|
} from "./chunk-VFUK3X5B.js";
|
|
20
20
|
import {
|
|
21
21
|
logInfo
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-OAPPJ3TM.js";
|
|
23
23
|
|
|
24
24
|
// src/chat/event-tasks/store.ts
|
|
25
25
|
import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-EM225ITJ.js";
|
|
4
4
|
import {
|
|
5
5
|
getSlackBotToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-D22FO4LW.js";
|
|
7
7
|
import {
|
|
8
8
|
parseSlackChannelReferenceId
|
|
9
9
|
} from "./chunk-F3B2YJ76.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
setSpanAttributes,
|
|
13
13
|
setSpanStatus,
|
|
14
14
|
withSpan
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OAPPJ3TM.js";
|
|
16
16
|
|
|
17
17
|
// src/chat/slack/client.ts
|
|
18
18
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|