@sentry/junior 0.162.0 → 0.164.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 (96) hide show
  1. package/README.md +2 -0
  2. package/dist/{agent-hooks-TL2SGC5W.js → agent-hooks-WTBPNRTC.js} +10 -10
  3. package/dist/api/acp/route.d.ts +13 -0
  4. package/dist/api/schema/workspace.d.ts +47 -0
  5. package/dist/api/schema.d.ts +2 -0
  6. package/dist/api/schema.js +15 -3
  7. package/dist/api/workspaces/routes.d.ts +4 -0
  8. package/dist/api.js +321 -408
  9. package/dist/app.d.ts +2 -2
  10. package/dist/app.js +482 -38
  11. package/dist/{catalog-runtime-IGSMIADJ.js → catalog-runtime-CZ2SQINY.js} +5 -5
  12. package/dist/chat/agent/sandbox.d.ts +4 -0
  13. package/dist/chat/api-turns/cancellation.d.ts +27 -0
  14. package/dist/chat/api-turns/routing.d.ts +31 -0
  15. package/dist/chat/api-turns/work.d.ts +12 -29
  16. package/dist/chat/app/conversation-work.d.ts +6 -1
  17. package/dist/chat/app/production.d.ts +2 -2
  18. package/dist/chat/conversations/history.d.ts +3 -0
  19. package/dist/chat/conversations/turn-lifecycle.d.ts +1 -1
  20. package/dist/chat/experimental.d.ts +1 -1
  21. package/dist/chat/plugins/agent-hooks.d.ts +4 -0
  22. package/dist/chat/repository-instructions.d.ts +1 -1
  23. package/dist/chat/sandbox/paths.d.ts +1 -0
  24. package/dist/chat/sandbox/prepare-workspace.d.ts +11 -0
  25. package/dist/chat/sandbox/ref.d.ts +1 -0
  26. package/dist/chat/sandbox/sandbox.d.ts +4 -0
  27. package/dist/chat/sandbox/session.d.ts +4 -0
  28. package/dist/chat/sandbox/snapshot/profile.d.ts +4 -3
  29. package/dist/chat/sandbox/snapshot/resolve.d.ts +4 -0
  30. package/dist/chat/sandbox/workspace.d.ts +4 -0
  31. package/dist/chat/tools/types.d.ts +5 -0
  32. package/dist/chat/workspaces/checkout-path.d.ts +4 -0
  33. package/dist/chat/workspaces/store.d.ts +37 -0
  34. package/dist/chat/workspaces/tools.d.ts +4 -0
  35. package/dist/chat/workspaces/types.d.ts +13 -0
  36. package/dist/chat/workspaces/validation.d.ts +21 -0
  37. package/dist/{chunk-THXMSSFZ.js → chunk-26JYGL2L.js} +1 -1
  38. package/dist/{chunk-OPNJRQDP.js → chunk-2K25MRZK.js} +9 -6
  39. package/dist/{chunk-C3KUKA27.js → chunk-3L23VTY7.js} +17 -17
  40. package/dist/{chunk-JJ3VXFDI.js → chunk-4GTOFUQF.js} +1 -1
  41. package/dist/{chunk-RDV4BQRZ.js → chunk-5FWQ73UZ.js} +1 -1
  42. package/dist/{chunk-BPZQWAZJ.js → chunk-5GLGQHO3.js} +4 -1
  43. package/dist/{chunk-K7IV6UV3.js → chunk-6BXV63YX.js} +5 -5
  44. package/dist/{chunk-4WYGQ47U.js → chunk-6ENAACWN.js} +5 -5
  45. package/dist/{chunk-EHQLTK3X.js → chunk-7WKWMMYQ.js} +323 -127
  46. package/dist/chunk-BVREIWBD.js +131 -0
  47. package/dist/{chunk-DZC3F2UI.js → chunk-BXBZDV3C.js} +1 -1
  48. package/dist/{chunk-HW4BW3PC.js → chunk-CGCNFEAU.js} +4 -4
  49. package/dist/{chunk-JRVURR3H.js → chunk-FKDY7NTC.js} +543 -164
  50. package/dist/{chunk-MNCEGXEH.js → chunk-FX4PX3SA.js} +2 -2
  51. package/dist/{chunk-OBFRMQBY.js → chunk-H36GJVJV.js} +9 -9
  52. package/dist/{chunk-V7QL4QMW.js → chunk-HHW6ZVIZ.js} +12 -7
  53. package/dist/{chunk-O6P7DZ6O.js → chunk-JW23XD4I.js} +6 -6
  54. package/dist/{chunk-DDQ43S5Q.js → chunk-LPLVNMVN.js} +4 -4
  55. package/dist/{chunk-5NEBOHRG.js → chunk-NAGI2XH3.js} +4 -4
  56. package/dist/{chunk-FEWT5KPP.js → chunk-NLTQRYNP.js} +2 -2
  57. package/dist/{chunk-SA6BEEAB.js → chunk-PU45BSBS.js} +108 -74
  58. package/dist/{chunk-7DTPFFQX.js → chunk-RBV4JHCP.js} +1 -1
  59. package/dist/{chunk-6BJFIWEV.js → chunk-RJHZNPDH.js} +46 -87
  60. package/dist/{chunk-FESUWAYU.js → chunk-RULIISEI.js} +1 -1
  61. package/dist/{chunk-MMBMDSRK.js → chunk-RYYEHWIL.js} +1 -1
  62. package/dist/{chunk-Y75ZDQB5.js → chunk-VHSEMJTS.js} +1 -1
  63. package/dist/{chunk-5IDFPCON.js → chunk-VRS6WDK5.js} +1 -1
  64. package/dist/{chunk-EBEHJPFF.js → chunk-VV2DN24T.js} +1 -1
  65. package/dist/{chunk-WHAJ3QVY.js → chunk-WJUKESU2.js} +1 -1
  66. package/dist/{chunk-H2KW7AZC.js → chunk-XAIRI54J.js} +1 -1
  67. package/dist/{chunk-AJ7J2HWY.js → chunk-Y2B6AXZQ.js} +6 -6
  68. package/dist/{chunk-QHCIZLIX.js → chunk-YHCTPDXS.js} +356 -13
  69. package/dist/{chunk-CZ6EHOU5.js → chunk-ZSNABC2E.js} +40 -2
  70. package/dist/{chunk-KQSO4DJ4.js → chunk-ZUTAGCPH.js} +9 -9
  71. package/dist/cli/chat.js +32 -32
  72. package/dist/cli/check.js +6 -6
  73. package/dist/cli/plugins.js +13 -13
  74. package/dist/cli/snapshot-create.js +10 -10
  75. package/dist/cli/upgrade.js +7 -7
  76. package/dist/db/schema/workspaces.d.ts +169 -0
  77. package/dist/db/schema.d.ts +169 -1
  78. package/dist/{db-66XZ4HHQ.js → db-32KRFS6L.js} +7 -7
  79. package/dist/{experimental-HH6OM6UH.js → experimental-XVDOSRBS.js} +1 -1
  80. package/dist/instrumentation.js +4 -4
  81. package/dist/nitro.js +2 -2
  82. package/dist/{oauth-callback-server-FMLKDUUF.js → oauth-callback-server-CGZP2Z6U.js} +24 -24
  83. package/dist/{runner-YZONUMNY.js → runner-S5N4Q2XL.js} +32 -34
  84. package/dist/{skills-3UDJJXSO.js → skills-KYPSHSQR.js} +6 -6
  85. package/dist/spawn-EGOB3CLV.js +37 -0
  86. package/dist/{validation-3HTDBONC.js → validation-SZBE7JNF.js} +6 -6
  87. package/dist/version.js +1 -1
  88. package/dist/{work-O4YTIS54.js → work-GCZKHEZX.js} +18 -18
  89. package/dist/worker-6MY5Q4A2.js +24 -0
  90. package/migrations/0029_dizzy_barracuda.sql +19 -0
  91. package/migrations/meta/0029_snapshot.json +2709 -0
  92. package/migrations/meta/_journal.json +8 -1
  93. package/package.json +7 -4
  94. package/dist/chunk-EM225ITJ.js +0 -56
  95. package/dist/spawn-TBPVA5S2.js +0 -37
  96. package/dist/worker-WHURUEYX.js +0 -24
