@sentry/junior 0.113.0 → 0.115.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 (98) hide show
  1. package/dist/{agent-hooks-BKEMWR3Z.js → agent-hooks-4EUUXP2F.js} +12 -11
  2. package/dist/api/conversations/detail.d.ts +26 -0
  3. package/dist/api/conversations/event-list.d.ts +26 -0
  4. package/dist/api/conversations/events.d.ts +1 -1
  5. package/dist/api/health.d.ts +7 -0
  6. package/dist/api/plugin-reports.d.ts +62 -0
  7. package/dist/api/plugins.d.ts +9 -0
  8. package/dist/api/runtime.d.ts +24 -0
  9. package/dist/api/schema/conversation.d.ts +104 -0
  10. package/dist/api/schema.d.ts +2 -2
  11. package/dist/api/schema.js +6 -6
  12. package/dist/api/skills.d.ts +6 -0
  13. package/dist/api.js +140 -100
  14. package/dist/app.d.ts +2 -0
  15. package/dist/app.js +1117 -5010
  16. package/dist/catalog-runtime-Y32UEQLB.js +18 -0
  17. package/dist/chat/agent/request.d.ts +6 -0
  18. package/dist/chat/agent/sandbox.d.ts +2 -0
  19. package/dist/chat/agent/tools.d.ts +2 -0
  20. package/dist/chat/config.d.ts +3 -1
  21. package/dist/chat/conversations/history.d.ts +92 -0
  22. package/dist/chat/conversations/projection.d.ts +20 -1
  23. package/dist/chat/local/credential-sync.d.ts +5 -0
  24. package/dist/chat/local/oauth-relay.d.ts +4 -0
  25. package/dist/chat/mcp/oauth.d.ts +1 -0
  26. package/dist/chat/oauth-authorization.d.ts +17 -0
  27. package/dist/chat/oauth-flow.d.ts +9 -0
  28. package/dist/chat/sandbox/egress/schemas.d.ts +46 -0
  29. package/dist/chat/sandbox/egress/signals.d.ts +9 -0
  30. package/dist/chat/sandbox/sandbox.d.ts +2 -0
  31. package/dist/chat/sentry-payload-filter.d.ts +4 -4
  32. package/dist/chat/services/context-budget.d.ts +7 -2
  33. package/dist/chat/services/context-compaction.d.ts +28 -1
  34. package/dist/chat/services/conversation-memory.d.ts +1 -0
  35. package/dist/chat/services/mcp-auth-orchestration.d.ts +5 -3
  36. package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -0
  37. package/dist/chat/services/provider-error.d.ts +1 -0
  38. package/dist/chat/services/turn-router.d.ts +1 -0
  39. package/dist/chat/slack/message-control.d.ts +2 -0
  40. package/dist/chat/slack/oauth-authorization-message.d.ts +3 -0
  41. package/dist/chat/task-execution/slack-work.d.ts +2 -0
  42. package/dist/chat/tool-support/zod-tool.d.ts +1 -1
  43. package/dist/chat/tools/definition.d.ts +5 -0
  44. package/dist/chat/tools/sandbox/edit-file.d.ts +1 -1
  45. package/dist/chat/tools/sandbox/text-edits.d.ts +1 -0
  46. package/dist/{chunk-4WZ7YKDF.js → chunk-2QG4MZQ7.js} +2 -2
  47. package/dist/{chunk-H5ON7XTE.js → chunk-43RYMWJ2.js} +954 -2514
  48. package/dist/chunk-4CODA7P5.js +43 -0
  49. package/dist/{chunk-HMRVILWZ.js → chunk-67CVNDJ7.js} +1 -1
  50. package/dist/{chunk-LR2SKL5Y.js → chunk-6FKLPVF3.js} +1 -1
  51. package/dist/{chunk-2ZTTXTSZ.js → chunk-6OPTF4BQ.js} +10 -4
  52. package/dist/{chunk-3CTIAKSS.js → chunk-6V762AB4.js} +1 -1
  53. package/dist/{chunk-WBB22ANL.js → chunk-AGLQYELI.js} +77 -8
  54. package/dist/{chunk-DXRPHBOU.js → chunk-CEYOL62C.js} +77 -36
  55. package/dist/{chunk-QTS66GMR.js → chunk-CWEZEPD4.js} +3 -3
  56. package/dist/chunk-DIB4GX3G.js +8 -0
  57. package/dist/{chunk-OXE5ZUTS.js → chunk-EW5MLKT5.js} +10 -75
  58. package/dist/{chunk-42WRQLJ6.js → chunk-F3B2YJ76.js} +0 -14
  59. package/dist/chunk-FA6POGLH.js +70 -0
  60. package/dist/{chunk-ZRSUCJGA.js → chunk-FHC4JUSF.js} +1 -1
  61. package/dist/{chunk-6Y5L4BOM.js → chunk-FXOYURO4.js} +5 -3
  62. package/dist/{chunk-UKGNSJQQ.js → chunk-G36V2YGB.js} +108 -82
  63. package/dist/{chunk-K5BXPM74.js → chunk-G5SX4UPR.js} +3 -43
  64. package/dist/chunk-HDSDCEPK.js +80 -0
  65. package/dist/{chunk-LLKDNPYV.js → chunk-HWCQRGLL.js} +37 -3
  66. package/dist/{chunk-C4MZ3GP5.js → chunk-HZF5P5UN.js} +1 -1
  67. package/dist/chunk-LYA2AB5G.js +1914 -0
  68. package/dist/{chunk-36UJA3OD.js → chunk-NVUQSFWX.js} +2 -2
  69. package/dist/chunk-OB42YVAE.js +16 -0
  70. package/dist/{chunk-4VKFQPCW.js → chunk-PVZHG2XZ.js} +4 -4
  71. package/dist/{chunk-YJ44UT7D.js → chunk-RAVKCKXA.js} +7 -7
  72. package/dist/{chunk-RCBUZGIT.js → chunk-SYJT7AKB.js} +23 -20
  73. package/dist/{chunk-NP7TYFYR.js → chunk-TVE25LPW.js} +1 -1
  74. package/dist/chunk-W3U3YQYI.js +71 -0
  75. package/dist/chunk-YCLO7D7M.js +4267 -0
  76. package/dist/cli/chat.js +72 -40
  77. package/dist/cli/check.js +10 -8
  78. package/dist/cli/init.js +1 -0
  79. package/dist/cli/plugins.js +16 -14
  80. package/dist/cli/snapshot-warmup.js +13 -11
  81. package/dist/cli/upgrade.js +10 -8
  82. package/dist/{db-2ASK6MV6.js → db-KBSJHAZU.js} +8 -7
  83. package/dist/handlers/sandbox-egress-signals.d.ts +4 -0
  84. package/dist/instrumentation.js +72 -4
  85. package/dist/nitro.js +2 -2
  86. package/dist/oauth-callback-server-EYRMJTCS.js +231 -0
  87. package/dist/oauth-relay-3ZU72UGL.js +9 -0
  88. package/dist/reporting-schema.d.ts +12 -4
  89. package/dist/reporting.d.ts +5 -5
  90. package/dist/{runner-L363K62Z.js → runner-RQGZ5Z2S.js} +139 -72
  91. package/dist/sandbox-egress-signals-CDFAP67O.js +75 -0
  92. package/dist/{skills-VCPG3NOO.js → skills-JJQIE3BT.js} +10 -8
  93. package/dist/validation-MZ47PZP5.js +21 -0
  94. package/dist/version.js +1 -1
  95. package/package.json +5 -5
  96. package/dist/catalog-runtime-6XYOUVRZ.js +0 -16
  97. package/dist/chat/oauth-authorization-message.d.ts +0 -6
  98. package/dist/validation-GY7AJBLC.js +0 -19
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  toOptionalNumber,
3
3
  toOptionalString
