@sentry/junior 0.202.0 → 0.204.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 (174) hide show
  1. package/dist/agent-CMyTD4DD.js +17509 -0
  2. package/dist/agent-hooks-Bbcp9e33.js +4040 -0
  3. package/dist/agent-runner-DNb1A49M.js +678 -0
  4. package/dist/api/schema.d.ts +2728 -2639
  5. package/dist/api/schema.js +4 -169
  6. package/dist/api.d.ts +23 -17
  7. package/dist/api.js +3881 -5326
  8. package/dist/app-B1TOqBI8.d.ts +246 -0
  9. package/dist/app.d.ts +4 -520
  10. package/dist/app.js +9522 -11875
  11. package/dist/auth-pause-state-DosEalIG.js +168 -0
  12. package/dist/catalog-runtime-BReos-D4.js +7 -0
  13. package/dist/checkpoint-CNrPyRJN.js +2450 -0
  14. package/dist/cli/chat.d.ts +20 -0
  15. package/dist/cli/chat.js +229 -336
  16. package/dist/cli/check.d.ts +8 -0
  17. package/dist/cli/check.js +513 -806
  18. package/dist/cli/env.d.ts +13 -0
  19. package/dist/cli/env.js +63 -12
  20. package/dist/cli/init.d.ts +3 -0
  21. package/dist/cli/init.js +90 -159
  22. package/dist/cli/main.d.ts +6 -0
  23. package/dist/cli/main.js +43 -64
  24. package/dist/cli/plugins.d.ts +13 -0
  25. package/dist/cli/plugins.js +148 -227
  26. package/dist/cli/run.d.ts +16 -0
  27. package/dist/cli/run.js +52 -8
  28. package/dist/cli/snapshot-create.d.ts +4 -0
  29. package/dist/cli/snapshot-create.js +71 -125
  30. package/dist/cli/upgrade.d.ts +15 -0
  31. package/dist/cli/upgrade.js +232 -335
  32. package/dist/config-nGCW1OTG.js +941 -0
  33. package/dist/context-B45_WqVX.js +298 -0
  34. package/dist/conversation-privacy-B4voFRSm.js +182 -0
  35. package/dist/conversation-work-C6y3T5Hx.js +51 -0
  36. package/dist/credential-sync-kXr1hvO1.js +2660 -0
  37. package/dist/db-BeyXKJOI.d.ts +5 -0
  38. package/dist/destinations-BeBiJeEM.js +29 -0
  39. package/dist/execution-stats-DWfSihcH.js +373 -0
  40. package/dist/executor-DcMSlI5c.js +721 -0
  41. package/dist/experimental-CIXf7Uye.js +46 -0
  42. package/dist/history-ClE4toxe.d.ts +32 -0
  43. package/dist/history-CqTuSAdI.js +441 -0
  44. package/dist/instrumentation.d.ts +3 -3
  45. package/dist/instrumentation.js +130 -176
  46. package/dist/job-queue-Drn_LXlM.js +63 -0
  47. package/dist/logging-BzAk1S_s.js +1210 -0
  48. package/dist/model-profile-CZmVoGdX.js +49 -0
  49. package/dist/nitro.d.ts +31 -36
  50. package/dist/nitro.js +275 -456
  51. package/dist/oauth-callback-server-JiftokvA.js +130 -0
  52. package/dist/oauth-relay-CdCnu80W.js +62 -0
  53. package/dist/package-discovery-7a9YqLhE.js +455 -0
  54. package/dist/pending-auth-CWmSdZVg.js +185 -0
  55. package/dist/plugin-module-BKGOXca2.js +81 -0
  56. package/dist/plugins-BI9A1vKA.d.ts +95 -0
  57. package/dist/plugins-egKWjgue.js +99 -0
  58. package/dist/private-trace-result-BLvBjy_e.js +16 -0
  59. package/dist/profile-CrT5nXbw.js +861 -0
  60. package/dist/registry-DH1xUo2N.js +1419 -0
  61. package/dist/reporting-schema-DosTN__Q.js +105 -0
  62. package/dist/resolve-CZHnfxaS.js +546 -0
  63. package/dist/rolldown-runtime-B4FMCO8f.js +28 -0
  64. package/dist/runner-CZV2sC46.js +392 -0
  65. package/dist/sandbox-egress-signals-bHZfmhbd.js +46 -0
  66. package/dist/schema-Rn8-XEaN.js +1140 -0
  67. package/dist/sentry-CD3SdJl-.js +26 -0
  68. package/dist/skills-CIcDQSgM.js +316 -0
  69. package/dist/spawn-DdkUFRmq.js +29 -0
  70. package/dist/stats-DTUbAb88.js +2634 -0
  71. package/dist/store-C5qxF2ac.d.ts +208 -0
  72. package/dist/task-queue-CJIR4RF7.js +136 -0
  73. package/dist/task-runner-D-O3A-Cp.js +639 -0
  74. package/dist/thread-state-CRc9jTJS.js +431 -0
  75. package/dist/turn-execution-BkinIdJF.js +47 -0
  76. package/dist/turn-lifecycle-DQV19VTW.js +54 -0
  77. package/dist/usage-D3EbSO7w.js +296 -0
  78. package/dist/usage-schema-CKaDkH_j.js +20 -0
  79. package/dist/validation-C2CR-OX3.js +40 -0
  80. package/dist/vercel-queue-DIkVcfK4.js +167 -0
  81. package/dist/vercel.d.ts +6 -6
  82. package/dist/vercel.js +14 -6
  83. package/dist/version-CnXZ614E.d.ts +5 -0
  84. package/dist/version-DxcWdoKa.js +8 -0
  85. package/dist/version.d.ts +2 -4
  86. package/dist/version.js +2 -6
  87. package/dist/web-authorization-RMBxAR_t.js +76 -0
  88. package/dist/web-input-3EPfpf55.js +494 -0
  89. package/dist/work-fGofI7Op.js +509 -0
  90. package/dist/worker-CsOLq-mR.js +625 -0
  91. package/package.json +9 -9
  92. package/dist/agent-hooks-UXITLYOK.js +0 -51
  93. package/dist/catalog-runtime-BG3JLLK2.js +0 -14
  94. package/dist/chunk-2LYHWMR4.js +0 -46
  95. package/dist/chunk-2MK3QBGA.js +0 -321
  96. package/dist/chunk-3PGQSKJV.js +0 -692
  97. package/dist/chunk-3UI3WFTX.js +0 -519
  98. package/dist/chunk-3Y47VMHV.js +0 -6
  99. package/dist/chunk-4UO6FK4G.js +0 -64
  100. package/dist/chunk-5NOPO64K.js +0 -198
  101. package/dist/chunk-5PKWYPFT.js +0 -2943
  102. package/dist/chunk-63NKKFJL.js +0 -1228
  103. package/dist/chunk-6AYH6252.js +0 -787
  104. package/dist/chunk-6Y5B5PEX.js +0 -80
  105. package/dist/chunk-7DHZP5KJ.js +0 -333
  106. package/dist/chunk-7H2VZTWN.js +0 -103
  107. package/dist/chunk-7NL7T6VU.js +0 -406
  108. package/dist/chunk-A76OIMYN.js +0 -102
  109. package/dist/chunk-AWMS3SPP.js +0 -58
  110. package/dist/chunk-B3LY5RCL.js +0 -229
  111. package/dist/chunk-BD2KT3OB.js +0 -36
  112. package/dist/chunk-BXCX5QKA.js +0 -2086
  113. package/dist/chunk-C6VVF43U.js +0 -81
  114. package/dist/chunk-CEMMLV5L.js +0 -98
  115. package/dist/chunk-CM5HNV2W.js +0 -131
  116. package/dist/chunk-DA2KGZZI.js +0 -13
  117. package/dist/chunk-DBVY6HLX.js +0 -64
  118. package/dist/chunk-DIB4GX3G.js +0 -8
  119. package/dist/chunk-DKIJ2RP5.js +0 -68
  120. package/dist/chunk-DL2KLKVH.js +0 -931
  121. package/dist/chunk-DWPN6SCH.js +0 -172
  122. package/dist/chunk-ELWOYVOY.js +0 -206
  123. package/dist/chunk-EWT7H65X.js +0 -506
  124. package/dist/chunk-FA6POGLH.js +0 -70
  125. package/dist/chunk-HMREVIO2.js +0 -135
  126. package/dist/chunk-IIWUT4FO.js +0 -820
  127. package/dist/chunk-JAL3CH4G.js +0 -27
  128. package/dist/chunk-JSJQEWBJ.js +0 -3295
  129. package/dist/chunk-KHKKHDLD.js +0 -387
  130. package/dist/chunk-LA6R4A7Q.js +0 -706
  131. package/dist/chunk-LOOU2DUR.js +0 -20428
  132. package/dist/chunk-M6FHWXE3.js +0 -700
  133. package/dist/chunk-M76HMB7M.js +0 -1856
  134. package/dist/chunk-MAGNK5J4.js +0 -1520
  135. package/dist/chunk-MTM5IFCY.js +0 -1190
  136. package/dist/chunk-N7TMSOZH.js +0 -235
  137. package/dist/chunk-NHJU2ZAL.js +0 -56
  138. package/dist/chunk-NSXKRGRT.js +0 -717
  139. package/dist/chunk-OWMPFXJA.js +0 -1764
  140. package/dist/chunk-PDO5BLNM.js +0 -22
  141. package/dist/chunk-PEQXYSSE.js +0 -45
  142. package/dist/chunk-PW4P4JYF.js +0 -1135
  143. package/dist/chunk-QB54UQUS.js +0 -320
  144. package/dist/chunk-QP3OGJXF.js +0 -105
  145. package/dist/chunk-RC745GGZ.js +0 -122
  146. package/dist/chunk-REOIRYPR.js +0 -37
  147. package/dist/chunk-SCOZRLZ4.js +0 -164
  148. package/dist/chunk-TXJSXBV5.js +0 -1433
  149. package/dist/chunk-TXKUKMVO.js +0 -417
  150. package/dist/chunk-U2GPUYAL.js +0 -3656
  151. package/dist/chunk-UIE3R5XU.js +0 -17
  152. package/dist/chunk-UXPG6ZIN.js +0 -84
  153. package/dist/chunk-VFUK3X5B.js +0 -50
  154. package/dist/chunk-WQSHDTTI.js +0 -1163
  155. package/dist/chunk-X6GDDWQH.js +0 -60
  156. package/dist/chunk-Y2CM7HXH.js +0 -111
  157. package/dist/chunk-Y7X25LFY.js +0 -15
  158. package/dist/chunk-YDUR3ZYW.js +0 -10
  159. package/dist/conversation-work-VIOQ5ZF3.js +0 -54
  160. package/dist/db-3L2MCVRI.js +0 -26
  161. package/dist/discovery-DWVDM7UK.js +0 -44
  162. package/dist/experimental-P5FZM4CU.js +0 -12
  163. package/dist/oauth-callback-server-YVV6C6T2.js +0 -243
  164. package/dist/oauth-relay-5XPVRPYB.js +0 -8
  165. package/dist/plugins-YTYJMMJF.js +0 -14
  166. package/dist/runner-LQ7RETDP.js +0 -522
  167. package/dist/sandbox-egress-signals-FIL7EGPR.js +0 -73
  168. package/dist/sentry-MB3NL3IR.js +0 -42
  169. package/dist/skills-XRWYEDCD.js +0 -27
  170. package/dist/spawn-RC6SJUAI.js +0 -42
  171. package/dist/task-runner-7DY7ARYH.js +0 -36
  172. package/dist/validation-7MNQGCJA.js +0 -17
  173. package/dist/work-COALHUCG.js +0 -51
  174. package/dist/worker-6MURZIPD.js +0 -24
