@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.
Files changed (178) hide show
  1. package/dist/admin.js +170 -0
  2. package/dist/airtable-ML2GIGCH.js +790 -0
  3. package/dist/{alt_text_generator_ai-W7O34SNG.js → alt_text_generator_ai-FGYQAF2A.js} +12 -11
  4. package/dist/{amap-VOX4T2AW.js → amap-G7V65NGK.js} +221 -220
  5. package/dist/anthropic-6ZK24TBB.js +203 -0
  6. package/dist/apify-VDGYHP6W.js +248 -0
  7. package/dist/brave_search-TAATLZOS.js +302 -0
  8. package/dist/chunk-2IAI3XQM.js +302 -0
  9. package/dist/chunk-7ISGFRC6.js +161 -0
  10. package/dist/{chunk-E6JCVKW6.js → chunk-BNMLA2RC.js} +3 -3
  11. package/dist/chunk-HA4BGL6C.js +8429 -0
  12. package/dist/{chunk-KMTT3I6D.js → chunk-RMAWSG7E.js} +19172 -25717
  13. package/dist/{chunk-XYBU3WZH.js → chunk-RTW5VRTK.js} +3 -3
  14. package/dist/chunk-U7PTOA3U.js +7320 -0
  15. package/dist/chunk-UY6ANCOY.js +378 -0
  16. package/dist/{chunk-ATK45BXV.js → chunk-X7ZUTKHR.js} +4 -2
  17. package/dist/circleci-BQ2UWXL2.js +389 -0
  18. package/dist/clerk-2JYWQNOI.js +1019 -0
  19. package/dist/cohere-6MI7AQM4.js +185 -0
  20. package/dist/{confluence-B3EWPZVE.js → confluence-6Y6GDETF.js} +105 -104
  21. package/dist/{convertapi-EUWSQYPF.js → convertapi-HBZCSWOX.js} +32 -31
  22. package/dist/{currencyapi-KVTIK3GL.js → currencyapi-337U5TGI.js} +71 -71
  23. package/dist/deepseek-OSPASO7O.js +210 -0
  24. package/dist/docker_hub-3ATQOY5L.js +933 -0
  25. package/dist/dropbox-LSA4GM2Y.js +1305 -0
  26. package/dist/dub-VZPJSPI6.js +680 -0
  27. package/dist/e2b-6SDYQZL2.js +278 -0
  28. package/dist/exa-B6EUYDVP.js +332 -0
  29. package/dist/{fal_ai-23E7JPNT.js → fal_ai-K4Q27IME.js} +81 -80
  30. package/dist/{feishu-7QRIDUV6.js → feishu-4TKXG4SU.js} +528 -572
  31. package/dist/{feishu_custom_bot-TJ4K7QNJ.js → feishu_custom_bot-7CTEAKRB.js} +57 -53
  32. package/dist/figma-OUKSZLD5.js +777 -0
  33. package/dist/firehydrant-7MOYL7QH.js +563 -0
  34. package/dist/{fixer-BWON27UO.js → fixer-H2BV2NO4.js} +34 -33
  35. package/dist/fly-PXKY6PNH.js +469 -0
  36. package/dist/{front-QCGXYEDJ.js → front-UZYIV5DW.js} +104 -104
  37. package/dist/geocodio-NSYO7TFP.js +213 -0
  38. package/dist/ghost-QBKKQQMF.js +338 -0
  39. package/dist/github-ENLSJ4CL.js +5421 -0
  40. package/dist/gmail-KQSDEB47.js +1887 -0
  41. package/dist/googlecalendar-5YCX4SZF.js +2524 -0
  42. package/dist/{googledocs-BUHL4J2H.js → googledocs-SSWIVFKA.js} +341 -340
  43. package/dist/{grafana-GLU2DWF2.js → grafana-TF2LXDQA.js} +221 -220
  44. package/dist/graphhopper-CURBVHYK.js +325 -0
  45. package/dist/index.d.ts +1132 -332
  46. package/dist/index.js +31 -14
  47. package/dist/{ip2proxy-EZ64Y4ZH.js → ip2proxy-YNVMTZEM.js} +28 -27
  48. package/dist/ipgeolocation_io-NAU7VJ4J.js +315 -0
  49. package/dist/ipqualityscore-OT63L4TI.js +279 -0
  50. package/dist/{jina_ai-EFBHTBXL.js → jina_ai-6WBMBGWM.js} +23 -23
  51. package/dist/{jira-HQSHAA5K.js → jira-DVDVTHNO.js} +118 -117
  52. package/dist/langsmith-IM5N4YAU.js +593 -0
  53. package/dist/lemlist-277SHUQF.js +289 -0
  54. package/dist/{linear-K7RYFYAD.js → linear-AEPH7B5V.js} +327 -326
  55. package/dist/logsnag-VEWRAGBG.js +150 -0
  56. package/dist/main.js +57 -280
  57. package/dist/{mattermost-S2BRCWLQ.js → mattermost-Q3A2BIZA.js} +59 -58
  58. package/dist/mem0-AXS7GZGI.js +544 -0
  59. package/dist/memos-7TXG4ZTU.js +744 -0
  60. package/dist/{metabase-MMSEPCOF.js → metabase-NSVACWQM.js} +90 -89
  61. package/dist/mistral_ai-YZ52RGD4.js +1196 -0
  62. package/dist/{mother_duck-H7PCQNZ2.js → mother_duck-XLLL6FVL.js} +94 -93
  63. package/dist/ngrok-4O4W3WZW.js +356 -0
  64. package/dist/{notes-PFMKRO33.js → notes-YTB3TJOO.js} +11 -9
  65. package/dist/notion-4W4O7J7V.js +940 -0
  66. package/dist/open_exchange_rates-23QJXVO5.js +215 -0
  67. package/dist/openai-ZS7GLSLH.js +800 -0
  68. package/dist/opengraph_io-PMVH7OYI.js +362 -0
  69. package/dist/openrouter-ONRGFNB6.js +441 -0
  70. package/dist/outline-UCUYZZ7J.js +599 -0
  71. package/dist/paddle-35HTKTUL.js +454 -0
  72. package/dist/perplexity-NVOBYN24.js +220 -0
  73. package/dist/pinecone-55CJY73C.js +571 -0
  74. package/dist/{pipedrive-Y2O7QGFF.js → pipedrive-WMCAKS72.js} +99 -98
  75. package/dist/polar-SM4ZM53B.js +395 -0
  76. package/dist/posthog-NWCXVXNJ.js +3464 -0
  77. package/dist/postmark-QJV5PHUQ.js +427 -0
  78. package/dist/{prerender-MENYM2TY.js → prerender-2W7UT4SC.js} +31 -30
  79. package/dist/{pubmed-GOXUVVH5.js → pubmed-VVV7XYLU.js} +239 -238
  80. package/dist/{railway-V2SID4WV.js → railway-KGI57S3O.js} +118 -117
  81. package/dist/readwise-AGHTQB42.js +470 -0
  82. package/dist/render-O4HBROCK.js +461 -0
  83. package/dist/{replicate-756MXPYX.js → replicate-KWBOMX7D.js} +81 -80
  84. package/dist/{resend-ZKH3BTBI.js → resend-DRH6Y6I4.js} +20 -16
  85. package/dist/rootly-XGCUDW6X.js +336 -0
  86. package/dist/{scrapfly-NSRHFDIQ.js → scrapfly-OIQ3OY6L.js} +62 -61
  87. package/dist/{scrapingbee-OQHLAVEY.js → scrapingbee-OCZO4FHX.js} +56 -56
  88. package/dist/{screenshot_fyi-DVWG3AXC.js → screenshot_fyi-CUNGFZOC.js} +16 -16
  89. package/dist/semantic_scholar-3UJRLKES.js +611 -0
  90. package/dist/{sentry-546MNDJG.js → sentry-5BWVZFJV.js} +208 -207
  91. package/dist/{shodan-C3OON3Z3.js → shodan-HI37CTEW.js} +62 -61
  92. package/dist/shopify-LJ2EV2HH.js +610 -0
  93. package/dist/stripe-3LHMV55K.js +585 -0
  94. package/dist/{supabase-U2SL4D63.js → supabase-H2KPX3Q2.js} +245 -244
  95. package/dist/tavily-FBEWGH3Z.js +326 -0
  96. package/dist/telegram-MYYO3JND.js +1767 -0
  97. package/dist/{telnyx-CXQ4EZUX.js → telnyx-H4ALEGAX.js} +57 -56
  98. package/dist/todoist-OBWICA5Q.js +664 -0
  99. package/dist/trello-GUFUJRWO.js +1080 -0
  100. package/dist/turso-NIAK4UMS.js +416 -0
  101. package/dist/{twilio-4PDBJKWX.js → twilio-K6SLK2CX.js} +70 -69
  102. package/dist/umami-42RS2EPS.js +389 -0
  103. package/dist/unsplash-V7TOTETT.js +351 -0
  104. package/dist/{upstash_redis-G4LQBYHA.js → upstash_redis-AWQMB6Y3.js} +51 -50
  105. package/dist/uptimerobot-AZC2DHOT.js +483 -0
  106. package/dist/v2ex-4TVRNMLS.js +667 -0
  107. package/dist/vercel-DPHTJ3XR.js +1076 -0
  108. package/dist/{wolfram_alpha_api-3G4PUJWB.js → wolfram_alpha_api-XAG7IXBW.js} +36 -35
  109. package/dist/wordpress-KMPKVGUX.js +812 -0
  110. package/dist/workos-PKB2YR7S.js +664 -0
  111. package/dist/zhihu-Y4H4XYPB.js +254 -0
  112. package/package.json +18 -9
  113. package/dist/airtable-LLZDFN7M.js +0 -789
  114. package/dist/anthropic-G23NN3X5.js +0 -202
  115. package/dist/apify-Y3SS734K.js +0 -247
  116. package/dist/brave_search-ZC7OAPSZ.js +0 -301
  117. package/dist/chunk-R6P4XAE5.js +0 -248
  118. package/dist/chunk-U7B6DS2O.js +0 -977
  119. package/dist/chunk-UZM2RXZH.js +0 -23436
  120. package/dist/circleci-3BAX5FCG.js +0 -388
  121. package/dist/clerk-6LEM6TNU.js +0 -1019
  122. package/dist/cloudflare_dns-KINYTJUD.js +0 -588
  123. package/dist/cohere-XCJ5AJ6B.js +0 -185
  124. package/dist/deepseek-PC5YGNC5.js +0 -209
  125. package/dist/docker_hub-C3MA5FU6.js +0 -932
  126. package/dist/dropbox-XBV7Z2IR.js +0 -1304
  127. package/dist/dub-LDOFG3HC.js +0 -679
  128. package/dist/e2b-JMCPSVBW.js +0 -277
  129. package/dist/exa-RAK7O7RD.js +0 -331
  130. package/dist/figma-E6IX5DTH.js +0 -773
  131. package/dist/firehydrant-ZBLPQREE.js +0 -562
  132. package/dist/fly-ZH3HFCZJ.js +0 -468
  133. package/dist/geocodio-YGNI7DA4.js +0 -212
  134. package/dist/ghost-EVSGKH2Q.js +0 -337
  135. package/dist/github-MA2BGRCJ.js +0 -5420
  136. package/dist/gmail-E5E6AADE.js +0 -1886
  137. package/dist/googlecalendar-BTLFPXTD.js +0 -2523
  138. package/dist/graphhopper-WSMB3TCD.js +0 -324
  139. package/dist/ipgeolocation_io-AA7HAS22.js +0 -315
  140. package/dist/ipqualityscore-BHJXVTJT.js +0 -277
  141. package/dist/langsmith-5W6SCT6F.js +0 -592
  142. package/dist/lemlist-HJWH6UMK.js +0 -288
  143. package/dist/logsnag-4KFOHL37.js +0 -150
  144. package/dist/mem0-CAW43CIC.js +0 -543
  145. package/dist/memos-TWEGPKFM.js +0 -740
  146. package/dist/mistral_ai-64BGZQHP.js +0 -1195
  147. package/dist/ngrok-GQCUGZKJ.js +0 -356
  148. package/dist/notion-DQWZWP4N.js +0 -936
  149. package/dist/open_exchange_rates-QMMD735E.js +0 -214
  150. package/dist/openai-W6PX32NZ.js +0 -799
  151. package/dist/opengraph_io-HNDBXYNW.js +0 -361
  152. package/dist/openrouter-JJYMEAUL.js +0 -437
  153. package/dist/outline-MCBNQZYY.js +0 -595
  154. package/dist/paddle-D2SKLUDN.js +0 -453
  155. package/dist/perplexity-XIFMKUAE.js +0 -219
  156. package/dist/pinecone-HUFTALV2.js +0 -570
  157. package/dist/polar-TYTOMOSR.js +0 -394
  158. package/dist/posthog-43JAR3VW.js +0 -3463
  159. package/dist/postmark-KL2QJYSG.js +0 -426
  160. package/dist/readwise-CI4GIMMJ.js +0 -469
  161. package/dist/render-SUBJ6YRZ.js +0 -460
  162. package/dist/rootly-CD2LJHPI.js +0 -336
  163. package/dist/semantic_scholar-T4A252KW.js +0 -610
  164. package/dist/shopify-Y2HN2MCQ.js +0 -609
  165. package/dist/stripe-VE3CD3AY.js +0 -584
  166. package/dist/tavily-KCZHK6HE.js +0 -326
  167. package/dist/telegram-3URFBCMY.js +0 -1766
  168. package/dist/todoist-HNPWNYTD.js +0 -663
  169. package/dist/trello-3W2MIXRP.js +0 -1079
  170. package/dist/turso-2EQF7C2Z.js +0 -415
  171. package/dist/umami-5REN7TGP.js +0 -388
  172. package/dist/unsplash-EIXL424F.js +0 -350
  173. package/dist/uptimerobot-KNJ3EYLY.js +0 -482
  174. package/dist/v2ex-RHJ234PZ.js +0 -666
  175. package/dist/vercel-AS6NCIC7.js +0 -1075
  176. package/dist/wordpress-KNDAAUV7.js +0 -811
  177. package/dist/workos-R6UITSJ7.js +0 -663
  178. package/dist/zhihu-AGK4HILK.js +0 -253
