@sentry/junior 0.163.0 → 0.165.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 (71) hide show
  1. package/dist/{agent-hooks-6IX5CV7G.js → agent-hooks-GSNL33UA.js} +9 -9
  2. package/dist/api/schema/workspace.d.ts +51 -0
  3. package/dist/api/schema.d.ts +2 -0
  4. package/dist/api/schema.js +15 -3
  5. package/dist/api/workspaces/routes.d.ts +4 -0
  6. package/dist/api.js +171 -27
  7. package/dist/app.js +36 -34
  8. package/dist/{catalog-runtime-NEPZNTOM.js → catalog-runtime-4ERDVI7V.js} +5 -5
  9. package/dist/chat/repository-instructions.d.ts +12 -1
  10. package/dist/chat/sandbox/sandbox.d.ts +1 -1
  11. package/dist/chat/sandbox/snapshot/resolve.d.ts +12 -0
  12. package/dist/chat/sandbox/snapshot/runtime.d.ts +2 -0
  13. package/dist/chat/workspaces/store.d.ts +27 -0
  14. package/dist/chat/workspaces/types.d.ts +0 -1
  15. package/dist/chat/workspaces/validation.d.ts +20 -0
  16. package/dist/{chunk-TPT6EF7K.js → chunk-32CCG4WP.js} +1 -1
  17. package/dist/{chunk-ICJ3KCA2.js → chunk-3V2EIQLT.js} +1 -1
  18. package/dist/{chunk-ZDKTZG3G.js → chunk-5T6WPPEI.js} +1 -1
  19. package/dist/{chunk-ZF6IC27P.js → chunk-5WDDWMQ7.js} +260 -8
  20. package/dist/{chunk-TPDNZCZU.js → chunk-65B3PDY7.js} +1 -1
  21. package/dist/{chunk-2FBPN2Y4.js → chunk-6OWVPXNO.js} +2 -1
  22. package/dist/{chunk-2HBJQEBE.js → chunk-6RZ6MMEK.js} +1 -1
  23. package/dist/{chunk-IIT23D3M.js → chunk-6YXCG2XL.js} +4 -4
  24. package/dist/{chunk-XY2IVIAY.js → chunk-7J26TW64.js} +5 -5
  25. package/dist/{chunk-RK7KPI6G.js → chunk-7S2JVUWS.js} +1 -1
  26. package/dist/{chunk-NL53P7PS.js → chunk-AEBF6AO2.js} +1 -1
  27. package/dist/{chunk-O5ZZL7IR.js → chunk-AQEBOQUC.js} +9 -9
  28. package/dist/{chunk-SA6BEEAB.js → chunk-BEC542E6.js} +111 -74
  29. package/dist/{chunk-THS4CKN4.js → chunk-BEHPIDVZ.js} +5 -4
  30. package/dist/{chunk-BLZUFHM7.js → chunk-DKO4RRGJ.js} +1 -1
  31. package/dist/{chunk-MXFL7LNZ.js → chunk-EA4UL5H2.js} +73 -14
  32. package/dist/{chunk-YAUQXZVT.js → chunk-FMOFCEAA.js} +2 -2
  33. package/dist/{chunk-SR6WRBJW.js → chunk-FNNQCHOL.js} +4 -4
  34. package/dist/{chunk-3OZNFCPR.js → chunk-FXX4NHOM.js} +6 -6
  35. package/dist/{chunk-GCLHNRMU.js → chunk-G72LBEMZ.js} +1 -1
  36. package/dist/{chunk-IX4XI42N.js → chunk-HPWZ4BJJ.js} +72 -120
  37. package/dist/{chunk-FEIHINKR.js → chunk-HZDLOFO4.js} +9 -5
  38. package/dist/{chunk-ATWHPSMF.js → chunk-IZHR2OES.js} +4 -13
  39. package/dist/{chunk-O4IK4O7C.js → chunk-N2BRRIQZ.js} +1 -1
  40. package/dist/{chunk-MWVQ35U6.js → chunk-NPW6LM2X.js} +12 -12
  41. package/dist/{chunk-JI5EPI3O.js → chunk-RQQTOF3H.js} +3 -3
  42. package/dist/{chunk-WPGYWDJR.js → chunk-SA5FVUWJ.js} +6 -6
  43. package/dist/{chunk-KD3ROG6P.js → chunk-T6BAHCT6.js} +17 -17
  44. package/dist/{chunk-4P2XNVTO.js → chunk-TCWPG5VL.js} +2 -2
  45. package/dist/{chunk-EKGJVUVS.js → chunk-VDNNVTX2.js} +5 -5
  46. package/dist/{chunk-RTPJRLOP.js → chunk-XOINKFDJ.js} +7 -7
  47. package/dist/{chunk-3T7RJVDJ.js → chunk-ZUKU2Y3J.js} +1 -1
  48. package/dist/cli/chat.js +29 -29
  49. package/dist/cli/check.js +6 -6
  50. package/dist/cli/plugins.js +12 -12
  51. package/dist/cli/snapshot-create.js +9 -9
  52. package/dist/cli/upgrade.js +7 -7
  53. package/dist/db/schema/workspaces.d.ts +0 -17
  54. package/dist/db/schema.d.ts +0 -17
  55. package/dist/{db-6VBMHVW2.js → db-5TTEPMTY.js} +7 -7
  56. package/dist/instrumentation.js +4 -4
  57. package/dist/nitro.js +2 -2
  58. package/dist/{oauth-callback-server-5NCCUIM2.js → oauth-callback-server-IVFC5YHY.js} +22 -22
  59. package/dist/{runner-6ONEB6TQ.js → runner-G76TSHWO.js} +31 -33
  60. package/dist/{skills-Y5R36UH4.js → skills-F6PSLVSG.js} +6 -6
  61. package/dist/spawn-WMJPIAZL.js +37 -0
  62. package/dist/{validation-HLHEQDEK.js → validation-56EJI6UQ.js} +6 -6
  63. package/dist/version.js +1 -1
  64. package/dist/{work-VIEFYTFG.js → work-RNRQCP3Y.js} +17 -17
  65. package/dist/worker-FBR2WUI4.js +24 -0
  66. package/migrations/0030_drop_workspace_repo_primary.sql +2 -0
  67. package/migrations/meta/0030_snapshot.json +2799 -0
  68. package/migrations/meta/_journal.json +8 -1
  69. package/package.json +6 -5
  70. package/dist/spawn-RFMBQ6B3.js +0 -37
  71. package/dist/worker-MRSKPKQZ.js +0 -24
