@frontmcp/plugins 0.6.3 → 0.7.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 (46) hide show
  1. package/esm/index.mjs +5 -2951
  2. package/esm/package.json +11 -38
  3. package/index.d.ts +16 -4
  4. package/index.d.ts.map +1 -0
  5. package/index.js +9 -2952
  6. package/package.json +11 -38
  7. package/cache/cache.plugin.d.ts +0 -10
  8. package/cache/cache.symbol.d.ts +0 -3
  9. package/cache/cache.types.d.ts +0 -68
  10. package/cache/index.d.ts +0 -2
  11. package/cache/index.js +0 -412
  12. package/cache/providers/cache-memory.provider.d.ts +0 -19
  13. package/cache/providers/cache-redis.provider.d.ts +0 -15
  14. package/cache/providers/cache-vercel-kv.provider.d.ts +0 -24
  15. package/codecall/codecall.plugin.d.ts +0 -41
  16. package/codecall/codecall.symbol.d.ts +0 -106
  17. package/codecall/codecall.types.d.ts +0 -352
  18. package/codecall/errors/index.d.ts +0 -1
  19. package/codecall/errors/tool-call.errors.d.ts +0 -79
  20. package/codecall/index.d.ts +0 -2
  21. package/codecall/index.js +0 -2988
  22. package/codecall/providers/code-call.config.d.ts +0 -29
  23. package/codecall/security/index.d.ts +0 -2
  24. package/codecall/security/self-reference-guard.d.ts +0 -32
  25. package/codecall/security/tool-access-control.service.d.ts +0 -104
  26. package/codecall/services/audit-logger.service.d.ts +0 -186
  27. package/codecall/services/enclave.service.d.ts +0 -62
  28. package/codecall/services/error-enrichment.service.d.ts +0 -94
  29. package/codecall/services/index.d.ts +0 -6
  30. package/codecall/services/output-sanitizer.d.ts +0 -86
  31. package/codecall/services/synonym-expansion.service.d.ts +0 -66
  32. package/codecall/services/tool-search.service.d.ts +0 -175
  33. package/codecall/tools/describe.schema.d.ts +0 -28
  34. package/codecall/tools/describe.tool.d.ts +0 -35
  35. package/codecall/tools/execute.schema.d.ts +0 -115
  36. package/codecall/tools/execute.tool.d.ts +0 -5
  37. package/codecall/tools/index.d.ts +0 -4
  38. package/codecall/tools/invoke.schema.d.ts +0 -104
  39. package/codecall/tools/invoke.tool.d.ts +0 -13
  40. package/codecall/tools/search.schema.d.ts +0 -30
  41. package/codecall/tools/search.tool.d.ts +0 -5
  42. package/codecall/utils/describe.utils.d.ts +0 -86
  43. package/codecall/utils/index.d.ts +0 -2
  44. package/codecall/utils/mcp-result.d.ts +0 -6
  45. package/esm/cache/index.mjs +0 -395
  46. package/esm/codecall/index.mjs +0 -2959
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frontmcp/plugins",
3
- "version": "0.6.3",
4
- "description": "FrontMCP plugins to extend the SDK",
3
+ "version": "0.7.1",
4
+ "description": "FrontMCP plugins meta-package - installs all official plugins",
5
5
  "author": "AgentFront <info@agentfront.dev>",
6
6
  "homepage": "https://docs.agentfront.dev",
7
7
  "license": "Apache-2.0",
@@ -21,6 +21,10 @@
21
21
  "bugs": {
22
22
  "url": "https://github.com/agentfront/frontmcp/issues"
23
23
  },
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "registry": "https://registry.npmjs.org/"
27
+ },
24
28
  "type": "commonjs",
25
29
  "main": "./index.js",
26
30
  "module": "./esm/index.mjs",
@@ -37,46 +41,15 @@
37
41
  "types": "./index.d.ts",
38
42
  "default": "./esm/index.mjs"
39
43
  }
