@sentry/junior 0.96.0 → 0.97.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/{agent-hooks-5URSMY3O.js → agent-hooks-XSUIVRQS.js} +8 -6
- package/dist/{reporting → api}/conversations/activity.d.ts +1 -1
- package/dist/api/conversations/detail-projection.d.ts +10 -0
- package/dist/api/conversations/detail.d.ts +3 -0
- package/dist/api/conversations/detail.query.d.ts +3 -0
- package/dist/api/conversations/list.d.ts +3 -0
- package/dist/api/conversations/list.query.d.ts +94 -0
- package/dist/api/conversations/projection.d.ts +14 -0
- package/dist/api/conversations/schema.d.ts +683 -0
- package/dist/{reporting → api}/conversations/shared.d.ts +1 -5
- package/dist/api/conversations/stats.d.ts +3 -0
- package/dist/api/conversations/stats.query.d.ts +3 -0
- package/dist/api/conversations/subagent.d.ts +3 -0
- package/dist/{reporting → api}/conversations/transcript.d.ts +4 -4
- package/dist/api/people/list.d.ts +1 -2
- package/dist/api/people/list.query.d.ts +3 -4
- package/dist/api/people/profile.d.ts +1 -2
- package/dist/api/people/profile.query.d.ts +3 -4
- package/dist/api/people/schema.d.ts +193 -0
- package/dist/api/people/shared.d.ts +31 -9
- package/dist/api/schema.d.ts +20 -0
- package/dist/api/schema.js +50 -0
- package/dist/api-reference.d.ts +4 -3
- package/dist/api.d.ts +3 -0
- package/dist/api.js +156 -0
- package/dist/app.d.ts +1 -4
- package/dist/app.js +101 -367
- package/dist/build/virtual-config.d.ts +2 -2
- package/dist/{catalog-runtime-MSMAYYIK.js → catalog-runtime-PFHVMHDR.js} +3 -2
- package/dist/chat/agent/resume.d.ts +3 -1
- package/dist/chat/agent/tools.d.ts +2 -1
- package/dist/chat/config.d.ts +1 -8
- package/dist/chat/conversations/history.d.ts +241 -27
- package/dist/chat/conversations/legacy-advisor-session.d.ts +7 -0
- package/dist/chat/conversations/legacy-import.d.ts +2 -2
- package/dist/chat/conversations/projection.d.ts +19 -3
- package/dist/chat/conversations/sql/legacy-history-import.d.ts +1 -1
- package/dist/chat/conversations/sql/store.d.ts +15 -9
- package/dist/chat/conversations/store.d.ts +9 -4
- package/dist/chat/model-profile.d.ts +14 -0
- package/dist/chat/pi/transcript.d.ts +5 -3
- package/dist/chat/resource-events/store.d.ts +2 -2
- package/dist/chat/services/context-compaction.d.ts +15 -0
- package/dist/chat/services/turn-result.d.ts +1 -0
- package/dist/chat/services/turn-session-record.d.ts +6 -6
- package/dist/chat/state/turn-session.d.ts +16 -5
- package/dist/chat/task-execution/store.d.ts +2 -2
- package/dist/chat/tools/handoff/tool.d.ts +45 -0
- package/dist/chat/tools/types.d.ts +7 -2
- package/dist/chat/usage.d.ts +25 -25
- package/dist/{chunk-RITD7E5L.js → chunk-35BNLDOJ.js} +338 -577
- package/dist/{chunk-PMNN6ST4.js → chunk-3ECW2K2O.js} +7 -2
- package/dist/{chunk-5C6XTTFI.js → chunk-3F4OPKGF.js} +89 -55
- package/dist/chunk-3V7OFJZC.js +264 -0
- package/dist/chunk-4ZNGQH7C.js +25 -0
- package/dist/{chunk-S5KZ5LPG.js → chunk-5HLDPVYS.js} +14 -447
- package/dist/{chunk-DZENG5ML.js → chunk-6U26PYI5.js} +24 -14
- package/dist/chunk-AUUCAFDE.js +546 -0
- package/dist/{chunk-6APU57E6.js → chunk-B3IT5END.js} +41 -260
- package/dist/chunk-CEA3A3UA.js +86 -0
- package/dist/{chunk-YDT7SNCN.js → chunk-D5KZYS4T.js} +1 -1
- package/dist/{chunk-YDVEH3SB.js → chunk-EEZCY5WX.js} +78 -28
- package/dist/{chunk-2NAZZPPS.js → chunk-EOWXRY5E.js} +1 -1
- package/dist/{chunk-GQ3GK22G.js → chunk-FBHZJFHI.js} +2 -2
- package/dist/{chunk-CZEX6KIQ.js → chunk-G3E7SCME.js} +0 -23
- package/dist/chunk-GUAP3H7O.js +319 -0
- package/dist/{chunk-BYZWPRJA.js → chunk-H66UCBPW.js} +6 -4
- package/dist/{chunk-L7CDEIVJ.js → chunk-LMJPRYHP.js} +4 -2
- package/dist/chunk-LUAE4MGW.js +199 -0
- package/dist/{chunk-GY34VGP5.js → chunk-LVA4I4H7.js} +3 -1
- package/dist/chunk-LVUKF5CE.js +63 -0
- package/dist/{chunk-AAZXTVJT.js → chunk-NG2AV7IB.js} +2 -72
- package/dist/chunk-ON6YKIQ7.js +260 -0
- package/dist/chunk-PDO5BLNM.js +22 -0
- package/dist/chunk-QNVHH5PU.js +20 -0
- package/dist/{chunk-P3YFQLEN.js → chunk-T533JLM3.js} +8 -10
- package/dist/chunk-UAMKJPDF.js +11 -0
- package/dist/chunk-VFH4ZKZT.js +66 -0
- package/dist/{chunk-UKHVMPX5.js → chunk-WGXMTFNU.js} +15 -17
- package/dist/{chunk-MNTINMWR.js → chunk-WJOSZOON.js} +184 -300
- package/dist/chunk-WTYEKPXU.js +451 -0
- package/dist/{chunk-IYM2SIVG.js → chunk-XIRPQQVE.js} +605 -363
- package/dist/cli/chat.js +24 -21
- package/dist/cli/check.js +4 -3
- package/dist/cli/init.js +12 -0
- package/dist/cli/plugins.js +12 -9
- package/dist/cli/snapshot-warmup.js +8 -6
- package/dist/cli/upgrade.js +265 -137
- package/dist/db/db.d.ts +4 -0
- package/dist/db/schema/conversations.d.ts +128 -0
- package/dist/db/schema.d.ts +129 -60
- package/dist/{db-2D6RMG67.js → db-BWXYIKFQ.js} +3 -3
- package/dist/detail-GA6NXWQJ.js +43 -0
- package/dist/discovery-RMHYSRL7.js +43 -0
- package/dist/handlers/health.d.ts +3 -0
- package/dist/instrumentation.js +1 -1
- package/dist/{legacy-import-VZ2MEGP7.js → legacy-import-3NQJVGQL.js} +4 -4
- package/dist/{api/people/list.js → list-A3WFRIYX.js} +26 -16
- package/dist/list-UXJI5Q5X.js +27 -0
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +2 -1
- package/dist/plugin-conversations-DDNGC35A.js +36 -0
- package/dist/{api/people/profile.js → profile-4RYDXWTF.js} +33 -18
- package/dist/reporting/plugin-conversations.d.ts +3 -0
- package/dist/reporting-schema.d.ts +140 -0
- package/dist/reporting.d.ts +12 -81
- package/dist/{runner-JZBRQP4F.js → runner-JALSYH2P.js} +17 -12
- package/dist/skills-MAZXZ2KE.js +26 -0
- package/dist/stats-XKXH3PTY.js +217 -0
- package/dist/subagent-TZ55XY37.js +48 -0
- package/dist/usage-schema.d.ts +25 -0
- package/dist/{validation-6XOOQGME.js → validation-FMEAEKCY.js} +4 -3
- package/migrations/0000_initial.sql +115 -0
- package/migrations/0001_conversation_metrics.sql +4 -0
- package/migrations/README.md +12 -30
- package/migrations/meta/0000_snapshot.json +1 -33
- package/migrations/meta/0001_snapshot.json +972 -0
- package/migrations/meta/_journal.json +9 -2
- package/package.json +13 -17
- package/dist/api/people/types.d.ts +0 -85
- package/dist/chat/advisor-request.d.ts +0 -4
- package/dist/chat/conversations/sql/migrations.d.ts +0 -22
- package/dist/chat/tools/advisor/session-store.d.ts +0 -9
- package/dist/chat/tools/advisor/tool.d.ts +0 -72
- package/dist/chunk-RAIB6WSG.js +0 -142
- package/dist/chunk-WM6KHPBQ.js +0 -48
- package/dist/db/schema/migrations.d.ts +0 -58
- package/dist/reporting/conversations/context.d.ts +0 -8
- package/dist/reporting/conversations/details.d.ts +0 -6
- package/dist/reporting/conversations/index.d.ts +0 -4
- package/dist/reporting/conversations/statistics.d.ts +0 -4
- package/dist/reporting/conversations/summaries.d.ts +0 -20
- package/dist/reporting/conversations/types.d.ts +0 -191
- package/dist/reporting/conversations.d.ts +0 -1
- package/dist/reporting.js +0 -1155
|
@@ -1,245 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
try {
|
|
7
|
-
return statSync(targetPath).isDirectory();
|
|
8
|
-
} catch {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function isFile(targetPath) {
|
|
13
|
-
try {
|
|
14
|
-
return statSync(targetPath).isFile();
|
|
15
|
-
} catch {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function normalizePath(targetPath) {
|
|
20
|
-
return path.resolve(targetPath);
|
|
21
|
-
}
|
|
22
|
-
function uniqueResolvedPathsInOrder(values) {
|
|
23
|
-
const seen = /* @__PURE__ */ new Set();
|
|
24
|
-
const resolved = [];
|
|
25
|
-
for (const value of values) {
|
|
26
|
-
const normalized = normalizePath(value);
|
|
27
|
-
if (seen.has(normalized)) {
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
seen.add(normalized);
|
|
31
|
-
resolved.push(normalized);
|
|
32
|
-
}
|
|
33
|
-
return resolved;
|
|
34
|
-
}
|
|
35
|
-
function isNodeModulesPath(candidatePath) {
|
|
36
|
-
return path.basename(candidatePath) === "node_modules";
|
|
37
|
-
}
|
|
38
|
-
function isInsidePnpmStore(candidatePath) {
|
|
39
|
-
return candidatePath.split(path.sep).includes(".pnpm");
|
|
40
|
-
}
|
|
41
|
-
function runningFromInstalledPackage() {
|
|
42
|
-
const currentFile = fileURLToPath(import.meta.url);
|
|
43
|
-
const marker = `${path.sep}node_modules${path.sep}@sentry${path.sep}junior${path.sep}`;
|
|
44
|
-
return currentFile.includes(marker);
|
|
45
|
-
}
|
|
46
|
-
function listInstalledPackageNodeModulesDirs() {
|
|
47
|
-
if (!runningFromInstalledPackage()) {
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
const dirs = [];
|
|
51
|
-
let current = path.resolve(path.dirname(fileURLToPath(import.meta.url)));
|
|
52
|
-
while (true) {
|
|
53
|
-
if (isNodeModulesPath(current) && !isInsidePnpmStore(current) && isDirectory(current)) {
|
|
54
|
-
dirs.push(current);
|
|
55
|
-
}
|
|
56
|
-
const parent = path.dirname(current);
|
|
57
|
-
if (parent === current) {
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
current = parent;
|
|
61
|
-
}
|
|
62
|
-
return dirs;
|
|
63
|
-
}
|
|
64
|
-
function listCwdAncestorNodeModulesDirs(cwd) {
|
|
65
|
-
const resolvedCwd = normalizePath(cwd);
|
|
66
|
-
const dirs = [];
|
|
67
|
-
let current = resolvedCwd;
|
|
68
|
-
while (true) {
|
|
69
|
-
const nodeModulesDir = path.join(current, "node_modules");
|
|
70
|
-
if (isDirectory(nodeModulesDir)) {
|
|
71
|
-
dirs.push(nodeModulesDir);
|
|
72
|
-
}
|
|
73
|
-
if (isFile(path.join(current, "package.json"))) {
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
const parent = path.dirname(current);
|
|
77
|
-
if (parent === current) {
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
current = parent;
|
|
81
|
-
}
|
|
82
|
-
return dirs;
|
|
83
|
-
}
|
|
84
|
-
function discoverNodeModulesDirs(cwd = process.cwd(), options) {
|
|
85
|
-
const explicit = options?.candidateDirs?.filter((dir) => isDirectory(dir)) ?? [];
|
|
86
|
-
if (explicit.length > 0) {
|
|
87
|
-
return uniqueResolvedPathsInOrder(explicit);
|
|
88
|
-
}
|
|
89
|
-
return uniqueResolvedPathsInOrder([
|
|
90
|
-
...listInstalledPackageNodeModulesDirs(),
|
|
91
|
-
...listCwdAncestorNodeModulesDirs(cwd)
|
|
92
|
-
]);
|
|
93
|
-
}
|
|
94
|
-
function discoverProjectRoots(cwd = process.cwd(), options) {
|
|
95
|
-
const roots = discoverNodeModulesDirs(
|
|
96
|
-
cwd,
|
|
97
|
-
options?.nodeModulesDirs ? { candidateDirs: options.nodeModulesDirs } : void 0
|
|
98
|
-
).map((nodeModulesDir) => path.dirname(nodeModulesDir));
|
|
99
|
-
return uniqueResolvedPathsInOrder([cwd, ...roots]);
|
|
100
|
-
}
|
|
101
|
-
function unique(values) {
|
|
102
|
-
return [...new Set(values)];
|
|
103
|
-
}
|
|
104
|
-
function pathExists(targetPath) {
|
|
105
|
-
try {
|
|
106
|
-
fs.accessSync(targetPath);
|
|
107
|
-
return true;
|
|
108
|
-
} catch {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function hasAnyDataMarkers(appDir) {
|
|
113
|
-
return pathExists(path.join(appDir, "SOUL.md")) || pathExists(path.join(appDir, "WORLD.md"));
|
|
114
|
-
}
|
|
115
|
-
function scoreAppCandidate(appDir) {
|
|
116
|
-
let score = 0;
|
|
117
|
-
if (pathExists(path.join(appDir, "SOUL.md"))) {
|
|
118
|
-
score += 4;
|
|
119
|
-
}
|
|
120
|
-
if (pathExists(path.join(appDir, "WORLD.md"))) {
|
|
121
|
-
score += 2;
|
|
122
|
-
}
|
|
123
|
-
if (pathExists(path.join(appDir, "skills"))) {
|
|
124
|
-
score += 1;
|
|
125
|
-
}
|
|
126
|
-
if (pathExists(path.join(appDir, "plugins"))) {
|
|
127
|
-
score += 1;
|
|
128
|
-
}
|
|
129
|
-
return score;
|
|
130
|
-
}
|
|
131
|
-
function resolveCandidateAppDirs(cwd, projectRoots) {
|
|
132
|
-
const roots = projectRoots ?? discoverProjectRoots(cwd);
|
|
133
|
-
const resolved = [];
|
|
134
|
-
const seen = /* @__PURE__ */ new Set();
|
|
135
|
-
for (const root of roots) {
|
|
136
|
-
const appDir = path.resolve(root, "app");
|
|
137
|
-
if (!pathExists(appDir)) {
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
if (seen.has(appDir)) {
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
seen.add(appDir);
|
|
144
|
-
resolved.push(appDir);
|
|
145
|
-
}
|
|
146
|
-
return resolved;
|
|
147
|
-
}
|
|
148
|
-
function homeDir() {
|
|
149
|
-
return resolveHomeDir();
|
|
150
|
-
}
|
|
151
|
-
function resolveHomeDir(cwd = process.cwd(), options) {
|
|
152
|
-
const resolvedCwd = path.resolve(cwd);
|
|
153
|
-
const directApp = path.resolve(resolvedCwd, "app");
|
|
154
|
-
if (pathExists(directApp) && hasAnyDataMarkers(directApp)) {
|
|
155
|
-
return directApp;
|
|
156
|
-
}
|
|
157
|
-
const candidates = resolveCandidateAppDirs(
|
|
158
|
-
resolvedCwd,
|
|
159
|
-
options?.projectRoots
|
|
160
|
-
);
|
|
161
|
-
if (candidates.length === 0) {
|
|
162
|
-
return directApp;
|
|
163
|
-
}
|
|
164
|
-
candidates.sort((left, right) => {
|
|
165
|
-
const leftScore = scoreAppCandidate(left);
|
|
166
|
-
const rightScore = scoreAppCandidate(right);
|
|
167
|
-
if (leftScore !== rightScore) {
|
|
168
|
-
return rightScore - leftScore;
|
|
169
|
-
}
|
|
170
|
-
const leftDistance = path.relative(resolvedCwd, left).split(path.sep).length;
|
|
171
|
-
const rightDistance = path.relative(resolvedCwd, right).split(path.sep).length;
|
|
172
|
-
if (leftDistance !== rightDistance) {
|
|
173
|
-
return leftDistance - rightDistance;
|
|
174
|
-
}
|
|
175
|
-
return left.localeCompare(right);
|
|
176
|
-
});
|
|
177
|
-
return candidates[0];
|
|
178
|
-
}
|
|
179
|
-
function resolveContentRoots(subdir) {
|
|
180
|
-
if (subdir === "data") {
|
|
181
|
-
return [homeDir()];
|
|
182
|
-
}
|
|
183
|
-
return [path.join(homeDir(), subdir)];
|
|
184
|
-
}
|
|
185
|
-
function dataRoots() {
|
|
186
|
-
return unique(resolveContentRoots("data"));
|
|
187
|
-
}
|
|
188
|
-
function skillRoots() {
|
|
189
|
-
return unique(resolveContentRoots("skills"));
|
|
190
|
-
}
|
|
191
|
-
function pluginRoots() {
|
|
192
|
-
return unique(resolveContentRoots("plugins"));
|
|
193
|
-
}
|
|
194
|
-
function soulPathCandidates() {
|
|
195
|
-
const candidates = dataRoots().map((root) => path.join(root, "SOUL.md"));
|
|
196
|
-
return unique(candidates);
|
|
197
|
-
}
|
|
198
|
-
function worldPathCandidates() {
|
|
199
|
-
const candidates = dataRoots().map((root) => path.join(root, "WORLD.md"));
|
|
200
|
-
return unique(candidates);
|
|
201
|
-
}
|
|
202
|
-
var RESERVED_APP_FILES = /* @__PURE__ */ new Set([
|
|
203
|
-
"SOUL.md",
|
|
204
|
-
"WORLD.md",
|
|
205
|
-
"DESCRIPTION.md",
|
|
206
|
-
"ABOUT.md"
|
|
207
|
-
]);
|
|
208
|
-
function listReferenceFiles() {
|
|
209
|
-
const appDir = homeDir();
|
|
210
|
-
try {
|
|
211
|
-
const entries = fs.readdirSync(appDir, { withFileTypes: true });
|
|
212
|
-
return entries.filter(
|
|
213
|
-
(entry) => entry.isFile() && entry.name.endsWith(".md") && !RESERVED_APP_FILES.has(entry.name)
|
|
214
|
-
).map((entry) => path.join(appDir, entry.name)).sort();
|
|
215
|
-
} catch {
|
|
216
|
-
return [];
|
|
217
|
-
}
|
|
218
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
discoverNodeModulesDirs,
|
|
3
|
+
isDirectory,
|
|
4
|
+
isFile
|
|
5
|
+
} from "./chunk-3V7OFJZC.js";
|
|
219
6
|
|
|
220
7
|
// src/package-resolution.ts
|
|
221
|
-
import { statSync
|
|
8
|
+
import { statSync } from "fs";
|
|
222
9
|
import { createRequire } from "module";
|
|
223
|
-
import
|
|
10
|
+
import path from "path";
|
|
224
11
|
function isDirectory2(targetPath) {
|
|
225
12
|
try {
|
|
226
|
-
return
|
|
13
|
+
return statSync(targetPath).isDirectory();
|
|
227
14
|
} catch {
|
|
228
15
|
return false;
|
|
229
16
|
}
|
|
230
17
|
}
|
|
231
18
|
function isFile2(targetPath) {
|
|
232
19
|
try {
|
|
233
|
-
return
|
|
20
|
+
return statSync(targetPath).isFile();
|
|
234
21
|
} catch {
|
|
235
22
|
return false;
|
|
236
23
|
}
|
|
237
24
|
}
|
|
238
|
-
function
|
|
25
|
+
function uniqueResolvedPathsInOrder(values) {
|
|
239
26
|
const seen = /* @__PURE__ */ new Set();
|
|
240
27
|
const resolved = [];
|
|
241
28
|
for (const value of values) {
|
|
242
|
-
const normalized =
|
|
29
|
+
const normalized = path.resolve(value);
|
|
243
30
|
if (seen.has(normalized)) {
|
|
244
31
|
continue;
|
|
245
32
|
}
|
|
@@ -250,13 +37,13 @@ function uniqueResolvedPathsInOrder2(values) {
|
|
|
250
37
|
}
|
|
251
38
|
function ancestorNodeModulesDirs(cwd) {
|
|
252
39
|
const dirs = [];
|
|
253
|
-
let current =
|
|
40
|
+
let current = path.resolve(cwd);
|
|
254
41
|
while (true) {
|
|
255
|
-
const nodeModulesDir =
|
|
42
|
+
const nodeModulesDir = path.join(current, "node_modules");
|
|
256
43
|
if (isDirectory2(nodeModulesDir)) {
|
|
257
44
|
dirs.push(nodeModulesDir);
|
|
258
45
|
}
|
|
259
|
-
const parent =
|
|
46
|
+
const parent = path.dirname(current);
|
|
260
47
|
if (parent === current) {
|
|
261
48
|
break;
|
|
262
49
|
}
|
|
@@ -265,14 +52,14 @@ function ancestorNodeModulesDirs(cwd) {
|
|
|
265
52
|
return dirs;
|
|
266
53
|
}
|
|
267
54
|
function packageDirInNodeModules(nodeModulesDir, packageName) {
|
|
268
|
-
const packageDir =
|
|
269
|
-
return isDirectory2(packageDir) ?
|
|
55
|
+
const packageDir = path.join(nodeModulesDir, ...packageName.split("/"));
|
|
56
|
+
return isDirectory2(packageDir) ? path.resolve(packageDir) : void 0;
|
|
270
57
|
}
|
|
271
58
|
function isValidPackageSegment(segment) {
|
|
272
59
|
return Boolean(segment) && segment !== "." && segment !== ".." && !segment.startsWith(".") && /^[A-Za-z0-9._~-]+$/.test(segment);
|
|
273
60
|
}
|
|
274
61
|
function isValidPackageName(packageName) {
|
|
275
|
-
if (!packageName || packageName.includes("\\") ||
|
|
62
|
+
if (!packageName || packageName.includes("\\") || path.isAbsolute(packageName)) {
|
|
276
63
|
return false;
|
|
277
64
|
}
|
|
278
65
|
const parts = packageName.split("/");
|
|
@@ -282,17 +69,17 @@ function isValidPackageName(packageName) {
|
|
|
282
69
|
return parts.length === 1 && isValidPackageSegment(parts[0]);
|
|
283
70
|
}
|
|
284
71
|
function findPackageRoot(entryPath) {
|
|
285
|
-
let dir =
|
|
286
|
-
while (dir !==
|
|
287
|
-
if (isFile2(
|
|
288
|
-
return
|
|
72
|
+
let dir = path.dirname(entryPath);
|
|
73
|
+
while (dir !== path.dirname(dir)) {
|
|
74
|
+
if (isFile2(path.join(dir, "package.json"))) {
|
|
75
|
+
return path.resolve(dir);
|
|
289
76
|
}
|
|
290
|
-
dir =
|
|
77
|
+
dir = path.dirname(dir);
|
|
291
78
|
}
|
|
292
79
|
return void 0;
|
|
293
80
|
}
|
|
294
81
|
function findPackageNodeModulesDir(packageDir, packageName) {
|
|
295
|
-
const parts =
|
|
82
|
+
const parts = path.resolve(packageDir).split(path.sep);
|
|
296
83
|
const packageParts = packageName.split("/");
|
|
297
84
|
for (let index = parts.length - 1; index >= 0; index -= 1) {
|
|
298
85
|
if (parts[index] !== "node_modules") {
|
|
@@ -305,21 +92,21 @@ function findPackageNodeModulesDir(packageDir, packageName) {
|
|
|
305
92
|
if (candidatePackageParts.join("/") !== packageParts.join("/")) {
|
|
306
93
|
continue;
|
|
307
94
|
}
|
|
308
|
-
return
|
|
95
|
+
return path.resolve(parts.slice(0, index + 1).join(path.sep) || path.sep);
|
|
309
96
|
}
|
|
310
97
|
return void 0;
|
|
311
98
|
}
|
|
312
99
|
function resolvePackageWithNode(cwd, packageName) {
|
|
313
100
|
let requireFromCwd;
|
|
314
101
|
try {
|
|
315
|
-
requireFromCwd = createRequire(
|
|
102
|
+
requireFromCwd = createRequire(path.join(cwd, "package.json"));
|
|
316
103
|
} catch {
|
|
317
104
|
return void 0;
|
|
318
105
|
}
|
|
319
106
|
for (const specifier of [`${packageName}/package.json`, packageName]) {
|
|
320
107
|
try {
|
|
321
108
|
const resolved = requireFromCwd.resolve(specifier);
|
|
322
|
-
const dir = specifier.endsWith("/package.json") ?
|
|
109
|
+
const dir = specifier.endsWith("/package.json") ? path.dirname(resolved) : findPackageRoot(resolved);
|
|
323
110
|
if (!dir) {
|
|
324
111
|
continue;
|
|
325
112
|
}
|
|
@@ -337,7 +124,7 @@ function resolvePackageLocation(cwd, packageName, options) {
|
|
|
337
124
|
if (!isValidPackageName(packageName)) {
|
|
338
125
|
return void 0;
|
|
339
126
|
}
|
|
340
|
-
const nodeModulesDirs =
|
|
127
|
+
const nodeModulesDirs = uniqueResolvedPathsInOrder([
|
|
341
128
|
...options?.nodeModulesDirs ?? [],
|
|
342
129
|
...ancestorNodeModulesDirs(cwd)
|
|
343
130
|
]);
|
|
@@ -354,9 +141,9 @@ function resolvePackageDir(cwd, packageName) {
|
|
|
354
141
|
}
|
|
355
142
|
|
|
356
143
|
// src/chat/plugins/package-discovery.ts
|
|
357
|
-
import
|
|
144
|
+
import path2 from "path";
|
|
358
145
|
function normalizeForGlob(targetPath) {
|
|
359
|
-
return targetPath.split(
|
|
146
|
+
return targetPath.split(path2.sep).join("/");
|
|
360
147
|
}
|
|
361
148
|
function uniqueStringsInOrder(values) {
|
|
362
149
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -371,8 +158,8 @@ function uniqueStringsInOrder(values) {
|
|
|
371
158
|
return resolved;
|
|
372
159
|
}
|
|
373
160
|
function pathForTracingInclude(cwd, targetPath) {
|
|
374
|
-
const relative =
|
|
375
|
-
if (!relative ||
|
|
161
|
+
const relative = path2.relative(cwd, targetPath);
|
|
162
|
+
if (!relative || path2.isAbsolute(relative) || relative === ".." || relative.startsWith(`..${path2.sep}`)) {
|
|
376
163
|
return null;
|
|
377
164
|
}
|
|
378
165
|
const normalized = normalizeForGlob(relative);
|
|
@@ -409,10 +196,10 @@ function resolvePackageDirFromName(cwd, packageName, candidateNodeModulesDirs) {
|
|
|
409
196
|
}) ?? null;
|
|
410
197
|
}
|
|
411
198
|
function readPluginPackageFlags(dir) {
|
|
412
|
-
const hasRootPluginManifest = isFile(
|
|
413
|
-
const hasMigrationsDir = isDirectory(
|
|
414
|
-
const hasPluginsDir = isDirectory(
|
|
415
|
-
const hasSkillsDir = isDirectory(
|
|
199
|
+
const hasRootPluginManifest = isFile(path2.join(dir, "plugin.yaml"));
|
|
200
|
+
const hasMigrationsDir = isDirectory(path2.join(dir, "migrations"));
|
|
201
|
+
const hasPluginsDir = isDirectory(path2.join(dir, "plugins"));
|
|
202
|
+
const hasSkillsDir = isDirectory(path2.join(dir, "skills"));
|
|
416
203
|
if (!hasRootPluginManifest && !hasMigrationsDir && !hasPluginsDir && !hasSkillsDir) {
|
|
417
204
|
return null;
|
|
418
205
|
}
|
|
@@ -457,7 +244,7 @@ function discoverDeclaredPackages(packageNames, candidateNodeModulesDirs, cwd) {
|
|
|
457
244
|
return discovered;
|
|
458
245
|
}
|
|
459
246
|
function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
460
|
-
const resolvedCwd =
|
|
247
|
+
const resolvedCwd = path2.resolve(cwd);
|
|
461
248
|
const packageNames = normalizePluginPackageNames(options?.packageNames);
|
|
462
249
|
const nodeModulesDirs = options?.nodeModulesDirs ?? discoverNodeModulesDirs(resolvedCwd);
|
|
463
250
|
const discoveredPackages = discoverDeclaredPackages(
|
|
@@ -466,12 +253,12 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
466
253
|
resolvedCwd
|
|
467
254
|
);
|
|
468
255
|
const manifestRoots = [];
|
|
469
|
-
const
|
|
256
|
+
const skillRoots = [];
|
|
470
257
|
const tracingIncludes = [];
|
|
471
258
|
for (const pkg of discoveredPackages) {
|
|
472
259
|
const tracingBasePath = pkg.nodeModulesDir ? pathForTracingInclude(
|
|
473
260
|
resolvedCwd,
|
|
474
|
-
|
|
261
|
+
path2.join(pkg.nodeModulesDir, ...pkg.packageName.split("/"))
|
|
475
262
|
) : pathForTracingInclude(resolvedCwd, pkg.dir);
|
|
476
263
|
if (pkg.hasRootPluginManifest) {
|
|
477
264
|
manifestRoots.push(pkg.dir);
|
|
@@ -485,13 +272,13 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
485
272
|
}
|
|
486
273
|
}
|
|
487
274
|
if (pkg.hasPluginsDir) {
|
|
488
|
-
manifestRoots.push(
|
|
275
|
+
manifestRoots.push(path2.join(pkg.dir, "plugins"));
|
|
489
276
|
if (tracingBasePath) {
|
|
490
277
|
tracingIncludes.push(`${tracingBasePath}/plugins/**/*`);
|
|
491
278
|
}
|
|
492
279
|
}
|
|
493
280
|
if (pkg.hasSkillsDir) {
|
|
494
|
-
|
|
281
|
+
skillRoots.push(path2.join(pkg.dir, "skills"));
|
|
495
282
|
if (tracingBasePath) {
|
|
496
283
|
tracingIncludes.push(`${tracingBasePath}/skills/**/*`);
|
|
497
284
|
}
|
|
@@ -508,18 +295,12 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
508
295
|
packageName: pkg.packageName
|
|
509
296
|
})),
|
|
510
297
|
manifestRoots: uniqueStringsInOrder(manifestRoots),
|
|
511
|
-
skillRoots: uniqueStringsInOrder(
|
|
298
|
+
skillRoots: uniqueStringsInOrder(skillRoots),
|
|
512
299
|
tracingIncludes: uniqueStringsInOrder(tracingIncludes)
|
|
513
300
|
};
|
|
514
301
|
}
|
|
515
302
|
|
|
516
303
|
export {
|
|
517
|
-
homeDir,
|
|
518
|
-
skillRoots,
|
|
519
|
-
pluginRoots,
|
|
520
|
-
soulPathCandidates,
|
|
521
|
-
worldPathCandidates,
|
|
522
|
-
listReferenceFiles,
|
|
523
304
|
isValidPackageName,
|
|
524
305
|
resolvePackageDir,
|
|
525
306
|
normalizePluginPackageNames,
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// src/reporting-schema.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var healthReportSchema = z.object({
|
|
4
|
+
status: z.literal("ok"),
|
|
5
|
+
service: z.string(),
|
|
6
|
+
timestamp: z.string()
|
|
7
|
+
}).strict();
|
|
8
|
+
var pluginReportSchema = z.object({ name: z.string() }).strict();
|
|
9
|
+
var pluginReportsSchema = z.array(pluginReportSchema);
|
|
10
|
+
var skillReportSchema = z.object({
|
|
11
|
+
name: z.string(),
|
|
12
|
+
pluginProvider: z.string().optional()
|
|
13
|
+
}).strict();
|
|
14
|
+
var skillReportsSchema = z.array(skillReportSchema);
|
|
15
|
+
var pluginPackageContentItemReportSchema = z.object({
|
|
16
|
+
dir: z.string(),
|
|
17
|
+
hasMigrationsDir: z.boolean(),
|
|
18
|
+
hasSkillsDir: z.boolean(),
|
|
19
|
+
packageName: z.string()
|
|
20
|
+
}).strict();
|
|
21
|
+
var pluginPackageContentReportSchema = z.object({
|
|
22
|
+
packageNames: z.array(z.string()),
|
|
23
|
+
packages: z.array(pluginPackageContentItemReportSchema),
|
|
24
|
+
manifestRoots: z.array(z.string()),
|
|
25
|
+
skillRoots: z.array(z.string()),
|
|
26
|
+
tracingIncludes: z.array(z.string())
|
|
27
|
+
}).strict();
|
|
28
|
+
var runtimeInfoReportSchema = z.object({
|
|
29
|
+
cwd: z.string(),
|
|
30
|
+
homeDir: z.string(),
|
|
31
|
+
descriptionText: z.string().optional(),
|
|
32
|
+
providers: z.array(z.string()),
|
|
33
|
+
skills: z.array(skillReportSchema),
|
|
34
|
+
packagedContent: pluginPackageContentReportSchema
|
|
35
|
+
}).strict();
|
|
36
|
+
var pluginOperationalToneSchema = z.enum([
|
|
37
|
+
"danger",
|
|
38
|
+
"good",
|
|
39
|
+
"neutral",
|
|
40
|
+
"warning"
|
|
41
|
+
]);
|
|
42
|
+
var pluginOperationalMetricSchema = z.object({
|
|
43
|
+
label: z.string(),
|
|
44
|
+
tone: pluginOperationalToneSchema.optional(),
|
|
45
|
+
value: z.string()
|
|
46
|
+
}).strict();
|
|
47
|
+
var pluginOperationalFieldSchema = z.object({
|
|
48
|
+
key: z.string(),
|
|
49
|
+
label: z.string()
|
|
50
|
+
}).strict();
|
|
51
|
+
var pluginOperationalRecordSchema = z.object({
|
|
52
|
+
id: z.string(),
|
|
53
|
+
tone: pluginOperationalToneSchema.optional(),
|
|
54
|
+
values: z.record(z.string(), z.string())
|
|
55
|
+
}).strict();
|
|
56
|
+
var pluginOperationalRecordSetSchema = z.object({
|
|
57
|
+
fields: z.array(pluginOperationalFieldSchema).optional(),
|
|
58
|
+
emptyText: z.string().optional(),
|
|
59
|
+
records: z.array(pluginOperationalRecordSchema).optional(),
|
|
60
|
+
title: z.string()
|
|
61
|
+
}).strict();
|
|
62
|
+
var pluginOperationalReportSchema = z.object({
|
|
63
|
+
generatedAt: z.string().optional(),
|
|
64
|
+
metrics: z.array(pluginOperationalMetricSchema).optional(),
|
|
65
|
+
recordSets: z.array(pluginOperationalRecordSetSchema).optional(),
|
|
66
|
+
title: z.string().optional(),
|
|
67
|
+
pluginName: z.string()
|
|
68
|
+
}).strict();
|
|
69
|
+
var pluginOperationalReportFeedSchema = z.object({
|
|
70
|
+
generatedAt: z.string(),
|
|
71
|
+
reports: z.array(pluginOperationalReportSchema),
|
|
72
|
+
source: z.literal("plugins")
|
|
73
|
+
}).strict();
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
healthReportSchema,
|
|
77
|
+
pluginReportSchema,
|
|
78
|
+
pluginReportsSchema,
|
|
79
|
+
skillReportSchema,
|
|
80
|
+
skillReportsSchema,
|
|
81
|
+
pluginPackageContentItemReportSchema,
|
|
82
|
+
pluginPackageContentReportSchema,
|
|
83
|
+
runtimeInfoReportSchema,
|
|
84
|
+
pluginOperationalReportSchema,
|
|
85
|
+
pluginOperationalReportFeedSchema
|
|
86
|
+
};
|