@sentry/junior 0.137.0 → 0.139.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 (103) hide show
  1. package/dist/{agent-hooks-MZOKEP3J.js → agent-hooks-MJXMD7JP.js} +11 -9
  2. package/dist/api/schema/task.d.ts +100 -1
  3. package/dist/api/schema.d.ts +2 -2
  4. package/dist/api/schema.js +9 -1
  5. package/dist/api.js +202 -55
  6. package/dist/app.d.ts +7 -0
  7. package/dist/app.js +601 -1356
  8. package/dist/{catalog-runtime-MD66YLFV.js → catalog-runtime-GCCFYPIK.js} +6 -6
  9. package/dist/chat/agent/request.d.ts +44 -4
  10. package/dist/chat/agent-dispatch/heartbeat.d.ts +5 -0
  11. package/dist/chat/agent-dispatch/types.d.ts +1 -1
  12. package/dist/chat/agent-invocations/errors.d.ts +8 -0
  13. package/dist/chat/agent-invocations/spawn.d.ts +12 -0
  14. package/dist/chat/agent-invocations/store.d.ts +44 -0
  15. package/dist/chat/agent-invocations/types.d.ts +449 -0
  16. package/dist/chat/agent-invocations/work.d.ts +31 -0
  17. package/dist/chat/config.d.ts +1 -0
  18. package/dist/chat/conversations/sql/store.d.ts +8 -0
  19. package/dist/chat/conversations/store.d.ts +7 -0
  20. package/dist/chat/credentials/context.d.ts +14 -0
  21. package/dist/chat/experimental.d.ts +16 -0
  22. package/dist/chat/resource-events/actor.d.ts +23 -0
  23. package/dist/chat/runtime/agent-runner.d.ts +2 -1
  24. package/dist/chat/services/auth-pause.d.ts +0 -1
  25. package/dist/chat/services/mcp-auth-orchestration.d.ts +3 -2
  26. package/dist/chat/services/plugin-auth-orchestration.d.ts +3 -2
  27. package/dist/chat/state/turn-session.d.ts +1 -5
  28. package/dist/chat/task-execution/state.d.ts +23 -11
  29. package/dist/chat/task-execution/store.d.ts +20 -11
  30. package/dist/chat/task-execution/worker.d.ts +2 -2
  31. package/dist/chat/tasks/execution-stats.d.ts +34 -3
  32. package/dist/chat/tasks/read.d.ts +3 -1
  33. package/dist/chat/tools/runtime/spawn-agent.d.ts +31 -0
  34. package/dist/chat/tools/types.d.ts +2 -0
  35. package/dist/{chunk-T6Z5S6PQ.js → chunk-2ECYPYKP.js} +1 -1
  36. package/dist/chunk-3T2JAGRH.js +115 -0
  37. package/dist/chunk-3Y47VMHV.js +6 -0
  38. package/dist/chunk-4V4QIYJH.js +41 -0
  39. package/dist/{chunk-SYCX4DOK.js → chunk-5GSZWRE2.js} +434 -65
  40. package/dist/chunk-5IDFPCON.js +46 -0
  41. package/dist/{chunk-36EG34YI.js → chunk-6OHTDR4F.js} +1 -1
  42. package/dist/chunk-6SU2DT27.js +441 -0
  43. package/dist/{chunk-UG6ZYPBI.js → chunk-75I3UBIL.js} +73 -60
  44. package/dist/chunk-AEQISMMU.js +711 -0
  45. package/dist/{chunk-5PNJMOY5.js → chunk-C2N6MNO4.js} +9 -2
  46. package/dist/{chunk-BZAMASJP.js → chunk-CXH25EL4.js} +2 -2
  47. package/dist/{chunk-K2NCQJKH.js → chunk-DW4PMHNW.js} +3 -3
  48. package/dist/chunk-EM225ITJ.js +56 -0
  49. package/dist/{chunk-UOXATPSI.js → chunk-G52UXKGO.js} +7 -5
  50. package/dist/chunk-GI52BW74.js +207 -0
  51. package/dist/{chunk-3Q342EJJ.js → chunk-GWQSZT4C.js} +2 -2
  52. package/dist/{chunk-EPBBYMNE.js → chunk-HUO3UTAQ.js} +1 -1
  53. package/dist/{chunk-WPPXIAFB.js → chunk-IIESAYDL.js} +17 -434
  54. package/dist/chunk-IUFM5JWV.js +24 -0
  55. package/dist/{chunk-UZQ4VY3M.js → chunk-J3S57AXY.js} +1 -1
  56. package/dist/{chunk-DQXAAVTR.js → chunk-J6EJQCHY.js} +46 -1471
  57. package/dist/{chunk-6ZK6FZIV.js → chunk-KCBZSJRU.js} +6 -27
  58. package/dist/chunk-MQ5RYATN.js +1523 -0
  59. package/dist/{chunk-5G34IEK2.js → chunk-MXTVUV3I.js} +2 -56
  60. package/dist/{chunk-YRPC6MJY.js → chunk-MXVD2BDS.js} +1 -1
  61. package/dist/{chunk-POBSY47Q.js → chunk-PJW6U46K.js} +337 -306
  62. package/dist/chunk-Q6QZTTLS.js +55 -0
  63. package/dist/{chunk-ZFS67WIR.js → chunk-QTBKPZDA.js} +57 -6
  64. package/dist/chunk-R776HKPK.js +81 -0
  65. package/dist/{chunk-77VDLF3Z.js → chunk-RUIXF3YQ.js} +10 -0
  66. package/dist/chunk-U27DSXKB.js +714 -0
  67. package/dist/{chunk-XZ7NPXAB.js → chunk-U7CMWQ7Z.js} +1 -1
  68. package/dist/{chunk-RB4NJKEX.js → chunk-UDBUS533.js} +125 -51
  69. package/dist/chunk-WQRX57EA.js +668 -0
  70. package/dist/chunk-WZH4JV7R.js +320 -0
  71. package/dist/{chunk-HCIVH3JS.js → chunk-YCTDA7BD.js} +28 -0
  72. package/dist/{chunk-YNFERGKP.js → chunk-YGZ2OLXL.js} +1 -1
  73. package/dist/{chunk-EWDSB24B.js → chunk-ZQCGQMF2.js} +16 -776
  74. package/dist/{chunk-KJ4HGRHN.js → chunk-ZYQSPQYR.js} +515 -601
  75. package/dist/cli/chat.js +68 -29
  76. package/dist/cli/check.js +7 -7
  77. package/dist/cli/plugins.js +15 -13
  78. package/dist/cli/snapshot-create.js +11 -10
  79. package/dist/cli/upgrade.js +8 -8
  80. package/dist/conversation-work-KATFHLG3.js +56 -0
  81. package/dist/db/schema/agent-invocations.d.ts +544 -0
  82. package/dist/db/schema/task-executions.d.ts +23 -2
  83. package/dist/db/schema.d.ts +563 -2
  84. package/dist/{db-66E7VDNC.js → db-UXPPGHDF.js} +7 -7
  85. package/dist/experimental-HH6OM6UH.js +13 -0
  86. package/dist/instrumentation.js +4 -4
  87. package/dist/nitro.js +4 -3
  88. package/dist/{oauth-callback-server-7QPD4Q7P.js → oauth-callback-server-4ZYMD5UA.js} +28 -19
  89. package/dist/{runner-L2BKJKOD.js → runner-MZSEONRZ.js} +32 -18
  90. package/dist/{sandbox-egress-signals-A5HWIQH4.js → sandbox-egress-signals-EKPAVWQL.js} +2 -2
  91. package/dist/{skills-HOQ2NSPW.js → skills-IMVPXSQ7.js} +7 -7
  92. package/dist/spawn-S5LSVOCE.js +38 -0
  93. package/dist/{validation-ENHI7S2C.js → validation-ZKCY2BVR.js} +7 -7
  94. package/dist/version.js +1 -1
  95. package/dist/work-GG3XDYRX.js +46 -0
  96. package/dist/worker-23AUELCJ.js +24 -0
  97. package/migrations/0021_first_warhawk.sql +35 -0
  98. package/migrations/0022_task_execution_status.sql +3 -0
  99. package/migrations/meta/0021_snapshot.json +2176 -0
  100. package/migrations/meta/0022_snapshot.json +2186 -0
  101. package/migrations/meta/_journal.json +15 -1
  102. package/package.json +4 -4
  103. package/dist/chunk-6QW2RRQT.js +0 -233
