@sentry/junior 0.184.0 → 0.186.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 (129) hide show
  1. package/dist/{agent-hooks-XTZVALGQ.js → agent-hooks-4B3Z4WRK.js} +13 -11
  2. package/dist/api/acp/schema.d.ts +20 -2
  3. package/dist/api/code/overview.d.ts +39 -0
  4. package/dist/api/locations/detail.d.ts +1 -1
  5. package/dist/api/people/code.d.ts +22 -0
  6. package/dist/api/schema/code.d.ts +46 -0
  7. package/dist/api/schema/conversation.d.ts +108 -20
  8. package/dist/api/schema/location.d.ts +1 -1
  9. package/dist/api/schema/person.d.ts +1 -1
  10. package/dist/api/schema.d.ts +4 -4
  11. package/dist/api/schema.js +12 -1
  12. package/dist/api.js +368 -78
  13. package/dist/app.js +1412 -538
  14. package/dist/{catalog-runtime-5357XR4F.js → catalog-runtime-AFJCAOHC.js} +4 -4
  15. package/dist/chat/api-turns/accepted-reply.d.ts +11 -0
  16. package/dist/chat/api-turns/cancellation.d.ts +3 -5
  17. package/dist/chat/api-turns/mailbox-input.d.ts +7 -0
  18. package/dist/chat/api-turns/routing.d.ts +18 -3
  19. package/dist/chat/api-turns/work.d.ts +4 -9
  20. package/dist/chat/app/conversation-work.d.ts +1 -1
  21. package/dist/chat/app/factory.d.ts +4 -0
  22. package/dist/chat/app/services.d.ts +4 -3
  23. package/dist/chat/conversations/history.d.ts +83 -9
  24. package/dist/chat/conversations/turn-lifecycle.d.ts +6 -3
  25. package/dist/chat/providers/slack/input.d.ts +32 -0
  26. package/dist/chat/{runtime → providers/slack}/processing-reaction.d.ts +6 -8
  27. package/dist/chat/{runtime/slack-resume.d.ts → providers/slack/resume.d.ts} +16 -19
  28. package/dist/chat/providers/slack/runtime.d.ts +1 -12
  29. package/dist/chat/providers/slack/turn.d.ts +10 -25
  30. package/dist/chat/resource-events/actor.d.ts +7 -2
  31. package/dist/chat/resource-events/app-publisher.d.ts +18 -0
  32. package/dist/chat/resource-events/catalog.d.ts +19 -0
  33. package/dist/chat/resource-events/ingest.d.ts +0 -1
  34. package/dist/chat/resource-events/notification.d.ts +28 -3
  35. package/dist/chat/resource-events/runtime-catalog.d.ts +7 -2
  36. package/dist/chat/resource-events/store.d.ts +2 -14
  37. package/dist/chat/resource-events/tool-support.d.ts +0 -5
  38. package/dist/chat/resource-events/workspace.d.ts +7 -3
  39. package/dist/chat/runtime/turn-execution.d.ts +7 -2
  40. package/dist/chat/sandbox/egress/credentials.d.ts +5 -4
  41. package/dist/chat/sandbox/egress/session.d.ts +10 -11
  42. package/dist/chat/sandbox/errors.d.ts +1 -1
  43. package/dist/chat/sandbox/ref.d.ts +1 -1
  44. package/dist/chat/sandbox/snapshot/events.d.ts +8 -1
  45. package/dist/chat/sandbox/snapshot/not-ready-error.d.ts +6 -1
  46. package/dist/chat/scheduled-tasks/tool-support.d.ts +5 -5
  47. package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
  48. package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
  49. package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
  50. package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
  51. package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -2
  52. package/dist/chat/scheduled-tasks/types.d.ts +1 -1
  53. package/dist/chat/sentry-links.d.ts +2 -0
  54. package/dist/chat/services/provider-retry.d.ts +2 -0
  55. package/dist/chat/services/turn-failure-response.d.ts +4 -0
  56. package/dist/chat/services/turn-session-routing.d.ts +20 -5
  57. package/dist/chat/task-execution/paused-turn.d.ts +0 -2
  58. package/dist/chat/task-execution/slack-resource-event.d.ts +47 -0
  59. package/dist/chat/task-execution/slack-work.d.ts +0 -21
  60. package/dist/chat/task-execution/state.d.ts +2 -2
  61. package/dist/chat/task-execution/store.d.ts +1 -1
  62. package/dist/chat/task-execution/turn-wake.d.ts +12 -0
  63. package/dist/chat/tool-support/action-review.d.ts +1 -1
  64. package/dist/chat/tools/event-tasks.d.ts +1 -1
  65. package/dist/chat/tools/resource-events.d.ts +2 -2
  66. package/dist/chat/tools/search-conversation-events.d.ts +1 -1
  67. package/dist/chat/tools/types.d.ts +1 -1
  68. package/dist/chat/tools/watch-resource-events.d.ts +2 -2
  69. package/dist/{chunk-Z3QAXJR7.js → chunk-2IBDVE62.js} +12 -9
  70. package/dist/{chunk-4RONS3WR.js → chunk-2U7EPTRZ.js} +11 -5
  71. package/dist/{chunk-3S7ULUWW.js → chunk-3CVEE6LA.js} +1 -1
  72. package/dist/{chunk-IZDYYYGP.js → chunk-43LODHJM.js} +24 -384
  73. package/dist/{chunk-LHXIZLFF.js → chunk-64WF2GQ3.js} +1 -1
  74. package/dist/{chunk-YKX6MTLU.js → chunk-7EOWT62G.js} +1 -1
  75. package/dist/{chunk-UBOIHNTH.js → chunk-7EU4YSZ4.js} +362 -188
  76. package/dist/{chunk-UF6BUA5W.js → chunk-ACGWTJ74.js} +3 -3
  77. package/dist/{chunk-6UDPINOX.js → chunk-AD64YMEC.js} +19 -44
  78. package/dist/{chunk-MLSQX2EX.js → chunk-BRKB5R7P.js} +1 -1
  79. package/dist/{chunk-E57WPXWY.js → chunk-CM6RTYSO.js} +5 -5
  80. package/dist/{chunk-MAPJFUMV.js → chunk-CV5CPRVG.js} +3 -3
  81. package/dist/chunk-D4YV5TDV.js +45 -0
  82. package/dist/{chunk-HIPUIPJM.js → chunk-DHYZ4VKG.js} +383 -254
  83. package/dist/{chunk-DUKIDPF6.js → chunk-DOP3FIQC.js} +1 -1
  84. package/dist/{chunk-BT53RIGJ.js → chunk-EWRPUXE3.js} +12 -50
  85. package/dist/{chunk-BHYRYYLY.js → chunk-FFYDRLXW.js} +1 -1
  86. package/dist/chunk-GFBR4S3Q.js +406 -0
  87. package/dist/chunk-GQMQCY7H.js +58 -0
  88. package/dist/{chunk-JNO2GUDS.js → chunk-GSB3NTNS.js} +926 -1856
  89. package/dist/{chunk-2ZQPVX7C.js → chunk-H7X2G2KS.js} +25 -12
  90. package/dist/{chunk-WQFEWULF.js → chunk-HKFLRIBD.js} +2 -2
  91. package/dist/{chunk-SHJK75Z2.js → chunk-HWXP6RHG.js} +38 -4
  92. package/dist/{chunk-RF6J3DIO.js → chunk-INQHUE72.js} +84 -1
  93. package/dist/{chunk-4CNDGK25.js → chunk-JFPY6XFF.js} +911 -993
  94. package/dist/{chunk-6WGC3SO4.js → chunk-MCLWOBPN.js} +80 -18
  95. package/dist/{chunk-PJPRXO2T.js → chunk-NRMAOGRS.js} +1 -1
  96. package/dist/{chunk-ACPDVEJO.js → chunk-O6GQO7VP.js} +201 -218
  97. package/dist/{chunk-M5YWNMTE.js → chunk-OZG7E22Y.js} +24 -6
  98. package/dist/{chunk-WVIA7V3M.js → chunk-PFAZSRGR.js} +29 -1
  99. package/dist/{chunk-LCP4EDKR.js → chunk-PZZOGHVR.js} +14 -4
  100. package/dist/{chunk-QABCY33S.js → chunk-QBL2AVFF.js} +2 -2
  101. package/dist/{chunk-FKEZZMXS.js → chunk-QU3URVWG.js} +9 -94
  102. package/dist/{chunk-M3QYTBQ6.js → chunk-STOCCPWH.js} +11 -2
  103. package/dist/{chunk-K7VDC2QW.js → chunk-TXLBLGNQ.js} +6 -6
  104. package/dist/{chunk-JA43DV4Y.js → chunk-VOGOTEW7.js} +1 -1
  105. package/dist/{chunk-HUXFMDBZ.js → chunk-VQIWBJOP.js} +1 -1
  106. package/dist/{chunk-JM2COLGC.js → chunk-VQZYIVYN.js} +6 -6
  107. package/dist/{chunk-BCHYQS4B.js → chunk-VXL2LBPK.js} +1 -1
  108. package/dist/{chunk-6VOYP4M6.js → chunk-YXSBZRP7.js} +1 -1
  109. package/dist/cli/chat.js +35 -33
  110. package/dist/cli/check.js +5 -5
  111. package/dist/cli/plugins.js +14 -12
  112. package/dist/cli/snapshot-create.js +10 -9
  113. package/dist/cli/upgrade.js +7 -6
  114. package/dist/{db-MA52H62H.js → db-7XL4UPAE.js} +8 -6
  115. package/dist/instrumentation.js +3 -3
  116. package/dist/nitro.js +7 -6
  117. package/dist/{oauth-callback-server-DXGHKN6S.js → oauth-callback-server-RAOYHWDI.js} +30 -27
  118. package/dist/{runner-4IXUAQNK.js → runner-KMPBWRPM.js} +24 -19
  119. package/dist/{skills-X3DY7AXO.js → skills-IPCALGLQ.js} +5 -5
  120. package/dist/spawn-OSOWTMBG.js +41 -0
  121. package/dist/task-runner-IQNBA3RY.js +34 -0
  122. package/dist/{validation-Z6JXSTJS.js → validation-BSRCCX6N.js} +5 -5
  123. package/dist/version.js +1 -1
  124. package/dist/{work-OKWRFBDW.js → work-T6UFTOJY.js} +24 -19
  125. package/dist/worker-L35OG7VA.js +24 -0
  126. package/package.json +5 -5
  127. package/dist/spawn-43WGS6CH.js +0 -37
  128. package/dist/task-runner-VDRKITPV.js +0 -32
  129. package/dist/worker-B236AE72.js +0 -22
