@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,544 @@
1
+ import {
2
+ createAuthedClient
3
+ } from "./chunk-TDAWLMDE.js";
4
+ import "./chunk-VWRUGUSU.js";
5
+ import {
6
+ asJsonObject,
7
+ compactDefined,
8
+ trimmedText
9
+ } from "./chunk-JXHMDBAY.js";
10
+ import {
11
+ createProviderPlugin,
12
+ upstreamError
13
+ } from "./chunk-WJHG6OK7.js";
14
+ import "./chunk-2JNAI4OC.js";
15
+ import "./chunk-BADVCN6K.js";
16
+ import {
17
+ TBError
18
+ } from "./chunk-5ICRY3VU.js";
19
+ import "./chunk-U67V476Y.js";
20
+
21
+ // ../plugins/src/mem0/api.ts
22
+ var SERVICE = "mem0";
23
+ var API_BASE = "https://api.mem0.ai";
24
+ function requireText(value, field) {
25
+ const result = trimmedText(value);
26
+ if (result === void 0) throw new TBError("invalid_argument", `${field} \u662F\u5FC5\u586B\u7684`);
27
+ return result;
28
+ }
29
+ function errorMessage(value, status) {
30
+ if (typeof value === "string") return value === "" ? `Mem0 \u8FD4\u56DE HTTP ${status}` : value;
31
+ const payload = asJsonObject(value);
32
+ if (payload === void 0) return `Mem0 \u8FD4\u56DE HTTP ${status}`;
33
+ const detail = payload.detail;
34
+ if (typeof detail === "string" && detail !== "") return detail;
35
+ if (Array.isArray(detail)) {
36
+ const parts = detail.map((item) => typeof asJsonObject(item)?.msg === "string" ? asJsonObject(item)?.msg : void 0).filter((item) => item !== void 0 && item !== "");
37
+ if (parts.length > 0) return parts.join("; ");
38
+ }
39
+ if (typeof payload.message === "string" && payload.message !== "") return payload.message;
40
+ if (typeof payload.error === "string" && payload.error !== "") return payload.error;
41
+ return `Mem0 \u8FD4\u56DE HTTP ${status}`;
42
+ }
43
+ var http = createAuthedClient({
44
+ baseUrl: `${API_BASE}/`,
45
+ service: SERVICE,
46
+ auth: { kind: "token" },
47
+ headers: { accept: "application/json" },
48
+ mapError: ({ data, status }) => upstreamError(status, errorMessage(data, status))
49
+ });
50
+ function execute(ctx, input) {
51
+ return http.request(ctx, {
52
+ path: input.path,
53
+ method: input.method ?? "GET",
54
+ query: Object.entries(input.query ?? {}),
55
+ ...input.body === void 0 ? {} : { json: input.body },
56
+ invalidJson: "text"
57
+ });
58
+ }
59
+ async function request(ctx, input) {
60
+ const result = await execute(ctx, input);
61
+ if (result.bodyKind === "empty") return {};
62
+ if (result.bodyKind === "invalid-json" || result.bodyKind === "text") {
63
+ return { raw: result.data };
64
+ }
65
+ return result.data;
66
+ }
67
+ function addMemories(input, ctx) {
68
+ const memory = trimmedText(input.memory);
69
+ if (memory === void 0 && !Array.isArray(input.messages)) {
70
+ throw new TBError("invalid_argument", "\u5FC5\u987B\u63D0\u4F9B memory \u6216 messages");
71
+ }
72
+ return request(ctx, {
73
+ method: "POST",
74
+ path: "/v1/memories/",
75
+ body: compactDefined({
76
+ memory,
77
+ messages: input.messages,
78
+ user_id: trimmedText(input.user_id),
79
+ agent_id: trimmedText(input.agent_id),
80
+ app_id: trimmedText(input.app_id),
81
+ run_id: trimmedText(input.run_id),
82
+ org_id: trimmedText(input.org_id),
83
+ project_id: trimmedText(input.project_id),
84
+ metadata: asJsonObject(input.metadata),
85
+ custom_categories: asJsonObject(input.custom_categories),
86
+ enable_graph: input.enable_graph,
87
+ infer: input.infer,
88
+ async_mode: input.async_mode,
89
+ output_format: trimmedText(input.output_format),
90
+ version: trimmedText(input.version),
91
+ custom_instructions: trimmedText(input.custom_instructions),
92
+ immutable: input.immutable,
93
+ timestamp: input.timestamp,
94
+ expiration_date: trimmedText(input.expiration_date),
95
+ includes: trimmedText(input.includes),
96
+ excludes: trimmedText(input.excludes)
97
+ })
98
+ });
99
+ }
100
+ function getMemories(input, ctx) {
101
+ return request(ctx, {
102
+ method: "POST",
103
+ path: "/v2/memories/",
104
+ body: compactDefined({
105
+ filters: asJsonObject(input.filters),
106
+ page: input.page,
107
+ page_size: input.page_size,
108
+ org_id: trimmedText(input.org_id),
109
+ project_id: trimmedText(input.project_id)
110
+ })
111
+ });
112
+ }
113
+ function searchMemories(input, ctx) {
114
+ return request(ctx, {
115
+ method: "POST",
116
+ path: "/v2/memories/search/",
117
+ body: compactDefined({
118
+ query: requireText(input.query, "query"),
119
+ filters: asJsonObject(input.filters),
120
+ top_k: input.top_k,
121
+ rerank: input.rerank,
122
+ threshold: input.threshold,
123
+ fields: input.fields,
124
+ keyword_search: input.keyword_search,
125
+ filter_memories: input.filter_memories,
126
+ org_id: trimmedText(input.org_id),
127
+ project_id: trimmedText(input.project_id)
128
+ })
129
+ });
130
+ }
131
+ function getMemory(input, ctx) {
132
+ const memoryId = requireText(input.memory_id, "memory_id");
133
+ return request(ctx, { path: `/v1/memories/${encodeURIComponent(memoryId)}/` });
134
+ }
135
+ function updateMemory(input, ctx) {
136
+ const memoryId = requireText(input.memory_id, "memory_id");
137
+ const value = trimmedText(input.text);
138
+ const metadata = asJsonObject(input.metadata);
139
+ if (value === void 0 && metadata === void 0) {
140
+ throw new TBError("invalid_argument", "\u5FC5\u987B\u63D0\u4F9B text \u6216 metadata");
141
+ }
142
+ return request(ctx, {
143
+ method: "PUT",
144
+ path: `/v1/memories/${encodeURIComponent(memoryId)}/`,
145
+ body: compactDefined({ text: value, metadata })
146
+ });
147
+ }
148
+ async function deleteMemory(input, ctx) {
149
+ const memoryId = requireText(input.memory_id, "memory_id");
150
+ const result = await execute(ctx, {
151
+ method: "DELETE",
152
+ path: `/v1/memories/${encodeURIComponent(memoryId)}/`
153
+ });
154
+ const payload = result.bodyKind === "json" ? asJsonObject(result.data) : void 0;
155
+ return {
156
+ memory_id: memoryId,
157
+ deleted: true,
158
+ message: trimmedText(payload?.message) ?? "Memory deleted successfully!"
159
+ };
160
+ }
161
+ function getMemoryHistory(input, ctx) {
162
+ const memoryId = requireText(input.memory_id, "memory_id");
163
+ return request(ctx, { path: `/v1/memories/${encodeURIComponent(memoryId)}/history/` });
164
+ }
165
+ function getEvents(input, ctx) {
166
+ return request(ctx, {
167
+ path: "/v1/events/",
168
+ query: {
169
+ event_type: trimmedText(input.event_type),
170
+ start_date: trimmedText(input.start_date),
171
+ end_date: trimmedText(input.end_date),
172
+ page: input.page,
173
+ page_size: input.page_size
174
+ }
175
+ });
176
+ }
177
+ function getEvent(input, ctx) {
178
+ const eventId = requireText(input.event_id, "event_id");
179
+ return request(ctx, { path: `/v1/event/${encodeURIComponent(eventId)}/` });
180
+ }
181
+ function getUsers(input, ctx) {
182
+ const orgId = trimmedText(input.org_id);
183
+ const projectId = trimmedText(input.project_id);
184
+ if (orgId === void 0 !== (projectId === void 0)) {
185
+ throw new TBError("invalid_argument", "org_id \u4E0E project_id \u5FC5\u987B\u540C\u65F6\u63D0\u4F9B\u6216\u540C\u65F6\u7701\u7565");
186
+ }
187
+ return request(ctx, {
188
+ path: "/v1/entities/",
189
+ query: { entity_type: "user", org_id: orgId, project_id: projectId }
190
+ });
191
+ }
192
+
193
+ // ../plugins/src/mem0/schema.ts
194
+ import { z } from "zod/v4";
195
+ var addMemoriesInput = z.strictObject({
196
+ memory: z.string().min(1).describe("A single memory string to write directly.").optional(),
197
+ messages: z.array(z.strictObject({
198
+ role: z.string().min(1).describe("The message role, such as user or assistant.").optional(),
199
+ content: z.string().min(1).describe("The text content of the message.").optional()
200
+ }).describe("A single message used to create or update memory.")).min(1).describe("The list of messages used to generate memory.").optional(),
201
+ user_id: z.string().min(1).describe("The associated user identifier.").optional(),
202
+ agent_id: z.string().min(1).describe("The associated agent identifier.").optional(),
203
+ app_id: z.string().min(1).describe("The associated application identifier.").optional(),
204
+ run_id: z.string().min(1).describe("The associated run identifier.").optional(),
205
+ org_id: z.string().min(1).describe("An optional organization identifier.").optional(),
206
+ project_id: z.string().min(1).describe("An optional project identifier.").optional(),
207
+ metadata: z.looseObject({}).describe("An arbitrary JSON object returned by Mem0.").optional(),
208
+ custom_categories: z.record(z.string(), z.string().describe("A category description.")).describe("A map of custom category names to their descriptions.").optional(),
209
+ enable_graph: z.boolean().describe("Whether graph memory extraction should be enabled for this request.").optional(),
210
+ infer: z.boolean().describe("Whether Mem0 should infer structured memory from the messages.").optional(),
211
+ async_mode: z.boolean().describe("Whether the write should be processed asynchronously.").optional(),
212
+ output_format: z.enum(["v1.0", "v1.1"]).describe("The response wrapper format version.").optional(),
213
+ version: z.enum(["v1", "v2"]).describe("The memory extraction engine version.").optional(),
214
+ custom_instructions: z.string().min(1).describe("Additional instructions used to guide memory extraction.").optional(),
215
+ immutable: z.boolean().describe("Whether the created memory should be treated as immutable.").optional(),
216
+ timestamp: z.int().describe("The Unix timestamp associated with the memory input.").optional(),
217
+ expiration_date: z.string().min(1).describe("The expiration date to attach to the created memory.").optional(),
218
+ includes: z.string().min(1).describe("A string list of keywords that should be prioritized.").optional(),
219
+ excludes: z.string().min(1).describe("A string list of keywords that should be excluded.").optional()
220
+ }).describe("The input payload for adding memories to Mem0.");
221
+ var addMemoriesOutput = z.union([z.array(z.union([z.strictObject({
222
+ event_id: z.string().describe("The asynchronous event identifier.").optional(),
223
+ status: z.string().describe("The asynchronous processing status.").optional(),
224
+ message: z.string().describe("A status message for asynchronous processing.").optional()
225
+ }).describe("An asynchronous add_memories result item."), z.looseObject({
226
+ id: z.string().describe("The identifier of the created or updated memory.").optional(),
227
+ event: z.string().describe("The event type associated with this result.").optional(),
228
+ memory: z.string().describe("The generated memory text returned by Mem0.").optional(),
229
+ structured_attributes: z.looseObject({}).describe("The structured attributes extracted for the generated memory.").optional()
230
+ }).describe("A processed add_memories result item with top-level memory fields."), z.looseObject({
231
+ id: z.string().describe("The identifier of the created or updated memory.").optional(),
232
+ event: z.string().describe("The event type associated with this result.").optional(),
233
+ data: z.looseObject({
234
+ memory: z.string().describe("The generated memory text returned by Mem0.").optional(),
235
+ structured_attributes: z.looseObject({}).describe("The structured attributes extracted for the generated memory.").optional()
236
+ }).describe("The nested memory payload returned by Mem0.").optional()
237
+ }).describe("A processed add_memories result item with nested data.")]).describe("A single result item returned by add_memories.")).describe("The list of memory creation results."), z.strictObject({
238
+ results: z.array(z.union([z.strictObject({
239
+ event_id: z.string().describe("The asynchronous event identifier.").optional(),
240
+ status: z.string().describe("The asynchronous processing status.").optional(),
241
+ message: z.string().describe("A status message for asynchronous processing.").optional()
242
+ }).describe("An asynchronous add_memories result item."), z.looseObject({
243
+ id: z.string().describe("The identifier of the created or updated memory.").optional(),
244
+ event: z.string().describe("The event type associated with this result.").optional(),
245
+ memory: z.string().describe("The generated memory text returned by Mem0.").optional(),
246
+ structured_attributes: z.looseObject({}).describe("The structured attributes extracted for the generated memory.").optional()
247
+ }).describe("A processed add_memories result item with top-level memory fields."), z.looseObject({
248
+ id: z.string().describe("The identifier of the created or updated memory.").optional(),
249
+ event: z.string().describe("The event type associated with this result.").optional(),
250
+ data: z.looseObject({
251
+ memory: z.string().describe("The generated memory text returned by Mem0.").optional(),
252
+ structured_attributes: z.looseObject({}).describe("The structured attributes extracted for the generated memory.").optional()
253
+ }).describe("The nested memory payload returned by Mem0.").optional()
254
+ }).describe("A processed add_memories result item with nested data.")]).describe("A single result item returned by add_memories.")).describe("The list of memory creation results.").optional()
255
+ }).describe("A memory creation response wrapped in the v1.1 format.")]).describe("The response payload for mem0.add_memories.");
256
+ var getMemoriesInput = z.strictObject({
257
+ filters: z.looseObject({}).describe("The advanced filter object supported by the Mem0 v2 memories API."),
258
+ page: z.int().min(1).describe("The page number to request, starting from 1.").optional(),
259
+ page_size: z.int().min(1).max(100).describe("The maximum number of results per page, up to 100.").optional(),
260
+ org_id: z.string().min(1).describe("An optional organization identifier.").optional(),
261
+ project_id: z.string().min(1).describe("An optional project identifier.").optional()
262
+ }).describe("The input payload for listing memories with advanced filters.");
263
+ var getMemoriesOutput = z.array(z.looseObject({
264
+ id: z.string().describe("The unique identifier of the memory.").optional(),
265
+ memory: z.string().describe("The memory text content.").optional(),
266
+ text: z.string().describe("The updated memory text returned by some write operations.").optional(),
267
+ hash: z.string().describe("The content hash of the memory.").optional(),
268
+ user_id: z.string().describe("The associated user identifier.").optional(),
269
+ agent_id: z.string().describe("The associated agent identifier.").optional(),
270
+ app_id: z.string().describe("The associated application identifier.").optional(),
271
+ run_id: z.string().describe("The associated run identifier.").optional(),
272
+ metadata: z.looseObject({}).describe("An arbitrary JSON object returned by Mem0.").optional(),
273
+ categories: z.array(z.string().describe("One category.")).describe("The categories assigned to the memory.").optional(),
274
+ created_at: z.string().describe("The timestamp when the memory was created.").optional(),
275
+ updated_at: z.string().describe("The timestamp when the memory was last updated.").optional(),
276
+ expiration_date: z.string().describe("The expiration date of the memory.").optional(),
277
+ score: z.number().describe("The relevance score returned by search results.").optional(),
278
+ input: z.array(z.strictObject({
279
+ role: z.string().min(1).describe("The message role, such as user or assistant.").optional(),
280
+ content: z.string().min(1).describe("The text content of the message.").optional()
281
+ }).describe("A single message used to create or update memory.")).describe("The input messages used to generate the memory.").optional(),
282
+ structured_attributes: z.looseObject({}).describe("Structured attributes extracted from the memory.").optional()
283
+ }).describe("A Mem0 memory object.")).describe("The list of Mem0 memories matching the advanced filters.");
284
+ var searchMemoriesInput = z.strictObject({
285
+ query: z.string().min(1).describe("The natural-language query used for semantic search."),
286
+ filters: z.looseObject({}).describe("An optional advanced filter object.").optional(),
287
+ top_k: z.int().min(1).max(100).describe("The maximum number of results to return.").optional(),
288
+ rerank: z.boolean().describe("Whether Mem0 should rerank the initial search results.").optional(),
289
+ threshold: z.number().describe("The semantic similarity threshold.").optional(),
290
+ fields: z.array(z.string().min(1)).min(1).describe("The list of fields to return.").optional(),
291
+ keyword_search: z.boolean().describe("Whether Mem0 should perform keyword search instead of semantic search.").optional(),
292
+ filter_memories: z.boolean().describe("Whether Mem0 should strictly apply the provided filters.").optional(),
293
+ org_id: z.string().min(1).describe("An optional organization identifier.").optional(),
294
+ project_id: z.string().min(1).describe("An optional project identifier.").optional()
295
+ }).describe("The input payload for searching memories in Mem0.");
296
+ var searchMemoriesOutput = z.array(z.looseObject({
297
+ id: z.string().describe("The unique identifier of the memory.").optional(),
298
+ memory: z.string().describe("The memory text content.").optional(),
299
+ text: z.string().describe("The updated memory text returned by some write operations.").optional(),
300
+ hash: z.string().describe("The content hash of the memory.").optional(),
301
+ user_id: z.string().describe("The associated user identifier.").optional(),
302
+ agent_id: z.string().describe("The associated agent identifier.").optional(),
303
+ app_id: z.string().describe("The associated application identifier.").optional(),
304
+ run_id: z.string().describe("The associated run identifier.").optional(),
305
+ metadata: z.looseObject({}).describe("An arbitrary JSON object returned by Mem0.").optional(),
306
+ categories: z.array(z.string().describe("One category.")).describe("The categories assigned to the memory.").optional(),
307
+ created_at: z.string().describe("The timestamp when the memory was created.").optional(),
308
+ updated_at: z.string().describe("The timestamp when the memory was last updated.").optional(),
309
+ expiration_date: z.string().describe("The expiration date of the memory.").optional(),
310
+ score: z.number().describe("The relevance score returned by search results.").optional(),
311
+ input: z.array(z.strictObject({
312
+ role: z.string().min(1).describe("The message role, such as user or assistant.").optional(),
313
+ content: z.string().min(1).describe("The text content of the message.").optional()
314
+ }).describe("A single message used to create or update memory.")).describe("The input messages used to generate the memory.").optional(),
315
+ structured_attributes: z.looseObject({}).describe("Structured attributes extracted from the memory.").optional()
316
+ }).describe("A Mem0 memory object.")).describe("The list of memories returned by semantic search.");
317
+ var getMemoryInput = z.strictObject({
318
+ memory_id: z.string().min(1).describe("The unique identifier of the target memory.").optional()
319
+ }).describe("The input payload for retrieving a single Mem0 memory.");
320
+ var getMemoryOutput = z.looseObject({
321
+ id: z.string().describe("The unique identifier of the memory.").optional(),
322
+ memory: z.string().describe("The memory text content.").optional(),
323
+ text: z.string().describe("The updated memory text returned by some write operations.").optional(),
324
+ hash: z.string().describe("The content hash of the memory.").optional(),
325
+ user_id: z.string().describe("The associated user identifier.").optional(),
326
+ agent_id: z.string().describe("The associated agent identifier.").optional(),
327
+ app_id: z.string().describe("The associated application identifier.").optional(),
328
+ run_id: z.string().describe("The associated run identifier.").optional(),
329
+ metadata: z.looseObject({}).describe("An arbitrary JSON object returned by Mem0.").optional(),
330
+ categories: z.array(z.string().describe("One category.")).describe("The categories assigned to the memory.").optional(),
331
+ created_at: z.string().describe("The timestamp when the memory was created.").optional(),
332
+ updated_at: z.string().describe("The timestamp when the memory was last updated.").optional(),
333
+ expiration_date: z.string().describe("The expiration date of the memory.").optional(),
334
+ score: z.number().describe("The relevance score returned by search results.").optional(),
335
+ input: z.array(z.strictObject({
336
+ role: z.string().min(1).describe("The message role, such as user or assistant.").optional(),
337
+ content: z.string().min(1).describe("The text content of the message.").optional()
338
+ }).describe("A single message used to create or update memory.")).describe("The input messages used to generate the memory.").optional(),
339
+ structured_attributes: z.looseObject({}).describe("Structured attributes extracted from the memory.").optional()
340
+ }).describe("A Mem0 memory object.");
341
+ var updateMemoryInput = z.strictObject({
342
+ memory_id: z.string().min(1).describe("The unique identifier of the target memory."),
343
+ text: z.string().min(1).describe("The new memory text to store.").optional(),
344
+ metadata: z.looseObject({}).describe("An arbitrary JSON object returned by Mem0.").optional()
345
+ }).describe("The input payload for updating a Mem0 memory.");
346
+ var updateMemoryOutput = z.looseObject({
347
+ id: z.string().describe("The unique identifier of the memory.").optional(),
348
+ memory: z.string().describe("The memory text content.").optional(),
349
+ text: z.string().describe("The updated memory text returned by some write operations.").optional(),
350
+ hash: z.string().describe("The content hash of the memory.").optional(),
351
+ user_id: z.string().describe("The associated user identifier.").optional(),
352
+ agent_id: z.string().describe("The associated agent identifier.").optional(),
353
+ app_id: z.string().describe("The associated application identifier.").optional(),
354
+ run_id: z.string().describe("The associated run identifier.").optional(),
355
+ metadata: z.looseObject({}).describe("An arbitrary JSON object returned by Mem0.").optional(),
356
+ categories: z.array(z.string().describe("One category.")).describe("The categories assigned to the memory.").optional(),
357
+ created_at: z.string().describe("The timestamp when the memory was created.").optional(),
358
+ updated_at: z.string().describe("The timestamp when the memory was last updated.").optional(),
359
+ expiration_date: z.string().describe("The expiration date of the memory.").optional(),
360
+ score: z.number().describe("The relevance score returned by search results.").optional(),
361
+ input: z.array(z.strictObject({
362
+ role: z.string().min(1).describe("The message role, such as user or assistant.").optional(),
363
+ content: z.string().min(1).describe("The text content of the message.").optional()
364
+ }).describe("A single message used to create or update memory.")).describe("The input messages used to generate the memory.").optional(),
365
+ structured_attributes: z.looseObject({}).describe("Structured attributes extracted from the memory.").optional()
366
+ }).describe("A Mem0 memory object.");
367
+ var deleteMemoryInput = z.strictObject({
368
+ memory_id: z.string().min(1).describe("The unique identifier of the target memory.").optional()
369
+ }).describe("The input payload for deleting a Mem0 memory.");
370
+ var deleteMemoryOutput = z.strictObject({
371
+ memory_id: z.string().describe("The identifier of the deleted memory.").optional(),
372
+ deleted: z.boolean().describe("Whether the memory was deleted successfully.").optional(),
373
+ message: z.string().describe("A deletion status message.").optional()
374
+ }).describe("The explicit acknowledgment object returned after deleting a Mem0 memory.");
375
+ var getMemoryHistoryInput = z.strictObject({
376
+ memory_id: z.string().min(1).describe("The unique identifier of the target memory.").optional()
377
+ }).describe("The input payload for retrieving Mem0 memory history.");
378
+ var getMemoryHistoryOutput = z.array(z.looseObject({
379
+ id: z.string().describe("The unique identifier of the history entry.").optional(),
380
+ memory_id: z.string().describe("The identifier of the related memory.").optional(),
381
+ event: z.string().describe("The history event type.").optional(),
382
+ old_memory: z.string().describe("A string value returned by Mem0, or null.").nullable().optional(),
383
+ new_memory: z.string().describe("A string value returned by Mem0, or null.").nullable().optional(),
384
+ input: z.array(z.strictObject({
385
+ role: z.string().min(1).describe("The message role, such as user or assistant.").optional(),
386
+ content: z.string().min(1).describe("The text content of the message.").optional()
387
+ }).describe("A single message used to create or update memory.")).describe("The input messages that triggered the change.").optional(),
388
+ metadata: z.looseObject({}).describe("An arbitrary JSON object returned by Mem0.").optional(),
389
+ created_at: z.string().describe("The timestamp when the history entry was created.").optional(),
390
+ updated_at: z.string().describe("The timestamp when the history entry was last updated.").optional(),
391
+ user_id: z.string().describe("The associated user identifier.").optional()
392
+ }).describe("A Mem0 memory history record.")).describe("The history entries for the requested memory.");
393
+ var getEventsInput = z.strictObject({
394
+ event_type: z.string().min(1).describe("Filter events by event type.").optional(),
395
+ start_date: z.string().min(1).describe("The start date filter, typically in YYYY-MM-DD format.").optional(),
396
+ end_date: z.string().min(1).describe("The end date filter, typically in YYYY-MM-DD format.").optional(),
397
+ page: z.int().min(1).describe("The page number to request, starting from 1.").optional(),
398
+ page_size: z.int().min(1).max(100).describe("The maximum number of results per page, up to 100.").optional()
399
+ }).describe("The input payload for listing Mem0 events.");
400
+ var getEventsOutput = z.strictObject({
401
+ count: z.number().describe("The total number of events matching the current query."),
402
+ next: z.string().describe("A string value returned by Mem0, or null.").nullable().optional(),
403
+ previous: z.string().describe("A string value returned by Mem0, or null.").nullable().optional(),
404
+ results: z.array(z.looseObject({
405
+ id: z.string().describe("The unique identifier of the event.").optional(),
406
+ event_type: z.string().describe("The event type.").optional(),
407
+ status: z.string().describe("The processing status of the event.").optional(),
408
+ payload: z.looseObject({}).describe("The raw request payload captured for the event.").optional(),
409
+ results: z.array(z.unknown().describe("One event processing result.")).describe("The list of event processing results.").optional(),
410
+ metadata: z.looseObject({}).describe("An arbitrary JSON object returned by Mem0.").optional(),
411
+ latency: z.number().describe("The event processing latency in milliseconds.").nullable().optional(),
412
+ graph_status: z.unknown().describe("The graph-memory processing status.").optional(),
413
+ created_at: z.string().describe("The timestamp when the event was created.").optional(),
414
+ updated_at: z.string().describe("The timestamp when the event was last updated.").optional(),
415
+ started_at: z.string().describe("A string value returned by Mem0, or null.").nullable().optional(),
416
+ completed_at: z.string().describe("A string value returned by Mem0, or null.").nullable().optional()
417
+ }).describe("A Mem0 event object.")).describe("The list of event records.")
418
+ }).describe("A paginated Mem0 event response.");
419
+ var getEventInput = z.strictObject({
420
+ event_id: z.string().min(1).describe("The unique identifier of the target event.").optional()
421
+ }).describe("The input payload for retrieving a single Mem0 event.");
422
+ var getEventOutput = z.looseObject({
423
+ id: z.string().describe("The unique identifier of the event.").optional(),
424
+ event_type: z.string().describe("The event type.").optional(),
425
+ status: z.string().describe("The processing status of the event.").optional(),
426
+ payload: z.looseObject({}).describe("The raw request payload captured for the event.").optional(),
427
+ results: z.array(z.unknown().describe("One event processing result.")).describe("The list of event processing results.").optional(),
428
+ metadata: z.looseObject({}).describe("An arbitrary JSON object returned by Mem0.").optional(),
429
+ latency: z.number().describe("The event processing latency in milliseconds.").nullable().optional(),
430
+ graph_status: z.unknown().describe("The graph-memory processing status.").optional(),
431
+ created_at: z.string().describe("The timestamp when the event was created.").optional(),
432
+ updated_at: z.string().describe("The timestamp when the event was last updated.").optional(),
433
+ started_at: z.string().describe("A string value returned by Mem0, or null.").nullable().optional(),
434
+ completed_at: z.string().describe("A string value returned by Mem0, or null.").nullable().optional()
435
+ }).describe("A Mem0 event object.");
436
+ var getUsersInput = z.strictObject({
437
+ org_id: z.string().min(1).describe("An optional organization identifier.").optional(),
438
+ project_id: z.string().min(1).describe("An optional project identifier.").optional()
439
+ }).describe("The input payload for listing Mem0 user entities.");
440
+ var getUsersOutput = z.strictObject({
441
+ entity_type: z.string().describe("The entity type returned by the current query.").optional(),
442
+ count: z.number().describe("The total number of user entities."),
443
+ next: z.string().describe("A string value returned by Mem0, or null.").nullable().optional(),
444
+ previous: z.string().describe("A string value returned by Mem0, or null.").nullable().optional(),
445
+ results: z.array(z.looseObject({
446
+ id: z.string().describe("The unique identifier of the user entity.").optional(),
447
+ name: z.string().describe("The display name of the user entity.").optional(),
448
+ type: z.string().describe("The entity type.").optional(),
449
+ owner: z.string().describe("The owner of the entity.").optional(),
450
+ metadata: z.looseObject({}).describe("An arbitrary JSON object returned by Mem0.").optional(),
451
+ created_at: z.string().describe("The timestamp when the user entity was created.").optional(),
452
+ updated_at: z.string().describe("The timestamp when the user entity was last updated.").optional()
453
+ }).describe("A Mem0 user entity.")).describe("The list of user entities.")
454
+ }).describe("A paginated Mem0 user entity response.");
455
+ var mem0Actions = {
456
+ add_memories: {
457
+ description: "Add new memories to Mem0 from messages or direct memory text.",
458
+ effect: "write",
459
+ inputSchema: addMemoriesInput,
460
+ outputSchema: z.toJSONSchema(addMemoriesOutput, { io: "output", unrepresentable: "any" })
461
+ },
462
+ get_memories: {
463
+ description: "List memories from Mem0 with v2 advanced filters.",
464
+ effect: "read",
465
+ inputSchema: getMemoriesInput,
466
+ outputSchema: z.toJSONSchema(getMemoriesOutput, { io: "output", unrepresentable: "any" })
467
+ },
468
+ search_memories: {
469
+ description: "Search memories in Mem0 with semantic query and optional filters.",
470
+ effect: "read",
471
+ inputSchema: searchMemoriesInput,
472
+ outputSchema: z.toJSONSchema(searchMemoriesOutput, { io: "output", unrepresentable: "any" })
473
+ },
474
+ get_memory: {
475
+ description: "Get a single memory from Mem0 by memory ID.",
476
+ effect: "read",
477
+ inputSchema: getMemoryInput,
478
+ outputSchema: z.toJSONSchema(getMemoryOutput, { io: "output", unrepresentable: "any" })
479
+ },
480
+ update_memory: {
481
+ description: "Update text or metadata of a Mem0 memory by memory ID.",
482
+ effect: "write",
483
+ inputSchema: updateMemoryInput,
484
+ outputSchema: z.toJSONSchema(updateMemoryOutput, { io: "output", unrepresentable: "any" })
485
+ },
486
+ delete_memory: {
487
+ description: "Delete a Mem0 memory by memory ID.",
488
+ effect: "destructive",
489
+ inputSchema: deleteMemoryInput,
490
+ outputSchema: z.toJSONSchema(deleteMemoryOutput, { io: "output", unrepresentable: "any" })
491
+ },
492
+ get_memory_history: {
493
+ description: "Get the change history of a Mem0 memory by memory ID.",
494
+ effect: "read",
495
+ inputSchema: getMemoryHistoryInput,
496
+ outputSchema: z.toJSONSchema(getMemoryHistoryOutput, { io: "output", unrepresentable: "any" })
497
+ },
498
+ get_events: {
499
+ description: "List Mem0 events for the current API key.",
500
+ effect: "read",
501
+ inputSchema: getEventsInput,
502
+ outputSchema: z.toJSONSchema(getEventsOutput, { io: "output", unrepresentable: "any" })
503
+ },
504
+ get_event: {
505
+ description: "Get a single Mem0 event by event ID.",
506
+ effect: "read",
507
+ inputSchema: getEventInput,
508
+ outputSchema: z.toJSONSchema(getEventOutput, { io: "output", unrepresentable: "any" })
509
+ },
510
+ get_users: {
511
+ description: "List user entities from Mem0, optionally scoped by org and project.",
512
+ effect: "read",
513
+ inputSchema: getUsersInput,
514
+ outputSchema: z.toJSONSchema(getUsersOutput, { io: "output", unrepresentable: "any" })
515
+ }
516
+ };
517
+
518
+ // ../plugins/src/mem0/index.ts
519
+ function createMem0Plugin() {
520
+ return createProviderPlugin({
521
+ description: "Mem0",
522
+ actions: mem0Actions,
523
+ // 上游的 credentialValidators 打的就是 /v1/events/;它只读、无必填入参,平台空参调
524
+ // 一次即可判定 key 是否可用(空参时不带分页,比上游的 page_size=1 多取一页,可接受)。
525
+ credentialProbe: "get_events",
526
+ handlers: {
527
+ add_memories: addMemories,
528
+ get_memories: getMemories,
529
+ search_memories: searchMemories,
530
+ get_memory: getMemory,
531
+ update_memory: updateMemory,
532
+ delete_memory: deleteMemory,
533
+ get_memory_history: getMemoryHistory,
534
+ get_events: getEvents,
535
+ get_event: getEvent,
536
+ get_users: getUsers
537
+ }
538
+ });
539
+ }
540
+ var mem0_default = createMem0Plugin();
541
+ export {
542
+ createMem0Plugin,
543
+ mem0_default as default
544
+ };