@sentry/junior 0.15.2 → 0.17.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/bin/junior.mjs +0 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +760 -725
- package/dist/{chunk-KTBQH6L5.js → chunk-4XWTSMRF.js} +1 -1
- package/dist/{chunk-5JHLDXBN.js → chunk-DTOS5CG4.js} +13 -4
- package/dist/{chunk-ESPIOJPM.js → chunk-XYOKYK6U.js} +1 -1
- package/dist/cli/check.js +2 -2
- package/dist/cli/init.js +1 -1
- package/dist/cli/snapshot-warmup.js +2 -2
- package/dist/nitro.js +90 -65
- package/package.json +7 -2
|
@@ -47,7 +47,7 @@ var LEGACY_KEY_MAP = {
|
|
|
47
47
|
steps: "app.ai.steps",
|
|
48
48
|
toolCalls: "app.ai.tool_calls",
|
|
49
49
|
toolResults: "app.ai.tool_results",
|
|
50
|
-
finishReason: "
|
|
50
|
+
finishReason: "gen_ai.response.finish_reasons",
|
|
51
51
|
sources: "app.ai.sources",
|
|
52
52
|
generatedFiles: "app.ai.generated_files",
|
|
53
53
|
resultFiles: "app.ai.result_files",
|
|
@@ -301,7 +301,9 @@ function mergeAttributes(...maps) {
|
|
|
301
301
|
if (!map) continue;
|
|
302
302
|
for (const [rawKey, rawValue] of Object.entries(map)) {
|
|
303
303
|
const key = normalizeAttributeKey(rawKey);
|
|
304
|
-
const value = sanitizeValue(
|
|
304
|
+
const value = sanitizeValue(
|
|
305
|
+
key === "gen_ai.response.finish_reasons" && typeof rawValue === "string" && rawValue.trim() ? [rawValue] : rawValue
|
|
306
|
+
);
|
|
305
307
|
if (value !== void 0) {
|
|
306
308
|
merged[key] = value;
|
|
307
309
|
}
|
|
@@ -1623,6 +1625,12 @@ function createGitHubAppBroker(manifest, credentials) {
|
|
|
1623
1625
|
function leaseDomainsFor(capability) {
|
|
1624
1626
|
return GIT_CAPABILITIES.has(capability) ? [...apiDomains, GIT_DOMAIN] : apiDomains;
|
|
1625
1627
|
}
|
|
1628
|
+
function authorizationFor(domain, token) {
|
|
1629
|
+
if (domain === GIT_DOMAIN) {
|
|
1630
|
+
return `Basic ${Buffer.from(`x-access-token:${token}`).toString("base64")}`;
|
|
1631
|
+
}
|
|
1632
|
+
return `Bearer ${token}`;
|
|
1633
|
+
}
|
|
1626
1634
|
const supportedCapabilities = new Set(manifest.capabilities);
|
|
1627
1635
|
return {
|
|
1628
1636
|
async issue(input) {
|
|
@@ -1659,7 +1667,7 @@ function createGitHubAppBroker(manifest, credentials) {
|
|
|
1659
1667
|
domain,
|
|
1660
1668
|
headers: {
|
|
1661
1669
|
...apiHeaders ?? {},
|
|
1662
|
-
Authorization:
|
|
1670
|
+
Authorization: authorizationFor(domain, cached.token)
|
|
1663
1671
|
}
|
|
1664
1672
|
})),
|
|
1665
1673
|
expiresAt: new Date(cached.expiresAt).toISOString(),
|
|
@@ -1703,7 +1711,7 @@ function createGitHubAppBroker(manifest, credentials) {
|
|
|
1703
1711
|
domain,
|
|
1704
1712
|
headers: {
|
|
1705
1713
|
...apiHeaders ?? {},
|
|
1706
|
-
Authorization:
|
|
1714
|
+
Authorization: authorizationFor(domain, accessTokenResponse.token)
|
|
1707
1715
|
}
|
|
1708
1716
|
})),
|
|
1709
1717
|
expiresAt: new Date(expiresAtMs).toISOString(),
|
|
@@ -2288,6 +2296,7 @@ export {
|
|
|
2288
2296
|
withSpan,
|
|
2289
2297
|
setSpanAttributes,
|
|
2290
2298
|
setSpanStatus,
|
|
2299
|
+
getActiveTraceId,
|
|
2291
2300
|
resolveErrorReference,
|
|
2292
2301
|
serializeGenAiAttribute,
|
|
2293
2302
|
extractGenAiUsageAttributes,
|
package/dist/cli/check.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSkillFile
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-4XWTSMRF.js";
|
|
4
4
|
import {
|
|
5
5
|
parsePluginManifest
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-DTOS5CG4.js";
|
|
7
7
|
import "../chunk-Z3YD6NHK.js";
|
|
8
8
|
import "../chunk-RBB2MZAN.js";
|
|
9
9
|
import "../chunk-2KG3PWR4.js";
|
package/dist/cli/init.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
disconnectStateAdapter,
|
|
3
3
|
resolveRuntimeDependencySnapshot
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-XYOKYK6U.js";
|
|
5
5
|
import {
|
|
6
6
|
getPluginProviders,
|
|
7
7
|
getPluginRuntimeDependencies,
|
|
8
8
|
getPluginRuntimePostinstall
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-DTOS5CG4.js";
|
|
10
10
|
import "../chunk-Z3YD6NHK.js";
|
|
11
11
|
import "../chunk-RBB2MZAN.js";
|
|
12
12
|
import "../chunk-2KG3PWR4.js";
|
package/dist/nitro.js
CHANGED
|
@@ -4,56 +4,62 @@ import {
|
|
|
4
4
|
import "./chunk-2KG3PWR4.js";
|
|
5
5
|
|
|
6
6
|
// src/nitro.ts
|
|
7
|
-
import
|
|
7
|
+
import path3 from "path";
|
|
8
|
+
|
|
9
|
+
// src/build/rolldown-workarounds.ts
|
|
10
|
+
function applyRolldownTreeshakeWorkaround(nitro) {
|
|
11
|
+
nitro.options.rolldownConfig = {
|
|
12
|
+
...nitro.options.rolldownConfig,
|
|
13
|
+
treeshake: {
|
|
14
|
+
...nitro.options.rolldownConfig?.treeshake,
|
|
15
|
+
moduleSideEffects: true
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// src/build/copy-build-content.ts
|
|
21
|
+
import { cpSync, existsSync as existsSync2, mkdirSync, readdirSync } from "fs";
|
|
22
|
+
import path2 from "path";
|
|
23
|
+
|
|
24
|
+
// src/build/glob-to-regex.ts
|
|
25
|
+
function globToRegex(pattern) {
|
|
26
|
+
const escaped = pattern.replace(/[\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
|
|
27
|
+
return new RegExp(`^${escaped}$`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/build/resolve-package.ts
|
|
31
|
+
import { existsSync } from "fs";
|
|
8
32
|
import path from "path";
|
|
9
33
|
import { fileURLToPath } from "url";
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
nitro.options.vercel.functions ??= {};
|
|
19
|
-
nitro.options.vercel.functions.maxDuration ??= options.maxDuration ?? 800;
|
|
20
|
-
nitro.options.rolldownConfig = {
|
|
21
|
-
...nitro.options.rolldownConfig,
|
|
22
|
-
treeshake: {
|
|
23
|
-
...nitro.options.rolldownConfig?.treeshake,
|
|
24
|
-
moduleSideEffects: true
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
nitro.options.virtual["#junior/config"] = `export const pluginPackages = ${JSON.stringify(options.pluginPackages ?? [])};`;
|
|
28
|
-
nitro.hooks.hook("compiled", () => {
|
|
29
|
-
copyAppAndPluginContent(
|
|
30
|
-
cwd,
|
|
31
|
-
nitro.options.output.serverDir,
|
|
32
|
-
options.pluginPackages
|
|
33
|
-
);
|
|
34
|
-
copyIncludedFiles(
|
|
35
|
-
nitro.options.output.serverDir,
|
|
36
|
-
options.includeFiles
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
34
|
+
function resolvePackageDir(pkgName) {
|
|
35
|
+
try {
|
|
36
|
+
const resolved = import.meta.resolve(pkgName);
|
|
37
|
+
const entry = resolved.startsWith("file://") ? fileURLToPath(resolved) : resolved;
|
|
38
|
+
let dir = path.dirname(entry);
|
|
39
|
+
while (dir !== path.dirname(dir)) {
|
|
40
|
+
if (existsSync(path.join(dir, "package.json"))) return dir;
|
|
41
|
+
dir = path.dirname(dir);
|
|
40
42
|
}
|
|
41
|
-
}
|
|
43
|
+
} catch {
|
|
44
|
+
}
|
|
45
|
+
return void 0;
|
|
42
46
|
}
|
|
47
|
+
|
|
48
|
+
// src/build/copy-build-content.ts
|
|
43
49
|
function copyAppAndPluginContent(cwd, serverRoot, pluginPackages) {
|
|
44
|
-
copyIfExists(
|
|
50
|
+
copyIfExists(path2.join(cwd, "app"), path2.join(serverRoot, "app"));
|
|
45
51
|
const packagedContent = discoverInstalledPluginPackageContent(cwd, {
|
|
46
52
|
packageNames: pluginPackages
|
|
47
53
|
});
|
|
48
54
|
for (const root of packagedContent.manifestRoots) {
|
|
49
|
-
if (
|
|
50
|
-
const relative =
|
|
51
|
-
if (!relative ||
|
|
55
|
+
if (existsSync2(path2.join(root, "plugin.yaml"))) {
|
|
56
|
+
const relative = path2.relative(cwd, root);
|
|
57
|
+
if (!relative || path2.isAbsolute(relative) || relative.startsWith("..")) {
|
|
52
58
|
continue;
|
|
53
59
|
}
|
|
54
60
|
copyIfExists(
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
path2.join(root, "plugin.yaml"),
|
|
62
|
+
path2.join(serverRoot, relative, "plugin.yaml")
|
|
57
63
|
);
|
|
58
64
|
continue;
|
|
59
65
|
}
|
|
@@ -63,19 +69,6 @@ function copyAppAndPluginContent(cwd, serverRoot, pluginPackages) {
|
|
|
63
69
|
copyRootIntoServerOutput(cwd, serverRoot, root);
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
|
-
function resolvePackageDir(pkgName) {
|
|
67
|
-
try {
|
|
68
|
-
const resolved = import.meta.resolve(pkgName);
|
|
69
|
-
const entry = resolved.startsWith("file://") ? fileURLToPath(resolved) : resolved;
|
|
70
|
-
let dir = path.dirname(entry);
|
|
71
|
-
while (dir !== path.dirname(dir)) {
|
|
72
|
-
if (existsSync(path.join(dir, "package.json"))) return dir;
|
|
73
|
-
dir = path.dirname(dir);
|
|
74
|
-
}
|
|
75
|
-
} catch {
|
|
76
|
-
}
|
|
77
|
-
return void 0;
|
|
78
|
-
}
|
|
79
72
|
function copyIncludedFiles(serverRoot, patterns) {
|
|
80
73
|
if (!patterns?.length) return;
|
|
81
74
|
for (const pattern of patterns) {
|
|
@@ -83,38 +76,70 @@ function copyIncludedFiles(serverRoot, patterns) {
|
|
|
83
76
|
const parts = normalized.split("/");
|
|
84
77
|
const pkgName = parts[0].startsWith("@") ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
85
78
|
const subpath = parts.slice(pkgName.includes("/") ? 2 : 1).join("/");
|
|
86
|
-
const fileGlob =
|
|
87
|
-
const subDir =
|
|
79
|
+
const fileGlob = path2.basename(subpath);
|
|
80
|
+
const subDir = path2.dirname(subpath);
|
|
88
81
|
const pkgDir = resolvePackageDir(pkgName);
|
|
89
82
|
if (!pkgDir) continue;
|
|
90
|
-
const sourceDir =
|
|
91
|
-
if (!
|
|
83
|
+
const sourceDir = path2.join(pkgDir, subDir);
|
|
84
|
+
if (!existsSync2(sourceDir)) continue;
|
|
92
85
|
const entries = readdirSync(sourceDir);
|
|
93
|
-
const re = fileGlob.includes("*") ?
|
|
94
|
-
`^${fileGlob.replace(/[\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*")}$`
|
|
95
|
-
) : null;
|
|
86
|
+
const re = fileGlob.includes("*") ? globToRegex(fileGlob) : null;
|
|
96
87
|
for (const entry of entries) {
|
|
97
88
|
if (re ? !re.test(entry) : entry !== fileGlob) continue;
|
|
98
89
|
copyIfExists(
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
path2.join(sourceDir, entry),
|
|
91
|
+
path2.join(serverRoot, "node_modules", pkgName, subDir, entry)
|
|
101
92
|
);
|
|
102
93
|
}
|
|
103
94
|
}
|
|
104
95
|
}
|
|
105
96
|
function copyIfExists(source, target) {
|
|
106
|
-
if (!
|
|
97
|
+
if (!existsSync2(source)) {
|
|
107
98
|
return;
|
|
108
99
|
}
|
|
109
|
-
mkdirSync(
|
|
100
|
+
mkdirSync(path2.dirname(target), { recursive: true });
|
|
110
101
|
cpSync(source, target, { recursive: true });
|
|
111
102
|
}
|
|
112
103
|
function copyRootIntoServerOutput(cwd, serverRoot, root) {
|
|
113
|
-
const relative =
|
|
114
|
-
if (!relative ||
|
|
104
|
+
const relative = path2.relative(cwd, root);
|
|
105
|
+
if (!relative || path2.isAbsolute(relative) || relative.startsWith("..")) {
|
|
115
106
|
return;
|
|
116
107
|
}
|
|
117
|
-
copyIfExists(root,
|
|
108
|
+
copyIfExists(root, path2.join(serverRoot, relative));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// src/build/virtual-config.ts
|
|
112
|
+
function injectVirtualConfig(nitro, pluginPackages) {
|
|
113
|
+
nitro.options.virtual["#junior/config"] = `export const pluginPackages = ${JSON.stringify(pluginPackages)};`;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/nitro.ts
|
|
117
|
+
function juniorNitro(options = {}) {
|
|
118
|
+
return {
|
|
119
|
+
nitro: {
|
|
120
|
+
setup(nitro) {
|
|
121
|
+
const cwd = path3.resolve(
|
|
122
|
+
options.cwd ?? nitro.options.rootDir ?? process.cwd()
|
|
123
|
+
);
|
|
124
|
+
nitro.options.vercel ??= {};
|
|
125
|
+
nitro.options.vercel.functions ??= {};
|
|
126
|
+
nitro.options.vercel.functions.maxDuration ??= options.maxDuration ?? 800;
|
|
127
|
+
applyRolldownTreeshakeWorkaround(nitro);
|
|
128
|
+
injectVirtualConfig(nitro, options.pluginPackages ?? []);
|
|
129
|
+
nitro.hooks.hook("compiled", () => {
|
|
130
|
+
copyAppAndPluginContent(
|
|
131
|
+
cwd,
|
|
132
|
+
nitro.options.output.serverDir,
|
|
133
|
+
options.pluginPackages
|
|
134
|
+
);
|
|
135
|
+
copyIncludedFiles(
|
|
136
|
+
nitro.options.output.serverDir,
|
|
137
|
+
options.includeFiles
|
|
138
|
+
);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
118
143
|
}
|
|
119
144
|
export {
|
|
120
145
|
juniorNitro
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -46,8 +46,10 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@sentry/node": "^10.46.0",
|
|
48
48
|
"@types/node": "^25.5.0",
|
|
49
|
+
"dependency-cruiser": "^17.3.10",
|
|
49
50
|
"msw": "^2.12.14",
|
|
50
51
|
"nitro": "3.0.260311-beta",
|
|
52
|
+
"oxlint": "^1.58.0",
|
|
51
53
|
"tsup": "^8.5.1",
|
|
52
54
|
"typescript": "^5.9.3",
|
|
53
55
|
"vercel": "^50.37.3",
|
|
@@ -55,9 +57,12 @@
|
|
|
55
57
|
},
|
|
56
58
|
"scripts": {
|
|
57
59
|
"build": "tsup",
|
|
58
|
-
"
|
|
60
|
+
"lint": "oxlint --config .oxlintrc.json --quiet --import-plugin --node-plugin --vitest-plugin src tests scripts bin tsup.config.ts",
|
|
61
|
+
"lint:fix": "oxlint --config .oxlintrc.json --quiet --import-plugin --node-plugin --vitest-plugin --fix src tests scripts bin tsup.config.ts",
|
|
62
|
+
"test": "pnpm run test:slack-boundary && pnpm run test:arch-boundary && vitest run",
|
|
59
63
|
"test:watch": "vitest",
|
|
60
64
|
"test:slack-boundary": "node scripts/check-slack-test-boundary.mjs",
|
|
65
|
+
"test:arch-boundary": "depcruise --config .dependency-cruiser.mjs src/chat",
|
|
61
66
|
"typecheck": "tsc --noEmit",
|
|
62
67
|
"skills:check": "node scripts/check-skills.mjs"
|
|
63
68
|
}
|