@sentry/junior 0.74.0 → 0.75.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-2HEB4C3Q.js +33 -0
- package/dist/api-reference.d.ts +1 -1
- package/dist/app.js +5211 -5316
- package/dist/build/copy-build-content.d.ts +1 -1
- package/dist/chat/agent-dispatch/context.d.ts +2 -3
- package/dist/chat/agent-dispatch/types.d.ts +2 -1
- package/dist/chat/config.d.ts +2 -0
- package/dist/chat/conversations/configured.d.ts +2 -0
- package/dist/chat/credentials/subject.d.ts +3 -3
- package/dist/chat/plugins/agent-hooks.d.ts +13 -13
- package/dist/chat/plugins/credential-hooks.d.ts +6 -6
- package/dist/chat/plugins/db.d.ts +31 -0
- package/dist/chat/plugins/logging.d.ts +2 -2
- package/dist/chat/plugins/package-discovery.d.ts +2 -1
- package/dist/chat/plugins/registry.d.ts +4 -0
- package/dist/chat/plugins/state.d.ts +3 -5
- package/dist/chat/plugins/types.d.ts +1 -0
- package/dist/chat/plugins/validation.d.ts +5 -0
- package/dist/chat/prompt.d.ts +11 -1
- package/dist/chat/respond.d.ts +10 -1
- package/dist/chat/runtime/slack-runtime.d.ts +6 -1
- package/dist/chat/sandbox/egress-credentials.d.ts +8 -8
- package/dist/chat/sandbox/sandbox.d.ts +2 -2
- package/dist/chat/sql/db.d.ts +3 -0
- package/dist/chat/sql/executor.d.ts +7 -0
- package/dist/chat/sql/neon.d.ts +2 -4
- package/dist/chat/sql/postgres.d.ts +6 -0
- package/dist/chat/task-execution/state.d.ts +7 -2
- package/dist/chat/task-execution/worker.d.ts +1 -1
- package/dist/chat/tools/agent-tools.d.ts +2 -2
- package/dist/chat/tools/types.d.ts +3 -0
- package/dist/{chunk-7Q5YOUUT.js → chunk-2RWFUS5F.js} +47 -10
- package/dist/{chunk-YRDS7VKO.js → chunk-62FUNJYS.js} +3 -54
- package/dist/{chunk-M4FLLXXD.js → chunk-74HO27II.js} +1 -1
- package/dist/chunk-BNJIEFQC.js +115 -0
- package/dist/{chunk-YOHFWWBV.js → chunk-C3AM4Z4J.js} +1 -103
- package/dist/chunk-D7NFH5GD.js +570 -0
- package/dist/chunk-EE6PJWY4.js +130 -0
- package/dist/{chunk-CYUI7JU5.js → chunk-EIYL7I4S.js} +1 -1
- package/dist/{chunk-GM7HTXYC.js → chunk-FCZO7LAR.js} +13 -2
- package/dist/{chunk-2LUZA3LY.js → chunk-JEELK46E.js} +5 -5
- package/dist/chunk-MCMROINU.js +12 -0
- package/dist/chunk-NPVUAXUE.js +694 -0
- package/dist/{chunk-OR6NQJ5E.js → chunk-OJODNL2P.js} +3 -3
- package/dist/{chunk-3BYAPS6B.js → chunk-OK4KKR7B.js} +1 -11
- package/dist/chunk-OZSPLAQ4.js +71 -0
- package/dist/{chunk-KVZL5NZS.js → chunk-Q3XNY442.js} +17 -7
- package/dist/{chunk-SQGMG7OD.js → chunk-TQ74BATR.js} +100 -58
- package/dist/{chunk-JL2SLRAT.js → chunk-UJ7OTHPO.js} +76 -312
- package/dist/{chunk-HYHKTFG2.js → chunk-VNTLUFTY.js} +80 -843
- package/dist/chunk-WBZ4M5N5.js +59 -0
- package/dist/{chunk-6UP2Z2RZ.js → chunk-XJHDZUGD.js} +7 -7
- package/dist/chunk-Y2CM7HXH.js +111 -0
- package/dist/{chunk-F6HWCPOC.js → chunk-ZNNTSPNF.js} +1 -1
- package/dist/cli/chat.js +52 -2
- package/dist/cli/check.js +6 -5
- package/dist/cli/snapshot-warmup.js +10 -9
- package/dist/cli/upgrade.js +256 -16
- package/dist/db-A3ILH67H.js +20 -0
- package/dist/handlers/sandbox-egress-route.d.ts +4 -0
- package/dist/handlers/slack-webhook.d.ts +4 -0
- package/dist/handlers/webhooks.d.ts +6 -13
- package/dist/nitro.js +34 -89
- package/dist/plugin-module.d.ts +21 -0
- package/dist/plugins-OMJKLRJ2.js +13 -0
- package/dist/plugins.d.ts +6 -4
- package/dist/registry-NLZFIW23.js +46 -0
- package/dist/reporting/conversations.d.ts +3 -3
- package/dist/reporting.d.ts +6 -5
- package/dist/reporting.js +23 -17
- package/dist/{runner-27NP2TEO.js → runner-LUQZ5G67.js} +18 -13
- package/dist/validation-VMCPP3YO.js +15 -0
- package/package.json +11 -9
|
@@ -1340,14 +1340,6 @@ function extractGenAiUsageAttributes(...sources) {
|
|
|
1340
1340
|
};
|
|
1341
1341
|
}
|
|
1342
1342
|
|
|
1343
|
-
// src/chat/slack/ids.ts
|
|
1344
|
-
function isSlackTeamId(value) {
|
|
1345
|
-
return /^T[A-Z0-9]+$/.test(value);
|
|
1346
|
-
}
|
|
1347
|
-
function isSlackConversationId(value) {
|
|
1348
|
-
return /^(C|G|D)[A-Z0-9]+$/.test(value);
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
1343
|
export {
|
|
1352
1344
|
toOptionalString,
|
|
1353
1345
|
toOptionalNumber,
|
|
@@ -1371,7 +1363,5 @@ export {
|
|
|
1371
1363
|
buildTurnFailureResponse,
|
|
1372
1364
|
serializeGenAiAttribute,
|
|
1373
1365
|
extractGenAiUsageSummary,
|
|
1374
|
-
extractGenAiUsageAttributes
|
|
1375
|
-
isSlackTeamId,
|
|
1376
|
-
isSlackConversationId
|
|
1366
|
+
extractGenAiUsageAttributes
|
|
1377
1367
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getPluginProviders
|
|
3
|
+
} from "./chunk-2RWFUS5F.js";
|
|
4
|
+
|
|
5
|
+
// src/chat/plugins/validation.ts
|
|
6
|
+
function validatePluginRegistrations(registrations) {
|
|
7
|
+
const loadedPlugins = getPluginProviders();
|
|
8
|
+
const loadedNames = new Set(
|
|
9
|
+
loadedPlugins.map((plugin) => plugin.manifest.name)
|
|
10
|
+
);
|
|
11
|
+
for (const registration of registrations) {
|
|
12
|
+
if (!loadedNames.has(registration.manifest.name)) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
`Plugin registration "${registration.manifest.name}" does not have a matching plugin manifest. Add an inline manifest, packageName, or app-local plugin.yaml with the same name.`
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function validatePluginEgressCredentialHooks(registrations) {
|
|
20
|
+
const plugins = new Map(
|
|
21
|
+
registrations.map((registration) => [
|
|
22
|
+
registration.manifest.name,
|
|
23
|
+
registration
|
|
24
|
+
])
|
|
25
|
+
);
|
|
26
|
+
for (const provider of getPluginProviders()) {
|
|
27
|
+
const hooks = plugins.get(provider.manifest.name)?.hooks;
|
|
28
|
+
const hasGrantHook = Boolean(hooks?.grantForEgress);
|
|
29
|
+
const hasIssueHook = Boolean(hooks?.issueCredential);
|
|
30
|
+
const hasGenericCredentials = Boolean(
|
|
31
|
+
provider.manifest.credentials || provider.manifest.apiHeaders
|
|
32
|
+
);
|
|
33
|
+
const hasDomains = Boolean(provider.manifest.domains?.length);
|
|
34
|
+
const hasHookManagedOAuth = Boolean(
|
|
35
|
+
provider.manifest.oauth && !provider.manifest.credentials
|
|
36
|
+
);
|
|
37
|
+
if (!hasGrantHook && !hasIssueHook) {
|
|
38
|
+
if (hasDomains && !hasGenericCredentials) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
`Plugin "${provider.manifest.name}" manifest.domains requires egress credential hooks when no generic credentials or apiHeaders are configured.`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
if (hasHookManagedOAuth) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`Plugin "${provider.manifest.name}" manifest.oauth without oauth-bearer credentials requires egress credential hooks.`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (!hasGrantHook || !hasIssueHook) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
`Plugin "${provider.manifest.name}" egress credential hooks must include both grantForEgress and issueCredential.`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
if (hasGenericCredentials) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`Plugin "${provider.manifest.name}" egress credential hooks must use manifest.domains instead of generic credentials or apiHeaders.`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
if (!hasDomains) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Plugin "${provider.manifest.name}" egress credential hooks require manifest.domains to list sandbox egress hosts.`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
validatePluginRegistrations,
|
|
70
|
+
validatePluginEgressCredentialHooks
|
|
71
|
+
};
|
|
@@ -217,6 +217,9 @@ function listReferenceFiles() {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
// src/chat/plugins/package-discovery.ts
|
|
221
|
+
import path3 from "path";
|
|
222
|
+
|
|
220
223
|
// src/package-resolution.ts
|
|
221
224
|
import { statSync as statSync2 } from "fs";
|
|
222
225
|
import { createRequire } from "module";
|
|
@@ -354,7 +357,6 @@ function resolvePackageDir(cwd, packageName) {
|
|
|
354
357
|
}
|
|
355
358
|
|
|
356
359
|
// src/chat/plugins/package-discovery.ts
|
|
357
|
-
import path3 from "path";
|
|
358
360
|
function normalizeForGlob(targetPath) {
|
|
359
361
|
return targetPath.split(path3.sep).join("/");
|
|
360
362
|
}
|
|
@@ -410,13 +412,15 @@ function resolvePackageDirFromName(cwd, packageName, candidateNodeModulesDirs) {
|
|
|
410
412
|
}
|
|
411
413
|
function readPluginPackageFlags(dir) {
|
|
412
414
|
const hasRootPluginManifest = isFile(path3.join(dir, "plugin.yaml"));
|
|
415
|
+
const hasMigrationsDir = isDirectory(path3.join(dir, "migrations"));
|
|
413
416
|
const hasPluginsDir = isDirectory(path3.join(dir, "plugins"));
|
|
414
417
|
const hasSkillsDir = isDirectory(path3.join(dir, "skills"));
|
|
415
|
-
if (!hasRootPluginManifest && !hasPluginsDir && !hasSkillsDir) {
|
|
418
|
+
if (!hasRootPluginManifest && !hasMigrationsDir && !hasPluginsDir && !hasSkillsDir) {
|
|
416
419
|
return null;
|
|
417
420
|
}
|
|
418
421
|
return {
|
|
419
422
|
hasRootPluginManifest,
|
|
423
|
+
hasMigrationsDir,
|
|
420
424
|
hasPluginsDir,
|
|
421
425
|
hasSkillsDir
|
|
422
426
|
};
|
|
@@ -441,14 +445,14 @@ function discoverDeclaredPackages(packageNames, candidateNodeModulesDirs, cwd) {
|
|
|
441
445
|
const pluginFlags = readPluginPackageFlags(resolved.dir);
|
|
442
446
|
if (!pluginFlags) {
|
|
443
447
|
throw new Error(
|
|
444
|
-
`Plugin package "${packageName}" was configured but does not contain plugin content; expected plugin.yaml, plugins/, or skills/ in ${resolved.dir}`
|
|
448
|
+
`Plugin package "${packageName}" was configured but does not contain plugin content; expected plugin.yaml, migrations/, plugins/, or skills/ in ${resolved.dir}`
|
|
445
449
|
);
|
|
446
450
|
}
|
|
447
451
|
seenPackageDirs.add(resolved.dir);
|
|
448
452
|
discovered.push({
|
|
449
|
-
name: packageName,
|
|
450
453
|
dir: resolved.dir,
|
|
451
454
|
nodeModulesDir: resolved.nodeModulesDir,
|
|
455
|
+
packageName,
|
|
452
456
|
...pluginFlags
|
|
453
457
|
});
|
|
454
458
|
}
|
|
@@ -469,7 +473,7 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
469
473
|
for (const pkg of discoveredPackages) {
|
|
470
474
|
const tracingBasePath = pkg.nodeModulesDir ? pathForTracingInclude(
|
|
471
475
|
resolvedCwd,
|
|
472
|
-
path3.join(pkg.nodeModulesDir, ...pkg.
|
|
476
|
+
path3.join(pkg.nodeModulesDir, ...pkg.packageName.split("/"))
|
|
473
477
|
) : pathForTracingInclude(resolvedCwd, pkg.dir);
|
|
474
478
|
if (pkg.hasRootPluginManifest) {
|
|
475
479
|
manifestRoots.push(pkg.dir);
|
|
@@ -477,6 +481,11 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
477
481
|
tracingIncludes.push(`${tracingBasePath}/plugin.yaml`);
|
|
478
482
|
}
|
|
479
483
|
}
|
|
484
|
+
if (pkg.hasMigrationsDir) {
|
|
485
|
+
if (tracingBasePath) {
|
|
486
|
+
tracingIncludes.push(`${tracingBasePath}/migrations/**/*`);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
480
489
|
if (pkg.hasPluginsDir) {
|
|
481
490
|
manifestRoots.push(path3.join(pkg.dir, "plugins"));
|
|
482
491
|
if (tracingBasePath) {
|
|
@@ -492,12 +501,13 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
492
501
|
}
|
|
493
502
|
return {
|
|
494
503
|
packageNames: uniqueStringsInOrder(
|
|
495
|
-
discoveredPackages.map((pkg) => pkg.
|
|
504
|
+
discoveredPackages.map((pkg) => pkg.packageName)
|
|
496
505
|
),
|
|
497
506
|
packages: discoveredPackages.map((pkg) => ({
|
|
498
507
|
dir: pkg.dir,
|
|
508
|
+
hasMigrationsDir: pkg.hasMigrationsDir,
|
|
499
509
|
hasSkillsDir: pkg.hasSkillsDir,
|
|
500
|
-
|
|
510
|
+
packageName: pkg.packageName
|
|
501
511
|
})),
|
|
502
512
|
manifestRoots: uniqueStringsInOrder(manifestRoots),
|
|
503
513
|
skillRoots: uniqueStringsInOrder(skillRoots2),
|
|
@@ -3,29 +3,34 @@ import {
|
|
|
3
3
|
abandonAgentTurnSessionRecord,
|
|
4
4
|
buildSystemPrompt,
|
|
5
5
|
buildTurnContextPrompt,
|
|
6
|
-
createAgentPluginHookRunner,
|
|
7
6
|
escapeXml,
|
|
8
|
-
getAgentPluginTools,
|
|
9
7
|
getAgentTurnSessionRecord,
|
|
10
|
-
getSlackToolContext,
|
|
11
8
|
loadConnectedMcpProviders,
|
|
12
9
|
recordAuthorizationRequested,
|
|
13
10
|
recordMcpProviderConnected,
|
|
14
|
-
resolveChannelCapabilities,
|
|
15
11
|
upsertAgentTurnSessionRecord
|
|
16
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VNTLUFTY.js";
|
|
13
|
+
import {
|
|
14
|
+
createPluginHookRunner,
|
|
15
|
+
getPluginTools,
|
|
16
|
+
getSlackToolContext,
|
|
17
|
+
resolveChannelCapabilities
|
|
18
|
+
} from "./chunk-NPVUAXUE.js";
|
|
17
19
|
import {
|
|
18
20
|
discoverSkills,
|
|
19
21
|
findSkillByName,
|
|
20
22
|
loadSkillsByName,
|
|
21
23
|
parseSkillInvocation
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-OJODNL2P.js";
|
|
23
25
|
import {
|
|
24
26
|
buildConversationStatePatch
|
|
25
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-74HO27II.js";
|
|
26
28
|
import {
|
|
27
29
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
28
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-UJ7OTHPO.js";
|
|
31
|
+
import {
|
|
32
|
+
parseDestination
|
|
33
|
+
} from "./chunk-WBZ4M5N5.js";
|
|
29
34
|
import {
|
|
30
35
|
SlackActionError,
|
|
31
36
|
downloadPrivateSlackFile,
|
|
@@ -34,9 +39,8 @@ import {
|
|
|
34
39
|
isConversationScopedChannel,
|
|
35
40
|
isDmChannel,
|
|
36
41
|
normalizeSlackConversationId,
|
|
37
|
-
parseDestination,
|
|
38
42
|
withSlackRetries
|
|
39
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-62FUNJYS.js";
|
|
40
44
|
import {
|
|
41
45
|
buildNonInteractiveShellScript,
|
|
42
46
|
createSandboxInstance,
|
|
@@ -45,7 +49,7 @@ import {
|
|
|
45
49
|
isSnapshotMissingError,
|
|
46
50
|
resolveRuntimeDependencySnapshot,
|
|
47
51
|
runNonInteractiveCommand
|
|
48
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-XJHDZUGD.js";
|
|
49
53
|
import {
|
|
50
54
|
SANDBOX_DATA_ROOT,
|
|
51
55
|
SANDBOX_SKILLS_ROOT,
|
|
@@ -53,26 +57,9 @@ import {
|
|
|
53
57
|
sandboxSkillDir,
|
|
54
58
|
sandboxSkillFile
|
|
55
59
|
} from "./chunk-G3E7SCME.js";
|
|
56
|
-
import {
|
|
57
|
-
createPluginBroker,
|
|
58
|
-
credentialContextSchema,
|
|
59
|
-
getPluginCapabilityProviders,
|
|
60
|
-
getPluginCatalogSignature,
|
|
61
|
-
getPluginDefinition,
|
|
62
|
-
getPluginDisplayName,
|
|
63
|
-
getPluginMcpProviders,
|
|
64
|
-
getPluginOAuthConfig,
|
|
65
|
-
getPluginProviders,
|
|
66
|
-
isPluginConfigKey,
|
|
67
|
-
resolveAuthTokenPlaceholder,
|
|
68
|
-
resolvePluginCommandEnv
|
|
69
|
-
} from "./chunk-7Q5YOUUT.js";
|
|
70
|
-
import {
|
|
71
|
-
listReferenceFiles
|
|
72
|
-
} from "./chunk-KVZL5NZS.js";
|
|
73
60
|
import {
|
|
74
61
|
getStateAdapter
|
|
75
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-ZNNTSPNF.js";
|
|
76
63
|
import {
|
|
77
64
|
GEN_AI_PROVIDER_NAME,
|
|
78
65
|
GEN_AI_SERVER_ADDRESS,
|
|
@@ -112,12 +99,29 @@ import {
|
|
|
112
99
|
toObservablePromptPart,
|
|
113
100
|
trimTrailingAssistantMessages,
|
|
114
101
|
upsertActiveSkill
|
|
115
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-FCZO7LAR.js";
|
|
103
|
+
import {
|
|
104
|
+
createPluginBroker,
|
|
105
|
+
credentialContextSchema,
|
|
106
|
+
getPluginCapabilityProviders,
|
|
107
|
+
getPluginCatalogSignature,
|
|
108
|
+
getPluginDefinition,
|
|
109
|
+
getPluginDisplayName,
|
|
110
|
+
getPluginMcpProviders,
|
|
111
|
+
getPluginOAuthConfig,
|
|
112
|
+
getPluginProviders,
|
|
113
|
+
isPluginConfigKey,
|
|
114
|
+
resolveAuthTokenPlaceholder,
|
|
115
|
+
resolvePluginCommandEnv
|
|
116
|
+
} from "./chunk-2RWFUS5F.js";
|
|
117
|
+
import {
|
|
118
|
+
listReferenceFiles
|
|
119
|
+
} from "./chunk-Q3XNY442.js";
|
|
116
120
|
import {
|
|
117
121
|
createRequester,
|
|
118
122
|
parseActorUserId,
|
|
119
123
|
toStoredSlackRequester
|
|
120
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-EIYL7I4S.js";
|
|
121
125
|
import {
|
|
122
126
|
extractGenAiUsageAttributes,
|
|
123
127
|
extractGenAiUsageSummary,
|
|
@@ -136,7 +140,7 @@ import {
|
|
|
136
140
|
setTags,
|
|
137
141
|
toOptionalString,
|
|
138
142
|
withSpan
|
|
139
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-OK4KKR7B.js";
|
|
140
144
|
import {
|
|
141
145
|
sentry_exports
|
|
142
146
|
} from "./chunk-SJHUF3DP.js";
|
|
@@ -1008,18 +1012,48 @@ ${usage}
|
|
|
1008
1012
|
exitCode: 2
|
|
1009
1013
|
});
|
|
1010
1014
|
}
|
|
1015
|
+
async function handlePluginsCommand(args) {
|
|
1016
|
+
const usage = "jr-rpc plugins list";
|
|
1017
|
+
const subverb = (args[0] ?? "").trim();
|
|
1018
|
+
if (subverb !== "list" || args.length !== 1) {
|
|
1019
|
+
return commandResult({
|
|
1020
|
+
stderr: `Usage:
|
|
1021
|
+
${usage}
|
|
1022
|
+
`,
|
|
1023
|
+
exitCode: 2
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
const plugins = getPluginProviders().map((plugin) => ({
|
|
1027
|
+
name: plugin.manifest.name,
|
|
1028
|
+
displayName: plugin.manifest.displayName,
|
|
1029
|
+
description: plugin.manifest.description,
|
|
1030
|
+
capabilities: [...plugin.manifest.capabilities],
|
|
1031
|
+
configKeys: [...plugin.manifest.configKeys]
|
|
1032
|
+
})).sort((left, right) => left.name.localeCompare(right.name));
|
|
1033
|
+
return commandResult({
|
|
1034
|
+
stdout: {
|
|
1035
|
+
ok: true,
|
|
1036
|
+
plugins
|
|
1037
|
+
},
|
|
1038
|
+
exitCode: 0
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1011
1041
|
function createJrRpcCommand(deps) {
|
|
1012
1042
|
return defineCommand("jr-rpc", async (args) => {
|
|
1013
1043
|
const usage = [
|
|
1014
1044
|
"jr-rpc config get <key>",
|
|
1015
1045
|
"jr-rpc config set <key> <value> [--json]",
|
|
1016
1046
|
"jr-rpc config unset <key>",
|
|
1017
|
-
"jr-rpc config list [--prefix <value>]"
|
|
1047
|
+
"jr-rpc config list [--prefix <value>]",
|
|
1048
|
+
"jr-rpc plugins list"
|
|
1018
1049
|
].join("\n");
|
|
1019
1050
|
const verb = (args[0] ?? "").trim();
|
|
1020
1051
|
if (verb === "config") {
|
|
1021
1052
|
return handleConfigCommand(args.slice(1), deps);
|
|
1022
1053
|
}
|
|
1054
|
+
if (verb === "plugins") {
|
|
1055
|
+
return handlePluginsCommand(args.slice(1));
|
|
1056
|
+
}
|
|
1023
1057
|
return commandResult({
|
|
1024
1058
|
stderr: `Unsupported jr-rpc command. Use:
|
|
1025
1059
|
${usage}
|
|
@@ -6685,6 +6719,7 @@ function createTools(availableSkills, hooks = {}, context) {
|
|
|
6685
6719
|
tools.slackListUpdateItem = createSlackListUpdateItemTool(state);
|
|
6686
6720
|
const outputChannelId = slackContext.destinationChannelId;
|
|
6687
6721
|
const outputCapabilities = outputChannelId ? resolveChannelCapabilities(outputChannelId) : void 0;
|
|
6722
|
+
const canPostStandaloneSlackMessage = context.surface === void 0 || context.surface === "slack";
|
|
6688
6723
|
const rawChannelCapabilities = resolveChannelCapabilities(
|
|
6689
6724
|
slackContext.sourceChannelId
|
|
6690
6725
|
);
|
|
@@ -6694,11 +6729,13 @@ function createTools(availableSkills, hooks = {}, context) {
|
|
|
6694
6729
|
state
|
|
6695
6730
|
);
|
|
6696
6731
|
}
|
|
6697
|
-
if (outputCapabilities?.canPostToChannel) {
|
|
6732
|
+
if (outputCapabilities?.canPostToChannel && canPostStandaloneSlackMessage) {
|
|
6698
6733
|
tools.slackChannelPostMessage = createSlackChannelPostMessageTool(
|
|
6699
6734
|
slackContext,
|
|
6700
6735
|
state
|
|
6701
6736
|
);
|
|
6737
|
+
}
|
|
6738
|
+
if (outputCapabilities?.canPostToChannel) {
|
|
6702
6739
|
tools.slackChannelListMessages = createSlackChannelListMessagesTool(slackContext);
|
|
6703
6740
|
}
|
|
6704
6741
|
if (rawChannelCapabilities.canAddReactions) {
|
|
@@ -6708,9 +6745,7 @@ function createTools(availableSkills, hooks = {}, context) {
|
|
|
6708
6745
|
);
|
|
6709
6746
|
}
|
|
6710
6747
|
}
|
|
6711
|
-
for (const [name, pluginTool] of Object.entries(
|
|
6712
|
-
getAgentPluginTools(context)
|
|
6713
|
-
)) {
|
|
6748
|
+
for (const [name, pluginTool] of Object.entries(getPluginTools(context))) {
|
|
6714
6749
|
if (tools[name]) {
|
|
6715
6750
|
throw new Error(`Plugin tool "${name}" conflicts with a core tool`);
|
|
6716
6751
|
}
|
|
@@ -7021,16 +7056,16 @@ import { createHmac, randomUUID, timingSafeEqual } from "crypto";
|
|
|
7021
7056
|
// src/chat/sandbox/egress-schemas.ts
|
|
7022
7057
|
import { z } from "zod";
|
|
7023
7058
|
import {
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7059
|
+
pluginAuthorizationSchema,
|
|
7060
|
+
pluginCredentialHeaderTransformSchema,
|
|
7061
|
+
pluginGrantSchema,
|
|
7062
|
+
pluginProviderAccountSchema
|
|
7028
7063
|
} from "@sentry/junior-plugin-api";
|
|
7029
7064
|
var finiteNumberSchema = z.number().refine(Number.isFinite);
|
|
7030
7065
|
var httpStatusSchema = z.number().int().min(100).max(599);
|
|
7031
7066
|
var providerNameSchema = z.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
7032
7067
|
var credentialSignalKindSchema = z.enum(["auth_required", "unavailable"]);
|
|
7033
|
-
var sandboxEgressGrantSchema =
|
|
7068
|
+
var sandboxEgressGrantSchema = pluginGrantSchema;
|
|
7034
7069
|
var sandboxEgressCredentialContextSchema = z.object({
|
|
7035
7070
|
credentials: credentialContextSchema,
|
|
7036
7071
|
egressId: z.string().min(1),
|
|
@@ -7038,15 +7073,15 @@ var sandboxEgressCredentialContextSchema = z.object({
|
|
|
7038
7073
|
contextId: z.string().min(1)
|
|
7039
7074
|
}).strict();
|
|
7040
7075
|
var sandboxEgressCredentialLeaseSchema = z.object({
|
|
7041
|
-
account:
|
|
7042
|
-
authorization:
|
|
7076
|
+
account: pluginProviderAccountSchema.optional(),
|
|
7077
|
+
authorization: pluginAuthorizationSchema.optional(),
|
|
7043
7078
|
grant: sandboxEgressGrantSchema,
|
|
7044
7079
|
provider: providerNameSchema,
|
|
7045
7080
|
expiresAt: z.string().min(1),
|
|
7046
|
-
headerTransforms: z.array(
|
|
7081
|
+
headerTransforms: z.array(pluginCredentialHeaderTransformSchema).min(1)
|
|
7047
7082
|
}).strict();
|
|
7048
7083
|
var sandboxEgressAuthRequiredSignalSchema = z.object({
|
|
7049
|
-
authorization:
|
|
7084
|
+
authorization: pluginAuthorizationSchema.optional(),
|
|
7050
7085
|
grant: sandboxEgressGrantSchema,
|
|
7051
7086
|
kind: credentialSignalKindSchema.default("auth_required"),
|
|
7052
7087
|
provider: providerNameSchema,
|
|
@@ -7062,7 +7097,7 @@ var sandboxEgressAuthRequiredSignalSchema = z.object({
|
|
|
7062
7097
|
}
|
|
7063
7098
|
});
|
|
7064
7099
|
var sandboxEgressPermissionDeniedSignalSchema = z.object({
|
|
7065
|
-
account:
|
|
7100
|
+
account: pluginProviderAccountSchema.optional(),
|
|
7066
7101
|
acceptedPermissions: z.string().optional(),
|
|
7067
7102
|
grant: sandboxEgressGrantSchema,
|
|
7068
7103
|
message: z.string().min(1),
|
|
@@ -9100,7 +9135,7 @@ function normalizeToolResult(result, isSandboxResult) {
|
|
|
9100
9135
|
}
|
|
9101
9136
|
|
|
9102
9137
|
// src/chat/tools/execution/tool-error-handler.ts
|
|
9103
|
-
import {
|
|
9138
|
+
import { PluginToolInputError } from "@sentry/junior-plugin-api";
|
|
9104
9139
|
|
|
9105
9140
|
// src/chat/services/plugin-auth-orchestration.ts
|
|
9106
9141
|
import { THREAD_STATE_TTL_MS } from "chat";
|
|
@@ -9580,7 +9615,7 @@ function createPluginAuthOrchestration(input) {
|
|
|
9580
9615
|
|
|
9581
9616
|
// src/chat/tools/execution/tool-error-handler.ts
|
|
9582
9617
|
function isPluginToolInputError(error) {
|
|
9583
|
-
return error instanceof
|
|
9618
|
+
return error instanceof PluginToolInputError || error instanceof Error && error.name === "PluginToolInputError";
|
|
9584
9619
|
}
|
|
9585
9620
|
function getToolErrorType(error) {
|
|
9586
9621
|
if (error instanceof McpToolError) return "tool_error";
|
|
@@ -9731,7 +9766,9 @@ function createAgentTools(tools, sandbox, spanContext, onStatus, sandboxExecutor
|
|
|
9731
9766
|
});
|
|
9732
9767
|
const normalized = normalizeToolResult(result, isSandbox);
|
|
9733
9768
|
if (isSandbox && pluginAuthOrchestration) {
|
|
9734
|
-
await pluginAuthOrchestration.maybeHandleAuthSignal(
|
|
9769
|
+
await pluginAuthOrchestration.maybeHandleAuthSignal(
|
|
9770
|
+
normalized.details
|
|
9771
|
+
);
|
|
9735
9772
|
}
|
|
9736
9773
|
const resultAttributeValue = normalized.details && typeof normalized.details === "object" && "rawResult" in normalized.details && normalized.details.rawResult !== void 0 ? normalized.details.rawResult : normalized.details;
|
|
9737
9774
|
const toolResultAttribute = serializeToolPayload(resultAttributeValue);
|
|
@@ -11119,6 +11156,9 @@ function actorRequesterFromContext(context) {
|
|
|
11119
11156
|
});
|
|
11120
11157
|
}
|
|
11121
11158
|
function toolInvocationSource(context) {
|
|
11159
|
+
if (context.source) {
|
|
11160
|
+
return context.source;
|
|
11161
|
+
}
|
|
11122
11162
|
if (context.destination.platform !== "slack") {
|
|
11123
11163
|
return context.destination;
|
|
11124
11164
|
}
|
|
@@ -11148,10 +11188,6 @@ function surfaceFromContext(context) {
|
|
|
11148
11188
|
if (context.slackConversation || (conversationId ? parseSlackThreadId(conversationId) : void 0)) {
|
|
11149
11189
|
return "slack";
|
|
11150
11190
|
}
|
|
11151
|
-
const actor = context.credentialContext?.actor;
|
|
11152
|
-
if (actor?.type === "system" && actor.id === "scheduler") {
|
|
11153
|
-
return "scheduler";
|
|
11154
|
-
}
|
|
11155
11191
|
if (conversationId) {
|
|
11156
11192
|
return "api";
|
|
11157
11193
|
}
|
|
@@ -11404,7 +11440,7 @@ async function generateAssistantReply(messageText, context) {
|
|
|
11404
11440
|
};
|
|
11405
11441
|
const authRequesterId = context.credentialContext?.actor.type === "user" ? context.credentialContext.actor.userId : void 0;
|
|
11406
11442
|
const userTokenStore = createUserTokenStore();
|
|
11407
|
-
const
|
|
11443
|
+
const pluginHooks = createPluginHookRunner({
|
|
11408
11444
|
requester: actorRequester
|
|
11409
11445
|
});
|
|
11410
11446
|
sandboxExecutor = createSandboxExecutor({
|
|
@@ -11413,7 +11449,7 @@ async function generateAssistantReply(messageText, context) {
|
|
|
11413
11449
|
traceContext: spanContext,
|
|
11414
11450
|
tracePropagation: context.sandbox?.tracePropagation,
|
|
11415
11451
|
credentialEgress: context.credentialContext,
|
|
11416
|
-
agentHooks:
|
|
11452
|
+
agentHooks: pluginHooks,
|
|
11417
11453
|
onSandboxAcquired: async (sandbox2) => {
|
|
11418
11454
|
lastKnownSandboxId = sandbox2.sandboxId;
|
|
11419
11455
|
lastKnownSandboxDependencyProfileHash = sandbox2.sandboxDependencyProfileHash;
|
|
@@ -11615,6 +11651,7 @@ async function generateAssistantReply(messageText, context) {
|
|
|
11615
11651
|
configuration: configurationValues,
|
|
11616
11652
|
mcpToolManager: turnMcpToolManager,
|
|
11617
11653
|
sandbox,
|
|
11654
|
+
surface,
|
|
11618
11655
|
advisor: {
|
|
11619
11656
|
config: botConfig.advisor,
|
|
11620
11657
|
conversationId: sessionConversationId,
|
|
@@ -11733,6 +11770,11 @@ async function generateAssistantReply(messageText, context) {
|
|
|
11733
11770
|
conversationId: spanContext.conversationId,
|
|
11734
11771
|
slackConversation: context.slackConversation
|
|
11735
11772
|
},
|
|
11773
|
+
dispatch: context.dispatch ? {
|
|
11774
|
+
...context.dispatch,
|
|
11775
|
+
destination: context.destination,
|
|
11776
|
+
source: toolSource
|
|
11777
|
+
} : void 0,
|
|
11736
11778
|
invocation: skillInvocation,
|
|
11737
11779
|
requester: actorRequester,
|
|
11738
11780
|
artifactState: context.artifactState,
|
|
@@ -11780,7 +11822,7 @@ async function generateAssistantReply(messageText, context) {
|
|
|
11780
11822
|
sandboxExecutor,
|
|
11781
11823
|
pluginAuth,
|
|
11782
11824
|
onToolCall,
|
|
11783
|
-
|
|
11825
|
+
pluginHooks,
|
|
11784
11826
|
conversationPrivacy
|
|
11785
11827
|
);
|
|
11786
11828
|
advisorTools = createAgentTools(
|
|
@@ -11791,7 +11833,7 @@ async function generateAssistantReply(messageText, context) {
|
|
|
11791
11833
|
sandboxExecutor,
|
|
11792
11834
|
pluginAuth,
|
|
11793
11835
|
onToolCall,
|
|
11794
|
-
|
|
11836
|
+
pluginHooks,
|
|
11795
11837
|
conversationPrivacy
|
|
11796
11838
|
);
|
|
11797
11839
|
let hasEmittedText = false;
|