package/dist/index.js CHANGED
@@ -4,31 +4,48 @@ import {
4
4
  DEVICE_WS_PATH,
5
5
  DeviceHub,
6
6
  DeviceRouter,
7
+ KeyManager,
8
+ MaintenanceManager,
9
+ PgKeyRotation,
10
+ PgMailboxRepository,
7
11
  PgSearchIndex,
8
12
  PgStateStore,
13
+ PgStoreRepository,
9
14
  RedisDeviceRouterBackend,
10
- SqliteSearchIndex,
11
- SqliteStateStore,
12
- configFromEnv,
13
- createDataObjectStore,
14
- createTbServer
15
- } from "./chunk-KMTT3I6D.js";
16
- import "./chunk-R6P4XAE5.js";
17
- import "./chunk-U7B6DS2O.js";
18
- import "./chunk-UZM2RXZH.js";
15
+ StorageManager,
16
+ createManagedServer,
17
+ createS3ObjectStore,
18
+ createTbServer,
19
+ probeS3ObjectStore,
20
+ runtimeAppSettings
21
+ } from "./chunk-RMAWSG7E.js";
22
+ import "./chunk-U7PTOA3U.js";
23
+ import {
24
+ BootstrapStateStore
25
+ } from "./chunk-2IAI3XQM.js";
26
+ import "./chunk-7ISGFRC6.js";
27
+ import "./chunk-UY6ANCOY.js";
28
+ import "./chunk-HA4BGL6C.js";
19
29
  import "./chunk-U67V476Y.js";
