@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
@@ -0,0 +1,744 @@
1
+ import {
2
+ bytesToBase64,
3
+ readBoundedResponseBytes
4
+ } from "./chunk-LMLX3DJF.js";
5
+ import {
6
+ createAuthedClient
7
+ } from "./chunk-RTW5VRTK.js";
8
+ import "./chunk-BNMLA2RC.js";
9
+ import {
10
+ asJsonObject,
11
+ compactDefined,
12
+ trimmedText
13
+ } from "./chunk-JXHMDBAY.js";
14
+ import {
15
+ createProviderPlugin,
16
+ requireApiKey,
17
+ upstreamError
18
+ } from "./chunk-X7ZUTKHR.js";
19
+ import {
20
+ assertPublicHttpUrl,
21
+ guardedFetch
22
+ } from "./chunk-7ISGFRC6.js";
23
+ import "./chunk-UY6ANCOY.js";
24
+ import {
25
+ TBError,
26
+ isTBError
27
+ } from "./chunk-HA4BGL6C.js";
28
+ import "./chunk-U67V476Y.js";
29
+
30
+ // ../plugins/src/memos/api.ts
31
+ var SERVICE = "memos";
32
+ var API_SUFFIX = "/api/v1";
33
+ var ATTACHMENT_MAX_BYTES = 20 * 1024 * 1024;
34
+ var http = createAuthedClient({
35
+ service: SERVICE,
36
+ auth: { kind: "bearer" },
37
+ headers: { accept: "application/json" },
38
+ // Memos 的错误消息就一个 `message` 键(gRPC-gateway 的形状);非 JSON 体则是整段文本。
39
+ errorMessage: {
40
+ keys: ["message"],
41
+ fallback: () => "Memos request failed"
42
+ }
43
+ });
44
+ var UPDATE_MASKS = [
45
+ ["content", "content"],
46
+ ["visibility", "visibility"],
47
+ ["pinned", "pinned"],
48
+ ["state", "state"],
49
+ ["createTime", "create_time"],
50
+ ["location", "location"]
51
+ ];
52
+ function requireText(value, field) {
53
+ const result = trimmedText(value);
54
+ if (result === void 0) throw new TBError("invalid_argument", `${field} is required.`);
55
+ return result;
56
+ }
57
+ function responseError(message) {
58
+ return new TBError("unavailable", message, { retryable: true });
59
+ }
60
+ function requireResponseObject(value, operation) {
61
+ const object = asJsonObject(value);
62
+ if (object === void 0) throw responseError(`Memos ${operation} response did not include an object`);
63
+ return object;
64
+ }
65
+ function requireResponseObjects(value, operation) {
66
+ if (!Array.isArray(value)) throw responseError(`Memos ${operation} response did not include an array`);
67
+ return value.map((item) => requireResponseObject(item, operation));
68
+ }
69
+ function configError(message) {
70
+ return new TBError("invalid_argument", `${SERVICE} \u7684 baseUrl ${message}`);
71
+ }
72
+ function resolveBaseUrl(ctx) {
73
+ const configured = ctx.config?.baseUrl;
74
+ if (configured !== void 0 && typeof configured !== "string") throw configError("\u5FC5\u987B\u662F\u5B57\u7B26\u4E32");
75
+ const candidate = trimmedText(configured);
76
+ if (candidate === void 0) {
77
+ throw configError(
78
+ "\u662F\u5FC5\u914D\u9879:\u7ED9\u6302\u8F7D\u8282\u70B9\u914D providerConfig.baseUrl \u6307\u5411\u4F60\u7684 Memos \u5B9E\u4F8B(\u5982 https://memos.example.com)\u3002Memos \u53EA\u6709\u81EA\u5EFA\u5B9E\u4F8B,\u6CA1\u6709\u516C\u5171\u7F3A\u7701\u5730\u5740"
79
+ );
80
+ }
81
+ let url;
82
+ try {
83
+ url = assertPublicHttpUrl(candidate);
84
+ } catch (error) {
85
+ const detail = error instanceof Error ? error.message : "\u4E0D\u53EF\u7528";
86
+ throw configError(
87
+ `\u4E0D\u53EF\u7528(${detail})\u3002\u81EA\u5EFA Memos \u5FC5\u987B\u662F**\u516C\u7F51\u53EF\u8FBE**\u7684\u5730\u5740:\u63D2\u4EF6\u4E0E\u7F51\u5173\u540C\u8FDB\u7A0B,\u6307\u5411\u5185\u7F51\u6216\u4FDD\u7559\u5730\u5740\u4F1A\u88AB\u51FA\u7AD9\u6821\u9A8C\u62D2\u7EDD`
88
+ );
89
+ }
90
+ if (url.username !== "" || url.password !== "") throw configError("\u4E0D\u80FD\u5E26\u7528\u6237\u540D/\u5BC6\u7801");
91
+ url.search = "";
92
+ url.hash = "";
93
+ const path = url.pathname.replace(/\/+$/, "");
94
+ const normalized = `${url.origin}${path}`;
95
+ return normalized.endsWith(API_SUFFIX) ? normalized : `${normalized}${API_SUFFIX}`;
96
+ }
97
+ function resolveTarget(ctx) {
98
+ requireApiKey(ctx, SERVICE);
99
+ return resolveBaseUrl(ctx);
100
+ }
101
+ function resourcePath(name, collection) {
102
+ const segments = name.split("/");
103
+ const id = segments[1];
104
+ if (segments.length !== 2 || segments[0] !== collection || id === void 0 || id === "" || id === "." || id === "..") {
105
+ throw new TBError("invalid_argument", `name must use the ${collection}/{id} resource format`);
106
+ }
107
+ return `/${collection}/${encodeURIComponent(id)}`;
108
+ }
109
+ async function request(ctx, input) {
110
+ const result = await http.request(ctx, {
111
+ baseUrl: `${resolveTarget(ctx)}/`,
112
+ path: input.path,
113
+ method: input.method ?? "GET",
114
+ query: Object.entries(input.query ?? {}),
115
+ ...input.body === void 0 ? {} : { json: input.body },
116
+ invalidJsonMessage: "Memos returned invalid JSON",
117
+ mapTransportError: ({ message }) => upstreamError(
118
+ 502,
119
+ `Memos ${input.path} request failed: ${message ?? "unknown network error"}`
120
+ )
121
+ });
122
+ return result.data === void 0 ? null : result.data;
123
+ }
124
+ async function readBoundedBytes(response) {
125
+ const tooLarge = () => new TBError(
126
+ "invalid_argument",
127
+ `fileUrl \u6307\u5411\u7684\u6587\u4EF6\u8D85\u8FC7 ${ATTACHMENT_MAX_BYTES} \u5B57\u8282\u7684\u4E0A\u9650`
128
+ );
129
+ return readBoundedResponseBytes(response, { maxBytes: ATTACHMENT_MAX_BYTES, tooLarge });
130
+ }
131
+ async function downloadAttachment(fileUrl, declaredType) {
132
+ let response;
133
+ try {
134
+ response = await guardedFetch(fileUrl, { method: "GET" });
135
+ } catch (error) {
136
+ if (isTBError(error)) throw error;
137
+ const detail = error instanceof Error ? error.message : "unknown network error";
138
+ throw upstreamError(502, `failed to fetch fileUrl: ${detail}`);
139
+ }
140
+ if (!response.ok) throw upstreamError(502, `failed to fetch fileUrl: ${response.status}`);
141
+ const bytes = await readBoundedBytes(response);
142
+ const responseType = trimmedText(response.headers.get("content-type")?.split(";", 1)[0]);
143
+ return { bytes, mimeType: declaredType ?? responseType ?? "application/octet-stream" };
144
+ }
145
+ async function createMemo(input, ctx) {
146
+ const payload = await request(ctx, {
147
+ method: "POST",
148
+ path: "/memos",
149
+ // memoId 是**query** 参数而不是 body 字段(Memos 的 AIP 风格:资源 id 走 query)。
150
+ query: compactDefined({ memoId: trimmedText(input.memoId) }),
151
+ body: compactDefined({
152
+ content: input.content,
153
+ visibility: trimmedText(input.visibility),
154
+ createTime: trimmedText(input.createTime),
155
+ pinned: input.pinned,
156
+ location: input.location
157
+ })
158
+ });
159
+ return { memo: requireResponseObject(payload, "create memo") };
160
+ }
161
+ async function listMemos(input, ctx) {
162
+ const payload = requireResponseObject(await request(ctx, {
163
+ path: "/memos",
164
+ query: compactDefined({
165
+ pageSize: input.pageSize,
166
+ pageToken: trimmedText(input.pageToken),
167
+ state: trimmedText(input.state),
168
+ orderBy: trimmedText(input.orderBy),
169
+ filter: trimmedText(input.filter),
170
+ showDeleted: input.showDeleted
171
+ })
172
+ }), "list memos");
173
+ return {
174
+ // 一页都没有时 Memos 干脆不给 `memos` 键,补成空数组;非数组则是上游坏了。
175
+ memos: requireResponseObjects(payload.memos ?? [], "list memos"),
176
+ nextPageToken: trimmedText(payload.nextPageToken) ?? null
177
+ };
178
+ }
179
+ async function getMemo(input, ctx) {
180
+ const path = resourcePath(requireText(input.name, "name"), "memos");
181
+ const payload = await request(ctx, { path });
182
+ return { memo: requireResponseObject(payload, "get memo") };
183
+ }
184
+ async function updateMemo(input, ctx) {
185
+ const name = requireText(input.name, "name");
186
+ const updateMask = UPDATE_MASKS.filter(([field]) => Object.hasOwn(input, field)).map(([, mask]) => mask);
187
+ if (updateMask.length === 0) {
188
+ throw new TBError("invalid_argument", "Provide at least one memo field to update.");
189
+ }
190
+ const payload = await request(ctx, {
191
+ method: "PATCH",
192
+ path: resourcePath(name, "memos"),
193
+ query: { updateMask: updateMask.join(",") },
194
+ body: compactDefined({
195
+ name,
196
+ content: input.content,
197
+ visibility: input.visibility,
198
+ pinned: input.pinned,
199
+ state: input.state,
200
+ createTime: input.createTime,
201
+ location: input.location
202
+ })
203
+ });
204
+ return { memo: requireResponseObject(payload, "update memo") };
205
+ }
206
+ async function deleteMemo(input, ctx) {
207
+ const name = requireText(input.name, "name");
208
+ await request(ctx, {
209
+ method: "DELETE",
210
+ path: resourcePath(name, "memos"),
211
+ query: compactDefined({ force: input.force })
212
+ });
213
+ return { deleted: true, name };
214
+ }
215
+ async function uploadAttachment(input, ctx) {
216
+ resolveTarget(ctx);
217
+ const source = await downloadAttachment(requireText(input.fileUrl, "fileUrl"), trimmedText(input.type));
218
+ const payload = await request(ctx, {
219
+ method: "POST",
220
+ path: "/attachments",
221
+ query: compactDefined({ attachmentId: trimmedText(input.attachmentId) }),
222
+ body: compactDefined({
223
+ filename: requireText(input.filename, "filename"),
224
+ content: bytesToBase64(source.bytes),
225
+ type: source.mimeType,
226
+ memo: trimmedText(input.memo)
227
+ })
228
+ });
229
+ return { attachment: requireResponseObject(payload, "upload attachment") };
230
+ }
231
+ async function listAttachments(input, ctx) {
232
+ const payload = requireResponseObject(await request(ctx, {
233
+ path: "/attachments",
234
+ query: compactDefined({
235
+ pageSize: input.pageSize,
236
+ pageToken: trimmedText(input.pageToken),
237
+ filter: trimmedText(input.filter),
238
+ orderBy: trimmedText(input.orderBy)
239
+ })
240
+ }), "list attachments");
241
+ return {
242
+ attachments: requireResponseObjects(payload.attachments ?? [], "list attachments"),
243
+ nextPageToken: trimmedText(payload.nextPageToken) ?? null
244
+ };
245
+ }
246
+ async function getAttachment(input, ctx) {
247
+ const path = resourcePath(requireText(input.name, "name"), "attachments");
248
+ const payload = await request(ctx, { path });
249
+ return { attachment: requireResponseObject(payload, "get attachment") };
250
+ }
251
+ async function deleteAttachment(input, ctx) {
252
+ const name = requireText(input.name, "name");
253
+ await request(ctx, { method: "DELETE", path: resourcePath(name, "attachments") });
254
+ return { deleted: true, name };
255
+ }
256
+ async function listMemoAttachments(input, ctx) {
257
+ const name = requireText(input.name, "name");
258
+ const payload = requireResponseObject(await request(ctx, {
259
+ path: `${resourcePath(name, "memos")}/attachments`,
260
+ query: compactDefined({ pageSize: input.pageSize, pageToken: trimmedText(input.pageToken) })
261
+ }), "list memo attachments");
262
+ return {
263
+ attachments: requireResponseObjects(payload.attachments ?? [], "list memo attachments"),
264
+ nextPageToken: trimmedText(payload.nextPageToken) ?? null
265
+ };
266
+ }
267
+ async function setMemoAttachments(input, ctx) {
268
+ const name = requireText(input.name, "name");
269
+ const attachmentNames = input.attachmentNames.map((item) => requireText(item, "attachmentNames"));
270
+ for (const attachmentName of attachmentNames) resourcePath(attachmentName, "attachments");
271
+ await request(ctx, {
272
+ method: "PATCH",
273
+ path: `${resourcePath(name, "memos")}/attachments`,
274
+ body: { name, attachments: attachmentNames.map((attachmentName) => ({ name: attachmentName })) }
275
+ });
276
+ return { updated: true, name, attachmentNames };
277
+ }
278
+ async function getCurrentUser(_input, ctx) {
279
+ const payload = requireResponseObject(await request(ctx, { path: "/auth/me" }), "get current user");
280
+ return { user: requireResponseObject(payload.user, "get current user") };
281
+ }
282
+ async function listUsers(input, ctx) {
283
+ const payload = requireResponseObject(await request(ctx, {
284
+ path: "/users",
285
+ query: compactDefined({
286
+ pageSize: input.pageSize,
287
+ pageToken: trimmedText(input.pageToken),
288
+ filter: trimmedText(input.filter),
289
+ showDeleted: input.showDeleted
290
+ })
291
+ }), "list users");
292
+ return {
293
+ users: requireResponseObjects(payload.users ?? [], "list users"),
294
+ nextPageToken: trimmedText(payload.nextPageToken) ?? null
295
+ };
296
+ }
297
+ async function getUser(input, ctx) {
298
+ const path = resourcePath(requireText(input.name, "name"), "users");
299
+ const payload = await request(ctx, {
300
+ path,
301
+ query: compactDefined({ readMask: trimmedText(input.readMask) })
302
+ });
303
+ return { user: requireResponseObject(payload, "get user") };
304
+ }
305
+
306
+ // ../plugins/src/memos/schema.ts
307
+ import { z as z2 } from "zod/v4";
308
+
309
+ // ../plugins/src/memos/schema.handwritten.ts
310
+ import { z } from "zod/v4";
311
+ var UPDATABLE = ["content", "visibility", "pinned", "state", "createTime", "location"];
312
+ var updateMemoInput = z.strictObject({
313
+ name: z.string().min(7).describe("The Memos memo resource name in the format memos/{memo}."),
314
+ content: z.string().describe("The replacement memo content. Provide at least one updatable field.").optional(),
315
+ visibility: z.enum(["PRIVATE", "PROTECTED", "PUBLIC"]).describe("The memo visibility. Provide at least one updatable field.").optional(),
316
+ pinned: z.boolean().describe("Whether the memo should be pinned. Provide at least one updatable field.").optional(),
317
+ state: z.enum(["NORMAL", "ARCHIVED"]).describe("The memo state. Provide at least one updatable field.").optional(),
318
+ createTime: z.iso.datetime({ offset: true }).describe("The replacement memo creation time. Provide at least one updatable field.").optional(),
319
+ location: z.strictObject({
320
+ placeholder: z.string().describe("The location label.").optional(),
321
+ latitude: z.number().describe("The latitude in decimal degrees.").optional(),
322
+ longitude: z.number().describe("The longitude in decimal degrees.").optional()
323
+ }).describe("A geographic location to attach to a memo; null clears it. Provide at least one updatable field.").nullable().optional()
324
+ }).refine(
325
+ // 按"键在不在"判,不是"值是不是 undefined":显式给 `location: null` 也算"要改这个字段"。
326
+ (input) => UPDATABLE.some((field) => Object.hasOwn(input, field)),
327
+ {
328
+ message: `at least one of ${UPDATABLE.join(", ")} is required`,
329
+ path: ["content"]
330
+ }
331
+ ).describe("Input parameters for updating selected memo fields.");
332
+ var updateMemoOutput = z.strictObject({
333
+ memo: z.looseObject({
334
+ name: z.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional(),
335
+ state: z.string().describe("The memo state returned by Memos.").optional(),
336
+ creator: z.string().min(7).describe("The Memos user resource name in the format users/{user}.").optional(),
337
+ createTime: z.iso.datetime({ offset: true }).describe("The memo creation time.").optional(),
338
+ updateTime: z.iso.datetime({ offset: true }).describe("The memo update time.").optional(),
339
+ content: z.string().describe("The memo Markdown content.").optional(),
340
+ visibility: z.string().describe("The memo visibility returned by Memos.").optional(),
341
+ tags: z.array(z.string().describe("An extracted memo tag.")).describe("Tags extracted from the memo content.").optional(),
342
+ pinned: z.boolean().describe("Whether the memo is pinned.").optional(),
343
+ attachments: z.array(z.looseObject({
344
+ name: z.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.").optional(),
345
+ createTime: z.iso.datetime({ offset: true }).describe("The attachment creation time.").optional(),
346
+ filename: z.string().describe("The attachment filename.").optional(),
347
+ externalLink: z.string().describe("The external storage URL when returned by Memos.").optional(),
348
+ type: z.string().describe("The attachment MIME type.").optional(),
349
+ size: z.string().describe("The attachment size in bytes, encoded as a string by the Memos API.").optional(),
350
+ memo: z.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional()
351
+ }).describe("Memos attachment metadata.")).describe("Attachments associated with the memo.").optional(),
352
+ parent: z.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional(),
353
+ snippet: z.string().describe("A plain-text preview of the memo content.").optional(),
354
+ location: z.looseObject({
355
+ placeholder: z.string().describe("The location label.").optional(),
356
+ latitude: z.number().describe("The latitude in decimal degrees.").optional(),
357
+ longitude: z.number().describe("The longitude in decimal degrees.").optional()
358
+ }).describe("A geographic location attached to a memo.").optional(),
359
+ property: z.looseObject({}).describe("Computed memo properties.").optional()
360
+ }).describe("A Memos memo resource.")
361
+ }).describe("The updated memo response.");
362
+
363
+ // ../plugins/src/memos/schema.ts
364
+ var createMemoInput = z2.strictObject({
365
+ content: z2.string().min(1).describe("The memo content in Markdown format."),
366
+ visibility: z2.enum(["PRIVATE", "PROTECTED", "PUBLIC"]).describe("The memo visibility.").optional(),
367
+ memoId: z2.string().min(1).max(36).describe("An optional caller-selected memo ID.").optional(),
368
+ createTime: z2.iso.datetime({ offset: true }).describe("An optional creation time for imported content.").optional(),
369
+ pinned: z2.boolean().describe("Whether the new memo should be pinned.").optional(),
370
+ location: z2.strictObject({
371
+ placeholder: z2.string().describe("The location label.").optional(),
372
+ latitude: z2.number().describe("The latitude in decimal degrees.").optional(),
373
+ longitude: z2.number().describe("The longitude in decimal degrees.").optional()
374
+ }).describe("A geographic location to attach to a memo.").optional()
375
+ }).describe("Input parameters for creating a memo.");
376
+ var createMemoOutput = z2.strictObject({
377
+ memo: z2.looseObject({
378
+ name: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional(),
379
+ state: z2.string().describe("The memo state returned by Memos.").optional(),
380
+ creator: z2.string().min(7).describe("The Memos user resource name in the format users/{user}.").optional(),
381
+ createTime: z2.iso.datetime({ offset: true }).describe("The memo creation time.").optional(),
382
+ updateTime: z2.iso.datetime({ offset: true }).describe("The memo update time.").optional(),
383
+ content: z2.string().describe("The memo Markdown content.").optional(),
384
+ visibility: z2.string().describe("The memo visibility returned by Memos.").optional(),
385
+ tags: z2.array(z2.string().describe("An extracted memo tag.")).describe("Tags extracted from the memo content.").optional(),
386
+ pinned: z2.boolean().describe("Whether the memo is pinned.").optional(),
387
+ attachments: z2.array(z2.looseObject({
388
+ name: z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.").optional(),
389
+ createTime: z2.iso.datetime({ offset: true }).describe("The attachment creation time.").optional(),
390
+ filename: z2.string().describe("The attachment filename.").optional(),
391
+ externalLink: z2.string().describe("The external storage URL when returned by Memos.").optional(),
392
+ type: z2.string().describe("The attachment MIME type.").optional(),
393
+ size: z2.string().describe("The attachment size in bytes, encoded as a string by the Memos API.").optional(),
394
+ memo: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional()
395
+ }).describe("Memos attachment metadata.")).describe("Attachments associated with the memo.").optional(),
396
+ parent: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional(),
397
+ snippet: z2.string().describe("A plain-text preview of the memo content.").optional(),
398
+ location: z2.looseObject({
399
+ placeholder: z2.string().describe("The location label.").optional(),
400
+ latitude: z2.number().describe("The latitude in decimal degrees.").optional(),
401
+ longitude: z2.number().describe("The longitude in decimal degrees.").optional()
402
+ }).describe("A geographic location attached to a memo.").optional(),
403
+ property: z2.looseObject({}).describe("Computed memo properties.").optional()
404
+ }).describe("A Memos memo resource.")
405
+ }).describe("The created memo response.");
406
+ var listMemosInput = z2.strictObject({
407
+ pageSize: z2.int().min(1).max(1e3).describe("The maximum number of resources to return.").optional(),
408
+ pageToken: z2.string().min(1).describe("The continuation token returned by a previous list action.").optional(),
409
+ state: z2.enum(["NORMAL", "ARCHIVED"]).describe("The memo state.").optional(),
410
+ orderBy: z2.string().min(1).describe("The AIP-132 ordering expression, such as pinned desc, create_time desc.").optional(),
411
+ filter: z2.string().min(1).describe("The Memos CEL filter expression, including content, creator, visibility, tags, timestamps, and computed properties.").optional(),
412
+ showDeleted: z2.boolean().describe("Whether deleted memos should be included.").optional()
413
+ }).describe("Input parameters for listing memos.");
414
+ var listMemosOutput = z2.strictObject({
415
+ memos: z2.array(z2.looseObject({
416
+ name: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional(),
417
+ state: z2.string().describe("The memo state returned by Memos.").optional(),
418
+ creator: z2.string().min(7).describe("The Memos user resource name in the format users/{user}.").optional(),
419
+ createTime: z2.iso.datetime({ offset: true }).describe("The memo creation time.").optional(),
420
+ updateTime: z2.iso.datetime({ offset: true }).describe("The memo update time.").optional(),
421
+ content: z2.string().describe("The memo Markdown content.").optional(),
422
+ visibility: z2.string().describe("The memo visibility returned by Memos.").optional(),
423
+ tags: z2.array(z2.string().describe("An extracted memo tag.")).describe("Tags extracted from the memo content.").optional(),
424
+ pinned: z2.boolean().describe("Whether the memo is pinned.").optional(),
425
+ attachments: z2.array(z2.looseObject({
426
+ name: z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.").optional(),
427
+ createTime: z2.iso.datetime({ offset: true }).describe("The attachment creation time.").optional(),
428
+ filename: z2.string().describe("The attachment filename.").optional(),
429
+ externalLink: z2.string().describe("The external storage URL when returned by Memos.").optional(),
430
+ type: z2.string().describe("The attachment MIME type.").optional(),
431
+ size: z2.string().describe("The attachment size in bytes, encoded as a string by the Memos API.").optional(),
432
+ memo: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional()
433
+ }).describe("Memos attachment metadata.")).describe("Attachments associated with the memo.").optional(),
434
+ parent: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional(),
435
+ snippet: z2.string().describe("A plain-text preview of the memo content.").optional(),
436
+ location: z2.looseObject({
437
+ placeholder: z2.string().describe("The location label.").optional(),
438
+ latitude: z2.number().describe("The latitude in decimal degrees.").optional(),
439
+ longitude: z2.number().describe("The longitude in decimal degrees.").optional()
440
+ }).describe("A geographic location attached to a memo.").optional(),
441
+ property: z2.looseObject({}).describe("Computed memo properties.").optional()
442
+ }).describe("A Memos memo resource.")).describe("The memos returned by the instance."),
443
+ nextPageToken: z2.string().describe("The continuation token for the next page, or null when no next page exists.").nullable()
444
+ }).describe("A page of Memos memo resources.");
445
+ var getMemoInput = z2.strictObject({
446
+ name: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.")
447
+ }).describe("Input parameters for reading a memo.");
448
+ var getMemoOutput = z2.strictObject({
449
+ memo: z2.looseObject({
450
+ name: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional(),
451
+ state: z2.string().describe("The memo state returned by Memos.").optional(),
452
+ creator: z2.string().min(7).describe("The Memos user resource name in the format users/{user}.").optional(),
453
+ createTime: z2.iso.datetime({ offset: true }).describe("The memo creation time.").optional(),
454
+ updateTime: z2.iso.datetime({ offset: true }).describe("The memo update time.").optional(),
455
+ content: z2.string().describe("The memo Markdown content.").optional(),
456
+ visibility: z2.string().describe("The memo visibility returned by Memos.").optional(),
457
+ tags: z2.array(z2.string().describe("An extracted memo tag.")).describe("Tags extracted from the memo content.").optional(),
458
+ pinned: z2.boolean().describe("Whether the memo is pinned.").optional(),
459
+ attachments: z2.array(z2.looseObject({
460
+ name: z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.").optional(),
461
+ createTime: z2.iso.datetime({ offset: true }).describe("The attachment creation time.").optional(),
462
+ filename: z2.string().describe("The attachment filename.").optional(),
463
+ externalLink: z2.string().describe("The external storage URL when returned by Memos.").optional(),
464
+ type: z2.string().describe("The attachment MIME type.").optional(),
465
+ size: z2.string().describe("The attachment size in bytes, encoded as a string by the Memos API.").optional(),
466
+ memo: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional()
467
+ }).describe("Memos attachment metadata.")).describe("Attachments associated with the memo.").optional(),
468
+ parent: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional(),
469
+ snippet: z2.string().describe("A plain-text preview of the memo content.").optional(),
470
+ location: z2.looseObject({
471
+ placeholder: z2.string().describe("The location label.").optional(),
472
+ latitude: z2.number().describe("The latitude in decimal degrees.").optional(),
473
+ longitude: z2.number().describe("The longitude in decimal degrees.").optional()
474
+ }).describe("A geographic location attached to a memo.").optional(),
475
+ property: z2.looseObject({}).describe("Computed memo properties.").optional()
476
+ }).describe("A Memos memo resource.")
477
+ }).describe("The memo response.");
478
+ var deleteMemoInput = z2.strictObject({
479
+ name: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}."),
480
+ force: z2.boolean().describe("Whether to force deletion when the memo has associated data.").optional()
481
+ }).describe("Input parameters for deleting a memo.");
482
+ var deleteMemoOutput = z2.strictObject({
483
+ deleted: z2.boolean().describe("Whether Memos accepted the deletion."),
484
+ name: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.")
485
+ }).describe("The memo deletion result.");
486
+ var uploadAttachmentInput = z2.strictObject({
487
+ fileUrl: z2.url().describe("The public HTTP or HTTPS URL of the file to upload."),
488
+ filename: z2.string().min(1).describe("The filename to store in Memos."),
489
+ type: z2.string().min(1).describe("The MIME type; inferred from the download response when omitted.").optional(),
490
+ memo: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional(),
491
+ attachmentId: z2.string().min(1).max(36).describe("An optional caller-selected attachment ID.").optional()
492
+ }).describe("Input parameters for uploading an attachment from a URL.");
493
+ var uploadAttachmentOutput = z2.strictObject({
494
+ attachment: z2.looseObject({
495
+ name: z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.").optional(),
496
+ createTime: z2.iso.datetime({ offset: true }).describe("The attachment creation time.").optional(),
497
+ filename: z2.string().describe("The attachment filename.").optional(),
498
+ externalLink: z2.string().describe("The external storage URL when returned by Memos.").optional(),
499
+ type: z2.string().describe("The attachment MIME type.").optional(),
500
+ size: z2.string().describe("The attachment size in bytes, encoded as a string by the Memos API.").optional(),
501
+ memo: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional()
502
+ }).describe("Memos attachment metadata.")
503
+ }).describe("The uploaded attachment response.");
504
+ var listAttachmentsInput = z2.strictObject({
505
+ pageSize: z2.int().min(1).max(1e3).describe("The maximum number of resources to return.").optional(),
506
+ pageToken: z2.string().min(1).describe("The continuation token returned by a previous list action.").optional(),
507
+ filter: z2.string().min(1).describe("The Memos attachment filter expression.").optional(),
508
+ orderBy: z2.string().min(1).describe("The attachment ordering expression, such as create_time desc.").optional()
509
+ }).describe("Input parameters for listing attachments.");
510
+ var listAttachmentsOutput = z2.strictObject({
511
+ attachments: z2.array(z2.looseObject({
512
+ name: z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.").optional(),
513
+ createTime: z2.iso.datetime({ offset: true }).describe("The attachment creation time.").optional(),
514
+ filename: z2.string().describe("The attachment filename.").optional(),
515
+ externalLink: z2.string().describe("The external storage URL when returned by Memos.").optional(),
516
+ type: z2.string().describe("The attachment MIME type.").optional(),
517
+ size: z2.string().describe("The attachment size in bytes, encoded as a string by the Memos API.").optional(),
518
+ memo: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional()
519
+ }).describe("Memos attachment metadata.")).describe("The attachments returned by Memos."),
520
+ nextPageToken: z2.string().describe("The continuation token for the next page, or null when no next page exists.").nullable()
521
+ }).describe("A page of Memos attachment metadata.");
522
+ var getAttachmentInput = z2.strictObject({
523
+ name: z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.")
524
+ }).describe("Input parameters for reading an attachment.");
525
+ var getAttachmentOutput = z2.strictObject({
526
+ attachment: z2.looseObject({
527
+ name: z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.").optional(),
528
+ createTime: z2.iso.datetime({ offset: true }).describe("The attachment creation time.").optional(),
529
+ filename: z2.string().describe("The attachment filename.").optional(),
530
+ externalLink: z2.string().describe("The external storage URL when returned by Memos.").optional(),
531
+ type: z2.string().describe("The attachment MIME type.").optional(),
532
+ size: z2.string().describe("The attachment size in bytes, encoded as a string by the Memos API.").optional(),
533
+ memo: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional()
534
+ }).describe("Memos attachment metadata.")
535
+ }).describe("The attachment metadata response.");
536
+ var deleteAttachmentInput = z2.strictObject({
537
+ name: z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.")
538
+ }).describe("Input parameters for deleting an attachment.");
539
+ var deleteAttachmentOutput = z2.strictObject({
540
+ deleted: z2.boolean().describe("Whether Memos accepted the deletion."),
541
+ name: z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.")
542
+ }).describe("The attachment deletion result.");
543
+ var listMemoAttachmentsInput = z2.strictObject({
544
+ name: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}."),
545
+ pageSize: z2.int().min(1).max(1e3).describe("The maximum number of resources to return.").optional(),
546
+ pageToken: z2.string().min(1).describe("The continuation token returned by a previous list action.").optional()
547
+ }).describe("Input parameters for listing a memo's attachments.");
548
+ var listMemoAttachmentsOutput = z2.strictObject({
549
+ attachments: z2.array(z2.looseObject({
550
+ name: z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.").optional(),
551
+ createTime: z2.iso.datetime({ offset: true }).describe("The attachment creation time.").optional(),
552
+ filename: z2.string().describe("The attachment filename.").optional(),
553
+ externalLink: z2.string().describe("The external storage URL when returned by Memos.").optional(),
554
+ type: z2.string().describe("The attachment MIME type.").optional(),
555
+ size: z2.string().describe("The attachment size in bytes, encoded as a string by the Memos API.").optional(),
556
+ memo: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}.").optional()
557
+ }).describe("Memos attachment metadata.")).describe("The memo attachments returned by Memos."),
558
+ nextPageToken: z2.string().describe("The continuation token for the next page, or null when no next page exists.").nullable()
559
+ }).describe("A page of attachments associated with the memo.");
560
+ var setMemoAttachmentsInput = z2.strictObject({
561
+ name: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}."),
562
+ attachmentNames: z2.array(z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.")).describe("The complete desired list of attachment resource names; use an empty array to clear all attachments.")
563
+ }).describe("Input parameters for replacing a memo's attachment set.");
564
+ var setMemoAttachmentsOutput = z2.strictObject({
565
+ updated: z2.boolean().describe("Whether Memos accepted the attachment replacement."),
566
+ name: z2.string().min(7).describe("The Memos memo resource name in the format memos/{memo}."),
567
+ attachmentNames: z2.array(z2.string().min(13).describe("The Memos attachment resource name in the format attachments/{attachment}.")).describe("The attachment resource names sent to Memos.")
568
+ }).describe("The memo attachment replacement result.");
569
+ var getCurrentUserInput = z2.strictObject({}).describe("The input payload for reading the current Memos user.");
570
+ var getCurrentUserOutput = z2.strictObject({
571
+ user: z2.looseObject({
572
+ name: z2.string().min(7).describe("The Memos user resource name in the format users/{user}.").optional(),
573
+ role: z2.string().describe("The user role returned by Memos.").optional(),
574
+ username: z2.string().describe("The unique Memos username.").optional(),
575
+ email: z2.string().describe("The user's email address.").optional(),
576
+ displayName: z2.string().describe("The user's display name.").optional(),
577
+ avatarUrl: z2.string().describe("The user's avatar URL.").optional(),
578
+ description: z2.string().describe("The user's profile description.").optional(),
579
+ state: z2.string().describe("The user state returned by Memos.").optional(),
580
+ createTime: z2.iso.datetime({ offset: true }).describe("The user creation time.").optional(),
581
+ updateTime: z2.iso.datetime({ offset: true }).describe("The user update time.").optional()
582
+ }).describe("A Memos user resource.")
583
+ }).describe("The current Memos user response.");
584
+ var listUsersInput = z2.strictObject({
585
+ pageSize: z2.int().min(1).max(1e3).describe("The maximum number of resources to return.").optional(),
586
+ pageToken: z2.string().min(1).describe("The continuation token returned by a previous list action.").optional(),
587
+ filter: z2.string().min(1).describe("The user filter expression; Memos v0.29 supports username equality.").optional(),
588
+ showDeleted: z2.boolean().describe("Whether deleted users should be included.").optional()
589
+ }).describe("Input parameters for listing Memos users.");
590
+ var listUsersOutput = z2.strictObject({
591
+ users: z2.array(z2.looseObject({
592
+ name: z2.string().min(7).describe("The Memos user resource name in the format users/{user}.").optional(),
593
+ role: z2.string().describe("The user role returned by Memos.").optional(),
594
+ username: z2.string().describe("The unique Memos username.").optional(),
595
+ email: z2.string().describe("The user's email address.").optional(),
596
+ displayName: z2.string().describe("The user's display name.").optional(),
597
+ avatarUrl: z2.string().describe("The user's avatar URL.").optional(),
598
+ description: z2.string().describe("The user's profile description.").optional(),
599
+ state: z2.string().describe("The user state returned by Memos.").optional(),
600
+ createTime: z2.iso.datetime({ offset: true }).describe("The user creation time.").optional(),
601
+ updateTime: z2.iso.datetime({ offset: true }).describe("The user update time.").optional()
602
+ }).describe("A Memos user resource.")).describe("The users returned by Memos."),
603
+ nextPageToken: z2.string().describe("The continuation token for the next page, or null when no next page exists.").nullable()
604
+ }).describe("A page of Memos users.");
605
+ var getUserInput = z2.strictObject({
606
+ name: z2.string().min(7).describe("The Memos user resource name in the format users/{user}."),
607
+ readMask: z2.string().min(1).describe("An optional comma-separated field mask for the user response.").optional()
608
+ }).describe("Input parameters for reading a Memos user.");
609
+ var getUserOutput = z2.strictObject({
610
+ user: z2.looseObject({
611
+ name: z2.string().min(7).describe("The Memos user resource name in the format users/{user}.").optional(),
612
+ role: z2.string().describe("The user role returned by Memos.").optional(),
613
+ username: z2.string().describe("The unique Memos username.").optional(),
614
+ email: z2.string().describe("The user's email address.").optional(),
615
+ displayName: z2.string().describe("The user's display name.").optional(),
616
+ avatarUrl: z2.string().describe("The user's avatar URL.").optional(),
617
+ description: z2.string().describe("The user's profile description.").optional(),
618
+ state: z2.string().describe("The user state returned by Memos.").optional(),
619
+ createTime: z2.iso.datetime({ offset: true }).describe("The user creation time.").optional(),
620
+ updateTime: z2.iso.datetime({ offset: true }).describe("The user update time.").optional()
621
+ }).describe("A Memos user resource.")
622
+ }).describe("The Memos user response.");
623
+ var memosActions = {
624
+ create_memo: {
625
+ description: "Create a Markdown memo on the connected Memos instance.",
626
+ effect: "write",
627
+ inputSchema: createMemoInput,
628
+ outputSchema: z2.toJSONSchema(createMemoOutput, { io: "output", unrepresentable: "any" })
629
+ },
630
+ list_memos: {
631
+ description: "List memos with pagination, state selection, ordering, and CEL filtering.",
632
+ effect: "read",
633
+ inputSchema: listMemosInput,
634
+ outputSchema: z2.toJSONSchema(listMemosOutput, { io: "output", unrepresentable: "any" })
635
+ },
636
+ get_memo: {
637
+ description: "Retrieve one memo by its Memos resource name.",
638
+ effect: "read",
639
+ inputSchema: getMemoInput,
640
+ outputSchema: z2.toJSONSchema(getMemoOutput, { io: "output", unrepresentable: "any" })
641
+ },
642
+ update_memo: {
643
+ description: "Update selected content, visibility, pin, state, time, or location fields on a memo.",
644
+ effect: "write",
645
+ inputSchema: updateMemoInput,
646
+ outputSchema: z2.toJSONSchema(updateMemoOutput, { io: "output", unrepresentable: "any" })
647
+ },
648
+ delete_memo: {
649
+ description: "Delete one memo, optionally forcing deletion when associated data exists.",
650
+ effect: "destructive",
651
+ inputSchema: deleteMemoInput,
652
+ outputSchema: z2.toJSONSchema(deleteMemoOutput, { io: "output", unrepresentable: "any" })
653
+ },
654
+ upload_attachment: {
655
+ description: "Download a public file URL and upload its bytes to the connected Memos instance.",
656
+ effect: "write",
657
+ inputSchema: uploadAttachmentInput,
658
+ outputSchema: z2.toJSONSchema(uploadAttachmentOutput, { io: "output", unrepresentable: "any" })
659
+ },
660
+ list_attachments: {
661
+ description: "List attachment metadata with pagination, filtering, and ordering.",
662
+ effect: "read",
663
+ inputSchema: listAttachmentsInput,
664
+ outputSchema: z2.toJSONSchema(listAttachmentsOutput, { io: "output", unrepresentable: "any" })
665
+ },
666
+ get_attachment: {
667
+ description: "Retrieve one attachment's metadata by resource name.",
668
+ effect: "read",
669
+ inputSchema: getAttachmentInput,
670
+ outputSchema: z2.toJSONSchema(getAttachmentOutput, { io: "output", unrepresentable: "any" })
671
+ },
672
+ delete_attachment: {
673
+ description: "Delete one attachment by resource name.",
674
+ effect: "destructive",
675
+ inputSchema: deleteAttachmentInput,
676
+ outputSchema: z2.toJSONSchema(deleteAttachmentOutput, { io: "output", unrepresentable: "any" })
677
+ },
678
+ list_memo_attachments: {
679
+ description: "List attachments associated with one memo.",
680
+ effect: "read",
681
+ inputSchema: listMemoAttachmentsInput,
682
+ outputSchema: z2.toJSONSchema(listMemoAttachmentsOutput, { io: "output", unrepresentable: "any" })
683
+ },
684
+ set_memo_attachments: {
685
+ description: "Replace the complete attachment set associated with one memo.",
686
+ effect: "write",
687
+ inputSchema: setMemoAttachmentsInput,
688
+ outputSchema: z2.toJSONSchema(setMemoAttachmentsOutput, { io: "output", unrepresentable: "any" })
689
+ },
690
+ get_current_user: {
691
+ description: "Retrieve the Memos user associated with the connected personal access token.",
692
+ effect: "read",
693
+ inputSchema: getCurrentUserInput,
694
+ outputSchema: z2.toJSONSchema(getCurrentUserOutput, { io: "output", unrepresentable: "any" })
695
+ },
696
+ list_users: {
697
+ description: "List users visible to the connected Memos account.",
698
+ effect: "read",
699
+ inputSchema: listUsersInput,
700
+ outputSchema: z2.toJSONSchema(listUsersOutput, { io: "output", unrepresentable: "any" })
701
+ },
702
+ get_user: {
703
+ description: "Retrieve one Memos user by resource name.",
704
+ effect: "read",
705
+ inputSchema: getUserInput,
706
+ outputSchema: z2.toJSONSchema(getUserOutput, { io: "output", unrepresentable: "any" })
707
+ }
708
+ };
709
+
710
+ // ../plugins/src/memos/index.ts
711
+ function createMemosPlugin() {
712
+ return createProviderPlugin({
713
+ description: "Memos",
714
+ actions: memosActions,
715
+ credentialProbe: "get_current_user",
716
+ mountConfigFields: [{
717
+ key: "baseUrl",
718
+ label: "\u5B9E\u4F8B\u5730\u5740",
719
+ description: "\u4F60\u7684 Memos \u5B9E\u4F8B\u5730\u5740,\u5982 https://memos.example.com",
720
+ required: true
721
+ }],
722
+ handlers: {
723
+ create_memo: createMemo,
724
+ list_memos: listMemos,
725
+ get_memo: getMemo,
726
+ update_memo: updateMemo,
727
+ delete_memo: deleteMemo,
728
+ upload_attachment: uploadAttachment,
729
+ list_attachments: listAttachments,
730
+ get_attachment: getAttachment,
731
+ delete_attachment: deleteAttachment,
732
+ list_memo_attachments: listMemoAttachments,
733
+ set_memo_attachments: setMemoAttachments,
734
+ get_current_user: getCurrentUser,
735
+ list_users: listUsers,
736
+ get_user: getUser
737
+ }
738
+ });
739
+ }
740
+ var memos_default = createMemosPlugin();
741
+ export {
742
+ createMemosPlugin,
743
+ memos_default as default
744
+ };