@sentry/junior 0.88.0 → 0.90.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/README.md +16 -5
- package/dist/{agent-hooks-RIJ5TSWP.js → agent-hooks-MXAF7RQL.js} +10 -10
- package/dist/api/people/list.js +8 -8
- package/dist/api/people/profile.js +8 -8
- package/dist/api-reference.d.ts +1 -1
- package/dist/app.js +716 -732
- package/dist/{catalog-runtime-MW7XERSU.js → catalog-runtime-DXE6NXHT.js} +5 -5
- package/dist/chat/agent/index.d.ts +4 -0
- package/dist/chat/agent/prompt.d.ts +78 -0
- package/dist/chat/{respond.d.ts → agent/request.d.ts} +98 -55
- package/dist/chat/agent/resume.d.ts +65 -0
- package/dist/chat/agent/sandbox.d.ts +15 -0
- package/dist/chat/agent/session.d.ts +20 -0
- package/dist/chat/agent/skills.d.ts +26 -0
- package/dist/chat/agent/tools.d.ts +78 -0
- package/dist/chat/agent-dispatch/runner.d.ts +3 -5
- package/dist/chat/app/production.d.ts +3 -1
- package/dist/chat/app/services.d.ts +1 -4
- package/dist/chat/logging.d.ts +2 -0
- package/dist/chat/mcp/tool-manager.d.ts +1 -6
- package/dist/chat/pi/messages.d.ts +18 -2
- package/dist/chat/pi/transcript.d.ts +31 -0
- package/dist/chat/plugins/agent-hooks.d.ts +2 -2
- package/dist/chat/prompt.d.ts +1 -1
- package/dist/chat/runtime/agent-continue-runner.d.ts +5 -5
- package/dist/chat/runtime/agent-run-outcome.d.ts +21 -0
- package/dist/chat/runtime/agent-runner.d.ts +11 -0
- package/dist/chat/runtime/delivered-turn-state.d.ts +2 -2
- package/dist/chat/runtime/generated-artifacts.d.ts +16 -0
- package/dist/chat/runtime/reply-executor.d.ts +2 -2
- package/dist/chat/runtime/slack-resume.d.ts +21 -12
- package/dist/chat/runtime/turn.d.ts +5 -39
- package/dist/chat/services/reply-delivery-plan.d.ts +0 -8
- package/dist/chat/services/turn-failure-response.d.ts +4 -4
- package/dist/chat/services/turn-result.d.ts +4 -7
- package/dist/chat/slack/channel.d.ts +9 -5
- package/dist/chat/slack/client.d.ts +3 -1
- package/dist/chat/slack/context.d.ts +17 -5
- package/dist/chat/slack/id-param.d.ts +25 -0
- package/dist/chat/slack/ids.d.ts +18 -4
- package/dist/chat/slack/outbound.d.ts +16 -0
- package/dist/chat/slack/output.d.ts +3 -3
- package/dist/chat/slack/reply.d.ts +4 -7
- package/dist/chat/slack/timestamp-param.d.ts +25 -0
- package/dist/chat/slack/tools/canvas/context.d.ts +18 -0
- package/dist/chat/slack/tools/canvas/create.d.ts +4 -0
- package/dist/chat/slack/tools/canvas/edit.d.ts +3 -0
- package/dist/chat/slack/tools/canvas/read.d.ts +6 -0
- package/dist/chat/slack/tools/canvas/write.d.ts +3 -0
- package/dist/chat/{tools/slack → slack/tools}/channel-access.d.ts +4 -3
- package/dist/chat/{tools → slack/tools}/channel-capabilities.d.ts +2 -0
- package/dist/chat/slack/tools/channel-list-messages.d.ts +3 -0
- package/dist/chat/{tools/slack → slack/tools}/context.d.ts +5 -4
- package/dist/chat/slack/tools/list/add-items.d.ts +3 -0
- package/dist/chat/{tools/slack/lists.d.ts → slack/tools/list/api.d.ts} +2 -1
- package/dist/chat/slack/tools/list/create.d.ts +3 -0
- package/dist/chat/slack/tools/list/get-items.d.ts +3 -0
- package/dist/chat/slack/tools/list/update-item.d.ts +3 -0
- package/dist/chat/slack/tools/message-add-reaction.d.ts +4 -0
- package/dist/chat/slack/tools/send-message.d.ts +11 -0
- package/dist/chat/{tools/slack → slack/tools}/slack-message-url.d.ts +5 -5
- package/dist/chat/slack/tools/thread-read.d.ts +6 -0
- package/dist/chat/slack/tools/user-lookup.d.ts +2 -0
- package/dist/chat/slack/users.d.ts +2 -1
- package/dist/chat/{services → slack}/vision-context.d.ts +4 -2
- package/dist/chat/state/session-log.d.ts +1 -1
- package/dist/chat/tool-exposure.d.ts +10 -0
- package/dist/chat/tool-support/catalog-tool-call.d.ts +10 -0
- package/dist/chat/{tools/execution → tool-support}/normalize-result.d.ts +4 -1
- package/dist/chat/{tools/agent-tools.d.ts → tool-support/pi-tool-adapter.d.ts} +3 -9
- package/dist/chat/tool-support/schema-summary.d.ts +2 -0
- package/dist/chat/{tools → tool-support}/skill/mcp-tool-summary.d.ts +0 -6
- package/dist/chat/tool-support/structured-result.d.ts +73 -0
- package/dist/chat/tool-support/text-range-result.d.ts +58 -0
- package/dist/chat/tool-support/tool-execution-report.d.ts +7 -0
- package/dist/chat/tool-support/zod-tool.d.ts +27 -0
- package/dist/chat/tools/advisor/tool.d.ts +9 -18
- package/dist/chat/tools/definition.d.ts +56 -9
- package/dist/chat/tools/execute-tool.d.ts +3 -0
- package/dist/chat/tools/index.d.ts +3 -2
- package/dist/chat/tools/resource-events.d.ts +3 -13
- package/dist/chat/tools/runtime/report-progress.d.ts +1 -3
- package/dist/chat/tools/sandbox/bash.d.ts +1 -4
- package/dist/chat/tools/sandbox/edit-file.d.ts +25 -7
- package/dist/chat/tools/sandbox/file-uploads.d.ts +30 -0
- package/dist/chat/tools/sandbox/file-utils.d.ts +10 -1
- package/dist/chat/tools/sandbox/find-files.d.ts +12 -11
- package/dist/chat/tools/sandbox/grep.d.ts +18 -12
- package/dist/chat/tools/sandbox/list-dir.d.ts +15 -7
- package/dist/chat/tools/sandbox/read-file.d.ts +2 -31
- package/dist/chat/tools/sandbox/write-file.d.ts +1 -4
- package/dist/chat/tools/search-tools.d.ts +4 -0
- package/dist/chat/tools/skill/call-mcp-tool.d.ts +1 -4
- package/dist/chat/tools/skill/load-skill.d.ts +4 -5
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +1 -5
- package/dist/chat/tools/system-time.d.ts +1 -1
- package/dist/chat/tools/types.d.ts +15 -5
- package/dist/chat/tools/web/fetch-content.d.ts +4 -2
- package/dist/chat/tools/web/fetch-tool.d.ts +4 -4
- package/dist/chat/tools/web/image-generate.d.ts +4 -3
- package/dist/chat/tools/web/search.d.ts +1 -4
- package/dist/{chunk-4IXHIV37.js → chunk-2S7M37HY.js} +6 -8
- package/dist/{chunk-L7OHKDOX.js → chunk-3MPOMK3K.js} +58 -7
- package/dist/{chunk-V6XDCS3X.js → chunk-5GBUZI6M.js} +4 -4
- package/dist/{chunk-7ES37H6U.js → chunk-AN2437E3.js} +4 -4
- package/dist/chunk-AOISHLSF.js +747 -0
- package/dist/{chunk-NYJLQI42.js → chunk-BKSZL4QO.js} +11257 -11957
- package/dist/{chunk-XS6NLQPA.js → chunk-DACFZ5CI.js} +474 -33
- package/dist/chunk-GCWD2VHP.js +1216 -0
- package/dist/chunk-GHGPTPBL.js +53 -0
- package/dist/{chunk-S35CPNPT.js → chunk-HXL2ZV74.js} +40 -216
- package/dist/{chunk-PBV4ZIVM.js → chunk-IRRMABQD.js} +1 -1
- package/dist/{chunk-2DPZRS3B.js → chunk-IX76WFJV.js} +8 -8
- package/dist/{chunk-66NX7MNW.js → chunk-KC42JAAQ.js} +1 -1
- package/dist/chunk-LFLTJQVR.js +90 -0
- package/dist/{chunk-IATAYWFU.js → chunk-NW7AXDA5.js} +2 -2
- package/dist/{chunk-F22AM3OW.js → chunk-NYWPISSO.js} +1 -1
- package/dist/chunk-OB42YVAE.js +16 -0
- package/dist/chunk-ONFOWI2D.js +955 -0
- package/dist/chunk-PHZHJTCK.js +1062 -0
- package/dist/{chunk-6UPQ5GTJ.js → chunk-QCKGI74V.js} +7 -7
- package/dist/{chunk-YPAE5RH3.js → chunk-RS6ANWVT.js} +1 -1
- package/dist/{chunk-C5NCV3OB.js → chunk-TYUXD3FN.js} +1 -1
- package/dist/{chunk-KBFQXJL4.js → chunk-XP7F4LYB.js} +5 -7
- package/dist/{chunk-VMBZFPZM.js → chunk-ZUK7BL63.js} +187 -9
- package/dist/cli/chat.js +55 -40
- package/dist/cli/check.js +6 -6
- package/dist/cli/init.js +30 -36
- package/dist/cli/plugins.js +16 -16
- package/dist/cli/snapshot-warmup.js +9 -9
- package/dist/cli/upgrade.js +21 -21
- package/dist/db-CXI7PR5U.js +18 -0
- package/dist/handlers/agent-dispatch.d.ts +3 -3
- package/dist/handlers/mcp-oauth-callback.d.ts +3 -3
- package/dist/handlers/oauth-callback.d.ts +3 -3
- package/dist/instrumentation.js +6 -5
- package/dist/nitro.js +3 -7
- package/dist/reporting.js +23 -25
- package/dist/{runner-BCRF2FCI.js → runner-FKL3RAHA.js} +89 -77
- package/dist/{validation-FMJO3L5P.js → validation-I7GD2YWS.js} +6 -6
- package/package.json +6 -6
- package/dist/chat/respond-helpers.d.ts +0 -82
- package/dist/chat/services/attachment-claims.d.ts +0 -2
- package/dist/chat/services/channel-intent.d.ts +0 -2
- package/dist/chat/tools/sandbox/attach-file.d.ts +0 -7
- package/dist/chat/tools/slack/canvas-tools.d.ts +0 -30
- package/dist/chat/tools/slack/channel-list-messages.d.ts +0 -9
- package/dist/chat/tools/slack/channel-post-message.d.ts +0 -5
- package/dist/chat/tools/slack/list-tools.d.ts +0 -21
- package/dist/chat/tools/slack/message-add-reaction.d.ts +0 -5
- package/dist/chat/tools/slack/thread-read.d.ts +0 -12
- package/dist/chat/tools/slack/user-lookup.d.ts +0 -8
- package/dist/chunk-AHLSXMOU.js +0 -506
- package/dist/chunk-FTMXFBDC.js +0 -49
- package/dist/chunk-KBSLCOGE.js +0 -2226
- package/dist/chunk-KQKIA4CU.js +0 -186
- package/dist/db-37HOGLI7.js +0 -18
- /package/dist/chat/{tools/slack/canvases.d.ts → slack/tools/canvas/api.d.ts} +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getStateAdapter
|
|
3
|
-
} from "./chunk-YPAE5RH3.js";
|
|
4
1
|
import {
|
|
5
2
|
normalizeSlackConversationId
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DACFZ5CI.js";
|
|
4
|
+
import {
|
|
5
|
+
getStateAdapter
|
|
6
|
+
} from "./chunk-RS6ANWVT.js";
|
|
7
7
|
import {
|
|
8
8
|
parseSlackThreadId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3MPOMK3K.js";
|
|
10
10
|
import {
|
|
11
11
|
parseStoredSlackRequester
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZUK7BL63.js";
|
|
13
13
|
import {
|
|
14
14
|
isRecord,
|
|
15
15
|
toOptionalNumber
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-OB42YVAE.js";
|
|
17
17
|
import {
|
|
18
18
|
getClient
|
|
19
19
|
} from "./chunk-3DA7X2U3.js";
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
logInfo,
|
|
3
|
+
logWarn,
|
|
4
|
+
parseActorUserId,
|
|
5
|
+
setSpanAttributes
|
|
6
|
+
} from "./chunk-ZUK7BL63.js";
|
|
4
7
|
import {
|
|
5
8
|
discoverInstalledPluginPackageContent,
|
|
6
9
|
normalizePluginPackageNames,
|
|
7
10
|
pluginRoots
|
|
8
11
|
} from "./chunk-6APU57E6.js";
|
|
9
|
-
import {
|
|
10
|
-
logInfo,
|
|
11
|
-
logWarn,
|
|
12
|
-
setSpanAttributes
|
|
13
|
-
} from "./chunk-VMBZFPZM.js";
|
|
14
12
|
|
|
15
13
|
// src/chat/plugins/registry.ts
|
|
16
14
|
import { readFileSync, readdirSync, statSync } from "fs";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getDeploymentTelemetryAttributes,
|
|
3
2
|
toOptionalNumber,
|
|
4
3
|
toOptionalString
|
|
5
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OB42YVAE.js";
|
|
6
5
|
import {
|
|
7
6
|
captureException,
|
|
8
7
|
sentry_exports,
|
|
@@ -11,6 +10,10 @@ import {
|
|
|
11
10
|
startSpan,
|
|
12
11
|
withScope
|
|
13
12
|
} from "./chunk-3DA7X2U3.js";
|
|
13
|
+
import {
|
|
14
|
+
getDeploymentTelemetryAttributes,
|
|
15
|
+
parseSlackTeamId
|
|
16
|
+
} from "./chunk-LFLTJQVR.js";
|
|
14
17
|
|
|
15
18
|
// src/chat/logging.ts
|
|
16
19
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -68,6 +71,13 @@ var LEGACY_KEY_MAP = {
|
|
|
68
71
|
function normalizeGenAiFinishReason(reason) {
|
|
69
72
|
return reason === "toolUse" ? "tool_use" : reason;
|
|
70
73
|
}
|
|
74
|
+
function summarizeMessageText(text) {
|
|
75
|
+
const normalized = text.trim().replace(/\s+/g, " ");
|
|
76
|
+
if (!normalized) {
|
|
77
|
+
return "[empty]";
|
|
78
|
+
}
|
|
79
|
+
return normalized.length > 1200 ? `${normalized.slice(0, 1200)}...` : normalized;
|
|
80
|
+
}
|
|
71
81
|
function normalizeGenAiFinishReasons(value) {
|
|
72
82
|
if (typeof value === "string" && value.trim()) {
|
|
73
83
|
return [normalizeGenAiFinishReason(value)];
|
|
@@ -1344,17 +1354,178 @@ function extractGenAiUsageAttributes(...sources) {
|
|
|
1344
1354
|
};
|
|
1345
1355
|
}
|
|
1346
1356
|
|
|
1347
|
-
// src/chat/
|
|
1348
|
-
|
|
1349
|
-
|
|
1357
|
+
// src/chat/requester.ts
|
|
1358
|
+
import { z } from "zod";
|
|
1359
|
+
import { requesterSchema } from "@sentry/junior-plugin-api";
|
|
1360
|
+
var SLACK_USER_ID_DISPLAY_PATTERN = /^[UW][A-Z0-9]{5,}$/;
|
|
1361
|
+
var EMAIL_PATTERN = /^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;
|
|
1362
|
+
var exactStoredStringSchema = z.string().min(1).refine((value) => value === value.trim());
|
|
1363
|
+
var storedSlackRequesterSchema = z.object({
|
|
1364
|
+
email: exactStoredStringSchema.optional(),
|
|
1365
|
+
fullName: exactStoredStringSchema.optional(),
|
|
1366
|
+
platform: z.literal("slack").optional(),
|
|
1367
|
+
slackUserId: exactStoredStringSchema.optional(),
|
|
1368
|
+
slackUserName: exactStoredStringSchema.optional(),
|
|
1369
|
+
teamId: exactStoredStringSchema.optional()
|
|
1370
|
+
}).strict();
|
|
1371
|
+
function parseRequester(value) {
|
|
1372
|
+
const result = requesterSchema.safeParse(value);
|
|
1373
|
+
return result.success ? result.data : void 0;
|
|
1374
|
+
}
|
|
1375
|
+
function clean(value) {
|
|
1376
|
+
const trimmed = value?.trim();
|
|
1377
|
+
return trimmed ? trimmed : void 0;
|
|
1378
|
+
}
|
|
1379
|
+
function isSyntheticActorUserId(value) {
|
|
1380
|
+
return value.toLowerCase() === "unknown";
|
|
1381
|
+
}
|
|
1382
|
+
function isSlackUserId(value) {
|
|
1383
|
+
return SLACK_USER_ID_DISPLAY_PATTERN.test(value);
|
|
1384
|
+
}
|
|
1385
|
+
function cleanRequesterDisplayName(value, userId) {
|
|
1386
|
+
const displayName = clean(value);
|
|
1387
|
+
if (!displayName) {
|
|
1388
|
+
return void 0;
|
|
1389
|
+
}
|
|
1390
|
+
if (displayName.toLowerCase() === "unknown") {
|
|
1391
|
+
return void 0;
|
|
1392
|
+
}
|
|
1393
|
+
if (userId && displayName === userId) {
|
|
1394
|
+
return void 0;
|
|
1395
|
+
}
|
|
1396
|
+
return isSlackUserId(displayName) ? void 0 : displayName;
|
|
1397
|
+
}
|
|
1398
|
+
function cleanRequesterEmail(value) {
|
|
1399
|
+
const email = clean(value);
|
|
1400
|
+
return email && EMAIL_PATTERN.test(email) ? email : void 0;
|
|
1401
|
+
}
|
|
1402
|
+
function parseActorUserId(value) {
|
|
1403
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
1404
|
+
return void 0;
|
|
1405
|
+
}
|
|
1406
|
+
if (value !== value.trim() || isSyntheticActorUserId(value)) {
|
|
1407
|
+
return void 0;
|
|
1408
|
+
}
|
|
1409
|
+
return value;
|
|
1350
1410
|
}
|
|
1351
|
-
function
|
|
1352
|
-
return
|
|
1411
|
+
function isActorUserId(value) {
|
|
1412
|
+
return parseActorUserId(value) === value;
|
|
1413
|
+
}
|
|
1414
|
+
function createRequester(input, context) {
|
|
1415
|
+
const platform = context.platform ?? input?.platform;
|
|
1416
|
+
if (!platform) {
|
|
1417
|
+
return void 0;
|
|
1418
|
+
}
|
|
1419
|
+
const contextUserId = parseActorUserId(context.userId);
|
|
1420
|
+
if (context.userId !== void 0 && !contextUserId) {
|
|
1421
|
+
return void 0;
|
|
1422
|
+
}
|
|
1423
|
+
const inputUserId = parseActorUserId(input?.userId);
|
|
1424
|
+
if (input?.userId !== void 0 && !inputUserId) {
|
|
1425
|
+
return void 0;
|
|
1426
|
+
}
|
|
1427
|
+
const requesterUserId = contextUserId ?? inputUserId;
|
|
1428
|
+
if (!requesterUserId) {
|
|
1429
|
+
return void 0;
|
|
1430
|
+
}
|
|
1431
|
+
const contextTeamId = parseSlackTeamId(context.teamId);
|
|
1432
|
+
if (context.teamId !== void 0 && !contextTeamId) {
|
|
1433
|
+
return void 0;
|
|
1434
|
+
}
|
|
1435
|
+
const inputTeamId = parseSlackTeamId(input?.teamId);
|
|
1436
|
+
if (input?.teamId !== void 0 && !inputTeamId) {
|
|
1437
|
+
return void 0;
|
|
1438
|
+
}
|
|
1439
|
+
const requesterTeamId = contextTeamId ?? inputTeamId;
|
|
1440
|
+
if (platform === "slack" && !requesterTeamId) {
|
|
1441
|
+
return void 0;
|
|
1442
|
+
}
|
|
1443
|
+
const canUseInputProfile = (!contextUserId || !inputUserId || contextUserId === inputUserId) && (platform !== "slack" || !contextTeamId || !inputTeamId || contextTeamId === inputTeamId);
|
|
1444
|
+
const requester = {
|
|
1445
|
+
...canUseInputProfile && cleanRequesterEmail(input?.email) ? { email: cleanRequesterEmail(input?.email) } : {},
|
|
1446
|
+
...canUseInputProfile && cleanRequesterDisplayName(input?.fullName, requesterUserId) ? {
|
|
1447
|
+
fullName: cleanRequesterDisplayName(input?.fullName, requesterUserId)
|
|
1448
|
+
} : {},
|
|
1449
|
+
platform,
|
|
1450
|
+
userId: requesterUserId,
|
|
1451
|
+
...canUseInputProfile && cleanRequesterDisplayName(input?.userName, requesterUserId) ? {
|
|
1452
|
+
userName: cleanRequesterDisplayName(input?.userName, requesterUserId)
|
|
1453
|
+
} : {}
|
|
1454
|
+
};
|
|
1455
|
+
if (platform === "slack") {
|
|
1456
|
+
return { ...requester, platform, teamId: requesterTeamId };
|
|
1457
|
+
}
|
|
1458
|
+
return { ...requester, platform };
|
|
1459
|
+
}
|
|
1460
|
+
function createSlackRequester(teamId, userId, profile) {
|
|
1461
|
+
const actorUserId = parseActorUserId(userId);
|
|
1462
|
+
const actorTeamId = parseSlackTeamId(teamId);
|
|
1463
|
+
if (!actorTeamId || !actorUserId) {
|
|
1464
|
+
throw new Error("Slack requester requires team and user ids");
|
|
1465
|
+
}
|
|
1466
|
+
const requester = createRequester(
|
|
1467
|
+
{
|
|
1468
|
+
email: profile?.email,
|
|
1469
|
+
fullName: profile?.fullName,
|
|
1470
|
+
platform: "slack",
|
|
1471
|
+
teamId: actorTeamId,
|
|
1472
|
+
userId: actorUserId,
|
|
1473
|
+
userName: profile?.userName
|
|
1474
|
+
},
|
|
1475
|
+
{ teamId: actorTeamId, userId: actorUserId }
|
|
1476
|
+
);
|
|
1477
|
+
if (!requester || requester.platform !== "slack") {
|
|
1478
|
+
throw new Error("Slack requester requires team and user ids");
|
|
1479
|
+
}
|
|
1480
|
+
return requester;
|
|
1481
|
+
}
|
|
1482
|
+
function parseStoredSlackRequester(value) {
|
|
1483
|
+
const parsed = storedSlackRequesterSchema.safeParse(value);
|
|
1484
|
+
if (!parsed.success) {
|
|
1485
|
+
return void 0;
|
|
1486
|
+
}
|
|
1487
|
+
if (parsed.data.slackUserId !== void 0 && !parseActorUserId(parsed.data.slackUserId)) {
|
|
1488
|
+
return void 0;
|
|
1489
|
+
}
|
|
1490
|
+
if (parsed.data.teamId !== void 0 && !parseSlackTeamId(parsed.data.teamId)) {
|
|
1491
|
+
return void 0;
|
|
1492
|
+
}
|
|
1493
|
+
if ((parsed.data.platform !== void 0 || parsed.data.teamId !== void 0) && (!parsed.data.platform || !parsed.data.teamId)) {
|
|
1494
|
+
return void 0;
|
|
1495
|
+
}
|
|
1496
|
+
return parsed.data;
|
|
1497
|
+
}
|
|
1498
|
+
function toStoredSlackRequester(requester) {
|
|
1499
|
+
return {
|
|
1500
|
+
...requester.email ? { email: requester.email } : {},
|
|
1501
|
+
...requester.fullName ? { fullName: requester.fullName } : {},
|
|
1502
|
+
platform: requester.platform,
|
|
1503
|
+
slackUserId: requester.userId,
|
|
1504
|
+
...requester.userName ? { slackUserName: requester.userName } : {},
|
|
1505
|
+
teamId: requester.teamId
|
|
1506
|
+
};
|
|
1507
|
+
}
|
|
1508
|
+
function createSlackResumeRequester(args) {
|
|
1509
|
+
if (args.requester) {
|
|
1510
|
+
if (args.requester.platform !== "slack" || args.requester.teamId !== args.teamId || args.requester.userId !== args.userId) {
|
|
1511
|
+
throw new Error("Stored Slack requester did not match resume actor");
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
const requester = createRequester(args.requester, {
|
|
1515
|
+
platform: "slack",
|
|
1516
|
+
teamId: args.teamId,
|
|
1517
|
+
userId: args.userId
|
|
1518
|
+
});
|
|
1519
|
+
if (!requester || requester.platform !== "slack") {
|
|
1520
|
+
throw new Error("Slack requester requires team and user ids");
|
|
1521
|
+
}
|
|
1522
|
+
return requester;
|
|
1353
1523
|
}
|
|
1354
1524
|
|
|
1355
1525
|
export {
|
|
1356
1526
|
normalizeIdentityEmail,
|
|
1357
1527
|
normalizeGenAiFinishReason,
|
|
1528
|
+
summarizeMessageText,
|
|
1358
1529
|
createChatSdkLogger,
|
|
1359
1530
|
getLogContextAttributes,
|
|
1360
1531
|
setSentryUser,
|
|
@@ -1374,6 +1545,13 @@ export {
|
|
|
1374
1545
|
serializeGenAiAttribute,
|
|
1375
1546
|
extractGenAiUsageSummary,
|
|
1376
1547
|
extractGenAiUsageAttributes,
|
|
1377
|
-
|
|
1378
|
-
|
|
1548
|
+
storedSlackRequesterSchema,
|
|
1549
|
+
parseRequester,
|
|
1550
|
+
parseActorUserId,
|
|
1551
|
+
isActorUserId,
|
|
1552
|
+
createRequester,
|
|
1553
|
+
createSlackRequester,
|
|
1554
|
+
parseStoredSlackRequester,
|
|
1555
|
+
toStoredSlackRequester,
|
|
1556
|
+
createSlackResumeRequester
|
|
1379
1557
|
};
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createAgentRunner,
|
|
3
|
+
executeAgentRun
|
|
4
|
+
} from "../chunk-BKSZL4QO.js";
|
|
5
|
+
import "../chunk-ONFOWI2D.js";
|
|
6
|
+
import "../chunk-KC42JAAQ.js";
|
|
7
|
+
import "../chunk-5GBUZI6M.js";
|
|
8
|
+
import "../chunk-PHZHJTCK.js";
|
|
9
|
+
import "../chunk-GCWD2VHP.js";
|
|
1
10
|
import {
|
|
2
11
|
loadAppPluginSet
|
|
3
12
|
} from "../chunk-Y2CM7HXH.js";
|
|
13
|
+
import "../chunk-DACFZ5CI.js";
|
|
14
|
+
import "../chunk-NW7AXDA5.js";
|
|
15
|
+
import "../chunk-G3E7SCME.js";
|
|
16
|
+
import "../chunk-RS6ANWVT.js";
|
|
17
|
+
import "../chunk-2S7M37HY.js";
|
|
18
|
+
import "../chunk-HXL2ZV74.js";
|
|
19
|
+
import "../chunk-3MPOMK3K.js";
|
|
20
|
+
import "../chunk-GHGPTPBL.js";
|
|
21
|
+
import "../chunk-AN2437E3.js";
|
|
22
|
+
import "../chunk-XP7F4LYB.js";
|
|
23
|
+
import "../chunk-ZUK7BL63.js";
|
|
24
|
+
import "../chunk-OB42YVAE.js";
|
|
25
|
+
import "../chunk-3DA7X2U3.js";
|
|
26
|
+
import "../chunk-6APU57E6.js";
|
|
27
|
+
import "../chunk-LFLTJQVR.js";
|
|
4
28
|
import "../chunk-MLKGABMK.js";
|
|
5
29
|
|
|
6
30
|
// src/cli/chat.ts
|
|
@@ -56,13 +80,6 @@ function errorMessage(error) {
|
|
|
56
80
|
}
|
|
57
81
|
async function deliverReply(io, reply) {
|
|
58
82
|
try {
|
|
59
|
-
const files = reply.files ?? [];
|
|
60
|
-
if (files.length > 0) {
|
|
61
|
-
const names = files.map(
|
|
62
|
-
(file) => typeof file.filename === "string" && file.filename.trim() ? file.filename : "generated file"
|
|
63
|
-
).join(", ");
|
|
64
|
-
throw new Error(`Local chat cannot deliver files yet: ${names}`);
|
|
65
|
-
}
|
|
66
83
|
await io.write(formatReply(reply));
|
|
67
84
|
} catch (error) {
|
|
68
85
|
throw new ChatOutputError(error);
|
|
@@ -130,10 +147,10 @@ async function configureLocalChatPlugins(pluginSet) {
|
|
|
130
147
|
databaseModule
|
|
131
148
|
] = await Promise.all([
|
|
132
149
|
import("../plugins-PZMDS7AT.js"),
|
|
133
|
-
import("../agent-hooks-
|
|
134
|
-
import("../catalog-runtime-
|
|
135
|
-
import("../validation-
|
|
136
|
-
import("../db-
|
|
150
|
+
import("../agent-hooks-MXAF7RQL.js"),
|
|
151
|
+
import("../catalog-runtime-DXE6NXHT.js"),
|
|
152
|
+
import("../validation-I7GD2YWS.js"),
|
|
153
|
+
import("../db-CXI7PR5U.js")
|
|
137
154
|
]);
|
|
138
155
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
139
156
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -191,35 +208,43 @@ function newRunConversationId() {
|
|
|
191
208
|
}
|
|
192
209
|
return conversationId;
|
|
193
210
|
}
|
|
194
|
-
async function
|
|
211
|
+
async function prepareLocalChatRun(io, pluginSet) {
|
|
195
212
|
defaultStateAdapterForLocalChat();
|
|
196
213
|
await configureLocalChatPlugins(pluginSet);
|
|
197
|
-
const
|
|
198
|
-
const
|
|
214
|
+
const { runLocalAgentTurn } = await import("../runner-FKL3RAHA.js");
|
|
215
|
+
const deps = {
|
|
216
|
+
agentRunner: createAgentRunner(executeAgentRun),
|
|
217
|
+
deliverReply: async (reply) => {
|
|
218
|
+
await deliverReply(io, reply);
|
|
219
|
+
},
|
|
220
|
+
onStatus: async (status) => {
|
|
221
|
+
await reportStatus(io, status);
|
|
222
|
+
},
|
|
223
|
+
onToolResult: async (result) => {
|
|
224
|
+
await reportToolResult(io, result);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
return { conversationId: newRunConversationId(), runLocalAgentTurn, deps };
|
|
228
|
+
}
|
|
229
|
+
async function runPrompt(options, io, pluginSet) {
|
|
230
|
+
const { conversationId, runLocalAgentTurn, deps } = await prepareLocalChatRun(
|
|
231
|
+
io,
|
|
232
|
+
pluginSet
|
|
233
|
+
);
|
|
199
234
|
const result = await runLocalAgentTurn(
|
|
200
235
|
{
|
|
201
236
|
conversationId,
|
|
202
237
|
message: options.message
|
|
203
238
|
},
|
|
204
|
-
|
|
205
|
-
deliverReply: async (reply) => {
|
|
206
|
-
await deliverReply(io, reply);
|
|
207
|
-
},
|
|
208
|
-
onStatus: async (status) => {
|
|
209
|
-
await reportStatus(io, status);
|
|
210
|
-
},
|
|
211
|
-
onToolResult: async (result2) => {
|
|
212
|
-
await reportToolResult(io, result2);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
239
|
+
deps
|
|
215
240
|
);
|
|
216
241
|
return result.outcome === "success" ? 0 : 1;
|
|
217
242
|
}
|
|
218
243
|
async function runInteractive(io, pluginSet) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
244
|
+
const { conversationId, runLocalAgentTurn, deps } = await prepareLocalChatRun(
|
|
245
|
+
io,
|
|
246
|
+
pluginSet
|
|
247
|
+
);
|
|
223
248
|
const rl = readline.createInterface({
|
|
224
249
|
input: io.input,
|
|
225
250
|
output: io.output,
|
|
@@ -240,17 +265,7 @@ async function runInteractive(io, pluginSet) {
|
|
|
240
265
|
conversationId,
|
|
241
266
|
message
|
|
242
267
|
},
|
|
243
|
-
|
|
244
|
-
deliverReply: async (reply) => {
|
|
245
|
-
await deliverReply(io, reply);
|
|
246
|
-
},
|
|
247
|
-
onStatus: async (status) => {
|
|
248
|
-
await reportStatus(io, status);
|
|
249
|
-
},
|
|
250
|
-
onToolResult: async (result) => {
|
|
251
|
-
await reportToolResult(io, result);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
268
|
+
deps
|
|
254
269
|
);
|
|
255
270
|
} catch (error) {
|
|
256
271
|
if (error instanceof ChatOutputError) {
|
package/dist/cli/check.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSkillFile
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-AN2437E3.js";
|
|
4
4
|
import {
|
|
5
5
|
parseInlinePluginManifest,
|
|
6
6
|
parsePluginManifest
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-XP7F4LYB.js";
|
|
8
|
+
import "../chunk-ZUK7BL63.js";
|
|
9
|
+
import "../chunk-OB42YVAE.js";
|
|
10
|
+
import "../chunk-3DA7X2U3.js";
|
|
9
11
|
import "../chunk-6APU57E6.js";
|
|
10
|
-
import "../chunk-VMBZFPZM.js";
|
|
11
12
|
import {
|
|
12
13
|
JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
13
14
|
JUNIOR_HEARTBEAT_ROUTE,
|
|
14
15
|
LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import "../chunk-3DA7X2U3.js";
|
|
16
|
+
} from "../chunk-LFLTJQVR.js";
|
|
17
17
|
import "../chunk-MLKGABMK.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/check.ts
|
package/dist/cli/init.js
CHANGED
|
@@ -9,28 +9,20 @@ import path from "path";
|
|
|
9
9
|
function writeServerEntry(targetDir) {
|
|
10
10
|
fs.writeFileSync(
|
|
11
11
|
path.join(targetDir, "server.ts"),
|
|
12
|
-
`import {
|
|
13
|
-
initSentry
|
|
12
|
+
`import { createApp } from "@sentry/junior";
|
|
13
|
+
import { initSentry } from "@sentry/junior/instrumentation";
|
|
14
|
+
import { plugins } from "./plugins.ts";
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
initSentry();
|
|
16
17
|
|
|
17
|
-
const app = await createApp(
|
|
18
|
+
const app = await createApp({
|
|
19
|
+
plugins,
|
|
20
|
+
});
|
|
18
21
|
|
|
19
22
|
export default app;
|
|
20
23
|
`
|
|
21
24
|
);
|
|
22
25
|
}
|
|
23
|
-
function writeQueueConsumerEntry(targetDir) {
|
|
24
|
-
const queueConsumerDir = path.join(targetDir, "api", "internal", "agent");
|
|
25
|
-
fs.mkdirSync(queueConsumerDir, { recursive: true });
|
|
26
|
-
fs.writeFileSync(
|
|
27
|
-
path.join(queueConsumerDir, "continue.ts"),
|
|
28
|
-
`import app from "../../../server.ts";
|
|
29
|
-
|
|
30
|
-
export const POST = (request: Request) => app.fetch(request);
|
|
31
|
-
`
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
26
|
function writePluginsFile(targetDir) {
|
|
35
27
|
fs.writeFileSync(
|
|
36
28
|
path.join(targetDir, "plugins.ts"),
|
|
@@ -64,18 +56,17 @@ export default defineConfig({
|
|
|
64
56
|
`
|
|
65
57
|
);
|
|
66
58
|
}
|
|
67
|
-
function
|
|
59
|
+
function writeTsConfig(targetDir) {
|
|
68
60
|
fs.writeFileSync(
|
|
69
|
-
path.join(targetDir, "
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
61
|
+
path.join(targetDir, "tsconfig.json"),
|
|
62
|
+
`${JSON.stringify(
|
|
63
|
+
{
|
|
64
|
+
extends: "nitro/tsconfig",
|
|
65
|
+
compilerOptions: {}
|
|
66
|
+
},
|
|
67
|
+
null,
|
|
68
|
+
2
|
|
69
|
+
)}
|
|
79
70
|
`
|
|
80
71
|
);
|
|
81
72
|
}
|
|
@@ -110,7 +101,7 @@ jobs:
|
|
|
110
101
|
with:
|
|
111
102
|
node-version: 24
|
|
112
103
|
cache: pnpm
|
|
113
|
-
- run: pnpm install
|
|
104
|
+
- run: pnpm install
|
|
114
105
|
- run: pnpm check
|
|
115
106
|
- run: pnpm build
|
|
116
107
|
`
|
|
@@ -140,21 +131,23 @@ async function runInit(dir, log = console.log) {
|
|
|
140
131
|
private: true,
|
|
141
132
|
type: "module",
|
|
142
133
|
scripts: {
|
|
143
|
-
dev: "
|
|
134
|
+
dev: "nitro dev",
|
|
144
135
|
check: "junior check",
|
|
145
|
-
build: "junior snapshot create &&
|
|
136
|
+
build: "junior snapshot create && nitro build",
|
|
137
|
+
preview: "nitro preview",
|
|
138
|
+
typecheck: "tsc --noEmit"
|
|
146
139
|
},
|
|
147
140
|
dependencies: {
|
|
148
141
|
"@sentry/junior": "latest",
|
|
149
142
|
"@sentry/junior-memory": "latest",
|
|
150
143
|
"@sentry/junior-maintenance": "latest",
|
|
151
|
-
hono: "^4.12.
|
|
144
|
+
hono: "^4.12.22"
|
|
152
145
|
},
|
|
153
146
|
devDependencies: {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
147
|
+
"@types/node": "^25.9.1",
|
|
148
|
+
jiti: "^2.7.0",
|
|
149
|
+
nitro: "3.0.260522-beta",
|
|
150
|
+
typescript: "^6.0.3"
|
|
158
151
|
}
|
|
159
152
|
};
|
|
160
153
|
fs.writeFileSync(
|
|
@@ -213,6 +206,8 @@ AI_EMBEDDING_MODEL=
|
|
|
213
206
|
MEMORY_RECALL_MAX_VECTOR_DISTANCE=
|
|
214
207
|
AI_VISION_MODEL=
|
|
215
208
|
AI_WEB_SEARCH_MODEL=
|
|
209
|
+
DATABASE_URL=
|
|
210
|
+
JUNIOR_DATABASE_DRIVER=
|
|
216
211
|
REDIS_URL=
|
|
217
212
|
CRON_SECRET=
|
|
218
213
|
SENTRY_DSN=
|
|
@@ -220,10 +215,9 @@ SENTRY_ORG_SLUG=
|
|
|
220
215
|
`
|
|
221
216
|
);
|
|
222
217
|
writeServerEntry(target);
|
|
223
|
-
writeQueueConsumerEntry(target);
|
|
224
218
|
writePluginsFile(target);
|
|
225
219
|
writeNitroConfig(target);
|
|
226
|
-
|
|
220
|
+
writeTsConfig(target);
|
|
227
221
|
writeVercelJson(target);
|
|
228
222
|
writeGitHubWorkflow(target);
|
|
229
223
|
log(`Created ${name} at ${target}`);
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validatePluginEgressCredentialHooks,
|
|
3
3
|
validatePluginRegistrations
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-TYUXD3FN.js";
|
|
5
5
|
import {
|
|
6
6
|
pluginCatalogConfigFromPluginSet,
|
|
7
7
|
pluginCliRegistrationsFromPluginSet,
|
|
8
8
|
pluginRuntimeRegistrationsFromPluginSet
|
|
9
9
|
} from "../chunk-SG5WAA7H.js";
|
|
10
|
+
import {
|
|
11
|
+
loadAppPluginSet
|
|
12
|
+
} from "../chunk-Y2CM7HXH.js";
|
|
10
13
|
import {
|
|
11
14
|
setPlugins,
|
|
12
15
|
validatePlugins
|
|
13
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-DACFZ5CI.js";
|
|
14
17
|
import {
|
|
15
18
|
createPluginLogger
|
|
16
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-NW7AXDA5.js";
|
|
17
20
|
import "../chunk-G3E7SCME.js";
|
|
18
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-RS6ANWVT.js";
|
|
19
22
|
import {
|
|
20
23
|
getDb
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import {
|
|
26
|
-
loadAppPluginSet
|
|
27
|
-
} from "../chunk-Y2CM7HXH.js";
|
|
24
|
+
} from "../chunk-2S7M37HY.js";
|
|
25
|
+
import "../chunk-HXL2ZV74.js";
|
|
26
|
+
import "../chunk-3MPOMK3K.js";
|
|
27
|
+
import "../chunk-GHGPTPBL.js";
|
|
28
28
|
import {
|
|
29
29
|
pluginCatalogRuntime
|
|
30
|
-
} from "../chunk-
|
|
31
|
-
import "../chunk-
|
|
32
|
-
import "../chunk-
|
|
33
|
-
import "../chunk-VMBZFPZM.js";
|
|
34
|
-
import "../chunk-FTMXFBDC.js";
|
|
30
|
+
} from "../chunk-XP7F4LYB.js";
|
|
31
|
+
import "../chunk-ZUK7BL63.js";
|
|
32
|
+
import "../chunk-OB42YVAE.js";
|
|
35
33
|
import "../chunk-3DA7X2U3.js";
|
|
34
|
+
import "../chunk-6APU57E6.js";
|
|
35
|
+
import "../chunk-LFLTJQVR.js";
|
|
36
36
|
import "../chunk-MLKGABMK.js";
|
|
37
37
|
|
|
38
38
|
// src/cli/plugins.ts
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRuntimeDependencySnapshot
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-5GBUZI6M.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-RS6ANWVT.js";
|
|
8
|
+
import "../chunk-HXL2ZV74.js";
|
|
9
|
+
import "../chunk-3MPOMK3K.js";
|
|
10
10
|
import {
|
|
11
11
|
pluginCatalogRuntime
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-VMBZFPZM.js";
|
|
16
|
-
import "../chunk-FTMXFBDC.js";
|
|
12
|
+
} from "../chunk-XP7F4LYB.js";
|
|
13
|
+
import "../chunk-ZUK7BL63.js";
|
|
14
|
+
import "../chunk-OB42YVAE.js";
|
|
17
15
|
import "../chunk-3DA7X2U3.js";
|
|
16
|
+
import "../chunk-6APU57E6.js";
|
|
17
|
+
import "../chunk-LFLTJQVR.js";
|
|
18
18
|
import "../chunk-MLKGABMK.js";
|
|
19
19
|
|
|
20
20
|
// src/cli/snapshot-warmup.ts
|