@@ -2,39 +2,38 @@ import {
2
2
  usageSchema
3
3
  } from "./chunk-PDO5BLNM.js";
4
4
  import {
5
- ToolInputError
6
- } from "./chunk-4CNDGK25.js";
7
- import {
8
- agentHistoryItemSchema,
9
5
  bindProviderConversation,
10
- contextProvenance,
11
6
  createSqlConversationEventStore,
12
7
  getConversationEventStore,
13
8
  getConversationStore,
14
9
  getSqlExecutor,
15
- instructionActors,
16
- instructionProvenanceFor,
17
10
  sanitizePostgresJson,
18
11
  withConversationEventLock
19
- } from "./chunk-IZDYYYGP.js";
12
+ } from "./chunk-43LODHJM.js";
20
13
  import {
21
14
  SANDBOX_REPOS_ROOT,
22
15
  SANDBOX_WORKSPACE_ROOT,
23
16
  sleep
24
- } from "./chunk-SHJK75Z2.js";
17
+ } from "./chunk-HWXP6RHG.js";
25
18
  import {
26
19
  MUTATION_LOCK_TTL_MS,
27
20
  fenceLock,
28
21
  getStateAdapter,
29
22
  withLock
30
- } from "./chunk-DUKIDPF6.js";
23
+ } from "./chunk-DOP3FIQC.js";
24
+ import {
25
+ agentHistoryItemSchema,
26
+ contextProvenance,
27
+ instructionActors,
28
+ instructionProvenanceFor
29
+ } from "./chunk-GFBR4S3Q.js";
31
30
  import {
32
31
  botConfig,
33
32
  completeText,
34
33
  escapeXml,
35
34
  resolveGatewayModel,
36
35
  unwrapCurrentInstruction
37
- } from "./chunk-6UDPINOX.js";
36
+ } from "./chunk-AD64YMEC.js";
38
37
  import {
39
38
  parseSlackMessageTs,
40
39
  toStoredSlackActor
@@ -44,7 +43,7 @@ import {
44
43
  logException,
45
44
  logWarn,
46
45
  setSpanAttributes
47
- } from "./chunk-3S7ULUWW.js";
46
+ } from "./chunk-3CVEE6LA.js";
48
47
 
