@sentry/junior 0.71.3 → 0.72.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.
Files changed (56) hide show
  1. package/bin/junior.mjs +10 -0
  2. package/dist/api-reference.d.ts +2 -0
  3. package/dist/app.d.ts +5 -5
  4. package/dist/app.js +1039 -1971
  5. package/dist/chat/agent-dispatch/heartbeat.d.ts +0 -6
  6. package/dist/chat/mcp/errors.d.ts +3 -0
  7. package/dist/chat/mcp/tool-manager.d.ts +5 -1
  8. package/dist/chat/plugins/agent-hooks.d.ts +3 -2
  9. package/dist/chat/requester.d.ts +60 -0
  10. package/dist/chat/respond.d.ts +2 -6
  11. package/dist/chat/runtime/agent-continue-runner.d.ts +25 -0
  12. package/dist/chat/runtime/reply-executor.d.ts +4 -4
  13. package/dist/chat/runtime/turn.d.ts +2 -2
  14. package/dist/chat/services/agent-continue.d.ts +27 -0
  15. package/dist/chat/services/message-actor-identity.d.ts +12 -4
  16. package/dist/chat/services/turn-session-record.d.ts +10 -7
  17. package/dist/chat/slack/user.d.ts +4 -4
  18. package/dist/chat/state/adapter.d.ts +2 -0
  19. package/dist/chat/state/conversation-details.d.ts +4 -3
  20. package/dist/chat/state/session-log.d.ts +43 -0
  21. package/dist/chat/state/turn-session.d.ts +7 -10
  22. package/dist/chat/task-execution/slack-work.d.ts +5 -5
  23. package/dist/chat/task-execution/store.d.ts +83 -48
  24. package/dist/chat/task-execution/worker.d.ts +3 -3
  25. package/dist/chat/tools/definition.d.ts +3 -0
  26. package/dist/chat/tools/execution/tool-error-handler.d.ts +2 -1
  27. package/dist/chat/tools/types.d.ts +2 -5
  28. package/dist/{chunk-R62YWUNO.js → chunk-3FYPXHPL.js} +10 -28
  29. package/dist/chunk-4JXCSGSA.js +212 -0
  30. package/dist/{chunk-GT67ZWZQ.js → chunk-55XEZFGD.js} +5 -3
  31. package/dist/{chunk-BBXYXOJW.js → chunk-6GEYPE6T.js} +18 -523
  32. package/dist/chunk-G3E7SCME.js +28 -0
  33. package/dist/{chunk-UXG6TU2U.js → chunk-GB3AL54K.js} +8 -93
  34. package/dist/chunk-HNMUVGSR.js +1119 -0
  35. package/dist/{chunk-XE2VFQQN.js → chunk-ICKIDP7G.js} +1 -1
  36. package/dist/chunk-KVZL5NZS.js +519 -0
  37. package/dist/chunk-PP7AGSBU.js +185 -0
  38. package/dist/{chunk-B5HKWWQB.js → chunk-VLIO6RQR.js} +8 -6
  39. package/dist/{chunk-HOGQL2H6.js → chunk-VSNA5KAB.js} +177 -101
  40. package/dist/{chunk-76YMBKW7.js → chunk-XC33FJZN.js} +4 -12
  41. package/dist/{chunk-JS4HURDT.js → chunk-ZJQPA67D.js} +25 -25
  42. package/dist/cli/check.js +10 -8
  43. package/dist/cli/run.js +9 -1
  44. package/dist/cli/snapshot-warmup.js +10 -7
  45. package/dist/cli/upgrade.js +599 -0
  46. package/dist/nitro.d.ts +1 -1
  47. package/dist/nitro.js +5 -4
  48. package/dist/plugins.d.ts +1 -1
  49. package/dist/reporting/conversations.d.ts +116 -0
  50. package/dist/reporting.d.ts +24 -129
  51. package/dist/reporting.js +310 -158
  52. package/package.json +3 -3
  53. package/dist/chat/runtime/timeout-resume-runner.d.ts +0 -19
  54. package/dist/chat/services/requester-identity.d.ts +0 -19
  55. package/dist/chat/services/timeout-resume.d.ts +0 -23
  56. package/dist/handlers/turn-resume.d.ts +0 -4
