@tool-bridge/server 0.21.1 → 0.23.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 (178) hide show
  1. package/dist/admin.js +170 -0
  2. package/dist/airtable-VMQVXLHK.js +790 -0
  3. package/dist/{alt_text_generator_ai-W7O34SNG.js → alt_text_generator_ai-FTWY4RU4.js} +12 -11
  4. package/dist/{amap-VOX4T2AW.js → amap-OK5VBHYC.js} +221 -220
  5. package/dist/anthropic-S67AZFZ3.js +203 -0
  6. package/dist/apify-ZE6MYQI3.js +248 -0
  7. package/dist/brave_search-TG2M2KOD.js +302 -0
  8. package/dist/chunk-2JNAI4OC.js +161 -0
  9. package/dist/{chunk-KMTT3I6D.js → chunk-4XJPN3DY.js} +19392 -26136
  10. package/dist/chunk-5ICRY3VU.js +8432 -0
  11. package/dist/chunk-7CTWGTDU.js +302 -0
  12. package/dist/chunk-BADVCN6K.js +378 -0
  13. package/dist/{chunk-XYBU3WZH.js → chunk-TDAWLMDE.js} +3 -3
  14. package/dist/chunk-U7PTOA3U.js +7320 -0
  15. package/dist/{chunk-E6JCVKW6.js → chunk-VWRUGUSU.js} +3 -3
  16. package/dist/{chunk-ATK45BXV.js → chunk-WJHG6OK7.js} +4 -2
  17. package/dist/circleci-3L3WJVSK.js +389 -0
  18. package/dist/clerk-EZPF2V7T.js +1019 -0
  19. package/dist/cohere-U27DPO64.js +185 -0
  20. package/dist/{confluence-B3EWPZVE.js → confluence-G2KL6ERH.js} +105 -104
  21. package/dist/{convertapi-EUWSQYPF.js → convertapi-L4CLJ2M3.js} +32 -31
  22. package/dist/{currencyapi-KVTIK3GL.js → currencyapi-YPYXG7YY.js} +71 -71
  23. package/dist/deepseek-6HT6WF3M.js +210 -0
  24. package/dist/docker_hub-LPE3PCVB.js +933 -0
  25. package/dist/dropbox-V56ABHTA.js +1305 -0
  26. package/dist/dub-6OKQ7MHT.js +680 -0
  27. package/dist/e2b-JS2U2QFU.js +278 -0
  28. package/dist/exa-DPWVYXSP.js +332 -0
  29. package/dist/{fal_ai-23E7JPNT.js → fal_ai-DK6Y27ZF.js} +81 -80
  30. package/dist/{feishu-7QRIDUV6.js → feishu-K7EGSRF3.js} +528 -572
  31. package/dist/{feishu_custom_bot-TJ4K7QNJ.js → feishu_custom_bot-2JUGFYNG.js} +57 -53
  32. package/dist/figma-FT5I7ITD.js +777 -0
  33. package/dist/firehydrant-EIKLKHX2.js +563 -0
  34. package/dist/{fixer-BWON27UO.js → fixer-U5QXIAKD.js} +34 -33
  35. package/dist/fly-T3JYFZ2M.js +469 -0
  36. package/dist/{front-QCGXYEDJ.js → front-D72MGVOR.js} +104 -104
  37. package/dist/geocodio-BOTD5TI5.js +213 -0
  38. package/dist/ghost-KYP7SZGB.js +338 -0
  39. package/dist/github-AGMZT3VY.js +5421 -0
  40. package/dist/gmail-BLJNJOBG.js +1887 -0
  41. package/dist/googlecalendar-GTHWNCF6.js +2524 -0
  42. package/dist/{googledocs-BUHL4J2H.js → googledocs-6EEDMEBQ.js} +341 -340
  43. package/dist/{grafana-GLU2DWF2.js → grafana-GMW6EKSQ.js} +221 -220
  44. package/dist/graphhopper-6OLGBDGB.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-4QN42E6T.js} +28 -27
  48. package/dist/ipgeolocation_io-SK4XKDA2.js +315 -0
  49. package/dist/ipqualityscore-6ANBPXKT.js +279 -0
  50. package/dist/{jina_ai-EFBHTBXL.js → jina_ai-IHPSVRM5.js} +23 -23
  51. package/dist/{jira-HQSHAA5K.js → jira-46KKM4LC.js} +118 -117
  52. package/dist/langsmith-JZA345I5.js +593 -0
  53. package/dist/lemlist-43IV7DK6.js +289 -0
  54. package/dist/{linear-K7RYFYAD.js → linear-5LFH7XNL.js} +327 -326
  55. package/dist/logsnag-5RMYAHIL.js +150 -0
  56. package/dist/main.js +57 -280
  57. package/dist/{mattermost-S2BRCWLQ.js → mattermost-XFL6SHGG.js} +59 -58
  58. package/dist/mem0-NYO4DTP6.js +544 -0
  59. package/dist/memos-37MPQOLV.js +744 -0
  60. package/dist/{metabase-MMSEPCOF.js → metabase-KYBKZFMG.js} +90 -89
  61. package/dist/mistral_ai-6PL3K4PM.js +1196 -0
  62. package/dist/{mother_duck-H7PCQNZ2.js → mother_duck-2NH7W5M5.js} +94 -93
  63. package/dist/ngrok-UO6CDYCA.js +356 -0
  64. package/dist/{notes-PFMKRO33.js → notes-I3P32WP4.js} +11 -9
  65. package/dist/notion-BEAJFUOE.js +940 -0
  66. package/dist/open_exchange_rates-CMF62JB4.js +215 -0
  67. package/dist/openai-IHOMKVND.js +800 -0
  68. package/dist/opengraph_io-ZQ2FGLHX.js +362 -0
  69. package/dist/openrouter-HXLW3NR5.js +441 -0
  70. package/dist/outline-ELCP4NEU.js +599 -0
  71. package/dist/paddle-O77LALVN.js +454 -0
  72. package/dist/perplexity-JCU654QV.js +220 -0
  73. package/dist/pinecone-W5W4LRKL.js +571 -0
  74. package/dist/{pipedrive-Y2O7QGFF.js → pipedrive-ITMJLLPZ.js} +99 -98
  75. package/dist/polar-R33XU4L3.js +395 -0
  76. package/dist/posthog-JVNTOLTV.js +3464 -0
  77. package/dist/postmark-6SBG7HWV.js +427 -0
  78. package/dist/{prerender-MENYM2TY.js → prerender-GPNKTNFC.js} +31 -30
  79. package/dist/{pubmed-GOXUVVH5.js → pubmed-UP6ZEEIH.js} +239 -238
  80. package/dist/{railway-V2SID4WV.js → railway-KWEWXHTY.js} +118 -117
  81. package/dist/readwise-BLATSMC3.js +470 -0
  82. package/dist/render-QYRVIXII.js +461 -0
  83. package/dist/{replicate-756MXPYX.js → replicate-JYTWH4NF.js} +81 -80
  84. package/dist/{resend-ZKH3BTBI.js → resend-L5N75SZM.js} +20 -16
  85. package/dist/rootly-MHCPEQ26.js +336 -0
  86. package/dist/{scrapfly-NSRHFDIQ.js → scrapfly-PTPGYSJM.js} +62 -61
  87. package/dist/{scrapingbee-OQHLAVEY.js → scrapingbee-JN6UH5PY.js} +56 -56
  88. package/dist/{screenshot_fyi-DVWG3AXC.js → screenshot_fyi-4QRVSV55.js} +16 -16
  89. package/dist/semantic_scholar-LRSWA2GE.js +611 -0
  90. package/dist/{sentry-546MNDJG.js → sentry-2G6PF5W6.js} +208 -207
  91. package/dist/{shodan-C3OON3Z3.js → shodan-WKKPP5C6.js} +62 -61
  92. package/dist/shopify-64YDK5T2.js +610 -0
  93. package/dist/stripe-QAIGGOTF.js +585 -0
  94. package/dist/{supabase-U2SL4D63.js → supabase-WHTGR6ND.js} +245 -244
  95. package/dist/tavily-QIXCDDWO.js +326 -0
  96. package/dist/telegram-E6G7CWI6.js +1767 -0
  97. package/dist/{telnyx-CXQ4EZUX.js → telnyx-ZDVVS7PK.js} +57 -56
  98. package/dist/todoist-DMYF3G7J.js +664 -0
  99. package/dist/trello-HY2RYIRP.js +1080 -0
  100. package/dist/turso-HAQWMGRP.js +416 -0
  101. package/dist/{twilio-4PDBJKWX.js → twilio-MLXYPHJE.js} +70 -69
  102. package/dist/umami-DZHBLPVG.js +389 -0
  103. package/dist/unsplash-GS2OPXKE.js +351 -0
  104. package/dist/{upstash_redis-G4LQBYHA.js → upstash_redis-XMXWTNAJ.js} +51 -50
  105. package/dist/uptimerobot-TF5WRZ4G.js +483 -0
  106. package/dist/v2ex-2BVXAPDF.js +667 -0
  107. package/dist/vercel-YMJGQYJE.js +1076 -0
  108. package/dist/{wolfram_alpha_api-3G4PUJWB.js → wolfram_alpha_api-I56SXWFZ.js} +36 -35
  109. package/dist/wordpress-R7TDFZ2P.js +812 -0
  110. package/dist/workos-HDNHWVMS.js +664 -0
  111. package/dist/zhihu-LX6AGGDS.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