@@ -0,0 +1,115 @@
1
+ import {
2
+ healthReportSchema
3
+ } from "./chunk-UTL3MHPC.js";
4
+ import {
5
+ parseSlackThreadId
6
+ } from "./chunk-MXVD2BDS.js";
7
+ import {
8
+ normalizeSlackConversationId
9
+ } from "./chunk-6SU2DT27.js";
10
+
11
+ // src/handlers/health.ts
12
+ function readHealthReport() {
13
+ return healthReportSchema.parse({
14
+ status: "ok",
15
+ service: "junior",
16
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
17
+ });
18
+ }
19
+ function GET() {
20
+ return Response.json(readHealthReport());
21
+ }
22
+
23
+ // src/chat/slack/conversation-context.ts
24
+ function normalizeConversationName(type, channelName) {
25
+ const trimmed = channelName?.trim();
26
+ if (!trimmed) return void 0;
27
+ if (type === "public_channel" || type === "private_channel" || type === "private_channel_or_group_dm") {
28
+ return trimmed.startsWith("#") ? trimmed : `#${trimmed}`;
29
+ }
30
+ return trimmed;
31
+ }
32
+ function typeFromSlackChannelType(channelType) {
33
+ if (channelType === "channel") return "public_channel";
34
+ if (channelType === "group") return "private_channel";
35
+ if (channelType === "mpim") return "group_dm";
36
+ if (channelType === "im") return "direct_message";
37
+ return void 0;
38
+ }
39
+ function typeFromChannelId(channelId, channelName) {
40
+ const normalized = normalizeSlackConversationId(channelId);
41
+ if (!normalized) return void 0;
42
+ if (normalized.startsWith("C")) return "public_channel";
43
+ if (normalized.startsWith("D")) return "direct_message";
44
+ if (normalized.startsWith("G")) {
45
+ return channelName?.trim().startsWith("mpdm-") ? "group_dm" : "private_channel_or_group_dm";
46
+ }
47
+ return void 0;
48
+ }
49
+ function toSlackEventChannelType(channelType) {
50
+ if (channelType === "channel" || channelType === "group" || channelType === "mpim" || channelType === "im") {
51
+ return channelType;
52
+ }
53
+ return void 0;
54
+ }
55
+ function conversationVisibilityFromSlackChannelType(channelType) {
56
+ if (!channelType) return void 0;
57
+ return channelType === "channel" ? "public" : "private";
58
+ }
59
+ function resolveSlackChannelTypeFromMessage(message) {
60
+ const raw = message.raw;
61
+ if (!raw || typeof raw !== "object") {
62
+ return void 0;
63
+ }
64
+ const channelType = raw.channel_type;
65
+ return typeof channelType === "string" ? toSlackEventChannelType(channelType.trim()) : void 0;
66
+ }
67
+ function resolveSlackConversationContext(input) {
68
+ const type = typeFromSlackChannelType(input.channelType) ?? typeFromChannelId(input.channelId, input.channelName);
69
+ if (!type) return void 0;
70
+ const name = normalizeConversationName(type, input.channelName);
71
+ const visibility = conversationVisibilityFromSlackChannelType(
72
+ input.channelType
73
+ );
74
+ return {
75
+ type,
76
+ ...name ? { name } : {},
77
+ ...visibility ? { visibility } : {}
78
+ };
79
+ }
80
+ function resolveSlackConversationContextFromThreadId(input) {
81
+ const slackThread = parseSlackThreadId(input.threadId);
82
+ const context = resolveSlackConversationContext({
83
+ channelId: slackThread?.channelId,
84
+ channelName: input.channelName
85
+ });
86
+ if (!context || !input.visibility) {
87
+ return context;
88
+ }
89
+ return {
90
+ ...context,
91
+ type: input.visibility === "private" && context.type === "public_channel" ? "private_channel" : context.type,
92
+ visibility: input.visibility
93
+ };
94
+ }
95
+ function formatSlackConversationTypeLabel(type) {
96
+ if (type === "public_channel") return "Public Channel";
97
+ if (type === "private_channel") return "Private Channel";
98
+ if (type === "group_dm") return "Group DM";
99
+ if (type === "direct_message") return "Direct Message";
100
+ return "Private Channel or Group DM";
101
+ }
102
+ function formatSlackConversationRedactedLabel(context) {
103
+ if (!context) return void 0;
104
+ return formatSlackConversationTypeLabel(context.type);
105
+ }
106
+
107
+ export {
108
+ readHealthReport,
109
+ GET,
110
+ conversationVisibilityFromSlackChannelType,
111
+ resolveSlackChannelTypeFromMessage,
112
+ resolveSlackConversationContext,
113
+ resolveSlackConversationContextFromThreadId,
114
+ formatSlackConversationRedactedLabel
115
+ };
@@ -0,0 +1,6 @@
1
+ // src/chat/state/ttl.ts
2
+ var JUNIOR_THREAD_STATE_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
3
+
4
+ export {
5
+ JUNIOR_THREAD_STATE_TTL_MS
6
+ };
@@ -0,0 +1,41 @@
1
+ import {
2
+ createAndEnqueueAgentInvocation
3
+ } from "./chunk-AEQISMMU.js";
4
+ import {
5
+ actorFromRouting,
6
+ toolInvocationDestination
7
+ } from "./chunk-R776HKPK.js";
8
+
9
+ // src/chat/agent-invocations/spawn.ts
10
+ function bindSpawnAgent(request, options) {
11
+ const actor = actorFromRouting(request.routing);
12
+ if (!actor) {
13
+ return void 0;
14
+ }
15
+ return async (input, call) => {
16
+ call.signal?.throwIfAborted();
17
+ const queue = typeof options.queue === "function" ? options.queue() : options.queue;
18
+ const invocation = await createAndEnqueueAgentInvocation(
19
+ {
20
+ actor,
21
+ ...input.name ? { agentName: input.name } : {},
22
+ ...request.routing.credentialContext ? { credentialContext: request.routing.credentialContext } : {},
23
+ destination: toolInvocationDestination(request.routing),
24
+ ...request.routing.destinationVisibility ? {
25
+ destinationVisibility: request.routing.destinationVisibility
26
+ } : {},
27
+ idempotencyKey: `${request.turnId}:${call.toolCallId}`,
28
+ input: input.task,
29
+ parentConversationId: request.conversationId,
30
+ ...input.reasoningLevel ? { reasoningLevel: input.reasoningLevel } : {},
31
+ source: request.routing.source
32
+ },
33
+ { ...options, queue }
34
+ );
35
+ return { invocationId: invocation.invocationId };
36
+ };
37
+ }
38
+
39
+ export {
40
+ bindSpawnAgent
41
+ };