@@ -2,224 +2,16 @@ import {
2
2
  sentry_exports
3
3
  } from "./chunk-Z3YD6NHK.js";
4
4
 
5
- // src/chat/discovery.ts
6
- import fs, { statSync } from "fs";
5
+ // src/chat/logging.ts
6
+ import { AsyncLocalStorage } from "async_hooks";
7
7
  import path from "path";
8
- import { fileURLToPath } from "url";
9
- function isDirectory(targetPath) {
10
- try {
11
- return statSync(targetPath).isDirectory();
12
- } catch {
13
- return false;
14
- }
15
- }
16
- function isFile(targetPath) {
17
- try {
18
- return statSync(targetPath).isFile();
19
- } catch {
20
- return false;
21
- }
22
- }
23
- function normalizePath(targetPath) {
24
- return path.resolve(targetPath);
25
- }
26
- function uniqueResolvedPathsInOrder(values) {
27
- const seen = /* @__PURE__ */ new Set();
28
- const resolved = [];
29
- for (const value of values) {
30
- const normalized = normalizePath(value);
31
- if (seen.has(normalized)) {
32
- continue;
33
- }
34
- seen.add(normalized);
35
- resolved.push(normalized);
36
- }
37
- return resolved;
38
- }
39
- function isNodeModulesPath(candidatePath) {
40
- return path.basename(candidatePath) === "node_modules";
41
- }
42
- function isInsidePnpmStore(candidatePath) {
43
- return candidatePath.split(path.sep).includes(".pnpm");
44
- }
45
- function runningFromInstalledPackage() {
46
- const currentFile = fileURLToPath(import.meta.url);
47
- const marker = `${path.sep}node_modules${path.sep}@sentry${path.sep}junior${path.sep}`;
48
- return currentFile.includes(marker);
49
- }
50
- function listInstalledPackageNodeModulesDirs() {
51
- if (!runningFromInstalledPackage()) {
52
- return [];
53
- }
54
- const dirs = [];
55
- let current = path.resolve(path.dirname(fileURLToPath(import.meta.url)));
56
- while (true) {
57
- if (isNodeModulesPath(current) && !isInsidePnpmStore(current) && isDirectory(current)) {
58
- dirs.push(current);
59
- }
60
- const parent = path.dirname(current);
61
- if (parent === current) {
62
- break;
63
- }
64
- current = parent;
65
- }
66
- return dirs;
67
- }
68
- function listCwdAncestorNodeModulesDirs(cwd) {
69
- const resolvedCwd = normalizePath(cwd);
70
- const dirs = [];
71
- let current = resolvedCwd;
72
- while (true) {
73
- const nodeModulesDir = path.join(current, "node_modules");
74
- if (isDirectory(nodeModulesDir)) {
75
- dirs.push(nodeModulesDir);
76
- }
77
- if (isFile(path.join(current, "package.json"))) {
78
- break;
79
- }
80
- const parent = path.dirname(current);
81
- if (parent === current) {
82
- break;
83
- }
84
- current = parent;
85
- }
86
- return dirs;
87
- }
88
- function discoverNodeModulesDirs(cwd = process.cwd(), options) {
89
- const explicit = options?.candidateDirs?.filter((dir) => isDirectory(dir)) ?? [];
90
- if (explicit.length > 0) {
91
- return uniqueResolvedPathsInOrder(explicit);
92
- }
93
- return uniqueResolvedPathsInOrder([
94
- ...listInstalledPackageNodeModulesDirs(),
95
- ...listCwdAncestorNodeModulesDirs(cwd)
96
- ]);
97
- }
98
- function discoverProjectRoots(cwd = process.cwd(), options) {
99
- const roots = discoverNodeModulesDirs(
100
- cwd,
101
- options?.nodeModulesDirs ? { candidateDirs: options.nodeModulesDirs } : void 0
102
- ).map((nodeModulesDir) => path.dirname(nodeModulesDir));
103
- return uniqueResolvedPathsInOrder([cwd, ...roots]);
104
- }
105
- function unique(values) {
106
- return [...new Set(values)];
107
- }
108
- function pathExists(targetPath) {
109
- try {
110
- fs.accessSync(targetPath);
111
- return true;
112
- } catch {
113
- return false;
114
- }
115
- }
116
- function hasAnyDataMarkers(appDir) {
117
- return pathExists(path.join(appDir, "SOUL.md")) || pathExists(path.join(appDir, "WORLD.md"));
118
- }
119
- function scoreAppCandidate(appDir) {
120
- let score = 0;
121
- if (pathExists(path.join(appDir, "SOUL.md"))) {
122
- score += 4;
123
- }
124
- if (pathExists(path.join(appDir, "WORLD.md"))) {
125
- score += 2;
126
- }
127
- if (pathExists(path.join(appDir, "skills"))) {
128
- score += 1;
129
- }
130
- if (pathExists(path.join(appDir, "plugins"))) {
131
- score += 1;
132
- }
133
- return score;
134
- }
135
- function resolveCandidateAppDirs(cwd, projectRoots) {
136
- const roots = projectRoots ?? discoverProjectRoots(cwd);
137
- const resolved = [];
138
- const seen = /* @__PURE__ */ new Set();
139
- for (const root of roots) {
140
- const appDir = path.resolve(root, "app");
141
- if (!pathExists(appDir)) {
142
- continue;
143
- }
144
- if (seen.has(appDir)) {
145
- continue;
146
- }
147
- seen.add(appDir);
148
- resolved.push(appDir);
149
- }
150
- return resolved;
151
- }
152
- function homeDir() {
153
- return resolveHomeDir();
154
- }
155
- function resolveHomeDir(cwd = process.cwd(), options) {
156
- const resolvedCwd = path.resolve(cwd);
157
- const directApp = path.resolve(resolvedCwd, "app");
158
- if (pathExists(directApp) && hasAnyDataMarkers(directApp)) {
159
- return directApp;
160
- }
161
- const candidates = resolveCandidateAppDirs(
162
- resolvedCwd,
163
- options?.projectRoots
164
- );
165
- if (candidates.length === 0) {
166
- return directApp;
167
- }
168
- candidates.sort((left, right) => {
169
- const leftScore = scoreAppCandidate(left);
170
- const rightScore = scoreAppCandidate(right);
171
- if (leftScore !== rightScore) {
172
- return rightScore - leftScore;
173
- }
174
- const leftDistance = path.relative(resolvedCwd, left).split(path.sep).length;
175
- const rightDistance = path.relative(resolvedCwd, right).split(path.sep).length;
176
- if (leftDistance !== rightDistance) {
177
- return leftDistance - rightDistance;
178
- }
179
- return left.localeCompare(right);
180
- });
181
- return candidates[0];
182
- }
183
- function resolveContentRoots(subdir) {
184
- if (subdir === "data") {
185
- return [homeDir()];
186
- }
187
- return [path.join(homeDir(), subdir)];
188
- }
189
- function dataRoots() {
190
- return unique(resolveContentRoots("data"));
191
- }
192
- function skillRoots() {
193
- return unique(resolveContentRoots("skills"));
194
- }
195
- function pluginRoots() {
196
- return unique(resolveContentRoots("plugins"));
197
- }
198
- function soulPathCandidates() {
199
- const candidates = dataRoots().map((root) => path.join(root, "SOUL.md"));
200
- return unique(candidates);
201
- }
202
- function worldPathCandidates() {
203
- const candidates = dataRoots().map((root) => path.join(root, "WORLD.md"));
204
- return unique(candidates);
205
- }
206
- var RESERVED_APP_FILES = /* @__PURE__ */ new Set([
207
- "SOUL.md",
208
- "WORLD.md",
209
- "DESCRIPTION.md",
210
- "ABOUT.md"
211
- ]);
212
- function listReferenceFiles() {
213
- const appDir = homeDir();
214
- try {
215
- const entries = fs.readdirSync(appDir, { withFileTypes: true });
216
- return entries.filter(
217
- (entry) => entry.isFile() && entry.name.endsWith(".md") && !RESERVED_APP_FILES.has(entry.name)
218
- ).map((entry) => path.join(appDir, entry.name)).sort();
219
- } catch {
220
- return [];
221
- }
222
- }
8
+ import { styleText } from "util";
9
+ import {
10
+ ConfigError,
11
+ configureSync,
12
+ getConfig,
13
+ getLogger
14
+ } from "@logtape/logtape";
223
15
 
