@sentry/junior 0.10.3 → 0.11.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 +19 -17
- package/dist/app.d.ts +13 -0
- package/dist/{chunk-ASAQ64YN.js → app.js} +9490 -8761
- package/dist/chunk-2KG3PWR4.js +17 -0
- package/dist/{chunk-FNYLIUOK.js → chunk-IRE2LOEJ.js} +5 -4
- package/dist/{chunk-573MJIST.js → chunk-WELSSJJU.js} +2 -2
- package/dist/{chunk-KCLEEKYX.js → chunk-XH7TV4JS.js} +13 -5
- package/dist/chunk-Z3YD6NHK.js +12 -0
- package/dist/{chunk-AVIUX5XL.js → chunk-ZYB3U7Q4.js} +15 -13
- package/dist/cli/check.js +5 -3
- package/dist/cli/env.js +2 -0
- package/dist/cli/init.js +65 -45
- package/dist/cli/run.js +2 -0
- package/dist/cli/snapshot-warmup.js +9 -3
- package/dist/instrumentation.d.ts +3 -11
- package/dist/instrumentation.js +17 -26
- package/dist/nitro.d.ts +18 -0
- package/dist/nitro.js +59 -0
- package/package.json +16 -25
- package/dist/app/layout.d.ts +0 -11
- package/dist/app/layout.js +0 -8
- package/dist/chunk-4RBEYCOG.js +0 -12
- package/dist/handlers/health.d.ts +0 -6
- package/dist/handlers/health.js +0 -6
- package/dist/handlers/router.d.ts +0 -23
- package/dist/handlers/router.js +0 -827
- package/dist/handlers/webhooks.d.ts +0 -28
- package/dist/handlers/webhooks.js +0 -12
- package/dist/next-config.d.ts +0 -22
- package/dist/next-config.js +0 -114
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
__reExport
|
|
17
|
+
};
|
|
@@ -2,7 +2,11 @@ import {
|
|
|
2
2
|
getPluginRuntimeDependencies,
|
|
3
3
|
getPluginRuntimePostinstall,
|
|
4
4
|
withSpan
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZYB3U7Q4.js";
|
|
6
|
+
|
|
7
|
+
// src/chat/state/adapter.ts
|
|
8
|
+
import { createMemoryState } from "@chat-adapter/state-memory";
|
|
9
|
+
import { createRedisState } from "@chat-adapter/state-redis";
|
|
6
10
|
|
|
7
11
|
// src/chat/optional-string.ts
|
|
8
12
|
function toOptionalTrimmed(value) {
|
|
@@ -93,8 +97,6 @@ function getRuntimeMetadata() {
|
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
// src/chat/state/adapter.ts
|
|
96
|
-
import { createMemoryState } from "@chat-adapter/state-memory";
|
|
97
|
-
import { createRedisState } from "@chat-adapter/state-redis";
|
|
98
100
|
var MIN_LOCK_TTL_MS = 1e3 * 60 * 5;
|
|
99
101
|
var stateAdapter;
|
|
100
102
|
var redisStateAdapter;
|
|
@@ -789,7 +791,6 @@ function isSnapshotMissingError(error) {
|
|
|
789
791
|
|
|
790
792
|
export {
|
|
791
793
|
toOptionalTrimmed,
|
|
792
|
-
getChatConfig,
|
|
793
794
|
botConfig,
|
|
794
795
|
getSlackBotToken,
|
|
795
796
|
getSlackSigningSecret,
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
getPluginSkillRoots,
|
|
5
5
|
logInfo,
|
|
6
6
|
logWarn
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZYB3U7Q4.js";
|
|
8
8
|
import {
|
|
9
9
|
skillRoots
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XH7TV4JS.js";
|
|
11
11
|
|
|
12
12
|
// src/chat/skills.ts
|
|
13
13
|
import fs from "fs/promises";
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// src/chat/plugins/package-discovery.ts
|
|
2
|
+
import { readFileSync, readdirSync as readdirSync2 } from "fs";
|
|
3
|
+
import path2 from "path";
|
|
4
|
+
import { parse as parseYaml } from "yaml";
|
|
5
|
+
|
|
1
6
|
// src/chat/discovery.ts
|
|
2
7
|
import fs, { readdirSync, statSync } from "fs";
|
|
3
8
|
import path from "path";
|
|
@@ -232,9 +237,6 @@ function aboutPathCandidates() {
|
|
|
232
237
|
}
|
|
233
238
|
|
|
234
239
|
// src/chat/plugins/package-discovery.ts
|
|
235
|
-
import { readFileSync, readdirSync as readdirSync2 } from "fs";
|
|
236
|
-
import path2 from "path";
|
|
237
|
-
import { parse as parseYaml } from "yaml";
|
|
238
240
|
function normalizeForGlob(targetPath) {
|
|
239
241
|
return targetPath.split(path2.sep).join("/");
|
|
240
242
|
}
|
|
@@ -267,7 +269,14 @@ function parseRuntimeConfiguredPackageNames(value) {
|
|
|
267
269
|
);
|
|
268
270
|
return uniqueStringsInOrder(parsed.map((entry) => entry.trim()));
|
|
269
271
|
}
|
|
272
|
+
var configuredPluginPackages;
|
|
273
|
+
function setPluginPackages(packages) {
|
|
274
|
+
configuredPluginPackages = packages;
|
|
275
|
+
}
|
|
270
276
|
function readNextRuntimeConfiguredPackageNames() {
|
|
277
|
+
if (configuredPluginPackages !== void 0) {
|
|
278
|
+
return configuredPluginPackages;
|
|
279
|
+
}
|
|
271
280
|
const raw = process.env.JUNIOR_PLUGIN_PACKAGES;
|
|
272
281
|
if (raw === void 0) {
|
|
273
282
|
return null;
|
|
@@ -541,12 +550,11 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
541
550
|
}
|
|
542
551
|
|
|
543
552
|
export {
|
|
544
|
-
isDirectory,
|
|
545
|
-
discoverNodeModulesDirs,
|
|
546
553
|
homeDir,
|
|
547
554
|
skillRoots,
|
|
548
555
|
pluginRoots,
|
|
549
556
|
soulPathCandidates,
|
|
550
557
|
aboutPathCandidates,
|
|
558
|
+
setPluginPackages,
|
|
551
559
|
discoverInstalledPluginPackageContent
|
|
552
560
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sentry_exports
|
|
3
|
+
} from "./chunk-Z3YD6NHK.js";
|
|
1
4
|
import {
|
|
2
5
|
discoverInstalledPluginPackageContent,
|
|
3
6
|
pluginRoots
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XH7TV4JS.js";
|
|
5
8
|
|
|
6
9
|
// src/chat/logging.ts
|
|
7
10
|
import { AsyncLocalStorage } from "async_hooks";
|
|
8
|
-
import * as Sentry from "@sentry/nextjs";
|
|
9
11
|
var MAX_STRING_VALUE = 1200;
|
|
10
12
|
var SECRETS_RE = [
|
|
11
13
|
/\b(sk-[A-Za-z0-9_-]{20,})\b/g,
|
|
@@ -93,7 +95,7 @@ var CONSOLE_PREVIEW_KEYS = /* @__PURE__ */ new Set([
|
|
|
93
95
|
"gen_ai.tool.call.result"
|
|
94
96
|
]);
|
|
95
97
|
function getSentryEnvironment() {
|
|
96
|
-
return (process.env.SENTRY_ENVIRONMENT ?? process.env.
|
|
98
|
+
return (process.env.SENTRY_ENVIRONMENT ?? process.env.VERCEL_ENV ?? process.env.NODE_ENV ?? "").trim().toLowerCase();
|
|
97
99
|
}
|
|
98
100
|
function shouldSuppressInfoLog(level) {
|
|
99
101
|
return getSentryEnvironment() === "production" && level === "info";
|
|
@@ -264,7 +266,7 @@ function contextToAttributes(context) {
|
|
|
264
266
|
return normalized;
|
|
265
267
|
}
|
|
266
268
|
function getTraceCorrelationAttributes() {
|
|
267
|
-
const sentry =
|
|
269
|
+
const sentry = sentry_exports;
|
|
268
270
|
if (typeof sentry.getActiveSpan !== "function" || typeof sentry.spanToJSON !== "function") {
|
|
269
271
|
return {};
|
|
270
272
|
}
|
|
@@ -298,7 +300,7 @@ function emitSentry(level, body, attributes) {
|
|
|
298
300
|
if (shouldSuppressInfoLog(level)) {
|
|
299
301
|
return;
|
|
300
302
|
}
|
|
301
|
-
const sentry =
|
|
303
|
+
const sentry = sentry_exports;
|
|
302
304
|
const loggerFn = sentry.logger?.[level];
|
|
303
305
|
if (typeof loggerFn === "function") {
|
|
304
306
|
loggerFn(body, attributes);
|
|
@@ -519,8 +521,8 @@ var log = {
|
|
|
519
521
|
body ?? normalizedError.message
|
|
520
522
|
);
|
|
521
523
|
let eventId;
|
|
522
|
-
const sentryWithScope =
|
|
523
|
-
const sentryCaptureException =
|
|
524
|
+
const sentryWithScope = sentry_exports.withScope;
|
|
525
|
+
const sentryCaptureException = sentry_exports.captureException;
|
|
524
526
|
if (typeof sentryWithScope === "function" && typeof sentryCaptureException === "function") {
|
|
525
527
|
sentryWithScope((scope) => {
|
|
526
528
|
for (const [key, value] of Object.entries(
|
|
@@ -575,11 +577,11 @@ function setSentryTagsFromContext(context) {
|
|
|
575
577
|
const attrs = contextToAttributes(context);
|
|
576
578
|
for (const [key, value] of Object.entries(attrs)) {
|
|
577
579
|
if (typeof value === "string" && value.length > 0) {
|
|
578
|
-
|
|
580
|
+
sentry_exports.setTag(key, value);
|
|
579
581
|
}
|
|
580
582
|
}
|
|
581
583
|
if (context.slackUserId) {
|
|
582
|
-
|
|
584
|
+
sentry_exports.setUser({
|
|
583
585
|
id: context.slackUserId,
|
|
584
586
|
username: context.slackUserName
|
|
585
587
|
});
|
|
@@ -635,7 +637,7 @@ async function withSpan(name, op, context, callback, attributes = {}) {
|
|
|
635
637
|
}
|
|
636
638
|
return withLogContext(
|
|
637
639
|
context,
|
|
638
|
-
() =>
|
|
640
|
+
() => sentry_exports.startSpan(
|
|
639
641
|
{
|
|
640
642
|
name,
|
|
641
643
|
op,
|
|
@@ -649,7 +651,7 @@ async function withSpan(name, op, context, callback, attributes = {}) {
|
|
|
649
651
|
);
|
|
650
652
|
}
|
|
651
653
|
function setSpanAttributes(attributes) {
|
|
652
|
-
const sentry =
|
|
654
|
+
const sentry = sentry_exports;
|
|
653
655
|
const span = sentry.getActiveSpan?.();
|
|
654
656
|
if (!span) {
|
|
655
657
|
return;
|
|
@@ -666,7 +668,7 @@ function setSpanAttributes(attributes) {
|
|
|
666
668
|
}
|
|
667
669
|
}
|
|
668
670
|
function setSpanStatus(status) {
|
|
669
|
-
const sentry =
|
|
671
|
+
const sentry = sentry_exports;
|
|
670
672
|
const span = sentry.getActiveSpan?.();
|
|
671
673
|
if (!span) {
|
|
672
674
|
return;
|
|
@@ -681,7 +683,7 @@ function toOptionalString(value) {
|
|
|
681
683
|
return typeof value === "string" && value.trim() ? value : void 0;
|
|
682
684
|
}
|
|
683
685
|
function getActiveTraceId() {
|
|
684
|
-
const sentry =
|
|
686
|
+
const sentry = sentry_exports;
|
|
685
687
|
if (typeof sentry.getActiveSpan !== "function" || typeof sentry.spanToJSON !== "function") {
|
|
686
688
|
return void 0;
|
|
687
689
|
}
|
package/dist/cli/check.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSkillFile
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-WELSSJJU.js";
|
|
4
4
|
import {
|
|
5
5
|
parsePluginManifest
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-ZYB3U7Q4.js";
|
|
7
|
+
import "../chunk-Z3YD6NHK.js";
|
|
8
|
+
import "../chunk-XH7TV4JS.js";
|
|
9
|
+
import "../chunk-2KG3PWR4.js";
|
|
8
10
|
|
|
9
11
|
// src/cli/check.ts
|
|
10
12
|
import fs from "fs/promises";
|
package/dist/cli/env.js
CHANGED
package/dist/cli/init.js
CHANGED
|
@@ -1,33 +1,45 @@
|
|
|
1
|
+
import "../chunk-2KG3PWR4.js";
|
|
2
|
+
|
|
1
3
|
// src/cli/init.ts
|
|
2
4
|
import fs from "fs";
|
|
3
5
|
import path from "path";
|
|
4
|
-
function
|
|
6
|
+
function writeServerEntry(targetDir) {
|
|
5
7
|
fs.writeFileSync(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
path.join(targetDir, "server.ts"),
|
|
9
|
+
`import { initSentry } from "@sentry/junior/instrumentation";
|
|
10
|
+
initSentry();
|
|
11
|
+
|
|
12
|
+
import { createApp } from "@sentry/junior";
|
|
13
|
+
|
|
14
|
+
const app = await createApp();
|
|
15
|
+
|
|
16
|
+
export default app;
|
|
9
17
|
`
|
|
10
18
|
);
|
|
11
19
|
}
|
|
12
|
-
function
|
|
13
|
-
const routeDir = path.join(targetDir, "app", "api", "[...path]");
|
|
14
|
-
fs.mkdirSync(routeDir, { recursive: true });
|
|
15
|
-
writeRouteModule(
|
|
16
|
-
path.join(routeDir, "route.js"),
|
|
17
|
-
'export { GET, POST } from "@sentry/junior/handler";'
|
|
18
|
-
);
|
|
19
|
-
fs.mkdirSync(path.join(targetDir, "app"), { recursive: true });
|
|
20
|
-
fs.writeFileSync(
|
|
21
|
-
path.join(targetDir, "app", "layout.js"),
|
|
22
|
-
'export { default } from "@sentry/junior/app/layout";\n'
|
|
23
|
-
);
|
|
20
|
+
function writeNitroConfig(targetDir) {
|
|
24
21
|
fs.writeFileSync(
|
|
25
|
-
path.join(targetDir, "
|
|
26
|
-
|
|
22
|
+
path.join(targetDir, "nitro.config.ts"),
|
|
23
|
+
`import { juniorNitroConfig } from "@sentry/junior/nitro";
|
|
24
|
+
import { defineConfig } from "nitro";
|
|
25
|
+
|
|
26
|
+
export default defineConfig(juniorNitroConfig());
|
|
27
|
+
`
|
|
27
28
|
);
|
|
29
|
+
}
|
|
30
|
+
function writeViteConfig(targetDir) {
|
|
28
31
|
fs.writeFileSync(
|
|
29
|
-
path.join(targetDir, "
|
|
30
|
-
|
|
32
|
+
path.join(targetDir, "vite.config.ts"),
|
|
33
|
+
`import { defineConfig } from "vite";
|
|
34
|
+
import { nitro } from "nitro/vite";
|
|
35
|
+
|
|
36
|
+
export default defineConfig({
|
|
37
|
+
server: {
|
|
38
|
+
allowedHosts: true,
|
|
39
|
+
},
|
|
40
|
+
plugins: [nitro()],
|
|
41
|
+
});
|
|
42
|
+
`
|
|
31
43
|
);
|
|
32
44
|
}
|
|
33
45
|
async function runInit(dir, log = console.log) {
|
|
@@ -54,16 +66,18 @@ async function runInit(dir, log = console.log) {
|
|
|
54
66
|
private: true,
|
|
55
67
|
type: "module",
|
|
56
68
|
scripts: {
|
|
57
|
-
dev: "
|
|
58
|
-
build: "
|
|
59
|
-
start: "next start"
|
|
69
|
+
dev: "vite dev",
|
|
70
|
+
build: "junior snapshot create && vite build"
|
|
60
71
|
},
|
|
61
72
|
dependencies: {
|
|
62
73
|
"@sentry/junior": "latest",
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
"@sentry/node": "^10.0.0",
|
|
75
|
+
hono: "^4.12.0"
|
|
76
|
+
},
|
|
77
|
+
devDependencies: {
|
|
78
|
+
nitro: "3.0.260311-beta",
|
|
79
|
+
typescript: "^5.9.0",
|
|
80
|
+
vite: "^8.0.0"
|
|
67
81
|
}
|
|
68
82
|
};
|
|
69
83
|
fs.writeFileSync(
|
|
@@ -71,46 +85,52 @@ async function runInit(dir, log = console.log) {
|
|
|
71
85
|
`${JSON.stringify(pkg, null, 2)}
|
|
72
86
|
`
|
|
73
87
|
);
|
|
74
|
-
const
|
|
75
|
-
fs.mkdirSync(
|
|
88
|
+
const appDir = path.join(target, "app");
|
|
89
|
+
fs.mkdirSync(appDir, { recursive: true });
|
|
76
90
|
fs.writeFileSync(
|
|
77
|
-
path.join(
|
|
91
|
+
path.join(appDir, "SOUL.md"),
|
|
78
92
|
`# ${name}
|
|
79
93
|
|
|
80
94
|
You are ${name}, a helpful assistant.
|
|
81
95
|
`
|
|
82
96
|
);
|
|
83
97
|
fs.writeFileSync(
|
|
84
|
-
path.join(
|
|
98
|
+
path.join(appDir, "ABOUT.md"),
|
|
85
99
|
`# About ${name}
|
|
86
100
|
|
|
87
101
|
Describe what ${name} helps users do.
|
|
88
102
|
`
|
|
89
103
|
);
|
|
90
|
-
const skillsDir = path.join(
|
|
104
|
+
const skillsDir = path.join(appDir, "skills");
|
|
91
105
|
fs.mkdirSync(skillsDir, { recursive: true });
|
|
92
106
|
fs.writeFileSync(path.join(skillsDir, ".gitkeep"), "");
|
|
93
|
-
const pluginsDir = path.join(
|
|
107
|
+
const pluginsDir = path.join(appDir, "plugins");
|
|
94
108
|
fs.mkdirSync(pluginsDir, { recursive: true });
|
|
95
109
|
fs.writeFileSync(path.join(pluginsDir, ".gitkeep"), "");
|
|
96
110
|
fs.writeFileSync(
|
|
97
111
|
path.join(target, ".gitignore"),
|
|
98
|
-
|
|
112
|
+
`node_modules/
|
|
113
|
+
.vercel/
|
|
114
|
+
.output/
|
|
115
|
+
.nitro/
|
|
116
|
+
.env
|
|
117
|
+
.env.local
|
|
118
|
+
`
|
|
99
119
|
);
|
|
100
120
|
fs.writeFileSync(
|
|
101
121
|
path.join(target, ".env.example"),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
""
|
|
111
|
-
].join("\n")
|
|
122
|
+
`SLACK_BOT_TOKEN=
|
|
123
|
+
SLACK_SIGNING_SECRET=
|
|
124
|
+
JUNIOR_BOT_NAME=
|
|
125
|
+
AI_MODEL=
|
|
126
|
+
AI_FAST_MODEL=
|
|
127
|
+
REDIS_URL=
|
|
128
|
+
SENTRY_DSN=
|
|
129
|
+
`
|
|
112
130
|
);
|
|
113
|
-
|
|
131
|
+
writeServerEntry(target);
|
|
132
|
+
writeNitroConfig(target);
|
|
133
|
+
writeViteConfig(target);
|
|
114
134
|
log(`Created ${name} at ${target}`);
|
|
115
135
|
log("");
|
|
116
136
|
log(` cd ${targetDir} && pnpm install && pnpm dev`);
|
package/dist/cli/run.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
disconnectStateAdapter,
|
|
3
3
|
resolveRuntimeDependencySnapshot
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-IRE2LOEJ.js";
|
|
5
5
|
import {
|
|
6
6
|
getPluginProviders,
|
|
7
7
|
getPluginRuntimeDependencies,
|
|
8
8
|
getPluginRuntimePostinstall
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-ZYB3U7Q4.js";
|
|
10
|
+
import "../chunk-Z3YD6NHK.js";
|
|
11
|
+
import "../chunk-XH7TV4JS.js";
|
|
12
|
+
import "../chunk-2KG3PWR4.js";
|
|
11
13
|
|
|
12
14
|
// src/cli/snapshot-warmup.ts
|
|
13
15
|
var DEFAULT_RUNTIME = "node22";
|
|
@@ -80,6 +82,10 @@ function logSnapshotProfile(log) {
|
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
async function runSnapshotCreate(log = console.log) {
|
|
85
|
+
if (process.env.JUNIOR_SKIP_SNAPSHOT === "1") {
|
|
86
|
+
log("Skipping sandbox snapshot create (JUNIOR_SKIP_SNAPSHOT=1)");
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
83
89
|
const runtime = DEFAULT_RUNTIME;
|
|
84
90
|
const timeoutMs = DEFAULT_TIMEOUT_MS;
|
|
85
91
|
try {
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/** Initialize Sentry for the Junior runtime. Call at the top of your entry point. */
|
|
2
|
+
declare function initSentry(): void;
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
* Initializes Sentry for Next.js runtime contexts used by Junior.
|
|
5
|
-
*/
|
|
6
|
-
declare function register(): Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* Re-export of Sentry request error handler for Next.js instrumentation wiring.
|
|
9
|
-
*/
|
|
10
|
-
declare const onRequestError: typeof Sentry.captureRequestError;
|
|
11
|
-
|
|
12
|
-
export { onRequestError, register };
|
|
4
|
+
export { initSentry };
|
package/dist/instrumentation.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sentry_exports
|
|
3
|
+
} from "./chunk-Z3YD6NHK.js";
|
|
4
|
+
import "./chunk-2KG3PWR4.js";
|
|
5
|
+
|
|
1
6
|
// src/instrumentation.ts
|
|
2
|
-
import * as Sentry from "@sentry/nextjs";
|
|
3
7
|
function getSampleRate(value, fallback) {
|
|
4
8
|
if (!value) return fallback;
|
|
5
9
|
const parsed = Number(value);
|
|
@@ -12,38 +16,25 @@ function getBoolean(value, fallback) {
|
|
|
12
16
|
if (["0", "false", "no", "off"].includes(normalized)) return false;
|
|
13
17
|
return fallback;
|
|
14
18
|
}
|
|
15
|
-
function
|
|
16
|
-
const dsn = process.env.SENTRY_DSN
|
|
19
|
+
function initSentry() {
|
|
20
|
+
const dsn = process.env.SENTRY_DSN;
|
|
17
21
|
const enableLogs = getBoolean(process.env.SENTRY_ENABLE_LOGS, Boolean(dsn));
|
|
18
|
-
|
|
22
|
+
sentry_exports.init({
|
|
19
23
|
dsn,
|
|
20
24
|
environment: process.env.SENTRY_ENVIRONMENT ?? process.env.VERCEL_ENV ?? process.env.NODE_ENV,
|
|
21
25
|
release: process.env.SENTRY_RELEASE ?? process.env.VERCEL_GIT_COMMIT_SHA,
|
|
22
26
|
tracesSampleRate: getSampleRate(process.env.SENTRY_TRACES_SAMPLE_RATE, 1),
|
|
23
27
|
sendDefaultPii: true,
|
|
24
28
|
enabled: Boolean(dsn),
|
|
25
|
-
enableLogs
|
|
26
|
-
|
|
29
|
+
enableLogs,
|
|
30
|
+
integrations: [
|
|
31
|
+
sentry_exports.vercelAIIntegration({
|
|
32
|
+
recordInputs: true,
|
|
33
|
+
recordOutputs: true
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
});
|
|
27
37
|
}
|
|
28
|
-
async function register() {
|
|
29
|
-
if (process.env.NEXT_RUNTIME === "nodejs") {
|
|
30
|
-
Sentry.init({
|
|
31
|
-
...getCommonOptions(),
|
|
32
|
-
integrations: [
|
|
33
|
-
Sentry.vercelAIIntegration({
|
|
34
|
-
recordInputs: true,
|
|
35
|
-
recordOutputs: true
|
|
36
|
-
})
|
|
37
|
-
]
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (process.env.NEXT_RUNTIME === "edge") {
|
|
42
|
-
Sentry.init(getCommonOptions());
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
var onRequestError = Sentry.captureRequestError;
|
|
46
38
|
export {
|
|
47
|
-
|
|
48
|
-
register
|
|
39
|
+
initSentry
|
|
49
40
|
};
|
package/dist/nitro.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface JuniorNitroConfigOptions {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
maxDuration?: number;
|
|
4
|
+
}
|
|
5
|
+
/** Return the default Nitro config used by scaffolded Junior apps. */
|
|
6
|
+
declare function juniorNitroConfig(options?: JuniorNitroConfigOptions): {
|
|
7
|
+
preset: "vercel";
|
|
8
|
+
vercel: {
|
|
9
|
+
functions: {
|
|
10
|
+
maxDuration: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
hooks: {
|
|
14
|
+
compiled(): void;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { type JuniorNitroConfigOptions, juniorNitroConfig };
|
package/dist/nitro.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
discoverInstalledPluginPackageContent
|
|
3
|
+
} from "./chunk-XH7TV4JS.js";
|
|
4
|
+
import "./chunk-2KG3PWR4.js";
|
|
5
|
+
|
|
6
|
+
// src/nitro.ts
|
|
7
|
+
import { cpSync, existsSync, mkdirSync } from "fs";
|
|
8
|
+
import path from "path";
|
|
9
|
+
function copyIfExists(source, target) {
|
|
10
|
+
if (!existsSync(source)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
mkdirSync(path.dirname(target), { recursive: true });
|
|
14
|
+
cpSync(source, target, { recursive: true });
|
|
15
|
+
}
|
|
16
|
+
function copyRootIntoServerOutput(cwd, serverRoot, root) {
|
|
17
|
+
const relative = path.relative(cwd, root);
|
|
18
|
+
if (!relative || path.isAbsolute(relative) || relative.startsWith("..")) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
copyIfExists(root, path.join(serverRoot, relative));
|
|
22
|
+
}
|
|
23
|
+
function juniorNitroConfig(options = {}) {
|
|
24
|
+
const cwd = path.resolve(options.cwd ?? process.cwd());
|
|
25
|
+
return {
|
|
26
|
+
preset: "vercel",
|
|
27
|
+
vercel: {
|
|
28
|
+
functions: {
|
|
29
|
+
maxDuration: options.maxDuration ?? 800
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
hooks: {
|
|
33
|
+
compiled() {
|
|
34
|
+
const serverRoot = path.join(
|
|
35
|
+
cwd,
|
|
36
|
+
".vercel/output/functions/__server.func"
|
|
37
|
+
);
|
|
38
|
+
copyIfExists(path.join(cwd, "app"), path.join(serverRoot, "app"));
|
|
39
|
+
const packagedContent = discoverInstalledPluginPackageContent(cwd);
|
|
40
|
+
for (const root of packagedContent.manifestRoots) {
|
|
41
|
+
if (existsSync(path.join(root, "plugin.yaml"))) {
|
|
42
|
+
copyIfExists(
|
|
43
|
+
path.join(root, "plugin.yaml"),
|
|
44
|
+
path.join(serverRoot, path.relative(cwd, root), "plugin.yaml")
|
|
45
|
+
);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
copyRootIntoServerOutput(cwd, serverRoot, root);
|
|
49
|
+
}
|
|
50
|
+
for (const root of packagedContent.skillRoots) {
|
|
51
|
+
copyRootIntoServerOutput(cwd, serverRoot, root);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
juniorNitroConfig
|
|
59
|
+
};
|