4
- } from "./chunk-42WRQLJ6.js";
4
+ } from "./chunk-OB42YVAE.js";
5
5
  import {
6
6
  captureException,
7
7
  getActiveSpan,
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-6GWA276C.js";
14
14
  import {
15
15
  getDeploymentTelemetryAttributes
16
- } from "./chunk-NP7TYFYR.js";
16
+ } from "./chunk-TVE25LPW.js";
17
17
 
18
18
  // src/chat/logging.ts
19
19
  import path from "path";
@@ -0,0 +1,16 @@
1
+ // src/chat/coerce.ts
2
+ function toOptionalString(value) {
3
+ return typeof value === "string" && value.trim() ? value : void 0;
4
+ }
5
+ function toOptionalNumber(value) {
6
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
7
+ }
8
+ function isRecord(value) {
9
+ return typeof value === "object" && value !== null;
10
+ }
11
+
12
+ export {
13
+ toOptionalString,
14
+ toOptionalNumber,
15
+ isRecord
16
+ };
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  SANDBOX_WORKSPACE_ROOT,
3
3
  getStateAdapter
4
- } from "./chunk-HMRVILWZ.js";
4
+ } from "./chunk-67CVNDJ7.js";
5
5
  import {
6
6
  sleep
7
7
  } from "./chunk-4ZNGQH7C.js";
