@tool-bridge/server 0.1.1 → 0.3.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 (107) hide show
  1. package/dist/airtable-V6446SVY.js +792 -0
  2. package/dist/alt_text_generator_ai-HV7JZPDT.js +72 -0
  3. package/dist/amap-TTTVB6WS.js +755 -0
  4. package/dist/anthropic-JH3RA363.js +224 -0
  5. package/dist/apify-ETNN7ITU.js +262 -0
  6. package/dist/brave_search-3DDR2MMB.js +322 -0
  7. package/dist/chunk-CSJEZHQO.js +252 -0
  8. package/dist/chunk-JLTYA2B3.js +20121 -0
  9. package/dist/chunk-K7FVSFUX.js +333 -0
  10. package/dist/{chunk-MQEYFCJB.js → chunk-KGYJEEBI.js} +2770 -21574
  11. package/dist/circleci-MX3TX3HC.js +409 -0
  12. package/dist/clerk-MRPORVF4.js +1036 -0
  13. package/dist/cloudflare_dns-OWP7DD7L.js +605 -0
  14. package/dist/cohere-GPECP66S.js +197 -0
  15. package/dist/confluence-BN7LZ6BC.js +436 -0
  16. package/dist/convertapi-SBEOFOFQ.js +161 -0
  17. package/dist/currencyapi-P2YY7Y7P.js +306 -0
  18. package/dist/deepseek-MWB3NYIN.js +205 -0
  19. package/dist/docker_hub-3JSCIGQ3.js +946 -0
  20. package/dist/dropbox-RFIBDAXO.js +1308 -0
  21. package/dist/dub-YVP57ELQ.js +706 -0
  22. package/dist/e2b-NFSUHTZR.js +305 -0
  23. package/dist/exa-KTDY6IV3.js +360 -0
  24. package/dist/fal_ai-OCUENLNQ.js +405 -0
  25. package/dist/feishu-5CWBQ7E5.js +225 -0
  26. package/dist/feishu_custom_bot-ZJR22OK6.js +240 -0
  27. package/dist/figma-YULGANSA.js +798 -0
  28. package/dist/firehydrant-2V6YSYAP.js +573 -0
  29. package/dist/fixer-LTCDB3CJ.js +171 -0
  30. package/dist/fly-IXPKMAML.js +478 -0
  31. package/dist/front-KRFB4M5X.js +379 -0
  32. package/dist/geocodio-VVURKYHQ.js +236 -0
  33. package/dist/ghost-6J2RIOUB.js +341 -0
  34. package/dist/github-5Z6KQRYH.js +5410 -0
  35. package/dist/gmail-KU4NZ7VA.js +1894 -0
  36. package/dist/googlecalendar-X44DFFXG.js +2539 -0
  37. package/dist/googledocs-WSGLPKSF.js +1322 -0
  38. package/dist/grafana-4PKSSDXY.js +817 -0
  39. package/dist/graphhopper-DF65ZNGK.js +336 -0
  40. package/dist/index.d.ts +181 -2
  41. package/dist/index.js +2 -1
  42. package/dist/ip2proxy-UCAQ5P2J.js +118 -0
  43. package/dist/ipgeolocation_io-UX6FCA2S.js +333 -0
  44. package/dist/ipqualityscore-MKTRXIZJ.js +287 -0
  45. package/dist/jina_ai-MRHPCSV5.js +119 -0
  46. package/dist/jira-EG7ZPOIW.js +627 -0
  47. package/dist/langsmith-FNO3RCOZ.js +597 -0
  48. package/dist/lemlist-SN6BJHSG.js +298 -0
  49. package/dist/linear-H3VU4PSD.js +2163 -0
  50. package/dist/logsnag-OY2JJT2H.js +167 -0
  51. package/dist/main.js +246 -2
  52. package/dist/mattermost-C5SQ7PGD.js +320 -0
  53. package/dist/mem0-LMLE5BFC.js +567 -0
  54. package/dist/memos-UWFAMBZC.js +781 -0
  55. package/dist/metabase-SRYDSDJ6.js +365 -0
  56. package/dist/mistral_ai-YNIJ7VDM.js +1195 -0
  57. package/dist/mother_duck-CPGOFEXE.js +322 -0
  58. package/dist/ngrok-CDJFBSOM.js +375 -0
  59. package/dist/notes-DIVFH3P3.js +109 -0
  60. package/dist/notion-HGDKS4HK.js +945 -0
  61. package/dist/open_exchange_rates-COHHYJDD.js +216 -0
  62. package/dist/openai-4TRT66GW.js +795 -0
  63. package/dist/opengraph_io-YKVW4PXI.js +377 -0
  64. package/dist/openrouter-6CV7B7V5.js +444 -0
  65. package/dist/outline-YWDUK5F7.js +604 -0
  66. package/dist/paddle-MEU7HWDZ.js +464 -0
  67. package/dist/perplexity-MRQUDBIC.js +238 -0
  68. package/dist/pinecone-JI7X2TAF.js +599 -0
  69. package/dist/pipedrive-6JQPAW23.js +453 -0
  70. package/dist/polar-7BF56CMC.js +400 -0
  71. package/dist/posthog-YPU5ADEN.js +3462 -0
  72. package/dist/postmark-BEU5OFKU.js +441 -0
  73. package/dist/prerender-UT5GOOZH.js +180 -0
  74. package/dist/pubmed-3SGOE24Q.js +1052 -0
  75. package/dist/railway-CEK4GLRQ.js +452 -0
  76. package/dist/readwise-DXQUQU67.js +482 -0
  77. package/dist/render-7TGAU5AW.js +473 -0
  78. package/dist/replicate-VICFSQ5A.js +347 -0
  79. package/dist/resend-3E76WK3O.js +100 -0
  80. package/dist/rootly-36GY46BY.js +345 -0
  81. package/dist/scrapfly-VDVUYAHX.js +289 -0
  82. package/dist/scrapingbee-3KTPMAVY.js +247 -0
  83. package/dist/screenshot_fyi-LKG62C3J.js +116 -0
  84. package/dist/semantic_scholar-4WREECYO.js +626 -0
  85. package/dist/sentry-HUQTGXOV.js +1139 -0
  86. package/dist/shodan-SGRKU4KS.js +303 -0
  87. package/dist/shopify-YCZ4L5HT.js +620 -0
  88. package/dist/stripe-OEBKMELB.js +583 -0
  89. package/dist/supabase-I3DBY7L4.js +937 -0
  90. package/dist/tavily-B2YHCNRD.js +349 -0
  91. package/dist/telegram-2VYJELZX.js +1773 -0
  92. package/dist/telnyx-HHXD3CXL.js +237 -0
  93. package/dist/todoist-PHFDEEIS.js +672 -0
  94. package/dist/trello-WUSAK6YN.js +1091 -0
  95. package/dist/turso-FW56U2B3.js +432 -0
  96. package/dist/twilio-M5JI7XHA.js +321 -0
  97. package/dist/umami-HAYODRC4.js +411 -0
  98. package/dist/unsplash-EDPTNEHJ.js +364 -0
  99. package/dist/upstash_redis-GC2CLIWD.js +299 -0
  100. package/dist/uptimerobot-XMSNYLIT.js +481 -0
  101. package/dist/v2ex-KU4ECD65.js +672 -0
  102. package/dist/vercel-THPCEFHW.js +1096 -0
  103. package/dist/wolfram_alpha_api-WHHTH4GU.js +212 -0
  104. package/dist/wordpress-O6TQEQNF.js +822 -0
  105. package/dist/workos-A3VHHWI3.js +681 -0
  106. package/dist/zhihu-BJAI64YJ.js +273 -0
  107. package/package.json +5 -4