40
- },
41
- "./cache": {
42
- "require": {
43
- "types": "./cache/index.d.ts",
44
- "default": "./cache/index.js"
45
- },
46
- "import": {
47
- "types": "./cache/index.d.ts",
48
- "default": "./esm/cache/index.mjs"
49
- }
50
- },
51
- "./codecall": {
52
- "require": {
53
- "types": "./codecall/index.d.ts",
54
- "default": "./codecall/index.js"
55
- },
56
- "import": {
57
- "types": "./codecall/index.d.ts",
58
- "default": "./esm/codecall/index.mjs"
59
- }
60
- },
61
- "./esm": null
44
+ }
62
45
  },
63
46
  "dependencies": {
64
- "ioredis": "^5.8.0",
65
- "@frontmcp/sdk": "0.6.3",
66
- "enclave-vm": "^1.0.3",
67
- "vectoriadb": "^2.0.1",
68
- "zod": "^4.0.0",
69
- "@modelcontextprotocol/sdk": "1.25.1"
47
+ "@frontmcp/plugin-cache": "0.7.1",
48
+ "@frontmcp/plugin-codecall": "0.7.1",
49
+ "@frontmcp/plugin-dashboard": "0.7.1",
50
+ "@frontmcp/plugin-remember": "0.7.1"
70
51
  },
71
52
  "devDependencies": {
72
53
  "reflect-metadata": "^0.2.2"
73
- },
74
- "peerDependencies": {
75
- "@vercel/kv": "^2.0.0 || ^3.0.0"
76
- },
77
- "peerDependenciesMeta": {
78
- "@vercel/kv": {
79
- "optional": true
80
- }
81
54
  }
82
55
  }
