@sentry/junior 0.1.1 → 0.3.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 +10 -165
- package/bin/junior.mjs +38 -128
- package/dist/app/layout.d.ts +3 -0
- package/dist/{bot-6KXJ366H.js → bot-JSIREVQD.js} +4 -3
- package/dist/chunk-4RFOJSJL.js +272 -0
- package/dist/chunk-DPTR2FNH.js +1866 -0
- package/dist/{chunk-5LLCJPTH.js → chunk-L745IWNK.js} +7132 -5459
- package/dist/{chunk-BBOVH5RF.js → chunk-PY4AI2GZ.js} +62 -15
- package/dist/{chunk-OVG2HBNM.js → chunk-RTQMRGZD.js} +2 -2
- package/dist/chunk-SP6LV35L.js +328 -0
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.js +105 -0
- package/dist/cli/run.d.ts +11 -0
- package/dist/cli/run.js +30 -0
- package/dist/cli/snapshot-warmup.d.ts +3 -0
- package/dist/cli/snapshot-warmup.js +58 -0
- package/dist/handlers/health.d.ts +3 -0
- package/dist/handlers/queue-callback.d.ts +7 -0
- package/dist/handlers/queue-callback.js +6 -266
- package/dist/handlers/router.d.ts +18 -3
- package/dist/handlers/router.js +321 -13
- package/dist/handlers/webhooks.d.ts +13 -0
- package/dist/handlers/webhooks.js +2 -2
- package/dist/instrumentation.d.ts +6 -0
- package/dist/next-config.d.ts +10 -2
- package/dist/next-config.js +58 -57
- package/package.json +3 -8
- package/dist/chunk-CJFEZLEN.js +0 -3136
- package/dist/route-DMVINKJW.js +0 -304
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as Sentry from '@sentry/nextjs';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Initializes Sentry for Next.js runtime contexts used by Junior.
|
|
5
|
+
*/
|
|
3
6
|
declare function register(): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Re-export of Sentry request error handler for Next.js instrumentation wiring.
|
|
9
|
+
*/
|
|
4
10
|
declare const onRequestError: typeof Sentry.captureRequestError;
|
|
5
11
|
|
|
6
12
|
export { onRequestError, register };
|
package/dist/next-config.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { NextConfig } from 'next';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Optional overrides for `withJunior`.
|
|
5
|
+
*/
|
|
3
6
|
interface JuniorConfigOptions {
|
|
4
7
|
dataDir?: string;
|
|
5
8
|
skillsDir?: string;
|
|
6
9
|
pluginsDir?: string;
|
|
7
|
-
|
|
10
|
+
pluginPackages?: string[];
|
|
8
11
|
}
|
|
9
12
|
type NextConfigFactory = (phase: string, ctx: {
|
|
10
13
|
defaultConfig: NextConfig;
|
|
11
14
|
}) => Promise<NextConfig> | NextConfig;
|
|
12
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Extends a Next.js config with Junior runtime defaults.
|
|
17
|
+
*
|
|
18
|
+
* Supports both object and function-style Next config exports.
|
|
19
|
+
*/
|
|
20
|
+
declare function withJunior(options?: JuniorConfigOptions, nextConfig?: NextConfig | NextConfigFactory): NextConfig | NextConfigFactory;
|
|
13
21
|
|
|
14
22
|
export { type JuniorConfigOptions, withJunior };
|
package/dist/next-config.js
CHANGED
|
@@ -1,59 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
discoverInstalledPluginPackageContent,
|
|
3
|
+
discoverNodeModulesDirs,
|
|
4
|
+
isDirectory
|
|
5
|
+
} from "./chunk-SP6LV35L.js";
|
|
6
|
+
|
|
1
7
|
// src/next-config.ts
|
|
2
8
|
import { createRequire } from "module";
|
|
3
|
-
import { readFileSync, statSync } from "fs";
|
|
4
9
|
import path from "path";
|
|
5
10
|
var require2 = createRequire(import.meta.url);
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
return statSync(targetPath).isDirectory();
|
|
9
|
-
} catch {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
11
|
+
function unique(values) {
|
|
12
|
+
return [...new Set(values)];
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
return statSync(targetPath).isFile();
|
|
16
|
-
} catch {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
14
|
+
function sentryConfigured() {
|
|
15
|
+
return Boolean(process.env.NEXT_PUBLIC_SENTRY_DSN || process.env.SENTRY_DSN);
|
|
19
16
|
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} catch {
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
|
-
const dependencies = [
|
|
29
|
-
...Object.keys(rootPackageJson.dependencies ?? {}),
|
|
30
|
-
...Object.keys(rootPackageJson.optionalDependencies ?? {})
|
|
31
|
-
];
|
|
32
|
-
const tracingIncludes = [];
|
|
33
|
-
for (const dependency of dependencies) {
|
|
34
|
-
const packageDir = path.join(cwd, "node_modules", ...dependency.split("/"));
|
|
35
|
-
if (!isDirectory(packageDir)) {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
const base = `./node_modules/${dependency}`;
|
|
39
|
-
if (isFile(path.join(packageDir, "plugin.yaml"))) {
|
|
40
|
-
tracingIncludes.push(`${base}/plugin.yaml`);
|
|
41
|
-
}
|
|
42
|
-
if (isDirectory(path.join(packageDir, "plugins"))) {
|
|
43
|
-
tracingIncludes.push(`${base}/plugins/**/*`);
|
|
44
|
-
}
|
|
45
|
-
if (isDirectory(path.join(packageDir, "skills"))) {
|
|
46
|
-
tracingIncludes.push(`${base}/skills/**/*`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return [...new Set(tracingIncludes)].sort((left, right) => left.localeCompare(right));
|
|
17
|
+
function isPackageInstalled(cwd, packageName) {
|
|
18
|
+
const nodeModulesDirs = discoverNodeModulesDirs(cwd);
|
|
19
|
+
return nodeModulesDirs.some(
|
|
20
|
+
(nodeModulesDir) => isDirectory(path.join(nodeModulesDir, ...packageName.split("/")))
|
|
21
|
+
);
|
|
50
22
|
}
|
|
51
23
|
function applyJuniorConfig(nextConfig, options) {
|
|
24
|
+
const existingServerRuntimeConfig = nextConfig?.serverRuntimeConfig ?? {};
|
|
52
25
|
const dataDir = options?.dataDir ?? "./app/data";
|
|
53
26
|
const skillsDir = options?.skillsDir ?? "./app/skills";
|
|
54
27
|
const pluginsDir = options?.pluginsDir ?? "./app/plugins";
|
|
28
|
+
const configuredPluginPackages = unique(options?.pluginPackages ?? []);
|
|
29
|
+
const discoveredPlugins = discoverInstalledPluginPackageContent(process.cwd(), { packageNames: configuredPluginPackages });
|
|
30
|
+
const unresolvedConfiguredPackages = configuredPluginPackages.filter(
|
|
31
|
+
(packageName) => !discoveredPlugins.packageNames.includes(packageName)
|
|
32
|
+
);
|
|
33
|
+
const invalidPluginPackages = unresolvedConfiguredPackages.filter(
|
|
34
|
+
(packageName) => isPackageInstalled(process.cwd(), packageName)
|
|
35
|
+
);
|
|
36
|
+
const missingPluginPackages = unresolvedConfiguredPackages.filter(
|
|
37
|
+
(packageName) => !invalidPluginPackages.includes(packageName)
|
|
38
|
+
);
|
|
39
|
+
if (invalidPluginPackages.length > 0) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`withJunior pluginPackages contains installed packages that are not valid Junior plugins: ${invalidPluginPackages.join(", ")}`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if (missingPluginPackages.length > 0) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
`withJunior pluginPackages contains unresolved packages: ${missingPluginPackages.join(", ")}`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
55
49
|
const defaultDataTracingIncludes = options?.dataDir ? [`${dataDir}/**/*`] : ["./app/SOUL.md", "./app/ABOUT.md"];
|
|
56
|
-
const pluginPackageTracingIncludes =
|
|
50
|
+
const pluginPackageTracingIncludes = discoveredPlugins.tracingIncludes;
|
|
57
51
|
const tracingIncludes = Array.from(/* @__PURE__ */ new Set([
|
|
58
52
|
...defaultDataTracingIncludes,
|
|
59
53
|
`${skillsDir}/**/*`,
|
|
@@ -69,32 +63,39 @@ function applyJuniorConfig(nextConfig, options) {
|
|
|
69
63
|
...nextConfig,
|
|
70
64
|
serverExternalPackages: Array.from(/* @__PURE__ */ new Set([
|
|
71
65
|
...nextConfig?.serverExternalPackages ?? [],
|
|
66
|
+
"@vercel/queue",
|
|
72
67
|
"@vercel/sandbox",
|
|
73
68
|
"bash-tool",
|
|
74
69
|
"just-bash",
|
|
70
|
+
"@mariozechner/pi-agent-core",
|
|
71
|
+
"@mariozechner/pi-ai",
|
|
75
72
|
"@chat-adapter/slack",
|
|
76
73
|
"@slack/web-api"
|
|
77
74
|
])),
|
|
78
75
|
outputFileTracingIncludes: {
|
|
79
76
|
...nextConfig?.outputFileTracingIncludes,
|
|
80
77
|
"/*": mergedGlobalTracingIncludes
|
|
78
|
+
},
|
|
79
|
+
serverRuntimeConfig: {
|
|
80
|
+
...existingServerRuntimeConfig,
|
|
81
|
+
juniorPluginPackages: configuredPluginPackages
|
|
81
82
|
}
|
|
82
83
|
};
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
return withSentryConfig(config, {
|
|
86
|
-
org: process.env.SENTRY_ORG,
|
|
87
|
-
project: process.env.SENTRY_PROJECT,
|
|
88
|
-
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
89
|
-
silent: !process.env.CI,
|
|
90
|
-
sourcemaps: {
|
|
91
|
-
disable: false
|
|
92
|
-
}
|
|
93
|
-
});
|
|
84
|
+
if (!sentryConfigured()) {
|
|
85
|
+
return config;
|
|
94
86
|
}
|
|
95
|
-
|
|
87
|
+
const { withSentryConfig } = require2("@sentry/nextjs");
|
|
88
|
+
return withSentryConfig(config, {
|
|
89
|
+
org: process.env.SENTRY_ORG,
|
|
90
|
+
project: process.env.SENTRY_PROJECT,
|
|
91
|
+
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
92
|
+
silent: !process.env.CI,
|
|
93
|
+
sourcemaps: {
|
|
94
|
+
disable: false
|
|
95
|
+
}
|
|
96
|
+
});
|
|
96
97
|
}
|
|
97
|
-
function withJunior(
|
|
98
|
+
function withJunior(options, nextConfig) {
|
|
98
99
|
if (typeof nextConfig === "function") {
|
|
99
100
|
return async (phase, ctx) => {
|
|
100
101
|
const resolved = await nextConfig(phase, ctx);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -39,9 +39,7 @@
|
|
|
39
39
|
"just-bash": "^2.12.0",
|
|
40
40
|
"node-html-markdown": "^2.0.0",
|
|
41
41
|
"yaml": "^2.8.2",
|
|
42
|
-
"zod": "^4.3.6"
|
|
43
|
-
"@sentry/junior-github": "0.1.1",
|
|
44
|
-
"@sentry/junior-sentry": "0.1.1"
|
|
42
|
+
"zod": "^4.3.6"
|
|
45
43
|
},
|
|
46
44
|
"peerDependencies": {
|
|
47
45
|
"@sentry/nextjs": ">=10.0.0",
|
|
@@ -65,10 +63,7 @@
|
|
|
65
63
|
"vitest-evals": "^0.6.0"
|
|
66
64
|
},
|
|
67
65
|
"scripts": {
|
|
68
|
-
"
|
|
69
|
-
"build": "next build",
|
|
70
|
-
"build:pkg": "tsup",
|
|
71
|
-
"start": "next start",
|
|
66
|
+
"build": "tsup",
|
|
72
67
|
"test": "pnpm run test:slack-boundary && vitest run",
|
|
73
68
|
"test:watch": "vitest",
|
|
74
69
|
"preevals": "pnpm run test:slack-boundary",
|