224
16
  // src/chat/coerce.ts
225
17
  function toOptionalString(value) {
@@ -233,15 +25,6 @@ function isRecord(value) {
233
25
  }
234
26
 
235
27
  // src/chat/logging.ts
236
- import { AsyncLocalStorage } from "async_hooks";
237
- import path2 from "path";
238
- import { styleText } from "util";
239
- import {
240
- ConfigError,
241
- configureSync,
242
- getConfig,
243
- getLogger
244
- } from "@logtape/logtape";
245
28
  var MAX_STRING_VALUE = 1200;
246
29
  var SECRETS_RE = [
247
30
  /\b(sk-[A-Za-z0-9_-]{20,})\b/g,
@@ -813,8 +596,8 @@ function toRelativeConsolePath(value) {
813
596
  return normalized;
814
597
  }
815
598
  try {
816
- const relative = path2.relative(process.cwd(), normalized);
817
- if (relative.length > 0 && !relative.startsWith("..") && !path2.isAbsolute(relative)) {
599
+ const relative = path.relative(process.cwd(), normalized);
600
+ if (relative.length > 0 && !relative.startsWith("..") && !path.isAbsolute(relative)) {
818
601
  return relative;
819
602
  }
820
603
  } catch {
@@ -1534,301 +1317,15 @@ function extractGenAiUsageAttributes(...sources) {
1534
1317
  };
1535
1318
  }
1536
1319
 
1537
- // src/package-resolution.ts
1538
- import { statSync as statSync2 } from "fs";
1539
- import { createRequire } from "module";
1540
- import path3 from "path";
1541
- function isDirectory2(targetPath) {
1542
- try {
1543
- return statSync2(targetPath).isDirectory();
1544
- } catch {
1545
- return false;
1546
- }
1547
- }
1548
- function isFile2(targetPath) {
1549
- try {
1550
- return statSync2(targetPath).isFile();
1551
- } catch {
1552
- return false;
1553
- }
1554
- }
1555
- function uniqueResolvedPathsInOrder2(values) {
1556
- const seen = /* @__PURE__ */ new Set();
1557
- const resolved = [];
1558
- for (const value of values) {
1559
- const normalized = path3.resolve(value);
1560
- if (seen.has(normalized)) {
1561
- continue;
1562
- }
1563
- seen.add(normalized);
1564
- resolved.push(normalized);
1565
- }
1566
- return resolved;
1567
- }
1568
- function ancestorNodeModulesDirs(cwd) {
1569
- const dirs = [];
1570
- let current = path3.resolve(cwd);
1571
- while (true) {
1572
- const nodeModulesDir = path3.join(current, "node_modules");
1573
- if (isDirectory2(nodeModulesDir)) {
1574
- dirs.push(nodeModulesDir);
1575
- }
1576
- const parent = path3.dirname(current);
1577
- if (parent === current) {
1578
- break;
1579
- }
1580
- current = parent;
1581
- }
1582
- return dirs;
1583
- }
1584
- function packageDirInNodeModules(nodeModulesDir, packageName) {
1585
- const packageDir = path3.join(nodeModulesDir, ...packageName.split("/"));
1586
- return isDirectory2(packageDir) ? path3.resolve(packageDir) : void 0;
1587
- }
1588
- function isValidPackageSegment(segment) {
1589
- return Boolean(segment) && segment !== "." && segment !== ".." && !segment.startsWith(".") && /^[A-Za-z0-9._~-]+$/.test(segment);
1590
- }
1591
- function isValidPackageName(packageName) {
1592
- if (!packageName || packageName.includes("\\") || path3.isAbsolute(packageName)) {
1593
- return false;
1594
- }
1595
- const parts = packageName.split("/");
1596
- if (parts[0].startsWith("@")) {
1597
- return parts.length === 2 && parts[0].length > 1 && isValidPackageSegment(parts[0].slice(1)) && isValidPackageSegment(parts[1]);
1598
- }
1599
- return parts.length === 1 && isValidPackageSegment(parts[0]);
1600
- }
1601
- function findPackageRoot(entryPath) {
1602
- let dir = path3.dirname(entryPath);
1603
- while (dir !== path3.dirname(dir)) {
1604
- if (isFile2(path3.join(dir, "package.json"))) {
1605
- return path3.resolve(dir);
1606
- }
1607
- dir = path3.dirname(dir);
1608
- }
1609
- return void 0;
1610
- }
1611
- function findPackageNodeModulesDir(packageDir, packageName) {
1612
- const parts = path3.resolve(packageDir).split(path3.sep);
1613
- const packageParts = packageName.split("/");
1614
- for (let index = parts.length - 1; index >= 0; index -= 1) {
1615
- if (parts[index] !== "node_modules") {
1616
- continue;
1617
- }
1618
- const candidatePackageParts = parts.slice(
1619
- index + 1,
1620
- index + 1 + packageParts.length
1621
- );
1622
- if (candidatePackageParts.join("/") !== packageParts.join("/")) {
1623
- continue;
1624
- }
1625
- return path3.resolve(parts.slice(0, index + 1).join(path3.sep) || path3.sep);
1626
- }
1627
- return void 0;
1628
- }
1629
- function resolvePackageWithNode(cwd, packageName) {
1630
- let requireFromCwd;
1631
- try {
1632
- requireFromCwd = createRequire(path3.join(cwd, "package.json"));
1633
- } catch {
1634
- return void 0;
1635
- }
1636
- for (const specifier of [`${packageName}/package.json`, packageName]) {
1637
- try {
1638
- const resolved = requireFromCwd.resolve(specifier);
1639
- const dir = specifier.endsWith("/package.json") ? path3.dirname(resolved) : findPackageRoot(resolved);
1640
- if (!dir) {
1641
- continue;
1642
- }
1643
- const nodeModulesDir = findPackageNodeModulesDir(dir, packageName);
1644
- return {
1645
- dir,
1646
- ...nodeModulesDir ? { nodeModulesDir } : {}
1647
- };
1648
- } catch {
1649
- }
1650
- }
1651
- return void 0;
1652
- }
1653
- function resolvePackageLocation(cwd, packageName, options) {
1654
- if (!isValidPackageName(packageName)) {
1655
- return void 0;
1656
- }
1657
- const nodeModulesDirs = uniqueResolvedPathsInOrder2([
1658
- ...options?.nodeModulesDirs ?? [],
1659
- ...ancestorNodeModulesDirs(cwd)
1660
- ]);
1661
- for (const nodeModulesDir of nodeModulesDirs) {
1662
- const dir = packageDirInNodeModules(nodeModulesDir, packageName);
1663
- if (dir) {
1664
- return { dir, nodeModulesDir };
1665
- }
1666
- }
1667
- return resolvePackageWithNode(cwd, packageName);
1668
- }
1669
- function resolvePackageDir(cwd, packageName) {
1670
- return resolvePackageLocation(cwd, packageName)?.dir;
1671
- }
1672
-
1673
- // src/chat/plugins/package-discovery.ts
1674
- import path4 from "path";
1675
- function normalizeForGlob(targetPath) {
1676
- return targetPath.split(path4.sep).join("/");
1677
- }
1678
- function uniqueStringsInOrder(values) {
1679
- const seen = /* @__PURE__ */ new Set();
1680
- const resolved = [];
1681
- for (const value of values) {
1682
- if (seen.has(value)) {
1683
- continue;
1684
- }
1685
- seen.add(value);
1686
- resolved.push(value);
1687
- }
1688
- return resolved;
1689
- }
1690
- function pathForTracingInclude(cwd, targetPath) {
1691
- const relative = path4.relative(cwd, targetPath);
1692
- if (!relative || path4.isAbsolute(relative) || relative === ".." || relative.startsWith(`..${path4.sep}`)) {
1693
- return null;
1694
- }
1695
- const normalized = normalizeForGlob(relative);
1696
- return normalized.startsWith(".") ? normalized : `./${normalized}`;
1697
- }
1698
- function normalizePluginPackageNames(packageNames) {
1699
- if (packageNames === void 0) {
1700
- return [];
1701
- }
1702
- if (!Array.isArray(packageNames)) {
1703
- throw new Error("Plugin package names must be an array");
1704
- }
1705
- const normalized = [];
1706
- const seen = /* @__PURE__ */ new Set();
1707
- for (const packageName of packageNames) {
1708
- const normalizedPackageName = typeof packageName === "string" ? packageName.trim() : "";
1709
- if (!normalizedPackageName || !isValidPackageName(normalizedPackageName)) {
1710
- throw new Error("Plugin package names must be valid npm package names");
1711
- }
1712
- if (seen.has(normalizedPackageName)) {
1713
- continue;
1714
- }
1715
- seen.add(normalizedPackageName);
1716
- normalized.push(normalizedPackageName);
1717
- }
1718
- return normalized;
1719
- }
1720
- function formatNodeModulesDirs(candidateNodeModulesDirs) {
1721
- return candidateNodeModulesDirs.length > 0 ? candidateNodeModulesDirs.join(", ") : "none found";
1722
- }
1723
- function resolvePackageDirFromName(cwd, packageName, candidateNodeModulesDirs) {
1724
- return resolvePackageLocation(cwd, packageName, {
1725
- nodeModulesDirs: candidateNodeModulesDirs
1726
- }) ?? null;
1727
- }
1728
- function readPluginPackageFlags(dir) {
1729
- const hasRootPluginManifest = isFile(path4.join(dir, "plugin.yaml"));
1730
- const hasPluginsDir = isDirectory(path4.join(dir, "plugins"));
1731
- const hasSkillsDir = isDirectory(path4.join(dir, "skills"));
1732
- if (!hasRootPluginManifest && !hasPluginsDir && !hasSkillsDir) {
1733
- return null;
1734
- }
1735
- return {
1736
- hasRootPluginManifest,
1737
- hasPluginsDir,
1738
- hasSkillsDir
1739
- };
1320
+ // src/chat/slack/ids.ts
1321
+ function isSlackTeamId(value) {
1322
+ return /^T[A-Z0-9]+$/.test(value);
1740
1323
  }
1741
- function discoverDeclaredPackages(packageNames, candidateNodeModulesDirs, cwd) {
1742
- const discovered = [];
1743
- const seenPackageDirs = /* @__PURE__ */ new Set();
1744
- for (const packageName of packageNames) {
1745
- const resolved = resolvePackageDirFromName(
1746
- cwd,
1747
- packageName,
1748
- candidateNodeModulesDirs
1749
- );
1750
- if (!resolved) {
1751
- throw new Error(
1752
- `Plugin package "${packageName}" was configured but could not be resolved from node_modules or package resolution (${formatNodeModulesDirs(candidateNodeModulesDirs)})`
1753
- );
1754
- }
1755
- if (seenPackageDirs.has(resolved.dir)) {
1756
- continue;
1757
- }
1758
- const pluginFlags = readPluginPackageFlags(resolved.dir);
1759
- if (!pluginFlags) {
1760
- throw new Error(
1761
- `Plugin package "${packageName}" was configured but does not contain plugin content; expected plugin.yaml, plugins/, or skills/ in ${resolved.dir}`
1762
- );
1763
- }
1764
- seenPackageDirs.add(resolved.dir);
1765
- discovered.push({
1766
- name: packageName,
1767
- dir: resolved.dir,
1768
- nodeModulesDir: resolved.nodeModulesDir,
1769
- ...pluginFlags
1770
- });
1771
- }
1772
- return discovered;
1773
- }
1774
- function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
1775
- const resolvedCwd = path4.resolve(cwd);
1776
- const packageNames = normalizePluginPackageNames(options?.packageNames);
1777
- const nodeModulesDirs = options?.nodeModulesDirs ?? discoverNodeModulesDirs(resolvedCwd);
1778
- const discoveredPackages = discoverDeclaredPackages(
1779
- packageNames,
1780
- nodeModulesDirs,
1781
- resolvedCwd
1782
- );
1783
- const manifestRoots = [];
1784
- const skillRoots2 = [];
1785
- const tracingIncludes = [];
1786
- for (const pkg of discoveredPackages) {
1787
- const tracingBasePath = pkg.nodeModulesDir ? pathForTracingInclude(
1788
- resolvedCwd,
1789
- path4.join(pkg.nodeModulesDir, ...pkg.name.split("/"))
1790
- ) : pathForTracingInclude(resolvedCwd, pkg.dir);
1791
- if (pkg.hasRootPluginManifest) {
1792
- manifestRoots.push(pkg.dir);
1793
- if (tracingBasePath) {
1794
- tracingIncludes.push(`${tracingBasePath}/plugin.yaml`);
1795
- }
1796
- }
1797
- if (pkg.hasPluginsDir) {
1798
- manifestRoots.push(path4.join(pkg.dir, "plugins"));
1799
- if (tracingBasePath) {
1800
- tracingIncludes.push(`${tracingBasePath}/plugins/**/*`);
1801
- }
1802
- }
1803
- if (pkg.hasSkillsDir) {
1804
- skillRoots2.push(path4.join(pkg.dir, "skills"));
1805
- if (tracingBasePath) {
1806
- tracingIncludes.push(`${tracingBasePath}/skills/**/*`);
1807
- }
1808
- }
1809
- }
1810
- return {
1811
- packageNames: uniqueStringsInOrder(
1812
- discoveredPackages.map((pkg) => pkg.name)
1813
- ),
1814
- packages: discoveredPackages.map((pkg) => ({
1815
- dir: pkg.dir,
1816
- hasSkillsDir: pkg.hasSkillsDir,
1817
- name: pkg.name
1818
- })),
1819
- manifestRoots: uniqueStringsInOrder(manifestRoots),
1820
- skillRoots: uniqueStringsInOrder(skillRoots2),
1821
- tracingIncludes: uniqueStringsInOrder(tracingIncludes)
1822
- };
1324
+ function isSlackConversationId(value) {
1325
+ return /^(C|G|D)[A-Z0-9]+$/.test(value);
1823
1326
  }
1824
1327
 
1825
1328
  export {
1826
- homeDir,
1827
- skillRoots,
1828
- pluginRoots,
1829
- soulPathCandidates,
1830
- worldPathCandidates,
1831
- listReferenceFiles,
1832
1329
  toOptionalString,
1833
1330
  toOptionalNumber,
1834
1331
  isRecord,
@@ -1851,8 +1348,6 @@ export {
1851
1348
  serializeGenAiAttribute,
1852
1349
  extractGenAiUsageSummary,
1853
1350
  extractGenAiUsageAttributes,
1854
- isValidPackageName,
1855
- resolvePackageDir,
1856
- normalizePluginPackageNames,
1857
- discoverInstalledPluginPackageContent
1351
+ isSlackTeamId,
1352
+ isSlackConversationId
1858
1353
  };
@@ -0,0 +1,28 @@
1
+ // src/chat/sandbox/paths.ts
2
+ function normalizeWorkspaceRoot(input) {
3
+ const candidate = (input ?? "").trim();
4
+ if (!candidate) {
5
+ return "/vercel/sandbox";
6
+ }
7
+ const normalized = candidate.replace(/\/+$/, "");
8
+ return normalized.startsWith("/") ? normalized : `/${normalized}`;
9
+ }
10
+ var SANDBOX_WORKSPACE_ROOT = normalizeWorkspaceRoot(
11
+ process.env.VERCEL_SANDBOX_WORKSPACE_DIR
12
+ );
13
+ var SANDBOX_SKILLS_ROOT = `${SANDBOX_WORKSPACE_ROOT}/skills`;
14
+ var SANDBOX_DATA_ROOT = `${SANDBOX_WORKSPACE_ROOT}/data`;
15
+ function sandboxSkillDir(skillName) {
16
+ return `${SANDBOX_SKILLS_ROOT}/${skillName}`;
17
+ }
18
+ function sandboxSkillFile(skillName) {
19
+ return `${sandboxSkillDir(skillName)}/SKILL.md`;
20
+ }
21
+
22
+ export {
23
+ SANDBOX_WORKSPACE_ROOT,
24
+ SANDBOX_SKILLS_ROOT,
25
+ SANDBOX_DATA_ROOT,
26
+ sandboxSkillDir,
27
+ sandboxSkillFile
28
+ };