@@ -7,7 +7,7 @@ import {
7
7
  PluginCredentialFailureError,
8
8
  agentNameSchema,
9
9
  createPluginAuthOrchestration
10
- } from "./chunk-XY2IVIAY.js";
10
+ } from "./chunk-7J26TW64.js";
11
11
  import {
12
12
  authorizationId
13
13
  } from "./chunk-DIB4GX3G.js";
@@ -32,7 +32,7 @@ import {
32
32
  searchSlackUsers,
33
33
  selectPluginGrant,
34
34
  toMcpProviderError
35
- } from "./chunk-RTPJRLOP.js";
35
+ } from "./chunk-XOINKFDJ.js";
36
36
  import {
37
37
  RetryableDeliveryError,
38
38
  actorFromRun,
@@ -48,7 +48,7 @@ import {
48
48
  getSlackMessagePermalink,
49
49
  resolveBaseUrl,
50
50
  uploadFilesToConversation
51
- } from "./chunk-3OZNFCPR.js";
51
+ } from "./chunk-FXX4NHOM.js";
52
52
  import {
53
53
  parseSandboxEgressAuthRequiredSignal,
54
54
  parseSandboxEgressPermissionDeniedSignal,
@@ -56,24 +56,7 @@ import {
56
56
  sandboxEgressCredentialLeaseSchema
57
57
  } from "./chunk-7MA4HV4W.js";
58
58
  import {
59
- bindSandboxFileSystem,
60
- createSandboxSession,
61
- ensureDockerDaemon,
62
- getSandboxResources,
63
- getVercelSandboxCredentials,
64
- hash,
65
- isAlreadyExistsError,
66
- isMissingError,
67
- isSandboxCommandStreamInterruptedError,
68
- isSandboxMissingError,
69
- isSandboxUnavailableError,
70
- isSnapshottingError,
71
- resolve,
72
- stopSession,
73
- throwSandboxOperationError,
74
- wrapSandboxSetupError
75
- } from "./chunk-THS4CKN4.js";
76
- import {
59
+ SANDBOX_RUNTIME,
77
60
  SCHEDULED_TASK_SYSTEM_ACTOR,
78
61
  compactEventTask,
79
62
  createEventTask,
@@ -105,10 +88,10 @@ import {
105
88
  scheduledTaskAttributes,
106
89
  storeAttachments,
107
90
  writableEventTask
108
- } from "./chunk-FEIHINKR.js";
91
+ } from "./chunk-HZDLOFO4.js";
109
92
  import {
110
93
  parseSlackThreadId
111
- } from "./chunk-ICJ3KCA2.js";
94
+ } from "./chunk-3V2EIQLT.js";
112
95
  import {
113
96
  AGENTS_REMOVAL_NOTICE,
114
97
  AGENTS_REPLACEMENT_NOTICE,
@@ -132,7 +115,6 @@ import {
132
115
  decideReply,
133
116
  estimateTextTokens,
134
117
  extractAssistantText,
135
- findSingleRepositoryDirectory,
136
118
  findVisibleAgentsInstructions,
137
119
  generateShortTitle,
138
120
  getAgentContextCompactionTriggerTokens,
@@ -152,6 +134,7 @@ import {
152
134
  isToolResultError,
153
135
  isToolResultMessage,
154
136
  isTurnInputCommitLostError,
137
+ listRepositoryDirectories,
155
138
  loadConnectedMcpProviders,
156
139
  loadConversationProjection,
157
140
  loadTurnCheckpoint,
@@ -170,7 +153,7 @@ import {
170
153
  recordToolExecutionStarted,
171
154
  recordTurnRoute,
172
155
  renderAgentsInstructions,
173
- resolveRepositoryInstructions,
156
+ resolveRepositoryInstructionsForDirectories,
174
157
  resolveTaskTitle,
175
158
  resolveWorkspacePath,
176
159
  retainRuntimeTurnContext,
@@ -179,10 +162,28 @@ import {
179
162
  stripRuntimeTurnContext,
180
163
  trimTrailingAssistantMessages,
181
164
  truncateText
182
- } from "./chunk-MXFL7LNZ.js";
165
+ } from "./chunk-EA4UL5H2.js";
183
166
  import {
184
167
  JUNIOR_THREAD_STATE_TTL_MS
185
168
  } from "./chunk-3Y47VMHV.js";
169
+ import {
170
+ bindSandboxFileSystem,
171
+ createSandboxSession,
172
+ ensureDockerDaemon,
173
+ getSandboxResources,
174
+ getVercelSandboxCredentials,
175
+ hash,
176
+ isAlreadyExistsError,
177
+ isMissingError,
178
+ isSandboxCommandStreamInterruptedError,
179
+ isSandboxMissingError,
180
+ isSandboxUnavailableError,
181
+ isSnapshottingError,
182
+ resolve,
183
+ stopSession,
184
+ throwSandboxOperationError,
185
+ wrapSandboxSetupError
186
+ } from "./chunk-BEHPIDVZ.js";
186
187
  import {
187
188
  privateTraceResultAttributes
188
189
  } from "./chunk-UIE3R5XU.js";
@@ -197,14 +198,17 @@ import {
197
198
  getPluginUserPromptContributions,
198
199
  getSlackClient,
199
200
  getSlackToolContext,
201
+ getWorkspace,
202
+ getWorkspaceByName,
200
203
  isConversationScopedChannel,
204
+ listWorkspaces,
201
205
  normalizeSlackConversationId,
202
206
  readActorIdentity,
203
207
  resolveChannelCapabilities,
204
208
  tryWorkspaceRepoCheckoutPath,
205
209
  withSlackRetries,
206
210
  workspaceRepoCheckoutPath
207
- } from "./chunk-ZF6IC27P.js";
211
+ } from "./chunk-5WDDWMQ7.js";
208
212
  import {
209
213
  KNOWN_CONVERSATION_EVENT_TYPES,
210
214
  contextProvenance,
@@ -216,13 +220,11 @@ import {
216
220
  instructionActors,
217
221
  instructionProvenanceFor,
218
222
  sameActorIdentity
219
- } from "./chunk-JI5EPI3O.js";
223
+ } from "./chunk-RQQTOF3H.js";
220
224
  import {
221
225
  juniorArtifacts,
222
- juniorIdentities,
223
- juniorWorkspaceRepos,
224
- juniorWorkspaces
225
- } from "./chunk-ATWHPSMF.js";
226
+ juniorIdentities
227
+ } from "./chunk-IZHR2OES.js";
226
228
  import {
227
229
  SANDBOX_DATA_ROOT,
228
230
  SANDBOX_REPOS_ROOT,
@@ -238,7 +240,7 @@ import {
238
240
  } from "./chunk-BVREIWBD.js";
239
241
  import {
240
242
  getStateAdapter
241
- } from "./chunk-TPDNZCZU.js";
243
+ } from "./chunk-65B3PDY7.js";
242
244
  import {
243
245
  ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
244
246
  COMPACTION_SUMMARY_PREFIX,
@@ -271,7 +273,7 @@ import {
271
273
  resolveGatewayCredential,
272
274
  resolveGatewayModel,
273
275
  unwrapCurrentInstruction
274
- } from "./chunk-YAUQXZVT.js";
276
+ } from "./chunk-FMOFCEAA.js";
275
277
  import {
276
278
  canExposeConversationPayload,
277
279
  resolveConversationPrivacy,
@@ -281,16 +283,16 @@ import {
281
283
  toGenAiMessagesTraceAttributes,
282
284
  toGenAiPayloadMetadata,
283
285
  toGenAiPayloadTraceAttributes
284
- } from "./chunk-3T7RJVDJ.js";
286
+ } from "./chunk-ZUKU2Y3J.js";
285
287
  import {
286
288
  discoverSkills,
287
289
  findSkillByName,
288
290
  loadSkillsByName,
289
291
  parseSkillInvocation
290
- } from "./chunk-4P2XNVTO.js";
292
+ } from "./chunk-TCWPG5VL.js";
291
293
  import {
292
294
  pluginCatalogRuntime
293
- } from "./chunk-RK7KPI6G.js";
295
+ } from "./chunk-7S2JVUWS.js";
294
296
  import {
295
297
  CredentialUnavailableError,
296
298
  OAuthProviderError,
@@ -298,7 +300,7 @@ import {
298
300
  getOAuthProviderErrorAttributes,
299
301
  resolveAuthTokenPlaceholder,
300
302
  resolvePluginCommandEnv
301
- } from "./chunk-O4IK4O7C.js";
303
+ } from "./chunk-N2BRRIQZ.js";
302
304
  import {
303
305
  credentialUserSubjectId
304
306
  } from "./chunk-BDUENQD3.js";