49
48
  // src/chat/turn-context-tag.ts
50
49
  var TURN_CONTEXT_TAG = "runtime-turn-context";
@@ -1746,6 +1745,16 @@ import path2 from "path";
1746
1745
 
1747
1746
  // src/chat/tools/sandbox/file-utils.ts
1748
1747
  import path from "path";
1748
+
1749
+ // src/chat/tools/execution/tool-input-error.ts
1750
+ var ToolInputError = class extends Error {
1751
+ constructor(message, options) {
1752
+ super(message, options);
1753
+ this.name = "ToolInputError";
1754
+ }
1755
+ };
1756
+
1757
+ // src/chat/tools/sandbox/file-utils.ts
1749
1758
  var MAX_TEXT_CHARS = 6e4;
1750
1759
  var RIPGREP_EXCLUDED_GLOBS = [
1751
1760
  "!**/.git/**",
@@ -2299,6 +2308,9 @@ async function recordConversationActivityMetadata(args) {
2299
2308
  });
2300
2309
  const isChild = Boolean(conversation?.lineage);
2301
2310
  const destination = isChild ? void 0 : args.destination;
2311
+ if (!isChild && !destination && !conversation) {
2312
+ return;
2313
+ }
2302
2314
  const activitySource = isChild ? "internal" : args.source?.platform === "web" ? "web" : destination?.platform === "local" ? "local" : destination ? args.summary.surface : void 0;