@@ -1,320 +0,0 @@
1
- import {
2
- parseSandboxEgressAuthRequiredSignal
3
- } from "./chunk-6Y5B5PEX.js";
4
- import {
5
- authorizationId
6
- } from "./chunk-DIB4GX3G.js";
7
- import {
8
- formatProviderLabel,
9
- startOAuthFlow
10
- } from "./chunk-DL2KLKVH.js";
11
- import {
12
- abandonReplacedPendingAuth,
13
- canReusePendingAuthLink
14
- } from "./chunk-ELWOYVOY.js";
15
- import {
16
- recordAuthorizationRequested
17
- } from "./chunk-5PKWYPFT.js";
18
- import {
19
- AGENT_INVOCATION_MAILBOX_STATUSES
20
- } from "./chunk-PW4P4JYF.js";
21
- import {
22
- TURN_REASONING_LEVELS
23
- } from "./chunk-NHJU2ZAL.js";
24
- import {
25
- pluginCatalogRuntime
26
- } from "./chunk-YDUR3ZYW.js";
27
- import {
28
- credentialContextSchema
29
- } from "./chunk-CEMMLV5L.js";
30
-
31
- // src/chat/services/auth-pause.ts
32
- var AuthorizationPauseError = class extends Error {
33
- disposition;
34
- kind;
35
- provider;
36
- providerDisplayName;
37
- requestText;
38
- constructor(kind, provider, providerDisplayName, disposition, requestText) {
39
- super(
40
- kind === "mcp" ? `MCP authorization started for ${provider}` : `Plugin authorization started for ${provider}`
41
- );
42
- this.name = kind === "mcp" ? "McpAuthorizationPauseError" : "PluginAuthorizationPauseError";
43
- this.disposition = disposition;
44
- this.kind = kind;
45
- this.provider = provider;
46
- this.providerDisplayName = providerDisplayName;
47
- this.requestText = requestText;
48
- }
49
- };
50
- var AuthPausePersistenceError = class extends Error {
51
- constructor(conversationId, turnId, cause) {
52
- super(
53
- `Failed to persist auth pause for conversation=${conversationId} turn=${turnId}`,
54
- cause === void 0 ? void 0 : { cause }
55
- );
56
- this.name = "AuthPausePersistenceError";
57
- }
58
- };
59
- var AuthorizationFlowDisabledError = class extends Error {
60
- kind;
61
- provider;
62
- constructor(kind, provider) {
63
- super(
64
- `Authorization is required for ${provider}, but this turn cannot start an authorization flow.`
65
- );
66
- this.name = "AuthorizationFlowDisabledError";
67
- this.kind = kind;
68
- this.provider = provider;
69
- }
70
- };
71
-
72
- // src/chat/services/plugin-auth-orchestration.ts
73
- var PluginAuthorizationPauseError = class extends AuthorizationPauseError {
74
- constructor(provider, providerDisplayName, disposition, requestText) {
75
- super("plugin", provider, providerDisplayName, disposition, requestText);
76
- }
77
- };
78
- var PluginCredentialFailureError = class extends Error {
79
- provider;
80
- constructor(provider, message) {
81
- super(message);
82
- this.name = "PluginCredentialFailureError";
83
- this.provider = provider;
84
- }
85
- };
86
- function pluginAuthRequiredSignal(details) {
87
- if (!details || typeof details !== "object") {
88
- return void 0;
89
- }
90
- const signal = details.auth_required;
91
- const parsedSignal = parseSandboxEgressAuthRequiredSignal(signal);
92
- if (!parsedSignal) {
93
- return void 0;
94
- }
95
- return {
96
- provider: parsedSignal.provider,
97
- grant: parsedSignal.grant,
98
- kind: parsedSignal.kind,
99
- ...parsedSignal.message ? { message: parsedSignal.message } : void 0,
100
- ...parsedSignal.authorization ? { authorization: parsedSignal.authorization } : void 0
101
- };
102
- }
103
- function createPluginAuthOrchestration(input) {
104
- let pendingPause;
105
- const startAuthorizationPause = async (provider, options) => {
106
- if (pendingPause) {
107
- throw pendingPause;
108
- }
109
- if (!input.actorId || !pluginCatalogRuntime.getOAuthConfig(provider)) {
110
- throw new Error(`Cannot start plugin authorization for ${provider}`);
111
- }
112
- if (input.interactiveAuthEnabled === false) {
113
- throw new AuthorizationFlowDisabledError("plugin", provider);
114
- }
115
- const recordPendingAuth = input.sessionId ? input.recordPendingAuth : void 0;
116
- if (input.sessionId && !recordPendingAuth) {
117
- throw new Error(
118
- `Missing pending auth recorder for plugin authorization pause "${provider}"`
119
- );
120
- }
121
- const providerLabel = formatProviderLabel(provider);
122
- const reusingPendingLink = input.sessionId ? canReusePendingAuthLink({
123
- pendingAuth: input.pendingAuth,
124
- kind: "plugin",
125
- provider,
126
- actorId: input.actorId,
127
- sessionId: input.sessionId,
128
- ...options?.scope ? { scope: options.scope } : void 0
129
- }) : false;
130
- if (!reusingPendingLink) {
131
- const oauthResult = await startOAuthFlow(provider, {
132
- actorId: input.actorId,
133
- ...input.actor ? { actor: input.actor } : void 0,
134
- channelId: input.channelId,
135
- destination: input.destination,
136
- source: input.source,
137
- threadTs: input.threadTs,
138
- ...options?.scope ? { scope: options.scope } : void 0,
139
- resumeConversationId: input.conversationId,
140
- resumeSessionId: input.sessionId,
141
- authorization: input.authorization
142
- });
143
- if (!oauthResult.ok) {
144
- throw new Error(oauthResult.error);
145
- }
146
- if (!oauthResult.delivery) {
147
- throw new Error(
148
- `I need to connect your ${providerLabel} account first, but I wasn't able to send you a private authorization link. Please send me a direct message and try again.`
149
- );
150
- }
151
- }
152
- if (input.sessionId && recordPendingAuth) {
153
- const nextPendingAuth = {
154
- kind: "plugin",
155
- provider,
156
- actorId: input.actorId,
157
- ...options?.scope ? { scope: options.scope } : void 0,
158
- sessionId: input.sessionId,
159
- linkSentAtMs: reusingPendingLink ? input.pendingAuth.linkSentAtMs : Date.now()
160
- };
161
- await recordPendingAuth(nextPendingAuth);
162
- await abandonReplacedPendingAuth({
163
- conversationId: input.conversationId,
164
- previousPendingAuth: input.pendingAuth,
165
- nextPendingAuth
166
- });
167
- }
168
- if (input.conversationId && input.sessionId) {
169
- await recordAuthorizationRequested({
170
- conversationId: input.conversationId,
171
- kind: "plugin",
172
- provider,
173
- actorId: input.actorId,
174
- authorizationId: authorizationId({
175
- kind: "plugin",
176
- provider,
177
- sessionId: input.sessionId
178
- }),
179
- delivery: reusingPendingLink ? "private_link_reused" : "private_link_sent"
180
- });
181
- }
182
- pendingPause = new PluginAuthorizationPauseError(
183
- provider,
184
- providerLabel,
185
- reusingPendingLink ? "link_already_sent" : "link_sent",
186
- input.userMessage
187
- );
188
- input.abortAgent();
189
- throw pendingPause;
190
- };
191
- return {
192
- maybeHandleAuthSignal: async (details) => {
193
- const signal = pluginAuthRequiredSignal(details);
194
- if (!signal) {
195
- return;
196
- }
197
- const { provider, authorization } = signal;
198
- if (signal.kind === "unavailable") {
199
- throw new PluginCredentialFailureError(
200
- provider,
201
- signal.message ?? `${formatProviderLabel(provider)} credentials are unavailable.`
202
- );
203
- }
204
- if (!authorization) {
205
- throw new PluginCredentialFailureError(
206
- provider,
207
- signal.message ?? `${formatProviderLabel(provider)} credentials are required but no OAuth flow is available for this provider.`
208
- );
209
- }
210
- if (!input.actorId || !input.userTokenStore) {
211
- if (input.interactiveAuthEnabled === false) {
212
- throw new AuthorizationFlowDisabledError("plugin", provider);
213
- }
214
- throw new PluginCredentialFailureError(
215
- provider,
216
- signal.message ?? `${formatProviderLabel(provider)} credentials are required. Please connect your ${formatProviderLabel(provider)} account and try again.`
217
- );
218
- }
219
- if (!pluginCatalogRuntime.getOAuthConfig(authorization.provider)) {
220
- throw new PluginCredentialFailureError(
221
- provider,
222
- signal.message ?? `${formatProviderLabel(provider)} credentials are required but the provider is not configured for OAuth.`
223
- );
224
- }
225
- await startAuthorizationPause(
226
- authorization.provider,
227
- authorization.scope ? { scope: authorization.scope } : void 0
228
- );
229
- },
230
- getPendingPause: () => pendingPause
231
- };
232
- }
233
-
234
- // src/chat/agent-invocations/errors.ts
235
- var AgentInvocationBusyError = class extends Error {
236
- constructor(name) {
237
- super(`Named agent "${name}" already has active work`);
238
- this.name = "AgentInvocationBusyError";
239
- }
240
- };
241
- var AgentInvocationLimitError = class extends Error {
242
- constructor(limit) {
243
- super(
244
- `Parent already has ${limit} active child agent invocations (limit ${limit})`
245
- );
246
- this.name = "AgentInvocationLimitError";
247
- }
248
- };
249
-
250
- // src/chat/agent-invocations/types.ts
251
- import {
252
- actorSchema,
253
- destinationSchema,
254
- sourceSchema
255
- } from "@sentry/junior-plugin-api";
256
- import { z } from "zod";
257
- var exactStringSchema = z.string().min(1).refine((value) => value === value.trim());
258
- var agentNameSchema = exactStringSchema.max(64);
259
- var agentInvocationMailboxStatusSchema = z.enum(
260
- AGENT_INVOCATION_MAILBOX_STATUSES
261
- );
262
- var agentBindingSchema = z.object({
263
- childConversationId: exactStringSchema,
264
- name: agentNameSchema,
265
- parentConversationId: exactStringSchema
266
- }).strict();
267
- var agentInvocationBaseSchema = z.object({
268
- actor: actorSchema,
269
- agentName: agentNameSchema.optional(),
270
- childConversationId: exactStringSchema,
271
- createdAtMs: z.number().finite(),
272
- credentialContext: credentialContextSchema.optional(),
273
- destination: destinationSchema,
274
- input: exactStringSchema,
275
- invocationId: exactStringSchema,
276
- mailboxStatus: agentInvocationMailboxStatusSchema,
277
- parentConversationId: exactStringSchema,
278
- reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
279
- source: sourceSchema,
280
- updatedAtMs: z.number().finite()
281
- }).strict();
282
- var agentInvocationSchema = z.discriminatedUnion("status", [
283
- agentInvocationBaseSchema.extend({
284
- status: z.enum(["pending", "running", "awaiting_resume"])
285
- }),
286
- agentInvocationBaseSchema.extend({
287
- result: z.string(),
288
- status: z.literal("completed"),
289
- terminalAtMs: z.number().finite()
290
- }),
291
- agentInvocationBaseSchema.extend({
292
- errorMessage: z.string(),
293
- status: z.enum(["blocked", "failed"]),
294
- terminalAtMs: z.number().finite()
295
- })
296
- ]);
297
- var createAgentInvocationSchema = z.object({
298
- actor: actorSchema,
299
- agentName: agentNameSchema.optional(),
300
- credentialContext: credentialContextSchema.optional(),
301
- destination: destinationSchema,
302
- idempotencyKey: exactStringSchema,
303
- input: exactStringSchema,
304
- parentConversationId: exactStringSchema,
305
- reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional()
306
- }).strict();
307
-
308
- export {
309
- AuthorizationPauseError,
310
- AuthPausePersistenceError,
311
- AuthorizationFlowDisabledError,
312
- AgentInvocationBusyError,
313
- AgentInvocationLimitError,
314
- agentNameSchema,
315
- agentBindingSchema,
316
- agentInvocationSchema,
317
- createAgentInvocationSchema,
318
- PluginCredentialFailureError,
319
- createPluginAuthOrchestration
320
- };
@@ -1,105 +0,0 @@
1
- import {
2
- getStateAdapter
3
- } from "./chunk-2MK3QBGA.js";
4
- import {
5
- getClient
6
- } from "./chunk-PEQXYSSE.js";
7
-
8
- // src/chat/conversations/web-authorization.ts
9
- import { randomUUID } from "crypto";
10
- var WEB_AUTHORIZATION_PREFIX = "junior:web_authorization:v1";
11
- var WEB_AUTHORIZATION_TTL_MS = 24 * 60 * 60 * 1e3;
12
- function authorizationKey(conversationId, actorId) {
13
- return `${WEB_AUTHORIZATION_PREFIX}:${conversationId}:${actorId}`;
14
- }
15
- function createWebAuthorization(args) {
16
- return {
17
- createState: async () => randomUUID(),
18
- deliver: async (request) => {
19
- await getStateAdapter().set(
20
- authorizationKey(args.conversationId, args.actorId),
21
- JSON.stringify({ ...request, ...args }),
22
- WEB_AUTHORIZATION_TTL_MS
23
- );
24
- }
25
- };
26
- }
27
- async function getWebAuthorization(args) {
28
- const value = await getStateAdapter().get(
29
- authorizationKey(args.conversationId, args.actorId)
30
- );
31
- if (typeof value !== "string") return void 0;
32
- try {
33
- const parsed = JSON.parse(value);
34
- if (parsed.actorId !== args.actorId || parsed.conversationId !== args.conversationId || typeof parsed.authorizationUrl !== "string" || typeof parsed.label !== "string" || typeof parsed.completionText !== "string") {
35
- return void 0;
36
- }
37
- return parsed;
38
- } catch {
39
- return void 0;
40
- }
41
- }
42
- async function deleteWebAuthorization(args) {
43
- await getStateAdapter().delete(
44
- authorizationKey(args.conversationId, args.actorId)
45
- );
46
- }
47
-
48
- // src/chat/sentry-links.ts
49
- function getSentryOrgSlug() {
50
- const slug = process.env.SENTRY_ORG_SLUG?.trim();
51
- return slug || void 0;
52
- }
53
- function isSentrySaasDsnHost(host) {
54
- return host === "sentry.io" || host.endsWith(".sentry.io");
55
- }
56
- function buildSentryWebBaseUrl(dsn) {
57
- if (isSentrySaasDsnHost(dsn.host)) {
58
- return "https://sentry.io";
59
- }
60
- const port = dsn.port ? `:${dsn.port}` : "";
61
- const path = dsn.path ? `/${dsn.path}` : "";
62
- return `${dsn.protocol}://${dsn.host}${port}${path}`;
63
- }
64
- function buildSentryOrgPath(args) {
65
- const client = getClient();
66
- const dsn = client?.getDsn();
67
- if (!dsn?.host || !dsn.projectId) {
68
- return void 0;
69
- }
70
- const orgSlug = getSentryOrgSlug();
71
- if (!orgSlug) {
72
- return void 0;
73
- }
74
- const params = new URLSearchParams();
75
- params.set("project", dsn.projectId);
76
- if (args.query) {
77
- for (const [key, value] of Object.entries(args.query)) {
78
- params.set(key, value);
79
- }
80
- }
81
- const path = `${args.path}?${params.toString()}`;
82
- if (isSentrySaasDsnHost(dsn.host)) {
83
- return `https://${orgSlug}.sentry.io/${path}`;
84
- }
85
- return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
86
- }
87
- function buildSentryConversationUrl(conversationId) {
88
- return buildSentryOrgPath({
89
- path: `explore/conversations/${encodeURIComponent(conversationId)}/`
90
- });
91
- }
92
- function buildSentryEventUrl(eventId) {
93
- return buildSentryOrgPath({
94
- path: "issues/",
95
- query: { query: eventId }
96
- });
97
- }
98
-
99
- export {
100
- buildSentryConversationUrl,
101
- buildSentryEventUrl,
102
- createWebAuthorization,
103
- getWebAuthorization,
104
- deleteWebAuthorization
105
- };
@@ -1,122 +0,0 @@
1
- // src/reporting-schema.ts
2
- import { z } from "zod";
3
- var healthReportSchema = z.object({
4
- status: z.literal("ok"),
5
- service: z.string(),
6
- timestamp: z.string()
7
- }).strict();
8
- var pluginSchema = z.object({
9
- configKeys: z.array(z.string()),
10
- description: z.string(),
11
- displayName: z.string(),
12
- name: z.string()
13
- }).strict();
14
- var pluginsSchema = z.array(pluginSchema);
15
- var skillReportSchema = z.object({
16
- name: z.string(),
17
- pluginProvider: z.string().optional()
18
- }).strict();
19
- var skillReportsSchema = z.array(skillReportSchema);
20
- var pluginPackageContentItemReportSchema = z.object({
21
- dir: z.string(),
22
- hasMigrationsDir: z.boolean(),
23
- hasSkillsDir: z.boolean(),
24
- packageName: z.string()
25
- }).strict();
26
- var pluginPackageContentReportSchema = z.object({
27
- packageNames: z.array(z.string()),
28
- packages: z.array(pluginPackageContentItemReportSchema),
29
- manifestRoots: z.array(z.string()),
30
- skillRoots: z.array(z.string()),
31
- tracingIncludes: z.array(z.string())
32
- }).strict();
33
- var runtimeInfoReportSchema = z.object({
34
- cwd: z.string(),
35
- homeDir: z.string(),
36
- descriptionText: z.string().optional(),
37
- providers: z.array(z.string()),
38
- skills: z.array(skillReportSchema),
39
- packagedContent: pluginPackageContentReportSchema
40
- }).strict();
41
- var pluginOperationalToneSchema = z.enum([
42
- "danger",
43
- "good",
44
- "neutral",
45
- "warning"
46
- ]);
47
- var pluginOperationalMetricSchema = z.object({
48
- label: z.string(),
49
- tone: pluginOperationalToneSchema.optional(),
50
- value: z.string()
51
- }).strict();
52
- var pluginOperationalFieldSchema = z.object({
53
- key: z.string(),
54
- label: z.string()
55
- }).strict();
56
- var pluginOperationalRecordSchema = z.object({
57
- id: z.string(),
58
- tone: pluginOperationalToneSchema.optional(),
59
- values: z.record(z.string(), z.string())
60
- }).strict();
61
- var pluginOperationalRecordSetSchema = z.object({
62
- fields: z.array(pluginOperationalFieldSchema).optional(),
63
- emptyText: z.string().optional(),
64
- records: z.array(pluginOperationalRecordSchema).optional(),
65
- title: z.string()
66
- }).strict();
67
- var pluginOperationalBarChartWidgetSchema = z.object({
68
- categories: z.array(
69
- z.object({
70
- id: z.string().min(1),
71
- label: z.string().min(1),
72
- values: z.record(z.string(), z.number().finite())
73
- }).strict()
74
- ).max(100),
75
- description: z.string().optional(),
76
- emptyText: z.string().optional(),
77
- id: z.string().min(1),
78
- series: z.array(
79
- z.object({
80
- format: z.literal("usd").optional(),
81
- key: z.string().min(1),
82
- label: z.string().min(1),
83
- tone: pluginOperationalToneSchema.optional()
84
- }).strict()
85
- ).min(1).max(8),
86
- timeRangeDays: z.array(
87
- z.union([
88
- z.literal(1),
89
- z.literal(7),
90
- z.literal(30),
91
- z.literal(90)
92
- ])
93
- ).min(1).max(4).optional(),
94
- title: z.string().min(1),
95
- type: z.literal("bar_chart")
96
- }).strict();
97
- var pluginOperationalReportSchema = z.object({
98
- generatedAt: z.string().optional(),
99
- metrics: z.array(pluginOperationalMetricSchema).optional(),
100
- recordSets: z.array(pluginOperationalRecordSetSchema).optional(),
101
- title: z.string().optional(),
102
- pluginName: z.string(),
103
- widgets: z.array(pluginOperationalBarChartWidgetSchema).max(12).optional()
104
- }).strict();
105
- var pluginOperationalReportFeedSchema = z.object({
106
- generatedAt: z.string(),
107
- reports: z.array(pluginOperationalReportSchema),
108
- source: z.literal("plugins")
109
- }).strict();
110
-
111
- export {
112
- healthReportSchema,
113
- pluginSchema,
114
- pluginsSchema,
115
- skillReportSchema,
116
- skillReportsSchema,
117
- pluginPackageContentItemReportSchema,
118
- pluginPackageContentReportSchema,
119
- runtimeInfoReportSchema,
120
- pluginOperationalReportSchema,
121
- pluginOperationalReportFeedSchema
122
- };
@@ -1,37 +0,0 @@
1
- import {
2
- createAndEnqueueAgentInvocation
3
- } from "./chunk-3PGQSKJV.js";
4
- import {
5
- actorFromRun,
6
- toolInvocationDestination
7
- } from "./chunk-DL2KLKVH.js";
8
-
9
- // src/chat/agent-invocations/spawn.ts
10
- function bindSpawnAgent(run, options) {
11
- const actor = actorFromRun(run);
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 } : void 0,
22
- ...run.credentialContext ? { credentialContext: run.credentialContext } : void 0,
23
- destination: toolInvocationDestination(run),
24
- idempotencyKey: `${run.turnId}:${call.toolCallId}`,
25
- input: input.task,
26
- parentConversationId: run.conversationId,
27
- ...input.reasoningLevel ? { reasoningLevel: input.reasoningLevel } : void 0
28
- },
29
- { ...options, queue }
30
- );
31
- return { invocationId: invocation.invocationId };
32
- };
33
- }
34
-
35
- export {
36
- bindSpawnAgent
37
- };