@tool-bridge/server 0.21.1 → 0.22.1
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.
- package/dist/admin.js +170 -0
- package/dist/airtable-ML2GIGCH.js +790 -0
- package/dist/{alt_text_generator_ai-W7O34SNG.js → alt_text_generator_ai-FGYQAF2A.js} +12 -11
- package/dist/{amap-VOX4T2AW.js → amap-G7V65NGK.js} +221 -220
- package/dist/anthropic-6ZK24TBB.js +203 -0
- package/dist/apify-VDGYHP6W.js +248 -0
- package/dist/brave_search-TAATLZOS.js +302 -0
- package/dist/chunk-2IAI3XQM.js +302 -0
- package/dist/chunk-7ISGFRC6.js +161 -0
- package/dist/{chunk-E6JCVKW6.js → chunk-BNMLA2RC.js} +3 -3
- package/dist/chunk-HA4BGL6C.js +8429 -0
- package/dist/{chunk-KMTT3I6D.js → chunk-RMAWSG7E.js} +19172 -25717
- package/dist/{chunk-XYBU3WZH.js → chunk-RTW5VRTK.js} +3 -3
- package/dist/chunk-U7PTOA3U.js +7320 -0
- package/dist/chunk-UY6ANCOY.js +378 -0
- package/dist/{chunk-ATK45BXV.js → chunk-X7ZUTKHR.js} +4 -2
- package/dist/circleci-BQ2UWXL2.js +389 -0
- package/dist/clerk-2JYWQNOI.js +1019 -0
- package/dist/cohere-6MI7AQM4.js +185 -0
- package/dist/{confluence-B3EWPZVE.js → confluence-6Y6GDETF.js} +105 -104
- package/dist/{convertapi-EUWSQYPF.js → convertapi-HBZCSWOX.js} +32 -31
- package/dist/{currencyapi-KVTIK3GL.js → currencyapi-337U5TGI.js} +71 -71
- package/dist/deepseek-OSPASO7O.js +210 -0
- package/dist/docker_hub-3ATQOY5L.js +933 -0
- package/dist/dropbox-LSA4GM2Y.js +1305 -0
- package/dist/dub-VZPJSPI6.js +680 -0
- package/dist/e2b-6SDYQZL2.js +278 -0
- package/dist/exa-B6EUYDVP.js +332 -0
- package/dist/{fal_ai-23E7JPNT.js → fal_ai-K4Q27IME.js} +81 -80
- package/dist/{feishu-7QRIDUV6.js → feishu-4TKXG4SU.js} +528 -572
- package/dist/{feishu_custom_bot-TJ4K7QNJ.js → feishu_custom_bot-7CTEAKRB.js} +57 -53
- package/dist/figma-OUKSZLD5.js +777 -0
- package/dist/firehydrant-7MOYL7QH.js +563 -0
- package/dist/{fixer-BWON27UO.js → fixer-H2BV2NO4.js} +34 -33
- package/dist/fly-PXKY6PNH.js +469 -0
- package/dist/{front-QCGXYEDJ.js → front-UZYIV5DW.js} +104 -104
- package/dist/geocodio-NSYO7TFP.js +213 -0
- package/dist/ghost-QBKKQQMF.js +338 -0
- package/dist/github-ENLSJ4CL.js +5421 -0
- package/dist/gmail-KQSDEB47.js +1887 -0
- package/dist/googlecalendar-5YCX4SZF.js +2524 -0
- package/dist/{googledocs-BUHL4J2H.js → googledocs-SSWIVFKA.js} +341 -340
- package/dist/{grafana-GLU2DWF2.js → grafana-TF2LXDQA.js} +221 -220
- package/dist/graphhopper-CURBVHYK.js +325 -0
- package/dist/index.d.ts +1132 -332
- package/dist/index.js +31 -14
- package/dist/{ip2proxy-EZ64Y4ZH.js → ip2proxy-YNVMTZEM.js} +28 -27
- package/dist/ipgeolocation_io-NAU7VJ4J.js +315 -0
- package/dist/ipqualityscore-OT63L4TI.js +279 -0
- package/dist/{jina_ai-EFBHTBXL.js → jina_ai-6WBMBGWM.js} +23 -23
- package/dist/{jira-HQSHAA5K.js → jira-DVDVTHNO.js} +118 -117
- package/dist/langsmith-IM5N4YAU.js +593 -0
- package/dist/lemlist-277SHUQF.js +289 -0
- package/dist/{linear-K7RYFYAD.js → linear-AEPH7B5V.js} +327 -326
- package/dist/logsnag-VEWRAGBG.js +150 -0
- package/dist/main.js +57 -280
- package/dist/{mattermost-S2BRCWLQ.js → mattermost-Q3A2BIZA.js} +59 -58
- package/dist/mem0-AXS7GZGI.js +544 -0
- package/dist/memos-7TXG4ZTU.js +744 -0
- package/dist/{metabase-MMSEPCOF.js → metabase-NSVACWQM.js} +90 -89
- package/dist/mistral_ai-YZ52RGD4.js +1196 -0
- package/dist/{mother_duck-H7PCQNZ2.js → mother_duck-XLLL6FVL.js} +94 -93
- package/dist/ngrok-4O4W3WZW.js +356 -0
- package/dist/{notes-PFMKRO33.js → notes-YTB3TJOO.js} +11 -9
- package/dist/notion-4W4O7J7V.js +940 -0
- package/dist/open_exchange_rates-23QJXVO5.js +215 -0
- package/dist/openai-ZS7GLSLH.js +800 -0
- package/dist/opengraph_io-PMVH7OYI.js +362 -0
- package/dist/openrouter-ONRGFNB6.js +441 -0
- package/dist/outline-UCUYZZ7J.js +599 -0
- package/dist/paddle-35HTKTUL.js +454 -0
- package/dist/perplexity-NVOBYN24.js +220 -0
- package/dist/pinecone-55CJY73C.js +571 -0
- package/dist/{pipedrive-Y2O7QGFF.js → pipedrive-WMCAKS72.js} +99 -98
- package/dist/polar-SM4ZM53B.js +395 -0
- package/dist/posthog-NWCXVXNJ.js +3464 -0
- package/dist/postmark-QJV5PHUQ.js +427 -0
- package/dist/{prerender-MENYM2TY.js → prerender-2W7UT4SC.js} +31 -30
- package/dist/{pubmed-GOXUVVH5.js → pubmed-VVV7XYLU.js} +239 -238
- package/dist/{railway-V2SID4WV.js → railway-KGI57S3O.js} +118 -117
- package/dist/readwise-AGHTQB42.js +470 -0
- package/dist/render-O4HBROCK.js +461 -0
- package/dist/{replicate-756MXPYX.js → replicate-KWBOMX7D.js} +81 -80
- package/dist/{resend-ZKH3BTBI.js → resend-DRH6Y6I4.js} +20 -16
- package/dist/rootly-XGCUDW6X.js +336 -0
- package/dist/{scrapfly-NSRHFDIQ.js → scrapfly-OIQ3OY6L.js} +62 -61
- package/dist/{scrapingbee-OQHLAVEY.js → scrapingbee-OCZO4FHX.js} +56 -56
- package/dist/{screenshot_fyi-DVWG3AXC.js → screenshot_fyi-CUNGFZOC.js} +16 -16
- package/dist/semantic_scholar-3UJRLKES.js +611 -0
- package/dist/{sentry-546MNDJG.js → sentry-5BWVZFJV.js} +208 -207
- package/dist/{shodan-C3OON3Z3.js → shodan-HI37CTEW.js} +62 -61
- package/dist/shopify-LJ2EV2HH.js +610 -0
- package/dist/stripe-3LHMV55K.js +585 -0
- package/dist/{supabase-U2SL4D63.js → supabase-H2KPX3Q2.js} +245 -244
- package/dist/tavily-FBEWGH3Z.js +326 -0
- package/dist/telegram-MYYO3JND.js +1767 -0
- package/dist/{telnyx-CXQ4EZUX.js → telnyx-H4ALEGAX.js} +57 -56
- package/dist/todoist-OBWICA5Q.js +664 -0
- package/dist/trello-GUFUJRWO.js +1080 -0
- package/dist/turso-NIAK4UMS.js +416 -0
- package/dist/{twilio-4PDBJKWX.js → twilio-K6SLK2CX.js} +70 -69
- package/dist/umami-42RS2EPS.js +389 -0
- package/dist/unsplash-V7TOTETT.js +351 -0
- package/dist/{upstash_redis-G4LQBYHA.js → upstash_redis-AWQMB6Y3.js} +51 -50
- package/dist/uptimerobot-AZC2DHOT.js +483 -0
- package/dist/v2ex-4TVRNMLS.js +667 -0
- package/dist/vercel-DPHTJ3XR.js +1076 -0
- package/dist/{wolfram_alpha_api-3G4PUJWB.js → wolfram_alpha_api-XAG7IXBW.js} +36 -35
- package/dist/wordpress-KMPKVGUX.js +812 -0
- package/dist/workos-PKB2YR7S.js +664 -0
- package/dist/zhihu-Y4H4XYPB.js +254 -0
- package/package.json +18 -9
- package/dist/airtable-LLZDFN7M.js +0 -789
- package/dist/anthropic-G23NN3X5.js +0 -202
- package/dist/apify-Y3SS734K.js +0 -247
- package/dist/brave_search-ZC7OAPSZ.js +0 -301
- package/dist/chunk-R6P4XAE5.js +0 -248
- package/dist/chunk-U7B6DS2O.js +0 -977
- package/dist/chunk-UZM2RXZH.js +0 -23436
- package/dist/circleci-3BAX5FCG.js +0 -388
- package/dist/clerk-6LEM6TNU.js +0 -1019
- package/dist/cloudflare_dns-KINYTJUD.js +0 -588
- package/dist/cohere-XCJ5AJ6B.js +0 -185
- package/dist/deepseek-PC5YGNC5.js +0 -209
- package/dist/docker_hub-C3MA5FU6.js +0 -932
- package/dist/dropbox-XBV7Z2IR.js +0 -1304
- package/dist/dub-LDOFG3HC.js +0 -679
- package/dist/e2b-JMCPSVBW.js +0 -277
- package/dist/exa-RAK7O7RD.js +0 -331
- package/dist/figma-E6IX5DTH.js +0 -773
- package/dist/firehydrant-ZBLPQREE.js +0 -562
- package/dist/fly-ZH3HFCZJ.js +0 -468
- package/dist/geocodio-YGNI7DA4.js +0 -212
- package/dist/ghost-EVSGKH2Q.js +0 -337
- package/dist/github-MA2BGRCJ.js +0 -5420
- package/dist/gmail-E5E6AADE.js +0 -1886
- package/dist/googlecalendar-BTLFPXTD.js +0 -2523
- package/dist/graphhopper-WSMB3TCD.js +0 -324
- package/dist/ipgeolocation_io-AA7HAS22.js +0 -315
- package/dist/ipqualityscore-BHJXVTJT.js +0 -277
- package/dist/langsmith-5W6SCT6F.js +0 -592
- package/dist/lemlist-HJWH6UMK.js +0 -288
- package/dist/logsnag-4KFOHL37.js +0 -150
- package/dist/mem0-CAW43CIC.js +0 -543
- package/dist/memos-TWEGPKFM.js +0 -740
- package/dist/mistral_ai-64BGZQHP.js +0 -1195
- package/dist/ngrok-GQCUGZKJ.js +0 -356
- package/dist/notion-DQWZWP4N.js +0 -936
- package/dist/open_exchange_rates-QMMD735E.js +0 -214
- package/dist/openai-W6PX32NZ.js +0 -799
- package/dist/opengraph_io-HNDBXYNW.js +0 -361
- package/dist/openrouter-JJYMEAUL.js +0 -437
- package/dist/outline-MCBNQZYY.js +0 -595
- package/dist/paddle-D2SKLUDN.js +0 -453
- package/dist/perplexity-XIFMKUAE.js +0 -219
- package/dist/pinecone-HUFTALV2.js +0 -570
- package/dist/polar-TYTOMOSR.js +0 -394
- package/dist/posthog-43JAR3VW.js +0 -3463
- package/dist/postmark-KL2QJYSG.js +0 -426
- package/dist/readwise-CI4GIMMJ.js +0 -469
- package/dist/render-SUBJ6YRZ.js +0 -460
- package/dist/rootly-CD2LJHPI.js +0 -336
- package/dist/semantic_scholar-T4A252KW.js +0 -610
- package/dist/shopify-Y2HN2MCQ.js +0 -609
- package/dist/stripe-VE3CD3AY.js +0 -584
- package/dist/tavily-KCZHK6HE.js +0 -326
- package/dist/telegram-3URFBCMY.js +0 -1766
- package/dist/todoist-HNPWNYTD.js +0 -663
- package/dist/trello-3W2MIXRP.js +0 -1079
- package/dist/turso-2EQF7C2Z.js +0 -415
- package/dist/umami-5REN7TGP.js +0 -388
- package/dist/unsplash-EIXL424F.js +0 -350
- package/dist/uptimerobot-KNJ3EYLY.js +0 -482
- package/dist/v2ex-RHJ234PZ.js +0 -666
- package/dist/vercel-AS6NCIC7.js +0 -1075
- package/dist/wordpress-KNDAAUV7.js +0 -811
- package/dist/workos-R6UITSJ7.js +0 -663
- package/dist/zhihu-AGK4HILK.js +0 -253
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createAuthedClient
|
|
3
|
-
} from "./chunk-XYBU3WZH.js";
|
|
4
|
-
import "./chunk-E6JCVKW6.js";
|
|
5
|
-
import {
|
|
6
|
-
asJsonObject,
|
|
7
|
-
compactDefined,
|
|
8
|
-
trimmedText
|
|
9
|
-
} from "./chunk-JXHMDBAY.js";
|
|
10
|
-
import {
|
|
11
|
-
createProviderPlugin,
|
|
12
|
-
upstreamError
|
|
13
|
-
} from "./chunk-ATK45BXV.js";
|
|
14
|
-
import "./chunk-U7B6DS2O.js";
|
|
15
|
-
import {
|
|
16
|
-
TBError,
|
|
17
|
-
external_exports
|
|
18
|
-
} from "./chunk-UZM2RXZH.js";
|
|
19
|
-
import "./chunk-U67V476Y.js";
|
|
20
|
-
|
|
21
|
-
// ../plugins/src/brave_search/api.ts
|
|
22
|
-
var SERVICE = "brave_search";
|
|
23
|
-
var API_BASE = "https://api.search.brave.com";
|
|
24
|
-
var RATE_LIMIT_CODES = /* @__PURE__ */ new Set(["QUOTA_LIMITED", "RATE_LIMITED", "USAGE_LIMIT_EXCEEDED"]);
|
|
25
|
-
var AUTH_CODES = /* @__PURE__ */ new Set(["SUBSCRIPTION_TOKEN_INVALID", "SUBSCRIPTION_NOT_FOUND"]);
|
|
26
|
-
var INVALID_CODES = /* @__PURE__ */ new Set(["RESOURCE_NOT_ALLOWED", "OPTION_NOT_IN_PLAN", "INVALID_URL"]);
|
|
27
|
-
function nullableRecord(value) {
|
|
28
|
-
return value === null ? null : asJsonObject(value);
|
|
29
|
-
}
|
|
30
|
-
function requireRecord(value, label) {
|
|
31
|
-
const result = asJsonObject(value);
|
|
32
|
-
if (result === void 0) {
|
|
33
|
-
throw new TBError("unavailable", `${label}\u4E0D\u662F\u5BF9\u8C61`, { retryable: true });
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
function objectArray(value) {
|
|
38
|
-
if (!Array.isArray(value)) return void 0;
|
|
39
|
-
return value.map((item) => requireRecord(item, "Brave Search \u7ED3\u679C\u9879"));
|
|
40
|
-
}
|
|
41
|
-
function searchTerm(value) {
|
|
42
|
-
const term = trimmedText(value);
|
|
43
|
-
if (term === void 0) throw new TBError("invalid_argument", "q \u4E0D\u80FD\u662F\u7A7A\u767D");
|
|
44
|
-
return term;
|
|
45
|
-
}
|
|
46
|
-
function goggles(value) {
|
|
47
|
-
if (value === void 0 || typeof value === "string") return trimmedText(value);
|
|
48
|
-
const items = value.map((item) => trimmedText(item)).filter((item) => item !== void 0);
|
|
49
|
-
return items.length > 0 ? items : void 0;
|
|
50
|
-
}
|
|
51
|
-
function braveSearchError(status, payload) {
|
|
52
|
-
const error = asJsonObject(asJsonObject(payload)?.error);
|
|
53
|
-
const message = trimmedText(error?.detail) ?? trimmedText(error?.code) ?? `Brave Search \u8FD4\u56DE HTTP ${status}`;
|
|
54
|
-
const code = trimmedText(error?.code);
|
|
55
|
-
if (code !== void 0) {
|
|
56
|
-
if (RATE_LIMIT_CODES.has(code)) return upstreamError(429, message);
|
|
57
|
-
if (AUTH_CODES.has(code)) return upstreamError(401, message);
|
|
58
|
-
if (INVALID_CODES.has(code)) return upstreamError(400, message);
|
|
59
|
-
}
|
|
60
|
-
return upstreamError(status, message);
|
|
61
|
-
}
|
|
62
|
-
var http = createAuthedClient({
|
|
63
|
-
baseUrl: `${API_BASE}/`,
|
|
64
|
-
service: SERVICE,
|
|
65
|
-
auth: { kind: "header", name: "x-subscription-token" },
|
|
66
|
-
headers: { accept: "application/json" },
|
|
67
|
-
// 稳定错误码码表比 HTTP 状态准,整段覆写而不用标准键序提取。
|
|
68
|
-
mapError: ({ data: payload, status }) => braveSearchError(status, payload)
|
|
69
|
-
});
|
|
70
|
-
async function request(ctx, path, query) {
|
|
71
|
-
const { data } = await http.request(ctx, {
|
|
72
|
-
path,
|
|
73
|
-
method: "GET",
|
|
74
|
-
query: Object.entries(query),
|
|
75
|
-
invalidJsonMessage: "Brave Search \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
76
|
-
});
|
|
77
|
-
return data ?? null;
|
|
78
|
-
}
|
|
79
|
-
function normalizeWebSearch(payload) {
|
|
80
|
-
const result = requireRecord(payload, "Brave Search \u54CD\u5E94");
|
|
81
|
-
return compactDefined({
|
|
82
|
-
type: trimmedText(result.type) ?? "search",
|
|
83
|
-
query: nullableRecord(result.query),
|
|
84
|
-
web: nullableRecord(result.web),
|
|
85
|
-
news: nullableRecord(result.news),
|
|
86
|
-
videos: nullableRecord(result.videos),
|
|
87
|
-
locations: nullableRecord(result.locations),
|
|
88
|
-
discussions: nullableRecord(result.discussions),
|
|
89
|
-
faq: nullableRecord(result.faq),
|
|
90
|
-
infobox: nullableRecord(result.infobox),
|
|
91
|
-
mixed: nullableRecord(result.mixed),
|
|
92
|
-
summarizer: nullableRecord(result.summarizer),
|
|
93
|
-
rich: nullableRecord(result.rich)
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
function normalizeCollection(payload, withExtra) {
|
|
97
|
-
const result = requireRecord(payload, "Brave Search \u54CD\u5E94");
|
|
98
|
-
return compactDefined({
|
|
99
|
-
type: trimmedText(result.type) ?? "search",
|
|
100
|
-
query: nullableRecord(result.query),
|
|
101
|
-
results: objectArray(result.results),
|
|
102
|
-
extra: withExtra ? nullableRecord(result.extra) : void 0
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
async function webSearch(input, ctx) {
|
|
106
|
-
return normalizeWebSearch(await request(ctx, "/res/v1/web/search", {
|
|
107
|
-
q: searchTerm(input.q),
|
|
108
|
-
search_lang: trimmedText(input.search_lang),
|
|
109
|
-
ui_lang: trimmedText(input.ui_lang),
|
|
110
|
-
country: trimmedText(input.country),
|
|
111
|
-
safesearch: trimmedText(input.safesearch),
|
|
112
|
-
count: input.count,
|
|
113
|
-
offset: input.offset,
|
|
114
|
-
spellcheck: input.spellcheck,
|
|
115
|
-
freshness: trimmedText(input.freshness),
|
|
116
|
-
result_filter: trimmedText(input.result_filter),
|
|
117
|
-
extra_snippets: input.extra_snippets,
|
|
118
|
-
goggles: goggles(input.goggles),
|
|
119
|
-
text_decorations: input.text_decorations,
|
|
120
|
-
units: trimmedText(input.units),
|
|
121
|
-
operators: input.operators,
|
|
122
|
-
include_fetch_metadata: input.include_fetch_metadata
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
|
-
async function newsSearch(input, ctx) {
|
|
126
|
-
const payload = await request(ctx, "/res/v1/news/search", {
|
|
127
|
-
q: searchTerm(input.q),
|
|
128
|
-
search_lang: trimmedText(input.search_lang),
|
|
129
|
-
ui_lang: trimmedText(input.ui_lang),
|
|
130
|
-
country: trimmedText(input.country),
|
|
131
|
-
safesearch: trimmedText(input.safesearch),
|
|
132
|
-
count: input.count,
|
|
133
|
-
offset: input.offset,
|
|
134
|
-
spellcheck: input.spellcheck,
|
|
135
|
-
freshness: trimmedText(input.freshness),
|
|
136
|
-
extra_snippets: input.extra_snippets,
|
|
137
|
-
goggles: goggles(input.goggles),
|
|
138
|
-
operators: input.operators,
|
|
139
|
-
include_fetch_metadata: input.include_fetch_metadata
|
|
140
|
-
});
|
|
141
|
-
return normalizeCollection(payload, false);
|
|
142
|
-
}
|
|
143
|
-
async function videoSearch(input, ctx) {
|
|
144
|
-
const payload = await request(ctx, "/res/v1/videos/search", {
|
|
145
|
-
q: searchTerm(input.q),
|
|
146
|
-
search_lang: trimmedText(input.search_lang),
|
|
147
|
-
ui_lang: trimmedText(input.ui_lang),
|
|
148
|
-
country: trimmedText(input.country),
|
|
149
|
-
safesearch: trimmedText(input.safesearch),
|
|
150
|
-
count: input.count,
|
|
151
|
-
offset: input.offset,
|
|
152
|
-
spellcheck: input.spellcheck,
|
|
153
|
-
freshness: trimmedText(input.freshness),
|
|
154
|
-
operators: input.operators,
|
|
155
|
-
include_fetch_metadata: input.include_fetch_metadata
|
|
156
|
-
});
|
|
157
|
-
return normalizeCollection(payload, true);
|
|
158
|
-
}
|
|
159
|
-
async function imageSearch(input, ctx) {
|
|
160
|
-
const payload = await request(ctx, "/res/v1/images/search", {
|
|
161
|
-
q: searchTerm(input.q),
|
|
162
|
-
search_lang: trimmedText(input.search_lang),
|
|
163
|
-
country: trimmedText(input.country),
|
|
164
|
-
safesearch: trimmedText(input.safesearch),
|
|
165
|
-
count: input.count,
|
|
166
|
-
spellcheck: input.spellcheck
|
|
167
|
-
});
|
|
168
|
-
return normalizeCollection(payload, true);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// ../plugins/src/brave_search/schema.ts
|
|
172
|
-
var webSearchInput = external_exports.strictObject({
|
|
173
|
-
q: external_exports.string().min(1).max(400).describe("The user's search query term. Maximum of 400 characters."),
|
|
174
|
-
search_lang: external_exports.string().min(2).describe("The preferred search result language code.").optional(),
|
|
175
|
-
ui_lang: external_exports.string().min(2).describe("The preferred user interface language for response formatting.").optional(),
|
|
176
|
-
country: external_exports.string().min(2).max(3).describe("The two-letter country code for result localization, or ALL for worldwide results.").optional(),
|
|
177
|
-
safesearch: external_exports.enum(["off", "moderate", "strict"]).describe("Filters adult content from web results.").optional(),
|
|
178
|
-
count: external_exports.int().min(1).max(20).describe("The maximum number of web results to return.").optional(),
|
|
179
|
-
offset: external_exports.int().min(0).max(9).describe("The zero-based results page offset used for pagination.").optional(),
|
|
180
|
-
spellcheck: external_exports.boolean().describe("Whether Brave Search should spellcheck the query before searching.").optional(),
|
|
181
|
-
freshness: external_exports.union([external_exports.enum(["pd", "pw", "pm", "py"]).describe("A predefined freshness window such as past day or past year."), external_exports.string().min(1).describe("A custom date range in the format YYYY-MM-DDtoYYYY-MM-DD.")]).describe("Filters web results by page age.").optional(),
|
|
182
|
-
result_filter: external_exports.string().min(1).describe("A comma-delimited list of result types to include, such as web,news,videos,locations,discussions,faq,infobox,mixed,summarizer or rich.").optional(),
|
|
183
|
-
extra_snippets: external_exports.boolean().describe("Whether Brave Search should return extra alternate snippets.").optional(),
|
|
184
|
-
goggles: external_exports.union([external_exports.string().min(1).describe("One goggle URL or inline definition."), external_exports.array(external_exports.string().min(1).describe("One goggle URL or inline definition.")).min(1).describe("Multiple goggles to apply to the search request.")]).describe("One or more Brave Search goggles used to rerank results.").optional(),
|
|
185
|
-
text_decorations: external_exports.boolean().describe("Whether display strings should include decoration markers such as highlights.").optional(),
|
|
186
|
-
units: external_exports.enum(["metric", "imperial"]).describe("The measurement units used for localized results.").optional(),
|
|
187
|
-
operators: external_exports.boolean().describe("Whether Brave Search should apply search operators.").optional(),
|
|
188
|
-
include_fetch_metadata: external_exports.boolean().describe("Whether Brave Search should include fetch metadata in results when available.").optional()
|
|
189
|
-
}).describe("Input parameters for a Brave Search web search request.");
|
|
190
|
-
var webSearchOutput = external_exports.strictObject({
|
|
191
|
-
type: external_exports.string().describe("The Brave Search response type."),
|
|
192
|
-
query: external_exports.looseObject({}).describe("Query metadata returned by Brave Search.").nullable().optional(),
|
|
193
|
-
web: external_exports.looseObject({}).describe("Web result payload returned by Brave Search.").nullable().optional(),
|
|
194
|
-
news: external_exports.looseObject({}).describe("News result payload returned by Brave Search.").nullable().optional(),
|
|
195
|
-
videos: external_exports.looseObject({}).describe("Video result payload returned by Brave Search.").nullable().optional(),
|
|
196
|
-
locations: external_exports.looseObject({}).describe("Location result payload returned by Brave Search.").nullable().optional(),
|
|
197
|
-
discussions: external_exports.looseObject({}).describe("Discussion clusters returned by Brave Search.").nullable().optional(),
|
|
198
|
-
faq: external_exports.looseObject({}).describe("Frequently asked questions returned by Brave Search.").nullable().optional(),
|
|
199
|
-
infobox: external_exports.looseObject({}).describe("Infobox payload returned by Brave Search.").nullable().optional(),
|
|
200
|
-
mixed: external_exports.looseObject({}).describe("Mixed ranking payload returned by Brave Search.").nullable().optional(),
|
|
201
|
-
summarizer: external_exports.looseObject({}).describe("Summary metadata returned by Brave Search.").nullable().optional(),
|
|
202
|
-
rich: external_exports.looseObject({}).describe("Rich result callback payload returned by Brave Search.").nullable().optional()
|
|
203
|
-
}).describe("A normalized Brave Search web search response.");
|
|
204
|
-
var newsSearchInput = external_exports.strictObject({
|
|
205
|
-
q: external_exports.string().min(1).max(400).describe("The user's search query term. Maximum of 400 characters."),
|
|
206
|
-
search_lang: external_exports.string().min(2).describe("The preferred search result language code.").optional(),
|
|
207
|
-
ui_lang: external_exports.string().min(2).describe("The preferred user interface language for response formatting.").optional(),
|
|
208
|
-
country: external_exports.string().min(2).max(3).describe("The two-letter country code for result localization, or ALL for worldwide results.").optional(),
|
|
209
|
-
safesearch: external_exports.enum(["off", "moderate", "strict"]).describe("Filters adult content from news results.").optional(),
|
|
210
|
-
count: external_exports.int().min(1).max(50).describe("The maximum number of results to return.").optional(),
|
|
211
|
-
offset: external_exports.int().min(0).max(9).describe("The zero-based results page offset used for pagination.").optional(),
|
|
212
|
-
spellcheck: external_exports.boolean().describe("Whether Brave Search should spellcheck the query before searching.").optional(),
|
|
213
|
-
freshness: external_exports.union([external_exports.enum(["pd", "pw", "pm", "py"]).describe("A predefined freshness window such as past day or past year."), external_exports.string().min(1).describe("A custom date range in the format YYYY-MM-DDtoYYYY-MM-DD.")]).describe("Filters news results by page age.").optional(),
|
|
214
|
-
extra_snippets: external_exports.boolean().describe("Whether Brave Search should return extra alternate snippets.").optional(),
|
|
215
|
-
goggles: external_exports.union([external_exports.string().min(1).describe("One goggle URL or inline definition."), external_exports.array(external_exports.string().min(1).describe("One goggle URL or inline definition.")).min(1).describe("Multiple goggles to apply to the search request.")]).describe("One or more Brave Search goggles used to rerank results.").optional(),
|
|
216
|
-
operators: external_exports.boolean().describe("Whether Brave Search should apply search operators.").optional(),
|
|
217
|
-
include_fetch_metadata: external_exports.boolean().describe("Whether Brave Search should include fetch metadata in results when available.").optional()
|
|
218
|
-
}).describe("Input parameters for a Brave Search news request.");
|
|
219
|
-
var newsSearchOutput = external_exports.strictObject({
|
|
220
|
-
type: external_exports.string().describe("The Brave Search response type."),
|
|
221
|
-
query: external_exports.looseObject({}).describe("Query metadata returned by Brave Search.").nullable().optional(),
|
|
222
|
-
results: external_exports.array(external_exports.looseObject({}).describe("One news result item returned by Brave Search.")).describe("The list of news results returned by Brave Search.").optional()
|
|
223
|
-
}).describe("A normalized Brave Search news response.");
|
|
224
|
-
var videoSearchInput = external_exports.strictObject({
|
|
225
|
-
q: external_exports.string().min(1).max(400).describe("The user's search query term. Maximum of 400 characters."),
|
|
226
|
-
search_lang: external_exports.string().min(2).describe("The preferred search result language code.").optional(),
|
|
227
|
-
ui_lang: external_exports.string().min(2).describe("The preferred user interface language for response formatting.").optional(),
|
|
228
|
-
country: external_exports.string().min(2).max(3).describe("The two-letter country code for result localization, or ALL for worldwide results.").optional(),
|
|
229
|
-
safesearch: external_exports.enum(["off", "moderate", "strict"]).describe("Filters adult content from video results.").optional(),
|
|
230
|
-
count: external_exports.int().min(1).max(50).describe("The maximum number of results to return.").optional(),
|
|
231
|
-
offset: external_exports.int().min(0).max(9).describe("The zero-based results page offset used for pagination.").optional(),
|
|
232
|
-
spellcheck: external_exports.boolean().describe("Whether Brave Search should spellcheck the query before searching.").optional(),
|
|
233
|
-
freshness: external_exports.union([external_exports.enum(["pd", "pw", "pm", "py"]).describe("A predefined freshness window such as past day or past year."), external_exports.string().min(1).describe("A custom date range in the format YYYY-MM-DDtoYYYY-MM-DD.")]).describe("Filters video results by page age.").optional(),
|
|
234
|
-
operators: external_exports.boolean().describe("Whether Brave Search should apply search operators.").optional(),
|
|
235
|
-
include_fetch_metadata: external_exports.boolean().describe("Whether Brave Search should include fetch metadata in results when available.").optional()
|
|
236
|
-
}).describe("Input parameters for a Brave Search video request.");
|
|
237
|
-
var videoSearchOutput = external_exports.strictObject({
|
|
238
|
-
type: external_exports.string().describe("The Brave Search response type."),
|
|
239
|
-
query: external_exports.looseObject({}).describe("Query metadata returned by Brave Search.").nullable().optional(),
|
|
240
|
-
results: external_exports.array(external_exports.looseObject({}).describe("One video result item returned by Brave Search.")).describe("The list of video results returned by Brave Search.").optional(),
|
|
241
|
-
extra: external_exports.looseObject({}).describe("Additional metadata returned with the video results.").nullable().optional()
|
|
242
|
-
}).describe("A normalized Brave Search video response.");
|
|
243
|
-
var imageSearchInput = external_exports.strictObject({
|
|
244
|
-
q: external_exports.string().min(1).max(400).describe("The user's search query term. Maximum of 400 characters."),
|
|
245
|
-
search_lang: external_exports.string().min(2).describe("The preferred search result language code.").optional(),
|
|
246
|
-
country: external_exports.string().min(2).max(3).describe("The two-letter country code for result localization, or ALL for worldwide results.").optional(),
|
|
247
|
-
safesearch: external_exports.enum(["off", "strict"]).describe("Filters adult content from image results.").optional(),
|
|
248
|
-
count: external_exports.int().min(1).max(200).describe("The maximum number of image results to return.").optional(),
|
|
249
|
-
spellcheck: external_exports.boolean().describe("Whether Brave Search should spellcheck the query before searching.").optional()
|
|
250
|
-
}).describe("Input parameters for a Brave Search image request.");
|
|
251
|
-
var imageSearchOutput = external_exports.strictObject({
|
|
252
|
-
type: external_exports.string().describe("The Brave Search response type."),
|
|
253
|
-
query: external_exports.looseObject({}).describe("Query metadata returned by Brave Search.").nullable().optional(),
|
|
254
|
-
results: external_exports.array(external_exports.looseObject({}).describe("One image result item returned by Brave Search.")).describe("The list of image results returned by Brave Search.").optional(),
|
|
255
|
-
extra: external_exports.looseObject({}).describe("Additional metadata returned with the image results.").nullable().optional()
|
|
256
|
-
}).describe("A normalized Brave Search image response.");
|
|
257
|
-
var braveSearchActions = {
|
|
258
|
-
web_search: {
|
|
259
|
-
description: "Search the Brave Search web index and return the selected result families.",
|
|
260
|
-
effect: "write",
|
|
261
|
-
inputSchema: webSearchInput,
|
|
262
|
-
outputSchema: external_exports.toJSONSchema(webSearchOutput, { io: "output", unrepresentable: "any" })
|
|
263
|
-
},
|
|
264
|
-
news_search: {
|
|
265
|
-
description: "Search Brave's news index for recent articles related to a query.",
|
|
266
|
-
effect: "write",
|
|
267
|
-
inputSchema: newsSearchInput,
|
|
268
|
-
outputSchema: external_exports.toJSONSchema(newsSearchOutput, { io: "output", unrepresentable: "any" })
|
|
269
|
-
},
|
|
270
|
-
video_search: {
|
|
271
|
-
description: "Search Brave's video index for videos related to a query.",
|
|
272
|
-
effect: "write",
|
|
273
|
-
inputSchema: videoSearchInput,
|
|
274
|
-
outputSchema: external_exports.toJSONSchema(videoSearchOutput, { io: "output", unrepresentable: "any" })
|
|
275
|
-
},
|
|
276
|
-
image_search: {
|
|
277
|
-
description: "Search Brave's image index for images related to a query.",
|
|
278
|
-
effect: "write",
|
|
279
|
-
inputSchema: imageSearchInput,
|
|
280
|
-
outputSchema: external_exports.toJSONSchema(imageSearchOutput, { io: "output", unrepresentable: "any" })
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
// ../plugins/src/brave_search/index.ts
|
|
285
|
-
function createBraveSearchPlugin() {
|
|
286
|
-
return createProviderPlugin({
|
|
287
|
-
description: "Brave Search",
|
|
288
|
-
actions: braveSearchActions,
|
|
289
|
-
handlers: {
|
|
290
|
-
web_search: webSearch,
|
|
291
|
-
news_search: newsSearch,
|
|
292
|
-
video_search: videoSearch,
|
|
293
|
-
image_search: imageSearch
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
var brave_search_default = createBraveSearchPlugin();
|
|
298
|
-
export {
|
|
299
|
-
createBraveSearchPlugin,
|
|
300
|
-
brave_search_default as default
|
|
301
|
-
};
|
package/dist/chunk-R6P4XAE5.js
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/index.js
|
|
2
|
-
var ParseError = class extends Error {
|
|
3
|
-
constructor(message, options) {
|
|
4
|
-
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
5
|
-
}
|
|
6
|
-
};
|
|
7
|
-
var LF = 10;
|
|
8
|
-
var CR = 13;
|
|
9
|
-
var SPACE = 32;
|
|
10
|
-
function noop(_arg) {
|
|
11
|
-
}
|
|
12
|
-
function createParser(config) {
|
|
13
|
-
if (typeof config == "function")
|
|
14
|
-
throw new TypeError(
|
|
15
|
-
"`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
|
|
16
|
-
);
|
|
17
|
-
const { onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize } = config, pendingFragments = [];
|
|
18
|
-
let pendingFragmentsLength = 0, isFirstChunk = true, id, data = "", dataLines = 0, eventType, terminated = false;
|
|
19
|
-
function feed(chunk) {
|
|
20
|
-
if (terminated)
|
|
21
|
-
throw new Error(
|
|
22
|
-
"Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing."
|
|
23
|
-
);
|
|
24
|
-
if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
|
|
25
|
-
const trailing2 = processLines(chunk);
|
|
26
|
-
trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (chunk.indexOf(`
|
|
30
|
-
`) === -1 && chunk.indexOf("\r") === -1) {
|
|
31
|
-
pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
pendingFragments.push(chunk);
|
|
35
|
-
const input = pendingFragments.join("");
|
|
36
|
-
pendingFragments.length = 0, pendingFragmentsLength = 0;
|
|
37
|
-
const trailing = processLines(input);
|
|
38
|
-
trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
|
|
39
|
-
}
|
|
40
|
-
function checkBufferSize() {
|
|
41
|
-
maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(
|
|
42
|
-
new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
|
|
43
|
-
type: "max-buffer-size-exceeded"
|
|
44
|
-
})
|
|
45
|
-
)));
|
|
46
|
-
}
|
|
47
|
-
function processLines(chunk) {
|
|
48
|
-
let searchIndex = 0;
|
|
49
|
-
if (chunk.indexOf("\r") === -1) {
|
|
50
|
-
let lfIndex = chunk.indexOf(`
|
|
51
|
-
`, searchIndex);
|
|
52
|
-
for (; lfIndex !== -1; ) {
|
|
53
|
-
if (searchIndex === lfIndex) {
|
|
54
|
-
dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
55
|
-
`, searchIndex);
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
59
|
-
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
|
|
60
|
-
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
61
|
-
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
|
|
62
|
-
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
63
|
-
`, searchIndex);
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
data = dataLines === 0 ? value : `${data}
|
|
67
|
-
${value}`, dataLines++;
|
|
68
|
-
} else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
69
|
-
chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
|
|
70
|
-
lfIndex
|
|
71
|
-
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
72
|
-
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
73
|
-
`, searchIndex);
|
|
74
|
-
}
|
|
75
|
-
return chunk.slice(searchIndex);
|
|
76
|
-
}
|
|
77
|
-
for (; searchIndex < chunk.length; ) {
|
|
78
|
-
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
79
|
-
`, searchIndex);
|
|
80
|
-
let lineEnd = -1;
|
|
81
|
-
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
82
|
-
break;
|
|
83
|
-
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
|
|
84
|
-
}
|
|
85
|
-
return chunk.slice(searchIndex);
|
|
86
|
-
}
|
|
87
|
-
function parseLine(chunk, start, end) {
|
|
88
|
-
if (start === end) {
|
|
89
|
-
dispatchEvent();
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const firstCharCode = chunk.charCodeAt(start);
|
|
93
|
-
if (isDataPrefix(chunk, start, firstCharCode)) {
|
|
94
|
-
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
95
|
-
data = dataLines === 0 ? value2 : `${data}
|
|
96
|
-
${value2}`, dataLines++;
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (isEventPrefix(chunk, start, firstCharCode)) {
|
|
100
|
-
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
104
|
-
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
|
|
105
|
-
id = value2.includes("\0") ? void 0 : value2;
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (firstCharCode === 58) {
|
|
109
|
-
if (onComment) {
|
|
110
|
-
const line2 = chunk.slice(start, end);
|
|
111
|
-
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
|
|
112
|
-
}
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
|
|
116
|
-
if (fieldSeparatorIndex === -1) {
|
|
117
|
-
processField(line, "", line);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
121
|
-
processField(field, value, line);
|
|
122
|
-
}
|
|
123
|
-
function processField(field, value, line) {
|
|
124
|
-
switch (field) {
|
|
125
|
-
case "event":
|
|
126
|
-
eventType = value || void 0;
|
|
127
|
-
break;
|
|
128
|
-
case "data":
|
|
129
|
-
data = dataLines === 0 ? value : `${data}
|
|
130
|
-
${value}`, dataLines++;
|
|
131
|
-
break;
|
|
132
|
-
case "id":
|
|
133
|
-
id = value.includes("\0") ? void 0 : value;
|
|
134
|
-
break;
|
|
135
|
-
case "retry":
|
|
136
|
-
/^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
|
|
137
|
-
new ParseError(`Invalid \`retry\` value: "${value}"`, {
|
|
138
|
-
type: "invalid-retry",
|
|
139
|
-
value,
|
|
140
|
-
line
|
|
141
|
-
})
|
|
142
|
-
);
|
|
143
|
-
break;
|
|
144
|
-
default:
|
|
145
|
-
onError(
|
|
146
|
-
new ParseError(
|
|
147
|
-
`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
|
|
148
|
-
{ type: "unknown-field", field, value, line }
|
|
149
|
-
)
|
|
150
|
-
);
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
function dispatchEvent() {
|
|
155
|
-
dataLines > 0 && onEvent({
|
|
156
|
-
id,
|
|
157
|
-
event: eventType,
|
|
158
|
-
data
|
|
159
|
-
}), id = void 0, data = "", dataLines = 0, eventType = void 0;
|
|
160
|
-
}
|
|
161
|
-
function reset(options = {}) {
|
|
162
|
-
if (options.consume && pendingFragments.length > 0) {
|
|
163
|
-
const incompleteLine = pendingFragments.join("");
|
|
164
|
-
parseLine(incompleteLine, 0, incompleteLine.length);
|
|
165
|
-
}
|
|
166
|
-
isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
|
|
167
|
-
}
|
|
168
|
-
return { feed, reset };
|
|
169
|
-
}
|
|
170
|
-
function isDataPrefix(chunk, i, firstCharCode) {
|
|
171
|
-
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
172
|
-
}
|
|
173
|
-
function isEventPrefix(chunk, i, firstCharCode) {
|
|
174
|
-
return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
|
|
178
|
-
var EventSourceParserStream = class extends TransformStream {
|
|
179
|
-
constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
|
|
180
|
-
let parser;
|
|
181
|
-
super({
|
|
182
|
-
start(controller) {
|
|
183
|
-
parser = createParser({
|
|
184
|
-
onEvent: (event) => {
|
|
185
|
-
controller.enqueue(event);
|
|
186
|
-
},
|
|
187
|
-
onError(error) {
|
|
188
|
-
typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
|
|
189
|
-
},
|
|
190
|
-
onRetry,
|
|
191
|
-
onComment,
|
|
192
|
-
maxBufferSize
|
|
193
|
-
});
|
|
194
|
-
},
|
|
195
|
-
transform(chunk) {
|
|
196
|
-
parser.feed(chunk);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
// ../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.node.js
|
|
203
|
-
var crypto;
|
|
204
|
-
crypto = globalThis.crypto?.webcrypto ?? // Node.js [18-16] REPL
|
|
205
|
-
globalThis.crypto ?? // Node.js >18
|
|
206
|
-
import("crypto").then((m) => m.webcrypto);
|
|
207
|
-
async function getRandomValues(size) {
|
|
208
|
-
return (await crypto).getRandomValues(new Uint8Array(size));
|
|
209
|
-
}
|
|
210
|
-
async function random(size) {
|
|
211
|
-
const mask = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
|
|
212
|
-
const evenDistCutoff = Math.pow(2, 8) - Math.pow(2, 8) % mask.length;
|
|
213
|
-
let result = "";
|
|
214
|
-
while (result.length < size) {
|
|
215
|
-
const randomBytes = await getRandomValues(size - result.length);
|
|
216
|
-
for (const randomByte of randomBytes) {
|
|
217
|
-
if (randomByte < evenDistCutoff) {
|
|
218
|
-
result += mask[randomByte % mask.length];
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return result;
|
|
223
|
-
}
|
|
224
|
-
async function generateVerifier(length) {
|
|
225
|
-
return await random(length);
|
|
226
|
-
}
|
|
227
|
-
async function generateChallenge(code_verifier) {
|
|
228
|
-
const buffer = await (await crypto).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
229
|
-
return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
230
|
-
}
|
|
231
|
-
async function pkceChallenge(length) {
|
|
232
|
-
if (!length)
|
|
233
|
-
length = 43;
|
|
234
|
-
if (length < 43 || length > 128) {
|
|
235
|
-
throw `Expected a length between 43 and 128. Received ${length}.`;
|
|
236
|
-
}
|
|
237
|
-
const verifier = await generateVerifier(length);
|
|
238
|
-
const challenge = await generateChallenge(verifier);
|
|
239
|
-
return {
|
|
240
|
-
code_verifier: verifier,
|
|
241
|
-
code_challenge: challenge
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
export {
|
|
246
|
-
pkceChallenge,
|
|
247
|
-
EventSourceParserStream
|
|
248
|
-
};
|