@@ -1,21 +1,22 @@
1
1
  import {
2
2
  SANDBOX_WORKSPACE_ROOT,
3
+ runNonInteractiveCommand,
3
4
  sleep
4
- } from "./chunk-EM225ITJ.js";
5
+ } from "./chunk-BVREIWBD.js";
5
6
  import {
6
7
  getStateAdapter
7
- } from "./chunk-DZC3F2UI.js";
8
+ } from "./chunk-BXBZDV3C.js";
8
9
  import {
9
10
  toOptionalTrimmed
10
- } from "./chunk-MNCEGXEH.js";
11
+ } from "./chunk-FX4PX3SA.js";
11
12
  import {
12
13
  pluginCatalogRuntime
13
- } from "./chunk-FESUWAYU.js";
14
+ } from "./chunk-RULIISEI.js";
14
15
  import {
15
16
  setSpanAttributes,
16
17
  setSpanStatus,
17
18
  withSpan
18
- } from "./chunk-Y75ZDQB5.js";
19
+ } from "./chunk-VHSEMJTS.js";
19
20
 
20
21
  // src/chat/sandbox/resources.ts
21
22
  var configuredResources;
@@ -52,76 +53,6 @@ function getSandboxResources() {
52
53
  // src/chat/sandbox/snapshot/profile.ts
53
54
  import { createHash } from "crypto";
54
55
 
55
- // src/chat/sandbox/noninteractive-command.ts
56
- var NON_INTERACTIVE_ENV = {
57
- CI: "1",
58
- TERM: "dumb",
59
- NO_COLOR: "1",
60
- PAGER: "cat",
61
- GIT_PAGER: "cat",
62
- GH_PROMPT_DISABLED: "1",
63
- GH_NO_UPDATE_NOTIFIER: "1",
64
- GH_NO_EXTENSION_UPDATE_NOTIFIER: "1",
65
- GH_SPINNER_DISABLED: "1",
66
- GIT_TERMINAL_PROMPT: "0",
67
- GCM_INTERACTIVE: "never",
68
- DEBIAN_FRONTEND: "noninteractive",
69
- // Git credential isolation: prevent git from sending its own auth so the
70
- // sandbox egress proxy's header transforms are the sole credential source.
71
- GIT_ASKPASS: "/bin/true",
72
- GIT_CONFIG_NOSYSTEM: "1",
73
- GIT_CONFIG_COUNT: "2",
74
- GIT_CONFIG_KEY_0: "credential.helper",
75
- GIT_CONFIG_VALUE_0: "",
76
- GIT_CONFIG_KEY_1: "http.emptyAuth",
77
- GIT_CONFIG_VALUE_1: "true"
78
- };
79
- function shellQuote(value) {
80
- return `'${value.replace(/'/g, "'\\''")}'`;
81
- }
82
- function buildEnvExports(options) {
83
- const lines = [];
84
- if (options.pathPrefix) {
85
- lines.push(`export PATH="${options.pathPrefix}"`);
86
- }
87
- for (const [key, value] of Object.entries(NON_INTERACTIVE_ENV)) {
88
- lines.push(`export ${key}=${shellQuote(value)}`);
89
- }
90
- for (const [key, value] of Object.entries(options.env ?? {})) {
91
- lines.push(`export ${key}=${shellQuote(value)}`);
92
- }
93
- return lines;
94
- }
95
- function buildCommandScript(input) {
96
- return [shellQuote(input.cmd), ...(input.args ?? []).map(shellQuote)].join(
97
- " "
98
- );
99
- }
100
- function buildNonInteractiveShellScript(script, options = {}) {
101
- return [...buildEnvExports(options), "exec </dev/null", script].join(" && ");
102
- }
103
- function buildNonInteractiveCommand(input) {
104
- return {
105
- cmd: "bash",
106
- args: [
107
- input.login ? "-lc" : "-c",
108
- buildNonInteractiveShellScript(buildCommandScript(input), {
109
- env: input.env,
110
- pathPrefix: input.pathPrefix
111
- })
112
- ]
113
- };
114
- }
115
- async function runNonInteractiveCommand(sandbox, input) {
116
- const command = {
117
- ...buildNonInteractiveCommand(input),
118
- ...input.cwd ? { cwd: input.cwd } : {},
119
- ...input.signal ? { signal: input.signal } : {},
120
- ...input.sudo !== void 0 ? { sudo: input.sudo } : {}
121
- };
122
- return await sandbox.runCommand(command);
123
- }
124
-
125
56
  // src/chat/sandbox/docker.ts
126
57
  var DOCKER_DAEMON_JSON = `{
127
58
  "storage-driver": "overlay2",
@@ -318,25 +249,46 @@ function floatingMaxAgeMs() {
318
249
  const parsed = Number.parseInt(raw, 10);
319
250
  return Number.isFinite(parsed) && parsed >= 0 ? parsed : DEFAULT_FLOATING_MAX_AGE_MS;
320
251
  }
321
- function create(runtime) {
252
+ function compareCodePoints(left, right) {
253
+ if (left < right) return -1;
254
+ if (left > right) return 1;
255
+ return 0;
256
+ }
257
+ function workspaceRecipe(workspace) {
258
+ const repos = [...workspace.repos].map(({ provider, repo }) => ({
259
+ provider,
260
+ repo
261
+ })).sort((left, right) => {
262
+ const provider = compareCodePoints(left.provider, right.provider);
263
+ if (provider !== 0) return provider;
264
+ return compareCodePoints(left.repo, right.repo);
265
+ });
266
+ return {
267
+ id: workspace.id,
268
+ repos,
269
+ setupScript: workspace.setupScript
270
+ };
271
+ }
272
+ function create(runtime, workspace) {
322
273
  const dependencies2 = mergeDependencies([
323
274
  ...GLOBAL_RUNTIME_DEPENDENCIES,
324
275
  ...pluginCatalogRuntime.getRuntimeDependencies()
325
276
  ]);
326
277
  const pluginPostinstall = pluginCatalogRuntime.getRuntimePostinstall();
327
278
  const postinstall2 = [...GLOBAL_RUNTIME_POSTINSTALL, ...pluginPostinstall];
328
- if (dependencies2.length === 0 && postinstall2.length === 0) {
279
+ if (dependencies2.length === 0 && postinstall2.length === 0 && !workspace) {
329
280
  return null;
330
281
  }
331
282
  const rebuildEpoch = process.env.SANDBOX_SNAPSHOT_REBUILD_EPOCH?.trim() ?? "";
332
- const floating = dependencies2.some((dependency) => isFloating(dependency)) || pluginPostinstall.length > 0;
283
+ const floating = dependencies2.some((dependency) => isFloating(dependency)) || pluginPostinstall.length > 0 || Boolean(workspace);
333
284
  const hash2 = createHash("sha256").update(
334
285
  JSON.stringify({
335
286
  version: VERSION,
336
287
  runtime,
337
288
  rebuildEpoch,
338
289
  dependencies: dependencies2,
339
- postinstall: postinstall2
290
+ postinstall: postinstall2,
291
+ ...workspace ? { workspace: workspaceRecipe(workspace) } : {}
340
292
  })
341
293
  ).digest("hex");
342
294
  return {
@@ -347,8 +299,8 @@ function create(runtime) {
347
299
  postinstall: postinstall2
348
300
  };
349
301
  }
350
- function hash(runtime) {
351
- return create(runtime)?.hash;
302
+ function hash(runtime, workspace) {
303
+ return create(runtime, workspace)?.hash;
352
304
  }
353
305
  function isStale(profile, createdAtMs) {
354
306
  if (!profile.floating) {
@@ -921,6 +873,13 @@ function createSandboxSession(sandbox, options) {
921
873
  }
922
874
  };
923
875
  }
876
+ async function stopSession(session) {
877
+ if (!session) return;
878
+ try {
879
+ await session.stop();
880
+ } catch {
881
+ }
882
+ }
924
883
 
925
884
  // src/chat/sandbox/snapshot/resolve.ts
926
885
  var SNAPSHOT_CACHE_PREFIX = "junior:sandbox_snapshot_profile";
@@ -969,7 +928,7 @@ async function setCachedSnapshot(entry) {
969
928
  SNAPSHOT_CACHE_TTL_MS
970
929
  );
971
930
  }
972
- async function build(value, runtime, timeoutMs, signal) {
931
+ async function build(value, runtime, timeoutMs, signal, prepare) {
973
932
  return await trace(
974
933
  "sandbox.snapshot.build",
975
934
  "sandbox.snapshot.build",
@@ -992,6 +951,7 @@ async function build(value, runtime, timeoutMs, signal) {
992
951
  try {
993
952
  await dependencies(sandbox, value.dependencies, signal);
994
953
  await postinstall(sandbox, value.postinstall, signal);
954
+ await prepare?.(sandbox);
995
955
  return await trace(
996
956
  "sandbox.snapshot.capture",
997
957
  "sandbox.snapshot.capture",
@@ -1100,7 +1060,7 @@ async function resolve(params) {
1100
1060
  async () => {
1101
1061
  params.signal?.throwIfAborted();
1102
1062
  await params.onProgress?.("resolve_start");
1103
- const currentProfile = create(params.runtime);
1063
+ const currentProfile = create(params.runtime, params.workspace);
1104
1064
  if (!currentProfile) {
1105
1065
  return {
1106
1066
  dependencyCount: 0,
@@ -1154,7 +1114,8 @@ async function resolve(params) {
1154
1114
  currentProfile,
1155
1115
  params.runtime,
1156
1116
  params.timeoutMs,
1157
- params.signal
1117
+ params.signal,
1118
+ params.prepareWorkspace
1158
1119
  );
1159
1120
  await setCachedSnapshot({
1160
1121
  profileHash: currentProfile.hash,
@@ -1192,9 +1153,6 @@ function isMissingError(error) {
1192
1153
  }
1193
1154
 
1194
1155
  export {
1195
- buildCommandScript,
1196
- buildNonInteractiveShellScript,
1197
- runNonInteractiveCommand,
1198
1156
  isAlreadyExistsError,
1199
1157
  isSandboxUnavailableError,
1200
1158
  isSandboxMissingError,
@@ -1211,6 +1169,7 @@ export {
1211
1169
  hash,
1212
1170
  bindSandboxFileSystem,
1213
1171
  createSandboxSession,
1172
+ stopSession,
1214
1173
  resolve,
1215
1174
  isMissingError
1216
1175
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPluginCatalogRuntime
3
- } from "./chunk-EBEHJPFF.js";
3
+ } from "./chunk-VV2DN24T.js";
4
4
 
5
5
  // src/chat/plugins/catalog-runtime.ts
6
6
  var pluginCatalogRuntime = createPluginCatalogRuntime();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FUNCTION_TIMEOUT_BUFFER_SECONDS,
3
3
  getChatConfig
4
- } from "./chunk-MNCEGXEH.js";
4
+ } from "./chunk-FX4PX3SA.js";
5
5
 
6
6
  // src/chat/runtime/request-deadline.ts
7
7
  import { AsyncLocalStorage } from "async_hooks";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-6GWA276C.js";
10
10
  import {
11
11
  getDeploymentTelemetryAttributes
12
- } from "./chunk-THXMSSFZ.js";
12
+ } from "./chunk-26JYGL2L.js";
13
13
 
14
14
  // src/chat/logging.ts
15
15
  import path from "path";
@@ -1,5 +1,5 @@
1
1
  // src/chat/experimental.ts
2
- var EXPERIMENTAL_FEATURES = ["subagents"];
2
+ var EXPERIMENTAL_FEATURES = ["acp", "subagents"];
3
3
  var EXPERIMENTAL_FEATURE_SET = new Set(EXPERIMENTAL_FEATURES);
4
4
  var configuredExperimental = {};
5
5
  function isExperimentalFeature(value) {
@@ -5,7 +5,7 @@ import {
5
5
  logInfo,
6
6
  logWarn,
7
7
  setSpanAttributes
8
- } from "./chunk-Y75ZDQB5.js";
8
+ } from "./chunk-VHSEMJTS.js";
9
9
  import {
10
10
  discoverInstalledPluginPackageContent,
11
11
  normalizePluginPackageNames
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-V7YE4WCP.js";
6
6
  import {
7
7
  toOptionalString
8
- } from "./chunk-Y75ZDQB5.js";
8
+ } from "./chunk-VHSEMJTS.js";
9
9
 
10
10
  // src/chat/slack/context.ts
11
11
  import { z } from "zod";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createAndEnqueueAgentInvocation
3
- } from "./chunk-AJ7J2HWY.js";
3
+ } from "./chunk-Y2B6AXZQ.js";
4
4
  import {
5
5
  actorFromRun,
6
6
  toolInvocationDestination
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  appendAndEnqueueInboundMessage
3
- } from "./chunk-5NEBOHRG.js";
3
+ } from "./chunk-NAGI2XH3.js";
4
4
  import {
5
5
  ConversationTurnLifecycleService,
6
6
  getPersistedSandboxState,
7
7
  getPersistedThreadState,
8
8
  persistThreadStateById
9
- } from "./chunk-OPNJRQDP.js";
9
+ } from "./chunk-2K25MRZK.js";
10
10
  import {
11
11
  AgentInvocationBusyError,
12
12
  AgentInvocationLimitError,
@@ -15,7 +15,7 @@ import {
15
15
  agentBindingSchema,
16
16
  agentInvocationSchema,
17
17
  createAgentInvocationSchema
18
- } from "./chunk-K7IV6UV3.js";
18
+ } from "./chunk-6BXV63YX.js";
19
19
  import {
20
20
  TurnInputCommitLostError,
21
21
  failTurnRecord,
@@ -26,16 +26,16 @@ import {
26
26
  isTurnInputCommitLostError,
27
27
  openConversationProjection,
28
28
  saveTurnCheckpoint
29
- } from "./chunk-V7QL4QMW.js";
29
+ } from "./chunk-HHW6ZVIZ.js";
30
30
  import {
31
31
  getConversationEventStore,
32
32
  getConversationStore,
33
33
  getSqlExecutor
34
- } from "./chunk-DDQ43S5Q.js";
34
+ } from "./chunk-LPLVNMVN.js";
35
35
  import {
36
36
  juniorAgentBindings,
37
37
  juniorAgentInvocations
38
- } from "./chunk-CZ6EHOU5.js";
38
+ } from "./chunk-ZSNABC2E.js";
39
39
 
40
40
  // src/chat/agent-invocations/work.ts
41
41
  import { z } from "zod";