@@ -326,7 +328,7 @@ import {
326
328
  summarizeMessageText,
327
329
  withLogContext,
328
330
  withSpan
329
- } from "./chunk-TPT6EF7K.js";
331
+ } from "./chunk-32CCG4WP.js";
330
332
  import {
331
333
  startInactiveSpan,
332
334
  withActiveSpan
@@ -3155,7 +3157,6 @@ async function syncSkillsToSandbox(params) {
3155
3157
  // src/chat/sandbox/session.ts
3156
3158
  var DEFAULT_MAX_OUTPUT_LENGTH = 3e4;
3157
3159
  var DEFAULT_BASH_COMMAND_TIMEOUT_MS = 5 * 60 * 1e3;
3158
- var SANDBOX_RUNTIME = "node22";
3159
3160
  var SANDBOX_RUNTIME_BIN_DIR = `${SANDBOX_WORKSPACE_ROOT}/.junior/bin`;
3160
3161
  var SNAPSHOT_BOOT_RETRY_COUNT = 3;
3161
3162
  var SNAPSHOT_BOOT_RETRY_DELAY_MS = 1e3;
@@ -4216,7 +4217,7 @@ import { z as z5 } from "zod";
4216
4217
  var DEFAULT_FIND_LIMIT = 100;
4217
4218
  async function findFiles(params) {
4218
4219
  if (!params.pattern.trim()) {
4219
- throw new Error("pattern is required");
4220
+ throw new ToolInputError("pattern is required");
4220
4221
  }
4221
4222
  const root = resolveWorkspacePath(params.path);
4222
4223
  const limit = positiveInteger(params.limit) ?? DEFAULT_FIND_LIMIT;
@@ -4432,7 +4433,7 @@ function lineMatches(params) {
4432
4433
  }
4433
4434
  async function grepFiles(params) {
4434
4435
  if (!params.pattern) {
4435
- throw new Error("pattern is required");
4436
+ throw new ToolInputError("pattern is required");
4436
4437
  }
4437
4438
  const root = resolveWorkspacePath(params.path);
4438
4439
  const limit = positiveInteger(params.limit) ?? DEFAULT_GREP_LIMIT;
@@ -5526,12 +5527,12 @@ function createSandbox(options) {
5526
5527
  return void 0;
5527
5528
  }
5528
5529
  const { fs: fs5 } = await runtime.tools();
5529
- const primary = activeWorkspace?.repos.find((repo) => repo.isPrimary);
5530
- const primaryPath = primary ? tryWorkspaceRepoCheckoutPath(primary.repo) : void 0;
5531
- const selected = primaryPath ? `${SANDBOX_WORKSPACE_ROOT}/${primaryPath}` : await findSingleRepositoryDirectory(fs5);
5532
- if (!selected) return void 0;
5533
- return await resolveRepositoryInstructions({
5534
- cwd: selected,
5530
+ const workspaceDirectories = activeWorkspace?.repos.map((repo) => tryWorkspaceRepoCheckoutPath(repo.repo)).filter((checkoutPath) => Boolean(checkoutPath)).map(
5531
+ (checkoutPath) => `${SANDBOX_WORKSPACE_ROOT}/${checkoutPath}`
5532
+ ) ?? [];
5533
+ const directories = workspaceDirectories.length > 0 ? workspaceDirectories : await listRepositoryDirectories(fs5);
5534
+ return await resolveRepositoryInstructionsForDirectories({
5535
+ directories,
5535
5536
  fs: fs5
5536
5537
  });
5537
5538
  },
@@ -5601,7 +5602,7 @@ var SandboxFileNotFoundError = class extends ToolInputError {
5601
5602
  function normalizeSandboxPath(inputPath) {
5602
5603
  const trimmed = inputPath.trim();
5603
5604
  if (!trimmed) {
5604
- throw new Error("path is required");
5605
+ throw new ToolInputError("path is required");
5605
5606
  }
5606
5607
  if (path7.posix.isAbsolute(trimmed)) {
5607
5608
  return trimmed;
@@ -12396,7 +12397,7 @@ function createSystemTimeTool() {
12396
12397
  const timezone = input.timezone?.trim() || null;
12397
12398
  if (timezone) {
12398
12399
  if (!isValidTimeZone2(timezone)) {
12399
- throw new Error("timezone must be a valid IANA time zone.");
12400
+ throw new ToolInputError("timezone must be a valid IANA time zone.");
12400
12401
  }
12401
12402
  const parts = getZonedDateTimeParts(now.getTime(), timezone);
12402
12403
  const isoLocal = [
@@ -13136,16 +13137,16 @@ function normalizeHostname(hostname) {
13136
13137
  async function resolvePublicHostname(hostname) {
13137
13138
  const records = await dns.lookup(hostname, { all: true, verbatim: true });
13138
13139
  if (records.length === 0) {
13139
- throw new Error("Could not resolve hostname");
13140
+ throw new ToolInputError("Could not resolve hostname");
13140
13141
  }
13141
13142
  const deduped = /* @__PURE__ */ new Map();
13142
13143
  for (const record2 of records) {
13143
13144
  const family = record2.family === 6 ? 6 : 4;
13144
13145
  if (family === 4 && isPrivateIpv4(record2.address)) {
13145
- throw new Error("Resolved to a private IPv4 address");
13146
+ throw new ToolInputError("Resolved to a private IPv4 address");
13146
13147
  }
13147
13148
  if (family === 6 && isPrivateIpv6(record2.address)) {
13148
- throw new Error("Resolved to a private IPv6 address");
13149
+ throw new ToolInputError("Resolved to a private IPv6 address");
13149
13150
  }
13150
13151
  deduped.set(`${family}:${record2.address}`, {
13151
13152
  address: record2.address,
@@ -13251,18 +13252,18 @@ async function fetchWithPinnedLookup(url, resolved, signal) {
13251
13252
  async function assertPublicUrl(rawUrl) {
13252
13253
  const parsed = new URL(rawUrl);
13253
13254
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
13254
- throw new Error("Only http(s) URLs are allowed");
13255
+ throw new ToolInputError("Only http(s) URLs are allowed");
13255
13256
  }
13256
13257
  const hostname = normalizeHostname(parsed.hostname);
13257
13258
  if (hostname === "localhost" || hostname === "0.0.0.0" || hostname.endsWith(".local") || hostname.endsWith(".internal")) {
13258
- throw new Error("Local/private hostnames are blocked");
13259
+ throw new ToolInputError("Local/private hostnames are blocked");
13259
13260
  }
13260
13261
  const hostIpType = net.isIP(hostname);
13261
13262
  if (hostIpType === 4 && isPrivateIpv4(hostname)) {
13262
- throw new Error("Private IPv4 addresses are blocked");
13263
+ throw new ToolInputError("Private IPv4 addresses are blocked");
13263
13264
  }
13264
13265
  if (hostIpType === 6 && isPrivateIpv6(hostname)) {
13265
- throw new Error("Private IPv6 addresses are blocked");
13266
+ throw new ToolInputError("Private IPv6 addresses are blocked");
13266
13267
  }
13267
13268
  if (hostIpType === 0) {
13268
13269
  await resolvePublicHostname(hostname);
@@ -13300,11 +13301,11 @@ async function fetchTextWithRedirects(url, redirectsLeft) {
13300
13301
  return response;
13301
13302
  }
13302
13303
  if (redirectsLeft <= 0) {
13303
- throw new Error("Too many redirects");
13304
+ throw new ToolInputError("Too many redirects");
13304
13305
  }
13305
13306
  const location = response.headers.get("location");
13306
13307
  if (!location) {
13307
- throw new Error("Redirect missing location");
13308
+ throw new ToolInputError("Redirect missing location");
13308
13309
  }
13309
13310
  const nextUrl = new URL(location, url);
13310
13311
  const safeUrl = await assertPublicUrl(nextUrl.toString());
@@ -13323,7 +13324,7 @@ async function readResponseBody(response, maxBytes) {
13323
13324
  if (!value) continue;
13324
13325
  total += value.byteLength;
13325
13326
  if (total > maxBytes) {
13326
- throw new Error("Response body too large");
13327
+ throw new ToolInputError("Response body too large");
13327
13328
  }
13328
13329
  chunks.push(value);
13329
13330
  }
@@ -13464,11 +13465,17 @@ function extractContentDetails(body, contentType, maxChars) {
13464
13465
  async function extractWebFetchResponse(url, response, maxChars = DEFAULT_MAX_CHARS) {
13465
13466
  const safeMaxChars = Math.max(500, Math.min(maxChars, MAX_FETCH_CHARS));
13466
13467
  if (!response.ok) {
13467
- throw new Error(`fetch failed: ${response.status}`);
13468
+ const message = `fetch failed: ${response.status}`;
13469
+ if (response.status >= 400 && response.status < 500) {
13470
+ throw new ToolInputError(message);
13471
+ }
13472
+ throw new Error(message);
13468
13473
  }
13469
13474
  const contentType = (response.headers.get("content-type") ?? "").toLowerCase();
13470
13475
  if (!contentType.includes("text/") && !contentType.includes("json") && !contentType.includes("xml")) {
13471
- throw new Error(`unsupported content type: ${contentType || "unknown"}`);
13476
+ throw new ToolInputError(
13477
+ `unsupported content type: ${contentType || "unknown"}`
13478
+ );
13472
13479
  }
13473
13480
  const body = await withTimeout(
13474
13481
  readResponseBody(response, MAX_FETCH_BYTES),
@@ -13529,7 +13536,7 @@ function createWebFetchTool(hooks, options = {}) {
13529
13536
  if (response.ok && contentType.startsWith("image/")) {
13530
13537
  const bytes = Buffer.from(await response.arrayBuffer());
13531
13538
  if (bytes.byteLength > MAX_FETCH_BYTES) {
13532
- throw new Error("image response body too large");
13539
+ throw new ToolInputError("image response body too large");
13533
13540
  }
13534
13541
  const filename = filenameForUrl(
13535
13542
  safeUrl,
@@ -13669,64 +13676,10 @@ function createWriteFileTool() {
13669
13676
 
13670
13677
  // src/chat/workspaces/tools.ts
13671
13678
  import { z as z63 } from "zod";
13672
-
13673
- // src/chat/workspaces/store.ts
13674
- import { asc, eq as eq3 } from "drizzle-orm";
13675
- function workspaceFromRows(row, repos) {
13676
- return {
13677
- id: row.id,
13678
- name: row.name,
13679
- setupScript: row.setupScript,
13680
- repos: repos.map((repo) => ({
13681
- provider: repo.provider,
13682
- repo: repo.repo,
13683
- isPrimary: repo.isPrimary
13684
- }))
13685
- };
13686
- }
13687
- async function listWorkspaces(db) {
13688
- const [workspaces, repos] = await Promise.all([
13689
- db.select().from(juniorWorkspaces).orderBy(asc(juniorWorkspaces.name)),
13690
- db.select().from(juniorWorkspaceRepos).orderBy(
13691
- asc(juniorWorkspaceRepos.workspaceId),
13692
- asc(juniorWorkspaceRepos.provider),
13693
- asc(juniorWorkspaceRepos.repo)
13694
- )
13695
- ]);
13696
- return workspaces.map(
13697
- (workspace) => workspaceFromRows(
13698
- workspace,
13699
- repos.filter((repo) => repo.workspaceId === workspace.id)
13700
- )
13701
- );
13702
- }
13703
- async function getWorkspaceByName(db, name) {
13704
- const rows = await db.select().from(juniorWorkspaces).where(eq3(juniorWorkspaces.name, name)).limit(1);
13705
- const workspace = rows[0];
13706
- if (!workspace) return void 0;
13707
- const repos = await db.select().from(juniorWorkspaceRepos).where(eq3(juniorWorkspaceRepos.workspaceId, workspace.id)).orderBy(
13708
- asc(juniorWorkspaceRepos.provider),
13709
- asc(juniorWorkspaceRepos.repo)
13710
- );
13711
- return workspaceFromRows(workspace, repos);
13712
- }
13713
- async function getWorkspace(db, id) {
13714
- const rows = await db.select().from(juniorWorkspaces).where(eq3(juniorWorkspaces.id, id)).limit(1);
13715
- const workspace = rows[0];
13716
- if (!workspace) return void 0;
13717
- const repos = await db.select().from(juniorWorkspaceRepos).where(eq3(juniorWorkspaceRepos.workspaceId, workspace.id)).orderBy(
13718
- asc(juniorWorkspaceRepos.provider),
13719
- asc(juniorWorkspaceRepos.repo)
13720
- );
13721
- return workspaceFromRows(workspace, repos);
13722
- }
13723
-
13724
- // src/chat/workspaces/tools.ts
13725
13679
  var repoSchema = z63.object({
13726
13680
  provider: z63.string(),
13727
13681
  repo: z63.string(),
13728
- checkout_path: z63.string(),
13729
- is_primary: z63.boolean()
13682
+ checkout_path: z63.string()
13730
13683
  });
13731
13684
  var workspaceSchema = z63.object({
13732
13685
  id: z63.string(),
@@ -13740,8 +13693,7 @@ function view(workspace) {
13740
13693
  repos: workspace.repos.map((repo) => ({
13741
13694
  provider: repo.provider,
13742
13695
  repo: repo.repo,
13743
- checkout_path: workspaceRepoCheckoutPath(repo.repo),
13744
- is_primary: repo.isPrimary
13696
+ checkout_path: workspaceRepoCheckoutPath(repo.repo)
13745
13697
  }))
13746
13698
  };
13747
13699
  }
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ToolInputError
3
- } from "./chunk-MXFL7LNZ.js";
3
+ } from "./chunk-EA4UL5H2.js";
4
4
  import {
5
5
  canRouteResourceEvents,
6
6
  getPlugins
7
- } from "./chunk-ZF6IC27P.js";
7
+ } from "./chunk-5WDDWMQ7.js";
8
8
  import {
9
9
  getDb
10
- } from "./chunk-JI5EPI3O.js";
10
+ } from "./chunk-RQQTOF3H.js";
11
11
  import {
12
12
  juniorAttachments,
13
13
  juniorConversations,
@@ -15,13 +15,16 @@ import {
15
15
  juniorSchedulerRuns,
16
16
  juniorSchedulerTasks,
17
17
  juniorStats
18
- } from "./chunk-ATWHPSMF.js";
18
+ } from "./chunk-IZHR2OES.js";
19
19
  import {
20
20
  juniorDestinations
21
21
  } from "./chunk-VFUK3X5B.js";
22
22
  import {
23
23
  logInfo
24
- } from "./chunk-TPT6EF7K.js";
24
+ } from "./chunk-32CCG4WP.js";
25
+
26
+ // src/chat/sandbox/snapshot/runtime.ts
27
+ var SANDBOX_RUNTIME = "node22";
25
28
 
26
29
  // src/chat/event-tasks/store.ts
27
30
  import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
@@ -1899,6 +1902,7 @@ export {
1899
1902
  juniorToolOutputSchema,
1900
1903
  injectContinuationToolName,
1901
1904
  makeStructuredToolOutput,
1905
+ SANDBOX_RUNTIME,
1902
1906
  eventNamespaceSchema,
1903
1907
  registeredEventTypeSchema,
1904
1908
  registeredResourceTypeSchema,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SQL_STATEMENT_TIMEOUT_MS
3
- } from "./chunk-YAUQXZVT.js";
3
+ } from "./chunk-FMOFCEAA.js";
4
4
  import {
5
5
  juniorDestinations,
6
6
  timestamptz
@@ -646,14 +646,7 @@ var juniorSchedulerRuns = pgTable16(
646
646
  );
647
647
 
648
648
  // src/db/schema/workspaces.ts
649
- import { sql as sql6 } from "drizzle-orm";
650
- import {
651
- boolean as boolean3,
652
- pgTable as pgTable17,
653
- primaryKey as primaryKey9,
654
- text as text17,
655
- uniqueIndex as uniqueIndex7
656
- } from "drizzle-orm/pg-core";
649
+ import { pgTable as pgTable17, primaryKey as primaryKey9, text as text17, uniqueIndex as uniqueIndex7 } from "drizzle-orm/pg-core";
657
650
  var juniorWorkspaces = pgTable17(
658
651
  "junior_workspaces",
659
652
  {
@@ -670,12 +663,10 @@ var juniorWorkspaceRepos = pgTable17(
670
663
  {
671
664
  workspaceId: text17("workspace_id").notNull().references(() => juniorWorkspaces.id, { onDelete: "cascade" }),
672
665
  provider: text17("provider").notNull(),
673
- repo: text17("repo").notNull(),
674
- isPrimary: boolean3("is_primary").notNull().default(false)
666
+ repo: text17("repo").notNull()
675
667
  },
676
668
  (table) => [
677
- primaryKey9({ columns: [table.workspaceId, table.provider, table.repo] }),
678
- uniqueIndex7("junior_workspace_repos_primary_idx").on(table.workspaceId).where(sql6`${table.isPrimary}`)
669
+ primaryKey9({ columns: [table.workspaceId, table.provider, table.repo] })
679
670
  ]
680
671
  );
681
672
 
@@ -5,7 +5,7 @@ import {
5
5
  logInfo,
6
6
  logWarn,
7
7
  setSpanAttributes
8
- } from "./chunk-TPT6EF7K.js";
8
+ } from "./chunk-32CCG4WP.js";
9
9
  import {
10
10
  discoverInstalledPluginPackageContent,
11
11
  normalizePluginPackageNames
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createWebAuthorization,
3
3
  deleteWebAuthorization
4
- } from "./chunk-NL53P7PS.js";
4
+ } from "./chunk-AEBF6AO2.js";
5
5
  import {
6
6
  appendAndEnqueueInboundMessage
7
- } from "./chunk-IIT23D3M.js";
7
+ } from "./chunk-6YXCG2XL.js";
8
8
  import {
9
9
  buildDeliveredTurnStatePatch,
10
10
  completeAuthPauseTurn,
@@ -12,20 +12,20 @@ import {
12
12
  getTurnUserMessage,
13
13
  processPluginTask,
14
14
  scheduleSessionCompletedPluginTasks
15
- } from "./chunk-O5ZZL7IR.js";
15
+ } from "./chunk-AQEBOQUC.js";
16
16
  import {
17
17
  ConversationTurnLifecycleService,
18
18
  coerceThreadConversationState,
19
19
  getPersistedSandboxState,
20
20
  getPersistedThreadState,
21
21
  persistThreadStateById
22
- } from "./chunk-EKGJVUVS.js";
22
+ } from "./chunk-VDNNVTX2.js";
23
23
  import {
24
24
  healthReportSchema
25
25
  } from "./chunk-UTL3MHPC.js";
26
26
  import {
27
27
  parseSlackThreadId
28
- } from "./chunk-ICJ3KCA2.js";
28
+ } from "./chunk-3V2EIQLT.js";
29
29
  import {
30
30
  TurnInputCommitLostError,
31
31
  abandonTurnRecord,
@@ -49,31 +49,31 @@ import {
49
49
  saveTurnCheckpoint,
50
50
  startActiveTurn,
51
51
  upsertConversationMessage
52
- } from "./chunk-MXFL7LNZ.js";
52
+ } from "./chunk-EA4UL5H2.js";
53
53
  import {
54
54
  normalizeSlackConversationId
55
- } from "./chunk-ZF6IC27P.js";
55
+ } from "./chunk-5WDDWMQ7.js";
56
56
  import {
57
57
  getConversationEventStore,
58
58
  getConversationStore,
59
59
  getDb
60
- } from "./chunk-JI5EPI3O.js";
60
+ } from "./chunk-RQQTOF3H.js";
61
61
  import {
62
62
  juniorApiTokens,
63
63
  juniorConversationParticipants,
64
64
  juniorConversations,
65
65
  juniorIdentities,
66
66
  juniorUsers
67
- } from "./chunk-ATWHPSMF.js";
67
+ } from "./chunk-IZHR2OES.js";
68
68
  import {
69
69
  getSlackBotToken
70
- } from "./chunk-YAUQXZVT.js";
70
+ } from "./chunk-FMOFCEAA.js";
71
71
  import {
72
72
  juniorDestinations
73
73
  } from "./chunk-VFUK3X5B.js";
74
74
  import {
75
75
  canExposeConversationPayload
76
- } from "./chunk-3T7RJVDJ.js";
76
+ } from "./chunk-ZUKU2Y3J.js";
77
77
  import {
78
78
  credentialContextForActor
79
79
  } from "./chunk-BDUENQD3.js";
@@ -82,7 +82,7 @@ import {
82
82
  logWarn,
83
83
  setTags,
84
84
  withLogContext
85
- } from "./chunk-TPT6EF7K.js";
85
+ } from "./chunk-32CCG4WP.js";
86
86
 
87
87
  // src/handlers/health.ts
88
88
  function readHealthReport() {
@@ -7,12 +7,12 @@ import {
7
7
  juniorConversations,
8
8
  juniorIdentities,
9
9
  juniorUsers
10
- } from "./chunk-ATWHPSMF.js";
10
+ } from "./chunk-IZHR2OES.js";
11
11
  import {
12
12
  TURN_REASONING_LEVELS,
13
13
  getChatConfig,
14
14
  modelProfileSchema
15
- } from "./chunk-YAUQXZVT.js";
15
+ } from "./chunk-FMOFCEAA.js";
16
16
  import {
17
17
  juniorDestinations
18
18
  } from "./chunk-VFUK3X5B.js";
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-V7YE4WCP.js";
24
24
  import {
25
25
  normalizeIdentityEmail
26
- } from "./chunk-TPT6EF7K.js";
26
+ } from "./chunk-32CCG4WP.js";
27
27
 
28
28
  // src/chat/conversations/sql/store.ts
29
29
  import { randomUUID as randomUUID2 } from "crypto";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  appendAndEnqueueInboundMessage
3
- } from "./chunk-IIT23D3M.js";
3
+ } from "./chunk-6YXCG2XL.js";
4
4
  import {
5
5
  ConversationTurnLifecycleService,
6
6
  getPersistedSandboxState,
7
7
  getPersistedThreadState,
8
8
  persistThreadStateById
9
- } from "./chunk-EKGJVUVS.js";
9
+ } from "./chunk-VDNNVTX2.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-XY2IVIAY.js";
18
+ } from "./chunk-7J26TW64.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-MXFL7LNZ.js";
29
+ } from "./chunk-EA4UL5H2.js";
30
30
  import {
31
31
  getConversationEventStore,
32
32
  getConversationStore,
33
33
  getSqlExecutor
34
- } from "./chunk-JI5EPI3O.js";
34
+ } from "./chunk-RQQTOF3H.js";
35
35
  import {
36
36
  juniorAgentBindings,
37
37
  juniorAgentInvocations
38
- } from "./chunk-ATWHPSMF.js";
38
+ } from "./chunk-IZHR2OES.js";
39
39
 
40
40
  // src/chat/agent-invocations/work.ts
41
41
  import { z } from "zod";