2303
2315
  await conversationStore.recordActivity({
2304
2316
  activityAtMs: args.summary.updatedAtMs,
@@ -3133,6 +3145,7 @@ export {
3133
3145
  recordToolExecutionStarted,
3134
3146
  recordAttachmentsDelivered,
3135
3147
  recordGuardianActionReviewed,
3148
+ ToolInputError,
3136
3149
  MAX_TEXT_CHARS,
3137
3150
  RIPGREP_EXCLUDED_GLOBS,
3138
3151
  DEFAULT_SEARCH_COMMAND_TIMEOUT_MS,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-PJPRXO2T.js";
3
+ } from "./chunk-NRMAOGRS.js";
4
4
  import {
5
5
  skillRoots
6
6
  } from "./chunk-TXKUKMVO.js";
7
7
  import {
8
8
  logWarn
9
- } from "./chunk-3S7ULUWW.js";
9
+ } from "./chunk-3CVEE6LA.js";
10
10
 
11
11
  // src/chat/skills.ts
12
12
  import fs from "fs/promises";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  toOptionalTrimmed
3
- } from "./chunk-6UDPINOX.js";
3
+ } from "./chunk-AD64YMEC.js";
4
4
  import {
5
5
  pluginCatalogRuntime
6
- } from "./chunk-PJPRXO2T.js";
6
+ } from "./chunk-NRMAOGRS.js";
7
7
  import {
8
8
  setSpanAttributes,
9
9
  setSpanStatus
10
- } from "./chunk-3S7ULUWW.js";
10
+ } from "./chunk-3CVEE6LA.js";
11
11
 