@@ -1,10 +0,0 @@
1
- import { DynamicPlugin, FlowCtxOf, ProviderType } from '@frontmcp/sdk';
2
- import { CachePluginOptions } from './cache.types';
3
- export default class CachePlugin extends DynamicPlugin<CachePluginOptions> {
4
- static dynamicProviders: (options: CachePluginOptions) => ProviderType[];
5
- static defaultOptions: CachePluginOptions;
6
- options: CachePluginOptions;
7
- constructor(options?: CachePluginOptions);
8
- willReadCache(flowCtx: FlowCtxOf<'tools:call-tool'>): Promise<void>;
9
- willWriteCache(flowCtx: FlowCtxOf<'tools:call-tool'>): Promise<void>;
10
- }
@@ -1,3 +0,0 @@
1
- import { CacheStoreInterface } from './cache.types';
2
- import { Token } from '@frontmcp/sdk';
3
- export declare const CacheStoreToken: Token<CacheStoreInterface>;
@@ -1,68 +0,0 @@
1
- import { Redis as RedisClient } from 'ioredis';
2
- declare global {
3
- interface ExtendFrontMcpToolMetadata {
4
- cache?: CachePluginToolOptions | true;
5
- }
6
- }
7
- export interface CachePluginToolOptions {
8
- /**
9
- * Time to live in seconds. Default is 1 day.
10
- */
11
- ttl?: number;
12
- /**
13
- * If true, the cache value will be updated with the new value after the TTL.
14
- * Default is false.
15
- */
16
- slideWindow?: boolean;
17
- }
18
- export interface BaseCachePluginOptions {
19
- defaultTTL?: number;
20
- }
21
- export interface RedisClientCachePluginOptions extends BaseCachePluginOptions {
22
- type: 'redis-client';
23
- client: RedisClient;
24
- }
25
- export interface RedisCachePluginOptions extends BaseCachePluginOptions {
26
- type: 'redis';
27
- config: {
28
- host: string;
29
- port: number;
30
- password?: string;
31
- db?: number;
32
- };
33
- }
34
- export type MemoryCachePluginOptions = BaseCachePluginOptions & {
35
- type: 'memory';
36
- };
37
- /**
38
- * Use global store configuration from @FrontMcp decorator.
39
- * Requires `redis` to be configured in the main FrontMcp options.
40
- * Supports both Redis and Vercel KV global configurations.
41
- *
42
- * @example
43
- * ```typescript
44
- * // In main.ts - configure global store
45
- * @FrontMcp({
46
- * redis: { host: 'localhost', port: 6379 },
47
- * apps: [MyApp]
48
- * })
49
- *
50
- * // In app - use global store
51
- * @App({
52
- * plugins: [CachePlugin.init({ type: 'global-store' })]
53
- * })
54
- * class MyApp {}
55
- * ```
56
- */
57
- export interface GlobalStoreCachePluginOptions extends BaseCachePluginOptions {
58
- type: 'global-store';
59
- }
60
- export type RedisCacheOptions = RedisClientCachePluginOptions | RedisCachePluginOptions;
61
- export type CachePluginOptions = MemoryCachePluginOptions | RedisCacheOptions | GlobalStoreCachePluginOptions;
62
- export interface CacheStoreInterface {
63
- setValue(key: string, value: unknown, ttlSeconds?: number): Promise<void>;
64
- getValue<T = unknown>(key: string, defaultValue?: T): Promise<T | undefined>;
65
- delete(key: string): Promise<void>;
66
- exists(key: string): Promise<boolean>;
67
- close(): Promise<void>;
68
- }
package/cache/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { default } from './cache.plugin';
2
- export * from './cache.types';
package/cache/index.js DELETED
@@ -1,412 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var __decorateClass = (decorators, target, key, kind) => {
31
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
32
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
33
- if (decorator = decorators[i])
34
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
35
- if (kind && result) __defProp(target, key, result);
36
- return result;
37
- };
38
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
39
-
40
- // libs/plugins/src/cache/index.ts
41
- var cache_exports = {};
42
- __export(cache_exports, {
43
- default: () => CachePlugin
44
- });
45
- module.exports = __toCommonJS(cache_exports);
46
-
47
- // libs/plugins/src/cache/cache.plugin.ts
48
- var import_sdk4 = require("@frontmcp/sdk");
49
-
50
- // libs/plugins/src/cache/providers/cache-redis.provider.ts
51
- var import_ioredis = __toESM(require("ioredis"));
52
- var import_sdk = require("@frontmcp/sdk");
53
- var CacheRedisProvider = class {
54
- client;
55
- constructor(options) {
56
- if (options.type !== "redis" && options.type !== "redis-client") {
57
- throw new Error("Invalid cache provider type");
58
- }
59
- if (options.type === "redis-client") {
60
- this.client = options.client;
61
- return;
62
- }
63
- this.client = new import_ioredis.default({
64
- lazyConnect: false,
65
- maxRetriesPerRequest: 3,
66
- ...options.config
67
- });
68
- this.client.on("connect", () => console.log("[Redis] Connected"));
69
- this.client.on("error", (err) => console.error("[Redis] Error:", err));
70
- }
71
- /** Set a value (auto-stringifies objects) */
72
- async setValue(key, value, ttlSeconds) {
73
- const strValue = typeof value === "string" ? value : JSON.stringify(value);
74
- if (ttlSeconds && ttlSeconds > 0) {
75
- await this.client.set(key, strValue, "EX", ttlSeconds);
76
- } else {
77
- await this.client.set(key, strValue);
78
- }
79
- }
80
- /** Get a value and automatically parse JSON if possible */
81
- async getValue(key, defaultValue) {
82
- const raw = await this.client.get(key);
83
- if (raw === null) return defaultValue;
84
- try {
85
- return JSON.parse(raw);
86
- } catch {
87
- return raw;
88
- }
89
- }
90
- /** Delete a key */
91
- async delete(key) {
92
- await this.client.del(key);
93
- }
94
- /** Check if a key exists */
95
- async exists(key) {
96
- return await this.client.exists(key) === 1;
97
- }
98
- /** Gracefully close the Redis connection */
99
- async close() {
100
- await this.client.quit();
101
- }
102
- };
103
- CacheRedisProvider = __decorateClass([
104
- (0, import_sdk.Provider)({
105
- name: "provider:cache:redis",
106
- description: "Redis-based cache provider",
107
- scope: import_sdk.ProviderScope.GLOBAL
108
- })
109
- ], CacheRedisProvider);
110
-
111
- // libs/plugins/src/cache/providers/cache-memory.provider.ts
112
- var import_sdk2 = require("@frontmcp/sdk");
113
- var MAX_TIMEOUT_MS = 2 ** 31 - 1;
114
- var CacheMemoryProvider = class {
115
- memory = /* @__PURE__ */ new Map();
116
- sweeper;
117
- constructor(sweepIntervalTTL = 60) {
118
- this.sweeper = setInterval(() => this.sweep(), sweepIntervalTTL * 1e3);
119
- this.sweeper.unref?.();
120
- }
121
- /** Set a value (auto-stringifies objects) */
122
- async setValue(key, value, ttlSeconds) {
123
- const strValue = typeof value === "string" ? value : JSON.stringify(value);
124
- const existing = this.memory.get(key);
125
- if (existing?.timeout) clearTimeout(existing.timeout);
126
- const entry = { value: strValue };
127
- if (ttlSeconds && ttlSeconds > 0) {
128
- const ttlMs = ttlSeconds * 1e3;
129
- entry.expiresAt = Date.now() + ttlMs;
130
- if (ttlMs <= MAX_TIMEOUT_MS) {
131
- entry.timeout = setTimeout(() => {
132
- const e = this.memory.get(key);
133
- if (e && e.expiresAt && e.expiresAt <= Date.now()) {
134
- this.memory.delete(key);
135
- }
136
- }, ttlMs);
137
- entry.timeout.unref?.();
138
- }
139
- }
140
- this.memory.set(key, entry);
141
- }
142
- /** Get a value and automatically parse JSON if possible */
143
- async getValue(key, defaultValue) {
144
- const entry = this.memory.get(key);
145
- if (!entry) return defaultValue;
146
- if (this.isExpired(entry)) {
147
- await this.delete(key);
148
- return defaultValue;
149
- }
150
- const raw = entry.value;
151
- try {
152
- return JSON.parse(raw);
153
- } catch {
154
- return raw;
155
- }
156
- }
157
- /** Delete a key */
158
- async delete(key) {
159
- const entry = this.memory.get(key);
160
- if (entry?.timeout) clearTimeout(entry.timeout);
161
- this.memory.delete(key);
162
- }
163
- /** Check if a key exists (and not expired) */
164
- async exists(key) {
165
- const entry = this.memory.get(key);
166
- if (!entry) return false;
167
- if (this.isExpired(entry)) {
168
- await this.delete(key);
169
- return false;
170
- }
171
- return true;
172
- }
173
- /** Gracefully close the provider */
174
- async close() {
175
- if (this.sweeper) clearInterval(this.sweeper);
176
- for (const [, entry] of this.memory) {
177
- if (entry.timeout) clearTimeout(entry.timeout);
178
- }
179
- this.memory.clear();
180
- }
181
- // ---- internals ----
182
- isExpired(entry) {
183
- return entry.expiresAt !== void 0 && entry.expiresAt <= Date.now();
184
- }
185
- /** Periodically remove expired keys to keep memory tidy */
186
- sweep() {
187
- const now = Date.now();
188
- for (const [key, entry] of this.memory) {
189
- if (entry.expiresAt !== void 0 && entry.expiresAt <= now) {
190
- if (entry.timeout) clearTimeout(entry.timeout);
191
- this.memory.delete(key);
192
- }
193
- }
194
- }
195
- };
196
- CacheMemoryProvider = __decorateClass([
197
- (0, import_sdk2.Provider)({
198
- name: "provider:cache:memory",
199
- description: "Memory-based cache provider",
200
- scope: import_sdk2.ProviderScope.GLOBAL
201
- })
202
- ], CacheMemoryProvider);
203
-
204
- // libs/plugins/src/cache/providers/cache-vercel-kv.provider.ts
205
- var import_sdk3 = require("@frontmcp/sdk");
206
- var CacheVercelKvProvider = class {
207
- kv;
208
- keyPrefix;
209
- defaultTTL;
210
- constructor(options = {}) {
211
- const vercelKv = require("@vercel/kv");
212
- const hasUrl = options.url !== void 0;
213
- const hasToken = options.token !== void 0;
214
- if (hasUrl !== hasToken) {
215
- throw new Error(
216
- `CacheVercelKvProvider: Both 'url' and 'token' must be provided together, or neither. Received: url=${hasUrl ? "provided" : "missing"}, token=${hasToken ? "provided" : "missing"}`
217
- );
218
- }
219
- if (options.url && options.token) {
220
- this.kv = vercelKv.createClient({
221
- url: options.url,
222
- token: options.token
223
- });
224
- } else {
225
- this.kv = vercelKv.kv;
226
- }
227
- this.keyPrefix = options.keyPrefix ?? "cache:";
228
- this.defaultTTL = options.defaultTTL ?? 60 * 60 * 24;
229
- }
230
- prefixKey(key) {
231
- return `${this.keyPrefix}${key}`;
232
- }
233
- /** Set a value (auto-stringifies objects) */
234
- async setValue(key, value, ttlSeconds) {
235
- const strValue = typeof value === "string" ? value : JSON.stringify(value);
236
- const ttl = ttlSeconds ?? this.defaultTTL;
237
- if (ttl > 0) {
238
- await this.kv.set(this.prefixKey(key), strValue, { ex: ttl });
239
- } else {
240
- await this.kv.set(this.prefixKey(key), strValue);
241
- }
242
- }
243
- /** Get a value and automatically parse JSON if possible */
244
- async getValue(key, defaultValue) {
245
- const raw = await this.kv.get(this.prefixKey(key));
246
- if (raw === null || raw === void 0) return defaultValue;
247
- if (typeof raw === "string") {
248
- try {
249
- return JSON.parse(raw);
250
- } catch {
251
- return raw;
252
- }
253
- }
254
- return raw;
255
- }
256
- /** Delete a key */
257
- async delete(key) {
258
- await this.kv.del(this.prefixKey(key));
259
- }
260
- /** Check if a key exists */
261
- async exists(key) {
262
- return await this.kv.exists(this.prefixKey(key)) === 1;
263
- }
264
- /** Gracefully close the provider (no-op for Vercel KV - stateless REST API) */
265
- async close() {
266
- }
267
- };
268
- CacheVercelKvProvider = __decorateClass([
269
- (0, import_sdk3.Provider)({
270
- name: "provider:cache:vercel-kv",
271
- description: "Vercel KV-based cache provider",
272
- scope: import_sdk3.ProviderScope.GLOBAL
273
- })
274
- ], CacheVercelKvProvider);
275
-
276
- // libs/plugins/src/cache/cache.symbol.ts
277
- var CacheStoreToken = /* @__PURE__ */ Symbol("plugin:cache:store");
278
-
279
- // libs/plugins/src/cache/cache.plugin.ts
280
- var CachePlugin = class extends import_sdk4.DynamicPlugin {
281
- options;
282
- constructor(options = CachePlugin.defaultOptions) {
283
- super();
284
- this.options = {
285
- defaultTTL: 60 * 60 * 24,
286
- ...options
287
- };
288
- }
289
- async willReadCache(flowCtx) {
290
- const { tool, toolContext } = flowCtx.state;
291
- if (!tool || !toolContext) return;
292
- const { cache } = toolContext.metadata;
293
- if (!cache || typeof toolContext.input === "undefined") {
294
- return;
295
- }
296
- const cacheStore = this.get(CacheStoreToken);
297
- const hash = hashObject({ tool: tool.fullName, input: toolContext.input });
298
- const cached = await cacheStore.getValue(hash);
299
- if (cached !== void 0 && cached !== null) {
300
- if (cache === true || cache.ttl && cache.slideWindow) {
301
- const ttl = cache === true ? this.options.defaultTTL : cache.ttl ?? this.options.defaultTTL;
302
- await cacheStore.setValue(hash, cached, ttl);
303
- }
304
- if (!tool.safeParseOutput(cached).success) {
305
- await cacheStore.delete(hash);
306
- return;
307
- }
308
- flowCtx.state.rawOutput = cached;
309
- toolContext.respond(cached);
310
- }
311
- }
312
- async willWriteCache(flowCtx) {
313
- const { tool, toolContext } = flowCtx.state;
314
- if (!tool || !toolContext) return;
315
- const { cache } = toolContext.metadata;
316
- if (!cache || typeof toolContext.input === "undefined") {
317
- return;
318
- }
319
- const cacheStore = this.get(CacheStoreToken);
320
- const ttl = cache === true ? this.options.defaultTTL : cache.ttl ?? this.options.defaultTTL;
321
- const hash = hashObject({ tool: tool.fullName, input: toolContext.input });
322
- await cacheStore.setValue(hash, toolContext.output, ttl);
323
- }
324
- };
325
- __publicField(CachePlugin, "dynamicProviders", (options) => {
326
- const providers = [];
327
- switch (options.type) {
328
- case "global-store":
329
- providers.push({
330
- name: "cache:global-store",
331
- provide: CacheStoreToken,
332
- inject: () => [import_sdk4.FrontMcpConfig],
333
- useFactory: (config) => {
334
- const storeConfig = (0, import_sdk4.getGlobalStoreConfig)("CachePlugin", config);
335
- const globalOptions = options;
336
- if ((0, import_sdk4.isVercelKvProvider)(storeConfig)) {
337
- return new CacheVercelKvProvider({
338
- url: storeConfig.url,
339
- token: storeConfig.token,
340
- keyPrefix: storeConfig.keyPrefix,
341
- defaultTTL: globalOptions.defaultTTL
342
- });
343
- }
344
- return new CacheRedisProvider({
345
- type: "redis",
346
- config: {
347
- host: storeConfig.host ?? "localhost",
348
- port: storeConfig.port ?? 6379,
349
- password: storeConfig.password,
350
- db: storeConfig.db
351
- },
352
- defaultTTL: globalOptions.defaultTTL
353
- });
354
- }
355
- });
356
- break;
357
- case "redis":
358
- case "redis-client":
359
- providers.push({
360
- name: "cache:redis",
361
- provide: CacheStoreToken,
362
- useValue: new CacheRedisProvider(options)
363
- });
364
- break;
365
- case "memory":
366
- providers.push({
367
- name: "cache:memory",
368
- provide: CacheStoreToken,
369
- useValue: new CacheMemoryProvider(options.defaultTTL)
370
- });
371
- break;
372
- }
373
- return providers;
374
- });
375
- __publicField(CachePlugin, "defaultOptions", {
376
- type: "memory"
377
- });
378
- __decorateClass([
379
- import_sdk4.ToolHook.Will("execute", { priority: 1e3 })
380
- ], CachePlugin.prototype, "willReadCache", 1);
381
- __decorateClass([
382
- import_sdk4.ToolHook.Did("execute", { priority: 1e3 })
383
- ], CachePlugin.prototype, "willWriteCache", 1);
384
- CachePlugin = __decorateClass([
385
- (0, import_sdk4.Plugin)({
386
- name: "cache",
387
- description: "Cache plugin for caching tool results",
388
- providers: [
389
- /* add providers that always loaded with the plugin or default providers */
390
- {
391
- // this is a default provider for cache, will be overridden if dynamicProviders based on config
392
- name: "cache:memory",
393
- provide: CacheStoreToken,
394
- useValue: new CacheMemoryProvider(60 * 60 * 24)
395
- }
396
- ]
397
- })
398
- ], CachePlugin);
399
- function hashObject(obj) {
400
- const keys = Object.keys(obj).sort();
401
- return keys.reduce((acc, key) => {
402
- acc += key + ":";
403
- const val = obj[key];
404
- if (typeof val === "object" && val !== null) {
405
- acc += hashObject(val);
406
- } else {
407
- acc += String(val);
408
- }
409
- acc += ";";
410
- return acc;
411
- }, "");
412
- }
@@ -1,19 +0,0 @@
1
- import { CacheStoreInterface } from '../cache.types';
2
- export default class CacheMemoryProvider implements CacheStoreInterface {
3
- private readonly memory;
4
- private sweeper?;
5
- constructor(sweepIntervalTTL?: number);
6
- /** Set a value (auto-stringifies objects) */
7
- setValue(key: string, value: unknown, ttlSeconds?: number): Promise<void>;
8
- /** Get a value and automatically parse JSON if possible */
9
- getValue<T = unknown>(key: string, defaultValue?: T): Promise<T | undefined>;
10
- /** Delete a key */
11
- delete(key: string): Promise<void>;
12
- /** Check if a key exists (and not expired) */
13
- exists(key: string): Promise<boolean>;
14
- /** Gracefully close the provider */
15
- close(): Promise<void>;
16
- private isExpired;
17
- /** Periodically remove expired keys to keep memory tidy */
18
- private sweep;
19
- }
@@ -1,15 +0,0 @@
1
- import { CacheStoreInterface, RedisCacheOptions } from '../cache.types';
2
- export default class CacheRedisProvider implements CacheStoreInterface {
3
- private readonly client;
4
- constructor(options: RedisCacheOptions);
5
- /** Set a value (auto-stringifies objects) */
6
- setValue(key: string, value: unknown, ttlSeconds?: number): Promise<void>;
7
- /** Get a value and automatically parse JSON if possible */
8
- getValue<T = unknown>(key: string, defaultValue?: T): Promise<T | undefined>;
9
- /** Delete a key */
10
- delete(key: string): Promise<void>;
11
- /** Check if a key exists */
12
- exists(key: string): Promise<boolean>;
13
- /** Gracefully close the Redis connection */
14
- close(): Promise<void>;
15
- }
@@ -1,24 +0,0 @@
1
- import { CacheStoreInterface } from '../cache.types';
2
- export interface CacheVercelKvProviderOptions {
3
- url?: string;
4
- token?: string;
5
- keyPrefix?: string;
6
- defaultTTL?: number;
7
- }
8
- export default class CacheVercelKvProvider implements CacheStoreInterface {
9
- private kv;
10
- private readonly keyPrefix;
11
- private readonly defaultTTL;
12
- constructor(options?: CacheVercelKvProviderOptions);
13
- private prefixKey;
14
- /** Set a value (auto-stringifies objects) */
15
- setValue(key: string, value: unknown, ttlSeconds?: number): Promise<void>;
16
- /** Get a value and automatically parse JSON if possible */
17
- getValue<T = unknown>(key: string, defaultValue?: T): Promise<T | undefined>;
18
- /** Delete a key */
19
- delete(key: string): Promise<void>;
20
- /** Check if a key exists */
21
- exists(key: string): Promise<boolean>;
22
- /** Gracefully close the provider (no-op for Vercel KV - stateless REST API) */
23
- close(): Promise<void>;
24
- }
@@ -1,41 +0,0 @@
1
- import { DynamicPlugin, FlowCtxOf, ProviderType } from '@frontmcp/sdk';
2
- import { CodeCallPluginOptions, CodeCallPluginOptionsInput } from './codecall.types';
3
- export default class CodeCallPlugin extends DynamicPlugin<CodeCallPluginOptions, CodeCallPluginOptionsInput> {
4
- options: CodeCallPluginOptions;
5
- constructor(options?: CodeCallPluginOptionsInput);
6
- /**
7
- * Dynamic providers allow you to configure the plugin with custom options
8
- * without touching the plugin decorator.
9
- */
10
- static dynamicProviders(options: CodeCallPluginOptionsInput): ProviderType[];
11
- /**
12
- * Hook into list_tools to enforce CodeCall modes:
13
- *
14
- * Modes:
15
- * - codecall_only: Hide all tools from list_tools except CodeCall meta-tools.
16
- * All other tools must be discovered via codecall:search.
17
- * - codecall_opt_in: Show all tools in list_tools. Tools opt-in to CodeCall via metadata.
18
- * - metadata_driven: Use per-tool metadata.codecall to control visibility in list_tools.
19
- *
20
- * CodeCall meta-tools (codecall:search, codecall:describe, codecall:execute, codecall:invoke)
21
- * are ALWAYS visible regardless of mode.
22
- */
23
- adjustListTools(flowCtx: FlowCtxOf<'tools:list-tools'>): Promise<void>;
24
- /**
25
- * Determine if a tool should be visible in list_tools based on mode.
26
- *
27
- * @param tool - The tool entry to check
28
- * @param mode - The current CodeCall mode
29
- * @returns true if tool should be visible
30
- */
31
- private shouldShowInListTools;
32
- /**
33
- * Check if a tool is a CodeCall meta-tool.
34
- * CodeCall meta-tools always remain visible.
35
- */
36
- private isCodeCallTool;
37
- /**
38
- * Extract CodeCall-specific metadata from a tool.
39
- */
40
- private getCodeCallMetadata;
41
- }