@@ -0,0 +1,1139 @@
1
+ import {
2
+ createProviderPlugin,
3
+ guardedFetch,
4
+ requireApiKey,
5
+ upstreamError
6
+ } from "./chunk-CSJEZHQO.js";
7
+ import "./chunk-K7FVSFUX.js";
8
+ import {
9
+ TBError,
10
+ external_exports
11
+ } from "./chunk-JLTYA2B3.js";
12
+ import "./chunk-MLKGABMK.js";
13
+
14
+ // ../plugins/src/sentry/api.ts
15
+ var SERVICE = "sentry";
16
+ var API_BASE = "https://sentry.io/api/0/";
17
+ function record(value) {
18
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
19
+ }
20
+ function str(value) {
21
+ return typeof value === "string" ? value : void 0;
22
+ }
23
+ function nullableStr(value) {
24
+ return typeof value === "string" ? value : null;
25
+ }
26
+ function nonEmpty(value) {
27
+ return typeof value === "string" && value.trim().length > 0;
28
+ }
29
+ function pickStr(...values) {
30
+ for (const value of values) {
31
+ if (nonEmpty(value)) return value;
32
+ }
33
+ return void 0;
34
+ }
35
+ function nullableInt(value) {
36
+ if (value === null || value === void 0 || value === "") return null;
37
+ const parsed = Number(value);
38
+ return Number.isInteger(parsed) ? parsed : null;
39
+ }
40
+ function bool(value) {
41
+ return value === true;
42
+ }
43
+ function strArray(value) {
44
+ if (!Array.isArray(value)) return [];
45
+ return value.filter((item) => typeof item === "string");
46
+ }
47
+ function nullableStrArray(value) {
48
+ return value === null ? null : strArray(value);
49
+ }
50
+ function arrayValue(value) {
51
+ return Array.isArray(value) ? value : [];
52
+ }
53
+ function compact(value) {
54
+ return Object.fromEntries(Object.entries(value).filter(([, child]) => child !== void 0));
55
+ }
56
+ function expectRecord(value, label) {
57
+ const body = record(value);
58
+ if (body === void 0) throw new TBError("unavailable", `Sentry ${label} \u54CD\u5E94\u5F62\u72B6\u4E0D\u7B26`, { retryable: true });
59
+ return body;
60
+ }
61
+ function expectArray(value, label) {
62
+ if (!Array.isArray(value)) {
63
+ throw new TBError("unavailable", `Sentry ${label} \u54CD\u5E94\u4E0D\u662F\u6570\u7EC4`, { retryable: true });
64
+ }
65
+ return value;
66
+ }
67
+ function oneZero(value) {
68
+ return value === void 0 ? void 0 : value ? "1" : "0";
69
+ }
70
+ function joinClauses(...clauses) {
71
+ const kept = clauses.filter((clause) => nonEmpty(clause));
72
+ return kept.length > 0 ? kept.join(" ") : void 0;
73
+ }
74
+ function buildUrl(path, query) {
75
+ const url = new URL(path, API_BASE);
76
+ for (const [key, value] of Object.entries(query ?? {})) {
77
+ if (value === void 0) continue;
78
+ if (Array.isArray(value)) {
79
+ for (const item of value) url.searchParams.append(key, String(item));
80
+ continue;
81
+ }
82
+ url.searchParams.set(key, String(value));
83
+ }
84
+ return url.toString();
85
+ }
86
+ function errorMessage(payload, status) {
87
+ const body = record(payload);
88
+ const nested = str(record(body?.detail)?.message);
89
+ return pickStr(body?.error_description, body?.detail, body?.error, body?.message) ?? (nonEmpty(nested) ? nested : void 0) ?? `Sentry \u8FD4\u56DE HTTP ${status}`;
90
+ }
91
+ async function readJson(response) {
92
+ if (!(response.headers.get("content-type") ?? "").includes("application/json")) return null;
93
+ try {
94
+ return await response.json();
95
+ } catch {
96
+ return null;
97
+ }
98
+ }
99
+ async function request(ctx, path, options = {}) {
100
+ const token = requireApiKey(ctx, SERVICE);
101
+ const headers = {
102
+ accept: "application/json",
103
+ authorization: `Bearer ${token}`
104
+ };
105
+ if (options.body !== void 0) headers["content-type"] = "application/json";
106
+ let response;
107
+ try {
108
+ response = await guardedFetch(buildUrl(path, options.query), {
109
+ method: options.method ?? "GET",
110
+ headers,
111
+ ...options.body === void 0 ? {} : { body: JSON.stringify(options.body) }
112
+ });
113
+ } catch (error) {
114
+ if (error instanceof TBError) throw error;
115
+ throw upstreamError(502, `Sentry \u8BF7\u6C42\u5931\u8D25:${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`);
116
+ }
117
+ const payload = await readJson(response);
118
+ if (!response.ok) throw upstreamError(response.status, errorMessage(payload, response.status));
119
+ return { payload, headers: response.headers };
120
+ }
121
+ function splitLinkHeader(value) {
122
+ const entries = [];
123
+ let current = "";
124
+ let inQuotes = false;
125
+ let inAngles = false;
126
+ for (const char of value) {
127
+ if (char === '"') {
128
+ inQuotes = !inQuotes;
129
+ current += char;
130
+ continue;
131
+ }
132
+ if (!inQuotes) {
133
+ if (char === "<") inAngles = true;
134
+ else if (char === ">") inAngles = false;
135
+ else if (char === "," && !inAngles) {
136
+ if (current.trim() !== "") entries.push(current.trim());
137
+ current = "";
138
+ continue;
139
+ }
140
+ }
141
+ current += char;
142
+ }
143
+ if (current.trim() !== "") entries.push(current.trim());
144
+ return entries;
145
+ }
146
+ function linkCursor(entry) {
147
+ const direct = /\bcursor="([^"]*)"/.exec(entry)?.[1];
148
+ if (nonEmpty(direct)) return direct;
149
+ const urlString = /<([^>]*)>/.exec(entry)?.[1];
150
+ if (!nonEmpty(urlString)) return null;
151
+ try {
152
+ return new URL(urlString).searchParams.get("cursor");
153
+ } catch {
154
+ return null;
155
+ }
156
+ }
157
+ function cursors(headers) {
158
+ const result = { nextCursor: null, previousCursor: null };
159
+ const header = headers.get("link");
160
+ if (!nonEmpty(header)) return result;
161
+ for (const entry of splitLinkHeader(header)) {
162
+ const rel = /\brel="([^"]+)"/.exec(entry)?.[1];
163
+ if (rel !== "next" && rel !== "previous") continue;
164
+ if (/\bresults="([^"]+)"/.exec(entry)?.[1] === "false") continue;
165
+ const cursor = linkCursor(entry);
166
+ if (cursor === null) continue;
167
+ if (rel === "next") result.nextCursor = cursor;
168
+ else result.previousCursor = cursor;
169
+ }
170
+ return result;
171
+ }
172
+ function normalizeSetupDialog(value) {
173
+ const body = record(value);
174
+ if (body === void 0) return null;
175
+ return { url: nullableStr(body.url), width: nullableInt(body.width), height: nullableInt(body.height) };
176
+ }
177
+ function normalizeProviderMetadata(value) {
178
+ const body = record(value);
179
+ if (body === void 0) return null;
180
+ return {
181
+ noun: nullableStr(body.noun),
182
+ author: nullableStr(body.author),
183
+ description: nullableStr(body.description),
184
+ // Sentry 同一字段在不同端点上 camelCase 与 snake_case 混用,两种都收。
185
+ issueUrl: nullableStr(body.issueUrl ?? body.issue_url),
186
+ sourceUrl: nullableStr(body.sourceUrl ?? body.source_url),
187
+ aspects: record(body.aspects) ?? null,
188
+ features: arrayValue(body.features)
189
+ };
190
+ }
191
+ function normalizeIntegrationProvider(value) {
192
+ const body = expectRecord(value, "integration provider");
193
+ return {
194
+ key: str(body.key) ?? "",
195
+ slug: str(body.slug) ?? "",
196
+ name: str(body.name) ?? "",
197
+ canAdd: bool(body.canAdd),
198
+ canDisable: bool(body.canDisable),
199
+ features: strArray(body.features),
200
+ aspects: record(body.aspects) ?? {},
201
+ metadata: normalizeProviderMetadata(body.metadata),
202
+ setupDialog: normalizeSetupDialog(body.setupDialog)
203
+ };
204
+ }
205
+ function normalizeOrganizationIntegration(value) {
206
+ const body = expectRecord(value, "integration");
207
+ return {
208
+ id: str(body.id) ?? "",
209
+ name: str(body.name) ?? "",
210
+ icon: nullableStr(body.icon),
211
+ domainName: nullableStr(body.domainName),
212
+ accountType: nullableStr(body.accountType),
213
+ scopes: nullableStrArray(body.scopes),
214
+ status: nullableStr(body.status),
215
+ provider: normalizeIntegrationProvider(body.provider),
216
+ configOrganization: arrayValue(body.configOrganization),
217
+ configData: record(body.configData ?? body.config_data) ?? {},
218
+ externalId: nullableStr(body.externalId),
219
+ organizationId: nullableInt(body.organizationId),
220
+ organizationIntegrationStatus: nullableStr(body.organizationIntegrationStatus),
221
+ gracePeriodEnd: nullableStr(body.gracePeriodEnd)
222
+ };
223
+ }
224
+ function normalizeSentryAppOwner(value) {
225
+ const body = record(value);
226
+ if (body === void 0) return null;
227
+ return { id: nullableInt(body.id), slug: nullableStr(body.slug) };
228
+ }
229
+ function normalizeSentryAppAvatars(value) {
230
+ if (!Array.isArray(value)) return [];
231
+ return value.flatMap((item) => {
232
+ const body = record(item);
233
+ if (body === void 0) return [];
234
+ return [{
235
+ avatarType: str(body.avatarType) ?? "",
236
+ avatarUuid: str(body.avatarUuid) ?? "",
237
+ avatarUrl: str(body.avatarUrl) ?? "",
238
+ color: bool(body.color),
239
+ photoType: str(body.photoType) ?? ""
240
+ }];
241
+ });
242
+ }
243
+ function normalizeSentryApp(value) {
244
+ const body = expectRecord(value, "app");
245
+ return {
246
+ name: str(body.name) ?? "",
247
+ slug: str(body.slug) ?? "",
248
+ uuid: str(body.uuid) ?? "",
249
+ owner: normalizeSentryAppOwner(body.owner),
250
+ author: nullableStr(body.author),
251
+ events: strArray(body.events),
252
+ schema: body.schema ?? null,
253
+ scopes: strArray(body.scopes),
254
+ status: str(body.status) ?? "",
255
+ avatars: normalizeSentryAppAvatars(body.avatars),
256
+ clientId: nullableStr(body.clientId),
257
+ metadata: body.metadata ?? null,
258
+ overview: nullableStr(body.overview),
259
+ popularity: nullableInt(body.popularity),
260
+ webhookUrl: nullableStr(body.webhookUrl),
261
+ featureData: arrayValue(body.featureData),
262
+ isAlertable: bool(body.isAlertable),
263
+ redirectUrl: nullableStr(body.redirectUrl),
264
+ // 只透出"有没有",**不透出 clientSecret 本身** —— Sentry App 的 client secret
265
+ // 是另一套凭证,让它经工具出参流到 agent 的上下文里就是一次凭证外泄。
266
+ hasClientSecret: nonEmpty(body.clientSecret),
267
+ verifyInstall: bool(body.verifyInstall),
268
+ allowedOrigins: strArray(body.allowedOrigins)
269
+ };
270
+ }
271
+ function normalizeTeam(value) {
272
+ const body = record(value);
273
+ if (body === void 0) return null;
274
+ return { id: nullableStr(body.id), slug: nullableStr(body.slug), name: nullableStr(body.name) };
275
+ }
276
+ function normalizeTeams(value) {
277
+ if (!Array.isArray(value)) return [];
278
+ return value.flatMap((item) => {
279
+ const team = normalizeTeam(item);
280
+ return team === null ? [] : [team];
281
+ });
282
+ }
283
+ function normalizeProject(value) {
284
+ const body = expectRecord(value, "project");
285
+ return {
286
+ id: str(body.id) ?? "",
287
+ slug: str(body.slug) ?? "",
288
+ name: str(body.name) ?? "",
289
+ platform: nullableStr(body.platform),
290
+ status: nullableStr(body.status),
291
+ dateCreated: nullableStr(body.dateCreated),
292
+ isBookmarked: bool(body.isBookmarked),
293
+ isMember: bool(body.isMember),
294
+ hasAccess: bool(body.hasAccess),
295
+ features: strArray(body.features),
296
+ environments: strArray(body.environments),
297
+ team: normalizeTeam(body.team),
298
+ teams: normalizeTeams(body.teams)
299
+ };
300
+ }
301
+ function normalizeProjectSummary(value) {
302
+ const body = record(value);
303
+ if (body === void 0) return null;
304
+ return {
305
+ id: str(body.id) ?? "",
306
+ slug: str(body.slug) ?? "",
307
+ name: str(body.name) ?? "",
308
+ platform: nullableStr(body.platform)
309
+ };
310
+ }
311
+ function normalizeIssueActor(value) {
312
+ const body = record(value);
313
+ if (body === void 0) return null;
314
+ return {
315
+ id: nullableStr(body.id),
316
+ type: nullableStr(body.type),
317
+ name: nullableStr(body.name),
318
+ email: nullableStr(body.email),
319
+ username: nullableStr(body.username)
320
+ };
321
+ }
322
+ function normalizeIssueStatusDetails(value) {
323
+ const body = record(value);
324
+ if (body === void 0) return null;
325
+ const inNextRelease = body.inNextRelease ?? body.in_next_release;
326
+ return {
327
+ inRelease: nullableStr(body.inRelease ?? body.in_release),
328
+ inCommit: nullableStr(body.inCommit ?? body.in_commit),
329
+ inNextRelease: typeof inNextRelease === "boolean" ? inNextRelease : null
330
+ };
331
+ }
332
+ function normalizeIssueTags(value) {
333
+ if (!Array.isArray(value)) return [];
334
+ return value.flatMap((item) => {
335
+ const body = record(item);
336
+ if (body === void 0 || !nonEmpty(body.key)) return [];
337
+ return [{ key: body.key, name: nullableStr(body.name), value: nullableStr(body.value) }];
338
+ });
339
+ }
340
+ function normalizeIssue(value) {
341
+ const body = expectRecord(value, "issue");
342
+ return {
343
+ id: str(body.id) ?? "",
344
+ shortId: nullableStr(body.shortId),
345
+ title: nullableStr(body.title),
346
+ culprit: nullableStr(body.culprit),
347
+ level: nullableStr(body.level),
348
+ status: nullableStr(body.status),
349
+ // `count` 上游就是**字符串**(Sentry 回的是 "42"),别顺手改成数字。
350
+ count: nullableStr(body.count),
351
+ userCount: nullableInt(body.userCount),
352
+ firstSeen: nullableStr(body.firstSeen),
353
+ lastSeen: nullableStr(body.lastSeen),
354
+ permalink: nullableStr(body.permalink),
355
+ logger: nullableStr(body.logger),
356
+ isBookmarked: bool(body.isBookmarked),
357
+ isSubscribed: bool(body.isSubscribed),
358
+ hasSeen: bool(body.hasSeen),
359
+ isPublic: bool(body.isPublic),
360
+ project: normalizeProjectSummary(body.project),
361
+ assignedTo: normalizeIssueActor(body.assignedTo),
362
+ statusDetails: normalizeIssueStatusDetails(body.statusDetails),
363
+ metadata: body.metadata ?? null,
364
+ stats: body.stats ?? null,
365
+ tags: normalizeIssueTags(body.tags)
366
+ };
367
+ }
368
+ function normalizeEventUser(value) {
369
+ const body = record(value);
370
+ if (body === void 0) return null;
371
+ return {
372
+ id: nullableStr(body.id),
373
+ email: nullableStr(body.email),
374
+ username: nullableStr(body.username),
375
+ ipAddress: nullableStr(body.ipAddress ?? body.ip_address ?? body.ip),
376
+ name: nullableStr(body.name)
377
+ };
378
+ }
379
+ function normalizeEventTags(value) {
380
+ if (!Array.isArray(value)) return [];
381
+ return value.flatMap((item) => {
382
+ const body = record(item);
383
+ if (body === void 0 || !nonEmpty(body.key) || !nonEmpty(body.value)) return [];
384
+ return [{ key: body.key, value: body.value }];
385
+ });
386
+ }
387
+ function normalizeIssueEvent(value) {
388
+ const body = expectRecord(value, "issue event");
389
+ return {
390
+ // Sentry 的事件 id 在列表与详情上分别叫 `id` 与 `eventID`,两种都收。
391
+ id: str(body.id) ?? str(body.eventID) ?? "",
392
+ eventId: nullableStr(body.eventID ?? body.eventId),
393
+ issueId: nullableStr(body.groupID ?? body.groupId),
394
+ title: nullableStr(body.title),
395
+ message: nullableStr(body.message),
396
+ platform: nullableStr(body.platform),
397
+ dateCreated: nullableStr(body.dateCreated),
398
+ user: normalizeEventUser(body.user),
399
+ tags: normalizeEventTags(body.tags)
400
+ };
401
+ }
402
+ function normalizeReleaseProjects(value) {
403
+ if (!Array.isArray(value)) return [];
404
+ return value.flatMap((item) => {
405
+ const body = record(item);
406
+ if (body === void 0) return [];
407
+ return [{ id: nullableInt(body.id), slug: nullableStr(body.slug), name: nullableStr(body.name) }];
408
+ });
409
+ }
410
+ function normalizeRelease(value) {
411
+ const body = expectRecord(value, "release");
412
+ return {
413
+ version: str(body.version) ?? "",
414
+ shortVersion: nullableStr(body.shortVersion),
415
+ status: nullableStr(body.status),
416
+ dateCreated: nullableStr(body.dateCreated),
417
+ dateReleased: nullableStr(body.dateReleased),
418
+ ref: nullableStr(body.ref),
419
+ url: nullableStr(body.url),
420
+ newGroups: nullableInt(body.newGroups),
421
+ projects: normalizeReleaseProjects(body.projects),
422
+ lastCommit: body.lastCommit ?? body.last_commit ?? null,
423
+ lastDeploy: body.lastDeploy ?? body.last_deploy ?? null,
424
+ healthData: body.healthData ?? body.health_data ?? null,
425
+ stats: body.stats ?? null
426
+ };
427
+ }
428
+ function normalizeHealthGroups(value) {
429
+ if (!Array.isArray(value)) return [];
430
+ return value.flatMap((item) => {
431
+ const body = record(item);
432
+ if (body === void 0) return [];
433
+ return [{ by: record(body.by) ?? {}, totals: record(body.totals) ?? {}, series: record(body.series) ?? null }];
434
+ });
435
+ }
436
+ function normalizeReplayUser(value) {
437
+ const body = record(value);
438
+ if (body === void 0) return null;
439
+ return {
440
+ id: nullableStr(body.id),
441
+ email: nullableStr(body.email),
442
+ username: nullableStr(body.username),
443
+ ip: nullableStr(body.ip ?? body.ipAddress ?? body.ip_address)
444
+ };
445
+ }
446
+ function normalizeNamedValue(value) {
447
+ const body = record(value);
448
+ if (body === void 0) return null;
449
+ return { name: nullableStr(body.name), version: nullableStr(body.version) };
450
+ }
451
+ function normalizeReplayReleases(value) {
452
+ if (!Array.isArray(value)) return [];
453
+ return value.flatMap((item) => {
454
+ if (typeof item === "string") return [item];
455
+ const version = str(record(item)?.version);
456
+ return version === void 0 ? [] : [version];
457
+ });
458
+ }
459
+ function normalizeReplay(value) {
460
+ const body = expectRecord(value, "replay");
461
+ return {
462
+ id: str(body.id) ?? "",
463
+ projectId: nullableInt(body.projectId ?? body.project_id),
464
+ environment: nullableStr(body.environment),
465
+ platform: nullableStr(body.platform),
466
+ startedAt: nullableStr(body.startedAt ?? body.started_at),
467
+ finishedAt: nullableStr(body.finishedAt ?? body.finished_at),
468
+ duration: nullableInt(body.duration),
469
+ countErrors: nullableInt(body.countErrors ?? body.count_errors),
470
+ countRageClicks: nullableInt(body.countRageClicks ?? body.count_rage_clicks),
471
+ countDeadClicks: nullableInt(body.countDeadClicks ?? body.count_dead_clicks),
472
+ countSegments: nullableInt(body.countSegments ?? body.count_segments),
473
+ user: normalizeReplayUser(body.user),
474
+ browser: normalizeNamedValue(body.browser),
475
+ os: normalizeNamedValue(body.os),
476
+ device: normalizeNamedValue(body.device),
477
+ releases: normalizeReplayReleases(body.releases)
478
+ };
479
+ }
480
+ function normalizeCreatedBy(value) {
481
+ if (typeof value === "string") return value;
482
+ const body = record(value);
483
+ if (body === void 0) return null;
484
+ return nullableStr(body.id ?? body.email ?? body.username);
485
+ }
486
+ function normalizeAlertTrigger(value) {
487
+ const body = record(value);
488
+ if (body === void 0) return null;
489
+ return {
490
+ id: nullableStr(body.id),
491
+ logicType: nullableStr(body.logicType),
492
+ actions: body.actions ?? null,
493
+ conditions: body.conditions ?? null,
494
+ organizationId: nullableStr(body.organizationId ?? body.organization_id)
495
+ };
496
+ }
497
+ function normalizeAlertActionFilters(value) {
498
+ if (!Array.isArray(value)) return [];
499
+ return value.flatMap((item) => {
500
+ const body = record(item);
501
+ if (body === void 0) return [];
502
+ return [{
503
+ id: nullableStr(body.id),
504
+ actions: body.actions ?? null,
505
+ logicType: nullableStr(body.logicType),
506
+ conditions: body.conditions ?? null,
507
+ organizationId: nullableStr(body.organizationId ?? body.organization_id)
508
+ }];
509
+ });
510
+ }
511
+ function normalizeAlert(value) {
512
+ const body = expectRecord(value, "alert");
513
+ return {
514
+ id: str(body.id) ?? "",
515
+ name: str(body.name) ?? "",
516
+ organizationId: nullableStr(body.organizationId ?? body.organization_id),
517
+ enabled: bool(body.enabled),
518
+ createdBy: normalizeCreatedBy(body.createdBy),
519
+ dateCreated: nullableStr(body.dateCreated),
520
+ dateUpdated: nullableStr(body.dateUpdated),
521
+ environment: nullableStr(body.environment),
522
+ lastTriggered: nullableStr(body.lastTriggered),
523
+ detectorIds: strArray(body.detectorIds),
524
+ config: record(body.config) ?? {},
525
+ triggers: normalizeAlertTrigger(body.triggers),
526
+ actionFilters: normalizeAlertActionFilters(body.actionFilters)
527
+ };
528
+ }
529
+ function unwrapWorkflowList(payload) {
530
+ if (Array.isArray(payload)) return payload;
531
+ const body = record(payload);
532
+ if (body === void 0 || !Array.isArray(body.data)) {
533
+ throw new TBError("unavailable", "Sentry alerts \u54CD\u5E94\u5F62\u72B6\u4E0D\u7B26", { retryable: true });
534
+ }
535
+ return body.data;
536
+ }
537
+ function unwrapWorkflowItem(payload) {
538
+ const body = record(payload);
539
+ return body !== void 0 && "data" in body ? body.data : payload;
540
+ }
541
+ function seg(value) {
542
+ return encodeURIComponent(value);
543
+ }
544
+ async function listOrganizationIntegrations(input, ctx) {
545
+ const { payload } = await request(ctx, `organizations/${seg(input.organizationIdOrSlug)}/integrations/`, {
546
+ query: compact({
547
+ providerKey: input.providerKey,
548
+ includeConfig: input.includeConfig,
549
+ features: input.features
550
+ })
551
+ });
552
+ return { integrations: expectArray(payload, "integrations").map(normalizeOrganizationIntegration) };
553
+ }
554
+ async function getOrganizationIntegration(input, ctx) {
555
+ const path = `organizations/${seg(input.organizationIdOrSlug)}/integrations/${seg(input.integrationId)}/`;
556
+ const { payload } = await request(ctx, path);
557
+ return { integration: normalizeOrganizationIntegration(payload) };
558
+ }
559
+ async function getOrganizationIntegrationConfig(input, ctx) {
560
+ const { payload } = await request(ctx, `organizations/${seg(input.organizationIdOrSlug)}/config/integrations/`, {
561
+ query: { providerKey: input.providerKey }
562
+ });
563
+ const body = expectRecord(payload, "integration config");
564
+ if (!Array.isArray(body.providers)) {
565
+ throw new TBError("unavailable", "Sentry integration config \u54CD\u5E94\u7F3A providers", { retryable: true });
566
+ }
567
+ return { providers: body.providers.map(normalizeIntegrationProvider) };
568
+ }
569
+ async function listOrganizationSentryApps(input, ctx) {
570
+ const { payload } = await request(ctx, `organizations/${seg(input.organizationIdOrSlug)}/sentry-apps/`);
571
+ return { sentryApps: expectArray(payload, "apps").map(normalizeSentryApp) };
572
+ }
573
+ async function getSentryApp(input, ctx) {
574
+ const { payload } = await request(ctx, `sentry-apps/${seg(input.sentryAppIdOrSlug)}/`);
575
+ return { sentryApp: normalizeSentryApp(payload) };
576
+ }
577
+ async function listOrganizationProjects(input, ctx) {
578
+ const { payload, headers } = await request(ctx, `organizations/${seg(input.organizationIdOrSlug)}/projects/`, {
579
+ query: { cursor: input.cursor }
580
+ });
581
+ return {
582
+ projects: expectArray(payload, "projects").map(normalizeProject),
583
+ ...cursors(headers)
584
+ };
585
+ }
586
+ async function getProject(input, ctx) {
587
+ const { payload } = await request(ctx, `projects/${seg(input.organizationIdOrSlug)}/${seg(input.projectIdOrSlug)}/`);
588
+ return { project: normalizeProject(payload) };
589
+ }
590
+ async function listOrganizationIssues(input, ctx) {
591
+ const { payload, headers } = await request(ctx, `organizations/${seg(input.organizationIdOrSlug)}/issues/`, {
592
+ query: {
593
+ query: input.query,
594
+ sort: input.sort,
595
+ limit: input.limit,
596
+ start: input.start,
597
+ end: input.end,
598
+ cursor: input.cursor,
599
+ expand: input.expand,
600
+ collapse: input.collapse,
601
+ // 入参名是复数 `environments` / `projectIds`,线上是单数 `environment` / `project`。
602
+ environment: input.environments,
603
+ project: input.projectIds,
604
+ statsPeriod: input.statsPeriod,
605
+ // Sentry 这个参数只认 1/0,给 true/false 会被当成"没传"。
606
+ shortIdLookup: oneZero(input.shortIdLookup),
607
+ groupStatsPeriod: input.groupStatsPeriod,
608
+ viewId: input.viewId
609
+ }
610
+ });
611
+ return {
612
+ issues: expectArray(payload, "issues").map(normalizeIssue),
613
+ ...cursors(headers)
614
+ };
615
+ }
616
+ async function getIssue(input, ctx) {
617
+ const path = `organizations/${seg(input.organizationIdOrSlug)}/issues/${seg(input.issueId)}/`;
618
+ const { payload } = await request(ctx, path);
619
+ return { issue: normalizeIssue(payload) };
620
+ }
621
+ async function getIssueEvent(input, ctx) {
622
+ const path = `organizations/${seg(input.organizationIdOrSlug)}/issues/${seg(input.issueId)}/events/${seg(input.eventId)}/`;
623
+ const { payload } = await request(ctx, path, { query: { environment: input.environments } });
624
+ return { event: normalizeIssueEvent(payload) };
625
+ }
626
+ async function listIssueEvents(input, ctx) {
627
+ const path = `organizations/${seg(input.organizationIdOrSlug)}/issues/${seg(input.issueId)}/events/`;
628
+ const { payload } = await request(ctx, path, {
629
+ query: {
630
+ full: input.full,
631
+ sample: input.sample,
632
+ query: input.query,
633
+ start: input.start,
634
+ end: input.end,
635
+ environment: input.environments,
636
+ statsPeriod: input.statsPeriod
637
+ }
638
+ });
639
+ return { events: expectArray(payload, "issue events").map(normalizeIssueEvent) };
640
+ }
641
+ async function updateIssue(input, ctx) {
642
+ const details = input.statusDetails === void 0 ? void 0 : compact({ ...input.statusDetails });
643
+ const { payload } = await request(ctx, `organizations/${seg(input.organizationIdOrSlug)}/issues/${seg(input.issueId)}/`, {
644
+ method: "PUT",
645
+ body: compact({
646
+ status: input.status,
647
+ hasSeen: input.hasSeen,
648
+ isPublic: input.isPublic,
649
+ // 空串是**取消指派**的正规写法(不是"没给值"),故这里不能用 `text()` 过滤掉它。
650
+ assignedTo: input.assignedTo,
651
+ isBookmarked: input.isBookmarked,
652
+ isSubscribed: input.isSubscribed,
653
+ statusDetails: details
654
+ })
655
+ });
656
+ return { issue: normalizeIssue(payload) };
657
+ }
658
+ async function listOrganizationReleases(input, ctx) {
659
+ const { payload } = await request(ctx, `organizations/${seg(input.organizationIdOrSlug)}/releases/`, {
660
+ query: { query: input.query }
661
+ });
662
+ return { releases: expectArray(payload, "releases").map(normalizeRelease) };
663
+ }
664
+ async function getOrganizationRelease(input, ctx) {
665
+ const path = `organizations/${seg(input.organizationIdOrSlug)}/releases/${seg(input.version)}/`;
666
+ const { payload } = await request(ctx, path, {
667
+ query: compact({
668
+ sort: input.sort,
669
+ query: input.query,
670
+ health: input.health,
671
+ status: input.status,
672
+ // 入参叫 projectId,线上参数名是 project。
673
+ project: input.projectId,
674
+ adoptionStages: input.adoptionStages,
675
+ healthStatsPeriod: input.healthStatsPeriod,
676
+ summaryStatsPeriod: input.summaryStatsPeriod
677
+ })
678
+ });
679
+ return { release: normalizeRelease(payload) };
680
+ }
681
+ async function getReleaseHealthStats(input, ctx) {
682
+ const { payload } = await request(ctx, `organizations/${seg(input.organizationIdOrSlug)}/sessions/`, {
683
+ query: {
684
+ field: input.fields,
685
+ groupBy: input.groupBy,
686
+ query: joinClauses(`release:${input.version}`, input.query),
687
+ start: input.start,
688
+ end: input.end,
689
+ environment: input.environments,
690
+ project: input.projectIds,
691
+ interval: input.interval,
692
+ statsPeriod: input.statsPeriod,
693
+ includeSeries: input.includeSeries,
694
+ includeTotals: input.includeTotals,
695
+ // 这一个是 snake_case,同一个端点上与 camelCase 参数混着用。
696
+ per_page: input.perPage,
697
+ orderBy: input.orderBy
698
+ }
699
+ });
700
+ const body = expectRecord(payload, "release health stats");
701
+ return {
702
+ groups: normalizeHealthGroups(body.groups),
703
+ intervals: strArray(body.intervals),
704
+ start: nullableStr(body.start),
705
+ end: nullableStr(body.end)
706
+ };
707
+ }
708
+ async function listOrganizationReplays(input, ctx) {
709
+ const { payload, headers } = await request(ctx, `organizations/${seg(input.organizationIdOrSlug)}/replays/`, {
710
+ query: {
711
+ start: input.start,
712
+ end: input.end,
713
+ sort: input.sort,
714
+ field: input.field,
715
+ query: input.query,
716
+ cursor: input.cursor,
717
+ project: input.projectIds,
718
+ per_page: input.perPage,
719
+ environment: input.environment,
720
+ statsPeriod: input.statsPeriod
721
+ }
722
+ });
723
+ return {
724
+ replays: expectArray(payload, "replays").map(normalizeReplay),
725
+ ...cursors(headers)
726
+ };
727
+ }
728
+ async function getReplay(input, ctx) {
729
+ const path = `organizations/${seg(input.organizationIdOrSlug)}/replays/${seg(input.replayId)}/`;
730
+ const { payload, headers } = await request(ctx, path, {
731
+ query: {
732
+ start: input.start,
733
+ end: input.end,
734
+ sort: input.sort,
735
+ field: input.field,
736
+ query: input.query,
737
+ cursor: input.cursor,
738
+ project: input.projectIds,
739
+ per_page: input.perPage,
740
+ environment: input.environment,
741
+ statsPeriod: input.statsPeriod
742
+ }
743
+ });
744
+ return { replay: normalizeReplay(payload), ...cursors(headers) };
745
+ }
746
+ async function listAlerts(input, ctx) {
747
+ const { payload } = await request(ctx, `organizations/${seg(input.organizationIdOrSlug)}/workflows/`, {
748
+ query: {
749
+ // 入参叫 ids,线上参数名是单数 id(可重复)。
750
+ id: input.ids,
751
+ query: input.query,
752
+ sortBy: input.sortBy,
753
+ project: input.projectIds
754
+ }
755
+ });
756
+ return { alerts: unwrapWorkflowList(payload).map(normalizeAlert) };
757
+ }
758
+ async function getAlert(input, ctx) {
759
+ const path = `organizations/${seg(input.organizationIdOrSlug)}/workflows/${seg(input.alertId)}/`;
760
+ const { payload } = await request(ctx, path);
761
+ return { alert: normalizeAlert(unwrapWorkflowItem(payload)) };
762
+ }
763
+
764
+ // ../plugins/src/sentry/schema.ts
765
+ var listOrganizationIntegrationsInput = external_exports.strictObject({
766
+ organizationIdOrSlug: external_exports.string().min(1).describe("The Sentry organization id or slug whose installed integrations should be listed."),
767
+ providerKey: external_exports.string().min(1).describe("Optional provider key filter such as slack, github, or jira.").optional(),
768
+ includeConfig: external_exports.boolean().describe("Whether to ask Sentry to include expanded third-party configuration details.").optional(),
769
+ features: external_exports.array(external_exports.string().min(1)).describe("Optional provider feature filters such as alert-rule or issue-sync.").optional()
770
+ }).describe("The input payload for listing installed Sentry integrations.");
771
+ var listOrganizationIntegrationsOutput = external_exports.strictObject({
772
+ integrations: external_exports.array(external_exports.looseObject({}).describe("An installed integration within a Sentry organization.")).describe("The installed integrations returned for the organization.")
773
+ }).describe("Action output.");
774
+ var getOrganizationIntegrationInput = external_exports.strictObject({
775
+ organizationIdOrSlug: external_exports.string().min(1).describe("The Sentry organization id or slug that owns the integration."),
776
+ integrationId: external_exports.string().min(1).describe("The installed integration id to retrieve.")
777
+ }).describe("The input payload for retrieving an installed Sentry integration.");
778
+ var getOrganizationIntegrationOutput = external_exports.strictObject({
779
+ integration: external_exports.looseObject({}).describe("An installed integration within a Sentry organization.")
780
+ }).describe("Action output.");
781
+ var getOrganizationIntegrationConfigInput = external_exports.strictObject({
782
+ organizationIdOrSlug: external_exports.string().min(1).describe("The Sentry organization id or slug whose integration config should be retrieved."),
783
+ providerKey: external_exports.string().min(1).describe("Optional provider key filter such as slack, github, or jira.").optional()
784
+ }).describe("The input payload for retrieving Sentry integration provider config.");
785
+ var getOrganizationIntegrationConfigOutput = external_exports.strictObject({
786
+ providers: external_exports.array(external_exports.looseObject({}).describe("A Sentry integration provider summary.")).describe("The integration provider configs returned by Sentry.")
787
+ }).describe("Action output.");
788
+ var listOrganizationSentryAppsInput = external_exports.strictObject({
789
+ organizationIdOrSlug: external_exports.string().min(1).describe("The Sentry organization id or slug whose custom Sentry Apps should be listed.")
790
+ }).describe("The input payload for listing organization-owned Sentry Apps.");
791
+ var listOrganizationSentryAppsOutput = external_exports.strictObject({
792
+ sentryApps: external_exports.array(external_exports.looseObject({}).describe("A Sentry App with integration and OAuth settings details.")).describe("The custom Sentry Apps returned for the organization.")
793
+ }).describe("Action output.");
794
+ var getSentryAppInput = external_exports.strictObject({
795
+ sentryAppIdOrSlug: external_exports.string().min(1).describe("The Sentry App id or slug to retrieve from the global Sentry App registry.")
796
+ }).describe("The input payload for retrieving a Sentry App.");
797
+ var getSentryAppOutput = external_exports.strictObject({
798
+ sentryApp: external_exports.looseObject({}).describe("A Sentry App with integration and OAuth settings details.")
799
+ }).describe("Action output.");
800
+ var listOrganizationProjectsInput = external_exports.strictObject({
801
+ organizationIdOrSlug: external_exports.string().min(1).describe("The Sentry organization id or slug whose projects should be listed."),
802
+ cursor: external_exports.string().min(1).describe("The opaque Sentry pagination cursor for the next or previous page.").optional()
803
+ }).describe("The input payload for listing Sentry organization projects.");
804
+ var listOrganizationProjectsOutput = external_exports.strictObject({
805
+ projects: external_exports.array(external_exports.looseObject({}).describe("A Sentry project returned by project list or detail endpoints.")).describe("The projects returned by Sentry."),
806
+ nextCursor: external_exports.string().describe("The opaque Sentry cursor from the Link header for the next page, or null when there are no more results.").nullable(),
807
+ previousCursor: external_exports.string().describe("The opaque Sentry cursor from the Link header for the previous page, or null when there are no earlier results.").nullable()
808
+ }).describe("Action output.");
809
+ var getProjectInput = external_exports.strictObject({
810
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug that owns the project."),
811
+ projectIdOrSlug: external_exports.string().min(1).describe("The Sentry project id or slug to retrieve.")
812
+ }).describe("The input payload for retrieving one Sentry project.");
813
+ var getProjectOutput = external_exports.strictObject({
814
+ project: external_exports.looseObject({}).describe("A Sentry project returned by project list or detail endpoints.")
815
+ }).describe("Action output.");
816
+ var listOrganizationIssuesInput = external_exports.strictObject({
817
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug whose issues should be listed."),
818
+ query: external_exports.string().describe("The Sentry issue search query string used to filter the results.").optional(),
819
+ sort: external_exports.string().describe("The issue sort order such as date, freq, inbox, new, trends, or user.").optional(),
820
+ limit: external_exports.int().min(1).max(100).describe("The maximum number of issues to return in one page.").optional(),
821
+ start: external_exports.string().describe("The inclusive ISO 8601 start time used to filter the issue results.").optional(),
822
+ end: external_exports.string().describe("The inclusive ISO 8601 end time used to filter the issue results.").optional(),
823
+ cursor: external_exports.string().describe("The opaque Sentry pagination cursor for the issue results.").optional(),
824
+ expand: external_exports.array(external_exports.string().min(1)).describe("Additional issue data keys that Sentry should expand in the response.").optional(),
825
+ collapse: external_exports.array(external_exports.string().min(1)).describe("Response sections that Sentry should collapse or omit from the payload.").optional(),
826
+ environments: external_exports.array(external_exports.string().min(1)).describe("The environment names used to filter issues.").optional(),
827
+ projectIds: external_exports.array(external_exports.int().describe("A numeric Sentry project id.")).describe("The numeric Sentry project ids used to filter issues.").optional(),
828
+ statsPeriod: external_exports.string().describe("The relative stats period such as 24h or 7d used for issue statistics.").optional(),
829
+ shortIdLookup: external_exports.boolean().describe("Whether Sentry should parse short issue ids inside the query string.").optional(),
830
+ groupStatsPeriod: external_exports.string().describe("The issue group statistics window such as auto, 24h, or 14d.").optional(),
831
+ viewId: external_exports.string().describe("The Sentry saved view id whose filters should be applied.").optional()
832
+ }).describe("The input payload for listing Sentry organization issues.");
833
+ var listOrganizationIssuesOutput = external_exports.strictObject({
834
+ issues: external_exports.array(external_exports.looseObject({}).describe("A Sentry issue summary or detail payload.")).describe("The issues returned by Sentry."),
835
+ nextCursor: external_exports.string().describe("The opaque Sentry cursor from the Link header for the next page, or null when there are no more results.").nullable(),
836
+ previousCursor: external_exports.string().describe("The opaque Sentry cursor from the Link header for the previous page, or null when there are no earlier results.").nullable()
837
+ }).describe("Action output.");
838
+ var getIssueInput = external_exports.strictObject({
839
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug that owns the issue."),
840
+ issueId: external_exports.string().min(1).describe("The Sentry issue id or short id to retrieve.")
841
+ }).describe("The input payload for retrieving one Sentry issue.");
842
+ var getIssueOutput = external_exports.strictObject({
843
+ issue: external_exports.looseObject({}).describe("A Sentry issue summary or detail payload.")
844
+ }).describe("Action output.");
845
+ var getIssueEventInput = external_exports.strictObject({
846
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug that owns the issue."),
847
+ issueId: external_exports.string().min(1).describe("The Sentry issue id whose event should be retrieved."),
848
+ eventId: external_exports.string().min(1).describe("The event id or selector such as latest, oldest, or recommended."),
849
+ environments: external_exports.array(external_exports.string().min(1)).describe("The environment names used to filter which issue event Sentry selects.").optional()
850
+ }).describe("The input payload for retrieving one event from a Sentry issue.");
851
+ var getIssueEventOutput = external_exports.strictObject({
852
+ event: external_exports.looseObject({}).describe("A normalized event associated with a Sentry issue.")
853
+ }).describe("Action output.");
854
+ var listIssueEventsInput = external_exports.strictObject({
855
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug that owns the issue."),
856
+ issueId: external_exports.string().min(1).describe("The Sentry issue id whose events should be listed."),
857
+ full: external_exports.boolean().describe("Whether Sentry should return full event payloads instead of summaries.").optional(),
858
+ sample: external_exports.boolean().describe("Whether Sentry should return a deterministic sample of issue events.").optional(),
859
+ query: external_exports.string().describe("The Sentry event search query string used to filter issue events.").optional(),
860
+ start: external_exports.string().describe("The inclusive ISO 8601 start time used to filter issue events.").optional(),
861
+ end: external_exports.string().describe("The inclusive ISO 8601 end time used to filter issue events.").optional(),
862
+ environments: external_exports.array(external_exports.string().min(1)).describe("The environment names used to filter issue events.").optional(),
863
+ statsPeriod: external_exports.string().describe("The relative stats period such as 24h or 7d used to filter issue events.").optional()
864
+ }).describe("The input payload for listing events attached to one Sentry issue.");
865
+ var listIssueEventsOutput = external_exports.strictObject({
866
+ events: external_exports.array(external_exports.looseObject({}).describe("A normalized event associated with a Sentry issue.")).describe("The issue events returned by Sentry.")
867
+ }).describe("Action output.");
868
+ var updateIssueInput = external_exports.strictObject({
869
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug that owns the issue."),
870
+ issueId: external_exports.string().min(1).describe("The Sentry issue id to update."),
871
+ status: external_exports.string().describe("The new issue status such as resolved, resolvedInNextRelease, unresolved, or ignored.").optional(),
872
+ hasSeen: external_exports.boolean().describe("Whether the current user has seen the issue after this update.").optional(),
873
+ isPublic: external_exports.boolean().describe("Whether the issue should be visible via a public permalink.").optional(),
874
+ assignedTo: external_exports.string().describe("The assignee actor id, username, or email address; use an empty string to unassign.").optional(),
875
+ isBookmarked: external_exports.boolean().describe("Whether the current user should bookmark the issue after this update.").optional(),
876
+ isSubscribed: external_exports.boolean().describe("Whether the current user should subscribe to issue notifications.").optional(),
877
+ statusDetails: external_exports.strictObject({
878
+ inCommit: external_exports.string().describe("The commit hash associated with the issue resolution.").optional(),
879
+ inRelease: external_exports.string().describe("The release version in which the issue is considered resolved.").optional(),
880
+ inNextRelease: external_exports.boolean().describe("Whether the issue is considered resolved in the next release.").optional()
881
+ }).describe("Additional issue resolution details sent to Sentry.").optional()
882
+ }).describe("The input payload for updating one Sentry issue.");
883
+ var updateIssueOutput = external_exports.strictObject({
884
+ issue: external_exports.looseObject({}).describe("A Sentry issue summary or detail payload.")
885
+ }).describe("Action output.");
886
+ var listOrganizationReleasesInput = external_exports.strictObject({
887
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug whose releases should be listed."),
888
+ query: external_exports.string().describe("An optional release version prefix used to filter the release list.").optional()
889
+ }).describe("The input payload for listing Sentry organization releases.");
890
+ var listOrganizationReleasesOutput = external_exports.strictObject({
891
+ releases: external_exports.array(external_exports.looseObject({}).describe("A Sentry release payload.")).describe("The releases returned by Sentry.")
892
+ }).describe("Action output.");
893
+ var getOrganizationReleaseInput = external_exports.strictObject({
894
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug that owns the release."),
895
+ version: external_exports.string().min(1).describe("The Sentry release version identifier to retrieve."),
896
+ health: external_exports.boolean().describe("Whether Sentry should include release health details in the response.").optional(),
897
+ summaryStatsPeriod: external_exports.string().describe("The relative time period used for release summary statistics.").optional(),
898
+ healthStatsPeriod: external_exports.string().describe("The relative time period used for release health statistics.").optional(),
899
+ adoptionStages: external_exports.boolean().describe("Whether Sentry should include release adoption stage information.").optional(),
900
+ projectId: external_exports.string().describe("An optional project id used to scope the release details.").optional(),
901
+ query: external_exports.string().describe("An optional Sentry query string used to filter release statistics.").optional(),
902
+ sort: external_exports.string().describe("The sort field used for release statistics in the Sentry response.").optional(),
903
+ status: external_exports.string().describe("An optional release status filter such as open or archived.").optional()
904
+ }).describe("The input payload for retrieving one Sentry release.");
905
+ var getOrganizationReleaseOutput = external_exports.strictObject({
906
+ release: external_exports.looseObject({}).describe("A Sentry release payload.")
907
+ }).describe("Action output.");
908
+ var getReleaseHealthStatsInput = external_exports.strictObject({
909
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug that owns the release."),
910
+ version: external_exports.string().min(1).describe("The Sentry release version to filter release health statistics by."),
911
+ fields: external_exports.array(external_exports.string().min(1)).describe("The session metric fields that Sentry should calculate."),
912
+ groupBy: external_exports.array(external_exports.string().min(1)).describe("The session dimensions that Sentry should group by.").optional(),
913
+ query: external_exports.string().describe("An optional additional Sentry search query appended to the release filter.").optional(),
914
+ start: external_exports.string().describe("The inclusive ISO 8601 start time used to query release health data.").optional(),
915
+ end: external_exports.string().describe("The inclusive ISO 8601 end time used to query release health data.").optional(),
916
+ environments: external_exports.array(external_exports.string().min(1)).describe("The environment names used to filter release health statistics.").optional(),
917
+ projectIds: external_exports.array(external_exports.int().describe("A numeric Sentry project id.")).describe("The numeric Sentry project ids used to filter release health statistics.").optional(),
918
+ interval: external_exports.string().describe("The interval used for time-series release health statistics.").optional(),
919
+ statsPeriod: external_exports.string().describe("The relative time period such as 24h or 7d used for release health statistics.").optional(),
920
+ includeSeries: external_exports.int().describe("Whether Sentry should include series data, using 1 for yes and 0 for no.").optional(),
921
+ includeTotals: external_exports.int().describe("Whether Sentry should include totals data, using 1 for yes and 0 for no.").optional(),
922
+ perPage: external_exports.int().min(1).describe("The maximum number of grouped rows to return.").optional(),
923
+ orderBy: external_exports.string().describe("The metric field Sentry should order the grouped rows by.").optional()
924
+ }).describe("The input payload for retrieving Sentry release health statistics.");
925
+ var getReleaseHealthStatsOutput = external_exports.strictObject({
926
+ groups: external_exports.array(external_exports.looseObject({}).describe("A grouped release health statistics row.")).describe("The grouped release health statistics returned by Sentry."),
927
+ intervals: external_exports.array(external_exports.string().min(1)).describe("The interval boundaries returned by the Sentry sessions endpoint."),
928
+ start: external_exports.string().describe("The ISO 8601 start time applied to the statistics query.").nullable(),
929
+ end: external_exports.string().describe("The ISO 8601 end time applied to the statistics query.").nullable()
930
+ }).describe("Action output.");
931
+ var listOrganizationReplaysInput = external_exports.strictObject({
932
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug whose replays should be listed."),
933
+ start: external_exports.string().describe("The inclusive ISO 8601 start time used to filter replays.").optional(),
934
+ end: external_exports.string().describe("The inclusive ISO 8601 end time used to filter replays.").optional(),
935
+ statsPeriod: external_exports.string().describe("The relative time period such as 1d or 7d used to filter replays.").optional(),
936
+ sort: external_exports.string().describe("The replay sort field returned by Sentry, optionally prefixed with -.").optional(),
937
+ field: external_exports.array(external_exports.string().min(1)).describe("Additional replay fields that Sentry should include in each result.").optional(),
938
+ query: external_exports.string().describe("The Sentry replay search query string used to filter results.").optional(),
939
+ cursor: external_exports.string().describe("The opaque Sentry pagination cursor for the replay results.").optional(),
940
+ projectIds: external_exports.array(external_exports.int().describe("A numeric Sentry project id.")).describe("The numeric Sentry project ids used to filter replays.").optional(),
941
+ perPage: external_exports.int().min(1).describe("The maximum number of replay rows to return.").optional(),
942
+ environment: external_exports.string().describe("The environment name used to filter replays.").optional()
943
+ }).describe("The input payload for listing Sentry organization replays.");
944
+ var listOrganizationReplaysOutput = external_exports.strictObject({
945
+ replays: external_exports.array(external_exports.looseObject({}).describe("A Sentry replay payload.")).describe("The replays returned by Sentry."),
946
+ nextCursor: external_exports.string().describe("The opaque Sentry cursor from the Link header for the next page, or null when there are no more results.").nullable(),
947
+ previousCursor: external_exports.string().describe("The opaque Sentry cursor from the Link header for the previous page, or null when there are no earlier results.").nullable()
948
+ }).describe("Action output.");
949
+ var getReplayInput = external_exports.strictObject({
950
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug that owns the replay."),
951
+ replayId: external_exports.string().min(1).describe("The replay id to retrieve."),
952
+ start: external_exports.string().describe("The inclusive ISO 8601 start time used to scope replay detail metrics.").optional(),
953
+ end: external_exports.string().describe("The inclusive ISO 8601 end time used to scope replay detail metrics.").optional(),
954
+ statsPeriod: external_exports.string().describe("The relative time period such as 1h or 7d used to scope replay detail metrics.").optional(),
955
+ sort: external_exports.string().describe("The replay detail sort field returned by Sentry, optionally prefixed with -.").optional(),
956
+ field: external_exports.array(external_exports.string().min(1)).describe("Additional replay detail fields that Sentry should include in the response.").optional(),
957
+ query: external_exports.string().describe("The Sentry replay search query string used to scope the replay detail response.").optional(),
958
+ cursor: external_exports.string().describe("The opaque Sentry pagination cursor for nested replay detail data.").optional(),
959
+ projectIds: external_exports.array(external_exports.int().describe("A numeric Sentry project id.")).describe("The numeric Sentry project ids used to scope replay details.").optional(),
960
+ perPage: external_exports.int().min(1).describe("The maximum number of nested replay detail rows to return.").optional(),
961
+ environment: external_exports.string().describe("The environment name used to scope replay details.").optional()
962
+ }).describe("The input payload for retrieving one Sentry replay.");
963
+ var getReplayOutput = external_exports.strictObject({
964
+ replay: external_exports.looseObject({}).describe("A Sentry replay payload."),
965
+ nextCursor: external_exports.string().describe("The opaque Sentry cursor from the Link header for the next page, or null when there are no more results.").nullable(),
966
+ previousCursor: external_exports.string().describe("The opaque Sentry cursor from the Link header for the previous page, or null when there are no earlier results.").nullable()
967
+ }).describe("Action output.");
968
+ var listAlertsInput = external_exports.strictObject({
969
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug whose alert workflows should be listed."),
970
+ ids: external_exports.array(external_exports.string().min(1)).describe("Specific alert workflow ids that Sentry should filter the list to.").optional(),
971
+ query: external_exports.string().describe("An optional free-text search query used to filter alert workflows.").optional(),
972
+ sortBy: external_exports.string().describe("The alert workflow sort field, optionally prefixed with - for descending.").optional(),
973
+ projectIds: external_exports.array(external_exports.int().describe("A numeric Sentry project id.")).describe("The numeric Sentry project ids used to filter alert workflows.").optional()
974
+ }).describe("The input payload for listing Sentry alert workflows.");
975
+ var listAlertsOutput = external_exports.strictObject({
976
+ alerts: external_exports.array(external_exports.looseObject({}).describe("A Sentry alert workflow payload.")).describe("The alert workflows returned by Sentry.")
977
+ }).describe("Action output.");
978
+ var getAlertInput = external_exports.strictObject({
979
+ organizationIdOrSlug: external_exports.string().min(1).describe("The organization id or slug that owns the alert workflow."),
980
+ alertId: external_exports.string().min(1).describe("The alert workflow id to retrieve.")
981
+ }).describe("The input payload for retrieving one Sentry alert workflow.");
982
+ var getAlertOutput = external_exports.strictObject({
983
+ alert: external_exports.looseObject({}).describe("A Sentry alert workflow payload.")
984
+ }).describe("Action output.");
985
+ var sentryActions = {
986
+ list_organization_integrations: {
987
+ description: "List installed integrations for a Sentry organization, with optional provider and feature filters.",
988
+ effect: "read",
989
+ inputSchema: listOrganizationIntegrationsInput,
990
+ outputSchema: external_exports.toJSONSchema(listOrganizationIntegrationsOutput, { io: "output", unrepresentable: "any" })
991
+ },
992
+ get_organization_integration: {
993
+ description: "Get one installed Sentry organization integration by its integration id.",
994
+ effect: "read",
995
+ inputSchema: getOrganizationIntegrationInput,
996
+ outputSchema: external_exports.toJSONSchema(getOrganizationIntegrationOutput, { io: "output", unrepresentable: "any" })
997
+ },
998
+ get_organization_integration_config: {
999
+ description: "List available integration provider configs for a Sentry organization, optionally filtered by provider key.",
1000
+ effect: "read",
1001
+ inputSchema: getOrganizationIntegrationConfigInput,
1002
+ outputSchema: external_exports.toJSONSchema(getOrganizationIntegrationConfigOutput, { io: "output", unrepresentable: "any" })
1003
+ },
1004
+ list_organization_sentry_apps: {
1005
+ description: "List the custom Sentry Apps created by a Sentry organization.",
1006
+ effect: "read",
1007
+ inputSchema: listOrganizationSentryAppsInput,
1008
+ outputSchema: external_exports.toJSONSchema(listOrganizationSentryAppsOutput, { io: "output", unrepresentable: "any" })
1009
+ },
1010
+ get_sentry_app: {
1011
+ description: "Get one Sentry App by id or slug, including integration metadata and OAuth client settings.",
1012
+ effect: "read",
1013
+ inputSchema: getSentryAppInput,
1014
+ outputSchema: external_exports.toJSONSchema(getSentryAppOutput, { io: "output", unrepresentable: "any" })
1015
+ },
1016
+ list_organization_projects: {
1017
+ description: "List projects that belong to a Sentry organization.",
1018
+ effect: "read",
1019
+ inputSchema: listOrganizationProjectsInput,
1020
+ outputSchema: external_exports.toJSONSchema(listOrganizationProjectsOutput, { io: "output", unrepresentable: "any" })
1021
+ },
1022
+ get_project: {
1023
+ description: "Get one Sentry project by organization and project slug or id.",
1024
+ effect: "read",
1025
+ inputSchema: getProjectInput,
1026
+ outputSchema: external_exports.toJSONSchema(getProjectOutput, { io: "output", unrepresentable: "any" })
1027
+ },
1028
+ list_organization_issues: {
1029
+ description: "List issues for a Sentry organization with optional search, project, and environment filters.",
1030
+ effect: "read",
1031
+ inputSchema: listOrganizationIssuesInput,
1032
+ outputSchema: external_exports.toJSONSchema(listOrganizationIssuesOutput, { io: "output", unrepresentable: "any" })
1033
+ },
1034
+ get_issue: {
1035
+ description: "Get one issue in a Sentry organization by numeric id or short id.",
1036
+ effect: "read",
1037
+ inputSchema: getIssueInput,
1038
+ outputSchema: external_exports.toJSONSchema(getIssueOutput, { io: "output", unrepresentable: "any" })
1039
+ },
1040
+ get_issue_event: {
1041
+ description: "Get one event for a Sentry issue by event id, or use latest, oldest, or recommended selectors.",
1042
+ effect: "read",
1043
+ inputSchema: getIssueEventInput,
1044
+ outputSchema: external_exports.toJSONSchema(getIssueEventOutput, { io: "output", unrepresentable: "any" })
1045
+ },
1046
+ list_issue_events: {
1047
+ description: "List events that belong to one Sentry issue, with optional event query filters.",
1048
+ effect: "read",
1049
+ inputSchema: listIssueEventsInput,
1050
+ outputSchema: external_exports.toJSONSchema(listIssueEventsOutput, { io: "output", unrepresentable: "any" })
1051
+ },
1052
+ update_issue: {
1053
+ description: "Update mutable attributes on one Sentry issue, such as status, assignment, or bookmarks.",
1054
+ effect: "write",
1055
+ inputSchema: updateIssueInput,
1056
+ outputSchema: external_exports.toJSONSchema(updateIssueOutput, { io: "output", unrepresentable: "any" })
1057
+ },
1058
+ list_organization_releases: {
1059
+ description: "List releases that belong to a Sentry organization, optionally filtered by version prefix.",
1060
+ effect: "read",
1061
+ inputSchema: listOrganizationReleasesInput,
1062
+ outputSchema: external_exports.toJSONSchema(listOrganizationReleasesOutput, { io: "output", unrepresentable: "any" })
1063
+ },
1064
+ get_organization_release: {
1065
+ description: "Get one release in a Sentry organization, with optional health and summary statistics included.",
1066
+ effect: "read",
1067
+ inputSchema: getOrganizationReleaseInput,
1068
+ outputSchema: external_exports.toJSONSchema(getOrganizationReleaseOutput, { io: "output", unrepresentable: "any" })
1069
+ },
1070
+ get_release_health_stats: {
1071
+ description: "Retrieve release health session statistics for one Sentry release by querying the sessions endpoint with that release version.",
1072
+ effect: "read",
1073
+ inputSchema: getReleaseHealthStatsInput,
1074
+ outputSchema: external_exports.toJSONSchema(getReleaseHealthStatsOutput, { io: "output", unrepresentable: "any" })
1075
+ },
1076
+ list_organization_replays: {
1077
+ description: "List session replays for a Sentry organization, with optional project and environment filters.",
1078
+ effect: "read",
1079
+ inputSchema: listOrganizationReplaysInput,
1080
+ outputSchema: external_exports.toJSONSchema(listOrganizationReplaysOutput, { io: "output", unrepresentable: "any" })
1081
+ },
1082
+ get_replay: {
1083
+ description: "Get one replay instance in a Sentry organization by replay id.",
1084
+ effect: "read",
1085
+ inputSchema: getReplayInput,
1086
+ outputSchema: external_exports.toJSONSchema(getReplayOutput, { io: "output", unrepresentable: "any" })
1087
+ },
1088
+ list_alerts: {
1089
+ description: "List alert workflows for a Sentry organization, with optional id, project, and search filters.",
1090
+ effect: "read",
1091
+ inputSchema: listAlertsInput,
1092
+ outputSchema: external_exports.toJSONSchema(listAlertsOutput, { io: "output", unrepresentable: "any" })
1093
+ },
1094
+ get_alert: {
1095
+ description: "Get one alert workflow in a Sentry organization by workflow id.",
1096
+ effect: "read",
1097
+ inputSchema: getAlertInput,
1098
+ outputSchema: external_exports.toJSONSchema(getAlertOutput, { io: "output", unrepresentable: "any" })
1099
+ }
1100
+ };
1101
+
1102
+ // ../plugins/src/sentry/index.ts
1103
+ function createSentryPlugin() {
1104
+ return createProviderPlugin({
1105
+ description: "Sentry",
1106
+ actions: sentryActions,
1107
+ oauth: {
1108
+ authorizationUrl: "https://sentry.io/oauth/authorize/",
1109
+ tokenUrl: "https://sentry.io/oauth/token/",
1110
+ scopes: ["org:read", "project:read", "project:releases", "event:read", "event:write"]
1111
+ },
1112
+ handlers: {
1113
+ list_organization_integrations: listOrganizationIntegrations,
1114
+ get_organization_integration: getOrganizationIntegration,
1115
+ get_organization_integration_config: getOrganizationIntegrationConfig,
1116
+ list_organization_sentry_apps: listOrganizationSentryApps,
1117
+ get_sentry_app: getSentryApp,
1118
+ list_organization_projects: listOrganizationProjects,
1119
+ get_project: getProject,
1120
+ list_organization_issues: listOrganizationIssues,
1121
+ get_issue: getIssue,
1122
+ get_issue_event: getIssueEvent,
1123
+ list_issue_events: listIssueEvents,
1124
+ update_issue: updateIssue,
1125
+ list_organization_releases: listOrganizationReleases,
1126
+ get_organization_release: getOrganizationRelease,
1127
+ get_release_health_stats: getReleaseHealthStats,
1128
+ list_organization_replays: listOrganizationReplays,
1129
+ get_replay: getReplay,
1130
+ list_alerts: listAlerts,
1131
+ get_alert: getAlert
1132
+ }
1133
+ });
1134
+ }
1135
+ var sentry_default = createSentryPlugin();
1136
+ export {
1137
+ createSentryPlugin,
1138
+ sentry_default as default
1139
+ };