12
12
  // src/chat/sandbox/paths.ts
13
13
  function normalizeWorkspaceRoot(input) {
@@ -399,6 +399,32 @@ function getVercelSandboxCredentials() {
399
399
  return void 0;
400
400
  }
401
401
 
402
+ // src/chat/sandbox/snapshot/not-ready-error.ts
403
+ var WorkspaceSnapshotNotReadyError = class extends Error {
404
+ workspaceName;
405
+ constructor(workspaceName) {
406
+ super(`Workspace ${workspaceName} snapshot is not ready`);
407
+ this.name = "WorkspaceSnapshotNotReadyError";
408
+ this.workspaceName = workspaceName;
409
+ }
410
+ };
411
+ function getWorkspaceSnapshotNotReadyError(error) {
412
+ const seen = /* @__PURE__ */ new Set();
413
+ let current = error;
414
+ while (current instanceof Error && !seen.has(current)) {
415
+ if (current instanceof WorkspaceSnapshotNotReadyError) return current;
416
+ seen.add(current);
417
+ current = current.cause;
418
+ }
419
+ return void 0;
420
+ }
421
+ function isWorkspaceSnapshotNotReadyError(error) {
422
+ return getWorkspaceSnapshotNotReadyError(error) !== void 0;
423
+ }
424
+ function workspaceSnapshotNotReadyUserMessage(error) {
425
+ return `The ${error.workspaceName} workspace is still preparing its sandbox. Wait for that preparation to finish, then try again.`;
426
+ }
427
+
402
428
  // src/chat/sandbox/http-error-details.ts
403
429
  var DEFAULT_PREVIEW_LIMIT = 512;
404
430
  function toTrimmedString(value, maxChars) {
@@ -591,7 +617,7 @@ function isAbortError(error) {
591
617
  if (!(candidate instanceof Error)) return false;
592
618
  if (candidate.name === "AbortError") return true;
593
619
  const message = candidate.message.toLowerCase();
594
- return message === "api turn cancelled" || message === "api turn canceled" || message.startsWith("executeagentrun timed out after");
620
+ return message.startsWith("executeagentrun timed out after");
595
621
  });
596
622
  }
597
623
  function isSandboxApiTransientError(error) {
@@ -615,6 +641,10 @@ function isSandboxCommandStreamInterruptedError(error) {
615
641
  });
616
642
  }
