@sentry/junior 0.166.0 → 0.167.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 (59) hide show
  1. package/dist/{agent-hooks-ZIPK2HUF.js → agent-hooks-KEHBR4DB.js} +9 -9
  2. package/dist/api/schema/workspace.d.ts +14 -0
  3. package/dist/api/schema.d.ts +2 -2
  4. package/dist/api/schema.js +3 -1
  5. package/dist/api.js +51 -27
  6. package/dist/app.js +34 -35
  7. package/dist/{catalog-runtime-GEZAHBUP.js → catalog-runtime-7QFMBU2Q.js} +5 -5
  8. package/dist/{chunk-OCOGPNHA.js → chunk-2MPO25ZZ.js} +1 -1
  9. package/dist/{chunk-DTQAMME2.js → chunk-2RSPCWAV.js} +5 -5
  10. package/dist/{chunk-WX42YNDQ.js → chunk-4KRDL4ZD.js} +5 -5
  11. package/dist/{chunk-2KV4BAAN.js → chunk-5IR2ABRO.js} +12 -12
  12. package/dist/{chunk-Q2IPCX7J.js → chunk-5LZVDKQJ.js} +270 -7
  13. package/dist/{chunk-CDBTQQQ4.js → chunk-6SJN7JZ3.js} +1 -1
  14. package/dist/{chunk-C3USHSIJ.js → chunk-BGRLZPMI.js} +1 -1
  15. package/dist/{chunk-SLWGX3G5.js → chunk-CC4EYBUO.js} +35 -35
  16. package/dist/{chunk-U2UCDSDF.js → chunk-CU7YQNZ3.js} +4 -4
  17. package/dist/{chunk-P6UQMGM2.js → chunk-EWAG7BNE.js} +1 -1
  18. package/dist/{chunk-FFE3BMAT.js → chunk-GC3AKBNP.js} +7 -7
  19. package/dist/{chunk-YTIKGCPC.js → chunk-GIGUXRMY.js} +1 -1
  20. package/dist/{chunk-OYN45QUQ.js → chunk-HIB3XTKR.js} +6 -6
  21. package/dist/{chunk-2ZKFLHVP.js → chunk-IHSPBOWG.js} +6 -6
  22. package/dist/{chunk-ZKJO4K6M.js → chunk-KE5ETKIR.js} +4 -4
  23. package/dist/{chunk-22RO7IDD.js → chunk-KSQIE2R4.js} +4 -4
  24. package/dist/{chunk-VNPG55CU.js → chunk-L63FA77C.js} +1 -1
  25. package/dist/{chunk-AEKBVJMV.js → chunk-MKDIEH3C.js} +2 -2
  26. package/dist/{chunk-43KLUCAM.js → chunk-MV4LDMRG.js} +17 -17
  27. package/dist/{chunk-3EZ5V7XQ.js → chunk-O5J556I2.js} +9 -9
  28. package/dist/{chunk-JDTCQDRU.js → chunk-PMULUKHL.js} +3 -3
  29. package/dist/{chunk-FEYQVP64.js → chunk-PRV74X7E.js} +5 -5
  30. package/dist/{chunk-ABNRESX6.js → chunk-TZHLY42G.js} +1 -1
  31. package/dist/{chunk-BKP3PVKR.js → chunk-UFTE42ZF.js} +1 -1
  32. package/dist/{chunk-4CMORAHL.js → chunk-UTMP45YM.js} +11 -1
  33. package/dist/{chunk-JUFZR2LD.js → chunk-V7GGA4LW.js} +1 -1
  34. package/dist/{chunk-EKBVHDZO.js → chunk-W72TSO24.js} +1 -1
  35. package/dist/{chunk-LGSGPWYH.js → chunk-WD7PVGMA.js} +1 -1
  36. package/dist/{chunk-4MDEQNSW.js → chunk-WHMDWHZX.js} +5 -5
  37. package/dist/{chunk-MDW5YPXW.js → chunk-WRBQL2AW.js} +2 -2
  38. package/dist/{chunk-KQ5YZGDV.js → chunk-WZGOP5BZ.js} +1 -1
  39. package/dist/{chunk-65SNO3WK.js → chunk-YVW44V5Y.js} +1 -1
  40. package/dist/cli/chat.js +29 -30
  41. package/dist/cli/check.js +6 -6
  42. package/dist/cli/plugins.js +12 -12
  43. package/dist/cli/snapshot-create.js +10 -12
  44. package/dist/cli/upgrade.js +7 -7
  45. package/dist/{db-TGZBS2CP.js → db-H25MZO65.js} +7 -7
  46. package/dist/instrumentation.js +4 -4
  47. package/dist/nitro.js +2 -2
  48. package/dist/{oauth-callback-server-Z54WUF5H.js → oauth-callback-server-BX334MQ6.js} +22 -22
  49. package/dist/{runner-PVFHKKK6.js → runner-GRWCCCKP.js} +12 -12
  50. package/dist/{skills-BYRH3QWD.js → skills-TG76W7TS.js} +6 -6
  51. package/dist/spawn-4YBTXAR2.js +37 -0
  52. package/dist/{validation-VZIE4RHA.js → validation-JY6EXXR3.js} +6 -6
  53. package/dist/version.js +1 -1
  54. package/dist/{work-JTHAOPDQ.js → work-53J6P32F.js} +17 -17
  55. package/dist/worker-WLLGEEQS.js +24 -0
  56. package/package.json +4 -4
  57. package/dist/chunk-4DARCEZH.js +0 -274
  58. package/dist/spawn-RIPWK7EP.js +0 -37
  59. package/dist/worker-APEVP56Y.js +0 -24
