@sentry/junior 0.8.0 → 0.9.1
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/chunk-7GLBFSWP.js +839 -0
- package/dist/{chunk-OGLG4WAL.js → chunk-JNHYSCAO.js} +11346 -9421
- package/dist/{chunk-Z5E25LRN.js → chunk-KCLEEKYX.js} +124 -17
- package/dist/{chunk-NNYZHUWR.js → chunk-T7BIFBYH.js} +15 -6
- package/dist/chunk-UPCIISWE.js +678 -0
- package/dist/chunk-VM3CPAZF.js +448 -0
- package/dist/chunk-ZBWWHP6Q.js +1436 -0
- package/dist/{chunk-PY4AI2GZ.js → chunk-ZW4OVKF5.js} +376 -79
- package/dist/cli/check.js +4 -2
- package/dist/cli/snapshot-warmup.js +7 -6
- package/dist/handlers/queue-callback.js +7 -7
- package/dist/handlers/router.d.ts +1 -0
- package/dist/handlers/router.js +523 -85
- package/dist/handlers/webhooks.js +2 -2
- package/dist/next-config.js +1 -1
- package/dist/production-PPQEQOPO.js +15 -0
- package/package.json +12 -14
- package/dist/bot-7SE3TX37.js +0 -19
- package/dist/chunk-H3ZG43WE.js +0 -330
- package/dist/chunk-KT5HARSN.js +0 -164
- package/dist/chunk-RKOO42TW.js +0 -1797
- package/dist/chunk-VW26MOSO.js +0 -522
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
// src/chat/
|
|
2
|
-
import { statSync } from "fs";
|
|
1
|
+
// src/chat/discovery.ts
|
|
2
|
+
import fs, { readdirSync, statSync } from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
3
5
|
function isDirectory(targetPath) {
|
|
4
6
|
try {
|
|
5
7
|
return statSync(targetPath).isDirectory();
|
|
@@ -14,11 +16,6 @@ function isFile(targetPath) {
|
|
|
14
16
|
return false;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
|
-
|
|
18
|
-
// src/chat/discovery-roots.ts
|
|
19
|
-
import { readdirSync } from "fs";
|
|
20
|
-
import path from "path";
|
|
21
|
-
import { fileURLToPath } from "url";
|
|
22
19
|
function normalizePath(targetPath) {
|
|
23
20
|
return path.resolve(targetPath);
|
|
24
21
|
}
|
|
@@ -95,11 +92,16 @@ function discoverNodeModulesDirs(cwd = process.cwd(), options) {
|
|
|
95
92
|
]);
|
|
96
93
|
}
|
|
97
94
|
function discoverProjectRoots(cwd = process.cwd(), options) {
|
|
98
|
-
const roots = discoverNodeModulesDirs(
|
|
95
|
+
const roots = discoverNodeModulesDirs(
|
|
96
|
+
cwd,
|
|
97
|
+
options?.nodeModulesDirs ? { candidateDirs: options.nodeModulesDirs } : void 0
|
|
98
|
+
).map((nodeModulesDir) => path.dirname(nodeModulesDir));
|
|
99
99
|
return uniqueResolvedPathsInOrder([cwd, ...roots]);
|
|
100
100
|
}
|
|
101
101
|
function listTopLevelPackages(nodeModulesDir) {
|
|
102
|
-
const entries = readdirSync(nodeModulesDir, { withFileTypes: true }).filter(
|
|
102
|
+
const entries = readdirSync(nodeModulesDir, { withFileTypes: true }).filter(
|
|
103
|
+
(entry) => !entry.name.startsWith(".") && entry.name !== ".bin" && entry.name !== ".pnpm"
|
|
104
|
+
).sort((left, right) => left.name.localeCompare(right.name));
|
|
103
105
|
const packages = [];
|
|
104
106
|
for (const entry of entries) {
|
|
105
107
|
const entryPath = path.join(nodeModulesDir, entry.name);
|
|
@@ -107,9 +109,9 @@ function listTopLevelPackages(nodeModulesDir) {
|
|
|
107
109
|
if (!isDirectory(entryPath)) {
|
|
108
110
|
continue;
|
|
109
111
|
}
|
|
110
|
-
const scopedEntries = readdirSync(entryPath, {
|
|
111
|
-
|
|
112
|
-
);
|
|
112
|
+
const scopedEntries = readdirSync(entryPath, {
|
|
113
|
+
withFileTypes: true
|
|
114
|
+
}).sort((left, right) => left.name.localeCompare(right.name));
|
|
113
115
|
for (const scopedEntry of scopedEntries) {
|
|
114
116
|
const packageName = `${entry.name}/${scopedEntry.name}`;
|
|
115
117
|
const packagePath = path.join(entryPath, scopedEntry.name);
|
|
@@ -127,6 +129,107 @@ function listTopLevelPackages(nodeModulesDir) {
|
|
|
127
129
|
}
|
|
128
130
|
return packages;
|
|
129
131
|
}
|
|
132
|
+
function unique(values) {
|
|
133
|
+
return [...new Set(values)];
|
|
134
|
+
}
|
|
135
|
+
function pathExists(targetPath) {
|
|
136
|
+
try {
|
|
137
|
+
fs.accessSync(targetPath);
|
|
138
|
+
return true;
|
|
139
|
+
} catch {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function hasAnyDataMarkers(appDir) {
|
|
144
|
+
return pathExists(path.join(appDir, "SOUL.md")) || pathExists(path.join(appDir, "ABOUT.md"));
|
|
145
|
+
}
|
|
146
|
+
function scoreAppCandidate(appDir) {
|
|
147
|
+
let score = 0;
|
|
148
|
+
if (pathExists(path.join(appDir, "SOUL.md"))) {
|
|
149
|
+
score += 4;
|
|
150
|
+
}
|
|
151
|
+
if (pathExists(path.join(appDir, "ABOUT.md"))) {
|
|
152
|
+
score += 2;
|
|
153
|
+
}
|
|
154
|
+
if (pathExists(path.join(appDir, "skills"))) {
|
|
155
|
+
score += 1;
|
|
156
|
+
}
|
|
157
|
+
if (pathExists(path.join(appDir, "plugins"))) {
|
|
158
|
+
score += 1;
|
|
159
|
+
}
|
|
160
|
+
return score;
|
|
161
|
+
}
|
|
162
|
+
function resolveCandidateAppDirs(cwd, projectRoots) {
|
|
163
|
+
const roots = projectRoots ?? discoverProjectRoots(cwd);
|
|
164
|
+
const resolved = [];
|
|
165
|
+
const seen = /* @__PURE__ */ new Set();
|
|
166
|
+
for (const root of roots) {
|
|
167
|
+
const appDir = path.resolve(root, "app");
|
|
168
|
+
if (!pathExists(appDir)) {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (seen.has(appDir)) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
seen.add(appDir);
|
|
175
|
+
resolved.push(appDir);
|
|
176
|
+
}
|
|
177
|
+
return resolved;
|
|
178
|
+
}
|
|
179
|
+
function homeDir() {
|
|
180
|
+
return resolveHomeDir();
|
|
181
|
+
}
|
|
182
|
+
function resolveHomeDir(cwd = process.cwd(), options) {
|
|
183
|
+
const resolvedCwd = path.resolve(cwd);
|
|
184
|
+
const directApp = path.resolve(resolvedCwd, "app");
|
|
185
|
+
if (pathExists(directApp) && hasAnyDataMarkers(directApp)) {
|
|
186
|
+
return directApp;
|
|
187
|
+
}
|
|
188
|
+
const candidates = resolveCandidateAppDirs(
|
|
189
|
+
resolvedCwd,
|
|
190
|
+
options?.projectRoots
|
|
191
|
+
);
|
|
192
|
+
if (candidates.length === 0) {
|
|
193
|
+
return directApp;
|
|
194
|
+
}
|
|
195
|
+
candidates.sort((left, right) => {
|
|
196
|
+
const leftScore = scoreAppCandidate(left);
|
|
197
|
+
const rightScore = scoreAppCandidate(right);
|
|
198
|
+
if (leftScore !== rightScore) {
|
|
199
|
+
return rightScore - leftScore;
|
|
200
|
+
}
|
|
201
|
+
const leftDistance = path.relative(resolvedCwd, left).split(path.sep).length;
|
|
202
|
+
const rightDistance = path.relative(resolvedCwd, right).split(path.sep).length;
|
|
203
|
+
if (leftDistance !== rightDistance) {
|
|
204
|
+
return leftDistance - rightDistance;
|
|
205
|
+
}
|
|
206
|
+
return left.localeCompare(right);
|
|
207
|
+
});
|
|
208
|
+
return candidates[0];
|
|
209
|
+
}
|
|
210
|
+
function resolveContentRoots(subdir) {
|
|
211
|
+
if (subdir === "data") {
|
|
212
|
+
return [homeDir()];
|
|
213
|
+
}
|
|
214
|
+
return [path.join(homeDir(), subdir)];
|
|
215
|
+
}
|
|
216
|
+
function dataRoots() {
|
|
217
|
+
return unique(resolveContentRoots("data"));
|
|
218
|
+
}
|
|
219
|
+
function skillRoots() {
|
|
220
|
+
return unique(resolveContentRoots("skills"));
|
|
221
|
+
}
|
|
222
|
+
function pluginRoots() {
|
|
223
|
+
return unique(resolveContentRoots("plugins"));
|
|
224
|
+
}
|
|
225
|
+
function soulPathCandidates() {
|
|
226
|
+
const candidates = dataRoots().map((root) => path.join(root, "SOUL.md"));
|
|
227
|
+
return unique(candidates);
|
|
228
|
+
}
|
|
229
|
+
function aboutPathCandidates() {
|
|
230
|
+
const candidates = dataRoots().map((root) => path.join(root, "ABOUT.md"));
|
|
231
|
+
return unique(candidates);
|
|
232
|
+
}
|
|
130
233
|
|
|
131
234
|
// src/chat/plugins/package-discovery.ts
|
|
132
235
|
import { readFileSync, readdirSync as readdirSync2 } from "fs";
|
|
@@ -380,7 +483,7 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
380
483
|
configuredPackageNames
|
|
381
484
|
);
|
|
382
485
|
const manifestRoots = [];
|
|
383
|
-
const
|
|
486
|
+
const skillRoots2 = [];
|
|
384
487
|
const tracingIncludes = [];
|
|
385
488
|
for (const pkg of discoveredPackages) {
|
|
386
489
|
const tracingBasePath = pkg.nodeModulesDir ? pathForTracingInclude(
|
|
@@ -400,7 +503,7 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
400
503
|
}
|
|
401
504
|
}
|
|
402
505
|
if (pkg.hasSkillsDir) {
|
|
403
|
-
|
|
506
|
+
skillRoots2.push(path2.join(pkg.dir, "skills"));
|
|
404
507
|
if (tracingBasePath) {
|
|
405
508
|
tracingIncludes.push(`${tracingBasePath}/skills/**/*`);
|
|
406
509
|
}
|
|
@@ -421,7 +524,7 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
421
524
|
}
|
|
422
525
|
}
|
|
423
526
|
if (isDirectory(path2.join(pluginDir, "skills"))) {
|
|
424
|
-
|
|
527
|
+
skillRoots2.push(path2.join(pluginDir, "skills"));
|
|
425
528
|
if (tracingBasePath) {
|
|
426
529
|
tracingIncludes.push(`${tracingBasePath}/skills/**/*`);
|
|
427
530
|
}
|
|
@@ -432,7 +535,7 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
432
535
|
discoveredPackages.map((pkg) => pkg.name)
|
|
433
536
|
),
|
|
434
537
|
manifestRoots: uniqueStringsInOrder(manifestRoots),
|
|
435
|
-
skillRoots: uniqueStringsInOrder(
|
|
538
|
+
skillRoots: uniqueStringsInOrder(skillRoots2),
|
|
436
539
|
tracingIncludes: uniqueStringsInOrder(tracingIncludes)
|
|
437
540
|
};
|
|
438
541
|
}
|
|
@@ -440,6 +543,10 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
440
543
|
export {
|
|
441
544
|
isDirectory,
|
|
442
545
|
discoverNodeModulesDirs,
|
|
443
|
-
|
|
546
|
+
homeDir,
|
|
547
|
+
skillRoots,
|
|
548
|
+
pluginRoots,
|
|
549
|
+
soulPathCandidates,
|
|
550
|
+
aboutPathCandidates,
|
|
444
551
|
discoverInstalledPluginPackageContent
|
|
445
552
|
};
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
setSpanStatus,
|
|
7
7
|
withContext,
|
|
8
8
|
withSpan
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZW4OVKF5.js";
|
|
10
10
|
|
|
11
11
|
// src/handlers/webhooks.ts
|
|
12
12
|
import { after } from "next/server";
|
|
13
13
|
import * as Sentry from "@sentry/nextjs";
|
|
14
14
|
async function loadBot() {
|
|
15
|
-
const { bot } = await import("./
|
|
15
|
+
const { bot } = await import("./production-PPQEQOPO.js");
|
|
16
16
|
return bot;
|
|
17
17
|
}
|
|
18
18
|
async function POST(request, context) {
|
|
@@ -24,9 +24,15 @@ async function POST(request, context) {
|
|
|
24
24
|
return withContext(requestContext, async () => {
|
|
25
25
|
if (!handler) {
|
|
26
26
|
const error = new Error(`Unknown platform: ${platform}`);
|
|
27
|
-
logException(
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
logException(
|
|
28
|
+
error,
|
|
29
|
+
"webhook_platform_unknown",
|
|
30
|
+
{},
|
|
31
|
+
{
|
|
32
|
+
"http.response.status_code": 404
|
|
33
|
+
},
|
|
34
|
+
`Unknown platform: ${platform}`
|
|
35
|
+
);
|
|
30
36
|
return new Response(`Unknown platform: ${platform}`, { status: 404 });
|
|
31
37
|
}
|
|
32
38
|
try {
|
|
@@ -52,7 +58,10 @@ async function POST(request, context) {
|
|
|
52
58
|
if (response.status >= 400) {
|
|
53
59
|
let responseBodySnippet;
|
|
54
60
|
try {
|
|
55
|
-
responseBodySnippet = (await response.clone().text()).slice(
|
|
61
|
+
responseBodySnippet = (await response.clone().text()).slice(
|
|
62
|
+
0,
|
|
63
|
+
300
|
|
64
|
+
);
|
|
56
65
|
} catch {
|
|
57
66
|
responseBodySnippet = void 0;
|
|
58
67
|
}
|