8
8
  import {
9
9
  toOptionalTrimmed
10
- } from "./chunk-RCBUZGIT.js";
10
+ } from "./chunk-SYJT7AKB.js";
11
11
  import {
12
12
  pluginCatalogRuntime
13
- } from "./chunk-LR2SKL5Y.js";
13
+ } from "./chunk-6FKLPVF3.js";
14
14
  import {
15
15
  setSpanAttributes,
16
16
  setSpanStatus,
17
17
  withSpan
18
- } from "./chunk-36UJA3OD.js";
18
+ } from "./chunk-NVUQSFWX.js";
19
19
 
20
20
  // src/chat/sandbox/runtime-dependencies.ts
21
21
  var GLOBAL_RUNTIME_DEPENDENCIES = [
@@ -1,36 +1,36 @@
1
1
  import {
2
2
  SANDBOX_WORKSPACE_ROOT,
3
3
  getStateAdapter
4
- } from "./chunk-HMRVILWZ.js";
4
+ } from "./chunk-67CVNDJ7.js";
5
5
  import {
6
6
  isConversationChannel,
7
7
  isConversationScopedChannel,
8
8
  isDmChannel,
9
9
  normalizeSlackConversationId
10
- } from "./chunk-QTS66GMR.js";
10
+ } from "./chunk-CWEZEPD4.js";
11
11
  import {
12
12
  getDb
13
- } from "./chunk-LLKDNPYV.js";
13
+ } from "./chunk-HWCQRGLL.js";
14
14
  import {
15
15
  botConfig,
16
16
  completeObject,
17
17
  embedTexts,
18
18
  standardModelId
19
- } from "./chunk-RCBUZGIT.js";
19
+ } from "./chunk-SYJT7AKB.js";
20
20
  import {
21
21
  isActorUserId,
22
22
  parseActorUserId
23
- } from "./chunk-C4MZ3GP5.js";
23
+ } from "./chunk-HZF5P5UN.js";
24
24
  import {
25
25
  logException,
26
26
  logInfo,
27
27
  logWarn
28
- } from "./chunk-36UJA3OD.js";
28
+ } from "./chunk-NVUQSFWX.js";
29
29
  import {
30
30
  parseSlackChannelReferenceId,
31
31
  parseSlackMessageTs,
32
32
  parseSlackTeamId
33
- } from "./chunk-42WRQLJ6.js";
33
+ } from "./chunk-F3B2YJ76.js";
34
34
 
35
35
  // src/chat/plugins/agent-hooks.ts
36
36
  import {
@@ -4,7 +4,7 @@ import {
4
4
  toCanonicalInputMessage,
5
5
  toCanonicalOutputMessage,
6
6
  toGenAiMessagesTraceAttributes
7
- } from "./chunk-6Y5L4BOM.js";
7
+ } from "./chunk-FXOYURO4.js";
8
8
  import {
9
9
  extractGenAiUsageAttributes,
10
10
  logException,
@@ -12,7 +12,7 @@ import {
12
12
  normalizeGenAiFinishReason,
13
13
  serializeGenAiAttribute,
14
14
  withSpan
15
- } from "./chunk-36UJA3OD.js";
15
+ } from "./chunk-NVUQSFWX.js";
16
16
 
17
17
  // src/chat/config.ts
18
18
  import { getModel as getModel2 } from "@earendil-works/pi-ai/compat";