@@ -1,274 +0,0 @@
1
- import {
2
- SANDBOX_WORKSPACE_ROOT,
3
- runNonInteractiveCommand
4
- } from "./chunk-BVREIWBD.js";
5
- import {
6
- pluginCatalogRuntime
7
- } from "./chunk-VNPG55CU.js";
8
-
9
- // src/chat/sandbox/snapshot/profile.ts
10
- import { createHash } from "crypto";
11
-
12
- // src/chat/sandbox/docker.ts
13
- var DOCKER_DAEMON_JSON = `{
14
- "storage-driver": "overlay2",
15
- "live-restore": false
16
- }
17
- `;
18
- var DOCKER_ENSURE_SCRIPT = `#!/bin/sh
19
- set -eu
20
-
21
- if [ "$(id -u)" -ne 0 ]; then
22
- exec sudo -n "$0" "$@"
23
- fi
24
-
25
- SOCK=/var/run/docker.sock
26
- PIDFILE=/var/run/docker.pid
27
- LOG=/var/log/junior-dockerd.log
28
-
29
- is_ready() {
30
- [ -S "$SOCK" ] && /usr/bin/docker info >/dev/null 2>&1
31
- }
32
-
33
- if is_ready; then
34
- chmod 666 "$SOCK" 2>/dev/null || true
35
- exit 0
36
- fi
37
-
38
- mkdir -p /etc/docker /var/lib/docker /var/run /var/log
39
- if [ ! -f /etc/docker/daemon.json ]; then
40
- cat > /etc/docker/daemon.json <<'EOF'
41
- {
42
- "storage-driver": "overlay2",
43
- "live-restore": false
44
- }
45
- EOF
46
- fi
47
-
48
- if [ -f "$PIDFILE" ]; then
49
- oldpid="$(cat "$PIDFILE" 2>/dev/null || true)"
50
- if [ -n "\${oldpid:-}" ] && ! kill -0 "$oldpid" 2>/dev/null; then
51
- rm -f "$PIDFILE"
52
- fi
53
- fi
54
-
55
- if [ ! -f "$PIDFILE" ] || ! kill -0 "$(cat "$PIDFILE" 2>/dev/null)" 2>/dev/null; then
56
- # dockerd must outlive this helper; nohup + background is intentional.
57
- nohup dockerd --host="unix://$SOCK" --pidfile="$PIDFILE" >"$LOG" 2>&1 &
58
- fi
59
-
60
- i=0
61
- while [ "$i" -lt 50 ]; do
62
- if is_ready; then
63
- chmod 666 "$SOCK" 2>/dev/null || true
64
- exit 0
65
- fi
66
- i=$((i + 1))
67
- sleep 0.1
68
- done
69
-
70
- echo "junior-ensure-docker: dockerd failed to become ready" >&2
71
- if [ -f "$LOG" ]; then
72
- tail -n 50 "$LOG" >&2 || true
73
- fi
74
- exit 1
75
- `;
76
- var DOCKER_CLI_WRAPPER_SCRIPT = `#!/bin/sh
77
- set -eu
78
- if command -v junior-ensure-docker >/dev/null 2>&1; then
79
- junior-ensure-docker
80
- fi
81
- exec /usr/bin/docker "$@"
82
- `;
83
- var DOCKER_COMPOSE_CLI_WRAPPER_SCRIPT = `#!/bin/sh
84
- set -eu
85
- if command -v junior-ensure-docker >/dev/null 2>&1; then
86
- junior-ensure-docker
87
- fi
88
- exec /usr/local/libexec/junior-docker-compose "$@"
89
- `;
90
- async function ensureDockerDaemon(sandbox, signal) {
91
- await runNonInteractiveCommand(sandbox, {
92
- cmd: "sh",
93
- args: [
94
- "-c",
95
- "command -v junior-ensure-docker >/dev/null 2>&1 && junior-ensure-docker || true"
96
- ],
97
- signal
98
- });
99
- }
100
-
101
- // src/chat/sandbox/runtime-dependencies.ts
102
- var GLOBAL_RUNTIME_DEPENDENCIES = [
103
- { type: "system", package: "docker" },
104
- { type: "system", package: "spal-release" },
105
- { type: "system", package: "ripgrep" }
106
- ];
107
- function writeFileCommand(path, contents, mode = "0644") {
108
- const payload = Buffer.from(contents, "utf8").toString("base64");
109
- return [
110
- `printf '%s' '${payload}' | base64 -d > ${path}`,
111
- `chmod ${mode} ${path}`
112
- ].join("\n");
113
- }
114
- function writeExecutableCommand(path, contents) {
115
- return writeFileCommand(path, contents, "0755");
116
- }
117
- var GLOBAL_RUNTIME_POSTINSTALL = [
118
- {
119
- cmd: "sh",
120
- args: [
121
- "-c",
122
- [
123
- "set -eu",
124
- 'case "$(uname -m)" in',
125
- ' x86_64) asset="x86_64"; sha256="7af95166a730b87e172d4fc9aefea8725d3c6c7327d59149267b452114ddb7d4" ;;',
126
- ' aarch64) asset="aarch64"; sha256="49082844b87f03cdcd5f5bbef1ba8c9c897b7a2dfb80cea18d61ec8ca6117e0c" ;;',
127
- ' *) echo "unsupported Docker Compose architecture: $(uname -m)" >&2; exit 1 ;;',
128
- "esac",
129
- 'tmp="$(mktemp)"',
130
- `trap 'rm -f "$tmp"' EXIT`,
131
- 'curl --fail --location --silent --show-error "https://github.com/docker/compose/releases/download/v2.39.4/docker-compose-linux-${asset}" --output "$tmp"',
132
- 'echo "${sha256} ${tmp}" | sha256sum --check --status',
133
- // Keep the real Compose binary off PATH; the wrapper below starts dockerd.
134
- 'install -D -m 0755 "$tmp" /usr/local/libexec/junior-docker-compose',
135
- "mkdir -p /usr/local/lib/docker/cli-plugins /usr/local/libexec /etc/docker /usr/local/bin",
136
- `mkdir -p ${SANDBOX_WORKSPACE_ROOT}/.junior/bin`,
137
- writeFileCommand("/etc/docker/daemon.json", DOCKER_DAEMON_JSON),
138
- writeExecutableCommand(
139
- "/usr/local/bin/junior-ensure-docker",
140
- DOCKER_ENSURE_SCRIPT
141
- ),
142
- // docker compose plugin delegates to the real Compose binary.
143
- "ln -sfn /usr/local/libexec/junior-docker-compose /usr/local/lib/docker/cli-plugins/docker-compose",
144
- // PATH wrappers auto-start dockerd for both CLI entrypoints.
145
- writeExecutableCommand(
146
- "/usr/local/bin/docker-compose",
147
- DOCKER_COMPOSE_CLI_WRAPPER_SCRIPT
148
- ),
149
- writeExecutableCommand(
150
- `${SANDBOX_WORKSPACE_ROOT}/.junior/bin/docker`,
151
- DOCKER_CLI_WRAPPER_SCRIPT
152
- ),
153
- writeExecutableCommand(
154
- `${SANDBOX_WORKSPACE_ROOT}/.junior/bin/docker-compose`,
155
- DOCKER_COMPOSE_CLI_WRAPPER_SCRIPT
156
- ),
157
- // Prefer the wrapper over /usr/bin/docker for non-login shells too.
158
- writeExecutableCommand(
159
- "/usr/local/bin/docker",
160
- DOCKER_CLI_WRAPPER_SCRIPT
161
- )
162
- ].join("\n")
163
- ],
164
- sudo: true
165
- }
166
- ];
167
-
168
- // src/chat/sandbox/snapshot/profile.ts
169
- var VERSION = 1;
170
- var DEFAULT_FLOATING_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
171
- function isExactNpmVersion(version) {
172
- return /^\d+\.\d+\.\d+(?:[-+][a-z0-9.]+)?$/i.test(version.trim());
173
- }
174
- function isFloating(dep) {
175
- return dep.type === "npm" && !isExactNpmVersion(dep.version);
176
- }
177
- function mergeDependencies(dependencies) {
178
- const seen = /* @__PURE__ */ new Set();
179
- const npmVersions = /* @__PURE__ */ new Map();
180
- const merged = [];
181
- for (const dependency of dependencies) {
182
- const key = dependency.type === "npm" ? `${dependency.type}:${dependency.package}:${dependency.version}` : "package" in dependency ? `${dependency.type}:package:${dependency.package}` : `${dependency.type}:url:${dependency.url}:${dependency.sha256}`;
183
- if (seen.has(key)) {
184
- continue;
185
- }
186
- seen.add(key);
187
- if (dependency.type === "npm") {
188
- const version = npmVersions.get(dependency.package);
189
- if (version !== void 0 && version !== dependency.version) {
190
- throw new Error(
191
- `Conflicting runtime dependency versions for ${dependency.package}: ${version} and ${dependency.version}`
192
- );
193
- }
194
- npmVersions.set(dependency.package, dependency.version);
195
- }
196
- merged.push(dependency);
197
- }
198
- return merged;
199
- }
200
- function floatingMaxAgeMs() {
201
- const raw = process.env.SANDBOX_SNAPSHOT_FLOATING_MAX_AGE_MS;
202
- if (!raw?.trim()) {
203
- return DEFAULT_FLOATING_MAX_AGE_MS;
204
- }
205
- const parsed = Number.parseInt(raw, 10);
206
- return Number.isFinite(parsed) && parsed >= 0 ? parsed : DEFAULT_FLOATING_MAX_AGE_MS;
207
- }
208
- function compareCodePoints(left, right) {
209
- if (left < right) return -1;
210
- if (left > right) return 1;
211
- return 0;
212
- }
213
- function workspaceRecipe(workspace) {
214
- const repos = [...workspace.repos].map(({ provider, repo }) => ({
215
- provider,
216
- repo
217
- })).sort((left, right) => {
218
- const provider = compareCodePoints(left.provider, right.provider);
219
- if (provider !== 0) return provider;
220
- return compareCodePoints(left.repo, right.repo);
221
- });
222
- return {
223
- id: workspace.id,
224
- repos,
225
- setupScript: workspace.setupScript
226
- };
227
- }
228
- function create(runtime, workspace) {
229
- const dependencies = mergeDependencies([
230
- ...GLOBAL_RUNTIME_DEPENDENCIES,
231
- ...pluginCatalogRuntime.getRuntimeDependencies()
232
- ]);
233
- const pluginPostinstall = pluginCatalogRuntime.getRuntimePostinstall();
234
- const postinstall = [...GLOBAL_RUNTIME_POSTINSTALL, ...pluginPostinstall];
235
- if (dependencies.length === 0 && postinstall.length === 0 && !workspace) {
236
- return null;
237
- }
238
- const rebuildEpoch = process.env.SANDBOX_SNAPSHOT_REBUILD_EPOCH?.trim() ?? "";
239
- const floating = dependencies.some((dependency) => isFloating(dependency)) || pluginPostinstall.length > 0 || Boolean(workspace);
240
- const hash2 = createHash("sha256").update(
241
- JSON.stringify({
242
- version: VERSION,
243
- runtime,
244
- rebuildEpoch,
245
- dependencies,
246
- postinstall,
247
- ...workspace ? { workspace: workspaceRecipe(workspace) } : {}
248
- })
249
- ).digest("hex");
250
- return {
251
- hash: hash2,
252
- dependencyCount: dependencies.length,
253
- floating,
254
- dependencies,
255
- postinstall
256
- };
257
- }
258
- function hash(runtime, workspace) {
259
- return create(runtime, workspace)?.hash;
260
- }
261
- function isStale(profile, createdAtMs) {
262
- if (!profile.floating) {
263
- return false;
264
- }
265
- const maxAgeMs = floatingMaxAgeMs();
266
- return maxAgeMs === 0 || Date.now() - createdAtMs > maxAgeMs;
267
- }
268
-
269
- export {
270
- ensureDockerDaemon,
271
- create,
272
- hash,
273
- isStale
274
- };
@@ -1,37 +0,0 @@
1
- import {
2
- bindSpawnAgent
3
- } from "./chunk-C3USHSIJ.js";
4
- import "./chunk-2ZKFLHVP.js";
5
- import "./chunk-ZKJO4K6M.js";
6
- import "./chunk-DTQAMME2.js";
7
- import "./chunk-JAL3CH4G.js";
8
- import "./chunk-FEYQVP64.js";
9
- import "./chunk-DIB4GX3G.js";
10
- import "./chunk-RF6J3DIO.js";
11
- import "./chunk-OYN45QUQ.js";
12
- import "./chunk-7MA4HV4W.js";
13
- import "./chunk-22RO7IDD.js";
14
- import "./chunk-3Y47VMHV.js";
15
- import "./chunk-PDO5BLNM.js";
16
- import "./chunk-WX42YNDQ.js";
17
- import "./chunk-JDTCQDRU.js";
18
- import "./chunk-65SNO3WK.js";
19
- import "./chunk-BVREIWBD.js";
20
- import "./chunk-EKBVHDZO.js";
21
- import "./chunk-AEKBVJMV.js";
22
- import "./chunk-VFUK3X5B.js";
23
- import "./chunk-KQ5YZGDV.js";
24
- import "./chunk-VNPG55CU.js";
25
- import "./chunk-P6UQMGM2.js";
26
- import "./chunk-BDUENQD3.js";
27
- import "./chunk-V7YE4WCP.js";
28
- import "./chunk-JUFZR2LD.js";
29
- import "./chunk-6GWA276C.js";
30
- import "./chunk-OOUNJNMR.js";
31
- import "./chunk-H4HBKISO.js";
32
- import "./chunk-BKP3PVKR.js";
33
- import "./chunk-YTIKGCPC.js";
34
- import "./chunk-MLKGABMK.js";
35
- export {
36
- bindSpawnAgent
37
- };
@@ -1,24 +0,0 @@
1
- import {
2
- CONVERSATION_WORK_DEFER_DELAY_MS,
3
- processConversationWork
4
- } from "./chunk-U2UCDSDF.js";
5
- import "./chunk-CDBTQQQ4.js";
6
- import "./chunk-ZKJO4K6M.js";
7
- import "./chunk-JAL3CH4G.js";
8
- import "./chunk-3Y47VMHV.js";
9
- import "./chunk-JDTCQDRU.js";
10
- import "./chunk-65SNO3WK.js";
11
- import "./chunk-EKBVHDZO.js";
12
- import "./chunk-AEKBVJMV.js";
13
- import "./chunk-VFUK3X5B.js";
14
- import "./chunk-KQ5YZGDV.js";
15
- import "./chunk-V7YE4WCP.js";
16
- import "./chunk-JUFZR2LD.js";
17
- import "./chunk-6GWA276C.js";
18
- import "./chunk-BKP3PVKR.js";
19
- import "./chunk-YTIKGCPC.js";
20
- import "./chunk-MLKGABMK.js";
21
- export {
22
- CONVERSATION_WORK_DEFER_DELAY_MS,
23
- processConversationWork
24
- };