20
30
  export {
31
+ BootstrapStateStore,
21
32
  DEVICE_FORWARD_TIMEOUT_MS,
22
33
  DEVICE_ROUTE_TTL_SEC,
23
34
  DEVICE_WS_PATH,
24
35
  DeviceHub,
25
36
  DeviceRouter,
37
+ KeyManager,
38
+ MaintenanceManager,
39
+ PgKeyRotation,
40
+ PgMailboxRepository,
26
41
  PgSearchIndex,
27
42
  PgStateStore,
43
+ PgStoreRepository,
28
44
  RedisDeviceRouterBackend,
29
- SqliteSearchIndex,
30
- SqliteStateStore,
31
- configFromEnv,
32
- createDataObjectStore,
33
- createTbServer
45
+ StorageManager,
46
+ createManagedServer,
47
+ createS3ObjectStore,
48
+ createTbServer,
49
+ probeS3ObjectStore,
50
+ runtimeAppSettings
34
51
  };
@@ -1,48 +1,49 @@
1
1
  import {
2
2
  createProviderHttpClient
3
- } from "./chunk-E6JCVKW6.js";
3
+ } from "./chunk-BNMLA2RC.js";
4
4
  import "./chunk-JXHMDBAY.js";
5
5
  import {
6
6
  createProviderPlugin,
7
7
  requireApiKey,
8
8
  upstreamError
9
- } from "./chunk-ATK45BXV.js";
10
- import "./chunk-U7B6DS2O.js";
9
+ } from "./chunk-X7ZUTKHR.js";
10
+ import "./chunk-7ISGFRC6.js";
11
+ import "./chunk-UY6ANCOY.js";
11
12
  import {
12
- TBError,
13
- external_exports
14
- } from "./chunk-UZM2RXZH.js";
13
+ TBError
14
+ } from "./chunk-HA4BGL6C.js";
15
15
  import "./chunk-U67V476Y.js";