617
643
  function wrapSandboxSetupError(error) {
644
+ const notReady = getWorkspaceSnapshotNotReadyError(error);
645
+ if (notReady) {
646
+ return notReady;
647
+ }
618
648
  try {
619
649
  const details = getSandboxErrorDetails(error);
620
650
  if (details.summary) {
@@ -667,6 +697,10 @@ export {
667
697
  buildNonInteractiveShellScript,
668
698
  runNonInteractiveCommand,
669
699
  getVercelSandboxCredentials,
700
+ WorkspaceSnapshotNotReadyError,
701
+ getWorkspaceSnapshotNotReadyError,
702
+ isWorkspaceSnapshotNotReadyError,
703
+ workspaceSnapshotNotReadyUserMessage,
670
704
  isAlreadyExistsError,
671
705
  isSandboxUnavailableError,
672
706
  isSandboxMissingError,
@@ -1,3 +1,7 @@
1
+ import {
2
+ isExperimentalFeatureEnabled
3
+ } from "./chunk-2LYHWMR4.js";
4
+
1
5
  // src/chat/agent/types.ts
2
6
  var RetryableDeliveryError = class extends Error {
3
7
  constructor(cause) {
@@ -124,11 +128,90 @@ function surfaceFromRun(run) {
124
128
  return "internal";
125
129
  }
126
130
 
131
+ // src/chat/runtime/agent-runner.ts
132
+ var AGENT_ABORT_SETTLE_GRACE_MS = 5e3;
133
+ function createAgentRunner(execute, options) {
134
+ const attachmentStorage = options?.attachmentStorage;
135
+ const streamFn = options?.streamFn;
136
+ const tracePropagation = options?.tracePropagation;
137
+ const bindSpawnAgent = options?.bindSpawnAgent;
138
+ const canBindSpawn = Boolean(bindSpawnAgent) && isExperimentalFeatureEnabled("subagents");
139
+ return {
140
+ run: async (run) => {
141
+ const spawnAgent = bindSpawnAgent && canBindSpawn && !isAgentRunFeatureDisabled(run.disabledFeatures, "subagents") ? bindSpawnAgent(run) : void 0;
142
+ const nextRun = {
143
+ ...run,
144
+ environment: {
145
+ ...run.environment,
146
+ attachmentStorage: run.environment?.attachmentStorage ?? attachmentStorage,
147
+ sandboxTracePropagation: run.environment?.sandboxTracePropagation ?? tracePropagation
148
+ },
149
+ ...spawnAgent ? {
150
+ durability: {
151
+ ...run.durability,
152
+ spawnAgent
153
+ }
154
+ } : void 0
155
+ };
156
+ return await execute(nextRun, streamFn);
157
+ }
158
+ };
159
+ }
160
+ async function waitForAgentSettlement(runPromise) {
161
+ let timeoutId;
162
+ const settleGrace = new Promise((resolve) => {
163
+ timeoutId = setTimeout(resolve, AGENT_ABORT_SETTLE_GRACE_MS);
164
+ timeoutId.unref?.();
165
+ });
166
+ await Promise.race([
167
+ runPromise.then(
168
+ () => void 0,
169
+ () => void 0
170
+ ),
171
+ settleGrace
172
+ ]);
173
+ if (timeoutId) {
174
+ clearTimeout(timeoutId);
175
+ }
176
+ }
177
+ async function runAgentWithTimeout(agentRunner, run, timeoutMs) {
178
+ if (typeof timeoutMs !== "number") {
179
+ return await agentRunner.run(run);
180
+ }
181
+ const timeoutError = new Error(
182
+ `executeAgentRun timed out after ${timeoutMs}ms`
183
+ );
184
+ const abortController = new AbortController();
185
+ const signal = run.signal ? AbortSignal.any([run.signal, abortController.signal]) : abortController.signal;
186
+ const runPromise = agentRunner.run({ ...run, signal });
187
+ let timeoutId;
188
+ const timeoutPromise = new Promise((_, reject) => {
189
+ timeoutId = setTimeout(() => {
190
+ abortController.abort(timeoutError);
191
+ reject(timeoutError);
192
+ }, timeoutMs);
193
+ });
194
+ try {
195
+ return await Promise.race([runPromise, timeoutPromise]);
196
+ } catch (error) {
197
+ if (abortController.signal.aborted) {
198
+ await waitForAgentSettlement(runPromise);
199
+ }
200
+ throw error;
201
+ } finally {
202
+ if (timeoutId) {
203
+ clearTimeout(timeoutId);
204
+ }
205
+ }
206
+ }
207
+
127
208
  export {
128
209
  RetryableDeliveryError,
129
210
  isAgentRunFeatureDisabled,
130
211
  actorFromRun,
131
212
  assertRunConsistency,
132
213
  toolInvocationDestination,
133
- surfaceFromRun
214
+ surfaceFromRun,
215
+ createAgentRunner,
216
+ runAgentWithTimeout
134
217
  };