@@ -42,7 +42,7 @@ import {
42
42
 
43
43
  // src/chat/pi/client.ts
44
44
  import { createGatewayProvider } from "@ai-sdk/gateway";
45
- import { embedMany, generateObject } from "ai";
45
+ import { embedMany, generateObject, NoObjectGeneratedError } from "ai";
46
46
 
47
47
  // src/chat/services/provider-error.ts
48
48
  var ProviderError = class extends Error {
@@ -53,7 +53,10 @@ var ProviderError = class extends Error {
53
53
  retryAfterMs;
54
54
  status;
55
55
  constructor(details) {
56
- super(`AI provider error: ${details.kind}`);
56
+ super(
57
+ `AI provider error: ${details.kind}`,
58
+ details.cause !== void 0 ? { cause: details.cause } : {}
59
+ );
57
60
  this.name = "ProviderError";
58
61
  this.kind = details.kind;
59
62
  this.modelId = details.modelId;
@@ -162,6 +165,7 @@ function createProviderError(error, options = {}) {
162
165
  const kind = options.kind ?? classifyProviderError(status, message, extractTransportKind(error));
163
166
  const retryable = !TERMINAL_KINDS.has(kind) && (options.retryable ?? RETRYABLE_KINDS.has(kind));
164
167
  return new ProviderError({
168
+ cause: error,
165
169
  kind,
166
170
  modelId: options.modelId,
167
171
  retryable,
@@ -473,22 +477,9 @@ async function completeObject(params) {
473
477
  return { object: result.object };
474
478
  } catch (error) {
475
479
  const providerError = createProviderError(error, {
480
+ ...NoObjectGeneratedError.isInstance(error) ? { kind: "invalid_response" } : {},
476
481
  modelId: params.modelId
477
482
  });
478
- if (isProviderRetryError(providerError)) {
479
- throw providerError;
480
- }
481
- logException(
482
- providerError,
483
- "ai_completion_failed",
484
- {},
485
- {
486
- "gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
487
- "gen_ai.operation.name": GEN_AI_OPERATION_CHAT,
488
- "gen_ai.request.model": params.modelId
489
- },
490
- "AI object completion failed"
491
- );
492
483
  throw providerError;
493
484
  }
494
485
  }
@@ -621,6 +612,7 @@ var DEFAULT_FUNCTION_MAX_DURATION_SECONDS = 300;
621
612
  var DEFAULT_SLACK_SLASH_COMMAND = "/jr";
622
613
  var DEFAULT_PROCESSING_REACTION_EMOJI = "eyes";
623
614
  var DEFAULT_COMPLETED_REACTION_EMOJI = "white_check_mark";
615
+ var DEFAULT_MODEL_CONTEXT_WINDOW_TOKENS = 4e5;
624
616
  var FUNCTION_TIMEOUT_BUFFER_SECONDS = 20;
625
617
  var CONVERSATION_WORK_SOFT_YIELD_BUFFER_SECONDS = 40;
626
618
  var DEFAULT_ASSISTANT_LOADING_MESSAGES = [
@@ -701,6 +693,13 @@ function parseSlashCommand(rawValue) {
701
693
  }
702
694
  return command;
703
695
  }
696
+ function parseCrossActorMidRunMode(rawValue) {
697
+ const value = toOptionalTrimmed(rawValue) ?? "follow_up";
698
+ if (value === "follow_up" || value === "steer") {
699
+ return value;
700
+ }
701
+ throw new Error("JUNIOR_CROSS_ACTOR_MID_RUN_MODE must be follow_up or steer");
702
+ }
704
703
  var DEFAULT_MODEL_ID = getModel2("vercel-ai-gateway", "xai/grok-4.5").id;
705
704
  var DEFAULT_FAST_MODEL_ID = getModel2(
706
705
  "vercel-ai-gateway",
@@ -787,11 +786,14 @@ function readBotConfig(env, functionMaxDurationSeconds) {
787
786
  const handoffModelId = validateGatewayModelId(env.AI_HANDOFF_MODEL) ?? DEFAULT_HANDOFF_MODEL_ID;
788
787
  return {
789
788
  userName: toOptionalTrimmed(env.JUNIOR_BOT_NAME) ?? "junior",
789
+ crossActorMidRunMode: parseCrossActorMidRunMode(
790
+ env.JUNIOR_CROSS_ACTOR_MID_RUN_MODE
791
+ ),
790
792
  profiles: parseProfiles(env.AI_MODEL_PROFILES, modelId, handoffModelId),
791
- modelContextWindowTokens: parseOptionalPositiveInteger(
793
+ contextWindowTokens: parseOptionalPositiveInteger(
792
794
  "AI_MODEL_CONTEXT_WINDOW_TOKENS",
793
795
  env.AI_MODEL_CONTEXT_WINDOW_TOKENS
794
- ),
796
+ ) ?? DEFAULT_MODEL_CONTEXT_WINDOW_TOKENS,
795
797
  reasoningLevel: reasoningLevel === void 0 ? void 0 : parseTurnReasoningLevel(reasoningLevel),
796
798
  fastModelId,
797
799
  imageGenerationModelId: toOptionalTrimmed(env.AI_IMAGE_MODEL) ?? DEFAULT_IMAGE_GENERATION_MODEL_ID,
@@ -947,6 +949,7 @@ export {
947
949
  embedTexts,
948
950
  normalizeSlackEmojiName,
949
951
  TURN_REASONING_LEVELS,
952
+ parseTurnReasoningLevel,
950
953
  STANDARD_MODEL_PROFILE,
951
954
  DEFAULT_HANDOFF_MODEL_PROFILE,
952
955
  modelProfileSchema,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JUNIOR_VERSION
3
- } from "./chunk-ZRSUCJGA.js";
3
+ } from "./chunk-FHC4JUSF.js";
4
4
 
5
5
  // src/deployment.ts
6
6
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
@@ -0,0 +1,71 @@
1
+ import {
2
+ parseActorUserId
3
+ } from "./chunk-HZF5P5UN.js";
4
+
5
+ // src/chat/credentials/context.ts
6
+ import { z } from "zod";
7
+ var exactActorIdSchema = z.string().refine((value) => parseActorUserId(value) === value);
8
+ var exactNonBlankStringSchema = z.string().min(1).refine((value) => value === value.trim());
9
+ var slackDirectCredentialSubjectBindingSchema = z.object({
10
+ type: z.literal("slack-direct-conversation"),
11
+ teamId: z.string().min(1),
12
+ channelId: z.string().min(1),
13
+ signature: z.string().min(1)
14
+ }).strict();
15
+ var scheduledTaskCredentialSubjectBindingSchema = z.object({
16
+ type: z.literal("scheduled-task"),
17
+ plugin: z.string().min(1),
18
+ taskId: exactNonBlankStringSchema,
19
+ signature: z.string().min(1)
20
+ }).strict();
21
+ var credentialSubjectBindingSchema = z.discriminatedUnion("type", [
22
+ slackDirectCredentialSubjectBindingSchema,
23
+ scheduledTaskCredentialSubjectBindingSchema
24
+ ]);
25
+ var credentialUserActorSchema = z.object({
26
+ type: z.literal("user"),
27
+ userId: exactActorIdSchema
28
+ }).strict();
29
+ var credentialSystemActorSchema = z.object({
30
+ platform: z.literal("system"),
31
+ name: exactActorIdSchema
32
+ }).strict();
33
+ var credentialSubjectSchema = z.discriminatedUnion("allowedWhen", [
34
+ z.object({
35
+ type: z.literal("user"),
36
+ userId: exactActorIdSchema,
37
+ allowedWhen: z.literal("private-direct-conversation"),
38
+ binding: slackDirectCredentialSubjectBindingSchema
39
+ }).strict(),
40
+ z.object({
41
+ type: z.literal("user"),
42
+ userId: exactActorIdSchema,
43
+ allowedWhen: z.literal("scheduled-task"),
44
+ taskId: exactNonBlankStringSchema,
45
+ binding: scheduledTaskCredentialSubjectBindingSchema
46
+ }).strict().refine((subject) => subject.binding.taskId === subject.taskId, {
47
+ message: "Scheduled task credential subject requires task binding",
48
+ path: ["binding"]
49
+ })
50
+ ]);
51
+ var credentialContextSchema = z.union([
52
+ z.object({
53
+ actor: credentialUserActorSchema
54
+ }).strict(),
55
+ z.object({
56
+ actor: credentialSystemActorSchema,
57
+ subject: credentialSubjectSchema.optional()
58
+ }).strict()
59
+ ]);
60
+ function credentialUserSubjectId(context) {
61
+ if ("type" in context.actor) {
62
+ return context.actor.userId;
63
+ }
64
+ return "subject" in context ? context.subject?.userId : void 0;
65
+ }
66
+
67
+ export {
68
+ credentialSubjectSchema,
69
+ credentialContextSchema,
70
+ credentialUserSubjectId
71
+ };