@sentry/junior 0.90.0 → 0.92.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-MXAF7RQL.js → agent-hooks-BYSSWCNW.js} +7 -7
- package/dist/api/people/list.d.ts +3 -3
- package/dist/api/people/list.js +15 -15
- package/dist/api/people/list.query.d.ts +2 -2
- package/dist/api/people/profile.d.ts +3 -3
- package/dist/api/people/profile.js +12 -12
- package/dist/api/people/profile.query.d.ts +2 -2
- package/dist/api/people/shared.d.ts +13 -13
- package/dist/api/people/types.d.ts +12 -12
- package/dist/api-reference.d.ts +1 -1
- package/dist/app.js +406 -267
- package/dist/{catalog-runtime-DXE6NXHT.js → catalog-runtime-NZHMSMYC.js} +2 -2
- package/dist/chat/actor.d.ts +75 -0
- package/dist/chat/agent/prompt.d.ts +4 -4
- package/dist/chat/agent/request.d.ts +21 -13
- package/dist/chat/agent/resume.d.ts +5 -4
- package/dist/chat/agent/tools.d.ts +2 -2
- package/dist/chat/capabilities/jr-rpc-command.d.ts +1 -1
- package/dist/chat/conversation-privacy.d.ts +11 -0
- package/dist/chat/conversations/sql/migrations.d.ts +1 -1
- package/dist/chat/conversations/sql/schema/conversations.d.ts +2 -19
- package/dist/chat/conversations/sql/schema.d.ts +2 -19
- package/dist/chat/conversations/sql/store.d.ts +3 -3
- package/dist/chat/conversations/store.d.ts +4 -4
- package/dist/chat/credentials/context.d.ts +4 -4
- package/dist/chat/current-instruction.d.ts +5 -3
- package/dist/chat/logging.d.ts +2 -2
- package/dist/chat/no-reply.d.ts +1 -1
- package/dist/chat/oauth-authorization-message.d.ts +6 -0
- package/dist/chat/oauth-flow.d.ts +1 -1
- package/dist/chat/pi/messages.d.ts +2 -2
- package/dist/chat/pi/transcript.d.ts +15 -0
- package/dist/chat/plugins/agent-hooks.d.ts +3 -3
- package/dist/chat/plugins/credential-hooks.d.ts +2 -8
- package/dist/chat/prompt.d.ts +3 -6
- package/dist/chat/runtime/reply-executor.d.ts +1 -1
- package/dist/chat/runtime/turn-input.d.ts +1 -1
- package/dist/chat/sandbox/egress/schemas.d.ts +2 -2
- package/dist/chat/sandbox/egress/session.d.ts +1 -1
- package/dist/chat/services/context-compaction.d.ts +1 -1
- package/dist/chat/services/conversation-memory.d.ts +1 -1
- package/dist/chat/services/mcp-auth-orchestration.d.ts +1 -1
- package/dist/chat/services/message-actor-identity.d.ts +4 -4
- package/dist/chat/services/pending-auth.d.ts +2 -2
- package/dist/chat/services/plugin-auth-orchestration.d.ts +1 -1
- package/dist/chat/services/provider-default-config.d.ts +1 -1
- package/dist/chat/services/subscribed-decision.d.ts +1 -1
- package/dist/chat/services/turn-result.d.ts +1 -1
- package/dist/chat/services/turn-session-record.d.ts +11 -8
- package/dist/chat/services/turn-thinking-level.d.ts +1 -1
- package/dist/chat/slack/assistant-thread/title.d.ts +1 -1
- package/dist/chat/slack/mrkdwn.d.ts +6 -0
- package/dist/chat/slack/tools/canvas/create.d.ts +41 -1
- package/dist/chat/slack/tools/canvas/edit.d.ts +60 -1
- package/dist/chat/slack/tools/canvas/read.d.ts +60 -1
- package/dist/chat/slack/tools/canvas/write.d.ts +41 -1
- package/dist/chat/slack/tools/channel-list-messages.d.ts +45 -1
- package/dist/chat/slack/tools/context.d.ts +3 -3
- package/dist/chat/slack/tools/list/add-items.d.ts +42 -1
- package/dist/chat/slack/tools/list/create.d.ts +40 -1
- package/dist/chat/slack/tools/list/get-items.d.ts +40 -1
- package/dist/chat/slack/tools/list/update-item.d.ts +46 -1
- package/dist/chat/slack/tools/message-add-reaction.d.ts +40 -1
- package/dist/chat/slack/tools/send-message.d.ts +45 -1
- package/dist/chat/slack/tools/thread-read.d.ts +44 -1
- package/dist/chat/slack/tools/user-lookup.d.ts +45 -1
- package/dist/chat/slack/user.d.ts +3 -3
- package/dist/chat/slack/vision-context.d.ts +2 -2
- package/dist/chat/sql/schema.d.ts +2 -19
- package/dist/chat/state/conversation-details.d.ts +4 -4
- package/dist/chat/state/conversation.d.ts +1 -1
- package/dist/chat/state/session-log.d.ts +140 -26
- package/dist/chat/state/turn-session.d.ts +18 -5
- package/dist/chat/task-execution/slack-work.d.ts +2 -2
- package/dist/chat/task-execution/state.d.ts +4 -4
- package/dist/chat/tool-support/zod-tool.d.ts +16 -4
- package/dist/chat/tools/advisor/tool.d.ts +41 -1
- package/dist/chat/tools/definition.d.ts +10 -0
- package/dist/chat/tools/execute-tool.d.ts +41 -1
- package/dist/chat/tools/resource-events.d.ts +124 -3
- package/dist/chat/tools/runtime/report-progress.d.ts +40 -1
- package/dist/chat/tools/sandbox/bash.d.ts +41 -1
- package/dist/chat/tools/sandbox/edit-file.d.ts +44 -1
- package/dist/chat/tools/sandbox/find-files.d.ts +42 -1
- package/dist/chat/tools/sandbox/grep.d.ts +46 -1
- package/dist/chat/tools/sandbox/list-dir.d.ts +41 -1
- package/dist/chat/tools/sandbox/read-file.d.ts +42 -1
- package/dist/chat/tools/sandbox/write-file.d.ts +41 -1
- package/dist/chat/tools/search-tools.d.ts +102 -1
- package/dist/chat/tools/skill/call-mcp-tool.d.ts +10 -1
- package/dist/chat/tools/skill/load-skill.d.ts +40 -1
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +100 -1
- package/dist/chat/tools/system-time.d.ts +38 -1
- package/dist/chat/tools/types.d.ts +4 -4
- package/dist/chat/tools/web/fetch-tool.d.ts +41 -1
- package/dist/chat/tools/web/image-generate.d.ts +62 -1
- package/dist/chat/tools/web/search.d.ts +41 -1
- package/dist/{chunk-HXL2ZV74.js → chunk-3F54A3YM.js} +82 -11
- package/dist/{chunk-BKSZL4QO.js → chunk-7DVIELX3.js} +670 -401
- package/dist/{chunk-GCWD2VHP.js → chunk-7FS3K243.js} +284 -124
- package/dist/{chunk-AOISHLSF.js → chunk-ACJENBVF.js} +143 -20
- package/dist/{chunk-IRRMABQD.js → chunk-APIVR44P.js} +10 -10
- package/dist/{chunk-PHZHJTCK.js → chunk-BMQ5DXHV.js} +30 -52
- package/dist/{chunk-XP7F4LYB.js → chunk-BTH37NCU.js} +4 -4
- package/dist/{chunk-5GBUZI6M.js → chunk-H7KUZAMZ.js} +4 -4
- package/dist/{chunk-TYUXD3FN.js → chunk-MC4ZZE4Q.js} +1 -1
- package/dist/{chunk-QCKGI74V.js → chunk-N25HRI6B.js} +10 -10
- package/dist/{chunk-2S7M37HY.js → chunk-NIFONS4W.js} +86 -47
- package/dist/{chunk-ONFOWI2D.js → chunk-OJP53WIU.js} +16 -15
- package/dist/{chunk-NW7AXDA5.js → chunk-OZJXGX4U.js} +2 -2
- package/dist/{chunk-KC42JAAQ.js → chunk-PFXC67GJ.js} +3 -3
- package/dist/{chunk-ZUK7BL63.js → chunk-S6QKIGRM.js} +66 -54
- package/dist/{chunk-IX76WFJV.js → chunk-TF5VLGA7.js} +10 -10
- package/dist/{chunk-DACFZ5CI.js → chunk-VY7TVOIK.js} +16 -12
- package/dist/{chunk-AN2437E3.js → chunk-YTNPU7I2.js} +2 -2
- package/dist/{chunk-3MPOMK3K.js → chunk-YYBX2BD5.js} +61 -3
- package/dist/{chunk-RS6ANWVT.js → chunk-ZATRYQLR.js} +1 -1
- package/dist/cli/chat.js +20 -20
- package/dist/cli/check.js +3 -3
- package/dist/cli/plugins.js +9 -9
- package/dist/cli/snapshot-warmup.js +6 -6
- package/dist/cli/upgrade.js +9 -9
- package/dist/{db-CXI7PR5U.js → db-GCK43OO3.js} +4 -4
- package/dist/instrumentation.js +1 -1
- package/dist/reporting/conversations.d.ts +3 -3
- package/dist/reporting.d.ts +1 -1
- package/dist/reporting.js +48 -50
- package/dist/{runner-FKL3RAHA.js → runner-XWTFA26U.js} +20 -18
- package/dist/{validation-I7GD2YWS.js → validation-KYAWETI4.js} +3 -3
- package/package.json +6 -6
- package/dist/chat/requester.d.ts +0 -68
|
@@ -1340,27 +1340,35 @@ function extractGenAiUsageSummary(...sources) {
|
|
|
1340
1340
|
return summary;
|
|
1341
1341
|
}
|
|
1342
1342
|
function extractGenAiUsageAttributes(...sources) {
|
|
1343
|
-
const {
|
|
1343
|
+
const {
|
|
1344
|
+
inputTokens,
|
|
1345
|
+
outputTokens,
|
|
1346
|
+
cachedInputTokens,
|
|
1347
|
+
cacheCreationTokens,
|
|
1348
|
+
totalTokens
|
|
1349
|
+
} = extractGenAiUsageSummary(...sources);
|
|
1344
1350
|
const semanticInputTokens = sumTokenCounts(
|
|
1345
1351
|
inputTokens,
|
|
1346
1352
|
cachedInputTokens,
|
|
1347
1353
|
cacheCreationTokens
|
|
1348
1354
|
);
|
|
1355
|
+
const semanticTotalTokens = totalTokens ?? sumTokenCounts(semanticInputTokens, outputTokens);
|
|
1349
1356
|
return {
|
|
1350
1357
|
...semanticInputTokens !== void 0 ? { "gen_ai.usage.input_tokens": semanticInputTokens } : {},
|
|
1351
1358
|
...outputTokens !== void 0 ? { "gen_ai.usage.output_tokens": outputTokens } : {},
|
|
1352
|
-
...
|
|
1353
|
-
...
|
|
1359
|
+
...semanticTotalTokens !== void 0 ? { "gen_ai.usage.total_tokens": semanticTotalTokens } : {},
|
|
1360
|
+
...cachedInputTokens !== void 0 ? { "gen_ai.usage.input_tokens.cached": cachedInputTokens } : {},
|
|
1361
|
+
...cacheCreationTokens !== void 0 ? { "gen_ai.usage.input_tokens.cache_write": cacheCreationTokens } : {}
|
|
1354
1362
|
};
|
|
1355
1363
|
}
|
|
1356
1364
|
|
|
1357
|
-
// src/chat/
|
|
1365
|
+
// src/chat/actor.ts
|
|
1358
1366
|
import { z } from "zod";
|
|
1359
|
-
import {
|
|
1367
|
+
import { actorSchema } from "@sentry/junior-plugin-api";
|
|
1360
1368
|
var SLACK_USER_ID_DISPLAY_PATTERN = /^[UW][A-Z0-9]{5,}$/;
|
|
1361
1369
|
var EMAIL_PATTERN = /^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;
|
|
1362
1370
|
var exactStoredStringSchema = z.string().min(1).refine((value) => value === value.trim());
|
|
1363
|
-
var
|
|
1371
|
+
var storedSlackActorSchema = z.object({
|
|
1364
1372
|
email: exactStoredStringSchema.optional(),
|
|
1365
1373
|
fullName: exactStoredStringSchema.optional(),
|
|
1366
1374
|
platform: z.literal("slack").optional(),
|
|
@@ -1368,10 +1376,13 @@ var storedSlackRequesterSchema = z.object({
|
|
|
1368
1376
|
slackUserName: exactStoredStringSchema.optional(),
|
|
1369
1377
|
teamId: exactStoredStringSchema.optional()
|
|
1370
1378
|
}).strict();
|
|
1371
|
-
function
|
|
1372
|
-
const result =
|
|
1379
|
+
function parseActor(value) {
|
|
1380
|
+
const result = actorSchema.safeParse(value);
|
|
1373
1381
|
return result.success ? result.data : void 0;
|
|
1374
1382
|
}
|
|
1383
|
+
function isUserActor(actor) {
|
|
1384
|
+
return Boolean(actor && "userId" in actor);
|
|
1385
|
+
}
|
|
1375
1386
|
function clean(value) {
|
|
1376
1387
|
const trimmed = value?.trim();
|
|
1377
1388
|
return trimmed ? trimmed : void 0;
|
|
@@ -1382,7 +1393,7 @@ function isSyntheticActorUserId(value) {
|
|
|
1382
1393
|
function isSlackUserId(value) {
|
|
1383
1394
|
return SLACK_USER_ID_DISPLAY_PATTERN.test(value);
|
|
1384
1395
|
}
|
|
1385
|
-
function
|
|
1396
|
+
function cleanActorDisplayName(value, userId) {
|
|
1386
1397
|
const displayName = clean(value);
|
|
1387
1398
|
if (!displayName) {
|
|
1388
1399
|
return void 0;
|
|
@@ -1395,7 +1406,7 @@ function cleanRequesterDisplayName(value, userId) {
|
|
|
1395
1406
|
}
|
|
1396
1407
|
return isSlackUserId(displayName) ? void 0 : displayName;
|
|
1397
1408
|
}
|
|
1398
|
-
function
|
|
1409
|
+
function cleanActorEmail(value) {
|
|
1399
1410
|
const email = clean(value);
|
|
1400
1411
|
return email && EMAIL_PATTERN.test(email) ? email : void 0;
|
|
1401
1412
|
}
|
|
@@ -1411,7 +1422,7 @@ function parseActorUserId(value) {
|
|
|
1411
1422
|
function isActorUserId(value) {
|
|
1412
1423
|
return parseActorUserId(value) === value;
|
|
1413
1424
|
}
|
|
1414
|
-
function
|
|
1425
|
+
function createActor(input, context) {
|
|
1415
1426
|
const platform = context.platform ?? input?.platform;
|
|
1416
1427
|
if (!platform) {
|
|
1417
1428
|
return void 0;
|
|
@@ -1424,8 +1435,8 @@ function createRequester(input, context) {
|
|
|
1424
1435
|
if (input?.userId !== void 0 && !inputUserId) {
|
|
1425
1436
|
return void 0;
|
|
1426
1437
|
}
|
|
1427
|
-
const
|
|
1428
|
-
if (!
|
|
1438
|
+
const actorUserId = contextUserId ?? inputUserId;
|
|
1439
|
+
if (!actorUserId) {
|
|
1429
1440
|
return void 0;
|
|
1430
1441
|
}
|
|
1431
1442
|
const contextTeamId = parseSlackTeamId(context.teamId);
|
|
@@ -1436,34 +1447,34 @@ function createRequester(input, context) {
|
|
|
1436
1447
|
if (input?.teamId !== void 0 && !inputTeamId) {
|
|
1437
1448
|
return void 0;
|
|
1438
1449
|
}
|
|
1439
|
-
const
|
|
1440
|
-
if (platform === "slack" && !
|
|
1450
|
+
const actorTeamId = contextTeamId ?? inputTeamId;
|
|
1451
|
+
if (platform === "slack" && !actorTeamId) {
|
|
1441
1452
|
return void 0;
|
|
1442
1453
|
}
|
|
1443
1454
|
const canUseInputProfile = (!contextUserId || !inputUserId || contextUserId === inputUserId) && (platform !== "slack" || !contextTeamId || !inputTeamId || contextTeamId === inputTeamId);
|
|
1444
|
-
const
|
|
1445
|
-
...canUseInputProfile &&
|
|
1446
|
-
...canUseInputProfile &&
|
|
1447
|
-
fullName:
|
|
1455
|
+
const actor = {
|
|
1456
|
+
...canUseInputProfile && cleanActorEmail(input?.email) ? { email: cleanActorEmail(input?.email) } : {},
|
|
1457
|
+
...canUseInputProfile && cleanActorDisplayName(input?.fullName, actorUserId) ? {
|
|
1458
|
+
fullName: cleanActorDisplayName(input?.fullName, actorUserId)
|
|
1448
1459
|
} : {},
|
|
1449
1460
|
platform,
|
|
1450
|
-
userId:
|
|
1451
|
-
...canUseInputProfile &&
|
|
1452
|
-
userName:
|
|
1461
|
+
userId: actorUserId,
|
|
1462
|
+
...canUseInputProfile && cleanActorDisplayName(input?.userName, actorUserId) ? {
|
|
1463
|
+
userName: cleanActorDisplayName(input?.userName, actorUserId)
|
|
1453
1464
|
} : {}
|
|
1454
1465
|
};
|
|
1455
1466
|
if (platform === "slack") {
|
|
1456
|
-
return { ...
|
|
1467
|
+
return { ...actor, platform, teamId: actorTeamId };
|
|
1457
1468
|
}
|
|
1458
|
-
return { ...
|
|
1469
|
+
return { ...actor, platform };
|
|
1459
1470
|
}
|
|
1460
|
-
function
|
|
1471
|
+
function createSlackActor(teamId, userId, profile) {
|
|
1461
1472
|
const actorUserId = parseActorUserId(userId);
|
|
1462
1473
|
const actorTeamId = parseSlackTeamId(teamId);
|
|
1463
1474
|
if (!actorTeamId || !actorUserId) {
|
|
1464
|
-
throw new Error("Slack
|
|
1475
|
+
throw new Error("Slack actor requires team and user ids");
|
|
1465
1476
|
}
|
|
1466
|
-
const
|
|
1477
|
+
const actor = createActor(
|
|
1467
1478
|
{
|
|
1468
1479
|
email: profile?.email,
|
|
1469
1480
|
fullName: profile?.fullName,
|
|
@@ -1474,13 +1485,13 @@ function createSlackRequester(teamId, userId, profile) {
|
|
|
1474
1485
|
},
|
|
1475
1486
|
{ teamId: actorTeamId, userId: actorUserId }
|
|
1476
1487
|
);
|
|
1477
|
-
if (!
|
|
1478
|
-
throw new Error("Slack
|
|
1488
|
+
if (!actor || actor.platform !== "slack") {
|
|
1489
|
+
throw new Error("Slack actor requires team and user ids");
|
|
1479
1490
|
}
|
|
1480
|
-
return
|
|
1491
|
+
return actor;
|
|
1481
1492
|
}
|
|
1482
|
-
function
|
|
1483
|
-
const parsed =
|
|
1493
|
+
function parseStoredSlackActor(value) {
|
|
1494
|
+
const parsed = storedSlackActorSchema.safeParse(value);
|
|
1484
1495
|
if (!parsed.success) {
|
|
1485
1496
|
return void 0;
|
|
1486
1497
|
}
|
|
@@ -1495,31 +1506,31 @@ function parseStoredSlackRequester(value) {
|
|
|
1495
1506
|
}
|
|
1496
1507
|
return parsed.data;
|
|
1497
1508
|
}
|
|
1498
|
-
function
|
|
1509
|
+
function toStoredSlackActor(actor) {
|
|
1499
1510
|
return {
|
|
1500
|
-
...
|
|
1501
|
-
...
|
|
1502
|
-
platform:
|
|
1503
|
-
slackUserId:
|
|
1504
|
-
...
|
|
1505
|
-
teamId:
|
|
1511
|
+
...actor.email ? { email: actor.email } : {},
|
|
1512
|
+
...actor.fullName ? { fullName: actor.fullName } : {},
|
|
1513
|
+
platform: actor.platform,
|
|
1514
|
+
slackUserId: actor.userId,
|
|
1515
|
+
...actor.userName ? { slackUserName: actor.userName } : {},
|
|
1516
|
+
teamId: actor.teamId
|
|
1506
1517
|
};
|
|
1507
1518
|
}
|
|
1508
|
-
function
|
|
1509
|
-
if (args.
|
|
1510
|
-
if (args.
|
|
1511
|
-
throw new Error("Stored Slack
|
|
1519
|
+
function createSlackResumeActor(args) {
|
|
1520
|
+
if (args.actor) {
|
|
1521
|
+
if (args.actor.platform !== "slack" || args.actor.teamId !== args.teamId || args.actor.userId !== args.userId) {
|
|
1522
|
+
throw new Error("Stored Slack actor did not match resume actor");
|
|
1512
1523
|
}
|
|
1513
1524
|
}
|
|
1514
|
-
const
|
|
1525
|
+
const actor = createActor(args.actor, {
|
|
1515
1526
|
platform: "slack",
|
|
1516
1527
|
teamId: args.teamId,
|
|
1517
1528
|
userId: args.userId
|
|
1518
1529
|
});
|
|
1519
|
-
if (!
|
|
1520
|
-
throw new Error("Slack
|
|
1530
|
+
if (!actor || actor.platform !== "slack") {
|
|
1531
|
+
throw new Error("Slack actor requires team and user ids");
|
|
1521
1532
|
}
|
|
1522
|
-
return
|
|
1533
|
+
return actor;
|
|
1523
1534
|
}
|
|
1524
1535
|
|
|
1525
1536
|
export {
|
|
@@ -1545,13 +1556,14 @@ export {
|
|
|
1545
1556
|
serializeGenAiAttribute,
|
|
1546
1557
|
extractGenAiUsageSummary,
|
|
1547
1558
|
extractGenAiUsageAttributes,
|
|
1548
|
-
|
|
1549
|
-
|
|
1559
|
+
storedSlackActorSchema,
|
|
1560
|
+
parseActor,
|
|
1561
|
+
isUserActor,
|
|
1550
1562
|
parseActorUserId,
|
|
1551
1563
|
isActorUserId,
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1564
|
+
createActor,
|
|
1565
|
+
createSlackActor,
|
|
1566
|
+
parseStoredSlackActor,
|
|
1567
|
+
toStoredSlackActor,
|
|
1568
|
+
createSlackResumeActor
|
|
1557
1569
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PFXC67GJ.js";
|
|
4
4
|
import {
|
|
5
5
|
getDefaultRedisStateAdapterFor,
|
|
6
6
|
getStateAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZATRYQLR.js";
|
|
8
8
|
import {
|
|
9
9
|
getChatConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3F54A3YM.js";
|
|
11
11
|
import {
|
|
12
12
|
parseDestination,
|
|
13
13
|
sameDestination
|
|
14
14
|
} from "./chunk-GHGPTPBL.js";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
parseStoredSlackActor
|
|
17
|
+
} from "./chunk-S6QKIGRM.js";
|
|
18
18
|
import {
|
|
19
19
|
isRecord,
|
|
20
20
|
toOptionalNumber,
|
|
@@ -150,8 +150,8 @@ function normalizeMessage(value) {
|
|
|
150
150
|
function isFinalAttempt(message) {
|
|
151
151
|
return (message.attemptCount ?? 0) >= CONVERSATION_WORK_MAX_DELIVERY_ATTEMPTS - 1;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
153
|
+
function normalizeActor(value) {
|
|
154
|
+
return parseStoredSlackActor(value);
|
|
155
155
|
}
|
|
156
156
|
function normalizeLease(value) {
|
|
157
157
|
if (!isRecord(value)) {
|
|
@@ -228,7 +228,7 @@ function normalizeConversation(conversationId, value) {
|
|
|
228
228
|
...destination ? { destination } : {},
|
|
229
229
|
...toOptionalString(value.title) ? { title: toOptionalString(value.title) } : {},
|
|
230
230
|
...toOptionalString(value.channelName) ? { channelName: toOptionalString(value.channelName) } : {},
|
|
231
|
-
...
|
|
231
|
+
...normalizeActor(value.actor) ? { actor: normalizeActor(value.actor) } : {},
|
|
232
232
|
...normalizeSource(value.source) ? { source: normalizeSource(value.source) } : {}
|
|
233
233
|
};
|
|
234
234
|
}
|
|
@@ -766,7 +766,7 @@ async function recordConversationActivity(args) {
|
|
|
766
766
|
...current.destination ?? args.destination ? { destination: current.destination ?? args.destination } : {},
|
|
767
767
|
...current.source ?? args.source ? { source: current.source ?? args.source } : {},
|
|
768
768
|
...current.channelName ?? args.channelName ? { channelName: current.channelName ?? args.channelName } : {},
|
|
769
|
-
...current.
|
|
769
|
+
...current.actor ?? args.actor ? { actor: current.actor ?? args.actor } : {},
|
|
770
770
|
...current.title ?? args.title ? { title: current.title ?? args.title } : {},
|
|
771
771
|
lastActivityAtMs: Math.max(current.lastActivityAtMs, activityAtMs),
|
|
772
772
|
updatedAtMs: nowMs,
|
|
@@ -803,7 +803,7 @@ async function recordConversationExecution(args) {
|
|
|
803
803
|
...current.destination ?? args.destination ? { destination: current.destination ?? args.destination } : {},
|
|
804
804
|
...current.source ?? args.source ? { source: current.source ?? args.source } : {},
|
|
805
805
|
...current.channelName ?? args.channelName ? { channelName: current.channelName ?? args.channelName } : {},
|
|
806
|
-
...current.
|
|
806
|
+
...current.actor ?? args.actor ? { actor: current.actor ?? args.actor } : {},
|
|
807
807
|
...current.title ?? args.title ? { title: current.title ?? args.title } : {},
|
|
808
808
|
createdAtMs: Math.min(current.createdAtMs, args.createdAtMs),
|
|
809
809
|
lastActivityAtMs: Math.max(
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPluginLogger,
|
|
3
3
|
createPluginState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OZJXGX4U.js";
|
|
5
5
|
import {
|
|
6
6
|
SANDBOX_WORKSPACE_ROOT
|
|
7
7
|
} from "./chunk-G3E7SCME.js";
|
|
8
8
|
import {
|
|
9
9
|
getDb
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NIFONS4W.js";
|
|
11
11
|
import {
|
|
12
12
|
botConfig,
|
|
13
13
|
completeObject,
|
|
14
14
|
embedTexts,
|
|
15
15
|
getSlackBotToken
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3F54A3YM.js";
|
|
17
17
|
import {
|
|
18
18
|
isActorUserId,
|
|
19
19
|
logInfo,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
setSpanAttributes,
|
|
23
23
|
setSpanStatus,
|
|
24
24
|
withSpan
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-S6QKIGRM.js";
|
|
26
26
|
import {
|
|
27
27
|
parseSlackChannelReferenceId,
|
|
28
28
|
parseSlackMessageTs,
|
|
@@ -90,7 +90,7 @@ function getSlackToolContext(context) {
|
|
|
90
90
|
return {
|
|
91
91
|
destination: context.destination,
|
|
92
92
|
source: context.source,
|
|
93
|
-
|
|
93
|
+
actor: context.actor?.platform === "slack" ? context.actor : void 0,
|
|
94
94
|
destinationChannelId,
|
|
95
95
|
messageTs: parseSlackMessageTs(context.source.messageTs),
|
|
96
96
|
sourceChannelId,
|
|
@@ -697,7 +697,7 @@ function invocationPluginContext(plugin, context) {
|
|
|
697
697
|
return {
|
|
698
698
|
...common,
|
|
699
699
|
destination: context.destination,
|
|
700
|
-
|
|
700
|
+
actor: context.actor?.platform === "slack" ? context.actor : void 0
|
|
701
701
|
};
|
|
702
702
|
}
|
|
703
703
|
if (context.destination.platform !== "local") {
|
|
@@ -708,7 +708,7 @@ function invocationPluginContext(plugin, context) {
|
|
|
708
708
|
return {
|
|
709
709
|
...common,
|
|
710
710
|
destination: context.destination,
|
|
711
|
-
|
|
711
|
+
actor: context.actor?.platform === "local" ? context.actor : void 0
|
|
712
712
|
};
|
|
713
713
|
}
|
|
714
714
|
function safeErrorMessage(error) {
|
|
@@ -907,7 +907,7 @@ function getPluginTools(context) {
|
|
|
907
907
|
const credentialSubject = slackToolContext ? createSlackDirectCredentialSubject({
|
|
908
908
|
channelId: slackToolContext.sourceChannelId,
|
|
909
909
|
teamId: slackToolContext.teamId,
|
|
910
|
-
userId: slackToolContext.
|
|
910
|
+
userId: slackToolContext.actor?.userId
|
|
911
911
|
}) : void 0;
|
|
912
912
|
const slackContext = slackToolContext ? {
|
|
913
913
|
channelCapabilities: resolveChannelCapabilities(
|
|
@@ -924,7 +924,7 @@ function getPluginTools(context) {
|
|
|
924
924
|
}
|
|
925
925
|
pluginContext = {
|
|
926
926
|
...basePluginContext(plugin),
|
|
927
|
-
|
|
927
|
+
actor: context.actor?.platform === "slack" ? context.actor : void 0,
|
|
928
928
|
conversationId: context.conversationId,
|
|
929
929
|
destination: context.destination,
|
|
930
930
|
slack: slackContext,
|
|
@@ -943,7 +943,7 @@ function getPluginTools(context) {
|
|
|
943
943
|
}
|
|
944
944
|
pluginContext = {
|
|
945
945
|
...basePluginContext(plugin),
|
|
946
|
-
|
|
946
|
+
actor: context.actor?.platform === "local" ? context.actor : void 0,
|
|
947
947
|
conversationId: context.conversationId,
|
|
948
948
|
destination: context.destination,
|
|
949
949
|
source: context.source,
|
|
@@ -974,6 +974,10 @@ function getPluginTools(context) {
|
|
|
974
974
|
name: localName,
|
|
975
975
|
plugin: pluginName
|
|
976
976
|
};
|
|
977
|
+
definition.source = {
|
|
978
|
+
id: pluginName,
|
|
979
|
+
description: plugin.manifest.description
|
|
980
|
+
};
|
|
977
981
|
definition.exposure = "deferred";
|
|
978
982
|
tools[name] = definition;
|
|
979
983
|
}
|
|
@@ -1355,7 +1359,7 @@ function createPluginHookRunner(input = {}) {
|
|
|
1355
1359
|
);
|
|
1356
1360
|
await hook({
|
|
1357
1361
|
...basePluginContext(plugin),
|
|
1358
|
-
|
|
1362
|
+
actor: input.actor,
|
|
1359
1363
|
sandbox: sandboxCapability
|
|
1360
1364
|
});
|
|
1361
1365
|
}
|
|
@@ -1373,7 +1377,7 @@ function createPluginHookRunner(input = {}) {
|
|
|
1373
1377
|
let denied;
|
|
1374
1378
|
await hook({
|
|
1375
1379
|
...basePluginContext(plugin),
|
|
1376
|
-
|
|
1380
|
+
actor: input.actor,
|
|
1377
1381
|
tool: {
|
|
1378
1382
|
name: tool.name,
|
|
1379
1383
|
input: nextInput
|
|
@@ -143,10 +143,12 @@ function contentMetadata(content) {
|
|
|
143
143
|
return { type: typeof part };
|
|
144
144
|
}
|
|
145
145
|
const record = part;
|
|
146
|
-
const type =
|
|
146
|
+
const type = canonicalContentPartType(
|
|
147
|
+
typeof record.type === "string" ? record.type : "unknown"
|
|
148
|
+
);
|
|
147
149
|
return {
|
|
148
150
|
type,
|
|
149
|
-
...typeof record.text === "string" ? { chars: record.text.length } : {},
|
|
151
|
+
...typeof record.text === "string" ? { chars: record.text.length } : typeof record.thinking === "string" && record.thinking.length > 0 ? { chars: record.thinking.length } : {},
|
|
150
152
|
...typeof record.mimeType === "string" ? { mimeType: record.mimeType } : {},
|
|
151
153
|
...typeof record.mediaType === "string" ? { mediaType: record.mediaType } : {},
|
|
152
154
|
...typeof record.data === "string" ? { dataChars: record.data.length } : {}
|
|
@@ -224,10 +226,14 @@ function summarizeContent(content) {
|
|
|
224
226
|
continue;
|
|
225
227
|
}
|
|
226
228
|
const record = part;
|
|
227
|
-
const type =
|
|
229
|
+
const type = canonicalContentPartType(
|
|
230
|
+
typeof record.type === "string" ? record.type : "unknown"
|
|
231
|
+
);
|
|
228
232
|
partTypes.add(type);
|
|
229
233
|
if (typeof record.text === "string") {
|
|
230
234
|
chars += record.text.length;
|
|
235
|
+
} else if (typeof record.thinking === "string") {
|
|
236
|
+
chars += record.thinking.length;
|
|
231
237
|
} else if (typeof record.data === "string") {
|
|
232
238
|
chars += record.data.length;
|
|
233
239
|
} else {
|
|
@@ -236,6 +242,56 @@ function summarizeContent(content) {
|
|
|
236
242
|
}
|
|
237
243
|
return { chars, partTypes: [...partTypes] };
|
|
238
244
|
}
|
|
245
|
+
function normalizeFinishReason(reason) {
|
|
246
|
+
return reason === "toolUse" ? "tool_use" : reason;
|
|
247
|
+
}
|
|
248
|
+
function canonicalContentPartType(type) {
|
|
249
|
+
if (type === "thinking") return "reasoning";
|
|
250
|
+
if (type === "toolCall") return "tool_call";
|
|
251
|
+
return type;
|
|
252
|
+
}
|
|
253
|
+
function toCanonicalPart(part) {
|
|
254
|
+
if (part.type === "text") {
|
|
255
|
+
return { type: "text", content: part.text };
|
|
256
|
+
}
|
|
257
|
+
if (part.type === "thinking") {
|
|
258
|
+
if (part.redacted) {
|
|
259
|
+
return { type: "reasoning", redacted: true };
|
|
260
|
+
}
|
|
261
|
+
return { type: "reasoning", content: part.thinking };
|
|
262
|
+
}
|
|
263
|
+
if (part.type === "toolCall") {
|
|
264
|
+
return {
|
|
265
|
+
type: "tool_call",
|
|
266
|
+
id: part.id,
|
|
267
|
+
name: part.name,
|
|
268
|
+
arguments: part.arguments
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
return { type: "image", mimeType: part.mimeType };
|
|
272
|
+
}
|
|
273
|
+
function toCanonicalOutputMessage(message) {
|
|
274
|
+
return {
|
|
275
|
+
role: "assistant",
|
|
276
|
+
parts: message.content.map(toCanonicalPart),
|
|
277
|
+
finish_reason: normalizeFinishReason(message.stopReason)
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function toCanonicalInputMessage(message) {
|
|
281
|
+
if (message.role === "user") {
|
|
282
|
+
const parts = typeof message.content === "string" ? [{ type: "text", content: message.content }] : message.content.map(toCanonicalPart);
|
|
283
|
+
return { role: "user", parts };
|
|
284
|
+
}
|
|
285
|
+
if (message.role === "toolResult") {
|
|
286
|
+
return {
|
|
287
|
+
role: "tool",
|
|
288
|
+
id: message.toolCallId,
|
|
289
|
+
name: message.toolName,
|
|
290
|
+
parts: message.content.map(toCanonicalPart)
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
return toCanonicalOutputMessage(message);
|
|
294
|
+
}
|
|
239
295
|
function toGenAiMessagesTraceAttributes(prefix, messages) {
|
|
240
296
|
let contentChars = 0;
|
|
241
297
|
const roles = /* @__PURE__ */ new Set();
|
|
@@ -276,5 +332,7 @@ export {
|
|
|
276
332
|
toGenAiTextMetadata,
|
|
277
333
|
toGenAiPayloadMetadata,
|
|
278
334
|
toGenAiPayloadTraceAttributes,
|
|
335
|
+
toCanonicalOutputMessage,
|
|
336
|
+
toCanonicalInputMessage,
|
|
279
337
|
toGenAiMessagesTraceAttributes
|
|
280
338
|
};
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAgentRunner,
|
|
3
3
|
executeAgentRun
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-7DVIELX3.js";
|
|
5
|
+
import "../chunk-OJP53WIU.js";
|
|
6
|
+
import "../chunk-PFXC67GJ.js";
|
|
7
|
+
import "../chunk-H7KUZAMZ.js";
|
|
8
|
+
import "../chunk-BMQ5DXHV.js";
|
|
9
|
+
import "../chunk-7FS3K243.js";
|
|
10
10
|
import {
|
|
11
11
|
loadAppPluginSet
|
|
12
12
|
} from "../chunk-Y2CM7HXH.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-VY7TVOIK.js";
|
|
14
|
+
import "../chunk-OZJXGX4U.js";
|
|
15
15
|
import "../chunk-G3E7SCME.js";
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-ZATRYQLR.js";
|
|
17
|
+
import "../chunk-NIFONS4W.js";
|
|
18
|
+
import "../chunk-3F54A3YM.js";
|
|
19
|
+
import "../chunk-YYBX2BD5.js";
|
|
20
20
|
import "../chunk-GHGPTPBL.js";
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-YTNPU7I2.js";
|
|
22
|
+
import "../chunk-BTH37NCU.js";
|
|
23
|
+
import "../chunk-S6QKIGRM.js";
|
|
24
24
|
import "../chunk-OB42YVAE.js";
|
|
25
25
|
import "../chunk-3DA7X2U3.js";
|
|
26
26
|
import "../chunk-6APU57E6.js";
|
|
@@ -147,10 +147,10 @@ async function configureLocalChatPlugins(pluginSet) {
|
|
|
147
147
|
databaseModule
|
|
148
148
|
] = await Promise.all([
|
|
149
149
|
import("../plugins-PZMDS7AT.js"),
|
|
150
|
-
import("../agent-hooks-
|
|
151
|
-
import("../catalog-runtime-
|
|
152
|
-
import("../validation-
|
|
153
|
-
import("../db-
|
|
150
|
+
import("../agent-hooks-BYSSWCNW.js"),
|
|
151
|
+
import("../catalog-runtime-NZHMSMYC.js"),
|
|
152
|
+
import("../validation-KYAWETI4.js"),
|
|
153
|
+
import("../db-GCK43OO3.js")
|
|
154
154
|
]);
|
|
155
155
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
156
156
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -211,7 +211,7 @@ function newRunConversationId() {
|
|
|
211
211
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
212
212
|
defaultStateAdapterForLocalChat();
|
|
213
213
|
await configureLocalChatPlugins(pluginSet);
|
|
214
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
214
|
+
const { runLocalAgentTurn } = await import("../runner-XWTFA26U.js");
|
|
215
215
|
const deps = {
|
|
216
216
|
agentRunner: createAgentRunner(executeAgentRun),
|
|
217
217
|
deliverReply: async (reply) => {
|
package/dist/cli/check.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSkillFile
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-YTNPU7I2.js";
|
|
4
4
|
import {
|
|
5
5
|
parseInlinePluginManifest,
|
|
6
6
|
parsePluginManifest
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-BTH37NCU.js";
|
|
8
|
+
import "../chunk-S6QKIGRM.js";
|
|
9
9
|
import "../chunk-OB42YVAE.js";
|
|
10
10
|
import "../chunk-3DA7X2U3.js";
|
|
11
11
|
import "../chunk-6APU57E6.js";
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validatePluginEgressCredentialHooks,
|
|
3
3
|
validatePluginRegistrations
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-MC4ZZE4Q.js";
|
|
5
5
|
import {
|
|
6
6
|
pluginCatalogConfigFromPluginSet,
|
|
7
7
|
pluginCliRegistrationsFromPluginSet,
|
|
@@ -13,22 +13,22 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
setPlugins,
|
|
15
15
|
validatePlugins
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-VY7TVOIK.js";
|
|
17
17
|
import {
|
|
18
18
|
createPluginLogger
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-OZJXGX4U.js";
|
|
20
20
|
import "../chunk-G3E7SCME.js";
|
|
21
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-ZATRYQLR.js";
|
|
22
22
|
import {
|
|
23
23
|
getDb
|
|
24
|
-
} from "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
24
|
+
} from "../chunk-NIFONS4W.js";
|
|
25
|
+
import "../chunk-3F54A3YM.js";
|
|
26
|
+
import "../chunk-YYBX2BD5.js";
|
|
27
27
|
import "../chunk-GHGPTPBL.js";
|
|
28
28
|
import {
|
|
29
29
|
pluginCatalogRuntime
|
|
30
|
-
} from "../chunk-
|
|
31
|
-
import "../chunk-
|
|
30
|
+
} from "../chunk-BTH37NCU.js";
|
|
31
|
+
import "../chunk-S6QKIGRM.js";
|
|
32
32
|
import "../chunk-OB42YVAE.js";
|
|
33
33
|
import "../chunk-3DA7X2U3.js";
|
|
34
34
|
import "../chunk-6APU57E6.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRuntimeDependencySnapshot
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-H7KUZAMZ.js";
|
|
4
4
|
import "../chunk-G3E7SCME.js";
|
|
5
5
|
import {
|
|
6
6
|
disconnectStateAdapter
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-ZATRYQLR.js";
|
|
8
|
+
import "../chunk-3F54A3YM.js";
|
|
9
|
+
import "../chunk-YYBX2BD5.js";
|
|
10
10
|
import {
|
|
11
11
|
pluginCatalogRuntime
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
12
|
+
} from "../chunk-BTH37NCU.js";
|
|
13
|
+
import "../chunk-S6QKIGRM.js";
|
|
14
14
|
import "../chunk-OB42YVAE.js";
|
|
15
15
|
import "../chunk-3DA7X2U3.js";
|
|
16
16
|
import "../chunk-6APU57E6.js";
|