@sentry/junior 0.118.0 → 0.120.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/dist/{agent-hooks-J2FB7XD6.js → agent-hooks-5DDPWRYO.js} +8 -8
- package/dist/api/conversations/detail.d.ts +17 -0
- package/dist/api/conversations/event-list.d.ts +17 -0
- package/dist/api/schema/conversation.d.ts +68 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +103 -82
- package/dist/app.js +24 -24
- package/dist/build/copy-build-content.d.ts +2 -2
- package/dist/{catalog-runtime-UHHLU53I.js → catalog-runtime-5KR5XBMJ.js} +7 -7
- package/dist/chat/discovery.d.ts +2 -0
- package/dist/chat/mcp/tool-manager.d.ts +14 -1
- package/dist/chat/plugins/types.d.ts +3 -9
- package/dist/chat/plugins/user-pages.d.ts +2 -1
- package/dist/chat/slack/tools/canvas/api.d.ts +2 -9
- package/dist/chat/slack/tools/canvas/markdown.d.ts +9 -0
- package/dist/{chunk-GT2ZUALJ.js → chunk-24B5R6OU.js} +92 -6
- package/dist/{chunk-L72GDKSN.js → chunk-6WX5SPI3.js} +1 -1
- package/dist/{chunk-3N3FMCKN.js → chunk-ALAKN7LR.js} +1 -1
- package/dist/{chunk-MLZFK4KP.js → chunk-ALYQOZG7.js} +1 -1
- package/dist/{chunk-6BGUAOYP.js → chunk-BHXW734F.js} +13 -7
- package/dist/{chunk-4LPPH7Y6.js → chunk-DJDGDJDF.js} +4 -4
- package/dist/{chunk-HWUBBHLK.js → chunk-DMKHRBI6.js} +4 -3
- package/dist/{chunk-QWCF4RAC.js → chunk-DWOH57FW.js} +1 -1
- package/dist/{chunk-7GADTCNS.js → chunk-EIVE6GL4.js} +3 -3
- package/dist/{chunk-6K2QE2UI.js → chunk-ERYVNWNE.js} +250 -37
- package/dist/{chunk-UXLYAVYL.js → chunk-GNNV3UTY.js} +1 -1
- package/dist/chunk-H4HBKISO.js +417 -0
- package/dist/{chunk-FXOYURO4.js → chunk-HDFGNU5E.js} +1 -0
- package/dist/{chunk-PJPKHGLG.js → chunk-JQWP6V22.js} +4 -11
- package/dist/{chunk-KC5EE27Y.js → chunk-M243JMZH.js} +2 -2
- package/dist/{chunk-7SM3P4XR.js → chunk-O2ULQJWR.js} +82 -1
- package/dist/{chunk-B3IT5END.js → chunk-OOUNJNMR.js} +16 -152
- package/dist/{chunk-HN6LFYG3.js → chunk-Q3RL6A4E.js} +2 -2
- package/dist/{chunk-3MUSSFMP.js → chunk-QOQPPRFS.js} +221 -14
- package/dist/{chunk-S6R23MFB.js → chunk-TKUCRFNX.js} +12 -225
- package/dist/{chunk-PWRFTDTY.js → chunk-VURFJVFH.js} +2 -2
- package/dist/{chunk-3LGCVRBQ.js → chunk-XAI2HNAY.js} +9 -5
- package/dist/{chunk-4SOQPUF4.js → chunk-YEAOUT5W.js} +1 -1
- package/dist/cli/chat.js +24 -24
- package/dist/cli/check.js +8 -8
- package/dist/cli/init.js +2 -2
- package/dist/cli/plugins.js +13 -13
- package/dist/cli/snapshot-create.js +11 -11
- package/dist/cli/upgrade.js +8 -8
- package/dist/{db-PMRHFSYL.js → db-T4ZY64PB.js} +6 -6
- package/dist/{discovery-RMHYSRL7.js → discovery-GUFTFBTL.js} +3 -1
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +24 -7
- package/dist/{oauth-callback-server-QJUC7S4X.js → oauth-callback-server-LQ6DFI26.js} +17 -17
- package/dist/{runner-PZMV6JQW.js → runner-D3ZU6TJH.js} +10 -10
- package/dist/{skills-W4JETYSV.js → skills-JMXY7LIY.js} +8 -8
- package/dist/{validation-IJLNHZSU.js → validation-OEPJS7JX.js} +8 -8
- package/dist/version.js +1 -1
- package/package.json +8 -7
- package/skills/jr-rpc/SKILL.md +40 -0
- package/dist/chunk-3V7OFJZC.js +0 -264
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
// src/chat/discovery.ts
|
|
2
|
+
import fs, { statSync as statSync2 } from "fs";
|
|
3
|
+
import path2 from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
// src/package-resolution.ts
|
|
7
|
+
import { statSync } from "fs";
|
|
8
|
+
import { createRequire } from "module";
|
|
9
|
+
import path from "path";
|
|
10
|
+
function isDirectory(targetPath) {
|
|
11
|
+
try {
|
|
12
|
+
return statSync(targetPath).isDirectory();
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function isFile(targetPath) {
|
|
18
|
+
try {
|
|
19
|
+
return statSync(targetPath).isFile();
|
|
20
|
+
} catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function uniqueResolvedPathsInOrder(values) {
|
|
25
|
+
const seen = /* @__PURE__ */ new Set();
|
|
26
|
+
const resolved = [];
|
|
27
|
+
for (const value of values) {
|
|
28
|
+
const normalized = path.resolve(value);
|
|
29
|
+
if (seen.has(normalized)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
seen.add(normalized);
|
|
33
|
+
resolved.push(normalized);
|
|
34
|
+
}
|
|
35
|
+
return resolved;
|
|
36
|
+
}
|
|
37
|
+
function ancestorNodeModulesDirs(cwd) {
|
|
38
|
+
const dirs = [];
|
|
39
|
+
let current = path.resolve(cwd);
|
|
40
|
+
while (true) {
|
|
41
|
+
const nodeModulesDir = path.join(current, "node_modules");
|
|
42
|
+
if (isDirectory(nodeModulesDir)) {
|
|
43
|
+
dirs.push(nodeModulesDir);
|
|
44
|
+
}
|
|
45
|
+
const parent = path.dirname(current);
|
|
46
|
+
if (parent === current) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
current = parent;
|
|
50
|
+
}
|
|
51
|
+
return dirs;
|
|
52
|
+
}
|
|
53
|
+
function packageDirInNodeModules(nodeModulesDir, packageName) {
|
|
54
|
+
const packageDir = path.join(nodeModulesDir, ...packageName.split("/"));
|
|
55
|
+
return isDirectory(packageDir) ? path.resolve(packageDir) : void 0;
|
|
56
|
+
}
|
|
57
|
+
function isValidPackageSegment(segment) {
|
|
58
|
+
return Boolean(segment) && segment !== "." && segment !== ".." && !segment.startsWith(".") && /^[A-Za-z0-9._~-]+$/.test(segment);
|
|
59
|
+
}
|
|
60
|
+
function isValidPackageName(packageName) {
|
|
61
|
+
if (!packageName || packageName.includes("\\") || path.isAbsolute(packageName)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
const parts = packageName.split("/");
|
|
65
|
+
if (parts[0].startsWith("@")) {
|
|
66
|
+
return parts.length === 2 && parts[0].length > 1 && isValidPackageSegment(parts[0].slice(1)) && isValidPackageSegment(parts[1]);
|
|
67
|
+
}
|
|
68
|
+
return parts.length === 1 && isValidPackageSegment(parts[0]);
|
|
69
|
+
}
|
|
70
|
+
function findPackageRoot(entryPath) {
|
|
71
|
+
let dir = path.dirname(entryPath);
|
|
72
|
+
while (dir !== path.dirname(dir)) {
|
|
73
|
+
if (isFile(path.join(dir, "package.json"))) {
|
|
74
|
+
return path.resolve(dir);
|
|
75
|
+
}
|
|
76
|
+
dir = path.dirname(dir);
|
|
77
|
+
}
|
|
78
|
+
return void 0;
|
|
79
|
+
}
|
|
80
|
+
function findPackageNodeModulesDir(packageDir, packageName) {
|
|
81
|
+
const parts = path.resolve(packageDir).split(path.sep);
|
|
82
|
+
const packageParts = packageName.split("/");
|
|
83
|
+
for (let index = parts.length - 1; index >= 0; index -= 1) {
|
|
84
|
+
if (parts[index] !== "node_modules") {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const candidatePackageParts = parts.slice(
|
|
88
|
+
index + 1,
|
|
89
|
+
index + 1 + packageParts.length
|
|
90
|
+
);
|
|
91
|
+
if (candidatePackageParts.join("/") !== packageParts.join("/")) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
return path.resolve(parts.slice(0, index + 1).join(path.sep) || path.sep);
|
|
95
|
+
}
|
|
96
|
+
return void 0;
|
|
97
|
+
}
|
|
98
|
+
function resolvePackageWithNode(cwd, packageName) {
|
|
99
|
+
let requireFromCwd;
|
|
100
|
+
try {
|
|
101
|
+
requireFromCwd = createRequire(path.join(cwd, "package.json"));
|
|
102
|
+
} catch {
|
|
103
|
+
return void 0;
|
|
104
|
+
}
|
|
105
|
+
for (const specifier of [`${packageName}/package.json`, packageName]) {
|
|
106
|
+
try {
|
|
107
|
+
const resolved = requireFromCwd.resolve(specifier);
|
|
108
|
+
const dir = specifier.endsWith("/package.json") ? path.dirname(resolved) : findPackageRoot(resolved);
|
|
109
|
+
if (!dir) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const nodeModulesDir = findPackageNodeModulesDir(dir, packageName);
|
|
113
|
+
return {
|
|
114
|
+
dir,
|
|
115
|
+
...nodeModulesDir ? { nodeModulesDir } : {}
|
|
116
|
+
};
|
|
117
|
+
} catch {
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return void 0;
|
|
121
|
+
}
|
|
122
|
+
function resolvePackageLocation(cwd, packageName, options) {
|
|
123
|
+
if (!isValidPackageName(packageName)) {
|
|
124
|
+
return void 0;
|
|
125
|
+
}
|
|
126
|
+
const nodeModulesDirs = uniqueResolvedPathsInOrder([
|
|
127
|
+
...options?.nodeModulesDirs ?? [],
|
|
128
|
+
...ancestorNodeModulesDirs(cwd)
|
|
129
|
+
]);
|
|
130
|
+
for (const nodeModulesDir of nodeModulesDirs) {
|
|
131
|
+
const dir = packageDirInNodeModules(nodeModulesDir, packageName);
|
|
132
|
+
if (dir) {
|
|
133
|
+
return { dir, nodeModulesDir };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return resolvePackageWithNode(cwd, packageName);
|
|
137
|
+
}
|
|
138
|
+
function resolvePackageDir(cwd, packageName) {
|
|
139
|
+
return resolvePackageLocation(cwd, packageName)?.dir;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// src/chat/discovery.ts
|
|
143
|
+
function isDirectory2(targetPath) {
|
|
144
|
+
try {
|
|
145
|
+
return statSync2(targetPath).isDirectory();
|
|
146
|
+
} catch {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function isFile2(targetPath) {
|
|
151
|
+
try {
|
|
152
|
+
return statSync2(targetPath).isFile();
|
|
153
|
+
} catch {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function normalizePath(targetPath) {
|
|
158
|
+
return path2.resolve(targetPath);
|
|
159
|
+
}
|
|
160
|
+
function uniqueResolvedPathsInOrder2(values) {
|
|
161
|
+
const seen = /* @__PURE__ */ new Set();
|
|
162
|
+
const resolved = [];
|
|
163
|
+
for (const value of values) {
|
|
164
|
+
const normalized = normalizePath(value);
|
|
165
|
+
if (seen.has(normalized)) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
seen.add(normalized);
|
|
169
|
+
resolved.push(normalized);
|
|
170
|
+
}
|
|
171
|
+
return resolved;
|
|
172
|
+
}
|
|
173
|
+
function isNodeModulesPath(candidatePath) {
|
|
174
|
+
return path2.basename(candidatePath) === "node_modules";
|
|
175
|
+
}
|
|
176
|
+
function isInsidePnpmStore(candidatePath) {
|
|
177
|
+
return candidatePath.split(path2.sep).includes(".pnpm");
|
|
178
|
+
}
|
|
179
|
+
function runningFromInstalledPackage() {
|
|
180
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
181
|
+
const marker = `${path2.sep}node_modules${path2.sep}@sentry${path2.sep}junior${path2.sep}`;
|
|
182
|
+
return currentFile.includes(marker);
|
|
183
|
+
}
|
|
184
|
+
function listInstalledPackageNodeModulesDirs() {
|
|
185
|
+
if (!runningFromInstalledPackage()) {
|
|
186
|
+
return [];
|
|
187
|
+
}
|
|
188
|
+
const dirs = [];
|
|
189
|
+
let current = path2.resolve(path2.dirname(fileURLToPath(import.meta.url)));
|
|
190
|
+
while (true) {
|
|
191
|
+
if (isNodeModulesPath(current) && !isInsidePnpmStore(current) && isDirectory2(current)) {
|
|
192
|
+
dirs.push(current);
|
|
193
|
+
}
|
|
194
|
+
const parent = path2.dirname(current);
|
|
195
|
+
if (parent === current) {
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
current = parent;
|
|
199
|
+
}
|
|
200
|
+
return dirs;
|
|
201
|
+
}
|
|
202
|
+
function listCwdAncestorNodeModulesDirs(cwd) {
|
|
203
|
+
const resolvedCwd = normalizePath(cwd);
|
|
204
|
+
const dirs = [];
|
|
205
|
+
let current = resolvedCwd;
|
|
206
|
+
while (true) {
|
|
207
|
+
const nodeModulesDir = path2.join(current, "node_modules");
|
|
208
|
+
if (isDirectory2(nodeModulesDir)) {
|
|
209
|
+
dirs.push(nodeModulesDir);
|
|
210
|
+
}
|
|
211
|
+
if (isFile2(path2.join(current, "package.json"))) {
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
const parent = path2.dirname(current);
|
|
215
|
+
if (parent === current) {
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
current = parent;
|
|
219
|
+
}
|
|
220
|
+
return dirs;
|
|
221
|
+
}
|
|
222
|
+
function discoverNodeModulesDirs(cwd = process.cwd(), options) {
|
|
223
|
+
const explicit = options?.candidateDirs?.filter((dir) => isDirectory2(dir)) ?? [];
|
|
224
|
+
if (explicit.length > 0) {
|
|
225
|
+
return uniqueResolvedPathsInOrder2(explicit);
|
|
226
|
+
}
|
|
227
|
+
return uniqueResolvedPathsInOrder2([
|
|
228
|
+
...listInstalledPackageNodeModulesDirs(),
|
|
229
|
+
...listCwdAncestorNodeModulesDirs(cwd)
|
|
230
|
+
]);
|
|
231
|
+
}
|
|
232
|
+
function discoverProjectRoots(cwd = process.cwd(), options) {
|
|
233
|
+
const roots = discoverNodeModulesDirs(
|
|
234
|
+
cwd,
|
|
235
|
+
options?.nodeModulesDirs ? { candidateDirs: options.nodeModulesDirs } : void 0
|
|
236
|
+
).map((nodeModulesDir) => path2.dirname(nodeModulesDir));
|
|
237
|
+
return uniqueResolvedPathsInOrder2([cwd, ...roots]);
|
|
238
|
+
}
|
|
239
|
+
function unique(values) {
|
|
240
|
+
return [...new Set(values)];
|
|
241
|
+
}
|
|
242
|
+
function pathExists(targetPath) {
|
|
243
|
+
try {
|
|
244
|
+
fs.accessSync(targetPath);
|
|
245
|
+
return true;
|
|
246
|
+
} catch {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function hasAnyDataMarkers(appDir) {
|
|
251
|
+
return pathExists(path2.join(appDir, "SOUL.md")) || pathExists(path2.join(appDir, "WORLD.md"));
|
|
252
|
+
}
|
|
253
|
+
function scoreAppCandidate(appDir) {
|
|
254
|
+
let score = 0;
|
|
255
|
+
if (pathExists(path2.join(appDir, "SOUL.md"))) {
|
|
256
|
+
score += 4;
|
|
257
|
+
}
|
|
258
|
+
if (pathExists(path2.join(appDir, "WORLD.md"))) {
|
|
259
|
+
score += 2;
|
|
260
|
+
}
|
|
261
|
+
if (pathExists(path2.join(appDir, "skills"))) {
|
|
262
|
+
score += 1;
|
|
263
|
+
}
|
|
264
|
+
if (pathExists(path2.join(appDir, "plugins"))) {
|
|
265
|
+
score += 1;
|
|
266
|
+
}
|
|
267
|
+
return score;
|
|
268
|
+
}
|
|
269
|
+
function resolveCandidateAppDirs(cwd, projectRoots) {
|
|
270
|
+
const roots = projectRoots ?? discoverProjectRoots(cwd);
|
|
271
|
+
const resolved = [];
|
|
272
|
+
const seen = /* @__PURE__ */ new Set();
|
|
273
|
+
for (const root of roots) {
|
|
274
|
+
const appDir = path2.resolve(root, "app");
|
|
275
|
+
if (!pathExists(appDir)) {
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
if (seen.has(appDir)) {
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
seen.add(appDir);
|
|
282
|
+
resolved.push(appDir);
|
|
283
|
+
}
|
|
284
|
+
return resolved;
|
|
285
|
+
}
|
|
286
|
+
function homeDir() {
|
|
287
|
+
return resolveHomeDir();
|
|
288
|
+
}
|
|
289
|
+
function resolveHomeDir(cwd = process.cwd(), options) {
|
|
290
|
+
const resolvedCwd = path2.resolve(cwd);
|
|
291
|
+
const directApp = path2.resolve(resolvedCwd, "app");
|
|
292
|
+
if (pathExists(directApp) && hasAnyDataMarkers(directApp)) {
|
|
293
|
+
return directApp;
|
|
294
|
+
}
|
|
295
|
+
const candidates = resolveCandidateAppDirs(
|
|
296
|
+
resolvedCwd,
|
|
297
|
+
options?.projectRoots
|
|
298
|
+
);
|
|
299
|
+
if (candidates.length === 0) {
|
|
300
|
+
return directApp;
|
|
301
|
+
}
|
|
302
|
+
candidates.sort((left, right) => {
|
|
303
|
+
const leftScore = scoreAppCandidate(left);
|
|
304
|
+
const rightScore = scoreAppCandidate(right);
|
|
305
|
+
if (leftScore !== rightScore) {
|
|
306
|
+
return rightScore - leftScore;
|
|
307
|
+
}
|
|
308
|
+
const leftDistance = path2.relative(resolvedCwd, left).split(path2.sep).length;
|
|
309
|
+
const rightDistance = path2.relative(resolvedCwd, right).split(path2.sep).length;
|
|
310
|
+
if (leftDistance !== rightDistance) {
|
|
311
|
+
return leftDistance - rightDistance;
|
|
312
|
+
}
|
|
313
|
+
return left.localeCompare(right);
|
|
314
|
+
});
|
|
315
|
+
return candidates[0];
|
|
316
|
+
}
|
|
317
|
+
function resolveContentRoots(subdir) {
|
|
318
|
+
if (subdir === "data") {
|
|
319
|
+
return [homeDir()];
|
|
320
|
+
}
|
|
321
|
+
return [path2.join(homeDir(), subdir)];
|
|
322
|
+
}
|
|
323
|
+
function builtInSkillsDir() {
|
|
324
|
+
const moduleDir = path2.dirname(fileURLToPath(import.meta.url));
|
|
325
|
+
if (path2.basename(moduleDir) === "dist") {
|
|
326
|
+
return path2.join(path2.dirname(moduleDir), "skills");
|
|
327
|
+
}
|
|
328
|
+
if (path2.basename(moduleDir) === "chat" && path2.basename(path2.dirname(moduleDir)) === "src") {
|
|
329
|
+
return path2.resolve(moduleDir, "../../skills");
|
|
330
|
+
}
|
|
331
|
+
const packageDir = resolvePackageDir(process.cwd(), "@sentry/junior");
|
|
332
|
+
return path2.join(packageDir ?? moduleDir, "skills");
|
|
333
|
+
}
|
|
334
|
+
function dataDir() {
|
|
335
|
+
return resolveContentRoots("data")[0];
|
|
336
|
+
}
|
|
337
|
+
function soulPath() {
|
|
338
|
+
return path2.join(dataDir(), "SOUL.md");
|
|
339
|
+
}
|
|
340
|
+
function worldPath() {
|
|
341
|
+
return path2.join(dataDir(), "WORLD.md");
|
|
342
|
+
}
|
|
343
|
+
function descriptionPath() {
|
|
344
|
+
return path2.join(dataDir(), "DESCRIPTION.md");
|
|
345
|
+
}
|
|
346
|
+
function skillsDir() {
|
|
347
|
+
return resolveContentRoots("skills")[0];
|
|
348
|
+
}
|
|
349
|
+
function pluginsDir() {
|
|
350
|
+
return resolveContentRoots("plugins")[0];
|
|
351
|
+
}
|
|
352
|
+
function dataRoots() {
|
|
353
|
+
return unique(resolveContentRoots("data"));
|
|
354
|
+
}
|
|
355
|
+
function skillRoots() {
|
|
356
|
+
return unique([builtInSkillsDir(), ...resolveContentRoots("skills")]);
|
|
357
|
+
}
|
|
358
|
+
function pluginRoots() {
|
|
359
|
+
return unique(resolveContentRoots("plugins"));
|
|
360
|
+
}
|
|
361
|
+
function soulPathCandidates() {
|
|
362
|
+
const candidates = dataRoots().map((root) => path2.join(root, "SOUL.md"));
|
|
363
|
+
return unique(candidates);
|
|
364
|
+
}
|
|
365
|
+
function worldPathCandidates() {
|
|
366
|
+
const candidates = dataRoots().map((root) => path2.join(root, "WORLD.md"));
|
|
367
|
+
return unique(candidates);
|
|
368
|
+
}
|
|
369
|
+
function descriptionPathCandidates() {
|
|
370
|
+
const candidates = dataRoots().map(
|
|
371
|
+
(root) => path2.join(root, "DESCRIPTION.md")
|
|
372
|
+
);
|
|
373
|
+
return unique(candidates);
|
|
374
|
+
}
|
|
375
|
+
var RESERVED_APP_FILES = /* @__PURE__ */ new Set([
|
|
376
|
+
"SOUL.md",
|
|
377
|
+
"WORLD.md",
|
|
378
|
+
"DESCRIPTION.md",
|
|
379
|
+
"ABOUT.md"
|
|
380
|
+
]);
|
|
381
|
+
function listReferenceFiles() {
|
|
382
|
+
const appDir = homeDir();
|
|
383
|
+
try {
|
|
384
|
+
const entries = fs.readdirSync(appDir, { withFileTypes: true });
|
|
385
|
+
return entries.filter(
|
|
386
|
+
(entry) => entry.isFile() && entry.name.endsWith(".md") && !RESERVED_APP_FILES.has(entry.name)
|
|
387
|
+
).map((entry) => path2.join(appDir, entry.name)).sort();
|
|
388
|
+
} catch {
|
|
389
|
+
return [];
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export {
|
|
394
|
+
isValidPackageName,
|
|
395
|
+
resolvePackageLocation,
|
|
396
|
+
resolvePackageDir,
|
|
397
|
+
isDirectory2 as isDirectory,
|
|
398
|
+
isFile2 as isFile,
|
|
399
|
+
discoverNodeModulesDirs,
|
|
400
|
+
discoverProjectRoots,
|
|
401
|
+
homeDir,
|
|
402
|
+
resolveHomeDir,
|
|
403
|
+
builtInSkillsDir,
|
|
404
|
+
dataDir,
|
|
405
|
+
soulPath,
|
|
406
|
+
worldPath,
|
|
407
|
+
descriptionPath,
|
|
408
|
+
skillsDir,
|
|
409
|
+
pluginsDir,
|
|
410
|
+
dataRoots,
|
|
411
|
+
skillRoots,
|
|
412
|
+
pluginRoots,
|
|
413
|
+
soulPathCandidates,
|
|
414
|
+
worldPathCandidates,
|
|
415
|
+
descriptionPathCandidates,
|
|
416
|
+
listReferenceFiles
|
|
417
|
+
};
|
|
@@ -289,6 +289,7 @@ function toGenAiMessagesTraceAttributes(prefix, messages) {
|
|
|
289
289
|
return {
|
|
290
290
|
[`${prefix}.message_count`]: messages.length,
|
|
291
291
|
[`${prefix}.content_chars`]: contentChars,
|
|
292
|
+
[`${prefix}.messages.size`]: contentChars,
|
|
292
293
|
...roles.size > 0 ? { [`${prefix}.roles`]: [...roles] } : {},
|
|
293
294
|
...partTypes.size > 0 ? { [`${prefix}.part_types`]: [...partTypes] } : {}
|
|
294
295
|
};
|
|
@@ -13,17 +13,17 @@ import {
|
|
|
13
13
|
instructionProvenanceFor,
|
|
14
14
|
sanitizePostgresJson,
|
|
15
15
|
withConversationEventLock
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-M243JMZH.js";
|
|
17
17
|
import {
|
|
18
18
|
getStateAdapter,
|
|
19
19
|
sleep
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ALAKN7LR.js";
|
|
21
21
|
import {
|
|
22
22
|
botConfig,
|
|
23
23
|
escapeXml,
|
|
24
24
|
resolveGatewayModel,
|
|
25
25
|
unwrapCurrentInstruction
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-VURFJVFH.js";
|
|
27
27
|
import {
|
|
28
28
|
toStoredSlackActor
|
|
29
29
|
} from "./chunk-HZF5P5UN.js";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
logException,
|
|
33
33
|
logWarn,
|
|
34
34
|
setSpanAttributes
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-ALYQOZG7.js";
|
|
36
36
|
import {
|
|
37
37
|
isRecord,
|
|
38
38
|
toOptionalNumber,
|
|
@@ -2713,12 +2713,6 @@ function getChannelConfigurationServiceById(channelId) {
|
|
|
2713
2713
|
});
|
|
2714
2714
|
}
|
|
2715
2715
|
|
|
2716
|
-
// src/chat/interruption-marker.ts
|
|
2717
|
-
var INTERRUPTED_MARKER = "\n\n[Response interrupted before completion]";
|
|
2718
|
-
function getInterruptionMarker() {
|
|
2719
|
-
return INTERRUPTED_MARKER;
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
2716
|
// src/chat/services/pending-auth.ts
|
|
2723
2717
|
var AUTH_LINK_REUSE_WINDOW_MS = 10 * 60 * 1e3;
|
|
2724
2718
|
var NON_REQUEST_SKIPPED_REASON_PREFIXES = [
|
|
@@ -2840,7 +2834,6 @@ export {
|
|
|
2840
2834
|
persistAuthPauseSessionRecord,
|
|
2841
2835
|
persistContinuationSessionRecord,
|
|
2842
2836
|
persistYieldSessionRecord,
|
|
2843
|
-
getInterruptionMarker,
|
|
2844
2837
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
2845
2838
|
canReusePendingAuthLink,
|
|
2846
2839
|
getConversationPendingAuth,
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
TURN_REASONING_LEVELS,
|
|
10
10
|
getChatConfig,
|
|
11
11
|
modelProfileSchema
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VURFJVFH.js";
|
|
13
13
|
import {
|
|
14
14
|
juniorDestinations
|
|
15
15
|
} from "./chunk-VFUK3X5B.js";
|
|
16
16
|
import {
|
|
17
17
|
normalizeIdentityEmail
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ALYQOZG7.js";
|
|
19
19
|
import {
|
|
20
20
|
parseSlackChannelReferenceId,
|
|
21
21
|
parseSlackTeamId
|
|
@@ -126,9 +126,64 @@ var conversationReportToolCallSchema = z2.object({
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
|
+
var conversationReportReasoningPartSchema = z2.object({
|
|
130
|
+
type: z2.literal("reasoning"),
|
|
131
|
+
text: z2.string().min(1).optional(),
|
|
132
|
+
redacted: z2.literal(true).optional()
|
|
133
|
+
}).strict().superRefine((data, context) => {
|
|
134
|
+
if (data.text === void 0 === (data.redacted !== true)) {
|
|
135
|
+
context.addIssue({
|
|
136
|
+
code: "custom",
|
|
137
|
+
message: "reasoning content must be text or explicitly redacted"
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
var conversationReportAssistantToolCallPartSchema = z2.object({
|
|
142
|
+
type: z2.literal("tool_call"),
|
|
143
|
+
toolCallId: z2.string().min(1)
|
|
144
|
+
}).strict();
|
|
145
|
+
var conversationReportAssistantMetadataSchema = z2.object({
|
|
146
|
+
parts: z2.array(
|
|
147
|
+
z2.discriminatedUnion("type", [
|
|
148
|
+
conversationReportReasoningPartSchema,
|
|
149
|
+
conversationReportAssistantToolCallPartSchema
|
|
150
|
+
])
|
|
151
|
+
).min(1)
|
|
152
|
+
}).strict();
|
|
129
153
|
var conversationReportToolCallsEventDataSchema = z2.object({
|
|
130
154
|
type: z2.literal("tool_calls"),
|
|
131
|
-
calls: z2.array(conversationReportToolCallSchema).min(1)
|
|
155
|
+
calls: z2.array(conversationReportToolCallSchema).min(1),
|
|
156
|
+
assistant: conversationReportAssistantMetadataSchema.optional()
|
|
157
|
+
}).strict().superRefine((data, context) => {
|
|
158
|
+
if (!data.assistant) return;
|
|
159
|
+
const callCounts = /* @__PURE__ */ new Map();
|
|
160
|
+
for (const call of data.calls) {
|
|
161
|
+
callCounts.set(
|
|
162
|
+
call.toolCallId,
|
|
163
|
+
(callCounts.get(call.toolCallId) ?? 0) + 1
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
const partCounts = /* @__PURE__ */ new Map();
|
|
167
|
+
for (const part of data.assistant.parts) {
|
|
168
|
+
if (part.type !== "tool_call") continue;
|
|
169
|
+
partCounts.set(
|
|
170
|
+
part.toolCallId,
|
|
171
|
+
(partCounts.get(part.toolCallId) ?? 0) + 1
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
if (callCounts.size !== partCounts.size || [...callCounts].some(
|
|
175
|
+
([toolCallId, count]) => partCounts.get(toolCallId) !== count
|
|
176
|
+
)) {
|
|
177
|
+
context.addIssue({
|
|
178
|
+
code: "custom",
|
|
179
|
+
path: ["assistant", "parts"],
|
|
180
|
+
message: "assistant tool parts must reference every call exactly once"
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
var conversationReportAssistantMessageEventDataSchema = z2.object({
|
|
185
|
+
type: z2.literal("assistant_message"),
|
|
186
|
+
parts: z2.array(conversationReportReasoningPartSchema).min(1)
|
|
132
187
|
}).strict();
|
|
133
188
|
var conversationReportTurnLifecycleEventDataSchema = z2.discriminatedUnion(
|
|
134
189
|
"state",
|
|
@@ -199,6 +254,7 @@ var conversationReportSubagentEventDataSchema = z2.object({
|
|
|
199
254
|
var conversationReportEventDataSchema = z2.discriminatedUnion("type", [
|
|
200
255
|
conversationReportMessageEventDataSchema,
|
|
201
256
|
conversationReportMessageHandledEventDataSchema,
|
|
257
|
+
conversationReportAssistantMessageEventDataSchema,
|
|
202
258
|
conversationReportToolCallsEventDataSchema,
|
|
203
259
|
conversationReportTurnLifecycleEventDataSchema,
|
|
204
260
|
conversationReportTurnContextEventDataSchema,
|
|
@@ -270,6 +326,31 @@ function validateConversationEvents(report, context) {
|
|
|
270
326
|
message: "redacted event history must redact tool payloads"
|
|
271
327
|
});
|
|
272
328
|
}
|
|
329
|
+
if (report.eventHistory.status === "redacted" && event.data.type === "assistant_message" && event.data.parts.some((part) => part.text !== void 0)) {
|
|
330
|
+
context.addIssue({
|
|
331
|
+
code: "custom",
|
|
332
|
+
path: ["events", index, "data"],
|
|
333
|
+
message: "redacted event history must redact assistant messages"
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
if (report.eventHistory.status === "available" && event.data.type === "assistant_message" && event.data.parts.some((part) => part.redacted === true)) {
|
|
337
|
+
context.addIssue({
|
|
338
|
+
code: "custom",
|
|
339
|
+
path: ["events", index, "data"],
|
|
340
|
+
message: "available event history must expose reasoning"
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
if (event.data.type === "tool_calls" && (report.eventHistory.status === "redacted" && event.data.assistant?.parts.some(
|
|
344
|
+
(part) => part.type === "reasoning" && part.text !== void 0
|
|
345
|
+
) || report.eventHistory.status === "available" && event.data.assistant?.parts.some(
|
|
346
|
+
(part) => part.type === "reasoning" && part.redacted === true
|
|
347
|
+
))) {
|
|
348
|
+
context.addIssue({
|
|
349
|
+
code: "custom",
|
|
350
|
+
path: ["events", index, "data", "assistant"],
|
|
351
|
+
message: "assistant reasoning must match event history visibility"
|
|
352
|
+
});
|
|
353
|
+
}
|
|
273
354
|
}
|
|
274
355
|
}
|
|
275
356
|
var conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|