@@ -0,0 +1,1305 @@
1
+ import {
2
+ bytesToBase64
3
+ } from "./chunk-LMLX3DJF.js";
4
+ import {
5
+ createAuthedClient
6
+ } from "./chunk-TDAWLMDE.js";
7
+ import "./chunk-VWRUGUSU.js";
8
+ import {
9
+ asJsonObject,
10
+ booleanValue,
11
+ compactDefined,
12
+ finiteNumber,
13
+ trimmedText
14
+ } from "./chunk-JXHMDBAY.js";
15
+ import {
16
+ createProviderPlugin,
17
+ requireApiKey,
18
+ upstreamError
19
+ } from "./chunk-WJHG6OK7.js";
20
+ import {
21
+ guardedFetch
22
+ } from "./chunk-2JNAI4OC.js";
23
+ import "./chunk-BADVCN6K.js";
24
+ import {
25
+ TBError
26
+ } from "./chunk-5ICRY3VU.js";
27
+ import "./chunk-U67V476Y.js";
28
+
29
+ // ../plugins/src/dropbox/api.ts
30
+ var SERVICE = "dropbox";
31
+ var API_BASE = "https://api.dropboxapi.com/2";
32
+ var CONTENT_BASE = "https://content.dropboxapi.com/2";
33
+ var http = createAuthedClient({ baseUrl: `${API_BASE}/`, service: SERVICE, auth: { kind: "bearer" } });
34
+ var MAX_SIMPLE_UPLOAD_BYTES = 150 * 1024 * 1024;
35
+ var DEFAULT_MIME_TYPE = "application/octet-stream";
36
+ function objectArray(value) {
37
+ if (!Array.isArray(value)) return [];
38
+ return value.map((item) => asJsonObject(item)).filter((item) => item !== void 0);
39
+ }
40
+ function stringArray(value) {
41
+ if (!Array.isArray(value)) return void 0;
42
+ const items = value.filter((item) => typeof item === "string" && item !== "");
43
+ return items.length > 0 ? items : void 0;
44
+ }
45
+ function contractError(label) {
46
+ return new TBError("unavailable", `Dropbox \u54CD\u5E94\u7F3A\u5C11 ${label}`, { retryable: true });
47
+ }
48
+ function requiredText(value, label) {
49
+ const result = trimmedText(value);
50
+ if (result === void 0) throw contractError(label);
51
+ return result;
52
+ }
53
+ function requiredRecord(value, label) {
54
+ const result = asJsonObject(value);
55
+ if (result === void 0) throw contractError(label);
56
+ return result;
57
+ }
58
+ function required(value, field) {
59
+ const result = trimmedText(value);
60
+ if (result === void 0) throw new TBError("invalid_argument", `${field} \u4E0D\u80FD\u4E3A\u7A7A`);
61
+ return result;
62
+ }
63
+ function base64ToBytes(value) {
64
+ let binary;
65
+ try {
66
+ binary = atob(value);
67
+ } catch {
68
+ throw new TBError("invalid_argument", "contentBase64 \u4E0D\u662F\u5408\u6CD5\u7684 base64");
69
+ }
70
+ const bytes = new Uint8Array(binary.length);
71
+ for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);
72
+ return bytes;
73
+ }
74
+ function trimSummary(value) {
75
+ return value.endsWith("/...") ? value.slice(0, -4) : value;
76
+ }
77
+ function dropboxError(status, discriminator, message) {
78
+ const tag = discriminator ?? "";
79
+ if (/expired_access_token|invalid_access_token/.test(tag)) return upstreamError(401, message);
80
+ if (/too_many_requests|too_many_write_operations/.test(tag)) return upstreamError(429, message);
81
+ if (/not_found/.test(tag)) return upstreamError(404, message);
82
+ if (/conflict/.test(tag)) return upstreamError(409, message);
83
+ if (/no_permission|access_denied|not_allowed|no_write_permission/.test(tag)) {
84
+ return upstreamError(403, message);
85
+ }
86
+ return upstreamError(status, message);
87
+ }
88
+ async function readError(response, fallback) {
89
+ const contentType = response.headers.get("content-type") ?? "";
90
+ if (!contentType.includes("application/json")) {
91
+ const raw = (await response.text()).trim();
92
+ return dropboxError(response.status, void 0, raw === "" ? fallback : raw);
93
+ }
94
+ let payload;
95
+ try {
96
+ payload = asJsonObject(JSON.parse(await response.text()));
97
+ } catch {
98
+ payload = void 0;
99
+ }
100
+ const summary = trimmedText(payload?.error_summary);
101
+ const tag = trimmedText(asJsonObject(payload?.error)?.[".tag"]);
102
+ const message = summary === void 0 ? tag ?? fallback : trimSummary(summary);
103
+ return dropboxError(response.status, summary ?? tag, message);
104
+ }
105
+ function authHeader(ctx) {
106
+ return `Bearer ${requireApiKey(ctx, SERVICE)}`;
107
+ }
108
+ function rpcError(context, fallback) {
109
+ if (!context.headers.get("content-type")?.includes("application/json")) {
110
+ const raw = context.rawText?.trim();
111
+ return dropboxError(context.status, void 0, raw === void 0 || raw === "" ? fallback : raw);
112
+ }
113
+ const payload = asJsonObject(context.data);
114
+ const summary = trimmedText(payload?.error_summary);
115
+ const tag = trimmedText(asJsonObject(payload?.error)?.[".tag"]);
116
+ const message = summary === void 0 ? tag ?? fallback : trimSummary(summary);
117
+ return dropboxError(context.status, summary ?? tag, message);
118
+ }
119
+ async function rpc(ctx, route, options = {}) {
120
+ const hasBody = options.body !== void 0;
121
+ const result = await http.request(ctx, {
122
+ path: route,
123
+ method: "POST",
124
+ ...hasBody ? { json: options.body } : {},
125
+ invalidJsonMessage: "Dropbox \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94",
126
+ // fallback 文案含 route,只能逐请求给。
127
+ mapError: (context) => rpcError(context, `Dropbox ${route} \u8C03\u7528\u5931\u8D25`)
128
+ });
129
+ if (result.bodyKind === "empty") {
130
+ if (options.allowEmptyResponse === true) return {};
131
+ throw new TBError("unavailable", `Dropbox ${route} \u8FD4\u56DE\u4E86\u7A7A\u54CD\u5E94`, { retryable: true });
132
+ }
133
+ const parsed = result.data;
134
+ if (parsed === null) return {};
135
+ return requiredRecord(parsed, `${route} \u54CD\u5E94`);
136
+ }
137
+ async function downloadContent(ctx, route, arg, fallbackMessage) {
138
+ const response = await guardedFetch(`${CONTENT_BASE}${route}`, {
139
+ method: "POST",
140
+ headers: {
141
+ "authorization": authHeader(ctx),
142
+ "Dropbox-API-Arg": JSON.stringify(arg)
143
+ }
144
+ });
145
+ if (!response.ok) throw await readError(response, fallbackMessage);
146
+ const raw = response.headers.get("dropbox-api-result");
147
+ if (raw === null || raw === "") {
148
+ throw new TBError("unavailable", "Dropbox \u4E0B\u8F7D\u54CD\u5E94\u7F3A\u5C11 dropbox-api-result \u5934", { retryable: true });
149
+ }
150
+ let parsed;
151
+ try {
152
+ parsed = JSON.parse(raw);
153
+ } catch {
154
+ throw new TBError("unavailable", "Dropbox \u4E0B\u8F7D\u5143\u6570\u636E\u4E0D\u662F\u5408\u6CD5 JSON", { retryable: true });
155
+ }
156
+ return {
157
+ metadata: requiredRecord(parsed, "\u4E0B\u8F7D\u5143\u6570\u636E"),
158
+ contentType: response.headers.get("content-type"),
159
+ bytes: new Uint8Array(await response.arrayBuffer())
160
+ };
161
+ }
162
+ function metadataTag(item) {
163
+ const explicit = trimmedText(item[".tag"]);
164
+ if (explicit !== void 0) return explicit;
165
+ if (booleanValue(item.is_downloadable) !== void 0 || trimmedText(item.rev) !== void 0 || trimmedText(item.content_hash) !== void 0 || finiteNumber(item.size) !== void 0) {
166
+ return "file";
167
+ }
168
+ return "unknown";
169
+ }
170
+ function mapMetadata(value) {
171
+ const item = requiredRecord(value, "\u5143\u6570\u636E");
172
+ return {
173
+ tag: metadataTag(item),
174
+ // 名字缺失时给空串而不是 null:出参契约里 name 是必填 string。
175
+ name: trimmedText(item.name) ?? "",
176
+ id: trimmedText(item.id) ?? null,
177
+ pathDisplay: trimmedText(item.path_display) ?? null,
178
+ pathLower: trimmedText(item.path_lower) ?? null,
179
+ clientModified: trimmedText(item.client_modified) ?? null,
180
+ serverModified: trimmedText(item.server_modified) ?? null,
181
+ rev: trimmedText(item.rev) ?? null,
182
+ sizeBytes: finiteNumber(item.size) ?? null,
183
+ isDownloadable: booleanValue(item.is_downloadable) ?? null,
184
+ contentHash: trimmedText(item.content_hash) ?? null,
185
+ url: trimmedText(item.url) ?? null,
186
+ expiresAt: trimmedText(item.expires) ?? null,
187
+ sharingInfo: asJsonObject(item.sharing_info) ?? null,
188
+ linkPermissions: asJsonObject(item.link_permissions) ?? null
189
+ };
190
+ }
191
+ function listFolderResult(payload) {
192
+ return {
193
+ entries: objectArray(payload.entries).map((entry) => mapMetadata(entry)),
194
+ cursor: requiredText(payload.cursor, "cursor"),
195
+ hasMore: booleanValue(payload.has_more) ?? false
196
+ };
197
+ }
198
+ function searchResult(payload) {
199
+ return {
200
+ matches: objectArray(payload.matches).map((match) => {
201
+ const metadata = asJsonObject(match.metadata) ?? {};
202
+ return {
203
+ matchType: trimmedText(asJsonObject(match.match_type)?.[".tag"]) ?? "unknown",
204
+ // search_v2 的 match.metadata 自己还套一层 metadata;两种形状都接。
205
+ metadata: mapMetadata(asJsonObject(metadata.metadata) ?? metadata),
206
+ highlightSpans: objectArray(match.highlight_spans)
207
+ };
208
+ }),
209
+ cursor: trimmedText(payload.cursor) ?? null,
210
+ hasMore: booleanValue(payload.has_more) ?? false
211
+ };
212
+ }
213
+ function saveUrlResult(payload) {
214
+ const tag = trimmedText(payload[".tag"]) ?? "unknown";
215
+ const metadata = asJsonObject(payload.complete) ?? asJsonObject(payload.metadata) ?? (tag === "complete" ? payload : void 0);
216
+ return {
217
+ tag,
218
+ asyncJobId: trimmedText(payload.async_job_id) ?? null,
219
+ metadata: metadata === void 0 ? null : mapMetadata(metadata),
220
+ failure: asJsonObject(payload.failed) ?? asJsonObject(payload.failure) ?? null
221
+ };
222
+ }
223
+ function downloadResult(downloaded, fileName, action) {
224
+ const metadata = mapMetadata(downloaded.metadata);
225
+ if (metadata.tag !== "file") {
226
+ throw new TBError("invalid_argument", `${action} \u53EA\u80FD\u4E0B\u8F7D\u6587\u4EF6,\u8BE5\u8DEF\u5F84\u4E0D\u662F\u6587\u4EF6`);
227
+ }
228
+ const fileId = metadata.id;
229
+ if (typeof fileId !== "string" || fileId === "") throw contractError("\u4E0B\u8F7D\u5143\u6570\u636E\u91CC\u7684\u6587\u4EF6 id");
230
+ return {
231
+ fileId,
232
+ name: trimmedText(fileName) ?? metadata.name,
233
+ mimeType: trimmedText(downloaded.contentType) ?? DEFAULT_MIME_TYPE,
234
+ sizeBytes: metadata.sizeBytes,
235
+ contentBase64: bytesToBase64(downloaded.bytes)
236
+ };
237
+ }
238
+ async function getCurrentAccount(_input, ctx) {
239
+ const payload = await rpc(ctx, "users/get_current_account");
240
+ const name = asJsonObject(payload.name) ?? {};
241
+ const team = asJsonObject(payload.team) ?? {};
242
+ const accountType = asJsonObject(payload.account_type) ?? {};
243
+ return {
244
+ accountId: requiredText(payload.account_id, "account_id"),
245
+ displayName: requiredText(name.display_name, "name.display_name"),
246
+ abbreviatedName: trimmedText(name.abbreviated_name) ?? null,
247
+ givenName: trimmedText(name.given_name) ?? null,
248
+ surname: trimmedText(name.surname) ?? null,
249
+ email: trimmedText(payload.email) ?? null,
250
+ emailVerified: booleanValue(payload.email_verified) ?? null,
251
+ disabled: booleanValue(payload.disabled) ?? false,
252
+ locale: trimmedText(payload.locale) ?? null,
253
+ country: trimmedText(payload.country) ?? null,
254
+ accountType: trimmedText(accountType[".tag"]) ?? null,
255
+ teamId: trimmedText(team.id) ?? null,
256
+ teamName: trimmedText(team.name) ?? null
257
+ };
258
+ }
259
+ async function listFolder(input, ctx) {
260
+ const payload = await rpc(ctx, "files/list_folder", {
261
+ body: compactDefined({
262
+ // 根目录在 Dropbox 里是空串,不是 '/' —— 省略 path 等同列根。
263
+ path: trimmedText(input.path) ?? "",
264
+ recursive: input.recursive,
265
+ include_deleted: input.includeDeleted,
266
+ include_mounted_folders: input.includeMountedFolders,
267
+ include_has_explicit_shared_members: input.includeHasExplicitSharedMembers,
268
+ limit: input.limit
269
+ })
270
+ });
271
+ return listFolderResult(payload);
272
+ }
273
+ async function listFolderContinue(input, ctx) {
274
+ return listFolderResult(await rpc(ctx, "files/list_folder/continue", { body: { cursor: required(input.cursor, "cursor") } }));
275
+ }
276
+ async function getMetadata(input, ctx) {
277
+ const payload = await rpc(ctx, "files/get_metadata", {
278
+ body: compactDefined({
279
+ path: required(input.path, "path"),
280
+ include_deleted: input.includeDeleted,
281
+ include_has_explicit_shared_members: input.includeHasExplicitSharedMembers
282
+ })
283
+ });
284
+ return { metadata: mapMetadata(payload) };
285
+ }
286
+ async function downloadFile(input, ctx) {
287
+ const downloaded = await downloadContent(
288
+ ctx,
289
+ "/files/download",
290
+ { path: required(input.path, "path") },
291
+ "Dropbox \u4E0B\u8F7D\u5931\u8D25"
292
+ );
293
+ return downloadResult(downloaded, input.fileName, "download_file");
294
+ }
295
+ function writeMode(mode, updateRev) {
296
+ if (mode === "overwrite") return "overwrite";
297
+ if (mode === "update") {
298
+ const rev = trimmedText(updateRev);
299
+ if (rev === void 0) throw new TBError("invalid_argument", "mode \u4E3A 'update' \u65F6\u5FC5\u987B\u7ED9 updateRev");
300
+ return { ".tag": "update", "update": rev };
301
+ }
302
+ return "add";
303
+ }
304
+ function uploadSource(input) {
305
+ const inlineText = input.text;
306
+ const contentBase64 = trimmedText(input.contentBase64);
307
+ const sources = Number(inlineText !== void 0) + Number(contentBase64 !== void 0);
308
+ if (sources !== 1) {
309
+ throw new TBError("invalid_argument", "text \u4E0E contentBase64 \u5FC5\u987B\u6070\u597D\u7ED9\u4E00\u4E2A");
310
+ }
311
+ return {
312
+ bytes: inlineText === void 0 ? base64ToBytes(contentBase64 ?? "") : new TextEncoder().encode(inlineText),
313
+ mimeType: trimmedText(input.mimeType) ?? DEFAULT_MIME_TYPE
314
+ };
315
+ }
316
+ async function uploadFile(input, ctx) {
317
+ const source = uploadSource(input);
318
+ if (source.bytes.byteLength > MAX_SIMPLE_UPLOAD_BYTES) {
319
+ throw new TBError(
320
+ "invalid_argument",
321
+ "upload_file \u5355\u8BF7\u6C42\u6700\u591A 150 MiB(\u66F4\u5927\u7684\u6587\u4EF6\u9700\u8981 upload_session,\u672C provider \u5C1A\u672A\u652F\u6301)"
322
+ );
323
+ }
324
+ const arg = compactDefined({
325
+ path: required(input.path, "path"),
326
+ mode: writeMode(input.mode, input.updateRev),
327
+ autorename: input.autorename,
328
+ client_modified: trimmedText(input.clientModified),
329
+ mute: input.mute,
330
+ strict_conflict: input.strictConflict,
331
+ content_hash: trimmedText(input.contentHash)
332
+ });
333
+ const response = await guardedFetch(`${CONTENT_BASE}/files/upload`, {
334
+ method: "POST",
335
+ headers: {
336
+ "authorization": authHeader(ctx),
337
+ // 内容面用 octet-stream 语义传字节,参数全在 Dropbox-API-Arg 头里。
338
+ "content-type": source.mimeType,
339
+ "Dropbox-API-Arg": JSON.stringify(arg)
340
+ },
341
+ body: source.bytes
342
+ });
343
+ if (!response.ok) throw await readError(response, "Dropbox \u4E0A\u4F20\u5931\u8D25");
344
+ let parsed;
345
+ try {
346
+ parsed = JSON.parse(await response.text());
347
+ } catch {
348
+ throw new TBError("unavailable", "Dropbox \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94", { retryable: true });
349
+ }
350
+ return { metadata: mapMetadata(parsed) };
351
+ }
352
+ async function createFolder(input, ctx) {
353
+ const payload = await rpc(ctx, "files/create_folder_v2", {
354
+ body: compactDefined({
355
+ path: required(input.path, "path"),
356
+ autorename: input.autorename
357
+ })
358
+ });
359
+ return { metadata: mapMetadata(payload.metadata) };
360
+ }
361
+ async function relocate(input, ctx, route) {
362
+ const payload = await rpc(ctx, `files/${route}`, {
363
+ body: compactDefined({
364
+ from_path: required(input.fromPath, "fromPath"),
365
+ to_path: required(input.toPath, "toPath"),
366
+ autorename: input.autorename,
367
+ allow_ownership_transfer: input.allowOwnershipTransfer
368
+ })
369
+ });
370
+ return { metadata: mapMetadata(payload.metadata) };
371
+ }
372
+ function move(input, ctx) {
373
+ return relocate(input, ctx, "move_v2");
374
+ }
375
+ function copy(input, ctx) {
376
+ return relocate(input, ctx, "copy_v2");
377
+ }
378
+ async function deletePath(input, ctx) {
379
+ const payload = await rpc(ctx, "files/delete_v2", {
380
+ body: compactDefined({
381
+ path: required(input.path, "path"),
382
+ parent_rev: trimmedText(input.parentRev)
383
+ })
384
+ });
385
+ return { metadata: mapMetadata(payload.metadata) };
386
+ }
387
+ async function searchFiles(input, ctx) {
388
+ const options = compactDefined({
389
+ path: trimmedText(input.path),
390
+ max_results: input.maxResults,
391
+ file_status: trimmedText(input.fileStatus),
392
+ filename_only: input.filenameOnly,
393
+ file_categories: stringArray(input.fileCategories),
394
+ file_extensions: stringArray(input.fileExtensions),
395
+ order_by: trimmedText(input.orderBy)
396
+ });
397
+ const payload = await rpc(ctx, "files/search_v2", {
398
+ body: compactDefined({
399
+ query: required(input.query, "query"),
400
+ // 一个都没给就整个 options 不发(空对象会被 Dropbox 当成显式的全默认)。
401
+ options: Object.keys(options).length > 0 ? options : void 0,
402
+ // 只在显式要 highlight 时才发这个信封。
403
+ match_field_options: input.includeHighlights === true ? { include_highlights: true } : void 0
404
+ })
405
+ });
406
+ return searchResult(payload);
407
+ }
408
+ async function searchFilesContinue(input, ctx) {
409
+ return searchResult(await rpc(ctx, "files/search/continue_v2", { body: { cursor: required(input.cursor, "cursor") } }));
410
+ }
411
+ async function getTemporaryLink(input, ctx) {
412
+ const payload = await rpc(ctx, "files/get_temporary_link", {
413
+ body: { path: required(input.path, "path") }
414
+ });
415
+ return {
416
+ metadata: mapMetadata(payload.metadata),
417
+ link: requiredText(payload.link, "link")
418
+ };
419
+ }
420
+ async function saveUrl(input, ctx) {
421
+ const payload = await rpc(ctx, "files/save_url", {
422
+ body: {
423
+ path: required(input.path, "path"),
424
+ url: required(input.url, "url")
425
+ }
426
+ });
427
+ return saveUrlResult(payload);
428
+ }
429
+ async function saveUrlCheckJobStatus(input, ctx) {
430
+ const payload = await rpc(ctx, "files/save_url/check_job_status", {
431
+ body: { async_job_id: required(input.asyncJobId, "asyncJobId") }
432
+ });
433
+ return saveUrlResult(payload);
434
+ }
435
+ async function listRevisions(input, ctx) {
436
+ const payload = await rpc(ctx, "files/list_revisions", {
437
+ body: compactDefined({
438
+ path: required(input.path, "path"),
439
+ mode: trimmedText(input.mode),
440
+ before_rev: trimmedText(input.beforeRev),
441
+ limit: input.limit
442
+ })
443
+ });
444
+ return {
445
+ entries: objectArray(payload.entries).map((entry) => mapMetadata(entry)),
446
+ isDeleted: booleanValue(payload.is_deleted) ?? false,
447
+ serverDeleted: trimmedText(payload.server_deleted) ?? null,
448
+ hasMore: booleanValue(payload.has_more) ?? false
449
+ };
450
+ }
451
+ async function restore(input, ctx) {
452
+ const payload = await rpc(ctx, "files/restore", {
453
+ body: {
454
+ path: required(input.path, "path"),
455
+ rev: required(input.rev, "rev")
456
+ }
457
+ });
458
+ return { metadata: mapMetadata(payload) };
459
+ }
460
+ async function getTags(input, ctx) {
461
+ const paths = stringArray(input.paths);
462
+ if (paths === void 0) throw new TBError("invalid_argument", "get_tags \u81F3\u5C11\u9700\u8981\u4E00\u4E2A\u975E\u7A7A\u8DEF\u5F84");
463
+ const payload = await rpc(ctx, "files/tags/get", { body: { paths } });
464
+ return {
465
+ pathsToTags: objectArray(payload.paths_to_tags).map((entry) => ({
466
+ path: requiredText(entry.path, "paths_to_tags[].path"),
467
+ tags: objectArray(entry.tags).map((tag) => ({
468
+ tag: trimmedText(tag[".tag"]) ?? "unknown",
469
+ tagText: trimmedText(tag.tag_text) ?? null
470
+ }))
471
+ }))
472
+ };
473
+ }
474
+ async function createSharedLink(input, ctx) {
475
+ const settings = compactDefined({
476
+ requested_visibility: trimmedText(input.requestedVisibility),
477
+ audience: trimmedText(input.audience),
478
+ access: trimmedText(input.access),
479
+ allow_download: input.allowDownload,
480
+ password: trimmedText(input.password),
481
+ expires: trimmedText(input.expiresAt)
482
+ });
483
+ const payload = await rpc(ctx, "sharing/create_shared_link_with_settings", {
484
+ body: compactDefined({
485
+ path: required(input.path, "path"),
486
+ settings: Object.keys(settings).length > 0 ? settings : void 0
487
+ })
488
+ });
489
+ return { link: mapMetadata(payload) };
490
+ }
491
+ async function listSharedLinks(input, ctx) {
492
+ const payload = await rpc(ctx, "sharing/list_shared_links", {
493
+ body: compactDefined({
494
+ path: trimmedText(input.path),
495
+ cursor: trimmedText(input.cursor),
496
+ direct_only: input.directOnly
497
+ })
498
+ });
499
+ return {
500
+ links: objectArray(payload.links).map((link) => mapMetadata(link)),
501
+ cursor: trimmedText(payload.cursor) ?? null,
502
+ hasMore: booleanValue(payload.has_more) ?? false
503
+ };
504
+ }
505
+ async function getSharedLinkMetadata(input, ctx) {
506
+ const payload = await rpc(ctx, "sharing/get_shared_link_metadata", {
507
+ body: compactDefined({
508
+ url: required(input.url, "url"),
509
+ path: trimmedText(input.path)
510
+ })
511
+ });
512
+ return { link: mapMetadata(payload) };
513
+ }
514
+ async function getSharedLinkFile(input, ctx) {
515
+ const downloaded = await downloadContent(
516
+ ctx,
517
+ "/sharing/get_shared_link_file",
518
+ compactDefined({ url: required(input.url, "url"), path: trimmedText(input.path) }),
519
+ "Dropbox \u5171\u4EAB\u94FE\u63A5\u4E0B\u8F7D\u5931\u8D25"
520
+ );
521
+ return downloadResult(downloaded, input.fileName, "get_shared_link_file");
522
+ }
523
+ async function modifySharedLink(input, ctx) {
524
+ const settings = compactDefined({
525
+ requested_visibility: trimmedText(input.requestedVisibility),
526
+ audience: trimmedText(input.audience),
527
+ access: trimmedText(input.access),
528
+ allow_download: input.allowDownload,
529
+ link_password: trimmedText(input.password),
530
+ expires: trimmedText(input.expiresAt)
531
+ });
532
+ const payload = await rpc(ctx, "sharing/modify_shared_link_settings", {
533
+ // 与 create 不同:这里的 settings 即便是空对象也照发(上游如此)。
534
+ body: compactDefined({
535
+ url: required(input.url, "url"),
536
+ settings,
537
+ remove_expiration: input.removeExpiration
538
+ })
539
+ });
540
+ return { link: mapMetadata(payload) };
541
+ }
542
+ async function revokeSharedLink(input, ctx) {
543
+ await rpc(ctx, "sharing/revoke_shared_link", { body: { url: required(input.url, "url") }, allowEmptyResponse: true });
544
+ return { revoked: true };
545
+ }
546
+
547
+ // ../plugins/src/dropbox/schema.ts
548
+ import { z } from "zod/v4";
549
+ var getCurrentAccountInput = z.strictObject({}).describe("No input is required for this action.");
550
+ var getCurrentAccountOutput = z.strictObject({
551
+ accountId: z.string().describe("The Dropbox account ID."),
552
+ displayName: z.string().describe("The full display name of the current user."),
553
+ abbreviatedName: z.string().describe("The abbreviated display name when available.").nullable(),
554
+ givenName: z.string().describe("The given name when available.").nullable(),
555
+ surname: z.string().describe("The surname when available.").nullable(),
556
+ email: z.string().describe("The email address when available.").nullable(),
557
+ emailVerified: z.boolean().describe("Whether the Dropbox account email is verified.").nullable(),
558
+ disabled: z.boolean().describe("Whether the Dropbox account is disabled."),
559
+ locale: z.string().describe("The account locale when available.").nullable(),
560
+ country: z.string().describe("The account country when available.").nullable(),
561
+ accountType: z.string().describe("The Dropbox account type tag when available.").nullable(),
562
+ teamId: z.string().describe("The Dropbox team ID when available.").nullable(),
563
+ teamName: z.string().describe("The Dropbox team name when available.").nullable()
564
+ }).describe("Normalized current-account information from Dropbox.");
565
+ var listFolderInput = z.strictObject({
566
+ path: z.string().describe("The folder path to list. Leave empty or omit it to list the root folder.").optional(),
567
+ recursive: z.boolean().describe("Whether to list subfolders recursively.").optional(),
568
+ includeDeleted: z.boolean().describe("Whether deleted entries should be included.").optional(),
569
+ includeMountedFolders: z.boolean().describe("Whether mounted folders should be included in the response.").optional(),
570
+ includeHasExplicitSharedMembers: z.boolean().describe("Whether Dropbox should include explicit shared-member flags when available.").optional(),
571
+ limit: z.int().min(1).max(2e3).describe("The maximum number of entries to return per page.").optional()
572
+ }).describe("Input payload for listing a Dropbox folder.");
573
+ var listFolderOutput = z.strictObject({
574
+ entries: z.array(z.strictObject({
575
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
576
+ name: z.string().describe("The Dropbox item name."),
577
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
578
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
579
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
580
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
581
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
582
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
583
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
584
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
585
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
586
+ url: z.string().describe("The shared link URL when available.").nullable(),
587
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
588
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
589
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
590
+ }).describe("A normalized Dropbox metadata or shared-link record.")).describe("The Dropbox entries returned in this page."),
591
+ cursor: z.string().describe("The cursor for continuing the listing."),
592
+ hasMore: z.boolean().describe("Whether more entries are available.")
593
+ }).describe("A Dropbox folder listing page.");
594
+ var listFolderContinueInput = z.strictObject({
595
+ cursor: z.string().min(1).regex(new RegExp("\\S")).describe("The cursor returned by a previous Dropbox folder listing.")
596
+ }).describe("Input payload for continuing a Dropbox folder listing.");
597
+ var listFolderContinueOutput = z.strictObject({
598
+ entries: z.array(z.strictObject({
599
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
600
+ name: z.string().describe("The Dropbox item name."),
601
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
602
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
603
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
604
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
605
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
606
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
607
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
608
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
609
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
610
+ url: z.string().describe("The shared link URL when available.").nullable(),
611
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
612
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
613
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
614
+ }).describe("A normalized Dropbox metadata or shared-link record.")).describe("The Dropbox entries returned in this page."),
615
+ cursor: z.string().describe("The cursor for continuing the listing."),
616
+ hasMore: z.boolean().describe("Whether more entries are available.")
617
+ }).describe("A Dropbox folder listing page.");
618
+ var getMetadataInput = z.strictObject({
619
+ path: z.string().describe("A Dropbox path, file ID, revision ID, or namespace-relative path."),
620
+ includeDeleted: z.boolean().describe("Whether deleted metadata is allowed.").optional(),
621
+ includeHasExplicitSharedMembers: z.boolean().describe("Whether Dropbox should include explicit shared-member flags when available.").optional()
622
+ }).describe("Input payload for retrieving Dropbox metadata.");
623
+ var getMetadataOutput = z.strictObject({
624
+ metadata: z.strictObject({
625
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
626
+ name: z.string().describe("The Dropbox item name."),
627
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
628
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
629
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
630
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
631
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
632
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
633
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
634
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
635
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
636
+ url: z.string().describe("The shared link URL when available.").nullable(),
637
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
638
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
639
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
640
+ }).describe("A normalized Dropbox metadata or shared-link record.")
641
+ }).describe("A normalized Dropbox metadata wrapper.");
642
+ var downloadFileInput = z.strictObject({
643
+ path: z.string().describe("The Dropbox file path, file ID, or revision ID to download."),
644
+ fileName: z.string().describe("Optional file name to use for the uploaded transit file.").optional()
645
+ }).describe("Input payload for downloading a Dropbox file into transit storage.");
646
+ var downloadFileOutput = z.strictObject({
647
+ fileId: z.string().describe("The unique identifier of the downloaded Dropbox file."),
648
+ name: z.string().describe("The name of the downloaded Dropbox file."),
649
+ mimeType: z.string().describe("The MIME type used for the transit upload."),
650
+ sizeBytes: z.int().describe("The size of the downloaded file content in bytes.").nullable(),
651
+ contentBase64: z.string().describe("The downloaded file content encoded as base64.")
652
+ }).describe("A Dropbox file downloaded into transit storage.");
653
+ var uploadFileInput = z.strictObject({
654
+ path: z.string().describe("A Dropbox path, file ID, revision ID, or namespace-relative path."),
655
+ text: z.string().describe("Inline UTF-8 text content to upload.").optional(),
656
+ contentBase64: z.string().describe("Base64-encoded binary content to upload.").optional(),
657
+ mimeType: z.string().describe("Optional MIME type override for inline text or base64 content.").optional(),
658
+ mode: z.enum(["add", "overwrite", "update"]).describe("How Dropbox should handle conflicts at the destination path.").optional(),
659
+ updateRev: z.string().describe("The required file revision when mode is update.").optional(),
660
+ autorename: z.boolean().describe("Whether Dropbox should autorename on conflict when supported by the mode.").optional(),
661
+ clientModified: z.iso.datetime({ offset: true }).describe("Optional client-side modification timestamp in ISO 8601 format.").optional(),
662
+ mute: z.boolean().describe("Whether the upload should avoid client-side user notifications.").optional(),
663
+ strictConflict: z.boolean().describe("Whether Dropbox should use stricter conflict detection.").optional(),
664
+ contentHash: z.string().describe("Optional Dropbox content hash for integrity verification.").optional()
665
+ }).describe("Input payload for uploading a file to Dropbox.");
666
+ var uploadFileOutput = z.strictObject({
667
+ metadata: z.strictObject({
668
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
669
+ name: z.string().describe("The Dropbox item name."),
670
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
671
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
672
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
673
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
674
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
675
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
676
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
677
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
678
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
679
+ url: z.string().describe("The shared link URL when available.").nullable(),
680
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
681
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
682
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
683
+ }).describe("A normalized Dropbox metadata or shared-link record.")
684
+ }).describe("A normalized Dropbox metadata wrapper.");
685
+ var createFolderInput = z.strictObject({
686
+ path: z.string().describe("A Dropbox path, file ID, revision ID, or namespace-relative path."),
687
+ autorename: z.boolean().describe("Whether Dropbox should autorename on conflict.").optional()
688
+ }).describe("Input payload for creating a Dropbox folder.");
689
+ var createFolderOutput = z.strictObject({
690
+ metadata: z.strictObject({
691
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
692
+ name: z.string().describe("The Dropbox item name."),
693
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
694
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
695
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
696
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
697
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
698
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
699
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
700
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
701
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
702
+ url: z.string().describe("The shared link URL when available.").nullable(),
703
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
704
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
705
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
706
+ }).describe("A normalized Dropbox metadata or shared-link record.")
707
+ }).describe("A normalized Dropbox metadata wrapper.");
708
+ var moveInput = z.strictObject({
709
+ fromPath: z.string().describe("The Dropbox source path or ID."),
710
+ toPath: z.string().describe("The Dropbox destination path or ID."),
711
+ autorename: z.boolean().describe("Whether Dropbox should autorename on conflict.").optional(),
712
+ allowOwnershipTransfer: z.boolean().describe("Whether ownership transfer is allowed when Dropbox supports it.").optional()
713
+ }).describe("Input payload for moving or copying Dropbox content.");
714
+ var moveOutput = z.strictObject({
715
+ metadata: z.strictObject({
716
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
717
+ name: z.string().describe("The Dropbox item name."),
718
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
719
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
720
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
721
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
722
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
723
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
724
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
725
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
726
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
727
+ url: z.string().describe("The shared link URL when available.").nullable(),
728
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
729
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
730
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
731
+ }).describe("A normalized Dropbox metadata or shared-link record.")
732
+ }).describe("A normalized Dropbox metadata wrapper.");
733
+ var copyInput = z.strictObject({
734
+ fromPath: z.string().describe("The Dropbox source path or ID."),
735
+ toPath: z.string().describe("The Dropbox destination path or ID."),
736
+ autorename: z.boolean().describe("Whether Dropbox should autorename on conflict.").optional(),
737
+ allowOwnershipTransfer: z.boolean().describe("Whether ownership transfer is allowed when Dropbox supports it.").optional()
738
+ }).describe("Input payload for moving or copying Dropbox content.");
739
+ var copyOutput = z.strictObject({
740
+ metadata: z.strictObject({
741
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
742
+ name: z.string().describe("The Dropbox item name."),
743
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
744
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
745
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
746
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
747
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
748
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
749
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
750
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
751
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
752
+ url: z.string().describe("The shared link URL when available.").nullable(),
753
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
754
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
755
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
756
+ }).describe("A normalized Dropbox metadata or shared-link record.")
757
+ }).describe("A normalized Dropbox metadata wrapper.");
758
+ var deleteInput = z.strictObject({
759
+ path: z.string().describe("The Dropbox path or ID to delete."),
760
+ parentRev: z.string().describe("Optional parent revision that must match when deleting a file.").optional()
761
+ }).describe("Input payload for deleting Dropbox content.");
762
+ var deleteOutput = z.strictObject({
763
+ metadata: z.strictObject({
764
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
765
+ name: z.string().describe("The Dropbox item name."),
766
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
767
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
768
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
769
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
770
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
771
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
772
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
773
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
774
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
775
+ url: z.string().describe("The shared link URL when available.").nullable(),
776
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
777
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
778
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
779
+ }).describe("A normalized Dropbox metadata or shared-link record.")
780
+ }).describe("A normalized Dropbox metadata wrapper.");
781
+ var createSharedLinkInput = z.strictObject({
782
+ path: z.string().describe("The Dropbox path, file ID, or revision ID to share."),
783
+ requestedVisibility: z.enum(["public", "team_only", "password"]).describe("The requested visibility for the shared link.").optional(),
784
+ audience: z.enum(["public", "team", "no_one"]).describe("The requested audience for the shared link.").optional(),
785
+ access: z.enum(["viewer", "editor", "max"]).describe("The requested access level for the shared link.").optional(),
786
+ allowDownload: z.boolean().describe("Whether the shared link should allow downloads when supported.").optional(),
787
+ password: z.string().describe("Optional password to apply when password visibility is used.").optional(),
788
+ expiresAt: z.iso.datetime({ offset: true }).describe("Optional shared-link expiration timestamp in ISO 8601 format.").optional()
789
+ }).describe("Input payload for creating a Dropbox shared link.");
790
+ var createSharedLinkOutput = z.strictObject({
791
+ link: z.strictObject({
792
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
793
+ name: z.string().describe("The Dropbox item name."),
794
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
795
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
796
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
797
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
798
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
799
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
800
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
801
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
802
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
803
+ url: z.string().describe("The shared link URL when available.").nullable(),
804
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
805
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
806
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
807
+ }).describe("A normalized Dropbox metadata or shared-link record.")
808
+ }).describe("A Dropbox shared-link creation result.");
809
+ var listSharedLinksInput = z.strictObject({
810
+ path: z.string().describe("Optional Dropbox path, file ID, or revision ID used to filter shared links.").optional(),
811
+ cursor: z.string().describe("Optional cursor returned by a previous shared-link listing.").optional(),
812
+ directOnly: z.boolean().describe("Whether parent-folder links should be excluded when path is provided.").optional()
813
+ }).describe("Input payload for listing Dropbox shared links.");
814
+ var listSharedLinksOutput = z.strictObject({
815
+ links: z.array(z.strictObject({
816
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
817
+ name: z.string().describe("The Dropbox item name."),
818
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
819
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
820
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
821
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
822
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
823
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
824
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
825
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
826
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
827
+ url: z.string().describe("The shared link URL when available.").nullable(),
828
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
829
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
830
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
831
+ }).describe("A normalized Dropbox metadata or shared-link record.")).describe("The shared links returned by Dropbox."),
832
+ cursor: z.string().describe("The cursor for continuing the listing when Dropbox provides it.").nullable(),
833
+ hasMore: z.boolean().describe("Whether more shared links are available.")
834
+ }).describe("A Dropbox shared-link listing page.");
835
+ var searchFilesInput = z.strictObject({
836
+ query: z.string().min(1).regex(new RegExp("\\S")).describe("The Dropbox search query."),
837
+ path: z.string().describe("Optional folder path that limits where Dropbox searches.").optional(),
838
+ maxResults: z.int().min(1).max(1e3).describe("The maximum number of search matches to return.").optional(),
839
+ fileStatus: z.enum(["active", "deleted"]).describe("Whether Dropbox should search active or deleted content.").optional(),
840
+ filenameOnly: z.boolean().describe("Whether Dropbox should search only file and folder names.").optional(),
841
+ fileCategories: z.array(z.enum(["image", "document", "pdf", "spreadsheet", "presentation", "audio", "video", "folder", "paper", "others"]).describe("A Dropbox file category.")).describe("Optional Dropbox file categories used to filter search results.").optional(),
842
+ fileExtensions: z.array(z.string().min(1).regex(new RegExp("\\S")).describe("A file extension.")).describe("Optional file extensions used to filter search results.").optional(),
843
+ orderBy: z.enum(["relevance", "last_modified_time"]).describe("How Dropbox should order search results.").optional(),
844
+ includeHighlights: z.boolean().describe("Whether Dropbox should include match highlight spans when available.").optional()
845
+ }).describe("Input payload for searching Dropbox files and folders.");
846
+ var searchFilesOutput = z.strictObject({
847
+ matches: z.array(z.strictObject({
848
+ matchType: z.string().describe("The Dropbox match type tag."),
849
+ metadata: z.strictObject({
850
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
851
+ name: z.string().describe("The Dropbox item name."),
852
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
853
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
854
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
855
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
856
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
857
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
858
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
859
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
860
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
861
+ url: z.string().describe("The shared link URL when available.").nullable(),
862
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
863
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
864
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
865
+ }).describe("A normalized Dropbox metadata or shared-link record."),
866
+ highlightSpans: z.array(z.looseObject({}).describe("A generic JSON object returned by Dropbox.")).describe("Dropbox highlight spans when requested and returned.").nullable()
867
+ }).describe("A normalized Dropbox search match.")).describe("The Dropbox search matches."),
868
+ cursor: z.string().describe("The cursor for continuing the search when available.").nullable(),
869
+ hasMore: z.boolean().describe("Whether more search matches are available.")
870
+ }).describe("A Dropbox search result page.");
871
+ var searchFilesContinueInput = z.strictObject({
872
+ cursor: z.string().min(1).regex(new RegExp("\\S")).describe("The cursor returned by a previous Dropbox search.")
873
+ }).describe("Input payload for continuing a Dropbox search.");
874
+ var searchFilesContinueOutput = z.strictObject({
875
+ matches: z.array(z.strictObject({
876
+ matchType: z.string().describe("The Dropbox match type tag."),
877
+ metadata: z.strictObject({
878
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
879
+ name: z.string().describe("The Dropbox item name."),
880
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
881
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
882
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
883
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
884
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
885
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
886
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
887
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
888
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
889
+ url: z.string().describe("The shared link URL when available.").nullable(),
890
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
891
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
892
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
893
+ }).describe("A normalized Dropbox metadata or shared-link record."),
894
+ highlightSpans: z.array(z.looseObject({}).describe("A generic JSON object returned by Dropbox.")).describe("Dropbox highlight spans when requested and returned.").nullable()
895
+ }).describe("A normalized Dropbox search match.")).describe("The Dropbox search matches."),
896
+ cursor: z.string().describe("The cursor for continuing the search when available.").nullable(),
897
+ hasMore: z.boolean().describe("Whether more search matches are available.")
898
+ }).describe("A Dropbox search result page.");
899
+ var getTemporaryLinkInput = z.strictObject({
900
+ path: z.string().describe("The Dropbox file path or ID to create a temporary link for.")
901
+ }).describe("Input payload for creating a Dropbox temporary file link.");
902
+ var getTemporaryLinkOutput = z.strictObject({
903
+ metadata: z.strictObject({
904
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
905
+ name: z.string().describe("The Dropbox item name."),
906
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
907
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
908
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
909
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
910
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
911
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
912
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
913
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
914
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
915
+ url: z.string().describe("The shared link URL when available.").nullable(),
916
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
917
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
918
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
919
+ }).describe("A normalized Dropbox metadata or shared-link record."),
920
+ link: z.string().describe("The temporary Dropbox link.")
921
+ }).describe("A Dropbox temporary link result.");
922
+ var saveUrlInput = z.strictObject({
923
+ path: z.string().describe("The Dropbox destination path for the saved URL."),
924
+ url: z.url().describe("The publicly reachable URL Dropbox should save.")
925
+ }).describe("Input payload for saving a URL into Dropbox.");
926
+ var saveUrlOutput = z.strictObject({
927
+ tag: z.string().describe("The Dropbox save_url result tag."),
928
+ asyncJobId: z.string().describe("The async job ID when Dropbox continues in background.").nullable(),
929
+ metadata: z.strictObject({
930
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
931
+ name: z.string().describe("The Dropbox item name."),
932
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
933
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
934
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
935
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
936
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
937
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
938
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
939
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
940
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
941
+ url: z.string().describe("The shared link URL when available.").nullable(),
942
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
943
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
944
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
945
+ }).describe("A normalized Dropbox metadata or shared-link record.").nullable(),
946
+ failure: z.looseObject({}).describe("Dropbox failure details when the job failed.").nullable()
947
+ }).describe("A normalized Dropbox save_url or save_url/check_job_status result.");
948
+ var saveUrlCheckJobStatusInput = z.strictObject({
949
+ asyncJobId: z.string().min(1).regex(new RegExp("\\S")).describe("The Dropbox async job ID returned by save_url.")
950
+ }).describe("Input payload for checking a Dropbox save_url job.");
951
+ var saveUrlCheckJobStatusOutput = z.strictObject({
952
+ tag: z.string().describe("The Dropbox save_url result tag."),
953
+ asyncJobId: z.string().describe("The async job ID when Dropbox continues in background.").nullable(),
954
+ metadata: z.strictObject({
955
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
956
+ name: z.string().describe("The Dropbox item name."),
957
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
958
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
959
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
960
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
961
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
962
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
963
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
964
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
965
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
966
+ url: z.string().describe("The shared link URL when available.").nullable(),
967
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
968
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
969
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
970
+ }).describe("A normalized Dropbox metadata or shared-link record.").nullable(),
971
+ failure: z.looseObject({}).describe("Dropbox failure details when the job failed.").nullable()
972
+ }).describe("A normalized Dropbox save_url or save_url/check_job_status result.");
973
+ var listRevisionsInput = z.strictObject({
974
+ path: z.string().describe("The Dropbox file path or ID whose revisions should be listed."),
975
+ mode: z.enum(["path", "id"]).describe("Whether Dropbox should list revisions by path or by file ID.").optional(),
976
+ beforeRev: z.string().describe("Optional revision used to page older revisions when mode is path.").optional(),
977
+ limit: z.int().min(1).max(100).describe("The maximum number of revisions to return.").optional()
978
+ }).describe("Input payload for listing Dropbox file revisions.");
979
+ var listRevisionsOutput = z.strictObject({
980
+ entries: z.array(z.strictObject({
981
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
982
+ name: z.string().describe("The Dropbox item name."),
983
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
984
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
985
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
986
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
987
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
988
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
989
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
990
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
991
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
992
+ url: z.string().describe("The shared link URL when available.").nullable(),
993
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
994
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
995
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
996
+ }).describe("A normalized Dropbox metadata or shared-link record.")).describe("The Dropbox file revision metadata entries."),
997
+ isDeleted: z.boolean().describe("Whether the latest file entry is deleted."),
998
+ serverDeleted: z.string().describe("The deletion timestamp when Dropbox returns one.").nullable(),
999
+ hasMore: z.boolean().describe("Whether more older revisions are available.")
1000
+ }).describe("A Dropbox file revision listing.");
1001
+ var restoreInput = z.strictObject({
1002
+ path: z.string().describe("The Dropbox file path to restore."),
1003
+ rev: z.string().min(1).regex(new RegExp("\\S")).describe("The Dropbox revision ID to restore.")
1004
+ }).describe("Input payload for restoring a Dropbox file revision.");
1005
+ var restoreOutput = z.strictObject({
1006
+ metadata: z.strictObject({
1007
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
1008
+ name: z.string().describe("The Dropbox item name."),
1009
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
1010
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
1011
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
1012
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
1013
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
1014
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
1015
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
1016
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
1017
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
1018
+ url: z.string().describe("The shared link URL when available.").nullable(),
1019
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
1020
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
1021
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
1022
+ }).describe("A normalized Dropbox metadata or shared-link record.")
1023
+ }).describe("A normalized Dropbox metadata wrapper.");
1024
+ var getSharedLinkMetadataInput = z.strictObject({
1025
+ url: z.string().min(1).regex(new RegExp("\\S")).describe("The Dropbox shared link URL."),
1026
+ path: z.string().describe("Optional path inside the shared link when the link points to a folder.").optional()
1027
+ }).describe("Input payload for reading Dropbox shared-link metadata.");
1028
+ var getSharedLinkMetadataOutput = z.strictObject({
1029
+ link: z.strictObject({
1030
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
1031
+ name: z.string().describe("The Dropbox item name."),
1032
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
1033
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
1034
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
1035
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
1036
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
1037
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
1038
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
1039
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
1040
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
1041
+ url: z.string().describe("The shared link URL when available.").nullable(),
1042
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
1043
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
1044
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
1045
+ }).describe("A normalized Dropbox metadata or shared-link record.")
1046
+ }).describe("A Dropbox shared-link creation result.");
1047
+ var getSharedLinkFileInput = z.strictObject({
1048
+ url: z.string().min(1).regex(new RegExp("\\S")).describe("The Dropbox shared link URL."),
1049
+ path: z.string().describe("Optional path inside the shared link when the link points to a folder.").optional(),
1050
+ fileName: z.string().describe("Optional file name to use for the uploaded transit file.").optional()
1051
+ }).describe("Input payload for downloading a Dropbox shared-link file into transit storage.");
1052
+ var getSharedLinkFileOutput = z.strictObject({
1053
+ fileId: z.string().describe("The unique identifier of the downloaded Dropbox file."),
1054
+ name: z.string().describe("The name of the downloaded Dropbox file."),
1055
+ mimeType: z.string().describe("The MIME type used for the transit upload."),
1056
+ sizeBytes: z.int().describe("The size of the downloaded file content in bytes.").nullable(),
1057
+ contentBase64: z.string().describe("The downloaded file content encoded as base64.")
1058
+ }).describe("A Dropbox file downloaded into transit storage.");
1059
+ var modifySharedLinkInput = z.strictObject({
1060
+ url: z.string().min(1).regex(new RegExp("\\S")).describe("The Dropbox shared link URL to modify."),
1061
+ requestedVisibility: z.enum(["public", "team_only", "password"]).describe("The requested visibility for the shared link.").optional(),
1062
+ audience: z.enum(["public", "team", "no_one"]).describe("The requested audience for the shared link.").optional(),
1063
+ access: z.enum(["viewer", "editor", "max"]).describe("The requested access level for the shared link.").optional(),
1064
+ allowDownload: z.boolean().describe("Whether the shared link should allow downloads when supported.").optional(),
1065
+ password: z.string().describe("Optional password to apply when password visibility is used.").optional(),
1066
+ expiresAt: z.iso.datetime({ offset: true }).describe("Optional shared-link expiration timestamp in ISO 8601 format.").optional(),
1067
+ removeExpiration: z.boolean().describe("Whether Dropbox should remove the existing shared-link expiration.").optional()
1068
+ }).describe("Input payload for modifying Dropbox shared-link settings.");
1069
+ var modifySharedLinkOutput = z.strictObject({
1070
+ link: z.strictObject({
1071
+ tag: z.string().describe("The Dropbox metadata tag such as file, folder, or deleted."),
1072
+ name: z.string().describe("The Dropbox item name."),
1073
+ id: z.string().describe("The Dropbox item ID when available.").nullable(),
1074
+ pathDisplay: z.string().describe("The user-facing cased path when available.").nullable(),
1075
+ pathLower: z.string().describe("The lower-cased full path when available.").nullable(),
1076
+ clientModified: z.string().describe("The client-provided modification timestamp in ISO 8601 format when available.").nullable(),
1077
+ serverModified: z.string().describe("The server-side modification timestamp in ISO 8601 format when available.").nullable(),
1078
+ rev: z.string().describe("The Dropbox file revision when available.").nullable(),
1079
+ sizeBytes: z.int().describe("The file size in bytes when available.").nullable(),
1080
+ isDownloadable: z.boolean().describe("Whether the file can be downloaded directly.").nullable(),
1081
+ contentHash: z.string().describe("The Dropbox content hash when available.").nullable(),
1082
+ url: z.string().describe("The shared link URL when available.").nullable(),
1083
+ expiresAt: z.string().describe("The shared link expiration timestamp in ISO 8601 format when available.").nullable(),
1084
+ sharingInfo: z.looseObject({}).describe("A generic JSON object returned by Dropbox.").nullable(),
1085
+ linkPermissions: z.looseObject({}).describe("Shared-link permission metadata when Dropbox includes it.").nullable()
1086
+ }).describe("A normalized Dropbox metadata or shared-link record.")
1087
+ }).describe("A Dropbox shared-link creation result.");
1088
+ var revokeSharedLinkInput = z.strictObject({
1089
+ url: z.string().min(1).regex(new RegExp("\\S")).describe("The Dropbox shared link URL to revoke.")
1090
+ }).describe("Input payload for revoking a Dropbox shared link.");
1091
+ var revokeSharedLinkOutput = z.strictObject({
1092
+ revoked: z.boolean().describe("Whether the shared link revoke call completed.")
1093
+ }).describe("A Dropbox shared-link revoke result.");
1094
+ var getTagsInput = z.strictObject({
1095
+ paths: z.array(z.string().describe("A Dropbox path, file ID, revision ID, or namespace-relative path.")).min(1).describe("Dropbox file or folder paths to inspect.")
1096
+ }).describe("Input payload for reading Dropbox tags.");
1097
+ var getTagsOutput = z.strictObject({
1098
+ pathsToTags: z.array(z.strictObject({
1099
+ path: z.string().describe("The Dropbox path whose tags were returned."),
1100
+ tags: z.array(z.strictObject({
1101
+ tag: z.string().describe("The Dropbox tag union tag."),
1102
+ tagText: z.string().describe("The user-generated tag text when available.").nullable()
1103
+ }).describe("A normalized Dropbox tag.")).describe("The tags assigned to the path.")
1104
+ }).describe("Dropbox tags attached to one path.")).describe("Tags grouped by Dropbox path.")
1105
+ }).describe("A normalized Dropbox tags response.");
1106
+ var dropboxActions = {
1107
+ get_current_account: {
1108
+ description: "Get basic profile information for the current Dropbox account.",
1109
+ effect: "read",
1110
+ inputSchema: getCurrentAccountInput,
1111
+ outputSchema: z.toJSONSchema(getCurrentAccountOutput, { io: "output", unrepresentable: "any" })
1112
+ },
1113
+ list_folder: {
1114
+ description: "List files and folders inside one Dropbox folder.",
1115
+ effect: "read",
1116
+ inputSchema: listFolderInput,
1117
+ outputSchema: z.toJSONSchema(listFolderOutput, { io: "output", unrepresentable: "any" })
1118
+ },
1119
+ list_folder_continue: {
1120
+ description: "Continue a previous Dropbox folder listing with a cursor.",
1121
+ effect: "read",
1122
+ inputSchema: listFolderContinueInput,
1123
+ outputSchema: z.toJSONSchema(listFolderContinueOutput, { io: "output", unrepresentable: "any" })
1124
+ },
1125
+ get_metadata: {
1126
+ description: "Get Dropbox metadata for one file or folder.",
1127
+ effect: "read",
1128
+ inputSchema: getMetadataInput,
1129
+ outputSchema: z.toJSONSchema(getMetadataOutput, { io: "output", unrepresentable: "any" })
1130
+ },
1131
+ download_file: {
1132
+ description: "Download one Dropbox file and return its content encoded as base64.",
1133
+ effect: "read",
1134
+ inputSchema: downloadFileInput,
1135
+ outputSchema: z.toJSONSchema(downloadFileOutput, { io: "output", unrepresentable: "any" })
1136
+ },
1137
+ upload_file: {
1138
+ description: "Upload one file to Dropbox from inline text or base64 content.",
1139
+ effect: "write",
1140
+ inputSchema: uploadFileInput,
1141
+ outputSchema: z.toJSONSchema(uploadFileOutput, { io: "output", unrepresentable: "any" })
1142
+ },
1143
+ create_folder: {
1144
+ description: "Create one folder in Dropbox.",
1145
+ effect: "write",
1146
+ inputSchema: createFolderInput,
1147
+ outputSchema: z.toJSONSchema(createFolderOutput, { io: "output", unrepresentable: "any" })
1148
+ },
1149
+ move: {
1150
+ description: "Move one file or folder to another Dropbox path.",
1151
+ effect: "write",
1152
+ inputSchema: moveInput,
1153
+ outputSchema: z.toJSONSchema(moveOutput, { io: "output", unrepresentable: "any" })
1154
+ },
1155
+ copy: {
1156
+ description: "Copy one file or folder to another Dropbox path.",
1157
+ effect: "write",
1158
+ inputSchema: copyInput,
1159
+ outputSchema: z.toJSONSchema(copyOutput, { io: "output", unrepresentable: "any" })
1160
+ },
1161
+ delete: {
1162
+ description: "Delete one file or folder from Dropbox.",
1163
+ effect: "write",
1164
+ inputSchema: deleteInput,
1165
+ outputSchema: z.toJSONSchema(deleteOutput, { io: "output", unrepresentable: "any" })
1166
+ },
1167
+ create_shared_link: {
1168
+ description: "Create one Dropbox shared link with optional custom settings.",
1169
+ effect: "write",
1170
+ inputSchema: createSharedLinkInput,
1171
+ outputSchema: z.toJSONSchema(createSharedLinkOutput, { io: "output", unrepresentable: "any" })
1172
+ },
1173
+ list_shared_links: {
1174
+ description: "List Dropbox shared links for the current user or a specific path.",
1175
+ effect: "read",
1176
+ inputSchema: listSharedLinksInput,
1177
+ outputSchema: z.toJSONSchema(listSharedLinksOutput, { io: "output", unrepresentable: "any" })
1178
+ },
1179
+ search_files: {
1180
+ description: "Search Dropbox files and folders with the official search_v2 endpoint.",
1181
+ effect: "read",
1182
+ inputSchema: searchFilesInput,
1183
+ outputSchema: z.toJSONSchema(searchFilesOutput, { io: "output", unrepresentable: "any" })
1184
+ },
1185
+ search_files_continue: {
1186
+ description: "Continue a previous Dropbox file search with a cursor.",
1187
+ effect: "read",
1188
+ inputSchema: searchFilesContinueInput,
1189
+ outputSchema: z.toJSONSchema(searchFilesContinueOutput, { io: "output", unrepresentable: "any" })
1190
+ },
1191
+ get_temporary_link: {
1192
+ description: "Create a temporary direct-download Dropbox link for one file.",
1193
+ effect: "read",
1194
+ inputSchema: getTemporaryLinkInput,
1195
+ outputSchema: z.toJSONSchema(getTemporaryLinkOutput, { io: "output", unrepresentable: "any" })
1196
+ },
1197
+ save_url: {
1198
+ description: "Ask Dropbox to save a public URL into a Dropbox file path.",
1199
+ effect: "write",
1200
+ inputSchema: saveUrlInput,
1201
+ outputSchema: z.toJSONSchema(saveUrlOutput, { io: "output", unrepresentable: "any" })
1202
+ },
1203
+ save_url_check_job_status: {
1204
+ description: "Check the status of an asynchronous Dropbox save_url job.",
1205
+ effect: "write",
1206
+ inputSchema: saveUrlCheckJobStatusInput,
1207
+ outputSchema: z.toJSONSchema(saveUrlCheckJobStatusOutput, { io: "output", unrepresentable: "any" })
1208
+ },
1209
+ list_revisions: {
1210
+ description: "List revisions for one Dropbox file.",
1211
+ effect: "read",
1212
+ inputSchema: listRevisionsInput,
1213
+ outputSchema: z.toJSONSchema(listRevisionsOutput, { io: "output", unrepresentable: "any" })
1214
+ },
1215
+ restore: {
1216
+ description: "Restore one Dropbox file to a previous revision.",
1217
+ effect: "write",
1218
+ inputSchema: restoreInput,
1219
+ outputSchema: z.toJSONSchema(restoreOutput, { io: "output", unrepresentable: "any" })
1220
+ },
1221
+ get_shared_link_metadata: {
1222
+ description: "Get metadata for a Dropbox shared link.",
1223
+ effect: "read",
1224
+ inputSchema: getSharedLinkMetadataInput,
1225
+ outputSchema: z.toJSONSchema(getSharedLinkMetadataOutput, { io: "output", unrepresentable: "any" })
1226
+ },
1227
+ get_shared_link_file: {
1228
+ description: "Download a Dropbox shared-link file and return its content encoded as base64.",
1229
+ effect: "read",
1230
+ inputSchema: getSharedLinkFileInput,
1231
+ outputSchema: z.toJSONSchema(getSharedLinkFileOutput, { io: "output", unrepresentable: "any" })
1232
+ },
1233
+ modify_shared_link: {
1234
+ description: "Modify settings for an existing Dropbox shared link.",
1235
+ effect: "write",
1236
+ inputSchema: modifySharedLinkInput,
1237
+ outputSchema: z.toJSONSchema(modifySharedLinkOutput, { io: "output", unrepresentable: "any" })
1238
+ },
1239
+ revoke_shared_link: {
1240
+ description: "Revoke an existing Dropbox shared link.",
1241
+ effect: "destructive",
1242
+ inputSchema: revokeSharedLinkInput,
1243
+ outputSchema: z.toJSONSchema(revokeSharedLinkOutput, { io: "output", unrepresentable: "any" })
1244
+ },
1245
+ get_tags: {
1246
+ description: "Get user-generated Dropbox tags for one or more files or folders.",
1247
+ effect: "read",
1248
+ inputSchema: getTagsInput,
1249
+ outputSchema: z.toJSONSchema(getTagsOutput, { io: "output", unrepresentable: "any" })
1250
+ }
1251
+ };
1252
+
1253
+ // ../plugins/src/dropbox/index.ts
1254
+ function createDropboxPlugin() {
1255
+ return createProviderPlugin({
1256
+ description: "Dropbox",
1257
+ actions: dropboxActions,
1258
+ oauth: {
1259
+ authorizationUrl: "https://www.dropbox.com/oauth2/authorize",
1260
+ tokenUrl: "https://api.dropboxapi.com/oauth2/token",
1261
+ scopes: [
1262
+ "account_info.read",
1263
+ "files.metadata.read",
1264
+ "files.content.read",
1265
+ "files.content.write",
1266
+ "sharing.read",
1267
+ "sharing.write"
1268
+ ],
1269
+ clientAuth: "client_secret_post",
1270
+ // 没有它 Dropbox 不发 refresh_token(见文件头)。
1271
+ authorizationParams: { token_access_type: "offline" }
1272
+ },
1273
+ handlers: {
1274
+ get_current_account: getCurrentAccount,
1275
+ list_folder: listFolder,
1276
+ list_folder_continue: listFolderContinue,
1277
+ get_metadata: getMetadata,
1278
+ download_file: downloadFile,
1279
+ upload_file: uploadFile,
1280
+ create_folder: createFolder,
1281
+ move,
1282
+ copy,
1283
+ delete: deletePath,
1284
+ create_shared_link: createSharedLink,
1285
+ list_shared_links: listSharedLinks,
1286
+ search_files: searchFiles,
1287
+ search_files_continue: searchFilesContinue,
1288
+ get_temporary_link: getTemporaryLink,
1289
+ save_url: saveUrl,
1290
+ save_url_check_job_status: saveUrlCheckJobStatus,
1291
+ list_revisions: listRevisions,
1292
+ restore,
1293
+ get_shared_link_metadata: getSharedLinkMetadata,
1294
+ get_shared_link_file: getSharedLinkFile,
1295
+ modify_shared_link: modifySharedLink,
1296
+ revoke_shared_link: revokeSharedLink,
1297
+ get_tags: getTags
1298
+ }
1299
+ });
1300
+ }
1301
+ var dropbox_default = createDropboxPlugin();
1302
+ export {
1303
+ createDropboxPlugin,
1304
+ dropbox_default as default
1305
+ };