16
16
 
17
17
  // ../plugins/src/ip2proxy/schema.ts
18
- var lookupIpInput = external_exports.strictObject({
19
- ip: external_exports.union([external_exports.ipv4().describe("The IPv4 address to look up."), external_exports.ipv6().describe("The IPv6 address to look up.")]).describe("The IPv4 or IPv6 address to look up.").optional(),
20
- package: external_exports.enum(["PX1", "PX2", "PX3", "PX4", "PX5", "PX6", "PX7", "PX8", "PX9", "PX10", "PX11"]).default("PX1").describe("The IP2Proxy package code to query. The official API defaults to PX1 when omitted.").optional()
18
+ import { z } from "zod/v4";
19
+ var lookupIpInput = z.strictObject({
20
+ ip: z.union([z.ipv4().describe("The IPv4 address to look up."), z.ipv6().describe("The IPv6 address to look up.")]).describe("The IPv4 or IPv6 address to look up.").optional(),
21
+ package: z.enum(["PX1", "PX2", "PX3", "PX4", "PX5", "PX6", "PX7", "PX8", "PX9", "PX10", "PX11"]).default("PX1").describe("The IP2Proxy package code to query. The official API defaults to PX1 when omitted.").optional()
21
22
  }).describe("The input payload for one proxy detection lookup.");
22
- var lookupIpOutput = external_exports.looseObject({
23
- response: external_exports.string().min(1).describe("The response status string returned by IP2Proxy."),
24
- countryCode: external_exports.string().describe("The two-character ISO 3166 country code.").optional(),
25
- countryName: external_exports.string().describe("The country name.").optional(),
26
- regionName: external_exports.string().describe("The region or state name.").optional(),
27
- cityName: external_exports.string().describe("The city name.").optional(),
28
- isp: external_exports.string().describe("The ISP or company name.").optional(),
29
- domain: external_exports.string().describe("The internet domain associated with the IP range.").optional(),
30
- usageType: external_exports.string().describe("The usage type classification returned by IP2Proxy.").optional(),
31
- asn: external_exports.string().describe("The autonomous system number.").optional(),
32
- as: external_exports.string().describe("The autonomous system name.").optional(),
33
- lastSeen: external_exports.int().describe("How many days ago the proxy was last seen.").optional(),
34
- proxyType: external_exports.string().describe("The proxy type returned by IP2Proxy.").optional(),
35
- isProxy: external_exports.string().describe("Whether the IP address is identified as a proxy.").optional(),
36
- threat: external_exports.string().describe("The security threat classification returned by IP2Proxy.").optional(),
37
- provider: external_exports.string().describe("The VPN provider name when IP2Proxy has one.").optional(),
38
- creditsConsumed: external_exports.int().describe("The credit count consumed by the query.").optional()
23
+ var lookupIpOutput = z.looseObject({
24
+ response: z.string().min(1).describe("The response status string returned by IP2Proxy."),
25
+ countryCode: z.string().describe("The two-character ISO 3166 country code.").optional(),
26
+ countryName: z.string().describe("The country name.").optional(),
27
+ regionName: z.string().describe("The region or state name.").optional(),
28
+ cityName: z.string().describe("The city name.").optional(),
29
+ isp: z.string().describe("The ISP or company name.").optional(),
30
+ domain: z.string().describe("The internet domain associated with the IP range.").optional(),
31
+ usageType: z.string().describe("The usage type classification returned by IP2Proxy.").optional(),
32
+ asn: z.string().describe("The autonomous system number.").optional(),
33
+ as: z.string().describe("The autonomous system name.").optional(),
34
+ lastSeen: z.int().describe("How many days ago the proxy was last seen.").optional(),
35
+ proxyType: z.string().describe("The proxy type returned by IP2Proxy.").optional(),
36
+ isProxy: z.string().describe("Whether the IP address is identified as a proxy.").optional(),
37
+ threat: z.string().describe("The security threat classification returned by IP2Proxy.").optional(),
38
+ provider: z.string().describe("The VPN provider name when IP2Proxy has one.").optional(),
39
+ creditsConsumed: z.int().describe("The credit count consumed by the query.").optional()
39
40
  }).describe("The proxy detection payload returned by IP2Proxy.");
40
41
  var ip2proxyActions = {
41
42
  lookup_ip: {
42
43
  description: "Detect whether one IPv4 or IPv6 address is a proxy and return the official IP2Proxy lookup payload.",
43
44
  effect: "write",
44
45
  inputSchema: lookupIpInput,
45
- outputSchema: external_exports.toJSONSchema(lookupIpOutput, { io: "output", unrepresentable: "any" })
46
+ outputSchema: z.toJSONSchema(lookupIpOutput, { io: "output", unrepresentable: "any" })
46
47
  }
47
48
  };
48
49
 
@@ -0,0 +1,315 @@
1
+ import {
2
+ createProviderHttpClient
3
+ } from "./chunk-BNMLA2RC.js";
4
+ import {
5
+ asJsonObject
6
+ } from "./chunk-JXHMDBAY.js";
7
+ import {
8
+ createProviderPlugin,
9
+ requireApiKey,
10
+ upstreamError
11
+ } from "./chunk-X7ZUTKHR.js";
12
+ import "./chunk-7ISGFRC6.js";
13
+ import "./chunk-UY6ANCOY.js";
14
+ import "./chunk-HA4BGL6C.js";
15
+ import "./chunk-U67V476Y.js";
16
+
17
+ // ../plugins/src/ipgeolocation_io/api.ts
18
+ var SERVICE = "ipgeolocation_io";
19
+ var API_BASE = "https://api.ipgeolocation.io/";
20
+ var REQUEST_TIMEOUT_MS = 3e4;
21
+ var http = createProviderHttpClient({ baseUrl: API_BASE, service: SERVICE });
22
+ function nullableString(value) {
23
+ if (typeof value === "string") return value;
24
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
25
+ return null;
26
+ }
27
+ function nullableNumber(value) {
28
+ if (typeof value === "number" && Number.isFinite(value)) return value;
29
+ if (typeof value === "string" && value.trim() !== "") {
30
+ const parsed = Number(value);
31
+ return Number.isFinite(parsed) ? parsed : null;
32
+ }
33
+ return null;
34
+ }
35
+ function nullableInteger(value) {
36
+ const parsed = nullableNumber(value);
37
+ return parsed !== null && Number.isInteger(parsed) ? parsed : null;
38
+ }
39
+ function errorMessage(payload, status) {
40
+ if (typeof payload === "string" && payload.trim() !== "") return payload;
41
+ const record = asJsonObject(payload);
42
+ const message = record?.message ?? record?.error;
43
+ if (typeof message === "string" && message.trim() !== "") return message;
44
+ return `IPGeolocation.io request failed with status ${status}`;
45
+ }
46
+ async function request(ctx, path, params) {
47
+ const { data: payload } = await http.request({
48
+ path,
49
+ method: "GET",
50
+ query: [["apiKey", requireApiKey(ctx, SERVICE)], ...Object.entries(params)],
51
+ headers: { accept: "application/json" },
52
+ timeoutMs: REQUEST_TIMEOUT_MS,
53
+ invalidJsonMessage: "IPGeolocation.io returned invalid JSON",
54
+ mapError: ({ bodyKind, data, status }) => {
55
+ if (bodyKind === "invalid-json") return upstreamError(502, "IPGeolocation.io returned invalid JSON");
56
+ const normalized = status === 429 || status === 401 || status === 403 ? status : status >= 400 && status < 500 ? 400 : status || 500;
57
+ return upstreamError(normalized, errorMessage(data, status));
58
+ },
59
+ mapTransportError: ({ kind }) => kind === "timeout" ? upstreamError(504, "IPGeolocation.io request timed out") : upstreamError(502, "IPGeolocation.io request failed")
60
+ });
61
+ const record = asJsonObject(payload);
62
+ if (record === void 0) throw upstreamError(502, "IPGeolocation.io returned an invalid payload");
63
+ return record;
64
+ }
65
+ function joinList(value) {
66
+ if (value === void 0) return void 0;
67
+ const items = value.map((item) => item.trim()).filter((item) => item !== "");
68
+ return items.length === 0 ? void 0 : items.join(",");
69
+ }
70
+ function numberParam(value) {
71
+ return typeof value === "number" && Number.isFinite(value) ? String(value) : void 0;
72
+ }
73
+ async function lookupIp(input, ctx) {
74
+ const includes = [
75
+ input.includeHostname === true ? "hostname" : void 0,
76
+ input.includeGeoAccuracy === true ? "geo_accuracy" : void 0,
77
+ input.includeDmaCode === true ? "dma_code" : void 0,
78
+ input.includeSecurity === true ? "security" : void 0,
79
+ input.includeAbuse === true ? "abuse" : void 0,
80
+ input.includeUserAgent === true ? "user_agent" : void 0
81
+ ].filter((item) => item !== void 0);
82
+ const payload = await request(ctx, "v3/ipgeo", {
83
+ ip: input.ip,
84
+ fields: joinList(input.fields),
85
+ excludes: joinList(input.excludes),
86
+ include: includes.length > 0 ? includes.join(",") : void 0
87
+ });
88
+ const location = asJsonObject(payload.location) ?? payload;
89
+ return {
90
+ geolocation: {
91
+ ip: nullableString(payload.ip),
92
+ hostname: nullableString(payload.hostname),
93
+ continentCode: nullableString(location.continent_code),
94
+ continentName: nullableString(location.continent_name),
95
+ countryCode2: nullableString(location.country_code2),
96
+ countryCode3: nullableString(location.country_code3),
97
+ countryName: nullableString(location.country_name),
98
+ stateProvince: nullableString(location.state_prov),
99
+ district: nullableString(location.district),
100
+ city: nullableString(location.city),
101
+ zipcode: nullableString(location.zipcode),
102
+ latitude: nullableNumber(location.latitude),
103
+ longitude: nullableNumber(location.longitude),
104
+ callingCode: nullableString(asJsonObject(payload.country_metadata)?.calling_code),
105
+ countryFlag: nullableString(location.country_flag),
106
+ countryMetadata: asJsonObject(payload.country_metadata) ?? null,
107
+ network: asJsonObject(payload.network) ?? null,
108
+ asn: asJsonObject(payload.asn) ?? null,
109
+ company: asJsonObject(payload.company) ?? null,
110
+ timeZone: asJsonObject(payload.time_zone) ?? null,
111
+ currency: asJsonObject(payload.currency) ?? null,
112
+ security: asJsonObject(payload.security) ?? null,
113
+ abuse: asJsonObject(payload.abuse) ?? null,
114
+ userAgent: asJsonObject(payload.user_agent) ?? null,
115
+ raw: payload
116
+ }
117
+ };
118
+ }
119
+ async function getTimezone(input, ctx) {
120
+ const payload = await request(ctx, "v3/timezone", {
121
+ ip: input.ip,
122
+ lat: numberParam(input.lat),
123
+ long: numberParam(input.long),
124
+ location: input.location,
125
+ // 入参叫 timeZone,上游 query 叫 tz。
126
+ tz: input.timeZone
127
+ });
128
+ return {
129
+ timeZone: {
130
+ timeZone: nullableString(payload.timezone),
131
+ date: nullableString(payload.date),
132
+ dateTime: nullableString(payload.date_time),
133
+ dateTimeTxt: nullableString(payload.date_time_txt),
134
+ dateTimeWti: nullableString(payload.date_time_wti),
135
+ dateTimeYmd: nullableString(payload.date_time_ymd),
136
+ dateTimeUnix: nullableNumber(payload.date_time_unix),
137
+ time24: nullableString(payload.time_24),
138
+ time12: nullableString(payload.time_12),
139
+ week: nullableInteger(payload.week),
140
+ month: nullableInteger(payload.month),
141
+ year: nullableInteger(payload.year),
142
+ yearAbbr: nullableString(payload.year_abbr),
143
+ isDst: typeof payload.is_dst === "boolean" ? payload.is_dst : null,
144
+ dstSavings: nullableInteger(payload.dst_savings),
145
+ geo: asJsonObject(payload.geo) ?? null,
146
+ raw: payload
147
+ }
148
+ };
149
+ }
150
+ async function getAstronomy(input, ctx) {
151
+ const payload = await request(ctx, "v3/astronomy", {
152
+ ip: input.ip,
153
+ lat: numberParam(input.lat),
154
+ long: numberParam(input.long),
155
+ location: input.location,
156
+ date: input.date
157
+ });
158
+ return {
159
+ astronomy: {
160
+ location: asJsonObject(payload.location) ?? null,
161
+ date: nullableString(payload.date),
162
+ currentTime: nullableString(payload.current_time),
163
+ sunrise: nullableString(payload.sunrise),
164
+ sunset: nullableString(payload.sunset),
165
+ sunStatus: nullableString(payload.sun_status),
166
+ solarNoon: nullableString(payload.solar_noon),
167
+ dayLength: nullableString(payload.day_length),
168
+ moonrise: nullableString(payload.moonrise),
169
+ moonset: nullableString(payload.moonset),
170
+ moonStatus: nullableString(payload.moon_status),
171
+ moonPhase: nullableString(payload.moon_phase),
172
+ moonIlluminationPercentage: nullableNumber(payload.moon_illumination_percentage),
173
+ moonAngle: nullableNumber(payload.moon_angle),
174
+ raw: payload
175
+ }
176
+ };
177
+ }
178
+
179
+ // ../plugins/src/ipgeolocation_io/schema.ts
180
+ import { z } from "zod/v4";
181
+ var lookupIpInput = z.strictObject({
182
+ ip: z.string().min(1).regex(new RegExp("\\S")).describe("The IPv4 or IPv6 address to look up.").optional(),
183
+ fields: z.array(z.string().min(1).describe("One IPGeolocation.io field name.")).min(1).describe("Specific response fields to request from IPGeolocation.io.").optional(),
184
+ excludes: z.array(z.string().min(1).describe("One IPGeolocation.io field name.")).min(1).describe("Specific response fields to exclude from the IPGeolocation.io response.").optional(),
185
+ includeHostname: z.boolean().describe("Whether to include hostname data in the geolocation response.").optional(),
186
+ includeGeoAccuracy: z.boolean().describe("Whether to include geo accuracy fields in the geolocation response.").optional(),
187
+ includeDmaCode: z.boolean().describe("Whether to include DMA code fields in the geolocation response.").optional(),
188
+ includeSecurity: z.boolean().describe("Whether to include security threat intelligence fields.").optional(),
189
+ includeAbuse: z.boolean().describe("Whether to include abuse contact fields.").optional(),
190
+ includeUserAgent: z.boolean().describe("Whether to include user-agent derived fields when supported.").optional()
191
+ }).describe("The input payload for looking up an IP address.");
192
+ var lookupIpOutput = z.strictObject({
193
+ geolocation: z.strictObject({
194
+ ip: z.string().describe("The queried IP address.").nullable().optional(),
195
+ hostname: z.string().describe("The hostname associated with the IP address when returned.").nullable().optional(),
196
+ continentCode: z.string().describe("The continent code.").nullable().optional(),
197
+ continentName: z.string().describe("The continent name.").nullable().optional(),
198
+ countryCode2: z.string().describe("The ISO 3166-1 alpha-2 country code.").nullable().optional(),
199
+ countryCode3: z.string().describe("The ISO 3166-1 alpha-3 country code.").nullable().optional(),
200
+ countryName: z.string().describe("The country name.").nullable().optional(),
201
+ stateProvince: z.string().describe("The state or province name.").nullable().optional(),
202
+ district: z.string().describe("The district name.").nullable().optional(),
203
+ city: z.string().describe("The city name.").nullable().optional(),
204
+ zipcode: z.string().describe("The postal code.").nullable().optional(),
205
+ latitude: z.number().describe("The latitude returned by IPGeolocation.io.").nullable().optional(),
206
+ longitude: z.number().describe("The longitude returned by IPGeolocation.io.").nullable().optional(),
207
+ callingCode: z.string().describe("The international calling code.").nullable().optional(),
208
+ countryFlag: z.string().describe("The country flag URL or emoji field returned by IPGeolocation.io.").nullable().optional(),
209
+ countryMetadata: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
210
+ network: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
211
+ asn: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
212
+ company: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
213
+ timeZone: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
214
+ currency: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
215
+ security: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
216
+ abuse: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
217
+ userAgent: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
218
+ raw: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").optional()
219
+ }).describe("The normalized IP geolocation result.").optional()
220
+ }).describe("The response returned when looking up an IP address.");
221
+ var getTimezoneInput = z.strictObject({
222
+ ip: z.string().min(1).regex(new RegExp("\\S")).describe("The IPv4 or IPv6 address to look up.").optional(),
223
+ lat: z.number().min(-90).max(90).describe("The latitude coordinate.").optional(),
224
+ long: z.number().min(-180).max(180).describe("The longitude coordinate.").optional(),
225
+ location: z.string().min(1).regex(new RegExp("\\S")).describe("The location string accepted by IPGeolocation.io.").optional(),
226
+ timeZone: z.string().min(1).regex(new RegExp("\\S")).describe("The IANA time zone name.").optional()
227
+ }).describe("The input payload for getting IPGeolocation.io time zone data.");
228
+ var getTimezoneOutput = z.strictObject({
229
+ timeZone: z.strictObject({
230
+ timeZone: z.string().describe("The IANA time zone name.").nullable().optional(),
231
+ date: z.string().describe("The date returned by IPGeolocation.io.").nullable().optional(),
232
+ dateTime: z.string().describe("The local date and time string.").nullable().optional(),
233
+ dateTimeTxt: z.string().describe("The formatted local date and time text.").nullable().optional(),
234
+ dateTimeWti: z.string().describe("The local date and time with time zone information.").nullable().optional(),
235
+ dateTimeYmd: z.string().describe("The local date in YYYY-MM-DD format.").nullable().optional(),
236
+ dateTimeUnix: z.number().describe("The local date and time as a Unix timestamp when returned.").nullable().optional(),
237
+ time24: z.string().describe("The 24-hour local time string.").nullable().optional(),
238
+ time12: z.string().describe("The 12-hour local time string.").nullable().optional(),
239
+ week: z.int().describe("The week number.").nullable().optional(),
240
+ month: z.int().describe("The month number.").nullable().optional(),
241
+ year: z.int().describe("The year.").nullable().optional(),
242
+ yearAbbr: z.string().describe("The abbreviated year.").nullable().optional(),
243
+ isDst: z.boolean().describe("Whether daylight saving time is active.").nullable().optional(),
244
+ dstSavings: z.int().describe("The daylight saving time offset in seconds.").nullable().optional(),
245
+ geo: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
246
+ raw: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").optional()
247
+ }).describe("The normalized IPGeolocation.io time zone result.").optional()
248
+ }).describe("The response returned when getting time zone data.");
249
+ var getAstronomyInput = z.strictObject({
250
+ ip: z.string().min(1).regex(new RegExp("\\S")).describe("The IPv4 or IPv6 address to look up.").optional(),
251
+ lat: z.number().min(-90).max(90).describe("The latitude coordinate.").optional(),
252
+ long: z.number().min(-180).max(180).describe("The longitude coordinate.").optional(),
253
+ location: z.string().min(1).regex(new RegExp("\\S")).describe("The location string accepted by IPGeolocation.io.").optional(),
254
+ date: z.iso.date().describe("The date to use for astronomy data in YYYY-MM-DD format.").optional()
255
+ }).describe("The input payload for getting IPGeolocation.io astronomy data.");
256
+ var getAstronomyOutput = z.strictObject({
257
+ astronomy: z.strictObject({
258
+ location: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
259
+ date: z.string().describe("The date used for the astronomy result.").nullable().optional(),
260
+ currentTime: z.string().describe("The current local time returned by IPGeolocation.io.").nullable().optional(),
261
+ sunrise: z.string().describe("The sunrise time.").nullable().optional(),
262
+ sunset: z.string().describe("The sunset time.").nullable().optional(),
263
+ sunStatus: z.string().describe("The current sun status when returned.").nullable().optional(),
264
+ solarNoon: z.string().describe("The solar noon time.").nullable().optional(),
265
+ dayLength: z.string().describe("The day length.").nullable().optional(),
266
+ moonrise: z.string().describe("The moonrise time.").nullable().optional(),
267
+ moonset: z.string().describe("The moonset time.").nullable().optional(),
268
+ moonStatus: z.string().describe("The current moon status when returned.").nullable().optional(),
269
+ moonPhase: z.string().describe("The moon phase name.").nullable().optional(),
270
+ moonIlluminationPercentage: z.number().describe("The moon illumination percentage when returned.").nullable().optional(),
271
+ moonAngle: z.number().describe("The moon angle when returned.").nullable().optional(),
272
+ raw: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").optional()
273
+ }).describe("The normalized IPGeolocation.io astronomy result.").optional()
274
+ }).describe("The response returned when getting astronomy data.");
275
+ var ipgeolocationIoActions = {
276
+ lookup_ip: {
277
+ description: "Look up IP geolocation data with optional field controls.",
278
+ effect: "write",
279
+ inputSchema: lookupIpInput,
280
+ outputSchema: z.toJSONSchema(lookupIpOutput, { io: "output", unrepresentable: "any" })
281
+ },
282
+ get_timezone: {
283
+ description: "Get time zone information by IP address, coordinates, location, or time zone name.",
284
+ effect: "read",
285
+ inputSchema: getTimezoneInput,
286
+ outputSchema: z.toJSONSchema(getTimezoneOutput, { io: "output", unrepresentable: "any" })
287
+ },
288
+ get_astronomy: {
289
+ description: "Get sunrise, sunset, moonrise, moonset, and moon phase data for a location.",
290
+ effect: "read",
291
+ inputSchema: getAstronomyInput,
292
+ outputSchema: z.toJSONSchema(getAstronomyOutput, { io: "output", unrepresentable: "any" })
293
+ }
294
+ };
295
+
296
+ // ../plugins/src/ipgeolocation_io/index.ts
297
+ function createIpgeolocationIoPlugin() {
298
+ return createProviderPlugin({
299
+ description: "IPGeolocation.io",
300
+ actions: ipgeolocationIoActions,
301
+ // 上游的 credentialValidator 打的是 /v3/ipgeo,但 lookup_ip 的 effect 被播种成 write,
302
+ // 不能当探针。get_timezone 同样只读、无必填入参、同一把 key,等效且合规。
303
+ credentialProbe: "get_timezone",
304
+ handlers: {
305
+ lookup_ip: lookupIp,
306
+ get_timezone: getTimezone,
307
+ get_astronomy: getAstronomy
308
+ }
309
+ });
310
+ }
311
+ var ipgeolocation_io_default = createIpgeolocationIoPlugin();
312
+ export {
313
+ createIpgeolocationIoPlugin,
314
+ ipgeolocation_io_default as default
315
+ };